diff --git a/go.mod b/go.mod index 6a3698e2..436c4f21 100644 --- a/go.mod +++ b/go.mod @@ -6,41 +6,41 @@ require ( github.com/TwinProduction/gocache v1.2.3 github.com/TwinProduction/health v1.0.0 github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.1 // indirect - github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663 + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/go-ping/ping v0.0.0-20210911151512-381826476871 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/golang/protobuf v1.4.3 // indirect - github.com/google/go-cmp v0.5.4 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/gorilla/mux v1.8.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/lib/pq v1.10.3 - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/miekg/dns v1.1.35 - github.com/prometheus/client_golang v1.9.0 + github.com/miekg/dns v1.1.43 + github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.15.0 // indirect - github.com/prometheus/procfs v0.2.0 // indirect + github.com/prometheus/common v0.31.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/wcharczuk/go-chart/v2 v2.1.0 - go.etcd.io/bbolt v1.3.5 // indirect - golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect + go.etcd.io/bbolt v1.3.6 // indirect golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect - golang.org/x/mod v0.4.0 // indirect - golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect - golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect - golang.org/x/tools v0.0.0-20201208233053-a543418bbed2 // indirect + golang.org/x/mod v0.5.1 // indirect + golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c // indirect + golang.org/x/tools v0.1.7 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/protobuf v1.25.0 // indirect + google.golang.org/protobuf v1.27.1 // indirect gopkg.in/yaml.v2 v2.4.0 lukechampine.com/uint128 v1.1.1 // indirect - modernc.org/cc/v3 v3.33.6 // indirect - modernc.org/ccgo/v3 v3.9.5 // indirect - modernc.org/libc v1.9.11 // indirect - modernc.org/mathutil v1.4.0 // indirect - modernc.org/memory v1.0.4 // indirect + modernc.org/cc/v3 v3.35.8 // indirect + modernc.org/ccgo/v3 v3.12.16 // indirect + modernc.org/libc v1.11.22 // indirect + modernc.org/mathutil v1.4.1 // indirect + modernc.org/memory v1.0.5 // indirect modernc.org/opt v0.1.1 // indirect - modernc.org/sqlite v1.11.2 + modernc.org/sqlite v1.13.1 modernc.org/strutil v1.1.1 // indirect modernc.org/token v1.0.0 // indirect ) diff --git a/go.sum b/go.sum index 44e4f26d..e79c54ce 100644 --- a/go.sum +++ b/go.sum @@ -1,91 +1,103 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/TwinProduction/gocache v1.2.3 h1:4wFNih4CemUX+A99Gk/EsaU0SXSNZV42Ve77v7/7ToY= github.com/TwinProduction/gocache v1.2.3/go.mod h1:Yj2daITit8TTBgiOpc26XCDSbg9xcFskUilHj9u3Mh8= github.com/TwinProduction/health v1.0.0 h1:TVyYTAORQQZ8LaptX8jCHZRCGCAO6e+oJx19BUIzQYY= github.com/TwinProduction/health v1.0.0/go.mod h1:ys4mYKUeEfYrWmkm60xLtPjTuLIEDQNBZaTZvenLG1c= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663 h1:jI2GiiRh+pPbey52EVmbU6kuLiXqwy4CXZ4gwUBj8Y0= -github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663/go.mod h1:35JbSyV/BYqHwwRA6Zr1uVDm1637YlNOU61wI797NPI= +github.com/go-ping/ping v0.0.0-20210911151512-381826476871 h1:wtjTfjwAR/BYYMJ+QOLI/3J/qGEI0fgrkZvgsEWK2/Q= +github.com/go-ping/ping v0.0.0-20210911151512-381826476871/go.mod h1:xIFjORFzTxqIV/tDVGO4eDy/bLuSyawEeojSm3GfRGk= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -93,69 +105,55 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -167,161 +165,98 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg= github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= -github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU= +github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.35 h1:oTfOaDH+mZkdcgdIjH6yBajRGtIwcwcaR+rt23ZSrJs= -github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= +github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQjKvxPRQIU= -github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= +github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= -github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.31.1 h1:d18hG4PkHnNAKNMOmFuXFaiY8Us0nird/2m60uS1AMs= +github.com/prometheus/common v0.31.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tidwall/redcon v1.3.2/go.mod h1:bdYBm4rlcWpst2XMwKVzWDF9CoUxEbUmM7CQrKeOZas= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/wcharczuk/go-chart/v2 v2.1.0 h1:tY2slqVQ6bN+yHSnDYwZebLQFkphK4WNrVwnt7CJZ2I= github.com/wcharczuk/go-chart/v2 v2.1.0/go.mod h1:yx7MvAVNcP/kN9lKXM/NTce4au4DFN99j6i1OwDclNA= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20200927104501-e162460cd6b5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= @@ -329,129 +264,250 @@ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6 h1:Z04ewVs7JhXaYkmDhBERPi41gnltfQpMWDnTnQbaCqk= +golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c h1:EyJTLQbOxvk8V6oDdD8ILR1BOs3nEJXThD6aqsiPNkM= +golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2 h1:vEtypaVub6UvKkiXZ2xx9QIvp9TL7sI7xp7vdi2kezA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -460,21 +516,20 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -482,39 +537,73 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.33.6 h1:r63dgSzVzRxUpAJFPQWHy1QeZeY1ydNENUDaBx1GqYc= modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/ccgo/v3 v3.9.5 h1:dEuUSf8WN51rDkprFuAqjfchKEzN0WttP/Py3enBwjk= +modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.35.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.35.4/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.35.5/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.35.7/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= +modernc.org/cc/v3 v3.35.8 h1:jJydTMwMwOdv78Ij8hZVTS2uLP8LroN0ey0r+dwFMJg= +modernc.org/cc/v3 v3.35.8/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60= +modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw= +modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI= +modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag= +modernc.org/ccgo/v3 v3.11.2/go.mod h1:6kii3AptTDI+nUrM9RFBoIEUEisSWCbdczD9ZwQH2FE= +modernc.org/ccgo/v3 v3.11.3/go.mod h1:0oHunRBMBiXOKdaglfMlRPBALQqsfrCKXgw9okQ3GEw= +modernc.org/ccgo/v3 v3.12.4/go.mod h1:Bk+m6m2tsooJchP/Yk5ji56cClmN6R1cqc9o/YtbgBQ= +modernc.org/ccgo/v3 v3.12.6/go.mod h1:0Ji3ruvpFPpz+yu+1m0wk68pdr/LENABhTrDkMDWH6c= +modernc.org/ccgo/v3 v3.12.8/go.mod h1:Hq9keM4ZfjCDuDXxaHptpv9N24JhgBZmUG5q60iLgUo= +modernc.org/ccgo/v3 v3.12.11/go.mod h1:0jVcmyDwDKDGWbcrzQ+xwJjbhZruHtouiBEvDfoIsdg= +modernc.org/ccgo/v3 v3.12.14/go.mod h1:GhTu1k0YCpJSuWwtRAEHAol5W7g1/RRfS4/9hc9vF5I= +modernc.org/ccgo/v3 v3.12.16 h1:UTOh3qwbtGTT2bAPkU3y05xyj4haNiRuzs/QqIspjhw= +modernc.org/ccgo/v3 v3.12.16/go.mod h1:4Irvb6s9pzGIjrtVfvDDgoAQAH/L7KpHjgTYvcAMXV0= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= -modernc.org/libc v1.9.11 h1:QUxZMs48Ahg2F7SN41aERvMfGLY2HU/ADnB9DC4Yts8= modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q= +modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg= +modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M= +modernc.org/libc v1.11.3/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU= +modernc.org/libc v1.11.5/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU= +modernc.org/libc v1.11.6/go.mod h1:ddqmzR6p5i4jIGK1d/EiSw97LBcE3dK24QEwCFvgNgE= +modernc.org/libc v1.11.11/go.mod h1:lXEp9QOOk4qAYOtL3BmMve99S5Owz7Qyowzvg6LiZso= +modernc.org/libc v1.11.13/go.mod h1:ZYawJWlXIzXy2Pzghaf7YfM8OKacP3eZQI81PDLFdY8= +modernc.org/libc v1.11.16/go.mod h1:+DJquzYi+DMRUtWI1YNxrlQO6TcA5+dRRiq8HWBWRC8= +modernc.org/libc v1.11.19/go.mod h1:e0dgEame6mkydy19KKaVPBeEnyJB4LGNb0bBH1EtQ3I= +modernc.org/libc v1.11.22 h1:u2ek1qgzki0RUDI2kW3EC9VKHP9LXKxKnoQLZmIeCbA= +modernc.org/libc v1.11.22/go.mod h1:FOSzE0UwookyT1TtCJrRkvsOrX2k38HoInhw+cSCUGk= modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.0 h1:GCjoRaBew8ECCKINQA2nYjzvufFW9YiEuuB+rQ9bn2E= modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.0.4 h1:utMBrFcpnQDdNsmM6asmyH/FM9TqLPS7XF7otpJmrwM= +modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8= +modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= +modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14= +modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM= modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A= modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.11.2 h1:ShWQpeD3ag/bmx6TqidBlIWonWmQaSQKls3aenCbt+w= -modernc.org/sqlite v1.11.2/go.mod h1:+mhs/P1ONd+6G7hcAs6irwDi/bjTQ7nLW6LHRBsEa3A= +modernc.org/sqlite v1.13.1 h1:s/qk6VTTVyQIyhVNWa50whBBcI3+2oREbx85t227iOo= +modernc.org/sqlite v1.13.1/go.mod h1:2qO/6jZJrcQaxFUHxOwa6Q6WfiGSsiVj6GXX0Ker+Jg= modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/tcl v1.5.5 h1:N03RwthgTR/l/eQvz3UjfYnvVVj1G2sZqzFGfoD4HE4= -modernc.org/tcl v1.5.5/go.mod h1:ADkaTUuwukkrlhqwERyq0SM8OvyXo7+TjFz7yAF56EI= +modernc.org/tcl v1.5.9 h1:DZMfR+RDJRhcrmMEMTJgVIX+Wf5qhfVX0llI0rsc20w= +modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE= modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.0.1 h1:WyIDpEpAIx4Hel6q/Pcgj/VhaQV5XPJ2I6ryIYbjnpc= -modernc.org/z v1.0.1/go.mod h1:8/SRk5C/HgiQWCgXdfpb+1RvhORdkz5sw72d3jjtyqA= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +modernc.org/z v1.1.2 h1:IjjzDsIFbl0wuF2KfwvdyUAJVwxD4iwZ6akLNiDoClM= +modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/github.com/cespare/xxhash/v2/.travis.yml b/vendor/github.com/cespare/xxhash/v2/.travis.yml deleted file mode 100644 index c516ea88..00000000 --- a/vendor/github.com/cespare/xxhash/v2/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go -go: - - "1.x" - - master -env: - - TAGS="" - - TAGS="-tags purego" -script: go test $TAGS -v ./... diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md index 2fd8693c..792b4a60 100644 --- a/vendor/github.com/cespare/xxhash/v2/README.md +++ b/vendor/github.com/cespare/xxhash/v2/README.md @@ -1,7 +1,7 @@ # xxhash -[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) -[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) +[![Go Reference](https://pkg.go.dev/badge/github.com/cespare/xxhash/v2.svg)](https://pkg.go.dev/github.com/cespare/xxhash/v2) +[![Test](https://github.com/cespare/xxhash/actions/workflows/test.yml/badge.svg)](https://github.com/cespare/xxhash/actions/workflows/test.yml) xxhash is a Go implementation of the 64-bit [xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a @@ -64,4 +64,6 @@ $ go test -benchtime 10s -bench '/xxhash,direct,bytes' - [InfluxDB](https://github.com/influxdata/influxdb) - [Prometheus](https://github.com/prometheus/prometheus) +- [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) - [FreeCache](https://github.com/coocood/freecache) +- [FastCache](https://github.com/VictoriaMetrics/fastcache) diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go index db0b35fb..15c835d5 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash.go @@ -193,7 +193,6 @@ func (d *Digest) UnmarshalBinary(b []byte) error { b, d.v4 = consumeUint64(b) b, d.total = consumeUint64(b) copy(d.mem[:], b) - b = b[len(d.mem):] d.n = int(d.total % uint64(len(d.mem))) return nil } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s index d580e32a..be8db5bf 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s @@ -6,7 +6,7 @@ // Register allocation: // AX h -// CX pointer to advance through b +// SI pointer to advance through b // DX n // BX loop end // R8 v1, k1 @@ -16,39 +16,39 @@ // R12 tmp // R13 prime1v // R14 prime2v -// R15 prime4v +// DI prime4v -// round reads from and advances the buffer pointer in CX. +// round reads from and advances the buffer pointer in SI. // It assumes that R13 has prime1v and R14 has prime2v. #define round(r) \ - MOVQ (CX), R12 \ - ADDQ $8, CX \ + MOVQ (SI), R12 \ + ADDQ $8, SI \ IMULQ R14, R12 \ ADDQ R12, r \ ROLQ $31, r \ IMULQ R13, r // mergeRound applies a merge round on the two registers acc and val. -// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v. +// It assumes that R13 has prime1v, R14 has prime2v, and DI has prime4v. #define mergeRound(acc, val) \ IMULQ R14, val \ ROLQ $31, val \ IMULQ R13, val \ XORQ val, acc \ IMULQ R13, acc \ - ADDQ R15, acc + ADDQ DI, acc // func Sum64(b []byte) uint64 TEXT ·Sum64(SB), NOSPLIT, $0-32 // Load fixed primes. MOVQ ·prime1v(SB), R13 MOVQ ·prime2v(SB), R14 - MOVQ ·prime4v(SB), R15 + MOVQ ·prime4v(SB), DI // Load slice. - MOVQ b_base+0(FP), CX + MOVQ b_base+0(FP), SI MOVQ b_len+8(FP), DX - LEAQ (CX)(DX*1), BX + LEAQ (SI)(DX*1), BX // The first loop limit will be len(b)-32. SUBQ $32, BX @@ -65,14 +65,14 @@ TEXT ·Sum64(SB), NOSPLIT, $0-32 XORQ R11, R11 SUBQ R13, R11 - // Loop until CX > BX. + // Loop until SI > BX. blockLoop: round(R8) round(R9) round(R10) round(R11) - CMPQ CX, BX + CMPQ SI, BX JLE blockLoop MOVQ R8, AX @@ -100,16 +100,16 @@ noBlocks: afterBlocks: ADDQ DX, AX - // Right now BX has len(b)-32, and we want to loop until CX > len(b)-8. + // Right now BX has len(b)-32, and we want to loop until SI > len(b)-8. ADDQ $24, BX - CMPQ CX, BX + CMPQ SI, BX JG fourByte wordLoop: // Calculate k1. - MOVQ (CX), R8 - ADDQ $8, CX + MOVQ (SI), R8 + ADDQ $8, SI IMULQ R14, R8 ROLQ $31, R8 IMULQ R13, R8 @@ -117,18 +117,18 @@ wordLoop: XORQ R8, AX ROLQ $27, AX IMULQ R13, AX - ADDQ R15, AX + ADDQ DI, AX - CMPQ CX, BX + CMPQ SI, BX JLE wordLoop fourByte: ADDQ $4, BX - CMPQ CX, BX + CMPQ SI, BX JG singles - MOVL (CX), R8 - ADDQ $4, CX + MOVL (SI), R8 + ADDQ $4, SI IMULQ R13, R8 XORQ R8, AX @@ -138,19 +138,19 @@ fourByte: singles: ADDQ $4, BX - CMPQ CX, BX + CMPQ SI, BX JGE finalize singlesLoop: - MOVBQZX (CX), R12 - ADDQ $1, CX + MOVBQZX (SI), R12 + ADDQ $1, SI IMULQ ·prime5v(SB), R12 XORQ R12, AX ROLQ $11, AX IMULQ R13, AX - CMPQ CX, BX + CMPQ SI, BX JL singlesLoop finalize: @@ -179,9 +179,9 @@ TEXT ·writeBlocks(SB), NOSPLIT, $0-40 MOVQ ·prime2v(SB), R14 // Load slice. - MOVQ b_base+8(FP), CX + MOVQ b_base+8(FP), SI MOVQ b_len+16(FP), DX - LEAQ (CX)(DX*1), BX + LEAQ (SI)(DX*1), BX SUBQ $32, BX // Load vN from d. @@ -199,7 +199,7 @@ blockLoop: round(R10) round(R11) - CMPQ CX, BX + CMPQ SI, BX JLE blockLoop // Copy vN back to d. @@ -208,8 +208,8 @@ blockLoop: MOVQ R10, 16(AX) MOVQ R11, 24(AX) - // The number of bytes written is CX minus the old base pointer. - SUBQ b_base+8(FP), CX - MOVQ CX, ret+32(FP) + // The number of bytes written is SI minus the old base pointer. + SUBQ b_base+8(FP), SI + MOVQ SI, ret+32(FP) RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go index 53bf76ef..376e0ca2 100644 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go @@ -6,41 +6,52 @@ package xxhash import ( - "reflect" "unsafe" ) -// Notes: -// -// See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ -// for some discussion about these unsafe conversions. -// // In the future it's possible that compiler optimizations will make these -// unsafe operations unnecessary: https://golang.org/issue/2205. +// XxxString functions unnecessary by realizing that calls such as +// Sum64([]byte(s)) don't need to copy s. See https://golang.org/issue/2205. +// If that happens, even if we keep these functions they can be replaced with +// the trivial safe code. + +// NOTE: The usual way of doing an unsafe string-to-[]byte conversion is: // -// Both of these wrapper functions still incur function call overhead since they -// will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write -// for strings to squeeze out a bit more speed. Mid-stack inlining should -// eventually fix this. +// var b []byte +// bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) +// bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data +// bh.Len = len(s) +// bh.Cap = len(s) +// +// Unfortunately, as of Go 1.15.3 the inliner's cost model assigns a high enough +// weight to this sequence of expressions that any function that uses it will +// not be inlined. Instead, the functions below use a different unsafe +// conversion designed to minimize the inliner weight and allow both to be +// inlined. There is also a test (TestInlining) which verifies that these are +// inlined. +// +// See https://github.com/golang/go/issues/42739 for discussion. // Sum64String computes the 64-bit xxHash digest of s. // It may be faster than Sum64([]byte(s)) by avoiding a copy. func Sum64String(s string) uint64 { - var b []byte - bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data - bh.Len = len(s) - bh.Cap = len(s) + b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})) return Sum64(b) } // WriteString adds more data to d. It always returns len(s), nil. // It may be faster than Write([]byte(s)) by avoiding a copy. func (d *Digest) WriteString(s string) (n int, err error) { - var b []byte - bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data - bh.Len = len(s) - bh.Cap = len(s) - return d.Write(b) + d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)}))) + // d.Write always returns len(s), nil. + // Ignoring the return output and returning these fixed values buys a + // savings of 6 in the inliner's cost model. + return len(s), nil +} + +// sliceHeader is similar to reflect.SliceHeader, but it assumes that the layout +// of the first two words is the same as the layout of a string. +type sliceHeader struct { + s string + cap int } diff --git a/vendor/github.com/go-ping/ping/CONTRIBUTING.md b/vendor/github.com/go-ping/ping/CONTRIBUTING.md new file mode 100644 index 00000000..001998de --- /dev/null +++ b/vendor/github.com/go-ping/ping/CONTRIBUTING.md @@ -0,0 +1,44 @@ +# Contributing + +First off, thanks for taking the time to contribute! + +Remember that this is open source software so please consider the other people who will read your code. +Make it look nice for them, document your logic in comments and add or update the unit test cases. + +This library is used by various other projects, companies and individuals in live production environments so please discuss any breaking changes with us before making them. +Feel free to join us in the #go-ping channel of the [Gophers Slack](https://invite.slack.golangbridge.org/). + +## Pull Requests + +[Fork the repo on GitHub](https://github.com/go-ping/ping/fork) and clone it to your local machine. + +```bash +git clone https://github.com/YOUR_USERNAME/ping.git && cd ping +``` + +Here is a guide on [how to configure a remote repository](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork). + +Check out a new branch, make changes, run tests, commit & sign-off, then push branch to your fork. + +```bash +$ git checkout -b +# edit files +$ make style vet test +$ git add +$ git commit -s +$ git push +``` + +Open a [new pull request](https://github.com/go-ping/ping/compare) in the main `go-ping/ping` repository. +Please describe the purpose of your PR and remember link it to any related issues. + +*We may ask you to rebase your feature branch or squash the commits in order to keep the history clean.* + +## Development Guides + +- Run `make style vet test` before committing your changes. +- Document your logic in code comments. +- Add tests for bug fixes and new features. +- Use UNIX-style (LF) line endings. +- End every file with a single blank line. +- Use the UTF-8 character set. diff --git a/vendor/github.com/go-ping/ping/README.md b/vendor/github.com/go-ping/ping/README.md index 7fbdd4df..8074587b 100644 --- a/vendor/github.com/go-ping/ping/README.md +++ b/vendor/github.com/go-ping/ping/README.md @@ -17,7 +17,7 @@ err = pinger.Run() // Blocks until finished. if err != nil { panic(err) } -stats := pinger.Statistics() // get send/receive/rtt stats +stats := pinger.Statistics() // get send/receive/duplicate/rtt stats ``` Here is an example that emulates the traditional UNIX ping command: @@ -42,6 +42,11 @@ pinger.OnRecv = func(pkt *ping.Packet) { pkt.Nbytes, pkt.IPAddr, pkt.Seq, pkt.Rtt) } +pinger.OnDuplicateRecv = func(pkt *ping.Packet) { + fmt.Printf("%d bytes from %s: icmp_seq=%d time=%v ttl=%v (DUP!)\n", + pkt.Nbytes, pkt.IPAddr, pkt.Seq, pkt.Rtt, pkt.Ttl) +} + pinger.OnFinish = func(stats *ping.Statistics) { fmt.Printf("\n--- %s ping statistics ---\n", stats.Addr) fmt.Printf("%d packets transmitted, %d packets received, %v%% packet loss\n", @@ -58,8 +63,10 @@ if err != nil { ``` It sends ICMP Echo Request packet(s) and waits for an Echo Reply in -response. If it receives a response, it calls the `OnRecv` callback. -When it's finished, it calls the `OnFinish` callback. +response. If it receives a response, it calls the `OnRecv` callback +unless a packet with that sequence number has already been received, +in which case it calls the `OnDuplicateRecv` callback. When it's +finished, it calls the `OnFinish` callback. For a full ping example, see [cmd/ping/ping.go](https://github.com/go-ping/ping/blob/master/cmd/ping/ping.go). @@ -128,3 +135,7 @@ This repo was originally in the personal account of For support and help, you usually find us in the #go-ping channel of Gophers Slack. See https://invite.slack.golangbridge.org/ for an invite to the Gophers Slack org. + +## Contributing + +Refer to [CONTRIBUTING.md](https://github.com/go-ping/ping/blob/master/CONTRIBUTING.md) diff --git a/vendor/github.com/go-ping/ping/logger.go b/vendor/github.com/go-ping/ping/logger.go new file mode 100644 index 00000000..be3d4fa2 --- /dev/null +++ b/vendor/github.com/go-ping/ping/logger.go @@ -0,0 +1,53 @@ +package ping + +import "log" + +type Logger interface { + Fatalf(format string, v ...interface{}) + Errorf(format string, v ...interface{}) + Warnf(format string, v ...interface{}) + Infof(format string, v ...interface{}) + Debugf(format string, v ...interface{}) +} + +type StdLogger struct { + Logger *log.Logger +} + +func (l StdLogger) Fatalf(format string, v ...interface{}) { + l.Logger.Printf("FATAL: "+format, v...) +} + +func (l StdLogger) Errorf(format string, v ...interface{}) { + l.Logger.Printf("ERROR: "+format, v...) +} + +func (l StdLogger) Warnf(format string, v ...interface{}) { + l.Logger.Printf("WARN: "+format, v...) +} + +func (l StdLogger) Infof(format string, v ...interface{}) { + l.Logger.Printf("INFO: "+format, v...) +} + +func (l StdLogger) Debugf(format string, v ...interface{}) { + l.Logger.Printf("DEBUG: "+format, v...) +} + +type NoopLogger struct { +} + +func (l NoopLogger) Fatalf(format string, v ...interface{}) { +} + +func (l NoopLogger) Errorf(format string, v ...interface{}) { +} + +func (l NoopLogger) Warnf(format string, v ...interface{}) { +} + +func (l NoopLogger) Infof(format string, v ...interface{}) { +} + +func (l NoopLogger) Debugf(format string, v ...interface{}) { +} diff --git a/vendor/github.com/go-ping/ping/packetconn.go b/vendor/github.com/go-ping/ping/packetconn.go new file mode 100644 index 00000000..a590bfb3 --- /dev/null +++ b/vendor/github.com/go-ping/ping/packetconn.go @@ -0,0 +1,86 @@ +package ping + +import ( + "net" + "runtime" + "time" + + "golang.org/x/net/icmp" + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" +) + +type packetConn interface { + Close() error + ICMPRequestType() icmp.Type + ReadFrom(b []byte) (n int, ttl int, src net.Addr, err error) + SetFlagTTL() error + SetReadDeadline(t time.Time) error + WriteTo(b []byte, dst net.Addr) (int, error) +} + +type icmpConn struct { + c *icmp.PacketConn +} + +func (c *icmpConn) Close() error { + return c.c.Close() +} + +func (c *icmpConn) SetReadDeadline(t time.Time) error { + return c.c.SetReadDeadline(t) +} + +func (c *icmpConn) WriteTo(b []byte, dst net.Addr) (int, error) { + return c.c.WriteTo(b, dst) +} + +type icmpv4Conn struct { + icmpConn +} + +func (c *icmpv4Conn) SetFlagTTL() error { + err := c.c.IPv4PacketConn().SetControlMessage(ipv4.FlagTTL, true) + if runtime.GOOS == "windows" { + return nil + } + return err +} + +func (c *icmpv4Conn) ReadFrom(b []byte) (int, int, net.Addr, error) { + var ttl int + n, cm, src, err := c.c.IPv4PacketConn().ReadFrom(b) + if cm != nil { + ttl = cm.TTL + } + return n, ttl, src, err +} + +func (c icmpv4Conn) ICMPRequestType() icmp.Type { + return ipv4.ICMPTypeEcho +} + +type icmpV6Conn struct { + icmpConn +} + +func (c *icmpV6Conn) SetFlagTTL() error { + err := c.c.IPv6PacketConn().SetControlMessage(ipv6.FlagHopLimit, true) + if runtime.GOOS == "windows" { + return nil + } + return err +} + +func (c *icmpV6Conn) ReadFrom(b []byte) (int, int, net.Addr, error) { + var ttl int + n, cm, src, err := c.c.IPv6PacketConn().ReadFrom(b) + if cm != nil { + ttl = cm.HopLimit + } + return n, ttl, src, err +} + +func (c icmpV6Conn) ICMPRequestType() icmp.Type { + return ipv6.ICMPTypeEchoRequest +} diff --git a/vendor/github.com/go-ping/ping/ping.go b/vendor/github.com/go-ping/ping/ping.go index 0ed08490..8e789528 100644 --- a/vendor/github.com/go-ping/ping/ping.go +++ b/vendor/github.com/go-ping/ping/ping.go @@ -54,25 +54,27 @@ package ping import ( "bytes" - "encoding/binary" "errors" "fmt" + "log" "math" "math/rand" "net" - "runtime" "sync" + "sync/atomic" "syscall" "time" + "github.com/google/uuid" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" + "golang.org/x/sync/errgroup" ) const ( timeSliceLength = 8 - trackerLength = 8 + trackerLength = len(uuid.UUID{}) protocolICMP = 1 protocolIPv6ICMP = 58 ) @@ -84,22 +86,27 @@ var ( // New returns a new Pinger struct pointer. func New(addr string) *Pinger { - r := rand.New(rand.NewSource(time.Now().UnixNano())) + r := rand.New(rand.NewSource(getSeed())) + firstUUID := uuid.New() + var firstSequence = map[uuid.UUID]map[int]struct{}{} + firstSequence[firstUUID] = make(map[int]struct{}) return &Pinger{ Count: -1, Interval: time.Second, RecordRtts: true, - Size: timeSliceLength, - Timeout: time.Second * 100000, - Tracker: r.Int63n(math.MaxInt64), + Size: timeSliceLength + trackerLength, + Timeout: time.Duration(math.MaxInt64), - addr: addr, - done: make(chan bool), - id: r.Intn(math.MaxInt16), - ipaddr: nil, - ipv4: false, - network: "ip", - protocol: "udp", + addr: addr, + done: make(chan interface{}), + id: r.Intn(math.MaxUint16), + trackerUUIDs: []uuid.UUID{firstUUID}, + ipaddr: nil, + ipv4: false, + network: "ip", + protocol: "udp", + awaitingSequences: firstSequence, + logger: StdLogger{Logger: log.New(log.Writer(), log.Prefix(), log.Flags())}, } } @@ -132,6 +139,17 @@ type Pinger struct { // Number of packets received PacketsRecv int + // Number of duplicate packets received + PacketsRecvDuplicates int + + // Round trip time statistics + minRtt time.Duration + maxRtt time.Duration + avgRtt time.Duration + stdDevRtt time.Duration + stddevm2 time.Duration + statsMu sync.RWMutex + // If true, keep a record of rtts of all received packets. // Set to false to avoid memory bloat for long running pings. RecordRtts bool @@ -139,6 +157,9 @@ type Pinger struct { // rtts is all of the Rtts rtts []time.Duration + // OnSetup is called when Pinger has finished setting up the listening socket + OnSetup func() + // OnSend is called when Pinger sends a packet OnSend func(*Packet) @@ -148,28 +169,39 @@ type Pinger struct { // OnFinish is called when Pinger exits OnFinish func(*Statistics) + // OnDuplicateRecv is called when a packet is received that has already been received. + OnDuplicateRecv func(*Packet) + // Size of packet being sent Size int - // Tracker: Used to uniquely identify packet when non-priviledged - Tracker int64 + // Tracker: Used to uniquely identify packets - Deprecated + Tracker uint64 // Source is the source IP address Source string - // stop chan bool - done chan bool + // Channel and mutex used to communicate when the Pinger should stop between goroutines. + done chan interface{} + lock sync.Mutex ipaddr *net.IPAddr addr string + // trackerUUIDs is the list of UUIDs being used for sending packets. + trackerUUIDs []uuid.UUID + ipv4 bool id int sequence int + // awaitingSequences are in-flight sequence numbers we keep track of to help remove duplicate receipts + awaitingSequences map[uuid.UUID]map[int]struct{} // network is one of "ip", "ip4", or "ip6". network string // protocol is "icmp" or "udp". protocol string + + logger Logger } type packet struct { @@ -208,6 +240,9 @@ type Statistics struct { // PacketsSent is the number of packets sent. PacketsSent int + // PacketsRecvDuplicates is the number of duplicate responses there were to a sent packet. + PacketsRecvDuplicates int + // PacketLoss is the percentage of packets lost. PacketLoss float64 @@ -234,6 +269,34 @@ type Statistics struct { StdDevRtt time.Duration } +func (p *Pinger) updateStatistics(pkt *Packet) { + p.statsMu.Lock() + defer p.statsMu.Unlock() + + p.PacketsRecv++ + if p.RecordRtts { + p.rtts = append(p.rtts, pkt.Rtt) + } + + if p.PacketsRecv == 1 || pkt.Rtt < p.minRtt { + p.minRtt = pkt.Rtt + } + + if pkt.Rtt > p.maxRtt { + p.maxRtt = pkt.Rtt + } + + pktCount := time.Duration(p.PacketsRecv) + // welford's online method for stddev + // https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm + delta := pkt.Rtt - p.avgRtt + p.avgRtt += delta / pktCount + delta2 := pkt.Rtt - p.avgRtt + p.stddevm2 += delta * delta2 + + p.stdDevRtt = time.Duration(math.Sqrt(float64(p.stddevm2 / pktCount))) +} + // SetIPAddr sets the ip address of the target host. func (p *Pinger) SetIPAddr(ipaddr *net.IPAddr) { p.ipv4 = isIPv4(ipaddr.IP) @@ -314,88 +377,128 @@ func (p *Pinger) Privileged() bool { return p.protocol == "icmp" } +// SetLogger sets the logger to be used to log events from the pinger. +func (p *Pinger) SetLogger(logger Logger) { + p.logger = logger +} + // Run runs the pinger. This is a blocking function that will exit when it's // done. If Count or Interval are not specified, it will run continuously until // it is interrupted. func (p *Pinger) Run() error { - var conn *icmp.PacketConn + var conn packetConn var err error + if p.Size < timeSliceLength+trackerLength { + return fmt.Errorf("size %d is less than minimum required size %d", p.Size, timeSliceLength+trackerLength) + } if p.ipaddr == nil { err = p.Resolve() } if err != nil { return err } - if p.ipv4 { - if conn, err = p.listen(ipv4Proto[p.protocol]); err != nil { - return err - } - if err = conn.IPv4PacketConn().SetControlMessage(ipv4.FlagTTL, true); runtime.GOOS != "windows" && err != nil { - return err - } - } else { - if conn, err = p.listen(ipv6Proto[p.protocol]); err != nil { - return err - } - if err = conn.IPv6PacketConn().SetControlMessage(ipv6.FlagHopLimit, true); runtime.GOOS != "windows" && err != nil { - return err - } + if conn, err = p.listen(); err != nil { + return err } defer conn.Close() + + return p.run(conn) +} + +func (p *Pinger) run(conn packetConn) error { + if err := conn.SetFlagTTL(); err != nil { + return err + } defer p.finish() - var wg sync.WaitGroup recv := make(chan *packet, 5) defer close(recv) - wg.Add(1) - //nolint:errcheck - go p.recvICMP(conn, recv, &wg) - err = p.sendICMP(conn) - if err != nil { - return err + if handler := p.OnSetup; handler != nil { + handler() + } + + var g errgroup.Group + + g.Go(func() error { + defer p.Stop() + return p.recvICMP(conn, recv) + }) + + g.Go(func() error { + defer p.Stop() + return p.runLoop(conn, recv) + }) + + return g.Wait() +} + +func (p *Pinger) runLoop( + conn packetConn, + recvCh <-chan *packet, +) error { + logger := p.logger + if logger == nil { + logger = NoopLogger{} } timeout := time.NewTicker(p.Timeout) - defer timeout.Stop() interval := time.NewTicker(p.Interval) - defer interval.Stop() + defer func() { + p.Stop() + interval.Stop() + timeout.Stop() + }() + + if err := p.sendICMP(conn); err != nil { + return err + } for { select { case <-p.done: - wg.Wait() return nil + case <-timeout.C: - close(p.done) - wg.Wait() return nil - case <-interval.C: - if p.Count > 0 && p.PacketsSent >= p.Count { - continue - } - err = p.sendICMP(conn) - if err != nil { - // FIXME: this logs as FATAL but continues - fmt.Println("FATAL: ", err.Error()) - } - case r := <-recv: + + case r := <-recvCh: err := p.processPacket(r) if err != nil { // FIXME: this logs as FATAL but continues - fmt.Println("FATAL: ", err.Error()) + logger.Fatalf("processing received packet: %s", err) + } + + case <-interval.C: + if p.Count > 0 && p.PacketsSent >= p.Count { + interval.Stop() + continue + } + err := p.sendICMP(conn) + if err != nil { + // FIXME: this logs as FATAL but continues + logger.Fatalf("sending packet: %s", err) } } if p.Count > 0 && p.PacketsRecv >= p.Count { - close(p.done) - wg.Wait() return nil } } } func (p *Pinger) Stop() { - close(p.done) + p.lock.Lock() + defer p.lock.Unlock() + + open := true + select { + case _, open = <-p.done: + default: + } + + if open { + close(p.done) + } } func (p *Pinger) finish() { @@ -410,83 +513,73 @@ func (p *Pinger) finish() { // pinger is running or after it is finished. OnFinish calls this function to // get it's finished statistics. func (p *Pinger) Statistics() *Statistics { - loss := float64(p.PacketsSent-p.PacketsRecv) / float64(p.PacketsSent) * 100 - var min, max, total time.Duration - if len(p.rtts) > 0 { - min = p.rtts[0] - max = p.rtts[0] - } - for _, rtt := range p.rtts { - if rtt < min { - min = rtt - } - if rtt > max { - max = rtt - } - total += rtt - } + p.statsMu.RLock() + defer p.statsMu.RUnlock() + sent := p.PacketsSent + loss := float64(sent-p.PacketsRecv) / float64(sent) * 100 s := Statistics{ - PacketsSent: p.PacketsSent, - PacketsRecv: p.PacketsRecv, - PacketLoss: loss, - Rtts: p.rtts, - Addr: p.addr, - IPAddr: p.ipaddr, - MaxRtt: max, - MinRtt: min, - } - if len(p.rtts) > 0 { - s.AvgRtt = total / time.Duration(len(p.rtts)) - var sumsquares time.Duration - for _, rtt := range p.rtts { - sumsquares += (rtt - s.AvgRtt) * (rtt - s.AvgRtt) - } - s.StdDevRtt = time.Duration(math.Sqrt( - float64(sumsquares / time.Duration(len(p.rtts))))) + PacketsSent: sent, + PacketsRecv: p.PacketsRecv, + PacketsRecvDuplicates: p.PacketsRecvDuplicates, + PacketLoss: loss, + Rtts: p.rtts, + Addr: p.addr, + IPAddr: p.ipaddr, + MaxRtt: p.maxRtt, + MinRtt: p.minRtt, + AvgRtt: p.avgRtt, + StdDevRtt: p.stdDevRtt, } return &s } +type expBackoff struct { + baseDelay time.Duration + maxExp int64 + c int64 +} + +func (b *expBackoff) Get() time.Duration { + if b.c < b.maxExp { + b.c++ + } + + return b.baseDelay * time.Duration(rand.Int63n(1< 0 { t = append(t, bytes.Repeat([]byte{1}, remainSize)...) } @@ -591,7 +705,7 @@ func (p *Pinger) sendICMP(conn *icmp.PacketConn) error { } msg := &icmp.Message{ - Type: typ, + Type: conn.ICMPRequestType(), Code: 0, Body: body, } @@ -608,6 +722,7 @@ func (p *Pinger) sendICMP(conn *icmp.PacketConn) error { continue } } + return err } handler := p.OnSend if handler != nil { @@ -619,19 +734,40 @@ func (p *Pinger) sendICMP(conn *icmp.PacketConn) error { } handler(outPkt) } - + // mark this sequence as in-flight + p.awaitingSequences[currentUUID][p.sequence] = struct{}{} p.PacketsSent++ p.sequence++ + if p.sequence > 65535 { + newUUID := uuid.New() + p.trackerUUIDs = append(p.trackerUUIDs, newUUID) + p.awaitingSequences[newUUID] = make(map[int]struct{}) + p.sequence = 0 + } break } return nil } -func (p *Pinger) listen(netProto string) (*icmp.PacketConn, error) { - conn, err := icmp.ListenPacket(netProto, p.Source) +func (p *Pinger) listen() (packetConn, error) { + var ( + conn packetConn + err error + ) + + if p.ipv4 { + var c icmpv4Conn + c.c, err = icmp.ListenPacket(ipv4Proto[p.protocol], p.Source) + conn = &c + } else { + var c icmpV6Conn + c.c, err = icmp.ListenPacket(ipv6Proto[p.protocol], p.Source) + conn = &c + } + if err != nil { - close(p.done) + p.Stop() return nil, err } return conn, nil @@ -658,12 +794,9 @@ func timeToBytes(t time.Time) []byte { return b } -func bytesToInt(b []byte) int64 { - return int64(binary.BigEndian.Uint64(b)) -} +var seed int64 = time.Now().UnixNano() -func intToBytes(tracker int64) []byte { - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, uint64(tracker)) - return b +// getSeed returns a goroutine-safe unique seed +func getSeed() int64 { + return atomic.AddInt64(&seed, 1) } diff --git a/vendor/github.com/go-ping/ping/utils_linux.go b/vendor/github.com/go-ping/ping/utils_linux.go new file mode 100644 index 00000000..ba785d2e --- /dev/null +++ b/vendor/github.com/go-ping/ping/utils_linux.go @@ -0,0 +1,19 @@ +// +build linux + +package ping + +// Returns the length of an ICMP message. +func (p *Pinger) getMessageLength() int { + return p.Size + 8 +} + +// Attempts to match the ID of an ICMP packet. +func (p *Pinger) matchID(ID int) bool { + // On Linux we can only match ID if we are privileged. + if p.protocol == "icmp" { + if ID != p.id { + return false + } + } + return true +} diff --git a/vendor/github.com/go-ping/ping/utils_other.go b/vendor/github.com/go-ping/ping/utils_other.go new file mode 100644 index 00000000..6ccbe789 --- /dev/null +++ b/vendor/github.com/go-ping/ping/utils_other.go @@ -0,0 +1,16 @@ +// +build !linux,!windows + +package ping + +// Returns the length of an ICMP message. +func (p *Pinger) getMessageLength() int { + return p.Size + 8 +} + +// Attempts to match the ID of an ICMP packet. +func (p *Pinger) matchID(ID int) bool { + if ID != p.id { + return false + } + return true +} diff --git a/vendor/github.com/go-ping/ping/utils_windows.go b/vendor/github.com/go-ping/ping/utils_windows.go new file mode 100644 index 00000000..ba642bc9 --- /dev/null +++ b/vendor/github.com/go-ping/ping/utils_windows.go @@ -0,0 +1,24 @@ +// +build windows + +package ping + +import ( + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" +) + +// Returns the length of an ICMP message, plus the IP packet header. +func (p *Pinger) getMessageLength() int { + if p.ipv4 { + return p.Size + 8 + ipv4.HeaderLen + } + return p.Size + 8 + ipv6.HeaderLen +} + +// Attempts to match the ID of an ICMP packet. +func (p *Pinger) matchID(ID int) bool { + if ID != p.id { + return false + } + return true +} diff --git a/vendor/github.com/golang/protobuf/proto/registry.go b/vendor/github.com/golang/protobuf/proto/registry.go index 1e7ff642..066b4323 100644 --- a/vendor/github.com/golang/protobuf/proto/registry.go +++ b/vendor/github.com/golang/protobuf/proto/registry.go @@ -13,6 +13,7 @@ import ( "strings" "sync" + "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/runtime/protoimpl" @@ -62,14 +63,7 @@ func FileDescriptor(s filePath) fileDescGZIP { // Find the descriptor in the v2 registry. var b []byte if fd, _ := protoregistry.GlobalFiles.FindFileByPath(s); fd != nil { - if fd, ok := fd.(interface{ ProtoLegacyRawDesc() []byte }); ok { - b = fd.ProtoLegacyRawDesc() - } else { - // TODO: Use protodesc.ToFileDescriptorProto to construct - // a descriptorpb.FileDescriptorProto and marshal it. - // However, doing so causes the proto package to have a dependency - // on descriptorpb, leading to cyclic dependency issues. - } + b, _ = Marshal(protodesc.ToFileDescriptorProto(fd)) } // Locally cache the raw descriptor form for the file. diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go index e729dcff..85f9f573 100644 --- a/vendor/github.com/golang/protobuf/ptypes/any.go +++ b/vendor/github.com/golang/protobuf/ptypes/any.go @@ -19,6 +19,8 @@ const urlPrefix = "type.googleapis.com/" // AnyMessageName returns the message name contained in an anypb.Any message. // Most type assertions should use the Is function instead. +// +// Deprecated: Call the any.MessageName method instead. func AnyMessageName(any *anypb.Any) (string, error) { name, err := anyMessageName(any) return string(name), err @@ -38,6 +40,8 @@ func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) { } // MarshalAny marshals the given message m into an anypb.Any message. +// +// Deprecated: Call the anypb.New function instead. func MarshalAny(m proto.Message) (*anypb.Any, error) { switch dm := m.(type) { case DynamicAny: @@ -58,6 +62,9 @@ func MarshalAny(m proto.Message) (*anypb.Any, error) { // Empty returns a new message of the type specified in an anypb.Any message. // It returns protoregistry.NotFound if the corresponding message type could not // be resolved in the global registry. +// +// Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead +// to resolve the message name and create a new instance of it. func Empty(any *anypb.Any) (proto.Message, error) { name, err := anyMessageName(any) if err != nil { @@ -76,6 +83,8 @@ func Empty(any *anypb.Any) (proto.Message, error) { // // The target message m may be a *DynamicAny message. If the underlying message // type could not be resolved, then this returns protoregistry.NotFound. +// +// Deprecated: Call the any.UnmarshalTo method instead. func UnmarshalAny(any *anypb.Any, m proto.Message) error { if dm, ok := m.(*DynamicAny); ok { if dm.Message == nil { @@ -100,6 +109,8 @@ func UnmarshalAny(any *anypb.Any, m proto.Message) error { } // Is reports whether the Any message contains a message of the specified type. +// +// Deprecated: Call the any.MessageIs method instead. func Is(any *anypb.Any, m proto.Message) bool { if any == nil || m == nil { return false @@ -119,6 +130,9 @@ func Is(any *anypb.Any, m proto.Message) bool { // var x ptypes.DynamicAny // if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } // fmt.Printf("unmarshaled message: %v", x.Message) +// +// Deprecated: Use the any.UnmarshalNew method instead to unmarshal +// the any message contents into a new instance of the underlying message. type DynamicAny struct{ proto.Message } func (m DynamicAny) String() string { diff --git a/vendor/github.com/golang/protobuf/ptypes/doc.go b/vendor/github.com/golang/protobuf/ptypes/doc.go index fb9edd5c..d3c33259 100644 --- a/vendor/github.com/golang/protobuf/ptypes/doc.go +++ b/vendor/github.com/golang/protobuf/ptypes/doc.go @@ -3,4 +3,8 @@ // license that can be found in the LICENSE file. // Package ptypes provides functionality for interacting with well-known types. +// +// Deprecated: Well-known types have specialized functionality directly +// injected into the generated packages for each message type. +// See the deprecation notice for each function for the suggested alternative. package ptypes diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go index 6110ae8a..b2b55dd8 100644 --- a/vendor/github.com/golang/protobuf/ptypes/duration.go +++ b/vendor/github.com/golang/protobuf/ptypes/duration.go @@ -21,6 +21,8 @@ const ( // Duration converts a durationpb.Duration to a time.Duration. // Duration returns an error if dur is invalid or overflows a time.Duration. +// +// Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead. func Duration(dur *durationpb.Duration) (time.Duration, error) { if err := validateDuration(dur); err != nil { return 0, err @@ -39,6 +41,8 @@ func Duration(dur *durationpb.Duration) (time.Duration, error) { } // DurationProto converts a time.Duration to a durationpb.Duration. +// +// Deprecated: Call the durationpb.New function instead. func DurationProto(d time.Duration) *durationpb.Duration { nanos := d.Nanoseconds() secs := nanos / 1e9 diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go index 026d0d49..8368a3f7 100644 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go +++ b/vendor/github.com/golang/protobuf/ptypes/timestamp.go @@ -33,6 +33,8 @@ const ( // // A nil Timestamp returns an error. The first return value in that case is // undefined. +// +// Deprecated: Call the ts.AsTime and ts.CheckValid methods instead. func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { // Don't return the zero value on error, because corresponds to a valid // timestamp. Instead return whatever time.Unix gives us. @@ -46,6 +48,8 @@ func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) { } // TimestampNow returns a google.protobuf.Timestamp for the current time. +// +// Deprecated: Call the timestamppb.Now function instead. func TimestampNow() *timestamppb.Timestamp { ts, err := TimestampProto(time.Now()) if err != nil { @@ -56,6 +60,8 @@ func TimestampNow() *timestamppb.Timestamp { // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // It returns an error if the resulting Timestamp is invalid. +// +// Deprecated: Call the timestamppb.New function instead. func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { ts := ×tamppb.Timestamp{ Seconds: t.Unix(), @@ -69,6 +75,9 @@ func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) { // TimestampString returns the RFC 3339 string for valid Timestamps. // For invalid Timestamps, it returns an error message in parentheses. +// +// Deprecated: Call the ts.AsTime method instead, +// followed by a call to the Format method on the time.Time value. func TimestampString(ts *timestamppb.Timestamp) string { t, err := Timestamp(ts) if err != nil { diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml new file mode 100644 index 00000000..d8156a60 --- /dev/null +++ b/vendor/github.com/google/uuid/.travis.yml @@ -0,0 +1,9 @@ +language: go + +go: + - 1.4.3 + - 1.5.3 + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md new file mode 100644 index 00000000..04fdf09f --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS new file mode 100644 index 00000000..b4bb97f6 --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTORS @@ -0,0 +1,9 @@ +Paul Borman +bmatsuo +shawnps +theory +jboverfelt +dsymonds +cd1 +wallclockbuilder +dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE new file mode 100644 index 00000000..5dc68268 --- /dev/null +++ b/vendor/github.com/google/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md new file mode 100644 index 00000000..f765a46f --- /dev/null +++ b/vendor/github.com/google/uuid/README.md @@ -0,0 +1,19 @@ +# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) +The uuid package generates and inspects UUIDs based on +[RFC 4122](http://tools.ietf.org/html/rfc4122) +and DCE 1.1: Authentication and Security Services. + +This package is based on the github.com/pborman/uuid package (previously named +code.google.com/p/go-uuid). It differs from these earlier packages in that +a UUID is a 16 byte array rather than a byte slice. One loss due to this +change is the ability to represent an invalid UUID (vs a NIL UUID). + +###### Install +`go get github.com/google/uuid` + +###### Documentation +[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) + +Full `go doc` style documentation for the package can be viewed online without +installing this package by using the GoDoc site here: +http://pkg.go.dev/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go new file mode 100644 index 00000000..fa820b9d --- /dev/null +++ b/vendor/github.com/google/uuid/dce.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) (UUID, error) { + uuid, err := NewUUID() + if err == nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid, err +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCESecurity(Person, uint32(os.Getuid())) +func NewDCEPerson() (UUID, error) { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCESecurity(Group, uint32(os.Getgid())) +func NewDCEGroup() (UUID, error) { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID. Domains are only defined +// for Version 2 UUIDs. +func (uuid UUID) Domain() Domain { + return Domain(uuid[9]) +} + +// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 +// UUIDs. +func (uuid UUID) ID() uint32 { + return binary.BigEndian.Uint32(uuid[0:4]) +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go new file mode 100644 index 00000000..5b8a4b9a --- /dev/null +++ b/vendor/github.com/google/uuid/doc.go @@ -0,0 +1,12 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uuid generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to +// maps or compared directly. +package uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go new file mode 100644 index 00000000..b404f4be --- /dev/null +++ b/vendor/github.com/google/uuid/hash.go @@ -0,0 +1,53 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known namespace IDs and UUIDs +var ( + NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) + Nil UUID // empty UUID, all zeros +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space[:]) //nolint:errcheck + h.Write(data) //nolint:errcheck + s := h.Sum(nil) + var uuid UUID + copy(uuid[:], s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go new file mode 100644 index 00000000..14bd3407 --- /dev/null +++ b/vendor/github.com/google/uuid/marshal.go @@ -0,0 +1,38 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "fmt" + +// MarshalText implements encoding.TextMarshaler. +func (uuid UUID) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], uuid) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (uuid *UUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err != nil { + return err + } + *uuid = id + return nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (uuid *UUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(uuid[:], data) + return nil +} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go new file mode 100644 index 00000000..d651a2b0 --- /dev/null +++ b/vendor/github.com/google/uuid/node.go @@ -0,0 +1,90 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "sync" +) + +var ( + nodeMu sync.Mutex + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + defer nodeMu.Unlock() + nodeMu.Lock() + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + defer nodeMu.Unlock() + nodeMu.Lock() + return setNodeInterface(name) +} + +func setNodeInterface(name string) bool { + iname, addr := getHardwareInterface(name) // null implementation for js + if iname != "" && addr != nil { + ifname = iname + copy(nodeID[:], addr) + return true + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + ifname = "random" + randomBits(nodeID[:]) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + defer nodeMu.Unlock() + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nid := nodeID + return nid[:] +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + defer nodeMu.Unlock() + nodeMu.Lock() + copy(nodeID[:], id) + ifname = "user" + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + var node [6]byte + copy(node[:], uuid[10:]) + return node[:] +} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go new file mode 100644 index 00000000..24b78edc --- /dev/null +++ b/vendor/github.com/google/uuid/node_js.go @@ -0,0 +1,12 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build js + +package uuid + +// getHardwareInterface returns nil values for the JS version of the code. +// This remvoves the "net" dependency, because it is not used in the browser. +// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. +func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go new file mode 100644 index 00000000..0cbbcddb --- /dev/null +++ b/vendor/github.com/google/uuid/node_net.go @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !js + +package uuid + +import "net" + +var interfaces []net.Interface // cached list of interfaces + +// getHardwareInterface returns the name and hardware address of interface name. +// If name is "" then the name and hardware address of one of the system's +// interfaces is returned. If no interfaces are found (name does not exist or +// there are no interfaces) then "", nil is returned. +// +// Only addresses of at least 6 bytes are returned. +func getHardwareInterface(name string) (string, []byte) { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil { + return "", nil + } + } + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + return ifs.Name, ifs.HardwareAddr + } + } + return "", nil +} diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go new file mode 100644 index 00000000..d7fcbf28 --- /dev/null +++ b/vendor/github.com/google/uuid/null.go @@ -0,0 +1,118 @@ +// Copyright 2021 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "database/sql/driver" + "encoding/json" + "fmt" +) + +var jsonNull = []byte("null") + +// NullUUID represents a UUID that may be null. +// NullUUID implements the SQL driver.Scanner interface so +// it can be used as a scan destination: +// +// var u uuid.NullUUID +// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) +// ... +// if u.Valid { +// // use u.UUID +// } else { +// // NULL value +// } +// +type NullUUID struct { + UUID UUID + Valid bool // Valid is true if UUID is not NULL +} + +// Scan implements the SQL driver.Scanner interface. +func (nu *NullUUID) Scan(value interface{}) error { + if value == nil { + nu.UUID, nu.Valid = Nil, false + return nil + } + + err := nu.UUID.Scan(value) + if err != nil { + nu.Valid = false + return err + } + + nu.Valid = true + return nil +} + +// Value implements the driver Valuer interface. +func (nu NullUUID) Value() (driver.Value, error) { + if !nu.Valid { + return nil, nil + } + // Delegate to UUID Value function + return nu.UUID.Value() +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (nu NullUUID) MarshalBinary() ([]byte, error) { + if nu.Valid { + return nu.UUID[:], nil + } + + return []byte(nil), nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (nu *NullUUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(nu.UUID[:], data) + nu.Valid = true + return nil +} + +// MarshalText implements encoding.TextMarshaler. +func (nu NullUUID) MarshalText() ([]byte, error) { + if nu.Valid { + return nu.UUID.MarshalText() + } + + return jsonNull, nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (nu *NullUUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err != nil { + nu.Valid = false + return err + } + nu.UUID = id + nu.Valid = true + return nil +} + +// MarshalJSON implements json.Marshaler. +func (nu NullUUID) MarshalJSON() ([]byte, error) { + if nu.Valid { + return json.Marshal(nu.UUID) + } + + return jsonNull, nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (nu *NullUUID) UnmarshalJSON(data []byte) error { + if bytes.Equal(data, jsonNull) { + *nu = NullUUID{} + return nil // valid null UUID + } + err := json.Unmarshal(data, &nu.UUID) + nu.Valid = err == nil + return err +} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go new file mode 100644 index 00000000..2e02ec06 --- /dev/null +++ b/vendor/github.com/google/uuid/sql.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently. +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case nil: + return nil + + case string: + // if an empty UUID comes from a table, we return a null UUID + if src == "" { + return nil + } + + // see Parse for required string format + u, err := Parse(src) + if err != nil { + return fmt.Errorf("Scan: %v", err) + } + + *uuid = u + + case []byte: + // if an empty UUID comes from a table, we return a null UUID + if len(src) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(src) != 16 { + return uuid.Scan(string(src)) + } + copy((*uuid)[:], src) + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go new file mode 100644 index 00000000..e6ef06cd --- /dev/null +++ b/vendor/github.com/google/uuid/time.go @@ -0,0 +1,123 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + timeMu sync.Mutex + lasttime uint64 // last time we returned + clockSeq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { + defer timeMu.Unlock() + timeMu.Lock() + return getTime() +} + +func getTime() (Time, uint16, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clockSeq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), clockSeq, nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence is used, a new +// random clock sequence is generated the first time a clock sequence is +// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) +func ClockSequence() int { + defer timeMu.Unlock() + timeMu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clockSeq == 0 { + setClockSequence(-1) + } + return int(clockSeq & 0x3fff) +} + +// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer timeMu.Unlock() + timeMu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + oldSeq := clockSeq + clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if oldSeq != clockSeq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. The time is only defined for version 1 and 2 UUIDs. +func (uuid UUID) Time() Time { + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + return Time(time) +} + +// ClockSequence returns the clock sequence encoded in uuid. +// The clock sequence is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) ClockSequence() int { + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff +} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go new file mode 100644 index 00000000..5ea6c737 --- /dev/null +++ b/vendor/github.com/google/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts hex characters x1 and x2 into a byte. +func xtob(x1, x2 byte) (byte, bool) { + b1 := xvalues[x1] + b2 := xvalues[x2] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go new file mode 100644 index 00000000..a57207ae --- /dev/null +++ b/vendor/github.com/google/uuid/uuid.go @@ -0,0 +1,294 @@ +// Copyright 2018 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" + "sync" +) + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID [16]byte + +// A Version represents a UUID's version. +type Version byte + +// A Variant represents a UUID's variant. +type Variant byte + +// Constants returned by Variant. +const ( + Invalid = Variant(iota) // Invalid UUID + RFC4122 // The variant specified in RFC4122 + Reserved // Reserved, NCS backward compatibility. + Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future // Reserved for future definition. +) + +const randPoolSize = 16 * 16 + +var ( + rander = rand.Reader // random function + poolEnabled = false + poolMu sync.Mutex + poolPos = randPoolSize // protected with poolMu + pool [randPoolSize]byte // protected with poolMu +) + +type invalidLengthError struct{ len int } + +func (err invalidLengthError) Error() string { + return fmt.Sprintf("invalid UUID length: %d", err.len) +} + +// IsInvalidLengthError is matcher function for custom error invalidLengthError +func IsInvalidLengthError(err error) bool { + _, ok := err.(invalidLengthError) + return ok +} + +// Parse decodes s into a UUID or returns an error. Both the standard UUID +// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the +// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex +// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. +func Parse(s string) (UUID, error) { + var uuid UUID + switch len(s) { + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36: + + // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: + if strings.ToLower(s[:9]) != "urn:uuid:" { + return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + case 36 + 2: + s = s[1:] + + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + case 32: + var ok bool + for i := range uuid { + uuid[i], ok = xtob(s[i*2], s[i*2+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, invalidLengthError{len(s)} + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(s[x], s[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + var uuid UUID + switch len(b) { + case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) { + return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) + } + b = b[9:] + case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + b = b[1:] + case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var ok bool + for i := 0; i < 32; i += 2 { + uuid[i/2], ok = xtob(b[i], b[i+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, invalidLengthError{len(b)} + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34} { + v, ok := xtob(b[x], b[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// MustParse is like Parse but panics if the string cannot be parsed. +// It simplifies safe initialization of global variables holding compiled UUIDs. +func MustParse(s string) UUID { + uuid, err := Parse(s) + if err != nil { + panic(`uuid: Parse(` + s + `): ` + err.Error()) + } + return uuid +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + +// Must returns uuid if err is nil and panics otherwise. +func Must(uuid UUID, err error) UUID { + if err != nil { + panic(err) + } + return uuid +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst, uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. +func (uuid UUID) Variant() Variant { + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. +func (uuid UUID) Version() Version { + return Version(uuid[6] >> 4) +} + +func (v Version) String() string { + if v > 15 { + return fmt.Sprintf("BAD_VERSION_%d", v) + } + return fmt.Sprintf("VERSION_%d", v) +} + +func (v Variant) String() string { + switch v { + case RFC4122: + return "RFC4122" + case Reserved: + return "Reserved" + case Microsoft: + return "Microsoft" + case Future: + return "Future" + case Invalid: + return "Invalid" + } + return fmt.Sprintf("BadVariant%d", int(v)) +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + if r == nil { + rander = rand.Reader + return + } + rander = r +} + +// EnableRandPool enables internal randomness pool used for Random +// (Version 4) UUID generation. The pool contains random bytes read from +// the random number generator on demand in batches. Enabling the pool +// may improve the UUID generation throughput significantly. +// +// Since the pool is stored on the Go heap, this feature may be a bad fit +// for security sensitive applications. +// +// Both EnableRandPool and DisableRandPool are not thread-safe and should +// only be called when there is no possibility that New or any other +// UUID Version 4 generation function will be called concurrently. +func EnableRandPool() { + poolEnabled = true +} + +// DisableRandPool disables the randomness pool if it was previously +// enabled with EnableRandPool. +// +// Both EnableRandPool and DisableRandPool are not thread-safe and should +// only be called when there is no possibility that New or any other +// UUID Version 4 generation function will be called concurrently. +func DisableRandPool() { + poolEnabled = false + defer poolMu.Unlock() + poolMu.Lock() + poolPos = randPoolSize +} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go new file mode 100644 index 00000000..46310962 --- /dev/null +++ b/vendor/github.com/google/uuid/version1.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil and an error. +// +// In most cases, New should be used. +func NewUUID() (UUID, error) { + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + timeLow := uint32(now & 0xffffffff) + timeMid := uint16((now >> 32) & 0xffff) + timeHi := uint16((now >> 48) & 0x0fff) + timeHi |= 0x1000 // Version 1 + + binary.BigEndian.PutUint32(uuid[0:], timeLow) + binary.BigEndian.PutUint16(uuid[4:], timeMid) + binary.BigEndian.PutUint16(uuid[6:], timeHi) + binary.BigEndian.PutUint16(uuid[8:], seq) + + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + copy(uuid[10:], nodeID[:]) + nodeMu.Unlock() + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go new file mode 100644 index 00000000..7697802e --- /dev/null +++ b/vendor/github.com/google/uuid/version4.go @@ -0,0 +1,76 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "io" + +// New creates a new random UUID or panics. New is equivalent to +// the expression +// +// uuid.Must(uuid.NewRandom()) +func New() UUID { + return Must(NewRandom()) +} + +// NewString creates a new random UUID and returns it as a string or panics. +// NewString is equivalent to the expression +// +// uuid.New().String() +func NewString() string { + return Must(NewRandom()).String() +} + +// NewRandom returns a Random (Version 4) UUID. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// Uses the randomness pool if it was enabled with EnableRandPool. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() (UUID, error) { + if !poolEnabled { + return NewRandomFromReader(rander) + } + return newRandomFromPool() +} + +// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. +func NewRandomFromReader(r io.Reader) (UUID, error) { + var uuid UUID + _, err := io.ReadFull(r, uuid[:]) + if err != nil { + return Nil, err + } + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} + +func newRandomFromPool() (UUID, error) { + var uuid UUID + poolMu.Lock() + if poolPos == randPoolSize { + _, err := io.ReadFull(rander, pool[:]) + if err != nil { + poolMu.Unlock() + return Nil, err + } + poolPos = 0 + } + copy(uuid[:], pool[poolPos:(poolPos+16)]) + poolPos += 16 + poolMu.Unlock() + + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} diff --git a/vendor/github.com/mattn/go-isatty/.travis.yml b/vendor/github.com/mattn/go-isatty/.travis.yml deleted file mode 100644 index 604314dd..00000000 --- a/vendor/github.com/mattn/go-isatty/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go -sudo: false -go: - - 1.13.x - - tip - -before_install: - - go get -t -v ./... - -script: - - ./go.test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go index 711f2880..39bbcf00 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go +++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go @@ -1,3 +1,4 @@ +//go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine // +build darwin freebsd openbsd netbsd dragonfly // +build !appengine diff --git a/vendor/github.com/mattn/go-isatty/isatty_others.go b/vendor/github.com/mattn/go-isatty/isatty_others.go index ff714a37..31503226 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_others.go +++ b/vendor/github.com/mattn/go-isatty/isatty_others.go @@ -1,4 +1,5 @@ -// +build appengine js nacl +//go:build appengine || js || nacl || wasm +// +build appengine js nacl wasm package isatty diff --git a/vendor/github.com/mattn/go-isatty/isatty_plan9.go b/vendor/github.com/mattn/go-isatty/isatty_plan9.go index c5b6e0c0..bae7f9bb 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_plan9.go +++ b/vendor/github.com/mattn/go-isatty/isatty_plan9.go @@ -1,3 +1,4 @@ +//go:build plan9 // +build plan9 package isatty diff --git a/vendor/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go index bdd5c79a..0c3acf2d 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_solaris.go +++ b/vendor/github.com/mattn/go-isatty/isatty_solaris.go @@ -1,5 +1,5 @@ -// +build solaris -// +build !appengine +//go:build solaris && !appengine +// +build solaris,!appengine package isatty @@ -8,10 +8,9 @@ import ( ) // IsTerminal returns true if the given file descriptor is a terminal. -// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c +// see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c func IsTerminal(fd uintptr) bool { - var termio unix.Termio - err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) + _, err := unix.IoctlGetTermio(int(fd), unix.TCGETA) return err == nil } diff --git a/vendor/github.com/mattn/go-isatty/isatty_tcgets.go b/vendor/github.com/mattn/go-isatty/isatty_tcgets.go index 31a1ca97..67787657 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_tcgets.go +++ b/vendor/github.com/mattn/go-isatty/isatty_tcgets.go @@ -1,4 +1,5 @@ -// +build linux aix +//go:build (linux || aix || zos) && !appengine +// +build linux aix zos // +build !appengine package isatty diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go index 1fa86915..8e3c9917 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_windows.go +++ b/vendor/github.com/mattn/go-isatty/isatty_windows.go @@ -1,5 +1,5 @@ -// +build windows -// +build !appengine +//go:build windows && !appengine +// +build windows,!appengine package isatty @@ -76,7 +76,7 @@ func isCygwinPipeName(name string) bool { } // getFileNameByHandle use the undocomented ntdll NtQueryObject to get file full name from file handler -// since GetFileInformationByHandleEx is not avilable under windows Vista and still some old fashion +// since GetFileInformationByHandleEx is not available under windows Vista and still some old fashion // guys are using Windows XP, this is a workaround for those guys, it will also work on system from // Windows vista to 10 // see https://stackoverflow.com/a/18792477 for details diff --git a/vendor/github.com/mattn/go-isatty/renovate.json b/vendor/github.com/mattn/go-isatty/renovate.json deleted file mode 100644 index 5ae9d96b..00000000 --- a/vendor/github.com/mattn/go-isatty/renovate.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": [ - "config:base" - ], - "postUpdateOptions": [ - "gomodTidy" - ] -} diff --git a/vendor/github.com/miekg/dns/.travis.yml b/vendor/github.com/miekg/dns/.travis.yml deleted file mode 100644 index 7d9b1727..00000000 --- a/vendor/github.com/miekg/dns/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go -sudo: false - -go: - - 1.14.x - - 1.15.x - - tip - -env: - - GO111MODULE=on - -script: - - go generate ./... && test `git ls-files --modified | wc -l` = 0 - - go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/miekg/dns/Makefile.release b/vendor/github.com/miekg/dns/Makefile.release index 8fb748e8..a0ce9b71 100644 --- a/vendor/github.com/miekg/dns/Makefile.release +++ b/vendor/github.com/miekg/dns/Makefile.release @@ -1,7 +1,7 @@ # Makefile for releasing. # # The release is controlled from version.go. The version found there is -# used to tag the git repo, we're not building any artifects so there is nothing +# used to tag the git repo, we're not building any artifacts so there is nothing # to upload to github. # # * Up the version in version.go diff --git a/vendor/github.com/miekg/dns/README.md b/vendor/github.com/miekg/dns/README.md index fc8394e2..d5b78ef4 100644 --- a/vendor/github.com/miekg/dns/README.md +++ b/vendor/github.com/miekg/dns/README.md @@ -69,6 +69,11 @@ A not-so-up-to-date-list-that-may-be-actually-current: * https://zonedb.org/ * https://router7.org/ * https://github.com/fortio/dnsping +* https://github.com/Luzilla/dnsbl_exporter +* https://github.com/bodgit/tsig +* https://github.com/v2fly/v2ray-core (test only) +* https://kuma.io/ + Send pull request if you want to be listed here. @@ -165,6 +170,9 @@ Example programs can be found in the `github.com/miekg/exdns` repository. * 7873 - Domain Name System (DNS) Cookies * 8080 - EdDSA for DNSSEC * 8499 - DNS Terminology +* 8659 - DNS Certification Authority Authorization (CAA) Resource Record +* 8914 - Extended DNS Errors +* 8976 - Message Digest for DNS Zones (ZONEMD RR) ## Loosely Based Upon diff --git a/vendor/github.com/miekg/dns/acceptfunc.go b/vendor/github.com/miekg/dns/acceptfunc.go index 825617fe..3f29a48c 100644 --- a/vendor/github.com/miekg/dns/acceptfunc.go +++ b/vendor/github.com/miekg/dns/acceptfunc.go @@ -25,6 +25,7 @@ var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc // MsgAcceptAction represents the action to be taken. type MsgAcceptAction int +// Allowed returned values from a MsgAcceptFunc. const ( MsgAccept MsgAcceptAction = iota // Accept the message MsgReject // Reject the message with a RcodeFormatError diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go index e7ff786a..f907698b 100644 --- a/vendor/github.com/miekg/dns/client.go +++ b/vendor/github.com/miekg/dns/client.go @@ -23,6 +23,7 @@ type Conn struct { net.Conn // a net.Conn holding the connection UDPSize uint16 // minimum receive buffer for UDP messages TsigSecret map[string]string // secret(s) for Tsig map[], zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2) + TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations. tsigRequestMAC string } @@ -40,6 +41,7 @@ type Client struct { ReadTimeout time.Duration // net.Conn.SetReadTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero TsigSecret map[string]string // secret(s) for Tsig map[], zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2) + TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations. SingleInflight bool // if true suppress multiple outstanding queries for the same Qname, Qtype and Qclass group singleflight } @@ -124,7 +126,6 @@ func (c *Client) Dial(address string) (conn *Conn, err error) { // of 512 bytes // To specify a local address or a timeout, the caller has to set the `Client.Dialer` // attribute appropriately - func (c *Client) Exchange(m *Msg, address string) (r *Msg, rtt time.Duration, err error) { co, err := c.Dial(address) @@ -176,7 +177,7 @@ func (c *Client) exchange(m *Msg, co *Conn) (r *Msg, rtt time.Duration, err erro co.UDPSize = c.UDPSize } - co.TsigSecret = c.TsigSecret + co.TsigSecret, co.TsigProvider = c.TsigSecret, c.TsigProvider t := time.Now() // write with the appropriate write timeout co.SetWriteDeadline(t.Add(c.getTimeoutForRequest(c.writeTimeout()))) @@ -223,11 +224,15 @@ func (co *Conn) ReadMsg() (*Msg, error) { return m, err } if t := m.IsTsig(); t != nil { - if _, ok := co.TsigSecret[t.Hdr.Name]; !ok { - return m, ErrSecret + if co.TsigProvider != nil { + err = tsigVerifyProvider(p, co.TsigProvider, co.tsigRequestMAC, false) + } else { + if _, ok := co.TsigSecret[t.Hdr.Name]; !ok { + return m, ErrSecret + } + // Need to work on the original message p, as that was used to calculate the tsig. + err = TsigVerify(p, co.TsigSecret[t.Hdr.Name], co.tsigRequestMAC, false) } - // Need to work on the original message p, as that was used to calculate the tsig. - err = TsigVerify(p, co.TsigSecret[t.Hdr.Name], co.tsigRequestMAC, false) } return m, err } @@ -305,10 +310,14 @@ func (co *Conn) WriteMsg(m *Msg) (err error) { var out []byte if t := m.IsTsig(); t != nil { mac := "" - if _, ok := co.TsigSecret[t.Hdr.Name]; !ok { - return ErrSecret + if co.TsigProvider != nil { + out, mac, err = tsigGenerateProvider(m, co.TsigProvider, co.tsigRequestMAC, false) + } else { + if _, ok := co.TsigSecret[t.Hdr.Name]; !ok { + return ErrSecret + } + out, mac, err = TsigGenerate(m, co.TsigSecret[t.Hdr.Name], co.tsigRequestMAC, false) } - out, mac, err = TsigGenerate(m, co.TsigSecret[t.Hdr.Name], co.tsigRequestMAC, false) // Set for the next read, although only used in zone transfers co.tsigRequestMAC = mac } else { @@ -331,11 +340,10 @@ func (co *Conn) Write(p []byte) (int, error) { return co.Conn.Write(p) } - l := make([]byte, 2) - binary.BigEndian.PutUint16(l, uint16(len(p))) - - n, err := (&net.Buffers{l, p}).WriteTo(co.Conn) - return int(n), err + msg := make([]byte, 2+len(p)) + binary.BigEndian.PutUint16(msg, uint16(len(p))) + copy(msg[2:], p) + return co.Conn.Write(msg) } // Return the appropriate timeout for a specific request @@ -371,7 +379,7 @@ func Dial(network, address string) (conn *Conn, err error) { func ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg, err error) { client := Client{Net: "udp"} r, _, err = client.ExchangeContext(ctx, m, a) - // ignorint rtt to leave the original ExchangeContext API unchanged, but + // ignoring rtt to leave the original ExchangeContext API unchanged, but // this function will go away return r, err } diff --git a/vendor/github.com/miekg/dns/defaults.go b/vendor/github.com/miekg/dns/defaults.go index d874e300..d47b0b1f 100644 --- a/vendor/github.com/miekg/dns/defaults.go +++ b/vendor/github.com/miekg/dns/defaults.go @@ -349,10 +349,7 @@ func ReverseAddr(addr string) (arpa string, err error) { // Add it, in reverse, to the buffer for i := len(ip) - 1; i >= 0; i-- { v := ip[i] - buf = append(buf, hexDigit[v&0xF]) - buf = append(buf, '.') - buf = append(buf, hexDigit[v>>4]) - buf = append(buf, '.') + buf = append(buf, hexDigit[v&0xF], '.', hexDigit[v>>4], '.') } // Append "ip6.arpa." and return (buf already has the final .) buf = append(buf, "ip6.arpa."...) diff --git a/vendor/github.com/miekg/dns/dns.go b/vendor/github.com/miekg/dns/dns.go index ad83a27e..a88484b0 100644 --- a/vendor/github.com/miekg/dns/dns.go +++ b/vendor/github.com/miekg/dns/dns.go @@ -1,6 +1,9 @@ package dns -import "strconv" +import ( + "encoding/hex" + "strconv" +) const ( year68 = 1 << 31 // For RFC1982 (Serial Arithmetic) calculations in 32 bits. @@ -111,7 +114,7 @@ func (h *RR_Header) parse(c *zlexer, origin string) *ParseError { // ToRFC3597 converts a known RR to the unknown RR representation from RFC 3597. func (rr *RFC3597) ToRFC3597(r RR) error { - buf := make([]byte, Len(r)*2) + buf := make([]byte, Len(r)) headerEnd, off, err := packRR(r, buf, 0, compressionMap{}, false) if err != nil { return err @@ -126,9 +129,30 @@ func (rr *RFC3597) ToRFC3597(r RR) error { } _, err = rr.unpack(buf, headerEnd) + return err +} + +// fromRFC3597 converts an unknown RR representation from RFC 3597 to the known RR type. +func (rr *RFC3597) fromRFC3597(r RR) error { + hdr := r.Header() + *hdr = rr.Hdr + + // Can't overflow uint16 as the length of Rdata is validated in (*RFC3597).parse. + // We can only get here when rr was constructed with that method. + hdr.Rdlength = uint16(hex.DecodedLen(len(rr.Rdata))) + + if noRdata(*hdr) { + // Dynamic update. + return nil + } + + // rr.pack requires an extra allocation and a copy so we just decode Rdata + // manually, it's simpler anyway. + msg, err := hex.DecodeString(rr.Rdata) if err != nil { return err } - return nil + _, err = r.unpack(msg, 0) + return err } diff --git a/vendor/github.com/miekg/dns/dnssec.go b/vendor/github.com/miekg/dns/dnssec.go index 900f6e05..8539aae6 100644 --- a/vendor/github.com/miekg/dns/dnssec.go +++ b/vendor/github.com/miekg/dns/dnssec.go @@ -4,12 +4,13 @@ import ( "bytes" "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rand" "crypto/rsa" - _ "crypto/sha1" - _ "crypto/sha256" - _ "crypto/sha512" + _ "crypto/sha1" // need its init function + _ "crypto/sha256" // need its init function + _ "crypto/sha512" // need its init function "encoding/asn1" "encoding/binary" "encoding/hex" @@ -17,8 +18,6 @@ import ( "sort" "strings" "time" - - "golang.org/x/crypto/ed25519" ) // DNSSEC encryption algorithm codes. @@ -373,6 +372,8 @@ func sign(k crypto.Signer, hashed []byte, hash crypto.Hash, alg uint8) ([]byte, // Verify validates an RRSet with the signature and key. This is only the // cryptographic test, the signature validity period must be checked separately. // This function copies the rdata of some RRs (to lowercase domain names) for the validation to work. +// It also checks that the Zone Key bit (RFC 4034 2.1.1) is set on the DNSKEY +// and that the Protocol field is set to 3 (RFC 4034 2.1.2). func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error { // First the easy checks if !IsRRset(rrset) { @@ -393,6 +394,12 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error { if k.Protocol != 3 { return ErrKey } + // RFC 4034 2.1.1 If bit 7 has value 0, then the DNSKEY record holds some + // other type of DNS public key and MUST NOT be used to verify RRSIGs that + // cover RRsets. + if k.Flags&ZONE == 0 { + return ErrKey + } // IsRRset checked that we have at least one RR and that the RRs in // the set have consistent type, class, and name. Also check that type and @@ -500,7 +507,7 @@ func (rr *RRSIG) ValidityPeriod(t time.Time) bool { return ti <= utc && utc <= te } -// Return the signatures base64 encodedig sigdata as a byte slice. +// Return the signatures base64 encoding sigdata as a byte slice. func (rr *RRSIG) sigBuf() []byte { sigbuf, err := fromBase64([]byte(rr.Signature)) if err != nil { diff --git a/vendor/github.com/miekg/dns/dnssec_keygen.go b/vendor/github.com/miekg/dns/dnssec_keygen.go index 2ab7b6d7..b8124b56 100644 --- a/vendor/github.com/miekg/dns/dnssec_keygen.go +++ b/vendor/github.com/miekg/dns/dnssec_keygen.go @@ -3,12 +3,11 @@ package dns import ( "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/elliptic" "crypto/rand" "crypto/rsa" "math/big" - - "golang.org/x/crypto/ed25519" ) // Generate generates a DNSKEY of the given bit size. diff --git a/vendor/github.com/miekg/dns/dnssec_keyscan.go b/vendor/github.com/miekg/dns/dnssec_keyscan.go index 6cbc2848..f7965816 100644 --- a/vendor/github.com/miekg/dns/dnssec_keyscan.go +++ b/vendor/github.com/miekg/dns/dnssec_keyscan.go @@ -4,13 +4,12 @@ import ( "bufio" "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/rsa" "io" "math/big" "strconv" "strings" - - "golang.org/x/crypto/ed25519" ) // NewPrivateKey returns a PrivateKey by parsing the string s. diff --git a/vendor/github.com/miekg/dns/dnssec_privkey.go b/vendor/github.com/miekg/dns/dnssec_privkey.go index 072e445d..f1607729 100644 --- a/vendor/github.com/miekg/dns/dnssec_privkey.go +++ b/vendor/github.com/miekg/dns/dnssec_privkey.go @@ -3,11 +3,10 @@ package dns import ( "crypto" "crypto/ecdsa" + "crypto/ed25519" "crypto/rsa" "math/big" "strconv" - - "golang.org/x/crypto/ed25519" ) const format = "Private-key-format: v1.3\n" diff --git a/vendor/github.com/miekg/dns/doc.go b/vendor/github.com/miekg/dns/doc.go index 6861de77..5c83f82e 100644 --- a/vendor/github.com/miekg/dns/doc.go +++ b/vendor/github.com/miekg/dns/doc.go @@ -159,7 +159,7 @@ shows the options you have and what functions to call. TRANSACTION SIGNATURE An TSIG or transaction signature adds a HMAC TSIG record to each message sent. -The supported algorithms include: HmacMD5, HmacSHA1, HmacSHA256 and HmacSHA512. +The supported algorithms include: HmacSHA1, HmacSHA256 and HmacSHA512. Basic use pattern when querying with a TSIG name "axfr." (note that these key names must be fully qualified - as they are domain names) and the base64 secret @@ -174,7 +174,7 @@ changes to the RRset after calling SetTsig() the signature will be incorrect. c.TsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="} m := new(dns.Msg) m.SetQuestion("miek.nl.", dns.TypeMX) - m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) + m.SetTsig("axfr.", dns.HmacSHA256, 300, time.Now().Unix()) ... // When sending the TSIG RR is calculated and filled in before sending @@ -187,13 +187,37 @@ request an AXFR for miek.nl. with TSIG key named "axfr." and secret m := new(dns.Msg) t.TsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="} m.SetAxfr("miek.nl.") - m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) + m.SetTsig("axfr.", dns.HmacSHA256, 300, time.Now().Unix()) c, err := t.In(m, "176.58.119.54:53") for r := range c { ... } You can now read the records from the transfer as they come in. Each envelope is checked with TSIG. If something is not correct an error is returned. +A custom TSIG implementation can be used. This requires additional code to +perform any session establishment and signature generation/verification. The +client must be configured with an implementation of the TsigProvider interface: + + type Provider struct{} + + func (*Provider) Generate(msg []byte, tsig *dns.TSIG) ([]byte, error) { + // Use tsig.Hdr.Name and tsig.Algorithm in your code to + // generate the MAC using msg as the payload. + } + + func (*Provider) Verify(msg []byte, tsig *dns.TSIG) error { + // Use tsig.Hdr.Name and tsig.Algorithm in your code to verify + // that msg matches the value in tsig.MAC. + } + + c := new(dns.Client) + c.TsigProvider = new(Provider) + m := new(dns.Msg) + m.SetQuestion("miek.nl.", dns.TypeMX) + m.SetTsig(keyname, dns.HmacSHA256, 300, time.Now().Unix()) + ... + // TSIG RR is calculated by calling your Generate method + Basic use pattern validating and replying to a message that has TSIG set. server := &dns.Server{Addr: ":53", Net: "udp"} @@ -207,7 +231,7 @@ Basic use pattern validating and replying to a message that has TSIG set. if r.IsTsig() != nil { if w.TsigStatus() == nil { // *Msg r has an TSIG record and it was validated - m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix()) + m.SetTsig("axfr.", dns.HmacSHA256, 300, time.Now().Unix()) } else { // *Msg r has an TSIG records and it was not validated } diff --git a/vendor/github.com/miekg/dns/edns.go b/vendor/github.com/miekg/dns/edns.go index 04808d57..c9181783 100644 --- a/vendor/github.com/miekg/dns/edns.go +++ b/vendor/github.com/miekg/dns/edns.go @@ -22,11 +22,47 @@ const ( EDNS0COOKIE = 0xa // EDNS0 Cookie EDNS0TCPKEEPALIVE = 0xb // EDNS0 tcp keep alive (See RFC 7828) EDNS0PADDING = 0xc // EDNS0 padding (See RFC 7830) + EDNS0EDE = 0xf // EDNS0 extended DNS errors (See RFC 8914) EDNS0LOCALSTART = 0xFDE9 // Beginning of range reserved for local/experimental use (See RFC 6891) EDNS0LOCALEND = 0xFFFE // End of range reserved for local/experimental use (See RFC 6891) _DO = 1 << 15 // DNSSEC OK ) +// makeDataOpt is used to unpack the EDNS0 option(s) from a message. +func makeDataOpt(code uint16) EDNS0 { + // All the EDNS0.* constants above need to be in this switch. + switch code { + case EDNS0LLQ: + return new(EDNS0_LLQ) + case EDNS0UL: + return new(EDNS0_UL) + case EDNS0NSID: + return new(EDNS0_NSID) + case EDNS0DAU: + return new(EDNS0_DAU) + case EDNS0DHU: + return new(EDNS0_DHU) + case EDNS0N3U: + return new(EDNS0_N3U) + case EDNS0SUBNET: + return new(EDNS0_SUBNET) + case EDNS0EXPIRE: + return new(EDNS0_EXPIRE) + case EDNS0COOKIE: + return new(EDNS0_COOKIE) + case EDNS0TCPKEEPALIVE: + return new(EDNS0_TCP_KEEPALIVE) + case EDNS0PADDING: + return new(EDNS0_PADDING) + case EDNS0EDE: + return new(EDNS0_EDE) + default: + e := new(EDNS0_LOCAL) + e.Code = code + return e + } +} + // OPT is the EDNS0 RR appended to messages to convey extra (meta) information. // See RFC 6891. type OPT struct { @@ -73,6 +109,8 @@ func (rr *OPT) String() string { s += "\n; LOCAL OPT: " + o.String() case *EDNS0_PADDING: s += "\n; PADDING: " + o.String() + case *EDNS0_EDE: + s += "\n; EDE: " + o.String() } } return s @@ -88,11 +126,11 @@ func (rr *OPT) len(off int, compression map[string]struct{}) int { return l } -func (rr *OPT) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on OPT") +func (*OPT) parse(c *zlexer, origin string) *ParseError { + return &ParseError{err: "OPT records do not have a presentation format"} } -func (r1 *OPT) isDuplicate(r2 RR) bool { return false } +func (rr *OPT) isDuplicate(r2 RR) bool { return false } // return the old value -> delete SetVersion? @@ -148,6 +186,16 @@ func (rr *OPT) SetDo(do ...bool) { } } +// Z returns the Z part of the OPT RR as a uint16 with only the 15 least significant bits used. +func (rr *OPT) Z() uint16 { + return uint16(rr.Hdr.Ttl & 0x7FFF) +} + +// SetZ sets the Z part of the OPT RR, note only the 15 least significant bits of z are used. +func (rr *OPT) SetZ(z uint16) { + rr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF) +} + // EDNS0 defines an EDNS0 Option. An OPT RR can have multiple options appended to it. type EDNS0 interface { // Option returns the option code for the option. @@ -452,7 +500,7 @@ func (e *EDNS0_LLQ) copy() EDNS0 { return &EDNS0_LLQ{e.Code, e.Version, e.Opcode, e.Error, e.Id, e.LeaseLife} } -// EDNS0_DUA implements the EDNS0 "DNSSEC Algorithm Understood" option. See RFC 6975. +// EDNS0_DAU implements the EDNS0 "DNSSEC Algorithm Understood" option. See RFC 6975. type EDNS0_DAU struct { Code uint16 // Always EDNS0DAU AlgCode []uint8 @@ -525,7 +573,7 @@ func (e *EDNS0_N3U) String() string { } func (e *EDNS0_N3U) copy() EDNS0 { return &EDNS0_N3U{e.Code, e.AlgCode} } -// EDNS0_EXPIRE implementes the EDNS0 option as described in RFC 7314. +// EDNS0_EXPIRE implements the EDNS0 option as described in RFC 7314. type EDNS0_EXPIRE struct { Code uint16 // Always EDNS0EXPIRE Expire uint32 @@ -673,3 +721,101 @@ func (e *EDNS0_PADDING) copy() EDNS0 { copy(b, e.Padding) return &EDNS0_PADDING{b} } + +// Extended DNS Error Codes (RFC 8914). +const ( + ExtendedErrorCodeOther uint16 = iota + ExtendedErrorCodeUnsupportedDNSKEYAlgorithm + ExtendedErrorCodeUnsupportedDSDigestType + ExtendedErrorCodeStaleAnswer + ExtendedErrorCodeForgedAnswer + ExtendedErrorCodeDNSSECIndeterminate + ExtendedErrorCodeDNSBogus + ExtendedErrorCodeSignatureExpired + ExtendedErrorCodeSignatureNotYetValid + ExtendedErrorCodeDNSKEYMissing + ExtendedErrorCodeRRSIGsMissing + ExtendedErrorCodeNoZoneKeyBitSet + ExtendedErrorCodeNSECMissing + ExtendedErrorCodeCachedError + ExtendedErrorCodeNotReady + ExtendedErrorCodeBlocked + ExtendedErrorCodeCensored + ExtendedErrorCodeFiltered + ExtendedErrorCodeProhibited + ExtendedErrorCodeStaleNXDOMAINAnswer + ExtendedErrorCodeNotAuthoritative + ExtendedErrorCodeNotSupported + ExtendedErrorCodeNoReachableAuthority + ExtendedErrorCodeNetworkError + ExtendedErrorCodeInvalidData +) + +// ExtendedErrorCodeToString maps extended error info codes to a human readable +// description. +var ExtendedErrorCodeToString = map[uint16]string{ + ExtendedErrorCodeOther: "Other", + ExtendedErrorCodeUnsupportedDNSKEYAlgorithm: "Unsupported DNSKEY Algorithm", + ExtendedErrorCodeUnsupportedDSDigestType: "Unsupported DS Digest Type", + ExtendedErrorCodeStaleAnswer: "Stale Answer", + ExtendedErrorCodeForgedAnswer: "Forged Answer", + ExtendedErrorCodeDNSSECIndeterminate: "DNSSEC Indeterminate", + ExtendedErrorCodeDNSBogus: "DNSSEC Bogus", + ExtendedErrorCodeSignatureExpired: "Signature Expired", + ExtendedErrorCodeSignatureNotYetValid: "Signature Not Yet Valid", + ExtendedErrorCodeDNSKEYMissing: "DNSKEY Missing", + ExtendedErrorCodeRRSIGsMissing: "RRSIGs Missing", + ExtendedErrorCodeNoZoneKeyBitSet: "No Zone Key Bit Set", + ExtendedErrorCodeNSECMissing: "NSEC Missing", + ExtendedErrorCodeCachedError: "Cached Error", + ExtendedErrorCodeNotReady: "Not Ready", + ExtendedErrorCodeBlocked: "Blocked", + ExtendedErrorCodeCensored: "Censored", + ExtendedErrorCodeFiltered: "Filtered", + ExtendedErrorCodeProhibited: "Prohibited", + ExtendedErrorCodeStaleNXDOMAINAnswer: "Stale NXDOMAIN Answer", + ExtendedErrorCodeNotAuthoritative: "Not Authoritative", + ExtendedErrorCodeNotSupported: "Not Supported", + ExtendedErrorCodeNoReachableAuthority: "No Reachable Authority", + ExtendedErrorCodeNetworkError: "Network Error", + ExtendedErrorCodeInvalidData: "Invalid Data", +} + +// StringToExtendedErrorCode is a map from human readable descriptions to +// extended error info codes. +var StringToExtendedErrorCode = reverseInt16(ExtendedErrorCodeToString) + +// EDNS0_EDE option is used to return additional information about the cause of +// DNS errors. +type EDNS0_EDE struct { + InfoCode uint16 + ExtraText string +} + +// Option implements the EDNS0 interface. +func (e *EDNS0_EDE) Option() uint16 { return EDNS0EDE } +func (e *EDNS0_EDE) copy() EDNS0 { return &EDNS0_EDE{e.InfoCode, e.ExtraText} } + +func (e *EDNS0_EDE) String() string { + info := strconv.FormatUint(uint64(e.InfoCode), 10) + if s, ok := ExtendedErrorCodeToString[e.InfoCode]; ok { + info += fmt.Sprintf(" (%s)", s) + } + return fmt.Sprintf("%s: (%s)", info, e.ExtraText) +} + +func (e *EDNS0_EDE) pack() ([]byte, error) { + b := make([]byte, 2+len(e.ExtraText)) + binary.BigEndian.PutUint16(b[0:], e.InfoCode) + copy(b[2:], []byte(e.ExtraText)) + return b, nil +} + +func (e *EDNS0_EDE) unpack(b []byte) error { + if len(b) < 2 { + return ErrBuf + } + e.InfoCode = binary.BigEndian.Uint16(b[0:]) + e.ExtraText = string(b[2:]) + return nil +} diff --git a/vendor/github.com/miekg/dns/generate.go b/vendor/github.com/miekg/dns/generate.go index f713074a..ac8df34d 100644 --- a/vendor/github.com/miekg/dns/generate.go +++ b/vendor/github.com/miekg/dns/generate.go @@ -75,10 +75,10 @@ func (zp *ZoneParser) generate(l lex) (RR, bool) { r := &generateReader{ s: s, - cur: int(start), - start: int(start), - end: int(end), - step: int(step), + cur: start, + start: start, + end: end, + step: step, file: zp.file, lex: &l, @@ -94,10 +94,10 @@ type generateReader struct { s string si int - cur int - start int - end int - step int + cur int64 + start int64 + end int64 + step int64 mod bytes.Buffer @@ -173,7 +173,7 @@ func (r *generateReader) ReadByte() (byte, error) { return '$', nil } - var offset int + var offset int64 // Search for { and } if r.s[si+1] == '{' { @@ -188,7 +188,7 @@ func (r *generateReader) ReadByte() (byte, error) { if errMsg != "" { return 0, r.parseError(errMsg, si+3+sep) } - if r.start+offset < 0 || int64(r.end) + int64(offset) > 1<<31-1 { + if r.start+offset < 0 || r.end+offset > 1<<31-1 { return 0, r.parseError("bad offset in $GENERATE", si+3+sep) } @@ -208,7 +208,7 @@ func (r *generateReader) ReadByte() (byte, error) { } // Convert a $GENERATE modifier 0,0,d to something Printf can deal with. -func modToPrintf(s string) (string, int, string) { +func modToPrintf(s string) (string, int64, string) { // Modifier is { offset [ ,width [ ,base ] ] } - provide default // values for optional width and type, if necessary. var offStr, widthStr, base string @@ -240,8 +240,8 @@ func modToPrintf(s string) (string, int, string) { } if width == 0 { - return "%" + base, int(offset), "" + return "%" + base, offset, "" } - return "%0" + widthStr + base, int(offset), "" + return "%0" + widthStr + base, offset, "" } diff --git a/vendor/github.com/miekg/dns/labels.go b/vendor/github.com/miekg/dns/labels.go index df1675df..f9faacfe 100644 --- a/vendor/github.com/miekg/dns/labels.go +++ b/vendor/github.com/miekg/dns/labels.go @@ -10,7 +10,7 @@ package dns // escaped dots (\.) for instance. // s must be a syntactically valid domain name, see IsDomainName. func SplitDomainName(s string) (labels []string) { - if len(s) == 0 { + if s == "" { return nil } fqdnEnd := 0 // offset of the final '.' or the length of the name diff --git a/vendor/github.com/miekg/dns/listen_go_not111.go b/vendor/github.com/miekg/dns/listen_no_reuseport.go similarity index 100% rename from vendor/github.com/miekg/dns/listen_go_not111.go rename to vendor/github.com/miekg/dns/listen_no_reuseport.go diff --git a/vendor/github.com/miekg/dns/listen_go111.go b/vendor/github.com/miekg/dns/listen_reuseport.go similarity index 100% rename from vendor/github.com/miekg/dns/listen_go111.go rename to vendor/github.com/miekg/dns/listen_reuseport.go diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go index 7001f6da..ead4b693 100644 --- a/vendor/github.com/miekg/dns/msg.go +++ b/vendor/github.com/miekg/dns/msg.go @@ -624,11 +624,18 @@ func UnpackRRWithHeader(h RR_Header, msg []byte, off int) (rr RR, off1 int, err rr = &RFC3597{Hdr: h} } - if noRdata(h) { - return rr, off, nil + if off < 0 || off > len(msg) { + return &h, off, &Error{err: "bad off"} } end := off + int(h.Rdlength) + if end < off || end > len(msg) { + return &h, end, &Error{err: "bad rdlength"} + } + + if noRdata(h) { + return rr, off, nil + } off, err = rr.unpack(msg, off) if err != nil { @@ -735,7 +742,7 @@ func (dns *Msg) packBufferWithCompressionMap(buf []byte, compression compression } // Set extended rcode unconditionally if we have an opt, this will allow - // reseting the extended rcode bits if they need to. + // resetting the extended rcode bits if they need to. if opt := dns.IsEdns0(); opt != nil { opt.SetExtendedRcode(uint16(dns.Rcode)) } else if dns.Rcode > 0xF { diff --git a/vendor/github.com/miekg/dns/msg_helpers.go b/vendor/github.com/miekg/dns/msg_helpers.go index 47625ed0..5904927c 100644 --- a/vendor/github.com/miekg/dns/msg_helpers.go +++ b/vendor/github.com/miekg/dns/msg_helpers.go @@ -438,35 +438,6 @@ Option: return edns, off, nil } -func makeDataOpt(code uint16) EDNS0 { - switch code { - case EDNS0NSID: - return new(EDNS0_NSID) - case EDNS0SUBNET: - return new(EDNS0_SUBNET) - case EDNS0COOKIE: - return new(EDNS0_COOKIE) - case EDNS0EXPIRE: - return new(EDNS0_EXPIRE) - case EDNS0UL: - return new(EDNS0_UL) - case EDNS0LLQ: - return new(EDNS0_LLQ) - case EDNS0DAU: - return new(EDNS0_DAU) - case EDNS0DHU: - return new(EDNS0_DHU) - case EDNS0N3U: - return new(EDNS0_N3U) - case EDNS0PADDING: - return new(EDNS0_PADDING) - default: - e := new(EDNS0_LOCAL) - e.Code = code - return e - } -} - func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) { for _, el := range options { b, err := el.pack() diff --git a/vendor/github.com/miekg/dns/msg_truncate.go b/vendor/github.com/miekg/dns/msg_truncate.go index 156c5a0e..2ddc9a7d 100644 --- a/vendor/github.com/miekg/dns/msg_truncate.go +++ b/vendor/github.com/miekg/dns/msg_truncate.go @@ -8,6 +8,11 @@ package dns // record adding as many records as possible without exceeding the // requested buffer size. // +// If the message fits within the requested size without compression, +// Truncate will set the message's Compress attribute to false. It is +// the caller's responsibility to set it back to true if they wish to +// compress the payload regardless of size. +// // The TC bit will be set if any records were excluded from the message. // If the TC bit is already set on the message it will be retained. // TC indicates that the client should retry over TCP. diff --git a/vendor/github.com/miekg/dns/privaterr.go b/vendor/github.com/miekg/dns/privaterr.go index cda6cae3..d256b652 100644 --- a/vendor/github.com/miekg/dns/privaterr.go +++ b/vendor/github.com/miekg/dns/privaterr.go @@ -6,7 +6,7 @@ import "strings" // RFC 6895. This allows one to experiment with new RR types, without requesting an // official type code. Also see dns.PrivateHandle and dns.PrivateHandleRemove. type PrivateRdata interface { - // String returns the text presentaton of the Rdata of the Private RR. + // String returns the text presentation of the Rdata of the Private RR. String() string // Parse parses the Rdata of the private RR. Parse([]string) error @@ -90,7 +90,7 @@ Fetch: return nil } -func (r1 *PrivateRR) isDuplicate(r2 RR) bool { return false } +func (r *PrivateRR) isDuplicate(r2 RR) bool { return false } // PrivateHandle registers a private resource record type. It requires // string and numeric representation of private RR type and generator function as argument. diff --git a/vendor/github.com/miekg/dns/scan.go b/vendor/github.com/miekg/dns/scan.go index aa2840ef..57be9882 100644 --- a/vendor/github.com/miekg/dns/scan.go +++ b/vendor/github.com/miekg/dns/scan.go @@ -150,6 +150,9 @@ func ReadRR(r io.Reader, file string) (RR, error) { // The text "; this is comment" is returned from Comment. Comments inside // the RR are returned concatenated along with the RR. Comments on a line // by themselves are discarded. +// +// Callers should not assume all returned data in an Resource Record is +// syntactically correct, e.g. illegal base64 in RRSIGs will be returned as-is. type ZoneParser struct { c *zlexer @@ -577,10 +580,23 @@ func (zp *ZoneParser) Next() (RR, bool) { st = zExpectRdata case zExpectRdata: - var rr RR - if newFn, ok := TypeToRR[h.Rrtype]; ok && canParseAsRR(h.Rrtype) { + var ( + rr RR + parseAsRFC3597 bool + ) + if newFn, ok := TypeToRR[h.Rrtype]; ok { rr = newFn() *rr.Header() = *h + + // We may be parsing a known RR type using the RFC3597 format. + // If so, we handle that here in a generic way. + // + // This is also true for PrivateRR types which will have the + // RFC3597 parsing done for them and the Unpack method called + // to populate the RR instead of simply deferring to Parse. + if zp.c.Peek().token == "\\#" { + parseAsRFC3597 = true + } } else { rr = &RFC3597{Hdr: *h} } @@ -600,13 +616,18 @@ func (zp *ZoneParser) Next() (RR, bool) { return zp.setParseError("unexpected newline", l) } - if err := rr.parse(zp.c, zp.origin); err != nil { + parseAsRR := rr + if parseAsRFC3597 { + parseAsRR = &RFC3597{Hdr: *h} + } + + if err := parseAsRR.parse(zp.c, zp.origin); err != nil { // err is a concrete *ParseError without the file field set. // The setParseError call below will construct a new // *ParseError with file set to zp.file. - // If err.lex is nil than we have encounter an unknown RR type - // in that case we substitute our current lex token. + // err.lex may be nil in which case we substitute our current + // lex token. if err.lex == (lex{}) { return zp.setParseError(err.err, l) } @@ -614,6 +635,13 @@ func (zp *ZoneParser) Next() (RR, bool) { return zp.setParseError(err.err, err.lex) } + if parseAsRFC3597 { + err := parseAsRR.(*RFC3597).fromRFC3597(rr) + if err != nil { + return zp.setParseError(err.Error(), l) + } + } + return rr, true } } @@ -623,18 +651,6 @@ func (zp *ZoneParser) Next() (RR, bool) { return nil, false } -// canParseAsRR returns true if the record type can be parsed as a -// concrete RR. It blacklists certain record types that must be parsed -// according to RFC 3597 because they lack a presentation format. -func canParseAsRR(rrtype uint16) bool { - switch rrtype { - case TypeANY, TypeNULL, TypeOPT, TypeTSIG: - return false - default: - return true - } -} - type zlexer struct { br io.ByteReader @@ -1220,7 +1236,7 @@ func stringToCm(token string) (e, m uint8, ok bool) { // 'nn.1' must be treated as 'nn-meters and 10cm, not 1cm. cmeters *= 10 } - if len(s[0]) == 0 { + if s[0] == "" { // This will allow omitting the 'meter' part, like .01 (meaning 0.01m = 1cm). break } @@ -1290,7 +1306,7 @@ func appendOrigin(name, origin string) string { // LOC record helper function func locCheckNorth(token string, latitude uint32) (uint32, bool) { - if latitude > 90 * 1000 * 60 * 60 { + if latitude > 90*1000*60*60 { return latitude, false } switch token { @@ -1304,7 +1320,7 @@ func locCheckNorth(token string, latitude uint32) (uint32, bool) { // LOC record helper function func locCheckEast(token string, longitude uint32) (uint32, bool) { - if longitude > 180 * 1000 * 60 * 60 { + if longitude > 180*1000*60*60 { return longitude, false } switch token { @@ -1339,7 +1355,7 @@ func stringToNodeID(l lex) (uint64, *ParseError) { if len(l.token) < 19 { return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} } - // There must be three colons at fixes postitions, if not its a parse error + // There must be three colons at fixes positions, if not its a parse error if l.token[4] != ':' && l.token[9] != ':' && l.token[14] != ':' { return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} } diff --git a/vendor/github.com/miekg/dns/scan_rr.go b/vendor/github.com/miekg/dns/scan_rr.go index 69f10052..e398484d 100644 --- a/vendor/github.com/miekg/dns/scan_rr.go +++ b/vendor/github.com/miekg/dns/scan_rr.go @@ -609,7 +609,7 @@ func (rr *LOC) parse(c *zlexer, o string) *ParseError { c.Next() // zBlank l, _ = c.Next() - if i, err := strconv.ParseFloat(l.token, 32); err != nil || l.err || i < 0 || i >= 60 { + if i, err := strconv.ParseFloat(l.token, 64); err != nil || l.err || i < 0 || i >= 60 { return &ParseError{"", "bad LOC Latitude seconds", l} } else { rr.Latitude += uint32(1000 * i) @@ -645,7 +645,7 @@ East: } c.Next() // zBlank l, _ = c.Next() - if i, err := strconv.ParseFloat(l.token, 32); err != nil || l.err || i < 0 || i >= 60 { + if i, err := strconv.ParseFloat(l.token, 64); err != nil || l.err || i < 0 || i >= 60 { return &ParseError{"", "bad LOC Longitude seconds", l} } else { rr.Longitude += uint32(1000 * i) @@ -662,7 +662,7 @@ East: Altitude: c.Next() // zBlank l, _ = c.Next() - if len(l.token) == 0 || l.err { + if l.token == "" || l.err { return &ParseError{"", "bad LOC Altitude", l} } if l.token[len(l.token)-1] == 'M' || l.token[len(l.token)-1] == 'm' { @@ -722,7 +722,7 @@ func (rr *HIP) parse(c *zlexer, o string) *ParseError { c.Next() // zBlank l, _ = c.Next() // zString - if len(l.token) == 0 || l.err { + if l.token == "" || l.err { return &ParseError{"", "bad HIP Hit", l} } rr.Hit = l.token // This can not contain spaces, see RFC 5205 Section 6. @@ -730,11 +730,15 @@ func (rr *HIP) parse(c *zlexer, o string) *ParseError { c.Next() // zBlank l, _ = c.Next() // zString - if len(l.token) == 0 || l.err { + if l.token == "" || l.err { return &ParseError{"", "bad HIP PublicKey", l} } rr.PublicKey = l.token // This cannot contain spaces - rr.PublicKeyLength = uint16(base64.StdEncoding.DecodedLen(len(rr.PublicKey))) + decodedPK, decodedPKerr := base64.StdEncoding.DecodeString(rr.PublicKey) + if decodedPKerr != nil { + return &ParseError{"", "bad HIP PublicKey", l} + } + rr.PublicKeyLength = uint16(len(decodedPK)) // RendezvousServers (if any) l, _ = c.Next() @@ -846,6 +850,38 @@ func (rr *CSYNC) parse(c *zlexer, o string) *ParseError { return nil } +func (rr *ZONEMD) parse(c *zlexer, o string) *ParseError { + l, _ := c.Next() + i, e := strconv.ParseUint(l.token, 10, 32) + if e != nil || l.err { + return &ParseError{"", "bad ZONEMD Serial", l} + } + rr.Serial = uint32(i) + + c.Next() // zBlank + l, _ = c.Next() + i, e1 := strconv.ParseUint(l.token, 10, 8) + if e1 != nil || l.err { + return &ParseError{"", "bad ZONEMD Scheme", l} + } + rr.Scheme = uint8(i) + + c.Next() // zBlank + l, _ = c.Next() + i, err := strconv.ParseUint(l.token, 10, 8) + if err != nil || l.err { + return &ParseError{"", "bad ZONEMD Hash Algorithm", l} + } + rr.Hash = uint8(i) + + s, e2 := endingToString(c, "bad ZONEMD Digest") + if e2 != nil { + return e2 + } + rr.Digest = s + return nil +} + func (rr *SIG) parse(c *zlexer, o string) *ParseError { return rr.RRSIG.parse(c, o) } func (rr *RRSIG) parse(c *zlexer, o string) *ParseError { @@ -997,7 +1033,7 @@ func (rr *NSEC3) parse(c *zlexer, o string) *ParseError { rr.Iterations = uint16(i) c.Next() l, _ = c.Next() - if len(l.token) == 0 || l.err { + if l.token == "" || l.err { return &ParseError{"", "bad NSEC3 Salt", l} } if l.token != "-" { @@ -1007,7 +1043,7 @@ func (rr *NSEC3) parse(c *zlexer, o string) *ParseError { c.Next() l, _ = c.Next() - if len(l.token) == 0 || l.err { + if l.token == "" || l.err { return &ParseError{"", "bad NSEC3 NextDomain", l} } rr.HashLength = 20 // Fix for NSEC3 (sha1 160 bits) @@ -1387,7 +1423,7 @@ func (rr *RFC3597) parse(c *zlexer, o string) *ParseError { c.Next() // zBlank l, _ = c.Next() - rdlength, e := strconv.Atoi(l.token) + rdlength, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { return &ParseError{"", "bad RFC3597 Rdata ", l} } @@ -1396,7 +1432,7 @@ func (rr *RFC3597) parse(c *zlexer, o string) *ParseError { if e1 != nil { return e1 } - if rdlength*2 != len(s) { + if int(rdlength)*2 != len(s) { return &ParseError{"", "bad RFC3597 Rdata", l} } rr.Rdata = s diff --git a/vendor/github.com/miekg/dns/server.go b/vendor/github.com/miekg/dns/server.go index 30dfd41d..b2a63bda 100644 --- a/vendor/github.com/miekg/dns/server.go +++ b/vendor/github.com/miekg/dns/server.go @@ -321,6 +321,7 @@ func (srv *Server) ListenAndServe() error { } u := l.(*net.UDPConn) if e := setUDPSocketOptions(u); e != nil { + u.Close() return e } srv.PacketConn = l @@ -752,11 +753,10 @@ func (w *response) Write(m []byte) (int, error) { return 0, &Error{err: "message too large"} } - l := make([]byte, 2) - binary.BigEndian.PutUint16(l, uint16(len(m))) - - n, err := (&net.Buffers{l, m}).WriteTo(w.tcp) - return int(n), err + msg := make([]byte, 2+len(m)) + binary.BigEndian.PutUint16(msg, uint16(len(m))) + copy(msg[2:], m) + return w.tcp.Write(msg) default: panic("dns: internal error: udp and tcp both nil") } diff --git a/vendor/github.com/miekg/dns/sig0.go b/vendor/github.com/miekg/dns/sig0.go index 9ef13ccf..e781c9bb 100644 --- a/vendor/github.com/miekg/dns/sig0.go +++ b/vendor/github.com/miekg/dns/sig0.go @@ -17,7 +17,7 @@ func (rr *SIG) Sign(k crypto.Signer, m *Msg) ([]byte, error) { if k == nil { return nil, ErrPrivKey } - if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 { + if rr.KeyTag == 0 || rr.SignerName == "" || rr.Algorithm == 0 { return nil, ErrKey } @@ -78,7 +78,7 @@ func (rr *SIG) Verify(k *KEY, buf []byte) error { if k == nil { return ErrKey } - if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 { + if rr.KeyTag == 0 || rr.SignerName == "" || rr.Algorithm == 0 { return ErrKey } diff --git a/vendor/github.com/miekg/dns/svcb.go b/vendor/github.com/miekg/dns/svcb.go index f44dc67d..3344253c 100644 --- a/vendor/github.com/miekg/dns/svcb.go +++ b/vendor/github.com/miekg/dns/svcb.go @@ -10,6 +10,7 @@ import ( "strings" ) +// SVCBKey is the type of the keys used in the SVCB RR. type SVCBKey uint16 // Keys defined in draft-ietf-dnsop-svcb-https-01 Section 12.3.2. @@ -204,7 +205,7 @@ type SVCB struct { Hdr RR_Header Priority uint16 Target string `dns:"domain-name"` - Value []SVCBKeyValue `dns:"pairs"` // Value must be empty if Priority is non-zero. + Value []SVCBKeyValue `dns:"pairs"` // Value must be empty if Priority is zero. } // HTTPS RR. Everything valid for SVCB applies to HTTPS as well. @@ -321,7 +322,7 @@ func (s *SVCBAlpn) pack() ([]byte, error) { // Liberally estimate the size of an alpn as 10 octets b := make([]byte, 0, 10*len(s.Alpn)) for _, e := range s.Alpn { - if len(e) == 0 { + if e == "" { return nil, errors.New("dns: svcbalpn: empty alpn-id") } if len(e) > 255 { @@ -390,7 +391,7 @@ func (*SVCBNoDefaultAlpn) unpack(b []byte) error { } func (*SVCBNoDefaultAlpn) parse(b string) error { - if len(b) != 0 { + if b != "" { return errors.New("dns: svcbnodefaultalpn: no_default_alpn must have no value") } return nil @@ -511,8 +512,13 @@ func (s *SVCBIPv4Hint) parse(b string) error { } func (s *SVCBIPv4Hint) copy() SVCBKeyValue { + hint := make([]net.IP, len(s.Hint)) + for i, ip := range s.Hint { + hint[i] = copyIP(ip) + } + return &SVCBIPv4Hint{ - append([]net.IP(nil), s.Hint...), + Hint: hint, } } @@ -629,8 +635,13 @@ func (s *SVCBIPv6Hint) parse(b string) error { } func (s *SVCBIPv6Hint) copy() SVCBKeyValue { + hint := make([]net.IP, len(s.Hint)) + for i, ip := range s.Hint { + hint[i] = copyIP(ip) + } + return &SVCBIPv6Hint{ - append([]net.IP(nil), s.Hint...), + Hint: hint, } } diff --git a/vendor/github.com/miekg/dns/tsig.go b/vendor/github.com/miekg/dns/tsig.go index 59904dd6..b49562d8 100644 --- a/vendor/github.com/miekg/dns/tsig.go +++ b/vendor/github.com/miekg/dns/tsig.go @@ -24,6 +24,56 @@ const ( HmacMD5 = "hmac-md5.sig-alg.reg.int." // Deprecated: HmacMD5 is no longer supported. ) +// TsigProvider provides the API to plug-in a custom TSIG implementation. +type TsigProvider interface { + // Generate is passed the DNS message to be signed and the partial TSIG RR. It returns the signature and nil, otherwise an error. + Generate(msg []byte, t *TSIG) ([]byte, error) + // Verify is passed the DNS message to be verified and the TSIG RR. If the signature is valid it will return nil, otherwise an error. + Verify(msg []byte, t *TSIG) error +} + +type tsigHMACProvider string + +func (key tsigHMACProvider) Generate(msg []byte, t *TSIG) ([]byte, error) { + // If we barf here, the caller is to blame + rawsecret, err := fromBase64([]byte(key)) + if err != nil { + return nil, err + } + var h hash.Hash + switch CanonicalName(t.Algorithm) { + case HmacSHA1: + h = hmac.New(sha1.New, rawsecret) + case HmacSHA224: + h = hmac.New(sha256.New224, rawsecret) + case HmacSHA256: + h = hmac.New(sha256.New, rawsecret) + case HmacSHA384: + h = hmac.New(sha512.New384, rawsecret) + case HmacSHA512: + h = hmac.New(sha512.New, rawsecret) + default: + return nil, ErrKeyAlg + } + h.Write(msg) + return h.Sum(nil), nil +} + +func (key tsigHMACProvider) Verify(msg []byte, t *TSIG) error { + b, err := key.Generate(msg, t) + if err != nil { + return err + } + mac, err := hex.DecodeString(t.MAC) + if err != nil { + return err + } + if !hmac.Equal(b, mac) { + return ErrSig + } + return nil +} + // TSIG is the RR the holds the transaction signature of a message. // See RFC 2845 and RFC 4635. type TSIG struct { @@ -56,8 +106,8 @@ func (rr *TSIG) String() string { return s } -func (rr *TSIG) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on TSIG") +func (*TSIG) parse(c *zlexer, origin string) *ParseError { + return &ParseError{err: "TSIG records do not have a presentation format"} } // The following values must be put in wireformat, so that the MAC can be calculated. @@ -98,14 +148,13 @@ type timerWireFmt struct { // timersOnly is false. // If something goes wrong an error is returned, otherwise it is nil. func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, string, error) { + return tsigGenerateProvider(m, tsigHMACProvider(secret), requestMAC, timersOnly) +} + +func tsigGenerateProvider(m *Msg, provider TsigProvider, requestMAC string, timersOnly bool) ([]byte, string, error) { if m.IsTsig() == nil { panic("dns: TSIG not last RR in additional") } - // If we barf here, the caller is to blame - rawsecret, err := fromBase64([]byte(secret)) - if err != nil { - return nil, "", err - } rr := m.Extra[len(m.Extra)-1].(*TSIG) m.Extra = m.Extra[0 : len(m.Extra)-1] // kill the TSIG from the msg @@ -119,25 +168,13 @@ func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, s } t := new(TSIG) - var h hash.Hash - switch CanonicalName(rr.Algorithm) { - case HmacSHA1: - h = hmac.New(sha1.New, rawsecret) - case HmacSHA224: - h = hmac.New(sha256.New224, rawsecret) - case HmacSHA256: - h = hmac.New(sha256.New, rawsecret) - case HmacSHA384: - h = hmac.New(sha512.New384, rawsecret) - case HmacSHA512: - h = hmac.New(sha512.New, rawsecret) - default: - return nil, "", ErrKeyAlg - } - h.Write(buf) // Copy all TSIG fields except MAC and its size, which are filled using the computed digest. *t = *rr - t.MAC = hex.EncodeToString(h.Sum(nil)) + mac, err := provider.Generate(buf, rr) + if err != nil { + return nil, "", err + } + t.MAC = hex.EncodeToString(mac) t.MACSize = uint16(len(t.MAC) / 2) // Size is half! tbuf := make([]byte, Len(t)) @@ -156,49 +193,28 @@ func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, s // If the signature does not validate err contains the // error, otherwise it is nil. func TsigVerify(msg []byte, secret, requestMAC string, timersOnly bool) error { - return tsigVerify(msg, secret, requestMAC, timersOnly, uint64(time.Now().Unix())) + return tsigVerify(msg, tsigHMACProvider(secret), requestMAC, timersOnly, uint64(time.Now().Unix())) +} + +func tsigVerifyProvider(msg []byte, provider TsigProvider, requestMAC string, timersOnly bool) error { + return tsigVerify(msg, provider, requestMAC, timersOnly, uint64(time.Now().Unix())) } // actual implementation of TsigVerify, taking the current time ('now') as a parameter for the convenience of tests. -func tsigVerify(msg []byte, secret, requestMAC string, timersOnly bool, now uint64) error { - rawsecret, err := fromBase64([]byte(secret)) - if err != nil { - return err - } +func tsigVerify(msg []byte, provider TsigProvider, requestMAC string, timersOnly bool, now uint64) error { // Strip the TSIG from the incoming msg stripped, tsig, err := stripTsig(msg) if err != nil { return err } - msgMAC, err := hex.DecodeString(tsig.MAC) - if err != nil { - return err - } - buf, err := tsigBuffer(stripped, tsig, requestMAC, timersOnly) if err != nil { return err } - var h hash.Hash - switch CanonicalName(tsig.Algorithm) { - case HmacSHA1: - h = hmac.New(sha1.New, rawsecret) - case HmacSHA224: - h = hmac.New(sha256.New224, rawsecret) - case HmacSHA256: - h = hmac.New(sha256.New, rawsecret) - case HmacSHA384: - h = hmac.New(sha512.New384, rawsecret) - case HmacSHA512: - h = hmac.New(sha512.New, rawsecret) - default: - return ErrKeyAlg - } - h.Write(buf) - if !hmac.Equal(h.Sum(nil), msgMAC) { - return ErrSig + if err := provider.Verify(buf, tsig); err != nil { + return err } // Fudge factor works both ways. A message can arrive before it was signed because diff --git a/vendor/github.com/miekg/dns/types.go b/vendor/github.com/miekg/dns/types.go index 1f385bd2..d9becb67 100644 --- a/vendor/github.com/miekg/dns/types.go +++ b/vendor/github.com/miekg/dns/types.go @@ -81,6 +81,7 @@ const ( TypeCDNSKEY uint16 = 60 TypeOPENPGPKEY uint16 = 61 TypeCSYNC uint16 = 62 + TypeZONEMD uint16 = 63 TypeSVCB uint16 = 64 TypeHTTPS uint16 = 65 TypeSPF uint16 = 99 @@ -150,6 +151,14 @@ const ( OpcodeUpdate = 5 ) +// Used in ZONEMD https://tools.ietf.org/html/rfc8976 +const ( + ZoneMDSchemeSimple = 1 + + ZoneMDHashAlgSHA384 = 1 + ZoneMDHashAlgSHA512 = 2 +) + // Header is the wire format for the DNS packet header. type Header struct { Id uint16 @@ -245,8 +254,8 @@ type ANY struct { func (rr *ANY) String() string { return rr.Hdr.String() } -func (rr *ANY) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on ANY") +func (*ANY) parse(c *zlexer, origin string) *ParseError { + return &ParseError{err: "ANY records do not have a presentation format"} } // NULL RR. See RFC 1035. @@ -260,8 +269,8 @@ func (rr *NULL) String() string { return ";" + rr.Hdr.String() + rr.Data } -func (rr *NULL) parse(c *zlexer, origin string) *ParseError { - panic("dns: internal error: parse should never be called on NULL") +func (*NULL) parse(c *zlexer, origin string) *ParseError { + return &ParseError{err: "NULL records do not have a presentation format"} } // CNAME RR. See RFC 1034. @@ -1361,6 +1370,23 @@ func (rr *CSYNC) len(off int, compression map[string]struct{}) int { return l } +// ZONEMD RR, from draft-ietf-dnsop-dns-zone-digest +type ZONEMD struct { + Hdr RR_Header + Serial uint32 + Scheme uint8 + Hash uint8 + Digest string `dns:"hex"` +} + +func (rr *ZONEMD) String() string { + return rr.Hdr.String() + + strconv.Itoa(int(rr.Serial)) + + " " + strconv.Itoa(int(rr.Scheme)) + + " " + strconv.Itoa(int(rr.Hash)) + + " " + rr.Digest +} + // APL RR. See RFC 3123. type APL struct { Hdr RR_Header @@ -1387,13 +1413,13 @@ func (rr *APL) String() string { } // str returns presentation form of the APL prefix. -func (p *APLPrefix) str() string { +func (a *APLPrefix) str() string { var sb strings.Builder - if p.Negation { + if a.Negation { sb.WriteByte('!') } - switch len(p.Network.IP) { + switch len(a.Network.IP) { case net.IPv4len: sb.WriteByte('1') case net.IPv6len: @@ -1402,20 +1428,20 @@ func (p *APLPrefix) str() string { sb.WriteByte(':') - switch len(p.Network.IP) { + switch len(a.Network.IP) { case net.IPv4len: - sb.WriteString(p.Network.IP.String()) + sb.WriteString(a.Network.IP.String()) case net.IPv6len: // add prefix for IPv4-mapped IPv6 - if v4 := p.Network.IP.To4(); v4 != nil { + if v4 := a.Network.IP.To4(); v4 != nil { sb.WriteString("::ffff:") } - sb.WriteString(p.Network.IP.String()) + sb.WriteString(a.Network.IP.String()) } sb.WriteByte('/') - prefix, _ := p.Network.Mask.Size() + prefix, _ := a.Network.Mask.Size() sb.WriteString(strconv.Itoa(prefix)) return sb.String() @@ -1429,17 +1455,17 @@ func (a *APLPrefix) equals(b *APLPrefix) bool { } // copy returns a copy of the APL prefix. -func (p *APLPrefix) copy() APLPrefix { +func (a *APLPrefix) copy() APLPrefix { return APLPrefix{ - Negation: p.Negation, - Network: copyNet(p.Network), + Negation: a.Negation, + Network: copyNet(a.Network), } } // len returns size of the prefix in wire format. -func (p *APLPrefix) len() int { +func (a *APLPrefix) len() int { // 4-byte header and the network address prefix (see Section 4 of RFC 3123) - prefix, _ := p.Network.Mask.Size() + prefix, _ := a.Network.Mask.Size() return 4 + (prefix+7)/8 } @@ -1472,7 +1498,7 @@ func StringToTime(s string) (uint32, error) { // saltToString converts a NSECX salt to uppercase and returns "-" when it is empty. func saltToString(s string) string { - if len(s) == 0 { + if s == "" { return "-" } return strings.ToUpper(s) diff --git a/vendor/github.com/miekg/dns/version.go b/vendor/github.com/miekg/dns/version.go index 5c75851b..622c69a1 100644 --- a/vendor/github.com/miekg/dns/version.go +++ b/vendor/github.com/miekg/dns/version.go @@ -3,7 +3,7 @@ package dns import "fmt" // Version is current version of this library. -var Version = v{1, 1, 35} +var Version = v{1, 1, 43} // v holds the version of this library. type v struct { diff --git a/vendor/github.com/miekg/dns/zduplicate.go b/vendor/github.com/miekg/dns/zduplicate.go index 0d3b34bd..9eb1dac2 100644 --- a/vendor/github.com/miekg/dns/zduplicate.go +++ b/vendor/github.com/miekg/dns/zduplicate.go @@ -1317,3 +1317,24 @@ func (r1 *X25) isDuplicate(_r2 RR) bool { } return true } + +func (r1 *ZONEMD) isDuplicate(_r2 RR) bool { + r2, ok := _r2.(*ZONEMD) + if !ok { + return false + } + _ = r2 + if r1.Serial != r2.Serial { + return false + } + if r1.Scheme != r2.Scheme { + return false + } + if r1.Hash != r2.Hash { + return false + } + if r1.Digest != r2.Digest { + return false + } + return true +} diff --git a/vendor/github.com/miekg/dns/zmsg.go b/vendor/github.com/miekg/dns/zmsg.go index d24a10fa..fc0822f9 100644 --- a/vendor/github.com/miekg/dns/zmsg.go +++ b/vendor/github.com/miekg/dns/zmsg.go @@ -1118,6 +1118,26 @@ func (rr *X25) pack(msg []byte, off int, compression compressionMap, compress bo return off, nil } +func (rr *ZONEMD) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { + off, err = packUint32(rr.Serial, msg, off) + if err != nil { + return off, err + } + off, err = packUint8(rr.Scheme, msg, off) + if err != nil { + return off, err + } + off, err = packUint8(rr.Hash, msg, off) + if err != nil { + return off, err + } + off, err = packStringHex(rr.Digest, msg, off) + if err != nil { + return off, err + } + return off, nil +} + // unpack*() functions func (rr *A) unpack(msg []byte, off int) (off1 int, err error) { @@ -2821,3 +2841,35 @@ func (rr *X25) unpack(msg []byte, off int) (off1 int, err error) { } return off, nil } + +func (rr *ZONEMD) unpack(msg []byte, off int) (off1 int, err error) { + rdStart := off + _ = rdStart + + rr.Serial, off, err = unpackUint32(msg, off) + if err != nil { + return off, err + } + if off == len(msg) { + return off, nil + } + rr.Scheme, off, err = unpackUint8(msg, off) + if err != nil { + return off, err + } + if off == len(msg) { + return off, nil + } + rr.Hash, off, err = unpackUint8(msg, off) + if err != nil { + return off, err + } + if off == len(msg) { + return off, nil + } + rr.Digest, off, err = unpackStringHex(msg, off, rdStart+int(rr.Hdr.Rdlength)) + if err != nil { + return off, err + } + return off, nil +} diff --git a/vendor/github.com/miekg/dns/ztypes.go b/vendor/github.com/miekg/dns/ztypes.go index 11b51bf2..5d060cfe 100644 --- a/vendor/github.com/miekg/dns/ztypes.go +++ b/vendor/github.com/miekg/dns/ztypes.go @@ -82,6 +82,7 @@ var TypeToRR = map[uint16]func() RR{ TypeUINFO: func() RR { return new(UINFO) }, TypeURI: func() RR { return new(URI) }, TypeX25: func() RR { return new(X25) }, + TypeZONEMD: func() RR { return new(ZONEMD) }, } // TypeToString is a map of strings for each RR type. @@ -168,6 +169,7 @@ var TypeToString = map[uint16]string{ TypeUNSPEC: "UNSPEC", TypeURI: "URI", TypeX25: "X25", + TypeZONEMD: "ZONEMD", TypeNSAPPTR: "NSAP-PTR", } @@ -245,6 +247,7 @@ func (rr *UID) Header() *RR_Header { return &rr.Hdr } func (rr *UINFO) Header() *RR_Header { return &rr.Hdr } func (rr *URI) Header() *RR_Header { return &rr.Hdr } func (rr *X25) Header() *RR_Header { return &rr.Hdr } +func (rr *ZONEMD) Header() *RR_Header { return &rr.Hdr } // len() functions func (rr *A) len(off int, compression map[string]struct{}) int { @@ -684,6 +687,14 @@ func (rr *X25) len(off int, compression map[string]struct{}) int { l += len(rr.PSDNAddress) + 1 return l } +func (rr *ZONEMD) len(off int, compression map[string]struct{}) int { + l := rr.Hdr.len(off, compression) + l += 4 // Serial + l++ // Scheme + l++ // Hash + l += len(rr.Digest) / 2 + return l +} // copy() functions func (rr *A) copy() RR { @@ -936,3 +947,6 @@ func (rr *URI) copy() RR { func (rr *X25) copy() RR { return &X25{rr.Hdr, rr.PSDNAddress} } +func (rr *ZONEMD) copy() RR { + return &ZONEMD{rr.Hdr, rr.Serial, rr.Scheme, rr.Hash, rr.Digest} +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go index 957d93a2..4bb816ab 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/desc.go @@ -20,7 +20,7 @@ import ( "strings" "github.com/cespare/xxhash/v2" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/model" diff --git a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go index 18a99d5f..c41ab37f 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go @@ -22,43 +22,10 @@ type expvarCollector struct { exports map[string]*Desc } -// NewExpvarCollector returns a newly allocated expvar Collector that still has -// to be registered with a Prometheus registry. +// NewExpvarCollector is the obsolete version of collectors.NewExpvarCollector. +// See there for documentation. // -// An expvar Collector collects metrics from the expvar interface. It provides a -// quick way to expose numeric values that are already exported via expvar as -// Prometheus metrics. Note that the data models of expvar and Prometheus are -// fundamentally different, and that the expvar Collector is inherently slower -// than native Prometheus metrics. Thus, the expvar Collector is probably great -// for experiments and prototying, but you should seriously consider a more -// direct implementation of Prometheus metrics for monitoring production -// systems. -// -// The exports map has the following meaning: -// -// The keys in the map correspond to expvar keys, i.e. for every expvar key you -// want to export as Prometheus metric, you need an entry in the exports -// map. The descriptor mapped to each key describes how to export the expvar -// value. It defines the name and the help string of the Prometheus metric -// proxying the expvar value. The type will always be Untyped. -// -// For descriptors without variable labels, the expvar value must be a number or -// a bool. The number is then directly exported as the Prometheus sample -// value. (For a bool, 'false' translates to 0 and 'true' to 1). Expvar values -// that are not numbers or bools are silently ignored. -// -// If the descriptor has one variable label, the expvar value must be an expvar -// map. The keys in the expvar map become the various values of the one -// Prometheus label. The values in the expvar map must be numbers or bools again -// as above. -// -// For descriptors with more than one variable label, the expvar must be a -// nested expvar map, i.e. where the values of the topmost map are maps again -// etc. until a depth is reached that corresponds to the number of labels. The -// leaves of that structure must be numbers or bools as above to serve as the -// sample values. -// -// Anything that does not fit into the scheme above is silently ignored. +// Deprecated: Use collectors.NewExpvarCollector instead. func NewExpvarCollector(exports map[string]*Desc) Collector { return &expvarCollector{ exports: exports, diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go index 6f67d104..a96ed1ce 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go @@ -36,32 +36,10 @@ type goCollector struct { msMaxAge time.Duration // Maximum allowed age of old memstats. } -// NewGoCollector returns a collector that exports metrics about the current Go -// process. This includes memory stats. To collect those, runtime.ReadMemStats -// is called. This requires to “stop the world”, which usually only happens for -// garbage collection (GC). Take the following implications into account when -// deciding whether to use the Go collector: +// NewGoCollector is the obsolete version of collectors.NewGoCollector. +// See there for documentation. // -// 1. The performance impact of stopping the world is the more relevant the more -// frequently metrics are collected. However, with Go1.9 or later the -// stop-the-world time per metrics collection is very short (~25µs) so that the -// performance impact will only matter in rare cases. However, with older Go -// versions, the stop-the-world duration depends on the heap size and can be -// quite significant (~1.7 ms/GiB as per -// https://go-review.googlesource.com/c/go/+/34937). -// -// 2. During an ongoing GC, nothing else can stop the world. Therefore, if the -// metrics collection happens to coincide with GC, it will only complete after -// GC has finished. Usually, GC is fast enough to not cause problems. However, -// with a very large heap, GC might take multiple seconds, which is enough to -// cause scrape timeouts in common setups. To avoid this problem, the Go -// collector will use the memstats from a previous collection if -// runtime.ReadMemStats takes more than 1s. However, if there are no previously -// collected memstats, or their collection is more than 5m ago, the collection -// will block until runtime.ReadMemStats succeeds. -// -// NOTE: The problem is solved in Go 1.15, see -// https://github.com/golang/go/issues/19812 for the related Go issue. +// Deprecated: Use collectors.NewGoCollector instead. func NewGoCollector() Collector { return &goCollector{ goroutinesDesc: NewDesc( @@ -366,25 +344,17 @@ type memStatsMetrics []struct { valType ValueType } -// NewBuildInfoCollector returns a collector collecting a single metric -// "go_build_info" with the constant value 1 and three labels "path", "version", -// and "checksum". Their label values contain the main module path, version, and -// checksum, respectively. The labels will only have meaningful values if the -// binary is built with Go module support and from source code retrieved from -// the source repository (rather than the local file system). This is usually -// accomplished by building from outside of GOPATH, specifying the full address -// of the main package, e.g. "GO111MODULE=on go run -// github.com/prometheus/client_golang/examples/random". If built without Go -// module support, all label values will be "unknown". If built with Go module -// support but using the source code from the local file system, the "path" will -// be set appropriately, but "checksum" will be empty and "version" will be -// "(devel)". +// NewBuildInfoCollector is the obsolete version of collectors.NewBuildInfoCollector. +// See there for documentation. // -// This collector uses only the build information for the main module. See -// https://github.com/povilasv/prommod for an example of a collector for the -// module dependencies. +// Deprecated: Use collectors.NewBuildInfoCollector instead. func NewBuildInfoCollector() Collector { - path, version, sum := readBuildInfo() + path, version, sum := "unknown", "unknown", "unknown" + if bi, ok := debug.ReadBuildInfo(); ok { + path = bi.Main.Path + version = bi.Main.Version + sum = bi.Main.Sum + } c := &selfCollector{MustNewConstMetric( NewDesc( "go_build_info", diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go index f71e286b..8425640b 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go @@ -22,7 +22,7 @@ import ( "sync/atomic" "time" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" @@ -47,7 +47,12 @@ type Histogram interface { Metric Collector - // Observe adds a single observation to the histogram. + // Observe adds a single observation to the histogram. Observations are + // usually positive or zero. Negative observations are accepted but + // prevent current versions of Prometheus from properly detecting + // counter resets in the sum of observations. See + // https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations + // for details. Observe(float64) } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go index a2b80b1c..dc121910 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/metric.go @@ -17,7 +17,7 @@ import ( "strings" "time" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/model" @@ -58,7 +58,7 @@ type Metric interface { } // Opts bundles the options for creating most Metric types. Each metric -// implementation XXX has its own XXXOpts type, but in most cases, it is just be +// implementation XXX has its own XXXOpts type, but in most cases, it is just // an alias of this type (which might change when the requirement arises.) // // It is mandatory to set Name to a non-empty string. All other fields are diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go index c46702d6..5bfe0ff5 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go @@ -54,16 +54,10 @@ type ProcessCollectorOpts struct { ReportErrors bool } -// NewProcessCollector returns a collector which exports the current state of -// process metrics including CPU, memory and file descriptor usage as well as -// the process start time. The detailed behavior is defined by the provided -// ProcessCollectorOpts. The zero value of ProcessCollectorOpts creates a -// collector for the current process with an empty namespace string and no error -// reporting. +// NewProcessCollector is the obsolete version of collectors.NewProcessCollector. +// See there for documentation. // -// The collector only works on operating systems with a Linux-style proc -// filesystem and on Microsoft Windows. On other operating systems, it will not -// collect any metrics. +// Deprecated: Use collectors.NewProcessCollector instead. func NewProcessCollector(opts ProcessCollectorOpts) Collector { ns := "" if len(opts.Namespace) > 0 { diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go index 5070e72e..e7c0d054 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go @@ -83,8 +83,7 @@ type readerFromDelegator struct{ *responseWriterDelegator } type pusherDelegator struct{ *responseWriterDelegator } func (d closeNotifierDelegator) CloseNotify() <-chan bool { - //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to - //remove support from client_golang yet. + //nolint:staticcheck // Ignore SA1019. http.CloseNotifier is deprecated but we keep it here to not break existing users. return d.ResponseWriter.(http.CloseNotifier).CloseNotify() } func (d flusherDelegator) Flush() { @@ -348,8 +347,7 @@ func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) deleg } id := 0 - //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to - //remove support from client_golang yet. + //nolint:staticcheck // Ignore SA1019. http.CloseNotifier is deprecated but we keep it here to not break existing users. if _, ok := w.(http.CloseNotifier); ok { id += closeNotifier } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go index 48f5ef9d..383a7f59 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go @@ -26,7 +26,7 @@ import ( "unicode/utf8" "github.com/cespare/xxhash/v2" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/expfmt" diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go index cf700714..c5fa8ed7 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/summary.go @@ -23,7 +23,7 @@ import ( "time" "github.com/beorn7/perks/quantile" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" @@ -55,7 +55,12 @@ type Summary interface { Metric Collector - // Observe adds a single observation to the summary. + // Observe adds a single observation to the summary. Observations are + // usually positive or zero. Negative observations are accepted but + // prevent current versions of Prometheus from properly detecting + // counter resets in the sum of observations. See + // https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations + // for details. Observe(float64) } @@ -121,7 +126,9 @@ type SummaryOpts struct { Objectives map[float64]float64 // MaxAge defines the duration for which an observation stays relevant - // for the summary. Must be positive. The default value is DefMaxAge. + // for the summary. Only applies to pre-calculated quantiles, does not + // apply to _sum and _count. Must be positive. The default value is + // DefMaxAge. MaxAge time.Duration // AgeBuckets is the number of buckets used to exclude observations that diff --git a/vendor/github.com/prometheus/client_golang/prometheus/value.go b/vendor/github.com/prometheus/client_golang/prometheus/value.go index 8304de47..c778711b 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/value.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/value.go @@ -19,7 +19,7 @@ import ( "time" "unicode/utf8" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go index 6ba49d85..4ababe6c 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/vec.go @@ -167,8 +167,8 @@ func (m *MetricVec) CurryWith(labels Labels) (*MetricVec, error) { // calling the newMetric function provided during construction of the // MetricVec). // -// It is possible to call this method without using the returned Metry to only -// create the new Metric but leave it in its intitial state. +// It is possible to call this method without using the returned Metric to only +// create the new Metric but leave it in its initial state. // // Keeping the Metric for later use is possible (and should be considered if // performance is critical), but keep in mind that Reset, DeleteLabelValues and diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go index c1b12f08..74ee9328 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go @@ -17,7 +17,7 @@ import ( "fmt" "sort" - //lint:ignore SA1019 Need to keep deprecated package for compatibility. + //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go index bd4e3474..64dc0eb4 100644 --- a/vendor/github.com/prometheus/common/expfmt/encode.go +++ b/vendor/github.com/prometheus/common/expfmt/encode.go @@ -18,7 +18,7 @@ import ( "io" "net/http" - "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/matttproud/golang_protobuf_extensions/pbutil" "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg" diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index b6079b31..84be0643 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -24,7 +24,7 @@ import ( dto "github.com/prometheus/client_model/go" - "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility. "github.com/prometheus/common/model" ) diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go index 41051a01..ef895633 100644 --- a/vendor/github.com/prometheus/common/model/labels.go +++ b/vendor/github.com/prometheus/common/model/labels.go @@ -45,6 +45,14 @@ const ( // scrape a target. MetricsPathLabel = "__metrics_path__" + // ScrapeIntervalLabel is the name of the label that holds the scrape interval + // used to scrape a target. + ScrapeIntervalLabel = "__scrape_interval__" + + // ScrapeTimeoutLabel is the name of the label that holds the scrape + // timeout used to scrape a target. + ScrapeTimeoutLabel = "__scrape_timeout__" + // ReservedLabelPrefix is a prefix which is not legal in user-supplied // label names. ReservedLabelPrefix = "__" diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go index c40e6403..7f67b16e 100644 --- a/vendor/github.com/prometheus/common/model/time.go +++ b/vendor/github.com/prometheus/common/model/time.go @@ -14,6 +14,8 @@ package model import ( + "encoding/json" + "errors" "fmt" "math" "regexp" @@ -201,13 +203,23 @@ func ParseDuration(durationStr string) (Duration, error) { // Parse the match at pos `pos` in the regex and use `mult` to turn that // into ms, then add that value to the total parsed duration. + var overflowErr error m := func(pos int, mult time.Duration) { if matches[pos] == "" { return } n, _ := strconv.Atoi(matches[pos]) + + // Check if the provided duration overflows time.Duration (> ~ 290years). + if n > int((1<<63-1)/mult/time.Millisecond) { + overflowErr = errors.New("duration out of range") + } d := time.Duration(n) * time.Millisecond dur += d * mult + + if dur < 0 { + overflowErr = errors.New("duration out of range") + } } m(2, 1000*60*60*24*365) // y @@ -218,7 +230,7 @@ func ParseDuration(durationStr string) (Duration, error) { m(12, 1000) // s m(14, 1) // ms - return Duration(dur), nil + return Duration(dur), overflowErr } func (d Duration) String() string { @@ -254,6 +266,37 @@ func (d Duration) String() string { return r } +// MarshalJSON implements the json.Marshaler interface. +func (d Duration) MarshalJSON() ([]byte, error) { + return json.Marshal(d.String()) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (d *Duration) UnmarshalJSON(bytes []byte) error { + var s string + if err := json.Unmarshal(bytes, &s); err != nil { + return err + } + dur, err := ParseDuration(s) + if err != nil { + return err + } + *d = dur + return nil +} + +// MarshalText implements the encoding.TextMarshaler interface. +func (d *Duration) MarshalText() ([]byte, error) { + return []byte(d.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (d *Duration) UnmarshalText(text []byte) error { + var err error + *d, err = ParseDuration(string(text)) + return err +} + // MarshalYAML implements the yaml.Marshaler interface. func (d Duration) MarshalYAML() (interface{}, error) { return d.String(), nil diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile index 616a0d25..fa2bd5b5 100644 --- a/vendor/github.com/prometheus/procfs/Makefile +++ b/vendor/github.com/prometheus/procfs/Makefile @@ -18,6 +18,8 @@ include Makefile.common ./ttar -C $(dir $*) -x -f $*.ttar touch $@ +fixtures: fixtures/.unpacked + update_fixtures: rm -vf fixtures/.unpacked ./ttar -c -f fixtures.ttar fixtures/ diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common index 9320176c..a1b1ca40 100644 --- a/vendor/github.com/prometheus/procfs/Makefile.common +++ b/vendor/github.com/prometheus/procfs/Makefile.common @@ -78,12 +78,12 @@ ifneq ($(shell which gotestsum),) endif endif -PROMU_VERSION ?= 0.5.0 +PROMU_VERSION ?= 0.12.0 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.18.0 +GOLANGCI_LINT_VERSION ?= v1.39.0 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) @@ -118,7 +118,7 @@ endif %: common-% ; .PHONY: common-all -common-all: precheck style check_license lint unused build test +common-all: precheck style check_license lint yamllint unused build test .PHONY: common-style common-style: @@ -198,6 +198,15 @@ else endif endif +.PHONY: common-yamllint +common-yamllint: + @echo ">> running yamllint on all YAML files in the repository" +ifeq (, $(shell which yamllint)) + @echo "yamllint not installed so skipping" +else + yamllint . +endif + # For backward-compatibility. .PHONY: common-staticcheck common-staticcheck: lint @@ -245,10 +254,12 @@ common-docker-publish: $(PUBLISH_DOCKER_ARCHS) $(PUBLISH_DOCKER_ARCHS): common-docker-publish-%: docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" +DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION))) .PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS) common-docker-tag-latest: $(TAG_DOCKER_ARCHS) $(TAG_DOCKER_ARCHS): common-docker-tag-latest-%: docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest" + docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)" .PHONY: common-docker-manifest common-docker-manifest: diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md index 55d1e326..43c37735 100644 --- a/vendor/github.com/prometheus/procfs/README.md +++ b/vendor/github.com/prometheus/procfs/README.md @@ -6,8 +6,8 @@ metrics from the pseudo-filesystems /proc and /sys. *WARNING*: This package is a work in progress. Its API may still break in backwards-incompatible ways without warnings. Use it at your own risk. -[![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs) -[![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs) +[![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/procfs.svg)](https://pkg.go.dev/github.com/prometheus/procfs) +[![CircleCI](https://circleci.com/gh/prometheus/procfs/tree/master.svg?style=svg)](https://circleci.com/gh/prometheus/procfs/tree/master) [![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs) ## Usage diff --git a/vendor/github.com/prometheus/procfs/SECURITY.md b/vendor/github.com/prometheus/procfs/SECURITY.md new file mode 100644 index 00000000..67741f01 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/SECURITY.md @@ -0,0 +1,6 @@ +# Reporting a security issue + +The Prometheus security policy, including how to report vulnerabilities, can be +found here: + +https://prometheus.io/docs/operating/security/ diff --git a/vendor/github.com/prometheus/procfs/arp.go b/vendor/github.com/prometheus/procfs/arp.go index 916c9182..4e47e617 100644 --- a/vendor/github.com/prometheus/procfs/arp.go +++ b/vendor/github.com/prometheus/procfs/arp.go @@ -36,7 +36,7 @@ type ARPEntry struct { func (fs FS) GatherARPEntries() ([]ARPEntry, error) { data, err := ioutil.ReadFile(fs.proc.Path("net/arp")) if err != nil { - return nil, fmt.Errorf("error reading arp %s: %s", fs.proc.Path("net/arp"), err) + return nil, fmt.Errorf("error reading arp %q: %w", fs.proc.Path("net/arp"), err) } return parseARPEntries(data) @@ -59,7 +59,7 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) { } else if width == expectedDataWidth { entry, err := parseARPEntry(columns) if err != nil { - return []ARPEntry{}, fmt.Errorf("failed to parse ARP entry: %s", err) + return []ARPEntry{}, fmt.Errorf("failed to parse ARP entry: %w", err) } entries = append(entries, entry) } else { diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go index 10bd067a..f5b7939b 100644 --- a/vendor/github.com/prometheus/procfs/buddyinfo.go +++ b/vendor/github.com/prometheus/procfs/buddyinfo.go @@ -74,7 +74,7 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { for i := 0; i < arraySize; i++ { sizes[i], err = strconv.ParseFloat(parts[i+4], 64) if err != nil { - return nil, fmt.Errorf("invalid value in buddyinfo: %s", err) + return nil, fmt.Errorf("invalid value in buddyinfo: %w", err) } } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info.go b/vendor/github.com/prometheus/procfs/cmdline.go similarity index 58% rename from vendor/github.com/prometheus/client_golang/prometheus/build_info.go rename to vendor/github.com/prometheus/procfs/cmdline.go index 288f0e85..bf4f3b48 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/build_info.go +++ b/vendor/github.com/prometheus/procfs/cmdline.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright 2021 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -11,19 +11,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build go1.12 +package procfs -package prometheus +import ( + "strings" -import "runtime/debug" + "github.com/prometheus/procfs/internal/util" +) -// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+. -func readBuildInfo() (path, version, sum string) { - path, version, sum = "unknown", "unknown", "unknown" - if bi, ok := debug.ReadBuildInfo(); ok { - path = bi.Main.Path - version = bi.Main.Version - sum = bi.Main.Sum +// CmdLine returns the command line of the kernel. +func (fs FS) CmdLine() ([]string, error) { + data, err := util.ReadFileNoStat(fs.proc.Path("cmdline")) + if err != nil { + return nil, err } - return + + return strings.Fields(string(data)), nil } diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go index b9fb589a..5623b24a 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo.go @@ -19,6 +19,7 @@ import ( "bufio" "bytes" "errors" + "fmt" "regexp" "strconv" "strings" @@ -77,7 +78,7 @@ func parseCPUInfoX86(info []byte) ([]CPUInfo, error) { // find the first "processor" line firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } field := strings.SplitN(firstLine, ": ", 2) v, err := strconv.ParseUint(field[1], 0, 32) @@ -192,7 +193,7 @@ func parseCPUInfoARM(info []byte) ([]CPUInfo, error) { firstLine := firstNonEmptyLine(scanner) match, _ := regexp.MatchString("^[Pp]rocessor", firstLine) if !match || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } field := strings.SplitN(firstLine, ": ", 2) cpuinfo := []CPUInfo{} @@ -256,7 +257,7 @@ func parseCPUInfoS390X(info []byte) ([]CPUInfo, error) { firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "vendor_id") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } field := strings.SplitN(firstLine, ": ", 2) cpuinfo := []CPUInfo{} @@ -281,7 +282,7 @@ func parseCPUInfoS390X(info []byte) ([]CPUInfo, error) { if strings.HasPrefix(line, "processor") { match := cpuinfoS390XProcessorRegexp.FindStringSubmatch(line) if len(match) < 2 { - return nil, errors.New("Invalid line found in cpuinfo: " + line) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } cpu := commonCPUInfo v, err := strconv.ParseUint(match[1], 0, 32) @@ -313,6 +314,22 @@ func parseCPUInfoS390X(info []byte) ([]CPUInfo, error) { return nil, err } cpuinfo[i].CPUMHz = v + case "physical id": + cpuinfo[i].PhysicalID = field[1] + case "core id": + cpuinfo[i].CoreID = field[1] + case "cpu cores": + v, err := strconv.ParseUint(field[1], 0, 32) + if err != nil { + return nil, err + } + cpuinfo[i].CPUCores = uint(v) + case "siblings": + v, err := strconv.ParseUint(field[1], 0, 32) + if err != nil { + return nil, err + } + cpuinfo[i].Siblings = uint(v) } } @@ -325,7 +342,7 @@ func parseCPUInfoMips(info []byte) ([]CPUInfo, error) { // find the first "processor" line firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } field := strings.SplitN(firstLine, ": ", 2) cpuinfo := []CPUInfo{} @@ -367,7 +384,7 @@ func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) { firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } field := strings.SplitN(firstLine, ": ", 2) v, err := strconv.ParseUint(field[1], 0, 32) @@ -412,7 +429,7 @@ func parseCPUInfoRISCV(info []byte) ([]CPUInfo, error) { firstLine := firstNonEmptyLine(scanner) if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") { - return nil, errors.New("invalid cpuinfo file: " + firstLine) + return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine) } field := strings.SplitN(firstLine, ": ", 2) v, err := strconv.ParseUint(field[1], 0, 32) diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go similarity index 62% rename from vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go rename to vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go index 6609e287..e83c2e20 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright 2020 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -11,12 +11,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build !go1.12 +// +build linux +// +build riscv riscv64 -package prometheus +package procfs -// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before -// 1.12. Remove this whole file once the minimum supported Go version is 1.12. -func readBuildInfo() (path, version, sum string) { - return "unknown", "unknown", "unknown" -} +var parseCPUInfo = parseCPUInfoRISCV diff --git a/vendor/github.com/prometheus/procfs/crypto.go b/vendor/github.com/prometheus/procfs/crypto.go index a9589337..5048ad1f 100644 --- a/vendor/github.com/prometheus/procfs/crypto.go +++ b/vendor/github.com/prometheus/procfs/crypto.go @@ -55,12 +55,12 @@ func (fs FS) Crypto() ([]Crypto, error) { path := fs.proc.Path("crypto") b, err := util.ReadFileNoStat(path) if err != nil { - return nil, fmt.Errorf("error reading crypto %s: %s", path, err) + return nil, fmt.Errorf("error reading crypto %q: %w", path, err) } crypto, err := parseCrypto(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("error parsing crypto %s: %s", path, err) + return nil, fmt.Errorf("error parsing crypto %q: %w", path, err) } return crypto, nil diff --git a/vendor/github.com/prometheus/procfs/doc.go b/vendor/github.com/prometheus/procfs/doc.go index e2acd6d4..d31a8260 100644 --- a/vendor/github.com/prometheus/procfs/doc.go +++ b/vendor/github.com/prometheus/procfs/doc.go @@ -31,7 +31,7 @@ // log.Fatalf("could not get process: %s", err) // } // -// stat, err := p.NewStat() +// stat, err := p.Stat() // if err != nil { // log.Fatalf("could not get process stat: %s", err) // } diff --git a/vendor/github.com/prometheus/procfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/fixtures.ttar index 12494d74..5e7eeef4 100644 --- a/vendor/github.com/prometheus/procfs/fixtures.ttar +++ b/vendor/github.com/prometheus/procfs/fixtures.ttar @@ -111,7 +111,7 @@ Max core file size 0 unlimited bytes Max resident set unlimited unlimited bytes Max processes 62898 62898 processes Max open files 2048 4096 files -Max locked memory 65536 65536 bytes +Max locked memory 18446744073708503040 18446744073708503040 bytes Max address space 8589934592 unlimited bytes Max file locks unlimited unlimited locks Max pending signals 62898 62898 signals @@ -644,6 +644,11 @@ Node 0, zone DMA32 759 572 791 475 194 45 12 0 Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/cmdline +Lines: 1 +BOOT_IMAGE=/vmlinuz-5.11.0-22-generic root=UUID=456a0345-450d-4f7b-b7c9-43e3241d99ad ro quiet splash vt.handoff=7 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/cpuinfo Lines: 216 processor : 0 @@ -1080,7 +1085,6 @@ internal : yes type : skcipher async : yes blocksize : 1 -min keysize : 16 max keysize : 32 ivsize : 16 chunksize : 16 @@ -1839,6 +1843,7 @@ min keysize : 16 max keysize : 32 Mode: 444 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/diskstats Lines: 52 @@ -2129,6 +2134,24 @@ Lines: 6 4 1FB3C 0 1282A8F 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/protocols +Lines: 14 +protocol size sockets memory press maxhdr slab module cl co di ac io in de sh ss gs se re sp bi br ha uh gp em +PACKET 1344 2 -1 NI 0 no kernel n n n n n n n n n n n n n n n n n n n +PINGv6 1112 0 -1 NI 0 yes kernel y y y n n y n n y y y y n y y y y y n +RAWv6 1112 1 -1 NI 0 yes kernel y y y n y y y n y y y y n y y y y n n +UDPLITEv6 1216 0 57 NI 0 yes kernel y y y n y y y n y y y y n n n y y y n +UDPv6 1216 10 57 NI 0 yes kernel y y y n y y y n y y y y n n n y y y n +TCPv6 2144 1937 1225378 no 320 yes kernel y y y y y y y y y y y y y n y y y y y +UNIX 1024 120 -1 NI 0 yes kernel n n n n n n n n n n n n n n n n n n n +UDP-Lite 1024 0 57 NI 0 yes kernel y y y n y y y n y y y y y n n y y y n +PING 904 0 -1 NI 0 yes kernel y y y n n y n n y y y y n y y y y y n +RAW 912 0 -1 NI 0 yes kernel y y y n y y y n y y y y n y y y y n n +UDP 1024 73 57 NI 0 yes kernel y y y n y y y n y y y y y n n y y y n +TCP 1984 93064 1225378 yes 320 yes kernel y y y y y y y y y y y y y n y y y y y +NETLINK 1040 16 -1 NI 0 no kernel n n n n n n n n n n n n n n n n n n n +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/net/rpc Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2186,10 +2209,42 @@ Lines: 1 00015c73 00020e76 F0000769 00000000 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/proc/net/stat +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/stat/arp_cache +Lines: 3 +entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs unresolved_discards table_fulls +00000014 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 0000000a 0000000b 0000000c +00000014 0000000d 0000000e 0000000f 00000010 00000011 00000012 00000013 00000014 00000015 00000016 00000017 00000018 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/stat/ndisc_cache +Lines: 3 +entries allocs destroys hash_grows lookups hits res_failed rcv_probes_mcast rcv_probes_ucast periodic_gc_runs forced_gc_runs unresolved_discards table_fulls +00000024 000000f0 000000f1 000000f2 000000f3 000000f4 000000f5 000000f6 000000f7 000000f8 000000f9 000000fa 000000fb +00000024 000000fc 000000fd 000000fe 000000ff 00000100 00000101 00000102 00000103 00000104 00000105 00000106 00000107 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/tcp +Lines: 4 + sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode + 0: 0500000A:0016 00000000:0000 0A 00000000:00000001 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 + 1: 00000000:0016 00000000:0000 0A 00000001:00000000 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 + 2: 00000000:0016 00000000:0000 0A 00000001:00000001 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/tcp6 +Lines: 3 + sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode ref pointer drops + 1315: 00000000000000000000000000000000:14EB 00000000000000000000000000000000:0000 07 00000000:00000000 00:00000000 00000000 981 0 21040 2 0000000013726323 0 + 6073: 000080FE00000000FFADE15609667CFE:C781 00000000000000000000000000000000:0000 07 00000000:00000000 00:00000000 00000000 1000 0 11337031 2 00000000b9256fdd 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/net/udp Lines: 4 sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode - 0: 0A000005:0016 00000000:0000 0A 00000000:00000001 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 + 0: 0500000A:0016 00000000:0000 0A 00000000:00000001 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 1: 00000000:0016 00000000:0000 0A 00000001:00000000 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 2: 00000000:0016 00000000:0000 0A 00000001:00000001 00:00000000 00000000 0 0 2740 1 ffff88003d3af3c0 100 0 0 10 0 Mode: 644 @@ -2292,6 +2347,312 @@ Mode: 644 Path: fixtures/proc/self SymlinkTo: 26231 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/slabinfo +Lines: 302 +slabinfo - version: 2.1 +# name : tunables : slabdata +pid_3 375 532 576 28 4 : tunables 0 0 0 : slabdata 19 19 0 +pid_2 3 28 576 28 4 : tunables 0 0 0 : slabdata 1 1 0 +nvidia_p2p_page_cache 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +nvidia_pte_cache 9022 9152 368 22 2 : tunables 0 0 0 : slabdata 416 416 0 +nvidia_stack_cache 321 326 12624 2 8 : tunables 0 0 0 : slabdata 163 163 0 +kvm_async_pf 0 0 472 34 4 : tunables 0 0 0 : slabdata 0 0 0 +kvm_vcpu 0 0 15552 2 8 : tunables 0 0 0 : slabdata 0 0 0 +kvm_mmu_page_header 0 0 504 32 4 : tunables 0 0 0 : slabdata 0 0 0 +pte_list_desc 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +x86_emulator 0 0 3024 10 8 : tunables 0 0 0 : slabdata 0 0 0 +x86_fpu 0 0 4608 7 8 : tunables 0 0 0 : slabdata 0 0 0 +iwl_cmd_pool:0000:04:00.0 0 128 512 32 4 : tunables 0 0 0 : slabdata 4 4 0 +ext4_groupinfo_4k 3719 3740 480 34 4 : tunables 0 0 0 : slabdata 110 110 0 +bio-6 32 75 640 25 4 : tunables 0 0 0 : slabdata 3 3 0 +bio-5 16 48 1344 24 8 : tunables 0 0 0 : slabdata 2 2 0 +bio-4 17 92 1408 23 8 : tunables 0 0 0 : slabdata 4 4 0 +fat_inode_cache 0 0 1056 31 8 : tunables 0 0 0 : slabdata 0 0 0 +fat_cache 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +ovl_aio_req 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +ovl_inode 0 0 1000 32 8 : tunables 0 0 0 : slabdata 0 0 0 +squashfs_inode_cache 0 0 1088 30 8 : tunables 0 0 0 : slabdata 0 0 0 +fuse_request 0 0 472 34 4 : tunables 0 0 0 : slabdata 0 0 0 +fuse_inode 0 0 1152 28 8 : tunables 0 0 0 : slabdata 0 0 0 +xfs_dqtrx 0 0 864 37 8 : tunables 0 0 0 : slabdata 0 0 0 +xfs_dquot 0 0 832 39 8 : tunables 0 0 0 : slabdata 0 0 0 +xfs_buf 0 0 768 21 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_bui_item 0 0 544 30 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_bud_item 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_cui_item 0 0 768 21 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_cud_item 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_rui_item 0 0 1024 32 8 : tunables 0 0 0 : slabdata 0 0 0 +xfs_rud_item 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_icr 0 0 520 31 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_ili 0 0 528 31 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_inode 0 0 1344 24 8 : tunables 0 0 0 : slabdata 0 0 0 +xfs_efi_item 0 0 768 21 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_efd_item 0 0 776 21 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_buf_item 0 0 608 26 4 : tunables 0 0 0 : slabdata 0 0 0 +xf_trans 0 0 568 28 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_ifork 0 0 376 21 2 : tunables 0 0 0 : slabdata 0 0 0 +xfs_da_state 0 0 816 20 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_btree_cur 0 0 560 29 4 : tunables 0 0 0 : slabdata 0 0 0 +xfs_bmap_free_item 0 0 400 20 2 : tunables 0 0 0 : slabdata 0 0 0 +xfs_log_ticket 0 0 520 31 4 : tunables 0 0 0 : slabdata 0 0 0 +nfs_direct_cache 0 0 560 29 4 : tunables 0 0 0 : slabdata 0 0 0 +nfs_commit_data 4 28 1152 28 8 : tunables 0 0 0 : slabdata 1 1 0 +nfs_write_data 32 50 1280 25 8 : tunables 0 0 0 : slabdata 2 2 0 +nfs_read_data 0 0 1280 25 8 : tunables 0 0 0 : slabdata 0 0 0 +nfs_inode_cache 0 0 1408 23 8 : tunables 0 0 0 : slabdata 0 0 0 +nfs_page 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +rpc_inode_cache 0 0 1024 32 8 : tunables 0 0 0 : slabdata 0 0 0 +rpc_buffers 8 13 2496 13 8 : tunables 0 0 0 : slabdata 1 1 0 +rpc_tasks 8 25 640 25 4 : tunables 0 0 0 : slabdata 1 1 0 +fscache_cookie_jar 1 35 464 35 4 : tunables 0 0 0 : slabdata 1 1 0 +jfs_mp 32 35 464 35 4 : tunables 0 0 0 : slabdata 1 1 0 +jfs_ip 0 0 1592 20 8 : tunables 0 0 0 : slabdata 0 0 0 +reiser_inode_cache 0 0 1096 29 8 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_end_io_wq 0 0 464 35 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_prelim_ref 0 0 424 38 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_delayed_extent_op 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_delayed_data_ref 0 0 448 36 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_delayed_tree_ref 0 0 440 37 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_delayed_ref_head 0 0 480 34 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_inode_defrag 0 0 400 20 2 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_delayed_node 0 0 648 25 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_ordered_extent 0 0 752 21 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_extent_map 0 0 480 34 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_extent_state 0 0 416 39 4 : tunables 0 0 0 : slabdata 0 0 0 +bio-3 35 92 704 23 4 : tunables 0 0 0 : slabdata 4 4 0 +btrfs_extent_buffer 0 0 600 27 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_free_space_bitmap 0 0 12288 2 8 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_free_space 0 0 416 39 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_path 0 0 448 36 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_trans_handle 0 0 440 37 4 : tunables 0 0 0 : slabdata 0 0 0 +btrfs_inode 0 0 1496 21 8 : tunables 0 0 0 : slabdata 0 0 0 +ext4_inode_cache 84136 84755 1400 23 8 : tunables 0 0 0 : slabdata 3685 3685 0 +ext4_free_data 22 80 392 20 2 : tunables 0 0 0 : slabdata 4 4 0 +ext4_allocation_context 0 70 464 35 4 : tunables 0 0 0 : slabdata 2 2 0 +ext4_prealloc_space 24 74 440 37 4 : tunables 0 0 0 : slabdata 2 2 0 +ext4_system_zone 267 273 376 21 2 : tunables 0 0 0 : slabdata 13 13 0 +ext4_io_end_vec 0 88 368 22 2 : tunables 0 0 0 : slabdata 4 4 0 +ext4_io_end 0 80 400 20 2 : tunables 0 0 0 : slabdata 4 4 0 +ext4_bio_post_read_ctx 128 147 384 21 2 : tunables 0 0 0 : slabdata 7 7 0 +ext4_pending_reservation 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +ext4_extent_status 79351 79422 376 21 2 : tunables 0 0 0 : slabdata 3782 3782 0 +jbd2_transaction_s 44 100 640 25 4 : tunables 0 0 0 : slabdata 4 4 0 +jbd2_inode 6785 6840 400 20 2 : tunables 0 0 0 : slabdata 342 342 0 +jbd2_journal_handle 0 80 392 20 2 : tunables 0 0 0 : slabdata 4 4 0 +jbd2_journal_head 824 1944 448 36 4 : tunables 0 0 0 : slabdata 54 54 0 +jbd2_revoke_table_s 4 23 352 23 2 : tunables 0 0 0 : slabdata 1 1 0 +jbd2_revoke_record_s 0 156 416 39 4 : tunables 0 0 0 : slabdata 4 4 0 +ext2_inode_cache 0 0 1144 28 8 : tunables 0 0 0 : slabdata 0 0 0 +mbcache 0 0 392 20 2 : tunables 0 0 0 : slabdata 0 0 0 +dm_thin_new_mapping 0 152 424 38 4 : tunables 0 0 0 : slabdata 4 4 0 +dm_snap_pending_exception 0 0 464 35 4 : tunables 0 0 0 : slabdata 0 0 0 +dm_exception 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +dm_dirty_log_flush_entry 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +dm_bio_prison_cell_v2 0 0 432 37 4 : tunables 0 0 0 : slabdata 0 0 0 +dm_bio_prison_cell 0 148 432 37 4 : tunables 0 0 0 : slabdata 4 4 0 +kcopyd_job 0 8 3648 8 8 : tunables 0 0 0 : slabdata 1 1 0 +io 0 32 512 32 4 : tunables 0 0 0 : slabdata 1 1 0 +dm_uevent 0 0 3224 10 8 : tunables 0 0 0 : slabdata 0 0 0 +dax_cache 1 28 1152 28 8 : tunables 0 0 0 : slabdata 1 1 0 +aic94xx_ascb 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +aic94xx_dma_token 0 0 384 21 2 : tunables 0 0 0 : slabdata 0 0 0 +asd_sas_event 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +sas_task 0 0 704 23 4 : tunables 0 0 0 : slabdata 0 0 0 +qla2xxx_srbs 0 0 832 39 8 : tunables 0 0 0 : slabdata 0 0 0 +sd_ext_cdb 2 22 368 22 2 : tunables 0 0 0 : slabdata 1 1 0 +scsi_sense_cache 258 288 512 32 4 : tunables 0 0 0 : slabdata 9 9 0 +virtio_scsi_cmd 64 75 640 25 4 : tunables 0 0 0 : slabdata 3 3 0 +L2TP/IPv6 0 0 1536 21 8 : tunables 0 0 0 : slabdata 0 0 0 +L2TP/IP 0 0 1408 23 8 : tunables 0 0 0 : slabdata 0 0 0 +ip6-frags 0 0 520 31 4 : tunables 0 0 0 : slabdata 0 0 0 +fib6_nodes 5 32 512 32 4 : tunables 0 0 0 : slabdata 1 1 0 +ip6_dst_cache 4 25 640 25 4 : tunables 0 0 0 : slabdata 1 1 0 +ip6_mrt_cache 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +PINGv6 0 0 1600 20 8 : tunables 0 0 0 : slabdata 0 0 0 +RAWv6 25 40 1600 20 8 : tunables 0 0 0 : slabdata 2 2 0 +UDPLITEv6 0 0 1728 18 8 : tunables 0 0 0 : slabdata 0 0 0 +UDPv6 3 54 1728 18 8 : tunables 0 0 0 : slabdata 3 3 0 +tw_sock_TCPv6 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +request_sock_TCPv6 0 0 632 25 4 : tunables 0 0 0 : slabdata 0 0 0 +TCPv6 0 33 2752 11 8 : tunables 0 0 0 : slabdata 3 3 0 +uhci_urb_priv 0 0 392 20 2 : tunables 0 0 0 : slabdata 0 0 0 +sgpool-128 2 14 4544 7 8 : tunables 0 0 0 : slabdata 2 2 0 +sgpool-64 2 13 2496 13 8 : tunables 0 0 0 : slabdata 1 1 0 +sgpool-32 2 44 1472 22 8 : tunables 0 0 0 : slabdata 2 2 0 +sgpool-16 2 68 960 34 8 : tunables 0 0 0 : slabdata 2 2 0 +sgpool-8 2 46 704 23 4 : tunables 0 0 0 : slabdata 2 2 0 +btree_node 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +bfq_io_cq 0 0 488 33 4 : tunables 0 0 0 : slabdata 0 0 0 +bfq_queue 0 0 848 38 8 : tunables 0 0 0 : slabdata 0 0 0 +mqueue_inode_cache 1 24 1344 24 8 : tunables 0 0 0 : slabdata 1 1 0 +isofs_inode_cache 0 0 968 33 8 : tunables 0 0 0 : slabdata 0 0 0 +io_kiocb 0 0 640 25 4 : tunables 0 0 0 : slabdata 0 0 0 +kioctx 0 30 1088 30 8 : tunables 0 0 0 : slabdata 1 1 0 +aio_kiocb 0 28 576 28 4 : tunables 0 0 0 : slabdata 1 1 0 +userfaultfd_ctx_cache 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +fanotify_path_event 0 0 392 20 2 : tunables 0 0 0 : slabdata 0 0 0 +fanotify_fid_event 0 0 400 20 2 : tunables 0 0 0 : slabdata 0 0 0 +fsnotify_mark 0 0 408 20 2 : tunables 0 0 0 : slabdata 0 0 0 +dnotify_mark 0 0 416 39 4 : tunables 0 0 0 : slabdata 0 0 0 +dnotify_struct 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +dio 0 0 1088 30 8 : tunables 0 0 0 : slabdata 0 0 0 +bio-2 4 25 640 25 4 : tunables 0 0 0 : slabdata 1 1 0 +fasync_cache 0 0 384 21 2 : tunables 0 0 0 : slabdata 0 0 0 +audit_tree_mark 0 0 416 39 4 : tunables 0 0 0 : slabdata 0 0 0 +pid_namespace 30 34 480 34 4 : tunables 0 0 0 : slabdata 1 1 0 +posix_timers_cache 0 27 592 27 4 : tunables 0 0 0 : slabdata 1 1 0 +iommu_devinfo 24 32 512 32 4 : tunables 0 0 0 : slabdata 1 1 0 +iommu_domain 10 10 3264 10 8 : tunables 0 0 0 : slabdata 1 1 0 +iommu_iova 8682 8748 448 36 4 : tunables 0 0 0 : slabdata 243 243 0 +UNIX 529 814 1472 22 8 : tunables 0 0 0 : slabdata 37 37 0 +ip4-frags 0 0 536 30 4 : tunables 0 0 0 : slabdata 0 0 0 +ip_mrt_cache 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +UDP-Lite 0 0 1536 21 8 : tunables 0 0 0 : slabdata 0 0 0 +tcp_bind_bucket 7 128 512 32 4 : tunables 0 0 0 : slabdata 4 4 0 +inet_peer_cache 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +xfrm_dst_cache 0 0 704 23 4 : tunables 0 0 0 : slabdata 0 0 0 +xfrm_state 0 0 1152 28 8 : tunables 0 0 0 : slabdata 0 0 0 +ip_fib_trie 7 21 384 21 2 : tunables 0 0 0 : slabdata 1 1 0 +ip_fib_alias 9 20 392 20 2 : tunables 0 0 0 : slabdata 1 1 0 +ip_dst_cache 27 84 576 28 4 : tunables 0 0 0 : slabdata 3 3 0 +PING 0 0 1408 23 8 : tunables 0 0 0 : slabdata 0 0 0 +RAW 32 46 1408 23 8 : tunables 0 0 0 : slabdata 2 2 0 +UDP 11 168 1536 21 8 : tunables 0 0 0 : slabdata 8 8 0 +tw_sock_TCP 1 56 576 28 4 : tunables 0 0 0 : slabdata 2 2 0 +request_sock_TCP 0 25 632 25 4 : tunables 0 0 0 : slabdata 1 1 0 +TCP 10 60 2624 12 8 : tunables 0 0 0 : slabdata 5 5 0 +hugetlbfs_inode_cache 2 35 928 35 8 : tunables 0 0 0 : slabdata 1 1 0 +dquot 0 0 640 25 4 : tunables 0 0 0 : slabdata 0 0 0 +bio-1 32 46 704 23 4 : tunables 0 0 0 : slabdata 2 2 0 +eventpoll_pwq 409 600 408 20 2 : tunables 0 0 0 : slabdata 30 30 0 +eventpoll_epi 408 672 576 28 4 : tunables 0 0 0 : slabdata 24 24 0 +inotify_inode_mark 58 195 416 39 4 : tunables 0 0 0 : slabdata 5 5 0 +scsi_data_buffer 0 0 360 22 2 : tunables 0 0 0 : slabdata 0 0 0 +bio_crypt_ctx 128 147 376 21 2 : tunables 0 0 0 : slabdata 7 7 0 +request_queue 29 39 2408 13 8 : tunables 0 0 0 : slabdata 3 3 0 +blkdev_ioc 81 148 440 37 4 : tunables 0 0 0 : slabdata 4 4 0 +bio-0 125 200 640 25 4 : tunables 0 0 0 : slabdata 8 8 0 +biovec-max 166 196 4544 7 8 : tunables 0 0 0 : slabdata 28 28 0 +biovec-128 0 52 2496 13 8 : tunables 0 0 0 : slabdata 4 4 0 +biovec-64 0 88 1472 22 8 : tunables 0 0 0 : slabdata 4 4 0 +biovec-16 0 92 704 23 4 : tunables 0 0 0 : slabdata 4 4 0 +bio_integrity_payload 4 28 576 28 4 : tunables 0 0 0 : slabdata 1 1 0 +khugepaged_mm_slot 59 180 448 36 4 : tunables 0 0 0 : slabdata 5 5 0 +ksm_mm_slot 0 0 384 21 2 : tunables 0 0 0 : slabdata 0 0 0 +ksm_stable_node 0 0 400 20 2 : tunables 0 0 0 : slabdata 0 0 0 +ksm_rmap_item 0 0 400 20 2 : tunables 0 0 0 : slabdata 0 0 0 +user_namespace 2 37 864 37 8 : tunables 0 0 0 : slabdata 1 1 0 +uid_cache 5 28 576 28 4 : tunables 0 0 0 : slabdata 1 1 0 +dmaengine-unmap-256 1 13 2496 13 8 : tunables 0 0 0 : slabdata 1 1 0 +dmaengine-unmap-128 1 22 1472 22 8 : tunables 0 0 0 : slabdata 1 1 0 +dmaengine-unmap-16 1 28 576 28 4 : tunables 0 0 0 : slabdata 1 1 0 +dmaengine-unmap-2 1 36 448 36 4 : tunables 0 0 0 : slabdata 1 1 0 +audit_buffer 0 22 360 22 2 : tunables 0 0 0 : slabdata 1 1 0 +sock_inode_cache 663 1170 1216 26 8 : tunables 0 0 0 : slabdata 45 45 0 +skbuff_ext_cache 0 0 576 28 4 : tunables 0 0 0 : slabdata 0 0 0 +skbuff_fclone_cache 1 72 896 36 8 : tunables 0 0 0 : slabdata 2 2 0 +skbuff_head_cache 3 650 640 25 4 : tunables 0 0 0 : slabdata 26 26 0 +configfs_dir_cache 7 38 424 38 4 : tunables 0 0 0 : slabdata 1 1 0 +file_lock_cache 27 116 552 29 4 : tunables 0 0 0 : slabdata 4 4 0 +file_lock_ctx 106 120 392 20 2 : tunables 0 0 0 : slabdata 6 6 0 +fsnotify_mark_connector 52 66 368 22 2 : tunables 0 0 0 : slabdata 3 3 0 +net_namespace 1 6 5312 6 8 : tunables 0 0 0 : slabdata 1 1 0 +task_delay_info 784 1560 416 39 4 : tunables 0 0 0 : slabdata 40 40 0 +taskstats 45 92 688 23 4 : tunables 0 0 0 : slabdata 4 4 0 +proc_dir_entry 678 682 528 31 4 : tunables 0 0 0 : slabdata 22 22 0 +pde_opener 0 189 376 21 2 : tunables 0 0 0 : slabdata 9 9 0 +proc_inode_cache 7150 8250 992 33 8 : tunables 0 0 0 : slabdata 250 250 0 +seq_file 60 735 456 35 4 : tunables 0 0 0 : slabdata 21 21 0 +sigqueue 0 156 416 39 4 : tunables 0 0 0 : slabdata 4 4 0 +bdev_cache 36 78 1216 26 8 : tunables 0 0 0 : slabdata 3 3 0 +shmem_inode_cache 1599 2208 1016 32 8 : tunables 0 0 0 : slabdata 69 69 0 +kernfs_iattrs_cache 1251 1254 424 38 4 : tunables 0 0 0 : slabdata 33 33 0 +kernfs_node_cache 52898 52920 464 35 4 : tunables 0 0 0 : slabdata 1512 1512 0 +mnt_cache 42 46 704 23 4 : tunables 0 0 0 : slabdata 2 2 0 +filp 4314 6371 704 23 4 : tunables 0 0 0 : slabdata 277 277 0 +inode_cache 28695 29505 920 35 8 : tunables 0 0 0 : slabdata 843 843 0 +dentry 166069 169074 528 31 4 : tunables 0 0 0 : slabdata 5454 5454 0 +names_cache 0 35 4544 7 8 : tunables 0 0 0 : slabdata 5 5 0 +hashtab_node 0 0 360 22 2 : tunables 0 0 0 : slabdata 0 0 0 +ebitmap_node 0 0 400 20 2 : tunables 0 0 0 : slabdata 0 0 0 +avtab_extended_perms 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +avtab_node 0 0 360 22 2 : tunables 0 0 0 : slabdata 0 0 0 +avc_xperms_data 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +avc_xperms_decision_node 0 0 384 21 2 : tunables 0 0 0 : slabdata 0 0 0 +avc_xperms_node 0 0 392 20 2 : tunables 0 0 0 : slabdata 0 0 0 +avc_node 37 40 408 20 2 : tunables 0 0 0 : slabdata 2 2 0 +iint_cache 0 0 448 36 4 : tunables 0 0 0 : slabdata 0 0 0 +lsm_inode_cache 122284 122340 392 20 2 : tunables 0 0 0 : slabdata 6117 6117 0 +lsm_file_cache 4266 4485 352 23 2 : tunables 0 0 0 : slabdata 195 195 0 +key_jar 8 25 640 25 4 : tunables 0 0 0 : slabdata 1 1 0 +buffer_head 255622 257076 440 37 4 : tunables 0 0 0 : slabdata 6948 6948 0 +uts_namespace 0 0 776 21 4 : tunables 0 0 0 : slabdata 0 0 0 +nsproxy 31 40 408 20 2 : tunables 0 0 0 : slabdata 2 2 0 +vm_area_struct 39115 43214 528 31 4 : tunables 0 0 0 : slabdata 1394 1394 0 +mm_struct 96 529 1408 23 8 : tunables 0 0 0 : slabdata 23 23 0 +fs_cache 102 756 448 36 4 : tunables 0 0 0 : slabdata 21 21 0 +files_cache 102 588 1152 28 8 : tunables 0 0 0 : slabdata 21 21 0 +signal_cache 266 672 1536 21 8 : tunables 0 0 0 : slabdata 32 32 0 +sighand_cache 266 507 2496 13 8 : tunables 0 0 0 : slabdata 39 39 0 +task_struct 783 963 10240 3 8 : tunables 0 0 0 : slabdata 321 321 0 +cred_jar 364 952 576 28 4 : tunables 0 0 0 : slabdata 34 34 0 +anon_vma_chain 63907 67821 416 39 4 : tunables 0 0 0 : slabdata 1739 1739 0 +anon_vma 25891 28899 416 39 4 : tunables 0 0 0 : slabdata 741 741 0 +pid 408 992 512 32 4 : tunables 0 0 0 : slabdata 31 31 0 +Acpi-Operand 6682 6740 408 20 2 : tunables 0 0 0 : slabdata 337 337 0 +Acpi-ParseExt 0 39 416 39 4 : tunables 0 0 0 : slabdata 1 1 0 +Acpi-Parse 0 80 392 20 2 : tunables 0 0 0 : slabdata 4 4 0 +Acpi-State 0 78 416 39 4 : tunables 0 0 0 : slabdata 2 2 0 +Acpi-Namespace 3911 3948 384 21 2 : tunables 0 0 0 : slabdata 188 188 0 +trace_event_file 2638 2660 424 38 4 : tunables 0 0 0 : slabdata 70 70 0 +ftrace_event_field 6592 6594 384 21 2 : tunables 0 0 0 : slabdata 314 314 0 +pool_workqueue 41 64 1024 32 8 : tunables 0 0 0 : slabdata 2 2 0 +radix_tree_node 21638 24045 912 35 8 : tunables 0 0 0 : slabdata 687 687 0 +task_group 48 78 1216 26 8 : tunables 0 0 0 : slabdata 3 3 0 +vmap_area 4411 4680 400 20 2 : tunables 0 0 0 : slabdata 234 234 0 +dma-kmalloc-8k 0 0 24576 1 8 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-4k 0 0 12288 2 8 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-2k 0 0 6144 5 8 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-1k 0 0 3072 10 8 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-512 0 0 1536 21 8 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-256 0 0 1024 32 8 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-128 0 0 640 25 4 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-64 0 0 512 32 4 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-32 0 0 416 39 4 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-16 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-8 0 0 344 23 2 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-192 0 0 528 31 4 : tunables 0 0 0 : slabdata 0 0 0 +dma-kmalloc-96 0 0 432 37 4 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-8k 0 0 24576 1 8 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-4k 0 0 12288 2 8 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-2k 0 0 6144 5 8 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-1k 0 0 3072 10 8 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-512 0 0 1536 21 8 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-256 0 0 1024 32 8 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-192 0 0 528 31 4 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-128 31 75 640 25 4 : tunables 0 0 0 : slabdata 3 3 0 +kmalloc-rcl-96 3371 3626 432 37 4 : tunables 0 0 0 : slabdata 98 98 0 +kmalloc-rcl-64 2080 2272 512 32 4 : tunables 0 0 0 : slabdata 71 71 0 +kmalloc-rcl-32 0 0 416 39 4 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-16 0 0 368 22 2 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-rcl-8 0 0 344 23 2 : tunables 0 0 0 : slabdata 0 0 0 +kmalloc-8k 133 140 24576 1 8 : tunables 0 0 0 : slabdata 140 140 0 +kmalloc-4k 403 444 12288 2 8 : tunables 0 0 0 : slabdata 222 222 0 +kmalloc-2k 2391 2585 6144 5 8 : tunables 0 0 0 : slabdata 517 517 0 +kmalloc-1k 2163 2420 3072 10 8 : tunables 0 0 0 : slabdata 242 242 0 +kmalloc-512 2972 3633 1536 21 8 : tunables 0 0 0 : slabdata 173 173 0 +kmalloc-256 1841 1856 1024 32 8 : tunables 0 0 0 : slabdata 58 58 0 +kmalloc-192 2165 2914 528 31 4 : tunables 0 0 0 : slabdata 94 94 0 +kmalloc-128 1137 1175 640 25 4 : tunables 0 0 0 : slabdata 47 47 0 +kmalloc-96 1925 2590 432 37 4 : tunables 0 0 0 : slabdata 70 70 0 +kmalloc-64 9433 10688 512 32 4 : tunables 0 0 0 : slabdata 334 334 0 +kmalloc-32 9098 10062 416 39 4 : tunables 0 0 0 : slabdata 258 258 0 +kmalloc-16 10914 10956 368 22 2 : tunables 0 0 0 : slabdata 498 498 0 +kmalloc-8 7576 7705 344 23 2 : tunables 0 0 0 : slabdata 335 335 0 +kmem_cache_node 904 928 512 32 4 : tunables 0 0 0 : slabdata 29 29 0 +kmem_cache 904 936 832 39 8 : tunables 0 0 0 : slabdata 24 24 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/stat Lines: 16 cpu 301854 612 111922 8979004 3552 2 3944 0 0 0 @@ -3116,6 +3477,460 @@ Mode: 664 Directory: fixtures/sys/class Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm/card0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm/card0/device +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/aer_dev_correctable +Lines: 9 +RxErr 0 +BadTLP 0 +BadDLLP 0 +Rollover 0 +Timeout 0 +NonFatalErr 0 +CorrIntErr 0 +HeaderOF 0 +TOTAL_ERR_COR 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/aer_dev_fatal +Lines: 19 +Undefined 0 +DLP 0 +SDES 0 +TLP 0 +FCP 0 +CmpltTO 0 +CmpltAbrt 0 +UnxCmplt 0 +RxOF 0 +MalfTLP 0 +ECRC 0 +UnsupReq 0 +ACSViol 0 +UncorrIntErr 0 +BlockedTLP 0 +AtomicOpBlocked 0 +TLPBlockedErr 0 +PoisonTLPBlocked 0 +TOTAL_ERR_FATAL 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/aer_dev_nonfatal +Lines: 19 +Undefined 0 +DLP 0 +SDES 0 +TLP 0 +FCP 0 +CmpltTO 0 +CmpltAbrt 0 +UnxCmplt 0 +RxOF 0 +MalfTLP 0 +ECRC 0 +UnsupReq 0 +ACSViol 0 +UncorrIntErr 0 +BlockedTLP 0 +AtomicOpBlocked 0 +TLPBlockedErr 0 +PoisonTLPBlocked 0 +TOTAL_ERR_NONFATAL 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/ari_enabled +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/boot_vga +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/broken_parity_status +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/class +Lines: 1 +0x030000 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/consistent_dma_mask_bits +Lines: 1 +44 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/current_link_speed +Lines: 1 +8.0 GT/s PCIe +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/current_link_width +Lines: 1 +16 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/d3cold_allowed +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/device +Lines: 1 +0x687f +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/dma_mask_bits +Lines: 1 +44 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/driver_override +Lines: 1 +(null) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/gpu_busy_percent +Lines: 1 +4 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/irq +Lines: 1 +95 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/local_cpulist +Lines: 1 +0-15 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/local_cpus +Lines: 1 +0000ffff +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/max_link_speed +Lines: 1 +8.0 GT/s PCIe +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/max_link_width +Lines: 1 +16 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_gtt_total +Lines: 1 +8573157376 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_gtt_used +Lines: 1 +144560128 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_vis_vram_total +Lines: 1 +8573157376 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_vis_vram_used +Lines: 1 +1490378752 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_vram_total +Lines: 1 +8573157376 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_vram_used +Lines: 1 +1490378752 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/mem_info_vram_vendor +Lines: 1 +samsung +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/modalias +Lines: 1 +pci:v00001002d0000687Fsv00001043sd000004C4bc03sc00i00 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/msi_bus +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/numa_node +Lines: 1 +-1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pcie_bw +Lines: 1 +6641 815 256 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pcie_replay_count +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/power_dpm_force_performance_level +Lines: 1 +manual +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/power_dpm_state +Lines: 1 +performance +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/power_state +Lines: 1 +D0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_cur_state +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_dpm_dcefclk +Lines: 5 +0: 600Mhz * +1: 720Mhz +2: 800Mhz +3: 847Mhz +4: 900Mhz +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_dpm_mclk +Lines: 4 +0: 167Mhz * +1: 500Mhz +2: 800Mhz +3: 945Mhz +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_dpm_pcie +Lines: 2 +0: 8.0GT/s, x16 +1: 8.0GT/s, x16 * +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_dpm_sclk +Lines: 8 +0: 852Mhz * +1: 991Mhz +2: 1084Mhz +3: 1138Mhz +4: 1200Mhz +5: 1401Mhz +6: 1536Mhz +7: 1630Mhz +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_dpm_socclk +Lines: 8 +0: 600Mhz +1: 720Mhz * +2: 800Mhz +3: 847Mhz +4: 900Mhz +5: 960Mhz +6: 1028Mhz +7: 1107Mhz +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_features +Lines: 32 +Current ppfeatures: 0x0000000019a1ff4f +FEATURES BITMASK ENABLEMENT +DPM_PREFETCHER 0x0000000000000001 Y +GFXCLK_DPM 0x0000000000000002 Y +UCLK_DPM 0x0000000000000004 Y +SOCCLK_DPM 0x0000000000000008 Y +UVD_DPM 0x0000000000000010 N +VCE_DPM 0x0000000000000020 N +ULV 0x0000000000000040 Y +MP0CLK_DPM 0x0000000000000080 N +LINK_DPM 0x0000000000000100 Y +DCEFCLK_DPM 0x0000000000000200 Y +AVFS 0x0000000000000400 Y +GFXCLK_DS 0x0000000000000800 Y +SOCCLK_DS 0x0000000000001000 Y +LCLK_DS 0x0000000000002000 Y +PPT 0x0000000000004000 Y +TDC 0x0000000000008000 Y +THERMAL 0x0000000000010000 Y +GFX_PER_CU_CG 0x0000000000020000 N +RM 0x0000000000040000 N +DCEFCLK_DS 0x0000000000080000 N +ACDC 0x0000000000100000 N +VR0HOT 0x0000000000200000 Y +VR1HOT 0x0000000000400000 N +FW_CTF 0x0000000000800000 Y +LED_DISPLAY 0x0000000001000000 Y +FAN_CONTROL 0x0000000002000000 N +FAST_PPT 0x0000000004000000 N +DIDT 0x0000000008000000 Y +ACG 0x0000000010000000 Y +PCC_LIMIT 0x0000000020000000 N +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_force_state +Lines: 1 + +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_mclk_od +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_num_states +Lines: 3 +states: 2 +0 boot +1 performance +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_od_clk_voltage +Lines: 18 +OD_SCLK: +0: 852Mhz 800mV +1: 991Mhz 900mV +2: 1084Mhz 950mV +3: 1138Mhz 1000mV +4: 1200Mhz 1050mV +5: 1401Mhz 1100mV +6: 1536Mhz 1150mV +7: 1630Mhz 1200mV +OD_MCLK: +0: 167Mhz 800mV +1: 500Mhz 800mV +2: 800Mhz 950mV +3: 945Mhz 1100mV +OD_RANGE: +SCLK: 852MHz 2400MHz +MCLK: 167MHz 1500MHz +VDDC: 800mV 1200mV +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_power_profile_mode +Lines: 8 +NUM MODE_NAME BUSY_SET_POINT FPS USE_RLC_BUSY MIN_ACTIVE_LEVEL + 0 BOOTUP_DEFAULT : 70 60 0 0 + 1 3D_FULL_SCREEN*: 70 60 1 3 + 2 POWER_SAVING : 90 60 0 0 + 3 VIDEO : 70 60 0 0 + 4 VR : 70 90 0 0 + 5 COMPUTE : 30 60 0 6 + 6 CUSTOM : 0 0 0 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/pp_sclk_od +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/product_name +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/product_number +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/resource +Lines: 13 +0x0000007c00000000 0x0000007dffffffff 0x000000000014220c +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000007e00000000 0x0000007e0fffffff 0x000000000014220c +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x000000000000d000 0x000000000000d0ff 0x0000000000040101 +0x00000000fcd00000 0x00000000fcd7ffff 0x0000000000040200 +0x00000000fcd80000 0x00000000fcd9ffff 0x0000000000046200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/revision +Lines: 1 +0xc1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/serial_number +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/subsystem_device +Lines: 1 +0x04c4 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/subsystem_vendor +Lines: 1 +0x1043 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/thermal_throttling_logging +Lines: 1 +0000:09:00.0: thermal throttling logging enabled, with interval 60 seconds +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/uevent +Lines: 6 +DRIVER=amdgpu +PCI_CLASS=30000 +PCI_ID=1002:687F +PCI_SUBSYS_ID=1043:04C4 +PCI_SLOT_NAME=0000:09:00.0 +MODALIAS=pci:v00001002d0000687Fsv00001043sd000004C4bc03sc00i00 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/unique_id +Lines: 1 +0123456789abcdef +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/vbios_version +Lines: 1 +115-D050PIL-100 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/vendor +Lines: 1 +0x1002 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/fc_host Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3253,6 +4068,128 @@ Mode: 644 Directory: fixtures/sys/class/infiniband Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/hfi1_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/board_id +Lines: 1 +HPE 100Gb 1-port OP101 QSFP28 x16 PCIe Gen3 with Intel Omni-Path Adapter +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/fw_ver +Lines: 1 +1.27.0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/hfi1_0/ports +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/hfi1_0/ports/1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/VL15_dropped +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/excessive_buffer_overrun_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/link_downed +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/link_error_recovery +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/local_link_integrity_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_rcv_constraint_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_rcv_data +Lines: 1 +345091702026 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_rcv_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_rcv_packets +Lines: 1 +638036947 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_rcv_remote_physical_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_rcv_switch_relay_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_xmit_constraint_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_xmit_data +Lines: 1 +273558326543 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_xmit_discards +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_xmit_packets +Lines: 1 +568318856 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/port_xmit_wait +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/counters/symbol_error +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/phys_state +Lines: 1 +5: LinkUp +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/rate +Lines: 1 +100 Gb/sec (4X EDR) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/hfi1_0/ports/1/state +Lines: 1 +4: ACTIVE +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/infiniband/mlx4_0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3621,6 +4558,32 @@ Lines: 1 1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/nvme +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/nvme/nvme0 +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/nvme/nvme0/firmware_rev +Lines: 1 +1B2QEXP7 +Mode: 664 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/nvme/nvme0/model +Lines: 1 +Samsung SSD 970 PRO 512GB +Mode: 664 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/nvme/nvme0/serial +Lines: 1 +S680HF8N190894I +Mode: 664 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/nvme/nvme0/state +Lines: 1 +live +Mode: 664 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/power_supply Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3825,6 +4788,33 @@ Path: fixtures/sys/class/powercap/intel-rapl:a/uevent Lines: 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/scsi_tape +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/nst0 +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/nst0a +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/nst0l +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/nst0m +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/st0 +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/st0a +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/st0l +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/scsi_tape/st0m +SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/thermal Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4236,6 +5226,475 @@ Mode: 444 Directory: fixtures/sys/devices/pci0000:00 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0a/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0l/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/nst0m/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0a/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0l/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/in_flight +Lines: 1 +1EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/io_ns +Lines: 1 +9247011087720EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/other_cnt +Lines: 1 +1409EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/read_byte_cnt +Lines: 1 +979383912EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/read_cnt +Lines: 1 +3741EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/read_ns +Lines: 1 +33788355744EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/resid_cnt +Lines: 1 +19EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/write_byte_cnt +Lines: 1 +1496246784000EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/write_cnt +Lines: 1 +53772916EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m/stats/write_ns +Lines: 1 +5233597394395EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4886,6 +6345,35 @@ Mode: 644 Directory: fixtures/sys/devices/system/cpu/cpufreq/policy1 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/system/node +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/system/node/node1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/system/node/node1/vmstat +Lines: 6 +nr_free_pages 1 +nr_zone_inactive_anon 2 +nr_zone_active_anon 3 +nr_zone_inactive_file 4 +nr_zone_active_file 5 +nr_zone_unevictable 6 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/system/node/node2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/system/node/node2/vmstat +Lines: 6 +nr_free_pages 7 +nr_zone_inactive_anon 8 +nr_zone_active_anon 9 +nr_zone_inactive_file 10 +nr_zone_active_file 11 +nr_zone_unevictable 12 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/fs Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/github.com/prometheus/procfs/fscache.go b/vendor/github.com/prometheus/procfs/fscache.go index 8783cf3c..f8070e6e 100644 --- a/vendor/github.com/prometheus/procfs/fscache.go +++ b/vendor/github.com/prometheus/procfs/fscache.go @@ -236,7 +236,7 @@ func (fs FS) Fscacheinfo() (Fscacheinfo, error) { m, err := parseFscacheinfo(bytes.NewReader(b)) if err != nil { - return Fscacheinfo{}, fmt.Errorf("failed to parse Fscacheinfo: %v", err) + return Fscacheinfo{}, fmt.Errorf("failed to parse Fscacheinfo: %w", err) } return *m, nil diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go index 565e89e4..0040753b 100644 --- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go +++ b/vendor/github.com/prometheus/procfs/internal/fs/fs.go @@ -39,10 +39,10 @@ type FS string func NewFS(mountPoint string) (FS, error) { info, err := os.Stat(mountPoint) if err != nil { - return "", fmt.Errorf("could not read %s: %s", mountPoint, err) + return "", fmt.Errorf("could not read %q: %w", mountPoint, err) } if !info.IsDir() { - return "", fmt.Errorf("mount point %s is not a directory", mountPoint) + return "", fmt.Errorf("mount point %q is not a directory", mountPoint) } return FS(mountPoint), nil diff --git a/vendor/github.com/prometheus/procfs/loadavg.go b/vendor/github.com/prometheus/procfs/loadavg.go index 00bbe144..0cce190e 100644 --- a/vendor/github.com/prometheus/procfs/loadavg.go +++ b/vendor/github.com/prometheus/procfs/loadavg.go @@ -44,14 +44,14 @@ func parseLoad(loadavgBytes []byte) (*LoadAvg, error) { loads := make([]float64, 3) parts := strings.Fields(string(loadavgBytes)) if len(parts) < 3 { - return nil, fmt.Errorf("malformed loadavg line: too few fields in loadavg string: %s", string(loadavgBytes)) + return nil, fmt.Errorf("malformed loadavg line: too few fields in loadavg string: %q", string(loadavgBytes)) } var err error for i, load := range parts[0:3] { loads[i], err = strconv.ParseFloat(load, 64) if err != nil { - return nil, fmt.Errorf("could not parse load '%s': %s", load, err) + return nil, fmt.Errorf("could not parse load %q: %w", load, err) } } return &LoadAvg{ diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go index 98e37aa8..f0b9e5f7 100644 --- a/vendor/github.com/prometheus/procfs/mdstat.go +++ b/vendor/github.com/prometheus/procfs/mdstat.go @@ -22,8 +22,12 @@ import ( ) var ( - statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) - recoveryLineRE = regexp.MustCompile(`\((\d+)/\d+\)`) + statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[([U_]+)\]`) + recoveryLineBlocksRE = regexp.MustCompile(`\((\d+)/\d+\)`) + recoveryLinePctRE = regexp.MustCompile(`= (.+)%`) + recoveryLineFinishRE = regexp.MustCompile(`finish=(.+)min`) + recoveryLineSpeedRE = regexp.MustCompile(`speed=(.+)[A-Z]`) + componentDeviceRE = regexp.MustCompile(`(.*)\[\d+\]`) ) // MDStat holds info parsed from /proc/mdstat. @@ -38,12 +42,22 @@ type MDStat struct { DisksTotal int64 // Number of failed disks. DisksFailed int64 + // Number of "down" disks. (the _ indicator in the status line) + DisksDown int64 // Spare disks in the device. DisksSpare int64 // Number of blocks the device holds. BlocksTotal int64 // Number of blocks on the device that are in sync. BlocksSynced int64 + // progress percentage of current sync + BlocksSyncedPct float64 + // estimated finishing time for current sync (in minutes) + BlocksSyncedFinishTime float64 + // current sync speed (in Kilobytes/sec) + BlocksSyncedSpeed float64 + // Name of md component devices + Devices []string } // MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of @@ -56,7 +70,7 @@ func (fs FS) MDStat() ([]MDStat, error) { } mdstat, err := parseMDStat(data) if err != nil { - return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) + return nil, fmt.Errorf("error parsing mdstat %q: %w", fs.proc.Path("mdstat"), err) } return mdstat, nil } @@ -82,19 +96,16 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { state := deviceFields[2] // active or inactive if len(lines) <= i+3 { - return nil, fmt.Errorf( - "error parsing %s: too few lines for md device", - mdName, - ) + return nil, fmt.Errorf("error parsing %q: too few lines for md device", mdName) } // Failed disks have the suffix (F) & Spare disks have the suffix (S). fail := int64(strings.Count(line, "(F)")) spare := int64(strings.Count(line, "(S)")) - active, total, size, err := evalStatusLine(lines[i], lines[i+1]) + active, total, down, size, err := evalStatusLine(lines[i], lines[i+1]) if err != nil { - return nil, fmt.Errorf("error parsing md device lines: %s", err) + return nil, fmt.Errorf("error parsing md device lines: %w", err) } syncLineIdx := i + 2 @@ -105,6 +116,9 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { // If device is syncing at the moment, get the number of currently // synced bytes, otherwise that number equals the size of the device. syncedBlocks := size + speed := float64(0) + finish := float64(0) + pct := float64(0) recovering := strings.Contains(lines[syncLineIdx], "recovery") resyncing := strings.Contains(lines[syncLineIdx], "resync") checking := strings.Contains(lines[syncLineIdx], "check") @@ -124,74 +138,125 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { strings.Contains(lines[syncLineIdx], "DELAYED") { syncedBlocks = 0 } else { - syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx]) + syncedBlocks, pct, finish, speed, err = evalRecoveryLine(lines[syncLineIdx]) if err != nil { - return nil, fmt.Errorf("error parsing sync line in md device %s: %s", mdName, err) + return nil, fmt.Errorf("error parsing sync line in md device %q: %w", mdName, err) } } } mdStats = append(mdStats, MDStat{ - Name: mdName, - ActivityState: state, - DisksActive: active, - DisksFailed: fail, - DisksSpare: spare, - DisksTotal: total, - BlocksTotal: size, - BlocksSynced: syncedBlocks, + Name: mdName, + ActivityState: state, + DisksActive: active, + DisksFailed: fail, + DisksDown: down, + DisksSpare: spare, + DisksTotal: total, + BlocksTotal: size, + BlocksSynced: syncedBlocks, + BlocksSyncedPct: pct, + BlocksSyncedFinishTime: finish, + BlocksSyncedSpeed: speed, + Devices: evalComponentDevices(deviceFields), }) } return mdStats, nil } -func evalStatusLine(deviceLine, statusLine string) (active, total, size int64, err error) { +func evalStatusLine(deviceLine, statusLine string) (active, total, down, size int64, err error) { sizeStr := strings.Fields(statusLine)[0] size, err = strconv.ParseInt(sizeStr, 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("unexpected statusLine %q: %w", statusLine, err) } if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") { // In the device deviceLine, only disks have a number associated with them in []. total = int64(strings.Count(deviceLine, "[")) - return total, total, size, nil + return total, total, 0, size, nil } if strings.Contains(deviceLine, "inactive") { - return 0, 0, size, nil + return 0, 0, 0, size, nil } matches := statusLineRE.FindStringSubmatch(statusLine) - if len(matches) != 4 { - return 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine) + if len(matches) != 5 { + return 0, 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine) } total, err = strconv.ParseInt(matches[2], 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("unexpected statusLine %q: %w", statusLine, err) } active, err = strconv.ParseInt(matches[3], 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) + return 0, 0, 0, 0, fmt.Errorf("unexpected statusLine %q: %w", statusLine, err) } + down = int64(strings.Count(matches[4], "_")) - return active, total, size, nil + return active, total, down, size, nil } -func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, err error) { - matches := recoveryLineRE.FindStringSubmatch(recoveryLine) +func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, pct float64, finish float64, speed float64, err error) { + matches := recoveryLineBlocksRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine) + return 0, 0, 0, 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine) } syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) if err != nil { - return 0, fmt.Errorf("%s in recoveryLine: %s", err, recoveryLine) + return 0, 0, 0, 0, fmt.Errorf("error parsing int from recoveryLine %q: %w", recoveryLine, err) } - return syncedBlocks, nil + // Get percentage complete + matches = recoveryLinePctRE.FindStringSubmatch(recoveryLine) + if len(matches) != 2 { + return syncedBlocks, 0, 0, 0, fmt.Errorf("unexpected recoveryLine matching percentage: %s", recoveryLine) + } + pct, err = strconv.ParseFloat(strings.TrimSpace(matches[1]), 64) + if err != nil { + return syncedBlocks, 0, 0, 0, fmt.Errorf("error parsing float from recoveryLine %q: %w", recoveryLine, err) + } + + // Get time expected left to complete + matches = recoveryLineFinishRE.FindStringSubmatch(recoveryLine) + if len(matches) != 2 { + return syncedBlocks, pct, 0, 0, fmt.Errorf("unexpected recoveryLine matching est. finish time: %s", recoveryLine) + } + finish, err = strconv.ParseFloat(matches[1], 64) + if err != nil { + return syncedBlocks, pct, 0, 0, fmt.Errorf("error parsing float from recoveryLine %q: %w", recoveryLine, err) + } + + // Get recovery speed + matches = recoveryLineSpeedRE.FindStringSubmatch(recoveryLine) + if len(matches) != 2 { + return syncedBlocks, pct, finish, 0, fmt.Errorf("unexpected recoveryLine matching speed: %s", recoveryLine) + } + speed, err = strconv.ParseFloat(matches[1], 64) + if err != nil { + return syncedBlocks, pct, finish, 0, fmt.Errorf("error parsing float from recoveryLine %q: %w", recoveryLine, err) + } + + return syncedBlocks, pct, finish, speed, nil +} + +func evalComponentDevices(deviceFields []string) []string { + mdComponentDevices := make([]string, 0) + if len(deviceFields) > 3 { + for _, field := range deviceFields[4:] { + match := componentDeviceRE.FindStringSubmatch(field) + if match == nil { + continue + } + mdComponentDevices = append(mdComponentDevices, match[1]) + } + } + + return mdComponentDevices } diff --git a/vendor/github.com/prometheus/procfs/meminfo.go b/vendor/github.com/prometheus/procfs/meminfo.go index 50dab4bc..f65e174e 100644 --- a/vendor/github.com/prometheus/procfs/meminfo.go +++ b/vendor/github.com/prometheus/procfs/meminfo.go @@ -28,9 +28,9 @@ import ( type Meminfo struct { // Total usable ram (i.e. physical ram minus a few reserved // bits and the kernel binary code) - MemTotal uint64 + MemTotal *uint64 // The sum of LowFree+HighFree - MemFree uint64 + MemFree *uint64 // An estimate of how much memory is available for starting // new applications, without swapping. Calculated from // MemFree, SReclaimable, the size of the file LRU lists, and @@ -39,59 +39,59 @@ type Meminfo struct { // well, and that not all reclaimable slab will be // reclaimable, due to items being in use. The impact of those // factors will vary from system to system. - MemAvailable uint64 + MemAvailable *uint64 // Relatively temporary storage for raw disk blocks shouldn't // get tremendously large (20MB or so) - Buffers uint64 - Cached uint64 + Buffers *uint64 + Cached *uint64 // Memory that once was swapped out, is swapped back in but // still also is in the swapfile (if memory is needed it // doesn't need to be swapped out AGAIN because it is already // in the swapfile. This saves I/O) - SwapCached uint64 + SwapCached *uint64 // Memory that has been used more recently and usually not // reclaimed unless absolutely necessary. - Active uint64 + Active *uint64 // Memory which has been less recently used. It is more // eligible to be reclaimed for other purposes - Inactive uint64 - ActiveAnon uint64 - InactiveAnon uint64 - ActiveFile uint64 - InactiveFile uint64 - Unevictable uint64 - Mlocked uint64 + Inactive *uint64 + ActiveAnon *uint64 + InactiveAnon *uint64 + ActiveFile *uint64 + InactiveFile *uint64 + Unevictable *uint64 + Mlocked *uint64 // total amount of swap space available - SwapTotal uint64 + SwapTotal *uint64 // Memory which has been evicted from RAM, and is temporarily // on the disk - SwapFree uint64 + SwapFree *uint64 // Memory which is waiting to get written back to the disk - Dirty uint64 + Dirty *uint64 // Memory which is actively being written back to the disk - Writeback uint64 + Writeback *uint64 // Non-file backed pages mapped into userspace page tables - AnonPages uint64 + AnonPages *uint64 // files which have been mapped, such as libraries - Mapped uint64 - Shmem uint64 + Mapped *uint64 + Shmem *uint64 // in-kernel data structures cache - Slab uint64 + Slab *uint64 // Part of Slab, that might be reclaimed, such as caches - SReclaimable uint64 + SReclaimable *uint64 // Part of Slab, that cannot be reclaimed on memory pressure - SUnreclaim uint64 - KernelStack uint64 + SUnreclaim *uint64 + KernelStack *uint64 // amount of memory dedicated to the lowest level of page // tables. - PageTables uint64 + PageTables *uint64 // NFS pages sent to the server, but not yet committed to // stable storage - NFSUnstable uint64 + NFSUnstable *uint64 // Memory used for block device "bounce buffers" - Bounce uint64 + Bounce *uint64 // Memory used by FUSE for temporary writeback buffers - WritebackTmp uint64 + WritebackTmp *uint64 // Based on the overcommit ratio ('vm.overcommit_ratio'), // this is the total amount of memory currently available to // be allocated on the system. This limit is only adhered to @@ -105,7 +105,7 @@ type Meminfo struct { // yield a CommitLimit of 7.3G. // For more details, see the memory overcommit documentation // in vm/overcommit-accounting. - CommitLimit uint64 + CommitLimit *uint64 // The amount of memory presently allocated on the system. // The committed memory is a sum of all of the memory which // has been allocated by processes, even if it has not been @@ -119,27 +119,27 @@ type Meminfo struct { // This is useful if one needs to guarantee that processes will // not fail due to lack of memory once that memory has been // successfully allocated. - CommittedAS uint64 + CommittedAS *uint64 // total size of vmalloc memory area - VmallocTotal uint64 + VmallocTotal *uint64 // amount of vmalloc area which is used - VmallocUsed uint64 + VmallocUsed *uint64 // largest contiguous block of vmalloc area which is free - VmallocChunk uint64 - HardwareCorrupted uint64 - AnonHugePages uint64 - ShmemHugePages uint64 - ShmemPmdMapped uint64 - CmaTotal uint64 - CmaFree uint64 - HugePagesTotal uint64 - HugePagesFree uint64 - HugePagesRsvd uint64 - HugePagesSurp uint64 - Hugepagesize uint64 - DirectMap4k uint64 - DirectMap2M uint64 - DirectMap1G uint64 + VmallocChunk *uint64 + HardwareCorrupted *uint64 + AnonHugePages *uint64 + ShmemHugePages *uint64 + ShmemPmdMapped *uint64 + CmaTotal *uint64 + CmaFree *uint64 + HugePagesTotal *uint64 + HugePagesFree *uint64 + HugePagesRsvd *uint64 + HugePagesSurp *uint64 + Hugepagesize *uint64 + DirectMap4k *uint64 + DirectMap2M *uint64 + DirectMap1G *uint64 } // Meminfo returns an information about current kernel/system memory statistics. @@ -152,7 +152,7 @@ func (fs FS) Meminfo() (Meminfo, error) { m, err := parseMemInfo(bytes.NewReader(b)) if err != nil { - return Meminfo{}, fmt.Errorf("failed to parse meminfo: %v", err) + return Meminfo{}, fmt.Errorf("failed to parse meminfo: %w", err) } return *m, nil @@ -175,101 +175,101 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { switch fields[0] { case "MemTotal:": - m.MemTotal = v + m.MemTotal = &v case "MemFree:": - m.MemFree = v + m.MemFree = &v case "MemAvailable:": - m.MemAvailable = v + m.MemAvailable = &v case "Buffers:": - m.Buffers = v + m.Buffers = &v case "Cached:": - m.Cached = v + m.Cached = &v case "SwapCached:": - m.SwapCached = v + m.SwapCached = &v case "Active:": - m.Active = v + m.Active = &v case "Inactive:": - m.Inactive = v + m.Inactive = &v case "Active(anon):": - m.ActiveAnon = v + m.ActiveAnon = &v case "Inactive(anon):": - m.InactiveAnon = v + m.InactiveAnon = &v case "Active(file):": - m.ActiveFile = v + m.ActiveFile = &v case "Inactive(file):": - m.InactiveFile = v + m.InactiveFile = &v case "Unevictable:": - m.Unevictable = v + m.Unevictable = &v case "Mlocked:": - m.Mlocked = v + m.Mlocked = &v case "SwapTotal:": - m.SwapTotal = v + m.SwapTotal = &v case "SwapFree:": - m.SwapFree = v + m.SwapFree = &v case "Dirty:": - m.Dirty = v + m.Dirty = &v case "Writeback:": - m.Writeback = v + m.Writeback = &v case "AnonPages:": - m.AnonPages = v + m.AnonPages = &v case "Mapped:": - m.Mapped = v + m.Mapped = &v case "Shmem:": - m.Shmem = v + m.Shmem = &v case "Slab:": - m.Slab = v + m.Slab = &v case "SReclaimable:": - m.SReclaimable = v + m.SReclaimable = &v case "SUnreclaim:": - m.SUnreclaim = v + m.SUnreclaim = &v case "KernelStack:": - m.KernelStack = v + m.KernelStack = &v case "PageTables:": - m.PageTables = v + m.PageTables = &v case "NFS_Unstable:": - m.NFSUnstable = v + m.NFSUnstable = &v case "Bounce:": - m.Bounce = v + m.Bounce = &v case "WritebackTmp:": - m.WritebackTmp = v + m.WritebackTmp = &v case "CommitLimit:": - m.CommitLimit = v + m.CommitLimit = &v case "Committed_AS:": - m.CommittedAS = v + m.CommittedAS = &v case "VmallocTotal:": - m.VmallocTotal = v + m.VmallocTotal = &v case "VmallocUsed:": - m.VmallocUsed = v + m.VmallocUsed = &v case "VmallocChunk:": - m.VmallocChunk = v + m.VmallocChunk = &v case "HardwareCorrupted:": - m.HardwareCorrupted = v + m.HardwareCorrupted = &v case "AnonHugePages:": - m.AnonHugePages = v + m.AnonHugePages = &v case "ShmemHugePages:": - m.ShmemHugePages = v + m.ShmemHugePages = &v case "ShmemPmdMapped:": - m.ShmemPmdMapped = v + m.ShmemPmdMapped = &v case "CmaTotal:": - m.CmaTotal = v + m.CmaTotal = &v case "CmaFree:": - m.CmaFree = v + m.CmaFree = &v case "HugePages_Total:": - m.HugePagesTotal = v + m.HugePagesTotal = &v case "HugePages_Free:": - m.HugePagesFree = v + m.HugePagesFree = &v case "HugePages_Rsvd:": - m.HugePagesRsvd = v + m.HugePagesRsvd = &v case "HugePages_Surp:": - m.HugePagesSurp = v + m.HugePagesSurp = &v case "Hugepagesize:": - m.Hugepagesize = v + m.Hugepagesize = &v case "DirectMap4k:": - m.DirectMap4k = v + m.DirectMap4k = &v case "DirectMap2M:": - m.DirectMap2M = v + m.DirectMap2M = &v case "DirectMap1G:": - m.DirectMap1G = v + m.DirectMap1G = &v } } diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go index 861ced9d..f7a828bb 100644 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ b/vendor/github.com/prometheus/procfs/mountstats.go @@ -338,12 +338,12 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e if len(ss) == 0 { break } - if len(ss) < 2 { - return nil, fmt.Errorf("not enough information for NFS stats: %v", ss) - } switch ss[0] { case fieldOpts: + if len(ss) < 2 { + return nil, fmt.Errorf("not enough information for NFS stats: %v", ss) + } if stats.Opts == nil { stats.Opts = map[string]string{} } @@ -356,6 +356,9 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e } } case fieldAge: + if len(ss) < 2 { + return nil, fmt.Errorf("not enough information for NFS stats: %v", ss) + } // Age integer is in seconds d, err := time.ParseDuration(ss[1] + "s") if err != nil { @@ -364,6 +367,9 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e stats.Age = d case fieldBytes: + if len(ss) < 2 { + return nil, fmt.Errorf("not enough information for NFS stats: %v", ss) + } bstats, err := parseNFSBytesStats(ss[1:]) if err != nil { return nil, err @@ -371,6 +377,9 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e stats.Bytes = *bstats case fieldEvents: + if len(ss) < 2 { + return nil, fmt.Errorf("not enough information for NFS stats: %v", ss) + } estats, err := parseNFSEventsStats(ss[1:]) if err != nil { return nil, err diff --git a/vendor/github.com/prometheus/procfs/net_conntrackstat.go b/vendor/github.com/prometheus/procfs/net_conntrackstat.go index b637be98..9964a360 100644 --- a/vendor/github.com/prometheus/procfs/net_conntrackstat.go +++ b/vendor/github.com/prometheus/procfs/net_conntrackstat.go @@ -55,7 +55,7 @@ func readConntrackStat(path string) ([]ConntrackStatEntry, error) { stat, err := parseConntrackStat(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("failed to read conntrack stats from %q: %v", path, err) + return nil, fmt.Errorf("failed to read conntrack stats from %q: %w", path, err) } return stat, nil @@ -147,7 +147,7 @@ func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) { func parseConntrackStatField(field string) (uint64, error) { val, err := strconv.ParseUint(field, 16, 64) if err != nil { - return 0, fmt.Errorf("couldn't parse \"%s\" field: %s", field, err) + return 0, fmt.Errorf("couldn't parse %q field: %w", field, err) } return val, err } diff --git a/vendor/github.com/prometheus/procfs/net_ip_socket.go b/vendor/github.com/prometheus/procfs/net_ip_socket.go new file mode 100644 index 00000000..8c9ee3de --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_ip_socket.go @@ -0,0 +1,226 @@ +// Copyright 2020 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "encoding/hex" + "fmt" + "io" + "net" + "os" + "strconv" + "strings" +) + +const ( + // readLimit is used by io.LimitReader while reading the content of the + // /proc/net/udp{,6} files. The number of lines inside such a file is dynamic + // as each line represents a single used socket. + // In theory, the number of available sockets is 65535 (2^16 - 1) per IP. + // With e.g. 150 Byte per line and the maximum number of 65535, + // the reader needs to handle 150 Byte * 65535 =~ 10 MB for a single IP. + readLimit = 4294967296 // Byte -> 4 GiB +) + +// this contains generic data structures for both udp and tcp sockets +type ( + // NetIPSocket represents the contents of /proc/net/{t,u}dp{,6} file without the header. + NetIPSocket []*netIPSocketLine + + // NetIPSocketSummary provides already computed values like the total queue lengths or + // the total number of used sockets. In contrast to NetIPSocket it does not collect + // the parsed lines into a slice. + NetIPSocketSummary struct { + // TxQueueLength shows the total queue length of all parsed tx_queue lengths. + TxQueueLength uint64 + // RxQueueLength shows the total queue length of all parsed rx_queue lengths. + RxQueueLength uint64 + // UsedSockets shows the total number of parsed lines representing the + // number of used sockets. + UsedSockets uint64 + } + + // netIPSocketLine represents the fields parsed from a single line + // in /proc/net/{t,u}dp{,6}. Fields which are not used by IPSocket are skipped. + // For the proc file format details, see https://linux.die.net/man/5/proc. + netIPSocketLine struct { + Sl uint64 + LocalAddr net.IP + LocalPort uint64 + RemAddr net.IP + RemPort uint64 + St uint64 + TxQueue uint64 + RxQueue uint64 + UID uint64 + Inode uint64 + } +) + +func newNetIPSocket(file string) (NetIPSocket, error) { + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + var netIPSocket NetIPSocket + + lr := io.LimitReader(f, readLimit) + s := bufio.NewScanner(lr) + s.Scan() // skip first line with headers + for s.Scan() { + fields := strings.Fields(s.Text()) + line, err := parseNetIPSocketLine(fields) + if err != nil { + return nil, err + } + netIPSocket = append(netIPSocket, line) + } + if err := s.Err(); err != nil { + return nil, err + } + return netIPSocket, nil +} + +// newNetIPSocketSummary creates a new NetIPSocket{,6} from the contents of the given file. +func newNetIPSocketSummary(file string) (*NetIPSocketSummary, error) { + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + var netIPSocketSummary NetIPSocketSummary + + lr := io.LimitReader(f, readLimit) + s := bufio.NewScanner(lr) + s.Scan() // skip first line with headers + for s.Scan() { + fields := strings.Fields(s.Text()) + line, err := parseNetIPSocketLine(fields) + if err != nil { + return nil, err + } + netIPSocketSummary.TxQueueLength += line.TxQueue + netIPSocketSummary.RxQueueLength += line.RxQueue + netIPSocketSummary.UsedSockets++ + } + if err := s.Err(); err != nil { + return nil, err + } + return &netIPSocketSummary, nil +} + +// the /proc/net/{t,u}dp{,6} files are network byte order for ipv4 and for ipv6 the address is four words consisting of four bytes each. In each of those four words the four bytes are written in reverse order. + +func parseIP(hexIP string) (net.IP, error) { + var byteIP []byte + byteIP, err := hex.DecodeString(hexIP) + if err != nil { + return nil, fmt.Errorf("cannot parse address field in socket line %q", hexIP) + } + switch len(byteIP) { + case 4: + return net.IP{byteIP[3], byteIP[2], byteIP[1], byteIP[0]}, nil + case 16: + i := net.IP{ + byteIP[3], byteIP[2], byteIP[1], byteIP[0], + byteIP[7], byteIP[6], byteIP[5], byteIP[4], + byteIP[11], byteIP[10], byteIP[9], byteIP[8], + byteIP[15], byteIP[14], byteIP[13], byteIP[12], + } + return i, nil + default: + return nil, fmt.Errorf("Unable to parse IP %s", hexIP) + } +} + +// parseNetIPSocketLine parses a single line, represented by a list of fields. +func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) { + line := &netIPSocketLine{} + if len(fields) < 10 { + return nil, fmt.Errorf( + "cannot parse net socket line as it has less then 10 columns %q", + strings.Join(fields, " "), + ) + } + var err error // parse error + + // sl + s := strings.Split(fields[0], ":") + if len(s) != 2 { + return nil, fmt.Errorf("cannot parse sl field in socket line %q", fields[0]) + } + + if line.Sl, err = strconv.ParseUint(s[0], 0, 64); err != nil { + return nil, fmt.Errorf("cannot parse sl value in socket line: %w", err) + } + // local_address + l := strings.Split(fields[1], ":") + if len(l) != 2 { + return nil, fmt.Errorf("cannot parse local_address field in socket line %q", fields[1]) + } + if line.LocalAddr, err = parseIP(l[0]); err != nil { + return nil, err + } + if line.LocalPort, err = strconv.ParseUint(l[1], 16, 64); err != nil { + return nil, fmt.Errorf("cannot parse local_address port value in socket line: %w", err) + } + + // remote_address + r := strings.Split(fields[2], ":") + if len(r) != 2 { + return nil, fmt.Errorf("cannot parse rem_address field in socket line %q", fields[1]) + } + if line.RemAddr, err = parseIP(r[0]); err != nil { + return nil, err + } + if line.RemPort, err = strconv.ParseUint(r[1], 16, 64); err != nil { + return nil, fmt.Errorf("cannot parse rem_address port value in socket line: %w", err) + } + + // st + if line.St, err = strconv.ParseUint(fields[3], 16, 64); err != nil { + return nil, fmt.Errorf("cannot parse st value in socket line: %w", err) + } + + // tx_queue and rx_queue + q := strings.Split(fields[4], ":") + if len(q) != 2 { + return nil, fmt.Errorf( + "cannot parse tx/rx queues in socket line as it has a missing colon %q", + fields[4], + ) + } + if line.TxQueue, err = strconv.ParseUint(q[0], 16, 64); err != nil { + return nil, fmt.Errorf("cannot parse tx_queue value in socket line: %w", err) + } + if line.RxQueue, err = strconv.ParseUint(q[1], 16, 64); err != nil { + return nil, fmt.Errorf("cannot parse rx_queue value in socket line: %w", err) + } + + // uid + if line.UID, err = strconv.ParseUint(fields[7], 0, 64); err != nil { + return nil, fmt.Errorf("cannot parse uid value in socket line: %w", err) + } + + // inode + if line.Inode, err = strconv.ParseUint(fields[9], 0, 64); err != nil { + return nil, fmt.Errorf("cannot parse inode value in socket line: %w", err) + } + + return line, nil +} diff --git a/vendor/github.com/prometheus/procfs/net_protocols.go b/vendor/github.com/prometheus/procfs/net_protocols.go new file mode 100644 index 00000000..8c6de379 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_protocols.go @@ -0,0 +1,180 @@ +// Copyright 2020 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "bytes" + "fmt" + "strconv" + "strings" + + "github.com/prometheus/procfs/internal/util" +) + +// NetProtocolStats stores the contents from /proc/net/protocols +type NetProtocolStats map[string]NetProtocolStatLine + +// NetProtocolStatLine contains a single line parsed from /proc/net/protocols. We +// only care about the first six columns as the rest are not likely to change +// and only serve to provide a set of capabilities for each protocol. +type NetProtocolStatLine struct { + Name string // 0 The name of the protocol + Size uint64 // 1 The size, in bytes, of a given protocol structure. e.g. sizeof(struct tcp_sock) or sizeof(struct unix_sock) + Sockets int64 // 2 Number of sockets in use by this protocol + Memory int64 // 3 Number of 4KB pages allocated by all sockets of this protocol + Pressure int // 4 This is either yes, no, or NI (not implemented). For the sake of simplicity we treat NI as not experiencing memory pressure. + MaxHeader uint64 // 5 Protocol specific max header size + Slab bool // 6 Indicates whether or not memory is allocated from the SLAB + ModuleName string // 7 The name of the module that implemented this protocol or "kernel" if not from a module + Capabilities NetProtocolCapabilities +} + +// NetProtocolCapabilities contains a list of capabilities for each protocol +type NetProtocolCapabilities struct { + Close bool // 8 + Connect bool // 9 + Disconnect bool // 10 + Accept bool // 11 + IoCtl bool // 12 + Init bool // 13 + Destroy bool // 14 + Shutdown bool // 15 + SetSockOpt bool // 16 + GetSockOpt bool // 17 + SendMsg bool // 18 + RecvMsg bool // 19 + SendPage bool // 20 + Bind bool // 21 + BacklogRcv bool // 22 + Hash bool // 23 + UnHash bool // 24 + GetPort bool // 25 + EnterMemoryPressure bool // 26 +} + +// NetProtocols reads stats from /proc/net/protocols and returns a map of +// PortocolStatLine entries. As of this writing no official Linux Documentation +// exists, however the source is fairly self-explanatory and the format seems +// stable since its introduction in 2.6.12-rc2 +// Linux 2.6.12-rc2 - https://elixir.bootlin.com/linux/v2.6.12-rc2/source/net/core/sock.c#L1452 +// Linux 5.10 - https://elixir.bootlin.com/linux/v5.10.4/source/net/core/sock.c#L3586 +func (fs FS) NetProtocols() (NetProtocolStats, error) { + data, err := util.ReadFileNoStat(fs.proc.Path("net/protocols")) + if err != nil { + return NetProtocolStats{}, err + } + return parseNetProtocols(bufio.NewScanner(bytes.NewReader(data))) +} + +func parseNetProtocols(s *bufio.Scanner) (NetProtocolStats, error) { + nps := NetProtocolStats{} + + // Skip the header line + s.Scan() + + for s.Scan() { + line, err := nps.parseLine(s.Text()) + if err != nil { + return NetProtocolStats{}, err + } + + nps[line.Name] = *line + } + return nps, nil +} + +func (ps NetProtocolStats) parseLine(rawLine string) (*NetProtocolStatLine, error) { + line := &NetProtocolStatLine{Capabilities: NetProtocolCapabilities{}} + var err error + const enabled = "yes" + const disabled = "no" + + fields := strings.Fields(rawLine) + line.Name = fields[0] + line.Size, err = strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return nil, err + } + line.Sockets, err = strconv.ParseInt(fields[2], 10, 64) + if err != nil { + return nil, err + } + line.Memory, err = strconv.ParseInt(fields[3], 10, 64) + if err != nil { + return nil, err + } + if fields[4] == enabled { + line.Pressure = 1 + } else if fields[4] == disabled { + line.Pressure = 0 + } else { + line.Pressure = -1 + } + line.MaxHeader, err = strconv.ParseUint(fields[5], 10, 64) + if err != nil { + return nil, err + } + if fields[6] == enabled { + line.Slab = true + } else if fields[6] == disabled { + line.Slab = false + } else { + return nil, fmt.Errorf("unable to parse capability for protocol: %s", line.Name) + } + line.ModuleName = fields[7] + + err = line.Capabilities.parseCapabilities(fields[8:]) + if err != nil { + return nil, err + } + + return line, nil +} + +func (pc *NetProtocolCapabilities) parseCapabilities(capabilities []string) error { + // The capabilities are all bools so we can loop over to map them + capabilityFields := [...]*bool{ + &pc.Close, + &pc.Connect, + &pc.Disconnect, + &pc.Accept, + &pc.IoCtl, + &pc.Init, + &pc.Destroy, + &pc.Shutdown, + &pc.SetSockOpt, + &pc.GetSockOpt, + &pc.SendMsg, + &pc.RecvMsg, + &pc.SendPage, + &pc.Bind, + &pc.BacklogRcv, + &pc.Hash, + &pc.UnHash, + &pc.GetPort, + &pc.EnterMemoryPressure, + } + + for i := 0; i < len(capabilities); i++ { + if capabilities[i] == "y" { + *capabilityFields[i] = true + } else if capabilities[i] == "n" { + *capabilityFields[i] = false + } else { + return fmt.Errorf("unable to parse capability block for protocol: position %d", i) + } + } + return nil +} diff --git a/vendor/github.com/prometheus/procfs/net_sockstat.go b/vendor/github.com/prometheus/procfs/net_sockstat.go index f91ef552..e36f4872 100644 --- a/vendor/github.com/prometheus/procfs/net_sockstat.go +++ b/vendor/github.com/prometheus/procfs/net_sockstat.go @@ -70,7 +70,7 @@ func readSockstat(name string) (*NetSockstat, error) { stat, err := parseSockstat(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("failed to read sockstats from %q: %v", name, err) + return nil, fmt.Errorf("failed to read sockstats from %q: %w", name, err) } return stat, nil @@ -90,7 +90,7 @@ func parseSockstat(r io.Reader) (*NetSockstat, error) { // The remaining fields are key/value pairs. kvs, err := parseSockstatKVs(fields[1:]) if err != nil { - return nil, fmt.Errorf("error parsing sockstat key/value pairs from %q: %v", s.Text(), err) + return nil, fmt.Errorf("error parsing sockstat key/value pairs from %q: %w", s.Text(), err) } // The first field is the protocol. We must trim its colon suffix. diff --git a/vendor/github.com/prometheus/procfs/net_softnet.go b/vendor/github.com/prometheus/procfs/net_softnet.go index db5debdf..46f12c61 100644 --- a/vendor/github.com/prometheus/procfs/net_softnet.go +++ b/vendor/github.com/prometheus/procfs/net_softnet.go @@ -51,7 +51,7 @@ func (fs FS) NetSoftnetStat() ([]SoftnetStat, error) { entries, err := parseSoftnet(bytes.NewReader(b)) if err != nil { - return nil, fmt.Errorf("failed to parse /proc/net/softnet_stat: %v", err) + return nil, fmt.Errorf("failed to parse /proc/net/softnet_stat: %w", err) } return entries, nil diff --git a/vendor/github.com/prometheus/procfs/net_tcp.go b/vendor/github.com/prometheus/procfs/net_tcp.go new file mode 100644 index 00000000..52776295 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_tcp.go @@ -0,0 +1,64 @@ +// Copyright 2020 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +type ( + // NetTCP represents the contents of /proc/net/tcp{,6} file without the header. + NetTCP []*netIPSocketLine + + // NetTCPSummary provides already computed values like the total queue lengths or + // the total number of used sockets. In contrast to NetTCP it does not collect + // the parsed lines into a slice. + NetTCPSummary NetIPSocketSummary +) + +// NetTCP returns the IPv4 kernel/networking statistics for TCP datagrams +// read from /proc/net/tcp. +func (fs FS) NetTCP() (NetTCP, error) { + return newNetTCP(fs.proc.Path("net/tcp")) +} + +// NetTCP6 returns the IPv6 kernel/networking statistics for TCP datagrams +// read from /proc/net/tcp6. +func (fs FS) NetTCP6() (NetTCP, error) { + return newNetTCP(fs.proc.Path("net/tcp6")) +} + +// NetTCPSummary returns already computed statistics like the total queue lengths +// for TCP datagrams read from /proc/net/tcp. +func (fs FS) NetTCPSummary() (*NetTCPSummary, error) { + return newNetTCPSummary(fs.proc.Path("net/tcp")) +} + +// NetTCP6Summary returns already computed statistics like the total queue lengths +// for TCP datagrams read from /proc/net/tcp6. +func (fs FS) NetTCP6Summary() (*NetTCPSummary, error) { + return newNetTCPSummary(fs.proc.Path("net/tcp6")) +} + +// newNetTCP creates a new NetTCP{,6} from the contents of the given file. +func newNetTCP(file string) (NetTCP, error) { + n, err := newNetIPSocket(file) + n1 := NetTCP(n) + return n1, err +} + +func newNetTCPSummary(file string) (*NetTCPSummary, error) { + n, err := newNetIPSocketSummary(file) + if n == nil { + return nil, err + } + n1 := NetTCPSummary(*n) + return &n1, err +} diff --git a/vendor/github.com/prometheus/procfs/net_udp.go b/vendor/github.com/prometheus/procfs/net_udp.go index d017e3f1..9ac3daf2 100644 --- a/vendor/github.com/prometheus/procfs/net_udp.go +++ b/vendor/github.com/prometheus/procfs/net_udp.go @@ -13,58 +13,14 @@ package procfs -import ( - "bufio" - "encoding/hex" - "fmt" - "io" - "net" - "os" - "strconv" - "strings" -) - -const ( - // readLimit is used by io.LimitReader while reading the content of the - // /proc/net/udp{,6} files. The number of lines inside such a file is dynamic - // as each line represents a single used socket. - // In theory, the number of available sockets is 65535 (2^16 - 1) per IP. - // With e.g. 150 Byte per line and the maximum number of 65535, - // the reader needs to handle 150 Byte * 65535 =~ 10 MB for a single IP. - readLimit = 4294967296 // Byte -> 4 GiB -) - type ( // NetUDP represents the contents of /proc/net/udp{,6} file without the header. - NetUDP []*netUDPLine + NetUDP []*netIPSocketLine // NetUDPSummary provides already computed values like the total queue lengths or // the total number of used sockets. In contrast to NetUDP it does not collect // the parsed lines into a slice. - NetUDPSummary struct { - // TxQueueLength shows the total queue length of all parsed tx_queue lengths. - TxQueueLength uint64 - // RxQueueLength shows the total queue length of all parsed rx_queue lengths. - RxQueueLength uint64 - // UsedSockets shows the total number of parsed lines representing the - // number of used sockets. - UsedSockets uint64 - } - - // netUDPLine represents the fields parsed from a single line - // in /proc/net/udp{,6}. Fields which are not used by UDP are skipped. - // For the proc file format details, see https://linux.die.net/man/5/proc. - netUDPLine struct { - Sl uint64 - LocalAddr net.IP - LocalPort uint64 - RemAddr net.IP - RemPort uint64 - St uint64 - TxQueue uint64 - RxQueue uint64 - UID uint64 - } + NetUDPSummary NetIPSocketSummary ) // NetUDP returns the IPv4 kernel/networking statistics for UDP datagrams @@ -93,137 +49,16 @@ func (fs FS) NetUDP6Summary() (*NetUDPSummary, error) { // newNetUDP creates a new NetUDP{,6} from the contents of the given file. func newNetUDP(file string) (NetUDP, error) { - f, err := os.Open(file) - if err != nil { - return nil, err - } - defer f.Close() - - netUDP := NetUDP{} - - lr := io.LimitReader(f, readLimit) - s := bufio.NewScanner(lr) - s.Scan() // skip first line with headers - for s.Scan() { - fields := strings.Fields(s.Text()) - line, err := parseNetUDPLine(fields) - if err != nil { - return nil, err - } - netUDP = append(netUDP, line) - } - if err := s.Err(); err != nil { - return nil, err - } - return netUDP, nil + n, err := newNetIPSocket(file) + n1 := NetUDP(n) + return n1, err } -// newNetUDPSummary creates a new NetUDP{,6} from the contents of the given file. func newNetUDPSummary(file string) (*NetUDPSummary, error) { - f, err := os.Open(file) - if err != nil { + n, err := newNetIPSocketSummary(file) + if n == nil { return nil, err } - defer f.Close() - - netUDPSummary := &NetUDPSummary{} - - lr := io.LimitReader(f, readLimit) - s := bufio.NewScanner(lr) - s.Scan() // skip first line with headers - for s.Scan() { - fields := strings.Fields(s.Text()) - line, err := parseNetUDPLine(fields) - if err != nil { - return nil, err - } - netUDPSummary.TxQueueLength += line.TxQueue - netUDPSummary.RxQueueLength += line.RxQueue - netUDPSummary.UsedSockets++ - } - if err := s.Err(); err != nil { - return nil, err - } - return netUDPSummary, nil -} - -// parseNetUDPLine parses a single line, represented by a list of fields. -func parseNetUDPLine(fields []string) (*netUDPLine, error) { - line := &netUDPLine{} - if len(fields) < 8 { - return nil, fmt.Errorf( - "cannot parse net udp socket line as it has less then 8 columns: %s", - strings.Join(fields, " "), - ) - } - var err error // parse error - - // sl - s := strings.Split(fields[0], ":") - if len(s) != 2 { - return nil, fmt.Errorf( - "cannot parse sl field in udp socket line: %s", fields[0]) - } - - if line.Sl, err = strconv.ParseUint(s[0], 0, 64); err != nil { - return nil, fmt.Errorf("cannot parse sl value in udp socket line: %s", err) - } - // local_address - l := strings.Split(fields[1], ":") - if len(l) != 2 { - return nil, fmt.Errorf( - "cannot parse local_address field in udp socket line: %s", fields[1]) - } - if line.LocalAddr, err = hex.DecodeString(l[0]); err != nil { - return nil, fmt.Errorf( - "cannot parse local_address value in udp socket line: %s", err) - } - if line.LocalPort, err = strconv.ParseUint(l[1], 16, 64); err != nil { - return nil, fmt.Errorf( - "cannot parse local_address port value in udp socket line: %s", err) - } - - // remote_address - r := strings.Split(fields[2], ":") - if len(r) != 2 { - return nil, fmt.Errorf( - "cannot parse rem_address field in udp socket line: %s", fields[1]) - } - if line.RemAddr, err = hex.DecodeString(r[0]); err != nil { - return nil, fmt.Errorf( - "cannot parse rem_address value in udp socket line: %s", err) - } - if line.RemPort, err = strconv.ParseUint(r[1], 16, 64); err != nil { - return nil, fmt.Errorf( - "cannot parse rem_address port value in udp socket line: %s", err) - } - - // st - if line.St, err = strconv.ParseUint(fields[3], 16, 64); err != nil { - return nil, fmt.Errorf( - "cannot parse st value in udp socket line: %s", err) - } - - // tx_queue and rx_queue - q := strings.Split(fields[4], ":") - if len(q) != 2 { - return nil, fmt.Errorf( - "cannot parse tx/rx queues in udp socket line as it has a missing colon: %s", - fields[4], - ) - } - if line.TxQueue, err = strconv.ParseUint(q[0], 16, 64); err != nil { - return nil, fmt.Errorf("cannot parse tx_queue value in udp socket line: %s", err) - } - if line.RxQueue, err = strconv.ParseUint(q[1], 16, 64); err != nil { - return nil, fmt.Errorf("cannot parse rx_queue value in udp socket line: %s", err) - } - - // uid - if line.UID, err = strconv.ParseUint(fields[7], 0, 64); err != nil { - return nil, fmt.Errorf( - "cannot parse uid value in udp socket line: %s", err) - } - - return line, nil + n1 := NetUDPSummary(*n) + return &n1, err } diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go index c55b4b18..98aa8e1c 100644 --- a/vendor/github.com/prometheus/procfs/net_unix.go +++ b/vendor/github.com/prometheus/procfs/net_unix.go @@ -108,14 +108,14 @@ func parseNetUNIX(r io.Reader) (*NetUNIX, error) { line := s.Text() item, err := nu.parseLine(line, hasInode, minFields) if err != nil { - return nil, fmt.Errorf("failed to parse /proc/net/unix data %q: %v", line, err) + return nil, fmt.Errorf("failed to parse /proc/net/unix data %q: %w", line, err) } nu.Rows = append(nu.Rows, item) } if err := s.Err(); err != nil { - return nil, fmt.Errorf("failed to scan /proc/net/unix data: %v", err) + return nil, fmt.Errorf("failed to scan /proc/net/unix data: %w", err) } return &nu, nil @@ -136,29 +136,29 @@ func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine, users, err := u.parseUsers(fields[1]) if err != nil { - return nil, fmt.Errorf("failed to parse ref count(%s): %v", fields[1], err) + return nil, fmt.Errorf("failed to parse ref count %q: %w", fields[1], err) } flags, err := u.parseFlags(fields[3]) if err != nil { - return nil, fmt.Errorf("failed to parse flags(%s): %v", fields[3], err) + return nil, fmt.Errorf("failed to parse flags %q: %w", fields[3], err) } typ, err := u.parseType(fields[4]) if err != nil { - return nil, fmt.Errorf("failed to parse type(%s): %v", fields[4], err) + return nil, fmt.Errorf("failed to parse type %q: %w", fields[4], err) } state, err := u.parseState(fields[5]) if err != nil { - return nil, fmt.Errorf("failed to parse state(%s): %v", fields[5], err) + return nil, fmt.Errorf("failed to parse state %q: %w", fields[5], err) } var inode uint64 if hasInode { inode, err = u.parseInode(fields[6]) if err != nil { - return nil, fmt.Errorf("failed to parse inode(%s): %v", fields[6], err) + return nil, fmt.Errorf("failed to parse inode %q: %w", fields[6], err) } } diff --git a/vendor/github.com/prometheus/procfs/netstat.go b/vendor/github.com/prometheus/procfs/netstat.go new file mode 100644 index 00000000..94d892f1 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/netstat.go @@ -0,0 +1,68 @@ +// Copyright 2020 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "os" + "path/filepath" + "strconv" + "strings" +) + +// NetStat contains statistics for all the counters from one file +type NetStat struct { + Filename string + Stats map[string][]uint64 +} + +// NetStat retrieves stats from /proc/net/stat/ +func (fs FS) NetStat() ([]NetStat, error) { + statFiles, err := filepath.Glob(fs.proc.Path("net/stat/*")) + if err != nil { + return nil, err + } + + var netStatsTotal []NetStat + + for _, filePath := range statFiles { + file, err := os.Open(filePath) + if err != nil { + return nil, err + } + + netStatFile := NetStat{ + Filename: filepath.Base(filePath), + Stats: make(map[string][]uint64), + } + scanner := bufio.NewScanner(file) + scanner.Scan() + // First string is always a header for stats + var headers []string + headers = append(headers, strings.Fields(scanner.Text())...) + + // Other strings represent per-CPU counters + for scanner.Scan() { + for num, counter := range strings.Fields(scanner.Text()) { + value, err := strconv.ParseUint(counter, 16, 32) + if err != nil { + return nil, err + } + netStatFile.Stats[headers[num]] = append(netStatFile.Stats[headers[num]], value) + } + } + netStatsTotal = append(netStatsTotal, netStatFile) + } + return netStatsTotal, nil +} diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index 9f97b6e5..28f69680 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go @@ -105,7 +105,7 @@ func (fs FS) AllProcs() (Procs, error) { names, err := d.Readdirnames(-1) if err != nil { - return Procs{}, fmt.Errorf("could not read %s: %s", d.Name(), err) + return Procs{}, fmt.Errorf("could not read %q: %w", d.Name(), err) } p := Procs{} @@ -206,7 +206,7 @@ func (p Proc) FileDescriptors() ([]uintptr, error) { for i, n := range names { fd, err := strconv.ParseInt(n, 10, 32) if err != nil { - return nil, fmt.Errorf("could not parse fd %s: %s", n, err) + return nil, fmt.Errorf("could not parse fd %q: %w", n, err) } fds[i] = uintptr(fd) } @@ -278,7 +278,7 @@ func (p Proc) fileDescriptors() ([]string, error) { names, err := d.Readdirnames(-1) if err != nil { - return nil, fmt.Errorf("could not read %s: %s", d.Name(), err) + return nil, fmt.Errorf("could not read %q: %w", d.Name(), err) } return names, nil diff --git a/vendor/github.com/prometheus/procfs/proc_cgroup.go b/vendor/github.com/prometheus/procfs/proc_cgroup.go index 4abd4645..be45b798 100644 --- a/vendor/github.com/prometheus/procfs/proc_cgroup.go +++ b/vendor/github.com/prometheus/procfs/proc_cgroup.go @@ -49,7 +49,7 @@ type Cgroup struct { func parseCgroupString(cgroupStr string) (*Cgroup, error) { var err error - fields := strings.Split(cgroupStr, ":") + fields := strings.SplitN(cgroupStr, ":", 3) if len(fields) < 3 { return nil, fmt.Errorf("at least 3 fields required, found %d fields in cgroup string: %s", len(fields), cgroupStr) } @@ -90,7 +90,7 @@ func parseCgroups(data []byte) ([]Cgroup, error) { // control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes, // so the len of the returned struct is equal to the number of active hierarchies on this system func (p Proc) Cgroups() ([]Cgroup, error) { - data, err := util.ReadFileNoStat(fmt.Sprintf("/proc/%d/cgroup", p.PID)) + data, err := util.ReadFileNoStat(p.path("cgroup")) if err != nil { return nil, err } diff --git a/vendor/github.com/prometheus/procfs/proc_fdinfo.go b/vendor/github.com/prometheus/procfs/proc_fdinfo.go index a76ca707..cf63227f 100644 --- a/vendor/github.com/prometheus/procfs/proc_fdinfo.go +++ b/vendor/github.com/prometheus/procfs/proc_fdinfo.go @@ -16,7 +16,7 @@ package procfs import ( "bufio" "bytes" - "errors" + "fmt" "regexp" "github.com/prometheus/procfs/internal/util" @@ -112,7 +112,7 @@ func parseInotifyInfo(line string) (*InotifyInfo, error) { } return i, nil } - return nil, errors.New("invalid inode entry: " + line) + return nil, fmt.Errorf("invalid inode entry: %q", line) } // ProcFDInfos represents a list of ProcFDInfo structs. diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go index 91ee24df..dd20f198 100644 --- a/vendor/github.com/prometheus/procfs/proc_limits.go +++ b/vendor/github.com/prometheus/procfs/proc_limits.go @@ -26,55 +26,55 @@ import ( // http://man7.org/linux/man-pages/man2/getrlimit.2.html. type ProcLimits struct { // CPU time limit in seconds. - CPUTime int64 + CPUTime uint64 // Maximum size of files that the process may create. - FileSize int64 + FileSize uint64 // Maximum size of the process's data segment (initialized data, // uninitialized data, and heap). - DataSize int64 + DataSize uint64 // Maximum size of the process stack in bytes. - StackSize int64 + StackSize uint64 // Maximum size of a core file. - CoreFileSize int64 + CoreFileSize uint64 // Limit of the process's resident set in pages. - ResidentSet int64 + ResidentSet uint64 // Maximum number of processes that can be created for the real user ID of // the calling process. - Processes int64 + Processes uint64 // Value one greater than the maximum file descriptor number that can be // opened by this process. - OpenFiles int64 + OpenFiles uint64 // Maximum number of bytes of memory that may be locked into RAM. - LockedMemory int64 + LockedMemory uint64 // Maximum size of the process's virtual memory address space in bytes. - AddressSpace int64 + AddressSpace uint64 // Limit on the combined number of flock(2) locks and fcntl(2) leases that // this process may establish. - FileLocks int64 + FileLocks uint64 // Limit of signals that may be queued for the real user ID of the calling // process. - PendingSignals int64 + PendingSignals uint64 // Limit on the number of bytes that can be allocated for POSIX message // queues for the real user ID of the calling process. - MsqqueueSize int64 + MsqqueueSize uint64 // Limit of the nice priority set using setpriority(2) or nice(2). - NicePriority int64 + NicePriority uint64 // Limit of the real-time priority set using sched_setscheduler(2) or // sched_setparam(2). - RealtimePriority int64 + RealtimePriority uint64 // Limit (in microseconds) on the amount of CPU time that a process // scheduled under a real-time scheduling policy may consume without making // a blocking system call. - RealtimeTimeout int64 + RealtimeTimeout uint64 } const ( - limitsFields = 3 + limitsFields = 4 limitsUnlimited = "unlimited" ) var ( - limitsDelimiter = regexp.MustCompile(" +") + limitsMatch = regexp.MustCompile(`(Max \w+\s{0,1}?\w*\s{0,1}\w*)\s{2,}(\w+)\s+(\w+)`) ) // NewLimits returns the current soft limits of the process. @@ -96,46 +96,49 @@ func (p Proc) Limits() (ProcLimits, error) { l = ProcLimits{} s = bufio.NewScanner(f) ) + + s.Scan() // Skip limits header + for s.Scan() { - fields := limitsDelimiter.Split(s.Text(), limitsFields) + //fields := limitsMatch.Split(s.Text(), limitsFields) + fields := limitsMatch.FindStringSubmatch(s.Text()) if len(fields) != limitsFields { - return ProcLimits{}, fmt.Errorf( - "couldn't parse %s line %s", f.Name(), s.Text()) + return ProcLimits{}, fmt.Errorf("couldn't parse %q line %q", f.Name(), s.Text()) } - switch fields[0] { + switch fields[1] { case "Max cpu time": - l.CPUTime, err = parseInt(fields[1]) + l.CPUTime, err = parseUint(fields[2]) case "Max file size": - l.FileSize, err = parseInt(fields[1]) + l.FileSize, err = parseUint(fields[2]) case "Max data size": - l.DataSize, err = parseInt(fields[1]) + l.DataSize, err = parseUint(fields[2]) case "Max stack size": - l.StackSize, err = parseInt(fields[1]) + l.StackSize, err = parseUint(fields[2]) case "Max core file size": - l.CoreFileSize, err = parseInt(fields[1]) + l.CoreFileSize, err = parseUint(fields[2]) case "Max resident set": - l.ResidentSet, err = parseInt(fields[1]) + l.ResidentSet, err = parseUint(fields[2]) case "Max processes": - l.Processes, err = parseInt(fields[1]) + l.Processes, err = parseUint(fields[2]) case "Max open files": - l.OpenFiles, err = parseInt(fields[1]) + l.OpenFiles, err = parseUint(fields[2]) case "Max locked memory": - l.LockedMemory, err = parseInt(fields[1]) + l.LockedMemory, err = parseUint(fields[2]) case "Max address space": - l.AddressSpace, err = parseInt(fields[1]) + l.AddressSpace, err = parseUint(fields[2]) case "Max file locks": - l.FileLocks, err = parseInt(fields[1]) + l.FileLocks, err = parseUint(fields[2]) case "Max pending signals": - l.PendingSignals, err = parseInt(fields[1]) + l.PendingSignals, err = parseUint(fields[2]) case "Max msgqueue size": - l.MsqqueueSize, err = parseInt(fields[1]) + l.MsqqueueSize, err = parseUint(fields[2]) case "Max nice priority": - l.NicePriority, err = parseInt(fields[1]) + l.NicePriority, err = parseUint(fields[2]) case "Max realtime priority": - l.RealtimePriority, err = parseInt(fields[1]) + l.RealtimePriority, err = parseUint(fields[2]) case "Max realtime timeout": - l.RealtimeTimeout, err = parseInt(fields[1]) + l.RealtimeTimeout, err = parseUint(fields[2]) } if err != nil { return ProcLimits{}, err @@ -145,13 +148,13 @@ func (p Proc) Limits() (ProcLimits, error) { return l, s.Err() } -func parseInt(s string) (int64, error) { +func parseUint(s string) (uint64, error) { if s == limitsUnlimited { - return -1, nil + return 18446744073709551615, nil } - i, err := strconv.ParseInt(s, 10, 64) + i, err := strconv.ParseUint(s, 10, 64) if err != nil { - return 0, fmt.Errorf("couldn't parse value %s: %s", s, err) + return 0, fmt.Errorf("couldn't parse value %q: %w", s, err) } return i, nil } diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go index c66740ff..391b4cbd 100644 --- a/vendor/github.com/prometheus/procfs/proc_ns.go +++ b/vendor/github.com/prometheus/procfs/proc_ns.go @@ -40,7 +40,7 @@ func (p Proc) Namespaces() (Namespaces, error) { names, err := d.Readdirnames(-1) if err != nil { - return nil, fmt.Errorf("failed to read contents of ns dir: %v", err) + return nil, fmt.Errorf("failed to read contents of ns dir: %w", err) } ns := make(Namespaces, len(names)) @@ -52,13 +52,13 @@ func (p Proc) Namespaces() (Namespaces, error) { fields := strings.SplitN(target, ":", 2) if len(fields) != 2 { - return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target) + return nil, fmt.Errorf("failed to parse namespace type and inode from %q", target) } typ := fields[0] inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) if err != nil { - return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err) + return nil, fmt.Errorf("failed to parse inode from %q: %w", fields[1], err) } ns[name] = Namespace{typ, uint32(inode)} diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go index 0d7bee54..dc6c14f0 100644 --- a/vendor/github.com/prometheus/procfs/proc_psi.go +++ b/vendor/github.com/prometheus/procfs/proc_psi.go @@ -59,7 +59,7 @@ type PSIStats struct { func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { data, err := util.ReadFileNoStat(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) if err != nil { - return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource) + return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %q: %w", resource, err) } return parsePSIStats(resource, bytes.NewReader(data)) diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go index 4517d2e9..8c7b6e80 100644 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ b/vendor/github.com/prometheus/procfs/proc_stat.go @@ -100,6 +100,15 @@ type ProcStat struct { VSize uint // Resident set size in pages. RSS int + // Soft limit in bytes on the rss of the process. + RSSLimit uint64 + // Real-time scheduling priority, a number in the range 1 to 99 for processes + // scheduled under a real-time policy, or 0, for non-real-time processes. + RTPriority uint + // Scheduling policy. + Policy uint + // Aggregated block I/O delays, measured in clock ticks (centiseconds). + DelayAcctBlkIOTicks uint64 proc fs.FS } @@ -119,7 +128,8 @@ func (p Proc) Stat() (ProcStat, error) { } var ( - ignore int + ignoreInt64 int64 + ignoreUint64 uint64 s = ProcStat{PID: p.PID, proc: p.fs} l = bytes.Index(data, []byte("(")) @@ -127,10 +137,7 @@ func (p Proc) Stat() (ProcStat, error) { ) if l < 0 || r < 0 { - return ProcStat{}, fmt.Errorf( - "unexpected format, couldn't extract comm: %s", - data, - ) + return ProcStat{}, fmt.Errorf("unexpected format, couldn't extract comm %q", data) } s.Comm = string(data[l+1 : r]) @@ -154,10 +161,28 @@ func (p Proc) Stat() (ProcStat, error) { &s.Priority, &s.Nice, &s.NumThreads, - &ignore, + &ignoreInt64, &s.Starttime, &s.VSize, &s.RSS, + &s.RSSLimit, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreUint64, + &ignoreInt64, + &ignoreInt64, + &s.RTPriority, + &s.Policy, + &s.DelayAcctBlkIOTicks, ) if err != nil { return ProcStat{}, err diff --git a/vendor/github.com/prometheus/procfs/schedstat.go b/vendor/github.com/prometheus/procfs/schedstat.go index a4c4089a..28228164 100644 --- a/vendor/github.com/prometheus/procfs/schedstat.go +++ b/vendor/github.com/prometheus/procfs/schedstat.go @@ -95,24 +95,27 @@ func (fs FS) Schedstat() (*Schedstat, error) { return stats, nil } -func parseProcSchedstat(contents string) (stats ProcSchedstat, err error) { +func parseProcSchedstat(contents string) (ProcSchedstat, error) { + var ( + stats ProcSchedstat + err error + ) match := procLineRE.FindStringSubmatch(contents) if match != nil { stats.RunningNanoseconds, err = strconv.ParseUint(match[1], 10, 64) if err != nil { - return + return stats, err } stats.WaitingNanoseconds, err = strconv.ParseUint(match[2], 10, 64) if err != nil { - return + return stats, err } stats.RunTimeslices, err = strconv.ParseUint(match[3], 10, 64) - return + return stats, err } - err = errors.New("could not parse schedstat") - return + return stats, errors.New("could not parse schedstat") } diff --git a/vendor/github.com/prometheus/procfs/slab.go b/vendor/github.com/prometheus/procfs/slab.go new file mode 100644 index 00000000..7896fd72 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/slab.go @@ -0,0 +1,151 @@ +// Copyright 2020 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "bytes" + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/prometheus/procfs/internal/util" +) + +var ( + slabSpace = regexp.MustCompile(`\s+`) + slabVer = regexp.MustCompile(`slabinfo -`) + slabHeader = regexp.MustCompile(`# name`) +) + +// Slab represents a slab pool in the kernel. +type Slab struct { + Name string + ObjActive int64 + ObjNum int64 + ObjSize int64 + ObjPerSlab int64 + PagesPerSlab int64 + // tunables + Limit int64 + Batch int64 + SharedFactor int64 + SlabActive int64 + SlabNum int64 + SharedAvail int64 +} + +// SlabInfo represents info for all slabs. +type SlabInfo struct { + Slabs []*Slab +} + +func shouldParseSlab(line string) bool { + if slabVer.MatchString(line) { + return false + } + if slabHeader.MatchString(line) { + return false + } + return true +} + +// parseV21SlabEntry is used to parse a line from /proc/slabinfo version 2.1. +func parseV21SlabEntry(line string) (*Slab, error) { + // First cleanup whitespace. + l := slabSpace.ReplaceAllString(line, " ") + s := strings.Split(l, " ") + if len(s) != 16 { + return nil, fmt.Errorf("unable to parse: %q", line) + } + var err error + i := &Slab{Name: s[0]} + i.ObjActive, err = strconv.ParseInt(s[1], 10, 64) + if err != nil { + return nil, err + } + i.ObjNum, err = strconv.ParseInt(s[2], 10, 64) + if err != nil { + return nil, err + } + i.ObjSize, err = strconv.ParseInt(s[3], 10, 64) + if err != nil { + return nil, err + } + i.ObjPerSlab, err = strconv.ParseInt(s[4], 10, 64) + if err != nil { + return nil, err + } + i.PagesPerSlab, err = strconv.ParseInt(s[5], 10, 64) + if err != nil { + return nil, err + } + i.Limit, err = strconv.ParseInt(s[8], 10, 64) + if err != nil { + return nil, err + } + i.Batch, err = strconv.ParseInt(s[9], 10, 64) + if err != nil { + return nil, err + } + i.SharedFactor, err = strconv.ParseInt(s[10], 10, 64) + if err != nil { + return nil, err + } + i.SlabActive, err = strconv.ParseInt(s[13], 10, 64) + if err != nil { + return nil, err + } + i.SlabNum, err = strconv.ParseInt(s[14], 10, 64) + if err != nil { + return nil, err + } + i.SharedAvail, err = strconv.ParseInt(s[15], 10, 64) + if err != nil { + return nil, err + } + return i, nil +} + +// parseSlabInfo21 is used to parse a slabinfo 2.1 file. +func parseSlabInfo21(r *bytes.Reader) (SlabInfo, error) { + scanner := bufio.NewScanner(r) + s := SlabInfo{Slabs: []*Slab{}} + for scanner.Scan() { + line := scanner.Text() + if !shouldParseSlab(line) { + continue + } + slab, err := parseV21SlabEntry(line) + if err != nil { + return s, err + } + s.Slabs = append(s.Slabs, slab) + } + return s, nil +} + +// SlabInfo reads data from /proc/slabinfo +func (fs FS) SlabInfo() (SlabInfo, error) { + // TODO: Consider passing options to allow for parsing different + // slabinfo versions. However, slabinfo 2.1 has been stable since + // kernel 2.6.10 and later. + data, err := util.ReadFileNoStat(fs.proc.Path("slabinfo")) + if err != nil { + return SlabInfo{}, err + } + + return parseSlabInfo21(bytes.NewReader(data)) +} diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go index b2a6fc99..6d872754 100644 --- a/vendor/github.com/prometheus/procfs/stat.go +++ b/vendor/github.com/prometheus/procfs/stat.go @@ -93,10 +93,10 @@ func parseCPUStat(line string) (CPUStat, int64, error) { &cpuStat.Guest, &cpuStat.GuestNice) if err != nil && err != io.EOF { - return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): %s", line, err) + return CPUStat{}, -1, fmt.Errorf("couldn't parse %q (cpu): %w", line, err) } if count == 0 { - return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): 0 elements parsed", line) + return CPUStat{}, -1, fmt.Errorf("couldn't parse %q (cpu): 0 elements parsed", line) } cpuStat.User /= userHZ @@ -116,7 +116,7 @@ func parseCPUStat(line string) (CPUStat, int64, error) { cpuID, err := strconv.ParseInt(cpu[3:], 10, 64) if err != nil { - return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu/cpuid): %s", line, err) + return CPUStat{}, -1, fmt.Errorf("couldn't parse %q (cpu/cpuid): %w", line, err) } return cpuStat, cpuID, nil @@ -136,7 +136,7 @@ func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { &softIRQStat.Hrtimer, &softIRQStat.Rcu) if err != nil { - return SoftIRQStat{}, 0, fmt.Errorf("couldn't parse %s (softirq): %s", line, err) + return SoftIRQStat{}, 0, fmt.Errorf("couldn't parse %q (softirq): %w", line, err) } return softIRQStat, total, nil @@ -184,34 +184,34 @@ func (fs FS) Stat() (Stat, error) { switch { case parts[0] == "btime": if stat.BootTime, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (btime): %s", parts[1], err) + return Stat{}, fmt.Errorf("couldn't parse %q (btime): %w", parts[1], err) } case parts[0] == "intr": if stat.IRQTotal, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (intr): %s", parts[1], err) + return Stat{}, fmt.Errorf("couldn't parse %q (intr): %w", parts[1], err) } numberedIRQs := parts[2:] stat.IRQ = make([]uint64, len(numberedIRQs)) for i, count := range numberedIRQs { if stat.IRQ[i], err = strconv.ParseUint(count, 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (intr%d): %s", count, i, err) + return Stat{}, fmt.Errorf("couldn't parse %q (intr%d): %w", count, i, err) } } case parts[0] == "ctxt": if stat.ContextSwitches, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (ctxt): %s", parts[1], err) + return Stat{}, fmt.Errorf("couldn't parse %q (ctxt): %w", parts[1], err) } case parts[0] == "processes": if stat.ProcessCreated, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (processes): %s", parts[1], err) + return Stat{}, fmt.Errorf("couldn't parse %q (processes): %w", parts[1], err) } case parts[0] == "procs_running": if stat.ProcessesRunning, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (procs_running): %s", parts[1], err) + return Stat{}, fmt.Errorf("couldn't parse %q (procs_running): %w", parts[1], err) } case parts[0] == "procs_blocked": if stat.ProcessesBlocked, err = strconv.ParseUint(parts[1], 10, 64); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s (procs_blocked): %s", parts[1], err) + return Stat{}, fmt.Errorf("couldn't parse %q (procs_blocked): %w", parts[1], err) } case parts[0] == "softirq": softIRQStats, total, err := parseSoftIRQStat(line) @@ -237,7 +237,7 @@ func (fs FS) Stat() (Stat, error) { } if err := scanner.Err(); err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s: %s", fileName, err) + return Stat{}, fmt.Errorf("couldn't parse %q: %w", fileName, err) } return stat, nil diff --git a/vendor/github.com/prometheus/procfs/xfrm.go b/vendor/github.com/prometheus/procfs/xfrm.go index 30aa417d..eed07c7d 100644 --- a/vendor/github.com/prometheus/procfs/xfrm.go +++ b/vendor/github.com/prometheus/procfs/xfrm.go @@ -112,8 +112,7 @@ func (fs FS) NewXfrmStat() (XfrmStat, error) { fields := strings.Fields(s.Text()) if len(fields) != 2 { - return XfrmStat{}, fmt.Errorf( - "couldn't parse %s line %s", file.Name(), s.Text()) + return XfrmStat{}, fmt.Errorf("couldn't parse %q line %q", file.Name(), s.Text()) } name := fields[0] diff --git a/vendor/github.com/prometheus/procfs/zoneinfo.go b/vendor/github.com/prometheus/procfs/zoneinfo.go index e941503d..209e2ac9 100644 --- a/vendor/github.com/prometheus/procfs/zoneinfo.go +++ b/vendor/github.com/prometheus/procfs/zoneinfo.go @@ -74,11 +74,11 @@ var nodeZoneRE = regexp.MustCompile(`(\d+), zone\s+(\w+)`) func (fs FS) Zoneinfo() ([]Zoneinfo, error) { data, err := ioutil.ReadFile(fs.proc.Path("zoneinfo")) if err != nil { - return nil, fmt.Errorf("error reading zoneinfo %s: %s", fs.proc.Path("zoneinfo"), err) + return nil, fmt.Errorf("error reading zoneinfo %q: %w", fs.proc.Path("zoneinfo"), err) } zoneinfo, err := parseZoneinfo(data) if err != nil { - return nil, fmt.Errorf("error parsing zoneinfo %s: %s", fs.proc.Path("zoneinfo"), err) + return nil, fmt.Errorf("error parsing zoneinfo %q: %w", fs.proc.Path("zoneinfo"), err) } return zoneinfo, nil } @@ -99,7 +99,6 @@ func parseZoneinfo(zoneinfoData []byte) ([]Zoneinfo, error) { continue } if strings.HasPrefix(strings.TrimSpace(line), "per-node stats") { - zoneinfoElement.Zone = "" continue } parts := strings.Fields(strings.TrimSpace(line)) diff --git a/vendor/go.etcd.io/bbolt/.gitignore b/vendor/go.etcd.io/bbolt/.gitignore index 3bcd8cba..18312f00 100644 --- a/vendor/go.etcd.io/bbolt/.gitignore +++ b/vendor/go.etcd.io/bbolt/.gitignore @@ -3,3 +3,5 @@ *.swp /bin/ cover.out +/.idea +*.iml diff --git a/vendor/go.etcd.io/bbolt/.travis.yml b/vendor/go.etcd.io/bbolt/.travis.yml index 257dfdfe..452601e4 100644 --- a/vendor/go.etcd.io/bbolt/.travis.yml +++ b/vendor/go.etcd.io/bbolt/.travis.yml @@ -4,9 +4,10 @@ go_import_path: go.etcd.io/bbolt sudo: false go: -- 1.12 +- 1.15 before_install: +- go get -v golang.org/x/sys/unix - go get -v honnef.co/go/tools/... - go get -v github.com/kisielk/errcheck diff --git a/vendor/go.etcd.io/bbolt/Makefile b/vendor/go.etcd.io/bbolt/Makefile index 2968aaa6..21ecf48f 100644 --- a/vendor/go.etcd.io/bbolt/Makefile +++ b/vendor/go.etcd.io/bbolt/Makefile @@ -2,8 +2,6 @@ BRANCH=`git rev-parse --abbrev-ref HEAD` COMMIT=`git rev-parse --short HEAD` GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)" -default: build - race: @TEST_FREELIST_TYPE=hashmap go test -v -race -test.run="TestSimulate_(100op|1000op)" @echo "array freelist test" diff --git a/vendor/go.etcd.io/bbolt/README.md b/vendor/go.etcd.io/bbolt/README.md index c9e64b1a..f1b4a7b2 100644 --- a/vendor/go.etcd.io/bbolt/README.md +++ b/vendor/go.etcd.io/bbolt/README.md @@ -908,12 +908,14 @@ Below is a list of public, open source projects that use Bolt: * [BoltStore](https://github.com/yosssi/boltstore) - Session store using Bolt. * [Boltdb Boilerplate](https://github.com/bobintornado/boltdb-boilerplate) - Boilerplate wrapper around bolt aiming to make simple calls one-liners. * [BoltDbWeb](https://github.com/evnix/boltdbweb) - A web based GUI for BoltDB files. +* [BoltDB Viewer](https://github.com/zc310/rich_boltdb) - A BoltDB Viewer Can run on Windows、Linux、Android system. * [bleve](http://www.blevesearch.com/) - A pure Go search engine similar to ElasticSearch that uses Bolt as the default storage backend. * [btcwallet](https://github.com/btcsuite/btcwallet) - A bitcoin wallet. * [buckets](https://github.com/joyrexus/buckets) - a bolt wrapper streamlining simple tx and key scans. * [cayley](https://github.com/google/cayley) - Cayley is an open-source graph database using Bolt as optional backend. * [ChainStore](https://github.com/pressly/chainstore) - Simple key-value interface to a variety of storage engines organized as a chain of operations. +* [🌰 Chestnut](https://github.com/jrapoport/chestnut) - Chestnut is encrypted storage for Go. * [Consul](https://github.com/hashicorp/consul) - Consul is service discovery and configuration made easy. Distributed, highly available, and datacenter-aware. * [DVID](https://github.com/janelia-flyem/dvid) - Added Bolt as optional storage engine and testing it against Basho-tuned leveldb. * [dcrwallet](https://github.com/decred/dcrwallet) - A wallet for the Decred cryptocurrency. @@ -938,9 +940,8 @@ Below is a list of public, open source projects that use Bolt: * [MetricBase](https://github.com/msiebuhr/MetricBase) - Single-binary version of Graphite. * [MuLiFS](https://github.com/dankomiocevic/mulifs) - Music Library Filesystem creates a filesystem to organise your music files. * [NATS](https://github.com/nats-io/nats-streaming-server) - NATS Streaming uses bbolt for message and metadata storage. -* [Operation Go: A Routine Mission](http://gocode.io) - An online programming game for Golang using Bolt for user accounts and a leaderboard. -* [photosite/session](https://godoc.org/bitbucket.org/kardianos/photosite/session) - Sessions for a photo viewing site. * [Prometheus Annotation Server](https://github.com/oliver006/prom_annotation_server) - Annotation server for PromDash & Prometheus service monitoring system. +* [Rain](https://github.com/cenkalti/rain) - BitTorrent client and library. * [reef-pi](https://github.com/reef-pi/reef-pi) - reef-pi is an award winning, modular, DIY reef tank controller using easy to learn electronics based on a Raspberry Pi. * [Request Baskets](https://github.com/darklynx/request-baskets) - A web service to collect arbitrary HTTP requests and inspect them via REST API or simple web UI, similar to [RequestBin](http://requestb.in/) service * [Seaweed File System](https://github.com/chrislusf/seaweedfs) - Highly scalable distributed key~file system with O(1) disk read. diff --git a/vendor/go.etcd.io/bbolt/bolt_unix.go b/vendor/go.etcd.io/bbolt/bolt_unix.go index 2938fed5..4e5f65cc 100644 --- a/vendor/go.etcd.io/bbolt/bolt_unix.go +++ b/vendor/go.etcd.io/bbolt/bolt_unix.go @@ -7,6 +7,8 @@ import ( "syscall" "time" "unsafe" + + "golang.org/x/sys/unix" ) // flock acquires an advisory lock on a file descriptor. @@ -49,13 +51,13 @@ func funlock(db *DB) error { // mmap memory maps a DB's data file. func mmap(db *DB, sz int) error { // Map the data file to memory. - b, err := syscall.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) + b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) if err != nil { return err } // Advise the kernel that the mmap is accessed randomly. - err = madvise(b, syscall.MADV_RANDOM) + err = unix.Madvise(b, syscall.MADV_RANDOM) if err != nil && err != syscall.ENOSYS { // Ignore not implemented error in kernel because it still works. return fmt.Errorf("madvise: %s", err) @@ -76,18 +78,9 @@ func munmap(db *DB) error { } // Unmap using the original byte slice. - err := syscall.Munmap(db.dataref) + err := unix.Munmap(db.dataref) db.dataref = nil db.data = nil db.datasz = 0 return err } - -// NOTE: This function is copied from stdlib because it is not available on darwin. -func madvise(b []byte, advice int) (err error) { - _, _, e1 := syscall.Syscall(syscall.SYS_MADVISE, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), uintptr(advice)) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/go.etcd.io/bbolt/compact.go b/vendor/go.etcd.io/bbolt/compact.go new file mode 100644 index 00000000..e4fe91b0 --- /dev/null +++ b/vendor/go.etcd.io/bbolt/compact.go @@ -0,0 +1,114 @@ +package bbolt + +// Compact will create a copy of the source DB and in the destination DB. This may +// reclaim space that the source database no longer has use for. txMaxSize can be +// used to limit the transactions size of this process and may trigger intermittent +// commits. A value of zero will ignore transaction sizes. +// TODO: merge with: https://github.com/etcd-io/etcd/blob/b7f0f52a16dbf83f18ca1d803f7892d750366a94/mvcc/backend/backend.go#L349 +func Compact(dst, src *DB, txMaxSize int64) error { + // commit regularly, or we'll run out of memory for large datasets if using one transaction. + var size int64 + tx, err := dst.Begin(true) + if err != nil { + return err + } + defer tx.Rollback() + + if err := walk(src, func(keys [][]byte, k, v []byte, seq uint64) error { + // On each key/value, check if we have exceeded tx size. + sz := int64(len(k) + len(v)) + if size+sz > txMaxSize && txMaxSize != 0 { + // Commit previous transaction. + if err := tx.Commit(); err != nil { + return err + } + + // Start new transaction. + tx, err = dst.Begin(true) + if err != nil { + return err + } + size = 0 + } + size += sz + + // Create bucket on the root transaction if this is the first level. + nk := len(keys) + if nk == 0 { + bkt, err := tx.CreateBucket(k) + if err != nil { + return err + } + if err := bkt.SetSequence(seq); err != nil { + return err + } + return nil + } + + // Create buckets on subsequent levels, if necessary. + b := tx.Bucket(keys[0]) + if nk > 1 { + for _, k := range keys[1:] { + b = b.Bucket(k) + } + } + + // Fill the entire page for best compaction. + b.FillPercent = 1.0 + + // If there is no value then this is a bucket call. + if v == nil { + bkt, err := b.CreateBucket(k) + if err != nil { + return err + } + if err := bkt.SetSequence(seq); err != nil { + return err + } + return nil + } + + // Otherwise treat it as a key/value pair. + return b.Put(k, v) + }); err != nil { + return err + } + + return tx.Commit() +} + +// walkFunc is the type of the function called for keys (buckets and "normal" +// values) discovered by Walk. keys is the list of keys to descend to the bucket +// owning the discovered key/value pair k/v. +type walkFunc func(keys [][]byte, k, v []byte, seq uint64) error + +// walk walks recursively the bolt database db, calling walkFn for each key it finds. +func walk(db *DB, walkFn walkFunc) error { + return db.View(func(tx *Tx) error { + return tx.ForEach(func(name []byte, b *Bucket) error { + return walkBucket(b, nil, name, nil, b.Sequence(), walkFn) + }) + }) +} + +func walkBucket(b *Bucket, keypath [][]byte, k, v []byte, seq uint64, fn walkFunc) error { + // Execute callback. + if err := fn(keypath, k, v, seq); err != nil { + return err + } + + // If this is not a bucket then stop. + if v != nil { + return nil + } + + // Iterate over each child key/value. + keypath = append(keypath, k) + return b.ForEach(func(k, v []byte) error { + if v == nil { + bkt := b.Bucket(k) + return walkBucket(bkt, keypath, k, nil, bkt.Sequence(), fn) + } + return walkBucket(b, keypath, k, v, b.Sequence(), fn) + }) +} diff --git a/vendor/go.etcd.io/bbolt/db.go b/vendor/go.etcd.io/bbolt/db.go index 80b0095c..a798c390 100644 --- a/vendor/go.etcd.io/bbolt/db.go +++ b/vendor/go.etcd.io/bbolt/db.go @@ -120,6 +120,12 @@ type DB struct { // of truncate() and fsync() when growing the data file. AllocSize int + // Mlock locks database file in memory when set to true. + // It prevents major page faults, however used memory can't be reclaimed. + // + // Supported only on Unix via mlock/munlock syscalls. + Mlock bool + path string openFile func(string, int, os.FileMode) (*os.File, error) file *os.File @@ -188,6 +194,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) { db.MmapFlags = options.MmapFlags db.NoFreelistSync = options.NoFreelistSync db.FreelistType = options.FreelistType + db.Mlock = options.Mlock // Set default values for later DB operations. db.MaxBatchSize = DefaultMaxBatchSize @@ -337,7 +344,8 @@ func (db *DB) mmap(minsz int) error { } // Ensure the size is at least the minimum size. - var size = int(info.Size()) + fileSize := int(info.Size()) + var size = fileSize if size < minsz { size = minsz } @@ -346,6 +354,13 @@ func (db *DB) mmap(minsz int) error { return err } + if db.Mlock { + // Unlock db memory + if err := db.munlock(fileSize); err != nil { + return err + } + } + // Dereference all mmap references before unmapping. if db.rwtx != nil { db.rwtx.root.dereference() @@ -361,6 +376,13 @@ func (db *DB) mmap(minsz int) error { return err } + if db.Mlock { + // Don't allow swapping of data file + if err := db.mlock(fileSize); err != nil { + return err + } + } + // Save references to the meta pages. db.meta0 = db.page(0).meta() db.meta1 = db.page(1).meta() @@ -422,12 +444,36 @@ func (db *DB) mmapSize(size int) (int, error) { return int(sz), nil } +func (db *DB) munlock(fileSize int) error { + if err := munlock(db, fileSize); err != nil { + return fmt.Errorf("munlock error: " + err.Error()) + } + return nil +} + +func (db *DB) mlock(fileSize int) error { + if err := mlock(db, fileSize); err != nil { + return fmt.Errorf("mlock error: " + err.Error()) + } + return nil +} + +func (db *DB) mrelock(fileSizeFrom, fileSizeTo int) error { + if err := db.munlock(fileSizeFrom); err != nil { + return err + } + if err := db.mlock(fileSizeTo); err != nil { + return err + } + return nil +} + // init creates a new database file and initializes its meta pages. func (db *DB) init() error { // Create two meta pages on a buffer. buf := make([]byte, db.pageSize*4) for i := 0; i < 2; i++ { - p := db.pageInBuffer(buf[:], pgid(i)) + p := db.pageInBuffer(buf, pgid(i)) p.id = pgid(i) p.flags = metaPageFlag @@ -444,13 +490,13 @@ func (db *DB) init() error { } // Write an empty freelist at page 3. - p := db.pageInBuffer(buf[:], pgid(2)) + p := db.pageInBuffer(buf, pgid(2)) p.id = pgid(2) p.flags = freelistPageFlag p.count = 0 // Write an empty leaf page at page 4. - p = db.pageInBuffer(buf[:], pgid(3)) + p = db.pageInBuffer(buf, pgid(3)) p.id = pgid(3) p.flags = leafPageFlag p.count = 0 @@ -462,6 +508,7 @@ func (db *DB) init() error { if err := fdatasync(db); err != nil { return err } + db.filesz = len(buf) return nil } @@ -973,6 +1020,12 @@ func (db *DB) grow(sz int) error { if err := db.file.Sync(); err != nil { return fmt.Errorf("file sync error: %s", err) } + if db.Mlock { + // unlock old file and lock new one + if err := db.mrelock(db.filesz, sz); err != nil { + return fmt.Errorf("mlock/munlock error: %s", err) + } + } } db.filesz = sz @@ -1064,6 +1117,11 @@ type Options struct { // OpenFile is used to open files. It defaults to os.OpenFile. This option // is useful for writing hermetic tests. OpenFile func(string, int, os.FileMode) (*os.File, error) + + // Mlock locks database file in memory when set to true. + // It prevents potential page faults, however + // used memory can't be reclaimed. (UNIX only) + Mlock bool } // DefaultOptions represent the options used if nil options are passed into Open(). diff --git a/vendor/go.etcd.io/bbolt/freelist_hmap.go b/vendor/go.etcd.io/bbolt/freelist_hmap.go index 02ef2be0..dbd67a1e 100644 --- a/vendor/go.etcd.io/bbolt/freelist_hmap.go +++ b/vendor/go.etcd.io/bbolt/freelist_hmap.go @@ -4,7 +4,7 @@ import "sort" // hashmapFreeCount returns count of free pages(hashmap version) func (f *freelist) hashmapFreeCount() int { - // use the forwardmap to get the total count + // use the forwardMap to get the total count count := 0 for _, size := range f.forwardMap { count += int(size) @@ -41,7 +41,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid { for pid := range bm { // remove the initial - f.delSpan(pid, uint64(size)) + f.delSpan(pid, size) f.allocs[pid] = txid @@ -51,7 +51,7 @@ func (f *freelist) hashmapAllocate(txid txid, n int) pgid { f.addSpan(pid+pgid(n), remain) for i := pgid(0); i < pgid(n); i++ { - delete(f.cache, pid+pgid(i)) + delete(f.cache, pid+i) } return pid } diff --git a/vendor/go.etcd.io/bbolt/mlock_unix.go b/vendor/go.etcd.io/bbolt/mlock_unix.go new file mode 100644 index 00000000..6a6c7b35 --- /dev/null +++ b/vendor/go.etcd.io/bbolt/mlock_unix.go @@ -0,0 +1,36 @@ +// +build !windows + +package bbolt + +import "golang.org/x/sys/unix" + +// mlock locks memory of db file +func mlock(db *DB, fileSize int) error { + sizeToLock := fileSize + if sizeToLock > db.datasz { + // Can't lock more than mmaped slice + sizeToLock = db.datasz + } + if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil { + return err + } + return nil +} + +//munlock unlocks memory of db file +func munlock(db *DB, fileSize int) error { + if db.dataref == nil { + return nil + } + + sizeToUnlock := fileSize + if sizeToUnlock > db.datasz { + // Can't unlock more than mmaped slice + sizeToUnlock = db.datasz + } + + if err := unix.Munlock(db.dataref[:sizeToUnlock]); err != nil { + return err + } + return nil +} diff --git a/vendor/go.etcd.io/bbolt/mlock_windows.go b/vendor/go.etcd.io/bbolt/mlock_windows.go new file mode 100644 index 00000000..b4a36a49 --- /dev/null +++ b/vendor/go.etcd.io/bbolt/mlock_windows.go @@ -0,0 +1,11 @@ +package bbolt + +// mlock locks memory of db file +func mlock(_ *DB, _ int) error { + panic("mlock is supported only on UNIX systems") +} + +//munlock unlocks memory of db file +func munlock(_ *DB, _ int) error { + panic("munlock is supported only on UNIX systems") +} diff --git a/vendor/go.etcd.io/bbolt/tx.go b/vendor/go.etcd.io/bbolt/tx.go index 4b1a64a8..869d4120 100644 --- a/vendor/go.etcd.io/bbolt/tx.go +++ b/vendor/go.etcd.io/bbolt/tx.go @@ -188,7 +188,6 @@ func (tx *Tx) Commit() error { } // If strict mode is enabled then perform a consistency check. - // Only the first consistency error is reported in the panic. if tx.db.StrictMode { ch := tx.Check() var errs []string @@ -393,7 +392,7 @@ func (tx *Tx) CopyFile(path string, mode os.FileMode) error { return err } - err = tx.Copy(f) + _, err = tx.WriteTo(f) if err != nil { _ = f.Close() return err diff --git a/vendor/golang.org/x/crypto/ed25519/ed25519.go b/vendor/golang.org/x/crypto/ed25519/ed25519.go deleted file mode 100644 index c7f8c7e6..00000000 --- a/vendor/golang.org/x/crypto/ed25519/ed25519.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// In Go 1.13, the ed25519 package was promoted to the standard library as -// crypto/ed25519, and this package became a wrapper for the standard library one. -// -// +build !go1.13 - -// Package ed25519 implements the Ed25519 signature algorithm. See -// https://ed25519.cr.yp.to/. -// -// These functions are also compatible with the “Ed25519” function defined in -// RFC 8032. However, unlike RFC 8032's formulation, this package's private key -// representation includes a public key suffix to make multiple signing -// operations with the same key more efficient. This package refers to the RFC -// 8032 private key as the “seed”. -package ed25519 - -// This code is a port of the public domain, “ref10” implementation of ed25519 -// from SUPERCOP. - -import ( - "bytes" - "crypto" - cryptorand "crypto/rand" - "crypto/sha512" - "errors" - "io" - "strconv" - - "golang.org/x/crypto/ed25519/internal/edwards25519" -) - -const ( - // PublicKeySize is the size, in bytes, of public keys as used in this package. - PublicKeySize = 32 - // PrivateKeySize is the size, in bytes, of private keys as used in this package. - PrivateKeySize = 64 - // SignatureSize is the size, in bytes, of signatures generated and verified by this package. - SignatureSize = 64 - // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. - SeedSize = 32 -) - -// PublicKey is the type of Ed25519 public keys. -type PublicKey []byte - -// PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. -type PrivateKey []byte - -// Public returns the PublicKey corresponding to priv. -func (priv PrivateKey) Public() crypto.PublicKey { - publicKey := make([]byte, PublicKeySize) - copy(publicKey, priv[32:]) - return PublicKey(publicKey) -} - -// Seed returns the private key seed corresponding to priv. It is provided for -// interoperability with RFC 8032. RFC 8032's private keys correspond to seeds -// in this package. -func (priv PrivateKey) Seed() []byte { - seed := make([]byte, SeedSize) - copy(seed, priv[:32]) - return seed -} - -// Sign signs the given message with priv. -// Ed25519 performs two passes over messages to be signed and therefore cannot -// handle pre-hashed messages. Thus opts.HashFunc() must return zero to -// indicate the message hasn't been hashed. This can be achieved by passing -// crypto.Hash(0) as the value for opts. -func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error) { - if opts.HashFunc() != crypto.Hash(0) { - return nil, errors.New("ed25519: cannot sign hashed message") - } - - return Sign(priv, message), nil -} - -// GenerateKey generates a public/private key pair using entropy from rand. -// If rand is nil, crypto/rand.Reader will be used. -func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { - if rand == nil { - rand = cryptorand.Reader - } - - seed := make([]byte, SeedSize) - if _, err := io.ReadFull(rand, seed); err != nil { - return nil, nil, err - } - - privateKey := NewKeyFromSeed(seed) - publicKey := make([]byte, PublicKeySize) - copy(publicKey, privateKey[32:]) - - return publicKey, privateKey, nil -} - -// NewKeyFromSeed calculates a private key from a seed. It will panic if -// len(seed) is not SeedSize. This function is provided for interoperability -// with RFC 8032. RFC 8032's private keys correspond to seeds in this -// package. -func NewKeyFromSeed(seed []byte) PrivateKey { - if l := len(seed); l != SeedSize { - panic("ed25519: bad seed length: " + strconv.Itoa(l)) - } - - digest := sha512.Sum512(seed) - digest[0] &= 248 - digest[31] &= 127 - digest[31] |= 64 - - var A edwards25519.ExtendedGroupElement - var hBytes [32]byte - copy(hBytes[:], digest[:]) - edwards25519.GeScalarMultBase(&A, &hBytes) - var publicKeyBytes [32]byte - A.ToBytes(&publicKeyBytes) - - privateKey := make([]byte, PrivateKeySize) - copy(privateKey, seed) - copy(privateKey[32:], publicKeyBytes[:]) - - return privateKey -} - -// Sign signs the message with privateKey and returns a signature. It will -// panic if len(privateKey) is not PrivateKeySize. -func Sign(privateKey PrivateKey, message []byte) []byte { - if l := len(privateKey); l != PrivateKeySize { - panic("ed25519: bad private key length: " + strconv.Itoa(l)) - } - - h := sha512.New() - h.Write(privateKey[:32]) - - var digest1, messageDigest, hramDigest [64]byte - var expandedSecretKey [32]byte - h.Sum(digest1[:0]) - copy(expandedSecretKey[:], digest1[:]) - expandedSecretKey[0] &= 248 - expandedSecretKey[31] &= 63 - expandedSecretKey[31] |= 64 - - h.Reset() - h.Write(digest1[32:]) - h.Write(message) - h.Sum(messageDigest[:0]) - - var messageDigestReduced [32]byte - edwards25519.ScReduce(&messageDigestReduced, &messageDigest) - var R edwards25519.ExtendedGroupElement - edwards25519.GeScalarMultBase(&R, &messageDigestReduced) - - var encodedR [32]byte - R.ToBytes(&encodedR) - - h.Reset() - h.Write(encodedR[:]) - h.Write(privateKey[32:]) - h.Write(message) - h.Sum(hramDigest[:0]) - var hramDigestReduced [32]byte - edwards25519.ScReduce(&hramDigestReduced, &hramDigest) - - var s [32]byte - edwards25519.ScMulAdd(&s, &hramDigestReduced, &expandedSecretKey, &messageDigestReduced) - - signature := make([]byte, SignatureSize) - copy(signature[:], encodedR[:]) - copy(signature[32:], s[:]) - - return signature -} - -// Verify reports whether sig is a valid signature of message by publicKey. It -// will panic if len(publicKey) is not PublicKeySize. -func Verify(publicKey PublicKey, message, sig []byte) bool { - if l := len(publicKey); l != PublicKeySize { - panic("ed25519: bad public key length: " + strconv.Itoa(l)) - } - - if len(sig) != SignatureSize || sig[63]&224 != 0 { - return false - } - - var A edwards25519.ExtendedGroupElement - var publicKeyBytes [32]byte - copy(publicKeyBytes[:], publicKey) - if !A.FromBytes(&publicKeyBytes) { - return false - } - edwards25519.FeNeg(&A.X, &A.X) - edwards25519.FeNeg(&A.T, &A.T) - - h := sha512.New() - h.Write(sig[:32]) - h.Write(publicKey[:]) - h.Write(message) - var digest [64]byte - h.Sum(digest[:0]) - - var hReduced [32]byte - edwards25519.ScReduce(&hReduced, &digest) - - var R edwards25519.ProjectiveGroupElement - var s [32]byte - copy(s[:], sig[32:]) - - // https://tools.ietf.org/html/rfc8032#section-5.1.7 requires that s be in - // the range [0, order) in order to prevent signature malleability. - if !edwards25519.ScMinimal(&s) { - return false - } - - edwards25519.GeDoubleScalarMultVartime(&R, &hReduced, &A, &s) - - var checkR [32]byte - R.ToBytes(&checkR) - return bytes.Equal(sig[:32], checkR[:]) -} diff --git a/vendor/golang.org/x/crypto/ed25519/ed25519_go113.go b/vendor/golang.org/x/crypto/ed25519/ed25519_go113.go deleted file mode 100644 index d1448d8d..00000000 --- a/vendor/golang.org/x/crypto/ed25519/ed25519_go113.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.13 - -// Package ed25519 implements the Ed25519 signature algorithm. See -// https://ed25519.cr.yp.to/. -// -// These functions are also compatible with the “Ed25519” function defined in -// RFC 8032. However, unlike RFC 8032's formulation, this package's private key -// representation includes a public key suffix to make multiple signing -// operations with the same key more efficient. This package refers to the RFC -// 8032 private key as the “seed”. -// -// Beginning with Go 1.13, the functionality of this package was moved to the -// standard library as crypto/ed25519. This package only acts as a compatibility -// wrapper. -package ed25519 - -import ( - "crypto/ed25519" - "io" -) - -const ( - // PublicKeySize is the size, in bytes, of public keys as used in this package. - PublicKeySize = 32 - // PrivateKeySize is the size, in bytes, of private keys as used in this package. - PrivateKeySize = 64 - // SignatureSize is the size, in bytes, of signatures generated and verified by this package. - SignatureSize = 64 - // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. - SeedSize = 32 -) - -// PublicKey is the type of Ed25519 public keys. -// -// This type is an alias for crypto/ed25519's PublicKey type. -// See the crypto/ed25519 package for the methods on this type. -type PublicKey = ed25519.PublicKey - -// PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. -// -// This type is an alias for crypto/ed25519's PrivateKey type. -// See the crypto/ed25519 package for the methods on this type. -type PrivateKey = ed25519.PrivateKey - -// GenerateKey generates a public/private key pair using entropy from rand. -// If rand is nil, crypto/rand.Reader will be used. -func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { - return ed25519.GenerateKey(rand) -} - -// NewKeyFromSeed calculates a private key from a seed. It will panic if -// len(seed) is not SeedSize. This function is provided for interoperability -// with RFC 8032. RFC 8032's private keys correspond to seeds in this -// package. -func NewKeyFromSeed(seed []byte) PrivateKey { - return ed25519.NewKeyFromSeed(seed) -} - -// Sign signs the message with privateKey and returns a signature. It will -// panic if len(privateKey) is not PrivateKeySize. -func Sign(privateKey PrivateKey, message []byte) []byte { - return ed25519.Sign(privateKey, message) -} - -// Verify reports whether sig is a valid signature of message by publicKey. It -// will panic if len(publicKey) is not PublicKeySize. -func Verify(publicKey PublicKey, message, sig []byte) bool { - return ed25519.Verify(publicKey, message, sig) -} diff --git a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go b/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go deleted file mode 100644 index e39f086c..00000000 --- a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go +++ /dev/null @@ -1,1422 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package edwards25519 - -// These values are from the public domain, “ref10” implementation of ed25519 -// from SUPERCOP. - -// d is a constant in the Edwards curve equation. -var d = FieldElement{ - -10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116, -} - -// d2 is 2*d. -var d2 = FieldElement{ - -21827239, -5839606, -30745221, 13898782, 229458, 15978800, -12551817, -6495438, 29715968, 9444199, -} - -// SqrtM1 is the square-root of -1 in the field. -var SqrtM1 = FieldElement{ - -32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482, -} - -// A is a constant in the Montgomery-form of curve25519. -var A = FieldElement{ - 486662, 0, 0, 0, 0, 0, 0, 0, 0, 0, -} - -// bi contains precomputed multiples of the base-point. See the Ed25519 paper -// for a discussion about how these values are used. -var bi = [8]PreComputedGroupElement{ - { - FieldElement{25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605}, - FieldElement{-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378}, - FieldElement{-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546}, - }, - { - FieldElement{15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024}, - FieldElement{16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574}, - FieldElement{30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357}, - }, - { - FieldElement{10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380}, - FieldElement{4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306}, - FieldElement{19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942}, - }, - { - FieldElement{5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766}, - FieldElement{-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701}, - FieldElement{28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300}, - }, - { - FieldElement{-22518993, -6692182, 14201702, -8745502, -23510406, 8844726, 18474211, -1361450, -13062696, 13821877}, - FieldElement{-6455177, -7839871, 3374702, -4740862, -27098617, -10571707, 31655028, -7212327, 18853322, -14220951}, - FieldElement{4566830, -12963868, -28974889, -12240689, -7602672, -2830569, -8514358, -10431137, 2207753, -3209784}, - }, - { - FieldElement{-25154831, -4185821, 29681144, 7868801, -6854661, -9423865, -12437364, -663000, -31111463, -16132436}, - FieldElement{25576264, -2703214, 7349804, -11814844, 16472782, 9300885, 3844789, 15725684, 171356, 6466918}, - FieldElement{23103977, 13316479, 9739013, -16149481, 817875, -15038942, 8965339, -14088058, -30714912, 16193877}, - }, - { - FieldElement{-33521811, 3180713, -2394130, 14003687, -16903474, -16270840, 17238398, 4729455, -18074513, 9256800}, - FieldElement{-25182317, -4174131, 32336398, 5036987, -21236817, 11360617, 22616405, 9761698, -19827198, 630305}, - FieldElement{-13720693, 2639453, -24237460, -7406481, 9494427, -5774029, -6554551, -15960994, -2449256, -14291300}, - }, - { - FieldElement{-3151181, -5046075, 9282714, 6866145, -31907062, -863023, -18940575, 15033784, 25105118, -7894876}, - FieldElement{-24326370, 15950226, -31801215, -14592823, -11662737, -5090925, 1573892, -2625887, 2198790, -15804619}, - FieldElement{-3099351, 10324967, -2241613, 7453183, -5446979, -2735503, -13812022, -16236442, -32461234, -12290683}, - }, -} - -// base contains precomputed multiples of the base-point. See the Ed25519 paper -// for a discussion about how these values are used. -var base = [32][8]PreComputedGroupElement{ - { - { - FieldElement{25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605}, - FieldElement{-12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378}, - FieldElement{-8738181, 4489570, 9688441, -14785194, 10184609, -12363380, 29287919, 11864899, -24514362, -4438546}, - }, - { - FieldElement{-12815894, -12976347, -21581243, 11784320, -25355658, -2750717, -11717903, -3814571, -358445, -10211303}, - FieldElement{-21703237, 6903825, 27185491, 6451973, -29577724, -9554005, -15616551, 11189268, -26829678, -5319081}, - FieldElement{26966642, 11152617, 32442495, 15396054, 14353839, -12752335, -3128826, -9541118, -15472047, -4166697}, - }, - { - FieldElement{15636291, -9688557, 24204773, -7912398, 616977, -16685262, 27787600, -14772189, 28944400, -1550024}, - FieldElement{16568933, 4717097, -11556148, -1102322, 15682896, -11807043, 16354577, -11775962, 7689662, 11199574}, - FieldElement{30464156, -5976125, -11779434, -15670865, 23220365, 15915852, 7512774, 10017326, -17749093, -9920357}, - }, - { - FieldElement{-17036878, 13921892, 10945806, -6033431, 27105052, -16084379, -28926210, 15006023, 3284568, -6276540}, - FieldElement{23599295, -8306047, -11193664, -7687416, 13236774, 10506355, 7464579, 9656445, 13059162, 10374397}, - FieldElement{7798556, 16710257, 3033922, 2874086, 28997861, 2835604, 32406664, -3839045, -641708, -101325}, - }, - { - FieldElement{10861363, 11473154, 27284546, 1981175, -30064349, 12577861, 32867885, 14515107, -15438304, 10819380}, - FieldElement{4708026, 6336745, 20377586, 9066809, -11272109, 6594696, -25653668, 12483688, -12668491, 5581306}, - FieldElement{19563160, 16186464, -29386857, 4097519, 10237984, -4348115, 28542350, 13850243, -23678021, -15815942}, - }, - { - FieldElement{-15371964, -12862754, 32573250, 4720197, -26436522, 5875511, -19188627, -15224819, -9818940, -12085777}, - FieldElement{-8549212, 109983, 15149363, 2178705, 22900618, 4543417, 3044240, -15689887, 1762328, 14866737}, - FieldElement{-18199695, -15951423, -10473290, 1707278, -17185920, 3916101, -28236412, 3959421, 27914454, 4383652}, - }, - { - FieldElement{5153746, 9909285, 1723747, -2777874, 30523605, 5516873, 19480852, 5230134, -23952439, -15175766}, - FieldElement{-30269007, -3463509, 7665486, 10083793, 28475525, 1649722, 20654025, 16520125, 30598449, 7715701}, - FieldElement{28881845, 14381568, 9657904, 3680757, -20181635, 7843316, -31400660, 1370708, 29794553, -1409300}, - }, - { - FieldElement{14499471, -2729599, -33191113, -4254652, 28494862, 14271267, 30290735, 10876454, -33154098, 2381726}, - FieldElement{-7195431, -2655363, -14730155, 462251, -27724326, 3941372, -6236617, 3696005, -32300832, 15351955}, - FieldElement{27431194, 8222322, 16448760, -3907995, -18707002, 11938355, -32961401, -2970515, 29551813, 10109425}, - }, - }, - { - { - FieldElement{-13657040, -13155431, -31283750, 11777098, 21447386, 6519384, -2378284, -1627556, 10092783, -4764171}, - FieldElement{27939166, 14210322, 4677035, 16277044, -22964462, -12398139, -32508754, 12005538, -17810127, 12803510}, - FieldElement{17228999, -15661624, -1233527, 300140, -1224870, -11714777, 30364213, -9038194, 18016357, 4397660}, - }, - { - FieldElement{-10958843, -7690207, 4776341, -14954238, 27850028, -15602212, -26619106, 14544525, -17477504, 982639}, - FieldElement{29253598, 15796703, -2863982, -9908884, 10057023, 3163536, 7332899, -4120128, -21047696, 9934963}, - FieldElement{5793303, 16271923, -24131614, -10116404, 29188560, 1206517, -14747930, 4559895, -30123922, -10897950}, - }, - { - FieldElement{-27643952, -11493006, 16282657, -11036493, 28414021, -15012264, 24191034, 4541697, -13338309, 5500568}, - FieldElement{12650548, -1497113, 9052871, 11355358, -17680037, -8400164, -17430592, 12264343, 10874051, 13524335}, - FieldElement{25556948, -3045990, 714651, 2510400, 23394682, -10415330, 33119038, 5080568, -22528059, 5376628}, - }, - { - FieldElement{-26088264, -4011052, -17013699, -3537628, -6726793, 1920897, -22321305, -9447443, 4535768, 1569007}, - FieldElement{-2255422, 14606630, -21692440, -8039818, 28430649, 8775819, -30494562, 3044290, 31848280, 12543772}, - FieldElement{-22028579, 2943893, -31857513, 6777306, 13784462, -4292203, -27377195, -2062731, 7718482, 14474653}, - }, - { - FieldElement{2385315, 2454213, -22631320, 46603, -4437935, -15680415, 656965, -7236665, 24316168, -5253567}, - FieldElement{13741529, 10911568, -33233417, -8603737, -20177830, -1033297, 33040651, -13424532, -20729456, 8321686}, - FieldElement{21060490, -2212744, 15712757, -4336099, 1639040, 10656336, 23845965, -11874838, -9984458, 608372}, - }, - { - FieldElement{-13672732, -15087586, -10889693, -7557059, -6036909, 11305547, 1123968, -6780577, 27229399, 23887}, - FieldElement{-23244140, -294205, -11744728, 14712571, -29465699, -2029617, 12797024, -6440308, -1633405, 16678954}, - FieldElement{-29500620, 4770662, -16054387, 14001338, 7830047, 9564805, -1508144, -4795045, -17169265, 4904953}, - }, - { - FieldElement{24059557, 14617003, 19037157, -15039908, 19766093, -14906429, 5169211, 16191880, 2128236, -4326833}, - FieldElement{-16981152, 4124966, -8540610, -10653797, 30336522, -14105247, -29806336, 916033, -6882542, -2986532}, - FieldElement{-22630907, 12419372, -7134229, -7473371, -16478904, 16739175, 285431, 2763829, 15736322, 4143876}, - }, - { - FieldElement{2379352, 11839345, -4110402, -5988665, 11274298, 794957, 212801, -14594663, 23527084, -16458268}, - FieldElement{33431127, -11130478, -17838966, -15626900, 8909499, 8376530, -32625340, 4087881, -15188911, -14416214}, - FieldElement{1767683, 7197987, -13205226, -2022635, -13091350, 448826, 5799055, 4357868, -4774191, -16323038}, - }, - }, - { - { - FieldElement{6721966, 13833823, -23523388, -1551314, 26354293, -11863321, 23365147, -3949732, 7390890, 2759800}, - FieldElement{4409041, 2052381, 23373853, 10530217, 7676779, -12885954, 21302353, -4264057, 1244380, -12919645}, - FieldElement{-4421239, 7169619, 4982368, -2957590, 30256825, -2777540, 14086413, 9208236, 15886429, 16489664}, - }, - { - FieldElement{1996075, 10375649, 14346367, 13311202, -6874135, -16438411, -13693198, 398369, -30606455, -712933}, - FieldElement{-25307465, 9795880, -2777414, 14878809, -33531835, 14780363, 13348553, 12076947, -30836462, 5113182}, - FieldElement{-17770784, 11797796, 31950843, 13929123, -25888302, 12288344, -30341101, -7336386, 13847711, 5387222}, - }, - { - FieldElement{-18582163, -3416217, 17824843, -2340966, 22744343, -10442611, 8763061, 3617786, -19600662, 10370991}, - FieldElement{20246567, -14369378, 22358229, -543712, 18507283, -10413996, 14554437, -8746092, 32232924, 16763880}, - FieldElement{9648505, 10094563, 26416693, 14745928, -30374318, -6472621, 11094161, 15689506, 3140038, -16510092}, - }, - { - FieldElement{-16160072, 5472695, 31895588, 4744994, 8823515, 10365685, -27224800, 9448613, -28774454, 366295}, - FieldElement{19153450, 11523972, -11096490, -6503142, -24647631, 5420647, 28344573, 8041113, 719605, 11671788}, - FieldElement{8678025, 2694440, -6808014, 2517372, 4964326, 11152271, -15432916, -15266516, 27000813, -10195553}, - }, - { - FieldElement{-15157904, 7134312, 8639287, -2814877, -7235688, 10421742, 564065, 5336097, 6750977, -14521026}, - FieldElement{11836410, -3979488, 26297894, 16080799, 23455045, 15735944, 1695823, -8819122, 8169720, 16220347}, - FieldElement{-18115838, 8653647, 17578566, -6092619, -8025777, -16012763, -11144307, -2627664, -5990708, -14166033}, - }, - { - FieldElement{-23308498, -10968312, 15213228, -10081214, -30853605, -11050004, 27884329, 2847284, 2655861, 1738395}, - FieldElement{-27537433, -14253021, -25336301, -8002780, -9370762, 8129821, 21651608, -3239336, -19087449, -11005278}, - FieldElement{1533110, 3437855, 23735889, 459276, 29970501, 11335377, 26030092, 5821408, 10478196, 8544890}, - }, - { - FieldElement{32173121, -16129311, 24896207, 3921497, 22579056, -3410854, 19270449, 12217473, 17789017, -3395995}, - FieldElement{-30552961, -2228401, -15578829, -10147201, 13243889, 517024, 15479401, -3853233, 30460520, 1052596}, - FieldElement{-11614875, 13323618, 32618793, 8175907, -15230173, 12596687, 27491595, -4612359, 3179268, -9478891}, - }, - { - FieldElement{31947069, -14366651, -4640583, -15339921, -15125977, -6039709, -14756777, -16411740, 19072640, -9511060}, - FieldElement{11685058, 11822410, 3158003, -13952594, 33402194, -4165066, 5977896, -5215017, 473099, 5040608}, - FieldElement{-20290863, 8198642, -27410132, 11602123, 1290375, -2799760, 28326862, 1721092, -19558642, -3131606}, - }, - }, - { - { - FieldElement{7881532, 10687937, 7578723, 7738378, -18951012, -2553952, 21820786, 8076149, -27868496, 11538389}, - FieldElement{-19935666, 3899861, 18283497, -6801568, -15728660, -11249211, 8754525, 7446702, -5676054, 5797016}, - FieldElement{-11295600, -3793569, -15782110, -7964573, 12708869, -8456199, 2014099, -9050574, -2369172, -5877341}, - }, - { - FieldElement{-22472376, -11568741, -27682020, 1146375, 18956691, 16640559, 1192730, -3714199, 15123619, 10811505}, - FieldElement{14352098, -3419715, -18942044, 10822655, 32750596, 4699007, -70363, 15776356, -28886779, -11974553}, - FieldElement{-28241164, -8072475, -4978962, -5315317, 29416931, 1847569, -20654173, -16484855, 4714547, -9600655}, - }, - { - FieldElement{15200332, 8368572, 19679101, 15970074, -31872674, 1959451, 24611599, -4543832, -11745876, 12340220}, - FieldElement{12876937, -10480056, 33134381, 6590940, -6307776, 14872440, 9613953, 8241152, 15370987, 9608631}, - FieldElement{-4143277, -12014408, 8446281, -391603, 4407738, 13629032, -7724868, 15866074, -28210621, -8814099}, - }, - { - FieldElement{26660628, -15677655, 8393734, 358047, -7401291, 992988, -23904233, 858697, 20571223, 8420556}, - FieldElement{14620715, 13067227, -15447274, 8264467, 14106269, 15080814, 33531827, 12516406, -21574435, -12476749}, - FieldElement{236881, 10476226, 57258, -14677024, 6472998, 2466984, 17258519, 7256740, 8791136, 15069930}, - }, - { - FieldElement{1276410, -9371918, 22949635, -16322807, -23493039, -5702186, 14711875, 4874229, -30663140, -2331391}, - FieldElement{5855666, 4990204, -13711848, 7294284, -7804282, 1924647, -1423175, -7912378, -33069337, 9234253}, - FieldElement{20590503, -9018988, 31529744, -7352666, -2706834, 10650548, 31559055, -11609587, 18979186, 13396066}, - }, - { - FieldElement{24474287, 4968103, 22267082, 4407354, 24063882, -8325180, -18816887, 13594782, 33514650, 7021958}, - FieldElement{-11566906, -6565505, -21365085, 15928892, -26158305, 4315421, -25948728, -3916677, -21480480, 12868082}, - FieldElement{-28635013, 13504661, 19988037, -2132761, 21078225, 6443208, -21446107, 2244500, -12455797, -8089383}, - }, - { - FieldElement{-30595528, 13793479, -5852820, 319136, -25723172, -6263899, 33086546, 8957937, -15233648, 5540521}, - FieldElement{-11630176, -11503902, -8119500, -7643073, 2620056, 1022908, -23710744, -1568984, -16128528, -14962807}, - FieldElement{23152971, 775386, 27395463, 14006635, -9701118, 4649512, 1689819, 892185, -11513277, -15205948}, - }, - { - FieldElement{9770129, 9586738, 26496094, 4324120, 1556511, -3550024, 27453819, 4763127, -19179614, 5867134}, - FieldElement{-32765025, 1927590, 31726409, -4753295, 23962434, -16019500, 27846559, 5931263, -29749703, -16108455}, - FieldElement{27461885, -2977536, 22380810, 1815854, -23033753, -3031938, 7283490, -15148073, -19526700, 7734629}, - }, - }, - { - { - FieldElement{-8010264, -9590817, -11120403, 6196038, 29344158, -13430885, 7585295, -3176626, 18549497, 15302069}, - FieldElement{-32658337, -6171222, -7672793, -11051681, 6258878, 13504381, 10458790, -6418461, -8872242, 8424746}, - FieldElement{24687205, 8613276, -30667046, -3233545, 1863892, -1830544, 19206234, 7134917, -11284482, -828919}, - }, - { - FieldElement{11334899, -9218022, 8025293, 12707519, 17523892, -10476071, 10243738, -14685461, -5066034, 16498837}, - FieldElement{8911542, 6887158, -9584260, -6958590, 11145641, -9543680, 17303925, -14124238, 6536641, 10543906}, - FieldElement{-28946384, 15479763, -17466835, 568876, -1497683, 11223454, -2669190, -16625574, -27235709, 8876771}, - }, - { - FieldElement{-25742899, -12566864, -15649966, -846607, -33026686, -796288, -33481822, 15824474, -604426, -9039817}, - FieldElement{10330056, 70051, 7957388, -9002667, 9764902, 15609756, 27698697, -4890037, 1657394, 3084098}, - FieldElement{10477963, -7470260, 12119566, -13250805, 29016247, -5365589, 31280319, 14396151, -30233575, 15272409}, - }, - { - FieldElement{-12288309, 3169463, 28813183, 16658753, 25116432, -5630466, -25173957, -12636138, -25014757, 1950504}, - FieldElement{-26180358, 9489187, 11053416, -14746161, -31053720, 5825630, -8384306, -8767532, 15341279, 8373727}, - FieldElement{28685821, 7759505, -14378516, -12002860, -31971820, 4079242, 298136, -10232602, -2878207, 15190420}, - }, - { - FieldElement{-32932876, 13806336, -14337485, -15794431, -24004620, 10940928, 8669718, 2742393, -26033313, -6875003}, - FieldElement{-1580388, -11729417, -25979658, -11445023, -17411874, -10912854, 9291594, -16247779, -12154742, 6048605}, - FieldElement{-30305315, 14843444, 1539301, 11864366, 20201677, 1900163, 13934231, 5128323, 11213262, 9168384}, - }, - { - FieldElement{-26280513, 11007847, 19408960, -940758, -18592965, -4328580, -5088060, -11105150, 20470157, -16398701}, - FieldElement{-23136053, 9282192, 14855179, -15390078, -7362815, -14408560, -22783952, 14461608, 14042978, 5230683}, - FieldElement{29969567, -2741594, -16711867, -8552442, 9175486, -2468974, 21556951, 3506042, -5933891, -12449708}, - }, - { - FieldElement{-3144746, 8744661, 19704003, 4581278, -20430686, 6830683, -21284170, 8971513, -28539189, 15326563}, - FieldElement{-19464629, 10110288, -17262528, -3503892, -23500387, 1355669, -15523050, 15300988, -20514118, 9168260}, - FieldElement{-5353335, 4488613, -23803248, 16314347, 7780487, -15638939, -28948358, 9601605, 33087103, -9011387}, - }, - { - FieldElement{-19443170, -15512900, -20797467, -12445323, -29824447, 10229461, -27444329, -15000531, -5996870, 15664672}, - FieldElement{23294591, -16632613, -22650781, -8470978, 27844204, 11461195, 13099750, -2460356, 18151676, 13417686}, - FieldElement{-24722913, -4176517, -31150679, 5988919, -26858785, 6685065, 1661597, -12551441, 15271676, -15452665}, - }, - }, - { - { - FieldElement{11433042, -13228665, 8239631, -5279517, -1985436, -725718, -18698764, 2167544, -6921301, -13440182}, - FieldElement{-31436171, 15575146, 30436815, 12192228, -22463353, 9395379, -9917708, -8638997, 12215110, 12028277}, - FieldElement{14098400, 6555944, 23007258, 5757252, -15427832, -12950502, 30123440, 4617780, -16900089, -655628}, - }, - { - FieldElement{-4026201, -15240835, 11893168, 13718664, -14809462, 1847385, -15819999, 10154009, 23973261, -12684474}, - FieldElement{-26531820, -3695990, -1908898, 2534301, -31870557, -16550355, 18341390, -11419951, 32013174, -10103539}, - FieldElement{-25479301, 10876443, -11771086, -14625140, -12369567, 1838104, 21911214, 6354752, 4425632, -837822}, - }, - { - FieldElement{-10433389, -14612966, 22229858, -3091047, -13191166, 776729, -17415375, -12020462, 4725005, 14044970}, - FieldElement{19268650, -7304421, 1555349, 8692754, -21474059, -9910664, 6347390, -1411784, -19522291, -16109756}, - FieldElement{-24864089, 12986008, -10898878, -5558584, -11312371, -148526, 19541418, 8180106, 9282262, 10282508}, - }, - { - FieldElement{-26205082, 4428547, -8661196, -13194263, 4098402, -14165257, 15522535, 8372215, 5542595, -10702683}, - FieldElement{-10562541, 14895633, 26814552, -16673850, -17480754, -2489360, -2781891, 6993761, -18093885, 10114655}, - FieldElement{-20107055, -929418, 31422704, 10427861, -7110749, 6150669, -29091755, -11529146, 25953725, -106158}, - }, - { - FieldElement{-4234397, -8039292, -9119125, 3046000, 2101609, -12607294, 19390020, 6094296, -3315279, 12831125}, - FieldElement{-15998678, 7578152, 5310217, 14408357, -33548620, -224739, 31575954, 6326196, 7381791, -2421839}, - FieldElement{-20902779, 3296811, 24736065, -16328389, 18374254, 7318640, 6295303, 8082724, -15362489, 12339664}, - }, - { - FieldElement{27724736, 2291157, 6088201, -14184798, 1792727, 5857634, 13848414, 15768922, 25091167, 14856294}, - FieldElement{-18866652, 8331043, 24373479, 8541013, -701998, -9269457, 12927300, -12695493, -22182473, -9012899}, - FieldElement{-11423429, -5421590, 11632845, 3405020, 30536730, -11674039, -27260765, 13866390, 30146206, 9142070}, - }, - { - FieldElement{3924129, -15307516, -13817122, -10054960, 12291820, -668366, -27702774, 9326384, -8237858, 4171294}, - FieldElement{-15921940, 16037937, 6713787, 16606682, -21612135, 2790944, 26396185, 3731949, 345228, -5462949}, - FieldElement{-21327538, 13448259, 25284571, 1143661, 20614966, -8849387, 2031539, -12391231, -16253183, -13582083}, - }, - { - FieldElement{31016211, -16722429, 26371392, -14451233, -5027349, 14854137, 17477601, 3842657, 28012650, -16405420}, - FieldElement{-5075835, 9368966, -8562079, -4600902, -15249953, 6970560, -9189873, 16292057, -8867157, 3507940}, - FieldElement{29439664, 3537914, 23333589, 6997794, -17555561, -11018068, -15209202, -15051267, -9164929, 6580396}, - }, - }, - { - { - FieldElement{-12185861, -7679788, 16438269, 10826160, -8696817, -6235611, 17860444, -9273846, -2095802, 9304567}, - FieldElement{20714564, -4336911, 29088195, 7406487, 11426967, -5095705, 14792667, -14608617, 5289421, -477127}, - FieldElement{-16665533, -10650790, -6160345, -13305760, 9192020, -1802462, 17271490, 12349094, 26939669, -3752294}, - }, - { - FieldElement{-12889898, 9373458, 31595848, 16374215, 21471720, 13221525, -27283495, -12348559, -3698806, 117887}, - FieldElement{22263325, -6560050, 3984570, -11174646, -15114008, -566785, 28311253, 5358056, -23319780, 541964}, - FieldElement{16259219, 3261970, 2309254, -15534474, -16885711, -4581916, 24134070, -16705829, -13337066, -13552195}, - }, - { - FieldElement{9378160, -13140186, -22845982, -12745264, 28198281, -7244098, -2399684, -717351, 690426, 14876244}, - FieldElement{24977353, -314384, -8223969, -13465086, 28432343, -1176353, -13068804, -12297348, -22380984, 6618999}, - FieldElement{-1538174, 11685646, 12944378, 13682314, -24389511, -14413193, 8044829, -13817328, 32239829, -5652762}, - }, - { - FieldElement{-18603066, 4762990, -926250, 8885304, -28412480, -3187315, 9781647, -10350059, 32779359, 5095274}, - FieldElement{-33008130, -5214506, -32264887, -3685216, 9460461, -9327423, -24601656, 14506724, 21639561, -2630236}, - FieldElement{-16400943, -13112215, 25239338, 15531969, 3987758, -4499318, -1289502, -6863535, 17874574, 558605}, - }, - { - FieldElement{-13600129, 10240081, 9171883, 16131053, -20869254, 9599700, 33499487, 5080151, 2085892, 5119761}, - FieldElement{-22205145, -2519528, -16381601, 414691, -25019550, 2170430, 30634760, -8363614, -31999993, -5759884}, - FieldElement{-6845704, 15791202, 8550074, -1312654, 29928809, -12092256, 27534430, -7192145, -22351378, 12961482}, - }, - { - FieldElement{-24492060, -9570771, 10368194, 11582341, -23397293, -2245287, 16533930, 8206996, -30194652, -5159638}, - FieldElement{-11121496, -3382234, 2307366, 6362031, -135455, 8868177, -16835630, 7031275, 7589640, 8945490}, - FieldElement{-32152748, 8917967, 6661220, -11677616, -1192060, -15793393, 7251489, -11182180, 24099109, -14456170}, - }, - { - FieldElement{5019558, -7907470, 4244127, -14714356, -26933272, 6453165, -19118182, -13289025, -6231896, -10280736}, - FieldElement{10853594, 10721687, 26480089, 5861829, -22995819, 1972175, -1866647, -10557898, -3363451, -6441124}, - FieldElement{-17002408, 5906790, 221599, -6563147, 7828208, -13248918, 24362661, -2008168, -13866408, 7421392}, - }, - { - FieldElement{8139927, -6546497, 32257646, -5890546, 30375719, 1886181, -21175108, 15441252, 28826358, -4123029}, - FieldElement{6267086, 9695052, 7709135, -16603597, -32869068, -1886135, 14795160, -7840124, 13746021, -1742048}, - FieldElement{28584902, 7787108, -6732942, -15050729, 22846041, -7571236, -3181936, -363524, 4771362, -8419958}, - }, - }, - { - { - FieldElement{24949256, 6376279, -27466481, -8174608, -18646154, -9930606, 33543569, -12141695, 3569627, 11342593}, - FieldElement{26514989, 4740088, 27912651, 3697550, 19331575, -11472339, 6809886, 4608608, 7325975, -14801071}, - FieldElement{-11618399, -14554430, -24321212, 7655128, -1369274, 5214312, -27400540, 10258390, -17646694, -8186692}, - }, - { - FieldElement{11431204, 15823007, 26570245, 14329124, 18029990, 4796082, -31446179, 15580664, 9280358, -3973687}, - FieldElement{-160783, -10326257, -22855316, -4304997, -20861367, -13621002, -32810901, -11181622, -15545091, 4387441}, - FieldElement{-20799378, 12194512, 3937617, -5805892, -27154820, 9340370, -24513992, 8548137, 20617071, -7482001}, - }, - { - FieldElement{-938825, -3930586, -8714311, 16124718, 24603125, -6225393, -13775352, -11875822, 24345683, 10325460}, - FieldElement{-19855277, -1568885, -22202708, 8714034, 14007766, 6928528, 16318175, -1010689, 4766743, 3552007}, - FieldElement{-21751364, -16730916, 1351763, -803421, -4009670, 3950935, 3217514, 14481909, 10988822, -3994762}, - }, - { - FieldElement{15564307, -14311570, 3101243, 5684148, 30446780, -8051356, 12677127, -6505343, -8295852, 13296005}, - FieldElement{-9442290, 6624296, -30298964, -11913677, -4670981, -2057379, 31521204, 9614054, -30000824, 12074674}, - FieldElement{4771191, -135239, 14290749, -13089852, 27992298, 14998318, -1413936, -1556716, 29832613, -16391035}, - }, - { - FieldElement{7064884, -7541174, -19161962, -5067537, -18891269, -2912736, 25825242, 5293297, -27122660, 13101590}, - FieldElement{-2298563, 2439670, -7466610, 1719965, -27267541, -16328445, 32512469, -5317593, -30356070, -4190957}, - FieldElement{-30006540, 10162316, -33180176, 3981723, -16482138, -13070044, 14413974, 9515896, 19568978, 9628812}, - }, - { - FieldElement{33053803, 199357, 15894591, 1583059, 27380243, -4580435, -17838894, -6106839, -6291786, 3437740}, - FieldElement{-18978877, 3884493, 19469877, 12726490, 15913552, 13614290, -22961733, 70104, 7463304, 4176122}, - FieldElement{-27124001, 10659917, 11482427, -16070381, 12771467, -6635117, -32719404, -5322751, 24216882, 5944158}, - }, - { - FieldElement{8894125, 7450974, -2664149, -9765752, -28080517, -12389115, 19345746, 14680796, 11632993, 5847885}, - FieldElement{26942781, -2315317, 9129564, -4906607, 26024105, 11769399, -11518837, 6367194, -9727230, 4782140}, - FieldElement{19916461, -4828410, -22910704, -11414391, 25606324, -5972441, 33253853, 8220911, 6358847, -1873857}, - }, - { - FieldElement{801428, -2081702, 16569428, 11065167, 29875704, 96627, 7908388, -4480480, -13538503, 1387155}, - FieldElement{19646058, 5720633, -11416706, 12814209, 11607948, 12749789, 14147075, 15156355, -21866831, 11835260}, - FieldElement{19299512, 1155910, 28703737, 14890794, 2925026, 7269399, 26121523, 15467869, -26560550, 5052483}, - }, - }, - { - { - FieldElement{-3017432, 10058206, 1980837, 3964243, 22160966, 12322533, -6431123, -12618185, 12228557, -7003677}, - FieldElement{32944382, 14922211, -22844894, 5188528, 21913450, -8719943, 4001465, 13238564, -6114803, 8653815}, - FieldElement{22865569, -4652735, 27603668, -12545395, 14348958, 8234005, 24808405, 5719875, 28483275, 2841751}, - }, - { - FieldElement{-16420968, -1113305, -327719, -12107856, 21886282, -15552774, -1887966, -315658, 19932058, -12739203}, - FieldElement{-11656086, 10087521, -8864888, -5536143, -19278573, -3055912, 3999228, 13239134, -4777469, -13910208}, - FieldElement{1382174, -11694719, 17266790, 9194690, -13324356, 9720081, 20403944, 11284705, -14013818, 3093230}, - }, - { - FieldElement{16650921, -11037932, -1064178, 1570629, -8329746, 7352753, -302424, 16271225, -24049421, -6691850}, - FieldElement{-21911077, -5927941, -4611316, -5560156, -31744103, -10785293, 24123614, 15193618, -21652117, -16739389}, - FieldElement{-9935934, -4289447, -25279823, 4372842, 2087473, 10399484, 31870908, 14690798, 17361620, 11864968}, - }, - { - FieldElement{-11307610, 6210372, 13206574, 5806320, -29017692, -13967200, -12331205, -7486601, -25578460, -16240689}, - FieldElement{14668462, -12270235, 26039039, 15305210, 25515617, 4542480, 10453892, 6577524, 9145645, -6443880}, - FieldElement{5974874, 3053895, -9433049, -10385191, -31865124, 3225009, -7972642, 3936128, -5652273, -3050304}, - }, - { - FieldElement{30625386, -4729400, -25555961, -12792866, -20484575, 7695099, 17097188, -16303496, -27999779, 1803632}, - FieldElement{-3553091, 9865099, -5228566, 4272701, -5673832, -16689700, 14911344, 12196514, -21405489, 7047412}, - FieldElement{20093277, 9920966, -11138194, -5343857, 13161587, 12044805, -32856851, 4124601, -32343828, -10257566}, - }, - { - FieldElement{-20788824, 14084654, -13531713, 7842147, 19119038, -13822605, 4752377, -8714640, -21679658, 2288038}, - FieldElement{-26819236, -3283715, 29965059, 3039786, -14473765, 2540457, 29457502, 14625692, -24819617, 12570232}, - FieldElement{-1063558, -11551823, 16920318, 12494842, 1278292, -5869109, -21159943, -3498680, -11974704, 4724943}, - }, - { - FieldElement{17960970, -11775534, -4140968, -9702530, -8876562, -1410617, -12907383, -8659932, -29576300, 1903856}, - FieldElement{23134274, -14279132, -10681997, -1611936, 20684485, 15770816, -12989750, 3190296, 26955097, 14109738}, - FieldElement{15308788, 5320727, -30113809, -14318877, 22902008, 7767164, 29425325, -11277562, 31960942, 11934971}, - }, - { - FieldElement{-27395711, 8435796, 4109644, 12222639, -24627868, 14818669, 20638173, 4875028, 10491392, 1379718}, - FieldElement{-13159415, 9197841, 3875503, -8936108, -1383712, -5879801, 33518459, 16176658, 21432314, 12180697}, - FieldElement{-11787308, 11500838, 13787581, -13832590, -22430679, 10140205, 1465425, 12689540, -10301319, -13872883}, - }, - }, - { - { - FieldElement{5414091, -15386041, -21007664, 9643570, 12834970, 1186149, -2622916, -1342231, 26128231, 6032912}, - FieldElement{-26337395, -13766162, 32496025, -13653919, 17847801, -12669156, 3604025, 8316894, -25875034, -10437358}, - FieldElement{3296484, 6223048, 24680646, -12246460, -23052020, 5903205, -8862297, -4639164, 12376617, 3188849}, - }, - { - FieldElement{29190488, -14659046, 27549113, -1183516, 3520066, -10697301, 32049515, -7309113, -16109234, -9852307}, - FieldElement{-14744486, -9309156, 735818, -598978, -20407687, -5057904, 25246078, -15795669, 18640741, -960977}, - FieldElement{-6928835, -16430795, 10361374, 5642961, 4910474, 12345252, -31638386, -494430, 10530747, 1053335}, - }, - { - FieldElement{-29265967, -14186805, -13538216, -12117373, -19457059, -10655384, -31462369, -2948985, 24018831, 15026644}, - FieldElement{-22592535, -3145277, -2289276, 5953843, -13440189, 9425631, 25310643, 13003497, -2314791, -15145616}, - FieldElement{-27419985, -603321, -8043984, -1669117, -26092265, 13987819, -27297622, 187899, -23166419, -2531735}, - }, - { - FieldElement{-21744398, -13810475, 1844840, 5021428, -10434399, -15911473, 9716667, 16266922, -5070217, 726099}, - FieldElement{29370922, -6053998, 7334071, -15342259, 9385287, 2247707, -13661962, -4839461, 30007388, -15823341}, - FieldElement{-936379, 16086691, 23751945, -543318, -1167538, -5189036, 9137109, 730663, 9835848, 4555336}, - }, - { - FieldElement{-23376435, 1410446, -22253753, -12899614, 30867635, 15826977, 17693930, 544696, -11985298, 12422646}, - FieldElement{31117226, -12215734, -13502838, 6561947, -9876867, -12757670, -5118685, -4096706, 29120153, 13924425}, - FieldElement{-17400879, -14233209, 19675799, -2734756, -11006962, -5858820, -9383939, -11317700, 7240931, -237388}, - }, - { - FieldElement{-31361739, -11346780, -15007447, -5856218, -22453340, -12152771, 1222336, 4389483, 3293637, -15551743}, - FieldElement{-16684801, -14444245, 11038544, 11054958, -13801175, -3338533, -24319580, 7733547, 12796905, -6335822}, - FieldElement{-8759414, -10817836, -25418864, 10783769, -30615557, -9746811, -28253339, 3647836, 3222231, -11160462}, - }, - { - FieldElement{18606113, 1693100, -25448386, -15170272, 4112353, 10045021, 23603893, -2048234, -7550776, 2484985}, - FieldElement{9255317, -3131197, -12156162, -1004256, 13098013, -9214866, 16377220, -2102812, -19802075, -3034702}, - FieldElement{-22729289, 7496160, -5742199, 11329249, 19991973, -3347502, -31718148, 9936966, -30097688, -10618797}, - }, - { - FieldElement{21878590, -5001297, 4338336, 13643897, -3036865, 13160960, 19708896, 5415497, -7360503, -4109293}, - FieldElement{27736861, 10103576, 12500508, 8502413, -3413016, -9633558, 10436918, -1550276, -23659143, -8132100}, - FieldElement{19492550, -12104365, -29681976, -852630, -3208171, 12403437, 30066266, 8367329, 13243957, 8709688}, - }, - }, - { - { - FieldElement{12015105, 2801261, 28198131, 10151021, 24818120, -4743133, -11194191, -5645734, 5150968, 7274186}, - FieldElement{2831366, -12492146, 1478975, 6122054, 23825128, -12733586, 31097299, 6083058, 31021603, -9793610}, - FieldElement{-2529932, -2229646, 445613, 10720828, -13849527, -11505937, -23507731, 16354465, 15067285, -14147707}, - }, - { - FieldElement{7840942, 14037873, -33364863, 15934016, -728213, -3642706, 21403988, 1057586, -19379462, -12403220}, - FieldElement{915865, -16469274, 15608285, -8789130, -24357026, 6060030, -17371319, 8410997, -7220461, 16527025}, - FieldElement{32922597, -556987, 20336074, -16184568, 10903705, -5384487, 16957574, 52992, 23834301, 6588044}, - }, - { - FieldElement{32752030, 11232950, 3381995, -8714866, 22652988, -10744103, 17159699, 16689107, -20314580, -1305992}, - FieldElement{-4689649, 9166776, -25710296, -10847306, 11576752, 12733943, 7924251, -2752281, 1976123, -7249027}, - FieldElement{21251222, 16309901, -2983015, -6783122, 30810597, 12967303, 156041, -3371252, 12331345, -8237197}, - }, - { - FieldElement{8651614, -4477032, -16085636, -4996994, 13002507, 2950805, 29054427, -5106970, 10008136, -4667901}, - FieldElement{31486080, 15114593, -14261250, 12951354, 14369431, -7387845, 16347321, -13662089, 8684155, -10532952}, - FieldElement{19443825, 11385320, 24468943, -9659068, -23919258, 2187569, -26263207, -6086921, 31316348, 14219878}, - }, - { - FieldElement{-28594490, 1193785, 32245219, 11392485, 31092169, 15722801, 27146014, 6992409, 29126555, 9207390}, - FieldElement{32382935, 1110093, 18477781, 11028262, -27411763, -7548111, -4980517, 10843782, -7957600, -14435730}, - FieldElement{2814918, 7836403, 27519878, -7868156, -20894015, -11553689, -21494559, 8550130, 28346258, 1994730}, - }, - { - FieldElement{-19578299, 8085545, -14000519, -3948622, 2785838, -16231307, -19516951, 7174894, 22628102, 8115180}, - FieldElement{-30405132, 955511, -11133838, -15078069, -32447087, -13278079, -25651578, 3317160, -9943017, 930272}, - FieldElement{-15303681, -6833769, 28856490, 1357446, 23421993, 1057177, 24091212, -1388970, -22765376, -10650715}, - }, - { - FieldElement{-22751231, -5303997, -12907607, -12768866, -15811511, -7797053, -14839018, -16554220, -1867018, 8398970}, - FieldElement{-31969310, 2106403, -4736360, 1362501, 12813763, 16200670, 22981545, -6291273, 18009408, -15772772}, - FieldElement{-17220923, -9545221, -27784654, 14166835, 29815394, 7444469, 29551787, -3727419, 19288549, 1325865}, - }, - { - FieldElement{15100157, -15835752, -23923978, -1005098, -26450192, 15509408, 12376730, -3479146, 33166107, -8042750}, - FieldElement{20909231, 13023121, -9209752, 16251778, -5778415, -8094914, 12412151, 10018715, 2213263, -13878373}, - FieldElement{32529814, -11074689, 30361439, -16689753, -9135940, 1513226, 22922121, 6382134, -5766928, 8371348}, - }, - }, - { - { - FieldElement{9923462, 11271500, 12616794, 3544722, -29998368, -1721626, 12891687, -8193132, -26442943, 10486144}, - FieldElement{-22597207, -7012665, 8587003, -8257861, 4084309, -12970062, 361726, 2610596, -23921530, -11455195}, - FieldElement{5408411, -1136691, -4969122, 10561668, 24145918, 14240566, 31319731, -4235541, 19985175, -3436086}, - }, - { - FieldElement{-13994457, 16616821, 14549246, 3341099, 32155958, 13648976, -17577068, 8849297, 65030, 8370684}, - FieldElement{-8320926, -12049626, 31204563, 5839400, -20627288, -1057277, -19442942, 6922164, 12743482, -9800518}, - FieldElement{-2361371, 12678785, 28815050, 4759974, -23893047, 4884717, 23783145, 11038569, 18800704, 255233}, - }, - { - FieldElement{-5269658, -1773886, 13957886, 7990715, 23132995, 728773, 13393847, 9066957, 19258688, -14753793}, - FieldElement{-2936654, -10827535, -10432089, 14516793, -3640786, 4372541, -31934921, 2209390, -1524053, 2055794}, - FieldElement{580882, 16705327, 5468415, -2683018, -30926419, -14696000, -7203346, -8994389, -30021019, 7394435}, - }, - { - FieldElement{23838809, 1822728, -15738443, 15242727, 8318092, -3733104, -21672180, -3492205, -4821741, 14799921}, - FieldElement{13345610, 9759151, 3371034, -16137791, 16353039, 8577942, 31129804, 13496856, -9056018, 7402518}, - FieldElement{2286874, -4435931, -20042458, -2008336, -13696227, 5038122, 11006906, -15760352, 8205061, 1607563}, - }, - { - FieldElement{14414086, -8002132, 3331830, -3208217, 22249151, -5594188, 18364661, -2906958, 30019587, -9029278}, - FieldElement{-27688051, 1585953, -10775053, 931069, -29120221, -11002319, -14410829, 12029093, 9944378, 8024}, - FieldElement{4368715, -3709630, 29874200, -15022983, -20230386, -11410704, -16114594, -999085, -8142388, 5640030}, - }, - { - FieldElement{10299610, 13746483, 11661824, 16234854, 7630238, 5998374, 9809887, -16694564, 15219798, -14327783}, - FieldElement{27425505, -5719081, 3055006, 10660664, 23458024, 595578, -15398605, -1173195, -18342183, 9742717}, - FieldElement{6744077, 2427284, 26042789, 2720740, -847906, 1118974, 32324614, 7406442, 12420155, 1994844}, - }, - { - FieldElement{14012521, -5024720, -18384453, -9578469, -26485342, -3936439, -13033478, -10909803, 24319929, -6446333}, - FieldElement{16412690, -4507367, 10772641, 15929391, -17068788, -4658621, 10555945, -10484049, -30102368, -4739048}, - FieldElement{22397382, -7767684, -9293161, -12792868, 17166287, -9755136, -27333065, 6199366, 21880021, -12250760}, - }, - { - FieldElement{-4283307, 5368523, -31117018, 8163389, -30323063, 3209128, 16557151, 8890729, 8840445, 4957760}, - FieldElement{-15447727, 709327, -6919446, -10870178, -29777922, 6522332, -21720181, 12130072, -14796503, 5005757}, - FieldElement{-2114751, -14308128, 23019042, 15765735, -25269683, 6002752, 10183197, -13239326, -16395286, -2176112}, - }, - }, - { - { - FieldElement{-19025756, 1632005, 13466291, -7995100, -23640451, 16573537, -32013908, -3057104, 22208662, 2000468}, - FieldElement{3065073, -1412761, -25598674, -361432, -17683065, -5703415, -8164212, 11248527, -3691214, -7414184}, - FieldElement{10379208, -6045554, 8877319, 1473647, -29291284, -12507580, 16690915, 2553332, -3132688, 16400289}, - }, - { - FieldElement{15716668, 1254266, -18472690, 7446274, -8448918, 6344164, -22097271, -7285580, 26894937, 9132066}, - FieldElement{24158887, 12938817, 11085297, -8177598, -28063478, -4457083, -30576463, 64452, -6817084, -2692882}, - FieldElement{13488534, 7794716, 22236231, 5989356, 25426474, -12578208, 2350710, -3418511, -4688006, 2364226}, - }, - { - FieldElement{16335052, 9132434, 25640582, 6678888, 1725628, 8517937, -11807024, -11697457, 15445875, -7798101}, - FieldElement{29004207, -7867081, 28661402, -640412, -12794003, -7943086, 31863255, -4135540, -278050, -15759279}, - FieldElement{-6122061, -14866665, -28614905, 14569919, -10857999, -3591829, 10343412, -6976290, -29828287, -10815811}, - }, - { - FieldElement{27081650, 3463984, 14099042, -4517604, 1616303, -6205604, 29542636, 15372179, 17293797, 960709}, - FieldElement{20263915, 11434237, -5765435, 11236810, 13505955, -10857102, -16111345, 6493122, -19384511, 7639714}, - FieldElement{-2830798, -14839232, 25403038, -8215196, -8317012, -16173699, 18006287, -16043750, 29994677, -15808121}, - }, - { - FieldElement{9769828, 5202651, -24157398, -13631392, -28051003, -11561624, -24613141, -13860782, -31184575, 709464}, - FieldElement{12286395, 13076066, -21775189, -1176622, -25003198, 4057652, -32018128, -8890874, 16102007, 13205847}, - FieldElement{13733362, 5599946, 10557076, 3195751, -5557991, 8536970, -25540170, 8525972, 10151379, 10394400}, - }, - { - FieldElement{4024660, -16137551, 22436262, 12276534, -9099015, -2686099, 19698229, 11743039, -33302334, 8934414}, - FieldElement{-15879800, -4525240, -8580747, -2934061, 14634845, -698278, -9449077, 3137094, -11536886, 11721158}, - FieldElement{17555939, -5013938, 8268606, 2331751, -22738815, 9761013, 9319229, 8835153, -9205489, -1280045}, - }, - { - FieldElement{-461409, -7830014, 20614118, 16688288, -7514766, -4807119, 22300304, 505429, 6108462, -6183415}, - FieldElement{-5070281, 12367917, -30663534, 3234473, 32617080, -8422642, 29880583, -13483331, -26898490, -7867459}, - FieldElement{-31975283, 5726539, 26934134, 10237677, -3173717, -605053, 24199304, 3795095, 7592688, -14992079}, - }, - { - FieldElement{21594432, -14964228, 17466408, -4077222, 32537084, 2739898, 6407723, 12018833, -28256052, 4298412}, - FieldElement{-20650503, -11961496, -27236275, 570498, 3767144, -1717540, 13891942, -1569194, 13717174, 10805743}, - FieldElement{-14676630, -15644296, 15287174, 11927123, 24177847, -8175568, -796431, 14860609, -26938930, -5863836}, - }, - }, - { - { - FieldElement{12962541, 5311799, -10060768, 11658280, 18855286, -7954201, 13286263, -12808704, -4381056, 9882022}, - FieldElement{18512079, 11319350, -20123124, 15090309, 18818594, 5271736, -22727904, 3666879, -23967430, -3299429}, - FieldElement{-6789020, -3146043, 16192429, 13241070, 15898607, -14206114, -10084880, -6661110, -2403099, 5276065}, - }, - { - FieldElement{30169808, -5317648, 26306206, -11750859, 27814964, 7069267, 7152851, 3684982, 1449224, 13082861}, - FieldElement{10342826, 3098505, 2119311, 193222, 25702612, 12233820, 23697382, 15056736, -21016438, -8202000}, - FieldElement{-33150110, 3261608, 22745853, 7948688, 19370557, -15177665, -26171976, 6482814, -10300080, -11060101}, - }, - { - FieldElement{32869458, -5408545, 25609743, 15678670, -10687769, -15471071, 26112421, 2521008, -22664288, 6904815}, - FieldElement{29506923, 4457497, 3377935, -9796444, -30510046, 12935080, 1561737, 3841096, -29003639, -6657642}, - FieldElement{10340844, -6630377, -18656632, -2278430, 12621151, -13339055, 30878497, -11824370, -25584551, 5181966}, - }, - { - FieldElement{25940115, -12658025, 17324188, -10307374, -8671468, 15029094, 24396252, -16450922, -2322852, -12388574}, - FieldElement{-21765684, 9916823, -1300409, 4079498, -1028346, 11909559, 1782390, 12641087, 20603771, -6561742}, - FieldElement{-18882287, -11673380, 24849422, 11501709, 13161720, -4768874, 1925523, 11914390, 4662781, 7820689}, - }, - { - FieldElement{12241050, -425982, 8132691, 9393934, 32846760, -1599620, 29749456, 12172924, 16136752, 15264020}, - FieldElement{-10349955, -14680563, -8211979, 2330220, -17662549, -14545780, 10658213, 6671822, 19012087, 3772772}, - FieldElement{3753511, -3421066, 10617074, 2028709, 14841030, -6721664, 28718732, -15762884, 20527771, 12988982}, - }, - { - FieldElement{-14822485, -5797269, -3707987, 12689773, -898983, -10914866, -24183046, -10564943, 3299665, -12424953}, - FieldElement{-16777703, -15253301, -9642417, 4978983, 3308785, 8755439, 6943197, 6461331, -25583147, 8991218}, - FieldElement{-17226263, 1816362, -1673288, -6086439, 31783888, -8175991, -32948145, 7417950, -30242287, 1507265}, - }, - { - FieldElement{29692663, 6829891, -10498800, 4334896, 20945975, -11906496, -28887608, 8209391, 14606362, -10647073}, - FieldElement{-3481570, 8707081, 32188102, 5672294, 22096700, 1711240, -33020695, 9761487, 4170404, -2085325}, - FieldElement{-11587470, 14855945, -4127778, -1531857, -26649089, 15084046, 22186522, 16002000, -14276837, -8400798}, - }, - { - FieldElement{-4811456, 13761029, -31703877, -2483919, -3312471, 7869047, -7113572, -9620092, 13240845, 10965870}, - FieldElement{-7742563, -8256762, -14768334, -13656260, -23232383, 12387166, 4498947, 14147411, 29514390, 4302863}, - FieldElement{-13413405, -12407859, 20757302, -13801832, 14785143, 8976368, -5061276, -2144373, 17846988, -13971927}, - }, - }, - { - { - FieldElement{-2244452, -754728, -4597030, -1066309, -6247172, 1455299, -21647728, -9214789, -5222701, 12650267}, - FieldElement{-9906797, -16070310, 21134160, 12198166, -27064575, 708126, 387813, 13770293, -19134326, 10958663}, - FieldElement{22470984, 12369526, 23446014, -5441109, -21520802, -9698723, -11772496, -11574455, -25083830, 4271862}, - }, - { - FieldElement{-25169565, -10053642, -19909332, 15361595, -5984358, 2159192, 75375, -4278529, -32526221, 8469673}, - FieldElement{15854970, 4148314, -8893890, 7259002, 11666551, 13824734, -30531198, 2697372, 24154791, -9460943}, - FieldElement{15446137, -15806644, 29759747, 14019369, 30811221, -9610191, -31582008, 12840104, 24913809, 9815020}, - }, - { - FieldElement{-4709286, -5614269, -31841498, -12288893, -14443537, 10799414, -9103676, 13438769, 18735128, 9466238}, - FieldElement{11933045, 9281483, 5081055, -5183824, -2628162, -4905629, -7727821, -10896103, -22728655, 16199064}, - FieldElement{14576810, 379472, -26786533, -8317236, -29426508, -10812974, -102766, 1876699, 30801119, 2164795}, - }, - { - FieldElement{15995086, 3199873, 13672555, 13712240, -19378835, -4647646, -13081610, -15496269, -13492807, 1268052}, - FieldElement{-10290614, -3659039, -3286592, 10948818, 23037027, 3794475, -3470338, -12600221, -17055369, 3565904}, - FieldElement{29210088, -9419337, -5919792, -4952785, 10834811, -13327726, -16512102, -10820713, -27162222, -14030531}, - }, - { - FieldElement{-13161890, 15508588, 16663704, -8156150, -28349942, 9019123, -29183421, -3769423, 2244111, -14001979}, - FieldElement{-5152875, -3800936, -9306475, -6071583, 16243069, 14684434, -25673088, -16180800, 13491506, 4641841}, - FieldElement{10813417, 643330, -19188515, -728916, 30292062, -16600078, 27548447, -7721242, 14476989, -12767431}, - }, - { - FieldElement{10292079, 9984945, 6481436, 8279905, -7251514, 7032743, 27282937, -1644259, -27912810, 12651324}, - FieldElement{-31185513, -813383, 22271204, 11835308, 10201545, 15351028, 17099662, 3988035, 21721536, -3148940}, - FieldElement{10202177, -6545839, -31373232, -9574638, -32150642, -8119683, -12906320, 3852694, 13216206, 14842320}, - }, - { - FieldElement{-15815640, -10601066, -6538952, -7258995, -6984659, -6581778, -31500847, 13765824, -27434397, 9900184}, - FieldElement{14465505, -13833331, -32133984, -14738873, -27443187, 12990492, 33046193, 15796406, -7051866, -8040114}, - FieldElement{30924417, -8279620, 6359016, -12816335, 16508377, 9071735, -25488601, 15413635, 9524356, -7018878}, - }, - { - FieldElement{12274201, -13175547, 32627641, -1785326, 6736625, 13267305, 5237659, -5109483, 15663516, 4035784}, - FieldElement{-2951309, 8903985, 17349946, 601635, -16432815, -4612556, -13732739, -15889334, -22258478, 4659091}, - FieldElement{-16916263, -4952973, -30393711, -15158821, 20774812, 15897498, 5736189, 15026997, -2178256, -13455585}, - }, - }, - { - { - FieldElement{-8858980, -2219056, 28571666, -10155518, -474467, -10105698, -3801496, 278095, 23440562, -290208}, - FieldElement{10226241, -5928702, 15139956, 120818, -14867693, 5218603, 32937275, 11551483, -16571960, -7442864}, - FieldElement{17932739, -12437276, -24039557, 10749060, 11316803, 7535897, 22503767, 5561594, -3646624, 3898661}, - }, - { - FieldElement{7749907, -969567, -16339731, -16464, -25018111, 15122143, -1573531, 7152530, 21831162, 1245233}, - FieldElement{26958459, -14658026, 4314586, 8346991, -5677764, 11960072, -32589295, -620035, -30402091, -16716212}, - FieldElement{-12165896, 9166947, 33491384, 13673479, 29787085, 13096535, 6280834, 14587357, -22338025, 13987525}, - }, - { - FieldElement{-24349909, 7778775, 21116000, 15572597, -4833266, -5357778, -4300898, -5124639, -7469781, -2858068}, - FieldElement{9681908, -6737123, -31951644, 13591838, -6883821, 386950, 31622781, 6439245, -14581012, 4091397}, - FieldElement{-8426427, 1470727, -28109679, -1596990, 3978627, -5123623, -19622683, 12092163, 29077877, -14741988}, - }, - { - FieldElement{5269168, -6859726, -13230211, -8020715, 25932563, 1763552, -5606110, -5505881, -20017847, 2357889}, - FieldElement{32264008, -15407652, -5387735, -1160093, -2091322, -3946900, 23104804, -12869908, 5727338, 189038}, - FieldElement{14609123, -8954470, -6000566, -16622781, -14577387, -7743898, -26745169, 10942115, -25888931, -14884697}, - }, - { - FieldElement{20513500, 5557931, -15604613, 7829531, 26413943, -2019404, -21378968, 7471781, 13913677, -5137875}, - FieldElement{-25574376, 11967826, 29233242, 12948236, -6754465, 4713227, -8940970, 14059180, 12878652, 8511905}, - FieldElement{-25656801, 3393631, -2955415, -7075526, -2250709, 9366908, -30223418, 6812974, 5568676, -3127656}, - }, - { - FieldElement{11630004, 12144454, 2116339, 13606037, 27378885, 15676917, -17408753, -13504373, -14395196, 8070818}, - FieldElement{27117696, -10007378, -31282771, -5570088, 1127282, 12772488, -29845906, 10483306, -11552749, -1028714}, - FieldElement{10637467, -5688064, 5674781, 1072708, -26343588, -6982302, -1683975, 9177853, -27493162, 15431203}, - }, - { - FieldElement{20525145, 10892566, -12742472, 12779443, -29493034, 16150075, -28240519, 14943142, -15056790, -7935931}, - FieldElement{-30024462, 5626926, -551567, -9981087, 753598, 11981191, 25244767, -3239766, -3356550, 9594024}, - FieldElement{-23752644, 2636870, -5163910, -10103818, 585134, 7877383, 11345683, -6492290, 13352335, -10977084}, - }, - { - FieldElement{-1931799, -5407458, 3304649, -12884869, 17015806, -4877091, -29783850, -7752482, -13215537, -319204}, - FieldElement{20239939, 6607058, 6203985, 3483793, -18386976, -779229, -20723742, 15077870, -22750759, 14523817}, - FieldElement{27406042, -6041657, 27423596, -4497394, 4996214, 10002360, -28842031, -4545494, -30172742, -4805667}, - }, - }, - { - { - FieldElement{11374242, 12660715, 17861383, -12540833, 10935568, 1099227, -13886076, -9091740, -27727044, 11358504}, - FieldElement{-12730809, 10311867, 1510375, 10778093, -2119455, -9145702, 32676003, 11149336, -26123651, 4985768}, - FieldElement{-19096303, 341147, -6197485, -239033, 15756973, -8796662, -983043, 13794114, -19414307, -15621255}, - }, - { - FieldElement{6490081, 11940286, 25495923, -7726360, 8668373, -8751316, 3367603, 6970005, -1691065, -9004790}, - FieldElement{1656497, 13457317, 15370807, 6364910, 13605745, 8362338, -19174622, -5475723, -16796596, -5031438}, - FieldElement{-22273315, -13524424, -64685, -4334223, -18605636, -10921968, -20571065, -7007978, -99853, -10237333}, - }, - { - FieldElement{17747465, 10039260, 19368299, -4050591, -20630635, -16041286, 31992683, -15857976, -29260363, -5511971}, - FieldElement{31932027, -4986141, -19612382, 16366580, 22023614, 88450, 11371999, -3744247, 4882242, -10626905}, - FieldElement{29796507, 37186, 19818052, 10115756, -11829032, 3352736, 18551198, 3272828, -5190932, -4162409}, - }, - { - FieldElement{12501286, 4044383, -8612957, -13392385, -32430052, 5136599, -19230378, -3529697, 330070, -3659409}, - FieldElement{6384877, 2899513, 17807477, 7663917, -2358888, 12363165, 25366522, -8573892, -271295, 12071499}, - FieldElement{-8365515, -4042521, 25133448, -4517355, -6211027, 2265927, -32769618, 1936675, -5159697, 3829363}, - }, - { - FieldElement{28425966, -5835433, -577090, -4697198, -14217555, 6870930, 7921550, -6567787, 26333140, 14267664}, - FieldElement{-11067219, 11871231, 27385719, -10559544, -4585914, -11189312, 10004786, -8709488, -21761224, 8930324}, - FieldElement{-21197785, -16396035, 25654216, -1725397, 12282012, 11008919, 1541940, 4757911, -26491501, -16408940}, - }, - { - FieldElement{13537262, -7759490, -20604840, 10961927, -5922820, -13218065, -13156584, 6217254, -15943699, 13814990}, - FieldElement{-17422573, 15157790, 18705543, 29619, 24409717, -260476, 27361681, 9257833, -1956526, -1776914}, - FieldElement{-25045300, -10191966, 15366585, 15166509, -13105086, 8423556, -29171540, 12361135, -18685978, 4578290}, - }, - { - FieldElement{24579768, 3711570, 1342322, -11180126, -27005135, 14124956, -22544529, 14074919, 21964432, 8235257}, - FieldElement{-6528613, -2411497, 9442966, -5925588, 12025640, -1487420, -2981514, -1669206, 13006806, 2355433}, - FieldElement{-16304899, -13605259, -6632427, -5142349, 16974359, -10911083, 27202044, 1719366, 1141648, -12796236}, - }, - { - FieldElement{-12863944, -13219986, -8318266, -11018091, -6810145, -4843894, 13475066, -3133972, 32674895, 13715045}, - FieldElement{11423335, -5468059, 32344216, 8962751, 24989809, 9241752, -13265253, 16086212, -28740881, -15642093}, - FieldElement{-1409668, 12530728, -6368726, 10847387, 19531186, -14132160, -11709148, 7791794, -27245943, 4383347}, - }, - }, - { - { - FieldElement{-28970898, 5271447, -1266009, -9736989, -12455236, 16732599, -4862407, -4906449, 27193557, 6245191}, - FieldElement{-15193956, 5362278, -1783893, 2695834, 4960227, 12840725, 23061898, 3260492, 22510453, 8577507}, - FieldElement{-12632451, 11257346, -32692994, 13548177, -721004, 10879011, 31168030, 13952092, -29571492, -3635906}, - }, - { - FieldElement{3877321, -9572739, 32416692, 5405324, -11004407, -13656635, 3759769, 11935320, 5611860, 8164018}, - FieldElement{-16275802, 14667797, 15906460, 12155291, -22111149, -9039718, 32003002, -8832289, 5773085, -8422109}, - FieldElement{-23788118, -8254300, 1950875, 8937633, 18686727, 16459170, -905725, 12376320, 31632953, 190926}, - }, - { - FieldElement{-24593607, -16138885, -8423991, 13378746, 14162407, 6901328, -8288749, 4508564, -25341555, -3627528}, - FieldElement{8884438, -5884009, 6023974, 10104341, -6881569, -4941533, 18722941, -14786005, -1672488, 827625}, - FieldElement{-32720583, -16289296, -32503547, 7101210, 13354605, 2659080, -1800575, -14108036, -24878478, 1541286}, - }, - { - FieldElement{2901347, -1117687, 3880376, -10059388, -17620940, -3612781, -21802117, -3567481, 20456845, -1885033}, - FieldElement{27019610, 12299467, -13658288, -1603234, -12861660, -4861471, -19540150, -5016058, 29439641, 15138866}, - FieldElement{21536104, -6626420, -32447818, -10690208, -22408077, 5175814, -5420040, -16361163, 7779328, 109896}, - }, - { - FieldElement{30279744, 14648750, -8044871, 6425558, 13639621, -743509, 28698390, 12180118, 23177719, -554075}, - FieldElement{26572847, 3405927, -31701700, 12890905, -19265668, 5335866, -6493768, 2378492, 4439158, -13279347}, - FieldElement{-22716706, 3489070, -9225266, -332753, 18875722, -1140095, 14819434, -12731527, -17717757, -5461437}, - }, - { - FieldElement{-5056483, 16566551, 15953661, 3767752, -10436499, 15627060, -820954, 2177225, 8550082, -15114165}, - FieldElement{-18473302, 16596775, -381660, 15663611, 22860960, 15585581, -27844109, -3582739, -23260460, -8428588}, - FieldElement{-32480551, 15707275, -8205912, -5652081, 29464558, 2713815, -22725137, 15860482, -21902570, 1494193}, - }, - { - FieldElement{-19562091, -14087393, -25583872, -9299552, 13127842, 759709, 21923482, 16529112, 8742704, 12967017}, - FieldElement{-28464899, 1553205, 32536856, -10473729, -24691605, -406174, -8914625, -2933896, -29903758, 15553883}, - FieldElement{21877909, 3230008, 9881174, 10539357, -4797115, 2841332, 11543572, 14513274, 19375923, -12647961}, - }, - { - FieldElement{8832269, -14495485, 13253511, 5137575, 5037871, 4078777, 24880818, -6222716, 2862653, 9455043}, - FieldElement{29306751, 5123106, 20245049, -14149889, 9592566, 8447059, -2077124, -2990080, 15511449, 4789663}, - FieldElement{-20679756, 7004547, 8824831, -9434977, -4045704, -3750736, -5754762, 108893, 23513200, 16652362}, - }, - }, - { - { - FieldElement{-33256173, 4144782, -4476029, -6579123, 10770039, -7155542, -6650416, -12936300, -18319198, 10212860}, - FieldElement{2756081, 8598110, 7383731, -6859892, 22312759, -1105012, 21179801, 2600940, -9988298, -12506466}, - FieldElement{-24645692, 13317462, -30449259, -15653928, 21365574, -10869657, 11344424, 864440, -2499677, -16710063}, - }, - { - FieldElement{-26432803, 6148329, -17184412, -14474154, 18782929, -275997, -22561534, 211300, 2719757, 4940997}, - FieldElement{-1323882, 3911313, -6948744, 14759765, -30027150, 7851207, 21690126, 8518463, 26699843, 5276295}, - FieldElement{-13149873, -6429067, 9396249, 365013, 24703301, -10488939, 1321586, 149635, -15452774, 7159369}, - }, - { - FieldElement{9987780, -3404759, 17507962, 9505530, 9731535, -2165514, 22356009, 8312176, 22477218, -8403385}, - FieldElement{18155857, -16504990, 19744716, 9006923, 15154154, -10538976, 24256460, -4864995, -22548173, 9334109}, - FieldElement{2986088, -4911893, 10776628, -3473844, 10620590, -7083203, -21413845, 14253545, -22587149, 536906}, - }, - { - FieldElement{4377756, 8115836, 24567078, 15495314, 11625074, 13064599, 7390551, 10589625, 10838060, -15420424}, - FieldElement{-19342404, 867880, 9277171, -3218459, -14431572, -1986443, 19295826, -15796950, 6378260, 699185}, - FieldElement{7895026, 4057113, -7081772, -13077756, -17886831, -323126, -716039, 15693155, -5045064, -13373962}, - }, - { - FieldElement{-7737563, -5869402, -14566319, -7406919, 11385654, 13201616, 31730678, -10962840, -3918636, -9669325}, - FieldElement{10188286, -15770834, -7336361, 13427543, 22223443, 14896287, 30743455, 7116568, -21786507, 5427593}, - FieldElement{696102, 13206899, 27047647, -10632082, 15285305, -9853179, 10798490, -4578720, 19236243, 12477404}, - }, - { - FieldElement{-11229439, 11243796, -17054270, -8040865, -788228, -8167967, -3897669, 11180504, -23169516, 7733644}, - FieldElement{17800790, -14036179, -27000429, -11766671, 23887827, 3149671, 23466177, -10538171, 10322027, 15313801}, - FieldElement{26246234, 11968874, 32263343, -5468728, 6830755, -13323031, -15794704, -101982, -24449242, 10890804}, - }, - { - FieldElement{-31365647, 10271363, -12660625, -6267268, 16690207, -13062544, -14982212, 16484931, 25180797, -5334884}, - FieldElement{-586574, 10376444, -32586414, -11286356, 19801893, 10997610, 2276632, 9482883, 316878, 13820577}, - FieldElement{-9882808, -4510367, -2115506, 16457136, -11100081, 11674996, 30756178, -7515054, 30696930, -3712849}, - }, - { - FieldElement{32988917, -9603412, 12499366, 7910787, -10617257, -11931514, -7342816, -9985397, -32349517, 7392473}, - FieldElement{-8855661, 15927861, 9866406, -3649411, -2396914, -16655781, -30409476, -9134995, 25112947, -2926644}, - FieldElement{-2504044, -436966, 25621774, -5678772, 15085042, -5479877, -24884878, -13526194, 5537438, -13914319}, - }, - }, - { - { - FieldElement{-11225584, 2320285, -9584280, 10149187, -33444663, 5808648, -14876251, -1729667, 31234590, 6090599}, - FieldElement{-9633316, 116426, 26083934, 2897444, -6364437, -2688086, 609721, 15878753, -6970405, -9034768}, - FieldElement{-27757857, 247744, -15194774, -9002551, 23288161, -10011936, -23869595, 6503646, 20650474, 1804084}, - }, - { - FieldElement{-27589786, 15456424, 8972517, 8469608, 15640622, 4439847, 3121995, -10329713, 27842616, -202328}, - FieldElement{-15306973, 2839644, 22530074, 10026331, 4602058, 5048462, 28248656, 5031932, -11375082, 12714369}, - FieldElement{20807691, -7270825, 29286141, 11421711, -27876523, -13868230, -21227475, 1035546, -19733229, 12796920}, - }, - { - FieldElement{12076899, -14301286, -8785001, -11848922, -25012791, 16400684, -17591495, -12899438, 3480665, -15182815}, - FieldElement{-32361549, 5457597, 28548107, 7833186, 7303070, -11953545, -24363064, -15921875, -33374054, 2771025}, - FieldElement{-21389266, 421932, 26597266, 6860826, 22486084, -6737172, -17137485, -4210226, -24552282, 15673397}, - }, - { - FieldElement{-20184622, 2338216, 19788685, -9620956, -4001265, -8740893, -20271184, 4733254, 3727144, -12934448}, - FieldElement{6120119, 814863, -11794402, -622716, 6812205, -15747771, 2019594, 7975683, 31123697, -10958981}, - FieldElement{30069250, -11435332, 30434654, 2958439, 18399564, -976289, 12296869, 9204260, -16432438, 9648165}, - }, - { - FieldElement{32705432, -1550977, 30705658, 7451065, -11805606, 9631813, 3305266, 5248604, -26008332, -11377501}, - FieldElement{17219865, 2375039, -31570947, -5575615, -19459679, 9219903, 294711, 15298639, 2662509, -16297073}, - FieldElement{-1172927, -7558695, -4366770, -4287744, -21346413, -8434326, 32087529, -1222777, 32247248, -14389861}, - }, - { - FieldElement{14312628, 1221556, 17395390, -8700143, -4945741, -8684635, -28197744, -9637817, -16027623, -13378845}, - FieldElement{-1428825, -9678990, -9235681, 6549687, -7383069, -468664, 23046502, 9803137, 17597934, 2346211}, - FieldElement{18510800, 15337574, 26171504, 981392, -22241552, 7827556, -23491134, -11323352, 3059833, -11782870}, - }, - { - FieldElement{10141598, 6082907, 17829293, -1947643, 9830092, 13613136, -25556636, -5544586, -33502212, 3592096}, - FieldElement{33114168, -15889352, -26525686, -13343397, 33076705, 8716171, 1151462, 1521897, -982665, -6837803}, - FieldElement{-32939165, -4255815, 23947181, -324178, -33072974, -12305637, -16637686, 3891704, 26353178, 693168}, - }, - { - FieldElement{30374239, 1595580, -16884039, 13186931, 4600344, 406904, 9585294, -400668, 31375464, 14369965}, - FieldElement{-14370654, -7772529, 1510301, 6434173, -18784789, -6262728, 32732230, -13108839, 17901441, 16011505}, - FieldElement{18171223, -11934626, -12500402, 15197122, -11038147, -15230035, -19172240, -16046376, 8764035, 12309598}, - }, - }, - { - { - FieldElement{5975908, -5243188, -19459362, -9681747, -11541277, 14015782, -23665757, 1228319, 17544096, -10593782}, - FieldElement{5811932, -1715293, 3442887, -2269310, -18367348, -8359541, -18044043, -15410127, -5565381, 12348900}, - FieldElement{-31399660, 11407555, 25755363, 6891399, -3256938, 14872274, -24849353, 8141295, -10632534, -585479}, - }, - { - FieldElement{-12675304, 694026, -5076145, 13300344, 14015258, -14451394, -9698672, -11329050, 30944593, 1130208}, - FieldElement{8247766, -6710942, -26562381, -7709309, -14401939, -14648910, 4652152, 2488540, 23550156, -271232}, - FieldElement{17294316, -3788438, 7026748, 15626851, 22990044, 113481, 2267737, -5908146, -408818, -137719}, - }, - { - FieldElement{16091085, -16253926, 18599252, 7340678, 2137637, -1221657, -3364161, 14550936, 3260525, -7166271}, - FieldElement{-4910104, -13332887, 18550887, 10864893, -16459325, -7291596, -23028869, -13204905, -12748722, 2701326}, - FieldElement{-8574695, 16099415, 4629974, -16340524, -20786213, -6005432, -10018363, 9276971, 11329923, 1862132}, - }, - { - FieldElement{14763076, -15903608, -30918270, 3689867, 3511892, 10313526, -21951088, 12219231, -9037963, -940300}, - FieldElement{8894987, -3446094, 6150753, 3013931, 301220, 15693451, -31981216, -2909717, -15438168, 11595570}, - FieldElement{15214962, 3537601, -26238722, -14058872, 4418657, -15230761, 13947276, 10730794, -13489462, -4363670}, - }, - { - FieldElement{-2538306, 7682793, 32759013, 263109, -29984731, -7955452, -22332124, -10188635, 977108, 699994}, - FieldElement{-12466472, 4195084, -9211532, 550904, -15565337, 12917920, 19118110, -439841, -30534533, -14337913}, - FieldElement{31788461, -14507657, 4799989, 7372237, 8808585, -14747943, 9408237, -10051775, 12493932, -5409317}, - }, - { - FieldElement{-25680606, 5260744, -19235809, -6284470, -3695942, 16566087, 27218280, 2607121, 29375955, 6024730}, - FieldElement{842132, -2794693, -4763381, -8722815, 26332018, -12405641, 11831880, 6985184, -9940361, 2854096}, - FieldElement{-4847262, -7969331, 2516242, -5847713, 9695691, -7221186, 16512645, 960770, 12121869, 16648078}, - }, - { - FieldElement{-15218652, 14667096, -13336229, 2013717, 30598287, -464137, -31504922, -7882064, 20237806, 2838411}, - FieldElement{-19288047, 4453152, 15298546, -16178388, 22115043, -15972604, 12544294, -13470457, 1068881, -12499905}, - FieldElement{-9558883, -16518835, 33238498, 13506958, 30505848, -1114596, -8486907, -2630053, 12521378, 4845654}, - }, - { - FieldElement{-28198521, 10744108, -2958380, 10199664, 7759311, -13088600, 3409348, -873400, -6482306, -12885870}, - FieldElement{-23561822, 6230156, -20382013, 10655314, -24040585, -11621172, 10477734, -1240216, -3113227, 13974498}, - FieldElement{12966261, 15550616, -32038948, -1615346, 21025980, -629444, 5642325, 7188737, 18895762, 12629579}, - }, - }, - { - { - FieldElement{14741879, -14946887, 22177208, -11721237, 1279741, 8058600, 11758140, 789443, 32195181, 3895677}, - FieldElement{10758205, 15755439, -4509950, 9243698, -4879422, 6879879, -2204575, -3566119, -8982069, 4429647}, - FieldElement{-2453894, 15725973, -20436342, -10410672, -5803908, -11040220, -7135870, -11642895, 18047436, -15281743}, - }, - { - FieldElement{-25173001, -11307165, 29759956, 11776784, -22262383, -15820455, 10993114, -12850837, -17620701, -9408468}, - FieldElement{21987233, 700364, -24505048, 14972008, -7774265, -5718395, 32155026, 2581431, -29958985, 8773375}, - FieldElement{-25568350, 454463, -13211935, 16126715, 25240068, 8594567, 20656846, 12017935, -7874389, -13920155}, - }, - { - FieldElement{6028182, 6263078, -31011806, -11301710, -818919, 2461772, -31841174, -5468042, -1721788, -2776725}, - FieldElement{-12278994, 16624277, 987579, -5922598, 32908203, 1248608, 7719845, -4166698, 28408820, 6816612}, - FieldElement{-10358094, -8237829, 19549651, -12169222, 22082623, 16147817, 20613181, 13982702, -10339570, 5067943}, - }, - { - FieldElement{-30505967, -3821767, 12074681, 13582412, -19877972, 2443951, -19719286, 12746132, 5331210, -10105944}, - FieldElement{30528811, 3601899, -1957090, 4619785, -27361822, -15436388, 24180793, -12570394, 27679908, -1648928}, - FieldElement{9402404, -13957065, 32834043, 10838634, -26580150, -13237195, 26653274, -8685565, 22611444, -12715406}, - }, - { - FieldElement{22190590, 1118029, 22736441, 15130463, -30460692, -5991321, 19189625, -4648942, 4854859, 6622139}, - FieldElement{-8310738, -2953450, -8262579, -3388049, -10401731, -271929, 13424426, -3567227, 26404409, 13001963}, - FieldElement{-31241838, -15415700, -2994250, 8939346, 11562230, -12840670, -26064365, -11621720, -15405155, 11020693}, - }, - { - FieldElement{1866042, -7949489, -7898649, -10301010, 12483315, 13477547, 3175636, -12424163, 28761762, 1406734}, - FieldElement{-448555, -1777666, 13018551, 3194501, -9580420, -11161737, 24760585, -4347088, 25577411, -13378680}, - FieldElement{-24290378, 4759345, -690653, -1852816, 2066747, 10693769, -29595790, 9884936, -9368926, 4745410}, - }, - { - FieldElement{-9141284, 6049714, -19531061, -4341411, -31260798, 9944276, -15462008, -11311852, 10931924, -11931931}, - FieldElement{-16561513, 14112680, -8012645, 4817318, -8040464, -11414606, -22853429, 10856641, -20470770, 13434654}, - FieldElement{22759489, -10073434, -16766264, -1871422, 13637442, -10168091, 1765144, -12654326, 28445307, -5364710}, - }, - { - FieldElement{29875063, 12493613, 2795536, -3786330, 1710620, 15181182, -10195717, -8788675, 9074234, 1167180}, - FieldElement{-26205683, 11014233, -9842651, -2635485, -26908120, 7532294, -18716888, -9535498, 3843903, 9367684}, - FieldElement{-10969595, -6403711, 9591134, 9582310, 11349256, 108879, 16235123, 8601684, -139197, 4242895}, - }, - }, - { - { - FieldElement{22092954, -13191123, -2042793, -11968512, 32186753, -11517388, -6574341, 2470660, -27417366, 16625501}, - FieldElement{-11057722, 3042016, 13770083, -9257922, 584236, -544855, -7770857, 2602725, -27351616, 14247413}, - FieldElement{6314175, -10264892, -32772502, 15957557, -10157730, 168750, -8618807, 14290061, 27108877, -1180880}, - }, - { - FieldElement{-8586597, -7170966, 13241782, 10960156, -32991015, -13794596, 33547976, -11058889, -27148451, 981874}, - FieldElement{22833440, 9293594, -32649448, -13618667, -9136966, 14756819, -22928859, -13970780, -10479804, -16197962}, - FieldElement{-7768587, 3326786, -28111797, 10783824, 19178761, 14905060, 22680049, 13906969, -15933690, 3797899}, - }, - { - FieldElement{21721356, -4212746, -12206123, 9310182, -3882239, -13653110, 23740224, -2709232, 20491983, -8042152}, - FieldElement{9209270, -15135055, -13256557, -6167798, -731016, 15289673, 25947805, 15286587, 30997318, -6703063}, - FieldElement{7392032, 16618386, 23946583, -8039892, -13265164, -1533858, -14197445, -2321576, 17649998, -250080}, - }, - { - FieldElement{-9301088, -14193827, 30609526, -3049543, -25175069, -1283752, -15241566, -9525724, -2233253, 7662146}, - FieldElement{-17558673, 1763594, -33114336, 15908610, -30040870, -12174295, 7335080, -8472199, -3174674, 3440183}, - FieldElement{-19889700, -5977008, -24111293, -9688870, 10799743, -16571957, 40450, -4431835, 4862400, 1133}, - }, - { - FieldElement{-32856209, -7873957, -5422389, 14860950, -16319031, 7956142, 7258061, 311861, -30594991, -7379421}, - FieldElement{-3773428, -1565936, 28985340, 7499440, 24445838, 9325937, 29727763, 16527196, 18278453, 15405622}, - FieldElement{-4381906, 8508652, -19898366, -3674424, -5984453, 15149970, -13313598, 843523, -21875062, 13626197}, - }, - { - FieldElement{2281448, -13487055, -10915418, -2609910, 1879358, 16164207, -10783882, 3953792, 13340839, 15928663}, - FieldElement{31727126, -7179855, -18437503, -8283652, 2875793, -16390330, -25269894, -7014826, -23452306, 5964753}, - FieldElement{4100420, -5959452, -17179337, 6017714, -18705837, 12227141, -26684835, 11344144, 2538215, -7570755}, - }, - { - FieldElement{-9433605, 6123113, 11159803, -2156608, 30016280, 14966241, -20474983, 1485421, -629256, -15958862}, - FieldElement{-26804558, 4260919, 11851389, 9658551, -32017107, 16367492, -20205425, -13191288, 11659922, -11115118}, - FieldElement{26180396, 10015009, -30844224, -8581293, 5418197, 9480663, 2231568, -10170080, 33100372, -1306171}, - }, - { - FieldElement{15121113, -5201871, -10389905, 15427821, -27509937, -15992507, 21670947, 4486675, -5931810, -14466380}, - FieldElement{16166486, -9483733, -11104130, 6023908, -31926798, -1364923, 2340060, -16254968, -10735770, -10039824}, - FieldElement{28042865, -3557089, -12126526, 12259706, -3717498, -6945899, 6766453, -8689599, 18036436, 5803270}, - }, - }, - { - { - FieldElement{-817581, 6763912, 11803561, 1585585, 10958447, -2671165, 23855391, 4598332, -6159431, -14117438}, - FieldElement{-31031306, -14256194, 17332029, -2383520, 31312682, -5967183, 696309, 50292, -20095739, 11763584}, - FieldElement{-594563, -2514283, -32234153, 12643980, 12650761, 14811489, 665117, -12613632, -19773211, -10713562}, - }, - { - FieldElement{30464590, -11262872, -4127476, -12734478, 19835327, -7105613, -24396175, 2075773, -17020157, 992471}, - FieldElement{18357185, -6994433, 7766382, 16342475, -29324918, 411174, 14578841, 8080033, -11574335, -10601610}, - FieldElement{19598397, 10334610, 12555054, 2555664, 18821899, -10339780, 21873263, 16014234, 26224780, 16452269}, - }, - { - FieldElement{-30223925, 5145196, 5944548, 16385966, 3976735, 2009897, -11377804, -7618186, -20533829, 3698650}, - FieldElement{14187449, 3448569, -10636236, -10810935, -22663880, -3433596, 7268410, -10890444, 27394301, 12015369}, - FieldElement{19695761, 16087646, 28032085, 12999827, 6817792, 11427614, 20244189, -1312777, -13259127, -3402461}, - }, - { - FieldElement{30860103, 12735208, -1888245, -4699734, -16974906, 2256940, -8166013, 12298312, -8550524, -10393462}, - FieldElement{-5719826, -11245325, -1910649, 15569035, 26642876, -7587760, -5789354, -15118654, -4976164, 12651793}, - FieldElement{-2848395, 9953421, 11531313, -5282879, 26895123, -12697089, -13118820, -16517902, 9768698, -2533218}, - }, - { - FieldElement{-24719459, 1894651, -287698, -4704085, 15348719, -8156530, 32767513, 12765450, 4940095, 10678226}, - FieldElement{18860224, 15980149, -18987240, -1562570, -26233012, -11071856, -7843882, 13944024, -24372348, 16582019}, - FieldElement{-15504260, 4970268, -29893044, 4175593, -20993212, -2199756, -11704054, 15444560, -11003761, 7989037}, - }, - { - FieldElement{31490452, 5568061, -2412803, 2182383, -32336847, 4531686, -32078269, 6200206, -19686113, -14800171}, - FieldElement{-17308668, -15879940, -31522777, -2831, -32887382, 16375549, 8680158, -16371713, 28550068, -6857132}, - FieldElement{-28126887, -5688091, 16837845, -1820458, -6850681, 12700016, -30039981, 4364038, 1155602, 5988841}, - }, - { - FieldElement{21890435, -13272907, -12624011, 12154349, -7831873, 15300496, 23148983, -4470481, 24618407, 8283181}, - FieldElement{-33136107, -10512751, 9975416, 6841041, -31559793, 16356536, 3070187, -7025928, 1466169, 10740210}, - FieldElement{-1509399, -15488185, -13503385, -10655916, 32799044, 909394, -13938903, -5779719, -32164649, -15327040}, - }, - { - FieldElement{3960823, -14267803, -28026090, -15918051, -19404858, 13146868, 15567327, 951507, -3260321, -573935}, - FieldElement{24740841, 5052253, -30094131, 8961361, 25877428, 6165135, -24368180, 14397372, -7380369, -6144105}, - FieldElement{-28888365, 3510803, -28103278, -1158478, -11238128, -10631454, -15441463, -14453128, -1625486, -6494814}, - }, - }, - { - { - FieldElement{793299, -9230478, 8836302, -6235707, -27360908, -2369593, 33152843, -4885251, -9906200, -621852}, - FieldElement{5666233, 525582, 20782575, -8038419, -24538499, 14657740, 16099374, 1468826, -6171428, -15186581}, - FieldElement{-4859255, -3779343, -2917758, -6748019, 7778750, 11688288, -30404353, -9871238, -1558923, -9863646}, - }, - { - FieldElement{10896332, -7719704, 824275, 472601, -19460308, 3009587, 25248958, 14783338, -30581476, -15757844}, - FieldElement{10566929, 12612572, -31944212, 11118703, -12633376, 12362879, 21752402, 8822496, 24003793, 14264025}, - FieldElement{27713862, -7355973, -11008240, 9227530, 27050101, 2504721, 23886875, -13117525, 13958495, -5732453}, - }, - { - FieldElement{-23481610, 4867226, -27247128, 3900521, 29838369, -8212291, -31889399, -10041781, 7340521, -15410068}, - FieldElement{4646514, -8011124, -22766023, -11532654, 23184553, 8566613, 31366726, -1381061, -15066784, -10375192}, - FieldElement{-17270517, 12723032, -16993061, 14878794, 21619651, -6197576, 27584817, 3093888, -8843694, 3849921}, - }, - { - FieldElement{-9064912, 2103172, 25561640, -15125738, -5239824, 9582958, 32477045, -9017955, 5002294, -15550259}, - FieldElement{-12057553, -11177906, 21115585, -13365155, 8808712, -12030708, 16489530, 13378448, -25845716, 12741426}, - FieldElement{-5946367, 10645103, -30911586, 15390284, -3286982, -7118677, 24306472, 15852464, 28834118, -7646072}, - }, - { - FieldElement{-17335748, -9107057, -24531279, 9434953, -8472084, -583362, -13090771, 455841, 20461858, 5491305}, - FieldElement{13669248, -16095482, -12481974, -10203039, -14569770, -11893198, -24995986, 11293807, -28588204, -9421832}, - FieldElement{28497928, 6272777, -33022994, 14470570, 8906179, -1225630, 18504674, -14165166, 29867745, -8795943}, - }, - { - FieldElement{-16207023, 13517196, -27799630, -13697798, 24009064, -6373891, -6367600, -13175392, 22853429, -4012011}, - FieldElement{24191378, 16712145, -13931797, 15217831, 14542237, 1646131, 18603514, -11037887, 12876623, -2112447}, - FieldElement{17902668, 4518229, -411702, -2829247, 26878217, 5258055, -12860753, 608397, 16031844, 3723494}, - }, - { - FieldElement{-28632773, 12763728, -20446446, 7577504, 33001348, -13017745, 17558842, -7872890, 23896954, -4314245}, - FieldElement{-20005381, -12011952, 31520464, 605201, 2543521, 5991821, -2945064, 7229064, -9919646, -8826859}, - FieldElement{28816045, 298879, -28165016, -15920938, 19000928, -1665890, -12680833, -2949325, -18051778, -2082915}, - }, - { - FieldElement{16000882, -344896, 3493092, -11447198, -29504595, -13159789, 12577740, 16041268, -19715240, 7847707}, - FieldElement{10151868, 10572098, 27312476, 7922682, 14825339, 4723128, -32855931, -6519018, -10020567, 3852848}, - FieldElement{-11430470, 15697596, -21121557, -4420647, 5386314, 15063598, 16514493, -15932110, 29330899, -15076224}, - }, - }, - { - { - FieldElement{-25499735, -4378794, -15222908, -6901211, 16615731, 2051784, 3303702, 15490, -27548796, 12314391}, - FieldElement{15683520, -6003043, 18109120, -9980648, 15337968, -5997823, -16717435, 15921866, 16103996, -3731215}, - FieldElement{-23169824, -10781249, 13588192, -1628807, -3798557, -1074929, -19273607, 5402699, -29815713, -9841101}, - }, - { - FieldElement{23190676, 2384583, -32714340, 3462154, -29903655, -1529132, -11266856, 8911517, -25205859, 2739713}, - FieldElement{21374101, -3554250, -33524649, 9874411, 15377179, 11831242, -33529904, 6134907, 4931255, 11987849}, - FieldElement{-7732, -2978858, -16223486, 7277597, 105524, -322051, -31480539, 13861388, -30076310, 10117930}, - }, - { - FieldElement{-29501170, -10744872, -26163768, 13051539, -25625564, 5089643, -6325503, 6704079, 12890019, 15728940}, - FieldElement{-21972360, -11771379, -951059, -4418840, 14704840, 2695116, 903376, -10428139, 12885167, 8311031}, - FieldElement{-17516482, 5352194, 10384213, -13811658, 7506451, 13453191, 26423267, 4384730, 1888765, -5435404}, - }, - { - FieldElement{-25817338, -3107312, -13494599, -3182506, 30896459, -13921729, -32251644, -12707869, -19464434, -3340243}, - FieldElement{-23607977, -2665774, -526091, 4651136, 5765089, 4618330, 6092245, 14845197, 17151279, -9854116}, - FieldElement{-24830458, -12733720, -15165978, 10367250, -29530908, -265356, 22825805, -7087279, -16866484, 16176525}, - }, - { - FieldElement{-23583256, 6564961, 20063689, 3798228, -4740178, 7359225, 2006182, -10363426, -28746253, -10197509}, - FieldElement{-10626600, -4486402, -13320562, -5125317, 3432136, -6393229, 23632037, -1940610, 32808310, 1099883}, - FieldElement{15030977, 5768825, -27451236, -2887299, -6427378, -15361371, -15277896, -6809350, 2051441, -15225865}, - }, - { - FieldElement{-3362323, -7239372, 7517890, 9824992, 23555850, 295369, 5148398, -14154188, -22686354, 16633660}, - FieldElement{4577086, -16752288, 13249841, -15304328, 19958763, -14537274, 18559670, -10759549, 8402478, -9864273}, - FieldElement{-28406330, -1051581, -26790155, -907698, -17212414, -11030789, 9453451, -14980072, 17983010, 9967138}, - }, - { - FieldElement{-25762494, 6524722, 26585488, 9969270, 24709298, 1220360, -1677990, 7806337, 17507396, 3651560}, - FieldElement{-10420457, -4118111, 14584639, 15971087, -15768321, 8861010, 26556809, -5574557, -18553322, -11357135}, - FieldElement{2839101, 14284142, 4029895, 3472686, 14402957, 12689363, -26642121, 8459447, -5605463, -7621941}, - }, - { - FieldElement{-4839289, -3535444, 9744961, 2871048, 25113978, 3187018, -25110813, -849066, 17258084, -7977739}, - FieldElement{18164541, -10595176, -17154882, -1542417, 19237078, -9745295, 23357533, -15217008, 26908270, 12150756}, - FieldElement{-30264870, -7647865, 5112249, -7036672, -1499807, -6974257, 43168, -5537701, -32302074, 16215819}, - }, - }, - { - { - FieldElement{-6898905, 9824394, -12304779, -4401089, -31397141, -6276835, 32574489, 12532905, -7503072, -8675347}, - FieldElement{-27343522, -16515468, -27151524, -10722951, 946346, 16291093, 254968, 7168080, 21676107, -1943028}, - FieldElement{21260961, -8424752, -16831886, -11920822, -23677961, 3968121, -3651949, -6215466, -3556191, -7913075}, - }, - { - FieldElement{16544754, 13250366, -16804428, 15546242, -4583003, 12757258, -2462308, -8680336, -18907032, -9662799}, - FieldElement{-2415239, -15577728, 18312303, 4964443, -15272530, -12653564, 26820651, 16690659, 25459437, -4564609}, - FieldElement{-25144690, 11425020, 28423002, -11020557, -6144921, -15826224, 9142795, -2391602, -6432418, -1644817}, - }, - { - FieldElement{-23104652, 6253476, 16964147, -3768872, -25113972, -12296437, -27457225, -16344658, 6335692, 7249989}, - FieldElement{-30333227, 13979675, 7503222, -12368314, -11956721, -4621693, -30272269, 2682242, 25993170, -12478523}, - FieldElement{4364628, 5930691, 32304656, -10044554, -8054781, 15091131, 22857016, -10598955, 31820368, 15075278}, - }, - { - FieldElement{31879134, -8918693, 17258761, 90626, -8041836, -4917709, 24162788, -9650886, -17970238, 12833045}, - FieldElement{19073683, 14851414, -24403169, -11860168, 7625278, 11091125, -19619190, 2074449, -9413939, 14905377}, - FieldElement{24483667, -11935567, -2518866, -11547418, -1553130, 15355506, -25282080, 9253129, 27628530, -7555480}, - }, - { - FieldElement{17597607, 8340603, 19355617, 552187, 26198470, -3176583, 4593324, -9157582, -14110875, 15297016}, - FieldElement{510886, 14337390, -31785257, 16638632, 6328095, 2713355, -20217417, -11864220, 8683221, 2921426}, - FieldElement{18606791, 11874196, 27155355, -5281482, -24031742, 6265446, -25178240, -1278924, 4674690, 13890525}, - }, - { - FieldElement{13609624, 13069022, -27372361, -13055908, 24360586, 9592974, 14977157, 9835105, 4389687, 288396}, - FieldElement{9922506, -519394, 13613107, 5883594, -18758345, -434263, -12304062, 8317628, 23388070, 16052080}, - FieldElement{12720016, 11937594, -31970060, -5028689, 26900120, 8561328, -20155687, -11632979, -14754271, -10812892}, - }, - { - FieldElement{15961858, 14150409, 26716931, -665832, -22794328, 13603569, 11829573, 7467844, -28822128, 929275}, - FieldElement{11038231, -11582396, -27310482, -7316562, -10498527, -16307831, -23479533, -9371869, -21393143, 2465074}, - FieldElement{20017163, -4323226, 27915242, 1529148, 12396362, 15675764, 13817261, -9658066, 2463391, -4622140}, - }, - { - FieldElement{-16358878, -12663911, -12065183, 4996454, -1256422, 1073572, 9583558, 12851107, 4003896, 12673717}, - FieldElement{-1731589, -15155870, -3262930, 16143082, 19294135, 13385325, 14741514, -9103726, 7903886, 2348101}, - FieldElement{24536016, -16515207, 12715592, -3862155, 1511293, 10047386, -3842346, -7129159, -28377538, 10048127}, - }, - }, - { - { - FieldElement{-12622226, -6204820, 30718825, 2591312, -10617028, 12192840, 18873298, -7297090, -32297756, 15221632}, - FieldElement{-26478122, -11103864, 11546244, -1852483, 9180880, 7656409, -21343950, 2095755, 29769758, 6593415}, - FieldElement{-31994208, -2907461, 4176912, 3264766, 12538965, -868111, 26312345, -6118678, 30958054, 8292160}, - }, - { - FieldElement{31429822, -13959116, 29173532, 15632448, 12174511, -2760094, 32808831, 3977186, 26143136, -3148876}, - FieldElement{22648901, 1402143, -22799984, 13746059, 7936347, 365344, -8668633, -1674433, -3758243, -2304625}, - FieldElement{-15491917, 8012313, -2514730, -12702462, -23965846, -10254029, -1612713, -1535569, -16664475, 8194478}, - }, - { - FieldElement{27338066, -7507420, -7414224, 10140405, -19026427, -6589889, 27277191, 8855376, 28572286, 3005164}, - FieldElement{26287124, 4821776, 25476601, -4145903, -3764513, -15788984, -18008582, 1182479, -26094821, -13079595}, - FieldElement{-7171154, 3178080, 23970071, 6201893, -17195577, -4489192, -21876275, -13982627, 32208683, -1198248}, - }, - { - FieldElement{-16657702, 2817643, -10286362, 14811298, 6024667, 13349505, -27315504, -10497842, -27672585, -11539858}, - FieldElement{15941029, -9405932, -21367050, 8062055, 31876073, -238629, -15278393, -1444429, 15397331, -4130193}, - FieldElement{8934485, -13485467, -23286397, -13423241, -32446090, 14047986, 31170398, -1441021, -27505566, 15087184}, - }, - { - FieldElement{-18357243, -2156491, 24524913, -16677868, 15520427, -6360776, -15502406, 11461896, 16788528, -5868942}, - FieldElement{-1947386, 16013773, 21750665, 3714552, -17401782, -16055433, -3770287, -10323320, 31322514, -11615635}, - FieldElement{21426655, -5650218, -13648287, -5347537, -28812189, -4920970, -18275391, -14621414, 13040862, -12112948}, - }, - { - FieldElement{11293895, 12478086, -27136401, 15083750, -29307421, 14748872, 14555558, -13417103, 1613711, 4896935}, - FieldElement{-25894883, 15323294, -8489791, -8057900, 25967126, -13425460, 2825960, -4897045, -23971776, -11267415}, - FieldElement{-15924766, -5229880, -17443532, 6410664, 3622847, 10243618, 20615400, 12405433, -23753030, -8436416}, - }, - { - FieldElement{-7091295, 12556208, -20191352, 9025187, -17072479, 4333801, 4378436, 2432030, 23097949, -566018}, - FieldElement{4565804, -16025654, 20084412, -7842817, 1724999, 189254, 24767264, 10103221, -18512313, 2424778}, - FieldElement{366633, -11976806, 8173090, -6890119, 30788634, 5745705, -7168678, 1344109, -3642553, 12412659}, - }, - { - FieldElement{-24001791, 7690286, 14929416, -168257, -32210835, -13412986, 24162697, -15326504, -3141501, 11179385}, - FieldElement{18289522, -14724954, 8056945, 16430056, -21729724, 7842514, -6001441, -1486897, -18684645, -11443503}, - FieldElement{476239, 6601091, -6152790, -9723375, 17503545, -4863900, 27672959, 13403813, 11052904, 5219329}, - }, - }, - { - { - FieldElement{20678546, -8375738, -32671898, 8849123, -5009758, 14574752, 31186971, -3973730, 9014762, -8579056}, - FieldElement{-13644050, -10350239, -15962508, 5075808, -1514661, -11534600, -33102500, 9160280, 8473550, -3256838}, - FieldElement{24900749, 14435722, 17209120, -15292541, -22592275, 9878983, -7689309, -16335821, -24568481, 11788948}, - }, - { - FieldElement{-3118155, -11395194, -13802089, 14797441, 9652448, -6845904, -20037437, 10410733, -24568470, -1458691}, - FieldElement{-15659161, 16736706, -22467150, 10215878, -9097177, 7563911, 11871841, -12505194, -18513325, 8464118}, - FieldElement{-23400612, 8348507, -14585951, -861714, -3950205, -6373419, 14325289, 8628612, 33313881, -8370517}, - }, - { - FieldElement{-20186973, -4967935, 22367356, 5271547, -1097117, -4788838, -24805667, -10236854, -8940735, -5818269}, - FieldElement{-6948785, -1795212, -32625683, -16021179, 32635414, -7374245, 15989197, -12838188, 28358192, -4253904}, - FieldElement{-23561781, -2799059, -32351682, -1661963, -9147719, 10429267, -16637684, 4072016, -5351664, 5596589}, - }, - { - FieldElement{-28236598, -3390048, 12312896, 6213178, 3117142, 16078565, 29266239, 2557221, 1768301, 15373193}, - FieldElement{-7243358, -3246960, -4593467, -7553353, -127927, -912245, -1090902, -4504991, -24660491, 3442910}, - FieldElement{-30210571, 5124043, 14181784, 8197961, 18964734, -11939093, 22597931, 7176455, -18585478, 13365930}, - }, - { - FieldElement{-7877390, -1499958, 8324673, 4690079, 6261860, 890446, 24538107, -8570186, -9689599, -3031667}, - FieldElement{25008904, -10771599, -4305031, -9638010, 16265036, 15721635, 683793, -11823784, 15723479, -15163481}, - FieldElement{-9660625, 12374379, -27006999, -7026148, -7724114, -12314514, 11879682, 5400171, 519526, -1235876}, - }, - { - FieldElement{22258397, -16332233, -7869817, 14613016, -22520255, -2950923, -20353881, 7315967, 16648397, 7605640}, - FieldElement{-8081308, -8464597, -8223311, 9719710, 19259459, -15348212, 23994942, -5281555, -9468848, 4763278}, - FieldElement{-21699244, 9220969, -15730624, 1084137, -25476107, -2852390, 31088447, -7764523, -11356529, 728112}, - }, - { - FieldElement{26047220, -11751471, -6900323, -16521798, 24092068, 9158119, -4273545, -12555558, -29365436, -5498272}, - FieldElement{17510331, -322857, 5854289, 8403524, 17133918, -3112612, -28111007, 12327945, 10750447, 10014012}, - FieldElement{-10312768, 3936952, 9156313, -8897683, 16498692, -994647, -27481051, -666732, 3424691, 7540221}, - }, - { - FieldElement{30322361, -6964110, 11361005, -4143317, 7433304, 4989748, -7071422, -16317219, -9244265, 15258046}, - FieldElement{13054562, -2779497, 19155474, 469045, -12482797, 4566042, 5631406, 2711395, 1062915, -5136345}, - FieldElement{-19240248, -11254599, -29509029, -7499965, -5835763, 13005411, -6066489, 12194497, 32960380, 1459310}, - }, - }, - { - { - FieldElement{19852034, 7027924, 23669353, 10020366, 8586503, -6657907, 394197, -6101885, 18638003, -11174937}, - FieldElement{31395534, 15098109, 26581030, 8030562, -16527914, -5007134, 9012486, -7584354, -6643087, -5442636}, - FieldElement{-9192165, -2347377, -1997099, 4529534, 25766844, 607986, -13222, 9677543, -32294889, -6456008}, - }, - { - FieldElement{-2444496, -149937, 29348902, 8186665, 1873760, 12489863, -30934579, -7839692, -7852844, -8138429}, - FieldElement{-15236356, -15433509, 7766470, 746860, 26346930, -10221762, -27333451, 10754588, -9431476, 5203576}, - FieldElement{31834314, 14135496, -770007, 5159118, 20917671, -16768096, -7467973, -7337524, 31809243, 7347066}, - }, - { - FieldElement{-9606723, -11874240, 20414459, 13033986, 13716524, -11691881, 19797970, -12211255, 15192876, -2087490}, - FieldElement{-12663563, -2181719, 1168162, -3804809, 26747877, -14138091, 10609330, 12694420, 33473243, -13382104}, - FieldElement{33184999, 11180355, 15832085, -11385430, -1633671, 225884, 15089336, -11023903, -6135662, 14480053}, - }, - { - FieldElement{31308717, -5619998, 31030840, -1897099, 15674547, -6582883, 5496208, 13685227, 27595050, 8737275}, - FieldElement{-20318852, -15150239, 10933843, -16178022, 8335352, -7546022, -31008351, -12610604, 26498114, 66511}, - FieldElement{22644454, -8761729, -16671776, 4884562, -3105614, -13559366, 30540766, -4286747, -13327787, -7515095}, - }, - { - FieldElement{-28017847, 9834845, 18617207, -2681312, -3401956, -13307506, 8205540, 13585437, -17127465, 15115439}, - FieldElement{23711543, -672915, 31206561, -8362711, 6164647, -9709987, -33535882, -1426096, 8236921, 16492939}, - FieldElement{-23910559, -13515526, -26299483, -4503841, 25005590, -7687270, 19574902, 10071562, 6708380, -6222424}, - }, - { - FieldElement{2101391, -4930054, 19702731, 2367575, -15427167, 1047675, 5301017, 9328700, 29955601, -11678310}, - FieldElement{3096359, 9271816, -21620864, -15521844, -14847996, -7592937, -25892142, -12635595, -9917575, 6216608}, - FieldElement{-32615849, 338663, -25195611, 2510422, -29213566, -13820213, 24822830, -6146567, -26767480, 7525079}, - }, - { - FieldElement{-23066649, -13985623, 16133487, -7896178, -3389565, 778788, -910336, -2782495, -19386633, 11994101}, - FieldElement{21691500, -13624626, -641331, -14367021, 3285881, -3483596, -25064666, 9718258, -7477437, 13381418}, - FieldElement{18445390, -4202236, 14979846, 11622458, -1727110, -3582980, 23111648, -6375247, 28535282, 15779576}, - }, - { - FieldElement{30098053, 3089662, -9234387, 16662135, -21306940, 11308411, -14068454, 12021730, 9955285, -16303356}, - FieldElement{9734894, -14576830, -7473633, -9138735, 2060392, 11313496, -18426029, 9924399, 20194861, 13380996}, - FieldElement{-26378102, -7965207, -22167821, 15789297, -18055342, -6168792, -1984914, 15707771, 26342023, 10146099}, - }, - }, - { - { - FieldElement{-26016874, -219943, 21339191, -41388, 19745256, -2878700, -29637280, 2227040, 21612326, -545728}, - FieldElement{-13077387, 1184228, 23562814, -5970442, -20351244, -6348714, 25764461, 12243797, -20856566, 11649658}, - FieldElement{-10031494, 11262626, 27384172, 2271902, 26947504, -15997771, 39944, 6114064, 33514190, 2333242}, - }, - { - FieldElement{-21433588, -12421821, 8119782, 7219913, -21830522, -9016134, -6679750, -12670638, 24350578, -13450001}, - FieldElement{-4116307, -11271533, -23886186, 4843615, -30088339, 690623, -31536088, -10406836, 8317860, 12352766}, - FieldElement{18200138, -14475911, -33087759, -2696619, -23702521, -9102511, -23552096, -2287550, 20712163, 6719373}, - }, - { - FieldElement{26656208, 6075253, -7858556, 1886072, -28344043, 4262326, 11117530, -3763210, 26224235, -3297458}, - FieldElement{-17168938, -14854097, -3395676, -16369877, -19954045, 14050420, 21728352, 9493610, 18620611, -16428628}, - FieldElement{-13323321, 13325349, 11432106, 5964811, 18609221, 6062965, -5269471, -9725556, -30701573, -16479657}, - }, - { - FieldElement{-23860538, -11233159, 26961357, 1640861, -32413112, -16737940, 12248509, -5240639, 13735342, 1934062}, - FieldElement{25089769, 6742589, 17081145, -13406266, 21909293, -16067981, -15136294, -3765346, -21277997, 5473616}, - FieldElement{31883677, -7961101, 1083432, -11572403, 22828471, 13290673, -7125085, 12469656, 29111212, -5451014}, - }, - { - FieldElement{24244947, -15050407, -26262976, 2791540, -14997599, 16666678, 24367466, 6388839, -10295587, 452383}, - FieldElement{-25640782, -3417841, 5217916, 16224624, 19987036, -4082269, -24236251, -5915248, 15766062, 8407814}, - FieldElement{-20406999, 13990231, 15495425, 16395525, 5377168, 15166495, -8917023, -4388953, -8067909, 2276718}, - }, - { - FieldElement{30157918, 12924066, -17712050, 9245753, 19895028, 3368142, -23827587, 5096219, 22740376, -7303417}, - FieldElement{2041139, -14256350, 7783687, 13876377, -25946985, -13352459, 24051124, 13742383, -15637599, 13295222}, - FieldElement{33338237, -8505733, 12532113, 7977527, 9106186, -1715251, -17720195, -4612972, -4451357, -14669444}, - }, - { - FieldElement{-20045281, 5454097, -14346548, 6447146, 28862071, 1883651, -2469266, -4141880, 7770569, 9620597}, - FieldElement{23208068, 7979712, 33071466, 8149229, 1758231, -10834995, 30945528, -1694323, -33502340, -14767970}, - FieldElement{1439958, -16270480, -1079989, -793782, 4625402, 10647766, -5043801, 1220118, 30494170, -11440799}, - }, - { - FieldElement{-5037580, -13028295, -2970559, -3061767, 15640974, -6701666, -26739026, 926050, -1684339, -13333647}, - FieldElement{13908495, -3549272, 30919928, -6273825, -21521863, 7989039, 9021034, 9078865, 3353509, 4033511}, - FieldElement{-29663431, -15113610, 32259991, -344482, 24295849, -12912123, 23161163, 8839127, 27485041, 7356032}, - }, - }, - { - { - FieldElement{9661027, 705443, 11980065, -5370154, -1628543, 14661173, -6346142, 2625015, 28431036, -16771834}, - FieldElement{-23839233, -8311415, -25945511, 7480958, -17681669, -8354183, -22545972, 14150565, 15970762, 4099461}, - FieldElement{29262576, 16756590, 26350592, -8793563, 8529671, -11208050, 13617293, -9937143, 11465739, 8317062}, - }, - { - FieldElement{-25493081, -6962928, 32500200, -9419051, -23038724, -2302222, 14898637, 3848455, 20969334, -5157516}, - FieldElement{-20384450, -14347713, -18336405, 13884722, -33039454, 2842114, -21610826, -3649888, 11177095, 14989547}, - FieldElement{-24496721, -11716016, 16959896, 2278463, 12066309, 10137771, 13515641, 2581286, -28487508, 9930240}, - }, - { - FieldElement{-17751622, -2097826, 16544300, -13009300, -15914807, -14949081, 18345767, -13403753, 16291481, -5314038}, - FieldElement{-33229194, 2553288, 32678213, 9875984, 8534129, 6889387, -9676774, 6957617, 4368891, 9788741}, - FieldElement{16660756, 7281060, -10830758, 12911820, 20108584, -8101676, -21722536, -8613148, 16250552, -11111103}, - }, - { - FieldElement{-19765507, 2390526, -16551031, 14161980, 1905286, 6414907, 4689584, 10604807, -30190403, 4782747}, - FieldElement{-1354539, 14736941, -7367442, -13292886, 7710542, -14155590, -9981571, 4383045, 22546403, 437323}, - FieldElement{31665577, -12180464, -16186830, 1491339, -18368625, 3294682, 27343084, 2786261, -30633590, -14097016}, - }, - { - FieldElement{-14467279, -683715, -33374107, 7448552, 19294360, 14334329, -19690631, 2355319, -19284671, -6114373}, - FieldElement{15121312, -15796162, 6377020, -6031361, -10798111, -12957845, 18952177, 15496498, -29380133, 11754228}, - FieldElement{-2637277, -13483075, 8488727, -14303896, 12728761, -1622493, 7141596, 11724556, 22761615, -10134141}, - }, - { - FieldElement{16918416, 11729663, -18083579, 3022987, -31015732, -13339659, -28741185, -12227393, 32851222, 11717399}, - FieldElement{11166634, 7338049, -6722523, 4531520, -29468672, -7302055, 31474879, 3483633, -1193175, -4030831}, - FieldElement{-185635, 9921305, 31456609, -13536438, -12013818, 13348923, 33142652, 6546660, -19985279, -3948376}, - }, - { - FieldElement{-32460596, 11266712, -11197107, -7899103, 31703694, 3855903, -8537131, -12833048, -30772034, -15486313}, - FieldElement{-18006477, 12709068, 3991746, -6479188, -21491523, -10550425, -31135347, -16049879, 10928917, 3011958}, - FieldElement{-6957757, -15594337, 31696059, 334240, 29576716, 14796075, -30831056, -12805180, 18008031, 10258577}, - }, - { - FieldElement{-22448644, 15655569, 7018479, -4410003, -30314266, -1201591, -1853465, 1367120, 25127874, 6671743}, - FieldElement{29701166, -14373934, -10878120, 9279288, -17568, 13127210, 21382910, 11042292, 25838796, 4642684}, - FieldElement{-20430234, 14955537, -24126347, 8124619, -5369288, -5990470, 30468147, -13900640, 18423289, 4177476}, - }, - }, -} diff --git a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go b/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go deleted file mode 100644 index fd03c252..00000000 --- a/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go +++ /dev/null @@ -1,1793 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package edwards25519 - -import "encoding/binary" - -// This code is a port of the public domain, “ref10” implementation of ed25519 -// from SUPERCOP. - -// FieldElement represents an element of the field GF(2^255 - 19). An element -// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77 -// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on -// context. -type FieldElement [10]int32 - -var zero FieldElement - -func FeZero(fe *FieldElement) { - copy(fe[:], zero[:]) -} - -func FeOne(fe *FieldElement) { - FeZero(fe) - fe[0] = 1 -} - -func FeAdd(dst, a, b *FieldElement) { - dst[0] = a[0] + b[0] - dst[1] = a[1] + b[1] - dst[2] = a[2] + b[2] - dst[3] = a[3] + b[3] - dst[4] = a[4] + b[4] - dst[5] = a[5] + b[5] - dst[6] = a[6] + b[6] - dst[7] = a[7] + b[7] - dst[8] = a[8] + b[8] - dst[9] = a[9] + b[9] -} - -func FeSub(dst, a, b *FieldElement) { - dst[0] = a[0] - b[0] - dst[1] = a[1] - b[1] - dst[2] = a[2] - b[2] - dst[3] = a[3] - b[3] - dst[4] = a[4] - b[4] - dst[5] = a[5] - b[5] - dst[6] = a[6] - b[6] - dst[7] = a[7] - b[7] - dst[8] = a[8] - b[8] - dst[9] = a[9] - b[9] -} - -func FeCopy(dst, src *FieldElement) { - copy(dst[:], src[:]) -} - -// Replace (f,g) with (g,g) if b == 1; -// replace (f,g) with (f,g) if b == 0. -// -// Preconditions: b in {0,1}. -func FeCMove(f, g *FieldElement, b int32) { - b = -b - f[0] ^= b & (f[0] ^ g[0]) - f[1] ^= b & (f[1] ^ g[1]) - f[2] ^= b & (f[2] ^ g[2]) - f[3] ^= b & (f[3] ^ g[3]) - f[4] ^= b & (f[4] ^ g[4]) - f[5] ^= b & (f[5] ^ g[5]) - f[6] ^= b & (f[6] ^ g[6]) - f[7] ^= b & (f[7] ^ g[7]) - f[8] ^= b & (f[8] ^ g[8]) - f[9] ^= b & (f[9] ^ g[9]) -} - -func load3(in []byte) int64 { - var r int64 - r = int64(in[0]) - r |= int64(in[1]) << 8 - r |= int64(in[2]) << 16 - return r -} - -func load4(in []byte) int64 { - var r int64 - r = int64(in[0]) - r |= int64(in[1]) << 8 - r |= int64(in[2]) << 16 - r |= int64(in[3]) << 24 - return r -} - -func FeFromBytes(dst *FieldElement, src *[32]byte) { - h0 := load4(src[:]) - h1 := load3(src[4:]) << 6 - h2 := load3(src[7:]) << 5 - h3 := load3(src[10:]) << 3 - h4 := load3(src[13:]) << 2 - h5 := load4(src[16:]) - h6 := load3(src[20:]) << 7 - h7 := load3(src[23:]) << 5 - h8 := load3(src[26:]) << 4 - h9 := (load3(src[29:]) & 8388607) << 2 - - FeCombine(dst, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) -} - -// FeToBytes marshals h to s. -// Preconditions: -// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. -// -// Write p=2^255-19; q=floor(h/p). -// Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))). -// -// Proof: -// Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4. -// Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4. -// -// Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9). -// Then 0> 25 - q = (h[0] + q) >> 26 - q = (h[1] + q) >> 25 - q = (h[2] + q) >> 26 - q = (h[3] + q) >> 25 - q = (h[4] + q) >> 26 - q = (h[5] + q) >> 25 - q = (h[6] + q) >> 26 - q = (h[7] + q) >> 25 - q = (h[8] + q) >> 26 - q = (h[9] + q) >> 25 - - // Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20. - h[0] += 19 * q - // Goal: Output h-2^255 q, which is between 0 and 2^255-20. - - carry[0] = h[0] >> 26 - h[1] += carry[0] - h[0] -= carry[0] << 26 - carry[1] = h[1] >> 25 - h[2] += carry[1] - h[1] -= carry[1] << 25 - carry[2] = h[2] >> 26 - h[3] += carry[2] - h[2] -= carry[2] << 26 - carry[3] = h[3] >> 25 - h[4] += carry[3] - h[3] -= carry[3] << 25 - carry[4] = h[4] >> 26 - h[5] += carry[4] - h[4] -= carry[4] << 26 - carry[5] = h[5] >> 25 - h[6] += carry[5] - h[5] -= carry[5] << 25 - carry[6] = h[6] >> 26 - h[7] += carry[6] - h[6] -= carry[6] << 26 - carry[7] = h[7] >> 25 - h[8] += carry[7] - h[7] -= carry[7] << 25 - carry[8] = h[8] >> 26 - h[9] += carry[8] - h[8] -= carry[8] << 26 - carry[9] = h[9] >> 25 - h[9] -= carry[9] << 25 - // h10 = carry9 - - // Goal: Output h[0]+...+2^255 h10-2^255 q, which is between 0 and 2^255-20. - // Have h[0]+...+2^230 h[9] between 0 and 2^255-1; - // evidently 2^255 h10-2^255 q = 0. - // Goal: Output h[0]+...+2^230 h[9]. - - s[0] = byte(h[0] >> 0) - s[1] = byte(h[0] >> 8) - s[2] = byte(h[0] >> 16) - s[3] = byte((h[0] >> 24) | (h[1] << 2)) - s[4] = byte(h[1] >> 6) - s[5] = byte(h[1] >> 14) - s[6] = byte((h[1] >> 22) | (h[2] << 3)) - s[7] = byte(h[2] >> 5) - s[8] = byte(h[2] >> 13) - s[9] = byte((h[2] >> 21) | (h[3] << 5)) - s[10] = byte(h[3] >> 3) - s[11] = byte(h[3] >> 11) - s[12] = byte((h[3] >> 19) | (h[4] << 6)) - s[13] = byte(h[4] >> 2) - s[14] = byte(h[4] >> 10) - s[15] = byte(h[4] >> 18) - s[16] = byte(h[5] >> 0) - s[17] = byte(h[5] >> 8) - s[18] = byte(h[5] >> 16) - s[19] = byte((h[5] >> 24) | (h[6] << 1)) - s[20] = byte(h[6] >> 7) - s[21] = byte(h[6] >> 15) - s[22] = byte((h[6] >> 23) | (h[7] << 3)) - s[23] = byte(h[7] >> 5) - s[24] = byte(h[7] >> 13) - s[25] = byte((h[7] >> 21) | (h[8] << 4)) - s[26] = byte(h[8] >> 4) - s[27] = byte(h[8] >> 12) - s[28] = byte((h[8] >> 20) | (h[9] << 6)) - s[29] = byte(h[9] >> 2) - s[30] = byte(h[9] >> 10) - s[31] = byte(h[9] >> 18) -} - -func FeIsNegative(f *FieldElement) byte { - var s [32]byte - FeToBytes(&s, f) - return s[0] & 1 -} - -func FeIsNonZero(f *FieldElement) int32 { - var s [32]byte - FeToBytes(&s, f) - var x uint8 - for _, b := range s { - x |= b - } - x |= x >> 4 - x |= x >> 2 - x |= x >> 1 - return int32(x & 1) -} - -// FeNeg sets h = -f -// -// Preconditions: -// |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. -// -// Postconditions: -// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. -func FeNeg(h, f *FieldElement) { - h[0] = -f[0] - h[1] = -f[1] - h[2] = -f[2] - h[3] = -f[3] - h[4] = -f[4] - h[5] = -f[5] - h[6] = -f[6] - h[7] = -f[7] - h[8] = -f[8] - h[9] = -f[9] -} - -func FeCombine(h *FieldElement, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) { - var c0, c1, c2, c3, c4, c5, c6, c7, c8, c9 int64 - - /* - |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38)) - i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8 - |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19)) - i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9 - */ - - c0 = (h0 + (1 << 25)) >> 26 - h1 += c0 - h0 -= c0 << 26 - c4 = (h4 + (1 << 25)) >> 26 - h5 += c4 - h4 -= c4 << 26 - /* |h0| <= 2^25 */ - /* |h4| <= 2^25 */ - /* |h1| <= 1.51*2^58 */ - /* |h5| <= 1.51*2^58 */ - - c1 = (h1 + (1 << 24)) >> 25 - h2 += c1 - h1 -= c1 << 25 - c5 = (h5 + (1 << 24)) >> 25 - h6 += c5 - h5 -= c5 << 25 - /* |h1| <= 2^24; from now on fits into int32 */ - /* |h5| <= 2^24; from now on fits into int32 */ - /* |h2| <= 1.21*2^59 */ - /* |h6| <= 1.21*2^59 */ - - c2 = (h2 + (1 << 25)) >> 26 - h3 += c2 - h2 -= c2 << 26 - c6 = (h6 + (1 << 25)) >> 26 - h7 += c6 - h6 -= c6 << 26 - /* |h2| <= 2^25; from now on fits into int32 unchanged */ - /* |h6| <= 2^25; from now on fits into int32 unchanged */ - /* |h3| <= 1.51*2^58 */ - /* |h7| <= 1.51*2^58 */ - - c3 = (h3 + (1 << 24)) >> 25 - h4 += c3 - h3 -= c3 << 25 - c7 = (h7 + (1 << 24)) >> 25 - h8 += c7 - h7 -= c7 << 25 - /* |h3| <= 2^24; from now on fits into int32 unchanged */ - /* |h7| <= 2^24; from now on fits into int32 unchanged */ - /* |h4| <= 1.52*2^33 */ - /* |h8| <= 1.52*2^33 */ - - c4 = (h4 + (1 << 25)) >> 26 - h5 += c4 - h4 -= c4 << 26 - c8 = (h8 + (1 << 25)) >> 26 - h9 += c8 - h8 -= c8 << 26 - /* |h4| <= 2^25; from now on fits into int32 unchanged */ - /* |h8| <= 2^25; from now on fits into int32 unchanged */ - /* |h5| <= 1.01*2^24 */ - /* |h9| <= 1.51*2^58 */ - - c9 = (h9 + (1 << 24)) >> 25 - h0 += c9 * 19 - h9 -= c9 << 25 - /* |h9| <= 2^24; from now on fits into int32 unchanged */ - /* |h0| <= 1.8*2^37 */ - - c0 = (h0 + (1 << 25)) >> 26 - h1 += c0 - h0 -= c0 << 26 - /* |h0| <= 2^25; from now on fits into int32 unchanged */ - /* |h1| <= 1.01*2^24 */ - - h[0] = int32(h0) - h[1] = int32(h1) - h[2] = int32(h2) - h[3] = int32(h3) - h[4] = int32(h4) - h[5] = int32(h5) - h[6] = int32(h6) - h[7] = int32(h7) - h[8] = int32(h8) - h[9] = int32(h9) -} - -// FeMul calculates h = f * g -// Can overlap h with f or g. -// -// Preconditions: -// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. -// |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. -// -// Postconditions: -// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. -// -// Notes on implementation strategy: -// -// Using schoolbook multiplication. -// Karatsuba would save a little in some cost models. -// -// Most multiplications by 2 and 19 are 32-bit precomputations; -// cheaper than 64-bit postcomputations. -// -// There is one remaining multiplication by 19 in the carry chain; -// one *19 precomputation can be merged into this, -// but the resulting data flow is considerably less clean. -// -// There are 12 carries below. -// 10 of them are 2-way parallelizable and vectorizable. -// Can get away with 11 carries, but then data flow is much deeper. -// -// With tighter constraints on inputs, can squeeze carries into int32. -func FeMul(h, f, g *FieldElement) { - f0 := int64(f[0]) - f1 := int64(f[1]) - f2 := int64(f[2]) - f3 := int64(f[3]) - f4 := int64(f[4]) - f5 := int64(f[5]) - f6 := int64(f[6]) - f7 := int64(f[7]) - f8 := int64(f[8]) - f9 := int64(f[9]) - - f1_2 := int64(2 * f[1]) - f3_2 := int64(2 * f[3]) - f5_2 := int64(2 * f[5]) - f7_2 := int64(2 * f[7]) - f9_2 := int64(2 * f[9]) - - g0 := int64(g[0]) - g1 := int64(g[1]) - g2 := int64(g[2]) - g3 := int64(g[3]) - g4 := int64(g[4]) - g5 := int64(g[5]) - g6 := int64(g[6]) - g7 := int64(g[7]) - g8 := int64(g[8]) - g9 := int64(g[9]) - - g1_19 := int64(19 * g[1]) /* 1.4*2^29 */ - g2_19 := int64(19 * g[2]) /* 1.4*2^30; still ok */ - g3_19 := int64(19 * g[3]) - g4_19 := int64(19 * g[4]) - g5_19 := int64(19 * g[5]) - g6_19 := int64(19 * g[6]) - g7_19 := int64(19 * g[7]) - g8_19 := int64(19 * g[8]) - g9_19 := int64(19 * g[9]) - - h0 := f0*g0 + f1_2*g9_19 + f2*g8_19 + f3_2*g7_19 + f4*g6_19 + f5_2*g5_19 + f6*g4_19 + f7_2*g3_19 + f8*g2_19 + f9_2*g1_19 - h1 := f0*g1 + f1*g0 + f2*g9_19 + f3*g8_19 + f4*g7_19 + f5*g6_19 + f6*g5_19 + f7*g4_19 + f8*g3_19 + f9*g2_19 - h2 := f0*g2 + f1_2*g1 + f2*g0 + f3_2*g9_19 + f4*g8_19 + f5_2*g7_19 + f6*g6_19 + f7_2*g5_19 + f8*g4_19 + f9_2*g3_19 - h3 := f0*g3 + f1*g2 + f2*g1 + f3*g0 + f4*g9_19 + f5*g8_19 + f6*g7_19 + f7*g6_19 + f8*g5_19 + f9*g4_19 - h4 := f0*g4 + f1_2*g3 + f2*g2 + f3_2*g1 + f4*g0 + f5_2*g9_19 + f6*g8_19 + f7_2*g7_19 + f8*g6_19 + f9_2*g5_19 - h5 := f0*g5 + f1*g4 + f2*g3 + f3*g2 + f4*g1 + f5*g0 + f6*g9_19 + f7*g8_19 + f8*g7_19 + f9*g6_19 - h6 := f0*g6 + f1_2*g5 + f2*g4 + f3_2*g3 + f4*g2 + f5_2*g1 + f6*g0 + f7_2*g9_19 + f8*g8_19 + f9_2*g7_19 - h7 := f0*g7 + f1*g6 + f2*g5 + f3*g4 + f4*g3 + f5*g2 + f6*g1 + f7*g0 + f8*g9_19 + f9*g8_19 - h8 := f0*g8 + f1_2*g7 + f2*g6 + f3_2*g5 + f4*g4 + f5_2*g3 + f6*g2 + f7_2*g1 + f8*g0 + f9_2*g9_19 - h9 := f0*g9 + f1*g8 + f2*g7 + f3*g6 + f4*g5 + f5*g4 + f6*g3 + f7*g2 + f8*g1 + f9*g0 - - FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) -} - -func feSquare(f *FieldElement) (h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 int64) { - f0 := int64(f[0]) - f1 := int64(f[1]) - f2 := int64(f[2]) - f3 := int64(f[3]) - f4 := int64(f[4]) - f5 := int64(f[5]) - f6 := int64(f[6]) - f7 := int64(f[7]) - f8 := int64(f[8]) - f9 := int64(f[9]) - f0_2 := int64(2 * f[0]) - f1_2 := int64(2 * f[1]) - f2_2 := int64(2 * f[2]) - f3_2 := int64(2 * f[3]) - f4_2 := int64(2 * f[4]) - f5_2 := int64(2 * f[5]) - f6_2 := int64(2 * f[6]) - f7_2 := int64(2 * f[7]) - f5_38 := 38 * f5 // 1.31*2^30 - f6_19 := 19 * f6 // 1.31*2^30 - f7_38 := 38 * f7 // 1.31*2^30 - f8_19 := 19 * f8 // 1.31*2^30 - f9_38 := 38 * f9 // 1.31*2^30 - - h0 = f0*f0 + f1_2*f9_38 + f2_2*f8_19 + f3_2*f7_38 + f4_2*f6_19 + f5*f5_38 - h1 = f0_2*f1 + f2*f9_38 + f3_2*f8_19 + f4*f7_38 + f5_2*f6_19 - h2 = f0_2*f2 + f1_2*f1 + f3_2*f9_38 + f4_2*f8_19 + f5_2*f7_38 + f6*f6_19 - h3 = f0_2*f3 + f1_2*f2 + f4*f9_38 + f5_2*f8_19 + f6*f7_38 - h4 = f0_2*f4 + f1_2*f3_2 + f2*f2 + f5_2*f9_38 + f6_2*f8_19 + f7*f7_38 - h5 = f0_2*f5 + f1_2*f4 + f2_2*f3 + f6*f9_38 + f7_2*f8_19 - h6 = f0_2*f6 + f1_2*f5_2 + f2_2*f4 + f3_2*f3 + f7_2*f9_38 + f8*f8_19 - h7 = f0_2*f7 + f1_2*f6 + f2_2*f5 + f3_2*f4 + f8*f9_38 - h8 = f0_2*f8 + f1_2*f7_2 + f2_2*f6 + f3_2*f5_2 + f4*f4 + f9*f9_38 - h9 = f0_2*f9 + f1_2*f8 + f2_2*f7 + f3_2*f6 + f4_2*f5 - - return -} - -// FeSquare calculates h = f*f. Can overlap h with f. -// -// Preconditions: -// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. -// -// Postconditions: -// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. -func FeSquare(h, f *FieldElement) { - h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 := feSquare(f) - FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) -} - -// FeSquare2 sets h = 2 * f * f -// -// Can overlap h with f. -// -// Preconditions: -// |f| bounded by 1.65*2^26,1.65*2^25,1.65*2^26,1.65*2^25,etc. -// -// Postconditions: -// |h| bounded by 1.01*2^25,1.01*2^24,1.01*2^25,1.01*2^24,etc. -// See fe_mul.c for discussion of implementation strategy. -func FeSquare2(h, f *FieldElement) { - h0, h1, h2, h3, h4, h5, h6, h7, h8, h9 := feSquare(f) - - h0 += h0 - h1 += h1 - h2 += h2 - h3 += h3 - h4 += h4 - h5 += h5 - h6 += h6 - h7 += h7 - h8 += h8 - h9 += h9 - - FeCombine(h, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9) -} - -func FeInvert(out, z *FieldElement) { - var t0, t1, t2, t3 FieldElement - var i int - - FeSquare(&t0, z) // 2^1 - FeSquare(&t1, &t0) // 2^2 - for i = 1; i < 2; i++ { // 2^3 - FeSquare(&t1, &t1) - } - FeMul(&t1, z, &t1) // 2^3 + 2^0 - FeMul(&t0, &t0, &t1) // 2^3 + 2^1 + 2^0 - FeSquare(&t2, &t0) // 2^4 + 2^2 + 2^1 - FeMul(&t1, &t1, &t2) // 2^4 + 2^3 + 2^2 + 2^1 + 2^0 - FeSquare(&t2, &t1) // 5,4,3,2,1 - for i = 1; i < 5; i++ { // 9,8,7,6,5 - FeSquare(&t2, &t2) - } - FeMul(&t1, &t2, &t1) // 9,8,7,6,5,4,3,2,1,0 - FeSquare(&t2, &t1) // 10..1 - for i = 1; i < 10; i++ { // 19..10 - FeSquare(&t2, &t2) - } - FeMul(&t2, &t2, &t1) // 19..0 - FeSquare(&t3, &t2) // 20..1 - for i = 1; i < 20; i++ { // 39..20 - FeSquare(&t3, &t3) - } - FeMul(&t2, &t3, &t2) // 39..0 - FeSquare(&t2, &t2) // 40..1 - for i = 1; i < 10; i++ { // 49..10 - FeSquare(&t2, &t2) - } - FeMul(&t1, &t2, &t1) // 49..0 - FeSquare(&t2, &t1) // 50..1 - for i = 1; i < 50; i++ { // 99..50 - FeSquare(&t2, &t2) - } - FeMul(&t2, &t2, &t1) // 99..0 - FeSquare(&t3, &t2) // 100..1 - for i = 1; i < 100; i++ { // 199..100 - FeSquare(&t3, &t3) - } - FeMul(&t2, &t3, &t2) // 199..0 - FeSquare(&t2, &t2) // 200..1 - for i = 1; i < 50; i++ { // 249..50 - FeSquare(&t2, &t2) - } - FeMul(&t1, &t2, &t1) // 249..0 - FeSquare(&t1, &t1) // 250..1 - for i = 1; i < 5; i++ { // 254..5 - FeSquare(&t1, &t1) - } - FeMul(out, &t1, &t0) // 254..5,3,1,0 -} - -func fePow22523(out, z *FieldElement) { - var t0, t1, t2 FieldElement - var i int - - FeSquare(&t0, z) - for i = 1; i < 1; i++ { - FeSquare(&t0, &t0) - } - FeSquare(&t1, &t0) - for i = 1; i < 2; i++ { - FeSquare(&t1, &t1) - } - FeMul(&t1, z, &t1) - FeMul(&t0, &t0, &t1) - FeSquare(&t0, &t0) - for i = 1; i < 1; i++ { - FeSquare(&t0, &t0) - } - FeMul(&t0, &t1, &t0) - FeSquare(&t1, &t0) - for i = 1; i < 5; i++ { - FeSquare(&t1, &t1) - } - FeMul(&t0, &t1, &t0) - FeSquare(&t1, &t0) - for i = 1; i < 10; i++ { - FeSquare(&t1, &t1) - } - FeMul(&t1, &t1, &t0) - FeSquare(&t2, &t1) - for i = 1; i < 20; i++ { - FeSquare(&t2, &t2) - } - FeMul(&t1, &t2, &t1) - FeSquare(&t1, &t1) - for i = 1; i < 10; i++ { - FeSquare(&t1, &t1) - } - FeMul(&t0, &t1, &t0) - FeSquare(&t1, &t0) - for i = 1; i < 50; i++ { - FeSquare(&t1, &t1) - } - FeMul(&t1, &t1, &t0) - FeSquare(&t2, &t1) - for i = 1; i < 100; i++ { - FeSquare(&t2, &t2) - } - FeMul(&t1, &t2, &t1) - FeSquare(&t1, &t1) - for i = 1; i < 50; i++ { - FeSquare(&t1, &t1) - } - FeMul(&t0, &t1, &t0) - FeSquare(&t0, &t0) - for i = 1; i < 2; i++ { - FeSquare(&t0, &t0) - } - FeMul(out, &t0, z) -} - -// Group elements are members of the elliptic curve -x^2 + y^2 = 1 + d * x^2 * -// y^2 where d = -121665/121666. -// -// Several representations are used: -// ProjectiveGroupElement: (X:Y:Z) satisfying x=X/Z, y=Y/Z -// ExtendedGroupElement: (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT -// CompletedGroupElement: ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T -// PreComputedGroupElement: (y+x,y-x,2dxy) - -type ProjectiveGroupElement struct { - X, Y, Z FieldElement -} - -type ExtendedGroupElement struct { - X, Y, Z, T FieldElement -} - -type CompletedGroupElement struct { - X, Y, Z, T FieldElement -} - -type PreComputedGroupElement struct { - yPlusX, yMinusX, xy2d FieldElement -} - -type CachedGroupElement struct { - yPlusX, yMinusX, Z, T2d FieldElement -} - -func (p *ProjectiveGroupElement) Zero() { - FeZero(&p.X) - FeOne(&p.Y) - FeOne(&p.Z) -} - -func (p *ProjectiveGroupElement) Double(r *CompletedGroupElement) { - var t0 FieldElement - - FeSquare(&r.X, &p.X) - FeSquare(&r.Z, &p.Y) - FeSquare2(&r.T, &p.Z) - FeAdd(&r.Y, &p.X, &p.Y) - FeSquare(&t0, &r.Y) - FeAdd(&r.Y, &r.Z, &r.X) - FeSub(&r.Z, &r.Z, &r.X) - FeSub(&r.X, &t0, &r.Y) - FeSub(&r.T, &r.T, &r.Z) -} - -func (p *ProjectiveGroupElement) ToBytes(s *[32]byte) { - var recip, x, y FieldElement - - FeInvert(&recip, &p.Z) - FeMul(&x, &p.X, &recip) - FeMul(&y, &p.Y, &recip) - FeToBytes(s, &y) - s[31] ^= FeIsNegative(&x) << 7 -} - -func (p *ExtendedGroupElement) Zero() { - FeZero(&p.X) - FeOne(&p.Y) - FeOne(&p.Z) - FeZero(&p.T) -} - -func (p *ExtendedGroupElement) Double(r *CompletedGroupElement) { - var q ProjectiveGroupElement - p.ToProjective(&q) - q.Double(r) -} - -func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement) { - FeAdd(&r.yPlusX, &p.Y, &p.X) - FeSub(&r.yMinusX, &p.Y, &p.X) - FeCopy(&r.Z, &p.Z) - FeMul(&r.T2d, &p.T, &d2) -} - -func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement) { - FeCopy(&r.X, &p.X) - FeCopy(&r.Y, &p.Y) - FeCopy(&r.Z, &p.Z) -} - -func (p *ExtendedGroupElement) ToBytes(s *[32]byte) { - var recip, x, y FieldElement - - FeInvert(&recip, &p.Z) - FeMul(&x, &p.X, &recip) - FeMul(&y, &p.Y, &recip) - FeToBytes(s, &y) - s[31] ^= FeIsNegative(&x) << 7 -} - -func (p *ExtendedGroupElement) FromBytes(s *[32]byte) bool { - var u, v, v3, vxx, check FieldElement - - FeFromBytes(&p.Y, s) - FeOne(&p.Z) - FeSquare(&u, &p.Y) - FeMul(&v, &u, &d) - FeSub(&u, &u, &p.Z) // y = y^2-1 - FeAdd(&v, &v, &p.Z) // v = dy^2+1 - - FeSquare(&v3, &v) - FeMul(&v3, &v3, &v) // v3 = v^3 - FeSquare(&p.X, &v3) - FeMul(&p.X, &p.X, &v) - FeMul(&p.X, &p.X, &u) // x = uv^7 - - fePow22523(&p.X, &p.X) // x = (uv^7)^((q-5)/8) - FeMul(&p.X, &p.X, &v3) - FeMul(&p.X, &p.X, &u) // x = uv^3(uv^7)^((q-5)/8) - - var tmpX, tmp2 [32]byte - - FeSquare(&vxx, &p.X) - FeMul(&vxx, &vxx, &v) - FeSub(&check, &vxx, &u) // vx^2-u - if FeIsNonZero(&check) == 1 { - FeAdd(&check, &vxx, &u) // vx^2+u - if FeIsNonZero(&check) == 1 { - return false - } - FeMul(&p.X, &p.X, &SqrtM1) - - FeToBytes(&tmpX, &p.X) - for i, v := range tmpX { - tmp2[31-i] = v - } - } - - if FeIsNegative(&p.X) != (s[31] >> 7) { - FeNeg(&p.X, &p.X) - } - - FeMul(&p.T, &p.X, &p.Y) - return true -} - -func (p *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement) { - FeMul(&r.X, &p.X, &p.T) - FeMul(&r.Y, &p.Y, &p.Z) - FeMul(&r.Z, &p.Z, &p.T) -} - -func (p *CompletedGroupElement) ToExtended(r *ExtendedGroupElement) { - FeMul(&r.X, &p.X, &p.T) - FeMul(&r.Y, &p.Y, &p.Z) - FeMul(&r.Z, &p.Z, &p.T) - FeMul(&r.T, &p.X, &p.Y) -} - -func (p *PreComputedGroupElement) Zero() { - FeOne(&p.yPlusX) - FeOne(&p.yMinusX) - FeZero(&p.xy2d) -} - -func geAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) { - var t0 FieldElement - - FeAdd(&r.X, &p.Y, &p.X) - FeSub(&r.Y, &p.Y, &p.X) - FeMul(&r.Z, &r.X, &q.yPlusX) - FeMul(&r.Y, &r.Y, &q.yMinusX) - FeMul(&r.T, &q.T2d, &p.T) - FeMul(&r.X, &p.Z, &q.Z) - FeAdd(&t0, &r.X, &r.X) - FeSub(&r.X, &r.Z, &r.Y) - FeAdd(&r.Y, &r.Z, &r.Y) - FeAdd(&r.Z, &t0, &r.T) - FeSub(&r.T, &t0, &r.T) -} - -func geSub(r *CompletedGroupElement, p *ExtendedGroupElement, q *CachedGroupElement) { - var t0 FieldElement - - FeAdd(&r.X, &p.Y, &p.X) - FeSub(&r.Y, &p.Y, &p.X) - FeMul(&r.Z, &r.X, &q.yMinusX) - FeMul(&r.Y, &r.Y, &q.yPlusX) - FeMul(&r.T, &q.T2d, &p.T) - FeMul(&r.X, &p.Z, &q.Z) - FeAdd(&t0, &r.X, &r.X) - FeSub(&r.X, &r.Z, &r.Y) - FeAdd(&r.Y, &r.Z, &r.Y) - FeSub(&r.Z, &t0, &r.T) - FeAdd(&r.T, &t0, &r.T) -} - -func geMixedAdd(r *CompletedGroupElement, p *ExtendedGroupElement, q *PreComputedGroupElement) { - var t0 FieldElement - - FeAdd(&r.X, &p.Y, &p.X) - FeSub(&r.Y, &p.Y, &p.X) - FeMul(&r.Z, &r.X, &q.yPlusX) - FeMul(&r.Y, &r.Y, &q.yMinusX) - FeMul(&r.T, &q.xy2d, &p.T) - FeAdd(&t0, &p.Z, &p.Z) - FeSub(&r.X, &r.Z, &r.Y) - FeAdd(&r.Y, &r.Z, &r.Y) - FeAdd(&r.Z, &t0, &r.T) - FeSub(&r.T, &t0, &r.T) -} - -func geMixedSub(r *CompletedGroupElement, p *ExtendedGroupElement, q *PreComputedGroupElement) { - var t0 FieldElement - - FeAdd(&r.X, &p.Y, &p.X) - FeSub(&r.Y, &p.Y, &p.X) - FeMul(&r.Z, &r.X, &q.yMinusX) - FeMul(&r.Y, &r.Y, &q.yPlusX) - FeMul(&r.T, &q.xy2d, &p.T) - FeAdd(&t0, &p.Z, &p.Z) - FeSub(&r.X, &r.Z, &r.Y) - FeAdd(&r.Y, &r.Z, &r.Y) - FeSub(&r.Z, &t0, &r.T) - FeAdd(&r.T, &t0, &r.T) -} - -func slide(r *[256]int8, a *[32]byte) { - for i := range r { - r[i] = int8(1 & (a[i>>3] >> uint(i&7))) - } - - for i := range r { - if r[i] != 0 { - for b := 1; b <= 6 && i+b < 256; b++ { - if r[i+b] != 0 { - if r[i]+(r[i+b]<= -15 { - r[i] -= r[i+b] << uint(b) - for k := i + b; k < 256; k++ { - if r[k] == 0 { - r[k] = 1 - break - } - r[k] = 0 - } - } else { - break - } - } - } - } - } -} - -// GeDoubleScalarMultVartime sets r = a*A + b*B -// where a = a[0]+256*a[1]+...+256^31 a[31]. -// and b = b[0]+256*b[1]+...+256^31 b[31]. -// B is the Ed25519 base point (x,4/5) with x positive. -func GeDoubleScalarMultVartime(r *ProjectiveGroupElement, a *[32]byte, A *ExtendedGroupElement, b *[32]byte) { - var aSlide, bSlide [256]int8 - var Ai [8]CachedGroupElement // A,3A,5A,7A,9A,11A,13A,15A - var t CompletedGroupElement - var u, A2 ExtendedGroupElement - var i int - - slide(&aSlide, a) - slide(&bSlide, b) - - A.ToCached(&Ai[0]) - A.Double(&t) - t.ToExtended(&A2) - - for i := 0; i < 7; i++ { - geAdd(&t, &A2, &Ai[i]) - t.ToExtended(&u) - u.ToCached(&Ai[i+1]) - } - - r.Zero() - - for i = 255; i >= 0; i-- { - if aSlide[i] != 0 || bSlide[i] != 0 { - break - } - } - - for ; i >= 0; i-- { - r.Double(&t) - - if aSlide[i] > 0 { - t.ToExtended(&u) - geAdd(&t, &u, &Ai[aSlide[i]/2]) - } else if aSlide[i] < 0 { - t.ToExtended(&u) - geSub(&t, &u, &Ai[(-aSlide[i])/2]) - } - - if bSlide[i] > 0 { - t.ToExtended(&u) - geMixedAdd(&t, &u, &bi[bSlide[i]/2]) - } else if bSlide[i] < 0 { - t.ToExtended(&u) - geMixedSub(&t, &u, &bi[(-bSlide[i])/2]) - } - - t.ToProjective(r) - } -} - -// equal returns 1 if b == c and 0 otherwise, assuming that b and c are -// non-negative. -func equal(b, c int32) int32 { - x := uint32(b ^ c) - x-- - return int32(x >> 31) -} - -// negative returns 1 if b < 0 and 0 otherwise. -func negative(b int32) int32 { - return (b >> 31) & 1 -} - -func PreComputedGroupElementCMove(t, u *PreComputedGroupElement, b int32) { - FeCMove(&t.yPlusX, &u.yPlusX, b) - FeCMove(&t.yMinusX, &u.yMinusX, b) - FeCMove(&t.xy2d, &u.xy2d, b) -} - -func selectPoint(t *PreComputedGroupElement, pos int32, b int32) { - var minusT PreComputedGroupElement - bNegative := negative(b) - bAbs := b - (((-bNegative) & b) << 1) - - t.Zero() - for i := int32(0); i < 8; i++ { - PreComputedGroupElementCMove(t, &base[pos][i], equal(bAbs, i+1)) - } - FeCopy(&minusT.yPlusX, &t.yMinusX) - FeCopy(&minusT.yMinusX, &t.yPlusX) - FeNeg(&minusT.xy2d, &t.xy2d) - PreComputedGroupElementCMove(t, &minusT, bNegative) -} - -// GeScalarMultBase computes h = a*B, where -// a = a[0]+256*a[1]+...+256^31 a[31] -// B is the Ed25519 base point (x,4/5) with x positive. -// -// Preconditions: -// a[31] <= 127 -func GeScalarMultBase(h *ExtendedGroupElement, a *[32]byte) { - var e [64]int8 - - for i, v := range a { - e[2*i] = int8(v & 15) - e[2*i+1] = int8((v >> 4) & 15) - } - - // each e[i] is between 0 and 15 and e[63] is between 0 and 7. - - carry := int8(0) - for i := 0; i < 63; i++ { - e[i] += carry - carry = (e[i] + 8) >> 4 - e[i] -= carry << 4 - } - e[63] += carry - // each e[i] is between -8 and 8. - - h.Zero() - var t PreComputedGroupElement - var r CompletedGroupElement - for i := int32(1); i < 64; i += 2 { - selectPoint(&t, i/2, int32(e[i])) - geMixedAdd(&r, h, &t) - r.ToExtended(h) - } - - var s ProjectiveGroupElement - - h.Double(&r) - r.ToProjective(&s) - s.Double(&r) - r.ToProjective(&s) - s.Double(&r) - r.ToProjective(&s) - s.Double(&r) - r.ToExtended(h) - - for i := int32(0); i < 64; i += 2 { - selectPoint(&t, i/2, int32(e[i])) - geMixedAdd(&r, h, &t) - r.ToExtended(h) - } -} - -// The scalars are GF(2^252 + 27742317777372353535851937790883648493). - -// Input: -// a[0]+256*a[1]+...+256^31*a[31] = a -// b[0]+256*b[1]+...+256^31*b[31] = b -// c[0]+256*c[1]+...+256^31*c[31] = c -// -// Output: -// s[0]+256*s[1]+...+256^31*s[31] = (ab+c) mod l -// where l = 2^252 + 27742317777372353535851937790883648493. -func ScMulAdd(s, a, b, c *[32]byte) { - a0 := 2097151 & load3(a[:]) - a1 := 2097151 & (load4(a[2:]) >> 5) - a2 := 2097151 & (load3(a[5:]) >> 2) - a3 := 2097151 & (load4(a[7:]) >> 7) - a4 := 2097151 & (load4(a[10:]) >> 4) - a5 := 2097151 & (load3(a[13:]) >> 1) - a6 := 2097151 & (load4(a[15:]) >> 6) - a7 := 2097151 & (load3(a[18:]) >> 3) - a8 := 2097151 & load3(a[21:]) - a9 := 2097151 & (load4(a[23:]) >> 5) - a10 := 2097151 & (load3(a[26:]) >> 2) - a11 := (load4(a[28:]) >> 7) - b0 := 2097151 & load3(b[:]) - b1 := 2097151 & (load4(b[2:]) >> 5) - b2 := 2097151 & (load3(b[5:]) >> 2) - b3 := 2097151 & (load4(b[7:]) >> 7) - b4 := 2097151 & (load4(b[10:]) >> 4) - b5 := 2097151 & (load3(b[13:]) >> 1) - b6 := 2097151 & (load4(b[15:]) >> 6) - b7 := 2097151 & (load3(b[18:]) >> 3) - b8 := 2097151 & load3(b[21:]) - b9 := 2097151 & (load4(b[23:]) >> 5) - b10 := 2097151 & (load3(b[26:]) >> 2) - b11 := (load4(b[28:]) >> 7) - c0 := 2097151 & load3(c[:]) - c1 := 2097151 & (load4(c[2:]) >> 5) - c2 := 2097151 & (load3(c[5:]) >> 2) - c3 := 2097151 & (load4(c[7:]) >> 7) - c4 := 2097151 & (load4(c[10:]) >> 4) - c5 := 2097151 & (load3(c[13:]) >> 1) - c6 := 2097151 & (load4(c[15:]) >> 6) - c7 := 2097151 & (load3(c[18:]) >> 3) - c8 := 2097151 & load3(c[21:]) - c9 := 2097151 & (load4(c[23:]) >> 5) - c10 := 2097151 & (load3(c[26:]) >> 2) - c11 := (load4(c[28:]) >> 7) - var carry [23]int64 - - s0 := c0 + a0*b0 - s1 := c1 + a0*b1 + a1*b0 - s2 := c2 + a0*b2 + a1*b1 + a2*b0 - s3 := c3 + a0*b3 + a1*b2 + a2*b1 + a3*b0 - s4 := c4 + a0*b4 + a1*b3 + a2*b2 + a3*b1 + a4*b0 - s5 := c5 + a0*b5 + a1*b4 + a2*b3 + a3*b2 + a4*b1 + a5*b0 - s6 := c6 + a0*b6 + a1*b5 + a2*b4 + a3*b3 + a4*b2 + a5*b1 + a6*b0 - s7 := c7 + a0*b7 + a1*b6 + a2*b5 + a3*b4 + a4*b3 + a5*b2 + a6*b1 + a7*b0 - s8 := c8 + a0*b8 + a1*b7 + a2*b6 + a3*b5 + a4*b4 + a5*b3 + a6*b2 + a7*b1 + a8*b0 - s9 := c9 + a0*b9 + a1*b8 + a2*b7 + a3*b6 + a4*b5 + a5*b4 + a6*b3 + a7*b2 + a8*b1 + a9*b0 - s10 := c10 + a0*b10 + a1*b9 + a2*b8 + a3*b7 + a4*b6 + a5*b5 + a6*b4 + a7*b3 + a8*b2 + a9*b1 + a10*b0 - s11 := c11 + a0*b11 + a1*b10 + a2*b9 + a3*b8 + a4*b7 + a5*b6 + a6*b5 + a7*b4 + a8*b3 + a9*b2 + a10*b1 + a11*b0 - s12 := a1*b11 + a2*b10 + a3*b9 + a4*b8 + a5*b7 + a6*b6 + a7*b5 + a8*b4 + a9*b3 + a10*b2 + a11*b1 - s13 := a2*b11 + a3*b10 + a4*b9 + a5*b8 + a6*b7 + a7*b6 + a8*b5 + a9*b4 + a10*b3 + a11*b2 - s14 := a3*b11 + a4*b10 + a5*b9 + a6*b8 + a7*b7 + a8*b6 + a9*b5 + a10*b4 + a11*b3 - s15 := a4*b11 + a5*b10 + a6*b9 + a7*b8 + a8*b7 + a9*b6 + a10*b5 + a11*b4 - s16 := a5*b11 + a6*b10 + a7*b9 + a8*b8 + a9*b7 + a10*b6 + a11*b5 - s17 := a6*b11 + a7*b10 + a8*b9 + a9*b8 + a10*b7 + a11*b6 - s18 := a7*b11 + a8*b10 + a9*b9 + a10*b8 + a11*b7 - s19 := a8*b11 + a9*b10 + a10*b9 + a11*b8 - s20 := a9*b11 + a10*b10 + a11*b9 - s21 := a10*b11 + a11*b10 - s22 := a11 * b11 - s23 := int64(0) - - carry[0] = (s0 + (1 << 20)) >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[2] = (s2 + (1 << 20)) >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[4] = (s4 + (1 << 20)) >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[6] = (s6 + (1 << 20)) >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[8] = (s8 + (1 << 20)) >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[10] = (s10 + (1 << 20)) >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - carry[12] = (s12 + (1 << 20)) >> 21 - s13 += carry[12] - s12 -= carry[12] << 21 - carry[14] = (s14 + (1 << 20)) >> 21 - s15 += carry[14] - s14 -= carry[14] << 21 - carry[16] = (s16 + (1 << 20)) >> 21 - s17 += carry[16] - s16 -= carry[16] << 21 - carry[18] = (s18 + (1 << 20)) >> 21 - s19 += carry[18] - s18 -= carry[18] << 21 - carry[20] = (s20 + (1 << 20)) >> 21 - s21 += carry[20] - s20 -= carry[20] << 21 - carry[22] = (s22 + (1 << 20)) >> 21 - s23 += carry[22] - s22 -= carry[22] << 21 - - carry[1] = (s1 + (1 << 20)) >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[3] = (s3 + (1 << 20)) >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[5] = (s5 + (1 << 20)) >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[7] = (s7 + (1 << 20)) >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[9] = (s9 + (1 << 20)) >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[11] = (s11 + (1 << 20)) >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - carry[13] = (s13 + (1 << 20)) >> 21 - s14 += carry[13] - s13 -= carry[13] << 21 - carry[15] = (s15 + (1 << 20)) >> 21 - s16 += carry[15] - s15 -= carry[15] << 21 - carry[17] = (s17 + (1 << 20)) >> 21 - s18 += carry[17] - s17 -= carry[17] << 21 - carry[19] = (s19 + (1 << 20)) >> 21 - s20 += carry[19] - s19 -= carry[19] << 21 - carry[21] = (s21 + (1 << 20)) >> 21 - s22 += carry[21] - s21 -= carry[21] << 21 - - s11 += s23 * 666643 - s12 += s23 * 470296 - s13 += s23 * 654183 - s14 -= s23 * 997805 - s15 += s23 * 136657 - s16 -= s23 * 683901 - s23 = 0 - - s10 += s22 * 666643 - s11 += s22 * 470296 - s12 += s22 * 654183 - s13 -= s22 * 997805 - s14 += s22 * 136657 - s15 -= s22 * 683901 - s22 = 0 - - s9 += s21 * 666643 - s10 += s21 * 470296 - s11 += s21 * 654183 - s12 -= s21 * 997805 - s13 += s21 * 136657 - s14 -= s21 * 683901 - s21 = 0 - - s8 += s20 * 666643 - s9 += s20 * 470296 - s10 += s20 * 654183 - s11 -= s20 * 997805 - s12 += s20 * 136657 - s13 -= s20 * 683901 - s20 = 0 - - s7 += s19 * 666643 - s8 += s19 * 470296 - s9 += s19 * 654183 - s10 -= s19 * 997805 - s11 += s19 * 136657 - s12 -= s19 * 683901 - s19 = 0 - - s6 += s18 * 666643 - s7 += s18 * 470296 - s8 += s18 * 654183 - s9 -= s18 * 997805 - s10 += s18 * 136657 - s11 -= s18 * 683901 - s18 = 0 - - carry[6] = (s6 + (1 << 20)) >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[8] = (s8 + (1 << 20)) >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[10] = (s10 + (1 << 20)) >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - carry[12] = (s12 + (1 << 20)) >> 21 - s13 += carry[12] - s12 -= carry[12] << 21 - carry[14] = (s14 + (1 << 20)) >> 21 - s15 += carry[14] - s14 -= carry[14] << 21 - carry[16] = (s16 + (1 << 20)) >> 21 - s17 += carry[16] - s16 -= carry[16] << 21 - - carry[7] = (s7 + (1 << 20)) >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[9] = (s9 + (1 << 20)) >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[11] = (s11 + (1 << 20)) >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - carry[13] = (s13 + (1 << 20)) >> 21 - s14 += carry[13] - s13 -= carry[13] << 21 - carry[15] = (s15 + (1 << 20)) >> 21 - s16 += carry[15] - s15 -= carry[15] << 21 - - s5 += s17 * 666643 - s6 += s17 * 470296 - s7 += s17 * 654183 - s8 -= s17 * 997805 - s9 += s17 * 136657 - s10 -= s17 * 683901 - s17 = 0 - - s4 += s16 * 666643 - s5 += s16 * 470296 - s6 += s16 * 654183 - s7 -= s16 * 997805 - s8 += s16 * 136657 - s9 -= s16 * 683901 - s16 = 0 - - s3 += s15 * 666643 - s4 += s15 * 470296 - s5 += s15 * 654183 - s6 -= s15 * 997805 - s7 += s15 * 136657 - s8 -= s15 * 683901 - s15 = 0 - - s2 += s14 * 666643 - s3 += s14 * 470296 - s4 += s14 * 654183 - s5 -= s14 * 997805 - s6 += s14 * 136657 - s7 -= s14 * 683901 - s14 = 0 - - s1 += s13 * 666643 - s2 += s13 * 470296 - s3 += s13 * 654183 - s4 -= s13 * 997805 - s5 += s13 * 136657 - s6 -= s13 * 683901 - s13 = 0 - - s0 += s12 * 666643 - s1 += s12 * 470296 - s2 += s12 * 654183 - s3 -= s12 * 997805 - s4 += s12 * 136657 - s5 -= s12 * 683901 - s12 = 0 - - carry[0] = (s0 + (1 << 20)) >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[2] = (s2 + (1 << 20)) >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[4] = (s4 + (1 << 20)) >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[6] = (s6 + (1 << 20)) >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[8] = (s8 + (1 << 20)) >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[10] = (s10 + (1 << 20)) >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - - carry[1] = (s1 + (1 << 20)) >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[3] = (s3 + (1 << 20)) >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[5] = (s5 + (1 << 20)) >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[7] = (s7 + (1 << 20)) >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[9] = (s9 + (1 << 20)) >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[11] = (s11 + (1 << 20)) >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - - s0 += s12 * 666643 - s1 += s12 * 470296 - s2 += s12 * 654183 - s3 -= s12 * 997805 - s4 += s12 * 136657 - s5 -= s12 * 683901 - s12 = 0 - - carry[0] = s0 >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[1] = s1 >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[2] = s2 >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[3] = s3 >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[4] = s4 >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[5] = s5 >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[6] = s6 >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[7] = s7 >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[8] = s8 >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[9] = s9 >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[10] = s10 >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - carry[11] = s11 >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - - s0 += s12 * 666643 - s1 += s12 * 470296 - s2 += s12 * 654183 - s3 -= s12 * 997805 - s4 += s12 * 136657 - s5 -= s12 * 683901 - s12 = 0 - - carry[0] = s0 >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[1] = s1 >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[2] = s2 >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[3] = s3 >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[4] = s4 >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[5] = s5 >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[6] = s6 >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[7] = s7 >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[8] = s8 >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[9] = s9 >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[10] = s10 >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - - s[0] = byte(s0 >> 0) - s[1] = byte(s0 >> 8) - s[2] = byte((s0 >> 16) | (s1 << 5)) - s[3] = byte(s1 >> 3) - s[4] = byte(s1 >> 11) - s[5] = byte((s1 >> 19) | (s2 << 2)) - s[6] = byte(s2 >> 6) - s[7] = byte((s2 >> 14) | (s3 << 7)) - s[8] = byte(s3 >> 1) - s[9] = byte(s3 >> 9) - s[10] = byte((s3 >> 17) | (s4 << 4)) - s[11] = byte(s4 >> 4) - s[12] = byte(s4 >> 12) - s[13] = byte((s4 >> 20) | (s5 << 1)) - s[14] = byte(s5 >> 7) - s[15] = byte((s5 >> 15) | (s6 << 6)) - s[16] = byte(s6 >> 2) - s[17] = byte(s6 >> 10) - s[18] = byte((s6 >> 18) | (s7 << 3)) - s[19] = byte(s7 >> 5) - s[20] = byte(s7 >> 13) - s[21] = byte(s8 >> 0) - s[22] = byte(s8 >> 8) - s[23] = byte((s8 >> 16) | (s9 << 5)) - s[24] = byte(s9 >> 3) - s[25] = byte(s9 >> 11) - s[26] = byte((s9 >> 19) | (s10 << 2)) - s[27] = byte(s10 >> 6) - s[28] = byte((s10 >> 14) | (s11 << 7)) - s[29] = byte(s11 >> 1) - s[30] = byte(s11 >> 9) - s[31] = byte(s11 >> 17) -} - -// Input: -// s[0]+256*s[1]+...+256^63*s[63] = s -// -// Output: -// s[0]+256*s[1]+...+256^31*s[31] = s mod l -// where l = 2^252 + 27742317777372353535851937790883648493. -func ScReduce(out *[32]byte, s *[64]byte) { - s0 := 2097151 & load3(s[:]) - s1 := 2097151 & (load4(s[2:]) >> 5) - s2 := 2097151 & (load3(s[5:]) >> 2) - s3 := 2097151 & (load4(s[7:]) >> 7) - s4 := 2097151 & (load4(s[10:]) >> 4) - s5 := 2097151 & (load3(s[13:]) >> 1) - s6 := 2097151 & (load4(s[15:]) >> 6) - s7 := 2097151 & (load3(s[18:]) >> 3) - s8 := 2097151 & load3(s[21:]) - s9 := 2097151 & (load4(s[23:]) >> 5) - s10 := 2097151 & (load3(s[26:]) >> 2) - s11 := 2097151 & (load4(s[28:]) >> 7) - s12 := 2097151 & (load4(s[31:]) >> 4) - s13 := 2097151 & (load3(s[34:]) >> 1) - s14 := 2097151 & (load4(s[36:]) >> 6) - s15 := 2097151 & (load3(s[39:]) >> 3) - s16 := 2097151 & load3(s[42:]) - s17 := 2097151 & (load4(s[44:]) >> 5) - s18 := 2097151 & (load3(s[47:]) >> 2) - s19 := 2097151 & (load4(s[49:]) >> 7) - s20 := 2097151 & (load4(s[52:]) >> 4) - s21 := 2097151 & (load3(s[55:]) >> 1) - s22 := 2097151 & (load4(s[57:]) >> 6) - s23 := (load4(s[60:]) >> 3) - - s11 += s23 * 666643 - s12 += s23 * 470296 - s13 += s23 * 654183 - s14 -= s23 * 997805 - s15 += s23 * 136657 - s16 -= s23 * 683901 - s23 = 0 - - s10 += s22 * 666643 - s11 += s22 * 470296 - s12 += s22 * 654183 - s13 -= s22 * 997805 - s14 += s22 * 136657 - s15 -= s22 * 683901 - s22 = 0 - - s9 += s21 * 666643 - s10 += s21 * 470296 - s11 += s21 * 654183 - s12 -= s21 * 997805 - s13 += s21 * 136657 - s14 -= s21 * 683901 - s21 = 0 - - s8 += s20 * 666643 - s9 += s20 * 470296 - s10 += s20 * 654183 - s11 -= s20 * 997805 - s12 += s20 * 136657 - s13 -= s20 * 683901 - s20 = 0 - - s7 += s19 * 666643 - s8 += s19 * 470296 - s9 += s19 * 654183 - s10 -= s19 * 997805 - s11 += s19 * 136657 - s12 -= s19 * 683901 - s19 = 0 - - s6 += s18 * 666643 - s7 += s18 * 470296 - s8 += s18 * 654183 - s9 -= s18 * 997805 - s10 += s18 * 136657 - s11 -= s18 * 683901 - s18 = 0 - - var carry [17]int64 - - carry[6] = (s6 + (1 << 20)) >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[8] = (s8 + (1 << 20)) >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[10] = (s10 + (1 << 20)) >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - carry[12] = (s12 + (1 << 20)) >> 21 - s13 += carry[12] - s12 -= carry[12] << 21 - carry[14] = (s14 + (1 << 20)) >> 21 - s15 += carry[14] - s14 -= carry[14] << 21 - carry[16] = (s16 + (1 << 20)) >> 21 - s17 += carry[16] - s16 -= carry[16] << 21 - - carry[7] = (s7 + (1 << 20)) >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[9] = (s9 + (1 << 20)) >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[11] = (s11 + (1 << 20)) >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - carry[13] = (s13 + (1 << 20)) >> 21 - s14 += carry[13] - s13 -= carry[13] << 21 - carry[15] = (s15 + (1 << 20)) >> 21 - s16 += carry[15] - s15 -= carry[15] << 21 - - s5 += s17 * 666643 - s6 += s17 * 470296 - s7 += s17 * 654183 - s8 -= s17 * 997805 - s9 += s17 * 136657 - s10 -= s17 * 683901 - s17 = 0 - - s4 += s16 * 666643 - s5 += s16 * 470296 - s6 += s16 * 654183 - s7 -= s16 * 997805 - s8 += s16 * 136657 - s9 -= s16 * 683901 - s16 = 0 - - s3 += s15 * 666643 - s4 += s15 * 470296 - s5 += s15 * 654183 - s6 -= s15 * 997805 - s7 += s15 * 136657 - s8 -= s15 * 683901 - s15 = 0 - - s2 += s14 * 666643 - s3 += s14 * 470296 - s4 += s14 * 654183 - s5 -= s14 * 997805 - s6 += s14 * 136657 - s7 -= s14 * 683901 - s14 = 0 - - s1 += s13 * 666643 - s2 += s13 * 470296 - s3 += s13 * 654183 - s4 -= s13 * 997805 - s5 += s13 * 136657 - s6 -= s13 * 683901 - s13 = 0 - - s0 += s12 * 666643 - s1 += s12 * 470296 - s2 += s12 * 654183 - s3 -= s12 * 997805 - s4 += s12 * 136657 - s5 -= s12 * 683901 - s12 = 0 - - carry[0] = (s0 + (1 << 20)) >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[2] = (s2 + (1 << 20)) >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[4] = (s4 + (1 << 20)) >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[6] = (s6 + (1 << 20)) >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[8] = (s8 + (1 << 20)) >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[10] = (s10 + (1 << 20)) >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - - carry[1] = (s1 + (1 << 20)) >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[3] = (s3 + (1 << 20)) >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[5] = (s5 + (1 << 20)) >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[7] = (s7 + (1 << 20)) >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[9] = (s9 + (1 << 20)) >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[11] = (s11 + (1 << 20)) >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - - s0 += s12 * 666643 - s1 += s12 * 470296 - s2 += s12 * 654183 - s3 -= s12 * 997805 - s4 += s12 * 136657 - s5 -= s12 * 683901 - s12 = 0 - - carry[0] = s0 >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[1] = s1 >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[2] = s2 >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[3] = s3 >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[4] = s4 >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[5] = s5 >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[6] = s6 >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[7] = s7 >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[8] = s8 >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[9] = s9 >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[10] = s10 >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - carry[11] = s11 >> 21 - s12 += carry[11] - s11 -= carry[11] << 21 - - s0 += s12 * 666643 - s1 += s12 * 470296 - s2 += s12 * 654183 - s3 -= s12 * 997805 - s4 += s12 * 136657 - s5 -= s12 * 683901 - s12 = 0 - - carry[0] = s0 >> 21 - s1 += carry[0] - s0 -= carry[0] << 21 - carry[1] = s1 >> 21 - s2 += carry[1] - s1 -= carry[1] << 21 - carry[2] = s2 >> 21 - s3 += carry[2] - s2 -= carry[2] << 21 - carry[3] = s3 >> 21 - s4 += carry[3] - s3 -= carry[3] << 21 - carry[4] = s4 >> 21 - s5 += carry[4] - s4 -= carry[4] << 21 - carry[5] = s5 >> 21 - s6 += carry[5] - s5 -= carry[5] << 21 - carry[6] = s6 >> 21 - s7 += carry[6] - s6 -= carry[6] << 21 - carry[7] = s7 >> 21 - s8 += carry[7] - s7 -= carry[7] << 21 - carry[8] = s8 >> 21 - s9 += carry[8] - s8 -= carry[8] << 21 - carry[9] = s9 >> 21 - s10 += carry[9] - s9 -= carry[9] << 21 - carry[10] = s10 >> 21 - s11 += carry[10] - s10 -= carry[10] << 21 - - out[0] = byte(s0 >> 0) - out[1] = byte(s0 >> 8) - out[2] = byte((s0 >> 16) | (s1 << 5)) - out[3] = byte(s1 >> 3) - out[4] = byte(s1 >> 11) - out[5] = byte((s1 >> 19) | (s2 << 2)) - out[6] = byte(s2 >> 6) - out[7] = byte((s2 >> 14) | (s3 << 7)) - out[8] = byte(s3 >> 1) - out[9] = byte(s3 >> 9) - out[10] = byte((s3 >> 17) | (s4 << 4)) - out[11] = byte(s4 >> 4) - out[12] = byte(s4 >> 12) - out[13] = byte((s4 >> 20) | (s5 << 1)) - out[14] = byte(s5 >> 7) - out[15] = byte((s5 >> 15) | (s6 << 6)) - out[16] = byte(s6 >> 2) - out[17] = byte(s6 >> 10) - out[18] = byte((s6 >> 18) | (s7 << 3)) - out[19] = byte(s7 >> 5) - out[20] = byte(s7 >> 13) - out[21] = byte(s8 >> 0) - out[22] = byte(s8 >> 8) - out[23] = byte((s8 >> 16) | (s9 << 5)) - out[24] = byte(s9 >> 3) - out[25] = byte(s9 >> 11) - out[26] = byte((s9 >> 19) | (s10 << 2)) - out[27] = byte(s10 >> 6) - out[28] = byte((s10 >> 14) | (s11 << 7)) - out[29] = byte(s11 >> 1) - out[30] = byte(s11 >> 9) - out[31] = byte(s11 >> 17) -} - -// order is the order of Curve25519 in little-endian form. -var order = [4]uint64{0x5812631a5cf5d3ed, 0x14def9dea2f79cd6, 0, 0x1000000000000000} - -// ScMinimal returns true if the given scalar is less than the order of the -// curve. -func ScMinimal(scalar *[32]byte) bool { - for i := 3; ; i-- { - v := binary.LittleEndian.Uint64(scalar[i*8:]) - if v > order[i] { - return false - } else if v < order[i] { - break - } else if i == 0 { - return false - } - } - - return true -} diff --git a/vendor/golang.org/x/mod/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go index 4338f351..7be398f8 100644 --- a/vendor/golang.org/x/mod/semver/semver.go +++ b/vendor/golang.org/x/mod/semver/semver.go @@ -22,6 +22,8 @@ // as shorthands for vMAJOR.0.0 and vMAJOR.MINOR.0. package semver +import "sort" + // parsed returns the parsed form of a semantic version string. type parsed struct { major string @@ -150,6 +152,24 @@ func Max(v, w string) string { return w } +// ByVersion implements sort.Interface for sorting semantic version strings. +type ByVersion []string + +func (vs ByVersion) Len() int { return len(vs) } +func (vs ByVersion) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] } +func (vs ByVersion) Less(i, j int) bool { + cmp := Compare(vs[i], vs[j]) + if cmp != 0 { + return cmp < 0 + } + return vs[i] < vs[j] +} + +// Sort sorts a list of semantic version strings using ByVersion. +func Sort(list []string) { + sort.Sort(ByVersion(list)) +} + func parse(v string) (p parsed, ok bool) { if v == "" || v[0] != 'v' { p.err = "missing v prefix" diff --git a/vendor/golang.org/x/net/icmp/helper_posix.go b/vendor/golang.org/x/net/icmp/helper_posix.go index 75e75575..6c3ebfae 100644 --- a/vendor/golang.org/x/net/icmp/helper_posix.go +++ b/vendor/golang.org/x/net/icmp/helper_posix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package icmp diff --git a/vendor/golang.org/x/net/icmp/listen_posix.go b/vendor/golang.org/x/net/icmp/listen_posix.go index 327abf84..bcad739b 100644 --- a/vendor/golang.org/x/net/icmp/listen_posix.go +++ b/vendor/golang.org/x/net/icmp/listen_posix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package icmp diff --git a/vendor/golang.org/x/net/icmp/listen_stub.go b/vendor/golang.org/x/net/icmp/listen_stub.go index 3acd91dc..bc9343c4 100644 --- a/vendor/golang.org/x/net/icmp/listen_stub.go +++ b/vendor/golang.org/x/net/icmp/listen_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows package icmp diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr.go b/vendor/golang.org/x/net/internal/socket/cmsghdr.go index 0cde35a4..4bdaaaf1 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go index 14dbb3ad..0d30e0a0 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd // +build aix darwin dragonfly freebsd netbsd openbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go index bac66811..4936e8a6 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build arm mips mipsle 386 +//go:build (arm || mips || mipsle || 386 || ppc) && linux +// +build arm mips mipsle 386 ppc // +build linux package socket diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go index 27be0efa..1ba43101 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux // +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x // +build linux diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go index 7dedd430..d3dbe1b8 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 -// +build solaris +//go:build amd64 && solaris +// +build amd64,solaris package socket diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go index 83c35ecd..1d9f2ed6 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go b/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go index c2b2b659..aa1b0620 100644 --- a/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go +++ b/vendor/golang.org/x/net/internal/socket/cmsghdr_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package socket diff --git a/vendor/golang.org/x/net/internal/socket/complete_dontwait.go b/vendor/golang.org/x/net/internal/socket/complete_dontwait.go new file mode 100644 index 00000000..5b1d50ae --- /dev/null +++ b/vendor/golang.org/x/net/internal/socket/complete_dontwait.go @@ -0,0 +1,26 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris + +package socket + +import ( + "syscall" +) + +// ioComplete checks the flags and result of a syscall, to be used as return +// value in a syscall.RawConn.Read or Write callback. +func ioComplete(flags int, operr error) bool { + if flags&syscall.MSG_DONTWAIT != 0 { + // Caller explicitly said don't wait, so always return immediately. + return true + } + if operr == syscall.EAGAIN || operr == syscall.EWOULDBLOCK { + // No data available, block for I/O and try again. + return false + } + return true +} diff --git a/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go b/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go new file mode 100644 index 00000000..be634095 --- /dev/null +++ b/vendor/golang.org/x/net/internal/socket/complete_nodontwait.go @@ -0,0 +1,22 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build aix || windows || zos +// +build aix windows zos + +package socket + +import ( + "syscall" +) + +// ioComplete checks the flags and result of a syscall, to be used as return +// value in a syscall.RawConn.Read or Write callback. +func ioComplete(flags int, operr error) bool { + if operr == syscall.EAGAIN || operr == syscall.EWOULDBLOCK { + // No data available, block for I/O and try again. + return false + } + return true +} diff --git a/vendor/golang.org/x/net/internal/socket/error_unix.go b/vendor/golang.org/x/net/internal/socket/error_unix.go index 47f0d6e2..78f41290 100644 --- a/vendor/golang.org/x/net/internal/socket/error_unix.go +++ b/vendor/golang.org/x/net/internal/socket/error_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/iovec_32bit.go b/vendor/golang.org/x/net/internal/socket/iovec_32bit.go index 05d6082d..2b8fbb3f 100644 --- a/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +++ b/vendor/golang.org/x/net/internal/socket/iovec_32bit.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build arm mips mipsle 386 +//go:build (arm || mips || mipsle || 386 || ppc) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd) +// +build arm mips mipsle 386 ppc // +build darwin dragonfly freebsd linux netbsd openbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/iovec_64bit.go b/vendor/golang.org/x/net/internal/socket/iovec_64bit.go index 0309e10f..3dc5def2 100644 --- a/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +++ b/vendor/golang.org/x/net/internal/socket/iovec_64bit.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos) // +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x // +build aix darwin dragonfly freebsd linux netbsd openbsd zos diff --git a/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go b/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go index 8d17a40c..f7da2bc4 100644 --- a/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +++ b/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 -// +build solaris +//go:build amd64 && solaris +// +build amd64,solaris package socket diff --git a/vendor/golang.org/x/net/internal/socket/iovec_stub.go b/vendor/golang.org/x/net/internal/socket/iovec_stub.go index f44d4f52..14caf524 100644 --- a/vendor/golang.org/x/net/internal/socket/iovec_stub.go +++ b/vendor/golang.org/x/net/internal/socket/iovec_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go b/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go index 1a7f2792..113e773c 100644 --- a/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +++ b/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !linux && !netbsd // +build !aix,!linux,!netbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go b/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go index f1100683..40ebedab 100644 --- a/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +++ b/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go @@ -2,29 +2,18 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || linux || netbsd // +build aix linux netbsd package socket -import "net" +import ( + "net" + "sync" +) type mmsghdrs []mmsghdr -func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { - for i := range hs { - vs := make([]iovec, len(ms[i].Buffers)) - var sa []byte - if parseFn != nil { - sa = make([]byte, sizeofSockaddrInet6) - } - if marshalFn != nil { - sa = marshalFn(ms[i].Addr) - } - hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa) - } - return nil -} - func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { for i := range hs { ms[i].N = int(hs[i].Len) @@ -40,3 +29,86 @@ func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, } return nil } + +// mmsghdrsPacker packs Message-slices into mmsghdrs (re-)using pre-allocated buffers. +type mmsghdrsPacker struct { + // hs are the pre-allocated mmsghdrs. + hs mmsghdrs + // sockaddrs is the pre-allocated buffer for the Hdr.Name buffers. + // We use one large buffer for all messages and slice it up. + sockaddrs []byte + // vs are the pre-allocated iovecs. + // We allocate one large buffer for all messages and slice it up. This allows to reuse the buffer + // if the number of buffers per message is distributed differently between calls. + vs []iovec +} + +func (p *mmsghdrsPacker) prepare(ms []Message) { + n := len(ms) + if n <= cap(p.hs) { + p.hs = p.hs[:n] + } else { + p.hs = make(mmsghdrs, n) + } + if n*sizeofSockaddrInet6 <= cap(p.sockaddrs) { + p.sockaddrs = p.sockaddrs[:n*sizeofSockaddrInet6] + } else { + p.sockaddrs = make([]byte, n*sizeofSockaddrInet6) + } + + nb := 0 + for _, m := range ms { + nb += len(m.Buffers) + } + if nb <= cap(p.vs) { + p.vs = p.vs[:nb] + } else { + p.vs = make([]iovec, nb) + } +} + +func (p *mmsghdrsPacker) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr, []byte) int) mmsghdrs { + p.prepare(ms) + hs := p.hs + vsRest := p.vs + saRest := p.sockaddrs + for i := range hs { + nvs := len(ms[i].Buffers) + vs := vsRest[:nvs] + vsRest = vsRest[nvs:] + + var sa []byte + if parseFn != nil { + sa = saRest[:sizeofSockaddrInet6] + saRest = saRest[sizeofSockaddrInet6:] + } else if marshalFn != nil { + n := marshalFn(ms[i].Addr, saRest) + if n > 0 { + sa = saRest[:n] + saRest = saRest[n:] + } + } + hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa) + } + return hs +} + +var defaultMmsghdrsPool = mmsghdrsPool{ + p: sync.Pool{ + New: func() interface{} { + return new(mmsghdrsPacker) + }, + }, +} + +type mmsghdrsPool struct { + p sync.Pool +} + +func (p *mmsghdrsPool) Get() *mmsghdrsPacker { + return p.p.Get().(*mmsghdrsPacker) +} + +func (p *mmsghdrsPool) Put(packer *mmsghdrsPacker) { + p.p.Put(packer) +} diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go b/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go index 77f44c1f..25f6847f 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd // +build aix darwin dragonfly freebsd netbsd openbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go b/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go index c5562dd6..5b8e00f1 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || netbsd // +build aix darwin dragonfly freebsd netbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_linux.go b/vendor/golang.org/x/net/internal/socket/msghdr_linux.go index 5a38798c..c3c7cc4c 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_linux.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_linux.go @@ -17,6 +17,9 @@ func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { if sa != nil { h.Name = (*byte)(unsafe.Pointer(&sa[0])) h.Namelen = uint32(len(sa)) + } else { + h.Name = nil + h.Namelen = 0 } } diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go b/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go index a7a5987c..b4658fba 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build arm mips mipsle 386 +//go:build (arm || mips || mipsle || 386 || ppc) && linux +// +build arm mips mipsle 386 ppc // +build linux package socket diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go b/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go index e731833a..c9c592dd 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux // +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x // +build linux diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go b/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go index 6465b207..3098f5d7 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 -// +build solaris +//go:build amd64 && solaris +// +build amd64,solaris package socket diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_stub.go b/vendor/golang.org/x/net/internal/socket/msghdr_stub.go index 1a253d2d..eb79151f 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go b/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go index eb1a99a3..324e9ee7 100644 --- a/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go +++ b/vendor/golang.org/x/net/internal/socket/msghdr_zos_s390x.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build s390x -// +build zos +//go:build s390x && zos +// +build s390x,zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/norace.go b/vendor/golang.org/x/net/internal/socket/norace.go index 9519ffbb..de0ad420 100644 --- a/vendor/golang.org/x/net/internal/socket/norace.go +++ b/vendor/golang.org/x/net/internal/socket/norace.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !race // +build !race package socket diff --git a/vendor/golang.org/x/net/internal/socket/race.go b/vendor/golang.org/x/net/internal/socket/race.go index df60c62f..f0a28a62 100644 --- a/vendor/golang.org/x/net/internal/socket/race.go +++ b/vendor/golang.org/x/net/internal/socket/race.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build race // +build race package socket diff --git a/vendor/golang.org/x/net/internal/socket/rawconn.go b/vendor/golang.org/x/net/internal/socket/rawconn.go index b07b8900..87e81071 100644 --- a/vendor/golang.org/x/net/internal/socket/rawconn.go +++ b/vendor/golang.org/x/net/internal/socket/rawconn.go @@ -17,18 +17,45 @@ type Conn struct { c syscall.RawConn } +// tcpConn is an interface implemented by net.TCPConn. +// It can be used for interface assertions to check if a net.Conn is a TCP connection. +type tcpConn interface { + SyscallConn() (syscall.RawConn, error) + SetLinger(int) error +} + +var _ tcpConn = (*net.TCPConn)(nil) + +// udpConn is an interface implemented by net.UDPConn. +// It can be used for interface assertions to check if a net.Conn is a UDP connection. +type udpConn interface { + SyscallConn() (syscall.RawConn, error) + ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *net.UDPAddr, err error) +} + +var _ udpConn = (*net.UDPConn)(nil) + +// ipConn is an interface implemented by net.IPConn. +// It can be used for interface assertions to check if a net.Conn is an IP connection. +type ipConn interface { + SyscallConn() (syscall.RawConn, error) + ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *net.IPAddr, err error) +} + +var _ ipConn = (*net.IPConn)(nil) + // NewConn returns a new raw connection. func NewConn(c net.Conn) (*Conn, error) { var err error var cc Conn switch c := c.(type) { - case *net.TCPConn: + case tcpConn: cc.network = "tcp" cc.c, err = c.SyscallConn() - case *net.UDPConn: + case udpConn: cc.network = "udp" cc.c, err = c.SyscallConn() - case *net.IPConn: + case ipConn: cc.network = "ip" cc.c, err = c.SyscallConn() default: diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go b/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go index d01fc4c7..3fcb51b3 100644 --- a/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +++ b/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package socket @@ -9,29 +10,24 @@ package socket import ( "net" "os" - "syscall" ) func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { for i := range ms { ms[i].raceWrite() } - hs := make(mmsghdrs, len(ms)) + packer := defaultMmsghdrsPool.Get() + defer defaultMmsghdrsPool.Put(packer) var parseFn func([]byte, string) (net.Addr, error) if c.network != "tcp" { parseFn = parseInetAddr } - if err := hs.pack(ms, parseFn, nil); err != nil { - return 0, err - } + hs := packer.pack(ms, parseFn, nil) var operr error var n int fn := func(s uintptr) bool { n, operr = recvmmsg(s, hs, flags) - if operr == syscall.EAGAIN { - return false - } - return true + return ioComplete(flags, operr) } if err := c.c.Read(fn); err != nil { return n, err @@ -49,22 +45,18 @@ func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { for i := range ms { ms[i].raceRead() } - hs := make(mmsghdrs, len(ms)) - var marshalFn func(net.Addr) []byte + packer := defaultMmsghdrsPool.Get() + defer defaultMmsghdrsPool.Put(packer) + var marshalFn func(net.Addr, []byte) int if c.network != "tcp" { marshalFn = marshalInetAddr } - if err := hs.pack(ms, nil, marshalFn); err != nil { - return 0, err - } + hs := packer.pack(ms, nil, marshalFn) var operr error var n int fn := func(s uintptr) bool { n, operr = sendmmsg(s, hs, flags) - if operr == syscall.EAGAIN { - return false - } - return true + return ioComplete(flags, operr) } if err := c.c.Write(fn); err != nil { return n, err diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_msg.go b/vendor/golang.org/x/net/internal/socket/rawconn_msg.go index 610b1a1a..ba53f564 100644 --- a/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +++ b/vendor/golang.org/x/net/internal/socket/rawconn_msg.go @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package socket import ( "os" - "runtime" - "syscall" ) func (c *Conn) recvMsg(m *Message, flags int) error { @@ -25,10 +24,7 @@ func (c *Conn) recvMsg(m *Message, flags int) error { var n int fn := func(s uintptr) bool { n, operr = recvmsg(s, &h, flags) - if operr == syscall.EAGAIN || (runtime.GOOS == "zos" && operr == syscall.EWOULDBLOCK) { - return false - } - return true + return ioComplete(flags, operr) } if err := c.c.Read(fn); err != nil { return err @@ -55,17 +51,16 @@ func (c *Conn) sendMsg(m *Message, flags int) error { vs := make([]iovec, len(m.Buffers)) var sa []byte if m.Addr != nil { - sa = marshalInetAddr(m.Addr) + var a [sizeofSockaddrInet6]byte + n := marshalInetAddr(m.Addr, a[:]) + sa = a[:n] } h.pack(vs, m.Buffers, m.OOB, sa) var operr error var n int fn := func(s uintptr) bool { n, operr = sendmsg(s, &h, flags) - if operr == syscall.EAGAIN || (runtime.GOOS == "zos" && operr == syscall.EWOULDBLOCK) { - return false - } - return true + return ioComplete(flags, operr) } if err := c.c.Write(fn); err != nil { return err diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go b/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go index fe5bb942..02f32855 100644 --- a/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +++ b/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package socket diff --git a/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go b/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go index e51b60d1..dd785877 100644 --- a/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +++ b/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package socket diff --git a/vendor/golang.org/x/net/internal/socket/sys_bsd.go b/vendor/golang.org/x/net/internal/socket/sys_bsd.go index d432835b..b6cd7708 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_bsd.go +++ b/vendor/golang.org/x/net/internal/socket/sys_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || openbsd // +build aix darwin dragonfly freebsd openbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/sys_const_unix.go b/vendor/golang.org/x/net/internal/socket/sys_const_unix.go index 43797d6e..5d99f237 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_const_unix.go +++ b/vendor/golang.org/x/net/internal/socket/sys_const_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package socket @@ -14,4 +15,7 @@ const ( sysAF_INET6 = unix.AF_INET6 sysSOCK_RAW = unix.SOCK_RAW + + sizeofSockaddrInet4 = unix.SizeofSockaddrInet4 + sizeofSockaddrInet6 = unix.SizeofSockaddrInet6 ) diff --git a/vendor/golang.org/x/net/internal/socket/sys_const_zos.go b/vendor/golang.org/x/net/internal/socket/sys_const_zos.go deleted file mode 100644 index 01b63720..00000000 --- a/vendor/golang.org/x/net/internal/socket/sys_const_zos.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build zos - -package socket - -import "syscall" - -const ( - sysAF_UNSPEC = syscall.AF_UNSPEC - sysAF_INET = syscall.AF_INET - sysAF_INET6 = syscall.AF_INET6 - - sysSOCK_RAW = syscall.SOCK_RAW -) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linkname.go b/vendor/golang.org/x/net/internal/socket/sys_linkname.go index 61c3f38a..21734af4 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_linkname.go +++ b/vendor/golang.org/x/net/internal/socket/sys_linkname.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || (go1.12 && darwin) // +build aix go1.12,darwin package socket diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux.go b/vendor/golang.org/x/net/internal/socket/sys_linux.go index 8b03cd6d..76f5b8ae 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_linux.go +++ b/vendor/golang.org/x/net/internal/socket/sys_linux.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && !s390x && !386 // +build linux,!s390x,!386 package socket diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_ppc.go b/vendor/golang.org/x/net/internal/socket/sys_linux_ppc.go new file mode 100644 index 00000000..90cfaa9f --- /dev/null +++ b/vendor/golang.org/x/net/internal/socket/sys_linux_ppc.go @@ -0,0 +1,10 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package socket + +const ( + sysRECVMMSG = 0x157 + sysSENDMMSG = 0x15d +) diff --git a/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go b/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go index 64f69f1d..5b128fbb 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go +++ b/vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build riscv64 // +build riscv64 package socket diff --git a/vendor/golang.org/x/net/internal/socket/sys_posix.go b/vendor/golang.org/x/net/internal/socket/sys_posix.go index 05ded237..42b8f234 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_posix.go +++ b/vendor/golang.org/x/net/internal/socket/sys_posix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package socket @@ -16,35 +17,36 @@ import ( "time" ) -func marshalInetAddr(a net.Addr) []byte { +// marshalInetAddr writes a in sockaddr format into the buffer b. +// The buffer must be sufficiently large (sizeofSockaddrInet4/6). +// Returns the number of bytes written. +func marshalInetAddr(a net.Addr, b []byte) int { switch a := a.(type) { case *net.TCPAddr: - return marshalSockaddr(a.IP, a.Port, a.Zone) + return marshalSockaddr(a.IP, a.Port, a.Zone, b) case *net.UDPAddr: - return marshalSockaddr(a.IP, a.Port, a.Zone) + return marshalSockaddr(a.IP, a.Port, a.Zone, b) case *net.IPAddr: - return marshalSockaddr(a.IP, 0, a.Zone) + return marshalSockaddr(a.IP, 0, a.Zone, b) default: - return nil + return 0 } } -func marshalSockaddr(ip net.IP, port int, zone string) []byte { +func marshalSockaddr(ip net.IP, port int, zone string, b []byte) int { if ip4 := ip.To4(); ip4 != nil { - b := make([]byte, sizeofSockaddrInet) switch runtime.GOOS { case "android", "illumos", "linux", "solaris", "windows": NativeEndian.PutUint16(b[:2], uint16(sysAF_INET)) default: - b[0] = sizeofSockaddrInet + b[0] = sizeofSockaddrInet4 b[1] = sysAF_INET } binary.BigEndian.PutUint16(b[2:4], uint16(port)) copy(b[4:8], ip4) - return b + return sizeofSockaddrInet4 } if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil { - b := make([]byte, sizeofSockaddrInet6) switch runtime.GOOS { case "android", "illumos", "linux", "solaris", "windows": NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6)) @@ -57,9 +59,9 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { if zone != "" { NativeEndian.PutUint32(b[24:28], uint32(zoneCache.index(zone))) } - return b + return sizeofSockaddrInet6 } - return nil + return 0 } func parseInetAddr(b []byte, network string) (net.Addr, error) { @@ -76,7 +78,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) { var ip net.IP var zone string if af == sysAF_INET { - if len(b) < sizeofSockaddrInet { + if len(b) < sizeofSockaddrInet4 { return nil, errors.New("short address") } ip = make(net.IP, net.IPv4len) diff --git a/vendor/golang.org/x/net/internal/socket/sys_stub.go b/vendor/golang.org/x/net/internal/socket/sys_stub.go index 3c97008d..381e45e1 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_stub.go +++ b/vendor/golang.org/x/net/internal/socket/sys_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package socket @@ -14,6 +15,9 @@ const ( sysAF_INET6 = 0xa sysSOCK_RAW = 0x3 + + sizeofSockaddrInet4 = 0x10 + sizeofSockaddrInet6 = 0x1c ) func marshalInetAddr(ip net.IP, port int, zone string) []byte { diff --git a/vendor/golang.org/x/net/internal/socket/sys_unix.go b/vendor/golang.org/x/net/internal/socket/sys_unix.go index 0eb71283..c98ebae5 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_unix.go +++ b/vendor/golang.org/x/net/internal/socket/sys_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build dragonfly || freebsd || (linux && !s390x && !386) || netbsd || openbsd // +build dragonfly freebsd linux,!s390x,!386 netbsd openbsd package socket diff --git a/vendor/golang.org/x/net/internal/socket/sys_windows.go b/vendor/golang.org/x/net/internal/socket/sys_windows.go index d556a446..2de0d68c 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_windows.go +++ b/vendor/golang.org/x/net/internal/socket/sys_windows.go @@ -22,25 +22,8 @@ const ( sysAF_INET6 = windows.AF_INET6 sysSOCK_RAW = windows.SOCK_RAW -) -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -const ( - sizeofSockaddrInet = 0x10 + sizeofSockaddrInet4 = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go b/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go index 93d923ad..00691bd5 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go @@ -2,6 +2,7 @@ // cgo -godefs defs_aix.go // Added for go1.11 compatibility +//go:build aix // +build aix package socket @@ -33,27 +34,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go index 150f980f..5acf6db6 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go index a686c952..98dcfe41 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go index 150f980f..5acf6db6 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go index a686c952..98dcfe41 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go index d45c197e..636d129a 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go index ffec860e..87707fed 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go index aa701ab6..7db77811 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go index ffec860e..87707fed 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go index aa701ab6..7db77811 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go index 0c847bee..4c19269b 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go @@ -29,25 +29,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go index 0c847bee..4c19269b 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go @@ -29,25 +29,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go index 0c847bee..4c19269b 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go @@ -29,25 +29,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go index 0c847bee..4c19269b 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go @@ -29,25 +29,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc.go new file mode 100644 index 00000000..59b71da5 --- /dev/null +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc.go @@ -0,0 +1,35 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs defs_linux.go + +package socket + +type iovec struct { + Base *byte + Len uint32 +} + +type msghdr struct { + Name *byte + Namelen uint32 + Iov *iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type mmsghdr struct { + Hdr msghdr + Len uint32 +} + +type cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +const ( + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c +) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go index 8640c03e..c066272d 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go @@ -1,6 +1,7 @@ // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs defs_linux.go +//go:build riscv64 // +build riscv64 package socket @@ -33,25 +34,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go b/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go index 15e2aeca..3dcd5c8e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go @@ -32,25 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - X__pad [8]uint8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go index 6b72d24d..f95572dc 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go @@ -29,27 +29,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go index 9aaa4ab1..a92fd60e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go @@ -32,27 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go index 6b72d24d..f95572dc 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go @@ -29,27 +29,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go index 9aaa4ab1..a92fd60e 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go @@ -32,27 +32,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go index 3ec8d42f..e792ec21 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go index ea0ee008..b68ff2d5 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go index 3ec8d42f..e792ec21 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go index ea0ee008..b68ff2d5 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go @@ -26,27 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_mips64.go b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_mips64.go index 01128324..3c9576e2 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_openbsd_mips64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_openbsd_mips64.go @@ -24,27 +24,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x1c ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go b/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go index 48b2b591..359cfec4 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go @@ -26,26 +26,7 @@ type cmsghdr struct { Type int32 } -type sockaddrInet struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type sockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 - X__sin6_src_id uint32 -} - const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - - sizeofSockaddrInet = 0x10 - sizeofSockaddrInet6 = 0x20 ) diff --git a/vendor/golang.org/x/net/internal/socket/zsys_zos_s390x.go b/vendor/golang.org/x/net/internal/socket/zsys_zos_s390x.go index 514ca375..49b62c85 100644 --- a/vendor/golang.org/x/net/internal/socket/zsys_zos_s390x.go +++ b/vendor/golang.org/x/net/internal/socket/zsys_zos_s390x.go @@ -25,8 +25,4 @@ type cmsghdr struct { Type int32 } -const ( - sizeofCmsghdr = 12 - sizeofSockaddrInet = 16 - sizeofSockaddrInet6 = 28 -) +const sizeofCmsghdr = 12 diff --git a/vendor/golang.org/x/net/ipv4/control_bsd.go b/vendor/golang.org/x/net/ipv4/control_bsd.go index 69c4f553..b7385dfd 100644 --- a/vendor/golang.org/x/net/ipv4/control_bsd.go +++ b/vendor/golang.org/x/net/ipv4/control_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd // +build aix darwin dragonfly freebsd netbsd openbsd package ipv4 @@ -13,11 +14,13 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func marshalDst(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len) + m.MarshalHeader(iana.ProtocolIP, unix.IP_RECVDSTADDR, net.IPv4len) return m.Next(net.IPv4len) } @@ -30,7 +33,7 @@ func parseDst(cm *ControlMessage, b []byte) { func marshalInterface(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink) + m.MarshalHeader(iana.ProtocolIP, sockoptReceiveInterface, syscall.SizeofSockaddrDatalink) return m.Next(syscall.SizeofSockaddrDatalink) } diff --git a/vendor/golang.org/x/net/ipv4/control_pktinfo.go b/vendor/golang.org/x/net/ipv4/control_pktinfo.go index 425338f3..0e748dbd 100644 --- a/vendor/golang.org/x/net/ipv4/control_pktinfo.go +++ b/vendor/golang.org/x/net/ipv4/control_pktinfo.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || linux || solaris // +build darwin linux solaris package ipv4 @@ -12,11 +13,13 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo) + m.MarshalHeader(iana.ProtocolIP, unix.IP_PKTINFO, sizeofInetPktinfo) if cm != nil { pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0])) if ip := cm.Src.To4(); ip != nil { diff --git a/vendor/golang.org/x/net/ipv4/control_stub.go b/vendor/golang.org/x/net/ipv4/control_stub.go index 9d825347..f27322c3 100644 --- a/vendor/golang.org/x/net/ipv4/control_stub.go +++ b/vendor/golang.org/x/net/ipv4/control_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/control_unix.go b/vendor/golang.org/x/net/ipv4/control_unix.go index b27fa490..2413e02f 100644 --- a/vendor/golang.org/x/net/ipv4/control_unix.go +++ b/vendor/golang.org/x/net/ipv4/control_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package ipv4 @@ -11,6 +12,8 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { @@ -64,7 +67,7 @@ func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) er func marshalTTL(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_RECVTTL, 1) + m.MarshalHeader(iana.ProtocolIP, unix.IP_RECVTTL, 1) return m.Next(1) } diff --git a/vendor/golang.org/x/net/ipv4/control_zos.go b/vendor/golang.org/x/net/ipv4/control_zos.go index 04420003..de11c42e 100644 --- a/vendor/golang.org/x/net/ipv4/control_zos.go +++ b/vendor/golang.org/x/net/ipv4/control_zos.go @@ -10,11 +10,13 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo) + m.MarshalHeader(iana.ProtocolIP, unix.IP_PKTINFO, sizeofInetPktinfo) if cm != nil { pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0])) if ip := cm.Src.To4(); ip != nil { diff --git a/vendor/golang.org/x/net/ipv4/icmp_stub.go b/vendor/golang.org/x/net/ipv4/icmp_stub.go index 21bb29ab..cd4ee6e1 100644 --- a/vendor/golang.org/x/net/ipv4/icmp_stub.go +++ b/vendor/golang.org/x/net/ipv4/icmp_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/payload_cmsg.go b/vendor/golang.org/x/net/ipv4/payload_cmsg.go index 7bde6894..1bb370e2 100644 --- a/vendor/golang.org/x/net/ipv4/payload_cmsg.go +++ b/vendor/golang.org/x/net/ipv4/payload_cmsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go index 251bd0c7..53f0794e 100644 --- a/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +++ b/vendor/golang.org/x/net/ipv4/payload_nocmsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sockopt_posix.go b/vendor/golang.org/x/net/ipv4/sockopt_posix.go index ef29718d..eb07c1c0 100644 --- a/vendor/golang.org/x/net/ipv4/sockopt_posix.go +++ b/vendor/golang.org/x/net/ipv4/sockopt_posix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sockopt_stub.go b/vendor/golang.org/x/net/ipv4/sockopt_stub.go index fbca5268..cf036893 100644 --- a/vendor/golang.org/x/net/ipv4/sockopt_stub.go +++ b/vendor/golang.org/x/net/ipv4/sockopt_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_aix.go b/vendor/golang.org/x/net/ipv4/sys_aix.go index 3d1201e6..02730cdf 100644 --- a/vendor/golang.org/x/net/ipv4/sys_aix.go +++ b/vendor/golang.org/x/net/ipv4/sys_aix.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // Added for go1.11 compatibility +//go:build aix // +build aix package ipv4 @@ -13,26 +14,31 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) +// IP_RECVIF is defined on AIX but doesn't work. IP_RECVINTERFACE must be used instead. +const sockoptReceiveInterface = unix.IP_RECVINTERFACE + var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, + ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, + ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, + ctlInterface: {unix.IP_RECVINTERFACE, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, } sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 1}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, + ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVINTERFACE, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, } ) diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreq.go b/vendor/golang.org/x/net/ipv4/sys_asmreq.go index 76d670ac..22322b38 100644 --- a/vendor/golang.org/x/net/ipv4/sys_asmreq.go +++ b/vendor/golang.org/x/net/ipv4/sys_asmreq.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows // +build aix darwin dragonfly freebsd netbsd openbsd solaris windows package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go b/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go index 6dc339ce..fde64014 100644 --- a/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +++ b/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !windows // +build !aix,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreqn.go b/vendor/golang.org/x/net/ipv4/sys_asmreqn.go index 1f24f69f..54eb9901 100644 --- a/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +++ b/vendor/golang.org/x/net/ipv4/sys_asmreqn.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || freebsd || linux // +build darwin freebsd linux package ipv4 @@ -11,6 +12,8 @@ import ( "unsafe" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { @@ -18,7 +21,7 @@ func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { if _, err := so.Get(c, b); err != nil { return nil, err } - mreqn := (*ipMreqn)(unsafe.Pointer(&b[0])) + mreqn := (*unix.IPMreqn)(unsafe.Pointer(&b[0])) if mreqn.Ifindex == 0 { return nil, nil } @@ -30,13 +33,13 @@ func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { } func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { - var mreqn ipMreqn + var mreqn unix.IPMreqn if ifi != nil { mreqn.Ifindex = int32(ifi.Index) } if grp != nil { mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]} } - b := (*[sizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:sizeofIPMreqn] + b := (*[unix.SizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:unix.SizeofIPMreqn] return so.Set(c, b) } diff --git a/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go b/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go index 48ef5562..dcb15f25 100644 --- a/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +++ b/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !darwin && !freebsd && !linux // +build !darwin,!freebsd,!linux package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_bpf.go b/vendor/golang.org/x/net/ipv4/sys_bpf.go index 5c03dce3..fb11e324 100644 --- a/vendor/golang.org/x/net/ipv4/sys_bpf.go +++ b/vendor/golang.org/x/net/ipv4/sys_bpf.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go b/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go index 5c986427..fc53a0d3 100644 --- a/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +++ b/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_bsd.go b/vendor/golang.org/x/net/ipv4/sys_bsd.go index 58256dd9..e191b2f1 100644 --- a/vendor/golang.org/x/net/ipv4/sys_bsd.go +++ b/vendor/golang.org/x/net/ipv4/sys_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build netbsd || openbsd // +build netbsd openbsd package ipv4 @@ -12,26 +13,30 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) +const sockoptReceiveInterface = unix.IP_RECVIF + var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, + ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, + ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, + ctlInterface: {unix.IP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, } sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 1}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, + ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVIF, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, } ) diff --git a/vendor/golang.org/x/net/ipv4/sys_darwin.go b/vendor/golang.org/x/net/ipv4/sys_darwin.go index ac213c73..cac6f3ca 100644 --- a/vendor/golang.org/x/net/ipv4/sys_darwin.go +++ b/vendor/golang.org/x/net/ipv4/sys_darwin.go @@ -11,34 +11,38 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) +const sockoptReceiveInterface = unix.IP_RECVIF + var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, + ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, + ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, + ctlInterface: {unix.IP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, + ctlPacketInfo: {unix.IP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, } sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoStripHeader: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_STRIPHDR, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: unix.SizeofIPMreqn}, typ: ssoTypeIPMreqn}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, + ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVIF, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoStripHeader: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_STRIPHDR, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVPKTINFO, Len: 4}}, } ) diff --git a/vendor/golang.org/x/net/ipv4/sys_dragonfly.go b/vendor/golang.org/x/net/ipv4/sys_dragonfly.go index 859764f3..0620d0e1 100644 --- a/vendor/golang.org/x/net/ipv4/sys_dragonfly.go +++ b/vendor/golang.org/x/net/ipv4/sys_dragonfly.go @@ -10,26 +10,30 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) +const sockoptReceiveInterface = unix.IP_RECVIF + var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, + ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, + ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, + ctlInterface: {unix.IP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, } sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, + ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVIF, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, } ) diff --git a/vendor/golang.org/x/net/ipv4/sys_freebsd.go b/vendor/golang.org/x/net/ipv4/sys_freebsd.go index 482873d9..89612287 100644 --- a/vendor/golang.org/x/net/ipv4/sys_freebsd.go +++ b/vendor/golang.org/x/net/ipv4/sys_freebsd.go @@ -13,38 +13,42 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) +const sockoptReceiveInterface = unix.IP_RECVIF + var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, - ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, - ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, + ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL}, + ctlDst: {unix.IP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, + ctlInterface: {unix.IP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, } sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, - ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVDSTADDR, Len: 4}}, + ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVIF, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) func init() { freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate") if freebsdVersion >= 1000000 { - sockOpts[ssoMulticastInterface] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn} + sockOpts[ssoMulticastInterface] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: unix.SizeofIPMreqn}, typ: ssoTypeIPMreqn} } if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" { archs, _ := syscall.Sysctl("kern.supported_archs") diff --git a/vendor/golang.org/x/net/ipv4/sys_linux.go b/vendor/golang.org/x/net/ipv4/sys_linux.go index cf755c7f..4588a5f3 100644 --- a/vendor/golang.org/x/net/ipv4/sys_linux.go +++ b/vendor/golang.org/x/net/ipv4/sys_linux.go @@ -11,31 +11,32 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL}, - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, + ctlTTL: {unix.IP_TTL, 1, marshalTTL, parseTTL}, + ctlPacketInfo: {unix.IP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, } sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_PKTINFO, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolReserved, Name: sysICMP_FILTER, Len: sizeofICMPFilter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: unix.SizeofIPMreqn}, typ: ssoTypeIPMreqn}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_PKTINFO, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolReserved, Name: unix.ICMP_FILTER, Len: sizeofICMPFilter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, ssoAttachFilter: {Option: socket.Option{Level: unix.SOL_SOCKET, Name: unix.SO_ATTACH_FILTER, Len: unix.SizeofSockFprog}}, } ) diff --git a/vendor/golang.org/x/net/ipv4/sys_solaris.go b/vendor/golang.org/x/net/ipv4/sys_solaris.go index 832fef1e..0bb9f3e3 100644 --- a/vendor/golang.org/x/net/ipv4/sys_solaris.go +++ b/vendor/golang.org/x/net/ipv4/sys_solaris.go @@ -11,29 +11,33 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) +const sockoptReceiveInterface = unix.IP_RECVIF + var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTTL: {sysIP_RECVTTL, 4, marshalTTL, parseTTL}, - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, + ctlTTL: {unix.IP_RECVTTL, 4, marshalTTL, parseTTL}, + ctlPacketInfo: {unix.IP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, } sockOpts = map[int]sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 1}}, + ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVTTL, Len: 4}}, + ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVPKTINFO, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_HDRINCL, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) diff --git a/vendor/golang.org/x/net/ipv4/sys_ssmreq.go b/vendor/golang.org/x/net/ipv4/sys_ssmreq.go index eeced7f3..6a4e7abf 100644 --- a/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +++ b/vendor/golang.org/x/net/ipv4/sys_ssmreq.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || freebsd || linux || solaris // +build darwin freebsd linux solaris package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go b/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go index c0921674..157159fd 100644 --- a/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +++ b/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !darwin && !freebsd && !linux && !solaris // +build !darwin,!freebsd,!linux,!solaris package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_stub.go b/vendor/golang.org/x/net/ipv4/sys_stub.go index 55558518..d5508516 100644 --- a/vendor/golang.org/x/net/ipv4/sys_stub.go +++ b/vendor/golang.org/x/net/ipv4/sys_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv4 diff --git a/vendor/golang.org/x/net/ipv4/sys_windows.go b/vendor/golang.org/x/net/ipv4/sys_windows.go index b0913d53..c5e95063 100644 --- a/vendor/golang.org/x/net/ipv4/sys_windows.go +++ b/vendor/golang.org/x/net/ipv4/sys_windows.go @@ -7,34 +7,15 @@ package ipv4 import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/windows" ) const ( - // See ws2tcpip.h. - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_DONTFRAGMENT = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0xf - sysIP_DROP_SOURCE_MEMBERSHIP = 0x10 - sysIP_PKTINFO = 0x13 - - sizeofInetPktinfo = 0x8 sizeofIPMreq = 0x8 sizeofIPMreqSource = 0xc ) -type inetPktinfo struct { - Addr [4]byte - Ifindex int32 -} - type ipMreq struct { Multiaddr [4]byte Interface [4]byte @@ -51,17 +32,13 @@ var ( ctlOpts = [ctlMax]ctlOpt{} sockOpts = map[int]*sockOpt{ - ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, - ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, - ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_TOS, Len: 4}}, + ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_TTL, Len: 4}}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_MULTICAST_TTL, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_MULTICAST_LOOP, Len: 4}}, + ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_HDRINCL, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, } ) - -func (pi *inetPktinfo) setIfindex(i int) { - pi.Ifindex = int32(i) -} diff --git a/vendor/golang.org/x/net/ipv4/sys_zos.go b/vendor/golang.org/x/net/ipv4/sys_zos.go index 7426606c..be206409 100644 --- a/vendor/golang.org/x/net/ipv4/sys_zos.go +++ b/vendor/golang.org/x/net/ipv4/sys_zos.go @@ -11,24 +11,26 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, + ctlPacketInfo: {unix.IP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, } sockOpts = map[int]*sockOpt{ - ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, - ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_TTL, Len: 1}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_IF, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_MULTICAST_LOOP, Len: 1}}, + ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.IP_RECVPKTINFO, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) diff --git a/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go b/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go index c741d5c8..b7f2d6e5 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go @@ -2,28 +2,12 @@ // cgo -godefs defs_aix.go // Added for go1.11 compatibility +//go:build aix // +build aix package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x20 - sysIP_RECVTTL = 0x22 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sizeofIPMreq = 0x8 ) diff --git a/vendor/golang.org/x/net/ipv4/zsys_darwin.go b/vendor/golang.org/x/net/ipv4/zsys_darwin.go index e05a251b..6c1b7056 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_darwin.go +++ b/vendor/golang.org/x/net/ipv4/zsys_darwin.go @@ -4,45 +4,11 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_STRIPHDR = 0x17 - sysIP_RECVTTL = 0x18 - sysIP_BOUND_IF = 0x19 - sysIP_PKTINFO = 0x1a - sysIP_RECVPKTINFO = 0x1a - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_MULTICAST_IFINDEX = 0x42 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -75,12 +41,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr [4]byte /* in_addr */ Sourceaddr [4]byte /* in_addr */ diff --git a/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go b/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go index 6d65e9fc..2155df13 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go +++ b/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go @@ -4,24 +4,6 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_RECVTTL = 0x41 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sizeofIPMreq = 0x8 ) diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go index 136e2b8f..ae40482a 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go +++ b/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go @@ -4,45 +4,10 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -69,12 +34,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr [4]byte /* in_addr */ Sourceaddr [4]byte /* in_addr */ diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go index 4f730f19..90181867 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go @@ -4,45 +4,10 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -69,12 +34,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr [4]byte /* in_addr */ Sourceaddr [4]byte /* in_addr */ diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go index 4f730f19..90181867 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go +++ b/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go @@ -4,45 +4,10 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -69,12 +34,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr [4]byte /* in_addr */ Sourceaddr [4]byte /* in_addr */ diff --git a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go b/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go index ecebf327..0feb9a75 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go @@ -4,45 +4,10 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_SENDSRCADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_ONESBCAST = 0x17 - sysIP_BINDANY = 0x18 - sysIP_RECVTTL = 0x41 - sysIP_MINTTL = 0x42 - sysIP_DONTFRAG = 0x43 - sysIP_RECVTOS = 0x44 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sysIP_MULTICAST_VIF = 0xe - sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 - sysIP_BLOCK_SOURCE = 0x48 - sysIP_UNBLOCK_SOURCE = 0x49 - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -69,12 +34,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr [4]byte /* in_addr */ Sourceaddr [4]byte /* in_addr */ diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_386.go b/vendor/golang.org/x/net/ipv4/zsys_linux_386.go index 1c7fdfa1..d510357c 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_386.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_386.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go b/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go index 1c7fdfa1..d510357c 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go index 1c7fdfa1..d510357c 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go b/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go index 1c7fdfa1..d510357c 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go index 3c5ea547..29202e40 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x84 sizeofGroupSourceReq = 0x104 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go b/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go index e626134a..e2edebdb 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go @@ -1,69 +1,18 @@ // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs defs_linux.go +//go:build riscv64 // +build riscv64 package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -104,12 +53,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go b/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go index a04e7851..eb10cc79 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go +++ b/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go @@ -4,64 +4,12 @@ package ipv4 const ( - sysIP_TOS = 0x1 - sysIP_TTL = 0x2 - sysIP_HDRINCL = 0x3 - sysIP_OPTIONS = 0x4 - sysIP_ROUTER_ALERT = 0x5 - sysIP_RECVOPTS = 0x6 - sysIP_RETOPTS = 0x7 - sysIP_PKTINFO = 0x8 - sysIP_PKTOPTIONS = 0x9 - sysIP_MTU_DISCOVER = 0xa - sysIP_RECVERR = 0xb - sysIP_RECVTTL = 0xc - sysIP_RECVTOS = 0xd - sysIP_MTU = 0xe - sysIP_FREEBIND = 0xf - sysIP_TRANSPARENT = 0x13 - sysIP_RECVRETOPTS = 0x7 - sysIP_ORIGDSTADDR = 0x14 - sysIP_RECVORIGDSTADDR = 0x14 - sysIP_MINTTL = 0x15 - sysIP_NODEFRAG = 0x16 - sysIP_UNICAST_IF = 0x32 - - sysIP_MULTICAST_IF = 0x20 - sysIP_MULTICAST_TTL = 0x21 - sysIP_MULTICAST_LOOP = 0x22 - sysIP_ADD_MEMBERSHIP = 0x23 - sysIP_DROP_MEMBERSHIP = 0x24 - sysIP_UNBLOCK_SOURCE = 0x25 - sysIP_BLOCK_SOURCE = 0x26 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x27 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x28 - sysIP_MSFILTER = 0x29 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIP_MULTICAST_ALL = 0x31 - - sysICMP_FILTER = 0x1 - - sysSO_EE_ORIGIN_NONE = 0x0 - sysSO_EE_ORIGIN_LOCAL = 0x1 - sysSO_EE_ORIGIN_ICMP = 0x2 - sysSO_EE_ORIGIN_ICMP6 = 0x3 - sysSO_EE_ORIGIN_TXSTATUS = 0x4 - sysSO_EE_ORIGIN_TIMESTAMPING = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc sizeofSockExtendedErr = 0x10 sizeofIPMreq = 0x8 - sizeofIPMreqn = 0xc sizeofIPMreqSource = 0xc sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 @@ -102,12 +50,6 @@ type ipMreq struct { Interface [4]byte /* in_addr */ } -type ipMreqn struct { - Multiaddr [4]byte /* in_addr */ - Address [4]byte /* in_addr */ - Ifindex int32 -} - type ipMreqSource struct { Multiaddr uint32 Interface uint32 diff --git a/vendor/golang.org/x/net/ipv4/zsys_netbsd.go b/vendor/golang.org/x/net/ipv4/zsys_netbsd.go index 8cfc648a..a2ef2f6d 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_netbsd.go +++ b/vendor/golang.org/x/net/ipv4/zsys_netbsd.go @@ -4,23 +4,6 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x14 - sysIP_RECVTTL = 0x17 - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sizeofIPMreq = 0x8 ) diff --git a/vendor/golang.org/x/net/ipv4/zsys_openbsd.go b/vendor/golang.org/x/net/ipv4/zsys_openbsd.go index 37629cb0..b293a338 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_openbsd.go +++ b/vendor/golang.org/x/net/ipv4/zsys_openbsd.go @@ -4,23 +4,6 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x1e - sysIP_RECVTTL = 0x1f - - sysIP_MULTICAST_IF = 0x9 - sysIP_MULTICAST_TTL = 0xa - sysIP_MULTICAST_LOOP = 0xb - sysIP_ADD_MEMBERSHIP = 0xc - sysIP_DROP_MEMBERSHIP = 0xd - sizeofIPMreq = 0x8 ) diff --git a/vendor/golang.org/x/net/ipv4/zsys_solaris.go b/vendor/golang.org/x/net/ipv4/zsys_solaris.go index cb80a308..e1a961bb 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_solaris.go +++ b/vendor/golang.org/x/net/ipv4/zsys_solaris.go @@ -4,49 +4,6 @@ package ipv4 const ( - sysIP_OPTIONS = 0x1 - sysIP_HDRINCL = 0x2 - sysIP_TOS = 0x3 - sysIP_TTL = 0x4 - sysIP_RECVOPTS = 0x5 - sysIP_RECVRETOPTS = 0x6 - sysIP_RECVDSTADDR = 0x7 - sysIP_RETOPTS = 0x8 - sysIP_RECVIF = 0x9 - sysIP_RECVSLLA = 0xa - sysIP_RECVTTL = 0xb - - sysIP_MULTICAST_IF = 0x10 - sysIP_MULTICAST_TTL = 0x11 - sysIP_MULTICAST_LOOP = 0x12 - sysIP_ADD_MEMBERSHIP = 0x13 - sysIP_DROP_MEMBERSHIP = 0x14 - sysIP_BLOCK_SOURCE = 0x15 - sysIP_UNBLOCK_SOURCE = 0x16 - sysIP_ADD_SOURCE_MEMBERSHIP = 0x17 - sysIP_DROP_SOURCE_MEMBERSHIP = 0x18 - sysIP_NEXTHOP = 0x19 - - sysIP_PKTINFO = 0x1a - sysIP_RECVPKTINFO = 0x1a - sysIP_DONTFRAG = 0x1b - - sysIP_BOUND_IF = 0x41 - sysIP_UNSPEC_SRC = 0x42 - sysIP_BROADCAST_TTL = 0x43 - sysIP_DHCPINIT_IF = 0x45 - - sysIP_REUSEADDR = 0x104 - sysIP_DONTROUTE = 0x105 - sysIP_BROADCAST = 0x106 - - sysMCAST_JOIN_GROUP = 0x29 - sysMCAST_LEAVE_GROUP = 0x2a - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_JOIN_SOURCE_GROUP = 0x2d - sysMCAST_LEAVE_SOURCE_GROUP = 0x2e - sizeofSockaddrStorage = 0x100 sizeofSockaddrInet = 0x10 sizeofInetPktinfo = 0xc diff --git a/vendor/golang.org/x/net/ipv4/zsys_zos_s390x.go b/vendor/golang.org/x/net/ipv4/zsys_zos_s390x.go index 4bbfda07..692abf68 100644 --- a/vendor/golang.org/x/net/ipv4/zsys_zos_s390x.go +++ b/vendor/golang.org/x/net/ipv4/zsys_zos_s390x.go @@ -8,30 +8,6 @@ package ipv4 const ( - sysIP_ADD_MEMBERSHIP = 5 - sysIP_ADD_SOURCE_MEMBERSHIP = 12 - sysIP_BLOCK_SOURCE = 10 - sysIP_DEFAULT_MULTICAST_LOOP = 1 - sysIP_DEFAULT_MULTICAST_TTL = 1 - sysIP_DROP_MEMBERSHIP = 6 - sysIP_DROP_SOURCE_MEMBERSHIP = 13 - sysIP_MAX_MEMBERSHIPS = 20 - sysIP_MULTICAST_IF = 7 - sysIP_MULTICAST_LOOP = 4 - sysIP_MULTICAST_TTL = 3 - sysIP_OPTIONS = 1 - sysIP_PKTINFO = 101 - sysIP_RECVPKTINFO = 102 - sysIP_TOS = 2 - sysIP_UNBLOCK_SOURCE = 11 - - sysMCAST_JOIN_GROUP = 40 - sysMCAST_LEAVE_GROUP = 41 - sysMCAST_JOIN_SOURCE_GROUP = 42 - sysMCAST_LEAVE_SOURCE_GROUP = 43 - sysMCAST_BLOCK_SOURCE = 44 - sysMCAST_UNBLOCK_SOURCE = 45 - sizeofIPMreq = 8 sizeofSockaddrInet4 = 16 sizeofSockaddrStorage = 128 diff --git a/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go b/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go index 9fd9eb15..2733ddbe 100644 --- a/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go +++ b/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin // +build darwin package ipv6 @@ -11,11 +12,13 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func marshal2292HopLimit(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_2292HOPLIMIT, 4) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_2292HOPLIMIT, 4) if cm != nil { socket.NativeEndian.PutUint32(m.Data(4), uint32(cm.HopLimit)) } @@ -24,7 +27,7 @@ func marshal2292HopLimit(b []byte, cm *ControlMessage) []byte { func marshal2292PacketInfo(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_2292PKTINFO, sizeofInet6Pktinfo) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_2292PKTINFO, sizeofInet6Pktinfo) if cm != nil { pi := (*inet6Pktinfo)(unsafe.Pointer(&m.Data(sizeofInet6Pktinfo)[0])) if ip := cm.Src.To16(); ip != nil && ip.To4() == nil { @@ -39,7 +42,7 @@ func marshal2292PacketInfo(b []byte, cm *ControlMessage) []byte { func marshal2292NextHop(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_2292NEXTHOP, sizeofSockaddrInet6) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_2292NEXTHOP, sizeofSockaddrInet6) if cm != nil { sa := (*sockaddrInet6)(unsafe.Pointer(&m.Data(sizeofSockaddrInet6)[0])) sa.setSockaddr(cm.NextHop, cm.IfIndex) diff --git a/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go b/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go index 77c449ec..9c90844a 100644 --- a/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go +++ b/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package ipv6 @@ -12,11 +13,13 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) func marshalTrafficClass(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_TCLASS, 4) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_TCLASS, 4) if cm != nil { socket.NativeEndian.PutUint32(m.Data(4), uint32(cm.TrafficClass)) } @@ -29,7 +32,7 @@ func parseTrafficClass(cm *ControlMessage, b []byte) { func marshalHopLimit(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_HOPLIMIT, 4) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_HOPLIMIT, 4) if cm != nil { socket.NativeEndian.PutUint32(m.Data(4), uint32(cm.HopLimit)) } @@ -42,7 +45,7 @@ func parseHopLimit(cm *ControlMessage, b []byte) { func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_PKTINFO, sizeofInet6Pktinfo) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_PKTINFO, sizeofInet6Pktinfo) if cm != nil { pi := (*inet6Pktinfo)(unsafe.Pointer(&m.Data(sizeofInet6Pktinfo)[0])) if ip := cm.Src.To16(); ip != nil && ip.To4() == nil { @@ -66,7 +69,7 @@ func parsePacketInfo(cm *ControlMessage, b []byte) { func marshalNextHop(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_NEXTHOP, sizeofSockaddrInet6) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_NEXTHOP, sizeofSockaddrInet6) if cm != nil { sa := (*sockaddrInet6)(unsafe.Pointer(&m.Data(sizeofSockaddrInet6)[0])) sa.setSockaddr(cm.NextHop, cm.IfIndex) @@ -79,7 +82,7 @@ func parseNextHop(cm *ControlMessage, b []byte) { func marshalPathMTU(b []byte, cm *ControlMessage) []byte { m := socket.ControlMessage(b) - m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_PATHMTU, sizeofIPv6Mtuinfo) + m.MarshalHeader(iana.ProtocolIPv6, unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo) return m.Next(sizeofIPv6Mtuinfo) } diff --git a/vendor/golang.org/x/net/ipv6/control_stub.go b/vendor/golang.org/x/net/ipv6/control_stub.go index e50b8864..b7e8643f 100644 --- a/vendor/golang.org/x/net/ipv6/control_stub.go +++ b/vendor/golang.org/x/net/ipv6/control_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/control_unix.go b/vendor/golang.org/x/net/ipv6/control_unix.go index ec31ca2a..63e475db 100644 --- a/vendor/golang.org/x/net/ipv6/control_unix.go +++ b/vendor/golang.org/x/net/ipv6/control_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/icmp_bsd.go b/vendor/golang.org/x/net/ipv6/icmp_bsd.go index b03025cd..120bf877 100644 --- a/vendor/golang.org/x/net/ipv6/icmp_bsd.go +++ b/vendor/golang.org/x/net/ipv6/icmp_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd // +build aix darwin dragonfly freebsd netbsd openbsd package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/icmp_stub.go b/vendor/golang.org/x/net/ipv6/icmp_stub.go index 297e191f..d60136a9 100644 --- a/vendor/golang.org/x/net/ipv6/icmp_stub.go +++ b/vendor/golang.org/x/net/ipv6/icmp_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/payload_cmsg.go b/vendor/golang.org/x/net/ipv6/payload_cmsg.go index 8baa26e7..b0692e43 100644 --- a/vendor/golang.org/x/net/ipv6/payload_cmsg.go +++ b/vendor/golang.org/x/net/ipv6/payload_cmsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/payload_nocmsg.go b/vendor/golang.org/x/net/ipv6/payload_nocmsg.go index 00c4f587..cd0ff508 100644 --- a/vendor/golang.org/x/net/ipv6/payload_nocmsg.go +++ b/vendor/golang.org/x/net/ipv6/payload_nocmsg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sockopt_posix.go b/vendor/golang.org/x/net/ipv6/sockopt_posix.go index f7187927..37c62871 100644 --- a/vendor/golang.org/x/net/ipv6/sockopt_posix.go +++ b/vendor/golang.org/x/net/ipv6/sockopt_posix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sockopt_stub.go b/vendor/golang.org/x/net/ipv6/sockopt_stub.go index d87db6a0..32fd8664 100644 --- a/vendor/golang.org/x/net/ipv6/sockopt_stub.go +++ b/vendor/golang.org/x/net/ipv6/sockopt_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_aix.go b/vendor/golang.org/x/net/ipv6/sys_aix.go index bce7091f..a47182af 100644 --- a/vendor/golang.org/x/net/ipv6/sys_aix.go +++ b/vendor/golang.org/x/net/ipv6/sys_aix.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // Added for go1.11 compatibility +//go:build aix // +build aix package ipv6 @@ -14,32 +15,34 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlNextHop: {sysIPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlTrafficClass: {unix.IPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlNextHop: {unix.IPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]*sockOpt{ - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMP6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMP6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_asmreq.go b/vendor/golang.org/x/net/ipv6/sys_asmreq.go index 8c3934c3..6ff9950d 100644 --- a/vendor/golang.org/x/net/ipv6/sys_asmreq.go +++ b/vendor/golang.org/x/net/ipv6/sys_asmreq.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go b/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go index 87ae4818..485290cb 100644 --- a/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go +++ b/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_bpf.go b/vendor/golang.org/x/net/ipv6/sys_bpf.go index 90ef4dfa..b5661fb8 100644 --- a/vendor/golang.org/x/net/ipv6/sys_bpf.go +++ b/vendor/golang.org/x/net/ipv6/sys_bpf.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux // +build linux package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go b/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go index eb9f8316..cb006618 100644 --- a/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go +++ b/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_bsd.go b/vendor/golang.org/x/net/ipv6/sys_bsd.go index e416eaa1..bde41a6c 100644 --- a/vendor/golang.org/x/net/ipv6/sys_bsd.go +++ b/vendor/golang.org/x/net/ipv6/sys_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build dragonfly || netbsd || openbsd // +build dragonfly netbsd openbsd package ipv6 @@ -12,32 +13,34 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlNextHop: {sysIPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlTrafficClass: {unix.IPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlNextHop: {unix.IPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]*sockOpt{ - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMP6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMP6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_darwin.go b/vendor/golang.org/x/net/ipv6/sys_darwin.go index 12cc5cb2..b80ec806 100644 --- a/vendor/golang.org/x/net/ipv6/sys_darwin.go +++ b/vendor/golang.org/x/net/ipv6/sys_darwin.go @@ -11,36 +11,38 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlNextHop: {sysIPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlTrafficClass: {unix.IPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlNextHop: {unix.IPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]*sockOpt{ - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMP6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMP6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_freebsd.go b/vendor/golang.org/x/net/ipv6/sys_freebsd.go index 85a9f5d0..6282cf97 100644 --- a/vendor/golang.org/x/net/ipv6/sys_freebsd.go +++ b/vendor/golang.org/x/net/ipv6/sys_freebsd.go @@ -13,36 +13,38 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlNextHop: {sysIPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlTrafficClass: {unix.IPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlNextHop: {unix.IPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]sockOpt{ - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMP6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMP6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_linux.go b/vendor/golang.org/x/net/ipv6/sys_linux.go index 96e8093a..82e21210 100644 --- a/vendor/golang.org/x/net/ipv6/sys_linux.go +++ b/vendor/golang.org/x/net/ipv6/sys_linux.go @@ -11,36 +11,37 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlTrafficClass: {unix.IPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]*sockOpt{ - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolReserved, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMPV6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolReserved, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMPV6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, ssoAttachFilter: {Option: socket.Option{Level: unix.SOL_SOCKET, Name: unix.SO_ATTACH_FILTER, Len: unix.SizeofSockFprog}}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_solaris.go b/vendor/golang.org/x/net/ipv6/sys_solaris.go index d348b5f6..1fc30add 100644 --- a/vendor/golang.org/x/net/ipv6/sys_solaris.go +++ b/vendor/golang.org/x/net/ipv6/sys_solaris.go @@ -11,36 +11,38 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlTrafficClass: {sysIPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlNextHop: {sysIPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlTrafficClass: {unix.IPV6_TCLASS, 4, marshalTrafficClass, parseTrafficClass}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlNextHop: {unix.IPV6_NEXTHOP, sizeofSockaddrInet6, marshalNextHop, parseNextHop}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]*sockOpt{ - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMP6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoPathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_PATHMTU, Len: sizeofIPv6Mtuinfo}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMP6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_ssmreq.go b/vendor/golang.org/x/net/ipv6/sys_ssmreq.go index 88d64f17..023488a4 100644 --- a/vendor/golang.org/x/net/ipv6/sys_ssmreq.go +++ b/vendor/golang.org/x/net/ipv6/sys_ssmreq.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || freebsd || linux || solaris || zos // +build aix darwin freebsd linux solaris zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go b/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go index b0708868..acdf2e5c 100644 --- a/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go +++ b/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !freebsd && !linux && !solaris && !zos // +build !aix,!darwin,!freebsd,!linux,!solaris,!zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_stub.go b/vendor/golang.org/x/net/ipv6/sys_stub.go index cbe4a029..5807bba3 100644 --- a/vendor/golang.org/x/net/ipv6/sys_stub.go +++ b/vendor/golang.org/x/net/ipv6/sys_stub.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos package ipv6 diff --git a/vendor/golang.org/x/net/ipv6/sys_windows.go b/vendor/golang.org/x/net/ipv6/sys_windows.go index fc36b018..fda8a299 100644 --- a/vendor/golang.org/x/net/ipv6/sys_windows.go +++ b/vendor/golang.org/x/net/ipv6/sys_windows.go @@ -10,18 +10,11 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/windows" ) const ( - // See ws2tcpip.h. - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PKTINFO = 0x13 - sizeofSockaddrInet6 = 0x1c sizeofIPv6Mreq = 0x14 @@ -55,12 +48,12 @@ var ( ctlOpts = [ctlMax]ctlOpt{} sockOpts = map[int]*sockOpt{ - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: windows.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: windows.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: windows.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: windows.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: windows.IPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: windows.IPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/sys_zos.go b/vendor/golang.org/x/net/ipv6/sys_zos.go index d4567f90..31adc866 100644 --- a/vendor/golang.org/x/net/ipv6/sys_zos.go +++ b/vendor/golang.org/x/net/ipv6/sys_zos.go @@ -11,33 +11,35 @@ import ( "golang.org/x/net/internal/iana" "golang.org/x/net/internal/socket" + + "golang.org/x/sys/unix" ) var ( ctlOpts = [ctlMax]ctlOpt{ - ctlHopLimit: {sysIPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, - ctlPacketInfo: {sysIPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, - ctlPathMTU: {sysIPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, + ctlHopLimit: {unix.IPV6_HOPLIMIT, 4, marshalHopLimit, parseHopLimit}, + ctlPacketInfo: {unix.IPV6_PKTINFO, sizeofInet6Pktinfo, marshalPacketInfo, parsePacketInfo}, + ctlPathMTU: {unix.IPV6_PATHMTU, sizeofIPv6Mtuinfo, marshalPathMTU, parsePathMTU}, } sockOpts = map[int]*sockOpt{ - ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_TCLASS, Len: 4}}, - ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, - ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, - ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, - ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, - ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVTCLASS, Len: 4}}, - ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVHOPLIMIT, Len: 4}}, - ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPKTINFO, Len: 4}}, - ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_RECVPATHMTU, Len: 4}}, - ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_CHECKSUM, Len: 4}}, - ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: sysICMP6_FILTER, Len: sizeofICMPv6Filter}}, - ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, - ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, - ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_TCLASS, Len: 4}}, + ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_UNICAST_HOPS, Len: 4}}, + ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_IF, Len: 4}}, + ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_HOPS, Len: 4}}, + ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_MULTICAST_LOOP, Len: 4}}, + ssoReceiveTrafficClass: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVTCLASS, Len: 4}}, + ssoReceiveHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVHOPLIMIT, Len: 4}}, + ssoReceivePacketInfo: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPKTINFO, Len: 4}}, + ssoReceivePathMTU: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_RECVPATHMTU, Len: 4}}, + ssoChecksum: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.IPV6_CHECKSUM, Len: 4}}, + ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolIPv6ICMP, Name: unix.ICMP6_FILTER, Len: sizeofICMPv6Filter}}, + ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}, + ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, + ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: unix.MCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}, } ) diff --git a/vendor/golang.org/x/net/ipv6/zsys_aix_ppc64.go b/vendor/golang.org/x/net/ipv6/zsys_aix_ppc64.go index bf44e338..f604b0f3 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_aix_ppc64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_aix_ppc64.go @@ -2,46 +2,12 @@ // cgo -godefs defs_aix.go // Added for go1.11 compatibility +//go:build aix // +build aix package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysICMP6_FILTER = 0x26 - - sysIPV6_CHECKSUM = 0x27 - sysIPV6_V6ONLY = 0x25 - - sysIPV6_RTHDRDSTOPTS = 0x37 - - sysIPV6_RECVPKTINFO = 0x23 - sysIPV6_RECVHOPLIMIT = 0x29 - sysIPV6_RECVRTHDR = 0x33 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_RECVDSTOPTS = 0x38 - - sysIPV6_USE_MIN_MTU = 0x2c - sysIPV6_RECVPATHMTU = 0x2f - sysIPV6_PATHMTU = 0x2e - - sysIPV6_PKTINFO = 0x21 - sysIPV6_HOPLIMIT = 0x28 - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x34 - sysIPV6_DSTOPTS = 0x36 - sysIPV6_RTHDR = 0x32 - - sysIPV6_RECVTCLASS = 0x2a - - sysIPV6_TCLASS = 0x2b - sysIPV6_DONTFRAG = 0x2d - sizeofSockaddrStorage = 0x508 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_darwin.go b/vendor/golang.org/x/net/ipv6/zsys_darwin.go index 555744af..dd6f7b28 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_darwin.go +++ b/vendor/golang.org/x/net/ipv6/zsys_darwin.go @@ -4,73 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - sysIPV6_2292PKTINFO = 0x13 - sysIPV6_2292HOPLIMIT = 0x14 - sysIPV6_2292NEXTHOP = 0x15 - sysIPV6_2292HOPOPTS = 0x16 - sysIPV6_2292DSTOPTS = 0x17 - sysIPV6_2292RTHDR = 0x18 - - sysIPV6_2292PKTOPTIONS = 0x19 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RECVTCLASS = 0x23 - sysIPV6_TCLASS = 0x24 - - sysIPV6_RTHDRDSTOPTS = 0x39 - - sysIPV6_RECVPKTINFO = 0x3d - - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_AUTOFLOWLABEL = 0x3b - - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PREFER_TEMPADDR = 0x3f - - sysIPV6_MSFILTER = 0x4a - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sysIPV6_BOUND_IF = 0x7d - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go b/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go index cf3cc102..6b45a94f 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go +++ b/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go @@ -4,52 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RTHDRDSTOPTS = 0x23 - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_AUTOFLOWLABEL = 0x3b - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PREFER_TEMPADDR = 0x3f - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 sizeofIPv6Mtuinfo = 0x20 diff --git a/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go b/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go index 73f31b26..8da55925 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go +++ b/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go @@ -4,64 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RTHDRDSTOPTS = 0x23 - - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_AUTOFLOWLABEL = 0x3b - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PREFER_TEMPADDR = 0x3f - - sysIPV6_BINDANY = 0x40 - - sysIPV6_MSFILTER = 0x4a - - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go b/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go index 490ce7cf..72a1a65a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go @@ -4,64 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RTHDRDSTOPTS = 0x23 - - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_AUTOFLOWLABEL = 0x3b - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PREFER_TEMPADDR = 0x3f - - sysIPV6_BINDANY = 0x40 - - sysIPV6_MSFILTER = 0x4a - - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go b/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go index 490ce7cf..72a1a65a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go +++ b/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go @@ -4,64 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RTHDRDSTOPTS = 0x23 - - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_AUTOFLOWLABEL = 0x3b - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PREFER_TEMPADDR = 0x3f - - sysIPV6_BINDANY = 0x40 - - sysIPV6_MSFILTER = 0x4a - - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm64.go b/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm64.go index 47e99ac9..5b39eb8d 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm64.go @@ -4,64 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RTHDRDSTOPTS = 0x23 - - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_AUTOFLOWLABEL = 0x3b - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PREFER_TEMPADDR = 0x3f - - sysIPV6_BINDANY = 0x40 - - sysIPV6_MSFILTER = 0x4a - - sysMCAST_JOIN_GROUP = 0x50 - sysMCAST_LEAVE_GROUP = 0x51 - sysMCAST_JOIN_SOURCE_GROUP = 0x52 - sysMCAST_LEAVE_SOURCE_GROUP = 0x53 - sysMCAST_BLOCK_SOURCE = 0x54 - sysMCAST_UNBLOCK_SOURCE = 0x55 - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_386.go b/vendor/golang.org/x/net/ipv6/zsys_linux_386.go index bde4a8f8..ad71871b 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_386.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_386.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go b/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go b/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go index bde4a8f8..ad71871b 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go b/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go b/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go index bde4a8f8..ad71871b 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go b/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go b/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go b/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go index bde4a8f8..ad71871b 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go b/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go index 66fd2361..d06c2ade 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go b/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go b/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_riscv64.go b/vendor/golang.org/x/net/ipv6/zsys_linux_riscv64.go index 6083ddce..d4f78e40 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_riscv64.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_riscv64.go @@ -1,91 +1,12 @@ // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs defs_linux.go +//go:build riscv64 // +build riscv64 package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go b/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go index 992ac9ec..2514ab9a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go +++ b/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go @@ -4,86 +4,6 @@ package ipv6 const ( - sysIPV6_ADDRFORM = 0x1 - sysIPV6_2292PKTINFO = 0x2 - sysIPV6_2292HOPOPTS = 0x3 - sysIPV6_2292DSTOPTS = 0x4 - sysIPV6_2292RTHDR = 0x5 - sysIPV6_2292PKTOPTIONS = 0x6 - sysIPV6_CHECKSUM = 0x7 - sysIPV6_2292HOPLIMIT = 0x8 - sysIPV6_NEXTHOP = 0x9 - sysIPV6_FLOWINFO = 0xb - - sysIPV6_UNICAST_HOPS = 0x10 - sysIPV6_MULTICAST_IF = 0x11 - sysIPV6_MULTICAST_HOPS = 0x12 - sysIPV6_MULTICAST_LOOP = 0x13 - sysIPV6_ADD_MEMBERSHIP = 0x14 - sysIPV6_DROP_MEMBERSHIP = 0x15 - sysMCAST_JOIN_GROUP = 0x2a - sysMCAST_LEAVE_GROUP = 0x2d - sysMCAST_JOIN_SOURCE_GROUP = 0x2e - sysMCAST_LEAVE_SOURCE_GROUP = 0x2f - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_MSFILTER = 0x30 - sysIPV6_ROUTER_ALERT = 0x16 - sysIPV6_MTU_DISCOVER = 0x17 - sysIPV6_MTU = 0x18 - sysIPV6_RECVERR = 0x19 - sysIPV6_V6ONLY = 0x1a - sysIPV6_JOIN_ANYCAST = 0x1b - sysIPV6_LEAVE_ANYCAST = 0x1c - - sysIPV6_FLOWLABEL_MGR = 0x20 - sysIPV6_FLOWINFO_SEND = 0x21 - - sysIPV6_IPSEC_POLICY = 0x22 - sysIPV6_XFRM_POLICY = 0x23 - - sysIPV6_RECVPKTINFO = 0x31 - sysIPV6_PKTINFO = 0x32 - sysIPV6_RECVHOPLIMIT = 0x33 - sysIPV6_HOPLIMIT = 0x34 - sysIPV6_RECVHOPOPTS = 0x35 - sysIPV6_HOPOPTS = 0x36 - sysIPV6_RTHDRDSTOPTS = 0x37 - sysIPV6_RECVRTHDR = 0x38 - sysIPV6_RTHDR = 0x39 - sysIPV6_RECVDSTOPTS = 0x3a - sysIPV6_DSTOPTS = 0x3b - sysIPV6_RECVPATHMTU = 0x3c - sysIPV6_PATHMTU = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_RECVTCLASS = 0x42 - sysIPV6_TCLASS = 0x43 - - sysIPV6_ADDR_PREFERENCES = 0x48 - - sysIPV6_PREFER_SRC_TMP = 0x1 - sysIPV6_PREFER_SRC_PUBLIC = 0x2 - sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 - sysIPV6_PREFER_SRC_COA = 0x4 - sysIPV6_PREFER_SRC_HOME = 0x400 - sysIPV6_PREFER_SRC_CGA = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x800 - - sysIPV6_MINHOPCOUNT = 0x49 - - sysIPV6_ORIGDSTADDR = 0x4a - sysIPV6_RECVORIGDSTADDR = 0x4a - sysIPV6_TRANSPARENT = 0x4b - sysIPV6_UNICAST_IF = 0x4c - - sysICMPV6_FILTER = 0x1 - - sysICMPV6_FILTER_BLOCK = 0x1 - sysICMPV6_FILTER_PASS = 0x2 - sysICMPV6_FILTER_BLOCKOTHERS = 0x3 - sysICMPV6_FILTER_PASSONLY = 0x4 - sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_netbsd.go b/vendor/golang.org/x/net/ipv6/zsys_netbsd.go index e39571e0..f7335d5a 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_netbsd.go +++ b/vendor/golang.org/x/net/ipv6/zsys_netbsd.go @@ -4,48 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_IPSEC_POLICY = 0x1c - - sysIPV6_RTHDRDSTOPTS = 0x23 - - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 sizeofIPv6Mtuinfo = 0x20 diff --git a/vendor/golang.org/x/net/ipv6/zsys_openbsd.go b/vendor/golang.org/x/net/ipv6/zsys_openbsd.go index cc1899a6..6d159281 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_openbsd.go +++ b/vendor/golang.org/x/net/ipv6/zsys_openbsd.go @@ -4,57 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x4 - sysIPV6_MULTICAST_IF = 0x9 - sysIPV6_MULTICAST_HOPS = 0xa - sysIPV6_MULTICAST_LOOP = 0xb - sysIPV6_JOIN_GROUP = 0xc - sysIPV6_LEAVE_GROUP = 0xd - sysIPV6_PORTRANGE = 0xe - sysICMP6_FILTER = 0x12 - - sysIPV6_CHECKSUM = 0x1a - sysIPV6_V6ONLY = 0x1b - - sysIPV6_RTHDRDSTOPTS = 0x23 - - sysIPV6_RECVPKTINFO = 0x24 - sysIPV6_RECVHOPLIMIT = 0x25 - sysIPV6_RECVRTHDR = 0x26 - sysIPV6_RECVHOPOPTS = 0x27 - sysIPV6_RECVDSTOPTS = 0x28 - - sysIPV6_USE_MIN_MTU = 0x2a - sysIPV6_RECVPATHMTU = 0x2b - - sysIPV6_PATHMTU = 0x2c - - sysIPV6_PKTINFO = 0x2e - sysIPV6_HOPLIMIT = 0x2f - sysIPV6_NEXTHOP = 0x30 - sysIPV6_HOPOPTS = 0x31 - sysIPV6_DSTOPTS = 0x32 - sysIPV6_RTHDR = 0x33 - - sysIPV6_AUTH_LEVEL = 0x35 - sysIPV6_ESP_TRANS_LEVEL = 0x36 - sysIPV6_ESP_NETWORK_LEVEL = 0x37 - sysIPSEC6_OUTSA = 0x38 - sysIPV6_RECVTCLASS = 0x39 - - sysIPV6_AUTOFLOWLABEL = 0x3b - sysIPV6_IPCOMP_LEVEL = 0x3c - - sysIPV6_TCLASS = 0x3d - sysIPV6_DONTFRAG = 0x3e - sysIPV6_PIPEX = 0x3f - - sysIPV6_RTABLE = 0x1021 - - sysIPV6_PORTRANGE_DEFAULT = 0x0 - sysIPV6_PORTRANGE_HIGH = 0x1 - sysIPV6_PORTRANGE_LOW = 0x2 - sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 sizeofIPv6Mtuinfo = 0x20 diff --git a/vendor/golang.org/x/net/ipv6/zsys_solaris.go b/vendor/golang.org/x/net/ipv6/zsys_solaris.go index 690eef93..17161974 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_solaris.go +++ b/vendor/golang.org/x/net/ipv6/zsys_solaris.go @@ -4,74 +4,6 @@ package ipv6 const ( - sysIPV6_UNICAST_HOPS = 0x5 - sysIPV6_MULTICAST_IF = 0x6 - sysIPV6_MULTICAST_HOPS = 0x7 - sysIPV6_MULTICAST_LOOP = 0x8 - sysIPV6_JOIN_GROUP = 0x9 - sysIPV6_LEAVE_GROUP = 0xa - - sysIPV6_PKTINFO = 0xb - - sysIPV6_HOPLIMIT = 0xc - sysIPV6_NEXTHOP = 0xd - sysIPV6_HOPOPTS = 0xe - sysIPV6_DSTOPTS = 0xf - - sysIPV6_RTHDR = 0x10 - sysIPV6_RTHDRDSTOPTS = 0x11 - - sysIPV6_RECVPKTINFO = 0x12 - sysIPV6_RECVHOPLIMIT = 0x13 - sysIPV6_RECVHOPOPTS = 0x14 - - sysIPV6_RECVRTHDR = 0x16 - - sysIPV6_RECVRTHDRDSTOPTS = 0x17 - - sysIPV6_CHECKSUM = 0x18 - sysIPV6_RECVTCLASS = 0x19 - sysIPV6_USE_MIN_MTU = 0x20 - sysIPV6_DONTFRAG = 0x21 - sysIPV6_SEC_OPT = 0x22 - sysIPV6_SRC_PREFERENCES = 0x23 - sysIPV6_RECVPATHMTU = 0x24 - sysIPV6_PATHMTU = 0x25 - sysIPV6_TCLASS = 0x26 - sysIPV6_V6ONLY = 0x27 - - sysIPV6_RECVDSTOPTS = 0x28 - - sysMCAST_JOIN_GROUP = 0x29 - sysMCAST_LEAVE_GROUP = 0x2a - sysMCAST_BLOCK_SOURCE = 0x2b - sysMCAST_UNBLOCK_SOURCE = 0x2c - sysMCAST_JOIN_SOURCE_GROUP = 0x2d - sysMCAST_LEAVE_SOURCE_GROUP = 0x2e - - sysIPV6_PREFER_SRC_HOME = 0x1 - sysIPV6_PREFER_SRC_COA = 0x2 - sysIPV6_PREFER_SRC_PUBLIC = 0x4 - sysIPV6_PREFER_SRC_TMP = 0x8 - sysIPV6_PREFER_SRC_NONCGA = 0x10 - sysIPV6_PREFER_SRC_CGA = 0x20 - - sysIPV6_PREFER_SRC_MIPMASK = 0x3 - sysIPV6_PREFER_SRC_MIPDEFAULT = 0x1 - sysIPV6_PREFER_SRC_TMPMASK = 0xc - sysIPV6_PREFER_SRC_TMPDEFAULT = 0x4 - sysIPV6_PREFER_SRC_CGAMASK = 0x30 - sysIPV6_PREFER_SRC_CGADEFAULT = 0x10 - - sysIPV6_PREFER_SRC_MASK = 0x3f - - sysIPV6_PREFER_SRC_DEFAULT = 0x15 - - sysIPV6_BOUND_IF = 0x41 - sysIPV6_UNSPEC_SRC = 0x42 - - sysICMP6_FILTER = 0x1 - sizeofSockaddrStorage = 0x100 sizeofSockaddrInet6 = 0x20 sizeofInet6Pktinfo = 0x14 diff --git a/vendor/golang.org/x/net/ipv6/zsys_zos_s390x.go b/vendor/golang.org/x/net/ipv6/zsys_zos_s390x.go index 3f980691..7c756459 100644 --- a/vendor/golang.org/x/net/ipv6/zsys_zos_s390x.go +++ b/vendor/golang.org/x/net/ipv6/zsys_zos_s390x.go @@ -8,50 +8,6 @@ package ipv6 const ( - sysIPV6_ADDR_PREFERENCES = 32 - sysIPV6_CHECKSUM = 19 - sysIPV6_DONTFRAG = 29 - sysIPV6_DSTOPTS = 23 - sysIPV6_HOPLIMIT = 11 - sysIPV6_HOPOPTS = 22 - sysIPV6_JOIN_GROUP = 5 - sysIPV6_LEAVE_GROUP = 6 - sysIPV6_MULTICAST_HOPS = 9 - sysIPV6_MULTICAST_IF = 7 - sysIPV6_MULTICAST_LOOP = 4 - sysIPV6_NEXTHOP = 20 - sysIPV6_PATHMTU = 12 - sysIPV6_PKTINFO = 13 - sysIPV6_PREFER_SRC_CGA = 0x10 - sysIPV6_PREFER_SRC_COA = 0x02 - sysIPV6_PREFER_SRC_HOME = 0x01 - sysIPV6_PREFER_SRC_NONCGA = 0x20 - sysIPV6_PREFER_SRC_PUBLIC = 0x08 - sysIPV6_PREFER_SRC_TMP = 0x04 - sysIPV6_RECVDSTOPTS = 28 - sysIPV6_RECVHOPLIMIT = 14 - sysIPV6_RECVHOPOPTS = 26 - sysIPV6_RECVPATHMTU = 16 - sysIPV6_RECVPKTINFO = 15 - sysIPV6_RECVRTHDR = 25 - sysIPV6_RECVTCLASS = 31 - sysIPV6_RTHDR = 21 - sysIPV6_RTHDRDSTOPTS = 24 - sysIPV6_RTHDR_TYPE_0 = 0 - sysIPV6_TCLASS = 30 - sysIPV6_UNICAST_HOPS = 3 - sysIPV6_USE_MIN_MTU = 18 - sysIPV6_V6ONLY = 10 - - sysMCAST_JOIN_GROUP = 40 - sysMCAST_LEAVE_GROUP = 41 - sysMCAST_JOIN_SOURCE_GROUP = 42 - sysMCAST_LEAVE_SOURCE_GROUP = 43 - sysMCAST_BLOCK_SOURCE = 44 - sysMCAST_UNBLOCK_SOURCE = 45 - - sysICMP6_FILTER = 0x1 - sizeofSockaddrStorage = 128 sizeofICMPv6Filter = 32 sizeofInet6Pktinfo = 20 diff --git a/vendor/golang.org/x/crypto/AUTHORS b/vendor/golang.org/x/sync/AUTHORS similarity index 74% rename from vendor/golang.org/x/crypto/AUTHORS rename to vendor/golang.org/x/sync/AUTHORS index 2b00ddba..15167cd7 100644 --- a/vendor/golang.org/x/crypto/AUTHORS +++ b/vendor/golang.org/x/sync/AUTHORS @@ -1,3 +1,3 @@ # This source code refers to The Go Authors for copyright purposes. # The master list of authors is in the main Go distribution, -# visible at https://tip.golang.org/AUTHORS. +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/crypto/CONTRIBUTORS b/vendor/golang.org/x/sync/CONTRIBUTORS similarity index 70% rename from vendor/golang.org/x/crypto/CONTRIBUTORS rename to vendor/golang.org/x/sync/CONTRIBUTORS index 1fbd3e97..1c4577e9 100644 --- a/vendor/golang.org/x/crypto/CONTRIBUTORS +++ b/vendor/golang.org/x/sync/CONTRIBUTORS @@ -1,3 +1,3 @@ # This source code was written by the Go contributors. # The master list of contributors is in the main Go distribution, -# visible at https://tip.golang.org/CONTRIBUTORS. +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/sync/LICENSE similarity index 100% rename from vendor/golang.org/x/crypto/LICENSE rename to vendor/golang.org/x/sync/LICENSE diff --git a/vendor/golang.org/x/crypto/PATENTS b/vendor/golang.org/x/sync/PATENTS similarity index 100% rename from vendor/golang.org/x/crypto/PATENTS rename to vendor/golang.org/x/sync/PATENTS diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go new file mode 100644 index 00000000..9857fe53 --- /dev/null +++ b/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -0,0 +1,66 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package errgroup provides synchronization, error propagation, and Context +// cancelation for groups of goroutines working on subtasks of a common task. +package errgroup + +import ( + "context" + "sync" +) + +// A Group is a collection of goroutines working on subtasks that are part of +// the same overall task. +// +// A zero Group is valid and does not cancel on error. +type Group struct { + cancel func() + + wg sync.WaitGroup + + errOnce sync.Once + err error +} + +// WithContext returns a new Group and an associated Context derived from ctx. +// +// The derived Context is canceled the first time a function passed to Go +// returns a non-nil error or the first time Wait returns, whichever occurs +// first. +func WithContext(ctx context.Context) (*Group, context.Context) { + ctx, cancel := context.WithCancel(ctx) + return &Group{cancel: cancel}, ctx +} + +// Wait blocks until all function calls from the Go method have returned, then +// returns the first non-nil error (if any) from them. +func (g *Group) Wait() error { + g.wg.Wait() + if g.cancel != nil { + g.cancel() + } + return g.err +} + +// Go calls the given function in a new goroutine. +// +// The first call to return a non-nil error cancels the group; its error will be +// returned by Wait. +func (g *Group) Go(f func() error) { + g.wg.Add(1) + + go func() { + defer g.wg.Done() + + if err := f(); err != nil { + g.errOnce.Do(func() { + g.err = err + if g.cancel != nil { + g.cancel() + } + }) + } + }() +} diff --git a/vendor/golang.org/x/sys/execabs/execabs.go b/vendor/golang.org/x/sys/execabs/execabs.go new file mode 100644 index 00000000..78192498 --- /dev/null +++ b/vendor/golang.org/x/sys/execabs/execabs.go @@ -0,0 +1,102 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package execabs is a drop-in replacement for os/exec +// that requires PATH lookups to find absolute paths. +// That is, execabs.Command("cmd") runs the same PATH lookup +// as exec.Command("cmd"), but if the result is a path +// which is relative, the Run and Start methods will report +// an error instead of running the executable. +// +// See https://blog.golang.org/path-security for more information +// about when it may be necessary or appropriate to use this package. +package execabs + +import ( + "context" + "fmt" + "os/exec" + "path/filepath" + "reflect" + "unsafe" +) + +// ErrNotFound is the error resulting if a path search failed to find an executable file. +// It is an alias for exec.ErrNotFound. +var ErrNotFound = exec.ErrNotFound + +// Cmd represents an external command being prepared or run. +// It is an alias for exec.Cmd. +type Cmd = exec.Cmd + +// Error is returned by LookPath when it fails to classify a file as an executable. +// It is an alias for exec.Error. +type Error = exec.Error + +// An ExitError reports an unsuccessful exit by a command. +// It is an alias for exec.ExitError. +type ExitError = exec.ExitError + +func relError(file, path string) error { + return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path) +} + +// LookPath searches for an executable named file in the directories +// named by the PATH environment variable. If file contains a slash, +// it is tried directly and the PATH is not consulted. The result will be +// an absolute path. +// +// LookPath differs from exec.LookPath in its handling of PATH lookups, +// which are used for file names without slashes. If exec.LookPath's +// PATH lookup would have returned an executable from the current directory, +// LookPath instead returns an error. +func LookPath(file string) (string, error) { + path, err := exec.LookPath(file) + if err != nil { + return "", err + } + if filepath.Base(file) == file && !filepath.IsAbs(path) { + return "", relError(file, path) + } + return path, nil +} + +func fixCmd(name string, cmd *exec.Cmd) { + if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) { + // exec.Command was called with a bare binary name and + // exec.LookPath returned a path which is not absolute. + // Set cmd.lookPathErr and clear cmd.Path so that it + // cannot be run. + lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer())) + if *lookPathErr == nil { + *lookPathErr = relError(name, cmd.Path) + } + cmd.Path = "" + } +} + +// CommandContext is like Command but includes a context. +// +// The provided context is used to kill the process (by calling os.Process.Kill) +// if the context becomes done before the command completes on its own. +func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd { + cmd := exec.CommandContext(ctx, name, arg...) + fixCmd(name, cmd) + return cmd + +} + +// Command returns the Cmd struct to execute the named program with the given arguments. +// See exec.Command for most details. +// +// Command differs from exec.Command in its handling of PATH lookups, +// which are used when the program name contains no slashes. +// If exec.Command would have returned an exec.Cmd configured to run an +// executable from the current directory, Command instead +// returns an exec.Cmd that will return an error from Start or Run. +func Command(name string, arg ...string) *exec.Cmd { + cmd := exec.Command(name, arg...) + fixCmd(name, cmd) + return cmd +} diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md index 579d2d73..474efad0 100644 --- a/vendor/golang.org/x/sys/unix/README.md +++ b/vendor/golang.org/x/sys/unix/README.md @@ -76,7 +76,7 @@ arguments can be passed to the kernel. The third is for low-level use by the ForkExec wrapper. Unlike the first two, it does not call into the scheduler to let it know that a system call is running. -When porting Go to an new architecture/OS, this file must be implemented for +When porting Go to a new architecture/OS, this file must be implemented for each GOOS/GOARCH pair. ### mksysnum @@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not. Adding a new syscall often just requires adding a new `//sys` function prototype with the desired arguments and a capitalized name so it is exported. However, if you want the interface to the syscall to be different, often one will make an -unexported `//sys` prototype, an then write a custom wrapper in +unexported `//sys` prototype, and then write a custom wrapper in `syscall_${GOOS}.go`. ### types files @@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements. This script is used to generate the system's various constants. This doesn't just include the error numbers and error strings, but also the signal numbers -an a wide variety of miscellaneous constants. The constants come from the list +and a wide variety of miscellaneous constants. The constants come from the list of include files in the `includes_${uname}` variable. A regex then picks out the desired `#define` statements, and generates the corresponding Go constants. The error numbers and strings are generated from `#include `, and the diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go index 951fce4d..abc89c10 100644 --- a/vendor/golang.org/x/sys/unix/aliases.go +++ b/vendor/golang.org/x/sys/unix/aliases.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // +build go1.9 package unix diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s index 6b4027b3..db9171c2 100644 --- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s +++ b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gc // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_bsd_386.s similarity index 72% rename from vendor/golang.org/x/sys/unix/asm_freebsd_386.s rename to vendor/golang.org/x/sys/unix/asm_bsd_386.s index 49f0ac23..e0fcd9b3 100644 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_386.s @@ -1,14 +1,14 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (freebsd || netbsd || openbsd) && gc +// +build freebsd netbsd openbsd // +build gc #include "textflag.h" -// -// System call support for 386, FreeBSD -// +// System call support for 386 BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. @@ -22,7 +22,7 @@ TEXT ·Syscall6(SB),NOSPLIT,$0-40 TEXT ·Syscall9(SB),NOSPLIT,$0-52 JMP syscall·Syscall9(SB) -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 +TEXT ·RawSyscall(SB),NOSPLIT,$0-28 JMP syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s similarity index 72% rename from vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s rename to vendor/golang.org/x/sys/unix/asm_bsd_amd64.s index 07632c99..2b99c349 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s @@ -1,14 +1,14 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc +// +build darwin dragonfly freebsd netbsd openbsd // +build gc #include "textflag.h" -// -// System call support for AMD64, OpenBSD -// +// System call support for AMD64 BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s similarity index 76% rename from vendor/golang.org/x/sys/unix/asm_freebsd_arm.s rename to vendor/golang.org/x/sys/unix/asm_bsd_arm.s index 6d740db2..d702d4ad 100644 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s @@ -1,14 +1,14 @@ -// Copyright 2012 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (freebsd || netbsd || openbsd) && gc +// +build freebsd netbsd openbsd // +build gc #include "textflag.h" -// -// System call support for ARM, FreeBSD -// +// System call support for ARM BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s similarity index 75% rename from vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s rename to vendor/golang.org/x/sys/unix/asm_bsd_arm64.s index e57367c1..fe36a739 100644 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s @@ -1,14 +1,14 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin || freebsd || netbsd || openbsd) && gc +// +build darwin freebsd netbsd openbsd // +build gc #include "textflag.h" -// -// System call support for AMD64, NetBSD -// +// System call support for ARM64 BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s deleted file mode 100644 index 8a06b87d..00000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_386.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for 386, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s deleted file mode 100644 index f2397fde..00000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for AMD64, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s deleted file mode 100644 index c9e6b6fc..00000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc -// +build arm,darwin - -#include "textflag.h" - -// -// System call support for ARM, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s deleted file mode 100644 index 89843f8f..00000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc -// +build arm64,darwin - -#include "textflag.h" - -// -// System call support for AMD64, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s deleted file mode 100644 index 27674e1c..00000000 --- a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for AMD64, DragonFly -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s deleted file mode 100644 index f2dfc57b..00000000 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for AMD64, FreeBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s deleted file mode 100644 index a8f5a29b..00000000 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for ARM64, FreeBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s index 0655ecbf..8fd101d0 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_386.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_386.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gc // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s index bc3fb6ac..7ed38e43 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gc // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s index 55b13c7b..8ef1d514 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gc // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s index 22a83d8e..98ae0276 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && arm64 && gc // +build linux // +build arm64 // +build gc diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s index dc222b90..21231d2c 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips64 || mips64le) && gc // +build linux // +build mips64 mips64le // +build gc diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s index d333f13c..6783b26c 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips || mipsle) && gc // +build linux // +build mips mipsle // +build gc diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index 459a629c..19d49893 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (ppc64 || ppc64le) && gc // +build linux // +build ppc64 ppc64le // +build gc diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s index 04d38497..e42eb81d 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build riscv64,gc +//go:build riscv64 && gc +// +build riscv64 +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s index cc303989..c46aab33 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s @@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build s390x +//go:build linux && s390x && gc // +build linux +// +build s390x // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s deleted file mode 100644 index ae7b498d..00000000 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for 386, NetBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s deleted file mode 100644 index d7da175e..00000000 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for ARM, NetBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s deleted file mode 100644 index e7cbe190..00000000 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for ARM64, NetBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s deleted file mode 100644 index 2f00b031..00000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for 386, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s deleted file mode 100644 index 73e99732..00000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for ARM, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s deleted file mode 100644 index c47302aa..00000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build gc - -#include "textflag.h" - -// -// System call support for arm64, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s index 47c93fcb..5e7a1169 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gc // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s index 1f2c755a..f8c5394c 100644 --- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gc // +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s new file mode 100644 index 00000000..3b54e185 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -0,0 +1,426 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x && gc +// +build zos +// +build s390x +// +build gc + +#include "textflag.h" + +#define PSALAA 1208(R0) +#define GTAB64(x) 80(x) +#define LCA64(x) 88(x) +#define CAA(x) 8(x) +#define EDCHPXV(x) 1016(x) // in the CAA +#define SAVSTACK_ASYNC(x) 336(x) // in the LCA + +// SS_*, where x=SAVSTACK_ASYNC +#define SS_LE(x) 0(x) +#define SS_GO(x) 8(x) +#define SS_ERRNO(x) 16(x) +#define SS_ERRNOJR(x) 20(x) + +#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6 + +TEXT ·clearErrno(SB),NOSPLIT,$0-0 + BL addrerrno<>(SB) + MOVD $0, 0(R3) + RET + +// Returns the address of errno in R3. +TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0 + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get __errno FuncDesc. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + ADD $(0x156*16), R9 + LMG 0(R9), R5, R6 + + // Switch to saved LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Call __errno function. + LE_CALL + NOPH + + // Switch back to Go stack. + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + RET + +TEXT ·syscall_syscall(SB),NOSPLIT,$0-56 + BL runtime·entersyscall(SB) + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+32(FP) + MOVD R0, r2+40(FP) + MOVD R0, err+48(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+48(FP) +done: + BL runtime·exitsyscall(SB) + RET + +TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56 + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+32(FP) + MOVD R0, r2+40(FP) + MOVD R0, err+48(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+48(FP) +done: + RET + +TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80 + BL runtime·entersyscall(SB) + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+56(FP) + MOVD R0, r2+64(FP) + MOVD R0, err+72(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+72(FP) +done: + BL runtime·exitsyscall(SB) + RET + +TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80 + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+56(FP) + MOVD R0, r2+64(FP) + MOVD R0, err+72(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL ·rrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+72(FP) +done: + RET + +TEXT ·syscall_syscall9(SB),NOSPLIT,$0 + BL runtime·entersyscall(SB) + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + MOVD a7+56(FP), R12 + MOVD R12, (2176+48)(R4) + MOVD a8+64(FP), R12 + MOVD R12, (2176+56)(R4) + MOVD a9+72(FP), R12 + MOVD R12, (2176+64)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+80(FP) + MOVD R0, r2+88(FP) + MOVD R0, err+96(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+96(FP) +done: + BL runtime·exitsyscall(SB) + RET + +TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0 + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + MOVD a7+56(FP), R12 + MOVD R12, (2176+48)(R4) + MOVD a8+64(FP), R12 + MOVD R12, (2176+56)(R4) + MOVD a9+72(FP), R12 + MOVD R12, (2176+64)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+80(FP) + MOVD R0, r2+88(FP) + MOVD R0, err+96(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+96(FP) +done: + RET + +// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64) +TEXT ·svcCall(SB),NOSPLIT,$0 + BL runtime·save_g(SB) // Save g and stack pointer + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD R15, 0(R9) + + MOVD argv+8(FP), R1 // Move function arguments into registers + MOVD dsa+16(FP), g + MOVD fnptr+0(FP), R15 + + BYTE $0x0D // Branch to function + BYTE $0xEF + + BL runtime·load_g(SB) // Restore g and stack pointer + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R15 + + RET + +// func svcLoad(name *byte) unsafe.Pointer +TEXT ·svcLoad(SB),NOSPLIT,$0 + MOVD R15, R2 // Save go stack pointer + MOVD name+0(FP), R0 // Move SVC args into registers + MOVD $0x80000000, R1 + MOVD $0, R15 + BYTE $0x0A // SVC 08 LOAD + BYTE $0x08 + MOVW R15, R3 // Save return code from SVC + MOVD R2, R15 // Restore go stack pointer + CMP R3, $0 // Check SVC return code + BNE error + + MOVD $-2, R3 // Reset last bit of entry point to zero + AND R0, R3 + MOVD R3, addr+8(FP) // Return entry point returned by SVC + CMP R0, R3 // Check if last bit of entry point was set + BNE done + + MOVD R15, R2 // Save go stack pointer + MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08) + BYTE $0x0A // SVC 09 DELETE + BYTE $0x09 + MOVD R2, R15 // Restore go stack pointer + +error: + MOVD $0, addr+8(FP) // Return 0 on failure +done: + XOR R0, R0 // Reset r0 to 0 + RET + +// func svcUnload(name *byte, fnptr unsafe.Pointer) int64 +TEXT ·svcUnload(SB),NOSPLIT,$0 + MOVD R15, R2 // Save go stack pointer + MOVD name+0(FP), R0 // Move SVC args into registers + MOVD addr+8(FP), R15 + BYTE $0x0A // SVC 09 + BYTE $0x09 + XOR R0, R0 // Reset r0 to 0 + MOVD R15, R1 // Save SVC return code + MOVD R2, R15 // Restore go stack pointer + MOVD R1, rc+0(FP) // Return SVC return code + RET + +// func gettid() uint64 +TEXT ·gettid(SB), NOSPLIT, $0 + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get CEECAATHDID + MOVD CAA(R8), R9 + MOVD 0x3D0(R9), R9 + MOVD R9, ret+0(FP) + + RET diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go index df520487..0b7c6adb 100644 --- a/vendor/golang.org/x/sys/unix/cap_freebsd.go +++ b/vendor/golang.org/x/sys/unix/cap_freebsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build freebsd // +build freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go index 3a6ac648..394a3965 100644 --- a/vendor/golang.org/x/sys/unix/constants.go +++ b/vendor/golang.org/x/sys/unix/constants.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go index 5e5fb451..65a99850 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc +//go:build aix && ppc +// +build aix,ppc // Functions to access/create device major and minor numbers matching the // encoding used by AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go index 8b401244..8fc08ad0 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc64 +//go:build aix && ppc64 +// +build aix,ppc64 // Functions to access/create device major and minor numbers matching the // encoding used AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_zos.go b/vendor/golang.org/x/sys/unix/dev_zos.go new file mode 100644 index 00000000..a388e59a --- /dev/null +++ b/vendor/golang.org/x/sys/unix/dev_zos.go @@ -0,0 +1,29 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +// Functions to access/create device major and minor numbers matching the +// encoding used by z/OS. +// +// The information below is extracted and adapted from macros. + +package unix + +// Major returns the major component of a z/OS device number. +func Major(dev uint64) uint32 { + return uint32((dev >> 16) & 0x0000FFFF) +} + +// Minor returns the minor component of a z/OS device number. +func Minor(dev uint64) uint32 { + return uint32(dev & 0x0000FFFF) +} + +// Mkdev returns a z/OS device number generated from the given major and minor +// components. +func Mkdev(major, minor uint32) uint64 { + return (uint64(major) << 16) | uint64(minor) +} diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index 304016b6..e74e5eaa 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go index 86781eac..a5202655 100644 --- a/vendor/golang.org/x/sys/unix/endian_big.go +++ b/vendor/golang.org/x/sys/unix/endian_big.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 // +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go index 8822d854..4362f47e 100644 --- a/vendor/golang.org/x/sys/unix/endian_little.go +++ b/vendor/golang.org/x/sys/unix/endian_little.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh // +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh package unix diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go index 84178b0a..29ccc4d1 100644 --- a/vendor/golang.org/x/sys/unix/env_unix.go +++ b/vendor/golang.org/x/sys/unix/env_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Unix environment variables. diff --git a/vendor/golang.org/x/sys/unix/epoll_zos.go b/vendor/golang.org/x/sys/unix/epoll_zos.go new file mode 100644 index 00000000..cedaf7e0 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/epoll_zos.go @@ -0,0 +1,221 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "sync" +) + +// This file simulates epoll on z/OS using poll. + +// Analogous to epoll_event on Linux. +// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove? +type EpollEvent struct { + Events uint32 + Fd int32 + Pad int32 +} + +const ( + EPOLLERR = 0x8 + EPOLLHUP = 0x10 + EPOLLIN = 0x1 + EPOLLMSG = 0x400 + EPOLLOUT = 0x4 + EPOLLPRI = 0x2 + EPOLLRDBAND = 0x80 + EPOLLRDNORM = 0x40 + EPOLLWRBAND = 0x200 + EPOLLWRNORM = 0x100 + EPOLL_CTL_ADD = 0x1 + EPOLL_CTL_DEL = 0x2 + EPOLL_CTL_MOD = 0x3 + // The following constants are part of the epoll API, but represent + // currently unsupported functionality on z/OS. + // EPOLL_CLOEXEC = 0x80000 + // EPOLLET = 0x80000000 + // EPOLLONESHOT = 0x40000000 + // EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis + // EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode + // EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability +) + +// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL +// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16). + +// epToPollEvt converts epoll event field to poll equivalent. +// In epoll, Events is a 32-bit field, while poll uses 16 bits. +func epToPollEvt(events uint32) int16 { + var ep2p = map[uint32]int16{ + EPOLLIN: POLLIN, + EPOLLOUT: POLLOUT, + EPOLLHUP: POLLHUP, + EPOLLPRI: POLLPRI, + EPOLLERR: POLLERR, + } + + var pollEvts int16 = 0 + for epEvt, pEvt := range ep2p { + if (events & epEvt) != 0 { + pollEvts |= pEvt + } + } + + return pollEvts +} + +// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields. +func pToEpollEvt(revents int16) uint32 { + var p2ep = map[int16]uint32{ + POLLIN: EPOLLIN, + POLLOUT: EPOLLOUT, + POLLHUP: EPOLLHUP, + POLLPRI: EPOLLPRI, + POLLERR: EPOLLERR, + } + + var epollEvts uint32 = 0 + for pEvt, epEvt := range p2ep { + if (revents & pEvt) != 0 { + epollEvts |= epEvt + } + } + + return epollEvts +} + +// Per-process epoll implementation. +type epollImpl struct { + mu sync.Mutex + epfd2ep map[int]*eventPoll + nextEpfd int +} + +// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances. +// On Linux, this is an in-kernel data structure accessed through a fd. +type eventPoll struct { + mu sync.Mutex + fds map[int]*EpollEvent +} + +// epoll impl for this process. +var impl epollImpl = epollImpl{ + epfd2ep: make(map[int]*eventPoll), + nextEpfd: 0, +} + +func (e *epollImpl) epollcreate(size int) (epfd int, err error) { + e.mu.Lock() + defer e.mu.Unlock() + epfd = e.nextEpfd + e.nextEpfd++ + + e.epfd2ep[epfd] = &eventPoll{ + fds: make(map[int]*EpollEvent), + } + return epfd, nil +} + +func (e *epollImpl) epollcreate1(flag int) (fd int, err error) { + return e.epollcreate(4) +} + +func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) { + e.mu.Lock() + defer e.mu.Unlock() + + ep, ok := e.epfd2ep[epfd] + if !ok { + + return EBADF + } + + switch op { + case EPOLL_CTL_ADD: + // TODO(neeilan): When we make epfds and fds disjoint, detect epoll + // loops here (instances watching each other) and return ELOOP. + if _, ok := ep.fds[fd]; ok { + return EEXIST + } + ep.fds[fd] = event + case EPOLL_CTL_MOD: + if _, ok := ep.fds[fd]; !ok { + return ENOENT + } + ep.fds[fd] = event + case EPOLL_CTL_DEL: + if _, ok := ep.fds[fd]; !ok { + return ENOENT + } + delete(ep.fds, fd) + + } + return nil +} + +// Must be called while holding ep.mu +func (ep *eventPoll) getFds() []int { + fds := make([]int, len(ep.fds)) + for fd := range ep.fds { + fds = append(fds, fd) + } + return fds +} + +func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) { + e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait + ep, ok := e.epfd2ep[epfd] + + if !ok { + e.mu.Unlock() + return 0, EBADF + } + + pollfds := make([]PollFd, 4) + for fd, epollevt := range ep.fds { + pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)}) + } + e.mu.Unlock() + + n, err = Poll(pollfds, msec) + if err != nil { + return n, err + } + + i := 0 + for _, pFd := range pollfds { + if pFd.Revents != 0 { + events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)} + i++ + } + + if i == n { + break + } + } + + return n, nil +} + +func EpollCreate(size int) (fd int, err error) { + return impl.epollcreate(size) +} + +func EpollCreate1(flag int) (fd int, err error) { + return impl.epollcreate1(flag) +} + +func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + return impl.epollctl(epfd, op, fd, event) +} + +// Because EpollWait mutates events, the caller is expected to coordinate +// concurrent access if calling with the same epfd from multiple goroutines. +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + return impl.epollwait(epfd, events, msec) +} diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go index 4dc53486..e9b99125 100644 --- a/vendor/golang.org/x/sys/unix/fcntl.go +++ b/vendor/golang.org/x/sys/unix/fcntl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build dragonfly || freebsd || linux || netbsd || openbsd // +build dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go index 8db48e5e..29d44808 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go +++ b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux,386 linux,arm linux,mips linux,mipsle +//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) +// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go index b27be0a0..a8068f94 100644 --- a/vendor/golang.org/x/sys/unix/fdset.go +++ b/vendor/golang.org/x/sys/unix/fdset.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/vendor/golang.org/x/sys/unix/fstatfs_zos.go new file mode 100644 index 00000000..e377cc9f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/fstatfs_zos.go @@ -0,0 +1,164 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "unsafe" +) + +// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent. + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + var stat_v Statvfs_t + err = Fstatvfs(fd, &stat_v) + if err == nil { + // populate stat + stat.Type = 0 + stat.Bsize = stat_v.Bsize + stat.Blocks = stat_v.Blocks + stat.Bfree = stat_v.Bfree + stat.Bavail = stat_v.Bavail + stat.Files = stat_v.Files + stat.Ffree = stat_v.Ffree + stat.Fsid = stat_v.Fsid + stat.Namelen = stat_v.Namemax + stat.Frsize = stat_v.Frsize + stat.Flags = stat_v.Flag + for passn := 0; passn < 5; passn++ { + switch passn { + case 0: + err = tryGetmntent64(stat) + break + case 1: + err = tryGetmntent128(stat) + break + case 2: + err = tryGetmntent256(stat) + break + case 3: + err = tryGetmntent512(stat) + break + case 4: + err = tryGetmntent1024(stat) + break + default: + break + } + //proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred) + if err == nil || err != nil && err != ERANGE { + break + } + } + } + return err +} + +func tryGetmntent64(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [64]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent128(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [128]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent256(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [256]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent512(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [512]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent1024(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [1024]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go index 86032c11..0dee2322 100644 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ b/vendor/golang.org/x/sys/unix/gccgo.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build gccgo -// +build !aix +//go:build gccgo && !aix +// +build gccgo,!aix package unix diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go index 251a977a..e60e49a3 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gccgo && linux && amd64 // +build gccgo,linux,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go new file mode 100644 index 00000000..934af313 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -0,0 +1,149 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import ( + "bytes" + "unsafe" +) + +// Helpers for dealing with ifreq since it contains a union and thus requires a +// lot of unsafe.Pointer casts to use properly. + +// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq +// contains an interface name and a union of arbitrary data which can be +// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq +// function. +// +// Use the Name method to access the stored interface name. The union data +// fields can be get and set using the following methods: +// - Uint16/SetUint16: flags +// - Uint32/SetUint32: ifindex, metric, mtu +type Ifreq struct{ raw ifreq } + +// NewIfreq creates an Ifreq with the input network interface name after +// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required) +// bytes. +func NewIfreq(name string) (*Ifreq, error) { + // Leave room for terminating NULL byte. + if len(name) >= IFNAMSIZ { + return nil, EINVAL + } + + var ifr ifreq + copy(ifr.Ifrn[:], name) + + return &Ifreq{raw: ifr}, nil +} + +// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc. + +// Name returns the interface name associated with the Ifreq. +func (ifr *Ifreq) Name() string { + // BytePtrToString requires a NULL terminator or the program may crash. If + // one is not present, just return the empty string. + if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) { + return "" + } + + return BytePtrToString(&ifr.raw.Ifrn[0]) +} + +// According to netdevice(7), only AF_INET addresses are returned for numerous +// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port +// field and other data is always empty. + +// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C +// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not +// AF_INET, an error is returned. +func (ifr *Ifreq) Inet4Addr() ([]byte, error) { + raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0])) + if raw.Family != AF_INET { + // Cannot safely interpret raw.Addr bytes as an IPv4 address. + return nil, EINVAL + } + + return raw.Addr[:], nil +} + +// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an +// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length +// or an error will be returned. +func (ifr *Ifreq) SetInet4Addr(v []byte) error { + if len(v) != 4 { + return EINVAL + } + + var addr [4]byte + copy(addr[:], v) + + ifr.clear() + *(*RawSockaddrInet4)( + unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]), + ) = RawSockaddrInet4{ + // Always set IP family as ioctls would require it anyway. + Family: AF_INET, + Addr: addr, + } + + return nil +} + +// Uint16 returns the Ifreq union data as a C short/Go uint16 value. +func (ifr *Ifreq) Uint16() uint16 { + return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) +} + +// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint16(v uint16) { + ifr.clear() + *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v +} + +// Uint32 returns the Ifreq union data as a C int/Go uint32 value. +func (ifr *Ifreq) Uint32() uint32 { + return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) +} + +// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint32(v uint32) { + ifr.clear() + *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v +} + +// clear zeroes the ifreq's union field to prevent trailing garbage data from +// being sent to the kernel if an ifreq is reused. +func (ifr *Ifreq) clear() { + for i := range ifr.raw.Ifru { + ifr.raw.Ifru[i] = 0 + } +} + +// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as +// IoctlGetEthtoolDrvinfo which use these APIs under the hood. + +// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData, +// use the Ifreq.withData method. +type ifreqData struct { + name [IFNAMSIZ]byte + // A type separate from ifreq is required in order to comply with the + // unsafe.Pointer rules since the "pointer-ness" of data would not be + // preserved if it were cast into the byte array of a raw ifreq. + data unsafe.Pointer + // Pad to the same size as ifreq. + _ [len(ifreq{}.Ifru) - SizeofPtr]byte +} + +// withData produces an ifreqData with the pointer p set for ioctls which require +// arbitrary pointer data. +func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData { + return ifreqData{ + name: ifr.raw.Ifrn, + data: p, + } +} diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl.go index 56416786..6c7ad052 100644 --- a/vendor/golang.org/x/sys/unix/ioctl.go +++ b/vendor/golang.org/x/sys/unix/ioctl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go new file mode 100644 index 00000000..1dadead2 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -0,0 +1,196 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package unix + +import ( + "unsafe" +) + +// IoctlRetInt performs an ioctl operation specified by req on a device +// associated with opened file descriptor fd, and returns a non-negative +// integer that is returned by the ioctl syscall. +func IoctlRetInt(fd int, req uint) (int, error) { + ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0) + if err != 0 { + return 0, err + } + return int(ret), nil +} + +func IoctlGetUint32(fd int, req uint) (uint32, error) { + var value uint32 + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return value, err +} + +func IoctlGetRTCTime(fd int) (*RTCTime, error) { + var value RTCTime + err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlSetRTCTime(fd int, value *RTCTime) error { + return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value)) +} + +func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) { + var value RTCWkAlrm + err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error { + return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value)) +} + +// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network +// device specified by ifname. +func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) { + ifr, err := NewIfreq(ifname) + if err != nil { + return nil, err + } + + value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO} + ifrd := ifr.withData(unsafe.Pointer(&value)) + + err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd) + return &value, err +} + +// IoctlGetWatchdogInfo fetches information about a watchdog device from the +// Linux watchdog API. For more information, see: +// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. +func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) { + var value WatchdogInfo + err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value)) + return &value, err +} + +// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For +// more information, see: +// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. +func IoctlWatchdogKeepalive(fd int) error { + // arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr. + return ioctl(fd, WDIOC_KEEPALIVE, 0) +} + +// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the +// range of data conveyed in value to the file associated with the file +// descriptor destFd. See the ioctl_ficlonerange(2) man page for details. +func IoctlFileCloneRange(destFd int, value *FileCloneRange) error { + return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value)) +} + +// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file +// associated with the file description srcFd to the file associated with the +// file descriptor destFd. See the ioctl_ficlone(2) man page for details. +func IoctlFileClone(destFd, srcFd int) error { + return ioctl(destFd, FICLONE, uintptr(srcFd)) +} + +type FileDedupeRange struct { + Src_offset uint64 + Src_length uint64 + Reserved1 uint16 + Reserved2 uint32 + Info []FileDedupeRangeInfo +} + +type FileDedupeRangeInfo struct { + Dest_fd int64 + Dest_offset uint64 + Bytes_deduped uint64 + Status int32 + Reserved uint32 +} + +// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the +// range of data conveyed in value from the file associated with the file +// descriptor srcFd to the value.Info destinations. See the +// ioctl_fideduperange(2) man page for details. +func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error { + buf := make([]byte, SizeofRawFileDedupeRange+ + len(value.Info)*SizeofRawFileDedupeRangeInfo) + rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0])) + rawrange.Src_offset = value.Src_offset + rawrange.Src_length = value.Src_length + rawrange.Dest_count = uint16(len(value.Info)) + rawrange.Reserved1 = value.Reserved1 + rawrange.Reserved2 = value.Reserved2 + + for i := range value.Info { + rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer( + uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) + + uintptr(i*SizeofRawFileDedupeRangeInfo))) + rawinfo.Dest_fd = value.Info[i].Dest_fd + rawinfo.Dest_offset = value.Info[i].Dest_offset + rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped + rawinfo.Status = value.Info[i].Status + rawinfo.Reserved = value.Info[i].Reserved + } + + err := ioctlPtr(srcFd, FIDEDUPERANGE, unsafe.Pointer(&buf[0])) + + // Output + for i := range value.Info { + rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer( + uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) + + uintptr(i*SizeofRawFileDedupeRangeInfo))) + value.Info[i].Dest_fd = rawinfo.Dest_fd + value.Info[i].Dest_offset = rawinfo.Dest_offset + value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped + value.Info[i].Status = rawinfo.Status + value.Info[i].Reserved = rawinfo.Reserved + } + + return err +} + +func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error { + return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value)) +} + +func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) { + var value HIDRawDevInfo + err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlHIDGetRawName(fd int) (string, error) { + var value [_HIDIOCGRAWNAME_LEN]byte + err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0])) + return ByteSliceToString(value[:]), err +} + +func IoctlHIDGetRawPhys(fd int) (string, error) { + var value [_HIDIOCGRAWPHYS_LEN]byte + err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0])) + return ByteSliceToString(value[:]), err +} + +func IoctlHIDGetRawUniq(fd int) (string, error) { + var value [_HIDIOCGRAWUNIQ_LEN]byte + err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0])) + return ByteSliceToString(value[:]), err +} + +// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or +// output. See the netdevice(7) man page for details. +func IoctlIfreq(fd int, req uint, value *Ifreq) error { + // It is possible we will add more fields to *Ifreq itself later to prevent + // misuse, so pass the raw *ifreq directly. + return ioctlPtr(fd, req, unsafe.Pointer(&value.raw)) +} + +// TODO(mdlayher): export if and when IfreqData is exported. + +// ioctlIfreqData performs an ioctl using an ifreqData structure for input +// and/or output. See the netdevice(7) man page for details. +func ioctlIfreqData(fd int, req uint, value *ifreqData) error { + // The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are + // identical so pass *IfreqData directly. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go new file mode 100644 index 00000000..5384e7d9 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -0,0 +1,74 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "runtime" + "unsafe" +) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req uint, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. +// +// To change fd's window size, the req argument should be TIOCSWINSZ. +func IoctlSetWinsize(fd int, req uint, value *Winsize) error { + // TODO: if we get the chance, remove the req parameter and + // hardcode TIOCSWINSZ. + err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) + runtime.KeepAlive(value) + return err +} + +// IoctlSetTermios performs an ioctl on fd with a *Termios. +// +// The req value is expected to be TCSETS, TCSETSW, or TCSETSF +func IoctlSetTermios(fd int, req uint, value *Termios) error { + if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) { + return ENOSYS + } + err := Tcsetattr(fd, int(req), value) + runtime.KeepAlive(value) + return err +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +// +// A few ioctl requests use the return value as an output parameter; +// for those, IoctlRetInt should be used instead of this function. +func IoctlGetInt(fd int, req uint) (int, error) { + var value int + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return value, err +} + +func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { + var value Winsize + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + +// IoctlGetTermios performs an ioctl on fd with a *Termios. +// +// The req value is expected to be TCGETS +func IoctlGetTermios(fd int, req uint) (*Termios, error) { + var value Termios + if req != TCGETS { + return &value, ENOSYS + } + err := Tcgetattr(fd, &value) + return &value, err +} diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index d257fac5..396aadf8 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -70,23 +70,11 @@ aix_ppc64) mksyscall="go run mksyscall_aix_ppc64.go -aix" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; -darwin_386) - mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" - ;; darwin_amd64) mkerrors="$mkerrors -m64" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; -darwin_arm) - mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" - ;; darwin_arm64) mkerrors="$mkerrors -m64" mktypes="GOARCH=$GOARCH go tool cgo -godefs" @@ -199,7 +187,7 @@ illumos_amd64) mksyscall="go run mksyscall_solaris.go" mkerrors= mksysnum= - mktypes= + mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; *) echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2 diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index b8313e98..850aafec 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -56,6 +56,7 @@ includes_Darwin=' #define _DARWIN_C_SOURCE #define KERNEL #define _DARWIN_USE_64_BIT_INODE +#define __APPLE_USE_RFC_3542 #include #include #include @@ -65,6 +66,7 @@ includes_Darwin=' #include #include #include +#include #include #include #include @@ -114,6 +116,7 @@ includes_FreeBSD=' #include #include #include +#include #include #include #include @@ -213,7 +216,7 @@ struct ltchars { #include #include #include -#include +#include #include #include #include @@ -223,8 +226,10 @@ struct ltchars { #include #include #include +#include #include #include +#include #include #include #include @@ -233,6 +238,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -252,6 +258,7 @@ struct ltchars { #include #include +#include #include #if defined(__sparc__) @@ -299,6 +306,17 @@ struct ltchars { // Including linux/l2tp.h here causes conflicts between linux/in.h // and netinet/in.h included via net/route.h above. #define IPPROTO_L2TP 115 + +// Copied from linux/hid.h. +// Keep in sync with the size of the referenced fields. +#define _HIDIOCGRAWNAME_LEN 128 // sizeof_field(struct hid_device, name) +#define _HIDIOCGRAWPHYS_LEN 64 // sizeof_field(struct hid_device, phys) +#define _HIDIOCGRAWUNIQ_LEN 64 // sizeof_field(struct hid_device, uniq) + +#define _HIDIOCGRAWNAME HIDIOCGRAWNAME(_HIDIOCGRAWNAME_LEN) +#define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN) +#define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN) + ' includes_NetBSD=' @@ -388,10 +406,11 @@ includes_SunOS=' #include #include #include +#include #include -#include #include #include +#include ' @@ -446,6 +465,8 @@ ccflags="$@" $2 !~ /^EPROC_/ && $2 !~ /^EQUIV_/ && $2 !~ /^EXPR_/ && + $2 !~ /^EVIOC/ && + $2 !~ /^EV_/ && $2 ~ /^E[A-Z0-9_]+$/ || $2 ~ /^B[0-9_]+$/ || $2 ~ /^(OLD|NEW)DEV$/ || @@ -477,13 +498,17 @@ ccflags="$@" $2 ~ /^O?XTABS$/ || $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || + $2 ~ /^LANDLOCK_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || + $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ || + $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || + $2 ~ /^NFC_.*_(MAX)?SIZE$/ || + $2 ~ /^RAW_PAYLOAD_/ || $2 ~ /^TP_STATUS_/ || $2 ~ /^FALLOC_/ || - $2 == "ICMPV6_FILTER" || + $2 ~ /^ICMPV?6?_(FILTER|SEC)/ || $2 == "SOMAXCONN" || $2 == "NAME_MAX" || $2 == "IFNAMSIZ" || @@ -538,6 +563,7 @@ ccflags="$@" $2 ~ /^KEYCTL_/ || $2 ~ /^PERF_/ || $2 ~ /^SECCOMP_MODE_/ || + $2 ~ /^SEEK_/ || $2 ~ /^SPLICE_/ || $2 ~ /^SYNC_FILE_RANGE_/ || $2 !~ /^AUDIT_RECORD_MAGIC/ && @@ -570,6 +596,12 @@ ccflags="$@" $2 ~ /^W[A-Z0-9]+$/ || $2 ~/^PPPIOC/ || $2 ~ /^FAN_|FANOTIFY_/ || + $2 == "HID_MAX_DESCRIPTOR_SIZE" || + $2 ~ /^_?HIDIOC/ || + $2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ || + $2 ~ /^MTD/ || + $2 ~ /^OTP/ || + $2 ~ /^MEM/ || $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)} @@ -607,6 +639,7 @@ echo '#include ' | $CC -x c - -E -dM $ccflags | echo '// mkerrors.sh' "$@" echo '// Code generated by the command above; see README.md. DO NOT EDIT.' echo +echo "//go:build ${GOARCH} && ${GOOS}" echo "// +build ${GOARCH},${GOOS}" echo go tool cgo -godefs -- "$@" _const.go >_error.out diff --git a/vendor/golang.org/x/sys/unix/pagesize_unix.go b/vendor/golang.org/x/sys/unix/pagesize_unix.go index bc2f3629..53f1b4c5 100644 --- a/vendor/golang.org/x/sys/unix/pagesize_unix.go +++ b/vendor/golang.org/x/sys/unix/pagesize_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // For Unix, get the pagesize from the runtime. diff --git a/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/vendor/golang.org/x/sys/unix/ptrace_darwin.go index fc568b54..463c3eff 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_darwin.go +++ b/vendor/golang.org/x/sys/unix/ptrace_darwin.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && !ios // +build darwin,!ios package unix diff --git a/vendor/golang.org/x/sys/unix/ptrace_ios.go b/vendor/golang.org/x/sys/unix/ptrace_ios.go index 183441c9..ed0509a0 100644 --- a/vendor/golang.org/x/sys/unix/ptrace_ios.go +++ b/vendor/golang.org/x/sys/unix/ptrace_ios.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ios // +build ios package unix diff --git a/vendor/golang.org/x/sys/unix/race.go b/vendor/golang.org/x/sys/unix/race.go index 61712b51..6f6c5fec 100644 --- a/vendor/golang.org/x/sys/unix/race.go +++ b/vendor/golang.org/x/sys/unix/race.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin && race) || (linux && race) || (freebsd && race) // +build darwin,race linux,race freebsd,race package unix diff --git a/vendor/golang.org/x/sys/unix/race0.go b/vendor/golang.org/x/sys/unix/race0.go index ad026678..706e1322 100644 --- a/vendor/golang.org/x/sys/unix/race0.go +++ b/vendor/golang.org/x/sys/unix/race0.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly +//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos +// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdents.go b/vendor/golang.org/x/sys/unix/readdirent_getdents.go index 3a90aa6d..4d625756 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdents.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdents.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd // +build aix dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go index 5fdae40b..2a4ba47c 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin // +build darwin package unix diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 003916ed..453a942c 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Socket control messages diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go index 57a0021d..0840fe4a 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin freebsd linux netbsd openbsd solaris +//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin freebsd linux netbsd openbsd solaris zos package unix @@ -36,6 +37,10 @@ func cmsgAlignOf(salen int) int { if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" { salign = 16 } + case "zos": + // z/OS socket macros use [32-bit] sizeof(int) alignment, + // not pointer width. + salign = SizeofInt } return (salen + salign - 1) & ^(salign - 1) diff --git a/vendor/golang.org/x/sys/unix/str.go b/vendor/golang.org/x/sys/unix/str.go index 17fb6986..8ba89ed8 100644 --- a/vendor/golang.org/x/sys/unix/str.go +++ b/vendor/golang.org/x/sys/unix/str.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index ab75ef9c..649fa874 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Package unix contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index 44081538..d8efb715 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix // +build aix // Aix system calls. @@ -251,7 +252,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } } - bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] + bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] sa.Name = string(bytes) return sa, nil @@ -419,8 +420,8 @@ func (w WaitStatus) TrapCause() int { return -1 } //sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) -//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64 -//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) +//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64 +//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -439,8 +440,8 @@ func (w WaitStatus) TrapCause() int { return -1 } //sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Umask(mask int) (oldmask int) //sysnb Uname(buf *Utsname) (err error) -//sys Unlink(path string) (err error) -//sys Unlinkat(dirfd int, path string, flags int) (err error) +//sys Unlink(path string) (err error) +//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys write(fd int, p []byte) (n int, err error) //sys readlen(fd int, p *byte, np int) (n int, err error) = read @@ -514,7 +515,7 @@ func Munmap(b []byte) (err error) { //sys Munlock(b []byte) (err error) //sys Munlockall() (err error) -//sysnb pipe(p *[2]_C_int) (err error) +//sysnb pipe(p *[2]_C_int) (err error) func Pipe(p []int) (err error) { if len(p) != 2 { diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index b3c8e330..e92a0be1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc +//go:build aix && ppc +// +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 9a6e0241..16eed170 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc64 +//go:build aix && ppc64 +// +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index bc634a28..95ac3946 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || dragonfly || freebsd || netbsd || openbsd // +build darwin dragonfly freebsd netbsd openbsd // BSD system call wrappers shared by *BSD based systems @@ -318,7 +319,7 @@ func Getsockname(fd int) (sa Sockaddr, err error) { return anyToSockaddr(fd, &rsa) } -//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) // GetsockoptString returns the string value of the socket option opt for the // socket associated with fd at the given socket level. @@ -332,8 +333,8 @@ func GetsockoptString(fd, level, opt int) (string, error) { return string(buf[:vallen-1]), nil } -//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) -//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { @@ -626,7 +627,7 @@ func Futimes(fd int, tv []Timeval) error { return futimes(fd, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) +//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) func Poll(fds []PollFd, timeout int) (n int, err error) { if len(fds) == 0 { diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go index b31ef035..b0098607 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && go1.12 && !go1.13 // +build darwin,go1.12,!go1.13 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go index ee852f1a..1596426b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && go1.13 // +build darwin,go1.13 package unix @@ -16,7 +17,7 @@ import ( //sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) func fdopendir(fd int) (dir uintptr, err error) { - r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0) dir = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,7 +25,7 @@ func fdopendir(fd int) (dir uintptr, err error) { return } -func libc_fdopendir_trampoline() +var libc_fdopendir_trampoline_addr uintptr //go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 16f9c226..d59fb95c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -13,6 +13,7 @@ package unix import ( + "fmt" "runtime" "syscall" "unsafe" @@ -119,7 +120,7 @@ type attrList struct { Forkattr uint32 } -//sysnb pipe(p *[2]int32) (err error) +//sysnb pipe(p *[2]int32) (err error) func Pipe(p []int) (err error) { if len(p) != 2 { @@ -272,7 +273,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { options) } -//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) +//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error { // Darwin doesn't support SYS_UTIMENSAT @@ -320,7 +321,7 @@ func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { return err } -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} @@ -378,8 +379,65 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return } +func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) { + var value IPMreqn + vallen := _Socklen(SizeofIPMreqn) + errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, errno +} + +func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) +} + +// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct. +// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively. +func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { + x := new(Xucred) + vallen := _Socklen(SizeofXucred) + err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen) + return x, err +} + +func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) { + mib, err := sysctlmib(name) + if err != nil { + return nil, err + } + + // Find size. + n := uintptr(0) + if err := sysctl(mib, nil, &n, nil, 0); err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } + + // Read into buffer of that size. + buf := make([]KinfoProc, n/SizeofKinfoProc) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil { + return nil, err + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } + + // The actual call may return less than the original reported required + // size so ensure we deal with that. + return buf[:n/SizeofKinfoProc], nil +} + //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) +//sys shmdt(addr uintptr) (err error) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Exposed directly */ @@ -472,8 +530,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) -//sys munmap(addr uintptr, length uintptr) (err error) +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) +//sys munmap(addr uintptr, length uintptr) (err error) //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE @@ -537,10 +595,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e // Msgget // Msgsnd // Msgrcv -// Shmat -// Shmctl -// Shmdt -// Shmget // Shm_open // Shm_unlink // Sem_open diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go deleted file mode 100644 index ee065fcf..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build 386,darwin - -package unix - -import "syscall" - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: int32(sec), Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: int32(sec), Usec: int32(usec)} -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint32(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint32(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (msghdr *Msghdr) SetIovlen(length int) { - msghdr.Iovlen = int32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 -//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 -//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 -//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace -//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 -//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index 7a1f64a7..b37310ce 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && darwin // +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go deleted file mode 100644 index d30735c5..00000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -import "syscall" - -func ptrace1(request int, pid int, addr uintptr, data uintptr) error { - return ENOTSUP -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: int32(sec), Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: int32(sec), Usec: int32(usec)} -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint32(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint32(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (msghdr *Msghdr) SetIovlen(length int) { - msghdr.Iovlen = int32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic - -//sys Fstat(fd int, stat *Stat_t) (err error) -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) -//sys Fstatfs(fd int, stat *Statfs_t) (err error) -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT -//sys Lstat(path string, stat *Stat_t) (err error) -//sys Stat(path string, stat *Stat_t) (err error) -//sys Statfs(path string, stat *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index 9f85fd40..d51ec996 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && darwin // +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go index f34c86c8..53c96641 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && go1.12 // +build darwin,go1.12 package unix -import "unsafe" +import _ "unsafe" // Implemented in the runtime package (runtime/sys_darwin.go) func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) @@ -24,10 +25,3 @@ func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) //go:linkname syscall_rawSyscall syscall.rawSyscall //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 //go:linkname syscall_syscallPtr syscall.syscallPtr - -// Find the entry point for f. See comments in runtime/proc.go for the -// function of the same name. -//go:nosplit -func funcPC(f func()) uintptr { - return **(**uintptr)(unsafe.Pointer(&f)) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index a4f2944a..5af108a5 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -95,7 +95,7 @@ func direntNamlen(buf []byte) (uint64, bool) { return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) } -//sysnb pipe() (r int, w int, err error) +//sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { if len(p) != 2 { @@ -105,16 +105,16 @@ func Pipe(p []int) (err error) { return } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) +//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error) -func Pipe2(p []int, flags int) error { +func Pipe2(p []int, flags int) (err error) { if len(p) != 2 { return EINVAL } var pp [2]_C_int - err := pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + // pipe2 on dragonfly takes an fds array as an argument, but still + // returns the file descriptors. + p[0], p[1], err = pipe2(&pp, flags) return err } @@ -170,7 +170,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error { err := sysctl(mib, old, oldlen, nil, 0) @@ -337,8 +337,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) -//sys munmap(addr uintptr, length uintptr) (err error) +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) +//sys munmap(addr uintptr, length uintptr) (err error) //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go index a6b4830a..4e2d3212 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && dragonfly // +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index acc00c2e..18c392cf 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -126,6 +126,15 @@ func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) } +// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct. +// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively. +func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { + x := new(Xucred) + vallen := _Socklen(SizeofXucred) + err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen) + return x, err +} + func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -188,9 +197,9 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { return ENOSYS } -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} @@ -665,8 +674,8 @@ func PtraceSingleStep(pid int) (err error) { //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) -//sys munmap(addr uintptr, length uintptr) (err error) +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) +//sys munmap(addr uintptr, length uintptr) (err error) //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index 72a506dd..342fc32b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && freebsd // +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index d5e376ac..a32d5aa4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && freebsd // +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 4ea45bce..1e36d39a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && freebsd // +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index aa5326db..a09a1537 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && freebsd // +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 7a2d4120..8d5f294c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -1,14 +1,19 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // illumos system calls not present on Solaris. +//go:build amd64 && illumos // +build amd64,illumos package unix -import "unsafe" +import ( + "fmt" + "runtime" + "unsafe" +) func bytes2iovec(bs [][]byte) []Iovec { iovecs := make([]Iovec, len(bs)) @@ -75,3 +80,107 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { } return } + +//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) + +func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) { + var clp, datap *strbuf + if len(cl) > 0 { + clp = &strbuf{ + Len: int32(len(cl)), + Buf: (*int8)(unsafe.Pointer(&cl[0])), + } + } + if len(data) > 0 { + datap = &strbuf{ + Len: int32(len(data)), + Buf: (*int8)(unsafe.Pointer(&data[0])), + } + } + return putmsg(fd, clp, datap, flags) +} + +//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) + +func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) { + var clp, datap *strbuf + if len(cl) > 0 { + clp = &strbuf{ + Maxlen: int32(len(cl)), + Buf: (*int8)(unsafe.Pointer(&cl[0])), + } + } + if len(data) > 0 { + datap = &strbuf{ + Maxlen: int32(len(data)), + Buf: (*int8)(unsafe.Pointer(&data[0])), + } + } + + if err = getmsg(fd, clp, datap, &flags); err != nil { + return nil, nil, 0, err + } + + if len(cl) > 0 { + retCl = cl[:clp.Len] + } + if len(data) > 0 { + retData = data[:datap.Len] + } + return retCl, retData, flags, nil +} + +func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) { + return ioctlRet(fd, req, uintptr(arg)) +} + +func IoctlSetString(fd int, req uint, val string) error { + bs := make([]byte, len(val)+1) + copy(bs[:len(bs)-1], val) + err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0]))) + runtime.KeepAlive(&bs[0]) + return err +} + +// Lifreq Helpers + +func (l *Lifreq) SetName(name string) error { + if len(name) >= len(l.Name) { + return fmt.Errorf("name cannot be more than %d characters", len(l.Name)-1) + } + for i := range name { + l.Name[i] = int8(name[i]) + } + return nil +} + +func (l *Lifreq) SetLifruInt(d int) { + *(*int)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruInt() int { + return *(*int)(unsafe.Pointer(&l.Lifru[0])) +} + +func (l *Lifreq) SetLifruUint(d uint) { + *(*uint)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruUint() uint { + return *(*uint)(unsafe.Pointer(&l.Lifru[0])) +} + +func IoctlLifreq(fd int, req uint, l *Lifreq) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(l))) +} + +// Strioctl Helpers + +func (s *Strioctl) SetInt(i int) { + s.Len = int32(unsafe.Sizeof(i)) + s.Dp = (*int8)(unsafe.Pointer(&i)) +} + +func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) { + return ioctlRet(fd, req, uintptr(unsafe.Pointer(s))) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 28be1306..fff38a84 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -13,7 +13,6 @@ package unix import ( "encoding/binary" - "runtime" "syscall" "unsafe" ) @@ -38,6 +37,13 @@ func Creat(path string, mode uint32) (fd int, err error) { return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode) } +func EpollCreate(size int) (fd int, err error) { + if size <= 0 { + return -1, EINVAL + } + return EpollCreate1(0) +} + //sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) //sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) @@ -66,92 +72,22 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { return fchmodat(dirfd, path, mode) } -//sys ioctl(fd int, req uint, arg uintptr) (err error) - -// ioctl itself should not be exposed directly, but additional get/set -// functions for specific types are permissible. - -// IoctlRetInt performs an ioctl operation specified by req on a device -// associated with opened file descriptor fd, and returns a non-negative -// integer that is returned by the ioctl syscall. -func IoctlRetInt(fd int, req uint) (int, error) { - ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0) - if err != 0 { - return 0, err - } - return int(ret), nil +func InotifyInit() (fd int, err error) { + return InotifyInit1(0) } -func IoctlSetRTCTime(fd int, value *RTCTime) error { - err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} +//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL +//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL -func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error { - err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - -func IoctlGetUint32(fd int, req uint) (uint32, error) { - var value uint32 - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return value, err -} - -func IoctlGetRTCTime(fd int) (*RTCTime, error) { - var value RTCTime - err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value))) - return &value, err -} - -// IoctlGetWatchdogInfo fetches information about a watchdog device from the -// Linux watchdog API. For more information, see: -// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. -func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) { - var value WatchdogInfo - err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value))) - return &value, err -} - -func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) { - var value RTCWkAlrm - err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value))) - return &value, err -} - -// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the -// range of data conveyed in value to the file associated with the file -// descriptor destFd. See the ioctl_ficlonerange(2) man page for details. -func IoctlFileCloneRange(destFd int, value *FileCloneRange) error { - err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - -// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file -// associated with the file description srcFd to the file associated with the -// file descriptor destFd. See the ioctl_ficlone(2) man page for details. -func IoctlFileClone(destFd, srcFd int) error { - return ioctl(destFd, FICLONE, uintptr(srcFd)) -} - -// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the -// range of data conveyed in value with the file associated with the file -// descriptor destFd. See the ioctl_fideduperange(2) man page for details. -func IoctlFileDedupeRange(destFd int, value *FileDedupeRange) error { - err := ioctl(destFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - -// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For -// more information, see: -// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. -func IoctlWatchdogKeepalive(fd int) error { - return ioctl(fd, WDIOC_KEEPALIVE, 0) -} +// ioctl itself should not be exposed directly, but additional get/set functions +// for specific types are permissible. These are defined in ioctl.go and +// ioctl_linux.go. +// +// The third argument to ioctl is often a pointer but sometimes an integer. +// Callers should use ioctlPtr when the third argument is a pointer and ioctl +// when the third argument is an integer. +// +// TODO: some existing code incorrectly uses ioctl when it should use ioctlPtr. //sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) @@ -183,6 +119,23 @@ func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) { return openat2(dirfd, path, how, SizeofOpenHow) } +func Pipe(p []int) error { + return Pipe2(p, 0) +} + +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { @@ -192,6 +145,15 @@ func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error return ppoll(&fds[0], len(fds), timeout, sigmask) } +func Poll(fds []PollFd, timeout int) (n int, err error) { + var ts *Timespec + if timeout >= 0 { + ts = new(Timespec) + *ts = NsecToTimespec(int64(timeout) * 1e6) + } + return Ppoll(fds, ts, nil) +} + //sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) func Readlink(path string, buf []byte) (n int, err error) { @@ -242,27 +204,7 @@ func Utimes(path string, tv []Timeval) error { //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) func UtimesNano(path string, ts []Timespec) error { - if ts == nil { - err := utimensat(AT_FDCWD, path, nil, 0) - if err != ENOSYS { - return err - } - return utimes(path, nil) - } - if len(ts) != 2 { - return EINVAL - } - err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) - if err != ENOSYS { - return err - } - // If the utimensat syscall isn't available (utimensat was added to Linux - // in 2.6.22, Released, 8 July 2007) then fall back to utimes - var tv [2]Timeval - for i := 0; i < 2; i++ { - tv[i] = NsecToTimeval(TimespecToNsec(ts[i])) - } - return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) + return UtimesNanoAt(AT_FDCWD, path, ts, 0) } func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error { @@ -778,16 +720,19 @@ type SockaddrVM struct { // CID and Port specify a context ID and port address for a VM socket. // Guests have a unique CID, and hosts may have a well-known CID of: // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process. + // - VMADDR_CID_LOCAL: refers to local communication (loopback). // - VMADDR_CID_HOST: refers to other processes on the host. - CID uint32 - Port uint32 - raw RawSockaddrVM + CID uint32 + Port uint32 + Flags uint8 + raw RawSockaddrVM } func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_VSOCK sa.raw.Port = sa.Port sa.raw.Cid = sa.CID + sa.raw.Flags = sa.Flags return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil } @@ -982,6 +927,46 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil } +type SockaddrNFC struct { + DeviceIdx uint32 + TargetIdx uint32 + NFCProtocol uint32 + raw RawSockaddrNFC +} + +func (sa *SockaddrNFC) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Sa_family = AF_NFC + sa.raw.Dev_idx = sa.DeviceIdx + sa.raw.Target_idx = sa.TargetIdx + sa.raw.Nfc_protocol = sa.NFCProtocol + return unsafe.Pointer(&sa.raw), SizeofSockaddrNFC, nil +} + +type SockaddrNFCLLCP struct { + DeviceIdx uint32 + TargetIdx uint32 + NFCProtocol uint32 + DestinationSAP uint8 + SourceSAP uint8 + ServiceName string + raw RawSockaddrNFCLLCP +} + +func (sa *SockaddrNFCLLCP) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Sa_family = AF_NFC + sa.raw.Dev_idx = sa.DeviceIdx + sa.raw.Target_idx = sa.TargetIdx + sa.raw.Nfc_protocol = sa.NFCProtocol + sa.raw.Dsap = sa.DestinationSAP + sa.raw.Ssap = sa.SourceSAP + if len(sa.ServiceName) > len(sa.raw.Service_name) { + return nil, 0, EINVAL + } + copy(sa.raw.Service_name[:], sa.ServiceName) + sa.raw.SetServiceNameLen(len(sa.ServiceName)) + return unsafe.Pointer(&sa.raw), SizeofSockaddrNFCLLCP, nil +} + var socketProtocol = func(fd int) (int, error) { return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) } @@ -1092,8 +1077,9 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { case AF_VSOCK: pp := (*RawSockaddrVM)(unsafe.Pointer(rsa)) sa := &SockaddrVM{ - CID: pp.Cid, - Port: pp.Port, + CID: pp.Cid, + Port: pp.Port, + Flags: pp.Flags, } return sa, nil case AF_BLUETOOTH: @@ -1221,6 +1207,37 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } return sa, nil } + case AF_NFC: + proto, err := socketProtocol(fd) + if err != nil { + return nil, err + } + switch proto { + case NFC_SOCKPROTO_RAW: + pp := (*RawSockaddrNFC)(unsafe.Pointer(rsa)) + sa := &SockaddrNFC{ + DeviceIdx: pp.Dev_idx, + TargetIdx: pp.Target_idx, + NFCProtocol: pp.Nfc_protocol, + } + return sa, nil + case NFC_SOCKPROTO_LLCP: + pp := (*RawSockaddrNFCLLCP)(unsafe.Pointer(rsa)) + if uint64(pp.Service_name_len) > uint64(len(pp.Service_name)) { + return nil, EINVAL + } + sa := &SockaddrNFCLLCP{ + DeviceIdx: pp.Dev_idx, + TargetIdx: pp.Target_idx, + NFCProtocol: pp.Nfc_protocol, + DestinationSAP: pp.Dsap, + SourceSAP: pp.Ssap, + ServiceName: string(pp.Service_name[:pp.Service_name_len]), + } + return sa, nil + default: + return nil, EINVAL + } } return nil, EAFNOSUPPORT } @@ -1228,7 +1245,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { func Accept(fd int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny - nfd, err = accept(fd, &rsa, &len) + nfd, err = accept4(fd, &rsa, &len, 0) if err != nil { return } @@ -1350,6 +1367,13 @@ func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error { return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp)) } +func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) { + if len(o) == 0 { + return EINVAL + } + return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o))) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1482,8 +1506,8 @@ func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error return keyctlRestrictKeyringByType(KEYCTL_RESTRICT_KEYRING, ringid, keyType, restriction) } -//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL -//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL +//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL +//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { var msg Msghdr @@ -1798,16 +1822,13 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys ClockGettime(clockid int32, time *Timespec) (err error) //sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) //sys Close(fd int) (err error) +//sys CloseRange(first uint, last uint, flags uint) (err error) //sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys DeleteModule(name string, flags int) (err error) //sys Dup(oldfd int) (fd int, err error) func Dup2(oldfd, newfd int) error { - // Android O and newer blocks dup2; riscv and arm64 don't implement dup2. - if runtime.GOOS == "android" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "arm64" { - return Dup3(oldfd, newfd, 0) - } - return dup2(oldfd, newfd) + return Dup3(oldfd, newfd, 0) } //sys Dup3(oldfd int, newfd int, flags int) (err error) @@ -1860,8 +1881,8 @@ func Getpgrp() (pid int) { //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT -//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 -//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) +//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 +//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) @@ -1934,9 +1955,9 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { //sys Syncfs(fd int) (err error) //sysnb Sysinfo(info *Sysinfo_t) (err error) //sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error) -//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error) -//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error) -//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error) +//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error) +//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error) +//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error) //sysnb Tgkill(tgid int, tid int, sig syscall.Signal) (err error) //sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Umask(mask int) (oldmask int) @@ -2196,8 +2217,8 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { return EACCES } -//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT -//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT +//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT +//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT // fileHandle is the argument to nameToHandleAt and openByHandleAt. We // originally tried to generate it via unix/linux/types.go with "type @@ -2295,6 +2316,14 @@ type RemoteIovec struct { //sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV //sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV +//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN +//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD + +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) +//sys shmdt(addr uintptr) (err error) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Unimplemented */ @@ -2376,10 +2405,6 @@ type RemoteIovec struct { // SetRobustList // SetThreadArea // SetTidAddress -// Shmat -// Shmctl -// Shmdt -// Shmget // Sigaltstack // Swapoff // Swapon diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index c97c2ee5..5f757e8a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && linux // +build 386,linux package unix @@ -18,36 +19,8 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // 64-bit file system and 32-bit uid calls // (386 default is 32-bit file system and 16-bit uid). -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 @@ -58,7 +31,6 @@ func Pipe2(p []int, flags int) (err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 @@ -98,13 +70,13 @@ type rlimit32 struct { Max uint32 } -//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -129,10 +101,10 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -377,11 +349,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 72efe86e..4299125a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && linux // +build amd64,linux package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -20,17 +19,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb inotifyInit() (fd int, err error) - -func InotifyInit() (fd int, err error) { - // First try inotify_init1, because Android's seccomp policy blocks the latter. - fd, err = InotifyInit1(0) - if err == ENOSYS { - fd, err = inotifyInit() - } - return -} - //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -125,32 +113,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Rip } func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc } @@ -171,13 +133,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go index baa771f8..8b0f0f3a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,linux -// +build gc +//go:build amd64 && linux && gc +// +build amd64,linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index 496837b1..79edeb9c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && linux // +build arm,linux package unix @@ -18,36 +19,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - // Try pipe2 first for Android O, then try pipe for kernel 2.6.23. - err = pipe2(&pp, 0) - if err == ENOSYS { - err = pipe(&pp) - } - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { newoffset, errno := seek(fd, offset, whence) if errno != 0 { @@ -75,8 +46,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { // 64-bit file system and 32-bit uid calls // (16-bit uid calls are not always supported in newer kernels) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 @@ -85,7 +54,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 @@ -129,8 +97,8 @@ func Utime(path string, buf *Utimbuf) error { //sys utimes(path string, times *[2]Timeval) (err error) -//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 -//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 //sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 @@ -177,13 +145,13 @@ type rlimit32 struct { Max uint32 } -//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -208,10 +176,10 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -255,13 +223,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) } //sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index c6de6b91..862890de 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -2,19 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && linux // +build arm64,linux package unix import "unsafe" -func EpollCreate(size int) (fd int, err error) { - if size <= 0 { - return -1, EINVAL - } - return EpollCreate1(0) -} - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -144,33 +138,9 @@ func utimes(path string, tv *[2]Timeval) (err error) { return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // Getrlimit prefers the prlimit64 system call. See issue 38604. func Getrlimit(resource int, rlim *Rlimit) error { - err := prlimit(0, resource, nil, rlim) + err := Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -179,7 +149,7 @@ func Getrlimit(resource int, rlim *Rlimit) error { // Setrlimit prefers the prlimit64 system call. See issue 38604. func Setrlimit(resource int, rlim *Rlimit) error { - err := prlimit(0, resource, rlim, nil) + err := Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -206,31 +176,15 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } -// dup2 exists because func Dup3 in syscall_linux.go references -// it in an unreachable path. dup2 isn't available on arm64. -func dup2(oldfd int, newfd int) error - func Pause() error { _, err := ppoll(nil, 0, nil, nil) return err } -func Poll(fds []PollFd, timeout int) (n int, err error) { - var ts *Timespec - if timeout >= 0 { - ts = new(Timespec) - *ts = NsecToTimespec(int64(timeout) * 1e6) - } - if len(fds) == 0 { - return ppoll(nil, 0, ts, nil) - } - return ppoll(&fds[0], len(fds), ts, nil) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go index 9edf3961..2b1168d7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && gc // +build linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go index 90e33d8c..9843fb48 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && gc && 386 // +build linux,gc,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go index 1a97baae..a6008fcc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && gc && linux // +build arm,gc,linux package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go index 308eb7ae..7740af24 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && gccgo && 386 // +build linux,gccgo,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go index aa7fc9e1..e16a1229 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && gccgo && arm // +build linux,gccgo,arm package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index f0287476..8932e34a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips64 || mips64le) // +build linux // +build mips64 mips64le package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -93,30 +92,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Ioperm(from int, num int, on int) (err error) { return ENOSYS } @@ -216,15 +191,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index c1132811..7821c25d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips || mipsle) // +build linux // +build mips mipsle @@ -14,8 +15,6 @@ import ( func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -59,7 +58,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) @@ -112,29 +110,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe() (p1 int, p2 int, err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - p[0], p[1], err = pipe() - return -} - //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { @@ -153,10 +128,10 @@ type rlimit32 struct { Max uint32 } -//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -181,10 +156,10 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -228,11 +203,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go new file mode 100644 index 00000000..c5053a0f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -0,0 +1,237 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux && ppc +// +build linux,ppc + +package unix + +import ( + "syscall" + "unsafe" +) + +//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) +//sys Fchown(fd int, uid int, gid int) (err error) +//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 +//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 +//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 +//sysnb Getegid() (egid int) +//sysnb Geteuid() (euid int) +//sysnb Getgid() (gid int) +//sysnb Getuid() (uid int) +//sys Ioperm(from int, num int, on int) (err error) +//sys Iopl(level int) (err error) +//sys Lchown(path string, uid int, gid int) (err error) +//sys Listen(s int, n int) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 +//sys Pause() (err error) +//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) +//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT +//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 +//sys setfsgid(gid int) (prev int, err error) +//sys setfsuid(uid int) (prev int, err error) +//sysnb Setregid(rgid int, egid int) (err error) +//sysnb Setresgid(rgid int, egid int, sgid int) (err error) +//sysnb Setresuid(ruid int, euid int, suid int) (err error) +//sysnb Setreuid(ruid int, euid int) (err error) +//sys Shutdown(fd int, how int) (err error) +//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) +//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 +//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 +//sys Ustat(dev int, ubuf *Ustat_t) (err error) +//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) +//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) +//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) +//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) +//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) +//sysnb setgroups(n int, list *_Gid_t) (err error) +//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) +//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) +//sysnb socket(domain int, typ int, proto int) (fd int, err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) +//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) +//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) + +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) +//sysnb Gettimeofday(tv *Timeval) (err error) +//sysnb Time(t *Time_t) (tt Time_t, err error) +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) + +func Fadvise(fd int, offset int64, length int64, advice int) (err error) { + _, _, e1 := Syscall6(SYS_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset>>32), uintptr(offset), uintptr(length>>32), uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { + var newoffset int64 + offsetLow := uint32(offset & 0xffffffff) + offsetHigh := uint32((offset >> 32) & 0xffffffff) + _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) + return newoffset, err +} + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + newoffset, errno := seek(fd, offset, whence) + if errno != 0 { + return 0, errno + } + return newoffset, nil +} + +func Fstatfs(fd int, buf *Statfs_t) (err error) { + _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) + if e != 0 { + err = e + } + return +} + +func Statfs(path string, buf *Statfs_t) (err error) { + pathp, err := BytePtrFromString(path) + if err != nil { + return err + } + _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) + if e != 0 { + err = e + } + return +} + +//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) + +func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { + page := uintptr(offset / 4096) + if offset != int64(page)*4096 { + return 0, EINVAL + } + return mmap2(addr, length, prot, flags, fd, page) +} + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: int32(sec), Nsec: int32(nsec)} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: int32(sec), Usec: int32(usec)} +} + +type rlimit32 struct { + Cur uint32 + Max uint32 +} + +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT + +const rlimInf32 = ^uint32(0) +const rlimInf64 = ^uint64(0) + +func Getrlimit(resource int, rlim *Rlimit) (err error) { + err = Prlimit(0, resource, nil, rlim) + if err != ENOSYS { + return err + } + + rl := rlimit32{} + err = getrlimit(resource, &rl) + if err != nil { + return + } + + if rl.Cur == rlimInf32 { + rlim.Cur = rlimInf64 + } else { + rlim.Cur = uint64(rl.Cur) + } + + if rl.Max == rlimInf32 { + rlim.Max = rlimInf64 + } else { + rlim.Max = uint64(rl.Max) + } + return +} + +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT + +func Setrlimit(resource int, rlim *Rlimit) (err error) { + err = Prlimit(0, resource, rlim, nil) + if err != ENOSYS { + return err + } + + rl := rlimit32{} + if rlim.Cur == rlimInf64 { + rl.Cur = rlimInf32 + } else if rlim.Cur < uint64(rlimInf32) { + rl.Cur = uint32(rlim.Cur) + } else { + return EINVAL + } + if rlim.Max == rlimInf64 { + rl.Max = rlimInf32 + } else if rlim.Max < uint64(rlimInf32) { + rl.Max = uint32(rlim.Max) + } else { + return EINVAL + } + + return setrlimit(resource, &rl) +} + +func (r *PtraceRegs) PC() uint32 { return r.Nip } + +func (r *PtraceRegs) SetPC(pc uint32) { r.Nip = pc } + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint32(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (msghdr *Msghdr) SetIovlen(length int) { + msghdr.Iovlen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) +} + +//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 + +func SyncFileRange(fd int, off int64, n int64, flags int) error { + // The sync_file_range and sync_file_range2 syscalls differ only in the + // order of their arguments. + return syncFileRange2(fd, flags, off, n) +} + +//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) + +func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { + cmdlineLen := len(cmdline) + if cmdlineLen > 0 { + // Account for the additional NULL byte added by + // BytePtrFromString in kexecFileLoad. The kexec_file_load + // syscall expects a NULL-terminated string. + cmdlineLen++ + } + return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 34937440..25786c42 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (ppc64 || ppc64le) // +build linux // +build ppc64 ppc64le package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -21,7 +20,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -99,39 +97,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } //sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index b0b15055..6f9f7104 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -2,19 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build riscv64 && linux // +build riscv64,linux package unix import "unsafe" -func EpollCreate(size int) (fd int, err error) { - if size <= 0 { - return -1, EINVAL - } - return EpollCreate1(0) -} - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -143,30 +137,6 @@ func utimes(path string, tv *[2]Timeval) (err error) { return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Pc } func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc } @@ -187,8 +157,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } func Pause() error { @@ -196,18 +166,6 @@ func Pause() error { return err } -func Poll(fds []PollFd, timeout int) (n int, err error) { - var ts *Timespec - if timeout >= 0 { - ts = new(Timespec) - *ts = NsecToTimespec(int64(timeout) * 1e6) - } - if len(fds) == 0 { - return ppoll(nil, 0, ts, nil) - } - return ppoll(&fds[0], len(fds), ts, nil) -} - func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0) } @@ -224,7 +182,3 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error } return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) } - -// dup2 exists because func Dup3 in syscall_linux.go references -// it in an unreachable path. dup2 isn't available on arm64. -func dup2(oldfd int, newfd int) error diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index 2363f749..6aa59cb2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build s390x && linux // +build s390x,linux package unix @@ -10,8 +11,6 @@ import ( "unsafe" ) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -24,7 +23,6 @@ import ( //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) //sys Pause() (err error) @@ -76,30 +74,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0. - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Ioperm(from int, num int, on int) (err error) { return ENOSYS } @@ -128,6 +102,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) +} + // Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct. // mmap2 also requires arguments to be passed in a struct; it is currently not exposed in . func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { @@ -249,7 +227,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen } func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error { - args := [4]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val)} + args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen} _, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0) if err != 0 { return err @@ -319,15 +297,6 @@ func Shutdown(s, how int) error { return nil } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index d389f151..bbe8d174 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build sparc64 && linux // +build sparc64,linux package unix //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 -//sys dup2(oldfd int, newfd int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 @@ -19,7 +19,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) @@ -115,37 +114,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 1e6843b4..853d5f0f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -110,7 +110,8 @@ func direntNamlen(buf []byte) (uint64, bool) { return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) } -//sysnb pipe() (fd1 int, fd2 int, err error) +//sysnb pipe() (fd1 int, fd2 int, err error) + func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL @@ -119,7 +120,21 @@ func Pipe(p []int) (err error) { return } -//sys Getdents(fd int, buf []byte) (n int, err error) +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} + +//sys Getdents(fd int, buf []byte) (n int, err error) + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { n, err = Getdents(fd, buf) if err != nil || basep == nil { @@ -159,7 +174,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) { var value Ptmget diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go index 24da8b52..5199d282 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && netbsd // +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go index 25a0ac82..70a9c52e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && netbsd // +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go index 21591ecd..3eb5942f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && netbsd // +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go index 80474963..fc6ccfd8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && netbsd // +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 6a50b50b..22b55038 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -92,7 +92,7 @@ func Pipe2(p []int, flags int) error { return err } -//sys Getdents(fd int, buf []byte) (n int, err error) +//sys Getdents(fd int, buf []byte) (n int, err error) func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { n, err = Getdents(fd, buf) if err != nil || basep == nil { @@ -154,7 +154,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index 42b5a0e5..6baabcdc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && openbsd // +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index 6ea4b488..bab25360 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && openbsd // +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go index 1c3d26fa..8eed3c4d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && openbsd // +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go index a8c458cb..483dde99 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && openbsd // +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 184786ed..d2a6495c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -13,7 +13,10 @@ package unix import ( + "fmt" + "os" "runtime" + "sync" "syscall" "unsafe" ) @@ -565,7 +568,12 @@ func Minor(dev uint64) uint32 { * Expose the ioctl function */ -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) = libc.ioctl + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, err = ioctlRet(fd, req, arg) + return err +} func IoctlSetTermio(fd int, req uint, value *Termio) error { err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) @@ -579,7 +587,7 @@ func IoctlGetTermio(fd int, req uint) (*Termio, error) { return &value, err } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) +//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) func Poll(fds []PollFd, timeout int) (n int, err error) { if len(fds) == 0 { @@ -682,6 +690,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Statvfs(path string, vfsstat *Statvfs_t) (err error) //sys Symlink(path string, link string) (err error) //sys Sync() (err error) +//sys Sysconf(which int) (n int64, err error) //sysnb Times(tms *Tms) (ticks uintptr, err error) //sys Truncate(path string, length int64) (err error) //sys Fsync(fd int) (err error) @@ -738,3 +747,240 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e func Munmap(b []byte) (err error) { return mapper.Munmap(b) } + +// Event Ports + +type fileObjCookie struct { + fobj *fileObj + cookie interface{} +} + +// EventPort provides a safe abstraction on top of Solaris/illumos Event Ports. +type EventPort struct { + port int + mu sync.Mutex + fds map[uintptr]interface{} + paths map[string]*fileObjCookie +} + +// PortEvent is an abstraction of the port_event C struct. +// Compare Source against PORT_SOURCE_FILE or PORT_SOURCE_FD +// to see if Path or Fd was the event source. The other will be +// uninitialized. +type PortEvent struct { + Cookie interface{} + Events int32 + Fd uintptr + Path string + Source uint16 + fobj *fileObj +} + +// NewEventPort creates a new EventPort including the +// underlying call to port_create(3c). +func NewEventPort() (*EventPort, error) { + port, err := port_create() + if err != nil { + return nil, err + } + e := &EventPort{ + port: port, + fds: make(map[uintptr]interface{}), + paths: make(map[string]*fileObjCookie), + } + return e, nil +} + +//sys port_create() (n int, err error) +//sys port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) +//sys port_dissociate(port int, source int, object uintptr) (n int, err error) +//sys port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) +//sys port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) + +// Close closes the event port. +func (e *EventPort) Close() error { + e.mu.Lock() + defer e.mu.Unlock() + e.fds = nil + e.paths = nil + return Close(e.port) +} + +// PathIsWatched checks to see if path is associated with this EventPort. +func (e *EventPort) PathIsWatched(path string) bool { + e.mu.Lock() + defer e.mu.Unlock() + _, found := e.paths[path] + return found +} + +// FdIsWatched checks to see if fd is associated with this EventPort. +func (e *EventPort) FdIsWatched(fd uintptr) bool { + e.mu.Lock() + defer e.mu.Unlock() + _, found := e.fds[fd] + return found +} + +// AssociatePath wraps port_associate(3c) for a filesystem path including +// creating the necessary file_obj from the provided stat information. +func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, cookie interface{}) error { + e.mu.Lock() + defer e.mu.Unlock() + if _, found := e.paths[path]; found { + return fmt.Errorf("%v is already associated with this Event Port", path) + } + fobj, err := createFileObj(path, stat) + if err != nil { + return err + } + fCookie := &fileObjCookie{fobj, cookie} + _, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie))) + if err != nil { + return err + } + e.paths[path] = fCookie + return nil +} + +// DissociatePath wraps port_dissociate(3c) for a filesystem path. +func (e *EventPort) DissociatePath(path string) error { + e.mu.Lock() + defer e.mu.Unlock() + f, ok := e.paths[path] + if !ok { + return fmt.Errorf("%v is not associated with this Event Port", path) + } + _, err := port_dissociate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(f.fobj))) + if err != nil { + return err + } + delete(e.paths, path) + return nil +} + +// AssociateFd wraps calls to port_associate(3c) on file descriptors. +func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) error { + e.mu.Lock() + defer e.mu.Unlock() + if _, found := e.fds[fd]; found { + return fmt.Errorf("%v is already associated with this Event Port", fd) + } + pcookie := &cookie + _, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(pcookie))) + if err != nil { + return err + } + e.fds[fd] = pcookie + return nil +} + +// DissociateFd wraps calls to port_dissociate(3c) on file descriptors. +func (e *EventPort) DissociateFd(fd uintptr) error { + e.mu.Lock() + defer e.mu.Unlock() + _, ok := e.fds[fd] + if !ok { + return fmt.Errorf("%v is not associated with this Event Port", fd) + } + _, err := port_dissociate(e.port, PORT_SOURCE_FD, fd) + if err != nil { + return err + } + delete(e.fds, fd) + return nil +} + +func createFileObj(name string, stat os.FileInfo) (*fileObj, error) { + fobj := new(fileObj) + bs, err := ByteSliceFromString(name) + if err != nil { + return nil, err + } + fobj.Name = (*int8)(unsafe.Pointer(&bs[0])) + s := stat.Sys().(*syscall.Stat_t) + fobj.Atim.Sec = s.Atim.Sec + fobj.Atim.Nsec = s.Atim.Nsec + fobj.Mtim.Sec = s.Mtim.Sec + fobj.Mtim.Nsec = s.Mtim.Nsec + fobj.Ctim.Sec = s.Ctim.Sec + fobj.Ctim.Nsec = s.Ctim.Nsec + return fobj, nil +} + +// GetOne wraps port_get(3c) and returns a single PortEvent. +func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) { + pe := new(portEvent) + _, err := port_get(e.port, pe, t) + if err != nil { + return nil, err + } + p := new(PortEvent) + p.Events = pe.Events + p.Source = pe.Source + e.mu.Lock() + defer e.mu.Unlock() + switch pe.Source { + case PORT_SOURCE_FD: + p.Fd = uintptr(pe.Object) + cookie := (*interface{})(unsafe.Pointer(pe.User)) + p.Cookie = *cookie + delete(e.fds, p.Fd) + case PORT_SOURCE_FILE: + p.fobj = (*fileObj)(unsafe.Pointer(uintptr(pe.Object))) + p.Path = BytePtrToString((*byte)(unsafe.Pointer(p.fobj.Name))) + cookie := (*interface{})(unsafe.Pointer(pe.User)) + p.Cookie = *cookie + delete(e.paths, p.Path) + } + return p, nil +} + +// Pending wraps port_getn(3c) and returns how many events are pending. +func (e *EventPort) Pending() (int, error) { + var n uint32 = 0 + _, err := port_getn(e.port, nil, 0, &n, nil) + return int(n), err +} + +// Get wraps port_getn(3c) and fills a slice of PortEvent. +// It will block until either min events have been received +// or the timeout has been exceeded. It will return how many +// events were actually received along with any error information. +func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) { + if min == 0 { + return 0, fmt.Errorf("need to request at least one event or use Pending() instead") + } + if len(s) < min { + return 0, fmt.Errorf("len(s) (%d) is less than min events requested (%d)", len(s), min) + } + got := uint32(min) + max := uint32(len(s)) + var err error + ps := make([]portEvent, max, max) + _, err = port_getn(e.port, &ps[0], max, &got, timeout) + // got will be trustworthy with ETIME, but not any other error. + if err != nil && err != ETIME { + return 0, err + } + e.mu.Lock() + defer e.mu.Unlock() + for i := 0; i < int(got); i++ { + s[i].Events = ps[i].Events + s[i].Source = ps[i].Source + switch ps[i].Source { + case PORT_SOURCE_FD: + s[i].Fd = uintptr(ps[i].Object) + cookie := (*interface{})(unsafe.Pointer(ps[i].User)) + s[i].Cookie = *cookie + delete(e.fds, s[i].Fd) + case PORT_SOURCE_FILE: + s[i].fobj = (*fileObj)(unsafe.Pointer(uintptr(ps[i].Object))) + s[i].Path = BytePtrToString((*byte)(unsafe.Pointer(s[i].fobj.Name))) + cookie := (*interface{})(unsafe.Pointer(ps[i].User)) + s[i].Cookie = *cookie + delete(e.paths, s[i].Path) + } + } + return int(got), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go index b22a34d7..0bd25ef8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && solaris // +build amd64,solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 400ba9fb..cf296a24 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix @@ -312,6 +313,10 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { return } +func Send(s int, buf []byte, flags int) (err error) { + return sendto(s, buf, flags, nil, 0) +} + func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) { ptr, n, err := to.sockaddr() if err != nil { diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index 87bd161c..5898e9a5 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc && !ppc64le && !ppc64 // +build darwin dragonfly freebsd linux netbsd openbsd solaris -// +build gc,!ppc64le,!ppc64 +// +build gc +// +build !ppc64le +// +build !ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go index d36216c3..f6f707ac 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (ppc64le || ppc64) && gc // +build linux // +build ppc64le ppc64 // +build gc diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go new file mode 100644 index 00000000..1ffd8bfc --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -0,0 +1,1829 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "bytes" + "runtime" + "sort" + "sync" + "syscall" + "unsafe" +) + +const ( + O_CLOEXEC = 0 // Dummy value (not supported). + AF_LOCAL = AF_UNIX // AF_LOCAL is an alias for AF_UNIX +) + +func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall_syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawsyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall_syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawsyscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) + +func copyStat(stat *Stat_t, statLE *Stat_LE_t) { + stat.Dev = uint64(statLE.Dev) + stat.Ino = uint64(statLE.Ino) + stat.Nlink = uint64(statLE.Nlink) + stat.Mode = uint32(statLE.Mode) + stat.Uid = uint32(statLE.Uid) + stat.Gid = uint32(statLE.Gid) + stat.Rdev = uint64(statLE.Rdev) + stat.Size = statLE.Size + stat.Atim.Sec = int64(statLE.Atim) + stat.Atim.Nsec = 0 //zos doesn't return nanoseconds + stat.Mtim.Sec = int64(statLE.Mtim) + stat.Mtim.Nsec = 0 //zos doesn't return nanoseconds + stat.Ctim.Sec = int64(statLE.Ctim) + stat.Ctim.Nsec = 0 //zos doesn't return nanoseconds + stat.Blksize = int64(statLE.Blksize) + stat.Blocks = statLE.Blocks +} + +func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64) +func svcLoad(name *byte) unsafe.Pointer +func svcUnload(name *byte, fnptr unsafe.Pointer) int64 + +func (d *Dirent) NameString() string { + if d == nil { + return "" + } + return string(d.Name[:d.Namlen]) +} + +func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { + if sa.Port < 0 || sa.Port > 0xFFFF { + return nil, 0, EINVAL + } + sa.raw.Len = SizeofSockaddrInet4 + sa.raw.Family = AF_INET + p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) + p[0] = byte(sa.Port >> 8) + p[1] = byte(sa.Port) + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Addr[i] = sa.Addr[i] + } + return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil +} + +func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { + if sa.Port < 0 || sa.Port > 0xFFFF { + return nil, 0, EINVAL + } + sa.raw.Len = SizeofSockaddrInet6 + sa.raw.Family = AF_INET6 + p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) + p[0] = byte(sa.Port >> 8) + p[1] = byte(sa.Port) + sa.raw.Scope_id = sa.ZoneId + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Addr[i] = sa.Addr[i] + } + return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil +} + +func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { + name := sa.Name + n := len(name) + if n >= len(sa.raw.Path) || n == 0 { + return nil, 0, EINVAL + } + sa.raw.Len = byte(3 + n) // 2 for Family, Len; 1 for NUL + sa.raw.Family = AF_UNIX + for i := 0; i < n; i++ { + sa.raw.Path[i] = int8(name[i]) + } + return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil +} + +func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) { + // TODO(neeilan): Implement use of first param (fd) + switch rsa.Addr.Family { + case AF_UNIX: + pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa)) + sa := new(SockaddrUnix) + // For z/OS, only replace NUL with @ when the + // length is not zero. + if pp.Len != 0 && pp.Path[0] == 0 { + // "Abstract" Unix domain socket. + // Rewrite leading NUL as @ for textual display. + // (This is the standard convention.) + // Not friendly to overwrite in place, + // but the callers below don't care. + pp.Path[0] = '@' + } + + // Assume path ends at NUL. + // + // For z/OS, the length of the name is a field + // in the structure. To be on the safe side, we + // will still scan the name for a NUL but only + // to the length provided in the structure. + // + // This is not technically the Linux semantics for + // abstract Unix domain sockets--they are supposed + // to be uninterpreted fixed-size binary blobs--but + // everyone uses this convention. + n := 0 + for n < int(pp.Len) && pp.Path[n] != 0 { + n++ + } + bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] + sa.Name = string(bytes) + return sa, nil + + case AF_INET: + pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa)) + sa := new(SockaddrInet4) + p := (*[2]byte)(unsafe.Pointer(&pp.Port)) + sa.Port = int(p[0])<<8 + int(p[1]) + for i := 0; i < len(sa.Addr); i++ { + sa.Addr[i] = pp.Addr[i] + } + return sa, nil + + case AF_INET6: + pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa)) + sa := new(SockaddrInet6) + p := (*[2]byte)(unsafe.Pointer(&pp.Port)) + sa.Port = int(p[0])<<8 + int(p[1]) + sa.ZoneId = pp.Scope_id + for i := 0; i < len(sa.Addr); i++ { + sa.Addr[i] = pp.Addr[i] + } + return sa, nil + } + return nil, EAFNOSUPPORT +} + +func Accept(fd int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + nfd, err = accept(fd, &rsa, &len) + if err != nil { + return + } + // TODO(neeilan): Remove 0 in call + sa, err = anyToSockaddr(0, &rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = int32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = int32(length) +} + +//sys fcntl(fd int, cmd int, arg int) (val int, err error) +//sys read(fd int, p []byte) (n int, err error) +//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ +//sys write(fd int, p []byte) (n int, err error) + +//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = SYS___ACCEPT_A +//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = SYS___BIND_A +//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = SYS___CONNECT_A +//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) +//sysnb setgroups(n int, list *_Gid_t) (err error) +//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) +//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) +//sysnb socket(domain int, typ int, proto int) (fd int, err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = SYS___GETPEERNAME_A +//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = SYS___GETSOCKNAME_A +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = SYS___RECVFROM_A +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = SYS___SENDTO_A +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___RECVMSG_A +//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___SENDMSG_A +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) = SYS_MMAP +//sys munmap(addr uintptr, length uintptr) (err error) = SYS_MUNMAP +//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL + +//sys Access(path string, mode uint32) (err error) = SYS___ACCESS_A +//sys Chdir(path string) (err error) = SYS___CHDIR_A +//sys Chown(path string, uid int, gid int) (err error) = SYS___CHOWN_A +//sys Chmod(path string, mode uint32) (err error) = SYS___CHMOD_A +//sys Creat(path string, mode uint32) (fd int, err error) = SYS___CREAT_A +//sys Dup(oldfd int) (fd int, err error) +//sys Dup2(oldfd int, newfd int) (err error) +//sys Errno2() (er2 int) = SYS___ERRNO2 +//sys Err2ad() (eadd *int) = SYS___ERR2AD +//sys Exit(code int) +//sys Fchdir(fd int) (err error) +//sys Fchmod(fd int, mode uint32) (err error) +//sys Fchown(fd int, uid int, gid int) (err error) +//sys FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) = SYS_FCNTL +//sys fstat(fd int, stat *Stat_LE_t) (err error) + +func Fstat(fd int, stat *Stat_t) (err error) { + var statLE Stat_LE_t + err = fstat(fd, &statLE) + copyStat(stat, &statLE) + return +} + +//sys Fstatvfs(fd int, stat *Statvfs_t) (err error) = SYS_FSTATVFS +//sys Fsync(fd int) (err error) +//sys Ftruncate(fd int, length int64) (err error) +//sys Getpagesize() (pgsize int) = SYS_GETPAGESIZE +//sys Mprotect(b []byte, prot int) (err error) = SYS_MPROTECT +//sys Msync(b []byte, flags int) (err error) = SYS_MSYNC +//sys Poll(fds []PollFd, timeout int) (n int, err error) = SYS_POLL +//sys Times(tms *Tms) (ticks uintptr, err error) = SYS_TIMES +//sys W_Getmntent(buff *byte, size int) (lastsys int, err error) = SYS_W_GETMNTENT +//sys W_Getmntent_A(buff *byte, size int) (lastsys int, err error) = SYS___W_GETMNTENT_A + +//sys mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) = SYS___MOUNT_A +//sys unmount(filesystem string, mtm int) (err error) = SYS___UMOUNT_A +//sys Chroot(path string) (err error) = SYS___CHROOT_A +//sys Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) = SYS_SELECT +//sysnb Uname(buf *Utsname) (err error) = SYS___UNAME_A + +func Ptsname(fd int) (name string, err error) { + r0, _, e1 := syscall_syscall(SYS___PTSNAME_A, uintptr(fd), 0, 0) + name = u2s(unsafe.Pointer(r0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func u2s(cstr unsafe.Pointer) string { + str := (*[1024]uint8)(cstr) + i := 0 + for str[i] != 0 { + i++ + } + return string(str[:i]) +} + +func Close(fd int) (err error) { + _, _, e1 := syscall_syscall(SYS_CLOSE, uintptr(fd), 0, 0) + for i := 0; e1 == EAGAIN && i < 10; i++ { + _, _, _ = syscall_syscall(SYS_USLEEP, uintptr(10), 0, 0) + _, _, e1 = syscall_syscall(SYS_CLOSE, uintptr(fd), 0, 0) + } + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var mapper = &mmapper{ + active: make(map[*byte][]byte), + mmap: mmap, + munmap: munmap, +} + +// Dummy function: there are no semantics for Madvise on z/OS +func Madvise(b []byte, advice int) (err error) { + return +} + +func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + return mapper.Mmap(fd, offset, length, prot, flags) +} + +func Munmap(b []byte) (err error) { + return mapper.Munmap(b) +} + +//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A +//sysnb Getegid() (egid int) +//sysnb Geteuid() (uid int) +//sysnb Getgid() (gid int) +//sysnb Getpid() (pid int) +//sysnb Getpgid(pid int) (pgid int, err error) = SYS_GETPGID + +func Getpgrp() (pid int) { + pid, _ = Getpgid(0) + return +} + +//sysnb Getppid() (pid int) +//sys Getpriority(which int, who int) (prio int, err error) +//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_GETRLIMIT + +//sysnb getrusage(who int, rusage *rusage_zos) (err error) = SYS_GETRUSAGE + +func Getrusage(who int, rusage *Rusage) (err error) { + var ruz rusage_zos + err = getrusage(who, &ruz) + //Only the first two fields of Rusage are set + rusage.Utime.Sec = ruz.Utime.Sec + rusage.Utime.Usec = int64(ruz.Utime.Usec) + rusage.Stime.Sec = ruz.Stime.Sec + rusage.Stime.Usec = int64(ruz.Stime.Usec) + return +} + +//sysnb Getsid(pid int) (sid int, err error) = SYS_GETSID +//sysnb Getuid() (uid int) +//sysnb Kill(pid int, sig Signal) (err error) +//sys Lchown(path string, uid int, gid int) (err error) = SYS___LCHOWN_A +//sys Link(path string, link string) (err error) = SYS___LINK_A +//sys Listen(s int, n int) (err error) +//sys lstat(path string, stat *Stat_LE_t) (err error) = SYS___LSTAT_A + +func Lstat(path string, stat *Stat_t) (err error) { + var statLE Stat_LE_t + err = lstat(path, &statLE) + copyStat(stat, &statLE) + return +} + +//sys Mkdir(path string, mode uint32) (err error) = SYS___MKDIR_A +//sys Mkfifo(path string, mode uint32) (err error) = SYS___MKFIFO_A +//sys Mknod(path string, mode uint32, dev int) (err error) = SYS___MKNOD_A +//sys Pread(fd int, p []byte, offset int64) (n int, err error) +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) +//sys Readlink(path string, buf []byte) (n int, err error) = SYS___READLINK_A +//sys Rename(from string, to string) (err error) = SYS___RENAME_A +//sys Rmdir(path string) (err error) = SYS___RMDIR_A +//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK +//sys Setpriority(which int, who int, prio int) (err error) +//sysnb Setpgid(pid int, pgid int) (err error) = SYS_SETPGID +//sysnb Setrlimit(resource int, lim *Rlimit) (err error) +//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID +//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID +//sysnb Setsid() (pid int, err error) = SYS_SETSID +//sys Setuid(uid int) (err error) = SYS_SETUID +//sys Setgid(uid int) (err error) = SYS_SETGID +//sys Shutdown(fd int, how int) (err error) +//sys stat(path string, statLE *Stat_LE_t) (err error) = SYS___STAT_A + +func Stat(path string, sta *Stat_t) (err error) { + var statLE Stat_LE_t + err = stat(path, &statLE) + copyStat(sta, &statLE) + return +} + +//sys Symlink(path string, link string) (err error) = SYS___SYMLINK_A +//sys Sync() = SYS_SYNC +//sys Truncate(path string, length int64) (err error) = SYS___TRUNCATE_A +//sys Tcgetattr(fildes int, termptr *Termios) (err error) = SYS_TCGETATTR +//sys Tcsetattr(fildes int, when int, termptr *Termios) (err error) = SYS_TCSETATTR +//sys Umask(mask int) (oldmask int) +//sys Unlink(path string) (err error) = SYS___UNLINK_A +//sys Utime(path string, utim *Utimbuf) (err error) = SYS___UTIME_A + +//sys open(path string, mode int, perm uint32) (fd int, err error) = SYS___OPEN_A + +func Open(path string, mode int, perm uint32) (fd int, err error) { + return open(path, mode, perm) +} + +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + wd, err := Getwd() + if err != nil { + return err + } + + if err := Fchdir(dirfd); err != nil { + return err + } + defer Chdir(wd) + + return Mkfifo(path, mode) +} + +//sys remove(path string) (err error) + +func Remove(path string) error { + return remove(path) +} + +const ImplementsGetwd = true + +func Getcwd(buf []byte) (n int, err error) { + var p unsafe.Pointer + if len(buf) > 0 { + p = unsafe.Pointer(&buf[0]) + } else { + p = unsafe.Pointer(&_zero) + } + _, _, e := syscall_syscall(SYS___GETCWD_A, uintptr(p), uintptr(len(buf)), 0) + n = clen(buf) + 1 + if e != 0 { + err = errnoErr(e) + } + return +} + +func Getwd() (wd string, err error) { + var buf [PathMax]byte + n, err := Getcwd(buf[0:]) + if err != nil { + return "", err + } + // Getcwd returns the number of bytes written to buf, including the NUL. + if n < 1 || n > len(buf) || buf[n-1] != 0 { + return "", EINVAL + } + return string(buf[0 : n-1]), nil +} + +func Getgroups() (gids []int, err error) { + n, err := getgroups(0, nil) + if err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + + // Sanity check group count. Max is 1<<16 on Linux. + if n < 0 || n > 1<<20 { + return nil, EINVAL + } + + a := make([]_Gid_t, n) + n, err = getgroups(n, &a[0]) + if err != nil { + return nil, err + } + gids = make([]int, n) + for i, v := range a[0:n] { + gids[i] = int(v) + } + return +} + +func Setgroups(gids []int) (err error) { + if len(gids) == 0 { + return setgroups(0, nil) + } + + a := make([]_Gid_t, len(gids)) + for i, v := range gids { + a[i] = _Gid_t(v) + } + return setgroups(len(a), &a[0]) +} + +func gettid() uint64 + +func Gettid() (tid int) { + return int(gettid()) +} + +type WaitStatus uint32 + +// Wait status is 7 bits at bottom, either 0 (exited), +// 0x7F (stopped), or a signal number that caused an exit. +// The 0x80 bit is whether there was a core dump. +// An extra number (exit code, signal causing a stop) +// is in the high bits. At least that's the idea. +// There are various irregularities. For example, the +// "continued" status is 0xFFFF, distinguishing itself +// from stopped via the core dump bit. + +const ( + mask = 0x7F + core = 0x80 + exited = 0x00 + stopped = 0x7F + shift = 8 +) + +func (w WaitStatus) Exited() bool { return w&mask == exited } + +func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != exited } + +func (w WaitStatus) Stopped() bool { return w&0xFF == stopped } + +func (w WaitStatus) Continued() bool { return w == 0xFFFF } + +func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 } + +func (w WaitStatus) ExitStatus() int { + if !w.Exited() { + return -1 + } + return int(w>>shift) & 0xFF +} + +func (w WaitStatus) Signal() Signal { + if !w.Signaled() { + return -1 + } + return Signal(w & mask) +} + +func (w WaitStatus) StopSignal() Signal { + if !w.Stopped() { + return -1 + } + return Signal(w>>shift) & 0xFF +} + +func (w WaitStatus) TrapCause() int { return -1 } + +//sys waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) + +func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { + // TODO(mundaym): z/OS doesn't have wait4. I don't think getrusage does what we want. + // At the moment rusage will not be touched. + var status _C_int + wpid, err = waitpid(pid, &status, options) + if wstatus != nil { + *wstatus = WaitStatus(status) + } + return +} + +//sysnb gettimeofday(tv *timeval_zos) (err error) + +func Gettimeofday(tv *Timeval) (err error) { + var tvz timeval_zos + err = gettimeofday(&tvz) + tv.Sec = tvz.Sec + tv.Usec = int64(tvz.Usec) + return +} + +func Time(t *Time_t) (tt Time_t, err error) { + var tv Timeval + err = Gettimeofday(&tv) + if err != nil { + return 0, err + } + if t != nil { + *t = Time_t(tv.Sec) + } + return Time_t(tv.Sec), nil +} + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { //fix + return Timeval{Sec: sec, Usec: usec} +} + +//sysnb pipe(p *[2]_C_int) (err error) + +func Pipe(p []int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err = pipe(&pp) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return +} + +//sys utimes(path string, timeval *[2]Timeval) (err error) = SYS___UTIMES_A + +func Utimes(path string, tv []Timeval) (err error) { + if len(tv) != 2 { + return EINVAL + } + return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) +} + +func UtimesNano(path string, ts []Timespec) error { + if len(ts) != 2 { + return EINVAL + } + // Not as efficient as it could be because Timespec and + // Timeval have different types in the different OSes + tv := [2]Timeval{ + NsecToTimeval(TimespecToNsec(ts[0])), + NsecToTimeval(TimespecToNsec(ts[1])), + } + return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) +} + +func Getsockname(fd int) (sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + if err = getsockname(fd, &rsa, &len); err != nil { + return + } + // TODO(neeilan) : Remove this 0 ( added to get sys/unix compiling on z/OS ) + return anyToSockaddr(0, &rsa) +} + +const ( + // identifier constants + nwmHeaderIdentifier = 0xd5e6d4c8 + nwmFilterIdentifier = 0xd5e6d4c6 + nwmTCPConnIdentifier = 0xd5e6d4c3 + nwmRecHeaderIdentifier = 0xd5e6d4d9 + nwmIPStatsIdentifier = 0xd5e6d4c9d7e2e340 + nwmIPGStatsIdentifier = 0xd5e6d4c9d7c7e2e3 + nwmTCPStatsIdentifier = 0xd5e6d4e3c3d7e2e3 + nwmUDPStatsIdentifier = 0xd5e6d4e4c4d7e2e3 + nwmICMPGStatsEntry = 0xd5e6d4c9c3d4d7c7 + nwmICMPTStatsEntry = 0xd5e6d4c9c3d4d7e3 + + // nwmHeader constants + nwmVersion1 = 1 + nwmVersion2 = 2 + nwmCurrentVer = 2 + + nwmTCPConnType = 1 + nwmGlobalStatsType = 14 + + // nwmFilter constants + nwmFilterLclAddrMask = 0x20000000 // Local address + nwmFilterSrcAddrMask = 0x20000000 // Source address + nwmFilterLclPortMask = 0x10000000 // Local port + nwmFilterSrcPortMask = 0x10000000 // Source port + + // nwmConnEntry constants + nwmTCPStateClosed = 1 + nwmTCPStateListen = 2 + nwmTCPStateSynSent = 3 + nwmTCPStateSynRcvd = 4 + nwmTCPStateEstab = 5 + nwmTCPStateFinWait1 = 6 + nwmTCPStateFinWait2 = 7 + nwmTCPStateClosWait = 8 + nwmTCPStateLastAck = 9 + nwmTCPStateClosing = 10 + nwmTCPStateTimeWait = 11 + nwmTCPStateDeletTCB = 12 + + // Existing constants on linux + BPF_TCP_CLOSE = 1 + BPF_TCP_LISTEN = 2 + BPF_TCP_SYN_SENT = 3 + BPF_TCP_SYN_RECV = 4 + BPF_TCP_ESTABLISHED = 5 + BPF_TCP_FIN_WAIT1 = 6 + BPF_TCP_FIN_WAIT2 = 7 + BPF_TCP_CLOSE_WAIT = 8 + BPF_TCP_LAST_ACK = 9 + BPF_TCP_CLOSING = 10 + BPF_TCP_TIME_WAIT = 11 + BPF_TCP_NEW_SYN_RECV = -1 + BPF_TCP_MAX_STATES = -2 +) + +type nwmTriplet struct { + offset uint32 + length uint32 + number uint32 +} + +type nwmQuadruplet struct { + offset uint32 + length uint32 + number uint32 + match uint32 +} + +type nwmHeader struct { + ident uint32 + length uint32 + version uint16 + nwmType uint16 + bytesNeeded uint32 + options uint32 + _ [16]byte + inputDesc nwmTriplet + outputDesc nwmQuadruplet +} + +type nwmFilter struct { + ident uint32 + flags uint32 + resourceName [8]byte + resourceId uint32 + listenerId uint32 + local [28]byte // union of sockaddr4 and sockaddr6 + remote [28]byte // union of sockaddr4 and sockaddr6 + _ uint16 + _ uint16 + asid uint16 + _ [2]byte + tnLuName [8]byte + tnMonGrp uint32 + tnAppl [8]byte + applData [40]byte + nInterface [16]byte + dVipa [16]byte + dVipaPfx uint16 + dVipaPort uint16 + dVipaFamily byte + _ [3]byte + destXCF [16]byte + destXCFPfx uint16 + destXCFFamily byte + _ [1]byte + targIP [16]byte + targIPPfx uint16 + targIPFamily byte + _ [1]byte + _ [20]byte +} + +type nwmRecHeader struct { + ident uint32 + length uint32 + number byte + _ [3]byte +} + +type nwmTCPStatsEntry struct { + ident uint64 + currEstab uint32 + activeOpened uint32 + passiveOpened uint32 + connClosed uint32 + estabResets uint32 + attemptFails uint32 + passiveDrops uint32 + timeWaitReused uint32 + inSegs uint64 + predictAck uint32 + predictData uint32 + inDupAck uint32 + inBadSum uint32 + inBadLen uint32 + inShort uint32 + inDiscOldTime uint32 + inAllBeforeWin uint32 + inSomeBeforeWin uint32 + inAllAfterWin uint32 + inSomeAfterWin uint32 + inOutOfOrder uint32 + inAfterClose uint32 + inWinProbes uint32 + inWinUpdates uint32 + outWinUpdates uint32 + outSegs uint64 + outDelayAcks uint32 + outRsts uint32 + retransSegs uint32 + retransTimeouts uint32 + retransDrops uint32 + pmtuRetrans uint32 + pmtuErrors uint32 + outWinProbes uint32 + probeDrops uint32 + keepAliveProbes uint32 + keepAliveDrops uint32 + finwait2Drops uint32 + acceptCount uint64 + inBulkQSegs uint64 + inDiscards uint64 + connFloods uint32 + connStalls uint32 + cfgEphemDef uint16 + ephemInUse uint16 + ephemHiWater uint16 + flags byte + _ [1]byte + ephemExhaust uint32 + smcRCurrEstabLnks uint32 + smcRLnkActTimeOut uint32 + smcRActLnkOpened uint32 + smcRPasLnkOpened uint32 + smcRLnksClosed uint32 + smcRCurrEstab uint32 + smcRActiveOpened uint32 + smcRPassiveOpened uint32 + smcRConnClosed uint32 + smcRInSegs uint64 + smcROutSegs uint64 + smcRInRsts uint32 + smcROutRsts uint32 + smcDCurrEstabLnks uint32 + smcDActLnkOpened uint32 + smcDPasLnkOpened uint32 + smcDLnksClosed uint32 + smcDCurrEstab uint32 + smcDActiveOpened uint32 + smcDPassiveOpened uint32 + smcDConnClosed uint32 + smcDInSegs uint64 + smcDOutSegs uint64 + smcDInRsts uint32 + smcDOutRsts uint32 +} + +type nwmConnEntry struct { + ident uint32 + local [28]byte // union of sockaddr4 and sockaddr6 + remote [28]byte // union of sockaddr4 and sockaddr6 + startTime [8]byte // uint64, changed to prevent padding from being inserted + lastActivity [8]byte // uint64 + bytesIn [8]byte // uint64 + bytesOut [8]byte // uint64 + inSegs [8]byte // uint64 + outSegs [8]byte // uint64 + state uint16 + activeOpen byte + flag01 byte + outBuffered uint32 + inBuffered uint32 + maxSndWnd uint32 + reXmtCount uint32 + congestionWnd uint32 + ssThresh uint32 + roundTripTime uint32 + roundTripVar uint32 + sendMSS uint32 + sndWnd uint32 + rcvBufSize uint32 + sndBufSize uint32 + outOfOrderCount uint32 + lcl0WindowCount uint32 + rmt0WindowCount uint32 + dupacks uint32 + flag02 byte + sockOpt6Cont byte + asid uint16 + resourceName [8]byte + resourceId uint32 + subtask uint32 + sockOpt byte + sockOpt6 byte + clusterConnFlag byte + proto byte + targetAppl [8]byte + luName [8]byte + clientUserId [8]byte + logMode [8]byte + timeStamp uint32 + timeStampAge uint32 + serverResourceId uint32 + intfName [16]byte + ttlsStatPol byte + ttlsStatConn byte + ttlsSSLProt uint16 + ttlsNegCiph [2]byte + ttlsSecType byte + ttlsFIPS140Mode byte + ttlsUserID [8]byte + applData [40]byte + inOldestTime [8]byte // uint64 + outOldestTime [8]byte // uint64 + tcpTrustedPartner byte + _ [3]byte + bulkDataIntfName [16]byte + ttlsNegCiph4 [4]byte + smcReason uint32 + lclSMCLinkId uint32 + rmtSMCLinkId uint32 + smcStatus byte + smcFlags byte + _ [2]byte + rcvWnd uint32 + lclSMCBufSz uint32 + rmtSMCBufSz uint32 + ttlsSessID [32]byte + ttlsSessIDLen int16 + _ [1]byte + smcDStatus byte + smcDReason uint32 +} + +var svcNameTable [][]byte = [][]byte{ + []byte("\xc5\xe9\xc2\xd5\xd4\xc9\xc6\xf4"), // svc_EZBNMIF4 +} + +const ( + svc_EZBNMIF4 = 0 +) + +func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) { + jobname := []byte("\x5c\x40\x40\x40\x40\x40\x40\x40") // "*" + responseBuffer := [4096]byte{0} + var bufferAlet, reasonCode uint32 = 0, 0 + var bufferLen, returnValue, returnCode int32 = 4096, 0, 0 + + dsa := [18]uint64{0} + var argv [7]unsafe.Pointer + argv[0] = unsafe.Pointer(&jobname[0]) + argv[1] = unsafe.Pointer(&responseBuffer[0]) + argv[2] = unsafe.Pointer(&bufferAlet) + argv[3] = unsafe.Pointer(&bufferLen) + argv[4] = unsafe.Pointer(&returnValue) + argv[5] = unsafe.Pointer(&returnCode) + argv[6] = unsafe.Pointer(&reasonCode) + + request := (*struct { + header nwmHeader + filter nwmFilter + })(unsafe.Pointer(&responseBuffer[0])) + + EZBNMIF4 := svcLoad(&svcNameTable[svc_EZBNMIF4][0]) + if EZBNMIF4 == nil { + return nil, errnoErr(EINVAL) + } + + // GetGlobalStats EZBNMIF4 call + request.header.ident = nwmHeaderIdentifier + request.header.length = uint32(unsafe.Sizeof(request.header)) + request.header.version = nwmCurrentVer + request.header.nwmType = nwmGlobalStatsType + request.header.options = 0x80000000 + + svcCall(EZBNMIF4, &argv[0], &dsa[0]) + + // outputDesc field is filled by EZBNMIF4 on success + if returnCode != 0 || request.header.outputDesc.offset == 0 { + return nil, errnoErr(EINVAL) + } + + // Check that EZBNMIF4 returned a nwmRecHeader + recHeader := (*nwmRecHeader)(unsafe.Pointer(&responseBuffer[request.header.outputDesc.offset])) + if recHeader.ident != nwmRecHeaderIdentifier { + return nil, errnoErr(EINVAL) + } + + // Parse nwmTriplets to get offsets of returned entries + var sections []*uint64 + var sectionDesc *nwmTriplet = (*nwmTriplet)(unsafe.Pointer(&responseBuffer[0])) + for i := uint32(0); i < uint32(recHeader.number); i++ { + offset := request.header.outputDesc.offset + uint32(unsafe.Sizeof(*recHeader)) + i*uint32(unsafe.Sizeof(*sectionDesc)) + sectionDesc = (*nwmTriplet)(unsafe.Pointer(&responseBuffer[offset])) + for j := uint32(0); j < sectionDesc.number; j++ { + offset = request.header.outputDesc.offset + sectionDesc.offset + j*sectionDesc.length + sections = append(sections, (*uint64)(unsafe.Pointer(&responseBuffer[offset]))) + } + } + + // Find nwmTCPStatsEntry in returned entries + var tcpStats *nwmTCPStatsEntry = nil + for _, ptr := range sections { + switch *ptr { + case nwmTCPStatsIdentifier: + if tcpStats != nil { + return nil, errnoErr(EINVAL) + } + tcpStats = (*nwmTCPStatsEntry)(unsafe.Pointer(ptr)) + case nwmIPStatsIdentifier: + case nwmIPGStatsIdentifier: + case nwmUDPStatsIdentifier: + case nwmICMPGStatsEntry: + case nwmICMPTStatsEntry: + default: + return nil, errnoErr(EINVAL) + } + } + if tcpStats == nil { + return nil, errnoErr(EINVAL) + } + + // GetConnectionDetail EZBNMIF4 call + responseBuffer = [4096]byte{0} + dsa = [18]uint64{0} + bufferAlet, reasonCode = 0, 0 + bufferLen, returnValue, returnCode = 4096, 0, 0 + nameptr := (*uint32)(unsafe.Pointer(uintptr(0x21c))) // Get jobname of current process + nameptr = (*uint32)(unsafe.Pointer(uintptr(*nameptr + 12))) + argv[0] = unsafe.Pointer(uintptr(*nameptr)) + + request.header.ident = nwmHeaderIdentifier + request.header.length = uint32(unsafe.Sizeof(request.header)) + request.header.version = nwmCurrentVer + request.header.nwmType = nwmTCPConnType + request.header.options = 0x80000000 + + request.filter.ident = nwmFilterIdentifier + + var localSockaddr RawSockaddrAny + socklen := _Socklen(SizeofSockaddrAny) + err := getsockname(fd, &localSockaddr, &socklen) + if err != nil { + return nil, errnoErr(EINVAL) + } + if localSockaddr.Addr.Family == AF_INET { + localSockaddr := (*RawSockaddrInet4)(unsafe.Pointer(&localSockaddr.Addr)) + localSockFilter := (*RawSockaddrInet4)(unsafe.Pointer(&request.filter.local[0])) + localSockFilter.Family = AF_INET + var i int + for i = 0; i < 4; i++ { + if localSockaddr.Addr[i] != 0 { + break + } + } + if i != 4 { + request.filter.flags |= nwmFilterLclAddrMask + for i = 0; i < 4; i++ { + localSockFilter.Addr[i] = localSockaddr.Addr[i] + } + } + if localSockaddr.Port != 0 { + request.filter.flags |= nwmFilterLclPortMask + localSockFilter.Port = localSockaddr.Port + } + } else if localSockaddr.Addr.Family == AF_INET6 { + localSockaddr := (*RawSockaddrInet6)(unsafe.Pointer(&localSockaddr.Addr)) + localSockFilter := (*RawSockaddrInet6)(unsafe.Pointer(&request.filter.local[0])) + localSockFilter.Family = AF_INET6 + var i int + for i = 0; i < 16; i++ { + if localSockaddr.Addr[i] != 0 { + break + } + } + if i != 16 { + request.filter.flags |= nwmFilterLclAddrMask + for i = 0; i < 16; i++ { + localSockFilter.Addr[i] = localSockaddr.Addr[i] + } + } + if localSockaddr.Port != 0 { + request.filter.flags |= nwmFilterLclPortMask + localSockFilter.Port = localSockaddr.Port + } + } + + svcCall(EZBNMIF4, &argv[0], &dsa[0]) + + // outputDesc field is filled by EZBNMIF4 on success + if returnCode != 0 || request.header.outputDesc.offset == 0 { + return nil, errnoErr(EINVAL) + } + + // Check that EZBNMIF4 returned a nwmConnEntry + conn := (*nwmConnEntry)(unsafe.Pointer(&responseBuffer[request.header.outputDesc.offset])) + if conn.ident != nwmTCPConnIdentifier { + return nil, errnoErr(EINVAL) + } + + // Copy data from the returned data structures into tcpInfo + // Stats from nwmConnEntry are specific to that connection. + // Stats from nwmTCPStatsEntry are global (to the interface?) + // Fields may not be an exact match. Some fields have no equivalent. + var tcpinfo TCPInfo + tcpinfo.State = uint8(conn.state) + tcpinfo.Ca_state = 0 // dummy + tcpinfo.Retransmits = uint8(tcpStats.retransSegs) + tcpinfo.Probes = uint8(tcpStats.outWinProbes) + tcpinfo.Backoff = 0 // dummy + tcpinfo.Options = 0 // dummy + tcpinfo.Rto = tcpStats.retransTimeouts + tcpinfo.Ato = tcpStats.outDelayAcks + tcpinfo.Snd_mss = conn.sendMSS + tcpinfo.Rcv_mss = conn.sendMSS // dummy + tcpinfo.Unacked = 0 // dummy + tcpinfo.Sacked = 0 // dummy + tcpinfo.Lost = 0 // dummy + tcpinfo.Retrans = conn.reXmtCount + tcpinfo.Fackets = 0 // dummy + tcpinfo.Last_data_sent = uint32(*(*uint64)(unsafe.Pointer(&conn.lastActivity[0]))) + tcpinfo.Last_ack_sent = uint32(*(*uint64)(unsafe.Pointer(&conn.outOldestTime[0]))) + tcpinfo.Last_data_recv = uint32(*(*uint64)(unsafe.Pointer(&conn.inOldestTime[0]))) + tcpinfo.Last_ack_recv = uint32(*(*uint64)(unsafe.Pointer(&conn.inOldestTime[0]))) + tcpinfo.Pmtu = conn.sendMSS // dummy, NWMIfRouteMtu is a candidate + tcpinfo.Rcv_ssthresh = conn.ssThresh + tcpinfo.Rtt = conn.roundTripTime + tcpinfo.Rttvar = conn.roundTripVar + tcpinfo.Snd_ssthresh = conn.ssThresh // dummy + tcpinfo.Snd_cwnd = conn.congestionWnd + tcpinfo.Advmss = conn.sendMSS // dummy + tcpinfo.Reordering = 0 // dummy + tcpinfo.Rcv_rtt = conn.roundTripTime // dummy + tcpinfo.Rcv_space = conn.sendMSS // dummy + tcpinfo.Total_retrans = conn.reXmtCount + + svcUnload(&svcNameTable[svc_EZBNMIF4][0], EZBNMIF4) + + return &tcpinfo, nil +} + +// GetsockoptString returns the string value of the socket option opt for the +// socket associated with fd at the given socket level. +func GetsockoptString(fd, level, opt int) (string, error) { + buf := make([]byte, 256) + vallen := _Socklen(len(buf)) + err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen) + if err != nil { + return "", err + } + + return string(buf[:vallen-1]), nil +} + +func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { + var msg Msghdr + var rsa RawSockaddrAny + msg.Name = (*byte)(unsafe.Pointer(&rsa)) + msg.Namelen = SizeofSockaddrAny + var iov Iovec + if len(p) > 0 { + iov.Base = (*byte)(unsafe.Pointer(&p[0])) + iov.SetLen(len(p)) + } + var dummy byte + if len(oob) > 0 { + // receive at least one normal byte + if len(p) == 0 { + iov.Base = &dummy + iov.SetLen(1) + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + msg.Iov = &iov + msg.Iovlen = 1 + if n, err = recvmsg(fd, &msg, flags); err != nil { + return + } + oobn = int(msg.Controllen) + recvflags = int(msg.Flags) + // source address is only specified if the socket is unconnected + if rsa.Addr.Family != AF_UNSPEC { + // TODO(neeilan): Remove 0 arg added to get this compiling on z/OS + from, err = anyToSockaddr(0, &rsa) + } + return +} + +func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) { + _, err = SendmsgN(fd, p, oob, to, flags) + return +} + +func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) { + var ptr unsafe.Pointer + var salen _Socklen + if to != nil { + var err error + ptr, salen, err = to.sockaddr() + if err != nil { + return 0, err + } + } + var msg Msghdr + msg.Name = (*byte)(unsafe.Pointer(ptr)) + msg.Namelen = int32(salen) + var iov Iovec + if len(p) > 0 { + iov.Base = (*byte)(unsafe.Pointer(&p[0])) + iov.SetLen(len(p)) + } + var dummy byte + if len(oob) > 0 { + // send at least one normal byte + if len(p) == 0 { + iov.Base = &dummy + iov.SetLen(1) + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + msg.Iov = &iov + msg.Iovlen = 1 + if n, err = sendmsg(fd, &msg, flags); err != nil { + return 0, err + } + if len(oob) > 0 && len(p) == 0 { + n = 0 + } + return n, nil +} + +func Opendir(name string) (uintptr, error) { + p, err := BytePtrFromString(name) + if err != nil { + return 0, err + } + dir, _, e := syscall_syscall(SYS___OPENDIR_A, uintptr(unsafe.Pointer(p)), 0, 0) + runtime.KeepAlive(unsafe.Pointer(p)) + if e != 0 { + err = errnoErr(e) + } + return dir, err +} + +// clearsyscall.Errno resets the errno value to 0. +func clearErrno() + +func Readdir(dir uintptr) (*Dirent, error) { + var ent Dirent + var res uintptr + // __readdir_r_a returns errno at the end of the directory stream, rather than 0. + // Therefore to avoid false positives we clear errno before calling it. + + // TODO(neeilan): Commented this out to get sys/unix compiling on z/OS. Uncomment and fix. Error: "undefined: clearsyscall" + //clearsyscall.Errno() // TODO(mundaym): check pre-emption rules. + + e, _, _ := syscall_syscall(SYS___READDIR_R_A, dir, uintptr(unsafe.Pointer(&ent)), uintptr(unsafe.Pointer(&res))) + var err error + if e != 0 { + err = errnoErr(Errno(e)) + } + if res == 0 { + return nil, err + } + return &ent, err +} + +func Closedir(dir uintptr) error { + _, _, e := syscall_syscall(SYS_CLOSEDIR, dir, 0, 0) + if e != 0 { + return errnoErr(e) + } + return nil +} + +func Seekdir(dir uintptr, pos int) { + _, _, _ = syscall_syscall(SYS_SEEKDIR, dir, uintptr(pos), 0) +} + +func Telldir(dir uintptr) (int, error) { + p, _, e := syscall_syscall(SYS_TELLDIR, dir, 0, 0) + pos := int(p) + if pos == -1 { + return pos, errnoErr(e) + } + return pos, nil +} + +// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { + // struct flock is packed on z/OS. We can't emulate that in Go so + // instead we pack it here. + var flock [24]byte + *(*int16)(unsafe.Pointer(&flock[0])) = lk.Type + *(*int16)(unsafe.Pointer(&flock[2])) = lk.Whence + *(*int64)(unsafe.Pointer(&flock[4])) = lk.Start + *(*int64)(unsafe.Pointer(&flock[12])) = lk.Len + *(*int32)(unsafe.Pointer(&flock[20])) = lk.Pid + _, _, errno := syscall_syscall(SYS_FCNTL, fd, uintptr(cmd), uintptr(unsafe.Pointer(&flock))) + lk.Type = *(*int16)(unsafe.Pointer(&flock[0])) + lk.Whence = *(*int16)(unsafe.Pointer(&flock[2])) + lk.Start = *(*int64)(unsafe.Pointer(&flock[4])) + lk.Len = *(*int64)(unsafe.Pointer(&flock[12])) + lk.Pid = *(*int32)(unsafe.Pointer(&flock[20])) + if errno == 0 { + return nil + } + return errno +} + +func Flock(fd int, how int) error { + + var flock_type int16 + var fcntl_cmd int + + switch how { + case LOCK_SH | LOCK_NB: + flock_type = F_RDLCK + fcntl_cmd = F_SETLK + case LOCK_EX | LOCK_NB: + flock_type = F_WRLCK + fcntl_cmd = F_SETLK + case LOCK_EX: + flock_type = F_WRLCK + fcntl_cmd = F_SETLKW + case LOCK_UN: + flock_type = F_UNLCK + fcntl_cmd = F_SETLKW + default: + } + + flock := Flock_t{ + Type: int16(flock_type), + Whence: int16(0), + Start: int64(0), + Len: int64(0), + Pid: int32(Getppid()), + } + + err := FcntlFlock(uintptr(fd), fcntl_cmd, &flock) + return err +} + +func Mlock(b []byte) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Mlock2(b []byte, flags int) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Mlockall(flags int) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Munlock(b []byte) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_SWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Munlockall() (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_SWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func ClockGettime(clockid int32, ts *Timespec) error { + + var ticks_per_sec uint32 = 100 //TODO(kenan): value is currently hardcoded; need sysconf() call otherwise + var nsec_per_sec int64 = 1000000000 + + if ts == nil { + return EFAULT + } + if clockid == CLOCK_REALTIME || clockid == CLOCK_MONOTONIC { + var nanotime int64 = runtime.Nanotime1() + ts.Sec = nanotime / nsec_per_sec + ts.Nsec = nanotime % nsec_per_sec + } else if clockid == CLOCK_PROCESS_CPUTIME_ID || clockid == CLOCK_THREAD_CPUTIME_ID { + var tm Tms + _, err := Times(&tm) + if err != nil { + return EFAULT + } + ts.Sec = int64(tm.Utime / ticks_per_sec) + ts.Nsec = int64(tm.Utime) * nsec_per_sec / int64(ticks_per_sec) + } else { + return EINVAL + } + return nil +} + +func Statfs(path string, stat *Statfs_t) (err error) { + fd, err := open(path, O_RDONLY, 0) + defer Close(fd) + if err != nil { + return err + } + return Fstatfs(fd, stat) +} + +var ( + Stdin = 0 + Stdout = 1 + Stderr = 2 +) + +// Do the interface allocations only once for common +// Errno values. +var ( + errEAGAIN error = syscall.EAGAIN + errEINVAL error = syscall.EINVAL + errENOENT error = syscall.ENOENT +) + +var ( + signalNameMapOnce sync.Once + signalNameMap map[string]syscall.Signal +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e Errno) error { + switch e { + case 0: + return nil + case EAGAIN: + return errEAGAIN + case EINVAL: + return errEINVAL + case ENOENT: + return errENOENT + } + return e +} + +// ErrnoName returns the error name for error number e. +func ErrnoName(e Errno) string { + i := sort.Search(len(errorList), func(i int) bool { + return errorList[i].num >= e + }) + if i < len(errorList) && errorList[i].num == e { + return errorList[i].name + } + return "" +} + +// SignalName returns the signal name for signal number s. +func SignalName(s syscall.Signal) string { + i := sort.Search(len(signalList), func(i int) bool { + return signalList[i].num >= s + }) + if i < len(signalList) && signalList[i].num == s { + return signalList[i].name + } + return "" +} + +// SignalNum returns the syscall.Signal for signal named s, +// or 0 if a signal with such name is not found. +// The signal name should start with "SIG". +func SignalNum(s string) syscall.Signal { + signalNameMapOnce.Do(func() { + signalNameMap = make(map[string]syscall.Signal, len(signalList)) + for _, signal := range signalList { + signalNameMap[signal.name] = signal.num + } + }) + return signalNameMap[s] +} + +// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte. +func clen(n []byte) int { + i := bytes.IndexByte(n, 0) + if i == -1 { + i = len(n) + } + return i +} + +// Mmap manager, for use by operating system-specific implementations. + +type mmapper struct { + sync.Mutex + active map[*byte][]byte // active mappings; key is last byte in mapping + mmap func(addr, length uintptr, prot, flags, fd int, offset int64) (uintptr, error) + munmap func(addr uintptr, length uintptr) error +} + +func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + if length <= 0 { + return nil, EINVAL + } + + // Map the requested memory. + addr, errno := m.mmap(0, uintptr(length), prot, flags, fd, offset) + if errno != nil { + return nil, errno + } + + // Slice memory layout + var sl = struct { + addr uintptr + len int + cap int + }{addr, length, length} + + // Use unsafe to turn sl into a []byte. + b := *(*[]byte)(unsafe.Pointer(&sl)) + + // Register mapping in m and return it. + p := &b[cap(b)-1] + m.Lock() + defer m.Unlock() + m.active[p] = b + return b, nil +} + +func (m *mmapper) Munmap(data []byte) (err error) { + if len(data) == 0 || len(data) != cap(data) { + return EINVAL + } + + // Find the base of the mapping. + p := &data[cap(data)-1] + m.Lock() + defer m.Unlock() + b := m.active[p] + if b == nil || &b[0] != &data[0] { + return EINVAL + } + + // Unmap the memory and update m. + if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b))); errno != nil { + return errno + } + delete(m.active, p) + return nil +} + +func Read(fd int, p []byte) (n int, err error) { + n, err = read(fd, p) + if raceenabled { + if n > 0 { + raceWriteRange(unsafe.Pointer(&p[0]), n) + } + if err == nil { + raceAcquire(unsafe.Pointer(&ioSync)) + } + } + return +} + +func Write(fd int, p []byte) (n int, err error) { + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + n, err = write(fd, p) + if raceenabled && n > 0 { + raceReadRange(unsafe.Pointer(&p[0]), n) + } + return +} + +// For testing: clients can set this flag to force +// creation of IPv6 sockets to return EAFNOSUPPORT. +var SocketDisableIPv6 bool + +// Sockaddr represents a socket address. +type Sockaddr interface { + sockaddr() (ptr unsafe.Pointer, len _Socklen, err error) // lowercase; only we can define Sockaddrs +} + +// SockaddrInet4 implements the Sockaddr interface for AF_INET type sockets. +type SockaddrInet4 struct { + Port int + Addr [4]byte + raw RawSockaddrInet4 +} + +// SockaddrInet6 implements the Sockaddr interface for AF_INET6 type sockets. +type SockaddrInet6 struct { + Port int + ZoneId uint32 + Addr [16]byte + raw RawSockaddrInet6 +} + +// SockaddrUnix implements the Sockaddr interface for AF_UNIX type sockets. +type SockaddrUnix struct { + Name string + raw RawSockaddrUnix +} + +func Bind(fd int, sa Sockaddr) (err error) { + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return bind(fd, ptr, n) +} + +func Connect(fd int, sa Sockaddr) (err error) { + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return connect(fd, ptr, n) +} + +func Getpeername(fd int) (sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + if err = getpeername(fd, &rsa, &len); err != nil { + return + } + return anyToSockaddr(fd, &rsa) +} + +func GetsockoptByte(fd, level, opt int) (value byte, err error) { + var n byte + vallen := _Socklen(1) + err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) + return n, err +} + +func GetsockoptInt(fd, level, opt int) (value int, err error) { + var n int32 + vallen := _Socklen(4) + err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) + return int(n), err +} + +func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) { + vallen := _Socklen(4) + err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen) + return value, err +} + +func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) { + var value IPMreq + vallen := _Socklen(SizeofIPMreq) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) { + var value IPv6Mreq + vallen := _Socklen(SizeofIPv6Mreq) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) { + var value IPv6MTUInfo + vallen := _Socklen(SizeofIPv6MTUInfo) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) { + var value ICMPv6Filter + vallen := _Socklen(SizeofICMPv6Filter) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptLinger(fd, level, opt int) (*Linger, error) { + var linger Linger + vallen := _Socklen(SizeofLinger) + err := getsockopt(fd, level, opt, unsafe.Pointer(&linger), &vallen) + return &linger, err +} + +func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) { + var tv Timeval + vallen := _Socklen(unsafe.Sizeof(tv)) + err := getsockopt(fd, level, opt, unsafe.Pointer(&tv), &vallen) + return &tv, err +} + +func GetsockoptUint64(fd, level, opt int) (value uint64, err error) { + var n uint64 + vallen := _Socklen(8) + err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) + return n, err +} + +func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + if n, err = recvfrom(fd, p, flags, &rsa, &len); err != nil { + return + } + if rsa.Addr.Family != AF_UNSPEC { + from, err = anyToSockaddr(fd, &rsa) + } + return +} + +func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) { + ptr, n, err := to.sockaddr() + if err != nil { + return err + } + return sendto(fd, p, flags, ptr, n) +} + +func SetsockoptByte(fd, level, opt int, value byte) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(&value), 1) +} + +func SetsockoptInt(fd, level, opt int, value int) (err error) { + var n = int32(value) + return setsockopt(fd, level, opt, unsafe.Pointer(&n), 4) +} + +func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(&value[0]), 4) +} + +func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPMreq) +} + +func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPv6Mreq) +} + +func SetsockoptICMPv6Filter(fd, level, opt int, filter *ICMPv6Filter) error { + return setsockopt(fd, level, opt, unsafe.Pointer(filter), SizeofICMPv6Filter) +} + +func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(l), SizeofLinger) +} + +func SetsockoptString(fd, level, opt int, s string) (err error) { + var p unsafe.Pointer + if len(s) > 0 { + p = unsafe.Pointer(&[]byte(s)[0]) + } + return setsockopt(fd, level, opt, p, uintptr(len(s))) +} + +func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv)) +} + +func SetsockoptUint64(fd, level, opt int, value uint64) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8) +} + +func Socket(domain, typ, proto int) (fd int, err error) { + if domain == AF_INET6 && SocketDisableIPv6 { + return -1, EAFNOSUPPORT + } + fd, err = socket(domain, typ, proto) + return +} + +func Socketpair(domain, typ, proto int) (fd [2]int, err error) { + var fdx [2]int32 + err = socketpair(domain, typ, proto, &fdx) + if err == nil { + fd[0] = int(fdx[0]) + fd[1] = int(fdx[1]) + } + return +} + +var ioSync int64 + +func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) } + +func SetNonblock(fd int, nonblocking bool) (err error) { + flag, err := fcntl(fd, F_GETFL, 0) + if err != nil { + return err + } + if nonblocking { + flag |= O_NONBLOCK + } else { + flag &= ^O_NONBLOCK + } + _, err = fcntl(fd, F_SETFL, flag) + return err +} + +// Exec calls execve(2), which replaces the calling executable in the process +// tree. argv0 should be the full path to an executable ("/bin/ls") and the +// executable name should also be the first argument in argv (["ls", "-l"]). +// envv are the environment variables that should be passed to the new +// process (["USER=go", "PWD=/tmp"]). +func Exec(argv0 string, argv []string, envv []string) error { + return syscall.Exec(argv0, argv, envv) +} + +func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { + if needspace := 8 - len(fstype); needspace <= 0 { + fstype = fstype[:8] + } else { + fstype += " "[:needspace] + } + return mount_LE(target, source, fstype, uint32(flags), int32(len(data)), data) +} + +func Unmount(name string, mtm int) (err error) { + // mountpoint is always a full path and starts with a '/' + // check if input string is not a mountpoint but a filesystem name + if name[0] != '/' { + return unmount(name, mtm) + } + // treat name as mountpoint + b2s := func(arr []byte) string { + nulli := bytes.IndexByte(arr, 0) + if nulli == -1 { + return string(arr) + } else { + return string(arr[:nulli]) + } + } + var buffer struct { + header W_Mnth + fsinfo [64]W_Mntent + } + fsCount, err := W_Getmntent_A((*byte)(unsafe.Pointer(&buffer)), int(unsafe.Sizeof(buffer))) + if err != nil { + return err + } + if fsCount == 0 { + return EINVAL + } + for i := 0; i < fsCount; i++ { + if b2s(buffer.fsinfo[i].Mountpoint[:]) == name { + err = unmount(b2s(buffer.fsinfo[i].Fsname[:]), mtm) + break + } + } + return err +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/vendor/golang.org/x/sys/unix/sysvshm_linux.go new file mode 100644 index 00000000..2c3a4437 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_linux.go @@ -0,0 +1,21 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import "runtime" + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + if runtime.GOARCH == "arm" || + runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { + cmd |= ipc_64 + } + + return shmctl(id, cmd, desc) +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go new file mode 100644 index 00000000..0bb4c8de --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -0,0 +1,61 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (darwin && !ios) || linux +// +build darwin,!ios linux + +package unix + +import ( + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" +) + +// SysvShmAttach attaches the Sysv shared memory segment associated with the +// shared memory identifier id. +func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) { + addr, errno := shmat(id, addr, flag) + if errno != nil { + return nil, errno + } + + // Retrieve the size of the shared memory to enable slice creation + var info SysvShmDesc + + _, err := SysvShmCtl(id, IPC_STAT, &info) + if err != nil { + // release the shared memory if we can't find the size + + // ignoring error from shmdt as there's nothing sensible to return here + shmdt(addr) + return nil, err + } + + // Use unsafe to convert addr into a []byte. + // TODO: convert to unsafe.Slice once we can assume Go 1.17 + var b []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) + hdr.Data = unsafe.Pointer(addr) + hdr.Cap = int(info.Segsz) + hdr.Len = int(info.Segsz) + return b, nil +} + +// SysvShmDetach unmaps the shared memory slice returned from SysvShmAttach. +// +// It is not safe to use the slice after calling this function. +func SysvShmDetach(data []byte) error { + if len(data) == 0 { + return EINVAL + } + + return shmdt(uintptr(unsafe.Pointer(&data[0]))) +} + +// SysvShmGet returns the Sysv shared memory identifier associated with key. +// If the IPC_CREAT flag is specified a new segment is created. +func SysvShmGet(key, size, flag int) (id int, err error) { + return shmget(key, size, flag) +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go new file mode 100644 index 00000000..71bddefd --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -0,0 +1,14 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin && !ios +// +build darwin,!ios + +package unix + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + return shmctl(id, cmd, desc) +} diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go index 10360429..3d893040 100644 --- a/vendor/golang.org/x/sys/unix/timestruct.go +++ b/vendor/golang.org/x/sys/unix/timestruct.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index 30c1d71f..25df1e37 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build freebsd || netbsd // +build freebsd netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index 104994bc..ca9799b7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -1,6 +1,7 @@ // mkerrors.sh -maix32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc && aix // +build ppc,aix // Created by cgo -godefs - DO NOT EDIT diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index 4fc8d306..200c8c26 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -1,6 +1,7 @@ // mkerrors.sh -maix64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && aix // +build ppc64,aix // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go deleted file mode 100644 index ec376f51..00000000 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go +++ /dev/null @@ -1,1788 +0,0 @@ -// mkerrors.sh -m32 -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build 386,darwin - -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -m32 _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_SYS_CONTROL = 0x2 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4008426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80084267 - BIOCSETFNR = 0x8008427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8008426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CLONE_NOFOLLOW = 0x1 - CLONE_NOOWNERCOPY = 0x2 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTLIOCGINFO = 0xc0644e03 - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc01c697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc0086924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc0286938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc00c6981 - SIOCRSLVMULTI = 0xc008693b - SIOCSDRVSPEC = 0x801c697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40087458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x402c7413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x802c7414 - TIOCSETAF = 0x802c7416 - TIOCSETAW = 0x802c7415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40087459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x20 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADARCH = syscall.Errno(0x56) - EBADEXEC = syscall.Errno(0x55) - EBADF = syscall.Errno(0x9) - EBADMACHO = syscall.Errno(0x58) - EBADMSG = syscall.Errno(0x5e) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x59) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDEVERR = syscall.Errno(0x53) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x5a) - EILSEQ = syscall.Errno(0x5c) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5f) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) - ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x60) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x61) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5b) - ENOPOLICY = syscall.Errno(0x67) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x62) - ENOSTR = syscall.Errno(0x63) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x68) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x66) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x69) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x64) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHLIBVERS = syscall.Errno(0x57) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x65) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "device not configured"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EDEADLK", "resource deadlock avoided"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "resource busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "cross-device link"}, - {19, "ENODEV", "operation not supported by device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "ENOTSUP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "can't assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "socket is already connected"}, - {57, "ENOTCONN", "socket is not connected"}, - {58, "ESHUTDOWN", "can't send after socket shutdown"}, - {59, "ETOOMANYREFS", "too many references: can't splice"}, - {60, "ETIMEDOUT", "operation timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disc quota exceeded"}, - {70, "ESTALE", "stale NFS file handle"}, - {71, "EREMOTE", "too many levels of remote in path"}, - {72, "EBADRPC", "RPC struct is bad"}, - {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC prog. not avail"}, - {75, "EPROGMISMATCH", "program version wrong"}, - {76, "EPROCUNAVAIL", "bad procedure for program"}, - {77, "ENOLCK", "no locks available"}, - {78, "ENOSYS", "function not implemented"}, - {79, "EFTYPE", "inappropriate file type or format"}, - {80, "EAUTH", "authentication error"}, - {81, "ENEEDAUTH", "need authenticator"}, - {82, "EPWROFF", "device power is off"}, - {83, "EDEVERR", "device error"}, - {84, "EOVERFLOW", "value too large to be stored in data type"}, - {85, "EBADEXEC", "bad executable (or shared library)"}, - {86, "EBADARCH", "bad CPU type in executable"}, - {87, "ESHLIBVERS", "shared library version mismatch"}, - {88, "EBADMACHO", "malformed Mach-o file"}, - {89, "ECANCELED", "operation canceled"}, - {90, "EIDRM", "identifier removed"}, - {91, "ENOMSG", "no message of desired type"}, - {92, "EILSEQ", "illegal byte sequence"}, - {93, "ENOATTR", "attribute not found"}, - {94, "EBADMSG", "bad message"}, - {95, "EMULTIHOP", "EMULTIHOP (Reserved)"}, - {96, "ENODATA", "no message available on STREAM"}, - {97, "ENOLINK", "ENOLINK (Reserved)"}, - {98, "ENOSR", "no STREAM resources"}, - {99, "ENOSTR", "not a STREAM"}, - {100, "EPROTO", "protocol error"}, - {101, "ETIME", "STREAM ioctl timeout"}, - {102, "EOPNOTSUPP", "operation not supported on socket"}, - {103, "ENOPOLICY", "policy not found"}, - {104, "ENOTRECOVERABLE", "state not recoverable"}, - {105, "EOWNERDEAD", "previous owner died"}, - {106, "EQFULL", "interface output queue is full"}, -} - -// Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "suspended (signal)"}, - {18, "SIGTSTP", "suspended"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "cputime limit exceeded"}, - {25, "SIGXFSZ", "filesize limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window size changes"}, - {29, "SIGINFO", "information request"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index fea5dfaa..a3a45fec 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && darwin // +build amd64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -32,7 +33,7 @@ const ( AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 - AF_MAX = 0x28 + AF_MAX = 0x29 AF_NATM = 0x1f AF_NDRV = 0x1b AF_NETBIOS = 0x21 @@ -49,6 +50,7 @@ const ( AF_UNIX = 0x1 AF_UNSPEC = 0x0 AF_UTUN = 0x26 + AF_VSOCK = 0x28 ALTWERASE = 0x200 ATTR_BIT_MAP_COUNT = 0x5 ATTR_CMN_ACCESSMASK = 0x20000 @@ -83,7 +85,7 @@ const ( ATTR_CMN_PAROBJID = 0x80 ATTR_CMN_RETURNED_ATTRS = 0x80000000 ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 + ATTR_CMN_SETMASK = 0x51c7ff00 ATTR_CMN_USERACCESS = 0x200000 ATTR_CMN_UUID = 0x800000 ATTR_CMN_VALIDMASK = 0xffffffff @@ -357,7 +359,7 @@ const ( DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 + DLT_MATCHING_MAX = 0x10a DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 @@ -398,6 +400,7 @@ const ( DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba + DLT_USB_DARWIN = 0x10a DLT_USB_LINUX = 0xbd DLT_USB_LINUX_MMAPPED = 0xdc DLT_USER0 = 0x93 @@ -442,8 +445,8 @@ const ( EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf + EVFILT_SYSCOUNT = 0x11 + EVFILT_THREADMARKER = 0x11 EVFILT_TIMER = -0x7 EVFILT_USER = -0xa EVFILT_VM = -0xc @@ -481,9 +484,12 @@ const ( FSOPT_NOINMEMUPDATE = 0x2 FSOPT_PACK_INVAL_ATTRS = 0x8 FSOPT_REPORT_FULLSIZE = 0x4 + FSOPT_RETURN_REALDEV = 0x200 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 + F_ADDFILESIGS_INFO = 0x67 F_ADDFILESIGS_RETURN = 0x61 + F_ADDFILESUPPL = 0x68 F_ADDSIGS = 0x3b F_ALLOCATEALL = 0x4 F_ALLOCATECONTIG = 0x2 @@ -505,8 +511,10 @@ const ( F_GETOWN = 0x5 F_GETPATH = 0x32 F_GETPATH_MTMINFO = 0x47 + F_GETPATH_NOFIRMLINK = 0x66 F_GETPROTECTIONCLASS = 0x3f F_GETPROTECTIONLEVEL = 0x4d + F_GETSIGSINFO = 0x69 F_GLOBAL_NOCACHE = 0x37 F_LOG2PHYS = 0x31 F_LOG2PHYS_EXT = 0x41 @@ -531,6 +539,7 @@ const ( F_SETPROTECTIONCLASS = 0x40 F_SETSIZE = 0x2b F_SINGLE_WRITER = 0x4c + F_SPECULATIVE_READ = 0x65 F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b F_TRIM_ACTIVE_FILE = 0x64 @@ -562,6 +571,7 @@ const ( IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 + IFT_6LOWPAN = 0x40 IFT_AAL5 = 0x31 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 @@ -766,16 +776,28 @@ const ( IPV6_2292PKTINFO = 0x13 IPV6_2292PKTOPTIONS = 0x19 IPV6_2292RTHDR = 0x18 + IPV6_3542DSTOPTS = 0x32 + IPV6_3542HOPLIMIT = 0x2f + IPV6_3542HOPOPTS = 0x31 + IPV6_3542NEXTHOP = 0x30 + IPV6_3542PKTINFO = 0x2e + IPV6_3542RTHDR = 0x33 + IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 + IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 + IPV6_AUTOFLOWLABEL = 0x3b IPV6_BINDV6ONLY = 0x1b IPV6_BOUND_IF = 0x7d IPV6_CHECKSUM = 0x1a IPV6_DEFAULT_MULTICAST_HOPS = 0x1 IPV6_DEFAULT_MULTICAST_LOOP = 0x1 IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 + IPV6_FLOW_ECN_MASK = 0x3000 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f @@ -783,6 +805,8 @@ const ( IPV6_FW_GET = 0x22 IPV6_FW_ZERO = 0x21 IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd @@ -794,20 +818,34 @@ const ( IPV6_MAX_SOCK_SRC_FILTER = 0x80 IPV6_MIN_MEMBERSHIPS = 0x1f IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e IPV6_PORTRANGE = 0xe IPV6_PORTRANGE_DEFAULT = 0x0 IPV6_PORTRANGE_HIGH = 0x1 IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x3d + IPV6_RECVRTHDR = 0x26 IPV6_RECVTCLASS = 0x23 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x39 IPV6_RTHDR_LOOSE = 0x0 IPV6_RTHDR_STRICT = 0x1 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_SOCKOPT_RESERVED1 = 0x3 IPV6_TCLASS = 0x24 IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 @@ -818,6 +856,7 @@ const ( IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 + IP_DONTFRAG = 0x1c IP_DROP_MEMBERSHIP = 0xd IP_DROP_SOURCE_MEMBERSHIP = 0x47 IP_DUMMYNET_CONFIGURE = 0x3c @@ -889,6 +928,12 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_PEERCRED = 0x1 + LOCAL_PEEREPID = 0x3 + LOCAL_PEEREUUID = 0x5 + LOCAL_PEERPID = 0x2 + LOCAL_PEERTOKEN = 0x6 + LOCAL_PEERUUID = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -904,6 +949,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_WILLNEED = 0x3 MADV_ZERO_WIRED_PAGES = 0x6 + MAP_32BIT = 0x8000 MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 @@ -920,6 +966,17 @@ const ( MAP_RESILIENT_CODESIGN = 0x2000 MAP_RESILIENT_MEDIA = 0x4000 MAP_SHARED = 0x1 + MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 + MAP_UNIX03 = 0x40000 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ASYNC = 0x40 @@ -931,6 +988,7 @@ const ( MNT_DOVOLFS = 0x8000 MNT_DWAIT = 0x4 MNT_EXPORTED = 0x100 + MNT_EXT_ROOT_DATA_VOL = 0x1 MNT_FORCE = 0x80000 MNT_IGNORE_OWNERSHIP = 0x200000 MNT_JOURNALED = 0x800000 @@ -947,12 +1005,15 @@ const ( MNT_QUOTA = 0x2000 MNT_RDONLY = 0x1 MNT_RELOAD = 0x40000 + MNT_REMOVABLE = 0x200 MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x40000000 + MNT_STRICTATIME = 0x80000000 MNT_SYNCHRONOUS = 0x2 MNT_UNION = 0x20 MNT_UNKNOWNPERMISSIONS = 0x200000 MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff + MNT_VISFLAGMASK = 0xd7f0f7ff MNT_WAIT = 0x1 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 @@ -963,6 +1024,7 @@ const ( MSG_HAVEMORE = 0x2000 MSG_HOLD = 0x800 MSG_NEEDSA = 0x10000 + MSG_NOSIGNAL = 0x80000 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_RCVMORE = 0x4000 @@ -979,9 +1041,10 @@ const ( NET_RT_DUMP = 0x1 NET_RT_DUMP2 = 0x7 NET_RT_FLAGS = 0x2 + NET_RT_FLAGS_PRIV = 0xa NET_RT_IFLIST = 0x3 NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa + NET_RT_MAXID = 0xb NET_RT_STAT = 0x4 NET_RT_TRASH = 0x5 NFDBITS = 0x20 @@ -1019,6 +1082,7 @@ const ( NOTE_LEEWAY = 0x10 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_MACHTIME = 0x100 NOTE_MACH_CONTINUOUS_TIME = 0x80 NOTE_NONE = 0x80 NOTE_NSECONDS = 0x4 @@ -1065,6 +1129,7 @@ const ( O_NDELAY = 0x4 O_NOCTTY = 0x20000 O_NOFOLLOW = 0x100 + O_NOFOLLOW_ANY = 0x20000000 O_NONBLOCK = 0x4 O_POPUP = 0x80000000 O_RDONLY = 0x0 @@ -1136,13 +1201,16 @@ const ( RTF_BROADCAST = 0x400000 RTF_CLONING = 0x100 RTF_CONDEMNED = 0x2000000 + RTF_DEAD = 0x20000000 RTF_DELCLONE = 0x80 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 RTF_GATEWAY = 0x2 + RTF_GLOBAL = 0x40000000 RTF_HOST = 0x4 RTF_IFREF = 0x4000000 RTF_IFSCOPE = 0x1000000 + RTF_LLDATA = 0x400 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 @@ -1195,6 +1263,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIMESTAMP_MONOTONIC = 0x4 + SEEK_CUR = 0x1 + SEEK_DATA = 0x4 + SEEK_END = 0x2 + SEEK_HOLE = 0x3 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1210,6 +1283,7 @@ const ( SIOCGDRVSPEC = 0xc028697b SIOCGETVLAN = 0xc020697f SIOCGHIWAT = 0x40047301 + SIOCGIF6LOWPAN = 0xc02069c5 SIOCGIFADDR = 0xc0206921 SIOCGIFALTMTU = 0xc0206948 SIOCGIFASYNCMAP = 0xc020697c @@ -1220,6 +1294,7 @@ const ( SIOCGIFDEVMTU = 0xc0206944 SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFLAGS = 0xc0206911 + SIOCGIFFUNCTIONALTYPE = 0xc02069ad SIOCGIFGENERIC = 0xc020693a SIOCGIFKPI = 0xc0206987 SIOCGIFMAC = 0xc0206982 @@ -1233,6 +1308,7 @@ const ( SIOCGIFSTATUS = 0xc331693d SIOCGIFVLAN = 0xc020697f SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGIFXMEDIA = 0xc02c6948 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCIFCREATE = 0xc0206978 @@ -1243,6 +1319,7 @@ const ( SIOCSDRVSPEC = 0x8028697b SIOCSETVLAN = 0x8020697e SIOCSHIWAT = 0x80047300 + SIOCSIF6LOWPAN = 0x802069c4 SIOCSIFADDR = 0x8020690c SIOCSIFALTMTU = 0x80206945 SIOCSIFASYNCMAP = 0x8020697d @@ -1270,6 +1347,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go deleted file mode 100644 index 03feefbf..00000000 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go +++ /dev/null @@ -1,1788 +0,0 @@ -// mkerrors.sh -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm,darwin - -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_SYS_CONTROL = 0x2 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CLONE_NOFOLLOW = 0x1 - CLONE_NOOWNERCOPY = 0x2 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTLIOCGINFO = 0xc0644e03 - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADARCH = syscall.Errno(0x56) - EBADEXEC = syscall.Errno(0x55) - EBADF = syscall.Errno(0x9) - EBADMACHO = syscall.Errno(0x58) - EBADMSG = syscall.Errno(0x5e) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x59) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDEVERR = syscall.Errno(0x53) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x5a) - EILSEQ = syscall.Errno(0x5c) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5f) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) - ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x60) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x61) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5b) - ENOPOLICY = syscall.Errno(0x67) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x62) - ENOSTR = syscall.Errno(0x63) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x68) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x66) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x69) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x64) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHLIBVERS = syscall.Errno(0x57) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x65) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "device not configured"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EDEADLK", "resource deadlock avoided"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "resource busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "cross-device link"}, - {19, "ENODEV", "operation not supported by device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "ENOTSUP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "can't assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "socket is already connected"}, - {57, "ENOTCONN", "socket is not connected"}, - {58, "ESHUTDOWN", "can't send after socket shutdown"}, - {59, "ETOOMANYREFS", "too many references: can't splice"}, - {60, "ETIMEDOUT", "operation timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disc quota exceeded"}, - {70, "ESTALE", "stale NFS file handle"}, - {71, "EREMOTE", "too many levels of remote in path"}, - {72, "EBADRPC", "RPC struct is bad"}, - {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC prog. not avail"}, - {75, "EPROGMISMATCH", "program version wrong"}, - {76, "EPROCUNAVAIL", "bad procedure for program"}, - {77, "ENOLCK", "no locks available"}, - {78, "ENOSYS", "function not implemented"}, - {79, "EFTYPE", "inappropriate file type or format"}, - {80, "EAUTH", "authentication error"}, - {81, "ENEEDAUTH", "need authenticator"}, - {82, "EPWROFF", "device power is off"}, - {83, "EDEVERR", "device error"}, - {84, "EOVERFLOW", "value too large to be stored in data type"}, - {85, "EBADEXEC", "bad executable (or shared library)"}, - {86, "EBADARCH", "bad CPU type in executable"}, - {87, "ESHLIBVERS", "shared library version mismatch"}, - {88, "EBADMACHO", "malformed Mach-o file"}, - {89, "ECANCELED", "operation canceled"}, - {90, "EIDRM", "identifier removed"}, - {91, "ENOMSG", "no message of desired type"}, - {92, "EILSEQ", "illegal byte sequence"}, - {93, "ENOATTR", "attribute not found"}, - {94, "EBADMSG", "bad message"}, - {95, "EMULTIHOP", "EMULTIHOP (Reserved)"}, - {96, "ENODATA", "no message available on STREAM"}, - {97, "ENOLINK", "ENOLINK (Reserved)"}, - {98, "ENOSR", "no STREAM resources"}, - {99, "ENOSTR", "not a STREAM"}, - {100, "EPROTO", "protocol error"}, - {101, "ETIME", "STREAM ioctl timeout"}, - {102, "EOPNOTSUPP", "operation not supported on socket"}, - {103, "ENOPOLICY", "policy not found"}, - {104, "ENOTRECOVERABLE", "state not recoverable"}, - {105, "EOWNERDEAD", "previous owner died"}, - {106, "EQFULL", "interface output queue is full"}, -} - -// Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "suspended (signal)"}, - {18, "SIGTSTP", "suspended"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "cputime limit exceeded"}, - {25, "SIGXFSZ", "filesize limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window size changes"}, - {29, "SIGINFO", "information request"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index b40fb1f6..31009d7f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && darwin // +build arm64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -32,7 +33,7 @@ const ( AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 - AF_MAX = 0x28 + AF_MAX = 0x29 AF_NATM = 0x1f AF_NDRV = 0x1b AF_NETBIOS = 0x21 @@ -49,6 +50,7 @@ const ( AF_UNIX = 0x1 AF_UNSPEC = 0x0 AF_UTUN = 0x26 + AF_VSOCK = 0x28 ALTWERASE = 0x200 ATTR_BIT_MAP_COUNT = 0x5 ATTR_CMN_ACCESSMASK = 0x20000 @@ -83,7 +85,7 @@ const ( ATTR_CMN_PAROBJID = 0x80 ATTR_CMN_RETURNED_ATTRS = 0x80000000 ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 + ATTR_CMN_SETMASK = 0x51c7ff00 ATTR_CMN_USERACCESS = 0x200000 ATTR_CMN_UUID = 0x800000 ATTR_CMN_VALIDMASK = 0xffffffff @@ -357,7 +359,7 @@ const ( DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 + DLT_MATCHING_MAX = 0x10a DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 @@ -398,6 +400,7 @@ const ( DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba + DLT_USB_DARWIN = 0x10a DLT_USB_LINUX = 0xbd DLT_USB_LINUX_MMAPPED = 0xdc DLT_USER0 = 0x93 @@ -442,8 +445,8 @@ const ( EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf + EVFILT_SYSCOUNT = 0x11 + EVFILT_THREADMARKER = 0x11 EVFILT_TIMER = -0x7 EVFILT_USER = -0xa EVFILT_VM = -0xc @@ -481,9 +484,12 @@ const ( FSOPT_NOINMEMUPDATE = 0x2 FSOPT_PACK_INVAL_ATTRS = 0x8 FSOPT_REPORT_FULLSIZE = 0x4 + FSOPT_RETURN_REALDEV = 0x200 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 + F_ADDFILESIGS_INFO = 0x67 F_ADDFILESIGS_RETURN = 0x61 + F_ADDFILESUPPL = 0x68 F_ADDSIGS = 0x3b F_ALLOCATEALL = 0x4 F_ALLOCATECONTIG = 0x2 @@ -505,8 +511,10 @@ const ( F_GETOWN = 0x5 F_GETPATH = 0x32 F_GETPATH_MTMINFO = 0x47 + F_GETPATH_NOFIRMLINK = 0x66 F_GETPROTECTIONCLASS = 0x3f F_GETPROTECTIONLEVEL = 0x4d + F_GETSIGSINFO = 0x69 F_GLOBAL_NOCACHE = 0x37 F_LOG2PHYS = 0x31 F_LOG2PHYS_EXT = 0x41 @@ -531,6 +539,7 @@ const ( F_SETPROTECTIONCLASS = 0x40 F_SETSIZE = 0x2b F_SINGLE_WRITER = 0x4c + F_SPECULATIVE_READ = 0x65 F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b F_TRIM_ACTIVE_FILE = 0x64 @@ -562,6 +571,7 @@ const ( IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 + IFT_6LOWPAN = 0x40 IFT_AAL5 = 0x31 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 @@ -766,16 +776,28 @@ const ( IPV6_2292PKTINFO = 0x13 IPV6_2292PKTOPTIONS = 0x19 IPV6_2292RTHDR = 0x18 + IPV6_3542DSTOPTS = 0x32 + IPV6_3542HOPLIMIT = 0x2f + IPV6_3542HOPOPTS = 0x31 + IPV6_3542NEXTHOP = 0x30 + IPV6_3542PKTINFO = 0x2e + IPV6_3542RTHDR = 0x33 + IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 + IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 + IPV6_AUTOFLOWLABEL = 0x3b IPV6_BINDV6ONLY = 0x1b IPV6_BOUND_IF = 0x7d IPV6_CHECKSUM = 0x1a IPV6_DEFAULT_MULTICAST_HOPS = 0x1 IPV6_DEFAULT_MULTICAST_LOOP = 0x1 IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 + IPV6_FLOW_ECN_MASK = 0x3000 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f @@ -783,6 +805,8 @@ const ( IPV6_FW_GET = 0x22 IPV6_FW_ZERO = 0x21 IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd @@ -794,20 +818,34 @@ const ( IPV6_MAX_SOCK_SRC_FILTER = 0x80 IPV6_MIN_MEMBERSHIPS = 0x1f IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e IPV6_PORTRANGE = 0xe IPV6_PORTRANGE_DEFAULT = 0x0 IPV6_PORTRANGE_HIGH = 0x1 IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x3d + IPV6_RECVRTHDR = 0x26 IPV6_RECVTCLASS = 0x23 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x39 IPV6_RTHDR_LOOSE = 0x0 IPV6_RTHDR_STRICT = 0x1 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_SOCKOPT_RESERVED1 = 0x3 IPV6_TCLASS = 0x24 IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 @@ -818,6 +856,7 @@ const ( IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 + IP_DONTFRAG = 0x1c IP_DROP_MEMBERSHIP = 0xd IP_DROP_SOURCE_MEMBERSHIP = 0x47 IP_DUMMYNET_CONFIGURE = 0x3c @@ -889,6 +928,12 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_PEERCRED = 0x1 + LOCAL_PEEREPID = 0x3 + LOCAL_PEEREUUID = 0x5 + LOCAL_PEERPID = 0x2 + LOCAL_PEERTOKEN = 0x6 + LOCAL_PEERUUID = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -904,6 +949,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_WILLNEED = 0x3 MADV_ZERO_WIRED_PAGES = 0x6 + MAP_32BIT = 0x8000 MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 @@ -920,6 +966,17 @@ const ( MAP_RESILIENT_CODESIGN = 0x2000 MAP_RESILIENT_MEDIA = 0x4000 MAP_SHARED = 0x1 + MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 + MAP_UNIX03 = 0x40000 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ASYNC = 0x40 @@ -931,6 +988,7 @@ const ( MNT_DOVOLFS = 0x8000 MNT_DWAIT = 0x4 MNT_EXPORTED = 0x100 + MNT_EXT_ROOT_DATA_VOL = 0x1 MNT_FORCE = 0x80000 MNT_IGNORE_OWNERSHIP = 0x200000 MNT_JOURNALED = 0x800000 @@ -947,12 +1005,15 @@ const ( MNT_QUOTA = 0x2000 MNT_RDONLY = 0x1 MNT_RELOAD = 0x40000 + MNT_REMOVABLE = 0x200 MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x40000000 + MNT_STRICTATIME = 0x80000000 MNT_SYNCHRONOUS = 0x2 MNT_UNION = 0x20 MNT_UNKNOWNPERMISSIONS = 0x200000 MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff + MNT_VISFLAGMASK = 0xd7f0f7ff MNT_WAIT = 0x1 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 @@ -963,6 +1024,7 @@ const ( MSG_HAVEMORE = 0x2000 MSG_HOLD = 0x800 MSG_NEEDSA = 0x10000 + MSG_NOSIGNAL = 0x80000 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_RCVMORE = 0x4000 @@ -979,9 +1041,10 @@ const ( NET_RT_DUMP = 0x1 NET_RT_DUMP2 = 0x7 NET_RT_FLAGS = 0x2 + NET_RT_FLAGS_PRIV = 0xa NET_RT_IFLIST = 0x3 NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa + NET_RT_MAXID = 0xb NET_RT_STAT = 0x4 NET_RT_TRASH = 0x5 NFDBITS = 0x20 @@ -1019,6 +1082,7 @@ const ( NOTE_LEEWAY = 0x10 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 + NOTE_MACHTIME = 0x100 NOTE_MACH_CONTINUOUS_TIME = 0x80 NOTE_NONE = 0x80 NOTE_NSECONDS = 0x4 @@ -1065,6 +1129,7 @@ const ( O_NDELAY = 0x4 O_NOCTTY = 0x20000 O_NOFOLLOW = 0x100 + O_NOFOLLOW_ANY = 0x20000000 O_NONBLOCK = 0x4 O_POPUP = 0x80000000 O_RDONLY = 0x0 @@ -1136,13 +1201,16 @@ const ( RTF_BROADCAST = 0x400000 RTF_CLONING = 0x100 RTF_CONDEMNED = 0x2000000 + RTF_DEAD = 0x20000000 RTF_DELCLONE = 0x80 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 RTF_GATEWAY = 0x2 + RTF_GLOBAL = 0x40000000 RTF_HOST = 0x4 RTF_IFREF = 0x4000000 RTF_IFSCOPE = 0x1000000 + RTF_LLDATA = 0x400 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 @@ -1195,6 +1263,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIMESTAMP_MONOTONIC = 0x4 + SEEK_CUR = 0x1 + SEEK_DATA = 0x4 + SEEK_END = 0x2 + SEEK_HOLE = 0x3 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1210,6 +1283,7 @@ const ( SIOCGDRVSPEC = 0xc028697b SIOCGETVLAN = 0xc020697f SIOCGHIWAT = 0x40047301 + SIOCGIF6LOWPAN = 0xc02069c5 SIOCGIFADDR = 0xc0206921 SIOCGIFALTMTU = 0xc0206948 SIOCGIFASYNCMAP = 0xc020697c @@ -1220,6 +1294,7 @@ const ( SIOCGIFDEVMTU = 0xc0206944 SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFLAGS = 0xc0206911 + SIOCGIFFUNCTIONALTYPE = 0xc02069ad SIOCGIFGENERIC = 0xc020693a SIOCGIFKPI = 0xc0206987 SIOCGIFMAC = 0xc0206982 @@ -1233,6 +1308,7 @@ const ( SIOCGIFSTATUS = 0xc331693d SIOCGIFVLAN = 0xc020697f SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGIFXMEDIA = 0xc02c6948 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCIFCREATE = 0xc0206978 @@ -1243,6 +1319,7 @@ const ( SIOCSDRVSPEC = 0x8028697b SIOCSETVLAN = 0x8020697e SIOCSHIWAT = 0x80047300 + SIOCSIF6LOWPAN = 0x802069c4 SIOCSIFADDR = 0x8020690c SIOCSIFALTMTU = 0x80206945 SIOCSIFASYNCMAP = 0x8020697d @@ -1270,6 +1347,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index f5e91b7a..17bba0e4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && dragonfly // +build amd64,dragonfly // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index 3689c808..44090011 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && freebsd // +build 386,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -997,6 +998,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1291,6 +1297,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1375,6 +1386,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index b8f7c3c9..64520d31 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && freebsd // +build amd64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -997,6 +998,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1292,6 +1298,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1376,6 +1387,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index be14bb1a..99e9a0e0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && freebsd // +build arm,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -980,6 +981,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1016,6 +1022,15 @@ const ( MAP_RESERVED0100 = 0x100 MAP_SHARED = 0x1 MAP_STACK = 0x400 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ACLS = 0x8000000 @@ -1261,6 +1276,11 @@ const ( SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1341,6 +1361,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index 7ce9c008..4c837711 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && freebsd // +build arm64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -997,6 +998,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1292,6 +1298,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1376,6 +1387,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index b3463a8b..78d4b85e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,5 +1,6 @@ // Code generated by mkmerge.go; DO NOT EDIT. +//go:build linux // +build linux package unix @@ -165,13 +166,16 @@ const ( BPF_ALU64 = 0x7 BPF_AND = 0x50 BPF_ARSH = 0xc0 + BPF_ATOMIC = 0xc0 BPF_B = 0x10 BPF_BUILD_ID_SIZE = 0x14 BPF_CALL = 0x80 + BPF_CMPXCHG = 0xf1 BPF_DIV = 0x30 BPF_DW = 0x18 BPF_END = 0xd0 BPF_EXIT = 0x90 + BPF_FETCH = 0x1 BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 @@ -224,7 +228,11 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_BTF_ID = 0x3 BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_FUNC = 0x4 + BPF_PSEUDO_KFUNC_CALL = 0x2 BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_IDX = 0x5 + BPF_PSEUDO_MAP_IDX_VALUE = 0x6 BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 @@ -239,11 +247,16 @@ const ( BPF_W = 0x0 BPF_X = 0x8 BPF_XADD = 0xc0 + BPF_XCHG = 0xe1 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 BTRFS_SUPER_MAGIC = 0x9123683e BTRFS_TEST_MAGIC = 0x73727279 + BUS_BLUETOOTH = 0x5 + BUS_HIL = 0x4 + BUS_USB = 0x3 + BUS_VIRTUAL = 0x6 CAN_BCM = 0x2 CAN_EFF_FLAG = 0x80000000 CAN_EFF_ID_BITS = 0x1d @@ -313,6 +326,7 @@ const ( CAN_J1939 = 0x7 CAN_MAX_DLC = 0x8 CAN_MAX_DLEN = 0x8 + CAN_MAX_RAW_DLC = 0xf CAN_MCNET = 0x5 CAN_MTU = 0x10 CAN_NPROTO = 0x8 @@ -465,6 +479,8 @@ const ( DM_LIST_VERSIONS = 0xc138fd0d DM_MAX_TYPE_NAME = 0x10 DM_NAME_LEN = 0x80 + DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID = 0x2 + DM_NAME_LIST_FLAG_HAS_UUID = 0x1 DM_NOFLUSH_FLAG = 0x800 DM_PERSISTENT_DEV_FLAG = 0x8 DM_QUERY_INACTIVE_TABLE_FLAG = 0x1000 @@ -484,9 +500,9 @@ const ( DM_UUID_FLAG = 0x4000 DM_UUID_LEN = 0x81 DM_VERSION = 0xc138fd00 - DM_VERSION_EXTRA = "-ioctl (2020-10-01)" + DM_VERSION_EXTRA = "-ioctl (2021-03-22)" DM_VERSION_MAJOR = 0x4 - DM_VERSION_MINOR = 0x2b + DM_VERSION_MINOR = 0x2d DM_VERSION_PATCHLEVEL = 0x0 DT_BLK = 0x6 DT_CHR = 0x2 @@ -664,6 +680,7 @@ const ( ETH_P_CAIF = 0xf7 ETH_P_CAN = 0xc ETH_P_CANFD = 0xd + ETH_P_CFM = 0x8902 ETH_P_CONTROL = 0x16 ETH_P_CUST = 0x6006 ETH_P_DDCMP = 0x6 @@ -834,7 +851,6 @@ const ( FSCRYPT_POLICY_FLAGS_PAD_4 = 0x0 FSCRYPT_POLICY_FLAGS_PAD_8 = 0x1 FSCRYPT_POLICY_FLAGS_PAD_MASK = 0x3 - FSCRYPT_POLICY_FLAGS_VALID = 0x1f FSCRYPT_POLICY_FLAG_DIRECT_KEY = 0x4 FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 = 0x10 FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 = 0x8 @@ -854,6 +870,7 @@ const ( FS_IOC_GET_ENCRYPTION_KEY_STATUS = 0xc080661a FS_IOC_GET_ENCRYPTION_POLICY_EX = 0xc0096616 FS_IOC_MEASURE_VERITY = 0xc0046686 + FS_IOC_READ_VERITY_METADATA = 0xc0286687 FS_IOC_REMOVE_ENCRYPTION_KEY = 0xc0406618 FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS = 0xc0406619 FS_KEY_DESCRIPTOR_SIZE = 0x8 @@ -865,10 +882,13 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0x1f + FS_POLICY_FLAGS_VALID = 0x7 FS_VERITY_FL = 0x100000 FS_VERITY_HASH_ALG_SHA256 = 0x1 FS_VERITY_HASH_ALG_SHA512 = 0x2 + FS_VERITY_METADATA_TYPE_DESCRIPTOR = 0x2 + FS_VERITY_METADATA_TYPE_MERKLE_TREE = 0x1 + FS_VERITY_METADATA_TYPE_SIGNATURE = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -962,11 +982,11 @@ const ( HDIO_SET_XFER = 0x306 HDIO_TRISTATE_HWIF = 0x31b HDIO_UNREGISTER_HWIF = 0x32a + HID_MAX_DESCRIPTOR_SIZE = 0x1000 HOSTFS_SUPER_MAGIC = 0xc0ffee HPFS_SUPER_MAGIC = 0xf995e849 HUGETLBFS_MAGIC = 0x958458f6 IBSHIFT = 0x10 - ICMPV6_FILTER = 0x1 ICRNL = 0x100 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 @@ -1138,6 +1158,7 @@ const ( IPV6_PMTUDISC_WANT = 0x1 IPV6_RECVDSTOPTS = 0x3a IPV6_RECVERR = 0x19 + IPV6_RECVERR_RFC4884 = 0x1f IPV6_RECVFRAGSIZE = 0x4d IPV6_RECVHOPLIMIT = 0x33 IPV6_RECVHOPOPTS = 0x35 @@ -1202,6 +1223,7 @@ const ( IP_PMTUDISC_PROBE = 0x3 IP_PMTUDISC_WANT = 0x1 IP_RECVERR = 0xb + IP_RECVERR_RFC4884 = 0x1a IP_RECVFRAGSIZE = 0x19 IP_RECVOPTS = 0x6 IP_RECVORIGDSTADDR = 0x14 @@ -1235,6 +1257,7 @@ const ( KEXEC_ARCH_PARISC = 0xf0000 KEXEC_ARCH_PPC = 0x140000 KEXEC_ARCH_PPC64 = 0x150000 + KEXEC_ARCH_RISCV = 0xf30000 KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 @@ -1310,6 +1333,20 @@ const ( KEY_SPEC_THREAD_KEYRING = -0x1 KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 + LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 + LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 + LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 + LANDLOCK_ACCESS_FS_MAKE_FIFO = 0x400 + LANDLOCK_ACCESS_FS_MAKE_REG = 0x100 + LANDLOCK_ACCESS_FS_MAKE_SOCK = 0x200 + LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000 + LANDLOCK_ACCESS_FS_READ_DIR = 0x8 + LANDLOCK_ACCESS_FS_READ_FILE = 0x4 + LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10 + LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 + LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 + LANDLOCK_CREATE_RULESET_VERSION = 0x1 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_HALT = 0xcdef0123 @@ -1360,6 +1397,8 @@ const ( MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 MADV_PAGEOUT = 0x15 + MADV_POPULATE_READ = 0x16 + MADV_POPULATE_WRITE = 0x17 MADV_RANDOM = 0x1 MADV_REMOVE = 0x9 MADV_SEQUENTIAL = 0x2 @@ -1384,6 +1423,10 @@ const ( MCAST_LEAVE_SOURCE_GROUP = 0x2f MCAST_MSFILTER = 0x30 MCAST_UNBLOCK_SOURCE = 0x2c + MEMGETREGIONINFO = 0xc0104d08 + MEMREADOOB64 = 0xc0184d16 + MEMWRITE = 0xc0304d18 + MEMWRITEOOB64 = 0xc0184d15 MFD_ALLOW_SEALING = 0x2 MFD_CLOEXEC = 0x1 MFD_HUGETLB = 0x4 @@ -1472,7 +1515,35 @@ const ( MS_SYNCHRONOUS = 0x10 MS_UNBINDABLE = 0x20000 MS_VERBOSE = 0x8000 + MTD_ABSENT = 0x0 + MTD_BIT_WRITEABLE = 0x800 + MTD_CAP_NANDFLASH = 0x400 + MTD_CAP_NORFLASH = 0xc00 + MTD_CAP_NVRAM = 0x1c00 + MTD_CAP_RAM = 0x1c00 + MTD_CAP_ROM = 0x0 + MTD_DATAFLASH = 0x6 MTD_INODE_FS_MAGIC = 0x11307854 + MTD_MAX_ECCPOS_ENTRIES = 0x40 + MTD_MAX_OOBFREE_ENTRIES = 0x8 + MTD_MLCNANDFLASH = 0x8 + MTD_NANDECC_AUTOPLACE = 0x2 + MTD_NANDECC_AUTOPL_USR = 0x4 + MTD_NANDECC_OFF = 0x0 + MTD_NANDECC_PLACE = 0x1 + MTD_NANDECC_PLACEONLY = 0x3 + MTD_NANDFLASH = 0x4 + MTD_NORFLASH = 0x3 + MTD_NO_ERASE = 0x1000 + MTD_OTP_FACTORY = 0x1 + MTD_OTP_OFF = 0x0 + MTD_OTP_USER = 0x2 + MTD_POWERUP_LOCK = 0x2000 + MTD_RAM = 0x1 + MTD_ROM = 0x2 + MTD_SLC_ON_MLC_EMULATION = 0x4000 + MTD_UBIVOLUME = 0x7 + MTD_WRITEABLE = 0x400 NAME_MAX = 0xff NCP_SUPER_MAGIC = 0x564c NETLINK_ADD_MEMBERSHIP = 0x1 @@ -1512,6 +1583,59 @@ const ( NETLINK_XFRM = 0x6 NETNSA_MAX = 0x5 NETNSA_NSID_NOT_ASSIGNED = -0x1 + NFC_ATR_REQ_GB_MAXSIZE = 0x30 + NFC_ATR_REQ_MAXSIZE = 0x40 + NFC_ATR_RES_GB_MAXSIZE = 0x2f + NFC_ATR_RES_MAXSIZE = 0x40 + NFC_COMM_ACTIVE = 0x0 + NFC_COMM_PASSIVE = 0x1 + NFC_DEVICE_NAME_MAXSIZE = 0x8 + NFC_DIRECTION_RX = 0x0 + NFC_DIRECTION_TX = 0x1 + NFC_FIRMWARE_NAME_MAXSIZE = 0x20 + NFC_GB_MAXSIZE = 0x30 + NFC_GENL_MCAST_EVENT_NAME = "events" + NFC_GENL_NAME = "nfc" + NFC_GENL_VERSION = 0x1 + NFC_HEADER_SIZE = 0x1 + NFC_ISO15693_UID_MAXSIZE = 0x8 + NFC_LLCP_MAX_SERVICE_NAME = 0x3f + NFC_LLCP_MIUX = 0x1 + NFC_LLCP_REMOTE_LTO = 0x3 + NFC_LLCP_REMOTE_MIU = 0x2 + NFC_LLCP_REMOTE_RW = 0x4 + NFC_LLCP_RW = 0x0 + NFC_NFCID1_MAXSIZE = 0xa + NFC_NFCID2_MAXSIZE = 0x8 + NFC_NFCID3_MAXSIZE = 0xa + NFC_PROTO_FELICA = 0x3 + NFC_PROTO_FELICA_MASK = 0x8 + NFC_PROTO_ISO14443 = 0x4 + NFC_PROTO_ISO14443_B = 0x6 + NFC_PROTO_ISO14443_B_MASK = 0x40 + NFC_PROTO_ISO14443_MASK = 0x10 + NFC_PROTO_ISO15693 = 0x7 + NFC_PROTO_ISO15693_MASK = 0x80 + NFC_PROTO_JEWEL = 0x1 + NFC_PROTO_JEWEL_MASK = 0x2 + NFC_PROTO_MAX = 0x8 + NFC_PROTO_MIFARE = 0x2 + NFC_PROTO_MIFARE_MASK = 0x4 + NFC_PROTO_NFC_DEP = 0x5 + NFC_PROTO_NFC_DEP_MASK = 0x20 + NFC_RAW_HEADER_SIZE = 0x2 + NFC_RF_INITIATOR = 0x0 + NFC_RF_NONE = 0x2 + NFC_RF_TARGET = 0x1 + NFC_SENSB_RES_MAXSIZE = 0xc + NFC_SENSF_RES_MAXSIZE = 0x12 + NFC_SE_DISABLED = 0x0 + NFC_SE_EMBEDDED = 0x2 + NFC_SE_ENABLED = 0x1 + NFC_SE_UICC = 0x1 + NFC_SOCKPROTO_LLCP = 0x1 + NFC_SOCKPROTO_MAX = 0x2 + NFC_SOCKPROTO_RAW = 0x0 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 NFNLGRP_CONNTRACK_DESTROY = 0x3 @@ -1529,11 +1653,12 @@ const ( NFNL_MSG_BATCH_END = 0x11 NFNL_NFA_NEST = 0x8000 NFNL_SUBSYS_ACCT = 0x7 - NFNL_SUBSYS_COUNT = 0xc + NFNL_SUBSYS_COUNT = 0xd NFNL_SUBSYS_CTHELPER = 0x9 NFNL_SUBSYS_CTNETLINK = 0x1 NFNL_SUBSYS_CTNETLINK_EXP = 0x2 NFNL_SUBSYS_CTNETLINK_TIMEOUT = 0x8 + NFNL_SUBSYS_HOOK = 0xc NFNL_SUBSYS_IPSET = 0x6 NFNL_SUBSYS_NFTABLES = 0xa NFNL_SUBSYS_NFT_COMPAT = 0xb @@ -1649,16 +1774,25 @@ const ( PERF_ATTR_SIZE_VER4 = 0x68 PERF_ATTR_SIZE_VER5 = 0x70 PERF_ATTR_SIZE_VER6 = 0x78 + PERF_ATTR_SIZE_VER7 = 0x80 PERF_AUX_FLAG_COLLISION = 0x8 + PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT = 0x0 + PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW = 0x100 PERF_AUX_FLAG_OVERWRITE = 0x2 PERF_AUX_FLAG_PARTIAL = 0x4 + PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK = 0xff00 PERF_AUX_FLAG_TRUNCATED = 0x1 PERF_FLAG_FD_CLOEXEC = 0x8 PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 + PERF_HW_EVENT_MASK = 0xffffffff PERF_MAX_CONTEXTS_PER_STACK = 0x8 PERF_MAX_STACK_DEPTH = 0x7f + PERF_MEM_BLK_ADDR = 0x4 + PERF_MEM_BLK_DATA = 0x2 + PERF_MEM_BLK_NA = 0x1 + PERF_MEM_BLK_SHIFT = 0x28 PERF_MEM_LOCK_LOCKED = 0x2 PERF_MEM_LOCK_NA = 0x1 PERF_MEM_LOCK_SHIFT = 0x18 @@ -1711,6 +1845,7 @@ const ( PERF_MEM_TLB_OS = 0x40 PERF_MEM_TLB_SHIFT = 0x1a PERF_MEM_TLB_WK = 0x20 + PERF_PMU_TYPE_SHIFT = 0x20 PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER = 0x1 PERF_RECORD_MISC_COMM_EXEC = 0x2000 PERF_RECORD_MISC_CPUMODE_MASK = 0x7 @@ -1722,12 +1857,14 @@ const ( PERF_RECORD_MISC_GUEST_USER = 0x5 PERF_RECORD_MISC_HYPERVISOR = 0x3 PERF_RECORD_MISC_KERNEL = 0x1 + PERF_RECORD_MISC_MMAP_BUILD_ID = 0x4000 PERF_RECORD_MISC_MMAP_DATA = 0x2000 PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT = 0x1000 PERF_RECORD_MISC_SWITCH_OUT = 0x2000 PERF_RECORD_MISC_SWITCH_OUT_PREEMPT = 0x4000 PERF_RECORD_MISC_USER = 0x2 PERF_SAMPLE_BRANCH_PLM_ALL = 0x7 + PERF_SAMPLE_WEIGHT_TYPE = 0x1004000 PIPEFS_MAGIC = 0x50495045 PPC_CMM_MAGIC = 0xc7571590 PPPIOCGNPMODE = 0xc008744c @@ -1808,7 +1945,15 @@ const ( PR_PAC_APGAKEY = 0x10 PR_PAC_APIAKEY = 0x1 PR_PAC_APIBKEY = 0x2 + PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 + PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_SCHED_CORE = 0x3e + PR_SCHED_CORE_CREATE = 0x1 + PR_SCHED_CORE_GET = 0x0 + PR_SCHED_CORE_MAX = 0x4 + PR_SCHED_CORE_SHARE_FROM = 0x3 + PR_SCHED_CORE_SHARE_TO = 0x2 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1840,6 +1985,7 @@ const ( PR_SET_SECCOMP = 0x16 PR_SET_SECUREBITS = 0x1c PR_SET_SPECULATION_CTRL = 0x35 + PR_SET_SYSCALL_USER_DISPATCH = 0x3b PR_SET_TAGGED_ADDR_CTRL = 0x37 PR_SET_THP_DISABLE = 0x29 PR_SET_TIMERSLACK = 0x1d @@ -1859,6 +2005,8 @@ const ( PR_SVE_SET_VL_ONEXEC = 0x40000 PR_SVE_VL_INHERIT = 0x20000 PR_SVE_VL_LEN_MASK = 0xffff + PR_SYS_DISPATCH_OFF = 0x0 + PR_SYS_DISPATCH_ON = 0x1 PR_TAGGED_ADDR_ENABLE = 0x1 PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 @@ -1887,6 +2035,7 @@ const ( PTRACE_GETREGSET = 0x4204 PTRACE_GETSIGINFO = 0x4202 PTRACE_GETSIGMASK = 0x420a + PTRACE_GET_RSEQ_CONFIGURATION = 0x420f PTRACE_GET_SYSCALL_INFO = 0x420e PTRACE_INTERRUPT = 0x4207 PTRACE_KILL = 0x8 @@ -1928,6 +2077,11 @@ const ( QNX4_SUPER_MAGIC = 0x2f QNX6_SUPER_MAGIC = 0x68191122 RAMFS_MAGIC = 0x858458f6 + RAW_PAYLOAD_DIGITAL = 0x3 + RAW_PAYLOAD_HCI = 0x2 + RAW_PAYLOAD_LLCP = 0x0 + RAW_PAYLOAD_NCI = 0x1 + RAW_PAYLOAD_PROPRIETARY = 0x4 RDTGROUP_SUPER_MAGIC = 0x7655821 REISERFS_SUPER_MAGIC = 0x52654973 RENAME_EXCHANGE = 0x2 @@ -1978,6 +2132,10 @@ const ( RTCF_NAT = 0x800000 RTCF_VALVE = 0x200000 RTC_AF = 0x20 + RTC_FEATURE_ALARM = 0x0 + RTC_FEATURE_ALARM_RES_MINUTE = 0x1 + RTC_FEATURE_CNT = 0x3 + RTC_FEATURE_NEED_WEEK_DAY = 0x2 RTC_IRQF = 0x80 RTC_MAX_FREQ = 0x2000 RTC_PF = 0x40 @@ -2038,6 +2196,7 @@ const ( RTM_DELNEIGH = 0x1d RTM_DELNETCONF = 0x51 RTM_DELNEXTHOP = 0x69 + RTM_DELNEXTHOPBUCKET = 0x75 RTM_DELNSID = 0x59 RTM_DELQDISC = 0x25 RTM_DELROUTE = 0x19 @@ -2051,6 +2210,7 @@ const ( RTM_F_LOOKUP_TABLE = 0x1000 RTM_F_NOTIFY = 0x100 RTM_F_OFFLOAD = 0x4000 + RTM_F_OFFLOAD_FAILED = 0x20000000 RTM_F_PREFIX = 0x800 RTM_F_TRAP = 0x8000 RTM_GETACTION = 0x32 @@ -2067,6 +2227,7 @@ const ( RTM_GETNEIGHTBL = 0x42 RTM_GETNETCONF = 0x52 RTM_GETNEXTHOP = 0x6a + RTM_GETNEXTHOPBUCKET = 0x76 RTM_GETNSID = 0x5a RTM_GETQDISC = 0x26 RTM_GETROUTE = 0x1a @@ -2075,7 +2236,7 @@ const ( RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e RTM_GETVLAN = 0x72 - RTM_MAX = 0x73 + RTM_MAX = 0x77 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 @@ -2089,6 +2250,7 @@ const ( RTM_NEWNEIGHTBL = 0x40 RTM_NEWNETCONF = 0x50 RTM_NEWNEXTHOP = 0x68 + RTM_NEWNEXTHOPBUCKET = 0x74 RTM_NEWNSID = 0x58 RTM_NEWNVLAN = 0x70 RTM_NEWPREFIX = 0x34 @@ -2098,18 +2260,19 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x19 - RTM_NR_MSGTYPES = 0x64 + RTM_NR_FAMILIES = 0x1a + RTM_NR_MSGTYPES = 0x68 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 RTNH_ALIGNTO = 0x4 - RTNH_COMPARE_MASK = 0x19 + RTNH_COMPARE_MASK = 0x59 RTNH_F_DEAD = 0x1 RTNH_F_LINKDOWN = 0x10 RTNH_F_OFFLOAD = 0x8 RTNH_F_ONLINK = 0x4 RTNH_F_PERVASIVE = 0x2 + RTNH_F_TRAP = 0x40 RTNH_F_UNRESOLVED = 0x20 RTN_MAX = 0xb RTPROT_BABEL = 0x2a @@ -2126,6 +2289,7 @@ const ( RTPROT_MROUTED = 0x11 RTPROT_MRT = 0xa RTPROT_NTK = 0xf + RTPROT_OPENR = 0x63 RTPROT_OSPF = 0xbc RTPROT_RA = 0x9 RTPROT_REDIRECT = 0x1 @@ -2156,7 +2320,14 @@ const ( SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 + SECRETMEM_MAGIC = 0x5345434d SECURITYFS_MAGIC = 0x73636673 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_MAX = 0x4 + SEEK_SET = 0x0 SELINUX_MAGIC = 0xf97cff8c SHUT_RD = 0x0 SHUT_RDWR = 0x2 @@ -2403,6 +2574,14 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2580,6 +2759,7 @@ const ( VMADDR_CID_HOST = 0x2 VMADDR_CID_HYPERVISOR = 0x0 VMADDR_CID_LOCAL = 0x1 + VMADDR_FLAG_TO_HOST = 0x1 VMADDR_PORT_ANY = 0xffffffff VM_SOCKETS_INVALID_VERSION = 0xffffffff VQUIT = 0x1 @@ -2727,6 +2907,9 @@ const ( Z3FOLD_MAGIC = 0x33 ZONEFS_MAGIC = 0x5a4f4653 ZSMALLOC_MAGIC = 0x58295829 + _HIDIOCGRAWNAME_LEN = 0x80 + _HIDIOCGRAWPHYS_LEN = 0x40 + _HIDIOCGRAWUNIQ_LEN = 0x40 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 336e0b32..697811a4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && linux // +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -93,6 +96,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -119,6 +125,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -128,6 +147,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -165,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -192,6 +217,7 @@ const ( PPPIOCSPASS = 0x40087447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETFPREGS = 0xe @@ -268,6 +294,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -282,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -290,6 +318,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -481,6 +510,9 @@ const ( X86_FXSR_MAGIC = 0x0 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 961507e9..7d8d93bf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && linux // +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -93,6 +96,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -119,6 +125,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -128,6 +147,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -165,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -192,6 +217,7 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_ARCH_PRCTL = 0x1e @@ -269,6 +295,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -283,6 +310,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -291,6 +319,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -481,6 +510,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index a65576db..f707d508 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && linux // +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x40087447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETCRUNCHREGS = 0x19 @@ -275,6 +301,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -289,6 +316,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -297,6 +325,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -487,6 +516,9 @@ const ( WORDSIZE = 0x20 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index cf075caa..3a67a9c8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && linux // +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -95,6 +98,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -120,6 +126,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -129,6 +148,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -166,6 +190,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -193,8 +218,10 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PROT_BTI = 0x10 + PROT_MTE = 0x20 PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_PEEKMTETAGS = 0x21 PTRACE_POKEMTETAGS = 0x22 @@ -264,6 +291,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -278,6 +306,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -286,6 +315,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -477,6 +507,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index efe90dee..a7ccef56 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips && linux // +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x80087447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETFPREGS = 0xe @@ -268,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -282,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -290,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -483,6 +512,9 @@ const ( WORDSIZE = 0x20 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 8b0e8911..f7b7cec9 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && linux // +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_GETFPREGS = 0xe @@ -268,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -282,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -290,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -483,6 +512,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index e9430cd1..4fcacf95 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64le && linux // +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_GETFPREGS = 0xe @@ -268,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -282,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -290,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -483,6 +512,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 61e4f5db..6f6c223a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mipsle && linux // +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x80087447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETFPREGS = 0xe @@ -268,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -282,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -290,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -483,6 +512,9 @@ const ( WORDSIZE = 0x20 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go new file mode 100644 index 00000000..59e522bc --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -0,0 +1,881 @@ +// mkerrors.sh -Wall -Werror -static -I/tmp/include +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc && linux +// +build ppc,linux + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go + +package unix + +import "syscall" + +const ( + B1000000 = 0x17 + B115200 = 0x11 + B1152000 = 0x18 + B1500000 = 0x19 + B2000000 = 0x1a + B230400 = 0x12 + B2500000 = 0x1b + B3000000 = 0x1c + B3500000 = 0x1d + B4000000 = 0x1e + B460800 = 0x13 + B500000 = 0x14 + B57600 = 0x10 + B576000 = 0x15 + B921600 = 0x16 + BLKBSZGET = 0x40041270 + BLKBSZSET = 0x80041271 + BLKFLSBUF = 0x20001261 + BLKFRAGET = 0x20001265 + BLKFRASET = 0x20001264 + BLKGETSIZE = 0x20001260 + BLKGETSIZE64 = 0x40041272 + BLKPBSZGET = 0x2000127b + BLKRAGET = 0x20001263 + BLKRASET = 0x20001262 + BLKROGET = 0x2000125e + BLKROSET = 0x2000125d + BLKRRPART = 0x2000125f + BLKSECTGET = 0x20001267 + BLKSECTSET = 0x20001266 + BLKSSZGET = 0x20001268 + BOTHER = 0x1f + BS1 = 0x8000 + BSDLY = 0x8000 + CBAUD = 0xff + CBAUDEX = 0x0 + CIBAUD = 0xff0000 + CLOCAL = 0x8000 + CR1 = 0x1000 + CR2 = 0x2000 + CR3 = 0x3000 + CRDLY = 0x3000 + CREAD = 0x800 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EFD_CLOEXEC = 0x80000 + EFD_NONBLOCK = 0x800 + EPOLL_CLOEXEC = 0x80000 + EXTPROC = 0x10000000 + FF1 = 0x4000 + FFDLY = 0x4000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d + FLUSHO = 0x800000 + FS_IOC_ENABLE_VERITY = 0x80806685 + FS_IOC_GETFLAGS = 0x40046601 + FS_IOC_GET_ENCRYPTION_NONCE = 0x4010661b + FS_IOC_GET_ENCRYPTION_POLICY = 0x800c6615 + FS_IOC_GET_ENCRYPTION_PWSALT = 0x80106614 + FS_IOC_SETFLAGS = 0x80046602 + FS_IOC_SET_ENCRYPTION_POLICY = 0x400c6613 + F_GETLK = 0xc + F_GETLK64 = 0xc + F_GETOWN = 0x9 + F_RDLCK = 0x0 + F_SETLK = 0xd + F_SETLK64 = 0xd + F_SETLKW = 0xe + F_SETLKW64 = 0xe + F_SETOWN = 0x8 + F_UNLCK = 0x2 + F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 + HUPCL = 0x4000 + ICANON = 0x100 + IEXTEN = 0x400 + IN_CLOEXEC = 0x80000 + IN_NONBLOCK = 0x800 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 + ISIG = 0x80 + IUCLC = 0x1000 + IXOFF = 0x400 + IXON = 0x200 + MAP_ANON = 0x20 + MAP_ANONYMOUS = 0x20 + MAP_DENYWRITE = 0x800 + MAP_EXECUTABLE = 0x1000 + MAP_GROWSDOWN = 0x100 + MAP_HUGETLB = 0x40000 + MAP_LOCKED = 0x80 + MAP_NONBLOCK = 0x10000 + MAP_NORESERVE = 0x40 + MAP_POPULATE = 0x8000 + MAP_STACK = 0x20000 + MAP_SYNC = 0x80000 + MCL_CURRENT = 0x2000 + MCL_FUTURE = 0x4000 + MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x20004d13 + NFDBITS = 0x20 + NL2 = 0x200 + NL3 = 0x300 + NLDLY = 0x300 + NOFLSH = 0x80000000 + NS_GET_NSTYPE = 0x2000b703 + NS_GET_OWNER_UID = 0x2000b704 + NS_GET_PARENT = 0x2000b702 + NS_GET_USERNS = 0x2000b701 + OLCUC = 0x4 + ONLCR = 0x2 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d + O_APPEND = 0x400 + O_ASYNC = 0x2000 + O_CLOEXEC = 0x80000 + O_CREAT = 0x40 + O_DIRECT = 0x20000 + O_DIRECTORY = 0x4000 + O_DSYNC = 0x1000 + O_EXCL = 0x80 + O_FSYNC = 0x101000 + O_LARGEFILE = 0x10000 + O_NDELAY = 0x800 + O_NOATIME = 0x40000 + O_NOCTTY = 0x100 + O_NOFOLLOW = 0x8000 + O_NONBLOCK = 0x800 + O_PATH = 0x200000 + O_RSYNC = 0x101000 + O_SYNC = 0x101000 + O_TMPFILE = 0x404000 + O_TRUNC = 0x200 + PARENB = 0x1000 + PARODD = 0x2000 + PENDIN = 0x20000000 + PERF_EVENT_IOC_DISABLE = 0x20002401 + PERF_EVENT_IOC_ENABLE = 0x20002400 + PERF_EVENT_IOC_ID = 0x40042407 + PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8004240b + PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + PERF_EVENT_IOC_PERIOD = 0x80082404 + PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + PERF_EVENT_IOC_REFRESH = 0x20002402 + PERF_EVENT_IOC_RESET = 0x20002403 + PERF_EVENT_IOC_SET_BPF = 0x80042408 + PERF_EVENT_IOC_SET_FILTER = 0x80042406 + PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 + PPPIOCATTACH = 0x8004743d + PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 + PPPIOCCONNECT = 0x8004743a + PPPIOCDETACH = 0x8004743c + PPPIOCDISCONN = 0x20007439 + PPPIOCGASYNCMAP = 0x40047458 + PPPIOCGCHAN = 0x40047437 + PPPIOCGDEBUG = 0x40047441 + PPPIOCGFLAGS = 0x4004745a + PPPIOCGIDLE = 0x4008743f + PPPIOCGIDLE32 = 0x4008743f + PPPIOCGIDLE64 = 0x4010743f + PPPIOCGL2TPSTATS = 0x40487436 + PPPIOCGMRU = 0x40047453 + PPPIOCGRASYNCMAP = 0x40047455 + PPPIOCGUNIT = 0x40047456 + PPPIOCGXASYNCMAP = 0x40207450 + PPPIOCSACTIVE = 0x80087446 + PPPIOCSASYNCMAP = 0x80047457 + PPPIOCSCOMPRESS = 0x800c744d + PPPIOCSDEBUG = 0x80047440 + PPPIOCSFLAGS = 0x80047459 + PPPIOCSMAXCID = 0x80047451 + PPPIOCSMRRU = 0x8004743b + PPPIOCSMRU = 0x80047452 + PPPIOCSNPMODE = 0x8008744b + PPPIOCSPASS = 0x80087447 + PPPIOCSRASYNCMAP = 0x80047454 + PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 + PPPIOCXFERUNIT = 0x2000744e + PROT_SAO = 0x10 + PR_SET_PTRACER_ANY = 0xffffffff + PTRACE_GETEVRREGS = 0x14 + PTRACE_GETFPREGS = 0xe + PTRACE_GETREGS64 = 0x16 + PTRACE_GETVRREGS = 0x12 + PTRACE_GETVSRREGS = 0x1b + PTRACE_GET_DEBUGREG = 0x19 + PTRACE_SETEVRREGS = 0x15 + PTRACE_SETFPREGS = 0xf + PTRACE_SETREGS64 = 0x17 + PTRACE_SETVRREGS = 0x13 + PTRACE_SETVSRREGS = 0x1c + PTRACE_SET_DEBUGREG = 0x1a + PTRACE_SINGLEBLOCK = 0x100 + PTRACE_SYSEMU = 0x1d + PTRACE_SYSEMU_SINGLESTEP = 0x1e + PT_CCR = 0x26 + PT_CTR = 0x23 + PT_DAR = 0x29 + PT_DSCR = 0x2c + PT_DSISR = 0x2a + PT_FPR0 = 0x30 + PT_FPR31 = 0x6e + PT_FPSCR = 0x71 + PT_LNK = 0x24 + PT_MQ = 0x27 + PT_MSR = 0x21 + PT_NIP = 0x20 + PT_ORIG_R3 = 0x22 + PT_R0 = 0x0 + PT_R1 = 0x1 + PT_R10 = 0xa + PT_R11 = 0xb + PT_R12 = 0xc + PT_R13 = 0xd + PT_R14 = 0xe + PT_R15 = 0xf + PT_R16 = 0x10 + PT_R17 = 0x11 + PT_R18 = 0x12 + PT_R19 = 0x13 + PT_R2 = 0x2 + PT_R20 = 0x14 + PT_R21 = 0x15 + PT_R22 = 0x16 + PT_R23 = 0x17 + PT_R24 = 0x18 + PT_R25 = 0x19 + PT_R26 = 0x1a + PT_R27 = 0x1b + PT_R28 = 0x1c + PT_R29 = 0x1d + PT_R3 = 0x3 + PT_R30 = 0x1e + PT_R31 = 0x1f + PT_R4 = 0x4 + PT_R5 = 0x5 + PT_R6 = 0x6 + PT_R7 = 0x7 + PT_R8 = 0x8 + PT_R9 = 0x9 + PT_REGS_COUNT = 0x2c + PT_RESULT = 0x2b + PT_TRAP = 0x28 + PT_XER = 0x25 + RLIMIT_AS = 0x9 + RLIMIT_MEMLOCK = 0x8 + RLIMIT_NOFILE = 0x7 + RLIMIT_NPROC = 0x6 + RLIMIT_RSS = 0x5 + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 + RTC_AIE_OFF = 0x20007002 + RTC_AIE_ON = 0x20007001 + RTC_ALM_READ = 0x40247008 + RTC_ALM_SET = 0x80247007 + RTC_EPOCH_READ = 0x4004700d + RTC_EPOCH_SET = 0x8004700e + RTC_IRQP_READ = 0x4004700b + RTC_IRQP_SET = 0x8004700c + RTC_PIE_OFF = 0x20007006 + RTC_PIE_ON = 0x20007005 + RTC_PLL_GET = 0x401c7011 + RTC_PLL_SET = 0x801c7012 + RTC_RD_TIME = 0x40247009 + RTC_SET_TIME = 0x8024700a + RTC_UIE_OFF = 0x20007004 + RTC_UIE_ON = 0x20007003 + RTC_VL_CLR = 0x20007014 + RTC_VL_READ = 0x40047013 + RTC_WIE_OFF = 0x20007010 + RTC_WIE_ON = 0x2000700f + RTC_WKALM_RD = 0x40287010 + RTC_WKALM_SET = 0x8028700f + SCM_TIMESTAMPING = 0x25 + SCM_TIMESTAMPING_OPT_STATS = 0x36 + SCM_TIMESTAMPING_PKTINFO = 0x3a + SCM_TIMESTAMPNS = 0x23 + SCM_TXTIME = 0x3d + SCM_WIFI_STATUS = 0x29 + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 + SIOCATMARK = 0x8905 + SIOCGPGRP = 0x8904 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCINQ = 0x4004667f + SIOCOUTQ = 0x40047473 + SIOCSPGRP = 0x8902 + SOCK_CLOEXEC = 0x80000 + SOCK_DGRAM = 0x2 + SOCK_NONBLOCK = 0x800 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0x1 + SO_ACCEPTCONN = 0x1e + SO_ATTACH_BPF = 0x32 + SO_ATTACH_REUSEPORT_CBPF = 0x33 + SO_ATTACH_REUSEPORT_EBPF = 0x34 + SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e + SO_BPF_EXTENSIONS = 0x30 + SO_BROADCAST = 0x6 + SO_BSDCOMPAT = 0xe + SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 + SO_CNX_ADVICE = 0x35 + SO_COOKIE = 0x39 + SO_DETACH_REUSEPORT_BPF = 0x44 + SO_DOMAIN = 0x27 + SO_DONTROUTE = 0x5 + SO_ERROR = 0x4 + SO_INCOMING_CPU = 0x31 + SO_INCOMING_NAPI_ID = 0x38 + SO_KEEPALIVE = 0x9 + SO_LINGER = 0xd + SO_LOCK_FILTER = 0x2c + SO_MARK = 0x24 + SO_MAX_PACING_RATE = 0x2f + SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 + SO_NOFCS = 0x2b + SO_OOBINLINE = 0xa + SO_PASSCRED = 0x14 + SO_PASSSEC = 0x22 + SO_PEEK_OFF = 0x2a + SO_PEERCRED = 0x15 + SO_PEERGROUPS = 0x3b + SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 + SO_PROTOCOL = 0x26 + SO_RCVBUF = 0x8 + SO_RCVBUFFORCE = 0x21 + SO_RCVLOWAT = 0x10 + SO_RCVTIMEO = 0x12 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x12 + SO_REUSEADDR = 0x2 + SO_REUSEPORT = 0xf + SO_RXQ_OVFL = 0x28 + SO_SECURITY_AUTHENTICATION = 0x16 + SO_SECURITY_ENCRYPTION_NETWORK = 0x18 + SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17 + SO_SELECT_ERR_QUEUE = 0x2d + SO_SNDBUF = 0x7 + SO_SNDBUFFORCE = 0x20 + SO_SNDLOWAT = 0x11 + SO_SNDTIMEO = 0x13 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x13 + SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 + SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TXTIME = 0x3d + SO_TYPE = 0x3 + SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c + TAB1 = 0x400 + TAB2 = 0x800 + TAB3 = 0xc00 + TABDLY = 0xc00 + TCFLSH = 0x2000741f + TCGETA = 0x40147417 + TCGETS = 0x402c7413 + TCSAFLUSH = 0x2 + TCSBRK = 0x2000741d + TCSBRKP = 0x5425 + TCSETA = 0x80147418 + TCSETAF = 0x8014741c + TCSETAW = 0x80147419 + TCSETS = 0x802c7414 + TCSETSF = 0x802c7416 + TCSETSW = 0x802c7415 + TCXONC = 0x2000741e + TFD_CLOEXEC = 0x80000 + TFD_NONBLOCK = 0x800 + TIOCCBRK = 0x5428 + TIOCCONS = 0x541d + TIOCEXCL = 0x540c + TIOCGDEV = 0x40045432 + TIOCGETC = 0x40067412 + TIOCGETD = 0x5424 + TIOCGETP = 0x40067408 + TIOCGEXCL = 0x40045440 + TIOCGICOUNT = 0x545d + TIOCGISO7816 = 0x40285442 + TIOCGLCKTRMIOS = 0x5456 + TIOCGLTC = 0x40067474 + TIOCGPGRP = 0x40047477 + TIOCGPKT = 0x40045438 + TIOCGPTLCK = 0x40045439 + TIOCGPTN = 0x40045430 + TIOCGPTPEER = 0x20005441 + TIOCGRS485 = 0x542e + TIOCGSERIAL = 0x541e + TIOCGSID = 0x5429 + TIOCGSOFTCAR = 0x5419 + TIOCGWINSZ = 0x40087468 + TIOCINQ = 0x4004667f + TIOCLINUX = 0x541c + TIOCMBIC = 0x5417 + TIOCMBIS = 0x5416 + TIOCMGET = 0x5415 + TIOCMIWAIT = 0x545c + TIOCMSET = 0x5418 + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_LOOP = 0x8000 + TIOCM_OUT1 = 0x2000 + TIOCM_OUT2 = 0x4000 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x5422 + TIOCNXCL = 0x540d + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x5420 + TIOCSBRK = 0x5427 + TIOCSCTTY = 0x540e + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETC = 0x80067411 + TIOCSETD = 0x5423 + TIOCSETN = 0x8006740a + TIOCSETP = 0x80067409 + TIOCSIG = 0x80045436 + TIOCSISO7816 = 0xc0285443 + TIOCSLCKTRMIOS = 0x5457 + TIOCSLTC = 0x80067475 + TIOCSPGRP = 0x80047476 + TIOCSPTLCK = 0x80045431 + TIOCSRS485 = 0x542f + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x541a + TIOCSTART = 0x2000746e + TIOCSTI = 0x5412 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCVHANGUP = 0x5437 + TOSTOP = 0x400000 + TUNATTACHFILTER = 0x800854d5 + TUNDETACHFILTER = 0x800854d6 + TUNGETDEVNETNS = 0x200054e3 + TUNGETFEATURES = 0x400454cf + TUNGETFILTER = 0x400854db + TUNGETIFF = 0x400454d2 + TUNGETSNDBUF = 0x400454d3 + TUNGETVNETBE = 0x400454df + TUNGETVNETHDRSZ = 0x400454d7 + TUNGETVNETLE = 0x400454dd + TUNSETCARRIER = 0x800454e2 + TUNSETDEBUG = 0x800454c9 + TUNSETFILTEREBPF = 0x400454e1 + TUNSETGROUP = 0x800454ce + TUNSETIFF = 0x800454ca + TUNSETIFINDEX = 0x800454da + TUNSETLINK = 0x800454cd + TUNSETNOCSUM = 0x800454c8 + TUNSETOFFLOAD = 0x800454d0 + TUNSETOWNER = 0x800454cc + TUNSETPERSIST = 0x800454cb + TUNSETQUEUE = 0x800454d9 + TUNSETSNDBUF = 0x800454d4 + TUNSETSTEERINGEBPF = 0x400454e0 + TUNSETTXFILTER = 0x800454d1 + TUNSETVNETBE = 0x800454de + TUNSETVNETHDRSZ = 0x800454d8 + TUNSETVNETLE = 0x800454dc + UBI_IOCATT = 0x80186f40 + UBI_IOCDET = 0x80046f41 + UBI_IOCEBCH = 0x80044f02 + UBI_IOCEBER = 0x80044f01 + UBI_IOCEBISMAP = 0x40044f05 + UBI_IOCEBMAP = 0x80084f03 + UBI_IOCEBUNMAP = 0x80044f04 + UBI_IOCMKVOL = 0x80986f00 + UBI_IOCRMVOL = 0x80046f01 + UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 + UBI_IOCRSVOL = 0x800c6f02 + UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 + UBI_IOCVOLCRBLK = 0x80804f07 + UBI_IOCVOLRMBLK = 0x20004f08 + UBI_IOCVOLUP = 0x80084f00 + VDISCARD = 0x10 + VEOF = 0x4 + VEOL = 0x6 + VEOL2 = 0x8 + VMIN = 0x5 + VREPRINT = 0xb + VSTART = 0xd + VSTOP = 0xe + VSUSP = 0xc + VSWTC = 0x9 + VT1 = 0x10000 + VTDLY = 0x10000 + VTIME = 0x7 + VWERASE = 0xa + WDIOC_GETBOOTSTATUS = 0x40045702 + WDIOC_GETPRETIMEOUT = 0x40045709 + WDIOC_GETSTATUS = 0x40045701 + WDIOC_GETSUPPORT = 0x40285700 + WDIOC_GETTEMP = 0x40045703 + WDIOC_GETTIMELEFT = 0x4004570a + WDIOC_GETTIMEOUT = 0x40045707 + WDIOC_KEEPALIVE = 0x40045705 + WDIOC_SETOPTIONS = 0x40045704 + WORDSIZE = 0x20 + XCASE = 0x4000 + XTABS = 0xc00 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 +) + +// Errors +const ( + EADDRINUSE = syscall.Errno(0x62) + EADDRNOTAVAIL = syscall.Errno(0x63) + EADV = syscall.Errno(0x44) + EAFNOSUPPORT = syscall.Errno(0x61) + EALREADY = syscall.Errno(0x72) + EBADE = syscall.Errno(0x34) + EBADFD = syscall.Errno(0x4d) + EBADMSG = syscall.Errno(0x4a) + EBADR = syscall.Errno(0x35) + EBADRQC = syscall.Errno(0x38) + EBADSLT = syscall.Errno(0x39) + EBFONT = syscall.Errno(0x3b) + ECANCELED = syscall.Errno(0x7d) + ECHRNG = syscall.Errno(0x2c) + ECOMM = syscall.Errno(0x46) + ECONNABORTED = syscall.Errno(0x67) + ECONNREFUSED = syscall.Errno(0x6f) + ECONNRESET = syscall.Errno(0x68) + EDEADLK = syscall.Errno(0x23) + EDEADLOCK = syscall.Errno(0x3a) + EDESTADDRREQ = syscall.Errno(0x59) + EDOTDOT = syscall.Errno(0x49) + EDQUOT = syscall.Errno(0x7a) + EHOSTDOWN = syscall.Errno(0x70) + EHOSTUNREACH = syscall.Errno(0x71) + EHWPOISON = syscall.Errno(0x85) + EIDRM = syscall.Errno(0x2b) + EILSEQ = syscall.Errno(0x54) + EINPROGRESS = syscall.Errno(0x73) + EISCONN = syscall.Errno(0x6a) + EISNAM = syscall.Errno(0x78) + EKEYEXPIRED = syscall.Errno(0x7f) + EKEYREJECTED = syscall.Errno(0x81) + EKEYREVOKED = syscall.Errno(0x80) + EL2HLT = syscall.Errno(0x33) + EL2NSYNC = syscall.Errno(0x2d) + EL3HLT = syscall.Errno(0x2e) + EL3RST = syscall.Errno(0x2f) + ELIBACC = syscall.Errno(0x4f) + ELIBBAD = syscall.Errno(0x50) + ELIBEXEC = syscall.Errno(0x53) + ELIBMAX = syscall.Errno(0x52) + ELIBSCN = syscall.Errno(0x51) + ELNRNG = syscall.Errno(0x30) + ELOOP = syscall.Errno(0x28) + EMEDIUMTYPE = syscall.Errno(0x7c) + EMSGSIZE = syscall.Errno(0x5a) + EMULTIHOP = syscall.Errno(0x48) + ENAMETOOLONG = syscall.Errno(0x24) + ENAVAIL = syscall.Errno(0x77) + ENETDOWN = syscall.Errno(0x64) + ENETRESET = syscall.Errno(0x66) + ENETUNREACH = syscall.Errno(0x65) + ENOANO = syscall.Errno(0x37) + ENOBUFS = syscall.Errno(0x69) + ENOCSI = syscall.Errno(0x32) + ENODATA = syscall.Errno(0x3d) + ENOKEY = syscall.Errno(0x7e) + ENOLCK = syscall.Errno(0x25) + ENOLINK = syscall.Errno(0x43) + ENOMEDIUM = syscall.Errno(0x7b) + ENOMSG = syscall.Errno(0x2a) + ENONET = syscall.Errno(0x40) + ENOPKG = syscall.Errno(0x41) + ENOPROTOOPT = syscall.Errno(0x5c) + ENOSR = syscall.Errno(0x3f) + ENOSTR = syscall.Errno(0x3c) + ENOSYS = syscall.Errno(0x26) + ENOTCONN = syscall.Errno(0x6b) + ENOTEMPTY = syscall.Errno(0x27) + ENOTNAM = syscall.Errno(0x76) + ENOTRECOVERABLE = syscall.Errno(0x83) + ENOTSOCK = syscall.Errno(0x58) + ENOTSUP = syscall.Errno(0x5f) + ENOTUNIQ = syscall.Errno(0x4c) + EOPNOTSUPP = syscall.Errno(0x5f) + EOVERFLOW = syscall.Errno(0x4b) + EOWNERDEAD = syscall.Errno(0x82) + EPFNOSUPPORT = syscall.Errno(0x60) + EPROTO = syscall.Errno(0x47) + EPROTONOSUPPORT = syscall.Errno(0x5d) + EPROTOTYPE = syscall.Errno(0x5b) + EREMCHG = syscall.Errno(0x4e) + EREMOTE = syscall.Errno(0x42) + EREMOTEIO = syscall.Errno(0x79) + ERESTART = syscall.Errno(0x55) + ERFKILL = syscall.Errno(0x84) + ESHUTDOWN = syscall.Errno(0x6c) + ESOCKTNOSUPPORT = syscall.Errno(0x5e) + ESRMNT = syscall.Errno(0x45) + ESTALE = syscall.Errno(0x74) + ESTRPIPE = syscall.Errno(0x56) + ETIME = syscall.Errno(0x3e) + ETIMEDOUT = syscall.Errno(0x6e) + ETOOMANYREFS = syscall.Errno(0x6d) + EUCLEAN = syscall.Errno(0x75) + EUNATCH = syscall.Errno(0x31) + EUSERS = syscall.Errno(0x57) + EXFULL = syscall.Errno(0x36) +) + +// Signals +const ( + SIGBUS = syscall.Signal(0x7) + SIGCHLD = syscall.Signal(0x11) + SIGCLD = syscall.Signal(0x11) + SIGCONT = syscall.Signal(0x12) + SIGIO = syscall.Signal(0x1d) + SIGPOLL = syscall.Signal(0x1d) + SIGPROF = syscall.Signal(0x1b) + SIGPWR = syscall.Signal(0x1e) + SIGSTKFLT = syscall.Signal(0x10) + SIGSTOP = syscall.Signal(0x13) + SIGSYS = syscall.Signal(0x1f) + SIGTSTP = syscall.Signal(0x14) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x17) + SIGUSR1 = syscall.Signal(0xa) + SIGUSR2 = syscall.Signal(0xc) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "no such device or address"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EAGAIN", "resource temporarily unavailable"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device or resource busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "invalid cross-device link"}, + {19, "ENODEV", "no such device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "numerical result out of range"}, + {35, "EDEADLK", "resource deadlock avoided"}, + {36, "ENAMETOOLONG", "file name too long"}, + {37, "ENOLCK", "no locks available"}, + {38, "ENOSYS", "function not implemented"}, + {39, "ENOTEMPTY", "directory not empty"}, + {40, "ELOOP", "too many levels of symbolic links"}, + {42, "ENOMSG", "no message of desired type"}, + {43, "EIDRM", "identifier removed"}, + {44, "ECHRNG", "channel number out of range"}, + {45, "EL2NSYNC", "level 2 not synchronized"}, + {46, "EL3HLT", "level 3 halted"}, + {47, "EL3RST", "level 3 reset"}, + {48, "ELNRNG", "link number out of range"}, + {49, "EUNATCH", "protocol driver not attached"}, + {50, "ENOCSI", "no CSI structure available"}, + {51, "EL2HLT", "level 2 halted"}, + {52, "EBADE", "invalid exchange"}, + {53, "EBADR", "invalid request descriptor"}, + {54, "EXFULL", "exchange full"}, + {55, "ENOANO", "no anode"}, + {56, "EBADRQC", "invalid request code"}, + {57, "EBADSLT", "invalid slot"}, + {58, "EDEADLOCK", "file locking deadlock error"}, + {59, "EBFONT", "bad font file format"}, + {60, "ENOSTR", "device not a stream"}, + {61, "ENODATA", "no data available"}, + {62, "ETIME", "timer expired"}, + {63, "ENOSR", "out of streams resources"}, + {64, "ENONET", "machine is not on the network"}, + {65, "ENOPKG", "package not installed"}, + {66, "EREMOTE", "object is remote"}, + {67, "ENOLINK", "link has been severed"}, + {68, "EADV", "advertise error"}, + {69, "ESRMNT", "srmount error"}, + {70, "ECOMM", "communication error on send"}, + {71, "EPROTO", "protocol error"}, + {72, "EMULTIHOP", "multihop attempted"}, + {73, "EDOTDOT", "RFS specific error"}, + {74, "EBADMSG", "bad message"}, + {75, "EOVERFLOW", "value too large for defined data type"}, + {76, "ENOTUNIQ", "name not unique on network"}, + {77, "EBADFD", "file descriptor in bad state"}, + {78, "EREMCHG", "remote address changed"}, + {79, "ELIBACC", "can not access a needed shared library"}, + {80, "ELIBBAD", "accessing a corrupted shared library"}, + {81, "ELIBSCN", ".lib section in a.out corrupted"}, + {82, "ELIBMAX", "attempting to link in too many shared libraries"}, + {83, "ELIBEXEC", "cannot exec a shared library directly"}, + {84, "EILSEQ", "invalid or incomplete multibyte or wide character"}, + {85, "ERESTART", "interrupted system call should be restarted"}, + {86, "ESTRPIPE", "streams pipe error"}, + {87, "EUSERS", "too many users"}, + {88, "ENOTSOCK", "socket operation on non-socket"}, + {89, "EDESTADDRREQ", "destination address required"}, + {90, "EMSGSIZE", "message too long"}, + {91, "EPROTOTYPE", "protocol wrong type for socket"}, + {92, "ENOPROTOOPT", "protocol not available"}, + {93, "EPROTONOSUPPORT", "protocol not supported"}, + {94, "ESOCKTNOSUPPORT", "socket type not supported"}, + {95, "ENOTSUP", "operation not supported"}, + {96, "EPFNOSUPPORT", "protocol family not supported"}, + {97, "EAFNOSUPPORT", "address family not supported by protocol"}, + {98, "EADDRINUSE", "address already in use"}, + {99, "EADDRNOTAVAIL", "cannot assign requested address"}, + {100, "ENETDOWN", "network is down"}, + {101, "ENETUNREACH", "network is unreachable"}, + {102, "ENETRESET", "network dropped connection on reset"}, + {103, "ECONNABORTED", "software caused connection abort"}, + {104, "ECONNRESET", "connection reset by peer"}, + {105, "ENOBUFS", "no buffer space available"}, + {106, "EISCONN", "transport endpoint is already connected"}, + {107, "ENOTCONN", "transport endpoint is not connected"}, + {108, "ESHUTDOWN", "cannot send after transport endpoint shutdown"}, + {109, "ETOOMANYREFS", "too many references: cannot splice"}, + {110, "ETIMEDOUT", "connection timed out"}, + {111, "ECONNREFUSED", "connection refused"}, + {112, "EHOSTDOWN", "host is down"}, + {113, "EHOSTUNREACH", "no route to host"}, + {114, "EALREADY", "operation already in progress"}, + {115, "EINPROGRESS", "operation now in progress"}, + {116, "ESTALE", "stale file handle"}, + {117, "EUCLEAN", "structure needs cleaning"}, + {118, "ENOTNAM", "not a XENIX named type file"}, + {119, "ENAVAIL", "no XENIX semaphores available"}, + {120, "EISNAM", "is a named type file"}, + {121, "EREMOTEIO", "remote I/O error"}, + {122, "EDQUOT", "disk quota exceeded"}, + {123, "ENOMEDIUM", "no medium found"}, + {124, "EMEDIUMTYPE", "wrong medium type"}, + {125, "ECANCELED", "operation canceled"}, + {126, "ENOKEY", "required key not available"}, + {127, "EKEYEXPIRED", "key has expired"}, + {128, "EKEYREVOKED", "key has been revoked"}, + {129, "EKEYREJECTED", "key was rejected by service"}, + {130, "EOWNERDEAD", "owner died"}, + {131, "ENOTRECOVERABLE", "state not recoverable"}, + {132, "ERFKILL", "operation not possible due to RF-kill"}, + {133, "EHWPOISON", "memory page has hardware error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/breakpoint trap"}, + {6, "SIGABRT", "aborted"}, + {7, "SIGBUS", "bus error"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGUSR1", "user defined signal 1"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGUSR2", "user defined signal 2"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGSTKFLT", "stack fault"}, + {17, "SIGCHLD", "child exited"}, + {18, "SIGCONT", "continued"}, + {19, "SIGSTOP", "stopped (signal)"}, + {20, "SIGTSTP", "stopped"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGURG", "urgent I/O condition"}, + {24, "SIGXCPU", "CPU time limit exceeded"}, + {25, "SIGXFSZ", "file size limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window changed"}, + {29, "SIGIO", "I/O possible"}, + {30, "SIGPWR", "power failure"}, + {31, "SIGSYS", "bad system call"}, +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 973ad934..d4264a0f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && linux // +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x4000 ICANON = 0x100 IEXTEN = 0x400 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NL2 = 0x200 NL3 = 0x300 @@ -128,6 +147,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -165,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -192,6 +217,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PROT_SAO = 0x10 PR_SET_PTRACER_ANY = 0xffffffffffffffff @@ -327,6 +353,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -341,6 +368,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 @@ -349,6 +377,7 @@ const ( SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -543,6 +572,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4000 XTABS = 0xc00 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 70a7406b..21cbec1d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64le && linux // +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x4000 ICANON = 0x100 IEXTEN = 0x400 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NL2 = 0x200 NL3 = 0x300 @@ -128,6 +147,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -165,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -192,6 +217,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PROT_SAO = 0x10 PR_SET_PTRACER_ANY = 0xffffffffffffffff @@ -327,6 +353,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -341,6 +368,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 @@ -349,6 +377,7 @@ const ( SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -543,6 +572,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4000 XTABS = 0xc00 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index b1bf7997..9b05bf12 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build riscv64 && linux // +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff RLIMIT_AS = 0x9 @@ -256,6 +282,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -270,6 +297,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -278,6 +306,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -468,6 +497,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 7053d10b..bd82ace0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build s390x && linux // +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -92,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -117,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +145,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -190,6 +215,7 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_DISABLE_TE = 0x5010 @@ -206,6 +232,8 @@ const ( PTRACE_POKE_SYSTEM_CALL = 0x5008 PTRACE_PROT = 0x15 PTRACE_SINGLEBLOCK = 0xc + PTRACE_SYSEMU = 0x1f + PTRACE_SYSEMU_SINGLESTEP = 0x20 PTRACE_TE_ABORT_RAND = 0x5011 PT_ACR0 = 0x90 PT_ACR1 = 0x94 @@ -329,6 +357,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -343,6 +372,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -351,6 +381,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -541,6 +572,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 137cfe79..1f8bded5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -1,6 +1,7 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build sparc64 && linux // +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -62,6 +63,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -96,6 +99,9 @@ const ( F_SETOWN = 0x6 F_UNLCK = 0x3 F_WRLCK = 0x2 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -122,6 +128,19 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -131,6 +150,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x40 O_CLOEXEC = 0x400000 @@ -168,6 +192,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -195,6 +220,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_GETFPAREGS = 0x14 @@ -322,6 +348,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0x400 SO_BUSY_POLL = 0x30 + SO_BUSY_POLL_BUDGET = 0x49 SO_CNX_ADVICE = 0x37 SO_COOKIE = 0x3b SO_DETACH_REUSEPORT_BPF = 0x47 @@ -336,6 +363,7 @@ const ( SO_MARK = 0x22 SO_MAX_PACING_RATE = 0x31 SO_MEMINFO = 0x39 + SO_NETNS_COOKIE = 0x50 SO_NOFCS = 0x27 SO_OOBINLINE = 0x100 SO_PASSCRED = 0x2 @@ -344,6 +372,7 @@ const ( SO_PEERCRED = 0x40 SO_PEERGROUPS = 0x3d SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x48 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x100b @@ -531,6 +560,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 __TIOCFLUSH = 0x80047410 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index 20f3a579..72f7420d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && netbsd // +build 386,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index 90b8fcd2..8d4eb0c0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && netbsd // +build amd64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index c5c03993..9eef9749 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh -marm // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && netbsd // +build arm,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go index 14dd3c1d..3b62ba19 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && netbsd // +build arm64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index c865a10d..6d56edc0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -1019,7 +1020,10 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index 9db6b2fb..25cb6094 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index 7072526a..aef6c085 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -1019,7 +1020,10 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go index ac5efbe5..90de7dfc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go index a74639a4..f1154ff5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && openbsd // +build mips64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go index 5312c36c..1afee6a0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && solaris // +build amd64,solaris // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -365,6 +366,7 @@ const ( HUPCL = 0x400 IBSHIFT = 0x10 ICANON = 0x2 + ICMP6_FILTER = 0x1 ICRNL = 0x100 IEXTEN = 0x8000 IFF_ADDRCONF = 0x80000 @@ -611,6 +613,7 @@ const ( IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 IP_RECVSLLA = 0xa + IP_RECVTOS = 0xc IP_RECVTTL = 0xb IP_RETOPTS = 0x8 IP_REUSEADDR = 0x104 @@ -703,6 +706,7 @@ const ( O_APPEND = 0x8 O_CLOEXEC = 0x800000 O_CREAT = 0x100 + O_DIRECT = 0x2000000 O_DIRECTORY = 0x1000000 O_DSYNC = 0x40 O_EXCL = 0x400 diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go new file mode 100644 index 00000000..fc7d0506 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -0,0 +1,860 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +// Hand edited based on zerrors_linux_s390x.go +// TODO: auto-generate. + +package unix + +const ( + BRKINT = 0x0001 + CLOCK_MONOTONIC = 0x1 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x3 + CS8 = 0x0030 + CSIZE = 0x0030 + ECHO = 0x00000008 + ECHONL = 0x00000001 + FD_CLOEXEC = 0x01 + FD_CLOFORK = 0x02 + FNDELAY = 0x04 + F_CLOSFD = 9 + F_CONTROL_CVT = 13 + F_DUPFD = 0 + F_DUPFD2 = 8 + F_GETFD = 1 + F_GETFL = 259 + F_GETLK = 5 + F_GETOWN = 10 + F_OK = 0x0 + F_RDLCK = 1 + F_SETFD = 2 + F_SETFL = 4 + F_SETLK = 6 + F_SETLKW = 7 + F_SETOWN = 11 + F_SETTAG = 12 + F_UNLCK = 3 + F_WRLCK = 2 + FSTYPE_ZFS = 0xe9 //"Z" + FSTYPE_HFS = 0xc8 //"H" + FSTYPE_NFS = 0xd5 //"N" + FSTYPE_TFS = 0xe3 //"T" + FSTYPE_AUTOMOUNT = 0xc1 //"A" + IP6F_MORE_FRAG = 0x0001 + IP6F_OFF_MASK = 0xfff8 + IP6F_RESERVED_MASK = 0x0006 + IP6OPT_JUMBO = 0xc2 + IP6OPT_JUMBO_LEN = 6 + IP6OPT_MUTABLE = 0x20 + IP6OPT_NSAP_ADDR = 0xc3 + IP6OPT_PAD1 = 0x00 + IP6OPT_PADN = 0x01 + IP6OPT_ROUTER_ALERT = 0x05 + IP6OPT_TUNNEL_LIMIT = 0x04 + IP6OPT_TYPE_DISCARD = 0x40 + IP6OPT_TYPE_FORCEICMP = 0x80 + IP6OPT_TYPE_ICMP = 0xc0 + IP6OPT_TYPE_SKIP = 0x00 + IP6_ALERT_AN = 0x0002 + IP6_ALERT_MLD = 0x0000 + IP6_ALERT_RSVP = 0x0001 + IPPORT_RESERVED = 1024 + IPPORT_USERRESERVED = 5000 + IPPROTO_AH = 51 + SOL_AH = 51 + IPPROTO_DSTOPTS = 60 + SOL_DSTOPTS = 60 + IPPROTO_EGP = 8 + SOL_EGP = 8 + IPPROTO_ESP = 50 + SOL_ESP = 50 + IPPROTO_FRAGMENT = 44 + SOL_FRAGMENT = 44 + IPPROTO_GGP = 2 + SOL_GGP = 2 + IPPROTO_HOPOPTS = 0 + SOL_HOPOPTS = 0 + IPPROTO_ICMP = 1 + SOL_ICMP = 1 + IPPROTO_ICMPV6 = 58 + SOL_ICMPV6 = 58 + IPPROTO_IDP = 22 + SOL_IDP = 22 + IPPROTO_IP = 0 + SOL_IP = 0 + IPPROTO_IPV6 = 41 + SOL_IPV6 = 41 + IPPROTO_MAX = 256 + SOL_MAX = 256 + IPPROTO_NONE = 59 + SOL_NONE = 59 + IPPROTO_PUP = 12 + SOL_PUP = 12 + IPPROTO_RAW = 255 + SOL_RAW = 255 + IPPROTO_ROUTING = 43 + SOL_ROUTING = 43 + IPPROTO_TCP = 6 + SOL_TCP = 6 + IPPROTO_UDP = 17 + SOL_UDP = 17 + IPV6_ADDR_PREFERENCES = 32 + IPV6_CHECKSUM = 19 + IPV6_DONTFRAG = 29 + IPV6_DSTOPTS = 23 + IPV6_HOPLIMIT = 11 + IPV6_HOPOPTS = 22 + IPV6_JOIN_GROUP = 5 + IPV6_LEAVE_GROUP = 6 + IPV6_MULTICAST_HOPS = 9 + IPV6_MULTICAST_IF = 7 + IPV6_MULTICAST_LOOP = 4 + IPV6_NEXTHOP = 20 + IPV6_PATHMTU = 12 + IPV6_PKTINFO = 13 + IPV6_PREFER_SRC_CGA = 0x10 + IPV6_PREFER_SRC_COA = 0x02 + IPV6_PREFER_SRC_HOME = 0x01 + IPV6_PREFER_SRC_NONCGA = 0x20 + IPV6_PREFER_SRC_PUBLIC = 0x08 + IPV6_PREFER_SRC_TMP = 0x04 + IPV6_RECVDSTOPTS = 28 + IPV6_RECVHOPLIMIT = 14 + IPV6_RECVHOPOPTS = 26 + IPV6_RECVPATHMTU = 16 + IPV6_RECVPKTINFO = 15 + IPV6_RECVRTHDR = 25 + IPV6_RECVTCLASS = 31 + IPV6_RTHDR = 21 + IPV6_RTHDRDSTOPTS = 24 + IPV6_RTHDR_TYPE_0 = 0 + IPV6_TCLASS = 30 + IPV6_UNICAST_HOPS = 3 + IPV6_USE_MIN_MTU = 18 + IPV6_V6ONLY = 10 + IP_ADD_MEMBERSHIP = 5 + IP_ADD_SOURCE_MEMBERSHIP = 12 + IP_BLOCK_SOURCE = 10 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DROP_MEMBERSHIP = 6 + IP_DROP_SOURCE_MEMBERSHIP = 13 + IP_MAX_MEMBERSHIPS = 20 + IP_MULTICAST_IF = 7 + IP_MULTICAST_LOOP = 4 + IP_MULTICAST_TTL = 3 + IP_OPTIONS = 1 + IP_PKTINFO = 101 + IP_RECVPKTINFO = 102 + IP_TOS = 2 + IP_TTL = 3 + IP_UNBLOCK_SOURCE = 11 + ICANON = 0x0010 + ICMP6_FILTER = 0x26 + ICRNL = 0x0002 + IEXTEN = 0x0020 + IGNBRK = 0x0004 + IGNCR = 0x0008 + INLCR = 0x0020 + ISIG = 0x0040 + ISTRIP = 0x0080 + IXON = 0x0200 + IXOFF = 0x0100 + LOCK_SH = 0x1 // Not exist on zOS + LOCK_EX = 0x2 // Not exist on zOS + LOCK_NB = 0x4 // Not exist on zOS + LOCK_UN = 0x8 // Not exist on zOS + POLLIN = 0x0003 + POLLOUT = 0x0004 + POLLPRI = 0x0010 + POLLERR = 0x0020 + POLLHUP = 0x0040 + POLLNVAL = 0x0080 + PROT_READ = 0x1 // mmap - page can be read + PROT_WRITE = 0x2 // page can be written + PROT_NONE = 0x4 // can't be accessed + PROT_EXEC = 0x8 // can be executed + MAP_PRIVATE = 0x1 // changes are private + MAP_SHARED = 0x2 // changes are shared + MAP_FIXED = 0x4 // place exactly + MCAST_JOIN_GROUP = 40 + MCAST_LEAVE_GROUP = 41 + MCAST_JOIN_SOURCE_GROUP = 42 + MCAST_LEAVE_SOURCE_GROUP = 43 + MCAST_BLOCK_SOURCE = 44 + MCAST_UNBLOCK_SOURCE = 45 + MS_SYNC = 0x1 // msync - synchronous writes + MS_ASYNC = 0x2 // asynchronous writes + MS_INVALIDATE = 0x4 // invalidate mappings + MTM_RDONLY = 0x80000000 + MTM_RDWR = 0x40000000 + MTM_UMOUNT = 0x10000000 + MTM_IMMED = 0x08000000 + MTM_FORCE = 0x04000000 + MTM_DRAIN = 0x02000000 + MTM_RESET = 0x01000000 + MTM_SAMEMODE = 0x00100000 + MTM_UNQSEFORCE = 0x00040000 + MTM_NOSUID = 0x00000400 + MTM_SYNCHONLY = 0x00000200 + MTM_REMOUNT = 0x00000100 + MTM_NOSECURITY = 0x00000080 + NFDBITS = 0x20 + O_ACCMODE = 0x03 + O_APPEND = 0x08 + O_ASYNCSIG = 0x0200 + O_CREAT = 0x80 + O_EXCL = 0x40 + O_GETFL = 0x0F + O_LARGEFILE = 0x0400 + O_NONBLOCK = 0x04 + O_RDONLY = 0x02 + O_RDWR = 0x03 + O_SYNC = 0x0100 + O_TRUNC = 0x10 + O_WRONLY = 0x01 + O_NOCTTY = 0x20 + OPOST = 0x0001 + ONLCR = 0x0004 + PARENB = 0x0200 + PARMRK = 0x0400 + QUERYCVT = 3 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 // RUSAGE_THREAD unsupported on z/OS + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + SETAUTOCVTALL = 5 + SETAUTOCVTON = 2 + SETCVTALL = 4 + SETCVTOFF = 0 + SETCVTON = 1 + AF_APPLETALK = 16 + AF_CCITT = 10 + AF_CHAOS = 5 + AF_DATAKIT = 9 + AF_DLI = 13 + AF_ECMA = 8 + AF_HYLINK = 15 + AF_IMPLINK = 3 + AF_INET = 2 + AF_INET6 = 19 + AF_INTF = 20 + AF_IUCV = 17 + AF_LAT = 14 + AF_LINK = 18 + AF_MAX = 30 + AF_NBS = 7 + AF_NDD = 23 + AF_NETWARE = 22 + AF_NS = 6 + AF_PUP = 4 + AF_RIF = 21 + AF_ROUTE = 20 + AF_SNA = 11 + AF_UNIX = 1 + AF_UNSPEC = 0 + IBMTCP_IMAGE = 1 + MSG_ACK_EXPECTED = 0x10 + MSG_ACK_GEN = 0x40 + MSG_ACK_TIMEOUT = 0x20 + MSG_CONNTERM = 0x80 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_EOF = 0x8000 + MSG_EOR = 0x8 + MSG_MAXIOVLEN = 16 + MSG_NONBLOCK = 0x4000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + PRIO_PROCESS = 1 + PRIO_PGRP = 2 + PRIO_USER = 3 + RLIMIT_CPU = 0 + RLIMIT_FSIZE = 1 + RLIMIT_DATA = 2 + RLIMIT_STACK = 3 + RLIMIT_CORE = 4 + RLIMIT_AS = 5 + RLIMIT_NOFILE = 6 + RLIMIT_MEMLIMIT = 7 + RLIM_INFINITY = 2147483647 + SCM_RIGHTS = 0x01 + SF_CLOSE = 0x00000002 + SF_REUSE = 0x00000001 + SHUT_RD = 0 + SHUT_RDWR = 2 + SHUT_WR = 1 + SOCK_CONN_DGRAM = 6 + SOCK_DGRAM = 2 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 + SOCK_STREAM = 1 + SOL_SOCKET = 0xffff + SOMAXCONN = 10 + SO_ACCEPTCONN = 0x0002 + SO_ACCEPTECONNABORTED = 0x0006 + SO_ACKNOW = 0x7700 + SO_BROADCAST = 0x0020 + SO_BULKMODE = 0x8000 + SO_CKSUMRECV = 0x0800 + SO_CLOSE = 0x01 + SO_CLUSTERCONNTYPE = 0x00004001 + SO_CLUSTERCONNTYPE_INTERNAL = 8 + SO_CLUSTERCONNTYPE_NOCONN = 0 + SO_CLUSTERCONNTYPE_NONE = 1 + SO_CLUSTERCONNTYPE_SAME_CLUSTER = 2 + SO_CLUSTERCONNTYPE_SAME_IMAGE = 4 + SO_DEBUG = 0x0001 + SO_DONTROUTE = 0x0010 + SO_ERROR = 0x1007 + SO_IGNOREINCOMINGPUSH = 0x1 + SO_IGNORESOURCEVIPA = 0x0002 + SO_KEEPALIVE = 0x0008 + SO_LINGER = 0x0080 + SO_NONBLOCKLOCAL = 0x8001 + SO_NOREUSEADDR = 0x1000 + SO_OOBINLINE = 0x0100 + SO_OPTACK = 0x8004 + SO_OPTMSS = 0x8003 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x0004 + SO_REUSEPORT = 0x0200 + SO_SECINFO = 0x00004002 + SO_SET = 0x0200 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TYPE = 0x1008 + SO_UNSET = 0x0400 + SO_USELOOPBACK = 0x0040 + SO_USE_IFBUFS = 0x0400 + S_ISUID = 0x0800 + S_ISGID = 0x0400 + S_ISVTX = 0x0200 + S_IRUSR = 0x0100 + S_IWUSR = 0x0080 + S_IXUSR = 0x0040 + S_IRWXU = 0x01C0 + S_IRGRP = 0x0020 + S_IWGRP = 0x0010 + S_IXGRP = 0x0008 + S_IRWXG = 0x0038 + S_IROTH = 0x0004 + S_IWOTH = 0x0002 + S_IXOTH = 0x0001 + S_IRWXO = 0x0007 + S_IREAD = S_IRUSR + S_IWRITE = S_IWUSR + S_IEXEC = S_IXUSR + S_IFDIR = 0x01000000 + S_IFCHR = 0x02000000 + S_IFREG = 0x03000000 + S_IFFIFO = 0x04000000 + S_IFIFO = 0x04000000 + S_IFLNK = 0x05000000 + S_IFBLK = 0x06000000 + S_IFSOCK = 0x07000000 + S_IFVMEXTL = 0xFE000000 + S_IFVMEXTL_EXEC = 0x00010000 + S_IFVMEXTL_DATA = 0x00020000 + S_IFVMEXTL_MEL = 0x00030000 + S_IFEXTL = 0x00000001 + S_IFPROGCTL = 0x00000002 + S_IFAPFCTL = 0x00000004 + S_IFNOSHARE = 0x00000008 + S_IFSHARELIB = 0x00000010 + S_IFMT = 0xFF000000 + S_IFMST = 0x00FF0000 + TCP_KEEPALIVE = 0x8 + TCP_NODELAY = 0x1 + TCP_INFO = 0xb + TCP_USER_TIMEOUT = 0x1 + TIOCGWINSZ = 0x4008a368 + TIOCSWINSZ = 0x8008a367 + TIOCSBRK = 0x2000a77b + TIOCCBRK = 0x2000a77a + TIOCSTI = 0x8001a772 + TIOCGPGRP = 0x4004a777 // _IOR(167, 119, int) + TCSANOW = 0 + TCSETS = 0 // equivalent to TCSANOW for tcsetattr + TCSADRAIN = 1 + TCSETSW = 1 // equivalent to TCSADRAIN for tcsetattr + TCSAFLUSH = 2 + TCSETSF = 2 // equivalent to TCSAFLUSH for tcsetattr + TCGETS = 3 // not defined in ioctl.h -- zos golang only + TCIFLUSH = 0 + TCOFLUSH = 1 + TCIOFLUSH = 2 + TCOOFF = 0 + TCOON = 1 + TCIOFF = 2 + TCION = 3 + TIOCSPGRP = 0x8004a776 + TIOCNOTTY = 0x2000a771 + TIOCEXCL = 0x2000a70d + TIOCNXCL = 0x2000a70e + TIOCGETD = 0x4004a700 + TIOCSETD = 0x8004a701 + TIOCPKT = 0x8004a770 + TIOCSTOP = 0x2000a76f + TIOCSTART = 0x2000a76e + TIOCUCNTL = 0x8004a766 + TIOCREMOTE = 0x8004a769 + TIOCMGET = 0x4004a76a + TIOCMSET = 0x8004a76d + TIOCMBIC = 0x8004a76b + TIOCMBIS = 0x8004a76c + VINTR = 0 + VQUIT = 1 + VERASE = 2 + VKILL = 3 + VEOF = 4 + VEOL = 5 + VMIN = 6 + VSTART = 7 + VSTOP = 8 + VSUSP = 9 + VTIME = 10 + WCONTINUED = 0x4 + WNOHANG = 0x1 + WUNTRACED = 0x2 + _BPX_SWAP = 1 + _BPX_NONSWAP = 2 + MCL_CURRENT = 1 // for Linux compatibility -- no zos semantics + MCL_FUTURE = 2 // for Linux compatibility -- no zos semantics + MCL_ONFAULT = 3 // for Linux compatibility -- no zos semantics + MADV_NORMAL = 0 // for Linux compatibility -- no zos semantics + MADV_RANDOM = 1 // for Linux compatibility -- no zos semantics + MADV_SEQUENTIAL = 2 // for Linux compatibility -- no zos semantics + MADV_WILLNEED = 3 // for Linux compatibility -- no zos semantics + MADV_REMOVE = 4 // for Linux compatibility -- no zos semantics + MADV_DONTFORK = 5 // for Linux compatibility -- no zos semantics + MADV_DOFORK = 6 // for Linux compatibility -- no zos semantics + MADV_HWPOISON = 7 // for Linux compatibility -- no zos semantics + MADV_MERGEABLE = 8 // for Linux compatibility -- no zos semantics + MADV_UNMERGEABLE = 9 // for Linux compatibility -- no zos semantics + MADV_SOFT_OFFLINE = 10 // for Linux compatibility -- no zos semantics + MADV_HUGEPAGE = 11 // for Linux compatibility -- no zos semantics + MADV_NOHUGEPAGE = 12 // for Linux compatibility -- no zos semantics + MADV_DONTDUMP = 13 // for Linux compatibility -- no zos semantics + MADV_DODUMP = 14 // for Linux compatibility -- no zos semantics + MADV_FREE = 15 // for Linux compatibility -- no zos semantics + MADV_WIPEONFORK = 16 // for Linux compatibility -- no zos semantics + MADV_KEEPONFORK = 17 // for Linux compatibility -- no zos semantics + AT_SYMLINK_NOFOLLOW = 1 // for Unix compatibility -- no zos semantics + AT_FDCWD = 2 // for Unix compatibility -- no zos semantics +) + +const ( + EDOM = Errno(1) + ERANGE = Errno(2) + EACCES = Errno(111) + EAGAIN = Errno(112) + EBADF = Errno(113) + EBUSY = Errno(114) + ECHILD = Errno(115) + EDEADLK = Errno(116) + EEXIST = Errno(117) + EFAULT = Errno(118) + EFBIG = Errno(119) + EINTR = Errno(120) + EINVAL = Errno(121) + EIO = Errno(122) + EISDIR = Errno(123) + EMFILE = Errno(124) + EMLINK = Errno(125) + ENAMETOOLONG = Errno(126) + ENFILE = Errno(127) + ENODEV = Errno(128) + ENOENT = Errno(129) + ENOEXEC = Errno(130) + ENOLCK = Errno(131) + ENOMEM = Errno(132) + ENOSPC = Errno(133) + ENOSYS = Errno(134) + ENOTDIR = Errno(135) + ENOTEMPTY = Errno(136) + ENOTTY = Errno(137) + ENXIO = Errno(138) + EPERM = Errno(139) + EPIPE = Errno(140) + EROFS = Errno(141) + ESPIPE = Errno(142) + ESRCH = Errno(143) + EXDEV = Errno(144) + E2BIG = Errno(145) + ELOOP = Errno(146) + EILSEQ = Errno(147) + ENODATA = Errno(148) + EOVERFLOW = Errno(149) + EMVSNOTUP = Errno(150) + ECMSSTORAGE = Errno(151) + EMVSDYNALC = Errno(151) + EMVSCVAF = Errno(152) + EMVSCATLG = Errno(153) + ECMSINITIAL = Errno(156) + EMVSINITIAL = Errno(156) + ECMSERR = Errno(157) + EMVSERR = Errno(157) + EMVSPARM = Errno(158) + ECMSPFSFILE = Errno(159) + EMVSPFSFILE = Errno(159) + EMVSBADCHAR = Errno(160) + ECMSPFSPERM = Errno(162) + EMVSPFSPERM = Errno(162) + EMVSSAFEXTRERR = Errno(163) + EMVSSAF2ERR = Errno(164) + EMVSTODNOTSET = Errno(165) + EMVSPATHOPTS = Errno(166) + EMVSNORTL = Errno(167) + EMVSEXPIRE = Errno(168) + EMVSPASSWORD = Errno(169) + EMVSWLMERROR = Errno(170) + EMVSCPLERROR = Errno(171) + EMVSARMERROR = Errno(172) + ELENOFORK = Errno(200) + ELEMSGERR = Errno(201) + EFPMASKINV = Errno(202) + EFPMODEINV = Errno(203) + EBUFLEN = Errno(227) + EEXTLINK = Errno(228) + ENODD = Errno(229) + ECMSESMERR = Errno(230) + ECPERR = Errno(231) + ELEMULTITHREAD = Errno(232) + ELEFENCE = Errno(244) + EBADDATA = Errno(245) + EUNKNOWN = Errno(246) + ENOTSUP = Errno(247) + EBADNAME = Errno(248) + ENOTSAFE = Errno(249) + ELEMULTITHREADFORK = Errno(257) + ECUNNOENV = Errno(258) + ECUNNOCONV = Errno(259) + ECUNNOTALIGNED = Errno(260) + ECUNERR = Errno(262) + EIBMBADCALL = Errno(1000) + EIBMBADPARM = Errno(1001) + EIBMSOCKOUTOFRANGE = Errno(1002) + EIBMSOCKINUSE = Errno(1003) + EIBMIUCVERR = Errno(1004) + EOFFLOADboxERROR = Errno(1005) + EOFFLOADboxRESTART = Errno(1006) + EOFFLOADboxDOWN = Errno(1007) + EIBMCONFLICT = Errno(1008) + EIBMCANCELLED = Errno(1009) + EIBMBADTCPNAME = Errno(1011) + ENOTBLK = Errno(1100) + ETXTBSY = Errno(1101) + EWOULDBLOCK = Errno(1102) + EINPROGRESS = Errno(1103) + EALREADY = Errno(1104) + ENOTSOCK = Errno(1105) + EDESTADDRREQ = Errno(1106) + EMSGSIZE = Errno(1107) + EPROTOTYPE = Errno(1108) + ENOPROTOOPT = Errno(1109) + EPROTONOSUPPORT = Errno(1110) + ESOCKTNOSUPPORT = Errno(1111) + EOPNOTSUPP = Errno(1112) + EPFNOSUPPORT = Errno(1113) + EAFNOSUPPORT = Errno(1114) + EADDRINUSE = Errno(1115) + EADDRNOTAVAIL = Errno(1116) + ENETDOWN = Errno(1117) + ENETUNREACH = Errno(1118) + ENETRESET = Errno(1119) + ECONNABORTED = Errno(1120) + ECONNRESET = Errno(1121) + ENOBUFS = Errno(1122) + EISCONN = Errno(1123) + ENOTCONN = Errno(1124) + ESHUTDOWN = Errno(1125) + ETOOMANYREFS = Errno(1126) + ETIMEDOUT = Errno(1127) + ECONNREFUSED = Errno(1128) + EHOSTDOWN = Errno(1129) + EHOSTUNREACH = Errno(1130) + EPROCLIM = Errno(1131) + EUSERS = Errno(1132) + EDQUOT = Errno(1133) + ESTALE = Errno(1134) + EREMOTE = Errno(1135) + ENOSTR = Errno(1136) + ETIME = Errno(1137) + ENOSR = Errno(1138) + ENOMSG = Errno(1139) + EBADMSG = Errno(1140) + EIDRM = Errno(1141) + ENONET = Errno(1142) + ERREMOTE = Errno(1143) + ENOLINK = Errno(1144) + EADV = Errno(1145) + ESRMNT = Errno(1146) + ECOMM = Errno(1147) + EPROTO = Errno(1148) + EMULTIHOP = Errno(1149) + EDOTDOT = Errno(1150) + EREMCHG = Errno(1151) + ECANCELED = Errno(1152) + EINTRNODATA = Errno(1159) + ENOREUSE = Errno(1160) + ENOMOVE = Errno(1161) +) + +// Signals +const ( + SIGHUP = Signal(1) + SIGINT = Signal(2) + SIGABRT = Signal(3) + SIGILL = Signal(4) + SIGPOLL = Signal(5) + SIGURG = Signal(6) + SIGSTOP = Signal(7) + SIGFPE = Signal(8) + SIGKILL = Signal(9) + SIGBUS = Signal(10) + SIGSEGV = Signal(11) + SIGSYS = Signal(12) + SIGPIPE = Signal(13) + SIGALRM = Signal(14) + SIGTERM = Signal(15) + SIGUSR1 = Signal(16) + SIGUSR2 = Signal(17) + SIGABND = Signal(18) + SIGCONT = Signal(19) + SIGCHLD = Signal(20) + SIGTTIN = Signal(21) + SIGTTOU = Signal(22) + SIGIO = Signal(23) + SIGQUIT = Signal(24) + SIGTSTP = Signal(25) + SIGTRAP = Signal(26) + SIGIOERR = Signal(27) + SIGWINCH = Signal(28) + SIGXCPU = Signal(29) + SIGXFSZ = Signal(30) + SIGVTALRM = Signal(31) + SIGPROF = Signal(32) + SIGDANGER = Signal(33) + SIGTHSTOP = Signal(34) + SIGTHCONT = Signal(35) + SIGTRACE = Signal(37) + SIGDCE = Signal(38) + SIGDUMP = Signal(39) +) + +// Error table +var errorList = [...]struct { + num Errno + name string + desc string +}{ + {1, "EDC5001I", "A domain error occurred."}, + {2, "EDC5002I", "A range error occurred."}, + {111, "EDC5111I", "Permission denied."}, + {112, "EDC5112I", "Resource temporarily unavailable."}, + {113, "EDC5113I", "Bad file descriptor."}, + {114, "EDC5114I", "Resource busy."}, + {115, "EDC5115I", "No child processes."}, + {116, "EDC5116I", "Resource deadlock avoided."}, + {117, "EDC5117I", "File exists."}, + {118, "EDC5118I", "Incorrect address."}, + {119, "EDC5119I", "File too large."}, + {120, "EDC5120I", "Interrupted function call."}, + {121, "EDC5121I", "Invalid argument."}, + {122, "EDC5122I", "Input/output error."}, + {123, "EDC5123I", "Is a directory."}, + {124, "EDC5124I", "Too many open files."}, + {125, "EDC5125I", "Too many links."}, + {126, "EDC5126I", "Filename too long."}, + {127, "EDC5127I", "Too many open files in system."}, + {128, "EDC5128I", "No such device."}, + {129, "EDC5129I", "No such file or directory."}, + {130, "EDC5130I", "Exec format error."}, + {131, "EDC5131I", "No locks available."}, + {132, "EDC5132I", "Not enough memory."}, + {133, "EDC5133I", "No space left on device."}, + {134, "EDC5134I", "Function not implemented."}, + {135, "EDC5135I", "Not a directory."}, + {136, "EDC5136I", "Directory not empty."}, + {137, "EDC5137I", "Inappropriate I/O control operation."}, + {138, "EDC5138I", "No such device or address."}, + {139, "EDC5139I", "Operation not permitted."}, + {140, "EDC5140I", "Broken pipe."}, + {141, "EDC5141I", "Read-only file system."}, + {142, "EDC5142I", "Invalid seek."}, + {143, "EDC5143I", "No such process."}, + {144, "EDC5144I", "Improper link."}, + {145, "EDC5145I", "The parameter list is too long, or the message to receive was too large for the buffer."}, + {146, "EDC5146I", "Too many levels of symbolic links."}, + {147, "EDC5147I", "Illegal byte sequence."}, + {148, "", ""}, + {149, "EDC5149I", "Value Overflow Error."}, + {150, "EDC5150I", "UNIX System Services is not active."}, + {151, "EDC5151I", "Dynamic allocation error."}, + {152, "EDC5152I", "Common VTOC access facility (CVAF) error."}, + {153, "EDC5153I", "Catalog obtain error."}, + {156, "EDC5156I", "Process initialization error."}, + {157, "EDC5157I", "An internal error has occurred."}, + {158, "EDC5158I", "Bad parameters were passed to the service."}, + {159, "EDC5159I", "The Physical File System encountered a permanent file error."}, + {160, "EDC5160I", "Bad character in environment variable name."}, + {162, "EDC5162I", "The Physical File System encountered a system error."}, + {163, "EDC5163I", "SAF/RACF extract error."}, + {164, "EDC5164I", "SAF/RACF error."}, + {165, "EDC5165I", "System TOD clock not set."}, + {166, "EDC5166I", "Access mode argument on function call conflicts with PATHOPTS parameter on JCL DD statement."}, + {167, "EDC5167I", "Access to the UNIX System Services version of the C RTL is denied."}, + {168, "EDC5168I", "Password has expired."}, + {169, "EDC5169I", "Password is invalid."}, + {170, "EDC5170I", "An error was encountered with WLM."}, + {171, "EDC5171I", "An error was encountered with CPL."}, + {172, "EDC5172I", "An error was encountered with Application Response Measurement (ARM) component."}, + {200, "EDC5200I", "The application contains a Language Environment member language that cannot tolerate a fork()."}, + {201, "EDC5201I", "The Language Environment message file was not found in the hierarchical file system."}, + {202, "EDC5202E", "DLL facilities are not supported under SPC environment."}, + {203, "EDC5203E", "DLL facilities are not supported under POSIX environment."}, + {227, "EDC5227I", "Buffer is not long enough to contain a path definition"}, + {228, "EDC5228I", "The file referred to is an external link"}, + {229, "EDC5229I", "No path definition for ddname in effect"}, + {230, "EDC5230I", "ESM error."}, + {231, "EDC5231I", "CP or the external security manager had an error"}, + {232, "EDC5232I", "The function failed because it was invoked from a multithread environment."}, + {244, "EDC5244I", "The program, module or DLL is not supported in this environment."}, + {245, "EDC5245I", "Data is not valid."}, + {246, "EDC5246I", "Unknown system state."}, + {247, "EDC5247I", "Operation not supported."}, + {248, "EDC5248I", "The object name specified is not correct."}, + {249, "EDC5249I", "The function is not allowed."}, + {257, "EDC5257I", "Function cannot be called in the child process of a fork() from a multithreaded process until exec() is called."}, + {258, "EDC5258I", "A CUN_RS_NO_UNI_ENV error was issued by Unicode Services."}, + {259, "EDC5259I", "A CUN_RS_NO_CONVERSION error was issued by Unicode Services."}, + {260, "EDC5260I", "A CUN_RS_TABLE_NOT_ALIGNED error was issued by Unicode Services."}, + {262, "EDC5262I", "An iconv() function encountered an unexpected error while using Unicode Services."}, + {1000, "EDC8000I", "A bad socket-call constant was found in the IUCV header."}, + {1001, "EDC8001I", "An error was found in the IUCV header."}, + {1002, "EDC8002I", "A socket descriptor is out of range."}, + {1003, "EDC8003I", "A socket descriptor is in use."}, + {1004, "EDC8004I", "Request failed because of an IUCV error."}, + {1005, "EDC8005I", "Offload box error."}, + {1006, "EDC8006I", "Offload box restarted."}, + {1007, "EDC8007I", "Offload box down."}, + {1008, "EDC8008I", "Already a conflicting call outstanding on socket."}, + {1009, "EDC8009I", "Request cancelled using a SOCKcallCANCEL request."}, + {1011, "EDC8011I", "A name of a PFS was specified that either is not configured or is not a Sockets PFS."}, + {1100, "EDC8100I", "Block device required."}, + {1101, "EDC8101I", "Text file busy."}, + {1102, "EDC8102I", "Operation would block."}, + {1103, "EDC8103I", "Operation now in progress."}, + {1104, "EDC8104I", "Connection already in progress."}, + {1105, "EDC8105I", "Socket operation on non-socket."}, + {1106, "EDC8106I", "Destination address required."}, + {1107, "EDC8107I", "Message too long."}, + {1108, "EDC8108I", "Protocol wrong type for socket."}, + {1109, "EDC8109I", "Protocol not available."}, + {1110, "EDC8110I", "Protocol not supported."}, + {1111, "EDC8111I", "Socket type not supported."}, + {1112, "EDC8112I", "Operation not supported on socket."}, + {1113, "EDC8113I", "Protocol family not supported."}, + {1114, "EDC8114I", "Address family not supported."}, + {1115, "EDC8115I", "Address already in use."}, + {1116, "EDC8116I", "Address not available."}, + {1117, "EDC8117I", "Network is down."}, + {1118, "EDC8118I", "Network is unreachable."}, + {1119, "EDC8119I", "Network dropped connection on reset."}, + {1120, "EDC8120I", "Connection ended abnormally."}, + {1121, "EDC8121I", "Connection reset."}, + {1122, "EDC8122I", "No buffer space available."}, + {1123, "EDC8123I", "Socket already connected."}, + {1124, "EDC8124I", "Socket not connected."}, + {1125, "EDC8125I", "Can't send after socket shutdown."}, + {1126, "EDC8126I", "Too many references; can't splice."}, + {1127, "EDC8127I", "Connection timed out."}, + {1128, "EDC8128I", "Connection refused."}, + {1129, "EDC8129I", "Host is not available."}, + {1130, "EDC8130I", "Host cannot be reached."}, + {1131, "EDC8131I", "Too many processes."}, + {1132, "EDC8132I", "Too many users."}, + {1133, "EDC8133I", "Disk quota exceeded."}, + {1134, "EDC8134I", "Stale file handle."}, + {1135, "", ""}, + {1136, "EDC8136I", "File is not a STREAM."}, + {1137, "EDC8137I", "STREAMS ioctl() timeout."}, + {1138, "EDC8138I", "No STREAMS resources."}, + {1139, "EDC8139I", "The message identified by set_id and msg_id is not in the message catalog."}, + {1140, "EDC8140I", "Bad message."}, + {1141, "EDC8141I", "Identifier removed."}, + {1142, "", ""}, + {1143, "", ""}, + {1144, "EDC8144I", "The link has been severed."}, + {1145, "", ""}, + {1146, "", ""}, + {1147, "", ""}, + {1148, "EDC8148I", "Protocol error."}, + {1149, "EDC8149I", "Multihop not allowed."}, + {1150, "", ""}, + {1151, "", ""}, + {1152, "EDC8152I", "The asynchronous I/O request has been canceled."}, + {1159, "EDC8159I", "Function call was interrupted before any data was received."}, + {1160, "EDC8160I", "Socket reuse is not supported."}, + {1161, "EDC8161I", "The file system cannot currently be moved."}, +} + +// Signal table +var signalList = [...]struct { + num Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGABT", "aborted"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGPOLL", "pollable event"}, + {6, "SIGURG", "urgent I/O condition"}, + {7, "SIGSTOP", "stop process"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad argument to routine"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGUSR1", "user defined signal 1"}, + {17, "SIGUSR2", "user defined signal 2"}, + {18, "SIGABND", "abend"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGQUIT", "quit"}, + {25, "SIGTSTP", "stopped"}, + {26, "SIGTRAP", "trace/breakpoint trap"}, + {27, "SIGIOER", "I/O error"}, + {28, "SIGWINCH", "window changed"}, + {29, "SIGXCPU", "CPU time limit exceeded"}, + {30, "SIGXFSZ", "file size limit exceeded"}, + {31, "SIGVTALRM", "virtual timer expired"}, + {32, "SIGPROF", "profiling timer expired"}, + {33, "SIGDANGER", "danger"}, + {34, "SIGTHSTOP", "stop thread"}, + {35, "SIGTHCONT", "continue thread"}, + {37, "SIGTRACE", "trace"}, + {38, "", "DCE"}, + {39, "SIGDUMP", "dump"}, +} diff --git a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go index 89c5920e..bd001a6e 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. +//go:build linux && (arm || arm64) // +build linux // +build arm arm64 diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go index 24b841ee..c34d0639 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT. +//go:build linux && (mips || mips64) // +build linux // +build mips mips64 diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go index 47b04895..3ccf0c0c 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT. +//go:build linux && (mipsle || mips64le) // +build linux // +build mipsle mips64le diff --git a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go index ea5d9cb5..7d658570 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT. +//go:build linux && (386 || amd64) // +build linux // +build 386 amd64 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index ed657ff1..91a23cc7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -1,6 +1,7 @@ // go run mksyscall_aix_ppc.go -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build aix && ppc // +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 664b293b..33c2609b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -1,6 +1,7 @@ // go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build aix && ppc64 // +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index 0550da06..8b737fa9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -1,8 +1,8 @@ // go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build aix,ppc64 -// +build gc +//go:build aix && ppc64 && gc +// +build aix,ppc64,gc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index cde4dbc5..3c260917 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -1,8 +1,8 @@ // go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build aix,ppc64 -// +build gccgo +//go:build aix && ppc64 && gccgo +// +build aix,ppc64,gccgo package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go deleted file mode 100644 index c8c142c5..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go +++ /dev/null @@ -1,39 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,go1.13 syscall_darwin.1_13.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,go1.13 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_closedir_trampoline() - -//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - res = Errno(r0) - return -} - -func libc_readdir_r_trampoline() - -//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s deleted file mode 100644 index 00da1ebf..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s +++ /dev/null @@ -1,12 +0,0 @@ -// go run mkasm_darwin.go 386 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.13 - -#include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readdir_r(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go deleted file mode 100644 index 38771834..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ /dev/null @@ -1,2430 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getgroups_trampoline() - -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgroups_trampoline() - -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_wait4_trampoline() - -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_accept_trampoline() - -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_bind_trampoline() - -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_connect_trampoline() - -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socket_trampoline() - -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockopt_trampoline() - -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsockopt_trampoline() - -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpeername_trampoline() - -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockname_trampoline() - -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_shutdown_trampoline() - -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socketpair_trampoline() - -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvfrom_trampoline() - -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendto_trampoline() - -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvmsg_trampoline() - -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendmsg_trampoline() - -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kevent_trampoline() - -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_utimes_trampoline() - -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_futimes_trampoline() - -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_poll_trampoline() - -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_madvise_trampoline() - -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlock_trampoline() - -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlockall_trampoline() - -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mprotect_trampoline() - -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_msync_trampoline() - -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlock_trampoline() - -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlockall_trampoline() - -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pipe_trampoline() - -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getxattr_trampoline() - -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fgetxattr_trampoline() - -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setxattr_trampoline() - -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsetxattr_trampoline() - -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_removexattr_trampoline() - -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fremovexattr_trampoline() - -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listxattr_trampoline() - -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flistxattr_trampoline() - -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fcntl_trampoline() - -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kill_trampoline() - -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ioctl_trampoline() - -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sysctl_trampoline() - -//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_access_trampoline() - -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_adjtime_trampoline() - -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chdir_trampoline() - -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chflags_trampoline() - -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chmod_trampoline() - -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chown_trampoline() - -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chroot_trampoline() - -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clock_gettime_trampoline() - -//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_close_trampoline() - -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Clonefile(src string, dst string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(src) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(dst) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clonefile_trampoline() - -//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(src) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(dst) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clonefileat_trampoline() - -//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup_trampoline() - -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup2_trampoline() - -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_exchangedata_trampoline() - -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) - return -} - -func libc_exit_trampoline() - -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_faccessat_trampoline() - -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchdir_trampoline() - -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchflags_trampoline() - -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmod_trampoline() - -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmodat_trampoline() - -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchown_trampoline() - -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchownat_trampoline() - -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(dst) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fclonefileat_trampoline() - -//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flock_trampoline() - -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fpathconf_trampoline() - -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsync_trampoline() - -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ftruncate_trampoline() - -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getcwd_trampoline() - -//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) - size = int(r0) - return -} - -func libc_getdtablesize_trampoline() - -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) - egid = int(r0) - return -} - -func libc_getegid_trampoline() - -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_geteuid_trampoline() - -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) - gid = int(r0) - return -} - -func libc_getgid_trampoline() - -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpgid_trampoline() - -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) - pgrp = int(r0) - return -} - -func libc_getpgrp_trampoline() - -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) - pid = int(r0) - return -} - -func libc_getpid_trampoline() - -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) - ppid = int(r0) - return -} - -func libc_getppid_trampoline() - -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpriority_trampoline() - -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrlimit_trampoline() - -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrusage_trampoline() - -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsid_trampoline() - -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_gettimeofday_trampoline() - -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_getuid_trampoline() - -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -func libc_issetugid_trampoline() - -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kqueue_trampoline() - -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lchown_trampoline() - -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_link_trampoline() - -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_linkat_trampoline() - -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listen_trampoline() - -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdir_trampoline() - -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdirat_trampoline() - -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkfifo_trampoline() - -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mknod_trampoline() - -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_open_trampoline() - -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_openat_trampoline() - -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pathconf_trampoline() - -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pread_trampoline() - -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pwrite_trampoline() - -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_read_trampoline() - -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlink_trampoline() - -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlinkat_trampoline() - -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rename_trampoline() - -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_renameat_trampoline() - -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_revoke_trampoline() - -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rmdir_trampoline() - -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := syscall_syscall6(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lseek_trampoline() - -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_select_trampoline() - -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setegid_trampoline() - -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_seteuid_trampoline() - -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgid_trampoline() - -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setlogin_trampoline() - -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpgid_trampoline() - -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpriority_trampoline() - -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setprivexec_trampoline() - -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setregid_trampoline() - -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setreuid_trampoline() - -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setrlimit_trampoline() - -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsid_trampoline() - -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_settimeofday_trampoline() - -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setuid_trampoline() - -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlink_trampoline() - -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlinkat_trampoline() - -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sync_trampoline() - -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_truncate_trampoline() - -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -func libc_umask_trampoline() - -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_undelete_trampoline() - -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlink_trampoline() - -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlinkat_trampoline() - -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unmount_trampoline() - -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_write_trampoline() - -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mmap_trampoline() - -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munmap_trampoline() - -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat64_trampoline() - -//go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat64_trampoline() - -//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs64_trampoline() - -//go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat64_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat64_trampoline() - -//go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat64_trampoline() - -//go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ptrace_trampoline() - -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat64_trampoline() - -//go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs64_trampoline() - -//go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s deleted file mode 100644 index 1c53979a..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s +++ /dev/null @@ -1,290 +0,0 @@ -// go run mkasm_darwin.go 386 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clonefile(SB) -TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clonefileat(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fclonefileat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getcwd(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs64(SB) -TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat64(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat64(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs64(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go index 88826236..a06eb093 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,amd64,go1.13 syscall_darwin.1_13.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && amd64 && go1.13 // +build darwin,amd64,go1.13 package unix @@ -15,25 +16,25 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) + _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_closedir_trampoline() +var libc_closedir_trampoline_addr uintptr //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) res = Errno(r0) return } -func libc_readdir_r_trampoline() +var libc_readdir_r_trampoline_addr uintptr //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s index d671e831..d6c3e25c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s @@ -1,12 +1,25 @@ // go run mkasm_darwin.go amd64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.13 // +build go1.13 #include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) + +TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) + +TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) + +GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 508e5639..0ae0ed4c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,amd64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && amd64 && go1.12 // +build darwin,amd64,go1.12 package unix @@ -15,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,28 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() +var libc_getgroups_trampoline_addr uintptr //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() +var libc_setgroups_trampoline_addr uintptr //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -52,14 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() +var libc_wait4_trampoline_addr uintptr //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -67,42 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() +var libc_accept_trampoline_addr uintptr //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() +var libc_bind_trampoline_addr uintptr //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() +var libc_connect_trampoline_addr uintptr //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -110,91 +111,91 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() +var libc_socket_trampoline_addr uintptr //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() +var libc_getsockopt_trampoline_addr uintptr //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() +var libc_setsockopt_trampoline_addr uintptr //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() +var libc_getpeername_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() +var libc_getsockname_trampoline_addr uintptr //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() +var libc_shutdown_trampoline_addr uintptr //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() +var libc_socketpair_trampoline_addr uintptr //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" @@ -207,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -215,7 +216,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() +var libc_recvfrom_trampoline_addr uintptr //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" @@ -228,21 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() +var libc_sendto_trampoline_addr uintptr //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -250,14 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() +var libc_recvmsg_trampoline_addr uintptr //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,14 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() +var libc_sendmsg_trampoline_addr uintptr //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -280,7 +281,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() +var libc_kevent_trampoline_addr uintptr //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" @@ -292,35 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() +var libc_utimes_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() +var libc_futimes_trampoline_addr uintptr //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -328,7 +329,7 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() +var libc_poll_trampoline_addr uintptr //go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" @@ -341,14 +342,14 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() +var libc_madvise_trampoline_addr uintptr //go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" @@ -361,28 +362,28 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() +var libc_mlock_trampoline_addr uintptr //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() +var libc_mlockall_trampoline_addr uintptr //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" @@ -395,14 +396,14 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() +var libc_mprotect_trampoline_addr uintptr //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" @@ -415,14 +416,14 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() +var libc_msync_trampoline_addr uintptr //go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" @@ -435,42 +436,42 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() +var libc_munlock_trampoline_addr uintptr //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() +var libc_munlockall_trampoline_addr uintptr //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_pipe_trampoline_addr, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_pipe_trampoline() +var libc_pipe_trampoline_addr uintptr //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" @@ -487,7 +488,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_getxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -495,7 +496,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() +var libc_getxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" @@ -507,7 +508,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_fgetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -515,7 +516,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() +var libc_fgetxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" @@ -532,14 +533,14 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_setxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() +var libc_setxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" @@ -551,14 +552,14 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_fsetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() +var libc_fsetxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" @@ -575,14 +576,14 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_removexattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() +var libc_removexattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" @@ -594,14 +595,14 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_fremovexattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() +var libc_fremovexattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" @@ -613,7 +614,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_listxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -621,14 +622,14 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() +var libc_listxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_flistxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -636,28 +637,28 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() +var libc_flistxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setattrlist_trampoline() +var libc_setattrlist_trampoline_addr uintptr //go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -665,35 +666,35 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() +var libc_fcntl_trampoline_addr uintptr //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() +var libc_kill_trampoline_addr uintptr //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() +var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" @@ -706,61 +707,120 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sysctl_trampoline() +var libc_sysctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) + _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendfile_trampoline() +var libc_sendfile_trampoline_addr uintptr //go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() +var libc_access_trampoline_addr uintptr //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() +var libc_adjtime_trampoline_addr uintptr //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" @@ -772,14 +832,14 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() +var libc_chdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" @@ -791,14 +851,14 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() +var libc_chflags_trampoline_addr uintptr //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" @@ -810,14 +870,14 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() +var libc_chmod_trampoline_addr uintptr //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" @@ -829,14 +889,14 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() +var libc_chown_trampoline_addr uintptr //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" @@ -848,42 +908,42 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() +var libc_chroot_trampoline_addr uintptr //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clock_gettime_trampoline() +var libc_clock_gettime_trampoline_addr uintptr //go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() +var libc_close_trampoline_addr uintptr //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" @@ -900,14 +960,14 @@ func Clonefile(src string, dst string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_clonefile_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clonefile_trampoline() +var libc_clonefile_trampoline_addr uintptr //go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" @@ -924,21 +984,21 @@ func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_clonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clonefileat_trampoline() +var libc_clonefileat_trampoline_addr uintptr //go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -946,21 +1006,21 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() +var libc_dup_trampoline_addr uintptr //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() +var libc_dup2_trampoline_addr uintptr //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" @@ -977,25 +1037,25 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_exchangedata_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() +var libc_exchangedata_trampoline_addr uintptr //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } -func libc_exit_trampoline() +var libc_exit_trampoline_addr uintptr //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" @@ -1007,56 +1067,56 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() +var libc_faccessat_trampoline_addr uintptr //go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() +var libc_fchdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() +var libc_fchflags_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() +var libc_fchmod_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" @@ -1068,28 +1128,28 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() +var libc_fchmodat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() +var libc_fchown_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" @@ -1101,14 +1161,14 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() +var libc_fchownat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" @@ -1120,35 +1180,35 @@ func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fclonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fclonefileat_trampoline() +var libc_fclonefileat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() +var libc_flock_trampoline_addr uintptr //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1156,35 +1216,35 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +var libc_fpathconf_trampoline_addr uintptr //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() +var libc_fsync_trampoline_addr uintptr //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +var libc_ftruncate_trampoline_addr uintptr //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" @@ -1197,7 +1257,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1205,62 +1265,62 @@ func Getcwd(buf []byte) (n int, err error) { return } -func libc_getcwd_trampoline() +var libc_getcwd_trampoline_addr uintptr //go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := syscall_syscall(libc_getdtablesize_trampoline_addr, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() +var libc_getdtablesize_trampoline_addr uintptr //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() +var libc_getegid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() +var libc_geteuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() +var libc_getgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,50 +1328,50 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() +var libc_getpgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() +var libc_getpgrp_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() +var libc_getpid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() +var libc_getppid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1319,42 +1379,42 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() +var libc_getpriority_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() +var libc_getrlimit_trampoline_addr uintptr //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() +var libc_getrusage_trampoline_addr uintptr //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1362,52 +1422,52 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() +var libc_getsid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_gettimeofday_trampoline() +var libc_gettimeofday_trampoline_addr uintptr //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() +var libc_getuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() +var libc_issetugid_trampoline_addr uintptr //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1415,7 +1475,7 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() +var libc_kqueue_trampoline_addr uintptr //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" @@ -1427,14 +1487,14 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() +var libc_lchown_trampoline_addr uintptr //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" @@ -1451,14 +1511,14 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() +var libc_link_trampoline_addr uintptr //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" @@ -1475,28 +1535,28 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() +var libc_linkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +var libc_listen_trampoline_addr uintptr //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" @@ -1508,14 +1568,14 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() +var libc_mkdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" @@ -1527,14 +1587,14 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() +var libc_mkdirat_trampoline_addr uintptr //go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" @@ -1546,14 +1606,14 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() +var libc_mkfifo_trampoline_addr uintptr //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" @@ -1565,14 +1625,14 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() +var libc_mknod_trampoline_addr uintptr //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" @@ -1584,7 +1644,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1592,7 +1652,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() +var libc_open_trampoline_addr uintptr //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" @@ -1604,7 +1664,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1612,7 +1672,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() +var libc_openat_trampoline_addr uintptr //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" @@ -1624,7 +1684,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1632,7 +1692,7 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() +var libc_pathconf_trampoline_addr uintptr //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" @@ -1645,7 +1705,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1653,7 +1713,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() +var libc_pread_trampoline_addr uintptr //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" @@ -1666,7 +1726,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1674,7 +1734,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() +var libc_pwrite_trampoline_addr uintptr //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" @@ -1687,7 +1747,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1695,7 +1755,7 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() +var libc_read_trampoline_addr uintptr //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" @@ -1713,7 +1773,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1721,7 +1781,7 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() +var libc_readlink_trampoline_addr uintptr //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" @@ -1739,7 +1799,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1747,7 +1807,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() +var libc_readlinkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" @@ -1764,14 +1824,14 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() +var libc_rename_trampoline_addr uintptr //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" @@ -1788,14 +1848,14 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() +var libc_renameat_trampoline_addr uintptr //go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" @@ -1807,14 +1867,14 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() +var libc_revoke_trampoline_addr uintptr //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" @@ -1826,21 +1886,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() +var libc_rmdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1848,14 +1908,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() +var libc_lseek_trampoline_addr uintptr //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1863,49 +1923,49 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } -func libc_select_trampoline() +var libc_select_trampoline_addr uintptr //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() +var libc_setegid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() +var libc_seteuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() +var libc_setgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" @@ -1917,105 +1977,105 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() +var libc_setlogin_trampoline_addr uintptr //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() +var libc_setpgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() +var libc_setpriority_trampoline_addr uintptr //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := syscall_syscall(libc_setprivexec_trampoline_addr, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() +var libc_setprivexec_trampoline_addr uintptr //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() +var libc_setregid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() +var libc_setreuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() +var libc_setrlimit_trampoline_addr uintptr //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2023,35 +2083,35 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() +var libc_setsid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() +var libc_settimeofday_trampoline_addr uintptr //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +var libc_setuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" @@ -2068,14 +2128,14 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() +var libc_symlink_trampoline_addr uintptr //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" @@ -2092,28 +2152,28 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() +var libc_symlinkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() +var libc_sync_trampoline_addr uintptr //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" @@ -2125,26 +2185,26 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() +var libc_truncate_trampoline_addr uintptr //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() +var libc_umask_trampoline_addr uintptr //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" @@ -2156,14 +2216,14 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_undelete_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() +var libc_undelete_trampoline_addr uintptr //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" @@ -2175,14 +2235,14 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() +var libc_unlink_trampoline_addr uintptr //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" @@ -2194,14 +2254,14 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() +var libc_unlinkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" @@ -2213,14 +2273,14 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() +var libc_unmount_trampoline_addr uintptr //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" @@ -2233,7 +2293,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2241,14 +2301,14 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() +var libc_write_trampoline_addr uintptr //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2256,28 +2316,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() +var libc_mmap_trampoline_addr uintptr //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() +var libc_munmap_trampoline_addr uintptr //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2288,7 +2348,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2299,14 +2359,14 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstat64_trampoline() +var libc_fstat64_trampoline_addr uintptr //go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" @@ -2318,35 +2378,35 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatat64_trampoline() +var libc_fstatat64_trampoline_addr uintptr //go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatfs64_trampoline() +var libc_fstatfs64_trampoline_addr uintptr //go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat64_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_getfsstat64_trampoline_addr, uintptr(buf), uintptr(size), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2354,7 +2414,7 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { return } -func libc_getfsstat64_trampoline() +var libc_getfsstat64_trampoline_addr uintptr //go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib" @@ -2366,28 +2426,28 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lstat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat64_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lstat64_trampoline() +var libc_lstat64_trampoline_addr uintptr //go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ptrace_trampoline() +var libc_ptrace_trampoline_addr uintptr //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" @@ -2399,14 +2459,14 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_stat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat64_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_stat64_trampoline() +var libc_stat64_trampoline_addr uintptr //go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" @@ -2418,13 +2478,13 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_statfs64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs64_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_statfs64_trampoline() +var libc_statfs64_trampoline_addr uintptr //go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index c77bd6e2..eac6ca80 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -1,290 +1,883 @@ // go run mkasm_darwin.go amd64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.12 // +build go1.12 #include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB) + +TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB) + +TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB) + +TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB) + +TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB) + +TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB) + +TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB) + +TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB) + +TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB) + +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) + +TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmat(SB) + +GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) + +TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmctl(SB) + +GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) + +TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmdt(SB) + +GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) + +TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmget(SB) + +GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefile(SB) -TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB) + +TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefileat(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) -TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fclonefileat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8 +DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_fstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat64_trampoline_addr(SB)/8, $libc_fstat64_trampoline<>(SB) + +TEXT libc_fstatat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat64_trampoline_addr(SB)/8, $libc_fstatat64_trampoline<>(SB) + +TEXT libc_fstatfs64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatfs64(SB) -TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatfs64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs64_trampoline_addr(SB)/8, $libc_fstatfs64_trampoline<>(SB) + +TEXT libc_getfsstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getfsstat64(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getfsstat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat64_trampoline_addr(SB)/8, $libc_getfsstat64_trampoline<>(SB) + +TEXT libc_lstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lstat64(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lstat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat64_trampoline_addr(SB)/8, $libc_lstat64_trampoline<>(SB) + +TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB) + +TEXT libc_stat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_stat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat64_trampoline_addr(SB)/8, $libc_stat64_trampoline<>(SB) + +TEXT libc_statfs64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_statfs64(SB) + +GLOBL ·libc_statfs64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs64_trampoline_addr(SB)/8, $libc_statfs64_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go deleted file mode 100644 index de4738ff..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go +++ /dev/null @@ -1,39 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,go1.13 syscall_darwin.1_13.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,go1.13 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_closedir_trampoline() - -//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - res = Errno(r0) - return -} - -func libc_readdir_r_trampoline() - -//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s deleted file mode 100644 index 488e5570..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s +++ /dev/null @@ -1,12 +0,0 @@ -// go run mkasm_darwin.go arm -// Code generated by the command above; DO NOT EDIT. - -// +build go1.13 - -#include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readdir_r(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go deleted file mode 100644 index c0c771f4..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ /dev/null @@ -1,2416 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getgroups_trampoline() - -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgroups_trampoline() - -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_wait4_trampoline() - -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_accept_trampoline() - -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_bind_trampoline() - -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_connect_trampoline() - -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socket_trampoline() - -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockopt_trampoline() - -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsockopt_trampoline() - -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpeername_trampoline() - -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockname_trampoline() - -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_shutdown_trampoline() - -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socketpair_trampoline() - -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvfrom_trampoline() - -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendto_trampoline() - -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvmsg_trampoline() - -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendmsg_trampoline() - -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kevent_trampoline() - -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_utimes_trampoline() - -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_futimes_trampoline() - -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_poll_trampoline() - -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_madvise_trampoline() - -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlock_trampoline() - -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlockall_trampoline() - -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mprotect_trampoline() - -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_msync_trampoline() - -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlock_trampoline() - -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlockall_trampoline() - -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pipe_trampoline() - -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getxattr_trampoline() - -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fgetxattr_trampoline() - -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setxattr_trampoline() - -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsetxattr_trampoline() - -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_removexattr_trampoline() - -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fremovexattr_trampoline() - -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listxattr_trampoline() - -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flistxattr_trampoline() - -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fcntl_trampoline() - -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kill_trampoline() - -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ioctl_trampoline() - -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sysctl_trampoline() - -//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_access_trampoline() - -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_adjtime_trampoline() - -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chdir_trampoline() - -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chflags_trampoline() - -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chmod_trampoline() - -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chown_trampoline() - -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chroot_trampoline() - -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clock_gettime_trampoline() - -//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_close_trampoline() - -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Clonefile(src string, dst string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(src) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(dst) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clonefile_trampoline() - -//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(src) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(dst) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clonefileat_trampoline() - -//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup_trampoline() - -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup2_trampoline() - -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_exchangedata_trampoline() - -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) - return -} - -func libc_exit_trampoline() - -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_faccessat_trampoline() - -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchdir_trampoline() - -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchflags_trampoline() - -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmod_trampoline() - -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmodat_trampoline() - -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchown_trampoline() - -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchownat_trampoline() - -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(dst) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fclonefileat_trampoline() - -//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flock_trampoline() - -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fpathconf_trampoline() - -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsync_trampoline() - -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ftruncate_trampoline() - -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getcwd(buf []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getcwd_trampoline() - -//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) - size = int(r0) - return -} - -func libc_getdtablesize_trampoline() - -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) - egid = int(r0) - return -} - -func libc_getegid_trampoline() - -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_geteuid_trampoline() - -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) - gid = int(r0) - return -} - -func libc_getgid_trampoline() - -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpgid_trampoline() - -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) - pgrp = int(r0) - return -} - -func libc_getpgrp_trampoline() - -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) - pid = int(r0) - return -} - -func libc_getpid_trampoline() - -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) - ppid = int(r0) - return -} - -func libc_getppid_trampoline() - -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpriority_trampoline() - -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrlimit_trampoline() - -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrusage_trampoline() - -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsid_trampoline() - -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_gettimeofday_trampoline() - -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_getuid_trampoline() - -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -func libc_issetugid_trampoline() - -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kqueue_trampoline() - -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lchown_trampoline() - -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_link_trampoline() - -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_linkat_trampoline() - -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listen_trampoline() - -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdir_trampoline() - -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdirat_trampoline() - -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkfifo_trampoline() - -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mknod_trampoline() - -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_open_trampoline() - -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_openat_trampoline() - -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pathconf_trampoline() - -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pread_trampoline() - -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pwrite_trampoline() - -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_read_trampoline() - -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlink_trampoline() - -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlinkat_trampoline() - -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rename_trampoline() - -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_renameat_trampoline() - -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_revoke_trampoline() - -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rmdir_trampoline() - -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := syscall_syscall6(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lseek_trampoline() - -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_select_trampoline() - -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setegid_trampoline() - -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_seteuid_trampoline() - -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgid_trampoline() - -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setlogin_trampoline() - -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpgid_trampoline() - -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpriority_trampoline() - -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setprivexec_trampoline() - -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setregid_trampoline() - -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setreuid_trampoline() - -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setrlimit_trampoline() - -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsid_trampoline() - -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_settimeofday_trampoline() - -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setuid_trampoline() - -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlink_trampoline() - -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlinkat_trampoline() - -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sync_trampoline() - -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_truncate_trampoline() - -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -func libc_umask_trampoline() - -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_undelete_trampoline() - -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlink_trampoline() - -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlinkat_trampoline() - -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unmount_trampoline() - -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_write_trampoline() - -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mmap_trampoline() - -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munmap_trampoline() - -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat_trampoline() - -//go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat_trampoline() - -//go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs_trampoline() - -//go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat_trampoline() - -//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat_trampoline() - -//go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat_trampoline() - -//go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs_trampoline() - -//go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s deleted file mode 100644 index 5eec5f1d..00000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s +++ /dev/null @@ -1,288 +0,0 @@ -// go run mkasm_darwin.go arm -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clonefile(SB) -TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clonefileat(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fclonefileat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getcwd(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs(SB) -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go index 870eb37a..cec595d5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,arm64,go1.13 syscall_darwin.1_13.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && arm64 && go1.13 // +build darwin,arm64,go1.13 package unix @@ -15,25 +16,25 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) + _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_closedir_trampoline() +var libc_closedir_trampoline_addr uintptr //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) res = Errno(r0) return } -func libc_readdir_r_trampoline() +var libc_readdir_r_trampoline_addr uintptr //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s index b29dabb0..35798972 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s @@ -1,12 +1,25 @@ // go run mkasm_darwin.go arm64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.13 // +build go1.13 #include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) + +TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) + +TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) + +GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 9b01a79c..cf71be3e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,arm64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && arm64 && go1.12 // +build darwin,arm64,go1.12 package unix @@ -15,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,28 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() +var libc_getgroups_trampoline_addr uintptr //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() +var libc_setgroups_trampoline_addr uintptr //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -52,14 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() +var libc_wait4_trampoline_addr uintptr //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -67,42 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() +var libc_accept_trampoline_addr uintptr //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() +var libc_bind_trampoline_addr uintptr //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() +var libc_connect_trampoline_addr uintptr //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -110,91 +111,91 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() +var libc_socket_trampoline_addr uintptr //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() +var libc_getsockopt_trampoline_addr uintptr //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() +var libc_setsockopt_trampoline_addr uintptr //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() +var libc_getpeername_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() +var libc_getsockname_trampoline_addr uintptr //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() +var libc_shutdown_trampoline_addr uintptr //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() +var libc_socketpair_trampoline_addr uintptr //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" @@ -207,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -215,7 +216,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() +var libc_recvfrom_trampoline_addr uintptr //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" @@ -228,21 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() +var libc_sendto_trampoline_addr uintptr //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -250,14 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() +var libc_recvmsg_trampoline_addr uintptr //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,14 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() +var libc_sendmsg_trampoline_addr uintptr //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -280,7 +281,7 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() +var libc_kevent_trampoline_addr uintptr //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" @@ -292,35 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() +var libc_utimes_trampoline_addr uintptr //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() +var libc_futimes_trampoline_addr uintptr //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -328,7 +329,7 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() +var libc_poll_trampoline_addr uintptr //go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" @@ -341,14 +342,14 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() +var libc_madvise_trampoline_addr uintptr //go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" @@ -361,28 +362,28 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() +var libc_mlock_trampoline_addr uintptr //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() +var libc_mlockall_trampoline_addr uintptr //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" @@ -395,14 +396,14 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() +var libc_mprotect_trampoline_addr uintptr //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" @@ -415,14 +416,14 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() +var libc_msync_trampoline_addr uintptr //go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" @@ -435,42 +436,42 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() +var libc_munlock_trampoline_addr uintptr //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() +var libc_munlockall_trampoline_addr uintptr //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_pipe_trampoline_addr, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_pipe_trampoline() +var libc_pipe_trampoline_addr uintptr //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" @@ -487,7 +488,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_getxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -495,7 +496,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() +var libc_getxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" @@ -507,7 +508,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_fgetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -515,7 +516,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() +var libc_fgetxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" @@ -532,14 +533,14 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_setxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() +var libc_setxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" @@ -551,14 +552,14 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_fsetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() +var libc_fsetxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" @@ -575,14 +576,14 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_removexattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() +var libc_removexattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" @@ -594,14 +595,14 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_fremovexattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() +var libc_fremovexattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" @@ -613,7 +614,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_listxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -621,14 +622,14 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() +var libc_listxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_flistxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -636,28 +637,28 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() +var libc_flistxattr_trampoline_addr uintptr //go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setattrlist_trampoline() +var libc_setattrlist_trampoline_addr uintptr //go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -665,35 +666,35 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() +var libc_fcntl_trampoline_addr uintptr //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() +var libc_kill_trampoline_addr uintptr //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() +var libc_ioctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" @@ -706,61 +707,120 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sysctl_trampoline() +var libc_sysctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) + _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendfile_trampoline() +var libc_sendfile_trampoline_addr uintptr //go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() +var libc_access_trampoline_addr uintptr //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() +var libc_adjtime_trampoline_addr uintptr //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" @@ -772,14 +832,14 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() +var libc_chdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" @@ -791,14 +851,14 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() +var libc_chflags_trampoline_addr uintptr //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" @@ -810,14 +870,14 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() +var libc_chmod_trampoline_addr uintptr //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" @@ -829,14 +889,14 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() +var libc_chown_trampoline_addr uintptr //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" @@ -848,42 +908,42 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() +var libc_chroot_trampoline_addr uintptr //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clock_gettime_trampoline() +var libc_clock_gettime_trampoline_addr uintptr //go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() +var libc_close_trampoline_addr uintptr //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" @@ -900,14 +960,14 @@ func Clonefile(src string, dst string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_clonefile_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clonefile_trampoline() +var libc_clonefile_trampoline_addr uintptr //go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" @@ -924,21 +984,21 @@ func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_clonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clonefileat_trampoline() +var libc_clonefileat_trampoline_addr uintptr //go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -946,21 +1006,21 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() +var libc_dup_trampoline_addr uintptr //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() +var libc_dup2_trampoline_addr uintptr //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" @@ -977,25 +1037,25 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_exchangedata_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() +var libc_exchangedata_trampoline_addr uintptr //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } -func libc_exit_trampoline() +var libc_exit_trampoline_addr uintptr //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" @@ -1007,56 +1067,56 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() +var libc_faccessat_trampoline_addr uintptr //go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() +var libc_fchdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() +var libc_fchflags_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() +var libc_fchmod_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" @@ -1068,28 +1128,28 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() +var libc_fchmodat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() +var libc_fchown_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" @@ -1101,14 +1161,14 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() +var libc_fchownat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" @@ -1120,35 +1180,35 @@ func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fclonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fclonefileat_trampoline() +var libc_fclonefileat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() +var libc_flock_trampoline_addr uintptr //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1156,35 +1216,35 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +var libc_fpathconf_trampoline_addr uintptr //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() +var libc_fsync_trampoline_addr uintptr //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +var libc_ftruncate_trampoline_addr uintptr //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" @@ -1197,7 +1257,7 @@ func Getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1205,62 +1265,62 @@ func Getcwd(buf []byte) (n int, err error) { return } -func libc_getcwd_trampoline() +var libc_getcwd_trampoline_addr uintptr //go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := syscall_syscall(libc_getdtablesize_trampoline_addr, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() +var libc_getdtablesize_trampoline_addr uintptr //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() +var libc_getegid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() +var libc_geteuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() +var libc_getgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,50 +1328,50 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() +var libc_getpgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() +var libc_getpgrp_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() +var libc_getpid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() +var libc_getppid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1319,42 +1379,42 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() +var libc_getpriority_trampoline_addr uintptr //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() +var libc_getrlimit_trampoline_addr uintptr //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() +var libc_getrusage_trampoline_addr uintptr //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1362,52 +1422,52 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() +var libc_getsid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_gettimeofday_trampoline() +var libc_gettimeofday_trampoline_addr uintptr //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() +var libc_getuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() +var libc_issetugid_trampoline_addr uintptr //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1415,7 +1475,7 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() +var libc_kqueue_trampoline_addr uintptr //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" @@ -1427,14 +1487,14 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() +var libc_lchown_trampoline_addr uintptr //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" @@ -1451,14 +1511,14 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() +var libc_link_trampoline_addr uintptr //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" @@ -1475,28 +1535,28 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() +var libc_linkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +var libc_listen_trampoline_addr uintptr //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" @@ -1508,14 +1568,14 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() +var libc_mkdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" @@ -1527,14 +1587,14 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() +var libc_mkdirat_trampoline_addr uintptr //go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" @@ -1546,14 +1606,14 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() +var libc_mkfifo_trampoline_addr uintptr //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" @@ -1565,14 +1625,14 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() +var libc_mknod_trampoline_addr uintptr //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" @@ -1584,7 +1644,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1592,7 +1652,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() +var libc_open_trampoline_addr uintptr //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" @@ -1604,7 +1664,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1612,7 +1672,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() +var libc_openat_trampoline_addr uintptr //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" @@ -1624,7 +1684,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1632,7 +1692,7 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() +var libc_pathconf_trampoline_addr uintptr //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" @@ -1645,7 +1705,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1653,7 +1713,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() +var libc_pread_trampoline_addr uintptr //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" @@ -1666,7 +1726,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1674,7 +1734,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() +var libc_pwrite_trampoline_addr uintptr //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" @@ -1687,7 +1747,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1695,7 +1755,7 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() +var libc_read_trampoline_addr uintptr //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" @@ -1713,7 +1773,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1721,7 +1781,7 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() +var libc_readlink_trampoline_addr uintptr //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" @@ -1739,7 +1799,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1747,7 +1807,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() +var libc_readlinkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" @@ -1764,14 +1824,14 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() +var libc_rename_trampoline_addr uintptr //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" @@ -1788,14 +1848,14 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() +var libc_renameat_trampoline_addr uintptr //go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" @@ -1807,14 +1867,14 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() +var libc_revoke_trampoline_addr uintptr //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" @@ -1826,21 +1886,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() +var libc_rmdir_trampoline_addr uintptr //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1848,14 +1908,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() +var libc_lseek_trampoline_addr uintptr //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1863,49 +1923,49 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } -func libc_select_trampoline() +var libc_select_trampoline_addr uintptr //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() +var libc_setegid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() +var libc_seteuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() +var libc_setgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" @@ -1917,105 +1977,105 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() +var libc_setlogin_trampoline_addr uintptr //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() +var libc_setpgid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() +var libc_setpriority_trampoline_addr uintptr //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := syscall_syscall(libc_setprivexec_trampoline_addr, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() +var libc_setprivexec_trampoline_addr uintptr //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() +var libc_setregid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() +var libc_setreuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() +var libc_setrlimit_trampoline_addr uintptr //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2023,35 +2083,35 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() +var libc_setsid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() +var libc_settimeofday_trampoline_addr uintptr //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +var libc_setuid_trampoline_addr uintptr //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" @@ -2068,14 +2128,14 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() +var libc_symlink_trampoline_addr uintptr //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" @@ -2092,28 +2152,28 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() +var libc_symlinkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() +var libc_sync_trampoline_addr uintptr //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" @@ -2125,26 +2185,26 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() +var libc_truncate_trampoline_addr uintptr //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() +var libc_umask_trampoline_addr uintptr //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" @@ -2156,14 +2216,14 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_undelete_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() +var libc_undelete_trampoline_addr uintptr //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" @@ -2175,14 +2235,14 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() +var libc_unlink_trampoline_addr uintptr //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" @@ -2194,14 +2254,14 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() +var libc_unlinkat_trampoline_addr uintptr //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" @@ -2213,14 +2273,14 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() +var libc_unmount_trampoline_addr uintptr //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" @@ -2233,7 +2293,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2241,14 +2301,14 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() +var libc_write_trampoline_addr uintptr //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2256,28 +2316,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() +var libc_mmap_trampoline_addr uintptr //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() +var libc_munmap_trampoline_addr uintptr //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2288,7 +2348,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2299,14 +2359,14 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstat_trampoline() +var libc_fstat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" @@ -2318,35 +2378,35 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatat_trampoline() +var libc_fstatat_trampoline_addr uintptr //go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatfs_trampoline() +var libc_fstatfs_trampoline_addr uintptr //go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(buf), uintptr(size), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2354,7 +2414,7 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { return } -func libc_getfsstat_trampoline() +var libc_getfsstat_trampoline_addr uintptr //go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" @@ -2366,28 +2426,28 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lstat_trampoline() +var libc_lstat_trampoline_addr uintptr //go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ptrace_trampoline() +var libc_ptrace_trampoline_addr uintptr //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" @@ -2399,14 +2459,14 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_stat_trampoline() +var libc_stat_trampoline_addr uintptr //go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" @@ -2418,13 +2478,13 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_statfs_trampoline() +var libc_statfs_trampoline_addr uintptr //go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 53c402bf..33e19776 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -1,290 +1,859 @@ // go run mkasm_darwin.go arm64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.12 // +build go1.12 #include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB) + +TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB) + +TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB) + +TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB) + +TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB) + +TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB) + +TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB) + +TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB) + +TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB) + +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefile(SB) -TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB) + +TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clonefileat(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) -TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fclonefileat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8 +DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatfs(SB) -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getfsstat(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lstat(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_statfs(SB) + +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 1aaccd36..1b6eedfa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build dragonfly && amd64 // +build dragonfly,amd64 package unix @@ -362,8 +363,10 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) +func pipe2(p *[2]_C_int, flags int) (r int, w int, err error) { + r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + r = int(r0) + w = int(r1) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 600f1d26..3e9bddb7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && 386 // +build freebsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 064934b0..c72a462b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && amd64 // +build freebsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 31d2c461..530d5df9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && arm // +build freebsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index 4adaaa56..71e7df9e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags freebsd,arm64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && arm64 // +build freebsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index 665dd9e4..af5cb064 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall_solaris.go -illumos -tags illumos,amd64 syscall_illumos.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build illumos && amd64 // +build illumos,amd64 package unix @@ -14,19 +15,25 @@ import ( //go:cgo_import_dynamic libc_writev writev "libc.so" //go:cgo_import_dynamic libc_pwritev pwritev "libc.so" //go:cgo_import_dynamic libc_accept4 accept4 "libsocket.so" +//go:cgo_import_dynamic libc_putmsg putmsg "libc.so" +//go:cgo_import_dynamic libc_getmsg getmsg "libc.so" //go:linkname procreadv libc_readv //go:linkname procpreadv libc_preadv //go:linkname procwritev libc_writev //go:linkname procpwritev libc_pwritev //go:linkname procaccept4 libc_accept4 +//go:linkname procputmsg libc_putmsg +//go:linkname procgetmsg libc_getmsg var ( procreadv, procpreadv, procwritev, procpwritev, - procaccept4 syscallFunc + procaccept4, + procputmsg, + procgetmsg syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -99,3 +106,23 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procputmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(flags), 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 2fbbbe5a..4f5da1f5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,5 +1,6 @@ // Code generated by mkmerge.go; DO NOT EDIT. +//go:build linux // +build linux package unix @@ -47,6 +48,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -99,6 +110,16 @@ func openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err e // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -531,6 +552,16 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func CloseRange(first uint, last uint, flags uint) (err error) { + _, _, e1 := Syscall(SYS_CLOSE_RANGE, uintptr(first), uintptr(last), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) @@ -1190,7 +1221,7 @@ func PivotRoot(newroot string, putold string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { +func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) if e1 != 0 { err = errnoErr(e1) @@ -1924,8 +1955,63 @@ func ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags u // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) +func PidfdOpen(pid int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_OPEN, uintptr(pid), uintptr(flags), 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_GETFD, uintptr(pidfd), uintptr(targetfd), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := Syscall(SYS_SHMAT, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := Syscall(SYS_SHMCTL, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := Syscall(SYS_SHMDT, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := Syscall(SYS_SHMGET, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 19ebd3ff..ff90c81e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && 386 // +build linux,386 package unix @@ -45,37 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -180,17 +150,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -565,14 +524,3 @@ func utimes(path string, times *[2]Timeval) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 5c562182..fa7d3dbe 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && amd64 // +build linux,amd64 package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func inotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -710,27 +679,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index dc69d99c..654f9153 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && arm // +build linux,arm package unix @@ -45,16 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -234,27 +225,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -339,17 +309,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -680,17 +639,6 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 1b897dee..e893f987 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && arm64 // +build linux,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 49186843..6d155288 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -1,6 +1,7 @@ // go run mksyscall.go -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mips // +build linux,mips package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -543,17 +523,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -705,18 +674,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (p1 int, p2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - p1 = int(r0) - p2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) @@ -745,14 +702,3 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 9171d3bd..1e20d72d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mips64 // +build linux,mips64 package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -716,14 +696,3 @@ func stat(path string, st *stat_t) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index 82286f04..82b5e2d9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mips64le // +build linux,mips64le package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -716,14 +696,3 @@ func stat(path string, st *stat_t) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 15920621..a0440c1d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mipsle // +build linux,mipsle package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -543,17 +523,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -705,18 +674,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (p1 int, p2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - p1 = int(r0) - p2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) @@ -745,14 +702,3 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go new file mode 100644 index 00000000..5864b9ca --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -0,0 +1,709 @@ +// go run mksyscall.go -b32 -tags linux,ppc syscall_linux.go syscall_linux_ppc.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build linux && ppc +// +build linux,ppc + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { + _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask>>32), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { + _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off>>32), uintptr(off), uintptr(len>>32), uintptr(len)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { + r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) + n = int64(int64(r0)<<32 | int64(r1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + var _p0 unsafe.Pointer + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE64, uintptr(fd), uintptr(length>>32), uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _ := RawSyscallNoError(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (euid int) { + r0, _ := RawSyscallNoError(SYS_GETEUID, 0, 0, 0) + euid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _ := RawSyscallNoError(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _ := RawSyscallNoError(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ioperm(from int, num int, on int) (err error) { + _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Iopl(level int) (err error) { + _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, n int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset>>32), uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset>>32), uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) + written = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setfsgid(gid int) (prev int, err error) { + r0, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) + prev = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setfsuid(uid int) (prev int, err error) { + r0, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) + prev = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { + r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), uintptr(length>>32), uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(n int, list *_Gid_t) (nn int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + nn = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(n int, list *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Time(t *Time_t) (tt Time_t, err error) { + r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) + tt = Time_t(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) + xaddr = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getrlimit(resource int, rlim *rlimit32) (err error) { + _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setrlimit(resource int, rlim *rlimit32) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { + _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off>>32), uintptr(off), uintptr(n>>32), uintptr(n)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(cmdline) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 73a42e2c..beeb49e3 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && ppc64 // +build linux,ppc64 package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -762,27 +731,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 6b855953..53139b82 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && ppc64le // +build linux,ppc64le package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -762,27 +731,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index b7613344..63b393b8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,riscv64 syscall_linux.go syscall_linux_riscv64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && riscv64 // +build linux,riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index d7032ab1..202add37 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,s390x syscall_linux.go syscall_linux_s390x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && s390x // +build linux,s390x package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -552,17 +521,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index bcbbdd90..2ab268c3 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && sparc64 // +build linux,sparc64 package unix @@ -72,16 +73,6 @@ func Fadvise(fd int, offset int64, length int64, advice int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -179,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -717,24 +697,3 @@ func utimes(path string, times *[2]Timeval) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 3bbd9e39..4726ab30 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -netbsd -tags netbsd,386 syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && 386 // +build netbsd,386 package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index d8cf5012..fe71456d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -netbsd -tags netbsd,amd64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && amd64 // +build netbsd,amd64 package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 1153fe69..0b5b2f01 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -netbsd -arm -tags netbsd,arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && arm // +build netbsd,arm package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 24b4ebb4..bfca2864 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -netbsd -tags netbsd,arm64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && arm64 // +build netbsd,arm64 package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index b44b31ae..8f80f4ad 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && 386 // +build openbsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 67f93ee7..3a47aca7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && amd64 // +build openbsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index d7c878b1..883a9b45 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -openbsd -arm -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && arm // +build openbsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 8facd695..aac7fdc9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -openbsd -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && arm64 // +build openbsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index ec6bd5bb..87761874 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -openbsd -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && mips64 // +build openbsd,mips64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 6dbb8371..b5f926ce 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall_solaris.go -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build solaris && amd64 // +build solaris,amd64 package unix @@ -115,6 +116,7 @@ import ( //go:cgo_import_dynamic libc_statvfs statvfs "libc.so" //go:cgo_import_dynamic libc_symlink symlink "libc.so" //go:cgo_import_dynamic libc_sync sync "libc.so" +//go:cgo_import_dynamic libc_sysconf sysconf "libc.so" //go:cgo_import_dynamic libc_times times "libc.so" //go:cgo_import_dynamic libc_truncate truncate "libc.so" //go:cgo_import_dynamic libc_fsync fsync "libc.so" @@ -139,6 +141,11 @@ import ( //go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so" //go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" //go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" +//go:cgo_import_dynamic libc_port_create port_create "libc.so" +//go:cgo_import_dynamic libc_port_associate port_associate "libc.so" +//go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so" +//go:cgo_import_dynamic libc_port_get port_get "libc.so" +//go:cgo_import_dynamic libc_port_getn port_getn "libc.so" //go:linkname procpipe libc_pipe //go:linkname procpipe2 libc_pipe2 @@ -245,6 +252,7 @@ import ( //go:linkname procStatvfs libc_statvfs //go:linkname procSymlink libc_symlink //go:linkname procSync libc_sync +//go:linkname procSysconf libc_sysconf //go:linkname procTimes libc_times //go:linkname procTruncate libc_truncate //go:linkname procFsync libc_fsync @@ -269,6 +277,11 @@ import ( //go:linkname procgetpeername libc_getpeername //go:linkname procsetsockopt libc_setsockopt //go:linkname procrecvfrom libc_recvfrom +//go:linkname procport_create libc_port_create +//go:linkname procport_associate libc_port_associate +//go:linkname procport_dissociate libc_port_dissociate +//go:linkname procport_get libc_port_get +//go:linkname procport_getn libc_port_getn var ( procpipe, @@ -376,6 +389,7 @@ var ( procStatvfs, procSymlink, procSync, + procSysconf, procTimes, procTruncate, procFsync, @@ -399,7 +413,12 @@ var ( proc__xnet_getsockopt, procgetpeername, procsetsockopt, - procrecvfrom syscallFunc + procrecvfrom, + procport_create, + procport_associate, + procport_dissociate, + procport_get, + procport_getn syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -615,8 +634,9 @@ func __minor(version int, dev uint64) (val uint) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) +func ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) + ret = int(r0) if e1 != 0 { err = e1 } @@ -1687,6 +1707,17 @@ func Sync() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Sysconf(which int) (n int64, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSysconf)), 1, uintptr(which), 0, 0, 0, 0, 0) + n = int64(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0) ticks = uintptr(r0) @@ -1965,3 +1996,58 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_create() (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_associate)), 5, uintptr(port), uintptr(source), uintptr(object), uintptr(events), uintptr(unsafe.Pointer(user)), 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_dissociate(port int, source int, object uintptr) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_dissociate)), 3, uintptr(port), uintptr(source), uintptr(object), 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_get)), 3, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(unsafe.Pointer(timeout)), 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_getn)), 5, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go new file mode 100644 index 00000000..f2079457 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -0,0 +1,1255 @@ +// go run mksyscall.go -tags zos,s390x syscall_zos_s390x.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := syscall_syscall(SYS___ACCEPT_A, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(SYS___BIND_A, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(SYS___CONNECT_A, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(n int, list *_Gid_t) (nn int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + nn = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(n int, list *_Gid_t) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := syscall_syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := syscall_syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := syscall_rawsyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawsyscall(SYS___GETPEERNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawsyscall(SYS___GETSOCKNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(SYS___RECVFROM_A, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(SYS___SENDTO_A, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(SYS___RECVMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(SYS___SENDMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := syscall_syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___ACCESS_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHMOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Creat(path string, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(SYS___CREAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(oldfd int) (fd int, err error) { + r0, _, e1 := syscall_syscall(SYS_DUP, uintptr(oldfd), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(oldfd int, newfd int) (err error) { + _, _, e1 := syscall_syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Errno2() (er2 int) { + uer2, _, _ := syscall_syscall(SYS___ERRNO2, 0, 0, 0) + er2 = int(uer2) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Err2ad() (eadd *int) { + ueadd, _, _ := syscall_syscall(SYS___ERR2AD, 0, 0, 0) + eadd = (*int)(unsafe.Pointer(ueadd)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + syscall_syscall(SYS_EXIT, uintptr(code), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := syscall_syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := syscall_syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := syscall_syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) { + r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + retval = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstat(fd int, stat *Stat_LE_t) (err error) { + _, _, e1 := syscall_syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatvfs(fd int, stat *Statvfs_t) (err error) { + _, _, e1 := syscall_syscall(SYS_FSTATVFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := syscall_syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := syscall_syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpagesize() (pgsize int) { + r0, _, _ := syscall_syscall(SYS_GETPAGESIZE, 0, 0, 0) + pgsize = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Poll(fds []PollFd, timeout int) (n int, err error) { + var _p0 unsafe.Pointer + if len(fds) > 0 { + _p0 = unsafe.Pointer(&fds[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS_POLL, uintptr(_p0), uintptr(len(fds)), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Times(tms *Tms) (ticks uintptr, err error) { + r0, _, e1 := syscall_syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) + ticks = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func W_Getmntent(buff *byte, size int) (lastsys int, err error) { + r0, _, e1 := syscall_syscall(SYS_W_GETMNTENT, uintptr(unsafe.Pointer(buff)), uintptr(size), 0) + lastsys = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func W_Getmntent_A(buff *byte, size int) (lastsys int, err error) { + r0, _, e1 := syscall_syscall(SYS___W_GETMNTENT_A, uintptr(unsafe.Pointer(buff)), uintptr(size), 0) + lastsys = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(filesystem) + if err != nil { + return + } + var _p2 *byte + _p2, err = BytePtrFromString(fstype) + if err != nil { + return + } + var _p3 *byte + _p3, err = BytePtrFromString(parm) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(SYS___MOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(mtm), uintptr(parmlen), uintptr(unsafe.Pointer(_p3))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unmount(filesystem string, mtm int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(filesystem) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UMOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mtm), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHROOT_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Uname(buf *Utsname) (err error) { + _, _, e1 := syscall_rawsyscall(SYS___UNAME_A, uintptr(unsafe.Pointer(buf)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gethostname(buf []byte) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(SYS___GETHOSTNAME_A, uintptr(_p0), uintptr(len(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETEUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (pid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETPPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := syscall_syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(resource int, rlim *Rlimit) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getrusage(who int, rusage *rusage_zos) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_GETSID, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, sig Signal) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___LCHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___LINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, n int) (err error) { + _, _, e1 := syscall_syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func lstat(path string, stat *Stat_LE_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___LSTAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___MKDIR_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___MKFIFO_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___MKNOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS___READLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___RENAME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___RMDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (off int64, err error) { + r0, _, e1 := syscall_syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + off = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := syscall_syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(resource int, lim *Rlimit) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := syscall_syscall(SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(uid int) (err error) { + _, _, e1 := syscall_syscall(SYS_SETGID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(fd int, how int) (err error) { + _, _, e1 := syscall_syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func stat(path string, statLE *Stat_LE_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___STAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statLE)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___SYMLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() { + syscall_syscall(SYS_SYNC, 0, 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___TRUNCATE_A, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tcgetattr(fildes int, termptr *Termios) (err error) { + _, _, e1 := syscall_syscall(SYS_TCGETATTR, uintptr(fildes), uintptr(unsafe.Pointer(termptr)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tcsetattr(fildes int, when int, termptr *Termios) (err error) { + _, _, e1 := syscall_syscall(SYS_TCSETATTR, uintptr(fildes), uintptr(when), uintptr(unsafe.Pointer(termptr))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(mask int) (oldmask int) { + r0, _, _ := syscall_syscall(SYS_UMASK, uintptr(mask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UNLINK_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, utim *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UTIME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(utim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(SYS___OPEN_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func remove(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) { + r0, _, e1 := syscall_syscall(SYS_WAITPID, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options)) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func gettimeofday(tv *timeval_zos) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UTIMES_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) { + r0, _, e1 := syscall_syscall6(SYS_SELECT, uintptr(nmsgsfds), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 102f1ab4..9e9d0b2a 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index 4866fced..adecd096 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index d3801eb2..8ea52a4a 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go index ba4304fd..154b57ae 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go index aca34b34..d96bb2ba 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build mips64 && openbsd // +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go deleted file mode 100644 index ad62324c..00000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go +++ /dev/null @@ -1,437 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build 386,darwin - -package unix - -// Deprecated: Use libSystem wrappers instead of direct syscalls. -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index a2fc91d6..f8298ff9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && darwin // +build amd64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go deleted file mode 100644 index 20d7808a..00000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go +++ /dev/null @@ -1,437 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm,darwin - -package unix - -// Deprecated: Use libSystem wrappers instead of direct syscalls. -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 527b9588..5eb433bb 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && darwin // +build arm64,darwin package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 9912c6ee..703675c0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && dragonfly // +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 9474974b..59d5dfc2 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && freebsd // +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 48a7beae..342d471d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && freebsd // +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index 4a6dfd4a..e2e3d72c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && freebsd // +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 3e51af8e..61ad5ca3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && freebsd // +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index f6742bde..aa7ce85d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m32 /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && linux // +build 386,linux package unix @@ -436,4 +437,11 @@ const ( SYS_PIDFD_GETFD = 438 SYS_FACCESSAT2 = 439 SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index f7e52557..b8303263 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -1,361 +1,369 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && linux // +build amd64,linux package unix const ( - SYS_READ = 0 - SYS_WRITE = 1 - SYS_OPEN = 2 - SYS_CLOSE = 3 - SYS_STAT = 4 - SYS_FSTAT = 5 - SYS_LSTAT = 6 - SYS_POLL = 7 - SYS_LSEEK = 8 - SYS_MMAP = 9 - SYS_MPROTECT = 10 - SYS_MUNMAP = 11 - SYS_BRK = 12 - SYS_RT_SIGACTION = 13 - SYS_RT_SIGPROCMASK = 14 - SYS_RT_SIGRETURN = 15 - SYS_IOCTL = 16 - SYS_PREAD64 = 17 - SYS_PWRITE64 = 18 - SYS_READV = 19 - SYS_WRITEV = 20 - SYS_ACCESS = 21 - SYS_PIPE = 22 - SYS_SELECT = 23 - SYS_SCHED_YIELD = 24 - SYS_MREMAP = 25 - SYS_MSYNC = 26 - SYS_MINCORE = 27 - SYS_MADVISE = 28 - SYS_SHMGET = 29 - SYS_SHMAT = 30 - SYS_SHMCTL = 31 - SYS_DUP = 32 - SYS_DUP2 = 33 - SYS_PAUSE = 34 - SYS_NANOSLEEP = 35 - SYS_GETITIMER = 36 - SYS_ALARM = 37 - SYS_SETITIMER = 38 - SYS_GETPID = 39 - SYS_SENDFILE = 40 - SYS_SOCKET = 41 - SYS_CONNECT = 42 - SYS_ACCEPT = 43 - SYS_SENDTO = 44 - SYS_RECVFROM = 45 - SYS_SENDMSG = 46 - SYS_RECVMSG = 47 - SYS_SHUTDOWN = 48 - SYS_BIND = 49 - SYS_LISTEN = 50 - SYS_GETSOCKNAME = 51 - SYS_GETPEERNAME = 52 - SYS_SOCKETPAIR = 53 - SYS_SETSOCKOPT = 54 - SYS_GETSOCKOPT = 55 - SYS_CLONE = 56 - SYS_FORK = 57 - SYS_VFORK = 58 - SYS_EXECVE = 59 - SYS_EXIT = 60 - SYS_WAIT4 = 61 - SYS_KILL = 62 - SYS_UNAME = 63 - SYS_SEMGET = 64 - SYS_SEMOP = 65 - SYS_SEMCTL = 66 - SYS_SHMDT = 67 - SYS_MSGGET = 68 - SYS_MSGSND = 69 - SYS_MSGRCV = 70 - SYS_MSGCTL = 71 - SYS_FCNTL = 72 - SYS_FLOCK = 73 - SYS_FSYNC = 74 - SYS_FDATASYNC = 75 - SYS_TRUNCATE = 76 - SYS_FTRUNCATE = 77 - SYS_GETDENTS = 78 - SYS_GETCWD = 79 - SYS_CHDIR = 80 - SYS_FCHDIR = 81 - SYS_RENAME = 82 - SYS_MKDIR = 83 - SYS_RMDIR = 84 - SYS_CREAT = 85 - SYS_LINK = 86 - SYS_UNLINK = 87 - SYS_SYMLINK = 88 - SYS_READLINK = 89 - SYS_CHMOD = 90 - SYS_FCHMOD = 91 - SYS_CHOWN = 92 - SYS_FCHOWN = 93 - SYS_LCHOWN = 94 - SYS_UMASK = 95 - SYS_GETTIMEOFDAY = 96 - SYS_GETRLIMIT = 97 - SYS_GETRUSAGE = 98 - SYS_SYSINFO = 99 - SYS_TIMES = 100 - SYS_PTRACE = 101 - SYS_GETUID = 102 - SYS_SYSLOG = 103 - SYS_GETGID = 104 - SYS_SETUID = 105 - SYS_SETGID = 106 - SYS_GETEUID = 107 - SYS_GETEGID = 108 - SYS_SETPGID = 109 - SYS_GETPPID = 110 - SYS_GETPGRP = 111 - SYS_SETSID = 112 - SYS_SETREUID = 113 - SYS_SETREGID = 114 - SYS_GETGROUPS = 115 - SYS_SETGROUPS = 116 - SYS_SETRESUID = 117 - SYS_GETRESUID = 118 - SYS_SETRESGID = 119 - SYS_GETRESGID = 120 - SYS_GETPGID = 121 - SYS_SETFSUID = 122 - SYS_SETFSGID = 123 - SYS_GETSID = 124 - SYS_CAPGET = 125 - SYS_CAPSET = 126 - SYS_RT_SIGPENDING = 127 - SYS_RT_SIGTIMEDWAIT = 128 - SYS_RT_SIGQUEUEINFO = 129 - SYS_RT_SIGSUSPEND = 130 - SYS_SIGALTSTACK = 131 - SYS_UTIME = 132 - SYS_MKNOD = 133 - SYS_USELIB = 134 - SYS_PERSONALITY = 135 - SYS_USTAT = 136 - SYS_STATFS = 137 - SYS_FSTATFS = 138 - SYS_SYSFS = 139 - SYS_GETPRIORITY = 140 - SYS_SETPRIORITY = 141 - SYS_SCHED_SETPARAM = 142 - SYS_SCHED_GETPARAM = 143 - SYS_SCHED_SETSCHEDULER = 144 - SYS_SCHED_GETSCHEDULER = 145 - SYS_SCHED_GET_PRIORITY_MAX = 146 - SYS_SCHED_GET_PRIORITY_MIN = 147 - SYS_SCHED_RR_GET_INTERVAL = 148 - SYS_MLOCK = 149 - SYS_MUNLOCK = 150 - SYS_MLOCKALL = 151 - SYS_MUNLOCKALL = 152 - SYS_VHANGUP = 153 - SYS_MODIFY_LDT = 154 - SYS_PIVOT_ROOT = 155 - SYS__SYSCTL = 156 - SYS_PRCTL = 157 - SYS_ARCH_PRCTL = 158 - SYS_ADJTIMEX = 159 - SYS_SETRLIMIT = 160 - SYS_CHROOT = 161 - SYS_SYNC = 162 - SYS_ACCT = 163 - SYS_SETTIMEOFDAY = 164 - SYS_MOUNT = 165 - SYS_UMOUNT2 = 166 - SYS_SWAPON = 167 - SYS_SWAPOFF = 168 - SYS_REBOOT = 169 - SYS_SETHOSTNAME = 170 - SYS_SETDOMAINNAME = 171 - SYS_IOPL = 172 - SYS_IOPERM = 173 - SYS_CREATE_MODULE = 174 - SYS_INIT_MODULE = 175 - SYS_DELETE_MODULE = 176 - SYS_GET_KERNEL_SYMS = 177 - SYS_QUERY_MODULE = 178 - SYS_QUOTACTL = 179 - SYS_NFSSERVCTL = 180 - SYS_GETPMSG = 181 - SYS_PUTPMSG = 182 - SYS_AFS_SYSCALL = 183 - SYS_TUXCALL = 184 - SYS_SECURITY = 185 - SYS_GETTID = 186 - SYS_READAHEAD = 187 - SYS_SETXATTR = 188 - SYS_LSETXATTR = 189 - SYS_FSETXATTR = 190 - SYS_GETXATTR = 191 - SYS_LGETXATTR = 192 - SYS_FGETXATTR = 193 - SYS_LISTXATTR = 194 - SYS_LLISTXATTR = 195 - SYS_FLISTXATTR = 196 - SYS_REMOVEXATTR = 197 - SYS_LREMOVEXATTR = 198 - SYS_FREMOVEXATTR = 199 - SYS_TKILL = 200 - SYS_TIME = 201 - SYS_FUTEX = 202 - SYS_SCHED_SETAFFINITY = 203 - SYS_SCHED_GETAFFINITY = 204 - SYS_SET_THREAD_AREA = 205 - SYS_IO_SETUP = 206 - SYS_IO_DESTROY = 207 - SYS_IO_GETEVENTS = 208 - SYS_IO_SUBMIT = 209 - SYS_IO_CANCEL = 210 - SYS_GET_THREAD_AREA = 211 - SYS_LOOKUP_DCOOKIE = 212 - SYS_EPOLL_CREATE = 213 - SYS_EPOLL_CTL_OLD = 214 - SYS_EPOLL_WAIT_OLD = 215 - SYS_REMAP_FILE_PAGES = 216 - SYS_GETDENTS64 = 217 - SYS_SET_TID_ADDRESS = 218 - SYS_RESTART_SYSCALL = 219 - SYS_SEMTIMEDOP = 220 - SYS_FADVISE64 = 221 - SYS_TIMER_CREATE = 222 - SYS_TIMER_SETTIME = 223 - SYS_TIMER_GETTIME = 224 - SYS_TIMER_GETOVERRUN = 225 - SYS_TIMER_DELETE = 226 - SYS_CLOCK_SETTIME = 227 - SYS_CLOCK_GETTIME = 228 - SYS_CLOCK_GETRES = 229 - SYS_CLOCK_NANOSLEEP = 230 - SYS_EXIT_GROUP = 231 - SYS_EPOLL_WAIT = 232 - SYS_EPOLL_CTL = 233 - SYS_TGKILL = 234 - SYS_UTIMES = 235 - SYS_VSERVER = 236 - SYS_MBIND = 237 - SYS_SET_MEMPOLICY = 238 - SYS_GET_MEMPOLICY = 239 - SYS_MQ_OPEN = 240 - SYS_MQ_UNLINK = 241 - SYS_MQ_TIMEDSEND = 242 - SYS_MQ_TIMEDRECEIVE = 243 - SYS_MQ_NOTIFY = 244 - SYS_MQ_GETSETATTR = 245 - SYS_KEXEC_LOAD = 246 - SYS_WAITID = 247 - SYS_ADD_KEY = 248 - SYS_REQUEST_KEY = 249 - SYS_KEYCTL = 250 - SYS_IOPRIO_SET = 251 - SYS_IOPRIO_GET = 252 - SYS_INOTIFY_INIT = 253 - SYS_INOTIFY_ADD_WATCH = 254 - SYS_INOTIFY_RM_WATCH = 255 - SYS_MIGRATE_PAGES = 256 - SYS_OPENAT = 257 - SYS_MKDIRAT = 258 - SYS_MKNODAT = 259 - SYS_FCHOWNAT = 260 - SYS_FUTIMESAT = 261 - SYS_NEWFSTATAT = 262 - SYS_UNLINKAT = 263 - SYS_RENAMEAT = 264 - SYS_LINKAT = 265 - SYS_SYMLINKAT = 266 - SYS_READLINKAT = 267 - SYS_FCHMODAT = 268 - SYS_FACCESSAT = 269 - SYS_PSELECT6 = 270 - SYS_PPOLL = 271 - SYS_UNSHARE = 272 - SYS_SET_ROBUST_LIST = 273 - SYS_GET_ROBUST_LIST = 274 - SYS_SPLICE = 275 - SYS_TEE = 276 - SYS_SYNC_FILE_RANGE = 277 - SYS_VMSPLICE = 278 - SYS_MOVE_PAGES = 279 - SYS_UTIMENSAT = 280 - SYS_EPOLL_PWAIT = 281 - SYS_SIGNALFD = 282 - SYS_TIMERFD_CREATE = 283 - SYS_EVENTFD = 284 - SYS_FALLOCATE = 285 - SYS_TIMERFD_SETTIME = 286 - SYS_TIMERFD_GETTIME = 287 - SYS_ACCEPT4 = 288 - SYS_SIGNALFD4 = 289 - SYS_EVENTFD2 = 290 - SYS_EPOLL_CREATE1 = 291 - SYS_DUP3 = 292 - SYS_PIPE2 = 293 - SYS_INOTIFY_INIT1 = 294 - SYS_PREADV = 295 - SYS_PWRITEV = 296 - SYS_RT_TGSIGQUEUEINFO = 297 - SYS_PERF_EVENT_OPEN = 298 - SYS_RECVMMSG = 299 - SYS_FANOTIFY_INIT = 300 - SYS_FANOTIFY_MARK = 301 - SYS_PRLIMIT64 = 302 - SYS_NAME_TO_HANDLE_AT = 303 - SYS_OPEN_BY_HANDLE_AT = 304 - SYS_CLOCK_ADJTIME = 305 - SYS_SYNCFS = 306 - SYS_SENDMMSG = 307 - SYS_SETNS = 308 - SYS_GETCPU = 309 - SYS_PROCESS_VM_READV = 310 - SYS_PROCESS_VM_WRITEV = 311 - SYS_KCMP = 312 - SYS_FINIT_MODULE = 313 - SYS_SCHED_SETATTR = 314 - SYS_SCHED_GETATTR = 315 - SYS_RENAMEAT2 = 316 - SYS_SECCOMP = 317 - SYS_GETRANDOM = 318 - SYS_MEMFD_CREATE = 319 - SYS_KEXEC_FILE_LOAD = 320 - SYS_BPF = 321 - SYS_EXECVEAT = 322 - SYS_USERFAULTFD = 323 - SYS_MEMBARRIER = 324 - SYS_MLOCK2 = 325 - SYS_COPY_FILE_RANGE = 326 - SYS_PREADV2 = 327 - SYS_PWRITEV2 = 328 - SYS_PKEY_MPROTECT = 329 - SYS_PKEY_ALLOC = 330 - SYS_PKEY_FREE = 331 - SYS_STATX = 332 - SYS_IO_PGETEVENTS = 333 - SYS_RSEQ = 334 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_READ = 0 + SYS_WRITE = 1 + SYS_OPEN = 2 + SYS_CLOSE = 3 + SYS_STAT = 4 + SYS_FSTAT = 5 + SYS_LSTAT = 6 + SYS_POLL = 7 + SYS_LSEEK = 8 + SYS_MMAP = 9 + SYS_MPROTECT = 10 + SYS_MUNMAP = 11 + SYS_BRK = 12 + SYS_RT_SIGACTION = 13 + SYS_RT_SIGPROCMASK = 14 + SYS_RT_SIGRETURN = 15 + SYS_IOCTL = 16 + SYS_PREAD64 = 17 + SYS_PWRITE64 = 18 + SYS_READV = 19 + SYS_WRITEV = 20 + SYS_ACCESS = 21 + SYS_PIPE = 22 + SYS_SELECT = 23 + SYS_SCHED_YIELD = 24 + SYS_MREMAP = 25 + SYS_MSYNC = 26 + SYS_MINCORE = 27 + SYS_MADVISE = 28 + SYS_SHMGET = 29 + SYS_SHMAT = 30 + SYS_SHMCTL = 31 + SYS_DUP = 32 + SYS_DUP2 = 33 + SYS_PAUSE = 34 + SYS_NANOSLEEP = 35 + SYS_GETITIMER = 36 + SYS_ALARM = 37 + SYS_SETITIMER = 38 + SYS_GETPID = 39 + SYS_SENDFILE = 40 + SYS_SOCKET = 41 + SYS_CONNECT = 42 + SYS_ACCEPT = 43 + SYS_SENDTO = 44 + SYS_RECVFROM = 45 + SYS_SENDMSG = 46 + SYS_RECVMSG = 47 + SYS_SHUTDOWN = 48 + SYS_BIND = 49 + SYS_LISTEN = 50 + SYS_GETSOCKNAME = 51 + SYS_GETPEERNAME = 52 + SYS_SOCKETPAIR = 53 + SYS_SETSOCKOPT = 54 + SYS_GETSOCKOPT = 55 + SYS_CLONE = 56 + SYS_FORK = 57 + SYS_VFORK = 58 + SYS_EXECVE = 59 + SYS_EXIT = 60 + SYS_WAIT4 = 61 + SYS_KILL = 62 + SYS_UNAME = 63 + SYS_SEMGET = 64 + SYS_SEMOP = 65 + SYS_SEMCTL = 66 + SYS_SHMDT = 67 + SYS_MSGGET = 68 + SYS_MSGSND = 69 + SYS_MSGRCV = 70 + SYS_MSGCTL = 71 + SYS_FCNTL = 72 + SYS_FLOCK = 73 + SYS_FSYNC = 74 + SYS_FDATASYNC = 75 + SYS_TRUNCATE = 76 + SYS_FTRUNCATE = 77 + SYS_GETDENTS = 78 + SYS_GETCWD = 79 + SYS_CHDIR = 80 + SYS_FCHDIR = 81 + SYS_RENAME = 82 + SYS_MKDIR = 83 + SYS_RMDIR = 84 + SYS_CREAT = 85 + SYS_LINK = 86 + SYS_UNLINK = 87 + SYS_SYMLINK = 88 + SYS_READLINK = 89 + SYS_CHMOD = 90 + SYS_FCHMOD = 91 + SYS_CHOWN = 92 + SYS_FCHOWN = 93 + SYS_LCHOWN = 94 + SYS_UMASK = 95 + SYS_GETTIMEOFDAY = 96 + SYS_GETRLIMIT = 97 + SYS_GETRUSAGE = 98 + SYS_SYSINFO = 99 + SYS_TIMES = 100 + SYS_PTRACE = 101 + SYS_GETUID = 102 + SYS_SYSLOG = 103 + SYS_GETGID = 104 + SYS_SETUID = 105 + SYS_SETGID = 106 + SYS_GETEUID = 107 + SYS_GETEGID = 108 + SYS_SETPGID = 109 + SYS_GETPPID = 110 + SYS_GETPGRP = 111 + SYS_SETSID = 112 + SYS_SETREUID = 113 + SYS_SETREGID = 114 + SYS_GETGROUPS = 115 + SYS_SETGROUPS = 116 + SYS_SETRESUID = 117 + SYS_GETRESUID = 118 + SYS_SETRESGID = 119 + SYS_GETRESGID = 120 + SYS_GETPGID = 121 + SYS_SETFSUID = 122 + SYS_SETFSGID = 123 + SYS_GETSID = 124 + SYS_CAPGET = 125 + SYS_CAPSET = 126 + SYS_RT_SIGPENDING = 127 + SYS_RT_SIGTIMEDWAIT = 128 + SYS_RT_SIGQUEUEINFO = 129 + SYS_RT_SIGSUSPEND = 130 + SYS_SIGALTSTACK = 131 + SYS_UTIME = 132 + SYS_MKNOD = 133 + SYS_USELIB = 134 + SYS_PERSONALITY = 135 + SYS_USTAT = 136 + SYS_STATFS = 137 + SYS_FSTATFS = 138 + SYS_SYSFS = 139 + SYS_GETPRIORITY = 140 + SYS_SETPRIORITY = 141 + SYS_SCHED_SETPARAM = 142 + SYS_SCHED_GETPARAM = 143 + SYS_SCHED_SETSCHEDULER = 144 + SYS_SCHED_GETSCHEDULER = 145 + SYS_SCHED_GET_PRIORITY_MAX = 146 + SYS_SCHED_GET_PRIORITY_MIN = 147 + SYS_SCHED_RR_GET_INTERVAL = 148 + SYS_MLOCK = 149 + SYS_MUNLOCK = 150 + SYS_MLOCKALL = 151 + SYS_MUNLOCKALL = 152 + SYS_VHANGUP = 153 + SYS_MODIFY_LDT = 154 + SYS_PIVOT_ROOT = 155 + SYS__SYSCTL = 156 + SYS_PRCTL = 157 + SYS_ARCH_PRCTL = 158 + SYS_ADJTIMEX = 159 + SYS_SETRLIMIT = 160 + SYS_CHROOT = 161 + SYS_SYNC = 162 + SYS_ACCT = 163 + SYS_SETTIMEOFDAY = 164 + SYS_MOUNT = 165 + SYS_UMOUNT2 = 166 + SYS_SWAPON = 167 + SYS_SWAPOFF = 168 + SYS_REBOOT = 169 + SYS_SETHOSTNAME = 170 + SYS_SETDOMAINNAME = 171 + SYS_IOPL = 172 + SYS_IOPERM = 173 + SYS_CREATE_MODULE = 174 + SYS_INIT_MODULE = 175 + SYS_DELETE_MODULE = 176 + SYS_GET_KERNEL_SYMS = 177 + SYS_QUERY_MODULE = 178 + SYS_QUOTACTL = 179 + SYS_NFSSERVCTL = 180 + SYS_GETPMSG = 181 + SYS_PUTPMSG = 182 + SYS_AFS_SYSCALL = 183 + SYS_TUXCALL = 184 + SYS_SECURITY = 185 + SYS_GETTID = 186 + SYS_READAHEAD = 187 + SYS_SETXATTR = 188 + SYS_LSETXATTR = 189 + SYS_FSETXATTR = 190 + SYS_GETXATTR = 191 + SYS_LGETXATTR = 192 + SYS_FGETXATTR = 193 + SYS_LISTXATTR = 194 + SYS_LLISTXATTR = 195 + SYS_FLISTXATTR = 196 + SYS_REMOVEXATTR = 197 + SYS_LREMOVEXATTR = 198 + SYS_FREMOVEXATTR = 199 + SYS_TKILL = 200 + SYS_TIME = 201 + SYS_FUTEX = 202 + SYS_SCHED_SETAFFINITY = 203 + SYS_SCHED_GETAFFINITY = 204 + SYS_SET_THREAD_AREA = 205 + SYS_IO_SETUP = 206 + SYS_IO_DESTROY = 207 + SYS_IO_GETEVENTS = 208 + SYS_IO_SUBMIT = 209 + SYS_IO_CANCEL = 210 + SYS_GET_THREAD_AREA = 211 + SYS_LOOKUP_DCOOKIE = 212 + SYS_EPOLL_CREATE = 213 + SYS_EPOLL_CTL_OLD = 214 + SYS_EPOLL_WAIT_OLD = 215 + SYS_REMAP_FILE_PAGES = 216 + SYS_GETDENTS64 = 217 + SYS_SET_TID_ADDRESS = 218 + SYS_RESTART_SYSCALL = 219 + SYS_SEMTIMEDOP = 220 + SYS_FADVISE64 = 221 + SYS_TIMER_CREATE = 222 + SYS_TIMER_SETTIME = 223 + SYS_TIMER_GETTIME = 224 + SYS_TIMER_GETOVERRUN = 225 + SYS_TIMER_DELETE = 226 + SYS_CLOCK_SETTIME = 227 + SYS_CLOCK_GETTIME = 228 + SYS_CLOCK_GETRES = 229 + SYS_CLOCK_NANOSLEEP = 230 + SYS_EXIT_GROUP = 231 + SYS_EPOLL_WAIT = 232 + SYS_EPOLL_CTL = 233 + SYS_TGKILL = 234 + SYS_UTIMES = 235 + SYS_VSERVER = 236 + SYS_MBIND = 237 + SYS_SET_MEMPOLICY = 238 + SYS_GET_MEMPOLICY = 239 + SYS_MQ_OPEN = 240 + SYS_MQ_UNLINK = 241 + SYS_MQ_TIMEDSEND = 242 + SYS_MQ_TIMEDRECEIVE = 243 + SYS_MQ_NOTIFY = 244 + SYS_MQ_GETSETATTR = 245 + SYS_KEXEC_LOAD = 246 + SYS_WAITID = 247 + SYS_ADD_KEY = 248 + SYS_REQUEST_KEY = 249 + SYS_KEYCTL = 250 + SYS_IOPRIO_SET = 251 + SYS_IOPRIO_GET = 252 + SYS_INOTIFY_INIT = 253 + SYS_INOTIFY_ADD_WATCH = 254 + SYS_INOTIFY_RM_WATCH = 255 + SYS_MIGRATE_PAGES = 256 + SYS_OPENAT = 257 + SYS_MKDIRAT = 258 + SYS_MKNODAT = 259 + SYS_FCHOWNAT = 260 + SYS_FUTIMESAT = 261 + SYS_NEWFSTATAT = 262 + SYS_UNLINKAT = 263 + SYS_RENAMEAT = 264 + SYS_LINKAT = 265 + SYS_SYMLINKAT = 266 + SYS_READLINKAT = 267 + SYS_FCHMODAT = 268 + SYS_FACCESSAT = 269 + SYS_PSELECT6 = 270 + SYS_PPOLL = 271 + SYS_UNSHARE = 272 + SYS_SET_ROBUST_LIST = 273 + SYS_GET_ROBUST_LIST = 274 + SYS_SPLICE = 275 + SYS_TEE = 276 + SYS_SYNC_FILE_RANGE = 277 + SYS_VMSPLICE = 278 + SYS_MOVE_PAGES = 279 + SYS_UTIMENSAT = 280 + SYS_EPOLL_PWAIT = 281 + SYS_SIGNALFD = 282 + SYS_TIMERFD_CREATE = 283 + SYS_EVENTFD = 284 + SYS_FALLOCATE = 285 + SYS_TIMERFD_SETTIME = 286 + SYS_TIMERFD_GETTIME = 287 + SYS_ACCEPT4 = 288 + SYS_SIGNALFD4 = 289 + SYS_EVENTFD2 = 290 + SYS_EPOLL_CREATE1 = 291 + SYS_DUP3 = 292 + SYS_PIPE2 = 293 + SYS_INOTIFY_INIT1 = 294 + SYS_PREADV = 295 + SYS_PWRITEV = 296 + SYS_RT_TGSIGQUEUEINFO = 297 + SYS_PERF_EVENT_OPEN = 298 + SYS_RECVMMSG = 299 + SYS_FANOTIFY_INIT = 300 + SYS_FANOTIFY_MARK = 301 + SYS_PRLIMIT64 = 302 + SYS_NAME_TO_HANDLE_AT = 303 + SYS_OPEN_BY_HANDLE_AT = 304 + SYS_CLOCK_ADJTIME = 305 + SYS_SYNCFS = 306 + SYS_SENDMMSG = 307 + SYS_SETNS = 308 + SYS_GETCPU = 309 + SYS_PROCESS_VM_READV = 310 + SYS_PROCESS_VM_WRITEV = 311 + SYS_KCMP = 312 + SYS_FINIT_MODULE = 313 + SYS_SCHED_SETATTR = 314 + SYS_SCHED_GETATTR = 315 + SYS_RENAMEAT2 = 316 + SYS_SECCOMP = 317 + SYS_GETRANDOM = 318 + SYS_MEMFD_CREATE = 319 + SYS_KEXEC_FILE_LOAD = 320 + SYS_BPF = 321 + SYS_EXECVEAT = 322 + SYS_USERFAULTFD = 323 + SYS_MEMBARRIER = 324 + SYS_MLOCK2 = 325 + SYS_COPY_FILE_RANGE = 326 + SYS_PREADV2 = 327 + SYS_PWRITEV2 = 328 + SYS_PKEY_MPROTECT = 329 + SYS_PKEY_ALLOC = 330 + SYS_PKEY_FREE = 331 + SYS_STATX = 332 + SYS_IO_PGETEVENTS = 333 + SYS_RSEQ = 334 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 3f60977d..d75f65a0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && linux // +build arm,linux package unix @@ -400,4 +401,10 @@ const ( SYS_PIDFD_GETFD = 438 SYS_FACCESSAT2 = 439 SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index dbedf4cb..8b02f09e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -1,306 +1,314 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && linux // +build arm64,linux package unix const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_RENAMEAT = 38 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 - SYS_GETRANDOM = 278 - SYS_MEMFD_CREATE = 279 - SYS_BPF = 280 - SYS_EXECVEAT = 281 - SYS_USERFAULTFD = 282 - SYS_MEMBARRIER = 283 - SYS_MLOCK2 = 284 - SYS_COPY_FILE_RANGE = 285 - SYS_PREADV2 = 286 - SYS_PWRITEV2 = 287 - SYS_PKEY_MPROTECT = 288 - SYS_PKEY_ALLOC = 289 - SYS_PKEY_FREE = 290 - SYS_STATX = 291 - SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_IO_SETUP = 0 + SYS_IO_DESTROY = 1 + SYS_IO_SUBMIT = 2 + SYS_IO_CANCEL = 3 + SYS_IO_GETEVENTS = 4 + SYS_SETXATTR = 5 + SYS_LSETXATTR = 6 + SYS_FSETXATTR = 7 + SYS_GETXATTR = 8 + SYS_LGETXATTR = 9 + SYS_FGETXATTR = 10 + SYS_LISTXATTR = 11 + SYS_LLISTXATTR = 12 + SYS_FLISTXATTR = 13 + SYS_REMOVEXATTR = 14 + SYS_LREMOVEXATTR = 15 + SYS_FREMOVEXATTR = 16 + SYS_GETCWD = 17 + SYS_LOOKUP_DCOOKIE = 18 + SYS_EVENTFD2 = 19 + SYS_EPOLL_CREATE1 = 20 + SYS_EPOLL_CTL = 21 + SYS_EPOLL_PWAIT = 22 + SYS_DUP = 23 + SYS_DUP3 = 24 + SYS_FCNTL = 25 + SYS_INOTIFY_INIT1 = 26 + SYS_INOTIFY_ADD_WATCH = 27 + SYS_INOTIFY_RM_WATCH = 28 + SYS_IOCTL = 29 + SYS_IOPRIO_SET = 30 + SYS_IOPRIO_GET = 31 + SYS_FLOCK = 32 + SYS_MKNODAT = 33 + SYS_MKDIRAT = 34 + SYS_UNLINKAT = 35 + SYS_SYMLINKAT = 36 + SYS_LINKAT = 37 + SYS_RENAMEAT = 38 + SYS_UMOUNT2 = 39 + SYS_MOUNT = 40 + SYS_PIVOT_ROOT = 41 + SYS_NFSSERVCTL = 42 + SYS_STATFS = 43 + SYS_FSTATFS = 44 + SYS_TRUNCATE = 45 + SYS_FTRUNCATE = 46 + SYS_FALLOCATE = 47 + SYS_FACCESSAT = 48 + SYS_CHDIR = 49 + SYS_FCHDIR = 50 + SYS_CHROOT = 51 + SYS_FCHMOD = 52 + SYS_FCHMODAT = 53 + SYS_FCHOWNAT = 54 + SYS_FCHOWN = 55 + SYS_OPENAT = 56 + SYS_CLOSE = 57 + SYS_VHANGUP = 58 + SYS_PIPE2 = 59 + SYS_QUOTACTL = 60 + SYS_GETDENTS64 = 61 + SYS_LSEEK = 62 + SYS_READ = 63 + SYS_WRITE = 64 + SYS_READV = 65 + SYS_WRITEV = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_PREADV = 69 + SYS_PWRITEV = 70 + SYS_SENDFILE = 71 + SYS_PSELECT6 = 72 + SYS_PPOLL = 73 + SYS_SIGNALFD4 = 74 + SYS_VMSPLICE = 75 + SYS_SPLICE = 76 + SYS_TEE = 77 + SYS_READLINKAT = 78 + SYS_FSTATAT = 79 + SYS_FSTAT = 80 + SYS_SYNC = 81 + SYS_FSYNC = 82 + SYS_FDATASYNC = 83 + SYS_SYNC_FILE_RANGE = 84 + SYS_TIMERFD_CREATE = 85 + SYS_TIMERFD_SETTIME = 86 + SYS_TIMERFD_GETTIME = 87 + SYS_UTIMENSAT = 88 + SYS_ACCT = 89 + SYS_CAPGET = 90 + SYS_CAPSET = 91 + SYS_PERSONALITY = 92 + SYS_EXIT = 93 + SYS_EXIT_GROUP = 94 + SYS_WAITID = 95 + SYS_SET_TID_ADDRESS = 96 + SYS_UNSHARE = 97 + SYS_FUTEX = 98 + SYS_SET_ROBUST_LIST = 99 + SYS_GET_ROBUST_LIST = 100 + SYS_NANOSLEEP = 101 + SYS_GETITIMER = 102 + SYS_SETITIMER = 103 + SYS_KEXEC_LOAD = 104 + SYS_INIT_MODULE = 105 + SYS_DELETE_MODULE = 106 + SYS_TIMER_CREATE = 107 + SYS_TIMER_GETTIME = 108 + SYS_TIMER_GETOVERRUN = 109 + SYS_TIMER_SETTIME = 110 + SYS_TIMER_DELETE = 111 + SYS_CLOCK_SETTIME = 112 + SYS_CLOCK_GETTIME = 113 + SYS_CLOCK_GETRES = 114 + SYS_CLOCK_NANOSLEEP = 115 + SYS_SYSLOG = 116 + SYS_PTRACE = 117 + SYS_SCHED_SETPARAM = 118 + SYS_SCHED_SETSCHEDULER = 119 + SYS_SCHED_GETSCHEDULER = 120 + SYS_SCHED_GETPARAM = 121 + SYS_SCHED_SETAFFINITY = 122 + SYS_SCHED_GETAFFINITY = 123 + SYS_SCHED_YIELD = 124 + SYS_SCHED_GET_PRIORITY_MAX = 125 + SYS_SCHED_GET_PRIORITY_MIN = 126 + SYS_SCHED_RR_GET_INTERVAL = 127 + SYS_RESTART_SYSCALL = 128 + SYS_KILL = 129 + SYS_TKILL = 130 + SYS_TGKILL = 131 + SYS_SIGALTSTACK = 132 + SYS_RT_SIGSUSPEND = 133 + SYS_RT_SIGACTION = 134 + SYS_RT_SIGPROCMASK = 135 + SYS_RT_SIGPENDING = 136 + SYS_RT_SIGTIMEDWAIT = 137 + SYS_RT_SIGQUEUEINFO = 138 + SYS_RT_SIGRETURN = 139 + SYS_SETPRIORITY = 140 + SYS_GETPRIORITY = 141 + SYS_REBOOT = 142 + SYS_SETREGID = 143 + SYS_SETGID = 144 + SYS_SETREUID = 145 + SYS_SETUID = 146 + SYS_SETRESUID = 147 + SYS_GETRESUID = 148 + SYS_SETRESGID = 149 + SYS_GETRESGID = 150 + SYS_SETFSUID = 151 + SYS_SETFSGID = 152 + SYS_TIMES = 153 + SYS_SETPGID = 154 + SYS_GETPGID = 155 + SYS_GETSID = 156 + SYS_SETSID = 157 + SYS_GETGROUPS = 158 + SYS_SETGROUPS = 159 + SYS_UNAME = 160 + SYS_SETHOSTNAME = 161 + SYS_SETDOMAINNAME = 162 + SYS_GETRLIMIT = 163 + SYS_SETRLIMIT = 164 + SYS_GETRUSAGE = 165 + SYS_UMASK = 166 + SYS_PRCTL = 167 + SYS_GETCPU = 168 + SYS_GETTIMEOFDAY = 169 + SYS_SETTIMEOFDAY = 170 + SYS_ADJTIMEX = 171 + SYS_GETPID = 172 + SYS_GETPPID = 173 + SYS_GETUID = 174 + SYS_GETEUID = 175 + SYS_GETGID = 176 + SYS_GETEGID = 177 + SYS_GETTID = 178 + SYS_SYSINFO = 179 + SYS_MQ_OPEN = 180 + SYS_MQ_UNLINK = 181 + SYS_MQ_TIMEDSEND = 182 + SYS_MQ_TIMEDRECEIVE = 183 + SYS_MQ_NOTIFY = 184 + SYS_MQ_GETSETATTR = 185 + SYS_MSGGET = 186 + SYS_MSGCTL = 187 + SYS_MSGRCV = 188 + SYS_MSGSND = 189 + SYS_SEMGET = 190 + SYS_SEMCTL = 191 + SYS_SEMTIMEDOP = 192 + SYS_SEMOP = 193 + SYS_SHMGET = 194 + SYS_SHMCTL = 195 + SYS_SHMAT = 196 + SYS_SHMDT = 197 + SYS_SOCKET = 198 + SYS_SOCKETPAIR = 199 + SYS_BIND = 200 + SYS_LISTEN = 201 + SYS_ACCEPT = 202 + SYS_CONNECT = 203 + SYS_GETSOCKNAME = 204 + SYS_GETPEERNAME = 205 + SYS_SENDTO = 206 + SYS_RECVFROM = 207 + SYS_SETSOCKOPT = 208 + SYS_GETSOCKOPT = 209 + SYS_SHUTDOWN = 210 + SYS_SENDMSG = 211 + SYS_RECVMSG = 212 + SYS_READAHEAD = 213 + SYS_BRK = 214 + SYS_MUNMAP = 215 + SYS_MREMAP = 216 + SYS_ADD_KEY = 217 + SYS_REQUEST_KEY = 218 + SYS_KEYCTL = 219 + SYS_CLONE = 220 + SYS_EXECVE = 221 + SYS_MMAP = 222 + SYS_FADVISE64 = 223 + SYS_SWAPON = 224 + SYS_SWAPOFF = 225 + SYS_MPROTECT = 226 + SYS_MSYNC = 227 + SYS_MLOCK = 228 + SYS_MUNLOCK = 229 + SYS_MLOCKALL = 230 + SYS_MUNLOCKALL = 231 + SYS_MINCORE = 232 + SYS_MADVISE = 233 + SYS_REMAP_FILE_PAGES = 234 + SYS_MBIND = 235 + SYS_GET_MEMPOLICY = 236 + SYS_SET_MEMPOLICY = 237 + SYS_MIGRATE_PAGES = 238 + SYS_MOVE_PAGES = 239 + SYS_RT_TGSIGQUEUEINFO = 240 + SYS_PERF_EVENT_OPEN = 241 + SYS_ACCEPT4 = 242 + SYS_RECVMMSG = 243 + SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_WAIT4 = 260 + SYS_PRLIMIT64 = 261 + SYS_FANOTIFY_INIT = 262 + SYS_FANOTIFY_MARK = 263 + SYS_NAME_TO_HANDLE_AT = 264 + SYS_OPEN_BY_HANDLE_AT = 265 + SYS_CLOCK_ADJTIME = 266 + SYS_SYNCFS = 267 + SYS_SETNS = 268 + SYS_SENDMMSG = 269 + SYS_PROCESS_VM_READV = 270 + SYS_PROCESS_VM_WRITEV = 271 + SYS_KCMP = 272 + SYS_FINIT_MODULE = 273 + SYS_SCHED_SETATTR = 274 + SYS_SCHED_GETATTR = 275 + SYS_RENAMEAT2 = 276 + SYS_SECCOMP = 277 + SYS_GETRANDOM = 278 + SYS_MEMFD_CREATE = 279 + SYS_BPF = 280 + SYS_EXECVEAT = 281 + SYS_USERFAULTFD = 282 + SYS_MEMBARRIER = 283 + SYS_MLOCK2 = 284 + SYS_COPY_FILE_RANGE = 285 + SYS_PREADV2 = 286 + SYS_PWRITEV2 = 287 + SYS_PKEY_MPROTECT = 288 + SYS_PKEY_ALLOC = 289 + SYS_PKEY_FREE = 290 + SYS_STATX = 291 + SYS_IO_PGETEVENTS = 292 + SYS_RSEQ = 293 + SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index eeff7e1d..026695ab 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips && linux // +build mips,linux package unix @@ -421,4 +422,10 @@ const ( SYS_PIDFD_GETFD = 4438 SYS_FACCESSAT2 = 4439 SYS_PROCESS_MADVISE = 4440 + SYS_EPOLL_PWAIT2 = 4441 + SYS_MOUNT_SETATTR = 4442 + SYS_QUOTACTL_FD = 4443 + SYS_LANDLOCK_CREATE_RULESET = 4444 + SYS_LANDLOCK_ADD_RULE = 4445 + SYS_LANDLOCK_RESTRICT_SELF = 4446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 73cfa535..7320ba95 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -1,354 +1,361 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && linux // +build mips64,linux package unix const ( - SYS_READ = 5000 - SYS_WRITE = 5001 - SYS_OPEN = 5002 - SYS_CLOSE = 5003 - SYS_STAT = 5004 - SYS_FSTAT = 5005 - SYS_LSTAT = 5006 - SYS_POLL = 5007 - SYS_LSEEK = 5008 - SYS_MMAP = 5009 - SYS_MPROTECT = 5010 - SYS_MUNMAP = 5011 - SYS_BRK = 5012 - SYS_RT_SIGACTION = 5013 - SYS_RT_SIGPROCMASK = 5014 - SYS_IOCTL = 5015 - SYS_PREAD64 = 5016 - SYS_PWRITE64 = 5017 - SYS_READV = 5018 - SYS_WRITEV = 5019 - SYS_ACCESS = 5020 - SYS_PIPE = 5021 - SYS__NEWSELECT = 5022 - SYS_SCHED_YIELD = 5023 - SYS_MREMAP = 5024 - SYS_MSYNC = 5025 - SYS_MINCORE = 5026 - SYS_MADVISE = 5027 - SYS_SHMGET = 5028 - SYS_SHMAT = 5029 - SYS_SHMCTL = 5030 - SYS_DUP = 5031 - SYS_DUP2 = 5032 - SYS_PAUSE = 5033 - SYS_NANOSLEEP = 5034 - SYS_GETITIMER = 5035 - SYS_SETITIMER = 5036 - SYS_ALARM = 5037 - SYS_GETPID = 5038 - SYS_SENDFILE = 5039 - SYS_SOCKET = 5040 - SYS_CONNECT = 5041 - SYS_ACCEPT = 5042 - SYS_SENDTO = 5043 - SYS_RECVFROM = 5044 - SYS_SENDMSG = 5045 - SYS_RECVMSG = 5046 - SYS_SHUTDOWN = 5047 - SYS_BIND = 5048 - SYS_LISTEN = 5049 - SYS_GETSOCKNAME = 5050 - SYS_GETPEERNAME = 5051 - SYS_SOCKETPAIR = 5052 - SYS_SETSOCKOPT = 5053 - SYS_GETSOCKOPT = 5054 - SYS_CLONE = 5055 - SYS_FORK = 5056 - SYS_EXECVE = 5057 - SYS_EXIT = 5058 - SYS_WAIT4 = 5059 - SYS_KILL = 5060 - SYS_UNAME = 5061 - SYS_SEMGET = 5062 - SYS_SEMOP = 5063 - SYS_SEMCTL = 5064 - SYS_SHMDT = 5065 - SYS_MSGGET = 5066 - SYS_MSGSND = 5067 - SYS_MSGRCV = 5068 - SYS_MSGCTL = 5069 - SYS_FCNTL = 5070 - SYS_FLOCK = 5071 - SYS_FSYNC = 5072 - SYS_FDATASYNC = 5073 - SYS_TRUNCATE = 5074 - SYS_FTRUNCATE = 5075 - SYS_GETDENTS = 5076 - SYS_GETCWD = 5077 - SYS_CHDIR = 5078 - SYS_FCHDIR = 5079 - SYS_RENAME = 5080 - SYS_MKDIR = 5081 - SYS_RMDIR = 5082 - SYS_CREAT = 5083 - SYS_LINK = 5084 - SYS_UNLINK = 5085 - SYS_SYMLINK = 5086 - SYS_READLINK = 5087 - SYS_CHMOD = 5088 - SYS_FCHMOD = 5089 - SYS_CHOWN = 5090 - SYS_FCHOWN = 5091 - SYS_LCHOWN = 5092 - SYS_UMASK = 5093 - SYS_GETTIMEOFDAY = 5094 - SYS_GETRLIMIT = 5095 - SYS_GETRUSAGE = 5096 - SYS_SYSINFO = 5097 - SYS_TIMES = 5098 - SYS_PTRACE = 5099 - SYS_GETUID = 5100 - SYS_SYSLOG = 5101 - SYS_GETGID = 5102 - SYS_SETUID = 5103 - SYS_SETGID = 5104 - SYS_GETEUID = 5105 - SYS_GETEGID = 5106 - SYS_SETPGID = 5107 - SYS_GETPPID = 5108 - SYS_GETPGRP = 5109 - SYS_SETSID = 5110 - SYS_SETREUID = 5111 - SYS_SETREGID = 5112 - SYS_GETGROUPS = 5113 - SYS_SETGROUPS = 5114 - SYS_SETRESUID = 5115 - SYS_GETRESUID = 5116 - SYS_SETRESGID = 5117 - SYS_GETRESGID = 5118 - SYS_GETPGID = 5119 - SYS_SETFSUID = 5120 - SYS_SETFSGID = 5121 - SYS_GETSID = 5122 - SYS_CAPGET = 5123 - SYS_CAPSET = 5124 - SYS_RT_SIGPENDING = 5125 - SYS_RT_SIGTIMEDWAIT = 5126 - SYS_RT_SIGQUEUEINFO = 5127 - SYS_RT_SIGSUSPEND = 5128 - SYS_SIGALTSTACK = 5129 - SYS_UTIME = 5130 - SYS_MKNOD = 5131 - SYS_PERSONALITY = 5132 - SYS_USTAT = 5133 - SYS_STATFS = 5134 - SYS_FSTATFS = 5135 - SYS_SYSFS = 5136 - SYS_GETPRIORITY = 5137 - SYS_SETPRIORITY = 5138 - SYS_SCHED_SETPARAM = 5139 - SYS_SCHED_GETPARAM = 5140 - SYS_SCHED_SETSCHEDULER = 5141 - SYS_SCHED_GETSCHEDULER = 5142 - SYS_SCHED_GET_PRIORITY_MAX = 5143 - SYS_SCHED_GET_PRIORITY_MIN = 5144 - SYS_SCHED_RR_GET_INTERVAL = 5145 - SYS_MLOCK = 5146 - SYS_MUNLOCK = 5147 - SYS_MLOCKALL = 5148 - SYS_MUNLOCKALL = 5149 - SYS_VHANGUP = 5150 - SYS_PIVOT_ROOT = 5151 - SYS__SYSCTL = 5152 - SYS_PRCTL = 5153 - SYS_ADJTIMEX = 5154 - SYS_SETRLIMIT = 5155 - SYS_CHROOT = 5156 - SYS_SYNC = 5157 - SYS_ACCT = 5158 - SYS_SETTIMEOFDAY = 5159 - SYS_MOUNT = 5160 - SYS_UMOUNT2 = 5161 - SYS_SWAPON = 5162 - SYS_SWAPOFF = 5163 - SYS_REBOOT = 5164 - SYS_SETHOSTNAME = 5165 - SYS_SETDOMAINNAME = 5166 - SYS_CREATE_MODULE = 5167 - SYS_INIT_MODULE = 5168 - SYS_DELETE_MODULE = 5169 - SYS_GET_KERNEL_SYMS = 5170 - SYS_QUERY_MODULE = 5171 - SYS_QUOTACTL = 5172 - SYS_NFSSERVCTL = 5173 - SYS_GETPMSG = 5174 - SYS_PUTPMSG = 5175 - SYS_AFS_SYSCALL = 5176 - SYS_RESERVED177 = 5177 - SYS_GETTID = 5178 - SYS_READAHEAD = 5179 - SYS_SETXATTR = 5180 - SYS_LSETXATTR = 5181 - SYS_FSETXATTR = 5182 - SYS_GETXATTR = 5183 - SYS_LGETXATTR = 5184 - SYS_FGETXATTR = 5185 - SYS_LISTXATTR = 5186 - SYS_LLISTXATTR = 5187 - SYS_FLISTXATTR = 5188 - SYS_REMOVEXATTR = 5189 - SYS_LREMOVEXATTR = 5190 - SYS_FREMOVEXATTR = 5191 - SYS_TKILL = 5192 - SYS_RESERVED193 = 5193 - SYS_FUTEX = 5194 - SYS_SCHED_SETAFFINITY = 5195 - SYS_SCHED_GETAFFINITY = 5196 - SYS_CACHEFLUSH = 5197 - SYS_CACHECTL = 5198 - SYS_SYSMIPS = 5199 - SYS_IO_SETUP = 5200 - SYS_IO_DESTROY = 5201 - SYS_IO_GETEVENTS = 5202 - SYS_IO_SUBMIT = 5203 - SYS_IO_CANCEL = 5204 - SYS_EXIT_GROUP = 5205 - SYS_LOOKUP_DCOOKIE = 5206 - SYS_EPOLL_CREATE = 5207 - SYS_EPOLL_CTL = 5208 - SYS_EPOLL_WAIT = 5209 - SYS_REMAP_FILE_PAGES = 5210 - SYS_RT_SIGRETURN = 5211 - SYS_SET_TID_ADDRESS = 5212 - SYS_RESTART_SYSCALL = 5213 - SYS_SEMTIMEDOP = 5214 - SYS_FADVISE64 = 5215 - SYS_TIMER_CREATE = 5216 - SYS_TIMER_SETTIME = 5217 - SYS_TIMER_GETTIME = 5218 - SYS_TIMER_GETOVERRUN = 5219 - SYS_TIMER_DELETE = 5220 - SYS_CLOCK_SETTIME = 5221 - SYS_CLOCK_GETTIME = 5222 - SYS_CLOCK_GETRES = 5223 - SYS_CLOCK_NANOSLEEP = 5224 - SYS_TGKILL = 5225 - SYS_UTIMES = 5226 - SYS_MBIND = 5227 - SYS_GET_MEMPOLICY = 5228 - SYS_SET_MEMPOLICY = 5229 - SYS_MQ_OPEN = 5230 - SYS_MQ_UNLINK = 5231 - SYS_MQ_TIMEDSEND = 5232 - SYS_MQ_TIMEDRECEIVE = 5233 - SYS_MQ_NOTIFY = 5234 - SYS_MQ_GETSETATTR = 5235 - SYS_VSERVER = 5236 - SYS_WAITID = 5237 - SYS_ADD_KEY = 5239 - SYS_REQUEST_KEY = 5240 - SYS_KEYCTL = 5241 - SYS_SET_THREAD_AREA = 5242 - SYS_INOTIFY_INIT = 5243 - SYS_INOTIFY_ADD_WATCH = 5244 - SYS_INOTIFY_RM_WATCH = 5245 - SYS_MIGRATE_PAGES = 5246 - SYS_OPENAT = 5247 - SYS_MKDIRAT = 5248 - SYS_MKNODAT = 5249 - SYS_FCHOWNAT = 5250 - SYS_FUTIMESAT = 5251 - SYS_NEWFSTATAT = 5252 - SYS_UNLINKAT = 5253 - SYS_RENAMEAT = 5254 - SYS_LINKAT = 5255 - SYS_SYMLINKAT = 5256 - SYS_READLINKAT = 5257 - SYS_FCHMODAT = 5258 - SYS_FACCESSAT = 5259 - SYS_PSELECT6 = 5260 - SYS_PPOLL = 5261 - SYS_UNSHARE = 5262 - SYS_SPLICE = 5263 - SYS_SYNC_FILE_RANGE = 5264 - SYS_TEE = 5265 - SYS_VMSPLICE = 5266 - SYS_MOVE_PAGES = 5267 - SYS_SET_ROBUST_LIST = 5268 - SYS_GET_ROBUST_LIST = 5269 - SYS_KEXEC_LOAD = 5270 - SYS_GETCPU = 5271 - SYS_EPOLL_PWAIT = 5272 - SYS_IOPRIO_SET = 5273 - SYS_IOPRIO_GET = 5274 - SYS_UTIMENSAT = 5275 - SYS_SIGNALFD = 5276 - SYS_TIMERFD = 5277 - SYS_EVENTFD = 5278 - SYS_FALLOCATE = 5279 - SYS_TIMERFD_CREATE = 5280 - SYS_TIMERFD_GETTIME = 5281 - SYS_TIMERFD_SETTIME = 5282 - SYS_SIGNALFD4 = 5283 - SYS_EVENTFD2 = 5284 - SYS_EPOLL_CREATE1 = 5285 - SYS_DUP3 = 5286 - SYS_PIPE2 = 5287 - SYS_INOTIFY_INIT1 = 5288 - SYS_PREADV = 5289 - SYS_PWRITEV = 5290 - SYS_RT_TGSIGQUEUEINFO = 5291 - SYS_PERF_EVENT_OPEN = 5292 - SYS_ACCEPT4 = 5293 - SYS_RECVMMSG = 5294 - SYS_FANOTIFY_INIT = 5295 - SYS_FANOTIFY_MARK = 5296 - SYS_PRLIMIT64 = 5297 - SYS_NAME_TO_HANDLE_AT = 5298 - SYS_OPEN_BY_HANDLE_AT = 5299 - SYS_CLOCK_ADJTIME = 5300 - SYS_SYNCFS = 5301 - SYS_SENDMMSG = 5302 - SYS_SETNS = 5303 - SYS_PROCESS_VM_READV = 5304 - SYS_PROCESS_VM_WRITEV = 5305 - SYS_KCMP = 5306 - SYS_FINIT_MODULE = 5307 - SYS_GETDENTS64 = 5308 - SYS_SCHED_SETATTR = 5309 - SYS_SCHED_GETATTR = 5310 - SYS_RENAMEAT2 = 5311 - SYS_SECCOMP = 5312 - SYS_GETRANDOM = 5313 - SYS_MEMFD_CREATE = 5314 - SYS_BPF = 5315 - SYS_EXECVEAT = 5316 - SYS_USERFAULTFD = 5317 - SYS_MEMBARRIER = 5318 - SYS_MLOCK2 = 5319 - SYS_COPY_FILE_RANGE = 5320 - SYS_PREADV2 = 5321 - SYS_PWRITEV2 = 5322 - SYS_PKEY_MPROTECT = 5323 - SYS_PKEY_ALLOC = 5324 - SYS_PKEY_FREE = 5325 - SYS_STATX = 5326 - SYS_RSEQ = 5327 - SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 - SYS_PIDFD_OPEN = 5434 - SYS_CLONE3 = 5435 - SYS_CLOSE_RANGE = 5436 - SYS_OPENAT2 = 5437 - SYS_PIDFD_GETFD = 5438 - SYS_FACCESSAT2 = 5439 - SYS_PROCESS_MADVISE = 5440 + SYS_READ = 5000 + SYS_WRITE = 5001 + SYS_OPEN = 5002 + SYS_CLOSE = 5003 + SYS_STAT = 5004 + SYS_FSTAT = 5005 + SYS_LSTAT = 5006 + SYS_POLL = 5007 + SYS_LSEEK = 5008 + SYS_MMAP = 5009 + SYS_MPROTECT = 5010 + SYS_MUNMAP = 5011 + SYS_BRK = 5012 + SYS_RT_SIGACTION = 5013 + SYS_RT_SIGPROCMASK = 5014 + SYS_IOCTL = 5015 + SYS_PREAD64 = 5016 + SYS_PWRITE64 = 5017 + SYS_READV = 5018 + SYS_WRITEV = 5019 + SYS_ACCESS = 5020 + SYS_PIPE = 5021 + SYS__NEWSELECT = 5022 + SYS_SCHED_YIELD = 5023 + SYS_MREMAP = 5024 + SYS_MSYNC = 5025 + SYS_MINCORE = 5026 + SYS_MADVISE = 5027 + SYS_SHMGET = 5028 + SYS_SHMAT = 5029 + SYS_SHMCTL = 5030 + SYS_DUP = 5031 + SYS_DUP2 = 5032 + SYS_PAUSE = 5033 + SYS_NANOSLEEP = 5034 + SYS_GETITIMER = 5035 + SYS_SETITIMER = 5036 + SYS_ALARM = 5037 + SYS_GETPID = 5038 + SYS_SENDFILE = 5039 + SYS_SOCKET = 5040 + SYS_CONNECT = 5041 + SYS_ACCEPT = 5042 + SYS_SENDTO = 5043 + SYS_RECVFROM = 5044 + SYS_SENDMSG = 5045 + SYS_RECVMSG = 5046 + SYS_SHUTDOWN = 5047 + SYS_BIND = 5048 + SYS_LISTEN = 5049 + SYS_GETSOCKNAME = 5050 + SYS_GETPEERNAME = 5051 + SYS_SOCKETPAIR = 5052 + SYS_SETSOCKOPT = 5053 + SYS_GETSOCKOPT = 5054 + SYS_CLONE = 5055 + SYS_FORK = 5056 + SYS_EXECVE = 5057 + SYS_EXIT = 5058 + SYS_WAIT4 = 5059 + SYS_KILL = 5060 + SYS_UNAME = 5061 + SYS_SEMGET = 5062 + SYS_SEMOP = 5063 + SYS_SEMCTL = 5064 + SYS_SHMDT = 5065 + SYS_MSGGET = 5066 + SYS_MSGSND = 5067 + SYS_MSGRCV = 5068 + SYS_MSGCTL = 5069 + SYS_FCNTL = 5070 + SYS_FLOCK = 5071 + SYS_FSYNC = 5072 + SYS_FDATASYNC = 5073 + SYS_TRUNCATE = 5074 + SYS_FTRUNCATE = 5075 + SYS_GETDENTS = 5076 + SYS_GETCWD = 5077 + SYS_CHDIR = 5078 + SYS_FCHDIR = 5079 + SYS_RENAME = 5080 + SYS_MKDIR = 5081 + SYS_RMDIR = 5082 + SYS_CREAT = 5083 + SYS_LINK = 5084 + SYS_UNLINK = 5085 + SYS_SYMLINK = 5086 + SYS_READLINK = 5087 + SYS_CHMOD = 5088 + SYS_FCHMOD = 5089 + SYS_CHOWN = 5090 + SYS_FCHOWN = 5091 + SYS_LCHOWN = 5092 + SYS_UMASK = 5093 + SYS_GETTIMEOFDAY = 5094 + SYS_GETRLIMIT = 5095 + SYS_GETRUSAGE = 5096 + SYS_SYSINFO = 5097 + SYS_TIMES = 5098 + SYS_PTRACE = 5099 + SYS_GETUID = 5100 + SYS_SYSLOG = 5101 + SYS_GETGID = 5102 + SYS_SETUID = 5103 + SYS_SETGID = 5104 + SYS_GETEUID = 5105 + SYS_GETEGID = 5106 + SYS_SETPGID = 5107 + SYS_GETPPID = 5108 + SYS_GETPGRP = 5109 + SYS_SETSID = 5110 + SYS_SETREUID = 5111 + SYS_SETREGID = 5112 + SYS_GETGROUPS = 5113 + SYS_SETGROUPS = 5114 + SYS_SETRESUID = 5115 + SYS_GETRESUID = 5116 + SYS_SETRESGID = 5117 + SYS_GETRESGID = 5118 + SYS_GETPGID = 5119 + SYS_SETFSUID = 5120 + SYS_SETFSGID = 5121 + SYS_GETSID = 5122 + SYS_CAPGET = 5123 + SYS_CAPSET = 5124 + SYS_RT_SIGPENDING = 5125 + SYS_RT_SIGTIMEDWAIT = 5126 + SYS_RT_SIGQUEUEINFO = 5127 + SYS_RT_SIGSUSPEND = 5128 + SYS_SIGALTSTACK = 5129 + SYS_UTIME = 5130 + SYS_MKNOD = 5131 + SYS_PERSONALITY = 5132 + SYS_USTAT = 5133 + SYS_STATFS = 5134 + SYS_FSTATFS = 5135 + SYS_SYSFS = 5136 + SYS_GETPRIORITY = 5137 + SYS_SETPRIORITY = 5138 + SYS_SCHED_SETPARAM = 5139 + SYS_SCHED_GETPARAM = 5140 + SYS_SCHED_SETSCHEDULER = 5141 + SYS_SCHED_GETSCHEDULER = 5142 + SYS_SCHED_GET_PRIORITY_MAX = 5143 + SYS_SCHED_GET_PRIORITY_MIN = 5144 + SYS_SCHED_RR_GET_INTERVAL = 5145 + SYS_MLOCK = 5146 + SYS_MUNLOCK = 5147 + SYS_MLOCKALL = 5148 + SYS_MUNLOCKALL = 5149 + SYS_VHANGUP = 5150 + SYS_PIVOT_ROOT = 5151 + SYS__SYSCTL = 5152 + SYS_PRCTL = 5153 + SYS_ADJTIMEX = 5154 + SYS_SETRLIMIT = 5155 + SYS_CHROOT = 5156 + SYS_SYNC = 5157 + SYS_ACCT = 5158 + SYS_SETTIMEOFDAY = 5159 + SYS_MOUNT = 5160 + SYS_UMOUNT2 = 5161 + SYS_SWAPON = 5162 + SYS_SWAPOFF = 5163 + SYS_REBOOT = 5164 + SYS_SETHOSTNAME = 5165 + SYS_SETDOMAINNAME = 5166 + SYS_CREATE_MODULE = 5167 + SYS_INIT_MODULE = 5168 + SYS_DELETE_MODULE = 5169 + SYS_GET_KERNEL_SYMS = 5170 + SYS_QUERY_MODULE = 5171 + SYS_QUOTACTL = 5172 + SYS_NFSSERVCTL = 5173 + SYS_GETPMSG = 5174 + SYS_PUTPMSG = 5175 + SYS_AFS_SYSCALL = 5176 + SYS_RESERVED177 = 5177 + SYS_GETTID = 5178 + SYS_READAHEAD = 5179 + SYS_SETXATTR = 5180 + SYS_LSETXATTR = 5181 + SYS_FSETXATTR = 5182 + SYS_GETXATTR = 5183 + SYS_LGETXATTR = 5184 + SYS_FGETXATTR = 5185 + SYS_LISTXATTR = 5186 + SYS_LLISTXATTR = 5187 + SYS_FLISTXATTR = 5188 + SYS_REMOVEXATTR = 5189 + SYS_LREMOVEXATTR = 5190 + SYS_FREMOVEXATTR = 5191 + SYS_TKILL = 5192 + SYS_RESERVED193 = 5193 + SYS_FUTEX = 5194 + SYS_SCHED_SETAFFINITY = 5195 + SYS_SCHED_GETAFFINITY = 5196 + SYS_CACHEFLUSH = 5197 + SYS_CACHECTL = 5198 + SYS_SYSMIPS = 5199 + SYS_IO_SETUP = 5200 + SYS_IO_DESTROY = 5201 + SYS_IO_GETEVENTS = 5202 + SYS_IO_SUBMIT = 5203 + SYS_IO_CANCEL = 5204 + SYS_EXIT_GROUP = 5205 + SYS_LOOKUP_DCOOKIE = 5206 + SYS_EPOLL_CREATE = 5207 + SYS_EPOLL_CTL = 5208 + SYS_EPOLL_WAIT = 5209 + SYS_REMAP_FILE_PAGES = 5210 + SYS_RT_SIGRETURN = 5211 + SYS_SET_TID_ADDRESS = 5212 + SYS_RESTART_SYSCALL = 5213 + SYS_SEMTIMEDOP = 5214 + SYS_FADVISE64 = 5215 + SYS_TIMER_CREATE = 5216 + SYS_TIMER_SETTIME = 5217 + SYS_TIMER_GETTIME = 5218 + SYS_TIMER_GETOVERRUN = 5219 + SYS_TIMER_DELETE = 5220 + SYS_CLOCK_SETTIME = 5221 + SYS_CLOCK_GETTIME = 5222 + SYS_CLOCK_GETRES = 5223 + SYS_CLOCK_NANOSLEEP = 5224 + SYS_TGKILL = 5225 + SYS_UTIMES = 5226 + SYS_MBIND = 5227 + SYS_GET_MEMPOLICY = 5228 + SYS_SET_MEMPOLICY = 5229 + SYS_MQ_OPEN = 5230 + SYS_MQ_UNLINK = 5231 + SYS_MQ_TIMEDSEND = 5232 + SYS_MQ_TIMEDRECEIVE = 5233 + SYS_MQ_NOTIFY = 5234 + SYS_MQ_GETSETATTR = 5235 + SYS_VSERVER = 5236 + SYS_WAITID = 5237 + SYS_ADD_KEY = 5239 + SYS_REQUEST_KEY = 5240 + SYS_KEYCTL = 5241 + SYS_SET_THREAD_AREA = 5242 + SYS_INOTIFY_INIT = 5243 + SYS_INOTIFY_ADD_WATCH = 5244 + SYS_INOTIFY_RM_WATCH = 5245 + SYS_MIGRATE_PAGES = 5246 + SYS_OPENAT = 5247 + SYS_MKDIRAT = 5248 + SYS_MKNODAT = 5249 + SYS_FCHOWNAT = 5250 + SYS_FUTIMESAT = 5251 + SYS_NEWFSTATAT = 5252 + SYS_UNLINKAT = 5253 + SYS_RENAMEAT = 5254 + SYS_LINKAT = 5255 + SYS_SYMLINKAT = 5256 + SYS_READLINKAT = 5257 + SYS_FCHMODAT = 5258 + SYS_FACCESSAT = 5259 + SYS_PSELECT6 = 5260 + SYS_PPOLL = 5261 + SYS_UNSHARE = 5262 + SYS_SPLICE = 5263 + SYS_SYNC_FILE_RANGE = 5264 + SYS_TEE = 5265 + SYS_VMSPLICE = 5266 + SYS_MOVE_PAGES = 5267 + SYS_SET_ROBUST_LIST = 5268 + SYS_GET_ROBUST_LIST = 5269 + SYS_KEXEC_LOAD = 5270 + SYS_GETCPU = 5271 + SYS_EPOLL_PWAIT = 5272 + SYS_IOPRIO_SET = 5273 + SYS_IOPRIO_GET = 5274 + SYS_UTIMENSAT = 5275 + SYS_SIGNALFD = 5276 + SYS_TIMERFD = 5277 + SYS_EVENTFD = 5278 + SYS_FALLOCATE = 5279 + SYS_TIMERFD_CREATE = 5280 + SYS_TIMERFD_GETTIME = 5281 + SYS_TIMERFD_SETTIME = 5282 + SYS_SIGNALFD4 = 5283 + SYS_EVENTFD2 = 5284 + SYS_EPOLL_CREATE1 = 5285 + SYS_DUP3 = 5286 + SYS_PIPE2 = 5287 + SYS_INOTIFY_INIT1 = 5288 + SYS_PREADV = 5289 + SYS_PWRITEV = 5290 + SYS_RT_TGSIGQUEUEINFO = 5291 + SYS_PERF_EVENT_OPEN = 5292 + SYS_ACCEPT4 = 5293 + SYS_RECVMMSG = 5294 + SYS_FANOTIFY_INIT = 5295 + SYS_FANOTIFY_MARK = 5296 + SYS_PRLIMIT64 = 5297 + SYS_NAME_TO_HANDLE_AT = 5298 + SYS_OPEN_BY_HANDLE_AT = 5299 + SYS_CLOCK_ADJTIME = 5300 + SYS_SYNCFS = 5301 + SYS_SENDMMSG = 5302 + SYS_SETNS = 5303 + SYS_PROCESS_VM_READV = 5304 + SYS_PROCESS_VM_WRITEV = 5305 + SYS_KCMP = 5306 + SYS_FINIT_MODULE = 5307 + SYS_GETDENTS64 = 5308 + SYS_SCHED_SETATTR = 5309 + SYS_SCHED_GETATTR = 5310 + SYS_RENAMEAT2 = 5311 + SYS_SECCOMP = 5312 + SYS_GETRANDOM = 5313 + SYS_MEMFD_CREATE = 5314 + SYS_BPF = 5315 + SYS_EXECVEAT = 5316 + SYS_USERFAULTFD = 5317 + SYS_MEMBARRIER = 5318 + SYS_MLOCK2 = 5319 + SYS_COPY_FILE_RANGE = 5320 + SYS_PREADV2 = 5321 + SYS_PWRITEV2 = 5322 + SYS_PKEY_MPROTECT = 5323 + SYS_PKEY_ALLOC = 5324 + SYS_PKEY_FREE = 5325 + SYS_STATX = 5326 + SYS_RSEQ = 5327 + SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 + SYS_PIDFD_OPEN = 5434 + SYS_CLONE3 = 5435 + SYS_CLOSE_RANGE = 5436 + SYS_OPENAT2 = 5437 + SYS_PIDFD_GETFD = 5438 + SYS_FACCESSAT2 = 5439 + SYS_PROCESS_MADVISE = 5440 + SYS_EPOLL_PWAIT2 = 5441 + SYS_MOUNT_SETATTR = 5442 + SYS_QUOTACTL_FD = 5443 + SYS_LANDLOCK_CREATE_RULESET = 5444 + SYS_LANDLOCK_ADD_RULE = 5445 + SYS_LANDLOCK_RESTRICT_SELF = 5446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index be74729e..45082dd6 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -1,354 +1,361 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64le && linux // +build mips64le,linux package unix const ( - SYS_READ = 5000 - SYS_WRITE = 5001 - SYS_OPEN = 5002 - SYS_CLOSE = 5003 - SYS_STAT = 5004 - SYS_FSTAT = 5005 - SYS_LSTAT = 5006 - SYS_POLL = 5007 - SYS_LSEEK = 5008 - SYS_MMAP = 5009 - SYS_MPROTECT = 5010 - SYS_MUNMAP = 5011 - SYS_BRK = 5012 - SYS_RT_SIGACTION = 5013 - SYS_RT_SIGPROCMASK = 5014 - SYS_IOCTL = 5015 - SYS_PREAD64 = 5016 - SYS_PWRITE64 = 5017 - SYS_READV = 5018 - SYS_WRITEV = 5019 - SYS_ACCESS = 5020 - SYS_PIPE = 5021 - SYS__NEWSELECT = 5022 - SYS_SCHED_YIELD = 5023 - SYS_MREMAP = 5024 - SYS_MSYNC = 5025 - SYS_MINCORE = 5026 - SYS_MADVISE = 5027 - SYS_SHMGET = 5028 - SYS_SHMAT = 5029 - SYS_SHMCTL = 5030 - SYS_DUP = 5031 - SYS_DUP2 = 5032 - SYS_PAUSE = 5033 - SYS_NANOSLEEP = 5034 - SYS_GETITIMER = 5035 - SYS_SETITIMER = 5036 - SYS_ALARM = 5037 - SYS_GETPID = 5038 - SYS_SENDFILE = 5039 - SYS_SOCKET = 5040 - SYS_CONNECT = 5041 - SYS_ACCEPT = 5042 - SYS_SENDTO = 5043 - SYS_RECVFROM = 5044 - SYS_SENDMSG = 5045 - SYS_RECVMSG = 5046 - SYS_SHUTDOWN = 5047 - SYS_BIND = 5048 - SYS_LISTEN = 5049 - SYS_GETSOCKNAME = 5050 - SYS_GETPEERNAME = 5051 - SYS_SOCKETPAIR = 5052 - SYS_SETSOCKOPT = 5053 - SYS_GETSOCKOPT = 5054 - SYS_CLONE = 5055 - SYS_FORK = 5056 - SYS_EXECVE = 5057 - SYS_EXIT = 5058 - SYS_WAIT4 = 5059 - SYS_KILL = 5060 - SYS_UNAME = 5061 - SYS_SEMGET = 5062 - SYS_SEMOP = 5063 - SYS_SEMCTL = 5064 - SYS_SHMDT = 5065 - SYS_MSGGET = 5066 - SYS_MSGSND = 5067 - SYS_MSGRCV = 5068 - SYS_MSGCTL = 5069 - SYS_FCNTL = 5070 - SYS_FLOCK = 5071 - SYS_FSYNC = 5072 - SYS_FDATASYNC = 5073 - SYS_TRUNCATE = 5074 - SYS_FTRUNCATE = 5075 - SYS_GETDENTS = 5076 - SYS_GETCWD = 5077 - SYS_CHDIR = 5078 - SYS_FCHDIR = 5079 - SYS_RENAME = 5080 - SYS_MKDIR = 5081 - SYS_RMDIR = 5082 - SYS_CREAT = 5083 - SYS_LINK = 5084 - SYS_UNLINK = 5085 - SYS_SYMLINK = 5086 - SYS_READLINK = 5087 - SYS_CHMOD = 5088 - SYS_FCHMOD = 5089 - SYS_CHOWN = 5090 - SYS_FCHOWN = 5091 - SYS_LCHOWN = 5092 - SYS_UMASK = 5093 - SYS_GETTIMEOFDAY = 5094 - SYS_GETRLIMIT = 5095 - SYS_GETRUSAGE = 5096 - SYS_SYSINFO = 5097 - SYS_TIMES = 5098 - SYS_PTRACE = 5099 - SYS_GETUID = 5100 - SYS_SYSLOG = 5101 - SYS_GETGID = 5102 - SYS_SETUID = 5103 - SYS_SETGID = 5104 - SYS_GETEUID = 5105 - SYS_GETEGID = 5106 - SYS_SETPGID = 5107 - SYS_GETPPID = 5108 - SYS_GETPGRP = 5109 - SYS_SETSID = 5110 - SYS_SETREUID = 5111 - SYS_SETREGID = 5112 - SYS_GETGROUPS = 5113 - SYS_SETGROUPS = 5114 - SYS_SETRESUID = 5115 - SYS_GETRESUID = 5116 - SYS_SETRESGID = 5117 - SYS_GETRESGID = 5118 - SYS_GETPGID = 5119 - SYS_SETFSUID = 5120 - SYS_SETFSGID = 5121 - SYS_GETSID = 5122 - SYS_CAPGET = 5123 - SYS_CAPSET = 5124 - SYS_RT_SIGPENDING = 5125 - SYS_RT_SIGTIMEDWAIT = 5126 - SYS_RT_SIGQUEUEINFO = 5127 - SYS_RT_SIGSUSPEND = 5128 - SYS_SIGALTSTACK = 5129 - SYS_UTIME = 5130 - SYS_MKNOD = 5131 - SYS_PERSONALITY = 5132 - SYS_USTAT = 5133 - SYS_STATFS = 5134 - SYS_FSTATFS = 5135 - SYS_SYSFS = 5136 - SYS_GETPRIORITY = 5137 - SYS_SETPRIORITY = 5138 - SYS_SCHED_SETPARAM = 5139 - SYS_SCHED_GETPARAM = 5140 - SYS_SCHED_SETSCHEDULER = 5141 - SYS_SCHED_GETSCHEDULER = 5142 - SYS_SCHED_GET_PRIORITY_MAX = 5143 - SYS_SCHED_GET_PRIORITY_MIN = 5144 - SYS_SCHED_RR_GET_INTERVAL = 5145 - SYS_MLOCK = 5146 - SYS_MUNLOCK = 5147 - SYS_MLOCKALL = 5148 - SYS_MUNLOCKALL = 5149 - SYS_VHANGUP = 5150 - SYS_PIVOT_ROOT = 5151 - SYS__SYSCTL = 5152 - SYS_PRCTL = 5153 - SYS_ADJTIMEX = 5154 - SYS_SETRLIMIT = 5155 - SYS_CHROOT = 5156 - SYS_SYNC = 5157 - SYS_ACCT = 5158 - SYS_SETTIMEOFDAY = 5159 - SYS_MOUNT = 5160 - SYS_UMOUNT2 = 5161 - SYS_SWAPON = 5162 - SYS_SWAPOFF = 5163 - SYS_REBOOT = 5164 - SYS_SETHOSTNAME = 5165 - SYS_SETDOMAINNAME = 5166 - SYS_CREATE_MODULE = 5167 - SYS_INIT_MODULE = 5168 - SYS_DELETE_MODULE = 5169 - SYS_GET_KERNEL_SYMS = 5170 - SYS_QUERY_MODULE = 5171 - SYS_QUOTACTL = 5172 - SYS_NFSSERVCTL = 5173 - SYS_GETPMSG = 5174 - SYS_PUTPMSG = 5175 - SYS_AFS_SYSCALL = 5176 - SYS_RESERVED177 = 5177 - SYS_GETTID = 5178 - SYS_READAHEAD = 5179 - SYS_SETXATTR = 5180 - SYS_LSETXATTR = 5181 - SYS_FSETXATTR = 5182 - SYS_GETXATTR = 5183 - SYS_LGETXATTR = 5184 - SYS_FGETXATTR = 5185 - SYS_LISTXATTR = 5186 - SYS_LLISTXATTR = 5187 - SYS_FLISTXATTR = 5188 - SYS_REMOVEXATTR = 5189 - SYS_LREMOVEXATTR = 5190 - SYS_FREMOVEXATTR = 5191 - SYS_TKILL = 5192 - SYS_RESERVED193 = 5193 - SYS_FUTEX = 5194 - SYS_SCHED_SETAFFINITY = 5195 - SYS_SCHED_GETAFFINITY = 5196 - SYS_CACHEFLUSH = 5197 - SYS_CACHECTL = 5198 - SYS_SYSMIPS = 5199 - SYS_IO_SETUP = 5200 - SYS_IO_DESTROY = 5201 - SYS_IO_GETEVENTS = 5202 - SYS_IO_SUBMIT = 5203 - SYS_IO_CANCEL = 5204 - SYS_EXIT_GROUP = 5205 - SYS_LOOKUP_DCOOKIE = 5206 - SYS_EPOLL_CREATE = 5207 - SYS_EPOLL_CTL = 5208 - SYS_EPOLL_WAIT = 5209 - SYS_REMAP_FILE_PAGES = 5210 - SYS_RT_SIGRETURN = 5211 - SYS_SET_TID_ADDRESS = 5212 - SYS_RESTART_SYSCALL = 5213 - SYS_SEMTIMEDOP = 5214 - SYS_FADVISE64 = 5215 - SYS_TIMER_CREATE = 5216 - SYS_TIMER_SETTIME = 5217 - SYS_TIMER_GETTIME = 5218 - SYS_TIMER_GETOVERRUN = 5219 - SYS_TIMER_DELETE = 5220 - SYS_CLOCK_SETTIME = 5221 - SYS_CLOCK_GETTIME = 5222 - SYS_CLOCK_GETRES = 5223 - SYS_CLOCK_NANOSLEEP = 5224 - SYS_TGKILL = 5225 - SYS_UTIMES = 5226 - SYS_MBIND = 5227 - SYS_GET_MEMPOLICY = 5228 - SYS_SET_MEMPOLICY = 5229 - SYS_MQ_OPEN = 5230 - SYS_MQ_UNLINK = 5231 - SYS_MQ_TIMEDSEND = 5232 - SYS_MQ_TIMEDRECEIVE = 5233 - SYS_MQ_NOTIFY = 5234 - SYS_MQ_GETSETATTR = 5235 - SYS_VSERVER = 5236 - SYS_WAITID = 5237 - SYS_ADD_KEY = 5239 - SYS_REQUEST_KEY = 5240 - SYS_KEYCTL = 5241 - SYS_SET_THREAD_AREA = 5242 - SYS_INOTIFY_INIT = 5243 - SYS_INOTIFY_ADD_WATCH = 5244 - SYS_INOTIFY_RM_WATCH = 5245 - SYS_MIGRATE_PAGES = 5246 - SYS_OPENAT = 5247 - SYS_MKDIRAT = 5248 - SYS_MKNODAT = 5249 - SYS_FCHOWNAT = 5250 - SYS_FUTIMESAT = 5251 - SYS_NEWFSTATAT = 5252 - SYS_UNLINKAT = 5253 - SYS_RENAMEAT = 5254 - SYS_LINKAT = 5255 - SYS_SYMLINKAT = 5256 - SYS_READLINKAT = 5257 - SYS_FCHMODAT = 5258 - SYS_FACCESSAT = 5259 - SYS_PSELECT6 = 5260 - SYS_PPOLL = 5261 - SYS_UNSHARE = 5262 - SYS_SPLICE = 5263 - SYS_SYNC_FILE_RANGE = 5264 - SYS_TEE = 5265 - SYS_VMSPLICE = 5266 - SYS_MOVE_PAGES = 5267 - SYS_SET_ROBUST_LIST = 5268 - SYS_GET_ROBUST_LIST = 5269 - SYS_KEXEC_LOAD = 5270 - SYS_GETCPU = 5271 - SYS_EPOLL_PWAIT = 5272 - SYS_IOPRIO_SET = 5273 - SYS_IOPRIO_GET = 5274 - SYS_UTIMENSAT = 5275 - SYS_SIGNALFD = 5276 - SYS_TIMERFD = 5277 - SYS_EVENTFD = 5278 - SYS_FALLOCATE = 5279 - SYS_TIMERFD_CREATE = 5280 - SYS_TIMERFD_GETTIME = 5281 - SYS_TIMERFD_SETTIME = 5282 - SYS_SIGNALFD4 = 5283 - SYS_EVENTFD2 = 5284 - SYS_EPOLL_CREATE1 = 5285 - SYS_DUP3 = 5286 - SYS_PIPE2 = 5287 - SYS_INOTIFY_INIT1 = 5288 - SYS_PREADV = 5289 - SYS_PWRITEV = 5290 - SYS_RT_TGSIGQUEUEINFO = 5291 - SYS_PERF_EVENT_OPEN = 5292 - SYS_ACCEPT4 = 5293 - SYS_RECVMMSG = 5294 - SYS_FANOTIFY_INIT = 5295 - SYS_FANOTIFY_MARK = 5296 - SYS_PRLIMIT64 = 5297 - SYS_NAME_TO_HANDLE_AT = 5298 - SYS_OPEN_BY_HANDLE_AT = 5299 - SYS_CLOCK_ADJTIME = 5300 - SYS_SYNCFS = 5301 - SYS_SENDMMSG = 5302 - SYS_SETNS = 5303 - SYS_PROCESS_VM_READV = 5304 - SYS_PROCESS_VM_WRITEV = 5305 - SYS_KCMP = 5306 - SYS_FINIT_MODULE = 5307 - SYS_GETDENTS64 = 5308 - SYS_SCHED_SETATTR = 5309 - SYS_SCHED_GETATTR = 5310 - SYS_RENAMEAT2 = 5311 - SYS_SECCOMP = 5312 - SYS_GETRANDOM = 5313 - SYS_MEMFD_CREATE = 5314 - SYS_BPF = 5315 - SYS_EXECVEAT = 5316 - SYS_USERFAULTFD = 5317 - SYS_MEMBARRIER = 5318 - SYS_MLOCK2 = 5319 - SYS_COPY_FILE_RANGE = 5320 - SYS_PREADV2 = 5321 - SYS_PWRITEV2 = 5322 - SYS_PKEY_MPROTECT = 5323 - SYS_PKEY_ALLOC = 5324 - SYS_PKEY_FREE = 5325 - SYS_STATX = 5326 - SYS_RSEQ = 5327 - SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 - SYS_PIDFD_OPEN = 5434 - SYS_CLONE3 = 5435 - SYS_CLOSE_RANGE = 5436 - SYS_OPENAT2 = 5437 - SYS_PIDFD_GETFD = 5438 - SYS_FACCESSAT2 = 5439 - SYS_PROCESS_MADVISE = 5440 + SYS_READ = 5000 + SYS_WRITE = 5001 + SYS_OPEN = 5002 + SYS_CLOSE = 5003 + SYS_STAT = 5004 + SYS_FSTAT = 5005 + SYS_LSTAT = 5006 + SYS_POLL = 5007 + SYS_LSEEK = 5008 + SYS_MMAP = 5009 + SYS_MPROTECT = 5010 + SYS_MUNMAP = 5011 + SYS_BRK = 5012 + SYS_RT_SIGACTION = 5013 + SYS_RT_SIGPROCMASK = 5014 + SYS_IOCTL = 5015 + SYS_PREAD64 = 5016 + SYS_PWRITE64 = 5017 + SYS_READV = 5018 + SYS_WRITEV = 5019 + SYS_ACCESS = 5020 + SYS_PIPE = 5021 + SYS__NEWSELECT = 5022 + SYS_SCHED_YIELD = 5023 + SYS_MREMAP = 5024 + SYS_MSYNC = 5025 + SYS_MINCORE = 5026 + SYS_MADVISE = 5027 + SYS_SHMGET = 5028 + SYS_SHMAT = 5029 + SYS_SHMCTL = 5030 + SYS_DUP = 5031 + SYS_DUP2 = 5032 + SYS_PAUSE = 5033 + SYS_NANOSLEEP = 5034 + SYS_GETITIMER = 5035 + SYS_SETITIMER = 5036 + SYS_ALARM = 5037 + SYS_GETPID = 5038 + SYS_SENDFILE = 5039 + SYS_SOCKET = 5040 + SYS_CONNECT = 5041 + SYS_ACCEPT = 5042 + SYS_SENDTO = 5043 + SYS_RECVFROM = 5044 + SYS_SENDMSG = 5045 + SYS_RECVMSG = 5046 + SYS_SHUTDOWN = 5047 + SYS_BIND = 5048 + SYS_LISTEN = 5049 + SYS_GETSOCKNAME = 5050 + SYS_GETPEERNAME = 5051 + SYS_SOCKETPAIR = 5052 + SYS_SETSOCKOPT = 5053 + SYS_GETSOCKOPT = 5054 + SYS_CLONE = 5055 + SYS_FORK = 5056 + SYS_EXECVE = 5057 + SYS_EXIT = 5058 + SYS_WAIT4 = 5059 + SYS_KILL = 5060 + SYS_UNAME = 5061 + SYS_SEMGET = 5062 + SYS_SEMOP = 5063 + SYS_SEMCTL = 5064 + SYS_SHMDT = 5065 + SYS_MSGGET = 5066 + SYS_MSGSND = 5067 + SYS_MSGRCV = 5068 + SYS_MSGCTL = 5069 + SYS_FCNTL = 5070 + SYS_FLOCK = 5071 + SYS_FSYNC = 5072 + SYS_FDATASYNC = 5073 + SYS_TRUNCATE = 5074 + SYS_FTRUNCATE = 5075 + SYS_GETDENTS = 5076 + SYS_GETCWD = 5077 + SYS_CHDIR = 5078 + SYS_FCHDIR = 5079 + SYS_RENAME = 5080 + SYS_MKDIR = 5081 + SYS_RMDIR = 5082 + SYS_CREAT = 5083 + SYS_LINK = 5084 + SYS_UNLINK = 5085 + SYS_SYMLINK = 5086 + SYS_READLINK = 5087 + SYS_CHMOD = 5088 + SYS_FCHMOD = 5089 + SYS_CHOWN = 5090 + SYS_FCHOWN = 5091 + SYS_LCHOWN = 5092 + SYS_UMASK = 5093 + SYS_GETTIMEOFDAY = 5094 + SYS_GETRLIMIT = 5095 + SYS_GETRUSAGE = 5096 + SYS_SYSINFO = 5097 + SYS_TIMES = 5098 + SYS_PTRACE = 5099 + SYS_GETUID = 5100 + SYS_SYSLOG = 5101 + SYS_GETGID = 5102 + SYS_SETUID = 5103 + SYS_SETGID = 5104 + SYS_GETEUID = 5105 + SYS_GETEGID = 5106 + SYS_SETPGID = 5107 + SYS_GETPPID = 5108 + SYS_GETPGRP = 5109 + SYS_SETSID = 5110 + SYS_SETREUID = 5111 + SYS_SETREGID = 5112 + SYS_GETGROUPS = 5113 + SYS_SETGROUPS = 5114 + SYS_SETRESUID = 5115 + SYS_GETRESUID = 5116 + SYS_SETRESGID = 5117 + SYS_GETRESGID = 5118 + SYS_GETPGID = 5119 + SYS_SETFSUID = 5120 + SYS_SETFSGID = 5121 + SYS_GETSID = 5122 + SYS_CAPGET = 5123 + SYS_CAPSET = 5124 + SYS_RT_SIGPENDING = 5125 + SYS_RT_SIGTIMEDWAIT = 5126 + SYS_RT_SIGQUEUEINFO = 5127 + SYS_RT_SIGSUSPEND = 5128 + SYS_SIGALTSTACK = 5129 + SYS_UTIME = 5130 + SYS_MKNOD = 5131 + SYS_PERSONALITY = 5132 + SYS_USTAT = 5133 + SYS_STATFS = 5134 + SYS_FSTATFS = 5135 + SYS_SYSFS = 5136 + SYS_GETPRIORITY = 5137 + SYS_SETPRIORITY = 5138 + SYS_SCHED_SETPARAM = 5139 + SYS_SCHED_GETPARAM = 5140 + SYS_SCHED_SETSCHEDULER = 5141 + SYS_SCHED_GETSCHEDULER = 5142 + SYS_SCHED_GET_PRIORITY_MAX = 5143 + SYS_SCHED_GET_PRIORITY_MIN = 5144 + SYS_SCHED_RR_GET_INTERVAL = 5145 + SYS_MLOCK = 5146 + SYS_MUNLOCK = 5147 + SYS_MLOCKALL = 5148 + SYS_MUNLOCKALL = 5149 + SYS_VHANGUP = 5150 + SYS_PIVOT_ROOT = 5151 + SYS__SYSCTL = 5152 + SYS_PRCTL = 5153 + SYS_ADJTIMEX = 5154 + SYS_SETRLIMIT = 5155 + SYS_CHROOT = 5156 + SYS_SYNC = 5157 + SYS_ACCT = 5158 + SYS_SETTIMEOFDAY = 5159 + SYS_MOUNT = 5160 + SYS_UMOUNT2 = 5161 + SYS_SWAPON = 5162 + SYS_SWAPOFF = 5163 + SYS_REBOOT = 5164 + SYS_SETHOSTNAME = 5165 + SYS_SETDOMAINNAME = 5166 + SYS_CREATE_MODULE = 5167 + SYS_INIT_MODULE = 5168 + SYS_DELETE_MODULE = 5169 + SYS_GET_KERNEL_SYMS = 5170 + SYS_QUERY_MODULE = 5171 + SYS_QUOTACTL = 5172 + SYS_NFSSERVCTL = 5173 + SYS_GETPMSG = 5174 + SYS_PUTPMSG = 5175 + SYS_AFS_SYSCALL = 5176 + SYS_RESERVED177 = 5177 + SYS_GETTID = 5178 + SYS_READAHEAD = 5179 + SYS_SETXATTR = 5180 + SYS_LSETXATTR = 5181 + SYS_FSETXATTR = 5182 + SYS_GETXATTR = 5183 + SYS_LGETXATTR = 5184 + SYS_FGETXATTR = 5185 + SYS_LISTXATTR = 5186 + SYS_LLISTXATTR = 5187 + SYS_FLISTXATTR = 5188 + SYS_REMOVEXATTR = 5189 + SYS_LREMOVEXATTR = 5190 + SYS_FREMOVEXATTR = 5191 + SYS_TKILL = 5192 + SYS_RESERVED193 = 5193 + SYS_FUTEX = 5194 + SYS_SCHED_SETAFFINITY = 5195 + SYS_SCHED_GETAFFINITY = 5196 + SYS_CACHEFLUSH = 5197 + SYS_CACHECTL = 5198 + SYS_SYSMIPS = 5199 + SYS_IO_SETUP = 5200 + SYS_IO_DESTROY = 5201 + SYS_IO_GETEVENTS = 5202 + SYS_IO_SUBMIT = 5203 + SYS_IO_CANCEL = 5204 + SYS_EXIT_GROUP = 5205 + SYS_LOOKUP_DCOOKIE = 5206 + SYS_EPOLL_CREATE = 5207 + SYS_EPOLL_CTL = 5208 + SYS_EPOLL_WAIT = 5209 + SYS_REMAP_FILE_PAGES = 5210 + SYS_RT_SIGRETURN = 5211 + SYS_SET_TID_ADDRESS = 5212 + SYS_RESTART_SYSCALL = 5213 + SYS_SEMTIMEDOP = 5214 + SYS_FADVISE64 = 5215 + SYS_TIMER_CREATE = 5216 + SYS_TIMER_SETTIME = 5217 + SYS_TIMER_GETTIME = 5218 + SYS_TIMER_GETOVERRUN = 5219 + SYS_TIMER_DELETE = 5220 + SYS_CLOCK_SETTIME = 5221 + SYS_CLOCK_GETTIME = 5222 + SYS_CLOCK_GETRES = 5223 + SYS_CLOCK_NANOSLEEP = 5224 + SYS_TGKILL = 5225 + SYS_UTIMES = 5226 + SYS_MBIND = 5227 + SYS_GET_MEMPOLICY = 5228 + SYS_SET_MEMPOLICY = 5229 + SYS_MQ_OPEN = 5230 + SYS_MQ_UNLINK = 5231 + SYS_MQ_TIMEDSEND = 5232 + SYS_MQ_TIMEDRECEIVE = 5233 + SYS_MQ_NOTIFY = 5234 + SYS_MQ_GETSETATTR = 5235 + SYS_VSERVER = 5236 + SYS_WAITID = 5237 + SYS_ADD_KEY = 5239 + SYS_REQUEST_KEY = 5240 + SYS_KEYCTL = 5241 + SYS_SET_THREAD_AREA = 5242 + SYS_INOTIFY_INIT = 5243 + SYS_INOTIFY_ADD_WATCH = 5244 + SYS_INOTIFY_RM_WATCH = 5245 + SYS_MIGRATE_PAGES = 5246 + SYS_OPENAT = 5247 + SYS_MKDIRAT = 5248 + SYS_MKNODAT = 5249 + SYS_FCHOWNAT = 5250 + SYS_FUTIMESAT = 5251 + SYS_NEWFSTATAT = 5252 + SYS_UNLINKAT = 5253 + SYS_RENAMEAT = 5254 + SYS_LINKAT = 5255 + SYS_SYMLINKAT = 5256 + SYS_READLINKAT = 5257 + SYS_FCHMODAT = 5258 + SYS_FACCESSAT = 5259 + SYS_PSELECT6 = 5260 + SYS_PPOLL = 5261 + SYS_UNSHARE = 5262 + SYS_SPLICE = 5263 + SYS_SYNC_FILE_RANGE = 5264 + SYS_TEE = 5265 + SYS_VMSPLICE = 5266 + SYS_MOVE_PAGES = 5267 + SYS_SET_ROBUST_LIST = 5268 + SYS_GET_ROBUST_LIST = 5269 + SYS_KEXEC_LOAD = 5270 + SYS_GETCPU = 5271 + SYS_EPOLL_PWAIT = 5272 + SYS_IOPRIO_SET = 5273 + SYS_IOPRIO_GET = 5274 + SYS_UTIMENSAT = 5275 + SYS_SIGNALFD = 5276 + SYS_TIMERFD = 5277 + SYS_EVENTFD = 5278 + SYS_FALLOCATE = 5279 + SYS_TIMERFD_CREATE = 5280 + SYS_TIMERFD_GETTIME = 5281 + SYS_TIMERFD_SETTIME = 5282 + SYS_SIGNALFD4 = 5283 + SYS_EVENTFD2 = 5284 + SYS_EPOLL_CREATE1 = 5285 + SYS_DUP3 = 5286 + SYS_PIPE2 = 5287 + SYS_INOTIFY_INIT1 = 5288 + SYS_PREADV = 5289 + SYS_PWRITEV = 5290 + SYS_RT_TGSIGQUEUEINFO = 5291 + SYS_PERF_EVENT_OPEN = 5292 + SYS_ACCEPT4 = 5293 + SYS_RECVMMSG = 5294 + SYS_FANOTIFY_INIT = 5295 + SYS_FANOTIFY_MARK = 5296 + SYS_PRLIMIT64 = 5297 + SYS_NAME_TO_HANDLE_AT = 5298 + SYS_OPEN_BY_HANDLE_AT = 5299 + SYS_CLOCK_ADJTIME = 5300 + SYS_SYNCFS = 5301 + SYS_SENDMMSG = 5302 + SYS_SETNS = 5303 + SYS_PROCESS_VM_READV = 5304 + SYS_PROCESS_VM_WRITEV = 5305 + SYS_KCMP = 5306 + SYS_FINIT_MODULE = 5307 + SYS_GETDENTS64 = 5308 + SYS_SCHED_SETATTR = 5309 + SYS_SCHED_GETATTR = 5310 + SYS_RENAMEAT2 = 5311 + SYS_SECCOMP = 5312 + SYS_GETRANDOM = 5313 + SYS_MEMFD_CREATE = 5314 + SYS_BPF = 5315 + SYS_EXECVEAT = 5316 + SYS_USERFAULTFD = 5317 + SYS_MEMBARRIER = 5318 + SYS_MLOCK2 = 5319 + SYS_COPY_FILE_RANGE = 5320 + SYS_PREADV2 = 5321 + SYS_PWRITEV2 = 5322 + SYS_PKEY_MPROTECT = 5323 + SYS_PKEY_ALLOC = 5324 + SYS_PKEY_FREE = 5325 + SYS_STATX = 5326 + SYS_RSEQ = 5327 + SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 + SYS_PIDFD_OPEN = 5434 + SYS_CLONE3 = 5435 + SYS_CLOSE_RANGE = 5436 + SYS_OPENAT2 = 5437 + SYS_PIDFD_GETFD = 5438 + SYS_FACCESSAT2 = 5439 + SYS_PROCESS_MADVISE = 5440 + SYS_EPOLL_PWAIT2 = 5441 + SYS_MOUNT_SETATTR = 5442 + SYS_QUOTACTL_FD = 5443 + SYS_LANDLOCK_CREATE_RULESET = 5444 + SYS_LANDLOCK_ADD_RULE = 5445 + SYS_LANDLOCK_RESTRICT_SELF = 5446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 2a1047c8..570a857a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mipsle && linux // +build mipsle,linux package unix @@ -421,4 +422,10 @@ const ( SYS_PIDFD_GETFD = 4438 SYS_FACCESSAT2 = 4439 SYS_PROCESS_MADVISE = 4440 + SYS_EPOLL_PWAIT2 = 4441 + SYS_MOUNT_SETATTR = 4442 + SYS_QUOTACTL_FD = 4443 + SYS_LANDLOCK_CREATE_RULESET = 4444 + SYS_LANDLOCK_ADD_RULE = 4445 + SYS_LANDLOCK_RESTRICT_SELF = 4446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go new file mode 100644 index 00000000..638498d6 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -0,0 +1,438 @@ +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc && linux +// +build ppc,linux + +package unix + +const ( + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_MMAP2 = 192 + SYS_TRUNCATE64 = 193 + SYS_FTRUNCATE64 = 194 + SYS_STAT64 = 195 + SYS_LSTAT64 = 196 + SYS_FSTAT64 = 197 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_FCNTL64 = 204 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_SENDFILE64 = 226 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_FADVISE64_64 = 254 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_FSTATAT64 = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_CLOCK_GETTIME64 = 403 + SYS_CLOCK_SETTIME64 = 404 + SYS_CLOCK_ADJTIME64 = 405 + SYS_CLOCK_GETRES_TIME64 = 406 + SYS_CLOCK_NANOSLEEP_TIME64 = 407 + SYS_TIMER_GETTIME64 = 408 + SYS_TIMER_SETTIME64 = 409 + SYS_TIMERFD_GETTIME64 = 410 + SYS_TIMERFD_SETTIME64 = 411 + SYS_UTIMENSAT_TIME64 = 412 + SYS_PSELECT6_TIME64 = 413 + SYS_PPOLL_TIME64 = 414 + SYS_IO_PGETEVENTS_TIME64 = 416 + SYS_RECVMMSG_TIME64 = 417 + SYS_MQ_TIMEDSEND_TIME64 = 418 + SYS_MQ_TIMEDRECEIVE_TIME64 = 419 + SYS_SEMTIMEDOP_TIME64 = 420 + SYS_RT_SIGTIMEDWAIT_TIME64 = 421 + SYS_FUTEX_TIME64 = 422 + SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 +) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 32707428..702beebf 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -1,403 +1,410 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && linux // +build ppc64,linux package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 - SYS_EXECVEAT = 362 - SYS_SWITCH_ENDIAN = 363 - SYS_USERFAULTFD = 364 - SYS_MEMBARRIER = 365 - SYS_MLOCK2 = 378 - SYS_COPY_FILE_RANGE = 379 - SYS_PREADV2 = 380 - SYS_PWRITEV2 = 381 - SYS_KEXEC_FILE_LOAD = 382 - SYS_STATX = 383 - SYS_PKEY_ALLOC = 384 - SYS_PKEY_FREE = 385 - SYS_PKEY_MPROTECT = 386 - SYS_RSEQ = 387 - SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_NEWFSTATAT = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index a58572f7..bfc87ea4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -1,403 +1,410 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64le && linux // +build ppc64le,linux package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 - SYS_EXECVEAT = 362 - SYS_SWITCH_ENDIAN = 363 - SYS_USERFAULTFD = 364 - SYS_MEMBARRIER = 365 - SYS_MLOCK2 = 378 - SYS_COPY_FILE_RANGE = 379 - SYS_PREADV2 = 380 - SYS_PWRITEV2 = 381 - SYS_KEXEC_FILE_LOAD = 382 - SYS_STATX = 383 - SYS_PKEY_ALLOC = 384 - SYS_PKEY_FREE = 385 - SYS_PKEY_MPROTECT = 386 - SYS_RSEQ = 387 - SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_NEWFSTATAT = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 72a65b76..a390e147 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -1,305 +1,312 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build riscv64 && linux // +build riscv64,linux package unix const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 - SYS_GETRANDOM = 278 - SYS_MEMFD_CREATE = 279 - SYS_BPF = 280 - SYS_EXECVEAT = 281 - SYS_USERFAULTFD = 282 - SYS_MEMBARRIER = 283 - SYS_MLOCK2 = 284 - SYS_COPY_FILE_RANGE = 285 - SYS_PREADV2 = 286 - SYS_PWRITEV2 = 287 - SYS_PKEY_MPROTECT = 288 - SYS_PKEY_ALLOC = 289 - SYS_PKEY_FREE = 290 - SYS_STATX = 291 - SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_IO_SETUP = 0 + SYS_IO_DESTROY = 1 + SYS_IO_SUBMIT = 2 + SYS_IO_CANCEL = 3 + SYS_IO_GETEVENTS = 4 + SYS_SETXATTR = 5 + SYS_LSETXATTR = 6 + SYS_FSETXATTR = 7 + SYS_GETXATTR = 8 + SYS_LGETXATTR = 9 + SYS_FGETXATTR = 10 + SYS_LISTXATTR = 11 + SYS_LLISTXATTR = 12 + SYS_FLISTXATTR = 13 + SYS_REMOVEXATTR = 14 + SYS_LREMOVEXATTR = 15 + SYS_FREMOVEXATTR = 16 + SYS_GETCWD = 17 + SYS_LOOKUP_DCOOKIE = 18 + SYS_EVENTFD2 = 19 + SYS_EPOLL_CREATE1 = 20 + SYS_EPOLL_CTL = 21 + SYS_EPOLL_PWAIT = 22 + SYS_DUP = 23 + SYS_DUP3 = 24 + SYS_FCNTL = 25 + SYS_INOTIFY_INIT1 = 26 + SYS_INOTIFY_ADD_WATCH = 27 + SYS_INOTIFY_RM_WATCH = 28 + SYS_IOCTL = 29 + SYS_IOPRIO_SET = 30 + SYS_IOPRIO_GET = 31 + SYS_FLOCK = 32 + SYS_MKNODAT = 33 + SYS_MKDIRAT = 34 + SYS_UNLINKAT = 35 + SYS_SYMLINKAT = 36 + SYS_LINKAT = 37 + SYS_UMOUNT2 = 39 + SYS_MOUNT = 40 + SYS_PIVOT_ROOT = 41 + SYS_NFSSERVCTL = 42 + SYS_STATFS = 43 + SYS_FSTATFS = 44 + SYS_TRUNCATE = 45 + SYS_FTRUNCATE = 46 + SYS_FALLOCATE = 47 + SYS_FACCESSAT = 48 + SYS_CHDIR = 49 + SYS_FCHDIR = 50 + SYS_CHROOT = 51 + SYS_FCHMOD = 52 + SYS_FCHMODAT = 53 + SYS_FCHOWNAT = 54 + SYS_FCHOWN = 55 + SYS_OPENAT = 56 + SYS_CLOSE = 57 + SYS_VHANGUP = 58 + SYS_PIPE2 = 59 + SYS_QUOTACTL = 60 + SYS_GETDENTS64 = 61 + SYS_LSEEK = 62 + SYS_READ = 63 + SYS_WRITE = 64 + SYS_READV = 65 + SYS_WRITEV = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_PREADV = 69 + SYS_PWRITEV = 70 + SYS_SENDFILE = 71 + SYS_PSELECT6 = 72 + SYS_PPOLL = 73 + SYS_SIGNALFD4 = 74 + SYS_VMSPLICE = 75 + SYS_SPLICE = 76 + SYS_TEE = 77 + SYS_READLINKAT = 78 + SYS_FSTATAT = 79 + SYS_FSTAT = 80 + SYS_SYNC = 81 + SYS_FSYNC = 82 + SYS_FDATASYNC = 83 + SYS_SYNC_FILE_RANGE = 84 + SYS_TIMERFD_CREATE = 85 + SYS_TIMERFD_SETTIME = 86 + SYS_TIMERFD_GETTIME = 87 + SYS_UTIMENSAT = 88 + SYS_ACCT = 89 + SYS_CAPGET = 90 + SYS_CAPSET = 91 + SYS_PERSONALITY = 92 + SYS_EXIT = 93 + SYS_EXIT_GROUP = 94 + SYS_WAITID = 95 + SYS_SET_TID_ADDRESS = 96 + SYS_UNSHARE = 97 + SYS_FUTEX = 98 + SYS_SET_ROBUST_LIST = 99 + SYS_GET_ROBUST_LIST = 100 + SYS_NANOSLEEP = 101 + SYS_GETITIMER = 102 + SYS_SETITIMER = 103 + SYS_KEXEC_LOAD = 104 + SYS_INIT_MODULE = 105 + SYS_DELETE_MODULE = 106 + SYS_TIMER_CREATE = 107 + SYS_TIMER_GETTIME = 108 + SYS_TIMER_GETOVERRUN = 109 + SYS_TIMER_SETTIME = 110 + SYS_TIMER_DELETE = 111 + SYS_CLOCK_SETTIME = 112 + SYS_CLOCK_GETTIME = 113 + SYS_CLOCK_GETRES = 114 + SYS_CLOCK_NANOSLEEP = 115 + SYS_SYSLOG = 116 + SYS_PTRACE = 117 + SYS_SCHED_SETPARAM = 118 + SYS_SCHED_SETSCHEDULER = 119 + SYS_SCHED_GETSCHEDULER = 120 + SYS_SCHED_GETPARAM = 121 + SYS_SCHED_SETAFFINITY = 122 + SYS_SCHED_GETAFFINITY = 123 + SYS_SCHED_YIELD = 124 + SYS_SCHED_GET_PRIORITY_MAX = 125 + SYS_SCHED_GET_PRIORITY_MIN = 126 + SYS_SCHED_RR_GET_INTERVAL = 127 + SYS_RESTART_SYSCALL = 128 + SYS_KILL = 129 + SYS_TKILL = 130 + SYS_TGKILL = 131 + SYS_SIGALTSTACK = 132 + SYS_RT_SIGSUSPEND = 133 + SYS_RT_SIGACTION = 134 + SYS_RT_SIGPROCMASK = 135 + SYS_RT_SIGPENDING = 136 + SYS_RT_SIGTIMEDWAIT = 137 + SYS_RT_SIGQUEUEINFO = 138 + SYS_RT_SIGRETURN = 139 + SYS_SETPRIORITY = 140 + SYS_GETPRIORITY = 141 + SYS_REBOOT = 142 + SYS_SETREGID = 143 + SYS_SETGID = 144 + SYS_SETREUID = 145 + SYS_SETUID = 146 + SYS_SETRESUID = 147 + SYS_GETRESUID = 148 + SYS_SETRESGID = 149 + SYS_GETRESGID = 150 + SYS_SETFSUID = 151 + SYS_SETFSGID = 152 + SYS_TIMES = 153 + SYS_SETPGID = 154 + SYS_GETPGID = 155 + SYS_GETSID = 156 + SYS_SETSID = 157 + SYS_GETGROUPS = 158 + SYS_SETGROUPS = 159 + SYS_UNAME = 160 + SYS_SETHOSTNAME = 161 + SYS_SETDOMAINNAME = 162 + SYS_GETRLIMIT = 163 + SYS_SETRLIMIT = 164 + SYS_GETRUSAGE = 165 + SYS_UMASK = 166 + SYS_PRCTL = 167 + SYS_GETCPU = 168 + SYS_GETTIMEOFDAY = 169 + SYS_SETTIMEOFDAY = 170 + SYS_ADJTIMEX = 171 + SYS_GETPID = 172 + SYS_GETPPID = 173 + SYS_GETUID = 174 + SYS_GETEUID = 175 + SYS_GETGID = 176 + SYS_GETEGID = 177 + SYS_GETTID = 178 + SYS_SYSINFO = 179 + SYS_MQ_OPEN = 180 + SYS_MQ_UNLINK = 181 + SYS_MQ_TIMEDSEND = 182 + SYS_MQ_TIMEDRECEIVE = 183 + SYS_MQ_NOTIFY = 184 + SYS_MQ_GETSETATTR = 185 + SYS_MSGGET = 186 + SYS_MSGCTL = 187 + SYS_MSGRCV = 188 + SYS_MSGSND = 189 + SYS_SEMGET = 190 + SYS_SEMCTL = 191 + SYS_SEMTIMEDOP = 192 + SYS_SEMOP = 193 + SYS_SHMGET = 194 + SYS_SHMCTL = 195 + SYS_SHMAT = 196 + SYS_SHMDT = 197 + SYS_SOCKET = 198 + SYS_SOCKETPAIR = 199 + SYS_BIND = 200 + SYS_LISTEN = 201 + SYS_ACCEPT = 202 + SYS_CONNECT = 203 + SYS_GETSOCKNAME = 204 + SYS_GETPEERNAME = 205 + SYS_SENDTO = 206 + SYS_RECVFROM = 207 + SYS_SETSOCKOPT = 208 + SYS_GETSOCKOPT = 209 + SYS_SHUTDOWN = 210 + SYS_SENDMSG = 211 + SYS_RECVMSG = 212 + SYS_READAHEAD = 213 + SYS_BRK = 214 + SYS_MUNMAP = 215 + SYS_MREMAP = 216 + SYS_ADD_KEY = 217 + SYS_REQUEST_KEY = 218 + SYS_KEYCTL = 219 + SYS_CLONE = 220 + SYS_EXECVE = 221 + SYS_MMAP = 222 + SYS_FADVISE64 = 223 + SYS_SWAPON = 224 + SYS_SWAPOFF = 225 + SYS_MPROTECT = 226 + SYS_MSYNC = 227 + SYS_MLOCK = 228 + SYS_MUNLOCK = 229 + SYS_MLOCKALL = 230 + SYS_MUNLOCKALL = 231 + SYS_MINCORE = 232 + SYS_MADVISE = 233 + SYS_REMAP_FILE_PAGES = 234 + SYS_MBIND = 235 + SYS_GET_MEMPOLICY = 236 + SYS_SET_MEMPOLICY = 237 + SYS_MIGRATE_PAGES = 238 + SYS_MOVE_PAGES = 239 + SYS_RT_TGSIGQUEUEINFO = 240 + SYS_PERF_EVENT_OPEN = 241 + SYS_ACCEPT4 = 242 + SYS_RECVMMSG = 243 + SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_WAIT4 = 260 + SYS_PRLIMIT64 = 261 + SYS_FANOTIFY_INIT = 262 + SYS_FANOTIFY_MARK = 263 + SYS_NAME_TO_HANDLE_AT = 264 + SYS_OPEN_BY_HANDLE_AT = 265 + SYS_CLOCK_ADJTIME = 266 + SYS_SYNCFS = 267 + SYS_SETNS = 268 + SYS_SENDMMSG = 269 + SYS_PROCESS_VM_READV = 270 + SYS_PROCESS_VM_WRITEV = 271 + SYS_KCMP = 272 + SYS_FINIT_MODULE = 273 + SYS_SCHED_SETATTR = 274 + SYS_SCHED_GETATTR = 275 + SYS_RENAMEAT2 = 276 + SYS_SECCOMP = 277 + SYS_GETRANDOM = 278 + SYS_MEMFD_CREATE = 279 + SYS_BPF = 280 + SYS_EXECVEAT = 281 + SYS_USERFAULTFD = 282 + SYS_MEMBARRIER = 283 + SYS_MLOCK2 = 284 + SYS_COPY_FILE_RANGE = 285 + SYS_PREADV2 = 286 + SYS_PWRITEV2 = 287 + SYS_PKEY_MPROTECT = 288 + SYS_PKEY_ALLOC = 289 + SYS_PKEY_FREE = 290 + SYS_STATX = 291 + SYS_IO_PGETEVENTS = 292 + SYS_RSEQ = 293 + SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 1fb9ae5d..3e791e6c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -1,368 +1,375 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build s390x && linux // +build s390x,linux package unix const ( - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_RESTART_SYSCALL = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_BRK = 45 - SYS_SIGNAL = 48 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_SETPGID = 57 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_SYMLINK = 83 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_LOOKUP_DCOOKIE = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_GETDENTS = 141 - SYS_SELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_QUERY_MODULE = 167 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_GETPMSG = 188 - SYS_PUTPMSG = 189 - SYS_VFORK = 190 - SYS_GETRLIMIT = 191 - SYS_LCHOWN = 198 - SYS_GETUID = 199 - SYS_GETGID = 200 - SYS_GETEUID = 201 - SYS_GETEGID = 202 - SYS_SETREUID = 203 - SYS_SETREGID = 204 - SYS_GETGROUPS = 205 - SYS_SETGROUPS = 206 - SYS_FCHOWN = 207 - SYS_SETRESUID = 208 - SYS_GETRESUID = 209 - SYS_SETRESGID = 210 - SYS_GETRESGID = 211 - SYS_CHOWN = 212 - SYS_SETUID = 213 - SYS_SETGID = 214 - SYS_SETFSUID = 215 - SYS_SETFSGID = 216 - SYS_PIVOT_ROOT = 217 - SYS_MINCORE = 218 - SYS_MADVISE = 219 - SYS_GETDENTS64 = 220 - SYS_READAHEAD = 222 - SYS_SETXATTR = 224 - SYS_LSETXATTR = 225 - SYS_FSETXATTR = 226 - SYS_GETXATTR = 227 - SYS_LGETXATTR = 228 - SYS_FGETXATTR = 229 - SYS_LISTXATTR = 230 - SYS_LLISTXATTR = 231 - SYS_FLISTXATTR = 232 - SYS_REMOVEXATTR = 233 - SYS_LREMOVEXATTR = 234 - SYS_FREMOVEXATTR = 235 - SYS_GETTID = 236 - SYS_TKILL = 237 - SYS_FUTEX = 238 - SYS_SCHED_SETAFFINITY = 239 - SYS_SCHED_GETAFFINITY = 240 - SYS_TGKILL = 241 - SYS_IO_SETUP = 243 - SYS_IO_DESTROY = 244 - SYS_IO_GETEVENTS = 245 - SYS_IO_SUBMIT = 246 - SYS_IO_CANCEL = 247 - SYS_EXIT_GROUP = 248 - SYS_EPOLL_CREATE = 249 - SYS_EPOLL_CTL = 250 - SYS_EPOLL_WAIT = 251 - SYS_SET_TID_ADDRESS = 252 - SYS_FADVISE64 = 253 - SYS_TIMER_CREATE = 254 - SYS_TIMER_SETTIME = 255 - SYS_TIMER_GETTIME = 256 - SYS_TIMER_GETOVERRUN = 257 - SYS_TIMER_DELETE = 258 - SYS_CLOCK_SETTIME = 259 - SYS_CLOCK_GETTIME = 260 - SYS_CLOCK_GETRES = 261 - SYS_CLOCK_NANOSLEEP = 262 - SYS_STATFS64 = 265 - SYS_FSTATFS64 = 266 - SYS_REMAP_FILE_PAGES = 267 - SYS_MBIND = 268 - SYS_GET_MEMPOLICY = 269 - SYS_SET_MEMPOLICY = 270 - SYS_MQ_OPEN = 271 - SYS_MQ_UNLINK = 272 - SYS_MQ_TIMEDSEND = 273 - SYS_MQ_TIMEDRECEIVE = 274 - SYS_MQ_NOTIFY = 275 - SYS_MQ_GETSETATTR = 276 - SYS_KEXEC_LOAD = 277 - SYS_ADD_KEY = 278 - SYS_REQUEST_KEY = 279 - SYS_KEYCTL = 280 - SYS_WAITID = 281 - SYS_IOPRIO_SET = 282 - SYS_IOPRIO_GET = 283 - SYS_INOTIFY_INIT = 284 - SYS_INOTIFY_ADD_WATCH = 285 - SYS_INOTIFY_RM_WATCH = 286 - SYS_MIGRATE_PAGES = 287 - SYS_OPENAT = 288 - SYS_MKDIRAT = 289 - SYS_MKNODAT = 290 - SYS_FCHOWNAT = 291 - SYS_FUTIMESAT = 292 - SYS_NEWFSTATAT = 293 - SYS_UNLINKAT = 294 - SYS_RENAMEAT = 295 - SYS_LINKAT = 296 - SYS_SYMLINKAT = 297 - SYS_READLINKAT = 298 - SYS_FCHMODAT = 299 - SYS_FACCESSAT = 300 - SYS_PSELECT6 = 301 - SYS_PPOLL = 302 - SYS_UNSHARE = 303 - SYS_SET_ROBUST_LIST = 304 - SYS_GET_ROBUST_LIST = 305 - SYS_SPLICE = 306 - SYS_SYNC_FILE_RANGE = 307 - SYS_TEE = 308 - SYS_VMSPLICE = 309 - SYS_MOVE_PAGES = 310 - SYS_GETCPU = 311 - SYS_EPOLL_PWAIT = 312 - SYS_UTIMES = 313 - SYS_FALLOCATE = 314 - SYS_UTIMENSAT = 315 - SYS_SIGNALFD = 316 - SYS_TIMERFD = 317 - SYS_EVENTFD = 318 - SYS_TIMERFD_CREATE = 319 - SYS_TIMERFD_SETTIME = 320 - SYS_TIMERFD_GETTIME = 321 - SYS_SIGNALFD4 = 322 - SYS_EVENTFD2 = 323 - SYS_INOTIFY_INIT1 = 324 - SYS_PIPE2 = 325 - SYS_DUP3 = 326 - SYS_EPOLL_CREATE1 = 327 - SYS_PREADV = 328 - SYS_PWRITEV = 329 - SYS_RT_TGSIGQUEUEINFO = 330 - SYS_PERF_EVENT_OPEN = 331 - SYS_FANOTIFY_INIT = 332 - SYS_FANOTIFY_MARK = 333 - SYS_PRLIMIT64 = 334 - SYS_NAME_TO_HANDLE_AT = 335 - SYS_OPEN_BY_HANDLE_AT = 336 - SYS_CLOCK_ADJTIME = 337 - SYS_SYNCFS = 338 - SYS_SETNS = 339 - SYS_PROCESS_VM_READV = 340 - SYS_PROCESS_VM_WRITEV = 341 - SYS_S390_RUNTIME_INSTR = 342 - SYS_KCMP = 343 - SYS_FINIT_MODULE = 344 - SYS_SCHED_SETATTR = 345 - SYS_SCHED_GETATTR = 346 - SYS_RENAMEAT2 = 347 - SYS_SECCOMP = 348 - SYS_GETRANDOM = 349 - SYS_MEMFD_CREATE = 350 - SYS_BPF = 351 - SYS_S390_PCI_MMIO_WRITE = 352 - SYS_S390_PCI_MMIO_READ = 353 - SYS_EXECVEAT = 354 - SYS_USERFAULTFD = 355 - SYS_MEMBARRIER = 356 - SYS_RECVMMSG = 357 - SYS_SENDMMSG = 358 - SYS_SOCKET = 359 - SYS_SOCKETPAIR = 360 - SYS_BIND = 361 - SYS_CONNECT = 362 - SYS_LISTEN = 363 - SYS_ACCEPT4 = 364 - SYS_GETSOCKOPT = 365 - SYS_SETSOCKOPT = 366 - SYS_GETSOCKNAME = 367 - SYS_GETPEERNAME = 368 - SYS_SENDTO = 369 - SYS_SENDMSG = 370 - SYS_RECVFROM = 371 - SYS_RECVMSG = 372 - SYS_SHUTDOWN = 373 - SYS_MLOCK2 = 374 - SYS_COPY_FILE_RANGE = 375 - SYS_PREADV2 = 376 - SYS_PWRITEV2 = 377 - SYS_S390_GUARDED_STORAGE = 378 - SYS_STATX = 379 - SYS_S390_STHYI = 380 - SYS_KEXEC_FILE_LOAD = 381 - SYS_IO_PGETEVENTS = 382 - SYS_RSEQ = 383 - SYS_PKEY_MPROTECT = 384 - SYS_PKEY_ALLOC = 385 - SYS_PKEY_FREE = 386 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_RESTART_SYSCALL = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_BRK = 45 + SYS_SIGNAL = 48 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_SETPGID = 57 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_SYMLINK = 83 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_LOOKUP_DCOOKIE = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_GETDENTS = 141 + SYS_SELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_QUERY_MODULE = 167 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_GETPMSG = 188 + SYS_PUTPMSG = 189 + SYS_VFORK = 190 + SYS_GETRLIMIT = 191 + SYS_LCHOWN = 198 + SYS_GETUID = 199 + SYS_GETGID = 200 + SYS_GETEUID = 201 + SYS_GETEGID = 202 + SYS_SETREUID = 203 + SYS_SETREGID = 204 + SYS_GETGROUPS = 205 + SYS_SETGROUPS = 206 + SYS_FCHOWN = 207 + SYS_SETRESUID = 208 + SYS_GETRESUID = 209 + SYS_SETRESGID = 210 + SYS_GETRESGID = 211 + SYS_CHOWN = 212 + SYS_SETUID = 213 + SYS_SETGID = 214 + SYS_SETFSUID = 215 + SYS_SETFSGID = 216 + SYS_PIVOT_ROOT = 217 + SYS_MINCORE = 218 + SYS_MADVISE = 219 + SYS_GETDENTS64 = 220 + SYS_READAHEAD = 222 + SYS_SETXATTR = 224 + SYS_LSETXATTR = 225 + SYS_FSETXATTR = 226 + SYS_GETXATTR = 227 + SYS_LGETXATTR = 228 + SYS_FGETXATTR = 229 + SYS_LISTXATTR = 230 + SYS_LLISTXATTR = 231 + SYS_FLISTXATTR = 232 + SYS_REMOVEXATTR = 233 + SYS_LREMOVEXATTR = 234 + SYS_FREMOVEXATTR = 235 + SYS_GETTID = 236 + SYS_TKILL = 237 + SYS_FUTEX = 238 + SYS_SCHED_SETAFFINITY = 239 + SYS_SCHED_GETAFFINITY = 240 + SYS_TGKILL = 241 + SYS_IO_SETUP = 243 + SYS_IO_DESTROY = 244 + SYS_IO_GETEVENTS = 245 + SYS_IO_SUBMIT = 246 + SYS_IO_CANCEL = 247 + SYS_EXIT_GROUP = 248 + SYS_EPOLL_CREATE = 249 + SYS_EPOLL_CTL = 250 + SYS_EPOLL_WAIT = 251 + SYS_SET_TID_ADDRESS = 252 + SYS_FADVISE64 = 253 + SYS_TIMER_CREATE = 254 + SYS_TIMER_SETTIME = 255 + SYS_TIMER_GETTIME = 256 + SYS_TIMER_GETOVERRUN = 257 + SYS_TIMER_DELETE = 258 + SYS_CLOCK_SETTIME = 259 + SYS_CLOCK_GETTIME = 260 + SYS_CLOCK_GETRES = 261 + SYS_CLOCK_NANOSLEEP = 262 + SYS_STATFS64 = 265 + SYS_FSTATFS64 = 266 + SYS_REMAP_FILE_PAGES = 267 + SYS_MBIND = 268 + SYS_GET_MEMPOLICY = 269 + SYS_SET_MEMPOLICY = 270 + SYS_MQ_OPEN = 271 + SYS_MQ_UNLINK = 272 + SYS_MQ_TIMEDSEND = 273 + SYS_MQ_TIMEDRECEIVE = 274 + SYS_MQ_NOTIFY = 275 + SYS_MQ_GETSETATTR = 276 + SYS_KEXEC_LOAD = 277 + SYS_ADD_KEY = 278 + SYS_REQUEST_KEY = 279 + SYS_KEYCTL = 280 + SYS_WAITID = 281 + SYS_IOPRIO_SET = 282 + SYS_IOPRIO_GET = 283 + SYS_INOTIFY_INIT = 284 + SYS_INOTIFY_ADD_WATCH = 285 + SYS_INOTIFY_RM_WATCH = 286 + SYS_MIGRATE_PAGES = 287 + SYS_OPENAT = 288 + SYS_MKDIRAT = 289 + SYS_MKNODAT = 290 + SYS_FCHOWNAT = 291 + SYS_FUTIMESAT = 292 + SYS_NEWFSTATAT = 293 + SYS_UNLINKAT = 294 + SYS_RENAMEAT = 295 + SYS_LINKAT = 296 + SYS_SYMLINKAT = 297 + SYS_READLINKAT = 298 + SYS_FCHMODAT = 299 + SYS_FACCESSAT = 300 + SYS_PSELECT6 = 301 + SYS_PPOLL = 302 + SYS_UNSHARE = 303 + SYS_SET_ROBUST_LIST = 304 + SYS_GET_ROBUST_LIST = 305 + SYS_SPLICE = 306 + SYS_SYNC_FILE_RANGE = 307 + SYS_TEE = 308 + SYS_VMSPLICE = 309 + SYS_MOVE_PAGES = 310 + SYS_GETCPU = 311 + SYS_EPOLL_PWAIT = 312 + SYS_UTIMES = 313 + SYS_FALLOCATE = 314 + SYS_UTIMENSAT = 315 + SYS_SIGNALFD = 316 + SYS_TIMERFD = 317 + SYS_EVENTFD = 318 + SYS_TIMERFD_CREATE = 319 + SYS_TIMERFD_SETTIME = 320 + SYS_TIMERFD_GETTIME = 321 + SYS_SIGNALFD4 = 322 + SYS_EVENTFD2 = 323 + SYS_INOTIFY_INIT1 = 324 + SYS_PIPE2 = 325 + SYS_DUP3 = 326 + SYS_EPOLL_CREATE1 = 327 + SYS_PREADV = 328 + SYS_PWRITEV = 329 + SYS_RT_TGSIGQUEUEINFO = 330 + SYS_PERF_EVENT_OPEN = 331 + SYS_FANOTIFY_INIT = 332 + SYS_FANOTIFY_MARK = 333 + SYS_PRLIMIT64 = 334 + SYS_NAME_TO_HANDLE_AT = 335 + SYS_OPEN_BY_HANDLE_AT = 336 + SYS_CLOCK_ADJTIME = 337 + SYS_SYNCFS = 338 + SYS_SETNS = 339 + SYS_PROCESS_VM_READV = 340 + SYS_PROCESS_VM_WRITEV = 341 + SYS_S390_RUNTIME_INSTR = 342 + SYS_KCMP = 343 + SYS_FINIT_MODULE = 344 + SYS_SCHED_SETATTR = 345 + SYS_SCHED_GETATTR = 346 + SYS_RENAMEAT2 = 347 + SYS_SECCOMP = 348 + SYS_GETRANDOM = 349 + SYS_MEMFD_CREATE = 350 + SYS_BPF = 351 + SYS_S390_PCI_MMIO_WRITE = 352 + SYS_S390_PCI_MMIO_READ = 353 + SYS_EXECVEAT = 354 + SYS_USERFAULTFD = 355 + SYS_MEMBARRIER = 356 + SYS_RECVMMSG = 357 + SYS_SENDMMSG = 358 + SYS_SOCKET = 359 + SYS_SOCKETPAIR = 360 + SYS_BIND = 361 + SYS_CONNECT = 362 + SYS_LISTEN = 363 + SYS_ACCEPT4 = 364 + SYS_GETSOCKOPT = 365 + SYS_SETSOCKOPT = 366 + SYS_GETSOCKNAME = 367 + SYS_GETPEERNAME = 368 + SYS_SENDTO = 369 + SYS_SENDMSG = 370 + SYS_RECVFROM = 371 + SYS_RECVMSG = 372 + SYS_SHUTDOWN = 373 + SYS_MLOCK2 = 374 + SYS_COPY_FILE_RANGE = 375 + SYS_PREADV2 = 376 + SYS_PWRITEV2 = 377 + SYS_S390_GUARDED_STORAGE = 378 + SYS_STATX = 379 + SYS_S390_STHYI = 380 + SYS_KEXEC_FILE_LOAD = 381 + SYS_IO_PGETEVENTS = 382 + SYS_RSEQ = 383 + SYS_PKEY_MPROTECT = 384 + SYS_PKEY_ALLOC = 385 + SYS_PKEY_FREE = 386 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 57636e09..78802a5c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -1,382 +1,389 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build sparc64 && linux // +build sparc64,linux package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECV = 11 - SYS_CHDIR = 12 - SYS_CHOWN = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BRK = 17 - SYS_PERFCTR = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_CAPGET = 21 - SYS_CAPSET = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_VMSPLICE = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_SIGALTSTACK = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_STAT = 38 - SYS_SENDFILE = 39 - SYS_LSTAT = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_UMOUNT2 = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_MEMORY_ORDERING = 52 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_FSTAT = 62 - SYS_FSTAT64 = 63 - SYS_GETPAGESIZE = 64 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_MMAP = 71 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_VHANGUP = 76 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_SETHOSTNAME = 88 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_ACCEPT = 99 - SYS_GETPRIORITY = 100 - SYS_RT_SIGRETURN = 101 - SYS_RT_SIGACTION = 102 - SYS_RT_SIGPROCMASK = 103 - SYS_RT_SIGPENDING = 104 - SYS_RT_SIGTIMEDWAIT = 105 - SYS_RT_SIGQUEUEINFO = 106 - SYS_RT_SIGSUSPEND = 107 - SYS_SETRESUID = 108 - SYS_GETRESUID = 109 - SYS_SETRESGID = 110 - SYS_GETRESGID = 111 - SYS_RECVMSG = 113 - SYS_SENDMSG = 114 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_GETCWD = 119 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_RECVFROM = 125 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_TRUNCATE = 129 - SYS_FTRUNCATE = 130 - SYS_FLOCK = 131 - SYS_LSTAT64 = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_STAT64 = 139 - SYS_SENDFILE64 = 140 - SYS_GETPEERNAME = 141 - SYS_FUTEX = 142 - SYS_GETTID = 143 - SYS_GETRLIMIT = 144 - SYS_SETRLIMIT = 145 - SYS_PIVOT_ROOT = 146 - SYS_PRCTL = 147 - SYS_PCICONFIG_READ = 148 - SYS_PCICONFIG_WRITE = 149 - SYS_GETSOCKNAME = 150 - SYS_INOTIFY_INIT = 151 - SYS_INOTIFY_ADD_WATCH = 152 - SYS_POLL = 153 - SYS_GETDENTS64 = 154 - SYS_INOTIFY_RM_WATCH = 156 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UMOUNT = 159 - SYS_SCHED_SET_AFFINITY = 160 - SYS_SCHED_GET_AFFINITY = 161 - SYS_GETDOMAINNAME = 162 - SYS_SETDOMAINNAME = 163 - SYS_UTRAP_INSTALL = 164 - SYS_QUOTACTL = 165 - SYS_SET_TID_ADDRESS = 166 - SYS_MOUNT = 167 - SYS_USTAT = 168 - SYS_SETXATTR = 169 - SYS_LSETXATTR = 170 - SYS_FSETXATTR = 171 - SYS_GETXATTR = 172 - SYS_LGETXATTR = 173 - SYS_GETDENTS = 174 - SYS_SETSID = 175 - SYS_FCHDIR = 176 - SYS_FGETXATTR = 177 - SYS_LISTXATTR = 178 - SYS_LLISTXATTR = 179 - SYS_FLISTXATTR = 180 - SYS_REMOVEXATTR = 181 - SYS_LREMOVEXATTR = 182 - SYS_SIGPENDING = 183 - SYS_QUERY_MODULE = 184 - SYS_SETPGID = 185 - SYS_FREMOVEXATTR = 186 - SYS_TKILL = 187 - SYS_EXIT_GROUP = 188 - SYS_UNAME = 189 - SYS_INIT_MODULE = 190 - SYS_PERSONALITY = 191 - SYS_REMAP_FILE_PAGES = 192 - SYS_EPOLL_CREATE = 193 - SYS_EPOLL_CTL = 194 - SYS_EPOLL_WAIT = 195 - SYS_IOPRIO_SET = 196 - SYS_GETPPID = 197 - SYS_SIGACTION = 198 - SYS_SGETMASK = 199 - SYS_SSETMASK = 200 - SYS_SIGSUSPEND = 201 - SYS_OLDLSTAT = 202 - SYS_USELIB = 203 - SYS_READDIR = 204 - SYS_READAHEAD = 205 - SYS_SOCKETCALL = 206 - SYS_SYSLOG = 207 - SYS_LOOKUP_DCOOKIE = 208 - SYS_FADVISE64 = 209 - SYS_FADVISE64_64 = 210 - SYS_TGKILL = 211 - SYS_WAITPID = 212 - SYS_SWAPOFF = 213 - SYS_SYSINFO = 214 - SYS_IPC = 215 - SYS_SIGRETURN = 216 - SYS_CLONE = 217 - SYS_IOPRIO_GET = 218 - SYS_ADJTIMEX = 219 - SYS_SIGPROCMASK = 220 - SYS_CREATE_MODULE = 221 - SYS_DELETE_MODULE = 222 - SYS_GET_KERNEL_SYMS = 223 - SYS_GETPGID = 224 - SYS_BDFLUSH = 225 - SYS_SYSFS = 226 - SYS_AFS_SYSCALL = 227 - SYS_SETFSUID = 228 - SYS_SETFSGID = 229 - SYS__NEWSELECT = 230 - SYS_SPLICE = 232 - SYS_STIME = 233 - SYS_STATFS64 = 234 - SYS_FSTATFS64 = 235 - SYS__LLSEEK = 236 - SYS_MLOCK = 237 - SYS_MUNLOCK = 238 - SYS_MLOCKALL = 239 - SYS_MUNLOCKALL = 240 - SYS_SCHED_SETPARAM = 241 - SYS_SCHED_GETPARAM = 242 - SYS_SCHED_SETSCHEDULER = 243 - SYS_SCHED_GETSCHEDULER = 244 - SYS_SCHED_YIELD = 245 - SYS_SCHED_GET_PRIORITY_MAX = 246 - SYS_SCHED_GET_PRIORITY_MIN = 247 - SYS_SCHED_RR_GET_INTERVAL = 248 - SYS_NANOSLEEP = 249 - SYS_MREMAP = 250 - SYS__SYSCTL = 251 - SYS_GETSID = 252 - SYS_FDATASYNC = 253 - SYS_NFSSERVCTL = 254 - SYS_SYNC_FILE_RANGE = 255 - SYS_CLOCK_SETTIME = 256 - SYS_CLOCK_GETTIME = 257 - SYS_CLOCK_GETRES = 258 - SYS_CLOCK_NANOSLEEP = 259 - SYS_SCHED_GETAFFINITY = 260 - SYS_SCHED_SETAFFINITY = 261 - SYS_TIMER_SETTIME = 262 - SYS_TIMER_GETTIME = 263 - SYS_TIMER_GETOVERRUN = 264 - SYS_TIMER_DELETE = 265 - SYS_TIMER_CREATE = 266 - SYS_VSERVER = 267 - SYS_IO_SETUP = 268 - SYS_IO_DESTROY = 269 - SYS_IO_SUBMIT = 270 - SYS_IO_CANCEL = 271 - SYS_IO_GETEVENTS = 272 - SYS_MQ_OPEN = 273 - SYS_MQ_UNLINK = 274 - SYS_MQ_TIMEDSEND = 275 - SYS_MQ_TIMEDRECEIVE = 276 - SYS_MQ_NOTIFY = 277 - SYS_MQ_GETSETATTR = 278 - SYS_WAITID = 279 - SYS_TEE = 280 - SYS_ADD_KEY = 281 - SYS_REQUEST_KEY = 282 - SYS_KEYCTL = 283 - SYS_OPENAT = 284 - SYS_MKDIRAT = 285 - SYS_MKNODAT = 286 - SYS_FCHOWNAT = 287 - SYS_FUTIMESAT = 288 - SYS_FSTATAT64 = 289 - SYS_UNLINKAT = 290 - SYS_RENAMEAT = 291 - SYS_LINKAT = 292 - SYS_SYMLINKAT = 293 - SYS_READLINKAT = 294 - SYS_FCHMODAT = 295 - SYS_FACCESSAT = 296 - SYS_PSELECT6 = 297 - SYS_PPOLL = 298 - SYS_UNSHARE = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_GET_ROBUST_LIST = 301 - SYS_MIGRATE_PAGES = 302 - SYS_MBIND = 303 - SYS_GET_MEMPOLICY = 304 - SYS_SET_MEMPOLICY = 305 - SYS_KEXEC_LOAD = 306 - SYS_MOVE_PAGES = 307 - SYS_GETCPU = 308 - SYS_EPOLL_PWAIT = 309 - SYS_UTIMENSAT = 310 - SYS_SIGNALFD = 311 - SYS_TIMERFD_CREATE = 312 - SYS_EVENTFD = 313 - SYS_FALLOCATE = 314 - SYS_TIMERFD_SETTIME = 315 - SYS_TIMERFD_GETTIME = 316 - SYS_SIGNALFD4 = 317 - SYS_EVENTFD2 = 318 - SYS_EPOLL_CREATE1 = 319 - SYS_DUP3 = 320 - SYS_PIPE2 = 321 - SYS_INOTIFY_INIT1 = 322 - SYS_ACCEPT4 = 323 - SYS_PREADV = 324 - SYS_PWRITEV = 325 - SYS_RT_TGSIGQUEUEINFO = 326 - SYS_PERF_EVENT_OPEN = 327 - SYS_RECVMMSG = 328 - SYS_FANOTIFY_INIT = 329 - SYS_FANOTIFY_MARK = 330 - SYS_PRLIMIT64 = 331 - SYS_NAME_TO_HANDLE_AT = 332 - SYS_OPEN_BY_HANDLE_AT = 333 - SYS_CLOCK_ADJTIME = 334 - SYS_SYNCFS = 335 - SYS_SENDMMSG = 336 - SYS_SETNS = 337 - SYS_PROCESS_VM_READV = 338 - SYS_PROCESS_VM_WRITEV = 339 - SYS_KERN_FEATURES = 340 - SYS_KCMP = 341 - SYS_FINIT_MODULE = 342 - SYS_SCHED_SETATTR = 343 - SYS_SCHED_GETATTR = 344 - SYS_RENAMEAT2 = 345 - SYS_SECCOMP = 346 - SYS_GETRANDOM = 347 - SYS_MEMFD_CREATE = 348 - SYS_BPF = 349 - SYS_EXECVEAT = 350 - SYS_MEMBARRIER = 351 - SYS_USERFAULTFD = 352 - SYS_BIND = 353 - SYS_LISTEN = 354 - SYS_SETSOCKOPT = 355 - SYS_MLOCK2 = 356 - SYS_COPY_FILE_RANGE = 357 - SYS_PREADV2 = 358 - SYS_PWRITEV2 = 359 - SYS_STATX = 360 - SYS_IO_PGETEVENTS = 361 - SYS_PKEY_MPROTECT = 362 - SYS_PKEY_ALLOC = 363 - SYS_PKEY_FREE = 364 - SYS_RSEQ = 365 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLOSE_RANGE = 436 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 - SYS_FACCESSAT2 = 439 - SYS_PROCESS_MADVISE = 440 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAIT4 = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECV = 11 + SYS_CHDIR = 12 + SYS_CHOWN = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BRK = 17 + SYS_PERFCTR = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_CAPGET = 21 + SYS_CAPSET = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_VMSPLICE = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_SIGALTSTACK = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_STAT = 38 + SYS_SENDFILE = 39 + SYS_LSTAT = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_UMOUNT2 = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_MEMORY_ORDERING = 52 + SYS_IOCTL = 54 + SYS_REBOOT = 55 + SYS_SYMLINK = 57 + SYS_READLINK = 58 + SYS_EXECVE = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_FSTAT = 62 + SYS_FSTAT64 = 63 + SYS_GETPAGESIZE = 64 + SYS_MSYNC = 65 + SYS_VFORK = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_MMAP = 71 + SYS_MUNMAP = 73 + SYS_MPROTECT = 74 + SYS_MADVISE = 75 + SYS_VHANGUP = 76 + SYS_MINCORE = 78 + SYS_GETGROUPS = 79 + SYS_SETGROUPS = 80 + SYS_GETPGRP = 81 + SYS_SETITIMER = 83 + SYS_SWAPON = 85 + SYS_GETITIMER = 86 + SYS_SETHOSTNAME = 88 + SYS_DUP2 = 90 + SYS_FCNTL = 92 + SYS_SELECT = 93 + SYS_FSYNC = 95 + SYS_SETPRIORITY = 96 + SYS_SOCKET = 97 + SYS_CONNECT = 98 + SYS_ACCEPT = 99 + SYS_GETPRIORITY = 100 + SYS_RT_SIGRETURN = 101 + SYS_RT_SIGACTION = 102 + SYS_RT_SIGPROCMASK = 103 + SYS_RT_SIGPENDING = 104 + SYS_RT_SIGTIMEDWAIT = 105 + SYS_RT_SIGQUEUEINFO = 106 + SYS_RT_SIGSUSPEND = 107 + SYS_SETRESUID = 108 + SYS_GETRESUID = 109 + SYS_SETRESGID = 110 + SYS_GETRESGID = 111 + SYS_RECVMSG = 113 + SYS_SENDMSG = 114 + SYS_GETTIMEOFDAY = 116 + SYS_GETRUSAGE = 117 + SYS_GETSOCKOPT = 118 + SYS_GETCWD = 119 + SYS_READV = 120 + SYS_WRITEV = 121 + SYS_SETTIMEOFDAY = 122 + SYS_FCHOWN = 123 + SYS_FCHMOD = 124 + SYS_RECVFROM = 125 + SYS_SETREUID = 126 + SYS_SETREGID = 127 + SYS_RENAME = 128 + SYS_TRUNCATE = 129 + SYS_FTRUNCATE = 130 + SYS_FLOCK = 131 + SYS_LSTAT64 = 132 + SYS_SENDTO = 133 + SYS_SHUTDOWN = 134 + SYS_SOCKETPAIR = 135 + SYS_MKDIR = 136 + SYS_RMDIR = 137 + SYS_UTIMES = 138 + SYS_STAT64 = 139 + SYS_SENDFILE64 = 140 + SYS_GETPEERNAME = 141 + SYS_FUTEX = 142 + SYS_GETTID = 143 + SYS_GETRLIMIT = 144 + SYS_SETRLIMIT = 145 + SYS_PIVOT_ROOT = 146 + SYS_PRCTL = 147 + SYS_PCICONFIG_READ = 148 + SYS_PCICONFIG_WRITE = 149 + SYS_GETSOCKNAME = 150 + SYS_INOTIFY_INIT = 151 + SYS_INOTIFY_ADD_WATCH = 152 + SYS_POLL = 153 + SYS_GETDENTS64 = 154 + SYS_INOTIFY_RM_WATCH = 156 + SYS_STATFS = 157 + SYS_FSTATFS = 158 + SYS_UMOUNT = 159 + SYS_SCHED_SET_AFFINITY = 160 + SYS_SCHED_GET_AFFINITY = 161 + SYS_GETDOMAINNAME = 162 + SYS_SETDOMAINNAME = 163 + SYS_UTRAP_INSTALL = 164 + SYS_QUOTACTL = 165 + SYS_SET_TID_ADDRESS = 166 + SYS_MOUNT = 167 + SYS_USTAT = 168 + SYS_SETXATTR = 169 + SYS_LSETXATTR = 170 + SYS_FSETXATTR = 171 + SYS_GETXATTR = 172 + SYS_LGETXATTR = 173 + SYS_GETDENTS = 174 + SYS_SETSID = 175 + SYS_FCHDIR = 176 + SYS_FGETXATTR = 177 + SYS_LISTXATTR = 178 + SYS_LLISTXATTR = 179 + SYS_FLISTXATTR = 180 + SYS_REMOVEXATTR = 181 + SYS_LREMOVEXATTR = 182 + SYS_SIGPENDING = 183 + SYS_QUERY_MODULE = 184 + SYS_SETPGID = 185 + SYS_FREMOVEXATTR = 186 + SYS_TKILL = 187 + SYS_EXIT_GROUP = 188 + SYS_UNAME = 189 + SYS_INIT_MODULE = 190 + SYS_PERSONALITY = 191 + SYS_REMAP_FILE_PAGES = 192 + SYS_EPOLL_CREATE = 193 + SYS_EPOLL_CTL = 194 + SYS_EPOLL_WAIT = 195 + SYS_IOPRIO_SET = 196 + SYS_GETPPID = 197 + SYS_SIGACTION = 198 + SYS_SGETMASK = 199 + SYS_SSETMASK = 200 + SYS_SIGSUSPEND = 201 + SYS_OLDLSTAT = 202 + SYS_USELIB = 203 + SYS_READDIR = 204 + SYS_READAHEAD = 205 + SYS_SOCKETCALL = 206 + SYS_SYSLOG = 207 + SYS_LOOKUP_DCOOKIE = 208 + SYS_FADVISE64 = 209 + SYS_FADVISE64_64 = 210 + SYS_TGKILL = 211 + SYS_WAITPID = 212 + SYS_SWAPOFF = 213 + SYS_SYSINFO = 214 + SYS_IPC = 215 + SYS_SIGRETURN = 216 + SYS_CLONE = 217 + SYS_IOPRIO_GET = 218 + SYS_ADJTIMEX = 219 + SYS_SIGPROCMASK = 220 + SYS_CREATE_MODULE = 221 + SYS_DELETE_MODULE = 222 + SYS_GET_KERNEL_SYMS = 223 + SYS_GETPGID = 224 + SYS_BDFLUSH = 225 + SYS_SYSFS = 226 + SYS_AFS_SYSCALL = 227 + SYS_SETFSUID = 228 + SYS_SETFSGID = 229 + SYS__NEWSELECT = 230 + SYS_SPLICE = 232 + SYS_STIME = 233 + SYS_STATFS64 = 234 + SYS_FSTATFS64 = 235 + SYS__LLSEEK = 236 + SYS_MLOCK = 237 + SYS_MUNLOCK = 238 + SYS_MLOCKALL = 239 + SYS_MUNLOCKALL = 240 + SYS_SCHED_SETPARAM = 241 + SYS_SCHED_GETPARAM = 242 + SYS_SCHED_SETSCHEDULER = 243 + SYS_SCHED_GETSCHEDULER = 244 + SYS_SCHED_YIELD = 245 + SYS_SCHED_GET_PRIORITY_MAX = 246 + SYS_SCHED_GET_PRIORITY_MIN = 247 + SYS_SCHED_RR_GET_INTERVAL = 248 + SYS_NANOSLEEP = 249 + SYS_MREMAP = 250 + SYS__SYSCTL = 251 + SYS_GETSID = 252 + SYS_FDATASYNC = 253 + SYS_NFSSERVCTL = 254 + SYS_SYNC_FILE_RANGE = 255 + SYS_CLOCK_SETTIME = 256 + SYS_CLOCK_GETTIME = 257 + SYS_CLOCK_GETRES = 258 + SYS_CLOCK_NANOSLEEP = 259 + SYS_SCHED_GETAFFINITY = 260 + SYS_SCHED_SETAFFINITY = 261 + SYS_TIMER_SETTIME = 262 + SYS_TIMER_GETTIME = 263 + SYS_TIMER_GETOVERRUN = 264 + SYS_TIMER_DELETE = 265 + SYS_TIMER_CREATE = 266 + SYS_VSERVER = 267 + SYS_IO_SETUP = 268 + SYS_IO_DESTROY = 269 + SYS_IO_SUBMIT = 270 + SYS_IO_CANCEL = 271 + SYS_IO_GETEVENTS = 272 + SYS_MQ_OPEN = 273 + SYS_MQ_UNLINK = 274 + SYS_MQ_TIMEDSEND = 275 + SYS_MQ_TIMEDRECEIVE = 276 + SYS_MQ_NOTIFY = 277 + SYS_MQ_GETSETATTR = 278 + SYS_WAITID = 279 + SYS_TEE = 280 + SYS_ADD_KEY = 281 + SYS_REQUEST_KEY = 282 + SYS_KEYCTL = 283 + SYS_OPENAT = 284 + SYS_MKDIRAT = 285 + SYS_MKNODAT = 286 + SYS_FCHOWNAT = 287 + SYS_FUTIMESAT = 288 + SYS_FSTATAT64 = 289 + SYS_UNLINKAT = 290 + SYS_RENAMEAT = 291 + SYS_LINKAT = 292 + SYS_SYMLINKAT = 293 + SYS_READLINKAT = 294 + SYS_FCHMODAT = 295 + SYS_FACCESSAT = 296 + SYS_PSELECT6 = 297 + SYS_PPOLL = 298 + SYS_UNSHARE = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_GET_ROBUST_LIST = 301 + SYS_MIGRATE_PAGES = 302 + SYS_MBIND = 303 + SYS_GET_MEMPOLICY = 304 + SYS_SET_MEMPOLICY = 305 + SYS_KEXEC_LOAD = 306 + SYS_MOVE_PAGES = 307 + SYS_GETCPU = 308 + SYS_EPOLL_PWAIT = 309 + SYS_UTIMENSAT = 310 + SYS_SIGNALFD = 311 + SYS_TIMERFD_CREATE = 312 + SYS_EVENTFD = 313 + SYS_FALLOCATE = 314 + SYS_TIMERFD_SETTIME = 315 + SYS_TIMERFD_GETTIME = 316 + SYS_SIGNALFD4 = 317 + SYS_EVENTFD2 = 318 + SYS_EPOLL_CREATE1 = 319 + SYS_DUP3 = 320 + SYS_PIPE2 = 321 + SYS_INOTIFY_INIT1 = 322 + SYS_ACCEPT4 = 323 + SYS_PREADV = 324 + SYS_PWRITEV = 325 + SYS_RT_TGSIGQUEUEINFO = 326 + SYS_PERF_EVENT_OPEN = 327 + SYS_RECVMMSG = 328 + SYS_FANOTIFY_INIT = 329 + SYS_FANOTIFY_MARK = 330 + SYS_PRLIMIT64 = 331 + SYS_NAME_TO_HANDLE_AT = 332 + SYS_OPEN_BY_HANDLE_AT = 333 + SYS_CLOCK_ADJTIME = 334 + SYS_SYNCFS = 335 + SYS_SENDMMSG = 336 + SYS_SETNS = 337 + SYS_PROCESS_VM_READV = 338 + SYS_PROCESS_VM_WRITEV = 339 + SYS_KERN_FEATURES = 340 + SYS_KCMP = 341 + SYS_FINIT_MODULE = 342 + SYS_SCHED_SETATTR = 343 + SYS_SCHED_GETATTR = 344 + SYS_RENAMEAT2 = 345 + SYS_SECCOMP = 346 + SYS_GETRANDOM = 347 + SYS_MEMFD_CREATE = 348 + SYS_BPF = 349 + SYS_EXECVEAT = 350 + SYS_MEMBARRIER = 351 + SYS_USERFAULTFD = 352 + SYS_BIND = 353 + SYS_LISTEN = 354 + SYS_SETSOCKOPT = 355 + SYS_MLOCK2 = 356 + SYS_COPY_FILE_RANGE = 357 + SYS_PREADV2 = 358 + SYS_PWRITEV2 = 359 + SYS_STATX = 360 + SYS_IO_PGETEVENTS = 361 + SYS_PKEY_MPROTECT = 362 + SYS_PKEY_ALLOC = 363 + SYS_PKEY_FREE = 364 + SYS_RSEQ = 365 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index e66a8c9d..3a6699eb 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && netbsd // +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 42c788f2..5677cd4f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && netbsd // +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index 0a075717..e784cb6d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && netbsd // +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go index 0291c093..bd4952ef 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; DO NOT EDIT. +//go:build arm64 && netbsd // +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index b0207d1c..817edbf9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index f0dec6f0..ea453614 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index 33d1dc54..467971ee 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go index fe2b689b..32eec5ed 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go index 5c08d573..a37f7737 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && openbsd // +build mips64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go new file mode 100644 index 00000000..073daad4 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -0,0 +1,2670 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +// TODO: auto-generate. + +const ( + SYS_ACOSD128 = 0xB80 + SYS_ACOSD32 = 0xB7E + SYS_ACOSD64 = 0xB7F + SYS_ACOSHD128 = 0xB83 + SYS_ACOSHD32 = 0xB81 + SYS_ACOSHD64 = 0xB82 + SYS_AIO_FSYNC = 0xC69 + SYS_ASCTIME = 0x0AE + SYS_ASCTIME64 = 0xCD7 + SYS_ASCTIME64_R = 0xCD8 + SYS_ASIND128 = 0xB86 + SYS_ASIND32 = 0xB84 + SYS_ASIND64 = 0xB85 + SYS_ASINHD128 = 0xB89 + SYS_ASINHD32 = 0xB87 + SYS_ASINHD64 = 0xB88 + SYS_ATAN2D128 = 0xB8F + SYS_ATAN2D32 = 0xB8D + SYS_ATAN2D64 = 0xB8E + SYS_ATAND128 = 0xB8C + SYS_ATAND32 = 0xB8A + SYS_ATAND64 = 0xB8B + SYS_ATANHD128 = 0xB92 + SYS_ATANHD32 = 0xB90 + SYS_ATANHD64 = 0xB91 + SYS_BIND2ADDRSEL = 0xD59 + SYS_C16RTOMB = 0xD40 + SYS_C32RTOMB = 0xD41 + SYS_CBRTD128 = 0xB95 + SYS_CBRTD32 = 0xB93 + SYS_CBRTD64 = 0xB94 + SYS_CEILD128 = 0xB98 + SYS_CEILD32 = 0xB96 + SYS_CEILD64 = 0xB97 + SYS_CLEARENV = 0x0C9 + SYS_CLEARERR_UNLOCKED = 0xCA1 + SYS_CLOCK = 0x0AA + SYS_CLOGL = 0xA00 + SYS_CLRMEMF = 0x0BD + SYS_CONJ = 0xA03 + SYS_CONJF = 0xA06 + SYS_CONJL = 0xA09 + SYS_COPYSIGND128 = 0xB9E + SYS_COPYSIGND32 = 0xB9C + SYS_COPYSIGND64 = 0xB9D + SYS_COSD128 = 0xBA1 + SYS_COSD32 = 0xB9F + SYS_COSD64 = 0xBA0 + SYS_COSHD128 = 0xBA4 + SYS_COSHD32 = 0xBA2 + SYS_COSHD64 = 0xBA3 + SYS_CPOW = 0xA0C + SYS_CPOWF = 0xA0F + SYS_CPOWL = 0xA12 + SYS_CPROJ = 0xA15 + SYS_CPROJF = 0xA18 + SYS_CPROJL = 0xA1B + SYS_CREAL = 0xA1E + SYS_CREALF = 0xA21 + SYS_CREALL = 0xA24 + SYS_CSIN = 0xA27 + SYS_CSINF = 0xA2A + SYS_CSINH = 0xA30 + SYS_CSINHF = 0xA33 + SYS_CSINHL = 0xA36 + SYS_CSINL = 0xA2D + SYS_CSNAP = 0x0C5 + SYS_CSQRT = 0xA39 + SYS_CSQRTF = 0xA3C + SYS_CSQRTL = 0xA3F + SYS_CTAN = 0xA42 + SYS_CTANF = 0xA45 + SYS_CTANH = 0xA4B + SYS_CTANHF = 0xA4E + SYS_CTANHL = 0xA51 + SYS_CTANL = 0xA48 + SYS_CTIME = 0x0AB + SYS_CTIME64 = 0xCD9 + SYS_CTIME64_R = 0xCDA + SYS_CTRACE = 0x0C6 + SYS_DIFFTIME = 0x0A7 + SYS_DIFFTIME64 = 0xCDB + SYS_DLADDR = 0xC82 + SYS_DYNALLOC = 0x0C3 + SYS_DYNFREE = 0x0C2 + SYS_ERFCD128 = 0xBAA + SYS_ERFCD32 = 0xBA8 + SYS_ERFCD64 = 0xBA9 + SYS_ERFD128 = 0xBA7 + SYS_ERFD32 = 0xBA5 + SYS_ERFD64 = 0xBA6 + SYS_EXP2D128 = 0xBB0 + SYS_EXP2D32 = 0xBAE + SYS_EXP2D64 = 0xBAF + SYS_EXPD128 = 0xBAD + SYS_EXPD32 = 0xBAB + SYS_EXPD64 = 0xBAC + SYS_EXPM1D128 = 0xBB3 + SYS_EXPM1D32 = 0xBB1 + SYS_EXPM1D64 = 0xBB2 + SYS_FABSD128 = 0xBB6 + SYS_FABSD32 = 0xBB4 + SYS_FABSD64 = 0xBB5 + SYS_FDELREC_UNLOCKED = 0xCA2 + SYS_FDIMD128 = 0xBB9 + SYS_FDIMD32 = 0xBB7 + SYS_FDIMD64 = 0xBB8 + SYS_FDOPEN_UNLOCKED = 0xCFC + SYS_FECLEAREXCEPT = 0xAEA + SYS_FEGETENV = 0xAEB + SYS_FEGETEXCEPTFLAG = 0xAEC + SYS_FEGETROUND = 0xAED + SYS_FEHOLDEXCEPT = 0xAEE + SYS_FEOF_UNLOCKED = 0xCA3 + SYS_FERAISEEXCEPT = 0xAEF + SYS_FERROR_UNLOCKED = 0xCA4 + SYS_FESETENV = 0xAF0 + SYS_FESETEXCEPTFLAG = 0xAF1 + SYS_FESETROUND = 0xAF2 + SYS_FETCHEP = 0x0BF + SYS_FETESTEXCEPT = 0xAF3 + SYS_FEUPDATEENV = 0xAF4 + SYS_FE_DEC_GETROUND = 0xBBA + SYS_FE_DEC_SETROUND = 0xBBB + SYS_FFLUSH_UNLOCKED = 0xCA5 + SYS_FGETC_UNLOCKED = 0xC80 + SYS_FGETPOS64 = 0xCEE + SYS_FGETPOS64_UNLOCKED = 0xCF4 + SYS_FGETPOS_UNLOCKED = 0xCA6 + SYS_FGETS_UNLOCKED = 0xC7C + SYS_FGETWC_UNLOCKED = 0xCA7 + SYS_FGETWS_UNLOCKED = 0xCA8 + SYS_FILENO_UNLOCKED = 0xCA9 + SYS_FLDATA = 0x0C1 + SYS_FLDATA_UNLOCKED = 0xCAA + SYS_FLOCATE_UNLOCKED = 0xCAB + SYS_FLOORD128 = 0xBBE + SYS_FLOORD32 = 0xBBC + SYS_FLOORD64 = 0xBBD + SYS_FMA = 0xA63 + SYS_FMAD128 = 0xBC1 + SYS_FMAD32 = 0xBBF + SYS_FMAD64 = 0xBC0 + SYS_FMAF = 0xA66 + SYS_FMAL = 0xA69 + SYS_FMAX = 0xA6C + SYS_FMAXD128 = 0xBC4 + SYS_FMAXD32 = 0xBC2 + SYS_FMAXD64 = 0xBC3 + SYS_FMAXF = 0xA6F + SYS_FMAXL = 0xA72 + SYS_FMIN = 0xA75 + SYS_FMIND128 = 0xBC7 + SYS_FMIND32 = 0xBC5 + SYS_FMIND64 = 0xBC6 + SYS_FMINF = 0xA78 + SYS_FMINL = 0xA7B + SYS_FMODD128 = 0xBCA + SYS_FMODD32 = 0xBC8 + SYS_FMODD64 = 0xBC9 + SYS_FOPEN64 = 0xD49 + SYS_FOPEN64_UNLOCKED = 0xD4A + SYS_FOPEN_UNLOCKED = 0xCFA + SYS_FPRINTF_UNLOCKED = 0xCAC + SYS_FPUTC_UNLOCKED = 0xC81 + SYS_FPUTS_UNLOCKED = 0xC7E + SYS_FPUTWC_UNLOCKED = 0xCAD + SYS_FPUTWS_UNLOCKED = 0xCAE + SYS_FREAD_NOUPDATE = 0xCEC + SYS_FREAD_NOUPDATE_UNLOCKED = 0xCED + SYS_FREAD_UNLOCKED = 0xC7B + SYS_FREEIFADDRS = 0xCE6 + SYS_FREOPEN64 = 0xD4B + SYS_FREOPEN64_UNLOCKED = 0xD4C + SYS_FREOPEN_UNLOCKED = 0xCFB + SYS_FREXPD128 = 0xBCE + SYS_FREXPD32 = 0xBCC + SYS_FREXPD64 = 0xBCD + SYS_FSCANF_UNLOCKED = 0xCAF + SYS_FSEEK64 = 0xCEF + SYS_FSEEK64_UNLOCKED = 0xCF5 + SYS_FSEEKO64 = 0xCF0 + SYS_FSEEKO64_UNLOCKED = 0xCF6 + SYS_FSEEKO_UNLOCKED = 0xCB1 + SYS_FSEEK_UNLOCKED = 0xCB0 + SYS_FSETPOS64 = 0xCF1 + SYS_FSETPOS64_UNLOCKED = 0xCF7 + SYS_FSETPOS_UNLOCKED = 0xCB3 + SYS_FTELL64 = 0xCF2 + SYS_FTELL64_UNLOCKED = 0xCF8 + SYS_FTELLO64 = 0xCF3 + SYS_FTELLO64_UNLOCKED = 0xCF9 + SYS_FTELLO_UNLOCKED = 0xCB5 + SYS_FTELL_UNLOCKED = 0xCB4 + SYS_FUPDATE = 0x0B5 + SYS_FUPDATE_UNLOCKED = 0xCB7 + SYS_FWIDE_UNLOCKED = 0xCB8 + SYS_FWPRINTF_UNLOCKED = 0xCB9 + SYS_FWRITE_UNLOCKED = 0xC7A + SYS_FWSCANF_UNLOCKED = 0xCBA + SYS_GETDATE64 = 0xD4F + SYS_GETIFADDRS = 0xCE7 + SYS_GETIPV4SOURCEFILTER = 0xC77 + SYS_GETSOURCEFILTER = 0xC79 + SYS_GETSYNTX = 0x0FD + SYS_GETS_UNLOCKED = 0xC7D + SYS_GETTIMEOFDAY64 = 0xD50 + SYS_GETWCHAR_UNLOCKED = 0xCBC + SYS_GETWC_UNLOCKED = 0xCBB + SYS_GMTIME = 0x0B0 + SYS_GMTIME64 = 0xCDC + SYS_GMTIME64_R = 0xCDD + SYS_HYPOTD128 = 0xBD1 + SYS_HYPOTD32 = 0xBCF + SYS_HYPOTD64 = 0xBD0 + SYS_ILOGBD128 = 0xBD4 + SYS_ILOGBD32 = 0xBD2 + SYS_ILOGBD64 = 0xBD3 + SYS_ILOGBF = 0xA7E + SYS_ILOGBL = 0xA81 + SYS_INET6_IS_SRCADDR = 0xD5A + SYS_ISBLANK = 0x0FE + SYS_ISWALNUM = 0x0FF + SYS_LDEXPD128 = 0xBD7 + SYS_LDEXPD32 = 0xBD5 + SYS_LDEXPD64 = 0xBD6 + SYS_LGAMMAD128 = 0xBDA + SYS_LGAMMAD32 = 0xBD8 + SYS_LGAMMAD64 = 0xBD9 + SYS_LIO_LISTIO = 0xC6A + SYS_LLRINT = 0xA84 + SYS_LLRINTD128 = 0xBDD + SYS_LLRINTD32 = 0xBDB + SYS_LLRINTD64 = 0xBDC + SYS_LLRINTF = 0xA87 + SYS_LLRINTL = 0xA8A + SYS_LLROUND = 0xA8D + SYS_LLROUNDD128 = 0xBE0 + SYS_LLROUNDD32 = 0xBDE + SYS_LLROUNDD64 = 0xBDF + SYS_LLROUNDF = 0xA90 + SYS_LLROUNDL = 0xA93 + SYS_LOCALTIM = 0x0B1 + SYS_LOCALTIME = 0x0B1 + SYS_LOCALTIME64 = 0xCDE + SYS_LOCALTIME64_R = 0xCDF + SYS_LOG10D128 = 0xBE6 + SYS_LOG10D32 = 0xBE4 + SYS_LOG10D64 = 0xBE5 + SYS_LOG1PD128 = 0xBE9 + SYS_LOG1PD32 = 0xBE7 + SYS_LOG1PD64 = 0xBE8 + SYS_LOG2D128 = 0xBEC + SYS_LOG2D32 = 0xBEA + SYS_LOG2D64 = 0xBEB + SYS_LOGBD128 = 0xBEF + SYS_LOGBD32 = 0xBED + SYS_LOGBD64 = 0xBEE + SYS_LOGBF = 0xA96 + SYS_LOGBL = 0xA99 + SYS_LOGD128 = 0xBE3 + SYS_LOGD32 = 0xBE1 + SYS_LOGD64 = 0xBE2 + SYS_LRINT = 0xA9C + SYS_LRINTD128 = 0xBF2 + SYS_LRINTD32 = 0xBF0 + SYS_LRINTD64 = 0xBF1 + SYS_LRINTF = 0xA9F + SYS_LRINTL = 0xAA2 + SYS_LROUNDD128 = 0xBF5 + SYS_LROUNDD32 = 0xBF3 + SYS_LROUNDD64 = 0xBF4 + SYS_LROUNDL = 0xAA5 + SYS_MBLEN = 0x0AF + SYS_MBRTOC16 = 0xD42 + SYS_MBRTOC32 = 0xD43 + SYS_MEMSET = 0x0A3 + SYS_MKTIME = 0x0AC + SYS_MKTIME64 = 0xCE0 + SYS_MODFD128 = 0xBF8 + SYS_MODFD32 = 0xBF6 + SYS_MODFD64 = 0xBF7 + SYS_NAN = 0xAA8 + SYS_NAND128 = 0xBFB + SYS_NAND32 = 0xBF9 + SYS_NAND64 = 0xBFA + SYS_NANF = 0xAAA + SYS_NANL = 0xAAC + SYS_NEARBYINT = 0xAAE + SYS_NEARBYINTD128 = 0xBFE + SYS_NEARBYINTD32 = 0xBFC + SYS_NEARBYINTD64 = 0xBFD + SYS_NEARBYINTF = 0xAB1 + SYS_NEARBYINTL = 0xAB4 + SYS_NEXTAFTERD128 = 0xC01 + SYS_NEXTAFTERD32 = 0xBFF + SYS_NEXTAFTERD64 = 0xC00 + SYS_NEXTAFTERF = 0xAB7 + SYS_NEXTAFTERL = 0xABA + SYS_NEXTTOWARD = 0xABD + SYS_NEXTTOWARDD128 = 0xC04 + SYS_NEXTTOWARDD32 = 0xC02 + SYS_NEXTTOWARDD64 = 0xC03 + SYS_NEXTTOWARDF = 0xAC0 + SYS_NEXTTOWARDL = 0xAC3 + SYS_NL_LANGINFO = 0x0FC + SYS_PERROR_UNLOCKED = 0xCBD + SYS_POSIX_FALLOCATE = 0xCE8 + SYS_POSIX_MEMALIGN = 0xCE9 + SYS_POSIX_OPENPT = 0xC66 + SYS_POWD128 = 0xC07 + SYS_POWD32 = 0xC05 + SYS_POWD64 = 0xC06 + SYS_PRINTF_UNLOCKED = 0xCBE + SYS_PSELECT = 0xC67 + SYS_PTHREAD_ATTR_GETSTACK = 0xB3E + SYS_PTHREAD_ATTR_SETSTACK = 0xB3F + SYS_PTHREAD_SECURITY_APPLID_NP = 0xCE4 + SYS_PUTS_UNLOCKED = 0xC7F + SYS_PUTWCHAR_UNLOCKED = 0xCC0 + SYS_PUTWC_UNLOCKED = 0xCBF + SYS_QUANTEXPD128 = 0xD46 + SYS_QUANTEXPD32 = 0xD44 + SYS_QUANTEXPD64 = 0xD45 + SYS_QUANTIZED128 = 0xC0A + SYS_QUANTIZED32 = 0xC08 + SYS_QUANTIZED64 = 0xC09 + SYS_REMAINDERD128 = 0xC0D + SYS_REMAINDERD32 = 0xC0B + SYS_REMAINDERD64 = 0xC0C + SYS_RESIZE_ALLOC = 0xCEB + SYS_REWIND_UNLOCKED = 0xCC1 + SYS_RINTD128 = 0xC13 + SYS_RINTD32 = 0xC11 + SYS_RINTD64 = 0xC12 + SYS_RINTF = 0xACB + SYS_RINTL = 0xACD + SYS_ROUND = 0xACF + SYS_ROUNDD128 = 0xC16 + SYS_ROUNDD32 = 0xC14 + SYS_ROUNDD64 = 0xC15 + SYS_ROUNDF = 0xAD2 + SYS_ROUNDL = 0xAD5 + SYS_SAMEQUANTUMD128 = 0xC19 + SYS_SAMEQUANTUMD32 = 0xC17 + SYS_SAMEQUANTUMD64 = 0xC18 + SYS_SCALBLN = 0xAD8 + SYS_SCALBLND128 = 0xC1C + SYS_SCALBLND32 = 0xC1A + SYS_SCALBLND64 = 0xC1B + SYS_SCALBLNF = 0xADB + SYS_SCALBLNL = 0xADE + SYS_SCALBND128 = 0xC1F + SYS_SCALBND32 = 0xC1D + SYS_SCALBND64 = 0xC1E + SYS_SCALBNF = 0xAE3 + SYS_SCALBNL = 0xAE6 + SYS_SCANF_UNLOCKED = 0xCC2 + SYS_SCHED_YIELD = 0xB32 + SYS_SETENV = 0x0C8 + SYS_SETIPV4SOURCEFILTER = 0xC76 + SYS_SETSOURCEFILTER = 0xC78 + SYS_SHM_OPEN = 0xC8C + SYS_SHM_UNLINK = 0xC8D + SYS_SIND128 = 0xC22 + SYS_SIND32 = 0xC20 + SYS_SIND64 = 0xC21 + SYS_SINHD128 = 0xC25 + SYS_SINHD32 = 0xC23 + SYS_SINHD64 = 0xC24 + SYS_SIZEOF_ALLOC = 0xCEA + SYS_SOCKATMARK = 0xC68 + SYS_SQRTD128 = 0xC28 + SYS_SQRTD32 = 0xC26 + SYS_SQRTD64 = 0xC27 + SYS_STRCHR = 0x0A0 + SYS_STRCSPN = 0x0A1 + SYS_STRERROR = 0x0A8 + SYS_STRERROR_R = 0xB33 + SYS_STRFTIME = 0x0B2 + SYS_STRLEN = 0x0A9 + SYS_STRPBRK = 0x0A2 + SYS_STRSPN = 0x0A4 + SYS_STRSTR = 0x0A5 + SYS_STRTOD128 = 0xC2B + SYS_STRTOD32 = 0xC29 + SYS_STRTOD64 = 0xC2A + SYS_STRTOK = 0x0A6 + SYS_TAND128 = 0xC2E + SYS_TAND32 = 0xC2C + SYS_TAND64 = 0xC2D + SYS_TANHD128 = 0xC31 + SYS_TANHD32 = 0xC2F + SYS_TANHD64 = 0xC30 + SYS_TGAMMAD128 = 0xC34 + SYS_TGAMMAD32 = 0xC32 + SYS_TGAMMAD64 = 0xC33 + SYS_TIME = 0x0AD + SYS_TIME64 = 0xCE1 + SYS_TMPFILE64 = 0xD4D + SYS_TMPFILE64_UNLOCKED = 0xD4E + SYS_TMPFILE_UNLOCKED = 0xCFD + SYS_TRUNCD128 = 0xC40 + SYS_TRUNCD32 = 0xC3E + SYS_TRUNCD64 = 0xC3F + SYS_UNGETC_UNLOCKED = 0xCC3 + SYS_UNGETWC_UNLOCKED = 0xCC4 + SYS_UNSETENV = 0xB34 + SYS_VFPRINTF_UNLOCKED = 0xCC5 + SYS_VFSCANF_UNLOCKED = 0xCC7 + SYS_VFWPRINTF_UNLOCKED = 0xCC9 + SYS_VFWSCANF_UNLOCKED = 0xCCB + SYS_VPRINTF_UNLOCKED = 0xCCD + SYS_VSCANF_UNLOCKED = 0xCCF + SYS_VWPRINTF_UNLOCKED = 0xCD1 + SYS_VWSCANF_UNLOCKED = 0xCD3 + SYS_WCSTOD128 = 0xC43 + SYS_WCSTOD32 = 0xC41 + SYS_WCSTOD64 = 0xC42 + SYS_WPRINTF_UNLOCKED = 0xCD5 + SYS_WSCANF_UNLOCKED = 0xCD6 + SYS__FLUSHLBF = 0xD68 + SYS__FLUSHLBF_UNLOCKED = 0xD6F + SYS___ACOSHF_H = 0xA54 + SYS___ACOSHL_H = 0xA55 + SYS___ASINHF_H = 0xA56 + SYS___ASINHL_H = 0xA57 + SYS___ATANPID128 = 0xC6D + SYS___ATANPID32 = 0xC6B + SYS___ATANPID64 = 0xC6C + SYS___CBRTF_H = 0xA58 + SYS___CBRTL_H = 0xA59 + SYS___CDUMP = 0x0C4 + SYS___CLASS = 0xAFA + SYS___CLASS2 = 0xB99 + SYS___CLASS2D128 = 0xC99 + SYS___CLASS2D32 = 0xC97 + SYS___CLASS2D64 = 0xC98 + SYS___CLASS2F = 0xC91 + SYS___CLASS2F_B = 0xC93 + SYS___CLASS2F_H = 0xC94 + SYS___CLASS2L = 0xC92 + SYS___CLASS2L_B = 0xC95 + SYS___CLASS2L_H = 0xC96 + SYS___CLASS2_B = 0xB9A + SYS___CLASS2_H = 0xB9B + SYS___CLASS_B = 0xAFB + SYS___CLASS_H = 0xAFC + SYS___CLOGL_B = 0xA01 + SYS___CLOGL_H = 0xA02 + SYS___CLRENV = 0x0C9 + SYS___CLRMF = 0x0BD + SYS___CODEPAGE_INFO = 0xC64 + SYS___CONJF_B = 0xA07 + SYS___CONJF_H = 0xA08 + SYS___CONJL_B = 0xA0A + SYS___CONJL_H = 0xA0B + SYS___CONJ_B = 0xA04 + SYS___CONJ_H = 0xA05 + SYS___COPYSIGN_B = 0xA5A + SYS___COPYSIGN_H = 0xAF5 + SYS___COSPID128 = 0xC70 + SYS___COSPID32 = 0xC6E + SYS___COSPID64 = 0xC6F + SYS___CPOWF_B = 0xA10 + SYS___CPOWF_H = 0xA11 + SYS___CPOWL_B = 0xA13 + SYS___CPOWL_H = 0xA14 + SYS___CPOW_B = 0xA0D + SYS___CPOW_H = 0xA0E + SYS___CPROJF_B = 0xA19 + SYS___CPROJF_H = 0xA1A + SYS___CPROJL_B = 0xA1C + SYS___CPROJL_H = 0xA1D + SYS___CPROJ_B = 0xA16 + SYS___CPROJ_H = 0xA17 + SYS___CREALF_B = 0xA22 + SYS___CREALF_H = 0xA23 + SYS___CREALL_B = 0xA25 + SYS___CREALL_H = 0xA26 + SYS___CREAL_B = 0xA1F + SYS___CREAL_H = 0xA20 + SYS___CSINF_B = 0xA2B + SYS___CSINF_H = 0xA2C + SYS___CSINHF_B = 0xA34 + SYS___CSINHF_H = 0xA35 + SYS___CSINHL_B = 0xA37 + SYS___CSINHL_H = 0xA38 + SYS___CSINH_B = 0xA31 + SYS___CSINH_H = 0xA32 + SYS___CSINL_B = 0xA2E + SYS___CSINL_H = 0xA2F + SYS___CSIN_B = 0xA28 + SYS___CSIN_H = 0xA29 + SYS___CSNAP = 0x0C5 + SYS___CSQRTF_B = 0xA3D + SYS___CSQRTF_H = 0xA3E + SYS___CSQRTL_B = 0xA40 + SYS___CSQRTL_H = 0xA41 + SYS___CSQRT_B = 0xA3A + SYS___CSQRT_H = 0xA3B + SYS___CTANF_B = 0xA46 + SYS___CTANF_H = 0xA47 + SYS___CTANHF_B = 0xA4F + SYS___CTANHF_H = 0xA50 + SYS___CTANHL_B = 0xA52 + SYS___CTANHL_H = 0xA53 + SYS___CTANH_B = 0xA4C + SYS___CTANH_H = 0xA4D + SYS___CTANL_B = 0xA49 + SYS___CTANL_H = 0xA4A + SYS___CTAN_B = 0xA43 + SYS___CTAN_H = 0xA44 + SYS___CTEST = 0x0C7 + SYS___CTRACE = 0x0C6 + SYS___D1TOP = 0xC9B + SYS___D2TOP = 0xC9C + SYS___D4TOP = 0xC9D + SYS___DYNALL = 0x0C3 + SYS___DYNFRE = 0x0C2 + SYS___EXP2F_H = 0xA5E + SYS___EXP2L_H = 0xA5F + SYS___EXP2_H = 0xA5D + SYS___EXPM1F_H = 0xA5B + SYS___EXPM1L_H = 0xA5C + SYS___FBUFSIZE = 0xD60 + SYS___FLBF = 0xD62 + SYS___FLDATA = 0x0C1 + SYS___FMAF_B = 0xA67 + SYS___FMAF_H = 0xA68 + SYS___FMAL_B = 0xA6A + SYS___FMAL_H = 0xA6B + SYS___FMAXF_B = 0xA70 + SYS___FMAXF_H = 0xA71 + SYS___FMAXL_B = 0xA73 + SYS___FMAXL_H = 0xA74 + SYS___FMAX_B = 0xA6D + SYS___FMAX_H = 0xA6E + SYS___FMA_B = 0xA64 + SYS___FMA_H = 0xA65 + SYS___FMINF_B = 0xA79 + SYS___FMINF_H = 0xA7A + SYS___FMINL_B = 0xA7C + SYS___FMINL_H = 0xA7D + SYS___FMIN_B = 0xA76 + SYS___FMIN_H = 0xA77 + SYS___FPENDING = 0xD61 + SYS___FPENDING_UNLOCKED = 0xD6C + SYS___FPURGE = 0xD69 + SYS___FPURGE_UNLOCKED = 0xD70 + SYS___FP_CAST_D = 0xBCB + SYS___FREADABLE = 0xD63 + SYS___FREADAHEAD = 0xD6A + SYS___FREADAHEAD_UNLOCKED = 0xD71 + SYS___FREADING = 0xD65 + SYS___FREADING_UNLOCKED = 0xD6D + SYS___FSEEK2 = 0xB3C + SYS___FSETERR = 0xD6B + SYS___FSETLOCKING = 0xD67 + SYS___FTCHEP = 0x0BF + SYS___FTELL2 = 0xB3B + SYS___FUPDT = 0x0B5 + SYS___FWRITABLE = 0xD64 + SYS___FWRITING = 0xD66 + SYS___FWRITING_UNLOCKED = 0xD6E + SYS___GETCB = 0x0B4 + SYS___GETGRGID1 = 0xD5B + SYS___GETGRNAM1 = 0xD5C + SYS___GETTHENT = 0xCE5 + SYS___GETTOD = 0xD3E + SYS___HYPOTF_H = 0xAF6 + SYS___HYPOTL_H = 0xAF7 + SYS___ILOGBF_B = 0xA7F + SYS___ILOGBF_H = 0xA80 + SYS___ILOGBL_B = 0xA82 + SYS___ILOGBL_H = 0xA83 + SYS___ISBLANK_A = 0xB2E + SYS___ISBLNK = 0x0FE + SYS___ISWBLANK_A = 0xB2F + SYS___LE_CEEGTJS = 0xD72 + SYS___LE_TRACEBACK = 0xB7A + SYS___LGAMMAL_H = 0xA62 + SYS___LGAMMA_B_C99 = 0xB39 + SYS___LGAMMA_H_C99 = 0xB38 + SYS___LGAMMA_R_C99 = 0xB3A + SYS___LLRINTF_B = 0xA88 + SYS___LLRINTF_H = 0xA89 + SYS___LLRINTL_B = 0xA8B + SYS___LLRINTL_H = 0xA8C + SYS___LLRINT_B = 0xA85 + SYS___LLRINT_H = 0xA86 + SYS___LLROUNDF_B = 0xA91 + SYS___LLROUNDF_H = 0xA92 + SYS___LLROUNDL_B = 0xA94 + SYS___LLROUNDL_H = 0xA95 + SYS___LLROUND_B = 0xA8E + SYS___LLROUND_H = 0xA8F + SYS___LOCALE_CTL = 0xD47 + SYS___LOG1PF_H = 0xA60 + SYS___LOG1PL_H = 0xA61 + SYS___LOGBF_B = 0xA97 + SYS___LOGBF_H = 0xA98 + SYS___LOGBL_B = 0xA9A + SYS___LOGBL_H = 0xA9B + SYS___LOGIN_APPLID = 0xCE2 + SYS___LRINTF_B = 0xAA0 + SYS___LRINTF_H = 0xAA1 + SYS___LRINTL_B = 0xAA3 + SYS___LRINTL_H = 0xAA4 + SYS___LRINT_B = 0xA9D + SYS___LRINT_H = 0xA9E + SYS___LROUNDF_FIXUP = 0xB31 + SYS___LROUNDL_B = 0xAA6 + SYS___LROUNDL_H = 0xAA7 + SYS___LROUND_FIXUP = 0xB30 + SYS___MOSERVICES = 0xD3D + SYS___MUST_STAY_CLEAN = 0xB7C + SYS___NANF_B = 0xAAB + SYS___NANL_B = 0xAAD + SYS___NAN_B = 0xAA9 + SYS___NEARBYINTF_B = 0xAB2 + SYS___NEARBYINTF_H = 0xAB3 + SYS___NEARBYINTL_B = 0xAB5 + SYS___NEARBYINTL_H = 0xAB6 + SYS___NEARBYINT_B = 0xAAF + SYS___NEARBYINT_H = 0xAB0 + SYS___NEXTAFTERF_B = 0xAB8 + SYS___NEXTAFTERF_H = 0xAB9 + SYS___NEXTAFTERL_B = 0xABB + SYS___NEXTAFTERL_H = 0xABC + SYS___NEXTTOWARDF_B = 0xAC1 + SYS___NEXTTOWARDF_H = 0xAC2 + SYS___NEXTTOWARDL_B = 0xAC4 + SYS___NEXTTOWARDL_H = 0xAC5 + SYS___NEXTTOWARD_B = 0xABE + SYS___NEXTTOWARD_H = 0xABF + SYS___O_ENV = 0xB7D + SYS___PASSWD_APPLID = 0xCE3 + SYS___PTOD1 = 0xC9E + SYS___PTOD2 = 0xC9F + SYS___PTOD4 = 0xCA0 + SYS___REGCOMP_STD = 0x0EA + SYS___REMAINDERF_H = 0xAC6 + SYS___REMAINDERL_H = 0xAC7 + SYS___REMQUOD128 = 0xC10 + SYS___REMQUOD32 = 0xC0E + SYS___REMQUOD64 = 0xC0F + SYS___REMQUOF_H = 0xAC9 + SYS___REMQUOL_H = 0xACA + SYS___REMQUO_H = 0xAC8 + SYS___RINTF_B = 0xACC + SYS___RINTL_B = 0xACE + SYS___ROUNDF_B = 0xAD3 + SYS___ROUNDF_H = 0xAD4 + SYS___ROUNDL_B = 0xAD6 + SYS___ROUNDL_H = 0xAD7 + SYS___ROUND_B = 0xAD0 + SYS___ROUND_H = 0xAD1 + SYS___SCALBLNF_B = 0xADC + SYS___SCALBLNF_H = 0xADD + SYS___SCALBLNL_B = 0xADF + SYS___SCALBLNL_H = 0xAE0 + SYS___SCALBLN_B = 0xAD9 + SYS___SCALBLN_H = 0xADA + SYS___SCALBNF_B = 0xAE4 + SYS___SCALBNF_H = 0xAE5 + SYS___SCALBNL_B = 0xAE7 + SYS___SCALBNL_H = 0xAE8 + SYS___SCALBN_B = 0xAE1 + SYS___SCALBN_H = 0xAE2 + SYS___SETENV = 0x0C8 + SYS___SINPID128 = 0xC73 + SYS___SINPID32 = 0xC71 + SYS___SINPID64 = 0xC72 + SYS___SMF_RECORD2 = 0xD48 + SYS___STATIC_REINIT = 0xB3D + SYS___TGAMMAF_H_C99 = 0xB79 + SYS___TGAMMAL_H = 0xAE9 + SYS___TGAMMA_H_C99 = 0xB78 + SYS___TOCSNAME2 = 0xC9A + SYS_CEIL = 0x01F + SYS_CHAUDIT = 0x1E0 + SYS_EXP = 0x01A + SYS_FCHAUDIT = 0x1E1 + SYS_FREXP = 0x01D + SYS_GETGROUPSBYNAME = 0x1E2 + SYS_GETPWUID = 0x1A0 + SYS_GETUID = 0x1A1 + SYS_ISATTY = 0x1A3 + SYS_KILL = 0x1A4 + SYS_LDEXP = 0x01E + SYS_LINK = 0x1A5 + SYS_LOG10 = 0x01C + SYS_LSEEK = 0x1A6 + SYS_LSTAT = 0x1A7 + SYS_MKDIR = 0x1A8 + SYS_MKFIFO = 0x1A9 + SYS_MKNOD = 0x1AA + SYS_MODF = 0x01B + SYS_MOUNT = 0x1AB + SYS_OPEN = 0x1AC + SYS_OPENDIR = 0x1AD + SYS_PATHCONF = 0x1AE + SYS_PAUSE = 0x1AF + SYS_PIPE = 0x1B0 + SYS_PTHREAD_ATTR_DESTROY = 0x1E7 + SYS_PTHREAD_ATTR_GETDETACHSTATE = 0x1EB + SYS_PTHREAD_ATTR_GETSTACKSIZE = 0x1E9 + SYS_PTHREAD_ATTR_GETWEIGHT_NP = 0x1ED + SYS_PTHREAD_ATTR_INIT = 0x1E6 + SYS_PTHREAD_ATTR_SETDETACHSTATE = 0x1EA + SYS_PTHREAD_ATTR_SETSTACKSIZE = 0x1E8 + SYS_PTHREAD_ATTR_SETWEIGHT_NP = 0x1EC + SYS_PTHREAD_CANCEL = 0x1EE + SYS_PTHREAD_CLEANUP_POP = 0x1F0 + SYS_PTHREAD_CLEANUP_PUSH = 0x1EF + SYS_PTHREAD_CONDATTR_DESTROY = 0x1F2 + SYS_PTHREAD_CONDATTR_INIT = 0x1F1 + SYS_PTHREAD_COND_BROADCAST = 0x1F6 + SYS_PTHREAD_COND_DESTROY = 0x1F4 + SYS_PTHREAD_COND_INIT = 0x1F3 + SYS_PTHREAD_COND_SIGNAL = 0x1F5 + SYS_PTHREAD_COND_TIMEDWAIT = 0x1F8 + SYS_PTHREAD_COND_WAIT = 0x1F7 + SYS_PTHREAD_CREATE = 0x1F9 + SYS_PTHREAD_DETACH = 0x1FA + SYS_PTHREAD_EQUAL = 0x1FB + SYS_PTHREAD_EXIT = 0x1E4 + SYS_PTHREAD_GETSPECIFIC = 0x1FC + SYS_PTHREAD_JOIN = 0x1FD + SYS_PTHREAD_KEY_CREATE = 0x1FE + SYS_PTHREAD_KILL = 0x1E5 + SYS_PTHREAD_MUTEXATTR_INIT = 0x1FF + SYS_READ = 0x1B2 + SYS_READDIR = 0x1B3 + SYS_READLINK = 0x1B4 + SYS_REWINDDIR = 0x1B5 + SYS_RMDIR = 0x1B6 + SYS_SETEGID = 0x1B7 + SYS_SETEUID = 0x1B8 + SYS_SETGID = 0x1B9 + SYS_SETPGID = 0x1BA + SYS_SETSID = 0x1BB + SYS_SETUID = 0x1BC + SYS_SIGACTION = 0x1BD + SYS_SIGADDSET = 0x1BE + SYS_SIGDELSET = 0x1BF + SYS_SIGEMPTYSET = 0x1C0 + SYS_SIGFILLSET = 0x1C1 + SYS_SIGISMEMBER = 0x1C2 + SYS_SIGLONGJMP = 0x1C3 + SYS_SIGPENDING = 0x1C4 + SYS_SIGPROCMASK = 0x1C5 + SYS_SIGSETJMP = 0x1C6 + SYS_SIGSUSPEND = 0x1C7 + SYS_SIGWAIT = 0x1E3 + SYS_SLEEP = 0x1C8 + SYS_STAT = 0x1C9 + SYS_SYMLINK = 0x1CB + SYS_SYSCONF = 0x1CC + SYS_TCDRAIN = 0x1CD + SYS_TCFLOW = 0x1CE + SYS_TCFLUSH = 0x1CF + SYS_TCGETATTR = 0x1D0 + SYS_TCGETPGRP = 0x1D1 + SYS_TCSENDBREAK = 0x1D2 + SYS_TCSETATTR = 0x1D3 + SYS_TCSETPGRP = 0x1D4 + SYS_TIMES = 0x1D5 + SYS_TTYNAME = 0x1D6 + SYS_TZSET = 0x1D7 + SYS_UMASK = 0x1D8 + SYS_UMOUNT = 0x1D9 + SYS_UNAME = 0x1DA + SYS_UNLINK = 0x1DB + SYS_UTIME = 0x1DC + SYS_WAIT = 0x1DD + SYS_WAITPID = 0x1DE + SYS_WRITE = 0x1DF + SYS_W_GETPSENT = 0x1B1 + SYS_W_IOCTL = 0x1A2 + SYS_W_STATFS = 0x1CA + SYS_A64L = 0x2EF + SYS_BCMP = 0x2B9 + SYS_BCOPY = 0x2BA + SYS_BZERO = 0x2BB + SYS_CATCLOSE = 0x2B6 + SYS_CATGETS = 0x2B7 + SYS_CATOPEN = 0x2B8 + SYS_CRYPT = 0x2AC + SYS_DBM_CLEARERR = 0x2F7 + SYS_DBM_CLOSE = 0x2F8 + SYS_DBM_DELETE = 0x2F9 + SYS_DBM_ERROR = 0x2FA + SYS_DBM_FETCH = 0x2FB + SYS_DBM_FIRSTKEY = 0x2FC + SYS_DBM_NEXTKEY = 0x2FD + SYS_DBM_OPEN = 0x2FE + SYS_DBM_STORE = 0x2FF + SYS_DRAND48 = 0x2B2 + SYS_ENCRYPT = 0x2AD + SYS_ENDUTXENT = 0x2E1 + SYS_ERAND48 = 0x2B3 + SYS_ERF = 0x02C + SYS_ERFC = 0x02D + SYS_FCHDIR = 0x2D9 + SYS_FFS = 0x2BC + SYS_FMTMSG = 0x2E5 + SYS_FSTATVFS = 0x2B4 + SYS_FTIME = 0x2F5 + SYS_GAMMA = 0x02E + SYS_GETDATE = 0x2A6 + SYS_GETPAGESIZE = 0x2D8 + SYS_GETTIMEOFDAY = 0x2F6 + SYS_GETUTXENT = 0x2E0 + SYS_GETUTXID = 0x2E2 + SYS_GETUTXLINE = 0x2E3 + SYS_HCREATE = 0x2C6 + SYS_HDESTROY = 0x2C7 + SYS_HSEARCH = 0x2C8 + SYS_HYPOT = 0x02B + SYS_INDEX = 0x2BD + SYS_INITSTATE = 0x2C2 + SYS_INSQUE = 0x2CF + SYS_ISASCII = 0x2ED + SYS_JRAND48 = 0x2E6 + SYS_L64A = 0x2F0 + SYS_LCONG48 = 0x2EA + SYS_LFIND = 0x2C9 + SYS_LRAND48 = 0x2E7 + SYS_LSEARCH = 0x2CA + SYS_MEMCCPY = 0x2D4 + SYS_MRAND48 = 0x2E8 + SYS_NRAND48 = 0x2E9 + SYS_PCLOSE = 0x2D2 + SYS_POPEN = 0x2D1 + SYS_PUTUTXLINE = 0x2E4 + SYS_RANDOM = 0x2C4 + SYS_REMQUE = 0x2D0 + SYS_RINDEX = 0x2BE + SYS_SEED48 = 0x2EC + SYS_SETKEY = 0x2AE + SYS_SETSTATE = 0x2C3 + SYS_SETUTXENT = 0x2DF + SYS_SRAND48 = 0x2EB + SYS_SRANDOM = 0x2C5 + SYS_STATVFS = 0x2B5 + SYS_STRCASECMP = 0x2BF + SYS_STRDUP = 0x2C0 + SYS_STRNCASECMP = 0x2C1 + SYS_SWAB = 0x2D3 + SYS_TDELETE = 0x2CB + SYS_TFIND = 0x2CC + SYS_TOASCII = 0x2EE + SYS_TSEARCH = 0x2CD + SYS_TWALK = 0x2CE + SYS_UALARM = 0x2F1 + SYS_USLEEP = 0x2F2 + SYS_WAIT3 = 0x2A7 + SYS_WAITID = 0x2A8 + SYS_Y1 = 0x02A + SYS___ATOE = 0x2DB + SYS___ATOE_L = 0x2DC + SYS___CATTRM = 0x2A9 + SYS___CNVBLK = 0x2AF + SYS___CRYTRM = 0x2B0 + SYS___DLGHT = 0x2A1 + SYS___ECRTRM = 0x2B1 + SYS___ETOA = 0x2DD + SYS___ETOA_L = 0x2DE + SYS___GDTRM = 0x2AA + SYS___OCLCK = 0x2DA + SYS___OPARGF = 0x2A2 + SYS___OPERRF = 0x2A5 + SYS___OPINDF = 0x2A4 + SYS___OPOPTF = 0x2A3 + SYS___RNDTRM = 0x2AB + SYS___SRCTRM = 0x2F4 + SYS___TZONE = 0x2A0 + SYS___UTXTRM = 0x2F3 + SYS_ASIN = 0x03E + SYS_ISXDIGIT = 0x03B + SYS_SETLOCAL = 0x03A + SYS_SETLOCALE = 0x03A + SYS_SIN = 0x03F + SYS_TOLOWER = 0x03C + SYS_TOUPPER = 0x03D + SYS_ACCEPT_AND_RECV = 0x4F7 + SYS_ATOL = 0x04E + SYS_CHECKSCH = 0x4BC + SYS_CHECKSCHENV = 0x4BC + SYS_CLEARERR = 0x04C + SYS_CONNECTS = 0x4B5 + SYS_CONNECTSERVER = 0x4B5 + SYS_CONNECTW = 0x4B4 + SYS_CONNECTWORKMGR = 0x4B4 + SYS_CONTINUE = 0x4B3 + SYS_CONTINUEWORKUNIT = 0x4B3 + SYS_COPYSIGN = 0x4C2 + SYS_CREATEWO = 0x4B2 + SYS_CREATEWORKUNIT = 0x4B2 + SYS_DELETEWO = 0x4B9 + SYS_DELETEWORKUNIT = 0x4B9 + SYS_DISCONNE = 0x4B6 + SYS_DISCONNECTSERVER = 0x4B6 + SYS_FEOF = 0x04D + SYS_FERROR = 0x04A + SYS_FINITE = 0x4C8 + SYS_GAMMA_R = 0x4E2 + SYS_JOINWORK = 0x4B7 + SYS_JOINWORKUNIT = 0x4B7 + SYS_LEAVEWOR = 0x4B8 + SYS_LEAVEWORKUNIT = 0x4B8 + SYS_LGAMMA_R = 0x4EB + SYS_MATHERR = 0x4D0 + SYS_PERROR = 0x04F + SYS_QUERYMET = 0x4BA + SYS_QUERYMETRICS = 0x4BA + SYS_QUERYSCH = 0x4BB + SYS_QUERYSCHENV = 0x4BB + SYS_REWIND = 0x04B + SYS_SCALBN = 0x4D4 + SYS_SIGNIFIC = 0x4D5 + SYS_SIGNIFICAND = 0x4D5 + SYS___ACOSH_B = 0x4DA + SYS___ACOS_B = 0x4D9 + SYS___ASINH_B = 0x4BE + SYS___ASIN_B = 0x4DB + SYS___ATAN2_B = 0x4DC + SYS___ATANH_B = 0x4DD + SYS___ATAN_B = 0x4BF + SYS___CBRT_B = 0x4C0 + SYS___CEIL_B = 0x4C1 + SYS___COSH_B = 0x4DE + SYS___COS_B = 0x4C3 + SYS___DGHT = 0x4A8 + SYS___ENVN = 0x4B0 + SYS___ERFC_B = 0x4C5 + SYS___ERF_B = 0x4C4 + SYS___EXPM1_B = 0x4C6 + SYS___EXP_B = 0x4DF + SYS___FABS_B = 0x4C7 + SYS___FLOOR_B = 0x4C9 + SYS___FMOD_B = 0x4E0 + SYS___FP_SETMODE = 0x4F8 + SYS___FREXP_B = 0x4CA + SYS___GAMMA_B = 0x4E1 + SYS___GDRR = 0x4A1 + SYS___HRRNO = 0x4A2 + SYS___HYPOT_B = 0x4E3 + SYS___ILOGB_B = 0x4CB + SYS___ISNAN_B = 0x4CC + SYS___J0_B = 0x4E4 + SYS___J1_B = 0x4E6 + SYS___JN_B = 0x4E8 + SYS___LDEXP_B = 0x4CD + SYS___LGAMMA_B = 0x4EA + SYS___LOG10_B = 0x4ED + SYS___LOG1P_B = 0x4CE + SYS___LOGB_B = 0x4CF + SYS___LOGIN = 0x4F5 + SYS___LOG_B = 0x4EC + SYS___MLOCKALL = 0x4B1 + SYS___MODF_B = 0x4D1 + SYS___NEXTAFTER_B = 0x4D2 + SYS___OPENDIR2 = 0x4F3 + SYS___OPEN_STAT = 0x4F6 + SYS___OPND = 0x4A5 + SYS___OPPT = 0x4A6 + SYS___OPRG = 0x4A3 + SYS___OPRR = 0x4A4 + SYS___PID_AFFINITY = 0x4BD + SYS___POW_B = 0x4EE + SYS___READDIR2 = 0x4F4 + SYS___REMAINDER_B = 0x4EF + SYS___RINT_B = 0x4D3 + SYS___SCALB_B = 0x4F0 + SYS___SIGACTIONSET = 0x4FB + SYS___SIGGM = 0x4A7 + SYS___SINH_B = 0x4F1 + SYS___SIN_B = 0x4D6 + SYS___SQRT_B = 0x4F2 + SYS___TANH_B = 0x4D8 + SYS___TAN_B = 0x4D7 + SYS___TRRNO = 0x4AF + SYS___TZNE = 0x4A9 + SYS___TZZN = 0x4AA + SYS___UCREATE = 0x4FC + SYS___UFREE = 0x4FE + SYS___UHEAPREPORT = 0x4FF + SYS___UMALLOC = 0x4FD + SYS___Y0_B = 0x4E5 + SYS___Y1_B = 0x4E7 + SYS___YN_B = 0x4E9 + SYS_ABORT = 0x05C + SYS_ASCTIME_R = 0x5E0 + SYS_ATEXIT = 0x05D + SYS_CONNECTE = 0x5AE + SYS_CONNECTEXPORTIMPORT = 0x5AE + SYS_CTIME_R = 0x5E1 + SYS_DN_COMP = 0x5DF + SYS_DN_EXPAND = 0x5DD + SYS_DN_SKIPNAME = 0x5DE + SYS_EXIT = 0x05A + SYS_EXPORTWO = 0x5A1 + SYS_EXPORTWORKUNIT = 0x5A1 + SYS_EXTRACTW = 0x5A5 + SYS_EXTRACTWORKUNIT = 0x5A5 + SYS_FSEEKO = 0x5C9 + SYS_FTELLO = 0x5C8 + SYS_GETGRGID_R = 0x5E7 + SYS_GETGRNAM_R = 0x5E8 + SYS_GETLOGIN_R = 0x5E9 + SYS_GETPWNAM_R = 0x5EA + SYS_GETPWUID_R = 0x5EB + SYS_GMTIME_R = 0x5E2 + SYS_IMPORTWO = 0x5A3 + SYS_IMPORTWORKUNIT = 0x5A3 + SYS_INET_NTOP = 0x5D3 + SYS_INET_PTON = 0x5D4 + SYS_LLABS = 0x5CE + SYS_LLDIV = 0x5CB + SYS_LOCALTIME_R = 0x5E3 + SYS_PTHREAD_ATFORK = 0x5ED + SYS_PTHREAD_ATTR_GETDETACHSTATE_U98 = 0x5FB + SYS_PTHREAD_ATTR_GETGUARDSIZE = 0x5EE + SYS_PTHREAD_ATTR_GETSCHEDPARAM = 0x5F9 + SYS_PTHREAD_ATTR_GETSTACKADDR = 0x5EF + SYS_PTHREAD_ATTR_SETDETACHSTATE_U98 = 0x5FC + SYS_PTHREAD_ATTR_SETGUARDSIZE = 0x5F0 + SYS_PTHREAD_ATTR_SETSCHEDPARAM = 0x5FA + SYS_PTHREAD_ATTR_SETSTACKADDR = 0x5F1 + SYS_PTHREAD_CONDATTR_GETPSHARED = 0x5F2 + SYS_PTHREAD_CONDATTR_SETPSHARED = 0x5F3 + SYS_PTHREAD_DETACH_U98 = 0x5FD + SYS_PTHREAD_GETCONCURRENCY = 0x5F4 + SYS_PTHREAD_GETSPECIFIC_U98 = 0x5FE + SYS_PTHREAD_KEY_DELETE = 0x5F5 + SYS_PTHREAD_SETCANCELSTATE = 0x5FF + SYS_PTHREAD_SETCONCURRENCY = 0x5F6 + SYS_PTHREAD_SIGMASK = 0x5F7 + SYS_QUERYENC = 0x5AD + SYS_QUERYWORKUNITCLASSIFICATION = 0x5AD + SYS_RAISE = 0x05E + SYS_RAND_R = 0x5E4 + SYS_READDIR_R = 0x5E6 + SYS_REALLOC = 0x05B + SYS_RES_INIT = 0x5D8 + SYS_RES_MKQUERY = 0x5D7 + SYS_RES_QUERY = 0x5D9 + SYS_RES_QUERYDOMAIN = 0x5DC + SYS_RES_SEARCH = 0x5DA + SYS_RES_SEND = 0x5DB + SYS_SETJMP = 0x05F + SYS_SIGQUEUE = 0x5A9 + SYS_STRTOK_R = 0x5E5 + SYS_STRTOLL = 0x5B0 + SYS_STRTOULL = 0x5B1 + SYS_TTYNAME_R = 0x5EC + SYS_UNDOEXPO = 0x5A2 + SYS_UNDOEXPORTWORKUNIT = 0x5A2 + SYS_UNDOIMPO = 0x5A4 + SYS_UNDOIMPORTWORKUNIT = 0x5A4 + SYS_WCSTOLL = 0x5CC + SYS_WCSTOULL = 0x5CD + SYS___ABORT = 0x05C + SYS___CONSOLE2 = 0x5D2 + SYS___CPL = 0x5A6 + SYS___DISCARDDATA = 0x5F8 + SYS___DSA_PREV = 0x5B2 + SYS___EP_FIND = 0x5B3 + SYS___FP_SWAPMODE = 0x5AF + SYS___GETUSERID = 0x5AB + SYS___GET_CPUID = 0x5B9 + SYS___GET_SYSTEM_SETTINGS = 0x5BA + SYS___IPDOMAINNAME = 0x5AC + SYS___MAP_INIT = 0x5A7 + SYS___MAP_SERVICE = 0x5A8 + SYS___MOUNT = 0x5AA + SYS___MSGRCV_TIMED = 0x5B7 + SYS___RES = 0x5D6 + SYS___SEMOP_TIMED = 0x5B8 + SYS___SERVER_THREADS_QUERY = 0x5B4 + SYS_FPRINTF = 0x06D + SYS_FSCANF = 0x06A + SYS_PRINTF = 0x06F + SYS_SETBUF = 0x06B + SYS_SETVBUF = 0x06C + SYS_SSCANF = 0x06E + SYS___CATGETS_A = 0x6C0 + SYS___CHAUDIT_A = 0x6F4 + SYS___CHMOD_A = 0x6E8 + SYS___COLLATE_INIT_A = 0x6AC + SYS___CREAT_A = 0x6F6 + SYS___CTYPE_INIT_A = 0x6AF + SYS___DLLLOAD_A = 0x6DF + SYS___DLLQUERYFN_A = 0x6E0 + SYS___DLLQUERYVAR_A = 0x6E1 + SYS___E2A_L = 0x6E3 + SYS___EXECLE_A = 0x6A0 + SYS___EXECLP_A = 0x6A4 + SYS___EXECVE_A = 0x6C1 + SYS___EXECVP_A = 0x6C2 + SYS___EXECV_A = 0x6B1 + SYS___FPRINTF_A = 0x6FA + SYS___GETADDRINFO_A = 0x6BF + SYS___GETNAMEINFO_A = 0x6C4 + SYS___GET_WCTYPE_STD_A = 0x6AE + SYS___ICONV_OPEN_A = 0x6DE + SYS___IF_INDEXTONAME_A = 0x6DC + SYS___IF_NAMETOINDEX_A = 0x6DB + SYS___ISWCTYPE_A = 0x6B0 + SYS___IS_WCTYPE_STD_A = 0x6B2 + SYS___LOCALECONV_A = 0x6B8 + SYS___LOCALECONV_STD_A = 0x6B9 + SYS___LOCALE_INIT_A = 0x6B7 + SYS___LSTAT_A = 0x6EE + SYS___LSTAT_O_A = 0x6EF + SYS___MKDIR_A = 0x6E9 + SYS___MKFIFO_A = 0x6EC + SYS___MKNOD_A = 0x6F0 + SYS___MONETARY_INIT_A = 0x6BC + SYS___MOUNT_A = 0x6F1 + SYS___NL_CSINFO_A = 0x6D6 + SYS___NL_LANGINFO_A = 0x6BA + SYS___NL_LNAGINFO_STD_A = 0x6BB + SYS___NL_MONINFO_A = 0x6D7 + SYS___NL_NUMINFO_A = 0x6D8 + SYS___NL_RESPINFO_A = 0x6D9 + SYS___NL_TIMINFO_A = 0x6DA + SYS___NUMERIC_INIT_A = 0x6C6 + SYS___OPEN_A = 0x6F7 + SYS___PRINTF_A = 0x6DD + SYS___RESP_INIT_A = 0x6C7 + SYS___RPMATCH_A = 0x6C8 + SYS___RPMATCH_C_A = 0x6C9 + SYS___RPMATCH_STD_A = 0x6CA + SYS___SETLOCALE_A = 0x6F9 + SYS___SPAWNP_A = 0x6C5 + SYS___SPAWN_A = 0x6C3 + SYS___SPRINTF_A = 0x6FB + SYS___STAT_A = 0x6EA + SYS___STAT_O_A = 0x6EB + SYS___STRCOLL_STD_A = 0x6A1 + SYS___STRFMON_A = 0x6BD + SYS___STRFMON_STD_A = 0x6BE + SYS___STRFTIME_A = 0x6CC + SYS___STRFTIME_STD_A = 0x6CD + SYS___STRPTIME_A = 0x6CE + SYS___STRPTIME_STD_A = 0x6CF + SYS___STRXFRM_A = 0x6A2 + SYS___STRXFRM_C_A = 0x6A3 + SYS___STRXFRM_STD_A = 0x6A5 + SYS___SYNTAX_INIT_A = 0x6D4 + SYS___TIME_INIT_A = 0x6CB + SYS___TOD_INIT_A = 0x6D5 + SYS___TOWLOWER_A = 0x6B3 + SYS___TOWLOWER_STD_A = 0x6B4 + SYS___TOWUPPER_A = 0x6B5 + SYS___TOWUPPER_STD_A = 0x6B6 + SYS___UMOUNT_A = 0x6F2 + SYS___VFPRINTF_A = 0x6FC + SYS___VPRINTF_A = 0x6FD + SYS___VSPRINTF_A = 0x6FE + SYS___VSWPRINTF_A = 0x6FF + SYS___WCSCOLL_A = 0x6A6 + SYS___WCSCOLL_C_A = 0x6A7 + SYS___WCSCOLL_STD_A = 0x6A8 + SYS___WCSFTIME_A = 0x6D0 + SYS___WCSFTIME_STD_A = 0x6D1 + SYS___WCSXFRM_A = 0x6A9 + SYS___WCSXFRM_C_A = 0x6AA + SYS___WCSXFRM_STD_A = 0x6AB + SYS___WCTYPE_A = 0x6AD + SYS___W_GETMNTENT_A = 0x6F5 + SYS_____CCSIDTYPE_A = 0x6E6 + SYS_____CHATTR_A = 0x6E2 + SYS_____CSNAMETYPE_A = 0x6E7 + SYS_____OPEN_STAT_A = 0x6ED + SYS_____SPAWN2_A = 0x6D2 + SYS_____SPAWNP2_A = 0x6D3 + SYS_____TOCCSID_A = 0x6E4 + SYS_____TOCSNAME_A = 0x6E5 + SYS_ACL_FREE = 0x7FF + SYS_ACL_INIT = 0x7FE + SYS_FWIDE = 0x7DF + SYS_FWPRINTF = 0x7D1 + SYS_FWRITE = 0x07E + SYS_FWSCANF = 0x7D5 + SYS_GETCHAR = 0x07B + SYS_GETS = 0x07C + SYS_M_CREATE_LAYOUT = 0x7C9 + SYS_M_DESTROY_LAYOUT = 0x7CA + SYS_M_GETVALUES_LAYOUT = 0x7CB + SYS_M_SETVALUES_LAYOUT = 0x7CC + SYS_M_TRANSFORM_LAYOUT = 0x7CD + SYS_M_WTRANSFORM_LAYOUT = 0x7CE + SYS_PREAD = 0x7C7 + SYS_PUTC = 0x07D + SYS_PUTCHAR = 0x07A + SYS_PUTS = 0x07F + SYS_PWRITE = 0x7C8 + SYS_TOWCTRAN = 0x7D8 + SYS_TOWCTRANS = 0x7D8 + SYS_UNATEXIT = 0x7B5 + SYS_VFWPRINT = 0x7D3 + SYS_VFWPRINTF = 0x7D3 + SYS_VWPRINTF = 0x7D4 + SYS_WCTRANS = 0x7D7 + SYS_WPRINTF = 0x7D2 + SYS_WSCANF = 0x7D6 + SYS___ASCTIME_R_A = 0x7A1 + SYS___BASENAME_A = 0x7DC + SYS___BTOWC_A = 0x7E4 + SYS___CDUMP_A = 0x7B7 + SYS___CEE3DMP_A = 0x7B6 + SYS___CEILF_H = 0x7F4 + SYS___CEILL_H = 0x7F5 + SYS___CEIL_H = 0x7EA + SYS___CRYPT_A = 0x7BE + SYS___CSNAP_A = 0x7B8 + SYS___CTEST_A = 0x7B9 + SYS___CTIME_R_A = 0x7A2 + SYS___CTRACE_A = 0x7BA + SYS___DBM_OPEN_A = 0x7E6 + SYS___DIRNAME_A = 0x7DD + SYS___FABSF_H = 0x7FA + SYS___FABSL_H = 0x7FB + SYS___FABS_H = 0x7ED + SYS___FGETWC_A = 0x7AA + SYS___FGETWS_A = 0x7AD + SYS___FLOORF_H = 0x7F6 + SYS___FLOORL_H = 0x7F7 + SYS___FLOOR_H = 0x7EB + SYS___FPUTWC_A = 0x7A5 + SYS___FPUTWS_A = 0x7A8 + SYS___GETTIMEOFDAY_A = 0x7AE + SYS___GETWCHAR_A = 0x7AC + SYS___GETWC_A = 0x7AB + SYS___GLOB_A = 0x7DE + SYS___GMTIME_A = 0x7AF + SYS___GMTIME_R_A = 0x7B0 + SYS___INET_PTON_A = 0x7BC + SYS___J0_H = 0x7EE + SYS___J1_H = 0x7EF + SYS___JN_H = 0x7F0 + SYS___LOCALTIME_A = 0x7B1 + SYS___LOCALTIME_R_A = 0x7B2 + SYS___MALLOC24 = 0x7FC + SYS___MALLOC31 = 0x7FD + SYS___MKTIME_A = 0x7B3 + SYS___MODFF_H = 0x7F8 + SYS___MODFL_H = 0x7F9 + SYS___MODF_H = 0x7EC + SYS___OPENDIR_A = 0x7C2 + SYS___OSNAME = 0x7E0 + SYS___PUTWCHAR_A = 0x7A7 + SYS___PUTWC_A = 0x7A6 + SYS___READDIR_A = 0x7C3 + SYS___STRTOLL_A = 0x7A3 + SYS___STRTOULL_A = 0x7A4 + SYS___SYSLOG_A = 0x7BD + SYS___TZZNA = 0x7B4 + SYS___UNGETWC_A = 0x7A9 + SYS___UTIME_A = 0x7A0 + SYS___VFPRINTF2_A = 0x7E7 + SYS___VPRINTF2_A = 0x7E8 + SYS___VSPRINTF2_A = 0x7E9 + SYS___VSWPRNTF2_A = 0x7BB + SYS___WCSTOD_A = 0x7D9 + SYS___WCSTOL_A = 0x7DA + SYS___WCSTOUL_A = 0x7DB + SYS___WCTOB_A = 0x7E5 + SYS___Y0_H = 0x7F1 + SYS___Y1_H = 0x7F2 + SYS___YN_H = 0x7F3 + SYS_____OPENDIR2_A = 0x7BF + SYS_____OSNAME_A = 0x7E1 + SYS_____READDIR2_A = 0x7C0 + SYS_DLCLOSE = 0x8DF + SYS_DLERROR = 0x8E0 + SYS_DLOPEN = 0x8DD + SYS_DLSYM = 0x8DE + SYS_FLOCKFILE = 0x8D3 + SYS_FTRYLOCKFILE = 0x8D4 + SYS_FUNLOCKFILE = 0x8D5 + SYS_GETCHAR_UNLOCKED = 0x8D7 + SYS_GETC_UNLOCKED = 0x8D6 + SYS_PUTCHAR_UNLOCKED = 0x8D9 + SYS_PUTC_UNLOCKED = 0x8D8 + SYS_SNPRINTF = 0x8DA + SYS_VSNPRINTF = 0x8DB + SYS_WCSCSPN = 0x08B + SYS_WCSLEN = 0x08C + SYS_WCSNCAT = 0x08D + SYS_WCSNCMP = 0x08A + SYS_WCSNCPY = 0x08F + SYS_WCSSPN = 0x08E + SYS___ABSF_H = 0x8E7 + SYS___ABSL_H = 0x8E8 + SYS___ABS_H = 0x8E6 + SYS___ACOSF_H = 0x8EA + SYS___ACOSH_H = 0x8EC + SYS___ACOSL_H = 0x8EB + SYS___ACOS_H = 0x8E9 + SYS___ASINF_H = 0x8EE + SYS___ASINH_H = 0x8F0 + SYS___ASINL_H = 0x8EF + SYS___ASIN_H = 0x8ED + SYS___ATAN2F_H = 0x8F8 + SYS___ATAN2L_H = 0x8F9 + SYS___ATAN2_H = 0x8F7 + SYS___ATANF_H = 0x8F2 + SYS___ATANHF_H = 0x8F5 + SYS___ATANHL_H = 0x8F6 + SYS___ATANH_H = 0x8F4 + SYS___ATANL_H = 0x8F3 + SYS___ATAN_H = 0x8F1 + SYS___CBRT_H = 0x8FA + SYS___COPYSIGNF_H = 0x8FB + SYS___COPYSIGNL_H = 0x8FC + SYS___COSF_H = 0x8FE + SYS___COSL_H = 0x8FF + SYS___COS_H = 0x8FD + SYS___DLERROR_A = 0x8D2 + SYS___DLOPEN_A = 0x8D0 + SYS___DLSYM_A = 0x8D1 + SYS___GETUTXENT_A = 0x8C6 + SYS___GETUTXID_A = 0x8C7 + SYS___GETUTXLINE_A = 0x8C8 + SYS___ITOA = 0x8AA + SYS___ITOA_A = 0x8B0 + SYS___LE_CONDITION_TOKEN_BUILD = 0x8A5 + SYS___LE_MSG_ADD_INSERT = 0x8A6 + SYS___LE_MSG_GET = 0x8A7 + SYS___LE_MSG_GET_AND_WRITE = 0x8A8 + SYS___LE_MSG_WRITE = 0x8A9 + SYS___LLTOA = 0x8AE + SYS___LLTOA_A = 0x8B4 + SYS___LTOA = 0x8AC + SYS___LTOA_A = 0x8B2 + SYS___PUTCHAR_UNLOCKED_A = 0x8CC + SYS___PUTC_UNLOCKED_A = 0x8CB + SYS___PUTUTXLINE_A = 0x8C9 + SYS___RESET_EXCEPTION_HANDLER = 0x8E3 + SYS___REXEC_A = 0x8C4 + SYS___REXEC_AF_A = 0x8C5 + SYS___SET_EXCEPTION_HANDLER = 0x8E2 + SYS___SNPRINTF_A = 0x8CD + SYS___SUPERKILL = 0x8A4 + SYS___TCGETATTR_A = 0x8A1 + SYS___TCSETATTR_A = 0x8A2 + SYS___ULLTOA = 0x8AF + SYS___ULLTOA_A = 0x8B5 + SYS___ULTOA = 0x8AD + SYS___ULTOA_A = 0x8B3 + SYS___UTOA = 0x8AB + SYS___UTOA_A = 0x8B1 + SYS___VHM_EVENT = 0x8E4 + SYS___VSNPRINTF_A = 0x8CE + SYS_____GETENV_A = 0x8C3 + SYS_____UTMPXNAME_A = 0x8CA + SYS_CACOSH = 0x9A0 + SYS_CACOSHF = 0x9A3 + SYS_CACOSHL = 0x9A6 + SYS_CARG = 0x9A9 + SYS_CARGF = 0x9AC + SYS_CARGL = 0x9AF + SYS_CASIN = 0x9B2 + SYS_CASINF = 0x9B5 + SYS_CASINH = 0x9BB + SYS_CASINHF = 0x9BE + SYS_CASINHL = 0x9C1 + SYS_CASINL = 0x9B8 + SYS_CATAN = 0x9C4 + SYS_CATANF = 0x9C7 + SYS_CATANH = 0x9CD + SYS_CATANHF = 0x9D0 + SYS_CATANHL = 0x9D3 + SYS_CATANL = 0x9CA + SYS_CCOS = 0x9D6 + SYS_CCOSF = 0x9D9 + SYS_CCOSH = 0x9DF + SYS_CCOSHF = 0x9E2 + SYS_CCOSHL = 0x9E5 + SYS_CCOSL = 0x9DC + SYS_CEXP = 0x9E8 + SYS_CEXPF = 0x9EB + SYS_CEXPL = 0x9EE + SYS_CIMAG = 0x9F1 + SYS_CIMAGF = 0x9F4 + SYS_CIMAGL = 0x9F7 + SYS_CLOGF = 0x9FD + SYS_MEMCHR = 0x09B + SYS_MEMCMP = 0x09A + SYS_STRCOLL = 0x09C + SYS_STRNCMP = 0x09D + SYS_STRRCHR = 0x09F + SYS_STRXFRM = 0x09E + SYS___CACOSHF_B = 0x9A4 + SYS___CACOSHF_H = 0x9A5 + SYS___CACOSHL_B = 0x9A7 + SYS___CACOSHL_H = 0x9A8 + SYS___CACOSH_B = 0x9A1 + SYS___CACOSH_H = 0x9A2 + SYS___CARGF_B = 0x9AD + SYS___CARGF_H = 0x9AE + SYS___CARGL_B = 0x9B0 + SYS___CARGL_H = 0x9B1 + SYS___CARG_B = 0x9AA + SYS___CARG_H = 0x9AB + SYS___CASINF_B = 0x9B6 + SYS___CASINF_H = 0x9B7 + SYS___CASINHF_B = 0x9BF + SYS___CASINHF_H = 0x9C0 + SYS___CASINHL_B = 0x9C2 + SYS___CASINHL_H = 0x9C3 + SYS___CASINH_B = 0x9BC + SYS___CASINH_H = 0x9BD + SYS___CASINL_B = 0x9B9 + SYS___CASINL_H = 0x9BA + SYS___CASIN_B = 0x9B3 + SYS___CASIN_H = 0x9B4 + SYS___CATANF_B = 0x9C8 + SYS___CATANF_H = 0x9C9 + SYS___CATANHF_B = 0x9D1 + SYS___CATANHF_H = 0x9D2 + SYS___CATANHL_B = 0x9D4 + SYS___CATANHL_H = 0x9D5 + SYS___CATANH_B = 0x9CE + SYS___CATANH_H = 0x9CF + SYS___CATANL_B = 0x9CB + SYS___CATANL_H = 0x9CC + SYS___CATAN_B = 0x9C5 + SYS___CATAN_H = 0x9C6 + SYS___CCOSF_B = 0x9DA + SYS___CCOSF_H = 0x9DB + SYS___CCOSHF_B = 0x9E3 + SYS___CCOSHF_H = 0x9E4 + SYS___CCOSHL_B = 0x9E6 + SYS___CCOSHL_H = 0x9E7 + SYS___CCOSH_B = 0x9E0 + SYS___CCOSH_H = 0x9E1 + SYS___CCOSL_B = 0x9DD + SYS___CCOSL_H = 0x9DE + SYS___CCOS_B = 0x9D7 + SYS___CCOS_H = 0x9D8 + SYS___CEXPF_B = 0x9EC + SYS___CEXPF_H = 0x9ED + SYS___CEXPL_B = 0x9EF + SYS___CEXPL_H = 0x9F0 + SYS___CEXP_B = 0x9E9 + SYS___CEXP_H = 0x9EA + SYS___CIMAGF_B = 0x9F5 + SYS___CIMAGF_H = 0x9F6 + SYS___CIMAGL_B = 0x9F8 + SYS___CIMAGL_H = 0x9F9 + SYS___CIMAG_B = 0x9F2 + SYS___CIMAG_H = 0x9F3 + SYS___CLOG = 0x9FA + SYS___CLOGF_B = 0x9FE + SYS___CLOGF_H = 0x9FF + SYS___CLOG_B = 0x9FB + SYS___CLOG_H = 0x9FC + SYS_ISWCTYPE = 0x10C + SYS_ISWXDIGI = 0x10A + SYS_ISWXDIGIT = 0x10A + SYS_MBSINIT = 0x10F + SYS_TOWLOWER = 0x10D + SYS_TOWUPPER = 0x10E + SYS_WCTYPE = 0x10B + SYS_WCSSTR = 0x11B + SYS___RPMTCH = 0x11A + SYS_WCSTOD = 0x12E + SYS_WCSTOK = 0x12C + SYS_WCSTOL = 0x12D + SYS_WCSTOUL = 0x12F + SYS_FGETWC = 0x13C + SYS_FGETWS = 0x13D + SYS_FPUTWC = 0x13E + SYS_FPUTWS = 0x13F + SYS_REGERROR = 0x13B + SYS_REGFREE = 0x13A + SYS_COLLEQUIV = 0x14F + SYS_COLLTOSTR = 0x14E + SYS_ISMCCOLLEL = 0x14C + SYS_STRTOCOLL = 0x14D + SYS_DLLFREE = 0x16F + SYS_DLLQUERYFN = 0x16D + SYS_DLLQUERYVAR = 0x16E + SYS_GETMCCOLL = 0x16A + SYS_GETWMCCOLL = 0x16B + SYS___ERR2AD = 0x16C + SYS_CFSETOSPEED = 0x17A + SYS_CHDIR = 0x17B + SYS_CHMOD = 0x17C + SYS_CHOWN = 0x17D + SYS_CLOSE = 0x17E + SYS_CLOSEDIR = 0x17F + SYS_LOG = 0x017 + SYS_COSH = 0x018 + SYS_FCHMOD = 0x18A + SYS_FCHOWN = 0x18B + SYS_FCNTL = 0x18C + SYS_FILENO = 0x18D + SYS_FORK = 0x18E + SYS_FPATHCONF = 0x18F + SYS_GETLOGIN = 0x19A + SYS_GETPGRP = 0x19C + SYS_GETPID = 0x19D + SYS_GETPPID = 0x19E + SYS_GETPWNAM = 0x19F + SYS_TANH = 0x019 + SYS_W_GETMNTENT = 0x19B + SYS_POW = 0x020 + SYS_PTHREAD_SELF = 0x20A + SYS_PTHREAD_SETINTR = 0x20B + SYS_PTHREAD_SETINTRTYPE = 0x20C + SYS_PTHREAD_SETSPECIFIC = 0x20D + SYS_PTHREAD_TESTINTR = 0x20E + SYS_PTHREAD_YIELD = 0x20F + SYS_SQRT = 0x021 + SYS_FLOOR = 0x022 + SYS_J1 = 0x023 + SYS_WCSPBRK = 0x23F + SYS_BSEARCH = 0x24C + SYS_FABS = 0x024 + SYS_GETENV = 0x24A + SYS_LDIV = 0x24D + SYS_SYSTEM = 0x24B + SYS_FMOD = 0x025 + SYS___RETHROW = 0x25F + SYS___THROW = 0x25E + SYS_J0 = 0x026 + SYS_PUTENV = 0x26A + SYS___GETENV = 0x26F + SYS_SEMCTL = 0x27A + SYS_SEMGET = 0x27B + SYS_SEMOP = 0x27C + SYS_SHMAT = 0x27D + SYS_SHMCTL = 0x27E + SYS_SHMDT = 0x27F + SYS_YN = 0x027 + SYS_JN = 0x028 + SYS_SIGALTSTACK = 0x28A + SYS_SIGHOLD = 0x28B + SYS_SIGIGNORE = 0x28C + SYS_SIGINTERRUPT = 0x28D + SYS_SIGPAUSE = 0x28E + SYS_SIGRELSE = 0x28F + SYS_GETOPT = 0x29A + SYS_GETSUBOPT = 0x29D + SYS_LCHOWN = 0x29B + SYS_SETPGRP = 0x29E + SYS_TRUNCATE = 0x29C + SYS_Y0 = 0x029 + SYS___GDERR = 0x29F + SYS_ISALPHA = 0x030 + SYS_VFORK = 0x30F + SYS__LONGJMP = 0x30D + SYS__SETJMP = 0x30E + SYS_GLOB = 0x31A + SYS_GLOBFREE = 0x31B + SYS_ISALNUM = 0x031 + SYS_PUTW = 0x31C + SYS_SEEKDIR = 0x31D + SYS_TELLDIR = 0x31E + SYS_TEMPNAM = 0x31F + SYS_GETTIMEOFDAY_R = 0x32E + SYS_ISLOWER = 0x032 + SYS_LGAMMA = 0x32C + SYS_REMAINDER = 0x32A + SYS_SCALB = 0x32B + SYS_SYNC = 0x32F + SYS_TTYSLOT = 0x32D + SYS_ENDPROTOENT = 0x33A + SYS_ENDSERVENT = 0x33B + SYS_GETHOSTBYADDR = 0x33D + SYS_GETHOSTBYADDR_R = 0x33C + SYS_GETHOSTBYNAME = 0x33F + SYS_GETHOSTBYNAME_R = 0x33E + SYS_ISCNTRL = 0x033 + SYS_GETSERVBYNAME = 0x34A + SYS_GETSERVBYPORT = 0x34B + SYS_GETSERVENT = 0x34C + SYS_GETSOCKNAME = 0x34D + SYS_GETSOCKOPT = 0x34E + SYS_INET_ADDR = 0x34F + SYS_ISDIGIT = 0x034 + SYS_ISGRAPH = 0x035 + SYS_SELECT = 0x35B + SYS_SELECTEX = 0x35C + SYS_SEND = 0x35D + SYS_SENDTO = 0x35F + SYS_CHROOT = 0x36A + SYS_ISNAN = 0x36D + SYS_ISUPPER = 0x036 + SYS_ULIMIT = 0x36C + SYS_UTIMES = 0x36E + SYS_W_STATVFS = 0x36B + SYS___H_ERRNO = 0x36F + SYS_GRANTPT = 0x37A + SYS_ISPRINT = 0x037 + SYS_TCGETSID = 0x37C + SYS_UNLOCKPT = 0x37B + SYS___TCGETCP = 0x37D + SYS___TCSETCP = 0x37E + SYS___TCSETTABLES = 0x37F + SYS_ISPUNCT = 0x038 + SYS_NLIST = 0x38C + SYS___IPDBCS = 0x38D + SYS___IPDSPX = 0x38E + SYS___IPMSGC = 0x38F + SYS___STHOSTENT = 0x38B + SYS___STSERVENT = 0x38A + SYS_ISSPACE = 0x039 + SYS_COS = 0x040 + SYS_T_ALLOC = 0x40A + SYS_T_BIND = 0x40B + SYS_T_CLOSE = 0x40C + SYS_T_CONNECT = 0x40D + SYS_T_ERROR = 0x40E + SYS_T_FREE = 0x40F + SYS_TAN = 0x041 + SYS_T_RCVREL = 0x41A + SYS_T_RCVUDATA = 0x41B + SYS_T_RCVUDERR = 0x41C + SYS_T_SND = 0x41D + SYS_T_SNDDIS = 0x41E + SYS_T_SNDREL = 0x41F + SYS_GETPMSG = 0x42A + SYS_ISASTREAM = 0x42B + SYS_PUTMSG = 0x42C + SYS_PUTPMSG = 0x42D + SYS_SINH = 0x042 + SYS___ISPOSIXON = 0x42E + SYS___OPENMVSREL = 0x42F + SYS_ACOS = 0x043 + SYS_ATAN = 0x044 + SYS_ATAN2 = 0x045 + SYS_FTELL = 0x046 + SYS_FGETPOS = 0x047 + SYS_SOCK_DEBUG = 0x47A + SYS_SOCK_DO_TESTSTOR = 0x47D + SYS_TAKESOCKET = 0x47E + SYS___SERVER_INIT = 0x47F + SYS_FSEEK = 0x048 + SYS___IPHOST = 0x48B + SYS___IPNODE = 0x48C + SYS___SERVER_CLASSIFY_CREATE = 0x48D + SYS___SERVER_CLASSIFY_DESTROY = 0x48E + SYS___SERVER_CLASSIFY_RESET = 0x48F + SYS___SMF_RECORD = 0x48A + SYS_FSETPOS = 0x049 + SYS___FNWSA = 0x49B + SYS___SPAWN2 = 0x49D + SYS___SPAWNP2 = 0x49E + SYS_ATOF = 0x050 + SYS_PTHREAD_MUTEXATTR_GETPSHARED = 0x50A + SYS_PTHREAD_MUTEXATTR_SETPSHARED = 0x50B + SYS_PTHREAD_RWLOCK_DESTROY = 0x50C + SYS_PTHREAD_RWLOCK_INIT = 0x50D + SYS_PTHREAD_RWLOCK_RDLOCK = 0x50E + SYS_PTHREAD_RWLOCK_TRYRDLOCK = 0x50F + SYS_ATOI = 0x051 + SYS___FP_CLASS = 0x51D + SYS___FP_CLR_FLAG = 0x51A + SYS___FP_FINITE = 0x51E + SYS___FP_ISNAN = 0x51F + SYS___FP_RAISE_XCP = 0x51C + SYS___FP_READ_FLAG = 0x51B + SYS_RAND = 0x052 + SYS_SIGTIMEDWAIT = 0x52D + SYS_SIGWAITINFO = 0x52E + SYS___CHKBFP = 0x52F + SYS___FPC_RS = 0x52C + SYS___FPC_RW = 0x52A + SYS___FPC_SM = 0x52B + SYS_STRTOD = 0x053 + SYS_STRTOL = 0x054 + SYS_STRTOUL = 0x055 + SYS_MALLOC = 0x056 + SYS_SRAND = 0x057 + SYS_CALLOC = 0x058 + SYS_FREE = 0x059 + SYS___OSENV = 0x59F + SYS___W_PIOCTL = 0x59E + SYS_LONGJMP = 0x060 + SYS___FLOORF_B = 0x60A + SYS___FLOORL_B = 0x60B + SYS___FREXPF_B = 0x60C + SYS___FREXPL_B = 0x60D + SYS___LDEXPF_B = 0x60E + SYS___LDEXPL_B = 0x60F + SYS_SIGNAL = 0x061 + SYS___ATAN2F_B = 0x61A + SYS___ATAN2L_B = 0x61B + SYS___COSHF_B = 0x61C + SYS___COSHL_B = 0x61D + SYS___EXPF_B = 0x61E + SYS___EXPL_B = 0x61F + SYS_TMPNAM = 0x062 + SYS___ABSF_B = 0x62A + SYS___ABSL_B = 0x62C + SYS___ABS_B = 0x62B + SYS___FMODF_B = 0x62D + SYS___FMODL_B = 0x62E + SYS___MODFF_B = 0x62F + SYS_ATANL = 0x63A + SYS_CEILF = 0x63B + SYS_CEILL = 0x63C + SYS_COSF = 0x63D + SYS_COSHF = 0x63F + SYS_COSL = 0x63E + SYS_REMOVE = 0x063 + SYS_POWL = 0x64A + SYS_RENAME = 0x064 + SYS_SINF = 0x64B + SYS_SINHF = 0x64F + SYS_SINL = 0x64C + SYS_SQRTF = 0x64D + SYS_SQRTL = 0x64E + SYS_BTOWC = 0x65F + SYS_FREXPL = 0x65A + SYS_LDEXPF = 0x65B + SYS_LDEXPL = 0x65C + SYS_MODFF = 0x65D + SYS_MODFL = 0x65E + SYS_TMPFILE = 0x065 + SYS_FREOPEN = 0x066 + SYS___CHARMAP_INIT_A = 0x66E + SYS___GETHOSTBYADDR_R_A = 0x66C + SYS___GETHOSTBYNAME_A = 0x66A + SYS___GETHOSTBYNAME_R_A = 0x66D + SYS___MBLEN_A = 0x66F + SYS___RES_INIT_A = 0x66B + SYS_FCLOSE = 0x067 + SYS___GETGRGID_R_A = 0x67D + SYS___WCSTOMBS_A = 0x67A + SYS___WCSTOMBS_STD_A = 0x67B + SYS___WCSWIDTH_A = 0x67C + SYS___WCSWIDTH_ASIA = 0x67F + SYS___WCSWIDTH_STD_A = 0x67E + SYS_FFLUSH = 0x068 + SYS___GETLOGIN_R_A = 0x68E + SYS___GETPWNAM_R_A = 0x68C + SYS___GETPWUID_R_A = 0x68D + SYS___TTYNAME_R_A = 0x68F + SYS___WCWIDTH_ASIA = 0x68B + SYS___WCWIDTH_STD_A = 0x68A + SYS_FOPEN = 0x069 + SYS___REGEXEC_A = 0x69A + SYS___REGEXEC_STD_A = 0x69B + SYS___REGFREE_A = 0x69C + SYS___REGFREE_STD_A = 0x69D + SYS___STRCOLL_A = 0x69E + SYS___STRCOLL_C_A = 0x69F + SYS_SCANF = 0x070 + SYS___A64L_A = 0x70C + SYS___ECVT_A = 0x70D + SYS___FCVT_A = 0x70E + SYS___GCVT_A = 0x70F + SYS___STRTOUL_A = 0x70A + SYS_____AE_CORRESTBL_QUERY_A = 0x70B + SYS_SPRINTF = 0x071 + SYS___ACCESS_A = 0x71F + SYS___CATOPEN_A = 0x71E + SYS___GETOPT_A = 0x71D + SYS___REALPATH_A = 0x71A + SYS___SETENV_A = 0x71B + SYS___SYSTEM_A = 0x71C + SYS_FGETC = 0x072 + SYS___GAI_STRERROR_A = 0x72F + SYS___RMDIR_A = 0x72A + SYS___STATVFS_A = 0x72B + SYS___SYMLINK_A = 0x72C + SYS___TRUNCATE_A = 0x72D + SYS___UNLINK_A = 0x72E + SYS_VFPRINTF = 0x073 + SYS___ISSPACE_A = 0x73A + SYS___ISUPPER_A = 0x73B + SYS___ISWALNUM_A = 0x73F + SYS___ISXDIGIT_A = 0x73C + SYS___TOLOWER_A = 0x73D + SYS___TOUPPER_A = 0x73E + SYS_VPRINTF = 0x074 + SYS___CONFSTR_A = 0x74B + SYS___FDOPEN_A = 0x74E + SYS___FLDATA_A = 0x74F + SYS___FTOK_A = 0x74C + SYS___ISWXDIGIT_A = 0x74A + SYS___MKTEMP_A = 0x74D + SYS_VSPRINTF = 0x075 + SYS___GETGRGID_A = 0x75A + SYS___GETGRNAM_A = 0x75B + SYS___GETGROUPSBYNAME_A = 0x75C + SYS___GETHOSTENT_A = 0x75D + SYS___GETHOSTNAME_A = 0x75E + SYS___GETLOGIN_A = 0x75F + SYS_GETC = 0x076 + SYS___CREATEWORKUNIT_A = 0x76A + SYS___CTERMID_A = 0x76B + SYS___FMTMSG_A = 0x76C + SYS___INITGROUPS_A = 0x76D + SYS___MSGRCV_A = 0x76F + SYS_____LOGIN_A = 0x76E + SYS_FGETS = 0x077 + SYS___STRCASECMP_A = 0x77B + SYS___STRNCASECMP_A = 0x77C + SYS___TTYNAME_A = 0x77D + SYS___UNAME_A = 0x77E + SYS___UTIMES_A = 0x77F + SYS_____SERVER_PWU_A = 0x77A + SYS_FPUTC = 0x078 + SYS___CREAT_O_A = 0x78E + SYS___ENVNA = 0x78F + SYS___FREAD_A = 0x78A + SYS___FWRITE_A = 0x78B + SYS___ISASCII = 0x78D + SYS___OPEN_O_A = 0x78C + SYS_FPUTS = 0x079 + SYS___ASCTIME_A = 0x79C + SYS___CTIME_A = 0x79D + SYS___GETDATE_A = 0x79E + SYS___GETSERVBYPORT_A = 0x79A + SYS___GETSERVENT_A = 0x79B + SYS___TZSET_A = 0x79F + SYS_ACL_FROM_TEXT = 0x80C + SYS_ACL_SET_FD = 0x80A + SYS_ACL_SET_FILE = 0x80B + SYS_ACL_SORT = 0x80E + SYS_ACL_TO_TEXT = 0x80D + SYS_UNGETC = 0x080 + SYS___SHUTDOWN_REGISTRATION = 0x80F + SYS_FREAD = 0x081 + SYS_FREEADDRINFO = 0x81A + SYS_GAI_STRERROR = 0x81B + SYS_REXEC_AF = 0x81C + SYS___DYNALLOC_A = 0x81F + SYS___POE = 0x81D + SYS_WCSTOMBS = 0x082 + SYS___INET_ADDR_A = 0x82F + SYS___NLIST_A = 0x82A + SYS_____TCGETCP_A = 0x82B + SYS_____TCSETCP_A = 0x82C + SYS_____W_PIOCTL_A = 0x82E + SYS_MBTOWC = 0x083 + SYS___CABEND = 0x83D + SYS___LE_CIB_GET = 0x83E + SYS___RECVMSG_A = 0x83B + SYS___SENDMSG_A = 0x83A + SYS___SET_LAA_FOR_JIT = 0x83F + SYS_____LCHATTR_A = 0x83C + SYS_WCTOMB = 0x084 + SYS___CBRTL_B = 0x84A + SYS___COPYSIGNF_B = 0x84B + SYS___COPYSIGNL_B = 0x84C + SYS___COTANF_B = 0x84D + SYS___COTANL_B = 0x84F + SYS___COTAN_B = 0x84E + SYS_MBSTOWCS = 0x085 + SYS___LOG1PL_B = 0x85A + SYS___LOG2F_B = 0x85B + SYS___LOG2L_B = 0x85D + SYS___LOG2_B = 0x85C + SYS___REMAINDERF_B = 0x85E + SYS___REMAINDERL_B = 0x85F + SYS_ACOSHF = 0x86E + SYS_ACOSHL = 0x86F + SYS_WCSCPY = 0x086 + SYS___ERFCF_B = 0x86D + SYS___ERFF_B = 0x86C + SYS___LROUNDF_B = 0x86A + SYS___LROUND_B = 0x86B + SYS_COTANL = 0x87A + SYS_EXP2F = 0x87B + SYS_EXP2L = 0x87C + SYS_EXPM1F = 0x87D + SYS_EXPM1L = 0x87E + SYS_FDIMF = 0x87F + SYS_WCSCAT = 0x087 + SYS___COTANL = 0x87A + SYS_REMAINDERF = 0x88A + SYS_REMAINDERL = 0x88B + SYS_REMAINDF = 0x88A + SYS_REMAINDL = 0x88B + SYS_REMQUO = 0x88D + SYS_REMQUOF = 0x88C + SYS_REMQUOL = 0x88E + SYS_TGAMMAF = 0x88F + SYS_WCSCHR = 0x088 + SYS_ERFCF = 0x89B + SYS_ERFCL = 0x89C + SYS_ERFL = 0x89A + SYS_EXP2 = 0x89E + SYS_WCSCMP = 0x089 + SYS___EXP2_B = 0x89D + SYS___FAR_JUMP = 0x89F + SYS_ABS = 0x090 + SYS___ERFCL_H = 0x90A + SYS___EXPF_H = 0x90C + SYS___EXPL_H = 0x90D + SYS___EXPM1_H = 0x90E + SYS___EXP_H = 0x90B + SYS___FDIM_H = 0x90F + SYS_DIV = 0x091 + SYS___LOG2F_H = 0x91F + SYS___LOG2_H = 0x91E + SYS___LOGB_H = 0x91D + SYS___LOGF_H = 0x91B + SYS___LOGL_H = 0x91C + SYS___LOG_H = 0x91A + SYS_LABS = 0x092 + SYS___POWL_H = 0x92A + SYS___REMAINDER_H = 0x92B + SYS___RINT_H = 0x92C + SYS___SCALB_H = 0x92D + SYS___SINF_H = 0x92F + SYS___SIN_H = 0x92E + SYS_STRNCPY = 0x093 + SYS___TANHF_H = 0x93B + SYS___TANHL_H = 0x93C + SYS___TANH_H = 0x93A + SYS___TGAMMAF_H = 0x93E + SYS___TGAMMA_H = 0x93D + SYS___TRUNC_H = 0x93F + SYS_MEMCPY = 0x094 + SYS_VFWSCANF = 0x94A + SYS_VSWSCANF = 0x94E + SYS_VWSCANF = 0x94C + SYS_INET6_RTH_ADD = 0x95D + SYS_INET6_RTH_INIT = 0x95C + SYS_INET6_RTH_REVERSE = 0x95E + SYS_INET6_RTH_SEGMENTS = 0x95F + SYS_INET6_RTH_SPACE = 0x95B + SYS_MEMMOVE = 0x095 + SYS_WCSTOLD = 0x95A + SYS_STRCPY = 0x096 + SYS_STRCMP = 0x097 + SYS_CABS = 0x98E + SYS_STRCAT = 0x098 + SYS___CABS_B = 0x98F + SYS___POW_II = 0x98A + SYS___POW_II_B = 0x98B + SYS___POW_II_H = 0x98C + SYS_CACOSF = 0x99A + SYS_CACOSL = 0x99D + SYS_STRNCAT = 0x099 + SYS___CACOSF_B = 0x99B + SYS___CACOSF_H = 0x99C + SYS___CACOSL_B = 0x99E + SYS___CACOSL_H = 0x99F + SYS_ISWALPHA = 0x100 + SYS_ISWBLANK = 0x101 + SYS___ISWBLK = 0x101 + SYS_ISWCNTRL = 0x102 + SYS_ISWDIGIT = 0x103 + SYS_ISWGRAPH = 0x104 + SYS_ISWLOWER = 0x105 + SYS_ISWPRINT = 0x106 + SYS_ISWPUNCT = 0x107 + SYS_ISWSPACE = 0x108 + SYS_ISWUPPER = 0x109 + SYS_WCTOB = 0x110 + SYS_MBRLEN = 0x111 + SYS_MBRTOWC = 0x112 + SYS_MBSRTOWC = 0x113 + SYS_MBSRTOWCS = 0x113 + SYS_WCRTOMB = 0x114 + SYS_WCSRTOMB = 0x115 + SYS_WCSRTOMBS = 0x115 + SYS___CSID = 0x116 + SYS___WCSID = 0x117 + SYS_STRPTIME = 0x118 + SYS___STRPTM = 0x118 + SYS_STRFMON = 0x119 + SYS_WCSCOLL = 0x130 + SYS_WCSXFRM = 0x131 + SYS_WCSWIDTH = 0x132 + SYS_WCWIDTH = 0x133 + SYS_WCSFTIME = 0x134 + SYS_SWPRINTF = 0x135 + SYS_VSWPRINT = 0x136 + SYS_VSWPRINTF = 0x136 + SYS_SWSCANF = 0x137 + SYS_REGCOMP = 0x138 + SYS_REGEXEC = 0x139 + SYS_GETWC = 0x140 + SYS_GETWCHAR = 0x141 + SYS_PUTWC = 0x142 + SYS_PUTWCHAR = 0x143 + SYS_UNGETWC = 0x144 + SYS_ICONV_OPEN = 0x145 + SYS_ICONV = 0x146 + SYS_ICONV_CLOSE = 0x147 + SYS_COLLRANGE = 0x150 + SYS_CCLASS = 0x151 + SYS_COLLORDER = 0x152 + SYS___DEMANGLE = 0x154 + SYS_FDOPEN = 0x155 + SYS___ERRNO = 0x156 + SYS___ERRNO2 = 0x157 + SYS___TERROR = 0x158 + SYS_MAXCOLL = 0x169 + SYS_DLLLOAD = 0x170 + SYS__EXIT = 0x174 + SYS_ACCESS = 0x175 + SYS_ALARM = 0x176 + SYS_CFGETISPEED = 0x177 + SYS_CFGETOSPEED = 0x178 + SYS_CFSETISPEED = 0x179 + SYS_CREAT = 0x180 + SYS_CTERMID = 0x181 + SYS_DUP = 0x182 + SYS_DUP2 = 0x183 + SYS_EXECL = 0x184 + SYS_EXECLE = 0x185 + SYS_EXECLP = 0x186 + SYS_EXECV = 0x187 + SYS_EXECVE = 0x188 + SYS_EXECVP = 0x189 + SYS_FSTAT = 0x190 + SYS_FSYNC = 0x191 + SYS_FTRUNCATE = 0x192 + SYS_GETCWD = 0x193 + SYS_GETEGID = 0x194 + SYS_GETEUID = 0x195 + SYS_GETGID = 0x196 + SYS_GETGRGID = 0x197 + SYS_GETGRNAM = 0x198 + SYS_GETGROUPS = 0x199 + SYS_PTHREAD_MUTEXATTR_DESTROY = 0x200 + SYS_PTHREAD_MUTEXATTR_SETKIND_NP = 0x201 + SYS_PTHREAD_MUTEXATTR_GETKIND_NP = 0x202 + SYS_PTHREAD_MUTEX_INIT = 0x203 + SYS_PTHREAD_MUTEX_DESTROY = 0x204 + SYS_PTHREAD_MUTEX_LOCK = 0x205 + SYS_PTHREAD_MUTEX_TRYLOCK = 0x206 + SYS_PTHREAD_MUTEX_UNLOCK = 0x207 + SYS_PTHREAD_ONCE = 0x209 + SYS_TW_OPEN = 0x210 + SYS_TW_FCNTL = 0x211 + SYS_PTHREAD_JOIN_D4_NP = 0x212 + SYS_PTHREAD_CONDATTR_SETKIND_NP = 0x213 + SYS_PTHREAD_CONDATTR_GETKIND_NP = 0x214 + SYS_EXTLINK_NP = 0x215 + SYS___PASSWD = 0x216 + SYS_SETGROUPS = 0x217 + SYS_INITGROUPS = 0x218 + SYS_WCSRCHR = 0x240 + SYS_SVC99 = 0x241 + SYS___SVC99 = 0x241 + SYS_WCSWCS = 0x242 + SYS_LOCALECO = 0x243 + SYS_LOCALECONV = 0x243 + SYS___LIBREL = 0x244 + SYS_RELEASE = 0x245 + SYS___RLSE = 0x245 + SYS_FLOCATE = 0x246 + SYS___FLOCT = 0x246 + SYS_FDELREC = 0x247 + SYS___FDLREC = 0x247 + SYS_FETCH = 0x248 + SYS___FETCH = 0x248 + SYS_QSORT = 0x249 + SYS___CLEANUPCATCH = 0x260 + SYS___CATCHMATCH = 0x261 + SYS___CLEAN2UPCATCH = 0x262 + SYS_GETPRIORITY = 0x270 + SYS_NICE = 0x271 + SYS_SETPRIORITY = 0x272 + SYS_GETITIMER = 0x273 + SYS_SETITIMER = 0x274 + SYS_MSGCTL = 0x275 + SYS_MSGGET = 0x276 + SYS_MSGRCV = 0x277 + SYS_MSGSND = 0x278 + SYS_MSGXRCV = 0x279 + SYS___MSGXR = 0x279 + SYS_SHMGET = 0x280 + SYS___GETIPC = 0x281 + SYS_SETGRENT = 0x282 + SYS_GETGRENT = 0x283 + SYS_ENDGRENT = 0x284 + SYS_SETPWENT = 0x285 + SYS_GETPWENT = 0x286 + SYS_ENDPWENT = 0x287 + SYS_BSD_SIGNAL = 0x288 + SYS_KILLPG = 0x289 + SYS_SIGSET = 0x290 + SYS_SIGSTACK = 0x291 + SYS_GETRLIMIT = 0x292 + SYS_SETRLIMIT = 0x293 + SYS_GETRUSAGE = 0x294 + SYS_MMAP = 0x295 + SYS_MPROTECT = 0x296 + SYS_MSYNC = 0x297 + SYS_MUNMAP = 0x298 + SYS_CONFSTR = 0x299 + SYS___NDMTRM = 0x300 + SYS_FTOK = 0x301 + SYS_BASENAME = 0x302 + SYS_DIRNAME = 0x303 + SYS_GETDTABLESIZE = 0x304 + SYS_MKSTEMP = 0x305 + SYS_MKTEMP = 0x306 + SYS_NFTW = 0x307 + SYS_GETWD = 0x308 + SYS_LOCKF = 0x309 + SYS_WORDEXP = 0x310 + SYS_WORDFREE = 0x311 + SYS_GETPGID = 0x312 + SYS_GETSID = 0x313 + SYS___UTMPXNAME = 0x314 + SYS_CUSERID = 0x315 + SYS_GETPASS = 0x316 + SYS_FNMATCH = 0x317 + SYS_FTW = 0x318 + SYS_GETW = 0x319 + SYS_ACOSH = 0x320 + SYS_ASINH = 0x321 + SYS_ATANH = 0x322 + SYS_CBRT = 0x323 + SYS_EXPM1 = 0x324 + SYS_ILOGB = 0x325 + SYS_LOGB = 0x326 + SYS_LOG1P = 0x327 + SYS_NEXTAFTER = 0x328 + SYS_RINT = 0x329 + SYS_SPAWN = 0x330 + SYS_SPAWNP = 0x331 + SYS_GETLOGIN_UU = 0x332 + SYS_ECVT = 0x333 + SYS_FCVT = 0x334 + SYS_GCVT = 0x335 + SYS_ACCEPT = 0x336 + SYS_BIND = 0x337 + SYS_CONNECT = 0x338 + SYS_ENDHOSTENT = 0x339 + SYS_GETHOSTENT = 0x340 + SYS_GETHOSTID = 0x341 + SYS_GETHOSTNAME = 0x342 + SYS_GETNETBYADDR = 0x343 + SYS_GETNETBYNAME = 0x344 + SYS_GETNETENT = 0x345 + SYS_GETPEERNAME = 0x346 + SYS_GETPROTOBYNAME = 0x347 + SYS_GETPROTOBYNUMBER = 0x348 + SYS_GETPROTOENT = 0x349 + SYS_INET_LNAOF = 0x350 + SYS_INET_MAKEADDR = 0x351 + SYS_INET_NETOF = 0x352 + SYS_INET_NETWORK = 0x353 + SYS_INET_NTOA = 0x354 + SYS_IOCTL = 0x355 + SYS_LISTEN = 0x356 + SYS_READV = 0x357 + SYS_RECV = 0x358 + SYS_RECVFROM = 0x359 + SYS_SETHOSTENT = 0x360 + SYS_SETNETENT = 0x361 + SYS_SETPEER = 0x362 + SYS_SETPROTOENT = 0x363 + SYS_SETSERVENT = 0x364 + SYS_SETSOCKOPT = 0x365 + SYS_SHUTDOWN = 0x366 + SYS_SOCKET = 0x367 + SYS_SOCKETPAIR = 0x368 + SYS_WRITEV = 0x369 + SYS_ENDNETENT = 0x370 + SYS_CLOSELOG = 0x371 + SYS_OPENLOG = 0x372 + SYS_SETLOGMASK = 0x373 + SYS_SYSLOG = 0x374 + SYS_PTSNAME = 0x375 + SYS_SETREUID = 0x376 + SYS_SETREGID = 0x377 + SYS_REALPATH = 0x378 + SYS___SIGNGAM = 0x379 + SYS_POLL = 0x380 + SYS_REXEC = 0x381 + SYS___ISASCII2 = 0x382 + SYS___TOASCII2 = 0x383 + SYS_CHPRIORITY = 0x384 + SYS_PTHREAD_ATTR_SETSYNCTYPE_NP = 0x385 + SYS_PTHREAD_ATTR_GETSYNCTYPE_NP = 0x386 + SYS_PTHREAD_SET_LIMIT_NP = 0x387 + SYS___STNETENT = 0x388 + SYS___STPROTOENT = 0x389 + SYS___SELECT1 = 0x390 + SYS_PTHREAD_SECURITY_NP = 0x391 + SYS___CHECK_RESOURCE_AUTH_NP = 0x392 + SYS___CONVERT_ID_NP = 0x393 + SYS___OPENVMREL = 0x394 + SYS_WMEMCHR = 0x395 + SYS_WMEMCMP = 0x396 + SYS_WMEMCPY = 0x397 + SYS_WMEMMOVE = 0x398 + SYS_WMEMSET = 0x399 + SYS___FPUTWC = 0x400 + SYS___PUTWC = 0x401 + SYS___PWCHAR = 0x402 + SYS___WCSFTM = 0x403 + SYS___WCSTOK = 0x404 + SYS___WCWDTH = 0x405 + SYS_T_ACCEPT = 0x409 + SYS_T_GETINFO = 0x410 + SYS_T_GETPROTADDR = 0x411 + SYS_T_GETSTATE = 0x412 + SYS_T_LISTEN = 0x413 + SYS_T_LOOK = 0x414 + SYS_T_OPEN = 0x415 + SYS_T_OPTMGMT = 0x416 + SYS_T_RCV = 0x417 + SYS_T_RCVCONNECT = 0x418 + SYS_T_RCVDIS = 0x419 + SYS_T_SNDUDATA = 0x420 + SYS_T_STRERROR = 0x421 + SYS_T_SYNC = 0x422 + SYS_T_UNBIND = 0x423 + SYS___T_ERRNO = 0x424 + SYS___RECVMSG2 = 0x425 + SYS___SENDMSG2 = 0x426 + SYS_FATTACH = 0x427 + SYS_FDETACH = 0x428 + SYS_GETMSG = 0x429 + SYS_GETCONTEXT = 0x430 + SYS_SETCONTEXT = 0x431 + SYS_MAKECONTEXT = 0x432 + SYS_SWAPCONTEXT = 0x433 + SYS_PTHREAD_GETSPECIFIC_D8_NP = 0x434 + SYS_GETCLIENTID = 0x470 + SYS___GETCLIENTID = 0x471 + SYS_GETSTABLESIZE = 0x472 + SYS_GETIBMOPT = 0x473 + SYS_GETIBMSOCKOPT = 0x474 + SYS_GIVESOCKET = 0x475 + SYS_IBMSFLUSH = 0x476 + SYS_MAXDESC = 0x477 + SYS_SETIBMOPT = 0x478 + SYS_SETIBMSOCKOPT = 0x479 + SYS___SERVER_PWU = 0x480 + SYS_PTHREAD_TAG_NP = 0x481 + SYS___CONSOLE = 0x482 + SYS___WSINIT = 0x483 + SYS___IPTCPN = 0x489 + SYS___SERVER_CLASSIFY = 0x490 + SYS___HEAPRPT = 0x496 + SYS___ISBFP = 0x500 + SYS___FP_CAST = 0x501 + SYS___CERTIFICATE = 0x502 + SYS_SEND_FILE = 0x503 + SYS_AIO_CANCEL = 0x504 + SYS_AIO_ERROR = 0x505 + SYS_AIO_READ = 0x506 + SYS_AIO_RETURN = 0x507 + SYS_AIO_SUSPEND = 0x508 + SYS_AIO_WRITE = 0x509 + SYS_PTHREAD_RWLOCK_TRYWRLOCK = 0x510 + SYS_PTHREAD_RWLOCK_UNLOCK = 0x511 + SYS_PTHREAD_RWLOCK_WRLOCK = 0x512 + SYS_PTHREAD_RWLOCKATTR_GETPSHARED = 0x513 + SYS_PTHREAD_RWLOCKATTR_SETPSHARED = 0x514 + SYS_PTHREAD_RWLOCKATTR_INIT = 0x515 + SYS_PTHREAD_RWLOCKATTR_DESTROY = 0x516 + SYS___CTTBL = 0x517 + SYS_PTHREAD_MUTEXATTR_SETTYPE = 0x518 + SYS_PTHREAD_MUTEXATTR_GETTYPE = 0x519 + SYS___FP_UNORDERED = 0x520 + SYS___FP_READ_RND = 0x521 + SYS___FP_READ_RND_B = 0x522 + SYS___FP_SWAP_RND = 0x523 + SYS___FP_SWAP_RND_B = 0x524 + SYS___FP_LEVEL = 0x525 + SYS___FP_BTOH = 0x526 + SYS___FP_HTOB = 0x527 + SYS___FPC_RD = 0x528 + SYS___FPC_WR = 0x529 + SYS_PTHREAD_SETCANCELTYPE = 0x600 + SYS_PTHREAD_TESTCANCEL = 0x601 + SYS___ATANF_B = 0x602 + SYS___ATANL_B = 0x603 + SYS___CEILF_B = 0x604 + SYS___CEILL_B = 0x605 + SYS___COSF_B = 0x606 + SYS___COSL_B = 0x607 + SYS___FABSF_B = 0x608 + SYS___FABSL_B = 0x609 + SYS___SINF_B = 0x610 + SYS___SINL_B = 0x611 + SYS___TANF_B = 0x612 + SYS___TANL_B = 0x613 + SYS___TANHF_B = 0x614 + SYS___TANHL_B = 0x615 + SYS___ACOSF_B = 0x616 + SYS___ACOSL_B = 0x617 + SYS___ASINF_B = 0x618 + SYS___ASINL_B = 0x619 + SYS___LOGF_B = 0x620 + SYS___LOGL_B = 0x621 + SYS___LOG10F_B = 0x622 + SYS___LOG10L_B = 0x623 + SYS___POWF_B = 0x624 + SYS___POWL_B = 0x625 + SYS___SINHF_B = 0x626 + SYS___SINHL_B = 0x627 + SYS___SQRTF_B = 0x628 + SYS___SQRTL_B = 0x629 + SYS___MODFL_B = 0x630 + SYS_ABSF = 0x631 + SYS_ABSL = 0x632 + SYS_ACOSF = 0x633 + SYS_ACOSL = 0x634 + SYS_ASINF = 0x635 + SYS_ASINL = 0x636 + SYS_ATAN2F = 0x637 + SYS_ATAN2L = 0x638 + SYS_ATANF = 0x639 + SYS_COSHL = 0x640 + SYS_EXPF = 0x641 + SYS_EXPL = 0x642 + SYS_TANHF = 0x643 + SYS_TANHL = 0x644 + SYS_LOG10F = 0x645 + SYS_LOG10L = 0x646 + SYS_LOGF = 0x647 + SYS_LOGL = 0x648 + SYS_POWF = 0x649 + SYS_SINHL = 0x650 + SYS_TANF = 0x651 + SYS_TANL = 0x652 + SYS_FABSF = 0x653 + SYS_FABSL = 0x654 + SYS_FLOORF = 0x655 + SYS_FLOORL = 0x656 + SYS_FMODF = 0x657 + SYS_FMODL = 0x658 + SYS_FREXPF = 0x659 + SYS___CHATTR = 0x660 + SYS___FCHATTR = 0x661 + SYS___TOCCSID = 0x662 + SYS___CSNAMETYPE = 0x663 + SYS___TOCSNAME = 0x664 + SYS___CCSIDTYPE = 0x665 + SYS___AE_CORRESTBL_QUERY = 0x666 + SYS___AE_AUTOCONVERT_STATE = 0x667 + SYS_DN_FIND = 0x668 + SYS___GETHOSTBYADDR_A = 0x669 + SYS___MBLEN_SB_A = 0x670 + SYS___MBLEN_STD_A = 0x671 + SYS___MBLEN_UTF = 0x672 + SYS___MBSTOWCS_A = 0x673 + SYS___MBSTOWCS_STD_A = 0x674 + SYS___MBTOWC_A = 0x675 + SYS___MBTOWC_ISO1 = 0x676 + SYS___MBTOWC_SBCS = 0x677 + SYS___MBTOWC_MBCS = 0x678 + SYS___MBTOWC_UTF = 0x679 + SYS___CSID_A = 0x680 + SYS___CSID_STD_A = 0x681 + SYS___WCSID_A = 0x682 + SYS___WCSID_STD_A = 0x683 + SYS___WCTOMB_A = 0x684 + SYS___WCTOMB_ISO1 = 0x685 + SYS___WCTOMB_STD_A = 0x686 + SYS___WCTOMB_UTF = 0x687 + SYS___WCWIDTH_A = 0x688 + SYS___GETGRNAM_R_A = 0x689 + SYS___READDIR_R_A = 0x690 + SYS___E2A_S = 0x691 + SYS___FNMATCH_A = 0x692 + SYS___FNMATCH_C_A = 0x693 + SYS___EXECL_A = 0x694 + SYS___FNMATCH_STD_A = 0x695 + SYS___REGCOMP_A = 0x696 + SYS___REGCOMP_STD_A = 0x697 + SYS___REGERROR_A = 0x698 + SYS___REGERROR_STD_A = 0x699 + SYS___SWPRINTF_A = 0x700 + SYS___FSCANF_A = 0x701 + SYS___SCANF_A = 0x702 + SYS___SSCANF_A = 0x703 + SYS___SWSCANF_A = 0x704 + SYS___ATOF_A = 0x705 + SYS___ATOI_A = 0x706 + SYS___ATOL_A = 0x707 + SYS___STRTOD_A = 0x708 + SYS___STRTOL_A = 0x709 + SYS___L64A_A = 0x710 + SYS___STRERROR_A = 0x711 + SYS___PERROR_A = 0x712 + SYS___FETCH_A = 0x713 + SYS___GETENV_A = 0x714 + SYS___MKSTEMP_A = 0x717 + SYS___PTSNAME_A = 0x718 + SYS___PUTENV_A = 0x719 + SYS___CHDIR_A = 0x720 + SYS___CHOWN_A = 0x721 + SYS___CHROOT_A = 0x722 + SYS___GETCWD_A = 0x723 + SYS___GETWD_A = 0x724 + SYS___LCHOWN_A = 0x725 + SYS___LINK_A = 0x726 + SYS___PATHCONF_A = 0x727 + SYS___IF_NAMEINDEX_A = 0x728 + SYS___READLINK_A = 0x729 + SYS___EXTLINK_NP_A = 0x730 + SYS___ISALNUM_A = 0x731 + SYS___ISALPHA_A = 0x732 + SYS___A2E_S = 0x733 + SYS___ISCNTRL_A = 0x734 + SYS___ISDIGIT_A = 0x735 + SYS___ISGRAPH_A = 0x736 + SYS___ISLOWER_A = 0x737 + SYS___ISPRINT_A = 0x738 + SYS___ISPUNCT_A = 0x739 + SYS___ISWALPHA_A = 0x740 + SYS___A2E_L = 0x741 + SYS___ISWCNTRL_A = 0x742 + SYS___ISWDIGIT_A = 0x743 + SYS___ISWGRAPH_A = 0x744 + SYS___ISWLOWER_A = 0x745 + SYS___ISWPRINT_A = 0x746 + SYS___ISWPUNCT_A = 0x747 + SYS___ISWSPACE_A = 0x748 + SYS___ISWUPPER_A = 0x749 + SYS___REMOVE_A = 0x750 + SYS___RENAME_A = 0x751 + SYS___TMPNAM_A = 0x752 + SYS___FOPEN_A = 0x753 + SYS___FREOPEN_A = 0x754 + SYS___CUSERID_A = 0x755 + SYS___POPEN_A = 0x756 + SYS___TEMPNAM_A = 0x757 + SYS___FTW_A = 0x758 + SYS___GETGRENT_A = 0x759 + SYS___INET_NTOP_A = 0x760 + SYS___GETPASS_A = 0x761 + SYS___GETPWENT_A = 0x762 + SYS___GETPWNAM_A = 0x763 + SYS___GETPWUID_A = 0x764 + SYS_____CHECK_RESOURCE_AUTH_NP_A = 0x765 + SYS___CHECKSCHENV_A = 0x766 + SYS___CONNECTSERVER_A = 0x767 + SYS___CONNECTWORKMGR_A = 0x768 + SYS_____CONSOLE_A = 0x769 + SYS___MSGSND_A = 0x770 + SYS___MSGXRCV_A = 0x771 + SYS___NFTW_A = 0x772 + SYS_____PASSWD_A = 0x773 + SYS___PTHREAD_SECURITY_NP_A = 0x774 + SYS___QUERYMETRICS_A = 0x775 + SYS___QUERYSCHENV = 0x776 + SYS___READV_A = 0x777 + SYS_____SERVER_CLASSIFY_A = 0x778 + SYS_____SERVER_INIT_A = 0x779 + SYS___W_GETPSENT_A = 0x780 + SYS___WRITEV_A = 0x781 + SYS___W_STATFS_A = 0x782 + SYS___W_STATVFS_A = 0x783 + SYS___FPUTC_A = 0x784 + SYS___PUTCHAR_A = 0x785 + SYS___PUTS_A = 0x786 + SYS___FGETS_A = 0x787 + SYS___GETS_A = 0x788 + SYS___FPUTS_A = 0x789 + SYS___PUTC_A = 0x790 + SYS___AE_THREAD_SETMODE = 0x791 + SYS___AE_THREAD_SWAPMODE = 0x792 + SYS___GETNETBYADDR_A = 0x793 + SYS___GETNETBYNAME_A = 0x794 + SYS___GETNETENT_A = 0x795 + SYS___GETPROTOBYNAME_A = 0x796 + SYS___GETPROTOBYNUMBER_A = 0x797 + SYS___GETPROTOENT_A = 0x798 + SYS___GETSERVBYNAME_A = 0x799 + SYS_ACL_FIRST_ENTRY = 0x800 + SYS_ACL_GET_ENTRY = 0x801 + SYS_ACL_VALID = 0x802 + SYS_ACL_CREATE_ENTRY = 0x803 + SYS_ACL_DELETE_ENTRY = 0x804 + SYS_ACL_UPDATE_ENTRY = 0x805 + SYS_ACL_DELETE_FD = 0x806 + SYS_ACL_DELETE_FILE = 0x807 + SYS_ACL_GET_FD = 0x808 + SYS_ACL_GET_FILE = 0x809 + SYS___ERFL_B = 0x810 + SYS___ERFCL_B = 0x811 + SYS___LGAMMAL_B = 0x812 + SYS___SETHOOKEVENTS = 0x813 + SYS_IF_NAMETOINDEX = 0x814 + SYS_IF_INDEXTONAME = 0x815 + SYS_IF_NAMEINDEX = 0x816 + SYS_IF_FREENAMEINDEX = 0x817 + SYS_GETADDRINFO = 0x818 + SYS_GETNAMEINFO = 0x819 + SYS___DYNFREE_A = 0x820 + SYS___RES_QUERY_A = 0x821 + SYS___RES_SEARCH_A = 0x822 + SYS___RES_QUERYDOMAIN_A = 0x823 + SYS___RES_MKQUERY_A = 0x824 + SYS___RES_SEND_A = 0x825 + SYS___DN_EXPAND_A = 0x826 + SYS___DN_SKIPNAME_A = 0x827 + SYS___DN_COMP_A = 0x828 + SYS___DN_FIND_A = 0x829 + SYS___INET_NTOA_A = 0x830 + SYS___INET_NETWORK_A = 0x831 + SYS___ACCEPT_A = 0x832 + SYS___ACCEPT_AND_RECV_A = 0x833 + SYS___BIND_A = 0x834 + SYS___CONNECT_A = 0x835 + SYS___GETPEERNAME_A = 0x836 + SYS___GETSOCKNAME_A = 0x837 + SYS___RECVFROM_A = 0x838 + SYS___SENDTO_A = 0x839 + SYS___LCHATTR = 0x840 + SYS___WRITEDOWN = 0x841 + SYS_PTHREAD_MUTEX_INIT2 = 0x842 + SYS___ACOSHF_B = 0x843 + SYS___ACOSHL_B = 0x844 + SYS___ASINHF_B = 0x845 + SYS___ASINHL_B = 0x846 + SYS___ATANHF_B = 0x847 + SYS___ATANHL_B = 0x848 + SYS___CBRTF_B = 0x849 + SYS___EXP2F_B = 0x850 + SYS___EXP2L_B = 0x851 + SYS___EXPM1F_B = 0x852 + SYS___EXPM1L_B = 0x853 + SYS___FDIMF_B = 0x854 + SYS___FDIM_B = 0x855 + SYS___FDIML_B = 0x856 + SYS___HYPOTF_B = 0x857 + SYS___HYPOTL_B = 0x858 + SYS___LOG1PF_B = 0x859 + SYS___REMQUOF_B = 0x860 + SYS___REMQUO_B = 0x861 + SYS___REMQUOL_B = 0x862 + SYS___TGAMMAF_B = 0x863 + SYS___TGAMMA_B = 0x864 + SYS___TGAMMAL_B = 0x865 + SYS___TRUNCF_B = 0x866 + SYS___TRUNC_B = 0x867 + SYS___TRUNCL_B = 0x868 + SYS___LGAMMAF_B = 0x869 + SYS_ASINHF = 0x870 + SYS_ASINHL = 0x871 + SYS_ATANHF = 0x872 + SYS_ATANHL = 0x873 + SYS_CBRTF = 0x874 + SYS_CBRTL = 0x875 + SYS_COPYSIGNF = 0x876 + SYS_CPYSIGNF = 0x876 + SYS_COPYSIGNL = 0x877 + SYS_CPYSIGNL = 0x877 + SYS_COTANF = 0x878 + SYS___COTANF = 0x878 + SYS_COTAN = 0x879 + SYS___COTAN = 0x879 + SYS_FDIM = 0x881 + SYS_FDIML = 0x882 + SYS_HYPOTF = 0x883 + SYS_HYPOTL = 0x884 + SYS_LOG1PF = 0x885 + SYS_LOG1PL = 0x886 + SYS_LOG2F = 0x887 + SYS_LOG2 = 0x888 + SYS_LOG2L = 0x889 + SYS_TGAMMA = 0x890 + SYS_TGAMMAL = 0x891 + SYS_TRUNCF = 0x892 + SYS_TRUNC = 0x893 + SYS_TRUNCL = 0x894 + SYS_LGAMMAF = 0x895 + SYS_LGAMMAL = 0x896 + SYS_LROUNDF = 0x897 + SYS_LROUND = 0x898 + SYS_ERFF = 0x899 + SYS___COSHF_H = 0x900 + SYS___COSHL_H = 0x901 + SYS___COTAN_H = 0x902 + SYS___COTANF_H = 0x903 + SYS___COTANL_H = 0x904 + SYS___ERF_H = 0x905 + SYS___ERFF_H = 0x906 + SYS___ERFL_H = 0x907 + SYS___ERFC_H = 0x908 + SYS___ERFCF_H = 0x909 + SYS___FDIMF_H = 0x910 + SYS___FDIML_H = 0x911 + SYS___FMOD_H = 0x912 + SYS___FMODF_H = 0x913 + SYS___FMODL_H = 0x914 + SYS___GAMMA_H = 0x915 + SYS___HYPOT_H = 0x916 + SYS___ILOGB_H = 0x917 + SYS___LGAMMA_H = 0x918 + SYS___LGAMMAF_H = 0x919 + SYS___LOG2L_H = 0x920 + SYS___LOG1P_H = 0x921 + SYS___LOG10_H = 0x922 + SYS___LOG10F_H = 0x923 + SYS___LOG10L_H = 0x924 + SYS___LROUND_H = 0x925 + SYS___LROUNDF_H = 0x926 + SYS___NEXTAFTER_H = 0x927 + SYS___POW_H = 0x928 + SYS___POWF_H = 0x929 + SYS___SINL_H = 0x930 + SYS___SINH_H = 0x931 + SYS___SINHF_H = 0x932 + SYS___SINHL_H = 0x933 + SYS___SQRT_H = 0x934 + SYS___SQRTF_H = 0x935 + SYS___SQRTL_H = 0x936 + SYS___TAN_H = 0x937 + SYS___TANF_H = 0x938 + SYS___TANL_H = 0x939 + SYS___TRUNCF_H = 0x940 + SYS___TRUNCL_H = 0x941 + SYS___COSH_H = 0x942 + SYS___LE_DEBUG_SET_RESUME_MCH = 0x943 + SYS_VFSCANF = 0x944 + SYS_VSCANF = 0x946 + SYS_VSSCANF = 0x948 + SYS_IMAXABS = 0x950 + SYS_IMAXDIV = 0x951 + SYS_STRTOIMAX = 0x952 + SYS_STRTOUMAX = 0x953 + SYS_WCSTOIMAX = 0x954 + SYS_WCSTOUMAX = 0x955 + SYS_ATOLL = 0x956 + SYS_STRTOF = 0x957 + SYS_STRTOLD = 0x958 + SYS_WCSTOF = 0x959 + SYS_INET6_RTH_GETADDR = 0x960 + SYS_INET6_OPT_INIT = 0x961 + SYS_INET6_OPT_APPEND = 0x962 + SYS_INET6_OPT_FINISH = 0x963 + SYS_INET6_OPT_SET_VAL = 0x964 + SYS_INET6_OPT_NEXT = 0x965 + SYS_INET6_OPT_FIND = 0x966 + SYS_INET6_OPT_GET_VAL = 0x967 + SYS___POW_I = 0x987 + SYS___POW_I_B = 0x988 + SYS___POW_I_H = 0x989 + SYS___CABS_H = 0x990 + SYS_CABSF = 0x991 + SYS___CABSF_B = 0x992 + SYS___CABSF_H = 0x993 + SYS_CABSL = 0x994 + SYS___CABSL_B = 0x995 + SYS___CABSL_H = 0x996 + SYS_CACOS = 0x997 + SYS___CACOS_B = 0x998 + SYS___CACOS_H = 0x999 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index 295859c5..7a8161c1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -1,6 +1,7 @@ // cgo -godefs types_aix.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc && aix // +build ppc,aix package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index a9ee0ffd..07ed733c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -1,6 +1,7 @@ // cgo -godefs types_aix.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && aix // +build ppc64,aix package unix diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go deleted file mode 100644 index 725b4bee..00000000 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ /dev/null @@ -1,516 +0,0 @@ -// cgo -godefs types_darwin.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build 386,darwin - -package unix - -const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int32 - _C_long_long int64 -) - -type Timespec struct { - Sec int32 - Nsec int32 -} - -type Timeval struct { - Sec int32 - Usec int32 -} - -type Timeval32 struct{} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int32 - Ixrss int32 - Idrss int32 - Isrss int32 - Minflt int32 - Majflt int32 - Nswap int32 - Inblock int32 - Oublock int32 - Msgsnd int32 - Msgrcv int32 - Nsignals int32 - Nvcsw int32 - Nivcsw int32 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 -} - -type Statfs_t struct { - Bsize uint32 - Iosize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Owner uint32 - Type uint32 - Flags uint32 - Fssubtype uint32 - Fstypename [16]byte - Mntonname [1024]byte - Mntfromname [1024]byte - Reserved [8]uint32 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Fstore_t struct { - Flags uint32 - Posmode int32 - Offset int64 - Length int64 - Bytesalloc int64 -} - -type Radvisory_t struct { - Offset int64 - Count int32 -} - -type Fbootstraptransfer_t struct { - Offset int64 - Length uint32 - Buffer *byte -} - -type Log2phys_t struct { - Flags uint32 - Contigbytes int64 - Devoffset int64 -} - -type Fsid struct { - Val [2]int32 -} - -type Dirent struct { - Ino uint64 - Seekoff uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [1024]int8 - _ [3]byte -} - -const ( - PathMax = 0x400 -) - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type RawSockaddrCtl struct { - Sc_len uint8 - Sc_family uint8 - Ss_sysaddr uint16 - Sc_id uint32 - Sc_unit uint32 - Sc_reserved [5]uint32 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint32 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Iov *Iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet4Pktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofSockaddrCtl = 0x20 - SizeofLinger = 0x8 - SizeofIovec = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint32 - Filter int16 - Flags uint16 - Fflags uint32 - Data int32 - Udata *byte -} - -type FdSet struct { - Bits [32]int32 -} - -const ( - SizeofIfMsghdr = 0x70 - SizeofIfData = 0x60 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfmaMsghdr2 = 0x14 - SizeofRtMsghdr = 0x5c - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Data IfData -} - -type IfData struct { - Type uint8 - Typelen uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Recvquota uint8 - Xmitquota uint8 - Unused1 uint8 - Mtu uint32 - Metric uint32 - Baudrate uint32 - Ipackets uint32 - Ierrors uint32 - Opackets uint32 - Oerrors uint32 - Collisions uint32 - Ibytes uint32 - Obytes uint32 - Imcasts uint32 - Omcasts uint32 - Iqdrops uint32 - Noproto uint32 - Recvtiming uint32 - Xmittiming uint32 - Lastchange Timeval - Unused2 uint32 - Hwassist uint32 - Reserved1 uint32 - Reserved2 uint32 -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte -} - -type IfmaMsghdr2 struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Refcount int32 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint32 - Mtu uint32 - Hopcount uint32 - Expire int32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pksent uint32 - State uint32 - Filler [3]uint32 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x8 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -const ( - AT_FDCWD = -0x2 - AT_REMOVEDIR = 0x80 - AT_SYMLINK_FOLLOW = 0x40 - AT_SYMLINK_NOFOLLOW = 0x20 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} - -type CtlInfo struct { - Id uint32 - Name [96]byte -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 080ffce3..71db8538 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_darwin.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && darwin // +build amd64,darwin package unix @@ -210,6 +211,13 @@ type RawSockaddrCtl struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + type Linger struct { Onoff int32 Linger int32 @@ -225,6 +233,12 @@ type IPMreq struct { Interface [4]byte /* in_addr */ } +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 @@ -273,9 +287,11 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofSockaddrCtl = 0x20 + SizeofXucred = 0x4c SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 SizeofCmsghdr = 0xc @@ -519,3 +535,143 @@ type CtlInfo struct { Id uint32 Name [96]byte } + +const SizeofKinfoProc = 0x288 + +type Eproc struct { + Paddr uintptr + Sess uintptr + Pcred Pcred + Ucred Ucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess uintptr + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + _ [4]byte +} + +type ExternProc struct { + P_starttime Timeval + P_vmspace *Vmspace + P_sigacts uintptr + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + User_stack *int8 + Exit_thread *byte + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + P_wchan *byte + P_wmesg *int8 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + P_tracep uintptr + P_siglist int32 + P_textvp uintptr + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + P_pgrp uintptr + P_addr uintptr + P_xstat uint16 + P_acflag uint16 + P_ru *Rusage +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Pcred struct { + Pc_lock [72]int8 + Pc_ucred uintptr + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + _ [4]byte +} + +type Ucred struct { + Ref int32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go deleted file mode 100644 index f2a77bc4..00000000 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ /dev/null @@ -1,516 +0,0 @@ -// cgo -godefs types_darwin.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm,darwin - -package unix - -const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int32 - _C_long_long int64 -) - -type Timespec struct { - Sec int32 - Nsec int32 -} - -type Timeval struct { - Sec int32 - Usec int32 -} - -type Timeval32 struct{} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int32 - Ixrss int32 - Idrss int32 - Isrss int32 - Minflt int32 - Majflt int32 - Nswap int32 - Inblock int32 - Oublock int32 - Msgsnd int32 - Msgrcv int32 - Nsignals int32 - Nvcsw int32 - Nivcsw int32 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 -} - -type Statfs_t struct { - Bsize uint32 - Iosize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Owner uint32 - Type uint32 - Flags uint32 - Fssubtype uint32 - Fstypename [16]byte - Mntonname [1024]byte - Mntfromname [1024]byte - Reserved [8]uint32 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Fstore_t struct { - Flags uint32 - Posmode int32 - Offset int64 - Length int64 - Bytesalloc int64 -} - -type Radvisory_t struct { - Offset int64 - Count int32 -} - -type Fbootstraptransfer_t struct { - Offset int64 - Length uint32 - Buffer *byte -} - -type Log2phys_t struct { - Flags uint32 - Contigbytes int64 - Devoffset int64 -} - -type Fsid struct { - Val [2]int32 -} - -type Dirent struct { - Ino uint64 - Seekoff uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [1024]int8 - _ [3]byte -} - -const ( - PathMax = 0x400 -) - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type RawSockaddrCtl struct { - Sc_len uint8 - Sc_family uint8 - Ss_sysaddr uint16 - Sc_id uint32 - Sc_unit uint32 - Sc_reserved [5]uint32 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint32 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Iov *Iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet4Pktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofSockaddrCtl = 0x20 - SizeofLinger = 0x8 - SizeofIovec = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint32 - Filter int16 - Flags uint16 - Fflags uint32 - Data int32 - Udata *byte -} - -type FdSet struct { - Bits [32]int32 -} - -const ( - SizeofIfMsghdr = 0x70 - SizeofIfData = 0x60 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfmaMsghdr2 = 0x14 - SizeofRtMsghdr = 0x5c - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Data IfData -} - -type IfData struct { - Type uint8 - Typelen uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Recvquota uint8 - Xmitquota uint8 - Unused1 uint8 - Mtu uint32 - Metric uint32 - Baudrate uint32 - Ipackets uint32 - Ierrors uint32 - Opackets uint32 - Oerrors uint32 - Collisions uint32 - Ibytes uint32 - Obytes uint32 - Imcasts uint32 - Omcasts uint32 - Iqdrops uint32 - Noproto uint32 - Recvtiming uint32 - Xmittiming uint32 - Lastchange Timeval - Unused2 uint32 - Hwassist uint32 - Reserved1 uint32 - Reserved2 uint32 -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte -} - -type IfmaMsghdr2 struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - Refcount int32 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint32 - Mtu uint32 - Hopcount uint32 - Expire int32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pksent uint32 - State uint32 - Filler [3]uint32 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x8 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -const ( - AT_FDCWD = -0x2 - AT_REMOVEDIR = 0x80 - AT_SYMLINK_FOLLOW = 0x40 - AT_SYMLINK_NOFOLLOW = 0x20 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} - -type CtlInfo struct { - Id uint32 - Name [96]byte -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index c9492428..c17f45c5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs types_darwin.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && darwin // +build arm64,darwin package unix @@ -210,6 +211,13 @@ type RawSockaddrCtl struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + type Linger struct { Onoff int32 Linger int32 @@ -225,6 +233,12 @@ type IPMreq struct { Interface [4]byte /* in_addr */ } +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 @@ -273,9 +287,11 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofSockaddrCtl = 0x20 + SizeofXucred = 0x4c SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 SizeofCmsghdr = 0xc @@ -519,3 +535,143 @@ type CtlInfo struct { Id uint32 Name [96]byte } + +const SizeofKinfoProc = 0x288 + +type Eproc struct { + Paddr uintptr + Sess uintptr + Pcred Pcred + Ucred Ucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess uintptr + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + _ [4]byte +} + +type ExternProc struct { + P_starttime Timeval + P_vmspace *Vmspace + P_sigacts uintptr + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + User_stack *int8 + Exit_thread *byte + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + P_wchan *byte + P_wmesg *int8 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + P_tracep uintptr + P_siglist int32 + P_textvp uintptr + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + P_pgrp uintptr + P_addr uintptr + P_xstat uint16 + P_acflag uint16 + P_ru *Rusage +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Pcred struct { + Pc_lock [72]int8 + Pc_ucred uintptr + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + _ [4]byte +} + +type Ucred struct { + Ref int32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index 85506a05..d0ba8e9b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_dragonfly.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && dragonfly // +build amd64,dragonfly package unix @@ -430,6 +431,9 @@ type Winsize struct { const ( AT_FDCWD = 0xfffafdcd AT_SYMLINK_NOFOLLOW = 0x1 + AT_REMOVEDIR = 0x2 + AT_EACCESS = 0x4 + AT_SYMLINK_FOLLOW = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 3e9dad33..4eec078e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -1,6 +1,7 @@ // cgo -godefs types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && freebsd // +build 386,freebsd package unix @@ -30,6 +31,8 @@ type Timeval struct { Usec int32 } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval @@ -250,6 +253,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -312,6 +323,7 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x50 SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 @@ -662,9 +674,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index e00e6155..7622904a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && freebsd // +build amd64,freebsd package unix @@ -30,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval @@ -246,6 +249,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -308,6 +319,7 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x58 SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -665,9 +677,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index 5da13c87..19223ce8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && freebsd // +build arm,freebsd package unix @@ -32,6 +33,8 @@ type Timeval struct { _ [4]byte } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval @@ -248,6 +251,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -310,6 +321,7 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x50 SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 @@ -646,9 +658,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 995ecf9d..8e3e33f6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && freebsd // +build arm64,freebsd package unix @@ -30,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval @@ -246,6 +249,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -308,6 +319,7 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x58 SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 @@ -643,9 +655,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go new file mode 100644 index 00000000..4c485261 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go @@ -0,0 +1,42 @@ +// cgo -godefs types_illumos.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build amd64 && illumos +// +build amd64,illumos + +package unix + +const ( + TUNNEWPPA = 0x540001 + TUNSETPPA = 0x540002 + + I_STR = 0x5308 + I_POP = 0x5303 + I_PUSH = 0x5302 + I_LINK = 0x530c + I_UNLINK = 0x530d + I_PLINK = 0x5316 + I_PUNLINK = 0x5317 + + IF_UNITSEL = -0x7ffb8cca +) + +type strbuf struct { + Maxlen int32 + Len int32 + Buf *int8 +} + +type Strioctl struct { + Cmd int32 + Timout int32 + Len int32 + Dp *int8 +} + +type Lifreq struct { + Name [32]int8 + Lifru1 [4]byte + Type uint32 + Lifru [336]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 9f3b1a4e..249ecfcd 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,5 +1,6 @@ // Code generated by mkmerge.go; DO NOT EDIT. +//go:build linux // +build linux package unix @@ -83,7 +84,7 @@ type FileCloneRange struct { Dest_offset uint64 } -type FileDedupeRange struct { +type RawFileDedupeRange struct { Src_offset uint64 Src_length uint64 Dest_count uint16 @@ -91,6 +92,21 @@ type FileDedupeRange struct { Reserved2 uint32 } +type RawFileDedupeRangeInfo struct { + Dest_fd int64 + Dest_offset uint64 + Bytes_deduped uint64 + Status int32 + Reserved uint32 +} + +const ( + SizeofRawFileDedupeRange = 0x18 + SizeofRawFileDedupeRangeInfo = 0x20 + FILE_DEDUPE_RANGE_SAME = 0x0 + FILE_DEDUPE_RANGE_DIFFERS = 0x1 +) + type FscryptPolicy struct { Version uint8 Contents_encryption_mode uint8 @@ -288,7 +304,8 @@ type RawSockaddrVM struct { Reserved1 uint16 Port uint32 Cid uint32 - Zero [4]uint8 + Flags uint8 + Zero [3]uint8 } type RawSockaddrXDP struct { @@ -334,6 +351,13 @@ type RawSockaddrIUCV struct { Name [8]int8 } +type RawSockaddrNFC struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 +} + type _Socklen uint32 type Linger struct { @@ -428,6 +452,11 @@ type CanFilter struct { Mask uint32 } +type TCPRepairOpt struct { + Code uint32 + Val uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -447,6 +476,7 @@ const ( SizeofSockaddrL2TPIP = 0x10 SizeofSockaddrL2TPIP6 = 0x20 SizeofSockaddrIUCV = 0x20 + SizeofSockaddrNFC = 0x10 SizeofLinger = 0x8 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc @@ -459,6 +489,7 @@ const ( SizeofUcred = 0xc SizeofTCPInfo = 0x68 SizeofCanFilter = 0x8 + SizeofTCPRepairOpt = 0x8 ) const ( @@ -656,6 +687,16 @@ type NdMsg struct { Type uint8 } +const ( + ICMP_FILTER = 0x1 + + ICMPV6_FILTER = 0x1 + ICMPV6_FILTER_BLOCK = 0x1 + ICMPV6_FILTER_BLOCKOTHERS = 0x3 + ICMPV6_FILTER_PASS = 0x2 + ICMPV6_FILTER_PASSONLY = 0x4 +) + const ( SizeofSockFilter = 0x8 ) @@ -976,7 +1017,7 @@ const ( PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 PERF_COUNT_SW_BPF_OUTPUT = 0xa - PERF_COUNT_SW_MAX = 0xb + PERF_COUNT_SW_MAX = 0xc PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 PERF_SAMPLE_TIME = 0x4 @@ -999,7 +1040,10 @@ const ( PERF_SAMPLE_PHYS_ADDR = 0x80000 PERF_SAMPLE_AUX = 0x100000 PERF_SAMPLE_CGROUP = 0x200000 - PERF_SAMPLE_MAX = 0x400000 + PERF_SAMPLE_DATA_PAGE_SIZE = 0x400000 + PERF_SAMPLE_CODE_PAGE_SIZE = 0x800000 + PERF_SAMPLE_WEIGHT_STRUCT = 0x1000000 + PERF_SAMPLE_MAX = 0x2000000 PERF_SAMPLE_BRANCH_USER_SHIFT = 0x0 PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 0x1 PERF_SAMPLE_BRANCH_HV_SHIFT = 0x2 @@ -1745,6 +1789,8 @@ const ( NFPROTO_NUMPROTO = 0xd ) +const SO_ORIGINAL_DST = 0x50 + type Nfgenmsg struct { Nfgen_family uint8 Version uint8 @@ -2310,8 +2356,8 @@ const ( SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff + SOF_TIMESTAMPING_LAST = 0x8000 + SOF_TIMESTAMPING_MASK = 0xffff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 @@ -2887,7 +2933,7 @@ const ( DEVLINK_CMD_TRAP_POLICER_NEW = 0x47 DEVLINK_CMD_TRAP_POLICER_DEL = 0x48 DEVLINK_CMD_HEALTH_REPORTER_TEST = 0x49 - DEVLINK_CMD_MAX = 0x49 + DEVLINK_CMD_MAX = 0x4d DEVLINK_PORT_TYPE_NOTSET = 0x0 DEVLINK_PORT_TYPE_AUTO = 0x1 DEVLINK_PORT_TYPE_ETH = 0x2 @@ -3109,7 +3155,8 @@ const ( DEVLINK_ATTR_REMOTE_RELOAD_STATS = 0xa1 DEVLINK_ATTR_RELOAD_ACTION_INFO = 0xa2 DEVLINK_ATTR_RELOAD_ACTION_STATS = 0xa3 - DEVLINK_ATTR_MAX = 0xa3 + DEVLINK_ATTR_PORT_PCI_SF_NUMBER = 0xa4 + DEVLINK_ATTR_MAX = 0xa9 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 @@ -3123,7 +3170,9 @@ const ( DEVLINK_RESOURCE_UNIT_ENTRY = 0x0 DEVLINK_PORT_FUNCTION_ATTR_UNSPEC = 0x0 DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR = 0x1 - DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x1 + DEVLINK_PORT_FN_ATTR_STATE = 0x2 + DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x3 ) type FsverityDigest struct { @@ -3403,7 +3452,7 @@ const ( ETHTOOL_MSG_CABLE_TEST_ACT = 0x1a ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 0x1b ETHTOOL_MSG_TUNNEL_INFO_GET = 0x1c - ETHTOOL_MSG_USER_MAX = 0x1c + ETHTOOL_MSG_USER_MAX = 0x21 ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3434,7 +3483,7 @@ const ( ETHTOOL_MSG_CABLE_TEST_NTF = 0x1b ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 0x1c ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 0x1d - ETHTOOL_MSG_KERNEL_MAX = 0x1d + ETHTOOL_MSG_KERNEL_MAX = 0x22 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3492,7 +3541,8 @@ const ( ETHTOOL_A_LINKMODES_DUPLEX = 0x6 ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG = 0x7 ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE = 0x8 - ETHTOOL_A_LINKMODES_MAX = 0x8 + ETHTOOL_A_LINKMODES_LANES = 0x9 + ETHTOOL_A_LINKMODES_MAX = 0x9 ETHTOOL_A_LINKSTATE_UNSPEC = 0x0 ETHTOOL_A_LINKSTATE_HEADER = 0x1 ETHTOOL_A_LINKSTATE_LINK = 0x2 @@ -3680,3 +3730,229 @@ const ( ETHTOOL_A_TUNNEL_INFO_UDP_PORTS = 0x2 ETHTOOL_A_TUNNEL_INFO_MAX = 0x2 ) + +type EthtoolDrvinfo struct { + Cmd uint32 + Driver [32]byte + Version [32]byte + Fw_version [32]byte + Bus_info [32]byte + Erom_version [32]byte + Reserved2 [12]byte + N_priv_flags uint32 + N_stats uint32 + Testinfo_len uint32 + Eedump_len uint32 + Regdump_len uint32 +} + +type ( + HIDRawReportDescriptor struct { + Size uint32 + Value [4096]uint8 + } + HIDRawDevInfo struct { + Bustype uint32 + Vendor int16 + Product int16 + } +) + +const ( + CLOSE_RANGE_UNSHARE = 0x2 + CLOSE_RANGE_CLOEXEC = 0x4 +) + +const ( + NLMSGERR_ATTR_MSG = 0x1 + NLMSGERR_ATTR_OFFS = 0x2 + NLMSGERR_ATTR_COOKIE = 0x3 +) + +type ( + EraseInfo struct { + Start uint32 + Length uint32 + } + EraseInfo64 struct { + Start uint64 + Length uint64 + } + MtdOobBuf struct { + Start uint32 + Length uint32 + Ptr *uint8 + } + MtdOobBuf64 struct { + Start uint64 + Pad uint32 + Length uint32 + Ptr uint64 + } + MtdWriteReq struct { + Start uint64 + Len uint64 + Ooblen uint64 + Data uint64 + Oob uint64 + Mode uint8 + _ [7]uint8 + } + MtdInfo struct { + Type uint8 + Flags uint32 + Size uint32 + Erasesize uint32 + Writesize uint32 + Oobsize uint32 + _ uint64 + } + RegionInfo struct { + Offset uint32 + Erasesize uint32 + Numblocks uint32 + Regionindex uint32 + } + OtpInfo struct { + Start uint32 + Length uint32 + Locked uint32 + } + NandOobinfo struct { + Useecc uint32 + Eccbytes uint32 + Oobfree [8][2]uint32 + Eccpos [32]uint32 + } + NandOobfree struct { + Offset uint32 + Length uint32 + } + NandEcclayout struct { + Eccbytes uint32 + Eccpos [64]uint32 + Oobavail uint32 + Oobfree [8]NandOobfree + } + MtdEccStats struct { + Corrected uint32 + Failed uint32 + Badblocks uint32 + Bbtblocks uint32 + } +) + +const ( + MTD_OPS_PLACE_OOB = 0x0 + MTD_OPS_AUTO_OOB = 0x1 + MTD_OPS_RAW = 0x2 +) + +const ( + MTD_FILE_MODE_NORMAL = 0x0 + MTD_FILE_MODE_OTP_FACTORY = 0x1 + MTD_FILE_MODE_OTP_USER = 0x2 + MTD_FILE_MODE_RAW = 0x3 +) + +const ( + NFC_CMD_UNSPEC = 0x0 + NFC_CMD_GET_DEVICE = 0x1 + NFC_CMD_DEV_UP = 0x2 + NFC_CMD_DEV_DOWN = 0x3 + NFC_CMD_DEP_LINK_UP = 0x4 + NFC_CMD_DEP_LINK_DOWN = 0x5 + NFC_CMD_START_POLL = 0x6 + NFC_CMD_STOP_POLL = 0x7 + NFC_CMD_GET_TARGET = 0x8 + NFC_EVENT_TARGETS_FOUND = 0x9 + NFC_EVENT_DEVICE_ADDED = 0xa + NFC_EVENT_DEVICE_REMOVED = 0xb + NFC_EVENT_TARGET_LOST = 0xc + NFC_EVENT_TM_ACTIVATED = 0xd + NFC_EVENT_TM_DEACTIVATED = 0xe + NFC_CMD_LLC_GET_PARAMS = 0xf + NFC_CMD_LLC_SET_PARAMS = 0x10 + NFC_CMD_ENABLE_SE = 0x11 + NFC_CMD_DISABLE_SE = 0x12 + NFC_CMD_LLC_SDREQ = 0x13 + NFC_EVENT_LLC_SDRES = 0x14 + NFC_CMD_FW_DOWNLOAD = 0x15 + NFC_EVENT_SE_ADDED = 0x16 + NFC_EVENT_SE_REMOVED = 0x17 + NFC_EVENT_SE_CONNECTIVITY = 0x18 + NFC_EVENT_SE_TRANSACTION = 0x19 + NFC_CMD_GET_SE = 0x1a + NFC_CMD_SE_IO = 0x1b + NFC_CMD_ACTIVATE_TARGET = 0x1c + NFC_CMD_VENDOR = 0x1d + NFC_CMD_DEACTIVATE_TARGET = 0x1e + NFC_ATTR_UNSPEC = 0x0 + NFC_ATTR_DEVICE_INDEX = 0x1 + NFC_ATTR_DEVICE_NAME = 0x2 + NFC_ATTR_PROTOCOLS = 0x3 + NFC_ATTR_TARGET_INDEX = 0x4 + NFC_ATTR_TARGET_SENS_RES = 0x5 + NFC_ATTR_TARGET_SEL_RES = 0x6 + NFC_ATTR_TARGET_NFCID1 = 0x7 + NFC_ATTR_TARGET_SENSB_RES = 0x8 + NFC_ATTR_TARGET_SENSF_RES = 0x9 + NFC_ATTR_COMM_MODE = 0xa + NFC_ATTR_RF_MODE = 0xb + NFC_ATTR_DEVICE_POWERED = 0xc + NFC_ATTR_IM_PROTOCOLS = 0xd + NFC_ATTR_TM_PROTOCOLS = 0xe + NFC_ATTR_LLC_PARAM_LTO = 0xf + NFC_ATTR_LLC_PARAM_RW = 0x10 + NFC_ATTR_LLC_PARAM_MIUX = 0x11 + NFC_ATTR_SE = 0x12 + NFC_ATTR_LLC_SDP = 0x13 + NFC_ATTR_FIRMWARE_NAME = 0x14 + NFC_ATTR_SE_INDEX = 0x15 + NFC_ATTR_SE_TYPE = 0x16 + NFC_ATTR_SE_AID = 0x17 + NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS = 0x18 + NFC_ATTR_SE_APDU = 0x19 + NFC_ATTR_TARGET_ISO15693_DSFID = 0x1a + NFC_ATTR_TARGET_ISO15693_UID = 0x1b + NFC_ATTR_SE_PARAMS = 0x1c + NFC_ATTR_VENDOR_ID = 0x1d + NFC_ATTR_VENDOR_SUBCMD = 0x1e + NFC_ATTR_VENDOR_DATA = 0x1f + NFC_SDP_ATTR_UNSPEC = 0x0 + NFC_SDP_ATTR_URI = 0x1 + NFC_SDP_ATTR_SAP = 0x2 +) + +type LandlockRulesetAttr struct { + Access_fs uint64 +} + +type LandlockPathBeneathAttr struct { + Allowed_access uint64 + Parent_fd int32 +} + +const ( + LANDLOCK_RULE_PATH_BENEATH = 0x1 +) + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 + + ipc_64 = 0x100 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 088bd77e..eeeb9aa3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && linux // +build 386,linux package unix @@ -127,6 +128,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -158,10 +170,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -617,3 +635,36 @@ const ( PPS_GETCAP = 0x800470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 078d958e..d30e1155 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && linux // +build amd64,linux package unix @@ -129,6 +130,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -161,10 +173,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -635,3 +653,33 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 2d39122f..69d02975 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && linux // +build arm,linux package unix @@ -133,6 +134,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -164,10 +176,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -612,3 +630,36 @@ const ( PPS_GETCAP = 0x800470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 304cbd04..28a0455b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && linux // +build arm64,linux package unix @@ -130,6 +131,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -162,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -614,3 +632,33 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 7d9d5700..64a84548 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips && linux // +build mips,linux package unix @@ -132,6 +133,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -163,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -618,3 +636,35 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index a1eb2577..a1b7dee4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && linux // +build mips64,linux package unix @@ -130,6 +131,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -162,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -617,3 +635,33 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 2e5ce3b6..936fa6a2 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64le && linux // +build mips64le,linux package unix @@ -130,6 +131,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -162,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -617,3 +635,33 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index bbaa1200..5dd546fb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mipsle && linux // +build mipsle,linux package unix @@ -132,6 +133,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -163,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -618,3 +636,35 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go new file mode 100644 index 00000000..947b32e4 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -0,0 +1,678 @@ +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc && linux +// +build ppc,linux + +package unix + +const ( + SizeofPtr = 0x4 + SizeofLong = 0x4 +) + +type ( + _C_long int32 +) + +type Timespec struct { + Sec int32 + Nsec int32 +} + +type Timeval struct { + Sec int32 + Usec int32 +} + +type Timex struct { + Modes uint32 + Offset int32 + Freq int32 + Maxerror int32 + Esterror int32 + Status int32 + Constant int32 + Precision int32 + Tolerance int32 + Time Timeval + Tick int32 + Ppsfreq int32 + Jitter int32 + Shift int32 + Stabil int32 + Jitcnt int32 + Calcnt int32 + Errcnt int32 + Stbcnt int32 + Tai int32 + _ [44]byte +} + +type Time_t int32 + +type Tms struct { + Utime int32 + Stime int32 + Cutime int32 + Cstime int32 +} + +type Utimbuf struct { + Actime int32 + Modtime int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Stat_t struct { + Dev uint64 + Ino uint64 + Mode uint32 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev uint64 + _ uint16 + _ [4]byte + Size int64 + Blksize int32 + _ [4]byte + Blocks int64 + Atim Timespec + Mtim Timespec + Ctim Timespec + _ uint32 + _ uint32 +} + +type Dirent struct { + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]uint8 + _ [5]byte +} + +type Flock_t struct { + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte +} + +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + +const ( + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + +type RawSockaddr struct { + Family uint16 + Data [14]uint8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [96]uint8 +} + +type Iovec struct { + Base *byte + Len uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + +const ( + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc +) + +const ( + SizeofSockFprog = 0x8 +) + +type PtraceRegs struct { + Gpr [32]uint32 + Nip uint32 + Msr uint32 + Orig_gpr3 uint32 + Ctr uint32 + Link uint32 + Xer uint32 + Ccr uint32 + Mq uint32 + Trap uint32 + Dar uint32 + Dsisr uint32 + Result uint32 +} + +type FdSet struct { + Bits [32]int32 +} + +type Sysinfo_t struct { + Uptime int32 + Loads [3]uint32 + Totalram uint32 + Freeram uint32 + Sharedram uint32 + Bufferram uint32 + Totalswap uint32 + Freeswap uint32 + Procs uint16 + Pad uint16 + Totalhigh uint32 + Freehigh uint32 + Unit uint32 + _ [8]uint8 +} + +type Ustat_t struct { + Tfree int32 + Tinode uint32 + Fname [6]uint8 + Fpack [6]uint8 +} + +type EpollEvent struct { + Events uint32 + _ int32 + Fd int32 + Pad int32 +} + +const ( + POLLRDHUP = 0x2000 +) + +type Sigset_t struct { + Val [32]uint32 +} + +const _C__NSIG = 0x41 + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [19]uint8 + Line uint8 + Ispeed uint32 + Ospeed uint32 +} + +type Taskstats struct { + Version uint16 + Ac_exitcode uint32 + Ac_flag uint8 + Ac_nice uint8 + _ [4]byte + Cpu_count uint64 + Cpu_delay_total uint64 + Blkio_count uint64 + Blkio_delay_total uint64 + Swapin_count uint64 + Swapin_delay_total uint64 + Cpu_run_real_total uint64 + Cpu_run_virtual_total uint64 + Ac_comm [32]uint8 + Ac_sched uint8 + Ac_pad [3]uint8 + _ [4]byte + Ac_uid uint32 + Ac_gid uint32 + Ac_pid uint32 + Ac_ppid uint32 + Ac_btime uint32 + _ [4]byte + Ac_etime uint64 + Ac_utime uint64 + Ac_stime uint64 + Ac_minflt uint64 + Ac_majflt uint64 + Coremem uint64 + Virtmem uint64 + Hiwater_rss uint64 + Hiwater_vm uint64 + Read_char uint64 + Write_char uint64 + Read_syscalls uint64 + Write_syscalls uint64 + Read_bytes uint64 + Write_bytes uint64 + Cancelled_write_bytes uint64 + Nvcsw uint64 + Nivcsw uint64 + Ac_utimescaled uint64 + Ac_stimescaled uint64 + Cpu_scaled_run_real_total uint64 + Freepages_count uint64 + Freepages_delay_total uint64 + Thrashing_count uint64 + Thrashing_delay_total uint64 + Ac_btime64 uint64 +} + +type cpuMask uint32 + +const ( + _NCPUBITS = 0x20 +) + +const ( + CBitFieldMaskBit0 = 0x8000000000000000 + CBitFieldMaskBit1 = 0x4000000000000000 + CBitFieldMaskBit2 = 0x2000000000000000 + CBitFieldMaskBit3 = 0x1000000000000000 + CBitFieldMaskBit4 = 0x800000000000000 + CBitFieldMaskBit5 = 0x400000000000000 + CBitFieldMaskBit6 = 0x200000000000000 + CBitFieldMaskBit7 = 0x100000000000000 + CBitFieldMaskBit8 = 0x80000000000000 + CBitFieldMaskBit9 = 0x40000000000000 + CBitFieldMaskBit10 = 0x20000000000000 + CBitFieldMaskBit11 = 0x10000000000000 + CBitFieldMaskBit12 = 0x8000000000000 + CBitFieldMaskBit13 = 0x4000000000000 + CBitFieldMaskBit14 = 0x2000000000000 + CBitFieldMaskBit15 = 0x1000000000000 + CBitFieldMaskBit16 = 0x800000000000 + CBitFieldMaskBit17 = 0x400000000000 + CBitFieldMaskBit18 = 0x200000000000 + CBitFieldMaskBit19 = 0x100000000000 + CBitFieldMaskBit20 = 0x80000000000 + CBitFieldMaskBit21 = 0x40000000000 + CBitFieldMaskBit22 = 0x20000000000 + CBitFieldMaskBit23 = 0x10000000000 + CBitFieldMaskBit24 = 0x8000000000 + CBitFieldMaskBit25 = 0x4000000000 + CBitFieldMaskBit26 = 0x2000000000 + CBitFieldMaskBit27 = 0x1000000000 + CBitFieldMaskBit28 = 0x800000000 + CBitFieldMaskBit29 = 0x400000000 + CBitFieldMaskBit30 = 0x200000000 + CBitFieldMaskBit31 = 0x100000000 + CBitFieldMaskBit32 = 0x80000000 + CBitFieldMaskBit33 = 0x40000000 + CBitFieldMaskBit34 = 0x20000000 + CBitFieldMaskBit35 = 0x10000000 + CBitFieldMaskBit36 = 0x8000000 + CBitFieldMaskBit37 = 0x4000000 + CBitFieldMaskBit38 = 0x2000000 + CBitFieldMaskBit39 = 0x1000000 + CBitFieldMaskBit40 = 0x800000 + CBitFieldMaskBit41 = 0x400000 + CBitFieldMaskBit42 = 0x200000 + CBitFieldMaskBit43 = 0x100000 + CBitFieldMaskBit44 = 0x80000 + CBitFieldMaskBit45 = 0x40000 + CBitFieldMaskBit46 = 0x20000 + CBitFieldMaskBit47 = 0x10000 + CBitFieldMaskBit48 = 0x8000 + CBitFieldMaskBit49 = 0x4000 + CBitFieldMaskBit50 = 0x2000 + CBitFieldMaskBit51 = 0x1000 + CBitFieldMaskBit52 = 0x800 + CBitFieldMaskBit53 = 0x400 + CBitFieldMaskBit54 = 0x200 + CBitFieldMaskBit55 = 0x100 + CBitFieldMaskBit56 = 0x80 + CBitFieldMaskBit57 = 0x40 + CBitFieldMaskBit58 = 0x20 + CBitFieldMaskBit59 = 0x10 + CBitFieldMaskBit60 = 0x8 + CBitFieldMaskBit61 = 0x4 + CBitFieldMaskBit62 = 0x2 + CBitFieldMaskBit63 = 0x1 +) + +type SockaddrStorage struct { + Family uint16 + _ [122]uint8 + _ uint32 +} + +type HDGeometry struct { + Heads uint8 + Sectors uint8 + Cylinders uint16 + Start uint32 +} + +type Statfs_t struct { + Type int32 + Bsize int32 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint64 + Ffree uint64 + Fsid Fsid + Namelen int32 + Frsize int32 + Flags int32 + Spare [4]int32 + _ [4]byte +} + +type TpacketHdr struct { + Status uint32 + Len uint32 + Snaplen uint32 + Mac uint16 + Net uint16 + Sec uint32 + Usec uint32 +} + +const ( + SizeofTpacketHdr = 0x18 +) + +type RTCPLLInfo struct { + Ctrl int32 + Value int32 + Max int32 + Min int32 + Posmult int32 + Negmult int32 + Clock int32 +} + +type BlkpgPartition struct { + Start int64 + Length int64 + Pno int32 + Devname [64]uint8 + Volname [64]uint8 + _ [4]byte +} + +const ( + BLKPG = 0x20001269 +) + +type XDPUmemReg struct { + Addr uint64 + Len uint64 + Size uint32 + Headroom uint32 + Flags uint32 + _ [4]byte +} + +type CryptoUserAlg struct { + Name [64]uint8 + Driver_name [64]uint8 + Module_name [64]uint8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]uint8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]uint8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]uint8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]uint8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]uint8 +} + +type CryptoReportLarval struct { + Type [64]uint8 +} + +type CryptoReportHash struct { + Type [64]uint8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]uint8 +} + +type CryptoReportRNG struct { + Type [64]uint8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]uint8 +} + +type CryptoReportKPP struct { + Type [64]uint8 +} + +type CryptoReportAcomp struct { + Type [64]uint8 +} + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint32 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint32 + Reserved [4]uint8 +} + +type TIPCSubscr struct { + Seq TIPCServiceRange + Timeout uint32 + Filter uint32 + Handle [8]uint8 +} + +type TIPCSIOCLNReq struct { + Peer uint32 + Id uint32 + Linkname [68]uint8 +} + +type TIPCSIOCNodeIDReq struct { + Peer uint32 + Id [16]uint8 +} + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400470a1 + PPS_SETPARAMS = 0x800470a2 + PPS_GETCAP = 0x400470a3 + PPS_FETCH = 0xc00470a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime_high uint32 + Atime uint32 + Dtime_high uint32 + Dtime uint32 + Ctime_high uint32 + Ctime uint32 + _ uint32 + Segsz uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 + _ [4]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 0e6e8a77..2a606151 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && linux // +build ppc64,linux package unix @@ -131,6 +132,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -163,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -624,3 +642,32 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 7382f385..d0d735d0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64le && linux // +build ppc64le,linux package unix @@ -131,6 +132,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -163,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -624,3 +642,32 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 28d55221..95e3d6d0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build riscv64 && linux // +build riscv64,linux package unix @@ -130,6 +131,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -162,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -642,3 +660,33 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index a91a7a44..cccf1ef2 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build s390x && linux // +build s390x,linux package unix @@ -129,6 +130,17 @@ const ( FADV_NOREUSE = 0x7 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -161,10 +173,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -638,3 +656,32 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index f824b235..44fcbe4e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build sparc64 && linux // +build sparc64,linux package unix @@ -133,6 +134,17 @@ const ( FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -165,10 +177,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -619,3 +637,32 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x4000 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 3f11f88e..2fd2060e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && netbsd // +build 386,netbsd package unix @@ -444,8 +445,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 0bed83af..6a5a1a8a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && netbsd // +build amd64,netbsd package unix @@ -452,8 +453,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index e4e3bf73..84cc8d01 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && netbsd // +build arm,netbsd package unix @@ -449,8 +450,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index efac861b..c844e709 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && netbsd // +build arm64,netbsd package unix @@ -452,8 +453,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 80fa295f..2a8b1e6f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -1,6 +1,7 @@ // cgo -godefs types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd package unix @@ -437,8 +438,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 560dd6d0..b1759cf7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd package unix @@ -437,8 +438,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index 0c1700fa..e807de20 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd package unix @@ -438,8 +439,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index 5b3e4663..ff3aecae 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd package unix @@ -431,8 +432,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go index 62bff167..9ecda691 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && openbsd // +build mips64,openbsd package unix @@ -431,8 +432,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index ca512aff..ad4aad27 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_solaris.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && solaris // +build amd64,solaris package unix @@ -439,3 +440,43 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type fileObj struct { + Atim Timespec + Mtim Timespec + Ctim Timespec + Pad [3]uint64 + Name *int8 +} + +type portEvent struct { + Events int32 + Source uint16 + Pad uint16 + Object uint64 + User *byte +} + +const ( + PORT_SOURCE_AIO = 0x1 + PORT_SOURCE_TIMER = 0x2 + PORT_SOURCE_USER = 0x3 + PORT_SOURCE_FD = 0x4 + PORT_SOURCE_ALERT = 0x5 + PORT_SOURCE_MQ = 0x6 + PORT_SOURCE_FILE = 0x7 + PORT_ALERT_SET = 0x1 + PORT_ALERT_UPDATE = 0x2 + PORT_ALERT_INVALID = 0x3 + FILE_ACCESS = 0x1 + FILE_MODIFIED = 0x2 + FILE_ATTRIB = 0x4 + FILE_TRUNC = 0x100000 + FILE_NOFOLLOW = 0x10000000 + FILE_DELETE = 0x10 + FILE_RENAME_TO = 0x20 + FILE_RENAME_FROM = 0x40 + UNMOUNTED = 0x20000000 + MOUNTEDOVER = 0x40000000 + FILE_EXCEPTION = 0x60000070 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go new file mode 100644 index 00000000..4ab638cb --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -0,0 +1,406 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +// Hand edited based on ztypes_linux_s390x.go +// TODO: auto-generate. + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 + PathMax = 0x1000 +) + +const ( + SizeofSockaddrAny = 128 + SizeofCmsghdr = 12 + SizeofIPMreq = 8 + SizeofIPv6Mreq = 20 + SizeofICMPv6Filter = 32 + SizeofIPv6MTUInfo = 32 + SizeofLinger = 8 + SizeofSockaddrInet4 = 16 + SizeofSockaddrInet6 = 28 + SizeofTCPInfo = 0x68 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type timeval_zos struct { //correct (with padding and all) + Sec int64 + _ [4]byte // pad + Usec int32 +} + +type Tms struct { //clock_t is 4-byte unsigned int in zos + Utime uint32 + Stime uint32 + Cutime uint32 + Cstime uint32 +} + +type Time_t int64 + +type Utimbuf struct { + Actime int64 + Modtime int64 +} + +type Utsname struct { + Sysname [65]byte + Nodename [65]byte + Release [65]byte + Version [65]byte + Machine [65]byte + Domainname [65]byte +} + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]uint8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [108]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]uint8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + _ [112]uint8 // pad +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Iov *Iovec + Control *byte + Flags int32 + Namelen int32 + Iovlen int32 + Controllen int32 +} + +type Cmsghdr struct { + Len int32 + Level int32 + Type int32 +} + +type Inet4Pktinfo struct { + Addr [4]byte /* in_addr */ + Ifindex uint32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Data [8]uint32 +} + +type TCPInfo struct { + State uint8 + Ca_state uint8 + Retransmits uint8 + Probes uint8 + Backoff uint8 + Options uint8 + Rto uint32 + Ato uint32 + Snd_mss uint32 + Rcv_mss uint32 + Unacked uint32 + Sacked uint32 + Lost uint32 + Retrans uint32 + Fackets uint32 + Last_data_sent uint32 + Last_ack_sent uint32 + Last_data_recv uint32 + Last_ack_recv uint32 + Pmtu uint32 + Rcv_ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Advmss uint32 + Reordering uint32 + Rcv_rtt uint32 + Rcv_space uint32 + Total_retrans uint32 +} + +type _Gid_t uint32 + +type rusage_zos struct { + Utime timeval_zos + Stime timeval_zos +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +// { int, short, short } in poll.h +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +type Stat_t struct { //Linux Definition + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint32 + Uid uint32 + Gid uint32 + _ int32 + Rdev uint64 + Size int64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Blksize int64 + Blocks int64 + _ [3]int64 +} + +type Stat_LE_t struct { + _ [4]byte // eye catcher + Length uint16 + Version uint16 + Mode int32 + Ino uint32 + Dev uint32 + Nlink int32 + Uid int32 + Gid int32 + Size int64 + Atim31 [4]byte + Mtim31 [4]byte + Ctim31 [4]byte + Rdev uint32 + Auditoraudit uint32 + Useraudit uint32 + Blksize int32 + Creatim31 [4]byte + AuditID [16]byte + _ [4]byte // rsrvd1 + File_tag struct { + Ccsid uint16 + Txtflag uint16 // aggregating Txflag:1 deferred:1 rsvflags:14 + } + CharsetID [8]byte + Blocks int64 + Genvalue uint32 + Reftim31 [4]byte + Fid [8]byte + Filefmt byte + Fspflag2 byte + _ [2]byte // rsrvd2 + Ctimemsec int32 + Seclabel [8]byte + _ [4]byte // rsrvd3 + _ [4]byte // rsrvd4 + Atim Time_t + Mtim Time_t + Ctim Time_t + Creatim Time_t + Reftim Time_t + _ [24]byte // rsrvd5 +} + +type Statvfs_t struct { + ID [4]byte + Len int32 + Bsize uint64 + Blocks uint64 + Usedspace uint64 + Bavail uint64 + Flag uint64 + Maxfilesize int64 + _ [16]byte + Frsize uint64 + Bfree uint64 + Files uint32 + Ffree uint32 + Favail uint32 + Namemax31 uint32 + Invarsec uint32 + _ [4]byte + Fsid uint64 + Namemax uint64 +} + +type Statfs_t struct { + Type uint32 + Bsize uint64 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint32 + Ffree uint32 + Fsid uint64 + Namelen uint64 + Frsize uint64 + Flags uint64 +} + +type Dirent struct { + Reclen uint16 + Namlen uint16 + Ino uint32 + Extra uintptr + Name [256]byte +} + +type FdSet struct { + Bits [64]int32 +} + +// This struct is packed on z/OS so it can't be used directly. +type Flock_t struct { + Type int16 + Whence int16 + Start int64 + Len int64 + Pid int32 +} + +type Termios struct { + Cflag uint32 + Iflag uint32 + Lflag uint32 + Oflag uint32 + Cc [11]uint8 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +type W_Mnth struct { + Hid [4]byte + Size int32 + Cur1 int32 //32bit pointer + Cur2 int32 //^ + Devno uint32 + _ [4]byte +} + +type W_Mntent struct { + Fstype uint32 + Mode uint32 + Dev uint32 + Parentdev uint32 + Rootino uint32 + Status byte + Ddname [9]byte + Fstname [9]byte + Fsname [45]byte + Pathlen uint32 + Mountpoint [1024]byte + Jobname [8]byte + PID int32 + Parmoffset int32 + Parmlen int16 + Owner [8]byte + Quiesceowner [8]byte + _ [38]byte +} diff --git a/vendor/golang.org/x/sys/windows/empty.s b/vendor/golang.org/x/sys/windows/empty.s index 69309e4d..fdbbbcd3 100644 --- a/vendor/golang.org/x/sys/windows/empty.s +++ b/vendor/golang.org/x/sys/windows/empty.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !go1.12 // +build !go1.12 // This file is here to allow bodyless functions with go:linkname for Go 1.11 diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go index 3606c3a8..7a11e83b 100644 --- a/vendor/golang.org/x/sys/windows/exec_windows.go +++ b/vendor/golang.org/x/sys/windows/exec_windows.go @@ -6,6 +6,13 @@ package windows +import ( + errorspkg "errors" + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" +) + // EscapeArg rewrites command line argument s as prescribed // in http://msdn.microsoft.com/en-us/library/ms880421. // This function returns "" (2 double quotes) if s is empty. @@ -73,6 +80,40 @@ func EscapeArg(s string) string { return string(qs[:j]) } +// ComposeCommandLine escapes and joins the given arguments suitable for use as a Windows command line, +// in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument, +// or any program that uses CommandLineToArgv. +func ComposeCommandLine(args []string) string { + var commandLine string + for i := range args { + if i > 0 { + commandLine += " " + } + commandLine += EscapeArg(args[i]) + } + return commandLine +} + +// DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv, +// as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that +// command lines are passed around. +func DecomposeCommandLine(commandLine string) ([]string, error) { + if len(commandLine) == 0 { + return []string{}, nil + } + var argc int32 + argv, err := CommandLineToArgv(StringToUTF16Ptr(commandLine), &argc) + if err != nil { + return nil, err + } + defer LocalFree(Handle(unsafe.Pointer(argv))) + var args []string + for _, v := range (*argv)[:argc] { + args = append(args, UTF16ToString((*v)[:])) + } + return args, nil +} + func CloseOnExec(fd Handle) { SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) } @@ -95,3 +136,60 @@ func FullPath(name string) (path string, err error) { } } } + +// NewProcThreadAttributeList allocates a new ProcThreadAttributeListContainer, with the requested maximum number of attributes. +func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) { + var size uintptr + err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size) + if err != ERROR_INSUFFICIENT_BUFFER { + if err == nil { + return nil, errorspkg.New("unable to query buffer size from InitializeProcThreadAttributeList") + } + return nil, err + } + // size is guaranteed to be ≥1 by InitializeProcThreadAttributeList. + al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(&make([]byte, size)[0]))} + err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size) + if err != nil { + return nil, err + } + return al, err +} + +// Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute. +// Note that the value passed to this function will be copied into memory +// allocated by LocalAlloc, the contents of which should not contain any +// Go-managed pointers, even if the passed value itself is a Go-managed +// pointer. +func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error { + alloc, err := LocalAlloc(LMEM_FIXED, uint32(size)) + if err != nil { + return err + } + var src, dst []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&src)) + hdr.Data = value + hdr.Cap = int(size) + hdr.Len = int(size) + hdr = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) + hdr.Data = unsafe.Pointer(alloc) + hdr.Cap = int(size) + hdr.Len = int(size) + copy(dst, src) + al.heapAllocations = append(al.heapAllocations, alloc) + return updateProcThreadAttribute(al.data, 0, attribute, unsafe.Pointer(alloc), size, nil, nil) +} + +// Delete frees ProcThreadAttributeList's resources. +func (al *ProcThreadAttributeListContainer) Delete() { + deleteProcThreadAttributeList(al.data) + for i := range al.heapAllocations { + LocalFree(Handle(al.heapAllocations[i])) + } + al.heapAllocations = nil +} + +// List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx. +func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList { + return al.data +} diff --git a/vendor/golang.org/x/sys/windows/mkerrors.bash b/vendor/golang.org/x/sys/windows/mkerrors.bash index 2163843a..58e0188f 100644 --- a/vendor/golang.org/x/sys/windows/mkerrors.bash +++ b/vendor/golang.org/x/sys/windows/mkerrors.bash @@ -9,6 +9,8 @@ shopt -s nullglob winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" [[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } +ntstatus="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/ntstatus.h | sort -Vr | head -n 1)" +[[ -n $ntstatus ]] || { echo "Unable to find ntstatus.h" >&2; exit 1; } declare -A errors @@ -59,5 +61,10 @@ declare -A errors echo "$key $vtype = $value" done < "$winerror" + while read -r line; do + [[ $line =~ ^#define\ (STATUS_[^\s]+)\ +\(\(NTSTATUS\)((0x)?[0-9a-fA-F]+)L?\) ]] || continue + echo "${BASH_REMATCH[1]} NTStatus = ${BASH_REMATCH[2]}" + done < "$ntstatus" + echo ")" } | gofmt > "zerrors_windows.go" diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 69eb462c..d414ef13 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -889,6 +889,7 @@ type WTS_SESSION_INFO struct { //sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken //sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW //sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory +//sys WTSGetActiveConsoleSessionId() (sessionID uint32) type ACL struct { aclRevision byte @@ -908,6 +909,19 @@ type SECURITY_DESCRIPTOR struct { dacl *ACL } +type SECURITY_QUALITY_OF_SERVICE struct { + Length uint32 + ImpersonationLevel uint32 + ContextTrackingMode byte + EffectiveOnly byte +} + +// Constants for the ContextTrackingMode field of SECURITY_QUALITY_OF_SERVICE. +const ( + SECURITY_STATIC_TRACKING = 0 + SECURITY_DYNAMIC_TRACKING = 1 +) + type SecurityAttributes struct { Length uint32 SecurityDescriptor *SECURITY_DESCRIPTOR @@ -1321,7 +1335,11 @@ func (absoluteSD *SECURITY_DESCRIPTOR) ToSelfRelative() (selfRelativeSD *SECURIT } func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() *SECURITY_DESCRIPTOR { - sdLen := (int)(selfRelativeSD.Length()) + sdLen := int(selfRelativeSD.Length()) + const min = int(unsafe.Sizeof(SECURITY_DESCRIPTOR{})) + if sdLen < min { + sdLen = min + } var src []byte h := (*unsafeheader.Slice)(unsafe.Pointer(&src)) @@ -1329,7 +1347,15 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() h.Len = sdLen h.Cap = sdLen - dst := make([]byte, sdLen) + const psize = int(unsafe.Sizeof(uintptr(0))) + + var dst []byte + h = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) + alloc := make([]uintptr, (sdLen+psize-1)/psize) + h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data + h.Len = sdLen + h.Cap = sdLen + copy(dst, src) return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0])) } diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 0197df87..ff2d45d4 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -8,6 +8,8 @@ package windows import ( errorspkg "errors" + "fmt" + "runtime" "sync" "syscall" "time" @@ -65,9 +67,8 @@ const ( LOCKFILE_FAIL_IMMEDIATELY = 0x00000001 LOCKFILE_EXCLUSIVE_LOCK = 0x00000002 - // Return values of SleepEx and other APC functions - STATUS_USER_APC = 0x000000C0 - WAIT_IO_COMPLETION = STATUS_USER_APC + // Return value of SleepEx and other APC functions + WAIT_IO_COMPLETION = 0x000000C0 ) // StringToUTF16 is deprecated. Use UTF16FromString instead. @@ -180,6 +181,11 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process //sys IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) = IsWow64Process2? //sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW +//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW +//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) +//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) +//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW +//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState //sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) @@ -208,12 +214,16 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetSystemTimeAsFileTime(time *Filetime) //sys GetSystemTimePreciseAsFileTime(time *Filetime) //sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] -//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) -//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) -//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) +//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) +//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) +//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) //sys CancelIo(s Handle) (err error) //sys CancelIoEx(s Handle, o *Overlapped) (err error) //sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW +//sys CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = advapi32.CreateProcessAsUserW +//sys initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList +//sys deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) = DeleteProcThreadAttributeList +//sys updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW //sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId @@ -248,13 +258,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW //sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW //sys LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0] +//sys LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) //sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) //sys FlushFileBuffers(handle Handle) (err error) //sys GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) = kernel32.GetFullPathNameW //sys GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) = kernel32.GetLongPathNameW //sys GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) = kernel32.GetShortPathNameW //sys GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) = kernel32.GetFinalPathNameByHandleW -//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) = kernel32.CreateFileMappingW +//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateFileMappingW //sys MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) //sys UnmapViewOfFile(addr uintptr) (err error) //sys FlushViewOfFile(addr uintptr, length uintptr) (err error) @@ -283,6 +294,9 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy //sys CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) = crypt32.CertGetNameStringW //sys CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) = crypt32.CertFindExtension +//sys CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) [failretval==nil] = crypt32.CertFindCertificateInStore +//sys CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) [failretval==nil] = crypt32.CertFindChainInStore +//sys CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) = crypt32.CryptAcquireCertificatePrivateKey //sys CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) = crypt32.CryptQueryObject //sys CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) = crypt32.CryptDecodeObject //sys CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptProtectData @@ -312,14 +326,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW //sys CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW //sys GetCurrentThreadId() (id uint32) -//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) = kernel32.CreateEventW -//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateEventExW +//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventW +//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventExW //sys OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenEventW //sys SetEvent(event Handle) (err error) = kernel32.SetEvent //sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent //sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent -//sys CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) = kernel32.CreateMutexW -//sys CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateMutexExW +//sys CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexW +//sys CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexExW //sys OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenMutexW //sys ReleaseMutex(mutex Handle) (err error) = kernel32.ReleaseMutex //sys SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx @@ -334,10 +348,13 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) //sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) //sys GetProcessId(process Handle) (id uint32, err error) +//sys QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) = kernel32.QueryFullProcessImageNameW //sys OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) //sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost //sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) //sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) +//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) // Volume Management Functions //sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW @@ -367,15 +384,40 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2 //sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid //sys CoTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree -//sys rtlGetVersion(info *OsVersionInfoEx) (ret error) = ntdll.RtlGetVersion -//sys rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers +//sys CoInitializeEx(reserved uintptr, coInit uint32) (ret error) = ole32.CoInitializeEx +//sys CoUninitialize() = ole32.CoUninitialize +//sys CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) = ole32.CoGetObject //sys getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetProcessPreferredUILanguages //sys getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetThreadPreferredUILanguages //sys getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetUserPreferredUILanguages //sys getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetSystemPreferredUILanguages +//sys findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) = kernel32.FindResourceW +//sys SizeofResource(module Handle, resInfo Handle) (size uint32, err error) = kernel32.SizeofResource +//sys LoadResource(module Handle, resInfo Handle) (resData Handle, err error) = kernel32.LoadResource +//sys LockResource(resData Handle) (addr uintptr, err error) = kernel32.LockResource // Process Status API (PSAPI) //sys EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses +//sys EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) = psapi.EnumProcessModules +//sys EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) = psapi.EnumProcessModulesEx +//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation +//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW +//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW + +// NT Native APIs +//sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb +//sys rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) = ntdll.RtlGetVersion +//sys rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers +//sys RtlGetCurrentPeb() (peb *PEB) = ntdll.RtlGetCurrentPeb +//sys RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) = ntdll.RtlInitUnicodeString +//sys RtlInitString(destinationString *NTString, sourceString *byte) = ntdll.RtlInitString +//sys NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) = ntdll.NtCreateFile +//sys NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) = ntdll.NtCreateNamedPipeFile +//sys RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToNtPathName_U_WithStatus +//sys RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToRelativeNtPathName_U_WithStatus +//sys RtlDefaultNpAcl(acl **ACL) (ntstatus error) = ntdll.RtlDefaultNpAcl +//sys NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) = ntdll.NtQueryInformationProcess +//sys NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) = ntdll.NtSetInformationProcess // syscall interface implementation for other packages @@ -770,6 +812,7 @@ const socket_error = uintptr(^uint32(0)) //sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASend //sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom //sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo +//sys WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.WSASocketW //sys GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname //sys GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname //sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs @@ -783,6 +826,7 @@ const socket_error = uintptr(^uint32(0)) //sys GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) = iphlpapi.GetAdaptersInfo //sys SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) = kernel32.SetFileCompletionNotificationModes //sys WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) [failretval==-1] = ws2_32.WSAEnumProtocolsW +//sys WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult //sys GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) = iphlpapi.GetAdaptersAddresses //sys GetACP() (acp uint32) = kernel32.GetACP //sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar @@ -1505,3 +1549,129 @@ func getUILanguages(flags uint32, f func(flags uint32, numLanguages *uint32, buf func SetConsoleCursorPosition(console Handle, position Coord) error { return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position)))) } + +func (s NTStatus) Errno() syscall.Errno { + return rtlNtStatusToDosErrorNoTeb(s) +} + +func langID(pri, sub uint16) uint32 { return uint32(sub)<<10 | uint32(pri) } + +func (s NTStatus) Error() string { + b := make([]uint16, 300) + n, err := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY, modntdll.Handle(), uint32(s), langID(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil) + if err != nil { + return fmt.Sprintf("NTSTATUS 0x%08x", uint32(s)) + } + // trim terminating \r and \n + for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- { + } + return string(utf16.Decode(b[:n])) +} + +// NewNTUnicodeString returns a new NTUnicodeString structure for use with native +// NT APIs that work over the NTUnicodeString type. Note that most Windows APIs +// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for +// the more common *uint16 string type. +func NewNTUnicodeString(s string) (*NTUnicodeString, error) { + var u NTUnicodeString + s16, err := UTF16PtrFromString(s) + if err != nil { + return nil, err + } + RtlInitUnicodeString(&u, s16) + return &u, nil +} + +// Slice returns a uint16 slice that aliases the data in the NTUnicodeString. +func (s *NTUnicodeString) Slice() []uint16 { + var slice []uint16 + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) + hdr.Data = unsafe.Pointer(s.Buffer) + hdr.Len = int(s.Length) + hdr.Cap = int(s.MaximumLength) + return slice +} + +func (s *NTUnicodeString) String() string { + return UTF16ToString(s.Slice()) +} + +// NewNTString returns a new NTString structure for use with native +// NT APIs that work over the NTString type. Note that most Windows APIs +// do not use NTString, and instead UTF16PtrFromString should be used for +// the more common *uint16 string type. +func NewNTString(s string) (*NTString, error) { + var nts NTString + s8, err := BytePtrFromString(s) + if err != nil { + return nil, err + } + RtlInitString(&nts, s8) + return &nts, nil +} + +// Slice returns a byte slice that aliases the data in the NTString. +func (s *NTString) Slice() []byte { + var slice []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) + hdr.Data = unsafe.Pointer(s.Buffer) + hdr.Len = int(s.Length) + hdr.Cap = int(s.MaximumLength) + return slice +} + +func (s *NTString) String() string { + return ByteSliceToString(s.Slice()) +} + +// FindResource resolves a resource of the given name and resource type. +func FindResource(module Handle, name, resType ResourceIDOrString) (Handle, error) { + var namePtr, resTypePtr uintptr + var name16, resType16 *uint16 + var err error + resolvePtr := func(i interface{}, keep **uint16) (uintptr, error) { + switch v := i.(type) { + case string: + *keep, err = UTF16PtrFromString(v) + if err != nil { + return 0, err + } + return uintptr(unsafe.Pointer(*keep)), nil + case ResourceID: + return uintptr(v), nil + } + return 0, errorspkg.New("parameter must be a ResourceID or a string") + } + namePtr, err = resolvePtr(name, &name16) + if err != nil { + return 0, err + } + resTypePtr, err = resolvePtr(resType, &resType16) + if err != nil { + return 0, err + } + resInfo, err := findResource(module, namePtr, resTypePtr) + runtime.KeepAlive(name16) + runtime.KeepAlive(resType16) + return resInfo, err +} + +func LoadResourceData(module, resInfo Handle) (data []byte, err error) { + size, err := SizeofResource(module, resInfo) + if err != nil { + return + } + resData, err := LoadResource(module, resInfo) + if err != nil { + return + } + ptr, err := LockResource(resData) + if err != nil { + return + } + h := (*unsafeheader.Slice)(unsafe.Pointer(&data)) + h.Data = unsafe.Pointer(ptr) + h.Len = int(size) + h.Cap = int(size) + return +} diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index fd426076..88e0ce5d 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -10,6 +10,10 @@ import ( "unsafe" ) +// NTStatus corresponds with NTSTATUS, error values returned by ntdll.dll and +// other native functions. +type NTStatus uint32 + const ( // Invented values to support what package os expects. O_RDONLY = 0x00000 @@ -215,6 +219,18 @@ const ( INHERIT_PARENT_AFFINITY = 0x00010000 ) +const ( + // attributes for ProcThreadAttributeList + PROC_THREAD_ATTRIBUTE_PARENT_PROCESS = 0x00020000 + PROC_THREAD_ATTRIBUTE_HANDLE_LIST = 0x00020002 + PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY = 0x00030003 + PROC_THREAD_ATTRIBUTE_PREFERRED_NODE = 0x00020004 + PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR = 0x00030005 + PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 + PROC_THREAD_ATTRIBUTE_UMS_THREAD = 0x00030006 + PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL = 0x0002000b +) + const ( // flags for CreateToolhelp32Snapshot TH32CS_SNAPHEAPLIST = 0x01 @@ -226,6 +242,14 @@ const ( TH32CS_INHERIT = 0x80000000 ) +const ( + // flags for EnumProcessModulesEx + LIST_MODULES_32BIT = 0x01 + LIST_MODULES_64BIT = 0x02 + LIST_MODULES_ALL = 0x03 + LIST_MODULES_DEFAULT = 0x00 +) + const ( // filters for ReadDirectoryChangesW and FindFirstChangeNotificationW FILE_NOTIFY_CHANGE_FILE_NAME = 0x001 @@ -287,6 +311,23 @@ const ( PKCS12_NO_PERSIST_KEY = 0x00008000 PKCS12_INCLUDE_EXTENDED_PROPERTIES = 0x00000010 + /* Flags for CryptAcquireCertificatePrivateKey */ + CRYPT_ACQUIRE_CACHE_FLAG = 0x00000001 + CRYPT_ACQUIRE_USE_PROV_INFO_FLAG = 0x00000002 + CRYPT_ACQUIRE_COMPARE_KEY_FLAG = 0x00000004 + CRYPT_ACQUIRE_NO_HEALING = 0x00000008 + CRYPT_ACQUIRE_SILENT_FLAG = 0x00000040 + CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG = 0x00000080 + CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK = 0x00070000 + CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG = 0x00010000 + CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG = 0x00020000 + CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG = 0x00040000 + + /* pdwKeySpec for CryptAcquireCertificatePrivateKey */ + AT_KEYEXCHANGE = 1 + AT_SIGNATURE = 2 + CERT_NCRYPT_KEY_SPEC = 0xFFFFFFFF + /* Default usage match type is AND with value zero */ USAGE_MATCH_TYPE_AND = 0 USAGE_MATCH_TYPE_OR = 1 @@ -412,6 +453,89 @@ const ( CERT_TRUST_IS_CA_TRUSTED = 0x00004000 CERT_TRUST_IS_COMPLEX_CHAIN = 0x00010000 + /* Certificate Information Flags */ + CERT_INFO_VERSION_FLAG = 1 + CERT_INFO_SERIAL_NUMBER_FLAG = 2 + CERT_INFO_SIGNATURE_ALGORITHM_FLAG = 3 + CERT_INFO_ISSUER_FLAG = 4 + CERT_INFO_NOT_BEFORE_FLAG = 5 + CERT_INFO_NOT_AFTER_FLAG = 6 + CERT_INFO_SUBJECT_FLAG = 7 + CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG = 8 + CERT_INFO_ISSUER_UNIQUE_ID_FLAG = 9 + CERT_INFO_SUBJECT_UNIQUE_ID_FLAG = 10 + CERT_INFO_EXTENSION_FLAG = 11 + + /* dwFindType for CertFindCertificateInStore */ + CERT_COMPARE_MASK = 0xFFFF + CERT_COMPARE_SHIFT = 16 + CERT_COMPARE_ANY = 0 + CERT_COMPARE_SHA1_HASH = 1 + CERT_COMPARE_NAME = 2 + CERT_COMPARE_ATTR = 3 + CERT_COMPARE_MD5_HASH = 4 + CERT_COMPARE_PROPERTY = 5 + CERT_COMPARE_PUBLIC_KEY = 6 + CERT_COMPARE_HASH = CERT_COMPARE_SHA1_HASH + CERT_COMPARE_NAME_STR_A = 7 + CERT_COMPARE_NAME_STR_W = 8 + CERT_COMPARE_KEY_SPEC = 9 + CERT_COMPARE_ENHKEY_USAGE = 10 + CERT_COMPARE_CTL_USAGE = CERT_COMPARE_ENHKEY_USAGE + CERT_COMPARE_SUBJECT_CERT = 11 + CERT_COMPARE_ISSUER_OF = 12 + CERT_COMPARE_EXISTING = 13 + CERT_COMPARE_SIGNATURE_HASH = 14 + CERT_COMPARE_KEY_IDENTIFIER = 15 + CERT_COMPARE_CERT_ID = 16 + CERT_COMPARE_CROSS_CERT_DIST_POINTS = 17 + CERT_COMPARE_PUBKEY_MD5_HASH = 18 + CERT_COMPARE_SUBJECT_INFO_ACCESS = 19 + CERT_COMPARE_HASH_STR = 20 + CERT_COMPARE_HAS_PRIVATE_KEY = 21 + CERT_FIND_ANY = (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT) + CERT_FIND_SHA1_HASH = (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_MD5_HASH = (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_SIGNATURE_HASH = (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_KEY_IDENTIFIER = (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT) + CERT_FIND_HASH = CERT_FIND_SHA1_HASH + CERT_FIND_PROPERTY = (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT) + CERT_FIND_PUBLIC_KEY = (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT) + CERT_FIND_SUBJECT_NAME = (CERT_COMPARE_NAME< 0 { @@ -2921,6 +3258,30 @@ func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { return } +func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) { ret = procSubscribeServiceChangeNotifications.Find() if ret != nil { @@ -3081,6 +3442,18 @@ func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferL return } +func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == socket_error { @@ -3121,6 +3494,15 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 return } +func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } + return +} + func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) if r0 != 0 { diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index f8363d8f..fc8beea5 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -100,10 +100,34 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, // Write writes encoded type information for the specified package to out. // The FileSet provides file position information for named objects. func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error { - b, err := gcimporter.IExportData(fset, pkg) - if err != nil { + if _, err := io.WriteString(out, "i"); err != nil { return err } - _, err = out.Write(b) - return err + return gcimporter.IExportData(out, fset, pkg) +} + +// ReadBundle reads an export bundle from in, decodes it, and returns type +// information for the packages. +// File position information is added to fset. +// +// ReadBundle may inspect and add to the imports map to ensure that references +// within the export bundle to other packages are consistent. +// +// On return, the state of the reader is undefined. +// +// Experimental: This API is experimental and may change in the future. +func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) { + data, err := ioutil.ReadAll(in) + if err != nil { + return nil, fmt.Errorf("reading export bundle: %v", err) + } + return gcimporter.IImportBundle(fset, imports, data) +} + +// WriteBundle writes encoded type information for the specified packages to out. +// The FileSet provides file position information for named objects. +// +// Experimental: This API is experimental and may change in the future. +func WriteBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { + return gcimporter.IExportBundle(out, fset, pkgs) } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go index a807d0aa..072005af 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go @@ -92,16 +92,18 @@ func internalErrorf(format string, args ...interface{}) error { // BExportData returns binary export data for pkg. // If no file set is provided, position info will be missing. func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return + if !debug { + defer func() { + if e := recover(); e != nil { + if ierr, ok := e.(internalError); ok { + err = ierr + return + } + // Not an internal error; panic again. + panic(e) } - // Not an internal error; panic again. - panic(e) - } - }() + }() + } p := exporter{ fset: fset, diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go index e9f73d14..b0231200 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go @@ -1029,6 +1029,7 @@ func predeclared() []types.Type { // used internally by gc; never used by this package or in .a files anyType{}, } + predecl = append(predecl, additionalPredeclared()...) }) return predecl } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go index 4be32a2e..be8b7459 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go @@ -19,37 +19,51 @@ import ( "math/big" "reflect" "sort" + + "golang.org/x/tools/internal/typeparams" ) -// Current indexed export format version. Increase with each format change. -// 0: Go1.11 encoding -const iexportVersion = 0 +// Current bundled export format version. Increase with each format change. +// 0: initial implementation +const bundleVersion = 0 -// IExportData returns the binary export data for pkg. +// IExportData writes indexed export data for pkg to out. // // If no file set is provided, position info will be missing. // The package path of the top-level package will not be recorded, // so that calls to IImportData can override with a provided package path. -func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return +func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error { + return iexportCommon(out, fset, false, []*types.Package{pkg}) +} + +// IExportBundle writes an indexed export bundle for pkgs to out. +func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { + return iexportCommon(out, fset, true, pkgs) +} + +func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*types.Package) (err error) { + if !debug { + defer func() { + if e := recover(); e != nil { + if ierr, ok := e.(internalError); ok { + err = ierr + return + } + // Not an internal error; panic again. + panic(e) } - // Not an internal error; panic again. - panic(e) - } - }() + }() + } p := iexporter{ - out: bytes.NewBuffer(nil), fset: fset, allPkgs: map[*types.Package]bool{}, stringIndex: map[string]uint64{}, declIndex: map[types.Object]uint64{}, typIndex: map[types.Type]uint64{}, - localpkg: pkg, + } + if !bundle { + p.localpkg = pkgs[0] } for i, pt := range predeclared() { @@ -60,10 +74,20 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) } // Initialize work queue with exported declarations. - scope := pkg.Scope() - for _, name := range scope.Names() { - if ast.IsExported(name) { - p.pushDecl(scope.Lookup(name)) + for _, pkg := range pkgs { + scope := pkg.Scope() + for _, name := range scope.Names() { + if ast.IsExported(name) { + p.pushDecl(scope.Lookup(name)) + } + } + + if bundle { + // Ensure pkg and its imports are included in the index. + p.allPkgs[pkg] = true + for _, imp := range pkg.Imports() { + p.allPkgs[imp] = true + } } } @@ -76,21 +100,35 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) dataLen := uint64(p.data0.Len()) w := p.newWriter() w.writeIndex(p.declIndex) + + if bundle { + w.uint64(uint64(len(pkgs))) + for _, pkg := range pkgs { + w.pkg(pkg) + imps := pkg.Imports() + w.uint64(uint64(len(imps))) + for _, imp := range imps { + w.pkg(imp) + } + } + } w.flush() // Assemble header. var hdr intWriter - hdr.WriteByte('i') + if bundle { + hdr.uint64(bundleVersion) + } hdr.uint64(iexportVersion) hdr.uint64(uint64(p.strings.Len())) hdr.uint64(dataLen) // Flush output. - io.Copy(p.out, &hdr) - io.Copy(p.out, &p.strings) - io.Copy(p.out, &p.data0) + io.Copy(out, &hdr) + io.Copy(out, &p.strings) + io.Copy(out, &p.data0) - return p.out.Bytes(), nil + return nil } // writeIndex writes out an object index. mainIndex indicates whether @@ -104,7 +142,9 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { // For the main index, make sure to include every package that // we reference, even if we're not exporting (or reexporting) // any symbols from it. - pkgObjs[w.p.localpkg] = nil + if w.p.localpkg != nil { + pkgObjs[w.p.localpkg] = nil + } for pkg := range w.p.allPkgs { pkgObjs[pkg] = nil } @@ -118,7 +158,7 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { pkgs = append(pkgs, pkg) sort.Slice(objs, func(i, j int) bool { - return objs[i].Name() < objs[j].Name() + return indexName(objs[i]) < indexName(objs[j]) }) } @@ -135,12 +175,26 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { objs := pkgObjs[pkg] w.uint64(uint64(len(objs))) for _, obj := range objs { - w.string(obj.Name()) + w.string(indexName(obj)) w.uint64(index[obj]) } } } +// indexName returns the 'indexed' name of an object. It differs from +// obj.Name() only for type parameter names, where we include the subscripted +// type parameter ID. +// +// TODO(rfindley): remove this once we no longer need subscripts. +func indexName(obj types.Object) (res string) { + if _, ok := obj.(*types.TypeName); ok { + if tparam, ok := obj.Type().(*typeparams.TypeParam); ok { + return types.TypeString(tparam, func(*types.Package) string { return "" }) + } + } + return obj.Name() +} + type iexporter struct { fset *token.FileSet out *bytes.Buffer @@ -193,10 +247,11 @@ func (p *iexporter) pushDecl(obj types.Object) { type exportWriter struct { p *iexporter - data intWriter - currPkg *types.Package - prevFile string - prevLine int64 + data intWriter + currPkg *types.Package + prevFile string + prevLine int64 + prevColumn int64 } func (w *exportWriter) exportPath(pkg *types.Package) string { @@ -221,8 +276,23 @@ func (p *iexporter) doDecl(obj types.Object) { if sig.Recv() != nil { panic(internalErrorf("unexpected method: %v", sig)) } - w.tag('F') + + // Function. + if typeparams.ForSignature(sig).Len() == 0 { + w.tag('F') + } else { + w.tag('G') + } w.pos(obj.Pos()) + // The tparam list of the function type is the + // declaration of the type params. So, write out the type + // params right now. Then those type params will be + // referenced via their type offset (via typOff) in all + // other places in the signature and function that they + // are used. + if tparams := typeparams.ForSignature(sig); tparams.Len() > 0 { + w.tparamList(tparams, obj.Pkg()) + } w.signature(sig) case *types.Const: @@ -231,30 +301,46 @@ func (p *iexporter) doDecl(obj types.Object) { w.value(obj.Type(), obj.Val()) case *types.TypeName: + t := obj.Type() + + if tparam, ok := t.(*typeparams.TypeParam); ok { + w.tag('P') + w.pos(obj.Pos()) + w.typ(tparam.Constraint(), obj.Pkg()) + break + } + if obj.IsAlias() { w.tag('A') w.pos(obj.Pos()) - w.typ(obj.Type(), obj.Pkg()) + w.typ(t, obj.Pkg()) break } // Defined type. - w.tag('T') + named, ok := t.(*types.Named) + if !ok { + panic(internalErrorf("%s is not a defined type", t)) + } + + if typeparams.ForNamed(named).Len() == 0 { + w.tag('T') + } else { + w.tag('U') + } w.pos(obj.Pos()) + if typeparams.ForNamed(named).Len() > 0 { + w.tparamList(typeparams.ForNamed(named), obj.Pkg()) + } + underlying := obj.Type().Underlying() w.typ(underlying, obj.Pkg()) - t := obj.Type() if types.IsInterface(t) { break } - named, ok := t.(*types.Named) - if !ok { - panic(internalErrorf("%s is not a defined type", t)) - } - n := named.NumMethods() w.uint64(uint64(n)) for i := 0; i < n; i++ { @@ -278,6 +364,48 @@ func (w *exportWriter) tag(tag byte) { } func (w *exportWriter) pos(pos token.Pos) { + if iexportVersion >= iexportVersionPosCol { + w.posV1(pos) + } else { + w.posV0(pos) + } +} + +func (w *exportWriter) posV1(pos token.Pos) { + if w.p.fset == nil { + w.int64(0) + return + } + + p := w.p.fset.Position(pos) + file := p.Filename + line := int64(p.Line) + column := int64(p.Column) + + deltaColumn := (column - w.prevColumn) << 1 + deltaLine := (line - w.prevLine) << 1 + + if file != w.prevFile { + deltaLine |= 1 + } + if deltaLine != 0 { + deltaColumn |= 1 + } + + w.int64(deltaColumn) + if deltaColumn&1 != 0 { + w.int64(deltaLine) + if deltaLine&1 != 0 { + w.string(file) + } + } + + w.prevFile = file + w.prevLine = line + w.prevColumn = column +} + +func (w *exportWriter) posV0(pos token.Pos) { if w.p.fset == nil { w.int64(0) return @@ -321,8 +449,7 @@ func (w *exportWriter) pkg(pkg *types.Package) { func (w *exportWriter) qualifiedIdent(obj types.Object) { // Ensure any referenced declarations are written out too. w.p.pushDecl(obj) - - w.string(obj.Name()) + w.string(indexName(obj)) w.pkg(obj.Pkg()) } @@ -358,9 +485,22 @@ func (w *exportWriter) startType(k itag) { func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { switch t := t.(type) { case *types.Named: + if targs := typeparams.NamedTypeArgs(t); targs.Len() > 0 { + w.startType(instanceType) + // TODO(rfindley): investigate if this position is correct, and if it + // matters. + w.pos(t.Obj().Pos()) + w.typeList(targs, pkg) + w.typ(typeparams.NamedTypeOrigin(t), pkg) + return + } w.startType(definedType) w.qualifiedIdent(t.Obj()) + case *typeparams.TypeParam: + w.startType(typeParamType) + w.qualifiedIdent(t.Obj()) + case *types.Pointer: w.startType(pointerType) w.typ(t.Elem(), pkg) @@ -421,9 +561,14 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { n := t.NumEmbeddeds() w.uint64(uint64(n)) for i := 0; i < n; i++ { - f := t.Embedded(i) - w.pos(f.Obj().Pos()) - w.typ(f.Obj().Type(), f.Obj().Pkg()) + ft := t.EmbeddedType(i) + tPkg := pkg + if named, _ := ft.(*types.Named); named != nil { + w.pos(named.Obj().Pos()) + } else { + w.pos(token.NoPos) + } + w.typ(ft, tPkg) } n = t.NumExplicitMethods() @@ -436,6 +581,16 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { w.signature(sig) } + case *typeparams.Union: + w.startType(unionType) + nt := t.Len() + w.uint64(uint64(nt)) + for i := 0; i < nt; i++ { + term := t.Term(i) + w.bool(term.Tilde()) + w.typ(term.Type(), pkg) + } + default: panic(internalErrorf("unexpected type: %v, %v", t, reflect.TypeOf(t))) } @@ -457,6 +612,21 @@ func (w *exportWriter) signature(sig *types.Signature) { } } +func (w *exportWriter) typeList(ts *typeparams.TypeList, pkg *types.Package) { + w.uint64(uint64(ts.Len())) + for i := 0; i < ts.Len(); i++ { + w.typ(ts.At(i), pkg) + } +} + +func (w *exportWriter) tparamList(list *typeparams.TypeParamList, pkg *types.Package) { + ll := uint64(list.Len()) + w.uint64(ll) + for i := 0; i < list.Len(); i++ { + w.typ(list.At(i), pkg) + } +} + func (w *exportWriter) paramList(tup *types.Tuple) { n := tup.Len() w.uint64(uint64(n)) @@ -474,10 +644,10 @@ func (w *exportWriter) param(obj types.Object) { func (w *exportWriter) value(typ types.Type, v constant.Value) { w.typ(typ, nil) - switch v.Kind() { - case constant.Bool: + switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { + case types.IsBoolean: w.bool(constant.BoolVal(v)) - case constant.Int: + case types.IsInteger: var i big.Int if i64, exact := constant.Int64Val(v); exact { i.SetInt64(i64) @@ -487,25 +657,27 @@ func (w *exportWriter) value(typ types.Type, v constant.Value) { i.SetString(v.ExactString(), 10) } w.mpint(&i, typ) - case constant.Float: + case types.IsFloat: f := constantToFloat(v) w.mpfloat(f, typ) - case constant.Complex: + case types.IsComplex: w.mpfloat(constantToFloat(constant.Real(v)), typ) w.mpfloat(constantToFloat(constant.Imag(v)), typ) - case constant.String: + case types.IsString: w.string(constant.StringVal(v)) - case constant.Unknown: - // package contains type errors default: - panic(internalErrorf("unexpected value %v (%T)", v, v)) + if b.Kind() == types.Invalid { + // package contains type errors + break + } + panic(internalErrorf("unexpected type %v (%v)", typ, typ.Underlying())) } } // constantToFloat converts a constant.Value with kind constant.Float to a // big.Float. func constantToFloat(x constant.Value) *big.Float { - assert(x.Kind() == constant.Float) + x = constant.ToFloat(x) // Use the same floating-point precision (512) as cmd/compile // (see Mpprec in cmd/compile/internal/gc/mpfloat.go). const mpprec = 512 @@ -660,7 +832,7 @@ func (w *exportWriter) localIdent(obj types.Object) { return } - name := obj.Name() + name := indexName(obj) if name == "_" { w.string("_") return diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go index a31a8802..1fcc87e5 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go @@ -18,6 +18,8 @@ import ( "go/types" "io" "sort" + + "golang.org/x/tools/internal/typeparams" ) type intReader struct { @@ -41,6 +43,21 @@ func (r *intReader) uint64() uint64 { return i } +// Keep this in sync with constants in iexport.go. +const ( + iexportVersionGo1_11 = 0 + iexportVersionPosCol = 1 + // TODO: before release, change this back to 2. + iexportVersionGenerics = iexportVersionPosCol + + iexportVersionCurrent = iexportVersionGenerics +) + +type ident struct { + pkg string + name string +} + const predeclReserved = 32 type itag uint64 @@ -56,32 +73,63 @@ const ( signatureType structType interfaceType + typeParamType + instanceType + unionType ) // IImportData imports a package from the serialized package data -// and returns the number of bytes consumed and a reference to the package. +// and returns 0 and a reference to the package. // If the export data version is not recognized or the format is otherwise // compromised, an error is returned. -func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { +func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) { + pkgs, err := iimportCommon(fset, imports, data, false, path) + if err != nil { + return 0, nil, err + } + return 0, pkgs[0], nil +} + +// IImportBundle imports a set of packages from the serialized package bundle. +func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) { + return iimportCommon(fset, imports, data, true, "") +} + +func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string) (pkgs []*types.Package, err error) { const currentVersion = 1 version := int64(-1) - defer func() { - if e := recover(); e != nil { - if version > currentVersion { - err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) - } else { - err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) + if !debug { + defer func() { + if e := recover(); e != nil { + if version > currentVersion { + err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) + } else { + err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) + } } - } - }() + }() + } r := &intReader{bytes.NewReader(data), path} + if bundle { + bundleVersion := r.uint64() + switch bundleVersion { + case bundleVersion: + default: + errorf("unknown bundle format version %d", bundleVersion) + } + } + version = int64(r.uint64()) switch version { - case currentVersion, 0: + case /* iexportVersionGenerics, */ iexportVersionPosCol, iexportVersionGo1_11: default: - errorf("unknown iexport format version %d", version) + if version > iexportVersionGenerics { + errorf("unstable iexport format version %d, just rebuild compiler and std library", version) + } else { + errorf("unknown iexport format version %d", version) + } } sLen := int64(r.uint64()) @@ -93,8 +141,9 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] r.Seek(sLen+dLen, io.SeekCurrent) p := iimporter{ - ipath: path, - version: int(version), + exportVersion: version, + ipath: path, + version: int(version), stringData: stringData, stringCache: make(map[uint64]string), @@ -103,6 +152,9 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] declData: declData, pkgIndex: make(map[*types.Package]map[string]uint64), typCache: make(map[uint64]types.Type), + // Separate map for typeparams, keyed by their package and unique + // name (name with subscript). + tparamIndex: make(map[ident]types.Type), fake: fakeFileSet{ fset: fset, @@ -143,48 +195,69 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] p.pkgIndex[pkg] = nameIndex pkgList[i] = pkg } - if len(pkgList) == 0 { - errorf("no packages found for %s", path) - panic("unreachable") + + if bundle { + pkgs = make([]*types.Package, r.uint64()) + for i := range pkgs { + pkg := p.pkgAt(r.uint64()) + imps := make([]*types.Package, r.uint64()) + for j := range imps { + imps[j] = p.pkgAt(r.uint64()) + } + pkg.SetImports(imps) + pkgs[i] = pkg + } + } else { + if len(pkgList) == 0 { + errorf("no packages found for %s", path) + panic("unreachable") + } + pkgs = pkgList[:1] + + // record all referenced packages as imports + list := append(([]*types.Package)(nil), pkgList[1:]...) + sort.Sort(byPath(list)) + pkgs[0].SetImports(list) } - p.ipkg = pkgList[0] - names := make([]string, 0, len(p.pkgIndex[p.ipkg])) - for name := range p.pkgIndex[p.ipkg] { - names = append(names, name) - } - sort.Strings(names) - for _, name := range names { - p.doDecl(p.ipkg, name) + + for _, pkg := range pkgs { + if pkg.Complete() { + continue + } + + names := make([]string, 0, len(p.pkgIndex[pkg])) + for name := range p.pkgIndex[pkg] { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + p.doDecl(pkg, name) + } + + // package was imported completely and without errors + pkg.MarkComplete() } for _, typ := range p.interfaceList { typ.Complete() } - // record all referenced packages as imports - list := append(([]*types.Package)(nil), pkgList[1:]...) - sort.Sort(byPath(list)) - p.ipkg.SetImports(list) - - // package was imported completely and without errors - p.ipkg.MarkComplete() - - consumed, _ := r.Seek(0, io.SeekCurrent) - return int(consumed), p.ipkg, nil + return pkgs, nil } type iimporter struct { - ipath string - ipkg *types.Package - version int + exportVersion int64 + ipath string + version int stringData []byte stringCache map[uint64]string pkgCache map[uint64]*types.Package - declData []byte - pkgIndex map[*types.Package]map[string]uint64 - typCache map[uint64]types.Type + declData []byte + pkgIndex map[*types.Package]map[string]uint64 + typCache map[uint64]types.Type + tparamIndex map[ident]types.Type fake fakeFileSet interfaceList []*types.Interface @@ -227,9 +300,6 @@ func (p *iimporter) pkgAt(off uint64) *types.Package { return pkg } path := p.stringAt(off) - if path == p.ipath { - return p.ipkg - } errorf("missing package %q in %q", path, p.ipath) return nil } @@ -277,17 +347,27 @@ func (r *importReader) obj(name string) { r.declare(types.NewConst(pos, r.currPkg, name, typ, val)) - case 'F': + case 'F', 'G': + var tparams []*typeparams.TypeParam + if tag == 'G' { + tparams = r.tparamList() + } sig := r.signature(nil) - + typeparams.SetForSignature(sig, tparams) r.declare(types.NewFunc(pos, r.currPkg, name, sig)) - case 'T': + case 'T', 'U': // Types can be recursive. We need to setup a stub // declaration before recursing. obj := types.NewTypeName(pos, r.currPkg, name, nil) named := types.NewNamed(obj, nil, nil) + // Declare obj before calling r.tparamList, so the new type name is recognized + // if used in the constraint of one of its own typeparams (see #48280). r.declare(obj) + if tag == 'U' { + tparams := r.tparamList() + typeparams.SetForNamed(named, tparams) + } underlying := r.p.typAt(r.uint64(), named).Underlying() named.SetUnderlying(underlying) @@ -299,10 +379,50 @@ func (r *importReader) obj(name string) { recv := r.param() msig := r.signature(recv) + // If the receiver has any targs, set those as the + // rparams of the method (since those are the + // typeparams being used in the method sig/body). + targs := typeparams.NamedTypeArgs(baseType(msig.Recv().Type())) + if targs.Len() > 0 { + rparams := make([]*typeparams.TypeParam, targs.Len()) + for i := range rparams { + // TODO(rfindley): this is less tolerant than the standard library + // go/internal/gcimporter, which calls under(...) and is tolerant + // of nil rparams. Bring them in sync by making the standard + // library importer stricter. + rparams[i] = targs.At(i).(*typeparams.TypeParam) + } + typeparams.SetRecvTypeParams(msig, rparams) + } + named.AddMethod(types.NewFunc(mpos, r.currPkg, mname, msig)) } } + case 'P': + // We need to "declare" a typeparam in order to have a name that + // can be referenced recursively (if needed) in the type param's + // bound. + if r.p.exportVersion < iexportVersionGenerics { + errorf("unexpected type param type") + } + name0, sub := parseSubscript(name) + tn := types.NewTypeName(pos, r.currPkg, name0, nil) + t := typeparams.NewTypeParam(tn, nil) + if sub == 0 { + errorf("name %q missing subscript", name) + } + + // TODO(rfindley): can we use a different, stable ID? + // t.SetId(sub) + + // To handle recursive references to the typeparam within its + // bound, save the partial type in tparamIndex before reading the bounds. + id := ident{r.currPkg.Name(), name} + r.p.tparamIndex[id] = t + + typeparams.SetTypeParamConstraint(t, r.typ()) + case 'V': typ := r.typ() @@ -435,6 +555,14 @@ func (r *importReader) mpfloat(b *types.Basic) constant.Value { switch { case exp > 0: x = constant.Shift(x, token.SHL, uint(exp)) + // Ensure that the imported Kind is Float, else this constant may run into + // bitsize limits on overlarge integers. Eventually we can instead adopt + // the approach of CL 288632, but that CL relies on go/constant APIs that + // were introduced in go1.13. + // + // TODO(rFindley): sync the logic here with tip Go once we no longer + // support go1.12. + x = constant.ToFloat(x) case exp < 0: d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) x = constant.BinaryOp(x, token.QUO, d) @@ -453,7 +581,7 @@ func (r *importReader) qualifiedIdent() (*types.Package, string) { } func (r *importReader) pos() token.Pos { - if r.p.version >= 1 { + if r.p.exportVersion >= iexportVersionPosCol { r.posv1() } else { r.posv0() @@ -572,6 +700,49 @@ func (r *importReader) doType(base *types.Named) types.Type { typ := newInterface(methods, embeddeds) r.p.interfaceList = append(r.p.interfaceList, typ) return typ + + case typeParamType: + if r.p.exportVersion < iexportVersionGenerics { + errorf("unexpected type param type") + } + pkg, name := r.qualifiedIdent() + id := ident{pkg.Name(), name} + if t, ok := r.p.tparamIndex[id]; ok { + // We're already in the process of importing this typeparam. + return t + } + // Otherwise, import the definition of the typeparam now. + r.p.doDecl(pkg, name) + return r.p.tparamIndex[id] + + case instanceType: + if r.p.exportVersion < iexportVersionGenerics { + errorf("unexpected instantiation type") + } + // pos does not matter for instances: they are positioned on the original + // type. + _ = r.pos() + len := r.uint64() + targs := make([]types.Type, len) + for i := range targs { + targs[i] = r.typ() + } + baseType := r.typ() + // The imported instantiated type doesn't include any methods, so + // we must always use the methods of the base (orig) type. + // TODO provide a non-nil *Environment + t, _ := typeparams.Instantiate(nil, baseType, targs, false) + return t + + case unionType: + if r.p.exportVersion < iexportVersionGenerics { + errorf("unexpected instantiation type") + } + terms := make([]*typeparams.Term, r.uint64()) + for i := range terms { + terms[i] = typeparams.NewTerm(r.bool(), r.typ()) + } + return typeparams.NewUnion(terms) } } @@ -586,6 +757,20 @@ func (r *importReader) signature(recv *types.Var) *types.Signature { return types.NewSignature(recv, params, results, variadic) } +func (r *importReader) tparamList() []*typeparams.TypeParam { + n := r.uint64() + if n == 0 { + return nil + } + xs := make([]*typeparams.TypeParam, n) + for i := range xs { + // Note: the standard library importer is tolerant of nil types here, + // though would panic in SetTypeParams. + xs[i] = r.typ().(*typeparams.TypeParam) + } + return xs +} + func (r *importReader) paramList() *types.Tuple { xs := make([]*types.Var, r.uint64()) for i := range xs { @@ -628,3 +813,33 @@ func (r *importReader) byte() byte { } return x } + +func baseType(typ types.Type) *types.Named { + // pointer receivers are never types.Named types + if p, _ := typ.(*types.Pointer); p != nil { + typ = p.Elem() + } + // receiver base types are always (possibly generic) types.Named types + n, _ := typ.(*types.Named) + return n +} + +func parseSubscript(name string) (string, uint64) { + // Extract the subscript value from the type param name. We export + // and import the subscript value, so that all type params have + // unique names. + sub := uint64(0) + startsub := -1 + for i, r := range name { + if '₀' <= r && r < '₀'+10 { + if startsub == -1 { + startsub = i + } + sub = sub*10 + uint64(r-'₀') + } + } + if startsub >= 0 { + name = name[:startsub] + } + return name, sub +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go index 463f2522..8b163e3d 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !go1.11 // +build !go1.11 package gcimporter diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go index ab28b95c..49984f40 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.11 // +build go1.11 package gcimporter diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go new file mode 100644 index 00000000..817a147e --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go @@ -0,0 +1,16 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !typeparams || !go1.18 +// +build !typeparams !go1.18 + +package gcimporter + +import "go/types" + +const iexportVersion = iexportVersionGo1_11 + +func additionalPredeclared() []types.Type { + return nil +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go new file mode 100644 index 00000000..e6b81fc5 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go @@ -0,0 +1,20 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build typeparams && go1.18 +// +build typeparams,go1.18 + +package gcimporter + +import "go/types" + +const iexportVersion = iexportVersionGenerics + +// additionalPredeclared returns additional predeclared types in go.1.18. +func additionalPredeclared() []types.Type { + return []types.Type{ + // comparable + types.Universe.Lookup("comparable").Type(), + } +} diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go index f4d73b23..18a002f8 100644 --- a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go +++ b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go @@ -22,7 +22,7 @@ func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner * stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv) var goarch, compiler string if rawErr != nil { - if strings.Contains(rawErr.Error(), "cannot find main module") { + if rawErrMsg := rawErr.Error(); strings.Contains(rawErrMsg, "cannot find main module") || strings.Contains(rawErrMsg, "go.mod file not found") { // User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc. // TODO(matloob): Is this a problem in practice? inv.Verb = "env" diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go index 7db1d129..7242a0a7 100644 --- a/vendor/golang.org/x/tools/go/packages/external.go +++ b/vendor/golang.org/x/tools/go/packages/external.go @@ -12,8 +12,8 @@ import ( "bytes" "encoding/json" "fmt" + exec "golang.org/x/sys/execabs" "os" - "os/exec" "strings" ) diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index c83ca097..0e1e7f11 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -13,7 +13,6 @@ import ( "io/ioutil" "log" "os" - "os/exec" "path" "path/filepath" "reflect" @@ -23,8 +22,10 @@ import ( "sync" "unicode" + exec "golang.org/x/sys/execabs" "golang.org/x/tools/go/internal/packagesdriver" "golang.org/x/tools/internal/gocommand" + "golang.org/x/tools/internal/packagesinternal" "golang.org/x/xerrors" ) @@ -413,7 +414,8 @@ type jsonPackage struct { ForTest string // q in a "p [q.test]" package, else "" DepOnly bool - Error *jsonPackageError + Error *packagesinternal.PackageError + DepsErrors []*packagesinternal.PackageError } type jsonPackageError struct { @@ -565,6 +567,7 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse OtherFiles: absJoin(p.Dir, otherFiles(p)...), IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles), forTest: p.ForTest, + depsErrors: p.DepsErrors, Module: p.Module, } @@ -581,7 +584,7 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse // golang/go#38990: go list silently fails to do cgo processing pkg.CompiledGoFiles = nil pkg.Errors = append(pkg.Errors, Error{ - Msg: "go list failed to return CompiledGoFiles; https://golang.org/issue/38990?", + Msg: "go list failed to return CompiledGoFiles. This may indicate failure to perform cgo processing; try building at the command line. See https://golang.org/issue/38990.", Kind: ListError, }) } @@ -865,7 +868,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, if gocmdRunner == nil { gocmdRunner = &gocommand.Runner{} } - stdout, stderr, _, err := gocmdRunner.RunRaw(cfg.Context, inv) + stdout, stderr, friendlyErr, err := gocmdRunner.RunRaw(cfg.Context, inv) if err != nil { // Check for 'go' executable not being found. if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound { @@ -886,7 +889,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, // Related to #24854 if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "unexpected directory layout") { - return nil, fmt.Errorf("%s", stderr.String()) + return nil, friendlyErr } // Is there an error running the C compiler in cgo? This will be reported in the "Error" field @@ -999,7 +1002,7 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, // TODO(matloob): Remove these once we can depend on go list to exit with a zero status with -e even when // packages don't exist or a build fails. if !usesExportData(cfg) && !containsGoFile(args) { - return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr) + return nil, friendlyErr } } return stdout, nil diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go index de2c1dc5..9576b472 100644 --- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -9,7 +9,6 @@ import ( "fmt" "go/parser" "go/token" - "log" "os" "path/filepath" "regexp" @@ -35,9 +34,12 @@ func (state *golistState) processGolistOverlay(response *responseDeduper) (modif // This is an approximation of import path to id. This can be // wrong for tests, vendored packages, and a number of other cases. havePkgs[pkg.PkgPath] = pkg.ID - x := commonDir(pkg.GoFiles) - if x != "" { - pkgOfDir[x] = append(pkgOfDir[x], pkg) + dir, err := commonDir(pkg.GoFiles) + if err != nil { + return nil, nil, err + } + if dir != "" { + pkgOfDir[dir] = append(pkgOfDir[dir], pkg) } } @@ -441,20 +443,21 @@ func extractPackageName(filename string, contents []byte) (string, bool) { return f.Name.Name, true } -func commonDir(a []string) string { +// commonDir returns the directory that all files are in, "" if files is empty, +// or an error if they aren't in the same directory. +func commonDir(files []string) (string, error) { seen := make(map[string]bool) - x := append([]string{}, a...) - for _, f := range x { + for _, f := range files { seen[filepath.Dir(f)] = true } if len(seen) > 1 { - log.Fatalf("commonDir saw %v for %v", seen, x) + return "", fmt.Errorf("files (%v) are in more than one directory: %v", files, seen) } for k := range seen { - // len(seen) == 1 - return k + // seen has only one element; return it. + return k, nil } - return "" // no files + return "", nil // no files } // It is possible that the files in the disk directory dir have a different package diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index 38475e87..8a1a2d68 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -339,6 +339,9 @@ type Package struct { // forTest is the package under test, if any. forTest string + // depsErrors is the DepsErrors field from the go list response, if any. + depsErrors []*packagesinternal.PackageError + // module is the module information for the package if it exists. Module *Module } @@ -366,6 +369,9 @@ func init() { packagesinternal.GetForTest = func(p interface{}) string { return p.(*Package).forTest } + packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError { + return p.(*Package).depsErrors + } packagesinternal.GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return config.(*Config).gocmdRunner } diff --git a/vendor/golang.org/x/tools/go/packages/visit.go b/vendor/golang.org/x/tools/go/packages/visit.go index b13cb081..a1dcc40b 100644 --- a/vendor/golang.org/x/tools/go/packages/visit.go +++ b/vendor/golang.org/x/tools/go/packages/visit.go @@ -1,3 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package packages import ( diff --git a/vendor/golang.org/x/tools/internal/event/label/label.go b/vendor/golang.org/x/tools/internal/event/label/label.go index b55c12eb..0f526e1f 100644 --- a/vendor/golang.org/x/tools/internal/event/label/label.go +++ b/vendor/golang.org/x/tools/internal/event/label/label.go @@ -96,6 +96,8 @@ func Of64(k Key, v uint64) Label { return Label{key: k, packed: v} } // access should be done with the From method of the key. func (t Label) Unpack64() uint64 { return t.packed } +type stringptr unsafe.Pointer + // OfString creates a new label from a key and a string. // This method is for implementing new key types, label creation should // normally be done with the Of method of the key. @@ -104,7 +106,7 @@ func OfString(k Key, v string) Label { return Label{ key: k, packed: uint64(hdr.Len), - untyped: unsafe.Pointer(hdr.Data), + untyped: stringptr(hdr.Data), } } @@ -115,9 +117,9 @@ func OfString(k Key, v string) Label { func (t Label) UnpackString() string { var v string hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) - hdr.Data = uintptr(t.untyped.(unsafe.Pointer)) + hdr.Data = uintptr(t.untyped.(stringptr)) hdr.Len = int(t.packed) - return *(*string)(unsafe.Pointer(hdr)) + return v } // Valid returns true if the Label is a valid one (it has a key). diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go index f65aad4e..8659a0c5 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/invoke.go +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -9,9 +9,9 @@ import ( "bytes" "context" "fmt" + exec "golang.org/x/sys/execabs" "io" "os" - "os/exec" "regexp" "strconv" "strings" diff --git a/vendor/golang.org/x/tools/internal/gocommand/vendor.go b/vendor/golang.org/x/tools/internal/gocommand/vendor.go index 1cd8d847..5e75bd6d 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/vendor.go +++ b/vendor/golang.org/x/tools/internal/gocommand/vendor.go @@ -12,6 +12,7 @@ import ( "path/filepath" "regexp" "strings" + "time" "golang.org/x/mod/semver" ) @@ -19,11 +20,15 @@ import ( // ModuleJSON holds information about a module. type ModuleJSON struct { Path string // module path + Version string // module version + Versions []string // available module versions (with -versions) Replace *ModuleJSON // replaced by this module + Time *time.Time // time version was created + Update *ModuleJSON // available update, if any (with -u) Main bool // is this the main module? Indirect bool // is this module only an indirect dependency of main module? Dir string // directory holding files for this module, if any - GoMod string // path to go.mod file for this module, if any + GoMod string // path to go.mod file used when loading this module, if any GoVersion string // go version used in module } diff --git a/vendor/golang.org/x/tools/internal/gocommand/version.go b/vendor/golang.org/x/tools/internal/gocommand/version.go index 60d45ac0..71304368 100644 --- a/vendor/golang.org/x/tools/internal/gocommand/version.go +++ b/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -14,11 +14,22 @@ import ( // It returns the X in Go 1.X. func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { inv.Verb = "list" - inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`} + inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`} inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off") - // Unset any unneeded flags. + // Unset any unneeded flags, and remove them from BuildFlags, if they're + // present. inv.ModFile = "" inv.ModFlag = "" + var buildFlags []string + for _, flag := range inv.BuildFlags { + // Flags can be prefixed by one or two dashes. + f := strings.TrimPrefix(strings.TrimPrefix(flag, "-"), "-") + if strings.HasPrefix(f, "mod=") || strings.HasPrefix(f, "modfile=") { + continue + } + buildFlags = append(buildFlags, flag) + } + inv.BuildFlags = buildFlags stdoutBytes, err := r.Run(ctx, inv) if err != nil { return 0, err diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go index 1335a5ee..9702094c 100644 --- a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go +++ b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -1,3 +1,7 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + // Package packagesinternal exposes internal-only fields from go/packages. package packagesinternal @@ -6,6 +10,13 @@ import ( ) var GetForTest = func(p interface{}) string { return "" } +var GetDepsErrors = func(p interface{}) []*PackageError { return nil } + +type PackageError struct { + ImportStack []string // shortest path from package named on command line to this one + Pos string // position of error (if present, file:line:col) + Err string // the error itself +} var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil } diff --git a/vendor/golang.org/x/tools/internal/typeparams/common.go b/vendor/golang.org/x/tools/internal/typeparams/common.go new file mode 100644 index 00000000..9fc6b4be --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/common.go @@ -0,0 +1,25 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package typeparams provides functions to work indirectly with type parameter +// data stored in go/ast and go/types objects, while these API are guarded by a +// build constraint. +// +// This package exists to make it easier for tools to work with generic code, +// while also compiling against older Go versions. +package typeparams + +import ( + "go/ast" + "go/token" +) + +// A IndexExprData holds data from both ast.IndexExpr and the new +// ast.MultiIndexExpr, which was introduced in Go 1.18. +type IndexExprData struct { + X ast.Expr // expression + Lbrack token.Pos // position of "[" + Indices []ast.Expr // index expressions + Rbrack token.Pos // position of "]" +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go new file mode 100644 index 00000000..72d010e5 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go @@ -0,0 +1,12 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !typeparams || !go1.18 +// +build !typeparams !go1.18 + +package typeparams + +// Enabled reports whether type parameters are enabled in the current build +// environment. +const Enabled = false diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go new file mode 100644 index 00000000..642fc8ee --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go @@ -0,0 +1,15 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build typeparams && go1.18 +// +build typeparams,go1.18 + +package typeparams + +// Note: this constant is in a separate file as this is the only acceptable +// diff between the <1.18 API of this package and the 1.18 API. + +// Enabled reports whether type parameters are enabled in the current build +// environment. +const Enabled = true diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go new file mode 100644 index 00000000..12817af8 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go @@ -0,0 +1,177 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !typeparams || !go1.18 +// +build !typeparams !go1.18 + +package typeparams + +import ( + "go/ast" + "go/types" +) + +func unsupported() { + panic("type parameters are unsupported at this go version") +} + +// GetIndexExprData extracts data from *ast.IndexExpr nodes. +// For other nodes, GetIndexExprData returns nil. +func GetIndexExprData(n ast.Node) *IndexExprData { + if e, _ := n.(*ast.IndexExpr); e != nil { + return &IndexExprData{ + X: e.X, + Lbrack: e.Lbrack, + Indices: []ast.Expr{e.Index}, + Rbrack: e.Rbrack, + } + } + return nil +} + +// ForTypeSpec returns an empty field list, as type parameters on not supported +// at this Go version. +func ForTypeSpec(*ast.TypeSpec) *ast.FieldList { + return nil +} + +// ForFuncType returns an empty field list, as type parameters are not +// supported at this Go version. +func ForFuncType(*ast.FuncType) *ast.FieldList { + return nil +} + +// TypeParam is a placeholder type, as type parameters are not supported at +// this Go version. Its methods panic on use. +type TypeParam struct{ types.Type } + +func (*TypeParam) Constraint() types.Type { unsupported(); return nil } +func (*TypeParam) Obj() *types.TypeName { unsupported(); return nil } + +// TypeParamList is a placeholder for an empty type parameter list. +type TypeParamList struct{} + +func (*TypeParamList) Len() int { return 0 } +func (*TypeParamList) At(int) *TypeParam { unsupported(); return nil } + +// TypeList is a placeholder for an empty type list. +type TypeList struct{} + +func (*TypeList) Len() int { return 0 } +func (*TypeList) At(int) types.Type { unsupported(); return nil } + +// NewTypeParam is unsupported at this Go version, and panics. +func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam { + unsupported() + return nil +} + +// SetTypeParamConstraint is unsupported at this Go version, and panics. +func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { + unsupported() +} + +// ForSignature returns an empty slice. +func ForSignature(*types.Signature) *TypeParamList { + return nil +} + +// SetForSignature panics if tparams is non-empty. +func SetForSignature(_ *types.Signature, tparams []*TypeParam) { + if len(tparams) > 0 { + unsupported() + } +} + +// RecvTypeParams returns a nil slice. +func RecvTypeParams(sig *types.Signature) *TypeParamList { + return nil +} + +// SetRecvTypeParams panics if rparams is non-empty. +func SetRecvTypeParams(sig *types.Signature, rparams []*TypeParam) { + if len(rparams) > 0 { + unsupported() + } +} + +// IsComparable returns false, as no interfaces are type-restricted at this Go +// version. +func IsComparable(*types.Interface) bool { + return false +} + +// IsConstraint returns false, as no interfaces are type-restricted at this Go +// version. +func IsConstraint(*types.Interface) bool { + return false +} + +// ForNamed returns an empty type parameter list, as type parameters are not +// supported at this Go version. +func ForNamed(*types.Named) *TypeParamList { + return nil +} + +// SetForNamed panics if tparams is non-empty. +func SetForNamed(_ *types.Named, tparams []*TypeParam) { + if len(tparams) > 0 { + unsupported() + } +} + +// NamedTypeArgs returns nil. +func NamedTypeArgs(*types.Named) *TypeList { + return nil +} + +// NamedTypeOrigin is the identity method at this Go version. +func NamedTypeOrigin(named *types.Named) types.Type { + return named +} + +// Term is a placeholder type, as type parameters are not supported at this Go +// version. Its methods panic on use. +type Term struct{} + +func (*Term) Tilde() bool { unsupported(); return false } +func (*Term) Type() types.Type { unsupported(); return nil } +func (*Term) String() string { unsupported(); return "" } +func (*Term) Underlying() types.Type { unsupported(); return nil } + +// NewTerm is unsupported at this Go version, and panics. +func NewTerm(tilde bool, typ types.Type) *Term { + unsupported() + return nil +} + +// Union is a placeholder type, as type parameters are not supported at this Go +// version. Its methods panic on use. +type Union struct{ types.Type } + +func (*Union) Len() int { return 0 } +func (*Union) Term(i int) *Term { unsupported(); return nil } + +// NewUnion is unsupported at this Go version, and panics. +func NewUnion(terms []*Term) *Union { + unsupported() + return nil +} + +// InitInstanceInfo is a noop at this Go version. +func InitInstanceInfo(*types.Info) {} + +// GetInstance returns nothing, as type parameters are not supported at this Go +// version. +func GetInstance(*types.Info, *ast.Ident) (*TypeList, types.Type) { return nil, nil } + +// Environment is a placeholder type, as type parameters are not supported at +// this Go version. +type Environment struct{} + +// Instantiate is unsupported on this Go version, and panics. +func Instantiate(env *Environment, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { + unsupported() + return nil, nil +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go new file mode 100644 index 00000000..8ab17b77 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go @@ -0,0 +1,165 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build typeparams && go1.18 +// +build typeparams,go1.18 + +package typeparams + +import ( + "go/ast" + "go/types" +) + +// GetIndexExprData extracts data from AST nodes that represent index +// expressions. +// +// For an ast.IndexExpr, the resulting IndexExprData will have exactly one +// index expression. For an ast.IndexListExpr (go1.18+), it may have a +// variable number of index expressions. +// +// For nodes that don't represent index expressions, GetIndexExprData returns +// nil. +func GetIndexExprData(n ast.Node) *IndexExprData { + switch e := n.(type) { + case *ast.IndexExpr: + return &IndexExprData{ + X: e.X, + Lbrack: e.Lbrack, + Indices: []ast.Expr{e.Index}, + Rbrack: e.Rbrack, + } + case *ast.IndexListExpr: + return (*IndexExprData)(e) + } + return nil +} + +// ForTypeSpec returns n.TypeParams. +func ForTypeSpec(n *ast.TypeSpec) *ast.FieldList { + if n == nil { + return nil + } + return n.TypeParams +} + +// ForFuncType returns n.TypeParams. +func ForFuncType(n *ast.FuncType) *ast.FieldList { + if n == nil { + return nil + } + return n.TypeParams +} + +// TypeParam is an alias for types.TypeParam +type TypeParam = types.TypeParam + +// TypeParamList is an alias for types.TypeParamList +type TypeParamList = types.TypeParamList + +// TypeList is an alias for types.TypeList +type TypeList = types.TypeList + +// NewTypeParam calls types.NewTypeParam. +func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam { + return types.NewTypeParam(name, constraint) +} + +// SetTypeParamConstraint calls tparam.SetConstraint(constraint). +func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { + tparam.SetConstraint(constraint) +} + +// ForSignature returns sig.TypeParams() +func ForSignature(sig *types.Signature) *TypeParamList { + return sig.TypeParams() +} + +// SetForSignature calls sig.SetTypeParams(tparams) +func SetForSignature(sig *types.Signature, tparams []*TypeParam) { + sig.SetTypeParams(tparams) +} + +// RecvTypeParams returns sig.RecvTypeParams(). +func RecvTypeParams(sig *types.Signature) *TypeParamList { + return sig.RecvTypeParams() +} + +// SetRecvTypeParams calls sig.SetRecvTypeParams(rparams). +func SetRecvTypeParams(sig *types.Signature, rparams []*TypeParam) { + sig.SetRecvTypeParams(rparams) +} + +// IsComparable calls iface.IsComparable(). +func IsComparable(iface *types.Interface) bool { + return iface.IsComparable() +} + +// IsConstraint calls iface.IsConstraint(). +func IsConstraint(iface *types.Interface) bool { + return iface.IsConstraint() +} + +// ForNamed extracts the (possibly empty) type parameter object list from +// named. +func ForNamed(named *types.Named) *TypeParamList { + return named.TypeParams() +} + +// SetForNamed sets the type params tparams on n. Each tparam must be of +// dynamic type *types.TypeParam. +func SetForNamed(n *types.Named, tparams []*TypeParam) { + n.SetTypeParams(tparams) +} + +// NamedTypeArgs returns named.TypeArgs(). +func NamedTypeArgs(named *types.Named) *TypeList { + return named.TypeArgs() +} + +// NamedTypeOrigin returns named.Orig(). +func NamedTypeOrigin(named *types.Named) types.Type { + return named.Origin() +} + +// Term is an alias for types.Term. +type Term = types.Term + +// NewTerm calls types.NewTerm. +func NewTerm(tilde bool, typ types.Type) *Term { + return types.NewTerm(tilde, typ) +} + +// Union is an alias for types.Union +type Union = types.Union + +// NewUnion calls types.NewUnion. +func NewUnion(terms []*Term) *Union { + return types.NewUnion(terms) +} + +// InitInstanceInfo initializes info to record information about type and +// function instances. +func InitInstanceInfo(info *types.Info) { + info.Instances = make(map[*ast.Ident]types.Instance) +} + +// GetInstance extracts information about the instantiation occurring at the +// identifier id. id should be the identifier denoting a parameterized type or +// function in an instantiation expression or function call. +func GetInstance(info *types.Info, id *ast.Ident) (*TypeList, types.Type) { + if info.Instances != nil { + inf := info.Instances[id] + return inf.TypeArgs, inf.Type + } + return nil, nil +} + +// Environment is an alias for types.Environment. +type Environment = types.Environment + +// Instantiate calls types.Instantiate. +func Instantiate(env *Environment, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { + return types.Instantiate(env, typ, targs, validate) +} diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go index 65473eb2..fa2834e2 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go @@ -1209,6 +1209,16 @@ const ( // } InvalidTypeSwitch + // InvalidExprSwitch occurs when a switch expression is not comparable. + // + // Example: + // func _() { + // var a struct{ _ func() } + // switch a /* ERROR cannot switch on a */ { + // } + // } + InvalidExprSwitch + /* control flow > select */ // InvalidSelectCase occurs when a select case is not a channel send or diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go index 97f3ec89..3e5842a5 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go @@ -124,24 +124,25 @@ func _() { _ = x[DuplicateDefault-114] _ = x[BadTypeKeyword-115] _ = x[InvalidTypeSwitch-116] - _ = x[InvalidSelectCase-117] - _ = x[UndeclaredLabel-118] - _ = x[DuplicateLabel-119] - _ = x[MisplacedLabel-120] - _ = x[UnusedLabel-121] - _ = x[JumpOverDecl-122] - _ = x[JumpIntoBlock-123] - _ = x[InvalidMethodExpr-124] - _ = x[WrongArgCount-125] - _ = x[InvalidCall-126] - _ = x[UnusedResults-127] - _ = x[InvalidDefer-128] - _ = x[InvalidGo-129] + _ = x[InvalidExprSwitch-117] + _ = x[InvalidSelectCase-118] + _ = x[UndeclaredLabel-119] + _ = x[DuplicateLabel-120] + _ = x[MisplacedLabel-121] + _ = x[UnusedLabel-122] + _ = x[JumpOverDecl-123] + _ = x[JumpIntoBlock-124] + _ = x[InvalidMethodExpr-125] + _ = x[WrongArgCount-126] + _ = x[InvalidCall-127] + _ = x[UnusedResults-128] + _ = x[InvalidDefer-129] + _ = x[InvalidGo-130] } -const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo" +const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidExprSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo" -var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1747, 1761, 1775, 1786, 1798, 1811, 1828, 1841, 1852, 1865, 1877, 1886} +var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1749, 1764, 1778, 1792, 1803, 1815, 1828, 1845, 1858, 1869, 1882, 1894, 1903} func (i ErrorCode) String() string { i -= 1 diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go index c3e1a397..7c77c2fb 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/types.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -30,10 +30,15 @@ func SetUsesCgo(conf *types.Config) bool { return true } -func ReadGo116ErrorData(terr types.Error) (ErrorCode, token.Pos, token.Pos, bool) { +// ReadGo116ErrorData extracts additional information from types.Error values +// generated by Go version 1.16 and later: the error code, start position, and +// end position. If all positions are valid, start <= err.Pos <= end. +// +// If the data could not be read, the final result parameter will be false. +func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) { var data [3]int // By coincidence all of these fields are ints, which simplifies things. - v := reflect.ValueOf(terr) + v := reflect.ValueOf(err) for i, name := range []string{"go116code", "go116start", "go116end"} { f := v.FieldByName(name) if !f.IsValid() { diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go index cab95a42..179d6e8f 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go @@ -6,7 +6,6 @@ package prototext import ( "fmt" - "strings" "unicode/utf8" "google.golang.org/protobuf/internal/encoding/messageset" @@ -23,6 +22,7 @@ import ( ) // Unmarshal reads the given []byte into the given proto.Message. +// The provided message must be mutable (e.g., a non-nil pointer to a message). func Unmarshal(b []byte, m proto.Message) error { return UnmarshalOptions{}.Unmarshal(b, m) } @@ -51,8 +51,9 @@ type UnmarshalOptions struct { } } -// Unmarshal reads the given []byte and populates the given proto.Message using options in -// UnmarshalOptions object. +// Unmarshal reads the given []byte and populates the given proto.Message +// using options in the UnmarshalOptions object. +// The provided message must be mutable (e.g., a non-nil pointer to a message). func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error { return o.unmarshal(b, m) } @@ -158,21 +159,11 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error { switch tok.NameKind() { case text.IdentName: name = pref.Name(tok.IdentName()) - fd = fieldDescs.ByName(name) - if fd == nil { - // The proto name of a group field is in all lowercase, - // while the textproto field name is the group message name. - gd := fieldDescs.ByName(pref.Name(strings.ToLower(string(name)))) - if gd != nil && gd.Kind() == pref.GroupKind && gd.Message().Name() == name { - fd = gd - } - } else if fd.Kind() == pref.GroupKind && fd.Message().Name() != name { - fd = nil // reset since field name is actually the message name - } + fd = fieldDescs.ByTextName(string(name)) case text.TypeName: // Handle extensions only. This code path is not for Any. - xt, xtErr = d.findExtension(pref.FullName(tok.TypeName())) + xt, xtErr = d.opts.Resolver.FindExtensionByName(pref.FullName(tok.TypeName())) case text.FieldNumber: isFieldNumberName = true @@ -269,15 +260,6 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error { return nil } -// findExtension returns protoreflect.ExtensionType from the Resolver if found. -func (d decoder) findExtension(xtName pref.FullName) (pref.ExtensionType, error) { - xt, err := d.opts.Resolver.FindExtensionByName(xtName) - if err == nil { - return xt, nil - } - return messageset.FindMessageSetExtension(d.opts.Resolver, xtName) -} - // unmarshalSingular unmarshals a non-repeated field value specified by the // given FieldDescriptor. func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error { @@ -762,9 +744,6 @@ func (d decoder) skipValue() error { // Skip items. This will not validate whether skipped values are // of the same type or not, same behavior as C++ // TextFormat::Parser::AllowUnknownField(true) version 3.8.0. - if err := d.skipValue(); err != nil { - return err - } } } } diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go index 0877d71c..8d5304dc 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go @@ -6,7 +6,6 @@ package prototext import ( "fmt" - "sort" "strconv" "unicode/utf8" @@ -16,10 +15,11 @@ import ( "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/flags" "google.golang.org/protobuf/internal/genid" - "google.golang.org/protobuf/internal/mapsort" + "google.golang.org/protobuf/internal/order" "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/internal/strs" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" pref "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" ) @@ -169,35 +169,15 @@ func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error { // If unable to expand, continue on to marshal Any as a regular message. } - // Marshal known fields. - fieldDescs := messageDesc.Fields() - size := fieldDescs.Len() - for i := 0; i < size; { - fd := fieldDescs.Get(i) - if od := fd.ContainingOneof(); od != nil { - fd = m.WhichOneof(od) - i += od.Fields().Len() - } else { - i++ + // Marshal fields. + var err error + order.RangeFields(m, order.IndexNameFieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + if err = e.marshalField(fd.TextName(), v, fd); err != nil { + return false } - - if fd == nil || !m.Has(fd) { - continue - } - - name := fd.Name() - // Use type name for group field name. - if fd.Kind() == pref.GroupKind { - name = fd.Message().Name() - } - val := m.Get(fd) - if err := e.marshalField(string(name), val, fd); err != nil { - return err - } - } - - // Marshal extensions. - if err := e.marshalExtensions(m); err != nil { + return true + }) + if err != nil { return err } @@ -290,7 +270,7 @@ func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescripto // marshalMap marshals the given protoreflect.Map as multiple name-value fields. func (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error { var err error - mapsort.Range(mmap, fd.MapKey().Kind(), func(key pref.MapKey, val pref.Value) bool { + order.RangeEntries(mmap, order.GenericKeyOrder, func(key pref.MapKey, val pref.Value) bool { e.WriteName(name) e.StartMessage() defer e.EndMessage() @@ -311,48 +291,6 @@ func (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) return err } -// marshalExtensions marshals extension fields. -func (e encoder) marshalExtensions(m pref.Message) error { - type entry struct { - key string - value pref.Value - desc pref.FieldDescriptor - } - - // Get a sorted list based on field key first. - var entries []entry - m.Range(func(fd pref.FieldDescriptor, v pref.Value) bool { - if !fd.IsExtension() { - return true - } - // For MessageSet extensions, the name used is the parent message. - name := fd.FullName() - if messageset.IsMessageSetExtension(fd) { - name = name.Parent() - } - entries = append(entries, entry{ - key: string(name), - value: v, - desc: fd, - }) - return true - }) - // Sort extensions lexicographically. - sort.Slice(entries, func(i, j int) bool { - return entries[i].key < entries[j].key - }) - - // Write out sorted list. - for _, entry := range entries { - // Extension field name is the proto field name enclosed in []. - name := "[" + entry.key + "]" - if err := e.marshalField(name, entry.value, entry.desc); err != nil { - return err - } - } - return nil -} - // marshalUnknown parses the given []byte and marshals fields out. // This function assumes proper encoding in the given []byte. func (e encoder) marshalUnknown(b []byte) { diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go index e7af0fe0..360c6332 100644 --- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +++ b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go @@ -42,6 +42,8 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string { name = "FileImports" case pref.Descriptor: name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s" + default: + name = reflect.ValueOf(vs).Elem().Type().Name() } start, end = name+"{", "}" } diff --git a/vendor/google.golang.org/protobuf/internal/detrand/rand.go b/vendor/google.golang.org/protobuf/internal/detrand/rand.go index a904dd1f..49c8676d 100644 --- a/vendor/google.golang.org/protobuf/internal/detrand/rand.go +++ b/vendor/google.golang.org/protobuf/internal/detrand/rand.go @@ -26,6 +26,14 @@ func Bool() bool { return randSeed%2 == 1 } +// Intn returns a deterministically random integer between 0 and n-1, inclusive. +func Intn(n int) int { + if n <= 0 { + panic("must be positive") + } + return int(randSeed % uint64(n)) +} + // randSeed is a best-effort at an approximate hash of the Go binary. var randSeed = binaryHash() diff --git a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go b/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go index b1eeea50..c1866f3c 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go @@ -11,10 +11,9 @@ import ( "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/errors" pref "google.golang.org/protobuf/reflect/protoreflect" - preg "google.golang.org/protobuf/reflect/protoregistry" ) -// The MessageSet wire format is equivalent to a message defiend as follows, +// The MessageSet wire format is equivalent to a message defined as follows, // where each Item defines an extension field with a field number of 'type_id' // and content of 'message'. MessageSet extensions must be non-repeated message // fields. @@ -48,33 +47,17 @@ func IsMessageSet(md pref.MessageDescriptor) bool { return ok && xmd.IsMessageSet() } -// IsMessageSetExtension reports this field extends a MessageSet. +// IsMessageSetExtension reports this field properly extends a MessageSet. func IsMessageSetExtension(fd pref.FieldDescriptor) bool { - if fd.Name() != ExtensionName { + switch { + case fd.Name() != ExtensionName: + return false + case !IsMessageSet(fd.ContainingMessage()): + return false + case fd.FullName().Parent() != fd.Message().FullName(): return false } - if fd.FullName().Parent() != fd.Message().FullName() { - return false - } - return IsMessageSet(fd.ContainingMessage()) -} - -// FindMessageSetExtension locates a MessageSet extension field by name. -// In text and JSON formats, the extension name used is the message itself. -// The extension field name is derived by appending ExtensionName. -func FindMessageSetExtension(r preg.ExtensionTypeResolver, s pref.FullName) (pref.ExtensionType, error) { - name := s.Append(ExtensionName) - xt, err := r.FindExtensionByName(name) - if err != nil { - if err == preg.NotFound { - return nil, err - } - return nil, errors.Wrap(err, "%q", name) - } - if !IsMessageSetExtension(xt.TypeDescriptor()) { - return nil, preg.NotFound - } - return xt, nil + return true } // SizeField returns the size of a MessageSet item field containing an extension diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go index 16c02d7b..38f1931c 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go @@ -104,7 +104,7 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p case strings.HasPrefix(s, "json="): jsonName := s[len("json="):] if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) { - f.L1.JSONName.Init(jsonName) + f.L1.StringName.InitJSON(jsonName) } case s == "packed": f.L1.HasPacked = true diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go index c4ba1c59..da289ccc 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go @@ -32,7 +32,6 @@ type Encoder struct { encoderState indent string - newline string // set to "\n" if len(indent) > 0 delims [2]byte outputASCII bool } @@ -61,7 +60,6 @@ func NewEncoder(indent string, delims [2]byte, outputASCII bool) (*Encoder, erro return nil, errors.New("indent may only be composed of space and tab characters") } e.indent = indent - e.newline = "\n" } switch delims { case [2]byte{0, 0}: @@ -126,7 +124,7 @@ func appendString(out []byte, in string, outputASCII bool) []byte { // are used to represent both the proto string and bytes type. r = rune(in[0]) fallthrough - case r < ' ' || r == '"' || r == '\\': + case r < ' ' || r == '"' || r == '\\' || r == 0x7f: out = append(out, '\\') switch r { case '"', '\\': @@ -143,7 +141,7 @@ func appendString(out []byte, in string, outputASCII bool) []byte { out = strconv.AppendUint(out, uint64(r), 16) } in = in[n:] - case outputASCII && r >= utf8.RuneSelf: + case r >= utf8.RuneSelf && (outputASCII || r <= 0x009f): out = append(out, '\\') if r <= math.MaxUint16 { out = append(out, 'u') @@ -168,7 +166,7 @@ func appendString(out []byte, in string, outputASCII bool) []byte { // escaping. If no characters need escaping, this returns the input length. func indexNeedEscapeInString(s string) int { for i := 0; i < len(s); i++ { - if c := s[i]; c < ' ' || c == '"' || c == '\'' || c == '\\' || c >= utf8.RuneSelf { + if c := s[i]; c < ' ' || c == '"' || c == '\'' || c == '\\' || c >= 0x7f { return i } } @@ -265,3 +263,8 @@ func (e *Encoder) Snapshot() encoderState { func (e *Encoder) Reset(es encoderState) { e.encoderState = es } + +// AppendString appends the escaped form of the input string to b. +func AppendString(b []byte, s string) []byte { + return appendString(b, s, false) +} diff --git a/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go b/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go deleted file mode 100644 index 517c4e2a..00000000 --- a/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fieldsort defines an ordering of fields. -// -// The ordering defined by this package matches the historic behavior of the proto -// package, placing extensions first and oneofs last. -// -// There is no guarantee about stability of the wire encoding, and users should not -// depend on the order defined in this package as it is subject to change without -// notice. -package fieldsort - -import ( - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Less returns true if field a comes before field j in ordered wire marshal output. -func Less(a, b protoreflect.FieldDescriptor) bool { - ea := a.IsExtension() - eb := b.IsExtension() - oa := a.ContainingOneof() - ob := b.ContainingOneof() - switch { - case ea != eb: - return ea - case oa != nil && ob != nil: - if oa == ob { - return a.Number() < b.Number() - } - return oa.Index() < ob.Index() - case oa != nil && !oa.IsSynthetic(): - return false - case ob != nil && !ob.IsSynthetic(): - return true - default: - return a.Number() < b.Number() - } -} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/build.go b/vendor/google.golang.org/protobuf/internal/filedesc/build.go index d02d770c..b293b694 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/build.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/build.go @@ -3,6 +3,9 @@ // license that can be found in the LICENSE file. // Package filedesc provides functionality for constructing descriptors. +// +// The types in this package implement interfaces in the protoreflect package +// related to protobuf descripriptors. package filedesc import ( diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index 9385126f..98ab142a 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -13,6 +13,7 @@ import ( "google.golang.org/protobuf/internal/descfmt" "google.golang.org/protobuf/internal/descopts" "google.golang.org/protobuf/internal/encoding/defval" + "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/genid" "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/internal/strs" @@ -99,15 +100,6 @@ func (fd *File) lazyInitOnce() { fd.mu.Unlock() } -// ProtoLegacyRawDesc is a pseudo-internal API for allowing the v1 code -// to be able to retrieve the raw descriptor. -// -// WARNING: This method is exempt from the compatibility promise and may be -// removed in the future without warning. -func (fd *File) ProtoLegacyRawDesc() []byte { - return fd.builder.RawDescriptor -} - // GoPackagePath is a pseudo-internal API for determining the Go package path // that this file descriptor is declared in. // @@ -207,7 +199,7 @@ type ( Number pref.FieldNumber Cardinality pref.Cardinality // must be consistent with Message.RequiredNumbers Kind pref.Kind - JSONName jsonName + StringName stringName IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto IsWeak bool // promoted from google.protobuf.FieldOptions HasPacked bool // promoted from google.protobuf.FieldOptions @@ -277,8 +269,9 @@ func (fd *Field) Options() pref.ProtoMessage { func (fd *Field) Number() pref.FieldNumber { return fd.L1.Number } func (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality } func (fd *Field) Kind() pref.Kind { return fd.L1.Kind } -func (fd *Field) HasJSONName() bool { return fd.L1.JSONName.has } -func (fd *Field) JSONName() string { return fd.L1.JSONName.get(fd) } +func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON } +func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) } +func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) } func (fd *Field) HasPresence() bool { return fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil) } @@ -373,7 +366,7 @@ type ( } ExtensionL2 struct { Options func() pref.ProtoMessage - JSONName jsonName + StringName stringName IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto IsPacked bool // promoted from google.protobuf.FieldOptions Default defaultValue @@ -391,8 +384,9 @@ func (xd *Extension) Options() pref.ProtoMessage { func (xd *Extension) Number() pref.FieldNumber { return xd.L1.Number } func (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality } func (xd *Extension) Kind() pref.Kind { return xd.L1.Kind } -func (xd *Extension) HasJSONName() bool { return xd.lazyInit().JSONName.has } -func (xd *Extension) JSONName() string { return xd.lazyInit().JSONName.get(xd) } +func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON } +func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) } +func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) } func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != pref.Repeated } func (xd *Extension) HasOptionalKeyword() bool { return (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional @@ -506,27 +500,50 @@ func (d *Base) Syntax() pref.Syntax { return d.L0.ParentFile.Syn func (d *Base) IsPlaceholder() bool { return false } func (d *Base) ProtoInternal(pragma.DoNotImplement) {} -type jsonName struct { - has bool - once sync.Once - name string +type stringName struct { + hasJSON bool + once sync.Once + nameJSON string + nameText string } -// Init initializes the name. It is exported for use by other internal packages. -func (js *jsonName) Init(s string) { - js.has = true - js.name = s +// InitJSON initializes the name. It is exported for use by other internal packages. +func (s *stringName) InitJSON(name string) { + s.hasJSON = true + s.nameJSON = name } -func (js *jsonName) get(fd pref.FieldDescriptor) string { - if !js.has { - js.once.Do(func() { - js.name = strs.JSONCamelCase(string(fd.Name())) - }) - } - return js.name +func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName { + s.once.Do(func() { + if fd.IsExtension() { + // For extensions, JSON and text are formatted the same way. + var name string + if messageset.IsMessageSetExtension(fd) { + name = string("[" + fd.FullName().Parent() + "]") + } else { + name = string("[" + fd.FullName() + "]") + } + s.nameJSON = name + s.nameText = name + } else { + // Format the JSON name. + if !s.hasJSON { + s.nameJSON = strs.JSONCamelCase(string(fd.Name())) + } + + // Format the text name. + s.nameText = string(fd.Name()) + if fd.Kind() == pref.GroupKind { + s.nameText = string(fd.Message().Name()) + } + } + }) + return s } +func (s *stringName) getJSON(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameJSON } +func (s *stringName) getText(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameText } + func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue { dv := defaultValue{has: v.IsValid(), val: v, enum: ev} if b, ok := v.Interface().([]byte); ok { diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index e672233e..198451e3 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -451,7 +451,7 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des case genid.FieldDescriptorProto_Name_field_number: fd.L0.FullName = appendFullName(sb, pd.FullName(), v) case genid.FieldDescriptorProto_JsonName_field_number: - fd.L1.JSONName.Init(sb.MakeString(v)) + fd.L1.StringName.InitJSON(sb.MakeString(v)) case genid.FieldDescriptorProto_DefaultValue_field_number: fd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages case genid.FieldDescriptorProto_TypeName_field_number: @@ -551,7 +551,7 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) { b = b[m:] switch num { case genid.FieldDescriptorProto_JsonName_field_number: - xd.L2.JSONName.Init(sb.MakeString(v)) + xd.L2.StringName.InitJSON(sb.MakeString(v)) case genid.FieldDescriptorProto_DefaultValue_field_number: xd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions case genid.FieldDescriptorProto_TypeName_field_number: diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go index c876cd34..aa294fff 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go @@ -6,9 +6,12 @@ package filedesc import ( "fmt" + "math" "sort" "sync" + "google.golang.org/protobuf/internal/genid" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/descfmt" "google.golang.org/protobuf/internal/errors" @@ -245,6 +248,7 @@ type OneofFields struct { once sync.Once byName map[pref.Name]pref.FieldDescriptor // protected by once byJSON map[string]pref.FieldDescriptor // protected by once + byText map[string]pref.FieldDescriptor // protected by once byNum map[pref.FieldNumber]pref.FieldDescriptor // protected by once } @@ -252,6 +256,7 @@ func (p *OneofFields) Len() int { return func (p *OneofFields) Get(i int) pref.FieldDescriptor { return p.List[i] } func (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.lazyInit().byName[s] } func (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.lazyInit().byJSON[s] } +func (p *OneofFields) ByTextName(s string) pref.FieldDescriptor { return p.lazyInit().byText[s] } func (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] } func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) } func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {} @@ -261,11 +266,13 @@ func (p *OneofFields) lazyInit() *OneofFields { if len(p.List) > 0 { p.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List)) p.byJSON = make(map[string]pref.FieldDescriptor, len(p.List)) + p.byText = make(map[string]pref.FieldDescriptor, len(p.List)) p.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List)) for _, f := range p.List { // Field names and numbers are guaranteed to be unique. p.byName[f.Name()] = f p.byJSON[f.JSONName()] = f + p.byText[f.TextName()] = f p.byNum[f.Number()] = f } } @@ -274,9 +281,170 @@ func (p *OneofFields) lazyInit() *OneofFields { } type SourceLocations struct { + // List is a list of SourceLocations. + // The SourceLocation.Next field does not need to be populated + // as it will be lazily populated upon first need. List []pref.SourceLocation + + // File is the parent file descriptor that these locations are relative to. + // If non-nil, ByDescriptor verifies that the provided descriptor + // is a child of this file descriptor. + File pref.FileDescriptor + + once sync.Once + byPath map[pathKey]int } -func (p *SourceLocations) Len() int { return len(p.List) } -func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.List[i] } +func (p *SourceLocations) Len() int { return len(p.List) } +func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.lazyInit().List[i] } +func (p *SourceLocations) byKey(k pathKey) pref.SourceLocation { + if i, ok := p.lazyInit().byPath[k]; ok { + return p.List[i] + } + return pref.SourceLocation{} +} +func (p *SourceLocations) ByPath(path pref.SourcePath) pref.SourceLocation { + return p.byKey(newPathKey(path)) +} +func (p *SourceLocations) ByDescriptor(desc pref.Descriptor) pref.SourceLocation { + if p.File != nil && desc != nil && p.File != desc.ParentFile() { + return pref.SourceLocation{} // mismatching parent files + } + var pathArr [16]int32 + path := pathArr[:0] + for { + switch desc.(type) { + case pref.FileDescriptor: + // Reverse the path since it was constructed in reverse. + for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 { + path[i], path[j] = path[j], path[i] + } + return p.byKey(newPathKey(path)) + case pref.MessageDescriptor: + path = append(path, int32(desc.Index())) + desc = desc.Parent() + switch desc.(type) { + case pref.FileDescriptor: + path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number)) + case pref.MessageDescriptor: + path = append(path, int32(genid.DescriptorProto_NestedType_field_number)) + default: + return pref.SourceLocation{} + } + case pref.FieldDescriptor: + isExtension := desc.(pref.FieldDescriptor).IsExtension() + path = append(path, int32(desc.Index())) + desc = desc.Parent() + if isExtension { + switch desc.(type) { + case pref.FileDescriptor: + path = append(path, int32(genid.FileDescriptorProto_Extension_field_number)) + case pref.MessageDescriptor: + path = append(path, int32(genid.DescriptorProto_Extension_field_number)) + default: + return pref.SourceLocation{} + } + } else { + switch desc.(type) { + case pref.MessageDescriptor: + path = append(path, int32(genid.DescriptorProto_Field_field_number)) + default: + return pref.SourceLocation{} + } + } + case pref.OneofDescriptor: + path = append(path, int32(desc.Index())) + desc = desc.Parent() + switch desc.(type) { + case pref.MessageDescriptor: + path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number)) + default: + return pref.SourceLocation{} + } + case pref.EnumDescriptor: + path = append(path, int32(desc.Index())) + desc = desc.Parent() + switch desc.(type) { + case pref.FileDescriptor: + path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number)) + case pref.MessageDescriptor: + path = append(path, int32(genid.DescriptorProto_EnumType_field_number)) + default: + return pref.SourceLocation{} + } + case pref.EnumValueDescriptor: + path = append(path, int32(desc.Index())) + desc = desc.Parent() + switch desc.(type) { + case pref.EnumDescriptor: + path = append(path, int32(genid.EnumDescriptorProto_Value_field_number)) + default: + return pref.SourceLocation{} + } + case pref.ServiceDescriptor: + path = append(path, int32(desc.Index())) + desc = desc.Parent() + switch desc.(type) { + case pref.FileDescriptor: + path = append(path, int32(genid.FileDescriptorProto_Service_field_number)) + default: + return pref.SourceLocation{} + } + case pref.MethodDescriptor: + path = append(path, int32(desc.Index())) + desc = desc.Parent() + switch desc.(type) { + case pref.ServiceDescriptor: + path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number)) + default: + return pref.SourceLocation{} + } + default: + return pref.SourceLocation{} + } + } +} +func (p *SourceLocations) lazyInit() *SourceLocations { + p.once.Do(func() { + if len(p.List) > 0 { + // Collect all the indexes for a given path. + pathIdxs := make(map[pathKey][]int, len(p.List)) + for i, l := range p.List { + k := newPathKey(l.Path) + pathIdxs[k] = append(pathIdxs[k], i) + } + + // Update the next index for all locations. + p.byPath = make(map[pathKey]int, len(p.List)) + for k, idxs := range pathIdxs { + for i := 0; i < len(idxs)-1; i++ { + p.List[idxs[i]].Next = idxs[i+1] + } + p.List[idxs[len(idxs)-1]].Next = 0 + p.byPath[k] = idxs[0] // record the first location for this path + } + } + }) + return p +} func (p *SourceLocations) ProtoInternal(pragma.DoNotImplement) {} + +// pathKey is a comparable representation of protoreflect.SourcePath. +type pathKey struct { + arr [16]uint8 // first n-1 path segments; last element is the length + str string // used if the path does not fit in arr +} + +func newPathKey(p pref.SourcePath) (k pathKey) { + if len(p) < len(k.arr) { + for i, ps := range p { + if ps < 0 || math.MaxUint8 <= ps { + return pathKey{str: p.String()} + } + k.arr[i] = uint8(ps) + } + k.arr[len(k.arr)-1] = uint8(len(p)) + return k + } + return pathKey{str: p.String()} +} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go index 6a8825e8..30db19fd 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go @@ -142,6 +142,7 @@ type Fields struct { once sync.Once byName map[protoreflect.Name]*Field // protected by once byJSON map[string]*Field // protected by once + byText map[string]*Field // protected by once byNum map[protoreflect.FieldNumber]*Field // protected by once } @@ -163,6 +164,12 @@ func (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor { } return nil } +func (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor { + if d := p.lazyInit().byText[s]; d != nil { + return d + } + return nil +} func (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor { if d := p.lazyInit().byNum[n]; d != nil { return d @@ -178,6 +185,7 @@ func (p *Fields) lazyInit() *Fields { if len(p.List) > 0 { p.byName = make(map[protoreflect.Name]*Field, len(p.List)) p.byJSON = make(map[string]*Field, len(p.List)) + p.byText = make(map[string]*Field, len(p.List)) p.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List)) for i := range p.List { d := &p.List[i] @@ -187,6 +195,9 @@ func (p *Fields) lazyInit() *Fields { if _, ok := p.byJSON[d.JSONName()]; !ok { p.byJSON[d.JSONName()] = d } + if _, ok := p.byText[d.TextName()]; !ok { + p.byText[d.TextName()] = d + } if _, ok := p.byNum[d.Number()]; !ok { p.byNum[d.Number()] = d } diff --git a/vendor/google.golang.org/protobuf/internal/impl/api_export.go b/vendor/google.golang.org/protobuf/internal/impl/api_export.go index b5974528..abee5f30 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/api_export.go +++ b/vendor/google.golang.org/protobuf/internal/impl/api_export.go @@ -167,7 +167,7 @@ func (Export) MessageTypeOf(m message) pref.MessageType { if mv := (Export{}).protoMessageV2Of(m); mv != nil { return mv.ProtoReflect().Type() } - return legacyLoadMessageInfo(reflect.TypeOf(m), "") + return legacyLoadMessageType(reflect.TypeOf(m), "") } // MessageStringOf returns the message value as a string, diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go index c00744d3..cb4b482d 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go @@ -10,6 +10,7 @@ import ( "sync" "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/proto" pref "google.golang.org/protobuf/reflect/protoreflect" preg "google.golang.org/protobuf/reflect/protoregistry" @@ -20,6 +21,7 @@ type errInvalidUTF8 struct{} func (errInvalidUTF8) Error() string { return "string field contains invalid UTF-8" } func (errInvalidUTF8) InvalidUTF8() bool { return true } +func (errInvalidUTF8) Unwrap() error { return errors.Error } // initOneofFieldCoders initializes the fast-path functions for the fields in a oneof. // @@ -242,7 +244,7 @@ func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if p.Elem().IsNil() { p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem()))) @@ -276,7 +278,7 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ Buf: v, @@ -420,7 +422,7 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir } b, n := protowire.ConsumeGroup(num, b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ Buf: b, @@ -494,7 +496,7 @@ func consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderF } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } m := reflect.New(f.mi.GoReflectType.Elem()).Interface() mp := pointerOfIface(m) @@ -550,7 +552,7 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } mp := reflect.New(goType.Elem()) o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ @@ -613,7 +615,7 @@ func consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wt } v, n := protowire.ConsumeBytes(b) if n < 0 { - return pref.Value{}, out, protowire.ParseError(n) + return pref.Value{}, out, errDecode } m := list.NewElement() o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ @@ -681,7 +683,7 @@ func consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wt } b, n := protowire.ConsumeGroup(num, b) if n < 0 { - return pref.Value{}, out, protowire.ParseError(n) + return pref.Value{}, out, errDecode } m := list.NewElement() o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ @@ -767,7 +769,7 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire } b, n := protowire.ConsumeGroup(num, b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } mp := reflect.New(goType.Elem()) o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{ diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go b/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go index ff198d0a..1a509b63 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go @@ -15,13 +15,13 @@ import ( ) // sizeBool returns the size of wire encoding a bool pointer as a Bool. -func sizeBool(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBool(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Bool() return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) } // appendBool wire encodes a bool pointer as a Bool. -func appendBool(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBool(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Bool() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, protowire.EncodeBool(v)) @@ -29,7 +29,7 @@ func appendBool(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byt } // consumeBool wire decodes a bool pointer as a Bool. -func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -45,7 +45,7 @@ func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Bool() = protowire.DecodeBool(v) out.n = n @@ -61,7 +61,7 @@ var coderBool = pointerCoderFuncs{ // sizeBoolNoZero returns the size of wire encoding a bool pointer as a Bool. // The zero value is not encoded. -func sizeBoolNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBoolNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Bool() if v == false { return 0 @@ -71,7 +71,7 @@ func sizeBoolNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { // appendBoolNoZero wire encodes a bool pointer as a Bool. // The zero value is not encoded. -func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Bool() if v == false { return b, nil @@ -90,14 +90,14 @@ var coderBoolNoZero = pointerCoderFuncs{ // sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool. // It panics if the pointer is nil. -func sizeBoolPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBoolPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.BoolPtr() return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) } // appendBoolPtr wire encodes a *bool pointer as a Bool. // It panics if the pointer is nil. -func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.BoolPtr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, protowire.EncodeBool(v)) @@ -105,7 +105,7 @@ func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([] } // consumeBoolPtr wire decodes a *bool pointer as a Bool. -func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -121,7 +121,7 @@ func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.BoolPtr() if *vp == nil { @@ -140,7 +140,7 @@ var coderBoolPtr = pointerCoderFuncs{ } // sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool. -func sizeBoolSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBoolSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.BoolSlice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v)) @@ -149,7 +149,7 @@ func sizeBoolSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { } // appendBoolSlice encodes a []bool pointer as a repeated Bool. -func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.BoolSlice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -159,13 +159,13 @@ func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeBoolSlice wire decodes a []bool pointer as a repeated Bool. -func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.BoolSlice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -180,7 +180,7 @@ func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, protowire.DecodeBool(v)) b = b[n:] @@ -204,7 +204,7 @@ func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, protowire.DecodeBool(v)) out.n = n @@ -219,7 +219,7 @@ var coderBoolSlice = pointerCoderFuncs{ } // sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool. -func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.BoolSlice() if len(s) == 0 { return 0 @@ -232,7 +232,7 @@ func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size i } // appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool. -func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.BoolSlice() if len(s) == 0 { return b, nil @@ -257,19 +257,19 @@ var coderBoolPackedSlice = pointerCoderFuncs{ } // sizeBoolValue returns the size of wire encoding a bool value as a Bool. -func sizeBoolValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeBoolValue(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool())) } // appendBoolValue encodes a bool value as a Bool. -func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool())) return b, nil } // consumeBoolValue decodes a bool value as a Bool. -func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -285,7 +285,7 @@ func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp p v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil @@ -299,7 +299,7 @@ var coderBoolValue = valueCoderFuncs{ } // sizeBoolSliceValue returns the size of wire encoding a []bool value as a repeated Bool. -func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -309,7 +309,7 @@ func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) } // appendBoolSliceValue encodes a []bool value as a repeated Bool. -func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -320,12 +320,12 @@ func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ } // consumeBoolSliceValue wire decodes a []bool value as a repeated Bool. -func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -340,7 +340,7 @@ func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Numbe v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) b = b[n:] @@ -363,7 +363,7 @@ func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Numbe v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) out.n = n @@ -378,7 +378,7 @@ var coderBoolSliceValue = valueCoderFuncs{ } // sizeBoolPackedSliceValue returns the size of wire encoding a []bool value as a packed repeated Bool. -func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -393,7 +393,7 @@ func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOp } // appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool. -func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -421,19 +421,19 @@ var coderBoolPackedSliceValue = valueCoderFuncs{ } // sizeEnumValue returns the size of wire encoding a value as a Enum. -func sizeEnumValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeEnumValue(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(uint64(v.Enum())) } // appendEnumValue encodes a value as a Enum. -func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, uint64(v.Enum())) return b, nil } // consumeEnumValue decodes a value as a Enum. -func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -449,7 +449,7 @@ func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp p v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil @@ -463,7 +463,7 @@ var coderEnumValue = valueCoderFuncs{ } // sizeEnumSliceValue returns the size of wire encoding a [] value as a repeated Enum. -func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -473,7 +473,7 @@ func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) } // appendEnumSliceValue encodes a [] value as a repeated Enum. -func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -484,12 +484,12 @@ func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ } // consumeEnumSliceValue wire decodes a [] value as a repeated Enum. -func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -504,7 +504,7 @@ func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Numbe v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) b = b[n:] @@ -527,7 +527,7 @@ func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Numbe v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) out.n = n @@ -542,7 +542,7 @@ var coderEnumSliceValue = valueCoderFuncs{ } // sizeEnumPackedSliceValue returns the size of wire encoding a [] value as a packed repeated Enum. -func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -557,7 +557,7 @@ func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOp } // appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum. -func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -585,13 +585,13 @@ var coderEnumPackedSliceValue = valueCoderFuncs{ } // sizeInt32 returns the size of wire encoding a int32 pointer as a Int32. -func sizeInt32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int32() return f.tagsize + protowire.SizeVarint(uint64(v)) } // appendInt32 wire encodes a int32 pointer as a Int32. -func appendInt32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int32() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, uint64(v)) @@ -599,7 +599,7 @@ func appendInt32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]by } // consumeInt32 wire decodes a int32 pointer as a Int32. -func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -615,7 +615,7 @@ func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Int32() = int32(v) out.n = n @@ -631,7 +631,7 @@ var coderInt32 = pointerCoderFuncs{ // sizeInt32NoZero returns the size of wire encoding a int32 pointer as a Int32. // The zero value is not encoded. -func sizeInt32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int32() if v == 0 { return 0 @@ -641,7 +641,7 @@ func sizeInt32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendInt32NoZero wire encodes a int32 pointer as a Int32. // The zero value is not encoded. -func appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int32() if v == 0 { return b, nil @@ -660,14 +660,14 @@ var coderInt32NoZero = pointerCoderFuncs{ // sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32. // It panics if the pointer is nil. -func sizeInt32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.Int32Ptr() return f.tagsize + protowire.SizeVarint(uint64(v)) } // appendInt32Ptr wire encodes a *int32 pointer as a Int32. // It panics if the pointer is nil. -func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Int32Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, uint64(v)) @@ -675,7 +675,7 @@ func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([ } // consumeInt32Ptr wire decodes a *int32 pointer as a Int32. -func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -691,7 +691,7 @@ func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Int32Ptr() if *vp == nil { @@ -710,7 +710,7 @@ var coderInt32Ptr = pointerCoderFuncs{ } // sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32. -func sizeInt32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int32Slice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(uint64(v)) @@ -719,7 +719,7 @@ func sizeInt32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { } // appendInt32Slice encodes a []int32 pointer as a repeated Int32. -func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int32Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -729,13 +729,13 @@ func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32. -func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int32Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -750,7 +750,7 @@ func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldIn v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, int32(v)) b = b[n:] @@ -774,7 +774,7 @@ func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldIn v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, int32(v)) out.n = n @@ -789,7 +789,7 @@ var coderInt32Slice = pointerCoderFuncs{ } // sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32. -func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int32Slice() if len(s) == 0 { return 0 @@ -802,7 +802,7 @@ func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32. -func appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int32Slice() if len(s) == 0 { return b, nil @@ -827,19 +827,19 @@ var coderInt32PackedSlice = pointerCoderFuncs{ } // sizeInt32Value returns the size of wire encoding a int32 value as a Int32. -func sizeInt32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeInt32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(uint64(int32(v.Int()))) } // appendInt32Value encodes a int32 value as a Int32. -func appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, uint64(int32(v.Int()))) return b, nil } // consumeInt32Value decodes a int32 value as a Int32. -func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -855,7 +855,7 @@ func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfInt32(int32(v)), out, nil @@ -869,7 +869,7 @@ var coderInt32Value = valueCoderFuncs{ } // sizeInt32SliceValue returns the size of wire encoding a []int32 value as a repeated Int32. -func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -879,7 +879,7 @@ func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions } // appendInt32SliceValue encodes a []int32 value as a repeated Int32. -func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -890,12 +890,12 @@ func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ } // consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32. -func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -910,7 +910,7 @@ func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Numb v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt32(int32(v))) b = b[n:] @@ -933,7 +933,7 @@ func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Numb v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt32(int32(v))) out.n = n @@ -948,7 +948,7 @@ var coderInt32SliceValue = valueCoderFuncs{ } // sizeInt32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Int32. -func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -963,7 +963,7 @@ func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalO } // appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32. -func appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -991,13 +991,13 @@ var coderInt32PackedSliceValue = valueCoderFuncs{ } // sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32. -func sizeSint32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int32() return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) } // appendSint32 wire encodes a int32 pointer as a Sint32. -func appendSint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int32() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) @@ -1005,7 +1005,7 @@ func appendSint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]b } // consumeSint32 wire decodes a int32 pointer as a Sint32. -func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -1021,7 +1021,7 @@ func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32)) out.n = n @@ -1037,7 +1037,7 @@ var coderSint32 = pointerCoderFuncs{ // sizeSint32NoZero returns the size of wire encoding a int32 pointer as a Sint32. // The zero value is not encoded. -func sizeSint32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int32() if v == 0 { return 0 @@ -1047,7 +1047,7 @@ func sizeSint32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendSint32NoZero wire encodes a int32 pointer as a Sint32. // The zero value is not encoded. -func appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int32() if v == 0 { return b, nil @@ -1066,14 +1066,14 @@ var coderSint32NoZero = pointerCoderFuncs{ // sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32. // It panics if the pointer is nil. -func sizeSint32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.Int32Ptr() return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) } // appendSint32Ptr wire encodes a *int32 pointer as a Sint32. // It panics if the pointer is nil. -func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Int32Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v))) @@ -1081,7 +1081,7 @@ func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeSint32Ptr wire decodes a *int32 pointer as a Sint32. -func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -1097,7 +1097,7 @@ func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Int32Ptr() if *vp == nil { @@ -1116,7 +1116,7 @@ var coderSint32Ptr = pointerCoderFuncs{ } // sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32. -func sizeSint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int32Slice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v))) @@ -1125,7 +1125,7 @@ func sizeSint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) } // appendSint32Slice encodes a []int32 pointer as a repeated Sint32. -func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int32Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -1135,13 +1135,13 @@ func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32. -func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int32Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -1156,7 +1156,7 @@ func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32))) b = b[n:] @@ -1180,7 +1180,7 @@ func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32))) out.n = n @@ -1195,7 +1195,7 @@ var coderSint32Slice = pointerCoderFuncs{ } // sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32. -func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int32Slice() if len(s) == 0 { return 0 @@ -1208,7 +1208,7 @@ func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32. -func appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int32Slice() if len(s) == 0 { return b, nil @@ -1233,19 +1233,19 @@ var coderSint32PackedSlice = pointerCoderFuncs{ } // sizeSint32Value returns the size of wire encoding a int32 value as a Sint32. -func sizeSint32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeSint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int())))) } // appendSint32Value encodes a int32 value as a Sint32. -func appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int())))) return b, nil } // consumeSint32Value decodes a int32 value as a Sint32. -func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -1261,7 +1261,7 @@ func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil @@ -1275,7 +1275,7 @@ var coderSint32Value = valueCoderFuncs{ } // sizeSint32SliceValue returns the size of wire encoding a []int32 value as a repeated Sint32. -func sizeSint32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -1285,7 +1285,7 @@ func sizeSint32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOption } // appendSint32SliceValue encodes a []int32 value as a repeated Sint32. -func appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -1296,12 +1296,12 @@ func appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32. -func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -1316,7 +1316,7 @@ func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) b = b[n:] @@ -1339,7 +1339,7 @@ func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) out.n = n @@ -1354,7 +1354,7 @@ var coderSint32SliceValue = valueCoderFuncs{ } // sizeSint32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sint32. -func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -1369,7 +1369,7 @@ func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshal } // appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32. -func appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -1397,13 +1397,13 @@ var coderSint32PackedSliceValue = valueCoderFuncs{ } // sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32. -func sizeUint32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Uint32() return f.tagsize + protowire.SizeVarint(uint64(v)) } // appendUint32 wire encodes a uint32 pointer as a Uint32. -func appendUint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint32() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, uint64(v)) @@ -1411,7 +1411,7 @@ func appendUint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]b } // consumeUint32 wire decodes a uint32 pointer as a Uint32. -func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -1427,7 +1427,7 @@ func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Uint32() = uint32(v) out.n = n @@ -1443,7 +1443,7 @@ var coderUint32 = pointerCoderFuncs{ // sizeUint32NoZero returns the size of wire encoding a uint32 pointer as a Uint32. // The zero value is not encoded. -func sizeUint32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Uint32() if v == 0 { return 0 @@ -1453,7 +1453,7 @@ func sizeUint32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendUint32NoZero wire encodes a uint32 pointer as a Uint32. // The zero value is not encoded. -func appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint32() if v == 0 { return b, nil @@ -1472,14 +1472,14 @@ var coderUint32NoZero = pointerCoderFuncs{ // sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32. // It panics if the pointer is nil. -func sizeUint32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.Uint32Ptr() return f.tagsize + protowire.SizeVarint(uint64(v)) } // appendUint32Ptr wire encodes a *uint32 pointer as a Uint32. // It panics if the pointer is nil. -func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Uint32Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, uint64(v)) @@ -1487,7 +1487,7 @@ func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32. -func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -1503,7 +1503,7 @@ func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Uint32Ptr() if *vp == nil { @@ -1522,7 +1522,7 @@ var coderUint32Ptr = pointerCoderFuncs{ } // sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32. -func sizeUint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint32Slice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(uint64(v)) @@ -1531,7 +1531,7 @@ func sizeUint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) } // appendUint32Slice encodes a []uint32 pointer as a repeated Uint32. -func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint32Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -1541,13 +1541,13 @@ func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32. -func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint32Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -1562,7 +1562,7 @@ func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, uint32(v)) b = b[n:] @@ -1586,7 +1586,7 @@ func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, uint32(v)) out.n = n @@ -1601,7 +1601,7 @@ var coderUint32Slice = pointerCoderFuncs{ } // sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32. -func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint32Slice() if len(s) == 0 { return 0 @@ -1614,7 +1614,7 @@ func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32. -func appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint32Slice() if len(s) == 0 { return b, nil @@ -1639,19 +1639,19 @@ var coderUint32PackedSlice = pointerCoderFuncs{ } // sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32. -func sizeUint32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeUint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(uint64(uint32(v.Uint()))) } // appendUint32Value encodes a uint32 value as a Uint32. -func appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, uint64(uint32(v.Uint()))) return b, nil } // consumeUint32Value decodes a uint32 value as a Uint32. -func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -1667,7 +1667,7 @@ func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfUint32(uint32(v)), out, nil @@ -1681,7 +1681,7 @@ var coderUint32Value = valueCoderFuncs{ } // sizeUint32SliceValue returns the size of wire encoding a []uint32 value as a repeated Uint32. -func sizeUint32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeUint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -1691,7 +1691,7 @@ func sizeUint32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOption } // appendUint32SliceValue encodes a []uint32 value as a repeated Uint32. -func appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -1702,12 +1702,12 @@ func appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32. -func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -1722,7 +1722,7 @@ func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint32(uint32(v))) b = b[n:] @@ -1745,7 +1745,7 @@ func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint32(uint32(v))) out.n = n @@ -1760,7 +1760,7 @@ var coderUint32SliceValue = valueCoderFuncs{ } // sizeUint32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Uint32. -func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -1775,7 +1775,7 @@ func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshal } // appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32. -func appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -1803,13 +1803,13 @@ var coderUint32PackedSliceValue = valueCoderFuncs{ } // sizeInt64 returns the size of wire encoding a int64 pointer as a Int64. -func sizeInt64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int64() return f.tagsize + protowire.SizeVarint(uint64(v)) } // appendInt64 wire encodes a int64 pointer as a Int64. -func appendInt64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int64() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, uint64(v)) @@ -1817,7 +1817,7 @@ func appendInt64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]by } // consumeInt64 wire decodes a int64 pointer as a Int64. -func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -1833,7 +1833,7 @@ func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Int64() = int64(v) out.n = n @@ -1849,7 +1849,7 @@ var coderInt64 = pointerCoderFuncs{ // sizeInt64NoZero returns the size of wire encoding a int64 pointer as a Int64. // The zero value is not encoded. -func sizeInt64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int64() if v == 0 { return 0 @@ -1859,7 +1859,7 @@ func sizeInt64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendInt64NoZero wire encodes a int64 pointer as a Int64. // The zero value is not encoded. -func appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int64() if v == 0 { return b, nil @@ -1878,14 +1878,14 @@ var coderInt64NoZero = pointerCoderFuncs{ // sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64. // It panics if the pointer is nil. -func sizeInt64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.Int64Ptr() return f.tagsize + protowire.SizeVarint(uint64(v)) } // appendInt64Ptr wire encodes a *int64 pointer as a Int64. // It panics if the pointer is nil. -func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Int64Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, uint64(v)) @@ -1893,7 +1893,7 @@ func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([ } // consumeInt64Ptr wire decodes a *int64 pointer as a Int64. -func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -1909,7 +1909,7 @@ func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Int64Ptr() if *vp == nil { @@ -1928,7 +1928,7 @@ var coderInt64Ptr = pointerCoderFuncs{ } // sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64. -func sizeInt64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int64Slice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(uint64(v)) @@ -1937,7 +1937,7 @@ func sizeInt64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { } // appendInt64Slice encodes a []int64 pointer as a repeated Int64. -func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int64Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -1947,13 +1947,13 @@ func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64. -func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int64Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -1968,7 +1968,7 @@ func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldIn v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, int64(v)) b = b[n:] @@ -1992,7 +1992,7 @@ func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldIn v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, int64(v)) out.n = n @@ -2007,7 +2007,7 @@ var coderInt64Slice = pointerCoderFuncs{ } // sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64. -func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int64Slice() if len(s) == 0 { return 0 @@ -2020,7 +2020,7 @@ func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64. -func appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int64Slice() if len(s) == 0 { return b, nil @@ -2045,19 +2045,19 @@ var coderInt64PackedSlice = pointerCoderFuncs{ } // sizeInt64Value returns the size of wire encoding a int64 value as a Int64. -func sizeInt64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeInt64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(uint64(v.Int())) } // appendInt64Value encodes a int64 value as a Int64. -func appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, uint64(v.Int())) return b, nil } // consumeInt64Value decodes a int64 value as a Int64. -func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -2073,7 +2073,7 @@ func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfInt64(int64(v)), out, nil @@ -2087,7 +2087,7 @@ var coderInt64Value = valueCoderFuncs{ } // sizeInt64SliceValue returns the size of wire encoding a []int64 value as a repeated Int64. -func sizeInt64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeInt64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -2097,7 +2097,7 @@ func sizeInt64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions } // appendInt64SliceValue encodes a []int64 value as a repeated Int64. -func appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -2108,12 +2108,12 @@ func appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ } // consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64. -func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -2128,7 +2128,7 @@ func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Numb v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt64(int64(v))) b = b[n:] @@ -2151,7 +2151,7 @@ func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Numb v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt64(int64(v))) out.n = n @@ -2166,7 +2166,7 @@ var coderInt64SliceValue = valueCoderFuncs{ } // sizeInt64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Int64. -func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -2181,7 +2181,7 @@ func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalO } // appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64. -func appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -2209,13 +2209,13 @@ var coderInt64PackedSliceValue = valueCoderFuncs{ } // sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64. -func sizeSint64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int64() return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) } // appendSint64 wire encodes a int64 pointer as a Sint64. -func appendSint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int64() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) @@ -2223,7 +2223,7 @@ func appendSint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]b } // consumeSint64 wire decodes a int64 pointer as a Sint64. -func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -2239,7 +2239,7 @@ func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Int64() = protowire.DecodeZigZag(v) out.n = n @@ -2255,7 +2255,7 @@ var coderSint64 = pointerCoderFuncs{ // sizeSint64NoZero returns the size of wire encoding a int64 pointer as a Sint64. // The zero value is not encoded. -func sizeSint64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int64() if v == 0 { return 0 @@ -2265,7 +2265,7 @@ func sizeSint64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendSint64NoZero wire encodes a int64 pointer as a Sint64. // The zero value is not encoded. -func appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int64() if v == 0 { return b, nil @@ -2284,14 +2284,14 @@ var coderSint64NoZero = pointerCoderFuncs{ // sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64. // It panics if the pointer is nil. -func sizeSint64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.Int64Ptr() return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) } // appendSint64Ptr wire encodes a *int64 pointer as a Sint64. // It panics if the pointer is nil. -func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Int64Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, protowire.EncodeZigZag(v)) @@ -2299,7 +2299,7 @@ func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeSint64Ptr wire decodes a *int64 pointer as a Sint64. -func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -2315,7 +2315,7 @@ func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Int64Ptr() if *vp == nil { @@ -2334,7 +2334,7 @@ var coderSint64Ptr = pointerCoderFuncs{ } // sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64. -func sizeSint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int64Slice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v)) @@ -2343,7 +2343,7 @@ func sizeSint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) } // appendSint64Slice encodes a []int64 pointer as a repeated Sint64. -func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int64Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -2353,13 +2353,13 @@ func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64. -func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int64Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -2374,7 +2374,7 @@ func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, protowire.DecodeZigZag(v)) b = b[n:] @@ -2398,7 +2398,7 @@ func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, protowire.DecodeZigZag(v)) out.n = n @@ -2413,7 +2413,7 @@ var coderSint64Slice = pointerCoderFuncs{ } // sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64. -func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int64Slice() if len(s) == 0 { return 0 @@ -2426,7 +2426,7 @@ func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64. -func appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int64Slice() if len(s) == 0 { return b, nil @@ -2451,19 +2451,19 @@ var coderSint64PackedSlice = pointerCoderFuncs{ } // sizeSint64Value returns the size of wire encoding a int64 value as a Sint64. -func sizeSint64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeSint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int())) } // appendSint64Value encodes a int64 value as a Sint64. -func appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int())) return b, nil } // consumeSint64Value decodes a int64 value as a Sint64. -func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -2479,7 +2479,7 @@ func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil @@ -2493,7 +2493,7 @@ var coderSint64Value = valueCoderFuncs{ } // sizeSint64SliceValue returns the size of wire encoding a []int64 value as a repeated Sint64. -func sizeSint64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -2503,7 +2503,7 @@ func sizeSint64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOption } // appendSint64SliceValue encodes a []int64 value as a repeated Sint64. -func appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -2514,12 +2514,12 @@ func appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64. -func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -2534,7 +2534,7 @@ func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) b = b[n:] @@ -2557,7 +2557,7 @@ func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) out.n = n @@ -2572,7 +2572,7 @@ var coderSint64SliceValue = valueCoderFuncs{ } // sizeSint64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sint64. -func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -2587,7 +2587,7 @@ func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshal } // appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64. -func appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -2615,13 +2615,13 @@ var coderSint64PackedSliceValue = valueCoderFuncs{ } // sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64. -func sizeUint64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Uint64() return f.tagsize + protowire.SizeVarint(v) } // appendUint64 wire encodes a uint64 pointer as a Uint64. -func appendUint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint64() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, v) @@ -2629,7 +2629,7 @@ func appendUint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]b } // consumeUint64 wire decodes a uint64 pointer as a Uint64. -func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -2645,7 +2645,7 @@ func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Uint64() = v out.n = n @@ -2661,7 +2661,7 @@ var coderUint64 = pointerCoderFuncs{ // sizeUint64NoZero returns the size of wire encoding a uint64 pointer as a Uint64. // The zero value is not encoded. -func sizeUint64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Uint64() if v == 0 { return 0 @@ -2671,7 +2671,7 @@ func sizeUint64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendUint64NoZero wire encodes a uint64 pointer as a Uint64. // The zero value is not encoded. -func appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint64() if v == 0 { return b, nil @@ -2690,14 +2690,14 @@ var coderUint64NoZero = pointerCoderFuncs{ // sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64. // It panics if the pointer is nil. -func sizeUint64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.Uint64Ptr() return f.tagsize + protowire.SizeVarint(v) } // appendUint64Ptr wire encodes a *uint64 pointer as a Uint64. // It panics if the pointer is nil. -func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Uint64Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendVarint(b, v) @@ -2705,7 +2705,7 @@ func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64. -func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return out, errUnknown } @@ -2721,7 +2721,7 @@ func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Uint64Ptr() if *vp == nil { @@ -2740,7 +2740,7 @@ var coderUint64Ptr = pointerCoderFuncs{ } // sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64. -func sizeUint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint64Slice() for _, v := range s { size += f.tagsize + protowire.SizeVarint(v) @@ -2749,7 +2749,7 @@ func sizeUint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) } // appendUint64Slice encodes a []uint64 pointer as a repeated Uint64. -func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint64Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -2759,13 +2759,13 @@ func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64. -func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint64Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { var v uint64 @@ -2780,7 +2780,7 @@ func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, v) b = b[n:] @@ -2804,7 +2804,7 @@ func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI v, n = protowire.ConsumeVarint(b) } if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, v) out.n = n @@ -2819,7 +2819,7 @@ var coderUint64Slice = pointerCoderFuncs{ } // sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64. -func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint64Slice() if len(s) == 0 { return 0 @@ -2832,7 +2832,7 @@ func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64. -func appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint64Slice() if len(s) == 0 { return b, nil @@ -2857,19 +2857,19 @@ var coderUint64PackedSlice = pointerCoderFuncs{ } // sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64. -func sizeUint64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeUint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeVarint(v.Uint()) } // appendUint64Value encodes a uint64 value as a Uint64. -func appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendVarint(b, v.Uint()) return b, nil } // consumeUint64Value decodes a uint64 value as a Uint64. -func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.VarintType { return protoreflect.Value{}, out, errUnknown } @@ -2885,7 +2885,7 @@ func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfUint64(v), out, nil @@ -2899,7 +2899,7 @@ var coderUint64Value = valueCoderFuncs{ } // sizeUint64SliceValue returns the size of wire encoding a []uint64 value as a repeated Uint64. -func sizeUint64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeUint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -2909,7 +2909,7 @@ func sizeUint64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOption } // appendUint64SliceValue encodes a []uint64 value as a repeated Uint64. -func appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -2920,12 +2920,12 @@ func appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64. -func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { var v uint64 @@ -2940,7 +2940,7 @@ func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint64(v)) b = b[n:] @@ -2963,7 +2963,7 @@ func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Num v, n = protowire.ConsumeVarint(b) } if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint64(v)) out.n = n @@ -2978,7 +2978,7 @@ var coderUint64SliceValue = valueCoderFuncs{ } // sizeUint64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Uint64. -func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -2993,7 +2993,7 @@ func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshal } // appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64. -func appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3021,13 +3021,13 @@ var coderUint64PackedSliceValue = valueCoderFuncs{ } // sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32. -func sizeSfixed32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed32() } // appendSfixed32 wire encodes a int32 pointer as a Sfixed32. -func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int32() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed32(b, uint32(v)) @@ -3035,13 +3035,13 @@ func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([ } // consumeSfixed32 wire decodes a int32 pointer as a Sfixed32. -func consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Int32() = int32(v) out.n = n @@ -3057,7 +3057,7 @@ var coderSfixed32 = pointerCoderFuncs{ // sizeSfixed32NoZero returns the size of wire encoding a int32 pointer as a Sfixed32. // The zero value is not encoded. -func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int32() if v == 0 { return 0 @@ -3067,7 +3067,7 @@ func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size in // appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32. // The zero value is not encoded. -func appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int32() if v == 0 { return b, nil @@ -3086,13 +3086,13 @@ var coderSfixed32NoZero = pointerCoderFuncs{ // sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32. // It panics if the pointer is nil. -func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed32() } // appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32. // It panics if the pointer is nil. -func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Int32Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed32(b, uint32(v)) @@ -3100,13 +3100,13 @@ func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32. -func consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Int32Ptr() if *vp == nil { @@ -3125,14 +3125,14 @@ var coderSfixed32Ptr = pointerCoderFuncs{ } // sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32. -func sizeSfixed32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int32Slice() size = len(s) * (f.tagsize + protowire.SizeFixed32()) return size } // appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32. -func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int32Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -3142,18 +3142,18 @@ func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOption } // consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32. -func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int32Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, int32(v)) b = b[n:] @@ -3167,7 +3167,7 @@ func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFiel } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, int32(v)) out.n = n @@ -3182,7 +3182,7 @@ var coderSfixed32Slice = pointerCoderFuncs{ } // sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32. -func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int32Slice() if len(s) == 0 { return 0 @@ -3192,7 +3192,7 @@ func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (si } // appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32. -func appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int32Slice() if len(s) == 0 { return b, nil @@ -3214,25 +3214,25 @@ var coderSfixed32PackedSlice = pointerCoderFuncs{ } // sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32. -func sizeSfixed32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeSfixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeFixed32() } // appendSfixed32Value encodes a int32 value as a Sfixed32. -func appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendFixed32(b, uint32(v.Int())) return b, nil } // consumeSfixed32Value decodes a int32 value as a Sfixed32. -func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfInt32(int32(v)), out, nil @@ -3246,14 +3246,14 @@ var coderSfixed32Value = valueCoderFuncs{ } // sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32. -func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() size = list.Len() * (tagsize + protowire.SizeFixed32()) return size } // appendSfixed32SliceValue encodes a []int32 value as a repeated Sfixed32. -func appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -3264,17 +3264,17 @@ func appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64 } // consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32. -func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt32(int32(v))) b = b[n:] @@ -3287,7 +3287,7 @@ func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.N } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt32(int32(v))) out.n = n @@ -3302,7 +3302,7 @@ var coderSfixed32SliceValue = valueCoderFuncs{ } // sizeSfixed32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sfixed32. -func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3313,7 +3313,7 @@ func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marsh } // appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32. -func appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3337,13 +3337,13 @@ var coderSfixed32PackedSliceValue = valueCoderFuncs{ } // sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32. -func sizeFixed32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed32() } // appendFixed32 wire encodes a uint32 pointer as a Fixed32. -func appendFixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint32() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed32(b, v) @@ -3351,13 +3351,13 @@ func appendFixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([] } // consumeFixed32 wire decodes a uint32 pointer as a Fixed32. -func consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Uint32() = v out.n = n @@ -3373,7 +3373,7 @@ var coderFixed32 = pointerCoderFuncs{ // sizeFixed32NoZero returns the size of wire encoding a uint32 pointer as a Fixed32. // The zero value is not encoded. -func sizeFixed32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Uint32() if v == 0 { return 0 @@ -3383,7 +3383,7 @@ func sizeFixed32NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int // appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32. // The zero value is not encoded. -func appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint32() if v == 0 { return b, nil @@ -3402,13 +3402,13 @@ var coderFixed32NoZero = pointerCoderFuncs{ // sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32. // It panics if the pointer is nil. -func sizeFixed32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed32() } // appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32. // It panics if the pointer is nil. -func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Uint32Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed32(b, v) @@ -3416,13 +3416,13 @@ func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32. -func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Uint32Ptr() if *vp == nil { @@ -3441,14 +3441,14 @@ var coderFixed32Ptr = pointerCoderFuncs{ } // sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32. -func sizeFixed32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint32Slice() size = len(s) * (f.tagsize + protowire.SizeFixed32()) return size } // appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32. -func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint32Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -3458,18 +3458,18 @@ func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions } // consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32. -func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint32Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, v) b = b[n:] @@ -3483,7 +3483,7 @@ func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderField } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, v) out.n = n @@ -3498,7 +3498,7 @@ var coderFixed32Slice = pointerCoderFuncs{ } // sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32. -func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint32Slice() if len(s) == 0 { return 0 @@ -3508,7 +3508,7 @@ func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (siz } // appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32. -func appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint32Slice() if len(s) == 0 { return b, nil @@ -3530,25 +3530,25 @@ var coderFixed32PackedSlice = pointerCoderFuncs{ } // sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32. -func sizeFixed32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeFixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeFixed32() } // appendFixed32Value encodes a uint32 value as a Fixed32. -func appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendFixed32(b, uint32(v.Uint())) return b, nil } // consumeFixed32Value decodes a uint32 value as a Fixed32. -func consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfUint32(uint32(v)), out, nil @@ -3562,14 +3562,14 @@ var coderFixed32Value = valueCoderFuncs{ } // sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32. -func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() size = list.Len() * (tagsize + protowire.SizeFixed32()) return size } // appendFixed32SliceValue encodes a []uint32 value as a repeated Fixed32. -func appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -3580,17 +3580,17 @@ func appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32. -func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint32(uint32(v))) b = b[n:] @@ -3603,7 +3603,7 @@ func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Nu } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint32(uint32(v))) out.n = n @@ -3618,7 +3618,7 @@ var coderFixed32SliceValue = valueCoderFuncs{ } // sizeFixed32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Fixed32. -func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3629,7 +3629,7 @@ func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, _ marsha } // appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32. -func appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3653,13 +3653,13 @@ var coderFixed32PackedSliceValue = valueCoderFuncs{ } // sizeFloat returns the size of wire encoding a float32 pointer as a Float. -func sizeFloat(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFloat(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed32() } // appendFloat wire encodes a float32 pointer as a Float. -func appendFloat(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFloat(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Float32() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed32(b, math.Float32bits(v)) @@ -3667,13 +3667,13 @@ func appendFloat(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]by } // consumeFloat wire decodes a float32 pointer as a Float. -func consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Float32() = math.Float32frombits(v) out.n = n @@ -3689,7 +3689,7 @@ var coderFloat = pointerCoderFuncs{ // sizeFloatNoZero returns the size of wire encoding a float32 pointer as a Float. // The zero value is not encoded. -func sizeFloatNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFloatNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Float32() if v == 0 && !math.Signbit(float64(v)) { return 0 @@ -3699,7 +3699,7 @@ func sizeFloatNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendFloatNoZero wire encodes a float32 pointer as a Float. // The zero value is not encoded. -func appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Float32() if v == 0 && !math.Signbit(float64(v)) { return b, nil @@ -3718,13 +3718,13 @@ var coderFloatNoZero = pointerCoderFuncs{ // sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float. // It panics if the pointer is nil. -func sizeFloatPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFloatPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed32() } // appendFloatPtr wire encodes a *float32 pointer as a Float. // It panics if the pointer is nil. -func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Float32Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed32(b, math.Float32bits(v)) @@ -3732,13 +3732,13 @@ func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([ } // consumeFloatPtr wire decodes a *float32 pointer as a Float. -func consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Float32Ptr() if *vp == nil { @@ -3757,14 +3757,14 @@ var coderFloatPtr = pointerCoderFuncs{ } // sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float. -func sizeFloatSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFloatSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Float32Slice() size = len(s) * (f.tagsize + protowire.SizeFixed32()) return size } // appendFloatSlice encodes a []float32 pointer as a repeated Float. -func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Float32Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -3774,18 +3774,18 @@ func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeFloatSlice wire decodes a []float32 pointer as a repeated Float. -func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Float32Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, math.Float32frombits(v)) b = b[n:] @@ -3799,7 +3799,7 @@ func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldIn } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, math.Float32frombits(v)) out.n = n @@ -3814,7 +3814,7 @@ var coderFloatSlice = pointerCoderFuncs{ } // sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float. -func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Float32Slice() if len(s) == 0 { return 0 @@ -3824,7 +3824,7 @@ func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float. -func appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Float32Slice() if len(s) == 0 { return b, nil @@ -3846,25 +3846,25 @@ var coderFloatPackedSlice = pointerCoderFuncs{ } // sizeFloatValue returns the size of wire encoding a float32 value as a Float. -func sizeFloatValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeFloatValue(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeFixed32() } // appendFloatValue encodes a float32 value as a Float. -func appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float()))) return b, nil } // consumeFloatValue decodes a float32 value as a Float. -func consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.Fixed32Type { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil @@ -3878,14 +3878,14 @@ var coderFloatValue = valueCoderFuncs{ } // sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float. -func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() size = list.Len() * (tagsize + protowire.SizeFixed32()) return size } // appendFloatSliceValue encodes a []float32 value as a repeated Float. -func appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -3896,17 +3896,17 @@ func appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ } // consumeFloatSliceValue wire decodes a []float32 value as a repeated Float. -func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) b = b[n:] @@ -3919,7 +3919,7 @@ func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Numb } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) out.n = n @@ -3934,7 +3934,7 @@ var coderFloatSliceValue = valueCoderFuncs{ } // sizeFloatPackedSliceValue returns the size of wire encoding a []float32 value as a packed repeated Float. -func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3945,7 +3945,7 @@ func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalO } // appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float. -func appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -3969,13 +3969,13 @@ var coderFloatPackedSliceValue = valueCoderFuncs{ } // sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64. -func sizeSfixed64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed64() } // appendSfixed64 wire encodes a int64 pointer as a Sfixed64. -func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int64() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed64(b, uint64(v)) @@ -3983,13 +3983,13 @@ func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([ } // consumeSfixed64 wire decodes a int64 pointer as a Sfixed64. -func consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Int64() = int64(v) out.n = n @@ -4005,7 +4005,7 @@ var coderSfixed64 = pointerCoderFuncs{ // sizeSfixed64NoZero returns the size of wire encoding a int64 pointer as a Sfixed64. // The zero value is not encoded. -func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Int64() if v == 0 { return 0 @@ -4015,7 +4015,7 @@ func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size in // appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64. // The zero value is not encoded. -func appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Int64() if v == 0 { return b, nil @@ -4034,13 +4034,13 @@ var coderSfixed64NoZero = pointerCoderFuncs{ // sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64. // It panics if the pointer is nil. -func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed64() } // appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64. // It panics if the pointer is nil. -func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Int64Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed64(b, uint64(v)) @@ -4048,13 +4048,13 @@ func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64. -func consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Int64Ptr() if *vp == nil { @@ -4073,14 +4073,14 @@ var coderSfixed64Ptr = pointerCoderFuncs{ } // sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64. -func sizeSfixed64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int64Slice() size = len(s) * (f.tagsize + protowire.SizeFixed64()) return size } // appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64. -func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int64Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -4090,18 +4090,18 @@ func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOption } // consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64. -func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Int64Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, int64(v)) b = b[n:] @@ -4115,7 +4115,7 @@ func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFiel } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, int64(v)) out.n = n @@ -4130,7 +4130,7 @@ var coderSfixed64Slice = pointerCoderFuncs{ } // sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64. -func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Int64Slice() if len(s) == 0 { return 0 @@ -4140,7 +4140,7 @@ func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (si } // appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64. -func appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Int64Slice() if len(s) == 0 { return b, nil @@ -4162,25 +4162,25 @@ var coderSfixed64PackedSlice = pointerCoderFuncs{ } // sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64. -func sizeSfixed64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeSfixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeFixed64() } // appendSfixed64Value encodes a int64 value as a Sfixed64. -func appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendFixed64(b, uint64(v.Int())) return b, nil } // consumeSfixed64Value decodes a int64 value as a Sfixed64. -func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfInt64(int64(v)), out, nil @@ -4194,14 +4194,14 @@ var coderSfixed64Value = valueCoderFuncs{ } // sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64. -func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() size = list.Len() * (tagsize + protowire.SizeFixed64()) return size } // appendSfixed64SliceValue encodes a []int64 value as a repeated Sfixed64. -func appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -4212,17 +4212,17 @@ func appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64 } // consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64. -func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt64(int64(v))) b = b[n:] @@ -4235,7 +4235,7 @@ func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.N } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfInt64(int64(v))) out.n = n @@ -4250,7 +4250,7 @@ var coderSfixed64SliceValue = valueCoderFuncs{ } // sizeSfixed64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sfixed64. -func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -4261,7 +4261,7 @@ func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marsh } // appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64. -func appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -4285,13 +4285,13 @@ var coderSfixed64PackedSliceValue = valueCoderFuncs{ } // sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64. -func sizeFixed64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed64() } // appendFixed64 wire encodes a uint64 pointer as a Fixed64. -func appendFixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint64() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed64(b, v) @@ -4299,13 +4299,13 @@ func appendFixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([] } // consumeFixed64 wire decodes a uint64 pointer as a Fixed64. -func consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Uint64() = v out.n = n @@ -4321,7 +4321,7 @@ var coderFixed64 = pointerCoderFuncs{ // sizeFixed64NoZero returns the size of wire encoding a uint64 pointer as a Fixed64. // The zero value is not encoded. -func sizeFixed64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Uint64() if v == 0 { return 0 @@ -4331,7 +4331,7 @@ func sizeFixed64NoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int // appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64. // The zero value is not encoded. -func appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Uint64() if v == 0 { return b, nil @@ -4350,13 +4350,13 @@ var coderFixed64NoZero = pointerCoderFuncs{ // sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64. // It panics if the pointer is nil. -func sizeFixed64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed64() } // appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64. // It panics if the pointer is nil. -func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Uint64Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed64(b, v) @@ -4364,13 +4364,13 @@ func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64. -func consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Uint64Ptr() if *vp == nil { @@ -4389,14 +4389,14 @@ var coderFixed64Ptr = pointerCoderFuncs{ } // sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64. -func sizeFixed64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint64Slice() size = len(s) * (f.tagsize + protowire.SizeFixed64()) return size } // appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64. -func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint64Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -4406,18 +4406,18 @@ func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions } // consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64. -func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Uint64Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, v) b = b[n:] @@ -4431,7 +4431,7 @@ func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderField } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, v) out.n = n @@ -4446,7 +4446,7 @@ var coderFixed64Slice = pointerCoderFuncs{ } // sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64. -func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Uint64Slice() if len(s) == 0 { return 0 @@ -4456,7 +4456,7 @@ func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (siz } // appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64. -func appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Uint64Slice() if len(s) == 0 { return b, nil @@ -4478,25 +4478,25 @@ var coderFixed64PackedSlice = pointerCoderFuncs{ } // sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64. -func sizeFixed64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeFixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeFixed64() } // appendFixed64Value encodes a uint64 value as a Fixed64. -func appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendFixed64(b, v.Uint()) return b, nil } // consumeFixed64Value decodes a uint64 value as a Fixed64. -func consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfUint64(v), out, nil @@ -4510,14 +4510,14 @@ var coderFixed64Value = valueCoderFuncs{ } // sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64. -func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() size = list.Len() * (tagsize + protowire.SizeFixed64()) return size } // appendFixed64SliceValue encodes a []uint64 value as a repeated Fixed64. -func appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -4528,17 +4528,17 @@ func appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64. -func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint64(v)) b = b[n:] @@ -4551,7 +4551,7 @@ func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Nu } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfUint64(v)) out.n = n @@ -4566,7 +4566,7 @@ var coderFixed64SliceValue = valueCoderFuncs{ } // sizeFixed64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Fixed64. -func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -4577,7 +4577,7 @@ func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, _ marsha } // appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64. -func appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -4601,13 +4601,13 @@ var coderFixed64PackedSliceValue = valueCoderFuncs{ } // sizeDouble returns the size of wire encoding a float64 pointer as a Double. -func sizeDouble(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeDouble(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed64() } // appendDouble wire encodes a float64 pointer as a Double. -func appendDouble(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendDouble(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Float64() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed64(b, math.Float64bits(v)) @@ -4615,13 +4615,13 @@ func appendDouble(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]b } // consumeDouble wire decodes a float64 pointer as a Double. -func consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Float64() = math.Float64frombits(v) out.n = n @@ -4637,7 +4637,7 @@ var coderDouble = pointerCoderFuncs{ // sizeDoubleNoZero returns the size of wire encoding a float64 pointer as a Double. // The zero value is not encoded. -func sizeDoubleNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeDoubleNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Float64() if v == 0 && !math.Signbit(float64(v)) { return 0 @@ -4647,7 +4647,7 @@ func sizeDoubleNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendDoubleNoZero wire encodes a float64 pointer as a Double. // The zero value is not encoded. -func appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Float64() if v == 0 && !math.Signbit(float64(v)) { return b, nil @@ -4666,13 +4666,13 @@ var coderDoubleNoZero = pointerCoderFuncs{ // sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double. // It panics if the pointer is nil. -func sizeDoublePtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeDoublePtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { return f.tagsize + protowire.SizeFixed64() } // appendDoublePtr wire encodes a *float64 pointer as a Double. // It panics if the pointer is nil. -func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.Float64Ptr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendFixed64(b, math.Float64bits(v)) @@ -4680,13 +4680,13 @@ func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeDoublePtr wire decodes a *float64 pointer as a Double. -func consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.Float64Ptr() if *vp == nil { @@ -4705,14 +4705,14 @@ var coderDoublePtr = pointerCoderFuncs{ } // sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double. -func sizeDoubleSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeDoubleSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Float64Slice() size = len(s) * (f.tagsize + protowire.SizeFixed64()) return size } // appendDoubleSlice encodes a []float64 pointer as a repeated Double. -func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Float64Slice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -4722,18 +4722,18 @@ func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double. -func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.Float64Slice() if wtyp == protowire.BytesType { s := *sp b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } s = append(s, math.Float64frombits(v)) b = b[n:] @@ -4747,7 +4747,7 @@ func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, math.Float64frombits(v)) out.n = n @@ -4762,7 +4762,7 @@ var coderDoubleSlice = pointerCoderFuncs{ } // sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double. -func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.Float64Slice() if len(s) == 0 { return 0 @@ -4772,7 +4772,7 @@ func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size } // appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double. -func appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.Float64Slice() if len(s) == 0 { return b, nil @@ -4794,25 +4794,25 @@ var coderDoublePackedSlice = pointerCoderFuncs{ } // sizeDoubleValue returns the size of wire encoding a float64 value as a Double. -func sizeDoubleValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeDoubleValue(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeFixed64() } // appendDoubleValue encodes a float64 value as a Double. -func appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendFixed64(b, math.Float64bits(v.Float())) return b, nil } // consumeDoubleValue decodes a float64 value as a Double. -func consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.Fixed64Type { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil @@ -4826,14 +4826,14 @@ var coderDoubleValue = valueCoderFuncs{ } // sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double. -func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() size = list.Len() * (tagsize + protowire.SizeFixed64()) return size } // appendDoubleSliceValue encodes a []float64 value as a repeated Double. -func appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -4844,17 +4844,17 @@ func appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double. -func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) b = b[n:] @@ -4867,7 +4867,7 @@ func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Num } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) out.n = n @@ -4882,7 +4882,7 @@ var coderDoubleSliceValue = valueCoderFuncs{ } // sizeDoublePackedSliceValue returns the size of wire encoding a []float64 value as a packed repeated Double. -func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() llen := list.Len() if llen == 0 { @@ -4893,7 +4893,7 @@ func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, _ marshal } // appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double. -func appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() llen := list.Len() if llen == 0 { @@ -4917,13 +4917,13 @@ var coderDoublePackedSliceValue = valueCoderFuncs{ } // sizeString returns the size of wire encoding a string pointer as a String. -func sizeString(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeString(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.String() return f.tagsize + protowire.SizeBytes(len(v)) } // appendString wire encodes a string pointer as a String. -func appendString(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendString(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.String() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendString(b, v) @@ -4931,15 +4931,15 @@ func appendString(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]b } // consumeString wire decodes a string pointer as a String. -func consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } - *p.String() = v + *p.String() = string(v) out.n = n return out, nil } @@ -4952,7 +4952,7 @@ var coderString = pointerCoderFuncs{ } // appendStringValidateUTF8 wire encodes a string pointer as a String. -func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.String() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendString(b, v) @@ -4963,18 +4963,18 @@ func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalO } // consumeStringValidateUTF8 wire decodes a string pointer as a String. -func consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } - if !utf8.ValidString(v) { + if !utf8.Valid(v) { return out, errInvalidUTF8{} } - *p.String() = v + *p.String() = string(v) out.n = n return out, nil } @@ -4988,7 +4988,7 @@ var coderStringValidateUTF8 = pointerCoderFuncs{ // sizeStringNoZero returns the size of wire encoding a string pointer as a String. // The zero value is not encoded. -func sizeStringNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeStringNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.String() if len(v) == 0 { return 0 @@ -4998,7 +4998,7 @@ func sizeStringNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendStringNoZero wire encodes a string pointer as a String. // The zero value is not encoded. -func appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.String() if len(v) == 0 { return b, nil @@ -5017,7 +5017,7 @@ var coderStringNoZero = pointerCoderFuncs{ // appendStringNoZeroValidateUTF8 wire encodes a string pointer as a String. // The zero value is not encoded. -func appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.String() if len(v) == 0 { return b, nil @@ -5039,14 +5039,14 @@ var coderStringNoZeroValidateUTF8 = pointerCoderFuncs{ // sizeStringPtr returns the size of wire encoding a *string pointer as a String. // It panics if the pointer is nil. -func sizeStringPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeStringPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := **p.StringPtr() return f.tagsize + protowire.SizeBytes(len(v)) } // appendStringPtr wire encodes a *string pointer as a String. // It panics if the pointer is nil. -func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.StringPtr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendString(b, v) @@ -5054,19 +5054,19 @@ func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ( } // consumeStringPtr wire decodes a *string pointer as a String. -func consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } vp := p.StringPtr() if *vp == nil { *vp = new(string) } - **vp = v + **vp = string(v) out.n = n return out, nil } @@ -5080,7 +5080,7 @@ var coderStringPtr = pointerCoderFuncs{ // appendStringPtrValidateUTF8 wire encodes a *string pointer as a String. // It panics if the pointer is nil. -func appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := **p.StringPtr() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendString(b, v) @@ -5091,22 +5091,22 @@ func appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marsh } // consumeStringPtrValidateUTF8 wire decodes a *string pointer as a String. -func consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } - if !utf8.ValidString(v) { + if !utf8.Valid(v) { return out, errInvalidUTF8{} } vp := p.StringPtr() if *vp == nil { *vp = new(string) } - **vp = v + **vp = string(v) out.n = n return out, nil } @@ -5119,7 +5119,7 @@ var coderStringPtrValidateUTF8 = pointerCoderFuncs{ } // sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String. -func sizeStringSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeStringSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.StringSlice() for _, v := range s { size += f.tagsize + protowire.SizeBytes(len(v)) @@ -5128,7 +5128,7 @@ func sizeStringSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) } // appendStringSlice encodes a []string pointer as a repeated String. -func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.StringSlice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -5138,16 +5138,16 @@ func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeStringSlice wire decodes a []string pointer as a repeated String. -func consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.StringSlice() if wtyp != protowire.BytesType { return out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } - *sp = append(*sp, v) + *sp = append(*sp, string(v)) out.n = n return out, nil } @@ -5160,7 +5160,7 @@ var coderStringSlice = pointerCoderFuncs{ } // appendStringSliceValidateUTF8 encodes a []string pointer as a repeated String. -func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.StringSlice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -5173,19 +5173,19 @@ func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ mar } // consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String. -func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.StringSlice() +func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } - if !utf8.ValidString(v) { + if !utf8.Valid(v) { return out, errInvalidUTF8{} } - *sp = append(*sp, v) + sp := p.StringSlice() + *sp = append(*sp, string(v)) out.n = n return out, nil } @@ -5198,25 +5198,25 @@ var coderStringSliceValidateUTF8 = pointerCoderFuncs{ } // sizeStringValue returns the size of wire encoding a string value as a String. -func sizeStringValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeStringValue(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeBytes(len(v.String())) } // appendStringValue encodes a string value as a String. -func appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendString(b, v.String()) return b, nil } // consumeStringValue decodes a string value as a String. -func consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return protoreflect.Value{}, out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfString(string(v)), out, nil @@ -5230,7 +5230,7 @@ var coderStringValue = valueCoderFuncs{ } // appendStringValueValidateUTF8 encodes a string value as a String. -func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendString(b, v.String()) if !utf8.ValidString(v.String()) { @@ -5240,15 +5240,15 @@ func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint6 } // consumeStringValueValidateUTF8 decodes a string value as a String. -func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return protoreflect.Value{}, out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } - if !utf8.ValidString(v) { + if !utf8.Valid(v) { return protoreflect.Value{}, out, errInvalidUTF8{} } out.n = n @@ -5263,7 +5263,7 @@ var coderStringValueValidateUTF8 = valueCoderFuncs{ } // sizeStringSliceValue returns the size of wire encoding a []string value as a repeated String. -func sizeStringSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeStringSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -5273,7 +5273,7 @@ func sizeStringSliceValue(listv protoreflect.Value, tagsize int, _ marshalOption } // appendStringSliceValue encodes a []string value as a repeated String. -func appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -5284,14 +5284,14 @@ func appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, } // consumeStringSliceValue wire decodes a []string value as a repeated String. -func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp != protowire.BytesType { return protoreflect.Value{}, out, errUnknown } - v, n := protowire.ConsumeString(b) + v, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfString(string(v))) out.n = n @@ -5306,13 +5306,13 @@ var coderStringSliceValue = valueCoderFuncs{ } // sizeBytes returns the size of wire encoding a []byte pointer as a Bytes. -func sizeBytes(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Bytes() return f.tagsize + protowire.SizeBytes(len(v)) } // appendBytes wire encodes a []byte pointer as a Bytes. -func appendBytes(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBytes(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Bytes() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendBytes(b, v) @@ -5320,13 +5320,13 @@ func appendBytes(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]by } // consumeBytes wire decodes a []byte pointer as a Bytes. -func consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Bytes() = append(emptyBuf[:], v...) out.n = n @@ -5341,7 +5341,7 @@ var coderBytes = pointerCoderFuncs{ } // appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes. -func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Bytes() b = protowire.AppendVarint(b, f.wiretag) b = protowire.AppendBytes(b, v) @@ -5352,13 +5352,13 @@ func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOp } // consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes. -func consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if !utf8.Valid(v) { return out, errInvalidUTF8{} @@ -5377,7 +5377,7 @@ var coderBytesValidateUTF8 = pointerCoderFuncs{ // sizeBytesNoZero returns the size of wire encoding a []byte pointer as a Bytes. // The zero value is not encoded. -func sizeBytesNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { v := *p.Bytes() if len(v) == 0 { return 0 @@ -5387,7 +5387,7 @@ func sizeBytesNoZero(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) // appendBytesNoZero wire encodes a []byte pointer as a Bytes. // The zero value is not encoded. -func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Bytes() if len(v) == 0 { return b, nil @@ -5399,13 +5399,13 @@ func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) // consumeBytesNoZero wire decodes a []byte pointer as a Bytes. // The zero value is not decoded. -func consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *p.Bytes() = append(([]byte)(nil), v...) out.n = n @@ -5421,7 +5421,7 @@ var coderBytesNoZero = pointerCoderFuncs{ // appendBytesNoZeroValidateUTF8 wire encodes a []byte pointer as a Bytes. // The zero value is not encoded. -func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { v := *p.Bytes() if len(v) == 0 { return b, nil @@ -5435,13 +5435,13 @@ func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ mar } // consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes. -func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if !utf8.Valid(v) { return out, errInvalidUTF8{} @@ -5459,7 +5459,7 @@ var coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{ } // sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes. -func sizeBytesSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { +func sizeBytesSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) { s := *p.BytesSlice() for _, v := range s { size += f.tagsize + protowire.SizeBytes(len(v)) @@ -5468,7 +5468,7 @@ func sizeBytesSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) { } // appendBytesSlice encodes a [][]byte pointer as a repeated Bytes. -func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.BytesSlice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -5478,14 +5478,14 @@ func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) } // consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes. -func consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { +func consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { sp := p.BytesSlice() if wtyp != protowire.BytesType { return out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } *sp = append(*sp, append(emptyBuf[:], v...)) out.n = n @@ -5500,7 +5500,7 @@ var coderBytesSlice = pointerCoderFuncs{ } // appendBytesSliceValidateUTF8 encodes a [][]byte pointer as a repeated Bytes. -func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) { +func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { s := *p.BytesSlice() for _, v := range s { b = protowire.AppendVarint(b, f.wiretag) @@ -5513,18 +5513,18 @@ func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ mars } // consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes. -func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) { - sp := p.BytesSlice() +func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if !utf8.Valid(v) { return out, errInvalidUTF8{} } + sp := p.BytesSlice() *sp = append(*sp, append(emptyBuf[:], v...)) out.n = n return out, nil @@ -5538,25 +5538,25 @@ var coderBytesSliceValidateUTF8 = pointerCoderFuncs{ } // sizeBytesValue returns the size of wire encoding a []byte value as a Bytes. -func sizeBytesValue(v protoreflect.Value, tagsize int, _ marshalOptions) int { +func sizeBytesValue(v protoreflect.Value, tagsize int, opts marshalOptions) int { return tagsize + protowire.SizeBytes(len(v.Bytes())) } // appendBytesValue encodes a []byte value as a Bytes. -func appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { b = protowire.AppendVarint(b, wiretag) b = protowire.AppendBytes(b, v.Bytes()) return b, nil } // consumeBytesValue decodes a []byte value as a Bytes. -func consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { if wtyp != protowire.BytesType { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } out.n = n return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil @@ -5570,7 +5570,7 @@ var coderBytesValue = valueCoderFuncs{ } // sizeBytesSliceValue returns the size of wire encoding a [][]byte value as a repeated Bytes. -func sizeBytesSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) { +func sizeBytesSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -5580,7 +5580,7 @@ func sizeBytesSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions } // appendBytesSliceValue encodes a [][]byte value as a repeated Bytes. -func appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) { +func appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) { list := listv.List() for i, llen := 0, list.Len(); i < llen; i++ { v := list.Get(i) @@ -5591,14 +5591,14 @@ func appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, _ } // consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes. -func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { +func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) { list := listv.List() if wtyp != protowire.BytesType { return protoreflect.Value{}, out, errUnknown } v, n := protowire.ConsumeBytes(b) if n < 0 { - return protoreflect.Value{}, out, protowire.ParseError(n) + return protoreflect.Value{}, out, errDecode } list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...))) out.n = n diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go index 44885a76..c1245fef 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go @@ -5,7 +5,6 @@ package impl import ( - "errors" "reflect" "sort" @@ -118,7 +117,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo } b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } var ( key = mapi.keyZero @@ -127,10 +126,10 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo for len(b) > 0 { num, wtyp, n := protowire.ConsumeTag(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if num > protowire.MaxValidNumber { - return out, errors.New("invalid field number") + return out, errDecode } b = b[n:] err := errUnknown @@ -157,7 +156,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo if err == errUnknown { n = protowire.ConsumeFieldValue(num, wtyp, b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } } else if err != nil { return out, err @@ -175,7 +174,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi } b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } var ( key = mapi.keyZero @@ -184,10 +183,10 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi for len(b) > 0 { num, wtyp, n := protowire.ConsumeTag(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if num > protowire.MaxValidNumber { - return out, errors.New("invalid field number") + return out, errDecode } b = b[n:] err := errUnknown @@ -208,7 +207,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi var v []byte v, n = protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } var o unmarshalOutput o, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts) @@ -221,7 +220,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi if err == errUnknown { n = protowire.ConsumeFieldValue(num, wtyp, b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } } else if err != nil { return out, err diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go index 0e176d56..cd40527f 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go @@ -11,7 +11,7 @@ import ( "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/fieldsort" + "google.golang.org/protobuf/internal/order" pref "google.golang.org/protobuf/reflect/protoreflect" piface "google.golang.org/protobuf/runtime/protoiface" ) @@ -27,6 +27,7 @@ type coderMessageInfo struct { coderFields map[protowire.Number]*coderFieldInfo sizecacheOffset offset unknownOffset offset + unknownPtrKind bool extensionOffset offset needsInitCheck bool isMessageSet bool @@ -47,9 +48,20 @@ type coderFieldInfo struct { } func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { - mi.sizecacheOffset = si.sizecacheOffset - mi.unknownOffset = si.unknownOffset - mi.extensionOffset = si.extensionOffset + mi.sizecacheOffset = invalidOffset + mi.unknownOffset = invalidOffset + mi.extensionOffset = invalidOffset + + if si.sizecacheOffset.IsValid() && si.sizecacheType == sizecacheType { + mi.sizecacheOffset = si.sizecacheOffset + } + if si.unknownOffset.IsValid() && (si.unknownType == unknownFieldsAType || si.unknownType == unknownFieldsBType) { + mi.unknownOffset = si.unknownOffset + mi.unknownPtrKind = si.unknownType.Kind() == reflect.Ptr + } + if si.extensionOffset.IsValid() && si.extensionType == extensionFieldsType { + mi.extensionOffset = si.extensionOffset + } mi.coderFields = make(map[protowire.Number]*coderFieldInfo) fields := mi.Desc.Fields() @@ -73,6 +85,27 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { var funcs pointerCoderFuncs var childMessage *MessageInfo switch { + case ft == nil: + // This never occurs for generated message types. + // It implies that a hand-crafted type has missing Go fields + // for specific protobuf message fields. + funcs = pointerCoderFuncs{ + size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int { + return 0 + }, + marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { + return nil, nil + }, + unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) { + panic("missing Go struct field for " + string(fd.FullName())) + }, + isInit: func(p pointer, f *coderFieldInfo) error { + panic("missing Go struct field for " + string(fd.FullName())) + }, + merge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) { + panic("missing Go struct field for " + string(fd.FullName())) + }, + } case isOneof: fieldOffset = offsetOf(fs, mi.Exporter) case fd.IsWeak(): @@ -136,7 +169,7 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { sort.Slice(mi.orderedCoderFields, func(i, j int) bool { fi := fields.ByNumber(mi.orderedCoderFields[i].num) fj := fields.ByNumber(mi.orderedCoderFields[j].num) - return fieldsort.Less(fi, fj) + return order.LegacyFieldOrder(fi, fj) }) } @@ -157,3 +190,28 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) { mi.methods.Merge = mi.merge } } + +// getUnknownBytes returns a *[]byte for the unknown fields. +// It is the caller's responsibility to check whether the pointer is nil. +// This function is specially designed to be inlineable. +func (mi *MessageInfo) getUnknownBytes(p pointer) *[]byte { + if mi.unknownPtrKind { + return *p.Apply(mi.unknownOffset).BytesPtr() + } else { + return p.Apply(mi.unknownOffset).Bytes() + } +} + +// mutableUnknownBytes returns a *[]byte for the unknown fields. +// The returned pointer is guaranteed to not be nil. +func (mi *MessageInfo) mutableUnknownBytes(p pointer) *[]byte { + if mi.unknownPtrKind { + bp := p.Apply(mi.unknownOffset).BytesPtr() + if *bp == nil { + *bp = new([]byte) + } + return *bp + } else { + return p.Apply(mi.unknownOffset).Bytes() + } +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go index cfb68e12..b7a23faf 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go @@ -29,8 +29,9 @@ func sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int) size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts) } - unknown := *p.Apply(mi.unknownOffset).Bytes() - size += messageset.SizeUnknown(unknown) + if u := mi.getUnknownBytes(p); u != nil { + size += messageset.SizeUnknown(*u) + } return size } @@ -69,10 +70,12 @@ func marshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts marshalOptions } } - unknown := *p.Apply(mi.unknownOffset).Bytes() - b, err := messageset.AppendUnknown(b, unknown) - if err != nil { - return b, err + if u := mi.getUnknownBytes(p); u != nil { + var err error + b, err = messageset.AppendUnknown(b, *u) + if err != nil { + return b, err + } } return b, nil @@ -100,13 +103,13 @@ func unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOpt *ep = make(map[int32]ExtensionField) } ext := *ep - unknown := p.Apply(mi.unknownOffset).Bytes() initialized := true err = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error { o, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts) if err == errUnknown { - *unknown = protowire.AppendTag(*unknown, num, protowire.BytesType) - *unknown = append(*unknown, v...) + u := mi.mutableUnknownBytes(p) + *u = protowire.AppendTag(*u, num, protowire.BytesType) + *u = append(*u, v...) return nil } if !o.initialized { diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go index 86f7dc3c..90705e3a 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go @@ -30,7 +30,7 @@ func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ } v, n := protowire.ConsumeVarint(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } p.v.Elem().SetInt(int64(v)) out.n = n @@ -130,12 +130,12 @@ func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf if wtyp == protowire.BytesType { b, n := protowire.ConsumeBytes(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } for len(b) > 0 { v, n := protowire.ConsumeVarint(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } rv := reflect.New(s.Type().Elem()).Elem() rv.SetInt(int64(v)) @@ -150,7 +150,7 @@ func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf } v, n := protowire.ConsumeVarint(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } rv := reflect.New(s.Type().Elem()).Elem() rv.SetInt(int64(v)) diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go index 36a90dff..acd61bb5 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/convert.go +++ b/vendor/google.golang.org/protobuf/internal/impl/convert.go @@ -423,6 +423,13 @@ func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value { if v.Type() != c.goType { panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType)) } + if c.isNonPointer() { + if v.CanAddr() { + v = v.Addr() // T => *T + } else { + v = reflect.Zero(reflect.PtrTo(v.Type())) + } + } if m, ok := v.Interface().(pref.ProtoMessage); ok { return pref.ValueOfMessage(m.ProtoReflect()) } @@ -437,6 +444,16 @@ func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value { } else { rv = reflect.ValueOf(m.Interface()) } + if c.isNonPointer() { + if rv.Type() != reflect.PtrTo(c.goType) { + panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), reflect.PtrTo(c.goType))) + } + if !rv.IsNil() { + rv = rv.Elem() // *T => T + } else { + rv = reflect.Zero(rv.Type().Elem()) + } + } if rv.Type() != c.goType { panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), c.goType)) } @@ -451,6 +468,9 @@ func (c *messageConverter) IsValidPB(v pref.Value) bool { } else { rv = reflect.ValueOf(m.Interface()) } + if c.isNonPointer() { + return rv.Type() == reflect.PtrTo(c.goType) + } return rv.Type() == c.goType } @@ -459,9 +479,18 @@ func (c *messageConverter) IsValidGo(v reflect.Value) bool { } func (c *messageConverter) New() pref.Value { + if c.isNonPointer() { + return c.PBValueOf(reflect.New(c.goType).Elem()) + } return c.PBValueOf(reflect.New(c.goType.Elem())) } func (c *messageConverter) Zero() pref.Value { return c.PBValueOf(reflect.Zero(c.goType)) } + +// isNonPointer reports whether the type is a non-pointer type. +// This never occurs for generated message types. +func (c *messageConverter) isNonPointer() bool { + return c.goType.Kind() != reflect.Ptr +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/decode.go b/vendor/google.golang.org/protobuf/internal/impl/decode.go index 85ba1d3b..949dc49a 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/decode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/decode.go @@ -17,6 +17,8 @@ import ( piface "google.golang.org/protobuf/runtime/protoiface" ) +var errDecode = errors.New("cannot parse invalid wire-format data") + type unmarshalOptions struct { flags protoiface.UnmarshalInputFlags resolver interface { @@ -100,13 +102,13 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire. var n int tag, n = protowire.ConsumeVarint(b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } b = b[n:] } var num protowire.Number if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) { - return out, errors.New("invalid field number") + return out, errDecode } else { num = protowire.Number(n) } @@ -114,7 +116,7 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire. if wtyp == protowire.EndGroupType { if num != groupTag { - return out, errors.New("mismatching end group marker") + return out, errDecode } groupTag = 0 break @@ -170,10 +172,10 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire. } n = protowire.ConsumeFieldValue(num, wtyp, b) if n < 0 { - return out, protowire.ParseError(n) + return out, errDecode } if !opts.DiscardUnknown() && mi.unknownOffset.IsValid() { - u := p.Apply(mi.unknownOffset).Bytes() + u := mi.mutableUnknownBytes(p) *u = protowire.AppendTag(*u, num, wtyp) *u = append(*u, b[:n]...) } @@ -181,7 +183,7 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire. b = b[n:] } if groupTag != 0 { - return out, errors.New("missing end group marker") + return out, errDecode } if mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) { initialized = false @@ -221,7 +223,7 @@ func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp p return out, nil } case ValidationInvalid: - return out, errors.New("invalid wire format") + return out, errDecode case ValidationUnknown: } } diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go index 8c8a794c..845c67d6 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/encode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/encode.go @@ -79,8 +79,9 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int size += f.funcs.size(fptr, f, opts) } if mi.unknownOffset.IsValid() { - u := *p.Apply(mi.unknownOffset).Bytes() - size += len(u) + if u := mi.getUnknownBytes(p); u != nil { + size += len(*u) + } } if mi.sizecacheOffset.IsValid() { if size > math.MaxInt32 { @@ -141,8 +142,9 @@ func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOpt } } if mi.unknownOffset.IsValid() && !mi.isMessageSet { - u := *p.Apply(mi.unknownOffset).Bytes() - b = append(b, u...) + if u := mi.getUnknownBytes(p); u != nil { + b = append(b, (*u)...) + } } return b, nil } diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go index c3d741c2..e3fb0b57 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go @@ -30,7 +30,7 @@ func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.M if mv := (Export{}).protoMessageV2Of(m); mv != nil { return mv.ProtoReflect().Type() } - return legacyLoadMessageInfo(reflect.TypeOf(m), name) + return legacyLoadMessageType(reflect.TypeOf(m), name) } // UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input. diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go index 61757ce5..49e72316 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go @@ -154,7 +154,8 @@ func (x placeholderExtension) Number() pref.FieldNumber { retu func (x placeholderExtension) Cardinality() pref.Cardinality { return 0 } func (x placeholderExtension) Kind() pref.Kind { return 0 } func (x placeholderExtension) HasJSONName() bool { return false } -func (x placeholderExtension) JSONName() string { return "" } +func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" } +func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" } func (x placeholderExtension) HasPresence() bool { return false } func (x placeholderExtension) HasOptionalKeyword() bool { return false } func (x placeholderExtension) IsExtension() bool { return true } diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go index 06c68e11..029feeef 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go @@ -24,14 +24,24 @@ import ( // legacyWrapMessage wraps v as a protoreflect.Message, // where v must be a *struct kind and not implement the v2 API already. func legacyWrapMessage(v reflect.Value) pref.Message { - typ := v.Type() - if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct { + t := v.Type() + if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct { return aberrantMessage{v: v} } - mt := legacyLoadMessageInfo(typ, "") + mt := legacyLoadMessageInfo(t, "") return mt.MessageOf(v.Interface()) } +// legacyLoadMessageType dynamically loads a protoreflect.Type for t, +// where t must be not implement the v2 API already. +// The provided name is used if it cannot be determined from the message. +func legacyLoadMessageType(t reflect.Type, name pref.FullName) protoreflect.MessageType { + if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct { + return aberrantMessageType{t} + } + return legacyLoadMessageInfo(t, name) +} + var legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo // legacyLoadMessageInfo dynamically loads a *MessageInfo for t, @@ -49,8 +59,9 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo { GoReflectType: t, } + var hasMarshal, hasUnmarshal bool v := reflect.Zero(t).Interface() - if _, ok := v.(legacyMarshaler); ok { + if _, hasMarshal = v.(legacyMarshaler); hasMarshal { mi.methods.Marshal = legacyMarshal // We have no way to tell whether the type's Marshal method @@ -59,10 +70,10 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo { // calling Marshal methods when present. mi.methods.Flags |= piface.SupportMarshalDeterministic } - if _, ok := v.(legacyUnmarshaler); ok { + if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal { mi.methods.Unmarshal = legacyUnmarshal } - if _, ok := v.(legacyMerger); ok { + if _, hasMerge := v.(legacyMerger); hasMerge || (hasMarshal && hasUnmarshal) { mi.methods.Merge = legacyMerge } @@ -75,7 +86,7 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo { var legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDescriptor // LegacyLoadMessageDesc returns an MessageDescriptor derived from the Go type, -// which must be a *struct kind and not implement the v2 API already. +// which should be a *struct kind and must not implement the v2 API already. // // This is exported for testing purposes. func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor { @@ -114,17 +125,19 @@ func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescr // If the Go type has no fields, then this might be a proto3 empty message // from before the size cache was added. If there are any fields, check to // see that at least one of them looks like something we generated. - if nfield := t.Elem().NumField(); nfield > 0 { - hasProtoField := false - for i := 0; i < nfield; i++ { - f := t.Elem().Field(i) - if f.Tag.Get("protobuf") != "" || f.Tag.Get("protobuf_oneof") != "" || strings.HasPrefix(f.Name, "XXX_") { - hasProtoField = true - break + if t.Elem().Kind() == reflect.Struct { + if nfield := t.Elem().NumField(); nfield > 0 { + hasProtoField := false + for i := 0; i < nfield; i++ { + f := t.Elem().Field(i) + if f.Tag.Get("protobuf") != "" || f.Tag.Get("protobuf_oneof") != "" || strings.HasPrefix(f.Name, "XXX_") { + hasProtoField = true + break + } + } + if !hasProtoField { + return aberrantLoadMessageDesc(t, name) } - } - if !hasProtoField { - return aberrantLoadMessageDesc(t, name) } } @@ -370,7 +383,7 @@ type legacyMerger interface { Merge(protoiface.MessageV1) } -var legacyProtoMethods = &piface.Methods{ +var aberrantProtoMethods = &piface.Methods{ Marshal: legacyMarshal, Unmarshal: legacyUnmarshal, Merge: legacyMerge, @@ -401,18 +414,47 @@ func legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) { v := in.Message.(unwrapper).protoUnwrap() unmarshaler, ok := v.(legacyUnmarshaler) if !ok { - return piface.UnmarshalOutput{}, errors.New("%T does not implement Marshal", v) + return piface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v) } return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf) } func legacyMerge(in piface.MergeInput) piface.MergeOutput { + // Check whether this supports the legacy merger. dstv := in.Destination.(unwrapper).protoUnwrap() merger, ok := dstv.(legacyMerger) + if ok { + merger.Merge(Export{}.ProtoMessageV1Of(in.Source)) + return piface.MergeOutput{Flags: piface.MergeComplete} + } + + // If legacy merger is unavailable, implement merge in terms of + // a marshal and unmarshal operation. + srcv := in.Source.(unwrapper).protoUnwrap() + marshaler, ok := srcv.(legacyMarshaler) if !ok { return piface.MergeOutput{} } - merger.Merge(Export{}.ProtoMessageV1Of(in.Source)) + dstv = in.Destination.(unwrapper).protoUnwrap() + unmarshaler, ok := dstv.(legacyUnmarshaler) + if !ok { + return piface.MergeOutput{} + } + if !in.Source.IsValid() { + // Legacy Marshal methods may not function on nil messages. + // Check for a typed nil source only after we confirm that + // legacy Marshal/Unmarshal methods are present, for + // consistency. + return piface.MergeOutput{Flags: piface.MergeComplete} + } + b, err := marshaler.Marshal() + if err != nil { + return piface.MergeOutput{} + } + err = unmarshaler.Unmarshal(b) + if err != nil { + return piface.MergeOutput{} + } return piface.MergeOutput{Flags: piface.MergeComplete} } @@ -422,6 +464,9 @@ type aberrantMessageType struct { } func (mt aberrantMessageType) New() pref.Message { + if mt.t.Kind() == reflect.Ptr { + return aberrantMessage{reflect.New(mt.t.Elem())} + } return aberrantMessage{reflect.Zero(mt.t)} } func (mt aberrantMessageType) Zero() pref.Message { @@ -443,6 +488,17 @@ type aberrantMessage struct { v reflect.Value } +// Reset implements the v1 proto.Message.Reset method. +func (m aberrantMessage) Reset() { + if mr, ok := m.v.Interface().(interface{ Reset() }); ok { + mr.Reset() + return + } + if m.v.Kind() == reflect.Ptr && !m.v.IsNil() { + m.v.Elem().Set(reflect.Zero(m.v.Type().Elem())) + } +} + func (m aberrantMessage) ProtoReflect() pref.Message { return m } @@ -454,33 +510,40 @@ func (m aberrantMessage) Type() pref.MessageType { return aberrantMessageType{m.v.Type()} } func (m aberrantMessage) New() pref.Message { + if m.v.Type().Kind() == reflect.Ptr { + return aberrantMessage{reflect.New(m.v.Type().Elem())} + } return aberrantMessage{reflect.Zero(m.v.Type())} } func (m aberrantMessage) Interface() pref.ProtoMessage { return m } func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) { + return } func (m aberrantMessage) Has(pref.FieldDescriptor) bool { - panic("invalid field descriptor") + return false } func (m aberrantMessage) Clear(pref.FieldDescriptor) { - panic("invalid field descriptor") + panic("invalid Message.Clear on " + string(m.Descriptor().FullName())) } -func (m aberrantMessage) Get(pref.FieldDescriptor) pref.Value { - panic("invalid field descriptor") +func (m aberrantMessage) Get(fd pref.FieldDescriptor) pref.Value { + if fd.Default().IsValid() { + return fd.Default() + } + panic("invalid Message.Get on " + string(m.Descriptor().FullName())) } func (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) { - panic("invalid field descriptor") + panic("invalid Message.Set on " + string(m.Descriptor().FullName())) } func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value { - panic("invalid field descriptor") + panic("invalid Message.Mutable on " + string(m.Descriptor().FullName())) } func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value { - panic("invalid field descriptor") + panic("invalid Message.NewField on " + string(m.Descriptor().FullName())) } func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor { - panic("invalid oneof descriptor") + panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName())) } func (m aberrantMessage) GetUnknown() pref.RawFields { return nil @@ -489,13 +552,13 @@ func (m aberrantMessage) SetUnknown(pref.RawFields) { // SetUnknown discards its input on messages which don't support unknown field storage. } func (m aberrantMessage) IsValid() bool { - // An invalid message is a read-only, empty message. Since we don't know anything - // about the alleged contents of this message, we can't say with confidence that - // it is invalid in this sense. Therefore, report it as valid. - return true + if m.v.Kind() == reflect.Ptr { + return !m.v.IsNil() + } + return false } func (m aberrantMessage) ProtoMethods() *piface.Methods { - return legacyProtoMethods + return aberrantProtoMethods } func (m aberrantMessage) protoUnwrap() interface{} { return m.v.Interface() diff --git a/vendor/google.golang.org/protobuf/internal/impl/merge.go b/vendor/google.golang.org/protobuf/internal/impl/merge.go index cdc4267d..c65bbc04 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/merge.go +++ b/vendor/google.golang.org/protobuf/internal/impl/merge.go @@ -77,9 +77,9 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) { } } if mi.unknownOffset.IsValid() { - du := dst.Apply(mi.unknownOffset).Bytes() - su := src.Apply(mi.unknownOffset).Bytes() - if len(*su) > 0 { + su := mi.getUnknownBytes(src) + if su != nil && len(*su) > 0 { + du := mi.mutableUnknownBytes(dst) *du = append(*du, *su...) } } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go index c026a981..a104e28e 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message.go @@ -15,6 +15,7 @@ import ( "google.golang.org/protobuf/internal/genid" "google.golang.org/protobuf/reflect/protoreflect" pref "google.golang.org/protobuf/reflect/protoreflect" + preg "google.golang.org/protobuf/reflect/protoregistry" ) // MessageInfo provides protobuf related functionality for a given Go type @@ -109,22 +110,29 @@ func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) { type ( SizeCache = int32 WeakFields = map[int32]protoreflect.ProtoMessage - UnknownFields = []byte + UnknownFields = unknownFieldsA // TODO: switch to unknownFieldsB + unknownFieldsA = []byte + unknownFieldsB = *[]byte ExtensionFields = map[int32]ExtensionField ) var ( sizecacheType = reflect.TypeOf(SizeCache(0)) weakFieldsType = reflect.TypeOf(WeakFields(nil)) - unknownFieldsType = reflect.TypeOf(UnknownFields(nil)) + unknownFieldsAType = reflect.TypeOf(unknownFieldsA(nil)) + unknownFieldsBType = reflect.TypeOf(unknownFieldsB(nil)) extensionFieldsType = reflect.TypeOf(ExtensionFields(nil)) ) type structInfo struct { sizecacheOffset offset + sizecacheType reflect.Type weakOffset offset + weakType reflect.Type unknownOffset offset + unknownType reflect.Type extensionOffset offset + extensionType reflect.Type fieldsByNumber map[pref.FieldNumber]reflect.StructField oneofsByName map[pref.Name]reflect.StructField @@ -151,18 +159,22 @@ fieldLoop: case genid.SizeCache_goname, genid.SizeCacheA_goname: if f.Type == sizecacheType { si.sizecacheOffset = offsetOf(f, mi.Exporter) + si.sizecacheType = f.Type } case genid.WeakFields_goname, genid.WeakFieldsA_goname: if f.Type == weakFieldsType { si.weakOffset = offsetOf(f, mi.Exporter) + si.weakType = f.Type } case genid.UnknownFields_goname, genid.UnknownFieldsA_goname: - if f.Type == unknownFieldsType { + if f.Type == unknownFieldsAType || f.Type == unknownFieldsBType { si.unknownOffset = offsetOf(f, mi.Exporter) + si.unknownType = f.Type } case genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname: if f.Type == extensionFieldsType { si.extensionOffset = offsetOf(f, mi.Exporter) + si.extensionType = f.Type } default: for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") { @@ -212,4 +224,53 @@ func (mi *MessageInfo) New() protoreflect.Message { func (mi *MessageInfo) Zero() protoreflect.Message { return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface()) } -func (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor { return mi.Desc } +func (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor { + return mi.Desc +} +func (mi *MessageInfo) Enum(i int) protoreflect.EnumType { + mi.init() + fd := mi.Desc.Fields().Get(i) + return Export{}.EnumTypeOf(mi.fieldTypes[fd.Number()]) +} +func (mi *MessageInfo) Message(i int) protoreflect.MessageType { + mi.init() + fd := mi.Desc.Fields().Get(i) + switch { + case fd.IsWeak(): + mt, _ := preg.GlobalTypes.FindMessageByName(fd.Message().FullName()) + return mt + case fd.IsMap(): + return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]} + default: + return Export{}.MessageTypeOf(mi.fieldTypes[fd.Number()]) + } +} + +type mapEntryType struct { + desc protoreflect.MessageDescriptor + valType interface{} // zero value of enum or message type +} + +func (mt mapEntryType) New() protoreflect.Message { + return nil +} +func (mt mapEntryType) Zero() protoreflect.Message { + return nil +} +func (mt mapEntryType) Descriptor() protoreflect.MessageDescriptor { + return mt.desc +} +func (mt mapEntryType) Enum(i int) protoreflect.EnumType { + fd := mt.desc.Fields().Get(i) + if fd.Enum() == nil { + return nil + } + return Export{}.EnumTypeOf(mt.valType) +} +func (mt mapEntryType) Message(i int) protoreflect.MessageType { + fd := mt.desc.Fields().Get(i) + if fd.Message() == nil { + return nil + } + return Export{}.MessageTypeOf(mt.valType) +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go index 0f4b8db7..9488b726 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go @@ -8,6 +8,7 @@ import ( "fmt" "reflect" + "google.golang.org/protobuf/internal/detrand" "google.golang.org/protobuf/internal/pragma" pref "google.golang.org/protobuf/reflect/protoreflect" ) @@ -16,6 +17,11 @@ type reflectMessageInfo struct { fields map[pref.FieldNumber]*fieldInfo oneofs map[pref.Name]*oneofInfo + // fieldTypes contains the zero value of an enum or message field. + // For lists, it contains the element type. + // For maps, it contains the entry value type. + fieldTypes map[pref.FieldNumber]interface{} + // denseFields is a subset of fields where: // 0 < fieldDesc.Number() < len(denseFields) // It provides faster access to the fieldInfo, but may be incomplete. @@ -36,6 +42,7 @@ func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) { mi.makeKnownFieldsFunc(si) mi.makeUnknownFieldsFunc(t, si) mi.makeExtensionFieldsFunc(t, si) + mi.makeFieldTypes(si) } // makeKnownFieldsFunc generates functions for operations that can be performed @@ -51,17 +58,23 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) { for i := 0; i < fds.Len(); i++ { fd := fds.Get(i) fs := si.fieldsByNumber[fd.Number()] + isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic() + if isOneof { + fs = si.oneofsByName[fd.ContainingOneof().Name()] + } var fi fieldInfo switch { - case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): - fi = fieldInfoForOneof(fd, si.oneofsByName[fd.ContainingOneof().Name()], mi.Exporter, si.oneofWrappersByNumber[fd.Number()]) + case fs.Type == nil: + fi = fieldInfoForMissing(fd) // never occurs for officially generated message types + case isOneof: + fi = fieldInfoForOneof(fd, fs, mi.Exporter, si.oneofWrappersByNumber[fd.Number()]) case fd.IsMap(): fi = fieldInfoForMap(fd, fs, mi.Exporter) case fd.IsList(): fi = fieldInfoForList(fd, fs, mi.Exporter) case fd.IsWeak(): fi = fieldInfoForWeakMessage(fd, si.weakOffset) - case fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind: + case fd.Message() != nil: fi = fieldInfoForMessage(fd, fs, mi.Exporter) default: fi = fieldInfoForScalar(fd, fs, mi.Exporter) @@ -92,27 +105,53 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) { i++ } } + + // Introduce instability to iteration order, but keep it deterministic. + if len(mi.rangeInfos) > 1 && detrand.Bool() { + i := detrand.Intn(len(mi.rangeInfos) - 1) + mi.rangeInfos[i], mi.rangeInfos[i+1] = mi.rangeInfos[i+1], mi.rangeInfos[i] + } } func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) { - mi.getUnknown = func(pointer) pref.RawFields { return nil } - mi.setUnknown = func(pointer, pref.RawFields) { return } - if si.unknownOffset.IsValid() { + switch { + case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType: + // Handle as []byte. mi.getUnknown = func(p pointer) pref.RawFields { if p.IsNil() { return nil } - rv := p.Apply(si.unknownOffset).AsValueOf(unknownFieldsType) - return pref.RawFields(*rv.Interface().(*[]byte)) + return *p.Apply(mi.unknownOffset).Bytes() } mi.setUnknown = func(p pointer, b pref.RawFields) { if p.IsNil() { panic("invalid SetUnknown on nil Message") } - rv := p.Apply(si.unknownOffset).AsValueOf(unknownFieldsType) - *rv.Interface().(*[]byte) = []byte(b) + *p.Apply(mi.unknownOffset).Bytes() = b } - } else { + case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType: + // Handle as *[]byte. + mi.getUnknown = func(p pointer) pref.RawFields { + if p.IsNil() { + return nil + } + bp := p.Apply(mi.unknownOffset).BytesPtr() + if *bp == nil { + return nil + } + return **bp + } + mi.setUnknown = func(p pointer, b pref.RawFields) { + if p.IsNil() { + panic("invalid SetUnknown on nil Message") + } + bp := p.Apply(mi.unknownOffset).BytesPtr() + if *bp == nil { + *bp = new([]byte) + } + **bp = b + } + default: mi.getUnknown = func(pointer) pref.RawFields { return nil } @@ -139,6 +178,58 @@ func (mi *MessageInfo) makeExtensionFieldsFunc(t reflect.Type, si structInfo) { } } } +func (mi *MessageInfo) makeFieldTypes(si structInfo) { + md := mi.Desc + fds := md.Fields() + for i := 0; i < fds.Len(); i++ { + var ft reflect.Type + fd := fds.Get(i) + fs := si.fieldsByNumber[fd.Number()] + isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic() + if isOneof { + fs = si.oneofsByName[fd.ContainingOneof().Name()] + } + var isMessage bool + switch { + case fs.Type == nil: + continue // never occurs for officially generated message types + case isOneof: + if fd.Enum() != nil || fd.Message() != nil { + ft = si.oneofWrappersByNumber[fd.Number()].Field(0).Type + } + case fd.IsMap(): + if fd.MapValue().Enum() != nil || fd.MapValue().Message() != nil { + ft = fs.Type.Elem() + } + isMessage = fd.MapValue().Message() != nil + case fd.IsList(): + if fd.Enum() != nil || fd.Message() != nil { + ft = fs.Type.Elem() + } + isMessage = fd.Message() != nil + case fd.Enum() != nil: + ft = fs.Type + if fd.HasPresence() && ft.Kind() == reflect.Ptr { + ft = ft.Elem() + } + case fd.Message() != nil: + ft = fs.Type + if fd.IsWeak() { + ft = nil + } + isMessage = true + } + if isMessage && ft != nil && ft.Kind() != reflect.Ptr { + ft = reflect.PtrTo(ft) // never occurs for officially generated message types + } + if ft != nil { + if mi.fieldTypes == nil { + mi.fieldTypes = make(map[pref.FieldNumber]interface{}) + } + mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface() + } + } +} type extensionMap map[int32]ExtensionField @@ -306,7 +397,6 @@ var ( // pointer to a named Go struct. If the provided type has a ProtoReflect method, // it must be implemented by calling this method. func (mi *MessageInfo) MessageOf(m interface{}) pref.Message { - // TODO: Switch the input to be an opaque Pointer. if reflect.TypeOf(m) != mi.GoReflectType { panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType)) } @@ -320,6 +410,17 @@ func (mi *MessageInfo) MessageOf(m interface{}) pref.Message { func (m *messageReflectWrapper) pointer() pointer { return m.p } func (m *messageReflectWrapper) messageInfo() *MessageInfo { return m.mi } +// Reset implements the v1 proto.Message.Reset method. +func (m *messageIfaceWrapper) Reset() { + if mr, ok := m.protoUnwrap().(interface{ Reset() }); ok { + mr.Reset() + return + } + rv := reflect.ValueOf(m.protoUnwrap()) + if rv.Kind() == reflect.Ptr && !rv.IsNil() { + rv.Elem().Set(reflect.Zero(rv.Type().Elem())) + } +} func (m *messageIfaceWrapper) ProtoReflect() pref.Message { return (*messageReflectWrapper)(m) } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go index 23124a86..343cf872 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go @@ -28,6 +28,39 @@ type fieldInfo struct { newField func() pref.Value } +func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo { + // This never occurs for generated message types. + // It implies that a hand-crafted type has missing Go fields + // for specific protobuf message fields. + return fieldInfo{ + fieldDesc: fd, + has: func(p pointer) bool { + return false + }, + clear: func(p pointer) { + panic("missing Go struct field for " + string(fd.FullName())) + }, + get: func(p pointer) pref.Value { + return fd.Default() + }, + set: func(p pointer, v pref.Value) { + panic("missing Go struct field for " + string(fd.FullName())) + }, + mutable: func(p pointer) pref.Value { + panic("missing Go struct field for " + string(fd.FullName())) + }, + newMessage: func() pref.Message { + panic("missing Go struct field for " + string(fd.FullName())) + }, + newField: func() pref.Value { + if v := fd.Default(); v.IsValid() { + return v + } + panic("missing Go struct field for " + string(fd.FullName())) + }, + } +} + func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo { ft := fs.Type if ft.Kind() != reflect.Interface { @@ -97,7 +130,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export rv.Set(reflect.New(ot)) } rv = rv.Elem().Elem().Field(0) - if rv.IsNil() { + if rv.Kind() == reflect.Ptr && rv.IsNil() { rv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message()))) } return conv.PBValueOf(rv) @@ -225,7 +258,10 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 if nullable { if ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice { - panic(fmt.Sprintf("field %v has invalid type: got %v, want pointer", fd.FullName(), ft)) + // This never occurs for generated message types. + // Despite the protobuf type system specifying presence, + // the Go field type cannot represent it. + nullable = false } if ft.Kind() == reflect.Ptr { ft = ft.Elem() @@ -388,6 +424,9 @@ func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x expo return false } rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() + if fs.Type.Kind() != reflect.Ptr { + return !isZero(rv) + } return !rv.IsNil() }, clear: func(p pointer) { @@ -404,13 +443,13 @@ func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x expo set: func(p pointer, v pref.Value) { rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() rv.Set(conv.GoValueOf(v)) - if rv.IsNil() { + if fs.Type.Kind() == reflect.Ptr && rv.IsNil() { panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName())) } }, mutable: func(p pointer) pref.Value { rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem() - if rv.IsNil() { + if fs.Type.Kind() == reflect.Ptr && rv.IsNil() { rv.Set(conv.GoValueOf(conv.New())) } return conv.PBValueOf(rv) @@ -464,3 +503,41 @@ func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInf } return oi } + +// isZero is identical to reflect.Value.IsZero. +// TODO: Remove this when Go1.13 is the minimally supported Go version. +func isZero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return math.Float64bits(v.Float()) == 0 + case reflect.Complex64, reflect.Complex128: + c := v.Complex() + return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0 + case reflect.Array: + for i := 0; i < v.Len(); i++ { + if !isZero(v.Index(i)) { + return false + } + } + return true + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer: + return v.IsNil() + case reflect.String: + return v.Len() == 0 + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + if !isZero(v.Field(i)) { + return false + } + } + return true + default: + panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()}) + } +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go index 67b4ede6..9e3ed821 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go @@ -121,6 +121,7 @@ func (p pointer) String() *string { return p.v.Interface().(*string) } func (p pointer) StringPtr() **string { return p.v.Interface().(**string) } func (p pointer) StringSlice() *[]string { return p.v.Interface().(*[]string) } func (p pointer) Bytes() *[]byte { return p.v.Interface().(*[]byte) } +func (p pointer) BytesPtr() **[]byte { return p.v.Interface().(**[]byte) } func (p pointer) BytesSlice() *[][]byte { return p.v.Interface().(*[][]byte) } func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.v.Interface().(*WeakFields)) } func (p pointer) Extensions() *map[int32]ExtensionField { diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go index 088aa85d..9ecf23a8 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +++ b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go @@ -109,6 +109,7 @@ func (p pointer) String() *string { return (*string)(p.p) func (p pointer) StringPtr() **string { return (**string)(p.p) } func (p pointer) StringSlice() *[]string { return (*[]string)(p.p) } func (p pointer) Bytes() *[]byte { return (*[]byte)(p.p) } +func (p pointer) BytesPtr() **[]byte { return (**[]byte)(p.p) } func (p pointer) BytesSlice() *[][]byte { return (*[][]byte)(p.p) } func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.p) } func (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) } diff --git a/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go b/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go deleted file mode 100644 index a3de1cf3..00000000 --- a/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package mapsort provides sorted access to maps. -package mapsort - -import ( - "sort" - - "google.golang.org/protobuf/reflect/protoreflect" -) - -// Range iterates over every map entry in sorted key order, -// calling f for each key and value encountered. -func Range(mapv protoreflect.Map, keyKind protoreflect.Kind, f func(protoreflect.MapKey, protoreflect.Value) bool) { - var keys []protoreflect.MapKey - mapv.Range(func(key protoreflect.MapKey, _ protoreflect.Value) bool { - keys = append(keys, key) - return true - }) - sort.Slice(keys, func(i, j int) bool { - switch keyKind { - case protoreflect.BoolKind: - return !keys[i].Bool() && keys[j].Bool() - case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, - protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: - return keys[i].Int() < keys[j].Int() - case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, - protoreflect.Uint64Kind, protoreflect.Fixed64Kind: - return keys[i].Uint() < keys[j].Uint() - case protoreflect.StringKind: - return keys[i].String() < keys[j].String() - default: - panic("invalid kind: " + keyKind.String()) - } - }) - for _, key := range keys { - if !f(key, mapv.Get(key)) { - break - } - } -} diff --git a/vendor/google.golang.org/protobuf/internal/order/order.go b/vendor/google.golang.org/protobuf/internal/order/order.go new file mode 100644 index 00000000..2a24953f --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/order/order.go @@ -0,0 +1,89 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package order + +import ( + pref "google.golang.org/protobuf/reflect/protoreflect" +) + +// FieldOrder specifies the ordering to visit message fields. +// It is a function that reports whether x is ordered before y. +type FieldOrder func(x, y pref.FieldDescriptor) bool + +var ( + // AnyFieldOrder specifies no specific field ordering. + AnyFieldOrder FieldOrder = nil + + // LegacyFieldOrder sorts fields in the same ordering as emitted by + // wire serialization in the github.com/golang/protobuf implementation. + LegacyFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool { + ox, oy := x.ContainingOneof(), y.ContainingOneof() + inOneof := func(od pref.OneofDescriptor) bool { + return od != nil && !od.IsSynthetic() + } + + // Extension fields sort before non-extension fields. + if x.IsExtension() != y.IsExtension() { + return x.IsExtension() && !y.IsExtension() + } + // Fields not within a oneof sort before those within a oneof. + if inOneof(ox) != inOneof(oy) { + return !inOneof(ox) && inOneof(oy) + } + // Fields in disjoint oneof sets are sorted by declaration index. + if ox != nil && oy != nil && ox != oy { + return ox.Index() < oy.Index() + } + // Fields sorted by field number. + return x.Number() < y.Number() + } + + // NumberFieldOrder sorts fields by their field number. + NumberFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool { + return x.Number() < y.Number() + } + + // IndexNameFieldOrder sorts non-extension fields before extension fields. + // Non-extensions are sorted according to their declaration index. + // Extensions are sorted according to their full name. + IndexNameFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool { + // Non-extension fields sort before extension fields. + if x.IsExtension() != y.IsExtension() { + return !x.IsExtension() && y.IsExtension() + } + // Extensions sorted by fullname. + if x.IsExtension() && y.IsExtension() { + return x.FullName() < y.FullName() + } + // Non-extensions sorted by declaration index. + return x.Index() < y.Index() + } +) + +// KeyOrder specifies the ordering to visit map entries. +// It is a function that reports whether x is ordered before y. +type KeyOrder func(x, y pref.MapKey) bool + +var ( + // AnyKeyOrder specifies no specific key ordering. + AnyKeyOrder KeyOrder = nil + + // GenericKeyOrder sorts false before true, numeric keys in ascending order, + // and strings in lexicographical ordering according to UTF-8 codepoints. + GenericKeyOrder KeyOrder = func(x, y pref.MapKey) bool { + switch x.Interface().(type) { + case bool: + return !x.Bool() && y.Bool() + case int32, int64: + return x.Int() < y.Int() + case uint32, uint64: + return x.Uint() < y.Uint() + case string: + return x.String() < y.String() + default: + panic("invalid map key type") + } + } +) diff --git a/vendor/google.golang.org/protobuf/internal/order/range.go b/vendor/google.golang.org/protobuf/internal/order/range.go new file mode 100644 index 00000000..c8090e0c --- /dev/null +++ b/vendor/google.golang.org/protobuf/internal/order/range.go @@ -0,0 +1,115 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package order provides ordered access to messages and maps. +package order + +import ( + "sort" + "sync" + + pref "google.golang.org/protobuf/reflect/protoreflect" +) + +type messageField struct { + fd pref.FieldDescriptor + v pref.Value +} + +var messageFieldPool = sync.Pool{ + New: func() interface{} { return new([]messageField) }, +} + +type ( + // FieldRnger is an interface for visiting all fields in a message. + // The protoreflect.Message type implements this interface. + FieldRanger interface{ Range(VisitField) } + // VisitField is called everytime a message field is visited. + VisitField = func(pref.FieldDescriptor, pref.Value) bool +) + +// RangeFields iterates over the fields of fs according to the specified order. +func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) { + if less == nil { + fs.Range(fn) + return + } + + // Obtain a pre-allocated scratch buffer. + p := messageFieldPool.Get().(*[]messageField) + fields := (*p)[:0] + defer func() { + if cap(fields) < 1024 { + *p = fields + messageFieldPool.Put(p) + } + }() + + // Collect all fields in the message and sort them. + fs.Range(func(fd pref.FieldDescriptor, v pref.Value) bool { + fields = append(fields, messageField{fd, v}) + return true + }) + sort.Slice(fields, func(i, j int) bool { + return less(fields[i].fd, fields[j].fd) + }) + + // Visit the fields in the specified ordering. + for _, f := range fields { + if !fn(f.fd, f.v) { + return + } + } +} + +type mapEntry struct { + k pref.MapKey + v pref.Value +} + +var mapEntryPool = sync.Pool{ + New: func() interface{} { return new([]mapEntry) }, +} + +type ( + // EntryRanger is an interface for visiting all fields in a message. + // The protoreflect.Map type implements this interface. + EntryRanger interface{ Range(VisitEntry) } + // VisitEntry is called everytime a map entry is visited. + VisitEntry = func(pref.MapKey, pref.Value) bool +) + +// RangeEntries iterates over the entries of es according to the specified order. +func RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) { + if less == nil { + es.Range(fn) + return + } + + // Obtain a pre-allocated scratch buffer. + p := mapEntryPool.Get().(*[]mapEntry) + entries := (*p)[:0] + defer func() { + if cap(entries) < 1024 { + *p = entries + mapEntryPool.Put(p) + } + }() + + // Collect all entries in the map and sort them. + es.Range(func(k pref.MapKey, v pref.Value) bool { + entries = append(entries, mapEntry{k, v}) + return true + }) + sort.Slice(entries, func(i, j int) bool { + return less(entries[i].k, entries[j].k) + }) + + // Visit the entries in the specified ordering. + for _, e := range entries { + if !fn(e.k, e.v) { + return + } + } +} diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index 72cf770b..14e774fb 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -52,8 +52,8 @@ import ( // 10. Send out the CL for review and submit it. const ( Major = 1 - Minor = 25 - Patch = 0 + Minor = 27 + Patch = 1 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go index 42fc5195..49f9b8c8 100644 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ b/vendor/google.golang.org/protobuf/proto/decode.go @@ -45,12 +45,14 @@ type UnmarshalOptions struct { } // Unmarshal parses the wire-format message in b and places the result in m. +// The provided message must be mutable (e.g., a non-nil pointer to a message). func Unmarshal(b []byte, m Message) error { _, err := UnmarshalOptions{}.unmarshal(b, m.ProtoReflect()) return err } // Unmarshal parses the wire-format message in b and places the result in m. +// The provided message must be mutable (e.g., a non-nil pointer to a message). func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error { _, err := o.unmarshal(b, m.ProtoReflect()) return err @@ -116,10 +118,10 @@ func (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) // Parse the tag (field number and wire type). num, wtyp, tagLen := protowire.ConsumeTag(b) if tagLen < 0 { - return protowire.ParseError(tagLen) + return errDecode } if num > protowire.MaxValidNumber { - return errors.New("invalid field number") + return errDecode } // Find the field descriptor for this field number. @@ -159,7 +161,7 @@ func (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) } valLen = protowire.ConsumeFieldValue(num, wtyp, b[tagLen:]) if valLen < 0 { - return protowire.ParseError(valLen) + return errDecode } if !o.DiscardUnknown { m.SetUnknown(append(m.GetUnknown(), b[:tagLen+valLen]...)) @@ -194,7 +196,7 @@ func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv proto } b, n = protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } var ( keyField = fd.MapKey() @@ -213,10 +215,10 @@ func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv proto for len(b) > 0 { num, wtyp, n := protowire.ConsumeTag(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } if num > protowire.MaxValidNumber { - return 0, errors.New("invalid field number") + return 0, errDecode } b = b[n:] err = errUnknown @@ -246,7 +248,7 @@ func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv proto if err == errUnknown { n = protowire.ConsumeFieldValue(num, wtyp, b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } } else if err != nil { return 0, err @@ -272,3 +274,5 @@ func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv proto // to the unknown field set of a message. It is never returned from an exported // function. var errUnknown = errors.New("BUG: internal error (unknown)") + +var errDecode = errors.New("cannot parse invalid wire-format data") diff --git a/vendor/google.golang.org/protobuf/proto/decode_gen.go b/vendor/google.golang.org/protobuf/proto/decode_gen.go index d6dc904d..301eeb20 100644 --- a/vendor/google.golang.org/protobuf/proto/decode_gen.go +++ b/vendor/google.golang.org/protobuf/proto/decode_gen.go @@ -27,7 +27,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil case protoreflect.EnumKind: @@ -36,7 +36,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil case protoreflect.Int32Kind: @@ -45,7 +45,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfInt32(int32(v)), n, nil case protoreflect.Sint32Kind: @@ -54,7 +54,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil case protoreflect.Uint32Kind: @@ -63,7 +63,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfUint32(uint32(v)), n, nil case protoreflect.Int64Kind: @@ -72,7 +72,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfInt64(int64(v)), n, nil case protoreflect.Sint64Kind: @@ -81,7 +81,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil case protoreflect.Uint64Kind: @@ -90,7 +90,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfUint64(v), n, nil case protoreflect.Sfixed32Kind: @@ -99,7 +99,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfInt32(int32(v)), n, nil case protoreflect.Fixed32Kind: @@ -108,7 +108,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfUint32(uint32(v)), n, nil case protoreflect.FloatKind: @@ -117,7 +117,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil case protoreflect.Sfixed64Kind: @@ -126,7 +126,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfInt64(int64(v)), n, nil case protoreflect.Fixed64Kind: @@ -135,7 +135,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfUint64(v), n, nil case protoreflect.DoubleKind: @@ -144,7 +144,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil case protoreflect.StringKind: @@ -153,7 +153,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeBytes(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } if strs.EnforceUTF8(fd) && !utf8.Valid(v) { return protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName())) @@ -165,7 +165,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeBytes(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil case protoreflect.MessageKind: @@ -174,7 +174,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeBytes(b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfBytes(v), n, nil case protoreflect.GroupKind: @@ -183,7 +183,7 @@ func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd prot } v, n := protowire.ConsumeGroup(fd.Number(), b) if n < 0 { - return val, 0, protowire.ParseError(n) + return val, 0, errDecode } return protoreflect.ValueOfBytes(v), n, nil default: @@ -197,12 +197,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) @@ -214,7 +214,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v))) return n, nil @@ -222,12 +222,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) @@ -239,7 +239,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v))) return n, nil @@ -247,12 +247,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfInt32(int32(v))) @@ -264,7 +264,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfInt32(int32(v))) return n, nil @@ -272,12 +272,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) @@ -289,7 +289,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))) return n, nil @@ -297,12 +297,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfUint32(uint32(v))) @@ -314,7 +314,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfUint32(uint32(v))) return n, nil @@ -322,12 +322,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfInt64(int64(v))) @@ -339,7 +339,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfInt64(int64(v))) return n, nil @@ -347,12 +347,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) @@ -364,7 +364,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))) return n, nil @@ -372,12 +372,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeVarint(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfUint64(v)) @@ -389,7 +389,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeVarint(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfUint64(v)) return n, nil @@ -397,12 +397,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeFixed32(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfInt32(int32(v))) @@ -414,7 +414,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfInt32(int32(v))) return n, nil @@ -422,12 +422,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeFixed32(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfUint32(uint32(v))) @@ -439,7 +439,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfUint32(uint32(v))) return n, nil @@ -447,12 +447,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeFixed32(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) @@ -464,7 +464,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeFixed32(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v)))) return n, nil @@ -472,12 +472,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeFixed64(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfInt64(int64(v))) @@ -489,7 +489,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfInt64(int64(v))) return n, nil @@ -497,12 +497,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeFixed64(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfUint64(v)) @@ -514,7 +514,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfUint64(v)) return n, nil @@ -522,12 +522,12 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot if wtyp == protowire.BytesType { buf, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } for len(buf) > 0 { v, n := protowire.ConsumeFixed64(buf) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } buf = buf[n:] list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) @@ -539,7 +539,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeFixed64(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v))) return n, nil @@ -549,7 +549,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } if strs.EnforceUTF8(fd) && !utf8.Valid(v) { return 0, errors.InvalidUTF8(string(fd.FullName())) @@ -562,7 +562,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...))) return n, nil @@ -572,7 +572,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeBytes(b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } m := list.NewElement() if err := o.unmarshalMessage(v, m.Message()); err != nil { @@ -586,7 +586,7 @@ func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list prot } v, n := protowire.ConsumeGroup(fd.Number(), b) if n < 0 { - return 0, protowire.ParseError(n) + return 0, errDecode } m := list.NewElement() if err := o.unmarshalMessage(v, m.Message()); err != nil { diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go index 7b47a118..d18239c2 100644 --- a/vendor/google.golang.org/protobuf/proto/encode.go +++ b/vendor/google.golang.org/protobuf/proto/encode.go @@ -5,12 +5,9 @@ package proto import ( - "sort" - "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/encoding/messageset" - "google.golang.org/protobuf/internal/fieldsort" - "google.golang.org/protobuf/internal/mapsort" + "google.golang.org/protobuf/internal/order" "google.golang.org/protobuf/internal/pragma" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoiface" @@ -211,14 +208,15 @@ func (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([] if messageset.IsMessageSet(m.Descriptor()) { return o.marshalMessageSet(b, m) } - // There are many choices for what order we visit fields in. The default one here - // is chosen for reasonable efficiency and simplicity given the protoreflect API. - // It is not deterministic, since Message.Range does not return fields in any - // defined order. - // - // When using deterministic serialization, we sort the known fields. + fieldOrder := order.AnyFieldOrder + if o.Deterministic { + // TODO: This should use a more natural ordering like NumberFieldOrder, + // but doing so breaks golden tests that make invalid assumption about + // output stability of this implementation. + fieldOrder = order.LegacyFieldOrder + } var err error - o.rangeFields(m, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + order.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { b, err = o.marshalField(b, fd, v) return err == nil }) @@ -229,27 +227,6 @@ func (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([] return b, nil } -// rangeFields visits fields in a defined order when deterministic serialization is enabled. -func (o MarshalOptions) rangeFields(m protoreflect.Message, f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if !o.Deterministic { - m.Range(f) - return - } - var fds []protoreflect.FieldDescriptor - m.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool { - fds = append(fds, fd) - return true - }) - sort.Slice(fds, func(a, b int) bool { - return fieldsort.Less(fds[a], fds[b]) - }) - for _, fd := range fds { - if !f(fd, m.Get(fd)) { - break - } - } -} - func (o MarshalOptions) marshalField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) { switch { case fd.IsList(): @@ -292,8 +269,12 @@ func (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, l func (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) ([]byte, error) { keyf := fd.MapKey() valf := fd.MapValue() + keyOrder := order.AnyKeyOrder + if o.Deterministic { + keyOrder = order.GenericKeyOrder + } var err error - o.rangeMap(mapv, keyf.Kind(), func(key protoreflect.MapKey, value protoreflect.Value) bool { + order.RangeEntries(mapv, keyOrder, func(key protoreflect.MapKey, value protoreflect.Value) bool { b = protowire.AppendTag(b, fd.Number(), protowire.BytesType) var pos int b, pos = appendSpeculativeLength(b) @@ -312,14 +293,6 @@ func (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, ma return b, err } -func (o MarshalOptions) rangeMap(mapv protoreflect.Map, kind protoreflect.Kind, f func(protoreflect.MapKey, protoreflect.Value) bool) { - if !o.Deterministic { - mapv.Range(f) - return - } - mapsort.Range(mapv, kind, f) -} - // When encoding length-prefixed fields, we speculatively set aside some number of bytes // for the length, encode the data, and then encode the length (shifting the data if necessary // to make room). diff --git a/vendor/google.golang.org/protobuf/proto/equal.go b/vendor/google.golang.org/protobuf/proto/equal.go index 10902bd8..4dba2b96 100644 --- a/vendor/google.golang.org/protobuf/proto/equal.go +++ b/vendor/google.golang.org/protobuf/proto/equal.go @@ -111,18 +111,31 @@ func equalList(fd pref.FieldDescriptor, x, y pref.List) bool { // equalValue compares two singular values. func equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool { - switch { - case fd.Message() != nil: - return equalMessage(x.Message(), y.Message()) - case fd.Kind() == pref.BytesKind: - return bytes.Equal(x.Bytes(), y.Bytes()) - case fd.Kind() == pref.FloatKind, fd.Kind() == pref.DoubleKind: + switch fd.Kind() { + case pref.BoolKind: + return x.Bool() == y.Bool() + case pref.EnumKind: + return x.Enum() == y.Enum() + case pref.Int32Kind, pref.Sint32Kind, + pref.Int64Kind, pref.Sint64Kind, + pref.Sfixed32Kind, pref.Sfixed64Kind: + return x.Int() == y.Int() + case pref.Uint32Kind, pref.Uint64Kind, + pref.Fixed32Kind, pref.Fixed64Kind: + return x.Uint() == y.Uint() + case pref.FloatKind, pref.DoubleKind: fx := x.Float() fy := y.Float() if math.IsNaN(fx) || math.IsNaN(fy) { return math.IsNaN(fx) && math.IsNaN(fy) } return fx == fy + case pref.StringKind: + return x.String() == y.String() + case pref.BytesKind: + return bytes.Equal(x.Bytes(), y.Bytes()) + case pref.MessageKind, pref.GroupKind: + return equalMessage(x.Message(), y.Message()) default: return x.Interface() == y.Interface() } diff --git a/vendor/google.golang.org/protobuf/proto/messageset.go b/vendor/google.golang.org/protobuf/proto/messageset.go index 1d692c3a..312d5d45 100644 --- a/vendor/google.golang.org/protobuf/proto/messageset.go +++ b/vendor/google.golang.org/protobuf/proto/messageset.go @@ -9,6 +9,7 @@ import ( "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/errors" "google.golang.org/protobuf/internal/flags" + "google.golang.org/protobuf/internal/order" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" ) @@ -28,8 +29,12 @@ func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]b if !flags.ProtoLegacy { return b, errors.New("no support for message_set_wire_format") } + fieldOrder := order.AnyFieldOrder + if o.Deterministic { + fieldOrder = order.NumberFieldOrder + } var err error - o.rangeFields(m, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { + order.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool { b, err = o.marshalMessageSetField(b, fd, v) return err == nil }) diff --git a/vendor/google.golang.org/protobuf/proto/proto.go b/vendor/google.golang.org/protobuf/proto/proto.go index ca14b09c..1f0d183b 100644 --- a/vendor/google.golang.org/protobuf/proto/proto.go +++ b/vendor/google.golang.org/protobuf/proto/proto.go @@ -32,3 +32,12 @@ var Error error func init() { Error = errors.Error } + +// MessageName returns the full name of m. +// If m is nil, it returns an empty string. +func MessageName(m Message) protoreflect.FullName { + if m == nil { + return "" + } + return m.ProtoReflect().Descriptor().FullName() +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go new file mode 100644 index 00000000..e4dfb120 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go @@ -0,0 +1,276 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package protodesc provides functionality for converting +// FileDescriptorProto messages to/from protoreflect.FileDescriptor values. +// +// The google.protobuf.FileDescriptorProto is a protobuf message that describes +// the type information for a .proto file in a form that is easily serializable. +// The protoreflect.FileDescriptor is a more structured representation of +// the FileDescriptorProto message where references and remote dependencies +// can be directly followed. +package protodesc + +import ( + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/internal/pragma" + "google.golang.org/protobuf/internal/strs" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + "google.golang.org/protobuf/types/descriptorpb" +) + +// Resolver is the resolver used by NewFile to resolve dependencies. +// The enums and messages provided must belong to some parent file, +// which is also registered. +// +// It is implemented by protoregistry.Files. +type Resolver interface { + FindFileByPath(string) (protoreflect.FileDescriptor, error) + FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error) +} + +// FileOptions configures the construction of file descriptors. +type FileOptions struct { + pragma.NoUnkeyedLiterals + + // AllowUnresolvable configures New to permissively allow unresolvable + // file, enum, or message dependencies. Unresolved dependencies are replaced + // by placeholder equivalents. + // + // The following dependencies may be left unresolved: + // • Resolving an imported file. + // • Resolving the type for a message field or extension field. + // If the kind of the field is unknown, then a placeholder is used for both + // the Enum and Message accessors on the protoreflect.FieldDescriptor. + // • Resolving an enum value set as the default for an optional enum field. + // If unresolvable, the protoreflect.FieldDescriptor.Default is set to the + // first value in the associated enum (or zero if the also enum dependency + // is also unresolvable). The protoreflect.FieldDescriptor.DefaultEnumValue + // is populated with a placeholder. + // • Resolving the extended message type for an extension field. + // • Resolving the input or output message type for a service method. + // + // If the unresolved dependency uses a relative name, + // then the placeholder will contain an invalid FullName with a "*." prefix, + // indicating that the starting prefix of the full name is unknown. + AllowUnresolvable bool +} + +// NewFile creates a new protoreflect.FileDescriptor from the provided +// file descriptor message. See FileOptions.New for more information. +func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) { + return FileOptions{}.New(fd, r) +} + +// NewFiles creates a new protoregistry.Files from the provided +// FileDescriptorSet message. See FileOptions.NewFiles for more information. +func NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) { + return FileOptions{}.NewFiles(fd) +} + +// New creates a new protoreflect.FileDescriptor from the provided +// file descriptor message. The file must represent a valid proto file according +// to protobuf semantics. The returned descriptor is a deep copy of the input. +// +// Any imported files, enum types, or message types referenced in the file are +// resolved using the provided registry. When looking up an import file path, +// the path must be unique. The newly created file descriptor is not registered +// back into the provided file registry. +func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) { + if r == nil { + r = (*protoregistry.Files)(nil) // empty resolver + } + + // Handle the file descriptor content. + f := &filedesc.File{L2: &filedesc.FileL2{}} + switch fd.GetSyntax() { + case "proto2", "": + f.L1.Syntax = protoreflect.Proto2 + case "proto3": + f.L1.Syntax = protoreflect.Proto3 + default: + return nil, errors.New("invalid syntax: %q", fd.GetSyntax()) + } + f.L1.Path = fd.GetName() + if f.L1.Path == "" { + return nil, errors.New("file path must be populated") + } + f.L1.Package = protoreflect.FullName(fd.GetPackage()) + if !f.L1.Package.IsValid() && f.L1.Package != "" { + return nil, errors.New("invalid package: %q", f.L1.Package) + } + if opts := fd.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.FileOptions) + f.L2.Options = func() protoreflect.ProtoMessage { return opts } + } + + f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency())) + for _, i := range fd.GetPublicDependency() { + if !(0 <= i && int(i) < len(f.L2.Imports)) || f.L2.Imports[i].IsPublic { + return nil, errors.New("invalid or duplicate public import index: %d", i) + } + f.L2.Imports[i].IsPublic = true + } + for _, i := range fd.GetWeakDependency() { + if !(0 <= i && int(i) < len(f.L2.Imports)) || f.L2.Imports[i].IsWeak { + return nil, errors.New("invalid or duplicate weak import index: %d", i) + } + f.L2.Imports[i].IsWeak = true + } + imps := importSet{f.Path(): true} + for i, path := range fd.GetDependency() { + imp := &f.L2.Imports[i] + f, err := r.FindFileByPath(path) + if err == protoregistry.NotFound && (o.AllowUnresolvable || imp.IsWeak) { + f = filedesc.PlaceholderFile(path) + } else if err != nil { + return nil, errors.New("could not resolve import %q: %v", path, err) + } + imp.FileDescriptor = f + + if imps[imp.Path()] { + return nil, errors.New("already imported %q", path) + } + imps[imp.Path()] = true + } + for i := range fd.GetDependency() { + imp := &f.L2.Imports[i] + imps.importPublic(imp.Imports()) + } + + // Handle source locations. + f.L2.Locations.File = f + for _, loc := range fd.GetSourceCodeInfo().GetLocation() { + var l protoreflect.SourceLocation + // TODO: Validate that the path points to an actual declaration? + l.Path = protoreflect.SourcePath(loc.GetPath()) + s := loc.GetSpan() + switch len(s) { + case 3: + l.StartLine, l.StartColumn, l.EndLine, l.EndColumn = int(s[0]), int(s[1]), int(s[0]), int(s[2]) + case 4: + l.StartLine, l.StartColumn, l.EndLine, l.EndColumn = int(s[0]), int(s[1]), int(s[2]), int(s[3]) + default: + return nil, errors.New("invalid span: %v", s) + } + // TODO: Validate that the span information is sensible? + // See https://github.com/protocolbuffers/protobuf/issues/6378. + if false && (l.EndLine < l.StartLine || l.StartLine < 0 || l.StartColumn < 0 || l.EndColumn < 0 || + (l.StartLine == l.EndLine && l.EndColumn <= l.StartColumn)) { + return nil, errors.New("invalid span: %v", s) + } + l.LeadingDetachedComments = loc.GetLeadingDetachedComments() + l.LeadingComments = loc.GetLeadingComments() + l.TrailingComments = loc.GetTrailingComments() + f.L2.Locations.List = append(f.L2.Locations.List, l) + } + + // Step 1: Allocate and derive the names for all declarations. + // This copies all fields from the descriptor proto except: + // google.protobuf.FieldDescriptorProto.type_name + // google.protobuf.FieldDescriptorProto.default_value + // google.protobuf.FieldDescriptorProto.oneof_index + // google.protobuf.FieldDescriptorProto.extendee + // google.protobuf.MethodDescriptorProto.input + // google.protobuf.MethodDescriptorProto.output + var err error + sb := new(strs.Builder) + r1 := make(descsByName) + if f.L1.Enums.List, err = r1.initEnumDeclarations(fd.GetEnumType(), f, sb); err != nil { + return nil, err + } + if f.L1.Messages.List, err = r1.initMessagesDeclarations(fd.GetMessageType(), f, sb); err != nil { + return nil, err + } + if f.L1.Extensions.List, err = r1.initExtensionDeclarations(fd.GetExtension(), f, sb); err != nil { + return nil, err + } + if f.L1.Services.List, err = r1.initServiceDeclarations(fd.GetService(), f, sb); err != nil { + return nil, err + } + + // Step 2: Resolve every dependency reference not handled by step 1. + r2 := &resolver{local: r1, remote: r, imports: imps, allowUnresolvable: o.AllowUnresolvable} + if err := r2.resolveMessageDependencies(f.L1.Messages.List, fd.GetMessageType()); err != nil { + return nil, err + } + if err := r2.resolveExtensionDependencies(f.L1.Extensions.List, fd.GetExtension()); err != nil { + return nil, err + } + if err := r2.resolveServiceDependencies(f.L1.Services.List, fd.GetService()); err != nil { + return nil, err + } + + // Step 3: Validate every enum, message, and extension declaration. + if err := validateEnumDeclarations(f.L1.Enums.List, fd.GetEnumType()); err != nil { + return nil, err + } + if err := validateMessageDeclarations(f.L1.Messages.List, fd.GetMessageType()); err != nil { + return nil, err + } + if err := validateExtensionDeclarations(f.L1.Extensions.List, fd.GetExtension()); err != nil { + return nil, err + } + + return f, nil +} + +type importSet map[string]bool + +func (is importSet) importPublic(imps protoreflect.FileImports) { + for i := 0; i < imps.Len(); i++ { + if imp := imps.Get(i); imp.IsPublic { + is[imp.Path()] = true + is.importPublic(imp.Imports()) + } + } +} + +// NewFiles creates a new protoregistry.Files from the provided +// FileDescriptorSet message. The descriptor set must include only +// valid files according to protobuf semantics. The returned descriptors +// are a deep copy of the input. +func (o FileOptions) NewFiles(fds *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) { + files := make(map[string]*descriptorpb.FileDescriptorProto) + for _, fd := range fds.File { + if _, ok := files[fd.GetName()]; ok { + return nil, errors.New("file appears multiple times: %q", fd.GetName()) + } + files[fd.GetName()] = fd + } + r := &protoregistry.Files{} + for _, fd := range files { + if err := o.addFileDeps(r, fd, files); err != nil { + return nil, err + } + } + return r, nil +} +func (o FileOptions) addFileDeps(r *protoregistry.Files, fd *descriptorpb.FileDescriptorProto, files map[string]*descriptorpb.FileDescriptorProto) error { + // Set the entry to nil while descending into a file's dependencies to detect cycles. + files[fd.GetName()] = nil + for _, dep := range fd.Dependency { + depfd, ok := files[dep] + if depfd == nil { + if ok { + return errors.New("import cycle in file: %q", dep) + } + continue + } + if err := o.addFileDeps(r, depfd, files); err != nil { + return err + } + } + // Delete the entry once dependencies are processed. + delete(files, fd.GetName()) + f, err := o.New(fd, r) + if err != nil { + return err + } + return r.RegisterFile(f) +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go new file mode 100644 index 00000000..37efda1a --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go @@ -0,0 +1,248 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protodesc + +import ( + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/internal/strs" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + "google.golang.org/protobuf/types/descriptorpb" +) + +type descsByName map[protoreflect.FullName]protoreflect.Descriptor + +func (r descsByName) initEnumDeclarations(eds []*descriptorpb.EnumDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (es []filedesc.Enum, err error) { + es = make([]filedesc.Enum, len(eds)) // allocate up-front to ensure stable pointers + for i, ed := range eds { + e := &es[i] + e.L2 = new(filedesc.EnumL2) + if e.L0, err = r.makeBase(e, parent, ed.GetName(), i, sb); err != nil { + return nil, err + } + if opts := ed.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.EnumOptions) + e.L2.Options = func() protoreflect.ProtoMessage { return opts } + } + for _, s := range ed.GetReservedName() { + e.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s)) + } + for _, rr := range ed.GetReservedRange() { + e.L2.ReservedRanges.List = append(e.L2.ReservedRanges.List, [2]protoreflect.EnumNumber{ + protoreflect.EnumNumber(rr.GetStart()), + protoreflect.EnumNumber(rr.GetEnd()), + }) + } + if e.L2.Values.List, err = r.initEnumValuesFromDescriptorProto(ed.GetValue(), e, sb); err != nil { + return nil, err + } + } + return es, nil +} + +func (r descsByName) initEnumValuesFromDescriptorProto(vds []*descriptorpb.EnumValueDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (vs []filedesc.EnumValue, err error) { + vs = make([]filedesc.EnumValue, len(vds)) // allocate up-front to ensure stable pointers + for i, vd := range vds { + v := &vs[i] + if v.L0, err = r.makeBase(v, parent, vd.GetName(), i, sb); err != nil { + return nil, err + } + if opts := vd.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.EnumValueOptions) + v.L1.Options = func() protoreflect.ProtoMessage { return opts } + } + v.L1.Number = protoreflect.EnumNumber(vd.GetNumber()) + } + return vs, nil +} + +func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (ms []filedesc.Message, err error) { + ms = make([]filedesc.Message, len(mds)) // allocate up-front to ensure stable pointers + for i, md := range mds { + m := &ms[i] + m.L2 = new(filedesc.MessageL2) + if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil { + return nil, err + } + if opts := md.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.MessageOptions) + m.L2.Options = func() protoreflect.ProtoMessage { return opts } + m.L1.IsMapEntry = opts.GetMapEntry() + m.L1.IsMessageSet = opts.GetMessageSetWireFormat() + } + for _, s := range md.GetReservedName() { + m.L2.ReservedNames.List = append(m.L2.ReservedNames.List, protoreflect.Name(s)) + } + for _, rr := range md.GetReservedRange() { + m.L2.ReservedRanges.List = append(m.L2.ReservedRanges.List, [2]protoreflect.FieldNumber{ + protoreflect.FieldNumber(rr.GetStart()), + protoreflect.FieldNumber(rr.GetEnd()), + }) + } + for _, xr := range md.GetExtensionRange() { + m.L2.ExtensionRanges.List = append(m.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{ + protoreflect.FieldNumber(xr.GetStart()), + protoreflect.FieldNumber(xr.GetEnd()), + }) + var optsFunc func() protoreflect.ProtoMessage + if opts := xr.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.ExtensionRangeOptions) + optsFunc = func() protoreflect.ProtoMessage { return opts } + } + m.L2.ExtensionRangeOptions = append(m.L2.ExtensionRangeOptions, optsFunc) + } + if m.L2.Fields.List, err = r.initFieldsFromDescriptorProto(md.GetField(), m, sb); err != nil { + return nil, err + } + if m.L2.Oneofs.List, err = r.initOneofsFromDescriptorProto(md.GetOneofDecl(), m, sb); err != nil { + return nil, err + } + if m.L1.Enums.List, err = r.initEnumDeclarations(md.GetEnumType(), m, sb); err != nil { + return nil, err + } + if m.L1.Messages.List, err = r.initMessagesDeclarations(md.GetNestedType(), m, sb); err != nil { + return nil, err + } + if m.L1.Extensions.List, err = r.initExtensionDeclarations(md.GetExtension(), m, sb); err != nil { + return nil, err + } + } + return ms, nil +} + +func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (fs []filedesc.Field, err error) { + fs = make([]filedesc.Field, len(fds)) // allocate up-front to ensure stable pointers + for i, fd := range fds { + f := &fs[i] + if f.L0, err = r.makeBase(f, parent, fd.GetName(), i, sb); err != nil { + return nil, err + } + f.L1.IsProto3Optional = fd.GetProto3Optional() + if opts := fd.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.FieldOptions) + f.L1.Options = func() protoreflect.ProtoMessage { return opts } + f.L1.IsWeak = opts.GetWeak() + f.L1.HasPacked = opts.Packed != nil + f.L1.IsPacked = opts.GetPacked() + } + f.L1.Number = protoreflect.FieldNumber(fd.GetNumber()) + f.L1.Cardinality = protoreflect.Cardinality(fd.GetLabel()) + if fd.Type != nil { + f.L1.Kind = protoreflect.Kind(fd.GetType()) + } + if fd.JsonName != nil { + f.L1.StringName.InitJSON(fd.GetJsonName()) + } + } + return fs, nil +} + +func (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (os []filedesc.Oneof, err error) { + os = make([]filedesc.Oneof, len(ods)) // allocate up-front to ensure stable pointers + for i, od := range ods { + o := &os[i] + if o.L0, err = r.makeBase(o, parent, od.GetName(), i, sb); err != nil { + return nil, err + } + if opts := od.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.OneofOptions) + o.L1.Options = func() protoreflect.ProtoMessage { return opts } + } + } + return os, nil +} + +func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (xs []filedesc.Extension, err error) { + xs = make([]filedesc.Extension, len(xds)) // allocate up-front to ensure stable pointers + for i, xd := range xds { + x := &xs[i] + x.L2 = new(filedesc.ExtensionL2) + if x.L0, err = r.makeBase(x, parent, xd.GetName(), i, sb); err != nil { + return nil, err + } + if opts := xd.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.FieldOptions) + x.L2.Options = func() protoreflect.ProtoMessage { return opts } + x.L2.IsPacked = opts.GetPacked() + } + x.L1.Number = protoreflect.FieldNumber(xd.GetNumber()) + x.L1.Cardinality = protoreflect.Cardinality(xd.GetLabel()) + if xd.Type != nil { + x.L1.Kind = protoreflect.Kind(xd.GetType()) + } + if xd.JsonName != nil { + x.L2.StringName.InitJSON(xd.GetJsonName()) + } + } + return xs, nil +} + +func (r descsByName) initServiceDeclarations(sds []*descriptorpb.ServiceDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (ss []filedesc.Service, err error) { + ss = make([]filedesc.Service, len(sds)) // allocate up-front to ensure stable pointers + for i, sd := range sds { + s := &ss[i] + s.L2 = new(filedesc.ServiceL2) + if s.L0, err = r.makeBase(s, parent, sd.GetName(), i, sb); err != nil { + return nil, err + } + if opts := sd.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.ServiceOptions) + s.L2.Options = func() protoreflect.ProtoMessage { return opts } + } + if s.L2.Methods.List, err = r.initMethodsFromDescriptorProto(sd.GetMethod(), s, sb); err != nil { + return nil, err + } + } + return ss, nil +} + +func (r descsByName) initMethodsFromDescriptorProto(mds []*descriptorpb.MethodDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (ms []filedesc.Method, err error) { + ms = make([]filedesc.Method, len(mds)) // allocate up-front to ensure stable pointers + for i, md := range mds { + m := &ms[i] + if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil { + return nil, err + } + if opts := md.GetOptions(); opts != nil { + opts = proto.Clone(opts).(*descriptorpb.MethodOptions) + m.L1.Options = func() protoreflect.ProtoMessage { return opts } + } + m.L1.IsStreamingClient = md.GetClientStreaming() + m.L1.IsStreamingServer = md.GetServerStreaming() + } + return ms, nil +} + +func (r descsByName) makeBase(child, parent protoreflect.Descriptor, name string, idx int, sb *strs.Builder) (filedesc.BaseL0, error) { + if !protoreflect.Name(name).IsValid() { + return filedesc.BaseL0{}, errors.New("descriptor %q has an invalid nested name: %q", parent.FullName(), name) + } + + // Derive the full name of the child. + // Note that enum values are a sibling to the enum parent in the namespace. + var fullName protoreflect.FullName + if _, ok := parent.(protoreflect.EnumDescriptor); ok { + fullName = sb.AppendFullName(parent.FullName().Parent(), protoreflect.Name(name)) + } else { + fullName = sb.AppendFullName(parent.FullName(), protoreflect.Name(name)) + } + if _, ok := r[fullName]; ok { + return filedesc.BaseL0{}, errors.New("descriptor %q already declared", fullName) + } + r[fullName] = child + + // TODO: Verify that the full name does not already exist in the resolver? + // This is not as critical since most usages of NewFile will register + // the created file back into the registry, which will perform this check. + + return filedesc.BaseL0{ + FullName: fullName, + ParentFile: parent.ParentFile().(*filedesc.File), + Parent: parent, + Index: idx, + }, nil +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go new file mode 100644 index 00000000..cebb36cd --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go @@ -0,0 +1,286 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protodesc + +import ( + "google.golang.org/protobuf/internal/encoding/defval" + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + "google.golang.org/protobuf/types/descriptorpb" +) + +// resolver is a wrapper around a local registry of declarations within the file +// and the remote resolver. The remote resolver is restricted to only return +// descriptors that have been imported. +type resolver struct { + local descsByName + remote Resolver + imports importSet + + allowUnresolvable bool +} + +func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) (err error) { + for i, md := range mds { + m := &ms[i] + for j, fd := range md.GetField() { + f := &m.L2.Fields.List[j] + if f.L1.Cardinality == protoreflect.Required { + m.L2.RequiredNumbers.List = append(m.L2.RequiredNumbers.List, f.L1.Number) + } + if fd.OneofIndex != nil { + k := int(fd.GetOneofIndex()) + if !(0 <= k && k < len(md.GetOneofDecl())) { + return errors.New("message field %q has an invalid oneof index: %d", f.FullName(), k) + } + o := &m.L2.Oneofs.List[k] + f.L1.ContainingOneof = o + o.L1.Fields.List = append(o.L1.Fields.List, f) + } + + if f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName()), f.IsWeak()); err != nil { + return errors.New("message field %q cannot resolve type: %v", f.FullName(), err) + } + if fd.DefaultValue != nil { + v, ev, err := unmarshalDefault(fd.GetDefaultValue(), f, r.allowUnresolvable) + if err != nil { + return errors.New("message field %q has invalid default: %v", f.FullName(), err) + } + f.L1.Default = filedesc.DefaultValue(v, ev) + } + } + + if err := r.resolveMessageDependencies(m.L1.Messages.List, md.GetNestedType()); err != nil { + return err + } + if err := r.resolveExtensionDependencies(m.L1.Extensions.List, md.GetExtension()); err != nil { + return err + } + } + return nil +} + +func (r *resolver) resolveExtensionDependencies(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) (err error) { + for i, xd := range xds { + x := &xs[i] + if x.L1.Extendee, err = r.findMessageDescriptor(x.Parent().FullName(), partialName(xd.GetExtendee()), false); err != nil { + return errors.New("extension field %q cannot resolve extendee: %v", x.FullName(), err) + } + if x.L1.Kind, x.L2.Enum, x.L2.Message, err = r.findTarget(x.Kind(), x.Parent().FullName(), partialName(xd.GetTypeName()), false); err != nil { + return errors.New("extension field %q cannot resolve type: %v", x.FullName(), err) + } + if xd.DefaultValue != nil { + v, ev, err := unmarshalDefault(xd.GetDefaultValue(), x, r.allowUnresolvable) + if err != nil { + return errors.New("extension field %q has invalid default: %v", x.FullName(), err) + } + x.L2.Default = filedesc.DefaultValue(v, ev) + } + } + return nil +} + +func (r *resolver) resolveServiceDependencies(ss []filedesc.Service, sds []*descriptorpb.ServiceDescriptorProto) (err error) { + for i, sd := range sds { + s := &ss[i] + for j, md := range sd.GetMethod() { + m := &s.L2.Methods.List[j] + m.L1.Input, err = r.findMessageDescriptor(m.Parent().FullName(), partialName(md.GetInputType()), false) + if err != nil { + return errors.New("service method %q cannot resolve input: %v", m.FullName(), err) + } + m.L1.Output, err = r.findMessageDescriptor(s.FullName(), partialName(md.GetOutputType()), false) + if err != nil { + return errors.New("service method %q cannot resolve output: %v", m.FullName(), err) + } + } + } + return nil +} + +// findTarget finds an enum or message descriptor if k is an enum, message, +// group, or unknown. If unknown, and the name could be resolved, the kind +// returned kind is set based on the type of the resolved descriptor. +func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) { + switch k { + case protoreflect.EnumKind: + ed, err := r.findEnumDescriptor(scope, ref, isWeak) + if err != nil { + return 0, nil, nil, err + } + return k, ed, nil, nil + case protoreflect.MessageKind, protoreflect.GroupKind: + md, err := r.findMessageDescriptor(scope, ref, isWeak) + if err != nil { + return 0, nil, nil, err + } + return k, nil, md, nil + case 0: + // Handle unspecified kinds (possible with parsers that operate + // on a per-file basis without knowledge of dependencies). + d, err := r.findDescriptor(scope, ref) + if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) { + return k, filedesc.PlaceholderEnum(ref.FullName()), filedesc.PlaceholderMessage(ref.FullName()), nil + } else if err == protoregistry.NotFound { + return 0, nil, nil, errors.New("%q not found", ref.FullName()) + } else if err != nil { + return 0, nil, nil, err + } + switch d := d.(type) { + case protoreflect.EnumDescriptor: + return protoreflect.EnumKind, d, nil, nil + case protoreflect.MessageDescriptor: + return protoreflect.MessageKind, nil, d, nil + default: + return 0, nil, nil, errors.New("unknown kind") + } + default: + if ref != "" { + return 0, nil, nil, errors.New("target name cannot be specified for %v", k) + } + if !k.IsValid() { + return 0, nil, nil, errors.New("invalid kind: %d", k) + } + return k, nil, nil, nil + } +} + +// findDescriptor finds the descriptor by name, +// which may be a relative name within some scope. +// +// Suppose the scope was "fizz.buzz" and the reference was "Foo.Bar", +// then the following full names are searched: +// * fizz.buzz.Foo.Bar +// * fizz.Foo.Bar +// * Foo.Bar +func (r *resolver) findDescriptor(scope protoreflect.FullName, ref partialName) (protoreflect.Descriptor, error) { + if !ref.IsValid() { + return nil, errors.New("invalid name reference: %q", ref) + } + if ref.IsFull() { + scope, ref = "", ref[1:] + } + var foundButNotImported protoreflect.Descriptor + for { + // Derive the full name to search. + s := protoreflect.FullName(ref) + if scope != "" { + s = scope + "." + s + } + + // Check the current file for the descriptor. + if d, ok := r.local[s]; ok { + return d, nil + } + + // Check the remote registry for the descriptor. + d, err := r.remote.FindDescriptorByName(s) + if err == nil { + // Only allow descriptors covered by one of the imports. + if r.imports[d.ParentFile().Path()] { + return d, nil + } + foundButNotImported = d + } else if err != protoregistry.NotFound { + return nil, errors.Wrap(err, "%q", s) + } + + // Continue on at a higher level of scoping. + if scope == "" { + if d := foundButNotImported; d != nil { + return nil, errors.New("resolved %q, but %q is not imported", d.FullName(), d.ParentFile().Path()) + } + return nil, protoregistry.NotFound + } + scope = scope.Parent() + } +} + +func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.EnumDescriptor, error) { + d, err := r.findDescriptor(scope, ref) + if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) { + return filedesc.PlaceholderEnum(ref.FullName()), nil + } else if err == protoregistry.NotFound { + return nil, errors.New("%q not found", ref.FullName()) + } else if err != nil { + return nil, err + } + ed, ok := d.(protoreflect.EnumDescriptor) + if !ok { + return nil, errors.New("resolved %q, but it is not an enum", d.FullName()) + } + return ed, nil +} + +func (r *resolver) findMessageDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.MessageDescriptor, error) { + d, err := r.findDescriptor(scope, ref) + if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) { + return filedesc.PlaceholderMessage(ref.FullName()), nil + } else if err == protoregistry.NotFound { + return nil, errors.New("%q not found", ref.FullName()) + } else if err != nil { + return nil, err + } + md, ok := d.(protoreflect.MessageDescriptor) + if !ok { + return nil, errors.New("resolved %q, but it is not an message", d.FullName()) + } + return md, nil +} + +// partialName is the partial name. A leading dot means that the name is full, +// otherwise the name is relative to some current scope. +// See google.protobuf.FieldDescriptorProto.type_name. +type partialName string + +func (s partialName) IsFull() bool { + return len(s) > 0 && s[0] == '.' +} + +func (s partialName) IsValid() bool { + if s.IsFull() { + return protoreflect.FullName(s[1:]).IsValid() + } + return protoreflect.FullName(s).IsValid() +} + +const unknownPrefix = "*." + +// FullName converts the partial name to a full name on a best-effort basis. +// If relative, it creates an invalid full name, using a "*." prefix +// to indicate that the start of the full name is unknown. +func (s partialName) FullName() protoreflect.FullName { + if s.IsFull() { + return protoreflect.FullName(s[1:]) + } + return protoreflect.FullName(unknownPrefix + s) +} + +func unmarshalDefault(s string, fd protoreflect.FieldDescriptor, allowUnresolvable bool) (protoreflect.Value, protoreflect.EnumValueDescriptor, error) { + var evs protoreflect.EnumValueDescriptors + if fd.Enum() != nil { + evs = fd.Enum().Values() + } + v, ev, err := defval.Unmarshal(s, fd.Kind(), evs, defval.Descriptor) + if err != nil && allowUnresolvable && evs != nil && protoreflect.Name(s).IsValid() { + v = protoreflect.ValueOfEnum(0) + if evs.Len() > 0 { + v = protoreflect.ValueOfEnum(evs.Get(0).Number()) + } + ev = filedesc.PlaceholderEnumValue(fd.Enum().FullName().Parent().Append(protoreflect.Name(s))) + } else if err != nil { + return v, ev, err + } + if fd.Syntax() == protoreflect.Proto3 { + return v, ev, errors.New("cannot be specified under proto3 semantics") + } + if fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind || fd.Cardinality() == protoreflect.Repeated { + return v, ev, errors.New("cannot be specified on composite types") + } + return v, ev, nil +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go new file mode 100644 index 00000000..9af1d564 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go @@ -0,0 +1,374 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protodesc + +import ( + "strings" + "unicode" + + "google.golang.org/protobuf/encoding/protowire" + "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/internal/filedesc" + "google.golang.org/protobuf/internal/flags" + "google.golang.org/protobuf/internal/genid" + "google.golang.org/protobuf/internal/strs" + "google.golang.org/protobuf/reflect/protoreflect" + + "google.golang.org/protobuf/types/descriptorpb" +) + +func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescriptorProto) error { + for i, ed := range eds { + e := &es[i] + if err := e.L2.ReservedNames.CheckValid(); err != nil { + return errors.New("enum %q reserved names has %v", e.FullName(), err) + } + if err := e.L2.ReservedRanges.CheckValid(); err != nil { + return errors.New("enum %q reserved ranges has %v", e.FullName(), err) + } + if len(ed.GetValue()) == 0 { + return errors.New("enum %q must contain at least one value declaration", e.FullName()) + } + allowAlias := ed.GetOptions().GetAllowAlias() + foundAlias := false + for i := 0; i < e.Values().Len(); i++ { + v1 := e.Values().Get(i) + if v2 := e.Values().ByNumber(v1.Number()); v1 != v2 { + foundAlias = true + if !allowAlias { + return errors.New("enum %q has conflicting non-aliased values on number %d: %q with %q", e.FullName(), v1.Number(), v1.Name(), v2.Name()) + } + } + } + if allowAlias && !foundAlias { + return errors.New("enum %q allows aliases, but none were found", e.FullName()) + } + if e.Syntax() == protoreflect.Proto3 { + if v := e.Values().Get(0); v.Number() != 0 { + return errors.New("enum %q using proto3 semantics must have zero number for the first value", v.FullName()) + } + // Verify that value names in proto3 do not conflict if the + // case-insensitive prefix is removed. + // See protoc v3.8.0: src/google/protobuf/descriptor.cc:4991-5055 + names := map[string]protoreflect.EnumValueDescriptor{} + prefix := strings.Replace(strings.ToLower(string(e.Name())), "_", "", -1) + for i := 0; i < e.Values().Len(); i++ { + v1 := e.Values().Get(i) + s := strs.EnumValueName(strs.TrimEnumPrefix(string(v1.Name()), prefix)) + if v2, ok := names[s]; ok && v1.Number() != v2.Number() { + return errors.New("enum %q using proto3 semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name()) + } + names[s] = v1 + } + } + + for j, vd := range ed.GetValue() { + v := &e.L2.Values.List[j] + if vd.Number == nil { + return errors.New("enum value %q must have a specified number", v.FullName()) + } + if e.L2.ReservedNames.Has(v.Name()) { + return errors.New("enum value %q must not use reserved name", v.FullName()) + } + if e.L2.ReservedRanges.Has(v.Number()) { + return errors.New("enum value %q must not use reserved number %d", v.FullName(), v.Number()) + } + } + } + return nil +} + +func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error { + for i, md := range mds { + m := &ms[i] + + // Handle the message descriptor itself. + isMessageSet := md.GetOptions().GetMessageSetWireFormat() + if err := m.L2.ReservedNames.CheckValid(); err != nil { + return errors.New("message %q reserved names has %v", m.FullName(), err) + } + if err := m.L2.ReservedRanges.CheckValid(isMessageSet); err != nil { + return errors.New("message %q reserved ranges has %v", m.FullName(), err) + } + if err := m.L2.ExtensionRanges.CheckValid(isMessageSet); err != nil { + return errors.New("message %q extension ranges has %v", m.FullName(), err) + } + if err := (*filedesc.FieldRanges).CheckOverlap(&m.L2.ReservedRanges, &m.L2.ExtensionRanges); err != nil { + return errors.New("message %q reserved and extension ranges has %v", m.FullName(), err) + } + for i := 0; i < m.Fields().Len(); i++ { + f1 := m.Fields().Get(i) + if f2 := m.Fields().ByNumber(f1.Number()); f1 != f2 { + return errors.New("message %q has conflicting fields: %q with %q", m.FullName(), f1.Name(), f2.Name()) + } + } + if isMessageSet && !flags.ProtoLegacy { + return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName()) + } + if isMessageSet && (m.Syntax() != protoreflect.Proto2 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) { + return errors.New("message %q is an invalid proto1 MessageSet", m.FullName()) + } + if m.Syntax() == protoreflect.Proto3 { + if m.ExtensionRanges().Len() > 0 { + return errors.New("message %q using proto3 semantics cannot have extension ranges", m.FullName()) + } + // Verify that field names in proto3 do not conflict if lowercased + // with all underscores removed. + // See protoc v3.8.0: src/google/protobuf/descriptor.cc:5830-5847 + names := map[string]protoreflect.FieldDescriptor{} + for i := 0; i < m.Fields().Len(); i++ { + f1 := m.Fields().Get(i) + s := strings.Replace(strings.ToLower(string(f1.Name())), "_", "", -1) + if f2, ok := names[s]; ok { + return errors.New("message %q using proto3 semantics has conflict: %q with %q", m.FullName(), f1.Name(), f2.Name()) + } + names[s] = f1 + } + } + + for j, fd := range md.GetField() { + f := &m.L2.Fields.List[j] + if m.L2.ReservedNames.Has(f.Name()) { + return errors.New("message field %q must not use reserved name", f.FullName()) + } + if !f.Number().IsValid() { + return errors.New("message field %q has an invalid number: %d", f.FullName(), f.Number()) + } + if !f.Cardinality().IsValid() { + return errors.New("message field %q has an invalid cardinality: %d", f.FullName(), f.Cardinality()) + } + if m.L2.ReservedRanges.Has(f.Number()) { + return errors.New("message field %q must not use reserved number %d", f.FullName(), f.Number()) + } + if m.L2.ExtensionRanges.Has(f.Number()) { + return errors.New("message field %q with number %d in extension range", f.FullName(), f.Number()) + } + if fd.Extendee != nil { + return errors.New("message field %q may not have extendee: %q", f.FullName(), fd.GetExtendee()) + } + if f.L1.IsProto3Optional { + if f.Syntax() != protoreflect.Proto3 { + return errors.New("message field %q under proto3 optional semantics must be specified in the proto3 syntax", f.FullName()) + } + if f.Cardinality() != protoreflect.Optional { + return errors.New("message field %q under proto3 optional semantics must have optional cardinality", f.FullName()) + } + if f.ContainingOneof() != nil && f.ContainingOneof().Fields().Len() != 1 { + return errors.New("message field %q under proto3 optional semantics must be within a single element oneof", f.FullName()) + } + } + if f.IsWeak() && !flags.ProtoLegacy { + return errors.New("message field %q is a weak field, which is a legacy proto1 feature that is no longer supported", f.FullName()) + } + if f.IsWeak() && (f.Syntax() != protoreflect.Proto2 || !isOptionalMessage(f) || f.ContainingOneof() != nil) { + return errors.New("message field %q may only be weak for an optional message", f.FullName()) + } + if f.IsPacked() && !isPackable(f) { + return errors.New("message field %q is not packable", f.FullName()) + } + if err := checkValidGroup(f); err != nil { + return errors.New("message field %q is an invalid group: %v", f.FullName(), err) + } + if err := checkValidMap(f); err != nil { + return errors.New("message field %q is an invalid map: %v", f.FullName(), err) + } + if f.Syntax() == protoreflect.Proto3 { + if f.Cardinality() == protoreflect.Required { + return errors.New("message field %q using proto3 semantics cannot be required", f.FullName()) + } + if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().Syntax() != protoreflect.Proto3 { + return errors.New("message field %q using proto3 semantics may only depend on a proto3 enum", f.FullName()) + } + } + } + seenSynthetic := false // synthetic oneofs for proto3 optional must come after real oneofs + for j := range md.GetOneofDecl() { + o := &m.L2.Oneofs.List[j] + if o.Fields().Len() == 0 { + return errors.New("message oneof %q must contain at least one field declaration", o.FullName()) + } + if n := o.Fields().Len(); n-1 != (o.Fields().Get(n-1).Index() - o.Fields().Get(0).Index()) { + return errors.New("message oneof %q must have consecutively declared fields", o.FullName()) + } + + if o.IsSynthetic() { + seenSynthetic = true + continue + } + if !o.IsSynthetic() && seenSynthetic { + return errors.New("message oneof %q must be declared before synthetic oneofs", o.FullName()) + } + + for i := 0; i < o.Fields().Len(); i++ { + f := o.Fields().Get(i) + if f.Cardinality() != protoreflect.Optional { + return errors.New("message field %q belongs in a oneof and must be optional", f.FullName()) + } + if f.IsWeak() { + return errors.New("message field %q belongs in a oneof and must not be a weak reference", f.FullName()) + } + } + } + + if err := validateEnumDeclarations(m.L1.Enums.List, md.GetEnumType()); err != nil { + return err + } + if err := validateMessageDeclarations(m.L1.Messages.List, md.GetNestedType()); err != nil { + return err + } + if err := validateExtensionDeclarations(m.L1.Extensions.List, md.GetExtension()); err != nil { + return err + } + } + return nil +} + +func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error { + for i, xd := range xds { + x := &xs[i] + // NOTE: Avoid using the IsValid method since extensions to MessageSet + // may have a field number higher than normal. This check only verifies + // that the number is not negative or reserved. We check again later + // if we know that the extendee is definitely not a MessageSet. + if n := x.Number(); n < 0 || (protowire.FirstReservedNumber <= n && n <= protowire.LastReservedNumber) { + return errors.New("extension field %q has an invalid number: %d", x.FullName(), x.Number()) + } + if !x.Cardinality().IsValid() || x.Cardinality() == protoreflect.Required { + return errors.New("extension field %q has an invalid cardinality: %d", x.FullName(), x.Cardinality()) + } + if xd.JsonName != nil { + // A bug in older versions of protoc would always populate the + // "json_name" option for extensions when it is meaningless. + // When it did so, it would always use the camel-cased field name. + if xd.GetJsonName() != strs.JSONCamelCase(string(x.Name())) { + return errors.New("extension field %q may not have an explicitly set JSON name: %q", x.FullName(), xd.GetJsonName()) + } + } + if xd.OneofIndex != nil { + return errors.New("extension field %q may not be part of a oneof", x.FullName()) + } + if md := x.ContainingMessage(); !md.IsPlaceholder() { + if !md.ExtensionRanges().Has(x.Number()) { + return errors.New("extension field %q extends %q with non-extension field number: %d", x.FullName(), md.FullName(), x.Number()) + } + isMessageSet := md.Options().(*descriptorpb.MessageOptions).GetMessageSetWireFormat() + if isMessageSet && !isOptionalMessage(x) { + return errors.New("extension field %q extends MessageSet and must be an optional message", x.FullName()) + } + if !isMessageSet && !x.Number().IsValid() { + return errors.New("extension field %q has an invalid number: %d", x.FullName(), x.Number()) + } + } + if xd.GetOptions().GetWeak() { + return errors.New("extension field %q cannot be a weak reference", x.FullName()) + } + if x.IsPacked() && !isPackable(x) { + return errors.New("extension field %q is not packable", x.FullName()) + } + if err := checkValidGroup(x); err != nil { + return errors.New("extension field %q is an invalid group: %v", x.FullName(), err) + } + if md := x.Message(); md != nil && md.IsMapEntry() { + return errors.New("extension field %q cannot be a map entry", x.FullName()) + } + if x.Syntax() == protoreflect.Proto3 { + switch x.ContainingMessage().FullName() { + case (*descriptorpb.FileOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.EnumOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.EnumValueOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.MessageOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.FieldOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.OneofOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.ExtensionRangeOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.ServiceOptions)(nil).ProtoReflect().Descriptor().FullName(): + case (*descriptorpb.MethodOptions)(nil).ProtoReflect().Descriptor().FullName(): + default: + return errors.New("extension field %q cannot be declared in proto3 unless extended descriptor options", x.FullName()) + } + } + } + return nil +} + +// isOptionalMessage reports whether this is an optional message. +// If the kind is unknown, it is assumed to be a message. +func isOptionalMessage(fd protoreflect.FieldDescriptor) bool { + return (fd.Kind() == 0 || fd.Kind() == protoreflect.MessageKind) && fd.Cardinality() == protoreflect.Optional +} + +// isPackable checks whether the pack option can be specified. +func isPackable(fd protoreflect.FieldDescriptor) bool { + switch fd.Kind() { + case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: + return false + } + return fd.IsList() +} + +// checkValidGroup reports whether fd is a valid group according to the same +// rules that protoc imposes. +func checkValidGroup(fd protoreflect.FieldDescriptor) error { + md := fd.Message() + switch { + case fd.Kind() != protoreflect.GroupKind: + return nil + case fd.Syntax() != protoreflect.Proto2: + return errors.New("invalid under proto2 semantics") + case md == nil || md.IsPlaceholder(): + return errors.New("message must be resolvable") + case fd.FullName().Parent() != md.FullName().Parent(): + return errors.New("message and field must be declared in the same scope") + case !unicode.IsUpper(rune(md.Name()[0])): + return errors.New("message name must start with an uppercase") + case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))): + return errors.New("field name must be lowercased form of the message name") + } + return nil +} + +// checkValidMap checks whether the field is a valid map according to the same +// rules that protoc imposes. +// See protoc v3.8.0: src/google/protobuf/descriptor.cc:6045-6115 +func checkValidMap(fd protoreflect.FieldDescriptor) error { + md := fd.Message() + switch { + case md == nil || !md.IsMapEntry(): + return nil + case fd.FullName().Parent() != md.FullName().Parent(): + return errors.New("message and field must be declared in the same scope") + case md.Name() != protoreflect.Name(strs.MapEntryName(string(fd.Name()))): + return errors.New("incorrect implicit map entry name") + case fd.Cardinality() != protoreflect.Repeated: + return errors.New("field must be repeated") + case md.Fields().Len() != 2: + return errors.New("message must have exactly two fields") + case md.ExtensionRanges().Len() > 0: + return errors.New("message must not have any extension ranges") + case md.Enums().Len()+md.Messages().Len()+md.Extensions().Len() > 0: + return errors.New("message must not have any nested declarations") + } + kf := md.Fields().Get(0) + vf := md.Fields().Get(1) + switch { + case kf.Name() != genid.MapEntry_Key_field_name || kf.Number() != genid.MapEntry_Key_field_number || kf.Cardinality() != protoreflect.Optional || kf.ContainingOneof() != nil || kf.HasDefault(): + return errors.New("invalid key field") + case vf.Name() != genid.MapEntry_Value_field_name || vf.Number() != genid.MapEntry_Value_field_number || vf.Cardinality() != protoreflect.Optional || vf.ContainingOneof() != nil || vf.HasDefault(): + return errors.New("invalid value field") + } + switch kf.Kind() { + case protoreflect.BoolKind: // bool + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: // int32 + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: // int64 + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: // uint32 + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: // uint64 + case protoreflect.StringKind: // string + default: + return errors.New("invalid key kind: %v", kf.Kind()) + } + if e := vf.Enum(); e != nil && e.Values().Len() > 0 && e.Values().Get(0).Number() != 0 { + return errors.New("map enum value must have zero number for the first value") + } + return nil +} diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go new file mode 100644 index 00000000..a7c5ceff --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go @@ -0,0 +1,252 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package protodesc + +import ( + "fmt" + "strings" + + "google.golang.org/protobuf/internal/encoding/defval" + "google.golang.org/protobuf/internal/strs" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + "google.golang.org/protobuf/types/descriptorpb" +) + +// ToFileDescriptorProto copies a protoreflect.FileDescriptor into a +// google.protobuf.FileDescriptorProto message. +func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto { + p := &descriptorpb.FileDescriptorProto{ + Name: proto.String(file.Path()), + Options: proto.Clone(file.Options()).(*descriptorpb.FileOptions), + } + if file.Package() != "" { + p.Package = proto.String(string(file.Package())) + } + for i, imports := 0, file.Imports(); i < imports.Len(); i++ { + imp := imports.Get(i) + p.Dependency = append(p.Dependency, imp.Path()) + if imp.IsPublic { + p.PublicDependency = append(p.PublicDependency, int32(i)) + } + if imp.IsWeak { + p.WeakDependency = append(p.WeakDependency, int32(i)) + } + } + for i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ { + loc := locs.Get(i) + l := &descriptorpb.SourceCodeInfo_Location{} + l.Path = append(l.Path, loc.Path...) + if loc.StartLine == loc.EndLine { + l.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)} + } else { + l.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)} + } + l.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...) + if loc.LeadingComments != "" { + l.LeadingComments = proto.String(loc.LeadingComments) + } + if loc.TrailingComments != "" { + l.TrailingComments = proto.String(loc.TrailingComments) + } + if p.SourceCodeInfo == nil { + p.SourceCodeInfo = &descriptorpb.SourceCodeInfo{} + } + p.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l) + + } + for i, messages := 0, file.Messages(); i < messages.Len(); i++ { + p.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i))) + } + for i, enums := 0, file.Enums(); i < enums.Len(); i++ { + p.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i))) + } + for i, services := 0, file.Services(); i < services.Len(); i++ { + p.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i))) + } + for i, exts := 0, file.Extensions(); i < exts.Len(); i++ { + p.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i))) + } + if syntax := file.Syntax(); syntax != protoreflect.Proto2 { + p.Syntax = proto.String(file.Syntax().String()) + } + return p +} + +// ToDescriptorProto copies a protoreflect.MessageDescriptor into a +// google.protobuf.DescriptorProto message. +func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto { + p := &descriptorpb.DescriptorProto{ + Name: proto.String(string(message.Name())), + Options: proto.Clone(message.Options()).(*descriptorpb.MessageOptions), + } + for i, fields := 0, message.Fields(); i < fields.Len(); i++ { + p.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i))) + } + for i, exts := 0, message.Extensions(); i < exts.Len(); i++ { + p.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i))) + } + for i, messages := 0, message.Messages(); i < messages.Len(); i++ { + p.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i))) + } + for i, enums := 0, message.Enums(); i < enums.Len(); i++ { + p.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i))) + } + for i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ { + xrange := xranges.Get(i) + p.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{ + Start: proto.Int32(int32(xrange[0])), + End: proto.Int32(int32(xrange[1])), + Options: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions), + }) + } + for i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ { + p.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i))) + } + for i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ { + rrange := ranges.Get(i) + p.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{ + Start: proto.Int32(int32(rrange[0])), + End: proto.Int32(int32(rrange[1])), + }) + } + for i, names := 0, message.ReservedNames(); i < names.Len(); i++ { + p.ReservedName = append(p.ReservedName, string(names.Get(i))) + } + return p +} + +// ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a +// google.protobuf.FieldDescriptorProto message. +func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto { + p := &descriptorpb.FieldDescriptorProto{ + Name: proto.String(string(field.Name())), + Number: proto.Int32(int32(field.Number())), + Label: descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(), + Options: proto.Clone(field.Options()).(*descriptorpb.FieldOptions), + } + if field.IsExtension() { + p.Extendee = fullNameOf(field.ContainingMessage()) + } + if field.Kind().IsValid() { + p.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum() + } + if field.Enum() != nil { + p.TypeName = fullNameOf(field.Enum()) + } + if field.Message() != nil { + p.TypeName = fullNameOf(field.Message()) + } + if field.HasJSONName() { + // A bug in older versions of protoc would always populate the + // "json_name" option for extensions when it is meaningless. + // When it did so, it would always use the camel-cased field name. + if field.IsExtension() { + p.JsonName = proto.String(strs.JSONCamelCase(string(field.Name()))) + } else { + p.JsonName = proto.String(field.JSONName()) + } + } + if field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() { + p.Proto3Optional = proto.Bool(true) + } + if field.HasDefault() { + def, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor) + if err != nil && field.DefaultEnumValue() != nil { + def = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values + } else if err != nil { + panic(fmt.Sprintf("%v: %v", field.FullName(), err)) + } + p.DefaultValue = proto.String(def) + } + if oneof := field.ContainingOneof(); oneof != nil { + p.OneofIndex = proto.Int32(int32(oneof.Index())) + } + return p +} + +// ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a +// google.protobuf.OneofDescriptorProto message. +func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto { + return &descriptorpb.OneofDescriptorProto{ + Name: proto.String(string(oneof.Name())), + Options: proto.Clone(oneof.Options()).(*descriptorpb.OneofOptions), + } +} + +// ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a +// google.protobuf.EnumDescriptorProto message. +func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto { + p := &descriptorpb.EnumDescriptorProto{ + Name: proto.String(string(enum.Name())), + Options: proto.Clone(enum.Options()).(*descriptorpb.EnumOptions), + } + for i, values := 0, enum.Values(); i < values.Len(); i++ { + p.Value = append(p.Value, ToEnumValueDescriptorProto(values.Get(i))) + } + for i, ranges := 0, enum.ReservedRanges(); i < ranges.Len(); i++ { + rrange := ranges.Get(i) + p.ReservedRange = append(p.ReservedRange, &descriptorpb.EnumDescriptorProto_EnumReservedRange{ + Start: proto.Int32(int32(rrange[0])), + End: proto.Int32(int32(rrange[1])), + }) + } + for i, names := 0, enum.ReservedNames(); i < names.Len(); i++ { + p.ReservedName = append(p.ReservedName, string(names.Get(i))) + } + return p +} + +// ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a +// google.protobuf.EnumValueDescriptorProto message. +func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto { + return &descriptorpb.EnumValueDescriptorProto{ + Name: proto.String(string(value.Name())), + Number: proto.Int32(int32(value.Number())), + Options: proto.Clone(value.Options()).(*descriptorpb.EnumValueOptions), + } +} + +// ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a +// google.protobuf.ServiceDescriptorProto message. +func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto { + p := &descriptorpb.ServiceDescriptorProto{ + Name: proto.String(string(service.Name())), + Options: proto.Clone(service.Options()).(*descriptorpb.ServiceOptions), + } + for i, methods := 0, service.Methods(); i < methods.Len(); i++ { + p.Method = append(p.Method, ToMethodDescriptorProto(methods.Get(i))) + } + return p +} + +// ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a +// google.protobuf.MethodDescriptorProto message. +func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto { + p := &descriptorpb.MethodDescriptorProto{ + Name: proto.String(string(method.Name())), + InputType: fullNameOf(method.Input()), + OutputType: fullNameOf(method.Output()), + Options: proto.Clone(method.Options()).(*descriptorpb.MethodOptions), + } + if method.IsStreamingClient() { + p.ClientStreaming = proto.Bool(true) + } + if method.IsStreamingServer() { + p.ServerStreaming = proto.Bool(true) + } + return p +} + +func fullNameOf(d protoreflect.Descriptor) *string { + if d == nil { + return nil + } + if strings.HasPrefix(string(d.FullName()), unknownPrefix) { + return proto.String(string(d.FullName()[len(unknownPrefix):])) + } + return proto.String("." + string(d.FullName())) +} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go index 32ea3d98..121ba3a0 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go @@ -4,6 +4,10 @@ package protoreflect +import ( + "strconv" +) + // SourceLocations is a list of source locations. type SourceLocations interface { // Len reports the number of source locations in the proto file. @@ -11,9 +15,20 @@ type SourceLocations interface { // Get returns the ith SourceLocation. It panics if out of bounds. Get(int) SourceLocation - doNotImplement + // ByPath returns the SourceLocation for the given path, + // returning the first location if multiple exist for the same path. + // If multiple locations exist for the same path, + // then SourceLocation.Next index can be used to identify the + // index of the next SourceLocation. + // If no location exists for this path, it returns the zero value. + ByPath(path SourcePath) SourceLocation - // TODO: Add ByPath and ByDescriptor helper methods. + // ByDescriptor returns the SourceLocation for the given descriptor, + // returning the first location if multiple exist for the same path. + // If no location exists for this descriptor, it returns the zero value. + ByDescriptor(desc Descriptor) SourceLocation + + doNotImplement } // SourceLocation describes a source location and @@ -39,6 +54,10 @@ type SourceLocation struct { LeadingComments string // TrailingComments is the trailing attached comment for the declaration. TrailingComments string + + // Next is an index into SourceLocations for the next source location that + // has the same Path. It is zero if there is no next location. + Next int } // SourcePath identifies part of a file descriptor for a source location. @@ -48,5 +67,62 @@ type SourceLocation struct { // See google.protobuf.SourceCodeInfo.Location.path. type SourcePath []int32 -// TODO: Add SourcePath.String method to pretty-print the path. For example: -// ".message_type[6].nested_type[15].field[3]" +// Equal reports whether p1 equals p2. +func (p1 SourcePath) Equal(p2 SourcePath) bool { + if len(p1) != len(p2) { + return false + } + for i := range p1 { + if p1[i] != p2[i] { + return false + } + } + return true +} + +// String formats the path in a humanly readable manner. +// The output is guaranteed to be deterministic, +// making it suitable for use as a key into a Go map. +// It is not guaranteed to be stable as the exact output could change +// in a future version of this module. +// +// Example output: +// .message_type[6].nested_type[15].field[3] +func (p SourcePath) String() string { + b := p.appendFileDescriptorProto(nil) + for _, i := range p { + b = append(b, '.') + b = strconv.AppendInt(b, int64(i), 10) + } + return string(b) +} + +type appendFunc func(*SourcePath, []byte) []byte + +func (p *SourcePath) appendSingularField(b []byte, name string, f appendFunc) []byte { + if len(*p) == 0 { + return b + } + b = append(b, '.') + b = append(b, name...) + *p = (*p)[1:] + if f != nil { + b = f(p, b) + } + return b +} + +func (p *SourcePath) appendRepeatedField(b []byte, name string, f appendFunc) []byte { + b = p.appendSingularField(b, name, nil) + if len(*p) == 0 || (*p)[0] < 0 { + return b + } + b = append(b, '[') + b = strconv.AppendUint(b, uint64((*p)[0]), 10) + b = append(b, ']') + *p = (*p)[1:] + if f != nil { + b = f(p, b) + } + return b +} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go new file mode 100644 index 00000000..b03c1223 --- /dev/null +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go @@ -0,0 +1,461 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by generate-protos. DO NOT EDIT. + +package protoreflect + +func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendSingularField(b, "package", nil) + case 3: + b = p.appendRepeatedField(b, "dependency", nil) + case 10: + b = p.appendRepeatedField(b, "public_dependency", nil) + case 11: + b = p.appendRepeatedField(b, "weak_dependency", nil) + case 4: + b = p.appendRepeatedField(b, "message_type", (*SourcePath).appendDescriptorProto) + case 5: + b = p.appendRepeatedField(b, "enum_type", (*SourcePath).appendEnumDescriptorProto) + case 6: + b = p.appendRepeatedField(b, "service", (*SourcePath).appendServiceDescriptorProto) + case 7: + b = p.appendRepeatedField(b, "extension", (*SourcePath).appendFieldDescriptorProto) + case 8: + b = p.appendSingularField(b, "options", (*SourcePath).appendFileOptions) + case 9: + b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo) + case 12: + b = p.appendSingularField(b, "syntax", nil) + } + return b +} + +func (p *SourcePath) appendDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendRepeatedField(b, "field", (*SourcePath).appendFieldDescriptorProto) + case 6: + b = p.appendRepeatedField(b, "extension", (*SourcePath).appendFieldDescriptorProto) + case 3: + b = p.appendRepeatedField(b, "nested_type", (*SourcePath).appendDescriptorProto) + case 4: + b = p.appendRepeatedField(b, "enum_type", (*SourcePath).appendEnumDescriptorProto) + case 5: + b = p.appendRepeatedField(b, "extension_range", (*SourcePath).appendDescriptorProto_ExtensionRange) + case 8: + b = p.appendRepeatedField(b, "oneof_decl", (*SourcePath).appendOneofDescriptorProto) + case 7: + b = p.appendSingularField(b, "options", (*SourcePath).appendMessageOptions) + case 9: + b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendDescriptorProto_ReservedRange) + case 10: + b = p.appendRepeatedField(b, "reserved_name", nil) + } + return b +} + +func (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendRepeatedField(b, "value", (*SourcePath).appendEnumValueDescriptorProto) + case 3: + b = p.appendSingularField(b, "options", (*SourcePath).appendEnumOptions) + case 4: + b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange) + case 5: + b = p.appendRepeatedField(b, "reserved_name", nil) + } + return b +} + +func (p *SourcePath) appendServiceDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendRepeatedField(b, "method", (*SourcePath).appendMethodDescriptorProto) + case 3: + b = p.appendSingularField(b, "options", (*SourcePath).appendServiceOptions) + } + return b +} + +func (p *SourcePath) appendFieldDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 3: + b = p.appendSingularField(b, "number", nil) + case 4: + b = p.appendSingularField(b, "label", nil) + case 5: + b = p.appendSingularField(b, "type", nil) + case 6: + b = p.appendSingularField(b, "type_name", nil) + case 2: + b = p.appendSingularField(b, "extendee", nil) + case 7: + b = p.appendSingularField(b, "default_value", nil) + case 9: + b = p.appendSingularField(b, "oneof_index", nil) + case 10: + b = p.appendSingularField(b, "json_name", nil) + case 8: + b = p.appendSingularField(b, "options", (*SourcePath).appendFieldOptions) + case 17: + b = p.appendSingularField(b, "proto3_optional", nil) + } + return b +} + +func (p *SourcePath) appendFileOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "java_package", nil) + case 8: + b = p.appendSingularField(b, "java_outer_classname", nil) + case 10: + b = p.appendSingularField(b, "java_multiple_files", nil) + case 20: + b = p.appendSingularField(b, "java_generate_equals_and_hash", nil) + case 27: + b = p.appendSingularField(b, "java_string_check_utf8", nil) + case 9: + b = p.appendSingularField(b, "optimize_for", nil) + case 11: + b = p.appendSingularField(b, "go_package", nil) + case 16: + b = p.appendSingularField(b, "cc_generic_services", nil) + case 17: + b = p.appendSingularField(b, "java_generic_services", nil) + case 18: + b = p.appendSingularField(b, "py_generic_services", nil) + case 42: + b = p.appendSingularField(b, "php_generic_services", nil) + case 23: + b = p.appendSingularField(b, "deprecated", nil) + case 31: + b = p.appendSingularField(b, "cc_enable_arenas", nil) + case 36: + b = p.appendSingularField(b, "objc_class_prefix", nil) + case 37: + b = p.appendSingularField(b, "csharp_namespace", nil) + case 39: + b = p.appendSingularField(b, "swift_prefix", nil) + case 40: + b = p.appendSingularField(b, "php_class_prefix", nil) + case 41: + b = p.appendSingularField(b, "php_namespace", nil) + case 44: + b = p.appendSingularField(b, "php_metadata_namespace", nil) + case 45: + b = p.appendSingularField(b, "ruby_package", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendSourceCodeInfo(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendRepeatedField(b, "location", (*SourcePath).appendSourceCodeInfo_Location) + } + return b +} + +func (p *SourcePath) appendDescriptorProto_ExtensionRange(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "start", nil) + case 2: + b = p.appendSingularField(b, "end", nil) + case 3: + b = p.appendSingularField(b, "options", (*SourcePath).appendExtensionRangeOptions) + } + return b +} + +func (p *SourcePath) appendOneofDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendSingularField(b, "options", (*SourcePath).appendOneofOptions) + } + return b +} + +func (p *SourcePath) appendMessageOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "message_set_wire_format", nil) + case 2: + b = p.appendSingularField(b, "no_standard_descriptor_accessor", nil) + case 3: + b = p.appendSingularField(b, "deprecated", nil) + case 7: + b = p.appendSingularField(b, "map_entry", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendDescriptorProto_ReservedRange(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "start", nil) + case 2: + b = p.appendSingularField(b, "end", nil) + } + return b +} + +func (p *SourcePath) appendEnumValueDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendSingularField(b, "number", nil) + case 3: + b = p.appendSingularField(b, "options", (*SourcePath).appendEnumValueOptions) + } + return b +} + +func (p *SourcePath) appendEnumOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 2: + b = p.appendSingularField(b, "allow_alias", nil) + case 3: + b = p.appendSingularField(b, "deprecated", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendEnumDescriptorProto_EnumReservedRange(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "start", nil) + case 2: + b = p.appendSingularField(b, "end", nil) + } + return b +} + +func (p *SourcePath) appendMethodDescriptorProto(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name", nil) + case 2: + b = p.appendSingularField(b, "input_type", nil) + case 3: + b = p.appendSingularField(b, "output_type", nil) + case 4: + b = p.appendSingularField(b, "options", (*SourcePath).appendMethodOptions) + case 5: + b = p.appendSingularField(b, "client_streaming", nil) + case 6: + b = p.appendSingularField(b, "server_streaming", nil) + } + return b +} + +func (p *SourcePath) appendServiceOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 33: + b = p.appendSingularField(b, "deprecated", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendFieldOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "ctype", nil) + case 2: + b = p.appendSingularField(b, "packed", nil) + case 6: + b = p.appendSingularField(b, "jstype", nil) + case 5: + b = p.appendSingularField(b, "lazy", nil) + case 3: + b = p.appendSingularField(b, "deprecated", nil) + case 10: + b = p.appendSingularField(b, "weak", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendUninterpretedOption(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 2: + b = p.appendRepeatedField(b, "name", (*SourcePath).appendUninterpretedOption_NamePart) + case 3: + b = p.appendSingularField(b, "identifier_value", nil) + case 4: + b = p.appendSingularField(b, "positive_int_value", nil) + case 5: + b = p.appendSingularField(b, "negative_int_value", nil) + case 6: + b = p.appendSingularField(b, "double_value", nil) + case 7: + b = p.appendSingularField(b, "string_value", nil) + case 8: + b = p.appendSingularField(b, "aggregate_value", nil) + } + return b +} + +func (p *SourcePath) appendSourceCodeInfo_Location(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendRepeatedField(b, "path", nil) + case 2: + b = p.appendRepeatedField(b, "span", nil) + case 3: + b = p.appendSingularField(b, "leading_comments", nil) + case 4: + b = p.appendSingularField(b, "trailing_comments", nil) + case 6: + b = p.appendRepeatedField(b, "leading_detached_comments", nil) + } + return b +} + +func (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendOneofOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendEnumValueOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "deprecated", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendMethodOptions(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 33: + b = p.appendSingularField(b, "deprecated", nil) + case 34: + b = p.appendSingularField(b, "idempotency_level", nil) + case 999: + b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption) + } + return b +} + +func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte { + if len(*p) == 0 { + return b + } + switch (*p)[0] { + case 1: + b = p.appendSingularField(b, "name_part", nil) + case 2: + b = p.appendSingularField(b, "is_extension", nil) + } + return b +} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go index 5be14a72..8e53c44a 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go @@ -232,11 +232,15 @@ type MessageDescriptor interface { type isMessageDescriptor interface{ ProtoType(MessageDescriptor) } // MessageType encapsulates a MessageDescriptor with a concrete Go implementation. +// It is recommended that implementations of this interface also implement the +// MessageFieldTypes interface. type MessageType interface { // New returns a newly allocated empty message. + // It may return nil for synthetic messages representing a map entry. New() Message // Zero returns an empty, read-only message. + // It may return nil for synthetic messages representing a map entry. Zero() Message // Descriptor returns the message descriptor. @@ -245,6 +249,26 @@ type MessageType interface { Descriptor() MessageDescriptor } +// MessageFieldTypes extends a MessageType by providing type information +// regarding enums and messages referenced by the message fields. +type MessageFieldTypes interface { + MessageType + + // Enum returns the EnumType for the ith field in Descriptor.Fields. + // It returns nil if the ith field is not an enum kind. + // It panics if out of bounds. + // + // Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum() + Enum(i int) EnumType + + // Message returns the MessageType for the ith field in Descriptor.Fields. + // It returns nil if the ith field is not a message or group kind. + // It panics if out of bounds. + // + // Invariant: mt.Message(i).Descriptor() == mt.Descriptor().Fields(i).Message() + Message(i int) MessageType +} + // MessageDescriptors is a list of message declarations. type MessageDescriptors interface { // Len reports the number of messages. @@ -279,8 +303,15 @@ type FieldDescriptor interface { // JSONName reports the name used for JSON serialization. // It is usually the camel-cased form of the field name. + // Extension fields are represented by the full name surrounded by brackets. JSONName() string + // TextName reports the name used for text serialization. + // It is usually the name of the field, except that groups use the name + // of the inlined message, and extension fields are represented by the + // full name surrounded by brackets. + TextName() string + // HasPresence reports whether the field distinguishes between unpopulated // and default values. HasPresence() bool @@ -371,6 +402,9 @@ type FieldDescriptors interface { // ByJSONName returns the FieldDescriptor for a field with s as the JSON name. // It returns nil if not found. ByJSONName(s string) FieldDescriptor + // ByTextName returns the FieldDescriptor for a field with s as the text name. + // It returns nil if not found. + ByTextName(s string) FieldDescriptor // ByNumber returns the FieldDescriptor for a field numbered n. // It returns nil if not found. ByNumber(n FieldNumber) FieldDescriptor diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go index 5e5f9671..59f024c4 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +++ b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go @@ -17,24 +17,49 @@ package protoregistry import ( "fmt" - "log" + "os" "strings" "sync" + "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/errors" + "google.golang.org/protobuf/internal/flags" "google.golang.org/protobuf/reflect/protoreflect" ) +// conflictPolicy configures the policy for handling registration conflicts. +// +// It can be over-written at compile time with a linker-initialized variable: +// go build -ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn" +// +// It can be over-written at program execution with an environment variable: +// GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn ./main +// +// Neither of the above are covered by the compatibility promise and +// may be removed in a future release of this module. +var conflictPolicy = "panic" // "panic" | "warn" | "ignore" + // ignoreConflict reports whether to ignore a registration conflict // given the descriptor being registered and the error. // It is a variable so that the behavior is easily overridden in another file. var ignoreConflict = func(d protoreflect.Descriptor, err error) bool { - log.Printf(""+ - "WARNING: %v\n"+ - "A future release will panic on registration conflicts. See:\n"+ - "https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict\n"+ - "\n", err) - return true + const env = "GOLANG_PROTOBUF_REGISTRATION_CONFLICT" + const faq = "https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict" + policy := conflictPolicy + if v := os.Getenv(env); v != "" { + policy = v + } + switch policy { + case "panic": + panic(fmt.Sprintf("%v\nSee %v\n", err, faq)) + case "warn": + fmt.Fprintf(os.Stderr, "WARNING: %v\nSee %v\n\n", err, faq) + return true + case "ignore": + return true + default: + panic("invalid " + env + " value: " + os.Getenv(env)) + } } var globalMutex sync.RWMutex @@ -69,7 +94,8 @@ type Files struct { // Note that enum values are in the top-level since that are in the same // scope as the parent enum. descsByName map[protoreflect.FullName]interface{} - filesByPath map[string]protoreflect.FileDescriptor + filesByPath map[string][]protoreflect.FileDescriptor + numFiles int } type packageDescriptor struct { @@ -92,48 +118,16 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error { r.descsByName = map[protoreflect.FullName]interface{}{ "": &packageDescriptor{}, } - r.filesByPath = make(map[string]protoreflect.FileDescriptor) + r.filesByPath = make(map[string][]protoreflect.FileDescriptor) } path := file.Path() - if prev := r.filesByPath[path]; prev != nil { - // TODO: Remove this after some soak-in period after moving these types. - var prevPath string - const prevModule = "google.golang.org/genproto" - const prevVersion = "cb27e3aa (May 26th, 2020)" - switch path { - case "google/protobuf/field_mask.proto": - prevPath = prevModule + "/protobuf/field_mask" - case "google/protobuf/api.proto": - prevPath = prevModule + "/protobuf/api" - case "google/protobuf/type.proto": - prevPath = prevModule + "/protobuf/ptype" - case "google/protobuf/source_context.proto": - prevPath = prevModule + "/protobuf/source_context" - } - if r == GlobalFiles && prevPath != "" { - pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto") - pkgName = strings.Replace(pkgName, "_", "", -1) + "pb" - currPath := "google.golang.org/protobuf/types/known/" + pkgName - panic(fmt.Sprintf(""+ - "duplicate registration of %q\n"+ - "\n"+ - "The generated definition for this file has moved:\n"+ - "\tfrom: %q\n"+ - "\tto: %q\n"+ - "A dependency on the %q module must\n"+ - "be at version %v or higher.\n"+ - "\n"+ - "Upgrade the dependency by running:\n"+ - "\tgo get -u %v\n", - path, prevPath, currPath, prevModule, prevVersion, prevPath)) - } - + if prev := r.filesByPath[path]; len(prev) > 0 { + r.checkGenProtoConflict(path) err := errors.New("file %q is already registered", file.Path()) - err = amendErrorWithCaller(err, prev, file) - if r == GlobalFiles && ignoreConflict(file, err) { - err = nil + err = amendErrorWithCaller(err, prev[0], file) + if !(r == GlobalFiles && ignoreConflict(file, err)) { + return err } - return err } for name := file.Package(); name != ""; name = name.Parent() { @@ -174,10 +168,52 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error { rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) { r.descsByName[d.FullName()] = d }) - r.filesByPath[path] = file + r.filesByPath[path] = append(r.filesByPath[path], file) + r.numFiles++ return nil } +// Several well-known types were hosted in the google.golang.org/genproto module +// but were later moved to this module. To avoid a weak dependency on the +// genproto module (and its relatively large set of transitive dependencies), +// we rely on a registration conflict to determine whether the genproto version +// is too old (i.e., does not contain aliases to the new type declarations). +func (r *Files) checkGenProtoConflict(path string) { + if r != GlobalFiles { + return + } + var prevPath string + const prevModule = "google.golang.org/genproto" + const prevVersion = "cb27e3aa (May 26th, 2020)" + switch path { + case "google/protobuf/field_mask.proto": + prevPath = prevModule + "/protobuf/field_mask" + case "google/protobuf/api.proto": + prevPath = prevModule + "/protobuf/api" + case "google/protobuf/type.proto": + prevPath = prevModule + "/protobuf/ptype" + case "google/protobuf/source_context.proto": + prevPath = prevModule + "/protobuf/source_context" + default: + return + } + pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto") + pkgName = strings.Replace(pkgName, "_", "", -1) + "pb" // e.g., "field_mask" => "fieldmaskpb" + currPath := "google.golang.org/protobuf/types/known/" + pkgName + panic(fmt.Sprintf(""+ + "duplicate registration of %q\n"+ + "\n"+ + "The generated definition for this file has moved:\n"+ + "\tfrom: %q\n"+ + "\tto: %q\n"+ + "A dependency on the %q module must\n"+ + "be at version %v or higher.\n"+ + "\n"+ + "Upgrade the dependency by running:\n"+ + "\tgo get -u %v\n", + path, prevPath, currPath, prevModule, prevVersion, prevPath)) +} + // FindDescriptorByName looks up a descriptor by the full name. // // This returns (nil, NotFound) if not found. @@ -273,6 +309,7 @@ func (s *nameSuffix) Pop() (name protoreflect.Name) { // FindFileByPath looks up a file by the path. // // This returns (nil, NotFound) if not found. +// This returns an error if multiple files have the same path. func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { if r == nil { return nil, NotFound @@ -281,13 +318,19 @@ func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) globalMutex.RLock() defer globalMutex.RUnlock() } - if fd, ok := r.filesByPath[path]; ok { - return fd, nil + fds := r.filesByPath[path] + switch len(fds) { + case 0: + return nil, NotFound + case 1: + return fds[0], nil + default: + return nil, errors.New("multiple files named %q", path) } - return nil, NotFound } -// NumFiles reports the number of registered files. +// NumFiles reports the number of registered files, +// including duplicate files with the same name. func (r *Files) NumFiles() int { if r == nil { return 0 @@ -296,10 +339,11 @@ func (r *Files) NumFiles() int { globalMutex.RLock() defer globalMutex.RUnlock() } - return len(r.filesByPath) + return r.numFiles } // RangeFiles iterates over all registered files while f returns true. +// If multiple files have the same name, RangeFiles iterates over all of them. // The iteration order is undefined. func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) { if r == nil { @@ -309,9 +353,11 @@ func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) { globalMutex.RLock() defer globalMutex.RUnlock() } - for _, file := range r.filesByPath { - if !f(file) { - return + for _, files := range r.filesByPath { + for _, file := range files { + if !f(file) { + return + } } } } @@ -560,13 +606,25 @@ func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumTyp return nil, NotFound } -// FindMessageByName looks up a message by its full name. -// E.g., "google.protobuf.Any" +// FindMessageByName looks up a message by its full name, +// e.g. "google.protobuf.Any". // -// This return (nil, NotFound) if not found. +// This returns (nil, NotFound) if not found. func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) { - // The full name by itself is a valid URL. - return r.FindMessageByURL(string(message)) + if r == nil { + return nil, NotFound + } + if r == GlobalTypes { + globalMutex.RLock() + defer globalMutex.RUnlock() + } + if v := r.typesByName[message]; v != nil { + if mt, _ := v.(protoreflect.MessageType); mt != nil { + return mt, nil + } + return nil, errors.New("found wrong type: got %v, want message", typeName(v)) + } + return nil, NotFound } // FindMessageByURL looks up a message by a URL identifier. @@ -574,6 +632,8 @@ func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.M // // This returns (nil, NotFound) if not found. func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) { + // This function is similar to FindMessageByName but + // truncates anything before and including '/' in the URL. if r == nil { return nil, NotFound } @@ -613,6 +673,26 @@ func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.E if xt, _ := v.(protoreflect.ExtensionType); xt != nil { return xt, nil } + + // MessageSet extensions are special in that the name of the extension + // is the name of the message type used to extend the MessageSet. + // This naming scheme is used by text and JSON serialization. + // + // This feature is protected by the ProtoLegacy flag since MessageSets + // are a proto1 feature that is long deprecated. + if flags.ProtoLegacy { + if _, ok := v.(protoreflect.MessageType); ok { + field := field.Append(messageset.ExtensionName) + if v := r.typesByName[field]; v != nil { + if xt, _ := v.(protoreflect.ExtensionType); xt != nil { + if messageset.IsMessageSetExtension(xt.TypeDescriptor()) { + return xt, nil + } + } + } + } + } + return nil, errors.New("found wrong type: got %v, want extension", typeName(v)) } return nil, NotFound diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go new file mode 100644 index 00000000..abe4ab51 --- /dev/null +++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -0,0 +1,3957 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/descriptor.proto + +package descriptorpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +type FieldDescriptorProto_Type int32 + +const ( + // 0 is reserved for errors. + // Order is weird for historical reasons. + FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 + FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 + FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 + FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 + FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 + FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 + FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 + FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 // Length-delimited aggregate. + // New in version 2. + FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 + FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 + FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 + FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 + FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 + FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 // Uses ZigZag encoding. + FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 // Uses ZigZag encoding. +) + +// Enum value maps for FieldDescriptorProto_Type. +var ( + FieldDescriptorProto_Type_name = map[int32]string{ + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", + } + FieldDescriptorProto_Type_value = map[string]int32{ + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, + } +) + +func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { + p := new(FieldDescriptorProto_Type) + *p = x + return p +} + +func (x FieldDescriptorProto_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldDescriptorProto_Type) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[0].Descriptor() +} + +func (FieldDescriptorProto_Type) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[0] +} + +func (x FieldDescriptorProto_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FieldDescriptorProto_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FieldDescriptorProto_Type(num) + return nil +} + +// Deprecated: Use FieldDescriptorProto_Type.Descriptor instead. +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4, 0} +} + +type FieldDescriptorProto_Label int32 + +const ( + // 0 is reserved for errors + FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 + FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 +) + +// Enum value maps for FieldDescriptorProto_Label. +var ( + FieldDescriptorProto_Label_name = map[int32]string{ + 1: "LABEL_OPTIONAL", + 2: "LABEL_REQUIRED", + 3: "LABEL_REPEATED", + } + FieldDescriptorProto_Label_value = map[string]int32{ + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3, + } +) + +func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { + p := new(FieldDescriptorProto_Label) + *p = x + return p +} + +func (x FieldDescriptorProto_Label) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldDescriptorProto_Label) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor() +} + +func (FieldDescriptorProto_Label) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[1] +} + +func (x FieldDescriptorProto_Label) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FieldDescriptorProto_Label) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FieldDescriptorProto_Label(num) + return nil +} + +// Deprecated: Use FieldDescriptorProto_Label.Descriptor instead. +func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4, 1} +} + +// Generated classes can be optimized for speed or code size. +type FileOptions_OptimizeMode int32 + +const ( + FileOptions_SPEED FileOptions_OptimizeMode = 1 // Generate complete code for parsing, serialization, + // etc. + FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 // Use ReflectionOps to implement these methods. + FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 // Generate code using MessageLite and the lite runtime. +) + +// Enum value maps for FileOptions_OptimizeMode. +var ( + FileOptions_OptimizeMode_name = map[int32]string{ + 1: "SPEED", + 2: "CODE_SIZE", + 3: "LITE_RUNTIME", + } + FileOptions_OptimizeMode_value = map[string]int32{ + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3, + } +) + +func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { + p := new(FileOptions_OptimizeMode) + *p = x + return p +} + +func (x FileOptions_OptimizeMode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FileOptions_OptimizeMode) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor() +} + +func (FileOptions_OptimizeMode) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[2] +} + +func (x FileOptions_OptimizeMode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FileOptions_OptimizeMode) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FileOptions_OptimizeMode(num) + return nil +} + +// Deprecated: Use FileOptions_OptimizeMode.Descriptor instead. +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10, 0} +} + +type FieldOptions_CType int32 + +const ( + // Default mode. + FieldOptions_STRING FieldOptions_CType = 0 + FieldOptions_CORD FieldOptions_CType = 1 + FieldOptions_STRING_PIECE FieldOptions_CType = 2 +) + +// Enum value maps for FieldOptions_CType. +var ( + FieldOptions_CType_name = map[int32]string{ + 0: "STRING", + 1: "CORD", + 2: "STRING_PIECE", + } + FieldOptions_CType_value = map[string]int32{ + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2, + } +) + +func (x FieldOptions_CType) Enum() *FieldOptions_CType { + p := new(FieldOptions_CType) + *p = x + return p +} + +func (x FieldOptions_CType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldOptions_CType) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor() +} + +func (FieldOptions_CType) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[3] +} + +func (x FieldOptions_CType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FieldOptions_CType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FieldOptions_CType(num) + return nil +} + +// Deprecated: Use FieldOptions_CType.Descriptor instead. +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 0} +} + +type FieldOptions_JSType int32 + +const ( + // Use the default type. + FieldOptions_JS_NORMAL FieldOptions_JSType = 0 + // Use JavaScript strings. + FieldOptions_JS_STRING FieldOptions_JSType = 1 + // Use JavaScript numbers. + FieldOptions_JS_NUMBER FieldOptions_JSType = 2 +) + +// Enum value maps for FieldOptions_JSType. +var ( + FieldOptions_JSType_name = map[int32]string{ + 0: "JS_NORMAL", + 1: "JS_STRING", + 2: "JS_NUMBER", + } + FieldOptions_JSType_value = map[string]int32{ + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2, + } +) + +func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { + p := new(FieldOptions_JSType) + *p = x + return p +} + +func (x FieldOptions_JSType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FieldOptions_JSType) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor() +} + +func (FieldOptions_JSType) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[4] +} + +func (x FieldOptions_JSType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *FieldOptions_JSType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = FieldOptions_JSType(num) + return nil +} + +// Deprecated: Use FieldOptions_JSType.Descriptor instead. +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 1} +} + +// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, +// or neither? HTTP based RPC implementation may choose GET verb for safe +// methods, and PUT verb for idempotent methods instead of the default POST. +type MethodOptions_IdempotencyLevel int32 + +const ( + MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 + MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 // implies idempotent + MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 // idempotent, but may have side effects +) + +// Enum value maps for MethodOptions_IdempotencyLevel. +var ( + MethodOptions_IdempotencyLevel_name = map[int32]string{ + 0: "IDEMPOTENCY_UNKNOWN", + 1: "NO_SIDE_EFFECTS", + 2: "IDEMPOTENT", + } + MethodOptions_IdempotencyLevel_value = map[string]int32{ + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2, + } +) + +func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { + p := new(MethodOptions_IdempotencyLevel) + *p = x + return p +} + +func (x MethodOptions_IdempotencyLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MethodOptions_IdempotencyLevel) Descriptor() protoreflect.EnumDescriptor { + return file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor() +} + +func (MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType { + return &file_google_protobuf_descriptor_proto_enumTypes[5] +} + +func (x MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = MethodOptions_IdempotencyLevel(num) + return nil +} + +// Deprecated: Use MethodOptions_IdempotencyLevel.Descriptor instead. +func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17, 0} +} + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +type FileDescriptorSet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` +} + +func (x *FileDescriptorSet) Reset() { + *x = FileDescriptorSet{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileDescriptorSet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileDescriptorSet) ProtoMessage() {} + +func (x *FileDescriptorSet) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileDescriptorSet.ProtoReflect.Descriptor instead. +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{0} +} + +func (x *FileDescriptorSet) GetFile() []*FileDescriptorProto { + if x != nil { + return x.File + } + return nil +} + +// Describes a complete .proto file. +type FileDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // file name, relative to root of source tree + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` // e.g. "foo", "foo.bar", etc. + // Names of files imported by this file. + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + // Indexes of the public imported files in the dependency list above. + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // All top-level definitions in this file. + MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` +} + +func (x *FileDescriptorProto) Reset() { + *x = FileDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileDescriptorProto) ProtoMessage() {} + +func (x *FileDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileDescriptorProto.ProtoReflect.Descriptor instead. +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{1} +} + +func (x *FileDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *FileDescriptorProto) GetPackage() string { + if x != nil && x.Package != nil { + return *x.Package + } + return "" +} + +func (x *FileDescriptorProto) GetDependency() []string { + if x != nil { + return x.Dependency + } + return nil +} + +func (x *FileDescriptorProto) GetPublicDependency() []int32 { + if x != nil { + return x.PublicDependency + } + return nil +} + +func (x *FileDescriptorProto) GetWeakDependency() []int32 { + if x != nil { + return x.WeakDependency + } + return nil +} + +func (x *FileDescriptorProto) GetMessageType() []*DescriptorProto { + if x != nil { + return x.MessageType + } + return nil +} + +func (x *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { + if x != nil { + return x.EnumType + } + return nil +} + +func (x *FileDescriptorProto) GetService() []*ServiceDescriptorProto { + if x != nil { + return x.Service + } + return nil +} + +func (x *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { + if x != nil { + return x.Extension + } + return nil +} + +func (x *FileDescriptorProto) GetOptions() *FileOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { + if x != nil { + return x.SourceCodeInfo + } + return nil +} + +func (x *FileDescriptorProto) GetSyntax() string { + if x != nil && x.Syntax != nil { + return *x.Syntax + } + return "" +} + +// Describes a message type. +type DescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` + NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` + OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` + Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` + ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` +} + +func (x *DescriptorProto) Reset() { + *x = DescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DescriptorProto) ProtoMessage() {} + +func (x *DescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DescriptorProto.ProtoReflect.Descriptor instead. +func (*DescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2} +} + +func (x *DescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *DescriptorProto) GetField() []*FieldDescriptorProto { + if x != nil { + return x.Field + } + return nil +} + +func (x *DescriptorProto) GetExtension() []*FieldDescriptorProto { + if x != nil { + return x.Extension + } + return nil +} + +func (x *DescriptorProto) GetNestedType() []*DescriptorProto { + if x != nil { + return x.NestedType + } + return nil +} + +func (x *DescriptorProto) GetEnumType() []*EnumDescriptorProto { + if x != nil { + return x.EnumType + } + return nil +} + +func (x *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { + if x != nil { + return x.ExtensionRange + } + return nil +} + +func (x *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { + if x != nil { + return x.OneofDecl + } + return nil +} + +func (x *DescriptorProto) GetOptions() *MessageOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { + if x != nil { + return x.ReservedRange + } + return nil +} + +func (x *DescriptorProto) GetReservedName() []string { + if x != nil { + return x.ReservedName + } + return nil +} + +type ExtensionRangeOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +func (x *ExtensionRangeOptions) Reset() { + *x = ExtensionRangeOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExtensionRangeOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionRangeOptions) ProtoMessage() {} + +func (x *ExtensionRangeOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Descriptor instead. +func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{3} +} + +func (x *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +// Describes a field within a message. +type FieldDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` + Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // If true, this is a proto3 "optional". When a proto3 field is optional, it + // tracks presence regardless of field type. + // + // When proto3_optional is true, this field must be belong to a oneof to + // signal to old proto3 clients that presence is tracked for this field. This + // oneof is known as a "synthetic" oneof, and this field must be its sole + // member (each proto3 optional field gets its own synthetic oneof). Synthetic + // oneofs exist in the descriptor only, and do not generate any API. Synthetic + // oneofs must be ordered after all "real" oneofs. + // + // For message fields, proto3_optional doesn't create any semantic change, + // since non-repeated message fields always track presence. However it still + // indicates the semantic detail of whether the user wrote "optional" or not. + // This can be useful for round-tripping the .proto file. For consistency we + // give message fields a synthetic oneof also, even though it is not required + // to track presence. This is especially important because the parser can't + // tell if a field is a message or an enum, so it must always create a + // synthetic oneof. + // + // Proto2 optional fields do not set this flag, because they already indicate + // optional with `LABEL_OPTIONAL`. + Proto3Optional *bool `protobuf:"varint,17,opt,name=proto3_optional,json=proto3Optional" json:"proto3_optional,omitempty"` +} + +func (x *FieldDescriptorProto) Reset() { + *x = FieldDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldDescriptorProto) ProtoMessage() {} + +func (x *FieldDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldDescriptorProto.ProtoReflect.Descriptor instead. +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4} +} + +func (x *FieldDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *FieldDescriptorProto) GetNumber() int32 { + if x != nil && x.Number != nil { + return *x.Number + } + return 0 +} + +func (x *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { + if x != nil && x.Label != nil { + return *x.Label + } + return FieldDescriptorProto_LABEL_OPTIONAL +} + +func (x *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { + if x != nil && x.Type != nil { + return *x.Type + } + return FieldDescriptorProto_TYPE_DOUBLE +} + +func (x *FieldDescriptorProto) GetTypeName() string { + if x != nil && x.TypeName != nil { + return *x.TypeName + } + return "" +} + +func (x *FieldDescriptorProto) GetExtendee() string { + if x != nil && x.Extendee != nil { + return *x.Extendee + } + return "" +} + +func (x *FieldDescriptorProto) GetDefaultValue() string { + if x != nil && x.DefaultValue != nil { + return *x.DefaultValue + } + return "" +} + +func (x *FieldDescriptorProto) GetOneofIndex() int32 { + if x != nil && x.OneofIndex != nil { + return *x.OneofIndex + } + return 0 +} + +func (x *FieldDescriptorProto) GetJsonName() string { + if x != nil && x.JsonName != nil { + return *x.JsonName + } + return "" +} + +func (x *FieldDescriptorProto) GetOptions() *FieldOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *FieldDescriptorProto) GetProto3Optional() bool { + if x != nil && x.Proto3Optional != nil { + return *x.Proto3Optional + } + return false +} + +// Describes a oneof. +type OneofDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` +} + +func (x *OneofDescriptorProto) Reset() { + *x = OneofDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OneofDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OneofDescriptorProto) ProtoMessage() {} + +func (x *OneofDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OneofDescriptorProto.ProtoReflect.Descriptor instead. +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{5} +} + +func (x *OneofDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *OneofDescriptorProto) GetOptions() *OneofOptions { + if x != nil { + return x.Options + } + return nil +} + +// Describes an enum type. +type EnumDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` +} + +func (x *EnumDescriptorProto) Reset() { + *x = EnumDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumDescriptorProto) ProtoMessage() {} + +func (x *EnumDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumDescriptorProto.ProtoReflect.Descriptor instead. +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6} +} + +func (x *EnumDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { + if x != nil { + return x.Value + } + return nil +} + +func (x *EnumDescriptorProto) GetOptions() *EnumOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { + if x != nil { + return x.ReservedRange + } + return nil +} + +func (x *EnumDescriptorProto) GetReservedName() []string { + if x != nil { + return x.ReservedName + } + return nil +} + +// Describes a value within an enum. +type EnumValueDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` +} + +func (x *EnumValueDescriptorProto) Reset() { + *x = EnumValueDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumValueDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumValueDescriptorProto) ProtoMessage() {} + +func (x *EnumValueDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumValueDescriptorProto.ProtoReflect.Descriptor instead. +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{7} +} + +func (x *EnumValueDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *EnumValueDescriptorProto) GetNumber() int32 { + if x != nil && x.Number != nil { + return *x.Number + } + return 0 +} + +func (x *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { + if x != nil { + return x.Options + } + return nil +} + +// Describes a service. +type ServiceDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` +} + +func (x *ServiceDescriptorProto) Reset() { + *x = ServiceDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceDescriptorProto) ProtoMessage() {} + +func (x *ServiceDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceDescriptorProto.ProtoReflect.Descriptor instead. +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{8} +} + +func (x *ServiceDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { + if x != nil { + return x.Method + } + return nil +} + +func (x *ServiceDescriptorProto) GetOptions() *ServiceOptions { + if x != nil { + return x.Options + } + return nil +} + +// Describes a method of a service. +type MethodDescriptorProto struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` + OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` + Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + // Identifies if client streams multiple client messages + ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` + // Identifies if server streams multiple server messages + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` +} + +// Default values for MethodDescriptorProto fields. +const ( + Default_MethodDescriptorProto_ClientStreaming = bool(false) + Default_MethodDescriptorProto_ServerStreaming = bool(false) +) + +func (x *MethodDescriptorProto) Reset() { + *x = MethodDescriptorProto{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MethodDescriptorProto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MethodDescriptorProto) ProtoMessage() {} + +func (x *MethodDescriptorProto) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MethodDescriptorProto.ProtoReflect.Descriptor instead. +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{9} +} + +func (x *MethodDescriptorProto) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *MethodDescriptorProto) GetInputType() string { + if x != nil && x.InputType != nil { + return *x.InputType + } + return "" +} + +func (x *MethodDescriptorProto) GetOutputType() string { + if x != nil && x.OutputType != nil { + return *x.OutputType + } + return "" +} + +func (x *MethodDescriptorProto) GetOptions() *MethodOptions { + if x != nil { + return x.Options + } + return nil +} + +func (x *MethodDescriptorProto) GetClientStreaming() bool { + if x != nil && x.ClientStreaming != nil { + return *x.ClientStreaming + } + return Default_MethodDescriptorProto_ClientStreaming +} + +func (x *MethodDescriptorProto) GetServerStreaming() bool { + if x != nil && x.ServerStreaming != nil { + return *x.ServerStreaming + } + return Default_MethodDescriptorProto_ServerStreaming +} + +type FileOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` + // This option does nothing. + // + // Deprecated: Do not use. + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` + OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` + JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` + PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` + PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=1" json:"cc_enable_arenas,omitempty"` + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` + // Namespace for generated classes; defaults to the package. + CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be + // used for determining the namespace. + PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for FileOptions fields. +const ( + Default_FileOptions_JavaMultipleFiles = bool(false) + Default_FileOptions_JavaStringCheckUtf8 = bool(false) + Default_FileOptions_OptimizeFor = FileOptions_SPEED + Default_FileOptions_CcGenericServices = bool(false) + Default_FileOptions_JavaGenericServices = bool(false) + Default_FileOptions_PyGenericServices = bool(false) + Default_FileOptions_PhpGenericServices = bool(false) + Default_FileOptions_Deprecated = bool(false) + Default_FileOptions_CcEnableArenas = bool(true) +) + +func (x *FileOptions) Reset() { + *x = FileOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileOptions) ProtoMessage() {} + +func (x *FileOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileOptions.ProtoReflect.Descriptor instead. +func (*FileOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10} +} + +func (x *FileOptions) GetJavaPackage() string { + if x != nil && x.JavaPackage != nil { + return *x.JavaPackage + } + return "" +} + +func (x *FileOptions) GetJavaOuterClassname() string { + if x != nil && x.JavaOuterClassname != nil { + return *x.JavaOuterClassname + } + return "" +} + +func (x *FileOptions) GetJavaMultipleFiles() bool { + if x != nil && x.JavaMultipleFiles != nil { + return *x.JavaMultipleFiles + } + return Default_FileOptions_JavaMultipleFiles +} + +// Deprecated: Do not use. +func (x *FileOptions) GetJavaGenerateEqualsAndHash() bool { + if x != nil && x.JavaGenerateEqualsAndHash != nil { + return *x.JavaGenerateEqualsAndHash + } + return false +} + +func (x *FileOptions) GetJavaStringCheckUtf8() bool { + if x != nil && x.JavaStringCheckUtf8 != nil { + return *x.JavaStringCheckUtf8 + } + return Default_FileOptions_JavaStringCheckUtf8 +} + +func (x *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { + if x != nil && x.OptimizeFor != nil { + return *x.OptimizeFor + } + return Default_FileOptions_OptimizeFor +} + +func (x *FileOptions) GetGoPackage() string { + if x != nil && x.GoPackage != nil { + return *x.GoPackage + } + return "" +} + +func (x *FileOptions) GetCcGenericServices() bool { + if x != nil && x.CcGenericServices != nil { + return *x.CcGenericServices + } + return Default_FileOptions_CcGenericServices +} + +func (x *FileOptions) GetJavaGenericServices() bool { + if x != nil && x.JavaGenericServices != nil { + return *x.JavaGenericServices + } + return Default_FileOptions_JavaGenericServices +} + +func (x *FileOptions) GetPyGenericServices() bool { + if x != nil && x.PyGenericServices != nil { + return *x.PyGenericServices + } + return Default_FileOptions_PyGenericServices +} + +func (x *FileOptions) GetPhpGenericServices() bool { + if x != nil && x.PhpGenericServices != nil { + return *x.PhpGenericServices + } + return Default_FileOptions_PhpGenericServices +} + +func (x *FileOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_FileOptions_Deprecated +} + +func (x *FileOptions) GetCcEnableArenas() bool { + if x != nil && x.CcEnableArenas != nil { + return *x.CcEnableArenas + } + return Default_FileOptions_CcEnableArenas +} + +func (x *FileOptions) GetObjcClassPrefix() string { + if x != nil && x.ObjcClassPrefix != nil { + return *x.ObjcClassPrefix + } + return "" +} + +func (x *FileOptions) GetCsharpNamespace() string { + if x != nil && x.CsharpNamespace != nil { + return *x.CsharpNamespace + } + return "" +} + +func (x *FileOptions) GetSwiftPrefix() string { + if x != nil && x.SwiftPrefix != nil { + return *x.SwiftPrefix + } + return "" +} + +func (x *FileOptions) GetPhpClassPrefix() string { + if x != nil && x.PhpClassPrefix != nil { + return *x.PhpClassPrefix + } + return "" +} + +func (x *FileOptions) GetPhpNamespace() string { + if x != nil && x.PhpNamespace != nil { + return *x.PhpNamespace + } + return "" +} + +func (x *FileOptions) GetPhpMetadataNamespace() string { + if x != nil && x.PhpMetadataNamespace != nil { + return *x.PhpMetadataNamespace + } + return "" +} + +func (x *FileOptions) GetRubyPackage() string { + if x != nil && x.RubyPackage != nil { + return *x.RubyPackage + } + return "" +} + +func (x *FileOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type MessageOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementations still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for MessageOptions fields. +const ( + Default_MessageOptions_MessageSetWireFormat = bool(false) + Default_MessageOptions_NoStandardDescriptorAccessor = bool(false) + Default_MessageOptions_Deprecated = bool(false) +) + +func (x *MessageOptions) Reset() { + *x = MessageOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageOptions) ProtoMessage() {} + +func (x *MessageOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageOptions.ProtoReflect.Descriptor instead. +func (*MessageOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{11} +} + +func (x *MessageOptions) GetMessageSetWireFormat() bool { + if x != nil && x.MessageSetWireFormat != nil { + return *x.MessageSetWireFormat + } + return Default_MessageOptions_MessageSetWireFormat +} + +func (x *MessageOptions) GetNoStandardDescriptorAccessor() bool { + if x != nil && x.NoStandardDescriptorAccessor != nil { + return *x.NoStandardDescriptorAccessor + } + return Default_MessageOptions_NoStandardDescriptorAccessor +} + +func (x *MessageOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_MessageOptions_Deprecated +} + +func (x *MessageOptions) GetMapEntry() bool { + if x != nil && x.MapEntry != nil { + return *x.MapEntry + } + return false +} + +func (x *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type FieldOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // For Google-internal migration only. Do not use. + Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for FieldOptions fields. +const ( + Default_FieldOptions_Ctype = FieldOptions_STRING + Default_FieldOptions_Jstype = FieldOptions_JS_NORMAL + Default_FieldOptions_Lazy = bool(false) + Default_FieldOptions_Deprecated = bool(false) + Default_FieldOptions_Weak = bool(false) +) + +func (x *FieldOptions) Reset() { + *x = FieldOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FieldOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FieldOptions) ProtoMessage() {} + +func (x *FieldOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead. +func (*FieldOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12} +} + +func (x *FieldOptions) GetCtype() FieldOptions_CType { + if x != nil && x.Ctype != nil { + return *x.Ctype + } + return Default_FieldOptions_Ctype +} + +func (x *FieldOptions) GetPacked() bool { + if x != nil && x.Packed != nil { + return *x.Packed + } + return false +} + +func (x *FieldOptions) GetJstype() FieldOptions_JSType { + if x != nil && x.Jstype != nil { + return *x.Jstype + } + return Default_FieldOptions_Jstype +} + +func (x *FieldOptions) GetLazy() bool { + if x != nil && x.Lazy != nil { + return *x.Lazy + } + return Default_FieldOptions_Lazy +} + +func (x *FieldOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_FieldOptions_Deprecated +} + +func (x *FieldOptions) GetWeak() bool { + if x != nil && x.Weak != nil { + return *x.Weak + } + return Default_FieldOptions_Weak +} + +func (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type OneofOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +func (x *OneofOptions) Reset() { + *x = OneofOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OneofOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OneofOptions) ProtoMessage() {} + +func (x *OneofOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OneofOptions.ProtoReflect.Descriptor instead. +func (*OneofOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{13} +} + +func (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type EnumOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // Set this option to true to allow mapping different tag names to the same + // value. + AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for EnumOptions fields. +const ( + Default_EnumOptions_Deprecated = bool(false) +) + +func (x *EnumOptions) Reset() { + *x = EnumOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumOptions) ProtoMessage() {} + +func (x *EnumOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumOptions.ProtoReflect.Descriptor instead. +func (*EnumOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{14} +} + +func (x *EnumOptions) GetAllowAlias() bool { + if x != nil && x.AllowAlias != nil { + return *x.AllowAlias + } + return false +} + +func (x *EnumOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_EnumOptions_Deprecated +} + +func (x *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type EnumValueOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for EnumValueOptions fields. +const ( + Default_EnumValueOptions_Deprecated = bool(false) +) + +func (x *EnumValueOptions) Reset() { + *x = EnumValueOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumValueOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumValueOptions) ProtoMessage() {} + +func (x *EnumValueOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor instead. +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{15} +} + +func (x *EnumValueOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_EnumValueOptions_Deprecated +} + +func (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type ServiceOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for ServiceOptions fields. +const ( + Default_ServiceOptions_Deprecated = bool(false) +) + +func (x *ServiceOptions) Reset() { + *x = ServiceOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceOptions) ProtoMessage() {} + +func (x *ServiceOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead. +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{16} +} + +func (x *ServiceOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_ServiceOptions_Deprecated +} + +func (x *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +type MethodOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + extensionFields protoimpl.ExtensionFields + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` +} + +// Default values for MethodOptions fields. +const ( + Default_MethodOptions_Deprecated = bool(false) + Default_MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN +) + +func (x *MethodOptions) Reset() { + *x = MethodOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MethodOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MethodOptions) ProtoMessage() {} + +func (x *MethodOptions) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead. +func (*MethodOptions) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17} +} + +func (x *MethodOptions) GetDeprecated() bool { + if x != nil && x.Deprecated != nil { + return *x.Deprecated + } + return Default_MethodOptions_Deprecated +} + +func (x *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { + if x != nil && x.IdempotencyLevel != nil { + return *x.IdempotencyLevel + } + return Default_MethodOptions_IdempotencyLevel +} + +func (x *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { + if x != nil { + return x.UninterpretedOption + } + return nil +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +type UninterpretedOption struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` +} + +func (x *UninterpretedOption) Reset() { + *x = UninterpretedOption{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UninterpretedOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UninterpretedOption) ProtoMessage() {} + +func (x *UninterpretedOption) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UninterpretedOption.ProtoReflect.Descriptor instead. +func (*UninterpretedOption) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{18} +} + +func (x *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { + if x != nil { + return x.Name + } + return nil +} + +func (x *UninterpretedOption) GetIdentifierValue() string { + if x != nil && x.IdentifierValue != nil { + return *x.IdentifierValue + } + return "" +} + +func (x *UninterpretedOption) GetPositiveIntValue() uint64 { + if x != nil && x.PositiveIntValue != nil { + return *x.PositiveIntValue + } + return 0 +} + +func (x *UninterpretedOption) GetNegativeIntValue() int64 { + if x != nil && x.NegativeIntValue != nil { + return *x.NegativeIntValue + } + return 0 +} + +func (x *UninterpretedOption) GetDoubleValue() float64 { + if x != nil && x.DoubleValue != nil { + return *x.DoubleValue + } + return 0 +} + +func (x *UninterpretedOption) GetStringValue() []byte { + if x != nil { + return x.StringValue + } + return nil +} + +func (x *UninterpretedOption) GetAggregateValue() string { + if x != nil && x.AggregateValue != nil { + return *x.AggregateValue + } + return "" +} + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +type SourceCodeInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendant. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` +} + +func (x *SourceCodeInfo) Reset() { + *x = SourceCodeInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SourceCodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceCodeInfo) ProtoMessage() {} + +func (x *SourceCodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceCodeInfo.ProtoReflect.Descriptor instead. +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19} +} + +func (x *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if x != nil { + return x.Location + } + return nil +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` +} + +func (x *GeneratedCodeInfo) Reset() { + *x = GeneratedCodeInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GeneratedCodeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GeneratedCodeInfo) ProtoMessage() {} + +func (x *GeneratedCodeInfo) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GeneratedCodeInfo.ProtoReflect.Descriptor instead. +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20} +} + +func (x *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if x != nil { + return x.Annotation + } + return nil +} + +type DescriptorProto_ExtensionRange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Exclusive. + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` +} + +func (x *DescriptorProto_ExtensionRange) Reset() { + *x = DescriptorProto_ExtensionRange{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DescriptorProto_ExtensionRange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} + +func (x *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DescriptorProto_ExtensionRange.ProtoReflect.Descriptor instead. +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *DescriptorProto_ExtensionRange) GetStart() int32 { + if x != nil && x.Start != nil { + return *x.Start + } + return 0 +} + +func (x *DescriptorProto_ExtensionRange) GetEnd() int32 { + if x != nil && x.End != nil { + return *x.End + } + return 0 +} + +func (x *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { + if x != nil { + return x.Options + } + return nil +} + +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Exclusive. +} + +func (x *DescriptorProto_ReservedRange) Reset() { + *x = DescriptorProto_ReservedRange{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DescriptorProto_ReservedRange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DescriptorProto_ReservedRange) ProtoMessage() {} + +func (x *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DescriptorProto_ReservedRange.ProtoReflect.Descriptor instead. +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2, 1} +} + +func (x *DescriptorProto_ReservedRange) GetStart() int32 { + if x != nil && x.Start != nil { + return *x.Start + } + return 0 +} + +func (x *DescriptorProto_ReservedRange) GetEnd() int32 { + if x != nil && x.End != nil { + return *x.End + } + return 0 +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` // Inclusive. + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` // Inclusive. +} + +func (x *EnumDescriptorProto_EnumReservedRange) Reset() { + *x = EnumDescriptorProto_EnumReservedRange{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EnumDescriptorProto_EnumReservedRange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} + +func (x *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnumDescriptorProto_EnumReservedRange.ProtoReflect.Descriptor instead. +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if x != nil && x.Start != nil { + return *x.Start + } + return 0 +} + +func (x *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if x != nil && x.End != nil { + return *x.End + } + return 0 +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` +} + +func (x *UninterpretedOption_NamePart) Reset() { + *x = UninterpretedOption_NamePart{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UninterpretedOption_NamePart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UninterpretedOption_NamePart) ProtoMessage() {} + +func (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UninterpretedOption_NamePart.ProtoReflect.Descriptor instead. +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{18, 0} +} + +func (x *UninterpretedOption_NamePart) GetNamePart() string { + if x != nil && x.NamePart != nil { + return *x.NamePart + } + return "" +} + +func (x *UninterpretedOption_NamePart) GetIsExtension() bool { + if x != nil && x.IsExtension != nil { + return *x.IsExtension + } + return false +} + +type SourceCodeInfo_Location struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` + TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` + LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` +} + +func (x *SourceCodeInfo_Location) Reset() { + *x = SourceCodeInfo_Location{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SourceCodeInfo_Location) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceCodeInfo_Location) ProtoMessage() {} + +func (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceCodeInfo_Location.ProtoReflect.Descriptor instead. +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0} +} + +func (x *SourceCodeInfo_Location) GetPath() []int32 { + if x != nil { + return x.Path + } + return nil +} + +func (x *SourceCodeInfo_Location) GetSpan() []int32 { + if x != nil { + return x.Span + } + return nil +} + +func (x *SourceCodeInfo_Location) GetLeadingComments() string { + if x != nil && x.LeadingComments != nil { + return *x.LeadingComments + } + return "" +} + +func (x *SourceCodeInfo_Location) GetTrailingComments() string { + if x != nil && x.TrailingComments != nil { + return *x.TrailingComments + } + return "" +} + +func (x *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { + if x != nil { + return x.LeadingDetachedComments + } + return nil +} + +type GeneratedCodeInfo_Annotation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Identifies the filesystem path to the original source .proto. + SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` +} + +func (x *GeneratedCodeInfo_Annotation) Reset() { + *x = GeneratedCodeInfo_Annotation{} + if protoimpl.UnsafeEnabled { + mi := &file_google_protobuf_descriptor_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GeneratedCodeInfo_Annotation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} + +func (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message { + mi := &file_google_protobuf_descriptor_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GeneratedCodeInfo_Annotation.ProtoReflect.Descriptor instead. +func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { + return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0} +} + +func (x *GeneratedCodeInfo_Annotation) GetPath() []int32 { + if x != nil { + return x.Path + } + return nil +} + +func (x *GeneratedCodeInfo_Annotation) GetSourceFile() string { + if x != nil && x.SourceFile != nil { + return *x.SourceFile + } + return "" +} + +func (x *GeneratedCodeInfo_Annotation) GetBegin() int32 { + if x != nil && x.Begin != nil { + return *x.Begin + } + return 0 +} + +func (x *GeneratedCodeInfo_Annotation) GetEnd() int32 { + if x != nil && x.End != nil { + return *x.End + } + return 0 +} + +var File_google_protobuf_descriptor_proto protoreflect.FileDescriptor + +var file_google_protobuf_descriptor_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69, + 0x6c, 0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, + 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20, + 0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65, + 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e, + 0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43, + 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e, + 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, + 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43, + 0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74, + 0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, + 0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, + 0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63, + 0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, + 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, + 0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, + 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, + 0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, + 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65, + 0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, + 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, + 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, + 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c, + 0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41, + 0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36, + 0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, + 0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, + 0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58, + 0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, + 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a, + 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10, + 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, + 0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, + 0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c, + 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12, + 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, + 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50, + 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a, + 0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, + 0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, + 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x91, + 0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, + 0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, + 0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74, + 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c, + 0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61, + 0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61, + 0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68, + 0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08, + 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c, + 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53, + 0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f, + 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, + 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, + 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a, + 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70, + 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12, + 0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, + 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20, + 0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a, + 0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, + 0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a, + 0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79, + 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x72, 0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01, + 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12, + 0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, + 0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26, + 0x10, 0x27, 0x22, 0xd1, 0x02, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, + 0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, + 0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, + 0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, + 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, + 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, + 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, + 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xe2, 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52, + 0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b, + 0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, + 0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c, + 0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, + 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, + 0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10, + 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43, + 0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, + 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, + 0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, + 0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, + 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f, + 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, + 0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61, + 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, + 0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, + 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, + 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, + 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, + 0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, + 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, + 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, + 0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, + 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11, + 0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65, + 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, + 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, + 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69, + 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, + 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, + 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, + 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65, + 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, + 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44, + 0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49, + 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, + 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, + 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, + 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, + 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, + 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, + 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50, + 0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, + 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, + 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a, + 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42, + 0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61, + 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, + 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, + 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, + 0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd1, 0x01, + 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, + 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67, + 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, + 0x64, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, + 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, +} + +var ( + file_google_protobuf_descriptor_proto_rawDescOnce sync.Once + file_google_protobuf_descriptor_proto_rawDescData = file_google_protobuf_descriptor_proto_rawDesc +) + +func file_google_protobuf_descriptor_proto_rawDescGZIP() []byte { + file_google_protobuf_descriptor_proto_rawDescOnce.Do(func() { + file_google_protobuf_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_descriptor_proto_rawDescData) + }) + return file_google_protobuf_descriptor_proto_rawDescData +} + +var file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 27) +var file_google_protobuf_descriptor_proto_goTypes = []interface{}{ + (FieldDescriptorProto_Type)(0), // 0: google.protobuf.FieldDescriptorProto.Type + (FieldDescriptorProto_Label)(0), // 1: google.protobuf.FieldDescriptorProto.Label + (FileOptions_OptimizeMode)(0), // 2: google.protobuf.FileOptions.OptimizeMode + (FieldOptions_CType)(0), // 3: google.protobuf.FieldOptions.CType + (FieldOptions_JSType)(0), // 4: google.protobuf.FieldOptions.JSType + (MethodOptions_IdempotencyLevel)(0), // 5: google.protobuf.MethodOptions.IdempotencyLevel + (*FileDescriptorSet)(nil), // 6: google.protobuf.FileDescriptorSet + (*FileDescriptorProto)(nil), // 7: google.protobuf.FileDescriptorProto + (*DescriptorProto)(nil), // 8: google.protobuf.DescriptorProto + (*ExtensionRangeOptions)(nil), // 9: google.protobuf.ExtensionRangeOptions + (*FieldDescriptorProto)(nil), // 10: google.protobuf.FieldDescriptorProto + (*OneofDescriptorProto)(nil), // 11: google.protobuf.OneofDescriptorProto + (*EnumDescriptorProto)(nil), // 12: google.protobuf.EnumDescriptorProto + (*EnumValueDescriptorProto)(nil), // 13: google.protobuf.EnumValueDescriptorProto + (*ServiceDescriptorProto)(nil), // 14: google.protobuf.ServiceDescriptorProto + (*MethodDescriptorProto)(nil), // 15: google.protobuf.MethodDescriptorProto + (*FileOptions)(nil), // 16: google.protobuf.FileOptions + (*MessageOptions)(nil), // 17: google.protobuf.MessageOptions + (*FieldOptions)(nil), // 18: google.protobuf.FieldOptions + (*OneofOptions)(nil), // 19: google.protobuf.OneofOptions + (*EnumOptions)(nil), // 20: google.protobuf.EnumOptions + (*EnumValueOptions)(nil), // 21: google.protobuf.EnumValueOptions + (*ServiceOptions)(nil), // 22: google.protobuf.ServiceOptions + (*MethodOptions)(nil), // 23: google.protobuf.MethodOptions + (*UninterpretedOption)(nil), // 24: google.protobuf.UninterpretedOption + (*SourceCodeInfo)(nil), // 25: google.protobuf.SourceCodeInfo + (*GeneratedCodeInfo)(nil), // 26: google.protobuf.GeneratedCodeInfo + (*DescriptorProto_ExtensionRange)(nil), // 27: google.protobuf.DescriptorProto.ExtensionRange + (*DescriptorProto_ReservedRange)(nil), // 28: google.protobuf.DescriptorProto.ReservedRange + (*EnumDescriptorProto_EnumReservedRange)(nil), // 29: google.protobuf.EnumDescriptorProto.EnumReservedRange + (*UninterpretedOption_NamePart)(nil), // 30: google.protobuf.UninterpretedOption.NamePart + (*SourceCodeInfo_Location)(nil), // 31: google.protobuf.SourceCodeInfo.Location + (*GeneratedCodeInfo_Annotation)(nil), // 32: google.protobuf.GeneratedCodeInfo.Annotation +} +var file_google_protobuf_descriptor_proto_depIdxs = []int32{ + 7, // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto + 8, // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto + 12, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 14, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto + 10, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 16, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions + 25, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo + 10, // 7: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto + 10, // 8: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto + 8, // 9: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto + 12, // 10: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto + 27, // 11: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange + 11, // 12: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto + 17, // 13: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions + 28, // 14: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange + 24, // 15: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 1, // 16: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label + 0, // 17: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type + 18, // 18: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions + 19, // 19: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions + 13, // 20: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto + 20, // 21: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions + 29, // 22: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange + 21, // 23: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions + 15, // 24: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto + 22, // 25: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions + 23, // 26: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions + 2, // 27: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode + 24, // 28: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // 29: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 3, // 30: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType + 4, // 31: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType + 24, // 32: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // 33: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // 34: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // 35: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 24, // 36: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 5, // 37: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel + 24, // 38: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption + 30, // 39: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart + 31, // 40: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location + 32, // 41: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation + 9, // 42: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions + 43, // [43:43] is the sub-list for method output_type + 43, // [43:43] is the sub-list for method input_type + 43, // [43:43] is the sub-list for extension type_name + 43, // [43:43] is the sub-list for extension extendee + 0, // [0:43] is the sub-list for field type_name +} + +func init() { file_google_protobuf_descriptor_proto_init() } +func file_google_protobuf_descriptor_proto_init() { + if File_google_protobuf_descriptor_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_google_protobuf_descriptor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileDescriptorSet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExtensionRangeOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OneofDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumValueDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MethodDescriptorProto); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FieldOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OneofOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumValueOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MethodOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + case 3: + return &v.extensionFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UninterpretedOption); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SourceCodeInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeneratedCodeInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DescriptorProto_ExtensionRange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DescriptorProto_ReservedRange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EnumDescriptorProto_EnumReservedRange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UninterpretedOption_NamePart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SourceCodeInfo_Location); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GeneratedCodeInfo_Annotation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_google_protobuf_descriptor_proto_rawDesc, + NumEnums: 6, + NumMessages: 27, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_google_protobuf_descriptor_proto_goTypes, + DependencyIndexes: file_google_protobuf_descriptor_proto_depIdxs, + EnumInfos: file_google_protobuf_descriptor_proto_enumTypes, + MessageInfos: file_google_protobuf_descriptor_proto_msgTypes, + }.Build() + File_google_protobuf_descriptor_proto = out.File + file_google_protobuf_descriptor_proto_rawDesc = nil + file_google_protobuf_descriptor_proto_goTypes = nil + file_google_protobuf_descriptor_proto_depIdxs = nil +} diff --git a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go index 82a473e2..8c10797b 100644 --- a/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go @@ -166,10 +166,13 @@ import ( // Example 4: Pack and unpack a message in Go // // foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } // ... // foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// if err := any.UnmarshalTo(foo); err != nil { // ... // } // @@ -420,14 +423,15 @@ var file_google_protobuf_any_proto_rawDesc = []byte{ 0x41, 0x6e, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x6f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x61, 0x6c, 0x75, 0x65, 0x42, 0x76, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x08, 0x41, 0x6e, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x61, 0x6e, 0x79, 0xa2, 0x02, - 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, + 0x61, 0x6e, 0x79, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, + 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go index f7a11099..a583ca2f 100644 --- a/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go @@ -303,16 +303,16 @@ var file_google_protobuf_duration_proto_rawDesc = []byte{ 0x66, 0x22, 0x3a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x7c, 0x0a, - 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, - 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x83, 0x01, + 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0d, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, + 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, + 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go index c25e4bd7..c9ae9213 100644 --- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go @@ -134,7 +134,16 @@ import ( // .setNanos((int) ((millis % 1000) * 1000000)).build(); // // -// Example 5: Compute Timestamp from current time in Python. +// Example 5: Compute Timestamp from Java `Instant.now()`. +// +// Instant now = Instant.now(); +// +// Timestamp timestamp = +// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +// .setNanos(now.getNano()).build(); +// +// +// Example 6: Compute Timestamp from current time in Python. // // timestamp = Timestamp() // timestamp.GetCurrentTime() @@ -306,15 +315,15 @@ var file_google_protobuf_timestamp_proto_rawDesc = []byte{ 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, - 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, - 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x85, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, + 0x6e, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x70, 0x62, 0xf8, 0x01, 0x01, + 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, + 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/vendor/modernc.org/cc/v3/Makefile b/vendor/modernc.org/cc/v3/Makefile index e63a2811..12f21d04 100644 --- a/vendor/modernc.org/cc/v3/Makefile +++ b/vendor/modernc.org/cc/v3/Makefile @@ -95,8 +95,8 @@ edit: editor: lexer.go gofmt -l -s -w *.go - GO111MODULE=off go test -o /dev/null -c - GO111MODULE=off go install 2>&1 | tee log + go test -o /dev/null -c + go install 2>&1 | tee log ast.go lexer.go stringer.go: lexer.l parser.yy enum.go go generate diff --git a/vendor/modernc.org/cc/v3/abi.go b/vendor/modernc.org/cc/v3/abi.go index 537c8278..e0325584 100644 --- a/vendor/modernc.org/cc/v3/abi.go +++ b/vendor/modernc.org/cc/v3/abi.go @@ -50,10 +50,9 @@ func NewABI(os, arch string) (ABI, error) { return ABI{}, fmt.Errorf("unsupported os/arch pair: %s-%s", os, arch) } abi := ABI{ - ByteOrder: order, - Types: make(map[Kind]ABIType, len(types)), - //TODO: depends on the OS? - SignedChar: true, + ByteOrder: order, + Types: make(map[Kind]ABIType, len(types)), + SignedChar: abiSignedChar[[2]string{os, arch}], os: os, arch: arch, } @@ -276,10 +275,10 @@ func (a *ABI) layout(ctx *context, n Node, t *structType) *structType { off := f.offset m[off] = append(m[off], f) } - for _, a := range m { + for _, s := range m { var first *field var w byte - for _, f := range a { + for _, f := range s { if first == nil { first = f } @@ -291,11 +290,15 @@ func (a *ABI) layout(ctx *context, n Node, t *structType) *structType { } } w = normalizeBitFieldWidth(w) - for _, f := range a { + for _, f := range s { if f.isBitField { f.blockStart = first f.blockWidth = w } + if a.ByteOrder == binary.BigEndian { + f.bitFieldOffset = w - f.bitFieldWidth - f.bitFieldOffset + f.bitFieldMask = (uint64(1)< 0 { + fns = fns[x+1:] + } + } + r := fmt.Sprintf("%s:%d:%s: TRC %s", fn, fl, fns, s) fmt.Fprintf(os.Stdout, "%s\n", r) os.Stdout.Sync() return r diff --git a/vendor/modernc.org/cc/v3/check.go b/vendor/modernc.org/cc/v3/check.go index c97ddf60..6e94256a 100644 --- a/vendor/modernc.org/cc/v3/check.go +++ b/vendor/modernc.org/cc/v3/check.go @@ -283,6 +283,11 @@ func (n *InitializerList) setConstZero() { // [0], 6.7.8 Initialization func (n *Initializer) check(ctx *context, list *[]*Initializer, t Type, sc StorageClass, fld Field, off uintptr, il *InitializerList, designatorList *DesignatorList) *InitializerList { + // trc("Initializer.check: %v: t %v, off %v, designatorList != nil %v", n.Position(), t, off, designatorList != nil) + // if fld != nil { + // trc("\tfld %q", fld.Name()) + // } + // 3 - The type of the entity to be initialized shall be an array of // unknown size or an object type that is not a variable length array // type. @@ -464,9 +469,13 @@ func (n *InitializerList) checkArray(ctx *context, list *[]*Initializer, t Type, esz := elem.Size() length := t.Len() var i, maxI uintptr + nestedDesignator := designatorList != nil + retOnDesignator := false loop: for n != nil { switch { + case retOnDesignator && n.Designation != nil: + return n case designatorList == nil && n.Designation != nil: designatorList = n.Designation.DesignatorList fallthrough @@ -490,14 +499,12 @@ loop: panic(todo("")) } - designatorList = designatorList.DesignatorList - next := n.Initializer.check(ctx, list, elem, sc, nil, off+i*esz, n, designatorList) - if designatorList != nil { - panic(todo("", n.Position(), d.Position())) + n = n.Initializer.check(ctx, list, elem, sc, nil, off+i*esz, n, designatorList.DesignatorList) + designatorList = nil + if nestedDesignator { + retOnDesignator = true } - i++ - n = next default: if !t.IsIncomplete() && i >= length { break loop @@ -506,9 +513,8 @@ loop: if i > maxI { maxI = i } - next := n.Initializer.check(ctx, list, elem, sc, nil, off+i*esz, n, nil) + n = n.Initializer.check(ctx, list, elem, sc, nil, off+i*esz, n, nil) i++ - n = next } } if t.IsIncomplete() { @@ -518,13 +524,19 @@ loop: } func (n *InitializerList) checkStruct(ctx *context, list *[]*Initializer, t Type, sc StorageClass, off uintptr, designatorList *DesignatorList) *InitializerList { + // trc("InitializerList.checkStruct: %v: t %v, off %v, dl %v", n.Position(), t, off, designatorList != nil) t = t.underlyingType() // trc("==== struct %v: %v, off %v", n.Position(), t, off) //TODO- nf := t.NumField() i := []int{0} var f Field + nestedDesignator := designatorList != nil + retOnDesignator := false for n != nil { + // trc("---- %v: t %v, dl %v", n.Position(), t, designatorList != nil) switch { + case retOnDesignator && n.Designation != nil: + return n case designatorList == nil && n.Designation != nil: designatorList = n.Designation.DesignatorList fallthrough @@ -544,22 +556,32 @@ func (n *InitializerList) checkStruct(ctx *context, list *[]*Initializer, t Type f, xa, ok := t.FieldByName2(nm) if !ok { - panic(todo("%v: %q", d.Position(), nm)) + panic(todo("%v: t %v %q", d.Position(), t, nm)) } + t0 := t switch { case len(xa) != 1: - panic(todo("", d.Position())) - default: - designatorList = designatorList.DesignatorList - next := n.Initializer.check(ctx, list, f.Type(), sc, f, off+f.Offset(), n, designatorList) - if designatorList != nil && designatorList.DesignatorList != nil { - panic(todo("", d.Position())) + var f2 Field + var off2 uintptr + for len(xa) != 1 { + f2 = t.FieldByIndex(xa[:1]) + off2 += f2.Offset() + t = f2.Type() + xa = xa[1:] } - - i[0] = xa[0] + 1 - n = next + n = n.Initializer.check(ctx, list, t, sc, f, off+off2, n, designatorList) + if t.Kind() == Union { + t = t0 + } + default: + n = n.Initializer.check(ctx, list, f.Type(), sc, f, off+f.Offset(), n, designatorList.DesignatorList) } + designatorList = nil + if nestedDesignator { + retOnDesignator = true + } + i[0] = xa[0] + 1 default: // [0], 6.7.8 Initialization // @@ -575,9 +597,8 @@ func (n *InitializerList) checkStruct(ctx *context, list *[]*Initializer, t Type f = t.FieldByIndex(i) if f.Name() != 0 || !f.Type().IsBitFieldType() { - next := n.Initializer.check(ctx, list, f.Type(), sc, f, off+f.Offset(), n, nil) + n = n.Initializer.check(ctx, list, f.Type(), sc, f, off+f.Offset(), n, nil) i[0]++ - n = next break } } @@ -1437,13 +1458,13 @@ func (n *PostfixExpression) addrOf(ctx *context) Operand { case PostfixExpressionCall: // PostfixExpression '(' ArgumentExpressionList ')' panic(n.Position().String()) case PostfixExpressionSelect: // PostfixExpression '.' IDENTIFIER - op := n.PostfixExpression.check(ctx, false) + op := n.PostfixExpression.addrOf(ctx) n.IsSideEffectsFree = n.PostfixExpression.IsSideEffectsFree if d := n.PostfixExpression.Declarator(); d != nil { setAddressTaken(n, d, "PostfixExpression '.' IDENTIFIER") d.Read += ctx.readDelta } - st := op.Type() + st := op.Type().Elem() if k := st.Kind(); k == Invalid || k != Struct && k != Union { //TODO report error break diff --git a/vendor/modernc.org/cc/v3/cpp.go b/vendor/modernc.org/cc/v3/cpp.go index df538af9..5a917018 100644 --- a/vendor/modernc.org/cc/v3/cpp.go +++ b/vendor/modernc.org/cc/v3/cpp.go @@ -653,14 +653,21 @@ start: } arg := ap[0][0].value.String() - arg = arg[1 : len(arg)-1] // `""` -> ``, `""y""` -> `"y"` + switch { + case strings.HasPrefix(arg, `"\"`): // `"\"stdio.h\""` + arg = arg[2:len(arg)-3] + `"` // -> `"stdio.h"` + case strings.HasPrefix(arg, `"<`): // `""` + arg = arg[1 : len(arg)-1] // -> `` + default: + arg = "" + } var tok3 token3 tok3.char = PPNUMBER - switch _, err := c.hasInclude(&tok, arg); { - case err != nil: - tok3.value = idZero - default: - tok3.value = idOne + tok3.value = idZero + if arg != "" { + if _, err := c.hasInclude(&tok, arg); err == nil { + tok3.value = idOne + } } tok := cppToken{token4{token3: tok3, file: c.file}, nil} ts.ungets([]cppToken{tok}) @@ -702,7 +709,11 @@ start: goto start } -func (c *cpp) hasInclude(n Node, nm string) (string, error) { +func (c *cpp) hasInclude(n Node, nm string) (rs string, err error) { + // nm0 := nm + // defer func() { //TODO- + // trc("nm0 %q nm %q rs %q err %v", nm0, nm, rs, err) + // }() var ( b byte paths []string @@ -2171,6 +2182,8 @@ func decodeEscapeSequence(ctx *context, tok cppToken, s string) (rune, int) { return 7, 2 case 'b': return 8, 2 + case 'e': + return 0x1b, 2 case 'f': return 12, 2 case 'n': @@ -2433,21 +2446,7 @@ func (n *ppIncludeDirective) translationPhase4(c *cpp) { v = dir } - var p string - switch { - case strings.HasPrefix(nm, "./"): - wd := c.ctx.cfg.WorkingDir - if wd == "" { - var err error - if wd, err = os.Getwd(); err != nil { - c.err(toks[0], "cannot determine working dir: %v", err) - return - } - } - p = filepath.Join(wd, nm) - default: - p = filepath.Join(v, nm) - } + p := filepath.Join(v, nm) fi, err := c.ctx.statFile(p, sys) if err != nil || fi.IsDir() { continue @@ -2732,8 +2731,9 @@ func (n *ppTextLine) getToks() []token3 { return n.toks } func (n *ppTextLine) translationPhase4(c *cpp) { c.send(n.toks) } type ppLineDirective struct { - toks []token3 - args []token3 + toks []token3 + args []token3 + nextPos int } func (n *ppLineDirective) getToks() []token3 { return n.toks } @@ -2756,7 +2756,7 @@ func (n *ppLineDirective) translationPhase4(c *cpp) { toks = toks[1:] } if len(toks) == 1 { - c.file.AddLineInfo(int(n.toks[len(n.toks)-1].pos), c.file.Name(), int(ln)) + c.file.AddLineInfo(int(n.nextPos)-1, c.file.Name(), int(ln)) return } @@ -2765,7 +2765,7 @@ func (n *ppLineDirective) translationPhase4(c *cpp) { toks = toks[1:] } if len(toks) == 0 { - c.file.AddLineInfo(int(n.toks[len(n.toks)-1].pos), c.file.Name(), int(ln)) + c.file.AddLineInfo(int(n.nextPos)-1, c.file.Name(), int(ln)) return } @@ -2773,7 +2773,7 @@ func (n *ppLineDirective) translationPhase4(c *cpp) { case STRINGLITERAL: s := t.String() s = s[1 : len(s)-1] - c.file.AddLineInfo(int(n.toks[len(n.toks)-1].pos), s, int(ln)) + c.file.AddLineInfo(int(n.nextPos)-1, s, int(ln)) c.fileMacro.repl[0].value = t.value for len(toks) != 0 && toks[0].char == ' ' { toks = toks[1:] diff --git a/vendor/modernc.org/cc/v3/lexer.go b/vendor/modernc.org/cc/v3/lexer.go index 2819ac37..d1366135 100644 --- a/vendor/modernc.org/cc/v3/lexer.go +++ b/vendor/modernc.org/cc/v3/lexer.go @@ -360,7 +360,7 @@ yystate20: switch { default: goto yyabort - case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': + case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': goto yystate18 case c == 'U': goto yystate21 @@ -662,7 +662,7 @@ yystate53: switch { default: goto yyabort - case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': + case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': goto yystate51 case c == 'U': goto yystate54 @@ -1137,7 +1137,7 @@ yystate105: switch { default: goto yyabort - case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': + case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': goto yystate103 case c == 'U': goto yystate106 @@ -1254,7 +1254,7 @@ yystate117: switch { default: goto yyabort - case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': + case c == '"' || c == '\'' || c >= '0' && c <= '7' || c == '?' || c == '\\' || c == 'a' || c == 'b' || c == 'e' || c == 'f' || c == 'n' || c == 'r' || c == 't' || c == 'v': goto yystate115 case c == 'U': goto yystate118 diff --git a/vendor/modernc.org/cc/v3/lexer.l b/vendor/modernc.org/cc/v3/lexer.l index f3da9878..4a2bf53a 100644 --- a/vendor/modernc.org/cc/v3/lexer.l +++ b/vendor/modernc.org/cc/v3/lexer.l @@ -34,7 +34,7 @@ pp-number ({digit}|\.{digit})({digit}|{identifier-nondigit}|[eEpP]{sign}|\.)* s-char [^\x22\n\x80\\]|{escape-sequence} s-char-sequence {s-char}+ sign [-+] -simple-sequence \\['\x22?\\abfnrtv] +simple-sequence \\['\x22?\\abefnrtv] string-literal \x22{s-char-sequence}?\x22 universal-character-name \\u{hex-quad}|\\U{hex-quad}{hex-quad} white-space [ \t\f\v] diff --git a/vendor/modernc.org/cc/v3/operand.go b/vendor/modernc.org/cc/v3/operand.go index 62277e70..24c46616 100644 --- a/vendor/modernc.org/cc/v3/operand.go +++ b/vendor/modernc.org/cc/v3/operand.go @@ -275,7 +275,7 @@ func (v Float32Value) ge(b Value) Value { return boolValue(v >= b.(Float32Value func (v Float32Value) gt(b Value) Value { return boolValue(v > b.(Float32Value)) } func (v Float32Value) IsConst() bool { return true } func (v Float32Value) IsNonZero() bool { return v != 0 } -func (v Float32Value) IsZero() bool { return v == 0 } +func (v Float32Value) IsZero() bool { return !math.Signbit(float64(v)) && v == 0 } func (v Float32Value) le(b Value) Value { return boolValue(v <= b.(Float32Value)) } func (v Float32Value) lsh(b Value) Value { panic(todo("")) } func (v Float32Value) lt(b Value) Value { return boolValue(v < b.(Float32Value)) } @@ -299,7 +299,7 @@ func (v Float64Value) ge(b Value) Value { return boolValue(v >= b.(Float64Value func (v Float64Value) gt(b Value) Value { return boolValue(v > b.(Float64Value)) } func (v Float64Value) IsConst() bool { return true } func (v Float64Value) IsNonZero() bool { return v != 0 } -func (v Float64Value) IsZero() bool { return v == 0 } +func (v Float64Value) IsZero() bool { return !math.Signbit(float64(v)) && v == 0 } func (v Float64Value) le(b Value) Value { return boolValue(v <= b.(Float64Value)) } func (v Float64Value) lsh(b Value) Value { panic(todo("")) } func (v Float64Value) lt(b Value) Value { return boolValue(v < b.(Float64Value)) } @@ -328,7 +328,7 @@ func (v *Float128Value) ge(b Value) Value { panic(todo("")) } func (v *Float128Value) gt(b Value) Value { return boolValue(v.cmp(b, -1, 0)) } func (v *Float128Value) IsNonZero() bool { panic(todo("")) } func (v *Float128Value) IsConst() bool { return true } -func (v *Float128Value) IsZero() bool { return v.cmp(float128Zero, 0) } +func (v *Float128Value) IsZero() bool { return !v.NaN && !v.N.Signbit() && v.cmp(float128Zero, 0) } func (v *Float128Value) le(b Value) Value { panic(todo("")) } func (v *Float128Value) lsh(b Value) Value { panic(todo("")) } func (v *Float128Value) lt(b Value) Value { panic(todo("")) } diff --git a/vendor/modernc.org/cc/v3/scanner.go b/vendor/modernc.org/cc/v3/scanner.go index 2a062c57..6217d7db 100644 --- a/vendor/modernc.org/cc/v3/scanner.go +++ b/vendor/modernc.org/cc/v3/scanner.go @@ -744,7 +744,8 @@ func (s *scanner) parseLine(toks []token3) *ppLineDirective { return &ppLineDirective{toks: toks} default: toks := s.scanLineToEOL(toks) - r := &ppLineDirective{toks: toks} + last := toks[len(toks)-1] + r := &ppLineDirective{toks: toks, nextPos: int(last.pos) + len(last.src.String())} toks = toks[:len(toks)-1] // sans new-line toks = ltrim3(toks) toks = toks[1:] // Skip '#' @@ -1177,10 +1178,6 @@ func (c *ppCache) getFile(ctx *context, name string, sys bool, doNotCache bool) size := int(fi.Size()) if !filepath.IsAbs(name) { // Never cache relative paths - if isTesting { - panic(internalError()) - } - f, err := ctx.openFile(name, sys) if err != nil { return nil, err diff --git a/vendor/modernc.org/cc/v3/type.go b/vendor/modernc.org/cc/v3/type.go index 1c9e91af..c6d6c119 100644 --- a/vendor/modernc.org/cc/v3/type.go +++ b/vendor/modernc.org/cc/v3/type.go @@ -3097,7 +3097,7 @@ func (t *vectorType) underlyingType() Type { return t } func isCharType(t Type) bool { switch t.Kind() { - case Char, SChar, UChar: + case Char, SChar, UChar, Int8, UInt8: return true } @@ -3164,10 +3164,6 @@ func NewStructLayout(t Type) *StructLayout { //trc("%q off %d pos %d %v %v %v", f.Name(), off, pos, ft, ft.Kind(), ft.IsIncomplete()) switch { case ft.IsBitFieldType(): - if f.BitFieldOffset() != 0 { - break - } - if p := int(off - pos); p != 0 { if pads == nil { pads = map[Field]int{} diff --git a/vendor/modernc.org/ccgo/v3/lib/ccgo.go b/vendor/modernc.org/ccgo/v3/lib/ccgo.go index eb5d7380..9ec5f548 100644 --- a/vendor/modernc.org/ccgo/v3/lib/ccgo.go +++ b/vendor/modernc.org/ccgo/v3/lib/ccgo.go @@ -32,17 +32,20 @@ import ( "github.com/kballard/go-shellquote" "golang.org/x/tools/go/packages" "modernc.org/cc/v3" + "modernc.org/libc" "modernc.org/opt" ) const ( - Version = "3.9.2-20210323171250" + Version = "3.12.6-20210922111124" experimentsEnvVar = "CCGO_EXPERIMENT" maxSourceLine = 1 << 20 ) var ( + _ = libc.Xstdin + coverExperiment bool ) @@ -201,9 +204,11 @@ char *__builtin___strncpy_chk(char *dest, char *src, size_t n, size_t os); char *__builtin_strchr(const char *s, int c); char *__builtin_strcpy(char *dest, const char *src); double __builtin_copysign ( double x, double y ); +double __builtin_copysignl (long double x, long double y ); double __builtin_fabs(double x); double __builtin_huge_val (void); double __builtin_inf (void); +double __builtin_nan (const char *str); float __builtin_copysignf ( float x, float y ); float __builtin_huge_valf (void); float __builtin_inff (void); @@ -226,6 +231,7 @@ int __builtin_sprintf(char *str, const char *format, ...); int __builtin_strcmp(const char *s1, const char *s2); int __builtin_sub_overflow(); long __builtin_expect (long exp, long c); +long double __builtin_nanl (const char *str); long long __builtin_llabs(long long j); size_t __builtin_object_size (void * ptr, int type); size_t __builtin_strlen(const char *s); @@ -243,6 +249,7 @@ void __builtin_free(void *ptr); void __builtin_prefetch (const void *addr, ...); void __builtin_trap (void); void __builtin_unreachable (void); +void __ccgo_dmesg(char*, ...); void __ccgo_va_end(__builtin_va_list ap); void __ccgo_va_start(__builtin_va_list ap); @@ -370,6 +377,7 @@ type Task struct { exportStructsValid bool // -export-structs present exportTypedefsValid bool // -export-typedefs present fullPathComments bool // -full-path-comments + funcSig bool // -func-sig header bool // -header isScripted bool mingw bool @@ -627,12 +635,13 @@ func (t *Task) Main() (err error) { opts.Opt("cover-instrumentation-c", func(opt string) error { t.coverC = true; return nil }) opts.Opt("err-trace", func(opt string) error { t.errTrace = true; return nil }) opts.Opt("full-path-comments", func(opt string) error { t.fullPathComments = true; return nil }) + opts.Opt("func-sig", func(opt string) error { t.funcSig = true; return nil }) opts.Opt("header", func(opt string) error { t.header = true; return nil }) opts.Opt("nocapi", func(opt string) error { t.noCapi = true; return nil }) opts.Opt("nostdinc", func(opt string) error { t.nostdinc = true; return nil }) opts.Opt("panic-stubs", func(opt string) error { t.panicStubs = true; return nil }) - opts.Opt("trace-translation-units", func(opt string) error { t.traceTranslationUnits = true; return nil }) opts.Opt("trace-pinning", func(opt string) error { t.tracePinning = true; return nil }) + opts.Opt("trace-translation-units", func(opt string) error { t.traceTranslationUnits = true; return nil }) opts.Opt("unexported-by-default", func(opt string) error { t.defaultUnExport = true; return nil }) opts.Opt("verify-structs", func(opt string) error { t.verifyStructs = true; return nil }) opts.Opt("version", func(opt string) error { t.version = true; return nil }) @@ -719,6 +728,20 @@ func (t *Task) Main() (err error) { } if t.version { + gobin, err := exec.LookPath("go") + var b []byte + if err == nil { + var bin string + bin, err = exec.LookPath(os.Args[0]) + if err == nil { + b, err = exec.Command(gobin, "version", "-m", bin).CombinedOutput() + } + } + if err == nil { + fmt.Fprintf(t.stdout, "%s", b) + return nil + } + fmt.Fprintf(t.stdout, "%s\n", Version) return nil } @@ -745,6 +768,7 @@ func (t *Task) Main() (err error) { t.imported[len(t.imported)-1].used = true // crt is always imported } abi, err := cc.NewABI(t.goos, t.goarch) + abi.Types[cc.LongDouble] = abi.Types[cc.Double] if err != nil { return err } @@ -1210,8 +1234,8 @@ func (t *Task) createCompileDB(command []string) (rerr error) { var cmd *exec.Cmd var parser func(s string) ([]string, error) out: - switch { - case t.goos == "darwin": + switch t.goos { + case "darwin", "freebsd", "netbsd": if command[0] != "make" { return fmt.Errorf("usupported build command: %s", command[0]) } @@ -1224,7 +1248,7 @@ out: command = append([]string{sh, "-c"}, join(" ", command[0], "SHELL='sh -x'", command[1:])) cmd = exec.Command(command[0], command[1:]...) parser = makeXParser - case t.goos == "windows": + case "windows": if command[0] != "make" { return fmt.Errorf("usupported build command: %s", command[0]) } @@ -1397,6 +1421,7 @@ func (it *cdbItem) ccgoArgs(cc string) (r []string, err error) { set.Opt("pedantic", func(opt string) error { return nil }) set.Opt("pipe", func(opt string) error { return nil }) set.Opt("pthread", func(opt string) error { return nil }) + set.Opt("s", func(opt string) error { return nil }) if err := set.Parse(it.Arguments[1:], func(arg string) error { switch { case strings.HasSuffix(arg, ".c"): @@ -1564,6 +1589,7 @@ func (w *cdbMakeWriter) Write(b []byte) (int, error) { w.fail(err) continue } + if len(args) == 0 { continue } @@ -1575,15 +1601,15 @@ func (w *cdbMakeWriter) Write(b []byte) (int, error) { err = nil switch args[0] { case w.cc: - fmt.Println(args) + fmt.Printf("CCGO CC: %q\n", args) err = w.handleGCC(args) case w.ar: if isCreateArchive(args[1]) { - fmt.Println(args) + fmt.Printf("CCGO AR: %q\n", args) err = w.handleAR(args) } case "libtool": - fmt.Println(args) + fmt.Printf("CCGO LIBTOOL: %q\n", args) err = w.handleLibtool(args) } if err != nil { diff --git a/vendor/modernc.org/ccgo/v3/lib/dmesg.go b/vendor/modernc.org/ccgo/v3/lib/dmesg.go index 6a0eb1d6..c7da87ee 100644 --- a/vendor/modernc.org/ccgo/v3/lib/dmesg.go +++ b/vendor/modernc.org/ccgo/v3/lib/dmesg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build ccgo.dmesg // +build ccgo.dmesg package ccgo // import "modernc.org/ccgo/v3/lib" diff --git a/vendor/modernc.org/ccgo/v3/lib/go.go b/vendor/modernc.org/ccgo/v3/lib/go.go index cfd56f09..513100ee 100644 --- a/vendor/modernc.org/ccgo/v3/lib/go.go +++ b/vendor/modernc.org/ccgo/v3/lib/go.go @@ -6,7 +6,6 @@ package ccgo // import "modernc.org/ccgo/v3/lib" import ( "bytes" - "encoding/binary" "fmt" "go/scanner" "go/token" @@ -700,9 +699,9 @@ func (f *function) staticAllocsAndPinned(n *cc.CompoundStatement) { } } if need != 0 { - if f.project.task.mingw { - need += 8 // On windows the va list is prefixed with its length - } + //TODO- if f.project.task.mingw { + //TODO- need += 8 // On windows the va list is prefixed with its length + //TODO- } va := roundup(f.off, 8) f.vaLists[x] = va f.off = va + need @@ -1221,6 +1220,7 @@ type project struct { structs map[cc.StringID]*taggedStruct // key: C tag symtab map[string]interface{} // *tld or *imported task *Task + tldScope scope tlds map[*cc.Declarator]*tld ts bytes.Buffer // Text segment tsName string @@ -1289,6 +1289,7 @@ func newProject(t *Task) (*project, error) { wanted: map[*cc.Declarator]struct{}{}, wcharSize: t.asts[0].WideCharType.Size(), } + p.tldScope = p.scope p.scope.take(idCAPI) for _, v := range t.imported { var err error @@ -4255,6 +4256,18 @@ func (p *project) tld(f *function, n *cc.InitDeclarator, sep string, staticLocal } if _, ok := p.wanted[d]; !ok && !staticLocal { + isFn := d.Type().Kind() == cc.Function + if isFn && p.task.header && p.task.funcSig { + if nm := d.Name().String(); !strings.HasPrefix(nm, "__") { + p.w("\n\n") + t := p.tlds[d] + if t == nil { + t = &tld{} + t.name = p.tldScope.take(d.Name()) + } + p.functionSignature2(nil, d.Type(), t.name) + } + } return } @@ -4303,7 +4316,7 @@ func (p *project) tld(f *function, n *cc.InitDeclarator, sep string, staticLocal func (p *project) functionDefinition(n *cc.FunctionDefinition) { // DeclarationSpecifiers Declarator DeclarationList CompoundStatement - if p.task.header { + if p.task.header && !p.task.funcSig { return } @@ -4362,6 +4375,10 @@ func (p *project) functionDefinition(n *cc.FunctionDefinition) { p.pass1 = false p.w("\n\n") p.functionDefinitionSignature(f, tld) + if p.task.header && p.task.funcSig { + return + } + p.w(" ") comment := fmt.Sprintf("/* %v: */", p.pos(d)) if p.task.panicStubs { @@ -5167,30 +5184,11 @@ func (p *project) assignmentExpressionValueAssignBitfield(f *function, n *cc.Ass lt := lhs.Operand.Type() bf := lt.BitField() defer p.w("%s", p.convertType(n, lt, t, flags)) - switch { - case bf.Type().IsSignedType(): - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.todo(n, t) - break - } - - p.w("%sAssignBitFieldPtr%d%s(", p.task.crt, bf.BitFieldBlockWidth(), p.bfHelperType(lt)) - p.unaryExpression(f, lhs, lt, exprAddrOf, flags) - p.w(", ") - p.assignmentExpression(f, n.AssignmentExpression, lt, exprValue, flags|fOutermost) - p.w(", %d, %d, %#x)", bf.BitFieldWidth(), bf.BitFieldOffset(), bf.Mask()) - default: - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.todo(n, t) - break - } - - p.w("%sAssignBitFieldPtr%d%s(", p.task.crt, bf.BitFieldBlockWidth(), p.bfHelperType(lt)) - p.unaryExpression(f, lhs, lt, exprAddrOf, flags) - p.w(", ") - p.assignmentExpression(f, n.AssignmentExpression, lt, exprValue, flags|fOutermost) - p.w(", %d, %d, %#x)", bf.BitFieldWidth(), bf.BitFieldOffset(), bf.Mask()) - } + p.w("%sAssignBitFieldPtr%d%s(", p.task.crt, bf.BitFieldBlockWidth(), p.bfHelperType(lt)) + p.unaryExpression(f, lhs, lt, exprAddrOf, flags) + p.w(", ") + p.assignmentExpression(f, n.AssignmentExpression, lt, exprValue, flags|fOutermost) + p.w(", %d, %d, %#x)", bf.BitFieldWidth(), bf.BitFieldOffset(), bf.Mask()) } func (p *project) assignmentExpressionValueAssignNormal(f *function, n *cc.AssignmentExpression, t cc.Type, mode exprMode, flags flags) { @@ -5260,11 +5258,6 @@ func (p *project) assignmentExpressionVoid(f *function, n *cc.AssignmentExpressi p.assignmentExpression(f, n.AssignmentExpression, lt, mode, flags|fOutermost) } case opBitfield: - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.todo(n, t) - break - } - bf := lt.BitField() p.w("%sSetBitFieldPtr%d%s(", p.task.crt, bf.BitFieldBlockWidth(), p.bfHelperType(lt)) p.unaryExpression(f, lhs, lt, exprAddrOf, flags) @@ -7111,16 +7104,11 @@ func (p *project) binaryShiftExpressionBool(f *function, n *cc.ShiftExpression, defer p.w("%s", p.artithmeticBinaryExpression(n, n.Operand, n.Operand.Type(), &mode, flags)) switch { case n.ShiftExpression.Operand.Type().IsBitFieldType(): - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.todo(n, t) - return - } - p.w("(") p.shiftExpression(f, n.ShiftExpression, n.Operand.Type(), exprValue, flags) p.w(" %s%s", oper, tidyComment(" ", &n.Token)) p.additiveExpression(f, n.AdditiveExpression, n.Promote(), exprValue, flags) - p.w(")&%#x", n.ShiftExpression.Operand.Type().BitField().Mask()) + p.w(")&%#x", bfValueMask(n.ShiftExpression.Operand.Type().BitField())) case shiftOverflows(n, n.ShiftExpression.Operand, n.AdditiveExpression.Operand, oper, n.Operand.Type()): p.shiftExpression(f, n.ShiftExpression, n.Operand.Type(), exprValue, flags|fForceRuntimeConv) p.w(" %s%s", oper, tidyComment(" ", &n.Token)) @@ -7148,6 +7136,10 @@ func shiftOp(s string) string { } } +func bfValueMask(bf cc.Field) uint64 { + return uint64(1)< %s %s -> %s %s", n.Position(), op.Type(), op.Type().Kind(), tn, tn.Kind(), t, t.Kind())) } } } @@ -9947,11 +9934,6 @@ func (p *project) postfixExpressionValuePSelectStruct(f *function, n *cc.Postfix defer p.w("%s", p.convertType(n, fld.Promote(), t, flags)) switch pe.Kind() { case cc.Array: - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.todo(n, t) - return - } - x := p.convertType(n, nil, fld.Promote(), flags) p.w("*(*uint%d)(unsafe.Pointer(", fld.BitFieldBlockWidth()) p.postfixExpression(f, n.PostfixExpression, pe, exprDecay, flags) @@ -9963,18 +9945,6 @@ func (p *project) postfixExpressionValuePSelectStruct(f *function, n *cc.Postfix p.w("<<%d>>%[1]d", int(fld.Promote().Size()*8)-fld.BitFieldWidth()) } default: - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - x := p.convertType(n, nil, fld.Promote(), flags) - p.w("*(*uint%d)(unsafe.Pointer(", fld.BitFieldBlockWidth()) - p.postfixExpression(f, n.PostfixExpression, pe, exprValue, flags) - p.bitFldOff(pe.Elem(), n.Token2) - p.w("))>>%d&%#x%s", fld.BitFieldBlockWidth()-fld.BitFieldOffset()-fld.BitFieldWidth(), uint64(1)<>%[1]d", int(fld.Promote().Size()*8)-fld.BitFieldWidth()) - } - break - } - x := p.convertType(n, nil, fld.Promote(), flags) p.w("*(*uint%d)(unsafe.Pointer(", fld.BitFieldBlockWidth()) p.postfixExpression(f, n.PostfixExpression, pe, exprValue, flags) @@ -10141,11 +10111,6 @@ func (p *project) postfixExpressionValueSelectUnion(f *function, n *cc.PostfixEx } switch { case n.Operand.Type().IsBitFieldType(): - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.todo(n, t) - return - } - p.w("(") defer p.w("%s)", p.convertType(n, fld.Promote(), t, flags)) x := p.convertType(n, nil, fld.Promote(), flags) @@ -10175,20 +10140,6 @@ func (p *project) postfixExpressionValueSelectStruct(f *function, n *cc.PostfixE fld := n.Field switch { case n.Operand.Type().IsBitFieldType(): - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - p.w("(") - defer p.w("%s)", p.convertType(n, fld.Promote(), t, flags)) - x := p.convertType(n, nil, fld.Promote(), flags) - p.w("*(*uint%d)(unsafe.Pointer(", fld.BitFieldBlockWidth()) - p.postfixExpression(f, n.PostfixExpression, pe, exprAddrOf, flags) - p.bitFldOff(pe, n.Token2) - p.w("))>>%d&%#x%s", fld.BitFieldBlockWidth()-fld.BitFieldOffset()-fld.BitFieldWidth(), uint64(1)<>%[1]d", int(fld.Promote().Size()*8)-fld.BitFieldWidth()) - } - break - } - p.w("(") defer p.w("%s)", p.convertType(n, fld.Promote(), t, flags)) x := p.convertType(n, nil, fld.Promote(), flags) @@ -10491,10 +10442,6 @@ func (p *project) postfixExpressionIncDecValueArrayParameter(f *function, n *cc. } func (p *project) postfixExpressionIncDecValueBitfield(f *function, n *cc.PostfixExpression, oper, oper2 string, t cc.Type, mode exprMode, flags flags) { - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - panic(todo("", n.Position())) - } - // PostfixExpression "++" pe := n.PostfixExpression.Operand.Type() defer p.w("%s", p.convert(n, n.PostfixExpression.Operand, t, flags)) @@ -10671,6 +10618,9 @@ func (p *project) bitFldOff(t cc.Type, tok cc.Token) { } func (p *project) fldOff(t cc.Type, tok cc.Token) { + if t.Kind() == cc.Ptr { + t = t.Elem() + } var off uintptr fld, ok := t.FieldByName(tok.Value) switch { @@ -10729,8 +10679,12 @@ func (p *project) postfixExpressionCallBool(f *function, n *cc.PostfixExpression } } + var va uintptr + if f != nil { + va = f.vaLists[n] + } p.postfixExpression(f, n.PostfixExpression, n.PostfixExpression.Operand.Type(), exprFunc, flags&^fOutermost) - p.argumentExpressionList(f, n.PostfixExpression, n.ArgumentExpressionList, f.vaLists[n]) + p.argumentExpressionList(f, n.PostfixExpression, n.ArgumentExpressionList, va) } func (p *project) postfixExpressionCallValue(f *function, n *cc.PostfixExpression, t cc.Type, mode exprMode, flags flags) { @@ -10775,8 +10729,12 @@ func (p *project) postfixExpressionCallValue(f *function, n *cc.PostfixExpressio return } } + var va uintptr + if f != nil { + va = f.vaLists[n] + } p.postfixExpression(f, n.PostfixExpression, n.PostfixExpression.Operand.Type(), exprFunc, flags&^fOutermost) - p.argumentExpressionList(f, n.PostfixExpression, n.ArgumentExpressionList, f.vaLists[n]) + p.argumentExpressionList(f, n.PostfixExpression, n.ArgumentExpressionList, va) } // bool __builtin_mul_overflow (type1 a, type2 b, type3 *res) @@ -10970,8 +10928,12 @@ func (p *project) postfixExpressionCallVoid(f *function, n *cc.PostfixExpression return } } + var va uintptr + if f != nil { + va = f.vaLists[n] + } p.postfixExpression(f, n.PostfixExpression, n.PostfixExpression.Operand.Type(), exprFunc, flags&^fOutermost) - p.argumentExpressionList(f, n.PostfixExpression, n.ArgumentExpressionList, f.vaLists[n]) + p.argumentExpressionList(f, n.PostfixExpression, n.ArgumentExpressionList, va) } // void __atomic_store_n (type *ptr, type val, int memorder) @@ -11036,7 +10998,12 @@ func (p *project) argList(n *cc.ArgumentExpressionList) (r []*cc.AssignmentExpre } func (p *project) argumentExpressionList(f *function, pe *cc.PostfixExpression, n *cc.ArgumentExpressionList, bpOff uintptr) { - p.w("(%s", f.tlsName) + switch { + case f == nil: + p.w("(nil") + default: + p.w("(%s", f.tlsName) + } ft := funcType(pe.Operand.Type()) isVariadic := ft.IsVariadic() params := ft.Parameters() @@ -11347,7 +11314,7 @@ func (p *project) primaryExpressionBool(f *function, n *cc.PrimaryExpression, t case cc.PrimaryExpressionChar: // CHARCONST panic(todo("", p.pos(n))) case cc.PrimaryExpressionLChar: // LONGCHARCONST - panic(todo("", p.pos(n))) + p.charConst(n, n.Token.Src.String(), n.Operand, t, flags) case cc.PrimaryExpressionString: // STRINGLITERAL p.w(" 1 ") case cc.PrimaryExpressionLString: // LONGSTRINGLITERAL @@ -11457,7 +11424,7 @@ func (p *project) primaryExpressionAddrOf(f *function, n *cc.PrimaryExpression, case cc.PrimaryExpressionString: // STRINGLITERAL p.w("%s", p.stringLiteral(n.Operand.Value())) case cc.PrimaryExpressionLString: // LONGSTRINGLITERAL - panic(todo("", p.pos(n))) + p.w("%s", p.wideStringLiteral(n.Operand.Value(), 0)) case cc.PrimaryExpressionExpr: // '(' Expression ')' p.expression(f, n.Expression, t, mode, flags) case cc.PrimaryExpressionStmt: // '(' CompoundStatement ')' @@ -12045,10 +12012,6 @@ func (p *project) assignOpValueBitfield(f *function, n *cc.AssignmentExpression, panic(todo("")) } - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - panic(todo("", n.Position())) - } - ot := n.Operand.Type() lhs := n.UnaryExpression bf := lhs.Operand.Type().BitField() @@ -12078,10 +12041,6 @@ func (p *project) assignOpValueBitfield(f *function, n *cc.AssignmentExpression, } func (p *project) readBitfield(n cc.Node, ptr string, bf cc.Field, promote cc.Type) { - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - panic(todo("", n.Position())) - } - bw := bf.BitFieldBlockWidth() m := bf.Mask() o := bf.BitFieldOffset() @@ -12213,10 +12172,6 @@ func (p *project) assignOpVoidArrayParameter(f *function, n *cc.AssignmentExpres } func (p *project) assignOpVoidBitfield(f *function, n *cc.AssignmentExpression, t cc.Type, oper, oper2 string, mode exprMode, flags flags) { - if p.task.cfg.ABI.ByteOrder == binary.BigEndian { - panic(todo("", n.Position())) - } - // UnaryExpression "*=" AssignmentExpression etc. lhs := n.UnaryExpression lt := lhs.Operand.Type() @@ -12793,6 +12748,34 @@ func (p *project) functionDefinitionSignature(f *function, tld *tld) { } } +func (p *project) functionSignature2(f *function, t cc.Type, nm string) { + p.w("func %s", nm) + p.w("(_ *%sTLS", p.task.crt) + suffix := 1 + for _, v := range t.Parameters() { + if v.Type().Kind() == cc.Void { + break + } + + pn := "_" + if d := v.Declarator(); d != nil { + pn = d.Name().String() + if _, ok := reservedNames[pn]; ok { + pn += strconv.Itoa(suffix) + suffix++ + } + } + p.w(", %s %s", pn, p.paramTyp(v.Declarator(), v.Type())) + } + if t.IsVariadic() { + p.w(", _ /* va_list */ uintptr") + } + p.w(")") + if rt := t.Result(); rt != nil && rt.Kind() != cc.Void { + p.w(" %s", p.typ(nil, rt)) + } +} + func (p *project) functionSignature(f *function, t cc.Type, nm string) { p.w("func") if nm != "" { diff --git a/vendor/modernc.org/ccgo/v3/lib/init.go b/vendor/modernc.org/ccgo/v3/lib/init.go index d57113a9..aacd03d0 100644 --- a/vendor/modernc.org/ccgo/v3/lib/init.go +++ b/vendor/modernc.org/ccgo/v3/lib/init.go @@ -38,7 +38,7 @@ func (p *project) initializer(f *function, n *cc.Initializer, t cc.Type, sc cc.S } if a.Field == nil || b.Field == nil || !a.Field.IsBitField() || !b.Field.IsBitField() { - panic(todo("%v: internal error: %#x, %v: %#x", a.Position(), a.Offset, b.Position(), b.Offset)) + panic(todo("%v: internal error: off %#x, %v: off %#x, t %v", a.Position(), a.Offset, b.Position(), b.Offset, t)) } return a.Field.BitFieldOffset() < b.Field.BitFieldOffset() @@ -292,10 +292,6 @@ func (p *project) initializerStructField(off uintptr, s []*cc.Initializer, t cc. bits := false for i := []int{0}; i[0] < nf; i[0]++ { fld2 := t.FieldByIndex(i) - if fld2.Name() == 0 { - continue - } - if fld == nil { fld = fld2 } diff --git a/vendor/modernc.org/ccgo/v3/lib/mem.go b/vendor/modernc.org/ccgo/v3/lib/mem.go index ff7b8584..daf6c923 100644 --- a/vendor/modernc.org/ccgo/v3/lib/mem.go +++ b/vendor/modernc.org/ccgo/v3/lib/mem.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !linux // +build !linux package ccgo // import "modernc.org/ccgo/v3/lib" diff --git a/vendor/modernc.org/ccgo/v3/lib/nodmesg.go b/vendor/modernc.org/ccgo/v3/lib/nodmesg.go index 6388aa33..8871c8ec 100644 --- a/vendor/modernc.org/ccgo/v3/lib/nodmesg.go +++ b/vendor/modernc.org/ccgo/v3/lib/nodmesg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !ccgo.dmesg // +build !ccgo.dmesg package ccgo // import "modernc.org/ccgo/v3/lib" diff --git a/vendor/modernc.org/libc/AUTHORS b/vendor/modernc.org/libc/AUTHORS index d0dd42a1..932a584e 100644 --- a/vendor/modernc.org/libc/AUTHORS +++ b/vendor/modernc.org/libc/AUTHORS @@ -11,5 +11,6 @@ Dan Kortschak Dan Peterson Jan Mercl <0xjnml@gmail.com> +Jason DeBettencourt +Koichi Shiraishi Steffen Butzer -Jason DeBettencourt \ No newline at end of file diff --git a/vendor/modernc.org/libc/CONTRIBUTORS b/vendor/modernc.org/libc/CONTRIBUTORS index a4234ab6..9efa6ea6 100644 --- a/vendor/modernc.org/libc/CONTRIBUTORS +++ b/vendor/modernc.org/libc/CONTRIBUTORS @@ -10,5 +10,6 @@ Dan Kortschak Dan Peterson Jaap Aarts Jan Mercl <0xjnml@gmail.com> -Steffen Butzer Jason DeBettencourt +Koichi Shiraishi +Steffen Butzer diff --git a/vendor/modernc.org/libc/HACKING b/vendor/modernc.org/libc/HACKING index cbd0e830..c76a6ce4 100644 --- a/vendor/modernc.org/libc/HACKING +++ b/vendor/modernc.org/libc/HACKING @@ -1,10 +1,3 @@ -Version 3 notes - Install: - $ go get modernc.org/crt/v3 - -Version 3 is the transition from "all scalars are signed integers" (the QBE -model) to the more traditional "integers have signedness and pointers are not -exactly the same as integers" that is used by modernc.org/ccgo/v3. However, all -C pointers are of the same Go type: uintptr. + $ go get modernc.org/libc diff --git a/vendor/modernc.org/libc/LICENSE b/vendor/modernc.org/libc/LICENSE index 29e1443d..0c6500bc 100644 --- a/vendor/modernc.org/libc/LICENSE +++ b/vendor/modernc.org/libc/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 The CRT Authors. All rights reserved. +Copyright (c) 2017 The Libc Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/vendor/modernc.org/libc/Makefile b/vendor/modernc.org/libc/Makefile index a8259725..56e082a7 100644 --- a/vendor/modernc.org/libc/Makefile +++ b/vendor/modernc.org/libc/Makefile @@ -25,11 +25,13 @@ all: go test 2>&1 -timeout 1h | tee -a $(log) GOOS=darwin GOARCH=amd64 go build GOOS=darwin GOARCH=arm64 go build + GOOS=freebsd GOARCH=amd64 go build GOOS=linux GOARCH=386 go build GOOS=linux GOARCH=amd64 go build GOOS=linux GOARCH=arm go build GOOS=linux GOARCH=arm64 go build GOOS=linux GOARCH=s390x go build + GOOS=netbsd GOARCH=amd64 go build GOOS=windows GOARCH=386 go build GOOS=windows GOARCH=amd64 go build go vet -unsafeptr=false 2>&1 | grep -v $(ngrep) || true @@ -50,6 +52,16 @@ darwin_arm64: TARGET_GOOS=darwin TARGET_GOARCH=arm64 go generate GOOS=darwin GOARCH=arm64 go build -v ./... +# only on netbsd/amd64 +netbsd_amd64: + TARGET_GOOS=netbsd TARGET_GOARCH=amd64 go generate + GOOS=netbsd GOARCH=amd64 go build -v ./... + +# only on freebsd/amd64 +freebsd_amd64: + TARGET_GOOS=freebsd TARGET_GOARCH=amd64 go generate + GOOS=freebsd GOARCH=amd64 go build -v ./... + linux_amd64: TARGET_GOOS=linux TARGET_GOARCH=amd64 go generate GOOS=linux GOARCH=amd64 go build -v ./... @@ -84,11 +96,13 @@ all_targets: linux_amd64 linux_386 linux_arm linux_arm64 windows_amd64 windows_3 build_all_targets: GOOS=darwin GOARCH=amd64 go build -v ./... GOOS=darwin GOARCH=arm64 go build -v ./... + GOOS=freebsd GOARCH=amd64 go build -v ./... GOOS=linux GOARCH=386 go build -v ./... GOOS=linux GOARCH=amd64 go build -v ./... GOOS=linux GOARCH=arm go build -v ./... GOOS=linux GOARCH=arm64 go build -v ./... GOOS=linux GOARCH=s390x go build -v ./... + GOOS=netbsd GOARCH=amd64 go build -v ./... GOOS=windows GOARCH=386 go build -v ./... GOOS=windows GOARCH=amd64 go build -v ./... echo done @@ -119,10 +133,10 @@ edit: @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi editor: - GO111MODULE=off go generate 2>&1 | tee log + go generate 2>&1 | tee log gofmt -l -s -w *.go - GO111MODULE=off go test -short 2>&1 | tee -a log - GO111MODULE=off go install -v ./... + go test -short 2>&1 | tee -a log + go install -v ./... later: @grep -n $(grep) LATER * || true diff --git a/vendor/modernc.org/libc/capi_darwin_amd64.go b/vendor/modernc.org/libc/capi_darwin_amd64.go index 5896bfab..f6c90e34 100644 --- a/vendor/modernc.org/libc/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/capi_darwin_amd64.go @@ -29,6 +29,7 @@ var CAPI = map[string]struct{}{ "__builtin_constant_p_impl": {}, "__builtin_copysign": {}, "__builtin_copysignf": {}, + "__builtin_copysignl": {}, "__builtin_exit": {}, "__builtin_expect": {}, "__builtin_fabs": {}, @@ -37,6 +38,7 @@ var CAPI = map[string]struct{}{ "__builtin_huge_valf": {}, "__builtin_inf": {}, "__builtin_inff": {}, + "__builtin_infl": {}, "__builtin_isnan": {}, "__builtin_malloc": {}, "__builtin_memcmp": {}, @@ -46,7 +48,9 @@ var CAPI = map[string]struct{}{ "__builtin_mul_overflowInt64": {}, "__builtin_mul_overflowUint128": {}, "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, "__builtin_nanf": {}, + "__builtin_nanl": {}, "__builtin_object_size": {}, "__builtin_popcount": {}, "__builtin_prefetch": {}, @@ -60,10 +64,10 @@ var CAPI = map[string]struct{}{ "__builtin_sub_overflowInt64": {}, "__builtin_trap": {}, "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, "__ccgo_in6addr_anyp": {}, "__ccgo_sqlite3_log": {}, "__cmsg_nxthdr": {}, - "__ctype_b_loc": {}, "__ctype_get_mb_cur_max": {}, "__darwin_fd_clr": {}, "__darwin_fd_isset": {}, @@ -217,9 +221,7 @@ var CAPI = map[string]struct{}{ "getpeername": {}, "getpid": {}, "getpwnam": {}, - "getpwnam_r": {}, "getpwuid": {}, - "getpwuid_r": {}, "getresgid": {}, "getresuid": {}, "getrusage": {}, @@ -326,6 +328,7 @@ var CAPI = map[string]struct{}{ "remove": {}, "rename": {}, "rewind": {}, + "rint": {}, "rmdir": {}, "round": {}, "scalbn": {}, diff --git a/vendor/modernc.org/libc/capi_darwin_arm64.go b/vendor/modernc.org/libc/capi_darwin_arm64.go index 5896bfab..967a5bf7 100644 --- a/vendor/modernc.org/libc/capi_darwin_arm64.go +++ b/vendor/modernc.org/libc/capi_darwin_arm64.go @@ -29,6 +29,7 @@ var CAPI = map[string]struct{}{ "__builtin_constant_p_impl": {}, "__builtin_copysign": {}, "__builtin_copysignf": {}, + "__builtin_copysignl": {}, "__builtin_exit": {}, "__builtin_expect": {}, "__builtin_fabs": {}, @@ -36,6 +37,7 @@ var CAPI = map[string]struct{}{ "__builtin_huge_val": {}, "__builtin_huge_valf": {}, "__builtin_inf": {}, + "__builtin_infl": {}, "__builtin_inff": {}, "__builtin_isnan": {}, "__builtin_malloc": {}, @@ -46,7 +48,9 @@ var CAPI = map[string]struct{}{ "__builtin_mul_overflowInt64": {}, "__builtin_mul_overflowUint128": {}, "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, "__builtin_nanf": {}, + "__builtin_nanl": {}, "__builtin_object_size": {}, "__builtin_popcount": {}, "__builtin_prefetch": {}, @@ -60,10 +64,10 @@ var CAPI = map[string]struct{}{ "__builtin_sub_overflowInt64": {}, "__builtin_trap": {}, "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, "__ccgo_in6addr_anyp": {}, "__ccgo_sqlite3_log": {}, "__cmsg_nxthdr": {}, - "__ctype_b_loc": {}, "__ctype_get_mb_cur_max": {}, "__darwin_fd_clr": {}, "__darwin_fd_isset": {}, diff --git a/vendor/modernc.org/libc/capi_freebsd_amd64.go b/vendor/modernc.org/libc/capi_freebsd_amd64.go new file mode 100644 index 00000000..e8c39296 --- /dev/null +++ b/vendor/modernc.org/libc/capi_freebsd_amd64.go @@ -0,0 +1,426 @@ +// Code generated by 'go generate' - DO NOT EDIT. + +package libc // import "modernc.org/libc" + +var CAPI = map[string]struct{}{ + "_CurrentRuneLocale": {}, + "_DefaultRuneLocale": {}, + "_IO_putc": {}, + "_ThreadRuneLocale": {}, + "___errno_location": {}, + "___runetype": {}, + "__assert": {}, + "__assert_fail": {}, + "__builtin___memcpy_chk": {}, + "__builtin___memmove_chk": {}, + "__builtin___memset_chk": {}, + "__builtin___snprintf_chk": {}, + "__builtin___sprintf_chk": {}, + "__builtin___strcat_chk": {}, + "__builtin___strcpy_chk": {}, + "__builtin___strncpy_chk": {}, + "__builtin___vsnprintf_chk": {}, + "__builtin_abort": {}, + "__builtin_abs": {}, + "__builtin_add_overflowInt64": {}, + "__builtin_add_overflowUint32": {}, + "__builtin_add_overflowUint64": {}, + "__builtin_bswap16": {}, + "__builtin_bswap32": {}, + "__builtin_bswap64": {}, + "__builtin_clzll": {}, + "__builtin_constant_p_impl": {}, + "__builtin_copysign": {}, + "__builtin_copysignf": {}, + "__builtin_copysignl": {}, + "__builtin_exit": {}, + "__builtin_expect": {}, + "__builtin_fabs": {}, + "__builtin_free": {}, + "__builtin_huge_val": {}, + "__builtin_huge_valf": {}, + "__builtin_inf": {}, + "__builtin_infl": {}, + "__builtin_inff": {}, + "__builtin_isnan": {}, + "__builtin_malloc": {}, + "__builtin_memcmp": {}, + "__builtin_memcpy": {}, + "__builtin_memset": {}, + "__builtin_mmap": {}, + "__builtin_mul_overflowInt64": {}, + "__builtin_mul_overflowUint128": {}, + "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, + "__builtin_nanf": {}, + "__builtin_nanl": {}, + "__builtin_object_size": {}, + "__builtin_popcount": {}, + "__builtin_prefetch": {}, + "__builtin_printf": {}, + "__builtin_snprintf": {}, + "__builtin_sprintf": {}, + "__builtin_strchr": {}, + "__builtin_strcmp": {}, + "__builtin_strcpy": {}, + "__builtin_strlen": {}, + "__builtin_sub_overflowInt64": {}, + "__builtin_trap": {}, + "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, + "__ccgo_in6addr_anyp": {}, + "__ccgo_sqlite3_log": {}, + "__cmsg_nxthdr": {}, + "__ctype_get_mb_cur_max": {}, + "__errno_location": {}, + "__error": {}, + "__floatscan": {}, + "__h_errno_location": {}, + "__inet_aton": {}, + "__inet_ntoa": {}, + "__intscan": {}, + "__isalnum_l": {}, + "__isalpha_l": {}, + "__isdigit_l": {}, + "__isnan": {}, + "__isnanf": {}, + "__isnanl": {}, + "__isoc99_sscanf": {}, + "__isthreaded": {}, + "__lookup_ipliteral": {}, + "__lookup_name": {}, + "__lookup_serv": {}, + "__mb_sb_limit": {}, + "__runes_for_locale": {}, + "__shgetc": {}, + "__shlim": {}, + "__stderrp": {}, + "__stdinp": {}, + "__stdoutp": {}, + "__swbuf": {}, + "__syscall1": {}, + "__syscall3": {}, + "__syscall4": {}, + "__toread": {}, + "__toread_needs_stdio_exit": {}, + "__uflow": {}, + "__xuname": {}, + "_exit": {}, + "_obstack_begin": {}, + "_obstack_newchunk": {}, + "abort": {}, + "abs": {}, + "accept": {}, + "access": {}, + "acos": {}, + "acosh": {}, + "alarm": {}, + "asin": {}, + "asinh": {}, + "atan": {}, + "atan2": {}, + "atanh": {}, + "atexit": {}, + "atof": {}, + "atoi": {}, + "atol": {}, + "backtrace": {}, + "backtrace_symbols_fd": {}, + "bind": {}, + "calloc": {}, + "ceil": {}, + "ceilf": {}, + "cfgetospeed": {}, + "cfsetispeed": {}, + "cfsetospeed": {}, + "chdir": {}, + "chflags": {}, + "chmod": {}, + "chown": {}, + "clock_gettime": {}, + "close": {}, + "closedir": {}, + "confstr": {}, + "connect": {}, + "copysign": {}, + "copysignf": {}, + "copysignl": {}, + "cos": {}, + "cosf": {}, + "cosh": {}, + "ctime": {}, + "ctime_r": {}, + "dlclose": {}, + "dlerror": {}, + "dlopen": {}, + "dlsym": {}, + "dup2": {}, + "endpwent": {}, + "environ": {}, + "execvp": {}, + "exit": {}, + "exp": {}, + "fabs": {}, + "fabsf": {}, + "fabsl": {}, + "fchmod": {}, + "fchown": {}, + "fclose": {}, + "fcntl": {}, + "fcntl64": {}, + "fdopen": {}, + "ferror": {}, + "fflush": {}, + "fgetc": {}, + "fgets": {}, + "fileno": {}, + "floor": {}, + "fmod": {}, + "fmodl": {}, + "fopen": {}, + "fopen64": {}, + "fork": {}, + "fprintf": {}, + "fputc": {}, + "fputs": {}, + "fread": {}, + "free": {}, + "freeaddrinfo": {}, + "frexp": {}, + "fscanf": {}, + "fseek": {}, + "fstat": {}, + "fstat64": {}, + "fsync": {}, + "ftell": {}, + "ftruncate": {}, + "fts64_close": {}, + "fts64_open": {}, + "fts64_read": {}, + "fts_close": {}, + "fts_open": {}, + "fts_read": {}, + "fwrite": {}, + "gai_strerror": {}, + "getaddrinfo": {}, + "getc": {}, + "getcwd": {}, + "getegid": {}, + "getenv": {}, + "geteuid": {}, + "getgid": {}, + "getgrgid": {}, + "getgrgid_r": {}, + "getgrnam": {}, + "getgrnam_r": {}, + "gethostbyaddr": {}, + "gethostbyaddr_r": {}, + "gethostbyname": {}, + "gethostbyname2": {}, + "gethostbyname2_r": {}, + "gethostname": {}, + "getnameinfo": {}, + "getpeername": {}, + "getpid": {}, + "getpwnam": {}, + "getpwnam_r": {}, + "getpwuid": {}, + "getpwuid_r": {}, + "getresgid": {}, + "getresuid": {}, + "getrlimit": {}, + "getrlimit64": {}, + "getrusage": {}, + "getservbyname": {}, + "getsockname": {}, + "getsockopt": {}, + "gettimeofday": {}, + "getuid": {}, + "gmtime_r": {}, + "h_errno": {}, + "htonl": {}, + "htons": {}, + "hypot": {}, + "inet_ntoa": {}, + "inet_ntop": {}, + "inet_pton": {}, + "initstate_r": {}, + "ioctl": {}, + "isalnum": {}, + "isalpha": {}, + "isatty": {}, + "isdigit": {}, + "isnan": {}, + "isnanf": {}, + "isnanl": {}, + "kill": {}, + "ldexp": {}, + "link": {}, + "listen": {}, + "localtime": {}, + "localtime_r": {}, + "log": {}, + "log10": {}, + "lrand48": {}, + "lseek": {}, + "lseek64": {}, + "lstat": {}, + "lstat64": {}, + "malloc": {}, + "mblen": {}, + "mbstowcs": {}, + "mbtowc": {}, + "memchr": {}, + "memcmp": {}, + "memcpy": {}, + "memmove": {}, + "memset": {}, + "mkdir": {}, + "mkfifo": {}, + "mknod": {}, + "mkstemp": {}, + "mkstemp64": {}, + "mkstemps": {}, + "mkstemps64": {}, + "mktime": {}, + "mmap": {}, + "modf": {}, + "munmap": {}, + "nl_langinfo": {}, + "ntohs": {}, + "obstack_free": {}, + "obstack_vprintf": {}, + "open": {}, + "open64": {}, + "opendir": {}, + "openpty": {}, + "pathconf": {}, + "pause": {}, + "pclose": {}, + "perror": {}, + "pipe": {}, + "poll": {}, + "popen": {}, + "posix_fadvise": {}, + "pow": {}, + "printf": {}, + "pselect": {}, + "putc": {}, + "putchar": {}, + "puts": {}, + "qsort": {}, + "raise": {}, + "rand": {}, + "random": {}, + "random_r": {}, + "read": {}, + "readdir": {}, + "readdir64": {}, + "readlink": {}, + "readv": {}, + "realloc": {}, + "realpath": {}, + "recv": {}, + "recvfrom": {}, + "recvmsg": {}, + "remove": {}, + "rename": {}, + "rewind": {}, + "rint": {}, + "rmdir": {}, + "round": {}, + "scalbn": {}, + "scalbnl": {}, + "sched_yield": {}, + "select": {}, + "send": {}, + "sendmsg": {}, + "sendto": {}, + "setbuf": {}, + "setenv": {}, + "setlocale": {}, + "setrlimit": {}, + "setrlimit64": {}, + "setsid": {}, + "setsockopt": {}, + "setvbuf": {}, + "shmat": {}, + "shmctl": {}, + "shmdt": {}, + "shutdown": {}, + "sigaction": {}, + "signal": {}, + "sin": {}, + "sinf": {}, + "sinh": {}, + "sleep": {}, + "snprintf": {}, + "socket": {}, + "sprintf": {}, + "sqrt": {}, + "srand48": {}, + "sscanf": {}, + "stat": {}, + "stat64": {}, + "stderr": {}, + "stdin": {}, + "stdout": {}, + "strcasecmp": {}, + "strcat": {}, + "strchr": {}, + "strcmp": {}, + "strcpy": {}, + "strcspn": {}, + "strdup": {}, + "strerror": {}, + "strlen": {}, + "strncmp": {}, + "strncpy": {}, + "strnlen": {}, + "strpbrk": {}, + "strrchr": {}, + "strspn": {}, + "strstr": {}, + "strtod": {}, + "strtof": {}, + "strtoimax": {}, + "strtol": {}, + "strtold": {}, + "strtoll": {}, + "strtoul": {}, + "strtoull": {}, + "strtoumax": {}, + "symlink": {}, + "sysconf": {}, + "system": {}, + "tan": {}, + "tanh": {}, + "tcgetattr": {}, + "tcsendbreak": {}, + "tcsetattr": {}, + "time": {}, + "tolower": {}, + "toupper": {}, + "trunc": {}, + "tzset": {}, + "umask": {}, + "uname": {}, + "ungetc": {}, + "unlink": {}, + "unsetenv": {}, + "usleep": {}, + "utime": {}, + "utimes": {}, + "vasprintf": {}, + "vfprintf": {}, + "vprintf": {}, + "vsnprintf": {}, + "vsprintf": {}, + "waitpid": {}, + "wcschr": {}, + "wctomb": {}, + "wcwidth": {}, + "write": {}, + "writev": {}, + "zero_struct_address": {}, +} diff --git a/vendor/modernc.org/libc/capi_linux_386.go b/vendor/modernc.org/libc/capi_linux_386.go index 23fe92c9..6b9bc30f 100644 --- a/vendor/modernc.org/libc/capi_linux_386.go +++ b/vendor/modernc.org/libc/capi_linux_386.go @@ -3,420 +3,447 @@ package libc // import "modernc.org/libc" var CAPI = map[string]struct{}{ - "_IO_putc": {}, - "___errno_location": {}, - "__assert_fail": {}, - "__builtin___memcpy_chk": {}, - "__builtin___memmove_chk": {}, - "__builtin___memset_chk": {}, - "__builtin___snprintf_chk": {}, - "__builtin___sprintf_chk": {}, - "__builtin___strcat_chk": {}, - "__builtin___strcpy_chk": {}, - "__builtin___strncpy_chk": {}, - "__builtin___vsnprintf_chk": {}, - "__builtin_abort": {}, - "__builtin_abs": {}, - "__builtin_add_overflowInt64": {}, - "__builtin_add_overflowUint32": {}, - "__builtin_add_overflowUint64": {}, - "__builtin_bswap16": {}, - "__builtin_bswap32": {}, - "__builtin_bswap64": {}, - "__builtin_clzll": {}, - "__builtin_constant_p_impl": {}, - "__builtin_copysign": {}, - "__builtin_copysignf": {}, - "__builtin_exit": {}, - "__builtin_expect": {}, - "__builtin_fabs": {}, - "__builtin_free": {}, - "__builtin_huge_val": {}, - "__builtin_huge_valf": {}, - "__builtin_inf": {}, - "__builtin_inff": {}, - "__builtin_isnan": {}, - "__builtin_malloc": {}, - "__builtin_memcmp": {}, - "__builtin_memcpy": {}, - "__builtin_memset": {}, - "__builtin_mmap": {}, - "__builtin_mul_overflowInt64": {}, - "__builtin_mul_overflowUint128": {}, - "__builtin_mul_overflowUint64": {}, - "__builtin_nanf": {}, - "__builtin_object_size": {}, - "__builtin_popcount": {}, - "__builtin_prefetch": {}, - "__builtin_printf": {}, - "__builtin_snprintf": {}, - "__builtin_sprintf": {}, - "__builtin_strchr": {}, - "__builtin_strcmp": {}, - "__builtin_strcpy": {}, - "__builtin_strlen": {}, - "__builtin_sub_overflowInt64": {}, - "__builtin_trap": {}, - "__builtin_unreachable": {}, - "__ccgo_in6addr_anyp": {}, - "__ccgo_sqlite3_log": {}, - "__cmsg_nxthdr": {}, - "__ctype_b_loc": {}, - "__ctype_get_mb_cur_max": {}, - "__errno_location": {}, - "__floatscan": {}, - "__fpclassify": {}, - "__fpclassifyf": {}, - "__fpclassifyl": {}, - "__h_errno_location": {}, - "__inet_aton": {}, - "__intscan": {}, - "__isalnum_l": {}, - "__isalpha_l": {}, - "__isdigit_l": {}, - "__islower_l": {}, - "__isnan": {}, - "__isnanf": {}, - "__isnanl": {}, - "__isoc99_sscanf": {}, - "__isprint_l": {}, - "__isupper_l": {}, - "__isxdigit_l": {}, - "__lookup_ipliteral": {}, - "__lookup_name": {}, - "__lookup_serv": {}, - "__shgetc": {}, - "__shlim": {}, - "__strncasecmp_l": {}, - "__syscall1": {}, - "__syscall3": {}, - "__toread": {}, - "__toread_needs_stdio_exit": {}, - "__uflow": {}, - "_exit": {}, - "_obstack_begin": {}, - "_obstack_newchunk": {}, - "abort": {}, - "abs": {}, - "accept": {}, - "access": {}, - "acos": {}, - "acosh": {}, - "alarm": {}, - "asin": {}, - "asinh": {}, - "atan": {}, - "atan2": {}, - "atanh": {}, - "atexit": {}, - "atof": {}, - "atoi": {}, - "atol": {}, - "backtrace": {}, - "backtrace_symbols_fd": {}, - "bind": {}, - "calloc": {}, - "ceil": {}, - "ceilf": {}, - "cfgetospeed": {}, - "cfsetispeed": {}, - "cfsetospeed": {}, - "chdir": {}, - "chmod": {}, - "chown": {}, - "clock_gettime": {}, - "close": {}, - "closedir": {}, - "confstr": {}, - "connect": {}, - "copysign": {}, - "copysignf": {}, - "copysignl": {}, - "cos": {}, - "cosf": {}, - "cosh": {}, - "ctime": {}, - "dlclose": {}, - "dlerror": {}, - "dlopen": {}, - "dlsym": {}, - "dup2": {}, - "endpwent": {}, - "environ": {}, - "execvp": {}, - "exit": {}, - "exp": {}, - "fabs": {}, - "fabsf": {}, - "fabsl": {}, - "fchmod": {}, - "fchown": {}, - "fclose": {}, - "fcntl": {}, - "fcntl64": {}, - "fdopen": {}, - "ferror": {}, - "fflush": {}, - "fgetc": {}, - "fgets": {}, - "fileno": {}, - "floor": {}, - "fmod": {}, - "fmodl": {}, - "fopen": {}, - "fopen64": {}, - "fork": {}, - "fprintf": {}, - "fputc": {}, - "fputs": {}, - "fread": {}, - "free": {}, - "freeaddrinfo": {}, - "frexp": {}, - "fscanf": {}, - "fseek": {}, - "fstat": {}, - "fstat64": {}, - "fsync": {}, - "ftell": {}, - "ftruncate": {}, - "ftruncate64": {}, - "fts64_close": {}, - "fts64_open": {}, - "fts64_read": {}, - "fts_close": {}, - "fts_open": {}, - "fts_read": {}, - "fwrite": {}, - "gai_strerror": {}, - "getaddrinfo": {}, - "getc": {}, - "getcwd": {}, - "getegid": {}, - "getenv": {}, - "geteuid": {}, - "getgid": {}, - "getgrgid": {}, - "getgrnam": {}, - "gethostbyaddr": {}, - "gethostbyaddr_r": {}, - "gethostbyname": {}, - "gethostbyname2": {}, - "gethostbyname2_r": {}, - "gethostname": {}, - "getnameinfo": {}, - "getpeername": {}, - "getpid": {}, - "getpwnam": {}, - "getpwnam_r": {}, - "getpwuid": {}, - "getpwuid_r": {}, - "getresgid": {}, - "getresuid": {}, - "getrlimit": {}, - "getrlimit64": {}, - "getrusage": {}, - "getservbyname": {}, - "getsockname": {}, - "getsockopt": {}, - "gettimeofday": {}, - "getuid": {}, - "gmtime_r": {}, - "h_errno": {}, - "htonl": {}, - "htons": {}, - "hypot": {}, - "inet_ntoa": {}, - "inet_ntop": {}, - "inet_pton": {}, - "initstate_r": {}, - "ioctl": {}, - "isalnum": {}, - "isalpha": {}, - "isatty": {}, - "isdigit": {}, - "islower": {}, - "isnan": {}, - "isnanf": {}, - "isnanl": {}, - "isprint": {}, - "isupper": {}, - "isxdigit": {}, - "kill": {}, - "ldexp": {}, - "link": {}, - "listen": {}, - "localtime": {}, - "localtime_r": {}, - "log": {}, - "log10": {}, - "lrand48": {}, - "lseek": {}, - "lseek64": {}, - "lstat": {}, - "lstat64": {}, - "malloc": {}, - "mblen": {}, - "mbstowcs": {}, - "mbtowc": {}, - "memchr": {}, - "memcmp": {}, - "memcpy": {}, - "memmove": {}, - "memset": {}, - "mkdir": {}, - "mkfifo": {}, - "mknod": {}, - "mkstemp": {}, - "mkstemp64": {}, - "mkstemps": {}, - "mkstemps64": {}, - "mktime": {}, - "mmap": {}, - "mmap64": {}, - "modf": {}, - "mremap": {}, - "munmap": {}, - "nanf": {}, - "nl_langinfo": {}, - "ntohs": {}, - "obstack_free": {}, - "obstack_vprintf": {}, - "open": {}, - "open64": {}, - "opendir": {}, - "openpty": {}, - "pathconf": {}, - "pause": {}, - "pclose": {}, - "perror": {}, - "pipe": {}, - "poll": {}, - "popen": {}, - "posix_fadvise": {}, - "pow": {}, - "printf": {}, - "pselect": {}, - "putc": {}, - "putchar": {}, - "puts": {}, - "qsort": {}, - "raise": {}, - "rand": {}, - "rand_r": {}, - "random": {}, - "random_r": {}, - "read": {}, - "readdir": {}, - "readdir64": {}, - "readlink": {}, - "readv": {}, - "realloc": {}, - "realpath": {}, - "recv": {}, - "recvfrom": {}, - "recvmsg": {}, - "remove": {}, - "rename": {}, - "rewind": {}, - "rmdir": {}, - "round": {}, - "scalbn": {}, - "scalbnl": {}, - "select": {}, - "send": {}, - "sendmsg": {}, - "sendto": {}, - "setbuf": {}, - "setenv": {}, - "setlocale": {}, - "setrlimit": {}, - "setrlimit64": {}, - "setsid": {}, - "setsockopt": {}, - "setvbuf": {}, - "shmat": {}, - "shmctl": {}, - "shmdt": {}, - "shutdown": {}, - "sigaction": {}, - "signal": {}, - "sin": {}, - "sinf": {}, - "sinh": {}, - "sleep": {}, - "snprintf": {}, - "socket": {}, - "sprintf": {}, - "sqrt": {}, - "srand48": {}, - "sscanf": {}, - "stat": {}, - "stat64": {}, - "stderr": {}, - "stdin": {}, - "stdout": {}, - "strcasecmp": {}, - "strcat": {}, - "strchr": {}, - "strcmp": {}, - "strcpy": {}, - "strcspn": {}, - "strdup": {}, - "strerror": {}, - "strlcat": {}, - "strlcpy": {}, - "strlen": {}, - "strncasecmp": {}, - "strncat": {}, - "strncmp": {}, - "strncpy": {}, - "strnlen": {}, - "strpbrk": {}, - "strrchr": {}, - "strspn": {}, - "strstr": {}, - "strtod": {}, - "strtof": {}, - "strtoimax": {}, - "strtok": {}, - "strtol": {}, - "strtold": {}, - "strtoll": {}, - "strtoul": {}, - "strtoull": {}, - "strtoumax": {}, - "symlink": {}, - "sysconf": {}, - "system": {}, - "tan": {}, - "tanh": {}, - "tcgetattr": {}, - "tcsendbreak": {}, - "tcsetattr": {}, - "time": {}, - "tolower": {}, - "toupper": {}, - "trunc": {}, - "tzset": {}, - "umask": {}, - "uname": {}, - "ungetc": {}, - "unlink": {}, - "unsetenv": {}, - "usleep": {}, - "utime": {}, - "utimes": {}, - "vasprintf": {}, - "vfprintf": {}, - "vprintf": {}, - "vsnprintf": {}, - "vsprintf": {}, - "waitpid": {}, - "wcschr": {}, - "wctomb": {}, - "wcwidth": {}, - "write": {}, - "writev": {}, - "zero_struct_address": {}, + "_IO_putc": {}, + "___errno_location": {}, + "__assert_fail": {}, + "__builtin___memcpy_chk": {}, + "__builtin___memmove_chk": {}, + "__builtin___memset_chk": {}, + "__builtin___snprintf_chk": {}, + "__builtin___sprintf_chk": {}, + "__builtin___strcat_chk": {}, + "__builtin___strcpy_chk": {}, + "__builtin___strncpy_chk": {}, + "__builtin___vsnprintf_chk": {}, + "__builtin_abort": {}, + "__builtin_abs": {}, + "__builtin_add_overflowInt64": {}, + "__builtin_add_overflowUint32": {}, + "__builtin_add_overflowUint64": {}, + "__builtin_bswap16": {}, + "__builtin_bswap32": {}, + "__builtin_bswap64": {}, + "__builtin_clzll": {}, + "__builtin_constant_p_impl": {}, + "__builtin_copysign": {}, + "__builtin_copysignf": {}, + "__builtin_copysignl": {}, + "__builtin_exit": {}, + "__builtin_expect": {}, + "__builtin_fabs": {}, + "__builtin_free": {}, + "__builtin_huge_val": {}, + "__builtin_huge_valf": {}, + "__builtin_inf": {}, + "__builtin_infl": {}, + "__builtin_inff": {}, + "__builtin_isnan": {}, + "__builtin_malloc": {}, + "__builtin_memcmp": {}, + "__builtin_memcpy": {}, + "__builtin_memset": {}, + "__builtin_mmap": {}, + "__builtin_mul_overflowInt64": {}, + "__builtin_mul_overflowUint128": {}, + "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, + "__builtin_nanf": {}, + "__builtin_nanl": {}, + "__builtin_object_size": {}, + "__builtin_popcount": {}, + "__builtin_prefetch": {}, + "__builtin_printf": {}, + "__builtin_snprintf": {}, + "__builtin_sprintf": {}, + "__builtin_strchr": {}, + "__builtin_strcmp": {}, + "__builtin_strcpy": {}, + "__builtin_strlen": {}, + "__builtin_sub_overflowInt64": {}, + "__builtin_trap": {}, + "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, + "__ccgo_getMutexType": {}, + "__ccgo_in6addr_anyp": {}, + "__ccgo_pthreadAttrGetDetachState": {}, + "__ccgo_pthreadMutexattrGettype": {}, + "__ccgo_sqlite3_log": {}, + "__cmsg_nxthdr": {}, + "__ctype_b_loc": {}, + "__ctype_get_mb_cur_max": {}, + "__errno_location": {}, + "__floatscan": {}, + "__fpclassify": {}, + "__fpclassifyf": {}, + "__fpclassifyl": {}, + "__fsmu8": {}, + "__h_errno_location": {}, + "__inet_aton": {}, + "__intscan": {}, + "__isalnum_l": {}, + "__isalpha_l": {}, + "__isdigit_l": {}, + "__islower_l": {}, + "__isnan": {}, + "__isnanf": {}, + "__isnanl": {}, + "__isoc99_sscanf": {}, + "__isprint_l": {}, + "__isupper_l": {}, + "__isxdigit_l": {}, + "__lockfile": {}, + "__lookup_ipliteral": {}, + "__lookup_name": {}, + "__lookup_serv": {}, + "__shgetc": {}, + "__shlim": {}, + "__strncasecmp_l": {}, + "__syscall1": {}, + "__syscall3": {}, + "__syscall4": {}, + "__toread": {}, + "__toread_needs_stdio_exit": {}, + "__uflow": {}, + "__unlockfile": {}, + "_exit": {}, + "_obstack_begin": {}, + "_obstack_newchunk": {}, + "abort": {}, + "abs": {}, + "accept": {}, + "access": {}, + "acos": {}, + "acosh": {}, + "alarm": {}, + "asin": {}, + "asinh": {}, + "atan": {}, + "atan2": {}, + "atanh": {}, + "atexit": {}, + "atof": {}, + "atoi": {}, + "atol": {}, + "backtrace": {}, + "backtrace_symbols_fd": {}, + "bind": {}, + "calloc": {}, + "ceil": {}, + "ceilf": {}, + "cfgetospeed": {}, + "cfsetispeed": {}, + "cfsetospeed": {}, + "chdir": {}, + "chmod": {}, + "chown": {}, + "clock_gettime": {}, + "close": {}, + "closedir": {}, + "confstr": {}, + "connect": {}, + "copysign": {}, + "copysignf": {}, + "copysignl": {}, + "cos": {}, + "cosf": {}, + "cosh": {}, + "ctime": {}, + "ctime_r": {}, + "dlclose": {}, + "dlerror": {}, + "dlopen": {}, + "dlsym": {}, + "dup2": {}, + "endpwent": {}, + "environ": {}, + "execvp": {}, + "exit": {}, + "exp": {}, + "fabs": {}, + "fabsf": {}, + "fabsl": {}, + "fchmod": {}, + "fchown": {}, + "fclose": {}, + "fcntl": {}, + "fcntl64": {}, + "fdopen": {}, + "ferror": {}, + "fflush": {}, + "fgetc": {}, + "fgets": {}, + "fileno": {}, + "floor": {}, + "fmod": {}, + "fmodl": {}, + "fopen": {}, + "fopen64": {}, + "fork": {}, + "fprintf": {}, + "fputc": {}, + "fputs": {}, + "fread": {}, + "free": {}, + "freeaddrinfo": {}, + "frexp": {}, + "fscanf": {}, + "fseek": {}, + "fstat": {}, + "fstat64": {}, + "fsync": {}, + "ftell": {}, + "ftruncate": {}, + "ftruncate64": {}, + "fts64_close": {}, + "fts64_open": {}, + "fts64_read": {}, + "fts_close": {}, + "fts_open": {}, + "fts_read": {}, + "fwrite": {}, + "gai_strerror": {}, + "getaddrinfo": {}, + "getc": {}, + "getcwd": {}, + "getegid": {}, + "getenv": {}, + "geteuid": {}, + "getgid": {}, + "getgrgid": {}, + "getgrgid_r": {}, + "getgrnam": {}, + "getgrnam_r": {}, + "gethostbyaddr": {}, + "gethostbyaddr_r": {}, + "gethostbyname": {}, + "gethostbyname2": {}, + "gethostbyname2_r": {}, + "gethostbyname_r": {}, + "gethostname": {}, + "getnameinfo": {}, + "getpeername": {}, + "getpid": {}, + "getpwnam": {}, + "getpwnam_r": {}, + "getpwuid": {}, + "getpwuid_r": {}, + "getresgid": {}, + "getresuid": {}, + "getrlimit": {}, + "getrlimit64": {}, + "getrusage": {}, + "getservbyname": {}, + "getsockname": {}, + "getsockopt": {}, + "gettimeofday": {}, + "getuid": {}, + "gmtime_r": {}, + "h_errno": {}, + "htonl": {}, + "htons": {}, + "hypot": {}, + "inet_ntoa": {}, + "inet_ntop": {}, + "inet_pton": {}, + "initstate_r": {}, + "ioctl": {}, + "isalnum": {}, + "isalpha": {}, + "isatty": {}, + "isdigit": {}, + "islower": {}, + "isnan": {}, + "isnanf": {}, + "isnanl": {}, + "isprint": {}, + "isupper": {}, + "isxdigit": {}, + "kill": {}, + "ldexp": {}, + "link": {}, + "listen": {}, + "localtime": {}, + "localtime_r": {}, + "log": {}, + "log10": {}, + "lrand48": {}, + "lseek": {}, + "lseek64": {}, + "lstat": {}, + "lstat64": {}, + "malloc": {}, + "mblen": {}, + "mbrtowc": {}, + "mbsinit": {}, + "mbstowcs": {}, + "mbtowc": {}, + "memchr": {}, + "memcmp": {}, + "memcpy": {}, + "memmove": {}, + "memset": {}, + "mkdir": {}, + "mkfifo": {}, + "mknod": {}, + "mkstemp": {}, + "mkstemp64": {}, + "mkstemps": {}, + "mkstemps64": {}, + "mktime": {}, + "mmap": {}, + "mmap64": {}, + "modf": {}, + "mremap": {}, + "munmap": {}, + "nanf": {}, + "nl_langinfo": {}, + "ntohs": {}, + "obstack_free": {}, + "obstack_vprintf": {}, + "open": {}, + "open64": {}, + "opendir": {}, + "openpty": {}, + "pathconf": {}, + "pause": {}, + "pclose": {}, + "perror": {}, + "pipe": {}, + "poll": {}, + "popen": {}, + "posix_fadvise": {}, + "pow": {}, + "printf": {}, + "pselect": {}, + "pthread_attr_getdetachstate": {}, + "pthread_attr_setdetachstate": {}, + "pthread_mutexattr_destroy": {}, + "pthread_mutexattr_init": {}, + "pthread_mutexattr_settype": {}, + "putc": {}, + "putchar": {}, + "puts": {}, + "qsort": {}, + "raise": {}, + "rand": {}, + "rand_r": {}, + "random": {}, + "random_r": {}, + "read": {}, + "readdir": {}, + "readdir64": {}, + "readlink": {}, + "readv": {}, + "realloc": {}, + "realpath": {}, + "recv": {}, + "recvfrom": {}, + "recvmsg": {}, + "remove": {}, + "rename": {}, + "rewind": {}, + "rint": {}, + "rmdir": {}, + "round": {}, + "scalbn": {}, + "scalbnl": {}, + "sched_yield": {}, + "select": {}, + "send": {}, + "sendmsg": {}, + "sendto": {}, + "setbuf": {}, + "setenv": {}, + "setlocale": {}, + "setrlimit": {}, + "setrlimit64": {}, + "setsid": {}, + "setsockopt": {}, + "setvbuf": {}, + "shmat": {}, + "shmctl": {}, + "shmdt": {}, + "shutdown": {}, + "sigaction": {}, + "signal": {}, + "sin": {}, + "sinf": {}, + "sinh": {}, + "sleep": {}, + "snprintf": {}, + "socket": {}, + "sprintf": {}, + "sqrt": {}, + "srand48": {}, + "sscanf": {}, + "stat": {}, + "stat64": {}, + "stderr": {}, + "stdin": {}, + "stdout": {}, + "strcasecmp": {}, + "strcat": {}, + "strchr": {}, + "strcmp": {}, + "strcpy": {}, + "strcspn": {}, + "strdup": {}, + "strerror": {}, + "strlcat": {}, + "strlcpy": {}, + "strlen": {}, + "strncasecmp": {}, + "strncat": {}, + "strncmp": {}, + "strncpy": {}, + "strnlen": {}, + "strpbrk": {}, + "strrchr": {}, + "strspn": {}, + "strstr": {}, + "strtod": {}, + "strtof": {}, + "strtoimax": {}, + "strtok": {}, + "strtol": {}, + "strtold": {}, + "strtoll": {}, + "strtoul": {}, + "strtoull": {}, + "strtoumax": {}, + "symlink": {}, + "sysconf": {}, + "system": {}, + "tan": {}, + "tanh": {}, + "tcgetattr": {}, + "tcsendbreak": {}, + "tcsetattr": {}, + "time": {}, + "tolower": {}, + "toupper": {}, + "trunc": {}, + "tzset": {}, + "umask": {}, + "uname": {}, + "ungetc": {}, + "unlink": {}, + "unsetenv": {}, + "usleep": {}, + "utime": {}, + "utimes": {}, + "vasprintf": {}, + "vfprintf": {}, + "vfscanf": {}, + "vprintf": {}, + "vsnprintf": {}, + "vsprintf": {}, + "vsscanf": {}, + "waitpid": {}, + "wcschr": {}, + "wctomb": {}, + "wcwidth": {}, + "write": {}, + "writev": {}, + "zero_struct_address": {}, } diff --git a/vendor/modernc.org/libc/capi_linux_amd64.go b/vendor/modernc.org/libc/capi_linux_amd64.go index b5cf5643..ad26ce4f 100644 --- a/vendor/modernc.org/libc/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/capi_linux_amd64.go @@ -27,6 +27,7 @@ var CAPI = map[string]struct{}{ "__builtin_constant_p_impl": {}, "__builtin_copysign": {}, "__builtin_copysignf": {}, + "__builtin_copysignl": {}, "__builtin_exit": {}, "__builtin_expect": {}, "__builtin_fabs": {}, @@ -35,6 +36,7 @@ var CAPI = map[string]struct{}{ "__builtin_huge_valf": {}, "__builtin_inf": {}, "__builtin_inff": {}, + "__builtin_infl": {}, "__builtin_isnan": {}, "__builtin_malloc": {}, "__builtin_memcmp": {}, @@ -44,7 +46,9 @@ var CAPI = map[string]struct{}{ "__builtin_mul_overflowInt64": {}, "__builtin_mul_overflowUint128": {}, "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, "__builtin_nanf": {}, + "__builtin_nanl": {}, "__builtin_object_size": {}, "__builtin_popcount": {}, "__builtin_prefetch": {}, @@ -58,6 +62,7 @@ var CAPI = map[string]struct{}{ "__builtin_sub_overflowInt64": {}, "__builtin_trap": {}, "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, "__ccgo_getMutexType": {}, "__ccgo_in6addr_anyp": {}, "__ccgo_pthreadAttrGetDetachState": {}, @@ -344,6 +349,7 @@ var CAPI = map[string]struct{}{ "putc": {}, "putchar": {}, "puts": {}, + "pwrite": {}, "qsort": {}, "raise": {}, "rand": {}, @@ -363,6 +369,7 @@ var CAPI = map[string]struct{}{ "remove": {}, "rename": {}, "rewind": {}, + "rint": {}, "rmdir": {}, "round": {}, "scalbn": {}, diff --git a/vendor/modernc.org/libc/capi_linux_arm.go b/vendor/modernc.org/libc/capi_linux_arm.go index 23fe92c9..6b9bc30f 100644 --- a/vendor/modernc.org/libc/capi_linux_arm.go +++ b/vendor/modernc.org/libc/capi_linux_arm.go @@ -3,420 +3,447 @@ package libc // import "modernc.org/libc" var CAPI = map[string]struct{}{ - "_IO_putc": {}, - "___errno_location": {}, - "__assert_fail": {}, - "__builtin___memcpy_chk": {}, - "__builtin___memmove_chk": {}, - "__builtin___memset_chk": {}, - "__builtin___snprintf_chk": {}, - "__builtin___sprintf_chk": {}, - "__builtin___strcat_chk": {}, - "__builtin___strcpy_chk": {}, - "__builtin___strncpy_chk": {}, - "__builtin___vsnprintf_chk": {}, - "__builtin_abort": {}, - "__builtin_abs": {}, - "__builtin_add_overflowInt64": {}, - "__builtin_add_overflowUint32": {}, - "__builtin_add_overflowUint64": {}, - "__builtin_bswap16": {}, - "__builtin_bswap32": {}, - "__builtin_bswap64": {}, - "__builtin_clzll": {}, - "__builtin_constant_p_impl": {}, - "__builtin_copysign": {}, - "__builtin_copysignf": {}, - "__builtin_exit": {}, - "__builtin_expect": {}, - "__builtin_fabs": {}, - "__builtin_free": {}, - "__builtin_huge_val": {}, - "__builtin_huge_valf": {}, - "__builtin_inf": {}, - "__builtin_inff": {}, - "__builtin_isnan": {}, - "__builtin_malloc": {}, - "__builtin_memcmp": {}, - "__builtin_memcpy": {}, - "__builtin_memset": {}, - "__builtin_mmap": {}, - "__builtin_mul_overflowInt64": {}, - "__builtin_mul_overflowUint128": {}, - "__builtin_mul_overflowUint64": {}, - "__builtin_nanf": {}, - "__builtin_object_size": {}, - "__builtin_popcount": {}, - "__builtin_prefetch": {}, - "__builtin_printf": {}, - "__builtin_snprintf": {}, - "__builtin_sprintf": {}, - "__builtin_strchr": {}, - "__builtin_strcmp": {}, - "__builtin_strcpy": {}, - "__builtin_strlen": {}, - "__builtin_sub_overflowInt64": {}, - "__builtin_trap": {}, - "__builtin_unreachable": {}, - "__ccgo_in6addr_anyp": {}, - "__ccgo_sqlite3_log": {}, - "__cmsg_nxthdr": {}, - "__ctype_b_loc": {}, - "__ctype_get_mb_cur_max": {}, - "__errno_location": {}, - "__floatscan": {}, - "__fpclassify": {}, - "__fpclassifyf": {}, - "__fpclassifyl": {}, - "__h_errno_location": {}, - "__inet_aton": {}, - "__intscan": {}, - "__isalnum_l": {}, - "__isalpha_l": {}, - "__isdigit_l": {}, - "__islower_l": {}, - "__isnan": {}, - "__isnanf": {}, - "__isnanl": {}, - "__isoc99_sscanf": {}, - "__isprint_l": {}, - "__isupper_l": {}, - "__isxdigit_l": {}, - "__lookup_ipliteral": {}, - "__lookup_name": {}, - "__lookup_serv": {}, - "__shgetc": {}, - "__shlim": {}, - "__strncasecmp_l": {}, - "__syscall1": {}, - "__syscall3": {}, - "__toread": {}, - "__toread_needs_stdio_exit": {}, - "__uflow": {}, - "_exit": {}, - "_obstack_begin": {}, - "_obstack_newchunk": {}, - "abort": {}, - "abs": {}, - "accept": {}, - "access": {}, - "acos": {}, - "acosh": {}, - "alarm": {}, - "asin": {}, - "asinh": {}, - "atan": {}, - "atan2": {}, - "atanh": {}, - "atexit": {}, - "atof": {}, - "atoi": {}, - "atol": {}, - "backtrace": {}, - "backtrace_symbols_fd": {}, - "bind": {}, - "calloc": {}, - "ceil": {}, - "ceilf": {}, - "cfgetospeed": {}, - "cfsetispeed": {}, - "cfsetospeed": {}, - "chdir": {}, - "chmod": {}, - "chown": {}, - "clock_gettime": {}, - "close": {}, - "closedir": {}, - "confstr": {}, - "connect": {}, - "copysign": {}, - "copysignf": {}, - "copysignl": {}, - "cos": {}, - "cosf": {}, - "cosh": {}, - "ctime": {}, - "dlclose": {}, - "dlerror": {}, - "dlopen": {}, - "dlsym": {}, - "dup2": {}, - "endpwent": {}, - "environ": {}, - "execvp": {}, - "exit": {}, - "exp": {}, - "fabs": {}, - "fabsf": {}, - "fabsl": {}, - "fchmod": {}, - "fchown": {}, - "fclose": {}, - "fcntl": {}, - "fcntl64": {}, - "fdopen": {}, - "ferror": {}, - "fflush": {}, - "fgetc": {}, - "fgets": {}, - "fileno": {}, - "floor": {}, - "fmod": {}, - "fmodl": {}, - "fopen": {}, - "fopen64": {}, - "fork": {}, - "fprintf": {}, - "fputc": {}, - "fputs": {}, - "fread": {}, - "free": {}, - "freeaddrinfo": {}, - "frexp": {}, - "fscanf": {}, - "fseek": {}, - "fstat": {}, - "fstat64": {}, - "fsync": {}, - "ftell": {}, - "ftruncate": {}, - "ftruncate64": {}, - "fts64_close": {}, - "fts64_open": {}, - "fts64_read": {}, - "fts_close": {}, - "fts_open": {}, - "fts_read": {}, - "fwrite": {}, - "gai_strerror": {}, - "getaddrinfo": {}, - "getc": {}, - "getcwd": {}, - "getegid": {}, - "getenv": {}, - "geteuid": {}, - "getgid": {}, - "getgrgid": {}, - "getgrnam": {}, - "gethostbyaddr": {}, - "gethostbyaddr_r": {}, - "gethostbyname": {}, - "gethostbyname2": {}, - "gethostbyname2_r": {}, - "gethostname": {}, - "getnameinfo": {}, - "getpeername": {}, - "getpid": {}, - "getpwnam": {}, - "getpwnam_r": {}, - "getpwuid": {}, - "getpwuid_r": {}, - "getresgid": {}, - "getresuid": {}, - "getrlimit": {}, - "getrlimit64": {}, - "getrusage": {}, - "getservbyname": {}, - "getsockname": {}, - "getsockopt": {}, - "gettimeofday": {}, - "getuid": {}, - "gmtime_r": {}, - "h_errno": {}, - "htonl": {}, - "htons": {}, - "hypot": {}, - "inet_ntoa": {}, - "inet_ntop": {}, - "inet_pton": {}, - "initstate_r": {}, - "ioctl": {}, - "isalnum": {}, - "isalpha": {}, - "isatty": {}, - "isdigit": {}, - "islower": {}, - "isnan": {}, - "isnanf": {}, - "isnanl": {}, - "isprint": {}, - "isupper": {}, - "isxdigit": {}, - "kill": {}, - "ldexp": {}, - "link": {}, - "listen": {}, - "localtime": {}, - "localtime_r": {}, - "log": {}, - "log10": {}, - "lrand48": {}, - "lseek": {}, - "lseek64": {}, - "lstat": {}, - "lstat64": {}, - "malloc": {}, - "mblen": {}, - "mbstowcs": {}, - "mbtowc": {}, - "memchr": {}, - "memcmp": {}, - "memcpy": {}, - "memmove": {}, - "memset": {}, - "mkdir": {}, - "mkfifo": {}, - "mknod": {}, - "mkstemp": {}, - "mkstemp64": {}, - "mkstemps": {}, - "mkstemps64": {}, - "mktime": {}, - "mmap": {}, - "mmap64": {}, - "modf": {}, - "mremap": {}, - "munmap": {}, - "nanf": {}, - "nl_langinfo": {}, - "ntohs": {}, - "obstack_free": {}, - "obstack_vprintf": {}, - "open": {}, - "open64": {}, - "opendir": {}, - "openpty": {}, - "pathconf": {}, - "pause": {}, - "pclose": {}, - "perror": {}, - "pipe": {}, - "poll": {}, - "popen": {}, - "posix_fadvise": {}, - "pow": {}, - "printf": {}, - "pselect": {}, - "putc": {}, - "putchar": {}, - "puts": {}, - "qsort": {}, - "raise": {}, - "rand": {}, - "rand_r": {}, - "random": {}, - "random_r": {}, - "read": {}, - "readdir": {}, - "readdir64": {}, - "readlink": {}, - "readv": {}, - "realloc": {}, - "realpath": {}, - "recv": {}, - "recvfrom": {}, - "recvmsg": {}, - "remove": {}, - "rename": {}, - "rewind": {}, - "rmdir": {}, - "round": {}, - "scalbn": {}, - "scalbnl": {}, - "select": {}, - "send": {}, - "sendmsg": {}, - "sendto": {}, - "setbuf": {}, - "setenv": {}, - "setlocale": {}, - "setrlimit": {}, - "setrlimit64": {}, - "setsid": {}, - "setsockopt": {}, - "setvbuf": {}, - "shmat": {}, - "shmctl": {}, - "shmdt": {}, - "shutdown": {}, - "sigaction": {}, - "signal": {}, - "sin": {}, - "sinf": {}, - "sinh": {}, - "sleep": {}, - "snprintf": {}, - "socket": {}, - "sprintf": {}, - "sqrt": {}, - "srand48": {}, - "sscanf": {}, - "stat": {}, - "stat64": {}, - "stderr": {}, - "stdin": {}, - "stdout": {}, - "strcasecmp": {}, - "strcat": {}, - "strchr": {}, - "strcmp": {}, - "strcpy": {}, - "strcspn": {}, - "strdup": {}, - "strerror": {}, - "strlcat": {}, - "strlcpy": {}, - "strlen": {}, - "strncasecmp": {}, - "strncat": {}, - "strncmp": {}, - "strncpy": {}, - "strnlen": {}, - "strpbrk": {}, - "strrchr": {}, - "strspn": {}, - "strstr": {}, - "strtod": {}, - "strtof": {}, - "strtoimax": {}, - "strtok": {}, - "strtol": {}, - "strtold": {}, - "strtoll": {}, - "strtoul": {}, - "strtoull": {}, - "strtoumax": {}, - "symlink": {}, - "sysconf": {}, - "system": {}, - "tan": {}, - "tanh": {}, - "tcgetattr": {}, - "tcsendbreak": {}, - "tcsetattr": {}, - "time": {}, - "tolower": {}, - "toupper": {}, - "trunc": {}, - "tzset": {}, - "umask": {}, - "uname": {}, - "ungetc": {}, - "unlink": {}, - "unsetenv": {}, - "usleep": {}, - "utime": {}, - "utimes": {}, - "vasprintf": {}, - "vfprintf": {}, - "vprintf": {}, - "vsnprintf": {}, - "vsprintf": {}, - "waitpid": {}, - "wcschr": {}, - "wctomb": {}, - "wcwidth": {}, - "write": {}, - "writev": {}, - "zero_struct_address": {}, + "_IO_putc": {}, + "___errno_location": {}, + "__assert_fail": {}, + "__builtin___memcpy_chk": {}, + "__builtin___memmove_chk": {}, + "__builtin___memset_chk": {}, + "__builtin___snprintf_chk": {}, + "__builtin___sprintf_chk": {}, + "__builtin___strcat_chk": {}, + "__builtin___strcpy_chk": {}, + "__builtin___strncpy_chk": {}, + "__builtin___vsnprintf_chk": {}, + "__builtin_abort": {}, + "__builtin_abs": {}, + "__builtin_add_overflowInt64": {}, + "__builtin_add_overflowUint32": {}, + "__builtin_add_overflowUint64": {}, + "__builtin_bswap16": {}, + "__builtin_bswap32": {}, + "__builtin_bswap64": {}, + "__builtin_clzll": {}, + "__builtin_constant_p_impl": {}, + "__builtin_copysign": {}, + "__builtin_copysignf": {}, + "__builtin_copysignl": {}, + "__builtin_exit": {}, + "__builtin_expect": {}, + "__builtin_fabs": {}, + "__builtin_free": {}, + "__builtin_huge_val": {}, + "__builtin_huge_valf": {}, + "__builtin_inf": {}, + "__builtin_infl": {}, + "__builtin_inff": {}, + "__builtin_isnan": {}, + "__builtin_malloc": {}, + "__builtin_memcmp": {}, + "__builtin_memcpy": {}, + "__builtin_memset": {}, + "__builtin_mmap": {}, + "__builtin_mul_overflowInt64": {}, + "__builtin_mul_overflowUint128": {}, + "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, + "__builtin_nanf": {}, + "__builtin_nanl": {}, + "__builtin_object_size": {}, + "__builtin_popcount": {}, + "__builtin_prefetch": {}, + "__builtin_printf": {}, + "__builtin_snprintf": {}, + "__builtin_sprintf": {}, + "__builtin_strchr": {}, + "__builtin_strcmp": {}, + "__builtin_strcpy": {}, + "__builtin_strlen": {}, + "__builtin_sub_overflowInt64": {}, + "__builtin_trap": {}, + "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, + "__ccgo_getMutexType": {}, + "__ccgo_in6addr_anyp": {}, + "__ccgo_pthreadAttrGetDetachState": {}, + "__ccgo_pthreadMutexattrGettype": {}, + "__ccgo_sqlite3_log": {}, + "__cmsg_nxthdr": {}, + "__ctype_b_loc": {}, + "__ctype_get_mb_cur_max": {}, + "__errno_location": {}, + "__floatscan": {}, + "__fpclassify": {}, + "__fpclassifyf": {}, + "__fpclassifyl": {}, + "__fsmu8": {}, + "__h_errno_location": {}, + "__inet_aton": {}, + "__intscan": {}, + "__isalnum_l": {}, + "__isalpha_l": {}, + "__isdigit_l": {}, + "__islower_l": {}, + "__isnan": {}, + "__isnanf": {}, + "__isnanl": {}, + "__isoc99_sscanf": {}, + "__isprint_l": {}, + "__isupper_l": {}, + "__isxdigit_l": {}, + "__lockfile": {}, + "__lookup_ipliteral": {}, + "__lookup_name": {}, + "__lookup_serv": {}, + "__shgetc": {}, + "__shlim": {}, + "__strncasecmp_l": {}, + "__syscall1": {}, + "__syscall3": {}, + "__syscall4": {}, + "__toread": {}, + "__toread_needs_stdio_exit": {}, + "__uflow": {}, + "__unlockfile": {}, + "_exit": {}, + "_obstack_begin": {}, + "_obstack_newchunk": {}, + "abort": {}, + "abs": {}, + "accept": {}, + "access": {}, + "acos": {}, + "acosh": {}, + "alarm": {}, + "asin": {}, + "asinh": {}, + "atan": {}, + "atan2": {}, + "atanh": {}, + "atexit": {}, + "atof": {}, + "atoi": {}, + "atol": {}, + "backtrace": {}, + "backtrace_symbols_fd": {}, + "bind": {}, + "calloc": {}, + "ceil": {}, + "ceilf": {}, + "cfgetospeed": {}, + "cfsetispeed": {}, + "cfsetospeed": {}, + "chdir": {}, + "chmod": {}, + "chown": {}, + "clock_gettime": {}, + "close": {}, + "closedir": {}, + "confstr": {}, + "connect": {}, + "copysign": {}, + "copysignf": {}, + "copysignl": {}, + "cos": {}, + "cosf": {}, + "cosh": {}, + "ctime": {}, + "ctime_r": {}, + "dlclose": {}, + "dlerror": {}, + "dlopen": {}, + "dlsym": {}, + "dup2": {}, + "endpwent": {}, + "environ": {}, + "execvp": {}, + "exit": {}, + "exp": {}, + "fabs": {}, + "fabsf": {}, + "fabsl": {}, + "fchmod": {}, + "fchown": {}, + "fclose": {}, + "fcntl": {}, + "fcntl64": {}, + "fdopen": {}, + "ferror": {}, + "fflush": {}, + "fgetc": {}, + "fgets": {}, + "fileno": {}, + "floor": {}, + "fmod": {}, + "fmodl": {}, + "fopen": {}, + "fopen64": {}, + "fork": {}, + "fprintf": {}, + "fputc": {}, + "fputs": {}, + "fread": {}, + "free": {}, + "freeaddrinfo": {}, + "frexp": {}, + "fscanf": {}, + "fseek": {}, + "fstat": {}, + "fstat64": {}, + "fsync": {}, + "ftell": {}, + "ftruncate": {}, + "ftruncate64": {}, + "fts64_close": {}, + "fts64_open": {}, + "fts64_read": {}, + "fts_close": {}, + "fts_open": {}, + "fts_read": {}, + "fwrite": {}, + "gai_strerror": {}, + "getaddrinfo": {}, + "getc": {}, + "getcwd": {}, + "getegid": {}, + "getenv": {}, + "geteuid": {}, + "getgid": {}, + "getgrgid": {}, + "getgrgid_r": {}, + "getgrnam": {}, + "getgrnam_r": {}, + "gethostbyaddr": {}, + "gethostbyaddr_r": {}, + "gethostbyname": {}, + "gethostbyname2": {}, + "gethostbyname2_r": {}, + "gethostbyname_r": {}, + "gethostname": {}, + "getnameinfo": {}, + "getpeername": {}, + "getpid": {}, + "getpwnam": {}, + "getpwnam_r": {}, + "getpwuid": {}, + "getpwuid_r": {}, + "getresgid": {}, + "getresuid": {}, + "getrlimit": {}, + "getrlimit64": {}, + "getrusage": {}, + "getservbyname": {}, + "getsockname": {}, + "getsockopt": {}, + "gettimeofday": {}, + "getuid": {}, + "gmtime_r": {}, + "h_errno": {}, + "htonl": {}, + "htons": {}, + "hypot": {}, + "inet_ntoa": {}, + "inet_ntop": {}, + "inet_pton": {}, + "initstate_r": {}, + "ioctl": {}, + "isalnum": {}, + "isalpha": {}, + "isatty": {}, + "isdigit": {}, + "islower": {}, + "isnan": {}, + "isnanf": {}, + "isnanl": {}, + "isprint": {}, + "isupper": {}, + "isxdigit": {}, + "kill": {}, + "ldexp": {}, + "link": {}, + "listen": {}, + "localtime": {}, + "localtime_r": {}, + "log": {}, + "log10": {}, + "lrand48": {}, + "lseek": {}, + "lseek64": {}, + "lstat": {}, + "lstat64": {}, + "malloc": {}, + "mblen": {}, + "mbrtowc": {}, + "mbsinit": {}, + "mbstowcs": {}, + "mbtowc": {}, + "memchr": {}, + "memcmp": {}, + "memcpy": {}, + "memmove": {}, + "memset": {}, + "mkdir": {}, + "mkfifo": {}, + "mknod": {}, + "mkstemp": {}, + "mkstemp64": {}, + "mkstemps": {}, + "mkstemps64": {}, + "mktime": {}, + "mmap": {}, + "mmap64": {}, + "modf": {}, + "mremap": {}, + "munmap": {}, + "nanf": {}, + "nl_langinfo": {}, + "ntohs": {}, + "obstack_free": {}, + "obstack_vprintf": {}, + "open": {}, + "open64": {}, + "opendir": {}, + "openpty": {}, + "pathconf": {}, + "pause": {}, + "pclose": {}, + "perror": {}, + "pipe": {}, + "poll": {}, + "popen": {}, + "posix_fadvise": {}, + "pow": {}, + "printf": {}, + "pselect": {}, + "pthread_attr_getdetachstate": {}, + "pthread_attr_setdetachstate": {}, + "pthread_mutexattr_destroy": {}, + "pthread_mutexattr_init": {}, + "pthread_mutexattr_settype": {}, + "putc": {}, + "putchar": {}, + "puts": {}, + "qsort": {}, + "raise": {}, + "rand": {}, + "rand_r": {}, + "random": {}, + "random_r": {}, + "read": {}, + "readdir": {}, + "readdir64": {}, + "readlink": {}, + "readv": {}, + "realloc": {}, + "realpath": {}, + "recv": {}, + "recvfrom": {}, + "recvmsg": {}, + "remove": {}, + "rename": {}, + "rewind": {}, + "rint": {}, + "rmdir": {}, + "round": {}, + "scalbn": {}, + "scalbnl": {}, + "sched_yield": {}, + "select": {}, + "send": {}, + "sendmsg": {}, + "sendto": {}, + "setbuf": {}, + "setenv": {}, + "setlocale": {}, + "setrlimit": {}, + "setrlimit64": {}, + "setsid": {}, + "setsockopt": {}, + "setvbuf": {}, + "shmat": {}, + "shmctl": {}, + "shmdt": {}, + "shutdown": {}, + "sigaction": {}, + "signal": {}, + "sin": {}, + "sinf": {}, + "sinh": {}, + "sleep": {}, + "snprintf": {}, + "socket": {}, + "sprintf": {}, + "sqrt": {}, + "srand48": {}, + "sscanf": {}, + "stat": {}, + "stat64": {}, + "stderr": {}, + "stdin": {}, + "stdout": {}, + "strcasecmp": {}, + "strcat": {}, + "strchr": {}, + "strcmp": {}, + "strcpy": {}, + "strcspn": {}, + "strdup": {}, + "strerror": {}, + "strlcat": {}, + "strlcpy": {}, + "strlen": {}, + "strncasecmp": {}, + "strncat": {}, + "strncmp": {}, + "strncpy": {}, + "strnlen": {}, + "strpbrk": {}, + "strrchr": {}, + "strspn": {}, + "strstr": {}, + "strtod": {}, + "strtof": {}, + "strtoimax": {}, + "strtok": {}, + "strtol": {}, + "strtold": {}, + "strtoll": {}, + "strtoul": {}, + "strtoull": {}, + "strtoumax": {}, + "symlink": {}, + "sysconf": {}, + "system": {}, + "tan": {}, + "tanh": {}, + "tcgetattr": {}, + "tcsendbreak": {}, + "tcsetattr": {}, + "time": {}, + "tolower": {}, + "toupper": {}, + "trunc": {}, + "tzset": {}, + "umask": {}, + "uname": {}, + "ungetc": {}, + "unlink": {}, + "unsetenv": {}, + "usleep": {}, + "utime": {}, + "utimes": {}, + "vasprintf": {}, + "vfprintf": {}, + "vfscanf": {}, + "vprintf": {}, + "vsnprintf": {}, + "vsprintf": {}, + "vsscanf": {}, + "waitpid": {}, + "wcschr": {}, + "wctomb": {}, + "wcwidth": {}, + "write": {}, + "writev": {}, + "zero_struct_address": {}, } diff --git a/vendor/modernc.org/libc/capi_linux_arm64.go b/vendor/modernc.org/libc/capi_linux_arm64.go index 26ac0b6f..6b9bc30f 100644 --- a/vendor/modernc.org/libc/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/capi_linux_arm64.go @@ -3,428 +3,447 @@ package libc // import "modernc.org/libc" var CAPI = map[string]struct{}{ - "_IO_putc": {}, - "___errno_location": {}, - "__assert_fail": {}, - "__builtin___memcpy_chk": {}, - "__builtin___memmove_chk": {}, - "__builtin___memset_chk": {}, - "__builtin___snprintf_chk": {}, - "__builtin___sprintf_chk": {}, - "__builtin___strcat_chk": {}, - "__builtin___strcpy_chk": {}, - "__builtin___strncpy_chk": {}, - "__builtin___vsnprintf_chk": {}, - "__builtin_abort": {}, - "__builtin_abs": {}, - "__builtin_add_overflowInt64": {}, - "__builtin_add_overflowUint32": {}, - "__builtin_add_overflowUint64": {}, - "__builtin_bswap16": {}, - "__builtin_bswap32": {}, - "__builtin_bswap64": {}, - "__builtin_clzll": {}, - "__builtin_constant_p_impl": {}, - "__builtin_copysign": {}, - "__builtin_copysignf": {}, - "__builtin_exit": {}, - "__builtin_expect": {}, - "__builtin_fabs": {}, - "__builtin_free": {}, - "__builtin_huge_val": {}, - "__builtin_huge_valf": {}, - "__builtin_inf": {}, - "__builtin_inff": {}, - "__builtin_isnan": {}, - "__builtin_malloc": {}, - "__builtin_memcmp": {}, - "__builtin_memcpy": {}, - "__builtin_memset": {}, - "__builtin_mmap": {}, - "__builtin_mul_overflowInt64": {}, - "__builtin_mul_overflowUint128": {}, - "__builtin_mul_overflowUint64": {}, - "__builtin_nanf": {}, - "__builtin_object_size": {}, - "__builtin_popcount": {}, - "__builtin_prefetch": {}, - "__builtin_printf": {}, - "__builtin_snprintf": {}, - "__builtin_sprintf": {}, - "__builtin_strchr": {}, - "__builtin_strcmp": {}, - "__builtin_strcpy": {}, - "__builtin_strlen": {}, - "__builtin_sub_overflowInt64": {}, - "__builtin_trap": {}, - "__builtin_unreachable": {}, - "__ccgo_in6addr_anyp": {}, - "__ccgo_sqlite3_log": {}, - "__cmsg_nxthdr": {}, - "__ctype_b_loc": {}, - "__ctype_get_mb_cur_max": {}, - "__errno_location": {}, - "__floatscan": {}, - "__fpclassify": {}, - "__fpclassifyf": {}, - "__fpclassifyl": {}, - "__fsmu8": {}, - "__h_errno_location": {}, - "__inet_aton": {}, - "__intscan": {}, - "__isalnum_l": {}, - "__isalpha_l": {}, - "__isdigit_l": {}, - "__islower_l": {}, - "__isnan": {}, - "__isnanf": {}, - "__isnanl": {}, - "__isoc99_sscanf": {}, - "__isprint_l": {}, - "__isupper_l": {}, - "__isxdigit_l": {}, - "__lockfile": {}, - "__lookup_ipliteral": {}, - "__lookup_name": {}, - "__lookup_serv": {}, - "__shgetc": {}, - "__shlim": {}, - "__strncasecmp_l": {}, - "__syscall1": {}, - "__syscall3": {}, - "__syscall4": {}, - "__toread": {}, - "__toread_needs_stdio_exit": {}, - "__uflow": {}, - "__unlockfile": {}, - "_exit": {}, - "_obstack_begin": {}, - "_obstack_newchunk": {}, - "abort": {}, - "abs": {}, - "accept": {}, - "access": {}, - "acos": {}, - "acosh": {}, - "alarm": {}, - "asin": {}, - "asinh": {}, - "atan": {}, - "atan2": {}, - "atanh": {}, - "atexit": {}, - "atof": {}, - "atoi": {}, - "atol": {}, - "backtrace": {}, - "backtrace_symbols_fd": {}, - "bind": {}, - "calloc": {}, - "ceil": {}, - "ceilf": {}, - "cfgetospeed": {}, - "cfsetispeed": {}, - "cfsetospeed": {}, - "chdir": {}, - "chmod": {}, - "chown": {}, - "clock_gettime": {}, - "close": {}, - "closedir": {}, - "confstr": {}, - "connect": {}, - "copysign": {}, - "copysignf": {}, - "copysignl": {}, - "cos": {}, - "cosf": {}, - "cosh": {}, - "ctime": {}, - "dlclose": {}, - "dlerror": {}, - "dlopen": {}, - "dlsym": {}, - "dup2": {}, - "endpwent": {}, - "environ": {}, - "execvp": {}, - "exit": {}, - "exp": {}, - "fabs": {}, - "fabsf": {}, - "fabsl": {}, - "fchmod": {}, - "fchown": {}, - "fclose": {}, - "fcntl": {}, - "fcntl64": {}, - "fdopen": {}, - "ferror": {}, - "fflush": {}, - "fgetc": {}, - "fgets": {}, - "fileno": {}, - "floor": {}, - "fmod": {}, - "fmodl": {}, - "fopen": {}, - "fopen64": {}, - "fork": {}, - "fprintf": {}, - "fputc": {}, - "fputs": {}, - "fread": {}, - "free": {}, - "freeaddrinfo": {}, - "frexp": {}, - "fscanf": {}, - "fseek": {}, - "fstat": {}, - "fstat64": {}, - "fsync": {}, - "ftell": {}, - "ftruncate": {}, - "ftruncate64": {}, - "fts64_close": {}, - "fts64_open": {}, - "fts64_read": {}, - "fts_close": {}, - "fts_open": {}, - "fts_read": {}, - "fwrite": {}, - "gai_strerror": {}, - "getaddrinfo": {}, - "getc": {}, - "getcwd": {}, - "getegid": {}, - "getenv": {}, - "geteuid": {}, - "getgid": {}, - "getgrgid": {}, - "getgrnam": {}, - "gethostbyaddr": {}, - "gethostbyaddr_r": {}, - "gethostbyname": {}, - "gethostbyname2": {}, - "gethostbyname2_r": {}, - "gethostname": {}, - "getnameinfo": {}, - "getpeername": {}, - "getpid": {}, - "getpwnam": {}, - "getpwnam_r": {}, - "getpwuid": {}, - "getpwuid_r": {}, - "getresgid": {}, - "getresuid": {}, - "getrlimit": {}, - "getrlimit64": {}, - "getrusage": {}, - "getservbyname": {}, - "getsockname": {}, - "getsockopt": {}, - "gettimeofday": {}, - "getuid": {}, - "gmtime_r": {}, - "h_errno": {}, - "htonl": {}, - "htons": {}, - "hypot": {}, - "inet_ntoa": {}, - "inet_ntop": {}, - "inet_pton": {}, - "initstate_r": {}, - "ioctl": {}, - "isalnum": {}, - "isalpha": {}, - "isatty": {}, - "isdigit": {}, - "islower": {}, - "isnan": {}, - "isnanf": {}, - "isnanl": {}, - "isprint": {}, - "isupper": {}, - "isxdigit": {}, - "kill": {}, - "ldexp": {}, - "link": {}, - "listen": {}, - "localtime": {}, - "localtime_r": {}, - "log": {}, - "log10": {}, - "lrand48": {}, - "lseek": {}, - "lseek64": {}, - "lstat": {}, - "lstat64": {}, - "malloc": {}, - "mblen": {}, - "mbrtowc": {}, - "mbsinit": {}, - "mbstowcs": {}, - "mbtowc": {}, - "memchr": {}, - "memcmp": {}, - "memcpy": {}, - "memmove": {}, - "memset": {}, - "mkdir": {}, - "mkfifo": {}, - "mknod": {}, - "mkstemp": {}, - "mkstemp64": {}, - "mkstemps": {}, - "mkstemps64": {}, - "mktime": {}, - "mmap": {}, - "mmap64": {}, - "modf": {}, - "mremap": {}, - "munmap": {}, - "nanf": {}, - "nl_langinfo": {}, - "ntohs": {}, - "obstack_free": {}, - "obstack_vprintf": {}, - "open": {}, - "open64": {}, - "opendir": {}, - "openpty": {}, - "pathconf": {}, - "pause": {}, - "pclose": {}, - "perror": {}, - "pipe": {}, - "poll": {}, - "popen": {}, - "posix_fadvise": {}, - "pow": {}, - "printf": {}, - "pselect": {}, - "putc": {}, - "putchar": {}, - "puts": {}, - "qsort": {}, - "raise": {}, - "rand": {}, - "rand_r": {}, - "random": {}, - "random_r": {}, - "read": {}, - "readdir": {}, - "readdir64": {}, - "readlink": {}, - "readv": {}, - "realloc": {}, - "realpath": {}, - "recv": {}, - "recvfrom": {}, - "recvmsg": {}, - "remove": {}, - "rename": {}, - "rewind": {}, - "rmdir": {}, - "round": {}, - "scalbn": {}, - "scalbnl": {}, - "select": {}, - "send": {}, - "sendmsg": {}, - "sendto": {}, - "setbuf": {}, - "setenv": {}, - "setlocale": {}, - "setrlimit": {}, - "setrlimit64": {}, - "setsid": {}, - "setsockopt": {}, - "setvbuf": {}, - "shmat": {}, - "shmctl": {}, - "shmdt": {}, - "shutdown": {}, - "sigaction": {}, - "signal": {}, - "sin": {}, - "sinf": {}, - "sinh": {}, - "sleep": {}, - "snprintf": {}, - "socket": {}, - "sprintf": {}, - "sqrt": {}, - "srand48": {}, - "sscanf": {}, - "stat": {}, - "stat64": {}, - "stderr": {}, - "stdin": {}, - "stdout": {}, - "strcasecmp": {}, - "strcat": {}, - "strchr": {}, - "strcmp": {}, - "strcpy": {}, - "strcspn": {}, - "strdup": {}, - "strerror": {}, - "strlcat": {}, - "strlcpy": {}, - "strlen": {}, - "strncasecmp": {}, - "strncat": {}, - "strncmp": {}, - "strncpy": {}, - "strnlen": {}, - "strpbrk": {}, - "strrchr": {}, - "strspn": {}, - "strstr": {}, - "strtod": {}, - "strtof": {}, - "strtoimax": {}, - "strtok": {}, - "strtol": {}, - "strtold": {}, - "strtoll": {}, - "strtoul": {}, - "strtoull": {}, - "strtoumax": {}, - "symlink": {}, - "sysconf": {}, - "system": {}, - "tan": {}, - "tanh": {}, - "tcgetattr": {}, - "tcsendbreak": {}, - "tcsetattr": {}, - "time": {}, - "tolower": {}, - "toupper": {}, - "trunc": {}, - "tzset": {}, - "umask": {}, - "uname": {}, - "ungetc": {}, - "unlink": {}, - "unsetenv": {}, - "usleep": {}, - "utime": {}, - "utimes": {}, - "vasprintf": {}, - "vfprintf": {}, - "vfscanf": {}, - "vprintf": {}, - "vsnprintf": {}, - "vsprintf": {}, - "vsscanf": {}, - "waitpid": {}, - "wcschr": {}, - "wctomb": {}, - "wcwidth": {}, - "write": {}, - "writev": {}, - "zero_struct_address": {}, + "_IO_putc": {}, + "___errno_location": {}, + "__assert_fail": {}, + "__builtin___memcpy_chk": {}, + "__builtin___memmove_chk": {}, + "__builtin___memset_chk": {}, + "__builtin___snprintf_chk": {}, + "__builtin___sprintf_chk": {}, + "__builtin___strcat_chk": {}, + "__builtin___strcpy_chk": {}, + "__builtin___strncpy_chk": {}, + "__builtin___vsnprintf_chk": {}, + "__builtin_abort": {}, + "__builtin_abs": {}, + "__builtin_add_overflowInt64": {}, + "__builtin_add_overflowUint32": {}, + "__builtin_add_overflowUint64": {}, + "__builtin_bswap16": {}, + "__builtin_bswap32": {}, + "__builtin_bswap64": {}, + "__builtin_clzll": {}, + "__builtin_constant_p_impl": {}, + "__builtin_copysign": {}, + "__builtin_copysignf": {}, + "__builtin_copysignl": {}, + "__builtin_exit": {}, + "__builtin_expect": {}, + "__builtin_fabs": {}, + "__builtin_free": {}, + "__builtin_huge_val": {}, + "__builtin_huge_valf": {}, + "__builtin_inf": {}, + "__builtin_infl": {}, + "__builtin_inff": {}, + "__builtin_isnan": {}, + "__builtin_malloc": {}, + "__builtin_memcmp": {}, + "__builtin_memcpy": {}, + "__builtin_memset": {}, + "__builtin_mmap": {}, + "__builtin_mul_overflowInt64": {}, + "__builtin_mul_overflowUint128": {}, + "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, + "__builtin_nanf": {}, + "__builtin_nanl": {}, + "__builtin_object_size": {}, + "__builtin_popcount": {}, + "__builtin_prefetch": {}, + "__builtin_printf": {}, + "__builtin_snprintf": {}, + "__builtin_sprintf": {}, + "__builtin_strchr": {}, + "__builtin_strcmp": {}, + "__builtin_strcpy": {}, + "__builtin_strlen": {}, + "__builtin_sub_overflowInt64": {}, + "__builtin_trap": {}, + "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, + "__ccgo_getMutexType": {}, + "__ccgo_in6addr_anyp": {}, + "__ccgo_pthreadAttrGetDetachState": {}, + "__ccgo_pthreadMutexattrGettype": {}, + "__ccgo_sqlite3_log": {}, + "__cmsg_nxthdr": {}, + "__ctype_b_loc": {}, + "__ctype_get_mb_cur_max": {}, + "__errno_location": {}, + "__floatscan": {}, + "__fpclassify": {}, + "__fpclassifyf": {}, + "__fpclassifyl": {}, + "__fsmu8": {}, + "__h_errno_location": {}, + "__inet_aton": {}, + "__intscan": {}, + "__isalnum_l": {}, + "__isalpha_l": {}, + "__isdigit_l": {}, + "__islower_l": {}, + "__isnan": {}, + "__isnanf": {}, + "__isnanl": {}, + "__isoc99_sscanf": {}, + "__isprint_l": {}, + "__isupper_l": {}, + "__isxdigit_l": {}, + "__lockfile": {}, + "__lookup_ipliteral": {}, + "__lookup_name": {}, + "__lookup_serv": {}, + "__shgetc": {}, + "__shlim": {}, + "__strncasecmp_l": {}, + "__syscall1": {}, + "__syscall3": {}, + "__syscall4": {}, + "__toread": {}, + "__toread_needs_stdio_exit": {}, + "__uflow": {}, + "__unlockfile": {}, + "_exit": {}, + "_obstack_begin": {}, + "_obstack_newchunk": {}, + "abort": {}, + "abs": {}, + "accept": {}, + "access": {}, + "acos": {}, + "acosh": {}, + "alarm": {}, + "asin": {}, + "asinh": {}, + "atan": {}, + "atan2": {}, + "atanh": {}, + "atexit": {}, + "atof": {}, + "atoi": {}, + "atol": {}, + "backtrace": {}, + "backtrace_symbols_fd": {}, + "bind": {}, + "calloc": {}, + "ceil": {}, + "ceilf": {}, + "cfgetospeed": {}, + "cfsetispeed": {}, + "cfsetospeed": {}, + "chdir": {}, + "chmod": {}, + "chown": {}, + "clock_gettime": {}, + "close": {}, + "closedir": {}, + "confstr": {}, + "connect": {}, + "copysign": {}, + "copysignf": {}, + "copysignl": {}, + "cos": {}, + "cosf": {}, + "cosh": {}, + "ctime": {}, + "ctime_r": {}, + "dlclose": {}, + "dlerror": {}, + "dlopen": {}, + "dlsym": {}, + "dup2": {}, + "endpwent": {}, + "environ": {}, + "execvp": {}, + "exit": {}, + "exp": {}, + "fabs": {}, + "fabsf": {}, + "fabsl": {}, + "fchmod": {}, + "fchown": {}, + "fclose": {}, + "fcntl": {}, + "fcntl64": {}, + "fdopen": {}, + "ferror": {}, + "fflush": {}, + "fgetc": {}, + "fgets": {}, + "fileno": {}, + "floor": {}, + "fmod": {}, + "fmodl": {}, + "fopen": {}, + "fopen64": {}, + "fork": {}, + "fprintf": {}, + "fputc": {}, + "fputs": {}, + "fread": {}, + "free": {}, + "freeaddrinfo": {}, + "frexp": {}, + "fscanf": {}, + "fseek": {}, + "fstat": {}, + "fstat64": {}, + "fsync": {}, + "ftell": {}, + "ftruncate": {}, + "ftruncate64": {}, + "fts64_close": {}, + "fts64_open": {}, + "fts64_read": {}, + "fts_close": {}, + "fts_open": {}, + "fts_read": {}, + "fwrite": {}, + "gai_strerror": {}, + "getaddrinfo": {}, + "getc": {}, + "getcwd": {}, + "getegid": {}, + "getenv": {}, + "geteuid": {}, + "getgid": {}, + "getgrgid": {}, + "getgrgid_r": {}, + "getgrnam": {}, + "getgrnam_r": {}, + "gethostbyaddr": {}, + "gethostbyaddr_r": {}, + "gethostbyname": {}, + "gethostbyname2": {}, + "gethostbyname2_r": {}, + "gethostbyname_r": {}, + "gethostname": {}, + "getnameinfo": {}, + "getpeername": {}, + "getpid": {}, + "getpwnam": {}, + "getpwnam_r": {}, + "getpwuid": {}, + "getpwuid_r": {}, + "getresgid": {}, + "getresuid": {}, + "getrlimit": {}, + "getrlimit64": {}, + "getrusage": {}, + "getservbyname": {}, + "getsockname": {}, + "getsockopt": {}, + "gettimeofday": {}, + "getuid": {}, + "gmtime_r": {}, + "h_errno": {}, + "htonl": {}, + "htons": {}, + "hypot": {}, + "inet_ntoa": {}, + "inet_ntop": {}, + "inet_pton": {}, + "initstate_r": {}, + "ioctl": {}, + "isalnum": {}, + "isalpha": {}, + "isatty": {}, + "isdigit": {}, + "islower": {}, + "isnan": {}, + "isnanf": {}, + "isnanl": {}, + "isprint": {}, + "isupper": {}, + "isxdigit": {}, + "kill": {}, + "ldexp": {}, + "link": {}, + "listen": {}, + "localtime": {}, + "localtime_r": {}, + "log": {}, + "log10": {}, + "lrand48": {}, + "lseek": {}, + "lseek64": {}, + "lstat": {}, + "lstat64": {}, + "malloc": {}, + "mblen": {}, + "mbrtowc": {}, + "mbsinit": {}, + "mbstowcs": {}, + "mbtowc": {}, + "memchr": {}, + "memcmp": {}, + "memcpy": {}, + "memmove": {}, + "memset": {}, + "mkdir": {}, + "mkfifo": {}, + "mknod": {}, + "mkstemp": {}, + "mkstemp64": {}, + "mkstemps": {}, + "mkstemps64": {}, + "mktime": {}, + "mmap": {}, + "mmap64": {}, + "modf": {}, + "mremap": {}, + "munmap": {}, + "nanf": {}, + "nl_langinfo": {}, + "ntohs": {}, + "obstack_free": {}, + "obstack_vprintf": {}, + "open": {}, + "open64": {}, + "opendir": {}, + "openpty": {}, + "pathconf": {}, + "pause": {}, + "pclose": {}, + "perror": {}, + "pipe": {}, + "poll": {}, + "popen": {}, + "posix_fadvise": {}, + "pow": {}, + "printf": {}, + "pselect": {}, + "pthread_attr_getdetachstate": {}, + "pthread_attr_setdetachstate": {}, + "pthread_mutexattr_destroy": {}, + "pthread_mutexattr_init": {}, + "pthread_mutexattr_settype": {}, + "putc": {}, + "putchar": {}, + "puts": {}, + "qsort": {}, + "raise": {}, + "rand": {}, + "rand_r": {}, + "random": {}, + "random_r": {}, + "read": {}, + "readdir": {}, + "readdir64": {}, + "readlink": {}, + "readv": {}, + "realloc": {}, + "realpath": {}, + "recv": {}, + "recvfrom": {}, + "recvmsg": {}, + "remove": {}, + "rename": {}, + "rewind": {}, + "rint": {}, + "rmdir": {}, + "round": {}, + "scalbn": {}, + "scalbnl": {}, + "sched_yield": {}, + "select": {}, + "send": {}, + "sendmsg": {}, + "sendto": {}, + "setbuf": {}, + "setenv": {}, + "setlocale": {}, + "setrlimit": {}, + "setrlimit64": {}, + "setsid": {}, + "setsockopt": {}, + "setvbuf": {}, + "shmat": {}, + "shmctl": {}, + "shmdt": {}, + "shutdown": {}, + "sigaction": {}, + "signal": {}, + "sin": {}, + "sinf": {}, + "sinh": {}, + "sleep": {}, + "snprintf": {}, + "socket": {}, + "sprintf": {}, + "sqrt": {}, + "srand48": {}, + "sscanf": {}, + "stat": {}, + "stat64": {}, + "stderr": {}, + "stdin": {}, + "stdout": {}, + "strcasecmp": {}, + "strcat": {}, + "strchr": {}, + "strcmp": {}, + "strcpy": {}, + "strcspn": {}, + "strdup": {}, + "strerror": {}, + "strlcat": {}, + "strlcpy": {}, + "strlen": {}, + "strncasecmp": {}, + "strncat": {}, + "strncmp": {}, + "strncpy": {}, + "strnlen": {}, + "strpbrk": {}, + "strrchr": {}, + "strspn": {}, + "strstr": {}, + "strtod": {}, + "strtof": {}, + "strtoimax": {}, + "strtok": {}, + "strtol": {}, + "strtold": {}, + "strtoll": {}, + "strtoul": {}, + "strtoull": {}, + "strtoumax": {}, + "symlink": {}, + "sysconf": {}, + "system": {}, + "tan": {}, + "tanh": {}, + "tcgetattr": {}, + "tcsendbreak": {}, + "tcsetattr": {}, + "time": {}, + "tolower": {}, + "toupper": {}, + "trunc": {}, + "tzset": {}, + "umask": {}, + "uname": {}, + "ungetc": {}, + "unlink": {}, + "unsetenv": {}, + "usleep": {}, + "utime": {}, + "utimes": {}, + "vasprintf": {}, + "vfprintf": {}, + "vfscanf": {}, + "vprintf": {}, + "vsnprintf": {}, + "vsprintf": {}, + "vsscanf": {}, + "waitpid": {}, + "wcschr": {}, + "wctomb": {}, + "wcwidth": {}, + "write": {}, + "writev": {}, + "zero_struct_address": {}, } diff --git a/vendor/modernc.org/libc/capi_linux_s390x.go b/vendor/modernc.org/libc/capi_linux_s390x.go index 002fc20a..6965a397 100644 --- a/vendor/modernc.org/libc/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/capi_linux_s390x.go @@ -27,6 +27,7 @@ var CAPI = map[string]struct{}{ "__builtin_constant_p_impl": {}, "__builtin_copysign": {}, "__builtin_copysignf": {}, + "__builtin_copysignl": {}, "__builtin_exit": {}, "__builtin_expect": {}, "__builtin_fabs": {}, @@ -35,6 +36,7 @@ var CAPI = map[string]struct{}{ "__builtin_huge_valf": {}, "__builtin_inf": {}, "__builtin_inff": {}, + "__builtin_infl": {}, "__builtin_isnan": {}, "__builtin_malloc": {}, "__builtin_memcmp": {}, @@ -44,7 +46,9 @@ var CAPI = map[string]struct{}{ "__builtin_mul_overflowInt64": {}, "__builtin_mul_overflowUint128": {}, "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, "__builtin_nanf": {}, + "__builtin_nanl": {}, "__builtin_object_size": {}, "__builtin_popcount": {}, "__builtin_prefetch": {}, @@ -58,6 +62,7 @@ var CAPI = map[string]struct{}{ "__builtin_sub_overflowInt64": {}, "__builtin_trap": {}, "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, "__ccgo_getMutexType": {}, "__ccgo_in6addr_anyp": {}, "__ccgo_pthreadAttrGetDetachState": {}, @@ -318,6 +323,7 @@ var CAPI = map[string]struct{}{ "putc": {}, "putchar": {}, "puts": {}, + "pwrite": {}, "qsort": {}, "raise": {}, "rand": {}, @@ -337,6 +343,7 @@ var CAPI = map[string]struct{}{ "remove": {}, "rename": {}, "rewind": {}, + "rint": {}, "rmdir": {}, "round": {}, "scalbn": {}, diff --git a/vendor/modernc.org/libc/capi_netbsd_amd64.go b/vendor/modernc.org/libc/capi_netbsd_amd64.go new file mode 100644 index 00000000..436e9ce1 --- /dev/null +++ b/vendor/modernc.org/libc/capi_netbsd_amd64.go @@ -0,0 +1,431 @@ +// Code generated by 'go generate' - DO NOT EDIT. + +package libc // import "modernc.org/libc" + +var CAPI = map[string]struct{}{ + "_C_ctype_tab_": {}, + "_IO_putc": {}, + "_ThreadRuneLocale": {}, + "___errno_location": {}, + "___runetype": {}, + "__assert": {}, + "__assert13": {}, + "__assert_fail": {}, + "__builtin___memcpy_chk": {}, + "__builtin___memmove_chk": {}, + "__builtin___memset_chk": {}, + "__builtin___snprintf_chk": {}, + "__builtin___sprintf_chk": {}, + "__builtin___strcat_chk": {}, + "__builtin___strcpy_chk": {}, + "__builtin___strncpy_chk": {}, + "__builtin___vsnprintf_chk": {}, + "__builtin_abort": {}, + "__builtin_abs": {}, + "__builtin_add_overflowInt64": {}, + "__builtin_add_overflowUint32": {}, + "__builtin_add_overflowUint64": {}, + "__builtin_bswap16": {}, + "__builtin_bswap32": {}, + "__builtin_bswap64": {}, + "__builtin_clzll": {}, + "__builtin_constant_p_impl": {}, + "__builtin_copysign": {}, + "__builtin_copysignf": {}, + "__builtin_copysignl": {}, + "__builtin_exit": {}, + "__builtin_expect": {}, + "__builtin_fabs": {}, + "__builtin_free": {}, + "__builtin_huge_val": {}, + "__builtin_huge_valf": {}, + "__builtin_inf": {}, + "__builtin_infl": {}, + "__builtin_inff": {}, + "__builtin_isnan": {}, + "__builtin_malloc": {}, + "__builtin_memcmp": {}, + "__builtin_memcpy": {}, + "__builtin_memset": {}, + "__builtin_mmap": {}, + "__builtin_mul_overflowInt64": {}, + "__builtin_mul_overflowUint128": {}, + "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, + "__builtin_nanf": {}, + "__builtin_nanl": {}, + "__builtin_object_size": {}, + "__builtin_popcount": {}, + "__builtin_prefetch": {}, + "__builtin_printf": {}, + "__builtin_snprintf": {}, + "__builtin_sprintf": {}, + "__builtin_strchr": {}, + "__builtin_strcmp": {}, + "__builtin_strcpy": {}, + "__builtin_strlen": {}, + "__builtin_sub_overflowInt64": {}, + "__builtin_trap": {}, + "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, + "__ccgo_in6addr_anyp": {}, + "__ccgo_sqlite3_log": {}, + "__cmsg_nxthdr": {}, + "__ctype_get_mb_cur_max": {}, + "__errno": {}, + "__errno_location": {}, + "__error": {}, + "__floatscan": {}, + "__h_errno_location": {}, + "__inet_aton": {}, + "__inet_ntoa": {}, + "__intscan": {}, + "__isalnum_l": {}, + "__isalpha_l": {}, + "__isdigit_l": {}, + "__isnan": {}, + "__isnanf": {}, + "__isnanl": {}, + "__isoc99_sscanf": {}, + "__isthreaded": {}, + "__lookup_ipliteral": {}, + "__lookup_name": {}, + "__lookup_serv": {}, + "__mb_sb_limit": {}, + "__runes_for_locale": {}, + "__sF": {}, + "__shgetc": {}, + "__shlim": {}, + "__stderrp": {}, + "__stdinp": {}, + "__stdoutp": {}, + "__swbuf": {}, + "__syscall1": {}, + "__syscall3": {}, + "__syscall4": {}, + "__toread": {}, + "__toread_needs_stdio_exit": {}, + "__uflow": {}, + "__xuname": {}, + "_ctype_tab_": {}, + "_exit": {}, + "_obstack_begin": {}, + "_obstack_newchunk": {}, + "_tolower_tab_": {}, + "_toupper_tab_": {}, + "abort": {}, + "abs": {}, + "accept": {}, + "access": {}, + "acos": {}, + "acosh": {}, + "alarm": {}, + "asin": {}, + "asinh": {}, + "atan": {}, + "atan2": {}, + "atanh": {}, + "atexit": {}, + "atof": {}, + "atoi": {}, + "atol": {}, + "backtrace": {}, + "backtrace_symbols_fd": {}, + "bind": {}, + "calloc": {}, + "ceil": {}, + "ceilf": {}, + "cfgetospeed": {}, + "cfsetispeed": {}, + "cfsetospeed": {}, + "chdir": {}, + "chflags": {}, + "chmod": {}, + "chown": {}, + "clock_gettime": {}, + "close": {}, + "closedir": {}, + "confstr": {}, + "connect": {}, + "copysign": {}, + "copysignf": {}, + "copysignl": {}, + "cos": {}, + "cosf": {}, + "cosh": {}, + "ctime": {}, + "ctime_r": {}, + "dlclose": {}, + "dlerror": {}, + "dlopen": {}, + "dlsym": {}, + "dup2": {}, + "endpwent": {}, + "environ": {}, + "execvp": {}, + "exit": {}, + "exp": {}, + "fabs": {}, + "fabsf": {}, + "fabsl": {}, + "fchmod": {}, + "fchown": {}, + "fclose": {}, + "fcntl": {}, + "fcntl64": {}, + "fdopen": {}, + "ferror": {}, + "fflush": {}, + "fgetc": {}, + "fgets": {}, + "fileno": {}, + "floor": {}, + "fmod": {}, + "fmodl": {}, + "fopen": {}, + "fopen64": {}, + "fork": {}, + "fprintf": {}, + "fputc": {}, + "fputs": {}, + "fread": {}, + "free": {}, + "freeaddrinfo": {}, + "frexp": {}, + "fscanf": {}, + "fseek": {}, + "fstat": {}, + "fstat64": {}, + "fsync": {}, + "ftell": {}, + "ftruncate": {}, + "fts64_close": {}, + "fts64_open": {}, + "fts64_read": {}, + "fts_close": {}, + "fts_open": {}, + "fts_read": {}, + "fwrite": {}, + "gai_strerror": {}, + "getaddrinfo": {}, + "getc": {}, + "getcwd": {}, + "getegid": {}, + "getenv": {}, + "geteuid": {}, + "getgid": {}, + "getgrgid": {}, + "getgrgid_r": {}, + "getgrnam": {}, + "getgrnam_r": {}, + "gethostbyaddr": {}, + "gethostbyaddr_r": {}, + "gethostbyname": {}, + "gethostbyname2": {}, + "gethostbyname2_r": {}, + "gethostname": {}, + "getnameinfo": {}, + "getpeername": {}, + "getpid": {}, + "getpwnam": {}, + "getpwnam_r": {}, + "getpwuid": {}, + "getpwuid_r": {}, + "getresgid": {}, + "getresuid": {}, + "getrlimit": {}, + "getrlimit64": {}, + "getrusage": {}, + "getservbyname": {}, + "getsockname": {}, + "getsockopt": {}, + "gettimeofday": {}, + "getuid": {}, + "gmtime_r": {}, + "h_errno": {}, + "htonl": {}, + "htons": {}, + "hypot": {}, + "inet_ntoa": {}, + "inet_ntop": {}, + "inet_pton": {}, + "initstate_r": {}, + "ioctl": {}, + "isalnum": {}, + "isalpha": {}, + "isatty": {}, + "isdigit": {}, + "isnan": {}, + "isnanf": {}, + "isnanl": {}, + "kill": {}, + "ldexp": {}, + "link": {}, + "listen": {}, + "localtime": {}, + "localtime_r": {}, + "log": {}, + "log10": {}, + "lrand48": {}, + "lseek": {}, + "lseek64": {}, + "lstat": {}, + "lstat64": {}, + "malloc": {}, + "mblen": {}, + "mbstowcs": {}, + "mbtowc": {}, + "memchr": {}, + "memcmp": {}, + "memcpy": {}, + "memmove": {}, + "memset": {}, + "mkdir": {}, + "mkfifo": {}, + "mknod": {}, + "mkstemp": {}, + "mkstemp64": {}, + "mkstemps": {}, + "mkstemps64": {}, + "mktime": {}, + "mmap": {}, + "modf": {}, + "munmap": {}, + "nl_langinfo": {}, + "ntohs": {}, + "obstack_free": {}, + "obstack_vprintf": {}, + "open": {}, + "open64": {}, + "opendir": {}, + "openpty": {}, + "pathconf": {}, + "pause": {}, + "pclose": {}, + "perror": {}, + "pipe": {}, + "poll": {}, + "popen": {}, + "posix_fadvise": {}, + "pow": {}, + "printf": {}, + "pselect": {}, + "putc": {}, + "putchar": {}, + "puts": {}, + "qsort": {}, + "raise": {}, + "rand": {}, + "random": {}, + "random_r": {}, + "read": {}, + "readdir": {}, + "readdir64": {}, + "readlink": {}, + "readv": {}, + "realloc": {}, + "realpath": {}, + "recv": {}, + "recvfrom": {}, + "recvmsg": {}, + "remove": {}, + "rename": {}, + "rewind": {}, + "rint": {}, + "rmdir": {}, + "round": {}, + "scalbn": {}, + "scalbnl": {}, + "sched_yield": {}, + "select": {}, + "send": {}, + "sendmsg": {}, + "sendto": {}, + "setbuf": {}, + "setenv": {}, + "setlocale": {}, + "setrlimit": {}, + "setrlimit64": {}, + "setsid": {}, + "setsockopt": {}, + "setvbuf": {}, + "shmat": {}, + "shmctl": {}, + "shmdt": {}, + "shutdown": {}, + "sigaction": {}, + "signal": {}, + "sin": {}, + "sinf": {}, + "sinh": {}, + "sleep": {}, + "snprintf": {}, + "socket": {}, + "sprintf": {}, + "sqrt": {}, + "srand48": {}, + "sscanf": {}, + "stat": {}, + "stat64": {}, + "stderr": {}, + "stdin": {}, + "stdout": {}, + "strcasecmp": {}, + "strcat": {}, + "strchr": {}, + "strcmp": {}, + "strcpy": {}, + "strcspn": {}, + "strdup": {}, + "strerror": {}, + "strlen": {}, + "strncmp": {}, + "strncpy": {}, + "strnlen": {}, + "strpbrk": {}, + "strrchr": {}, + "strspn": {}, + "strstr": {}, + "strtod": {}, + "strtof": {}, + "strtoimax": {}, + "strtol": {}, + "strtold": {}, + "strtoll": {}, + "strtoul": {}, + "strtoull": {}, + "strtoumax": {}, + "symlink": {}, + "sysconf": {}, + "system": {}, + "tan": {}, + "tanh": {}, + "tcgetattr": {}, + "tcsendbreak": {}, + "tcsetattr": {}, + "time": {}, + "tolower": {}, + "toupper": {}, + "trunc": {}, + "tzset": {}, + "umask": {}, + "uname": {}, + "ungetc": {}, + "unlink": {}, + "unsetenv": {}, + "usleep": {}, + "utime": {}, + "utimes": {}, + "vasprintf": {}, + "vfprintf": {}, + "vprintf": {}, + "vsnprintf": {}, + "vsprintf": {}, + "waitpid": {}, + "wcschr": {}, + "wctomb": {}, + "wcwidth": {}, + "write": {}, + "writev": {}, + "zero_struct_address": {}, +} diff --git a/vendor/modernc.org/libc/capi_windows_386.go b/vendor/modernc.org/libc/capi_windows_386.go index ffcccf74..26bb67cf 100644 --- a/vendor/modernc.org/libc/capi_windows_386.go +++ b/vendor/modernc.org/libc/capi_windows_386.go @@ -275,6 +275,7 @@ var CAPI = map[string]struct{}{ "__builtin_constant_p_impl": {}, "__builtin_copysign": {}, "__builtin_copysignf": {}, + "__builtin_copysignl": {}, "__builtin_exit": {}, "__builtin_expect": {}, "__builtin_fabs": {}, @@ -282,6 +283,7 @@ var CAPI = map[string]struct{}{ "__builtin_huge_val": {}, "__builtin_huge_valf": {}, "__builtin_inf": {}, + "__builtin_infl": {}, "__builtin_inff": {}, "__builtin_isnan": {}, "__builtin_malloc": {}, @@ -293,7 +295,9 @@ var CAPI = map[string]struct{}{ "__builtin_mul_overflowInt64": {}, "__builtin_mul_overflowUint128": {}, "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, "__builtin_nanf": {}, + "__builtin_nanl": {}, "__builtin_object_size": {}, "__builtin_popcount": {}, "__builtin_prefetch": {}, @@ -308,9 +312,9 @@ var CAPI = map[string]struct{}{ "__builtin_sub_overflowInt64": {}, "__builtin_trap": {}, "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, "__ccgo_in6addr_anyp": {}, "__ccgo_sqlite3_log": {}, - "__ctype_b_loc": {}, "__ctype_get_mb_cur_max": {}, "__env_rm_add": {}, "__errno_location": {}, @@ -580,6 +584,7 @@ var CAPI = map[string]struct{}{ "recv": {}, "rename": {}, "rewind": {}, + "rint": {}, "rmdir": {}, "round": {}, "select": {}, @@ -623,6 +628,7 @@ var CAPI = map[string]struct{}{ "strpbrk": {}, "strrchr": {}, "strstr": {}, + "strtod": {}, "strtol": {}, "strtoul": {}, "symlink": {}, diff --git a/vendor/modernc.org/libc/capi_windows_amd64.go b/vendor/modernc.org/libc/capi_windows_amd64.go index 12784f7d..d15fb63d 100644 --- a/vendor/modernc.org/libc/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/capi_windows_amd64.go @@ -273,6 +273,7 @@ var CAPI = map[string]struct{}{ "__builtin_constant_p_impl": {}, "__builtin_copysign": {}, "__builtin_copysignf": {}, + "__builtin_copysignl": {}, "__builtin_exit": {}, "__builtin_expect": {}, "__builtin_fabs": {}, @@ -280,6 +281,7 @@ var CAPI = map[string]struct{}{ "__builtin_huge_val": {}, "__builtin_huge_valf": {}, "__builtin_inf": {}, + "__builtin_infl": {}, "__builtin_inff": {}, "__builtin_isnan": {}, "__builtin_malloc": {}, @@ -291,7 +293,9 @@ var CAPI = map[string]struct{}{ "__builtin_mul_overflowInt64": {}, "__builtin_mul_overflowUint128": {}, "__builtin_mul_overflowUint64": {}, + "__builtin_nan": {}, "__builtin_nanf": {}, + "__builtin_nanl": {}, "__builtin_object_size": {}, "__builtin_popcount": {}, "__builtin_prefetch": {}, @@ -306,9 +310,9 @@ var CAPI = map[string]struct{}{ "__builtin_sub_overflowInt64": {}, "__builtin_trap": {}, "__builtin_unreachable": {}, + "__ccgo_dmesg": {}, "__ccgo_in6addr_anyp": {}, "__ccgo_sqlite3_log": {}, - "__ctype_b_loc": {}, "__ctype_get_mb_cur_max": {}, "__env_rm_add": {}, "__errno_location": {}, @@ -576,6 +580,7 @@ var CAPI = map[string]struct{}{ "recv": {}, "rename": {}, "rewind": {}, + "rint": {}, "rmdir": {}, "round": {}, "select": {}, diff --git a/vendor/modernc.org/libc/ccgo.go b/vendor/modernc.org/libc/ccgo.go index a23291bd..537dde70 100644 --- a/vendor/modernc.org/libc/ccgo.go +++ b/vendor/modernc.org/libc/ccgo.go @@ -967,306 +967,306 @@ func BoolUint64(b bool) uint64 { } func SetBitFieldPtr8Int8(p uintptr, v int8, off int, mask uint8) { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<> s } func AssignBitFieldPtr8Int16(p uintptr, v int16, w, off int, mask uint8) int16 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<> s } func AssignBitFieldPtr8Int32(p uintptr, v int32, w, off int, mask uint8) int32 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<> s } func AssignBitFieldPtr8Int64(p uintptr, v int64, w, off int, mask uint8) int64 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<> s } func AssignBitFieldPtr16Int8(p uintptr, v int8, w, off int, mask uint16) int8 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<> s } func AssignBitFieldPtr16Int16(p uintptr, v int16, w, off int, mask uint16) int16 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<> s } func AssignBitFieldPtr16Int32(p uintptr, v int32, w, off int, mask uint16) int32 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<> s } func AssignBitFieldPtr16Int64(p uintptr, v int64, w, off int, mask uint16) int64 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<> s } func AssignBitFieldPtr32Int8(p uintptr, v int8, w, off int, mask uint32) int8 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<> s } func AssignBitFieldPtr32Int16(p uintptr, v int16, w, off int, mask uint32) int16 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<> s } func AssignBitFieldPtr32Int32(p uintptr, v int32, w, off int, mask uint32) int32 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<> s } func AssignBitFieldPtr32Int64(p uintptr, v int64, w, off int, mask uint32) int64 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<> s } func AssignBitFieldPtr64Int8(p uintptr, v int8, w, off int, mask uint64) int8 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<> s } func AssignBitFieldPtr64Int16(p uintptr, v int16, w, off int, mask uint64) int16 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<> s } func AssignBitFieldPtr64Int32(p uintptr, v int32, w, off int, mask uint64) int32 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<> s } func AssignBitFieldPtr64Int64(p uintptr, v int64, w, off int, mask uint64) int64 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<> s } func AssignBitFieldPtr8Uint8(p uintptr, v uint8, w, off int, mask uint8) uint8 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<>off) } func AssignBitFieldPtr8Uint16(p uintptr, v uint16, w, off int, mask uint8) uint16 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<>off) } func AssignBitFieldPtr8Uint32(p uintptr, v uint32, w, off int, mask uint8) uint32 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<>off) } func AssignBitFieldPtr8Uint64(p uintptr, v uint64, w, off int, mask uint8) uint64 { - *(*uint8)(unsafe.Pointer(p)) = *(*uint8)(unsafe.Pointer(p))&^uint8(mask) | uint8(v<>off) } func AssignBitFieldPtr16Uint8(p uintptr, v uint8, w, off int, mask uint16) uint8 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<>off) } func AssignBitFieldPtr16Uint16(p uintptr, v uint16, w, off int, mask uint16) uint16 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<>off) } func AssignBitFieldPtr16Uint32(p uintptr, v uint32, w, off int, mask uint16) uint32 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<>off) } func AssignBitFieldPtr16Uint64(p uintptr, v uint64, w, off int, mask uint16) uint64 { - *(*uint16)(unsafe.Pointer(p)) = *(*uint16)(unsafe.Pointer(p))&^uint16(mask) | uint16(v<>off) } func AssignBitFieldPtr32Uint8(p uintptr, v uint8, w, off int, mask uint32) uint8 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<>off) } func AssignBitFieldPtr32Uint16(p uintptr, v uint16, w, off int, mask uint32) uint16 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<>off) } func AssignBitFieldPtr32Uint32(p uintptr, v uint32, w, off int, mask uint32) uint32 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<>off) } func AssignBitFieldPtr32Uint64(p uintptr, v uint64, w, off int, mask uint32) uint64 { - *(*uint32)(unsafe.Pointer(p)) = *(*uint32)(unsafe.Pointer(p))&^uint32(mask) | uint32(v<>off) } func AssignBitFieldPtr64Uint8(p uintptr, v uint8, w, off int, mask uint64) uint8 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<>off) } func AssignBitFieldPtr64Uint16(p uintptr, v uint16, w, off int, mask uint64) uint16 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<>off) } func AssignBitFieldPtr64Uint32(p uintptr, v uint32, w, off int, mask uint64) uint32 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<>off) } func AssignBitFieldPtr64Uint64(p uintptr, v uint64, w, off int, mask uint64) uint64 { - *(*uint64)(unsafe.Pointer(p)) = *(*uint64)(unsafe.Pointer(p))&^uint64(mask) | uint64(v<>off) } diff --git a/vendor/modernc.org/libc/dmesg.go b/vendor/modernc.org/libc/dmesg.go index df3d2096..4ddc3eca 100644 --- a/vendor/modernc.org/libc/dmesg.go +++ b/vendor/modernc.org/libc/dmesg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build libc.dmesg // +build libc.dmesg package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/errno/capi_darwin_amd64.go b/vendor/modernc.org/libc/errno/capi_darwin_amd64.go index e0b7cd82..4894d151 100644 --- a/vendor/modernc.org/libc/errno/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/errno/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_darwin_amd64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_darwin_amd64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_freebsd_amd64.go b/vendor/modernc.org/libc/errno/capi_freebsd_amd64.go new file mode 100644 index 00000000..adbe5b15 --- /dev/null +++ b/vendor/modernc.org/libc/errno/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_freebsd_amd64.go -pkgname errno', DO NOT EDIT. + +package errno + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/errno/capi_linux_386.go b/vendor/modernc.org/libc/errno/capi_linux_386.go index 3ec59e52..e33ffcbc 100644 --- a/vendor/modernc.org/libc/errno/capi_linux_386.go +++ b/vendor/modernc.org/libc/errno/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_386.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_386.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_linux_amd64.go b/vendor/modernc.org/libc/errno/capi_linux_amd64.go index 09685470..60faf382 100644 --- a/vendor/modernc.org/libc/errno/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/errno/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_amd64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_amd64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_linux_arm.go b/vendor/modernc.org/libc/errno/capi_linux_arm.go index 7d4dd76b..1be1b8d3 100644 --- a/vendor/modernc.org/libc/errno/capi_linux_arm.go +++ b/vendor/modernc.org/libc/errno/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_linux_arm64.go b/vendor/modernc.org/libc/errno/capi_linux_arm64.go index ca099be9..1759c771 100644 --- a/vendor/modernc.org/libc/errno/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/errno/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_linux_s390x.go b/vendor/modernc.org/libc/errno/capi_linux_s390x.go index 5a24f062..dc030616 100644 --- a/vendor/modernc.org/libc/errno/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/errno/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_s390x.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_s390x.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_netbsd_amd64.go b/vendor/modernc.org/libc/errno/capi_netbsd_amd64.go new file mode 100644 index 00000000..ccaa5033 --- /dev/null +++ b/vendor/modernc.org/libc/errno/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_netbsd_amd64.go -pkgname errno', DO NOT EDIT. + +package errno + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/errno/capi_windows_386.go b/vendor/modernc.org/libc/errno/capi_windows_386.go index d96973f2..076978ea 100644 --- a/vendor/modernc.org/libc/errno/capi_windows_386.go +++ b/vendor/modernc.org/libc/errno/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_386.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_386.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/capi_windows_amd64.go b/vendor/modernc.org/libc/errno/capi_windows_amd64.go index 5155089c..02862271 100644 --- a/vendor/modernc.org/libc/errno/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/errno/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_amd64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_amd64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_darwin_amd64.go b/vendor/modernc.org/libc/errno/errno_darwin_amd64.go index 1d7292ad..ce7e0806 100644 --- a/vendor/modernc.org/libc/errno/errno_darwin_amd64.go +++ b/vendor/modernc.org/libc/errno/errno_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_darwin_amd64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_darwin_amd64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_freebsd_amd64.go b/vendor/modernc.org/libc/errno/errno_freebsd_amd64.go new file mode 100644 index 00000000..5e68eb3a --- /dev/null +++ b/vendor/modernc.org/libc/errno/errno_freebsd_amd64.go @@ -0,0 +1,166 @@ +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_freebsd_amd64.go -pkgname errno', DO NOT EDIT. + +package errno + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + E2BIG = 7 + EACCES = 13 + EADDRINUSE = 48 + EADDRNOTAVAIL = 49 + EAFNOSUPPORT = 47 + EAGAIN = 35 + EALREADY = 37 + EAUTH = 80 + EBADF = 9 + EBADMSG = 89 + EBADRPC = 72 + EBUSY = 16 + ECANCELED = 85 + ECAPMODE = 94 + ECHILD = 10 + ECONNABORTED = 53 + ECONNREFUSED = 61 + ECONNRESET = 54 + EDEADLK = 11 + EDESTADDRREQ = 39 + EDOM = 33 + EDOOFUS = 88 + EDQUOT = 69 + EEXIST = 17 + EFAULT = 14 + EFBIG = 27 + EFTYPE = 79 + EHOSTDOWN = 64 + EHOSTUNREACH = 65 + EIDRM = 82 + EILSEQ = 86 + EINPROGRESS = 36 + EINTEGRITY = 97 + EINTR = 4 + EINVAL = 22 + EIO = 5 + EISCONN = 56 + EISDIR = 21 + ELAST = 97 + ELOOP = 62 + EMFILE = 24 + EMLINK = 31 + EMSGSIZE = 40 + EMULTIHOP = 90 + ENAMETOOLONG = 63 + ENEEDAUTH = 81 + ENETDOWN = 50 + ENETRESET = 52 + ENETUNREACH = 51 + ENFILE = 23 + ENOATTR = 87 + ENOBUFS = 55 + ENODEV = 19 + ENOENT = 2 + ENOEXEC = 8 + ENOLCK = 77 + ENOLINK = 91 + ENOMEM = 12 + ENOMSG = 83 + ENOPROTOOPT = 42 + ENOSPC = 28 + ENOSYS = 78 + ENOTBLK = 15 + ENOTCAPABLE = 93 + ENOTCONN = 57 + ENOTDIR = 20 + ENOTEMPTY = 66 + ENOTRECOVERABLE = 95 + ENOTSOCK = 38 + ENOTSUP = 45 + ENOTTY = 25 + ENXIO = 6 + EOPNOTSUPP = 45 + EOVERFLOW = 84 + EOWNERDEAD = 96 + EPERM = 1 + EPFNOSUPPORT = 46 + EPIPE = 32 + EPROCLIM = 67 + EPROCUNAVAIL = 76 + EPROGMISMATCH = 75 + EPROGUNAVAIL = 74 + EPROTO = 92 + EPROTONOSUPPORT = 43 + EPROTOTYPE = 41 + ERANGE = 34 + EREMOTE = 71 + EROFS = 30 + ERPCMISMATCH = 73 + ESHUTDOWN = 58 + ESOCKTNOSUPPORT = 44 + ESPIPE = 29 + ESRCH = 3 + ESTALE = 70 + ETIMEDOUT = 60 + ETOOMANYREFS = 59 + ETXTBSY = 26 + EUSERS = 68 + EWOULDBLOCK = 35 + EXDEV = 18 + X_ERRNO_T_DEFINED = 0 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_ERRNO_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// 11 was EAGAIN + +// math software + +// non-blocking and interrupt i/o + +// ipc/network software -- argument errors + +// ipc/network software -- operational errors + +// should be rearranged + +// quotas & mush + +// Network File System + +// ISO/IEC 9899:2011 K.3.2.2 +type Errno_t = int32 /* errno.h:204:13 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/errno/errno_linux_386.go b/vendor/modernc.org/libc/errno/errno_linux_386.go index d148b660..ecd4f887 100644 --- a/vendor/modernc.org/libc/errno/errno_linux_386.go +++ b/vendor/modernc.org/libc/errno/errno_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_386.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_386.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_linux_amd64.go b/vendor/modernc.org/libc/errno/errno_linux_amd64.go index f7b69c36..920fd4cc 100644 --- a/vendor/modernc.org/libc/errno/errno_linux_amd64.go +++ b/vendor/modernc.org/libc/errno/errno_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_amd64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_amd64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_linux_arm.go b/vendor/modernc.org/libc/errno/errno_linux_arm.go index 49a7ba60..eef5f53c 100644 --- a/vendor/modernc.org/libc/errno/errno_linux_arm.go +++ b/vendor/modernc.org/libc/errno/errno_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_linux_arm64.go b/vendor/modernc.org/libc/errno/errno_linux_arm64.go index f0ea730c..973f12cb 100644 --- a/vendor/modernc.org/libc/errno/errno_linux_arm64.go +++ b/vendor/modernc.org/libc/errno/errno_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_arm64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_linux_s390x.go b/vendor/modernc.org/libc/errno/errno_linux_s390x.go index 1f57b576..4ecaf601 100644 --- a/vendor/modernc.org/libc/errno/errno_linux_s390x.go +++ b/vendor/modernc.org/libc/errno/errno_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_s390x.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_linux_s390x.go -pkgname errno', DO NOT EDIT. package errno @@ -184,4 +184,4 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/errno/errno_netbsd_amd64.go b/vendor/modernc.org/libc/errno/errno_netbsd_amd64.go new file mode 100644 index 00000000..8a96a69d --- /dev/null +++ b/vendor/modernc.org/libc/errno/errno_netbsd_amd64.go @@ -0,0 +1,144 @@ +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_netbsd_amd64.go -pkgname errno', DO NOT EDIT. + +package errno + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + E2BIG = 7 + EACCES = 13 + EADDRINUSE = 48 + EADDRNOTAVAIL = 49 + EAFNOSUPPORT = 47 + EAGAIN = 35 + EALREADY = 37 + EAUTH = 80 + EBADF = 9 + EBADMSG = 88 + EBADRPC = 72 + EBUSY = 16 + ECANCELED = 87 + ECHILD = 10 + ECONNABORTED = 53 + ECONNREFUSED = 61 + ECONNRESET = 54 + EDEADLK = 11 + EDESTADDRREQ = 39 + EDOM = 33 + EDQUOT = 69 + EEXIST = 17 + EFAULT = 14 + EFBIG = 27 + EFTYPE = 79 + EHOSTDOWN = 64 + EHOSTUNREACH = 65 + EIDRM = 82 + EILSEQ = 85 + EINPROGRESS = 36 + EINTR = 4 + EINVAL = 22 + EIO = 5 + EISCONN = 56 + EISDIR = 21 + ELAST = 96 + ELOOP = 62 + EMFILE = 24 + EMLINK = 31 + EMSGSIZE = 40 + EMULTIHOP = 94 + ENAMETOOLONG = 63 + ENEEDAUTH = 81 + ENETDOWN = 50 + ENETRESET = 52 + ENETUNREACH = 51 + ENFILE = 23 + ENOATTR = 93 + ENOBUFS = 55 + ENODATA = 89 + ENODEV = 19 + ENOENT = 2 + ENOEXEC = 8 + ENOLCK = 77 + ENOLINK = 95 + ENOMEM = 12 + ENOMSG = 83 + ENOPROTOOPT = 42 + ENOSPC = 28 + ENOSR = 90 + ENOSTR = 91 + ENOSYS = 78 + ENOTBLK = 15 + ENOTCONN = 57 + ENOTDIR = 20 + ENOTEMPTY = 66 + ENOTSOCK = 38 + ENOTSUP = 86 + ENOTTY = 25 + ENXIO = 6 + EOPNOTSUPP = 45 + EOVERFLOW = 84 + EPERM = 1 + EPFNOSUPPORT = 46 + EPIPE = 32 + EPROCLIM = 67 + EPROCUNAVAIL = 76 + EPROGMISMATCH = 75 + EPROGUNAVAIL = 74 + EPROTO = 96 + EPROTONOSUPPORT = 43 + EPROTOTYPE = 41 + ERANGE = 34 + EREMOTE = 71 + EROFS = 30 + ERPCMISMATCH = 73 + ESHUTDOWN = 58 + ESOCKTNOSUPPORT = 44 + ESPIPE = 29 + ESRCH = 3 + ESTALE = 70 + ETIME = 92 + ETIMEDOUT = 60 + ETOOMANYREFS = 59 + ETXTBSY = 26 + EUSERS = 68 + EWOULDBLOCK = 35 + EXDEV = 18 + X_ERRNO_H_ = 0 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_ERRNO_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/errno/errno_windows_386.go b/vendor/modernc.org/libc/errno/errno_windows_386.go index 73527e5d..e72f6a8e 100644 --- a/vendor/modernc.org/libc/errno/errno_windows_386.go +++ b/vendor/modernc.org/libc/errno/errno_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_386.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_386.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/errno/errno_windows_amd64.go b/vendor/modernc.org/libc/errno/errno_windows_amd64.go index 05d61a94..89ca9b44 100644 --- a/vendor/modernc.org/libc/errno/errno_windows_amd64.go +++ b/vendor/modernc.org/libc/errno/errno_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_amd64.go -pkgname errno', DO NOT EDIT. +// Code generated by 'ccgo errno/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o errno/errno_windows_amd64.go -pkgname errno', DO NOT EDIT. package errno diff --git a/vendor/modernc.org/libc/etc.go b/vendor/modernc.org/libc/etc.go index 05ada729..6e687055 100644 --- a/vendor/modernc.org/libc/etc.go +++ b/vendor/modernc.org/libc/etc.go @@ -395,14 +395,17 @@ func cString(t *TLS, s string) uintptr { //TODO- return p } -// VaList fills a varargs list at p with args and returns uintptr(p). The list -// must have been allocated by caller and it must not be in Go managed -// memory, ie. it must be pinned. Caller is responsible for freeing the list. +// VaList fills a varargs list at p with args and returns p. The list must +// have been allocated by caller and it must not be in Go managed memory, ie. +// it must be pinned. Caller is responsible for freeing the list. // // Individual arguments must be one of int, uint, int32, uint32, int64, uint64, // float64, uintptr or Intptr. Other types will panic. // -// Note: The C translated to Go varargs ABI alignment for all types is 8 at all +// This function supports code generated by ccgo/v3. For manually constructed +// var args it's recommended to use the NewVaList function instead. +// +// Note: The C translated to Go varargs ABI alignment for all types is 8 on all // architectures. func VaList(p uintptr, args ...interface{}) (r uintptr) { if p&7 != 0 { @@ -438,6 +441,22 @@ func VaList(p uintptr, args ...interface{}) (r uintptr) { return r } +// NewVaListN returns a newly allocated va_list for n items. The caller of +// NewVaListN is responsible for freeing the va_list. +func NewVaListN(n int) (va_list uintptr) { + return Xmalloc(nil, types.Size_t(8*n)) +} + +// NewVaList is like VaList but automatically allocates the correct amount of +// memory for all of the items in args. +// +// The va_list return value is used to pass the constructed var args to var +// args accepting functions. The caller of NewVaList is responsible for freeing +// the va_list. +func NewVaList(args ...interface{}) (va_list uintptr) { + return VaList(NewVaListN(len(args)), args...) +} + func VaInt32(app *uintptr) int32 { ap := *(*uintptr)(unsafe.Pointer(app)) if ap == 0 { diff --git a/vendor/modernc.org/libc/fcntl/capi_darwin_amd64.go b/vendor/modernc.org/libc/fcntl/capi_darwin_amd64.go index 2cada671..7ff36b73 100644 --- a/vendor/modernc.org/libc/fcntl/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/fcntl/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_darwin_amd64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_darwin_amd64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_freebsd_amd64.go b/vendor/modernc.org/libc/fcntl/capi_freebsd_amd64.go new file mode 100644 index 00000000..d29a4557 --- /dev/null +++ b/vendor/modernc.org/libc/fcntl/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_freebsd_amd64.go -pkgname fcntl', DO NOT EDIT. + +package fcntl + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/fcntl/capi_linux_386.go b/vendor/modernc.org/libc/fcntl/capi_linux_386.go index d12c5477..6a2e65fb 100644 --- a/vendor/modernc.org/libc/fcntl/capi_linux_386.go +++ b/vendor/modernc.org/libc/fcntl/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_386.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_386.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_linux_amd64.go b/vendor/modernc.org/libc/fcntl/capi_linux_amd64.go index ba772f54..8b8fafc3 100644 --- a/vendor/modernc.org/libc/fcntl/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/fcntl/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_amd64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_amd64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_linux_arm.go b/vendor/modernc.org/libc/fcntl/capi_linux_arm.go index bbc377e0..930e7252 100644 --- a/vendor/modernc.org/libc/fcntl/capi_linux_arm.go +++ b/vendor/modernc.org/libc/fcntl/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_linux_arm64.go b/vendor/modernc.org/libc/fcntl/capi_linux_arm64.go index 896b41b8..d8986988 100644 --- a/vendor/modernc.org/libc/fcntl/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/fcntl/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_linux_s390x.go b/vendor/modernc.org/libc/fcntl/capi_linux_s390x.go index 1d755f49..f1c6f3e7 100644 --- a/vendor/modernc.org/libc/fcntl/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/fcntl/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_s390x.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_s390x.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_netbsd_amd64.go b/vendor/modernc.org/libc/fcntl/capi_netbsd_amd64.go new file mode 100644 index 00000000..db75e28c --- /dev/null +++ b/vendor/modernc.org/libc/fcntl/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_netbsd_amd64.go -pkgname fcntl', DO NOT EDIT. + +package fcntl + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/fcntl/capi_windows_386.go b/vendor/modernc.org/libc/fcntl/capi_windows_386.go index c22da7bc..901d6f2f 100644 --- a/vendor/modernc.org/libc/fcntl/capi_windows_386.go +++ b/vendor/modernc.org/libc/fcntl/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_386.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_386.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/capi_windows_amd64.go b/vendor/modernc.org/libc/fcntl/capi_windows_amd64.go index 7ba8331c..aec3e91b 100644 --- a/vendor/modernc.org/libc/fcntl/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/fcntl/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_amd64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_amd64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_darwin_amd64.go b/vendor/modernc.org/libc/fcntl/fcntl_darwin_amd64.go index e2d5af3c..93eb3caa 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_darwin_amd64.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_darwin_amd64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_darwin_amd64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_freebsd_amd64.go b/vendor/modernc.org/libc/fcntl/fcntl_freebsd_amd64.go new file mode 100644 index 00000000..d24cc9ee --- /dev/null +++ b/vendor/modernc.org/libc/fcntl/fcntl_freebsd_amd64.go @@ -0,0 +1,770 @@ +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_freebsd_amd64.go -pkgname fcntl', DO NOT EDIT. + +package fcntl + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AT_EACCESS = 0x0100 + AT_FDCWD = -100 + AT_REMOVEDIR = 0x0800 + AT_RESOLVE_BENEATH = 0x2000 + AT_SYMLINK_FOLLOW = 0x0400 + AT_SYMLINK_NOFOLLOW = 0x0200 + FAPPEND = 8 + FASYNC = 64 + FDSYNC = 16777216 + FD_CLOEXEC = 1 + FD_NONE = -200 + FFSYNC = 128 + FNDELAY = 4 + FNONBLOCK = 4 + FRDAHEAD = 512 + FREAD = 0x0001 + FWRITE = 0x0002 + F_ADD_SEALS = 19 + F_CANCEL = 5 + F_DUP2FD = 10 + F_DUP2FD_CLOEXEC = 18 + F_DUPFD = 0 + F_DUPFD_CLOEXEC = 17 + F_GETFD = 1 + F_GETFL = 3 + F_GETLK = 11 + F_GETOWN = 5 + F_GET_SEALS = 20 + F_ISUNIONSTACK = 21 + F_OGETLK = 7 + F_OSETLK = 8 + F_OSETLKW = 9 + F_RDAHEAD = 16 + F_RDLCK = 1 + F_READAHEAD = 15 + F_SEAL_GROW = 0x0004 + F_SEAL_SEAL = 0x0001 + F_SEAL_SHRINK = 0x0002 + F_SEAL_WRITE = 0x0008 + F_SETFD = 2 + F_SETFL = 4 + F_SETLK = 12 + F_SETLKW = 13 + F_SETLK_REMOTE = 14 + F_SETOWN = 6 + F_UNLCK = 2 + F_UNLCKSYS = 4 + F_WRLCK = 3 + LOCK_EX = 0x02 + LOCK_NB = 0x04 + LOCK_SH = 0x01 + LOCK_UN = 0x08 + O_ACCMODE = 0x0003 + O_APPEND = 0x0008 + O_ASYNC = 0x0040 + O_CLOEXEC = 0x00100000 + O_CREAT = 0x0200 + O_DIRECT = 0x00010000 + O_DIRECTORY = 0x00020000 + O_DSYNC = 0x01000000 + O_EXCL = 0x0800 + O_EXEC = 0x00040000 + O_EXLOCK = 0x0020 + O_FSYNC = 0x0080 + O_NDELAY = 4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x0100 + O_NONBLOCK = 0x0004 + O_RDONLY = 0x0000 + O_RDWR = 0x0002 + O_RESOLVE_BENEATH = 0x00800000 + O_SEARCH = 262144 + O_SHLOCK = 0x0010 + O_SYNC = 0x0080 + O_TRUNC = 0x0400 + O_TTY_INIT = 0x00080000 + O_VERIFY = 0x00200000 + O_WRONLY = 0x0001 + POSIX_FADV_DONTNEED = 4 + POSIX_FADV_NOREUSE = 5 + POSIX_FADV_NORMAL = 0 + POSIX_FADV_RANDOM = 1 + POSIX_FADV_SEQUENTIAL = 2 + POSIX_FADV_WILLNEED = 3 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MODE_T_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF_T_DECLARED = 0 + X_PID_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_FCNTL_H_ = 0 + X_SYS__TYPES_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1983, 1990, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fcntl.h 8.3 (Berkeley) 1/21/94 +// $FreeBSD$ + +// This file includes the definitions for open and fcntl +// described by POSIX for ; it also includes +// related kernel definitions. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Mode_t = X__mode_t /* fcntl.h:53:18 */ + +type Off_t = X__off_t /* fcntl.h:58:18 */ + +type Pid_t = X__pid_t /* fcntl.h:63:18 */ + +// File status flags: these are used by open(2), fcntl(2). +// They are also used (indirectly) in the kernel file structure f_flags, +// which is a superset of the open/fcntl flags. Open flags and f_flags +// are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). +// Open/fcntl flags begin with O_; kernel-internal flags begin with F. +// open-only flags + +// Kernel encoding of open mode; separate read and write bits that are +// independently testable: 1 greater than the above. +// +// XXX +// FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, +// which was documented to use FREAD/FWRITE, continues to work. + +// Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. + +// Attempt to bypass buffer cache + +// Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. + +/* #define O_UNUSED1 0x00400000 */ // Was O_BENEATH + +// XXX missing O_RSYNC. + +// The O_* flags used to have only F* names, which were used in the kernel +// and by fcntl. We retain the F* names for the kernel f_flag field +// and for backward compatibility for fcntl. These flags are deprecated. + +// Historically, we ran out of bits in f_flag (which was once a short). +// However, the flag bits not set in FMASK are only meaningful in the +// initial open syscall. Those bits were thus given a +// different meaning for fcntl(2). +// Read ahead + +// Magic value that specify the use of the current working directory +// to determine the target of relative file paths in the openat() and +// similar syscalls. + +// Miscellaneous flags for the *at() syscalls. +/* #define AT_UNUSED1 0x1000 */ // Was AT_BENEATH + +// Constants used for fcntl(2) + +// command values + +// Seals (F_ADD_SEALS, F_GET_SEALS). + +// file descriptor flags (F_GETFD, F_SETFD) + +// record locking flags (F_GETLK, F_SETLK, F_SETLKW) + +// Advisory file segment locking data type - +// information passed to system by user +type Flock = struct { + Fl_start Off_t + Fl_len Off_t + Fl_pid Pid_t + Fl_type int16 + Fl_whence int16 + Fl_sysid int32 + _ [4]byte +} /* fcntl.h:294:1 */ + +// Old advisory file segment locking data type, +// before adding l_sysid. +type X__oflock = struct { + Fl_start Off_t + Fl_len Off_t + Fl_pid Pid_t + Fl_type int16 + Fl_whence int16 +} /* fcntl.h:308:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/fcntl/fcntl_linux_386.go b/vendor/modernc.org/libc/fcntl/fcntl_linux_386.go index 74fd77dc..db83bc12 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_linux_386.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_386.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_386.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_linux_amd64.go b/vendor/modernc.org/libc/fcntl/fcntl_linux_amd64.go index f651d6ef..6a091b0a 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_linux_amd64.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_amd64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_amd64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_linux_arm.go b/vendor/modernc.org/libc/fcntl/fcntl_linux_arm.go index 59845ee8..847d6bec 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_linux_arm.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_linux_arm64.go b/vendor/modernc.org/libc/fcntl/fcntl_linux_arm64.go index fe981c32..1ed6645d 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_linux_arm64.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_arm64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_linux_s390x.go b/vendor/modernc.org/libc/fcntl/fcntl_linux_s390x.go index d7a3a43d..508aace3 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_linux_s390x.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_s390x.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_linux_s390x.go -pkgname fcntl', DO NOT EDIT. package fcntl @@ -111,7 +111,10 @@ const ( W_OK = 2 X_OK = 1 X_ATFILE_SOURCE = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_STAT_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_DEFAULT_SOURCE = 1 @@ -153,7 +156,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -168,11 +171,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 6.5 File Control Operations -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -187,7 +190,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -195,6 +198,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -315,6 +319,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -337,9 +343,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -354,7 +373,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -367,7 +386,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -382,7 +401,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -497,7 +516,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -514,14 +533,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -536,7 +553,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -576,7 +593,7 @@ type X__float128 = float64 /* :47:21 */ // Get __mode_t, __dev_t and __off_t . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -591,11 +608,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -610,43 +627,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -658,7 +697,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -679,7 +718,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -694,7 +733,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -709,83 +748,12 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. - -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. - -// Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ - -// Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ - -// Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ - -// Types from the Large File Support interface. - -// Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ - -// Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ - -// Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ - -// Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ - -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. - -// Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ -// Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ - -// Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ - -// C99: An integer type that can be accessed as an atomic entity, -// even in the presence of asynchronous interrupts. -// It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ - -// Get the definitions of O_*, F_*, FD_*: all the -// numbers and flag bits for `open', `fcntl', et al. -// O_*, F_*, FD_* bit values for Linux. -// Copyright (C) 2000-2018 Free Software Foundation, Inc. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -800,7 +768,106 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . + +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. + +// Clock ID used in clock and timer functions. +type X__clockid_t = int32 /* types.h:168:29 */ + +// Timer ID returned by `timer_create'. +type X__timer_t = uintptr /* types.h:171:12 */ + +// Type to represent block size. +type X__blksize_t = int64 /* types.h:174:29 */ + +// Types from the Large File Support interface. + +// Type to count number of disk blocks. +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ + +// Type to count file system blocks. +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ + +// Type to count file system nodes. +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ + +// Type of miscellaneous file system fields. +type X__fsword_t = int64 /* types.h:191:28 */ + +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. + +// Signed long type used in system calls. +type X__syscall_slong_t = int64 /* types.h:196:33 */ +// Unsigned long type used in system calls. +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__intptr_t = int64 /* types.h:206:25 */ + +// Duplicate info from sys/socket.h. +type X__socklen_t = uint32 /* types.h:209:23 */ + +// C99: An integer type that can be accessed as an atomic entity, +// even in the presence of asynchronous interrupts. +// It is not currently necessary for this to be machine-specific. +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. + +// Get the definitions of O_*, F_*, FD_*: all the +// numbers and flag bits for `open', `fcntl', et al. +// O_*, F_*, FD_* bit values for Linux. +// Copyright (C) 2000-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . // Determine the wordsize from the preprocessor defines. @@ -820,7 +887,7 @@ type Flock = struct { // Include generic Linux declarations. // O_*, F_*, FD_* bit values for Linux. -// Copyright (C) 2001-2018 Free Software Foundation, Inc. +// Copyright (C) 2001-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -835,7 +902,7 @@ type Flock = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This file contains shared definitions between Linux architectures // and is included by to declare them. The various @@ -883,8 +950,6 @@ type Flock = struct { // Advise to `posix_fadvise'. -// Values for `*at' functions. - // Detect if open needs mode as a third argument (or for openat as a fourth // argument). @@ -901,7 +966,27 @@ type Pid_t = X__pid_t /* fcntl.h:69:17 */ // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -918,16 +1003,29 @@ type Pid_t = X__pid_t /* fcntl.h:69:17 */ // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. +// Definitions for byte order, according to significance of bytes, +// from low addresses to high addresses. The value is what you get by +// putting '4' in the most significant byte, '3' in the second most +// significant byte, '2' in the second least significant byte, and '1' +// in the least significant byte, and then writing down one digit for +// each byte, starting with the byte at the lowest address at the left, +// and proceeding to the byte with the highest address at the right. + +// This file defines `__BYTE_ORDER' for the particular machine. + +// S/390 is big-endian. + +// Some machines may need to use a different endianness for floating point +// values. // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ -// Copyright (C) 2000-2018 Free Software Foundation, Inc. +// Copyright (C) 2000-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -942,7 +1040,7 @@ type Timespec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. @@ -979,4 +1077,4 @@ type Stat = struct { // Define some inlines helping to catch common problems. -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/fcntl/fcntl_netbsd_amd64.go b/vendor/modernc.org/libc/fcntl/fcntl_netbsd_amd64.go new file mode 100644 index 00000000..75b4b66a --- /dev/null +++ b/vendor/modernc.org/libc/fcntl/fcntl_netbsd_amd64.go @@ -0,0 +1,1492 @@ +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_netbsd_amd64.go -pkgname fcntl', DO NOT EDIT. + +package fcntl + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AT_EACCESS = 0x100 + AT_FDCWD = -100 + AT_REMOVEDIR = 0x800 + AT_SYMLINK_FOLLOW = 0x400 + AT_SYMLINK_NOFOLLOW = 0x200 + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FAPPEND = 8 + FASYNC = 64 + FD_CLOEXEC = 1 + FD_SETSIZE = 256 + FNDELAY = 4 + FREAD = 0x00000001 + FWRITE = 0x00000002 + F_CLOSEM = 10 + F_DUPFD = 0 + F_DUPFD_CLOEXEC = 12 + F_GETFD = 1 + F_GETFL = 3 + F_GETLK = 7 + F_GETNOSIGPIPE = 13 + F_GETOWN = 5 + F_MAXFD = 11 + F_PARAM_MASK = 0xfff + F_PARAM_MAX = 4095 + F_RDLCK = 1 + F_SETFD = 2 + F_SETFL = 4 + F_SETLK = 8 + F_SETLKW = 9 + F_SETNOSIGPIPE = 14 + F_SETOWN = 6 + F_UNLCK = 2 + F_WRLCK = 3 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + LITTLE_ENDIAN = 1234 + LOCK_EX = 0x02 + LOCK_NB = 0x04 + LOCK_SH = 0x01 + LOCK_UN = 0x08 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + O_ACCMODE = 0x00000003 + O_ALT_IO = 0x00040000 + O_APPEND = 0x00000008 + O_ASYNC = 0x00000040 + O_CLOEXEC = 0x00400000 + O_CREAT = 0x00000200 + O_DIRECT = 0x00080000 + O_DIRECTORY = 0x00200000 + O_DSYNC = 0x00010000 + O_EXCL = 0x00000800 + O_EXLOCK = 0x00000020 + O_FSYNC = 128 + O_NDELAY = 4 + O_NOCTTY = 0x00008000 + O_NOFOLLOW = 0x00000100 + O_NONBLOCK = 0x00000004 + O_NOSIGPIPE = 0x01000000 + O_RDONLY = 0x00000000 + O_RDWR = 0x00000002 + O_REGULAR = 0x02000000 + O_RSYNC = 0x00020000 + O_SEARCH = 0x00800000 + O_SHLOCK = 0x00000010 + O_SYNC = 0x00000080 + O_TRUNC = 0x00000400 + O_WRONLY = 0x00000001 + PDP_ENDIAN = 3412 + POSIX_FADV_DONTNEED = 4 + POSIX_FADV_NOREUSE = 5 + POSIX_FADV_NORMAL = 0 + POSIX_FADV_RANDOM = 1 + POSIX_FADV_SEQUENTIAL = 2 + POSIX_FADV_WILLNEED = 3 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FCNTL_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// File status flags: these are used by open(2), fcntl(2). +// They are also used (indirectly) in the kernel file structure f_flags, +// which is a superset of the open/fcntl flags. Open flags and f_flags +// are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). +// Open/fcntl flags begin with O_; kernel-internal flags begin with F. +// open-only flags + +// Kernel encoding of open mode; separate read and write bits that are +// independently testable: 1 greater than the above. +// +// XXX +// FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, +// which was documented to use FREAD/FWRITE, continues to work. +// path component + +// defined by POSIX 1003.1; BSD default, but required to be bitwise distinct + +// The O_* flags used to have only F* names, which were used in the kernel +// and by fcntl. We retain the F* names for the kernel f_flags field +// and for backward compatibility for fcntl. + +// Constants used for fcntl(2) + +// command values + +// file descriptor flags (F_GETFD, F_SETFD) + +// record locking flags (F_GETLK, F_SETLK, F_SETLKW) + +// Constants for fcntl's passed to the underlying fs - like ioctl's. + +// Define command macros for operations which, if implemented, must be +// the same for all fs's. + +// Define command macros for fs-specific commands. + +// Advisory file segment locking data type - +// information passed to system by user +type Flock = struct { + Fl_start X__off_t + Fl_len X__off_t + Fl_pid X__pid_t + Fl_type int16 + Fl_whence int16 +} /* fcntl.h:252:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/fcntl/fcntl_windows_386.go b/vendor/modernc.org/libc/fcntl/fcntl_windows_386.go index 3b66b652..9d871c7c 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_windows_386.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_386.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_386.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fcntl/fcntl_windows_amd64.go b/vendor/modernc.org/libc/fcntl/fcntl_windows_amd64.go index 36fc8472..aa8f7e87 100644 --- a/vendor/modernc.org/libc/fcntl/fcntl_windows_amd64.go +++ b/vendor/modernc.org/libc/fcntl/fcntl_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_amd64.go -pkgname fcntl', DO NOT EDIT. +// Code generated by 'ccgo fcntl/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fcntl/fcntl_windows_amd64.go -pkgname fcntl', DO NOT EDIT. package fcntl diff --git a/vendor/modernc.org/libc/fsync.go b/vendor/modernc.org/libc/fsync.go index c128fbab..dacf2528 100644 --- a/vendor/modernc.org/libc/fsync.go +++ b/vendor/modernc.org/libc/fsync.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !libc.nofsync // +build !libc.nofsync package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/fts/capi_darwin_amd64.go b/vendor/modernc.org/libc/fts/capi_darwin_amd64.go index 39f9e22a..2a2cd65c 100644 --- a/vendor/modernc.org/libc/fts/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/fts/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_darwin_amd64.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_darwin_amd64.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/capi_freebsd_amd64.go b/vendor/modernc.org/libc/fts/capi_freebsd_amd64.go new file mode 100644 index 00000000..b5b97ba4 --- /dev/null +++ b/vendor/modernc.org/libc/fts/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_freebsd_amd64.go -pkgname fts', DO NOT EDIT. + +package fts + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/fts/capi_linux_386.go b/vendor/modernc.org/libc/fts/capi_linux_386.go index 8afe3f10..864dbf8e 100644 --- a/vendor/modernc.org/libc/fts/capi_linux_386.go +++ b/vendor/modernc.org/libc/fts/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_386.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_386.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/capi_linux_amd64.go b/vendor/modernc.org/libc/fts/capi_linux_amd64.go index 3056c527..7c6e5848 100644 --- a/vendor/modernc.org/libc/fts/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/fts/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_amd64.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_amd64.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/capi_linux_arm.go b/vendor/modernc.org/libc/fts/capi_linux_arm.go index 4fc728a5..5e721c12 100644 --- a/vendor/modernc.org/libc/fts/capi_linux_arm.go +++ b/vendor/modernc.org/libc/fts/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/capi_linux_arm64.go b/vendor/modernc.org/libc/fts/capi_linux_arm64.go index 9653d2a5..24a78a6c 100644 --- a/vendor/modernc.org/libc/fts/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/fts/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm64.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm64.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/capi_linux_s390x.go b/vendor/modernc.org/libc/fts/capi_linux_s390x.go index 5151cacd..4d0ce9b2 100644 --- a/vendor/modernc.org/libc/fts/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/fts/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_s390x.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_s390x.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/capi_netbsd_amd64.go b/vendor/modernc.org/libc/fts/capi_netbsd_amd64.go new file mode 100644 index 00000000..c643a998 --- /dev/null +++ b/vendor/modernc.org/libc/fts/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo fts/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_netbsd_amd64.go -pkgname fts', DO NOT EDIT. + +package fts + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/fts/fts_darwin_amd64.go b/vendor/modernc.org/libc/fts/fts_darwin_amd64.go index 9c5240fe..c3e5d491 100644 --- a/vendor/modernc.org/libc/fts/fts_darwin_amd64.go +++ b/vendor/modernc.org/libc/fts/fts_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_darwin_amd64.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_darwin_amd64.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/fts_freebsd_amd64.go b/vendor/modernc.org/libc/fts/fts_freebsd_amd64.go new file mode 100644 index 00000000..5e562f48 --- /dev/null +++ b/vendor/modernc.org/libc/fts/fts_freebsd_amd64.go @@ -0,0 +1,642 @@ +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_freebsd_amd64.go -pkgname fts', DO NOT EDIT. + +package fts + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + FTS_AGAIN = 1 + FTS_COMFOLLOW = 0x001 + FTS_D = 1 + FTS_DC = 2 + FTS_DEFAULT = 3 + FTS_DNR = 4 + FTS_DONTCHDIR = 0x01 + FTS_DOT = 5 + FTS_DP = 6 + FTS_ERR = 7 + FTS_F = 8 + FTS_FOLLOW = 2 + FTS_INIT = 9 + FTS_ISW = 0x04 + FTS_LOGICAL = 0x002 + FTS_NAMEONLY = 0x100 + FTS_NOCHDIR = 0x004 + FTS_NOINSTR = 3 + FTS_NOSTAT = 0x008 + FTS_NS = 10 + FTS_NSOK = 11 + FTS_OPTIONMASK = 0x0ff + FTS_PHYSICAL = 0x010 + FTS_ROOTLEVEL = 0 + FTS_ROOTPARENTLEVEL = -1 + FTS_SEEDOT = 0x020 + FTS_SKIP = 4 + FTS_SL = 12 + FTS_SLNONE = 13 + FTS_STOP = 0x200 + FTS_SYMFOLLOW = 0x02 + FTS_W = 14 + FTS_WHITEOUT = 0x080 + FTS_XDEV = 0x040 + X_FILE_OFFSET_BITS = 64 + X_FTS_H_ = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type X_ftsent = struct { + Ffts_cycle uintptr + Ffts_parent uintptr + Ffts_link uintptr + Ffts_number int64 + Ffts_pointer uintptr + Ffts_accpath uintptr + Ffts_path uintptr + Ffts_errno int32 + Ffts_symfd int32 + Ffts_pathlen X__size_t + Ffts_namelen X__size_t + Ffts_ino X__ino_t + Ffts_dev X__dev_t + Ffts_nlink X__nlink_t + Ffts_level int64 + Ffts_info int32 + Ffts_flags uint32 + Ffts_instr int32 + _ [4]byte + Ffts_statp uintptr + Ffts_name uintptr + Ffts_fts uintptr +} /* fts.h:41:2 */ + +// compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type FTS = struct { + Ffts_cur uintptr + Ffts_child uintptr + Ffts_array uintptr + Ffts_dev X__dev_t + Ffts_path uintptr + Ffts_rfd int32 + _ [4]byte + Ffts_pathlen X__size_t + Ffts_nitems X__size_t + Ffts_compar uintptr + Ffts_options int32 + _ [4]byte + Ffts_clientptr uintptr +} /* fts.h:66:3 */ + +type FTSENT = X_ftsent /* fts.h:120:3 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/fts/fts_linux_386.go b/vendor/modernc.org/libc/fts/fts_linux_386.go index 2627f9f2..b5bf305c 100644 --- a/vendor/modernc.org/libc/fts/fts_linux_386.go +++ b/vendor/modernc.org/libc/fts/fts_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_386.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_386.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/fts_linux_amd64.go b/vendor/modernc.org/libc/fts/fts_linux_amd64.go index d339e08e..37114707 100644 --- a/vendor/modernc.org/libc/fts/fts_linux_amd64.go +++ b/vendor/modernc.org/libc/fts/fts_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_amd64.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_amd64.go -pkgname fts', DO NOT EDIT. package fts @@ -15,8 +15,11 @@ var _ atomic.Value var _ unsafe.Pointer const ( + ACCESSPERMS = 511 + ALLPERMS = 4095 BIG_ENDIAN = 4321 BYTE_ORDER = 1234 + DEFFILEMODE = 438 FD_SETSIZE = 1024 FTS_AGAIN = 1 FTS_COMFOLLOW = 0x0001 @@ -53,10 +56,40 @@ const ( FTS_XDEV = 0x0040 LITTLE_ENDIAN = 1234 PDP_ENDIAN = 3412 + S_BLKSIZE = 512 + S_IEXEC = 64 + S_IFBLK = 24576 + S_IFCHR = 8192 + S_IFDIR = 16384 + S_IFIFO = 4096 + S_IFLNK = 40960 + S_IFMT = 61440 + S_IFREG = 32768 + S_IFSOCK = 49152 + S_IREAD = 256 + S_IRGRP = 32 + S_IROTH = 4 + S_IRUSR = 256 + S_IRWXG = 56 + S_IRWXO = 7 + S_IRWXU = 448 + S_ISGID = 1024 + S_ISUID = 2048 + S_ISVTX = 512 + S_IWGRP = 16 + S_IWOTH = 2 + S_IWRITE = 128 + S_IWUSR = 128 + S_IXGRP = 8 + S_IXOTH = 1 + S_IXUSR = 64 + UTIME_NOW = 1073741823 + UTIME_OMIT = 1073741822 X_ATFILE_SOURCE = 1 X_BITS_BYTESWAP_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 + X_BITS_STAT_H = 1 X_BITS_STDINT_INTN_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 @@ -70,6 +103,8 @@ const ( X_FTS_H = 1 X_GCC_SIZE_T = 0 X_LP64 = 1 + X_MKNOD_VER = 0 + X_MKNOD_VER_LINUX = 0 X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 X_SIZET_ = 0 @@ -78,11 +113,18 @@ const ( X_SIZE_T_DECLARED = 0 X_SIZE_T_DEFINED = 0 X_SIZE_T_DEFINED_ = 0 + X_STATBUF_ST_BLKSIZE = 0 + X_STATBUF_ST_NSEC = 0 + X_STATBUF_ST_RDEV = 0 + X_STAT_VER = 1 + X_STAT_VER_KERNEL = 0 + X_STAT_VER_LINUX = 1 X_STDC_PREDEF_H = 1 X_STRUCT_TIMESPEC = 1 X_SYS_CDEFS_H = 1 X_SYS_SELECT_H = 1 X_SYS_SIZE_T_H = 0 + X_SYS_STAT_H = 1 X_SYS_TYPES_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 @@ -109,8 +151,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// File tree traversal functions declarations. -// Copyright (C) 1994-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -127,34 +168,7 @@ type X__float128 = float64 /* :47:21 */ // License along with the GNU C Library; if not, see // . -// Copyright (c) 1989, 1993 -// The Regents of the University of California. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 4. Neither the name of the University nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// -// @(#)fts.h 8.3 (Berkeley) 8/14/94 +// POSIX Standard: 2.6 Primitive System Data Types // Copyright (C) 1991-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. @@ -558,42 +572,6 @@ type X__float128 = float64 /* :47:21 */ // in the C library which is a stub, meaning it will fail // every time called, usually setting errno to ENOSYS. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// POSIX Standard: 2.6 Primitive System Data Types - -// Copyright (C) 1991-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - // bits/types.h -- definitions of __*_t types underlying *_t types. // Copyright (C) 2002-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. @@ -1401,6 +1379,198 @@ type Pthread_barrierattr_t = struct { F__size [4]int8 } /* pthreadtypes.h:118:3 */ +// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// POSIX Standard: 5.6 File Characteristics + +// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// NB: Include guard matches what uses. + +// The Single Unix specification says that some more types are +// available here. + +// Copyright (C) 1999-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Versions of the `struct stat' data structure. + +// x86-64 versions of the `xmknod' interface. + +type Stat = struct { + Fst_dev X__dev_t + Fst_ino X__ino_t + Fst_nlink X__nlink_t + Fst_mode X__mode_t + Fst_uid X__uid_t + Fst_gid X__gid_t + F__pad0 int32 + Fst_rdev X__dev_t + Fst_size X__off_t + Fst_blksize X__blksize_t + Fst_blocks X__blkcnt_t + Fst_atim struct { + Ftv_sec X__time_t + Ftv_nsec X__syscall_slong_t + } + Fst_mtim struct { + Ftv_sec X__time_t + Ftv_nsec X__syscall_slong_t + } + Fst_ctim struct { + Ftv_sec X__time_t + Ftv_nsec X__syscall_slong_t + } + F__glibc_reserved [3]X__syscall_slong_t +} /* stat.h:46:1 */ + +// File tree traversal functions declarations. +// Copyright (C) 1994-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 + +// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// POSIX Standard: 2.6 Primitive System Data Types + type X_ftsent = struct { Ffts_cycle uintptr Ffts_parent uintptr @@ -1426,6 +1596,89 @@ type X_ftsent = struct { _ [7]byte } /* fts.h:58:2 */ +// File tree traversal functions declarations. +// Copyright (C) 1994-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 + +// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// POSIX Standard: 2.6 Primitive System Data Types + type FTS = struct { Ffts_cur uintptr Ffts_child uintptr @@ -1443,4 +1696,4 @@ type FTS = struct { type FTSENT = X_ftsent /* fts.h:147:3 */ -var _ int8 /* gen.c:2:13: */ +var _ int8 /* gen.c:5:13: */ diff --git a/vendor/modernc.org/libc/fts/fts_linux_arm.go b/vendor/modernc.org/libc/fts/fts_linux_arm.go index 4b350b83..ab77306c 100644 --- a/vendor/modernc.org/libc/fts/fts_linux_arm.go +++ b/vendor/modernc.org/libc/fts/fts_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/fts_linux_arm64.go b/vendor/modernc.org/libc/fts/fts_linux_arm64.go index 792b4b9d..3498a46e 100644 --- a/vendor/modernc.org/libc/fts/fts_linux_arm64.go +++ b/vendor/modernc.org/libc/fts/fts_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm64.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_arm64.go -pkgname fts', DO NOT EDIT. package fts diff --git a/vendor/modernc.org/libc/fts/fts_linux_s390x.go b/vendor/modernc.org/libc/fts/fts_linux_s390x.go index d1b34645..d007dd09 100644 --- a/vendor/modernc.org/libc/fts/fts_linux_s390x.go +++ b/vendor/modernc.org/libc/fts/fts_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_s390x.go -pkgname fts', DO NOT EDIT. +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_linux_s390x.go -pkgname fts', DO NOT EDIT. package fts @@ -15,8 +15,11 @@ var _ atomic.Value var _ unsafe.Pointer const ( + ACCESSPERMS = 511 + ALLPERMS = 4095 BIG_ENDIAN = 4321 BYTE_ORDER = 4321 + DEFFILEMODE = 438 FD_SETSIZE = 1024 FTS_AGAIN = 1 FTS_COMFOLLOW = 0x0001 @@ -53,11 +56,44 @@ const ( FTS_XDEV = 0x0040 LITTLE_ENDIAN = 1234 PDP_ENDIAN = 3412 + S_BLKSIZE = 512 + S_IEXEC = 64 + S_IFBLK = 24576 + S_IFCHR = 8192 + S_IFDIR = 16384 + S_IFIFO = 4096 + S_IFLNK = 40960 + S_IFMT = 61440 + S_IFREG = 32768 + S_IFSOCK = 49152 + S_IREAD = 256 + S_IRGRP = 32 + S_IROTH = 4 + S_IRUSR = 256 + S_IRWXG = 56 + S_IRWXO = 7 + S_IRWXU = 448 + S_ISGID = 1024 + S_ISUID = 2048 + S_ISVTX = 512 + S_IWGRP = 16 + S_IWOTH = 2 + S_IWRITE = 128 + S_IWUSR = 128 + S_IXGRP = 8 + S_IXOTH = 1 + S_IXUSR = 64 + UTIME_NOW = 1073741823 + UTIME_OMIT = 1073741822 X_ATFILE_SOURCE = 1 X_BITS_BYTESWAP_H = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 + X_BITS_STAT_H = 1 X_BITS_STDINT_INTN_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BITS_UINTN_IDENTITY_H = 1 @@ -70,20 +106,31 @@ const ( X_FTS_H = 1 X_GCC_SIZE_T = 0 X_LP64 = 1 + X_MKNOD_VER = 0 + X_MKNOD_VER_LINUX = 0 X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 + X_RWLOCK_INTERNAL_H = 0 X_SIZET_ = 0 X_SIZE_T = 0 X_SIZE_T_ = 0 X_SIZE_T_DECLARED = 0 X_SIZE_T_DEFINED = 0 X_SIZE_T_DEFINED_ = 0 + X_STATBUF_ST_BLKSIZE = 0 + X_STATBUF_ST_NSEC = 0 + X_STATBUF_ST_RDEV = 0 + X_STAT_VER = 1 + X_STAT_VER_KERNEL = 0 + X_STAT_VER_LINUX = 1 X_STDC_PREDEF_H = 1 X_STRUCT_TIMESPEC = 1 X_SYS_CDEFS_H = 1 X_SYS_SELECT_H = 1 X_SYS_SIZE_T_H = 0 + X_SYS_STAT_H = 1 X_SYS_TYPES_H = 1 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 X_T_SIZE_ = 0 @@ -109,8 +156,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// File tree traversal functions declarations. -// Copyright (C) 1994-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -125,38 +171,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (c) 1989, 1993 -// The Regents of the University of California. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 4. Neither the name of the University nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// -// @(#)fts.h 8.3 (Berkeley) 8/14/94 +// POSIX Standard: 2.6 Primitive System Data Types -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -171,7 +190,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -179,6 +198,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -299,6 +319,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -321,9 +343,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -338,7 +373,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -351,7 +386,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -366,7 +401,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -481,7 +516,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -498,14 +533,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -520,7 +553,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -556,44 +589,8 @@ type X__float128 = float64 /* :47:21 */ // in the C library which is a stub, meaning it will fail // every time called, usually setting errno to ENOSYS. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// POSIX Standard: 2.6 Primitive System Data Types - -// Copyright (C) 1991-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -608,11 +605,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -627,43 +624,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -675,7 +694,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -696,7 +715,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -711,7 +730,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -726,78 +745,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. type U_char = X__u_char /* types.h:33:18 */ type U_short = X__u_short /* types.h:34:19 */ @@ -834,7 +881,7 @@ type Caddr_t = X__caddr_t /* types.h:115:19 */ type Key_t = X__key_t /* types.h:121:17 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -849,7 +896,7 @@ type Key_t = X__key_t /* types.h:121:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -857,7 +904,7 @@ type Key_t = X__key_t /* types.h:121:17 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -872,7 +919,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -880,7 +927,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -895,7 +942,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -903,7 +950,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Time_t = X__time_t /* time_t.h:7:18 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -918,7 +965,7 @@ type Time_t = X__time_t /* time_t.h:7:18 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -948,7 +995,7 @@ type Uint = uint32 /* types.h:150:22 */ // These size-specific names are used by some of the inet code. // Define intN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -963,10 +1010,10 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -981,7 +1028,7 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -990,18 +1037,17 @@ type Int16_t = X__int16_t /* stdint-intn.h:25:19 */ type Int32_t = X__int32_t /* stdint-intn.h:26:19 */ type Int64_t = X__int64_t /* stdint-intn.h:27:19 */ -// For GCC 2.7 and later, we can use specific type-size attributes. +// These were defined by ISO C without the first `_'. +type U_int8_t = X__uint8_t /* types.h:158:19 */ +type U_int16_t = X__uint16_t /* types.h:159:20 */ +type U_int32_t = X__uint32_t /* types.h:160:20 */ +type U_int64_t = X__uint64_t /* types.h:161:20 */ -type U_int8_t = uint32 /* types.h:177:1 */ -type U_int16_t = uint32 /* types.h:178:1 */ -type U_int32_t = uint32 /* types.h:179:1 */ -type U_int64_t = uint32 /* types.h:180:1 */ - -type Register_t = int32 /* types.h:182:13 */ +type Register_t = int32 /* types.h:164:13 */ // It also defines `fd_set' and the FD_* macros for `select'. // `fd_set' type and related macros, and `select'/`pselect' declarations. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1016,11 +1062,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX 1003.1g: 6.2 Select from File Descriptor Sets -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1035,11 +1081,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Get definition of needed basic types. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1054,12 +1100,12 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Get __FD_* definitions. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1074,7 +1120,7 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We don't use `memset' because this would require a prototype and // the array isn't too big. @@ -1089,7 +1135,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // Get definition of timer specification structures. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1104,7 +1150,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1118,7 +1164,27 @@ type Timeval = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1135,14 +1201,12 @@ type Timeval = struct { // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. - // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ type Suseconds_t = X__suseconds_t /* select.h:43:23 */ @@ -1162,16 +1226,16 @@ type Fd_mask = X__fd_mask /* select.h:77:19 */ // Define some inlines helping to catch common problems. -type Blksize_t = X__blksize_t /* types.h:202:21 */ +type Blksize_t = X__blksize_t /* types.h:185:21 */ // Types from the Large File Support interface. -type Blkcnt_t = X__blkcnt64_t /* types.h:222:22 */ // Type to count number of disk blocks. -type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:226:24 */ // Type to count file system blocks. -type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file system inodes. +type Blkcnt_t = X__blkcnt64_t /* types.h:205:22 */ // Type to count number of disk blocks. +type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:209:24 */ // Type to count file system blocks. +type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:213:24 */ // Type to count file system inodes. // Now add the thread types. // Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1186,11 +1250,11 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // For internal mutex and condition variable definitions. // Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1205,7 +1269,7 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -1220,36 +1284,6 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -1258,11 +1292,10 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1281,7 +1314,176 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Type to count file system inodes. + +// Now add the thread types. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -1296,31 +1498,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -1332,7 +1510,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -1342,14 +1520,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -1360,7 +1538,7 @@ type Pthread_once_t = int32 /* pthreadtypes.h:53:30 */ type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* pthreadtypes.h:56:1 */ type Pthread_attr_t = Pthread_attr_t1 /* pthreadtypes.h:62:30 */ @@ -1375,7 +1553,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -1385,14 +1563,208 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// POSIX Standard: 5.6 File Characteristics + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// NB: Include guard matches what uses. + +// The Single Unix specification says that some more types are +// available here. + +// Copyright (C) 2000-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Versions of the `struct stat' data structure. + +// Versions of the `xmknod' interface. + +type Stat = struct { + Fst_dev X__dev_t + Fst_ino X__ino_t + Fst_nlink X__nlink_t + Fst_mode X__mode_t + Fst_uid X__uid_t + Fst_gid X__gid_t + F__glibc_reserved0 int32 + Fst_rdev X__dev_t + Fst_size X__off_t + Fst_atim struct { + Ftv_sec X__time_t + Ftv_nsec X__syscall_slong_t + } + Fst_mtim struct { + Ftv_sec X__time_t + Ftv_nsec X__syscall_slong_t + } + Fst_ctim struct { + Ftv_sec X__time_t + Ftv_nsec X__syscall_slong_t + } + Fst_blksize X__blksize_t + Fst_blocks X__blkcnt_t + F__glibc_reserved [3]int64 +} /* stat.h:50:1 */ + +// File tree traversal functions declarations. +// Copyright (C) 1994-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// POSIX Standard: 2.6 Primitive System Data Types + type X_ftsent = struct { Ffts_cycle uintptr Ffts_parent uintptr @@ -1414,10 +1786,93 @@ type X_ftsent = struct { Ffts_flags uint16 Ffts_instr uint16 Ffts_statp uintptr - Ffts_name [1]int8 + Ffts_name [1]uint8 _ [7]byte } /* fts.h:58:2 */ +// File tree traversal functions declarations. +// Copyright (C) 1994-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// POSIX Standard: 2.6 Primitive System Data Types + type FTS = struct { Ffts_cur uintptr Ffts_child uintptr @@ -1435,4 +1890,4 @@ type FTS = struct { type FTSENT = X_ftsent /* fts.h:147:3 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:5:13: */ diff --git a/vendor/modernc.org/libc/fts/fts_netbsd_amd64.go b/vendor/modernc.org/libc/fts/fts_netbsd_amd64.go new file mode 100644 index 00000000..fa661204 --- /dev/null +++ b/vendor/modernc.org/libc/fts/fts_netbsd_amd64.go @@ -0,0 +1,2655 @@ +// Code generated by 'ccgo fts/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o fts/fts_netbsd_amd64.go -pkgname fts', DO NOT EDIT. + +package fts + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ACCESSPERMS = 511 + ALLPERMS = 4095 + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + CLOCKS_PER_SEC = 100 + CLOCK_MONOTONIC = 3 + CLOCK_PROCESS_CPUTIME_ID = 0x40000000 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_THREAD_CPUTIME_ID = 0x20000000 + CLOCK_VIRTUAL = 1 + DEFFILEMODE = 438 + FD_SETSIZE = 256 + FTS_AGAIN = 1 + FTS_COMFOLLOW = 0x001 + FTS_D = 1 + FTS_DC = 2 + FTS_DEFAULT = 3 + FTS_DNR = 4 + FTS_DONTCHDIR = 0x01 + FTS_DOT = 5 + FTS_DP = 6 + FTS_ERR = 7 + FTS_F = 8 + FTS_FOLLOW = 2 + FTS_INIT = 9 + FTS_ISW = 0x04 + FTS_LOGICAL = 0x002 + FTS_NAMEONLY = 0x100 + FTS_NOCHDIR = 0x004 + FTS_NOINSTR = 3 + FTS_NOSTAT = 0x008 + FTS_NS = 10 + FTS_NSOK = 11 + FTS_OPTIONMASK = 0x0ff + FTS_PHYSICAL = 0x010 + FTS_ROOTLEVEL = 0 + FTS_ROOTPARENTLEVEL = -1 + FTS_SEEDOT = 0x020 + FTS_SKIP = 4 + FTS_SL = 12 + FTS_SLNONE = 13 + FTS_STOP = 0x200 + FTS_SYMFOLLOW = 0x02 + FTS_W = 14 + FTS_WHITEOUT = 0x080 + FTS_XDEV = 0x040 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + ITIMER_MONOTONIC = 3 + ITIMER_PROF = 2 + ITIMER_REAL = 0 + ITIMER_VIRTUAL = 1 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SF_APPEND = 0x00040000 + SF_ARCHIVED = 0x00010000 + SF_IMMUTABLE = 0x00020000 + SF_LOG = 0x00400000 + SF_SETTABLE = 0xffff0000 + SF_SNAPINVAL = 0x00800000 + SF_SNAPSHOT = 0x00200000 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + S_ARCH1 = 65536 + S_ARCH2 = 131072 + S_BLKSIZE = 512 + S_IEXEC = 64 + S_IFBLK = 24576 + S_IFCHR = 8192 + S_IFDIR = 16384 + S_IFIFO = 4096 + S_IFLNK = 40960 + S_IFMT = 61440 + S_IFREG = 32768 + S_IFSOCK = 49152 + S_IFWHT = 57344 + S_IREAD = 256 + S_IRGRP = 0000040 + S_IROTH = 0000004 + S_IRUSR = 0000400 + S_IRWXG = 0000070 + S_IRWXO = 0000007 + S_IRWXU = 0000700 + S_ISGID = 0002000 + S_ISTXT = 0001000 + S_ISUID = 0004000 + S_ISVTX = 512 + S_IWGRP = 0000020 + S_IWOTH = 0000002 + S_IWRITE = 128 + S_IWUSR = 0000200 + S_IXGRP = 0000010 + S_IXOTH = 0000001 + S_IXUSR = 0000100 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + UF_APPEND = 0x00000004 + UF_IMMUTABLE = 0x00000002 + UF_NODUMP = 0x00000001 + UF_OPAQUE = 0x00000008 + UF_SETTABLE = 0x0000ffff + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + UTIME_NOW = 1073741823 + UTIME_OMIT = 1073741822 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_FTS_H_ = 0 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_IDTYPE_H_ = 0 + X_SYS_NULL_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_STAT_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TIME_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_S_ARCH1 = 0200000 + X_S_ARCH2 = 0400000 + X_S_IFBLK = 0060000 + X_S_IFCHR = 0020000 + X_S_IFDIR = 0040000 + X_S_IFIFO = 0010000 + X_S_IFLNK = 0120000 + X_S_IFMT = 0170000 + X_S_IFREG = 0100000 + X_S_IFSOCK = 0140000 + X_S_IFWHT = 0160000 + X_S_ISVTX = 0001000 + X_TIME_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +const ( /* idtype.h:41:1: */ + P_MYID = -1 // Me/my process group + P_ALL = 0 // All processes. + P_PID = 1 // A process identifier. + P_LWPID = 2 // An LWP identifier. + P_PPID = 3 // A parent process identifier. + P_PGID = 4 // A process group identifier. + P_SID = 5 // A session identifier. + P_CID = 6 // A scheduling class identifier. + P_UID = 7 // A user identifier. + P_GID = 8 // A group identifier. + P_TASKID = 9 // A task identifier. + P_PROJID = 10 // A project identifier. + P_POOLID = 11 // A pool identifier. + P_ZONEID = 12 // A zone identifier. + P_CTID = 13 // A (process) contract identifier. + P_CPUID = 14 // CPU identifier. + P_PSETID = 15 // Processor set identifier. + X_P_MAXIDTYPE = 2147483647 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// $NetBSD: stat.h,v 1.68 2013/10/17 18:01:11 njoly Exp $ + +// - +// Copyright (c) 1982, 1986, 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)stat.h 8.12 (Berkeley) 8/17/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// POSIX:2008 / XPG7 requires struct timespec to be declared in +// this header, but does not provide the usual exemption +// "inclusion of this header may make visible symbols defined in ". +// +// This is a Standard omission, acknowledged by the committee and +// scheduled to be corrected in Technical Corrigendum 2, according to +// http://austingroupbugs.net/view.php?id=531 +// $NetBSD: time.h,v 1.79 2017/01/17 15:28:34 maya Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// Structure returned by gettimeofday(2) system call, +// and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte +} /* time.h:44:1 */ + +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* timespec.h:47:1 */ + +// Note: timezone is obsolete. All timezone handling is now in +// userland. Its just here for back compatibility. +type Timezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} /* time.h:65:1 */ + +// Operations on timevals. + +// hide bintime for _STANDALONE because this header is used for hpcboot.exe, +// which is built with compilers which don't recognize LL suffix. +// http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html +type Bintime = struct { + Fsec Time_t + Ffrac Uint64_t +} /* time.h:102:1 */ + +// Operations on timespecs. + +// Names of the interval timers, and structure +// defining a timer setting. +// NB: Must match the CLOCK_ constants below. + +type Itimerval = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } + Fit_value struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } +} /* time.h:280:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* time.h:289:1 */ + +// $NetBSD: select.h,v 1.37 2014/04/25 15:52:45 pooka Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)select.h 8.2 (Berkeley) 1/4/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ + +// $NetBSD: time.h,v 1.47 2016/10/04 09:41:41 kamil Exp $ + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ + +// Written by Klaus Klein , December 22, 1999. +// Public domain. + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:75:1 */ + +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +type Idtype_t = int32 /* idtype.h:60:3 */ + +type Locale_t = uintptr /* time.h:188:25 */ + +type Timezone_t = uintptr /* time.h:198:24 */ + +type Stat = struct { + Fst_dev Dev_t + Fst_mode X__mode_t + _ [4]byte + Fst_ino Ino_t + Fst_nlink Nlink_t + Fst_uid X__uid_t + Fst_gid X__gid_t + _ [4]byte + Fst_rdev Dev_t + Fst_atim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_mtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_ctim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_birthtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_size X__off_t + Fst_blocks Blkcnt_t + Fst_blksize Blksize_t + Fst_flags Uint32_t + Fst_gen Uint32_t + Fst_spare [2]Uint32_t + _ [4]byte +} /* stat.h:59:1 */ + +// $NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $ + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 + +type X_ftsent = struct { + Ffts_cycle uintptr + Ffts_parent uintptr + Ffts_link uintptr + Ffts_number Int64_t + Ffts_pointer uintptr + Ffts_accpath uintptr + Ffts_path uintptr + Ffts_errno int32 + Ffts_symfd int32 + Ffts_pathlen uint32 + Ffts_namelen uint32 + Ffts_ino Ino_t + Ffts_dev Dev_t + Ffts_nlink Nlink_t + Ffts_level int32 + Ffts_info uint16 + Ffts_flags uint16 + Ffts_instr uint16 + _ [2]byte + Ffts_statp uintptr + Ffts_name [1]int8 + _ [7]byte +} /* fts.h:60:2 */ + +// $NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $ + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fts.h 8.3 (Berkeley) 8/14/94 + +type FTS = struct { + Ffts_cur uintptr + Ffts_child uintptr + Ffts_array uintptr + Ffts_dev Dev_t + Ffts_path uintptr + Ffts_rfd int32 + Ffts_pathlen uint32 + Ffts_nitems uint32 + _ [4]byte + Ffts_compar uintptr + Ffts_options int32 + _ [4]byte +} /* fts.h:84:3 */ + +type FTSENT = X_ftsent /* fts.h:136:3 */ + +var _ int8 /* gen.c:5:13: */ diff --git a/vendor/modernc.org/libc/grp/capi_darwin_amd64.go b/vendor/modernc.org/libc/grp/capi_darwin_amd64.go index a26dafb7..b01ff6e7 100644 --- a/vendor/modernc.org/libc/grp/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/grp/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_darwin_amd64.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_darwin_amd64.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/capi_freebsd_amd64.go b/vendor/modernc.org/libc/grp/capi_freebsd_amd64.go new file mode 100644 index 00000000..497b372f --- /dev/null +++ b/vendor/modernc.org/libc/grp/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_freebsd_amd64.go -pkgname grp', DO NOT EDIT. + +package grp + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/grp/capi_linux_386.go b/vendor/modernc.org/libc/grp/capi_linux_386.go index ed5b5962..107535a6 100644 --- a/vendor/modernc.org/libc/grp/capi_linux_386.go +++ b/vendor/modernc.org/libc/grp/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_386.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_386.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/capi_linux_amd64.go b/vendor/modernc.org/libc/grp/capi_linux_amd64.go index e13e8d93..f22fdd28 100644 --- a/vendor/modernc.org/libc/grp/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/grp/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_amd64.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_amd64.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/capi_linux_arm.go b/vendor/modernc.org/libc/grp/capi_linux_arm.go index 767896cd..3badd214 100644 --- a/vendor/modernc.org/libc/grp/capi_linux_arm.go +++ b/vendor/modernc.org/libc/grp/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/capi_linux_arm64.go b/vendor/modernc.org/libc/grp/capi_linux_arm64.go index 15e15427..1d9f5cad 100644 --- a/vendor/modernc.org/libc/grp/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/grp/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm64.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm64.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/capi_linux_s390x.go b/vendor/modernc.org/libc/grp/capi_linux_s390x.go index 25a4dd36..69d68e1b 100644 --- a/vendor/modernc.org/libc/grp/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/grp/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_s390x.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_s390x.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/capi_netbsd_amd64.go b/vendor/modernc.org/libc/grp/capi_netbsd_amd64.go new file mode 100644 index 00000000..0641828c --- /dev/null +++ b/vendor/modernc.org/libc/grp/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo grp/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_netbsd_amd64.go -pkgname grp', DO NOT EDIT. + +package grp + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/grp/grp_darwin_amd64.go b/vendor/modernc.org/libc/grp/grp_darwin_amd64.go index c5b00222..0de32ad5 100644 --- a/vendor/modernc.org/libc/grp/grp_darwin_amd64.go +++ b/vendor/modernc.org/libc/grp/grp_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_darwin_amd64.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_darwin_amd64.go -pkgname grp', DO NOT EDIT. package grp @@ -989,6 +989,4 @@ type Uuid_t = X__darwin_uuid_t /* _uuid_t.h:31:25 */ type Uuid_string_t = X__darwin_uuid_string_t /* uuid.h:43:33 */ -var sUUID_NULL = Uuid_t{uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0)} /* uuid.h:49:1 */ - var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/grp/grp_freebsd_amd64.go b/vendor/modernc.org/libc/grp/grp_freebsd_amd64.go new file mode 100644 index 00000000..f46ebabd --- /dev/null +++ b/vendor/modernc.org/libc/grp/grp_freebsd_amd64.go @@ -0,0 +1,613 @@ +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_freebsd_amd64.go -pkgname grp', DO NOT EDIT. + +package grp + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + X_FILE_OFFSET_BITS = 64 + X_GID_T_DECLARED = 0 + X_GRP_H_ = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PATH_GROUP = "/etc/group" + X_SIZE_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)grp.h 8.2 (Berkeley) 1/21/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Gid_t = X__gid_t /* grp.h:49:18 */ + +type Group = struct { + Fgr_name uintptr + Fgr_passwd uintptr + Fgr_gid Gid_t + _ [4]byte + Fgr_mem uintptr +} /* grp.h:58:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/grp/grp_linux_386.go b/vendor/modernc.org/libc/grp/grp_linux_386.go index 2e550aff..e296338f 100644 --- a/vendor/modernc.org/libc/grp/grp_linux_386.go +++ b/vendor/modernc.org/libc/grp/grp_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_386.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_386.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/grp_linux_amd64.go b/vendor/modernc.org/libc/grp/grp_linux_amd64.go index 31204316..8d736a3a 100644 --- a/vendor/modernc.org/libc/grp/grp_linux_amd64.go +++ b/vendor/modernc.org/libc/grp/grp_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_amd64.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_amd64.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/grp_linux_arm.go b/vendor/modernc.org/libc/grp/grp_linux_arm.go index 50d2ba5d..8d4f30db 100644 --- a/vendor/modernc.org/libc/grp/grp_linux_arm.go +++ b/vendor/modernc.org/libc/grp/grp_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/grp_linux_arm64.go b/vendor/modernc.org/libc/grp/grp_linux_arm64.go index 1b001a3c..a1c88446 100644 --- a/vendor/modernc.org/libc/grp/grp_linux_arm64.go +++ b/vendor/modernc.org/libc/grp/grp_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm64.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_arm64.go -pkgname grp', DO NOT EDIT. package grp diff --git a/vendor/modernc.org/libc/grp/grp_linux_s390x.go b/vendor/modernc.org/libc/grp/grp_linux_s390x.go index 80857051..f29a420e 100644 --- a/vendor/modernc.org/libc/grp/grp_linux_s390x.go +++ b/vendor/modernc.org/libc/grp/grp_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_s390x.go -pkgname grp', DO NOT EDIT. +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_linux_s390x.go -pkgname grp', DO NOT EDIT. package grp @@ -17,6 +17,7 @@ var _ unsafe.Pointer const ( NSS_BUFLEN_GROUP = 1024 X_ATFILE_SOURCE = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BSD_SIZE_T_ = 0 @@ -62,7 +63,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -77,11 +78,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 9.2.1 Group Database Access -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -96,7 +97,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -104,6 +105,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -224,6 +226,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -246,9 +250,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -263,7 +280,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -276,7 +293,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -291,7 +308,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -406,7 +423,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -423,14 +440,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -445,7 +460,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -482,7 +497,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -497,11 +512,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -516,43 +531,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -564,7 +601,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -585,7 +622,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -600,7 +637,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -615,78 +652,102 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ // Wide character type. // Locale-writers should change this as necessary to @@ -715,4 +776,4 @@ type Group = struct { Fgr_mem uintptr } /* grp.h:42:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/grp/grp_netbsd_amd64.go b/vendor/modernc.org/libc/grp/grp_netbsd_amd64.go new file mode 100644 index 00000000..d52ac5bd --- /dev/null +++ b/vendor/modernc.org/libc/grp/grp_netbsd_amd64.go @@ -0,0 +1,1616 @@ +// Code generated by 'ccgo grp/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o grp/grp_netbsd_amd64.go -pkgname grp', DO NOT EDIT. + +package grp + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FD_SETSIZE = 256 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_GRP_H_ = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PATH_GROUP = "/etc/group" + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +type Group = struct { + Fgr_name uintptr + Fgr_passwd uintptr + Fgr_gid X__gid_t + _ [4]byte + Fgr_mem uintptr +} /* grp.h:50:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/ioutil_freebsd.go b/vendor/modernc.org/libc/ioutil_freebsd.go new file mode 100644 index 00000000..1628bfa3 --- /dev/null +++ b/vendor/modernc.org/libc/ioutil_freebsd.go @@ -0,0 +1,65 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE-GO file. + +// Modifications Copyright 2020 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "fmt" + "os" + "sync" + "time" + "unsafe" + + "golang.org/x/sys/unix" +) + +// Random number state. +// We generate random temporary file names so that there's a good +// chance the file doesn't exist yet - keeps the number of tries in +// TempFile to a minimum. +var randState uint32 +var randStateMu sync.Mutex + +func reseed() uint32 { + return uint32(time.Now().UnixNano() + int64(os.Getpid())) +} + +func nextRandom(x uintptr) { + randStateMu.Lock() + r := randState + if r == 0 { + r = reseed() + } + r = r*1664525 + 1013904223 // constants from Numerical Recipes + randState = r + randStateMu.Unlock() + copy((*RawMem)(unsafe.Pointer(x))[:6:6], fmt.Sprintf("%06d", int(1e9+r%1e9)%1e6)) +} + +func tempFile(s, x uintptr) (fd int, err error) { + const maxTry = 10000 + nconflict := 0 + for i := 0; i < maxTry; i++ { + nextRandom(x) + if fd, err = unix.Open(GoString(s), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600); err == nil { + return fd, nil + } + + if !os.IsExist(err) { + return -1, err + } + + if nconflict++; nconflict > 10 { + randStateMu.Lock() + randState = reseed() + nconflict = 0 + randStateMu.Unlock() + } + } + return -1, err +} diff --git a/vendor/modernc.org/libc/ioutil_netbsd.go b/vendor/modernc.org/libc/ioutil_netbsd.go new file mode 100644 index 00000000..1628bfa3 --- /dev/null +++ b/vendor/modernc.org/libc/ioutil_netbsd.go @@ -0,0 +1,65 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE-GO file. + +// Modifications Copyright 2020 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "fmt" + "os" + "sync" + "time" + "unsafe" + + "golang.org/x/sys/unix" +) + +// Random number state. +// We generate random temporary file names so that there's a good +// chance the file doesn't exist yet - keeps the number of tries in +// TempFile to a minimum. +var randState uint32 +var randStateMu sync.Mutex + +func reseed() uint32 { + return uint32(time.Now().UnixNano() + int64(os.Getpid())) +} + +func nextRandom(x uintptr) { + randStateMu.Lock() + r := randState + if r == 0 { + r = reseed() + } + r = r*1664525 + 1013904223 // constants from Numerical Recipes + randState = r + randStateMu.Unlock() + copy((*RawMem)(unsafe.Pointer(x))[:6:6], fmt.Sprintf("%06d", int(1e9+r%1e9)%1e6)) +} + +func tempFile(s, x uintptr) (fd int, err error) { + const maxTry = 10000 + nconflict := 0 + for i := 0; i < maxTry; i++ { + nextRandom(x) + if fd, err = unix.Open(GoString(s), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600); err == nil { + return fd, nil + } + + if !os.IsExist(err) { + return -1, err + } + + if nconflict++; nconflict > 10 { + randStateMu.Lock() + randState = reseed() + nconflict = 0 + randStateMu.Unlock() + } + } + return -1, err +} diff --git a/vendor/modernc.org/libc/langinfo/capi_darwin_amd64.go b/vendor/modernc.org/libc/langinfo/capi_darwin_amd64.go index 265d7421..7a8fd578 100644 --- a/vendor/modernc.org/libc/langinfo/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/langinfo/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_darwin_amd64.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_darwin_amd64.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/capi_freebsd_amd64.go b/vendor/modernc.org/libc/langinfo/capi_freebsd_amd64.go new file mode 100644 index 00000000..c20d84c6 --- /dev/null +++ b/vendor/modernc.org/libc/langinfo/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_freebsd_amd64.go -pkgname langinfo', DO NOT EDIT. + +package langinfo + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/langinfo/capi_linux_386.go b/vendor/modernc.org/libc/langinfo/capi_linux_386.go index d3b3c3f5..5cc0cfba 100644 --- a/vendor/modernc.org/libc/langinfo/capi_linux_386.go +++ b/vendor/modernc.org/libc/langinfo/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_386.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_386.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/capi_linux_amd64.go b/vendor/modernc.org/libc/langinfo/capi_linux_amd64.go index b8e0421e..27a2c4be 100644 --- a/vendor/modernc.org/libc/langinfo/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/langinfo/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_amd64.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_amd64.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/capi_linux_arm.go b/vendor/modernc.org/libc/langinfo/capi_linux_arm.go index 19d2c9be..dd4ff49b 100644 --- a/vendor/modernc.org/libc/langinfo/capi_linux_arm.go +++ b/vendor/modernc.org/libc/langinfo/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/capi_linux_arm64.go b/vendor/modernc.org/libc/langinfo/capi_linux_arm64.go index 172997b6..de9629ff 100644 --- a/vendor/modernc.org/libc/langinfo/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/langinfo/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm64.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm64.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/capi_linux_s390x.go b/vendor/modernc.org/libc/langinfo/capi_linux_s390x.go index e21d22e9..9e5b8d1e 100644 --- a/vendor/modernc.org/libc/langinfo/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/langinfo/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_s390x.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_s390x.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/capi_netbsd_amd64.go b/vendor/modernc.org/libc/langinfo/capi_netbsd_amd64.go new file mode 100644 index 00000000..c6887839 --- /dev/null +++ b/vendor/modernc.org/libc/langinfo/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo langinfo/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_netbsd_amd64.go -pkgname langinfo', DO NOT EDIT. + +package langinfo + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/langinfo/langinfo_darwin_amd64.go b/vendor/modernc.org/libc/langinfo/langinfo_darwin_amd64.go index 279f18f9..3804112e 100644 --- a/vendor/modernc.org/libc/langinfo/langinfo_darwin_amd64.go +++ b/vendor/modernc.org/libc/langinfo/langinfo_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_darwin_amd64.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_darwin_amd64.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/langinfo_freebsd_amd64.go b/vendor/modernc.org/libc/langinfo/langinfo_freebsd_amd64.go new file mode 100644 index 00000000..5c2d0c62 --- /dev/null +++ b/vendor/modernc.org/libc/langinfo/langinfo_freebsd_amd64.go @@ -0,0 +1,700 @@ +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_freebsd_amd64.go -pkgname langinfo', DO NOT EDIT. + +package langinfo + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ABDAY_1 = 14 + ABDAY_2 = 15 + ABDAY_3 = 16 + ABDAY_4 = 17 + ABDAY_5 = 18 + ABDAY_6 = 19 + ABDAY_7 = 20 + ABMON_1 = 33 + ABMON_10 = 42 + ABMON_11 = 43 + ABMON_12 = 44 + ABMON_2 = 34 + ABMON_3 = 35 + ABMON_4 = 36 + ABMON_5 = 37 + ABMON_6 = 38 + ABMON_7 = 39 + ABMON_8 = 40 + ABMON_9 = 41 + ALTMON_1 = 58 + ALTMON_10 = 67 + ALTMON_11 = 68 + ALTMON_12 = 69 + ALTMON_2 = 59 + ALTMON_3 = 60 + ALTMON_4 = 61 + ALTMON_5 = 62 + ALTMON_6 = 63 + ALTMON_7 = 64 + ALTMON_8 = 65 + ALTMON_9 = 66 + ALT_DIGITS = 49 + AM_STR = 5 + CODESET = 0 + CRNCYSTR = 56 + DAY_1 = 7 + DAY_2 = 8 + DAY_3 = 9 + DAY_4 = 10 + DAY_5 = 11 + DAY_6 = 12 + DAY_7 = 13 + D_FMT = 2 + D_MD_ORDER = 57 + D_T_FMT = 1 + ERA = 45 + ERA_D_FMT = 46 + ERA_D_T_FMT = 47 + ERA_T_FMT = 48 + MON_1 = 21 + MON_10 = 30 + MON_11 = 31 + MON_12 = 32 + MON_2 = 22 + MON_3 = 23 + MON_4 = 24 + MON_5 = 25 + MON_6 = 26 + MON_7 = 27 + MON_8 = 28 + MON_9 = 29 + NOEXPR = 53 + NOSTR = 55 + PM_STR = 6 + RADIXCHAR = 50 + THOUSEP = 51 + T_FMT = 3 + T_FMT_AMPM = 4 + YESEXPR = 52 + YESSTR = 54 + X_FILE_OFFSET_BITS = 64 + X_LANGINFO_H_ = 0 + X_LOCALE_T_DEFINED = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_NL_ITEM_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_XLOCALE_LANGINFO_H = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2001 Alexey Zelkin +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Nl_item = X__nl_item /* langinfo.h:38:19 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011, 2012 The FreeBSD Foundation +// All rights reserved. +// +// This software was developed by David Chisnall under sponsorship from +// the FreeBSD Foundation. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Locale_t = uintptr /* _langinfo.h:39:25 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/langinfo/langinfo_linux_386.go b/vendor/modernc.org/libc/langinfo/langinfo_linux_386.go index 6576249d..4f00ea57 100644 --- a/vendor/modernc.org/libc/langinfo/langinfo_linux_386.go +++ b/vendor/modernc.org/libc/langinfo/langinfo_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_386.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_386.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/langinfo_linux_amd64.go b/vendor/modernc.org/libc/langinfo/langinfo_linux_amd64.go index 97f5d6e9..cc26558b 100644 --- a/vendor/modernc.org/libc/langinfo/langinfo_linux_amd64.go +++ b/vendor/modernc.org/libc/langinfo/langinfo_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_amd64.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_amd64.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/langinfo_linux_arm.go b/vendor/modernc.org/libc/langinfo/langinfo_linux_arm.go index c2522a10..04939dc7 100644 --- a/vendor/modernc.org/libc/langinfo/langinfo_linux_arm.go +++ b/vendor/modernc.org/libc/langinfo/langinfo_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/langinfo_linux_arm64.go b/vendor/modernc.org/libc/langinfo/langinfo_linux_arm64.go index 6530d1bb..b55dc919 100644 --- a/vendor/modernc.org/libc/langinfo/langinfo_linux_arm64.go +++ b/vendor/modernc.org/libc/langinfo/langinfo_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm64.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_arm64.go -pkgname langinfo', DO NOT EDIT. package langinfo diff --git a/vendor/modernc.org/libc/langinfo/langinfo_linux_s390x.go b/vendor/modernc.org/libc/langinfo/langinfo_linux_s390x.go index e52fce8d..67512783 100644 --- a/vendor/modernc.org/libc/langinfo/langinfo_linux_s390x.go +++ b/vendor/modernc.org/libc/langinfo/langinfo_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_s390x.go -pkgname langinfo', DO NOT EDIT. +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_linux_s390x.go -pkgname langinfo', DO NOT EDIT. package langinfo @@ -36,7 +36,7 @@ const ( ) // Definition of locale category symbol values. -// Copyright (C) 2001-2018 Free Software Foundation, Inc. +// Copyright (C) 2001-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -51,7 +51,7 @@ const ( // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Construct an `nl_item' value for `nl_langinfo' from a locale category // (LC_*) and an item index within the category. Some code may depend on @@ -533,7 +533,7 @@ type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ // Access to locale-dependent parameters. -// Copyright (C) 1995-2018 Free Software Foundation, Inc. +// Copyright (C) 1995-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -548,10 +548,10 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Get the type definition. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -566,9 +566,9 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -583,7 +583,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -591,6 +591,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -711,6 +712,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -733,9 +736,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -750,7 +766,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -763,7 +779,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -778,7 +794,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -893,7 +909,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -910,14 +926,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -932,7 +946,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -980,7 +994,7 @@ type Nl_item = int32 /* nl_types.h:36:13 */ // POSIX.1-2008 extended locale interface (see locale.h). // Definition of locale_t. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -995,10 +1009,10 @@ type Nl_item = int32 /* nl_types.h:36:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Definition of struct __locale_struct and __locale_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // Contributed by Ulrich Drepper , 1997. // @@ -1014,7 +1028,7 @@ type Nl_item = int32 /* nl_types.h:36:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX.1-2008: the locale_t type, representing a locale context // (implementation-namespace version). This type should be treated @@ -1033,4 +1047,4 @@ type X__locale_t = uintptr /* __locale_t.h:42:32 */ type Locale_t = X__locale_t /* locale_t.h:24:20 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/langinfo/langinfo_netbsd_amd64.go b/vendor/modernc.org/libc/langinfo/langinfo_netbsd_amd64.go new file mode 100644 index 00000000..d61929ad --- /dev/null +++ b/vendor/modernc.org/libc/langinfo/langinfo_netbsd_amd64.go @@ -0,0 +1,189 @@ +// Code generated by 'ccgo langinfo/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o langinfo/langinfo_netbsd_amd64.go -pkgname langinfo', DO NOT EDIT. + +package langinfo + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + NL_CAT_LOCALE = 1 + NL_SETD = 1 + X_FILE_OFFSET_BITS = 64 + X_LANGINFO_H_ = 0 + X_LP64 = 1 + X_NL_TYPES_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: nl_types.h,v 1.13 2013/08/19 08:03:33 joerg Exp $ + +// - +// Copyright (c) 1996 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by J.T. Conklin. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +type X__nl_cat_d = struct { + F__data uintptr + F__size int32 + _ [4]byte +} /* nl_types.h:77:9 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: nl_types.h,v 1.13 2013/08/19 08:03:33 joerg Exp $ + +// - +// Copyright (c) 1996 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by J.T. Conklin. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +type Nl_catd = uintptr /* nl_types.h:80:3 */ + +type Nl_item = int64 /* nl_types.h:82:14 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/libc.go b/vendor/modernc.org/libc/libc.go index 66307387..7617fba7 100644 --- a/vendor/modernc.org/libc/libc.go +++ b/vendor/modernc.org/libc/libc.go @@ -222,6 +222,7 @@ func X__builtin_clzll(t *TLS, n uint64) int32 { return in func X__builtin_constant_p_impl() { panic(todo("internal error: should never be called")) } func X__builtin_copysign(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) } func X__builtin_copysignf(t *TLS, x, y float32) float32 { return Xcopysignf(t, x, y) } +func X__builtin_copysignl(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) } func X__builtin_exit(t *TLS, status int32) { Xexit(t, status) } func X__builtin_expect(t *TLS, exp, c long) long { return exp } func X__builtin_fabs(t *TLS, x float64) float64 { return Xfabs(t, x) } @@ -230,9 +231,12 @@ func X__builtin_huge_val(t *TLS) float64 { return ma func X__builtin_huge_valf(t *TLS) float32 { return float32(math.Inf(1)) } func X__builtin_inf(t *TLS) float64 { return math.Inf(1) } func X__builtin_inff(t *TLS) float32 { return float32(math.Inf(1)) } +func X__builtin_infl(t *TLS) float64 { return math.Inf(1) } func X__builtin_malloc(t *TLS, size types.Size_t) uintptr { return Xmalloc(t, size) } func X__builtin_memcmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 { return Xmemcmp(t, s1, s2, n) } +func X__builtin_nan(t *TLS, s uintptr) float64 { return math.NaN() } func X__builtin_nanf(t *TLS, s uintptr) float32 { return float32(math.NaN()) } +func X__builtin_nanl(t *TLS, s uintptr) float64 { return math.NaN() } func X__builtin_prefetch(t *TLS, addr, args uintptr) {} func X__builtin_printf(t *TLS, s, args uintptr) int32 { return Xprintf(t, s, args) } func X__builtin_strchr(t *TLS, s uintptr, c int32) uintptr { return Xstrchr(t, s, c) } @@ -243,7 +247,8 @@ func X__builtin_trap(t *TLS) { Xabort(t) func X__isnan(t *TLS, arg float64) int32 { return X__builtin_isnan(t, arg) } func X__isnanf(t *TLS, arg float32) int32 { return Xisnanf(t, arg) } func X__isnanl(t *TLS, arg float64) int32 { return Xisnanl(t, arg) } -func Xvfprintf(t *TLS, stream, format, ap uintptr) int32 { return Xfprintf(t, stream, format, ap) } + +func Xvfprintf(t *TLS, stream, format, ap uintptr) int32 { return Xfprintf(t, stream, format, ap) } // int __builtin_popcount (unsigned int x) func X__builtin_popcount(t *TLS, x uint32) int32 { @@ -751,8 +756,8 @@ func Xmemset(t *TLS, s uintptr, c int32, n types.Size_t) uintptr { if n != 0 { c := byte(c & 0xff) - //this will make sure that on platforms where they are not equally alligned - //we clear out the first few bytes until allignment + // This will make sure that on platforms where they are not equally aligned we + // clear out the first few bytes until allignment bytesBeforeAllignment := s % unsafe.Alignof(uint64(0)) if bytesBeforeAllignment > uintptr(n) { bytesBeforeAllignment = uintptr(n) @@ -781,13 +786,9 @@ func Xmemset(t *TLS, s uintptr, c int32, n types.Size_t) uintptr { // void *memcpy(void *dest, const void *src, size_t n); func Xmemcpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) { - if n == 0 { - return dest + if n != 0 { + copy((*RawMem)(unsafe.Pointer(dest))[:n:n], (*RawMem)(unsafe.Pointer(src))[:n:n]) } - - s := (*RawMem)(unsafe.Pointer(src))[:n:n] - d := (*RawMem)(unsafe.Pointer(dest))[:n:n] - copy(d, s) return dest } @@ -1003,40 +1004,6 @@ func Xstrcasecmp(t *TLS, s1, s2 uintptr) int32 { } } -var __ctype_b_table = [...]uint16{ //TODO use symbolic constants - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, - 0x0002, 0x2003, 0x2002, 0x2002, 0x2002, 0x2002, 0x0002, 0x0002, - 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, - 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, - 0x6001, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, - 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, - 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, - 0xd808, 0xd808, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, - 0xc004, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xc508, - 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, - 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, - 0xc508, 0xc508, 0xc508, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, - 0xc004, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xc608, - 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, - 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, - 0xc608, 0xc608, 0xc608, 0xc004, 0xc004, 0xc004, 0xc004, 0x0002, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -} - -var ptable = uintptr(unsafe.Pointer(&__ctype_b_table[128])) - -// const unsigned short * * __ctype_b_loc (void); -func X__ctype_b_loc(t *TLS) uintptr { - return uintptr(unsafe.Pointer(&ptable)) -} - func Xntohs(t *TLS, netshort uint16) uint16 { return uint16((*[2]byte)(unsafe.Pointer(&netshort))[0])<<8 | uint16((*[2]byte)(unsafe.Pointer(&netshort))[1]) } @@ -1291,3 +1258,9 @@ func AtExit(f func()) { atExit = append(atExit, f) atExitMu.Unlock() } + +func X__ccgo_dmesg(t *TLS, fmt uintptr, va uintptr) { + if dmesgs { + dmesg("%s", printf(fmt, va)) + } +} diff --git a/vendor/modernc.org/libc/libc32.go b/vendor/modernc.org/libc/libc32.go index e96cdd90..6364e288 100644 --- a/vendor/modernc.org/libc/libc32.go +++ b/vendor/modernc.org/libc/libc32.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 || arm // +build 386 arm package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/libc64.go b/vendor/modernc.org/libc/libc64.go index 6ca31aa7..2108df07 100644 --- a/vendor/modernc.org/libc/libc64.go +++ b/vendor/modernc.org/libc/libc64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 || arm64 || s390x // +build amd64 arm64 s390x package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/libc_darwin.go b/vendor/modernc.org/libc/libc_darwin.go index baa52bbe..9d4c2b6b 100644 --- a/vendor/modernc.org/libc/libc_darwin.go +++ b/vendor/modernc.org/libc/libc_darwin.go @@ -332,7 +332,7 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr { func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { var mode types.Mode_t if args != 0 { - mode = *(*types.Mode_t)(unsafe.Pointer(args)) + mode = (types.Mode_t)(VaUint32(&args)) } fd, err := unix.Open(GoString(pathname), int(flags), uint32(mode)) if err != nil { diff --git a/vendor/modernc.org/libc/libc_freebsd.go b/vendor/modernc.org/libc/libc_freebsd.go new file mode 100644 index 00000000..724ece0e --- /dev/null +++ b/vendor/modernc.org/libc/libc_freebsd.go @@ -0,0 +1,2120 @@ +// Copyright 2020 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "bufio" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "runtime" + "runtime/debug" + "strconv" + "strings" + "syscall" + gotime "time" + "unsafe" + + "golang.org/x/sys/unix" + "modernc.org/libc/errno" + "modernc.org/libc/fcntl" + "modernc.org/libc/fts" + "modernc.org/libc/grp" + gonetdb "modernc.org/libc/honnef.co/go/netdb" + "modernc.org/libc/langinfo" + "modernc.org/libc/limits" + "modernc.org/libc/netdb" + "modernc.org/libc/netinet/in" + "modernc.org/libc/pwd" + "modernc.org/libc/signal" + "modernc.org/libc/stdio" + "modernc.org/libc/sys/socket" + "modernc.org/libc/sys/stat" + "modernc.org/libc/sys/types" + "modernc.org/libc/termios" + "modernc.org/libc/time" + "modernc.org/libc/unistd" +) + +var ( + in6_addr_any in.In6_addr +) + +type ( + long = int64 + ulong = uint64 +) + +// // Keep these outside of the var block otherwise go generate will miss them. +var X__stderrp = Xstdout +var X__stdinp = Xstdin +var X__stdoutp = Xstdout + +// include/stdio.h:486:extern int __isthreaded; +var X__isthreaded int32 + +// lib/libc/locale/mblocal.h:62: int __mb_sb_limit; +var X__mb_sb_limit int32 = 128 // UTF-8 + +// include/runetype.h:94:extern _Thread_local const _RuneLocale *_ThreadRuneLocale; +var X_ThreadRuneLocale uintptr //TODO initialize and implement _Thread_local semantics. + +// include/xlocale/_ctype.h:54:_RuneLocale *__runes_for_locale(locale_t, int*); +func X__runes_for_locale(t *TLS, l locale_t, p uintptr) uintptr { + panic(todo("")) +} + +type file uintptr + +func (f file) fd() int32 { return int32((*stdio.FILE)(unsafe.Pointer(f)).F_file) } +func (f file) setFd(fd int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_file = int16(fd) } + +func (f file) err() bool { + return (*stdio.FILE)(unsafe.Pointer(f)).F_flags&1 != 0 +} + +func (f file) setErr() { + (*stdio.FILE)(unsafe.Pointer(f)).F_flags |= 1 +} + +func (f file) close(t *TLS) int32 { + r := Xclose(t, f.fd()) + Xfree(t, uintptr(f)) + if r < 0 { + return stdio.EOF + } + + return 0 +} + +func newFile(t *TLS, fd int32) uintptr { + p := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(stdio.FILE{}))) + if p == 0 { + return 0 + } + file(p).setFd(fd) + return p +} + +func fwrite(fd int32, b []byte) (int, error) { + if fd == unistd.STDOUT_FILENO { + return write(b) + } + + // if dmesgs { + // dmesg("%v: fd %v: %s", origin(1), fd, b) + // } + return unix.Write(int(fd), b) //TODO use Xwrite +} + +// unsigned long ___runetype(__ct_rune_t) __pure; +func X___runetype(t *TLS, x types.X__ct_rune_t) ulong { + panic(todo("")) +} + +// int fprintf(FILE *stream, const char *format, ...); +func Xfprintf(t *TLS, stream, format, args uintptr) int32 { + n, _ := fwrite(int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file), printf(format, args)) + return int32(n) +} + +// int usleep(useconds_t usec); +func Xusleep(t *TLS, usec types.X__useconds_t) int32 { + gotime.Sleep(gotime.Microsecond * gotime.Duration(usec)) + return 0 +} + +// int getrusage(int who, struct rusage *usage); +func Xgetrusage(t *TLS, who int32, usage uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// char *fgets(char *s, int size, FILE *stream); +func Xfgets(t *TLS, s uintptr, size int32, stream uintptr) uintptr { + fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_file) + var b []byte + buf := [1]byte{} + for ; size > 0; size-- { + n, err := unix.Read(fd, buf[:]) + if n != 0 { + b = append(b, buf[0]) + if buf[0] == '\n' { + b = append(b, 0) + copy((*RawMem)(unsafe.Pointer(s))[:len(b):len(b)], b) + return s + } + + continue + } + + switch { + case n == 0 && err == nil && len(b) == 0: + return 0 + default: + panic(todo("")) + } + + // if err == nil { + // panic("internal error") + // } + + // if len(b) != 0 { + // b = append(b, 0) + // copy((*RawMem)(unsafe.Pointer(s)[:len(b)]), b) + // return s + // } + + // t.setErrno(err) + } + panic(todo("")) +} + +// int lstat(const char *pathname, struct stat *statbuf); +func Xlstat(t *TLS, pathname, statbuf uintptr) int32 { + return Xlstat64(t, pathname, statbuf) +} + +// int stat(const char *pathname, struct stat *statbuf); +func Xstat(t *TLS, pathname, statbuf uintptr) int32 { + return Xstat64(t, pathname, statbuf) +} + +// int chdir(const char *path); +func Xchdir(t *TLS, path uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %q: ok", origin(1), GoString(path)) + // } + return 0 +} + +var localtime time.Tm + +// struct tm *localtime(const time_t *timep); +func Xlocaltime(_ *TLS, timep uintptr) uintptr { + loc := gotime.Local + if r := getenv(Environ(), "TZ"); r != 0 { + zone, off := parseZone(GoString(r)) + loc = gotime.FixedZone(zone, -off) + } + ut := *(*time.Time_t)(unsafe.Pointer(timep)) + t := gotime.Unix(int64(ut), 0).In(loc) + localtime.Ftm_sec = int32(t.Second()) + localtime.Ftm_min = int32(t.Minute()) + localtime.Ftm_hour = int32(t.Hour()) + localtime.Ftm_mday = int32(t.Day()) + localtime.Ftm_mon = int32(t.Month() - 1) + localtime.Ftm_year = int32(t.Year() - 1900) + localtime.Ftm_wday = int32(t.Weekday()) + localtime.Ftm_yday = int32(t.YearDay()) + localtime.Ftm_isdst = Bool32(isTimeDST(t)) + return uintptr(unsafe.Pointer(&localtime)) +} + +// struct tm *localtime_r(const time_t *timep, struct tm *result); +func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr { + panic(todo("")) +} + +// int open(const char *pathname, int flags, ...); +func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { + return Xopen64(t, pathname, flags, args) +} + +// int open(const char *pathname, int flags, ...); +func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { + var mode types.Mode_t + if args != 0 { + mode = (types.Mode_t)(VaUint32(&args)) + } + fdcwd := fcntl.AT_FDCWD + n, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(fdcwd), pathname, uintptr(flags), uintptr(mode), 0, 0) + if err != 0 { + // if dmesgs { + // dmesg("%v: %q %#x: %v", origin(1), GoString(pathname), flags, err) + // } + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %q flags %#x mode %#o: fd %v", origin(1), GoString(pathname), flags, mode, n) + // } + return int32(n) +} + +// off_t lseek(int fd, off_t offset, int whence); +func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + return types.Off_t(Xlseek64(t, fd, offset, whence)) +} + +func whenceStr(whence int32) string { + panic(todo("")) +} + +var fsyncStatbuf stat.Stat + +// int fsync(int fd); +func Xfsync(t *TLS, fd int32) int32 { + if noFsync { + // Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c + return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf))) + } + + if _, _, err := unix.Syscall(unix.SYS_FSYNC, uintptr(fd), 0, 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %d: ok", origin(1), fd) + // } + return 0 +} + +// long sysconf(int name); +func Xsysconf(t *TLS, name int32) long { + switch name { + case unistd.X_SC_PAGESIZE: + return long(unix.Getpagesize()) + case unistd.X_SC_GETPW_R_SIZE_MAX: + return -1 + case unistd.X_SC_GETGR_R_SIZE_MAX: + return -1 + } + + panic(todo("", name)) +} + +// int close(int fd); +func Xclose(t *TLS, fd int32) int32 { + if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %d: ok", origin(1), fd) + // } + return 0 +} + +// char *getcwd(char *buf, size_t size); +func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr { + if _, err := unix.Getcwd((*RawMem)(unsafe.Pointer(buf))[:size:size]); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return 0 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return buf +} + +// int fstat(int fd, struct stat *statbuf); +func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 { + return Xfstat64(t, fd, statbuf) +} + +// int ftruncate(int fd, off_t length); +func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 { + if err := unix.Ftruncate(int(fd), int64(length)); err != nil { + if dmesgs { + dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %d %#x: ok", origin(1), fd, length) + } + return 0 +} + +// int fcntl(int fd, int cmd, ... /* arg */ ); +func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 { + return Xfcntl64(t, fd, cmd, args) +} + +// ssize_t read(int fd, void *buf, size_t count); +func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t { + n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count)) + if err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // // dmesg("%v: %d %#x: %#x\n%s", origin(1), fd, count, n, hex.Dump(GoBytes(buf, int(n)))) + // dmesg("%v: %d %#x: %#x", origin(1), fd, count, n) + // } + return types.Ssize_t(n) +} + +// ssize_t write(int fd, const void *buf, size_t count); +func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t { + const retry = 5 + var err syscall.Errno + for i := 0; i < retry; i++ { + var n uintptr + switch n, _, err = unix.Syscall(unix.SYS_WRITE, uintptr(fd), buf, uintptr(count)); err { + case 0: + // if dmesgs { + // // dmesg("%v: %d %#x: %#x\n%s", origin(1), fd, count, n, hex.Dump(GoBytes(buf, int(n)))) + // dmesg("%v: %d %#x: %#x", origin(1), fd, count, n) + // } + return types.Ssize_t(n) + case errno.EAGAIN: + // nop + } + } + + // if dmesgs { + // dmesg("%v: fd %v, count %#x: %v", origin(1), fd, count, err) + // } + t.setErrno(err) + return -1 +} + +// int fchmod(int fd, mode_t mode); +func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 { + if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %d %#o: ok", origin(1), fd, mode) + // } + return 0 +} + +// int fchown(int fd, uid_t owner, gid_t group); +func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 { + if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// uid_t geteuid(void); +func Xgeteuid(t *TLS) types.Uid_t { + n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0) + return types.Uid_t(n) +} + +// int munmap(void *addr, size_t length); +func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 { + if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int gettimeofday(struct timeval *tv, struct timezone *tz); +func Xgettimeofday(t *TLS, tv, tz uintptr) int32 { + if tz != 0 { + panic(todo("")) + } + + var tvs unix.Timeval + err := unix.Gettimeofday(&tvs) + if err != nil { + t.setErrno(err) + return -1 + } + + *(*unix.Timeval)(unsafe.Pointer(tv)) = tvs + return 0 +} + +// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen); +func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 { + if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen); +func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 { + if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int ioctl(int fd, unsigned long request, ...); +func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 { + var argp uintptr + if va != 0 { + argp = VaUintptr(&va) + } + n, _, err := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(request), argp) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 { + // if dmesgs { + // dmesg("%v: fd %v: %v", origin(1), sockfd, err) + // } + t.setErrno(err) + return -1 + } + + return 0 +} + +// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); +func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 { + n, err := unix.Select( + int(nfds), + (*unix.FdSet)(unsafe.Pointer(readfds)), + (*unix.FdSet)(unsafe.Pointer(writefds)), + (*unix.FdSet)(unsafe.Pointer(exceptfds)), + (*unix.Timeval)(unsafe.Pointer(timeout)), + ) + if err != nil { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int mkfifo(const char *pathname, mode_t mode); +func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 { + panic(todo("")) +} + +// mode_t umask(mode_t mask); +func Xumask(t *TLS, mask types.Mode_t) types.Mode_t { + n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0) + return types.Mode_t(n) +} + +// int execvp(const char *file, char *const argv[]); +func Xexecvp(t *TLS, file, argv uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// pid_t waitpid(pid_t pid, int *wstatus, int options); +func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t { + n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return types.Pid_t(n) +} + +// int uname(struct utsname *buf); +func Xuname(t *TLS, buf uintptr) int32 { + if err := unix.Uname((*unix.Utsname)(unsafe.Pointer(buf))); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// ssize_t recv(int sockfd, void *buf, size_t len, int flags); +func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t { + n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return types.Ssize_t(n) +} + +// ssize_t send(int sockfd, const void *buf, size_t len, int flags); +func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t { + n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return types.Ssize_t(n) +} + +// int shutdown(int sockfd, int how); +func Xshutdown(t *TLS, sockfd, how int32) int32 { + if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int socket(int domain, int type, int protocol); +func Xsocket(t *TLS, domain, type1, protocol int32) int32 { + n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol)) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 { + n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen)) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 { + if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int listen(int sockfd, int backlog); +func Xlisten(t *TLS, sockfd, backlog int32) int32 { + if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 { + n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int getrlimit(int resource, struct rlimit *rlim); +func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 { + return Xgetrlimit64(t, resource, rlim) +} + +// int setrlimit(int resource, const struct rlimit *rlim); +func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 { + return Xsetrlimit64(t, resource, rlim) +} + +// int setrlimit(int resource, const struct rlimit *rlim); +func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// uid_t getuid(void); +func Xgetuid(t *TLS) types.Uid_t { + return types.Uid_t(os.Getuid()) +} + +// pid_t getpid(void); +func Xgetpid(t *TLS) int32 { + return int32(os.Getpid()) +} + +// int system(const char *command); +func Xsystem(t *TLS, command uintptr) int32 { + s := GoString(command) + if command == 0 { + panic(todo("")) + } + + cmd := exec.Command("sh", "-c", s) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + if err != nil { + ps := err.(*exec.ExitError) + return int32(ps.ExitCode()) + } + + return 0 +} + +var staticGetpwuid pwd.Passwd + +func init() { + atExit = append(atExit, func() { closePasswd(&staticGetpwuid) }) +} + +func closePasswd(p *pwd.Passwd) { + Xfree(nil, p.Fpw_name) + Xfree(nil, p.Fpw_passwd) + Xfree(nil, p.Fpw_gecos) + Xfree(nil, p.Fpw_dir) + Xfree(nil, p.Fpw_shell) + *p = pwd.Passwd{} +} + +// struct passwd *getpwuid(uid_t uid); +func Xgetpwuid(t *TLS, uid uint32) uintptr { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sid := strconv.Itoa(int(uid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + s := sc.Text() + if strings.HasPrefix(s, "#") { + continue + } + + a := strings.Split(s, ":") + if len(a) < 7 { + panic(todo("%q", s)) + } + + if a[2] == sid { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + closePasswd(&staticGetpwuid) + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + initPasswd(t, &staticGetpwuid, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) + return uintptr(unsafe.Pointer(&staticGetpwuid)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +func initPasswd(t *TLS, p *pwd.Passwd, name, pwd string, uid, gid uint32, gecos, dir, shell string) { + p.Fpw_name = cString(t, name) + p.Fpw_passwd = cString(t, pwd) + p.Fpw_uid = uid + p.Fpw_gid = gid + p.Fpw_gecos = cString(t, gecos) + p.Fpw_dir = cString(t, dir) + p.Fpw_shell = cString(t, shell) +} + +func initPasswd2(t *TLS, buf uintptr, buflen types.Size_t, p *pwd.Passwd, name, pwd string, uid, gid uint32, gecos, dir, shell string) bool { + p.Fpw_name, buf, buflen = bufString(buf, buflen, name) + if buf == 0 { + return false + } + + p.Fpw_passwd, buf, buflen = bufString(buf, buflen, pwd) + if buf == 0 { + return false + } + + p.Fpw_uid = uid + p.Fpw_gid = gid + if buf == 0 { + return false + } + + p.Fpw_gecos, buf, buflen = bufString(buf, buflen, gecos) + if buf == 0 { + return false + } + + p.Fpw_dir, buf, buflen = bufString(buf, buflen, dir) + if buf == 0 { + return false + } + + p.Fpw_shell, buf, buflen = bufString(buf, buflen, shell) + if buf == 0 { + return false + } + + return true +} + +func bufString(buf uintptr, buflen types.Size_t, s string) (uintptr, uintptr, types.Size_t) { + buf0 := buf + rq := len(s) + 1 + if rq > int(buflen) { + return 0, 0, 0 + } + + copy((*RawMem)(unsafe.Pointer(buf))[:len(s):len(s)], s) + buf += uintptr(len(s)) + *(*byte)(unsafe.Pointer(buf)) = 0 + return buf0, buf + 1, buflen - types.Size_t(rq) +} + +// int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); +func Xgetpwuid_r(t *TLS, uid types.Uid_t, cpwd, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sid := strconv.Itoa(int(uid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + a := strings.Split(sc.Text(), ":") + if len(a) < 7 { + panic(todo("")) + } + + if a[2] == sid { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + var v pwd.Passwd + if initPasswd2(t, buf, buflen, &v, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) { + *(*pwd.Passwd)(unsafe.Pointer(cpwd)) = v + *(*uintptr)(unsafe.Pointer(result)) = cpwd + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return errno.ERANGE + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +// struct passwd *getpwnam(const char *name); +func Xgetpwnam(t *TLS, name uintptr) uintptr { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + a := strings.Split(sc.Text(), ":") + if len(a) < 7 { + panic(todo("")) + } + + if a[0] == sname { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + closePasswd(&staticGetpwnam) + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + initPasswd(t, &staticGetpwnam, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) + return uintptr(unsafe.Pointer(&staticGetpwnam)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +// int getpwnam_r(char *name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); +func Xgetpwnam_r(t *TLS, name, cpwd, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + a := strings.Split(sc.Text(), ":") + if len(a) < 7 { + panic(todo("")) + } + + if a[0] == sname { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + var v pwd.Passwd + if initPasswd2(t, buf, buflen, &v, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) { + *(*pwd.Passwd)(unsafe.Pointer(cpwd)) = v + *(*uintptr)(unsafe.Pointer(result)) = cpwd + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return errno.ERANGE + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +// int setvbuf(FILE *stream, char *buf, int mode, size_t size); +func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 { + return 0 //TODO +} + +// int raise(int sig); +func Xraise(t *TLS, sig int32) int32 { + panic(todo("")) +} + +// int backtrace(void **buffer, int size); +func Xbacktrace(t *TLS, buf uintptr, size int32) int32 { + panic(todo("")) +} + +// void backtrace_symbols_fd(void *const *buffer, int size, int fd); +func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) { + panic(todo("")) +} + +// int fileno(FILE *stream); +func Xfileno(t *TLS, stream uintptr) int32 { + panic(todo("")) +} + +var staticGetpwnam pwd.Passwd + +func init() { + atExit = append(atExit, func() { closePasswd(&staticGetpwnam) }) +} + +var staticGetgrnam grp.Group + +func init() { + atExit = append(atExit, func() { closeGroup(&staticGetgrnam) }) +} + +// struct group *getgrnam(const char *name); +func Xgetgrnam(t *TLS, name uintptr) uintptr { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[0] == sname { + closeGroup(&staticGetgrnam) + gid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + initGroup(t, &staticGetgrnam, a[0], a[1], uint32(gid), names) + return uintptr(unsafe.Pointer(&staticGetgrnam)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +// int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result); +func Xgetgrnam_r(t *TLS, name, pGrp, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[0] == sname { + gid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + var x grp.Group + if initGroup2(buf, buflen, &x, a[0], a[1], uint32(gid), names) { + *(*grp.Group)(unsafe.Pointer(pGrp)) = x + *(*uintptr)(unsafe.Pointer(result)) = pGrp + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +func closeGroup(p *grp.Group) { + Xfree(nil, p.Fgr_name) + Xfree(nil, p.Fgr_passwd) + if p := p.Fgr_mem; p != 0 { + for { + q := *(*uintptr)(unsafe.Pointer(p)) + if q == 0 { + break + } + + Xfree(nil, q) + p += unsafe.Sizeof(uintptr(0)) + } + } + *p = grp.Group{} +} + +func initGroup(t *TLS, p *grp.Group, name, pwd string, gid uint32, names []string) { + p.Fgr_name = cString(t, name) + p.Fgr_passwd = cString(t, pwd) + p.Fgr_gid = gid + a := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(uintptr(0)))*types.Size_t((len(names)+1))) + if a == 0 { + panic("OOM") + } + + for p := a; len(names) != 0; p += unsafe.Sizeof(uintptr(0)) { + *(*uintptr)(unsafe.Pointer(p)) = cString(t, names[0]) + names = names[1:] + } + p.Fgr_mem = a +} + +func initGroup2(buf uintptr, buflen types.Size_t, p *grp.Group, name, pwd string, gid uint32, names []string) bool { + p.Fgr_name, buf, buflen = bufString(buf, buflen, name) + if buf == 0 { + return false + } + + p.Fgr_passwd, buf, buflen = bufString(buf, buflen, pwd) + if buf == 0 { + return false + } + + p.Fgr_gid = gid + rq := unsafe.Sizeof(uintptr(0)) * uintptr(len(names)+1) + if rq > uintptr(buflen) { + return false + } + + a := buf + buf += rq + for ; len(names) != 0; buf += unsafe.Sizeof(uintptr(0)) { + if len(names[0])+1 > int(buflen) { + return false + } + + *(*uintptr)(unsafe.Pointer(buf)), buf, buflen = bufString(buf, buflen, names[0]) + names = names[1:] + } + *(*uintptr)(unsafe.Pointer(buf)) = 0 + p.Fgr_mem = a + return true +} + +func init() { + atExit = append(atExit, func() { closeGroup(&staticGetgrgid) }) +} + +var staticGetgrgid grp.Group + +// struct group *getgrgid(gid_t gid); +func Xgetgrgid(t *TLS, gid uint32) uintptr { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sid := strconv.Itoa(int(gid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[2] == sid { + closeGroup(&staticGetgrgid) + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + initGroup(t, &staticGetgrgid, a[0], a[1], gid, names) + return uintptr(unsafe.Pointer(&staticGetgrgid)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +// int getgrgid_r(gid_t gid, struct group *grp, char *buf, size_t buflen, struct group **result); +func Xgetgrgid_r(t *TLS, gid uint32, pGrp, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sid := strconv.Itoa(int(gid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[2] == sid { + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + var x grp.Group + if initGroup2(buf, buflen, &x, a[0], a[1], gid, names) { + *(*grp.Group)(unsafe.Pointer(pGrp)) = x + *(*uintptr)(unsafe.Pointer(result)) = pGrp + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +// int mkstemps(char *template, int suffixlen); +func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 { + return Xmkstemps64(t, template, suffixlen) +} + +// int mkstemps(char *template, int suffixlen); +func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 { + len := uintptr(Xstrlen(t, template)) + x := template + uintptr(len-6) - uintptr(suffixlen) + for i := uintptr(0); i < 6; i++ { + if *(*byte)(unsafe.Pointer(x + i)) != 'X' { + if dmesgs { + dmesg("%v: FAIL", origin(1)) + } + t.setErrno(errno.EINVAL) + return -1 + } + } + + fd, err := tempFile(template, x) + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + return int32(fd) +} + +// int mkstemp(char *template); +func Xmkstemp(t *TLS, template uintptr) int32 { + return Xmkstemp64(t, template) +} + +// int mkstemp(char *template); +func Xmkstemp64(t *TLS, template uintptr) int32 { + return Xmkstemps64(t, template, 0) +} + +func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { + var statp uintptr + if stat != nil { + statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) + if statp == 0 { + panic("OOM") + } + + *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat + } + csp, errx := CString(path) + if errx != nil { + panic("OOM") + } + + return &fts.FTSENT{ + Ffts_info: int32(info), + Ffts_path: csp, + Ffts_pathlen: uint64(len(path)), + Ffts_statp: statp, + Ffts_errno: int32(err), + } +} + +func newCFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) uintptr { + p := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(fts.FTSENT{}))) + if p == 0 { + panic("OOM") + } + + *(*fts.FTSENT)(unsafe.Pointer(p)) = *newFtsent(t, info, path, stat, err) + return p +} + +func ftsentClose(t *TLS, p uintptr) { + Xfree(t, (*fts.FTSENT)(unsafe.Pointer(p)).Ffts_path) + Xfree(t, (*fts.FTSENT)(unsafe.Pointer(p)).Ffts_statp) +} + +type ftstream struct { + s []uintptr + x int +} + +func (f *ftstream) close(t *TLS) { + for _, p := range f.s { + ftsentClose(t, p) + Xfree(t, p) + } + *f = ftstream{} +} + +// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **)); +func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr { + return Xfts64_open(t, path_argv, options, compar) +} + +// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **)); +func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr { + f := &ftstream{} + + var walk func(string) + walk = func(path string) { + var fi os.FileInfo + var err error + switch { + case options&fts.FTS_LOGICAL != 0: + fi, err = os.Stat(path) + case options&fts.FTS_PHYSICAL != 0: + fi, err = os.Lstat(path) + default: + panic(todo("")) + } + + if err != nil { + return + } + + var statp *unix.Stat_t + if options&fts.FTS_NOSTAT == 0 { + var stat unix.Stat_t + switch { + case options&fts.FTS_LOGICAL != 0: + if err := unix.Stat(path, &stat); err != nil { + panic(todo("")) + } + case options&fts.FTS_PHYSICAL != 0: + if err := unix.Lstat(path, &stat); err != nil { + panic(todo("")) + } + default: + panic(todo("")) + } + + statp = &stat + } + + out: + switch { + case fi.IsDir(): + f.s = append(f.s, newCFtsent(t, fts.FTS_D, path, statp, 0)) + g, err := os.Open(path) + switch x := err.(type) { + case nil: + // ok + case *os.PathError: + f.s = append(f.s, newCFtsent(t, fts.FTS_DNR, path, statp, errno.EACCES)) + break out + default: + panic(todo("%q: %v %T", path, x, x)) + } + + names, err := g.Readdirnames(-1) + g.Close() + if err != nil { + panic(todo("")) + } + + for _, name := range names { + walk(path + "/" + name) + if f == nil { + break out + } + } + + f.s = append(f.s, newCFtsent(t, fts.FTS_DP, path, statp, 0)) + default: + info := fts.FTS_F + if fi.Mode()&os.ModeSymlink != 0 { + info = fts.FTS_SL + } + switch { + case statp != nil: + f.s = append(f.s, newCFtsent(t, info, path, statp, 0)) + case options&fts.FTS_NOSTAT != 0: + f.s = append(f.s, newCFtsent(t, fts.FTS_NSOK, path, nil, 0)) + default: + panic(todo("")) + } + } + } + + for { + p := *(*uintptr)(unsafe.Pointer(path_argv)) + if p == 0 { + if f == nil { + return 0 + } + + if compar != 0 { + panic(todo("")) + } + + return addObject(f) + } + + walk(GoString(p)) + path_argv += unsafe.Sizeof(uintptr(0)) + } +} + +// FTSENT *fts_read(FTS *ftsp); +func Xfts_read(t *TLS, ftsp uintptr) uintptr { + return Xfts64_read(t, ftsp) +} + +// FTSENT *fts_read(FTS *ftsp); +func Xfts64_read(t *TLS, ftsp uintptr) uintptr { + f := getObject(ftsp).(*ftstream) + if f.x == len(f.s) { + t.setErrno(0) + return 0 + } + + r := f.s[f.x] + if e := (*fts.FTSENT)(unsafe.Pointer(r)).Ffts_errno; e != 0 { + t.setErrno(e) + } + f.x++ + return r +} + +// int fts_close(FTS *ftsp); +func Xfts_close(t *TLS, ftsp uintptr) int32 { + return Xfts64_close(t, ftsp) +} + +// int fts_close(FTS *ftsp); +func Xfts64_close(t *TLS, ftsp uintptr) int32 { + getObject(ftsp).(*ftstream).close(t) + removeObject(ftsp) + return 0 +} + +// void tzset (void); +func Xtzset(t *TLS) { + //TODO +} + +var strerrorBuf [100]byte + +// char *strerror(int errnum); +func Xstrerror(t *TLS, errnum int32) uintptr { + if dmesgs { + dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack()) + } + copy(strerrorBuf[:], fmt.Sprintf("strerror(%d)\x00", errnum)) + return uintptr(unsafe.Pointer(&strerrorBuf[0])) +} + +// void *dlopen(const char *filename, int flags); +func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr { + panic(todo("")) +} + +// char *dlerror(void); +func Xdlerror(t *TLS) uintptr { + panic(todo("")) +} + +// int dlclose(void *handle); +func Xdlclose(t *TLS, handle uintptr) int32 { + panic(todo("")) +} + +// void *dlsym(void *handle, const char *symbol); +func Xdlsym(t *TLS, handle, symbol uintptr) uintptr { + panic(todo("")) +} + +// void perror(const char *s); +func Xperror(t *TLS, s uintptr) { + panic(todo("")) +} + +// int pclose(FILE *stream); +func Xpclose(t *TLS, stream uintptr) int32 { + panic(todo("")) +} + +var gai_strerrorBuf [100]byte + +// const char *gai_strerror(int errcode); +func Xgai_strerror(t *TLS, errcode int32) uintptr { + copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode)) + return uintptr(unsafe.Pointer(&gai_strerrorBuf)) +} + +// int tcgetattr(int fd, struct termios *termios_p); +func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 { + panic(todo("")) +} + +// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); +func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 { + panic(todo("")) +} + +// speed_t cfgetospeed(const struct termios *termios_p); +func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t { + panic(todo("")) +} + +// int cfsetospeed(struct termios *termios_p, speed_t speed); +func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 { + panic(todo("")) +} + +// int cfsetispeed(struct termios *termios_p, speed_t speed); +func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 { + panic(todo("")) +} + +// pid_t fork(void); +func Xfork(t *TLS) int32 { + t.setErrno(errno.ENOSYS) + return -1 +} + +var emptyStr = [1]byte{} + +// char *setlocale(int category, const char *locale); +func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr { + return uintptr(unsafe.Pointer(&emptyStr)) //TODO +} + +// char *nl_langinfo(nl_item item); +func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr { + return uintptr(unsafe.Pointer(&emptyStr)) //TODO +} + +// FILE *popen(const char *command, const char *type); +func Xpopen(t *TLS, command, type1 uintptr) uintptr { + panic(todo("")) +} + +// char *realpath(const char *path, char *resolved_path); +func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr { + s, err := filepath.EvalSymlinks(GoString(path)) + if err != nil { + if os.IsNotExist(err) { + // if dmesgs { + // dmesg("%v: %q: %v", origin(1), GoString(path), err) + // } + t.setErrno(errno.ENOENT) + return 0 + } + + panic(todo("", err)) + } + + if resolved_path == 0 { + panic(todo("")) + } + + if len(s) >= limits.PATH_MAX { + s = s[:limits.PATH_MAX-1] + } + + copy((*RawMem)(unsafe.Pointer(resolved_path))[:len(s):len(s)], s) + (*RawMem)(unsafe.Pointer(resolved_path))[len(s)] = 0 + return resolved_path +} + +// struct tm *gmtime_r(const time_t *timep, struct tm *result); +func Xgmtime_r(t *TLS, timep, result uintptr) uintptr { + panic(todo("")) +} + +// char *inet_ntoa(struct in_addr in); +func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr { + panic(todo("")) +} + +func X__ccgo_in6addr_anyp(t *TLS) uintptr { + return uintptr(unsafe.Pointer(&in6_addr_any)) +} + +func Xabort(t *TLS) { + if dmesgs { + dmesg("%v:", origin(1)) + } + p := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(signal.Sigaction{}))) + if p == 0 { + panic("OOM") + } + + (*signal.Sigaction)(unsafe.Pointer(p)).F__sigaction_u.F__sa_handler = signal.SIG_DFL + Xsigaction(t, signal.SIGABRT, p, 0) + Xfree(t, p) + unix.Kill(unix.Getpid(), syscall.Signal(signal.SIGABRT)) + panic(todo("unrechable")) +} + +// int fflush(FILE *stream); +func Xfflush(t *TLS, stream uintptr) int32 { + return 0 //TODO +} + +// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); +func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { + m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) + if err != 0 { + file(stream).setErr() + return 0 + } + + // if dmesgs { + // // dmesg("%v: %d %#x x %#x: %#x\n%s", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size, hex.Dump(GoBytes(ptr, int(m)))) + // dmesg("%v: %d %#x x %#x: %#x", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size) + // } + return types.Size_t(m) / size +} + +// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); +func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { + m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) + if err != 0 { + file(stream).setErr() + return 0 + } + + // if dmesgs { + // // dmesg("%v: %d %#x x %#x: %#x\n%s", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size, hex.Dump(GoBytes(ptr, int(m)))) + // dmesg("%v: %d %#x x %#x: %#x", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size) + // } + return types.Size_t(m) / size +} + +// int fclose(FILE *stream); +func Xfclose(t *TLS, stream uintptr) int32 { + return file(stream).close(t) +} + +// int fputc(int c, FILE *stream); +func Xfputc(t *TLS, c int32, stream uintptr) int32 { + if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil { + return stdio.EOF + } + + return int32(byte(c)) +} + +// int fseek(FILE *stream, long offset, int whence); +func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 { + if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 { + // if dmesgs { + // dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n) + // } + file(stream).setErr() + return -1 + } + + // if dmesgs { + // dmesg("%v: fd %v, off %#x, whence %v: ok", origin(1), file(stream).fd(), offset, whenceStr(whence)) + // } + return 0 +} + +// long ftell(FILE *stream); +func Xftell(t *TLS, stream uintptr) long { + n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR) + if n < 0 { + file(stream).setErr() + return -1 + } + + // if dmesgs { + // dmesg("%v: fd %v, n %#x: ok %#x", origin(1), file(stream).fd(), n, long(n)) + // } + return long(n) +} + +// int ferror(FILE *stream); +func Xferror(t *TLS, stream uintptr) int32 { + return Bool32(file(stream).err()) +} + +// int fgetc(FILE *stream); +func Xfgetc(t *TLS, stream uintptr) int32 { + panic(todo("")) +} + +// int getc(FILE *stream); +func Xgetc(t *TLS, stream uintptr) int32 { + return Xfgetc(t, stream) +} + +// int ungetc(int c, FILE *stream); +func Xungetc(t *TLS, c int32, stream uintptr) int32 { + panic(todo("")) +} + +// int fscanf(FILE *stream, const char *format, ...); +func Xfscanf(t *TLS, stream, format, va uintptr) int32 { + panic(todo("")) +} + +// FILE *fdopen(int fd, const char *mode); +func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr { + panic(todo("")) +} + +// int fputs(const char *s, FILE *stream); +func Xfputs(t *TLS, s, stream uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 { + return -1 + } + + return 0 +} + +var getservbynameStaticResult netdb.Servent + +// struct servent *getservbyname(const char *name, const char *proto); +func Xgetservbyname(t *TLS, name, proto uintptr) uintptr { + var protoent *gonetdb.Protoent + if proto != 0 { + protoent = gonetdb.GetProtoByName(GoString(proto)) + } + servent := gonetdb.GetServByName(GoString(name), protoent) + if servent == nil { + // if dmesgs { + // dmesg("%q %q: nil (protoent %+v)", GoString(name), GoString(proto), protoent) + // } + return 0 + } + + Xfree(t, (*netdb.Servent)(unsafe.Pointer(&getservbynameStaticResult)).Fs_name) + if v := (*netdb.Servent)(unsafe.Pointer(&getservbynameStaticResult)).Fs_aliases; v != 0 { + for { + p := *(*uintptr)(unsafe.Pointer(v)) + if p == 0 { + break + } + + Xfree(t, p) + v += unsafe.Sizeof(uintptr(0)) + } + Xfree(t, v) + } + Xfree(t, (*netdb.Servent)(unsafe.Pointer(&getservbynameStaticResult)).Fs_proto) + cname, err := CString(servent.Name) + if err != nil { + getservbynameStaticResult = netdb.Servent{} + return 0 + } + + var protoname uintptr + if protoent != nil { + if protoname, err = CString(protoent.Name); err != nil { + Xfree(t, cname) + getservbynameStaticResult = netdb.Servent{} + return 0 + } + } + var a []uintptr + for _, v := range servent.Aliases { + cs, err := CString(v) + if err != nil { + for _, v := range a { + Xfree(t, v) + } + return 0 + } + + a = append(a, cs) + } + v := Xcalloc(t, types.Size_t(len(a)+1), types.Size_t(unsafe.Sizeof(uintptr(0)))) + if v == 0 { + Xfree(t, cname) + Xfree(t, protoname) + for _, v := range a { + Xfree(t, v) + } + getservbynameStaticResult = netdb.Servent{} + return 0 + } + for _, p := range a { + *(*uintptr)(unsafe.Pointer(v)) = p + v += unsafe.Sizeof(uintptr(0)) + } + + getservbynameStaticResult = netdb.Servent{ + Fs_name: cname, + Fs_aliases: v, + Fs_port: int32(servent.Port), + Fs_proto: protoname, + } + return uintptr(unsafe.Pointer(&getservbynameStaticResult)) +} + +func Xreaddir64(t *TLS, dir uintptr) uintptr { + return Xreaddir(t, dir) +} + +func __syscall(r, _ uintptr, errno syscall.Errno) long { + if errno != 0 { + return long(-errno) + } + + return long(r) +} + +func X__syscall1(t *TLS, trap, p1 long) long { + return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0)) +} + +func X__syscall3(t *TLS, trap, p1, p2, p3 long) long { + return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3))) +} + +func X__syscall4(t *TLS, trap, p1, p2, p3, p4 long) long { + return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0)) +} + +func fcntlCmdStr(cmd int32) string { + switch cmd { + case fcntl.F_GETOWN: + return "F_GETOWN" + case fcntl.F_SETLK: + return "F_SETLK" + case fcntl.F_GETLK: + return "F_GETLK" + case fcntl.F_SETFD: + return "F_SETFD" + case fcntl.F_GETFD: + return "F_GETFD" + default: + return fmt.Sprintf("cmd(%d)", cmd) + } +} + +// int setenv(const char *name, const char *value, int overwrite); +func Xsetenv(t *TLS, name, value uintptr, overwrite int32) int32 { + panic(todo("")) +} + +// int unsetenv(const char *name); +func Xunsetenv(t *TLS, name uintptr) int32 { + panic(todo("")) +} + +// int pause(void); +func Xpause(t *TLS) int32 { + panic(todo("")) +} + +// ssize_t writev(int fd, const struct iovec *iov, int iovcnt); +func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t { + panic(todo("")) +} + +// void endpwent(void); +func Xendpwent(t *TLS) { + // nop +} + +// int __isoc99_sscanf(const char *str, const char *format, ...); +func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 { + r := Xsscanf(t, str, format, va) + // if dmesgs { + // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) + // } + return r +} + +// int sched_yield(void); +func Xsched_yield(t *TLS) { + runtime.Gosched() +} + +var ctimeStaticBuf [32]byte + +// char *ctime(const time_t *timep); +func Xctime(t *TLS, timep uintptr) uintptr { + return Xctime_r(t, timep, uintptr(unsafe.Pointer(&ctimeStaticBuf[0]))) +} + +// char *ctime_r(const time_t *timep, char *buf); +func Xctime_r(t *TLS, timep, buf uintptr) uintptr { + panic(todo("")) +} + +// void __assert(const char * func, const char * file, int line, const char *expr) __dead2; +func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) { + X__assert_fail(t, expr, file, uint32(line), fn) +} + +// include/stdio.h:456:int __swbuf(int, FILE *); +func X__swbuf(t *TLS, n int32, file uintptr) int32 { + return Xfputc(t, n, file) //TODO improve performance, use a real buffer. +} + +// int rmdir(const char *pathname); +func Xrmdir(t *TLS, pathname uintptr) int32 { + if err := unix.Rmdir(GoString(pathname)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// struct dirent *readdir(DIR *dirp); +func Xreaddir(t *TLS, dir uintptr) uintptr { + if (*darwinDir)(unsafe.Pointer(dir)).eof { + return 0 + } + + if (*darwinDir)(unsafe.Pointer(dir)).l == (*darwinDir)(unsafe.Pointer(dir)).h { + n, err := unix.Getdirentries((*darwinDir)(unsafe.Pointer(dir)).fd, (*darwinDir)(unsafe.Pointer(dir)).buf[:], nil) + // trc("must read: %v %v", n, err) + if n == 0 { + if err != nil && err != io.EOF { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + } + (*darwinDir)(unsafe.Pointer(dir)).eof = true + return 0 + } + + (*darwinDir)(unsafe.Pointer(dir)).l = 0 + (*darwinDir)(unsafe.Pointer(dir)).h = n + // trc("new l %v, h %v", (*darwinDir)(unsafe.Pointer(dir)).l, (*darwinDir)(unsafe.Pointer(dir)).h) + } + de := dir + unsafe.Offsetof(darwinDir{}.buf) + uintptr((*darwinDir)(unsafe.Pointer(dir)).l) + (*darwinDir)(unsafe.Pointer(dir)).l += int((*unix.Dirent)(unsafe.Pointer(de)).Reclen) + return de +} + +type darwinDir struct { + buf [4096]byte + fd int + h int + l int + + eof bool +} + +// int sscanf(const char *str, const char *format, ...); +func Xsscanf(t *TLS, str, format, va uintptr) int32 { + r := scanf(strings.NewReader(GoString(str)), format, va) + // if dmesgs { + // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) + // } + return r +} + +// int * __error(void); +func X__error(t *TLS) uintptr { + return t.errnop +} + +func Xclosedir(t *TLS, dir uintptr) int32 { + r := Xclose(t, int32((*darwinDir)(unsafe.Pointer(dir)).fd)) + Xfree(t, dir) + return r +} + +// DIR *opendir(const char *name); +func Xopendir(t *TLS, name uintptr) uintptr { + p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{}))) + if p == 0 { + panic("OOM") + } + + fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) + if fd < 0 { + if dmesgs { + dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) + } + Xfree(t, p) + return 0 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + (*darwinDir)(unsafe.Pointer(p)).fd = fd + (*darwinDir)(unsafe.Pointer(p)).h = 0 + (*darwinDir)(unsafe.Pointer(p)).l = 0 + (*darwinDir)(unsafe.Pointer(p)).eof = false + return p +} + +// int __xuname(int namesize, void *namebuf) +func X__xuname(t *TLS, namesize int32, namebuf uintptr) int32 { + return Xuname(t, namebuf) +} + +// int chflags(const char *path, u_int flags); +func Xchflags(t *TLS, path uintptr, flags uint64) int32 { + if err := unix.Chflags(GoString(path), int(flags)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int pipe(int pipefd[2]); +func Xpipe(t *TLS, pipefd uintptr) int32 { + var a [2]int + if err := syscall.Pipe(a[:]); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + *(*[2]int32)(unsafe.Pointer(pipefd)) = [2]int32{int32(a[0]), int32(a[1])} + if dmesgs { + dmesg("%v: %v ok", origin(1), a) + } + return 0 +} + +// char *inet_ntoa(struct in_addr in); +func X__inet_ntoa(t *TLS, in1 in.In_addr) uintptr { + panic(todo("")) +} + +func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr { + // Cannot avoid the syscall here, addr sometimes matter. + data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) + if err != 0 { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return ^uintptr(0) // (void*)-1 + } + + if dmesgs { + dmesg("%v: %#x", origin(1), data) + } + return data +} diff --git a/vendor/modernc.org/libc/libc_freebsd_amd64.go b/vendor/modernc.org/libc/libc_freebsd_amd64.go new file mode 100644 index 00000000..54eb87f2 --- /dev/null +++ b/vendor/modernc.org/libc/libc_freebsd_amd64.go @@ -0,0 +1,575 @@ +// Copyright 2021 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "strings" + "unsafe" + + "golang.org/x/sys/unix" + "modernc.org/libc/fcntl" + "modernc.org/libc/sys/types" + "modernc.org/libc/time" + "modernc.org/libc/utime" +) + +// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); +func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// FILE *fopen64(const char *pathname, const char *mode); +func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { + m := strings.ReplaceAll(GoString(mode), "b", "") + var flags int + switch m { + case "r": + flags = fcntl.O_RDONLY + case "r+": + flags = fcntl.O_RDWR + case "w": + flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_TRUNC + case "w+": + flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_TRUNC + case "a": + flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_APPEND + case "a+": + flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_APPEND + default: + panic(m) + } + fd, err := unix.Open(GoString(pathname), int(flags), 0666) + if err != nil { + if dmesgs { + dmesg("%v: %q %q: %v FAIL", origin(1), GoString(pathname), GoString(mode), err) + } + t.setErrno(err) + return 0 + } + + if dmesgs { + dmesg("%v: %q %q: fd %v", origin(1), GoString(pathname), GoString(mode), fd) + } + if p := newFile(t, int32(fd)); p != 0 { + return p + } + + panic("OOM") +} + +// int lstat(const char *pathname, struct stat *statbuf); +func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { + if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(pathname)) + } + return 0 +} + +// int stat(const char *pathname, struct stat *statbuf); +func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { + if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(pathname)) + } + return 0 +} + +// int mkdir(const char *path, mode_t mode); +func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { + if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(path)) + } + return 0 +} + +// int access(const char *pathname, int mode); +func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { + if err := unix.Access(GoString(pathname), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) + } + return 0 +} + +// int unlink(const char *pathname); +func Xunlink(t *TLS, pathname uintptr) int32 { + if err := unix.Unlink(GoString(pathname)); err != nil { + if dmesgs { + dmesg("%v: %q: %v", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); +func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { + var n int + var err error + switch { + case buf == 0 || bufsize == 0: + n, err = unix.Readlink(GoString(path), nil) + default: + n, err = unix.Readlink(GoString(path), (*RawMem)(unsafe.Pointer(buf))[:bufsize:bufsize]) + } + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok") + } + return types.Ssize_t(n) +} + +// int symlink(const char *target, const char *linkpath); +func Xsymlink(t *TLS, target, linkpath uintptr) int32 { + if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int chmod(const char *pathname, mode_t mode) +func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 { + if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) + } + return 0 +} + +// time_t time(time_t *tloc); +func Xtime(t *TLS, tloc uintptr) time.Time_t { + panic(todo("")) + // n := time.Now().UTC().Unix() + // if tloc != 0 { + // *(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n) + // } + // return types.Time_t(n) +} + +// int utimes(const char *filename, const struct timeval times[2]); +func Xutimes(t *TLS, filename, times uintptr) int32 { + var a []unix.Timeval + if times != 0 { + a = make([]unix.Timeval, 2) + a[0] = *(*unix.Timeval)(unsafe.Pointer(times)) + a[1] = *(*unix.Timeval)(unsafe.Pointer(times + unsafe.Sizeof(unix.Timeval{}))) + } + if err := unix.Utimes(GoString(filename), a); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int fstat(int fd, struct stat *statbuf); +func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { + if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: fd %d: ok", origin(1), fd) + } + return 0 +} + +// off64_t lseek64(int fd, off64_t offset, int whence); +func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + n, err := unix.Seek(int(fd), int64(offset), int(whence)) + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return types.Off_t(n) +} + +func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { + var arg uintptr + if args != 0 { + arg = *(*uintptr)(unsafe.Pointer(args)) + } + n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg) + if err != 0 { + if dmesgs { + dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n) + } + return int32(n) +} + +// int rename(const char *oldpath, const char *newpath); +func Xrename(t *TLS, oldpath, newpath uintptr) int32 { + if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int mknod(const char *pathname, mode_t mode, dev_t dev); +func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// int utime(const char *filename, const struct utimbuf *times); +func Xutime(t *TLS, filename, times uintptr) int32 { + var a []unix.Timeval + if times != 0 { + a = make([]unix.Timeval, 2) + a[0].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Factime + a[1].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Fmodtime + } + if err := unix.Utimes(GoString(filename), a); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int chown(const char *pathname, uid_t owner, gid_t group); +func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// int link(const char *oldpath, const char *newpath); +func Xlink(t *TLS, oldpath, newpath uintptr) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// int dup2(int oldfd, int newfd); +func Xdup2(t *TLS, oldfd, newfd int32) int32 { + panic(todo("")) + // n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + // if err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return int32(n) +} + +// unsigned int alarm(unsigned int seconds); +func Xalarm(t *TLS, seconds uint32) uint32 { + panic(todo("")) + // n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0) + // if err != 0 { + // panic(todo("")) + // } + + // return uint32(n) +} + +func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */ + panic(todo("")) + //TODO bp := tls.Alloc(347) + //TODO defer tls.Free(347) + + //TODO // var ptr [78]int8 at bp, 78 + + //TODO // var buf [256]int8 at bp+78, 256 + + //TODO // var num [13]int8 at bp+334, 13 + + //TODO var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) + //TODO var a uintptr + //TODO var scopeid uint32 + + //TODO switch af { + //TODO case 2: + //TODO a = (sa1 + 4 /* &.sin_addr */) + //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{}))) { + //TODO return -6 + //TODO } + //TODO mkptr4(tls, bp /* &ptr[0] */, a) + //TODO scopeid = uint32(0) + //TODO break + //TODO case 10: + //TODO a = (sa1 + 8 /* &.sin6_addr */) + //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{}))) { + //TODO return -6 + //TODO } + //TODO if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { + //TODO mkptr6(tls, bp /* &ptr[0] */, a) + //TODO } else { + //TODO mkptr4(tls, bp /* &ptr[0] */, (a + uintptr(12))) + //TODO } + //TODO scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id + //TODO break + //TODO default: + //TODO return -6 + //TODO } + + //TODO if (node != 0) && (nodelen != 0) { + //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + //TODO if !((flags & 0x01) != 0) { + //TODO reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { + //TODO Xabort(tls) //TODO- + //TODO // unsigned char query[18+PTR_MAX], reply[512]; + //TODO // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, + //TODO // 0, 0, 0, query, sizeof query); + //TODO // query[3] = 0; /* don't need AD flag */ + //TODO // int rlen = __res_send(query, qlen, reply, sizeof reply); + //TODO // buf[0] = 0; + //TODO // if (rlen > 0) + //TODO // __dns_parse(reply, rlen, dns_parse_callback, buf); + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { + //TODO if (flags & 0x08) != 0 { + //TODO return -2 + //TODO } + //TODO Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) + //TODO if scopeid != 0 { + //TODO Xabort(tls) //TODO- + //TODO // char *p = 0, tmp[IF_NAMESIZE+1]; + //TODO // if (!(flags & NI_NUMERICSCOPE) && + //TODO // (IN6_IS_ADDR_LINKLOCAL(a) || + //TODO // IN6_IS_ADDR_MC_LINKLOCAL(a))) + //TODO // p = if_indextoname(scopeid, tmp+1); + //TODO // if (!p) + //TODO // p = itoa(num, scopeid); + //TODO // *--p = '%'; + //TODO // strcat(buf, p); + //TODO } + //TODO } + //TODO if Xstrlen(tls, bp+78 /* &buf[0] */) >= size_t(nodelen) { + //TODO return -12 + //TODO } + //TODO Xstrcpy(tls, node, bp+78 /* &buf[0] */) + //TODO } + + //TODO if (serv != 0) && (servlen != 0) { + //TODO var p uintptr = bp + 78 /* buf */ + //TODO var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) + //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + //TODO if !((flags & 0x02) != 0) { + //TODO reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { + //TODO p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) + //TODO } + //TODO if Xstrlen(tls, p) >= size_t(servlen) { + //TODO return -12 + //TODO } + //TODO Xstrcpy(tls, serv, p) + //TODO } + + //TODO return 0 +} + +func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ + panic(todo("")) + //TODO bp := tls.Alloc(28) + //TODO defer tls.Free(28) + + //TODO //TODO union { + //TODO //TODO struct sockaddr_in sin; + //TODO //TODO struct sockaddr_in6 sin6; + //TODO //TODO } sa = { .sin.sin_family = af }; + //TODO *(*struct { + //TODO sin sockaddr_in + //TODO _ [12]byte + //TODO })(unsafe.Pointer(bp /* sa1 */)) = struct { + //TODO sin sockaddr_in + //TODO _ [12]byte + //TODO }{} //TODO- + //TODO (*sockaddr_in)(unsafe.Pointer(bp /* &sa1 */)).sin_family = sa_family_t(af) //TODO- + //TODO var sl socklen_t + //TODO if af == 10 { + //TODO sl = uint32(unsafe.Sizeof(sockaddr_in6{})) + //TODO } else { + //TODO sl = uint32(unsafe.Sizeof(sockaddr_in{})) + //TODO } + //TODO var i int32 + + //TODO *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) + + //TODO // Load address argument into sockaddr structure + //TODO if (af == 10) && (l == socklen_t(16)) { + //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin6 */ + 8 /* &.sin6_addr */), a, uint64(16)) + //TODO } else if (af == 2) && (l == socklen_t(4)) { + //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin */ + 4 /* &.sin_addr */), a, uint64(4)) + //TODO } else { + //TODO *(*int32)(unsafe.Pointer(err)) = 3 + //TODO return 22 + //TODO } + + //TODO // Align buffer and check for space for pointers and ip address + //TODO i = (int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))) + //TODO if !(i != 0) { + //TODO i = int32(unsafe.Sizeof(uintptr(0))) + //TODO } + //TODO if buflen <= (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) { + //TODO return 34 + //TODO } + //TODO buf += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))) + //TODO buflen = buflen - (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) + + //TODO (*hostent)(unsafe.Pointer(h)).h_addr_list = buf + //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) + //TODO (*hostent)(unsafe.Pointer(h)).h_aliases = buf + //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) + + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf + //TODO Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) + //TODO buf += uintptr(l) + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) + + //TODO switch Xgetnameinfo(tls, bp /* &sa1 */, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { + //TODO case -3: + //TODO *(*int32)(unsafe.Pointer(err)) = 2 + //TODO return 11 + //TODO case -12: + //TODO return 34 + //TODO default: + //TODO fallthrough + //TODO case -10: + //TODO fallthrough + //TODO case -11: + //TODO fallthrough + //TODO case -4: + //TODO *(*int32)(unsafe.Pointer(err)) = 3 + //TODO return *(*int32)(unsafe.Pointer(X___errno_location(tls))) + //TODO case 0: + //TODO break + //TODO } + + //TODO (*hostent)(unsafe.Pointer(h)).h_addrtype = af + //TODO (*hostent)(unsafe.Pointer(h)).h_length = int32(l) + //TODO (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) + //TODO *(*uintptr)(unsafe.Pointer(res)) = h + //TODO return 0 +} + +// int getrlimit(int resource, struct rlimit *rlim); +func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} diff --git a/vendor/modernc.org/libc/libc_linux.go b/vendor/modernc.org/libc/libc_linux.go index aaec3da6..4e656eeb 100644 --- a/vendor/modernc.org/libc/libc_linux.go +++ b/vendor/modernc.org/libc/libc_linux.go @@ -6,6 +6,7 @@ package libc // import "modernc.org/libc" import ( "bufio" + "encoding/hex" "fmt" "os" "os/exec" @@ -41,6 +42,7 @@ import ( var ( in6_addr_any in.In6_addr + _ = X__ctype_b_loc ) type ( @@ -223,7 +225,7 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { //TODO- flags |= fcntl.O_LARGEFILE var mode types.Mode_t if args != 0 { - mode = *(*types.Mode_t)(unsafe.Pointer(args)) + mode = (types.Mode_t)(VaUint32(&args)) } fdcwd := fcntl.AT_FDCWD n, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(fdcwd), pathname, uintptr(flags|unix.O_LARGEFILE), uintptr(mode), 0, 0) @@ -1964,3 +1966,30 @@ func Xctime_r(t *TLS, timep, buf uintptr) uintptr { copy((*RawMem)(unsafe.Pointer(buf))[:26:26], s) return buf } + +// ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); +func Xpwrite(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off_t) types.Ssize_t { + var n int + var err error + switch { + case count == 0: + n, err = unix.Pwrite(int(fd), nil, int64(offset)) + default: + n, err = unix.Pwrite(int(fd), (*RawMem)(unsafe.Pointer(buf))[:count:count], int64(offset)) + if dmesgs { + dmesg("%v: fd %v, off %#x, count %#x\n%s", origin(1), fd, offset, count, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:count:count])) + } + } + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return types.Ssize_t(n) +} diff --git a/vendor/modernc.org/libc/libc_linux_386.go b/vendor/modernc.org/libc/libc_linux_386.go index 8f3d4ea3..a8e5c526 100644 --- a/vendor/modernc.org/libc/libc_linux_386.go +++ b/vendor/modernc.org/libc/libc_linux_386.go @@ -455,12 +455,3 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { t.setErrno(errno.ENOMEM) return 0 } - -// int sscanf(const char *str, const char *format, ...); -func Xsscanf(t *TLS, str, format, va uintptr) int32 { - r := scanf(strings.NewReader(GoString(str)), format, va) - // if dmesgs { - // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) - // } - return r -} diff --git a/vendor/modernc.org/libc/libc_linux_arm.go b/vendor/modernc.org/libc/libc_linux_arm.go index 72f3f129..cfabe77f 100644 --- a/vendor/modernc.org/libc/libc_linux_arm.go +++ b/vendor/modernc.org/libc/libc_linux_arm.go @@ -439,11 +439,11 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { return 0 } -// int sscanf(const char *str, const char *format, ...); -func Xsscanf(t *TLS, str, format, va uintptr) int32 { - r := scanf(strings.NewReader(GoString(str)), format, va) - // if dmesgs { - // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) - // } - return r -} +//TODO- // int sscanf(const char *str, const char *format, ...); +//TODO- func Xsscanf(t *TLS, str, format, va uintptr) int32 { +//TODO- r := scanf(strings.NewReader(GoString(str)), format, va) +//TODO- // if dmesgs { +//TODO- // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) +//TODO- // } +//TODO- return r +//TODO- } diff --git a/vendor/modernc.org/libc/libc_linux_s390x.go b/vendor/modernc.org/libc/libc_linux_s390x.go index c3ef6f28..f2ea9e44 100644 --- a/vendor/modernc.org/libc/libc_linux_s390x.go +++ b/vendor/modernc.org/libc/libc_linux_s390x.go @@ -465,3 +465,16 @@ func Xuuid_unparse(t *TLS, uu uuid.Uuid_t, out uintptr) { func Xuuid_parse(t *TLS, in uintptr, uu uuid.Uuid_t) int32 { panic(todo("")) } + +//TODO- +func __syscall1(t *TLS, trap, p1 long) long { + return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0)) +} + +func __syscall3(t *TLS, trap, p1, p2, p3 long) long { + return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3))) +} + +func __syscall4(t *TLS, trap, p1, p2, p3, p4 long) long { + return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0)) +} diff --git a/vendor/modernc.org/libc/libc_netbsd.go b/vendor/modernc.org/libc/libc_netbsd.go new file mode 100644 index 00000000..db15be74 --- /dev/null +++ b/vendor/modernc.org/libc/libc_netbsd.go @@ -0,0 +1,2166 @@ +// Copyright 2020 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "bufio" + "fmt" + "io" + "os" + "os/exec" + "path/filepath" + "runtime" + "runtime/debug" + "strconv" + "strings" + "syscall" + gotime "time" + "unsafe" + + "golang.org/x/sys/unix" + "modernc.org/libc/errno" + "modernc.org/libc/fcntl" + "modernc.org/libc/fts" + "modernc.org/libc/grp" + gonetdb "modernc.org/libc/honnef.co/go/netdb" + "modernc.org/libc/langinfo" + "modernc.org/libc/limits" + "modernc.org/libc/netdb" + "modernc.org/libc/netinet/in" + "modernc.org/libc/pwd" + "modernc.org/libc/stdio" + "modernc.org/libc/sys/socket" + "modernc.org/libc/sys/stat" + "modernc.org/libc/sys/types" + "modernc.org/libc/termios" + "modernc.org/libc/time" + "modernc.org/libc/unistd" +) + +var ( + in6_addr_any in.In6_addr +) + +type ( + long = int64 + ulong = uint64 +) + +// // Keep these outside of the var block otherwise go generate will miss them. +var X__stderrp = Xstdout +var X__stdinp = Xstdin +var X__stdoutp = Xstdout +var X__sF [3]stdio.FILE +var X_tolower_tab_ = Xmalloc(nil, 2*65537) +var X_toupper_tab_ = Xmalloc(nil, 2*65537) + +func init() { + for c := rune(0); c < 0xffff; c++ { + y := c + s := strings.ToLower(string(c)) + a := []rune(s) + if len(a) != 0 { + y = a[0] + } + (*[65536]uint16)(unsafe.Pointer(X_tolower_tab_))[c+1] = uint16(y) + y = c + s = strings.ToUpper(string(c)) + a = []rune(s) + if len(a) != 0 { + y = a[0] + } + (*[65536]uint16)(unsafe.Pointer(X_toupper_tab_))[c+1] = uint16(y) + } +} + +// include/stdio.h:486:extern int __isthreaded; +var X__isthreaded int32 + +// lib/libc/locale/mblocal.h:62: int __mb_sb_limit; +var X__mb_sb_limit int32 = 128 // UTF-8 + +// include/runetype.h:94:extern _Thread_local const _RuneLocale *_ThreadRuneLocale; +var X_ThreadRuneLocale uintptr //TODO initialize and implement _Thread_local semantics. + +// include/xlocale/_ctype.h:54:_RuneLocale *__runes_for_locale(locale_t, int*); +func X__runes_for_locale(t *TLS, l locale_t, p uintptr) uintptr { + panic(todo("")) +} + +type file uintptr + +func (f file) fd() int32 { return int32((*stdio.FILE)(unsafe.Pointer(f)).F_file) } +func (f file) setFd(fd int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_file = int16(fd) } + +func (f file) err() bool { + return (*stdio.FILE)(unsafe.Pointer(f)).F_flags&1 != 0 +} + +func (f file) setErr() { + (*stdio.FILE)(unsafe.Pointer(f)).F_flags |= 1 +} + +func (f file) close(t *TLS) int32 { + fd := f.fd() + r := Xclose(t, fd) + switch fd { + case unistd.STDIN_FILENO, unistd.STDOUT_FILENO, unistd.STDERR_FILENO: + X__sF[fd] = stdio.FILE{} + default: + Xfree(t, uintptr(f)) + } + if r < 0 { + return stdio.EOF + } + + return 0 +} + +func newFile(t *TLS, fd int32) uintptr { + var p uintptr + switch fd { + case unistd.STDIN_FILENO: + p = uintptr(unsafe.Pointer(&X__sF[0])) + case unistd.STDOUT_FILENO: + p = uintptr(unsafe.Pointer(&X__sF[1])) + case unistd.STDERR_FILENO: + p = uintptr(unsafe.Pointer(&X__sF[2])) + default: + if p = Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(stdio.FILE{}))); p == 0 { + return 0 + } + } + file(p).setFd(fd) + return p +} + +func fwrite(fd int32, b []byte) (int, error) { + if fd == unistd.STDOUT_FILENO { + return write(b) + } + + // if dmesgs { + // dmesg("%v: fd %v: %s", origin(1), fd, b) + // } + return unix.Write(int(fd), b) //TODO use Xwrite +} + +// unsigned long ___runetype(__ct_rune_t) __pure; +func X___runetype(t *TLS, x int32) ulong { + panic(todo("")) +} + +// int fprintf(FILE *stream, const char *format, ...); +func Xfprintf(t *TLS, stream, format, args uintptr) int32 { + n, _ := fwrite(int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file), printf(format, args)) + return int32(n) +} + +// int usleep(useconds_t usec); +func Xusleep(t *TLS, usec uint32) int32 { + gotime.Sleep(gotime.Microsecond * gotime.Duration(usec)) + return 0 +} + +// int getrusage(int who, struct rusage *usage); +func Xgetrusage(t *TLS, who int32, usage uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// char *fgets(char *s, int size, FILE *stream); +func Xfgets(t *TLS, s uintptr, size int32, stream uintptr) uintptr { + fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_file) + var b []byte + buf := [1]byte{} + for ; size > 0; size-- { + n, err := unix.Read(fd, buf[:]) + if n != 0 { + b = append(b, buf[0]) + if buf[0] == '\n' { + b = append(b, 0) + copy((*RawMem)(unsafe.Pointer(s))[:len(b):len(b)], b) + return s + } + + continue + } + + switch { + case n == 0 && err == nil && len(b) == 0: + return 0 + default: + panic(todo("")) + } + + // if err == nil { + // panic("internal error") + // } + + // if len(b) != 0 { + // b = append(b, 0) + // copy((*RawMem)(unsafe.Pointer(s)[:len(b)]), b) + // return s + // } + + // t.setErrno(err) + } + panic(todo("")) +} + +// int lstat(const char *pathname, struct stat *statbuf); +func Xlstat(t *TLS, pathname, statbuf uintptr) int32 { + return Xlstat64(t, pathname, statbuf) +} + +// int stat(const char *pathname, struct stat *statbuf); +func Xstat(t *TLS, pathname, statbuf uintptr) int32 { + return Xstat64(t, pathname, statbuf) +} + +// int chdir(const char *path); +func Xchdir(t *TLS, path uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %q: ok", origin(1), GoString(path)) + // } + return 0 +} + +var localtime time.Tm + +// struct tm *localtime(const time_t *timep); +func Xlocaltime(_ *TLS, timep uintptr) uintptr { + loc := gotime.Local + if r := getenv(Environ(), "TZ"); r != 0 { + zone, off := parseZone(GoString(r)) + loc = gotime.FixedZone(zone, -off) + } + ut := *(*time.Time_t)(unsafe.Pointer(timep)) + t := gotime.Unix(int64(ut), 0).In(loc) + localtime.Ftm_sec = int32(t.Second()) + localtime.Ftm_min = int32(t.Minute()) + localtime.Ftm_hour = int32(t.Hour()) + localtime.Ftm_mday = int32(t.Day()) + localtime.Ftm_mon = int32(t.Month() - 1) + localtime.Ftm_year = int32(t.Year() - 1900) + localtime.Ftm_wday = int32(t.Weekday()) + localtime.Ftm_yday = int32(t.YearDay()) + localtime.Ftm_isdst = Bool32(isTimeDST(t)) + return uintptr(unsafe.Pointer(&localtime)) +} + +// struct tm *localtime_r(const time_t *timep, struct tm *result); +func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr { + panic(todo("")) +} + +// int open(const char *pathname, int flags, ...); +func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { + return Xopen64(t, pathname, flags, args) +} + +// int open(const char *pathname, int flags, ...); +func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { + var mode types.Mode_t + if args != 0 { + mode = (types.Mode_t)(VaUint32(&args)) + } + fdcwd := fcntl.AT_FDCWD + n, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(fdcwd), pathname, uintptr(flags), uintptr(mode), 0, 0) + if err != 0 { + // if dmesgs { + // dmesg("%v: %q %#x: %v", origin(1), GoString(pathname), flags, err) + // } + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %q flags %#x mode %#o: fd %v", origin(1), GoString(pathname), flags, mode, n) + // } + return int32(n) +} + +// off_t lseek(int fd, off_t offset, int whence); +func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + return types.Off_t(Xlseek64(t, fd, offset, whence)) +} + +func whenceStr(whence int32) string { + panic(todo("")) +} + +var fsyncStatbuf stat.Stat + +// int fsync(int fd); +func Xfsync(t *TLS, fd int32) int32 { + if noFsync { + // Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c + return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf))) + } + + if _, _, err := unix.Syscall(unix.SYS_FSYNC, uintptr(fd), 0, 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %d: ok", origin(1), fd) + // } + return 0 +} + +// long sysconf(int name); +func Xsysconf(t *TLS, name int32) long { + switch name { + case unistd.X_SC_PAGESIZE: + return long(unix.Getpagesize()) + case unistd.X_SC_GETPW_R_SIZE_MAX: + return -1 + case unistd.X_SC_GETGR_R_SIZE_MAX: + return -1 + } + + panic(todo("", name)) +} + +// int close(int fd); +func Xclose(t *TLS, fd int32) int32 { + if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %d: ok", origin(1), fd) + // } + return 0 +} + +// char *getcwd(char *buf, size_t size); +func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr { + if _, err := unix.Getcwd((*RawMem)(unsafe.Pointer(buf))[:size:size]); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return 0 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return buf +} + +// int fstat(int fd, struct stat *statbuf); +func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 { + return Xfstat64(t, fd, statbuf) +} + +// int ftruncate(int fd, off_t length); +func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 { + if err := unix.Ftruncate(int(fd), int64(length)); err != nil { + if dmesgs { + dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %d %#x: ok", origin(1), fd, length) + } + return 0 +} + +// int fcntl(int fd, int cmd, ... /* arg */ ); +func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 { + return Xfcntl64(t, fd, cmd, args) +} + +// ssize_t read(int fd, void *buf, size_t count); +func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t { + n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count)) + if err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // // dmesg("%v: %d %#x: %#x\n%s", origin(1), fd, count, n, hex.Dump(GoBytes(buf, int(n)))) + // dmesg("%v: %d %#x: %#x", origin(1), fd, count, n) + // } + return types.Ssize_t(n) +} + +// ssize_t write(int fd, const void *buf, size_t count); +func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t { + const retry = 5 + var err syscall.Errno + for i := 0; i < retry; i++ { + var n uintptr + switch n, _, err = unix.Syscall(unix.SYS_WRITE, uintptr(fd), buf, uintptr(count)); err { + case 0: + // if dmesgs { + // // dmesg("%v: %d %#x: %#x\n%s", origin(1), fd, count, n, hex.Dump(GoBytes(buf, int(n)))) + // dmesg("%v: %d %#x: %#x", origin(1), fd, count, n) + // } + return types.Ssize_t(n) + case errno.EAGAIN: + // nop + } + } + + // if dmesgs { + // dmesg("%v: fd %v, count %#x: %v", origin(1), fd, count, err) + // } + t.setErrno(err) + return -1 +} + +// int fchmod(int fd, mode_t mode); +func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 { + if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 { + t.setErrno(err) + return -1 + } + + // if dmesgs { + // dmesg("%v: %d %#o: ok", origin(1), fd, mode) + // } + return 0 +} + +// int fchown(int fd, uid_t owner, gid_t group); +func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 { + if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// uid_t geteuid(void); +func Xgeteuid(t *TLS) types.Uid_t { + n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0) + return types.Uid_t(n) +} + +// int munmap(void *addr, size_t length); +func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 { + if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int gettimeofday(struct timeval *tv, struct timezone *tz); +func Xgettimeofday(t *TLS, tv, tz uintptr) int32 { + if tz != 0 { + panic(todo("")) + } + + var tvs unix.Timeval + err := unix.Gettimeofday(&tvs) + if err != nil { + t.setErrno(err) + return -1 + } + + *(*unix.Timeval)(unsafe.Pointer(tv)) = tvs + return 0 +} + +// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen); +func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 { + if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen); +func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 { + if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int ioctl(int fd, unsigned long request, ...); +func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 { + var argp uintptr + if va != 0 { + argp = VaUintptr(&va) + } + n, _, err := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(request), argp) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 { + // if dmesgs { + // dmesg("%v: fd %v: %v", origin(1), sockfd, err) + // } + t.setErrno(err) + return -1 + } + + return 0 +} + +// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); +func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 { + n, err := unix.Select( + int(nfds), + (*unix.FdSet)(unsafe.Pointer(readfds)), + (*unix.FdSet)(unsafe.Pointer(writefds)), + (*unix.FdSet)(unsafe.Pointer(exceptfds)), + (*unix.Timeval)(unsafe.Pointer(timeout)), + ) + if err != nil { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int mkfifo(const char *pathname, mode_t mode); +func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 { + panic(todo("")) +} + +// mode_t umask(mode_t mask); +func Xumask(t *TLS, mask types.Mode_t) types.Mode_t { + n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0) + return types.Mode_t(n) +} + +// int execvp(const char *file, char *const argv[]); +func Xexecvp(t *TLS, file, argv uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// pid_t waitpid(pid_t pid, int *wstatus, int options); +func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t { + n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return types.Pid_t(n) +} + +// int uname(struct utsname *buf); +func Xuname(t *TLS, buf uintptr) int32 { + if err := unix.Uname((*unix.Utsname)(unsafe.Pointer(buf))); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// ssize_t recv(int sockfd, void *buf, size_t len, int flags); +func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t { + n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return types.Ssize_t(n) +} + +// ssize_t send(int sockfd, const void *buf, size_t len, int flags); +func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t { + n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0) + if err != 0 { + t.setErrno(err) + return -1 + } + + return types.Ssize_t(n) +} + +// int shutdown(int sockfd, int how); +func Xshutdown(t *TLS, sockfd, how int32) int32 { + if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int socket(int domain, int type, int protocol); +func Xsocket(t *TLS, domain, type1, protocol int32) int32 { + n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol)) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 { + n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen)) + if err != 0 { + t.setErrno(err) + return -1 + } + + return int32(n) +} + +// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); +func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 { + if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int listen(int sockfd, int backlog); +func Xlisten(t *TLS, sockfd, backlog int32) int32 { + if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen); +func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 { + panic(todo("")) + // n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0) + // if err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return int32(n) +} + +// int getrlimit(int resource, struct rlimit *rlim); +func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 { + return Xgetrlimit64(t, resource, rlim) +} + +// int setrlimit(int resource, const struct rlimit *rlim); +func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 { + return Xsetrlimit64(t, resource, rlim) +} + +// int setrlimit(int resource, const struct rlimit *rlim); +func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} + +// uid_t getuid(void); +func Xgetuid(t *TLS) types.Uid_t { + return types.Uid_t(os.Getuid()) +} + +// pid_t getpid(void); +func Xgetpid(t *TLS) int32 { + return int32(os.Getpid()) +} + +// int system(const char *command); +func Xsystem(t *TLS, command uintptr) int32 { + s := GoString(command) + if command == 0 { + panic(todo("")) + } + + cmd := exec.Command("sh", "-c", s) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + if err != nil { + ps := err.(*exec.ExitError) + return int32(ps.ExitCode()) + } + + return 0 +} + +var staticGetpwuid pwd.Passwd + +func init() { + atExit = append(atExit, func() { closePasswd(&staticGetpwuid) }) +} + +func closePasswd(p *pwd.Passwd) { + Xfree(nil, p.Fpw_name) + Xfree(nil, p.Fpw_passwd) + Xfree(nil, p.Fpw_gecos) + Xfree(nil, p.Fpw_dir) + Xfree(nil, p.Fpw_shell) + *p = pwd.Passwd{} +} + +// struct passwd *getpwuid(uid_t uid); +func Xgetpwuid(t *TLS, uid uint32) uintptr { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sid := strconv.Itoa(int(uid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + s := sc.Text() + if strings.HasPrefix(s, "#") { + continue + } + + a := strings.Split(s, ":") + if len(a) < 7 { + panic(todo("%q", s)) + } + + if a[2] == sid { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + closePasswd(&staticGetpwuid) + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + initPasswd(t, &staticGetpwuid, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) + return uintptr(unsafe.Pointer(&staticGetpwuid)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +func initPasswd(t *TLS, p *pwd.Passwd, name, pwd string, uid, gid uint32, gecos, dir, shell string) { + p.Fpw_name = cString(t, name) + p.Fpw_passwd = cString(t, pwd) + p.Fpw_uid = uid + p.Fpw_gid = gid + p.Fpw_gecos = cString(t, gecos) + p.Fpw_dir = cString(t, dir) + p.Fpw_shell = cString(t, shell) +} + +func initPasswd2(t *TLS, buf uintptr, buflen types.Size_t, p *pwd.Passwd, name, pwd string, uid, gid uint32, gecos, dir, shell string) bool { + p.Fpw_name, buf, buflen = bufString(buf, buflen, name) + if buf == 0 { + return false + } + + p.Fpw_passwd, buf, buflen = bufString(buf, buflen, pwd) + if buf == 0 { + return false + } + + p.Fpw_uid = uid + p.Fpw_gid = gid + if buf == 0 { + return false + } + + p.Fpw_gecos, buf, buflen = bufString(buf, buflen, gecos) + if buf == 0 { + return false + } + + p.Fpw_dir, buf, buflen = bufString(buf, buflen, dir) + if buf == 0 { + return false + } + + p.Fpw_shell, buf, buflen = bufString(buf, buflen, shell) + if buf == 0 { + return false + } + + return true +} + +func bufString(buf uintptr, buflen types.Size_t, s string) (uintptr, uintptr, types.Size_t) { + buf0 := buf + rq := len(s) + 1 + if rq > int(buflen) { + return 0, 0, 0 + } + + copy((*RawMem)(unsafe.Pointer(buf))[:len(s):len(s)], s) + buf += uintptr(len(s)) + *(*byte)(unsafe.Pointer(buf)) = 0 + return buf0, buf + 1, buflen - types.Size_t(rq) +} + +// int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); +func Xgetpwuid_r(t *TLS, uid types.Uid_t, cpwd, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sid := strconv.Itoa(int(uid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + a := strings.Split(sc.Text(), ":") + if len(a) < 7 { + panic(todo("")) + } + + if a[2] == sid { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + var v pwd.Passwd + if initPasswd2(t, buf, buflen, &v, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) { + *(*pwd.Passwd)(unsafe.Pointer(cpwd)) = v + *(*uintptr)(unsafe.Pointer(result)) = cpwd + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return errno.ERANGE + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +// struct passwd *getpwnam(const char *name); +func Xgetpwnam(t *TLS, name uintptr) uintptr { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + a := strings.Split(sc.Text(), ":") + if len(a) < 7 { + panic(todo("")) + } + + if a[0] == sname { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + closePasswd(&staticGetpwnam) + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + initPasswd(t, &staticGetpwnam, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) + return uintptr(unsafe.Pointer(&staticGetpwnam)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +// int getpwnam_r(char *name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); +func Xgetpwnam_r(t *TLS, name, cpwd, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/passwd") + if err != nil { + panic(todo("", err)) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:0:root:/root:/bin/bash" + a := strings.Split(sc.Text(), ":") + if len(a) < 7 { + panic(todo("")) + } + + if a[0] == sname { + uid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + gid, err := strconv.Atoi(a[3]) + if err != nil { + panic(todo("")) + } + + gecos := a[4] + if strings.Contains(gecos, ",") { + a := strings.Split(gecos, ",") + gecos = a[0] + } + var v pwd.Passwd + if initPasswd2(t, buf, buflen, &v, a[0], a[1], uint32(uid), uint32(gid), gecos, a[5], a[6]) { + *(*pwd.Passwd)(unsafe.Pointer(cpwd)) = v + *(*uintptr)(unsafe.Pointer(result)) = cpwd + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return errno.ERANGE + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +// int setvbuf(FILE *stream, char *buf, int mode, size_t size); +func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 { + return 0 //TODO +} + +// int raise(int sig); +func Xraise(t *TLS, sig int32) int32 { + panic(todo("")) +} + +// int backtrace(void **buffer, int size); +func Xbacktrace(t *TLS, buf uintptr, size int32) int32 { + panic(todo("")) +} + +// void backtrace_symbols_fd(void *const *buffer, int size, int fd); +func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) { + panic(todo("")) +} + +// int fileno(FILE *stream); +func Xfileno(t *TLS, stream uintptr) int32 { + panic(todo("")) +} + +var staticGetpwnam pwd.Passwd + +func init() { + atExit = append(atExit, func() { closePasswd(&staticGetpwnam) }) +} + +var staticGetgrnam grp.Group + +func init() { + atExit = append(atExit, func() { closeGroup(&staticGetgrnam) }) +} + +// struct group *getgrnam(const char *name); +func Xgetgrnam(t *TLS, name uintptr) uintptr { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[0] == sname { + closeGroup(&staticGetgrnam) + gid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + initGroup(t, &staticGetgrnam, a[0], a[1], uint32(gid), names) + return uintptr(unsafe.Pointer(&staticGetgrnam)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +// int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result); +func Xgetgrnam_r(t *TLS, name, pGrp, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sname := GoString(name) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[0] == sname { + gid, err := strconv.Atoi(a[2]) + if err != nil { + panic(todo("")) + } + + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + var x grp.Group + if initGroup2(buf, buflen, &x, a[0], a[1], uint32(gid), names) { + *(*grp.Group)(unsafe.Pointer(pGrp)) = x + *(*uintptr)(unsafe.Pointer(result)) = pGrp + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +func closeGroup(p *grp.Group) { + Xfree(nil, p.Fgr_name) + Xfree(nil, p.Fgr_passwd) + if p := p.Fgr_mem; p != 0 { + for { + q := *(*uintptr)(unsafe.Pointer(p)) + if q == 0 { + break + } + + Xfree(nil, q) + p += unsafe.Sizeof(uintptr(0)) + } + } + *p = grp.Group{} +} + +func initGroup(t *TLS, p *grp.Group, name, pwd string, gid uint32, names []string) { + p.Fgr_name = cString(t, name) + p.Fgr_passwd = cString(t, pwd) + p.Fgr_gid = gid + a := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(uintptr(0)))*types.Size_t((len(names)+1))) + if a == 0 { + panic("OOM") + } + + for p := a; len(names) != 0; p += unsafe.Sizeof(uintptr(0)) { + *(*uintptr)(unsafe.Pointer(p)) = cString(t, names[0]) + names = names[1:] + } + p.Fgr_mem = a +} + +func initGroup2(buf uintptr, buflen types.Size_t, p *grp.Group, name, pwd string, gid uint32, names []string) bool { + p.Fgr_name, buf, buflen = bufString(buf, buflen, name) + if buf == 0 { + return false + } + + p.Fgr_passwd, buf, buflen = bufString(buf, buflen, pwd) + if buf == 0 { + return false + } + + p.Fgr_gid = gid + rq := unsafe.Sizeof(uintptr(0)) * uintptr(len(names)+1) + if rq > uintptr(buflen) { + return false + } + + a := buf + buf += rq + for ; len(names) != 0; buf += unsafe.Sizeof(uintptr(0)) { + if len(names[0])+1 > int(buflen) { + return false + } + + *(*uintptr)(unsafe.Pointer(buf)), buf, buflen = bufString(buf, buflen, names[0]) + names = names[1:] + } + *(*uintptr)(unsafe.Pointer(buf)) = 0 + p.Fgr_mem = a + return true +} + +func init() { + atExit = append(atExit, func() { closeGroup(&staticGetgrgid) }) +} + +var staticGetgrgid grp.Group + +// struct group *getgrgid(gid_t gid); +func Xgetgrgid(t *TLS, gid uint32) uintptr { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sid := strconv.Itoa(int(gid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[2] == sid { + closeGroup(&staticGetgrgid) + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + initGroup(t, &staticGetgrgid, a[0], a[1], gid, names) + return uintptr(unsafe.Pointer(&staticGetgrgid)) + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + return 0 +} + +// int getgrgid_r(gid_t gid, struct group *grp, char *buf, size_t buflen, struct group **result); +func Xgetgrgid_r(t *TLS, gid uint32, pGrp, buf uintptr, buflen types.Size_t, result uintptr) int32 { + f, err := os.Open("/etc/group") + if err != nil { + panic(todo("")) + } + + defer f.Close() + + sid := strconv.Itoa(int(gid)) + sc := bufio.NewScanner(f) + for sc.Scan() { + // eg. "root:x:0:" + a := strings.Split(sc.Text(), ":") + if len(a) < 4 { + panic(todo("")) + } + + if a[2] == sid { + var names []string + if a[3] != "" { + names = strings.Split(a[3], ",") + } + var x grp.Group + if initGroup2(buf, buflen, &x, a[0], a[1], gid, names) { + *(*grp.Group)(unsafe.Pointer(pGrp)) = x + *(*uintptr)(unsafe.Pointer(result)) = pGrp + return 0 + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 + } + } + + if sc.Err() != nil { + panic(todo("")) + } + + *(*uintptr)(unsafe.Pointer(result)) = 0 + return 0 +} + +// int mkstemps(char *template, int suffixlen); +func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 { + return Xmkstemps64(t, template, suffixlen) +} + +// int mkstemps(char *template, int suffixlen); +func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 { + len := uintptr(Xstrlen(t, template)) + x := template + uintptr(len-6) - uintptr(suffixlen) + for i := uintptr(0); i < 6; i++ { + if *(*byte)(unsafe.Pointer(x + i)) != 'X' { + if dmesgs { + dmesg("%v: FAIL", origin(1)) + } + t.setErrno(errno.EINVAL) + return -1 + } + } + + fd, err := tempFile(template, x) + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + return int32(fd) +} + +// int mkstemp(char *template); +func Xmkstemp(t *TLS, template uintptr) int32 { + return Xmkstemp64(t, template) +} + +// int mkstemp(char *template); +func Xmkstemp64(t *TLS, template uintptr) int32 { + return Xmkstemps64(t, template, 0) +} + +func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { + var statp uintptr + if stat != nil { + statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) + if statp == 0 { + panic("OOM") + } + + *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat + } + csp, errx := CString(path) + if errx != nil { + panic("OOM") + } + + return &fts.FTSENT{ + Ffts_info: uint16(info), + Ffts_path: csp, + Ffts_pathlen: uint32(len(path)), + Ffts_statp: statp, + Ffts_errno: int32(err), + } +} + +func newCFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) uintptr { + p := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(fts.FTSENT{}))) + if p == 0 { + panic("OOM") + } + + *(*fts.FTSENT)(unsafe.Pointer(p)) = *newFtsent(t, info, path, stat, err) + return p +} + +func ftsentClose(t *TLS, p uintptr) { + Xfree(t, (*fts.FTSENT)(unsafe.Pointer(p)).Ffts_path) + Xfree(t, (*fts.FTSENT)(unsafe.Pointer(p)).Ffts_statp) +} + +type ftstream struct { + s []uintptr + x int +} + +func (f *ftstream) close(t *TLS) { + for _, p := range f.s { + ftsentClose(t, p) + Xfree(t, p) + } + *f = ftstream{} +} + +// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **)); +func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr { + return Xfts64_open(t, path_argv, options, compar) +} + +// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **)); +func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr { + f := &ftstream{} + + var walk func(string) + walk = func(path string) { + var fi os.FileInfo + var err error + switch { + case options&fts.FTS_LOGICAL != 0: + fi, err = os.Stat(path) + case options&fts.FTS_PHYSICAL != 0: + fi, err = os.Lstat(path) + default: + panic(todo("")) + } + + if err != nil { + return + } + + var statp *unix.Stat_t + if options&fts.FTS_NOSTAT == 0 { + var stat unix.Stat_t + switch { + case options&fts.FTS_LOGICAL != 0: + if err := unix.Stat(path, &stat); err != nil { + panic(todo("")) + } + case options&fts.FTS_PHYSICAL != 0: + if err := unix.Lstat(path, &stat); err != nil { + panic(todo("")) + } + default: + panic(todo("")) + } + + statp = &stat + } + + out: + switch { + case fi.IsDir(): + f.s = append(f.s, newCFtsent(t, fts.FTS_D, path, statp, 0)) + g, err := os.Open(path) + switch x := err.(type) { + case nil: + // ok + case *os.PathError: + f.s = append(f.s, newCFtsent(t, fts.FTS_DNR, path, statp, errno.EACCES)) + break out + default: + panic(todo("%q: %v %T", path, x, x)) + } + + names, err := g.Readdirnames(-1) + g.Close() + if err != nil { + panic(todo("")) + } + + for _, name := range names { + walk(path + "/" + name) + if f == nil { + break out + } + } + + f.s = append(f.s, newCFtsent(t, fts.FTS_DP, path, statp, 0)) + default: + info := fts.FTS_F + if fi.Mode()&os.ModeSymlink != 0 { + info = fts.FTS_SL + } + switch { + case statp != nil: + f.s = append(f.s, newCFtsent(t, info, path, statp, 0)) + case options&fts.FTS_NOSTAT != 0: + f.s = append(f.s, newCFtsent(t, fts.FTS_NSOK, path, nil, 0)) + default: + panic(todo("")) + } + } + } + + for { + p := *(*uintptr)(unsafe.Pointer(path_argv)) + if p == 0 { + if f == nil { + return 0 + } + + if compar != 0 { + panic(todo("")) + } + + return addObject(f) + } + + walk(GoString(p)) + path_argv += unsafe.Sizeof(uintptr(0)) + } +} + +// FTSENT *fts_read(FTS *ftsp); +func Xfts_read(t *TLS, ftsp uintptr) uintptr { + return Xfts64_read(t, ftsp) +} + +// FTSENT *fts_read(FTS *ftsp); +func Xfts64_read(t *TLS, ftsp uintptr) uintptr { + f := getObject(ftsp).(*ftstream) + if f.x == len(f.s) { + t.setErrno(0) + return 0 + } + + r := f.s[f.x] + if e := (*fts.FTSENT)(unsafe.Pointer(r)).Ffts_errno; e != 0 { + t.setErrno(e) + } + f.x++ + return r +} + +// int fts_close(FTS *ftsp); +func Xfts_close(t *TLS, ftsp uintptr) int32 { + return Xfts64_close(t, ftsp) +} + +// int fts_close(FTS *ftsp); +func Xfts64_close(t *TLS, ftsp uintptr) int32 { + getObject(ftsp).(*ftstream).close(t) + removeObject(ftsp) + return 0 +} + +// void tzset (void); +func Xtzset(t *TLS) { + //TODO +} + +var strerrorBuf [100]byte + +// char *strerror(int errnum); +func Xstrerror(t *TLS, errnum int32) uintptr { + if dmesgs { + dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack()) + } + copy(strerrorBuf[:], fmt.Sprintf("strerror(%d)\x00", errnum)) + return uintptr(unsafe.Pointer(&strerrorBuf[0])) +} + +// void *dlopen(const char *filename, int flags); +func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr { + panic(todo("")) +} + +// char *dlerror(void); +func Xdlerror(t *TLS) uintptr { + panic(todo("")) +} + +// int dlclose(void *handle); +func Xdlclose(t *TLS, handle uintptr) int32 { + panic(todo("")) +} + +// void *dlsym(void *handle, const char *symbol); +func Xdlsym(t *TLS, handle, symbol uintptr) uintptr { + panic(todo("")) +} + +// void perror(const char *s); +func Xperror(t *TLS, s uintptr) { + panic(todo("")) +} + +// int pclose(FILE *stream); +func Xpclose(t *TLS, stream uintptr) int32 { + panic(todo("")) +} + +var gai_strerrorBuf [100]byte + +// const char *gai_strerror(int errcode); +func Xgai_strerror(t *TLS, errcode int32) uintptr { + copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode)) + return uintptr(unsafe.Pointer(&gai_strerrorBuf)) +} + +// int tcgetattr(int fd, struct termios *termios_p); +func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 { + panic(todo("")) +} + +// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); +func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 { + panic(todo("")) +} + +// speed_t cfgetospeed(const struct termios *termios_p); +func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t { + panic(todo("")) +} + +// int cfsetospeed(struct termios *termios_p, speed_t speed); +func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 { + panic(todo("")) +} + +// int cfsetispeed(struct termios *termios_p, speed_t speed); +func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 { + panic(todo("")) +} + +// pid_t fork(void); +func Xfork(t *TLS) int32 { + t.setErrno(errno.ENOSYS) + return -1 +} + +var emptyStr = [1]byte{} + +// char *setlocale(int category, const char *locale); +func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr { + return uintptr(unsafe.Pointer(&emptyStr)) //TODO +} + +// char *nl_langinfo(nl_item item); +func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr { + return uintptr(unsafe.Pointer(&emptyStr)) //TODO +} + +// FILE *popen(const char *command, const char *type); +func Xpopen(t *TLS, command, type1 uintptr) uintptr { + panic(todo("")) +} + +// char *realpath(const char *path, char *resolved_path); +func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr { + s, err := filepath.EvalSymlinks(GoString(path)) + if err != nil { + if os.IsNotExist(err) { + // if dmesgs { + // dmesg("%v: %q: %v", origin(1), GoString(path), err) + // } + t.setErrno(errno.ENOENT) + return 0 + } + + panic(todo("", err)) + } + + if resolved_path == 0 { + panic(todo("")) + } + + if len(s) >= limits.PATH_MAX { + s = s[:limits.PATH_MAX-1] + } + + copy((*RawMem)(unsafe.Pointer(resolved_path))[:len(s):len(s)], s) + (*RawMem)(unsafe.Pointer(resolved_path))[len(s)] = 0 + return resolved_path +} + +// struct tm *gmtime_r(const time_t *timep, struct tm *result); +func Xgmtime_r(t *TLS, timep, result uintptr) uintptr { + panic(todo("")) +} + +// char *inet_ntoa(struct in_addr in); +func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr { + panic(todo("")) +} + +func X__ccgo_in6addr_anyp(t *TLS) uintptr { + return uintptr(unsafe.Pointer(&in6_addr_any)) +} + +func Xabort(t *TLS) { + panic(todo("")) //TODO + // if dmesgs { + // dmesg("%v:", origin(1)) + // } + // p := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(signal.Sigaction{}))) + // if p == 0 { + // panic("OOM") + // } + + // (*signal.Sigaction)(unsafe.Pointer(p)).F__sigaction_u.F__sa_handler = signal.SIG_DFL + // Xsigaction(t, signal.SIGABRT, p, 0) + // Xfree(t, p) + // unix.Kill(unix.Getpid(), syscall.Signal(signal.SIGABRT)) + // panic(todo("unrechable")) +} + +// int fflush(FILE *stream); +func Xfflush(t *TLS, stream uintptr) int32 { + return 0 //TODO +} + +// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); +func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { + m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) + if err != 0 { + file(stream).setErr() + return 0 + } + + // if dmesgs { + // // dmesg("%v: %d %#x x %#x: %#x\n%s", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size, hex.Dump(GoBytes(ptr, int(m)))) + // dmesg("%v: %d %#x x %#x: %#x", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size) + // } + return types.Size_t(m) / size +} + +// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); +func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { + m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb)) + if err != 0 { + file(stream).setErr() + return 0 + } + + // if dmesgs { + // // dmesg("%v: %d %#x x %#x: %#x\n%s", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size, hex.Dump(GoBytes(ptr, int(m)))) + // dmesg("%v: %d %#x x %#x: %#x", origin(1), file(stream).fd(), size, nmemb, types.Size_t(m)/size) + // } + return types.Size_t(m) / size +} + +// int fclose(FILE *stream); +func Xfclose(t *TLS, stream uintptr) int32 { + return file(stream).close(t) +} + +// int fputc(int c, FILE *stream); +func Xfputc(t *TLS, c int32, stream uintptr) int32 { + if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil { + return stdio.EOF + } + + return int32(byte(c)) +} + +// int fseek(FILE *stream, long offset, int whence); +func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 { + if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 { + // if dmesgs { + // dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n) + // } + file(stream).setErr() + return -1 + } + + // if dmesgs { + // dmesg("%v: fd %v, off %#x, whence %v: ok", origin(1), file(stream).fd(), offset, whenceStr(whence)) + // } + return 0 +} + +// long ftell(FILE *stream); +func Xftell(t *TLS, stream uintptr) long { + n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR) + if n < 0 { + file(stream).setErr() + return -1 + } + + // if dmesgs { + // dmesg("%v: fd %v, n %#x: ok %#x", origin(1), file(stream).fd(), n, long(n)) + // } + return long(n) +} + +// int ferror(FILE *stream); +func Xferror(t *TLS, stream uintptr) int32 { + return Bool32(file(stream).err()) +} + +// int fgetc(FILE *stream); +func Xfgetc(t *TLS, stream uintptr) int32 { + panic(todo("")) +} + +// int getc(FILE *stream); +func Xgetc(t *TLS, stream uintptr) int32 { + return Xfgetc(t, stream) +} + +// int ungetc(int c, FILE *stream); +func Xungetc(t *TLS, c int32, stream uintptr) int32 { + panic(todo("")) +} + +// int fscanf(FILE *stream, const char *format, ...); +func Xfscanf(t *TLS, stream, format, va uintptr) int32 { + panic(todo("")) +} + +// FILE *fdopen(int fd, const char *mode); +func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr { + panic(todo("")) +} + +// int fputs(const char *s, FILE *stream); +func Xfputs(t *TLS, s, stream uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 { + return -1 + } + + return 0 +} + +var getservbynameStaticResult netdb.Servent + +// struct servent *getservbyname(const char *name, const char *proto); +func Xgetservbyname(t *TLS, name, proto uintptr) uintptr { + var protoent *gonetdb.Protoent + if proto != 0 { + protoent = gonetdb.GetProtoByName(GoString(proto)) + } + servent := gonetdb.GetServByName(GoString(name), protoent) + if servent == nil { + // if dmesgs { + // dmesg("%q %q: nil (protoent %+v)", GoString(name), GoString(proto), protoent) + // } + return 0 + } + + Xfree(t, (*netdb.Servent)(unsafe.Pointer(&getservbynameStaticResult)).Fs_name) + if v := (*netdb.Servent)(unsafe.Pointer(&getservbynameStaticResult)).Fs_aliases; v != 0 { + for { + p := *(*uintptr)(unsafe.Pointer(v)) + if p == 0 { + break + } + + Xfree(t, p) + v += unsafe.Sizeof(uintptr(0)) + } + Xfree(t, v) + } + Xfree(t, (*netdb.Servent)(unsafe.Pointer(&getservbynameStaticResult)).Fs_proto) + cname, err := CString(servent.Name) + if err != nil { + getservbynameStaticResult = netdb.Servent{} + return 0 + } + + var protoname uintptr + if protoent != nil { + if protoname, err = CString(protoent.Name); err != nil { + Xfree(t, cname) + getservbynameStaticResult = netdb.Servent{} + return 0 + } + } + var a []uintptr + for _, v := range servent.Aliases { + cs, err := CString(v) + if err != nil { + for _, v := range a { + Xfree(t, v) + } + return 0 + } + + a = append(a, cs) + } + v := Xcalloc(t, types.Size_t(len(a)+1), types.Size_t(unsafe.Sizeof(uintptr(0)))) + if v == 0 { + Xfree(t, cname) + Xfree(t, protoname) + for _, v := range a { + Xfree(t, v) + } + getservbynameStaticResult = netdb.Servent{} + return 0 + } + for _, p := range a { + *(*uintptr)(unsafe.Pointer(v)) = p + v += unsafe.Sizeof(uintptr(0)) + } + + getservbynameStaticResult = netdb.Servent{ + Fs_name: cname, + Fs_aliases: v, + Fs_port: int32(servent.Port), + Fs_proto: protoname, + } + return uintptr(unsafe.Pointer(&getservbynameStaticResult)) +} + +func Xreaddir64(t *TLS, dir uintptr) uintptr { + return Xreaddir(t, dir) +} + +func __syscall(r, _ uintptr, errno syscall.Errno) long { + if errno != 0 { + return long(-errno) + } + + return long(r) +} + +func X__syscall1(t *TLS, trap, p1 long) long { + return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0)) +} + +func X__syscall3(t *TLS, trap, p1, p2, p3 long) long { + return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3))) +} + +func X__syscall4(t *TLS, trap, p1, p2, p3, p4 long) long { + return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0)) +} + +func fcntlCmdStr(cmd int32) string { + switch cmd { + case fcntl.F_GETOWN: + return "F_GETOWN" + case fcntl.F_SETLK: + return "F_SETLK" + case fcntl.F_GETLK: + return "F_GETLK" + case fcntl.F_SETFD: + return "F_SETFD" + case fcntl.F_GETFD: + return "F_GETFD" + default: + return fmt.Sprintf("cmd(%d)", cmd) + } +} + +// int setenv(const char *name, const char *value, int overwrite); +func Xsetenv(t *TLS, name, value uintptr, overwrite int32) int32 { + panic(todo("")) +} + +// int unsetenv(const char *name); +func Xunsetenv(t *TLS, name uintptr) int32 { + panic(todo("")) +} + +// int pause(void); +func Xpause(t *TLS) int32 { + panic(todo("")) +} + +// ssize_t writev(int fd, const struct iovec *iov, int iovcnt); +func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t { + panic(todo("")) +} + +// void endpwent(void); +func Xendpwent(t *TLS) { + // nop +} + +// int __isoc99_sscanf(const char *str, const char *format, ...); +func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 { + r := Xsscanf(t, str, format, va) + // if dmesgs { + // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) + // } + return r +} + +// int sched_yield(void); +func Xsched_yield(t *TLS) { + runtime.Gosched() +} + +var ctimeStaticBuf [32]byte + +// char *ctime(const time_t *timep); +func Xctime(t *TLS, timep uintptr) uintptr { + return Xctime_r(t, timep, uintptr(unsafe.Pointer(&ctimeStaticBuf[0]))) +} + +// char *ctime_r(const time_t *timep, char *buf); +func Xctime_r(t *TLS, timep, buf uintptr) uintptr { + panic(todo("")) +} + +// void __assert(const char * func, const char * file, int line, const char *expr) __dead2; +func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) { + X__assert_fail(t, expr, file, uint32(line), fn) +} + +func X__assert13(t *TLS, file uintptr, line int32, fn, msg uintptr) { + X__assert_fail(t, msg, file, uint32(line), fn) +} + +// include/stdio.h:456:int __swbuf(int, FILE *); +func X__swbuf(t *TLS, n int32, file uintptr) int32 { + return Xfputc(t, n, file) //TODO improve performance, use a real buffer. +} + +// int rmdir(const char *pathname); +func Xrmdir(t *TLS, pathname uintptr) int32 { + if err := unix.Rmdir(GoString(pathname)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// struct dirent *readdir(DIR *dirp); +func Xreaddir(t *TLS, dir uintptr) uintptr { + if (*darwinDir)(unsafe.Pointer(dir)).eof { + return 0 + } + + if (*darwinDir)(unsafe.Pointer(dir)).l == (*darwinDir)(unsafe.Pointer(dir)).h { + n, err := unix.Getdirentries((*darwinDir)(unsafe.Pointer(dir)).fd, (*darwinDir)(unsafe.Pointer(dir)).buf[:], nil) + // trc("must read: %v %v", n, err) + if n == 0 { + if err != nil && err != io.EOF { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + } + (*darwinDir)(unsafe.Pointer(dir)).eof = true + return 0 + } + + (*darwinDir)(unsafe.Pointer(dir)).l = 0 + (*darwinDir)(unsafe.Pointer(dir)).h = n + // trc("new l %v, h %v", (*darwinDir)(unsafe.Pointer(dir)).l, (*darwinDir)(unsafe.Pointer(dir)).h) + } + de := dir + unsafe.Offsetof(darwinDir{}.buf) + uintptr((*darwinDir)(unsafe.Pointer(dir)).l) + (*darwinDir)(unsafe.Pointer(dir)).l += int((*unix.Dirent)(unsafe.Pointer(de)).Reclen) + return de +} + +type darwinDir struct { + buf [4096]byte + fd int + h int + l int + + eof bool +} + +// int sscanf(const char *str, const char *format, ...); +func Xsscanf(t *TLS, str, format, va uintptr) int32 { + r := scanf(strings.NewReader(GoString(str)), format, va) + // if dmesgs { + // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) + // } + return r +} + +// int * __error(void); +func X__error(t *TLS) uintptr { + return t.errnop +} + +func Xclosedir(t *TLS, dir uintptr) int32 { + r := Xclose(t, int32((*darwinDir)(unsafe.Pointer(dir)).fd)) + Xfree(t, dir) + return r +} + +// DIR *opendir(const char *name); +func Xopendir(t *TLS, name uintptr) uintptr { + p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{}))) + if p == 0 { + panic("OOM") + } + + fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) + if fd < 0 { + if dmesgs { + dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) + } + Xfree(t, p) + return 0 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + (*darwinDir)(unsafe.Pointer(p)).fd = fd + (*darwinDir)(unsafe.Pointer(p)).h = 0 + (*darwinDir)(unsafe.Pointer(p)).l = 0 + (*darwinDir)(unsafe.Pointer(p)).eof = false + return p +} + +// int __xuname(int namesize, void *namebuf) +func X__xuname(t *TLS, namesize int32, namebuf uintptr) int32 { + return Xuname(t, namebuf) +} + +// int chflags(const char *path, u_int flags); +func Xchflags(t *TLS, path uintptr, flags uint64) int32 { + if err := unix.Chflags(GoString(path), int(flags)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int pipe(int pipefd[2]); +func Xpipe(t *TLS, pipefd uintptr) int32 { + var a [2]int + if err := syscall.Pipe(a[:]); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + *(*[2]int32)(unsafe.Pointer(pipefd)) = [2]int32{int32(a[0]), int32(a[1])} + if dmesgs { + dmesg("%v: %v ok", origin(1), a) + } + return 0 +} + +// char *inet_ntoa(struct in_addr in); +func X__inet_ntoa(t *TLS, in1 in.In_addr) uintptr { + panic(todo("")) +} + +func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr { + // Cannot avoid the syscall here, addr sometimes matter. + data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) + if err != 0 { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return ^uintptr(0) // (void*)-1 + } + + if dmesgs { + dmesg("%v: %#x", origin(1), data) + } + return data +} + +func X__errno(t *TLS) uintptr { + return X__errno_location(t) +} diff --git a/vendor/modernc.org/libc/libc_netbsd_amd64.go b/vendor/modernc.org/libc/libc_netbsd_amd64.go new file mode 100644 index 00000000..bfc2bb65 --- /dev/null +++ b/vendor/modernc.org/libc/libc_netbsd_amd64.go @@ -0,0 +1,577 @@ +// Copyright 2021 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package libc // import "modernc.org/libc" + +import ( + "strings" + "unsafe" + + "golang.org/x/sys/unix" + "modernc.org/libc/fcntl" + "modernc.org/libc/sys/types" + "modernc.org/libc/time" + "modernc.org/libc/utime" +) + +// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); +func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// FILE *fopen64(const char *pathname, const char *mode); +func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { + m := strings.ReplaceAll(GoString(mode), "b", "") + var flags int + switch m { + case "r": + flags = fcntl.O_RDONLY + case "r+": + flags = fcntl.O_RDWR + case "w": + flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_TRUNC + case "w+": + flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_TRUNC + case "a": + flags = fcntl.O_WRONLY | fcntl.O_CREAT | fcntl.O_APPEND + case "a+": + flags = fcntl.O_RDWR | fcntl.O_CREAT | fcntl.O_APPEND + default: + panic(m) + } + fd, err := unix.Open(GoString(pathname), int(flags), 0666) + if err != nil { + if dmesgs { + dmesg("%v: %q %q: %v FAIL", origin(1), GoString(pathname), GoString(mode), err) + } + t.setErrno(err) + return 0 + } + + if dmesgs { + dmesg("%v: %q %q: fd %v", origin(1), GoString(pathname), GoString(mode), fd) + } + if p := newFile(t, int32(fd)); p != 0 { + return p + } + + panic("OOM") +} + +// int lstat(const char *pathname, struct stat *statbuf); +func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { + if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(pathname)) + } + return 0 +} + +// int stat(const char *pathname, struct stat *statbuf); +func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { + if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(pathname)) + } + return 0 +} + +// int mkdir(const char *path, mode_t mode); +func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { + if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q: ok", origin(1), GoString(path)) + } + return 0 +} + +// int access(const char *pathname, int mode); +func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { + if err := unix.Access(GoString(pathname), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) + } + return 0 +} + +// int unlink(const char *pathname); +func Xunlink(t *TLS, pathname uintptr) int32 { + if err := unix.Unlink(GoString(pathname)); err != nil { + if dmesgs { + dmesg("%v: %q: %v", origin(1), GoString(pathname), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); +func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { + var n int + var err error + switch { + case buf == 0 || bufsize == 0: + n, err = unix.Readlink(GoString(path), nil) + default: + n, err = unix.Readlink(GoString(path), (*RawMem)(unsafe.Pointer(buf))[:bufsize:bufsize]) + } + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok") + } + return types.Ssize_t(n) +} + +// int symlink(const char *target, const char *linkpath); +func Xsymlink(t *TLS, target, linkpath uintptr) int32 { + if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int chmod(const char *pathname, mode_t mode) +func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 { + if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil { + if dmesgs { + dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) + } + return 0 +} + +// time_t time(time_t *tloc); +func Xtime(t *TLS, tloc uintptr) time.Time_t { + panic(todo("")) + // n := time.Now().UTC().Unix() + // if tloc != 0 { + // *(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n) + // } + // return types.Time_t(n) +} + +// int utimes(const char *filename, const struct timeval times[2]); +func Xutimes(t *TLS, filename, times uintptr) int32 { + var a []unix.Timeval + if times != 0 { + a = make([]unix.Timeval, 2) + a[0] = *(*unix.Timeval)(unsafe.Pointer(times)) + a[1] = *(*unix.Timeval)(unsafe.Pointer(times + unsafe.Sizeof(unix.Timeval{}))) + } + if err := unix.Utimes(GoString(filename), a); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int fstat(int fd, struct stat *statbuf); +func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { + if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil { + if dmesgs { + dmesg("%v: fd %d: %v FAIL", origin(1), fd, err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: fd %d: ok", origin(1), fd) + } + return 0 +} + +// off64_t lseek64(int fd, off64_t offset, int whence); +func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + n, err := unix.Seek(int(fd), int64(offset), int(whence)) + if err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return types.Off_t(n) +} + +func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { + var arg uintptr + if args != 0 { + arg = *(*uintptr)(unsafe.Pointer(args)) + } + n, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(fd), uintptr(cmd), arg) + if err != 0 { + if dmesgs { + dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n) + } + return int32(n) +} + +// int rename(const char *oldpath, const char *newpath); +func Xrename(t *TLS, oldpath, newpath uintptr) int32 { + if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int mknod(const char *pathname, mode_t mode, dev_t dev); +func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// int utime(const char *filename, const struct utimbuf *times); +func Xutime(t *TLS, filename, times uintptr) int32 { + var a []unix.Timeval + if times != 0 { + a = make([]unix.Timeval, 2) + a[0].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Factime + a[1].Sec = (*utime.Utimbuf)(unsafe.Pointer(times)).Fmodtime + } + if err := unix.Utimes(GoString(filename), a); err != nil { + if dmesgs { + dmesg("%v: %v FAIL", origin(1), err) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + return 0 +} + +// int chown(const char *pathname, uid_t owner, gid_t group); +func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// int link(const char *oldpath, const char *newpath); +func Xlink(t *TLS, oldpath, newpath uintptr) int32 { + panic(todo("")) + // if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return 0 +} + +// int dup2(int oldfd, int newfd); +func Xdup2(t *TLS, oldfd, newfd int32) int32 { + panic(todo("")) + // n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + // if err != 0 { + // t.setErrno(err) + // return -1 + // } + + // return int32(n) +} + +// unsigned int alarm(unsigned int seconds); +func Xalarm(t *TLS, seconds uint32) uint32 { + panic(todo("")) + // n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0) + // if err != 0 { + // panic(todo("")) + // } + + // return uint32(n) +} + +// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags); +func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */ + panic(todo("")) + //TODO bp := tls.Alloc(347) + //TODO defer tls.Free(347) + + //TODO // var ptr [78]int8 at bp, 78 + + //TODO // var buf [256]int8 at bp+78, 256 + + //TODO // var num [13]int8 at bp+334, 13 + + //TODO var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) + //TODO var a uintptr + //TODO var scopeid uint32 + + //TODO switch af { + //TODO case 2: + //TODO a = (sa1 + 4 /* &.sin_addr */) + //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{}))) { + //TODO return -6 + //TODO } + //TODO mkptr4(tls, bp /* &ptr[0] */, a) + //TODO scopeid = uint32(0) + //TODO break + //TODO case 10: + //TODO a = (sa1 + 8 /* &.sin6_addr */) + //TODO if (uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{}))) { + //TODO return -6 + //TODO } + //TODO if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { + //TODO mkptr6(tls, bp /* &ptr[0] */, a) + //TODO } else { + //TODO mkptr4(tls, bp /* &ptr[0] */, (a + uintptr(12))) + //TODO } + //TODO scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id + //TODO break + //TODO default: + //TODO return -6 + //TODO } + + //TODO if (node != 0) && (nodelen != 0) { + //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + //TODO if !((flags & 0x01) != 0) { + //TODO reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { + //TODO Xabort(tls) //TODO- + //TODO // unsigned char query[18+PTR_MAX], reply[512]; + //TODO // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, + //TODO // 0, 0, 0, query, sizeof query); + //TODO // query[3] = 0; /* don't need AD flag */ + //TODO // int rlen = __res_send(query, qlen, reply, sizeof reply); + //TODO // buf[0] = 0; + //TODO // if (rlen > 0) + //TODO // __dns_parse(reply, rlen, dns_parse_callback, buf); + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { + //TODO if (flags & 0x08) != 0 { + //TODO return -2 + //TODO } + //TODO Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) + //TODO if scopeid != 0 { + //TODO Xabort(tls) //TODO- + //TODO // char *p = 0, tmp[IF_NAMESIZE+1]; + //TODO // if (!(flags & NI_NUMERICSCOPE) && + //TODO // (IN6_IS_ADDR_LINKLOCAL(a) || + //TODO // IN6_IS_ADDR_MC_LINKLOCAL(a))) + //TODO // p = if_indextoname(scopeid, tmp+1); + //TODO // if (!p) + //TODO // p = itoa(num, scopeid); + //TODO // *--p = '%'; + //TODO // strcat(buf, p); + //TODO } + //TODO } + //TODO if Xstrlen(tls, bp+78 /* &buf[0] */) >= size_t(nodelen) { + //TODO return -12 + //TODO } + //TODO Xstrcpy(tls, node, bp+78 /* &buf[0] */) + //TODO } + + //TODO if (serv != 0) && (servlen != 0) { + //TODO var p uintptr = bp + 78 /* buf */ + //TODO var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) + //TODO *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + //TODO if !((flags & 0x02) != 0) { + //TODO reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) + //TODO } + //TODO if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { + //TODO p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) + //TODO } + //TODO if Xstrlen(tls, p) >= size_t(servlen) { + //TODO return -12 + //TODO } + //TODO Xstrcpy(tls, serv, p) + //TODO } + + //TODO return 0 +} + +func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ + panic(todo("")) + //TODO bp := tls.Alloc(28) + //TODO defer tls.Free(28) + + //TODO //TODO union { + //TODO //TODO struct sockaddr_in sin; + //TODO //TODO struct sockaddr_in6 sin6; + //TODO //TODO } sa = { .sin.sin_family = af }; + //TODO *(*struct { + //TODO sin sockaddr_in + //TODO _ [12]byte + //TODO })(unsafe.Pointer(bp /* sa1 */)) = struct { + //TODO sin sockaddr_in + //TODO _ [12]byte + //TODO }{} //TODO- + //TODO (*sockaddr_in)(unsafe.Pointer(bp /* &sa1 */)).sin_family = sa_family_t(af) //TODO- + //TODO var sl socklen_t + //TODO if af == 10 { + //TODO sl = uint32(unsafe.Sizeof(sockaddr_in6{})) + //TODO } else { + //TODO sl = uint32(unsafe.Sizeof(sockaddr_in{})) + //TODO } + //TODO var i int32 + + //TODO *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) + + //TODO // Load address argument into sockaddr structure + //TODO if (af == 10) && (l == socklen_t(16)) { + //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin6 */ + 8 /* &.sin6_addr */), a, uint64(16)) + //TODO } else if (af == 2) && (l == socklen_t(4)) { + //TODO Xmemcpy(tls, (bp /* &sa1 */ /* &.sin */ + 4 /* &.sin_addr */), a, uint64(4)) + //TODO } else { + //TODO *(*int32)(unsafe.Pointer(err)) = 3 + //TODO return 22 + //TODO } + + //TODO // Align buffer and check for space for pointers and ip address + //TODO i = (int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))) + //TODO if !(i != 0) { + //TODO i = int32(unsafe.Sizeof(uintptr(0))) + //TODO } + //TODO if buflen <= (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) { + //TODO return 34 + //TODO } + //TODO buf += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))) + //TODO buflen = buflen - (((uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))) - uint64(i)) + uint64(l)) + + //TODO (*hostent)(unsafe.Pointer(h)).h_addr_list = buf + //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) + //TODO (*hostent)(unsafe.Pointer(h)).h_aliases = buf + //TODO buf += (uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))) + + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf + //TODO Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) + //TODO buf += uintptr(l) + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf + //TODO *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) + + //TODO switch Xgetnameinfo(tls, bp /* &sa1 */, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { + //TODO case -3: + //TODO *(*int32)(unsafe.Pointer(err)) = 2 + //TODO return 11 + //TODO case -12: + //TODO return 34 + //TODO default: + //TODO fallthrough + //TODO case -10: + //TODO fallthrough + //TODO case -11: + //TODO fallthrough + //TODO case -4: + //TODO *(*int32)(unsafe.Pointer(err)) = 3 + //TODO return *(*int32)(unsafe.Pointer(X___errno_location(tls))) + //TODO case 0: + //TODO break + //TODO } + + //TODO (*hostent)(unsafe.Pointer(h)).h_addrtype = af + //TODO (*hostent)(unsafe.Pointer(h)).h_length = int32(l) + //TODO (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) + //TODO *(*uintptr)(unsafe.Pointer(res)) = h + //TODO return 0 +} + +// int getrlimit(int resource, struct rlimit *rlim); +func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { + t.setErrno(err) + return -1 + } + + return 0 +} diff --git a/vendor/modernc.org/libc/libc_unix.go b/vendor/modernc.org/libc/libc_unix.go index 01a9dc0d..714260b7 100644 --- a/vendor/modernc.org/libc/libc_unix.go +++ b/vendor/modernc.org/libc/libc_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux darwin +//go:build linux || darwin || freebsd || netbsd +// +build linux darwin freebsd netbsd package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/libc_windows.go b/vendor/modernc.org/libc/libc_windows.go index f50f8c47..9c0160e4 100644 --- a/vendor/modernc.org/libc/libc_windows.go +++ b/vendor/modernc.org/libc/libc_windows.go @@ -226,24 +226,21 @@ func newFile(t *TLS, fd int32) uintptr { if err != nil { panic("no console") } - f := addFile(h, fd) - return uintptr(unsafe.Pointer(f)) + return addFile(h, fd) } if fd == unistd.STDOUT_FILENO { h, err := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE) if err != nil { panic("no console") } - f := addFile(h, fd) - return uintptr(unsafe.Pointer(f)) + return addFile(h, fd) } if fd == unistd.STDERR_FILENO { h, err := syscall.GetStdHandle(syscall.STD_ERROR_HANDLE) if err != nil { panic("no console") } - f := addFile(h, fd) - return uintptr(unsafe.Pointer(f)) + return addFile(h, fd) } // should not get here -- unless newFile @@ -483,7 +480,7 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, cmode uintptr) int32 { var mode types.Mode_t if cmode != 0 { - mode = *(*types.Mode_t)(unsafe.Pointer(cmode)) + mode = (types.Mode_t)(VaUint32(&cmode)) } // fdcwd := fcntl.AT_FDCWD h, err := syscall.Open(GoString(pathname), int(flags), uint32(mode)) @@ -5355,3 +5352,18 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 { func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ panic(todo("")) } + +func Xrint(tls *TLS, x float64) float64 { + switch { + case x == 0: // also +0 and -0 + return 0 + case math.IsInf(x, 0), math.IsNaN(x): + return x + case x >= math.MinInt64 && x <= math.MaxInt64 && float64(int64(x)) == x: + return x + case x >= 0: + return math.Floor(x + 0.5) + default: + return math.Ceil(x - 0.5) + } +} diff --git a/vendor/modernc.org/libc/limits/capi_darwin_amd64.go b/vendor/modernc.org/libc/limits/capi_darwin_amd64.go index afe4e385..bf0fdbf4 100644 --- a/vendor/modernc.org/libc/limits/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/limits/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_darwin_amd64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_darwin_amd64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_freebsd_amd64.go b/vendor/modernc.org/libc/limits/capi_freebsd_amd64.go new file mode 100644 index 00000000..59d86908 --- /dev/null +++ b/vendor/modernc.org/libc/limits/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_freebsd_amd64.go -pkgname limits', DO NOT EDIT. + +package limits + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/limits/capi_linux_386.go b/vendor/modernc.org/libc/limits/capi_linux_386.go index 08961a4b..0f9d360d 100644 --- a/vendor/modernc.org/libc/limits/capi_linux_386.go +++ b/vendor/modernc.org/libc/limits/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_386.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_386.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_linux_amd64.go b/vendor/modernc.org/libc/limits/capi_linux_amd64.go index 6bd70109..ebab7361 100644 --- a/vendor/modernc.org/libc/limits/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/limits/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_amd64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_amd64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_linux_arm.go b/vendor/modernc.org/libc/limits/capi_linux_arm.go index 44b4f564..f9f73992 100644 --- a/vendor/modernc.org/libc/limits/capi_linux_arm.go +++ b/vendor/modernc.org/libc/limits/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_linux_arm64.go b/vendor/modernc.org/libc/limits/capi_linux_arm64.go index 41f3ed1e..75630661 100644 --- a/vendor/modernc.org/libc/limits/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/limits/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_linux_s390x.go b/vendor/modernc.org/libc/limits/capi_linux_s390x.go index ec66afc2..eca6eefc 100644 --- a/vendor/modernc.org/libc/limits/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/limits/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_s390x.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_s390x.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_netbsd_amd64.go b/vendor/modernc.org/libc/limits/capi_netbsd_amd64.go new file mode 100644 index 00000000..b1512432 --- /dev/null +++ b/vendor/modernc.org/libc/limits/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_netbsd_amd64.go -pkgname limits', DO NOT EDIT. + +package limits + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/limits/capi_windows_386.go b/vendor/modernc.org/libc/limits/capi_windows_386.go index a3dc6a90..30ec29e9 100644 --- a/vendor/modernc.org/libc/limits/capi_windows_386.go +++ b/vendor/modernc.org/libc/limits/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_386.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_386.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/capi_windows_amd64.go b/vendor/modernc.org/libc/limits/capi_windows_amd64.go index 55332649..4d2c0c25 100644 --- a/vendor/modernc.org/libc/limits/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/limits/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_amd64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_amd64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/limits_darwin_amd64.go b/vendor/modernc.org/libc/limits/limits_darwin_amd64.go index f1e015e4..58a1b189 100644 --- a/vendor/modernc.org/libc/limits/limits_darwin_amd64.go +++ b/vendor/modernc.org/libc/limits/limits_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_darwin_amd64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_darwin_amd64.go -pkgname limits', DO NOT EDIT. package limits @@ -167,7 +167,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1992-2020 Free Software Foundation, Inc. +// Copyright (C) 1992-2021 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -873,7 +873,7 @@ type X__float128 = float64 /* :47:21 */ // NZERO to be defined here. TBD. See also sys/param.h -// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// Copyright (C) 1991-2021 Free Software Foundation, Inc. // // This file is part of GCC. // diff --git a/vendor/modernc.org/libc/limits/limits_freebsd_amd64.go b/vendor/modernc.org/libc/limits/limits_freebsd_amd64.go new file mode 100644 index 00000000..732fa2a9 --- /dev/null +++ b/vendor/modernc.org/libc/limits/limits_freebsd_amd64.go @@ -0,0 +1,574 @@ +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_freebsd_amd64.go -pkgname limits', DO NOT EDIT. + +package limits + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ARG_MAX = 524288 + BC_BASE_MAX = 99 + BC_DIM_MAX = 2048 + BC_SCALE_MAX = 99 + BC_STRING_MAX = 1000 + CHARCLASS_NAME_MAX = 14 + CHAR_BIT = 8 + CHAR_MAX = 127 + CHAR_MIN = -128 + CHILD_MAX = 40 + COLL_WEIGHTS_MAX = 10 + EXPR_NEST_MAX = 32 + GID_MAX = 4294967295 + INT_MAX = 2147483647 + INT_MIN = -2147483648 + IOV_MAX = 1024 + LINE_MAX = 2048 + LLONG_MAX = 9223372036854775807 + LLONG_MIN = -9223372036854775808 + LONG_BIT = 64 + LONG_MAX = 9223372036854775807 + LONG_MIN = -9223372036854775808 + MAX_CANON = 255 + MAX_INPUT = 255 + MB_LEN_MAX = 6 + MQ_PRIO_MAX = 64 + NAME_MAX = 255 + NGROUPS_MAX = 1023 + NL_ARGMAX = 4096 + NL_LANGMAX = 31 + NL_MSGMAX = 32767 + NL_NMAX = 1 + NL_SETMAX = 255 + NL_TEXTMAX = 2048 + OFF_MAX = 9223372036854775807 + OFF_MIN = -9223372036854775808 + OPEN_MAX = 64 + PASS_MAX = 128 + PATH_MAX = 1024 + PIPE_BUF = 512 + QUAD_MAX = 9223372036854775807 + QUAD_MIN = -9223372036854775808 + RE_DUP_MAX = 255 + SCHAR_MAX = 127 + SCHAR_MIN = -128 + SHRT_MAX = 32767 + SHRT_MIN = -32768 + SIZE_T_MAX = 18446744073709551615 + SSIZE_MAX = 9223372036854775807 + UCHAR_MAX = 255 + UID_MAX = 4294967295 + UINT_MAX = 4294967295 + ULLONG_MAX = 18446744073709551615 + ULONG_MAX = 18446744073709551615 + UQUAD_MAX = 18446744073709551615 + USHRT_MAX = 65535 + WORD_BIT = 32 + X_FILE_OFFSET_BITS = 64 + X_LIMITS_H_ = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_POSIX2_BC_BASE_MAX = 99 + X_POSIX2_BC_DIM_MAX = 2048 + X_POSIX2_BC_SCALE_MAX = 99 + X_POSIX2_BC_STRING_MAX = 1000 + X_POSIX2_CHARCLASS_NAME_MAX = 14 + X_POSIX2_COLL_WEIGHTS_MAX = 2 + X_POSIX2_EQUIV_CLASS_MAX = 2 + X_POSIX2_EXPR_NEST_MAX = 32 + X_POSIX2_LINE_MAX = 2048 + X_POSIX2_RE_DUP_MAX = 255 + X_POSIX_AIO_LISTIO_MAX = 2 + X_POSIX_AIO_MAX = 1 + X_POSIX_ARG_MAX = 4096 + X_POSIX_CHILD_MAX = 25 + X_POSIX_CLOCKRES_MIN = 20000000 + X_POSIX_DELAYTIMER_MAX = 32 + X_POSIX_HOST_NAME_MAX = 255 + X_POSIX_LINK_MAX = 8 + X_POSIX_LOGIN_NAME_MAX = 9 + X_POSIX_MAX_CANON = 255 + X_POSIX_MAX_INPUT = 255 + X_POSIX_MQ_OPEN_MAX = 8 + X_POSIX_MQ_PRIO_MAX = 32 + X_POSIX_NAME_MAX = 14 + X_POSIX_NGROUPS_MAX = 8 + X_POSIX_OPEN_MAX = 20 + X_POSIX_PATH_MAX = 256 + X_POSIX_PIPE_BUF = 512 + X_POSIX_RE_DUP_MAX = 255 + X_POSIX_RTSIG_MAX = 8 + X_POSIX_SEM_NSEMS_MAX = 256 + X_POSIX_SEM_VALUE_MAX = 32767 + X_POSIX_SIGQUEUE_MAX = 32 + X_POSIX_SSIZE_MAX = 32767 + X_POSIX_SS_REPL_MAX = 4 + X_POSIX_STREAM_MAX = 8 + X_POSIX_SYMLINK_MAX = 255 + X_POSIX_SYMLOOP_MAX = 8 + X_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 + X_POSIX_THREAD_KEYS_MAX = 128 + X_POSIX_THREAD_THREADS_MAX = 64 + X_POSIX_TIMER_MAX = 32 + X_POSIX_TRACE_EVENT_NAME_MAX = 30 + X_POSIX_TRACE_NAME_MAX = 8 + X_POSIX_TRACE_SYS_MAX = 8 + X_POSIX_TRACE_USER_EVENT_MAX = 32 + X_POSIX_TTY_NAME_MAX = 9 + X_POSIX_TZNAME_MAX = 6 + X_SYS_CDEFS_H_ = 0 + X_SYS_LIMITS_H_ = 0 + X_SYS_SYSLIMITS_H_ = 0 + X_XOPEN_IOV_MAX = 16 + X_XOPEN_NAME_MAX = 255 + X_XOPEN_PATH_MAX = 1024 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.2 (Berkeley) 1/4/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)syslimits.h 8.1 (Berkeley) 6/2/93 +// $FreeBSD$ + +// Do not add any new variables here. (See the comment at the end of +// the file for why.) + +// We leave the following values undefined to force applications to either +// assume conservative values or call sysconf() to get the current value. +// +// HOST_NAME_MAX +// +// (We should do this for most of the values currently defined here, +// but many programs are not prepared to deal with this yet.) + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/limits/limits_linux_386.go b/vendor/modernc.org/libc/limits/limits_linux_386.go index 5a4ea3ca..d5674404 100644 --- a/vendor/modernc.org/libc/limits/limits_linux_386.go +++ b/vendor/modernc.org/libc/limits/limits_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_386.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_386.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/limits_linux_amd64.go b/vendor/modernc.org/libc/limits/limits_linux_amd64.go index 7360b556..ef8747e3 100644 --- a/vendor/modernc.org/libc/limits/limits_linux_amd64.go +++ b/vendor/modernc.org/libc/limits/limits_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_amd64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_amd64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/limits_linux_arm.go b/vendor/modernc.org/libc/limits/limits_linux_arm.go index 54af74a6..e35f2831 100644 --- a/vendor/modernc.org/libc/limits/limits_linux_arm.go +++ b/vendor/modernc.org/libc/limits/limits_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/limits_linux_arm64.go b/vendor/modernc.org/libc/limits/limits_linux_arm64.go index 69e698d9..16868510 100644 --- a/vendor/modernc.org/libc/limits/limits_linux_arm64.go +++ b/vendor/modernc.org/libc/limits/limits_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_arm64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/limits_linux_s390x.go b/vendor/modernc.org/libc/limits/limits_linux_s390x.go index 94ff9aa4..5ebdf110 100644 --- a/vendor/modernc.org/libc/limits/limits_linux_s390x.go +++ b/vendor/modernc.org/libc/limits/limits_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_s390x.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_linux_s390x.go -pkgname limits', DO NOT EDIT. package limits @@ -143,7 +143,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -178,7 +178,7 @@ type X__float128 = float64 /* :47:21 */ // If fixincludes fixes it, then the fixed version is installed // instead of this text. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -193,12 +193,12 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types // Handle feature test macros at the start of a header. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -213,7 +213,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This header is internal to glibc and should not be included outside // of glibc headers. Headers including it must define @@ -223,7 +223,7 @@ type X__float128 = float64 /* :47:21 */ // header is included, not when the first system header is // included. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -238,7 +238,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -246,6 +246,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -366,6 +367,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -388,9 +391,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -405,7 +421,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -418,7 +434,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -433,7 +449,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -548,7 +564,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -565,14 +581,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -587,7 +601,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -627,10 +641,14 @@ type X__float128 = float64 /* :47:21 */ // macro. // ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__ -// macro. +// macro. Most but not all symbols enabled by that macro in TS +// 18661-1 are enabled unconditionally in C2X; the symbols in Annex F +// still require that macro in C2X. // ISO/IEC TS 18661-4:2015 defines the -// __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. +// __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction +// functions, the symbols from this TS are enabled unconditionally in +// C2X. // ISO/IEC TS 18661-3:2015 defines the // __STDC_WANT_IEC_60559_TYPES_EXT__ macro. @@ -657,7 +675,7 @@ type X__float128 = float64 /* :47:21 */ // __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature. // POSIX adds things to . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -672,7 +690,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 2.9.2 Minimum Values Added to // @@ -748,7 +766,7 @@ type X__float128 = float64 /* :47:21 */ // Get the implementation-specific values for the above. // Minimum guaranteed maximum values for system limits. Linux version. -// Copyright (C) 1993-2018 Free Software Foundation, Inc. +// Copyright (C) 1993-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -763,7 +781,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; see the file COPYING.LIB. If -// not, see . +// not, see . // The kernel header pollutes the namespace with the NR_OPEN symbol // and defines LINK_MAX although filesystems have different maxima. A @@ -812,7 +830,7 @@ type X__float128 = float64 /* :47:21 */ // This value is a guaranteed minimum maximum. // The current maximum can be got from `sysconf'. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -827,7 +845,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; include instead. @@ -859,7 +877,7 @@ type X__float128 = float64 /* :47:21 */ // This value is defined like this in regex.h. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -912,4 +930,4 @@ type X__float128 = float64 /* :47:21 */ // This administrivia gets added to the end of limits.h // if the system has its own version of limits.h. -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/limits/limits_netbsd_amd64.go b/vendor/modernc.org/libc/limits/limits_netbsd_amd64.go new file mode 100644 index 00000000..f729eda7 --- /dev/null +++ b/vendor/modernc.org/libc/limits/limits_netbsd_amd64.go @@ -0,0 +1,557 @@ +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_netbsd_amd64.go -pkgname limits', DO NOT EDIT. + +package limits + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ARG_MAX = 262144 + BC_BASE_MAX = 2147483647 + BC_DIM_MAX = 65535 + BC_SCALE_MAX = 2147483647 + BC_STRING_MAX = 2147483647 + CHARCLASS_NAME_MAX = 14 + CHAR_BIT = 8 + CHAR_MAX = 127 + CHAR_MIN = -128 + CHILD_MAX = 160 + COLL_WEIGHTS_MAX = 2 + DBL_DIG = 15 + EXPR_NEST_MAX = 32 + FLT_DIG = 6 + GID_MAX = 2147483647 + INT_MAX = 2147483647 + INT_MIN = -2147483648 + IOV_MAX = 1024 + LINE_MAX = 2048 + LINK_MAX = 32767 + LLONG_MAX = 9223372036854775807 + LLONG_MIN = -9223372036854775808 + LOGIN_NAME_MAX = 17 + LONG_BIT = 64 + LONG_LONG_MAX = 9223372036854775807 + LONG_LONG_MIN = -9223372036854775808 + LONG_MAX = 9223372036854775807 + LONG_MIN = -9223372036854775808 + MAX_CANON = 255 + MAX_INPUT = 255 + MB_LEN_MAX = 32 + NAME_MAX = 511 + NGROUPS_MAX = 16 + NL_ARGMAX = 9 + NL_LANGMAX = 14 + NL_MSGMAX = 32767 + NL_NMAX = 1 + NL_SETMAX = 255 + NL_TEXTMAX = 2048 + NZERO = 20 + OPEN_MAX = 128 + PASS_MAX = 128 + PATH_MAX = 1024 + PIPE_BUF = 512 + PTHREAD_DESTRUCTOR_ITERATIONS = 4 + PTHREAD_KEYS_MAX = 256 + PTHREAD_THREADS_MAX = 64 + QUAD_MAX = 0x7fffffffffffffff + QUAD_MIN = -9223372036854775808 + RE_DUP_MAX = 255 + SCHAR_MAX = 127 + SCHAR_MIN = -128 + SHRT_MAX = 32767 + SHRT_MIN = -32768 + SIZE_T_MAX = 18446744073709551615 + SSIZE_MAX = 9223372036854775807 + SSIZE_MIN = -9223372036854775808 + TMP_MAX = 308915776 + UCHAR_MAX = 255 + UID_MAX = 2147483647 + UINT_MAX = 4294967295 + ULLONG_MAX = 18446744073709551615 + ULONG_LONG_MAX = 18446744073709551615 + ULONG_MAX = 18446744073709551615 + UQUAD_MAX = 0xffffffffffffffff + USHRT_MAX = 65535 + WORD_BIT = 32 + X_FILE_OFFSET_BITS = 64 + X_GCC_LIMITS_H_ = 0 + X_GETGR_R_SIZE_MAX = 1024 + X_GETPW_R_SIZE_MAX = 1024 + X_LIMITS_H_ = 0 + X_LIMITS_H___ = 0 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_POSIX2_BC_BASE_MAX = 99 + X_POSIX2_BC_DIM_MAX = 2048 + X_POSIX2_BC_SCALE_MAX = 99 + X_POSIX2_BC_STRING_MAX = 1000 + X_POSIX2_CHARCLASS_NAME_MAX = 14 + X_POSIX2_COLL_WEIGHTS_MAX = 2 + X_POSIX2_EXPR_NEST_MAX = 32 + X_POSIX2_LINE_MAX = 2048 + X_POSIX2_RE_DUP_MAX = 255 + X_POSIX_AIO_LISTIO_MAX = 2 + X_POSIX_AIO_MAX = 1 + X_POSIX_ARG_MAX = 4096 + X_POSIX_CHILD_MAX = 25 + X_POSIX_DELAYTIMER_MAX = 32 + X_POSIX_HOST_NAME_MAX = 255 + X_POSIX_LINK_MAX = 8 + X_POSIX_LOGIN_NAME_MAX = 9 + X_POSIX_MAX_CANON = 255 + X_POSIX_MAX_INPUT = 255 + X_POSIX_MQ_OPEN_MAX = 8 + X_POSIX_MQ_PRIO_MAX = 32 + X_POSIX_NAME_MAX = 14 + X_POSIX_NGROUPS_MAX = 8 + X_POSIX_OPEN_MAX = 20 + X_POSIX_PATH_MAX = 256 + X_POSIX_PIPE_BUF = 512 + X_POSIX_REALTIME_SIGNALS = 200112 + X_POSIX_RE_DUP_MAX = 255 + X_POSIX_SEM_NSEMS_MAX = 256 + X_POSIX_SIGQUEUE_MAX = 32 + X_POSIX_SSIZE_MAX = 32767 + X_POSIX_STREAM_MAX = 8 + X_POSIX_SYMLINK_MAX = 255 + X_POSIX_SYMLOOP_MAX = 8 + X_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 + X_POSIX_THREAD_KEYS_MAX = 128 + X_POSIX_THREAD_THREADS_MAX = 64 + X_POSIX_TIMER_MAX = 32 + X_POSIX_TTY_NAME_MAX = 9 + X_POSIX_TZNAME_MAX = 6 + X_SYS_SYSLIMITS_H_ = 0 + X_X86_64_LIMITS_H_ = 0 + X_XOPEN_IOV_MAX = 16 + X_XOPEN_NAME_MAX = 256 + X_XOPEN_PATH_MAX = 1024 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// Copyright (C) 1992-2020 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 3, or (at your option) any later +// version. +// +// GCC is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. +// +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// This administrivia gets added to the beginning of limits.h +// if the system has its own version of limits.h. + +// We use _GCC_LIMITS_H_ because we want this not to match +// any macros that the system's limits.h uses for its own purposes. + +// Use "..." so that we find syslimits.h only in this same directory. +// syslimits.h stands for the system's own limits.h file. +// If we can use it ok unmodified, then we install this text. +// If fixincludes fixes it, then the fixed version is installed +// instead of this text. + +// $NetBSD: limits.h,v 1.40 2016/08/04 06:43:43 christos Exp $ + +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.2 (Berkeley) 1/4/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// We have not implemented these yet +// +// _POSIX_THREAD_ATTR_STACKADDR +// _POSIX_THREAD_ATTR_STACKSIZE +// _POSIX_THREAD_CPUTIME +// _POSIX_THREAD_PRIORITY_SCHEDULING +// _POSIX_THREAD_PRIO_INHERIT +// _POSIX_THREAD_PRIO_PROTECT +// _POSIX_THREAD_PROCESS_SHARED +// _POSIX_THREAD_SAFE_FUNCTIONS +// _POSIX_THREAD_SPORADIC_SERVER + +// The following 3 are defined in +// Open Group Base Specifications Issue 7 + +// These are the correct names, defined in terms of the above +// except for PTHREAD_KEYS_MAX which is bigger than standard +// mandated minimum value _POSIX_THREAD_KEYS_MAX. +// Not yet: PTHREAD_STACK_MIN + +// X/Open CAE Specifications, +// adopted in IEEE Std 1003.1-2001 XSI. + +// IEEE Std 1003.1-2001 TSF + +// Always ensure that this is consistent with + +// X/Open Extended API set 2 (a.k.a. C063) +// This hides unimplemented functions from GNU configure until +// we are done implementing them. + +// $NetBSD: limits.h,v 1.15 2019/01/21 20:22:48 dholland Exp $ + +// Copyright (c) 1988 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 7.2 (Berkeley) 6/28/90 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: syslimits.h,v 1.28 2015/08/21 07:19:39 uebayasi Exp $ + +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)syslimits.h 8.1 (Berkeley) 6/2/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// kept in sync with MAXNAMLEN + +// IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2 + +// X/Open CAE Specification Issue 5 Version 2 + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 3, or (at your option) any later +// version. +// +// GCC is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. +// +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Number of bits in a `char'. + +// Maximum length of a multibyte character. + +// Minimum and maximum values a `signed char' can hold. + +// Maximum value an `unsigned char' can hold. (Minimum is 0). + +// Minimum and maximum values a `char' can hold. + +// Minimum and maximum values a `signed short int' can hold. + +// Maximum value an `unsigned short int' can hold. (Minimum is 0). + +// Minimum and maximum values a `signed int' can hold. + +// Maximum value an `unsigned int' can hold. (Minimum is 0). + +// Minimum and maximum values a `signed long int' can hold. +// (Same as `int'). + +// Maximum value an `unsigned long int' can hold. (Minimum is 0). + +// Minimum and maximum values a `signed long long int' can hold. + +// Maximum value an `unsigned long long int' can hold. (Minimum is 0). + +// Minimum and maximum values a `signed long long int' can hold. + +// Maximum value an `unsigned long long int' can hold. (Minimum is 0). + +// This administrivia gets added to the end of limits.h +// if the system has its own version of limits.h. + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/limits/limits_windows_386.go b/vendor/modernc.org/libc/limits/limits_windows_386.go index 069f8a6f..b6e841b7 100644 --- a/vendor/modernc.org/libc/limits/limits_windows_386.go +++ b/vendor/modernc.org/libc/limits/limits_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_386.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_386.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/limits/limits_windows_amd64.go b/vendor/modernc.org/libc/limits/limits_windows_amd64.go index 0b4a1757..f8f71353 100644 --- a/vendor/modernc.org/libc/limits/limits_windows_amd64.go +++ b/vendor/modernc.org/libc/limits/limits_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_amd64.go -pkgname limits', DO NOT EDIT. +// Code generated by 'ccgo limits/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o limits/limits_windows_amd64.go -pkgname limits', DO NOT EDIT. package limits diff --git a/vendor/modernc.org/libc/mem.go b/vendor/modernc.org/libc/mem.go index 23c2ec06..50056c75 100644 --- a/vendor/modernc.org/libc/mem.go +++ b/vendor/modernc.org/libc/mem.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !libc.membrk && !libc.memgrind // +build !libc.membrk,!libc.memgrind package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/mem_brk.go b/vendor/modernc.org/libc/mem_brk.go index a9728db5..860a1a0a 100644 --- a/vendor/modernc.org/libc/mem_brk.go +++ b/vendor/modernc.org/libc/mem_brk.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build libc.membrk && !libc.memgrind // +build libc.membrk,!libc.memgrind // This is a debug-only version of the memory handling functions. When a diff --git a/vendor/modernc.org/libc/memgrind.go b/vendor/modernc.org/libc/memgrind.go index 535c9fe3..70044c07 100644 --- a/vendor/modernc.org/libc/memgrind.go +++ b/vendor/modernc.org/libc/memgrind.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !libc.membrk && libc.memgrind // +build !libc.membrk,libc.memgrind // This is a debug-only version of the memory handling functions. When a diff --git a/vendor/modernc.org/libc/musl_darwin_amd64.go b/vendor/modernc.org/libc/musl_darwin_amd64.go index 01bde469..2e402cb8 100644 --- a/vendor/modernc.org/libc/musl_darwin_amd64.go +++ b/vendor/modernc.org/libc/musl_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_darwin_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__toread.c src/stdio/__uflow.c src/string/strdup.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strchrnul.c src/string/strlcat.c src/string/strlcpy.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c', DO NOT EDIT. +// Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_darwin_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strchrnul.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c', DO NOT EDIT. package libc @@ -1917,6 +1917,34 @@ func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ return X__builtin_nanf(tls, ts+13 /* "" */) } +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ bp := tls.Alloc(8) defer tls.Free(8) @@ -2985,11 +3013,11 @@ type __res_state = struct { defdname [256]int8 pfcode uint64 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ + _ [4]byte sort_list [10]struct { addr struct{ s_addr in_addr_t } mask uint32_t } - _ [4]byte qhook uintptr rhook uintptr res_h_errno int32 @@ -3267,15 +3295,15 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5 switch i { case 0: *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */)) & uint64(0xffffff)) - AssignShrPtrUint64(bp /* &a */, int(uint64(24))) + AssignShrPtrUint64(bp /* &a */, int(24)) fallthrough case 1: *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) & uint64(0xffff)) - AssignShrPtrUint64(bp /* &a */ +1*8, int(uint64(16))) + AssignShrPtrUint64(bp /* &a */ +1*8, int(16)) fallthrough case 2: *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 3*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) & uint64(0xff)) - AssignShrPtrUint64(bp /* &a */ +2*8, int(uint64(8))) + AssignShrPtrUint64(bp /* &a */ +2*8, int(8)) } for i = 0; i < 4; i++ { if *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) > uint64(255) { @@ -4119,15 +4147,6 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ return -1 } -func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ - var l size_t = Xstrlen(tls, s) - var d uintptr = Xmalloc(tls, (l + uint64(1))) - if !(d != 0) { - return uintptr(0) - } - return Xmemcpy(tls, d, s, (l + uint64(1))) -} - func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ bp := tls.Alloc(232) defer tls.Free(232) @@ -4232,6 +4251,15 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: * return s } +func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ + var l size_t = Xstrlen(tls, s) + var d uintptr = Xmalloc(tls, (l + uint64(1))) + if !(d != 0) { + return uintptr(0) + } + return Xmemcpy(tls, d, s, (l + uint64(1))) +} + func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */ var l size_t = Xstrnlen(tls, d, n) if l == n { diff --git a/vendor/modernc.org/libc/musl_freebsd_amd64.go b/vendor/modernc.org/libc/musl_freebsd_amd64.go new file mode 100644 index 00000000..594e7264 --- /dev/null +++ b/vendor/modernc.org/libc/musl_freebsd_amd64.go @@ -0,0 +1,6783 @@ +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6,getnameinfo,gethostbyaddr_r, -nostdinc -nostdlib -o ../musl_freebsd_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c ../freebsd/table.cpp.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strnlen.c src/string/strspn.c', DO NOT EDIT. + +package libc + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +// musl as a whole is licensed under the following standard MIT license: +// +// ---------------------------------------------------------------------- +// Copyright © 2005-2020 Rich Felker, et al. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ---------------------------------------------------------------------- +// +// Authors/contributors include: +// +// A. Wilcox +// Ada Worcester +// Alex Dowad +// Alex Suykov +// Alexander Monakov +// Andre McCurdy +// Andrew Kelley +// Anthony G. Basile +// Aric Belsito +// Arvid Picciani +// Bartosz Brachaczek +// Benjamin Peterson +// Bobby Bingham +// Boris Brezillon +// Brent Cook +// Chris Spiegel +// Clément Vasseur +// Daniel Micay +// Daniel Sabogal +// Daurnimator +// David Carlier +// David Edelsohn +// Denys Vlasenko +// Dmitry Ivanov +// Dmitry V. Levin +// Drew DeVault +// Emil Renner Berthing +// Fangrui Song +// Felix Fietkau +// Felix Janda +// Gianluca Anzolin +// Hauke Mehrtens +// He X +// Hiltjo Posthuma +// Isaac Dunham +// Jaydeep Patil +// Jens Gustedt +// Jeremy Huntwork +// Jo-Philipp Wich +// Joakim Sindholt +// John Spencer +// Julien Ramseier +// Justin Cormack +// Kaarle Ritvanen +// Khem Raj +// Kylie McClain +// Leah Neukirchen +// Luca Barbato +// Luka Perkov +// M Farkas-Dyck (Strake) +// Mahesh Bodapati +// Markus Wichmann +// Masanori Ogino +// Michael Clark +// Michael Forney +// Mikhail Kremnyov +// Natanael Copa +// Nicholas J. Kain +// orc +// Pascal Cuoq +// Patrick Oppenlander +// Petr Hosek +// Petr Skocik +// Pierre Carrier +// Reini Urban +// Rich Felker +// Richard Pennington +// Ryan Fairfax +// Samuel Holland +// Segev Finer +// Shiz +// sin +// Solar Designer +// Stefan Kristiansson +// Stefan O'Rear +// Szabolcs Nagy +// Timo Teräs +// Trutz Behn +// Valentin Ochs +// Will Dietz +// William Haddon +// William Pitcock +// +// Portions of this software are derived from third-party works licensed +// under terms compatible with the above MIT license: +// +// The TRE regular expression implementation (src/regex/reg* and +// src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed +// under a 2-clause BSD license (license text in the source files). The +// included version has been heavily modified by Rich Felker in 2012, in +// the interests of size, simplicity, and namespace cleanliness. +// +// Much of the math library code (src/math/* and src/complex/*) is +// Copyright © 1993,2004 Sun Microsystems or +// Copyright © 2003-2011 David Schultz or +// Copyright © 2003-2009 Steven G. Kargl or +// Copyright © 2003-2009 Bruce D. Evans or +// Copyright © 2008 Stephen L. Moshier or +// Copyright © 2017-2018 Arm Limited +// and labelled as such in comments in the individual source files. All +// have been licensed under extremely permissive terms. +// +// The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 +// The Android Open Source Project and is licensed under a two-clause BSD +// license. It was taken from Bionic libc, used on Android. +// +// The AArch64 memcpy and memset code (src/string/aarch64/*) are +// Copyright © 1999-2019, Arm Limited. +// +// The implementation of DES for crypt (src/crypt/crypt_des.c) is +// Copyright © 1994 David Burren. It is licensed under a BSD license. +// +// The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was +// originally written by Solar Designer and placed into the public +// domain. The code also comes with a fallback permissive license for use +// in jurisdictions that may not recognize the public domain. +// +// The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 +// Valentin Ochs and is licensed under an MIT-style license. +// +// The x86_64 port was written by Nicholas J. Kain and is licensed under +// the standard MIT terms. +// +// The mips and microblaze ports were originally written by Richard +// Pennington for use in the ellcc project. The original code was adapted +// by Rich Felker for build system and code conventions during upstream +// integration. It is licensed under the standard MIT terms. +// +// The mips64 port was contributed by Imagination Technologies and is +// licensed under the standard MIT terms. +// +// The powerpc port was also originally written by Richard Pennington, +// and later supplemented and integrated by John Spencer. It is licensed +// under the standard MIT terms. +// +// All other files which have no copyright comments are original works +// produced specifically for use as part of this library, written either +// by Rich Felker, the main author of the library, or by one or more +// contibutors listed above. Details on authorship of individual files +// can be found in the git version control history of the project. The +// omission of copyright and license comments in each file is in the +// interest of source tree size. +// +// In addition, permission is hereby granted for all public header files +// (include/* and arch/*/bits/*) and crt files intended to be linked into +// applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit +// the copyright notice and permission notice otherwise required by the +// license, and to use these files without any requirement of +// attribution. These files include substantial contributions from: +// +// Bobby Bingham +// John Spencer +// Nicholas J. Kain +// Rich Felker +// Richard Pennington +// Stefan Kristiansson +// Szabolcs Nagy +// +// all of whom have explicitly granted such permission. +// +// This file previously contained text expressing a belief that most of +// the files covered by the above exception were sufficiently trivial not +// to be subject to copyright, resulting in confusion over whether it +// negated the permissions granted in the license. In the spirit of +// permissive licensing, and of not having licensing issues being an +// obstacle to adoption, that text has been removed. +const ( /* copyright.c:194:1: */ + __musl__copyright__ = 0 +) + +const ( /* nameser.h:117:1: */ + ns_uop_delete = 0 + ns_uop_add = 1 + ns_uop_max = 2 +) + +const ( /* nameser.h:147:1: */ + ns_t_invalid = 0 + ns_t_a = 1 + ns_t_ns = 2 + ns_t_md = 3 + ns_t_mf = 4 + ns_t_cname = 5 + ns_t_soa = 6 + ns_t_mb = 7 + ns_t_mg = 8 + ns_t_mr = 9 + ns_t_null = 10 + ns_t_wks = 11 + ns_t_ptr = 12 + ns_t_hinfo = 13 + ns_t_minfo = 14 + ns_t_mx = 15 + ns_t_txt = 16 + ns_t_rp = 17 + ns_t_afsdb = 18 + ns_t_x25 = 19 + ns_t_isdn = 20 + ns_t_rt = 21 + ns_t_nsap = 22 + ns_t_nsap_ptr = 23 + ns_t_sig = 24 + ns_t_key = 25 + ns_t_px = 26 + ns_t_gpos = 27 + ns_t_aaaa = 28 + ns_t_loc = 29 + ns_t_nxt = 30 + ns_t_eid = 31 + ns_t_nimloc = 32 + ns_t_srv = 33 + ns_t_atma = 34 + ns_t_naptr = 35 + ns_t_kx = 36 + ns_t_cert = 37 + ns_t_a6 = 38 + ns_t_dname = 39 + ns_t_sink = 40 + ns_t_opt = 41 + ns_t_apl = 42 + ns_t_tkey = 249 + ns_t_tsig = 250 + ns_t_ixfr = 251 + ns_t_axfr = 252 + ns_t_mailb = 253 + ns_t_maila = 254 + ns_t_any = 255 + ns_t_zxfr = 256 + ns_t_max = 65536 +) + +const ( /* nameser.h:210:1: */ + ns_c_invalid = 0 + ns_c_in = 1 + ns_c_2 = 2 + ns_c_chaos = 3 + ns_c_hs = 4 + ns_c_none = 254 + ns_c_any = 255 + ns_c_max = 65536 +) + +const ( /* nameser.h:221:1: */ + ns_kt_rsa = 1 + ns_kt_dh = 2 + ns_kt_dsa = 3 + ns_kt_private = 254 +) + +const ( /* nameser.h:228:1: */ + cert_t_pkix = 1 + cert_t_spki = 2 + cert_t_pgp = 3 + cert_t_url = 253 + cert_t_oid = 254 +) + +const ( /* nameser.h:28:1: */ + ns_s_qd = 0 + ns_s_zn = 0 + ns_s_an = 1 + ns_s_pr = 1 + ns_s_ns = 2 + ns_s_ud = 2 + ns_s_ar = 3 + ns_s_max = 4 +) + +const ( /* nameser.h:75:1: */ + ns_f_qr = 0 + ns_f_opcode = 1 + ns_f_aa = 2 + ns_f_tc = 3 + ns_f_rd = 4 + ns_f_ra = 5 + ns_f_z = 6 + ns_f_ad = 7 + ns_f_cd = 8 + ns_f_rcode = 9 + ns_f_max = 10 +) + +const ( /* nameser.h:89:1: */ + ns_o_query = 0 + ns_o_iquery = 1 + ns_o_status = 2 + ns_o_notify = 4 + ns_o_update = 5 + ns_o_max = 6 +) + +const ( /* nameser.h:98:1: */ + ns_r_noerror = 0 + ns_r_formerr = 1 + ns_r_servfail = 2 + ns_r_nxdomain = 3 + ns_r_notimpl = 4 + ns_r_refused = 5 + ns_r_yxdomain = 6 + ns_r_yxrrset = 7 + ns_r_nxrrset = 8 + ns_r_notauth = 9 + ns_r_notzone = 10 + ns_r_max = 11 + ns_r_badvers = 16 + ns_r_badsig = 16 + ns_r_badkey = 17 + ns_r_badtime = 18 +) + +type ptrdiff_t = int64 /* :3:26 */ + +type size_t = uint64 /* :9:23 */ + +type wchar_t = int32 /* :15:24 */ + +/// typedef __ct_rune_t __wint_t; +/// +/// +/// +/// typedef __uint_least16_t __char16_t; +/// typedef __uint_least32_t __char32_t; +/// +/// +/// +/// +/// +/// +/// +/// typedef struct { +/// long long __max_align1 __attribute__((__aligned__(_Alignof(long long)))); +/// +/// long double __max_align2 __attribute__((__aligned__(_Alignof(long double)))); +/// +/// } __max_align_t; +/// +/// typedef __uint64_t __dev_t; +/// +/// typedef __uint32_t __fixpt_t; +/// +/// +/// +/// +/// +/// typedef union { +/// char __mbstate8[128]; +/// __int64_t _mbstateL; +/// } __mbstate_t; +/// +/// typedef __uintmax_t __rman_res_t; +/// +/// +/// +/// +/// +/// +/// typedef __builtin_va_list __va_list; +/// +/// +/// +/// +/// +/// +/// typedef __va_list __gnuc_va_list; +/// +/// +/// +/// +/// unsigned long ___runetype(__ct_rune_t) __attribute__((__pure__)); +/// __ct_rune_t ___tolower(__ct_rune_t) __attribute__((__pure__)); +/// __ct_rune_t ___toupper(__ct_rune_t) __attribute__((__pure__)); +/// +/// +/// extern int __mb_sb_limit; + +type _RuneEntry = struct { + __min int32 + __max int32 + __map int32 + _ [4]byte + __types uintptr +} /* table.cpp.c:290:3 */ + +type _RuneRange = struct { + __nranges int32 + _ [4]byte + __ranges uintptr +} /* table.cpp.c:295:3 */ + +type _RuneLocale = struct { + __magic [8]int8 + __encoding [32]int8 + __sgetrune uintptr + __sputrune uintptr + __invalid_rune int32 + _ [4]byte + __runetype [256]uint64 + __maplower [256]int32 + __mapupper [256]int32 + __runetype_ext _RuneRange + __maplower_ext _RuneRange + __mapupper_ext _RuneRange + __variable uintptr + __variable_len int32 + _ [4]byte +} /* table.cpp.c:320:3 */ +/// +/// extern const _RuneLocale _DefaultRuneLocale; +/// extern const _RuneLocale *_CurrentRuneLocale; +/// +/// +/// +/// extern _Thread_local const _RuneLocale *_ThreadRuneLocale; +/// static __inline const _RuneLocale *__getCurrentRuneLocale(void) +/// { +/// +/// if (_ThreadRuneLocale) +/// return _ThreadRuneLocale; +/// return _CurrentRuneLocale; +/// } +/// +/// +/// +/// +/// +/// static __inline int +/// __maskrune(__ct_rune_t _c, unsigned long _f) +/// { +/// return ((_c < 0 || _c >= (1 <<8 )) ? ___runetype(_c) : +/// (__getCurrentRuneLocale())->__runetype[_c]) & _f; +/// } +/// +/// static __inline int +/// __sbmaskrune(__ct_rune_t _c, unsigned long _f) +/// { +/// return (_c < 0 || _c >= __mb_sb_limit) ? 0 : +/// (__getCurrentRuneLocale())->__runetype[_c] & _f; +/// } +/// +/// static __inline int +/// __istype(__ct_rune_t _c, unsigned long _f) +/// { +/// return (!!__maskrune(_c, _f)); +/// } +/// +/// static __inline int +/// __sbistype(__ct_rune_t _c, unsigned long _f) +/// { +/// return (!!__sbmaskrune(_c, _f)); +/// } +/// +/// static __inline int +/// __isctype(__ct_rune_t _c, unsigned long _f) +/// { +/// return (_c < 0 || _c >= 128) ? 0 : +/// !!(_DefaultRuneLocale.__runetype[_c] & _f); +/// } +/// +/// static __inline __ct_rune_t +/// __toupper(__ct_rune_t _c) +/// { +/// return (_c < 0 || _c >= (1 <<8 )) ? ___toupper(_c) : +/// (__getCurrentRuneLocale())->__mapupper[_c]; +/// } +/// +/// static __inline __ct_rune_t +/// __sbtoupper(__ct_rune_t _c) +/// { +/// return (_c < 0 || _c >= __mb_sb_limit) ? _c : +/// (__getCurrentRuneLocale())->__mapupper[_c]; +/// } +/// +/// static __inline __ct_rune_t +/// __tolower(__ct_rune_t _c) +/// { +/// return (_c < 0 || _c >= (1 <<8 )) ? ___tolower(_c) : +/// (__getCurrentRuneLocale())->__maplower[_c]; +/// } +/// +/// static __inline __ct_rune_t +/// __sbtolower(__ct_rune_t _c) +/// { +/// return (_c < 0 || _c >= __mb_sb_limit) ? _c : +/// (__getCurrentRuneLocale())->__maplower[_c]; +/// } +/// +/// static __inline int +/// __wcwidth(__ct_rune_t _c) +/// { +/// unsigned int _x; +/// +/// if (_c == 0) +/// return (0); +/// _x = (unsigned int)__maskrune(_c, 0xe0000000L|0x00040000L); +/// if ((_x & 0xe0000000L) != 0) +/// return ((_x & 0xe0000000L) >> 30); +/// return ((_x & 0x00040000L) != 0 ? 1 : -1); +/// } +/// +/// +/// +/// int isalnum(int); +/// int isalpha(int); +/// int iscntrl(int); +/// int isdigit(int); +/// int isgraph(int); +/// int islower(int); +/// int isprint(int); +/// int ispunct(int); +/// int isspace(int); +/// int isupper(int); +/// int isxdigit(int); +/// int tolower(int); +/// int toupper(int); +/// +/// +/// int isascii(int); +/// int toascii(int); +/// +/// +/// +/// int isblank(int); +/// +/// +/// +/// int digittoint(int); +/// int ishexnumber(int); +/// int isideogram(int); +/// int isnumber(int); +/// int isphonogram(int); +/// int isrune(int); +/// int isspecial(int); +/// +/// +/// +/// +/// +/// typedef struct _xlocale *locale_t; +/// +/// +/// +/// +/// unsigned long ___runetype_l(__ct_rune_t, locale_t) __attribute__((__pure__)); +/// __ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __attribute__((__pure__)); +/// __ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __attribute__((__pure__)); +/// _RuneLocale *__runes_for_locale(locale_t, int*); +/// +/// inline int +/// __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); +/// inline int +/// __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); +/// +/// inline int +/// __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) +/// { +/// int __limit; +/// _RuneLocale *runes = __runes_for_locale(__loc, &__limit); +/// return (__c < 0 || __c >= __limit) ? 0 : +/// runes->__runetype[__c] & __f; +/// } +/// +/// inline int +/// __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) +/// { +/// return (!!__sbmaskrune_l(__c, __f, __loc)); +/// } +/// +/// +/// +/// +/// +/// +/// +/// inline int isalnum_l(int, locale_t); inline int isalnum_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000100L|0x00000400L|0x00400000L, __l); } +/// inline int isalpha_l(int, locale_t); inline int isalpha_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000100L, __l); } +/// inline int isblank_l(int, locale_t); inline int isblank_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00020000L, __l); } +/// inline int iscntrl_l(int, locale_t); inline int iscntrl_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000200L, __l); } +/// inline int isdigit_l(int, locale_t); inline int isdigit_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000400L, __l); } +/// inline int isgraph_l(int, locale_t); inline int isgraph_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000800L, __l); } +/// inline int ishexnumber_l(int, locale_t); inline int ishexnumber_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00010000L, __l); } +/// inline int isideogram_l(int, locale_t); inline int isideogram_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00080000L, __l); } +/// inline int islower_l(int, locale_t); inline int islower_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00001000L, __l); } +/// inline int isnumber_l(int, locale_t); inline int isnumber_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000400L|0x00400000L, __l); } +/// inline int isphonogram_l(int, locale_t); inline int isphonogram_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00200000L, __l); } +/// inline int isprint_l(int, locale_t); inline int isprint_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00040000L, __l); } +/// inline int ispunct_l(int, locale_t); inline int ispunct_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00002000L, __l); } +/// inline int isrune_l(int, locale_t); inline int isrune_l(int __c, locale_t __l) { return __sbistype_l(__c, 0xFFFFFF00L, __l); } +/// inline int isspace_l(int, locale_t); inline int isspace_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00004000L, __l); } +/// inline int isspecial_l(int, locale_t); inline int isspecial_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00100000L, __l); } +/// inline int isupper_l(int, locale_t); inline int isupper_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00008000L, __l); } +/// inline int isxdigit_l(int, locale_t); inline int isxdigit_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00010000L, __l); } +/// +/// inline int digittoint_l(int, locale_t); +/// inline int tolower_l(int, locale_t); +/// inline int toupper_l(int, locale_t); +/// +/// inline int digittoint_l(int __c, locale_t __l) +/// { return __sbmaskrune_l((__c), 0xFF, __l); } +/// +/// inline int tolower_l(int __c, locale_t __l) +/// { +/// int __limit; +/// _RuneLocale *__runes = __runes_for_locale(__l, &__limit); +/// return (__c < 0 || __c >= __limit) ? __c : +/// __runes->__maplower[__c]; +/// } +/// inline int toupper_l(int __c, locale_t __l) +/// { +/// int __limit; +/// _RuneLocale *__runes = __runes_for_locale(__l, &__limit); +/// return (__c < 0 || __c >= __limit) ? __c : +/// __runes->__mapupper[__c]; +/// } +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// typedef __mbstate_t mbstate_t; +/// +/// +/// +/// +/// typedef __size_t size_t; +/// +/// +/// +/// +/// +/// typedef __va_list va_list; +/// +/// +/// +/// +/// +/// +/// typedef ___wchar_t wchar_t; +/// +/// +/// +/// +/// +/// typedef __wint_t wint_t; +/// +/// typedef struct __sFILE FILE; +/// +/// struct tm; +/// +/// +/// wint_t btowc(int); +/// wint_t fgetwc(FILE *); +/// wchar_t * +/// fgetws(wchar_t * restrict, int, FILE * restrict); +/// wint_t fputwc(wchar_t, FILE *); +/// int fputws(const wchar_t * restrict, FILE * restrict); +/// int fwide(FILE *, int); +/// int fwprintf(FILE * restrict, const wchar_t * restrict, ...); +/// int fwscanf(FILE * restrict, const wchar_t * restrict, ...); +/// wint_t getwc(FILE *); +/// wint_t getwchar(void); +/// size_t mbrlen(const char * restrict, size_t, mbstate_t * restrict); +/// size_t mbrtowc(wchar_t * restrict, const char * restrict, size_t, +/// mbstate_t * restrict); +/// int mbsinit(const mbstate_t *); +/// size_t mbsrtowcs(wchar_t * restrict, const char ** restrict, size_t, +/// mbstate_t * restrict); +/// wint_t putwc(wchar_t, FILE *); +/// wint_t putwchar(wchar_t); +/// int swprintf(wchar_t * restrict, size_t n, const wchar_t * restrict, +/// ...); +/// int swscanf(const wchar_t * restrict, const wchar_t * restrict, ...); +/// wint_t ungetwc(wint_t, FILE *); +/// int vfwprintf(FILE * restrict, const wchar_t * restrict, +/// __va_list); +/// int vswprintf(wchar_t * restrict, size_t n, const wchar_t * restrict, +/// __va_list); +/// int vwprintf(const wchar_t * restrict, __va_list); +/// size_t wcrtomb(char * restrict, wchar_t, mbstate_t * restrict); +/// wchar_t *wcscat(wchar_t * restrict, const wchar_t * restrict); +/// wchar_t *wcschr(const wchar_t *, wchar_t) __attribute__((__pure__)); +/// int wcscmp(const wchar_t *, const wchar_t *) __attribute__((__pure__)); +/// int wcscoll(const wchar_t *, const wchar_t *); +/// wchar_t *wcscpy(wchar_t * restrict, const wchar_t * restrict); +/// size_t wcscspn(const wchar_t *, const wchar_t *) __attribute__((__pure__)); +/// size_t wcsftime(wchar_t * restrict, size_t, const wchar_t * restrict, +/// const struct tm * restrict); +/// size_t wcslen(const wchar_t *) __attribute__((__pure__)); +/// wchar_t *wcsncat(wchar_t * restrict, const wchar_t * restrict, +/// size_t); +/// int wcsncmp(const wchar_t *, const wchar_t *, size_t) __attribute__((__pure__)); +/// wchar_t *wcsncpy(wchar_t * restrict , const wchar_t * restrict, size_t); +/// wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __attribute__((__pure__)); +/// wchar_t *wcsrchr(const wchar_t *, wchar_t) __attribute__((__pure__)); +/// size_t wcsrtombs(char * restrict, const wchar_t ** restrict, size_t, +/// mbstate_t * restrict); +/// size_t wcsspn(const wchar_t *, const wchar_t *) __attribute__((__pure__)); +/// wchar_t *wcsstr(const wchar_t * restrict, const wchar_t * restrict) +/// __attribute__((__pure__)); +/// size_t wcsxfrm(wchar_t * restrict, const wchar_t * restrict, size_t); +/// int wctob(wint_t); +/// double wcstod(const wchar_t * restrict, wchar_t ** restrict); +/// wchar_t *wcstok(wchar_t * restrict, const wchar_t * restrict, +/// wchar_t ** restrict); +/// long wcstol(const wchar_t * restrict, wchar_t ** restrict, int); +/// unsigned long +/// wcstoul(const wchar_t * restrict, wchar_t ** restrict, int); +/// wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __attribute__((__pure__)); +/// int wmemcmp(const wchar_t *, const wchar_t *, size_t) __attribute__((__pure__)); +/// wchar_t *wmemcpy(wchar_t * restrict, const wchar_t * restrict, size_t); +/// wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); +/// wchar_t *wmemset(wchar_t *, wchar_t, size_t); +/// int wprintf(const wchar_t * restrict, ...); +/// int wscanf(const wchar_t * restrict, ...); +/// +/// +/// extern FILE *__stdinp; +/// extern FILE *__stdoutp; +/// extern FILE *__stderrp; +/// +/// int vfwscanf(FILE * restrict, const wchar_t * restrict, +/// __va_list); +/// int vswscanf(const wchar_t * restrict, const wchar_t * restrict, +/// __va_list); +/// int vwscanf(const wchar_t * restrict, __va_list); +/// float wcstof(const wchar_t * restrict, wchar_t ** restrict); +/// long double +/// wcstold(const wchar_t * restrict, wchar_t ** restrict); +/// +/// +/// long long +/// wcstoll(const wchar_t * restrict, wchar_t ** restrict, int); +/// +/// unsigned long long +/// wcstoull(const wchar_t * restrict, wchar_t ** restrict, int); +/// +/// +/// +/// +/// int wcswidth(const wchar_t *, size_t); +/// int wcwidth(wchar_t); +/// +/// +/// +/// +/// size_t mbsnrtowcs(wchar_t * restrict, const char ** restrict, size_t, +/// size_t, mbstate_t * restrict); +/// FILE *open_wmemstream(wchar_t **, size_t *); +/// wchar_t *wcpcpy(wchar_t * restrict, const wchar_t * restrict); +/// wchar_t *wcpncpy(wchar_t * restrict, const wchar_t * restrict, size_t); +/// wchar_t *wcsdup(const wchar_t *) __attribute__((__malloc__)); +/// int wcscasecmp(const wchar_t *, const wchar_t *); +/// int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); +/// size_t wcsnlen(const wchar_t *, size_t) __attribute__((__pure__)); +/// size_t wcsnrtombs(char * restrict, const wchar_t ** restrict, size_t, +/// size_t, mbstate_t * restrict); +/// +/// +/// +/// wchar_t *fgetwln(FILE * restrict, size_t * restrict); +/// size_t wcslcat(wchar_t *, const wchar_t *, size_t); +/// size_t wcslcpy(wchar_t *, const wchar_t *, size_t); +/// +/// +/// +/// +/// +/// int wcscasecmp_l(const wchar_t *, const wchar_t *, +/// locale_t); +/// int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, +/// locale_t); +/// int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); +/// size_t wcsxfrm_l(wchar_t * restrict, +/// const wchar_t * restrict, size_t, locale_t); +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// struct lconv { +/// char *decimal_point; +/// char *thousands_sep; +/// char *grouping; +/// char *int_curr_symbol; +/// char *currency_symbol; +/// char *mon_decimal_point; +/// char *mon_thousands_sep; +/// char *mon_grouping; +/// char *positive_sign; +/// char *negative_sign; +/// char int_frac_digits; +/// char frac_digits; +/// char p_cs_precedes; +/// char p_sep_by_space; +/// char n_cs_precedes; +/// char n_sep_by_space; +/// char p_sign_posn; +/// char n_sign_posn; +/// char int_p_cs_precedes; +/// char int_n_cs_precedes; +/// char int_p_sep_by_space; +/// char int_n_sep_by_space; +/// char int_p_sign_posn; +/// char int_n_sign_posn; +/// }; +/// +/// +/// struct lconv *localeconv(void); +/// char *setlocale(int, const char *); +/// +/// +/// +/// +/// locale_t duplocale(locale_t base); +/// void freelocale(locale_t loc); +/// locale_t newlocale(int mask, const char *locale, locale_t base); +/// const char *querylocale(int mask, locale_t loc); +/// locale_t uselocale(locale_t loc); +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// wint_t btowc_l(int, locale_t); +/// wint_t fgetwc_l(FILE *, locale_t); +/// wchar_t *fgetws_l(wchar_t * restrict, int, FILE * restrict, +/// locale_t); +/// wint_t fputwc_l(wchar_t, FILE *, locale_t); +/// int fputws_l(const wchar_t * restrict, FILE * restrict, +/// locale_t); +/// int fwprintf_l(FILE * restrict, locale_t, +/// const wchar_t * restrict, ...); +/// int fwscanf_l(FILE * restrict, locale_t, +/// const wchar_t * restrict, ...); +/// wint_t getwc_l(FILE *, locale_t); +/// wint_t getwchar_l(locale_t); +/// size_t mbrlen_l(const char * restrict, size_t, +/// mbstate_t * restrict, locale_t); +/// size_t mbrtowc_l(wchar_t * restrict, +/// const char * restrict, size_t, +/// mbstate_t * restrict, locale_t); +/// int mbsinit_l(const mbstate_t *, locale_t); +/// size_t mbsrtowcs_l(wchar_t * restrict, +/// const char ** restrict, size_t, +/// mbstate_t * restrict, locale_t); +/// wint_t putwc_l(wchar_t, FILE *, locale_t); +/// wint_t putwchar_l(wchar_t, locale_t); +/// int swprintf_l(wchar_t * restrict, size_t n, locale_t, +/// const wchar_t * restrict, ...); +/// int swscanf_l(const wchar_t * restrict, locale_t, +/// const wchar_t * restrict, ...); +/// wint_t ungetwc_l(wint_t, FILE *, locale_t); +/// int vfwprintf_l(FILE * restrict, locale_t, +/// const wchar_t * restrict, __va_list); +/// int vswprintf_l(wchar_t * restrict, size_t n, locale_t, +/// const wchar_t * restrict, __va_list); +/// int vwprintf_l(locale_t, const wchar_t * restrict, +/// __va_list); +/// size_t wcrtomb_l(char * restrict, wchar_t, +/// mbstate_t * restrict, locale_t); +/// size_t wcsftime_l(wchar_t * restrict, size_t, +/// const wchar_t * restrict, +/// const struct tm * restrict, locale_t); +/// size_t wcsrtombs_l(char * restrict, +/// const wchar_t ** restrict, size_t, +/// mbstate_t * restrict, locale_t); +/// double wcstod_l(const wchar_t * restrict, +/// wchar_t ** restrict, locale_t); +/// long wcstol_l(const wchar_t * restrict, +/// wchar_t ** restrict, int, locale_t); +/// unsigned long wcstoul_l(const wchar_t * restrict, +/// wchar_t ** restrict, int, locale_t); +/// int wcswidth_l(const wchar_t *, size_t, locale_t); +/// int wctob_l(wint_t, locale_t); +/// int wcwidth_l(wchar_t, locale_t); +/// int wprintf_l(locale_t, const wchar_t * restrict, ...); +/// int wscanf_l(locale_t, const wchar_t * restrict, ...); +/// int vfwscanf_l(FILE * restrict, locale_t, +/// const wchar_t * restrict, __va_list); +/// int vswscanf_l(const wchar_t * restrict, locale_t, +/// const wchar_t *restrict, __va_list); +/// int vwscanf_l(locale_t, const wchar_t * restrict, +/// __va_list); +/// float wcstof_l(const wchar_t * restrict, +/// wchar_t ** restrict, locale_t); +/// long double wcstold_l(const wchar_t * restrict, +/// wchar_t ** restrict, locale_t); +/// long long wcstoll_l(const wchar_t * restrict, +/// wchar_t ** restrict, int, locale_t); +/// unsigned long long wcstoull_l(const wchar_t * restrict, +/// wchar_t ** restrict, int, locale_t); +/// size_t mbsnrtowcs_l(wchar_t * restrict, +/// const char ** restrict, size_t, size_t, +/// mbstate_t * restrict, locale_t); +/// size_t wcsnrtombs_l(char * restrict, +/// const wchar_t ** restrict, size_t, size_t, +/// mbstate_t * restrict, locale_t); +/// +/// +/// +/// +/// +/// struct lconv *localeconv_l(locale_t); +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// typedef __rune_t rune_t; +/// +/// typedef struct { +/// int quot; +/// int rem; +/// } div_t; +/// +/// typedef struct { +/// long quot; +/// long rem; +/// } ldiv_t; +/// +/// +/// +/// +/// +/// double atof_l(const char *, locale_t); +/// int atoi_l(const char *, locale_t); +/// long atol_l(const char *, locale_t); +/// long long atoll_l(const char *, locale_t); +/// int mblen_l(const char *, size_t, locale_t); +/// size_t mbstowcs_l(wchar_t * restrict, +/// const char * restrict, size_t, locale_t); +/// int mbtowc_l(wchar_t * restrict, +/// const char * restrict, size_t, locale_t); +/// double strtod_l(const char *, char **, locale_t); +/// float strtof_l(const char *, char **, locale_t); +/// long strtol_l(const char *, char **, int, locale_t); +/// long double strtold_l(const char *, char **, locale_t); +/// long long strtoll_l(const char *, char **, int, locale_t); +/// unsigned long strtoul_l(const char *, char **, int, locale_t); +/// unsigned long long strtoull_l(const char *, char **, int, locale_t); +/// size_t wcstombs_l(char * restrict, +/// const wchar_t * restrict, size_t, locale_t); +/// int wctomb_l(char *, wchar_t, locale_t); +/// +/// int ___mb_cur_max_l(locale_t); +/// +/// +/// extern int __mb_cur_max; +/// extern int ___mb_cur_max(void); +/// +/// +/// _Noreturn void abort(void); +/// int abs(int) __attribute__((__const__)); +/// int atexit(void (* )(void)); +/// double atof(const char *); +/// int atoi(const char *); +/// long atol(const char *); +/// void *bsearch(const void *, const void *, size_t, +/// size_t, int (*)(const void * , const void *)); +/// void *calloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) +/// __attribute__((__alloc_size__(1, 2))); +/// div_t div(int, int) __attribute__((__const__)); +/// _Noreturn void exit(int); +/// void free(void *); +/// char *getenv(const char *); +/// long labs(long) __attribute__((__const__)); +/// ldiv_t ldiv(long, long) __attribute__((__const__)); +/// void *malloc(size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(1))); +/// int mblen(const char *, size_t); +/// size_t mbstowcs(wchar_t * restrict , const char * restrict, size_t); +/// int mbtowc(wchar_t * restrict, const char * restrict, size_t); +/// void qsort(void *, size_t, size_t, +/// int (* )(const void *, const void *)); +/// int rand(void); +/// void *realloc(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2))); +/// void srand(unsigned); +/// double strtod(const char * restrict, char ** restrict); +/// float strtof(const char * restrict, char ** restrict); +/// long strtol(const char * restrict, char ** restrict, int); +/// long double +/// strtold(const char * restrict, char ** restrict); +/// unsigned long +/// strtoul(const char * restrict, char ** restrict, int); +/// int system(const char *); +/// int wctomb(char *, wchar_t); +/// size_t wcstombs(char * restrict, const wchar_t * restrict, size_t); +/// +/// typedef struct { +/// long long quot; +/// long long rem; +/// } lldiv_t; +/// +/// +/// long long +/// atoll(const char *); +/// +/// long long +/// llabs(long long) __attribute__((__const__)); +/// +/// lldiv_t lldiv(long long, long long) __attribute__((__const__)); +/// +/// long long +/// strtoll(const char * restrict, char ** restrict, int); +/// +/// unsigned long long +/// strtoull(const char * restrict, char ** restrict, int); +/// +/// +/// _Noreturn void _Exit(int); +/// +/// +/// +/// +/// +/// +/// void * aligned_alloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__alloc_align__(1))) +/// __attribute__((__alloc_size__(2))); +/// int at_quick_exit(void (*)(void)); +/// _Noreturn void +/// quick_exit(int); +/// +/// +/// +/// +/// +/// char *realpath(const char * restrict, char * restrict); +/// +/// +/// int rand_r(unsigned *); +/// +/// +/// int posix_memalign(void **, size_t, size_t); +/// int setenv(const char *, const char *, int); +/// int unsetenv(const char *); +/// +/// +/// +/// int getsubopt(char **, char *const *, char **); +/// +/// char *mkdtemp(char *); +/// +/// +/// +/// int mkstemp(char *); +/// +/// long a64l(const char *); +/// double drand48(void); +/// +/// double erand48(unsigned short[3]); +/// +/// +/// char *initstate(unsigned int, char *, size_t); +/// long jrand48(unsigned short[3]); +/// char *l64a(long); +/// void lcong48(unsigned short[7]); +/// long lrand48(void); +/// +/// char *mktemp(char *); +/// +/// +/// long mrand48(void); +/// long nrand48(unsigned short[3]); +/// int putenv(char *); +/// long random(void); +/// unsigned short +/// *seed48(unsigned short[3]); +/// char *setstate( char *); +/// void srand48(long); +/// void srandom(unsigned int); +/// +/// +/// +/// int grantpt(int); +/// int posix_openpt(int); +/// char *ptsname(int); +/// int unlockpt(int); +/// +/// +/// +/// int ptsname_r(int, char *, size_t); +/// +/// +/// +/// extern const char *malloc_conf; +/// extern void (*malloc_message)(void *, const char *); +/// +/// void abort2(const char *, int, void **) __attribute__((__noreturn__)); +/// __uint32_t +/// arc4random(void); +/// void arc4random_buf(void *, size_t); +/// __uint32_t +/// arc4random_uniform(__uint32_t); +/// +/// +/// +/// +/// +/// +/// char *getbsize(int *, long *); +/// +/// char *cgetcap(char *, const char *, int); +/// int cgetclose(void); +/// int cgetent(char **, char **, const char *); +/// int cgetfirst(char **, char **); +/// int cgetmatch(const char *, const char *); +/// int cgetnext(char **, char **); +/// int cgetnum(char *, const char *, long *); +/// int cgetset(const char *); +/// int cgetstr(char *, const char *, char **); +/// int cgetustr(char *, const char *, char **); +/// +/// int daemon(int, int); +/// int daemonfd(int, int); +/// char *devname(__dev_t, __mode_t); +/// char *devname_r(__dev_t, __mode_t, char *, int); +/// char *fdevname(int); +/// char *fdevname_r(int, char *, int); +/// int getloadavg(double [], int); +/// const char * +/// getprogname(void); +/// +/// int heapsort(void *, size_t, size_t, +/// int (* )(const void *, const void *)); +/// +/// +/// +/// +/// +/// +/// int l64a_r(long, char *, int); +/// int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); +/// +/// +/// +/// int mkostemp(char *, int); +/// int mkostemps(char *, int, int); +/// int mkostempsat(int, char *, int, int); +/// void qsort_r(void *, size_t, size_t, void *, +/// int (*)(void *, const void *, const void *)); +/// int radixsort(const unsigned char **, int, const unsigned char *, +/// unsigned); +/// void *reallocarray(void *, size_t, size_t) __attribute__((__warn_unused_result__)) +/// __attribute__((__alloc_size__(2, 3))); +/// void *reallocf(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2))); +/// int rpmatch(const char *); +/// void setprogname(const char *); +/// int sradixsort(const unsigned char **, int, const unsigned char *, +/// unsigned); +/// void srandomdev(void); +/// long long +/// strtonum(const char *, long long, long long, const char **); +/// +/// +/// __int64_t +/// strtoq(const char *, char **, int); +/// __uint64_t +/// strtouq(const char *, char **, int); +/// +/// extern char *suboptarg; +/// +/// +/// +/// +/// +/// +/// typedef size_t rsize_t; +/// +/// +/// +/// +/// typedef int errno_t; +/// +/// +/// +/// typedef void (*constraint_handler_t)(const char * restrict, +/// void * restrict, errno_t); +/// +/// constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); +/// +/// _Noreturn void abort_handler_s(const char * restrict, void * restrict, +/// errno_t); +/// +/// void ignore_handler_s(const char * restrict, void * restrict, errno_t); +/// +/// errno_t qsort_s(void *, rsize_t, rsize_t, +/// int (*)(const void *, const void *, void *), void *); +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// typedef __int8_t int8_t; +/// +/// +/// +/// +/// typedef __int16_t int16_t; +/// +/// +/// +/// +/// typedef __int32_t int32_t; +/// +/// +/// +/// +/// typedef __int64_t int64_t; +/// +/// +/// +/// +/// typedef __uint8_t uint8_t; +/// +/// +/// +/// +/// typedef __uint16_t uint16_t; +/// +/// +/// +/// +/// typedef __uint32_t uint32_t; +/// +/// +/// +/// +/// typedef __uint64_t uint64_t; +/// +/// +/// +/// +/// typedef __intptr_t intptr_t; +/// +/// +/// +/// typedef __uintptr_t uintptr_t; +/// +/// +/// +/// typedef __intmax_t intmax_t; +/// +/// +/// +/// typedef __uintmax_t uintmax_t; +/// +/// +/// typedef __int_least8_t int_least8_t; +/// typedef __int_least16_t int_least16_t; +/// typedef __int_least32_t int_least32_t; +/// typedef __int_least64_t int_least64_t; +/// +/// typedef __uint_least8_t uint_least8_t; +/// typedef __uint_least16_t uint_least16_t; +/// typedef __uint_least32_t uint_least32_t; +/// typedef __uint_least64_t uint_least64_t; +/// +/// typedef __int_fast8_t int_fast8_t; +/// typedef __int_fast16_t int_fast16_t; +/// typedef __int_fast32_t int_fast32_t; +/// typedef __int_fast64_t int_fast64_t; +/// +/// typedef __uint_fast8_t uint_fast8_t; +/// typedef __uint_fast16_t uint_fast16_t; +/// typedef __uint_fast32_t uint_fast32_t; +/// typedef __uint_fast64_t uint_fast64_t; +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// struct pthread; +/// struct pthread_attr; +/// struct pthread_cond; +/// struct pthread_cond_attr; +/// struct pthread_mutex; +/// struct pthread_mutex_attr; +/// struct pthread_once; +/// struct pthread_rwlock; +/// struct pthread_rwlockattr; +/// struct pthread_barrier; +/// struct pthread_barrier_attr; +/// struct pthread_spinlock; +/// +/// typedef struct pthread *pthread_t; +/// +/// +/// typedef struct pthread_attr *pthread_attr_t; +/// typedef struct pthread_mutex *pthread_mutex_t; +/// typedef struct pthread_mutex_attr *pthread_mutexattr_t; +/// typedef struct pthread_cond *pthread_cond_t; +/// typedef struct pthread_cond_attr *pthread_condattr_t; +/// typedef int pthread_key_t; +/// typedef struct pthread_once pthread_once_t; +/// typedef struct pthread_rwlock *pthread_rwlock_t; +/// typedef struct pthread_rwlockattr *pthread_rwlockattr_t; +/// typedef struct pthread_barrier *pthread_barrier_t; +/// typedef struct pthread_barrierattr *pthread_barrierattr_t; +/// typedef struct pthread_spinlock *pthread_spinlock_t; +/// +/// +/// +/// +/// +/// +/// +/// typedef void *pthread_addr_t; +/// typedef void *(*pthread_startroutine_t)(void *); +/// +/// +/// +/// +/// struct pthread_once { +/// int state; +/// pthread_mutex_t mutex; +/// }; +/// +/// +/// +/// typedef unsigned char u_char; +/// typedef unsigned short u_short; +/// typedef unsigned int u_int; +/// typedef unsigned long u_long; +/// +/// typedef unsigned short ushort; +/// typedef unsigned int uint; +/// +/// typedef __uint8_t u_int8_t; +/// typedef __uint16_t u_int16_t; +/// typedef __uint32_t u_int32_t; +/// typedef __uint64_t u_int64_t; +/// +/// typedef __uint64_t u_quad_t; +/// typedef __int64_t quad_t; +/// typedef quad_t * qaddr_t; +/// +/// typedef char * caddr_t; +/// typedef const char * c_caddr_t; +/// +/// +/// typedef __blksize_t blksize_t; +/// +/// +/// +/// typedef __cpuwhich_t cpuwhich_t; +/// typedef __cpulevel_t cpulevel_t; +/// typedef __cpusetid_t cpusetid_t; +/// +/// +/// typedef __blkcnt_t blkcnt_t; +/// +/// +/// +/// +/// typedef __clock_t clock_t; +/// +/// +/// +/// +/// typedef __clockid_t clockid_t; +/// +/// +/// +/// typedef __critical_t critical_t; +/// typedef __daddr_t daddr_t; +/// +/// +/// typedef __dev_t dev_t; +/// +/// +/// +/// +/// typedef __fflags_t fflags_t; +/// +/// +/// +/// typedef __fixpt_t fixpt_t; +/// +/// +/// typedef __fsblkcnt_t fsblkcnt_t; +/// typedef __fsfilcnt_t fsfilcnt_t; +/// +/// +/// +/// +/// typedef __gid_t gid_t; +/// +/// +/// +/// +/// typedef __uint32_t in_addr_t; +/// +/// +/// +/// +/// typedef __uint16_t in_port_t; +/// +/// +/// +/// +/// typedef __id_t id_t; +/// +/// +/// +/// +/// typedef __ino_t ino_t; +/// +/// +/// +/// +/// typedef __key_t key_t; +/// +/// +/// +/// +/// typedef __lwpid_t lwpid_t; +/// +/// +/// +/// +/// typedef __mode_t mode_t; +/// +/// +/// +/// +/// typedef __accmode_t accmode_t; +/// +/// +/// +/// +/// typedef __nlink_t nlink_t; +/// +/// +/// +/// +/// typedef __off_t off_t; +/// +/// +/// +/// +/// typedef __off64_t off64_t; +/// +/// +/// +/// +/// typedef __pid_t pid_t; +/// +/// +/// +/// typedef __register_t register_t; +/// +/// +/// typedef __rlim_t rlim_t; +/// +/// +/// +/// typedef __int64_t sbintime_t; +/// +/// typedef __segsz_t segsz_t; +/// +/// +/// +/// +/// +/// +/// +/// typedef __ssize_t ssize_t; +/// +/// +/// +/// +/// typedef __suseconds_t suseconds_t; +/// +/// +/// +/// +/// typedef __time_t time_t; +/// +/// +/// +/// +/// typedef __timer_t timer_t; +/// +/// +/// +/// +/// typedef __mqd_t mqd_t; +/// +/// +/// +/// typedef __u_register_t u_register_t; +/// +/// +/// typedef __uid_t uid_t; +/// +/// +/// +/// +/// typedef __useconds_t useconds_t; +/// +/// +/// +/// +/// +/// typedef unsigned long cap_ioctl_t; +/// +/// +/// +/// +/// struct cap_rights; +/// +/// typedef struct cap_rights cap_rights_t; +/// +/// typedef __uint64_t kpaddr_t; +/// typedef __uint64_t kvaddr_t; +/// typedef __uint64_t ksize_t; +/// typedef __int64_t kssize_t; +/// +/// typedef __vm_offset_t vm_offset_t; +/// typedef __uint64_t vm_ooffset_t; +/// typedef __vm_paddr_t vm_paddr_t; +/// typedef __uint64_t vm_pindex_t; +/// typedef __vm_size_t vm_size_t; +/// +/// typedef __rman_res_t rman_res_t; +/// +/// static __inline __uint16_t +/// __bitcount16(__uint16_t _x) +/// { +/// +/// _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); +/// _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); +/// _x = (_x + (_x >> 4)) & 0x0f0f; +/// _x = (_x + (_x >> 8)) & 0x00ff; +/// return (_x); +/// } +/// +/// static __inline __uint32_t +/// __bitcount32(__uint32_t _x) +/// { +/// +/// _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); +/// _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); +/// _x = (_x + (_x >> 4)) & 0x0f0f0f0f; +/// _x = (_x + (_x >> 8)); +/// _x = (_x + (_x >> 16)) & 0x000000ff; +/// return (_x); +/// } +/// +/// +/// static __inline __uint64_t +/// __bitcount64(__uint64_t _x) +/// { +/// +/// _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); +/// _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); +/// _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; +/// _x = (_x + (_x >> 8)); +/// _x = (_x + (_x >> 16)); +/// _x = (_x + (_x >> 32)) & 0x000000ff; +/// return (_x); +/// } +/// +/// +/// +/// +/// +/// typedef struct __sigset { +/// __uint32_t __bits[4]; +/// } __sigset_t; +/// +/// +/// +/// struct timeval { +/// time_t tv_sec; +/// suseconds_t tv_usec; +/// }; +/// +/// +/// +/// +/// +/// struct timespec { +/// time_t tv_sec; +/// long tv_nsec; +/// }; +/// +/// +/// struct itimerspec { +/// struct timespec it_interval; +/// struct timespec it_value; +/// }; +/// +/// +/// typedef unsigned long __fd_mask; +/// +/// typedef __fd_mask fd_mask; +/// +/// +/// +/// +/// typedef __sigset_t sigset_t; +/// +/// typedef struct fd_set { +/// __fd_mask __fds_bits[(((1024) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8)))]; +/// } fd_set; +/// +/// +/// int pselect(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, +/// const struct timespec *restrict, const sigset_t *restrict); +/// +/// +/// +/// int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +/// +/// +/// +/// +/// static __inline int +/// __major(dev_t _d) +/// { +/// return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff)); +/// } +/// +/// static __inline int +/// __minor(dev_t _d) +/// { +/// return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff)); +/// } +/// +/// static __inline dev_t +/// __makedev(int _Major, int _Minor) +/// { +/// return (((dev_t)(_Major & 0xffffff00) << 32) | ((_Major & 0xff) << 8) | +/// ((dev_t)(_Minor & 0xff00) << 24) | (_Minor & 0xffff00ff)); +/// } +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// int ftruncate(int, off_t); +/// +/// +/// +/// off_t lseek(int, off_t, int); +/// +/// +/// +/// void * mmap(void *, size_t, int, int, int, off_t); +/// +/// +/// +/// int truncate(const char *, off_t); +/// +/// +/// +/// +/// +/// +/// +/// +/// static __inline int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "char" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "char" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; +/// static __inline int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "short" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, u_short src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "short" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; +/// static __inline int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "int" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "int" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; +/// static __inline int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "long" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "long" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; +/// +/// +/// +/// +/// +/// static __inline u_int +/// atomic_fetchadd_int(volatile u_int *p, u_int v) +/// { +/// +/// __asm volatile( +/// " " "lock ; " " " +/// " xaddl %0,%1 ; " +/// "# atomic_fetchadd_int" +/// : "+r" (v), +/// "+m" (*p) +/// : : "cc"); +/// return (v); +/// } +/// +/// +/// +/// +/// +/// static __inline u_long +/// atomic_fetchadd_long(volatile u_long *p, u_long v) +/// { +/// +/// __asm volatile( +/// " " "lock ; " " " +/// " xaddq %0,%1 ; " +/// "# atomic_fetchadd_long" +/// : "+r" (v), +/// "+m" (*p) +/// : : "cc"); +/// return (v); +/// } +/// +/// static __inline int +/// atomic_testandset_int(volatile u_int *p, u_int v) +/// { +/// u_char res; +/// +/// __asm volatile( +/// " " "lock ; " " " +/// " btsl %2,%1 ; " +/// "# atomic_testandset_int" +/// : "=@ccc" (res), +/// "+m" (*p) +/// : "Ir" (v & 0x1f) +/// : "cc"); +/// return (res); +/// } +/// +/// static __inline int +/// atomic_testandset_long(volatile u_long *p, u_int v) +/// { +/// u_char res; +/// +/// __asm volatile( +/// " " "lock ; " " " +/// " btsq %2,%1 ; " +/// "# atomic_testandset_long" +/// : "=@ccc" (res), +/// "+m" (*p) +/// : "Jr" ((u_long)(v & 0x3f)) +/// : "cc"); +/// return (res); +/// } +/// +/// static __inline int +/// atomic_testandclear_int(volatile u_int *p, u_int v) +/// { +/// u_char res; +/// +/// __asm volatile( +/// " " "lock ; " " " +/// " btrl %2,%1 ; " +/// "# atomic_testandclear_int" +/// : "=@ccc" (res), +/// "+m" (*p) +/// : "Ir" (v & 0x1f) +/// : "cc"); +/// return (res); +/// } +/// +/// static __inline int +/// atomic_testandclear_long(volatile u_long *p, u_int v) +/// { +/// u_char res; +/// +/// __asm volatile( +/// " " "lock ; " " " +/// " btrq %2,%1 ; " +/// "# atomic_testandclear_long" +/// : "=@ccc" (res), +/// "+m" (*p) +/// : "Jr" ((u_long)(v & 0x3f)) +/// : "cc"); +/// return (res); +/// } +/// +/// static __inline void +/// __storeload_barrier(void) +/// { +/// +/// __asm volatile("lock; addl $0,-8(%%rsp)" : : : "memory", "cc"); +/// } +/// +/// static __inline void +/// atomic_thread_fence_acq(void) +/// { +/// +/// __asm volatile(" " : : : "memory"); +/// } +/// +/// static __inline void +/// atomic_thread_fence_rel(void) +/// { +/// +/// __asm volatile(" " : : : "memory"); +/// } +/// +/// static __inline void +/// atomic_thread_fence_acq_rel(void) +/// { +/// +/// __asm volatile(" " : : : "memory"); +/// } +/// +/// static __inline void +/// atomic_thread_fence_seq_cst(void) +/// { +/// +/// __storeload_barrier(); +/// } +/// +/// +/// +/// static __inline void atomic_set_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "orb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_set_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "orb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_clear_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "andb %b1,%0" : "+m" (*p) : "iq" (~v) : "cc"); } static __inline void atomic_clear_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "andb %b1,%0" : "+m" (*p) : "iq" (~v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_add_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "addb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_add_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "addb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_subtract_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "subb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_subtract_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "subb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack; +/// +/// static __inline void atomic_set_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "orw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_set_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "orw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_clear_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "andw %w1,%0" : "+m" (*p) : "ir" (~v) : "cc"); } static __inline void atomic_clear_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "andw %w1,%0" : "+m" (*p) : "ir" (~v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_add_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "addw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_add_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "addw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_subtract_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "subw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_subtract_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "subw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; +/// +/// static __inline void atomic_set_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "orl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_set_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "orl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_clear_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "andl %1,%0" : "+m" (*p) : "ir" (~v) : "cc"); } static __inline void atomic_clear_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "andl %1,%0" : "+m" (*p) : "ir" (~v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_add_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "addl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_add_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "addl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_subtract_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "subl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_subtract_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "subl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; +/// +/// static __inline void atomic_set_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "orq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_set_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "orq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_clear_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "andq %1,%0" : "+m" (*p) : "er" (~v) : "cc"); } static __inline void atomic_clear_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "andq %1,%0" : "+m" (*p) : "er" (~v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_add_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "addq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_add_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "addq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack; +/// static __inline void atomic_subtract_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "subq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_subtract_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "subq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack; +/// +/// +/// +/// +/// +/// static __inline u_char atomic_load_acq_char(volatile u_char *p) { u_char res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_char(volatile u_char *p, u_char v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; +/// static __inline u_short atomic_load_acq_short(volatile u_short *p) { u_short res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_short(volatile u_short *p, u_short v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; +/// static __inline u_int atomic_load_acq_int(volatile u_int *p) { u_int res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_int(volatile u_int *p, u_int v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; +/// static __inline u_long atomic_load_acq_long(volatile u_long *p) { u_long res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_long(volatile u_long *p, u_long v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; +/// +/// static __inline u_int +/// atomic_swap_int(volatile u_int *p, u_int v) +/// { +/// +/// __asm volatile( +/// " xchgl %1,%0 ; " +/// "# atomic_swap_int" +/// : "+r" (v), +/// "+m" (*p)); +/// return (v); +/// } +/// +/// static __inline u_long +/// atomic_swap_long(volatile u_long *p, u_long v) +/// { +/// +/// __asm volatile( +/// " xchgq %1,%0 ; " +/// "# atomic_swap_long" +/// : "+r" (v), +/// "+m" (*p)); +/// return (v); +/// } +/// +/// +/// +/// +/// +/// extern char *_PathLocale; +/// +/// int __detect_path_locale(void); +/// int __wrap_setrunelocale(const char *); +/// +/// +/// enum { +/// XLC_COLLATE = 0, +/// XLC_CTYPE, +/// XLC_MONETARY, +/// XLC_NUMERIC, +/// XLC_TIME, +/// XLC_MESSAGES, +/// XLC_LAST +/// }; +/// +/// _Static_assert(XLC_LAST - XLC_COLLATE == 6, "XLC values should be contiguous"); +/// _Static_assert(XLC_COLLATE == +/// +/// 1 +/// +/// - 1, +/// "XLC_COLLATE doesn't match the LC_COLLATE value."); +/// _Static_assert(XLC_CTYPE == +/// +/// 2 +/// +/// - 1, +/// "XLC_CTYPE doesn't match the LC_CTYPE value."); +/// _Static_assert(XLC_MONETARY == +/// +/// 3 +/// +/// - 1, +/// "XLC_MONETARY doesn't match the LC_MONETARY value."); +/// _Static_assert(XLC_NUMERIC == +/// +/// 4 +/// +/// - 1, +/// "XLC_NUMERIC doesn't match the LC_NUMERIC value."); +/// _Static_assert(XLC_TIME == +/// +/// 5 +/// +/// - 1, +/// "XLC_TIME doesn't match the LC_TIME value."); +/// _Static_assert(XLC_MESSAGES == +/// +/// 6 +/// +/// - 1, +/// "XLC_MESSAGES doesn't match the LC_MESSAGES value."); +/// +/// struct xlocale_refcounted { +/// +/// long retain_count; +/// +/// void(*destructor)(void*); +/// }; +/// +/// +/// +/// +/// +/// +/// +/// struct xlocale_component { +/// struct xlocale_refcounted header; +/// +/// char locale[31 +1]; +/// +/// char version[12]; +/// }; +/// +/// +/// +/// +/// struct _xlocale { +/// struct xlocale_refcounted header; +/// +/// struct xlocale_component *components[XLC_LAST]; +/// +/// +/// int monetary_locale_changed; +/// +/// +/// int using_monetary_locale; +/// +/// +/// int numeric_locale_changed; +/// +/// +/// int using_numeric_locale; +/// +/// +/// int using_time_locale; +/// +/// +/// int using_messages_locale; +/// +/// struct lconv lconv; +/// +/// char *csym; +/// }; +/// +/// +/// +/// +/// __attribute__((unused)) static void* +/// xlocale_retain(void *val) +/// { +/// struct xlocale_refcounted *obj = val; +/// atomic_add_long(&(obj->retain_count), 1); +/// return (val); +/// } +/// +/// +/// +/// +/// __attribute__((unused)) static void +/// xlocale_release(void *val) +/// { +/// struct xlocale_refcounted *obj = val; +/// long count; +/// +/// count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1; +/// if (count < 0 && obj->destructor != +/// +/// ((void *)0) +/// +/// ) +/// obj->destructor(obj); +/// } +/// +/// +/// +/// +/// +/// extern void* __collate_load(const char*, locale_t); +/// extern void* __ctype_load(const char*, locale_t); +/// extern void* __messages_load(const char*, locale_t); +/// extern void* __monetary_load(const char*, locale_t); +/// extern void* __numeric_load(const char*, locale_t); +/// extern void* __time_load(const char*, locale_t); +/// +/// extern struct _xlocale __xlocale_global_locale; +/// extern struct _xlocale __xlocale_C_locale; +/// +/// +/// +/// +/// void __set_thread_rune_locale(locale_t loc); +/// +/// +/// +/// +/// extern int __has_thread_locale; +/// +/// +/// +/// +/// +/// extern _Thread_local locale_t __thread_locale; +/// +/// +/// +/// +/// +/// +/// +/// static inline locale_t __get_locale(void) +/// { +/// +/// if (!__has_thread_locale) { +/// return (&__xlocale_global_locale); +/// } +/// return (__thread_locale ? __thread_locale : &__xlocale_global_locale); +/// } +/// +/// +/// +/// +/// +/// static inline locale_t get_real_locale(locale_t locale) +/// { +/// switch ((intptr_t)locale) { +/// case 0: return (&__xlocale_C_locale); +/// case -1: return (&__xlocale_global_locale); +/// default: return (locale); +/// } +/// } +/// +/// +/// +/// +/// +/// +/// +/// +/// struct xlocale_ctype { +/// struct xlocale_component header; +/// _RuneLocale *runes; +/// size_t (*__mbrtowc)(wchar_t * +/// +/// restrict +/// +/// , const char * +/// +/// restrict +/// +/// , +/// size_t, mbstate_t * +/// +/// restrict +/// +/// ); +/// int (*__mbsinit)(const mbstate_t *); +/// size_t (*__mbsnrtowcs)(wchar_t * +/// +/// restrict +/// +/// , const char ** +/// +/// restrict +/// +/// , +/// size_t, size_t, mbstate_t * +/// +/// restrict +/// +/// ); +/// size_t (*__wcrtomb)(char * +/// +/// restrict +/// +/// , wchar_t, mbstate_t * +/// +/// restrict +/// +/// ); +/// size_t (*__wcsnrtombs)(char * +/// +/// restrict +/// +/// , const wchar_t ** +/// +/// restrict +/// +/// , +/// size_t, size_t, mbstate_t * +/// +/// restrict +/// +/// ); +/// int __mb_cur_max; +/// int __mb_sb_limit; +/// +/// __mbstate_t mblen; +/// +/// __mbstate_t mbrlen; +/// +/// __mbstate_t mbrtoc16; +/// +/// __mbstate_t mbrtoc32; +/// +/// __mbstate_t mbrtowc; +/// +/// __mbstate_t mbsnrtowcs; +/// +/// __mbstate_t mbsrtowcs; +/// +/// __mbstate_t mbtowc; +/// +/// __mbstate_t c16rtomb; +/// +/// __mbstate_t c32rtomb; +/// +/// __mbstate_t wcrtomb; +/// +/// __mbstate_t wcsnrtombs; +/// +/// __mbstate_t wcsrtombs; +/// +/// __mbstate_t wctomb; +/// }; +/// +/// extern struct xlocale_ctype __xlocale_global_ctype; +/// +/// +/// +/// +/// int _none_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _UTF8_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _GB18030_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _GB2312_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _GBK_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _BIG5_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// int _ascii_init(struct xlocale_ctype *, _RuneLocale *) +/// +/// __attribute__((__visibility__("hidden"))) +/// +/// ; +/// +/// typedef size_t (*mbrtowc_pfn_t)(wchar_t * +/// +/// restrict +/// +/// , +/// const char * +/// +/// restrict +/// +/// , size_t, mbstate_t * +/// +/// restrict +/// +/// ); +/// typedef size_t (*wcrtomb_pfn_t)(char * +/// +/// restrict +/// +/// , wchar_t, +/// mbstate_t * +/// +/// restrict +/// +/// ); +/// size_t __mbsnrtowcs_std(wchar_t * +/// +/// restrict +/// +/// , const char ** +/// +/// restrict +/// +/// , +/// size_t, size_t, mbstate_t * +/// +/// restrict +/// +/// , mbrtowc_pfn_t); +/// size_t __wcsnrtombs_std(char * +/// +/// restrict +/// +/// , const wchar_t ** +/// +/// restrict +/// +/// , +/// size_t, size_t, mbstate_t * +/// +/// restrict +/// +/// , wcrtomb_pfn_t); +/// + +var X_DefaultRuneLocale = _RuneLocale{ + + __magic: *(*[8]int8)(unsafe.Pointer(ts /* "RuneMagi" */)), + __encoding: *(*[32]int8)(unsafe.Pointer(ts + 9 /* "NONE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00..." */)), + __invalid_rune: 0xFFFD, + + __runetype: [256]uint64{ + + 0: uint64(0x00000200), + + 1: uint64(0x00000200), + + 2: uint64(0x00000200), + + 3: uint64(0x00000200), + + 4: uint64(0x00000200), + + 5: uint64(0x00000200), + + 6: uint64(0x00000200), + + 7: uint64(0x00000200), + + 8: uint64(0x00000200), + + 9: (uint64((0x00000200 | + + 0x00004000) | + + 0x00020000)), + + 10: (uint64(0x00000200 | + + 0x00004000)), + + 11: (uint64(0x00000200 | + + 0x00004000)), + + 12: (uint64(0x00000200 | + + 0x00004000)), + + 13: (uint64(0x00000200 | + + 0x00004000)), + + 14: uint64(0x00000200), + + 15: uint64(0x00000200), + + 16: uint64(0x00000200), + + 17: uint64(0x00000200), + + 18: uint64(0x00000200), + + 19: uint64(0x00000200), + + 20: uint64(0x00000200), + + 21: uint64(0x00000200), + + 22: uint64(0x00000200), + + 23: uint64(0x00000200), + + 24: uint64(0x00000200), + + 25: uint64(0x00000200), + + 26: uint64(0x00000200), + + 27: uint64(0x00000200), + + 28: uint64(0x00000200), + + 29: uint64(0x00000200), + + 30: uint64(0x00000200), + + 31: uint64(0x00000200), + + 32: (uint64((0x00004000 | + + 0x00020000) | + + 0x00040000)), + + 33: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 34: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 35: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 36: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 37: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 38: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 39: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 40: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 41: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 42: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 43: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 44: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 45: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 46: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 47: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 48: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(0))), + + 49: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(1))), + + 50: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(2))), + + 51: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(3))), + + 52: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(4))), + + 53: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(5))), + + 54: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(6))), + + 55: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(7))), + + 56: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(8))), + + 57: (uint64(((((0x00000400 | + + 0x00040000) | + + 0x00000800) | + + 0x00010000) | + + 0x00400000) | + + int64(9))), + + 58: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 59: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 60: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 61: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 62: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 63: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 64: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 65: (uint64(((((0x00008000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(10))), + + 66: (uint64(((((0x00008000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(11))), + + 67: (uint64(((((0x00008000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(12))), + + 68: (uint64(((((0x00008000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(13))), + + 69: (uint64(((((0x00008000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(14))), + + 70: (uint64(((((0x00008000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(15))), + + 71: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 72: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 73: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 74: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 75: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 76: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 77: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 78: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 79: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 80: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 81: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 82: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 83: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 84: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 85: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 86: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 87: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 88: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 89: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 90: (uint64(((0x00008000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 91: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 92: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 93: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 94: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 95: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 96: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 97: (uint64(((((0x00001000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(10))), + + 98: (uint64(((((0x00001000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(11))), + + 99: (uint64(((((0x00001000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(12))), + + 100: (uint64(((((0x00001000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(13))), + + 101: (uint64(((((0x00001000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(14))), + + 102: (uint64(((((0x00001000 | + + 0x00010000) | + + 0x00040000) | + + 0x00000800) | + + 0x00000100) | + + int64(15))), + + 103: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 104: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 105: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 106: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 107: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 108: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 109: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 110: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 111: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 112: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 113: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 114: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 115: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 116: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 117: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 118: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 119: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 120: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 121: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 122: (uint64(((0x00001000 | + + 0x00040000) | + + 0x00000800) | + + 0x00000100)), + + 123: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 124: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 125: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 126: (uint64((0x00002000 | + + 0x00040000) | + + 0x00000800)), + + 127: uint64(0x00000200), + }, + __maplower: [256]int32{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + }, + __mapupper: [256]int32{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + }, +} /* table.cpp.c:2243:19 */ + +var X_CurrentRuneLocale uintptr = 0 /* table.cpp.c:4092:19 */ + +/// _RuneLocale * +/// __runes_for_locale(locale_t locale, int *mb_sb_limit) +/// { +/// (locale = get_real_locale(locale)); +/// struct xlocale_ctype *c = ((struct xlocale_ctype*)(locale)->components[XLC_CTYPE]); +/// *mb_sb_limit = c->__mb_sb_limit; +/// return c->runes; +/// } + +func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ + return (Bool32((_c == ' ') || ((uint32(_c) - uint32('\t')) < uint32(5)))) +} + +type locale_t = uintptr /* alltypes.h:343:32 */ + +func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ + return (Bool32((func() int32 { + if 0 != 0 { + return Xisalpha(tls, c) + } + return (Bool32((((uint32(c)) | uint32(32)) - uint32('a')) < uint32(26))) + }() != 0) || (func() int32 { + if 0 != 0 { + return Xisdigit(tls, c) + } + return (Bool32(((uint32(c)) - uint32('0')) < uint32(10))) + }() != 0))) +} + +func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */ + return Xisalnum(tls, c) +} + +func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */ + return (Bool32(((uint32(c) | uint32(32)) - uint32('a')) < uint32(26))) +} + +func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */ + return Xisalpha(tls, c) +} + +func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */ + return (Bool32((uint32(c) - uint32('0')) < uint32(10))) +} + +func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */ + return Xisdigit(tls, c) +} + +type uintptr_t = uint64 /* alltypes.h:55:24 */ + +type intptr_t = int64 /* alltypes.h:70:15 */ + +type int8_t = int8 /* alltypes.h:96:25 */ + +type int16_t = int16 /* alltypes.h:101:25 */ + +type int32_t = int32 /* alltypes.h:106:25 */ + +type int64_t = int64 /* alltypes.h:111:25 */ + +type intmax_t = int64 /* alltypes.h:116:25 */ + +type uint8_t = uint8 /* alltypes.h:121:25 */ + +type uint16_t = uint16 /* alltypes.h:126:25 */ + +type uint32_t = uint32 /* alltypes.h:131:25 */ + +type uint64_t = uint64 /* alltypes.h:136:25 */ + +type uintmax_t = uint64 /* alltypes.h:146:25 */ + +type int_fast8_t = int8_t /* stdint.h:22:16 */ +type int_fast64_t = int64_t /* stdint.h:23:17 */ + +type int_least8_t = int8_t /* stdint.h:25:17 */ +type int_least16_t = int16_t /* stdint.h:26:17 */ +type int_least32_t = int32_t /* stdint.h:27:17 */ +type int_least64_t = int64_t /* stdint.h:28:17 */ + +type uint_fast8_t = uint8_t /* stdint.h:30:17 */ +type uint_fast64_t = uint64_t /* stdint.h:31:18 */ + +type uint_least8_t = uint8_t /* stdint.h:33:18 */ +type uint_least16_t = uint16_t /* stdint.h:34:18 */ +type uint_least32_t = uint32_t /* stdint.h:35:18 */ +type uint_least64_t = uint64_t /* stdint.h:36:18 */ + +type int_fast16_t = int32_t /* stdint.h:1:17 */ +type int_fast32_t = int32_t /* stdint.h:2:17 */ +type uint_fast16_t = uint32_t /* stdint.h:3:18 */ +type uint_fast32_t = uint32_t /* stdint.h:4:18 */ + +type ssize_t = int64 /* alltypes.h:65:15 */ + +type off_t = int64 /* alltypes.h:162:16 */ + +type _IO_FILE = struct { + flags uint32 + _ [4]byte + rpos uintptr + rend uintptr + close uintptr + wend uintptr + wpos uintptr + mustbezero_1 uintptr + wbase uintptr + read uintptr + write uintptr + seek uintptr + buf uintptr + buf_size size_t + prev uintptr + next uintptr + fd int32 + pipe_pid int32 + lockcount int64 + mode int32 + lock int32 + lbf int32 + _ [4]byte + cookie uintptr + off off_t + getln_buf uintptr + mustbezero_2 uintptr + shend uintptr + shlim off_t + shcnt off_t + prev_locked uintptr + next_locked uintptr + locale uintptr +} /* alltypes.h:320:9 */ + +type FILE = _IO_FILE /* alltypes.h:320:25 */ + +type va_list = uintptr /* alltypes.h:326:27 */ + +type _G_fpos64_t = struct { + _ [0]uint64 + __opaque [16]int8 +} /* stdio.h:54:9 */ + +type fpos_t = _G_fpos64_t /* stdio.h:58:3 */ + +type float_t = float32 /* alltypes.h:29:15 */ + +type double_t = float64 /* alltypes.h:34:16 */ + +func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var __u struct {__f float32;} at bp, 4 + + *(*float32)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint32)(unsafe.Pointer(bp /* &__u */)) +} + +func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var __u struct {__f float64;} at bp, 8 + + *(*float64)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint64)(unsafe.Pointer(bp /* &__u */)) +} + +type syscall_arg_t = int64 /* syscall.h:22:14 */ + +func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ + var c int32 + var x int32 + var y int64 + var neg int32 = 0 + + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if (c == '+') || (c == '-') { + neg = (Bool32(c == '-')) + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if ((uint32(c - '0')) >= 10) && (pok != 0) { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } + } + if (uint32(c - '0')) >= 10 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + return (-0x7fffffffffffffff - int64(1)) + } + for x = 0; ((uint32(c - '0')) < 10) && (x < (0x7fffffff / 10)); c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + x = (((10 * x) + c) - '0') + } + for y = int64(x); ((uint32(c - '0')) < 10) && (y < (0x7fffffffffffffff / int64(100))); c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + y = (((int64(10) * y) + int64(c)) - int64('0')) + } + for ; (uint32(c - '0')) < 10; c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if neg != 0 { + return -y + } + return y +} + +func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */ + bp := tls.Alloc(512) + defer tls.Free(512) + + // var x [128]uint32_t at bp, 512 + + var i int32 + var j int32 + var k int32 + var a int32 + var z int32 + var lrp int64 = int64(0) + var dc int64 = int64(0) + var e10 int64 = int64(0) + var lnz int32 = 0 + var gotdig int32 = 0 + var gotrad int32 = 0 + var rp int32 + var e2 int32 + var emax int32 = ((-emin - bits) + 3) + var denormal int32 = 0 + var y float64 + var frac float64 = float64(0) + var bias float64 = float64(0) + + j = 0 + k = 0 + + // Don't let leading zeros consume buffer space + for ; c == '0'; c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + gotdig = 1 + } + if c == '.' { + gotrad = 1 + for c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }(); c == '0'; c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + gotdig = 1 + lrp-- + } + } + + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)) = uint32_t(0) + for ; ((uint32(c - '0')) < 10) || (c == '.'); c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + if c == '.' { + if gotrad != 0 { + break + } + gotrad = 1 + lrp = dc + } else if k < (128 - 3) { + dc++ + if c != '0' { + lnz = int32(dc) + } + if j != 0 { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = (((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) * uint32_t(10)) + uint32_t(c)) - uint32_t('0')) + } else { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = (uint32_t(c - '0')) + } + if PreIncInt32(&j, 1) == 9 { + k++ + j = 0 + } + gotdig = 1 + } else { + dc++ + if c != '0' { + lnz = ((128 - 4) * 9) + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + 124*4)) |= (uint32_t(1)) + } + } + } + if !(gotrad != 0) { + lrp = dc + } + + if (gotdig != 0) && ((c | 32) == 'e') { + e10 = scanexp(tls, f, pok) + if e10 == (-0x7fffffffffffffff - int64(1)) { + if pok != 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } else { + X__shlim(tls, f, int64(0)) + return float64(0) + } + e10 = int64(0) + } + lrp = lrp + (e10) + } else if c >= 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } + if !(gotdig != 0) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + X__shlim(tls, f, int64(0)) + return float64(0) + } + + // Handle zero specially to avoid nasty special cases later + if !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */))) != 0) { + return (float64(sign) * 0.0) + } + + // Optimize small integers (w/no exponent) and over/under-flow + if ((lrp == dc) && (dc < int64(10))) && ((bits > 30) || ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)) >> bits) == uint32_t(0))) { + return (float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) + } + if lrp > (int64(-emin / 2)) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 1.79769313486231570815e+308) * 1.79769313486231570815e+308) + } + if lrp < (int64(emin - (2 * 53))) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 2.22507385850720138309e-308) * 2.22507385850720138309e-308) + } + + // Align incomplete final B1B digit + if j != 0 { + for ; j < 9; j++ { + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + uintptr(k)*4)) *= (uint32_t(10)) + } + k++ + j = 0 + } + + a = 0 + z = k + e2 = 0 + rp = int32(lrp) + + // Optimize small to mid-size integers (even in exp. notation) + if ((lnz < 9) && (lnz <= rp)) && (rp < 18) { + if rp == 9 { + return (float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) + } + if rp < 9 { + return ((float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) / float64(_sp10s[(8-rp)])) + } + var bitlim int32 = (bits - (3 * (rp - 9))) + if (bitlim > 30) || ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)) >> bitlim) == uint32_t(0)) { + return ((float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) * float64(_sp10s[(rp-10)])) + } + } + + // Drop trailing zeros + for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr((z-1))*4))) != 0); z-- { + } + + // Align radix point to B1B digit boundary + if (rp % 9) != 0 { + var rpm9 int32 + if rp >= 0 { + rpm9 = (rp % 9) + } else { + rpm9 = ((rp % 9) + 9) + } + var p10 int32 = _sp10s[(8 - rpm9)] + var carry uint32_t = uint32_t(0) + for k = a; k != z; k++ { + var tmp uint32_t = (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) % uint32_t(p10)) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) / uint32_t(p10)) + carry) + carry = ((uint32_t(1000000000 / p10)) * tmp) + if (k == a) && !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) != 0) { + a = ((a + 1) & (128 - 1)) + rp = rp - (9) + } + } + if carry != 0 { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(PostIncInt32(&z, 1))*4)) = carry + } + rp = rp + (9 - rpm9) + } + + // Upscale until desired number of bits are left of radix point + for (rp < (9 * 2)) || ((rp == (9 * 2)) && (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(a)*4)) < _sth[0])) { + var carry uint32_t = uint32_t(0) + e2 = e2 - (29) + for k = ((z - 1) & (128 - 1)); ; k = ((k - 1) & (128 - 1)) { + var tmp uint64_t = ((uint64_t(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) << 29) + uint64_t(carry)) + if tmp > uint64(1000000000) { + carry = (uint32_t(tmp / uint64(1000000000))) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = (uint32_t(tmp % uint64(1000000000))) + } else { + carry = uint32_t(0) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = uint32_t(tmp) + } + if ((k == ((z - 1) & (128 - 1))) && (k != a)) && !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) != 0) { + z = k + } + if k == a { + break + } + } + if carry != 0 { + rp = rp + (9) + a = ((a - 1) & (128 - 1)) + if a == z { + z = ((z - 1) & (128 - 1)) + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + uintptr(((z-1)&(128-1)))*4)) |= (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(z)*4))) + } + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(a)*4)) = carry + } + } + + // Downscale until exactly number of bits are left of radix point + for { + var carry uint32_t = uint32_t(0) + var sh int32 = 1 + for i = 0; i < 2; i++ { + k = ((a + i) & (128 - 1)) + if (k == z) || (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) < _sth[i]) { + i = 2 + break + } + if *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((a+i)&(128-1)))*4)) > _sth[i] { + break + } + } + if (i == 2) && (rp == (9 * 2)) { + break + } + // FIXME: find a way to compute optimal sh + if rp > (9 + (9 * 2)) { + sh = 9 + } + e2 = e2 + (sh) + for k = a; k != z; k = ((k + 1) & (128 - 1)) { + var tmp uint32_t = (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) & (uint32_t((int32(1) << sh) - 1))) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) >> sh) + carry) + carry = ((uint32_t(int32(1000000000) >> sh)) * tmp) + if (k == a) && !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) != 0) { + a = ((a + 1) & (128 - 1)) + i-- + rp = rp - (9) + } + } + if carry != 0 { + if ((z + 1) & (128 - 1)) != a { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(z)*4)) = carry + z = ((z + 1) & (128 - 1)) + } else { + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + uintptr(((z-1)&(128-1)))*4)) |= (uint32_t(1)) + } + } + } + + // Assemble desired bits into floating point variable + for y = float64(AssignInt32(&i, 0)); i < 2; i++ { + if ((a + i) & (128 - 1)) == z { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((AssignInt32(&z, ((z+1)&(128-1))))-1))*4)) = uint32_t(0) + } + y = ((1000000000.0 * y) + float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((a+i)&(128-1)))*4)))) + } + + y = y * (float64(sign)) + + // Limit precision for denormal results + if bits > ((53 + e2) - emin) { + bits = ((53 + e2) - emin) + if bits < 0 { + bits = 0 + } + denormal = 1 + } + + // Calculate bias term to force rounding, move out lower bits + if bits < 53 { + bias = Xcopysignl(tls, Xscalbn(tls, float64(1), (((2*53)-bits)-1)), y) + frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), (53-bits))) + y = y - (frac) + y = y + (bias) + } + + // Process tail of decimal input so it can affect rounding + if ((a + i) & (128 - 1)) != z { + var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((a+i)&(128-1)))*4)) + if (t < uint32_t(500000000)) && ((t != 0) || ((((a + i) + 1) & (128 - 1)) != z)) { + frac = frac + (0.25 * float64(sign)) + } else if t > uint32_t(500000000) { + frac = frac + (0.75 * float64(sign)) + } else if t == uint32_t(500000000) { + if (((a + i) + 1) & (128 - 1)) == z { + frac = frac + (0.5 * float64(sign)) + } else { + frac = frac + (0.75 * float64(sign)) + } + } + if ((53 - bits) >= 2) && !(Xfmodl(tls, frac, float64(1)) != 0) { + frac += 1 + } + } + + y = y + (frac) + y = y - (bias) + + if ((e2 + 53) & 0x7fffffff) > (emax - 5) { + if Xfabsl(tls, y) >= (float64(float64(2)) / 2.22044604925031308085e-16) { + if (denormal != 0) && (bits == ((53 + e2) - emin)) { + denormal = 0 + } + y = y * (0.5) + e2++ + } + if ((e2 + 53) > emax) || ((denormal != 0) && (frac != 0)) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + } + } + + return Xscalbnl(tls, y, e2) +} + +var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */ +var _sp10s = [8]int32{10, 100, 1000, 10000, + 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */ + +func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */ + var x uint32_t = uint32_t(0) + var y float64 = float64(0) + var scale float64 = float64(1) + var bias float64 = float64(0) + var gottail int32 = 0 + var gotrad int32 = 0 + var gotdig int32 = 0 + var rp int64 = int64(0) + var dc int64 = int64(0) + var e2 int64 = int64(0) + var d int32 + var c int32 + + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + + // Skip leading zeros + for ; c == '0'; c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + gotdig = 1 + } + + if c == '.' { + gotrad = 1 + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + // Count zeros after the radix point before significand + rp = int64(0) + __1: + if !(c == '0') { + goto __3 + } + gotdig = 1 + goto __2 + __2: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + rp-- + goto __1 + goto __3 + __3: + } + + for ; (((uint32(c - '0')) < 10) || ((uint32((c | 32) - 'a')) < 6)) || (c == '.'); c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + if c == '.' { + if gotrad != 0 { + break + } + rp = dc + gotrad = 1 + } else { + gotdig = 1 + if c > '9' { + d = (((c | 32) + 10) - 'a') + } else { + d = (c - '0') + } + if dc < int64(8) { + x = ((x * uint32_t(16)) + uint32_t(d)) + } else if dc < (int64((53 / 4) + 1)) { + y = y + (float64(d) * (AssignDivFloat64(&scale, float64(16)))) + } else if (d != 0) && !(gottail != 0) { + y = y + (0.5 * scale) + gottail = 1 + } + dc++ + } + } + if !(gotdig != 0) { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if pok != 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if gotrad != 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } + } else { + X__shlim(tls, f, int64(0)) + } + return (float64(sign) * 0.0) + } + if !(gotrad != 0) { + rp = dc + } + for dc < int64(8) { + x = x * (uint32_t(16)) + dc++ + } + if (c | 32) == 'p' { + e2 = scanexp(tls, f, pok) + if e2 == (-0x7fffffffffffffff - int64(1)) { + if pok != 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } else { + X__shlim(tls, f, int64(0)) + return float64(0) + } + e2 = int64(0) + } + } else { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } + e2 = e2 + ((int64(4) * rp) - int64(32)) + + if !(x != 0) { + return (float64(sign) * 0.0) + } + if e2 > int64(-emin) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 1.79769313486231570815e+308) * 1.79769313486231570815e+308) + } + if e2 < (int64(emin - (2 * 53))) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 2.22507385850720138309e-308) * 2.22507385850720138309e-308) + } + + for x < 0x80000000 { + if y >= 0.5 { + x = x + (x + uint32_t(1)) + y = y + (y - float64(1)) + } else { + x = x + (x) + y = y + (y) + } + e2-- + } + + if int64(bits) > ((int64(32) + e2) - int64(emin)) { + bits = (int32((int64(32) + e2) - int64(emin))) + if bits < 0 { + bits = 0 + } + } + + if bits < 53 { + bias = Xcopysignl(tls, Xscalbn(tls, float64(1), (((32+53)-bits)-1)), float64(sign)) + } + + if ((bits < 32) && (y != 0)) && !((x & uint32_t(1)) != 0) { + x++ + y = float64(0) + } + + y = ((bias + (float64(sign) * float64(x))) + (float64(sign) * y)) + y = y - (bias) + + if !(y != 0) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + } + + return Xscalbnl(tls, y, int32(e2)) +} + +func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */ + var sign int32 = 1 + var i size_t + var bits int32 + var emin int32 + var c int32 + + switch prec { + case 0: + bits = 24 + emin = ((-125) - bits) + break + case 1: + bits = 53 + emin = ((-1021) - bits) + break + case 2: + bits = 53 + emin = ((-1021) - bits) + break + default: + return float64(0) + } + + for __isspace(tls, AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) != 0 { + } + + if (c == '+') || (c == '-') { + sign = sign - (2 * (Bool32(c == '-'))) + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + } + + for i = uint64(0); (i < uint64(8)) && ((c | 32) == int32(*(*int8)(unsafe.Pointer(ts + 41 /* "infinity" */ + uintptr(i))))); i++ { + if i < uint64(7) { + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + } + } + if ((i == uint64(3)) || (i == uint64(8))) || ((i > uint64(3)) && (pok != 0)) { + if i != uint64(8) { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if pok != 0 { + for ; i > uint64(3); i-- { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } + } + } + return (float64(float32(sign) * X__builtin_inff(tls))) + } + if !(i != 0) { + for i = uint64(0); (i < uint64(3)) && ((c | 32) == int32(*(*int8)(unsafe.Pointer(ts + 50 /* "nan" */ + uintptr(i))))); i++ { + if i < uint64(2) { + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + } + } + } + if i == uint64(3) { + if (func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) != '(' { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + return float64(X__builtin_nanf(tls, ts+54 /* "" */)) + } + for i = uint64(1); ; i++ { + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if ((((uint32(c - '0')) < 10) || ((uint32(c - 'A')) < 26)) || ((uint32(c - 'a')) < 26)) || (c == '_') { + continue + } + if c == ')' { + return float64(X__builtin_nanf(tls, ts+54 /* "" */)) + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(pok != 0) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + X__shlim(tls, f, int64(0)) + return float64(0) + } + for PostDecUint64(&i, 1) != 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + } + return float64(X__builtin_nanf(tls, ts+54 /* "" */)) + } + return float64(X__builtin_nanf(tls, ts+54 /* "" */)) + } + + if i != 0 { + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + X__shlim(tls, f, int64(0)) + return float64(0) + } + + if c == '0' { + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if (c | 32) == 'x' { + return hexfloat(tls, f, bits, emin, sign, pok) + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + c = '0' + } + + return decfloat(tls, f, c, bits, emin, sign, pok) +} + +// Lookup table for digit values. -1==255>=36 -> invalid +var table = [257]uint8{Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), + uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), + uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), +} /* intscan.c:7:28 */ + +func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */ + var val uintptr + var c int32 + var neg int32 + var x uint32 + var y uint64 + var bs int32 + val = (uintptr(unsafe.Pointer(&table)) + uintptr(1)) + neg = 0 + if !((base > uint32(36)) || (base == uint32(1))) { + goto __1 + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + return uint64(0) +__1: + ; +__2: + if !(__isspace(tls, AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) != 0) { + goto __3 + } + goto __2 +__3: + ; + if !((c == '+') || (c == '-')) { + goto __4 + } + neg = -(Bool32(c == '-')) + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() +__4: + ; + if !(((base == uint32(0)) || (base == uint32(16))) && (c == '0')) { + goto __5 + } + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if !((c | 32) == 'x') { + goto __7 + } + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) { + goto __9 + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(pok != 0) { + goto __10 + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + goto __11 +__10: + X__shlim(tls, f, int64(0)) +__11: + ; + return uint64(0) +__9: + ; + base = uint32(16) + goto __8 +__7: + if !(base == uint32(0)) { + goto __12 + } + base = uint32(8) +__12: + ; +__8: + ; + goto __6 +__5: + if !(base == uint32(0)) { + goto __13 + } + base = uint32(10) +__13: + ; + if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) { + goto __14 + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + X__shlim(tls, f, int64(0)) + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + return uint64(0) +__14: + ; +__6: + ; + if !(base == uint32(10)) { + goto __15 + } + x = uint32(0) +__17: + if !(((uint32(c - '0')) < 10) && (x <= ((0xffffffff / uint32(10)) - uint32(1)))) { + goto __19 + } + x = ((x * uint32(10)) + (uint32(c - '0'))) + goto __18 +__18: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __17 + goto __19 +__19: + ; + y = uint64(x) +__20: + if !((((uint32(c - '0')) < 10) && (y <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) / uint64(10)))) && ((uint64(10) * y) <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) - (uint64(c - '0'))))) { + goto __22 + } + y = ((y * uint64(10)) + (uint64(c - '0'))) + goto __21 +__21: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __20 + goto __22 +__22: + ; + if !((uint32(c - '0')) >= 10) { + goto __23 + } + goto done +__23: + ; + goto __16 +__15: + if !(!((base & (base - uint32(1))) != 0)) { + goto __24 + } + bs = int32(*(*int8)(unsafe.Pointer(ts + 55 /* "\x00\x01\x02\x04\a\x03\x06\x05" */ + uintptr((((uint32(0x17) * base) >> 5) & uint32(7)))))) + x = uint32(0) +__26: + if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (x <= (0xffffffff / uint32(32)))) { + goto __28 + } + x = ((x << bs) | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __27 +__27: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __26 + goto __28 +__28: + ; + y = uint64(x) +__29: + if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (y <= (uint64(((2 * uint64(0x7fffffffffffffff)) + uint64(1))) >> bs))) { + goto __31 + } + y = ((y << bs) | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __30 +__30: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __29 + goto __31 +__31: + ; + goto __25 +__24: + x = uint32(0) +__32: + if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (x <= ((0xffffffff / uint32(36)) - uint32(1)))) { + goto __34 + } + x = ((x * base) + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __33 +__33: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __32 + goto __34 +__34: + ; + y = uint64(x) +__35: + if !(((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (y <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) / uint64(base)))) && ((uint64(base) * y) <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) - uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))))) { + goto __37 + } + y = ((y * uint64(base)) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __36 +__36: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __35 + goto __37 +__37: + ; +__25: + ; +__16: + ; + if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { + goto __38 + } +__39: + if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { + goto __41 + } + goto __40 +__40: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __39 + goto __41 +__41: + ; + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + y = lim + if !((lim & uint64(1)) != 0) { + goto __42 + } + neg = 0 +__42: + ; +__38: + ; +done: + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(y >= lim) { + goto __43 + } + if !(!((lim & uint64(1)) != 0) && !(neg != 0)) { + goto __44 + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return (lim - uint64(1)) + goto __45 +__44: + if !(y > lim) { + goto __46 + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return lim +__46: + ; +__45: + ; +__43: + ; + return ((y ^ uint64(neg)) - uint64(neg)) +} + +// The shcnt field stores the number of bytes read so far, offset by +// the value of buf-rpos at the last function call (__shlim or __shgetc), +// so that between calls the inline shcnt macro can add rpos-buf to get +// the actual count. + +func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */ + (*FILE)(unsafe.Pointer(f)).shlim = lim + (*FILE)(unsafe.Pointer(f)).shcnt = ((int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1) + // If lim is nonzero, rend must be a valid pointer. + if (lim != 0) && (((int64((*FILE)(unsafe.Pointer(f)).rend) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1) > lim) { + (*FILE)(unsafe.Pointer(f)).shend = ((*FILE)(unsafe.Pointer(f)).rpos + uintptr(lim)) + } else { + (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend + } +} + +func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */ + var c int32 + var cnt off_t = ((*FILE)(unsafe.Pointer((f))).shcnt + ((int64((*FILE)(unsafe.Pointer((f))).rpos) - int64((*FILE)(unsafe.Pointer((f))).buf)) / 1)) + if (((*FILE)(unsafe.Pointer(f)).shlim != 0) && (cnt >= (*FILE)(unsafe.Pointer(f)).shlim)) || ((AssignInt32(&c, X__uflow(tls, f))) < 0) { + (*FILE)(unsafe.Pointer(f)).shcnt = (((int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1) + cnt) + (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + (*FILE)(unsafe.Pointer(f)).shlim = int64(-1) + return -1 + } + cnt++ + if ((*FILE)(unsafe.Pointer(f)).shlim != 0) && (((int64((*FILE)(unsafe.Pointer(f)).rend) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1) > ((*FILE)(unsafe.Pointer(f)).shlim - cnt)) { + (*FILE)(unsafe.Pointer(f)).shend = ((*FILE)(unsafe.Pointer(f)).rpos + uintptr(((*FILE)(unsafe.Pointer(f)).shlim - cnt))) + } else { + (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend + } + (*FILE)(unsafe.Pointer(f)).shcnt = (((int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1) + cnt) + if (*FILE)(unsafe.Pointer(f)).rpos <= (*FILE)(unsafe.Pointer(f)).buf { + *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).rpos + UintptrFromInt32(-1))) = uint8(c) + } + return c +} + +func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ + return ((((__x >> 24) | ((__x >> 8) & uint32_t(0xff00))) | ((__x << 8) & uint32_t(0xff0000))) | (__x << 24)) +} + +func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */ + return Xcopysign(tls, x, y) +} + +func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */ + return Xfabs(tls, x) +} + +func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */ + return Xfmod(tls, x, y) +} + +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + +func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var u struct {f float64;} at bp, 8 + + var y double_t = x + + if n > 1023 { + y = y * (0x1p1023) + n = n - (1023) + if n > 1023 { + y = y * (0x1p1023) + n = n - (1023) + if n > 1023 { + n = 1023 + } + } + } else if n < -1022 { + // make sure final n < -53 to avoid double + // rounding in the subnormal range + y = y * (float64(0x1p-1022) * 0x1p53) + n = n + (1022 - 53) + if n < -1022 { + y = y * (float64(0x1p-1022) * 0x1p53) + n = n + (1022 - 53) + if n < -1022 { + n = -1022 + } + } + } + *(*uint64_t)(unsafe.Pointer(bp /* &u */)) = ((uint64_t(0x3ff + n)) << 52) + x = (y * *(*float64)(unsafe.Pointer(bp /* &u */))) + return x +} + +func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ + return Xscalbn(tls, x, n) +} + +type div_t = struct { + quot int32 + rem int32 +} /* stdlib.h:62:35 */ +type ldiv_t = struct { + quot int64 + rem int64 +} /* stdlib.h:63:36 */ +type lldiv_t = struct { + quot int64 + rem int64 +} /* stdlib.h:64:41 */ + +type max_align_t = struct { + __ll int64 + __ld float64 +} /* alltypes.h:41:54 */ + +type imaxdiv_t = struct { + quot intmax_t + rem intmax_t +} /* inttypes.h:14:40 */ + +type pid_t = int32 /* alltypes.h:235:13 */ + +type uid_t = uint32 /* alltypes.h:245:18 */ + +type gid_t = uint32 /* alltypes.h:250:18 */ + +type iovec = struct { + iov_base uintptr + iov_len size_t +} /* alltypes.h:355:1 */ + +type socklen_t = uint32 /* alltypes.h:361:18 */ + +type sa_family_t = uint16 /* alltypes.h:366:24 */ + +type msghdr = struct { + msg_name uintptr + msg_namelen socklen_t + _ [4]byte + msg_iov uintptr + msg_iovlen int32 + __pad1 int32 + msg_control uintptr + msg_controllen socklen_t + __pad2 int32 + msg_flags int32 + _ [4]byte +} /* socket.h:22:1 */ + +type cmsghdr = struct { + cmsg_len socklen_t + __pad1 int32 + cmsg_level int32 + cmsg_type int32 +} /* socket.h:44:1 */ + +type linger = struct { + l_onoff int32 + l_linger int32 +} /* socket.h:74:1 */ + +type sockaddr = struct { + sa_family sa_family_t + sa_data [14]int8 +} /* socket.h:367:1 */ + +type sockaddr_storage = struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 +} /* socket.h:372:1 */ + +type in_port_t = uint16_t /* in.h:12:18 */ +type in_addr_t = uint32_t /* in.h:13:18 */ +type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */ + +type sockaddr_in = struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t +} /* in.h:16:1 */ + +type in6_addr = struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } +} /* in.h:23:1 */ + +type sockaddr_in6 = struct { + sin6_family sa_family_t + sin6_port in_port_t + sin6_flowinfo uint32_t + sin6_addr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + sin6_scope_id uint32_t +} /* in.h:34:1 */ + +type ipv6_mreq = struct { + ipv6mr_multiaddr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + ipv6mr_interface uint32 +} /* in.h:42:1 */ + +type ip_opts = struct { + ip_dst struct{ s_addr in_addr_t } + ip_opts [40]int8 +} /* in.h:229:1 */ + +type ip_mreq = struct { + imr_multiaddr struct{ s_addr in_addr_t } + imr_interface struct{ s_addr in_addr_t } +} /* in.h:247:1 */ + +type ip_mreqn = struct { + imr_multiaddr struct{ s_addr in_addr_t } + imr_address struct{ s_addr in_addr_t } + imr_ifindex int32 +} /* in.h:252:1 */ + +type ip_mreq_source = struct { + imr_multiaddr struct{ s_addr in_addr_t } + imr_interface struct{ s_addr in_addr_t } + imr_sourceaddr struct{ s_addr in_addr_t } +} /* in.h:258:1 */ + +type ip_msfilter = struct { + imsf_multiaddr struct{ s_addr in_addr_t } + imsf_interface struct{ s_addr in_addr_t } + imsf_fmode uint32_t + imsf_numsrc uint32_t + imsf_slist [1]struct{ s_addr in_addr_t } +} /* in.h:264:1 */ + +type group_req = struct { + gr_interface uint32_t + _ [4]byte + gr_group struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } +} /* in.h:275:1 */ + +type group_source_req = struct { + gsr_interface uint32_t + _ [4]byte + gsr_group struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } + gsr_source struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } +} /* in.h:280:1 */ + +type group_filter = struct { + gf_interface uint32_t + _ [4]byte + gf_group struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } + gf_fmode uint32_t + gf_numsrc uint32_t + gf_slist [1]struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } +} /* in.h:286:1 */ + +type in_pktinfo = struct { + ipi_ifindex int32 + ipi_spec_dst struct{ s_addr in_addr_t } + ipi_addr struct{ s_addr in_addr_t } +} /* in.h:297:1 */ + +type in6_pktinfo = struct { + ipi6_addr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + ipi6_ifindex uint32 +} /* in.h:303:1 */ + +type ip6_mtuinfo = struct { + ip6m_addr struct { + sin6_family sa_family_t + sin6_port in_port_t + sin6_flowinfo uint32_t + sin6_addr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + sin6_scope_id uint32_t + } + ip6m_mtu uint32_t +} /* in.h:308:1 */ + +type addrinfo = struct { + ai_flags int32 + ai_family int32 + ai_socktype int32 + ai_protocol int32 + ai_addrlen socklen_t + _ [4]byte + ai_addr uintptr + ai_canonname uintptr + ai_next uintptr +} /* netdb.h:16:1 */ + +// Legacy functions follow (marked OBsolete in SUS) + +type netent = struct { + n_name uintptr + n_aliases uintptr + n_addrtype int32 + n_net uint32_t +} /* netdb.h:62:1 */ + +type hostent = struct { + h_name uintptr + h_aliases uintptr + h_addrtype int32 + h_length int32 + h_addr_list uintptr +} /* netdb.h:69:1 */ + +type servent = struct { + s_name uintptr + s_aliases uintptr + s_port int32 + _ [4]byte + s_proto uintptr +} /* netdb.h:78:1 */ + +type protoent = struct { + p_name uintptr + p_aliases uintptr + p_proto int32 + _ [4]byte +} /* netdb.h:85:1 */ + +type aibuf = struct { + ai struct { + ai_flags int32 + ai_family int32 + ai_socktype int32 + ai_protocol int32 + ai_addrlen socklen_t + _ [4]byte + ai_addr uintptr + ai_canonname uintptr + ai_next uintptr + } + sa struct { + sin struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t + } + _ [12]byte + } + lock [1]int32 + slot int16 + ref int16 + _ [4]byte +} /* lookup.h:10:1 */ + +type sa = struct { + sin struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t + } + _ [12]byte +} /* lookup.h:10:1 */ + +type address = struct { + family int32 + scopeid uint32 + addr [16]uint8_t + sortkey int32 +} /* lookup.h:20:1 */ + +type service = struct { + port uint16_t + proto uint8 + socktype uint8 +} /* lookup.h:27:1 */ + +type resolvconf = struct { + ns [3]struct { + family int32 + scopeid uint32 + addr [16]uint8_t + sortkey int32 + } + nns uint32 + attempts uint32 + ndots uint32 + timeout uint32 +} /* lookup.h:34:1 */ + +func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ + var cnt size_t + cnt = uint64(1) +__1: + if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) { + goto __3 + } + goto __2 +__2: + cnt++ + p = (*addrinfo)(unsafe.Pointer(p)).ai_next + goto __1 + goto __3 +__3: + ; + var b uintptr = (p - uintptr((uint64((uintptr(0) /* &.ai */))))) + b -= 88 * (uintptr((*aibuf)(unsafe.Pointer(b)).slot)) + //TODO LOCK(b->lock); + if !(int32(AssignSubPtrInt16(b+82 /* &.ref */, int16(cnt))) != 0) { + Xfree(tls, b) + } + //TODO else UNLOCK(b->lock); +} + +type time_t = int64 /* alltypes.h:85:16 */ + +type clockid_t = int32 /* alltypes.h:214:13 */ + +type timespec = struct { + tv_sec time_t + tv_nsec int64 +} /* alltypes.h:229:1 */ + +type pthread_t = uintptr /* alltypes.h:273:26 */ + +type pthread_once_t = int32 /* alltypes.h:279:13 */ + +type pthread_key_t = uint32 /* alltypes.h:284:18 */ + +type pthread_spinlock_t = int32 /* alltypes.h:289:13 */ + +type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:294:37 */ + +type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:299:37 */ + +type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:304:37 */ + +type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:309:40 */ + +type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:349:9 */ + +type sigset_t = __sigset_t /* alltypes.h:349:71 */ + +type pthread_attr_t = struct { + __u struct { + _ [0]uint64 + __i [14]int32 + } +} /* alltypes.h:372:147 */ + +type pthread_mutex_t = struct { + __u struct { + _ [0]uint64 + __i [10]int32 + } +} /* alltypes.h:377:157 */ + +type pthread_cond_t = struct { + __u struct { + _ [0]uint64 + __i [12]int32 + } +} /* alltypes.h:387:112 */ + +type pthread_rwlock_t = struct { + __u struct { + _ [0]uint64 + __i [14]int32 + } +} /* alltypes.h:397:139 */ + +type pthread_barrier_t = struct { + __u struct { + _ [0]uint64 + __i [8]int32 + } +} /* alltypes.h:402:137 */ + +type sched_param = struct { + sched_priority int32 + __reserved1 int32 + __reserved2 [2]struct { + __reserved1 time_t + __reserved2 int64 + } + __reserved3 int32 + _ [4]byte +} /* sched.h:19:1 */ + +type timer_t = uintptr /* alltypes.h:209:14 */ + +type clock_t = int64 /* alltypes.h:219:14 */ + +type tm = struct { + tm_sec int32 + tm_min int32 + tm_hour int32 + tm_mday int32 + tm_mon int32 + tm_year int32 + tm_wday int32 + tm_yday int32 + tm_isdst int32 + _ [4]byte + tm_gmtoff int64 + tm_zone uintptr +} /* time.h:38:1 */ + +type itimerspec = struct { + it_interval struct { + tv_sec time_t + tv_nsec int64 + } + it_value struct { + tv_sec time_t + tv_nsec int64 + } +} /* time.h:80:1 */ + +type __ptcb = struct { + __f uintptr + __x uintptr + __next uintptr +} /* pthread.h:206:1 */ + +type useconds_t = uint32 /* alltypes.h:260:18 */ + +func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ + bp := tls.Alloc(1608) + defer tls.Free(1608) + + // var ports [2]service at bp, 8 + + // var addrs [48]address at bp+8, 1344 + + // var canon [256]int8 at bp+1352, 256 + + var outcanon uintptr + var nservs int32 + var naddrs int32 + var nais int32 + var canon_len int32 + var i int32 + var j int32 + var k int32 + var family int32 = 0 + var flags int32 = 0 + var proto int32 = 0 + var socktype int32 = 0 + var out uintptr + + if !(host != 0) && !(serv != 0) { + return -2 + } + + if hint != 0 { + family = (*addrinfo)(unsafe.Pointer(hint)).ai_family + flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags + proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol + socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype + + var mask int32 = ((((((0x01 | 0x02) | 0x04) | 0x08) | 0x10) | 0x20) | 0x400) + if (flags & mask) != flags { + return -1 + } + + switch family { + case 2: + fallthrough + case 10: + fallthrough + case 0: + break + fallthrough + default: + return -6 + } + } + + if (flags & 0x20) != 0 { + Xabort(tls) //TODO- + // /* Define the "an address is configured" condition for address + // * families via ability to create a socket for the family plus + // * routability of the loopback address for the family. */ + // static const struct sockaddr_in lo4 = { + // .sin_family = AF_INET, .sin_port = 65535, + // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN + // ? 0x7f000001 : 0x0100007f + // }; + // static const struct sockaddr_in6 lo6 = { + // .sin6_family = AF_INET6, .sin6_port = 65535, + // .sin6_addr = IN6ADDR_LOOPBACK_INIT + // }; + // int tf[2] = { AF_INET, AF_INET6 }; + // const void *ta[2] = { &lo4, &lo6 }; + // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; + // for (i=0; i<2; i++) { + // if (family==tf[1-i]) continue; + // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, + // IPPROTO_UDP); + // if (s>=0) { + // int cs; + // pthread_setcancelstate( + // PTHREAD_CANCEL_DISABLE, &cs); + // int r = connect(s, ta[i], tl[i]); + // pthread_setcancelstate(cs, 0); + // close(s); + // if (!r) continue; + // } + // switch (errno) { + // case EADDRNOTAVAIL: + // case EAFNOSUPPORT: + // case EHOSTUNREACH: + // case ENETDOWN: + // case ENETUNREACH: + // break; + // default: + // return EAI_SYSTEM; + // } + // if (family == tf[i]) return EAI_NONAME; + // family = tf[1-i]; + // } + } + + nservs = X__lookup_serv(tls, bp /* &ports[0] */, serv, proto, socktype, flags) + if nservs < 0 { + return nservs + } + + naddrs = X__lookup_name(tls, bp+8 /* &addrs[0] */, bp+1352 /* &canon[0] */, host, family, flags) + if naddrs < 0 { + return naddrs + } + + nais = (nservs * naddrs) + canon_len = int32(Xstrlen(tls, bp+1352 /* &canon[0] */)) + out = Xcalloc(tls, uint64(1), (((uint64(nais) * uint64(unsafe.Sizeof(aibuf{}))) + uint64(canon_len)) + uint64(1))) + if !(out != 0) { + return -10 + } + + if canon_len != 0 { + outcanon = (out + uintptr(nais)*88) + Xmemcpy(tls, outcanon, bp+1352 /* &canon[0] */, (uint64(canon_len + 1))) + } else { + outcanon = uintptr(0) + } + + for k = AssignInt32(&i, 0); i < naddrs; i++ { + j = 0 + __1: + if !(j < nservs) { + goto __3 + } + { + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k) + //TODO out[k].ai = (struct addrinfo){ + //TODO .ai_family = addrs[i].family, + //TODO .ai_socktype = ports[j].socktype, + //TODO .ai_protocol = ports[j].proto, + //TODO .ai_addrlen = addrs[i].family == AF_INET + //TODO ? sizeof(struct sockaddr_in) + //TODO : sizeof(struct sockaddr_in6), + //TODO .ai_addr = (void *)&out[k].sa, + //TODO .ai_canonname = outcanon }; + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 /* &addrs */ + uintptr(i)*28)).family + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp /* &ports */ + uintptr(j)*4)).socktype) + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp /* &ports */ + uintptr(j)*4)).proto) + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 { + if (*address)(unsafe.Pointer(bp+8 /* &addrs */ +uintptr(i)*28)).family == 2 { + return uint32(unsafe.Sizeof(sockaddr_in{})) + } + return uint32(unsafe.Sizeof(sockaddr_in6{})) + }() + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = (out + uintptr(k)*88 + 48 /* &.sa */) + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon + if k != 0 { + (*aibuf)(unsafe.Pointer(out + uintptr((k-1))*88)).ai.ai_next = (out + uintptr(k)*88 /* &.ai */) + } + switch (*address)(unsafe.Pointer(bp + 8 /* &addrs */ + uintptr(i)*28)).family { + case 2: + (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin_family = sa_family_t(2) + (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp /* &ports */ +uintptr(j)*4)).port) + Xmemcpy(tls, (out + uintptr(k)*88 + 48 /* &.sa */ /* &.sin */ + 4 /* &.sin_addr */), (bp + 8 /* &addrs */ + uintptr(i)*28 + 8 /* &.addr */), uint64(4)) + break + case 10: + (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin6_family = sa_family_t(10) + (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp /* &ports */ +uintptr(j)*4)).port) + (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 /* &addrs */ + uintptr(i)*28)).scopeid + Xmemcpy(tls, (out + uintptr(k)*88 + 48 /* &.sa */ /* &.sin6 */ + 8 /* &.sin6_addr */), (bp + 8 /* &addrs */ + uintptr(i)*28 + 8 /* &.addr */), uint64(16)) + break + } + + } + goto __2 + __2: + j++ + k++ + goto __1 + goto __3 + __3: + } + (*aibuf)(unsafe.Pointer(out)).ref = int16(nais) + *(*uintptr)(unsafe.Pointer(res)) = (out /* &.ai */) + return 0 +} + +type ucred = struct { + pid pid_t + uid uid_t + gid gid_t +} /* socket.h:57:1 */ + +type mmsghdr = struct { + msg_hdr struct { + msg_name uintptr + msg_namelen socklen_t + _ [4]byte + msg_iov uintptr + msg_iovlen int32 + __pad1 int32 + msg_control uintptr + msg_controllen socklen_t + __pad2 int32 + msg_flags int32 + _ [4]byte + } + msg_len uint32 + _ [4]byte +} /* socket.h:63:1 */ + +func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var size size_t = uint64(63) + // var res uintptr at bp, 8 + + var err int32 + for ok := true; ok; ok = (err == 34) { + Xfree(tls, _sh) + _sh = Xmalloc(tls, AssignAddUint64(&size, (size+uint64(1)))) + if !(_sh != 0) { + (*(*int32)(unsafe.Pointer(X__h_errno_location(tls)))) = 3 + return uintptr(0) + } + err = Xgethostbyaddr_r(tls, a, l, af, _sh, + (_sh + uintptr(1)*32), (size - size_t(unsafe.Sizeof(hostent{}))), bp /* &res */, X__h_errno_location(tls)) + } + if err != 0 { + return uintptr(0) + } + return _sh +} + +var _sh uintptr /* gethostbyaddr.c:9:24: */ + +func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ + return Xgethostbyname2(tls, name, 2) +} + +func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var size size_t = uint64(63) + // var res uintptr at bp, 8 + + var err int32 + for ok := true; ok; ok = (err == 34) { + Xfree(tls, _sh1) + _sh1 = Xmalloc(tls, AssignAddUint64(&size, (size+uint64(1)))) + if !(_sh1 != 0) { + (*(*int32)(unsafe.Pointer(X__h_errno_location(tls)))) = 3 + return uintptr(0) + } + err = Xgethostbyname2_r(tls, name, af, _sh1, + (_sh1 + uintptr(1)*32), (size - size_t(unsafe.Sizeof(hostent{}))), bp /* &res */, X__h_errno_location(tls)) + } + if err != 0 { + return uintptr(0) + } + return _sh1 +} + +var _sh1 uintptr /* gethostbyname2.c:10:24: */ + +func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */ + bp := tls.Alloc(1600) + defer tls.Free(1600) + + // var addrs [48]address at bp, 1344 + + // var canon [256]int8 at bp+1344, 256 + + var i int32 + var cnt int32 + var align size_t + var need size_t + + *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) + cnt = X__lookup_name(tls, bp /* &addrs[0] */, bp+1344 /* &canon[0] */, name, af, 0x02) + if cnt < 0 { + switch cnt { + case -2: + *(*int32)(unsafe.Pointer(err)) = 1 + return 2 + fallthrough + case -3: + *(*int32)(unsafe.Pointer(err)) = 2 + return 11 + fallthrough + default: + fallthrough + case -4: + *(*int32)(unsafe.Pointer(err)) = 3 + return 74 + fallthrough + case -10: + fallthrough + case -11: + *(*int32)(unsafe.Pointer(err)) = 3 + return *(*int32)(unsafe.Pointer(X___errno_location(tls))) + } + } + + (*hostent)(unsafe.Pointer(h)).h_addrtype = af + (*hostent)(unsafe.Pointer(h)).h_length = func() int32 { + if af == 10 { + return 16 + } + return 4 + }() + + // Align buffer + align = (-uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))) + + need = (uint64(4) * uint64(unsafe.Sizeof(uintptr(0)))) + need = need + ((uint64(cnt + 1)) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64((*hostent)(unsafe.Pointer(h)).h_length))) + need = need + (Xstrlen(tls, name) + uint64(1)) + need = need + (Xstrlen(tls, bp+1344 /* &canon[0] */) + uint64(1)) + need = need + (align) + + if need > buflen { + return 34 + } + + buf += uintptr(align) + (*hostent)(unsafe.Pointer(h)).h_aliases = buf + buf += (uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0))))) + (*hostent)(unsafe.Pointer(h)).h_addr_list = buf + buf += (uintptr((uint64(cnt + 1)) * uint64(unsafe.Sizeof(uintptr(0))))) + + for i = 0; i < cnt; i++ { + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf + buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length) + Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)), bp /* &addrs */ +uintptr(i)*28+8 /* &.addr */, uint64((*hostent)(unsafe.Pointer(h)).h_length)) + } + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0) + + (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf) + Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344 /* &canon[0] */) + buf += (uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1))) + + if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 { + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf + Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name) + buf += (uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1))) + } else { + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) + } + + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0) + + *(*uintptr)(unsafe.Pointer(res)) = h + return 0 +} + +type if_nameindex = struct { + if_index uint32 + _ [4]byte + if_name uintptr +} /* if.h:12:1 */ + +type ifaddr = struct { + ifa_addr struct { + sa_family sa_family_t + sa_data [14]int8 + } + ifa_ifu struct { + ifu_broadaddr struct { + sa_family sa_family_t + sa_data [14]int8 + } + } + ifa_ifp uintptr + ifa_next uintptr +} /* if.h:51:1 */ + +type ifmap = struct { + mem_start uint64 + mem_end uint64 + base_addr uint16 + irq uint8 + dma uint8 + port uint8 + _ [3]byte +} /* if.h:64:1 */ + +type ifreq = struct { + ifr_ifrn struct{ ifrn_name [16]int8 } + ifr_ifru struct { + _ [0]uint64 + ifru_addr struct { + sa_family sa_family_t + sa_data [14]int8 + } + _ [8]byte + } +} /* if.h:76:1 */ + +type ifconf = struct { + ifc_len int32 + _ [4]byte + ifc_ifcu struct{ ifcu_buf uintptr } +} /* if.h:116:1 */ + +type ns_sect = uint32 /* nameser.h:37:3 */ + +type __ns_msg = struct { + _msg uintptr + _eom uintptr + _id uint16_t + _flags uint16_t + _counts [4]uint16_t + _ [4]byte + _sections [4]uintptr + _sect ns_sect + _rrnum int32 + _msg_ptr uintptr +} /* nameser.h:39:9 */ + +type ns_msg = __ns_msg /* nameser.h:46:3 */ + +type _ns_flagdata = struct { + mask int32 + shift int32 +} /* nameser.h:48:1 */ + +type __ns_rr = struct { + name [1025]int8 + _ [1]byte + __type uint16_t + rr_class uint16_t + _ [2]byte + ttl uint32_t + rdlength uint16_t + _ [2]byte + rdata uintptr +} /* nameser.h:59:9 */ + +type ns_rr = __ns_rr /* nameser.h:66:3 */ + +type ns_flag = uint32 /* nameser.h:87:3 */ + +type ns_opcode = uint32 /* nameser.h:96:3 */ + +type ns_rcode = uint32 /* nameser.h:115:3 */ + +type ns_update_operation = uint32 /* nameser.h:121:3 */ + +type ns_tsig_key1 = struct { + name [1025]int8 + alg [1025]int8 + _ [6]byte + data uintptr + len int32 + _ [4]byte +} /* nameser.h:123:1 */ + +type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ + +type ns_tcp_tsig_state1 = struct { + counter int32 + _ [4]byte + key uintptr + ctx uintptr + sig [512]uint8 + siglen int32 + _ [4]byte +} /* nameser.h:130:1 */ + +type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ + +type ns_type = uint32 /* nameser.h:200:3 */ + +type ns_class = uint32 /* nameser.h:219:3 */ + +type ns_key_types = uint32 /* nameser.h:226:3 */ + +type ns_cert_types = uint32 /* nameser.h:234:3 */ + +type HEADER = struct { + _ [0]uint32 + id uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */ + qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ + nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ +} /* nameser.h:353:3 */ + +// unused; purely for broken apps +type __res_state = struct { + retrans int32 + retry int32 + options uint64 + nscount int32 + nsaddr_list [3]struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t + } + id uint16 + _ [2]byte + dnsrch [7]uintptr + defdname [256]int8 + pfcode uint64 + ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ + _ [4]byte + sort_list [10]struct { + addr struct{ s_addr in_addr_t } + mask uint32_t + } + qhook uintptr + rhook uintptr + res_h_errno int32 + _vcsock int32 + _flags uint32 + _ [4]byte + _u struct { + _ [0]uint64 + pad [52]int8 + _ [4]byte + } +} /* resolv.h:26:9 */ + +// unused; purely for broken apps +type res_state = uintptr /* resolv.h:62:3 */ + +type res_sym = struct { + number int32 + _ [4]byte + name uintptr + humanname uintptr +} /* resolv.h:70:1 */ + +func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ + p += (uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0))))) + *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0) + for ok := true; ok; ok = x != 0 { + *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = (int8(uint32('0') + (x % uint32(10)))) + x = x / (uint32(10)) + } + return p +} + +func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + Xsprintf(tls, s, ts+64, /* "%d.%d.%d.%d.in-a..." */ + VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) +} + +func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ + var i int32 + for i = 15; i >= 0; i-- { + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) & 15)] + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) >> 4)] + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') + } + Xstrcpy(tls, s, ts+89 /* "ip6.arpa" */) +} + +var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 98 /* "0123456789abcdef" */)) /* getnameinfo.c:36:20 */ + +func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ + bp := tls.Alloc(556) + defer tls.Free(556) + + // var line [512]int8 at bp+16, 512 + + var p uintptr + var z uintptr + var _buf [1032]uint8 + _ = _buf + // var atmp [16]uint8 at bp, 16 + + // var iplit address at bp+528, 28 + + //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); + var f uintptr = Xfopen(tls, ts+115 /* "/etc/hosts" */, ts+126 /* "rb" */) + if !(f != 0) { + return + } + if family == 2 { + Xmemcpy(tls, (bp /* &atmp[0] */ + uintptr(12)), a, uint64(4)) + Xmemcpy(tls, bp /* &atmp[0] */, ts+129 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) + a = bp /* &atmp[0] */ + } + for Xfgets(tls, bp+16 /* &line[0] */, int32(unsafe.Sizeof([512]int8{})), f) != 0 { + if AssignUintptr(&p, Xstrchr(tls, bp+16 /* &line[0] */, '#')) != 0 { + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') + *(*int8)(unsafe.Pointer(p)) = int8(0) + } + + for p = bp + 16; /* &line[0] */ (*(*int8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) + if X__lookup_ipliteral(tls, bp+528 /* &iplit */, bp+16 /* &line[0] */, 0) <= 0 { + continue + } + + if (*address)(unsafe.Pointer(bp+528 /* &iplit */)).family == 2 { + Xmemcpy(tls, ((bp + 528 /* &iplit */ + 8 /* &.addr */) + uintptr(12)), bp+528 /* &iplit */ +8 /* &.addr */, uint64(4)) + Xmemcpy(tls, bp+528 /* &iplit */ +8 /* &.addr */, ts+129 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) + (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0) + } + + if (Xmemcmp(tls, a, bp+528 /* &iplit */ +8 /* &.addr */, uint64(16)) != 0) || ((*address)(unsafe.Pointer(bp+528 /* &iplit */)).scopeid != scopeid) { + continue + } + + for ; (*(*int8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + for z = p; (*(*int8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { + } + *(*int8)(unsafe.Pointer(z)) = int8(0) + if ((int64(z) - int64(p)) / 1) < int64(256) { + Xmemcpy(tls, buf, p, (uint64(((int64(z) - int64(p)) / 1) + int64(1)))) + break + } + } + //TODO __fclose_ca(f); + Xfclose(tls, f) +} + +func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ + Xabort(tls) //TODO- + // unsigned long svport; + // char line[128], *p, *z; + // unsigned char _buf[1032]; + // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); + // if (!f) return; + // while (fgets(line, sizeof line, f)) { + // if ((p=strchr(line, '#'))) *p++='\n', *p=0; + + // for (p=line; *p && !isspace(*p); p++); + // if (!*p) continue; + // *p++ = 0; + // svport = strtoul(p, &z, 10); + + // if (svport != port || z==p) continue; + // if (dgram && strncmp(z, "/udp", 4)) continue; + // if (!dgram && strncmp(z, "/tcp", 4)) continue; + // if (p-line > 32) continue; + + // memcpy(buf, line, p-line); + // break; + // } + // __fclose_ca(f); +} + +var Xh_errno int32 /* h_errno.c:4:5: */ + +func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ + return uintptr(unsafe.Pointer(&Xh_errno)) +} + +func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var s uintptr = s0 + var d uintptr = dest + *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)} + // var z uintptr at bp+32, 8 + + var i int32 + + for i = 0; i < 4; i++ { + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32 /* &z */, 0) + if ((*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) == s) || ((*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)))) != 0) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != '.'))) || !(func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s)))) + } + return (Bool32(((uint32(*(*int8)(unsafe.Pointer(s)))) - uint32('0')) < uint32(10))) + }() != 0) { + return 0 + } + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != 0) { + break + } + s = (*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) + uintptr(1)) + } + if i == 4 { + return 0 + } + switch i { + case 0: + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */)) & uint64(0xffffff)) + AssignShrPtrUint64(bp /* &a */, int(24)) + fallthrough + case 1: + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) & uint64(0xffff)) + AssignShrPtrUint64(bp /* &a */ +1*8, int(16)) + fallthrough + case 2: + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 3*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) & uint64(0xff)) + AssignShrPtrUint64(bp /* &a */ +2*8, int(8)) + } + for i = 0; i < 4; i++ { + if *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) > uint64(255) { + return 0 + } + *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8))) + } + return 1 +} + +func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ + bp := tls.Alloc(276) + defer tls.Free(276) + + var a uintptr = a0 + var i int32 + var j int32 + var max int32 + var best int32 + // var buf [100]int8 at bp+176, 100 + + switch af { + case 2: + if socklen_t(Xsnprintf(tls, s, uint64(l), ts+142 /* "%d.%d.%d.%d" */, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { + return s + } + break + case 10: + if Xmemcmp(tls, a, ts+129 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { + Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]int8{})), + ts+154, /* "%x:%x:%x:%x:%x:%..." */ + VaList(bp+32, ((256*int32(*(*uint8)(unsafe.Pointer(a))))+int32(*(*uint8)(unsafe.Pointer(a + 1)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 2))))+int32(*(*uint8)(unsafe.Pointer(a + 3)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 4))))+int32(*(*uint8)(unsafe.Pointer(a + 5)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 6))))+int32(*(*uint8)(unsafe.Pointer(a + 7)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 8))))+int32(*(*uint8)(unsafe.Pointer(a + 9)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 10))))+int32(*(*uint8)(unsafe.Pointer(a + 11)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 12))))+int32(*(*uint8)(unsafe.Pointer(a + 13)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 14))))+int32(*(*uint8)(unsafe.Pointer(a + 15)))))) + } else { + Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]int8{})), + ts+178, /* "%x:%x:%x:%x:%x:%..." */ + VaList(bp+96, ((256*int32(*(*uint8)(unsafe.Pointer(a))))+int32(*(*uint8)(unsafe.Pointer(a + 1)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 2))))+int32(*(*uint8)(unsafe.Pointer(a + 3)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 4))))+int32(*(*uint8)(unsafe.Pointer(a + 5)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 6))))+int32(*(*uint8)(unsafe.Pointer(a + 7)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 8))))+int32(*(*uint8)(unsafe.Pointer(a + 9)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 10))))+int32(*(*uint8)(unsafe.Pointer(a + 11)))), + int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) + } + // Replace longest /(^0|:)[:0]{2,}/ with "::" + i = AssignInt32(&best, 0) + max = 2 + for ; *(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i))) != 0; i++ { + if (i != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i)))) != ':') { + continue + } + j = int32(Xstrspn(tls, (bp + 176 /* &buf[0] */ + uintptr(i)), ts+208 /* ":0" */)) + if j > max { + best = i + max = j + } + } + if max > 3 { + *(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(best))) = AssignPtrInt8(bp+176 /* &buf */ +uintptr((best+1)), int8(':')) + Xmemmove(tls, ((bp + 176 /* &buf[0] */ + uintptr(best)) + uintptr(2)), ((bp + 176 /* &buf[0] */ + uintptr(best)) + uintptr(max)), (uint64(((i - best) - max) + 1))) + } + if Xstrlen(tls, bp+176 /* &buf[0] */) < size_t(l) { + Xstrcpy(tls, s, bp+176 /* &buf[0] */) + return s + } + break + default: + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 97 + return uintptr(0) + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 28 + return uintptr(0) +} + +func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ + if (c - uint32('0')) < uint32(10) { + return (int32(c - uint32('0'))) + } + c = c | (uint32(32)) + if (c - uint32('a')) < uint32(6) { + return (int32((c - uint32('a')) + uint32(10))) + } + return -1 +} + +func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var ip [8]uint16_t at bp, 16 + + var a uintptr = a0 + var i int32 + var j int32 + var v int32 + var d int32 + var brk int32 = -1 + var need_v4 int32 = 0 + + if af == 2 { + for i = 0; i < 4; i++ { + for v = AssignInt32(&j, 0); (j < 3) && (func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) + } + return (Bool32(((uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - uint32('0')) < uint32(10))) + }() != 0); j++ { + v = (((10 * v) + int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - '0') + } + if ((j == 0) || ((j > 1) && (int32(*(*int8)(unsafe.Pointer(s))) == '0'))) || (v > 255) { + return 0 + } + *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) + if (int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0) && (i == 3) { + return 1 + } + if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' { + return 0 + } + s += (uintptr(j + 1)) + } + return 0 + } else if af != 10 { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 97 + return -1 + } + + if (int32(*(*int8)(unsafe.Pointer(s))) == ':') && (int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':') { + return 0 + } + + for i = 0; ; i++ { + if (int32(*(*int8)(unsafe.Pointer(s))) == ':') && (brk < 0) { + brk = i + *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((i&7))*2)) = uint16_t(0) + if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { + break + } + if i == 7 { + return 0 + } + continue + } + for v = AssignInt32(&j, 0); (j < 4) && ((AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))))) >= 0); j++ { + v = ((16 * v) + d) + } + if j == 0 { + return 0 + } + *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((i&7))*2)) = uint16_t(v) + if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && ((brk >= 0) || (i == 7)) { + break + } + if i == 7 { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' { + if (int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.') || ((i < 6) && (brk < 0)) { + return 0 + } + need_v4 = 1 + i++ + break + } + s += (uintptr(j + 1)) + } + if brk >= 0 { + Xmemmove(tls, (((bp /* &ip[0] */ + uintptr(brk)*2) + uintptr(7)*2) - uintptr(i)*2), (bp /* &ip[0] */ + uintptr(brk)*2), (uint64(2 * ((i + 1) - brk)))) + for j = 0; j < (7 - i); j++ { + *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((brk+j))*2)) = uint16_t(0) + } + } + for j = 0; j < 8; j++ { + *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = (uint8(int32(*(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr(j)*2))) >> 8)) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr(j)*2))) + } + if (need_v4 != 0) && (Xinet_pton(tls, 2, s, (a-uintptr(4))) <= 0) { + return 0 + } + return 1 +} + +func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + // var a4 in_addr at bp, 4 + + // var a6 in6_addr at bp+68, 16 + + if X__inet_aton(tls, name, bp /* &a4 */) > 0 { + if family == 10 { // wrong family + return -2 + } + Xmemcpy(tls, (buf + 8 /* &.addr */), bp /* &a4 */, uint64(unsafe.Sizeof(in_addr{}))) + (*address)(unsafe.Pointer(buf)).family = 2 + (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) + return 1 + } + // var tmp [64]int8 at bp+4, 64 + + var p uintptr = Xstrchr(tls, name, '%') + // var z uintptr at bp+88, 8 + + var scopeid uint64 = uint64(0) + if (p != 0) && (((int64(p) - int64(name)) / 1) < int64(64)) { + Xmemcpy(tls, bp+4 /* &tmp[0] */, name, (uint64((int64(p) - int64(name)) / 1))) + *(*int8)(unsafe.Pointer(bp + 4 /* &tmp[0] */ + uintptr(((int64(p) - int64(name)) / 1)))) = int8(0) + name = bp + 4 /* &tmp[0] */ + } + + if Xinet_pton(tls, 10, name, bp+68 /* &a6 */) <= 0 { + return 0 + } + if family == 2 { // wrong family + return -2 + } + + Xmemcpy(tls, (buf + 8 /* &.addr */), bp+68 /* &a6 */, uint64(unsafe.Sizeof(in6_addr{}))) + (*address)(unsafe.Pointer(buf)).family = 10 + if p != 0 { + if func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) + } + return (Bool32(((uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) - uint32('0')) < uint32(10))) + }() != 0 { + scopeid = Xstrtoull(tls, p, bp+88 /* &z */, 10) + } else { + *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = (p - uintptr(1)) + } + if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88 /* z */)))) != 0 { + Xabort(tls) //TODO- + // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && + // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) + // return EAI_NONAME; + // scopeid = if_nametoindex(p); + // if (!scopeid) return EAI_NONAME; + } + if scopeid > uint64(0xffffffff) { + return -2 + } + } + (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid) + return 1 +} + +type mode_t = uint32 /* alltypes.h:152:18 */ + +type flock = struct { + l_type int16 + l_whence int16 + _ [4]byte + l_start off_t + l_len off_t + l_pid pid_t + _ [4]byte +} /* fcntl.h:24:1 */ + +func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ + var s uintptr + //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; + if (Xstrnlen(tls, host, uint64(255)) - uint64(1)) >= uint64(254) { + return 0 + } + for s = host; (((int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80) || (int32(*(*uint8)(unsafe.Pointer(s))) == '.')) || (int32(*(*uint8)(unsafe.Pointer(s))) == '-')) || (Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0); s++ { + } + return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) +} + +var Xzero_struct_address address /* lookup_name.c:27:16: */ + +func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ + var cnt int32 = 0 + if name != 0 { + return 0 + } + if (flags & 0x01) != 0 { + //TODO if (family != AF_INET6) + //TODO buf[cnt++] = (struct address){ .family = AF_INET }; + if family != 10 { + var x = Xzero_struct_address + x.family = 2 + *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x + } + //TODO if (family != AF_INET) + //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; + if family != 2 { + var x = Xzero_struct_address + x.family = 10 + *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x + } + } else { + Xabort(tls) //TODO- + // if (family != AF_INET6) + // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; + // if (family != AF_INET) + // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; + } + return cnt +} + +func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ + return X__lookup_ipliteral(tls, buf, name, family) +} + +func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ + bp := tls.Alloc(512) + defer tls.Free(512) + + // var line [512]int8 at bp, 512 + + var l size_t = Xstrlen(tls, name) + var cnt int32 = 0 + var badfam int32 = 0 + var _buf [1032]uint8 + _ = _buf + //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); + var _f FILE + _ = _f + var f uintptr = Xfopen(tls, ts+115 /* "/etc/hosts" */, ts+126 /* "rb" */) + if !(f != 0) { + switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { + case 2: + fallthrough + case 20: + fallthrough + case 13: + return 0 + fallthrough + default: + return -11 + } + } + for (Xfgets(tls, bp /* &line[0] */, int32(unsafe.Sizeof([512]int8{})), f) != 0) && (cnt < 48) { + var p uintptr + var z uintptr + + if AssignUintptr(&p, Xstrchr(tls, bp /* &line[0] */, '#')) != 0 { + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') + *(*int8)(unsafe.Pointer(p)) = int8(0) + } + for p = (bp /* &line[0] */ + uintptr(1)); (AssignUintptr(&p, Xstrstr(tls, p, name)) != 0) && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { + } + if !(p != 0) { + continue + } + + // Isolate IP address to parse + for p = bp; /* &line[0] */ (*(*int8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) + switch name_from_numeric(tls, (buf + uintptr(cnt)*28), bp /* &line[0] */, family) { + case 1: + cnt++ + break + case 0: + continue + default: + badfam = -2 + continue + } + + // Extract first name as canonical name + for ; (*(*int8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + for z = p; (*(*int8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { + } + *(*int8)(unsafe.Pointer(z)) = int8(0) + if is_valid_hostname(tls, p) != 0 { + Xmemcpy(tls, canon, p, (uint64(((int64(z) - int64(p)) / 1) + int64(1)))) + } + } + //TODO __fclose_ca(f); + Xfclose(tls, f) + if cnt != 0 { + return cnt + } + return badfam +} + +type dpc_ctx = struct { + addrs uintptr + canon uintptr + cnt int32 + _ [4]byte +} /* lookup_name.c:112:1 */ + +func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ + return -1 //TODO- + Xabort(tls) + return int32(0) //TODO- + // char search[256]; + // struct resolvconf conf; + // size_t l, dots; + // char *p, *z; + + // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; + + // /* Count dots, suppress search when >=ndots or name ends in + // * a dot, which is an explicit request for global scope. */ + // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; + // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; + + // /* Strip final dot for canon, fail if multiple trailing dots. */ + // if (name[l-1]=='.') l--; + // if (!l || name[l-1]=='.') return EAI_NONAME; + + // /* This can never happen; the caller already checked length. */ + // if (l >= 256) return EAI_NONAME; + + // /* Name with search domain appended is setup in canon[]. This both + // * provides the desired default canonical name (if the requested + // * name is not a CNAME record) and serves as a buffer for passing + // * the full requested name to name_from_dns. */ + // memcpy(canon, name, l); + // canon[l] = '.'; + + // for (p=search; *p; p=z) { + // for (; isspace(*p); p++); + // for (z=p; *z && !isspace(*z); z++); + // if (z==p) break; + // if (z-p < 256 - l - 1) { + // memcpy(canon+l+1, p, z-p); + // canon[z-p+1+l] = 0; + // int cnt = name_from_dns(buf, canon, canon, family, &conf); + // if (cnt) return cnt; + // } + // } + + // canon[l] = 0; + // return name_from_dns(buf, canon, name, family, &conf); +} + +type policy = struct { + addr [16]uint8 + len uint8 + mask uint8 + prec uint8 + label uint8 +} /* lookup_name.c:237:14 */ + +var defpolicy = [6]policy{ + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 211 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" */)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 228 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00" */)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 244 /* " \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 260 /* " \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 276 /* "\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)}, + // Last rule must match all addresses to stop loop. + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 292 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), prec: uint8(40), label: uint8(1)}, +} /* lookup_name.c:241:3 */ + +func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ + var i int32 + for i = 0; ; i++ { + if Xmemcmp(tls, a /* &.__in6_union */ /* &.__s6_addr */, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20 /* &.addr */, uint64(defpolicy[i].len)) != 0 { + continue + } + if (int32(*(*uint8_t)(unsafe.Pointer((a /* &.__in6_union */ /* &.__s6_addr */) + uintptr(defpolicy[i].len)))) & int32(defpolicy[i].mask)) != + int32(*(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 /* &.addr */) + uintptr(defpolicy[i].len)))) { + continue + } + return (uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20) + } + return uintptr(0) +} + +func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ + return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label) +} + +func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ + if int32(*(*uint8_t)(unsafe.Pointer((a)))) == 0xff { + return (int32(*(*uint8_t)(unsafe.Pointer((a /* &.__in6_union */ /* &.__s6_addr */) + 1))) & 15) + } + if ((int32(*(*uint8_t)(unsafe.Pointer((a))))) == 0xfe) && ((int32(*(*uint8_t)(unsafe.Pointer((a) + 1))) & 0xc0) == 0x80) { + return 2 + } + if ((((((*(*uint32_t)(unsafe.Pointer((a))) == uint32_t(0)) && (*(*uint32_t)(unsafe.Pointer((a) + 1*4)) == uint32_t(0))) && (*(*uint32_t)(unsafe.Pointer((a) + 2*4)) == uint32_t(0))) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 12))) == 0)) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 13))) == 0)) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 14))) == 0)) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 15))) == 1) { + return 2 + } + if ((int32(*(*uint8_t)(unsafe.Pointer((a))))) == 0xfe) && ((int32(*(*uint8_t)(unsafe.Pointer((a) + 1))) & 0xc0) == 0xc0) { + return 5 + } + return 14 +} + +func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ + // FIXME: The common prefix length should be limited to no greater + // than the nominal length of the prefix portion of the source + // address. However the definition of the source prefix length is + // not clear and thus this limiting is not yet implemented. + var i uint32 + for i = uint32(0); (i < uint32(128)) && !(((int32(*(*uint8_t)(unsafe.Pointer((s /* &.__in6_union */ /* &.__s6_addr */) + uintptr((i / uint32(8)))))) ^ int32(*(*uint8_t)(unsafe.Pointer((d /* &.__in6_union */ /* &.__s6_addr */) + uintptr((i / uint32(8))))))) & (int32(128) >> (i % uint32(8)))) != 0); i++ { + } + return int32(i) +} + +func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ + var a uintptr = _a + var b uintptr = _b + return ((*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey) +} + +func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ + bp := tls.Alloc(92) + defer tls.Free(92) + + var cnt int32 = 0 + var i int32 + var j int32 + _ = j + + *(*int8)(unsafe.Pointer(canon)) = int8(0) + if name != 0 { + // reject empty name and check len so it fits into temp bufs + var l size_t = Xstrnlen(tls, name, uint64(255)) + if (l - uint64(1)) >= uint64(254) { + return -2 + } + Xmemcpy(tls, canon, name, (l + uint64(1))) + } + + // Procedurally, a request for v6 addresses with the v4-mapped + // flag set is like a request for unspecified family, followed + // by filtering of the results. + if (flags & 0x08) != 0 { + if family == 10 { + family = 0 + } else { + flags = flags - (0x08) + } + } + + // Try each backend until there's at least one result. + cnt = name_from_null(tls, buf, name, family, flags) + if !(cnt != 0) { + cnt = name_from_numeric(tls, buf, name, family) + } + if !(cnt != 0) && !((flags & 0x04) != 0) { + cnt = name_from_hosts(tls, buf, canon, name, family) + if !(cnt != 0) { + cnt = name_from_dns_search(tls, buf, canon, name, family) + } + } + if cnt <= 0 { + if cnt != 0 { + return cnt + } + return -2 + } + + // Filter/transform results for v4-mapped lookup, if requested. + if (flags & 0x08) != 0 { + Xabort(tls) //TODO- + // if (!(flags & AI_ALL)) { + // /* If any v6 results exist, remove v4 results. */ + // for (i=0; i= 0 { + if !(Xconnect(tls, fd, da, dalen) != 0) { + key = key | (0x40000000) + if !(Xgetsockname(tls, fd, sa1, bp+88 /* &salen */) != 0) { + if family == 2 { + Xmemcpy(tls, + ((bp + 28 /* &sa6 */ + 8 /* &.sin6_addr */ /* &.__in6_union */ /* &.__s6_addr */) + uintptr(12)), + (bp + 72 /* &sa4 */ + 4 /* &.sin_addr */), uint64(4)) + } + if dscope == scopeof(tls, (bp+28 /* &sa6 */ +8 /* &.sin6_addr */)) { + key = key | (0x20000000) + } + if dlabel == labelof(tls, (bp+28 /* &sa6 */ +8 /* &.sin6_addr */)) { + key = key | (0x10000000) + } + prefixlen = prefixmatch(tls, (bp + 28 /* &sa6 */ + 8 /* &.sin6_addr */), + (bp /* &da6 */ + 8 /* &.sin6_addr */)) + } + } + Xclose(tls, fd) + } + key = key | (dprec << 20) + key = key | ((15 - dscope) << 16) + key = key | (prefixlen << 8) + key = key | ((48 - i) << 0) + (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key + } + Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { + f func(*TLS, uintptr, uintptr) int32 + }{addrcmp}))) + + //TODO pthread_setcancelstate(cs, 0); + + return cnt +} + +func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var line [128]int8 + _ = line + var cnt int32 = 0 + var p uintptr + _ = p + *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 54 /* "" */ + var port uint64 = uint64(0) + + switch socktype { + case 1: + switch proto { + case 0: + proto = 6 + fallthrough + case 6: + break + default: + return -8 + } + break + case 2: + switch proto { + case 0: + proto = 17 + fallthrough + case 17: + break + default: + return -8 + } + fallthrough + case 0: + break + default: + if name != 0 { + return -8 + } + (*service)(unsafe.Pointer(buf)).port = uint16_t(0) + (*service)(unsafe.Pointer(buf)).proto = uint8(proto) + (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype) + return 1 + } + + if name != 0 { + if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) { + return -8 + } + port = Xstrtoul(tls, name, bp /* &z */, 10) + } + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* z */))))) != 0) { + if port > uint64(65535) { + return -8 + } + if proto != 17 { + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1) + (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6) + } + if proto != 6 { + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2) + (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17) + } + return cnt + } + + if (flags & 0x400) != 0 { + return -2 + } + + var l size_t = Xstrlen(tls, name) + _ = l + + Xabort(tls) //TODO- + // unsigned char _buf[1032]; + // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); + // if (!f) switch (errno) { + // case ENOENT: + // case ENOTDIR: + // case EACCES: + // return EAI_SERVICE; + // default: + // return EAI_SYSTEM; + // } + + Xabort(tls) //TODO- + // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { + // if ((p=strchr(line, '#'))) *p++='\n', *p=0; + + // /* Find service name */ + // for(p=line; (p=strstr(p, name)); p++) { + // if (p>line && !isspace(p[-1])) continue; + // if (p[l] && !isspace(p[l])) continue; + // break; + // } + // if (!p) continue; + + // /* Skip past canonical name at beginning of line */ + // for (p=line; *p && !isspace(*p); p++); + + // port = strtoul(p, &z, 10); + // if (port > 65535 || z==p) continue; + // if (!strncmp(z, "/udp", 4)) { + // if (proto == IPPROTO_TCP) continue; + // buf[cnt].port = port; + // buf[cnt].socktype = SOCK_DGRAM; + // buf[cnt++].proto = IPPROTO_UDP; + // } + // if (!strncmp(z, "/tcp", 4)) { + // if (proto == IPPROTO_UDP) continue; + // buf[cnt].port = port; + // buf[cnt].socktype = SOCK_STREAM; + // buf[cnt++].proto = IPPROTO_TCP; + // } + // } + // __fclose_ca(f); + // return cnt > 0 ? cnt : EAI_SERVICE; + Xabort(tls) + return int32(0) //TODO- +} + +func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ + *(*int32)(unsafe.Pointer(f + 136 /* &.mode */)) |= ((*FILE)(unsafe.Pointer(f)).mode - 1) + if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { + (*(*func(*TLS, uintptr, uintptr, size_t) size_t)(unsafe.Pointer((f + 72 /* &.write */))))(tls, f, uintptr(0), uint64(0)) + } + (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56 /* &.wbase */, AssignPtrUintptr(f+32 /* &.wend */, uintptr(0))) + if ((*FILE)(unsafe.Pointer(f)).flags & uint32(4)) != 0 { + *(*uint32)(unsafe.Pointer(f /* &.flags */)) |= (uint32(32)) + return -1 + } + (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16 /* &.rend */, ((*FILE)(unsafe.Pointer(f)).buf + uintptr((*FILE)(unsafe.Pointer(f)).buf_size))) + if ((*FILE)(unsafe.Pointer(f)).flags & uint32(16)) != 0 { + return -1 + } + return 0 +} + +func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ + X__builtin_abort(tls) //TODO- + // __stdio_exit_needed(); +} + +// This function assumes it will never be called if there is already +// data buffered for reading. + +func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ + bp := tls.Alloc(1) + defer tls.Free(1) + + // var c uint8 at bp, 1 + + if !(X__toread(tls, f) != 0) && ((*(*func(*TLS, uintptr, uintptr, size_t) size_t)(unsafe.Pointer((f + 64 /* &.read */))))(tls, f, bp /* &c */, uint64(1)) == uint64(1)) { + return int32(*(*uint8)(unsafe.Pointer(bp /* c */))) + } + return -1 +} + +func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + // var f FILE at bp, 232 + + (*FILE)(unsafe.Pointer(bp /* &f */)).buf = AssignPtrUintptr(bp /* &f */ +8 /* &.rpos */, s) + (*FILE)(unsafe.Pointer(bp /* &f */)).rend = UintptrFromInt32(-1) + X__shlim(tls, bp /* &f */, int64(0)) + var y float64 = X__floatscan(tls, bp /* &f */, prec, 1) + var cnt off_t = ((*FILE)(unsafe.Pointer((bp /* &f */))).shcnt + ((int64((*FILE)(unsafe.Pointer((bp /* &f */))).rpos) - int64((*FILE)(unsafe.Pointer((bp /* &f */))).buf)) / 1)) + if p != 0 { + *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { + if cnt != 0 { + return (s + uintptr(cnt)) + } + return s + }() + } + return y +} + +func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ + return float32(strtox(tls, s, p, 0)) +} + +func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ + return strtox(tls, s, p, 1) +} + +func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ + return strtox(tls, s, p, 2) +} + +func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + // var f FILE at bp, 232 + + (*FILE)(unsafe.Pointer(bp /* &f */)).buf = AssignPtrUintptr(bp /* &f */ +8 /* &.rpos */, s) + (*FILE)(unsafe.Pointer(bp /* &f */)).rend = UintptrFromInt32(-1) + X__shlim(tls, bp /* &f */, int64(0)) + var y uint64 = X__intscan(tls, bp /* &f */, uint32(base), 1, lim) + if p != 0 { + var cnt size_t = (size_t((*FILE)(unsafe.Pointer((bp /* &f */))).shcnt + ((int64((*FILE)(unsafe.Pointer((bp /* &f */))).rpos) - int64((*FILE)(unsafe.Pointer((bp /* &f */))).buf)) / 1))) + *(*uintptr)(unsafe.Pointer(p)) = (s + uintptr(cnt)) + } + return y +} + +func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ + return strtox1(tls, s, p, base, ((2 * uint64(0x7fffffffffffffff)) + uint64(1))) +} + +func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ + return int64(strtox1(tls, s, p, base, (Uint64FromInt64(-0x7fffffffffffffff - int64(1))))) +} + +func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */ + return uint64(strtox1(tls, s, p, base, ((2 * uint64(0x7fffffffffffffff)) + uint64(1)))) +} + +func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */ + return int64(strtox1(tls, s, p, base, (0 + (Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff)) - Int64FromInt32(1)))))) +} + +func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ + return intmax_t(Xstrtoll(tls, s, p, base)) +} + +func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ + return uintmax_t(Xstrtoull(tls, s, p, base)) +} + +func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ + var l size_t = Xstrlen(tls, s) + var d uintptr = Xmalloc(tls, (l + uint64(1))) + if !(d != 0) { + return uintptr(0) + } + return Xmemcpy(tls, d, s, (l + uint64(1))) +} + +func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ + var p uintptr = Xmemchr(tls, s, 0, n) + if p != 0 { + return (uint64((int64(p) - int64(s)) / 1)) + } + return n +} + +func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var a uintptr = s + *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} + + if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { + return uint64(0) + } + if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { + for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { + } + return (size_t((int64(s) - int64(a)) / 1)) + } + + for ; (*(*int8)(unsafe.Pointer(c)) != 0) && (AssignOrPtrUint64(bp /* &byteset */ +uintptr(((size_t(*(*uint8)(unsafe.Pointer(c))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8, (size_t(uint64(1))<<((size_t(*(*uint8)(unsafe.Pointer(c))))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))) != 0); c++ { + } + for ; (*(*int8)(unsafe.Pointer(s)) != 0) && ((*(*size_t)(unsafe.Pointer(bp /* &byteset[0] */ + uintptr(((size_t(*(*uint8)(unsafe.Pointer(s))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8)) & (size_t(uint64(1)) << ((size_t(*(*uint8)(unsafe.Pointer(s)))) % (uint64(8) * uint64(unsafe.Sizeof(size_t(0))))))) != 0); s++ { + } + return (size_t((int64(s) - int64(a)) / 1)) +} + +func init() { + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_CurrentRuneLocale)) + 0)) = uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) // table.cpp.c:4092:41: +} + +var ts1 = "RuneMagi\x00NONE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_linux_386.go b/vendor/modernc.org/libc/musl_linux_386.go index a8e3ddc0..51ae3635 100644 --- a/vendor/modernc.org/libc/musl_linux_386.go +++ b/vendor/modernc.org/libc/musl_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c', DO NOT EDIT. +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. package libc @@ -351,6 +351,12 @@ const ( /* nameser.h:98:1: */ ns_r_badtime = 18 ) +const ( /* pthread_impl.h:58:1: */ + DT_EXITING = 0 + DT_JOINABLE = 1 + DT_DETACHED = 2 +) + type ptrdiff_t = int32 /* :3:26 */ type size_t = uint32 /* :9:23 */ @@ -361,6 +367,8 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ return (Bool32((_c == ' ') || ((uint32(_c) - uint32('\t')) < uint32(5)))) } +type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:366:9 */ + type locale_t = uintptr /* alltypes.h:366:32 */ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ @@ -671,6 +679,44 @@ func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ return *(*uint64)(unsafe.Pointer(bp /* &__u */)) } +type __pthread = struct { + self uintptr + dtv uintptr + prev uintptr + next uintptr + sysinfo uintptr_t + canary uintptr_t + canary2 uintptr_t + tid int32 + errno_val int32 + detach_state int32 + cancel int32 + canceldisable uint8 + cancelasync uint8 + tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */ + _ [1]byte + map_base uintptr + map_size size_t + stack uintptr + stack_size size_t + guard_size size_t + result uintptr + cancelbuf uintptr + tsd uintptr + robust_list struct { + head uintptr + off int32 + pending uintptr + } + timer_id int32 + locale locale_t + killlock [1]int32 + dlerror_buf uintptr + stdio_locks uintptr + canary_at_end uintptr_t + dtv_copy uintptr +} /* alltypes.h:296:9 */ + func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ var c int32 var x int32 @@ -1847,6 +1893,34 @@ func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ return X__builtin_nanf(tls, ts+13 /* "" */) } +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ bp := tls.Alloc(8) defer tls.Free(8) @@ -1887,6 +1961,1480 @@ func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ return Xscalbn(tls, x, n) } +// Upper 6 state bits are a negative integer offset to bound-check next byte +// equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f + +// Interval [a,b). Either a must be 80 or b must be c0, lower 3 bits clear. + +// Arbitrary encoding for representing code units instead of characters. + +// Get inline definition of MB_CUR_MAX. + +type lconv = struct { + decimal_point uintptr + thousands_sep uintptr + grouping uintptr + int_curr_symbol uintptr + currency_symbol uintptr + mon_decimal_point uintptr + mon_thousands_sep uintptr + mon_grouping uintptr + positive_sign uintptr + negative_sign uintptr + int_frac_digits int8 + frac_digits int8 + p_cs_precedes int8 + p_sep_by_space int8 + n_cs_precedes int8 + n_sep_by_space int8 + p_sign_posn int8 + n_sign_posn int8 + int_p_cs_precedes int8 + int_p_sep_by_space int8 + int_n_cs_precedes int8 + int_n_sep_by_space int8 + int_p_sign_posn int8 + int_n_sign_posn int8 + _ [2]byte +} /* locale.h:24:1 */ + +// Support signed or unsigned plain-char + +// Implementation choices... + +// Arbitrary numbers... + +// POSIX/SUS requirements follow. These numbers come directly +// from SUS and have nothing to do with the host system. + +type __locale_map = struct { + __map uintptr + map_size size_t + name [24]int8 + next uintptr +} /* alltypes.h:366:9 */ + +type tls_module = struct { + next uintptr + image uintptr + len size_t + size size_t + align size_t + offset size_t +} /* libc.h:14:1 */ + +type __libc = struct { + can_do_threads int8 + threaded int8 + secure int8 + need_locks int8 + threads_minus_1 int32 + auxv uintptr + tls_head uintptr + tls_size size_t + tls_align size_t + tls_cnt size_t + page_size size_t + global_locale struct{ cat [6]uintptr } +} /* libc.h:20:1 */ + +type time_t = int64 /* alltypes.h:108:16 */ + +type clockid_t = int32 /* alltypes.h:237:13 */ + +type timespec = struct { + tv_sec time_t + tv_nsec int32 + __12 uint32 /* int : 32 */ +} /* alltypes.h:252:1 */ + +type pthread_t = uintptr /* alltypes.h:296:26 */ + +type pthread_once_t = int32 /* alltypes.h:302:13 */ + +type pthread_key_t = uint32 /* alltypes.h:307:18 */ + +type pthread_spinlock_t = int32 /* alltypes.h:312:13 */ + +type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:317:37 */ + +type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:322:37 */ + +type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:327:37 */ + +type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:332:40 */ + +type __sigset_t = struct{ __bits [32]uint32 } /* alltypes.h:372:9 */ + +type sigset_t = __sigset_t /* alltypes.h:372:71 */ + +type pthread_attr_t = struct{ __u struct{ __i [9]int32 } } /* alltypes.h:395:147 */ + +type pthread_mutex_t = struct{ __u struct{ __i [6]int32 } } /* alltypes.h:400:157 */ + +type pthread_cond_t = struct{ __u struct{ __i [12]int32 } } /* alltypes.h:410:112 */ + +type pthread_rwlock_t = struct{ __u struct{ __i [8]int32 } } /* alltypes.h:420:139 */ + +type pthread_barrier_t = struct{ __u struct{ __i [5]int32 } } /* alltypes.h:425:137 */ + +type sched_param = struct { + sched_priority int32 + __reserved1 int32 + __reserved2 [4]int32 + __reserved3 int32 +} /* sched.h:19:1 */ + +type timer_t = uintptr /* alltypes.h:232:14 */ + +type clock_t = int32 /* alltypes.h:242:14 */ + +type tm = struct { + tm_sec int32 + tm_min int32 + tm_hour int32 + tm_mday int32 + tm_mon int32 + tm_year int32 + tm_wday int32 + tm_yday int32 + tm_isdst int32 + tm_gmtoff int32 + tm_zone uintptr +} /* time.h:38:1 */ + +type itimerspec = struct { + it_interval struct { + tv_sec time_t + tv_nsec int32 + __12 uint32 /* int : 32 */ + } + it_value struct { + tv_sec time_t + tv_nsec int32 + __12 uint32 /* int : 32 */ + } +} /* time.h:80:1 */ + +type sigevent = struct { + sigev_value struct{ sival_int int32 } + sigev_signo int32 + sigev_notify int32 + sigev_notify_function uintptr + sigev_notify_attributes uintptr + __pad [44]int8 +} /* time.h:107:1 */ + +type __ptcb = struct { + __f uintptr + __x uintptr + __next uintptr +} /* alltypes.h:296:9 */ + +type sigaltstack = struct { + ss_sp uintptr + ss_flags int32 + ss_size size_t +} /* signal.h:44:9 */ + +type stack_t = sigaltstack /* signal.h:44:28 */ + +type greg_t = int32 /* signal.h:51:13 */ +type gregset_t = [19]int32 /* signal.h:51:21 */ +type _fpstate = struct { + cw uint32 + sw uint32 + tag uint32 + ipoff uint32 + cssel uint32 + dataoff uint32 + datasel uint32 + _st [8]struct { + significand [4]uint16 + exponent uint16 + } + status uint32 +} /* signal.h:52:9 */ + +type fpregset_t = uintptr /* signal.h:58:3 */ +type sigcontext = struct { + gs uint16 + __gsh uint16 + fs uint16 + __fsh uint16 + es uint16 + __esh uint16 + ds uint16 + __dsh uint16 + edi uint32 + esi uint32 + ebp uint32 + esp uint32 + ebx uint32 + edx uint32 + ecx uint32 + eax uint32 + trapno uint32 + err uint32 + eip uint32 + cs uint16 + __csh uint16 + eflags uint32 + esp_at_signal uint32 + ss uint16 + __ssh uint16 + fpstate uintptr + oldmask uint32 + cr2 uint32 +} /* signal.h:59:1 */ + +type mcontext_t = struct { + gregs gregset_t + fpregs fpregset_t + oldmask uint32 + cr2 uint32 +} /* signal.h:73:3 */ + +type __ucontext = struct { + uc_flags uint32 + uc_link uintptr + uc_stack stack_t + uc_mcontext mcontext_t + uc_sigmask sigset_t + __fpregs_mem [28]uint32 +} /* signal.h:86:9 */ + +type ucontext_t = __ucontext /* signal.h:93:3 */ + +type sigval = struct{ sival_int int32 } /* time.h:107:1 */ + +type siginfo_t = struct { + si_signo int32 + si_errno int32 + si_code int32 + __si_fields struct { + _ [0]uint32 + __pad [116]int8 + } +} /* signal.h:145:3 */ + +type sigaction = struct { + __sa_handler struct{ sa_handler uintptr } + sa_mask sigset_t + sa_flags int32 + sa_restorer uintptr +} /* signal.h:167:1 */ + +type sig_t = uintptr /* signal.h:251:14 */ + +type sig_atomic_t = int32 /* signal.h:269:13 */ + +func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:2:19: */ + panic(`arch/i386/atomic_arch.h:4:2: assembler statements not supported`) + return t +} + +func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic_arch.h:11:19: */ + panic(`arch/i386/atomic_arch.h:13:2: assembler statements not supported`) + return v +} + +func a_and(tls *TLS, p uintptr, v int32) { /* atomic_arch.h:29:20: */ + panic(`arch/i386/atomic_arch.h:31:2: assembler statements not supported`) +} + +func a_or(tls *TLS, p uintptr, v int32) { /* atomic_arch.h:37:20: */ + panic(`arch/i386/atomic_arch.h:39:2: assembler statements not supported`) +} + +func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic_arch.h:87:19: */ + var r int32 + panic(`arch/i386/atomic_arch.h:90:2: assembler statements not supported`) + return r +} + +func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic_arch.h:96:19: */ + var r int32 + panic(`arch/i386/atomic_arch.h:99:2: assembler statements not supported`) + return r +} + +func a_clz_32(tls *TLS, x uint32_t) int32 { /* atomic_arch.h:104:19: */ + panic(`arch/i386/atomic_arch.h:106:2: assembler statements not supported`) + return int32(x) +} + +func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ v uint64_t })(unsafe.Pointer(bp /* u */)) = struct{ v uint64_t }{v: v} + if *(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */))) != 0 { + a_or(tls, AtomicLoadUintptr(&p), int32(*(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */))))) + } + if *(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */) + 1*4)) != 0 { + a_or(tls, (AtomicLoadUintptr(&p) + uintptr(1)*4), int32(*(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */) + 1*4)))) + } +} + +type a_cas_p_undefined_but_pointer_not_32bit = [1]int8 /* atomic.h:229:14 */ + +type __timer = struct { + timerid int32 + thread pthread_t +} /* pthread_impl.h:64:1 */ + +func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */ + var self uintptr + panic(`arch/i386/pthread_arch.h:4:2: assembler statements not supported`) + return self +} + +func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */ + if priv != 0 { + priv = 128 + } + if cnt < 0 { + cnt = 0x7fffffff + } + _ = (Bool32((X__syscall3(tls, 240, int32(AtomicLoadUintptr(&addr)), (int32(1|priv)), int32(cnt)) != -38) || (X__syscall3(tls, 240, int32(AtomicLoadUintptr(&addr)), 1, int32(cnt)) != 0))) +} + +func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ + if priv != 0 { + priv = 128 + } + _ = (Bool32((X__syscall4(tls, 240, int32(AtomicLoadUintptr(&addr)), (int32(0|priv)), int32(val), 0) != -38) || (X__syscall4(tls, 240, int32(AtomicLoadUintptr(&addr)), 0, int32(val), 0) != 0))) +} + +var X__fsmu8 = [51]uint32_t{ + func() uint32 { + if 0x2 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x2)) + }(), func() uint32 { + if 0x3 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x3)) + }(), func() uint32 { + if 0x4 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x4)) + }(), func() uint32 { + if 0x5 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x5)) + }(), func() uint32 { + if 0x6 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x6)) + }(), func() uint32 { + if 0x7 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x7)) + }(), + func() uint32 { + if 0x8 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x8)) + }(), func() uint32 { + if 0x9 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x9)) + }(), func() uint32 { + if 0xa < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xa)) + }(), func() uint32 { + if 0xb < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xb)) + }(), func() uint32 { + if 0xc < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xc)) + }(), func() uint32 { + if 0xd < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xd)) + }(), func() uint32 { + if 0xe < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xe)) + }(), func() uint32 { + if 0xf < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xf)) + }(), + func() uint32 { + if (0x0 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x0 + 16))) + }(), func() uint32 { + if (0x1 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x1 + 16))) + }(), func() uint32 { + if (0x2 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x2 + 16))) + }(), func() uint32 { + if (0x3 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x3 + 16))) + }(), func() uint32 { + if (0x4 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x4 + 16))) + }(), func() uint32 { + if (0x5 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x5 + 16))) + }(), func() uint32 { + if (0x6 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x6 + 16))) + }(), func() uint32 { + if (0x7 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x7 + 16))) + }(), + func() uint32 { + if (0x8 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x8 + 16))) + }(), func() uint32 { + if (0x9 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x9 + 16))) + }(), func() uint32 { + if (0xa + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xa + 16))) + }(), func() uint32 { + if (0xb + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xb + 16))) + }(), func() uint32 { + if (0xc + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xc + 16))) + }(), func() uint32 { + if (0xd + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xd + 16))) + }(), func() uint32 { + if (0xe + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xe + 16))) + }(), func() uint32 { + if (0xf + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xf + 16))) + }(), + (((func() uint32 { + if 0x0 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x0 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x0)), (((func() uint32 { + if 0x1 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x1 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x1)), (((func() uint32 { + if 0x2 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x2 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x2)), (((func() uint32 { + if 0x3 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x3 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x3)), (((func() uint32 { + if 0x4 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x4 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x4)), (((func() uint32 { + if 0x5 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x5 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x5)), (((func() uint32 { + if 0x6 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x6 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x6)), (((func() uint32 { + if 0x7 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x7 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x7)), + (((func() uint32 { + if 0x8 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x8 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x8)), (((func() uint32 { + if 0x9 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x9 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x9)), (((func() uint32 { + if 0xa == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xa == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xa)), (((func() uint32 { + if 0xb == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xb == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xb)), (((func() uint32 { + if 0xc == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xc == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xc)), (((func() uint32 { + if 0xd == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xd == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xd)), (((func() uint32 { + if 0xe == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xe == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xe)), (((func() uint32 { + if 0xf == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xf == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xf)), + ((((func() uint32 { + if 0x0 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x0 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x0 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x0)), ((((func() uint32 { + if 0x1 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x1 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x1 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x1)), ((((func() uint32 { + if 0x2 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x2 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x2 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x2)), ((((func() uint32 { + if 0x3 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x3 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x3 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x3)), ((((func() uint32 { + if 0x4 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x4 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x4 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x4)), +} /* internal.c:18:16 */ + +type wint_t = uint32 /* alltypes.h:221:18 */ + +type wctype_t = uint32 /* alltypes.h:226:23 */ + +type __mbstate_t = struct { + __opaque1 uint32 + __opaque2 uint32 +} /* alltypes.h:360:9 */ + +type mbstate_t = __mbstate_t /* alltypes.h:360:63 */ + +func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var c uint32 + var s uintptr + var N uint32 + // var dummy wchar_t at bp, 4 + s = src + N = n + + if !(!(st != 0)) { + goto __1 + } + st = uintptr(unsafe.Pointer(&_sinternal_state)) +__1: + ; + c = *(*uint32)(unsafe.Pointer(st)) + + if !(!(s != 0)) { + goto __2 + } + if !(c != 0) { + goto __4 + } + goto ilseq +__4: + ; + return size_t(0) + goto __3 +__2: + if !(!(wc != 0)) { + goto __5 + } + wc = bp /* &dummy */ +__5: + ; +__3: + ; + + if !(!(n != 0)) { + goto __6 + } + return Uint32FromInt32(-2) +__6: + ; + if !(!(c != 0)) { + goto __7 + } + if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) { + goto __8 + } + return BoolUint32(!(!(int32(AssignPtrInt32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s))))) != 0))) +__8: + ; + if !((func() int32 { + if !(!(int32(*(*uintptr)(unsafe.Pointer(((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale /* &.cat */)))) != 0)) { + return 4 + } + return 1 + }()) == 1) { + goto __9 + } + *(*wchar_t)(unsafe.Pointer(wc)) = (wchar_t(0xdfff & int32((int8(*(*uint8)(unsafe.Pointer(s))))))) + return 1 +__9: + ; + if !((uint32(*(*uint8)(unsafe.Pointer(s))) - 0xc2) > (0xf4 - 0xc2)) { + goto __10 + } + goto ilseq +__10: + ; + c = X__fsmu8[(uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1)))) - 0xc2)] + n-- +__7: + ; + + if !(n != 0) { + goto __11 + } + if !((((((int32(*(*uint8)(unsafe.Pointer(s)))) >> 3) - 0x10) | (((int32(*(*uint8)(unsafe.Pointer(s)))) >> 3) + ((int32_t(c)) >> 26))) & CplInt32(7)) != 0) { + goto __12 + } + goto ilseq +__12: + ; +loop: + c = ((c << 6) | (uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1)))) - 0x80))) + n-- + if !(!((c & (uint32(1) << 31)) != 0)) { + goto __13 + } + *(*uint32)(unsafe.Pointer(st)) = uint32(0) + *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(c) + return (N - n) +__13: + ; + if !(n != 0) { + goto __14 + } + if !((uint32(*(*uint8)(unsafe.Pointer(s))) - 0x80) >= uint32(0x40)) { + goto __15 + } + goto ilseq +__15: + ; + goto loop +__14: + ; +__11: + ; + + *(*uint32)(unsafe.Pointer(st)) = c + return Uint32FromInt32(-2) +ilseq: + *(*uint32)(unsafe.Pointer(st)) = uint32(0) + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 84 + return Uint32FromInt32(-1) +} + +var _sinternal_state uint32 /* mbrtowc.c:8:18: */ + +func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */ + return (Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))) +} + type imaxdiv_t = struct { quot intmax_t rem intmax_t @@ -2196,90 +3744,6 @@ __3: //TODO else UNLOCK(b->lock); } -type time_t = int64 /* alltypes.h:108:16 */ - -type clockid_t = int32 /* alltypes.h:237:13 */ - -type timespec = struct { - tv_sec time_t - tv_nsec int32 - __12 uint32 /* int : 32 */ -} /* alltypes.h:252:1 */ - -type pthread_t = uintptr /* alltypes.h:296:26 */ - -type pthread_once_t = int32 /* alltypes.h:302:13 */ - -type pthread_key_t = uint32 /* alltypes.h:307:18 */ - -type pthread_spinlock_t = int32 /* alltypes.h:312:13 */ - -type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:317:37 */ - -type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:322:37 */ - -type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:327:37 */ - -type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:332:40 */ - -type __sigset_t = struct{ __bits [32]uint32 } /* alltypes.h:372:9 */ - -type sigset_t = __sigset_t /* alltypes.h:372:71 */ - -type pthread_attr_t = struct{ __u struct{ __i [9]int32 } } /* alltypes.h:395:147 */ - -type pthread_mutex_t = struct{ __u struct{ __i [6]int32 } } /* alltypes.h:400:157 */ - -type pthread_cond_t = struct{ __u struct{ __i [12]int32 } } /* alltypes.h:410:112 */ - -type pthread_rwlock_t = struct{ __u struct{ __i [8]int32 } } /* alltypes.h:420:139 */ - -type pthread_barrier_t = struct{ __u struct{ __i [5]int32 } } /* alltypes.h:425:137 */ - -type sched_param = struct { - sched_priority int32 - __reserved1 int32 - __reserved2 [4]int32 - __reserved3 int32 -} /* sched.h:19:1 */ - -type timer_t = uintptr /* alltypes.h:232:14 */ - -type clock_t = int32 /* alltypes.h:242:14 */ - -type tm = struct { - tm_sec int32 - tm_min int32 - tm_hour int32 - tm_mday int32 - tm_mon int32 - tm_year int32 - tm_wday int32 - tm_yday int32 - tm_isdst int32 - tm_gmtoff int32 - tm_zone uintptr -} /* time.h:38:1 */ - -type itimerspec = struct { - it_interval struct { - tv_sec time_t - tv_nsec int32 - __12 uint32 /* int : 32 */ - } - it_value struct { - tv_sec time_t - tv_nsec int32 - __12 uint32 /* int : 32 */ - } -} /* time.h:80:1 */ - -type __ptcb = struct { - __f uintptr - __x uintptr - __next uintptr -} /* pthread.h:206:1 */ - func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ bp := tls.Alloc(1608) defer tls.Free(1608) @@ -2711,6 +4175,10 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, return 0 } +func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ + return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) +} + type if_nameindex = struct { if_index uint32 if_name uintptr @@ -2853,6 +4321,7 @@ type __res_state = struct { defdname [256]int8 pfcode uint32 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ + _ [4]byte sort_list [10]struct { addr struct{ s_addr in_addr_t } mask uint32_t @@ -3131,15 +4600,15 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5 switch i { case 0: *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) = (*(*uint32)(unsafe.Pointer(bp /* &a[0] */)) & uint32(0xffffff)) - AssignShrPtrUint32(bp /* &a */, int(uint32(24))) + AssignShrPtrUint32(bp /* &a */, int(24)) fallthrough case 1: *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 2*4)) = (*(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) & uint32(0xffff)) - AssignShrPtrUint32(bp /* &a */ +1*4, int(uint32(16))) + AssignShrPtrUint32(bp /* &a */ +1*4, int(16)) fallthrough case 2: *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 3*4)) = (*(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 2*4)) & uint32(0xff)) - AssignShrPtrUint32(bp /* &a */ +2*4, int(uint32(8))) + AssignShrPtrUint32(bp /* &a */ +2*4, int(8)) } for i = 0; i < 4; i++ { if *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*4)) > uint32(255) { @@ -3933,6 +5402,30 @@ func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */ return (int32(temper(tls, AssignPtrUint32(seed, ((*(*uint32)(unsafe.Pointer(seed))*uint32(1103515245))+uint32(12345)))) / uint32(2))) } +func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */ + var owner int32 = (*FILE)(unsafe.Pointer(f)).lock + var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid + if (owner & CplInt32(0x40000000)) == tid { + return 0 + } + owner = a_cas(tls, (f + 76 /* &.lock */), 0, tid) + if !(owner != 0) { + return 1 + } + for AssignInt32(&owner, a_cas(tls, (f+76 /* &.lock */), 0, (tid|0x40000000))) != 0 { + if ((owner & 0x40000000) != 0) || (a_cas(tls, (f+76 /* &.lock */), owner, (owner|0x40000000)) == owner) { + __futexwait(tls, (f + 76 /* &.lock */), (owner | 0x40000000), 1) + } + } + return 1 +} + +func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */ + if (a_swap(tls, (f+76 /* &.lock */), 0) & 0x40000000) != 0 { + __wake(tls, (f + 76 /* &.lock */), 1, 1) + } +} + func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ *(*int32)(unsafe.Pointer(f + 72 /* &.mode */)) |= ((*FILE)(unsafe.Pointer(f)).mode - 1) if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { @@ -3970,6 +5463,940 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ return -1 } +func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */ + var ret int32 + var ap va_list + _ = ap + ap = va + ret = Xvsscanf(tls, s, fmt, ap) + _ = ap + return ret +} + +type wctrans_t = uintptr /* wctype.h:20:19 */ + +func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */ + if !(dest != 0) { + return + } + switch size { + case -2: + *(*int8)(unsafe.Pointer(dest)) = int8(i) + break + case -1: + *(*int16)(unsafe.Pointer(dest)) = int16(i) + break + case 0: + *(*int32)(unsafe.Pointer(dest)) = int32(i) + break + case 1: + *(*int32)(unsafe.Pointer(dest)) = int32(i) + break + case 3: + *(*int64)(unsafe.Pointer(dest)) = int64(i) + break + } +} + +func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */ + var p uintptr + var i uint32 + var ap2 va_list + _ = ap2 + ap2 = ap + for i = n; i > uint32(1); i-- { + VaUintptr(&ap2) + } + p = VaUintptr(&ap2) + _ = ap2 + return p +} + +func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */ + bp := tls.Alloc(276) + defer tls.Free(276) + + var width int32 + var size int32 + var alloc int32 + var base int32 + var p uintptr + var c int32 + var t int32 + var s uintptr + var wcs uintptr + // var st mbstate_t at bp+268, 8 + + var dest uintptr + var invert int32 + var matches int32 + var x uint64 + var y float64 + var pos off_t + // var scanset [257]uint8 at bp, 257 + + var i size_t + var k size_t + // var wc wchar_t at bp+260, 4 + + var __need_unlock int32 + var tmp uintptr + var tmp1 uintptr + alloc = 0 + dest = uintptr(0) + matches = 0 + pos = int64(0) + __need_unlock = func() int32 { + if (*FILE)(unsafe.Pointer((f))).lock >= 0 { + return X__lockfile(tls, f) + } + return 0 + }() + + if !(!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0)) { + goto __1 + } + X__toread(tls, f) +__1: + ; + if !(!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0)) { + goto __2 + } + goto input_fail +__2: + ; + + p = fmt +__3: + if !(*(*uint8)(unsafe.Pointer(p)) != 0) { + goto __5 + } + + alloc = 0 + + if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) { + goto __6 + } +__7: + if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) { + goto __8 + } + p++ + goto __7 +__8: + ; + X__shlim(tls, f, int64(0)) +__9: + if !(__isspace(tls, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) != 0) { + goto __10 + } + goto __9 +__10: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) + goto __4 +__6: + ; + if !((int32(*(*uint8)(unsafe.Pointer(p))) != '%') || (int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%')) { + goto __11 + } + X__shlim(tls, f, int64(0)) + if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') { + goto __12 + } + p++ +__14: + if !(__isspace(tls, AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) != 0) { + goto __15 + } + goto __14 +__15: + ; + goto __13 +__12: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() +__13: + ; + if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) { + goto __16 + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(c < 0) { + goto __17 + } + goto input_fail +__17: + ; + goto match_fail +__16: + ; + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) + goto __4 +__11: + ; + + p++ + if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') { + goto __18 + } + dest = uintptr(0) + p++ + goto __19 +__18: + if !((func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) + } + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(p)))) - uint32('0')) < uint32(10))) + }() != 0) && (int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$')) { + goto __20 + } + dest = arg_n(tls, ap, (uint32(int32(*(*uint8)(unsafe.Pointer(p))) - '0'))) + p += uintptr(2) + goto __21 +__20: + dest = VaUintptr(&ap) +__21: + ; +__19: + ; + + width = 0 +__22: + if !(func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) + } + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(p)))) - uint32('0')) < uint32(10))) + }() != 0) { + goto __24 + } + width = (((10 * width) + int32(*(*uint8)(unsafe.Pointer(p)))) - '0') + goto __23 +__23: + p++ + goto __22 + goto __24 +__24: + ; + + if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') { + goto __25 + } + wcs = uintptr(0) + s = uintptr(0) + alloc = BoolInt32(!(!(dest != 0))) + p++ + goto __26 +__25: + alloc = 0 +__26: + ; + + size = 0 + switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) { + case 'h': + goto __28 + case 'l': + goto __29 + case 'j': + goto __30 + case 'z': + goto __31 + case 't': + goto __32 + case 'L': + goto __33 + case 'd': + goto __34 + case 'i': + goto __35 + case 'o': + goto __36 + case 'u': + goto __37 + case 'x': + goto __38 + case 'a': + goto __39 + case 'e': + goto __40 + case 'f': + goto __41 + case 'g': + goto __42 + case 'A': + goto __43 + case 'E': + goto __44 + case 'F': + goto __45 + case 'G': + goto __46 + case 'X': + goto __47 + case 's': + goto __48 + case 'c': + goto __49 + case '[': + goto __50 + case 'S': + goto __51 + case 'C': + goto __52 + case 'p': + goto __53 + case 'n': + goto __54 + default: + goto __55 + } + goto __27 +__28: + if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') { + goto __56 + } + p++ + size = -2 + goto __57 +__56: + size = -1 +__57: + ; + goto __27 +__29: + if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') { + goto __58 + } + p++ + size = 3 + goto __59 +__58: + size = 1 +__59: + ; + goto __27 +__30: + size = 3 + goto __27 +__31: +__32: + size = 1 + goto __27 +__33: + size = 2 + goto __27 +__34: +__35: +__36: +__37: +__38: +__39: +__40: +__41: +__42: +__43: +__44: +__45: +__46: +__47: +__48: +__49: +__50: +__51: +__52: +__53: +__54: + p-- + goto __27 +__55: + goto fmt_fail +__27: + ; + + t = int32(*(*uint8)(unsafe.Pointer(p))) + + // C or S + if !((t & 0x2f) == 3) { + goto __60 + } + t = t | (32) + size = 1 +__60: + ; + + switch t { + case 'c': + goto __62 + case '[': + goto __63 + case 'n': + goto __64 + default: + goto __65 + } + goto __61 +__62: + if !(width < 1) { + goto __66 + } + width = 1 +__66: + ; +__63: + goto __61 +__64: + store_int(tls, dest, size, uint64(pos)) + // do not increment match count, etc! + goto __4 +__65: + X__shlim(tls, f, int64(0)) +__67: + if !(__isspace(tls, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) != 0) { + goto __68 + } + goto __67 +__68: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) +__61: + ; + + X__shlim(tls, f, int64(width)) + if !((func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) < 0) { + goto __69 + } + goto input_fail +__69: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + + switch t { + case 's': + goto __71 + case 'c': + goto __72 + case '[': + goto __73 + case 'p': + goto __74 + case 'X': + goto __75 + case 'x': + goto __76 + case 'o': + goto __77 + case 'd': + goto __78 + case 'u': + goto __79 + case 'i': + goto __80 + case 'a': + goto __81 + case 'A': + goto __82 + case 'e': + goto __83 + case 'E': + goto __84 + case 'f': + goto __85 + case 'F': + goto __86 + case 'g': + goto __87 + case 'G': + goto __88 + } + goto __70 +__71: +__72: +__73: + if !((t == 'c') || (t == 's')) { + goto __89 + } + Xmemset(tls, bp /* &scanset[0] */, -1, uint32(unsafe.Sizeof([257]uint8{}))) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */)) = uint8(0) + if !(t == 's') { + goto __91 + } + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 10)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 11)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 12)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 13)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 14)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 33)) = uint8(0) +__91: + ; + goto __90 +__89: + if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') { + goto __92 + } + p++ + invert = 1 + goto __93 +__92: + invert = 0 +__93: + ; + Xmemset(tls, bp /* &scanset[0] */, invert, uint32(unsafe.Sizeof([257]uint8{}))) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */)) = uint8(0) + if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') { + goto __94 + } + p++ + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 46)) = (uint8(1 - invert)) + goto __95 +__94: + if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') { + goto __96 + } + p++ + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 94)) = (uint8(1 - invert)) +__96: + ; +__95: + ; +__97: + if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') { + goto __99 + } + if !(!(int32(*(*uint8)(unsafe.Pointer(p))) != 0)) { + goto __100 + } + goto fmt_fail +__100: + ; + if !(((int32(*(*uint8)(unsafe.Pointer(p))) == '-') && (*(*uint8)(unsafe.Pointer(p + 1)) != 0)) && (int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']')) { + goto __101 + } + c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1)))) +__102: + if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) { + goto __104 + } + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr((1 + c)))) = (uint8(1 - invert)) + goto __103 +__103: + c++ + goto __102 + goto __104 +__104: + ; +__101: + ; + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr((1 + int32(*(*uint8)(unsafe.Pointer(p))))))) = (uint8(1 - invert)) + goto __98 +__98: + p++ + goto __97 + goto __99 +__99: + ; +__90: + ; + wcs = uintptr(0) + s = uintptr(0) + i = size_t(0) + if t == 'c' { + k = (uint32(width) + 1) + } else { + k = uint32(31) + } + if !(size == 1) { + goto __105 + } + if !(alloc != 0) { + goto __107 + } + wcs = Xmalloc(tls, (k * size_t(unsafe.Sizeof(wchar_t(0))))) + if !(!(wcs != 0)) { + goto __109 + } + goto alloc_fail +__109: + ; + goto __108 +__107: + wcs = dest +__108: + ; + *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{} +__110: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __111 + } + switch Xmbrtowc(tls, bp+260 /* &wc */, func() uintptr { *(*int8)(unsafe.Pointer(bp + 264)) = int8(c); return bp + 264 }(), uint32(1), bp+268 /* &st */) { + case Uint32FromInt32(-1): + goto __113 + case Uint32FromInt32(-2): + goto __114 + } + goto __112 +__113: + goto input_fail +__114: + goto __110 +__112: + ; + if !(wcs != 0) { + goto __115 + } + *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint32(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */)) +__115: + ; + if !((alloc != 0) && (i == k)) { + goto __116 + } + k = k + (k + size_t(1)) + tmp = Xrealloc(tls, wcs, (k * size_t(unsafe.Sizeof(wchar_t(0))))) + if !(!(tmp != 0)) { + goto __117 + } + goto alloc_fail +__117: + ; + wcs = tmp +__116: + ; + goto __110 +__111: + ; + if !(!(Xmbsinit(tls, bp+268 /* &st */) != 0)) { + goto __118 + } + goto input_fail +__118: + ; + goto __106 +__105: + if !(alloc != 0) { + goto __119 + } + s = Xmalloc(tls, k) + if !(!(s != 0)) { + goto __121 + } + goto alloc_fail +__121: + ; +__122: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __123 + } + *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint32(&i, 1)))) = int8(c) + if !(i == k) { + goto __124 + } + k = k + (k + size_t(1)) + tmp1 = Xrealloc(tls, s, k) + if !(!(tmp1 != 0)) { + goto __125 + } + goto alloc_fail +__125: + ; + s = tmp1 +__124: + ; + goto __122 +__123: + ; + goto __120 +__119: + if !(AssignUintptr(&s, dest) != 0) { + goto __126 + } +__128: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __129 + } + *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint32(&i, 1)))) = int8(c) + goto __128 +__129: + ; + goto __127 +__126: +__130: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __131 + } + goto __130 +__131: + ; +__127: + ; +__120: + ; +__106: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(!(((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != 0)) { + goto __132 + } + goto match_fail +__132: + ; + if !((t == 'c') && (((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != off_t(width))) { + goto __133 + } + goto match_fail +__133: + ; + if !(alloc != 0) { + goto __134 + } + if !(size == 1) { + goto __135 + } + *(*uintptr)(unsafe.Pointer(dest)) = wcs + goto __136 +__135: + *(*uintptr)(unsafe.Pointer(dest)) = s +__136: + ; +__134: + ; + if !(t != 'c') { + goto __137 + } + if !(wcs != 0) { + goto __138 + } + *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = 0 +__138: + ; + if !(s != 0) { + goto __139 + } + *(*int8)(unsafe.Pointer(s + uintptr(i))) = int8(0) +__139: + ; +__137: + ; + goto __70 +__74: +__75: +__76: + base = 16 + goto int_common +__77: + base = 8 + goto int_common +__78: +__79: + base = 10 + goto int_common +__80: + base = 0 +int_common: + x = X__intscan(tls, f, uint32(base), 0, ((2 * uint64(0x7fffffffffffffff)) + uint64(1))) + if !(!(((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != 0)) { + goto __140 + } + goto match_fail +__140: + ; + if !((t == 'p') && (dest != 0)) { + goto __141 + } + *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x)) + goto __142 +__141: + store_int(tls, dest, size, x) +__142: + ; + goto __70 +__81: +__82: +__83: +__84: +__85: +__86: +__87: +__88: + y = X__floatscan(tls, f, size, 0) + if !(!(((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != 0)) { + goto __143 + } + goto match_fail +__143: + ; + if !(dest != 0) { + goto __144 + } + switch size { + case 0: + goto __146 + case 1: + goto __147 + case 2: + goto __148 + } + goto __145 +__146: + *(*float32)(unsafe.Pointer(dest)) = float32(y) + goto __145 +__147: + *(*float64)(unsafe.Pointer(dest)) = y + goto __145 +__148: + *(*float64)(unsafe.Pointer(dest)) = y + goto __145 +__145: + ; +__144: + ; + goto __70 +__70: + ; + + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) + if !(dest != 0) { + goto __149 + } + matches++ +__149: + ; + goto __4 +__4: + p++ + goto __3 + goto __5 +__5: + ; + if !(0 != 0) { + goto __150 + } +fmt_fail: +alloc_fail: +input_fail: + if !(!(matches != 0)) { + goto __151 + } + matches-- +__151: + ; +match_fail: + if !(alloc != 0) { + goto __152 + } + Xfree(tls, s) + Xfree(tls, wcs) +__152: + ; +__150: + ; +__153: + if !(__need_unlock != 0) { + goto __156 + } + X__unlockfile(tls, f) +__156: + ; + goto __154 +__154: + if 0 != 0 { + goto __153 + } + goto __155 +__155: + ; + return matches +} + +func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */ + var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie + var k size_t = (len + size_t(256)) + var end uintptr = Xmemchr(tls, src, 0, k) + if end != 0 { + k = (size_t((int32(end) - int32(src)) / 1)) + } + if k < len { + len = k + } + Xmemcpy(tls, buf, src, len) + (*FILE)(unsafe.Pointer(f)).rpos = (src + uintptr(len)) + (*FILE)(unsafe.Pointer(f)).rend = (src + uintptr(k)) + (*FILE)(unsafe.Pointer(f)).cookie = (src + uintptr(k)) + return len +} + +func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct { + f func(*TLS, uintptr, uintptr, size_t) size_t + }{string_read})), buf: s, lock: -1, cookie: s} + return Xvfscanf(tls, bp /* &f */, fmt, ap) +} + func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ bp := tls.Alloc(136) defer tls.Free(136) @@ -4229,5 +6656,185 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ var _sp uintptr /* strtok.c:5:14: */ +func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ + return *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 3*4)) +} + +func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ + *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 3*4)) + return 0 +} + +// +// int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) +// { +// *size = a->_a_guardsize; +// return 0; +// } +// +// int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) +// { +// *inherit = a->_a_sched; +// return 0; +// } +// +// int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) +// { +// param->sched_priority = a->_a_prio; +// return 0; +// } +// +// int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) +// { +// *policy = a->_a_policy; +// return 0; +// } +// +// int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) +// { +// *scope = PTHREAD_SCOPE_SYSTEM; +// return 0; +// } +// +// int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) +// { +// if (!a->_a_stackaddr) +// return EINVAL; +// *size = a->_a_stacksize; +// *addr = (void *)(a->_a_stackaddr - *size); +// return 0; +// } +// +// int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) +// { +// *size = a->_a_stacksize; +// return 0; +// } +// +// int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) +// { +// *pshared = !!a->__attr; +// return 0; +// } +// +// int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) +// { +// *clk = a->__attr & 0x7fffffff; +// return 0; +// } +// +// int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr>>31; +// return 0; +// } +// +// int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) +// { +// *protocol = PTHREAD_PRIO_NONE; +// return 0; +// } +// int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr / 128U % 2; +// return 0; +// } +// +// int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) +// { +// *robust = a->__attr / 4U % 2; +// return 0; +// } + +func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ + return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))) +} + +// int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) +// { +// *type = a->__attr & 3; +// return 0; +// } +// +// int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr[0]; +// return 0; +// } + +func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ + if uint32(state) > 1 { + return 22 + } + *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 3*4)) = state + return 0 +} + +func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ + return (*(*int32)(unsafe.Pointer((m /* &.__u */ /* &.__i */))) & 15) +} + +// int __pthread_mutex_lock(pthread_mutex_t *m) +// { +// if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL +// && !a_cas(&m->_m_lock, 0, EBUSY)) +// return 0; +// +// return __pthread_mutex_timedlock(m, 0); +// } +// +// weak_alias(__pthread_mutex_lock, pthread_mutex_lock); + +func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ + return 0 +} + +func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ + *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} + return 0 +} + +func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ + if uint32(type1) > uint32(2) { + return 22 + } + (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1)) + return 0 +} + +var __ctype_b_table = [...]uint16{ //TODO use symbolic constants + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x2003, 0x2002, 0x2002, 0x2002, 0x2002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x6001, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, + 0xd808, 0xd808, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc004, 0xc004, 0xc004, 0xc004, 0x0002, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +var ptable = uintptr(unsafe.Pointer(&__ctype_b_table[128])) + +// const unsigned short * * __ctype_b_loc (void); +func X__ctype_b_loc(t *TLS) uintptr { + return uintptr(unsafe.Pointer(&ptable)) +} + var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_linux_amd64.go b/vendor/modernc.org/libc/musl_linux_amd64.go index c4e00917..528b9938 100644 --- a/vendor/modernc.org/libc/musl_linux_amd64.go +++ b/vendor/modernc.org/libc/musl_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. package libc @@ -1899,6 +1899,34 @@ func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ return X__builtin_nanf(tls, ts+13 /* "" */) } +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ bp := tls.Alloc(8) defer tls.Free(8) @@ -6832,5 +6860,39 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth return 0 } +var __ctype_b_table = [...]uint16{ //TODO use symbolic constants + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x2003, 0x2002, 0x2002, 0x2002, 0x2002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x6001, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, + 0xd808, 0xd808, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc004, 0xc004, 0xc004, 0xc004, 0x0002, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +var ptable = uintptr(unsafe.Pointer(&__ctype_b_table[128])) + +// const unsigned short * * __ctype_b_loc (void); +func X__ctype_b_loc(t *TLS) uintptr { + return uintptr(unsafe.Pointer(&ptable)) +} + var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_linux_arm.go b/vendor/modernc.org/libc/musl_linux_arm.go index dfd805a9..8d62aec5 100644 --- a/vendor/modernc.org/libc/musl_linux_arm.go +++ b/vendor/modernc.org/libc/musl_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_arm.go -pkgname libc -static-locals-prefix _s -Iarch/arm -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c', DO NOT EDIT. +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_arm.go -pkgname libc -static-locals-prefix _s -Iarch/arm -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. package libc @@ -351,6 +351,12 @@ const ( /* nameser.h:98:1: */ ns_r_badtime = 18 ) +const ( /* pthread_impl.h:58:1: */ + DT_EXITING = 0 + DT_JOINABLE = 1 + DT_DETACHED = 2 +) + type ptrdiff_t = int32 /* :3:26 */ type size_t = uint32 /* :9:23 */ @@ -361,6 +367,8 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ return (Bool32((_c == ' ') || ((uint32(_c) - uint32('\t')) < uint32(5)))) } +type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:336:9 */ + type locale_t = uintptr /* alltypes.h:336:32 */ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ @@ -675,6 +683,44 @@ func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ return *(*uint64)(unsafe.Pointer(bp /* &__u */)) } +type __pthread = struct { + self uintptr + dtv uintptr + prev uintptr + next uintptr + sysinfo uintptr_t + canary uintptr_t + canary2 uintptr_t + tid int32 + errno_val int32 + detach_state int32 + cancel int32 + canceldisable uint8 + cancelasync uint8 + tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */ + _ [1]byte + map_base uintptr + map_size size_t + stack uintptr + stack_size size_t + guard_size size_t + result uintptr + cancelbuf uintptr + tsd uintptr + robust_list struct { + head uintptr + off int32 + pending uintptr + } + timer_id int32 + locale locale_t + killlock [1]int32 + dlerror_buf uintptr + stdio_locks uintptr + canary_at_end uintptr_t + dtv_copy uintptr +} /* alltypes.h:266:9 */ + func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ var c int32 var x int32 @@ -1851,6 +1897,34 @@ func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ return X__builtin_nanf(tls, ts+13 /* "" */) } +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ bp := tls.Alloc(8) defer tls.Free(8) @@ -1891,6 +1965,1509 @@ func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ return Xscalbn(tls, x, n) } +// Upper 6 state bits are a negative integer offset to bound-check next byte +// equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f + +// Interval [a,b). Either a must be 80 or b must be c0, lower 3 bits clear. + +// Arbitrary encoding for representing code units instead of characters. + +// Get inline definition of MB_CUR_MAX. + +type lconv = struct { + decimal_point uintptr + thousands_sep uintptr + grouping uintptr + int_curr_symbol uintptr + currency_symbol uintptr + mon_decimal_point uintptr + mon_thousands_sep uintptr + mon_grouping uintptr + positive_sign uintptr + negative_sign uintptr + int_frac_digits int8 + frac_digits int8 + p_cs_precedes int8 + p_sep_by_space int8 + n_cs_precedes int8 + n_sep_by_space int8 + p_sign_posn int8 + n_sign_posn int8 + int_p_cs_precedes int8 + int_p_sep_by_space int8 + int_n_cs_precedes int8 + int_n_sep_by_space int8 + int_p_sign_posn int8 + int_n_sign_posn int8 + _ [2]byte +} /* locale.h:24:1 */ + +// Support signed or unsigned plain-char + +// Implementation choices... + +// Arbitrary numbers... + +// POSIX/SUS requirements follow. These numbers come directly +// from SUS and have nothing to do with the host system. + +type __locale_map = struct { + __map uintptr + map_size size_t + name [24]int8 + next uintptr +} /* alltypes.h:336:9 */ + +type tls_module = struct { + next uintptr + image uintptr + len size_t + size size_t + align size_t + offset size_t +} /* libc.h:14:1 */ + +type __libc = struct { + can_do_threads int8 + threaded int8 + secure int8 + need_locks int8 + threads_minus_1 int32 + auxv uintptr + tls_head uintptr + tls_size size_t + tls_align size_t + tls_cnt size_t + page_size size_t + global_locale struct{ cat [6]uintptr } +} /* libc.h:20:1 */ + +type time_t = int64 /* alltypes.h:78:16 */ + +type clockid_t = int32 /* alltypes.h:207:13 */ + +type timespec = struct { + tv_sec time_t + tv_nsec int32 + __12 uint32 /* int : 32 */ +} /* alltypes.h:222:1 */ + +type pthread_t = uintptr /* alltypes.h:266:26 */ + +type pthread_once_t = int32 /* alltypes.h:272:13 */ + +type pthread_key_t = uint32 /* alltypes.h:277:18 */ + +type pthread_spinlock_t = int32 /* alltypes.h:282:13 */ + +type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:287:37 */ + +type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:292:37 */ + +type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:297:37 */ + +type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:302:40 */ + +type __sigset_t = struct{ __bits [32]uint32 } /* alltypes.h:342:9 */ + +type sigset_t = __sigset_t /* alltypes.h:342:71 */ + +type pthread_attr_t = struct{ __u struct{ __i [9]int32 } } /* alltypes.h:365:147 */ + +type pthread_mutex_t = struct{ __u struct{ __i [6]int32 } } /* alltypes.h:370:157 */ + +type pthread_cond_t = struct{ __u struct{ __i [12]int32 } } /* alltypes.h:380:112 */ + +type pthread_rwlock_t = struct{ __u struct{ __i [8]int32 } } /* alltypes.h:390:139 */ + +type pthread_barrier_t = struct{ __u struct{ __i [5]int32 } } /* alltypes.h:395:137 */ + +type sched_param = struct { + sched_priority int32 + __reserved1 int32 + __reserved2 [4]int32 + __reserved3 int32 +} /* sched.h:19:1 */ + +type timer_t = uintptr /* alltypes.h:202:14 */ + +type clock_t = int32 /* alltypes.h:212:14 */ + +type tm = struct { + tm_sec int32 + tm_min int32 + tm_hour int32 + tm_mday int32 + tm_mon int32 + tm_year int32 + tm_wday int32 + tm_yday int32 + tm_isdst int32 + tm_gmtoff int32 + tm_zone uintptr +} /* time.h:38:1 */ + +type itimerspec = struct { + it_interval struct { + tv_sec time_t + tv_nsec int32 + __12 uint32 /* int : 32 */ + } + it_value struct { + tv_sec time_t + tv_nsec int32 + __12 uint32 /* int : 32 */ + } +} /* time.h:80:1 */ + +type sigevent = struct { + sigev_value struct{ sival_int int32 } + sigev_signo int32 + sigev_notify int32 + sigev_notify_function uintptr + sigev_notify_attributes uintptr + __pad [44]int8 +} /* time.h:107:1 */ + +type __ptcb = struct { + __f uintptr + __x uintptr + __next uintptr +} /* alltypes.h:266:9 */ + +type sigaltstack = struct { + ss_sp uintptr + ss_flags int32 + ss_size size_t +} /* signal.h:44:9 */ + +type stack_t = sigaltstack /* signal.h:44:28 */ + +type greg_t = int32 /* signal.h:10:13 */ +type gregset_t = [18]int32 /* signal.h:10:21 */ +type sigcontext = struct { + trap_no uint32 + error_code uint32 + oldmask uint32 + arm_r0 uint32 + arm_r1 uint32 + arm_r2 uint32 + arm_r3 uint32 + arm_r4 uint32 + arm_r5 uint32 + arm_r6 uint32 + arm_r7 uint32 + arm_r8 uint32 + arm_r9 uint32 + arm_r10 uint32 + arm_fp uint32 + arm_ip uint32 + arm_sp uint32 + arm_lr uint32 + arm_pc uint32 + arm_cpsr uint32 + fault_address uint32 +} /* signal.h:11:9 */ + +type mcontext_t = sigcontext /* signal.h:18:3 */ + +type __ucontext = struct { + uc_flags uint32 + uc_link uintptr + uc_stack stack_t + uc_mcontext mcontext_t + uc_sigmask sigset_t + uc_regspace [64]uint64 +} /* signal.h:31:9 */ + +type ucontext_t = __ucontext /* signal.h:38:3 */ + +type sigval = struct{ sival_int int32 } /* time.h:107:1 */ + +type siginfo_t = struct { + si_signo int32 + si_errno int32 + si_code int32 + __si_fields struct { + _ [0]uint32 + __pad [116]int8 + } +} /* signal.h:145:3 */ + +type sigaction = struct { + __sa_handler struct{ sa_handler uintptr } + sa_mask sigset_t + sa_flags int32 + sa_restorer uintptr +} /* signal.h:167:1 */ + +type sig_t = uintptr /* signal.h:251:14 */ + +type sig_atomic_t = int32 /* signal.h:269:13 */ + +func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:46:19: */ + panic(`arch/arm/atomic_arch.h:48:2: assembler statements not supported`) + return int32(0) + //TODO for (;;) { + //TODO register int r0 __asm__("r0") = t; + //TODO register int r1 __asm__("r1") = s; + //TODO register volatile int *r2 __asm__("r2") = p; + //TODO register uintptr_t r3 __asm__("r3") = __a_cas_ptr; + //TODO int old; + //TODO __asm__ __volatile__ ( + //TODO BLX " r3" + //TODO : "+r"(r0), "+r"(r3) : "r"(r1), "r"(r2) + //TODO : "memory", "lr", "ip", "cc" ); + //TODO if (!r0) return t; + //TODO if ((old=*p)!=t) return old; + //TODO } +} + +func a_barrier(tls *TLS) { /* atomic_arch.h:68:20: */ + panic(`arch/arm/atomic_arch.h:70:2: assembler statements not supported`) + //TODO register uintptr_t ip __asm__("ip") = __a_barrier_ptr; + //TODO __asm__ __volatile__( BLX " ip" : "+r"(ip) : : "memory", "cc", "lr" ); +} + +func a_clz_32(tls *TLS, x uint32_t) int32 { /* atomic_arch.h:91:19: */ + panic(`arch/arm/atomic_arch.h:93:2: assembler statements not supported`) + return int32(x) +} + +func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:108:19: */ + var old int32 + for ok := true; ok; ok = (a_cas(tls, AtomicLoadUintptr(&p), old, v) != old) { + old = *(*int32)(unsafe.Pointer(AtomicLoadUintptr(&p))) + } + return old +} + +func a_fetch_add(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:119:19: */ + var old int32 + for ok := true; ok; ok = (a_cas(tls, AtomicLoadUintptr(&p), old, (int32(uint32(old)+uint32(v)))) != old) { + old = *(*int32)(unsafe.Pointer(AtomicLoadUintptr(&p))) + } + return old +} + +func a_fetch_and(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:130:19: */ + var old int32 + for ok := true; ok; ok = (a_cas(tls, AtomicLoadUintptr(&p), old, (old&v)) != old) { + old = *(*int32)(unsafe.Pointer(AtomicLoadUintptr(&p))) + } + return old +} + +func a_fetch_or(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:140:19: */ + var old int32 + for ok := true; ok; ok = (a_cas(tls, AtomicLoadUintptr(&p), old, (old|v)) != old) { + old = *(*int32)(unsafe.Pointer(AtomicLoadUintptr(&p))) + } + return old +} + +func a_and(tls *TLS, p uintptr, v int32) { /* atomic.h:151:20: */ + a_fetch_and(tls, AtomicLoadUintptr(&p), v) +} + +func a_or(tls *TLS, p uintptr, v int32) { /* atomic.h:159:20: */ + a_fetch_or(tls, AtomicLoadUintptr(&p), v) +} + +func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ v uint64_t })(unsafe.Pointer(bp /* u */)) = struct{ v uint64_t }{v: v} + if *(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */))) != 0 { + a_or(tls, AtomicLoadUintptr(&p), int32(*(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */))))) + } + if *(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */) + 1*4)) != 0 { + a_or(tls, (AtomicLoadUintptr(&p) + uintptr(1)*4), int32(*(*uint32_t)(unsafe.Pointer((bp /* &u */ /* &.r */) + 1*4)))) + } +} + +type a_cas_p_undefined_but_pointer_not_32bit = [1]int8 /* atomic.h:229:14 */ + +func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ + return (31 - a_clz_32(tls, (x&-x))) +} + +func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic.h:272:19: */ + if uint32(unsafe.Sizeof(int32(0))) < uint32(8) { + var y uint32_t = uint32_t(x) + if !(y != 0) { + y = (uint32_t(x >> 32)) + return (32 + a_ctz_32(tls, y)) + } + return a_ctz_32(tls, y) + } + return int32(_sdebruijn648[(((x & -x) * 0x022fdd63cc95386d) >> 58)]) +} + +var _sdebruijn648 = [64]int8{ + int8(0), int8(1), int8(2), int8(53), int8(3), int8(7), int8(54), int8(27), int8(4), int8(38), int8(41), int8(8), int8(34), int8(55), int8(48), int8(28), + int8(62), int8(5), int8(39), int8(46), int8(44), int8(42), int8(22), int8(9), int8(24), int8(35), int8(59), int8(56), int8(49), int8(18), int8(29), int8(11), + int8(63), int8(52), int8(6), int8(26), int8(37), int8(40), int8(33), int8(47), int8(61), int8(45), int8(43), int8(21), int8(23), int8(58), int8(17), int8(10), + int8(51), int8(25), int8(36), int8(32), int8(60), int8(20), int8(57), int8(16), int8(50), int8(31), int8(19), int8(15), int8(30), int8(14), int8(13), int8(12), +} /* atomic.h:274:20 */ + +type __timer = struct { + timerid int32 + thread pthread_t +} /* pthread_impl.h:64:1 */ + +func __pthread_self(tls *TLS) pthread_t { /* pthread_arch.h:19:25: */ + var p uintptr_t + panic(`arch/arm/pthread_arch.h:23:2: assembler statements not supported`) + return (uintptr(p - uintptr_t(unsafe.Sizeof(__pthread{})))) +} + +func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */ + if priv != 0 { + priv = 128 + } + if cnt < 0 { + cnt = 0x7fffffff + } + _ = (Bool32((X__syscall3(tls, 240, int32(AtomicLoadUintptr(&addr)), (int32(1|priv)), int32(cnt)) != -38) || (X__syscall3(tls, 240, int32(AtomicLoadUintptr(&addr)), 1, int32(cnt)) != 0))) +} + +func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ + if priv != 0 { + priv = 128 + } + _ = (Bool32((X__syscall4(tls, 240, int32(AtomicLoadUintptr(&addr)), (int32(0|priv)), int32(val), 0) != -38) || (X__syscall4(tls, 240, int32(AtomicLoadUintptr(&addr)), 0, int32(val), 0) != 0))) +} + +var X__fsmu8 = [51]uint32_t{ + func() uint32 { + if 0x2 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x2)) + }(), func() uint32 { + if 0x3 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x3)) + }(), func() uint32 { + if 0x4 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x4)) + }(), func() uint32 { + if 0x5 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x5)) + }(), func() uint32 { + if 0x6 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x6)) + }(), func() uint32 { + if 0x7 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x7)) + }(), + func() uint32 { + if 0x8 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x8)) + }(), func() uint32 { + if 0x9 < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0x9)) + }(), func() uint32 { + if 0xa < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xa)) + }(), func() uint32 { + if 0xb < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xb)) + }(), func() uint32 { + if 0xc < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xc)) + }(), func() uint32 { + if 0xd < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xd)) + }(), func() uint32 { + if 0xe < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xe)) + }(), func() uint32 { + if 0xf < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | uint32_t(0xf)) + }(), + func() uint32 { + if (0x0 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x0 + 16))) + }(), func() uint32 { + if (0x1 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x1 + 16))) + }(), func() uint32 { + if (0x2 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x2 + 16))) + }(), func() uint32 { + if (0x3 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x3 + 16))) + }(), func() uint32 { + if (0x4 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x4 + 16))) + }(), func() uint32 { + if (0x5 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x5 + 16))) + }(), func() uint32 { + if (0x6 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x6 + 16))) + }(), func() uint32 { + if (0x7 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x7 + 16))) + }(), + func() uint32 { + if (0x8 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x8 + 16))) + }(), func() uint32 { + if (0x9 + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0x9 + 16))) + }(), func() uint32 { + if (0xa + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xa + 16))) + }(), func() uint32 { + if (0xb + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xb + 16))) + }(), func() uint32 { + if (0xc + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xc + 16))) + }(), func() uint32 { + if (0xd + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xd + 16))) + }(), func() uint32 { + if (0xe + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xe + 16))) + }(), func() uint32 { + if (0xf + 16) < 2 { + return Uint32FromInt32(-1) + } + return (((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) | (uint32_t(0xf + 16))) + }(), + (((func() uint32 { + if 0x0 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x0 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x0)), (((func() uint32 { + if 0x1 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x1 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x1)), (((func() uint32 { + if 0x2 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x2 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x2)), (((func() uint32 { + if 0x3 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x3 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x3)), (((func() uint32 { + if 0x4 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x4 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x4)), (((func() uint32 { + if 0x5 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x5 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x5)), (((func() uint32 { + if 0x6 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x6 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x6)), (((func() uint32 { + if 0x7 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x7 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x7)), + (((func() uint32 { + if 0x8 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x8 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x8)), (((func() uint32 { + if 0x9 == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0x9 == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0x9)), (((func() uint32 { + if 0xa == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xa == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xa)), (((func() uint32 { + if 0xb == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xb == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xb)), (((func() uint32 { + if 0xc == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xc == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xc)), (((func() uint32 { + if 0xd == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xd == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xd)), (((func() uint32 { + if 0xe == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xe == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xe)), (((func() uint32 { + if 0xf == 0 { + return ((func() uint32 { + if Int32(0xa0) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0xa0))) + }()) << 23) + } + return func() uint32 { + if 0xf == 0xd { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xa0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | uint32_t(0xf)), + ((((func() uint32 { + if 0x0 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x0 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x0 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x0)), ((((func() uint32 { + if 0x1 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x1 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x1 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x1)), ((((func() uint32 { + if 0x2 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x2 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x2 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x2)), ((((func() uint32 { + if 0x3 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x3 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x3 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x3)), ((((func() uint32 { + if 0x4 >= 5 { + return uint32(0) + } + return func() uint32 { + if 0x4 == 0 { + return ((func() uint32 { + if Int32(0x90) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x90))) + }()) << 23) + } + return func() uint32 { + if 0x4 == 4 { + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0x90))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + } + return ((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23) + }() + }() + }()) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 6)) | (uint32_t(((func() uint32 { + if Int32(0x80) == Int32(0x80) { + return (Uint32(Uint32(0x40) - Uint32FromInt32(0xc0))) + } + return (Uint32(Uint32(0) - Uint32FromInt32(0x80))) + }()) << 23)) >> 12)) | uint32_t(0x4)), +} /* internal.c:18:16 */ + +type wint_t = uint32 /* alltypes.h:191:18 */ + +type wctype_t = uint32 /* alltypes.h:196:23 */ + +type __mbstate_t = struct { + __opaque1 uint32 + __opaque2 uint32 +} /* alltypes.h:330:9 */ + +type mbstate_t = __mbstate_t /* alltypes.h:330:63 */ + +func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var c uint32 + var s uintptr + var N uint32 + // var dummy wchar_t at bp, 4 + s = src + N = n + + if !(!(st != 0)) { + goto __1 + } + st = uintptr(unsafe.Pointer(&_sinternal_state)) +__1: + ; + c = *(*uint32)(unsafe.Pointer(st)) + + if !(!(s != 0)) { + goto __2 + } + if !(c != 0) { + goto __4 + } + goto ilseq +__4: + ; + return size_t(0) + goto __3 +__2: + if !(!(wc != 0)) { + goto __5 + } + wc = bp /* &dummy */ +__5: + ; +__3: + ; + + if !(!(n != 0)) { + goto __6 + } + return Uint32FromInt32(-2) +__6: + ; + if !(!(c != 0)) { + goto __7 + } + if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) { + goto __8 + } + return BoolUint32(!(!(int32(AssignPtrUint32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s))))) != 0))) +__8: + ; + if !((func() int32 { + if !(!(int32(*(*uintptr)(unsafe.Pointer(((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale /* &.cat */)))) != 0)) { + return 4 + } + return 1 + }()) == 1) { + goto __9 + } + *(*wchar_t)(unsafe.Pointer(wc)) = (wchar_t(0xdfff & int32((int8(*(*uint8)(unsafe.Pointer(s))))))) + return 1 +__9: + ; + if !((uint32(*(*uint8)(unsafe.Pointer(s))) - 0xc2) > (0xf4 - 0xc2)) { + goto __10 + } + goto ilseq +__10: + ; + c = X__fsmu8[(uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1)))) - 0xc2)] + n-- +__7: + ; + + if !(n != 0) { + goto __11 + } + if !((((((int32(*(*uint8)(unsafe.Pointer(s)))) >> 3) - 0x10) | (((int32(*(*uint8)(unsafe.Pointer(s)))) >> 3) + ((int32_t(c)) >> 26))) & CplInt32(7)) != 0) { + goto __12 + } + goto ilseq +__12: + ; +loop: + c = ((c << 6) | (uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1)))) - 0x80))) + n-- + if !(!((c & (uint32(1) << 31)) != 0)) { + goto __13 + } + *(*uint32)(unsafe.Pointer(st)) = uint32(0) + *(*wchar_t)(unsafe.Pointer(wc)) = c + return (N - n) +__13: + ; + if !(n != 0) { + goto __14 + } + if !((uint32(*(*uint8)(unsafe.Pointer(s))) - 0x80) >= uint32(0x40)) { + goto __15 + } + goto ilseq +__15: + ; + goto loop +__14: + ; +__11: + ; + + *(*uint32)(unsafe.Pointer(st)) = c + return Uint32FromInt32(-2) +ilseq: + *(*uint32)(unsafe.Pointer(st)) = uint32(0) + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 84 + return Uint32FromInt32(-1) +} + +var _sinternal_state uint32 /* mbrtowc.c:8:18: */ + +func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */ + return (Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))) +} + type imaxdiv_t = struct { quot intmax_t rem intmax_t @@ -2200,90 +3777,6 @@ __3: //TODO else UNLOCK(b->lock); } -type time_t = int64 /* alltypes.h:78:16 */ - -type clockid_t = int32 /* alltypes.h:207:13 */ - -type timespec = struct { - tv_sec time_t - tv_nsec int32 - __12 uint32 /* int : 32 */ -} /* alltypes.h:222:1 */ - -type pthread_t = uintptr /* alltypes.h:266:26 */ - -type pthread_once_t = int32 /* alltypes.h:272:13 */ - -type pthread_key_t = uint32 /* alltypes.h:277:18 */ - -type pthread_spinlock_t = int32 /* alltypes.h:282:13 */ - -type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:287:37 */ - -type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:292:37 */ - -type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:297:37 */ - -type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:302:40 */ - -type __sigset_t = struct{ __bits [32]uint32 } /* alltypes.h:342:9 */ - -type sigset_t = __sigset_t /* alltypes.h:342:71 */ - -type pthread_attr_t = struct{ __u struct{ __i [9]int32 } } /* alltypes.h:365:147 */ - -type pthread_mutex_t = struct{ __u struct{ __i [6]int32 } } /* alltypes.h:370:157 */ - -type pthread_cond_t = struct{ __u struct{ __i [12]int32 } } /* alltypes.h:380:112 */ - -type pthread_rwlock_t = struct{ __u struct{ __i [8]int32 } } /* alltypes.h:390:139 */ - -type pthread_barrier_t = struct{ __u struct{ __i [5]int32 } } /* alltypes.h:395:137 */ - -type sched_param = struct { - sched_priority int32 - __reserved1 int32 - __reserved2 [4]int32 - __reserved3 int32 -} /* sched.h:19:1 */ - -type timer_t = uintptr /* alltypes.h:202:14 */ - -type clock_t = int32 /* alltypes.h:212:14 */ - -type tm = struct { - tm_sec int32 - tm_min int32 - tm_hour int32 - tm_mday int32 - tm_mon int32 - tm_year int32 - tm_wday int32 - tm_yday int32 - tm_isdst int32 - tm_gmtoff int32 - tm_zone uintptr -} /* time.h:38:1 */ - -type itimerspec = struct { - it_interval struct { - tv_sec time_t - tv_nsec int32 - __12 uint32 /* int : 32 */ - } - it_value struct { - tv_sec time_t - tv_nsec int32 - __12 uint32 /* int : 32 */ - } -} /* time.h:80:1 */ - -type __ptcb = struct { - __f uintptr - __x uintptr - __next uintptr -} /* pthread.h:206:1 */ - func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ bp := tls.Alloc(1608) defer tls.Free(1608) @@ -2715,6 +4208,10 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, return 0 } +func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ + return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) +} + type if_nameindex = struct { if_index uint32 if_name uintptr @@ -2857,6 +4354,7 @@ type __res_state = struct { defdname [256]int8 pfcode uint32 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ + _ [4]byte sort_list [10]struct { addr struct{ s_addr in_addr_t } mask uint32_t @@ -3135,15 +4633,15 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5 switch i { case 0: *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) = (*(*uint32)(unsafe.Pointer(bp /* &a[0] */)) & uint32(0xffffff)) - AssignShrPtrUint32(bp /* &a */, int(uint32(24))) + AssignShrPtrUint32(bp /* &a */, int(24)) fallthrough case 1: *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 2*4)) = (*(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) & uint32(0xffff)) - AssignShrPtrUint32(bp /* &a */ +1*4, int(uint32(16))) + AssignShrPtrUint32(bp /* &a */ +1*4, int(16)) fallthrough case 2: *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 3*4)) = (*(*uint32)(unsafe.Pointer(bp /* &a[0] */ + 2*4)) & uint32(0xff)) - AssignShrPtrUint32(bp /* &a */ +2*4, int(uint32(8))) + AssignShrPtrUint32(bp /* &a */ +2*4, int(8)) } for i = 0; i < 4; i++ { if *(*uint32)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*4)) > uint32(255) { @@ -3937,6 +5435,30 @@ func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */ return (int32(temper(tls, AssignPtrUint32(seed, ((*(*uint32)(unsafe.Pointer(seed))*uint32(1103515245))+uint32(12345)))) / uint32(2))) } +func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */ + var owner int32 = (*FILE)(unsafe.Pointer(f)).lock + var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid + if (owner & CplInt32(0x40000000)) == tid { + return 0 + } + owner = a_cas(tls, (f + 76 /* &.lock */), 0, tid) + if !(owner != 0) { + return 1 + } + for AssignInt32(&owner, a_cas(tls, (f+76 /* &.lock */), 0, (tid|0x40000000))) != 0 { + if ((owner & 0x40000000) != 0) || (a_cas(tls, (f+76 /* &.lock */), owner, (owner|0x40000000)) == owner) { + __futexwait(tls, (f + 76 /* &.lock */), (owner | 0x40000000), 1) + } + } + return 1 +} + +func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */ + if (a_swap(tls, (f+76 /* &.lock */), 0) & 0x40000000) != 0 { + __wake(tls, (f + 76 /* &.lock */), 1, 1) + } +} + func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ *(*int32)(unsafe.Pointer(f + 72 /* &.mode */)) |= ((*FILE)(unsafe.Pointer(f)).mode - 1) if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { @@ -3974,6 +5496,940 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ return -1 } +func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */ + var ret int32 + var ap va_list + _ = ap + ap = va + ret = Xvsscanf(tls, s, fmt, ap) + _ = ap + return ret +} + +type wctrans_t = uintptr /* wctype.h:20:19 */ + +func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */ + if !(dest != 0) { + return + } + switch size { + case -2: + *(*int8)(unsafe.Pointer(dest)) = int8(i) + break + case -1: + *(*int16)(unsafe.Pointer(dest)) = int16(i) + break + case 0: + *(*int32)(unsafe.Pointer(dest)) = int32(i) + break + case 1: + *(*int32)(unsafe.Pointer(dest)) = int32(i) + break + case 3: + *(*int64)(unsafe.Pointer(dest)) = int64(i) + break + } +} + +func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */ + var p uintptr + var i uint32 + var ap2 va_list + _ = ap2 + ap2 = ap + for i = n; i > uint32(1); i-- { + VaUintptr(&ap2) + } + p = VaUintptr(&ap2) + _ = ap2 + return p +} + +func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */ + bp := tls.Alloc(276) + defer tls.Free(276) + + var width int32 + var size int32 + var alloc int32 + var base int32 + var p uintptr + var c int32 + var t int32 + var s uintptr + var wcs uintptr + // var st mbstate_t at bp+268, 8 + + var dest uintptr + var invert int32 + var matches int32 + var x uint64 + var y float64 + var pos off_t + // var scanset [257]uint8 at bp, 257 + + var i size_t + var k size_t + // var wc wchar_t at bp+260, 4 + + var __need_unlock int32 + var tmp uintptr + var tmp1 uintptr + alloc = 0 + dest = uintptr(0) + matches = 0 + pos = int64(0) + __need_unlock = func() int32 { + if (*FILE)(unsafe.Pointer((f))).lock >= 0 { + return X__lockfile(tls, f) + } + return 0 + }() + + if !(!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0)) { + goto __1 + } + X__toread(tls, f) +__1: + ; + if !(!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0)) { + goto __2 + } + goto input_fail +__2: + ; + + p = fmt +__3: + if !(*(*uint8)(unsafe.Pointer(p)) != 0) { + goto __5 + } + + alloc = 0 + + if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) { + goto __6 + } +__7: + if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) { + goto __8 + } + p++ + goto __7 +__8: + ; + X__shlim(tls, f, int64(0)) +__9: + if !(__isspace(tls, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) != 0) { + goto __10 + } + goto __9 +__10: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) + goto __4 +__6: + ; + if !((int32(*(*uint8)(unsafe.Pointer(p))) != '%') || (int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%')) { + goto __11 + } + X__shlim(tls, f, int64(0)) + if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') { + goto __12 + } + p++ +__14: + if !(__isspace(tls, AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) != 0) { + goto __15 + } + goto __14 +__15: + ; + goto __13 +__12: + c = func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() +__13: + ; + if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) { + goto __16 + } + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(c < 0) { + goto __17 + } + goto input_fail +__17: + ; + goto match_fail +__16: + ; + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) + goto __4 +__11: + ; + + p++ + if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') { + goto __18 + } + dest = uintptr(0) + p++ + goto __19 +__18: + if !((func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) + } + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(p)))) - uint32('0')) < uint32(10))) + }() != 0) && (int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$')) { + goto __20 + } + dest = arg_n(tls, ap, (uint32(int32(*(*uint8)(unsafe.Pointer(p))) - '0'))) + p += uintptr(2) + goto __21 +__20: + dest = VaUintptr(&ap) +__21: + ; +__19: + ; + + width = 0 +__22: + if !(func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) + } + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(p)))) - uint32('0')) < uint32(10))) + }() != 0) { + goto __24 + } + width = (((10 * width) + int32(*(*uint8)(unsafe.Pointer(p)))) - '0') + goto __23 +__23: + p++ + goto __22 + goto __24 +__24: + ; + + if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') { + goto __25 + } + wcs = uintptr(0) + s = uintptr(0) + alloc = BoolInt32(!(!(dest != 0))) + p++ + goto __26 +__25: + alloc = 0 +__26: + ; + + size = 0 + switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) { + case 'h': + goto __28 + case 'l': + goto __29 + case 'j': + goto __30 + case 'z': + goto __31 + case 't': + goto __32 + case 'L': + goto __33 + case 'd': + goto __34 + case 'i': + goto __35 + case 'o': + goto __36 + case 'u': + goto __37 + case 'x': + goto __38 + case 'a': + goto __39 + case 'e': + goto __40 + case 'f': + goto __41 + case 'g': + goto __42 + case 'A': + goto __43 + case 'E': + goto __44 + case 'F': + goto __45 + case 'G': + goto __46 + case 'X': + goto __47 + case 's': + goto __48 + case 'c': + goto __49 + case '[': + goto __50 + case 'S': + goto __51 + case 'C': + goto __52 + case 'p': + goto __53 + case 'n': + goto __54 + default: + goto __55 + } + goto __27 +__28: + if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') { + goto __56 + } + p++ + size = -2 + goto __57 +__56: + size = -1 +__57: + ; + goto __27 +__29: + if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') { + goto __58 + } + p++ + size = 3 + goto __59 +__58: + size = 1 +__59: + ; + goto __27 +__30: + size = 3 + goto __27 +__31: +__32: + size = 1 + goto __27 +__33: + size = 2 + goto __27 +__34: +__35: +__36: +__37: +__38: +__39: +__40: +__41: +__42: +__43: +__44: +__45: +__46: +__47: +__48: +__49: +__50: +__51: +__52: +__53: +__54: + p-- + goto __27 +__55: + goto fmt_fail +__27: + ; + + t = int32(*(*uint8)(unsafe.Pointer(p))) + + // C or S + if !((t & 0x2f) == 3) { + goto __60 + } + t = t | (32) + size = 1 +__60: + ; + + switch t { + case 'c': + goto __62 + case '[': + goto __63 + case 'n': + goto __64 + default: + goto __65 + } + goto __61 +__62: + if !(width < 1) { + goto __66 + } + width = 1 +__66: + ; +__63: + goto __61 +__64: + store_int(tls, dest, size, uint64(pos)) + // do not increment match count, etc! + goto __4 +__65: + X__shlim(tls, f, int64(0)) +__67: + if !(__isspace(tls, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) != 0) { + goto __68 + } + goto __67 +__68: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) +__61: + ; + + X__shlim(tls, f, int64(width)) + if !((func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) < 0) { + goto __69 + } + goto input_fail +__69: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + + switch t { + case 's': + goto __71 + case 'c': + goto __72 + case '[': + goto __73 + case 'p': + goto __74 + case 'X': + goto __75 + case 'x': + goto __76 + case 'o': + goto __77 + case 'd': + goto __78 + case 'u': + goto __79 + case 'i': + goto __80 + case 'a': + goto __81 + case 'A': + goto __82 + case 'e': + goto __83 + case 'E': + goto __84 + case 'f': + goto __85 + case 'F': + goto __86 + case 'g': + goto __87 + case 'G': + goto __88 + } + goto __70 +__71: +__72: +__73: + if !((t == 'c') || (t == 's')) { + goto __89 + } + Xmemset(tls, bp /* &scanset[0] */, -1, uint32(unsafe.Sizeof([257]uint8{}))) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */)) = uint8(0) + if !(t == 's') { + goto __91 + } + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 10)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 11)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 12)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 13)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 14)) = uint8(0) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 33)) = uint8(0) +__91: + ; + goto __90 +__89: + if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') { + goto __92 + } + p++ + invert = 1 + goto __93 +__92: + invert = 0 +__93: + ; + Xmemset(tls, bp /* &scanset[0] */, invert, uint32(unsafe.Sizeof([257]uint8{}))) + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */)) = uint8(0) + if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') { + goto __94 + } + p++ + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 46)) = (uint8(1 - invert)) + goto __95 +__94: + if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') { + goto __96 + } + p++ + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + 94)) = (uint8(1 - invert)) +__96: + ; +__95: + ; +__97: + if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') { + goto __99 + } + if !(!(int32(*(*uint8)(unsafe.Pointer(p))) != 0)) { + goto __100 + } + goto fmt_fail +__100: + ; + if !(((int32(*(*uint8)(unsafe.Pointer(p))) == '-') && (*(*uint8)(unsafe.Pointer(p + 1)) != 0)) && (int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']')) { + goto __101 + } + c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1)))) +__102: + if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) { + goto __104 + } + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr((1 + c)))) = (uint8(1 - invert)) + goto __103 +__103: + c++ + goto __102 + goto __104 +__104: + ; +__101: + ; + *(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr((1 + int32(*(*uint8)(unsafe.Pointer(p))))))) = (uint8(1 - invert)) + goto __98 +__98: + p++ + goto __97 + goto __99 +__99: + ; +__90: + ; + wcs = uintptr(0) + s = uintptr(0) + i = size_t(0) + if t == 'c' { + k = (uint32(width) + 1) + } else { + k = uint32(31) + } + if !(size == 1) { + goto __105 + } + if !(alloc != 0) { + goto __107 + } + wcs = Xmalloc(tls, (k * size_t(unsafe.Sizeof(wchar_t(0))))) + if !(!(wcs != 0)) { + goto __109 + } + goto alloc_fail +__109: + ; + goto __108 +__107: + wcs = dest +__108: + ; + *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{} +__110: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __111 + } + switch Xmbrtowc(tls, bp+260 /* &wc */, func() uintptr { *(*int8)(unsafe.Pointer(bp + 264)) = int8(c); return bp + 264 }(), uint32(1), bp+268 /* &st */) { + case Uint32FromInt32(-1): + goto __113 + case Uint32FromInt32(-2): + goto __114 + } + goto __112 +__113: + goto input_fail +__114: + goto __110 +__112: + ; + if !(wcs != 0) { + goto __115 + } + *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint32(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */)) +__115: + ; + if !((alloc != 0) && (i == k)) { + goto __116 + } + k = k + (k + size_t(1)) + tmp = Xrealloc(tls, wcs, (k * size_t(unsafe.Sizeof(wchar_t(0))))) + if !(!(tmp != 0)) { + goto __117 + } + goto alloc_fail +__117: + ; + wcs = tmp +__116: + ; + goto __110 +__111: + ; + if !(!(Xmbsinit(tls, bp+268 /* &st */) != 0)) { + goto __118 + } + goto input_fail +__118: + ; + goto __106 +__105: + if !(alloc != 0) { + goto __119 + } + s = Xmalloc(tls, k) + if !(!(s != 0)) { + goto __121 + } + goto alloc_fail +__121: + ; +__122: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __123 + } + *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint32(&i, 1)))) = int8(c) + if !(i == k) { + goto __124 + } + k = k + (k + size_t(1)) + tmp1 = Xrealloc(tls, s, k) + if !(!(tmp1 != 0)) { + goto __125 + } + goto alloc_fail +__125: + ; + s = tmp1 +__124: + ; + goto __122 +__123: + ; + goto __120 +__119: + if !(AssignUintptr(&s, dest) != 0) { + goto __126 + } +__128: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __129 + } + *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint32(&i, 1)))) = int8(c) + goto __128 +__129: + ; + goto __127 +__126: +__130: + if !(*(*uint8)(unsafe.Pointer(bp /* &scanset[0] */ + uintptr(((AssignInt32(&c, func() int32 { + if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) + 1)))) != 0) { + goto __131 + } + goto __130 +__131: + ; +__127: + ; +__120: + ; +__106: + ; + if (*FILE)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(!(((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != 0)) { + goto __132 + } + goto match_fail +__132: + ; + if !((t == 'c') && (((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != off_t(width))) { + goto __133 + } + goto match_fail +__133: + ; + if !(alloc != 0) { + goto __134 + } + if !(size == 1) { + goto __135 + } + *(*uintptr)(unsafe.Pointer(dest)) = wcs + goto __136 +__135: + *(*uintptr)(unsafe.Pointer(dest)) = s +__136: + ; +__134: + ; + if !(t != 'c') { + goto __137 + } + if !(wcs != 0) { + goto __138 + } + *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = wchar_t(0) +__138: + ; + if !(s != 0) { + goto __139 + } + *(*int8)(unsafe.Pointer(s + uintptr(i))) = int8(0) +__139: + ; +__137: + ; + goto __70 +__74: +__75: +__76: + base = 16 + goto int_common +__77: + base = 8 + goto int_common +__78: +__79: + base = 10 + goto int_common +__80: + base = 0 +int_common: + x = X__intscan(tls, f, uint32(base), 0, ((2 * uint64(0x7fffffffffffffff)) + uint64(1))) + if !(!(((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != 0)) { + goto __140 + } + goto match_fail +__140: + ; + if !((t == 'p') && (dest != 0)) { + goto __141 + } + *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x)) + goto __142 +__141: + store_int(tls, dest, size, x) +__142: + ; + goto __70 +__81: +__82: +__83: +__84: +__85: +__86: +__87: +__88: + y = X__floatscan(tls, f, size, 0) + if !(!(((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) != 0)) { + goto __143 + } + goto match_fail +__143: + ; + if !(dest != 0) { + goto __144 + } + switch size { + case 0: + goto __146 + case 1: + goto __147 + case 2: + goto __148 + } + goto __145 +__146: + *(*float32)(unsafe.Pointer(dest)) = float32(y) + goto __145 +__147: + *(*float64)(unsafe.Pointer(dest)) = y + goto __145 +__148: + *(*float64)(unsafe.Pointer(dest)) = y + goto __145 +__145: + ; +__144: + ; + goto __70 +__70: + ; + + pos = pos + ((*FILE)(unsafe.Pointer((f))).shcnt + (off_t((int32((*FILE)(unsafe.Pointer((f))).rpos) - int32((*FILE)(unsafe.Pointer((f))).buf)) / 1))) + if !(dest != 0) { + goto __149 + } + matches++ +__149: + ; + goto __4 +__4: + p++ + goto __3 + goto __5 +__5: + ; + if !(0 != 0) { + goto __150 + } +fmt_fail: +alloc_fail: +input_fail: + if !(!(matches != 0)) { + goto __151 + } + matches-- +__151: + ; +match_fail: + if !(alloc != 0) { + goto __152 + } + Xfree(tls, s) + Xfree(tls, wcs) +__152: + ; +__150: + ; +__153: + if !(__need_unlock != 0) { + goto __156 + } + X__unlockfile(tls, f) +__156: + ; + goto __154 +__154: + if 0 != 0 { + goto __153 + } + goto __155 +__155: + ; + return matches +} + +func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */ + var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie + var k size_t = (len + size_t(256)) + var end uintptr = Xmemchr(tls, src, 0, k) + if end != 0 { + k = (size_t((int32(end) - int32(src)) / 1)) + } + if k < len { + len = k + } + Xmemcpy(tls, buf, src, len) + (*FILE)(unsafe.Pointer(f)).rpos = (src + uintptr(len)) + (*FILE)(unsafe.Pointer(f)).rend = (src + uintptr(k)) + (*FILE)(unsafe.Pointer(f)).cookie = (src + uintptr(k)) + return len +} + +func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */ + bp := tls.Alloc(144) + defer tls.Free(144) + + *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct { + f func(*TLS, uintptr, uintptr, size_t) size_t + }{string_read})), buf: s, lock: -1, cookie: s} + return Xvfscanf(tls, bp /* &f */, fmt, ap) +} + func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ bp := tls.Alloc(144) defer tls.Free(144) @@ -4233,5 +6689,185 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ var _sp uintptr /* strtok.c:5:14: */ +func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ + return *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 3*4)) +} + +func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ + *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 3*4)) + return 0 +} + +// +// int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) +// { +// *size = a->_a_guardsize; +// return 0; +// } +// +// int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) +// { +// *inherit = a->_a_sched; +// return 0; +// } +// +// int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) +// { +// param->sched_priority = a->_a_prio; +// return 0; +// } +// +// int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) +// { +// *policy = a->_a_policy; +// return 0; +// } +// +// int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) +// { +// *scope = PTHREAD_SCOPE_SYSTEM; +// return 0; +// } +// +// int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) +// { +// if (!a->_a_stackaddr) +// return EINVAL; +// *size = a->_a_stacksize; +// *addr = (void *)(a->_a_stackaddr - *size); +// return 0; +// } +// +// int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) +// { +// *size = a->_a_stacksize; +// return 0; +// } +// +// int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) +// { +// *pshared = !!a->__attr; +// return 0; +// } +// +// int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) +// { +// *clk = a->__attr & 0x7fffffff; +// return 0; +// } +// +// int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr>>31; +// return 0; +// } +// +// int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) +// { +// *protocol = PTHREAD_PRIO_NONE; +// return 0; +// } +// int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr / 128U % 2; +// return 0; +// } +// +// int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) +// { +// *robust = a->__attr / 4U % 2; +// return 0; +// } + +func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ + return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))) +} + +// int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) +// { +// *type = a->__attr & 3; +// return 0; +// } +// +// int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr[0]; +// return 0; +// } + +func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ + if uint32(state) > 1 { + return 22 + } + *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 3*4)) = state + return 0 +} + +func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ + return (*(*int32)(unsafe.Pointer((m /* &.__u */ /* &.__i */))) & 15) +} + +// int __pthread_mutex_lock(pthread_mutex_t *m) +// { +// if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL +// && !a_cas(&m->_m_lock, 0, EBUSY)) +// return 0; +// +// return __pthread_mutex_timedlock(m, 0); +// } +// +// weak_alias(__pthread_mutex_lock, pthread_mutex_lock); + +func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ + return 0 +} + +func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ + *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} + return 0 +} + +func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ + if uint32(type1) > uint32(2) { + return 22 + } + (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1)) + return 0 +} + +var __ctype_b_table = [...]uint16{ //TODO use symbolic constants + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x2003, 0x2002, 0x2002, 0x2002, 0x2002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x6001, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, + 0xd808, 0xd808, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc004, 0xc004, 0xc004, 0xc004, 0x0002, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +var ptable = uintptr(unsafe.Pointer(&__ctype_b_table[128])) + +// const unsigned short * * __ctype_b_loc (void); +func X__ctype_b_loc(t *TLS) uintptr { + return uintptr(unsafe.Pointer(&ptable)) +} + var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_linux_arm64.go b/vendor/modernc.org/libc/musl_linux_arm64.go index 1de3909f..5a694d22 100644 --- a/vendor/modernc.org/libc/musl_linux_arm64.go +++ b/vendor/modernc.org/libc/musl_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_arm64.go -pkgname libc -static-locals-prefix _s -Iarch/aarch64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c', DO NOT EDIT. +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_arm64.go -pkgname libc -static-locals-prefix _s -Iarch/aarch64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. package libc @@ -1899,6 +1899,34 @@ func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ return X__builtin_nanf(tls, ts+13 /* "" */) } +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ bp := tls.Alloc(8) defer tls.Free(8) @@ -2356,10 +2384,10 @@ func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */ } func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ - return int32(_sdebruijn322[(((x & -x) * uint32_t(0x076be629)) >> 27)]) + return int32(_sdebruijn328[(((x & -x) * uint32_t(0x076be629)) >> 27)]) } -var _sdebruijn322 = [32]int8{ +var _sdebruijn328 = [32]int8{ int8(0), int8(1), int8(23), int8(2), int8(29), int8(24), int8(19), int8(3), int8(30), int8(27), int8(25), int8(11), int8(20), int8(8), int8(4), int8(13), int8(31), int8(22), int8(28), int8(18), int8(26), int8(10), int8(7), int8(12), int8(21), int8(17), int8(9), int8(6), int8(16), int8(5), int8(15), int8(14), } /* atomic.h:261:20 */ @@ -4279,6 +4307,10 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, return 0 } +func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ + return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) +} + type if_nameindex = struct { if_index uint32 _ [4]byte @@ -4428,11 +4460,11 @@ type __res_state = struct { defdname [256]int8 pfcode uint64 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ + _ [4]byte sort_list [10]struct { addr struct{ s_addr in_addr_t } mask uint32_t } - _ [4]byte qhook uintptr rhook uintptr res_h_errno int32 @@ -4710,15 +4742,15 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5 switch i { case 0: *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */)) & uint64(0xffffff)) - AssignShrPtrUint64(bp /* &a */, int(uint64(24))) + AssignShrPtrUint64(bp /* &a */, int(24)) fallthrough case 1: *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) & uint64(0xffff)) - AssignShrPtrUint64(bp /* &a */ +1*8, int(uint64(16))) + AssignShrPtrUint64(bp /* &a */ +1*8, int(16)) fallthrough case 2: *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 3*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) & uint64(0xff)) - AssignShrPtrUint64(bp /* &a */ +2*8, int(uint64(8))) + AssignShrPtrUint64(bp /* &a */ +2*8, int(8)) } for i = 0; i < 4; i++ { if *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) > uint64(255) { @@ -6767,5 +6799,185 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ var _sp uintptr /* strtok.c:5:14: */ +func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ + return *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4)) +} + +func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ + *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4)) + return 0 +} + +// +// int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) +// { +// *size = a->_a_guardsize; +// return 0; +// } +// +// int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) +// { +// *inherit = a->_a_sched; +// return 0; +// } +// +// int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) +// { +// param->sched_priority = a->_a_prio; +// return 0; +// } +// +// int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) +// { +// *policy = a->_a_policy; +// return 0; +// } +// +// int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) +// { +// *scope = PTHREAD_SCOPE_SYSTEM; +// return 0; +// } +// +// int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) +// { +// if (!a->_a_stackaddr) +// return EINVAL; +// *size = a->_a_stacksize; +// *addr = (void *)(a->_a_stackaddr - *size); +// return 0; +// } +// +// int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) +// { +// *size = a->_a_stacksize; +// return 0; +// } +// +// int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) +// { +// *pshared = !!a->__attr; +// return 0; +// } +// +// int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) +// { +// *clk = a->__attr & 0x7fffffff; +// return 0; +// } +// +// int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr>>31; +// return 0; +// } +// +// int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) +// { +// *protocol = PTHREAD_PRIO_NONE; +// return 0; +// } +// int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr / 128U % 2; +// return 0; +// } +// +// int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) +// { +// *robust = a->__attr / 4U % 2; +// return 0; +// } + +func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ + return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))) +} + +// int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) +// { +// *type = a->__attr & 3; +// return 0; +// } +// +// int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) +// { +// *pshared = a->__attr[0]; +// return 0; +// } + +func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ + if uint32(state) > 1 { + return 22 + } + *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4)) = state + return 0 +} + +func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ + return (*(*int32)(unsafe.Pointer((m /* &.__u */ /* &.__i */))) & 15) +} + +// int __pthread_mutex_lock(pthread_mutex_t *m) +// { +// if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL +// && !a_cas(&m->_m_lock, 0, EBUSY)) +// return 0; +// +// return __pthread_mutex_timedlock(m, 0); +// } +// +// weak_alias(__pthread_mutex_lock, pthread_mutex_lock); + +func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ + return 0 +} + +func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ + *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} + return 0 +} + +func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ + if uint32(type1) > uint32(2) { + return 22 + } + (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1)) + return 0 +} + +var __ctype_b_table = [...]uint16{ //TODO use symbolic constants + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x2003, 0x2002, 0x2002, 0x2002, 0x2002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, + 0x6001, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, 0xd808, + 0xd808, 0xd808, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xd508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, 0xc508, + 0xc508, 0xc508, 0xc508, 0xc004, 0xc004, 0xc004, 0xc004, 0xc004, + 0xc004, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xd608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, 0xc608, + 0xc608, 0xc608, 0xc608, 0xc004, 0xc004, 0xc004, 0xc004, 0x0002, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +} + +var ptable = uintptr(unsafe.Pointer(&__ctype_b_table[128])) + +// const unsigned short * * __ctype_b_loc (void); +func X__ctype_b_loc(t *TLS) uintptr { + return uintptr(unsafe.Pointer(&ptable)) +} + var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_linux_s390x.go b/vendor/modernc.org/libc/musl_linux_s390x.go index 17a92810..6caa677a 100644 --- a/vendor/modernc.org/libc/musl_linux_s390x.go +++ b/vendor/modernc.org/libc/musl_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_s390x.go -pkgname libc -static-locals-prefix _s -Iarch/s390x -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_s390x.go -pkgname libc -static-locals-prefix _s -Iarch/s390x -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/__ctype_b_loc.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. package libc @@ -363,6 +363,49 @@ type size_t = uint64 /* :9:23 */ type wchar_t = int32 /* :15:24 */ +type uint16_t = uint16 /* alltypes.h:113:25 */ + +type uint32_t = uint32 /* alltypes.h:118:25 */ + +type uint64_t = uint64 /* alltypes.h:123:25 */ + +func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ + return ((((__x >> 24) | ((__x >> 8) & uint32_t(0xff00))) | ((__x << 8) & uint32_t(0xff0000))) | (__x << 24)) +} + +var table = [384]uint16{ + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), + uint16(0x200), uint16(0x320), uint16(0x220), uint16(0x220), uint16(0x220), uint16(0x220), uint16(0x200), uint16(0x200), + uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), + uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), + uint16(0x160), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), + uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), + uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), + uint16(0x8d8), uint16(0x8d8), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), + uint16(0x4c0), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8c5), + uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), + uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), + uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), + uint16(0x4c0), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8c6), + uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), + uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), + uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x200), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), + uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), +} /* __ctype_b_loc.c:9:29 */ + +var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */ + +func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */ + return uintptr(unsafe.Pointer(&ptable)) +} + func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ return (Bool32((_c == ' ') || ((uint32(_c) - uint32('\t')) < uint32(5)))) } @@ -451,7 +494,7 @@ type dirent = struct { d_off off_t d_reclen uint16 d_type uint8 - d_name [256]int8 + d_name [256]uint8 _ [5]byte } /* dirent.h:5:1 */ @@ -461,7 +504,7 @@ type __dirstream = struct { buf_pos int32 buf_end int32 lock [1]int32 - buf [2048]int8 + buf [2048]uint8 } /* dirent.h:20:9 */ type DIR = __dirstream /* dirent.h:20:28 */ @@ -535,7 +578,7 @@ func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */ return uintptr(0) } if !(int32(AssignUintptr(&dir, Xcalloc(tls, uint64(1), uint64(unsafe.Sizeof(DIR{}))))) != 0) { - X__syscall1(tls, int64(6), int64(fd)) + __syscall1(tls, int64(6), int64(fd)) return uintptr(0) } (*DIR)(unsafe.Pointer(dir)).fd = fd @@ -547,13 +590,13 @@ type max_align_t = struct { __ld float64 } /* alltypes.h:28:54 */ -type dirstream_buf_alignment_check = [1]int8 /* readdir.c:7:14 */ +type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */ func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */ var de uintptr if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end { - var len int32 = int32(X__syscall3(tls, int64(220), int64((*DIR)(unsafe.Pointer(dir)).fd), int64(dir+24 /* &.buf */), int64(unsafe.Sizeof([2048]int8{})))) + var len int32 = int32(__syscall3(tls, int64(220), int64((*DIR)(unsafe.Pointer(dir)).fd), int64(dir+24 /* &.buf */), int64(unsafe.Sizeof([2048]uint8{})))) if len <= 0 { if (len < 0) && (len != -2) { (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = -len @@ -583,12 +626,6 @@ type intmax_t = int64 /* alltypes.h:103:25 */ type uint8_t = uint8 /* alltypes.h:108:25 */ -type uint16_t = uint16 /* alltypes.h:113:25 */ - -type uint32_t = uint32 /* alltypes.h:118:25 */ - -type uint64_t = uint64 /* alltypes.h:123:25 */ - type uintmax_t = uint64 /* alltypes.h:133:25 */ type int_fast8_t = int8_t /* stdint.h:22:16 */ @@ -654,7 +691,7 @@ type va_list = uintptr /* alltypes.h:313:27 */ type _G_fpos64_t = struct { _ [0]uint64 - __opaque [16]int8 + __opaque [16]uint8 } /* stdio.h:54:9 */ type fpos_t = _G_fpos64_t /* stdio.h:58:3 */ @@ -1360,7 +1397,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* float }() } - for i = uint64(0); (i < uint64(8)) && ((c | 32) == int32(*(*int8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i))))); i++ { + for i = uint64(0); (i < uint64(8)) && ((c | 32) == int32(*(*uint8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i))))); i++ { if i < uint64(7) { c = func() int32 { if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { @@ -1388,7 +1425,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* float return (float64(float32(sign) * X__builtin_inff(tls))) } if !(i != 0) { - for i = uint64(0); (i < uint64(3)) && ((c | 32) == int32(*(*int8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i))))); i++ { + for i = uint64(0); (i < uint64(3)) && ((c | 32) == int32(*(*uint8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i))))); i++ { if i < uint64(2) { c = func() int32 { if (*FILE)(unsafe.Pointer((f))).rpos != (*FILE)(unsafe.Pointer((f))).shend { @@ -1476,7 +1513,7 @@ func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* float } // Lookup table for digit values. -1==255>=36 -> invalid -var table = [257]uint8{Uint8FromInt32(-1), +var table1 = [257]uint8{Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), @@ -1502,7 +1539,7 @@ func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 var x uint32 var y uint64 var bs int32 - val = (uintptr(unsafe.Pointer(&table)) + uintptr(1)) + val = (uintptr(unsafe.Pointer(&table1)) + uintptr(1)) neg = 0 if !((base > uint32(36)) || (base == uint32(1))) { goto __1 @@ -1658,7 +1695,7 @@ __15: if !(!((base & (base - uint32(1))) != 0)) { goto __24 } - bs = int32(*(*int8)(unsafe.Pointer(ts + 14 /* "\x00\x01\x02\x04\a\x03\x06\x05" */ + uintptr((((uint32(0x17) * base) >> 5) & uint32(7)))))) + bs = int32(*(*uint8)(unsafe.Pointer(ts + 14 /* "\x00\x01\x02\x04\a\x03\x06\x05" */ + uintptr((((uint32(0x17) * base) >> 5) & uint32(7)))))) x = uint32(0) __26: if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (x <= (0xffffffff / uint32(32)))) { @@ -1875,10 +1912,6 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */ return 4 } -func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ - return ((((__x >> 24) | ((__x >> 8) & uint32_t(0xff00))) | ((__x << 8) & uint32_t(0xff0000))) | (__x << 24)) -} - func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */ return X__fpclassify(tls, x) } @@ -1899,6 +1932,34 @@ func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ return X__builtin_nanf(tls, ts+13 /* "" */) } +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ bp := tls.Alloc(8) defer tls.Free(8) @@ -1959,20 +2020,20 @@ type lconv = struct { mon_grouping uintptr positive_sign uintptr negative_sign uintptr - int_frac_digits int8 - frac_digits int8 - p_cs_precedes int8 - p_sep_by_space int8 - n_cs_precedes int8 - n_sep_by_space int8 - p_sign_posn int8 - n_sign_posn int8 - int_p_cs_precedes int8 - int_p_sep_by_space int8 - int_n_cs_precedes int8 - int_n_sep_by_space int8 - int_p_sign_posn int8 - int_n_sign_posn int8 + int_frac_digits uint8 + frac_digits uint8 + p_cs_precedes uint8 + p_sep_by_space uint8 + n_cs_precedes uint8 + n_sep_by_space uint8 + p_sign_posn uint8 + n_sign_posn uint8 + int_p_cs_precedes uint8 + int_p_sep_by_space uint8 + int_n_cs_precedes uint8 + int_n_sep_by_space uint8 + int_p_sign_posn uint8 + int_n_sign_posn uint8 _ [2]byte } /* locale.h:24:1 */ @@ -1988,7 +2049,7 @@ type lconv = struct { type __locale_map = struct { __map uintptr map_size size_t - name [24]int8 + name [24]uint8 next uintptr } /* alltypes.h:330:9 */ @@ -2002,9 +2063,9 @@ type tls_module = struct { } /* libc.h:14:1 */ type __libc = struct { - can_do_threads int8 - threaded int8 - secure int8 + can_do_threads uint8 + threaded uint8 + secure uint8 need_locks int8 threads_minus_1 int32 auxv uintptr @@ -2131,7 +2192,7 @@ type sigevent = struct { sigev_notify int32 sigev_notify_function uintptr sigev_notify_attributes uintptr - __pad [32]int8 + __pad [32]uint8 } /* time.h:107:1 */ type __ptcb = struct { @@ -2198,7 +2259,7 @@ type siginfo_t = struct { _ [4]byte __si_fields struct { _ [0]uint64 - __pad [112]int8 + __pad [112]uint8 } } /* signal.h:145:3 */ @@ -2280,9 +2341,9 @@ func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ return int32(_sdebruijn328[(((x & -x) * uint32_t(0x076be629)) >> 27)]) } -var _sdebruijn328 = [32]int8{ - int8(0), int8(1), int8(23), int8(2), int8(29), int8(24), int8(19), int8(3), int8(30), int8(27), int8(25), int8(11), int8(20), int8(8), int8(4), int8(13), - int8(31), int8(22), int8(28), int8(18), int8(26), int8(10), int8(7), int8(12), int8(21), int8(17), int8(9), int8(6), int8(16), int8(5), int8(15), int8(14), +var _sdebruijn328 = [32]uint8{ + uint8(0), uint8(1), uint8(23), uint8(2), uint8(29), uint8(24), uint8(19), uint8(3), uint8(30), uint8(27), uint8(25), uint8(11), uint8(20), uint8(8), uint8(4), uint8(13), + uint8(31), uint8(22), uint8(28), uint8(18), uint8(26), uint8(10), uint8(7), uint8(12), uint8(21), uint8(17), uint8(9), uint8(6), uint8(16), uint8(5), uint8(15), uint8(14), } /* atomic.h:261:20 */ func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic.h:272:19: */ @@ -2297,11 +2358,11 @@ func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic.h:272:19: */ return int32(_sdebruijn648[(((uint64(x & -x)) * 0x022fdd63cc95386d) >> 58)]) } -var _sdebruijn648 = [64]int8{ - int8(0), int8(1), int8(2), int8(53), int8(3), int8(7), int8(54), int8(27), int8(4), int8(38), int8(41), int8(8), int8(34), int8(55), int8(48), int8(28), - int8(62), int8(5), int8(39), int8(46), int8(44), int8(42), int8(22), int8(9), int8(24), int8(35), int8(59), int8(56), int8(49), int8(18), int8(29), int8(11), - int8(63), int8(52), int8(6), int8(26), int8(37), int8(40), int8(33), int8(47), int8(61), int8(45), int8(43), int8(21), int8(23), int8(58), int8(17), int8(10), - int8(51), int8(25), int8(36), int8(32), int8(60), int8(20), int8(57), int8(16), int8(50), int8(31), int8(19), int8(15), int8(30), int8(14), int8(13), int8(12), +var _sdebruijn648 = [64]uint8{ + uint8(0), uint8(1), uint8(2), uint8(53), uint8(3), uint8(7), uint8(54), uint8(27), uint8(4), uint8(38), uint8(41), uint8(8), uint8(34), uint8(55), uint8(48), uint8(28), + uint8(62), uint8(5), uint8(39), uint8(46), uint8(44), uint8(42), uint8(22), uint8(9), uint8(24), uint8(35), uint8(59), uint8(56), uint8(49), uint8(18), uint8(29), uint8(11), + uint8(63), uint8(52), uint8(6), uint8(26), uint8(37), uint8(40), uint8(33), uint8(47), uint8(61), uint8(45), uint8(43), uint8(21), uint8(23), uint8(58), uint8(17), uint8(10), + uint8(51), uint8(25), uint8(36), uint8(32), uint8(60), uint8(20), uint8(57), uint8(16), uint8(50), uint8(31), uint8(19), uint8(15), uint8(30), uint8(14), uint8(13), uint8(12), } /* atomic.h:274:20 */ type __timer = struct { @@ -2323,14 +2384,14 @@ func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:1 if cnt < 0 { cnt = 0x7fffffff } - _ = (Bool32((X__syscall3(tls, int64(238), int64(AtomicLoadUintptr(&addr)), (int64(1|priv)), int64(cnt)) != int64(-38)) || (X__syscall3(tls, int64(238), int64(AtomicLoadUintptr(&addr)), int64(1), int64(cnt)) != 0))) + _ = (Bool32((__syscall3(tls, int64(238), int64(AtomicLoadUintptr(&addr)), (int64(1|priv)), int64(cnt)) != int64(-38)) || (__syscall3(tls, int64(238), int64(AtomicLoadUintptr(&addr)), int64(1), int64(cnt)) != 0))) } func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ if priv != 0 { priv = 128 } - _ = (Bool32((X__syscall4(tls, int64(238), int64(AtomicLoadUintptr(&addr)), (int64(0|priv)), int64(val), int64(0)) != int64(-38)) || (X__syscall4(tls, int64(238), int64(AtomicLoadUintptr(&addr)), int64(0), int64(val), int64(0)) != 0))) + _ = (Bool32((__syscall4(tls, int64(238), int64(AtomicLoadUintptr(&addr)), (int64(0|priv)), int64(val), int64(0)) != int64(-38)) || (__syscall4(tls, int64(238), int64(AtomicLoadUintptr(&addr)), int64(0), int64(val), int64(0)) != 0))) } var X__fsmu8 = [51]uint32_t{ @@ -3498,12 +3559,12 @@ type linger = struct { type sockaddr = struct { sa_family sa_family_t - sa_data [14]int8 + sa_data [14]uint8 } /* socket.h:367:1 */ type sockaddr_storage = struct { ss_family sa_family_t - __ss_padding [118]int8 + __ss_padding [118]uint8 __ss_align uint64 } /* socket.h:372:1 */ @@ -3550,7 +3611,7 @@ type ipv6_mreq = struct { type ip_opts = struct { ip_dst struct{ s_addr in_addr_t } - ip_opts [40]int8 + ip_opts [40]uint8 } /* in.h:229:1 */ type ip_mreq = struct { @@ -3583,7 +3644,7 @@ type group_req = struct { _ [4]byte gr_group struct { ss_family sa_family_t - __ss_padding [118]int8 + __ss_padding [118]uint8 __ss_align uint64 } } /* in.h:275:1 */ @@ -3593,12 +3654,12 @@ type group_source_req = struct { _ [4]byte gsr_group struct { ss_family sa_family_t - __ss_padding [118]int8 + __ss_padding [118]uint8 __ss_align uint64 } gsr_source struct { ss_family sa_family_t - __ss_padding [118]int8 + __ss_padding [118]uint8 __ss_align uint64 } } /* in.h:280:1 */ @@ -3608,14 +3669,14 @@ type group_filter = struct { _ [4]byte gf_group struct { ss_family sa_family_t - __ss_padding [118]int8 + __ss_padding [118]uint8 __ss_align uint64 } gf_fmode uint32_t gf_numsrc uint32_t gf_slist [1]struct { ss_family sa_family_t - __ss_padding [118]int8 + __ss_padding [118]uint8 __ss_align uint64 } } /* in.h:286:1 */ @@ -3791,7 +3852,7 @@ func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintpt // var addrs [48]address at bp+8, 1344 - // var canon [256]int8 at bp+1352, 256 + // var canon [256]uint8 at bp+1352, 256 var outcanon uintptr var nservs int32 @@ -4134,7 +4195,7 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, // var addrs [48]address at bp, 1344 - // var canon [256]int8 at bp+1344, 256 + // var canon [256]uint8 at bp+1344, 256 var i int32 var cnt int32 @@ -4232,12 +4293,12 @@ type if_nameindex = struct { type ifaddr = struct { ifa_addr struct { sa_family sa_family_t - sa_data [14]int8 + sa_data [14]uint8 } ifa_ifu struct { ifu_broadaddr struct { sa_family sa_family_t - sa_data [14]int8 + sa_data [14]uint8 } } ifa_ifp uintptr @@ -4255,12 +4316,12 @@ type ifmap = struct { } /* if.h:64:1 */ type ifreq = struct { - ifr_ifrn struct{ ifrn_name [16]int8 } + ifr_ifrn struct{ ifrn_name [16]uint8 } ifr_ifru struct { _ [0]uint64 ifru_addr struct { sa_family sa_family_t - sa_data [14]int8 + sa_data [14]uint8 } _ [8]byte } @@ -4295,7 +4356,7 @@ type _ns_flagdata = struct { } /* nameser.h:48:1 */ type __ns_rr = struct { - name [1025]int8 + name [1025]uint8 _ [1]byte __type uint16_t rr_class uint16_t @@ -4317,8 +4378,8 @@ type ns_rcode = uint32 /* nameser.h:115:3 */ type ns_update_operation = uint32 /* nameser.h:121:3 */ type ns_tsig_key1 = struct { - name [1025]int8 - alg [1025]int8 + name [1025]uint8 + alg [1025]uint8 _ [6]byte data uintptr len int32 @@ -4369,7 +4430,7 @@ type __res_state = struct { id uint16 _ [2]byte dnsrch [7]uintptr - defdname [256]int8 + defdname [256]uint8 pfcode uint64 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ _ [4]byte @@ -4385,7 +4446,7 @@ type __res_state = struct { _ [4]byte _u struct { _ [0]uint64 - pad [52]int8 + pad [52]uint8 _ [4]byte } } /* resolv.h:26:9 */ @@ -4402,9 +4463,9 @@ type res_sym = struct { func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ p += (uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0))))) - *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0) + *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(0) for ok := true; ok; ok = x != 0 { - *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = (int8(uint32('0') + (x % uint32(10)))) + *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = (uint8(uint32('0') + (x % uint32(10)))) x = x / (uint32(10)) } return p @@ -4421,21 +4482,21 @@ func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ var i int32 for i = 15; i >= 0; i-- { - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) & 15)] - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) >> 4)] - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') + *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) & 15)] + *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.') + *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) >> 4)] + *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.') } Xstrcpy(tls, s, ts+48 /* "ip6.arpa" */) } -var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 57 /* "0123456789abcdef" */)) /* getnameinfo.c:36:20 */ +var _sxdigits = *(*[17]uint8)(unsafe.Pointer(ts + 57 /* "0123456789abcdef" */)) /* getnameinfo.c:36:20 */ func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ bp := tls.Alloc(556) defer tls.Free(556) - // var line [512]int8 at bp+16, 512 + // var line [512]uint8 at bp+16, 512 var p uintptr var z uintptr @@ -4455,15 +4516,15 @@ func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int3 Xmemcpy(tls, bp /* &atmp[0] */, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) a = bp /* &atmp[0] */ } - for Xfgets(tls, bp+16 /* &line[0] */, int32(unsafe.Sizeof([512]int8{})), f) != 0 { + for Xfgets(tls, bp+16 /* &line[0] */, int32(unsafe.Sizeof([512]uint8{})), f) != 0 { if AssignUintptr(&p, Xstrchr(tls, bp+16 /* &line[0] */, '#')) != 0 { - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') - *(*int8)(unsafe.Pointer(p)) = int8(0) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n') + *(*uint8)(unsafe.Pointer(p)) = uint8(0) } - for p = bp + 16; /* &line[0] */ (*(*int8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + for p = bp + 16; /* &line[0] */ (*(*uint8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { } - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0) if X__lookup_ipliteral(tls, bp+528 /* &iplit */, bp+16 /* &line[0] */, 0) <= 0 { continue } @@ -4478,11 +4539,11 @@ func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int3 continue } - for ; (*(*int8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + for ; (*(*uint8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { } - for z = p; (*(*int8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { + for z = p; (*(*uint8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ { } - *(*int8)(unsafe.Pointer(z)) = int8(0) + *(*uint8)(unsafe.Pointer(z)) = uint8(0) if ((int64(z) - int64(p)) / 1) < int64(256) { Xmemcpy(tls, buf, p, (uint64(((int64(z) - int64(p)) / 1) + int64(1)))) break @@ -4522,11 +4583,11 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc bp := tls.Alloc(347) defer tls.Free(347) - // var ptr [78]int8 at bp, 78 + // var ptr [78]uint8 at bp, 78 - // var buf [256]int8 at bp+78, 256 + // var buf [256]uint8 at bp+78, 256 - // var num [13]int8 at bp+334, 13 + // var num [13]uint8 at bp+334, 13 var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) var a uintptr @@ -4558,11 +4619,11 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc } if (node != 0) && (nodelen != 0) { - *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + *(*uint8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = uint8(0) if !((flags & 0x01) != 0) { reverse_hosts(tls, bp+78 /* &buf[0] */, a, scopeid, af) } - if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) && !((flags & 0x01) != 0) { Xabort(tls) //TODO- // unsigned char query[18+PTR_MAX], reply[512]; // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, @@ -4573,11 +4634,11 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc // if (rlen > 0) // __dns_parse(reply, rlen, dns_parse_callback, buf); } - if !(int32(*(*int8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(bp + 78 /* buf */))) != 0) { if (flags & 0x08) != 0 { return -2 } - Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]int8{}))) + Xinet_ntop(tls, af, a, bp+78 /* &buf[0] */, uint32(unsafe.Sizeof([256]uint8{}))) if scopeid != 0 { Xabort(tls) //TODO- // char *p = 0, tmp[IF_NAMESIZE+1]; @@ -4600,11 +4661,11 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc if (serv != 0) && (servlen != 0) { var p uintptr = bp + 78 /* buf */ var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) - *(*int8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = int8(0) + *(*uint8)(unsafe.Pointer(bp + 78 /* &buf[0] */)) = uint8(0) if !((flags & 0x02) != 0) { reverse_services(tls, bp+78 /* &buf[0] */, port, (flags & 0x10)) } - if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { p = itoa(tls, bp+334 /* &num[0] */, uint32(port)) } if Xstrlen(tls, p) >= size_t(servlen) { @@ -4635,15 +4696,15 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5 for i = 0; i < 4; i++ { *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32 /* &z */, 0) - if ((*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) == s) || ((*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)))) != 0) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != '.'))) || !(func() int32 { + if ((*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) == s) || ((*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)))) != 0) && (int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != '.'))) || !(func() int32 { if 0 != 0 { - return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s)))) + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s)))) } - return (Bool32(((uint32(*(*int8)(unsafe.Pointer(s)))) - uint32('0')) < uint32(10))) + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(s)))) - uint32('0')) < uint32(10))) }() != 0) { return 0 } - if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != 0) { break } s = (*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) + uintptr(1)) @@ -4682,7 +4743,7 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr var j int32 var max int32 var best int32 - // var buf [100]int8 at bp+176, 100 + // var buf [100]uint8 at bp+176, 100 switch af { case 2: @@ -4692,14 +4753,14 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr break case 10: if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { - Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]int8{})), + Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]uint8{})), ts+113, /* "%x:%x:%x:%x:%x:%..." */ VaList(bp+32, ((256*int32(*(*uint8)(unsafe.Pointer(a))))+int32(*(*uint8)(unsafe.Pointer(a + 1)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 2))))+int32(*(*uint8)(unsafe.Pointer(a + 3)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 4))))+int32(*(*uint8)(unsafe.Pointer(a + 5)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 6))))+int32(*(*uint8)(unsafe.Pointer(a + 7)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 8))))+int32(*(*uint8)(unsafe.Pointer(a + 9)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 10))))+int32(*(*uint8)(unsafe.Pointer(a + 11)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 12))))+int32(*(*uint8)(unsafe.Pointer(a + 13)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 14))))+int32(*(*uint8)(unsafe.Pointer(a + 15)))))) } else { - Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]int8{})), + Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]uint8{})), ts+137, /* "%x:%x:%x:%x:%x:%..." */ VaList(bp+96, ((256*int32(*(*uint8)(unsafe.Pointer(a))))+int32(*(*uint8)(unsafe.Pointer(a + 1)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 2))))+int32(*(*uint8)(unsafe.Pointer(a + 3)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 4))))+int32(*(*uint8)(unsafe.Pointer(a + 5)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 6))))+int32(*(*uint8)(unsafe.Pointer(a + 7)))), @@ -4709,8 +4770,8 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr // Replace longest /(^0|:)[:0]{2,}/ with "::" i = AssignInt32(&best, 0) max = 2 - for ; *(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i))) != 0; i++ { - if (i != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i)))) != ':') { + for ; *(*uint8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i))) != 0; i++ { + if (i != 0) && (int32(*(*uint8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i)))) != ':') { continue } j = int32(Xstrspn(tls, (bp + 176 /* &buf[0] */ + uintptr(i)), ts+167 /* ":0" */)) @@ -4720,7 +4781,7 @@ func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr } } if max > 3 { - *(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(best))) = AssignPtrInt8(bp+176 /* &buf */ +uintptr((best+1)), int8(':')) + *(*uint8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(best))) = AssignPtrUint8(bp+176 /* &buf */ +uintptr((best+1)), uint8(':')) Xmemmove(tls, ((bp + 176 /* &buf[0] */ + uintptr(best)) + uintptr(2)), ((bp + 176 /* &buf[0] */ + uintptr(best)) + uintptr(max)), (uint64(((i - best) - max) + 1))) } if Xstrlen(tls, bp+176 /* &buf[0] */) < size_t(l) { @@ -4765,20 +4826,20 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton. for i = 0; i < 4; i++ { for v = AssignInt32(&j, 0); (j < 3) && (func() int32 { if 0 != 0 { - return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))) } - return (Bool32(((uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - uint32('0')) < uint32(10))) + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))) - uint32('0')) < uint32(10))) }() != 0); j++ { - v = (((10 * v) + int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - '0') + v = (((10 * v) + int32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))) - '0') } - if ((j == 0) || ((j > 1) && (int32(*(*int8)(unsafe.Pointer(s))) == '0'))) || (v > 255) { + if ((j == 0) || ((j > 1) && (int32(*(*uint8)(unsafe.Pointer(s))) == '0'))) || (v > 255) { return 0 } *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) - if (int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0) && (i == 3) { + if (int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) == 0) && (i == 3) { return 1 } - if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' { + if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' { return 0 } s += (uintptr(j + 1)) @@ -4789,15 +4850,15 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton. return -1 } - if (int32(*(*int8)(unsafe.Pointer(s))) == ':') && (int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':') { + if (int32(*(*uint8)(unsafe.Pointer(s))) == ':') && (int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':') { return 0 } for i = 0; ; i++ { - if (int32(*(*int8)(unsafe.Pointer(s))) == ':') && (brk < 0) { + if (int32(*(*uint8)(unsafe.Pointer(s))) == ':') && (brk < 0) { brk = i *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((i&7))*2)) = uint16_t(0) - if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { break } if i == 7 { @@ -4805,21 +4866,21 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton. } continue } - for v = AssignInt32(&j, 0); (j < 4) && ((AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))))) >= 0); j++ { + for v = AssignInt32(&j, 0); (j < 4) && ((AssignInt32(&d, hexval(tls, uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))))) >= 0); j++ { v = ((16 * v) + d) } if j == 0 { return 0 } *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((i&7))*2)) = uint16_t(v) - if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && ((brk >= 0) || (i == 7)) { + if !(int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != 0) && ((brk >= 0) || (i == 7)) { break } if i == 7 { return 0 } - if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' { - if (int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.') || ((i < 6) && (brk < 0)) { + if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != ':' { + if (int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.') || ((i < 6) && (brk < 0)) { return 0 } need_v4 = 1 @@ -4861,7 +4922,7 @@ func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int3 (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) return 1 } - // var tmp [64]int8 at bp+4, 64 + // var tmp [64]uint8 at bp+4, 64 var p uintptr = Xstrchr(tls, name, '%') // var z uintptr at bp+88, 8 @@ -4869,7 +4930,7 @@ func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int3 var scopeid uint64 = uint64(0) if (p != 0) && (((int64(p) - int64(name)) / 1) < int64(64)) { Xmemcpy(tls, bp+4 /* &tmp[0] */, name, (uint64((int64(p) - int64(name)) / 1))) - *(*int8)(unsafe.Pointer(bp + 4 /* &tmp[0] */ + uintptr(((int64(p) - int64(name)) / 1)))) = int8(0) + *(*uint8)(unsafe.Pointer(bp + 4 /* &tmp[0] */ + uintptr(((int64(p) - int64(name)) / 1)))) = uint8(0) name = bp + 4 /* &tmp[0] */ } @@ -4885,15 +4946,15 @@ func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int3 if p != 0 { if func() int32 { if 0 != 0 { - return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) + return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) } - return (Bool32(((uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) - uint32('0')) < uint32(10))) + return (Bool32(((uint32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) - uint32('0')) < uint32(10))) }() != 0 { scopeid = Xstrtoull(tls, p, bp+88 /* &z */, 10) } else { *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = (p - uintptr(1)) } - if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88 /* z */)))) != 0 { + if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88 /* z */)))) != 0 { Xabort(tls) //TODO- // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) @@ -4960,7 +5021,7 @@ func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family bp := tls.Alloc(512) defer tls.Free(512) - // var line [512]int8 at bp, 512 + // var line [512]uint8 at bp, 512 var l size_t = Xstrlen(tls, name) var cnt int32 = 0 @@ -4984,24 +5045,24 @@ func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family return -11 } } - for (Xfgets(tls, bp /* &line[0] */, int32(unsafe.Sizeof([512]int8{})), f) != 0) && (cnt < 48) { + for (Xfgets(tls, bp /* &line[0] */, int32(unsafe.Sizeof([512]uint8{})), f) != 0) && (cnt < 48) { var p uintptr var z uintptr if AssignUintptr(&p, Xstrchr(tls, bp /* &line[0] */, '#')) != 0 { - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') - *(*int8)(unsafe.Pointer(p)) = int8(0) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n') + *(*uint8)(unsafe.Pointer(p)) = uint8(0) } - for p = (bp /* &line[0] */ + uintptr(1)); (AssignUintptr(&p, Xstrstr(tls, p, name)) != 0) && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { + for p = (bp /* &line[0] */ + uintptr(1)); (AssignUintptr(&p, Xstrstr(tls, p, name)) != 0) && (!(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { } if !(p != 0) { continue } // Isolate IP address to parse - for p = bp; /* &line[0] */ (*(*int8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + for p = bp; /* &line[0] */ (*(*uint8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { } - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0) switch name_from_numeric(tls, (buf + uintptr(cnt)*28), bp /* &line[0] */, family) { case 1: cnt++ @@ -5014,11 +5075,11 @@ func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family } // Extract first name as canonical name - for ; (*(*int8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + for ; (*(*uint8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { } - for z = p; (*(*int8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { + for z = p; (*(*uint8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ { } - *(*int8)(unsafe.Pointer(z)) = int8(0) + *(*uint8)(unsafe.Pointer(z)) = uint8(0) if is_valid_hostname(tls, p) != 0 { Xmemcpy(tls, canon, p, (uint64(((int64(z) - int64(p)) / 1) + int64(1)))) } @@ -5163,7 +5224,7 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i var j int32 _ = j - *(*int8)(unsafe.Pointer(canon)) = int8(0) + *(*uint8)(unsafe.Pointer(canon)) = uint8(0) if name != 0 { // reject empty name and check len so it fits into temp bufs var l size_t = Xstrnlen(tls, name, uint64(255)) @@ -5324,7 +5385,7 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i bp := tls.Alloc(8) defer tls.Free(8) - var line [128]int8 + var line [128]uint8 _ = line var cnt int32 = 0 var p uintptr @@ -5368,12 +5429,12 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i } if name != 0 { - if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(name))) != 0) { return -8 } port = Xstrtoul(tls, name, bp /* &z */, 10) } - if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* z */))))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* z */))))) != 0) { if port > uint64(65535) { return -8 } @@ -5536,7 +5597,7 @@ func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:1 } switch size { case -2: - *(*int8)(unsafe.Pointer(dest)) = int8(i) + *(*uint8)(unsafe.Pointer(dest)) = uint8(i) break case -1: *(*int16)(unsafe.Pointer(dest)) = int16(i) @@ -6128,7 +6189,7 @@ __110: }())) + 1)))) != 0) { goto __111 } - switch Xmbrtowc(tls, bp+260 /* &wc */, func() uintptr { *(*int8)(unsafe.Pointer(bp + 264)) = int8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) { + switch Xmbrtowc(tls, bp+260 /* &wc */, func() uintptr { *(*uint8)(unsafe.Pointer(bp + 264)) = uint8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) { case Uint64FromInt32(-1): goto __113 case Uint64FromInt32(-2): @@ -6191,7 +6252,7 @@ __122: }())) + 1)))) != 0) { goto __123 } - *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = int8(c) + *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c) if !(i == k) { goto __124 } @@ -6223,7 +6284,7 @@ __128: }())) + 1)))) != 0) { goto __129 } - *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = int8(c) + *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c) goto __128 __129: ; @@ -6289,7 +6350,7 @@ __138: if !(s != 0) { goto __139 } - *(*int8)(unsafe.Pointer(s + uintptr(i))) = int8(0) + *(*uint8)(unsafe.Pointer(s + uintptr(i))) = uint8(0) __139: ; __137: @@ -6569,7 +6630,7 @@ __1: goto __2 } __3: - if !((((uintptr_t(s) & (uint64(unsafe.Sizeof(size_t(0))) - uint64(1))) != 0) && (n != 0)) && (AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0)) { + if !((((uintptr_t(s) & (uint64(unsafe.Sizeof(size_t(0))) - uint64(1))) != 0) && (n != 0)) && (AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0)) { goto __5 } goto __4 @@ -6581,7 +6642,7 @@ __4: goto __5 __5: ; - if !((n != 0) && (*(*int8)(unsafe.Pointer(s)) != 0)) { + if !((n != 0) && (*(*uint8)(unsafe.Pointer(s)) != 0)) { goto __6 } wd = d @@ -6607,7 +6668,7 @@ __6: __2: ; __10: - if !((n != 0) && (AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0)) { + if !((n != 0) && (AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0)) { goto __12 } goto __11 @@ -6619,7 +6680,7 @@ __11: goto __12 __12: ; - *(*int8)(unsafe.Pointer(d)) = int8(0) + *(*uint8)(unsafe.Pointer(d)) = uint8(0) finish: return ((size_t((int64(d) - int64(d0)) / 1)) + Xstrlen(tls, s)) } @@ -6653,11 +6714,11 @@ func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) in func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */ var a uintptr = d d += uintptr(Xstrlen(tls, d)) - for (n != 0) && (*(*int8)(unsafe.Pointer(s)) != 0) { + for (n != 0) && (*(*uint8)(unsafe.Pointer(s)) != 0) { n-- - *(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) } - *(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = int8(0) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = uint8(0) return a } @@ -6676,18 +6737,18 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ var a uintptr = s *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} - if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(c))) != 0) { return uint64(0) } - if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { - for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { + if !(int32(*(*uint8)(unsafe.Pointer(c + 1))) != 0) { + for ; int32(*(*uint8)(unsafe.Pointer(s))) == int32(*(*uint8)(unsafe.Pointer(c))); s++ { } return (size_t((int64(s) - int64(a)) / 1)) } - for ; (*(*int8)(unsafe.Pointer(c)) != 0) && (AssignOrPtrUint64(bp /* &byteset */ +uintptr(((size_t(*(*uint8)(unsafe.Pointer(c))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8, (size_t(uint64(1))<<((size_t(*(*uint8)(unsafe.Pointer(c))))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))) != 0); c++ { + for ; (*(*uint8)(unsafe.Pointer(c)) != 0) && (AssignOrPtrUint64(bp /* &byteset */ +uintptr(((size_t(*(*uint8)(unsafe.Pointer(c))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8, (size_t(uint64(1))<<((size_t(*(*uint8)(unsafe.Pointer(c))))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))) != 0); c++ { } - for ; (*(*int8)(unsafe.Pointer(s)) != 0) && ((*(*size_t)(unsafe.Pointer(bp /* &byteset[0] */ + uintptr(((size_t(*(*uint8)(unsafe.Pointer(s))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8)) & (size_t(uint64(1)) << ((size_t(*(*uint8)(unsafe.Pointer(s)))) % (uint64(8) * uint64(unsafe.Sizeof(size_t(0))))))) != 0); s++ { + for ; (*(*uint8)(unsafe.Pointer(s)) != 0) && ((*(*size_t)(unsafe.Pointer(bp /* &byteset[0] */ + uintptr(((size_t(*(*uint8)(unsafe.Pointer(s))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8)) & (size_t(uint64(1)) << ((size_t(*(*uint8)(unsafe.Pointer(s)))) % (uint64(8) * uint64(unsafe.Sizeof(size_t(0))))))) != 0); s++ { } return (size_t((int64(s) - int64(a)) / 1)) } @@ -6697,12 +6758,12 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ return uintptr(0) } s += uintptr(Xstrspn(tls, s, sep)) - if !(int32(*(*int8)(unsafe.Pointer(s))) != 0) { + if !(int32(*(*uint8)(unsafe.Pointer(s))) != 0) { return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0)) } _sp = (s + uintptr(Xstrcspn(tls, s, sep))) - if *(*int8)(unsafe.Pointer(_sp)) != 0 { - *(*int8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = int8(0) + if *(*uint8)(unsafe.Pointer(_sp)) != 0 { + *(*uint8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = uint8(0) } else { _sp = uintptr(0) } @@ -6857,5 +6918,9 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth return 0 } +func init() { + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = (uintptr(unsafe.Pointer(&table)) + uintptr(128)*2) // __ctype_b_loc.c:36:45: +} + var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_netbsd_amd64.go b/vendor/modernc.org/libc/musl_netbsd_amd64.go new file mode 100644 index 00000000..79a05483 --- /dev/null +++ b/vendor/modernc.org/libc/musl_netbsd_amd64.go @@ -0,0 +1,4317 @@ +// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6,getnameinfo,gethostbyaddr_r, -nostdinc -nostdlib -o ../musl_netbsd_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c ../netbsd/ctype_.cpp.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strnlen.c src/string/strspn.c', DO NOT EDIT. + +package libc + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +// musl as a whole is licensed under the following standard MIT license: +// +// ---------------------------------------------------------------------- +// Copyright © 2005-2020 Rich Felker, et al. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ---------------------------------------------------------------------- +// +// Authors/contributors include: +// +// A. Wilcox +// Ada Worcester +// Alex Dowad +// Alex Suykov +// Alexander Monakov +// Andre McCurdy +// Andrew Kelley +// Anthony G. Basile +// Aric Belsito +// Arvid Picciani +// Bartosz Brachaczek +// Benjamin Peterson +// Bobby Bingham +// Boris Brezillon +// Brent Cook +// Chris Spiegel +// Clément Vasseur +// Daniel Micay +// Daniel Sabogal +// Daurnimator +// David Carlier +// David Edelsohn +// Denys Vlasenko +// Dmitry Ivanov +// Dmitry V. Levin +// Drew DeVault +// Emil Renner Berthing +// Fangrui Song +// Felix Fietkau +// Felix Janda +// Gianluca Anzolin +// Hauke Mehrtens +// He X +// Hiltjo Posthuma +// Isaac Dunham +// Jaydeep Patil +// Jens Gustedt +// Jeremy Huntwork +// Jo-Philipp Wich +// Joakim Sindholt +// John Spencer +// Julien Ramseier +// Justin Cormack +// Kaarle Ritvanen +// Khem Raj +// Kylie McClain +// Leah Neukirchen +// Luca Barbato +// Luka Perkov +// M Farkas-Dyck (Strake) +// Mahesh Bodapati +// Markus Wichmann +// Masanori Ogino +// Michael Clark +// Michael Forney +// Mikhail Kremnyov +// Natanael Copa +// Nicholas J. Kain +// orc +// Pascal Cuoq +// Patrick Oppenlander +// Petr Hosek +// Petr Skocik +// Pierre Carrier +// Reini Urban +// Rich Felker +// Richard Pennington +// Ryan Fairfax +// Samuel Holland +// Segev Finer +// Shiz +// sin +// Solar Designer +// Stefan Kristiansson +// Stefan O'Rear +// Szabolcs Nagy +// Timo Teräs +// Trutz Behn +// Valentin Ochs +// Will Dietz +// William Haddon +// William Pitcock +// +// Portions of this software are derived from third-party works licensed +// under terms compatible with the above MIT license: +// +// The TRE regular expression implementation (src/regex/reg* and +// src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed +// under a 2-clause BSD license (license text in the source files). The +// included version has been heavily modified by Rich Felker in 2012, in +// the interests of size, simplicity, and namespace cleanliness. +// +// Much of the math library code (src/math/* and src/complex/*) is +// Copyright © 1993,2004 Sun Microsystems or +// Copyright © 2003-2011 David Schultz or +// Copyright © 2003-2009 Steven G. Kargl or +// Copyright © 2003-2009 Bruce D. Evans or +// Copyright © 2008 Stephen L. Moshier or +// Copyright © 2017-2018 Arm Limited +// and labelled as such in comments in the individual source files. All +// have been licensed under extremely permissive terms. +// +// The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 +// The Android Open Source Project and is licensed under a two-clause BSD +// license. It was taken from Bionic libc, used on Android. +// +// The AArch64 memcpy and memset code (src/string/aarch64/*) are +// Copyright © 1999-2019, Arm Limited. +// +// The implementation of DES for crypt (src/crypt/crypt_des.c) is +// Copyright © 1994 David Burren. It is licensed under a BSD license. +// +// The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was +// originally written by Solar Designer and placed into the public +// domain. The code also comes with a fallback permissive license for use +// in jurisdictions that may not recognize the public domain. +// +// The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 +// Valentin Ochs and is licensed under an MIT-style license. +// +// The x86_64 port was written by Nicholas J. Kain and is licensed under +// the standard MIT terms. +// +// The mips and microblaze ports were originally written by Richard +// Pennington for use in the ellcc project. The original code was adapted +// by Rich Felker for build system and code conventions during upstream +// integration. It is licensed under the standard MIT terms. +// +// The mips64 port was contributed by Imagination Technologies and is +// licensed under the standard MIT terms. +// +// The powerpc port was also originally written by Richard Pennington, +// and later supplemented and integrated by John Spencer. It is licensed +// under the standard MIT terms. +// +// All other files which have no copyright comments are original works +// produced specifically for use as part of this library, written either +// by Rich Felker, the main author of the library, or by one or more +// contibutors listed above. Details on authorship of individual files +// can be found in the git version control history of the project. The +// omission of copyright and license comments in each file is in the +// interest of source tree size. +// +// In addition, permission is hereby granted for all public header files +// (include/* and arch/*/bits/*) and crt files intended to be linked into +// applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit +// the copyright notice and permission notice otherwise required by the +// license, and to use these files without any requirement of +// attribution. These files include substantial contributions from: +// +// Bobby Bingham +// John Spencer +// Nicholas J. Kain +// Rich Felker +// Richard Pennington +// Stefan Kristiansson +// Szabolcs Nagy +// +// all of whom have explicitly granted such permission. +// +// This file previously contained text expressing a belief that most of +// the files covered by the above exception were sufficiently trivial not +// to be subject to copyright, resulting in confusion over whether it +// negated the permissions granted in the license. In the spirit of +// permissive licensing, and of not having licensing issues being an +// obstacle to adoption, that text has been removed. +const ( /* copyright.c:194:1: */ + __musl__copyright__ = 0 +) + +const ( /* nameser.h:117:1: */ + ns_uop_delete = 0 + ns_uop_add = 1 + ns_uop_max = 2 +) + +const ( /* nameser.h:147:1: */ + ns_t_invalid = 0 + ns_t_a = 1 + ns_t_ns = 2 + ns_t_md = 3 + ns_t_mf = 4 + ns_t_cname = 5 + ns_t_soa = 6 + ns_t_mb = 7 + ns_t_mg = 8 + ns_t_mr = 9 + ns_t_null = 10 + ns_t_wks = 11 + ns_t_ptr = 12 + ns_t_hinfo = 13 + ns_t_minfo = 14 + ns_t_mx = 15 + ns_t_txt = 16 + ns_t_rp = 17 + ns_t_afsdb = 18 + ns_t_x25 = 19 + ns_t_isdn = 20 + ns_t_rt = 21 + ns_t_nsap = 22 + ns_t_nsap_ptr = 23 + ns_t_sig = 24 + ns_t_key = 25 + ns_t_px = 26 + ns_t_gpos = 27 + ns_t_aaaa = 28 + ns_t_loc = 29 + ns_t_nxt = 30 + ns_t_eid = 31 + ns_t_nimloc = 32 + ns_t_srv = 33 + ns_t_atma = 34 + ns_t_naptr = 35 + ns_t_kx = 36 + ns_t_cert = 37 + ns_t_a6 = 38 + ns_t_dname = 39 + ns_t_sink = 40 + ns_t_opt = 41 + ns_t_apl = 42 + ns_t_tkey = 249 + ns_t_tsig = 250 + ns_t_ixfr = 251 + ns_t_axfr = 252 + ns_t_mailb = 253 + ns_t_maila = 254 + ns_t_any = 255 + ns_t_zxfr = 256 + ns_t_max = 65536 +) + +const ( /* nameser.h:210:1: */ + ns_c_invalid = 0 + ns_c_in = 1 + ns_c_2 = 2 + ns_c_chaos = 3 + ns_c_hs = 4 + ns_c_none = 254 + ns_c_any = 255 + ns_c_max = 65536 +) + +const ( /* nameser.h:221:1: */ + ns_kt_rsa = 1 + ns_kt_dh = 2 + ns_kt_dsa = 3 + ns_kt_private = 254 +) + +const ( /* nameser.h:228:1: */ + cert_t_pkix = 1 + cert_t_spki = 2 + cert_t_pgp = 3 + cert_t_url = 253 + cert_t_oid = 254 +) + +const ( /* nameser.h:28:1: */ + ns_s_qd = 0 + ns_s_zn = 0 + ns_s_an = 1 + ns_s_pr = 1 + ns_s_ns = 2 + ns_s_ud = 2 + ns_s_ar = 3 + ns_s_max = 4 +) + +const ( /* nameser.h:75:1: */ + ns_f_qr = 0 + ns_f_opcode = 1 + ns_f_aa = 2 + ns_f_tc = 3 + ns_f_rd = 4 + ns_f_ra = 5 + ns_f_z = 6 + ns_f_ad = 7 + ns_f_cd = 8 + ns_f_rcode = 9 + ns_f_max = 10 +) + +const ( /* nameser.h:89:1: */ + ns_o_query = 0 + ns_o_iquery = 1 + ns_o_status = 2 + ns_o_notify = 4 + ns_o_update = 5 + ns_o_max = 6 +) + +const ( /* nameser.h:98:1: */ + ns_r_noerror = 0 + ns_r_formerr = 1 + ns_r_servfail = 2 + ns_r_nxdomain = 3 + ns_r_notimpl = 4 + ns_r_refused = 5 + ns_r_yxdomain = 6 + ns_r_yxrrset = 7 + ns_r_nxrrset = 8 + ns_r_notauth = 9 + ns_r_notzone = 10 + ns_r_max = 11 + ns_r_badvers = 16 + ns_r_badsig = 16 + ns_r_badkey = 17 + ns_r_badtime = 18 +) + +type ptrdiff_t = int64 /* :3:26 */ + +type size_t = uint64 /* :9:23 */ + +type wchar_t = int32 /* :15:24 */ + +type ssize_t = int64 /* ctype_.cpp.c:111:18 */ + +type __sfpos = struct { + _pos int64 + _mbstate_in struct { + __mbstateL int64 + _ [120]byte + } + _mbstate_out struct { + __mbstateL int64 + _ [120]byte + } +} /* ctype_.cpp.c:121:9 */ + +type fpos_t = __sfpos /* ctype_.cpp.c:124:3 */ +type __sbuf = struct { + _base uintptr + _size int32 + _ [4]byte +} /* ctype_.cpp.c:126:1 */ + +type __sFILE = struct { + _p uintptr + _r int32 + _w int32 + _flags uint16 + _file int16 + _ [4]byte + _bf struct { + _base uintptr + _size int32 + _ [4]byte + } + _lbfsize int32 + _ [4]byte + _cookie uintptr + _close uintptr + _read uintptr + _seek uintptr + _write uintptr + _ext struct { + _base uintptr + _size int32 + _ [4]byte + } + _up uintptr + _ur int32 + _ubuf [3]uint8 + _nbuf [1]uint8 + _flush uintptr + _lb_unused [8]int8 + _blksize int32 + _ [4]byte + _offset int64 +} /* ctype_.cpp.c:131:9 */ + +type FILE = __sFILE /* ctype_.cpp.c:165:3 */ + +type off_t = int64 /* ctype_.cpp.c:365:17 */ + +type locale_t = uintptr /* ctype_.cpp.c:514:24 */ +var X_C_ctype_tab_ = [257]uint16{ + 0: uint16(0), + + 1: uint16(0x0002), + 2: uint16(0x0002), + 3: uint16(0x0002), + 4: uint16(0x0002), + + 5: uint16(0x0002), + 6: uint16(0x0002), + 7: uint16(0x0002), + 8: uint16(0x0002), + + 9: uint16(0x0002), + 10: (uint16((0x0200 | + 0x0002) | + 0x0040)), + 11: (uint16(0x0002 | + 0x0040)), + 12: (uint16(0x0002 | + 0x0040)), + + 13: (uint16(0x0002 | + 0x0040)), + 14: (uint16(0x0002 | + 0x0040)), + 15: uint16(0x0002), + 16: uint16(0x0002), + + 17: uint16(0x0002), + 18: uint16(0x0002), + 19: uint16(0x0002), + 20: uint16(0x0002), + + 21: uint16(0x0002), + 22: uint16(0x0002), + 23: uint16(0x0002), + 24: uint16(0x0002), + + 25: uint16(0x0002), + 26: uint16(0x0002), + 27: uint16(0x0002), + 28: uint16(0x0002), + + 29: uint16(0x0002), + 30: uint16(0x0002), + 31: uint16(0x0002), + 32: uint16(0x0002), + + 33: (uint16((0x0200 | + 0x0400) | + 0x0040)), + 34: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 35: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 36: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 37: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 38: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 39: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 40: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 41: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 42: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 43: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 44: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 45: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 46: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 47: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 48: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 49: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 50: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 51: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 52: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + + 53: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 54: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 55: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 56: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + + 57: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 58: (uint16(((0x0004 | + 0x0008) | + 0x0400) | + 0x0100)), + 59: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 60: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 61: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 62: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 63: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 64: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 65: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 66: (uint16((((0x0001 | + 0x0008) | + 0x0400) | + 0x0080) | + 0x0100)), + 67: (uint16((((0x0001 | + 0x0008) | + 0x0400) | + 0x0080) | + 0x0100)), + 68: (uint16((((0x0001 | + 0x0008) | + 0x0400) | + 0x0080) | + 0x0100)), + + 69: (uint16((((0x0001 | + 0x0008) | + 0x0400) | + 0x0080) | + 0x0100)), + 70: (uint16((((0x0001 | + 0x0008) | + 0x0400) | + 0x0080) | + 0x0100)), + 71: (uint16((((0x0001 | + 0x0008) | + 0x0400) | + 0x0080) | + 0x0100)), + 72: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + + 73: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 74: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 75: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 76: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + + 77: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 78: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 79: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 80: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + + 81: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 82: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 83: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 84: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + + 85: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 86: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 87: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 88: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + + 89: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 90: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 91: (uint16(((0x0001 | + 0x0008) | + 0x0400) | + 0x0080)), + 92: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 93: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 94: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 95: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 96: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 97: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 98: (uint16((((0x0001 | + 0x0008) | + 0x0010) | + 0x0400) | + 0x0100)), + 99: (uint16((((0x0001 | + 0x0008) | + 0x0010) | + 0x0400) | + 0x0100)), + 100: (uint16((((0x0001 | + 0x0008) | + 0x0010) | + 0x0400) | + 0x0100)), + + 101: (uint16((((0x0001 | + 0x0008) | + 0x0010) | + 0x0400) | + 0x0100)), + 102: (uint16((((0x0001 | + 0x0008) | + 0x0010) | + 0x0400) | + 0x0100)), + 103: (uint16((((0x0001 | + 0x0008) | + 0x0010) | + 0x0400) | + 0x0100)), + 104: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + + 105: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 106: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 107: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 108: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + + 109: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 110: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 111: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 112: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + + 113: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 114: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 115: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 116: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + + 117: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 118: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 119: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 120: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + + 121: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 122: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 123: (uint16(((0x0001 | + 0x0008) | + 0x0010) | + 0x0400)), + 124: (uint16((0x0008 | + 0x0400) | + 0x0020)), + + 125: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 126: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 127: (uint16((0x0008 | + 0x0400) | + 0x0020)), + 128: uint16(0x0002), +} /* ctype_.cpp.c:601:22 */ +var X_ctype_tab_ uintptr = 0 /* ctype_.cpp.c:2233:22 */ + +func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ + return (Bool32((_c == ' ') || ((uint32(_c) - uint32('\t')) < uint32(5)))) +} + +type locale_t1 = uintptr /* alltypes.h:343:32 */ + +func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ + return (Bool32((func() int32 { + if 0 != 0 { + return Xisalpha(tls, c) + } + return (Bool32((((uint32(c)) | uint32(32)) - uint32('a')) < uint32(26))) + }() != 0) || (func() int32 { + if 0 != 0 { + return Xisdigit(tls, c) + } + return (Bool32(((uint32(c)) - uint32('0')) < uint32(10))) + }() != 0))) +} + +func X__isalnum_l(tls *TLS, c int32, l locale_t1) int32 { /* isalnum.c:8:5: */ + return Xisalnum(tls, c) +} + +func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */ + return (Bool32(((uint32(c) | uint32(32)) - uint32('a')) < uint32(26))) +} + +func X__isalpha_l(tls *TLS, c int32, l locale_t1) int32 { /* isalpha.c:9:5: */ + return Xisalpha(tls, c) +} + +func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */ + return (Bool32((uint32(c) - uint32('0')) < uint32(10))) +} + +func X__isdigit_l(tls *TLS, c int32, l locale_t1) int32 { /* isdigit.c:9:5: */ + return Xisdigit(tls, c) +} + +type uintptr_t = uint64 /* alltypes.h:55:24 */ + +type intptr_t = int64 /* alltypes.h:70:15 */ + +type int8_t = int8 /* alltypes.h:96:25 */ + +type int16_t = int16 /* alltypes.h:101:25 */ + +type int32_t = int32 /* alltypes.h:106:25 */ + +type int64_t = int64 /* alltypes.h:111:25 */ + +type intmax_t = int64 /* alltypes.h:116:25 */ + +type uint8_t = uint8 /* alltypes.h:121:25 */ + +type uint16_t = uint16 /* alltypes.h:126:25 */ + +type uint32_t = uint32 /* alltypes.h:131:25 */ + +type uint64_t = uint64 /* alltypes.h:136:25 */ + +type uintmax_t = uint64 /* alltypes.h:146:25 */ + +type int_fast8_t = int8_t /* stdint.h:22:16 */ +type int_fast64_t = int64_t /* stdint.h:23:17 */ + +type int_least8_t = int8_t /* stdint.h:25:17 */ +type int_least16_t = int16_t /* stdint.h:26:17 */ +type int_least32_t = int32_t /* stdint.h:27:17 */ +type int_least64_t = int64_t /* stdint.h:28:17 */ + +type uint_fast8_t = uint8_t /* stdint.h:30:17 */ +type uint_fast64_t = uint64_t /* stdint.h:31:18 */ + +type uint_least8_t = uint8_t /* stdint.h:33:18 */ +type uint_least16_t = uint16_t /* stdint.h:34:18 */ +type uint_least32_t = uint32_t /* stdint.h:35:18 */ +type uint_least64_t = uint64_t /* stdint.h:36:18 */ + +type int_fast16_t = int32_t /* stdint.h:1:17 */ +type int_fast32_t = int32_t /* stdint.h:2:17 */ +type uint_fast16_t = uint32_t /* stdint.h:3:18 */ +type uint_fast32_t = uint32_t /* stdint.h:4:18 */ + +type _IO_FILE = struct { + flags uint32 + _ [4]byte + rpos uintptr + rend uintptr + close uintptr + wend uintptr + wpos uintptr + mustbezero_1 uintptr + wbase uintptr + read uintptr + write uintptr + seek uintptr + buf uintptr + buf_size size_t + prev uintptr + next uintptr + fd int32 + pipe_pid int32 + lockcount int64 + mode int32 + lock int32 + lbf int32 + _ [4]byte + cookie uintptr + off off_t + getln_buf uintptr + mustbezero_2 uintptr + shend uintptr + shlim off_t + shcnt off_t + prev_locked uintptr + next_locked uintptr + locale uintptr +} /* alltypes.h:320:9 */ + +type FILE1 = _IO_FILE /* alltypes.h:320:25 */ + +type va_list = uintptr /* alltypes.h:326:27 */ + +type _G_fpos64_t = struct { + _ [0]uint64 + __opaque [16]int8 +} /* stdio.h:54:9 */ + +type fpos_t1 = _G_fpos64_t /* stdio.h:58:3 */ + +type float_t = float32 /* alltypes.h:29:15 */ + +type double_t = float64 /* alltypes.h:34:16 */ + +func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var __u struct {__f float32;} at bp, 4 + + *(*float32)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint32)(unsafe.Pointer(bp /* &__u */)) +} + +func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var __u struct {__f float64;} at bp, 8 + + *(*float64)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint64)(unsafe.Pointer(bp /* &__u */)) +} + +type syscall_arg_t = int64 /* syscall.h:22:14 */ + +func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ + var c int32 + var x int32 + var y int64 + var neg int32 = 0 + + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if (c == '+') || (c == '-') { + neg = (Bool32(c == '-')) + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if ((uint32(c - '0')) >= 10) && (pok != 0) { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } + } + if (uint32(c - '0')) >= 10 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + return (-0x7fffffffffffffff - int64(1)) + } + for x = 0; ((uint32(c - '0')) < 10) && (x < (0x7fffffff / 10)); c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + x = (((10 * x) + c) - '0') + } + for y = int64(x); ((uint32(c - '0')) < 10) && (y < (0x7fffffffffffffff / int64(100))); c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + y = (((int64(10) * y) + int64(c)) - int64('0')) + } + for ; (uint32(c - '0')) < 10; c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + } + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if neg != 0 { + return -y + } + return y +} + +func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */ + bp := tls.Alloc(512) + defer tls.Free(512) + + // var x [128]uint32_t at bp, 512 + + var i int32 + var j int32 + var k int32 + var a int32 + var z int32 + var lrp int64 = int64(0) + var dc int64 = int64(0) + var e10 int64 = int64(0) + var lnz int32 = 0 + var gotdig int32 = 0 + var gotrad int32 = 0 + var rp int32 + var e2 int32 + var emax int32 = ((-emin - bits) + 3) + var denormal int32 = 0 + var y float64 + var frac float64 = float64(0) + var bias float64 = float64(0) + + j = 0 + k = 0 + + // Don't let leading zeros consume buffer space + for ; c == '0'; c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + gotdig = 1 + } + if c == '.' { + gotrad = 1 + for c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }(); c == '0'; c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + gotdig = 1 + lrp-- + } + } + + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)) = uint32_t(0) + for ; ((uint32(c - '0')) < 10) || (c == '.'); c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + if c == '.' { + if gotrad != 0 { + break + } + gotrad = 1 + lrp = dc + } else if k < (128 - 3) { + dc++ + if c != '0' { + lnz = int32(dc) + } + if j != 0 { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = (((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) * uint32_t(10)) + uint32_t(c)) - uint32_t('0')) + } else { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = (uint32_t(c - '0')) + } + if PreIncInt32(&j, 1) == 9 { + k++ + j = 0 + } + gotdig = 1 + } else { + dc++ + if c != '0' { + lnz = ((128 - 4) * 9) + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + 124*4)) |= (uint32_t(1)) + } + } + } + if !(gotrad != 0) { + lrp = dc + } + + if (gotdig != 0) && ((c | 32) == 'e') { + e10 = scanexp(tls, f, pok) + if e10 == (-0x7fffffffffffffff - int64(1)) { + if pok != 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } else { + X__shlim(tls, f, int64(0)) + return float64(0) + } + e10 = int64(0) + } + lrp = lrp + (e10) + } else if c >= 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } + if !(gotdig != 0) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + X__shlim(tls, f, int64(0)) + return float64(0) + } + + // Handle zero specially to avoid nasty special cases later + if !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */))) != 0) { + return (float64(sign) * 0.0) + } + + // Optimize small integers (w/no exponent) and over/under-flow + if ((lrp == dc) && (dc < int64(10))) && ((bits > 30) || ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)) >> bits) == uint32_t(0))) { + return (float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) + } + if lrp > (int64(-emin / 2)) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 1.79769313486231570815e+308) * 1.79769313486231570815e+308) + } + if lrp < (int64(emin - (2 * 53))) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 2.22507385850720138309e-308) * 2.22507385850720138309e-308) + } + + // Align incomplete final B1B digit + if j != 0 { + for ; j < 9; j++ { + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + uintptr(k)*4)) *= (uint32_t(10)) + } + k++ + j = 0 + } + + a = 0 + z = k + e2 = 0 + rp = int32(lrp) + + // Optimize small to mid-size integers (even in exp. notation) + if ((lnz < 9) && (lnz <= rp)) && (rp < 18) { + if rp == 9 { + return (float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) + } + if rp < 9 { + return ((float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) / float64(_sp10s[(8-rp)])) + } + var bitlim int32 = (bits - (3 * (rp - 9))) + if (bitlim > 30) || ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)) >> bitlim) == uint32_t(0)) { + return ((float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */)))) * float64(_sp10s[(rp-10)])) + } + } + + // Drop trailing zeros + for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr((z-1))*4))) != 0); z-- { + } + + // Align radix point to B1B digit boundary + if (rp % 9) != 0 { + var rpm9 int32 + if rp >= 0 { + rpm9 = (rp % 9) + } else { + rpm9 = ((rp % 9) + 9) + } + var p10 int32 = _sp10s[(8 - rpm9)] + var carry uint32_t = uint32_t(0) + for k = a; k != z; k++ { + var tmp uint32_t = (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) % uint32_t(p10)) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) / uint32_t(p10)) + carry) + carry = ((uint32_t(1000000000 / p10)) * tmp) + if (k == a) && !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) != 0) { + a = ((a + 1) & (128 - 1)) + rp = rp - (9) + } + } + if carry != 0 { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(PostIncInt32(&z, 1))*4)) = carry + } + rp = rp + (9 - rpm9) + } + + // Upscale until desired number of bits are left of radix point + for (rp < (9 * 2)) || ((rp == (9 * 2)) && (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(a)*4)) < _sth[0])) { + var carry uint32_t = uint32_t(0) + e2 = e2 - (29) + for k = ((z - 1) & (128 - 1)); ; k = ((k - 1) & (128 - 1)) { + var tmp uint64_t = ((uint64_t(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) << 29) + uint64_t(carry)) + if tmp > uint64(1000000000) { + carry = (uint32_t(tmp / uint64(1000000000))) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = (uint32_t(tmp % uint64(1000000000))) + } else { + carry = uint32_t(0) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = uint32_t(tmp) + } + if ((k == ((z - 1) & (128 - 1))) && (k != a)) && !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) != 0) { + z = k + } + if k == a { + break + } + } + if carry != 0 { + rp = rp + (9) + a = ((a - 1) & (128 - 1)) + if a == z { + z = ((z - 1) & (128 - 1)) + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + uintptr(((z-1)&(128-1)))*4)) |= (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(z)*4))) + } + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(a)*4)) = carry + } + } + + // Downscale until exactly number of bits are left of radix point + for { + var carry uint32_t = uint32_t(0) + var sh int32 = 1 + for i = 0; i < 2; i++ { + k = ((a + i) & (128 - 1)) + if (k == z) || (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) < _sth[i]) { + i = 2 + break + } + if *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((a+i)&(128-1)))*4)) > _sth[i] { + break + } + } + if (i == 2) && (rp == (9 * 2)) { + break + } + // FIXME: find a way to compute optimal sh + if rp > (9 + (9 * 2)) { + sh = 9 + } + e2 = e2 + (sh) + for k = a; k != z; k = ((k + 1) & (128 - 1)) { + var tmp uint32_t = (*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) & (uint32_t((int32(1) << sh) - 1))) + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) = ((*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4)) >> sh) + carry) + carry = ((uint32_t(int32(1000000000) >> sh)) * tmp) + if (k == a) && !(int32(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(k)*4))) != 0) { + a = ((a + 1) & (128 - 1)) + i-- + rp = rp - (9) + } + } + if carry != 0 { + if ((z + 1) & (128 - 1)) != a { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(z)*4)) = carry + z = ((z + 1) & (128 - 1)) + } else { + *(*uint32_t)(unsafe.Pointer(bp /* &x */ + uintptr(((z-1)&(128-1)))*4)) |= (uint32_t(1)) + } + } + } + + // Assemble desired bits into floating point variable + for y = float64(AssignInt32(&i, 0)); i < 2; i++ { + if ((a + i) & (128 - 1)) == z { + *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((AssignInt32(&z, ((z+1)&(128-1))))-1))*4)) = uint32_t(0) + } + y = ((1000000000.0 * y) + float64(*(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((a+i)&(128-1)))*4)))) + } + + y = y * (float64(sign)) + + // Limit precision for denormal results + if bits > ((53 + e2) - emin) { + bits = ((53 + e2) - emin) + if bits < 0 { + bits = 0 + } + denormal = 1 + } + + // Calculate bias term to force rounding, move out lower bits + if bits < 53 { + bias = Xcopysignl(tls, Xscalbn(tls, float64(1), (((2*53)-bits)-1)), y) + frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), (53-bits))) + y = y - (frac) + y = y + (bias) + } + + // Process tail of decimal input so it can affect rounding + if ((a + i) & (128 - 1)) != z { + var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp /* &x[0] */ + uintptr(((a+i)&(128-1)))*4)) + if (t < uint32_t(500000000)) && ((t != 0) || ((((a + i) + 1) & (128 - 1)) != z)) { + frac = frac + (0.25 * float64(sign)) + } else if t > uint32_t(500000000) { + frac = frac + (0.75 * float64(sign)) + } else if t == uint32_t(500000000) { + if (((a + i) + 1) & (128 - 1)) == z { + frac = frac + (0.5 * float64(sign)) + } else { + frac = frac + (0.75 * float64(sign)) + } + } + if ((53 - bits) >= 2) && !(Xfmodl(tls, frac, float64(1)) != 0) { + frac += 1 + } + } + + y = y + (frac) + y = y - (bias) + + if ((e2 + 53) & 0x7fffffff) > (emax - 5) { + if Xfabsl(tls, y) >= (float64(float64(2)) / 2.22044604925031308085e-16) { + if (denormal != 0) && (bits == ((53 + e2) - emin)) { + denormal = 0 + } + y = y * (0.5) + e2++ + } + if ((e2 + 53) > emax) || ((denormal != 0) && (frac != 0)) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + } + } + + return Xscalbnl(tls, y, e2) +} + +var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */ +var _sp10s = [8]int32{10, 100, 1000, 10000, + 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */ + +func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */ + var x uint32_t = uint32_t(0) + var y float64 = float64(0) + var scale float64 = float64(1) + var bias float64 = float64(0) + var gottail int32 = 0 + var gotrad int32 = 0 + var gotdig int32 = 0 + var rp int64 = int64(0) + var dc int64 = int64(0) + var e2 int64 = int64(0) + var d int32 + var c int32 + + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + + // Skip leading zeros + for ; c == '0'; c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + gotdig = 1 + } + + if c == '.' { + gotrad = 1 + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + // Count zeros after the radix point before significand + rp = int64(0) + __1: + if !(c == '0') { + goto __3 + } + gotdig = 1 + goto __2 + __2: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + rp-- + goto __1 + goto __3 + __3: + } + + for ; (((uint32(c - '0')) < 10) || ((uint32((c | 32) - 'a')) < 6)) || (c == '.'); c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() { + if c == '.' { + if gotrad != 0 { + break + } + rp = dc + gotrad = 1 + } else { + gotdig = 1 + if c > '9' { + d = (((c | 32) + 10) - 'a') + } else { + d = (c - '0') + } + if dc < int64(8) { + x = ((x * uint32_t(16)) + uint32_t(d)) + } else if dc < (int64((53 / 4) + 1)) { + y = y + (float64(d) * (AssignDivFloat64(&scale, float64(16)))) + } else if (d != 0) && !(gottail != 0) { + y = y + (0.5 * scale) + gottail = 1 + } + dc++ + } + } + if !(gotdig != 0) { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if pok != 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if gotrad != 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } + } else { + X__shlim(tls, f, int64(0)) + } + return (float64(sign) * 0.0) + } + if !(gotrad != 0) { + rp = dc + } + for dc < int64(8) { + x = x * (uint32_t(16)) + dc++ + } + if (c | 32) == 'p' { + e2 = scanexp(tls, f, pok) + if e2 == (-0x7fffffffffffffff - int64(1)) { + if pok != 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } else { + X__shlim(tls, f, int64(0)) + return float64(0) + } + e2 = int64(0) + } + } else { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } + e2 = e2 + ((int64(4) * rp) - int64(32)) + + if !(x != 0) { + return (float64(sign) * 0.0) + } + if e2 > int64(-emin) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 1.79769313486231570815e+308) * 1.79769313486231570815e+308) + } + if e2 < (int64(emin - (2 * 53))) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return ((float64(sign) * 2.22507385850720138309e-308) * 2.22507385850720138309e-308) + } + + for x < 0x80000000 { + if y >= 0.5 { + x = x + (x + uint32_t(1)) + y = y + (y - float64(1)) + } else { + x = x + (x) + y = y + (y) + } + e2-- + } + + if int64(bits) > ((int64(32) + e2) - int64(emin)) { + bits = (int32((int64(32) + e2) - int64(emin))) + if bits < 0 { + bits = 0 + } + } + + if bits < 53 { + bias = Xcopysignl(tls, Xscalbn(tls, float64(1), (((32+53)-bits)-1)), float64(sign)) + } + + if ((bits < 32) && (y != 0)) && !((x & uint32_t(1)) != 0) { + x++ + y = float64(0) + } + + y = ((bias + (float64(sign) * float64(x))) + (float64(sign) * y)) + y = y - (bias) + + if !(y != 0) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + } + + return Xscalbnl(tls, y, int32(e2)) +} + +func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */ + var sign int32 = 1 + var i size_t + var bits int32 + var emin int32 + var c int32 + + switch prec { + case 0: + bits = 24 + emin = ((-125) - bits) + break + case 1: + bits = 53 + emin = ((-1021) - bits) + break + case 2: + bits = 53 + emin = ((-1021) - bits) + break + default: + return float64(0) + } + + for __isspace(tls, AssignInt32(&c, func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) != 0 { + } + + if (c == '+') || (c == '-') { + sign = sign - (2 * (Bool32(c == '-'))) + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + } + + for i = uint64(0); (i < uint64(8)) && ((c | 32) == int32(*(*int8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i))))); i++ { + if i < uint64(7) { + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + } + } + if ((i == uint64(3)) || (i == uint64(8))) || ((i > uint64(3)) && (pok != 0)) { + if i != uint64(8) { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if pok != 0 { + for ; i > uint64(3); i-- { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } + } + } + return (float64(float32(sign) * X__builtin_inff(tls))) + } + if !(i != 0) { + for i = uint64(0); (i < uint64(3)) && ((c | 32) == int32(*(*int8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i))))); i++ { + if i < uint64(2) { + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + } + } + } + if i == uint64(3) { + if (func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }()) != '(' { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + return float64(X__builtin_nanf(tls, ts+13 /* "" */)) + } + for i = uint64(1); ; i++ { + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if ((((uint32(c - '0')) < 10) || ((uint32(c - 'A')) < 26)) || ((uint32(c - 'a')) < 26)) || (c == '_') { + continue + } + if c == ')' { + return float64(X__builtin_nanf(tls, ts+13 /* "" */)) + } + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(pok != 0) { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + X__shlim(tls, f, int64(0)) + return float64(0) + } + for PostDecUint64(&i, 1) != 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + } + return float64(X__builtin_nanf(tls, ts+13 /* "" */)) + } + return float64(X__builtin_nanf(tls, ts+13 /* "" */)) + } + + if i != 0 { + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + X__shlim(tls, f, int64(0)) + return float64(0) + } + + if c == '0' { + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if (c | 32) == 'x' { + return hexfloat(tls, f, bits, emin, sign, pok) + } + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + c = '0' + } + + return decfloat(tls, f, c, bits, emin, sign, pok) +} + +// Lookup table for digit values. -1==255>=36 -> invalid +var table = [257]uint8{Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), + uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), + uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), + Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), +} /* intscan.c:7:28 */ + +func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */ + var val uintptr + var c int32 + var neg int32 + var x uint32 + var y uint64 + var bs int32 + val = (uintptr(unsafe.Pointer(&table)) + uintptr(1)) + neg = 0 + if !((base > uint32(36)) || (base == uint32(1))) { + goto __1 + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + return uint64(0) +__1: + ; +__2: + if !(__isspace(tls, AssignInt32(&c, func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }())) != 0) { + goto __3 + } + goto __2 +__3: + ; + if !((c == '+') || (c == '-')) { + goto __4 + } + neg = -(Bool32(c == '-')) + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() +__4: + ; + if !(((base == uint32(0)) || (base == uint32(16))) && (c == '0')) { + goto __5 + } + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if !((c | 32) == 'x') { + goto __7 + } + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) { + goto __9 + } + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(pok != 0) { + goto __10 + } + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + goto __11 +__10: + X__shlim(tls, f, int64(0)) +__11: + ; + return uint64(0) +__9: + ; + base = uint32(16) + goto __8 +__7: + if !(base == uint32(0)) { + goto __12 + } + base = uint32(8) +__12: + ; +__8: + ; + goto __6 +__5: + if !(base == uint32(0)) { + goto __13 + } + base = uint32(10) +__13: + ; + if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) { + goto __14 + } + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + X__shlim(tls, f, int64(0)) + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 22 + return uint64(0) +__14: + ; +__6: + ; + if !(base == uint32(10)) { + goto __15 + } + x = uint32(0) +__17: + if !(((uint32(c - '0')) < 10) && (x <= ((0xffffffff / uint32(10)) - uint32(1)))) { + goto __19 + } + x = ((x * uint32(10)) + (uint32(c - '0'))) + goto __18 +__18: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __17 + goto __19 +__19: + ; + y = uint64(x) +__20: + if !((((uint32(c - '0')) < 10) && (y <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) / uint64(10)))) && ((uint64(10) * y) <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) - (uint64(c - '0'))))) { + goto __22 + } + y = ((y * uint64(10)) + (uint64(c - '0'))) + goto __21 +__21: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __20 + goto __22 +__22: + ; + if !((uint32(c - '0')) >= 10) { + goto __23 + } + goto done +__23: + ; + goto __16 +__15: + if !(!((base & (base - uint32(1))) != 0)) { + goto __24 + } + bs = int32(*(*int8)(unsafe.Pointer(ts + 14 /* "\x00\x01\x02\x04\a\x03\x06\x05" */ + uintptr((((uint32(0x17) * base) >> 5) & uint32(7)))))) + x = uint32(0) +__26: + if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (x <= (0xffffffff / uint32(32)))) { + goto __28 + } + x = ((x << bs) | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __27 +__27: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __26 + goto __28 +__28: + ; + y = uint64(x) +__29: + if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (y <= (uint64(((2 * uint64(0x7fffffffffffffff)) + uint64(1))) >> bs))) { + goto __31 + } + y = ((y << bs) | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __30 +__30: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __29 + goto __31 +__31: + ; + goto __25 +__24: + x = uint32(0) +__32: + if !((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (x <= ((0xffffffff / uint32(36)) - uint32(1)))) { + goto __34 + } + x = ((x * base) + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __33 +__33: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __32 + goto __34 +__34: + ; + y = uint64(x) +__35: + if !(((uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) && (y <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) / uint64(base)))) && ((uint64(base) * y) <= (((2 * uint64(0x7fffffffffffffff)) + uint64(1)) - uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))))) { + goto __37 + } + y = ((y * uint64(base)) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) + goto __36 +__36: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __35 + goto __37 +__37: + ; +__25: + ; +__16: + ; + if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { + goto __38 + } +__39: + if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { + goto __41 + } + goto __40 +__40: + c = func() int32 { + if (*FILE1)(unsafe.Pointer((f))).rpos != (*FILE1)(unsafe.Pointer((f))).shend { + return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE1)(unsafe.Pointer(f)).rpos, 1)))) + } + return X__shgetc(tls, f) + }() + goto __39 + goto __41 +__41: + ; + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + y = lim + if !((lim & uint64(1)) != 0) { + goto __42 + } + neg = 0 +__42: + ; +__38: + ; +done: + if (*FILE1)(unsafe.Pointer((f))).shlim >= int64(0) { + (*FILE1)(unsafe.Pointer(f)).rpos-- + } else { + } + if !(y >= lim) { + goto __43 + } + if !(!((lim & uint64(1)) != 0) && !(neg != 0)) { + goto __44 + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return (lim - uint64(1)) + goto __45 +__44: + if !(y > lim) { + goto __46 + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 34 + return lim +__46: + ; +__45: + ; +__43: + ; + return ((y ^ uint64(neg)) - uint64(neg)) +} + +// The shcnt field stores the number of bytes read so far, offset by +// the value of buf-rpos at the last function call (__shlim or __shgetc), +// so that between calls the inline shcnt macro can add rpos-buf to get +// the actual count. + +func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */ + (*FILE1)(unsafe.Pointer(f)).shlim = lim + (*FILE1)(unsafe.Pointer(f)).shcnt = ((int64((*FILE1)(unsafe.Pointer(f)).buf) - int64((*FILE1)(unsafe.Pointer(f)).rpos)) / 1) + // If lim is nonzero, rend must be a valid pointer. + if (lim != 0) && (((int64((*FILE1)(unsafe.Pointer(f)).rend) - int64((*FILE1)(unsafe.Pointer(f)).rpos)) / 1) > lim) { + (*FILE1)(unsafe.Pointer(f)).shend = ((*FILE1)(unsafe.Pointer(f)).rpos + uintptr(lim)) + } else { + (*FILE1)(unsafe.Pointer(f)).shend = (*FILE1)(unsafe.Pointer(f)).rend + } +} + +func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */ + var c int32 + var cnt off_t = ((*FILE1)(unsafe.Pointer((f))).shcnt + ((int64((*FILE1)(unsafe.Pointer((f))).rpos) - int64((*FILE1)(unsafe.Pointer((f))).buf)) / 1)) + if (((*FILE1)(unsafe.Pointer(f)).shlim != 0) && (cnt >= (*FILE1)(unsafe.Pointer(f)).shlim)) || ((AssignInt32(&c, X__uflow(tls, f))) < 0) { + (*FILE1)(unsafe.Pointer(f)).shcnt = (((int64((*FILE1)(unsafe.Pointer(f)).buf) - int64((*FILE1)(unsafe.Pointer(f)).rpos)) / 1) + cnt) + (*FILE1)(unsafe.Pointer(f)).shend = (*FILE1)(unsafe.Pointer(f)).rpos + (*FILE1)(unsafe.Pointer(f)).shlim = int64(-1) + return -1 + } + cnt++ + if ((*FILE1)(unsafe.Pointer(f)).shlim != 0) && (((int64((*FILE1)(unsafe.Pointer(f)).rend) - int64((*FILE1)(unsafe.Pointer(f)).rpos)) / 1) > ((*FILE1)(unsafe.Pointer(f)).shlim - cnt)) { + (*FILE1)(unsafe.Pointer(f)).shend = ((*FILE1)(unsafe.Pointer(f)).rpos + uintptr(((*FILE1)(unsafe.Pointer(f)).shlim - cnt))) + } else { + (*FILE1)(unsafe.Pointer(f)).shend = (*FILE1)(unsafe.Pointer(f)).rend + } + (*FILE1)(unsafe.Pointer(f)).shcnt = (((int64((*FILE1)(unsafe.Pointer(f)).buf) - int64((*FILE1)(unsafe.Pointer(f)).rpos)) / 1) + cnt) + if (*FILE1)(unsafe.Pointer(f)).rpos <= (*FILE1)(unsafe.Pointer(f)).buf { + *(*uint8)(unsafe.Pointer((*FILE1)(unsafe.Pointer(f)).rpos + UintptrFromInt32(-1))) = uint8(c) + } + return c +} + +func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ + return ((((__x >> 24) | ((__x >> 8) & uint32_t(0xff00))) | ((__x << 8) & uint32_t(0xff0000))) | (__x << 24)) +} + +func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */ + return Xcopysign(tls, x, y) +} + +func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */ + return Xfabs(tls, x) +} + +func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */ + return Xfmod(tls, x, y) +} + +var toint double_t = (float64(float64(1)) / 2.22044604925031308085e-16) /* rint.c:10:23 */ + +func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*struct{ f float64 })(unsafe.Pointer(bp /* u */)) = struct{ f float64 }{f: x} + var e int32 = (int32((*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 52) & uint64(0x7ff))) + var s int32 = (int32(*(*uint64_t)(unsafe.Pointer(bp /* &u */)) >> 63)) + var y double_t + + if e >= (0x3ff + 52) { + return x + } + if s != 0 { + y = ((x - toint) + toint) + } else { + y = ((x + toint) - toint) + } + if y == float64(0) { + if s != 0 { + return -Float64FromFloat64(0.0) + } + return float64(0) + } + return y +} + +func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var u struct {f float64;} at bp, 8 + + var y double_t = x + + if n > 1023 { + y = y * (0x1p1023) + n = n - (1023) + if n > 1023 { + y = y * (0x1p1023) + n = n - (1023) + if n > 1023 { + n = 1023 + } + } + } else if n < -1022 { + // make sure final n < -53 to avoid double + // rounding in the subnormal range + y = y * (float64(0x1p-1022) * 0x1p53) + n = n + (1022 - 53) + if n < -1022 { + y = y * (float64(0x1p-1022) * 0x1p53) + n = n + (1022 - 53) + if n < -1022 { + n = -1022 + } + } + } + *(*uint64_t)(unsafe.Pointer(bp /* &u */)) = ((uint64_t(0x3ff + n)) << 52) + x = (y * *(*float64)(unsafe.Pointer(bp /* &u */))) + return x +} + +func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ + return Xscalbn(tls, x, n) +} + +type div_t = struct { + quot int32 + rem int32 +} /* stdlib.h:62:35 */ +type ldiv_t = struct { + quot int64 + rem int64 +} /* stdlib.h:63:36 */ +type lldiv_t = struct { + quot int64 + rem int64 +} /* stdlib.h:64:41 */ + +type max_align_t = struct { + __ll int64 + __ld float64 +} /* alltypes.h:41:54 */ + +type imaxdiv_t = struct { + quot intmax_t + rem intmax_t +} /* inttypes.h:14:40 */ + +type pid_t = int32 /* alltypes.h:235:13 */ + +type uid_t = uint32 /* alltypes.h:245:18 */ + +type gid_t = uint32 /* alltypes.h:250:18 */ + +type iovec = struct { + iov_base uintptr + iov_len size_t +} /* alltypes.h:355:1 */ + +type socklen_t = uint32 /* alltypes.h:361:18 */ + +type sa_family_t = uint16 /* alltypes.h:366:24 */ + +type msghdr = struct { + msg_name uintptr + msg_namelen socklen_t + _ [4]byte + msg_iov uintptr + msg_iovlen int32 + __pad1 int32 + msg_control uintptr + msg_controllen socklen_t + __pad2 int32 + msg_flags int32 + _ [4]byte +} /* socket.h:22:1 */ + +type cmsghdr = struct { + cmsg_len socklen_t + __pad1 int32 + cmsg_level int32 + cmsg_type int32 +} /* socket.h:44:1 */ + +type linger = struct { + l_onoff int32 + l_linger int32 +} /* socket.h:74:1 */ + +type sockaddr = struct { + sa_family sa_family_t + sa_data [14]int8 +} /* socket.h:367:1 */ + +type sockaddr_storage = struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 +} /* socket.h:372:1 */ + +type in_port_t = uint16_t /* in.h:12:18 */ +type in_addr_t = uint32_t /* in.h:13:18 */ +type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */ + +type sockaddr_in = struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t +} /* in.h:16:1 */ + +type in6_addr = struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } +} /* in.h:23:1 */ + +type sockaddr_in6 = struct { + sin6_family sa_family_t + sin6_port in_port_t + sin6_flowinfo uint32_t + sin6_addr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + sin6_scope_id uint32_t +} /* in.h:34:1 */ + +type ipv6_mreq = struct { + ipv6mr_multiaddr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + ipv6mr_interface uint32 +} /* in.h:42:1 */ + +type ip_opts = struct { + ip_dst struct{ s_addr in_addr_t } + ip_opts [40]int8 +} /* in.h:229:1 */ + +type ip_mreq = struct { + imr_multiaddr struct{ s_addr in_addr_t } + imr_interface struct{ s_addr in_addr_t } +} /* in.h:247:1 */ + +type ip_mreqn = struct { + imr_multiaddr struct{ s_addr in_addr_t } + imr_address struct{ s_addr in_addr_t } + imr_ifindex int32 +} /* in.h:252:1 */ + +type ip_mreq_source = struct { + imr_multiaddr struct{ s_addr in_addr_t } + imr_interface struct{ s_addr in_addr_t } + imr_sourceaddr struct{ s_addr in_addr_t } +} /* in.h:258:1 */ + +type ip_msfilter = struct { + imsf_multiaddr struct{ s_addr in_addr_t } + imsf_interface struct{ s_addr in_addr_t } + imsf_fmode uint32_t + imsf_numsrc uint32_t + imsf_slist [1]struct{ s_addr in_addr_t } +} /* in.h:264:1 */ + +type group_req = struct { + gr_interface uint32_t + _ [4]byte + gr_group struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } +} /* in.h:275:1 */ + +type group_source_req = struct { + gsr_interface uint32_t + _ [4]byte + gsr_group struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } + gsr_source struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } +} /* in.h:280:1 */ + +type group_filter = struct { + gf_interface uint32_t + _ [4]byte + gf_group struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } + gf_fmode uint32_t + gf_numsrc uint32_t + gf_slist [1]struct { + ss_family sa_family_t + __ss_padding [118]int8 + __ss_align uint64 + } +} /* in.h:286:1 */ + +type in_pktinfo = struct { + ipi_ifindex int32 + ipi_spec_dst struct{ s_addr in_addr_t } + ipi_addr struct{ s_addr in_addr_t } +} /* in.h:297:1 */ + +type in6_pktinfo = struct { + ipi6_addr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + ipi6_ifindex uint32 +} /* in.h:303:1 */ + +type ip6_mtuinfo = struct { + ip6m_addr struct { + sin6_family sa_family_t + sin6_port in_port_t + sin6_flowinfo uint32_t + sin6_addr struct { + __in6_union struct { + _ [0]uint32 + __s6_addr [16]uint8_t + } + } + sin6_scope_id uint32_t + } + ip6m_mtu uint32_t +} /* in.h:308:1 */ + +type addrinfo = struct { + ai_flags int32 + ai_family int32 + ai_socktype int32 + ai_protocol int32 + ai_addrlen socklen_t + _ [4]byte + ai_addr uintptr + ai_canonname uintptr + ai_next uintptr +} /* netdb.h:16:1 */ + +// Legacy functions follow (marked OBsolete in SUS) + +type netent = struct { + n_name uintptr + n_aliases uintptr + n_addrtype int32 + n_net uint32_t +} /* netdb.h:62:1 */ + +type hostent = struct { + h_name uintptr + h_aliases uintptr + h_addrtype int32 + h_length int32 + h_addr_list uintptr +} /* netdb.h:69:1 */ + +type servent = struct { + s_name uintptr + s_aliases uintptr + s_port int32 + _ [4]byte + s_proto uintptr +} /* netdb.h:78:1 */ + +type protoent = struct { + p_name uintptr + p_aliases uintptr + p_proto int32 + _ [4]byte +} /* netdb.h:85:1 */ + +type aibuf = struct { + ai struct { + ai_flags int32 + ai_family int32 + ai_socktype int32 + ai_protocol int32 + ai_addrlen socklen_t + _ [4]byte + ai_addr uintptr + ai_canonname uintptr + ai_next uintptr + } + sa struct { + sin struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t + } + _ [12]byte + } + lock [1]int32 + slot int16 + ref int16 + _ [4]byte +} /* lookup.h:10:1 */ + +type sa = struct { + sin struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t + } + _ [12]byte +} /* lookup.h:10:1 */ + +type address = struct { + family int32 + scopeid uint32 + addr [16]uint8_t + sortkey int32 +} /* lookup.h:20:1 */ + +type service = struct { + port uint16_t + proto uint8 + socktype uint8 +} /* lookup.h:27:1 */ + +type resolvconf = struct { + ns [3]struct { + family int32 + scopeid uint32 + addr [16]uint8_t + sortkey int32 + } + nns uint32 + attempts uint32 + ndots uint32 + timeout uint32 +} /* lookup.h:34:1 */ + +func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ + var cnt size_t + cnt = uint64(1) +__1: + if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) { + goto __3 + } + goto __2 +__2: + cnt++ + p = (*addrinfo)(unsafe.Pointer(p)).ai_next + goto __1 + goto __3 +__3: + ; + var b uintptr = (p - uintptr((uint64((uintptr(0) /* &.ai */))))) + b -= 88 * (uintptr((*aibuf)(unsafe.Pointer(b)).slot)) + //TODO LOCK(b->lock); + if !(int32(AssignSubPtrInt16(b+82 /* &.ref */, int16(cnt))) != 0) { + Xfree(tls, b) + } + //TODO else UNLOCK(b->lock); +} + +type time_t = int64 /* alltypes.h:85:16 */ + +type clockid_t = int32 /* alltypes.h:214:13 */ + +type timespec = struct { + tv_sec time_t + tv_nsec int64 +} /* alltypes.h:229:1 */ + +type pthread_t = uintptr /* alltypes.h:273:26 */ + +type pthread_once_t = int32 /* alltypes.h:279:13 */ + +type pthread_key_t = uint32 /* alltypes.h:284:18 */ + +type pthread_spinlock_t = int32 /* alltypes.h:289:13 */ + +type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:294:37 */ + +type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:299:37 */ + +type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:304:37 */ + +type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:309:40 */ + +type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:349:9 */ + +type sigset_t = __sigset_t /* alltypes.h:349:71 */ + +type pthread_attr_t = struct { + __u struct { + _ [0]uint64 + __i [14]int32 + } +} /* alltypes.h:372:147 */ + +type pthread_mutex_t = struct { + __u struct { + _ [0]uint64 + __i [10]int32 + } +} /* alltypes.h:377:157 */ + +type pthread_cond_t = struct { + __u struct { + _ [0]uint64 + __i [12]int32 + } +} /* alltypes.h:387:112 */ + +type pthread_rwlock_t = struct { + __u struct { + _ [0]uint64 + __i [14]int32 + } +} /* alltypes.h:397:139 */ + +type pthread_barrier_t = struct { + __u struct { + _ [0]uint64 + __i [8]int32 + } +} /* alltypes.h:402:137 */ + +type sched_param = struct { + sched_priority int32 + __reserved1 int32 + __reserved2 [2]struct { + __reserved1 time_t + __reserved2 int64 + } + __reserved3 int32 + _ [4]byte +} /* sched.h:19:1 */ + +type timer_t = uintptr /* alltypes.h:209:14 */ + +type clock_t = int64 /* alltypes.h:219:14 */ + +type tm = struct { + tm_sec int32 + tm_min int32 + tm_hour int32 + tm_mday int32 + tm_mon int32 + tm_year int32 + tm_wday int32 + tm_yday int32 + tm_isdst int32 + _ [4]byte + tm_gmtoff int64 + tm_zone uintptr +} /* time.h:38:1 */ + +type itimerspec = struct { + it_interval struct { + tv_sec time_t + tv_nsec int64 + } + it_value struct { + tv_sec time_t + tv_nsec int64 + } +} /* time.h:80:1 */ + +type __ptcb = struct { + __f uintptr + __x uintptr + __next uintptr +} /* pthread.h:206:1 */ + +type useconds_t = uint32 /* alltypes.h:260:18 */ + +func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ + bp := tls.Alloc(1608) + defer tls.Free(1608) + + // var ports [2]service at bp, 8 + + // var addrs [48]address at bp+8, 1344 + + // var canon [256]int8 at bp+1352, 256 + + var outcanon uintptr + var nservs int32 + var naddrs int32 + var nais int32 + var canon_len int32 + var i int32 + var j int32 + var k int32 + var family int32 = 0 + var flags int32 = 0 + var proto int32 = 0 + var socktype int32 = 0 + var out uintptr + + if !(host != 0) && !(serv != 0) { + return -2 + } + + if hint != 0 { + family = (*addrinfo)(unsafe.Pointer(hint)).ai_family + flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags + proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol + socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype + + var mask int32 = ((((((0x01 | 0x02) | 0x04) | 0x08) | 0x10) | 0x20) | 0x400) + if (flags & mask) != flags { + return -1 + } + + switch family { + case 2: + fallthrough + case 10: + fallthrough + case 0: + break + fallthrough + default: + return -6 + } + } + + if (flags & 0x20) != 0 { + Xabort(tls) //TODO- + // /* Define the "an address is configured" condition for address + // * families via ability to create a socket for the family plus + // * routability of the loopback address for the family. */ + // static const struct sockaddr_in lo4 = { + // .sin_family = AF_INET, .sin_port = 65535, + // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN + // ? 0x7f000001 : 0x0100007f + // }; + // static const struct sockaddr_in6 lo6 = { + // .sin6_family = AF_INET6, .sin6_port = 65535, + // .sin6_addr = IN6ADDR_LOOPBACK_INIT + // }; + // int tf[2] = { AF_INET, AF_INET6 }; + // const void *ta[2] = { &lo4, &lo6 }; + // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; + // for (i=0; i<2; i++) { + // if (family==tf[1-i]) continue; + // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, + // IPPROTO_UDP); + // if (s>=0) { + // int cs; + // pthread_setcancelstate( + // PTHREAD_CANCEL_DISABLE, &cs); + // int r = connect(s, ta[i], tl[i]); + // pthread_setcancelstate(cs, 0); + // close(s); + // if (!r) continue; + // } + // switch (errno) { + // case EADDRNOTAVAIL: + // case EAFNOSUPPORT: + // case EHOSTUNREACH: + // case ENETDOWN: + // case ENETUNREACH: + // break; + // default: + // return EAI_SYSTEM; + // } + // if (family == tf[i]) return EAI_NONAME; + // family = tf[1-i]; + // } + } + + nservs = X__lookup_serv(tls, bp /* &ports[0] */, serv, proto, socktype, flags) + if nservs < 0 { + return nservs + } + + naddrs = X__lookup_name(tls, bp+8 /* &addrs[0] */, bp+1352 /* &canon[0] */, host, family, flags) + if naddrs < 0 { + return naddrs + } + + nais = (nservs * naddrs) + canon_len = int32(Xstrlen(tls, bp+1352 /* &canon[0] */)) + out = Xcalloc(tls, uint64(1), (((uint64(nais) * uint64(unsafe.Sizeof(aibuf{}))) + uint64(canon_len)) + uint64(1))) + if !(out != 0) { + return -10 + } + + if canon_len != 0 { + outcanon = (out + uintptr(nais)*88) + Xmemcpy(tls, outcanon, bp+1352 /* &canon[0] */, (uint64(canon_len + 1))) + } else { + outcanon = uintptr(0) + } + + for k = AssignInt32(&i, 0); i < naddrs; i++ { + j = 0 + __1: + if !(j < nservs) { + goto __3 + } + { + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k) + //TODO out[k].ai = (struct addrinfo){ + //TODO .ai_family = addrs[i].family, + //TODO .ai_socktype = ports[j].socktype, + //TODO .ai_protocol = ports[j].proto, + //TODO .ai_addrlen = addrs[i].family == AF_INET + //TODO ? sizeof(struct sockaddr_in) + //TODO : sizeof(struct sockaddr_in6), + //TODO .ai_addr = (void *)&out[k].sa, + //TODO .ai_canonname = outcanon }; + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 /* &addrs */ + uintptr(i)*28)).family + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp /* &ports */ + uintptr(j)*4)).socktype) + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp /* &ports */ + uintptr(j)*4)).proto) + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 { + if (*address)(unsafe.Pointer(bp+8 /* &addrs */ +uintptr(i)*28)).family == 2 { + return uint32(unsafe.Sizeof(sockaddr_in{})) + } + return uint32(unsafe.Sizeof(sockaddr_in6{})) + }() + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = (out + uintptr(k)*88 + 48 /* &.sa */) + (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon + if k != 0 { + (*aibuf)(unsafe.Pointer(out + uintptr((k-1))*88)).ai.ai_next = (out + uintptr(k)*88 /* &.ai */) + } + switch (*address)(unsafe.Pointer(bp + 8 /* &addrs */ + uintptr(i)*28)).family { + case 2: + (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin_family = sa_family_t(2) + (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp /* &ports */ +uintptr(j)*4)).port) + Xmemcpy(tls, (out + uintptr(k)*88 + 48 /* &.sa */ /* &.sin */ + 4 /* &.sin_addr */), (bp + 8 /* &addrs */ + uintptr(i)*28 + 8 /* &.addr */), uint64(4)) + break + case 10: + (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin6_family = sa_family_t(10) + (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp /* &ports */ +uintptr(j)*4)).port) + (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48 /* &.sa */)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 /* &addrs */ + uintptr(i)*28)).scopeid + Xmemcpy(tls, (out + uintptr(k)*88 + 48 /* &.sa */ /* &.sin6 */ + 8 /* &.sin6_addr */), (bp + 8 /* &addrs */ + uintptr(i)*28 + 8 /* &.addr */), uint64(16)) + break + } + + } + goto __2 + __2: + j++ + k++ + goto __1 + goto __3 + __3: + } + (*aibuf)(unsafe.Pointer(out)).ref = int16(nais) + *(*uintptr)(unsafe.Pointer(res)) = (out /* &.ai */) + return 0 +} + +type ucred = struct { + pid pid_t + uid uid_t + gid gid_t +} /* socket.h:57:1 */ + +type mmsghdr = struct { + msg_hdr struct { + msg_name uintptr + msg_namelen socklen_t + _ [4]byte + msg_iov uintptr + msg_iovlen int32 + __pad1 int32 + msg_control uintptr + msg_controllen socklen_t + __pad2 int32 + msg_flags int32 + _ [4]byte + } + msg_len uint32 + _ [4]byte +} /* socket.h:63:1 */ + +func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var size size_t = uint64(63) + // var res uintptr at bp, 8 + + var err int32 + for ok := true; ok; ok = (err == 34) { + Xfree(tls, _sh) + _sh = Xmalloc(tls, AssignAddUint64(&size, (size+uint64(1)))) + if !(_sh != 0) { + (*(*int32)(unsafe.Pointer(X__h_errno_location(tls)))) = 3 + return uintptr(0) + } + err = Xgethostbyaddr_r(tls, a, l, af, _sh, + (_sh + uintptr(1)*32), (size - size_t(unsafe.Sizeof(hostent{}))), bp /* &res */, X__h_errno_location(tls)) + } + if err != 0 { + return uintptr(0) + } + return _sh +} + +var _sh uintptr /* gethostbyaddr.c:9:24: */ + +func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ + return Xgethostbyname2(tls, name, 2) +} + +func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var size size_t = uint64(63) + // var res uintptr at bp, 8 + + var err int32 + for ok := true; ok; ok = (err == 34) { + Xfree(tls, _sh1) + _sh1 = Xmalloc(tls, AssignAddUint64(&size, (size+uint64(1)))) + if !(_sh1 != 0) { + (*(*int32)(unsafe.Pointer(X__h_errno_location(tls)))) = 3 + return uintptr(0) + } + err = Xgethostbyname2_r(tls, name, af, _sh1, + (_sh1 + uintptr(1)*32), (size - size_t(unsafe.Sizeof(hostent{}))), bp /* &res */, X__h_errno_location(tls)) + } + if err != 0 { + return uintptr(0) + } + return _sh1 +} + +var _sh1 uintptr /* gethostbyname2.c:10:24: */ + +func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */ + bp := tls.Alloc(1600) + defer tls.Free(1600) + + // var addrs [48]address at bp, 1344 + + // var canon [256]int8 at bp+1344, 256 + + var i int32 + var cnt int32 + var align size_t + var need size_t + + *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) + cnt = X__lookup_name(tls, bp /* &addrs[0] */, bp+1344 /* &canon[0] */, name, af, 0x02) + if cnt < 0 { + switch cnt { + case -2: + *(*int32)(unsafe.Pointer(err)) = 1 + return 2 + fallthrough + case -3: + *(*int32)(unsafe.Pointer(err)) = 2 + return 11 + fallthrough + default: + fallthrough + case -4: + *(*int32)(unsafe.Pointer(err)) = 3 + return 74 + fallthrough + case -10: + fallthrough + case -11: + *(*int32)(unsafe.Pointer(err)) = 3 + return *(*int32)(unsafe.Pointer(X___errno_location(tls))) + } + } + + (*hostent)(unsafe.Pointer(h)).h_addrtype = af + (*hostent)(unsafe.Pointer(h)).h_length = func() int32 { + if af == 10 { + return 16 + } + return 4 + }() + + // Align buffer + align = (-uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))) + + need = (uint64(4) * uint64(unsafe.Sizeof(uintptr(0)))) + need = need + ((uint64(cnt + 1)) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64((*hostent)(unsafe.Pointer(h)).h_length))) + need = need + (Xstrlen(tls, name) + uint64(1)) + need = need + (Xstrlen(tls, bp+1344 /* &canon[0] */) + uint64(1)) + need = need + (align) + + if need > buflen { + return 34 + } + + buf += uintptr(align) + (*hostent)(unsafe.Pointer(h)).h_aliases = buf + buf += (uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0))))) + (*hostent)(unsafe.Pointer(h)).h_addr_list = buf + buf += (uintptr((uint64(cnt + 1)) * uint64(unsafe.Sizeof(uintptr(0))))) + + for i = 0; i < cnt; i++ { + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf + buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length) + Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)), bp /* &addrs */ +uintptr(i)*28+8 /* &.addr */, uint64((*hostent)(unsafe.Pointer(h)).h_length)) + } + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0) + + (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf) + Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344 /* &canon[0] */) + buf += (uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1))) + + if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 { + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf + Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name) + buf += (uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1))) + } else { + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) + } + + *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0) + + *(*uintptr)(unsafe.Pointer(res)) = h + return 0 +} + +type if_nameindex = struct { + if_index uint32 + _ [4]byte + if_name uintptr +} /* if.h:12:1 */ + +type ifaddr = struct { + ifa_addr struct { + sa_family sa_family_t + sa_data [14]int8 + } + ifa_ifu struct { + ifu_broadaddr struct { + sa_family sa_family_t + sa_data [14]int8 + } + } + ifa_ifp uintptr + ifa_next uintptr +} /* if.h:51:1 */ + +type ifmap = struct { + mem_start uint64 + mem_end uint64 + base_addr uint16 + irq uint8 + dma uint8 + port uint8 + _ [3]byte +} /* if.h:64:1 */ + +type ifreq = struct { + ifr_ifrn struct{ ifrn_name [16]int8 } + ifr_ifru struct { + _ [0]uint64 + ifru_addr struct { + sa_family sa_family_t + sa_data [14]int8 + } + _ [8]byte + } +} /* if.h:76:1 */ + +type ifconf = struct { + ifc_len int32 + _ [4]byte + ifc_ifcu struct{ ifcu_buf uintptr } +} /* if.h:116:1 */ + +type ns_sect = uint32 /* nameser.h:37:3 */ + +type __ns_msg = struct { + _msg uintptr + _eom uintptr + _id uint16_t + _flags uint16_t + _counts [4]uint16_t + _ [4]byte + _sections [4]uintptr + _sect ns_sect + _rrnum int32 + _msg_ptr uintptr +} /* nameser.h:39:9 */ + +type ns_msg = __ns_msg /* nameser.h:46:3 */ + +type _ns_flagdata = struct { + mask int32 + shift int32 +} /* nameser.h:48:1 */ + +type __ns_rr = struct { + name [1025]int8 + _ [1]byte + __type uint16_t + rr_class uint16_t + _ [2]byte + ttl uint32_t + rdlength uint16_t + _ [2]byte + rdata uintptr +} /* nameser.h:59:9 */ + +type ns_rr = __ns_rr /* nameser.h:66:3 */ + +type ns_flag = uint32 /* nameser.h:87:3 */ + +type ns_opcode = uint32 /* nameser.h:96:3 */ + +type ns_rcode = uint32 /* nameser.h:115:3 */ + +type ns_update_operation = uint32 /* nameser.h:121:3 */ + +type ns_tsig_key1 = struct { + name [1025]int8 + alg [1025]int8 + _ [6]byte + data uintptr + len int32 + _ [4]byte +} /* nameser.h:123:1 */ + +type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ + +type ns_tcp_tsig_state1 = struct { + counter int32 + _ [4]byte + key uintptr + ctx uintptr + sig [512]uint8 + siglen int32 + _ [4]byte +} /* nameser.h:130:1 */ + +type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ + +type ns_type = uint32 /* nameser.h:200:3 */ + +type ns_class = uint32 /* nameser.h:219:3 */ + +type ns_key_types = uint32 /* nameser.h:226:3 */ + +type ns_cert_types = uint32 /* nameser.h:234:3 */ + +type HEADER = struct { + _ [0]uint32 + id uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */ + qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ + nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ +} /* nameser.h:353:3 */ + +// unused; purely for broken apps +type __res_state = struct { + retrans int32 + retry int32 + options uint64 + nscount int32 + nsaddr_list [3]struct { + sin_family sa_family_t + sin_port in_port_t + sin_addr struct{ s_addr in_addr_t } + sin_zero [8]uint8_t + } + id uint16 + _ [2]byte + dnsrch [7]uintptr + defdname [256]int8 + pfcode uint64 + ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ + _ [4]byte + sort_list [10]struct { + addr struct{ s_addr in_addr_t } + mask uint32_t + } + qhook uintptr + rhook uintptr + res_h_errno int32 + _vcsock int32 + _flags uint32 + _ [4]byte + _u struct { + _ [0]uint64 + pad [52]int8 + _ [4]byte + } +} /* resolv.h:26:9 */ + +// unused; purely for broken apps +type res_state = uintptr /* resolv.h:62:3 */ + +type res_sym = struct { + number int32 + _ [4]byte + name uintptr + humanname uintptr +} /* resolv.h:70:1 */ + +func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ + p += (uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0))))) + *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0) + for ok := true; ok; ok = x != 0 { + *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = (int8(uint32('0') + (x % uint32(10)))) + x = x / (uint32(10)) + } + return p +} + +func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + Xsprintf(tls, s, ts+23, /* "%d.%d.%d.%d.in-a..." */ + VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) +} + +func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ + var i int32 + for i = 15; i >= 0; i-- { + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) & 15)] + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[(int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i)))) >> 4)] + *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') + } + Xstrcpy(tls, s, ts+48 /* "ip6.arpa" */) +} + +var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 57 /* "0123456789abcdef" */)) /* getnameinfo.c:36:20 */ + +func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ + bp := tls.Alloc(556) + defer tls.Free(556) + + // var line [512]int8 at bp+16, 512 + + var p uintptr + var z uintptr + var _buf [1032]uint8 + _ = _buf + // var atmp [16]uint8 at bp, 16 + + // var iplit address at bp+528, 28 + + //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); + var f uintptr = Xfopen(tls, ts+74 /* "/etc/hosts" */, ts+85 /* "rb" */) + if !(f != 0) { + return + } + if family == 2 { + Xmemcpy(tls, (bp /* &atmp[0] */ + uintptr(12)), a, uint64(4)) + Xmemcpy(tls, bp /* &atmp[0] */, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) + a = bp /* &atmp[0] */ + } + for Xfgets(tls, bp+16 /* &line[0] */, int32(unsafe.Sizeof([512]int8{})), f) != 0 { + if AssignUintptr(&p, Xstrchr(tls, bp+16 /* &line[0] */, '#')) != 0 { + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') + *(*int8)(unsafe.Pointer(p)) = int8(0) + } + + for p = bp + 16; /* &line[0] */ (*(*int8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) + if X__lookup_ipliteral(tls, bp+528 /* &iplit */, bp+16 /* &line[0] */, 0) <= 0 { + continue + } + + if (*address)(unsafe.Pointer(bp+528 /* &iplit */)).family == 2 { + Xmemcpy(tls, ((bp + 528 /* &iplit */ + 8 /* &.addr */) + uintptr(12)), bp+528 /* &iplit */ +8 /* &.addr */, uint64(4)) + Xmemcpy(tls, bp+528 /* &iplit */ +8 /* &.addr */, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) + (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0) + } + + if (Xmemcmp(tls, a, bp+528 /* &iplit */ +8 /* &.addr */, uint64(16)) != 0) || ((*address)(unsafe.Pointer(bp+528 /* &iplit */)).scopeid != scopeid) { + continue + } + + for ; (*(*int8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + for z = p; (*(*int8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { + } + *(*int8)(unsafe.Pointer(z)) = int8(0) + if ((int64(z) - int64(p)) / 1) < int64(256) { + Xmemcpy(tls, buf, p, (uint64(((int64(z) - int64(p)) / 1) + int64(1)))) + break + } + } + //TODO __fclose_ca(f); + Xfclose(tls, f) +} + +func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ + Xabort(tls) //TODO- + // unsigned long svport; + // char line[128], *p, *z; + // unsigned char _buf[1032]; + // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); + // if (!f) return; + // while (fgets(line, sizeof line, f)) { + // if ((p=strchr(line, '#'))) *p++='\n', *p=0; + + // for (p=line; *p && !isspace(*p); p++); + // if (!*p) continue; + // *p++ = 0; + // svport = strtoul(p, &z, 10); + + // if (svport != port || z==p) continue; + // if (dgram && strncmp(z, "/udp", 4)) continue; + // if (!dgram && strncmp(z, "/tcp", 4)) continue; + // if (p-line > 32) continue; + + // memcpy(buf, line, p-line); + // break; + // } + // __fclose_ca(f); +} + +var Xh_errno int32 /* h_errno.c:4:5: */ + +func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ + return uintptr(unsafe.Pointer(&Xh_errno)) +} + +func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var s uintptr = s0 + var d uintptr = dest + *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)} + // var z uintptr at bp+32, 8 + + var i int32 + + for i = 0; i < 4; i++ { + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32 /* &z */, 0) + if ((*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) == s) || ((*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)))) != 0) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != '.'))) || !(func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s)))) + } + return (Bool32(((uint32(*(*int8)(unsafe.Pointer(s)))) - uint32('0')) < uint32(10))) + }() != 0) { + return 0 + } + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* z */))))) != 0) { + break + } + s = (*(*uintptr)(unsafe.Pointer(bp + 32 /* z */)) + uintptr(1)) + } + if i == 4 { + return 0 + } + switch i { + case 0: + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */)) & uint64(0xffffff)) + AssignShrPtrUint64(bp /* &a */, int(24)) + fallthrough + case 1: + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 1*8)) & uint64(0xffff)) + AssignShrPtrUint64(bp /* &a */ +1*8, int(16)) + fallthrough + case 2: + *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 3*8)) = (*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + 2*8)) & uint64(0xff)) + AssignShrPtrUint64(bp /* &a */ +2*8, int(8)) + } + for i = 0; i < 4; i++ { + if *(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) > uint64(255) { + return 0 + } + *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8))) + } + return 1 +} + +func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ + bp := tls.Alloc(276) + defer tls.Free(276) + + var a uintptr = a0 + var i int32 + var j int32 + var max int32 + var best int32 + // var buf [100]int8 at bp+176, 100 + + switch af { + case 2: + if socklen_t(Xsnprintf(tls, s, uint64(l), ts+101 /* "%d.%d.%d.%d" */, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { + return s + } + break + case 10: + if Xmemcmp(tls, a, ts+88 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff" */, uint64(12)) != 0 { + Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]int8{})), + ts+113, /* "%x:%x:%x:%x:%x:%..." */ + VaList(bp+32, ((256*int32(*(*uint8)(unsafe.Pointer(a))))+int32(*(*uint8)(unsafe.Pointer(a + 1)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 2))))+int32(*(*uint8)(unsafe.Pointer(a + 3)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 4))))+int32(*(*uint8)(unsafe.Pointer(a + 5)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 6))))+int32(*(*uint8)(unsafe.Pointer(a + 7)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 8))))+int32(*(*uint8)(unsafe.Pointer(a + 9)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 10))))+int32(*(*uint8)(unsafe.Pointer(a + 11)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 12))))+int32(*(*uint8)(unsafe.Pointer(a + 13)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 14))))+int32(*(*uint8)(unsafe.Pointer(a + 15)))))) + } else { + Xsnprintf(tls, bp+176 /* &buf[0] */, uint64(unsafe.Sizeof([100]int8{})), + ts+137, /* "%x:%x:%x:%x:%x:%..." */ + VaList(bp+96, ((256*int32(*(*uint8)(unsafe.Pointer(a))))+int32(*(*uint8)(unsafe.Pointer(a + 1)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 2))))+int32(*(*uint8)(unsafe.Pointer(a + 3)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 4))))+int32(*(*uint8)(unsafe.Pointer(a + 5)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 6))))+int32(*(*uint8)(unsafe.Pointer(a + 7)))), + ((256*int32(*(*uint8)(unsafe.Pointer(a + 8))))+int32(*(*uint8)(unsafe.Pointer(a + 9)))), ((256*int32(*(*uint8)(unsafe.Pointer(a + 10))))+int32(*(*uint8)(unsafe.Pointer(a + 11)))), + int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) + } + // Replace longest /(^0|:)[:0]{2,}/ with "::" + i = AssignInt32(&best, 0) + max = 2 + for ; *(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i))) != 0; i++ { + if (i != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(i)))) != ':') { + continue + } + j = int32(Xstrspn(tls, (bp + 176 /* &buf[0] */ + uintptr(i)), ts+167 /* ":0" */)) + if j > max { + best = i + max = j + } + } + if max > 3 { + *(*int8)(unsafe.Pointer(bp + 176 /* &buf[0] */ + uintptr(best))) = AssignPtrInt8(bp+176 /* &buf */ +uintptr((best+1)), int8(':')) + Xmemmove(tls, ((bp + 176 /* &buf[0] */ + uintptr(best)) + uintptr(2)), ((bp + 176 /* &buf[0] */ + uintptr(best)) + uintptr(max)), (uint64(((i - best) - max) + 1))) + } + if Xstrlen(tls, bp+176 /* &buf[0] */) < size_t(l) { + Xstrcpy(tls, s, bp+176 /* &buf[0] */) + return s + } + break + default: + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 97 + return uintptr(0) + } + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 28 + return uintptr(0) +} + +func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ + if (c - uint32('0')) < uint32(10) { + return (int32(c - uint32('0'))) + } + c = c | (uint32(32)) + if (c - uint32('a')) < uint32(6) { + return (int32((c - uint32('a')) + uint32(10))) + } + return -1 +} + +func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var ip [8]uint16_t at bp, 16 + + var a uintptr = a0 + var i int32 + var j int32 + var v int32 + var d int32 + var brk int32 = -1 + var need_v4 int32 = 0 + + if af == 2 { + for i = 0; i < 4; i++ { + for v = AssignInt32(&j, 0); (j < 3) && (func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) + } + return (Bool32(((uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - uint32('0')) < uint32(10))) + }() != 0); j++ { + v = (((10 * v) + int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - '0') + } + if ((j == 0) || ((j > 1) && (int32(*(*int8)(unsafe.Pointer(s))) == '0'))) || (v > 255) { + return 0 + } + *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) + if (int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0) && (i == 3) { + return 1 + } + if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' { + return 0 + } + s += (uintptr(j + 1)) + } + return 0 + } else if af != 10 { + (*(*int32)(unsafe.Pointer(X___errno_location(tls)))) = 97 + return -1 + } + + if (int32(*(*int8)(unsafe.Pointer(s))) == ':') && (int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':') { + return 0 + } + + for i = 0; ; i++ { + if (int32(*(*int8)(unsafe.Pointer(s))) == ':') && (brk < 0) { + brk = i + *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((i&7))*2)) = uint16_t(0) + if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { + break + } + if i == 7 { + return 0 + } + continue + } + for v = AssignInt32(&j, 0); (j < 4) && ((AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))))) >= 0); j++ { + v = ((16 * v) + d) + } + if j == 0 { + return 0 + } + *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((i&7))*2)) = uint16_t(v) + if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && ((brk >= 0) || (i == 7)) { + break + } + if i == 7 { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' { + if (int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.') || ((i < 6) && (brk < 0)) { + return 0 + } + need_v4 = 1 + i++ + break + } + s += (uintptr(j + 1)) + } + if brk >= 0 { + Xmemmove(tls, (((bp /* &ip[0] */ + uintptr(brk)*2) + uintptr(7)*2) - uintptr(i)*2), (bp /* &ip[0] */ + uintptr(brk)*2), (uint64(2 * ((i + 1) - brk)))) + for j = 0; j < (7 - i); j++ { + *(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr((brk+j))*2)) = uint16_t(0) + } + } + for j = 0; j < 8; j++ { + *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = (uint8(int32(*(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr(j)*2))) >> 8)) + *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp /* &ip[0] */ + uintptr(j)*2))) + } + if (need_v4 != 0) && (Xinet_pton(tls, 2, s, (a-uintptr(4))) <= 0) { + return 0 + } + return 1 +} + +func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + // var a4 in_addr at bp, 4 + + // var a6 in6_addr at bp+68, 16 + + if X__inet_aton(tls, name, bp /* &a4 */) > 0 { + if family == 10 { // wrong family + return -2 + } + Xmemcpy(tls, (buf + 8 /* &.addr */), bp /* &a4 */, uint64(unsafe.Sizeof(in_addr{}))) + (*address)(unsafe.Pointer(buf)).family = 2 + (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) + return 1 + } + // var tmp [64]int8 at bp+4, 64 + + var p uintptr = Xstrchr(tls, name, '%') + // var z uintptr at bp+88, 8 + + var scopeid uint64 = uint64(0) + if (p != 0) && (((int64(p) - int64(name)) / 1) < int64(64)) { + Xmemcpy(tls, bp+4 /* &tmp[0] */, name, (uint64((int64(p) - int64(name)) / 1))) + *(*int8)(unsafe.Pointer(bp + 4 /* &tmp[0] */ + uintptr(((int64(p) - int64(name)) / 1)))) = int8(0) + name = bp + 4 /* &tmp[0] */ + } + + if Xinet_pton(tls, 10, name, bp+68 /* &a6 */) <= 0 { + return 0 + } + if family == 2 { // wrong family + return -2 + } + + Xmemcpy(tls, (buf + 8 /* &.addr */), bp+68 /* &a6 */, uint64(unsafe.Sizeof(in6_addr{}))) + (*address)(unsafe.Pointer(buf)).family = 10 + if p != 0 { + if func() int32 { + if 0 != 0 { + return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) + } + return (Bool32(((uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) - uint32('0')) < uint32(10))) + }() != 0 { + scopeid = Xstrtoull(tls, p, bp+88 /* &z */, 10) + } else { + *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = (p - uintptr(1)) + } + if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88 /* z */)))) != 0 { + Xabort(tls) //TODO- + // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && + // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) + // return EAI_NONAME; + // scopeid = if_nametoindex(p); + // if (!scopeid) return EAI_NONAME; + } + if scopeid > uint64(0xffffffff) { + return -2 + } + } + (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid) + return 1 +} + +type mode_t = uint32 /* alltypes.h:152:18 */ + +type flock = struct { + l_type int16 + l_whence int16 + _ [4]byte + l_start off_t + l_len off_t + l_pid pid_t + _ [4]byte +} /* fcntl.h:24:1 */ + +func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ + var s uintptr + //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; + if (Xstrnlen(tls, host, uint64(255)) - uint64(1)) >= uint64(254) { + return 0 + } + for s = host; (((int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80) || (int32(*(*uint8)(unsafe.Pointer(s))) == '.')) || (int32(*(*uint8)(unsafe.Pointer(s))) == '-')) || (Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0); s++ { + } + return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) +} + +var Xzero_struct_address address /* lookup_name.c:27:16: */ + +func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ + var cnt int32 = 0 + if name != 0 { + return 0 + } + if (flags & 0x01) != 0 { + //TODO if (family != AF_INET6) + //TODO buf[cnt++] = (struct address){ .family = AF_INET }; + if family != 10 { + var x = Xzero_struct_address + x.family = 2 + *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x + } + //TODO if (family != AF_INET) + //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; + if family != 2 { + var x = Xzero_struct_address + x.family = 10 + *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x + } + } else { + Xabort(tls) //TODO- + // if (family != AF_INET6) + // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; + // if (family != AF_INET) + // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; + } + return cnt +} + +func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ + return X__lookup_ipliteral(tls, buf, name, family) +} + +func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ + bp := tls.Alloc(512) + defer tls.Free(512) + + // var line [512]int8 at bp, 512 + + var l size_t = Xstrlen(tls, name) + var cnt int32 = 0 + var badfam int32 = 0 + var _buf [1032]uint8 + _ = _buf + //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); + var _f FILE1 + _ = _f + var f uintptr = Xfopen(tls, ts+74 /* "/etc/hosts" */, ts+85 /* "rb" */) + if !(f != 0) { + switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { + case 2: + fallthrough + case 20: + fallthrough + case 13: + return 0 + fallthrough + default: + return -11 + } + } + for (Xfgets(tls, bp /* &line[0] */, int32(unsafe.Sizeof([512]int8{})), f) != 0) && (cnt < 48) { + var p uintptr + var z uintptr + + if AssignUintptr(&p, Xstrchr(tls, bp /* &line[0] */, '#')) != 0 { + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') + *(*int8)(unsafe.Pointer(p)) = int8(0) + } + for p = (bp /* &line[0] */ + uintptr(1)); (AssignUintptr(&p, Xstrstr(tls, p, name)) != 0) && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { + } + if !(p != 0) { + continue + } + + // Isolate IP address to parse + for p = bp; /* &line[0] */ (*(*int8)(unsafe.Pointer(p)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) + switch name_from_numeric(tls, (buf + uintptr(cnt)*28), bp /* &line[0] */, family) { + case 1: + cnt++ + break + case 0: + continue + default: + badfam = -2 + continue + } + + // Extract first name as canonical name + for ; (*(*int8)(unsafe.Pointer(p)) != 0) && (__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { + } + for z = p; (*(*int8)(unsafe.Pointer(z)) != 0) && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { + } + *(*int8)(unsafe.Pointer(z)) = int8(0) + if is_valid_hostname(tls, p) != 0 { + Xmemcpy(tls, canon, p, (uint64(((int64(z) - int64(p)) / 1) + int64(1)))) + } + } + //TODO __fclose_ca(f); + Xfclose(tls, f) + if cnt != 0 { + return cnt + } + return badfam +} + +type dpc_ctx = struct { + addrs uintptr + canon uintptr + cnt int32 + _ [4]byte +} /* lookup_name.c:112:1 */ + +func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ + return -1 //TODO- + Xabort(tls) + return int32(0) //TODO- + // char search[256]; + // struct resolvconf conf; + // size_t l, dots; + // char *p, *z; + + // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; + + // /* Count dots, suppress search when >=ndots or name ends in + // * a dot, which is an explicit request for global scope. */ + // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; + // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; + + // /* Strip final dot for canon, fail if multiple trailing dots. */ + // if (name[l-1]=='.') l--; + // if (!l || name[l-1]=='.') return EAI_NONAME; + + // /* This can never happen; the caller already checked length. */ + // if (l >= 256) return EAI_NONAME; + + // /* Name with search domain appended is setup in canon[]. This both + // * provides the desired default canonical name (if the requested + // * name is not a CNAME record) and serves as a buffer for passing + // * the full requested name to name_from_dns. */ + // memcpy(canon, name, l); + // canon[l] = '.'; + + // for (p=search; *p; p=z) { + // for (; isspace(*p); p++); + // for (z=p; *z && !isspace(*z); z++); + // if (z==p) break; + // if (z-p < 256 - l - 1) { + // memcpy(canon+l+1, p, z-p); + // canon[z-p+1+l] = 0; + // int cnt = name_from_dns(buf, canon, canon, family, &conf); + // if (cnt) return cnt; + // } + // } + + // canon[l] = 0; + // return name_from_dns(buf, canon, name, family, &conf); +} + +type policy = struct { + addr [16]uint8 + len uint8 + mask uint8 + prec uint8 + label uint8 +} /* lookup_name.c:237:14 */ + +var defpolicy = [6]policy{ + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 170 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" */)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 187 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00" */)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 203 /* " \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 219 /* " \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)}, + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 235 /* "\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)}, + // Last rule must match all addresses to stop loop. + {addr: *(*[16]uint8)(unsafe.Pointer(ts + 251 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" */)), prec: uint8(40), label: uint8(1)}, +} /* lookup_name.c:241:3 */ + +func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ + var i int32 + for i = 0; ; i++ { + if Xmemcmp(tls, a /* &.__in6_union */ /* &.__s6_addr */, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20 /* &.addr */, uint64(defpolicy[i].len)) != 0 { + continue + } + if (int32(*(*uint8_t)(unsafe.Pointer((a /* &.__in6_union */ /* &.__s6_addr */) + uintptr(defpolicy[i].len)))) & int32(defpolicy[i].mask)) != + int32(*(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 /* &.addr */) + uintptr(defpolicy[i].len)))) { + continue + } + return (uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20) + } + return uintptr(0) +} + +func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ + return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label) +} + +func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ + if int32(*(*uint8_t)(unsafe.Pointer((a)))) == 0xff { + return (int32(*(*uint8_t)(unsafe.Pointer((a /* &.__in6_union */ /* &.__s6_addr */) + 1))) & 15) + } + if ((int32(*(*uint8_t)(unsafe.Pointer((a))))) == 0xfe) && ((int32(*(*uint8_t)(unsafe.Pointer((a) + 1))) & 0xc0) == 0x80) { + return 2 + } + if ((((((*(*uint32_t)(unsafe.Pointer((a))) == uint32_t(0)) && (*(*uint32_t)(unsafe.Pointer((a) + 1*4)) == uint32_t(0))) && (*(*uint32_t)(unsafe.Pointer((a) + 2*4)) == uint32_t(0))) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 12))) == 0)) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 13))) == 0)) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 14))) == 0)) && (int32(*(*uint8_t)(unsafe.Pointer((a) + 15))) == 1) { + return 2 + } + if ((int32(*(*uint8_t)(unsafe.Pointer((a))))) == 0xfe) && ((int32(*(*uint8_t)(unsafe.Pointer((a) + 1))) & 0xc0) == 0xc0) { + return 5 + } + return 14 +} + +func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ + // FIXME: The common prefix length should be limited to no greater + // than the nominal length of the prefix portion of the source + // address. However the definition of the source prefix length is + // not clear and thus this limiting is not yet implemented. + var i uint32 + for i = uint32(0); (i < uint32(128)) && !(((int32(*(*uint8_t)(unsafe.Pointer((s /* &.__in6_union */ /* &.__s6_addr */) + uintptr((i / uint32(8)))))) ^ int32(*(*uint8_t)(unsafe.Pointer((d /* &.__in6_union */ /* &.__s6_addr */) + uintptr((i / uint32(8))))))) & (int32(128) >> (i % uint32(8)))) != 0); i++ { + } + return int32(i) +} + +func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ + var a uintptr = _a + var b uintptr = _b + return ((*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey) +} + +func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ + bp := tls.Alloc(92) + defer tls.Free(92) + + var cnt int32 = 0 + var i int32 + var j int32 + _ = j + + *(*int8)(unsafe.Pointer(canon)) = int8(0) + if name != 0 { + // reject empty name and check len so it fits into temp bufs + var l size_t = Xstrnlen(tls, name, uint64(255)) + if (l - uint64(1)) >= uint64(254) { + return -2 + } + Xmemcpy(tls, canon, name, (l + uint64(1))) + } + + // Procedurally, a request for v6 addresses with the v4-mapped + // flag set is like a request for unspecified family, followed + // by filtering of the results. + if (flags & 0x08) != 0 { + if family == 10 { + family = 0 + } else { + flags = flags - (0x08) + } + } + + // Try each backend until there's at least one result. + cnt = name_from_null(tls, buf, name, family, flags) + if !(cnt != 0) { + cnt = name_from_numeric(tls, buf, name, family) + } + if !(cnt != 0) && !((flags & 0x04) != 0) { + cnt = name_from_hosts(tls, buf, canon, name, family) + if !(cnt != 0) { + cnt = name_from_dns_search(tls, buf, canon, name, family) + } + } + if cnt <= 0 { + if cnt != 0 { + return cnt + } + return -2 + } + + // Filter/transform results for v4-mapped lookup, if requested. + if (flags & 0x08) != 0 { + Xabort(tls) //TODO- + // if (!(flags & AI_ALL)) { + // /* If any v6 results exist, remove v4 results. */ + // for (i=0; i= 0 { + if !(Xconnect(tls, fd, da, dalen) != 0) { + key = key | (0x40000000) + if !(Xgetsockname(tls, fd, sa1, bp+88 /* &salen */) != 0) { + if family == 2 { + Xmemcpy(tls, + ((bp + 28 /* &sa6 */ + 8 /* &.sin6_addr */ /* &.__in6_union */ /* &.__s6_addr */) + uintptr(12)), + (bp + 72 /* &sa4 */ + 4 /* &.sin_addr */), uint64(4)) + } + if dscope == scopeof(tls, (bp+28 /* &sa6 */ +8 /* &.sin6_addr */)) { + key = key | (0x20000000) + } + if dlabel == labelof(tls, (bp+28 /* &sa6 */ +8 /* &.sin6_addr */)) { + key = key | (0x10000000) + } + prefixlen = prefixmatch(tls, (bp + 28 /* &sa6 */ + 8 /* &.sin6_addr */), + (bp /* &da6 */ + 8 /* &.sin6_addr */)) + } + } + Xclose(tls, fd) + } + key = key | (dprec << 20) + key = key | ((15 - dscope) << 16) + key = key | (prefixlen << 8) + key = key | ((48 - i) << 0) + (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key + } + Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { + f func(*TLS, uintptr, uintptr) int32 + }{addrcmp}))) + + //TODO pthread_setcancelstate(cs, 0); + + return cnt +} + +func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var line [128]int8 + _ = line + var cnt int32 = 0 + var p uintptr + _ = p + *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */ + var port uint64 = uint64(0) + + switch socktype { + case 1: + switch proto { + case 0: + proto = 6 + fallthrough + case 6: + break + default: + return -8 + } + break + case 2: + switch proto { + case 0: + proto = 17 + fallthrough + case 17: + break + default: + return -8 + } + fallthrough + case 0: + break + default: + if name != 0 { + return -8 + } + (*service)(unsafe.Pointer(buf)).port = uint16_t(0) + (*service)(unsafe.Pointer(buf)).proto = uint8(proto) + (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype) + return 1 + } + + if name != 0 { + if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) { + return -8 + } + port = Xstrtoul(tls, name, bp /* &z */, 10) + } + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* z */))))) != 0) { + if port > uint64(65535) { + return -8 + } + if proto != 17 { + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1) + (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6) + } + if proto != 6 { + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) + (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2) + (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17) + } + return cnt + } + + if (flags & 0x400) != 0 { + return -2 + } + + var l size_t = Xstrlen(tls, name) + _ = l + + Xabort(tls) //TODO- + // unsigned char _buf[1032]; + // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); + // if (!f) switch (errno) { + // case ENOENT: + // case ENOTDIR: + // case EACCES: + // return EAI_SERVICE; + // default: + // return EAI_SYSTEM; + // } + + Xabort(tls) //TODO- + // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { + // if ((p=strchr(line, '#'))) *p++='\n', *p=0; + + // /* Find service name */ + // for(p=line; (p=strstr(p, name)); p++) { + // if (p>line && !isspace(p[-1])) continue; + // if (p[l] && !isspace(p[l])) continue; + // break; + // } + // if (!p) continue; + + // /* Skip past canonical name at beginning of line */ + // for (p=line; *p && !isspace(*p); p++); + + // port = strtoul(p, &z, 10); + // if (port > 65535 || z==p) continue; + // if (!strncmp(z, "/udp", 4)) { + // if (proto == IPPROTO_TCP) continue; + // buf[cnt].port = port; + // buf[cnt].socktype = SOCK_DGRAM; + // buf[cnt++].proto = IPPROTO_UDP; + // } + // if (!strncmp(z, "/tcp", 4)) { + // if (proto == IPPROTO_UDP) continue; + // buf[cnt].port = port; + // buf[cnt].socktype = SOCK_STREAM; + // buf[cnt++].proto = IPPROTO_TCP; + // } + // } + // __fclose_ca(f); + // return cnt > 0 ? cnt : EAI_SERVICE; + Xabort(tls) + return int32(0) //TODO- +} + +func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ + *(*int32)(unsafe.Pointer(f + 136 /* &.mode */)) |= ((*FILE1)(unsafe.Pointer(f)).mode - 1) + if (*FILE1)(unsafe.Pointer(f)).wpos != (*FILE1)(unsafe.Pointer(f)).wbase { + (*(*func(*TLS, uintptr, uintptr, size_t) size_t)(unsafe.Pointer((f + 72 /* &.write */))))(tls, f, uintptr(0), uint64(0)) + } + (*FILE1)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56 /* &.wbase */, AssignPtrUintptr(f+32 /* &.wend */, uintptr(0))) + if ((*FILE1)(unsafe.Pointer(f)).flags & uint32(4)) != 0 { + *(*uint32)(unsafe.Pointer(f /* &.flags */)) |= (uint32(32)) + return -1 + } + (*FILE1)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16 /* &.rend */, ((*FILE1)(unsafe.Pointer(f)).buf + uintptr((*FILE1)(unsafe.Pointer(f)).buf_size))) + if ((*FILE1)(unsafe.Pointer(f)).flags & uint32(16)) != 0 { + return -1 + } + return 0 +} + +func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ + X__builtin_abort(tls) //TODO- + // __stdio_exit_needed(); +} + +// This function assumes it will never be called if there is already +// data buffered for reading. + +func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ + bp := tls.Alloc(1) + defer tls.Free(1) + + // var c uint8 at bp, 1 + + if !(X__toread(tls, f) != 0) && ((*(*func(*TLS, uintptr, uintptr, size_t) size_t)(unsafe.Pointer((f + 64 /* &.read */))))(tls, f, bp /* &c */, uint64(1)) == uint64(1)) { + return int32(*(*uint8)(unsafe.Pointer(bp /* c */))) + } + return -1 +} + +func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + // var f FILE1 at bp, 232 + + (*FILE1)(unsafe.Pointer(bp /* &f */)).buf = AssignPtrUintptr(bp /* &f */ +8 /* &.rpos */, s) + (*FILE1)(unsafe.Pointer(bp /* &f */)).rend = UintptrFromInt32(-1) + X__shlim(tls, bp /* &f */, int64(0)) + var y float64 = X__floatscan(tls, bp /* &f */, prec, 1) + var cnt off_t = ((*FILE1)(unsafe.Pointer((bp /* &f */))).shcnt + ((int64((*FILE1)(unsafe.Pointer((bp /* &f */))).rpos) - int64((*FILE1)(unsafe.Pointer((bp /* &f */))).buf)) / 1)) + if p != 0 { + *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { + if cnt != 0 { + return (s + uintptr(cnt)) + } + return s + }() + } + return y +} + +func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ + return float32(strtox(tls, s, p, 0)) +} + +func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ + return strtox(tls, s, p, 1) +} + +func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ + return strtox(tls, s, p, 2) +} + +func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + // var f FILE1 at bp, 232 + + (*FILE1)(unsafe.Pointer(bp /* &f */)).buf = AssignPtrUintptr(bp /* &f */ +8 /* &.rpos */, s) + (*FILE1)(unsafe.Pointer(bp /* &f */)).rend = UintptrFromInt32(-1) + X__shlim(tls, bp /* &f */, int64(0)) + var y uint64 = X__intscan(tls, bp /* &f */, uint32(base), 1, lim) + if p != 0 { + var cnt size_t = (size_t((*FILE1)(unsafe.Pointer((bp /* &f */))).shcnt + ((int64((*FILE1)(unsafe.Pointer((bp /* &f */))).rpos) - int64((*FILE1)(unsafe.Pointer((bp /* &f */))).buf)) / 1))) + *(*uintptr)(unsafe.Pointer(p)) = (s + uintptr(cnt)) + } + return y +} + +func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ + return strtox1(tls, s, p, base, ((2 * uint64(0x7fffffffffffffff)) + uint64(1))) +} + +func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ + return int64(strtox1(tls, s, p, base, (Uint64FromInt64(-0x7fffffffffffffff - int64(1))))) +} + +func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */ + return uint64(strtox1(tls, s, p, base, ((2 * uint64(0x7fffffffffffffff)) + uint64(1)))) +} + +func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */ + return int64(strtox1(tls, s, p, base, (0 + (Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff)) - Int64FromInt32(1)))))) +} + +func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ + return intmax_t(Xstrtoll(tls, s, p, base)) +} + +func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ + return uintmax_t(Xstrtoull(tls, s, p, base)) +} + +func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ + var l size_t = Xstrlen(tls, s) + var d uintptr = Xmalloc(tls, (l + uint64(1))) + if !(d != 0) { + return uintptr(0) + } + return Xmemcpy(tls, d, s, (l + uint64(1))) +} + +func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ + var p uintptr = Xmemchr(tls, s, 0, n) + if p != 0 { + return (uint64((int64(p) - int64(s)) / 1)) + } + return n +} + +func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var a uintptr = s + *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} + + if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { + return uint64(0) + } + if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { + for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { + } + return (size_t((int64(s) - int64(a)) / 1)) + } + + for ; (*(*int8)(unsafe.Pointer(c)) != 0) && (AssignOrPtrUint64(bp /* &byteset */ +uintptr(((size_t(*(*uint8)(unsafe.Pointer(c))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8, (size_t(uint64(1))<<((size_t(*(*uint8)(unsafe.Pointer(c))))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))) != 0); c++ { + } + for ; (*(*int8)(unsafe.Pointer(s)) != 0) && ((*(*size_t)(unsafe.Pointer(bp /* &byteset[0] */ + uintptr(((size_t(*(*uint8)(unsafe.Pointer(s))))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0))))))*8)) & (size_t(uint64(1)) << ((size_t(*(*uint8)(unsafe.Pointer(s)))) % (uint64(8) * uint64(unsafe.Sizeof(size_t(0))))))) != 0); s++ { + } + return (size_t((int64(s) - int64(a)) / 1)) +} + +func init() { + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_ctype_tab_)) + 0)) = (uintptr(unsafe.Pointer(&X_C_ctype_tab_))) // ctype_.cpp.c:2233:37: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_ctype_tab_)) + 0)) = (uintptr(unsafe.Pointer(&X_C_ctype_tab_))) // ctype_.cpp.c:2233:37: +} + +var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/musl_windows_386.go b/vendor/modernc.org/libc/musl_windows_386.go index 96e52e33..efb16535 100644 --- a/vendor/modernc.org/libc/musl_windows_386.go +++ b/vendor/modernc.org/libc/musl_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_windows_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/multibyte/wcrtomb.c src/multibyte/wcsrtombs.c src/multibyte/wcstombs.c src/string/strdup.c src/string/strchrnul.c', DO NOT EDIT. +// Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_windows_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/math/rint.c src/multibyte/wcrtomb.c src/multibyte/wcsrtombs.c src/multibyte/wcstombs.c src/string/strchrnul.c src/string/strdup.c', DO NOT EDIT. package libc @@ -491,30 +491,44 @@ func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */ return 0 } -type wint_t = uint32 /* alltypes.h:221:18 */ +// #define LDBL_TRUE_MIN 3.6451995318824746025e-4951L +// #define LDBL_MIN 3.3621031431120935063e-4932L +// #define LDBL_MAX 1.1897314953572317650e+4932L +// #define LDBL_EPSILON 1.0842021724855044340e-19L +// +// #define LDBL_MANT_DIG 64 +// #define LDBL_MIN_EXP (-16381) +// #define LDBL_MAX_EXP 16384 +// +// #define LDBL_DIG 18 +// #define LDBL_MIN_10_EXP (-4931) +// #define LDBL_MAX_10_EXP 4932 +// +// #define DECIMAL_DIG 21 -type wctype_t = uint32 /* alltypes.h:226:23 */ +type float_t = float64 /* alltypes.h:38:21 */ -type __mbstate_t = struct { - __opaque1 uint32 - __opaque2 uint32 -} /* alltypes.h:360:9 */ +type double_t = float64 /* alltypes.h:43:21 */ -type mbstate_t = __mbstate_t /* alltypes.h:360:63 */ +func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ + bp := tls.Alloc(4) + defer tls.Free(4) -type tm = struct { - tm_sec int32 - tm_min int32 - tm_hour int32 - tm_mday int32 - tm_mon int32 - tm_year int32 - tm_wday int32 - tm_yday int32 - tm_isdst int32 - tm_gmtoff int32 - tm_zone uintptr -} /* wchar.h:138:1 */ + // var __u struct {__f float32;} at bp, 4 + + *(*float32)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint32)(unsafe.Pointer(bp /* &__u */)) +} + +func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var __u struct {__f float64;} at bp, 8 + + *(*float64)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint64)(unsafe.Pointer(bp /* &__u */)) +} type uintptr_t = uint32 /* alltypes.h:78:24 */ @@ -559,6 +573,31 @@ type int_fast32_t = int32_t /* stdint.h:2:17 */ type uint_fast16_t = uint32_t /* stdint.h:3:18 */ type uint_fast32_t = uint32_t /* stdint.h:4:18 */ +type wint_t = uint32 /* alltypes.h:221:18 */ + +type wctype_t = uint32 /* alltypes.h:226:23 */ + +type __mbstate_t = struct { + __opaque1 uint32 + __opaque2 uint32 +} /* alltypes.h:360:9 */ + +type mbstate_t = __mbstate_t /* alltypes.h:360:63 */ + +type tm = struct { + tm_sec int32 + tm_min int32 + tm_hour int32 + tm_mday int32 + tm_mon int32 + tm_year int32 + tm_wday int32 + tm_yday int32 + tm_isdst int32 + tm_gmtoff int32 + tm_zone uintptr +} /* wchar.h:138:1 */ + // Upper 6 state bits are a negative integer offset to bound-check next byte // equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f @@ -1036,15 +1075,6 @@ func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c return Xwcsrtombs(tls, s, bp /* &ws */, n, uintptr(0)) } -func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ - var l size_t = Xstrlen(tls, s) - var d uintptr = Xmalloc(tls, (l + size_t(1))) - if !(d != 0) { - return uintptr(0) - } - return Xmemcpy(tls, d, s, (l + size_t(1))) -} - // Support signed or unsigned plain-char // Implementation choices... @@ -1073,3 +1103,12 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: * } return s } + +func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ + var l size_t = Xstrlen(tls, s) + var d uintptr = Xmalloc(tls, (l + size_t(1))) + if !(d != 0) { + return uintptr(0) + } + return Xmemcpy(tls, d, s, (l + size_t(1))) +} diff --git a/vendor/modernc.org/libc/musl_windows_amd64.go b/vendor/modernc.org/libc/musl_windows_amd64.go index f8da6219..59eb672d 100644 --- a/vendor/modernc.org/libc/musl_windows_amd64.go +++ b/vendor/modernc.org/libc/musl_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_windows_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/multibyte/wcrtomb.c src/multibyte/wcsrtombs.c src/multibyte/wcstombs.c src/string/strdup.c src/string/strchrnul.c', DO NOT EDIT. +// Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_windows_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/math/rint.c src/multibyte/wcrtomb.c src/multibyte/wcsrtombs.c src/multibyte/wcstombs.c src/string/strchrnul.c src/string/strdup.c', DO NOT EDIT. package libc @@ -491,30 +491,44 @@ func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */ return 0 } -type wint_t = uint32 /* alltypes.h:198:18 */ +// #define LDBL_TRUE_MIN 3.6451995318824746025e-4951L +// #define LDBL_MIN 3.3621031431120935063e-4932L +// #define LDBL_MAX 1.1897314953572317650e+4932L +// #define LDBL_EPSILON 1.0842021724855044340e-19L +// +// #define LDBL_MANT_DIG 64 +// #define LDBL_MIN_EXP (-16381) +// #define LDBL_MAX_EXP 16384 +// +// #define LDBL_DIG 18 +// #define LDBL_MIN_10_EXP (-4931) +// #define LDBL_MAX_10_EXP 4932 +// +// #define DECIMAL_DIG 21 -type wctype_t = uint32 /* alltypes.h:203:23 */ +type float_t = float32 /* alltypes.h:29:15 */ -type __mbstate_t = struct { - __opaque1 uint32 - __opaque2 uint32 -} /* alltypes.h:337:9 */ +type double_t = float64 /* alltypes.h:34:16 */ -type mbstate_t = __mbstate_t /* alltypes.h:337:63 */ +func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ + bp := tls.Alloc(4) + defer tls.Free(4) -type tm = struct { - tm_sec int32 - tm_min int32 - tm_hour int32 - tm_mday int32 - tm_mon int32 - tm_year int32 - tm_wday int32 - tm_yday int32 - tm_isdst int32 - tm_gmtoff int32 - tm_zone uintptr -} /* wchar.h:138:1 */ + // var __u struct {__f float32;} at bp, 4 + + *(*float32)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint32)(unsafe.Pointer(bp /* &__u */)) +} + +func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var __u struct {__f float64;} at bp, 8 + + *(*float64)(unsafe.Pointer(bp /* &__u */)) = __f + return *(*uint64)(unsafe.Pointer(bp /* &__u */)) +} type uintptr_t = uint32 /* alltypes.h:55:24 */ @@ -559,6 +573,31 @@ type int_fast32_t = int32_t /* stdint.h:2:17 */ type uint_fast16_t = uint32_t /* stdint.h:3:18 */ type uint_fast32_t = uint32_t /* stdint.h:4:18 */ +type wint_t = uint32 /* alltypes.h:198:18 */ + +type wctype_t = uint32 /* alltypes.h:203:23 */ + +type __mbstate_t = struct { + __opaque1 uint32 + __opaque2 uint32 +} /* alltypes.h:337:9 */ + +type mbstate_t = __mbstate_t /* alltypes.h:337:63 */ + +type tm = struct { + tm_sec int32 + tm_min int32 + tm_hour int32 + tm_mday int32 + tm_mon int32 + tm_year int32 + tm_wday int32 + tm_yday int32 + tm_isdst int32 + tm_gmtoff int32 + tm_zone uintptr +} /* wchar.h:138:1 */ + // Upper 6 state bits are a negative integer offset to bound-check next byte // equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f @@ -1062,15 +1101,6 @@ func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c return Xwcsrtombs(tls, s, bp /* &ws */, n, uintptr(0)) } -func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ - var l size_t = Xstrlen(tls, s) - var d uintptr = Xmalloc(tls, (l + uint64(1))) - if !(d != 0) { - return uintptr(0) - } - return Xmemcpy(tls, d, s, (l + uint64(1))) -} - // Support signed or unsigned plain-char // Implementation choices... @@ -1099,3 +1129,12 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: * } return s } + +func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ + var l size_t = Xstrlen(tls, s) + var d uintptr = Xmalloc(tls, (l + uint64(1))) + if !(d != 0) { + return uintptr(0) + } + return Xmemcpy(tls, d, s, (l + uint64(1))) +} diff --git a/vendor/modernc.org/libc/netdb/capi_darwin_amd64.go b/vendor/modernc.org/libc/netdb/capi_darwin_amd64.go index 204a4288..a750f528 100644 --- a/vendor/modernc.org/libc/netdb/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/netdb/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_darwin_amd64.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_darwin_amd64.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/capi_freebsd_amd64.go b/vendor/modernc.org/libc/netdb/capi_freebsd_amd64.go new file mode 100644 index 00000000..842c76a4 --- /dev/null +++ b/vendor/modernc.org/libc/netdb/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_freebsd_amd64.go -pkgname netdb', DO NOT EDIT. + +package netdb + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/netdb/capi_linux_386.go b/vendor/modernc.org/libc/netdb/capi_linux_386.go index ae6eedb4..a3443a06 100644 --- a/vendor/modernc.org/libc/netdb/capi_linux_386.go +++ b/vendor/modernc.org/libc/netdb/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_386.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_386.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/capi_linux_amd64.go b/vendor/modernc.org/libc/netdb/capi_linux_amd64.go index 320af21d..f8e1b5e3 100644 --- a/vendor/modernc.org/libc/netdb/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/netdb/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_amd64.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_amd64.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/capi_linux_arm.go b/vendor/modernc.org/libc/netdb/capi_linux_arm.go index 067de566..c58589a4 100644 --- a/vendor/modernc.org/libc/netdb/capi_linux_arm.go +++ b/vendor/modernc.org/libc/netdb/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/capi_linux_arm64.go b/vendor/modernc.org/libc/netdb/capi_linux_arm64.go index 270f34d6..aad6e361 100644 --- a/vendor/modernc.org/libc/netdb/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/netdb/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm64.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm64.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/capi_linux_s390x.go b/vendor/modernc.org/libc/netdb/capi_linux_s390x.go index 19c51eb4..872e8f82 100644 --- a/vendor/modernc.org/libc/netdb/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/netdb/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_s390x.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_s390x.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/capi_netbsd_amd64.go b/vendor/modernc.org/libc/netdb/capi_netbsd_amd64.go new file mode 100644 index 00000000..4aea73b1 --- /dev/null +++ b/vendor/modernc.org/libc/netdb/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo netdb/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_netbsd_amd64.go -pkgname netdb', DO NOT EDIT. + +package netdb + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/netdb/netdb_darwin_amd64.go b/vendor/modernc.org/libc/netdb/netdb_darwin_amd64.go index 52d5f846..b130f7cc 100644 --- a/vendor/modernc.org/libc/netdb/netdb_darwin_amd64.go +++ b/vendor/modernc.org/libc/netdb/netdb_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_darwin_amd64.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_darwin_amd64.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/netdb_freebsd_amd64.go b/vendor/modernc.org/libc/netdb/netdb_freebsd_amd64.go new file mode 100644 index 00000000..ce87b686 --- /dev/null +++ b/vendor/modernc.org/libc/netdb/netdb_freebsd_amd64.go @@ -0,0 +1,721 @@ +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_freebsd_amd64.go -pkgname netdb', DO NOT EDIT. + +package netdb + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AI_ADDRCONFIG = 0x00000400 + AI_ALL = 0x00000100 + AI_CANONNAME = 0x00000002 + AI_DEFAULT = 1536 + AI_MASK = 3343 + AI_NUMERICHOST = 0x00000004 + AI_NUMERICSERV = 0x00000008 + AI_PASSIVE = 0x00000001 + AI_V4MAPPED = 0x00000800 + AI_V4MAPPED_CFG = 0x00000200 + EAI_AGAIN = 2 + EAI_BADFLAGS = 3 + EAI_BADHINTS = 12 + EAI_FAIL = 4 + EAI_FAMILY = 5 + EAI_MAX = 15 + EAI_MEMORY = 6 + EAI_NONAME = 8 + EAI_OVERFLOW = 14 + EAI_PROTOCOL = 13 + EAI_SERVICE = 9 + EAI_SOCKTYPE = 10 + EAI_SYSTEM = 11 + HOST_NOT_FOUND = 1 + IPPORT_RESERVED = 1024 + NETDB_INTERNAL = -1 + NETDB_SUCCESS = 0 + NI_DGRAM = 0x00000010 + NI_MAXHOST = 1025 + NI_MAXSERV = 32 + NI_NAMEREQD = 0x00000004 + NI_NOFQDN = 0x00000001 + NI_NUMERICHOST = 0x00000002 + NI_NUMERICSCOPE = 0x00000020 + NI_NUMERICSERV = 0x00000008 + NO_ADDRESS = 4 + NO_DATA = 4 + NO_RECOVERY = 3 + SCOPE_DELIMITER = 37 + TRY_AGAIN = 2 + X_FILE_OFFSET_BITS = 64 + X_IN_ADDR_T_DECLARED = 0 + X_IN_PORT_T_DECLARED = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_NETDB_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PATH_HEQUIV = "/etc/hosts.equiv" + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" + X_PATH_SERVICES_DB = "/var/db/services.db" + X_SIZE_T_DECLARED = 0 + X_SOCKLEN_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_UINT32_T_DECLARED = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: (BSD-3-Clause AND ISC) +// +// Copyright (c) 1980, 1983, 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// - +// Portions Copyright (c) 1993 by Digital Equipment Corporation. +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies, and that +// the name of Digital Equipment Corporation not be used in advertising or +// publicity pertaining to distribution of the document or software without +// specific, written prior permission. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT +// CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +// SOFTWARE. +// - +// --Copyright-- + +// @(#)netdb.h 8.1 (Berkeley) 6/2/93 +// From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type In_addr_t = X__uint32_t /* netdb.h:66:20 */ + +type In_port_t = X__uint16_t /* netdb.h:71:20 */ + +type Socklen_t = X__socklen_t /* netdb.h:81:21 */ + +type Uint32_t = X__uint32_t /* netdb.h:86:20 */ + +// Structures returned by network data base library. All addresses are +// supplied in host order, and returned in network order (suitable for +// use in system calls). +type Hostent = struct { + Fh_name uintptr + Fh_aliases uintptr + Fh_addrtype int32 + Fh_length int32 + Fh_addr_list uintptr +} /* netdb.h:106:1 */ + +type Netent = struct { + Fn_name uintptr + Fn_aliases uintptr + Fn_addrtype int32 + Fn_net Uint32_t +} /* netdb.h:115:1 */ + +type Servent = struct { + Fs_name uintptr + Fs_aliases uintptr + Fs_port int32 + _ [4]byte + Fs_proto uintptr +} /* netdb.h:122:1 */ + +type Protoent = struct { + Fp_name uintptr + Fp_aliases uintptr + Fp_proto int32 + _ [4]byte +} /* netdb.h:129:1 */ + +type Addrinfo = struct { + Fai_flags int32 + Fai_family int32 + Fai_socktype int32 + Fai_protocol int32 + Fai_addrlen Socklen_t + _ [4]byte + Fai_canonname uintptr + Fai_addr uintptr + Fai_next uintptr +} /* netdb.h:135:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/netdb/netdb_linux_386.go b/vendor/modernc.org/libc/netdb/netdb_linux_386.go index 29fee270..df2fffec 100644 --- a/vendor/modernc.org/libc/netdb/netdb_linux_386.go +++ b/vendor/modernc.org/libc/netdb/netdb_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_386.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_386.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/netdb_linux_amd64.go b/vendor/modernc.org/libc/netdb/netdb_linux_amd64.go index 68bc56de..0dcb9391 100644 --- a/vendor/modernc.org/libc/netdb/netdb_linux_amd64.go +++ b/vendor/modernc.org/libc/netdb/netdb_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_amd64.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_amd64.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/netdb_linux_arm.go b/vendor/modernc.org/libc/netdb/netdb_linux_arm.go index 651a08d0..b2b3c8df 100644 --- a/vendor/modernc.org/libc/netdb/netdb_linux_arm.go +++ b/vendor/modernc.org/libc/netdb/netdb_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/netdb_linux_arm64.go b/vendor/modernc.org/libc/netdb/netdb_linux_arm64.go index 1171209e..47931dc0 100644 --- a/vendor/modernc.org/libc/netdb/netdb_linux_arm64.go +++ b/vendor/modernc.org/libc/netdb/netdb_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm64.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_arm64.go -pkgname netdb', DO NOT EDIT. package netdb diff --git a/vendor/modernc.org/libc/netdb/netdb_linux_s390x.go b/vendor/modernc.org/libc/netdb/netdb_linux_s390x.go index 073d5a60..4390dc4a 100644 --- a/vendor/modernc.org/libc/netdb/netdb_linux_s390x.go +++ b/vendor/modernc.org/libc/netdb/netdb_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_s390x.go -pkgname netdb', DO NOT EDIT. +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_linux_s390x.go -pkgname netdb', DO NOT EDIT. package netdb @@ -40,7 +40,7 @@ const ( AF_KEY = 15 AF_LLC = 26 AF_LOCAL = 1 - AF_MAX = 44 + AF_MAX = 45 AF_MPLS = 28 AF_NETBEUI = 13 AF_NETLINK = 16 @@ -63,6 +63,7 @@ const ( AF_VSOCK = 40 AF_WANPIPE = 25 AF_X25 = 9 + AF_XDP = 44 AI_ADDRCONFIG = 0x0020 AI_ALL = 0x0010 AI_CANONNAME = 0x0002 @@ -128,6 +129,7 @@ const ( IPV6_MINHOPCOUNT = 73 IPV6_MTU = 24 IPV6_MTU_DISCOVER = 23 + IPV6_MULTICAST_ALL = 29 IPV6_MULTICAST_HOPS = 18 IPV6_MULTICAST_IF = 17 IPV6_MULTICAST_LOOP = 19 @@ -152,6 +154,7 @@ const ( IPV6_RECVRTHDR = 56 IPV6_RECVTCLASS = 66 IPV6_ROUTER_ALERT = 22 + IPV6_ROUTER_ALERT_ISOLATE = 30 IPV6_RTHDR = 57 IPV6_RTHDRDSTOPTS = 55 IPV6_RTHDR_LOOSE = 0 @@ -262,7 +265,7 @@ const ( PF_KEY = 15 PF_LLC = 26 PF_LOCAL = 1 - PF_MAX = 44 + PF_MAX = 45 PF_MPLS = 28 PF_NETBEUI = 13 PF_NETLINK = 16 @@ -285,6 +288,7 @@ const ( PF_VSOCK = 40 PF_WANPIPE = 25 PF_X25 = 9 + PF_XDP = 44 SCM_TIMESTAMP = 29 SCM_TIMESTAMPING = 37 SCM_TIMESTAMPING_OPT_STATS = 54 @@ -294,8 +298,8 @@ const ( SCM_WIFI_STATUS = 41 SIOCATMARK = 0x8905 SIOCGPGRP = 0x8904 - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_OLD = 0x8906 SIOCSPGRP = 0x8902 SOL_AAL = 265 SOL_ALG = 279 @@ -324,13 +328,15 @@ const ( SOL_TIPC = 271 SOL_TLS = 282 SOL_X25 = 262 - SOMAXCONN = 128 + SOL_XDP = 283 + SOMAXCONN = 4096 SO_ACCEPTCONN = 30 SO_ATTACH_BPF = 50 SO_ATTACH_FILTER = 26 SO_ATTACH_REUSEPORT_CBPF = 51 SO_ATTACH_REUSEPORT_EBPF = 52 SO_BINDTODEVICE = 25 + SO_BINDTOIFINDEX = 62 SO_BPF_EXTENSIONS = 48 SO_BROADCAST = 6 SO_BSDCOMPAT = 14 @@ -340,6 +346,7 @@ const ( SO_DEBUG = 1 SO_DETACH_BPF = 27 SO_DETACH_FILTER = 27 + SO_DETACH_REUSEPORT_BPF = 68 SO_DOMAIN = 39 SO_DONTROUTE = 5 SO_ERROR = 4 @@ -368,6 +375,8 @@ const ( SO_RCVBUFFORCE = 33 SO_RCVLOWAT = 18 SO_RCVTIMEO = 20 + SO_RCVTIMEO_NEW = 66 + SO_RCVTIMEO_OLD = 20 SO_REUSEADDR = 2 SO_REUSEPORT = 15 SO_RXQ_OVFL = 40 @@ -379,22 +388,32 @@ const ( SO_SNDBUFFORCE = 32 SO_SNDLOWAT = 19 SO_SNDTIMEO = 21 + SO_SNDTIMEO_NEW = 67 + SO_SNDTIMEO_OLD = 21 SO_TIMESTAMP = 29 SO_TIMESTAMPING = 37 + SO_TIMESTAMPING_NEW = 65 + SO_TIMESTAMPING_OLD = 37 SO_TIMESTAMPNS = 35 + SO_TIMESTAMPNS_NEW = 64 + SO_TIMESTAMPNS_OLD = 35 + SO_TIMESTAMP_NEW = 63 + SO_TIMESTAMP_OLD = 29 SO_TXTIME = 61 SO_TYPE = 3 SO_WIFI_STATUS = 41 SO_ZEROCOPY = 60 TRY_AGAIN = 2 - X_ASM_SOCKET_H = 0 X_ATFILE_SOURCE = 1 X_BITS_BYTESWAP_H = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 X_BITS_SOCKADDR_H = 1 X_BITS_STDINT_INTN_H = 1 X_BITS_STDINT_UINTN_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BITS_UINTN_IDENTITY_H = 1 @@ -405,6 +424,7 @@ const ( X_FEATURES_H = 1 X_FILE_OFFSET_BITS = 64 X_GCC_SIZE_T = 0 + X_LINUX_POSIX_TYPES_H = 0 X_LP64 = 1 X_NETDB_H = 1 X_NETINET_IN_H = 1 @@ -417,6 +437,7 @@ const ( X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 X_RPC_NETDB_H = 1 + X_RWLOCK_INTERNAL_H = 0 X_SIZET_ = 0 X_SIZE_T = 0 X_SIZE_T_ = 0 @@ -431,6 +452,7 @@ const ( X_SYS_SIZE_T_H = 0 X_SYS_SOCKET_H = 1 X_SYS_TYPES_H = 1 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 X_T_SIZE_ = 0 @@ -439,7 +461,7 @@ const ( ) // Bits in the FLAGS argument to `send', `recv', et al. -const ( /* socket.h:197:1: */ +const ( /* socket.h:200:1: */ MSG_OOB = 1 // Process out-of-band data. MSG_PEEK = 2 // Peek at incoming messages. MSG_DONTROUTE = 4 // Don't use local routing. @@ -466,13 +488,13 @@ const ( /* socket.h:197:1: */ // Socket level message types. This must match the definitions in // . -const ( /* socket.h:329:1: */ +const ( /* socket.h:332:1: */ SCM_RIGHTS = 1 ) // Get the architecture-dependent definition of enum __socket_type. // Define enum __socket_type for generic Linux. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -487,7 +509,7 @@ const ( /* socket.h:329:1: */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Types of sockets. const ( /* socket_type.h:24:1: */ @@ -639,7 +661,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -654,13 +676,13 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // All data returned by the network data base library are supplied in // host order and returned in network order (suitable for use in // system calls). -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -675,7 +697,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -683,6 +705,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -803,6 +826,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -825,9 +850,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -842,7 +880,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -855,7 +893,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -870,7 +908,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -985,7 +1023,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -1002,14 +1040,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1024,7 +1060,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -1060,7 +1096,7 @@ type X__float128 = float64 /* :47:21 */ // in the C library which is a stub, meaning it will fail // every time called, usually setting errno to ENOSYS. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1075,9 +1111,9 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1092,10 +1128,10 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Define uintN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1110,10 +1146,10 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1128,11 +1164,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1147,43 +1183,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -1195,7 +1253,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -1216,7 +1274,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1231,7 +1289,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -1246,78 +1304,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. type Uint8_t = X__uint8_t /* stdint-uintn.h:24:19 */ type Uint16_t = X__uint16_t /* stdint-uintn.h:25:20 */ @@ -1345,7 +1431,7 @@ type Iovec = struct { Fiov_len Size_t } /* struct_iovec.h:26:1 */ -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1431,7 +1517,7 @@ type Iovec = struct { // AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', // `struct msghdr', and `struct linger' types. // System-specific socket constants and types. Linux version. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1446,9 +1532,9 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1530,7 +1616,7 @@ type Iovec = struct { // A null pointer constant. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1545,11 +1631,11 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 2.6 Primitive System Data Types -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1564,10 +1650,10 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1582,7 +1668,7 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1621,7 +1707,7 @@ type Caddr_t = X__caddr_t /* types.h:115:19 */ type Key_t = X__key_t /* types.h:121:17 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1636,7 +1722,7 @@ type Key_t = X__key_t /* types.h:121:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1644,7 +1730,7 @@ type Key_t = X__key_t /* types.h:121:17 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1659,7 +1745,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1667,7 +1753,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1682,7 +1768,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1690,7 +1776,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Time_t = X__time_t /* time_t.h:7:18 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1705,14 +1791,14 @@ type Time_t = X__time_t /* time_t.h:7:18 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Timer ID returned by `timer_create'. type Timer_t = X__timer_t /* timer_t.h:7:19 */ -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1802,7 +1888,7 @@ type Uint = uint32 /* types.h:150:22 */ // These size-specific names are used by some of the inet code. // Define intN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1817,10 +1903,10 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1835,7 +1921,7 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1844,18 +1930,17 @@ type Int16_t = X__int16_t /* stdint-intn.h:25:19 */ type Int32_t = X__int32_t /* stdint-intn.h:26:19 */ type Int64_t = X__int64_t /* stdint-intn.h:27:19 */ -// For GCC 2.7 and later, we can use specific type-size attributes. +// These were defined by ISO C without the first `_'. +type U_int8_t = X__uint8_t /* types.h:158:19 */ +type U_int16_t = X__uint16_t /* types.h:159:20 */ +type U_int32_t = X__uint32_t /* types.h:160:20 */ +type U_int64_t = X__uint64_t /* types.h:161:20 */ -type U_int8_t = uint32 /* types.h:177:1 */ -type U_int16_t = uint32 /* types.h:178:1 */ -type U_int32_t = uint32 /* types.h:179:1 */ -type U_int64_t = uint32 /* types.h:180:1 */ - -type Register_t = int32 /* types.h:182:13 */ +type Register_t = int32 /* types.h:164:13 */ // It also defines `fd_set' and the FD_* macros for `select'. // `fd_set' type and related macros, and `select'/`pselect' declarations. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1870,11 +1955,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX 1003.1g: 6.2 Select from File Descriptor Sets -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1889,11 +1974,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Get definition of needed basic types. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1908,12 +1993,12 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Get __FD_* definitions. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1928,7 +2013,7 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We don't use `memset' because this would require a prototype and // the array isn't too big. @@ -1943,7 +2028,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // Get definition of timer specification structures. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1958,7 +2043,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1972,7 +2057,27 @@ type Timeval = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1989,14 +2094,12 @@ type Timeval = struct { // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. - // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ type Suseconds_t = X__suseconds_t /* select.h:43:23 */ @@ -2016,16 +2119,16 @@ type Fd_mask = X__fd_mask /* select.h:77:19 */ // Define some inlines helping to catch common problems. -type Blksize_t = X__blksize_t /* types.h:202:21 */ +type Blksize_t = X__blksize_t /* types.h:185:21 */ // Types from the Large File Support interface. -type Blkcnt_t = X__blkcnt64_t /* types.h:222:22 */ // Type to count number of disk blocks. -type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:226:24 */ // Type to count file system blocks. -type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file system inodes. +type Blkcnt_t = X__blkcnt64_t /* types.h:205:22 */ // Type to count number of disk blocks. +type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:209:24 */ // Type to count file system blocks. +type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:213:24 */ // Type to count file system inodes. // Now add the thread types. // Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2040,11 +2143,11 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // For internal mutex and condition variable definitions. // Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2059,7 +2162,7 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -2074,36 +2177,6 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -2112,11 +2185,10 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2135,7 +2207,176 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Type to count file system inodes. + +// Now add the thread types. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -2150,31 +2391,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -2186,7 +2403,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -2196,14 +2413,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -2214,7 +2431,7 @@ type Pthread_once_t = int32 /* pthreadtypes.h:53:30 */ type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* pthreadtypes.h:56:1 */ type Pthread_attr_t = Pthread_attr_t1 /* pthreadtypes.h:62:30 */ @@ -2229,7 +2446,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -2239,12 +2456,12 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ // Type for length arguments in socket calls. @@ -2263,7 +2480,7 @@ type Socklen_t = X__socklen_t /* socket.h:33:21 */ // Get the definition of the macro to define the common sockaddr members. // Definition of struct sockaddr_* common members and sizes, generic version. -// Copyright (C) 1995-2018 Free Software Foundation, Inc. +// Copyright (C) 1995-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2278,7 +2495,7 @@ type Socklen_t = X__socklen_t /* socket.h:33:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -2294,17 +2511,17 @@ type Sa_family_t = uint16 /* sockaddr.h:28:28 */ // Structure describing a generic socket address. type Sockaddr = struct { Fsa_family Sa_family_t - Fsa_data [14]int8 -} /* socket.h:175:1 */ + Fsa_data [14]uint8 +} /* socket.h:178:1 */ // Structure large enough to hold any socket address (with the historical // exception of AF_UNIX). type Sockaddr_storage = struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 -} /* socket.h:188:1 */ +} /* socket.h:191:1 */ // Structure describing messages sent by // `sendmsg' and received by `recvmsg'. @@ -2318,7 +2535,7 @@ type Msghdr = struct { Fmsg_controllen Size_t Fmsg_flags int32 _ [4]byte -} /* socket.h:254:1 */ +} /* socket.h:257:1 */ // Structure used for storage of ancillary data object information. type Cmsghdr = struct { @@ -2326,15 +2543,105 @@ type Cmsghdr = struct { Fcmsg_len Size_t Fcmsg_level int32 Fcmsg_type int32 -} /* socket.h:272:1 */ +} /* socket.h:275:1 */ -// Ugly workaround for unclean kernel headers. +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// This allows for 1024 file descriptors: if NR_OPEN is ever grown +// beyond that you'll have to change this too. But 1024 fd's seem to be +// enough even for such "real" unices like OSF/1, so hopefully this is +// one limit that doesn't have to be changed [again]. +// +// Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in +// (and thus ) - but this is a more logical +// place for them. Solved by having dummy defines in . + +// This macro may have been defined in . But we always +// use the one here. + +type X__kernel_fd_set = struct{ Ffds_bits [16]uint64 } /* posix_types.h:27:3 */ + +// Type of a signal handler. +type X__kernel_sighandler_t = uintptr /* posix_types.h:30:14 */ + +// Type of a SYSV IPC key. +type X__kernel_key_t = int32 /* posix_types.h:33:13 */ +type X__kernel_mqd_t = int32 /* posix_types.h:34:13 */ -// Get socket manipulation related informations from kernel headers. // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note // S390 version // -// Derived from "include/asm-i386/socket.h" + +// This file is generally used by user-level software, so you need to +// be a little careful about namespace pollution etc. Also, we cannot +// assume GCC is being used. + +type X__kernel_size_t = uint64 /* posix_types.h:16:25 */ +type X__kernel_ssize_t = int64 /* posix_types.h:17:25 */ + +type X__kernel_old_dev_t = uint16 /* posix_types.h:20:24 */ + +type X__kernel_ino_t = uint32 /* posix_types.h:35:25 */ +type X__kernel_mode_t = uint32 /* posix_types.h:36:25 */ +type X__kernel_ipc_pid_t = int32 /* posix_types.h:37:25 */ +type X__kernel_uid_t = uint32 /* posix_types.h:38:25 */ +type X__kernel_gid_t = uint32 /* posix_types.h:39:25 */ +type X__kernel_ptrdiff_t = int64 /* posix_types.h:40:25 */ +type X__kernel_sigset_t = uint64 /* posix_types.h:41:25 */ // at least 32 bits + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// There seems to be no way of detecting this automatically from user +// space, so 64 bit architectures should override this in their +// bitsperlong.h. In particular, an architecture that supports +// both 32 and 64 bit user space must not rely on CONFIG_64BIT +// to decide it, but rather check a compiler provided macro. + +// This file is generally used by user-level software, so you need to +// be a little careful about namespace pollution etc. +// +// First the types that are often defined in different ways across +// architectures, so that you can override them. + +type X__kernel_long_t = int64 /* posix_types.h:15:15 */ +type X__kernel_ulong_t = uint64 /* posix_types.h:16:23 */ + +type X__kernel_pid_t = int32 /* posix_types.h:28:14 */ + +type X__kernel_suseconds_t = X__kernel_long_t /* posix_types.h:41:26 */ + +type X__kernel_daddr_t = int32 /* posix_types.h:45:14 */ + +type X__kernel_uid32_t = uint32 /* posix_types.h:49:22 */ +type X__kernel_gid32_t = uint32 /* posix_types.h:50:22 */ + +type X__kernel_old_uid_t = X__kernel_uid_t /* posix_types.h:54:24 */ +type X__kernel_old_gid_t = X__kernel_gid_t /* posix_types.h:55:24 */ + +// Most 32 bit architectures use "unsigned int" size_t, +// and all 64 bit architectures use "unsigned long" size_t. + +type X__kernel_fsid_t = struct{ Fval [2]int32 } /* posix_types.h:81:3 */ + +// anything below here should be completely generic +type X__kernel_off_t = X__kernel_long_t /* posix_types.h:87:25 */ +type X__kernel_loff_t = int64 /* posix_types.h:88:19 */ +type X__kernel_time_t = X__kernel_long_t /* posix_types.h:89:25 */ +type X__kernel_time64_t = int64 /* posix_types.h:90:19 */ +type X__kernel_clock_t = X__kernel_long_t /* posix_types.h:91:25 */ +type X__kernel_timer_t = int32 /* posix_types.h:92:14 */ +type X__kernel_clockid_t = int32 /* posix_types.h:93:14 */ +type X__kernel_caddr_t = uintptr /* posix_types.h:94:14 */ +type X__kernel_uid16_t = uint16 /* posix_types.h:95:24 */ +type X__kernel_gid16_t = uint16 /* posix_types.h:96:24 */ // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note @@ -2348,11 +2655,13 @@ type Cmsghdr = struct { // Instruct lower device to use last 4-bytes of skb data as FCS +// on 64-bit and x32, avoid the ?: operator + // Structure used to manipulate the SO_LINGER option. type Linger = struct { Fl_onoff int32 Fl_linger int32 -} /* socket.h:444:1 */ +} /* socket.h:361:1 */ // This is the 4.3 BSD `struct sockaddr' format, which is used as wire // format in the grotty old 4.3 `talk' protocol. @@ -2364,7 +2673,7 @@ type Osockaddr = struct { // Define some macros helping to catch buffer overflows. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2379,7 +2688,7 @@ type Osockaddr = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -2388,7 +2697,7 @@ type In_addr_t = Uint32_t /* in.h:30:18 */ type In_addr = struct{ Fs_addr In_addr_t } /* in.h:31:1 */ // Get system-specific definitions. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2403,7 +2712,7 @@ type In_addr = struct{ Fs_addr In_addr_t } /* in.h:31:1 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Linux version. @@ -2436,7 +2745,7 @@ type In_addr = struct{ Fs_addr In_addr_t } /* in.h:31:1 */ // source route (this gets put into the header proper). type Ip_opts = struct { Fip_dst struct{ Fs_addr In_addr_t } - Fip_opts [40]int8 + Fip_opts [40]uint8 } /* in.h:142:1 */ // Like `struct ip_mreq' but including interface specification by index. @@ -2476,7 +2785,7 @@ type In6_addr = struct { _ [0]uint32 F__u6_addr8 [16]Uint8_t } -} /* in.h:211:1 */ +} /* in.h:212:1 */ // ::1 @@ -2486,7 +2795,7 @@ type Sockaddr_in = struct { Fsin_port In_port_t Fsin_addr struct{ Fs_addr In_addr_t } Fsin_zero [8]uint8 -} /* in.h:237:1 */ +} /* in.h:238:1 */ // Ditto, for IPv6. type Sockaddr_in6 = struct { @@ -2500,19 +2809,19 @@ type Sockaddr_in6 = struct { } } Fsin6_scope_id Uint32_t -} /* in.h:252:1 */ +} /* in.h:253:1 */ // IPv4 multicast request. type Ip_mreq = struct { Fimr_multiaddr struct{ Fs_addr In_addr_t } Fimr_interface struct{ Fs_addr In_addr_t } -} /* in.h:264:1 */ +} /* in.h:265:1 */ type Ip_mreq_source = struct { Fimr_multiaddr struct{ Fs_addr In_addr_t } Fimr_interface struct{ Fs_addr In_addr_t } Fimr_sourceaddr struct{ Fs_addr In_addr_t } -} /* in.h:273:1 */ +} /* in.h:274:1 */ // Likewise, for IPv6. type Ipv6_mreq = struct { @@ -2523,7 +2832,7 @@ type Ipv6_mreq = struct { } } Fipv6mr_interface uint32 -} /* in.h:288:1 */ +} /* in.h:289:1 */ // Multicast group request. type Group_req = struct { @@ -2531,25 +2840,25 @@ type Group_req = struct { _ [4]byte Fgr_group struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } -} /* in.h:300:1 */ +} /* in.h:301:1 */ type Group_source_req = struct { Fgsr_interface Uint32_t _ [4]byte Fgsr_group struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } Fgsr_source struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } -} /* in.h:309:1 */ +} /* in.h:310:1 */ // Full-state filter operations. type Ip_msfilter = struct { @@ -2558,27 +2867,27 @@ type Ip_msfilter = struct { Fimsf_fmode Uint32_t Fimsf_numsrc Uint32_t Fimsf_slist [1]struct{ Fs_addr In_addr_t } -} /* in.h:323:1 */ +} /* in.h:324:1 */ type Group_filter = struct { Fgf_interface Uint32_t _ [4]byte Fgf_group struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } Fgf_fmode Uint32_t Fgf_numsrc Uint32_t Fgf_slist [1]struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } -} /* in.h:344:1 */ +} /* in.h:345:1 */ // Define uintN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2593,7 +2902,7 @@ type Group_filter = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This is necessary to make this include file properly replace the // Sun version. @@ -2630,7 +2939,7 @@ type Group_filter = struct { // added multiple inclusion protection and use of . // In GNU this file is #include'd by . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2645,9 +2954,9 @@ type Group_filter = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -2736,7 +3045,7 @@ type Rpcent = struct { _ [4]byte } /* netdb.h:46:1 */ -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2751,7 +3060,7 @@ type Rpcent = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Description of data base entry for a single network. NOTE: here a // poor assumption is made. The network number is expected to fit @@ -2803,4 +3112,4 @@ type Addrinfo = struct { Fai_next uintptr } /* netdb.h:565:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/netdb/netdb_netbsd_amd64.go b/vendor/modernc.org/libc/netdb/netdb_netbsd_amd64.go new file mode 100644 index 00000000..0aaaa65f --- /dev/null +++ b/vendor/modernc.org/libc/netdb/netdb_netbsd_amd64.go @@ -0,0 +1,1018 @@ +// Code generated by 'ccgo netdb/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netdb/netdb_netbsd_amd64.go -pkgname netdb', DO NOT EDIT. + +package netdb + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AI_ADDRCONFIG = 0x00000400 + AI_CANONNAME = 0x00000002 + AI_MASK = 3087 + AI_NUMERICHOST = 0x00000004 + AI_NUMERICSERV = 0x00000008 + AI_PASSIVE = 0x00000001 + AI_SRV = 0x00000800 + EAI_ADDRFAMILY = 1 + EAI_AGAIN = 2 + EAI_BADFLAGS = 3 + EAI_BADHINTS = 12 + EAI_FAIL = 4 + EAI_FAMILY = 5 + EAI_MAX = 15 + EAI_MEMORY = 6 + EAI_NODATA = 7 + EAI_NONAME = 8 + EAI_OVERFLOW = 14 + EAI_PROTOCOL = 13 + EAI_SERVICE = 9 + EAI_SOCKTYPE = 10 + EAI_SYSTEM = 11 + HOST_NOT_FOUND = 1 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + NETDB_INTERNAL = -1 + NETDB_SUCCESS = 0 + NI_DGRAM = 0x00000010 + NI_MAXHOST = 1025 + NI_MAXSERV = 32 + NI_NAMEREQD = 0x00000004 + NI_NOFQDN = 0x00000001 + NI_NUMERICHOST = 0x00000002 + NI_NUMERICSCOPE = 0x00000040 + NI_NUMERICSERV = 0x00000008 + NI_WITHSCOPEID = 0x00000020 + NO_ADDRESS = 4 + NO_DATA = 4 + NO_RECOVERY = 3 + PRIX16 = "X" + PRIX32 = "X" + PRIX64 = "lX" + PRIX8 = "X" + PRIXFAST16 = "X" + PRIXFAST32 = "X" + PRIXFAST64 = "lX" + PRIXFAST8 = "X" + PRIXLEAST16 = "X" + PRIXLEAST32 = "X" + PRIXLEAST64 = "lX" + PRIXLEAST8 = "X" + PRIXMAX = "lX" + PRIXPTR = "lX" + PRId16 = "d" + PRId32 = "d" + PRId64 = "ld" + PRId8 = "d" + PRIdFAST16 = "d" + PRIdFAST32 = "d" + PRIdFAST64 = "ld" + PRIdFAST8 = "d" + PRIdLEAST16 = "d" + PRIdLEAST32 = "d" + PRIdLEAST64 = "ld" + PRIdLEAST8 = "d" + PRIdMAX = "ld" + PRIdPTR = "ld" + PRIi16 = "i" + PRIi32 = "i" + PRIi64 = "li" + PRIi8 = "i" + PRIiFAST16 = "i" + PRIiFAST32 = "i" + PRIiFAST64 = "li" + PRIiFAST8 = "i" + PRIiLEAST16 = "i" + PRIiLEAST32 = "i" + PRIiLEAST64 = "li" + PRIiLEAST8 = "i" + PRIiMAX = "li" + PRIiPTR = "li" + PRIo16 = "o" + PRIo32 = "o" + PRIo64 = "lo" + PRIo8 = "o" + PRIoFAST16 = "o" + PRIoFAST32 = "o" + PRIoFAST64 = "lo" + PRIoFAST8 = "o" + PRIoLEAST16 = "o" + PRIoLEAST32 = "o" + PRIoLEAST64 = "lo" + PRIoLEAST8 = "o" + PRIoMAX = "lo" + PRIoPTR = "lo" + PRIu16 = "u" + PRIu32 = "u" + PRIu64 = "lu" + PRIu8 = "u" + PRIuFAST16 = "u" + PRIuFAST32 = "u" + PRIuFAST64 = "lu" + PRIuFAST8 = "u" + PRIuLEAST16 = "u" + PRIuLEAST32 = "u" + PRIuLEAST64 = "lu" + PRIuLEAST8 = "u" + PRIuMAX = "lu" + PRIuPTR = "lu" + PRIx16 = "x" + PRIx32 = "x" + PRIx64 = "lx" + PRIx8 = "x" + PRIxFAST16 = "x" + PRIxFAST32 = "x" + PRIxFAST64 = "lx" + PRIxFAST8 = "x" + PRIxLEAST16 = "x" + PRIxLEAST32 = "x" + PRIxLEAST64 = "lx" + PRIxLEAST8 = "x" + PRIxMAX = "lx" + PRIxPTR = "lx" + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SCNd16 = "hd" + SCNd32 = "d" + SCNd64 = "ld" + SCNd8 = "hhd" + SCNdFAST16 = "d" + SCNdFAST32 = "d" + SCNdFAST64 = "ld" + SCNdFAST8 = "d" + SCNdLEAST16 = "hd" + SCNdLEAST32 = "d" + SCNdLEAST64 = "ld" + SCNdLEAST8 = "hhd" + SCNdMAX = "ld" + SCNdPTR = "ld" + SCNi16 = "hi" + SCNi32 = "i" + SCNi64 = "li" + SCNi8 = "hhi" + SCNiFAST16 = "i" + SCNiFAST32 = "i" + SCNiFAST64 = "li" + SCNiFAST8 = "i" + SCNiLEAST16 = "hi" + SCNiLEAST32 = "i" + SCNiLEAST64 = "li" + SCNiLEAST8 = "hhi" + SCNiMAX = "li" + SCNiPTR = "li" + SCNo16 = "ho" + SCNo32 = "o" + SCNo64 = "lo" + SCNo8 = "hho" + SCNoFAST16 = "o" + SCNoFAST32 = "o" + SCNoFAST64 = "lo" + SCNoFAST8 = "o" + SCNoLEAST16 = "ho" + SCNoLEAST32 = "o" + SCNoLEAST64 = "lo" + SCNoLEAST8 = "hho" + SCNoMAX = "lo" + SCNoPTR = "lo" + SCNu16 = "hu" + SCNu32 = "u" + SCNu64 = "lu" + SCNu8 = "hhu" + SCNuFAST16 = "u" + SCNuFAST32 = "u" + SCNuFAST64 = "lu" + SCNuFAST8 = "u" + SCNuLEAST16 = "hu" + SCNuLEAST32 = "u" + SCNuLEAST64 = "lu" + SCNuLEAST8 = "hhu" + SCNuMAX = "lu" + SCNuPTR = "lu" + SCNx16 = "hx" + SCNx32 = "x" + SCNx64 = "lx" + SCNx8 = "hhx" + SCNxFAST16 = "x" + SCNxFAST32 = "x" + SCNxFAST64 = "lx" + SCNxFAST8 = "x" + SCNxLEAST16 = "hx" + SCNxLEAST32 = "x" + SCNxLEAST64 = "lx" + SCNxLEAST8 = "hhx" + SCNxMAX = "lx" + SCNxPTR = "lx" + SCOPE_DELIMITER = 37 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + TRY_AGAIN = 2 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_FMTIO_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_FILE_OFFSET_BITS = 64 + X_INTTYPES_H_ = 0 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_NETDB_H_ = 0 + X_PATH_HEQUIV = "/etc/hosts.equiv" + X_PATH_HOSTS = "/etc/hosts" + X_PATH_NETWORKS = "/etc/networks" + X_PATH_PROTOCOLS = "/etc/protocols" + X_PATH_SERVICES = "/etc/services" + X_PATH_SERVICES_CDB = "/var/db/services.cdb" + X_PATH_SERVICES_DB = "/var/db/services.db" + X_SYS_ANSI_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_INTTYPES_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: endian_machdep.h,v 1.4 2006/01/30 21:52:38 dsl Exp $ + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: inttypes.h,v 1.11 2015/01/16 18:35:59 christos Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: inttypes.h,v 1.6 2013/04/22 21:26:48 joerg Exp $ + +// - +// Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus J. Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.8 Format conversion of integer types + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Int8_t = X__int8_t /* stdint.h:39:18 */ + +type Uint8_t = X__uint8_t /* stdint.h:44:19 */ + +type Int16_t = X__int16_t /* stdint.h:49:19 */ + +type Uint16_t = X__uint16_t /* stdint.h:54:20 */ + +type Int32_t = X__int32_t /* stdint.h:59:19 */ + +type Uint32_t = X__uint32_t /* stdint.h:64:20 */ + +type Int64_t = X__int64_t /* stdint.h:69:19 */ + +type Uint64_t = X__uint64_t /* stdint.h:74:20 */ + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type Imaxdiv_t = struct { + Fquot Intmax_t + Frem Intmax_t +} /* inttypes.h:60:3 */ + +type Locale_t = uintptr /* inttypes.h:66:25 */ + +// Data types +type Socklen_t = X__socklen_t /* netdb.h:102:21 */ + +// % +// Structures returned by network data base library. All addresses are +// supplied in host order, and returned in network order (suitable for +// use in system calls). +type Hostent = struct { + Fh_name uintptr + Fh_aliases uintptr + Fh_addrtype int32 + Fh_length int32 + Fh_addr_list uintptr +} /* netdb.h:148:1 */ + +// % +// Assumption here is that a network number +// fits in an unsigned long -- probably a poor one. +type Netent = struct { + Fn_name uintptr + Fn_aliases uintptr + Fn_addrtype int32 + Fn_net Uint32_t +} /* netdb.h:161:1 */ + +type Servent = struct { + Fs_name uintptr + Fs_aliases uintptr + Fs_port int32 + _ [4]byte + Fs_proto uintptr +} /* netdb.h:176:1 */ + +type Protoent = struct { + Fp_name uintptr + Fp_aliases uintptr + Fp_proto int32 + _ [4]byte +} /* netdb.h:183:1 */ + +// Note: ai_addrlen used to be a size_t, per RFC 2553. +// In XNS5.2, and subsequently in POSIX-2001 and +// draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t. +// To accommodate for this while preserving binary compatibility with the +// old interface, we prepend or append 32 bits of padding, depending on +// the (LP64) architecture's endianness. +// +// This should be deleted the next time the libc major number is +// incremented. +type Addrinfo = struct { + Fai_flags int32 + Fai_family int32 + Fai_socktype int32 + Fai_protocol int32 + Fai_addrlen X__socklen_t + _ [4]byte + Fai_canonname uintptr + Fai_addr uintptr + Fai_next uintptr +} /* netdb.h:202:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/netinet/in/capi_darwin_amd64.go b/vendor/modernc.org/libc/netinet/in/capi_darwin_amd64.go index 3dc4a83a..8883b013 100644 --- a/vendor/modernc.org/libc/netinet/in/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/netinet/in/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_darwin_amd64.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_darwin_amd64.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/capi_freebsd_amd64.go b/vendor/modernc.org/libc/netinet/in/capi_freebsd_amd64.go new file mode 100644 index 00000000..722fc683 --- /dev/null +++ b/vendor/modernc.org/libc/netinet/in/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_freebsd_amd64.go -pkgname in', DO NOT EDIT. + +package in + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/netinet/in/capi_linux_386.go b/vendor/modernc.org/libc/netinet/in/capi_linux_386.go index 6cda465c..4b077477 100644 --- a/vendor/modernc.org/libc/netinet/in/capi_linux_386.go +++ b/vendor/modernc.org/libc/netinet/in/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_386.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_386.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/capi_linux_amd64.go b/vendor/modernc.org/libc/netinet/in/capi_linux_amd64.go index 9e510917..53137ada 100644 --- a/vendor/modernc.org/libc/netinet/in/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/netinet/in/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_amd64.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_amd64.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/capi_linux_arm.go b/vendor/modernc.org/libc/netinet/in/capi_linux_arm.go index caae184a..8448f013 100644 --- a/vendor/modernc.org/libc/netinet/in/capi_linux_arm.go +++ b/vendor/modernc.org/libc/netinet/in/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/capi_linux_arm64.go b/vendor/modernc.org/libc/netinet/in/capi_linux_arm64.go index 5a44162c..d4619795 100644 --- a/vendor/modernc.org/libc/netinet/in/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/netinet/in/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm64.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm64.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/capi_linux_s390x.go b/vendor/modernc.org/libc/netinet/in/capi_linux_s390x.go index 931d9a4c..a2fbd12b 100644 --- a/vendor/modernc.org/libc/netinet/in/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/netinet/in/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_s390x.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_s390x.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/capi_netbsd_amd64.go b/vendor/modernc.org/libc/netinet/in/capi_netbsd_amd64.go new file mode 100644 index 00000000..9c3c7e58 --- /dev/null +++ b/vendor/modernc.org/libc/netinet/in/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_netbsd_amd64.go -pkgname in', DO NOT EDIT. + +package in + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/netinet/in/in_darwin_amd64.go b/vendor/modernc.org/libc/netinet/in/in_darwin_amd64.go index a58d3fb8..8e8956ca 100644 --- a/vendor/modernc.org/libc/netinet/in/in_darwin_amd64.go +++ b/vendor/modernc.org/libc/netinet/in/in_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_darwin_amd64.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_darwin_amd64.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/in_freebsd_amd64.go b/vendor/modernc.org/libc/netinet/in/in_freebsd_amd64.go new file mode 100644 index 00000000..f7df467c --- /dev/null +++ b/vendor/modernc.org/libc/netinet/in/in_freebsd_amd64.go @@ -0,0 +1,1524 @@ +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_freebsd_amd64.go -pkgname in', DO NOT EDIT. + +package in + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + ICMP6_FILTER = 18 + ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47 + INET6_ADDRSTRLEN = 46 + INET_ADDRSTRLEN = 16 + IN_CLASSA_HOST = 0x00ffffff + IN_CLASSA_MAX = 128 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 24 + IN_CLASSB_HOST = 0x0000ffff + IN_CLASSB_MAX = 65536 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 16 + IN_CLASSC_HOST = 0x000000ff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 8 + IN_CLASSD_HOST = 0x0fffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 28 + IN_LOOPBACKNET = 127 + IPCTL_ACCEPTSOURCEROUTE = 13 + IPCTL_DEFTTL = 3 + IPCTL_DIRECTEDBROADCAST = 9 + IPCTL_FASTFORWARDING = 14 + IPCTL_FORWARDING = 1 + IPCTL_GIF_TTL = 16 + IPCTL_INTRDQDROPS = 18 + IPCTL_INTRDQMAXLEN = 17 + IPCTL_INTRQDROPS = 11 + IPCTL_INTRQMAXLEN = 10 + IPCTL_SENDREDIRECTS = 2 + IPCTL_SOURCEROUTE = 8 + IPCTL_STATS = 12 + IPPORT_EPHEMERALFIRST = 10000 + IPPORT_EPHEMERALLAST = 65535 + IPPORT_HIFIRSTAUTO = 49152 + IPPORT_HILASTAUTO = 65535 + IPPORT_MAX = 65535 + IPPORT_RESERVED = 1024 + IPPORT_RESERVEDSTART = 600 + IPPROTO_3PC = 34 + IPPROTO_ADFS = 68 + IPPROTO_AH = 51 + IPPROTO_AHIP = 61 + IPPROTO_APES = 99 + IPPROTO_ARGUS = 13 + IPPROTO_AX25 = 93 + IPPROTO_BHA = 49 + IPPROTO_BLT = 30 + IPPROTO_BRSATMON = 76 + IPPROTO_CARP = 112 + IPPROTO_CFTP = 62 + IPPROTO_CHAOS = 16 + IPPROTO_CMTP = 38 + IPPROTO_CPHB = 73 + IPPROTO_CPNX = 72 + IPPROTO_DCCP = 33 + IPPROTO_DDP = 37 + IPPROTO_DGP = 86 + IPPROTO_DIVERT = 258 + IPPROTO_DONE = 257 + IPPROTO_DSTOPTS = 60 + IPPROTO_EGP = 8 + IPPROTO_EMCON = 14 + IPPROTO_ENCAP = 98 + IPPROTO_EON = 80 + IPPROTO_ESP = 50 + IPPROTO_ETHERIP = 97 + IPPROTO_FRAGMENT = 44 + IPPROTO_GGP = 3 + IPPROTO_GMTP = 100 + IPPROTO_GRE = 47 + IPPROTO_HELLO = 63 + IPPROTO_HIP = 139 + IPPROTO_HMP = 20 + IPPROTO_HOPOPTS = 0 + IPPROTO_ICMP = 1 + IPPROTO_ICMPV6 = 58 + IPPROTO_IDP = 22 + IPPROTO_IDPR = 35 + IPPROTO_IDRP = 45 + IPPROTO_IGMP = 2 + IPPROTO_IGP = 85 + IPPROTO_IGRP = 88 + IPPROTO_IL = 40 + IPPROTO_INLSP = 52 + IPPROTO_INP = 32 + IPPROTO_IP = 0 + IPPROTO_IPCOMP = 108 + IPPROTO_IPCV = 71 + IPPROTO_IPEIP = 94 + IPPROTO_IPIP = 4 + IPPROTO_IPPC = 67 + IPPROTO_IPV4 = 4 + IPPROTO_IPV6 = 41 + IPPROTO_IRTP = 28 + IPPROTO_KRYPTOLAN = 65 + IPPROTO_LARP = 91 + IPPROTO_LEAF1 = 25 + IPPROTO_LEAF2 = 26 + IPPROTO_MAX = 256 + IPPROTO_MEAS = 19 + IPPROTO_MH = 135 + IPPROTO_MHRP = 48 + IPPROTO_MICP = 95 + IPPROTO_MOBILE = 55 + IPPROTO_MPLS = 137 + IPPROTO_MTP = 92 + IPPROTO_MUX = 18 + IPPROTO_ND = 77 + IPPROTO_NHRP = 54 + IPPROTO_NONE = 59 + IPPROTO_NSP = 31 + IPPROTO_NVPII = 11 + IPPROTO_OLD_DIVERT = 254 + IPPROTO_OSPFIGP = 89 + IPPROTO_PFSYNC = 240 + IPPROTO_PGM = 113 + IPPROTO_PIGP = 9 + IPPROTO_PIM = 103 + IPPROTO_PRM = 21 + IPPROTO_PUP = 12 + IPPROTO_PVP = 75 + IPPROTO_RAW = 255 + IPPROTO_RCCMON = 10 + IPPROTO_RDP = 27 + IPPROTO_RESERVED_253 = 253 + IPPROTO_RESERVED_254 = 254 + IPPROTO_ROUTING = 43 + IPPROTO_RSVP = 46 + IPPROTO_RVD = 66 + IPPROTO_SATEXPAK = 64 + IPPROTO_SATMON = 69 + IPPROTO_SCCSP = 96 + IPPROTO_SCTP = 132 + IPPROTO_SDRP = 42 + IPPROTO_SEND = 259 + IPPROTO_SHIM6 = 140 + IPPROTO_SKIP = 57 + IPPROTO_SPACER = 32767 + IPPROTO_SRPC = 90 + IPPROTO_ST = 7 + IPPROTO_SVMTP = 82 + IPPROTO_SWIPE = 53 + IPPROTO_TCF = 87 + IPPROTO_TCP = 6 + IPPROTO_TLSP = 56 + IPPROTO_TP = 29 + IPPROTO_TPXX = 39 + IPPROTO_TRUNK1 = 23 + IPPROTO_TRUNK2 = 24 + IPPROTO_TTP = 84 + IPPROTO_UDP = 17 + IPPROTO_UDPLITE = 136 + IPPROTO_VINES = 83 + IPPROTO_VISA = 70 + IPPROTO_VMTP = 81 + IPPROTO_WBEXPAK = 79 + IPPROTO_WBMON = 78 + IPPROTO_WSN = 74 + IPPROTO_XNET = 15 + IPPROTO_XTP = 36 + IPV6CTL_ACCEPT_RTADV = 12 + IPV6CTL_ADDRCTLPOLICY = 38 + IPV6CTL_AUTO_FLOWLABEL = 17 + IPV6CTL_AUTO_LINKLOCAL = 35 + IPV6CTL_DAD_COUNT = 16 + IPV6CTL_DEFHLIM = 3 + IPV6CTL_DEFMCASTHLIM = 18 + IPV6CTL_FORWARDING = 1 + IPV6CTL_FORWSRCRT = 5 + IPV6CTL_GIF_HLIM = 19 + IPV6CTL_HDRNESTLIMIT = 15 + IPV6CTL_INTRDQMAXLEN = 52 + IPV6CTL_INTRQMAXLEN = 51 + IPV6CTL_KAME_VERSION = 20 + IPV6CTL_LOG_INTERVAL = 14 + IPV6CTL_MAXFRAGBUCKETSIZE = 54 + IPV6CTL_MAXFRAGPACKETS = 9 + IPV6CTL_MAXFRAGS = 41 + IPV6CTL_MAXFRAGSPERPACKET = 53 + IPV6CTL_MAXID = 55 + IPV6CTL_MCAST_PMTU = 44 + IPV6CTL_MRTPROTO = 8 + IPV6CTL_MRTSTATS = 7 + IPV6CTL_NORBIT_RAIF = 49 + IPV6CTL_NO_RADR = 48 + IPV6CTL_PREFER_TEMPADDR = 37 + IPV6CTL_RFC6204W3 = 50 + IPV6CTL_RIP6STATS = 36 + IPV6CTL_RR_PRUNE = 22 + IPV6CTL_SENDREDIRECTS = 2 + IPV6CTL_SOURCECHECK = 10 + IPV6CTL_SOURCECHECK_LOGINT = 11 + IPV6CTL_STATS = 6 + IPV6CTL_STEALTH = 45 + IPV6CTL_TEMPPLTIME = 33 + IPV6CTL_TEMPVLTIME = 34 + IPV6CTL_USETEMPADDR = 32 + IPV6CTL_USE_DEFAULTZONE = 39 + IPV6CTL_USE_DEPRECATED = 21 + IPV6CTL_V6ONLY = 24 + IPV6PORT_ANONMAX = 65535 + IPV6PORT_ANONMIN = 49152 + IPV6PORT_RESERVED = 1024 + IPV6PORT_RESERVEDMAX = 1023 + IPV6PORT_RESERVEDMIN = 600 + IPV6PROTO_MAXID = 104 + IPV6_AUTOFLOWLABEL = 59 + IPV6_BINDANY = 64 + IPV6_BINDMULTI = 65 + IPV6_BINDV6ONLY = 27 + IPV6_CHECKSUM = 26 + IPV6_DEFAULT_MULTICAST_HOPS = 1 + IPV6_DEFAULT_MULTICAST_LOOP = 1 + IPV6_DONTFRAG = 62 + IPV6_DSTOPTS = 50 + IPV6_FLOWID = 67 + IPV6_FLOWTYPE = 68 + IPV6_FW_ADD = 30 + IPV6_FW_DEL = 31 + IPV6_FW_FLUSH = 32 + IPV6_FW_GET = 34 + IPV6_FW_ZERO = 33 + IPV6_HOPLIMIT = 47 + IPV6_HOPOPTS = 49 + IPV6_IPSEC_POLICY = 28 + IPV6_JOIN_GROUP = 12 + IPV6_LEAVE_GROUP = 13 + IPV6_MAX_GROUP_SRC_FILTER = 512 + IPV6_MAX_MEMBERSHIPS = 4095 + IPV6_MAX_SOCK_SRC_FILTER = 128 + IPV6_MSFILTER = 74 + IPV6_MULTICAST_HOPS = 10 + IPV6_MULTICAST_IF = 9 + IPV6_MULTICAST_LOOP = 11 + IPV6_NEXTHOP = 48 + IPV6_ORIGDSTADDR = 72 + IPV6_PATHMTU = 44 + IPV6_PKTINFO = 46 + IPV6_PORTRANGE = 14 + IPV6_PORTRANGE_DEFAULT = 0 + IPV6_PORTRANGE_HIGH = 1 + IPV6_PORTRANGE_LOW = 2 + IPV6_PREFER_TEMPADDR = 63 + IPV6_RECVDSTOPTS = 40 + IPV6_RECVFLOWID = 70 + IPV6_RECVHOPLIMIT = 37 + IPV6_RECVHOPOPTS = 39 + IPV6_RECVORIGDSTADDR = 72 + IPV6_RECVPATHMTU = 43 + IPV6_RECVPKTINFO = 36 + IPV6_RECVRSSBUCKETID = 71 + IPV6_RECVRTHDR = 38 + IPV6_RECVTCLASS = 57 + IPV6_RSSBUCKETID = 69 + IPV6_RSS_LISTEN_BUCKET = 66 + IPV6_RTHDR = 51 + IPV6_RTHDRDSTOPTS = 35 + IPV6_RTHDR_LOOSE = 0 + IPV6_RTHDR_STRICT = 1 + IPV6_RTHDR_TYPE_0 = 0 + IPV6_SOCKOPT_RESERVED1 = 3 + IPV6_TCLASS = 61 + IPV6_UNICAST_HOPS = 4 + IPV6_USE_MIN_MTU = 42 + IPV6_V6ONLY = 27 + IPV6_VLAN_PCP = 75 + IP_ADD_MEMBERSHIP = 12 + IP_ADD_SOURCE_MEMBERSHIP = 70 + IP_BINDANY = 24 + IP_BINDMULTI = 25 + IP_BLOCK_SOURCE = 72 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DONTFRAG = 67 + IP_DROP_MEMBERSHIP = 13 + IP_DROP_SOURCE_MEMBERSHIP = 71 + IP_DUMMYNET3 = 49 + IP_DUMMYNET_CONFIGURE = 60 + IP_DUMMYNET_DEL = 61 + IP_DUMMYNET_FLUSH = 62 + IP_DUMMYNET_GET = 64 + IP_FLOWID = 90 + IP_FLOWTYPE = 91 + IP_FW3 = 48 + IP_FW_ADD = 50 + IP_FW_DEL = 51 + IP_FW_FLUSH = 52 + IP_FW_GET = 54 + IP_FW_NAT_CFG = 56 + IP_FW_NAT_DEL = 57 + IP_FW_NAT_GET_CONFIG = 58 + IP_FW_NAT_GET_LOG = 59 + IP_FW_RESETLOG = 55 + IP_FW_TABLE_ADD = 40 + IP_FW_TABLE_DEL = 41 + IP_FW_TABLE_FLUSH = 42 + IP_FW_TABLE_GETSIZE = 43 + IP_FW_TABLE_LIST = 44 + IP_FW_ZERO = 53 + IP_HDRINCL = 2 + IP_IPSEC_POLICY = 21 + IP_MAX_GROUP_SRC_FILTER = 512 + IP_MAX_MEMBERSHIPS = 4095 + IP_MAX_SOCK_MUTE_FILTER = 128 + IP_MAX_SOCK_SRC_FILTER = 128 + IP_MINTTL = 66 + IP_MSFILTER = 74 + IP_MULTICAST_IF = 9 + IP_MULTICAST_LOOP = 11 + IP_MULTICAST_TTL = 10 + IP_MULTICAST_VIF = 14 + IP_ONESBCAST = 23 + IP_OPTIONS = 1 + IP_ORIGDSTADDR = 27 + IP_PORTRANGE = 19 + IP_PORTRANGE_DEFAULT = 0 + IP_PORTRANGE_HIGH = 1 + IP_PORTRANGE_LOW = 2 + IP_RECVDSTADDR = 7 + IP_RECVFLOWID = 93 + IP_RECVIF = 20 + IP_RECVOPTS = 5 + IP_RECVORIGDSTADDR = 27 + IP_RECVRETOPTS = 6 + IP_RECVRSSBUCKETID = 94 + IP_RECVTOS = 68 + IP_RECVTTL = 65 + IP_RETOPTS = 8 + IP_RSSBUCKETID = 92 + IP_RSS_LISTEN_BUCKET = 26 + IP_RSVP_OFF = 16 + IP_RSVP_ON = 15 + IP_RSVP_VIF_OFF = 18 + IP_RSVP_VIF_ON = 17 + IP_SENDSRCADDR = 7 + IP_TOS = 3 + IP_TTL = 4 + IP_UNBLOCK_SOURCE = 73 + IP_VLAN_PCP = 75 + LITTLE_ENDIAN = 1234 + MCAST_BLOCK_SOURCE = 84 + MCAST_EXCLUDE = 2 + MCAST_INCLUDE = 1 + MCAST_JOIN_GROUP = 80 + MCAST_JOIN_SOURCE_GROUP = 82 + MCAST_LEAVE_GROUP = 81 + MCAST_LEAVE_SOURCE_GROUP = 83 + MCAST_UNBLOCK_SOURCE = 85 + MCAST_UNDEFINED = 0 + PDP_ENDIAN = 3412 + SIN6_LEN = 0 + X_BIG_ENDIAN = 4321 + X_BYTEORDER_FUNC_DEFINED = 0 + X_BYTEORDER_PROTOTYPED = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_IN_ADDR_T_DECLARED = 0 + X_IN_PORT_T_DECLARED = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_MACHINE_ENDIAN_H_ = 0 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_NETINET6_IN6_H_ = 0 + X_NETINET_IN_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PDP_ENDIAN = 3412 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SA_FAMILY_T_DECLARED = 0 + X_SIZE_T_DECLARED = 0 + X_SOCKLEN_T_DECLARED = 0 + X_SS_MAXSIZE = 128 + X_STRUCT_IN_ADDR_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__SOCKADDR_STORAGE_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_UINT16_T_DECLARED = 0 + X_UINT32_T_DECLARED = 0 + X_UINT8_T_DECLARED = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)in.h 8.3 (Berkeley) 1/3/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1987, 1991 Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 7.8 (Berkeley) 4/3/91 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Define the order of 32-bit words in 64-bit words. + +// Definitions for byte order, according to byte significance from low +// address to high. + +// Deprecated variants that don't have enough underscores to be useful in more +// strict namespaces. + +// Protocols common to RFC 1700, POSIX, and X/Open. + +type Uint8_t = X__uint8_t /* in.h:52:20 */ + +type Uint16_t = X__uint16_t /* in.h:57:21 */ + +type Uint32_t = X__uint32_t /* in.h:62:21 */ + +type In_addr_t = Uint32_t /* in.h:67:19 */ + +type In_port_t = Uint16_t /* in.h:72:19 */ + +type Sa_family_t = X__sa_family_t /* in.h:77:24 */ + +// Internet address (a structure for historical reasons). +type In_addr = struct{ Fs_addr In_addr_t } /* in.h:83:1 */ + +type Socklen_t = X__socklen_t /* in.h:90:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)socket.h 8.4 (Berkeley) 2/21/94 +// $FreeBSD$ + +// RFC 2553: protocol-independent placeholder for socket addresses + +type Sockaddr_storage = struct { + Fss_len uint8 + Fss_family Sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 +} /* _sockaddr_storage.h:48:1 */ + +// Socket address, internet style. +type Sockaddr_in = struct { + Fsin_len Uint8_t + Fsin_family Sa_family_t + Fsin_port In_port_t + Fsin_addr struct{ Fs_addr In_addr_t } + Fsin_zero [8]int8 +} /* in.h:97:1 */ + +// Constants and structures defined by the internet system, +// Per RFC 790, September 1981, and numerous additions. + +// Protocols (RFC 1700) +// 101-254: Partly Unassigned +// 255: Reserved +// BSD Private, local use, namespace incursion, no longer used + +// last return value of *_input(), meaning "all job for this pkt is done". + +// Only used internally, so can be outside the range of valid IP protocols. + +// Defined to avoid confusion. The master value is defined by +// PROTO_SPACER in sys/protosw.h. + +// Local port number conventions: +// +// When a user does a bind(2) or connect(2) with a port number of zero, +// a non-conflicting local port address is chosen. +// The default range is IPPORT_HIFIRSTAUTO through +// IPPORT_HILASTAUTO, although that is settable by sysctl. +// +// A user may set the IPPROTO_IP option IP_PORTRANGE to change this +// default assignment range. +// +// The value IP_PORTRANGE_DEFAULT causes the default behavior. +// +// The value IP_PORTRANGE_HIGH changes the range of candidate port numbers +// into the "high" range. These are reserved for client outbound connections +// which do not want to be filtered by any firewalls. +// +// The value IP_PORTRANGE_LOW changes the range to the "low" are +// that is (by convention) restricted to privileged processes. This +// convention is based on "vouchsafe" principles only. It is only secure +// if you trust the remote host to restrict these ports. +// +// The default range of ports and the high range can be changed by +// sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last}) +// +// Changing those values has bad security implications if you are +// using a stateless firewall that is allowing packets outside of that +// range in order to allow transparent outgoing connections. +// +// Such a firewall configuration will generally depend on the use of these +// default values. If you change them, you may find your Security +// Administrator looking for you with a heavy object. +// +// For a slightly more orthodox text view on this: +// +// ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers +// +// port numbers are divided into three ranges: +// +// 0 - 1023 Well Known Ports +// 1024 - 49151 Registered Ports +// 49152 - 65535 Dynamic and/or Private Ports +// + +// Ports < IPPORT_RESERVED are reserved for +// privileged processes (e.g. root). (IP_PORTRANGE_LOW) + +// Default local port range, used by IP_PORTRANGE_DEFAULT + +// Dynamic port range, used by IP_PORTRANGE_HIGH. + +// Scanning for a free reserved port return a value below IPPORT_RESERVED, +// but higher than IPPORT_RESERVEDSTART. Traditionally the start value was +// 512, but that conflicts with some well-known-services that firewalls may +// have a fit if we use. + +// Definitions of bits in internet address integers. +// On subnets, the decomposition of addresses to host and net parts +// is done according to subnet mask, not the masks here. + +// Options for use with [gs]etsockopt at the IP level. +// First word of comment is data type; bool is stored in int. +// for IPSEC +// unused; was IP_FAITH + +// Options for controlling the firewall and dummynet. +// Historical options (from 40 to 64) will eventually be +// replaced by only two options, IP_FW3 and IP_DUMMYNET3. + +// IPv4 Source Filter Multicast API [RFC3678] + +// The following option is private; do not use it from user applications. + +// The following option deals with the 802.1Q Ethernet Priority Code Point +// -1 use interface default + +// Protocol Independent Multicast API [RFC3678] + +// Flow and RSS definitions + +// Defaults and limits for options + +// Limit for IPv4 multicast memberships + +// Default resource limits for IPv4 multicast source filtering. +// These may be modified by sysctl. + +// Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. +type Ip_mreq = struct { + Fimr_multiaddr struct{ Fs_addr In_addr_t } + Fimr_interface struct{ Fs_addr In_addr_t } +} /* in.h:527:1 */ + +// Modified argument structure for IP_MULTICAST_IF, obtained from Linux. +// This is used to specify an interface index for multicast sends, as +// the IPv4 legacy APIs do not support this (unless IP_SENDIF is available). +type Ip_mreqn = struct { + Fimr_multiaddr struct{ Fs_addr In_addr_t } + Fimr_address struct{ Fs_addr In_addr_t } + Fimr_ifindex int32 +} /* in.h:537:1 */ + +// Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678] +type Ip_mreq_source = struct { + Fimr_multiaddr struct{ Fs_addr In_addr_t } + Fimr_sourceaddr struct{ Fs_addr In_addr_t } + Fimr_interface struct{ Fs_addr In_addr_t } +} /* in.h:546:1 */ + +// Argument structures for Protocol-Independent Multicast Source +// Filter APIs. [RFC3678] +type Group_req = struct { + Fgr_interface Uint32_t + _ [4]byte + Fgr_group struct { + Fss_len uint8 + Fss_family Sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 + } +} /* in.h:556:1 */ + +type Group_source_req = struct { + Fgsr_interface Uint32_t + _ [4]byte + Fgsr_group struct { + Fss_len uint8 + Fss_family Sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 + } + Fgsr_source struct { + Fss_len uint8 + Fss_family Sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 + } +} /* in.h:561:1 */ + +// The following structure is private; do not use it from user applications. +// It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between +// the RFC 3678 libc functions and the kernel. +type X__msfilterreq = struct { + Fmsfr_ifindex Uint32_t + Fmsfr_fmode Uint32_t + Fmsfr_nsrcs Uint32_t + _ [4]byte + Fmsfr_group struct { + Fss_len uint8 + Fss_family Sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 + } + Fmsfr_srcs uintptr +} /* in.h:574:1 */ + +// Filter modes; also used to represent per-socket filter mode internally. + +// Argument for IP_PORTRANGE: +// - which range to search when port is unspecified at bind() or connect() + +// Identifiers for IP sysctl nodes +// IPCTL_RTEXPIRE 5 deprecated +// IPCTL_RTMINEXPIRE 6 deprecated +// IPCTL_RTMAXCACHE 7 deprecated +// 15, unused, was: IPCTL_KEEPFAITH + +// INET6 stuff +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the project nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $ + +// - +// Copyright (c) 1982, 1986, 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)in.h 8.3 (Berkeley) 1/3/94 +// $FreeBSD$ + +// Identification of the network protocol stack +// for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE +// has the table of implementation/integration differences. + +// IPv6 port allocation rules should mirror the IPv4 rules and are controlled +// by the net.inet.ip.portrange sysctl tree. The following defines exist +// for compatibility with userland applications that need them. + +// IPv6 address +type In6_addr = struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]Uint8_t + } +} /* in6.h:97:1 */ + +// XXX missing POSIX.1-2001 macro IPPROTO_IPV6. + +// Socket address for IPv6 + +type Sockaddr_in6 = struct { + Fsin6_len Uint8_t + Fsin6_family Sa_family_t + Fsin6_port In_port_t + Fsin6_flowinfo Uint32_t + Fsin6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]Uint8_t + } + } + Fsin6_scope_id Uint32_t +} /* in6.h:125:1 */ + +type Route_in6 = struct { + Fro_nh uintptr + Fro_lle uintptr + Fro_prepend uintptr + Fro_plen Uint16_t + Fro_flags Uint16_t + Fro_mtu Uint16_t + Fspare Uint16_t + Fro_dst struct { + Fsin6_len Uint8_t + Fsin6_family Sa_family_t + Fsin6_port In_port_t + Fsin6_flowinfo Uint32_t + Fsin6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]Uint8_t + } + } + Fsin6_scope_id Uint32_t + } + _ [4]byte +} /* in6.h:379:1 */ + +// Options for use with [gs]etsockopt at the IPV6 level. +// First word of comment is data type; bool is stored in int. +// no hdrincl +// RFC2292 options + +// 29; unused; was IPV6_FAITH + +// new socket options introduced in RFC3542 + +// more new socket options introduced in RFC3542 + +// The following option is private; do not use it from user applications. +// It is deliberately defined to the same value as IP_MSFILTER. + +// The following option deals with the 802.1Q Ethernet Priority Code Point +// -1 use interface default + +// to define items, should talk with KAME guys first, for *BSD compatibility + +// Defaults and limits for options + +// Limit for IPv6 multicast memberships + +// Default resource limits for IPv6 multicast source filtering. +// These may be modified by sysctl. + +// Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. +type Ipv6_mreq = struct { + Fipv6mr_multiaddr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]Uint8_t + } + } + Fipv6mr_interface uint32 +} /* in6.h:545:1 */ + +// IPV6_PKTINFO: Packet information(RFC2292 sec 5) +type In6_pktinfo = struct { + Fipi6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]Uint8_t + } + } + Fipi6_ifindex uint32 +} /* in6.h:553:1 */ + +// Control structure for IPV6_RECVPATHMTU socket option. +type Ip6_mtuinfo = struct { + Fip6m_addr struct { + Fsin6_len Uint8_t + Fsin6_family Sa_family_t + Fsin6_port In_port_t + Fsin6_flowinfo Uint32_t + Fsin6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]Uint8_t + } + } + Fsin6_scope_id Uint32_t + } + Fip6m_mtu Uint32_t +} /* in6.h:561:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/netinet/in/in_linux_386.go b/vendor/modernc.org/libc/netinet/in/in_linux_386.go index 068d8600..c50a9dd1 100644 --- a/vendor/modernc.org/libc/netinet/in/in_linux_386.go +++ b/vendor/modernc.org/libc/netinet/in/in_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_386.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_386.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/in_linux_amd64.go b/vendor/modernc.org/libc/netinet/in/in_linux_amd64.go index daa93b7a..862baf2d 100644 --- a/vendor/modernc.org/libc/netinet/in/in_linux_amd64.go +++ b/vendor/modernc.org/libc/netinet/in/in_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_amd64.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_amd64.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/in_linux_arm.go b/vendor/modernc.org/libc/netinet/in/in_linux_arm.go index 31ea0412..1e16d4cc 100644 --- a/vendor/modernc.org/libc/netinet/in/in_linux_arm.go +++ b/vendor/modernc.org/libc/netinet/in/in_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/in_linux_arm64.go b/vendor/modernc.org/libc/netinet/in/in_linux_arm64.go index 60d72b2f..308e5c53 100644 --- a/vendor/modernc.org/libc/netinet/in/in_linux_arm64.go +++ b/vendor/modernc.org/libc/netinet/in/in_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm64.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_arm64.go -pkgname in', DO NOT EDIT. package in diff --git a/vendor/modernc.org/libc/netinet/in/in_linux_s390x.go b/vendor/modernc.org/libc/netinet/in/in_linux_s390x.go index ae8e84cc..7cda974e 100644 --- a/vendor/modernc.org/libc/netinet/in/in_linux_s390x.go +++ b/vendor/modernc.org/libc/netinet/in/in_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_s390x.go -pkgname in', DO NOT EDIT. +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_linux_s390x.go -pkgname in', DO NOT EDIT. package in @@ -40,7 +40,7 @@ const ( AF_KEY = 15 AF_LLC = 26 AF_LOCAL = 1 - AF_MAX = 44 + AF_MAX = 45 AF_MPLS = 28 AF_NETBEUI = 13 AF_NETLINK = 16 @@ -63,6 +63,7 @@ const ( AF_VSOCK = 40 AF_WANPIPE = 25 AF_X25 = 9 + AF_XDP = 44 BIG_ENDIAN = 4321 BYTE_ORDER = 4321 FD_SETSIZE = 1024 @@ -109,6 +110,7 @@ const ( IPV6_MINHOPCOUNT = 73 IPV6_MTU = 24 IPV6_MTU_DISCOVER = 23 + IPV6_MULTICAST_ALL = 29 IPV6_MULTICAST_HOPS = 18 IPV6_MULTICAST_IF = 17 IPV6_MULTICAST_LOOP = 19 @@ -133,6 +135,7 @@ const ( IPV6_RECVRTHDR = 56 IPV6_RECVTCLASS = 66 IPV6_ROUTER_ALERT = 22 + IPV6_ROUTER_ALERT_ISOLATE = 30 IPV6_RTHDR = 57 IPV6_RTHDRDSTOPTS = 55 IPV6_RTHDR_LOOSE = 0 @@ -231,7 +234,7 @@ const ( PF_KEY = 15 PF_LLC = 26 PF_LOCAL = 1 - PF_MAX = 44 + PF_MAX = 45 PF_MPLS = 28 PF_NETBEUI = 13 PF_NETLINK = 16 @@ -254,6 +257,7 @@ const ( PF_VSOCK = 40 PF_WANPIPE = 25 PF_X25 = 9 + PF_XDP = 44 SCM_TIMESTAMP = 29 SCM_TIMESTAMPING = 37 SCM_TIMESTAMPING_OPT_STATS = 54 @@ -263,8 +267,8 @@ const ( SCM_WIFI_STATUS = 41 SIOCATMARK = 0x8905 SIOCGPGRP = 0x8904 - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_OLD = 0x8906 SIOCSPGRP = 0x8902 SOL_AAL = 265 SOL_ALG = 279 @@ -293,13 +297,15 @@ const ( SOL_TIPC = 271 SOL_TLS = 282 SOL_X25 = 262 - SOMAXCONN = 128 + SOL_XDP = 283 + SOMAXCONN = 4096 SO_ACCEPTCONN = 30 SO_ATTACH_BPF = 50 SO_ATTACH_FILTER = 26 SO_ATTACH_REUSEPORT_CBPF = 51 SO_ATTACH_REUSEPORT_EBPF = 52 SO_BINDTODEVICE = 25 + SO_BINDTOIFINDEX = 62 SO_BPF_EXTENSIONS = 48 SO_BROADCAST = 6 SO_BSDCOMPAT = 14 @@ -309,6 +315,7 @@ const ( SO_DEBUG = 1 SO_DETACH_BPF = 27 SO_DETACH_FILTER = 27 + SO_DETACH_REUSEPORT_BPF = 68 SO_DOMAIN = 39 SO_DONTROUTE = 5 SO_ERROR = 4 @@ -337,6 +344,8 @@ const ( SO_RCVBUFFORCE = 33 SO_RCVLOWAT = 18 SO_RCVTIMEO = 20 + SO_RCVTIMEO_NEW = 66 + SO_RCVTIMEO_OLD = 20 SO_REUSEADDR = 2 SO_REUSEPORT = 15 SO_RXQ_OVFL = 40 @@ -348,21 +357,31 @@ const ( SO_SNDBUFFORCE = 32 SO_SNDLOWAT = 19 SO_SNDTIMEO = 21 + SO_SNDTIMEO_NEW = 67 + SO_SNDTIMEO_OLD = 21 SO_TIMESTAMP = 29 SO_TIMESTAMPING = 37 + SO_TIMESTAMPING_NEW = 65 + SO_TIMESTAMPING_OLD = 37 SO_TIMESTAMPNS = 35 + SO_TIMESTAMPNS_NEW = 64 + SO_TIMESTAMPNS_OLD = 35 + SO_TIMESTAMP_NEW = 63 + SO_TIMESTAMP_OLD = 29 SO_TXTIME = 61 SO_TYPE = 3 SO_WIFI_STATUS = 41 SO_ZEROCOPY = 60 - X_ASM_SOCKET_H = 0 X_ATFILE_SOURCE = 1 X_BITS_BYTESWAP_H = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 X_BITS_SOCKADDR_H = 1 X_BITS_STDINT_INTN_H = 1 X_BITS_STDINT_UINTN_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BITS_UINTN_IDENTITY_H = 1 @@ -373,10 +392,12 @@ const ( X_FEATURES_H = 1 X_FILE_OFFSET_BITS = 64 X_GCC_SIZE_T = 0 + X_LINUX_POSIX_TYPES_H = 0 X_LP64 = 1 X_NETINET_IN_H = 1 X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 + X_RWLOCK_INTERNAL_H = 0 X_SIZET_ = 0 X_SIZE_T = 0 X_SIZE_T_ = 0 @@ -391,6 +412,7 @@ const ( X_SYS_SIZE_T_H = 0 X_SYS_SOCKET_H = 1 X_SYS_TYPES_H = 1 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 X_T_SIZE_ = 0 @@ -399,7 +421,7 @@ const ( ) // Bits in the FLAGS argument to `send', `recv', et al. -const ( /* socket.h:197:1: */ +const ( /* socket.h:200:1: */ MSG_OOB = 1 // Process out-of-band data. MSG_PEEK = 2 // Peek at incoming messages. MSG_DONTROUTE = 4 // Don't use local routing. @@ -426,13 +448,13 @@ const ( /* socket.h:197:1: */ // Socket level message types. This must match the definitions in // . -const ( /* socket.h:329:1: */ +const ( /* socket.h:332:1: */ SCM_RIGHTS = 1 ) // Get the architecture-dependent definition of enum __socket_type. // Define enum __socket_type for generic Linux. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -447,7 +469,7 @@ const ( /* socket.h:329:1: */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Types of sockets. const ( /* socket_type.h:24:1: */ @@ -599,7 +621,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -614,9 +636,9 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -631,7 +653,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -639,6 +661,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -759,6 +782,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -781,9 +806,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -798,7 +836,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -811,7 +849,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -826,7 +864,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -941,7 +979,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -958,14 +996,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -980,7 +1016,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -1017,7 +1053,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // Define uintN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1032,10 +1068,10 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1050,11 +1086,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1069,43 +1105,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -1117,7 +1175,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -1138,7 +1196,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1153,7 +1211,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -1168,78 +1226,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. type Uint8_t = X__uint8_t /* stdint-uintn.h:24:19 */ type Uint16_t = X__uint16_t /* stdint-uintn.h:25:20 */ @@ -1267,7 +1353,7 @@ type Iovec = struct { Fiov_len Size_t } /* struct_iovec.h:26:1 */ -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1353,7 +1439,7 @@ type Iovec = struct { // AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', // `struct msghdr', and `struct linger' types. // System-specific socket constants and types. Linux version. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1368,9 +1454,9 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1452,7 +1538,7 @@ type Iovec = struct { // A null pointer constant. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1467,11 +1553,11 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 2.6 Primitive System Data Types -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1486,10 +1572,10 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1504,7 +1590,7 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1543,7 +1629,7 @@ type Caddr_t = X__caddr_t /* types.h:115:19 */ type Key_t = X__key_t /* types.h:121:17 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1558,7 +1644,7 @@ type Key_t = X__key_t /* types.h:121:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1566,7 +1652,7 @@ type Key_t = X__key_t /* types.h:121:17 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1581,7 +1667,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1589,7 +1675,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1604,7 +1690,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1612,7 +1698,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Time_t = X__time_t /* time_t.h:7:18 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1627,14 +1713,14 @@ type Time_t = X__time_t /* time_t.h:7:18 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Timer ID returned by `timer_create'. type Timer_t = X__timer_t /* timer_t.h:7:19 */ -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1724,7 +1810,7 @@ type Uint = uint32 /* types.h:150:22 */ // These size-specific names are used by some of the inet code. // Define intN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1739,10 +1825,10 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1757,7 +1843,7 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1766,18 +1852,17 @@ type Int16_t = X__int16_t /* stdint-intn.h:25:19 */ type Int32_t = X__int32_t /* stdint-intn.h:26:19 */ type Int64_t = X__int64_t /* stdint-intn.h:27:19 */ -// For GCC 2.7 and later, we can use specific type-size attributes. +// These were defined by ISO C without the first `_'. +type U_int8_t = X__uint8_t /* types.h:158:19 */ +type U_int16_t = X__uint16_t /* types.h:159:20 */ +type U_int32_t = X__uint32_t /* types.h:160:20 */ +type U_int64_t = X__uint64_t /* types.h:161:20 */ -type U_int8_t = uint32 /* types.h:177:1 */ -type U_int16_t = uint32 /* types.h:178:1 */ -type U_int32_t = uint32 /* types.h:179:1 */ -type U_int64_t = uint32 /* types.h:180:1 */ - -type Register_t = int32 /* types.h:182:13 */ +type Register_t = int32 /* types.h:164:13 */ // It also defines `fd_set' and the FD_* macros for `select'. // `fd_set' type and related macros, and `select'/`pselect' declarations. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1792,11 +1877,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX 1003.1g: 6.2 Select from File Descriptor Sets -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1811,11 +1896,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Get definition of needed basic types. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1830,12 +1915,12 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Get __FD_* definitions. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1850,7 +1935,7 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We don't use `memset' because this would require a prototype and // the array isn't too big. @@ -1865,7 +1950,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // Get definition of timer specification structures. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1880,7 +1965,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1894,7 +1979,27 @@ type Timeval = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1911,14 +2016,12 @@ type Timeval = struct { // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. - // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ type Suseconds_t = X__suseconds_t /* select.h:43:23 */ @@ -1938,16 +2041,16 @@ type Fd_mask = X__fd_mask /* select.h:77:19 */ // Define some inlines helping to catch common problems. -type Blksize_t = X__blksize_t /* types.h:202:21 */ +type Blksize_t = X__blksize_t /* types.h:185:21 */ // Types from the Large File Support interface. -type Blkcnt_t = X__blkcnt64_t /* types.h:222:22 */ // Type to count number of disk blocks. -type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:226:24 */ // Type to count file system blocks. -type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file system inodes. +type Blkcnt_t = X__blkcnt64_t /* types.h:205:22 */ // Type to count number of disk blocks. +type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:209:24 */ // Type to count file system blocks. +type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:213:24 */ // Type to count file system inodes. // Now add the thread types. // Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1962,11 +2065,11 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // For internal mutex and condition variable definitions. // Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1981,7 +2084,7 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -1996,36 +2099,6 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -2034,11 +2107,10 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2057,7 +2129,176 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Type to count file system inodes. + +// Now add the thread types. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -2072,31 +2313,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -2108,7 +2325,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -2118,14 +2335,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -2136,7 +2353,7 @@ type Pthread_once_t = int32 /* pthreadtypes.h:53:30 */ type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* pthreadtypes.h:56:1 */ type Pthread_attr_t = Pthread_attr_t1 /* pthreadtypes.h:62:30 */ @@ -2151,7 +2368,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -2161,12 +2378,12 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ // Type for length arguments in socket calls. @@ -2185,7 +2402,7 @@ type Socklen_t = X__socklen_t /* socket.h:33:21 */ // Get the definition of the macro to define the common sockaddr members. // Definition of struct sockaddr_* common members and sizes, generic version. -// Copyright (C) 1995-2018 Free Software Foundation, Inc. +// Copyright (C) 1995-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2200,7 +2417,7 @@ type Socklen_t = X__socklen_t /* socket.h:33:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -2216,17 +2433,17 @@ type Sa_family_t = uint16 /* sockaddr.h:28:28 */ // Structure describing a generic socket address. type Sockaddr = struct { Fsa_family Sa_family_t - Fsa_data [14]int8 -} /* socket.h:175:1 */ + Fsa_data [14]uint8 +} /* socket.h:178:1 */ // Structure large enough to hold any socket address (with the historical // exception of AF_UNIX). type Sockaddr_storage = struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 -} /* socket.h:188:1 */ +} /* socket.h:191:1 */ // Structure describing messages sent by // `sendmsg' and received by `recvmsg'. @@ -2240,7 +2457,7 @@ type Msghdr = struct { Fmsg_controllen Size_t Fmsg_flags int32 _ [4]byte -} /* socket.h:254:1 */ +} /* socket.h:257:1 */ // Structure used for storage of ancillary data object information. type Cmsghdr = struct { @@ -2248,15 +2465,105 @@ type Cmsghdr = struct { Fcmsg_len Size_t Fcmsg_level int32 Fcmsg_type int32 -} /* socket.h:272:1 */ +} /* socket.h:275:1 */ -// Ugly workaround for unclean kernel headers. +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// This allows for 1024 file descriptors: if NR_OPEN is ever grown +// beyond that you'll have to change this too. But 1024 fd's seem to be +// enough even for such "real" unices like OSF/1, so hopefully this is +// one limit that doesn't have to be changed [again]. +// +// Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in +// (and thus ) - but this is a more logical +// place for them. Solved by having dummy defines in . + +// This macro may have been defined in . But we always +// use the one here. + +type X__kernel_fd_set = struct{ Ffds_bits [16]uint64 } /* posix_types.h:27:3 */ + +// Type of a signal handler. +type X__kernel_sighandler_t = uintptr /* posix_types.h:30:14 */ + +// Type of a SYSV IPC key. +type X__kernel_key_t = int32 /* posix_types.h:33:13 */ +type X__kernel_mqd_t = int32 /* posix_types.h:34:13 */ -// Get socket manipulation related informations from kernel headers. // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note // S390 version // -// Derived from "include/asm-i386/socket.h" + +// This file is generally used by user-level software, so you need to +// be a little careful about namespace pollution etc. Also, we cannot +// assume GCC is being used. + +type X__kernel_size_t = uint64 /* posix_types.h:16:25 */ +type X__kernel_ssize_t = int64 /* posix_types.h:17:25 */ + +type X__kernel_old_dev_t = uint16 /* posix_types.h:20:24 */ + +type X__kernel_ino_t = uint32 /* posix_types.h:35:25 */ +type X__kernel_mode_t = uint32 /* posix_types.h:36:25 */ +type X__kernel_ipc_pid_t = int32 /* posix_types.h:37:25 */ +type X__kernel_uid_t = uint32 /* posix_types.h:38:25 */ +type X__kernel_gid_t = uint32 /* posix_types.h:39:25 */ +type X__kernel_ptrdiff_t = int64 /* posix_types.h:40:25 */ +type X__kernel_sigset_t = uint64 /* posix_types.h:41:25 */ // at least 32 bits + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// There seems to be no way of detecting this automatically from user +// space, so 64 bit architectures should override this in their +// bitsperlong.h. In particular, an architecture that supports +// both 32 and 64 bit user space must not rely on CONFIG_64BIT +// to decide it, but rather check a compiler provided macro. + +// This file is generally used by user-level software, so you need to +// be a little careful about namespace pollution etc. +// +// First the types that are often defined in different ways across +// architectures, so that you can override them. + +type X__kernel_long_t = int64 /* posix_types.h:15:15 */ +type X__kernel_ulong_t = uint64 /* posix_types.h:16:23 */ + +type X__kernel_pid_t = int32 /* posix_types.h:28:14 */ + +type X__kernel_suseconds_t = X__kernel_long_t /* posix_types.h:41:26 */ + +type X__kernel_daddr_t = int32 /* posix_types.h:45:14 */ + +type X__kernel_uid32_t = uint32 /* posix_types.h:49:22 */ +type X__kernel_gid32_t = uint32 /* posix_types.h:50:22 */ + +type X__kernel_old_uid_t = X__kernel_uid_t /* posix_types.h:54:24 */ +type X__kernel_old_gid_t = X__kernel_gid_t /* posix_types.h:55:24 */ + +// Most 32 bit architectures use "unsigned int" size_t, +// and all 64 bit architectures use "unsigned long" size_t. + +type X__kernel_fsid_t = struct{ Fval [2]int32 } /* posix_types.h:81:3 */ + +// anything below here should be completely generic +type X__kernel_off_t = X__kernel_long_t /* posix_types.h:87:25 */ +type X__kernel_loff_t = int64 /* posix_types.h:88:19 */ +type X__kernel_time_t = X__kernel_long_t /* posix_types.h:89:25 */ +type X__kernel_time64_t = int64 /* posix_types.h:90:19 */ +type X__kernel_clock_t = X__kernel_long_t /* posix_types.h:91:25 */ +type X__kernel_timer_t = int32 /* posix_types.h:92:14 */ +type X__kernel_clockid_t = int32 /* posix_types.h:93:14 */ +type X__kernel_caddr_t = uintptr /* posix_types.h:94:14 */ +type X__kernel_uid16_t = uint16 /* posix_types.h:95:24 */ +type X__kernel_gid16_t = uint16 /* posix_types.h:96:24 */ // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note @@ -2270,11 +2577,13 @@ type Cmsghdr = struct { // Instruct lower device to use last 4-bytes of skb data as FCS +// on 64-bit and x32, avoid the ?: operator + // Structure used to manipulate the SO_LINGER option. type Linger = struct { Fl_onoff int32 Fl_linger int32 -} /* socket.h:444:1 */ +} /* socket.h:361:1 */ // This is the 4.3 BSD `struct sockaddr' format, which is used as wire // format in the grotty old 4.3 `talk' protocol. @@ -2286,7 +2595,7 @@ type Osockaddr = struct { // Define some macros helping to catch buffer overflows. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2301,7 +2610,7 @@ type Osockaddr = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -2310,7 +2619,7 @@ type In_addr_t = Uint32_t /* in.h:30:18 */ type In_addr = struct{ Fs_addr In_addr_t } /* in.h:31:1 */ // Get system-specific definitions. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -2325,7 +2634,7 @@ type In_addr = struct{ Fs_addr In_addr_t } /* in.h:31:1 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Linux version. @@ -2358,7 +2667,7 @@ type In_addr = struct{ Fs_addr In_addr_t } /* in.h:31:1 */ // source route (this gets put into the header proper). type Ip_opts = struct { Fip_dst struct{ Fs_addr In_addr_t } - Fip_opts [40]int8 + Fip_opts [40]uint8 } /* in.h:142:1 */ // Like `struct ip_mreq' but including interface specification by index. @@ -2398,7 +2707,7 @@ type In6_addr = struct { _ [0]uint32 F__u6_addr8 [16]Uint8_t } -} /* in.h:211:1 */ +} /* in.h:212:1 */ // ::1 @@ -2408,7 +2717,7 @@ type Sockaddr_in = struct { Fsin_port In_port_t Fsin_addr struct{ Fs_addr In_addr_t } Fsin_zero [8]uint8 -} /* in.h:237:1 */ +} /* in.h:238:1 */ // Ditto, for IPv6. type Sockaddr_in6 = struct { @@ -2422,19 +2731,19 @@ type Sockaddr_in6 = struct { } } Fsin6_scope_id Uint32_t -} /* in.h:252:1 */ +} /* in.h:253:1 */ // IPv4 multicast request. type Ip_mreq = struct { Fimr_multiaddr struct{ Fs_addr In_addr_t } Fimr_interface struct{ Fs_addr In_addr_t } -} /* in.h:264:1 */ +} /* in.h:265:1 */ type Ip_mreq_source = struct { Fimr_multiaddr struct{ Fs_addr In_addr_t } Fimr_interface struct{ Fs_addr In_addr_t } Fimr_sourceaddr struct{ Fs_addr In_addr_t } -} /* in.h:273:1 */ +} /* in.h:274:1 */ // Likewise, for IPv6. type Ipv6_mreq = struct { @@ -2445,7 +2754,7 @@ type Ipv6_mreq = struct { } } Fipv6mr_interface uint32 -} /* in.h:288:1 */ +} /* in.h:289:1 */ // Multicast group request. type Group_req = struct { @@ -2453,25 +2762,25 @@ type Group_req = struct { _ [4]byte Fgr_group struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } -} /* in.h:300:1 */ +} /* in.h:301:1 */ type Group_source_req = struct { Fgsr_interface Uint32_t _ [4]byte Fgsr_group struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } Fgsr_source struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } -} /* in.h:309:1 */ +} /* in.h:310:1 */ // Full-state filter operations. type Ip_msfilter = struct { @@ -2480,23 +2789,23 @@ type Ip_msfilter = struct { Fimsf_fmode Uint32_t Fimsf_numsrc Uint32_t Fimsf_slist [1]struct{ Fs_addr In_addr_t } -} /* in.h:323:1 */ +} /* in.h:324:1 */ type Group_filter = struct { Fgf_interface Uint32_t _ [4]byte Fgf_group struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } Fgf_fmode Uint32_t Fgf_numsrc Uint32_t Fgf_slist [1]struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 } -} /* in.h:344:1 */ +} /* in.h:345:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/netinet/in/in_netbsd_amd64.go b/vendor/modernc.org/libc/netinet/in/in_netbsd_amd64.go new file mode 100644 index 00000000..8db92f77 --- /dev/null +++ b/vendor/modernc.org/libc/netinet/in/in_netbsd_amd64.go @@ -0,0 +1,2960 @@ +// Code generated by 'ccgo netinet/in/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o netinet/in/in_netbsd_amd64.go -pkgname in', DO NOT EDIT. + +package in + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AF_APPLETALK = 16 + AF_ARP = 28 + AF_BLUETOOTH = 31 + AF_CAN = 35 + AF_CCITT = 10 + AF_CHAOS = 5 + AF_CNT = 21 + AF_COIP = 20 + AF_DATAKIT = 9 + AF_DECnet = 12 + AF_DLI = 13 + AF_E164 = 26 + AF_ECMA = 8 + AF_ETHER = 36 + AF_HYLINK = 15 + AF_IEEE80211 = 32 + AF_IMPLINK = 3 + AF_INET = 2 + AF_INET6 = 24 + AF_IPX = 23 + AF_ISDN = 26 + AF_ISO = 7 + AF_LAT = 14 + AF_LINK = 18 + AF_LOCAL = 1 + AF_MAX = 37 + AF_MPLS = 33 + AF_NATM = 27 + AF_NS = 6 + AF_OROUTE = 17 + AF_OSI = 7 + AF_PUP = 4 + AF_ROUTE = 34 + AF_SNA = 11 + AF_UNIX = 1 + AF_UNSPEC = 0 + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + CTL_IPPROTO_IPSEC = 258 + FD_SETSIZE = 256 + ICMP6_FILTER = 18 + INET6_ADDRSTRLEN = 46 + INET6_IS_ADDR_LINKLOCAL = 1 + INET6_IS_ADDR_MC_LINKLOCAL = 2 + INET6_IS_ADDR_SITELOCAL = 4 + INET_ADDRSTRLEN = 16 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + IN_CLASSA_MAX = 128 + IN_CLASSA_NSHIFT = 24 + IN_CLASSB_MAX = 65536 + IN_CLASSB_NSHIFT = 16 + IN_CLASSC_NSHIFT = 8 + IN_CLASSD_NSHIFT = 28 + IN_LOOPBACKNET = 127 + IPCTL_ALLOWSRCRT = 7 + IPCTL_ANONPORTMAX = 11 + IPCTL_ANONPORTMIN = 10 + IPCTL_CHECKINTERFACE = 20 + IPCTL_DAD_COUNT = 25 + IPCTL_DEFTTL = 3 + IPCTL_DIRECTEDBCAST = 6 + IPCTL_FORWARDING = 1 + IPCTL_FORWSRCRT = 5 + IPCTL_GIF_TTL = 15 + IPCTL_GRE_TTL = 19 + IPCTL_HOSTZEROBROADCAST = 14 + IPCTL_IFQ = 21 + IPCTL_LOOPBACKCKSUM = 23 + IPCTL_LOWPORTMAX = 17 + IPCTL_LOWPORTMIN = 16 + IPCTL_MAXFLOWS = 13 + IPCTL_MAXFRAGPACKETS = 18 + IPCTL_MTUDISC = 9 + IPCTL_MTUDISCTIMEOUT = 12 + IPCTL_RANDOMID = 22 + IPCTL_SENDREDIRECTS = 2 + IPCTL_STATS = 24 + IPCTL_SUBNETSARELOCAL = 8 + IPPORT_ANONMAX = 65535 + IPPORT_ANONMIN = 49152 + IPPORT_RESERVED = 1024 + IPPORT_RESERVEDMAX = 1023 + IPPORT_RESERVEDMIN = 600 + IPPROTO_AH = 51 + IPPROTO_CARP = 112 + IPPROTO_DCCP = 33 + IPPROTO_DONE = 257 + IPPROTO_DSTOPTS = 60 + IPPROTO_EGP = 8 + IPPROTO_ENCAP = 98 + IPPROTO_EON = 80 + IPPROTO_ESP = 50 + IPPROTO_ETHERIP = 97 + IPPROTO_FRAGMENT = 44 + IPPROTO_GGP = 3 + IPPROTO_GRE = 47 + IPPROTO_HOPOPTS = 0 + IPPROTO_ICMP = 1 + IPPROTO_ICMPV6 = 58 + IPPROTO_IDP = 22 + IPPROTO_IGMP = 2 + IPPROTO_IP = 0 + IPPROTO_IPCOMP = 108 + IPPROTO_IPIP = 4 + IPPROTO_IPV4 = 4 + IPPROTO_IPV6 = 41 + IPPROTO_IPV6_ICMP = 58 + IPPROTO_L2TP = 115 + IPPROTO_MAX = 256 + IPPROTO_MOBILE = 55 + IPPROTO_NONE = 59 + IPPROTO_PFSYNC = 240 + IPPROTO_PIM = 103 + IPPROTO_PUP = 12 + IPPROTO_RAW = 255 + IPPROTO_ROUTING = 43 + IPPROTO_RSVP = 46 + IPPROTO_SCTP = 132 + IPPROTO_TCP = 6 + IPPROTO_TP = 29 + IPPROTO_UDP = 17 + IPPROTO_VRRP = 112 + IPV6CTL_ACCEPT_RTADV = 12 + IPV6CTL_ADDRCTLPOLICY = 38 + IPV6CTL_ANONPORTMAX = 29 + IPV6CTL_ANONPORTMIN = 28 + IPV6CTL_AUTO_FLOWLABEL = 17 + IPV6CTL_AUTO_LINKLOCAL = 35 + IPV6CTL_DAD_COUNT = 16 + IPV6CTL_DEFHLIM = 3 + IPV6CTL_DEFMCASTHLIM = 18 + IPV6CTL_FORWARDING = 1 + IPV6CTL_FORWSRCRT = 5 + IPV6CTL_GIF_HLIM = 19 + IPV6CTL_HDRNESTLIMIT = 15 + IPV6CTL_IFQ = 42 + IPV6CTL_KAME_VERSION = 20 + IPV6CTL_KEEPFAITH = 13 + IPV6CTL_LOG_INTERVAL = 14 + IPV6CTL_LOWPORTMAX = 31 + IPV6CTL_LOWPORTMIN = 30 + IPV6CTL_MAXFRAGPACKETS = 9 + IPV6CTL_MAXFRAGS = 41 + IPV6CTL_MRTPROTO = 8 + IPV6CTL_MRTSTATS = 7 + IPV6CTL_RR_PRUNE = 22 + IPV6CTL_RTADV_MAXROUTES = 43 + IPV6CTL_RTADV_NUMROUTES = 44 + IPV6CTL_SENDREDIRECTS = 2 + IPV6CTL_SOURCECHECK = 10 + IPV6CTL_SOURCECHECK_LOGINT = 11 + IPV6CTL_STATS = 6 + IPV6CTL_USE_DEFAULTZONE = 39 + IPV6CTL_USE_DEPRECATED = 21 + IPV6CTL_V6ONLY = 24 + IPV6PORT_ANONMAX = 65535 + IPV6PORT_ANONMIN = 49152 + IPV6PORT_RESERVED = 1024 + IPV6PORT_RESERVEDMAX = 1023 + IPV6PORT_RESERVEDMIN = 600 + IPV6_CHECKSUM = 26 + IPV6_DEFAULT_MULTICAST_HOPS = 1 + IPV6_DEFAULT_MULTICAST_LOOP = 1 + IPV6_DONTFRAG = 62 + IPV6_DSTOPTS = 50 + IPV6_FAITH = 29 + IPV6_HOPLIMIT = 47 + IPV6_HOPOPTS = 49 + IPV6_IPSEC_POLICY = 28 + IPV6_JOIN_GROUP = 12 + IPV6_LEAVE_GROUP = 13 + IPV6_MULTICAST_HOPS = 10 + IPV6_MULTICAST_IF = 9 + IPV6_MULTICAST_LOOP = 11 + IPV6_NEXTHOP = 48 + IPV6_PATHMTU = 44 + IPV6_PKTINFO = 46 + IPV6_PORTALGO = 17 + IPV6_PORTRANGE = 14 + IPV6_PORTRANGE_DEFAULT = 0 + IPV6_PORTRANGE_HIGH = 1 + IPV6_PORTRANGE_LOW = 2 + IPV6_PREFER_TEMPADDR = 63 + IPV6_RECVDSTOPTS = 40 + IPV6_RECVHOPLIMIT = 37 + IPV6_RECVHOPOPTS = 39 + IPV6_RECVPATHMTU = 43 + IPV6_RECVPKTINFO = 36 + IPV6_RECVRTHDR = 38 + IPV6_RECVTCLASS = 57 + IPV6_RTHDR = 51 + IPV6_RTHDRDSTOPTS = 35 + IPV6_RTHDR_LOOSE = 0 + IPV6_RTHDR_STRICT = 1 + IPV6_RTHDR_TYPE_0 = 0 + IPV6_SOCKOPT_RESERVED1 = 3 + IPV6_TCLASS = 61 + IPV6_UNICAST_HOPS = 4 + IPV6_USE_MIN_MTU = 42 + IPV6_V6ONLY = 27 + IP_ADD_MEMBERSHIP = 12 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DROP_MEMBERSHIP = 13 + IP_ERRORMTU = 21 + IP_HDRINCL = 2 + IP_IPSEC_POLICY = 22 + IP_MAX_MEMBERSHIPS = 20 + IP_MINTTL = 24 + IP_MULTICAST_IF = 9 + IP_MULTICAST_LOOP = 11 + IP_MULTICAST_TTL = 10 + IP_OPTIONS = 1 + IP_PKTINFO = 25 + IP_PORTALGO = 18 + IP_PORTRANGE = 19 + IP_PORTRANGE_DEFAULT = 0 + IP_PORTRANGE_HIGH = 1 + IP_PORTRANGE_LOW = 2 + IP_RECVDSTADDR = 7 + IP_RECVIF = 20 + IP_RECVOPTS = 5 + IP_RECVPKTINFO = 26 + IP_RECVRETOPTS = 6 + IP_RECVTTL = 23 + IP_RETOPTS = 8 + IP_SENDSRCADDR = 7 + IP_TOS = 3 + IP_TTL = 4 + LITTLE_ENDIAN = 1234 + MSG_BCAST = 0x0100 + MSG_CMSG_CLOEXEC = 0x0800 + MSG_CONTROLMBUF = 0x2000000 + MSG_CTRUNC = 0x0020 + MSG_DONTROUTE = 0x0004 + MSG_DONTWAIT = 0x0080 + MSG_EOR = 0x0008 + MSG_IOVUSRSPACE = 0x4000000 + MSG_LENUSRSPACE = 0x8000000 + MSG_MCAST = 0x0200 + MSG_NAMEMBUF = 0x1000000 + MSG_NBIO = 0x1000 + MSG_NOSIGNAL = 0x0400 + MSG_NOTIFICATION = 0x4000 + MSG_OOB = 0x0001 + MSG_PEEK = 0x0002 + MSG_TRUNC = 0x0010 + MSG_USERFLAGS = 0x0ffffff + MSG_WAITALL = 0x0040 + MSG_WAITFORONE = 0x2000 + NBBY = 8 + NET_RT_DUMP = 1 + NET_RT_FLAGS = 2 + NET_RT_IFLIST = 6 + NET_RT_OIFLIST = 5 + NET_RT_OOIFLIST = 4 + NET_RT_OOOIFLIST = 3 + NFDBITS = 32 + NODEVMAJOR = -1 + PCB_ALL = 0 + PCB_SLOP = 20 + PDP_ENDIAN = 3412 + PF_APPLETALK = 16 + PF_ARP = 28 + PF_BLUETOOTH = 31 + PF_CAN = 35 + PF_CCITT = 10 + PF_CHAOS = 5 + PF_CNT = 21 + PF_COIP = 20 + PF_DATAKIT = 9 + PF_DECnet = 12 + PF_DLI = 13 + PF_E164 = 26 + PF_ECMA = 8 + PF_ETHER = 36 + PF_HYLINK = 15 + PF_IMPLINK = 3 + PF_INET = 2 + PF_INET6 = 24 + PF_IPX = 23 + PF_ISDN = 26 + PF_ISO = 7 + PF_KEY = 29 + PF_LAT = 14 + PF_LINK = 18 + PF_LOCAL = 1 + PF_MAX = 37 + PF_MPLS = 33 + PF_NATM = 27 + PF_NS = 6 + PF_OROUTE = 17 + PF_OSI = 7 + PF_PIP = 25 + PF_PUP = 4 + PF_ROUTE = 34 + PF_RTIP = 22 + PF_SNA = 11 + PF_UNIX = 1 + PF_UNSPEC = 0 + PF_XTP = 19 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SCM_CREDS = 0x10 + SCM_RIGHTS = 0x01 + SCM_TIMESTAMP = 0x08 + SHUT_RD = 0 + SHUT_RDWR = 2 + SHUT_WR = 1 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIN6_LEN = 0 + SIZE_MAX = 18446744073709551615 + SOCK_CLOEXEC = 0x10000000 + SOCK_CONN_DGRAM = 6 + SOCK_DCCP = 6 + SOCK_DGRAM = 2 + SOCK_FLAGS_MASK = 0xf0000000 + SOCK_NONBLOCK = 0x20000000 + SOCK_NOSIGPIPE = 0x40000000 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 + SOCK_STREAM = 1 + SOL_SOCKET = 0xffff + SOMAXCONN = 128 + SO_ACCEPTCONN = 0x0002 + SO_ACCEPTFILTER = 0x1000 + SO_BROADCAST = 0x0020 + SO_DEBUG = 0x0001 + SO_DEFOPTS = 27645 + SO_DONTROUTE = 0x0010 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x0008 + SO_LINGER = 0x0080 + SO_NOHEADER = 0x100a + SO_NOSIGPIPE = 0x0800 + SO_OOBINLINE = 0x0100 + SO_OVERFLOWED = 0x1009 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x100c + SO_RERROR = 0x4000 + SO_REUSEADDR = 0x0004 + SO_REUSEPORT = 0x0200 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x100b + SO_TIMESTAMP = 0x2000 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x0040 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + UIO_MAXIOV = 1024 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_NETINET6_IN6_H_ = 0 + X_NETINET_IN_H_ = 0 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SS_MAXSIZE = 128 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_SOCKET_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS_UIO_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 + Pseudo_AF_HDRCMPLT = 30 + Pseudo_AF_KEY = 29 + Pseudo_AF_PIP = 25 + Pseudo_AF_RTIP = 22 + Pseudo_AF_XTP = 19 +) + +// file offset + +const ( /* uio.h:69:1: */ + UIO_READ = 0 + UIO_WRITE = 1 +) + +// Segment flag values. +const ( /* uio.h:72:1: */ + UIO_USERSPACE = 0 // from user data space + UIO_SYSSPACE = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// $NetBSD: in.h,v 1.108 2018/11/09 11:46:28 maya Exp $ + +// Copyright (c) 1982, 1986, 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)in.h 8.3 (Berkeley) 1/3/94 + +// Constants and structures defined by the internet system, +// Per RFC 790, September 1981, and numerous additions. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type Uint8_t = X__uint8_t /* in.h:46:19 */ + +type Uint32_t = X__uint32_t /* in.h:51:20 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type In_addr_t = X__in_addr_t /* in.h:58:21 */ + +type In_port_t = X__in_port_t /* in.h:63:21 */ + +type Sa_family_t = X__sa_family_t /* in.h:68:23 */ + +// Protocols + +// last return value of *_input(), meaning "all job for this pkt is done". + +// sysctl placeholder for (FAST_)IPSEC + +// Local port number conventions: +// +// Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), +// unless a kernel is compiled with IPNOPRIVPORTS defined. +// +// When a user does a bind(2) or connect(2) with a port number of zero, +// a non-conflicting local port address is chosen. +// +// The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although +// that is settable by sysctl(3); net.inet.ip.anonportmin and +// net.inet.ip.anonportmax respectively. +// +// A user may set the IPPROTO_IP option IP_PORTRANGE to change this +// default assignment range. +// +// The value IP_PORTRANGE_DEFAULT causes the default behavior. +// +// The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, +// and exists only for FreeBSD compatibility purposes. +// +// The value IP_PORTRANGE_LOW changes the range to the "low" are +// that is (by convention) restricted to privileged processes. +// This convention is based on "vouchsafe" principles only. +// It is only secure if you trust the remote host to restrict these ports. +// The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. + +// Internet address (a structure for historical reasons) +type In_addr = struct{ Fs_addr X__in_addr_t } /* in.h:158:1 */ + +// Definitions of bits in internet address integers. +// On subnets, the decomposition of addresses to host and net parts +// is done according to subnet mask, not the masks here. +// +// By byte-swapping the constants, we avoid ever having to byte-swap IP +// addresses inside the kernel. Unfortunately, user-level programs rely +// on these macros not doing byte-swapping. + +// These ones aren't really net and host fields, but routing needn't know. + +// Socket address, internet style. +type Sockaddr_in = struct { + Fsin_len Uint8_t + Fsin_family X__sa_family_t + Fsin_port X__in_port_t + Fsin_addr struct{ Fs_addr X__in_addr_t } + Fsin_zero [8]X__int8_t +} /* in.h:241:1 */ + +// Structure used to describe IP options. +// Used to store options internally, to pass them to a process, +// or to restore options retrieved earlier. +// The ip_dst is used for the first-hop gateway when using a source route +// (this gets put into the header proper). +type Ip_opts = struct { + Fip_dst struct{ Fs_addr X__in_addr_t } + Fip_opts [40]X__int8_t +} /* in.h:258:1 */ + +// Options for use with [gs]etsockopt at the IP level. +// First word of comment is data type; bool is stored in int. +// The add and drop membership option numbers need to match with the v6 ones + +// Information sent in the control message of a datagram socket for +// IP_PKTINFO and IP_RECVPKTINFO. +type In_pktinfo = struct { + Fipi_addr struct{ Fs_addr X__in_addr_t } + Fipi_ifindex uint32 +} /* in.h:301:1 */ + +// Defaults and limits for options + +// Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. +type Ip_mreq = struct { + Fimr_multiaddr struct{ Fs_addr X__in_addr_t } + Fimr_interface struct{ Fs_addr X__in_addr_t } +} /* in.h:318:1 */ + +// Argument for IP_PORTRANGE: +// - which range to search when port is unspecified at bind() or connect() + +// Definitions for inet sysctl operations. +// +// Third level is protocol number. +// Fourth level is desired variable within that protocol. + +// Names for IP sysctl objects +// IPCTL_DEFMTU=4, never implemented + +// INET6 stuff +// $NetBSD: in6.h,v 1.95.2.1 2019/09/06 19:43:00 martin Exp $ +// $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ + +// Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the project nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. + +// Copyright (c) 1982, 1986, 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)in.h 8.3 (Berkeley) 1/3/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: socket.h,v 1.129 2018/11/04 16:30:29 christos Exp $ + +// Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the project nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. + +// Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)socket.h 8.6 (Berkeley) 5/3/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions related to sockets: types, address families, options. + +// Data types. +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Socklen_t = X__socklen_t /* socket.h:83:21 */ + +type Ssize_t = int64 /* socket.h:95:23 */ + +// $NetBSD: uio.h,v 1.36 2011/07/27 13:20:07 uebayasi Exp $ + +// Copyright (c) 1982, 1986, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)uio.h 8.5 (Berkeley) 2/22/94 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +type Iovec = struct { + Fiov_base uintptr + Fiov_len Size_t +} /* uio.h:56:1 */ + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Off_t = X__off_t /* uio.h:65:18 */ + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ + +// Socket types. + +// Option flags per-socket. +// SO_OTIMESTAMP 0x0400 + +// Allowed default option flags + +// Additional options, not kept in so_options. +// SO_OSNDTIMEO 0x1005 +// SO_ORCVTIMEO 0x1006 + +// Structure used for manipulating linger option. +type Linger = struct { + Fl_onoff int32 + Fl_linger int32 +} /* socket.h:182:1 */ + +type Accept_filter_arg = struct { + Faf_name [16]int8 + Faf_arg [240]int8 +} /* socket.h:187:1 */ + +// Level number for (get/set)sockopt() to apply to socket itself. + +// Address families. + +// Structure used by kernel to store most +// addresses. +type Sockaddr = struct { + Fsa_len X__uint8_t + Fsa_family X__sa_family_t + Fsa_data [14]int8 +} /* socket.h:255:1 */ + +// RFC 2553: protocol-independent placeholder for socket addresses + +type Sockaddr_storage = struct { + Fss_len X__uint8_t + Fss_family X__sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 +} /* socket.h:301:1 */ + +// Protocol families, same as address families for now. + +type Pid_t = X__pid_t /* socket.h:366:18 */ // process id + +type Gid_t = X__gid_t /* socket.h:371:18 */ // group id + +type Uid_t = X__uid_t /* socket.h:376:18 */ // user id + +// Socket credentials. +type Sockcred = struct { + Fsc_pid X__pid_t + Fsc_uid X__uid_t + Fsc_euid X__uid_t + Fsc_gid X__gid_t + Fsc_egid X__gid_t + Fsc_ngroups int32 + Fsc_groups [1]X__gid_t +} /* socket.h:383:1 */ + +// Compute size of a sockcred structure with groups. + +// Definition for CTL_NET PCB fetching sysctls +type Kinfo_pcb = struct { + Fki_pcbaddr X__uint64_t + Fki_ppcbaddr X__uint64_t + Fki_sockaddr X__uint64_t + Fki_family X__uint32_t + Fki_type X__uint32_t + Fki_protocol X__uint32_t + Fki_pflags X__uint32_t + Fki_sostate X__uint32_t + Fki_prstate X__uint32_t + Fki_tstate X__int32_t + Fki_tflags X__uint32_t + Fki_rcvq X__uint64_t + Fki_sndq X__uint64_t + Fki_s struct { + F_kis_src struct { + Fsa_len X__uint8_t + Fsa_family X__sa_family_t + Fsa_data [14]int8 + } + _ [248]byte + } + Fki_d struct { + F_kid_dst struct { + Fsa_len X__uint8_t + Fsa_family X__sa_family_t + Fsa_data [14]int8 + } + _ [248]byte + } + Fki_inode X__uint64_t + Fki_vnode X__uint64_t + Fki_conn X__uint64_t + Fki_refs X__uint64_t + Fki_nextref X__uint64_t +} /* socket.h:404:1 */ + +// PF_ROUTE - Routing table +// +// Three additional levels are defined: +// Fourth: address family, 0 is wildcard +// Fifth: type of info, defined below +// Sixth: flag(s) to mask with for NET_RT_FLAGS + +// Maximum queue length specifiable by listen(2). + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// Message header for recvmsg and sendmsg calls. +// Used value-result for recvmsg, value only for sendmsg. +type Msghdr = struct { + Fmsg_name uintptr + Fmsg_namelen X__socklen_t + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_control uintptr + Fmsg_controllen X__socklen_t + Fmsg_flags int32 +} /* socket.h:479:1 */ + +type Mmsghdr = struct { + Fmsg_hdr struct { + Fmsg_name uintptr + Fmsg_namelen X__socklen_t + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_control uintptr + Fmsg_controllen X__socklen_t + Fmsg_flags int32 + } + Fmsg_len uint32 + _ [4]byte +} /* socket.h:506:1 */ + +// Extra flags used internally only + +// Header for ancillary data objects in msg_control buffer. +// Used for additional information with/about a datagram +// not expressible by flags. The format is a sequence +// of message elements headed by cmsghdr structures. +type Cmsghdr = struct { + Fcmsg_len X__socklen_t + Fcmsg_level int32 + Fcmsg_type int32 +} /* socket.h:525:1 */ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +// Identification of the network protocol stack +// for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE +// has the table of implementation/integration differences. + +// Local port number conventions: +// +// Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), +// unless a kernel is compiled with IPNOPRIVPORTS defined. +// +// When a user does a bind(2) or connect(2) with a port number of zero, +// a non-conflicting local port address is chosen. +// +// The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although +// that is settable by sysctl(3); net.inet.ip.anonportmin and +// net.inet.ip.anonportmax respectively. +// +// A user may set the IPPROTO_IP option IP_PORTRANGE to change this +// default assignment range. +// +// The value IP_PORTRANGE_DEFAULT causes the default behavior. +// +// The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, +// and exists only for FreeBSD compatibility purposes. +// +// The value IP_PORTRANGE_LOW changes the range to the "low" are +// that is (by convention) restricted to privileged processes. +// This convention is based on "vouchsafe" principles only. +// It is only secure if you trust the remote host to restrict these ports. +// The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. + +// IPv6 address +type In6_addr = struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]X__uint8_t + } +} /* in6.h:123:1 */ + +// Socket address for IPv6 +type Sockaddr_in6 = struct { + Fsin6_len Uint8_t + Fsin6_family X__sa_family_t + Fsin6_port X__in_port_t + Fsin6_flowinfo Uint32_t + Fsin6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]X__uint8_t + } + } + Fsin6_scope_id Uint32_t +} /* in6.h:146:1 */ + +// Unspecified + +// Loopback + +// IPv4 compatible + +// Mapped + +// KAME Scope Values + +// Unicast Scope +// Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). + +// Multicast + +// Multicast Scope + +// Options for use with [gs]etsockopt at the IPV6 level. +// First word of comment is data type; bool is stored in int. +// no hdrincl +// The join and leave membership option numbers need to match with the v4 ones +// RFC2292 options + +// new socket options introduced in RFC3542 + +// more new socket options introduced in RFC3542 + +// to define items, should talk with KAME guys first, for *BSD compatibility + +// Defaults and limits for options + +// Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP. +type Ipv6_mreq = struct { + Fipv6mr_multiaddr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]X__uint8_t + } + } + Fipv6mr_interface uint32 +} /* in6.h:459:1 */ + +// IPV6_PKTINFO: Packet information(RFC2292 sec 5) +type In6_pktinfo = struct { + Fipi6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]X__uint8_t + } + } + Fipi6_ifindex uint32 +} /* in6.h:467:1 */ + +// Control structure for IPV6_RECVPATHMTU socket option. +type Ip6_mtuinfo = struct { + Fip6m_addr struct { + Fsin6_len Uint8_t + Fsin6_family X__sa_family_t + Fsin6_port X__in_port_t + Fsin6_flowinfo Uint32_t + Fsin6_addr struct { + F__u6_addr struct { + _ [0]uint32 + F__u6_addr8 [16]X__uint8_t + } + } + Fsin6_scope_id Uint32_t + } + Fip6m_mtu Uint32_t +} /* in6.h:475:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/nodmesg.go b/vendor/modernc.org/libc/nodmesg.go index d4524f52..92e494b2 100644 --- a/vendor/modernc.org/libc/nodmesg.go +++ b/vendor/modernc.org/libc/nodmesg.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !libc.dmesg // +build !libc.dmesg package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/nofsync.go b/vendor/modernc.org/libc/nofsync.go index 37d1db58..205c2af0 100644 --- a/vendor/modernc.org/libc/nofsync.go +++ b/vendor/modernc.org/libc/nofsync.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build libc.nofsync // +build libc.nofsync package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/nopthreads.go b/vendor/modernc.org/libc/nopthreads.go index 24943d39..ac46711f 100644 --- a/vendor/modernc.org/libc/nopthreads.go +++ b/vendor/modernc.org/libc/nopthreads.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !amd64 !linux +//go:build windows || darwin || (linux && arm) || (linux && s390x) || (linux && 386) || (linux && arm) || (linux && arm64) || (freebsd && amd64) || (netbsd && amd64) +// +build windows darwin linux,arm linux,s390x linux,386 linux,arm linux,arm64 freebsd,amd64 netbsd,amd64 package libc // import "modernc.org/libc" diff --git a/vendor/modernc.org/libc/poll/capi_darwin_amd64.go b/vendor/modernc.org/libc/poll/capi_darwin_amd64.go index d30e8f98..2589fc07 100644 --- a/vendor/modernc.org/libc/poll/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/poll/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_darwin_amd64.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_darwin_amd64.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/capi_freebsd_amd64.go b/vendor/modernc.org/libc/poll/capi_freebsd_amd64.go new file mode 100644 index 00000000..38c70d4f --- /dev/null +++ b/vendor/modernc.org/libc/poll/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_freebsd_amd64.go -pkgname poll', DO NOT EDIT. + +package poll + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/poll/capi_linux_386.go b/vendor/modernc.org/libc/poll/capi_linux_386.go index 1419ab87..e9770439 100644 --- a/vendor/modernc.org/libc/poll/capi_linux_386.go +++ b/vendor/modernc.org/libc/poll/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_386.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_386.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/capi_linux_amd64.go b/vendor/modernc.org/libc/poll/capi_linux_amd64.go index c1852edb..d5990792 100644 --- a/vendor/modernc.org/libc/poll/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/poll/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_amd64.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_amd64.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/capi_linux_arm.go b/vendor/modernc.org/libc/poll/capi_linux_arm.go index 7a022a47..4c537074 100644 --- a/vendor/modernc.org/libc/poll/capi_linux_arm.go +++ b/vendor/modernc.org/libc/poll/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/capi_linux_arm64.go b/vendor/modernc.org/libc/poll/capi_linux_arm64.go index 16504baf..9035dda6 100644 --- a/vendor/modernc.org/libc/poll/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/poll/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm64.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm64.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/capi_linux_s390x.go b/vendor/modernc.org/libc/poll/capi_linux_s390x.go index a3a1e9ea..36ce787e 100644 --- a/vendor/modernc.org/libc/poll/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/poll/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_s390x.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_s390x.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/capi_netbsd_amd64.go b/vendor/modernc.org/libc/poll/capi_netbsd_amd64.go new file mode 100644 index 00000000..1f0d73f7 --- /dev/null +++ b/vendor/modernc.org/libc/poll/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo poll/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_netbsd_amd64.go -pkgname poll', DO NOT EDIT. + +package poll + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/poll/poll_darwin_amd64.go b/vendor/modernc.org/libc/poll/poll_darwin_amd64.go index 87ec19a9..08f1916a 100644 --- a/vendor/modernc.org/libc/poll/poll_darwin_amd64.go +++ b/vendor/modernc.org/libc/poll/poll_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_darwin_amd64.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_darwin_amd64.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/poll_freebsd_amd64.go b/vendor/modernc.org/libc/poll/poll_freebsd_amd64.go new file mode 100644 index 00000000..ab3cd770 --- /dev/null +++ b/vendor/modernc.org/libc/poll/poll_freebsd_amd64.go @@ -0,0 +1,887 @@ +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_freebsd_amd64.go -pkgname poll', DO NOT EDIT. + +package poll + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + INFTIM = -1 + POLLERR = 0x0008 + POLLHUP = 0x0010 + POLLIN = 0x0001 + POLLINIGNEOF = 0x2000 + POLLNVAL = 0x0020 + POLLOUT = 0x0004 + POLLPRI = 0x0002 + POLLRDBAND = 0x0080 + POLLRDNORM = 0x0040 + POLLSTANDARD = 511 + POLLWRBAND = 0x0100 + POLLWRNORM = 4 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_SIGSET_T_DECLARED = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SYS_CDEFS_H_ = 0 + X_SYS_POLL_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIME_T_DECLARED = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1997 Peter Wemm +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// This file is intended to be compatible with the traditional poll.h. + +type Nfds_t = uint32 /* poll.h:42:22 */ + +// This structure is passed as an array to poll(2). +type Pollfd = struct { + Ffd int32 + Fevents int16 + Frevents int16 +} /* poll.h:47:1 */ + +// Requestable events. If poll(2) finds any of these set, they are +// copied to revents on return. +// XXX Note that FreeBSD doesn't make much distinction between POLLPRI +// and POLLRDBAND since none of the file types have distinct priority +// bands - and only some have an urgent "mode". +// XXX Note POLLIN isn't really supported in true SVSV terms. Under SYSV +// POLLIN includes all of normal, band and urgent data. Most poll handlers +// on FreeBSD only treat it as "normal" data. + +// General FreeBSD extension (currently only supported for sockets): + +// These events are set if they occur regardless of whether they were +// requested. + +// Request that poll() wait forever. +// XXX in SYSV, this is defined in stropts.h, which is not included +// by poll.h. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = X__sigset /* _sigset.h:55:3 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Time_t = X__time_t /* _timespec.h:42:18 */ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +type Sigset_t = X__sigset_t /* poll.h:108:20 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/poll/poll_linux_386.go b/vendor/modernc.org/libc/poll/poll_linux_386.go index c1da8ea3..c95e78b6 100644 --- a/vendor/modernc.org/libc/poll/poll_linux_386.go +++ b/vendor/modernc.org/libc/poll/poll_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_386.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_386.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/poll_linux_amd64.go b/vendor/modernc.org/libc/poll/poll_linux_amd64.go index cf88eb46..06f47b33 100644 --- a/vendor/modernc.org/libc/poll/poll_linux_amd64.go +++ b/vendor/modernc.org/libc/poll/poll_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_amd64.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_amd64.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/poll_linux_arm.go b/vendor/modernc.org/libc/poll/poll_linux_arm.go index 18213f02..747a1843 100644 --- a/vendor/modernc.org/libc/poll/poll_linux_arm.go +++ b/vendor/modernc.org/libc/poll/poll_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/poll_linux_arm64.go b/vendor/modernc.org/libc/poll/poll_linux_arm64.go index e895ad08..03ab7871 100644 --- a/vendor/modernc.org/libc/poll/poll_linux_arm64.go +++ b/vendor/modernc.org/libc/poll/poll_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm64.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_arm64.go -pkgname poll', DO NOT EDIT. package poll diff --git a/vendor/modernc.org/libc/poll/poll_linux_s390x.go b/vendor/modernc.org/libc/poll/poll_linux_s390x.go index 29ad3d57..054396d2 100644 --- a/vendor/modernc.org/libc/poll/poll_linux_s390x.go +++ b/vendor/modernc.org/libc/poll/poll_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_s390x.go -pkgname poll', DO NOT EDIT. +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_linux_s390x.go -pkgname poll', DO NOT EDIT. package poll @@ -58,7 +58,7 @@ type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ // Compatibility definitions for System V `poll' interface. -// Copyright (C) 1994-2018 Free Software Foundation, Inc. +// Copyright (C) 1994-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -73,9 +73,9 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -90,7 +90,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -98,6 +98,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -218,6 +219,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -240,9 +243,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -257,7 +273,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -270,7 +286,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -285,7 +301,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -400,7 +416,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -417,14 +433,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -439,7 +453,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -476,7 +490,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // Get the platform dependent bits of `poll'. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -491,7 +505,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Event types that can be polled for. These bits may be set in `events' // to indicate the interesting event types; they will appear in `revents' @@ -515,4 +529,4 @@ type Pollfd = struct { // Define some inlines helping to catch common problems. -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/poll/poll_netbsd_amd64.go b/vendor/modernc.org/libc/poll/poll_netbsd_amd64.go new file mode 100644 index 00000000..37a4b0cd --- /dev/null +++ b/vendor/modernc.org/libc/poll/poll_netbsd_amd64.go @@ -0,0 +1,351 @@ +// Code generated by 'ccgo poll/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o poll/poll_netbsd_amd64.go -pkgname poll', DO NOT EDIT. + +package poll + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + INFTIM = -1 + POLLERR = 0x0008 + POLLHUP = 0x0010 + POLLIN = 0x0001 + POLLNVAL = 0x0020 + POLLOUT = 0x0004 + POLLPRI = 0x0002 + POLLRDBAND = 0x0080 + POLLRDNORM = 0x0040 + POLLWRBAND = 0x0100 + POLLWRNORM = 4 + X_AMD64_INT_TYPES_H_ = 0 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_POLL_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// $NetBSD: poll.h,v 1.15 2009/11/11 09:48:51 rmind Exp $ + +// - +// Copyright (c) 1998 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Charles M. Hannum. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +type Nfds_t = uint32 /* poll.h:37:22 */ + +type Pollfd = struct { + Ffd int32 + Fevents int16 + Frevents int16 +} /* poll.h:39:1 */ + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/printf.go b/vendor/modernc.org/libc/printf.go index c755a537..fe67c747 100644 --- a/vendor/modernc.org/libc/printf.go +++ b/vendor/modernc.org/libc/printf.go @@ -42,9 +42,9 @@ func printf(format, args uintptr) []byte { case '%': format = printfConversion(buf, format, &args) case 0: - // if dmesgs { - // dmesg("%v: %q", origin(1), buf.Bytes()) - // } + if dmesgs { + dmesg("%v: %q", origin(1), buf.Bytes()) + } return buf.Bytes() default: format++ diff --git a/vendor/modernc.org/libc/pthread/capi_darwin_amd64.go b/vendor/modernc.org/libc/pthread/capi_darwin_amd64.go index 99caefd1..2fa8f0e2 100644 --- a/vendor/modernc.org/libc/pthread/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/pthread/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_darwin_amd64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_darwin_amd64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_freebsd_amd64.go b/vendor/modernc.org/libc/pthread/capi_freebsd_amd64.go new file mode 100644 index 00000000..6a08c0d4 --- /dev/null +++ b/vendor/modernc.org/libc/pthread/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_freebsd_amd64.go -pkgname pthread', DO NOT EDIT. + +package pthread + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/pthread/capi_linux_386.go b/vendor/modernc.org/libc/pthread/capi_linux_386.go index c5e46be7..1a78ab75 100644 --- a/vendor/modernc.org/libc/pthread/capi_linux_386.go +++ b/vendor/modernc.org/libc/pthread/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_386.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_386.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_linux_amd64.go b/vendor/modernc.org/libc/pthread/capi_linux_amd64.go index 0c94855a..ba3474e0 100644 --- a/vendor/modernc.org/libc/pthread/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/pthread/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_amd64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_amd64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_linux_arm.go b/vendor/modernc.org/libc/pthread/capi_linux_arm.go index a48241cd..a73c9846 100644 --- a/vendor/modernc.org/libc/pthread/capi_linux_arm.go +++ b/vendor/modernc.org/libc/pthread/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_linux_arm64.go b/vendor/modernc.org/libc/pthread/capi_linux_arm64.go index fa3ceec8..2569731b 100644 --- a/vendor/modernc.org/libc/pthread/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/pthread/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_linux_s390x.go b/vendor/modernc.org/libc/pthread/capi_linux_s390x.go index bc2814df..1e640b53 100644 --- a/vendor/modernc.org/libc/pthread/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/pthread/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_s390x.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_s390x.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_netbsd_amd64.go b/vendor/modernc.org/libc/pthread/capi_netbsd_amd64.go new file mode 100644 index 00000000..1d030ddd --- /dev/null +++ b/vendor/modernc.org/libc/pthread/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_netbsd_amd64.go -pkgname pthread', DO NOT EDIT. + +package pthread + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/pthread/capi_windows_386.go b/vendor/modernc.org/libc/pthread/capi_windows_386.go index a6518e0c..619b6d06 100644 --- a/vendor/modernc.org/libc/pthread/capi_windows_386.go +++ b/vendor/modernc.org/libc/pthread/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_386.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_386.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/capi_windows_amd64.go b/vendor/modernc.org/libc/pthread/capi_windows_amd64.go index 76663209..bf7df362 100644 --- a/vendor/modernc.org/libc/pthread/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/pthread/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_amd64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_amd64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_darwin_amd64.go b/vendor/modernc.org/libc/pthread/pthread_darwin_amd64.go index 8ae0f224..5d4a78e0 100644 --- a/vendor/modernc.org/libc/pthread/pthread_darwin_amd64.go +++ b/vendor/modernc.org/libc/pthread/pthread_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_darwin_amd64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_darwin_amd64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_freebsd_amd64.go b/vendor/modernc.org/libc/pthread/pthread_freebsd_amd64.go new file mode 100644 index 00000000..cb4f7633 --- /dev/null +++ b/vendor/modernc.org/libc/pthread/pthread_freebsd_amd64.go @@ -0,0 +1,1123 @@ +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_freebsd_amd64.go -pkgname pthread', DO NOT EDIT. + +package pthread + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + CLK_TCK = 128 + CLOCKS_PER_SEC = 128 + CLOCK_MONOTONIC = 4 + CLOCK_MONOTONIC_FAST = 12 + CLOCK_MONOTONIC_PRECISE = 11 + CLOCK_PROCESS_CPUTIME_ID = 15 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_REALTIME_FAST = 10 + CLOCK_REALTIME_PRECISE = 9 + CLOCK_SECOND = 13 + CLOCK_THREAD_CPUTIME_ID = 14 + CLOCK_UPTIME = 5 + CLOCK_UPTIME_FAST = 8 + CLOCK_UPTIME_PRECISE = 7 + CLOCK_VIRTUAL = 1 + PTHREAD_BARRIER_SERIAL_THREAD = -1 + PTHREAD_CANCEL_ASYNCHRONOUS = 2 + PTHREAD_CANCEL_DEFERRED = 0 + PTHREAD_CANCEL_DISABLE = 1 + PTHREAD_CANCEL_ENABLE = 0 + PTHREAD_CREATE_DETACHED = 1 + PTHREAD_CREATE_JOINABLE = 0 + PTHREAD_DESTRUCTOR_ITERATIONS = 4 + PTHREAD_DETACHED = 0x1 + PTHREAD_DONE_INIT = 1 + PTHREAD_EXPLICIT_SCHED = 0 + PTHREAD_INHERIT_SCHED = 0x4 + PTHREAD_KEYS_MAX = 256 + PTHREAD_MUTEX_ROBUST = 1 + PTHREAD_MUTEX_STALLED = 0 + PTHREAD_NEEDS_INIT = 0 + PTHREAD_NOFLOAT = 0x8 + PTHREAD_PRIO_INHERIT = 1 + PTHREAD_PRIO_NONE = 0 + PTHREAD_PRIO_PROTECT = 2 + PTHREAD_PROCESS_PRIVATE = 0 + PTHREAD_PROCESS_SHARED = 1 + PTHREAD_SCOPE_PROCESS = 0 + PTHREAD_SCOPE_SYSTEM = 0x2 + PTHREAD_STACK_MIN = 2048 + PTHREAD_THREADS_MAX = 18446744073709551615 + SCHED_FIFO = 1 + SCHED_OTHER = 2 + SCHED_RR = 3 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + X_CLOCKID_T_DECLARED = 0 + X_CLOCK_T_DECLARED = 0 + X_FILE_OFFSET_BITS = 64 + X_LOCALE_T_DEFINED = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PID_T_DECLARED = 0 + X_PTHREAD_H_ = 0 + X_PTHREAD_T_DECLARED = 0 + X_SCHED_H_ = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SIZE_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS__PTHREADTYPES_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIMER_T_DECLARED = 0 + X_TIME_H_ = 0 + X_TIME_T_DECLARED = 0 + X_XLOCALE_LOCALE1_H = 0 + Unix = 1 +) + +// Run-time invariant values: + +// Flags for threads and thread attributes. + +// Values for process shared/private attributes. + +// Flags for cancelling threads + +// Flags for once initialization. + +// Static once initialization values. + +// Static initialization values. + +// Default attribute arguments (draft 4, deprecated). + +// Mutex types (Single UNIX Specification, Version 2, 1997). +// +// Note that a mutex attribute with one of the following types: +// +// PTHREAD_MUTEX_NORMAL +// PTHREAD_MUTEX_RECURSIVE +// +// will deviate from POSIX specified semantics. +const ( /* pthread.h:130:1: */ + PTHREAD_MUTEX_ERRORCHECK = 1 // Default POSIX mutex + PTHREAD_MUTEX_RECURSIVE = 2 // Recursive mutex + PTHREAD_MUTEX_NORMAL = 3 // No error checking + PTHREAD_MUTEX_ADAPTIVE_NP = 4 // Adaptive mutex, spins briefly before blocking on lock + PTHREAD_MUTEX_TYPE_MAX = 5 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ +type Pthread_once = struct { + Fstate int32 + _ [4]byte + Fmutex Pthread_mutex_t +} /* _pthreadtypes.h:52:1 */ + +// Primitive system data type definitions required by P1003.1c. +// +// Note that P1003.1c specifies that there are no defined comparison +// or assignment operators for the types pthread_attr_t, pthread_cond_t, +// pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. +type Pthread_t = uintptr /* _pthreadtypes.h:67:26 */ +type Pthread_attr_t = uintptr /* _pthreadtypes.h:70:30 */ +type Pthread_mutex_t = uintptr /* _pthreadtypes.h:71:31 */ +type Pthread_mutexattr_t = uintptr /* _pthreadtypes.h:72:35 */ +type Pthread_cond_t = uintptr /* _pthreadtypes.h:73:30 */ +type Pthread_condattr_t = uintptr /* _pthreadtypes.h:74:34 */ +type Pthread_key_t = int32 /* _pthreadtypes.h:75:20 */ +type Pthread_once_t = Pthread_once /* _pthreadtypes.h:76:30 */ +type Pthread_rwlock_t = uintptr /* _pthreadtypes.h:77:32 */ +type Pthread_rwlockattr_t = uintptr /* _pthreadtypes.h:78:35 */ +type Pthread_barrier_t = uintptr /* _pthreadtypes.h:79:33 */ +type Pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */ +type Pthread_spinlock_t = uintptr /* _pthreadtypes.h:81:33 */ + +// Additional type definitions: +// +// Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for +// use in header symbols. +type Pthread_addr_t = uintptr /* _pthreadtypes.h:89:14 */ +type Pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = X__sigset /* _sigset.h:55:3 */ + +// - +// SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD) +// +// Copyright (c) 1996, 1997 +// HD Associates, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by HD Associates, Inc +// and Jukka Antero Ukkonen. +// 4. Neither the name of the author nor the names of any co-contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. + +// - +// Copyright (c) 2002-2008, Jeffrey Roberson +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice unmodified, this list of conditions, and the following +// disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// POSIX 1003.1b Process Scheduling + +// POSIX scheduling policies + +type Sched_param = struct{ Fsched_priority int32 } /* sched.h:240:1 */ + +// POSIX scheduling declarations for userland. +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Time_t = X__time_t /* _timespec.h:42:18 */ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Pid_t = X__pid_t /* sched.h:253:25 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2003 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Frequency of the clock ticks reported by times(). Deprecated - use +// sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) + +// Frequency of the clock ticks reported by clock(). + +type Clock_t = X__clock_t /* time.h:62:19 */ + +// New in POSIX 1003.1b-1993. +type Clockid_t = X__clockid_t /* time.h:81:21 */ + +type Timer_t = X__timer_t /* time.h:86:19 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +// These macros are also in sys/time.h. + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:129:1 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011, 2012 The FreeBSD Foundation +// All rights reserved. +// +// This software was developed by David Chisnall under sponsorship from +// the FreeBSD Foundation. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Locale_t = uintptr /* _time.h:36:25 */ + +type X_pthread_cleanup_info = struct{ Fpthread_cleanup_pad [8]X__uintptr_t } /* pthread.h:143:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/pthread/pthread_linux_386.go b/vendor/modernc.org/libc/pthread/pthread_linux_386.go index cd66dc68..a506d254 100644 --- a/vendor/modernc.org/libc/pthread/pthread_linux_386.go +++ b/vendor/modernc.org/libc/pthread/pthread_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_386.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_386.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_linux_amd64.go b/vendor/modernc.org/libc/pthread/pthread_linux_amd64.go index 13038e48..690641ee 100644 --- a/vendor/modernc.org/libc/pthread/pthread_linux_amd64.go +++ b/vendor/modernc.org/libc/pthread/pthread_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_amd64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_amd64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_linux_arm.go b/vendor/modernc.org/libc/pthread/pthread_linux_arm.go index 230ff3ca..02b58ecb 100644 --- a/vendor/modernc.org/libc/pthread/pthread_linux_arm.go +++ b/vendor/modernc.org/libc/pthread/pthread_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_linux_arm64.go b/vendor/modernc.org/libc/pthread/pthread_linux_arm64.go index 21ca5575..6b3cafcd 100644 --- a/vendor/modernc.org/libc/pthread/pthread_linux_arm64.go +++ b/vendor/modernc.org/libc/pthread/pthread_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_arm64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_linux_s390x.go b/vendor/modernc.org/libc/pthread/pthread_linux_s390x.go index 28a700c7..a40b59e7 100644 --- a/vendor/modernc.org/libc/pthread/pthread_linux_s390x.go +++ b/vendor/modernc.org/libc/pthread/pthread_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_s390x.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_linux_s390x.go -pkgname pthread', DO NOT EDIT. package pthread @@ -15,8 +15,6 @@ var _ atomic.Value var _ unsafe.Pointer const ( - BIG_ENDIAN = 4321 - BYTE_ORDER = 4321 CLOCK_BOOTTIME = 7 CLOCK_BOOTTIME_ALARM = 9 CLOCK_MONOTONIC = 1 @@ -28,8 +26,6 @@ const ( CLOCK_REALTIME_COARSE = 5 CLOCK_TAI = 11 CLOCK_THREAD_CPUTIME_ID = 3 - LITTLE_ENDIAN = 1234 - PDP_ENDIAN = 3412 PTHREAD_BARRIER_SERIAL_THREAD = -1 PTHREAD_ONCE_INIT = 0 SCHED_FIFO = 1 @@ -38,22 +34,22 @@ const ( TIMER_ABSTIME = 1 TIME_UTC = 1 X_ATFILE_SOURCE = 1 - X_BITS_BYTESWAP_H = 1 X_BITS_CPU_SET_H = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 X_BITS_SCHED_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TIME_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BITS_TYPES_LOCALE_T_H = 1 X_BITS_TYPES_STRUCT_SCHED_PARAM = 1 X_BITS_TYPES___LOCALE_T_H = 1 - X_BITS_UINTN_IDENTITY_H = 1 X_BSD_SIZE_T_ = 0 X_BSD_SIZE_T_DEFINED_ = 0 X_DEFAULT_SOURCE = 1 - X_ENDIAN_H = 1 X_FEATURES_H = 1 X_FILE_OFFSET_BITS = 64 X_GCC_SIZE_T = 0 @@ -61,6 +57,7 @@ const ( X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 X_PTHREAD_H = 1 + X_RWLOCK_INTERNAL_H = 0 X_SCHED_H = 1 X_SIZET_ = 0 X_SIZE_T = 0 @@ -72,6 +69,7 @@ const ( X_STRUCT_TIMESPEC = 1 X_SYS_CDEFS_H = 1 X_SYS_SIZE_T_H = 0 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_TIME_H = 1 X_T_SIZE = 0 @@ -81,43 +79,39 @@ const ( ) // Read-write lock types. -const ( /* pthread.h:115:1: */ +const ( /* pthread.h:100:1: */ PTHREAD_RWLOCK_PREFER_READER_NP = 0 PTHREAD_RWLOCK_PREFER_WRITER_NP = 1 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP = 2 PTHREAD_RWLOCK_DEFAULT_NP = 0 ) -// Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t -// has the shared field. All 64-bit architectures have the shared field -// in pthread_rwlock_t. - // Read-write lock initializers. // Scheduler inheritance. -const ( /* pthread.h:156:1: */ +const ( /* pthread.h:120:1: */ PTHREAD_INHERIT_SCHED = 0 PTHREAD_EXPLICIT_SCHED = 1 ) // Scope handling. -const ( /* pthread.h:166:1: */ +const ( /* pthread.h:130:1: */ PTHREAD_SCOPE_SYSTEM = 0 PTHREAD_SCOPE_PROCESS = 1 ) // Process shared or private flag. -const ( /* pthread.h:176:1: */ +const ( /* pthread.h:140:1: */ PTHREAD_PROCESS_PRIVATE = 0 PTHREAD_PROCESS_SHARED = 1 ) // Cancellation -const ( /* pthread.h:200:1: */ +const ( /* pthread.h:164:1: */ PTHREAD_CANCEL_ENABLE = 0 PTHREAD_CANCEL_DISABLE = 1 ) -const ( /* pthread.h:207:1: */ +const ( /* pthread.h:171:1: */ PTHREAD_CANCEL_DEFERRED = 0 PTHREAD_CANCEL_ASYNCHRONOUS = 1 ) @@ -177,7 +171,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -192,9 +186,9 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -209,7 +203,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -217,6 +211,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -337,6 +332,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -359,9 +356,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -376,7 +386,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -389,7 +399,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -404,7 +414,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -519,7 +529,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -536,14 +546,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -558,7 +566,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -594,7 +602,8 @@ type X__float128 = float64 /* :47:21 */ // in the C library which is a stub, meaning it will fail // every time called, usually setting errno to ENOSYS. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -609,9 +618,341 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Get type definitions. +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Copyright (C) 1991-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + +// Convenience types. +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ + +// Fixed-size types, underlying types depend on word size and compiler. +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ + +// Smallest types with at least a given width. +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ + +// quad_t is also 64 bits. +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ + +// Largest integral types. +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ + +// The machine-dependent file defines __*_T_TYPE +// macros for each of the OS types we define below. The definitions +// of those macros must use the following macros for underlying types. +// We define __S_TYPE and __U_TYPE for the signed and unsigned +// variants of each of the following integer types on this machine. +// +// 16 -- "natural" 16-bit type (always short) +// 32 -- "natural" 32-bit type (always int) +// 64 -- "natural" 64-bit type (long or long long) +// LONG32 -- 32-bit type, traditionally long +// QUAD -- 64-bit type, traditionally long long +// WORD -- natural type of __WORDSIZE bits (int or long) +// LONGWORD -- type of __WORDSIZE bits, traditionally long +// +// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the +// conventional uses of `long' or `long long' type modifiers match the +// types we define, even when a less-adorned type would be the same size. +// This matters for (somewhat) portably writing printf/scanf formats for +// these types, where using the appropriate l or ll format modifiers can +// make the typedefs and the formats match up across all GNU platforms. If +// we used `long' when it's 64 bits where `long long' is expected, then the +// compiler would warn about the formats not matching the argument types, +// and the programmer changing them to shut up the compiler would break the +// program's portability. +// +// Here we assume what is presently the case in all the GCC configurations +// we support: long long is always 64 bits, long is always word/address size, +// and int is always 32 bits. + +// No need to mark the typedef with __extension__. +// bits/typesizes.h -- underlying types for *_t. Linux/s390 version. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// See for the meaning of these macros. This file exists so +// that need not vary across different GNU platforms. + +// size_t is unsigned long int on s390 -m31. + +// Tell the libc code that off_t and off64_t are actually the same type +// for all ABI purposes, even if possibly expressed as different base types +// for C type-checking purposes. + +// Same for ino_t and ino64_t. + +// And for __rlim_t and __rlim64_t. + +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + +// Number of descriptors that can fit in an `fd_set'. + +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. + +// Clock ID used in clock and timer functions. +type X__clockid_t = int32 /* types.h:168:29 */ + +// Timer ID returned by `timer_create'. +type X__timer_t = uintptr /* types.h:171:12 */ + +// Type to represent block size. +type X__blksize_t = int64 /* types.h:174:29 */ + +// Types from the Large File Support interface. + +// Type to count number of disk blocks. +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ + +// Type to count file system blocks. +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ + +// Type to count file system nodes. +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ + +// Type of miscellaneous file system fields. +type X__fsword_t = int64 /* types.h:191:28 */ + +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. + +// Signed long type used in system calls. +type X__syscall_slong_t = int64 /* types.h:196:33 */ +// Unsigned long type used in system calls. +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__intptr_t = int64 /* types.h:206:25 */ + +// Duplicate info from sys/socket.h. +type X__socklen_t = uint32 /* types.h:209:23 */ + +// C99: An integer type that can be accessed as an atomic entity, +// even in the presence of asynchronous interrupts. +// It is not currently necessary for this to be machine-specific. +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Wide character type. +// Locale-writers should change this as necessary to +// be big enough to hold unique values not between 0 and 127, +// and not (wchar_t) -1, for each defined multibyte character. + +// Define this type if we are doing the whole job, +// or if we want this type in particular. + +// In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. +// are already defined. +// BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. +// NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here. + +// A null pointer constant. + +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Returned by `time'. +type Time_t = X__time_t /* time_t.h:7:18 */ + +// NB: Include guard matches what uses. + +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -637,327 +978,25 @@ type X__float128 = float64 /* :47:21 */ // and proceeding to the byte with the highest address at the right. // This file defines `__BYTE_ORDER' for the particular machine. -// s390 is big-endian + +// S/390 is big-endian. // Some machines may need to use a different endianness for floating point // values. -// Conversion interfaces. -// Macros and inline functions to swap the order of bytes in integer values. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// Copyright (C) 1991-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// Never include this file directly; use instead. - -// Copyright (C) 1991-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// Determine the wordsize from the preprocessor defines. - -// Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ - -// Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ - -// Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ - -// quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ - -// Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ - -// The machine-dependent file defines __*_T_TYPE -// macros for each of the OS types we define below. The definitions -// of those macros must use the following macros for underlying types. -// We define __S_TYPE and __U_TYPE for the signed and unsigned -// variants of each of the following integer types on this machine. -// -// 16 -- "natural" 16-bit type (always short) -// 32 -- "natural" 32-bit type (always int) -// 64 -- "natural" 64-bit type (long or long long) -// LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long -// WORD -- natural type of __WORDSIZE bits (int or long) -// LONGWORD -- type of __WORDSIZE bits, traditionally long -// -// We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the -// conventional uses of `long' or `long long' type modifiers match the -// types we define, even when a less-adorned type would be the same size. -// This matters for (somewhat) portably writing printf/scanf formats for -// these types, where using the appropriate l or ll format modifiers can -// make the typedefs and the formats match up across all GNU platforms. If -// we used `long' when it's 64 bits where `long long' is expected, then the -// compiler would warn about the formats not matching the argument types, -// and the programmer changing them to shut up the compiler would break the -// program's portability. -// -// Here we assume what is presently the case in all the GCC configurations -// we support: long long is always 64 bits, long is always word/address size, -// and int is always 32 bits. - -// No need to mark the typedef with __extension__. -// bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// See for the meaning of these macros. This file exists so -// that need not vary across different GNU platforms. - -// size_t is unsigned long int on s390 -m31. - -// Tell the libc code that off_t and off64_t are actually the same type -// for all ABI purposes, even if possibly expressed as different base types -// for C type-checking purposes. - -// Same for ino_t and ino64_t. - -// And for __rlim_t and __rlim64_t. - -// Number of descriptors that can fit in an `fd_set'. - -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. - -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. - -// Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ - -// Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ - -// Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ - -// Types from the Large File Support interface. - -// Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ - -// Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ - -// Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ - -// Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ - -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. - -// Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ -// Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ - -// Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ - -// C99: An integer type that can be accessed as an atomic entity, -// even in the presence of asynchronous interrupts. -// It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ - -// Wide character type. -// Locale-writers should change this as necessary to -// be big enough to hold unique values not between 0 and 127, -// and not (wchar_t) -1, for each defined multibyte character. - -// Define this type if we are doing the whole job, -// or if we want this type in particular. - -// In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. -// are already defined. -// BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. -// NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here. - -// A null pointer constant. - -// bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// Never include this file directly; use instead. - -// Returned by `time'. -type Time_t = X__time_t /* time_t.h:7:18 */ - -// NB: Include guard matches what uses. - -// bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. -// This file is part of the GNU C Library. -// -// The GNU C Library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// The GNU C Library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with the GNU C Library; if not, see -// . - -// Never include this file directly; use instead. - // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ type Pid_t = X__pid_t /* sched.h:38:17 */ // Get system specific constant and data structure definitions. // Definitions of constants and data structure for POSIX 1003.1b-1993 // scheduling interface. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -972,12 +1011,12 @@ type Pid_t = X__pid_t /* sched.h:38:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Scheduling algorithms. // Sched parameter structure. Generic version. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -992,14 +1031,14 @@ type Pid_t = X__pid_t /* sched.h:38:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Data structure to describe a process' schedulability. type Sched_param = struct{ Fsched_priority int32 } /* struct_sched_param.h:23:1 */ // Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 // scheduling interface. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1014,7 +1053,7 @@ type Sched_param = struct{ Fsched_priority int32 } /* struct_sched_param.h:23:1 // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Size definition for CPU sets. @@ -1026,7 +1065,7 @@ type X__cpu_mask = uint64 /* cpu-set.h:32:25 */ // Data structure to describe CPU mask. type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1041,11 +1080,11 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // ISO C99 Standard: 7.23 Date and time -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1060,9 +1099,9 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1147,7 +1186,7 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // This defines CLOCKS_PER_SEC, which is the number of processor clock // ticks per second, and possibly a number of other constants. // System-dependent timing definitions. Linux version. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1162,12 +1201,12 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1182,7 +1221,7 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1211,7 +1250,7 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // may also need to be defined by other headers. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1226,7 +1265,7 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1234,7 +1273,7 @@ type Cpu_set_t = struct{ F__bits [16]X__cpu_mask } /* cpu-set.h:42:3 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1249,7 +1288,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1272,7 +1311,7 @@ type Tm = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1287,7 +1326,7 @@ type Tm = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1295,7 +1334,7 @@ type Tm = struct { type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1310,7 +1349,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1318,7 +1357,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Timer_t = X__timer_t /* timer_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1333,7 +1372,7 @@ type Timer_t = X__timer_t /* timer_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1352,7 +1391,7 @@ type Itimerspec = struct { } /* struct_itimerspec.h:8:1 */ // Definition of locale_t. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1367,10 +1406,10 @@ type Itimerspec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Definition of struct __locale_struct and __locale_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // Contributed by Ulrich Drepper , 1997. // @@ -1386,7 +1425,7 @@ type Itimerspec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX.1-2008: the locale_t type, representing a locale context // (implementation-namespace version). This type should be treated @@ -1405,8 +1444,8 @@ type X__locale_t = uintptr /* __locale_t.h:42:32 */ type Locale_t = X__locale_t /* locale_t.h:24:20 */ -// Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1423,9 +1462,8 @@ type Locale_t = X__locale_t /* locale_t.h:24:20 */ // License along with the GNU C Library; if not, see // . -// For internal mutex and condition variable definitions. -// Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1440,7 +1478,26 @@ type Locale_t = X__locale_t /* locale_t.h:24:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -1455,36 +1512,6 @@ type Locale_t = X__locale_t /* locale_t.h:24:20 */ // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -1493,11 +1520,10 @@ type Locale_t = X__locale_t /* locale_t.h:24:20 */ // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1516,7 +1542,191 @@ type Locale_t = X__locale_t /* locale_t.h:24:20 */ // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -1531,31 +1741,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -1567,7 +1753,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -1577,14 +1763,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -1595,7 +1781,7 @@ type Pthread_once_t = int32 /* pthreadtypes.h:53:30 */ type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* pthreadtypes.h:56:1 */ type Pthread_attr_t = Pthread_attr_t1 /* pthreadtypes.h:62:30 */ @@ -1610,7 +1796,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -1620,15 +1806,15 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ -// Copyright (C) 2000-2018 Free Software Foundation, Inc. +// Copyright (C) 2000-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1643,7 +1829,7 @@ type Pthread_barrierattr_t = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Define the machine-dependent type `jmp_buf'. IBM s390 version. @@ -1654,7 +1840,7 @@ type X__s390_jmp_buf = struct { F__fpregs [8]int64 } /* setjmp.h:31:9 */ -// Copyright (C) 2000-2018 Free Software Foundation, Inc. +// Copyright (C) 2000-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1669,7 +1855,7 @@ type X__s390_jmp_buf = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Define the machine-dependent type `jmp_buf'. IBM s390 version. @@ -1686,7 +1872,7 @@ type X_pthread_cleanup_buffer = struct { F__canceltype int32 _ [4]byte F__prev uintptr -} /* pthread.h:191:1 */ +} /* pthread.h:155:1 */ // Cancellation handling with integration into exception handling. @@ -1697,7 +1883,7 @@ type X__pthread_unwind_buf_t = struct { _ [4]byte } F__pad [4]uintptr -} /* pthread.h:532:3 */ +} /* pthread.h:507:3 */ // No special attributes by default. @@ -1707,6 +1893,6 @@ type X__pthread_cleanup_frame = struct { F__cancel_arg uintptr F__do_it int32 F__cancel_type int32 -} /* pthread.h:541:1 */ +} /* pthread.h:516:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/pthread/pthread_netbsd_amd64.go b/vendor/modernc.org/libc/pthread/pthread_netbsd_amd64.go new file mode 100644 index 00000000..c74f6b2a --- /dev/null +++ b/vendor/modernc.org/libc/pthread/pthread_netbsd_amd64.go @@ -0,0 +1,2769 @@ +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_netbsd_amd64.go -pkgname pthread', DO NOT EDIT. + +package pthread + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + CLOCKS_PER_SEC = 100 + CLOCK_MONOTONIC = 3 + CLOCK_PROCESS_CPUTIME_ID = 0x40000000 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_THREAD_CPUTIME_ID = 0x20000000 + CLOCK_VIRTUAL = 1 + CLONE_CSIGNAL = 0x000000ff + CLONE_FILES = 0x00000400 + CLONE_FS = 0x00000200 + CLONE_PID = 0x00001000 + CLONE_PTRACE = 0x00002000 + CLONE_SIGHAND = 0x00000800 + CLONE_VFORK = 0x00004000 + CLONE_VM = 0x00000100 + CPUSTATES = 5 + CP_IDLE = 4 + CP_INTR = 3 + CP_NICE = 1 + CP_SYS = 2 + CP_USER = 0 + FD_SETSIZE = 256 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + ITIMER_MONOTONIC = 3 + ITIMER_PROF = 2 + ITIMER_REAL = 0 + ITIMER_VIRTUAL = 1 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTHREAD_BARRIER_SERIAL_THREAD = 1234567 + PTHREAD_CANCEL_ASYNCHRONOUS = 1 + PTHREAD_CANCEL_DEFERRED = 0 + PTHREAD_CANCEL_DISABLE = 1 + PTHREAD_CANCEL_ENABLE = 0 + PTHREAD_CREATE_DETACHED = 1 + PTHREAD_CREATE_JOINABLE = 0 + PTHREAD_EXPLICIT_SCHED = 1 + PTHREAD_INHERIT_SCHED = 0 + PTHREAD_MAX_NAMELEN_NP = 32 + PTHREAD_MUTEX_DEFAULT = 0 + PTHREAD_MUTEX_ERRORCHECK = 1 + PTHREAD_MUTEX_NORMAL = 0 + PTHREAD_MUTEX_RECURSIVE = 2 + PTHREAD_PRIO_INHERIT = 1 + PTHREAD_PRIO_NONE = 0 + PTHREAD_PRIO_PROTECT = 2 + PTHREAD_PROCESS_PRIVATE = 0 + PTHREAD_PROCESS_SHARED = 1 + PTHREAD_SCOPE_PROCESS = 0 + PTHREAD_SCOPE_SYSTEM = 1 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SCHED_FIFO = 1 + SCHED_NONE = -1 + SCHED_OTHER = 0 + SCHED_RR = 2 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_LIB_PTHREAD_H = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SCHED_H_ = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_IDTYPE_H_ = 0 + X_SYS_NULL_H_ = 0 + X_SYS_SCHED_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TIME_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_TIME_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +const ( /* idtype.h:41:1: */ + P_MYID = -1 // Me/my process group + P_ALL = 0 // All processes. + P_PID = 1 // A process identifier. + P_LWPID = 2 // An LWP identifier. + P_PPID = 3 // A parent process identifier. + P_PGID = 4 // A process group identifier. + P_SID = 5 // A session identifier. + P_CID = 6 // A scheduling class identifier. + P_UID = 7 // A user identifier. + P_GID = 8 // A group identifier. + P_TASKID = 9 // A task identifier. + P_PROJID = 10 // A project identifier. + P_POOLID = 11 // A pool identifier. + P_ZONEID = 12 // A zone identifier. + P_CTID = 13 // A (process) contract identifier. + P_CPUID = 14 // CPU identifier. + P_PSETID = 15 // Processor set identifier. + X_P_MAXIDTYPE = 2147483647 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: time.h,v 1.47 2016/10/04 09:41:41 kamil Exp $ + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ + +// Written by Klaus Klein , December 22, 1999. +// Public domain. + +type Clock_t = uint32 /* time.h:49:23 */ + +type Time_t = X__int64_t /* time.h:54:22 */ + +type Clockid_t = int32 /* time.h:64:25 */ + +type Timer_t = int32 /* time.h:69:23 */ + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:75:1 */ + +// ISO/IEC 9899:201x 7.27.1/3 Components of time +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* timespec.h:47:1 */ + +// $NetBSD: time.h,v 1.79 2017/01/17 15:28:34 maya Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// Structure returned by gettimeofday(2) system call, +// and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte +} /* time.h:44:1 */ + +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// Note: timezone is obsolete. All timezone handling is now in +// userland. Its just here for back compatibility. +type Timezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} /* time.h:65:1 */ + +// Operations on timevals. + +// hide bintime for _STANDALONE because this header is used for hpcboot.exe, +// which is built with compilers which don't recognize LL suffix. +// http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html +type Bintime = struct { + Fsec Time_t + Ffrac Uint64_t +} /* time.h:102:1 */ + +// Operations on timespecs. + +// Names of the interval timers, and structure +// defining a timer setting. +// NB: Must match the CLOCK_ constants below. + +type Itimerval = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } + Fit_value struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } +} /* time.h:280:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* time.h:289:1 */ + +// $NetBSD: select.h,v 1.37 2014/04/25 15:52:45 pooka Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)select.h 8.2 (Berkeley) 1/4/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +type Idtype_t = int32 /* idtype.h:60:3 */ + +type Locale_t = uintptr /* time.h:188:25 */ + +type Timezone_t = uintptr /* time.h:198:24 */ + +// $NetBSD: sched.h,v 1.12 2009/01/11 03:04:12 christos Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: sched.h,v 1.76 2016/07/03 14:24:59 christos Exp $ + +// - +// Copyright (c) 1999, 2000, 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Ross Harvey, Jason R. Thorpe, Nathan J. Williams, Andrew Doran and +// Daniel Sieger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// - +// Copyright (c) 1982, 1986, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type Sched_param = struct{ Fsched_priority int32 } /* sched.h:80:1 */ + +type Pthread_cleanup_store = struct{ Fpad [4]uintptr } /* pthread.h:170:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/pthread/pthread_windows_386.go b/vendor/modernc.org/libc/pthread/pthread_windows_386.go index e24f7060..b746fb75 100644 --- a/vendor/modernc.org/libc/pthread/pthread_windows_386.go +++ b/vendor/modernc.org/libc/pthread/pthread_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_386.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_386.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthread/pthread_windows_amd64.go b/vendor/modernc.org/libc/pthread/pthread_windows_amd64.go index 7e8612cb..b07be8d0 100644 --- a/vendor/modernc.org/libc/pthread/pthread_windows_amd64.go +++ b/vendor/modernc.org/libc/pthread/pthread_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_amd64.go -pkgname pthread', DO NOT EDIT. +// Code generated by 'ccgo pthread/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pthread/pthread_windows_amd64.go -pkgname pthread', DO NOT EDIT. package pthread diff --git a/vendor/modernc.org/libc/pthreads_linux_amd64.go b/vendor/modernc.org/libc/pthreads.go similarity index 98% rename from vendor/modernc.org/libc/pthreads_linux_amd64.go rename to vendor/modernc.org/libc/pthreads.go index 58392d56..cd45cea0 100644 --- a/vendor/modernc.org/libc/pthreads_linux_amd64.go +++ b/vendor/modernc.org/libc/pthreads.go @@ -2,6 +2,17 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//TODO darwin,amd64 +//TODO darwin,arm64 +//TODO freebsd,amd64 +//TODO linux,386 +//TODO linux,arm +//TODO linux,arm64 +//TODO linux,s390x + +//go:build linux && amd64 +// +build linux,amd64 + package libc // import "modernc.org/libc" import ( @@ -557,7 +568,7 @@ func Xpthread_detach(t *TLS, thread pthread.Pthread_t) int32 { // int pthread_equal(pthread_t t1, pthread_t t2); func Xpthread_equal(t *TLS, t1, t2 pthread.Pthread_t) int32 { - panic(todo("")) + return Bool32(t1 == t1) } // void pthread_exit(void *value_ptr); diff --git a/vendor/modernc.org/libc/pwd/capi_darwin_amd64.go b/vendor/modernc.org/libc/pwd/capi_darwin_amd64.go index 4b1cf369..16e7deed 100644 --- a/vendor/modernc.org/libc/pwd/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/pwd/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_darwin_amd64.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_darwin_amd64.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/capi_freebsd_amd64.go b/vendor/modernc.org/libc/pwd/capi_freebsd_amd64.go new file mode 100644 index 00000000..d488fcf5 --- /dev/null +++ b/vendor/modernc.org/libc/pwd/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_freebsd_amd64.go -pkgname pwd', DO NOT EDIT. + +package pwd + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/pwd/capi_linux_386.go b/vendor/modernc.org/libc/pwd/capi_linux_386.go index 16765be3..89453ca1 100644 --- a/vendor/modernc.org/libc/pwd/capi_linux_386.go +++ b/vendor/modernc.org/libc/pwd/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_386.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_386.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/capi_linux_amd64.go b/vendor/modernc.org/libc/pwd/capi_linux_amd64.go index 57e766ad..cbc2f115 100644 --- a/vendor/modernc.org/libc/pwd/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/pwd/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_amd64.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_amd64.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/capi_linux_arm.go b/vendor/modernc.org/libc/pwd/capi_linux_arm.go index 673cf780..32cc57bc 100644 --- a/vendor/modernc.org/libc/pwd/capi_linux_arm.go +++ b/vendor/modernc.org/libc/pwd/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/capi_linux_arm64.go b/vendor/modernc.org/libc/pwd/capi_linux_arm64.go index 6fbe87fa..8fb5d138 100644 --- a/vendor/modernc.org/libc/pwd/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/pwd/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm64.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm64.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/capi_linux_s390x.go b/vendor/modernc.org/libc/pwd/capi_linux_s390x.go index 203365bc..bc28bad8 100644 --- a/vendor/modernc.org/libc/pwd/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/pwd/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_s390x.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_s390x.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/capi_netbsd_amd64.go b/vendor/modernc.org/libc/pwd/capi_netbsd_amd64.go new file mode 100644 index 00000000..3ab523bd --- /dev/null +++ b/vendor/modernc.org/libc/pwd/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo pwd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_netbsd_amd64.go -pkgname pwd', DO NOT EDIT. + +package pwd + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/pwd/pwd_darwin_amd64.go b/vendor/modernc.org/libc/pwd/pwd_darwin_amd64.go index 6c846d47..26a026e1 100644 --- a/vendor/modernc.org/libc/pwd/pwd_darwin_amd64.go +++ b/vendor/modernc.org/libc/pwd/pwd_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_darwin_amd64.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_darwin_amd64.go -pkgname pwd', DO NOT EDIT. package pwd @@ -1069,6 +1069,4 @@ type Uuid_t = X__darwin_uuid_t /* _uuid_t.h:31:25 */ type Uuid_string_t = X__darwin_uuid_string_t /* uuid.h:43:33 */ -var sUUID_NULL = Uuid_t{uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0)} /* uuid.h:49:1 */ - var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/pwd/pwd_freebsd_amd64.go b/vendor/modernc.org/libc/pwd/pwd_freebsd_amd64.go new file mode 100644 index 00000000..2fee7aa6 --- /dev/null +++ b/vendor/modernc.org/libc/pwd/pwd_freebsd_amd64.go @@ -0,0 +1,676 @@ +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_freebsd_amd64.go -pkgname pwd', DO NOT EDIT. + +package pwd + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + X_FILE_OFFSET_BITS = 64 + X_GID_T_DECLARED = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MASTERPASSWD = "master.passwd" + X_MP_DB = "pwd.db" + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PASSWD = "passwd" + X_PASSWORD_EFMT1 = 95 + X_PASSWORD_LEN = 128 + X_PATH_MASTERPASSWD = "/etc/master.passwd" + X_PATH_MP_DB = "/etc/pwd.db" + X_PATH_PASSWD = "/etc/passwd" + X_PATH_PWD = "/etc" + X_PATH_PWD_MKDB = "/usr/sbin/pwd_mkdb" + X_PATH_SMP_DB = "/etc/spwd.db" + X_PWD_CURRENT_VERSION = 4 + X_PWD_H_ = 0 + X_PWF_CHANGE = 16 + X_PWF_CLASS = 32 + X_PWF_DIR = 128 + X_PWF_EXPIRE = 512 + X_PWF_FILES = 0x1000 + X_PWF_GECOS = 64 + X_PWF_GID = 8 + X_PWF_HESIOD = 0x3000 + X_PWF_NAME = 1 + X_PWF_NIS = 0x2000 + X_PWF_PASSWD = 2 + X_PWF_SHELL = 256 + X_PWF_SOURCE = 0x3000 + X_PWF_UID = 4 + X_PW_KEYBYNAME = 49 + X_PW_KEYBYNUM = 50 + X_PW_KEYBYUID = 51 + X_PW_KEYYPBYNUM = 53 + X_PW_KEYYPENABLED = 52 + X_PW_VERSION_MASK = 240 + X_SIZE_T_DECLARED = 0 + X_SMP_DB = "spwd.db" + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIME_T_DECLARED = 0 + X_UID_T_DECLARED = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)pwd.h 8.2 (Berkeley) 1/21/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Gid_t = X__gid_t /* pwd.h:47:18 */ + +type Time_t = X__time_t /* pwd.h:52:18 */ + +type Uid_t = X__uid_t /* pwd.h:57:18 */ + +// Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format +// `1 octet tag | key', where the tag is one of the _PW_KEY* values +// listed below. These values happen to be ASCII digits. Starting +// with FreeBSD 5.1, the tag is now still a single octet, but the +// upper 4 bits are interpreted as a version. Pre-FreeBSD 5.1 format +// entries are version `3' -- this conveniently results in the same +// key values as before. The new, architecture-independent entries +// are version `4'. +// As it happens, some applications read the database directly. +// (Bad app, no cookie!) Thus, we leave the _PW_KEY* symbols at their +// old pre-FreeBSD 5.1 values so these apps still work. Consequently +// we have to muck around a bit more to get the correct, versioned +// tag, and that is what the _PW_VERSIONED macro is about. + +// The database also contains a key to indicate the format version of +// the entries therein. There may be other, older versioned entries +// as well. + +type Passwd = struct { + Fpw_name uintptr + Fpw_passwd uintptr + Fpw_uid Uid_t + Fpw_gid Gid_t + Fpw_change Time_t + Fpw_class uintptr + Fpw_gecos uintptr + Fpw_dir uintptr + Fpw_shell uintptr + Fpw_expire Time_t + Fpw_fields int32 + _ [4]byte +} /* pwd.h:114:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/pwd/pwd_linux_386.go b/vendor/modernc.org/libc/pwd/pwd_linux_386.go index f942456a..65216629 100644 --- a/vendor/modernc.org/libc/pwd/pwd_linux_386.go +++ b/vendor/modernc.org/libc/pwd/pwd_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_386.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_386.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/pwd_linux_amd64.go b/vendor/modernc.org/libc/pwd/pwd_linux_amd64.go index 57e5e693..11702a51 100644 --- a/vendor/modernc.org/libc/pwd/pwd_linux_amd64.go +++ b/vendor/modernc.org/libc/pwd/pwd_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_amd64.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_amd64.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/pwd_linux_arm.go b/vendor/modernc.org/libc/pwd/pwd_linux_arm.go index 5cb49415..a30ccefd 100644 --- a/vendor/modernc.org/libc/pwd/pwd_linux_arm.go +++ b/vendor/modernc.org/libc/pwd/pwd_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/pwd_linux_arm64.go b/vendor/modernc.org/libc/pwd/pwd_linux_arm64.go index 49d976d1..e38bf97f 100644 --- a/vendor/modernc.org/libc/pwd/pwd_linux_arm64.go +++ b/vendor/modernc.org/libc/pwd/pwd_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm64.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_arm64.go -pkgname pwd', DO NOT EDIT. package pwd diff --git a/vendor/modernc.org/libc/pwd/pwd_linux_s390x.go b/vendor/modernc.org/libc/pwd/pwd_linux_s390x.go index 67f2b895..5e30c0b8 100644 --- a/vendor/modernc.org/libc/pwd/pwd_linux_s390x.go +++ b/vendor/modernc.org/libc/pwd/pwd_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_s390x.go -pkgname pwd', DO NOT EDIT. +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_linux_s390x.go -pkgname pwd', DO NOT EDIT. package pwd @@ -17,6 +17,7 @@ var _ unsafe.Pointer const ( NSS_BUFLEN_PASSWD = 1024 X_ATFILE_SOURCE = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BSD_SIZE_T_ = 0 @@ -62,7 +63,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -77,11 +78,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 9.2.2 User Database Access -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -96,7 +97,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -104,6 +105,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -224,6 +226,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -246,9 +250,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -263,7 +280,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -276,7 +293,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -291,7 +308,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -406,7 +423,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -423,14 +440,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -445,7 +460,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -482,7 +497,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -497,11 +512,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -516,43 +531,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -564,7 +601,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -585,7 +622,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -600,7 +637,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -615,78 +652,102 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ // Wide character type. // Locale-writers should change this as necessary to @@ -720,4 +781,4 @@ type Passwd = struct { Fpw_shell uintptr } /* pwd.h:49:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/pwd/pwd_netbsd_amd64.go b/vendor/modernc.org/libc/pwd/pwd_netbsd_amd64.go new file mode 100644 index 00000000..222fa8d9 --- /dev/null +++ b/vendor/modernc.org/libc/pwd/pwd_netbsd_amd64.go @@ -0,0 +1,1642 @@ +// Code generated by 'ccgo pwd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o pwd/pwd_netbsd_amd64.go -pkgname pwd', DO NOT EDIT. + +package pwd + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FD_SETSIZE = 256 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PASSWORD_CHGNOW = -1 + X_PASSWORD_EFMT1 = 95 + X_PASSWORD_LEN = 128 + X_PASSWORD_NOCHG = 0x04 + X_PASSWORD_NOEXP = 0x08 + X_PASSWORD_NOGID = 0x02 + X_PASSWORD_NONDES = 36 + X_PASSWORD_NOUID = 0x01 + X_PASSWORD_NOWARN = 0x20 + X_PASSWORD_OLDFMT = 0x10 + X_PASSWORD_WARNDAYS = 14 + X_PATH_MASTERPASSWD = "/etc/master.passwd" + X_PATH_MASTERPASSWD_LOCK = "/etc/ptmp" + X_PATH_MP_DB = "/etc/pwd.db" + X_PATH_PASSWD = "/etc/passwd" + X_PATH_PASSWD_CONF = "/etc/passwd.conf" + X_PATH_PWD_MKDB = "/usr/sbin/pwd_mkdb" + X_PATH_SMP_DB = "/etc/spwd.db" + X_PATH_USERMGMT_CONF = "/etc/usermgmt.conf" + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_PWD_H_ = 0 + X_PW_KEYBYNAME = 49 + X_PW_KEYBYNUM = 50 + X_PW_KEYBYUID = 51 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +type Passwd = struct { + Fpw_name uintptr + Fpw_passwd uintptr + Fpw_uid X__uid_t + Fpw_gid X__gid_t + Fpw_change Time_t + Fpw_class uintptr + Fpw_gecos uintptr + Fpw_dir uintptr + Fpw_shell uintptr + Fpw_expire Time_t +} /* pwd.h:107:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/signal/capi_darwin_amd64.go b/vendor/modernc.org/libc/signal/capi_darwin_amd64.go index 9ec7f851..d9c9a11a 100644 --- a/vendor/modernc.org/libc/signal/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/signal/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_darwin_amd64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_darwin_amd64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_freebsd_amd64.go b/vendor/modernc.org/libc/signal/capi_freebsd_amd64.go new file mode 100644 index 00000000..218bb0ad --- /dev/null +++ b/vendor/modernc.org/libc/signal/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_freebsd_amd64.go -pkgname signal', DO NOT EDIT. + +package signal + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/signal/capi_linux_386.go b/vendor/modernc.org/libc/signal/capi_linux_386.go index 89a52d53..92c263a3 100644 --- a/vendor/modernc.org/libc/signal/capi_linux_386.go +++ b/vendor/modernc.org/libc/signal/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_386.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_386.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_linux_amd64.go b/vendor/modernc.org/libc/signal/capi_linux_amd64.go index 46145ced..990d5bf9 100644 --- a/vendor/modernc.org/libc/signal/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/signal/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_amd64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_amd64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_linux_arm.go b/vendor/modernc.org/libc/signal/capi_linux_arm.go index 9e5ce3b7..03de5408 100644 --- a/vendor/modernc.org/libc/signal/capi_linux_arm.go +++ b/vendor/modernc.org/libc/signal/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_linux_arm64.go b/vendor/modernc.org/libc/signal/capi_linux_arm64.go index 0c88dc7e..a55b1d49 100644 --- a/vendor/modernc.org/libc/signal/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/signal/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_linux_s390x.go b/vendor/modernc.org/libc/signal/capi_linux_s390x.go index e63dcad1..f7a596ff 100644 --- a/vendor/modernc.org/libc/signal/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/signal/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_s390x.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_s390x.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_netbsd_amd64.go b/vendor/modernc.org/libc/signal/capi_netbsd_amd64.go new file mode 100644 index 00000000..d69eae6c --- /dev/null +++ b/vendor/modernc.org/libc/signal/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_netbsd_amd64.go -pkgname signal', DO NOT EDIT. + +package signal + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/signal/capi_windows_386.go b/vendor/modernc.org/libc/signal/capi_windows_386.go index adff01f8..2ac7e272 100644 --- a/vendor/modernc.org/libc/signal/capi_windows_386.go +++ b/vendor/modernc.org/libc/signal/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_386.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_386.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/capi_windows_amd64.go b/vendor/modernc.org/libc/signal/capi_windows_amd64.go index 6ed5485b..dafa3759 100644 --- a/vendor/modernc.org/libc/signal/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/signal/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_amd64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_amd64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/more_freebsd_amd64.go b/vendor/modernc.org/libc/signal/more_freebsd_amd64.go new file mode 100644 index 00000000..c1791b2a --- /dev/null +++ b/vendor/modernc.org/libc/signal/more_freebsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2020 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package signal + +const ( + // sys/sys/signal.h:139:#define SIG_DFL ((__sighandler_t *)0) + SIG_DFL = 0 + // sys/sys/signal.h:140:#define SIG_IGN ((__sighandler_t *)1) + SIG_IGN = 1 +) diff --git a/vendor/modernc.org/libc/signal/more_netbsd_amd64.go b/vendor/modernc.org/libc/signal/more_netbsd_amd64.go new file mode 100644 index 00000000..c1791b2a --- /dev/null +++ b/vendor/modernc.org/libc/signal/more_netbsd_amd64.go @@ -0,0 +1,12 @@ +// Copyright 2020 The Libc Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package signal + +const ( + // sys/sys/signal.h:139:#define SIG_DFL ((__sighandler_t *)0) + SIG_DFL = 0 + // sys/sys/signal.h:140:#define SIG_IGN ((__sighandler_t *)1) + SIG_IGN = 1 +) diff --git a/vendor/modernc.org/libc/signal/signal_darwin_amd64.go b/vendor/modernc.org/libc/signal/signal_darwin_amd64.go index 0b062a2d..f94595a6 100644 --- a/vendor/modernc.org/libc/signal/signal_darwin_amd64.go +++ b/vendor/modernc.org/libc/signal/signal_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_darwin_amd64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_darwin_amd64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/signal_freebsd_amd64.go b/vendor/modernc.org/libc/signal/signal_freebsd_amd64.go new file mode 100644 index 00000000..75523721 --- /dev/null +++ b/vendor/modernc.org/libc/signal/signal_freebsd_amd64.go @@ -0,0 +1,1621 @@ +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_freebsd_amd64.go -pkgname signal', DO NOT EDIT. + +package signal + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BUS_ADRALN = 1 + BUS_ADRERR = 2 + BUS_OBJERR = 3 + BUS_OOMERR = 100 + CLD_CONTINUED = 6 + CLD_DUMPED = 3 + CLD_EXITED = 1 + CLD_KILLED = 2 + CLD_STOPPED = 5 + CLD_TRAPPED = 4 + FPE_FLTDIV = 3 + FPE_FLTINV = 7 + FPE_FLTOVF = 4 + FPE_FLTRES = 6 + FPE_FLTSUB = 8 + FPE_FLTUND = 5 + FPE_INTDIV = 2 + FPE_INTOVF = 1 + ILL_BADSTK = 8 + ILL_COPROC = 7 + ILL_ILLADR = 3 + ILL_ILLOPC = 1 + ILL_ILLOPN = 2 + ILL_ILLTRP = 4 + ILL_PRVOPC = 5 + ILL_PRVREG = 6 + MINSIGSTKSZ = 2048 + NSIG = 32 + POLL_ERR = 4 + POLL_HUP = 6 + POLL_IN = 1 + POLL_MSG = 3 + POLL_OUT = 2 + POLL_PRI = 5 + SA_NOCLDSTOP = 0x0008 + SA_NOCLDWAIT = 0x0020 + SA_NODEFER = 0x0010 + SA_ONSTACK = 0x0001 + SA_RESETHAND = 0x0004 + SA_RESTART = 0x0002 + SA_SIGINFO = 0x0040 + SEGV_ACCERR = 2 + SEGV_MAPERR = 1 + SEGV_PKUERR = 100 + SIGABRT = 6 + SIGALRM = 14 + SIGBUS = 10 + SIGCHLD = 20 + SIGCONT = 19 + SIGEMT = 7 + SIGEV_KEVENT = 3 + SIGEV_NONE = 0 + SIGEV_SIGNAL = 1 + SIGEV_THREAD = 2 + SIGEV_THREAD_ID = 4 + SIGFPE = 8 + SIGHUP = 1 + SIGILL = 4 + SIGINFO = 29 + SIGINT = 2 + SIGIO = 23 + SIGIOT = 6 + SIGKILL = 9 + SIGLIBRT = 33 + SIGLWP = 32 + SIGPIPE = 13 + SIGPROF = 27 + SIGQUIT = 3 + SIGRTMAX = 126 + SIGRTMIN = 65 + SIGSEGV = 11 + SIGSTKSZ = 34816 + SIGSTOP = 17 + SIGSYS = 12 + SIGTERM = 15 + SIGTHR = 32 + SIGTRAP = 5 + SIGTSTP = 18 + SIGTTIN = 21 + SIGTTOU = 22 + SIGURG = 16 + SIGUSR1 = 30 + SIGUSR2 = 31 + SIGVTALRM = 26 + SIGWINCH = 28 + SIGXCPU = 24 + SIGXFSZ = 25 + SIG_BLOCK = 1 + SIG_SETMASK = 3 + SIG_UNBLOCK = 2 + SI_ASYNCIO = 0x10004 + SI_KERNEL = 0x10006 + SI_LWP = 0x10007 + SI_MESGQ = 0x10005 + SI_NOINFO = 0 + SI_QUEUE = 0x10002 + SI_TIMER = 0x10003 + SI_UNDEFINED = 0 + SI_USER = 0x10001 + SS_DISABLE = 0x0004 + SS_ONSTACK = 0x0001 + SV_INTERRUPT = 2 + SV_NOCLDSTOP = 8 + SV_NODEFER = 16 + SV_ONSTACK = 1 + SV_RESETHAND = 4 + SV_SIGINFO = 64 + TRAP_BRKPT = 1 + TRAP_CAP = 4 + TRAP_DTRACE = 3 + TRAP_TRACE = 2 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MC_FLAG_MASK = 7 + X_MC_FPFMT_NODEV = 0x10000 + X_MC_FPFMT_XMM = 0x10002 + X_MC_FPOWNED_FPU = 0x20001 + X_MC_FPOWNED_NONE = 0x20000 + X_MC_FPOWNED_PCB = 0x20002 + X_MC_HASBASES = 0x2 + X_MC_HASFPXSTATE = 0x4 + X_MC_HASSEGS = 0x1 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PID_T_DECLARED = 0 + X_PTHREAD_T_DECLARED = 0 + X_SIGNAL_H_ = 0 + X_SIGSET_T_DECLARED = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SIZE_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_SIGNAL_H_ = 0 + X_SYS__PTHREADTYPES_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_SYS__UCONTEXT_H_ = 0 + X_TIME_T_DECLARED = 0 + X_UID_T_DECLARED = 0 + X_X86_SIGNAL_H = 1 + X_X86_UCONTEXT_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.3 (Berkeley) 3/30/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = X__sigset /* _sigset.h:55:3 */ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// Copyright (c) 2003 Peter Wemm. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.1 (Berkeley) 6/11/93 +// $FreeBSD$ + +// Machine-dependent signal definitions + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +type Sig_atomic_t = int64 /* signal.h:101:14 */ + +// Information pushed on stack when a signal is delivered. +// This is used by the kernel to restore state following +// execution of the signal handler. It is also made available +// to the handler to allow it to restore state properly if +// a non-standard exit is performed. +// +// The sequence of the fields/registers after sc_mask in struct +// sigcontext must match those in mcontext_t and struct trapframe. +type Sigcontext = struct { + Fsc_mask struct{ F__bits [4]X__uint32_t } + Fsc_onstack int64 + Fsc_rdi int64 + Fsc_rsi int64 + Fsc_rdx int64 + Fsc_rcx int64 + Fsc_r8 int64 + Fsc_r9 int64 + Fsc_rax int64 + Fsc_rbx int64 + Fsc_rbp int64 + Fsc_r10 int64 + Fsc_r11 int64 + Fsc_r12 int64 + Fsc_r13 int64 + Fsc_r14 int64 + Fsc_r15 int64 + Fsc_trapno int32 + Fsc_fs int16 + Fsc_gs int16 + Fsc_addr int64 + Fsc_flags int32 + Fsc_es int16 + Fsc_ds int16 + Fsc_err int64 + Fsc_rip int64 + Fsc_cs int64 + Fsc_rflags int64 + Fsc_rsp int64 + Fsc_ss int64 + Fsc_len int64 + Fsc_fpformat int64 + Fsc_ownedfp int64 + Fsc_fpstate [64]int64 + Fsc_fsbase int64 + Fsc_gsbase int64 + Fsc_xfpustate int64 + Fsc_xfpustate_len int64 + Fsc_spare [4]int64 +} /* signal.h:114:1 */ + +type Pthread_once = struct { + Fstate int32 + _ [4]byte + Fmutex Pthread_mutex_t +} /* _pthreadtypes.h:52:1 */ + +// Primitive system data type definitions required by P1003.1c. +// +// Note that P1003.1c specifies that there are no defined comparison +// or assignment operators for the types pthread_attr_t, pthread_cond_t, +// pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. +type Pthread_t = uintptr /* _pthreadtypes.h:67:26 */ +type Pthread_attr_t = uintptr /* _pthreadtypes.h:70:30 */ +type Pthread_mutex_t = uintptr /* _pthreadtypes.h:71:31 */ +type Pthread_mutexattr_t = uintptr /* _pthreadtypes.h:72:35 */ +type Pthread_cond_t = uintptr /* _pthreadtypes.h:73:30 */ +type Pthread_condattr_t = uintptr /* _pthreadtypes.h:74:34 */ +type Pthread_key_t = int32 /* _pthreadtypes.h:75:20 */ +type Pthread_once_t = Pthread_once /* _pthreadtypes.h:76:30 */ +type Pthread_rwlock_t = uintptr /* _pthreadtypes.h:77:32 */ +type Pthread_rwlockattr_t = uintptr /* _pthreadtypes.h:78:35 */ +type Pthread_barrier_t = uintptr /* _pthreadtypes.h:79:33 */ +type Pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */ +type Pthread_spinlock_t = uintptr /* _pthreadtypes.h:81:33 */ + +// Additional type definitions: +// +// Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for +// use in header symbols. +type Pthread_addr_t = uintptr /* _pthreadtypes.h:89:14 */ +type Pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Time_t = X__time_t /* _timespec.h:42:18 */ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +type Uid_t = X__uid_t /* signal.h:61:18 */ + +type Sigset_t = X__sigset_t /* signal.h:166:20 */ + +type Sigval = struct { + _ [0]uint64 + Fsival_int int32 + _ [4]byte +} /* signal.h:171:1 */ + +type Sigevent = struct { + Fsigev_notify int32 + Fsigev_signo int32 + Fsigev_value struct { + _ [0]uint64 + Fsival_int int32 + _ [4]byte + } + F_sigev_un struct { + _ [0]uint64 + F_threadid X__lwpid_t + _ [60]byte + } +} /* signal.h:195:1 */ + +type X__siginfo = struct { + Fsi_signo int32 + Fsi_errno int32 + Fsi_code int32 + Fsi_pid X__pid_t + Fsi_uid X__uid_t + Fsi_status int32 + Fsi_addr uintptr + Fsi_value struct { + _ [0]uint64 + Fsival_int int32 + _ [4]byte + } + F_reason struct { + _ [0]uint64 + F_fault struct{ F_trapno int32 } + _ [36]byte + } +} /* signal.h:229:9 */ + +type Siginfo_t = X__siginfo /* signal.h:263:3 */ + +// Signal vector "template" used in sigaction call. +type Sigaction = struct { + F__sigaction_u struct{ F__sa_handler uintptr } + Fsa_flags int32 + Fsa_mask Sigset_t + _ [4]byte +} /* signal.h:368:1 */ + +// If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. + +// a timer set by timer_settime(). +// an asynchronous I/O request. +// message on an empty message queue. + +type Sig_t = uintptr /* signal.h:420:24 */ + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size X__size_t + Fss_flags int32 + _ [4]byte +} /* signal.h:428:9 */ + +type Stack_t = Sigaltstack /* signal.h:428:26 */ + +// 4.3 compatibility: +// Signal vector "template" used in sigvec call. +type Sigvec = struct { + Fsv_handler uintptr + Fsv_mask int32 + Fsv_flags int32 +} /* signal.h:452:1 */ + +// Keep this in one place only + +// Structure used in sigstack call. +type Sigstack = struct { + Fss_sp uintptr + Fss_onstack int32 + _ [4]byte +} /* signal.h:479:1 */ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 2003 Peter Wemm +// Copyright (c) 1999 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer +// in this position and unchanged. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// mc_flags bits. Shall be in sync with TF_XXX. + +type X__mcontext = struct { + Fmc_onstack X__register_t + Fmc_rdi X__register_t + Fmc_rsi X__register_t + Fmc_rdx X__register_t + Fmc_rcx X__register_t + Fmc_r8 X__register_t + Fmc_r9 X__register_t + Fmc_rax X__register_t + Fmc_rbx X__register_t + Fmc_rbp X__register_t + Fmc_r10 X__register_t + Fmc_r11 X__register_t + Fmc_r12 X__register_t + Fmc_r13 X__register_t + Fmc_r14 X__register_t + Fmc_r15 X__register_t + Fmc_trapno X__uint32_t + Fmc_fs X__uint16_t + Fmc_gs X__uint16_t + Fmc_addr X__register_t + Fmc_flags X__uint32_t + Fmc_es X__uint16_t + Fmc_ds X__uint16_t + Fmc_err X__register_t + Fmc_rip X__register_t + Fmc_cs X__register_t + Fmc_rflags X__register_t + Fmc_rsp X__register_t + Fmc_ss X__register_t + Fmc_len int64 + Fmc_fpformat int64 + Fmc_ownedfp int64 + Fmc_fpstate [64]int64 + Fmc_fsbase X__register_t + Fmc_gsbase X__register_t + Fmc_xfpustate X__register_t + Fmc_xfpustate_len X__register_t + Fmc_spare [4]int64 +} /* ucontext.h:106:9 */ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 2003 Peter Wemm +// Copyright (c) 1999 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer +// in this position and unchanged. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// mc_flags bits. Shall be in sync with TF_XXX. + +type Mcontext_t = X__mcontext /* ucontext.h:164:3 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1999 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer +// in this position and unchanged. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +type X__ucontext = struct { + Fuc_sigmask X__sigset_t + Fuc_mcontext Mcontext_t + Fuc_link uintptr + Fuc_stack struct { + Fss_sp uintptr + Fss_size X__size_t + Fss_flags int32 + _ [4]byte + } + Fuc_flags int32 + F__spare__ [4]int32 + _ [4]byte +} /* _ucontext.h:36:9 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1999 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer +// in this position and unchanged. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +type Ucontext_t = X__ucontext /* _ucontext.h:52:3 */ + +type Pid_t = X__pid_t /* signal.h:60:18 */ // XXX +type X__pthread_t = uintptr /* signal.h:67:24 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/signal/signal_linux_386.go b/vendor/modernc.org/libc/signal/signal_linux_386.go index 06e7eadc..cd79bc00 100644 --- a/vendor/modernc.org/libc/signal/signal_linux_386.go +++ b/vendor/modernc.org/libc/signal/signal_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_386.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_386.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/signal_linux_amd64.go b/vendor/modernc.org/libc/signal/signal_linux_amd64.go index f52f5b08..067f3723 100644 --- a/vendor/modernc.org/libc/signal/signal_linux_amd64.go +++ b/vendor/modernc.org/libc/signal/signal_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_amd64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_amd64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/signal_linux_arm.go b/vendor/modernc.org/libc/signal/signal_linux_arm.go index b4bd9170..6b571cbb 100644 --- a/vendor/modernc.org/libc/signal/signal_linux_arm.go +++ b/vendor/modernc.org/libc/signal/signal_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm.go -pkgname signal', DO NOT EDIT. package signal @@ -1628,9 +1628,7 @@ type X_libc_fpstate = struct { } Ffpsr uint32 /* unsigned fpsr: 32 */ Ffpcr uint32 /* unsigned fpcr: 32 */ - _ [1]byte Fftype [8]uint8 - _ [3]byte Finit_flag uint32 } /* ucontext.h:81:1 */ diff --git a/vendor/modernc.org/libc/signal/signal_linux_arm64.go b/vendor/modernc.org/libc/signal/signal_linux_arm64.go index 8d5d5f5f..4842a975 100644 --- a/vendor/modernc.org/libc/signal/signal_linux_arm64.go +++ b/vendor/modernc.org/libc/signal/signal_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_arm64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/signal_linux_s390x.go b/vendor/modernc.org/libc/signal/signal_linux_s390x.go index 2472f492..dccf1b8e 100644 --- a/vendor/modernc.org/libc/signal/signal_linux_s390x.go +++ b/vendor/modernc.org/libc/signal/signal_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_s390x.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_linux_s390x.go -pkgname signal', DO NOT EDIT. package signal @@ -70,6 +70,8 @@ const ( X_ASM_GENERIC_INT_LL64_H = 0 X_ASM_S390_SIGCONTEXT_H = 0 X_ATFILE_SOURCE = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 X_BITS_SIGACTION_H = 1 @@ -82,6 +84,7 @@ const ( X_BITS_SIGSTACK_H = 1 X_BITS_SIGTHREAD_H = 1 X_BITS_SS_FLAGS_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BSD_SIZE_T_ = 0 @@ -96,6 +99,7 @@ const ( X_NSIG = 65 X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 + X_RWLOCK_INTERNAL_H = 0 X_S390_TYPES_H = 0 X_SIGCONTEXT_NSIG = 64 X_SIGCONTEXT_NSIG_BPW = 64 @@ -112,6 +116,7 @@ const ( X_SYS_CDEFS_H = 1 X_SYS_SIZE_T_H = 0 X_SYS_UCONTEXT_H = 1 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 X_T_SIZE_ = 0 @@ -122,7 +127,7 @@ const ( // POSIX names to access some of the members. // sigevent constants. Linux version. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -137,7 +142,7 @@ const ( // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // `sigev_notify' values. const ( /* sigevent-consts.h:27:1: */ @@ -149,15 +154,18 @@ const ( /* sigevent-consts.h:27:1: */ ) // `si_code' values for SIGSEGV signal. -const ( /* siginfo-consts.h:110:1: */ - SEGV_MAPERR = 1 // Address not mapped to object. - SEGV_ACCERR = 2 // Invalid permissions for mapped object. - SEGV_BNDERR = 3 // Bounds checking failure. - SEGV_PKUERR = 4 +const ( /* siginfo-consts.h:119:1: */ + SEGV_MAPERR = 1 // Address not mapped to object. + SEGV_ACCERR = 2 // Invalid permissions for mapped object. + SEGV_BNDERR = 3 // Bounds checking failure. + SEGV_PKUERR = 4 // Protection key checking failure. + SEGV_ACCADI = 5 // ADI not enabled for mapped object. + SEGV_ADIDERR = 6 // Disrupting MCD error. + SEGV_ADIPERR = 7 ) // `si_code' values for SIGBUS signal. -const ( /* siginfo-consts.h:123:1: */ +const ( /* siginfo-consts.h:138:1: */ BUS_ADRALN = 1 // Invalid address alignment. BUS_ADRERR = 2 // Non-existant physical address. BUS_OBJERR = 3 // Object specific hardware error. @@ -166,7 +174,7 @@ const ( /* siginfo-consts.h:123:1: */ ) // `si_code' values for SIGCHLD signal. -const ( /* siginfo-consts.h:151:1: */ +const ( /* siginfo-consts.h:172:1: */ CLD_EXITED = 1 // Child has exited. CLD_KILLED = 2 // Child was killed. CLD_DUMPED = 3 // Child terminated abnormally. @@ -176,7 +184,7 @@ const ( /* siginfo-consts.h:151:1: */ ) // `si_code' values for SIGPOLL signal. -const ( /* siginfo-consts.h:168:1: */ +const ( /* siginfo-consts.h:189:1: */ POLL_IN = 1 // Data input available. POLL_OUT = 2 // Output buffers available. POLL_MSG = 3 // Input message available. @@ -188,7 +196,7 @@ const ( /* siginfo-consts.h:168:1: */ // X/Open requires some more fields with fixed names. // siginfo constants. Linux version. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -203,7 +211,7 @@ const ( /* siginfo-consts.h:168:1: */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Most of these constants are uniform across all architectures, but there // is one exception. @@ -212,43 +220,48 @@ const ( /* siginfo-consts.h:168:1: */ // Values for `si_code'. Positive values are reserved for kernel-generated // signals. const ( /* siginfo-consts.h:35:1: */ - SI_ASYNCNL = -60 // Sent by asynch name lookup completion. - SI_TKILL = -6 // Sent by tkill. - SI_SIGIO = -5 // Sent by queued SIGIO. - SI_ASYNCIO = -4 // Sent by AIO completion. - SI_MESGQ = -3 // Sent by real time mesq state change. - SI_TIMER = -2 // Sent by timer expiration. - SI_QUEUE = -1 // Sent by sigqueue. - SI_USER = 0 // Sent by kill, sigsend. + SI_ASYNCNL = -60 // Sent by asynch name lookup completion. + SI_DETHREAD = -7 // Sent by execve killing subsidiary + // threads. + SI_TKILL = -6 // Sent by tkill. + SI_SIGIO = -5 // Sent by queued SIGIO. + SI_ASYNCIO = -4 // Sent by AIO completion. + SI_MESGQ = -3 // Sent by real time mesq state change. + SI_TIMER = -2 // Sent by timer expiration. + SI_QUEUE = -1 // Sent by sigqueue. + SI_USER = 0 // Sent by kill, sigsend. SI_KERNEL = 128 ) // `si_code' values for SIGILL signal. -const ( /* siginfo-consts.h:68:1: */ - ILL_ILLOPC = 1 // Illegal opcode. - ILL_ILLOPN = 2 // Illegal operand. - ILL_ILLADR = 3 // Illegal addressing mode. - ILL_ILLTRP = 4 // Illegal trap. - ILL_PRVOPC = 5 // Privileged opcode. - ILL_PRVREG = 6 // Privileged register. - ILL_COPROC = 7 // Coprocessor error. - ILL_BADSTK = 8 +const ( /* siginfo-consts.h:71:1: */ + ILL_ILLOPC = 1 // Illegal opcode. + ILL_ILLOPN = 2 // Illegal operand. + ILL_ILLADR = 3 // Illegal addressing mode. + ILL_ILLTRP = 4 // Illegal trap. + ILL_PRVOPC = 5 // Privileged opcode. + ILL_PRVREG = 6 // Privileged register. + ILL_COPROC = 7 // Coprocessor error. + ILL_BADSTK = 8 // Internal stack error. + ILL_BADIADDR = 9 ) // `si_code' values for SIGFPE signal. -const ( /* siginfo-consts.h:89:1: */ - FPE_INTDIV = 1 // Integer divide by zero. - FPE_INTOVF = 2 // Integer overflow. - FPE_FLTDIV = 3 // Floating point divide by zero. - FPE_FLTOVF = 4 // Floating point overflow. - FPE_FLTUND = 5 // Floating point underflow. - FPE_FLTRES = 6 // Floating point inexact result. - FPE_FLTINV = 7 // Floating point invalid operation. - FPE_FLTSUB = 8 +const ( /* siginfo-consts.h:94:1: */ + FPE_INTDIV = 1 // Integer divide by zero. + FPE_INTOVF = 2 // Integer overflow. + FPE_FLTDIV = 3 // Floating point divide by zero. + FPE_FLTOVF = 4 // Floating point overflow. + FPE_FLTUND = 5 // Floating point underflow. + FPE_FLTRES = 6 // Floating point inexact result. + FPE_FLTINV = 7 // Floating point invalid operation. + FPE_FLTSUB = 8 // Subscript out of range. + FPE_FLTUNK = 14 // Undiagnosed floating-point exception. + FPE_CONDTRAP = 15 ) // sigstack, sigaltstack definitions. -// Copyright (C) 1998-2018 Free Software Foundation, Inc. +// Copyright (C) 1998-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -263,14 +276,14 @@ const ( /* siginfo-consts.h:89:1: */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Minimum stack size for a signal handler. // System default stack size. // ss_flags values for stack_t. Linux version. -// Copyright (C) 1998-2018 Free Software Foundation, Inc. +// Copyright (C) 1998-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -285,7 +298,7 @@ const ( /* siginfo-consts.h:89:1: */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Possible values for `ss_flags'. const ( /* ss_flags.h:27:1: */ @@ -311,7 +324,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -326,11 +339,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // ISO C99 Standard: 7.14 Signal handling -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -345,7 +358,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -353,6 +366,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -473,6 +487,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -495,9 +511,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -512,7 +541,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -525,7 +554,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -540,7 +569,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -655,7 +684,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -672,14 +701,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -694,7 +721,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -731,7 +758,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -746,11 +773,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -765,43 +792,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -813,7 +862,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -834,7 +883,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -849,7 +898,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -864,81 +913,109 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. // Signal number definitions. Linux version. -// Copyright (C) 1995-2018 Free Software Foundation, Inc. +// Copyright (C) 1995-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -953,10 +1030,10 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Signal number constants. Generic template. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -971,7 +1048,7 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Fake signal functions. @@ -1010,7 +1087,7 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // most Linux systems. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1025,7 +1102,7 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1045,7 +1122,27 @@ type Uid_t = X__uid_t /* signal.h:46:17 */ // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1062,19 +1159,32 @@ type Uid_t = X__uid_t /* signal.h:46:17 */ // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. +// Definitions for byte order, according to significance of bytes, +// from low addresses to high addresses. The value is what you get by +// putting '4' in the most significant byte, '3' in the second most +// significant byte, '2' in the second least significant byte, and '1' +// in the least significant byte, and then writing down one digit for +// each byte, starting with the byte at the lowest address at the left, +// and proceeding to the byte with the highest address at the right. + +// This file defines `__BYTE_ORDER' for the particular machine. + +// S/390 is big-endian. + +// Some machines may need to use a different endianness for floating point +// values. // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ // Determine the wordsize from the preprocessor defines. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1089,12 +1199,12 @@ type Timespec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Define __sigval_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1109,7 +1219,7 @@ type Timespec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Type for data associated with a signal. type Sigval = struct { @@ -1140,7 +1250,7 @@ type Siginfo_t = struct { // These are all considered GNU extensions. // Define __sigval_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1155,7 +1265,7 @@ type Siginfo_t = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // To avoid sigval_t (not a standard type name) having C++ name // mangling depending on whether the selected standard includes union @@ -1169,7 +1279,7 @@ type Sigval_t = X__sigval_t /* sigval_t.h:16:20 */ // Determine the wordsize from the preprocessor defines. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1184,12 +1294,12 @@ type Sigval_t = X__sigval_t /* sigval_t.h:16:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Define __sigval_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1204,18 +1314,18 @@ type Sigval_t = X__sigval_t /* sigval_t.h:16:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Forward declaration. type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* sigevent_t.h:17:9 */ // Determine the wordsize from the preprocessor defines. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1230,12 +1340,12 @@ type Pthread_attr_t1 = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Define __sigval_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1250,7 +1360,7 @@ type Pthread_attr_t1 = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Forward declaration. type Pthread_attr_t = Pthread_attr_t1 /* sigevent_t.h:17:30 */ @@ -1278,7 +1388,7 @@ type Sig_t = X__sighandler_t /* signal.h:190:24 */ // Get the system-specific definitions of `struct sigaction' // and the `SA_*' and `SIG_*'. constants. // Definitions for 31 & 64 bit S/390 sigaction. -// Copyright (C) 2001-2018 Free Software Foundation, Inc. +// Copyright (C) 2001-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1293,7 +1403,7 @@ type Sig_t = X__sighandler_t /* signal.h:190:24 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. @@ -1307,7 +1417,7 @@ type Sigaction = struct { } /* sigaction.h:30:1 */ // Get machine-dependent `struct sigcontext' and signal subcodes. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1322,7 +1432,7 @@ type Sigaction = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Kernel headers before 2.1.1 define a struct sigcontext_struct, but // we need sigcontext. @@ -1414,13 +1524,13 @@ type X__kernel_ssize_t = int64 /* posix_types.h:17:25 */ type X__kernel_old_dev_t = uint16 /* posix_types.h:20:24 */ -type X__kernel_ino_t = uint32 /* posix_types.h:34:25 */ -type X__kernel_mode_t = uint32 /* posix_types.h:35:25 */ -type X__kernel_ipc_pid_t = int32 /* posix_types.h:36:25 */ -type X__kernel_uid_t = uint32 /* posix_types.h:37:25 */ -type X__kernel_gid_t = uint32 /* posix_types.h:38:25 */ -type X__kernel_ptrdiff_t = int64 /* posix_types.h:39:25 */ -type X__kernel_sigset_t = uint64 /* posix_types.h:40:25 */ // at least 32 bits +type X__kernel_ino_t = uint32 /* posix_types.h:35:25 */ +type X__kernel_mode_t = uint32 /* posix_types.h:36:25 */ +type X__kernel_ipc_pid_t = int32 /* posix_types.h:37:25 */ +type X__kernel_uid_t = uint32 /* posix_types.h:38:25 */ +type X__kernel_gid_t = uint32 /* posix_types.h:39:25 */ +type X__kernel_ptrdiff_t = int64 /* posix_types.h:40:25 */ +type X__kernel_sigset_t = uint64 /* posix_types.h:41:25 */ // at least 32 bits // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note @@ -1539,7 +1649,7 @@ type Sigcontext = struct { // A null pointer constant. // Define stack_t. Linux version. -// Copyright (C) 1998-2018 Free Software Foundation, Inc. +// Copyright (C) 1998-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1554,9 +1664,9 @@ type Sigcontext = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1647,7 +1757,7 @@ type Stack_t = struct { } /* stack_t.h:31:5 */ // This will define `ucontext_t' and `mcontext_t'. -// Copyright (C) 2000-2018 Free Software Foundation, Inc. +// Copyright (C) 2000-2020 Free Software Foundation, Inc. // Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). // This file is part of the GNU C Library. // @@ -1663,9 +1773,9 @@ type Stack_t = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1680,10 +1790,10 @@ type Stack_t = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Define stack_t. Linux version. -// Copyright (C) 1998-2018 Free Software Foundation, Inc. +// Copyright (C) 1998-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1698,7 +1808,7 @@ type Stack_t = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Type for a program status word. type X__psw_t = struct { @@ -1747,7 +1857,7 @@ type Ucontext_t1 = struct { type Ucontext_t = Ucontext_t1 /* ucontext.h:90:5 */ // Define struct sigstack. -// Copyright (C) 1998-2018 Free Software Foundation, Inc. +// Copyright (C) 1998-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1762,7 +1872,7 @@ type Ucontext_t = Ucontext_t1 /* ucontext.h:90:5 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Structure describing a signal stack (obsolete). type Sigstack = struct { @@ -1774,7 +1884,7 @@ type Sigstack = struct { // Some of the functions for handling signals in threaded programs must // be defined here. // Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1789,11 +1899,11 @@ type Sigstack = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // For internal mutex and condition variable definitions. // Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1808,7 +1918,7 @@ type Sigstack = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -1823,36 +1933,6 @@ type Sigstack = struct { // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -1861,11 +1941,10 @@ type Sigstack = struct { // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1884,7 +1963,175 @@ type Sigstack = struct { // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Some of the functions for handling signals in threaded programs must +// be defined here. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -1899,31 +2146,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -1935,7 +2158,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -1945,14 +2168,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -1971,7 +2194,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -1981,12 +2204,31 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ -var _ int8 /* gen.c:2:13: */ +// System-specific extensions. +// System-specific extensions of , Linux version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/signal/signal_netbsd_amd64.go b/vendor/modernc.org/libc/signal/signal_netbsd_amd64.go new file mode 100644 index 00000000..4357b31a --- /dev/null +++ b/vendor/modernc.org/libc/signal/signal_netbsd_amd64.go @@ -0,0 +1,2909 @@ +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_netbsd_amd64.go -pkgname signal', DO NOT EDIT. + +package signal + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BUS_ADRALN = 1 + BUS_ADRERR = 2 + BUS_OBJERR = 3 + BYTE_ORDER = 1234 + CLD_CONTINUED = 6 + CLD_DUMPED = 3 + CLD_EXITED = 1 + CLD_KILLED = 2 + CLD_STOPPED = 5 + CLD_TRAPPED = 4 + FD_SETSIZE = 256 + FPE_FLTDIV = 3 + FPE_FLTINV = 7 + FPE_FLTOVF = 4 + FPE_FLTRES = 6 + FPE_FLTSUB = 8 + FPE_FLTUND = 5 + FPE_INTDIV = 1 + FPE_INTOVF = 2 + ILL_BADSTK = 8 + ILL_COPROC = 7 + ILL_ILLADR = 3 + ILL_ILLOPC = 1 + ILL_ILLOPN = 2 + ILL_ILLTRP = 4 + ILL_PRVOPC = 5 + ILL_PRVREG = 6 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + LITTLE_ENDIAN = 1234 + MINSIGSTKSZ = 8192 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + NSIG = 64 + PDP_ENDIAN = 3412 + POLL_ERR = 4 + POLL_HUP = 6 + POLL_IN = 1 + POLL_MSG = 3 + POLL_OUT = 2 + POLL_PRI = 5 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SA_NOCLDSTOP = 0x0008 + SA_NOCLDWAIT = 0x0020 + SA_NODEFER = 0x0010 + SA_NOKERNINFO = 0x0080 + SA_ONSTACK = 0x0001 + SA_RESETHAND = 0x0004 + SA_RESTART = 0x0002 + SA_SIGINFO = 0x0040 + SEGV_ACCERR = 2 + SEGV_MAPERR = 1 + SIGABRT = 6 + SIGALRM = 14 + SIGBUS = 10 + SIGCHLD = 20 + SIGCONT = 19 + SIGEMT = 7 + SIGEV_NONE = 0 + SIGEV_SA = 3 + SIGEV_SIGNAL = 1 + SIGEV_THREAD = 2 + SIGFPE = 8 + SIGHUP = 1 + SIGILL = 4 + SIGINFO = 29 + SIGINT = 2 + SIGIO = 23 + SIGIOT = 6 + SIGKILL = 9 + SIGPIPE = 13 + SIGPROF = 27 + SIGPWR = 32 + SIGQUIT = 3 + SIGRTMAX = 63 + SIGRTMIN = 33 + SIGSEGV = 11 + SIGSTKSZ = 40960 + SIGSTOP = 17 + SIGSYS = 12 + SIGTERM = 15 + SIGTRAP = 5 + SIGTSTP = 18 + SIGTTIN = 21 + SIGTTOU = 22 + SIGURG = 16 + SIGUSR1 = 30 + SIGUSR2 = 31 + SIGVTALRM = 26 + SIGWINCH = 28 + SIGXCPU = 24 + SIGXFSZ = 25 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIG_BLOCK = 1 + SIG_SETMASK = 3 + SIG_UNBLOCK = 2 + SIZE_MAX = 18446744073709551615 + SI_ASYNCIO = -3 + SI_LWP = -5 + SI_MESGQ = -4 + SI_NOINFO = 32767 + SI_QUEUE = -1 + SI_TIMER = -2 + SI_USER = 0 + SS_DISABLE = 0x0004 + SS_ONSTACK = 0x0001 + TC_FLAGMASK = 2147483648 + TC_TSS = 0x80000000 + TRAP_BRKPT = 1 + TRAP_CHLD = 4 + TRAP_DBREG = 6 + TRAP_EXEC = 3 + TRAP_LWP = 5 + TRAP_SCE = 7 + TRAP_SCX = 8 + TRAP_TRACE = 2 + T_ALIGNFLT = 7 + T_ARITHTRAP = 2 + T_ASTFLT = 3 + T_BOUND = 11 + T_BPTFLT = 1 + T_DIVIDE = 8 + T_DNA = 12 + T_DOUBLEFLT = 13 + T_FPOPFLT = 14 + T_MCA = 18 + T_NMI = 9 + T_OFLOW = 10 + T_PAGEFLT = 6 + T_PRIVINFLT = 0 + T_PROTFLT = 4 + T_RESERVED = 20 + T_SEGNPFLT = 16 + T_STKFLT = 17 + T_TRCTRAP = 5 + T_TSSFLT = 15 + T_USER = 0x100 + T_XMM = 19 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_FRAME_REGS_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_MCONTEXT_H_ = 0 + X_AMD64_SIGNAL_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_NSIG = 64 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIGNAL_H_ = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_SIGINFO_H_ = 0 + X_SYS_SIGNAL_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS_UCONTEXT_H_ = 0 + X_UC_CLRSTACK = 0x00020000 + X_UC_CPU = 0x04 + X_UC_FPU = 0x08 + X_UC_MD = 0x400f0020 + X_UC_SETSTACK = 0x00010000 + X_UC_SIGMASK = 0x01 + X_UC_STACK = 0x02 + X_UC_TLSBASE = 0x00080000 + X_UC_UCONTEXT_ALIGN = -16 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +// Get the "code" values +// $NetBSD: trap.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ + +// $NetBSD: trap.h,v 1.2 2003/08/07 16:30:33 agc Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// William Jolitz. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)trap.h 5.4 (Berkeley) 5/9/91 + +// Trap type values +// also known in trap.c for name strings + +// Trap's coming from user mode + +// Flags kludged into the trap code + +// $NetBSD: mcontext.h,v 1.19 2018/02/15 15:53:56 kamil Exp $ + +// - +// Copyright (c) 1999 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: frame_regs.h,v 1.7 2015/04/26 18:49:39 mrg Exp $ + +// amd64 registers (and friends) ordered as in a trap/interrupt/syscall frame. +// Also the indexes into the 'general register state' (__greg_t) passed to +// userland. +// Historically they were in the same order, but the order in the frames +// has been changed to improve syscall efficiency. +// +// Notes: +// 1) gdb (amd64nbsd-tdep.c) has a lookup table that assumes the __greg_t +// ordering. +// 2) src/lib/libc/arch/x86_64/gen/makecontext.c assumes that the first +// 6 entries in the __greg_t array match the registers used to pass +// function arguments. +// 3) The 'struct reg' from machine/reg.h has to match __greg_t. +// Since they are both arrays and indexed with the same tokens this +// shouldn't be a problem, but is rather confusing. +// This assumption is made in a lot of places! +// 4) There might be other code out there that relies on the ordering. +// +// The first entries below match the registers used for syscall arguments +// (%rcx is destroyed by the syscall instruction, the libc system call +// stubs copy %rcx to %r10). +// arg6-arg9 are copied from the user stack for system calls with more +// than 6 args (SYS_MAXSYSARGS is 8, + 2 entries for SYS___SYSCALL). + +// General register state +const ( /* mcontext.h:43:1: */ + X_REG_RDI = 0 /* tf_rdi */ + X_REG_RSI = 1 /* tf_rsi */ + X_REG_RDX = 2 /* tf_rdx */ + X_REG_R10 = 6 /* tf_r10 */ + X_REG_R8 = 4 /* tf_r8 */ + X_REG_R9 = 5 /* tf_r9 */ + X_REG_RCX = 3 /* tf_rcx */ + X_REG_R11 = 7 /* tf_r11 */ + X_REG_R12 = 8 /* tf_r12 */ + X_REG_R13 = 9 /* tf_r13 */ + X_REG_R14 = 10 /* tf_r14 */ + X_REG_R15 = 11 /* tf_r15 */ + X_REG_RBP = 12 /* tf_rbp */ + X_REG_RBX = 13 /* tf_rbx */ + X_REG_RAX = 14 /* tf_rax */ + X_REG_GS = 15 /* tf_gs */ + X_REG_FS = 16 /* tf_fs */ + X_REG_ES = 17 /* tf_es */ + X_REG_DS = 18 /* tf_ds */ + X_REG_TRAPNO = 19 /* Below portion defined in hardware */ + X_REG_ERR = 20 /* tf_err: Dummy inserted if not defined */ + X_REG_RIP = 21 /* tf_rip */ + X_REG_CS = 22 /* tf_cs */ + X_REG_RFLAGS = 23 /* These are pushed unconditionally on the x86-64 */ + X_REG_RSP = 24 /* tf_rsp */ + X_REG_SS = 25 + X_NGREG = 26 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// $NetBSD: signal.h,v 1.72 2017/04/21 15:10:35 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: siginfo.h,v 1.33.2.1 2019/10/15 18:32:13 martin Exp $ + +// - +// Copyright (c) 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: signal.h,v 1.12 2013/01/02 19:40:23 dsl Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 7.16 (Berkeley) 3/17/91 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +type Sig_atomic_t = int32 /* signal.h:41:13 */ + +type X__greg_t = uint64 /* mcontext.h:46:23 */ +type X__gregset_t = [26]X__greg_t /* mcontext.h:47:18 */ + +// These names are for compatibility + +// Floating point register state +// The format of __fpregset_t is that of the fxsave instruction +// which requires 16 byte alignment. However the mcontext version +// is never directly accessed. +type X__fpregset_t = [512]int8 /* mcontext.h:59:14 */ + +type Mcontext_t = struct { + F__gregs X__gregset_t + F_mc_tlsbase X__greg_t + F__fpregs X__fpregset_t +} /* mcontext.h:65:3 */ + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +type Sigval = struct { + _ [0]uint64 + Fsival_int int32 + _ [4]byte +} /* siginfo.h:41:9 */ + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +type Sigval_t = Sigval /* siginfo.h:44:3 */ + +type X_ksiginfo = struct { + F_signo int32 + F_code int32 + F_errno int32 + F_pad int32 + F_reason struct { + F_rt struct { + F_pid X__pid_t + F_uid X__uid_t + F_value Sigval_t + } + _ [64]byte + } +} /* siginfo.h:46:1 */ + +type Siginfo = struct { + _ [0]uint64 + Fsi_pad [128]int8 +} /* siginfo.h:148:9 */ + +type Siginfo_t = Siginfo /* siginfo.h:151:3 */ + +//* Field access macros + +//* si_code +// SIGILL + +// SIGFPE + +// SIGSEGV + +// SIGBUS + +// SIGTRAP + +// SIGCHLD +// did not create a core file +// created a core file + +// SIGIO + +//* si_code +// set by timer_settime(2) +// asynchronous I/O signal +// an empty message queue + +// $NetBSD: ucontext.h,v 1.19 2018/02/27 23:09:02 uwe Exp $ + +// - +// Copyright (c) 1999, 2003 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein, and by Jason R. Thorpe. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// $NetBSD: mcontext.h,v 1.19 2018/02/15 15:53:56 kamil Exp $ + +// - +// Copyright (c) 1999 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__ucontext = struct { + Fuc_flags uint32 + _ [4]byte + Fuc_link uintptr + Fuc_sigmask Sigset_t + Fuc_stack Stack_t + Fuc_mcontext Mcontext_t +} /* ucontext.h:38:9 */ + +//* Field access macros + +//* si_code +// SIGILL + +// SIGFPE + +// SIGSEGV + +// SIGBUS + +// SIGTRAP + +// SIGCHLD +// did not create a core file +// created a core file + +// SIGIO + +//* si_code +// set by timer_settime(2) +// asynchronous I/O signal +// an empty message queue + +// $NetBSD: ucontext.h,v 1.19 2018/02/27 23:09:02 uwe Exp $ + +// - +// Copyright (c) 1999, 2003 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein, and by Jason R. Thorpe. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// $NetBSD: mcontext.h,v 1.19 2018/02/15 15:53:56 kamil Exp $ + +// - +// Copyright (c) 1999 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Ucontext_t = X__ucontext /* ucontext.h:38:27 */ + +// uc_flags + +// if your port needs more MD bits, please try to choose bits from _UC_MD +// first, rather than picking random unused bits. +// +// _UC_MD details +// +// _UC_TLSBASE Context contains valid pthread private pointer +// All ports must define this MD flag +// 0x00040000 hppa, mips +// 0x00000020 alpha +// 0x00080000 all other ports +// +// _UC_SETSTACK Context uses signal stack +// 0x00020000 arm +// [undefined] alpha, powerpc and vax +// 0x00010000 other ports +// +// _UC_CLRSTACK Context does not use signal stack +// 0x00040000 arm +// [undefined] alpha, powerpc and vax +// 0x00020000 other ports +// +// _UC_POWERPC_VEC Context contains valid AltiVec context +// 0x00010000 powerpc only +// +// _UC_POWERPC_SPE Context contains valid SPE context +// 0x00020000 powerpc only +// +// _UC_M68K_UC_USER Used by m68k machdep code, but undocumented +// 0x40000000 m68k only +// +// _UC_ARM_VFP Unused +// 0x00010000 arm only +// +// _UC_VM Context contains valid virtual 8086 context +// 0x00040000 i386, amd64 only +// +// _UC_FXSAVE Context contains FPU context in that +// is in FXSAVE format in XMM space +// 0x00000020 i386, amd64 only + +// Signal vector "template" used in sigaction call. +type Sigaction = struct { + F_sa_u struct{ F_sa_handler uintptr } + Fsa_mask Sigset_t + Fsa_flags int32 + _ [4]byte +} /* signal.h:123:1 */ + +// $NetBSD: signal.h,v 1.12 2013/01/02 19:40:23 dsl Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 7.16 (Berkeley) 3/17/91 + +// Only valid for SIGCHLD. + +// Flags for sigprocmask(): + +type Sig_t = uintptr /* signal.h:172:14 */ // type of signal function + +// Flags used with stack_t/struct sigaltstack. + +// Structure used in sigstack call. +type Sigstack = struct { + Fss_sp uintptr + Fss_onstack int32 + _ [4]byte +} /* signal.h:198:1 */ + +// Macro for converting signal number to a mask suitable for +// sigblock(). + +type Sigevent = struct { + Fsigev_notify int32 + Fsigev_signo int32 + Fsigev_value struct { + _ [0]uint64 + Fsival_int int32 + _ [4]byte + } + Fsigev_notify_function uintptr + Fsigev_notify_attributes uintptr +} /* signal.h:216:1 */ + +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* timespec.h:47:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/signal/signal_windows_386.go b/vendor/modernc.org/libc/signal/signal_windows_386.go index 71eaf92c..127d18f9 100644 --- a/vendor/modernc.org/libc/signal/signal_windows_386.go +++ b/vendor/modernc.org/libc/signal/signal_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_386.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_386.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/signal/signal_windows_amd64.go b/vendor/modernc.org/libc/signal/signal_windows_amd64.go index 98c9f94f..88f015a4 100644 --- a/vendor/modernc.org/libc/signal/signal_windows_amd64.go +++ b/vendor/modernc.org/libc/signal/signal_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_amd64.go -pkgname signal', DO NOT EDIT. +// Code generated by 'ccgo signal/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o signal/signal_windows_amd64.go -pkgname signal', DO NOT EDIT. package signal diff --git a/vendor/modernc.org/libc/stdio/capi_darwin_amd64.go b/vendor/modernc.org/libc/stdio/capi_darwin_amd64.go index eb99e949..ad9b9cf1 100644 --- a/vendor/modernc.org/libc/stdio/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/stdio/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_darwin_amd64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_darwin_amd64.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_freebsd_amd64.go b/vendor/modernc.org/libc/stdio/capi_freebsd_amd64.go new file mode 100644 index 00000000..ef04ad2e --- /dev/null +++ b/vendor/modernc.org/libc/stdio/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_freebsd_amd64.go -pkgname stdio', DO NOT EDIT. + +package stdio + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/stdio/capi_linux_386.go b/vendor/modernc.org/libc/stdio/capi_linux_386.go index 9d7e252a..e00b4c19 100644 --- a/vendor/modernc.org/libc/stdio/capi_linux_386.go +++ b/vendor/modernc.org/libc/stdio/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_386.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_386.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_linux_amd64.go b/vendor/modernc.org/libc/stdio/capi_linux_amd64.go index 06ea5420..c9969ca4 100644 --- a/vendor/modernc.org/libc/stdio/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/stdio/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_amd64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_amd64.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_linux_arm.go b/vendor/modernc.org/libc/stdio/capi_linux_arm.go index 23e119ee..91c7b0c9 100644 --- a/vendor/modernc.org/libc/stdio/capi_linux_arm.go +++ b/vendor/modernc.org/libc/stdio/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_linux_arm64.go b/vendor/modernc.org/libc/stdio/capi_linux_arm64.go index ef31fea9..9a47692a 100644 --- a/vendor/modernc.org/libc/stdio/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/stdio/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm64.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_linux_s390x.go b/vendor/modernc.org/libc/stdio/capi_linux_s390x.go index 94ee1da9..43f05d4d 100644 --- a/vendor/modernc.org/libc/stdio/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/stdio/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_s390x.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_s390x.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_netbsd_amd64.go b/vendor/modernc.org/libc/stdio/capi_netbsd_amd64.go new file mode 100644 index 00000000..7ad0ba7d --- /dev/null +++ b/vendor/modernc.org/libc/stdio/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_netbsd_amd64.go -pkgname stdio', DO NOT EDIT. + +package stdio + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/stdio/capi_windows_386.go b/vendor/modernc.org/libc/stdio/capi_windows_386.go index 12c76cf0..22f366ae 100644 --- a/vendor/modernc.org/libc/stdio/capi_windows_386.go +++ b/vendor/modernc.org/libc/stdio/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_386.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_386.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/capi_windows_amd64.go b/vendor/modernc.org/libc/stdio/capi_windows_amd64.go index a75fdec0..af0aecb5 100644 --- a/vendor/modernc.org/libc/stdio/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/stdio/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_amd64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_amd64.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/stdio_darwin_amd64.go b/vendor/modernc.org/libc/stdio/stdio_darwin_amd64.go index 669d201f..9ab04d5d 100644 --- a/vendor/modernc.org/libc/stdio/stdio_darwin_amd64.go +++ b/vendor/modernc.org/libc/stdio/stdio_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_darwin_amd64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_darwin_amd64.go -pkgname stdio', DO NOT EDIT. package stdio @@ -99,7 +99,7 @@ type X__float128 = float64 /* :47:21 */ // This had to be done to correct non-standard usages in the // original, manufacturer supplied header file. -// Copyright (C) 1989-2020 Free Software Foundation, Inc. +// Copyright (C) 1989-2021 Free Software Foundation, Inc. // // This file is part of GCC. // diff --git a/vendor/modernc.org/libc/stdio/stdio_freebsd_amd64.go b/vendor/modernc.org/libc/stdio/stdio_freebsd_amd64.go new file mode 100644 index 00000000..6d9e0bc6 --- /dev/null +++ b/vendor/modernc.org/libc/stdio/stdio_freebsd_amd64.go @@ -0,0 +1,759 @@ +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_freebsd_amd64.go -pkgname stdio', DO NOT EDIT. + +package stdio + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BUFSIZ = 1024 + EOF = -1 + FILENAME_MAX = 1024 + FOPEN_MAX = 20 + L_ctermid = 1024 + L_cuserid = 17 + L_tmpnam = 1024 + P_tmpdir = "/tmp/" + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + TMP_MAX = 308915776 + X_FILE_OFFSET_BITS = 64 + X_FSTDIO = 0 + X_FTRUNCATE_DECLARED = 0 + X_IOFBF = 0 + X_IOLBF = 1 + X_IONBF = 2 + X_LP64 = 1 + X_LSEEK_DECLARED = 0 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MMAP_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF64_T_DECLARED = 0 + X_OFF_T_DECLARED = 0 + X_RSIZE_T_DEFINED = 0 + X_SIZE_T_DECLARED = 0 + X_SSIZE_T_DECLARED = 0 + X_STDFILE_DECLARED = 0 + X_STDIO_H_ = 0 + X_STDSTREAM_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TRUNCATE_DECLARED = 0 + X_VA_LIST_DECLARED = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Chris Torek. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)stdio.h 8.5 (Berkeley) 4/29/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2003 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Fpos_t = X__off_t /* stdio.h:47:18 */ + +type Rsize_t = Size_t /* stdio.h:56:16 */ + +type Off_t = X__off_t /* stdio.h:62:18 */ +type Ssize_t = X__ssize_t /* stdio.h:66:19 */ + +type Off64_t = X__off64_t /* stdio.h:72:19 */ + +type Va_list = X__va_list /* stdio.h:77:19 */ + +// NB: to fit things in six character monocase externals, the stdio +// code uses the prefix `__s' for stdio objects, typically followed +// by a three-character attempt at a mnemonic. + +// stdio buffers +type X__sbuf = struct { + F_base uintptr + F_size int32 + _ [4]byte +} /* stdio.h:91:1 */ + +// stdio state variables. +// +// The following always hold: +// +// if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), +// _lbfsize is -_bf._size, else _lbfsize is 0 +// if _flags&__SRD, _w is 0 +// if _flags&__SWR, _r is 0 +// +// This ensures that the getc and putc macros (or inline functions) never +// try to write or read from a file that is in `read' or `write' mode. +// (Moreover, they can, and do, automatically switch from read mode to +// write mode, and back, on "r+" and "w+" files.) +// +// _lbfsize is used only to make the inline line-buffered output stream +// code as compact as possible. +// +// _ub, _up, and _ur are used when ungetc() pushes back more characters +// than fit in the current _bf, or when ungetc() pushes back a character +// that does not match the previous one in _bf. When this happens, +// _ub._base becomes non-nil (i.e., a stream has ungetc() data iff +// _ub._base!=NULL) and _up and _ur save the current values of _p and _r. +// +// Certain members of __sFILE are accessed directly via macros or +// inline functions. To preserve ABI compat, these members must not +// be disturbed. These members are marked below with (*). +type X__sFILE = struct { + F_p uintptr + F_r int32 + F_w int32 + F_flags int16 + F_file int16 + _ [4]byte + F_bf struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_lbfsize int32 + _ [4]byte + F_cookie uintptr + F_close uintptr + F_read uintptr + F_seek uintptr + F_write uintptr + F_ub struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_up uintptr + F_ur int32 + F_ubuf [3]uint8 + F_nbuf [1]uint8 + F_lb struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_blksize int32 + _ [4]byte + F_offset Fpos_t + F_fl_mutex uintptr + F_fl_owner uintptr + F_fl_count int32 + F_orientation int32 + F_mbstate X__mbstate_t + F_flags2 int32 + _ [4]byte +} /* stdio.h:124:1 */ + +type FILE = X__sFILE /* stdio.h:165:24 */ +type Cookie_io_functions_t = struct { + Fread uintptr + Fwrite uintptr + Fseek uintptr + Fclose uintptr +} /* stdio.h:428:3 */ + +// See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 +// B.8.2.7 for the rationale behind the *_unlocked() macros. + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/stdio/stdio_linux_386.go b/vendor/modernc.org/libc/stdio/stdio_linux_386.go index 927db121..1100b11d 100644 --- a/vendor/modernc.org/libc/stdio/stdio_linux_386.go +++ b/vendor/modernc.org/libc/stdio/stdio_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_386.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_386.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/stdio_linux_amd64.go b/vendor/modernc.org/libc/stdio/stdio_linux_amd64.go index 46bd5699..10f198cd 100644 --- a/vendor/modernc.org/libc/stdio/stdio_linux_amd64.go +++ b/vendor/modernc.org/libc/stdio/stdio_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_amd64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_amd64.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/stdio_linux_arm.go b/vendor/modernc.org/libc/stdio/stdio_linux_arm.go index bf929878..a9baebb1 100644 --- a/vendor/modernc.org/libc/stdio/stdio_linux_arm.go +++ b/vendor/modernc.org/libc/stdio/stdio_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/stdio_linux_arm64.go b/vendor/modernc.org/libc/stdio/stdio_linux_arm64.go index 33edd764..5b0617ae 100644 --- a/vendor/modernc.org/libc/stdio/stdio_linux_arm64.go +++ b/vendor/modernc.org/libc/stdio/stdio_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_arm64.go -pkgname stdio', DO NOT EDIT. package stdio diff --git a/vendor/modernc.org/libc/stdio/stdio_linux_s390x.go b/vendor/modernc.org/libc/stdio/stdio_linux_s390x.go index b3c1828f..3d155416 100644 --- a/vendor/modernc.org/libc/stdio/stdio_linux_s390x.go +++ b/vendor/modernc.org/libc/stdio/stdio_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_s390x.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_linux_s390x.go -pkgname stdio', DO NOT EDIT. package stdio @@ -28,6 +28,7 @@ const ( TMP_MAX = 238328 X_ATFILE_SOURCE = 1 X_BITS_STDIO_LIM_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BSD_SIZE_T_ = 0 @@ -95,7 +96,7 @@ type X__float128 = float64 /* :47:21 */ // A null pointer constant. -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -128,7 +129,7 @@ type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:40:27 */ // if this invocation was from the user program. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -143,11 +144,11 @@ type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:40:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -162,43 +163,65 @@ type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:40:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -210,7 +233,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -231,7 +254,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -246,7 +269,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -261,81 +284,12 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. - -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. - -// Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ - -// Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ - -// Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ - -// Types from the Large File Support interface. - -// Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ - -// Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ - -// Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ - -// Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ - -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. - -// Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ -// Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ - -// Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ - -// C99: An integer type that can be accessed as an atomic entity, -// even in the presence of asynchronous interrupts. -// It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ - -// bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -350,7 +304,104 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . + +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. + +// Clock ID used in clock and timer functions. +type X__clockid_t = int32 /* types.h:168:29 */ + +// Timer ID returned by `timer_create'. +type X__timer_t = uintptr /* types.h:171:12 */ + +// Type to represent block size. +type X__blksize_t = int64 /* types.h:174:29 */ + +// Types from the Large File Support interface. + +// Type to count number of disk blocks. +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ + +// Type to count file system blocks. +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ + +// Type to count file system nodes. +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ + +// Type of miscellaneous file system fields. +type X__fsword_t = int64 /* types.h:191:28 */ + +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. + +// Signed long type used in system calls. +type X__syscall_slong_t = int64 /* types.h:196:33 */ +// Unsigned long type used in system calls. +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__intptr_t = int64 /* types.h:206:25 */ + +// Duplicate info from sys/socket.h. +type X__socklen_t = uint32 /* types.h:209:23 */ + +// C99: An integer type that can be accessed as an atomic entity, +// even in the presence of asynchronous interrupts. +// It is not currently necessary for this to be machine-specific. +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. + +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . // Never include this file directly; use instead. @@ -379,7 +430,7 @@ type X_G_fpos_t = struct { type X__fpos_t = X_G_fpos_t /* __fpos_t.h:14:3 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -394,7 +445,7 @@ type X__fpos_t = X_G_fpos_t /* __fpos_t.h:14:3 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -407,7 +458,7 @@ type X_G_fpos64_t = struct { } /* __fpos64_t.h:10:9 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -422,7 +473,7 @@ type X_G_fpos64_t = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -452,7 +503,7 @@ type X_IO_FILE = struct { F_old_offset X__off_t F_cur_column uint16 F_vtable_offset int8 - F_shortbuf [1]int8 + F_shortbuf [1]uint8 _ [4]byte F_lock uintptr F_offset X__off64_t @@ -462,7 +513,7 @@ type X_IO_FILE = struct { F_freeres_buf uintptr F__pad5 Size_t F_mode int32 - F_unused2 [20]int8 + F_unused2 [20]uint8 } /* __FILE.h:4:1 */ type X__FILE = X_IO_FILE /* __FILE.h:5:25 */ @@ -486,4 +537,4 @@ type Fpos_t = X__fpos64_t /* stdio.h:86:20 */ // If we are compiling with optimizing read this file. It contains // several optimizing inline functions and macros. -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/stdio/stdio_netbsd_amd64.go b/vendor/modernc.org/libc/stdio/stdio_netbsd_amd64.go new file mode 100644 index 00000000..8176334c --- /dev/null +++ b/vendor/modernc.org/libc/stdio/stdio_netbsd_amd64.go @@ -0,0 +1,505 @@ +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_netbsd_amd64.go -pkgname stdio', DO NOT EDIT. + +package stdio + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BUFSIZ = 1024 + EOF = -1 + FILENAME_MAX = 1024 + FIXINC_WRAP_STDIO_H_STDIO_STDARG_H = 1 + FOPEN_MAX = 20 + FPARSELN_UNESCALL = 0x0f + FPARSELN_UNESCCOMM = 0x04 + FPARSELN_UNESCCONT = 0x02 + FPARSELN_UNESCESC = 0x01 + FPARSELN_UNESCREST = 0x08 + L_ctermid = 1024 + L_cuserid = 9 + L_tmpnam = 1024 + P_tmpdir = "/tmp/" + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + TMP_MAX = 308915776 + X_AMD64_INT_TYPES_H_ = 0 + X_FILE_OFFSET_BITS = 64 + X_FSTDIO = 0 + X_IOFBF = 0 + X_IOLBF = 1 + X_IONBF = 2 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_STDIO_H_ = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_NULL_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/stdio.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// Copyright (C) 1989-2020 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. +// +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// ISO C Standard: 7.15 Variable arguments + +// Define __gnuc_va_list. + +type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:40:27 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ +type Ssize_t = int64 /* stdio.h:63:23 */ + +// $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ + +// Written by Klaus Klein , December 22, 1999. +// Public domain. + +// This is fairly grotesque, but pure ANSI code must not inspect the +// innards of an fpos_t anyway. The library internally uses off_t, +// which we assume is exactly as big as eight chars. +type X__sfpos = struct { + F_pos X__off_t + F_mbstate_in X__mbstate_t + F_mbstate_out X__mbstate_t +} /* stdio.h:81:9 */ + +// $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ + +// Written by Klaus Klein , December 22, 1999. +// Public domain. + +// This is fairly grotesque, but pure ANSI code must not inspect the +// innards of an fpos_t anyway. The library internally uses off_t, +// which we assume is exactly as big as eight chars. +type Fpos_t = X__sfpos /* stdio.h:84:3 */ + +// NB: to fit things in six character monocase externals, the stdio +// code uses the prefix `__s' for stdio objects, typically followed +// by a three-character attempt at a mnemonic. + +// stdio buffers +type X__sbuf = struct { + F_base uintptr + F_size int32 + _ [4]byte +} /* stdio.h:95:1 */ + +// stdio state variables. +// +// The following always hold: +// +// if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), +// _lbfsize is -_bf._size, else _lbfsize is 0 +// if _flags&__SRD, _w is 0 +// if _flags&__SWR, _r is 0 +// +// This ensures that the getc and putc macros (or inline functions) never +// try to write or read from a file that is in `read' or `write' mode. +// (Moreover, they can, and do, automatically switch from read mode to +// write mode, and back, on "r+" and "w+" files.) +// +// _lbfsize is used only to make the inline line-buffered output stream +// code as compact as possible. +// +// _ub, _up, and _ur are used when ungetc() pushes back more characters +// than fit in the current _bf, or when ungetc() pushes back a character +// that does not match the previous one in _bf. When this happens, +// _ub._base becomes non-nil (i.e., a stream has ungetc() data iff +// _ub._base!=NULL) and _up and _ur save the current values of _p and _r. +// +// NB: see WARNING above before changing the layout of this structure! +type X__sFILE = struct { + F_p uintptr + F_r int32 + F_w int32 + F_flags uint16 + F_file int16 + _ [4]byte + F_bf struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_lbfsize int32 + _ [4]byte + F_cookie uintptr + F_close uintptr + F_read uintptr + F_seek uintptr + F_write uintptr + F_ext struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_up uintptr + F_ur int32 + F_ubuf [3]uint8 + F_nbuf [1]uint8 + F_flush uintptr + F_lb_unused [8]int8 + F_blksize int32 + _ [4]byte + F_offset X__off_t +} /* stdio.h:126:9 */ + +// stdio state variables. +// +// The following always hold: +// +// if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), +// _lbfsize is -_bf._size, else _lbfsize is 0 +// if _flags&__SRD, _w is 0 +// if _flags&__SWR, _r is 0 +// +// This ensures that the getc and putc macros (or inline functions) never +// try to write or read from a file that is in `read' or `write' mode. +// (Moreover, they can, and do, automatically switch from read mode to +// write mode, and back, on "r+" and "w+" files.) +// +// _lbfsize is used only to make the inline line-buffered output stream +// code as compact as possible. +// +// _ub, _up, and _ur are used when ungetc() pushes back more characters +// than fit in the current _bf, or when ungetc() pushes back a character +// that does not match the previous one in _bf. When this happens, +// _ub._base becomes non-nil (i.e., a stream has ungetc() data iff +// _ub._base!=NULL) and _up and _ur save the current values of _p and _r. +// +// NB: see WARNING above before changing the layout of this structure! +type FILE = X__sFILE /* stdio.h:160:3 */ + +// X/Open CAE Specification Issue 5 Version 2 +type Off_t = X__off_t /* stdio.h:390:18 */ + +type Locale_t = uintptr /* stdio.h:557:25 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/stdio/stdio_windows_386.go b/vendor/modernc.org/libc/stdio/stdio_windows_386.go index e351756b..be5391c0 100644 --- a/vendor/modernc.org/libc/stdio/stdio_windows_386.go +++ b/vendor/modernc.org/libc/stdio/stdio_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_386.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_386.go -pkgname stdio', DO NOT EDIT. package stdio @@ -13,3 +13,339 @@ var _ = math.Pi var _ reflect.Kind var _ atomic.Value var _ unsafe.Pointer + +const ( + BUFSIZ = 512 + DUMMYSTRUCTNAME = 0 + DUMMYSTRUCTNAME1 = 0 + DUMMYSTRUCTNAME2 = 0 + DUMMYSTRUCTNAME3 = 0 + DUMMYSTRUCTNAME4 = 0 + DUMMYSTRUCTNAME5 = 0 + DUMMYUNIONNAME = 0 + DUMMYUNIONNAME1 = 0 + DUMMYUNIONNAME2 = 0 + DUMMYUNIONNAME3 = 0 + DUMMYUNIONNAME4 = 0 + DUMMYUNIONNAME5 = 0 + DUMMYUNIONNAME6 = 0 + DUMMYUNIONNAME7 = 0 + DUMMYUNIONNAME8 = 0 + DUMMYUNIONNAME9 = 0 + EOF = -1 + FILENAME_MAX = 260 + FOPEN_MAX = 20 + MINGW_DDK_H = 0 + MINGW_DDRAW_VERSION = 7 + MINGW_HAS_DDK_H = 1 + MINGW_HAS_DDRAW_H = 1 + MINGW_HAS_SECURE_API = 1 + MINGW_SDK_INIT = 0 + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + STDERR_FILENO = 2 + STDIN_FILENO = 0 + STDOUT_FILENO = 1 + SYS_OPEN = 20 + TMP_MAX = 32767 + UNALIGNED = 0 + USE___UUIDOF = 0 + WIN32 = 1 + WINNT = 1 + X_AGLOBAL = 0 + X_ANONYMOUS_STRUCT = 0 + X_ANONYMOUS_UNION = 0 + X_ARGMAX = 100 + X_CONST_RETURN = 0 + X_CRTNOALIAS = 0 + X_CRTRESTRICT = 0 + X_CRT_ALTERNATIVE_IMPORTED = 0 + X_CRT_DIRECTORY_DEFINED = 0 + X_CRT_MANAGED_HEAP_DEPRECATE = 0 + X_CRT_PACKING = 8 + X_CRT_PERROR_DEFINED = 0 + X_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES = 0 + X_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY = 0 + X_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES = 0 + X_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT = 0 + X_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY = 0 + X_CRT_WPERROR_DEFINED = 0 + X_DLL = 0 + X_ERRCODE_DEFINED = 0 + X_FILE_DEFINED = 0 + X_FILE_OFFSET_BITS = 64 + X_FILE_OFFSET_BITS_SET_FSEEKO = 0 + X_FILE_OFFSET_BITS_SET_FTELLO = 0 + X_FILE_OFFSET_BITS_SET_OFFT = 0 + X_FPOS_T_DEFINED = 0 + X_INC_CRTDEFS = 0 + X_INC_CRTDEFS_MACRO = 0 + X_INC_MINGW_SECAPI = 0 + X_INC_STDIO = 0 + X_INC_STDIO_S = 0 + X_INC_SWPRINTF_INL = 0 + X_INC_VADEFS = 0 + X_INC__MINGW_H = 0 + X_INT128_DEFINED = 0 + X_INTEGRAL_MAX_BITS = 64 + X_INTPTR_T_DEFINED = 0 + X_IOB_ENTRIES = 20 + X_IOEOF = 0x0010 + X_IOERR = 0x0020 + X_IOFBF = 0x0000 + X_IOLBF = 0x0040 + X_IOMYBUF = 0x0008 + X_IONBF = 0x0004 + X_IOREAD = 0x0001 + X_IORW = 0x0080 + X_IOSTRG = 0x0040 + X_IOWRT = 0x0002 + X_MT = 0 + X_M_IX86 = 600 + X_NFILE = 512 + X_NSTREAM_ = 512 + X_OFF64_T_DEFINED = 0 + X_OFF_T_ = 0 + X_OFF_T_DEFINED = 0 + X_OLD_P_OVERLAY = 2 + X_PGLOBAL = 0 + X_PTRDIFF_T_ = 0 + X_PTRDIFF_T_DEFINED = 0 + X_P_DETACH = 4 + X_P_NOWAIT = 1 + X_P_NOWAITO = 3 + X_P_OVERLAY = 2 + X_P_WAIT = 0 + X_P_tmpdir = "\\" + X_RSIZE_T_DEFINED = 0 + X_SECURECRT_FILL_BUFFER_PATTERN = 0xFD + X_SIZE_T_DEFINED = 0 + X_SPAWNV_DEFINED = 0 + X_SSIZE_T_DEFINED = 0 + X_STDIO_DEFINED = 0 + X_STDIO_S_DEFINED = 0 + X_STDSTREAM_DEFINED = 0 + X_SYS_OPEN = 20 + X_TAGLC_ID_DEFINED = 0 + X_THREADLOCALEINFO = 0 + X_TIME32_T_DEFINED = 0 + X_TIME64_T_DEFINED = 0 + X_TIME_T_DEFINED = 0 + X_TWO_DIGIT_EXPONENT = 0x1 + X_UINTPTR_T_DEFINED = 0 + X_USE_32BIT_TIME_T = 0 + X_VA_LIST_DEFINED = 0 + X_W64 = 0 + X_WAIT_CHILD = 0 + X_WAIT_GRANDCHILD = 1 + X_WCHAR_T_DEFINED = 0 + X_WCTYPE_T_DEFINED = 0 + X_WIN32 = 1 + X_WIN32_WINNT = 0x502 + X_WINT_T = 0 + X_WSPAWN_DEFINED = 0 + X_WSTDIO_DEFINED = 0 + X_WSTDIO_S_DEFINED = 0 + X_X86_ = 1 + I386 = 1 +) + +type Ptrdiff_t = int32 /* :3:26 */ + +type Size_t = uint32 /* :9:23 */ + +type Wchar_t = uint16 /* :15:24 */ + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +type Va_list = X__builtin_va_list /* :50:27 */ + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// This macro holds an monotonic increasing value, which indicates +// a specific fix/patch is present on trunk. This value isn't related to +// minor/major version-macros. It is increased on demand, if a big +// fix was applied to trunk. This macro gets just increased on trunk. For +// other branches its value won't be modified. + +// mingw.org's version macros: these make gcc to define +// MINGW32_SUPPORTS_MT_EH and to use the _CRT_MT global +// and the __mingwthr_key_dtor() function from the MinGW +// CRT in its private gthr-win32.h header. + +// Set VC specific compiler target macros. + +// For x86 we have always to prefix by underscore. + +// Special case nameless struct/union. + +// MinGW-w64 has some additional C99 printf/scanf feature support. +// So we add some helper macros to ease recognition of them. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// http://msdn.microsoft.com/en-us/library/ms175759%28v=VS.100%29.aspx +// Templates won't work in C, will break if secure API is not enabled, disabled + +// https://blogs.msdn.com/b/sdl/archive/2010/02/16/vc-2010-and-memcpy.aspx?Redirected=true +// fallback on default implementation if we can't know the size of the destination + +// Include _cygwin.h if we're building a Cygwin application. + +// Target specific macro replacement for type "long". In the Windows API, +// the type long is always 32 bit, even if the target is 64 bit (LLP64). +// On 64 bit Cygwin, the type long is 64 bit (LP64). So, to get the right +// sized definitions and declarations, all usage of type long in the Windows +// headers have to be replaced by the below defined macro __LONG32. + +// C/C++ specific language defines. + +// Note the extern. This is needed to work around GCC's +// limitations in handling dllimport attribute. + +// Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's +// variadiac macro facility, because variadic macros cause syntax +// errors with --traditional-cpp. + +// High byte is the major version, low byte is the minor. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +type X__gnuc_va_list = X__builtin_va_list /* vadefs.h:24:29 */ + +type Ssize_t = int32 /* crtdefs.h:47:13 */ + +type Rsize_t = Size_t /* crtdefs.h:52:16 */ + +type Intptr_t = int32 /* crtdefs.h:64:13 */ + +type Uintptr_t = uint32 /* crtdefs.h:77:22 */ + +type Wint_t = uint16 /* crtdefs.h:106:24 */ +type Wctype_t = uint16 /* crtdefs.h:107:24 */ + +type Errno_t = int32 /* crtdefs.h:113:13 */ + +type X__time32_t = int32 /* crtdefs.h:118:14 */ + +type X__time64_t = int64 /* crtdefs.h:123:35 */ + +type Time_t = X__time32_t /* crtdefs.h:136:20 */ + +type Threadlocaleinfostruct = struct { + Frefcount int32 + Flc_codepage uint32 + Flc_collate_cp uint32 + Flc_handle [6]uint32 + Flc_id [6]LC_ID + Flc_category [6]struct { + Flocale uintptr + Fwlocale uintptr + Frefcount uintptr + Fwrefcount uintptr + } + Flc_clike int32 + Fmb_cur_max int32 + Flconv_intl_refcount uintptr + Flconv_num_refcount uintptr + Flconv_mon_refcount uintptr + Flconv uintptr + Fctype1_refcount uintptr + Fctype1 uintptr + Fpctype uintptr + Fpclmap uintptr + Fpcumap uintptr + Flc_time_curr uintptr +} /* crtdefs.h:422:1 */ + +type Pthreadlocinfo = uintptr /* crtdefs.h:424:39 */ +type Pthreadmbcinfo = uintptr /* crtdefs.h:425:36 */ + +type Localeinfo_struct = struct { + Flocinfo Pthreadlocinfo + Fmbcinfo Pthreadmbcinfo +} /* crtdefs.h:428:9 */ + +type X_locale_tstruct = Localeinfo_struct /* crtdefs.h:431:3 */ +type X_locale_t = uintptr /* crtdefs.h:431:19 */ + +type TagLC_ID = struct { + FwLanguage uint16 + FwCountry uint16 + FwCodePage uint16 +} /* crtdefs.h:422:1 */ + +type LC_ID = TagLC_ID /* crtdefs.h:439:3 */ +type LPLC_ID = uintptr /* crtdefs.h:439:9 */ + +type Threadlocinfo = Threadlocaleinfostruct /* crtdefs.h:468:3 */ + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// Undefine __mingw_ macros. + +type X_iobuf = struct { + F_ptr uintptr + F_cnt int32 + F_base uintptr + F_flag int32 + F_file int32 + F_charbuf int32 + F_bufsiz int32 + F_tmpfname uintptr +} /* stdio.h:26:3 */ + +type FILE = X_iobuf /* stdio.h:36:25 */ + +type X_off_t = int32 /* _mingw_off_t.h:5:16 */ +type Off32_t = int32 /* _mingw_off_t.h:7:16 */ + +type X_off64_t = int64 /* _mingw_off_t.h:13:39 */ +type Off64_t = int64 /* _mingw_off_t.h:15:39 */ + +type Off_t = Off64_t /* _mingw_off_t.h:24:17 */ // A pointer to an array of FILE + +type Fpos_t = int64 /* stdio.h:104:37 */ + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// Define __mingw_ macros. + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/stdio/stdio_windows_amd64.go b/vendor/modernc.org/libc/stdio/stdio_windows_amd64.go index 609da520..1424d3d6 100644 --- a/vendor/modernc.org/libc/stdio/stdio_windows_amd64.go +++ b/vendor/modernc.org/libc/stdio/stdio_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_amd64.go -pkgname stdio', DO NOT EDIT. +// Code generated by 'ccgo stdio/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o stdio/stdio_windows_amd64.go -pkgname stdio', DO NOT EDIT. package stdio @@ -13,3 +13,352 @@ var _ = math.Pi var _ reflect.Kind var _ atomic.Value var _ unsafe.Pointer + +const ( + BUFSIZ = 512 + DUMMYSTRUCTNAME = 0 + DUMMYSTRUCTNAME1 = 0 + DUMMYSTRUCTNAME2 = 0 + DUMMYSTRUCTNAME3 = 0 + DUMMYSTRUCTNAME4 = 0 + DUMMYSTRUCTNAME5 = 0 + DUMMYUNIONNAME = 0 + DUMMYUNIONNAME1 = 0 + DUMMYUNIONNAME2 = 0 + DUMMYUNIONNAME3 = 0 + DUMMYUNIONNAME4 = 0 + DUMMYUNIONNAME5 = 0 + DUMMYUNIONNAME6 = 0 + DUMMYUNIONNAME7 = 0 + DUMMYUNIONNAME8 = 0 + DUMMYUNIONNAME9 = 0 + EOF = -1 + FILENAME_MAX = 260 + FOPEN_MAX = 20 + MINGW_DDK_H = 0 + MINGW_DDRAW_VERSION = 7 + MINGW_HAS_DDK_H = 1 + MINGW_HAS_DDRAW_H = 1 + MINGW_HAS_SECURE_API = 1 + MINGW_SDK_INIT = 0 + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + STDERR_FILENO = 2 + STDIN_FILENO = 0 + STDOUT_FILENO = 1 + SYS_OPEN = 20 + TMP_MAX = 32767 + UNALIGNED = 0 + USE___UUIDOF = 0 + WIN32 = 1 + WIN64 = 1 + WINNT = 1 + X_AGLOBAL = 0 + X_ANONYMOUS_STRUCT = 0 + X_ANONYMOUS_UNION = 0 + X_ARGMAX = 100 + X_CONST_RETURN = 0 + X_CRTNOALIAS = 0 + X_CRTRESTRICT = 0 + X_CRT_ALTERNATIVE_IMPORTED = 0 + X_CRT_DIRECTORY_DEFINED = 0 + X_CRT_MANAGED_HEAP_DEPRECATE = 0 + X_CRT_PACKING = 8 + X_CRT_PERROR_DEFINED = 0 + X_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES = 0 + X_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY = 0 + X_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES = 0 + X_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT = 0 + X_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY = 0 + X_CRT_WPERROR_DEFINED = 0 + X_DLL = 0 + X_ERRCODE_DEFINED = 0 + X_FILE_DEFINED = 0 + X_FILE_OFFSET_BITS = 64 + X_FILE_OFFSET_BITS_SET_FSEEKO = 0 + X_FILE_OFFSET_BITS_SET_FTELLO = 0 + X_FILE_OFFSET_BITS_SET_OFFT = 0 + X_FPOS_T_DEFINED = 0 + X_INC_CRTDEFS = 0 + X_INC_CRTDEFS_MACRO = 0 + X_INC_MINGW_SECAPI = 0 + X_INC_STDIO = 0 + X_INC_STDIO_S = 0 + X_INC_SWPRINTF_INL = 0 + X_INC_VADEFS = 0 + X_INC__MINGW_H = 0 + X_INT128_DEFINED = 0 + X_INTEGRAL_MAX_BITS = 64 + X_INTPTR_T_DEFINED = 0 + X_IOB_ENTRIES = 20 + X_IOEOF = 0x0010 + X_IOERR = 0x0020 + X_IOFBF = 0x0000 + X_IOLBF = 0x0040 + X_IOMYBUF = 0x0008 + X_IONBF = 0x0004 + X_IOREAD = 0x0001 + X_IORW = 0x0080 + X_IOSTRG = 0x0040 + X_IOWRT = 0x0002 + X_MT = 0 + X_M_AMD64 = 100 + X_M_X64 = 100 + X_NFILE = 512 + X_NSTREAM_ = 512 + X_OFF64_T_DEFINED = 0 + X_OFF_T_ = 0 + X_OFF_T_DEFINED = 0 + X_OLD_P_OVERLAY = 2 + X_PGLOBAL = 0 + X_PTRDIFF_T_ = 0 + X_PTRDIFF_T_DEFINED = 0 + X_P_DETACH = 4 + X_P_NOWAIT = 1 + X_P_NOWAITO = 3 + X_P_OVERLAY = 2 + X_P_WAIT = 0 + X_P_tmpdir = "\\" + X_RSIZE_T_DEFINED = 0 + X_SECURECRT_FILL_BUFFER_PATTERN = 0xFD + X_SIZE_T_DEFINED = 0 + X_SPAWNV_DEFINED = 0 + X_SSIZE_T_DEFINED = 0 + X_STDIO_DEFINED = 0 + X_STDIO_S_DEFINED = 0 + X_STDSTREAM_DEFINED = 0 + X_SYS_OPEN = 20 + X_TAGLC_ID_DEFINED = 0 + X_THREADLOCALEINFO = 0 + X_TIME32_T_DEFINED = 0 + X_TIME64_T_DEFINED = 0 + X_TIME_T_DEFINED = 0 + X_TWO_DIGIT_EXPONENT = 0x1 + X_UINTPTR_T_DEFINED = 0 + X_VA_LIST_DEFINED = 0 + X_W64 = 0 + X_WAIT_CHILD = 0 + X_WAIT_GRANDCHILD = 1 + X_WCHAR_T_DEFINED = 0 + X_WCTYPE_T_DEFINED = 0 + X_WIN32 = 1 + X_WIN32_WINNT = 0x502 + X_WIN64 = 1 + X_WINT_T = 0 + X_WSPAWN_DEFINED = 0 + X_WSTDIO_DEFINED = 0 + X_WSTDIO_S_DEFINED = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = uint16 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +type Va_list = X__builtin_va_list /* :50:27 */ + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// This macro holds an monotonic increasing value, which indicates +// a specific fix/patch is present on trunk. This value isn't related to +// minor/major version-macros. It is increased on demand, if a big +// fix was applied to trunk. This macro gets just increased on trunk. For +// other branches its value won't be modified. + +// mingw.org's version macros: these make gcc to define +// MINGW32_SUPPORTS_MT_EH and to use the _CRT_MT global +// and the __mingwthr_key_dtor() function from the MinGW +// CRT in its private gthr-win32.h header. + +// Set VC specific compiler target macros. + +// MS does not prefix symbols by underscores for 64-bit. +// As we have to support older gcc version, which are using underscores +// as symbol prefix for x64, we have to check here for the user label +// prefix defined by gcc. + +// Special case nameless struct/union. + +// MinGW-w64 has some additional C99 printf/scanf feature support. +// So we add some helper macros to ease recognition of them. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// http://msdn.microsoft.com/en-us/library/ms175759%28v=VS.100%29.aspx +// Templates won't work in C, will break if secure API is not enabled, disabled + +// https://blogs.msdn.com/b/sdl/archive/2010/02/16/vc-2010-and-memcpy.aspx?Redirected=true +// fallback on default implementation if we can't know the size of the destination + +// Include _cygwin.h if we're building a Cygwin application. + +// Target specific macro replacement for type "long". In the Windows API, +// the type long is always 32 bit, even if the target is 64 bit (LLP64). +// On 64 bit Cygwin, the type long is 64 bit (LP64). So, to get the right +// sized definitions and declarations, all usage of type long in the Windows +// headers have to be replaced by the below defined macro __LONG32. + +// C/C++ specific language defines. + +// Note the extern. This is needed to work around GCC's +// limitations in handling dllimport attribute. + +// Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's +// variadiac macro facility, because variadic macros cause syntax +// errors with --traditional-cpp. + +// High byte is the major version, low byte is the minor. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +type X__gnuc_va_list = X__builtin_va_list /* vadefs.h:24:29 */ + +type Ssize_t = int64 /* crtdefs.h:45:35 */ + +type Rsize_t = Size_t /* crtdefs.h:52:16 */ + +type Intptr_t = int64 /* crtdefs.h:62:35 */ + +type Uintptr_t = uint64 /* crtdefs.h:75:44 */ + +type Wint_t = uint16 /* crtdefs.h:106:24 */ +type Wctype_t = uint16 /* crtdefs.h:107:24 */ + +type Errno_t = int32 /* crtdefs.h:113:13 */ + +type X__time32_t = int32 /* crtdefs.h:118:14 */ + +type X__time64_t = int64 /* crtdefs.h:123:35 */ + +type Time_t = X__time64_t /* crtdefs.h:138:20 */ + +type Threadlocaleinfostruct = struct { + Frefcount int32 + Flc_codepage uint32 + Flc_collate_cp uint32 + Flc_handle [6]uint32 + Flc_id [6]LC_ID + Flc_category [6]struct { + Flocale uintptr + Fwlocale uintptr + Frefcount uintptr + Fwrefcount uintptr + } + Flc_clike int32 + Fmb_cur_max int32 + Flconv_intl_refcount uintptr + Flconv_num_refcount uintptr + Flconv_mon_refcount uintptr + Flconv uintptr + Fctype1_refcount uintptr + Fctype1 uintptr + Fpctype uintptr + Fpclmap uintptr + Fpcumap uintptr + Flc_time_curr uintptr +} /* crtdefs.h:422:1 */ + +type Pthreadlocinfo = uintptr /* crtdefs.h:424:39 */ +type Pthreadmbcinfo = uintptr /* crtdefs.h:425:36 */ + +type Localeinfo_struct = struct { + Flocinfo Pthreadlocinfo + Fmbcinfo Pthreadmbcinfo +} /* crtdefs.h:428:9 */ + +type X_locale_tstruct = Localeinfo_struct /* crtdefs.h:431:3 */ +type X_locale_t = uintptr /* crtdefs.h:431:19 */ + +type TagLC_ID = struct { + FwLanguage uint16 + FwCountry uint16 + FwCodePage uint16 +} /* crtdefs.h:422:1 */ + +type LC_ID = TagLC_ID /* crtdefs.h:439:3 */ +type LPLC_ID = uintptr /* crtdefs.h:439:9 */ + +type Threadlocinfo = Threadlocaleinfostruct /* crtdefs.h:468:3 */ + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// Undefine __mingw_ macros. + +type X_iobuf = struct { + F_ptr uintptr + F_cnt int32 + _ [4]byte + F_base uintptr + F_flag int32 + F_file int32 + F_charbuf int32 + F_bufsiz int32 + F_tmpfname uintptr +} /* stdio.h:26:3 */ + +type FILE = X_iobuf /* stdio.h:36:25 */ + +type X_off_t = int32 /* _mingw_off_t.h:5:16 */ +type Off32_t = int32 /* _mingw_off_t.h:7:16 */ + +type X_off64_t = int64 /* _mingw_off_t.h:13:39 */ +type Off64_t = int64 /* _mingw_off_t.h:15:39 */ + +type Off_t = Off64_t /* _mingw_off_t.h:24:17 */ + +type Fpos_t = int64 /* stdio.h:104:37 */ + +// * +// This file has no copyright assigned and is placed in the Public Domain. +// This file is part of the mingw-w64 runtime package. +// No warranty is given; refer to the file DISCLAIMER.PD within this package. + +// Define __mingw_ macros. + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/socket/capi_darwin_amd64.go b/vendor/modernc.org/libc/sys/socket/capi_darwin_amd64.go index f8510ada..b0f3be1d 100644 --- a/vendor/modernc.org/libc/sys/socket/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/sys/socket/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_darwin_amd64.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_darwin_amd64.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/capi_freebsd_amd64.go b/vendor/modernc.org/libc/sys/socket/capi_freebsd_amd64.go new file mode 100644 index 00000000..03826109 --- /dev/null +++ b/vendor/modernc.org/libc/sys/socket/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_freebsd_amd64.go -pkgname socket', DO NOT EDIT. + +package socket + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/sys/socket/capi_linux_386.go b/vendor/modernc.org/libc/sys/socket/capi_linux_386.go index 0bf21fb3..0911eab5 100644 --- a/vendor/modernc.org/libc/sys/socket/capi_linux_386.go +++ b/vendor/modernc.org/libc/sys/socket/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_386.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_386.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/capi_linux_amd64.go b/vendor/modernc.org/libc/sys/socket/capi_linux_amd64.go index 54a802f1..57ceee42 100644 --- a/vendor/modernc.org/libc/sys/socket/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/sys/socket/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_amd64.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_amd64.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/capi_linux_arm.go b/vendor/modernc.org/libc/sys/socket/capi_linux_arm.go index ce1a6de6..34259749 100644 --- a/vendor/modernc.org/libc/sys/socket/capi_linux_arm.go +++ b/vendor/modernc.org/libc/sys/socket/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/capi_linux_arm64.go b/vendor/modernc.org/libc/sys/socket/capi_linux_arm64.go index 171b288d..0464f888 100644 --- a/vendor/modernc.org/libc/sys/socket/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/sys/socket/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm64.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm64.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/capi_linux_s390x.go b/vendor/modernc.org/libc/sys/socket/capi_linux_s390x.go index a5f4520e..5f53ef43 100644 --- a/vendor/modernc.org/libc/sys/socket/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/sys/socket/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_s390x.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_s390x.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/capi_netbsd_amd64.go b/vendor/modernc.org/libc/sys/socket/capi_netbsd_amd64.go new file mode 100644 index 00000000..d640c064 --- /dev/null +++ b/vendor/modernc.org/libc/sys/socket/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_netbsd_amd64.go -pkgname socket', DO NOT EDIT. + +package socket + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/sys/socket/socket_darwin_amd64.go b/vendor/modernc.org/libc/sys/socket/socket_darwin_amd64.go index 0be1d54d..3247100d 100644 --- a/vendor/modernc.org/libc/sys/socket/socket_darwin_amd64.go +++ b/vendor/modernc.org/libc/sys/socket/socket_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_darwin_amd64.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_darwin_amd64.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/socket_freebsd_amd64.go b/vendor/modernc.org/libc/sys/socket/socket_freebsd_amd64.go new file mode 100644 index 00000000..d5a87e17 --- /dev/null +++ b/vendor/modernc.org/libc/sys/socket/socket_freebsd_amd64.go @@ -0,0 +1,1159 @@ +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_freebsd_amd64.go -pkgname socket', DO NOT EDIT. + +package socket + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AF_APPLETALK = 16 + AF_ARP = 35 + AF_ATM = 30 + AF_BLUETOOTH = 36 + AF_CCITT = 10 + AF_CHAOS = 5 + AF_CNT = 21 + AF_COIP = 20 + AF_DATAKIT = 9 + AF_DECnet = 12 + AF_DLI = 13 + AF_E164 = 26 + AF_ECMA = 8 + AF_HYLINK = 15 + AF_HYPERV = 43 + AF_IEEE80211 = 37 + AF_IMPLINK = 3 + AF_INET = 2 + AF_INET6 = 28 + AF_INET6_SDP = 42 + AF_INET_SDP = 40 + AF_IPX = 23 + AF_ISDN = 26 + AF_ISO = 7 + AF_LAT = 14 + AF_LINK = 18 + AF_LOCAL = 1 + AF_MAX = 43 + AF_NATM = 29 + AF_NETBIOS = 6 + AF_NETGRAPH = 32 + AF_OSI = 7 + AF_PUP = 4 + AF_ROUTE = 17 + AF_SCLUSTER = 34 + AF_SIP = 24 + AF_SLOW = 33 + AF_SNA = 11 + AF_UNIX = 1 + AF_UNSPEC = 0 + AF_VENDOR00 = 39 + AF_VENDOR01 = 41 + AF_VENDOR03 = 45 + AF_VENDOR04 = 47 + AF_VENDOR05 = 49 + AF_VENDOR06 = 51 + AF_VENDOR07 = 53 + AF_VENDOR08 = 55 + AF_VENDOR09 = 57 + AF_VENDOR10 = 59 + AF_VENDOR11 = 61 + AF_VENDOR12 = 63 + AF_VENDOR13 = 65 + AF_VENDOR14 = 67 + AF_VENDOR15 = 69 + AF_VENDOR16 = 71 + AF_VENDOR17 = 73 + AF_VENDOR18 = 75 + AF_VENDOR19 = 77 + AF_VENDOR20 = 79 + AF_VENDOR21 = 81 + AF_VENDOR22 = 83 + AF_VENDOR23 = 85 + AF_VENDOR24 = 87 + AF_VENDOR25 = 89 + AF_VENDOR26 = 91 + AF_VENDOR27 = 93 + AF_VENDOR28 = 95 + AF_VENDOR29 = 97 + AF_VENDOR30 = 99 + AF_VENDOR31 = 101 + AF_VENDOR32 = 103 + AF_VENDOR33 = 105 + AF_VENDOR34 = 107 + AF_VENDOR35 = 109 + AF_VENDOR36 = 111 + AF_VENDOR37 = 113 + AF_VENDOR38 = 115 + AF_VENDOR39 = 117 + AF_VENDOR40 = 119 + AF_VENDOR41 = 121 + AF_VENDOR42 = 123 + AF_VENDOR43 = 125 + AF_VENDOR44 = 127 + AF_VENDOR45 = 129 + AF_VENDOR46 = 131 + AF_VENDOR47 = 133 + CMGROUP_MAX = 16 + MSG_CMSG_CLOEXEC = 0x00040000 + MSG_COMPAT = 0x00008000 + MSG_CTRUNC = 0x00000020 + MSG_DONTROUTE = 0x00000004 + MSG_DONTWAIT = 0x00000080 + MSG_EOF = 0x00000100 + MSG_EOR = 0x00000008 + MSG_NBIO = 0x00004000 + MSG_NOSIGNAL = 0x00020000 + MSG_NOTIFICATION = 0x00002000 + MSG_OOB = 0x00000001 + MSG_PEEK = 0x00000002 + MSG_TRUNC = 0x00000010 + MSG_WAITALL = 0x00000040 + MSG_WAITFORONE = 0x00080000 + NET_RT_DUMP = 1 + NET_RT_FLAGS = 2 + NET_RT_IFLIST = 3 + NET_RT_IFLISTL = 5 + NET_RT_IFMALIST = 4 + NET_RT_NHGRP = 7 + NET_RT_NHOP = 6 + PF_APPLETALK = 16 + PF_ARP = 35 + PF_ATM = 30 + PF_BLUETOOTH = 36 + PF_CCITT = 10 + PF_CHAOS = 5 + PF_CNT = 21 + PF_COIP = 20 + PF_DATAKIT = 9 + PF_DECnet = 12 + PF_DLI = 13 + PF_ECMA = 8 + PF_HYLINK = 15 + PF_IEEE80211 = 37 + PF_IMPLINK = 3 + PF_INET = 2 + PF_INET6 = 28 + PF_INET6_SDP = 42 + PF_INET_SDP = 40 + PF_IPX = 23 + PF_ISDN = 26 + PF_ISO = 7 + PF_KEY = 27 + PF_LAT = 14 + PF_LINK = 18 + PF_LOCAL = 1 + PF_MAX = 43 + PF_NATM = 29 + PF_NETBIOS = 6 + PF_NETGRAPH = 32 + PF_OSI = 7 + PF_PIP = 25 + PF_PUP = 4 + PF_ROUTE = 17 + PF_RTIP = 22 + PF_SCLUSTER = 34 + PF_SIP = 24 + PF_SLOW = 33 + PF_SNA = 11 + PF_UNIX = 1 + PF_UNSPEC = 0 + PF_XTP = 19 + PRU_FLUSH_RD = 0 + PRU_FLUSH_RDWR = 2 + PRU_FLUSH_WR = 1 + SCM_BINTIME = 0x04 + SCM_CREDS = 0x03 + SCM_CREDS2 = 0x08 + SCM_MONOTONIC = 0x06 + SCM_REALTIME = 0x05 + SCM_RIGHTS = 0x01 + SCM_TIMESTAMP = 0x02 + SCM_TIME_INFO = 0x07 + SF_MNOWAIT = 0x00000002 + SF_NOCACHE = 0x00000010 + SF_NODISKIO = 0x00000001 + SF_SYNC = 0x00000004 + SF_USER_READAHEAD = 0x00000008 + SHUT_RD = 0 + SHUT_RDWR = 2 + SHUT_WR = 1 + SOCK_CLOEXEC = 0x10000000 + SOCK_DGRAM = 2 + SOCK_MAXADDRLEN = 255 + SOCK_NONBLOCK = 0x20000000 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 + SOCK_STREAM = 1 + SOL_SOCKET = 0xffff + SOMAXCONN = 128 + SO_ACCEPTCONN = 0x00000002 + SO_ACCEPTFILTER = 0x00001000 + SO_BINTIME = 0x00002000 + SO_BROADCAST = 0x00000020 + SO_DEBUG = 0x00000001 + SO_DOMAIN = 0x1019 + SO_DONTROUTE = 0x00000010 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x00000008 + SO_LABEL = 0x1009 + SO_LINGER = 0x00000080 + SO_LISTENINCQLEN = 0x1013 + SO_LISTENQLEN = 0x1012 + SO_LISTENQLIMIT = 0x1011 + SO_MAX_PACING_RATE = 0x1018 + SO_NOSIGPIPE = 0x00000800 + SO_NO_DDP = 0x00008000 + SO_NO_OFFLOAD = 0x00004000 + SO_OOBINLINE = 0x00000100 + SO_PEERLABEL = 0x1010 + SO_PROTOCOL = 0x1016 + SO_PROTOTYPE = 4118 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x00000004 + SO_REUSEPORT = 0x00000200 + SO_REUSEPORT_LB = 0x00010000 + SO_SETFIB = 0x1014 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x00000400 + SO_TS_BINTIME = 1 + SO_TS_CLOCK = 0x1017 + SO_TS_CLOCK_MAX = 3 + SO_TS_DEFAULT = 0 + SO_TS_MONOTONIC = 3 + SO_TS_REALTIME = 2 + SO_TS_REALTIME_MICRO = 0 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x00000040 + SO_USER_COOKIE = 0x1015 + SO_VENDOR = 0x80000000 + ST_INFO_HW = 0x0001 + ST_INFO_HW_HPREC = 0x0002 + X_FILE_OFFSET_BITS = 64 + X_GID_T_DECLARED = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF_T_DECLARED = 0 + X_PID_T_DECLARED = 0 + X_SA_FAMILY_T_DECLARED = 0 + X_SIZE_T_DECLARED = 0 + X_SOCKLEN_T_DECLARED = 0 + X_SSIZE_T_DECLARED = 0 + X_SS_MAXSIZE = 128 + X_SYS_CDEFS_H_ = 0 + X_SYS_SOCKET_H_ = 0 + X_SYS__IOVEC_H_ = 0 + X_SYS__SOCKADDR_STORAGE_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_UID_T_DECLARED = 0 + X_UINT32_T_DECLARED = 0 + X_UINTPTR_T_DECLARED = 0 + X_X86_INCLUDE__ALIGN_H_ = 0 + Pseudo_AF_HDRCMPLT = 31 + Pseudo_AF_KEY = 27 + Pseudo_AF_PIP = 25 + Pseudo_AF_RTIP = 22 + Pseudo_AF_XTP = 19 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)socket.h 8.4 (Berkeley) 2/21/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ + +type Iovec = struct { + Fiov_base uintptr + Fiov_len Size_t +} /* _iovec.h:45:1 */ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2001 David E. O'Brien +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// William Jolitz. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)param.h 5.8 (Berkeley) 6/28/91 +// $FreeBSD$ + +// Round p (pointer or byte index) up to a correctly-aligned value +// for all data types (int, long, ...). The result is unsigned int +// and must be cast to any desired pointer type. + +// Definitions related to sockets: types, address families, options. + +// Data types. +type Gid_t = X__gid_t /* socket.h:52:18 */ + +type Off_t = X__off_t /* socket.h:57:18 */ + +type Pid_t = X__pid_t /* socket.h:62:18 */ + +type Sa_family_t = X__sa_family_t /* socket.h:68:23 */ + +type Socklen_t = X__socklen_t /* socket.h:73:21 */ + +type Ssize_t = X__ssize_t /* socket.h:78:19 */ + +type Uid_t = X__uid_t /* socket.h:84:18 */ + +type Uint32_t = X__uint32_t /* socket.h:90:20 */ + +type Uintptr_t = X__uintptr_t /* socket.h:95:21 */ + +// Types + +// Creation flags, OR'ed into socket() and socketpair() type argument. + +// Option flags per-socket. + +// Additional options, not kept in so_options. + +// Space reserved for new socket options added by third-party vendors. +// This range applies to all socket option levels. New socket options +// in FreeBSD should always use an option value less than SO_VENDOR. + +// Structure used for manipulating linger option. +type Linger = struct { + Fl_onoff int32 + Fl_linger int32 +} /* socket.h:198:1 */ + +type Accept_filter_arg = struct { + Faf_name [16]int8 + Faf_arg [240]int8 +} /* socket.h:204:1 */ + +// Level number for (get/set)sockopt() to apply to socket itself. + +// Address families. +// When allocating a new AF_ constant, please only allocate +// even numbered constants for FreeBSD until 134 as odd numbered AF_ +// constants 39-133 are now reserved for vendors. + +// Structure used by kernel to store most +// addresses. +type Sockaddr = struct { + Fsa_len uint8 + Fsa_family Sa_family_t + Fsa_data [14]int8 +} /* socket.h:328:1 */ + +// Structure used by kernel to pass protocol +// information in raw sockets. +type Sockproto = struct { + Fsp_family uint16 + Fsp_protocol uint16 +} /* socket.h:340:1 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)socket.h 8.4 (Berkeley) 2/21/94 +// $FreeBSD$ + +// RFC 2553: protocol-independent placeholder for socket addresses + +type Sockaddr_storage = struct { + Fss_len uint8 + Fss_family Sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 +} /* _sockaddr_storage.h:48:1 */ + +// Protocol families, same as address families for now. + +// Definitions for network related sysctl, CTL_NET. +// +// Second level is protocol family. +// Third level is protocol number. +// +// Further levels are defined by the individual families. + +// PF_ROUTE - Routing table +// +// Three additional levels are defined: +// Fourth: address family, 0 is wildcard +// Fifth: type of info, defined below +// Sixth: flag(s) to mask with for NET_RT_FLAGS + +// Maximum queue length specifiable by listen. + +// Message header for recvmsg and sendmsg calls. +// Used value-result for recvmsg, value only for sendmsg. +type Msghdr = struct { + Fmsg_name uintptr + Fmsg_namelen Socklen_t + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_control uintptr + Fmsg_controllen Socklen_t + Fmsg_flags int32 +} /* socket.h:432:1 */ + +// 0x00000200 unused +// 0x00000400 unused +// 0x00000800 unused +// 0x00001000 unused + +// Header for ancillary data objects in msg_control buffer. +// Used for additional information with/about a datagram +// not expressible by flags. The format is a sequence +// of message elements headed by cmsghdr structures. +type Cmsghdr = struct { + Fcmsg_len Socklen_t + Fcmsg_level int32 + Fcmsg_type int32 +} /* socket.h:481:1 */ + +// While we may have more groups than this, the cmsgcred struct must +// be able to fit in an mbuf and we have historically supported a +// maximum of 16 groups. + +// Credentials structure, used to verify the identity of a peer +// process that has sent us a message. This is allocated by the +// peer process but filled in by the kernel. This prevents the +// peer from lying about its identity. (Note that cmcred_groups[0] +// is the effective GID.) +type Cmsgcred = struct { + Fcmcred_pid Pid_t + Fcmcred_uid Uid_t + Fcmcred_euid Uid_t + Fcmcred_gid Gid_t + Fcmcred_ngroups int16 + _ [2]byte + Fcmcred_groups [16]Gid_t +} /* socket.h:503:1 */ + +// Socket credentials (LOCAL_CREDS). +type Sockcred = struct { + Fsc_uid Uid_t + Fsc_euid Uid_t + Fsc_gid Gid_t + Fsc_egid Gid_t + Fsc_ngroups int32 + Fsc_groups [1]Gid_t +} /* socket.h:515:1 */ + +// Compute size of a sockcred structure with groups. + +// Socket credentials (LOCAL_CREDS_PERSISTENT). +type Sockcred2 = struct { + Fsc_version int32 + Fsc_pid Pid_t + Fsc_uid Uid_t + Fsc_euid Uid_t + Fsc_gid Gid_t + Fsc_egid Gid_t + Fsc_ngroups int32 + Fsc_groups [1]Gid_t +} /* socket.h:533:1 */ + +// given pointer to struct cmsghdr, return pointer to data + +// given pointer to struct cmsghdr, return pointer to next cmsghdr + +// RFC 2292 requires to check msg_controllen, in case that the kernel returns +// an empty list for some reasons. + +// RFC 2292 additions + +// "Socket"-level control message types: + +type Sock_timestamp_info = struct { + Fst_info_flags X__uint32_t + Fst_info_pad0 X__uint32_t + Fst_info_rsv [7]X__uint64_t +} /* socket.h:592:1 */ + +// 4.3 compat sockaddr, move to compat file later +type Osockaddr = struct { + Fsa_family uint16 + Fsa_data [14]int8 +} /* socket.h:607:1 */ + +// 4.3-compat message header (move to compat file later). +type Omsghdr = struct { + Fmsg_name uintptr + Fmsg_namelen int32 + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_accrights uintptr + Fmsg_accrightslen int32 + _ [4]byte +} /* socket.h:615:1 */ + +// howto arguments for shutdown(2), specified by Posix.1g. + +// for SCTP +// we cheat and use the SHUT_XX defines for these + +// sendfile(2) header/trailer struct +type Sf_hdtr = struct { + Fheaders uintptr + Fhdr_cnt int32 + _ [4]byte + Ftrailers uintptr + Ftrl_cnt int32 + _ [4]byte +} /* socket.h:644:1 */ + +// Sendfile-specific flag(s) + +// Sendmmsg/recvmmsg specific structure(s) +type Mmsghdr = struct { + Fmsg_hdr struct { + Fmsg_name uintptr + Fmsg_namelen Socklen_t + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_control uintptr + Fmsg_controllen Socklen_t + Fmsg_flags int32 + } + Fmsg_len Ssize_t +} /* socket.h:668:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/socket/socket_linux_386.go b/vendor/modernc.org/libc/sys/socket/socket_linux_386.go index 34ef0f06..39dc0875 100644 --- a/vendor/modernc.org/libc/sys/socket/socket_linux_386.go +++ b/vendor/modernc.org/libc/sys/socket/socket_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_386.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_386.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/socket_linux_amd64.go b/vendor/modernc.org/libc/sys/socket/socket_linux_amd64.go index 42a0fc5a..10528b30 100644 --- a/vendor/modernc.org/libc/sys/socket/socket_linux_amd64.go +++ b/vendor/modernc.org/libc/sys/socket/socket_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_amd64.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_amd64.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/socket_linux_arm.go b/vendor/modernc.org/libc/sys/socket/socket_linux_arm.go index 2c9413e6..063b7113 100644 --- a/vendor/modernc.org/libc/sys/socket/socket_linux_arm.go +++ b/vendor/modernc.org/libc/sys/socket/socket_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/socket_linux_arm64.go b/vendor/modernc.org/libc/sys/socket/socket_linux_arm64.go index 073e862d..b33351c1 100644 --- a/vendor/modernc.org/libc/sys/socket/socket_linux_arm64.go +++ b/vendor/modernc.org/libc/sys/socket/socket_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm64.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_arm64.go -pkgname socket', DO NOT EDIT. package socket diff --git a/vendor/modernc.org/libc/sys/socket/socket_linux_s390x.go b/vendor/modernc.org/libc/sys/socket/socket_linux_s390x.go index 7ef69737..7a291f65 100644 --- a/vendor/modernc.org/libc/sys/socket/socket_linux_s390x.go +++ b/vendor/modernc.org/libc/sys/socket/socket_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_s390x.go -pkgname socket', DO NOT EDIT. +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_linux_s390x.go -pkgname socket', DO NOT EDIT. package socket @@ -40,7 +40,7 @@ const ( AF_KEY = 15 AF_LLC = 26 AF_LOCAL = 1 - AF_MAX = 44 + AF_MAX = 45 AF_MPLS = 28 AF_NETBEUI = 13 AF_NETLINK = 16 @@ -63,6 +63,7 @@ const ( AF_VSOCK = 40 AF_WANPIPE = 25 AF_X25 = 9 + AF_XDP = 44 BIG_ENDIAN = 4321 BYTE_ORDER = 4321 FD_SETSIZE = 1024 @@ -95,7 +96,7 @@ const ( PF_KEY = 15 PF_LLC = 26 PF_LOCAL = 1 - PF_MAX = 44 + PF_MAX = 45 PF_MPLS = 28 PF_NETBEUI = 13 PF_NETLINK = 16 @@ -118,6 +119,7 @@ const ( PF_VSOCK = 40 PF_WANPIPE = 25 PF_X25 = 9 + PF_XDP = 44 SCM_TIMESTAMP = 29 SCM_TIMESTAMPING = 37 SCM_TIMESTAMPING_OPT_STATS = 54 @@ -127,8 +129,8 @@ const ( SCM_WIFI_STATUS = 41 SIOCATMARK = 0x8905 SIOCGPGRP = 0x8904 - SIOCGSTAMP = 0x8906 - SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_OLD = 0x8906 SIOCSPGRP = 0x8902 SOL_AAL = 265 SOL_ALG = 279 @@ -154,13 +156,15 @@ const ( SOL_TIPC = 271 SOL_TLS = 282 SOL_X25 = 262 - SOMAXCONN = 128 + SOL_XDP = 283 + SOMAXCONN = 4096 SO_ACCEPTCONN = 30 SO_ATTACH_BPF = 50 SO_ATTACH_FILTER = 26 SO_ATTACH_REUSEPORT_CBPF = 51 SO_ATTACH_REUSEPORT_EBPF = 52 SO_BINDTODEVICE = 25 + SO_BINDTOIFINDEX = 62 SO_BPF_EXTENSIONS = 48 SO_BROADCAST = 6 SO_BSDCOMPAT = 14 @@ -170,6 +174,7 @@ const ( SO_DEBUG = 1 SO_DETACH_BPF = 27 SO_DETACH_FILTER = 27 + SO_DETACH_REUSEPORT_BPF = 68 SO_DOMAIN = 39 SO_DONTROUTE = 5 SO_ERROR = 4 @@ -198,6 +203,8 @@ const ( SO_RCVBUFFORCE = 33 SO_RCVLOWAT = 18 SO_RCVTIMEO = 20 + SO_RCVTIMEO_NEW = 66 + SO_RCVTIMEO_OLD = 20 SO_REUSEADDR = 2 SO_REUSEPORT = 15 SO_RXQ_OVFL = 40 @@ -209,20 +216,30 @@ const ( SO_SNDBUFFORCE = 32 SO_SNDLOWAT = 19 SO_SNDTIMEO = 21 + SO_SNDTIMEO_NEW = 67 + SO_SNDTIMEO_OLD = 21 SO_TIMESTAMP = 29 SO_TIMESTAMPING = 37 + SO_TIMESTAMPING_NEW = 65 + SO_TIMESTAMPING_OLD = 37 SO_TIMESTAMPNS = 35 + SO_TIMESTAMPNS_NEW = 64 + SO_TIMESTAMPNS_OLD = 35 + SO_TIMESTAMP_NEW = 63 + SO_TIMESTAMP_OLD = 29 SO_TXTIME = 61 SO_TYPE = 3 SO_WIFI_STATUS = 41 SO_ZEROCOPY = 60 - X_ASM_SOCKET_H = 0 X_ATFILE_SOURCE = 1 X_BITS_BYTESWAP_H = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 X_BITS_SOCKADDR_H = 1 X_BITS_STDINT_INTN_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BITS_UINTN_IDENTITY_H = 1 @@ -233,9 +250,11 @@ const ( X_FEATURES_H = 1 X_FILE_OFFSET_BITS = 64 X_GCC_SIZE_T = 0 + X_LINUX_POSIX_TYPES_H = 0 X_LP64 = 1 X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 + X_RWLOCK_INTERNAL_H = 0 X_SIZET_ = 0 X_SIZE_T = 0 X_SIZE_T_ = 0 @@ -250,6 +269,7 @@ const ( X_SYS_SIZE_T_H = 0 X_SYS_SOCKET_H = 1 X_SYS_TYPES_H = 1 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 X_T_SIZE_ = 0 @@ -258,7 +278,7 @@ const ( ) // Bits in the FLAGS argument to `send', `recv', et al. -const ( /* socket.h:197:1: */ +const ( /* socket.h:200:1: */ MSG_OOB = 1 // Process out-of-band data. MSG_PEEK = 2 // Peek at incoming messages. MSG_DONTROUTE = 4 // Don't use local routing. @@ -285,13 +305,13 @@ const ( /* socket.h:197:1: */ // Socket level message types. This must match the definitions in // . -const ( /* socket.h:329:1: */ +const ( /* socket.h:332:1: */ SCM_RIGHTS = 1 ) // Get the architecture-dependent definition of enum __socket_type. // Define enum __socket_type for generic Linux. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -306,7 +326,7 @@ const ( /* socket.h:329:1: */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Types of sockets. const ( /* socket_type.h:24:1: */ @@ -378,7 +398,7 @@ type Iovec = struct { Fiov_len Size_t } /* struct_iovec.h:26:1 */ -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -464,7 +484,7 @@ type Iovec = struct { // AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', // `struct msghdr', and `struct linger' types. // System-specific socket constants and types. Linux version. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -479,9 +499,9 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -563,7 +583,7 @@ type Iovec = struct { // A null pointer constant. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -578,11 +598,11 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 2.6 Primitive System Data Types -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -597,10 +617,10 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -615,11 +635,11 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -634,43 +654,65 @@ type Iovec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -682,7 +724,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -703,7 +745,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -718,7 +760,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -733,78 +775,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. type U_char = X__u_char /* types.h:33:18 */ type U_short = X__u_short /* types.h:34:19 */ @@ -841,7 +911,7 @@ type Caddr_t = X__caddr_t /* types.h:115:19 */ type Key_t = X__key_t /* types.h:121:17 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -856,7 +926,7 @@ type Key_t = X__key_t /* types.h:121:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -864,7 +934,7 @@ type Key_t = X__key_t /* types.h:121:17 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -879,7 +949,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -887,7 +957,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -902,7 +972,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -910,7 +980,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Time_t = X__time_t /* time_t.h:7:18 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -925,14 +995,14 @@ type Time_t = X__time_t /* time_t.h:7:18 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Timer ID returned by `timer_create'. type Timer_t = X__timer_t /* timer_t.h:7:19 */ -// Copyright (C) 1989-2018 Free Software Foundation, Inc. +// Copyright (C) 1989-2017 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -1022,7 +1092,7 @@ type Uint = uint32 /* types.h:150:22 */ // These size-specific names are used by some of the inet code. // Define intN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1037,10 +1107,10 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1055,7 +1125,7 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1064,18 +1134,17 @@ type Int16_t = X__int16_t /* stdint-intn.h:25:19 */ type Int32_t = X__int32_t /* stdint-intn.h:26:19 */ type Int64_t = X__int64_t /* stdint-intn.h:27:19 */ -// For GCC 2.7 and later, we can use specific type-size attributes. +// These were defined by ISO C without the first `_'. +type U_int8_t = X__uint8_t /* types.h:158:19 */ +type U_int16_t = X__uint16_t /* types.h:159:20 */ +type U_int32_t = X__uint32_t /* types.h:160:20 */ +type U_int64_t = X__uint64_t /* types.h:161:20 */ -type U_int8_t = uint32 /* types.h:177:1 */ -type U_int16_t = uint32 /* types.h:178:1 */ -type U_int32_t = uint32 /* types.h:179:1 */ -type U_int64_t = uint32 /* types.h:180:1 */ - -type Register_t = int32 /* types.h:182:13 */ +type Register_t = int32 /* types.h:164:13 */ // It also defines `fd_set' and the FD_* macros for `select'. // `fd_set' type and related macros, and `select'/`pselect' declarations. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1090,11 +1159,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX 1003.1g: 6.2 Select from File Descriptor Sets -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1109,11 +1178,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Get definition of needed basic types. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1128,12 +1197,12 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Get __FD_* definitions. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1148,7 +1217,7 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We don't use `memset' because this would require a prototype and // the array isn't too big. @@ -1163,7 +1232,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // Get definition of timer specification structures. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1178,7 +1247,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1192,7 +1261,27 @@ type Timeval = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1209,14 +1298,12 @@ type Timeval = struct { // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. - // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ type Suseconds_t = X__suseconds_t /* select.h:43:23 */ @@ -1236,16 +1323,16 @@ type Fd_mask = X__fd_mask /* select.h:77:19 */ // Define some inlines helping to catch common problems. -type Blksize_t = X__blksize_t /* types.h:202:21 */ +type Blksize_t = X__blksize_t /* types.h:185:21 */ // Types from the Large File Support interface. -type Blkcnt_t = X__blkcnt64_t /* types.h:222:22 */ // Type to count number of disk blocks. -type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:226:24 */ // Type to count file system blocks. -type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file system inodes. +type Blkcnt_t = X__blkcnt64_t /* types.h:205:22 */ // Type to count number of disk blocks. +type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:209:24 */ // Type to count file system blocks. +type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:213:24 */ // Type to count file system inodes. // Now add the thread types. // Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1260,11 +1347,11 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // For internal mutex and condition variable definitions. // Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1279,7 +1366,7 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -1294,36 +1381,6 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -1332,11 +1389,10 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1355,7 +1411,176 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Type to count file system inodes. + +// Now add the thread types. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -1370,31 +1595,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -1406,7 +1607,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -1416,14 +1617,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -1434,7 +1635,7 @@ type Pthread_once_t = int32 /* pthreadtypes.h:53:30 */ type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* pthreadtypes.h:56:1 */ type Pthread_attr_t = Pthread_attr_t1 /* pthreadtypes.h:62:30 */ @@ -1449,7 +1650,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -1459,12 +1660,12 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ // Type for length arguments in socket calls. @@ -1483,7 +1684,7 @@ type Socklen_t = X__socklen_t /* socket.h:33:21 */ // Get the definition of the macro to define the common sockaddr members. // Definition of struct sockaddr_* common members and sizes, generic version. -// Copyright (C) 1995-2018 Free Software Foundation, Inc. +// Copyright (C) 1995-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1498,7 +1699,7 @@ type Socklen_t = X__socklen_t /* socket.h:33:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1514,17 +1715,17 @@ type Sa_family_t = uint16 /* sockaddr.h:28:28 */ // Structure describing a generic socket address. type Sockaddr = struct { Fsa_family Sa_family_t - Fsa_data [14]int8 -} /* socket.h:175:1 */ + Fsa_data [14]uint8 +} /* socket.h:178:1 */ // Structure large enough to hold any socket address (with the historical // exception of AF_UNIX). type Sockaddr_storage = struct { Fss_family Sa_family_t - F__ss_padding [118]int8 + F__ss_padding [118]uint8 F__ss_align uint64 -} /* socket.h:188:1 */ +} /* socket.h:191:1 */ // Structure describing messages sent by // `sendmsg' and received by `recvmsg'. @@ -1538,7 +1739,7 @@ type Msghdr = struct { Fmsg_controllen Size_t Fmsg_flags int32 _ [4]byte -} /* socket.h:254:1 */ +} /* socket.h:257:1 */ // Structure used for storage of ancillary data object information. type Cmsghdr = struct { @@ -1546,15 +1747,105 @@ type Cmsghdr = struct { Fcmsg_len Size_t Fcmsg_level int32 Fcmsg_type int32 -} /* socket.h:272:1 */ +} /* socket.h:275:1 */ -// Ugly workaround for unclean kernel headers. +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// This allows for 1024 file descriptors: if NR_OPEN is ever grown +// beyond that you'll have to change this too. But 1024 fd's seem to be +// enough even for such "real" unices like OSF/1, so hopefully this is +// one limit that doesn't have to be changed [again]. +// +// Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in +// (and thus ) - but this is a more logical +// place for them. Solved by having dummy defines in . + +// This macro may have been defined in . But we always +// use the one here. + +type X__kernel_fd_set = struct{ Ffds_bits [16]uint64 } /* posix_types.h:27:3 */ + +// Type of a signal handler. +type X__kernel_sighandler_t = uintptr /* posix_types.h:30:14 */ + +// Type of a SYSV IPC key. +type X__kernel_key_t = int32 /* posix_types.h:33:13 */ +type X__kernel_mqd_t = int32 /* posix_types.h:34:13 */ -// Get socket manipulation related informations from kernel headers. // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note // S390 version // -// Derived from "include/asm-i386/socket.h" + +// This file is generally used by user-level software, so you need to +// be a little careful about namespace pollution etc. Also, we cannot +// assume GCC is being used. + +type X__kernel_size_t = uint64 /* posix_types.h:16:25 */ +type X__kernel_ssize_t = int64 /* posix_types.h:17:25 */ + +type X__kernel_old_dev_t = uint16 /* posix_types.h:20:24 */ + +type X__kernel_ino_t = uint32 /* posix_types.h:35:25 */ +type X__kernel_mode_t = uint32 /* posix_types.h:36:25 */ +type X__kernel_ipc_pid_t = int32 /* posix_types.h:37:25 */ +type X__kernel_uid_t = uint32 /* posix_types.h:38:25 */ +type X__kernel_gid_t = uint32 /* posix_types.h:39:25 */ +type X__kernel_ptrdiff_t = int64 /* posix_types.h:40:25 */ +type X__kernel_sigset_t = uint64 /* posix_types.h:41:25 */ // at least 32 bits + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note + +// There seems to be no way of detecting this automatically from user +// space, so 64 bit architectures should override this in their +// bitsperlong.h. In particular, an architecture that supports +// both 32 and 64 bit user space must not rely on CONFIG_64BIT +// to decide it, but rather check a compiler provided macro. + +// This file is generally used by user-level software, so you need to +// be a little careful about namespace pollution etc. +// +// First the types that are often defined in different ways across +// architectures, so that you can override them. + +type X__kernel_long_t = int64 /* posix_types.h:15:15 */ +type X__kernel_ulong_t = uint64 /* posix_types.h:16:23 */ + +type X__kernel_pid_t = int32 /* posix_types.h:28:14 */ + +type X__kernel_suseconds_t = X__kernel_long_t /* posix_types.h:41:26 */ + +type X__kernel_daddr_t = int32 /* posix_types.h:45:14 */ + +type X__kernel_uid32_t = uint32 /* posix_types.h:49:22 */ +type X__kernel_gid32_t = uint32 /* posix_types.h:50:22 */ + +type X__kernel_old_uid_t = X__kernel_uid_t /* posix_types.h:54:24 */ +type X__kernel_old_gid_t = X__kernel_gid_t /* posix_types.h:55:24 */ + +// Most 32 bit architectures use "unsigned int" size_t, +// and all 64 bit architectures use "unsigned long" size_t. + +type X__kernel_fsid_t = struct{ Fval [2]int32 } /* posix_types.h:81:3 */ + +// anything below here should be completely generic +type X__kernel_off_t = X__kernel_long_t /* posix_types.h:87:25 */ +type X__kernel_loff_t = int64 /* posix_types.h:88:19 */ +type X__kernel_time_t = X__kernel_long_t /* posix_types.h:89:25 */ +type X__kernel_time64_t = int64 /* posix_types.h:90:19 */ +type X__kernel_clock_t = X__kernel_long_t /* posix_types.h:91:25 */ +type X__kernel_timer_t = int32 /* posix_types.h:92:14 */ +type X__kernel_clockid_t = int32 /* posix_types.h:93:14 */ +type X__kernel_caddr_t = uintptr /* posix_types.h:94:14 */ +type X__kernel_uid16_t = uint16 /* posix_types.h:95:24 */ +type X__kernel_gid16_t = uint16 /* posix_types.h:96:24 */ // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note @@ -1568,11 +1859,13 @@ type Cmsghdr = struct { // Instruct lower device to use last 4-bytes of skb data as FCS +// on 64-bit and x32, avoid the ?: operator + // Structure used to manipulate the SO_LINGER option. type Linger = struct { Fl_onoff int32 Fl_linger int32 -} /* socket.h:444:1 */ +} /* socket.h:361:1 */ // This is the 4.3 BSD `struct sockaddr' format, which is used as wire // format in the grotty old 4.3 `talk' protocol. @@ -1583,4 +1876,4 @@ type Osockaddr = struct { // Define some macros helping to catch buffer overflows. -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/socket/socket_netbsd_amd64.go b/vendor/modernc.org/libc/sys/socket/socket_netbsd_amd64.go new file mode 100644 index 00000000..9802c248 --- /dev/null +++ b/vendor/modernc.org/libc/sys/socket/socket_netbsd_amd64.go @@ -0,0 +1,863 @@ +// Code generated by 'ccgo sys/socket/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/socket/socket_netbsd_amd64.go -pkgname socket', DO NOT EDIT. + +package socket + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + AF_APPLETALK = 16 + AF_ARP = 28 + AF_BLUETOOTH = 31 + AF_CAN = 35 + AF_CCITT = 10 + AF_CHAOS = 5 + AF_CNT = 21 + AF_COIP = 20 + AF_DATAKIT = 9 + AF_DECnet = 12 + AF_DLI = 13 + AF_E164 = 26 + AF_ECMA = 8 + AF_ETHER = 36 + AF_HYLINK = 15 + AF_IEEE80211 = 32 + AF_IMPLINK = 3 + AF_INET = 2 + AF_INET6 = 24 + AF_IPX = 23 + AF_ISDN = 26 + AF_ISO = 7 + AF_LAT = 14 + AF_LINK = 18 + AF_LOCAL = 1 + AF_MAX = 37 + AF_MPLS = 33 + AF_NATM = 27 + AF_NS = 6 + AF_OROUTE = 17 + AF_OSI = 7 + AF_PUP = 4 + AF_ROUTE = 34 + AF_SNA = 11 + AF_UNIX = 1 + AF_UNSPEC = 0 + MSG_BCAST = 0x0100 + MSG_CMSG_CLOEXEC = 0x0800 + MSG_CONTROLMBUF = 0x2000000 + MSG_CTRUNC = 0x0020 + MSG_DONTROUTE = 0x0004 + MSG_DONTWAIT = 0x0080 + MSG_EOR = 0x0008 + MSG_IOVUSRSPACE = 0x4000000 + MSG_LENUSRSPACE = 0x8000000 + MSG_MCAST = 0x0200 + MSG_NAMEMBUF = 0x1000000 + MSG_NBIO = 0x1000 + MSG_NOSIGNAL = 0x0400 + MSG_NOTIFICATION = 0x4000 + MSG_OOB = 0x0001 + MSG_PEEK = 0x0002 + MSG_TRUNC = 0x0010 + MSG_USERFLAGS = 0x0ffffff + MSG_WAITALL = 0x0040 + MSG_WAITFORONE = 0x2000 + NET_RT_DUMP = 1 + NET_RT_FLAGS = 2 + NET_RT_IFLIST = 6 + NET_RT_OIFLIST = 5 + NET_RT_OOIFLIST = 4 + NET_RT_OOOIFLIST = 3 + PCB_ALL = 0 + PCB_SLOP = 20 + PF_APPLETALK = 16 + PF_ARP = 28 + PF_BLUETOOTH = 31 + PF_CAN = 35 + PF_CCITT = 10 + PF_CHAOS = 5 + PF_CNT = 21 + PF_COIP = 20 + PF_DATAKIT = 9 + PF_DECnet = 12 + PF_DLI = 13 + PF_E164 = 26 + PF_ECMA = 8 + PF_ETHER = 36 + PF_HYLINK = 15 + PF_IMPLINK = 3 + PF_INET = 2 + PF_INET6 = 24 + PF_IPX = 23 + PF_ISDN = 26 + PF_ISO = 7 + PF_KEY = 29 + PF_LAT = 14 + PF_LINK = 18 + PF_LOCAL = 1 + PF_MAX = 37 + PF_MPLS = 33 + PF_NATM = 27 + PF_NS = 6 + PF_OROUTE = 17 + PF_OSI = 7 + PF_PIP = 25 + PF_PUP = 4 + PF_ROUTE = 34 + PF_RTIP = 22 + PF_SNA = 11 + PF_UNIX = 1 + PF_UNSPEC = 0 + PF_XTP = 19 + SCM_CREDS = 0x10 + SCM_RIGHTS = 0x01 + SCM_TIMESTAMP = 0x08 + SHUT_RD = 0 + SHUT_RDWR = 2 + SHUT_WR = 1 + SOCK_CLOEXEC = 0x10000000 + SOCK_CONN_DGRAM = 6 + SOCK_DCCP = 6 + SOCK_DGRAM = 2 + SOCK_FLAGS_MASK = 0xf0000000 + SOCK_NONBLOCK = 0x20000000 + SOCK_NOSIGPIPE = 0x40000000 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 + SOCK_STREAM = 1 + SOL_SOCKET = 0xffff + SOMAXCONN = 128 + SO_ACCEPTCONN = 0x0002 + SO_ACCEPTFILTER = 0x1000 + SO_BROADCAST = 0x0020 + SO_DEBUG = 0x0001 + SO_DEFOPTS = 27645 + SO_DONTROUTE = 0x0010 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x0008 + SO_LINGER = 0x0080 + SO_NOHEADER = 0x100a + SO_NOSIGPIPE = 0x0800 + SO_OOBINLINE = 0x0100 + SO_OVERFLOWED = 0x1009 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x100c + SO_RERROR = 0x4000 + SO_REUSEADDR = 0x0004 + SO_REUSEPORT = 0x0200 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x100b + SO_TIMESTAMP = 0x2000 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x0040 + UIO_MAXIOV = 1024 + X_AMD64_INT_TYPES_H_ = 0 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_SS_MAXSIZE = 128 + X_SYS_ANSI_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_SOCKET_H_ = 0 + X_SYS_UIO_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + Pseudo_AF_HDRCMPLT = 30 + Pseudo_AF_KEY = 29 + Pseudo_AF_PIP = 25 + Pseudo_AF_RTIP = 22 + Pseudo_AF_XTP = 19 +) + +// file offset + +const ( /* uio.h:69:1: */ + UIO_READ = 0 + UIO_WRITE = 1 +) + +// Segment flag values. +const ( /* uio.h:72:1: */ + UIO_USERSPACE = 0 // from user data space + UIO_SYSSPACE = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Sa_family_t = X__sa_family_t /* socket.h:78:23 */ + +type Socklen_t = X__socklen_t /* socket.h:83:21 */ + +type Ssize_t = int64 /* socket.h:95:23 */ + +// $NetBSD: uio.h,v 1.36 2011/07/27 13:20:07 uebayasi Exp $ + +// Copyright (c) 1982, 1986, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)uio.h 8.5 (Berkeley) 2/22/94 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +type Iovec = struct { + Fiov_base uintptr + Fiov_len Size_t +} /* uio.h:56:1 */ + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Off_t = X__off_t /* uio.h:65:18 */ + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ + +// Socket types. + +// Option flags per-socket. +// SO_OTIMESTAMP 0x0400 + +// Allowed default option flags + +// Additional options, not kept in so_options. +// SO_OSNDTIMEO 0x1005 +// SO_ORCVTIMEO 0x1006 + +// Structure used for manipulating linger option. +type Linger = struct { + Fl_onoff int32 + Fl_linger int32 +} /* socket.h:182:1 */ + +type Accept_filter_arg = struct { + Faf_name [16]int8 + Faf_arg [240]int8 +} /* socket.h:187:1 */ + +// Level number for (get/set)sockopt() to apply to socket itself. + +// Address families. + +// Structure used by kernel to store most +// addresses. +type Sockaddr = struct { + Fsa_len X__uint8_t + Fsa_family X__sa_family_t + Fsa_data [14]int8 +} /* socket.h:255:1 */ + +// RFC 2553: protocol-independent placeholder for socket addresses + +type Sockaddr_storage = struct { + Fss_len X__uint8_t + Fss_family X__sa_family_t + F__ss_pad1 [6]int8 + F__ss_align X__int64_t + F__ss_pad2 [112]int8 +} /* socket.h:301:1 */ + +// Protocol families, same as address families for now. + +type Pid_t = X__pid_t /* socket.h:366:18 */ // process id + +type Gid_t = X__gid_t /* socket.h:371:18 */ // group id + +type Uid_t = X__uid_t /* socket.h:376:18 */ // user id + +// Socket credentials. +type Sockcred = struct { + Fsc_pid X__pid_t + Fsc_uid X__uid_t + Fsc_euid X__uid_t + Fsc_gid X__gid_t + Fsc_egid X__gid_t + Fsc_ngroups int32 + Fsc_groups [1]X__gid_t +} /* socket.h:383:1 */ + +// Compute size of a sockcred structure with groups. + +// Definition for CTL_NET PCB fetching sysctls +type Kinfo_pcb = struct { + Fki_pcbaddr X__uint64_t + Fki_ppcbaddr X__uint64_t + Fki_sockaddr X__uint64_t + Fki_family X__uint32_t + Fki_type X__uint32_t + Fki_protocol X__uint32_t + Fki_pflags X__uint32_t + Fki_sostate X__uint32_t + Fki_prstate X__uint32_t + Fki_tstate X__int32_t + Fki_tflags X__uint32_t + Fki_rcvq X__uint64_t + Fki_sndq X__uint64_t + Fki_s struct { + F_kis_src struct { + Fsa_len X__uint8_t + Fsa_family X__sa_family_t + Fsa_data [14]int8 + } + _ [248]byte + } + Fki_d struct { + F_kid_dst struct { + Fsa_len X__uint8_t + Fsa_family X__sa_family_t + Fsa_data [14]int8 + } + _ [248]byte + } + Fki_inode X__uint64_t + Fki_vnode X__uint64_t + Fki_conn X__uint64_t + Fki_refs X__uint64_t + Fki_nextref X__uint64_t +} /* socket.h:404:1 */ + +// PF_ROUTE - Routing table +// +// Three additional levels are defined: +// Fourth: address family, 0 is wildcard +// Fifth: type of info, defined below +// Sixth: flag(s) to mask with for NET_RT_FLAGS + +// Maximum queue length specifiable by listen(2). + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// Message header for recvmsg and sendmsg calls. +// Used value-result for recvmsg, value only for sendmsg. +type Msghdr = struct { + Fmsg_name uintptr + Fmsg_namelen X__socklen_t + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_control uintptr + Fmsg_controllen X__socklen_t + Fmsg_flags int32 +} /* socket.h:479:1 */ + +type Mmsghdr = struct { + Fmsg_hdr struct { + Fmsg_name uintptr + Fmsg_namelen X__socklen_t + _ [4]byte + Fmsg_iov uintptr + Fmsg_iovlen int32 + _ [4]byte + Fmsg_control uintptr + Fmsg_controllen X__socklen_t + Fmsg_flags int32 + } + Fmsg_len uint32 + _ [4]byte +} /* socket.h:506:1 */ + +// Extra flags used internally only + +// Header for ancillary data objects in msg_control buffer. +// Used for additional information with/about a datagram +// not expressible by flags. The format is a sequence +// of message elements headed by cmsghdr structures. +type Cmsghdr = struct { + Fcmsg_len X__socklen_t + Fcmsg_level int32 + Fcmsg_type int32 +} /* socket.h:525:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/stat/capi_darwin_amd64.go b/vendor/modernc.org/libc/sys/stat/capi_darwin_amd64.go index 3b5af84e..fdd8a958 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/sys/stat/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_darwin_amd64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_darwin_amd64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_freebsd_amd64.go b/vendor/modernc.org/libc/sys/stat/capi_freebsd_amd64.go new file mode 100644 index 00000000..4aed33ac --- /dev/null +++ b/vendor/modernc.org/libc/sys/stat/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_freebsd_amd64.go -pkgname stat', DO NOT EDIT. + +package stat + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/sys/stat/capi_linux_386.go b/vendor/modernc.org/libc/sys/stat/capi_linux_386.go index 2ce23f74..56b0ecca 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_linux_386.go +++ b/vendor/modernc.org/libc/sys/stat/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_386.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_386.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_linux_amd64.go b/vendor/modernc.org/libc/sys/stat/capi_linux_amd64.go index 1fb4803d..4b376b5c 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/sys/stat/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_amd64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_amd64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_linux_arm.go b/vendor/modernc.org/libc/sys/stat/capi_linux_arm.go index 7f372b78..d528ab88 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_linux_arm.go +++ b/vendor/modernc.org/libc/sys/stat/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_linux_arm64.go b/vendor/modernc.org/libc/sys/stat/capi_linux_arm64.go index 91333e64..381d13e0 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/sys/stat/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_linux_s390x.go b/vendor/modernc.org/libc/sys/stat/capi_linux_s390x.go index 995c5e20..cd717e88 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/sys/stat/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_s390x.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_s390x.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_netbsd_amd64.go b/vendor/modernc.org/libc/sys/stat/capi_netbsd_amd64.go new file mode 100644 index 00000000..eac88b03 --- /dev/null +++ b/vendor/modernc.org/libc/sys/stat/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_netbsd_amd64.go -pkgname stat', DO NOT EDIT. + +package stat + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/sys/stat/capi_windows_386.go b/vendor/modernc.org/libc/sys/stat/capi_windows_386.go index 8ae3845c..ec7e8697 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_windows_386.go +++ b/vendor/modernc.org/libc/sys/stat/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_386.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_386.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/capi_windows_amd64.go b/vendor/modernc.org/libc/sys/stat/capi_windows_amd64.go index fb964cc3..ddd63472 100644 --- a/vendor/modernc.org/libc/sys/stat/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/sys/stat/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_amd64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_amd64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_darwin_amd64.go b/vendor/modernc.org/libc/sys/stat/stat_darwin_amd64.go index f505b679..ce8ad7a8 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_darwin_amd64.go +++ b/vendor/modernc.org/libc/sys/stat/stat_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_darwin_amd64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_darwin_amd64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_freebsd_amd64.go b/vendor/modernc.org/libc/sys/stat/stat_freebsd_amd64.go new file mode 100644 index 00000000..b7194021 --- /dev/null +++ b/vendor/modernc.org/libc/sys/stat/stat_freebsd_amd64.go @@ -0,0 +1,1897 @@ +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_freebsd_amd64.go -pkgname stat', DO NOT EDIT. + +package stat + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ACCESSPERMS = 511 + ALLPERMS = 4095 + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + CLK_TCK = 128 + CLOCKS_PER_SEC = 128 + CLOCK_MONOTONIC = 4 + CLOCK_MONOTONIC_FAST = 12 + CLOCK_MONOTONIC_PRECISE = 11 + CLOCK_PROCESS_CPUTIME_ID = 15 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_REALTIME_FAST = 10 + CLOCK_REALTIME_PRECISE = 9 + CLOCK_SECOND = 13 + CLOCK_THREAD_CPUTIME_ID = 14 + CLOCK_UPTIME = 5 + CLOCK_UPTIME_FAST = 8 + CLOCK_UPTIME_PRECISE = 7 + CLOCK_VIRTUAL = 1 + CPUCLOCK_WHICH_PID = 0 + CPUCLOCK_WHICH_TID = 1 + DEFFILEMODE = 438 + DST_AUST = 2 + DST_CAN = 6 + DST_EET = 5 + DST_MET = 4 + DST_NONE = 0 + DST_USA = 1 + DST_WET = 3 + FD_SETSIZE = 1024 + ITIMER_PROF = 2 + ITIMER_REAL = 0 + ITIMER_VIRTUAL = 1 + LITTLE_ENDIAN = 1234 + PDP_ENDIAN = 3412 + SBT_MAX = 0x7fffffffffffffff + SF_APPEND = 0x00040000 + SF_ARCHIVED = 0x00010000 + SF_IMMUTABLE = 0x00020000 + SF_NOUNLINK = 0x00100000 + SF_SETTABLE = 0xffff0000 + SF_SNAPSHOT = 0x00200000 + S_BLKSIZE = 512 + S_IEXEC = 64 + S_IFBLK = 0060000 + S_IFCHR = 0020000 + S_IFDIR = 0040000 + S_IFIFO = 0010000 + S_IFLNK = 0120000 + S_IFMT = 0170000 + S_IFREG = 0100000 + S_IFSOCK = 0140000 + S_IFWHT = 0160000 + S_IREAD = 256 + S_IRGRP = 0000040 + S_IROTH = 0000004 + S_IRUSR = 0000400 + S_IRWXG = 0000070 + S_IRWXO = 0000007 + S_IRWXU = 0000700 + S_ISGID = 0002000 + S_ISTXT = 0001000 + S_ISUID = 0004000 + S_ISVTX = 0001000 + S_IWGRP = 0000020 + S_IWOTH = 0000002 + S_IWRITE = 128 + S_IWUSR = 0000200 + S_IXGRP = 0000010 + S_IXOTH = 0000001 + S_IXUSR = 0000100 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + UF_APPEND = 0x00000004 + UF_ARCHIVE = 0x00000800 + UF_HIDDEN = 0x00008000 + UF_IMMUTABLE = 0x00000002 + UF_NODUMP = 0x00000001 + UF_NOUNLINK = 0x00000010 + UF_OFFLINE = 0x00000200 + UF_OPAQUE = 0x00000008 + UF_READONLY = 0x00001000 + UF_REPARSE = 0x00000400 + UF_SETTABLE = 0x0000ffff + UF_SPARSE = 0x00000100 + UF_SYSTEM = 0x00000080 + UTIME_NOW = -1 + UTIME_OMIT = -2 + X_ACCMODE_T_DECLARED = 0 + X_BIG_ENDIAN = 4321 + X_BLKCNT_T_DECLARED = 0 + X_BLKSIZE_T_DECLARED = 0 + X_BYTE_ORDER = 1234 + X_CAP_IOCTL_T_DECLARED = 0 + X_CAP_RIGHTS_T_DECLARED = 0 + X_CLOCKID_T_DECLARED = 0 + X_CLOCK_T_DECLARED = 0 + X_DEV_T_DECLARED = 0 + X_FFLAGS_T_DECLARED = 0 + X_FILE_OFFSET_BITS = 64 + X_FSBLKCNT_T_DECLARED = 0 + X_FTRUNCATE_DECLARED = 0 + X_GID_T_DECLARED = 0 + X_ID_T_DECLARED = 0 + X_INO_T_DECLARED = 0 + X_INT16_T_DECLARED = 0 + X_INT32_T_DECLARED = 0 + X_INT64_T_DECLARED = 0 + X_INT8_T_DECLARED = 0 + X_INTMAX_T_DECLARED = 0 + X_INTPTR_T_DECLARED = 0 + X_IN_ADDR_T_DECLARED = 0 + X_IN_PORT_T_DECLARED = 0 + X_KEY_T_DECLARED = 0 + X_LITTLE_ENDIAN = 1234 + X_LOCALE_T_DEFINED = 0 + X_LP64 = 1 + X_LSEEK_DECLARED = 0 + X_LWPID_T_DECLARED = 0 + X_MACHINE_ENDIAN_H_ = 0 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MKNOD_DECLARED = 0 + X_MMAP_DECLARED = 0 + X_MODE_T_DECLARED = 0 + X_MQD_T_DECLARED = 0 + X_NLINK_T_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF64_T_DECLARED = 0 + X_OFF_T_DECLARED = 0 + X_PDP_ENDIAN = 3412 + X_PID_T_DECLARED = 0 + X_PTHREAD_T_DECLARED = 0 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_RLIM_T_DECLARED = 0 + X_SELECT_DECLARED = 0 + X_SIGSET_T_DECLARED = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SIZE_T_DECLARED = 0 + X_SSIZE_T_DECLARED = 0 + X_SUSECONDS_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_STAT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TIME_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS__PTHREADTYPES_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__STDINT_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TIMEVAL_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIMER_T_DECLARED = 0 + X_TIME_H_ = 0 + X_TIME_T_DECLARED = 0 + X_TRUNCATE_DECLARED = 0 + X_UID_T_DECLARED = 0 + X_UINT16_T_DECLARED = 0 + X_UINT32_T_DECLARED = 0 + X_UINT64_T_DECLARED = 0 + X_UINT8_T_DECLARED = 0 + X_UINTMAX_T_DECLARED = 0 + X_UINTPTR_T_DECLARED = 0 + X_USECONDS_T_DECLARED = 0 + X_XLOCALE_LOCALE1_H = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)stat.h 8.12 (Berkeley) 6/16/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Time_t = X__time_t /* _timespec.h:42:18 */ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Blksize_t = X__blksize_t /* stat.h:48:21 */ + +type Blkcnt_t = X__blkcnt_t /* stat.h:53:20 */ + +type Dev_t = X__dev_t /* stat.h:58:18 */ + +type Fflags_t = X__fflags_t /* stat.h:63:20 */ + +type Gid_t = X__gid_t /* stat.h:68:18 */ + +type Ino_t = X__ino_t /* stat.h:73:18 */ + +type Mode_t = X__mode_t /* stat.h:78:18 */ + +type Nlink_t = X__nlink_t /* stat.h:83:19 */ + +type Off_t = X__off_t /* stat.h:88:18 */ + +type Uid_t = X__uid_t /* stat.h:93:18 */ + +// XXX We get miscellaneous namespace pollution with this. +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Suseconds_t = X__suseconds_t /* _timeval.h:37:23 */ + +// Structure returned by gettimeofday(2) system call, and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t +} /* _timeval.h:49:1 */ + +type Pthread_once = struct { + Fstate int32 + _ [4]byte + Fmutex Pthread_mutex_t +} /* _pthreadtypes.h:52:1 */ + +// Primitive system data type definitions required by P1003.1c. +// +// Note that P1003.1c specifies that there are no defined comparison +// or assignment operators for the types pthread_attr_t, pthread_cond_t, +// pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. +type Pthread_t = uintptr /* _pthreadtypes.h:67:26 */ +type Pthread_attr_t = uintptr /* _pthreadtypes.h:70:30 */ +type Pthread_mutex_t = uintptr /* _pthreadtypes.h:71:31 */ +type Pthread_mutexattr_t = uintptr /* _pthreadtypes.h:72:35 */ +type Pthread_cond_t = uintptr /* _pthreadtypes.h:73:30 */ +type Pthread_condattr_t = uintptr /* _pthreadtypes.h:74:34 */ +type Pthread_key_t = int32 /* _pthreadtypes.h:75:20 */ +type Pthread_once_t = Pthread_once /* _pthreadtypes.h:76:30 */ +type Pthread_rwlock_t = uintptr /* _pthreadtypes.h:77:32 */ +type Pthread_rwlockattr_t = uintptr /* _pthreadtypes.h:78:35 */ +type Pthread_barrier_t = uintptr /* _pthreadtypes.h:79:33 */ +type Pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */ +type Pthread_spinlock_t = uintptr /* _pthreadtypes.h:81:33 */ + +// Additional type definitions: +// +// Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for +// use in header symbols. +type Pthread_addr_t = uintptr /* _pthreadtypes.h:89:14 */ +type Pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */ + +type U_char = uint8 /* types.h:52:23 */ +type U_short = uint16 /* types.h:53:24 */ +type U_int = uint32 /* types.h:54:22 */ +type U_long = uint64 /* types.h:55:23 */ +type Ushort = uint16 /* types.h:57:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:58:22 */ // Sys V compatibility + +// XXX POSIX sized integrals that should appear only in . +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011 David E. O'Brien +// Copyright (c) 2001 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Int8_t = X__int8_t /* _stdint.h:36:19 */ + +type Int16_t = X__int16_t /* _stdint.h:41:20 */ + +type Int32_t = X__int32_t /* _stdint.h:46:20 */ + +type Int64_t = X__int64_t /* _stdint.h:51:20 */ + +type Uint8_t = X__uint8_t /* _stdint.h:56:20 */ + +type Uint16_t = X__uint16_t /* _stdint.h:61:21 */ + +type Uint32_t = X__uint32_t /* _stdint.h:66:21 */ + +type Uint64_t = X__uint64_t /* _stdint.h:71:21 */ + +type Intptr_t = X__intptr_t /* _stdint.h:76:21 */ +type Uintptr_t = X__uintptr_t /* _stdint.h:80:22 */ +type Intmax_t = X__intmax_t /* _stdint.h:84:21 */ +type Uintmax_t = X__uintmax_t /* _stdint.h:88:22 */ + +type U_int8_t = X__uint8_t /* types.h:67:19 */ // unsigned integrals (deprecated) +type U_int16_t = X__uint16_t /* types.h:68:20 */ +type U_int32_t = X__uint32_t /* types.h:69:20 */ +type U_int64_t = X__uint64_t /* types.h:70:20 */ + +type U_quad_t = X__uint64_t /* types.h:72:20 */ // quads (deprecated) +type Quad_t = X__int64_t /* types.h:73:19 */ +type Qaddr_t = uintptr /* types.h:74:16 */ + +type Caddr_t = uintptr /* types.h:76:14 */ // core address +type C_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const + +type Cpuwhich_t = X__cpuwhich_t /* types.h:84:22 */ +type Cpulevel_t = X__cpulevel_t /* types.h:85:22 */ +type Cpusetid_t = X__cpusetid_t /* types.h:86:22 */ + +type Clock_t = X__clock_t /* types.h:94:19 */ + +type Clockid_t = X__clockid_t /* types.h:99:21 */ + +type Critical_t = X__critical_t /* types.h:103:22 */ // Critical section value +type Daddr_t = X__daddr_t /* types.h:104:19 */ // disk address + +type Fixpt_t = X__fixpt_t /* types.h:116:19 */ // fixed point number + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:119:22 */ +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:120:22 */ + +type In_addr_t = X__uint32_t /* types.h:130:20 */ // base type for internet address + +type In_port_t = X__uint16_t /* types.h:135:20 */ + +type Id_t = X__id_t /* types.h:140:17 */ // can hold a uid_t or pid_t + +type Key_t = X__key_t /* types.h:150:18 */ // IPC key (for Sys V IPC) + +type Lwpid_t = X__lwpid_t /* types.h:155:19 */ // Thread ID (a.k.a. LWP) + +type Accmode_t = X__accmode_t /* types.h:165:21 */ // access permissions + +type Off64_t = X__off64_t /* types.h:180:19 */ // file offset (alias) + +type Pid_t = X__pid_t /* types.h:185:18 */ // process id + +type Register_t = X__register_t /* types.h:189:22 */ + +type Rlim_t = X__rlim_t /* types.h:192:18 */ // resource limit + +type Sbintime_t = X__int64_t /* types.h:196:19 */ + +type Segsz_t = X__segsz_t /* types.h:198:19 */ + +type Ssize_t = X__ssize_t /* types.h:206:19 */ + +type Timer_t = X__timer_t /* types.h:221:19 */ + +type Mqd_t = X__mqd_t /* types.h:226:17 */ + +type U_register_t = X__u_register_t /* types.h:230:24 */ + +type Useconds_t = X__useconds_t /* types.h:238:22 */ // microseconds (unsigned) + +type Cap_ioctl_t = uint64 /* types.h:244:23 */ + +// Types suitable for exporting physical addresses, virtual addresses +// (pointers), and memory object sizes from the kernel independent of native +// word size. These should be used in place of vm_paddr_t, (u)intptr_t, and +// size_t in structs which contain such types that are shared with userspace. +type Kpaddr_t = X__uint64_t /* types.h:260:20 */ +type Kvaddr_t = X__uint64_t /* types.h:261:20 */ +type Ksize_t = X__uint64_t /* types.h:262:20 */ +type Kssize_t = X__int64_t /* types.h:263:19 */ + +type Vm_offset_t = X__vm_offset_t /* types.h:265:23 */ +type Vm_ooffset_t = X__uint64_t /* types.h:266:20 */ +type Vm_paddr_t = X__vm_paddr_t /* types.h:267:22 */ +type Vm_pindex_t = X__uint64_t /* types.h:268:20 */ +type Vm_size_t = X__vm_size_t /* types.h:269:21 */ + +type Rman_res_t = X__rman_res_t /* types.h:271:25 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = X__sigset /* _sigset.h:55:3 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +type X__fd_mask = uint64 /* select.h:44:23 */ +type Fd_mask = X__fd_mask /* select.h:46:19 */ + +type Sigset_t = X__sigset_t /* select.h:51:20 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set1 = struct{ F__fds_bits [16]X__fd_mask } /* select.h:73:9 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set = Fd_set1 /* select.h:75:3 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +type Timezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} /* time.h:42:1 */ + +type Bintime = struct { + Fsec Time_t + Ffrac Uint64_t +} /* time.h:55:1 */ + +// Operations on timespecs + +// Names of the interval timers, and structure +// defining a timer setting. + +type Itimerval = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + } + Fit_value struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + } +} /* time.h:447:1 */ + +// Getkerninfo clock information structure +type Clockinfo = struct { + Fhz int32 + Ftick int32 + Fspare int32 + Fstathz int32 + Fprofhz int32 +} /* time.h:455:1 */ + +// These macros are also in time.h. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2003 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Frequency of the clock ticks reported by times(). Deprecated - use +// sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) + +// Frequency of the clock ticks reported by clock(). + +// New in POSIX 1003.1b-1993. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// These macros are also in sys/time.h. + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:129:1 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011, 2012 The FreeBSD Foundation +// All rights reserved. +// +// This software was developed by David Chisnall under sponsorship from +// the FreeBSD Foundation. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Locale_t = uintptr /* _time.h:36:25 */ + +type Stat = struct { + Fst_dev Dev_t + Fst_ino Ino_t + Fst_nlink Nlink_t + Fst_mode Mode_t + Fst_padding0 X__int16_t + Fst_uid Uid_t + Fst_gid Gid_t + Fst_padding1 X__int32_t + Fst_rdev Dev_t + Fst_atim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_mtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_ctim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_birthtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_size Off_t + Fst_blocks Blkcnt_t + Fst_blksize Blksize_t + Fst_flags Fflags_t + Fst_gen X__uint64_t + Fst_spare [10]X__uint64_t +} /* stat.h:160:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/stat/stat_linux_386.go b/vendor/modernc.org/libc/sys/stat/stat_linux_386.go index 55b6d772..c2f93581 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_linux_386.go +++ b/vendor/modernc.org/libc/sys/stat/stat_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_386.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_386.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_linux_amd64.go b/vendor/modernc.org/libc/sys/stat/stat_linux_amd64.go index d1825b29..cbbde2d2 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_linux_amd64.go +++ b/vendor/modernc.org/libc/sys/stat/stat_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_amd64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_amd64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_linux_arm.go b/vendor/modernc.org/libc/sys/stat/stat_linux_arm.go index 39c348bb..8ec662c7 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_linux_arm.go +++ b/vendor/modernc.org/libc/sys/stat/stat_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_linux_arm64.go b/vendor/modernc.org/libc/sys/stat/stat_linux_arm64.go index e06d284b..dc08dc78 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_linux_arm64.go +++ b/vendor/modernc.org/libc/sys/stat/stat_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_arm64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_linux_s390x.go b/vendor/modernc.org/libc/sys/stat/stat_linux_s390x.go index 34c93f79..ce259c2f 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_linux_s390x.go +++ b/vendor/modernc.org/libc/sys/stat/stat_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_s390x.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_linux_s390x.go -pkgname stat', DO NOT EDIT. package stat @@ -48,7 +48,10 @@ const ( UTIME_NOW = 1073741823 UTIME_OMIT = 1073741822 X_ATFILE_SOURCE = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_STAT_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_DEFAULT_SOURCE = 1 @@ -91,7 +94,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -106,11 +109,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 5.6 File Characteristics -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -125,7 +128,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -133,6 +136,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -253,6 +257,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -275,9 +281,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -292,7 +311,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -305,7 +324,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -320,7 +339,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -435,7 +454,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -452,14 +471,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -474,7 +491,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -511,7 +528,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -526,11 +543,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -545,43 +562,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -593,7 +632,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -614,7 +653,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -629,7 +668,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -644,83 +683,131 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -737,20 +824,33 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. +// Definitions for byte order, according to significance of bytes, +// from low addresses to high addresses. The value is what you get by +// putting '4' in the most significant byte, '3' in the second most +// significant byte, '2' in the second least significant byte, and '1' +// in the least significant byte, and then writing down one digit for +// each byte, starting with the byte at the lowest address at the left, +// and proceeding to the byte with the highest address at the right. + +// This file defines `__BYTE_ORDER' for the particular machine. + +// S/390 is big-endian. + +// Some machines may need to use a different endianness for floating point +// values. // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ // The Single Unix specification says that some more types are // available here. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -765,7 +865,7 @@ type Timespec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -786,7 +886,7 @@ type Off_t = X__off64_t /* stat.h:72:19 */ type Uid_t = X__uid_t /* stat.h:78:17 */ -// Copyright (C) 2000-2018 Free Software Foundation, Inc. +// Copyright (C) 2000-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -801,7 +901,7 @@ type Uid_t = X__uid_t /* stat.h:78:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. @@ -836,4 +936,4 @@ type Stat = struct { F__glibc_reserved [3]int64 } /* stat.h:50:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/stat/stat_netbsd_amd64.go b/vendor/modernc.org/libc/sys/stat/stat_netbsd_amd64.go new file mode 100644 index 00000000..5c7982b8 --- /dev/null +++ b/vendor/modernc.org/libc/sys/stat/stat_netbsd_amd64.go @@ -0,0 +1,2374 @@ +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_netbsd_amd64.go -pkgname stat', DO NOT EDIT. + +package stat + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ACCESSPERMS = 511 + ALLPERMS = 4095 + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + CLOCKS_PER_SEC = 100 + CLOCK_MONOTONIC = 3 + CLOCK_PROCESS_CPUTIME_ID = 0x40000000 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_THREAD_CPUTIME_ID = 0x20000000 + CLOCK_VIRTUAL = 1 + DEFFILEMODE = 438 + FD_SETSIZE = 256 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + ITIMER_MONOTONIC = 3 + ITIMER_PROF = 2 + ITIMER_REAL = 0 + ITIMER_VIRTUAL = 1 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SF_APPEND = 0x00040000 + SF_ARCHIVED = 0x00010000 + SF_IMMUTABLE = 0x00020000 + SF_LOG = 0x00400000 + SF_SETTABLE = 0xffff0000 + SF_SNAPINVAL = 0x00800000 + SF_SNAPSHOT = 0x00200000 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + S_ARCH1 = 65536 + S_ARCH2 = 131072 + S_BLKSIZE = 512 + S_IEXEC = 64 + S_IFBLK = 24576 + S_IFCHR = 8192 + S_IFDIR = 16384 + S_IFIFO = 4096 + S_IFLNK = 40960 + S_IFMT = 61440 + S_IFREG = 32768 + S_IFSOCK = 49152 + S_IFWHT = 57344 + S_IREAD = 256 + S_IRGRP = 0000040 + S_IROTH = 0000004 + S_IRUSR = 0000400 + S_IRWXG = 0000070 + S_IRWXO = 0000007 + S_IRWXU = 0000700 + S_ISGID = 0002000 + S_ISTXT = 0001000 + S_ISUID = 0004000 + S_ISVTX = 512 + S_IWGRP = 0000020 + S_IWOTH = 0000002 + S_IWRITE = 128 + S_IWUSR = 0000200 + S_IXGRP = 0000010 + S_IXOTH = 0000001 + S_IXUSR = 0000100 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + UF_APPEND = 0x00000004 + UF_IMMUTABLE = 0x00000002 + UF_NODUMP = 0x00000001 + UF_OPAQUE = 0x00000008 + UF_SETTABLE = 0x0000ffff + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + UTIME_NOW = 1073741823 + UTIME_OMIT = 1073741822 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_IDTYPE_H_ = 0 + X_SYS_NULL_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_STAT_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TIME_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_S_ARCH1 = 0200000 + X_S_ARCH2 = 0400000 + X_S_IFBLK = 0060000 + X_S_IFCHR = 0020000 + X_S_IFDIR = 0040000 + X_S_IFIFO = 0010000 + X_S_IFLNK = 0120000 + X_S_IFMT = 0170000 + X_S_IFREG = 0100000 + X_S_IFSOCK = 0140000 + X_S_IFWHT = 0160000 + X_S_ISVTX = 0001000 + X_TIME_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +const ( /* idtype.h:41:1: */ + P_MYID = -1 // Me/my process group + P_ALL = 0 // All processes. + P_PID = 1 // A process identifier. + P_LWPID = 2 // An LWP identifier. + P_PPID = 3 // A parent process identifier. + P_PGID = 4 // A process group identifier. + P_SID = 5 // A session identifier. + P_CID = 6 // A scheduling class identifier. + P_UID = 7 // A user identifier. + P_GID = 8 // A group identifier. + P_TASKID = 9 // A task identifier. + P_PROJID = 10 // A project identifier. + P_POOLID = 11 // A pool identifier. + P_ZONEID = 12 // A zone identifier. + P_CTID = 13 // A (process) contract identifier. + P_CPUID = 14 // CPU identifier. + P_PSETID = 15 // Processor set identifier. + X_P_MAXIDTYPE = 2147483647 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// POSIX:2008 / XPG7 requires struct timespec to be declared in +// this header, but does not provide the usual exemption +// "inclusion of this header may make visible symbols defined in ". +// +// This is a Standard omission, acknowledged by the committee and +// scheduled to be corrected in Technical Corrigendum 2, according to +// http://austingroupbugs.net/view.php?id=531 +// $NetBSD: time.h,v 1.79 2017/01/17 15:28:34 maya Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// Structure returned by gettimeofday(2) system call, +// and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte +} /* time.h:44:1 */ + +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* timespec.h:47:1 */ + +// Note: timezone is obsolete. All timezone handling is now in +// userland. Its just here for back compatibility. +type Timezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} /* time.h:65:1 */ + +// Operations on timevals. + +// hide bintime for _STANDALONE because this header is used for hpcboot.exe, +// which is built with compilers which don't recognize LL suffix. +// http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html +type Bintime = struct { + Fsec Time_t + Ffrac Uint64_t +} /* time.h:102:1 */ + +// Operations on timespecs. + +// Names of the interval timers, and structure +// defining a timer setting. +// NB: Must match the CLOCK_ constants below. + +type Itimerval = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } + Fit_value struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } +} /* time.h:280:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* time.h:289:1 */ + +// $NetBSD: select.h,v 1.37 2014/04/25 15:52:45 pooka Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)select.h 8.2 (Berkeley) 1/4/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ + +// $NetBSD: time.h,v 1.47 2016/10/04 09:41:41 kamil Exp $ + +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ + +// Written by Klaus Klein , December 22, 1999. +// Public domain. + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:75:1 */ + +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +type Idtype_t = int32 /* idtype.h:60:3 */ + +type Locale_t = uintptr /* time.h:188:25 */ + +type Timezone_t = uintptr /* time.h:198:24 */ + +type Stat = struct { + Fst_dev Dev_t + Fst_mode X__mode_t + _ [4]byte + Fst_ino Ino_t + Fst_nlink Nlink_t + Fst_uid X__uid_t + Fst_gid X__gid_t + _ [4]byte + Fst_rdev Dev_t + Fst_atim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_mtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_ctim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_birthtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_size X__off_t + Fst_blocks Blkcnt_t + Fst_blksize Blksize_t + Fst_flags Uint32_t + Fst_gen Uint32_t + Fst_spare [2]Uint32_t + _ [4]byte +} /* stat.h:59:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/stat/stat_windows_386.go b/vendor/modernc.org/libc/sys/stat/stat_windows_386.go index a0d65b22..e6c16ca3 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_windows_386.go +++ b/vendor/modernc.org/libc/sys/stat/stat_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_386.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_386.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/stat/stat_windows_amd64.go b/vendor/modernc.org/libc/sys/stat/stat_windows_amd64.go index 31aec504..8ec98f92 100644 --- a/vendor/modernc.org/libc/sys/stat/stat_windows_amd64.go +++ b/vendor/modernc.org/libc/sys/stat/stat_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_amd64.go -pkgname stat', DO NOT EDIT. +// Code generated by 'ccgo sys/stat/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/stat/stat_windows_amd64.go -pkgname stat', DO NOT EDIT. package stat diff --git a/vendor/modernc.org/libc/sys/types/capi_darwin_amd64.go b/vendor/modernc.org/libc/sys/types/capi_darwin_amd64.go index edc728ec..7d05a9e0 100644 --- a/vendor/modernc.org/libc/sys/types/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/sys/types/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_darwin_amd64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_darwin_amd64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_freebsd_amd64.go b/vendor/modernc.org/libc/sys/types/capi_freebsd_amd64.go new file mode 100644 index 00000000..38dd284a --- /dev/null +++ b/vendor/modernc.org/libc/sys/types/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_freebsd_amd64.go -pkgname types', DO NOT EDIT. + +package types + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/sys/types/capi_linux_386.go b/vendor/modernc.org/libc/sys/types/capi_linux_386.go index 479f6eeb..026dff4a 100644 --- a/vendor/modernc.org/libc/sys/types/capi_linux_386.go +++ b/vendor/modernc.org/libc/sys/types/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_386.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_386.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_linux_amd64.go b/vendor/modernc.org/libc/sys/types/capi_linux_amd64.go index 136e5ea1..bc337eed 100644 --- a/vendor/modernc.org/libc/sys/types/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/sys/types/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_amd64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_amd64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_linux_arm.go b/vendor/modernc.org/libc/sys/types/capi_linux_arm.go index 77b2df79..c64f386e 100644 --- a/vendor/modernc.org/libc/sys/types/capi_linux_arm.go +++ b/vendor/modernc.org/libc/sys/types/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_linux_arm64.go b/vendor/modernc.org/libc/sys/types/capi_linux_arm64.go index 5d51feec..4ec64ab5 100644 --- a/vendor/modernc.org/libc/sys/types/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/sys/types/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_linux_s390x.go b/vendor/modernc.org/libc/sys/types/capi_linux_s390x.go index 3a8d26c6..90fa54ba 100644 --- a/vendor/modernc.org/libc/sys/types/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/sys/types/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_s390x.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_s390x.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_netbsd_amd64.go b/vendor/modernc.org/libc/sys/types/capi_netbsd_amd64.go new file mode 100644 index 00000000..9164103d --- /dev/null +++ b/vendor/modernc.org/libc/sys/types/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_netbsd_amd64.go -pkgname types', DO NOT EDIT. + +package types + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/sys/types/capi_windows_386.go b/vendor/modernc.org/libc/sys/types/capi_windows_386.go index 1456be78..d09a4ea4 100644 --- a/vendor/modernc.org/libc/sys/types/capi_windows_386.go +++ b/vendor/modernc.org/libc/sys/types/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_386.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_386.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/capi_windows_amd64.go b/vendor/modernc.org/libc/sys/types/capi_windows_amd64.go index 85d07507..25a915ca 100644 --- a/vendor/modernc.org/libc/sys/types/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/sys/types/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_amd64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_amd64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_darwin_amd64.go b/vendor/modernc.org/libc/sys/types/types_darwin_amd64.go index 0300fe09..d2b025ab 100644 --- a/vendor/modernc.org/libc/sys/types/types_darwin_amd64.go +++ b/vendor/modernc.org/libc/sys/types/types_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_darwin_amd64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_darwin_amd64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_freebsd_amd64.go b/vendor/modernc.org/libc/sys/types/types_freebsd_amd64.go new file mode 100644 index 00000000..348cc4e6 --- /dev/null +++ b/vendor/modernc.org/libc/sys/types/types_freebsd_amd64.go @@ -0,0 +1,1448 @@ +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_freebsd_amd64.go -pkgname types', DO NOT EDIT. + +package types + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FD_SETSIZE = 1024 + LITTLE_ENDIAN = 1234 + PDP_ENDIAN = 3412 + X_ACCMODE_T_DECLARED = 0 + X_BIG_ENDIAN = 4321 + X_BLKCNT_T_DECLARED = 0 + X_BLKSIZE_T_DECLARED = 0 + X_BYTE_ORDER = 1234 + X_CAP_IOCTL_T_DECLARED = 0 + X_CAP_RIGHTS_T_DECLARED = 0 + X_CLOCKID_T_DECLARED = 0 + X_CLOCK_T_DECLARED = 0 + X_DEV_T_DECLARED = 0 + X_FFLAGS_T_DECLARED = 0 + X_FILE_OFFSET_BITS = 64 + X_FSBLKCNT_T_DECLARED = 0 + X_FTRUNCATE_DECLARED = 0 + X_GID_T_DECLARED = 0 + X_ID_T_DECLARED = 0 + X_INO_T_DECLARED = 0 + X_INT16_T_DECLARED = 0 + X_INT32_T_DECLARED = 0 + X_INT64_T_DECLARED = 0 + X_INT8_T_DECLARED = 0 + X_INTMAX_T_DECLARED = 0 + X_INTPTR_T_DECLARED = 0 + X_IN_ADDR_T_DECLARED = 0 + X_IN_PORT_T_DECLARED = 0 + X_KEY_T_DECLARED = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_LSEEK_DECLARED = 0 + X_LWPID_T_DECLARED = 0 + X_MACHINE_ENDIAN_H_ = 0 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MMAP_DECLARED = 0 + X_MODE_T_DECLARED = 0 + X_MQD_T_DECLARED = 0 + X_NLINK_T_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF64_T_DECLARED = 0 + X_OFF_T_DECLARED = 0 + X_PDP_ENDIAN = 3412 + X_PID_T_DECLARED = 0 + X_PTHREAD_T_DECLARED = 0 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_RLIM_T_DECLARED = 0 + X_SELECT_DECLARED = 0 + X_SIGSET_T_DECLARED = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SIZE_T_DECLARED = 0 + X_SSIZE_T_DECLARED = 0 + X_SUSECONDS_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS__PTHREADTYPES_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__STDINT_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TIMEVAL_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIMER_T_DECLARED = 0 + X_TIME_T_DECLARED = 0 + X_TRUNCATE_DECLARED = 0 + X_UID_T_DECLARED = 0 + X_UINT16_T_DECLARED = 0 + X_UINT32_T_DECLARED = 0 + X_UINT64_T_DECLARED = 0 + X_UINT8_T_DECLARED = 0 + X_UINTMAX_T_DECLARED = 0 + X_UINTPTR_T_DECLARED = 0 + X_USECONDS_T_DECLARED = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.6 (Berkeley) 2/19/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// Machine type dependent parameters. +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1987, 1991 Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 7.8 (Berkeley) 4/3/91 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ +type Pthread_once = struct { + Fstate int32 + _ [4]byte + Fmutex Pthread_mutex_t +} /* _pthreadtypes.h:52:1 */ + +// Primitive system data type definitions required by P1003.1c. +// +// Note that P1003.1c specifies that there are no defined comparison +// or assignment operators for the types pthread_attr_t, pthread_cond_t, +// pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. +type Pthread_t = uintptr /* _pthreadtypes.h:67:26 */ +type Pthread_attr_t = uintptr /* _pthreadtypes.h:70:30 */ +type Pthread_mutex_t = uintptr /* _pthreadtypes.h:71:31 */ +type Pthread_mutexattr_t = uintptr /* _pthreadtypes.h:72:35 */ +type Pthread_cond_t = uintptr /* _pthreadtypes.h:73:30 */ +type Pthread_condattr_t = uintptr /* _pthreadtypes.h:74:34 */ +type Pthread_key_t = int32 /* _pthreadtypes.h:75:20 */ +type Pthread_once_t = Pthread_once /* _pthreadtypes.h:76:30 */ +type Pthread_rwlock_t = uintptr /* _pthreadtypes.h:77:32 */ +type Pthread_rwlockattr_t = uintptr /* _pthreadtypes.h:78:35 */ +type Pthread_barrier_t = uintptr /* _pthreadtypes.h:79:33 */ +type Pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */ +type Pthread_spinlock_t = uintptr /* _pthreadtypes.h:81:33 */ + +// Additional type definitions: +// +// Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for +// use in header symbols. +type Pthread_addr_t = uintptr /* _pthreadtypes.h:89:14 */ +type Pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */ + +type U_char = uint8 /* types.h:52:23 */ +type U_short = uint16 /* types.h:53:24 */ +type U_int = uint32 /* types.h:54:22 */ +type U_long = uint64 /* types.h:55:23 */ +type Ushort = uint16 /* types.h:57:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:58:22 */ // Sys V compatibility + +// XXX POSIX sized integrals that should appear only in . +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011 David E. O'Brien +// Copyright (c) 2001 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Int8_t = X__int8_t /* _stdint.h:36:19 */ + +type Int16_t = X__int16_t /* _stdint.h:41:20 */ + +type Int32_t = X__int32_t /* _stdint.h:46:20 */ + +type Int64_t = X__int64_t /* _stdint.h:51:20 */ + +type Uint8_t = X__uint8_t /* _stdint.h:56:20 */ + +type Uint16_t = X__uint16_t /* _stdint.h:61:21 */ + +type Uint32_t = X__uint32_t /* _stdint.h:66:21 */ + +type Uint64_t = X__uint64_t /* _stdint.h:71:21 */ + +type Intptr_t = X__intptr_t /* _stdint.h:76:21 */ +type Uintptr_t = X__uintptr_t /* _stdint.h:80:22 */ +type Intmax_t = X__intmax_t /* _stdint.h:84:21 */ +type Uintmax_t = X__uintmax_t /* _stdint.h:88:22 */ + +type U_int8_t = X__uint8_t /* types.h:67:19 */ // unsigned integrals (deprecated) +type U_int16_t = X__uint16_t /* types.h:68:20 */ +type U_int32_t = X__uint32_t /* types.h:69:20 */ +type U_int64_t = X__uint64_t /* types.h:70:20 */ + +type U_quad_t = X__uint64_t /* types.h:72:20 */ // quads (deprecated) +type Quad_t = X__int64_t /* types.h:73:19 */ +type Qaddr_t = uintptr /* types.h:74:16 */ + +type Caddr_t = uintptr /* types.h:76:14 */ // core address +type C_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const + +type Blksize_t = X__blksize_t /* types.h:80:21 */ + +type Cpuwhich_t = X__cpuwhich_t /* types.h:84:22 */ +type Cpulevel_t = X__cpulevel_t /* types.h:85:22 */ +type Cpusetid_t = X__cpusetid_t /* types.h:86:22 */ + +type Blkcnt_t = X__blkcnt_t /* types.h:89:20 */ + +type Clock_t = X__clock_t /* types.h:94:19 */ + +type Clockid_t = X__clockid_t /* types.h:99:21 */ + +type Critical_t = X__critical_t /* types.h:103:22 */ // Critical section value +type Daddr_t = X__daddr_t /* types.h:104:19 */ // disk address + +type Dev_t = X__dev_t /* types.h:107:18 */ // device number or struct cdev + +type Fflags_t = X__fflags_t /* types.h:112:20 */ // file flags + +type Fixpt_t = X__fixpt_t /* types.h:116:19 */ // fixed point number + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:119:22 */ +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:120:22 */ + +type Gid_t = X__gid_t /* types.h:125:18 */ // group id + +type In_addr_t = X__uint32_t /* types.h:130:20 */ // base type for internet address + +type In_port_t = X__uint16_t /* types.h:135:20 */ + +type Id_t = X__id_t /* types.h:140:17 */ // can hold a uid_t or pid_t + +type Ino_t = X__ino_t /* types.h:145:18 */ // inode number + +type Key_t = X__key_t /* types.h:150:18 */ // IPC key (for Sys V IPC) + +type Lwpid_t = X__lwpid_t /* types.h:155:19 */ // Thread ID (a.k.a. LWP) + +type Mode_t = X__mode_t /* types.h:160:18 */ // permissions + +type Accmode_t = X__accmode_t /* types.h:165:21 */ // access permissions + +type Nlink_t = X__nlink_t /* types.h:170:19 */ // link count + +type Off_t = X__off_t /* types.h:175:18 */ // file offset + +type Off64_t = X__off64_t /* types.h:180:19 */ // file offset (alias) + +type Pid_t = X__pid_t /* types.h:185:18 */ // process id + +type Register_t = X__register_t /* types.h:189:22 */ + +type Rlim_t = X__rlim_t /* types.h:192:18 */ // resource limit + +type Sbintime_t = X__int64_t /* types.h:196:19 */ + +type Segsz_t = X__segsz_t /* types.h:198:19 */ + +type Ssize_t = X__ssize_t /* types.h:206:19 */ + +type Suseconds_t = X__suseconds_t /* types.h:211:23 */ // microseconds (signed) + +type Time_t = X__time_t /* types.h:216:18 */ + +type Timer_t = X__timer_t /* types.h:221:19 */ + +type Mqd_t = X__mqd_t /* types.h:226:17 */ + +type U_register_t = X__u_register_t /* types.h:230:24 */ + +type Uid_t = X__uid_t /* types.h:233:18 */ // user id + +type Useconds_t = X__useconds_t /* types.h:238:22 */ // microseconds (unsigned) + +type Cap_ioctl_t = uint64 /* types.h:244:23 */ + +// Types suitable for exporting physical addresses, virtual addresses +// (pointers), and memory object sizes from the kernel independent of native +// word size. These should be used in place of vm_paddr_t, (u)intptr_t, and +// size_t in structs which contain such types that are shared with userspace. +type Kpaddr_t = X__uint64_t /* types.h:260:20 */ +type Kvaddr_t = X__uint64_t /* types.h:261:20 */ +type Ksize_t = X__uint64_t /* types.h:262:20 */ +type Kssize_t = X__int64_t /* types.h:263:19 */ + +type Vm_offset_t = X__vm_offset_t /* types.h:265:23 */ +type Vm_ooffset_t = X__uint64_t /* types.h:266:20 */ +type Vm_paddr_t = X__vm_paddr_t /* types.h:267:22 */ +type Vm_pindex_t = X__uint64_t /* types.h:268:20 */ +type Vm_size_t = X__vm_size_t /* types.h:269:21 */ + +type Rman_res_t = X__rman_res_t /* types.h:271:25 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = X__sigset /* _sigset.h:55:3 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Structure returned by gettimeofday(2) system call, and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t +} /* _timeval.h:49:1 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +type X__fd_mask = uint64 /* select.h:44:23 */ +type Fd_mask = X__fd_mask /* select.h:46:19 */ + +type Sigset_t = X__sigset_t /* select.h:51:20 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set1 = struct{ F__fds_bits [16]X__fd_mask } /* select.h:73:9 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set = Fd_set1 /* select.h:75:3 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/types/types_linux_386.go b/vendor/modernc.org/libc/sys/types/types_linux_386.go index a8b201cf..a31c5771 100644 --- a/vendor/modernc.org/libc/sys/types/types_linux_386.go +++ b/vendor/modernc.org/libc/sys/types/types_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_386.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_386.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_linux_amd64.go b/vendor/modernc.org/libc/sys/types/types_linux_amd64.go index 46a8e971..ef4a29ad 100644 --- a/vendor/modernc.org/libc/sys/types/types_linux_amd64.go +++ b/vendor/modernc.org/libc/sys/types/types_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_amd64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_amd64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_linux_arm.go b/vendor/modernc.org/libc/sys/types/types_linux_arm.go index c5b8a5ff..5ff5cbc1 100644 --- a/vendor/modernc.org/libc/sys/types/types_linux_arm.go +++ b/vendor/modernc.org/libc/sys/types/types_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_linux_arm64.go b/vendor/modernc.org/libc/sys/types/types_linux_arm64.go index 4f6c9a72..e26f2a46 100644 --- a/vendor/modernc.org/libc/sys/types/types_linux_arm64.go +++ b/vendor/modernc.org/libc/sys/types/types_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_arm64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_linux_s390x.go b/vendor/modernc.org/libc/sys/types/types_linux_s390x.go index 199fdd2d..ba24cf14 100644 --- a/vendor/modernc.org/libc/sys/types/types_linux_s390x.go +++ b/vendor/modernc.org/libc/sys/types/types_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_s390x.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_linux_s390x.go -pkgname types', DO NOT EDIT. package types @@ -22,9 +22,12 @@ const ( PDP_ENDIAN = 3412 X_ATFILE_SOURCE = 1 X_BITS_BYTESWAP_H = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 X_BITS_PTHREADTYPES_ARCH_H = 1 X_BITS_PTHREADTYPES_COMMON_H = 1 X_BITS_STDINT_INTN_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BITS_UINTN_IDENTITY_H = 1 @@ -38,6 +41,7 @@ const ( X_LP64 = 1 X_POSIX_C_SOURCE = 200809 X_POSIX_SOURCE = 1 + X_RWLOCK_INTERNAL_H = 0 X_SIZET_ = 0 X_SIZE_T = 0 X_SIZE_T_ = 0 @@ -50,6 +54,7 @@ const ( X_SYS_SELECT_H = 1 X_SYS_SIZE_T_H = 0 X_SYS_TYPES_H = 1 + X_THREAD_MUTEX_INTERNAL_H = 1 X_THREAD_SHARED_TYPES_H = 1 X_T_SIZE = 0 X_T_SIZE_ = 0 @@ -75,7 +80,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -90,11 +95,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 2.6 Primitive System Data Types -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -109,7 +114,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -117,6 +122,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -237,6 +243,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -259,9 +267,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -276,7 +297,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -289,7 +310,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -304,7 +325,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -419,7 +440,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -436,14 +457,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -458,7 +477,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -495,7 +514,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -510,11 +529,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -529,43 +548,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -577,7 +618,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -598,7 +639,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -613,7 +654,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -628,78 +669,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. type U_char = X__u_char /* types.h:33:18 */ type U_short = X__u_short /* types.h:34:19 */ @@ -736,7 +805,7 @@ type Caddr_t = X__caddr_t /* types.h:115:19 */ type Key_t = X__key_t /* types.h:121:17 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -751,7 +820,7 @@ type Key_t = X__key_t /* types.h:121:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -759,7 +828,7 @@ type Key_t = X__key_t /* types.h:121:17 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -774,7 +843,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -782,7 +851,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -797,7 +866,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -805,7 +874,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Time_t = X__time_t /* time_t.h:7:18 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -820,7 +889,7 @@ type Time_t = X__time_t /* time_t.h:7:18 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -850,7 +919,7 @@ type Uint = uint32 /* types.h:150:22 */ // These size-specific names are used by some of the inet code. // Define intN_t types. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -865,10 +934,10 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -883,7 +952,7 @@ type Uint = uint32 /* types.h:150:22 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -892,18 +961,17 @@ type Int16_t = X__int16_t /* stdint-intn.h:25:19 */ type Int32_t = X__int32_t /* stdint-intn.h:26:19 */ type Int64_t = X__int64_t /* stdint-intn.h:27:19 */ -// For GCC 2.7 and later, we can use specific type-size attributes. +// These were defined by ISO C without the first `_'. +type U_int8_t = X__uint8_t /* types.h:158:19 */ +type U_int16_t = X__uint16_t /* types.h:159:20 */ +type U_int32_t = X__uint32_t /* types.h:160:20 */ +type U_int64_t = X__uint64_t /* types.h:161:20 */ -type U_int8_t = uint32 /* types.h:177:1 */ -type U_int16_t = uint32 /* types.h:178:1 */ -type U_int32_t = uint32 /* types.h:179:1 */ -type U_int64_t = uint32 /* types.h:180:1 */ - -type Register_t = int32 /* types.h:182:13 */ +type Register_t = int32 /* types.h:164:13 */ // It also defines `fd_set' and the FD_* macros for `select'. // `fd_set' type and related macros, and `select'/`pselect' declarations. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -918,11 +986,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX 1003.1g: 6.2 Select from File Descriptor Sets -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -937,11 +1005,11 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Get definition of needed basic types. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -956,12 +1024,12 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // Get __FD_* definitions. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -976,7 +1044,7 @@ type Register_t = int32 /* types.h:182:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We don't use `memset' because this would require a prototype and // the array isn't too big. @@ -991,7 +1059,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // Get definition of timer specification structures. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1006,7 +1074,7 @@ type Sigset_t = X__sigset_t /* sigset_t.h:7:20 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -1020,7 +1088,27 @@ type Timeval = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1037,14 +1125,12 @@ type Timeval = struct { // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. - // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ type Suseconds_t = X__suseconds_t /* select.h:43:23 */ @@ -1064,16 +1150,16 @@ type Fd_mask = X__fd_mask /* select.h:77:19 */ // Define some inlines helping to catch common problems. -type Blksize_t = X__blksize_t /* types.h:202:21 */ +type Blksize_t = X__blksize_t /* types.h:185:21 */ // Types from the Large File Support interface. -type Blkcnt_t = X__blkcnt64_t /* types.h:222:22 */ // Type to count number of disk blocks. -type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:226:24 */ // Type to count file system blocks. -type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file system inodes. +type Blkcnt_t = X__blkcnt64_t /* types.h:205:22 */ // Type to count number of disk blocks. +type Fsblkcnt_t = X__fsblkcnt64_t /* types.h:209:24 */ // Type to count file system blocks. +type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:213:24 */ // Type to count file system inodes. // Now add the thread types. // Declaration of common pthread types for all architectures. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1088,11 +1174,11 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // For internal mutex and condition variable definitions. // Common threading primitives definitions for both POSIX and C11. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1107,7 +1193,7 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Arch-specific definitions. Each architecture must define the following // macros to define the expected sizes of pthread data types: @@ -1122,36 +1208,6 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. // __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. // -// Also, the following macros must be define for internal pthread_mutex_t -// struct definitions (struct __pthread_mutex_s): -// -// __PTHREAD_COMPAT_PADDING_MID - any additional members after 'kind' -// and before '__spin' (for 64 bits) or -// '__nusers' (for 32 bits). -// __PTHREAD_COMPAT_PADDING_END - any additional members at the end of -// the internal structure. -// __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock -// elision or 0 otherwise. -// __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The -// preferred value for new architectures -// is 0. -// __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and -// __list will be place inside a union for -// linuxthreads compatibility. -// The preferred value for new architectures -// is 0. -// -// For a new port the preferred values for the required defines are: -// -// #define __PTHREAD_COMPAT_PADDING_MID -// #define __PTHREAD_COMPAT_PADDING_END -// #define __PTHREAD_MUTEX_LOCK_ELISION 0 -// #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -// #define __PTHREAD_MUTEX_USE_UNION 0 -// -// __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to -// eventually support lock elision using transactional memory. -// // The additional macro defines any constraint for the lock alignment // inside the thread structures: // @@ -1160,11 +1216,10 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Same idea but for the once locking primitive: // // __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. // -// And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t) -// must be defined. -// -// Copyright (C) 2003-2018 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1183,7 +1238,176 @@ type Fsfilcnt_t = X__fsfilcnt64_t /* types.h:230:24 */ // Type to count file sys // Determine the wordsize from the preprocessor defines. -// Definitions for internal mutex struct. +// Common definition of pthread_mutex_t. + +type X__pthread_internal_list = struct { + F__prev uintptr + F__next uintptr +} /* thread-shared-types.h:49:9 */ + +// Type to count file system inodes. + +// Now add the thread types. +// Declaration of common pthread types for all architectures. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// For internal mutex and condition variable definitions. +// Common threading primitives definitions for both POSIX and C11. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Arch-specific definitions. Each architecture must define the following +// macros to define the expected sizes of pthread data types: +// +// __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. +// __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. +// __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. +// __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. +// __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. +// __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. +// __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. +// __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. +// __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. +// +// The additional macro defines any constraint for the lock alignment +// inside the thread structures: +// +// __LOCK_ALIGNMENT - for internal lock/futex usage. +// +// Same idea but for the once locking primitive: +// +// __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. + +// Machine-specific pthread type layouts. Generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Common definition of pthread_mutex_t. + +type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:53:3 */ + +type X__pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:55:9 */ + +type X__pthread_slist_t = X__pthread_internal_slist /* thread-shared-types.h:58:3 */ + +// Arch-specific mutex definitions. A generic implementation is provided +// by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture +// can override it by defining: +// +// 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t +// definition). It should contains at least the internal members +// defined in the generic version. +// +// 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with +// atomic operations. +// +// 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. +// It should initialize the mutex internal flag. + +// S390 internal mutex struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +type X__pthread_mutex_s = struct { + F__lock int32 + F__count uint32 + F__owner int32 + F__nusers uint32 + F__kind int32 + F__spins int16 + F__elision int16 + F__list X__pthread_list_t +} /* struct_mutex.h:22:1 */ + +// Arch-sepecific read-write lock definitions. A generic implementation is +// provided by struct_rwlock.h. If required, an architecture can override it +// by defining: +// +// 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). +// It should contain at least the internal members defined in the +// generic version. +// +// 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. +// It should initialize the rwlock internal type. + +// S390 internal rwlock struct definitions. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type X__pthread_rwlock_arch_t = struct { F__readers uint32 @@ -1198,31 +1422,7 @@ type X__pthread_rwlock_arch_t = struct { F__pad2 uint64 F__flags uint32 _ [4]byte -} /* pthreadtypes-arch.h:50:1 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_internal_list = struct { - F__prev uintptr - F__next uintptr -} /* thread-shared-types.h:82:9 */ - -// Common definition of pthread_mutex_t. - -type X__pthread_list_t = X__pthread_internal_list /* thread-shared-types.h:86:3 */ - -// Lock elision support. - -type X__pthread_mutex_s = struct { - F__lock int32 - F__count uint32 - F__owner int32 - F__nusers uint32 - F__kind int32 - F__spins int16 - F__elision int16 - F__list X__pthread_list_t -} /* thread-shared-types.h:118:1 */ +} /* struct_rwlock.h:23:1 */ // Common definition of pthread_cond_t. @@ -1234,7 +1434,7 @@ type X__pthread_cond_s = struct { F__g1_orig_size uint32 F__wrefs uint32 F__g_signals [2]uint32 -} /* thread-shared-types.h:171:1 */ +} /* thread-shared-types.h:92:1 */ // Thread identifiers. The structure of the attribute type is not // exposed on purpose. @@ -1244,14 +1444,14 @@ type Pthread_t = uint64 /* pthreadtypes.h:27:27 */ // type is not exposed on purpose. type Pthread_mutexattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:36:3 */ // Data structure for condition variable handling. The structure of // the attribute type is not exposed on purpose. type Pthread_condattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:45:3 */ // Keys for thread-specific data @@ -1262,7 +1462,7 @@ type Pthread_once_t = int32 /* pthreadtypes.h:53:30 */ type Pthread_attr_t1 = struct { _ [0]uint64 - F__size [56]int8 + F__size [56]uint8 } /* pthreadtypes.h:56:1 */ type Pthread_attr_t = Pthread_attr_t1 /* pthreadtypes.h:62:30 */ @@ -1277,7 +1477,7 @@ type Pthread_rwlock_t = struct{ F__data X__pthread_rwlock_arch_t } /* pthreadtyp type Pthread_rwlockattr_t = struct { _ [0]uint64 - F__size [8]int8 + F__size [8]uint8 } /* pthreadtypes.h:97:3 */ // POSIX spinlock data type. @@ -1287,12 +1487,12 @@ type Pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */ // deliberately not exposed. type Pthread_barrier_t = struct { _ [0]uint64 - F__size [32]int8 + F__size [32]uint8 } /* pthreadtypes.h:112:3 */ type Pthread_barrierattr_t = struct { _ [0]uint32 - F__size [4]int8 + F__size [4]uint8 } /* pthreadtypes.h:118:3 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/types/types_netbsd_amd64.go b/vendor/modernc.org/libc/sys/types/types_netbsd_amd64.go new file mode 100644 index 00000000..477b902b --- /dev/null +++ b/vendor/modernc.org/libc/sys/types/types_netbsd_amd64.go @@ -0,0 +1,1375 @@ +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_netbsd_amd64.go -pkgname types', DO NOT EDIT. + +package types + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FD_SETSIZE = 256 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/sys/types/types_windows_386.go b/vendor/modernc.org/libc/sys/types/types_windows_386.go index d69ab047..479ce721 100644 --- a/vendor/modernc.org/libc/sys/types/types_windows_386.go +++ b/vendor/modernc.org/libc/sys/types/types_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_386.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_386.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/sys/types/types_windows_amd64.go b/vendor/modernc.org/libc/sys/types/types_windows_amd64.go index dfe772ff..dcc39aed 100644 --- a/vendor/modernc.org/libc/sys/types/types_windows_amd64.go +++ b/vendor/modernc.org/libc/sys/types/types_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_amd64.go -pkgname types', DO NOT EDIT. +// Code generated by 'ccgo sys/types/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o sys/types/types_windows_amd64.go -pkgname types', DO NOT EDIT. package types diff --git a/vendor/modernc.org/libc/termios/capi_darwin_amd64.go b/vendor/modernc.org/libc/termios/capi_darwin_amd64.go index 4e1973f6..7215e067 100644 --- a/vendor/modernc.org/libc/termios/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/termios/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_darwin_amd64.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_darwin_amd64.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/capi_freebsd_amd64.go b/vendor/modernc.org/libc/termios/capi_freebsd_amd64.go new file mode 100644 index 00000000..b8f8280d --- /dev/null +++ b/vendor/modernc.org/libc/termios/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_freebsd_amd64.go -pkgname termios', DO NOT EDIT. + +package termios + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/termios/capi_linux_386.go b/vendor/modernc.org/libc/termios/capi_linux_386.go index 9a858024..bc8ddcbe 100644 --- a/vendor/modernc.org/libc/termios/capi_linux_386.go +++ b/vendor/modernc.org/libc/termios/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_386.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_386.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/capi_linux_amd64.go b/vendor/modernc.org/libc/termios/capi_linux_amd64.go index c0d5caef..663db586 100644 --- a/vendor/modernc.org/libc/termios/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/termios/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_amd64.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_amd64.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/capi_linux_arm.go b/vendor/modernc.org/libc/termios/capi_linux_arm.go index 94134a00..be226509 100644 --- a/vendor/modernc.org/libc/termios/capi_linux_arm.go +++ b/vendor/modernc.org/libc/termios/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/capi_linux_arm64.go b/vendor/modernc.org/libc/termios/capi_linux_arm64.go index 4c924d5e..f94925e6 100644 --- a/vendor/modernc.org/libc/termios/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/termios/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm64.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm64.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/capi_linux_s390x.go b/vendor/modernc.org/libc/termios/capi_linux_s390x.go index 08d68045..b4b71f1c 100644 --- a/vendor/modernc.org/libc/termios/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/termios/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_s390x.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_s390x.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/capi_netbsd_amd64.go b/vendor/modernc.org/libc/termios/capi_netbsd_amd64.go new file mode 100644 index 00000000..4b6fad62 --- /dev/null +++ b/vendor/modernc.org/libc/termios/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo termios/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_netbsd_amd64.go -pkgname termios', DO NOT EDIT. + +package termios + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/termios/termios_darwin_amd64.go b/vendor/modernc.org/libc/termios/termios_darwin_amd64.go index e4cb841f..b462e9cc 100644 --- a/vendor/modernc.org/libc/termios/termios_darwin_amd64.go +++ b/vendor/modernc.org/libc/termios/termios_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_darwin_amd64.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_darwin_amd64.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/termios_freebsd_amd64.go b/vendor/modernc.org/libc/termios/termios_freebsd_amd64.go new file mode 100644 index 00000000..4b67b9eb --- /dev/null +++ b/vendor/modernc.org/libc/termios/termios_freebsd_amd64.go @@ -0,0 +1,999 @@ +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_freebsd_amd64.go -pkgname termios', DO NOT EDIT. + +package termios + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ALTWERASE = 0x00000200 + B0 = 0 + B110 = 110 + B115200 = 115200 + B1200 = 1200 + B134 = 134 + B14400 = 14400 + B150 = 150 + B1800 = 1800 + B19200 = 19200 + B200 = 200 + B230400 = 230400 + B2400 = 2400 + B28800 = 28800 + B300 = 300 + B38400 = 38400 + B460800 = 460800 + B4800 = 4800 + B50 = 50 + B57600 = 57600 + B600 = 600 + B7200 = 7200 + B75 = 75 + B76800 = 76800 + B921600 = 921600 + B9600 = 9600 + BRKINT = 0x00000002 + CBRK = 255 + CCAR_OFLOW = 0x00100000 + CCTS_OFLOW = 0x00010000 + CDISCARD = 15 + CDSR_OFLOW = 0x00080000 + CDSUSP = 25 + CDTR_IFLOW = 0x00040000 + CEOF = 4 + CEOL = 0xff + CEOT = 4 + CERASE = 127 + CERASE2 = 8 + CFLUSH = 15 + CIGNORE = 0x00000001 + CINTR = 3 + CKILL = 21 + CLNEXT = 22 + CLOCAL = 0x00008000 + CMIN = 1 + CNO_RTSDTR = 0x00200000 + CQUIT = 28 + CREAD = 0x00000800 + CREPRINT = 18 + CRPRNT = 18 + CRTSCTS = 196608 + CRTS_IFLOW = 0x00020000 + CS5 = 0x00000000 + CS6 = 0x00000100 + CS7 = 0x00000200 + CS8 = 0x00000300 + CSIZE = 0x00000300 + CSTART = 17 + CSTATUS = 20 + CSTOP = 19 + CSTOPB = 0x00000400 + CSUSP = 26 + CTIME = 0 + CWERASE = 23 + ECHO = 0x00000008 + ECHOCTL = 0x00000040 + ECHOE = 0x00000002 + ECHOK = 0x00000004 + ECHOKE = 0x00000001 + ECHONL = 0x00000010 + ECHOPRT = 0x00000020 + EXTA = 19200 + EXTB = 38400 + EXTPROC = 0x00000800 + FLUSHO = 0x00800000 + H4DISC = 7 + HUPCL = 0x00004000 + ICANON = 0x00000100 + ICRNL = 0x00000100 + IEXTEN = 0x00000400 + IGNBRK = 0x00000001 + IGNCR = 0x00000080 + IGNPAR = 0x00000004 + IMAXBEL = 0x00002000 + INLCR = 0x00000040 + INPCK = 0x00000010 + IOCPARM_MASK = 8191 + IOCPARM_MAX = 8192 + IOCPARM_SHIFT = 13 + IOC_DIRMASK = 3758096384 + IOC_IN = 0x80000000 + IOC_INOUT = 3221225472 + IOC_OUT = 0x40000000 + IOC_VOID = 0x20000000 + ISIG = 0x00000080 + ISTRIP = 0x00000020 + IXANY = 0x00000800 + IXOFF = 0x00000400 + IXON = 0x00000200 + MDMBUF = 1048576 + NCCS = 20 + NETGRAPHDISC = 6 + NOFLSH = 0x80000000 + NOKERNINFO = 0x02000000 + OCRNL = 0x00000010 + ONLCR = 0x00000002 + ONLRET = 0x00000040 + ONOCR = 0x00000020 + ONOEOT = 0x00000008 + OPOST = 0x00000001 + OXTABS = 4 + PARENB = 0x00001000 + PARMRK = 0x00000008 + PARODD = 0x00002000 + PENDIN = 0x20000000 + PPPDISC = 5 + SLIPDISC = 4 + TAB0 = 0x00000000 + TAB3 = 0x00000004 + TABDLY = 0x00000004 + TCIFLUSH = 1 + TCIOFF = 3 + TCIOFLUSH = 3 + TCION = 4 + TCOFLUSH = 2 + TCOOFF = 1 + TCOON = 2 + TCSADRAIN = 1 + TCSAFLUSH = 2 + TCSANOW = 0 + TCSASOFT = 0x10 + TIOCM_CAR = 64 + TIOCM_CD = 64 + TIOCM_CTS = 0040 + TIOCM_DCD = 0100 + TIOCM_DSR = 0400 + TIOCM_DTR = 0002 + TIOCM_LE = 0001 + TIOCM_RI = 0200 + TIOCM_RNG = 128 + TIOCM_RTS = 0004 + TIOCM_SR = 0020 + TIOCM_ST = 0010 + TIOCPKT_DATA = 0x00 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x01 + TIOCPKT_FLUSHWRITE = 0x02 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x08 + TIOCPKT_STOP = 0x04 + TOSTOP = 0x00400000 + TTYDEF_CFLAG = 19200 + TTYDEF_IFLAG = 11010 + TTYDEF_LFLAG = 1483 + TTYDEF_LFLAG_ECHO = 1483 + TTYDEF_LFLAG_NOECHO = 1408 + TTYDEF_OFLAG = 3 + TTYDEF_SPEED = 9600 + TTYDISC = 0 + VDISCARD = 15 + VDSUSP = 11 + VEOF = 0 + VEOL = 1 + VEOL2 = 2 + VERASE = 3 + VERASE2 = 7 + VINTR = 8 + VKILL = 5 + VLNEXT = 14 + VMIN = 16 + VQUIT = 9 + VREPRINT = 6 + VSTART = 12 + VSTATUS = 18 + VSTOP = 13 + VSUSP = 10 + VTIME = 17 + VWERASE = 4 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PID_T_DECLARED = 0 + X_POSIX_VDISABLE = 0xff + X_SYS_CDEFS_H_ = 0 + X_SYS_IOCCOM_H_ = 0 + X_SYS_TTYCOM_H_ = 0 + X_SYS_TTYDEFAULTS_H_ = 0 + X_SYS__TERMIOS_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_SYS__WINSIZE_H_ = 0 + X_TERMIOS_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1989, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)termios.h 8.3 (Berkeley) 3/28/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1989, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)termios.h 8.3 (Berkeley) 3/28/94 +// $FreeBSD$ + +// Special Control Characters +// +// Index into c_cc[] character array. +// +// Name Subscript Enabled by +// 7 ex-spare 1 +// 19 spare 2 + +// Input flags - software input processing + +// Output flags - software output processing + +// Control flags - hardware control of terminal + +// "Local" flags - dumping ground for other state +// +// Warning: some flags in this structure begin with +// the letter "I" and look like they belong in the +// input flag. + +// Standard speeds + +type Tcflag_t = uint32 /* _termios.h:216:22 */ +type Cc_t = uint8 /* _termios.h:217:23 */ +type Speed_t = uint32 /* _termios.h:218:22 */ + +type Termios = struct { + Fc_iflag Tcflag_t + Fc_oflag Tcflag_t + Fc_cflag Tcflag_t + Fc_lflag Tcflag_t + Fc_cc [20]Cc_t + Fc_ispeed Speed_t + Fc_ospeed Speed_t +} /* _termios.h:220:1 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1989, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttycom.h 8.1 (Berkeley) 3/28/94 +// $FreeBSD$ + +// Window/terminal size structure. This information is stored by the kernel +// in order to provide a consistent interface, but is not used by the kernel. +type Winsize = struct { + Fws_row uint16 + Fws_col uint16 + Fws_xpixel uint16 + Fws_ypixel uint16 +} /* _winsize.h:42:1 */ + +type Pid_t = X__pid_t /* termios.h:46:18 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1989, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttycom.h 8.1 (Berkeley) 3/28/94 +// $FreeBSD$ + +// Tty ioctl's except for those supported only for backwards compatibility +// with the old tty driver. + +// 0-2 compat +// 3-7 unused +// 8-10 compat +// 11-12 unused +// 17-18 compat +// 23-25 unused +// 29-85 unused +// 88 unused +// 89-91 conflicts: tun and tap +// 92-93 tun and tap +// 94-97 conflicts: tun and tap +// 100 unused +// 105 unused +// 116-117 compat +// 124-127 compat + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 +// $FreeBSD$ + +// System wide defaults for terminal state. + +// Defaults on "first" open. + +// Control Character Defaults +// XXX: A lot of code uses lowercase characters, but control-character +// conversion is actually only valid when applied to uppercase +// characters. We just treat lowercase characters as if they were +// inserted as uppercase. +// compat + +// PROTECTED INCLUSION ENDS HERE + +// #define TTYDEFCHARS to include an array of default control characters. +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/termios/termios_linux_386.go b/vendor/modernc.org/libc/termios/termios_linux_386.go index 0025d9a0..c032e8cc 100644 --- a/vendor/modernc.org/libc/termios/termios_linux_386.go +++ b/vendor/modernc.org/libc/termios/termios_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_386.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_386.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/termios_linux_amd64.go b/vendor/modernc.org/libc/termios/termios_linux_amd64.go index bd09ff7d..43c94f00 100644 --- a/vendor/modernc.org/libc/termios/termios_linux_amd64.go +++ b/vendor/modernc.org/libc/termios/termios_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_amd64.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_amd64.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/termios_linux_arm.go b/vendor/modernc.org/libc/termios/termios_linux_arm.go index 9bab8c40..c084805f 100644 --- a/vendor/modernc.org/libc/termios/termios_linux_arm.go +++ b/vendor/modernc.org/libc/termios/termios_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/termios_linux_arm64.go b/vendor/modernc.org/libc/termios/termios_linux_arm64.go index bb2d96e3..5eaff40e 100644 --- a/vendor/modernc.org/libc/termios/termios_linux_arm64.go +++ b/vendor/modernc.org/libc/termios/termios_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm64.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_arm64.go -pkgname termios', DO NOT EDIT. package termios diff --git a/vendor/modernc.org/libc/termios/termios_linux_s390x.go b/vendor/modernc.org/libc/termios/termios_linux_s390x.go index bb326fd8..dce63b15 100644 --- a/vendor/modernc.org/libc/termios/termios_linux_s390x.go +++ b/vendor/modernc.org/libc/termios/termios_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_s390x.go -pkgname termios', DO NOT EDIT. +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_linux_s390x.go -pkgname termios', DO NOT EDIT. package termios @@ -50,8 +50,8 @@ const ( BS0 = 0000000 BS1 = 0020000 BSDLY = 0020000 - CBAUD = 0010017 - CBAUDEX = 0010000 + CBAUD = 000000010017 + CBAUDEX = 000000010000 CBRK = 0 CDISCARD = 15 CDSUSP = 25 @@ -152,6 +152,7 @@ const ( TCSADRAIN = 1 TCSAFLUSH = 2 TCSANOW = 0 + TIOCSER_TEMT = 0x01 TOSTOP = 0000400 TTYDEF_CFLAG = 1440 TTYDEF_IFLAG = 11554 @@ -181,6 +182,7 @@ const ( XCASE = 0000004 XTABS = 0014000 X_ATFILE_SOURCE = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_DEFAULT_SOURCE = 1 @@ -217,7 +219,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -232,11 +234,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 7.1-2 General Terminal Interface -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -251,7 +253,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -259,6 +261,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -379,6 +382,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -401,9 +406,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -418,7 +436,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -431,7 +449,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -446,7 +464,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -561,7 +579,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -578,14 +596,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -600,7 +616,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -638,7 +654,7 @@ type X__float128 = float64 /* :47:21 */ // We need `pid_t'. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -653,11 +669,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -672,43 +688,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -720,7 +758,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -741,7 +779,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -756,7 +794,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -771,85 +809,12 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. - -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. - -// Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ - -// Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ - -// Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ - -// Types from the Large File Support interface. - -// Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ - -// Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ - -// Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ - -// Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ - -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. - -// Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ -// Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ - -// Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ - -// C99: An integer type that can be accessed as an atomic entity, -// even in the presence of asynchronous interrupts. -// It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ - -type Pid_t = X__pid_t /* termios.h:30:17 */ - -// Get the system-dependent definitions of `struct termios', `tcflag_t', -// `cc_t', `speed_t', and all the macros specifying the flag bits. -// termios type and macro definitions. Linux version. -// Copyright (C) 1993-2018 Free Software Foundation, Inc. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -864,12 +829,131 @@ type Pid_t = X__pid_t /* termios.h:30:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . + +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. + +// Clock ID used in clock and timer functions. +type X__clockid_t = int32 /* types.h:168:29 */ + +// Timer ID returned by `timer_create'. +type X__timer_t = uintptr /* types.h:171:12 */ + +// Type to represent block size. +type X__blksize_t = int64 /* types.h:174:29 */ + +// Types from the Large File Support interface. + +// Type to count number of disk blocks. +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ + +// Type to count file system blocks. +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ + +// Type to count file system nodes. +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ + +// Type of miscellaneous file system fields. +type X__fsword_t = int64 /* types.h:191:28 */ + +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. + +// Signed long type used in system calls. +type X__syscall_slong_t = int64 /* types.h:196:33 */ +// Unsigned long type used in system calls. +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__intptr_t = int64 /* types.h:206:25 */ + +// Duplicate info from sys/socket.h. +type X__socklen_t = uint32 /* types.h:209:23 */ + +// C99: An integer type that can be accessed as an atomic entity, +// even in the presence of asynchronous interrupts. +// It is not currently necessary for this to be machine-specific. +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. + +type Pid_t = X__pid_t /* termios.h:30:17 */ + +// Get the system-dependent definitions of `struct termios', `tcflag_t', +// `cc_t', `speed_t', and all the macros specifying the flag bits. +// termios type and macro definitions. Linux version. +// Copyright (C) 1993-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . type Cc_t = uint8 /* termios.h:23:23 */ type Speed_t = uint32 /* termios.h:24:22 */ type Tcflag_t = uint32 /* termios.h:25:22 */ +// struct termios definition. Linux/generic version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library. If not, see +// . + type Termios = struct { Fc_iflag Tcflag_t Fc_oflag Tcflag_t @@ -880,7 +964,7 @@ type Termios = struct { _ [3]byte Fc_ispeed Speed_t Fc_ospeed Speed_t -} /* termios.h:28:1 */ +} /* termios-struct.h:24:1 */ // - // Copyright (c) 1982, 1986, 1993 @@ -928,4 +1012,4 @@ type Termios = struct { // #define TTYDEFCHARS to include an array of default control characters. -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/termios/termios_netbsd_amd64.go b/vendor/modernc.org/libc/termios/termios_netbsd_amd64.go new file mode 100644 index 00000000..fbd514b2 --- /dev/null +++ b/vendor/modernc.org/libc/termios/termios_netbsd_amd64.go @@ -0,0 +1,733 @@ +// Code generated by 'ccgo termios/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o termios/termios_netbsd_amd64.go -pkgname termios', DO NOT EDIT. + +package termios + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + ALTWERASE = 0x00000200 + ARG_MAX = 262144 + B0 = 0 + B1000000 = 1000000 + B110 = 110 + B115200 = 115200 + B1200 = 1200 + B134 = 134 + B14400 = 14400 + B150 = 150 + B1500000 = 1500000 + B1800 = 1800 + B19200 = 19200 + B200 = 200 + B2000000 = 2000000 + B230400 = 230400 + B2400 = 2400 + B2500000 = 2500000 + B28800 = 28800 + B300 = 300 + B3000000 = 3000000 + B3500000 = 3500000 + B38400 = 38400 + B4000000 = 4000000 + B460800 = 460800 + B4800 = 4800 + B50 = 50 + B500000 = 500000 + B57600 = 57600 + B600 = 600 + B7200 = 7200 + B75 = 75 + B76800 = 76800 + B921600 = 921600 + B9600 = 9600 + BC_DIM_MAX = 65535 + BRKINT = 0x00000002 + CCTS_OFLOW = 65536 + CDISCARD = 15 + CDSUSP = 25 + CDTRCTS = 0x00020000 + CEOF = 4 + CEOT = 4 + CERASE = 0177 + CFLUSH = 15 + CHILD_MAX = 160 + CHWFLOW = 1245184 + CIGNORE = 0x00000001 + CINTR = 3 + CKILL = 21 + CLNEXT = 22 + CLOCAL = 0x00008000 + CMIN = 1 + COLL_WEIGHTS_MAX = 2 + CQUIT = 034 + CREAD = 0x00000800 + CREPRINT = 18 + CRPRNT = 18 + CRTSCTS = 0x00010000 + CRTS_IFLOW = 65536 + CS5 = 0x00000000 + CS6 = 0x00000100 + CS7 = 0x00000200 + CS8 = 0x00000300 + CSIZE = 0x00000300 + CSTART = 17 + CSTATUS = 20 + CSTOP = 19 + CSTOPB = 0x00000400 + CSUSP = 26 + CTIME = 0 + CWERASE = 23 + ECHO = 0x00000008 + ECHOCTL = 0x00000040 + ECHOE = 0x00000002 + ECHOK = 0x00000004 + ECHOKE = 0x00000001 + ECHONL = 0x00000010 + ECHOPRT = 0x00000020 + EXPR_NEST_MAX = 32 + EXTA = 19200 + EXTB = 38400 + EXTPROC = 0x00000800 + FLUSHO = 0x00800000 + GID_MAX = 2147483647 + HDLCDISC = 9 + HUPCL = 0x00004000 + ICANON = 0x00000100 + ICRNL = 0x00000100 + IEXTEN = 0x00000400 + IGNBRK = 0x00000001 + IGNCR = 0x00000080 + IGNPAR = 0x00000004 + IMAXBEL = 0x00002000 + INLCR = 0x00000040 + INPCK = 0x00000010 + IOCGROUP_SHIFT = 8 + IOCPARM_MASK = 0x1fff + IOCPARM_SHIFT = 16 + IOV_MAX = 1024 + ISIG = 0x00000080 + ISTRIP = 0x00000020 + IXANY = 0x00000800 + IXOFF = 0x00000400 + IXON = 0x00000200 + LINE_MAX = 2048 + LINK_MAX = 32767 + LOGIN_NAME_MAX = 17 + MAX_CANON = 255 + MAX_INPUT = 255 + MDMBUF = 0x00100000 + NAME_MAX = 511 + NCCS = 20 + NGROUPS_MAX = 16 + NOFLSH = 0x80000000 + NOKERNINFO = 0x02000000 + NZERO = 20 + OCRNL = 0x00000010 + ONLCR = 0x00000002 + ONLRET = 0x00000040 + ONOCR = 0x00000020 + ONOEOT = 0x00000008 + OPEN_MAX = 128 + OPOST = 0x00000001 + OXTABS = 0x00000004 + PARENB = 0x00001000 + PARMRK = 0x00000008 + PARODD = 0x00002000 + PATH_MAX = 1024 + PENDIN = 0x20000000 + PIPE_BUF = 512 + PPPDISC = 5 + RE_DUP_MAX = 255 + SLIPDISC = 4 + STRIPDISC = 6 + TABLDISC = 3 + TCIFLUSH = 1 + TCIOFF = 3 + TCIOFLUSH = 3 + TCION = 4 + TCOFLUSH = 2 + TCOOFF = 1 + TCOON = 2 + TCSADRAIN = 1 + TCSAFLUSH = 2 + TCSANOW = 0 + TCSASOFT = 0x10 + TIOCFLAG_CDTRCTS = 0x10 + TIOCFLAG_CLOCAL = 0x02 + TIOCFLAG_CRTSCTS = 0x04 + TIOCFLAG_MDMBUF = 0x08 + TIOCFLAG_SOFTCAR = 0x01 + TIOCM_CAR = 0100 + TIOCM_CD = 64 + TIOCM_CTS = 0040 + TIOCM_DSR = 0400 + TIOCM_DTR = 0002 + TIOCM_LE = 0001 + TIOCM_RI = 128 + TIOCM_RNG = 0200 + TIOCM_RTS = 0004 + TIOCM_SR = 0020 + TIOCM_ST = 0010 + TIOCPKT_DATA = 0x00 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x01 + TIOCPKT_FLUSHWRITE = 0x02 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x08 + TIOCPKT_STOP = 0x04 + TOSTOP = 0x00400000 + TTLINEDNAMELEN = 32 + TTYDEF_CFLAG = 19200 + TTYDEF_IFLAG = 11010 + TTYDEF_LFLAG = 1483 + TTYDEF_OFLAG = 7 + TTYDEF_SPEED = 9600 + TTYDISC = 0 + UID_MAX = 2147483647 + VDISCARD = 15 + VDSUSP = 11 + VEOF = 0 + VEOL = 1 + VEOL2 = 2 + VERASE = 3 + VINTR = 8 + VKILL = 5 + VLNEXT = 14 + VMIN = 16 + VQUIT = 9 + VREPRINT = 6 + VSTART = 12 + VSTATUS = 18 + VSTOP = 13 + VSUSP = 10 + VTIME = 17 + VWERASE = 4 + X_AMD64_INT_TYPES_H_ = 0 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_NETBSD_SYS_TTYCOM_H_ = 0 + X_PATH_PTMDEV = "/dev/ptm" + X_POSIX_SYS_TTYCOM_H_ = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_IOCCOM_H_ = 0 + X_SYS_SYSLIMITS_H_ = 0 + X_SYS_TERMIOS_H_ = 0 + X_SYS_TTYDEFAULTS_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Special Control Characters +// +// Index into c_cc[] character array. +// +// Name Subscript Enabled by +// 7 spare 1 +// 19 spare 2 + +// Input flags - software input processing + +// Output flags - software output processing + +// Control flags - hardware control of terminal + +// "Local" flags - dumping ground for other state +// +// Warning: some flags in this structure begin with +// the letter "I" and look like they belong in the +// input flag. + +type Tcflag_t = uint32 /* termios.h:188:22 */ +type Cc_t = uint8 /* termios.h:189:23 */ +type Speed_t = uint32 /* termios.h:190:22 */ + +type Termios = struct { + Fc_iflag Tcflag_t + Fc_oflag Tcflag_t + Fc_cflag Tcflag_t + Fc_lflag Tcflag_t + Fc_cc [20]Cc_t + Fc_ispeed int32 + Fc_ospeed int32 +} /* termios.h:192:1 */ + +// Commands passed to tcsetattr() for setting the termios structure. + +// Standard speeds + +type Pid_t = X__pid_t /* termios.h:265:18 */ + +// Include tty ioctl's that aren't just for backwards compatibility +// with the old tty driver. These ioctl definitions were previously +// in . Most of this appears only when _NETBSD_SOURCE +// is defined, but (at least) struct winsize has been made standard, +// and needs to be visible here (as well as via the old .) +// $NetBSD: ttycom.h,v 1.21 2017/10/25 06:32:59 kre Exp $ + +// - +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttycom.h 8.1 (Berkeley) 3/28/94 + +// $NetBSD: syslimits.h,v 1.28 2015/08/21 07:19:39 uebayasi Exp $ + +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)syslimits.h 8.1 (Berkeley) 6/2/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// kept in sync with MAXNAMLEN + +// IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2 + +// X/Open CAE Specification Issue 5 Version 2 + +// $NetBSD: ioccom.h,v 1.13 2019/05/26 10:21:33 hannken Exp $ + +// - +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ioccom.h 8.3 (Berkeley) 1/9/95 + +// Ioctl's have the command encoded in the lower word, and the size of +// any in or out parameters in the upper word. The high 3 bits of the +// upper word are used to encode the in/out status of the parameter. +// +// 31 29 28 16 15 8 7 0 +// +---------------------------------------------------------------+ +// | I/O | Parameter Length | Command Group | Command | +// +---------------------------------------------------------------+ + +// no parameters +// copy parameters out +// copy parameters in +// copy parameters in and out +// mask for IN/OUT/VOID + +// this should be _IORW, but stdio got there first + +// Tty ioctl's except for those supported only for backwards compatibility +// with the old tty driver. + +// Window/terminal size structure. This information is stored by the kernel +// in order to provide a consistent interface, but is not used by the kernel. +type Winsize = struct { + Fws_row uint16 + Fws_col uint16 + Fws_xpixel uint16 + Fws_ypixel uint16 +} /* ttycom.h:54:1 */ + +// The following are not exposed when imported via +// when _POSIX_SOURCE (et.al.) is defined (and hence _NETBSD_SOURCE +// is not, unless that is added manually.) + +// ptmget, for /dev/ptm pty getting ioctl TIOCPTMGET, and for TIOCPTSNAME +type Ptmget = struct { + Fcfd int32 + Fsfd int32 + Fcn [1024]int8 + Fsn [1024]int8 +} /* ttycom.h:74:1 */ + +// 8-10 compat +// 15 unused +// 17-18 compat + +// This is the maximum length of a line discipline's name. +type Linedn_t = [32]int8 /* ttycom.h:111:14 */ + +// END OF PROTECTED INCLUDE. + +// $NetBSD: ttydefaults.h,v 1.16 2008/05/24 14:06:39 yamt Exp $ + +// - +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 + +// System wide defaults for terminal state. + +// Defaults on "first" open. + +// Control Character Defaults +// compat + +// PROTECTED INCLUSION ENDS HERE + +// #define TTYDEFCHARS to include an array of default control characters. +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/time/capi_darwin_amd64.go b/vendor/modernc.org/libc/time/capi_darwin_amd64.go index 13c6c278..4ca486cc 100644 --- a/vendor/modernc.org/libc/time/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/time/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_darwin_amd64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_darwin_amd64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_freebsd_amd64.go b/vendor/modernc.org/libc/time/capi_freebsd_amd64.go new file mode 100644 index 00000000..f79c0726 --- /dev/null +++ b/vendor/modernc.org/libc/time/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_freebsd_amd64.go -pkgname time', DO NOT EDIT. + +package time + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/time/capi_linux_386.go b/vendor/modernc.org/libc/time/capi_linux_386.go index d4df5254..a008e686 100644 --- a/vendor/modernc.org/libc/time/capi_linux_386.go +++ b/vendor/modernc.org/libc/time/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_386.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_386.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_linux_amd64.go b/vendor/modernc.org/libc/time/capi_linux_amd64.go index 57b4e512..8ce1aea1 100644 --- a/vendor/modernc.org/libc/time/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/time/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_amd64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_amd64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_linux_arm.go b/vendor/modernc.org/libc/time/capi_linux_arm.go index db1d8c8b..fcdd39cd 100644 --- a/vendor/modernc.org/libc/time/capi_linux_arm.go +++ b/vendor/modernc.org/libc/time/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_linux_arm64.go b/vendor/modernc.org/libc/time/capi_linux_arm64.go index cf311a58..200888b0 100644 --- a/vendor/modernc.org/libc/time/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/time/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_linux_s390x.go b/vendor/modernc.org/libc/time/capi_linux_s390x.go index 35b215eb..4dfacc56 100644 --- a/vendor/modernc.org/libc/time/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/time/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_s390x.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_s390x.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_netbsd_amd64.go b/vendor/modernc.org/libc/time/capi_netbsd_amd64.go new file mode 100644 index 00000000..077bfef9 --- /dev/null +++ b/vendor/modernc.org/libc/time/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_netbsd_amd64.go -pkgname time', DO NOT EDIT. + +package time + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/time/capi_windows_386.go b/vendor/modernc.org/libc/time/capi_windows_386.go index 63022a4d..e46d8d23 100644 --- a/vendor/modernc.org/libc/time/capi_windows_386.go +++ b/vendor/modernc.org/libc/time/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_386.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_386.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/capi_windows_amd64.go b/vendor/modernc.org/libc/time/capi_windows_amd64.go index b4e2a389..e4363b28 100644 --- a/vendor/modernc.org/libc/time/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/time/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_amd64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_amd64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_darwin_amd64.go b/vendor/modernc.org/libc/time/time_darwin_amd64.go index 3f2f1cb5..819b5db5 100644 --- a/vendor/modernc.org/libc/time/time_darwin_amd64.go +++ b/vendor/modernc.org/libc/time/time_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_darwin_amd64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_darwin_amd64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_freebsd_amd64.go b/vendor/modernc.org/libc/time/time_freebsd_amd64.go new file mode 100644 index 00000000..a58c29f8 --- /dev/null +++ b/vendor/modernc.org/libc/time/time_freebsd_amd64.go @@ -0,0 +1,877 @@ +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_freebsd_amd64.go -pkgname time', DO NOT EDIT. + +package time + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + CLK_TCK = 128 + CLOCKS_PER_SEC = 128 + CLOCK_MONOTONIC = 4 + CLOCK_MONOTONIC_FAST = 12 + CLOCK_MONOTONIC_PRECISE = 11 + CLOCK_PROCESS_CPUTIME_ID = 15 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_REALTIME_FAST = 10 + CLOCK_REALTIME_PRECISE = 9 + CLOCK_SECOND = 13 + CLOCK_THREAD_CPUTIME_ID = 14 + CLOCK_UPTIME = 5 + CLOCK_UPTIME_FAST = 8 + CLOCK_UPTIME_PRECISE = 7 + CLOCK_VIRTUAL = 1 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + X_CLOCKID_T_DECLARED = 0 + X_CLOCK_T_DECLARED = 0 + X_FILE_OFFSET_BITS = 64 + X_LOCALE_T_DEFINED = 0 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_PID_T_DECLARED = 0 + X_SIZE_T_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIMER_T_DECLARED = 0 + X_TIME_H_ = 0 + X_TIME_T_DECLARED = 0 + X_XLOCALE_LOCALE1_H = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2003 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +// Frequency of the clock ticks reported by times(). Deprecated - use +// sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) + +// Frequency of the clock ticks reported by clock(). + +type Clock_t = X__clock_t /* time.h:62:19 */ + +type Time_t = X__time_t /* time.h:67:18 */ + +// New in POSIX 1003.1b-1993. +type Clockid_t = X__clockid_t /* time.h:81:21 */ + +type Timer_t = X__timer_t /* time.h:86:19 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +type Pid_t = X__pid_t /* time.h:95:18 */ + +// These macros are also in sys/time.h. + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:129:1 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011, 2012 The FreeBSD Foundation +// All rights reserved. +// +// This software was developed by David Chisnall under sponsorship from +// the FreeBSD Foundation. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Locale_t = uintptr /* _time.h:36:25 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/time/time_linux_386.go b/vendor/modernc.org/libc/time/time_linux_386.go index 08731612..6029bf9f 100644 --- a/vendor/modernc.org/libc/time/time_linux_386.go +++ b/vendor/modernc.org/libc/time/time_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_386.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_386.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_linux_amd64.go b/vendor/modernc.org/libc/time/time_linux_amd64.go index af52433a..5bfcc530 100644 --- a/vendor/modernc.org/libc/time/time_linux_amd64.go +++ b/vendor/modernc.org/libc/time/time_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_amd64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_amd64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_linux_arm.go b/vendor/modernc.org/libc/time/time_linux_arm.go index a2ccd1a7..bc9575ed 100644 --- a/vendor/modernc.org/libc/time/time_linux_arm.go +++ b/vendor/modernc.org/libc/time/time_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_linux_arm64.go b/vendor/modernc.org/libc/time/time_linux_arm64.go index bee691d4..b037a512 100644 --- a/vendor/modernc.org/libc/time/time_linux_arm64.go +++ b/vendor/modernc.org/libc/time/time_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_arm64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_linux_s390x.go b/vendor/modernc.org/libc/time/time_linux_s390x.go index b991fd37..eaf6aa41 100644 --- a/vendor/modernc.org/libc/time/time_linux_s390x.go +++ b/vendor/modernc.org/libc/time/time_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_s390x.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_linux_s390x.go -pkgname time', DO NOT EDIT. package time @@ -29,6 +29,9 @@ const ( TIMER_ABSTIME = 1 TIME_UTC = 1 X_ATFILE_SOURCE = 1 + X_BITS_ENDIANNESS_H = 1 + X_BITS_ENDIAN_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TIME_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 @@ -96,7 +99,7 @@ type X__float128 = float64 /* :47:21 */ // This defines CLOCKS_PER_SEC, which is the number of processor clock // ticks per second, and possibly a number of other constants. // System-dependent timing definitions. Linux version. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -111,12 +114,12 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -131,11 +134,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -150,43 +153,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -198,7 +223,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -219,7 +244,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -234,7 +259,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -249,78 +274,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. // ISO/IEC 9899:1999 7.23.1: Components of time // The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is @@ -347,7 +400,7 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // may also need to be defined by other headers. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -362,7 +415,7 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -370,7 +423,7 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -385,7 +438,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -393,7 +446,7 @@ type Clock_t = X__clock_t /* clock_t.h:7:19 */ type Time_t = X__time_t /* time_t.h:7:18 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -408,7 +461,7 @@ type Time_t = X__time_t /* time_t.h:7:18 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -431,7 +484,27 @@ type Tm = struct { // NB: Include guard matches what uses. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Never include this file directly; use instead. + +// Endian macros for string.h functions +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -448,17 +521,30 @@ type Tm = struct { // License along with the GNU C Library; if not, see // . -// Never include this file directly; use instead. +// Definitions for byte order, according to significance of bytes, +// from low addresses to high addresses. The value is what you get by +// putting '4' in the most significant byte, '3' in the second most +// significant byte, '2' in the second least significant byte, and '1' +// in the least significant byte, and then writing down one digit for +// each byte, starting with the byte at the lowest address at the left, +// and proceeding to the byte with the highest address at the right. + +// This file defines `__BYTE_ORDER' for the particular machine. + +// S/390 is big-endian. + +// Some machines may need to use a different endianness for floating point +// values. // POSIX.1b structure for a time value. This is like a `struct timeval' but // has nanoseconds instead of microseconds. type Timespec = struct { Ftv_sec X__time_t Ftv_nsec X__syscall_slong_t -} /* struct_timespec.h:9:1 */ +} /* struct_timespec.h:10:1 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -473,7 +559,7 @@ type Timespec = struct { // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -481,7 +567,7 @@ type Timespec = struct { type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -496,7 +582,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -504,7 +590,7 @@ type Clockid_t = X__clockid_t /* clockid_t.h:7:21 */ type Timer_t = X__timer_t /* timer_t.h:7:19 */ // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -519,7 +605,7 @@ type Timer_t = X__timer_t /* timer_t.h:7:19 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. @@ -540,7 +626,7 @@ type Itimerspec = struct { type Pid_t = X__pid_t /* time.h:54:17 */ // Definition of locale_t. -// Copyright (C) 2017-2018 Free Software Foundation, Inc. +// Copyright (C) 2017-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -555,10 +641,10 @@ type Pid_t = X__pid_t /* time.h:54:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Definition of struct __locale_struct and __locale_t. -// Copyright (C) 1997-2018 Free Software Foundation, Inc. +// Copyright (C) 1997-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // Contributed by Ulrich Drepper , 1997. // @@ -574,7 +660,7 @@ type Pid_t = X__pid_t /* time.h:54:17 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX.1-2008: the locale_t type, representing a locale context // (implementation-namespace version). This type should be treated @@ -593,4 +679,4 @@ type X__locale_t = uintptr /* __locale_t.h:42:32 */ type Locale_t = X__locale_t /* locale_t.h:24:20 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/time/time_netbsd_amd64.go b/vendor/modernc.org/libc/time/time_netbsd_amd64.go new file mode 100644 index 00000000..62423a45 --- /dev/null +++ b/vendor/modernc.org/libc/time/time_netbsd_amd64.go @@ -0,0 +1,2359 @@ +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_netbsd_amd64.go -pkgname time', DO NOT EDIT. + +package time + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + CLOCKS_PER_SEC = 100 + CLOCK_MONOTONIC = 3 + CLOCK_PROCESS_CPUTIME_ID = 0x40000000 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_THREAD_CPUTIME_ID = 0x20000000 + CLOCK_VIRTUAL = 1 + FD_SETSIZE = 256 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + ITIMER_MONOTONIC = 3 + ITIMER_PROF = 2 + ITIMER_REAL = 0 + ITIMER_VIRTUAL = 1 + LITTLE_ENDIAN = 1234 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIME_UTC = 1 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_PDP_ENDIAN = 3412 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_IDTYPE_H_ = 0 + X_SYS_NULL_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_SIGTYPES_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TIME_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_TIME_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 +) + +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +const ( /* idtype.h:41:1: */ + P_MYID = -1 // Me/my process group + P_ALL = 0 // All processes. + P_PID = 1 // A process identifier. + P_LWPID = 2 // An LWP identifier. + P_PPID = 3 // A parent process identifier. + P_PGID = 4 // A process group identifier. + P_SID = 5 // A session identifier. + P_CID = 6 // A scheduling class identifier. + P_UID = 7 // A user identifier. + P_GID = 8 // A group identifier. + P_TASKID = 9 // A task identifier. + P_PROJID = 10 // A project identifier. + P_POOLID = 11 // A pool identifier. + P_ZONEID = 12 // A zone identifier. + P_CTID = 13 // A (process) contract identifier. + P_CPUID = 14 // CPU identifier. + P_PSETID = 15 // Processor set identifier. + X_P_MAXIDTYPE = 2147483647 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ + +// Written by Klaus Klein , December 22, 1999. +// Public domain. + +type Clock_t = uint32 /* time.h:49:23 */ + +type Time_t = X__int64_t /* time.h:54:22 */ + +type Clockid_t = int32 /* time.h:64:25 */ + +type Timer_t = int32 /* time.h:69:23 */ + +type Tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:75:1 */ + +// ISO/IEC 9899:201x 7.27.1/3 Components of time +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* timespec.h:47:1 */ + +// $NetBSD: time.h,v 1.79 2017/01/17 15:28:34 maya Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ + +// Structure returned by gettimeofday(2) system call, +// and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte +} /* time.h:44:1 */ + +// $NetBSD: timespec.h,v 1.1 2015/07/31 12:51:32 kamil Exp $ + +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// +// Extracted by Kamil Rytarowski from: +// NetBSD: src/sys/sys/time.h,v 1.69 2015/05/19 23:35:11 riastradh Exp + +// Note: timezone is obsolete. All timezone handling is now in +// userland. Its just here for back compatibility. +type Timezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} /* time.h:65:1 */ + +// Operations on timevals. + +// hide bintime for _STANDALONE because this header is used for hpcboot.exe, +// which is built with compilers which don't recognize LL suffix. +// http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html +type Bintime = struct { + Fsec Time_t + Ffrac Uint64_t +} /* time.h:102:1 */ + +// Operations on timespecs. + +// Names of the interval timers, and structure +// defining a timer setting. +// NB: Must match the CLOCK_ constants below. + +type Itimerval = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } + Fit_value struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + _ [4]byte + } +} /* time.h:280:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* time.h:289:1 */ + +// $NetBSD: select.h,v 1.37 2014/04/25 15:52:45 pooka Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)select.h 8.2 (Berkeley) 1/4/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: sigtypes.h,v 1.11 2017/01/12 18:29:14 christos Exp $ + +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 + +// This header file defines various signal-related types. We also keep +// the macros to manipulate sigset_t here, to encapsulate knowledge of +// its internals. + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type Sigset_t = struct{ F__bits [4]X__uint32_t } /* sigtypes.h:62:3 */ + +// Macro for manipulating signal masks. + +type Sigaltstack = struct { + Fss_sp uintptr + Fss_size Size_t + Fss_flags int32 + _ [4]byte +} /* sigtypes.h:108:9 */ + +// Macro for manipulating signal masks. + +type Stack_t = Sigaltstack /* sigtypes.h:116:3 */ +// $NetBSD: idtype.h,v 1.5 2016/04/09 17:02:51 riastradh Exp $ + +// - +// Copyright (c) 2016 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Christos Zoulas. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// Using the solaris constants, some of them are not applicable to us +// Do not re-order the list, or add elements in the middle as this will +// break the ABI of the system calls using this. We set a high private +// maximum so that new values can be added in the future without +// changing the width of the type. +type Idtype_t = int32 /* idtype.h:60:3 */ + +type Locale_t = uintptr /* time.h:188:25 */ + +type Timezone_t = uintptr /* time.h:198:24 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/time/time_windows_386.go b/vendor/modernc.org/libc/time/time_windows_386.go index 0e55feea..ff240b82 100644 --- a/vendor/modernc.org/libc/time/time_windows_386.go +++ b/vendor/modernc.org/libc/time/time_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_386.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_386.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/time/time_windows_amd64.go b/vendor/modernc.org/libc/time/time_windows_amd64.go index 0836f896..2dcca75b 100644 --- a/vendor/modernc.org/libc/time/time_windows_amd64.go +++ b/vendor/modernc.org/libc/time/time_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_amd64.go -pkgname time', DO NOT EDIT. +// Code generated by 'ccgo time/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o time/time_windows_amd64.go -pkgname time', DO NOT EDIT. package time diff --git a/vendor/modernc.org/libc/unistd/capi_darwin_amd64.go b/vendor/modernc.org/libc/unistd/capi_darwin_amd64.go index 52f94069..045c6a83 100644 --- a/vendor/modernc.org/libc/unistd/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/unistd/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_darwin_amd64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_darwin_amd64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_freebsd_amd64.go b/vendor/modernc.org/libc/unistd/capi_freebsd_amd64.go new file mode 100644 index 00000000..3b07321b --- /dev/null +++ b/vendor/modernc.org/libc/unistd/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_freebsd_amd64.go -pkgname unistd', DO NOT EDIT. + +package unistd + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/unistd/capi_linux_386.go b/vendor/modernc.org/libc/unistd/capi_linux_386.go index eac75ece..22a388b0 100644 --- a/vendor/modernc.org/libc/unistd/capi_linux_386.go +++ b/vendor/modernc.org/libc/unistd/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_386.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_386.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_linux_amd64.go b/vendor/modernc.org/libc/unistd/capi_linux_amd64.go index ddee2e9a..aaf139a9 100644 --- a/vendor/modernc.org/libc/unistd/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/unistd/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_amd64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_amd64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_linux_arm.go b/vendor/modernc.org/libc/unistd/capi_linux_arm.go index 1c02583e..fd575bdb 100644 --- a/vendor/modernc.org/libc/unistd/capi_linux_arm.go +++ b/vendor/modernc.org/libc/unistd/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_linux_arm64.go b/vendor/modernc.org/libc/unistd/capi_linux_arm64.go index 394ed4ce..5476869a 100644 --- a/vendor/modernc.org/libc/unistd/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/unistd/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_linux_s390x.go b/vendor/modernc.org/libc/unistd/capi_linux_s390x.go index 7e434f3a..fdb35cd6 100644 --- a/vendor/modernc.org/libc/unistd/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/unistd/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_s390x.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_s390x.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_netbsd_amd64.go b/vendor/modernc.org/libc/unistd/capi_netbsd_amd64.go new file mode 100644 index 00000000..783a630b --- /dev/null +++ b/vendor/modernc.org/libc/unistd/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_netbsd_amd64.go -pkgname unistd', DO NOT EDIT. + +package unistd + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/unistd/capi_windows_386.go b/vendor/modernc.org/libc/unistd/capi_windows_386.go index 3331ae9a..51753d90 100644 --- a/vendor/modernc.org/libc/unistd/capi_windows_386.go +++ b/vendor/modernc.org/libc/unistd/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_386.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_386.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/capi_windows_amd64.go b/vendor/modernc.org/libc/unistd/capi_windows_amd64.go index 2c49667f..373cc961 100644 --- a/vendor/modernc.org/libc/unistd/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/unistd/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_amd64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_amd64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_darwin_amd64.go b/vendor/modernc.org/libc/unistd/unistd_darwin_amd64.go index f7ec92fd..24f8b5af 100644 --- a/vendor/modernc.org/libc/unistd/unistd_darwin_amd64.go +++ b/vendor/modernc.org/libc/unistd/unistd_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_darwin_amd64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_darwin_amd64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_freebsd_amd64.go b/vendor/modernc.org/libc/unistd/unistd_freebsd_amd64.go new file mode 100644 index 00000000..40c39892 --- /dev/null +++ b/vendor/modernc.org/libc/unistd/unistd_freebsd_amd64.go @@ -0,0 +1,1810 @@ +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_freebsd_amd64.go -pkgname unistd', DO NOT EDIT. + +package unistd + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FD_SETSIZE = 1024 + F_LOCK = 1 + F_OK = 0 + F_TEST = 3 + F_TLOCK = 2 + F_ULOCK = 0 + LITTLE_ENDIAN = 1234 + L_INCR = 1 + L_SET = 0 + L_XTND = 2 + PDP_ENDIAN = 3412 + RFCENVG = 2048 + RFCFDG = 4096 + RFCNAMEG = 1024 + RFENVG = 2 + RFFDG = 4 + RFFLAGS = 2416930932 + RFHIGHPID = 262144 + RFKERNELONLY = 268828672 + RFLINUXTHPN = 65536 + RFMEM = 32 + RFNAMEG = 1 + RFNOTEG = 8 + RFNOWAIT = 64 + RFPPWAIT = 2147483648 + RFPROC = 16 + RFPROCDESC = 268435456 + RFSIGSHARE = 16384 + RFSPAWN = 2147483648 + RFSTOPPED = 131072 + RFTHREAD = 8192 + RFTSIGMASK = 0xFF + RFTSIGSHIFT = 20 + RFTSIGZMB = 524288 + R_OK = 0x04 + SEEK_CUR = 1 + SEEK_DATA = 3 + SEEK_END = 2 + SEEK_HOLE = 4 + SEEK_SET = 0 + STDERR_FILENO = 2 + STDIN_FILENO = 0 + STDOUT_FILENO = 1 + W_OK = 0x02 + X_OK = 0x01 + X_ACCMODE_T_DECLARED = 0 + X_BIG_ENDIAN = 4321 + X_BLKCNT_T_DECLARED = 0 + X_BLKSIZE_T_DECLARED = 0 + X_BYTE_ORDER = 1234 + X_CAP_IOCTL_T_DECLARED = 0 + X_CAP_RIGHTS_T_DECLARED = 0 + X_CLOCKID_T_DECLARED = 0 + X_CLOCK_T_DECLARED = 0 + X_CS_PATH = 1 + X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2 + X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3 + X_CS_POSIX_V6_ILP32_OFF32_LIBS = 4 + X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5 + X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6 + X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7 + X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 8 + X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9 + X_CS_POSIX_V6_LP64_OFF64_LIBS = 10 + X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11 + X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12 + X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13 + X_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14 + X_DEV_T_DECLARED = 0 + X_FFLAGS_T_DECLARED = 0 + X_FILE_OFFSET_BITS = 64 + X_FSBLKCNT_T_DECLARED = 0 + X_FTRUNCATE_DECLARED = 0 + X_GETOPT_DECLARED = 0 + X_GID_T_DECLARED = 0 + X_ID_T_DECLARED = 0 + X_INO_T_DECLARED = 0 + X_INT16_T_DECLARED = 0 + X_INT32_T_DECLARED = 0 + X_INT64_T_DECLARED = 0 + X_INT8_T_DECLARED = 0 + X_INTMAX_T_DECLARED = 0 + X_INTPTR_T_DECLARED = 0 + X_IN_ADDR_T_DECLARED = 0 + X_IN_PORT_T_DECLARED = 0 + X_KEY_T_DECLARED = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_LSEEK_DECLARED = 0 + X_LWPID_T_DECLARED = 0 + X_MACHINE_ENDIAN_H_ = 0 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MKDTEMP_DECLARED = 0 + X_MKNOD_DECLARED = 0 + X_MKSTEMP_DECLARED = 0 + X_MKTEMP_DECLARED = 0 + X_MMAP_DECLARED = 0 + X_MODE_T_DECLARED = 0 + X_MQD_T_DECLARED = 0 + X_NLINK_T_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF64_T_DECLARED = 0 + X_OFF_T_DECLARED = 0 + X_OPTRESET_DECLARED = 0 + X_PC_ACL_EXTENDED = 59 + X_PC_ACL_NFS4 = 64 + X_PC_ACL_PATH_MAX = 60 + X_PC_ALLOC_SIZE_MIN = 10 + X_PC_ASYNC_IO = 53 + X_PC_CAP_PRESENT = 61 + X_PC_CHOWN_RESTRICTED = 7 + X_PC_FILESIZEBITS = 12 + X_PC_INF_PRESENT = 62 + X_PC_LINK_MAX = 1 + X_PC_MAC_PRESENT = 63 + X_PC_MAX_CANON = 2 + X_PC_MAX_INPUT = 3 + X_PC_MIN_HOLE_SIZE = 21 + X_PC_NAME_MAX = 4 + X_PC_NO_TRUNC = 8 + X_PC_PATH_MAX = 5 + X_PC_PIPE_BUF = 6 + X_PC_PRIO_IO = 54 + X_PC_REC_INCR_XFER_SIZE = 14 + X_PC_REC_MAX_XFER_SIZE = 15 + X_PC_REC_MIN_XFER_SIZE = 16 + X_PC_REC_XFER_ALIGN = 17 + X_PC_SYMLINK_MAX = 18 + X_PC_SYNC_IO = 55 + X_PC_VDISABLE = 9 + X_PDP_ENDIAN = 3412 + X_PID_T_DECLARED = 0 + X_POSIX2_CHAR_TERM = 1 + X_POSIX2_C_BIND = 200112 + X_POSIX2_C_DEV = -1 + X_POSIX2_FORT_DEV = -1 + X_POSIX2_FORT_RUN = 200112 + X_POSIX2_LOCALEDEF = -1 + X_POSIX2_PBS = -1 + X_POSIX2_PBS_ACCOUNTING = -1 + X_POSIX2_PBS_CHECKPOINT = -1 + X_POSIX2_PBS_LOCATE = -1 + X_POSIX2_PBS_MESSAGE = -1 + X_POSIX2_PBS_TRACK = -1 + X_POSIX2_SW_DEV = -1 + X_POSIX2_UPE = 200112 + X_POSIX2_VERSION = 199212 + X_POSIX_ADVISORY_INFO = 200112 + X_POSIX_ASYNCHRONOUS_IO = 200112 + X_POSIX_BARRIERS = 200112 + X_POSIX_CHOWN_RESTRICTED = 1 + X_POSIX_CLOCK_SELECTION = -1 + X_POSIX_CPUTIME = 200112 + X_POSIX_FSYNC = 200112 + X_POSIX_IPV6 = 0 + X_POSIX_JOB_CONTROL = 1 + X_POSIX_MAPPED_FILES = 200112 + X_POSIX_MEMLOCK = -1 + X_POSIX_MEMLOCK_RANGE = 200112 + X_POSIX_MEMORY_PROTECTION = 200112 + X_POSIX_MESSAGE_PASSING = 200112 + X_POSIX_MONOTONIC_CLOCK = 200112 + X_POSIX_NO_TRUNC = 1 + X_POSIX_PRIORITIZED_IO = -1 + X_POSIX_PRIORITY_SCHEDULING = 0 + X_POSIX_RAW_SOCKETS = 200112 + X_POSIX_READER_WRITER_LOCKS = 200112 + X_POSIX_REALTIME_SIGNALS = 200112 + X_POSIX_REGEXP = 1 + X_POSIX_SEMAPHORES = 200112 + X_POSIX_SHARED_MEMORY_OBJECTS = 200112 + X_POSIX_SHELL = 1 + X_POSIX_SPAWN = 200112 + X_POSIX_SPIN_LOCKS = 200112 + X_POSIX_SPORADIC_SERVER = -1 + X_POSIX_SYNCHRONIZED_IO = -1 + X_POSIX_THREADS = 200112 + X_POSIX_THREAD_ATTR_STACKADDR = 200112 + X_POSIX_THREAD_ATTR_STACKSIZE = 200112 + X_POSIX_THREAD_CPUTIME = 200112 + X_POSIX_THREAD_PRIORITY_SCHEDULING = 200112 + X_POSIX_THREAD_PRIO_INHERIT = 200112 + X_POSIX_THREAD_PRIO_PROTECT = 200112 + X_POSIX_THREAD_PROCESS_SHARED = 200112 + X_POSIX_THREAD_SAFE_FUNCTIONS = -1 + X_POSIX_THREAD_SPORADIC_SERVER = -1 + X_POSIX_TIMEOUTS = 200112 + X_POSIX_TIMERS = 200112 + X_POSIX_TRACE = -1 + X_POSIX_TRACE_EVENT_FILTER = -1 + X_POSIX_TRACE_INHERIT = -1 + X_POSIX_TRACE_LOG = -1 + X_POSIX_TYPED_MEMORY_OBJECTS = -1 + X_POSIX_VDISABLE = 0xff + X_POSIX_VERSION = 200112 + X_PTHREAD_T_DECLARED = 0 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_RLIM_T_DECLARED = 0 + X_SC_2_CHAR_TERM = 20 + X_SC_2_C_BIND = 18 + X_SC_2_C_DEV = 19 + X_SC_2_FORT_DEV = 21 + X_SC_2_FORT_RUN = 22 + X_SC_2_LOCALEDEF = 23 + X_SC_2_PBS = 59 + X_SC_2_PBS_ACCOUNTING = 60 + X_SC_2_PBS_CHECKPOINT = 61 + X_SC_2_PBS_LOCATE = 62 + X_SC_2_PBS_MESSAGE = 63 + X_SC_2_PBS_TRACK = 64 + X_SC_2_SW_DEV = 24 + X_SC_2_UPE = 25 + X_SC_2_VERSION = 17 + X_SC_ADVISORY_INFO = 65 + X_SC_AIO_LISTIO_MAX = 42 + X_SC_AIO_MAX = 43 + X_SC_AIO_PRIO_DELTA_MAX = 44 + X_SC_ARG_MAX = 1 + X_SC_ASYNCHRONOUS_IO = 28 + X_SC_ATEXIT_MAX = 107 + X_SC_BARRIERS = 66 + X_SC_BC_BASE_MAX = 9 + X_SC_BC_DIM_MAX = 10 + X_SC_BC_SCALE_MAX = 11 + X_SC_BC_STRING_MAX = 12 + X_SC_CHILD_MAX = 2 + X_SC_CLK_TCK = 3 + X_SC_CLOCK_SELECTION = 67 + X_SC_COLL_WEIGHTS_MAX = 13 + X_SC_CPUSET_SIZE = 122 + X_SC_CPUTIME = 68 + X_SC_DELAYTIMER_MAX = 45 + X_SC_EXPR_NEST_MAX = 14 + X_SC_FILE_LOCKING = 69 + X_SC_FSYNC = 38 + X_SC_GETGR_R_SIZE_MAX = 70 + X_SC_GETPW_R_SIZE_MAX = 71 + X_SC_HOST_NAME_MAX = 72 + X_SC_IOV_MAX = 56 + X_SC_IPV6 = 118 + X_SC_JOB_CONTROL = 6 + X_SC_LINE_MAX = 15 + X_SC_LOGIN_NAME_MAX = 73 + X_SC_MAPPED_FILES = 29 + X_SC_MEMLOCK = 30 + X_SC_MEMLOCK_RANGE = 31 + X_SC_MEMORY_PROTECTION = 32 + X_SC_MESSAGE_PASSING = 33 + X_SC_MONOTONIC_CLOCK = 74 + X_SC_MQ_OPEN_MAX = 46 + X_SC_MQ_PRIO_MAX = 75 + X_SC_NGROUPS_MAX = 4 + X_SC_NPROCESSORS_CONF = 57 + X_SC_NPROCESSORS_ONLN = 58 + X_SC_OPEN_MAX = 5 + X_SC_PAGESIZE = 47 + X_SC_PAGE_SIZE = 47 + X_SC_PHYS_PAGES = 121 + X_SC_PRIORITIZED_IO = 34 + X_SC_PRIORITY_SCHEDULING = 35 + X_SC_RAW_SOCKETS = 119 + X_SC_READER_WRITER_LOCKS = 76 + X_SC_REALTIME_SIGNALS = 36 + X_SC_REGEXP = 77 + X_SC_RE_DUP_MAX = 16 + X_SC_RTSIG_MAX = 48 + X_SC_SAVED_IDS = 7 + X_SC_SEMAPHORES = 37 + X_SC_SEM_NSEMS_MAX = 49 + X_SC_SEM_VALUE_MAX = 50 + X_SC_SHARED_MEMORY_OBJECTS = 39 + X_SC_SHELL = 78 + X_SC_SIGQUEUE_MAX = 51 + X_SC_SPAWN = 79 + X_SC_SPIN_LOCKS = 80 + X_SC_SPORADIC_SERVER = 81 + X_SC_STREAM_MAX = 26 + X_SC_SYMLOOP_MAX = 120 + X_SC_SYNCHRONIZED_IO = 40 + X_SC_THREADS = 96 + X_SC_THREAD_ATTR_STACKADDR = 82 + X_SC_THREAD_ATTR_STACKSIZE = 83 + X_SC_THREAD_CPUTIME = 84 + X_SC_THREAD_DESTRUCTOR_ITERATIONS = 85 + X_SC_THREAD_KEYS_MAX = 86 + X_SC_THREAD_PRIORITY_SCHEDULING = 89 + X_SC_THREAD_PRIO_INHERIT = 87 + X_SC_THREAD_PRIO_PROTECT = 88 + X_SC_THREAD_PROCESS_SHARED = 90 + X_SC_THREAD_SAFE_FUNCTIONS = 91 + X_SC_THREAD_SPORADIC_SERVER = 92 + X_SC_THREAD_STACK_MIN = 93 + X_SC_THREAD_THREADS_MAX = 94 + X_SC_TIMEOUTS = 95 + X_SC_TIMERS = 41 + X_SC_TIMER_MAX = 52 + X_SC_TRACE = 97 + X_SC_TRACE_EVENT_FILTER = 98 + X_SC_TRACE_INHERIT = 99 + X_SC_TRACE_LOG = 100 + X_SC_TTY_NAME_MAX = 101 + X_SC_TYPED_MEMORY_OBJECTS = 102 + X_SC_TZNAME_MAX = 27 + X_SC_V6_ILP32_OFF32 = 103 + X_SC_V6_ILP32_OFFBIG = 104 + X_SC_V6_LP64_OFF64 = 105 + X_SC_V6_LPBIG_OFFBIG = 106 + X_SC_VERSION = 8 + X_SC_XOPEN_CRYPT = 108 + X_SC_XOPEN_ENH_I18N = 109 + X_SC_XOPEN_LEGACY = 110 + X_SC_XOPEN_REALTIME = 111 + X_SC_XOPEN_REALTIME_THREADS = 112 + X_SC_XOPEN_SHM = 113 + X_SC_XOPEN_STREAMS = 114 + X_SC_XOPEN_UNIX = 115 + X_SC_XOPEN_VERSION = 116 + X_SC_XOPEN_XCU_VERSION = 117 + X_SELECT_DECLARED = 0 + X_SIGSET_T_DECLARED = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SIZE_T_DECLARED = 0 + X_SSIZE_T_DECLARED = 0 + X_SUSECONDS_T_DECLARED = 0 + X_SWAB_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS_UNISTD_H_ = 0 + X_SYS__PTHREADTYPES_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__STDINT_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TIMEVAL_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIMER_T_DECLARED = 0 + X_TIME_T_DECLARED = 0 + X_TRUNCATE_DECLARED = 0 + X_UID_T_DECLARED = 0 + X_UINT16_T_DECLARED = 0 + X_UINT32_T_DECLARED = 0 + X_UINT64_T_DECLARED = 0 + X_UINT8_T_DECLARED = 0 + X_UINTMAX_T_DECLARED = 0 + X_UINTPTR_T_DECLARED = 0 + X_UNISTD_H_ = 0 + X_USECONDS_T_DECLARED = 0 + X_V6_ILP32_OFF32 = -1 + X_V6_ILP32_OFFBIG = 0 + X_V6_LP64_OFF64 = 0 + X_V6_LPBIG_OFFBIG = -1 + X_XOPEN_CRYPT = -1 + X_XOPEN_ENH_I18N = -1 + X_XOPEN_LEGACY = -1 + X_XOPEN_REALTIME = -1 + X_XOPEN_REALTIME_THREADS = -1 + X_XOPEN_SHM = 1 + X_XOPEN_STREAMS = -1 + X_XOPEN_UNIX = -1 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)unistd.h 8.12 (Berkeley) 4/27/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.6 (Berkeley) 2/19/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Machine type dependent parameters. +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1987, 1991 Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 7.8 (Berkeley) 4/3/91 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ +type Pthread_once = struct { + Fstate int32 + _ [4]byte + Fmutex Pthread_mutex_t +} /* _pthreadtypes.h:52:1 */ + +// Primitive system data type definitions required by P1003.1c. +// +// Note that P1003.1c specifies that there are no defined comparison +// or assignment operators for the types pthread_attr_t, pthread_cond_t, +// pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. +type Pthread_t = uintptr /* _pthreadtypes.h:67:26 */ +type Pthread_attr_t = uintptr /* _pthreadtypes.h:70:30 */ +type Pthread_mutex_t = uintptr /* _pthreadtypes.h:71:31 */ +type Pthread_mutexattr_t = uintptr /* _pthreadtypes.h:72:35 */ +type Pthread_cond_t = uintptr /* _pthreadtypes.h:73:30 */ +type Pthread_condattr_t = uintptr /* _pthreadtypes.h:74:34 */ +type Pthread_key_t = int32 /* _pthreadtypes.h:75:20 */ +type Pthread_once_t = Pthread_once /* _pthreadtypes.h:76:30 */ +type Pthread_rwlock_t = uintptr /* _pthreadtypes.h:77:32 */ +type Pthread_rwlockattr_t = uintptr /* _pthreadtypes.h:78:35 */ +type Pthread_barrier_t = uintptr /* _pthreadtypes.h:79:33 */ +type Pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */ +type Pthread_spinlock_t = uintptr /* _pthreadtypes.h:81:33 */ + +// Additional type definitions: +// +// Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for +// use in header symbols. +type Pthread_addr_t = uintptr /* _pthreadtypes.h:89:14 */ +type Pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */ + +type U_char = uint8 /* types.h:52:23 */ +type U_short = uint16 /* types.h:53:24 */ +type U_int = uint32 /* types.h:54:22 */ +type U_long = uint64 /* types.h:55:23 */ +type Ushort = uint16 /* types.h:57:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:58:22 */ // Sys V compatibility + +// XXX POSIX sized integrals that should appear only in . +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011 David E. O'Brien +// Copyright (c) 2001 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Int8_t = X__int8_t /* _stdint.h:36:19 */ + +type Int16_t = X__int16_t /* _stdint.h:41:20 */ + +type Int32_t = X__int32_t /* _stdint.h:46:20 */ + +type Int64_t = X__int64_t /* _stdint.h:51:20 */ + +type Uint8_t = X__uint8_t /* _stdint.h:56:20 */ + +type Uint16_t = X__uint16_t /* _stdint.h:61:21 */ + +type Uint32_t = X__uint32_t /* _stdint.h:66:21 */ + +type Uint64_t = X__uint64_t /* _stdint.h:71:21 */ + +type Intptr_t = X__intptr_t /* _stdint.h:76:21 */ +type Uintptr_t = X__uintptr_t /* _stdint.h:80:22 */ +type Intmax_t = X__intmax_t /* _stdint.h:84:21 */ +type Uintmax_t = X__uintmax_t /* _stdint.h:88:22 */ + +type U_int8_t = X__uint8_t /* types.h:67:19 */ // unsigned integrals (deprecated) +type U_int16_t = X__uint16_t /* types.h:68:20 */ +type U_int32_t = X__uint32_t /* types.h:69:20 */ +type U_int64_t = X__uint64_t /* types.h:70:20 */ + +type U_quad_t = X__uint64_t /* types.h:72:20 */ // quads (deprecated) +type Quad_t = X__int64_t /* types.h:73:19 */ +type Qaddr_t = uintptr /* types.h:74:16 */ + +type Caddr_t = uintptr /* types.h:76:14 */ // core address +type C_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const + +type Blksize_t = X__blksize_t /* types.h:80:21 */ + +type Cpuwhich_t = X__cpuwhich_t /* types.h:84:22 */ +type Cpulevel_t = X__cpulevel_t /* types.h:85:22 */ +type Cpusetid_t = X__cpusetid_t /* types.h:86:22 */ + +type Blkcnt_t = X__blkcnt_t /* types.h:89:20 */ + +type Clock_t = X__clock_t /* types.h:94:19 */ + +type Clockid_t = X__clockid_t /* types.h:99:21 */ + +type Critical_t = X__critical_t /* types.h:103:22 */ // Critical section value +type Daddr_t = X__daddr_t /* types.h:104:19 */ // disk address + +type Dev_t = X__dev_t /* types.h:107:18 */ // device number or struct cdev + +type Fflags_t = X__fflags_t /* types.h:112:20 */ // file flags + +type Fixpt_t = X__fixpt_t /* types.h:116:19 */ // fixed point number + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:119:22 */ +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:120:22 */ + +type Gid_t = X__gid_t /* types.h:125:18 */ // group id + +type In_addr_t = X__uint32_t /* types.h:130:20 */ // base type for internet address + +type In_port_t = X__uint16_t /* types.h:135:20 */ + +type Id_t = X__id_t /* types.h:140:17 */ // can hold a uid_t or pid_t + +type Ino_t = X__ino_t /* types.h:145:18 */ // inode number + +type Key_t = X__key_t /* types.h:150:18 */ // IPC key (for Sys V IPC) + +type Lwpid_t = X__lwpid_t /* types.h:155:19 */ // Thread ID (a.k.a. LWP) + +type Mode_t = X__mode_t /* types.h:160:18 */ // permissions + +type Accmode_t = X__accmode_t /* types.h:165:21 */ // access permissions + +type Nlink_t = X__nlink_t /* types.h:170:19 */ // link count + +type Off_t = X__off_t /* types.h:175:18 */ // file offset + +type Off64_t = X__off64_t /* types.h:180:19 */ // file offset (alias) + +type Pid_t = X__pid_t /* types.h:185:18 */ // process id + +type Register_t = X__register_t /* types.h:189:22 */ + +type Rlim_t = X__rlim_t /* types.h:192:18 */ // resource limit + +type Sbintime_t = X__int64_t /* types.h:196:19 */ + +type Segsz_t = X__segsz_t /* types.h:198:19 */ + +type Ssize_t = X__ssize_t /* types.h:206:19 */ + +type Suseconds_t = X__suseconds_t /* types.h:211:23 */ // microseconds (signed) + +type Time_t = X__time_t /* types.h:216:18 */ + +type Timer_t = X__timer_t /* types.h:221:19 */ + +type Mqd_t = X__mqd_t /* types.h:226:17 */ + +type U_register_t = X__u_register_t /* types.h:230:24 */ + +type Uid_t = X__uid_t /* types.h:233:18 */ // user id + +type Useconds_t = X__useconds_t /* types.h:238:22 */ // microseconds (unsigned) + +type Cap_ioctl_t = uint64 /* types.h:244:23 */ + +// Types suitable for exporting physical addresses, virtual addresses +// (pointers), and memory object sizes from the kernel independent of native +// word size. These should be used in place of vm_paddr_t, (u)intptr_t, and +// size_t in structs which contain such types that are shared with userspace. +type Kpaddr_t = X__uint64_t /* types.h:260:20 */ +type Kvaddr_t = X__uint64_t /* types.h:261:20 */ +type Ksize_t = X__uint64_t /* types.h:262:20 */ +type Kssize_t = X__int64_t /* types.h:263:19 */ + +type Vm_offset_t = X__vm_offset_t /* types.h:265:23 */ +type Vm_ooffset_t = X__uint64_t /* types.h:266:20 */ +type Vm_paddr_t = X__vm_paddr_t /* types.h:267:22 */ +type Vm_pindex_t = X__uint64_t /* types.h:268:20 */ +type Vm_size_t = X__vm_size_t /* types.h:269:21 */ + +type Rman_res_t = X__rman_res_t /* types.h:271:25 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = X__sigset /* _sigset.h:55:3 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Structure returned by gettimeofday(2) system call, and used in other calls. +type Timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t +} /* _timeval.h:49:1 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type Itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +type X__fd_mask = uint64 /* select.h:44:23 */ +type Fd_mask = X__fd_mask /* select.h:46:19 */ + +type Sigset_t = X__sigset_t /* select.h:51:20 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set1 = struct{ F__fds_bits [16]X__fd_mask } /* select.h:73:9 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set = Fd_set1 /* select.h:75:3 */ // select(2) + +type Crypt_data = struct { + Finitialized int32 + F__buf [256]int8 +} /* unistd.h:489:1 */ + +// getopt(3) external variable + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/unistd/unistd_linux_386.go b/vendor/modernc.org/libc/unistd/unistd_linux_386.go index 23bcb999..9c7083bc 100644 --- a/vendor/modernc.org/libc/unistd/unistd_linux_386.go +++ b/vendor/modernc.org/libc/unistd/unistd_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_386.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_386.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_linux_amd64.go b/vendor/modernc.org/libc/unistd/unistd_linux_amd64.go index c67f7d55..0bb64c24 100644 --- a/vendor/modernc.org/libc/unistd/unistd_linux_amd64.go +++ b/vendor/modernc.org/libc/unistd/unistd_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_amd64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_amd64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_linux_arm.go b/vendor/modernc.org/libc/unistd/unistd_linux_arm.go index b455ea9d..18946f0b 100644 --- a/vendor/modernc.org/libc/unistd/unistd_linux_arm.go +++ b/vendor/modernc.org/libc/unistd/unistd_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_linux_arm64.go b/vendor/modernc.org/libc/unistd/unistd_linux_arm64.go index e054170f..69665b3b 100644 --- a/vendor/modernc.org/libc/unistd/unistd_linux_arm64.go +++ b/vendor/modernc.org/libc/unistd/unistd_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_arm64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_linux_s390x.go b/vendor/modernc.org/libc/unistd/unistd_linux_s390x.go index d01bb1a1..e601e723 100644 --- a/vendor/modernc.org/libc/unistd/unistd_linux_s390x.go +++ b/vendor/modernc.org/libc/unistd/unistd_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_s390x.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_linux_s390x.go -pkgname unistd', DO NOT EDIT. package unistd @@ -34,6 +34,7 @@ const ( X_OK = 1 X_ATFILE_SOURCE = 1 X_BITS_POSIX_OPT_H = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_BSD_SIZE_T_ = 0 @@ -149,7 +150,7 @@ const ( // the `_SC_*' symbols for the NAME argument to `sysconf'; // and the `_CS_*' symbols for the NAME argument to `confstr'. // `sysconf', `pathconf', and `confstr' NAME values. Generic version. -// Copyright (C) 1993-2018 Free Software Foundation, Inc. +// Copyright (C) 1993-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -164,7 +165,7 @@ const ( // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Values for the NAME argument to `pathconf' and `fpathconf'. const ( /* confname.h:24:1: */ @@ -531,7 +532,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -546,11 +547,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 2.10 Symbolic Constants -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -565,7 +566,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -573,6 +574,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -693,6 +695,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -715,9 +719,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -732,7 +749,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -745,7 +762,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -760,7 +777,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -875,7 +892,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -892,14 +909,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -914,7 +929,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -1074,7 +1089,7 @@ type X__float128 = float64 /* :47:21 */ // // Define POSIX options for Linux. -// Copyright (C) 1996-2018 Free Software Foundation, Inc. +// Copyright (C) 1996-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1089,13 +1104,16 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; see the file COPYING.LIB. If -// not, see . +// not, see . // Job control is supported. // Processes have a saved set-user-ID and a saved set-group-ID. -// Priority scheduling is supported. +// Priority scheduling is not supported with the correct semantics, +// but GNU/Linux applications expect that the corresponding interfaces +// are available, even though the semantics do not meet the POSIX +// requirements. See glibc bug 14829. // Synchronizing file data is supported. @@ -1198,7 +1216,7 @@ type X__float128 = float64 /* :47:21 */ // Typed memory objects are not available. // Get the environment definitions from Unix98. -// Copyright (C) 1999-2018 Free Software Foundation, Inc. +// Copyright (C) 1999-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1213,7 +1231,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. @@ -1254,7 +1272,7 @@ type X__float128 = float64 /* :47:21 */ // All functions that are not declared anywhere else. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1269,11 +1287,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1288,43 +1306,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -1336,7 +1376,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -1357,7 +1397,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -1372,7 +1412,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -1387,78 +1427,106 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. // Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ +type X__clockid_t = int32 /* types.h:168:29 */ // Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ +type X__timer_t = uintptr /* types.h:171:12 */ // Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ +type X__blksize_t = int64 /* types.h:174:29 */ // Types from the Large File Support interface. // Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ // Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ // Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ // Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ +type X__fsword_t = int64 /* types.h:191:28 */ -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. // Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ +type X__syscall_slong_t = int64 /* types.h:196:33 */ // Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ // These few don't really vary by system, they always correspond // to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ // Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ +type X__intptr_t = int64 /* types.h:206:25 */ // Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ +type X__socklen_t = uint32 /* types.h:209:23 */ // C99: An integer type that can be accessed as an atomic entity, // even in the presence of asynchronous interrupts. // It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. type Ssize_t = X__ssize_t /* unistd.h:220:19 */ @@ -1495,4 +1563,23 @@ type Socklen_t = X__socklen_t /* unistd.h:274:21 */ // Define some macros helping to catch buffer overflows. -var _ int8 /* gen.c:2:13: */ +// System-specific extensions. +// System-specific extensions of , Linux version. +// Copyright (C) 2019-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/unistd/unistd_netbsd_amd64.go b/vendor/modernc.org/libc/unistd/unistd_netbsd_amd64.go new file mode 100644 index 00000000..ad589914 --- /dev/null +++ b/vendor/modernc.org/libc/unistd/unistd_netbsd_amd64.go @@ -0,0 +1,1824 @@ +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_netbsd_amd64.go -pkgname unistd', DO NOT EDIT. + +package unistd + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + BIG_ENDIAN = 4321 + BYTE_ORDER = 1234 + FDATASYNC = 0x0010 + FDISKSYNC = 0x0040 + FD_SETSIZE = 256 + FFILESYNC = 0x0020 + F_LOCK = 1 + F_OK = 0 + F_TEST = 3 + F_TLOCK = 2 + F_ULOCK = 0 + GETPASS_7BIT = 0x080 + GETPASS_BUF_LIMIT = 0x004 + GETPASS_ECHO = 0x020 + GETPASS_ECHO_NL = 0x400 + GETPASS_ECHO_STAR = 0x040 + GETPASS_FAIL_EOF = 0x002 + GETPASS_FORCE_LOWER = 0x100 + GETPASS_FORCE_UPPER = 0x200 + GETPASS_NEED_TTY = 0x001 + GETPASS_NO_BEEP = 0x010 + GETPASS_NO_SIGNAL = 0x008 + INT16_MAX = 32767 + INT16_MIN = -32768 + INT32_MAX = 2147483647 + INT32_MIN = -2147483648 + INT64_MAX = 9223372036854775807 + INT64_MIN = -9223372036854775808 + INT8_MAX = 127 + INT8_MIN = -128 + INTMAX_MAX = 9223372036854775807 + INTMAX_MIN = -9223372036854775808 + INTPTR_MAX = 9223372036854775807 + INTPTR_MIN = -9223372036854775808 + INT_FAST16_MAX = 2147483647 + INT_FAST16_MIN = -2147483648 + INT_FAST32_MAX = 2147483647 + INT_FAST32_MIN = -2147483648 + INT_FAST64_MAX = 9223372036854775807 + INT_FAST64_MIN = -9223372036854775808 + INT_FAST8_MAX = 2147483647 + INT_FAST8_MIN = -2147483648 + INT_LEAST16_MAX = 32767 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MAX = 2147483647 + INT_LEAST32_MIN = -2147483648 + INT_LEAST64_MAX = 9223372036854775807 + INT_LEAST64_MIN = -9223372036854775808 + INT_LEAST8_MAX = 127 + INT_LEAST8_MIN = -128 + LITTLE_ENDIAN = 1234 + L_INCR = 1 + L_SET = 0 + L_XTND = 2 + NBBY = 8 + NFDBITS = 32 + NODEVMAJOR = -1 + PDP_ENDIAN = 3412 + PTRDIFF_MAX = 9223372036854775807 + PTRDIFF_MIN = -9223372036854775808 + R_OK = 0x04 + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + SIG_ATOMIC_MAX = 2147483647 + SIG_ATOMIC_MIN = -2147483648 + SIZE_MAX = 18446744073709551615 + STDERR_FILENO = 2 + STDIN_FILENO = 0 + STDOUT_FILENO = 1 + UINT16_MAX = 65535 + UINT32_MAX = 4294967295 + UINT64_MAX = 18446744073709551615 + UINT8_MAX = 255 + UINTMAX_MAX = 18446744073709551615 + UINTPTR_MAX = 18446744073709551615 + UINT_FAST16_MAX = 4294967295 + UINT_FAST32_MAX = 4294967295 + UINT_FAST64_MAX = 18446744073709551615 + UINT_FAST8_MAX = 4294967295 + UINT_LEAST16_MAX = 65535 + UINT_LEAST32_MAX = 4294967295 + UINT_LEAST64_MAX = 18446744073709551615 + UINT_LEAST8_MAX = 255 + WCHAR_MAX = 0x7fffffff + WCHAR_MIN = -2147483648 + WINT_MAX = 0x7fffffff + WINT_MIN = -2147483648 + W_OK = 0x02 + X_OK = 0x01 + X_AMD64_BYTE_SWAP_H_ = 0 + X_AMD64_INT_CONST_H_ = 0 + X_AMD64_INT_LIMITS_H_ = 0 + X_AMD64_INT_MWGWTYPES_H_ = 0 + X_AMD64_INT_TYPES_H_ = 0 + X_AMD64_WCHAR_LIMITS_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BSD_INT16_T_ = 0 + X_BSD_INT32_T_ = 0 + X_BSD_INT64_T_ = 0 + X_BSD_INT8_T_ = 0 + X_BSD_INTPTR_T_ = 0 + X_BSD_UINT16_T_ = 0 + X_BSD_UINT32_T_ = 0 + X_BSD_UINT64_T_ = 0 + X_BSD_UINT8_T_ = 0 + X_BSD_UINTPTR_T_ = 0 + X_BYTE_ORDER = 1234 + X_CS_PATH = 1 + X_FILE_OFFSET_BITS = 64 + X_GCC_PTRDIFF_T = 0 + X_GCC_SIZE_T = 0 + X_LIB_PTHREAD_TYPES_H = 0 + X_LITTLE_ENDIAN = 1234 + X_LP64 = 1 + X_NETBSD_SOURCE = 1 + X_O_SC_CLK_TCK = 3 + X_PC_2_SYMLINKS = 13 + X_PC_ACL_EXTENDED = 14 + X_PC_CHOWN_RESTRICTED = 7 + X_PC_FILESIZEBITS = 11 + X_PC_LINK_MAX = 1 + X_PC_MAX_CANON = 2 + X_PC_MAX_INPUT = 3 + X_PC_MIN_HOLE_SIZE = 15 + X_PC_NAME_MAX = 4 + X_PC_NO_TRUNC = 8 + X_PC_PATH_MAX = 5 + X_PC_PIPE_BUF = 6 + X_PC_SYMLINK_MAX = 12 + X_PC_SYNC_IO = 10 + X_PC_VDISABLE = 9 + X_PDP_ENDIAN = 3412 + X_POSIX2_C_BIND = 200112 + X_POSIX2_VERSION = 200112 + X_POSIX_ASYNCHRONOUS_IO = 200112 + X_POSIX_BARRIERS = 200112 + X_POSIX_CHOWN_RESTRICTED = 1 + X_POSIX_CLOCK_SELECTION = -1 + X_POSIX_CPUTIME = 200112 + X_POSIX_FSYNC = 1 + X_POSIX_IPV6 = 0 + X_POSIX_JOB_CONTROL = 1 + X_POSIX_MAPPED_FILES = 1 + X_POSIX_MEMLOCK = 1 + X_POSIX_MEMLOCK_RANGE = 1 + X_POSIX_MEMORY_PROTECTION = 1 + X_POSIX_MESSAGE_PASSING = 200112 + X_POSIX_MONOTONIC_CLOCK = 200112 + X_POSIX_NO_TRUNC = 1 + X_POSIX_PRIORITIZED_IO = -1 + X_POSIX_PRIORITY_SCHEDULING = 200112 + X_POSIX_RAW_SOCKETS = 200112 + X_POSIX_READER_WRITER_LOCKS = 200112 + X_POSIX_REGEXP = 1 + X_POSIX_SEMAPHORES = 0 + X_POSIX_SHARED_MEMORY_OBJECTS = 0 + X_POSIX_SHELL = 1 + X_POSIX_SPAWN = 200809 + X_POSIX_SPIN_LOCKS = 200112 + X_POSIX_SYNCHRONIZED_IO = 1 + X_POSIX_THREADS = 200112 + X_POSIX_THREAD_ATTR_STACKADDR = 200112 + X_POSIX_THREAD_ATTR_STACKSIZE = 200112 + X_POSIX_THREAD_CPUTIME = 200112 + X_POSIX_THREAD_PRIO_PROTECT = 200112 + X_POSIX_THREAD_SAFE_FUNCTIONS = 200112 + X_POSIX_TIMERS = 200112 + X_POSIX_VERSION = 200112 + X_PT_BARRIERATTR_DEAD = 0xDEAD0808 + X_PT_BARRIERATTR_MAGIC = 0x88880808 + X_PT_BARRIER_DEAD = 0xDEAD0008 + X_PT_BARRIER_MAGIC = 0x88880008 + X_PT_CONDATTR_DEAD = 0xDEAD0006 + X_PT_CONDATTR_MAGIC = 0x66660006 + X_PT_COND_DEAD = 0xDEAD0005 + X_PT_COND_MAGIC = 0x55550005 + X_PT_MUTEXATTR_DEAD = 0xDEAD0004 + X_PT_MUTEXATTR_MAGIC = 0x44440004 + X_PT_MUTEX_DEAD = 0xDEAD0003 + X_PT_MUTEX_MAGIC = 0x33330003 + X_PT_RWLOCKATTR_DEAD = 0xDEAD0909 + X_PT_RWLOCKATTR_MAGIC = 0x99990909 + X_PT_RWLOCK_DEAD = 0xDEAD0009 + X_PT_RWLOCK_MAGIC = 0x99990009 + X_PT_SPINLOCK_DEAD = 0xDEAD0007 + X_PT_SPINLOCK_MAGIC = 0x77770007 + X_PT_SPINLOCK_PSHARED = 0x00000001 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_SC_2_CHAR_TERM = 20 + X_SC_2_C_BIND = 18 + X_SC_2_C_DEV = 19 + X_SC_2_FORT_DEV = 21 + X_SC_2_FORT_RUN = 22 + X_SC_2_LOCALEDEF = 23 + X_SC_2_PBS = 80 + X_SC_2_PBS_ACCOUNTING = 81 + X_SC_2_PBS_CHECKPOINT = 82 + X_SC_2_PBS_LOCATE = 83 + X_SC_2_PBS_MESSAGE = 84 + X_SC_2_PBS_TRACK = 85 + X_SC_2_SW_DEV = 24 + X_SC_2_UPE = 25 + X_SC_2_VERSION = 17 + X_SC_AIO_LISTIO_MAX = 51 + X_SC_AIO_MAX = 52 + X_SC_ARG_MAX = 1 + X_SC_ASYNCHRONOUS_IO = 50 + X_SC_ATEXIT_MAX = 40 + X_SC_BARRIERS = 43 + X_SC_BC_BASE_MAX = 9 + X_SC_BC_DIM_MAX = 10 + X_SC_BC_SCALE_MAX = 11 + X_SC_BC_STRING_MAX = 12 + X_SC_CHILD_MAX = 2 + X_SC_CLK_TCK = 39 + X_SC_CLOCK_SELECTION = 49 + X_SC_COLL_WEIGHTS_MAX = 13 + X_SC_CPUTIME = 90 + X_SC_DELAYTIMER_MAX = 92 + X_SC_EXPR_NEST_MAX = 14 + X_SC_FSYNC = 29 + X_SC_GETGR_R_SIZE_MAX = 47 + X_SC_GETPW_R_SIZE_MAX = 48 + X_SC_HOST_NAME_MAX = 69 + X_SC_IOV_MAX = 32 + X_SC_JOB_CONTROL = 6 + X_SC_LINE_MAX = 15 + X_SC_LOGIN_NAME_MAX = 37 + X_SC_MAPPED_FILES = 33 + X_SC_MEMLOCK = 34 + X_SC_MEMLOCK_RANGE = 35 + X_SC_MEMORY_PROTECTION = 36 + X_SC_MESSAGE_PASSING = 53 + X_SC_MONOTONIC_CLOCK = 38 + X_SC_MQ_OPEN_MAX = 54 + X_SC_MQ_PRIO_MAX = 55 + X_SC_NGROUPS_MAX = 4 + X_SC_NPROCESSORS_CONF = 1001 + X_SC_NPROCESSORS_ONLN = 1002 + X_SC_OPEN_MAX = 5 + X_SC_PAGESIZE = 28 + X_SC_PAGE_SIZE = 28 + X_SC_PASS_MAX = 70 + X_SC_PHYS_PAGES = 121 + X_SC_PRIORITY_SCHEDULING = 56 + X_SC_READER_WRITER_LOCKS = 46 + X_SC_REALTIME_SIGNALS = 94 + X_SC_REGEXP = 71 + X_SC_RE_DUP_MAX = 16 + X_SC_SAVED_IDS = 7 + X_SC_SCHED_PRI_MAX = 2003 + X_SC_SCHED_PRI_MIN = 2002 + X_SC_SCHED_RT_TS = 2001 + X_SC_SEMAPHORES = 42 + X_SC_SEM_NSEMS_MAX = 89 + X_SC_SHARED_MEMORY_OBJECTS = 87 + X_SC_SHELL = 72 + X_SC_SIGQUEUE_MAX = 93 + X_SC_SPAWN = 86 + X_SC_SPIN_LOCKS = 45 + X_SC_STREAM_MAX = 26 + X_SC_SYMLOOP_MAX = 73 + X_SC_SYNCHRONIZED_IO = 31 + X_SC_THREADS = 41 + X_SC_THREAD_ATTR_STACKADDR = 61 + X_SC_THREAD_ATTR_STACKSIZE = 62 + X_SC_THREAD_CPUTIME = 91 + X_SC_THREAD_DESTRUCTOR_ITERATIONS = 57 + X_SC_THREAD_KEYS_MAX = 58 + X_SC_THREAD_PRIORITY_SCHEDULING = 63 + X_SC_THREAD_PRIO_INHERIT = 64 + X_SC_THREAD_PRIO_PROTECT = 65 + X_SC_THREAD_PROCESS_SHARED = 66 + X_SC_THREAD_SAFE_FUNCTIONS = 67 + X_SC_THREAD_STACK_MIN = 59 + X_SC_THREAD_THREADS_MAX = 60 + X_SC_TIMERS = 44 + X_SC_TIMER_MAX = 88 + X_SC_TTY_NAME_MAX = 68 + X_SC_TZNAME_MAX = 27 + X_SC_V6_ILP32_OFF32 = 74 + X_SC_V6_ILP32_OFFBIG = 75 + X_SC_V6_LP64_OFF64 = 76 + X_SC_V6_LPBIG_OFFBIG = 77 + X_SC_VERSION = 8 + X_SC_XOPEN_SHM = 30 + X_SIZE_T = 0 + X_SYS_ANSI_H_ = 0 + X_SYS_BSWAP_H_ = 0 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_LIMITS_H_ = 0 + X_SYS_COMMON_INT_MWGWTYPES_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_SYS_ENDIAN_H_ = 0 + X_SYS_FD_SET_H_ = 0 + X_SYS_NULL_H_ = 0 + X_SYS_STDINT_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS_UNISTD_H_ = 0 + X_UNISTD_H_ = 0 + X_X86_64_BSWAP_H_ = 0 + X_X86_64_CDEFS_H_ = 0 + X_X86_64_TYPES_H_ = 0 + X_XOPEN_SHM = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Machine type dependent parameters. +// $NetBSD: types.h,v 1.60 2019/04/06 03:06:24 thorpej Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type X__register_t = int64 /* types.h:68:19 */ +type X__cpu_simple_lock_nv_t = uint8 /* types.h:69:24 */ + +// __cpu_simple_lock_t used to be a full word. + +// The amd64 does not have strict alignment requirements. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ + +// $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Matt Thomas of 3am Software Foundry. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +type X__caddr_t = uintptr /* ansi.h:37:14 */ // core address +type X__gid_t = X__uint32_t /* ansi.h:38:20 */ // group id +type X__in_addr_t = X__uint32_t /* ansi.h:39:20 */ // IP(v4) address +type X__in_port_t = X__uint16_t /* ansi.h:40:20 */ // "Internet" port number +type X__mode_t = X__uint32_t /* ansi.h:41:20 */ // file permissions +type X__off_t = X__int64_t /* ansi.h:42:19 */ // file offset +type X__pid_t = X__int32_t /* ansi.h:43:19 */ // process id +type X__sa_family_t = X__uint8_t /* ansi.h:44:19 */ // socket address family +type X__socklen_t = uint32 /* ansi.h:45:22 */ // socket-related datum length +type X__uid_t = X__uint32_t /* ansi.h:46:20 */ // user id +type X__fsblkcnt_t = X__uint64_t /* ansi.h:47:20 */ // fs block count (statvfs) +type X__fsfilcnt_t = X__uint64_t /* ansi.h:48:20 */ +type X__wctrans_t = uintptr /* ansi.h:51:32 */ +type X__wctype_t = uintptr /* ansi.h:54:31 */ + +// mbstate_t is an opaque object to keep conversion state, during multibyte +// stream conversions. The content must not be referenced by user programs. +type X__mbstate_t = struct { + F__mbstateL X__int64_t + _ [120]byte +} /* ansi.h:63:3 */ + +type X__va_list = X__builtin_va_list /* ansi.h:72:27 */ + +type Int8_t = X__int8_t /* types.h:63:18 */ + +type Uint8_t = X__uint8_t /* types.h:68:19 */ + +type Int16_t = X__int16_t /* types.h:73:19 */ + +type Uint16_t = X__uint16_t /* types.h:78:20 */ + +type Int32_t = X__int32_t /* types.h:83:19 */ + +type Uint32_t = X__uint32_t /* types.h:88:20 */ + +type Int64_t = X__int64_t /* types.h:93:19 */ + +type Uint64_t = X__uint64_t /* types.h:98:20 */ + +type U_int8_t = Uint8_t /* types.h:102:18 */ +type U_int16_t = Uint16_t /* types.h:103:18 */ +type U_int32_t = Uint32_t /* types.h:104:18 */ +type U_int64_t = Uint64_t /* types.h:105:18 */ + +// $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ + +// $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ + +// Copyright (c) 1987, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)endian.h 8.1 (Berkeley) 6/11/93 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// Definitions for byte order, according to byte significance from low +// address to high. + +// C-family endian-ness definitions + +// $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ + +// - +// Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Jun-ichiro itojun Hagino and by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// DO NOT EDIT THIS FILE. +// +// It has been auto-edited by fixincludes from: +// +// "/usr/include/sys/types.h" +// +// This had to be done to correct non-standard usages in the +// original, manufacturer supplied header file. + +// $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.4 (Berkeley) 1/21/94 + +type In_addr_t = X__in_addr_t /* endian.h:58:21 */ + +type In_port_t = X__in_port_t /* endian.h:63:21 */ + +// $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ + +// Written by Manuel Bouyer. Public domain + +// $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ + +// - +// Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +type Intptr_t = X__intptr_t /* stdint.h:79:20 */ + +type Uintptr_t = X__uintptr_t /* stdint.h:84:21 */ + +// $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2001 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Klaus Klein. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.2 Minimum-width integer types + +type Int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ +type Uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ +type Int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ +type Uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ +type Int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ +type Uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ +type Int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ +type Uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ + +// 7.18.1.3 Fastest minimum-width integer types +type Int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ +type Uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ +type Int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ +type Uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ +type Int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ +type Uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ +type Int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ +type Uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ + +// 7.18.1.5 Greatest-width integer types + +type Intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ +type Uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ + +type U_char = uint8 /* types.h:110:23 */ +type U_short = uint16 /* types.h:111:24 */ +type U_int = uint32 /* types.h:112:22 */ +type U_long = uint64 /* types.h:113:23 */ + +type Unchar = uint8 /* types.h:115:23 */ // Sys V compatibility +type Ushort = uint16 /* types.h:116:24 */ // Sys V compatibility +type Uint = uint32 /* types.h:117:22 */ // Sys V compatibility +type Ulong = uint64 /* types.h:118:23 */ // Sys V compatibility + +type U_quad_t = Uint64_t /* types.h:121:18 */ // quads +type Quad_t = Int64_t /* types.h:122:18 */ +type Qaddr_t = uintptr /* types.h:123:16 */ + +// The types longlong_t and u_longlong_t exist for use with the +// Sun-derived XDR routines involving these types, and their usage +// in other contexts is discouraged. Further note that these types +// may not be equivalent to "long long" and "unsigned long long", +// they are only guaranteed to be signed and unsigned 64-bit types +// respectively. Portable programs that need 64-bit types should use +// the C99 types int64_t and uint64_t instead. + +type Longlong_t = Int64_t /* types.h:135:18 */ // for XDR +type U_longlong_t = Uint64_t /* types.h:136:18 */ // for XDR + +type Blkcnt_t = Int64_t /* types.h:138:18 */ // fs block count +type Blksize_t = Int32_t /* types.h:139:18 */ // fs optimal block size + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:142:22 */ // fs block count (statvfs) + +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:147:22 */ // fs file count + +// We don't and shouldn't use caddr_t in the kernel anymore +type Caddr_t = X__caddr_t /* types.h:154:19 */ // core address + +type Daddr_t = Int64_t /* types.h:163:18 */ // disk address + +type Dev_t = Uint64_t /* types.h:166:18 */ // device number +type Fixpt_t = Uint32_t /* types.h:167:18 */ // fixed point number + +type Gid_t = X__gid_t /* types.h:170:18 */ // group id + +type Id_t = Uint32_t /* types.h:174:18 */ // group id, process id or user id +type Ino_t = Uint64_t /* types.h:175:18 */ // inode number +type Key_t = int64 /* types.h:176:15 */ // IPC key (for Sys V IPC) + +type Mode_t = X__mode_t /* types.h:179:18 */ // permissions + +type Nlink_t = Uint32_t /* types.h:183:18 */ // link count + +type Off_t = X__off_t /* types.h:186:18 */ // file offset + +type Pid_t = X__pid_t /* types.h:191:18 */ // process id +type Lwpid_t = Int32_t /* types.h:194:18 */ // LWP id +type Rlim_t = Uint64_t /* types.h:195:18 */ // resource limit +type Segsz_t = Int32_t /* types.h:196:18 */ // segment size +type Swblk_t = Int32_t /* types.h:197:18 */ // swap offset + +type Uid_t = X__uid_t /* types.h:200:18 */ // user id + +type Mqd_t = int32 /* types.h:204:14 */ + +type Cpuid_t = uint64 /* types.h:206:23 */ + +type Psetid_t = int32 /* types.h:208:14 */ + +type X__cpu_simple_lock_t = X__cpu_simple_lock_nv_t /* types.h:210:41 */ + +// Major, minor numbers, dev_t's. +type X__devmajor_t = Int32_t /* types.h:264:17 */ +type X__devminor_t = Int32_t /* types.h:264:31 */ + +type Clock_t = uint32 /* types.h:277:24 */ + +type Ssize_t = int64 /* types.h:301:24 */ + +type Time_t = X__int64_t /* types.h:306:23 */ + +type Clockid_t = int32 /* types.h:311:26 */ + +type Timer_t = int32 /* types.h:316:24 */ + +type Suseconds_t = int32 /* types.h:321:27 */ + +type Useconds_t = uint32 /* types.h:326:26 */ + +// $NetBSD: fd_set.h,v 1.7 2018/06/24 12:05:40 kamil Exp $ + +// - +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 8.4 (Berkeley) 1/21/94 + +// $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ + +// * Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + +// $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ + +// Written by Klaus Klein , February 2, 1998. +// Public domain. +// +// NOTE: Do not protect this header against multiple inclusion. Doing +// so can have subtle side-effects due to header file inclusion order +// and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, +// protect each CPP macro that we want to supply. + +// Feature-test macros are defined by several standards, and allow an +// application to specify what symbols they want the system headers to +// expose, and hence what standard they want them to conform to. +// There are two classes of feature-test macros. The first class +// specify complete standards, and if one of these is defined, header +// files will try to conform to the relevant standard. They are: +// +// ANSI macros: +// _ANSI_SOURCE ANSI C89 +// +// POSIX macros: +// _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) +// _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 +// _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 +// _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 +// _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 +// _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 +// _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 +// +// X/Open macros: +// _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 +// _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions +// _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 +// _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 +// _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option +// _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option +// +// NetBSD macros: +// _NETBSD_SOURCE == 1 Make all NetBSD features available. +// +// If more than one of these "major" feature-test macros is defined, +// then the set of facilities provided (and namespace used) is the +// union of that specified by the relevant standards, and in case of +// conflict, the earlier standard in the above list has precedence (so +// if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version +// of rename() that's used is the POSIX one). If none of the "major" +// feature-test macros is defined, _NETBSD_SOURCE is assumed. +// +// There are also "minor" feature-test macros, which enable extra +// functionality in addition to some base standard. They should be +// defined along with one of the "major" macros. The "minor" macros +// are: +// +// _REENTRANT +// _ISOC99_SOURCE +// _ISOC11_SOURCE +// _LARGEFILE_SOURCE Large File Support +// + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// Implementation dependent defines, hidden from user space. +// POSIX does not specify them. + +type X__fd_mask = X__uint32_t /* fd_set.h:46:20 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set1 = struct{ Ffds_bits [8]X__fd_mask } /* fd_set.h:66:9 */ + +// 32 = 2 ^ 5 + +// Select uses bit fields of file descriptors. These macros manipulate +// such bit fields. Note: FD_SETSIZE may be defined by the user. + +type Fd_set = Fd_set1 /* fd_set.h:68:3 */ + +// Expose our internals if we are not required to hide them. + +type Kauth_cred_t = uintptr /* types.h:335:27 */ + +type Pri_t = int32 /* types.h:337:13 */ + +// $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ + +// - +// Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Nathan J. Williams. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the +// POSIX spinlock object. +// +// C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. +// This does not work for volatile types. Since C++ does not touch the guts +// of those types, we do not include volatile in the C++ definitions. +type Pthread_spin_t = X__cpu_simple_lock_t /* pthread_types.h:43:29 */ +type X__pthread_spin_t = Pthread_spin_t /* pthread_types.h:48:24 */ + +// Copied from PTQ_HEAD in pthread_queue.h + +type Pthread_queue_struct_t = struct { + Fptqh_first uintptr + Fptqh_last uintptr +} /* pthread_types.h:61:1 */ + +type Pthread_queue_t = Pthread_queue_struct_t /* pthread_types.h:62:39 */ +type X__pthread_attr_st = struct { + Fpta_magic uint32 + Fpta_flags int32 + Fpta_private uintptr +} /* pthread_types.h:65:1 */ + +type X__pthread_mutex_st = struct { + Fptm_magic uint32 + Fptm_errorcheck X__pthread_spin_t + Fptm_pad1 [3]Uint8_t + F__8 struct{ Fptm_ceiling uint8 } + Fptm_pad2 [3]Uint8_t + _ [4]byte + Fptm_owner Pthread_t + Fptm_waiters uintptr + Fptm_recursed uint32 + _ [4]byte + Fptm_spare2 uintptr +} /* pthread_types.h:66:1 */ + +type X__pthread_mutexattr_st = struct { + Fptma_magic uint32 + _ [4]byte + Fptma_private uintptr +} /* pthread_types.h:67:1 */ + +type X__pthread_cond_st = struct { + Fptc_magic uint32 + Fptc_lock X__pthread_spin_t + _ [3]byte + Fptc_waiters Pthread_queue_t + Fptc_mutex uintptr + Fptc_private uintptr +} /* pthread_types.h:68:1 */ + +type X__pthread_condattr_st = struct { + Fptca_magic uint32 + _ [4]byte + Fptca_private uintptr +} /* pthread_types.h:69:1 */ + +type X__pthread_rwlock_st = struct { + Fptr_magic uint32 + Fptr_interlock X__pthread_spin_t + _ [3]byte + Fptr_rblocked Pthread_queue_t + Fptr_wblocked Pthread_queue_t + Fptr_nreaders uint32 + _ [4]byte + Fptr_owner Pthread_t + Fptr_private uintptr +} /* pthread_types.h:71:1 */ + +type X__pthread_rwlockattr_st = struct { + Fptra_magic uint32 + _ [4]byte + Fptra_private uintptr +} /* pthread_types.h:72:1 */ + +type X__pthread_barrier_st = struct { + Fptb_magic uint32 + Fptb_lock Pthread_spin_t + _ [3]byte + Fptb_waiters Pthread_queue_t + Fptb_initcount uint32 + Fptb_curcount uint32 + Fptb_generation uint32 + _ [4]byte + Fptb_private uintptr +} /* pthread_types.h:73:1 */ + +type X__pthread_barrierattr_st = struct { + Fptba_magic uint32 + _ [4]byte + Fptba_private uintptr +} /* pthread_types.h:74:1 */ + +type Pthread_t = uintptr /* pthread_types.h:76:29 */ +type Pthread_attr_t = X__pthread_attr_st /* pthread_types.h:77:34 */ +type Pthread_mutex_t = X__pthread_mutex_st /* pthread_types.h:78:35 */ +type Pthread_mutexattr_t = X__pthread_mutexattr_st /* pthread_types.h:79:39 */ +type Pthread_cond_t = X__pthread_cond_st /* pthread_types.h:80:34 */ +type Pthread_condattr_t = X__pthread_condattr_st /* pthread_types.h:81:38 */ +type X__pthread_once_st = struct { + Fpto_mutex Pthread_mutex_t + Fpto_done int32 + _ [4]byte +} /* pthread_types.h:82:9 */ + +type Pthread_once_t = X__pthread_once_st /* pthread_types.h:82:34 */ +type X__pthread_spinlock_st = struct { + Fpts_magic uint32 + Fpts_spin X__pthread_spin_t + _ [3]byte + Fpts_flags int32 +} /* pthread_types.h:83:9 */ + +type Pthread_spinlock_t = X__pthread_spinlock_st /* pthread_types.h:83:38 */ +type Pthread_rwlock_t = X__pthread_rwlock_st /* pthread_types.h:84:36 */ +type Pthread_rwlockattr_t = X__pthread_rwlockattr_st /* pthread_types.h:85:40 */ +type Pthread_barrier_t = X__pthread_barrier_st /* pthread_types.h:86:37 */ +type Pthread_barrierattr_t = X__pthread_barrierattr_st /* pthread_types.h:87:41 */ +type Pthread_key_t = int32 /* pthread_types.h:88:13 */ // getsubopt(3) external variable + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/unistd/unistd_windows_386.go b/vendor/modernc.org/libc/unistd/unistd_windows_386.go index 38107097..1ac3e1ea 100644 --- a/vendor/modernc.org/libc/unistd/unistd_windows_386.go +++ b/vendor/modernc.org/libc/unistd/unistd_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_386.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_386.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/unistd/unistd_windows_amd64.go b/vendor/modernc.org/libc/unistd/unistd_windows_amd64.go index db687ded..892a2beb 100644 --- a/vendor/modernc.org/libc/unistd/unistd_windows_amd64.go +++ b/vendor/modernc.org/libc/unistd/unistd_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_amd64.go -pkgname unistd', DO NOT EDIT. +// Code generated by 'ccgo unistd/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o unistd/unistd_windows_amd64.go -pkgname unistd', DO NOT EDIT. package unistd diff --git a/vendor/modernc.org/libc/utime/capi_darwin_amd64.go b/vendor/modernc.org/libc/utime/capi_darwin_amd64.go index 45890f6e..f4971287 100644 --- a/vendor/modernc.org/libc/utime/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/utime/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_darwin_amd64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_darwin_amd64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_freebsd_amd64.go b/vendor/modernc.org/libc/utime/capi_freebsd_amd64.go new file mode 100644 index 00000000..88dc9f35 --- /dev/null +++ b/vendor/modernc.org/libc/utime/capi_freebsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_freebsd_amd64.go -pkgname utime', DO NOT EDIT. + +package utime + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/utime/capi_linux_386.go b/vendor/modernc.org/libc/utime/capi_linux_386.go index d824e4dc..cd94b447 100644 --- a/vendor/modernc.org/libc/utime/capi_linux_386.go +++ b/vendor/modernc.org/libc/utime/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_386.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_386.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_linux_amd64.go b/vendor/modernc.org/libc/utime/capi_linux_amd64.go index 8cb60e83..381f6bcc 100644 --- a/vendor/modernc.org/libc/utime/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/utime/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_amd64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_amd64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_linux_arm.go b/vendor/modernc.org/libc/utime/capi_linux_arm.go index ef21e740..2bb2f7e4 100644 --- a/vendor/modernc.org/libc/utime/capi_linux_arm.go +++ b/vendor/modernc.org/libc/utime/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_linux_arm64.go b/vendor/modernc.org/libc/utime/capi_linux_arm64.go index 07fde99b..c9c417de 100644 --- a/vendor/modernc.org/libc/utime/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/utime/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_linux_s390x.go b/vendor/modernc.org/libc/utime/capi_linux_s390x.go index 7d4ab1c1..4d6513ab 100644 --- a/vendor/modernc.org/libc/utime/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/utime/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_s390x.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_s390x.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_netbsd_amd64.go b/vendor/modernc.org/libc/utime/capi_netbsd_amd64.go new file mode 100644 index 00000000..bddece8e --- /dev/null +++ b/vendor/modernc.org/libc/utime/capi_netbsd_amd64.go @@ -0,0 +1,5 @@ +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_netbsd_amd64.go -pkgname utime', DO NOT EDIT. + +package utime + +var CAPI = map[string]struct{}{} diff --git a/vendor/modernc.org/libc/utime/capi_windows_386.go b/vendor/modernc.org/libc/utime/capi_windows_386.go index af9c5097..6b156a0c 100644 --- a/vendor/modernc.org/libc/utime/capi_windows_386.go +++ b/vendor/modernc.org/libc/utime/capi_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_386.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_386.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/capi_windows_amd64.go b/vendor/modernc.org/libc/utime/capi_windows_amd64.go index 9a7f6537..e529924b 100644 --- a/vendor/modernc.org/libc/utime/capi_windows_amd64.go +++ b/vendor/modernc.org/libc/utime/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_amd64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_amd64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_darwin_amd64.go b/vendor/modernc.org/libc/utime/utime_darwin_amd64.go index 6620a90b..fa5accde 100644 --- a/vendor/modernc.org/libc/utime/utime_darwin_amd64.go +++ b/vendor/modernc.org/libc/utime/utime_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_darwin_amd64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_darwin_amd64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_freebsd_amd64.go b/vendor/modernc.org/libc/utime/utime_freebsd_amd64.go new file mode 100644 index 00000000..46ba2616 --- /dev/null +++ b/vendor/modernc.org/libc/utime/utime_freebsd_amd64.go @@ -0,0 +1,603 @@ +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_freebsd_amd64.go -pkgname utime', DO NOT EDIT. + +package utime + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_TIME_T_DECLARED = 0 + X_UTIME_H_ = 0 + Unix = 1 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)utime.h 8.1 (Berkeley) 6/2/93 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. +// - +// Deal with _ANSI_SOURCE: +// If it is defined, and no other compilation environment is explicitly +// requested, then define our internal feature-test macros to zero. This +// makes no difference to the preprocessor (undefined symbols in preprocessing +// expressions are defined to have value zero), but makes it more convenient for +// a test program to print out the values. +// +// If a program mistakenly defines _ANSI_SOURCE and some other macro such as +// _POSIX_C_SOURCE, we will assume that it wants the broader compilation +// environment (and in fact we will never get here). + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc +type X__gnuc_va_list = X__va_list /* _types.h:140:20 */ // compatibility w/GNU headers + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Time_t = X__time_t /* utime.h:42:18 */ + +type Utimbuf = struct { + Factime Time_t + Fmodtime Time_t +} /* utime.h:46:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/utime/utime_linux_386.go b/vendor/modernc.org/libc/utime/utime_linux_386.go index f03a403b..cb96dc56 100644 --- a/vendor/modernc.org/libc/utime/utime_linux_386.go +++ b/vendor/modernc.org/libc/utime/utime_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_386.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_386.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_linux_amd64.go b/vendor/modernc.org/libc/utime/utime_linux_amd64.go index 142db19f..76849944 100644 --- a/vendor/modernc.org/libc/utime/utime_linux_amd64.go +++ b/vendor/modernc.org/libc/utime/utime_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_amd64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_amd64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_linux_arm.go b/vendor/modernc.org/libc/utime/utime_linux_arm.go index 5d780a93..97dcd6aa 100644 --- a/vendor/modernc.org/libc/utime/utime_linux_arm.go +++ b/vendor/modernc.org/libc/utime/utime_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_linux_arm64.go b/vendor/modernc.org/libc/utime/utime_linux_arm64.go index ac3f9c1f..912d1538 100644 --- a/vendor/modernc.org/libc/utime/utime_linux_arm64.go +++ b/vendor/modernc.org/libc/utime/utime_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_arm64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_linux_s390x.go b/vendor/modernc.org/libc/utime/utime_linux_s390x.go index 7458f7cc..cf5ca24a 100644 --- a/vendor/modernc.org/libc/utime/utime_linux_s390x.go +++ b/vendor/modernc.org/libc/utime/utime_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_s390x.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_linux_s390x.go -pkgname utime', DO NOT EDIT. package utime @@ -16,6 +16,7 @@ var _ unsafe.Pointer const ( X_ATFILE_SOURCE = 1 + X_BITS_TIME64_H = 1 X_BITS_TYPESIZES_H = 1 X_BITS_TYPES_H = 1 X_DEFAULT_SOURCE = 1 @@ -49,7 +50,7 @@ type X__uint128_t = struct { type X__builtin_va_list = uintptr /* :46:14 */ type X__float128 = float64 /* :47:21 */ -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -64,11 +65,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // POSIX Standard: 5.6.6 Set File Access and Modification Times -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -83,7 +84,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // These are defined by the user (or the compiler) // to specify the desired environment: @@ -91,6 +92,7 @@ type X__float128 = float64 /* :47:21 */ // __STRICT_ANSI__ ISO Standard C. // _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. // _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. +// _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. // __STDC_WANT_LIB_EXT2__ // Extensions to ISO C99 from TR 27431-2:2010. // __STDC_WANT_IEC_60559_BFP_EXT__ @@ -211,6 +213,8 @@ type X__float128 = float64 /* :47:21 */ // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, // define _DEFAULT_SOURCE. +// This is to enable the ISO C2X extension. + // This is to enable the ISO C11 extension. // This is to enable the ISO C99 extension. @@ -233,9 +237,22 @@ type X__float128 = float64 /* :47:21 */ // compatibility with various implementations of , this test // must consider only the value of __cplusplus when compiling C++. +// GNU formerly extended the scanf functions with modified format +// specifiers %as, %aS, and %a[...] that allocate a buffer for the +// input using malloc. This extension conflicts with ISO C99, which +// defines %a as a standalone format specifier that reads a floating- +// point number; moreover, POSIX.1-2008 provides the same feature +// using the modifier letter 'm' instead (%ms, %mS, %m[...]). +// +// We now follow C99 unless GNU extensions are active and the compiler +// is specifically in C89 or C++98 mode (strict or not). For +// instance, with GCC, -std=gnu11 will have C99-compliant scanf with +// or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the +// old extension. + // Get definitions of __STDC_* predefined macros, if the compiler has // not preincluded this header automatically. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -250,7 +267,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // This macro indicates that the installed library is the GNU C Library. // For historic reasons the value now is 6 and this will stay from now @@ -263,7 +280,7 @@ type X__float128 = float64 /* :47:21 */ // these macros to test for features in specific releases. // This is here only because every header file already includes this one. -// Copyright (C) 1992-2018 Free Software Foundation, Inc. +// Copyright (C) 1992-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -278,7 +295,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // We are almost always included from features.h. @@ -393,7 +410,7 @@ type X__float128 = float64 /* :47:21 */ // semantics. // // clang++ identifies itself as gcc-4.2, but has support for GNU inlining -// semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and +// semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and // __GNUC_GNU_INLINE__ macro definitions. // GCC 4.3 and above allow passing all anonymous arguments of an @@ -410,14 +427,12 @@ type X__float128 = float64 /* :47:21 */ // array_name[restrict] // GCC 3.1 supports this. -// Describes a char array whose address can safely be passed as the first -// argument to strncpy and strncat, as the char array is not necessarily -// a NUL-terminated string. +// Undefine (also defined in libc-symbols.h). // Determine the wordsize from the preprocessor defines. // Properties of long double type. ldbl-opt version. -// Copyright (C) 2016-2018 Free Software Foundation, Inc. +// Copyright (C) 2016-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -432,7 +447,7 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is // intended for use in preprocessor macros. @@ -469,7 +484,7 @@ type X__float128 = float64 /* :47:21 */ // every time called, usually setting errno to ENOSYS. // bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -484,11 +499,11 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Never include this file directly; use instead. -// Copyright (C) 1991-2018 Free Software Foundation, Inc. +// Copyright (C) 1991-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -503,43 +518,65 @@ type X__float128 = float64 /* :47:21 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // Determine the wordsize from the preprocessor defines. +// Bit size of the time_t type at glibc build time, general case. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . + +// Determine the wordsize from the preprocessor defines. + +// Size in bits of the 'time_t' type of the default ABI. + // Convenience types. -type X__u_char = uint8 /* types.h:30:23 */ -type X__u_short = uint16 /* types.h:31:28 */ -type X__u_int = uint32 /* types.h:32:22 */ -type X__u_long = uint64 /* types.h:33:27 */ +type X__u_char = uint8 /* types.h:31:23 */ +type X__u_short = uint16 /* types.h:32:28 */ +type X__u_int = uint32 /* types.h:33:22 */ +type X__u_long = uint64 /* types.h:34:27 */ // Fixed-size types, underlying types depend on word size and compiler. -type X__int8_t = int8 /* types.h:36:21 */ -type X__uint8_t = uint8 /* types.h:37:23 */ -type X__int16_t = int16 /* types.h:38:26 */ -type X__uint16_t = uint16 /* types.h:39:28 */ -type X__int32_t = int32 /* types.h:40:20 */ -type X__uint32_t = uint32 /* types.h:41:22 */ -type X__int64_t = int64 /* types.h:43:25 */ -type X__uint64_t = uint64 /* types.h:44:27 */ +type X__int8_t = int8 /* types.h:37:21 */ +type X__uint8_t = uint8 /* types.h:38:23 */ +type X__int16_t = int16 /* types.h:39:26 */ +type X__uint16_t = uint16 /* types.h:40:28 */ +type X__int32_t = int32 /* types.h:41:20 */ +type X__uint32_t = uint32 /* types.h:42:22 */ +type X__int64_t = int64 /* types.h:44:25 */ +type X__uint64_t = uint64 /* types.h:45:27 */ // Smallest types with at least a given width. -type X__int_least8_t = X__int8_t /* types.h:51:18 */ -type X__uint_least8_t = X__uint8_t /* types.h:52:19 */ -type X__int_least16_t = X__int16_t /* types.h:53:19 */ -type X__uint_least16_t = X__uint16_t /* types.h:54:20 */ -type X__int_least32_t = X__int32_t /* types.h:55:19 */ -type X__uint_least32_t = X__uint32_t /* types.h:56:20 */ -type X__int_least64_t = X__int64_t /* types.h:57:19 */ -type X__uint_least64_t = X__uint64_t /* types.h:58:20 */ +type X__int_least8_t = X__int8_t /* types.h:52:18 */ +type X__uint_least8_t = X__uint8_t /* types.h:53:19 */ +type X__int_least16_t = X__int16_t /* types.h:54:19 */ +type X__uint_least16_t = X__uint16_t /* types.h:55:20 */ +type X__int_least32_t = X__int32_t /* types.h:56:19 */ +type X__uint_least32_t = X__uint32_t /* types.h:57:20 */ +type X__int_least64_t = X__int64_t /* types.h:58:19 */ +type X__uint_least64_t = X__uint64_t /* types.h:59:20 */ // quad_t is also 64 bits. -type X__quad_t = int64 /* types.h:62:18 */ -type X__u_quad_t = uint64 /* types.h:63:27 */ +type X__quad_t = int64 /* types.h:63:18 */ +type X__u_quad_t = uint64 /* types.h:64:27 */ // Largest integral types. -type X__intmax_t = int64 /* types.h:71:18 */ -type X__uintmax_t = uint64 /* types.h:72:27 */ +type X__intmax_t = int64 /* types.h:72:18 */ +type X__uintmax_t = uint64 /* types.h:73:27 */ // The machine-dependent file defines __*_T_TYPE // macros for each of the OS types we define below. The definitions @@ -551,7 +588,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // 32 -- "natural" 32-bit type (always int) // 64 -- "natural" 64-bit type (long or long long) // LONG32 -- 32-bit type, traditionally long -// QUAD -- 64-bit type, always long long +// QUAD -- 64-bit type, traditionally long long // WORD -- natural type of __WORDSIZE bits (int or long) // LONGWORD -- type of __WORDSIZE bits, traditionally long // @@ -572,7 +609,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // No need to mark the typedef with __extension__. // bits/typesizes.h -- underlying types for *_t. Linux/s390 version. -// Copyright (C) 2003-2018 Free Software Foundation, Inc. +// Copyright (C) 2003-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -587,7 +624,7 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . // See for the meaning of these macros. This file exists so // that need not vary across different GNU platforms. @@ -602,81 +639,12 @@ type X__uintmax_t = uint64 /* types.h:72:27 */ // And for __rlim_t and __rlim64_t. +// And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. + // Number of descriptors that can fit in an `fd_set'. -type X__dev_t = uint64 /* types.h:143:25 */ // Type of device numbers. -type X__uid_t = uint32 /* types.h:144:25 */ // Type of user identifications. -type X__gid_t = uint32 /* types.h:145:25 */ // Type of group identifications. -type X__ino_t = uint64 /* types.h:146:25 */ // Type of file serial numbers. -type X__ino64_t = uint64 /* types.h:147:27 */ // Type of file serial numbers (LFS). -type X__mode_t = uint32 /* types.h:148:26 */ // Type of file attribute bitmasks. -type X__nlink_t = uint64 /* types.h:149:27 */ // Type of file link counts. -type X__off_t = int64 /* types.h:150:25 */ // Type of file sizes and offsets. -type X__off64_t = int64 /* types.h:151:27 */ // Type of file sizes and offsets (LFS). -type X__pid_t = int32 /* types.h:152:25 */ // Type of process identifications. -type X__fsid_t = struct{ F__val [2]int32 } /* types.h:153:26 */ // Type of file system IDs. -type X__clock_t = int64 /* types.h:154:27 */ // Type of CPU usage counts. -type X__rlim_t = uint64 /* types.h:155:26 */ // Type for resource measurement. -type X__rlim64_t = uint64 /* types.h:156:28 */ // Type for resource measurement (LFS). -type X__id_t = uint32 /* types.h:157:24 */ // General type for IDs. -type X__time_t = int64 /* types.h:158:26 */ // Seconds since the Epoch. -type X__useconds_t = uint32 /* types.h:159:30 */ // Count of microseconds. -type X__suseconds_t = int64 /* types.h:160:31 */ // Signed count of microseconds. - -type X__daddr_t = int32 /* types.h:162:27 */ // The type of a disk address. -type X__key_t = int32 /* types.h:163:25 */ // Type of an IPC key. - -// Clock ID used in clock and timer functions. -type X__clockid_t = int32 /* types.h:166:29 */ - -// Timer ID returned by `timer_create'. -type X__timer_t = uintptr /* types.h:169:12 */ - -// Type to represent block size. -type X__blksize_t = int64 /* types.h:172:29 */ - -// Types from the Large File Support interface. - -// Type to count number of disk blocks. -type X__blkcnt_t = int64 /* types.h:177:28 */ -type X__blkcnt64_t = int64 /* types.h:178:30 */ - -// Type to count file system blocks. -type X__fsblkcnt_t = uint64 /* types.h:181:30 */ -type X__fsblkcnt64_t = uint64 /* types.h:182:32 */ - -// Type to count file system nodes. -type X__fsfilcnt_t = uint64 /* types.h:185:30 */ -type X__fsfilcnt64_t = uint64 /* types.h:186:32 */ - -// Type of miscellaneous file system fields. -type X__fsword_t = int64 /* types.h:189:28 */ - -type X__ssize_t = int64 /* types.h:191:27 */ // Type of a byte count, or error. - -// Signed long type used in system calls. -type X__syscall_slong_t = int64 /* types.h:194:33 */ -// Unsigned long type used in system calls. -type X__syscall_ulong_t = uint64 /* types.h:196:33 */ - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__loff_t = X__off64_t /* types.h:200:19 */ // Type of file sizes and offsets (LFS). -type X__caddr_t = uintptr /* types.h:201:14 */ - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__intptr_t = int64 /* types.h:204:25 */ - -// Duplicate info from sys/socket.h. -type X__socklen_t = uint32 /* types.h:207:23 */ - -// C99: An integer type that can be accessed as an atomic entity, -// even in the presence of asynchronous interrupts. -// It is not currently necessary for this to be machine-specific. -type X__sig_atomic_t = int32 /* types.h:212:13 */ - -// bits/types.h -- definitions of __*_t types underlying *_t types. -// Copyright (C) 2002-2018 Free Software Foundation, Inc. +// bits/time64.h -- underlying types for __time64_t. Generic version. +// Copyright (C) 2018-2020 Free Software Foundation, Inc. // This file is part of the GNU C Library. // // The GNU C Library is free software; you can redistribute it and/or @@ -691,7 +659,104 @@ type X__sig_atomic_t = int32 /* types.h:212:13 */ // // You should have received a copy of the GNU Lesser General Public // License along with the GNU C Library; if not, see -// . +// . + +// Define __TIME64_T_TYPE so that it is always a 64-bit type. + +// If we already have 64-bit time type then use it. + +type X__dev_t = uint64 /* types.h:145:25 */ // Type of device numbers. +type X__uid_t = uint32 /* types.h:146:25 */ // Type of user identifications. +type X__gid_t = uint32 /* types.h:147:25 */ // Type of group identifications. +type X__ino_t = uint64 /* types.h:148:25 */ // Type of file serial numbers. +type X__ino64_t = uint64 /* types.h:149:27 */ // Type of file serial numbers (LFS). +type X__mode_t = uint32 /* types.h:150:26 */ // Type of file attribute bitmasks. +type X__nlink_t = uint64 /* types.h:151:27 */ // Type of file link counts. +type X__off_t = int64 /* types.h:152:25 */ // Type of file sizes and offsets. +type X__off64_t = int64 /* types.h:153:27 */ // Type of file sizes and offsets (LFS). +type X__pid_t = int32 /* types.h:154:25 */ // Type of process identifications. +type X__fsid_t = struct{ F__val [2]int32 } /* types.h:155:26 */ // Type of file system IDs. +type X__clock_t = int64 /* types.h:156:27 */ // Type of CPU usage counts. +type X__rlim_t = uint64 /* types.h:157:26 */ // Type for resource measurement. +type X__rlim64_t = uint64 /* types.h:158:28 */ // Type for resource measurement (LFS). +type X__id_t = uint32 /* types.h:159:24 */ // General type for IDs. +type X__time_t = int64 /* types.h:160:26 */ // Seconds since the Epoch. +type X__useconds_t = uint32 /* types.h:161:30 */ // Count of microseconds. +type X__suseconds_t = int64 /* types.h:162:31 */ // Signed count of microseconds. + +type X__daddr_t = int32 /* types.h:164:27 */ // The type of a disk address. +type X__key_t = int32 /* types.h:165:25 */ // Type of an IPC key. + +// Clock ID used in clock and timer functions. +type X__clockid_t = int32 /* types.h:168:29 */ + +// Timer ID returned by `timer_create'. +type X__timer_t = uintptr /* types.h:171:12 */ + +// Type to represent block size. +type X__blksize_t = int64 /* types.h:174:29 */ + +// Types from the Large File Support interface. + +// Type to count number of disk blocks. +type X__blkcnt_t = int64 /* types.h:179:28 */ +type X__blkcnt64_t = int64 /* types.h:180:30 */ + +// Type to count file system blocks. +type X__fsblkcnt_t = uint64 /* types.h:183:30 */ +type X__fsblkcnt64_t = uint64 /* types.h:184:32 */ + +// Type to count file system nodes. +type X__fsfilcnt_t = uint64 /* types.h:187:30 */ +type X__fsfilcnt64_t = uint64 /* types.h:188:32 */ + +// Type of miscellaneous file system fields. +type X__fsword_t = int64 /* types.h:191:28 */ + +type X__ssize_t = int64 /* types.h:193:27 */ // Type of a byte count, or error. + +// Signed long type used in system calls. +type X__syscall_slong_t = int64 /* types.h:196:33 */ +// Unsigned long type used in system calls. +type X__syscall_ulong_t = uint64 /* types.h:198:33 */ + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__loff_t = X__off64_t /* types.h:202:19 */ // Type of file sizes and offsets (LFS). +type X__caddr_t = uintptr /* types.h:203:14 */ + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__intptr_t = int64 /* types.h:206:25 */ + +// Duplicate info from sys/socket.h. +type X__socklen_t = uint32 /* types.h:209:23 */ + +// C99: An integer type that can be accessed as an atomic entity, +// even in the presence of asynchronous interrupts. +// It is not currently necessary for this to be machine-specific. +type X__sig_atomic_t = int32 /* types.h:214:13 */ + +// Seconds since the Epoch, visible to user code when time_t is too +// narrow only for consistency with the old way of widening too-narrow +// types. User code should never use __time64_t. + +// bits/types.h -- definitions of __*_t types underlying *_t types. +// Copyright (C) 2002-2020 Free Software Foundation, Inc. +// This file is part of the GNU C Library. +// +// The GNU C Library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// The GNU C Library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with the GNU C Library; if not, see +// . // Never include this file directly; use instead. @@ -704,4 +769,4 @@ type Utimbuf = struct { Fmodtime X__time_t } /* utime.h:36:1 */ -var _ int8 /* gen.c:2:13: */ +var _ uint8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/utime/utime_netbsd_amd64.go b/vendor/modernc.org/libc/utime/utime_netbsd_amd64.go new file mode 100644 index 00000000..56559238 --- /dev/null +++ b/vendor/modernc.org/libc/utime/utime_netbsd_amd64.go @@ -0,0 +1,144 @@ +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_netbsd_amd64.go -pkgname utime', DO NOT EDIT. + +package utime + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer + +const ( + X_AMD64_INT_TYPES_H_ = 0 + X_FILE_OFFSET_BITS = 64 + X_LP64 = 1 + X_SYS_CDEFS_ELF_H_ = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_COMMON_ANSI_H_ = 0 + X_SYS_COMMON_INT_TYPES_H_ = 0 + X_UTIME_H_ = 0 + X_X86_64_CDEFS_H_ = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// return true if value 'a' fits in type 't' + +// $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 1990 The Regents of the University of California. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// from: @(#)types.h 7.5 (Berkeley) 3/9/91 + +// $NetBSD: common_int_types.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ + +// - +// Copyright (c) 2014 The NetBSD Foundation, Inc. +// All rights reserved. +// +// This code is derived from software contributed to The NetBSD Foundation +// by Joerg Sonnenberger. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +// ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +type X__int8_t = int8 /* common_int_types.h:45:27 */ +type X__uint8_t = uint8 /* common_int_types.h:46:27 */ +type X__int16_t = int16 /* common_int_types.h:47:27 */ +type X__uint16_t = uint16 /* common_int_types.h:48:27 */ +type X__int32_t = int32 /* common_int_types.h:49:27 */ +type X__uint32_t = uint32 /* common_int_types.h:50:27 */ +type X__int64_t = int64 /* common_int_types.h:51:27 */ +type X__uint64_t = uint64 /* common_int_types.h:52:27 */ + +// 7.18.1.4 Integer types capable of holding object pointers + +type X__intptr_t = int64 /* common_int_types.h:58:27 */ +type X__uintptr_t = uint64 /* common_int_types.h:59:26 */ + +// Types which are fundamental to the implementation and may appear in +// more than one standard header are defined here. Standard headers +// then use: +// #ifdef _BSD_SIZE_T_ +// typedef _BSD_SIZE_T_ size_t; +// #undef _BSD_SIZE_T_ +// #endif + +type Time_t = X__int64_t /* utime.h:40:22 */ + +type Utimbuf = struct { + Factime Time_t + Fmodtime Time_t +} /* utime.h:44:1 */ + +var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/utime/utime_windows_386.go b/vendor/modernc.org/libc/utime/utime_windows_386.go index 102c883a..4dbdbde0 100644 --- a/vendor/modernc.org/libc/utime/utime_windows_386.go +++ b/vendor/modernc.org/libc/utime/utime_windows_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_386.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_386.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/utime/utime_windows_amd64.go b/vendor/modernc.org/libc/utime/utime_windows_amd64.go index d0821419..a45106af 100644 --- a/vendor/modernc.org/libc/utime/utime_windows_amd64.go +++ b/vendor/modernc.org/libc/utime/utime_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_amd64.go -pkgname utime', DO NOT EDIT. +// Code generated by 'ccgo utime/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o utime/utime_windows_amd64.go -pkgname utime', DO NOT EDIT. package utime diff --git a/vendor/modernc.org/libc/uuid/uuid/capi_darwin_amd64.go b/vendor/modernc.org/libc/uuid/uuid/capi_darwin_amd64.go index 20bfad1d..caed84ee 100644 --- a/vendor/modernc.org/libc/uuid/uuid/capi_darwin_amd64.go +++ b/vendor/modernc.org/libc/uuid/uuid/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_darwin_amd64.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_darwin_amd64.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/capi_linux_386.go b/vendor/modernc.org/libc/uuid/uuid/capi_linux_386.go index 95e035a0..d663f55d 100644 --- a/vendor/modernc.org/libc/uuid/uuid/capi_linux_386.go +++ b/vendor/modernc.org/libc/uuid/uuid/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_386.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_386.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/capi_linux_amd64.go b/vendor/modernc.org/libc/uuid/uuid/capi_linux_amd64.go index c2014741..1439e9a1 100644 --- a/vendor/modernc.org/libc/uuid/uuid/capi_linux_amd64.go +++ b/vendor/modernc.org/libc/uuid/uuid/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_amd64.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_amd64.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm.go b/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm.go index 7274a3aa..ade9414e 100644 --- a/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm.go +++ b/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm64.go b/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm64.go index 514b53ac..8fee6f78 100644 --- a/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm64.go +++ b/vendor/modernc.org/libc/uuid/uuid/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm64.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm64.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/capi_linux_s390x.go b/vendor/modernc.org/libc/uuid/uuid/capi_linux_s390x.go index 9947209f..41aa499d 100644 --- a/vendor/modernc.org/libc/uuid/uuid/capi_linux_s390x.go +++ b/vendor/modernc.org/libc/uuid/uuid/capi_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_s390x.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path -export-defines -export-enums -export-externs X -export-fields F -export-structs -export-typedefs -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_s390x.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/uuid_darwin_amd64.go b/vendor/modernc.org/libc/uuid/uuid/uuid_darwin_amd64.go index d10b60c7..b4f660f2 100644 --- a/vendor/modernc.org/libc/uuid/uuid/uuid_darwin_amd64.go +++ b/vendor/modernc.org/libc/uuid/uuid/uuid_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_darwin_amd64.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_darwin_amd64.go -pkgname uuid', DO NOT EDIT. package uuid @@ -806,6 +806,4 @@ type Uuid_t = X__darwin_uuid_t /* _uuid_t.h:31:25 */ type Uuid_string_t = X__darwin_uuid_string_t /* uuid.h:43:33 */ -var sUUID_NULL = Uuid_t{uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0)} /* uuid.h:49:1 */ - var _ int8 /* gen.c:2:13: */ diff --git a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_386.go b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_386.go index 2ac3d060..d00c9216 100644 --- a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_386.go +++ b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_386.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_386.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_amd64.go b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_amd64.go index d49ff63e..8b80db6c 100644 --- a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_amd64.go +++ b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_amd64.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_amd64.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm.go b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm.go index ab19b232..aff380bf 100644 --- a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm.go +++ b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm64.go b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm64.go index 0f2bb48d..1a968fd5 100644 --- a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm64.go +++ b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm64.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_arm64.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_s390x.go b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_s390x.go index 087ed6dd..edbcfc66 100644 --- a/vendor/modernc.org/libc/uuid/uuid/uuid_linux_s390x.go +++ b/vendor/modernc.org/libc/uuid/uuid/uuid_linux_s390x.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_s390x.go -pkgname uuid', DO NOT EDIT. +// Code generated by 'ccgo uuid/uuid/gen.c -crt-import-path "" -export-defines "" -export-enums "" -export-externs X -export-fields F -export-structs "" -export-typedefs "" -header -hide _OSSwapInt16,_OSSwapInt32,_OSSwapInt64 -o uuid/uuid/uuid_linux_s390x.go -pkgname uuid', DO NOT EDIT. package uuid diff --git a/vendor/modernc.org/mathutil/CONTRIBUTORS b/vendor/modernc.org/mathutil/CONTRIBUTORS index 8f2b983b..a2317614 100644 --- a/vendor/modernc.org/mathutil/CONTRIBUTORS +++ b/vendor/modernc.org/mathutil/CONTRIBUTORS @@ -12,3 +12,4 @@ Faiz Abbasi Gary Burd Jan Mercl <0xjnml@gmail.com> Muhammad Surya +Santiago De la Cruz diff --git a/vendor/modernc.org/mathutil/binarylog.go b/vendor/modernc.org/mathutil/binarylog.go index 5e3eecb0..5a35c57d 100644 --- a/vendor/modernc.org/mathutil/binarylog.go +++ b/vendor/modernc.org/mathutil/binarylog.go @@ -6,8 +6,6 @@ package mathutil // import "modernc.org/mathutil" import ( "math/big" - - "github.com/remyoudompheng/bigfft" ) type float struct { @@ -55,12 +53,6 @@ func (f *float) div2() { f.normalize() } -func (f *float) sqr() { - f.n = bigfft.Mul(f.n, f.n) - f.fracBits *= 2 - f.normalize() -} - // BinaryLog computes the binary logarithm of n. The result consists of a // characteristic and a mantissa having precision mantissaBits. The value of // the binary logarithm is diff --git a/vendor/modernc.org/mathutil/sqr.go b/vendor/modernc.org/mathutil/sqr.go new file mode 100644 index 00000000..0b29b874 --- /dev/null +++ b/vendor/modernc.org/mathutil/sqr.go @@ -0,0 +1,11 @@ +// +build !riscv64 + +package mathutil + +import "github.com/remyoudompheng/bigfft" + +func (f *float) sqr() { + f.n = bigfft.Mul(f.n, f.n) + f.fracBits *= 2 + f.normalize() +} diff --git a/vendor/modernc.org/mathutil/sqr_std.go b/vendor/modernc.org/mathutil/sqr_std.go new file mode 100644 index 00000000..50c69204 --- /dev/null +++ b/vendor/modernc.org/mathutil/sqr_std.go @@ -0,0 +1,9 @@ +// +build riscv64 + +package mathutil + +func (f *float) sqr() { + f.n.Mul(f.n, f.n) + f.fracBits *= 2 + f.normalize() +} diff --git a/vendor/modernc.org/memory/Makefile b/vendor/modernc.org/memory/Makefile index 848cf385..fbb3e4ee 100644 --- a/vendor/modernc.org/memory/Makefile +++ b/vendor/modernc.org/memory/Makefile @@ -34,11 +34,15 @@ edit: editor: gofmt -l -s -w *.go + GOOS=darwin GOARCH=amd64 go build + GOOS=darwin GOARCH=arm64 go build GOOS=linux GOARCH=386 go build GOOS=linux GOARCH=amd64 go build + GOOS=linux GOARCH=arm go build + GOOS=linux GOARCH=arm64 go build + GOOS=linux GOARCH=s390x go build GOOS=windows GOARCH=386 go build GOOS=windows GOARCH=amd64 go build - go test -i go test 2>&1 | tee log internalError: diff --git a/vendor/modernc.org/memory/memory.go b/vendor/modernc.org/memory/memory.go index bc7b38f5..bbfaffcf 100644 --- a/vendor/modernc.org/memory/memory.go +++ b/vendor/modernc.org/memory/memory.go @@ -20,7 +20,7 @@ // // Benchmarks // -// AMD Ryzen 9 3900X 12-Core Processor × 24 +// AMD Ryzen 9 3900X 12-Core Processor × 24 // // jnml@3900x:~/src/modernc.org/memory$ date ; go version ; go test -run @ -bench . -benchmem |& tee log // Fri Nov 20 17:23:04 CET 2020 @@ -51,7 +51,7 @@ // BenchmarkUintptrMalloc64-24 213706227 5.47 ns/op 0 B/op 0 allocs/op // PASS // ok modernc.org/memory 70.528s -// jnml@3900x:~/src/modernc.org/memory$ +// jnml@3900x:~/src/modernc.org/memory$ // // Intel® Core™ i5-4670 CPU @ 3.40GHz × 4 // diff --git a/vendor/modernc.org/memory/mmap_windows.go b/vendor/modernc.org/memory/mmap_windows.go index 4db6c618..3c402039 100644 --- a/vendor/modernc.org/memory/mmap_windows.go +++ b/vendor/modernc.org/memory/mmap_windows.go @@ -5,6 +5,7 @@ package memory // import "modernc.org/memory" import ( + "os" "syscall" ) @@ -22,6 +23,8 @@ const pageSizeLog = 16 var ( modkernel32 = syscall.NewLazyDLL("kernel32.dll") + osPageMask = osPageSize - 1 + osPageSize = os.Getpagesize() procVirtualAlloc = modkernel32.NewProc("VirtualAlloc") procVirtualFree = modkernel32.NewProc("VirtualFree") ) diff --git a/vendor/modernc.org/sqlite/AUTHORS b/vendor/modernc.org/sqlite/AUTHORS index eee21ef1..22ed3567 100644 --- a/vendor/modernc.org/sqlite/AUTHORS +++ b/vendor/modernc.org/sqlite/AUTHORS @@ -12,6 +12,7 @@ Dan Peterson Davsk Ltd Co Jaap Aarts Jan Mercl <0xjnml@gmail.com> +Logan Snow Ross Light Steffen Butzer Saed SayedAhmed diff --git a/vendor/modernc.org/sqlite/CONTRIBUTORS b/vendor/modernc.org/sqlite/CONTRIBUTORS index 61a74c34..af689e6c 100644 --- a/vendor/modernc.org/sqlite/CONTRIBUTORS +++ b/vendor/modernc.org/sqlite/CONTRIBUTORS @@ -11,6 +11,7 @@ Dan Peterson David Skinner Jaap Aarts Jan Mercl <0xjnml@gmail.com> +Logan Snow Ross Light Steffen Butzer Yaacov Akiba Slama diff --git a/vendor/modernc.org/sqlite/Makefile b/vendor/modernc.org/sqlite/Makefile index 84584f3e..0a917891 100644 --- a/vendor/modernc.org/sqlite/Makefile +++ b/vendor/modernc.org/sqlite/Makefile @@ -37,6 +37,7 @@ all: editor build_all_targets: GOOS=darwin GOARCH=amd64 go build -v ./... GOOS=darwin GOARCH=arm64 go build -v ./... + GOOS=freebsd GOARCH=amd64 go build -v ./... GOOS=linux GOARCH=386 go build -v ./... GOOS=linux GOARCH=amd64 go build -v ./... GOOS=linux GOARCH=arm go build -v ./... @@ -54,6 +55,10 @@ darwin_arm64: TARGET_GOOS=darwin TARGET_GOARCH=arm64 go generate 2>&1 | tee /tmp/log-generate-sqlite-darwin-arm64 GOOS=darwin GOARCH=arm64 go build -v ./... +freebsd_amd64: + TARGET_GOOS=freebsd TARGET_GOARCH=amd64 go generate 2>&1 | tee /tmp/log-generate-sqlite-freebsd-amd64 + GOOS=freebsd GOARCH=amd64 go build -v ./... + linux_amd64: TARGET_GOOS=linux TARGET_GOARCH=amd64 go generate 2>&1 | tee /tmp/log-generate-sqlite-linux-amd64 GOOS=linux GOARCH=amd64 go build -v ./... @@ -143,7 +148,7 @@ edit: editor: gofmt -l -s -w *.go - GO111MODULE=off go install -v ./... + go install -v ./... internalError: egrep -ho '"internal error.*"' *.go | sort | cat -n diff --git a/vendor/modernc.org/sqlite/doc.go b/vendor/modernc.org/sqlite/doc.go index 37677b08..8033f218 100644 --- a/vendor/modernc.org/sqlite/doc.go +++ b/vendor/modernc.org/sqlite/doc.go @@ -7,6 +7,27 @@ // SQLite is an in-process implementation of a self-contained, serverless, // zero-configuration, transactional SQL database engine. // +// Supported platforms and architectures +// +// These combinations of GOOS and GOARCH are currently supported +// +// darwin amd64 +// darwin arm64 +// freebsd amd64 +// linux 386 +// linux amd64 +// linux arm +// linux arm64 +// windows amd64 +// +// The windows/amd64 has currently experimental/preview status. Tcl tests +// report an unresolved yet memory leak, see +// https://gitlab.com/cznic/sqlite/-/issues/23 for more details. +// +// Planned platforms and architectures +// +// windows 386 +// // Builders // // Builder results available at @@ -15,6 +36,12 @@ // // Changelog // +// 2021-09-07 v1.13.0: +// +// Support freebsd/amd64. +// +// Changelog +// // 2021-06-23 v1.11.0: // // Upgrade to use sqlite 3.36.0, release notes at https://www.sqlite.org/releaselog/3_36_0.html. @@ -119,26 +146,6 @@ // // ... // -// Supported platforms and architectures -// -// These combinations of GOOS and GOARCH are currently supported -// -// darwin amd64 -// darwin arm64 -// linux 386 -// linux amd64 -// linux arm -// linux arm64 -// windows amd64 -// -// The windows/amd64 has currently experimental/preview status. Tcl tests -// report an unresolved yet memory leak, see -// https://gitlab.com/cznic/sqlite/-/issues/23 for more details. -// -// Planned platforms and architectures -// -// windows 386 -// // Debug and development versions // // A comma separated list of options can be passed to `go generate` via the diff --git a/vendor/modernc.org/sqlite/generator.go b/vendor/modernc.org/sqlite/generator.go index b4ddfdab..36b89a40 100644 --- a/vendor/modernc.org/sqlite/generator.go +++ b/vendor/modernc.org/sqlite/generator.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build generator // +build generator package main @@ -161,6 +162,7 @@ var ( "-DSQLITE_ENABLE_PREUPDATE_HOOK", "-DSQLITE_ENABLE_RBU", "-DSQLITE_ENABLE_RTREE", + "-DSQLITE_ENABLE_SESSION", "-DSQLITE_ENABLE_SNAPSHOT", "-DSQLITE_ENABLE_STAT4", "-DSQLITE_ENABLE_UNLOCK_NOTIFY", // Adds sqlite3_unlock_notify(). @@ -170,7 +172,6 @@ var ( "-DSQLITE_THREADSAFE=1", //DONT "-DNDEBUG", // To enable GO_GENERATE=-DSQLITE_DEBUG //DONT "-DSQLITE_DQS=0", // testfixture - //DONT "-DSQLITE_ENABLE_SESSION", // Needs UTF16 //DONT "-DSQLITE_NO_SYNC=1", //DONT "-DSQLITE_OMIT_DECLTYPE", // testfixture //DONT "-DSQLITE_OMIT_DEPRECATED", // mptest @@ -212,6 +213,7 @@ var ( "-DSQLITE_ENABLE_PREUPDATE_HOOK", "-DSQLITE_ENABLE_RBU", "-DSQLITE_ENABLE_RTREE", + "-DSQLITE_ENABLE_SESSION", "-DSQLITE_ENABLE_SNAPSHOT", "-DSQLITE_ENABLE_STAT4", "-DSQLITE_ENABLE_STMTVTAB", // testfixture @@ -225,7 +227,6 @@ var ( "-DSQLITE_THREADSAFE=1", //DONT "-DNDEBUG", // To enable GO_GENERATE=-DSQLITE_DEBUG //DONT "-DSQLITE_DQS=0", // testfixture - //DONT "-DSQLITE_ENABLE_SESSION", // Needs UTF16 //DONT "-DSQLITE_NO_SYNC=1", //DONT "-DSQLITE_OMIT_DECLTYPE", // testfixture //DONT "-DSQLITE_OMIT_DEPRECATED", // mptest @@ -398,7 +399,7 @@ func main() { configTest = append(configTest, "-DSQLITE_MUTEX_NOOP") } switch goos { - case "linux": + case "linux", "freebsd": configProduction = append(configProduction, "-DSQLITE_OS_UNIX=1") case "darwin": configProduction = append(configProduction, @@ -446,7 +447,7 @@ func configure(goos, goarch string) { cmd.Run() var args []string switch goos { - case "linux": + case "linux", "freebsd": // nop case "darwin": args = append(args, "--with-tcl=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework") @@ -520,7 +521,7 @@ func makeTestfixture(goos, goarch string, more []string) { "ext/misc/wholenumber.c", "ext/misc/zipfile.c", "ext/rbu/test_rbu.c", - // "ext/session/test_session.c", // Needs UTF16 + "ext/session/test_session.c", "ext/userauth/userauth.c", "src/tclsqlite.c", "src/test1.c", diff --git a/vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go b/vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go index 5db362db..c553cf71 100644 --- a/vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go +++ b/vendor/modernc.org/sqlite/lib/capi_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_darwin_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_darwin_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. package sqlite3 @@ -1242,6 +1242,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1255,4 +1281,25 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, } diff --git a/vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go b/vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go index b53848fc..824d9e16 100644 --- a/vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go +++ b/vendor/modernc.org/sqlite/lib/capi_darwin_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_darwin_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_darwin_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. package sqlite3 @@ -1242,6 +1242,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1255,4 +1281,25 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, } diff --git a/vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go b/vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go new file mode 100644 index 00000000..87d302fa --- /dev/null +++ b/vendor/modernc.org/sqlite/lib/capi_freebsd_amd64.go @@ -0,0 +1,1305 @@ +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_freebsd_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. + +package sqlite3 + +var CAPI = map[string]struct{}{ + "rbuVacuumIndexStart": {}, + "sqlite3AbsInt32": {}, + "sqlite3AddCheckConstraint": {}, + "sqlite3AddCollateType": {}, + "sqlite3AddColumn": {}, + "sqlite3AddDefaultValue": {}, + "sqlite3AddGenerated": {}, + "sqlite3AddInt64": {}, + "sqlite3AddNotNull": {}, + "sqlite3AddPrimaryKey": {}, + "sqlite3AddReturning": {}, + "sqlite3AffinityType": {}, + "sqlite3AggInfoPersistWalkerInit": {}, + "sqlite3AllocateIndexObject": {}, + "sqlite3AlterBeginAddColumn": {}, + "sqlite3AlterDropColumn": {}, + "sqlite3AlterFinishAddColumn": {}, + "sqlite3AlterFunctions": {}, + "sqlite3AlterRenameColumn": {}, + "sqlite3AlterRenameTable": {}, + "sqlite3AnalysisLoad": {}, + "sqlite3Analyze": {}, + "sqlite3ApiExit": {}, + "sqlite3ArrayAllocate": {}, + "sqlite3AtoF": {}, + "sqlite3Atoi": {}, + "sqlite3Atoi64": {}, + "sqlite3Attach": {}, + "sqlite3AuthCheck": {}, + "sqlite3AuthContextPop": {}, + "sqlite3AuthContextPush": {}, + "sqlite3AuthRead": {}, + "sqlite3AuthReadCol": {}, + "sqlite3AutoLoadExtensions": {}, + "sqlite3AutoincrementBegin": {}, + "sqlite3AutoincrementEnd": {}, + "sqlite3BackupRestart": {}, + "sqlite3BackupUpdate": {}, + "sqlite3BeginBenignMalloc": {}, + "sqlite3BeginTransaction": {}, + "sqlite3BeginTrigger": {}, + "sqlite3BeginWriteOperation": {}, + "sqlite3BenignMallocHooks": {}, + "sqlite3BinaryCompareCollSeq": {}, + "sqlite3BitvecBuiltinTest": {}, + "sqlite3BitvecClear": {}, + "sqlite3BitvecCreate": {}, + "sqlite3BitvecDestroy": {}, + "sqlite3BitvecSet": {}, + "sqlite3BitvecSize": {}, + "sqlite3BitvecTest": {}, + "sqlite3BitvecTestNotNull": {}, + "sqlite3BlobCompare": {}, + "sqlite3BtreeBeginStmt": {}, + "sqlite3BtreeBeginTrans": {}, + "sqlite3BtreeCheckpoint": {}, + "sqlite3BtreeClearCursor": {}, + "sqlite3BtreeClearTable": {}, + "sqlite3BtreeClearTableOfCursor": {}, + "sqlite3BtreeClose": {}, + "sqlite3BtreeCloseCursor": {}, + "sqlite3BtreeCommit": {}, + "sqlite3BtreeCommitPhaseOne": {}, + "sqlite3BtreeCommitPhaseTwo": {}, + "sqlite3BtreeConnectionCount": {}, + "sqlite3BtreeCopyFile": {}, + "sqlite3BtreeCount": {}, + "sqlite3BtreeCreateTable": {}, + "sqlite3BtreeCursor": {}, + "sqlite3BtreeCursorHasHint": {}, + "sqlite3BtreeCursorHasMoved": {}, + "sqlite3BtreeCursorHintFlags": {}, + "sqlite3BtreeCursorIsValidNN": {}, + "sqlite3BtreeCursorPin": {}, + "sqlite3BtreeCursorRestore": {}, + "sqlite3BtreeCursorSize": {}, + "sqlite3BtreeCursorUnpin": {}, + "sqlite3BtreeCursorZero": {}, + "sqlite3BtreeDelete": {}, + "sqlite3BtreeDropTable": {}, + "sqlite3BtreeEnter": {}, + "sqlite3BtreeEnterAll": {}, + "sqlite3BtreeEnterCursor": {}, + "sqlite3BtreeEof": {}, + "sqlite3BtreeFakeValidCursor": {}, + "sqlite3BtreeFirst": {}, + "sqlite3BtreeGetAutoVacuum": {}, + "sqlite3BtreeGetFilename": {}, + "sqlite3BtreeGetJournalname": {}, + "sqlite3BtreeGetMeta": {}, + "sqlite3BtreeGetPageSize": {}, + "sqlite3BtreeGetRequestedReserve": {}, + "sqlite3BtreeGetReserveNoMutex": {}, + "sqlite3BtreeIncrVacuum": {}, + "sqlite3BtreeIncrblobCursor": {}, + "sqlite3BtreeInsert": {}, + "sqlite3BtreeIntegerKey": {}, + "sqlite3BtreeIntegrityCheck": {}, + "sqlite3BtreeIsInBackup": {}, + "sqlite3BtreeIsReadonly": {}, + "sqlite3BtreeLast": {}, + "sqlite3BtreeLastPage": {}, + "sqlite3BtreeLeave": {}, + "sqlite3BtreeLeaveAll": {}, + "sqlite3BtreeLeaveCursor": {}, + "sqlite3BtreeLockTable": {}, + "sqlite3BtreeMaxPageCount": {}, + "sqlite3BtreeMaxRecordSize": {}, + "sqlite3BtreeMovetoUnpacked": {}, + "sqlite3BtreeNewDb": {}, + "sqlite3BtreeNext": {}, + "sqlite3BtreeOffset": {}, + "sqlite3BtreeOpen": {}, + "sqlite3BtreePager": {}, + "sqlite3BtreePayload": {}, + "sqlite3BtreePayloadChecked": {}, + "sqlite3BtreePayloadFetch": {}, + "sqlite3BtreePayloadSize": {}, + "sqlite3BtreePrevious": {}, + "sqlite3BtreePutData": {}, + "sqlite3BtreeRollback": {}, + "sqlite3BtreeRowCountEst": {}, + "sqlite3BtreeSavepoint": {}, + "sqlite3BtreeSchema": {}, + "sqlite3BtreeSchemaLocked": {}, + "sqlite3BtreeSecureDelete": {}, + "sqlite3BtreeSetAutoVacuum": {}, + "sqlite3BtreeSetCacheSize": {}, + "sqlite3BtreeSetMmapLimit": {}, + "sqlite3BtreeSetPageSize": {}, + "sqlite3BtreeSetPagerFlags": {}, + "sqlite3BtreeSetSpillSize": {}, + "sqlite3BtreeSetVersion": {}, + "sqlite3BtreeSharable": {}, + "sqlite3BtreeTransferRow": {}, + "sqlite3BtreeTripAllCursors": {}, + "sqlite3BtreeTxnState": {}, + "sqlite3BtreeUpdateMeta": {}, + "sqlite3BuiltinFunctions": {}, + "sqlite3CantopenError": {}, + "sqlite3ChangeCookie": {}, + "sqlite3CheckCollSeq": {}, + "sqlite3CheckObjectName": {}, + "sqlite3Checkpoint": {}, + "sqlite3ClearTempRegCache": {}, + "sqlite3CloseExtensions": {}, + "sqlite3CloseSavepoints": {}, + "sqlite3CodeDropTable": {}, + "sqlite3CodeRhsOfIN": {}, + "sqlite3CodeRowTrigger": {}, + "sqlite3CodeRowTriggerDirect": {}, + "sqlite3CodeSubselect": {}, + "sqlite3CodeVerifyNamedSchema": {}, + "sqlite3CodeVerifySchema": {}, + "sqlite3CollapseDatabaseArray": {}, + "sqlite3ColumnDefault": {}, + "sqlite3ColumnIndex": {}, + "sqlite3ColumnType": {}, + "sqlite3ColumnsFromExprList": {}, + "sqlite3CommitInternalChanges": {}, + "sqlite3CompareAffinity": {}, + "sqlite3CompileOptions": {}, + "sqlite3CompleteInsertion": {}, + "sqlite3ComputeGeneratedColumns": {}, + "sqlite3Config": {}, + "sqlite3ConnectionBlocked": {}, + "sqlite3ConnectionClosed": {}, + "sqlite3ConnectionUnlocked": {}, + "sqlite3CorruptError": {}, + "sqlite3CreateColumnExpr": {}, + "sqlite3CreateForeignKey": {}, + "sqlite3CreateFunc": {}, + "sqlite3CreateIndex": {}, + "sqlite3CreateView": {}, + "sqlite3CteDelete": {}, + "sqlite3CteNew": {}, + "sqlite3CtypeMap": {}, + "sqlite3DbFree": {}, + "sqlite3DbFreeNN": {}, + "sqlite3DbIsNamed": {}, + "sqlite3DbMallocRaw": {}, + "sqlite3DbMallocRawNN": {}, + "sqlite3DbMallocSize": {}, + "sqlite3DbMallocZero": {}, + "sqlite3DbNameToBtree": {}, + "sqlite3DbRealloc": {}, + "sqlite3DbReallocOrFree": {}, + "sqlite3DbSpanDup": {}, + "sqlite3DbStrDup": {}, + "sqlite3DbStrNDup": {}, + "sqlite3DecOrHexToI64": {}, + "sqlite3DefaultMutex": {}, + "sqlite3DefaultRowEst": {}, + "sqlite3DeferForeignKey": {}, + "sqlite3DeleteColumnNames": {}, + "sqlite3DeleteFrom": {}, + "sqlite3DeleteIndexSamples": {}, + "sqlite3DeleteTable": {}, + "sqlite3DeleteTrigger": {}, + "sqlite3DeleteTriggerStep": {}, + "sqlite3Dequote": {}, + "sqlite3DequoteExpr": {}, + "sqlite3Detach": {}, + "sqlite3DropIndex": {}, + "sqlite3DropTable": {}, + "sqlite3DropTrigger": {}, + "sqlite3DropTriggerPtr": {}, + "sqlite3EndBenignMalloc": {}, + "sqlite3EndTable": {}, + "sqlite3EndTransaction": {}, + "sqlite3ErrStr": {}, + "sqlite3Error": {}, + "sqlite3ErrorClear": {}, + "sqlite3ErrorMsg": {}, + "sqlite3ErrorToParser": {}, + "sqlite3ErrorWithMsg": {}, + "sqlite3ExpandSubquery": {}, + "sqlite3ExpirePreparedStatements": {}, + "sqlite3Expr": {}, + "sqlite3ExprAddCollateString": {}, + "sqlite3ExprAddCollateToken": {}, + "sqlite3ExprAffinity": {}, + "sqlite3ExprAlloc": {}, + "sqlite3ExprAnalyzeAggList": {}, + "sqlite3ExprAnalyzeAggregates": {}, + "sqlite3ExprAnd": {}, + "sqlite3ExprAssignVarNumber": {}, + "sqlite3ExprAttachSubtrees": {}, + "sqlite3ExprCanBeNull": {}, + "sqlite3ExprCheckHeight": {}, + "sqlite3ExprCheckIN": {}, + "sqlite3ExprCode": {}, + "sqlite3ExprCodeCopy": {}, + "sqlite3ExprCodeExprList": {}, + "sqlite3ExprCodeFactorable": {}, + "sqlite3ExprCodeGeneratedColumn": {}, + "sqlite3ExprCodeGetColumn": {}, + "sqlite3ExprCodeGetColumnOfTable": {}, + "sqlite3ExprCodeLoadIndexColumn": {}, + "sqlite3ExprCodeMove": {}, + "sqlite3ExprCodeRunJustOnce": {}, + "sqlite3ExprCodeTarget": {}, + "sqlite3ExprCodeTemp": {}, + "sqlite3ExprColUsed": {}, + "sqlite3ExprCollSeq": {}, + "sqlite3ExprCollSeqMatch": {}, + "sqlite3ExprCompare": {}, + "sqlite3ExprCompareCollSeq": {}, + "sqlite3ExprCompareSkip": {}, + "sqlite3ExprCoveredByIndex": {}, + "sqlite3ExprDeferredDelete": {}, + "sqlite3ExprDelete": {}, + "sqlite3ExprDup": {}, + "sqlite3ExprForVectorField": {}, + "sqlite3ExprFunction": {}, + "sqlite3ExprFunctionUsable": {}, + "sqlite3ExprIdToTrueFalse": {}, + "sqlite3ExprIfFalse": {}, + "sqlite3ExprIfFalseDup": {}, + "sqlite3ExprIfTrue": {}, + "sqlite3ExprImpliesExpr": {}, + "sqlite3ExprImpliesNonNullRow": {}, + "sqlite3ExprIsConstant": {}, + "sqlite3ExprIsConstantNotJoin": {}, + "sqlite3ExprIsConstantOrFunction": {}, + "sqlite3ExprIsConstantOrGroupBy": {}, + "sqlite3ExprIsInteger": {}, + "sqlite3ExprIsTableConstant": {}, + "sqlite3ExprIsVector": {}, + "sqlite3ExprListAppend": {}, + "sqlite3ExprListAppendGrow": {}, + "sqlite3ExprListAppendNew": {}, + "sqlite3ExprListAppendVector": {}, + "sqlite3ExprListCheckLength": {}, + "sqlite3ExprListCompare": {}, + "sqlite3ExprListDelete": {}, + "sqlite3ExprListDup": {}, + "sqlite3ExprListFlags": {}, + "sqlite3ExprListSetName": {}, + "sqlite3ExprListSetSortOrder": {}, + "sqlite3ExprListSetSpan": {}, + "sqlite3ExprNNCollSeq": {}, + "sqlite3ExprNeedsNoAffinityChange": {}, + "sqlite3ExprReferencesUpdatedColumn": {}, + "sqlite3ExprSetHeightAndFlags": {}, + "sqlite3ExprSimplifiedAndOr": {}, + "sqlite3ExprSkipCollate": {}, + "sqlite3ExprSkipCollateAndLikely": {}, + "sqlite3ExprTruthValue": {}, + "sqlite3ExprUnmapAndDelete": {}, + "sqlite3ExprVectorSize": {}, + "sqlite3ExprWalkNoop": {}, + "sqlite3FaultSim": {}, + "sqlite3FindCollSeq": {}, + "sqlite3FindDb": {}, + "sqlite3FindDbName": {}, + "sqlite3FindFunction": {}, + "sqlite3FindInIndex": {}, + "sqlite3FindIndex": {}, + "sqlite3FindTable": {}, + "sqlite3FinishCoding": {}, + "sqlite3FinishTrigger": {}, + "sqlite3FixExpr": {}, + "sqlite3FixInit": {}, + "sqlite3FixSelect": {}, + "sqlite3FixSrcList": {}, + "sqlite3FixTriggerStep": {}, + "sqlite3FkActions": {}, + "sqlite3FkCheck": {}, + "sqlite3FkDelete": {}, + "sqlite3FkDropTable": {}, + "sqlite3FkLocateIndex": {}, + "sqlite3FkOldmask": {}, + "sqlite3FkReferences": {}, + "sqlite3FkRequired": {}, + "sqlite3FreeIndex": {}, + "sqlite3Fts5Init": {}, + "sqlite3FunctionSearch": {}, + "sqlite3FunctionUsesThisSrc": {}, + "sqlite3GenerateColumnNames": {}, + "sqlite3GenerateConstraintChecks": {}, + "sqlite3GenerateIndexKey": {}, + "sqlite3GenerateRowDelete": {}, + "sqlite3GenerateRowIndexDelete": {}, + "sqlite3Get4byte": {}, + "sqlite3GetBoolean": {}, + "sqlite3GetCollSeq": {}, + "sqlite3GetInt32": {}, + "sqlite3GetTempRange": {}, + "sqlite3GetTempReg": {}, + "sqlite3GetToken": {}, + "sqlite3GetUInt32": {}, + "sqlite3GetVTable": {}, + "sqlite3GetVarint": {}, + "sqlite3GetVarint32": {}, + "sqlite3GetVdbe": {}, + "sqlite3HaltConstraint": {}, + "sqlite3HasExplicitNulls": {}, + "sqlite3HashClear": {}, + "sqlite3HashFind": {}, + "sqlite3HashInit": {}, + "sqlite3HashInsert": {}, + "sqlite3HeaderSizeBtree": {}, + "sqlite3HeaderSizePcache": {}, + "sqlite3HeaderSizePcache1": {}, + "sqlite3HeapNearlyFull": {}, + "sqlite3HexToBlob": {}, + "sqlite3HexToInt": {}, + "sqlite3IdListAppend": {}, + "sqlite3IdListDelete": {}, + "sqlite3IdListDup": {}, + "sqlite3IdListIndex": {}, + "sqlite3IndexAffinityOk": {}, + "sqlite3IndexAffinityStr": {}, + "sqlite3IndexColumnAffinity": {}, + "sqlite3IndexHasDuplicateRootPage": {}, + "sqlite3IndexedByLookup": {}, + "sqlite3Init": {}, + "sqlite3InitCallback": {}, + "sqlite3InitOne": {}, + "sqlite3Insert": {}, + "sqlite3InsertBuiltinFuncs": {}, + "sqlite3Int64ToText": {}, + "sqlite3InvokeBusyHandler": {}, + "sqlite3IsBinary": {}, + "sqlite3IsIdChar": {}, + "sqlite3IsLikeFunction": {}, + "sqlite3IsNaN": {}, + "sqlite3IsReadOnly": {}, + "sqlite3IsRowid": {}, + "sqlite3IsShadowTableOf": {}, + "sqlite3IsTrueOrFalse": {}, + "sqlite3JoinType": {}, + "sqlite3JournalIsInMemory": {}, + "sqlite3JournalModename": {}, + "sqlite3JournalOpen": {}, + "sqlite3JournalSize": {}, + "sqlite3Json1Init": {}, + "sqlite3KeyInfoAlloc": {}, + "sqlite3KeyInfoFromExprList": {}, + "sqlite3KeyInfoOfIndex": {}, + "sqlite3KeyInfoRef": {}, + "sqlite3KeyInfoUnref": {}, + "sqlite3KeywordCode": {}, + "sqlite3LeaveMutexAndCloseZombie": {}, + "sqlite3LocateCollSeq": {}, + "sqlite3LocateTable": {}, + "sqlite3LocateTableItem": {}, + "sqlite3LogEst": {}, + "sqlite3LogEstAdd": {}, + "sqlite3LogEstFromDouble": {}, + "sqlite3LogEstToInt": {}, + "sqlite3LookasideUsed": {}, + "sqlite3MPrintf": {}, + "sqlite3Malloc": {}, + "sqlite3MallocEnd": {}, + "sqlite3MallocInit": {}, + "sqlite3MallocMutex": {}, + "sqlite3MallocSize": {}, + "sqlite3MallocZero": {}, + "sqlite3MatchEName": {}, + "sqlite3MaterializeView": {}, + "sqlite3MayAbort": {}, + "sqlite3MemCompare": {}, + "sqlite3MemJournalOpen": {}, + "sqlite3MemSetDefault": {}, + "sqlite3MemdbInit": {}, + "sqlite3MisuseError": {}, + "sqlite3MulInt64": {}, + "sqlite3MultiWrite": {}, + "sqlite3MutexAlloc": {}, + "sqlite3MutexEnd": {}, + "sqlite3MutexInit": {}, + "sqlite3NameFromToken": {}, + "sqlite3NestedParse": {}, + "sqlite3NoopDestructor": {}, + "sqlite3NoopMutex": {}, + "sqlite3NotPureFunc": {}, + "sqlite3OomClear": {}, + "sqlite3OomFault": {}, + "sqlite3OpcodeName": {}, + "sqlite3OpcodeProperty": {}, + "sqlite3OpenSchemaTable": {}, + "sqlite3OpenTable": {}, + "sqlite3OpenTableAndIndices": {}, + "sqlite3OpenTempDatabase": {}, + "sqlite3OsAccess": {}, + "sqlite3OsCheckReservedLock": {}, + "sqlite3OsClose": {}, + "sqlite3OsCloseFree": {}, + "sqlite3OsCurrentTimeInt64": {}, + "sqlite3OsDelete": {}, + "sqlite3OsDeviceCharacteristics": {}, + "sqlite3OsDlClose": {}, + "sqlite3OsDlError": {}, + "sqlite3OsDlOpen": {}, + "sqlite3OsDlSym": {}, + "sqlite3OsFetch": {}, + "sqlite3OsFileControl": {}, + "sqlite3OsFileControlHint": {}, + "sqlite3OsFileSize": {}, + "sqlite3OsFullPathname": {}, + "sqlite3OsGetLastError": {}, + "sqlite3OsInit": {}, + "sqlite3OsLock": {}, + "sqlite3OsOpen": {}, + "sqlite3OsOpenMalloc": {}, + "sqlite3OsRandomness": {}, + "sqlite3OsRead": {}, + "sqlite3OsSectorSize": {}, + "sqlite3OsShmBarrier": {}, + "sqlite3OsShmLock": {}, + "sqlite3OsShmMap": {}, + "sqlite3OsShmUnmap": {}, + "sqlite3OsSleep": {}, + "sqlite3OsSync": {}, + "sqlite3OsTruncate": {}, + "sqlite3OsUnfetch": {}, + "sqlite3OsUnlock": {}, + "sqlite3OsWrite": {}, + "sqlite3PCacheBufferSetup": {}, + "sqlite3PCachePercentDirty": {}, + "sqlite3PCacheSetDefault": {}, + "sqlite3PExpr": {}, + "sqlite3PExprAddSelect": {}, + "sqlite3PageFree": {}, + "sqlite3PageMalloc": {}, + "sqlite3PagerBackupPtr": {}, + "sqlite3PagerBegin": {}, + "sqlite3PagerCacheStat": {}, + "sqlite3PagerCheckpoint": {}, + "sqlite3PagerClearCache": {}, + "sqlite3PagerClose": {}, + "sqlite3PagerCloseWal": {}, + "sqlite3PagerCommitPhaseOne": {}, + "sqlite3PagerCommitPhaseTwo": {}, + "sqlite3PagerDataVersion": {}, + "sqlite3PagerDontWrite": {}, + "sqlite3PagerExclusiveLock": {}, + "sqlite3PagerFile": {}, + "sqlite3PagerFilename": {}, + "sqlite3PagerFlush": {}, + "sqlite3PagerGet": {}, + "sqlite3PagerGetData": {}, + "sqlite3PagerGetExtra": {}, + "sqlite3PagerGetJournalMode": {}, + "sqlite3PagerIsMemdb": {}, + "sqlite3PagerIsreadonly": {}, + "sqlite3PagerJournalSizeLimit": {}, + "sqlite3PagerJournalname": {}, + "sqlite3PagerJrnlFile": {}, + "sqlite3PagerLockingMode": {}, + "sqlite3PagerLookup": {}, + "sqlite3PagerMaxPageCount": {}, + "sqlite3PagerMemUsed": {}, + "sqlite3PagerMovepage": {}, + "sqlite3PagerOkToChangeJournalMode": {}, + "sqlite3PagerOpen": {}, + "sqlite3PagerOpenSavepoint": {}, + "sqlite3PagerOpenWal": {}, + "sqlite3PagerPageRefcount": {}, + "sqlite3PagerPagecount": {}, + "sqlite3PagerReadFileheader": {}, + "sqlite3PagerRef": {}, + "sqlite3PagerRekey": {}, + "sqlite3PagerRollback": {}, + "sqlite3PagerSavepoint": {}, + "sqlite3PagerSetBusyHandler": {}, + "sqlite3PagerSetCachesize": {}, + "sqlite3PagerSetFlags": {}, + "sqlite3PagerSetJournalMode": {}, + "sqlite3PagerSetMmapLimit": {}, + "sqlite3PagerSetPagesize": {}, + "sqlite3PagerSetSpillsize": {}, + "sqlite3PagerSharedLock": {}, + "sqlite3PagerShrink": {}, + "sqlite3PagerSnapshotCheck": {}, + "sqlite3PagerSnapshotGet": {}, + "sqlite3PagerSnapshotOpen": {}, + "sqlite3PagerSnapshotRecover": {}, + "sqlite3PagerSnapshotUnlock": {}, + "sqlite3PagerSync": {}, + "sqlite3PagerTempSpace": {}, + "sqlite3PagerTruncateImage": {}, + "sqlite3PagerUnref": {}, + "sqlite3PagerUnrefNotNull": {}, + "sqlite3PagerUnrefPageOne": {}, + "sqlite3PagerVfs": {}, + "sqlite3PagerWalCallback": {}, + "sqlite3PagerWalSupported": {}, + "sqlite3PagerWrite": {}, + "sqlite3ParseUri": {}, + "sqlite3Parser": {}, + "sqlite3ParserAddCleanup": {}, + "sqlite3ParserFallback": {}, + "sqlite3ParserFinalize": {}, + "sqlite3ParserInit": {}, + "sqlite3ParserReset": {}, + "sqlite3Pcache1Mutex": {}, + "sqlite3PcacheCleanAll": {}, + "sqlite3PcacheClear": {}, + "sqlite3PcacheClearSyncFlags": {}, + "sqlite3PcacheClearWritable": {}, + "sqlite3PcacheClose": {}, + "sqlite3PcacheDirtyList": {}, + "sqlite3PcacheDrop": {}, + "sqlite3PcacheFetch": {}, + "sqlite3PcacheFetchFinish": {}, + "sqlite3PcacheFetchStress": {}, + "sqlite3PcacheInitialize": {}, + "sqlite3PcacheMakeClean": {}, + "sqlite3PcacheMakeDirty": {}, + "sqlite3PcacheMove": {}, + "sqlite3PcacheOpen": {}, + "sqlite3PcachePageRefcount": {}, + "sqlite3PcachePagecount": {}, + "sqlite3PcacheRef": {}, + "sqlite3PcacheRefCount": {}, + "sqlite3PcacheRelease": {}, + "sqlite3PcacheReleaseMemory": {}, + "sqlite3PcacheSetCachesize": {}, + "sqlite3PcacheSetPageSize": {}, + "sqlite3PcacheSetSpillsize": {}, + "sqlite3PcacheShrink": {}, + "sqlite3PcacheShutdown": {}, + "sqlite3PcacheSize": {}, + "sqlite3PcacheTruncate": {}, + "sqlite3PendingByte": {}, + "sqlite3Pragma": {}, + "sqlite3PragmaVtabRegister": {}, + "sqlite3PrimaryKeyIndex": {}, + "sqlite3PrngRestoreState": {}, + "sqlite3PrngSaveState": {}, + "sqlite3Put4byte": {}, + "sqlite3PutVarint": {}, + "sqlite3ReadOnlyShadowTables": {}, + "sqlite3ReadSchema": {}, + "sqlite3RealSameAsInt": {}, + "sqlite3Realloc": {}, + "sqlite3RegisterBuiltinFunctions": {}, + "sqlite3RegisterDateTimeFunctions": {}, + "sqlite3RegisterLikeFunctions": {}, + "sqlite3RegisterPerConnectionBuiltinFunctions": {}, + "sqlite3Reindex": {}, + "sqlite3ReleaseTempRange": {}, + "sqlite3ReleaseTempReg": {}, + "sqlite3RenameExprUnmap": {}, + "sqlite3RenameExprlistUnmap": {}, + "sqlite3RenameTokenMap": {}, + "sqlite3RenameTokenRemap": {}, + "sqlite3ReportError": {}, + "sqlite3Reprepare": {}, + "sqlite3ResetAllSchemasOfConnection": {}, + "sqlite3ResetOneSchema": {}, + "sqlite3ResolveExprListNames": {}, + "sqlite3ResolveExprNames": {}, + "sqlite3ResolveOrderGroupBy": {}, + "sqlite3ResolvePartIdxLabel": {}, + "sqlite3ResolveSelectNames": {}, + "sqlite3ResolveSelfReference": {}, + "sqlite3ResultIntReal": {}, + "sqlite3ResultSetOfSelect": {}, + "sqlite3RollbackAll": {}, + "sqlite3RootPageMoved": {}, + "sqlite3RowSetClear": {}, + "sqlite3RowSetDelete": {}, + "sqlite3RowSetInit": {}, + "sqlite3RowSetInsert": {}, + "sqlite3RowSetNext": {}, + "sqlite3RowSetTest": {}, + "sqlite3RowidConstraint": {}, + "sqlite3RtreeInit": {}, + "sqlite3RunParser": {}, + "sqlite3RunVacuum": {}, + "sqlite3SafetyCheckOk": {}, + "sqlite3SafetyCheckSickOrOk": {}, + "sqlite3Savepoint": {}, + "sqlite3SchemaClear": {}, + "sqlite3SchemaGet": {}, + "sqlite3SchemaToIndex": {}, + "sqlite3SectorSize": {}, + "sqlite3Select": {}, + "sqlite3SelectAddColumnTypeAndCollation": {}, + "sqlite3SelectDelete": {}, + "sqlite3SelectDestInit": {}, + "sqlite3SelectDup": {}, + "sqlite3SelectExprHeight": {}, + "sqlite3SelectNew": {}, + "sqlite3SelectOpName": {}, + "sqlite3SelectPopWith": {}, + "sqlite3SelectPrep": {}, + "sqlite3SelectTrace": {}, + "sqlite3SelectWalkFail": {}, + "sqlite3SelectWalkNoop": {}, + "sqlite3SelectWrongNumTermsError": {}, + "sqlite3SetJoinExpr": {}, + "sqlite3SetString": {}, + "sqlite3SetTextEncoding": {}, + "sqlite3ShadowTableName": {}, + "sqlite3SrcListAppend": {}, + "sqlite3SrcListAppendFromTerm": {}, + "sqlite3SrcListAppendList": {}, + "sqlite3SrcListAssignCursors": {}, + "sqlite3SrcListDelete": {}, + "sqlite3SrcListDup": {}, + "sqlite3SrcListEnlarge": {}, + "sqlite3SrcListFuncArgs": {}, + "sqlite3SrcListIndexedBy": {}, + "sqlite3SrcListLookup": {}, + "sqlite3SrcListShiftJoinType": {}, + "sqlite3StartTable": {}, + "sqlite3Stat4Column": {}, + "sqlite3Stat4ProbeFree": {}, + "sqlite3Stat4ProbeSetValue": {}, + "sqlite3Stat4ValueFromExpr": {}, + "sqlite3StatusDown": {}, + "sqlite3StatusHighwater": {}, + "sqlite3StatusUp": {}, + "sqlite3StatusValue": {}, + "sqlite3StmtCurrentTime": {}, + "sqlite3StorageColumnToTable": {}, + "sqlite3StrAccumFinish": {}, + "sqlite3StrAccumInit": {}, + "sqlite3StrBINARY": {}, + "sqlite3StrICmp": {}, + "sqlite3StrIHash": {}, + "sqlite3Strlen30": {}, + "sqlite3SubInt64": {}, + "sqlite3SubselectError": {}, + "sqlite3SystemError": {}, + "sqlite3TableAffinity": {}, + "sqlite3TableColumnAffinity": {}, + "sqlite3TableColumnToIndex": {}, + "sqlite3TableColumnToStorage": {}, + "sqlite3TableLock": {}, + "sqlite3TempInMemory": {}, + "sqlite3ThreadCreate": {}, + "sqlite3ThreadJoin": {}, + "sqlite3TokenInit": {}, + "sqlite3TransferBindings": {}, + "sqlite3TriggerColmask": {}, + "sqlite3TriggerDeleteStep": {}, + "sqlite3TriggerInsertStep": {}, + "sqlite3TriggerList": {}, + "sqlite3TriggerSelectStep": {}, + "sqlite3TriggerStepSrc": {}, + "sqlite3TriggerUpdateStep": {}, + "sqlite3TriggersExist": {}, + "sqlite3TwoPartName": {}, + "sqlite3UniqueConstraint": {}, + "sqlite3UnlinkAndDeleteIndex": {}, + "sqlite3UnlinkAndDeleteTable": {}, + "sqlite3UnlinkAndDeleteTrigger": {}, + "sqlite3Update": {}, + "sqlite3UpperToLower": {}, + "sqlite3UpsertAnalyzeTarget": {}, + "sqlite3UpsertDelete": {}, + "sqlite3UpsertDoUpdate": {}, + "sqlite3UpsertDup": {}, + "sqlite3UpsertNew": {}, + "sqlite3UpsertNextIsIPK": {}, + "sqlite3UpsertOfIndex": {}, + "sqlite3Utf16ByteLen": {}, + "sqlite3Utf16to8": {}, + "sqlite3Utf8CharLen": {}, + "sqlite3Utf8Read": {}, + "sqlite3VListAdd": {}, + "sqlite3VListNameToNum": {}, + "sqlite3VListNumToName": {}, + "sqlite3VMPrintf": {}, + "sqlite3Vacuum": {}, + "sqlite3ValueApplyAffinity": {}, + "sqlite3ValueBytes": {}, + "sqlite3ValueFree": {}, + "sqlite3ValueFromExpr": {}, + "sqlite3ValueNew": {}, + "sqlite3ValueSetNull": {}, + "sqlite3ValueSetStr": {}, + "sqlite3ValueText": {}, + "sqlite3VarintLen": {}, + "sqlite3VdbeAddFunctionCall": {}, + "sqlite3VdbeAddOp0": {}, + "sqlite3VdbeAddOp1": {}, + "sqlite3VdbeAddOp2": {}, + "sqlite3VdbeAddOp3": {}, + "sqlite3VdbeAddOp4": {}, + "sqlite3VdbeAddOp4Dup8": {}, + "sqlite3VdbeAddOp4Int": {}, + "sqlite3VdbeAddOpList": {}, + "sqlite3VdbeAddParseSchemaOp": {}, + "sqlite3VdbeAllocUnpackedRecord": {}, + "sqlite3VdbeAppendP4": {}, + "sqlite3VdbeBooleanValue": {}, + "sqlite3VdbeChangeEncoding": {}, + "sqlite3VdbeChangeOpcode": {}, + "sqlite3VdbeChangeP1": {}, + "sqlite3VdbeChangeP2": {}, + "sqlite3VdbeChangeP3": {}, + "sqlite3VdbeChangeP4": {}, + "sqlite3VdbeChangeP5": {}, + "sqlite3VdbeChangeToNoop": {}, + "sqlite3VdbeCheckFk": {}, + "sqlite3VdbeClearObject": {}, + "sqlite3VdbeCloseStatement": {}, + "sqlite3VdbeCountChanges": {}, + "sqlite3VdbeCreate": {}, + "sqlite3VdbeCurrentAddr": {}, + "sqlite3VdbeCursorMoveto": {}, + "sqlite3VdbeCursorRestore": {}, + "sqlite3VdbeDb": {}, + "sqlite3VdbeDelete": {}, + "sqlite3VdbeDeleteAuxData": {}, + "sqlite3VdbeDeletePriorOpcode": {}, + "sqlite3VdbeDisplayP4": {}, + "sqlite3VdbeEndCoroutine": {}, + "sqlite3VdbeEnter": {}, + "sqlite3VdbeError": {}, + "sqlite3VdbeExec": {}, + "sqlite3VdbeExpandSql": {}, + "sqlite3VdbeExplain": {}, + "sqlite3VdbeExplainParent": {}, + "sqlite3VdbeExplainPop": {}, + "sqlite3VdbeFinalize": {}, + "sqlite3VdbeFindCompare": {}, + "sqlite3VdbeFinishMoveto": {}, + "sqlite3VdbeFrameDelete": {}, + "sqlite3VdbeFrameMemDel": {}, + "sqlite3VdbeFrameRestore": {}, + "sqlite3VdbeFreeCursor": {}, + "sqlite3VdbeGetBoundValue": {}, + "sqlite3VdbeGetOp": {}, + "sqlite3VdbeGoto": {}, + "sqlite3VdbeHalt": {}, + "sqlite3VdbeHasSubProgram": {}, + "sqlite3VdbeIdxKeyCompare": {}, + "sqlite3VdbeIdxRowid": {}, + "sqlite3VdbeIntValue": {}, + "sqlite3VdbeIntegerAffinity": {}, + "sqlite3VdbeJumpHere": {}, + "sqlite3VdbeJumpHereOrPopInst": {}, + "sqlite3VdbeLeave": {}, + "sqlite3VdbeLinkSubProgram": {}, + "sqlite3VdbeList": {}, + "sqlite3VdbeLoadString": {}, + "sqlite3VdbeMakeLabel": {}, + "sqlite3VdbeMakeReady": {}, + "sqlite3VdbeMemAggValue": {}, + "sqlite3VdbeMemCast": {}, + "sqlite3VdbeMemClearAndResize": {}, + "sqlite3VdbeMemCopy": {}, + "sqlite3VdbeMemExpandBlob": {}, + "sqlite3VdbeMemFinalize": {}, + "sqlite3VdbeMemFromBtree": {}, + "sqlite3VdbeMemFromBtreeZeroOffset": {}, + "sqlite3VdbeMemGrow": {}, + "sqlite3VdbeMemHandleBom": {}, + "sqlite3VdbeMemInit": {}, + "sqlite3VdbeMemIntegerify": {}, + "sqlite3VdbeMemMakeWriteable": {}, + "sqlite3VdbeMemMove": {}, + "sqlite3VdbeMemNulTerminate": {}, + "sqlite3VdbeMemNumerify": {}, + "sqlite3VdbeMemRealify": {}, + "sqlite3VdbeMemRelease": {}, + "sqlite3VdbeMemSetDouble": {}, + "sqlite3VdbeMemSetInt64": {}, + "sqlite3VdbeMemSetNull": {}, + "sqlite3VdbeMemSetPointer": {}, + "sqlite3VdbeMemSetRowSet": {}, + "sqlite3VdbeMemSetStr": {}, + "sqlite3VdbeMemSetZeroBlob": {}, + "sqlite3VdbeMemShallowCopy": {}, + "sqlite3VdbeMemStringify": {}, + "sqlite3VdbeMemTooBig": {}, + "sqlite3VdbeMemTranslate": {}, + "sqlite3VdbeMultiLoad": {}, + "sqlite3VdbeNextOpcode": {}, + "sqlite3VdbeOneByteSerialTypeLen": {}, + "sqlite3VdbeParameterIndex": {}, + "sqlite3VdbeParser": {}, + "sqlite3VdbePreUpdateHook": {}, + "sqlite3VdbePrepareFlags": {}, + "sqlite3VdbeRealValue": {}, + "sqlite3VdbeRecordCompare": {}, + "sqlite3VdbeRecordCompareWithSkip": {}, + "sqlite3VdbeRecordUnpack": {}, + "sqlite3VdbeReset": {}, + "sqlite3VdbeResetStepResult": {}, + "sqlite3VdbeResolveLabel": {}, + "sqlite3VdbeReusable": {}, + "sqlite3VdbeRewind": {}, + "sqlite3VdbeRunOnlyOnce": {}, + "sqlite3VdbeSerialGet": {}, + "sqlite3VdbeSerialPut": {}, + "sqlite3VdbeSerialTypeLen": {}, + "sqlite3VdbeSetChanges": {}, + "sqlite3VdbeSetColName": {}, + "sqlite3VdbeSetNumCols": {}, + "sqlite3VdbeSetP4KeyInfo": {}, + "sqlite3VdbeSetSql": {}, + "sqlite3VdbeSetVarmask": {}, + "sqlite3VdbeSorterClose": {}, + "sqlite3VdbeSorterCompare": {}, + "sqlite3VdbeSorterInit": {}, + "sqlite3VdbeSorterNext": {}, + "sqlite3VdbeSorterReset": {}, + "sqlite3VdbeSorterRewind": {}, + "sqlite3VdbeSorterRowkey": {}, + "sqlite3VdbeSorterWrite": {}, + "sqlite3VdbeSwap": {}, + "sqlite3VdbeTakeOpArray": {}, + "sqlite3VdbeTransferError": {}, + "sqlite3VdbeUsesBtree": {}, + "sqlite3VectorErrorMsg": {}, + "sqlite3VectorFieldSubexpr": {}, + "sqlite3ViewGetColumnNames": {}, + "sqlite3VtabArgExtend": {}, + "sqlite3VtabArgInit": {}, + "sqlite3VtabBegin": {}, + "sqlite3VtabBeginParse": {}, + "sqlite3VtabCallConnect": {}, + "sqlite3VtabCallCreate": {}, + "sqlite3VtabCallDestroy": {}, + "sqlite3VtabClear": {}, + "sqlite3VtabCommit": {}, + "sqlite3VtabCreateModule": {}, + "sqlite3VtabDisconnect": {}, + "sqlite3VtabEponymousTableClear": {}, + "sqlite3VtabEponymousTableInit": {}, + "sqlite3VtabFinishParse": {}, + "sqlite3VtabImportErrmsg": {}, + "sqlite3VtabLock": {}, + "sqlite3VtabMakeWritable": {}, + "sqlite3VtabModuleUnref": {}, + "sqlite3VtabOverloadFunction": {}, + "sqlite3VtabRollback": {}, + "sqlite3VtabSavepoint": {}, + "sqlite3VtabSync": {}, + "sqlite3VtabUnlock": {}, + "sqlite3VtabUnlockList": {}, + "sqlite3WalBeginReadTransaction": {}, + "sqlite3WalBeginWriteTransaction": {}, + "sqlite3WalCallback": {}, + "sqlite3WalCheckpoint": {}, + "sqlite3WalClose": {}, + "sqlite3WalDbsize": {}, + "sqlite3WalDefaultHook": {}, + "sqlite3WalEndReadTransaction": {}, + "sqlite3WalEndWriteTransaction": {}, + "sqlite3WalExclusiveMode": {}, + "sqlite3WalFile": {}, + "sqlite3WalFindFrame": {}, + "sqlite3WalFrames": {}, + "sqlite3WalHeapMemory": {}, + "sqlite3WalLimit": {}, + "sqlite3WalOpen": {}, + "sqlite3WalReadFrame": {}, + "sqlite3WalSavepoint": {}, + "sqlite3WalSavepointUndo": {}, + "sqlite3WalSnapshotCheck": {}, + "sqlite3WalSnapshotGet": {}, + "sqlite3WalSnapshotOpen": {}, + "sqlite3WalSnapshotRecover": {}, + "sqlite3WalSnapshotUnlock": {}, + "sqlite3WalUndo": {}, + "sqlite3WalkExpr": {}, + "sqlite3WalkExprList": {}, + "sqlite3WalkSelect": {}, + "sqlite3WalkSelectExpr": {}, + "sqlite3WalkSelectFrom": {}, + "sqlite3WalkWinDefnDummyCallback": {}, + "sqlite3WalkerDepthDecrease": {}, + "sqlite3WalkerDepthIncrease": {}, + "sqlite3WhereBegin": {}, + "sqlite3WhereBreakLabel": {}, + "sqlite3WhereClauseClear": {}, + "sqlite3WhereClauseInit": {}, + "sqlite3WhereCodeOneLoopStart": {}, + "sqlite3WhereContinueLabel": {}, + "sqlite3WhereEnd": {}, + "sqlite3WhereExplainOneScan": {}, + "sqlite3WhereExprAnalyze": {}, + "sqlite3WhereExprListUsage": {}, + "sqlite3WhereExprUsage": {}, + "sqlite3WhereExprUsageNN": {}, + "sqlite3WhereFindTerm": {}, + "sqlite3WhereGetMask": {}, + "sqlite3WhereIsDistinct": {}, + "sqlite3WhereIsOrdered": {}, + "sqlite3WhereIsSorted": {}, + "sqlite3WhereMinMaxOptEarlyOut": {}, + "sqlite3WhereOkOnePass": {}, + "sqlite3WhereOrderByLimitOptLabel": {}, + "sqlite3WhereOutputRowCount": {}, + "sqlite3WhereSplit": {}, + "sqlite3WhereTabFuncArgs": {}, + "sqlite3WhereTrace": {}, + "sqlite3WhereUsesDeferredSeek": {}, + "sqlite3WindowAlloc": {}, + "sqlite3WindowAssemble": {}, + "sqlite3WindowAttach": {}, + "sqlite3WindowChain": {}, + "sqlite3WindowCodeInit": {}, + "sqlite3WindowCodeStep": {}, + "sqlite3WindowCompare": {}, + "sqlite3WindowDelete": {}, + "sqlite3WindowDup": {}, + "sqlite3WindowFunctions": {}, + "sqlite3WindowLink": {}, + "sqlite3WindowListDelete": {}, + "sqlite3WindowListDup": {}, + "sqlite3WindowRewrite": {}, + "sqlite3WindowUnlinkFromSelect": {}, + "sqlite3WindowUpdate": {}, + "sqlite3WithAdd": {}, + "sqlite3WithDelete": {}, + "sqlite3WithDup": {}, + "sqlite3WithPush": {}, + "sqlite3WritableSchema": {}, + "sqlite3_aggregate_context": {}, + "sqlite3_aggregate_count": {}, + "sqlite3_auto_extension": {}, + "sqlite3_backup_finish": {}, + "sqlite3_backup_init": {}, + "sqlite3_backup_pagecount": {}, + "sqlite3_backup_remaining": {}, + "sqlite3_backup_step": {}, + "sqlite3_bind_blob": {}, + "sqlite3_bind_blob64": {}, + "sqlite3_bind_double": {}, + "sqlite3_bind_int": {}, + "sqlite3_bind_int64": {}, + "sqlite3_bind_null": {}, + "sqlite3_bind_parameter_count": {}, + "sqlite3_bind_parameter_index": {}, + "sqlite3_bind_parameter_name": {}, + "sqlite3_bind_pointer": {}, + "sqlite3_bind_text": {}, + "sqlite3_bind_text16": {}, + "sqlite3_bind_text64": {}, + "sqlite3_bind_value": {}, + "sqlite3_bind_zeroblob": {}, + "sqlite3_bind_zeroblob64": {}, + "sqlite3_blob_bytes": {}, + "sqlite3_blob_close": {}, + "sqlite3_blob_open": {}, + "sqlite3_blob_read": {}, + "sqlite3_blob_reopen": {}, + "sqlite3_blob_write": {}, + "sqlite3_busy_handler": {}, + "sqlite3_busy_timeout": {}, + "sqlite3_cancel_auto_extension": {}, + "sqlite3_changes": {}, + "sqlite3_clear_bindings": {}, + "sqlite3_close": {}, + "sqlite3_close_v2": {}, + "sqlite3_collation_needed": {}, + "sqlite3_collation_needed16": {}, + "sqlite3_column_blob": {}, + "sqlite3_column_bytes": {}, + "sqlite3_column_bytes16": {}, + "sqlite3_column_count": {}, + "sqlite3_column_database_name": {}, + "sqlite3_column_database_name16": {}, + "sqlite3_column_decltype": {}, + "sqlite3_column_decltype16": {}, + "sqlite3_column_double": {}, + "sqlite3_column_int": {}, + "sqlite3_column_int64": {}, + "sqlite3_column_name": {}, + "sqlite3_column_name16": {}, + "sqlite3_column_origin_name": {}, + "sqlite3_column_origin_name16": {}, + "sqlite3_column_table_name": {}, + "sqlite3_column_table_name16": {}, + "sqlite3_column_text": {}, + "sqlite3_column_text16": {}, + "sqlite3_column_type": {}, + "sqlite3_column_value": {}, + "sqlite3_commit_hook": {}, + "sqlite3_compileoption_get": {}, + "sqlite3_compileoption_used": {}, + "sqlite3_complete": {}, + "sqlite3_complete16": {}, + "sqlite3_config": {}, + "sqlite3_context_db_handle": {}, + "sqlite3_create_collation": {}, + "sqlite3_create_collation16": {}, + "sqlite3_create_collation_v2": {}, + "sqlite3_create_filename": {}, + "sqlite3_create_function": {}, + "sqlite3_create_function16": {}, + "sqlite3_create_function_v2": {}, + "sqlite3_create_module": {}, + "sqlite3_create_module_v2": {}, + "sqlite3_create_window_function": {}, + "sqlite3_data_count": {}, + "sqlite3_data_directory": {}, + "sqlite3_database_file_object": {}, + "sqlite3_db_cacheflush": {}, + "sqlite3_db_config": {}, + "sqlite3_db_filename": {}, + "sqlite3_db_handle": {}, + "sqlite3_db_mutex": {}, + "sqlite3_db_readonly": {}, + "sqlite3_db_release_memory": {}, + "sqlite3_db_status": {}, + "sqlite3_declare_vtab": {}, + "sqlite3_deserialize": {}, + "sqlite3_drop_modules": {}, + "sqlite3_enable_load_extension": {}, + "sqlite3_enable_shared_cache": {}, + "sqlite3_errcode": {}, + "sqlite3_errmsg": {}, + "sqlite3_errmsg16": {}, + "sqlite3_errstr": {}, + "sqlite3_exec": {}, + "sqlite3_expanded_sql": {}, + "sqlite3_expired": {}, + "sqlite3_extended_errcode": {}, + "sqlite3_extended_result_codes": {}, + "sqlite3_file_control": {}, + "sqlite3_filename_database": {}, + "sqlite3_filename_journal": {}, + "sqlite3_filename_wal": {}, + "sqlite3_finalize": {}, + "sqlite3_free": {}, + "sqlite3_free_filename": {}, + "sqlite3_free_table": {}, + "sqlite3_get_autocommit": {}, + "sqlite3_get_auxdata": {}, + "sqlite3_get_table": {}, + "sqlite3_global_recover": {}, + "sqlite3_hard_heap_limit64": {}, + "sqlite3_initialize": {}, + "sqlite3_interrupt": {}, + "sqlite3_keyword_check": {}, + "sqlite3_keyword_count": {}, + "sqlite3_keyword_name": {}, + "sqlite3_last_insert_rowid": {}, + "sqlite3_libversion": {}, + "sqlite3_libversion_number": {}, + "sqlite3_limit": {}, + "sqlite3_load_extension": {}, + "sqlite3_log": {}, + "sqlite3_malloc": {}, + "sqlite3_malloc64": {}, + "sqlite3_memory_alarm": {}, + "sqlite3_memory_highwater": {}, + "sqlite3_memory_used": {}, + "sqlite3_mprintf": {}, + "sqlite3_msize": {}, + "sqlite3_mutex_alloc": {}, + "sqlite3_mutex_enter": {}, + "sqlite3_mutex_free": {}, + "sqlite3_mutex_leave": {}, + "sqlite3_mutex_try": {}, + "sqlite3_next_stmt": {}, + "sqlite3_open": {}, + "sqlite3_open16": {}, + "sqlite3_open_v2": {}, + "sqlite3_os_end": {}, + "sqlite3_os_init": {}, + "sqlite3_overload_function": {}, + "sqlite3_prepare": {}, + "sqlite3_prepare16": {}, + "sqlite3_prepare16_v2": {}, + "sqlite3_prepare16_v3": {}, + "sqlite3_prepare_v2": {}, + "sqlite3_prepare_v3": {}, + "sqlite3_preupdate_blobwrite": {}, + "sqlite3_preupdate_count": {}, + "sqlite3_preupdate_depth": {}, + "sqlite3_preupdate_hook": {}, + "sqlite3_preupdate_new": {}, + "sqlite3_preupdate_old": {}, + "sqlite3_profile": {}, + "sqlite3_progress_handler": {}, + "sqlite3_randomness": {}, + "sqlite3_realloc": {}, + "sqlite3_realloc64": {}, + "sqlite3_release_memory": {}, + "sqlite3_reset": {}, + "sqlite3_reset_auto_extension": {}, + "sqlite3_result_blob": {}, + "sqlite3_result_blob64": {}, + "sqlite3_result_double": {}, + "sqlite3_result_error": {}, + "sqlite3_result_error16": {}, + "sqlite3_result_error_code": {}, + "sqlite3_result_error_nomem": {}, + "sqlite3_result_error_toobig": {}, + "sqlite3_result_int": {}, + "sqlite3_result_int64": {}, + "sqlite3_result_null": {}, + "sqlite3_result_pointer": {}, + "sqlite3_result_subtype": {}, + "sqlite3_result_text": {}, + "sqlite3_result_text16": {}, + "sqlite3_result_text16be": {}, + "sqlite3_result_text16le": {}, + "sqlite3_result_text64": {}, + "sqlite3_result_value": {}, + "sqlite3_result_zeroblob": {}, + "sqlite3_result_zeroblob64": {}, + "sqlite3_rollback_hook": {}, + "sqlite3_rtree_geometry_callback": {}, + "sqlite3_rtree_query_callback": {}, + "sqlite3_serialize": {}, + "sqlite3_set_authorizer": {}, + "sqlite3_set_auxdata": {}, + "sqlite3_set_last_insert_rowid": {}, + "sqlite3_shutdown": {}, + "sqlite3_sleep": {}, + "sqlite3_snapshot_cmp": {}, + "sqlite3_snapshot_free": {}, + "sqlite3_snapshot_get": {}, + "sqlite3_snapshot_open": {}, + "sqlite3_snapshot_recover": {}, + "sqlite3_snprintf": {}, + "sqlite3_soft_heap_limit": {}, + "sqlite3_soft_heap_limit64": {}, + "sqlite3_sourceid": {}, + "sqlite3_sql": {}, + "sqlite3_status": {}, + "sqlite3_status64": {}, + "sqlite3_step": {}, + "sqlite3_stmt_busy": {}, + "sqlite3_stmt_isexplain": {}, + "sqlite3_stmt_readonly": {}, + "sqlite3_stmt_status": {}, + "sqlite3_str_append": {}, + "sqlite3_str_appendall": {}, + "sqlite3_str_appendchar": {}, + "sqlite3_str_appendf": {}, + "sqlite3_str_errcode": {}, + "sqlite3_str_finish": {}, + "sqlite3_str_length": {}, + "sqlite3_str_new": {}, + "sqlite3_str_reset": {}, + "sqlite3_str_value": {}, + "sqlite3_str_vappendf": {}, + "sqlite3_strglob": {}, + "sqlite3_stricmp": {}, + "sqlite3_strlike": {}, + "sqlite3_strnicmp": {}, + "sqlite3_system_errno": {}, + "sqlite3_table_column_metadata": {}, + "sqlite3_temp_directory": {}, + "sqlite3_test_control": {}, + "sqlite3_thread_cleanup": {}, + "sqlite3_threadsafe": {}, + "sqlite3_total_changes": {}, + "sqlite3_trace": {}, + "sqlite3_trace_v2": {}, + "sqlite3_transfer_bindings": {}, + "sqlite3_txn_state": {}, + "sqlite3_unlock_notify": {}, + "sqlite3_update_hook": {}, + "sqlite3_uri_boolean": {}, + "sqlite3_uri_int64": {}, + "sqlite3_uri_key": {}, + "sqlite3_uri_parameter": {}, + "sqlite3_user_data": {}, + "sqlite3_value_blob": {}, + "sqlite3_value_bytes": {}, + "sqlite3_value_bytes16": {}, + "sqlite3_value_double": {}, + "sqlite3_value_dup": {}, + "sqlite3_value_free": {}, + "sqlite3_value_frombind": {}, + "sqlite3_value_int": {}, + "sqlite3_value_int64": {}, + "sqlite3_value_nochange": {}, + "sqlite3_value_numeric_type": {}, + "sqlite3_value_pointer": {}, + "sqlite3_value_subtype": {}, + "sqlite3_value_text": {}, + "sqlite3_value_text16": {}, + "sqlite3_value_text16be": {}, + "sqlite3_value_text16le": {}, + "sqlite3_value_type": {}, + "sqlite3_version": {}, + "sqlite3_vfs_find": {}, + "sqlite3_vfs_register": {}, + "sqlite3_vfs_unregister": {}, + "sqlite3_vmprintf": {}, + "sqlite3_vsnprintf": {}, + "sqlite3_vtab_collation": {}, + "sqlite3_vtab_config": {}, + "sqlite3_vtab_nochange": {}, + "sqlite3_vtab_on_conflict": {}, + "sqlite3_wal_autocheckpoint": {}, + "sqlite3_wal_checkpoint": {}, + "sqlite3_wal_checkpoint_v2": {}, + "sqlite3_wal_hook": {}, + "sqlite3aEQb": {}, + "sqlite3aGTb": {}, + "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, + "sqlite3rbu_bp_progress": {}, + "sqlite3rbu_close": {}, + "sqlite3rbu_create_vfs": {}, + "sqlite3rbu_db": {}, + "sqlite3rbu_destroy_vfs": {}, + "sqlite3rbu_open": {}, + "sqlite3rbu_progress": {}, + "sqlite3rbu_savestate": {}, + "sqlite3rbu_state": {}, + "sqlite3rbu_step": {}, + "sqlite3rbu_temp_size": {}, + "sqlite3rbu_temp_size_limit": {}, + "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, +} diff --git a/vendor/modernc.org/sqlite/lib/capi_linux_386.go b/vendor/modernc.org/sqlite/lib/capi_linux_386.go index 1a9201d9..81ca364e 100644 --- a/vendor/modernc.org/sqlite/lib/capi_linux_386.go +++ b/vendor/modernc.org/sqlite/lib/capi_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_386.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_386.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1242,6 +1242,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1255,4 +1281,25 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, } diff --git a/vendor/modernc.org/sqlite/lib/capi_linux_amd64.go b/vendor/modernc.org/sqlite/lib/capi_linux_amd64.go index ce14b2ee..75f3c8eb 100644 --- a/vendor/modernc.org/sqlite/lib/capi_linux_amd64.go +++ b/vendor/modernc.org/sqlite/lib/capi_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1243,6 +1243,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1256,4 +1282,25 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, } diff --git a/vendor/modernc.org/sqlite/lib/capi_linux_arm.go b/vendor/modernc.org/sqlite/lib/capi_linux_arm.go index d6fdc473..8d4ff898 100644 --- a/vendor/modernc.org/sqlite/lib/capi_linux_arm.go +++ b/vendor/modernc.org/sqlite/lib/capi_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_arm.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_arm.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1242,6 +1242,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1255,4 +1281,25 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, } diff --git a/vendor/modernc.org/sqlite/lib/capi_linux_arm64.go b/vendor/modernc.org/sqlite/lib/capi_linux_arm64.go index b1222eae..c9050bf9 100644 --- a/vendor/modernc.org/sqlite/lib/capi_linux_arm64.go +++ b/vendor/modernc.org/sqlite/lib/capi_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_linux_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1242,6 +1242,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1255,4 +1281,25 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, } diff --git a/vendor/modernc.org/sqlite/lib/capi_windows_amd64.go b/vendor/modernc.org/sqlite/lib/capi_windows_amd64.go index f2c73b38..0ff55870 100644 --- a/vendor/modernc.org/sqlite/lib/capi_windows_amd64.go +++ b/vendor/modernc.org/sqlite/lib/capi_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_windows_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_WIN=1 -D_MSC_VER=1900', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines -export-enums -export-externs X -export-fields F -export-typedefs -pkgname sqlite3 -o lib/sqlite_windows_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_WIN=1 -D_MSC_VER=1900', DO NOT EDIT. package sqlite3 @@ -1259,6 +1259,32 @@ var CAPI = map[string]struct{}{ "sqlite3aEQb": {}, "sqlite3aGTb": {}, "sqlite3aLTb": {}, + "sqlite3changegroup_add": {}, + "sqlite3changegroup_add_strm": {}, + "sqlite3changegroup_delete": {}, + "sqlite3changegroup_new": {}, + "sqlite3changegroup_output": {}, + "sqlite3changegroup_output_strm": {}, + "sqlite3changeset_apply": {}, + "sqlite3changeset_apply_strm": {}, + "sqlite3changeset_apply_v2": {}, + "sqlite3changeset_apply_v2_strm": {}, + "sqlite3changeset_concat": {}, + "sqlite3changeset_concat_strm": {}, + "sqlite3changeset_conflict": {}, + "sqlite3changeset_finalize": {}, + "sqlite3changeset_fk_conflicts": {}, + "sqlite3changeset_invert": {}, + "sqlite3changeset_invert_strm": {}, + "sqlite3changeset_new": {}, + "sqlite3changeset_next": {}, + "sqlite3changeset_old": {}, + "sqlite3changeset_op": {}, + "sqlite3changeset_pk": {}, + "sqlite3changeset_start": {}, + "sqlite3changeset_start_strm": {}, + "sqlite3changeset_start_v2": {}, + "sqlite3changeset_start_v2_strm": {}, "sqlite3rbu_bp_progress": {}, "sqlite3rbu_close": {}, "sqlite3rbu_create_vfs": {}, @@ -1272,6 +1298,27 @@ var CAPI = map[string]struct{}{ "sqlite3rbu_temp_size": {}, "sqlite3rbu_temp_size_limit": {}, "sqlite3rbu_vacuum": {}, + "sqlite3rebaser_configure": {}, + "sqlite3rebaser_create": {}, + "sqlite3rebaser_delete": {}, + "sqlite3rebaser_rebase": {}, + "sqlite3rebaser_rebase_strm": {}, + "sqlite3session_attach": {}, + "sqlite3session_changeset": {}, + "sqlite3session_changeset_size": {}, + "sqlite3session_changeset_strm": {}, + "sqlite3session_config": {}, + "sqlite3session_create": {}, + "sqlite3session_delete": {}, + "sqlite3session_diff": {}, + "sqlite3session_enable": {}, + "sqlite3session_indirect": {}, + "sqlite3session_isempty": {}, + "sqlite3session_memory_used": {}, + "sqlite3session_object_config": {}, + "sqlite3session_patchset": {}, + "sqlite3session_patchset_strm": {}, + "sqlite3session_table_filter": {}, "timezone": {}, "tzname": {}, } diff --git a/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go index 35043601..e54a296c 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_darwin_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_darwin_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_darwin_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. package sqlite3 @@ -1806,6 +1806,9 @@ const ( SEGV_MAPERR = 1 SEGV_NOOP = 0 SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 SF_APPEND = 0x00040000 SF_ARCHIVED = 0x00010000 SF_Aggregate = 0x0000008 @@ -1956,6 +1959,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -2112,6 +2126,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -2479,6 +2494,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -4297,7 +4314,7 @@ type X__float128 = float64 /* :47:21 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [18]uintptr{ +var sqlite3azCompileOpt = [19]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=gcc-11...." */ @@ -4310,14 +4327,15 @@ var sqlite3azCompileOpt = [18]uintptr{ ts + 131, /* "ENABLE_PREUPDATE..." */ ts + 153, /* "ENABLE_RBU" */ ts + 164, /* "ENABLE_RTREE" */ - ts + 177, /* "ENABLE_SNAPSHOT" */ - ts + 193, /* "ENABLE_STAT4" */ - ts + 206, /* "ENABLE_UNLOCK_NO..." */ - ts + 227, /* "LIKE_DOESNT_MATC..." */ - ts + 251, /* "MUTEX_NOOP" */ - ts + 262, /* "SOUNDEX" */ - ts + 270, /* "SYSTEM_MALLOC" */ - ts + 284, /* "THREADSAFE=1" */ + ts + 177, /* "ENABLE_SESSION" */ + ts + 192, /* "ENABLE_SNAPSHOT" */ + ts + 208, /* "ENABLE_STAT4" */ + ts + 221, /* "ENABLE_UNLOCK_NO..." */ + ts + 242, /* "LIKE_DOESNT_MATC..." */ + ts + 266, /* "MUTEX_NOOP" */ + ts + 277, /* "SOUNDEX" */ + ts + 285, /* "SYSTEM_MALLOC" */ + ts + 299, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -4633,7 +4651,7 @@ type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 297 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 312 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -7184,6 +7202,495 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + _ [4]byte + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + _ [4]byte + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -7234,10 +7741,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -16894,7 +17400,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 304 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 319 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -18097,7 +18603,7 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+311 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+326 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 @@ -18134,13 +18640,13 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+319 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+334 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+327 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+342 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -18259,7 +18765,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+331 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+346 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -18340,7 +18846,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+343 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+358 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -18522,7 +19028,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+56 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 104 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) if osLocaltime(tls, bp+104 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+347 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+362 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -18557,12 +19063,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 370 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 377 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 384 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 389 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 393 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 399 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 385 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 392 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 399 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 404 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 408 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 414 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -18601,7 +19107,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+404 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+419 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -18615,7 +19121,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+414 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+429 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -18624,7 +19130,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+424 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+439 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -18649,7 +19155,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+428 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+443 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -18674,7 +19180,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+437 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+452 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -18688,14 +19194,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+393 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+408 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+399 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+414 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+389 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+404 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -18916,7 +19422,7 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // var zBuf [100]int8 at bp+96, 100 computeYMD_HMS(tls, bp+48 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+447, /* "%04d-%02d-%02d %..." */ + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+462, /* "%04d-%02d-%02d %..." */ libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } @@ -18935,7 +19441,7 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeHMS(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+477 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+492 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -18953,7 +19459,7 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeYMD(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+492 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+507 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -19080,7 +19586,7 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (uint64(2)) break fallthrough @@ -19090,14 +19596,14 @@ __3: if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+512 /* "%06.3f" */, libc.VaList(bp+8, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+527 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (uint64(2)) break fallthrough @@ -19115,10 +19621,10 @@ __3: if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (uint64(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+519 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+534 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (uint64(3)) } break @@ -19127,19 +19633,19 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+524 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+539 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (uint64(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (uint64(2)) break fallthrough @@ -19153,7 +19659,7 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (uint64(2)) break fallthrough @@ -19166,7 +19672,7 @@ __3: fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+530 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+545 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -19223,14 +19729,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 535 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 545 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 550 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 555 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 564 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 573 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 586 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 604 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 550 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 560 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 565 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 570 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 579 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 588 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 601 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 619 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -19807,7 +20313,7 @@ func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:1 p += 8 } else { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+617 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+632 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -19858,7 +20364,7 @@ func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* } else { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+655, /* "failed memory re..." */ + ts+670, /* "failed memory re..." */ libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) } return p @@ -21043,8 +21549,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 691 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 724 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 706 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 739 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -21298,7 +21804,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+731 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+746 /* "%" */, 1) goto __5 __11: ; @@ -21881,7 +22387,7 @@ __125: if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 733 /* "NaN" */ + bufpt = ts + 748 /* "NaN" */ length = 3 goto __58 __127: @@ -21941,7 +22447,7 @@ __138: } bufpt = bp + 8 /* &buf[0] */ *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix - libc.X__builtin___memcpy_chk(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+737 /* "Inf" */, uint64(4), libc.X__builtin_object_size(tls, (bp+8 /* &buf[0] */ +uintptr((libc.Bool32(int32(prefix) != 0)))), 0)) + libc.X__builtin___memcpy_chk(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+752 /* "Inf" */, uint64(4), libc.X__builtin_object_size(tls, (bp+8 /* &buf[0] */ +uintptr((libc.Bool32(int32(prefix) != 0)))), 0)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: @@ -22298,7 +22804,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 741 /* "" */ + bufpt = ts + 756 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -22427,9 +22933,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 742 /* "NULL" */ + return ts + 757 /* "NULL" */ } - return ts + 747 /* "(NULL)" */ + return ts + 762 /* "(NULL)" */ }() __220: ; @@ -22564,7 +23070,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+754 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+769 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -22579,7 +23085,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+756 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+771 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -22642,7 +23148,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 768 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 783 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -24754,7 +25260,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 777 /* "9223372036854775..." */ + var pow63 uintptr = ts + 792 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -25404,7 +25910,7 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+796, /* "API call with %s..." */ + ts+811, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -25423,14 +25929,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+742 /* "NULL" */) + logBadConnection(tls, ts+757 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+841 /* "unopened" */) + logBadConnection(tls, ts+856 /* "unopened" */) } return 0 } else { @@ -25444,7 +25950,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+850 /* "invalid" */) + logBadConnection(tls, ts+865 /* "invalid" */) return 0 } else { return 1 @@ -25972,186 +26478,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 858, /* "Savepoint" */ - /* 1 */ ts + 868, /* "AutoCommit" */ - /* 2 */ ts + 879, /* "Transaction" */ - /* 3 */ ts + 891, /* "SorterNext" */ - /* 4 */ ts + 902, /* "Prev" */ - /* 5 */ ts + 907, /* "Next" */ - /* 6 */ ts + 912, /* "Checkpoint" */ - /* 7 */ ts + 923, /* "JournalMode" */ - /* 8 */ ts + 935, /* "Vacuum" */ - /* 9 */ ts + 942, /* "VFilter" */ - /* 10 */ ts + 950, /* "VUpdate" */ - /* 11 */ ts + 958, /* "Goto" */ - /* 12 */ ts + 963, /* "Gosub" */ - /* 13 */ ts + 969, /* "InitCoroutine" */ - /* 14 */ ts + 983, /* "Yield" */ - /* 15 */ ts + 989, /* "MustBeInt" */ - /* 16 */ ts + 999, /* "Jump" */ - /* 17 */ ts + 1004, /* "Once" */ - /* 18 */ ts + 1009, /* "If" */ - /* 19 */ ts + 1012, /* "Not" */ - /* 20 */ ts + 1016, /* "IfNot" */ - /* 21 */ ts + 1022, /* "IfNullRow" */ - /* 22 */ ts + 1032, /* "SeekLT" */ - /* 23 */ ts + 1039, /* "SeekLE" */ - /* 24 */ ts + 1046, /* "SeekGE" */ - /* 25 */ ts + 1053, /* "SeekGT" */ - /* 26 */ ts + 1060, /* "IfNotOpen" */ - /* 27 */ ts + 1070, /* "IfNoHope" */ - /* 28 */ ts + 1079, /* "NoConflict" */ - /* 29 */ ts + 1090, /* "NotFound" */ - /* 30 */ ts + 1099, /* "Found" */ - /* 31 */ ts + 1105, /* "SeekRowid" */ - /* 32 */ ts + 1115, /* "NotExists" */ - /* 33 */ ts + 1125, /* "Last" */ - /* 34 */ ts + 1130, /* "IfSmaller" */ - /* 35 */ ts + 1140, /* "SorterSort" */ - /* 36 */ ts + 1151, /* "Sort" */ - /* 37 */ ts + 1156, /* "Rewind" */ - /* 38 */ ts + 1163, /* "IdxLE" */ - /* 39 */ ts + 1169, /* "IdxGT" */ - /* 40 */ ts + 1175, /* "IdxLT" */ - /* 41 */ ts + 1181, /* "IdxGE" */ - /* 42 */ ts + 1187, /* "RowSetRead" */ - /* 43 */ ts + 1198, /* "Or" */ - /* 44 */ ts + 1201, /* "And" */ - /* 45 */ ts + 1205, /* "RowSetTest" */ - /* 46 */ ts + 1216, /* "Program" */ - /* 47 */ ts + 1224, /* "FkIfZero" */ - /* 48 */ ts + 1233, /* "IfPos" */ - /* 49 */ ts + 1239, /* "IfNotZero" */ - /* 50 */ ts + 1249, /* "IsNull" */ - /* 51 */ ts + 1256, /* "NotNull" */ - /* 52 */ ts + 1264, /* "Ne" */ - /* 53 */ ts + 1267, /* "Eq" */ - /* 54 */ ts + 1270, /* "Gt" */ - /* 55 */ ts + 1273, /* "Le" */ - /* 56 */ ts + 1276, /* "Lt" */ - /* 57 */ ts + 1279, /* "Ge" */ - /* 58 */ ts + 1282, /* "ElseEq" */ - /* 59 */ ts + 1289, /* "DecrJumpZero" */ - /* 60 */ ts + 1302, /* "IncrVacuum" */ - /* 61 */ ts + 1313, /* "VNext" */ - /* 62 */ ts + 1319, /* "Init" */ - /* 63 */ ts + 1324, /* "PureFunc" */ - /* 64 */ ts + 1333, /* "Function" */ - /* 65 */ ts + 1342, /* "Return" */ - /* 66 */ ts + 1349, /* "EndCoroutine" */ - /* 67 */ ts + 1362, /* "HaltIfNull" */ - /* 68 */ ts + 1373, /* "Halt" */ - /* 69 */ ts + 1378, /* "Integer" */ - /* 70 */ ts + 1386, /* "Int64" */ - /* 71 */ ts + 1392, /* "String" */ - /* 72 */ ts + 1399, /* "Null" */ - /* 73 */ ts + 1404, /* "SoftNull" */ - /* 74 */ ts + 1413, /* "Blob" */ - /* 75 */ ts + 1418, /* "Variable" */ - /* 76 */ ts + 1427, /* "Move" */ - /* 77 */ ts + 1432, /* "Copy" */ - /* 78 */ ts + 1437, /* "SCopy" */ - /* 79 */ ts + 1443, /* "IntCopy" */ - /* 80 */ ts + 1451, /* "ChngCntRow" */ - /* 81 */ ts + 1462, /* "ResultRow" */ - /* 82 */ ts + 1472, /* "CollSeq" */ - /* 83 */ ts + 1480, /* "AddImm" */ - /* 84 */ ts + 1487, /* "RealAffinity" */ - /* 85 */ ts + 1500, /* "Cast" */ - /* 86 */ ts + 1505, /* "Permutation" */ - /* 87 */ ts + 1517, /* "Compare" */ - /* 88 */ ts + 1525, /* "IsTrue" */ - /* 89 */ ts + 1532, /* "ZeroOrNull" */ - /* 90 */ ts + 1543, /* "Offset" */ - /* 91 */ ts + 1550, /* "Column" */ - /* 92 */ ts + 1557, /* "Affinity" */ - /* 93 */ ts + 1566, /* "MakeRecord" */ - /* 94 */ ts + 1577, /* "Count" */ - /* 95 */ ts + 1583, /* "ReadCookie" */ - /* 96 */ ts + 1594, /* "SetCookie" */ - /* 97 */ ts + 1604, /* "ReopenIdx" */ - /* 98 */ ts + 1614, /* "OpenRead" */ - /* 99 */ ts + 1623, /* "OpenWrite" */ - /* 100 */ ts + 1633, /* "OpenDup" */ - /* 101 */ ts + 1641, /* "OpenAutoindex" */ - /* 102 */ ts + 1655, /* "BitAnd" */ - /* 103 */ ts + 1662, /* "BitOr" */ - /* 104 */ ts + 1668, /* "ShiftLeft" */ - /* 105 */ ts + 1678, /* "ShiftRight" */ - /* 106 */ ts + 1689, /* "Add" */ - /* 107 */ ts + 1693, /* "Subtract" */ - /* 108 */ ts + 1702, /* "Multiply" */ - /* 109 */ ts + 1711, /* "Divide" */ - /* 110 */ ts + 1718, /* "Remainder" */ - /* 111 */ ts + 1728, /* "Concat" */ - /* 112 */ ts + 1735, /* "OpenEphemeral" */ - /* 113 */ ts + 1749, /* "BitNot" */ - /* 114 */ ts + 1756, /* "SorterOpen" */ - /* 115 */ ts + 1767, /* "SequenceTest" */ - /* 116 */ ts + 1780, /* "String8" */ - /* 117 */ ts + 1788, /* "OpenPseudo" */ - /* 118 */ ts + 1799, /* "Close" */ - /* 119 */ ts + 1805, /* "ColumnsUsed" */ - /* 120 */ ts + 1817, /* "SeekScan" */ - /* 121 */ ts + 1826, /* "SeekHit" */ - /* 122 */ ts + 1834, /* "Sequence" */ - /* 123 */ ts + 1843, /* "NewRowid" */ - /* 124 */ ts + 1852, /* "Insert" */ - /* 125 */ ts + 1859, /* "RowCell" */ - /* 126 */ ts + 1867, /* "Delete" */ - /* 127 */ ts + 1874, /* "ResetCount" */ - /* 128 */ ts + 1885, /* "SorterCompare" */ - /* 129 */ ts + 1899, /* "SorterData" */ - /* 130 */ ts + 1910, /* "RowData" */ - /* 131 */ ts + 1918, /* "Rowid" */ - /* 132 */ ts + 1924, /* "NullRow" */ - /* 133 */ ts + 1932, /* "SeekEnd" */ - /* 134 */ ts + 1940, /* "IdxInsert" */ - /* 135 */ ts + 1950, /* "SorterInsert" */ - /* 136 */ ts + 1963, /* "IdxDelete" */ - /* 137 */ ts + 1973, /* "DeferredSeek" */ - /* 138 */ ts + 1986, /* "IdxRowid" */ - /* 139 */ ts + 1995, /* "FinishSeek" */ - /* 140 */ ts + 2006, /* "Destroy" */ - /* 141 */ ts + 2014, /* "Clear" */ - /* 142 */ ts + 2020, /* "ResetSorter" */ - /* 143 */ ts + 2032, /* "CreateBtree" */ - /* 144 */ ts + 2044, /* "SqlExec" */ - /* 145 */ ts + 2052, /* "ParseSchema" */ - /* 146 */ ts + 2064, /* "LoadAnalysis" */ - /* 147 */ ts + 2077, /* "DropTable" */ - /* 148 */ ts + 2087, /* "DropIndex" */ - /* 149 */ ts + 2097, /* "DropTrigger" */ - /* 150 */ ts + 2109, /* "IntegrityCk" */ - /* 151 */ ts + 2121, /* "RowSetAdd" */ - /* 152 */ ts + 2131, /* "Real" */ - /* 153 */ ts + 2136, /* "Param" */ - /* 154 */ ts + 2142, /* "FkCounter" */ - /* 155 */ ts + 2152, /* "MemMax" */ - /* 156 */ ts + 2159, /* "OffsetLimit" */ - /* 157 */ ts + 2171, /* "AggInverse" */ - /* 158 */ ts + 2182, /* "AggStep" */ - /* 159 */ ts + 2190, /* "AggStep1" */ - /* 160 */ ts + 2199, /* "AggValue" */ - /* 161 */ ts + 2208, /* "AggFinal" */ - /* 162 */ ts + 2217, /* "Expire" */ - /* 163 */ ts + 2224, /* "CursorLock" */ - /* 164 */ ts + 2235, /* "CursorUnlock" */ - /* 165 */ ts + 2248, /* "TableLock" */ - /* 166 */ ts + 2258, /* "VBegin" */ - /* 167 */ ts + 2265, /* "VCreate" */ - /* 168 */ ts + 2273, /* "VDestroy" */ - /* 169 */ ts + 2282, /* "VOpen" */ - /* 170 */ ts + 2288, /* "VColumn" */ - /* 171 */ ts + 2296, /* "VRename" */ - /* 172 */ ts + 2304, /* "Pagecount" */ - /* 173 */ ts + 2314, /* "MaxPgcnt" */ - /* 174 */ ts + 2323, /* "Trace" */ - /* 175 */ ts + 2329, /* "CursorHint" */ - /* 176 */ ts + 2340, /* "ReleaseReg" */ - /* 177 */ ts + 2351, /* "Noop" */ - /* 178 */ ts + 2356, /* "Explain" */ - /* 179 */ ts + 2364, /* "Abortable" */ + /* 0 */ ts + 873, /* "Savepoint" */ + /* 1 */ ts + 883, /* "AutoCommit" */ + /* 2 */ ts + 894, /* "Transaction" */ + /* 3 */ ts + 906, /* "SorterNext" */ + /* 4 */ ts + 917, /* "Prev" */ + /* 5 */ ts + 922, /* "Next" */ + /* 6 */ ts + 927, /* "Checkpoint" */ + /* 7 */ ts + 938, /* "JournalMode" */ + /* 8 */ ts + 950, /* "Vacuum" */ + /* 9 */ ts + 957, /* "VFilter" */ + /* 10 */ ts + 965, /* "VUpdate" */ + /* 11 */ ts + 973, /* "Goto" */ + /* 12 */ ts + 978, /* "Gosub" */ + /* 13 */ ts + 984, /* "InitCoroutine" */ + /* 14 */ ts + 998, /* "Yield" */ + /* 15 */ ts + 1004, /* "MustBeInt" */ + /* 16 */ ts + 1014, /* "Jump" */ + /* 17 */ ts + 1019, /* "Once" */ + /* 18 */ ts + 1024, /* "If" */ + /* 19 */ ts + 1027, /* "Not" */ + /* 20 */ ts + 1031, /* "IfNot" */ + /* 21 */ ts + 1037, /* "IfNullRow" */ + /* 22 */ ts + 1047, /* "SeekLT" */ + /* 23 */ ts + 1054, /* "SeekLE" */ + /* 24 */ ts + 1061, /* "SeekGE" */ + /* 25 */ ts + 1068, /* "SeekGT" */ + /* 26 */ ts + 1075, /* "IfNotOpen" */ + /* 27 */ ts + 1085, /* "IfNoHope" */ + /* 28 */ ts + 1094, /* "NoConflict" */ + /* 29 */ ts + 1105, /* "NotFound" */ + /* 30 */ ts + 1114, /* "Found" */ + /* 31 */ ts + 1120, /* "SeekRowid" */ + /* 32 */ ts + 1130, /* "NotExists" */ + /* 33 */ ts + 1140, /* "Last" */ + /* 34 */ ts + 1145, /* "IfSmaller" */ + /* 35 */ ts + 1155, /* "SorterSort" */ + /* 36 */ ts + 1166, /* "Sort" */ + /* 37 */ ts + 1171, /* "Rewind" */ + /* 38 */ ts + 1178, /* "IdxLE" */ + /* 39 */ ts + 1184, /* "IdxGT" */ + /* 40 */ ts + 1190, /* "IdxLT" */ + /* 41 */ ts + 1196, /* "IdxGE" */ + /* 42 */ ts + 1202, /* "RowSetRead" */ + /* 43 */ ts + 1213, /* "Or" */ + /* 44 */ ts + 1216, /* "And" */ + /* 45 */ ts + 1220, /* "RowSetTest" */ + /* 46 */ ts + 1231, /* "Program" */ + /* 47 */ ts + 1239, /* "FkIfZero" */ + /* 48 */ ts + 1248, /* "IfPos" */ + /* 49 */ ts + 1254, /* "IfNotZero" */ + /* 50 */ ts + 1264, /* "IsNull" */ + /* 51 */ ts + 1271, /* "NotNull" */ + /* 52 */ ts + 1279, /* "Ne" */ + /* 53 */ ts + 1282, /* "Eq" */ + /* 54 */ ts + 1285, /* "Gt" */ + /* 55 */ ts + 1288, /* "Le" */ + /* 56 */ ts + 1291, /* "Lt" */ + /* 57 */ ts + 1294, /* "Ge" */ + /* 58 */ ts + 1297, /* "ElseEq" */ + /* 59 */ ts + 1304, /* "DecrJumpZero" */ + /* 60 */ ts + 1317, /* "IncrVacuum" */ + /* 61 */ ts + 1328, /* "VNext" */ + /* 62 */ ts + 1334, /* "Init" */ + /* 63 */ ts + 1339, /* "PureFunc" */ + /* 64 */ ts + 1348, /* "Function" */ + /* 65 */ ts + 1357, /* "Return" */ + /* 66 */ ts + 1364, /* "EndCoroutine" */ + /* 67 */ ts + 1377, /* "HaltIfNull" */ + /* 68 */ ts + 1388, /* "Halt" */ + /* 69 */ ts + 1393, /* "Integer" */ + /* 70 */ ts + 1401, /* "Int64" */ + /* 71 */ ts + 1407, /* "String" */ + /* 72 */ ts + 1414, /* "Null" */ + /* 73 */ ts + 1419, /* "SoftNull" */ + /* 74 */ ts + 1428, /* "Blob" */ + /* 75 */ ts + 1433, /* "Variable" */ + /* 76 */ ts + 1442, /* "Move" */ + /* 77 */ ts + 1447, /* "Copy" */ + /* 78 */ ts + 1452, /* "SCopy" */ + /* 79 */ ts + 1458, /* "IntCopy" */ + /* 80 */ ts + 1466, /* "ChngCntRow" */ + /* 81 */ ts + 1477, /* "ResultRow" */ + /* 82 */ ts + 1487, /* "CollSeq" */ + /* 83 */ ts + 1495, /* "AddImm" */ + /* 84 */ ts + 1502, /* "RealAffinity" */ + /* 85 */ ts + 1515, /* "Cast" */ + /* 86 */ ts + 1520, /* "Permutation" */ + /* 87 */ ts + 1532, /* "Compare" */ + /* 88 */ ts + 1540, /* "IsTrue" */ + /* 89 */ ts + 1547, /* "ZeroOrNull" */ + /* 90 */ ts + 1558, /* "Offset" */ + /* 91 */ ts + 1565, /* "Column" */ + /* 92 */ ts + 1572, /* "Affinity" */ + /* 93 */ ts + 1581, /* "MakeRecord" */ + /* 94 */ ts + 1592, /* "Count" */ + /* 95 */ ts + 1598, /* "ReadCookie" */ + /* 96 */ ts + 1609, /* "SetCookie" */ + /* 97 */ ts + 1619, /* "ReopenIdx" */ + /* 98 */ ts + 1629, /* "OpenRead" */ + /* 99 */ ts + 1638, /* "OpenWrite" */ + /* 100 */ ts + 1648, /* "OpenDup" */ + /* 101 */ ts + 1656, /* "OpenAutoindex" */ + /* 102 */ ts + 1670, /* "BitAnd" */ + /* 103 */ ts + 1677, /* "BitOr" */ + /* 104 */ ts + 1683, /* "ShiftLeft" */ + /* 105 */ ts + 1693, /* "ShiftRight" */ + /* 106 */ ts + 1704, /* "Add" */ + /* 107 */ ts + 1708, /* "Subtract" */ + /* 108 */ ts + 1717, /* "Multiply" */ + /* 109 */ ts + 1726, /* "Divide" */ + /* 110 */ ts + 1733, /* "Remainder" */ + /* 111 */ ts + 1743, /* "Concat" */ + /* 112 */ ts + 1750, /* "OpenEphemeral" */ + /* 113 */ ts + 1764, /* "BitNot" */ + /* 114 */ ts + 1771, /* "SorterOpen" */ + /* 115 */ ts + 1782, /* "SequenceTest" */ + /* 116 */ ts + 1795, /* "String8" */ + /* 117 */ ts + 1803, /* "OpenPseudo" */ + /* 118 */ ts + 1814, /* "Close" */ + /* 119 */ ts + 1820, /* "ColumnsUsed" */ + /* 120 */ ts + 1832, /* "SeekScan" */ + /* 121 */ ts + 1841, /* "SeekHit" */ + /* 122 */ ts + 1849, /* "Sequence" */ + /* 123 */ ts + 1858, /* "NewRowid" */ + /* 124 */ ts + 1867, /* "Insert" */ + /* 125 */ ts + 1874, /* "RowCell" */ + /* 126 */ ts + 1882, /* "Delete" */ + /* 127 */ ts + 1889, /* "ResetCount" */ + /* 128 */ ts + 1900, /* "SorterCompare" */ + /* 129 */ ts + 1914, /* "SorterData" */ + /* 130 */ ts + 1925, /* "RowData" */ + /* 131 */ ts + 1933, /* "Rowid" */ + /* 132 */ ts + 1939, /* "NullRow" */ + /* 133 */ ts + 1947, /* "SeekEnd" */ + /* 134 */ ts + 1955, /* "IdxInsert" */ + /* 135 */ ts + 1965, /* "SorterInsert" */ + /* 136 */ ts + 1978, /* "IdxDelete" */ + /* 137 */ ts + 1988, /* "DeferredSeek" */ + /* 138 */ ts + 2001, /* "IdxRowid" */ + /* 139 */ ts + 2010, /* "FinishSeek" */ + /* 140 */ ts + 2021, /* "Destroy" */ + /* 141 */ ts + 2029, /* "Clear" */ + /* 142 */ ts + 2035, /* "ResetSorter" */ + /* 143 */ ts + 2047, /* "CreateBtree" */ + /* 144 */ ts + 2059, /* "SqlExec" */ + /* 145 */ ts + 2067, /* "ParseSchema" */ + /* 146 */ ts + 2079, /* "LoadAnalysis" */ + /* 147 */ ts + 2092, /* "DropTable" */ + /* 148 */ ts + 2102, /* "DropIndex" */ + /* 149 */ ts + 2112, /* "DropTrigger" */ + /* 150 */ ts + 2124, /* "IntegrityCk" */ + /* 151 */ ts + 2136, /* "RowSetAdd" */ + /* 152 */ ts + 2146, /* "Real" */ + /* 153 */ ts + 2151, /* "Param" */ + /* 154 */ ts + 2157, /* "FkCounter" */ + /* 155 */ ts + 2167, /* "MemMax" */ + /* 156 */ ts + 2174, /* "OffsetLimit" */ + /* 157 */ ts + 2186, /* "AggInverse" */ + /* 158 */ ts + 2197, /* "AggStep" */ + /* 159 */ ts + 2205, /* "AggStep1" */ + /* 160 */ ts + 2214, /* "AggValue" */ + /* 161 */ ts + 2223, /* "AggFinal" */ + /* 162 */ ts + 2232, /* "Expire" */ + /* 163 */ ts + 2239, /* "CursorLock" */ + /* 164 */ ts + 2250, /* "CursorUnlock" */ + /* 165 */ ts + 2263, /* "TableLock" */ + /* 166 */ ts + 2273, /* "VBegin" */ + /* 167 */ ts + 2280, /* "VCreate" */ + /* 168 */ ts + 2288, /* "VDestroy" */ + /* 169 */ ts + 2297, /* "VOpen" */ + /* 170 */ ts + 2303, /* "VColumn" */ + /* 171 */ ts + 2311, /* "VRename" */ + /* 172 */ ts + 2319, /* "Pagecount" */ + /* 173 */ ts + 2329, /* "MaxPgcnt" */ + /* 174 */ ts + 2338, /* "Trace" */ + /* 175 */ ts + 2344, /* "CursorHint" */ + /* 176 */ ts + 2355, /* "ReleaseReg" */ + /* 177 */ ts + 2366, /* "Noop" */ + /* 178 */ ts + 2371, /* "Explain" */ + /* 179 */ ts + 2379, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -35235,67 +35741,67 @@ type unix_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [29]unix_syscall{ - {FzName: ts + 2374 /* "open" */, FpCurrent: 0}, + {FzName: ts + 2389 /* "open" */, FpCurrent: 0}, - {FzName: ts + 2379 /* "close" */, FpCurrent: 0}, + {FzName: ts + 2394 /* "close" */, FpCurrent: 0}, - {FzName: ts + 2385 /* "access" */, FpCurrent: 0}, + {FzName: ts + 2400 /* "access" */, FpCurrent: 0}, - {FzName: ts + 2392 /* "getcwd" */, FpCurrent: 0}, + {FzName: ts + 2407 /* "getcwd" */, FpCurrent: 0}, - {FzName: ts + 2399 /* "stat" */, FpCurrent: 0}, + {FzName: ts + 2414 /* "stat" */, FpCurrent: 0}, // The DJGPP compiler environment looks mostly like Unix, but it // lacks the fcntl() system call. So redefine fcntl() to be something // that always succeeds. This means that locking does not occur under // DJGPP. But it is DOS - what did you expect? - {FzName: ts + 2404 /* "fstat" */, FpCurrent: 0}, + {FzName: ts + 2419 /* "fstat" */, FpCurrent: 0}, - {FzName: ts + 2410 /* "ftruncate" */, FpCurrent: 0}, + {FzName: ts + 2425 /* "ftruncate" */, FpCurrent: 0}, - {FzName: ts + 2420 /* "fcntl" */, FpCurrent: 0}, + {FzName: ts + 2435 /* "fcntl" */, FpCurrent: 0}, - {FzName: ts + 2426 /* "read" */, FpCurrent: 0}, + {FzName: ts + 2441 /* "read" */, FpCurrent: 0}, - {FzName: ts + 2431 /* "pread" */, FpCurrent: 0}, + {FzName: ts + 2446 /* "pread" */, FpCurrent: 0}, - {FzName: ts + 2437 /* "pread64" */}, + {FzName: ts + 2452 /* "pread64" */}, - {FzName: ts + 2445 /* "write" */, FpCurrent: 0}, + {FzName: ts + 2460 /* "write" */, FpCurrent: 0}, - {FzName: ts + 2451 /* "pwrite" */, FpCurrent: 0}, + {FzName: ts + 2466 /* "pwrite" */, FpCurrent: 0}, - {FzName: ts + 2458 /* "pwrite64" */}, + {FzName: ts + 2473 /* "pwrite64" */}, - {FzName: ts + 2467 /* "fchmod" */, FpCurrent: 0}, + {FzName: ts + 2482 /* "fchmod" */, FpCurrent: 0}, - {FzName: ts + 2474 /* "fallocate" */}, + {FzName: ts + 2489 /* "fallocate" */}, - {FzName: ts + 2484 /* "unlink" */, FpCurrent: 0}, + {FzName: ts + 2499 /* "unlink" */, FpCurrent: 0}, - {FzName: ts + 2491 /* "openDirectory" */, FpCurrent: 0}, + {FzName: ts + 2506 /* "openDirectory" */, FpCurrent: 0}, - {FzName: ts + 2505 /* "mkdir" */, FpCurrent: 0}, + {FzName: ts + 2520 /* "mkdir" */, FpCurrent: 0}, - {FzName: ts + 2511 /* "rmdir" */, FpCurrent: 0}, + {FzName: ts + 2526 /* "rmdir" */, FpCurrent: 0}, - {FzName: ts + 2517 /* "fchown" */, FpCurrent: 0}, + {FzName: ts + 2532 /* "fchown" */, FpCurrent: 0}, - {FzName: ts + 2524 /* "geteuid" */, FpCurrent: 0}, + {FzName: ts + 2539 /* "geteuid" */, FpCurrent: 0}, - {FzName: ts + 2532 /* "mmap" */, FpCurrent: 0}, + {FzName: ts + 2547 /* "mmap" */, FpCurrent: 0}, - {FzName: ts + 2537 /* "munmap" */, FpCurrent: 0}, + {FzName: ts + 2552 /* "munmap" */, FpCurrent: 0}, - {FzName: ts + 2544 /* "mremap" */}, + {FzName: ts + 2559 /* "mremap" */}, - {FzName: ts + 2551 /* "getpagesize" */, FpCurrent: 0}, + {FzName: ts + 2566 /* "getpagesize" */, FpCurrent: 0}, - {FzName: ts + 2563 /* "readlink" */, FpCurrent: 0}, + {FzName: ts + 2578 /* "readlink" */, FpCurrent: 0}, - {FzName: ts + 2572 /* "lstat" */, FpCurrent: 0}, + {FzName: ts + 2587 /* "lstat" */, FpCurrent: 0}, - {FzName: ts + 2578 /* "ioctl" */}, + {FzName: ts + 2593 /* "ioctl" */}, } /* sqlite3.c:34446:3 */ // End of the overrideable system calls @@ -35429,9 +35935,9 @@ func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3 } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, fd) Xsqlite3_log(tls, SQLITE_WARNING, - ts+2584 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + ts+2599 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) fd = -1 - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2627 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2642 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { break } } @@ -35690,13 +36196,13 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // the strerror() function to obtain the human-readable error message // equivalent to errno. Otherwise, use strerror_r(). // This is a threadsafe build, but strerror_r() is not available. - zErr = ts + 741 /* "" */ + zErr = ts + 756 /* "" */ if zPath == uintptr(0) { - zPath = ts + 741 /* "" */ + zPath = ts + 756 /* "" */ } Xsqlite3_log(tls, errcode, - ts+2637, /* "os_unix.c:%d: (%..." */ + ts+2652, /* "os_unix.c:%d: (%..." */ libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) return errcode @@ -35715,7 +36221,7 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // and move on. func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, h) != 0 { - unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2379, /* "close" */ + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2394, /* "close" */ func() uintptr { if pFile != 0 { return (*UnixFile)(unsafe.Pointer(pFile)).FzPath @@ -35815,7 +36321,7 @@ func findInodeInfo(tls *libc.TLS, pFile uintptr, ppInode uintptr) int32 { /* sql // the first page of the database, no damage is done. if ((*stat)(unsafe.Pointer(bp /* &statbuf */)).Fst_size == int64(0)) && (((*UnixFile)(unsafe.Pointer(pFile)).FfsFlags & uint32(SQLITE_FSFLAGS_IS_MSDOS)) != uint32(0)) { for ok := true; ok; ok = ((rc < 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR)) { - rc = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*24 + 8 /* &.pCurrent */))))(tls, fd, ts+2668 /* "S" */, uint64(1))) + rc = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*24 + 8 /* &.pCurrent */))))(tls, fd, ts+2683 /* "S" */, uint64(1))) } if rc != 1 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) @@ -35898,19 +36404,19 @@ func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) if rc != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2670 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2685 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if int32((*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink) == 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2694 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2709 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if int32((*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink) > 1 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2723 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2738 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2750 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2765 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -37737,7 +38243,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql var fd int32 = -1 // var zDirname [513]int8 at bp+8, 513 - Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2778 /* "%s" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2793 /* "%s" */, libc.VaList(bp, zFilename)) for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { } if ii > 0 { @@ -37756,7 +38262,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql if fd >= 0 { return SQLITE_OK } - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2491 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2506 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) } // Make sure all writes to a particular file are committed to disk. @@ -37791,7 +38297,7 @@ func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793 if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2781 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2796 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) } // Also fsync the directory containing the file if the DIRSYNC flag @@ -37829,7 +38335,7 @@ func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:378 rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2410 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2425 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) } else { // If the file was just truncated to a size smaller than the currently @@ -37908,7 +38414,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if iWrite >= nSize { iWrite = (nSize - int64(1)) } - nWrite = seekAndWrite(tls, pFile, iWrite, ts+741 /* "" */, 1) + nWrite = seekAndWrite(tls, pFile, iWrite, ts+756 /* "" */, 1) if nWrite != 1 { return (SQLITE_IOERR | (int32(3) << 8)) } @@ -37921,7 +38427,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2410 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2425 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) } } @@ -37995,7 +38501,7 @@ func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK } @@ -38288,7 +38794,7 @@ func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 // help detect if a -shm file truncation is legitimate or is the work // or a rogue process. if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2410 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2425 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) } } } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { @@ -38394,7 +38900,7 @@ __4: ; libc.X__builtin___memset_chk(tls, pShmNode, 0, (uint64(unsafe.Sizeof(unixShmNode{})) + uint64(nShmFilename)), libc.X__builtin_object_size(tls, pShmNode, 0)) zShm = libc.AssignPtrUintptr(pShmNode+16 /* &.zFilename */, (pShmNode + 1*96)) - Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2792 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2807 /* "%s-shm" */, libc.VaList(bp, zBasePath)) (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode @@ -38416,7 +38922,7 @@ __5: if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { goto __7 } - if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2799 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2814 /* "readonly_shm" */, 0)) { goto __8 } (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | O_NOFOLLOW), @@ -38431,7 +38937,7 @@ __8: if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { goto __10 } - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2374 /* "open" */, zShm, 38716) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2389 /* "open" */, zShm, 38716) goto shm_open_err __10: ; @@ -38598,11 +39104,11 @@ __11: goto __13 } *(*int32)(unsafe.Pointer(bp + 144 /* x */)) = 0 - if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+741 /* "" */, 1, bp+144 /* &x */) != 1) { + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+756 /* "" */, 1, bp+144 /* &x */) != 1) { goto __14 } zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2445 /* "write" */, zFile, 38860) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2460 /* "write" */, zFile, 38860) goto shmpage_out __14: ; @@ -38650,7 +39156,7 @@ __16: if !(pMem == (libc.UintptrFromInt32(-1))) { goto __20 } - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2532 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2547 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) goto shmpage_out __20: ; @@ -38909,7 +39415,7 @@ func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ // continue accessing the database using the xRead() and xWrite() // methods. func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ - var zErr uintptr = ts + 2532 /* "mmap" */ + var zErr uintptr = ts + 2547 /* "mmap" */ var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes @@ -39206,7 +39712,7 @@ func autolockIoFinderImpl(tls *libc.TLS, filePath uintptr, pNew uintptr) uintptr (*flock)(unsafe.Pointer(bp + 2176 /* &lockInfo */)).Fl_whence = int16(SEEK_SET) (*flock)(unsafe.Pointer(bp + 2176 /* &lockInfo */)).Fl_type = int16(F_RDLCK) if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pNew)).Fh, F_GETLK, libc.VaList(bp, bp+2176 /* &lockInfo */)) != -1 { - if libc.Xstrcmp(tls, bp+8 /* &fsInfo */ +72 /* &.f_fstypename */, ts+2812 /* "nfs" */) == 0 { + if libc.Xstrcmp(tls, bp+8 /* &fsInfo */ +72 /* &.f_fstypename */, ts+2827 /* "nfs" */) == 0 { return uintptr(unsafe.Pointer(&nfsIoMethods)) } else { return uintptr(unsafe.Pointer(&posixIoMethods)) @@ -39223,11 +39729,11 @@ type Mapping = struct { } /* sqlite3.c:39574:16 */ var aMap = [6]Mapping{ - {FzFilesystem: ts + 2816 /* "hfs" */, FpMethods: 0}, - {FzFilesystem: ts + 2820 /* "ufs" */, FpMethods: 0}, - {FzFilesystem: ts + 2824 /* "afpfs" */, FpMethods: 0}, - {FzFilesystem: ts + 2830 /* "smbfs" */, FpMethods: 0}, - {FzFilesystem: ts + 2836 /* "webdav" */, FpMethods: 0}, + {FzFilesystem: ts + 2831 /* "hfs" */, FpMethods: 0}, + {FzFilesystem: ts + 2835 /* "ufs" */, FpMethods: 0}, + {FzFilesystem: ts + 2839 /* "afpfs" */, FpMethods: 0}, + {FzFilesystem: ts + 2845 /* "smbfs" */, FpMethods: 0}, + {FzFilesystem: ts + 2851 /* "webdav" */, FpMethods: 0}, {}, } /* sqlite3.c:39577:5 */ var autolockIoFinder uintptr = 0 /* sqlite3.c:39624:3 */ @@ -39264,10 +39770,10 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename } return uintptr(0) }(), - ts+2843 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + ts+2858 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2848 /* "unix-excl" */) == 0 { + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2863 /* "unix-excl" */) == 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) } @@ -39341,7 +39847,7 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename if zLockFile == uintptr(0) { rc = SQLITE_NOMEM } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2858 /* "%s.lock" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2873 /* "%s.lock" */, libc.VaList(bp, zFilename)) } (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -39371,10 +39877,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var zDir uintptr = Xsqlite3_temp_directory if !(int32(azDirs[0]) != 0) { - azDirs[0] = libc.Xgetenv(tls, ts+2866 /* "SQLITE_TMPDIR" */) + azDirs[0] = libc.Xgetenv(tls, ts+2881 /* "SQLITE_TMPDIR" */) } if !(int32(azDirs[1]) != 0) { - azDirs[1] = libc.Xgetenv(tls, ts+2880 /* "TMPDIR" */) + azDirs[1] = libc.Xgetenv(tls, ts+2895 /* "TMPDIR" */) } for 1 != 0 { if (((zDir != uintptr(0)) && @@ -39394,10 +39900,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var azDirs = [6]uintptr{ uintptr(0), uintptr(0), - ts + 2887, /* "/var/tmp" */ - ts + 2896, /* "/usr/tmp" */ - ts + 2905, /* "/tmp" */ - ts + 754, /* "." */ + ts + 2902, /* "/var/tmp" */ + ts + 2911, /* "/usr/tmp" */ + ts + 2920, /* "/tmp" */ + ts + 769, /* "." */ } /* sqlite3.c:39857:21 */ // Create a temporary file name in zBuf. zBuf must be allocated @@ -39425,7 +39931,7 @@ func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2910, /* "%s/etilqs_%llx%c" */ + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2925, /* "%s/etilqs_%llx%c" */ libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { return SQLITE_ERROR @@ -39581,7 +40087,7 @@ func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr // filename, check for the "modeof" parameter. If present, interpret // its value as a filename and try to copy the mode, uid and gid from // that file. - var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2927 /* "modeof" */) + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2942 /* "modeof" */) if z != 0 { rc = getFileMode(tls, z, pMode, pUid, pGid) } @@ -39813,7 +40319,7 @@ __15: if !(fd < 0) { goto __19 } - rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2374 /* "open" */, zName, 40257) + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2389 /* "open" */, zName, 40257) if !(rc == SQLITE_OK) { goto __20 } @@ -39877,13 +40383,13 @@ __25: return (SQLITE_IOERR | (int32(13) << 8)) __26: ; - if !(0 == libc.Xstrncmp(tls, ts+2934 /* "msdos" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { + if !(0 == libc.Xstrncmp(tls, ts+2949 /* "msdos" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { goto __27 } *(*uint32)(unsafe.Pointer(pFile + 124 /* &.fsFlags */)) |= (uint32(SQLITE_FSFLAGS_IS_MSDOS)) __27: ; - if !(0 == libc.Xstrncmp(tls, ts+2940 /* "exfat" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { + if !(0 == libc.Xstrncmp(tls, ts+2955 /* "exfat" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { goto __28 } *(*uint32)(unsafe.Pointer(pFile + 124 /* &.fsFlags */)) |= (uint32(SQLITE_FSFLAGS_IS_MSDOS)) @@ -39926,7 +40432,7 @@ __33: if !((((isAutoProxy != 0) && (zPath != (uintptr(0)))) && (!(noLock != 0))) && ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen != 0)) { goto __34 } - envforce = libc.Xgetenv(tls, ts+2946 /* "SQLITE_FORCE_PRO..." */) + envforce = libc.Xgetenv(tls, ts+2961 /* "SQLITE_FORCE_PRO..." */) useProxy = 0 // SQLITE_FORCE_PROXY_LOCKING==1 means force always use proxy, 0 means @@ -39947,7 +40453,7 @@ __36: if !(rc == SQLITE_OK) { goto __38 } - rc = proxyTransformUnixFile(tls, pFile, ts+2973 /* ":auto:" */) + rc = proxyTransformUnixFile(tls, pFile, ts+2988 /* ":auto:" */) if !(rc != SQLITE_OK) { goto __39 } @@ -39991,7 +40497,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == ENOENT { rc = (SQLITE_IOERR | (int32(23) << 8)) } else { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2484 /* "unlink" */, zPath, 40396) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2499 /* "unlink" */, zPath, 40396) } return rc } @@ -40001,7 +40507,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) if rc == SQLITE_OK { if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2980 /* "fsync" */, zPath, 40406) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2995 /* "fsync" */, zPath, 40406) } robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) } else { @@ -40076,7 +40582,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, zOut, (uint64(nOut-2))) == uintptr(0) { - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2392 /* "getcwd" */, zPath, 40485) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2407 /* "getcwd" */, zPath, 40485) } iOff = Xsqlite3Strlen30(tls, zOut) *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') @@ -40087,7 +40593,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) return Xsqlite3CantopenError(tls, 40494) } - Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2778 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2793 /* "%s" */, libc.VaList(bp, zPath)) // Remove duplicate '/' characters. Except, two // at the beginning // of a pathname is allowed since this is important on windows. @@ -40162,7 +40668,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*24 + 8 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) != ENOENT { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2572 /* "lstat" */, zIn, 40577) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2587 /* "lstat" */, zIn, 40577) } } else { bLink = (libc.Bool32(((int32((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode)) & S_IFMT) == S_IFLNK)) @@ -40182,7 +40688,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if rc == SQLITE_OK { nByte = int32((*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls, zIn, zDel, (uint64(nOut - 1)))) if nByte < 0 { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2563 /* "readlink" */, zIn, 40595) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2578 /* "readlink" */, zIn, 40595) } else { if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { var n int32 @@ -40527,7 +41033,7 @@ func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { unixEnterMutex(tls) zErr = libc.Xdlerror(tls) if zErr != 0 { - Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2778 /* "%s" */, libc.VaList(bp, zErr)) + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2793 /* "%s" */, libc.VaList(bp, zErr)) } unixLeaveMutex(tls) } @@ -40584,7 +41090,7 @@ func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) in { var fd int32 var got int32 - fd = robust_open(tls, ts+2986 /* "/dev/urandom" */, O_RDONLY, uint16(0)) + fd = robust_open(tls, ts+3001 /* "/dev/urandom" */, O_RDONLY, uint16(0)) if fd < 0 { // var t Time_t at bp, 8 @@ -41018,12 +41524,12 @@ func proxyGetLockPath(tls *libc.TLS, dbPath uintptr, lPath uintptr, maxLen Size_ return (SQLITE_IOERR | (int32(15) << 8)) } - len = int32(libc.Xstrlcat(tls, lPath, ts+2999 /* "sqliteplocks" */, maxLen)) + len = int32(libc.Xstrlcat(tls, lPath, ts+3014 /* "sqliteplocks" */, maxLen)) } if int32(*(*int8)(unsafe.Pointer(lPath + uintptr((len - 1))))) != '/' { - len = int32(libc.Xstrlcat(tls, lPath, ts+3012 /* "/" */, maxLen)) + len = int32(libc.Xstrlcat(tls, lPath, ts+3027 /* "/" */, maxLen)) } // transform the db path to a unique cache name @@ -41038,7 +41544,7 @@ func proxyGetLockPath(tls *libc.TLS, dbPath uintptr, lPath uintptr, maxLen Size_ }() } *(*int8)(unsafe.Pointer(lPath + uintptr((i + len)))) = int8(0) - libc.Xstrlcat(tls, lPath, ts+2973 /* ":auto:" */, maxLen) + libc.Xstrlcat(tls, lPath, ts+2988 /* ":auto:" */, maxLen) return SQLITE_OK } @@ -41190,7 +41696,7 @@ __14: (*UnixFile)(unsafe.Pointer(pNew)).FopenFlags = openFlags libc.X__builtin___memset_chk(tls, bp /* &dummyVfs */, 0, uint64(unsafe.Sizeof(Sqlite3_vfs{})), libc.X__builtin_object_size(tls, bp /* &dummyVfs */, 0)) (*Sqlite3_vfs)(unsafe.Pointer(bp /* &dummyVfs */)).FpAppData = uintptr(unsafe.Pointer(&autolockIoFinder)) - (*Sqlite3_vfs)(unsafe.Pointer(bp /* &dummyVfs */)).FzName = ts + 3014 /* "dummy" */ + (*Sqlite3_vfs)(unsafe.Pointer(bp /* &dummyVfs */)).FzName = ts + 3029 /* "dummy" */ (*UnixUnusedFd)(unsafe.Pointer(pUnused)).Ffd = fd (*UnixUnusedFd)(unsafe.Pointer(pUnused)).Fflags = openFlags (*UnixFile)(unsafe.Pointer(pNew)).FpPreallocatedUnused = pUnused @@ -41260,17 +41766,17 @@ func proxyBreakConchLock(tls *libc.TLS, pFile uintptr, myHostID uintptr) int32 { cPath = (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FconchFilePath readLen = uint64(0) pathLen = uint64(0) - *(*[64]int8)(unsafe.Pointer(bp + 1088 /* errmsg */)) = *(*[64]int8)(unsafe.Pointer(ts + 3020 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00..." */)) + *(*[64]int8)(unsafe.Pointer(bp + 1088 /* errmsg */)) = *(*[64]int8)(unsafe.Pointer(ts + 3035 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00..." */)) fd = -1 rc = -1 _ = myHostID // create a new path by replace the trailing '-conch' with '-break' pathLen = libc.Xstrlcpy(tls, bp+64 /* &tPath[0] */, cPath, uint64(PATH_MAX)) - if !(((pathLen > uint64(PATH_MAX)) || (pathLen < uint64(6))) || (libc.Xstrlcpy(tls, (bp+64 /* &tPath */ +uintptr((pathLen-uint64(5)))), ts+3084 /* "break" */, uint64(6)) != uint64(5))) { + if !(((pathLen > uint64(PATH_MAX)) || (pathLen < uint64(6))) || (libc.Xstrlcpy(tls, (bp+64 /* &tPath */ +uintptr((pathLen-uint64(5)))), ts+3099 /* "break" */, uint64(6)) != uint64(5))) { goto __1 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3090 /* "path error (len ..." */, libc.VaList(bp, int32(pathLen))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3105 /* "path error (len ..." */, libc.VaList(bp, int32(pathLen))) goto end_breaklock __1: ; @@ -41279,7 +41785,7 @@ __1: if !(readLen < (uint64(PROXY_HEADERLEN + PROXY_HOSTIDLEN))) { goto __2 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3110 /* "read error (len ..." */, libc.VaList(bp+8, int32(readLen))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3125 /* "read error (len ..." */, libc.VaList(bp+8, int32(readLen))) goto end_breaklock __2: ; @@ -41288,26 +41794,26 @@ __2: if !(fd < 0) { goto __3 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3130 /* "create failed (%..." */, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3145 /* "create failed (%..." */, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) goto end_breaklock __3: ; if !((*(*func(*libc.TLS, int32, uintptr, Size_t, Off_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 12*24 + 8 /* &.pCurrent */))))(tls, fd, bp+1152 /* &buf[0] */, readLen, int64(0)) != Ssize_t(readLen)) { goto __4 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3149 /* "write failed (%d..." */, libc.VaList(bp+24, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3164 /* "write failed (%d..." */, libc.VaList(bp+24, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) goto end_breaklock __4: ; if !(libc.Xrename(tls, bp+64 /* &tPath[0] */, cPath) != 0) { goto __5 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3167 /* "rename failed (%..." */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3182 /* "rename failed (%..." */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) goto end_breaklock __5: ; rc = 0 - libc.Xfprintf(tls, libc.X__stderrp, ts+3186 /* "broke stale lock..." */, libc.VaList(bp+40, cPath)) + libc.Xfprintf(tls, libc.X__stderrp, ts+3201 /* "broke stale lock..." */, libc.VaList(bp+40, cPath)) robust_close(tls, pFile, (*UnixFile)(unsafe.Pointer(conchFile)).Fh, 41282) (*UnixFile)(unsafe.Pointer(conchFile)).Fh = fd (*UnixFile)(unsafe.Pointer(conchFile)).FopenFlags = (O_RDWR | O_CREAT) @@ -41323,7 +41829,7 @@ end_breaklock: robust_close(tls, pFile, fd, 41290) __7: ; - libc.Xfprintf(tls, libc.X__stderrp, ts+3210 /* "failed to break ..." */, libc.VaList(bp+48, cPath, bp+1088 /* &errmsg[0] */)) + libc.Xfprintf(tls, libc.X__stderrp, ts+3225 /* "failed to break ..." */, libc.VaList(bp+48, cPath, bp+1088 /* &errmsg[0] */)) __6: ; return rc @@ -41781,7 +42287,7 @@ func proxyCreateConchPathname(tls *libc.TLS, dbPath uintptr, pConchPath uintptr) } // append the "-conch" suffix to the file - libc.X__builtin___memcpy_chk(tls, (conchPath + uintptr((i + 1))), ts+3248 /* "-conch" */, uint64(7), libc.X__builtin_object_size(tls, (conchPath+uintptr((i+1))), 0)) + libc.X__builtin___memcpy_chk(tls, (conchPath + uintptr((i + 1))), ts+3263 /* "-conch" */, uint64(7), libc.X__builtin_object_size(tls, (conchPath+uintptr((i+1))), 0)) return SQLITE_OK } @@ -41798,7 +42304,7 @@ func switchLockProxyPath(tls *libc.TLS, pFile uintptr, path uintptr) int32 { /* } // nothing to do if the path is NULL, :auto: or matches the existing path - if ((!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2973 /* ":auto:" */) != 0)) || ((oldPath != 0) && !(libc.Xstrncmp(tls, oldPath, path, uint64(PATH_MAX)) != 0)) { + if ((!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2988 /* ":auto:" */) != 0)) || ((oldPath != 0) && !(libc.Xstrncmp(tls, oldPath, path, uint64(PATH_MAX)) != 0)) { return SQLITE_OK } else { var lockProxy uintptr = (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxy @@ -41833,7 +42339,7 @@ func proxyGetDbPathForUnixFile(tls *libc.TLS, pFile uintptr, dbPath uintptr) int } else if (*UnixFile)(unsafe.Pointer(pFile)).FpMethod == uintptr(unsafe.Pointer(&dotlockIoMethods)) { // dot lock style uses the locking context to store the dot lock // file path - var len int32 = (int32(libc.Xstrlen(tls, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext) - libc.Xstrlen(tls, ts+3255 /* ".lock" */))) + var len int32 = (int32(libc.Xstrlen(tls, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext) - libc.Xstrlen(tls, ts+3270 /* ".lock" */))) libc.X__builtin___memcpy_chk(tls, dbPath, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext, (uint64(len + 1)), libc.X__builtin_object_size(tls, dbPath, 0)) } else { // all other styles use the locking context to store the db file path @@ -41863,7 +42369,7 @@ func proxyTransformUnixFile(tls *libc.TLS, pFile uintptr, path uintptr) int32 { return SQLITE_BUSY } proxyGetDbPathForUnixFile(tls, pFile, bp /* &dbPath[0] */) - if (!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2973 /* ":auto:" */) != 0) { + if (!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2988 /* ":auto:" */) != 0) { lockPath = uintptr(0) } else { lockPath = path @@ -41944,7 +42450,7 @@ func proxyFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { if (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath != 0 { *(*uintptr)(unsafe.Pointer(pArg)) = (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath } else { - *(*uintptr)(unsafe.Pointer(pArg)) = ts + 3261 /* ":auto: (not held..." */ + *(*uintptr)(unsafe.Pointer(pArg)) = ts + 3276 /* ":auto: (not held..." */ } } else { *(*uintptr)(unsafe.Pointer(pArg)) = uintptr(0) @@ -41971,7 +42477,7 @@ func proxyFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { var proxyPath uintptr = pArg if isProxyStyle != 0 { var pCtx uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext - if !(libc.Xstrcmp(tls, pArg, ts+2973 /* ":auto:" */) != 0) || + if !(libc.Xstrcmp(tls, pArg, ts+2988 /* ":auto:" */) != 0) || (((*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath != 0) && !(libc.Xstrncmp(tls, (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath, proxyPath, uint64(PATH_MAX)) != 0)) { rc = SQLITE_OK } else { @@ -42174,15 +42680,15 @@ func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ } var aVfs = [9]Sqlite3_vfs{ - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3279 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3284 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3294 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2848 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3307 /* "unix-posix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3318 /* "unix-flock" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3329 /* "unix-afp" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3338 /* "unix-nfs" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3347 /* "unix-proxy" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3294 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3299 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3309 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2863 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3322 /* "unix-posix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3333 /* "unix-flock" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3344 /* "unix-afp" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3353 /* "unix-nfs" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3362 /* "unix-proxy" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, } /* sqlite3.c:42091:22 */ // Shutdown the operating system interface. @@ -42277,7 +42783,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 3358, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 3373, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -42509,7 +43015,7 @@ func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int3 var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+3364 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+3379 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -42652,7 +43158,7 @@ func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+2778 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+2793 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -42769,7 +43275,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+3379 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3394 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { @@ -42842,7 +43348,7 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+3402 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3417 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } @@ -48319,7 +48825,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3417, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3432, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -50071,7 +50577,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.X__builtin___memcpy_chk(tls, pPtr, zPathname, uint64(nPathname), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += uintptr(nPathname) - libc.X__builtin___memcpy_chk(tls, pPtr, ts+3444 /* "-journal" */, uint64(8), libc.X__builtin_object_size(tls, pPtr, 0)) + libc.X__builtin___memcpy_chk(tls, pPtr, ts+3459 /* "-journal" */, uint64(8), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -50086,7 +50592,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.X__builtin___memcpy_chk(tls, pPtr, zPathname, uint64(nPathname), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += uintptr(nPathname) - libc.X__builtin___memcpy_chk(tls, pPtr, ts+3453 /* "-wal" */, uint64(4), libc.X__builtin_object_size(tls, pPtr, 0)) + libc.X__builtin___memcpy_chk(tls, pPtr, ts+3468 /* "-wal" */, uint64(4), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -50145,9 +50651,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3458 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3473 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3465 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3480 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -54043,7 +54549,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+3475, /* "recovered %d fra..." */ + ts+3490, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -54788,7 +55294,7 @@ func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13 } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+3512 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+3527 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -57568,7 +58074,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3538 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3553 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -59608,7 +60114,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3554 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3569 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -60482,7 +60988,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+3563 /* "@ " */, uint64(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+3578 /* "@ " */, uint64(3)) != 0) { goto __14 } goto page1_init_failed @@ -67996,7 +68502,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3567 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3582 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 56 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -68032,11 +68538,11 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+3569 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3584 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+3592 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + checkAppendMsg(tls, pCheck, ts+3607 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -68063,13 +68569,13 @@ func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent P if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+3617 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+3632 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+3646, /* "Bad ptr map entr..." */ + ts+3661, /* "Bad ptr map entr..." */ libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } @@ -68092,7 +68598,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } N-- if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+3700 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3715 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) @@ -68103,7 +68609,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+3722 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + ts+3737 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -68129,12 +68635,12 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+3761, /* "%s is %d but sho..." */ + ts+3776, /* "%s is %d but sho..." */ libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 3787 /* "size" */ + return ts + 3802 /* "size" */ } - return ts + 3792 /* "overflow list le..." */ + return ts + 3807 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -68278,13 +68784,13 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3813 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3828 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+3823 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+3838 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; @@ -68298,7 +68804,7 @@ __3: } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+3861 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + ts+3876 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; @@ -68306,7 +68812,7 @@ __4: goto __5 } - checkAppendMsg(tls, pCheck, ts+3899 /* "free space corru..." */, libc.VaList(bp+16, rc)) + checkAppendMsg(tls, pCheck, ts+3914 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; @@ -68314,7 +68820,7 @@ __5: hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3921 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3936 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -68336,7 +68842,7 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3947 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3962 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; @@ -68367,7 +68873,7 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+3975, /* "Offset %d out of..." */ + checkAppendMsg(tls, pCheck, ts+3990, /* "Offset %d out of..." */ libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 @@ -68378,7 +68884,7 @@ __12: if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+4005 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+4020 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: @@ -68396,7 +68902,7 @@ __13: }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+4029 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+4044 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) __15: ; *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey @@ -68437,7 +68943,7 @@ __20: if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+4053 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+4068 /* "Child page depth..." */, 0) depth = d2 __21: ; @@ -68535,7 +69041,7 @@ __29: goto __31 } checkAppendMsg(tls, pCheck, - ts+4078 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) + ts+4093 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) goto __30 goto __32 __31: @@ -68555,7 +69061,7 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+4115, /* "Fragmentation of..." */ + ts+4130, /* "Fragmentation of..." */ libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; @@ -68684,7 +69190,7 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 4167 /* "Main freelist: " */ + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 4182 /* "Main freelist: " */ checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) @@ -68722,7 +69228,7 @@ __13: goto __15 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+4183, /* "max rootpage (%d..." */ + ts+4198, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -68732,7 +69238,7 @@ __9: goto __16 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+4228 /* "incremental_vacu..." */, 0) + ts+4243 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -68782,13 +69288,13 @@ __23: if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4283 /* "Page %d is never..." */, libc.VaList(bp+16, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4298 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4305 /* "Pointer map page..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4320 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -69107,7 +69613,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt libc.X__builtin___memset_chk(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{})), libc.X__builtin_object_size(tls, bp+16 /* &sParse */, 0)) (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2778 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2793 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) @@ -69118,7 +69624,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+4339 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+4354 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -69139,7 +69645,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+4359 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+4374 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -69166,7 +69672,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+4390 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+4405 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -69780,7 +70286,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4430, /* "%!.15g" */ + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4445, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -70421,7 +70927,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -70627,6 +71133,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -70932,7 +71440,7 @@ __9: goto __10 } rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -71004,7 +71512,7 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 741 /* "" */ + zNeg = ts + 756 /* "" */ rc = SQLITE_OK __1: @@ -71053,7 +71561,7 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 4437 /* "-" */ + zNeg = ts + 4452 /* "-" */ __6: ; @@ -71073,7 +71581,7 @@ __9: Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+4439 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+4454 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } @@ -72518,34 +73026,34 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4444 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4459 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(j)*8)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 741 /* "" */ + zColl = ts + 756 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+304 /* "BINARY" */) == 0 { - zColl = ts + 4449 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+319 /* "BINARY" */) == 0 { + zColl = ts + 4464 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4451, /* ",%s%s%s" */ + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4466, /* ",%s%s%s" */ libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 4437 /* "-" */ + return ts + 4452 /* "-" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 4459 /* "N." */ + return ts + 4474 /* "N." */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4477 /* ")" */, 1) break } @@ -72553,7 +73061,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4464 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4479 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -72561,32 +73069,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4473 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4488 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4473 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4488 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4480 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4495 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4485 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4500 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+524 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+539 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -72596,14 +73104,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4480 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4495 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+524 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+539 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 742 /* "NULL" */ + zP4 = ts + 757 /* "NULL" */ } else { - zP4 = ts + 4488 /* "(blob)" */ + zP4 = ts + 4503 /* "(blob)" */ } break @@ -72611,7 +73119,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4495 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4510 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -72622,20 +73130,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4503 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4518 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4508 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4523 /* "]" */, 1) break } case -4: { - zP4 = ts + 4510 /* "program" */ + zP4 = ts + 4525 /* "program" */ break } @@ -72667,7 +73175,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 4518 /* "?" */, ts + 4520 /* "8" */, ts + 4522 /* "16LE" */, ts + 4527 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 4533 /* "?" */, ts + 4535 /* "8" */, ts + 4537 /* "16LE" */, ts + 4542 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -73198,8 +73706,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 4532 /* "addr" */, ts + 4537 /* "opcode" */, ts + 4544 /* "p1" */, ts + 4547 /* "p2" */, ts + 4550 /* "p3" */, ts + 4553 /* "p4" */, ts + 4556 /* "p5" */, ts + 4559, /* "comment" */ - ts + 4567 /* "id" */, ts + 4570 /* "parent" */, ts + 4577 /* "notused" */, ts + 4585, /* "detail" */ + ts + 4547 /* "addr" */, ts + 4552 /* "opcode" */, ts + 4559 /* "p1" */, ts + 4562 /* "p2" */, ts + 4565 /* "p3" */, ts + 4568 /* "p4" */, ts + 4571 /* "p5" */, ts + 4574, /* "comment" */ + ts + 4582 /* "id" */, ts + 4585 /* "parent" */, ts + 4592 /* "notused" */, ts + 4600, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -73447,7 +73955,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+4592 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+4607 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } @@ -73457,16 +73965,16 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4604 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4619 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4618 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4633 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4633, /* "-mj%06X9%02X" */ + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4648, /* "-mj%06X9%02X" */ libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. @@ -73660,7 +74168,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+4646 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4661 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -73942,7 +74450,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -75493,13 +76001,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 4676 /* "a CHECK constrai..." */ + zContext = ts + 4691 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 4695 /* "a generated colu..." */ + zContext = ts + 4710 /* "a generated colu..." */ } else { - zContext = ts + 4714 /* "an index" */ + zContext = ts + 4729 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+4723, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+4738, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -75630,7 +76138,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4759 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4774 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -75640,7 +76148,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4804 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4819 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -76110,7 +76618,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4844 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4859 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -76861,7 +77369,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+4867 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+4882 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -77638,7 +78146,7 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4907 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4922 /* "-- " */, 3) Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) } @@ -77676,11 +78184,11 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 184 /* idx */))-1))*56) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+742 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+757 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4480 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4495 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4430 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4445 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc @@ -77695,21 +78203,21 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = bp + 192 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4911 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4926 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { Xsqlite3VdbeMemRelease(tls, bp+192 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4918 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4933 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4931 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4946 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4934 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4949 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4939 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4954 /* "'" */, 1) } } } @@ -81408,19 +81916,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+4941 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+4956 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4962 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4977 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4969 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4984 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -83970,7 +84478,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+4993 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5008 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -84043,7 +84551,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+5044 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + Xsqlite3VdbeError(tls, p, ts+5059 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -84053,7 +84561,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+5066 /* "cannot release s..." */, 0) + ts+5081 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -84258,7 +84766,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+5120 /* "cannot commit tr..." */, 0) + ts+5135 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -84301,13 +84809,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 5175 /* "cannot start a t..." */ + return ts + 5190 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 5223 /* "cannot rollback ..." */ + return ts + 5238 /* "cannot rollback ..." */ } - return ts + 5266 /* "cannot commit - ..." */ + return ts + 5281 /* "cannot commit - ..." */ }() }(), 0) @@ -84425,7 +84933,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+5307 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+5322 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -84807,7 +85315,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 741 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 756 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -86937,7 +87445,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+5335 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+5350 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -87370,14 +87878,14 @@ __137: goto __720 __719: - zSchema = ts + 5352 /* "sqlite_master" */ + zSchema = ts + 5367 /* "sqlite_master" */ (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FiDb = iDb3 (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmInitFlags = U32(0) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+5366, /* "SELECT*FROM\"%w\"...." */ + ts+5381, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 @@ -87710,7 +88218,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+5409 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5424 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -88155,7 +88663,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -88233,7 +88741,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -88348,12 +88856,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+5446, /* "cannot change %s..." */ + ts+5461, /* "cannot change %s..." */ libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 5498 /* "into" */ + return ts + 5513 /* "into" */ } - return ts + 5503 /* "out of" */ + return ts + 5518 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -88556,7 +89064,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+5510 /* "database table i..." */, libc.VaList(bp+112, z1)) + Xsqlite3VdbeError(tls, p, ts+5525 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -88800,7 +89308,7 @@ __833: if !((*Sqlite3_context)(unsafe.Pointer(bp+872 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) rc = (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FisError __834: ; @@ -89131,7 +89639,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -89221,7 +89729,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+5539 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+5554 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -89324,13 +89832,13 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+5545, /* "statement aborts..." */ + Xsqlite3_log(tls, rc, ts+5560, /* "statement aborts..." */ libc.VaList(bp+152, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { @@ -89375,14 +89883,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+4844 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4859 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+5577 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+5592 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -89395,8 +89903,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 5591 /* "NOT NULL" */, ts + 5600 /* "UNIQUE" */, ts + 5607, /* "CHECK" */ - ts + 5613 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 5606 /* "NOT NULL" */, ts + 5615 /* "UNIQUE" */, ts + 5622, /* "CHECK" */ + ts + 5628 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -89503,16 +90011,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5625, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5640, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 5654 /* "null" */ + return ts + 5669 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 5659 /* "real" */ + return ts + 5674 /* "real" */ } - return ts + 5664 /* "integer" */ + return ts + 5679 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -89532,10 +90040,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5672 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5687 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2778 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2793 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -89598,21 +90106,21 @@ __4: goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5692 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5707 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5722 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5737 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5758 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5773 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { @@ -89657,7 +90165,7 @@ __12: goto __14 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5779 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5794 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -89686,7 +90194,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FiFrom == iCol) { goto __23 } - zFault = ts + 5800 /* "foreign key" */ + zFault = ts + 5815 /* "foreign key" */ __23: ; goto __21 @@ -89719,7 +90227,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 5812 /* "indexed" */ + zFault = ts + 5827 /* "indexed" */ __30: ; goto __28 @@ -89740,7 +90248,7 @@ __26: goto __31 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5820 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5835 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -89849,7 +90357,7 @@ __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)))) @@ -90014,7 +90522,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) @@ -93572,7 +94080,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5854 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5869 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -93775,14 +94283,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5859 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5874 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5863 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5878 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -93799,7 +94307,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5867 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5882 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -93976,7 +94484,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+5876 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5891 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -93984,14 +94492,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+5907 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5922 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -94067,7 +94575,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+5962 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + ts+5977 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) return WRC_Prune @@ -94088,23 +94596,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 5997 /* "no such column" */ + zErr = ts + 6012 /* "no such column" */ } else { - zErr = ts + 6012 /* "ambiguous column..." */ + zErr = ts + 6027 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+6034 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6049 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+6047 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6062 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+6057 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6072 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -94238,15 +94746,15 @@ func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExp bp := tls.Alloc(16) defer tls.Free(16) - var zIn uintptr = ts + 6064 /* "partial index WH..." */ + var zIn uintptr = ts + 6079 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 6092 /* "index expression..." */ + zIn = ts + 6107 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 6110 /* "CHECK constraint..." */ + zIn = ts + 6125 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 6128 /* "generated column..." */ + zIn = ts + 6143 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+6146 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+6161 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -94354,10 +94862,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6166 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6181 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6171 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6186 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -94410,7 +94918,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6177 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+6192 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -94477,7 +94985,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6194 /* "second argument ..." */, 0) + ts+6209 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -94502,7 +95010,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+6265, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6280, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -94526,7 +95034,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6300 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+6315 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -94555,30 +95063,30 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6328 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + ts+6343 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 6372 /* "window" */ + zType = ts + 6387 /* "window" */ } else { - zType = ts + 6379 /* "aggregate" */ + zType = ts + 6394 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+6389 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6404 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6418 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6433 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6441, /* "wrong number of ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6456, /* "wrong number of ..." */ libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+6486, /* "FILTER may not b..." */ + ts+6501, /* "FILTER may not b..." */ libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -94653,7 +95161,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6535 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6550 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) @@ -94670,7 +95178,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6546 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6561 /* "parameters" */, pExpr) } break @@ -94730,7 +95238,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) } break @@ -94835,7 +95343,7 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 Xsqlite3ErrorMsg(tls, pParse, - ts+6557 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+6572 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -94867,7 +95375,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6613 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6628 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -94902,7 +95410,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+6647 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + resolveOutOfRangeError(tls, pParse, ts+6662 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { @@ -94973,7 +95481,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6653 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+6668 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -95001,7 +95509,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6714 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+6729 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -95290,7 +95798,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6745 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6760 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -95347,7 +95855,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6647 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6662 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -95360,7 +95868,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6789 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6804 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -95372,7 +95880,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6795 /* "aggregate functi..." */, 0) + ts+6810 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -96142,7 +96650,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) return } @@ -96218,7 +96726,7 @@ func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+6854 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+6869 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -96459,7 +96967,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6917 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -96481,7 +96989,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6904 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+6919 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -96515,7 +97023,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+6938 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6953 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -96568,7 +97076,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6957, /* "variable number ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6972, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) return } @@ -96595,7 +97103,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7000 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+7015 /* "too many SQL var..." */, 0) } } @@ -97264,7 +97772,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+7023, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7038, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -97399,7 +97907,7 @@ func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+7053 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+7068 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -97454,10 +97962,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+6166 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+6181 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+6171 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+6186 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -97902,13 +98410,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+7076 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+7091 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+7084 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+7099 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+7090 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+7105 /* "OID" */) == 0 { return 1 } return 0 @@ -98136,7 +98644,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7094 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7109 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -98227,7 +98735,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7141 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7156 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -98333,7 +98841,7 @@ func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpec defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 7172 /* "sub-select retur..." */ + var zFmt uintptr = ts + 7187 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -98351,7 +98859,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) } } @@ -98404,7 +98912,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7216 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7231 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -98440,11 +98948,11 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7239 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7254 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 7258 /* "CORRELATED " */ + return ts + 7273 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. @@ -98590,7 +99098,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7270 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7285 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -98623,11 +99131,11 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7288 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7303 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 7258 /* "CORRELATED " */ + return ts + 7273 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr @@ -98651,7 +99159,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6917 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -98661,7 +99169,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+7309 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+7324 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -99153,12 +99661,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+7311 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7314 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if Xsqlite3_strnicmp(tls, z, ts+7326 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+7329 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 4437 /* "-" */ + return ts + 4452 /* "-" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -99233,7 +99741,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7340 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7355 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -99792,7 +100300,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+7340, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7355, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -100044,7 +100552,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+7370 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+7385 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32)).FiMem @@ -100086,7 +100594,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+7396 /* "unknown function..." */, libc.VaList(bp+16, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7411 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -100280,7 +100788,7 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+7023, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7038, /* "%d columns assig..." */ libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; @@ -100362,7 +100870,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -100486,7 +100994,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+7419 /* "RAISE() may only..." */, 0) + ts+7434 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -100525,7 +101033,7 @@ __3: return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7469 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7484 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -102362,11 +102870,11 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq bp := tls.Alloc(8) defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7485 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7500 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -102384,14 +102892,14 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+7513, /* "SELECT 1 FROM \"%..." */ + ts+7528, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7688, /* "SELECT 1 FROM te..." */ + ts+7703, /* "SELECT 1 FROM te..." */ libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -102407,11 +102915,11 @@ func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { Xsqlite3NestedParse(tls, pParse, - ts+7862 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+7877 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+8009 /* "UPDATE temp.sqli..." */, 0) + ts+8024 /* "UPDATE temp.sqli..." */, 0) } } @@ -102485,7 +102993,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+8160 /* "there is already..." */, libc.VaList(bp, zName)) + ts+8175 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -102498,7 +103006,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+8219 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+8234 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -102508,7 +103016,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+8225 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+8240 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -102561,24 +103069,24 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+8252 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+8267 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+8436, /* "UPDATE %Q.sqlite..." */ + ts+8451, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+8741 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+8756 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+8757, /* "UPDATE \"%w\".sqli..." */ + ts+8772, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -102591,7 +103099,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+8815 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+8830 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -102609,7 +103117,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9080 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9095 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -102624,7 +103132,7 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+9093, /* "SELECT raise(ABO..." */ + ts+9108, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -102672,12 +103180,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9131 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9146 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+9163 /* "Cannot add a UNI..." */, 0) + ts+9178 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -102690,11 +103198,11 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+9190 /* "Cannot add a REF..." */) + ts+9205 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+9249 /* "Cannot add a NOT..." */) + ts+9264 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() @@ -102710,12 +103218,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+9302 /* "Cannot add a col..." */) + ts+9317 /* "Cannot add a col..." */) } Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+9348 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+9363 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -102731,7 +103239,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+9375, /* "UPDATE \"%w\".sqli..." */ + ts+9390, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -102802,7 +103310,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+9521 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9536 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -102811,7 +103319,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+9555 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9570 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -102846,7 +103354,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Column{})) * uint64(nAlloc)))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9585 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9600 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -102893,18 +103401,18 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 9604 /* "view" */ + zType = ts + 9619 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 9609 /* "virtual table" */ + zType = ts + 9624 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9623, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9638, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 9641 /* "drop column from" */ + return ts + 9656 /* "drop column from" */ } - return ts + 9658 /* "rename columns o..." */ + return ts + 9673 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -102997,13 +103505,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+5779 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+5794 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+741 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+756 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -103021,19 +103529,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+9676, /* "UPDATE \"%w\".sqli..." */ + ts+9691, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+9894, /* "UPDATE temp.sqli..." */ + ts+9909, /* "UPDATE temp.sqli..." */ libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+9080 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+9095 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -103328,12 +103836,12 @@ func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType ui var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+10025, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+10040, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 10048 /* " " */ + return ts + 10063 /* " " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -103442,7 +103950,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+10050 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+10065 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -103492,12 +104000,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.X__builtin___memcpy_chk(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn), libc.X__builtin_object_size(tls, zBuf1, 0)) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+10056 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+10071 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 10048 /* " " */ + return ts + 10063 /* " " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -104001,7 +104509,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+741 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) + renameColumnParseError(tls, context, ts+756 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -104181,7 +104689,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+741 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) + renameColumnParseError(tls, context, ts+756 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -104463,7 +104971,7 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+10061 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+10076 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) @@ -104551,7 +105059,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+5779 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5794 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -104561,12 +105069,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+10068, /* "cannot drop %s c..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10083, /* "cannot drop %s c..." */ libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 10096 /* "PRIMARY KEY" */ + return ts + 10111 /* "PRIMARY KEY" */ } - return ts + 5600 /* "UNIQUE" */ + return ts + 5615 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -104577,7 +105085,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+10108 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+10123 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -104586,15 +105094,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+741 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+756 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+10156 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+10171 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+10277 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+10292 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -104705,11 +105213,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10295 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10316 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10336 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10355 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10374 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10310 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10331 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10351 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10370 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10389 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -104906,7 +105414,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+10397 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + ts+10412 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } @@ -104918,10 +105426,10 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10420, /* "DELETE FROM %Q.%..." */ + ts+10435, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+10450 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+10465 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) @@ -104942,9 +105450,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 10468 /* "sqlite_stat1" */, FzCols: ts + 10481 /* "tbl,idx,stat" */}, - {FzName: ts + 10494 /* "sqlite_stat4" */, FzCols: ts + 10507 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 10535 /* "sqlite_stat3" */}, + {FzName: ts + 10483 /* "sqlite_stat1" */, FzCols: ts + 10496 /* "tbl,idx,stat" */}, + {FzName: ts + 10509 /* "sqlite_stat4" */, FzCols: ts + 10522 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10550 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -105175,7 +105683,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10548 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 10563 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -105493,7 +106001,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10558 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 10573 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -105550,7 +106058,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+10568, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+10583, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -105561,7 +106069,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+10573 /* " %llu" */, libc.VaList(bp+8, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+10588 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -105610,7 +106118,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+10579 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+10594 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -105627,7 +106135,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10585 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 10600 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -105674,7 +106182,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+10594 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+10609 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -105692,7 +106200,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*120) - libc.X__builtin___memcpy_chk(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10468 /* "sqlite_stat1" */, uint64(13), libc.X__builtin_object_size(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, 0)) + libc.X__builtin___memcpy_chk(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10483 /* "sqlite_stat1" */, uint64(13), libc.X__builtin_object_size(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, 0)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -105925,7 +106433,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10604 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10619 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -105987,7 +106495,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10604 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10619 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -106040,9 +106548,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10608 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10623 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10612 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10627 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -106137,7 +106645,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 741 /* "" */ + z = ts + 756 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -106159,15 +106667,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+10616 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+10631 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+10627 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10642 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+10637 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10652 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -106486,10 +106994,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+10494 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+10509 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+10649, /* "SELECT idx,count..." */ - ts+10703, /* "SELECT idx,neq,n..." */ + ts+10664, /* "SELECT idx,count..." */ + ts+10718, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -106540,9 +107048,9 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit // Load new statistics out of the sqlite_stat1 table (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+10468 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + if Xsqlite3FindTable(tls, db, ts+10483 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+10755 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + ts+10770 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { @@ -106634,7 +107142,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5854 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5869 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -106685,13 +107193,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 741 /* "" */ + zFile = ts + 756 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 741 /* "" */ + zName = ts + 756 /* "" */ __2: ; @@ -106701,7 +107209,7 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+3358 /* "memdb" */) + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+3373 /* "memdb" */) if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) == uintptr(0)) { goto __5 } @@ -106717,7 +107225,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10796 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10811 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -106730,7 +107238,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10799, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10814, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -106744,7 +107252,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10836 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10851 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -106815,7 +107323,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10866 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10881 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -106832,7 +107340,7 @@ __21: goto __23 } *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+10895 /* "attached databas..." */, 0) + ts+10910 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -106902,13 +107410,13 @@ __29: } Xsqlite3OomFault(tls, db) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5577 /* "out of memory" */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5592 /* "out of memory" */, 0) goto __31 __30: if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10963 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10978 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -106964,7 +107472,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 741 /* "" */ + zName = ts + 756 /* "" */ __1: ; i = 0 @@ -106996,14 +107504,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10991 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11006 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11012 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11027 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -107011,7 +107519,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11038 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11053 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -107134,7 +107642,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11060 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 11075 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -107147,7 +107655,7 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11074 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 11089 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ @@ -107162,7 +107670,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+11088 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+11103 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -107195,7 +107703,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+11112, /* "%s %T cannot ref..." */ + ts+11127, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -107394,7 +107902,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+11158 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11173 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -107418,11 +107926,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+11181 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+11196 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+11187 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+11202 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+11193 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11208 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -107474,7 +107982,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName } else { - zCol = ts + 7084 /* "ROWID" */ + zCol = ts + 7099 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -107506,7 +108014,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+11220 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11235 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -107816,25 +108324,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+5854 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+5869 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7477 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7492 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11235 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11254 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+5352 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11250 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11269 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+5367 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+11268 /* "sqlite_temp_mast..." */) + ts+11283 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11254 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11269 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), - ts+5352 /* "sqlite_master" */) + ts+5367 /* "sqlite_master" */) } } } @@ -107857,12 +108365,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7477 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11254 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+5352 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11235 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7492 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11269 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+5367 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11250 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+11268 /* "sqlite_temp_mast..." */) + ts+11283 /* "sqlite_temp_mast..." */) } } } @@ -107898,7 +108406,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+11287 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+11302 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -107916,14 +108424,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 11295 /* "no such view" */ + zMsg = ts + 11310 /* "no such view" */ } else { - zMsg = ts + 11308 /* "no such table" */ + zMsg = ts + 11323 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6047 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6062 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+6057 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6072 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -108236,7 +108744,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+5352 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+5367 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -108263,7 +108771,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5854 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5869 /* "main" */, zName)) { goto __3 } @@ -108316,13 +108824,13 @@ func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11322 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11337 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11339 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+11354 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -108363,13 +108871,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*8))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*8))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+741 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+756 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7477 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7492 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11359, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11374, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -108538,9 +109046,9 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 @@ -108558,7 +109066,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+11401 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11416 /* "temporary table ..." */, 0) return __4: ; @@ -108586,9 +109094,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 9604 /* "view" */ + return ts + 9619 /* "view" */ } - return ts + 8219 /* "table" */ + return ts + 8234 /* "table" */ }(), zName) != 0) { goto __8 } @@ -108605,9 +109113,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -108645,7 +109153,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+11442 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+11457 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -108659,7 +109167,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+11466 /* "there is already..." */, libc.VaList(bp+8, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11481 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -108775,7 +109283,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+11501 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+11516 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -108799,7 +109307,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11518 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11533 /* "cannot use RETUR..." */, 0) } else { } @@ -108820,7 +109328,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11501 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11516 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -108832,7 +109340,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+11501 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+11516 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == (pRet + 16 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -108860,7 +109368,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11552 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11567 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -108876,7 +109384,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11575 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11590 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -109050,11 +109558,11 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11601, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11616, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11646 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11661 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. @@ -109104,7 +109612,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11687 /* "generated column..." */, 0) + ts+11702 /* "generated column..." */, 0) } } @@ -109149,7 +109657,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+11739 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11754 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -109209,7 +109717,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+741 /* "" */), ts+11780 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+756 /* "" */), ts+11795 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -109237,7 +109745,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+11788 /* "AUTOINCREMENT is..." */, 0) + ts+11803 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -109341,7 +109849,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+11844 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11859 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -109354,13 +109862,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11887 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11902 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11895 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11910 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -109393,7 +109901,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+11902, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11917, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -109535,13 +110043,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 741 /* "" */ - zSep2 = ts + 11933 /* "," */ - zEnd = ts + 4462 /* ")" */ + zSep = ts + 756 /* "" */ + zSep2 = ts + 11948 /* "," */ + zEnd = ts + 4477 /* ")" */ } else { - zSep = ts + 11935 /* "\n " */ - zSep2 = ts + 11939 /* ",\n " */ - zEnd = ts + 11944 /* "\n)" */ + zSep = ts + 11950 /* "\n " */ + zSep2 = ts + 11954 /* ",\n " */ + zEnd = ts + 11959 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -109549,7 +110057,7 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+11947 /* "CREATE TABLE " */, 0) + Xsqlite3_snprintf(tls, n, zStmt, ts+11962 /* "CREATE TABLE " */, 0) *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') @@ -109583,16 +110091,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2778 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2793 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 741, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 11961, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 11967, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 11972, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 11977, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 756, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11976, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11982, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11987, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11992, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -110029,7 +110537,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+741 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+756 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -110042,11 +110550,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11983 /* "AUTOINCREMENT no..." */, 0) + ts+11998 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+12033 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12048 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -110090,7 +110598,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12065 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12080 /* "must have at lea..." */, 0) return } } @@ -110123,12 +110631,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 8219 /* "table" */ - zType2 = ts + 12109 /* "TABLE" */ + zType = ts + 8234 /* "table" */ + zType2 = ts + 12124 /* "TABLE" */ } else { // A view - zType = ts + 9604 /* "view" */ - zType2 = ts + 12115 /* "VIEW" */ + zType = ts + 9619 /* "view" */ + zType2 = ts + 12130 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -110209,7 +110717,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+12120 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+12135 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -110217,7 +110725,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+12135, /* "UPDATE %Q.sqlite..." */ + ts+12150, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, @@ -110235,14 +110743,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+12233, /* "CREATE TABLE %Q...." */ + ts+12248, /* "CREATE TABLE %Q...." */ libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+12275 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+12290 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -110263,7 +110771,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8741 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8756 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -110300,7 +110808,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+12309 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12324 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -110322,7 +110830,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9604 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9619 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+8 /* &sFix */, pSelect) != 0) { goto __3 } @@ -110439,7 +110947,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12345 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12360 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -110581,7 +111089,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+12375 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12390 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -110595,7 +111103,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+12390, /* "UPDATE %Q.sqlite..." */ + ts+12405, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -110659,10 +111167,10 @@ func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uint for i = 1; i <= 4; i++ { // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12457 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12472 /* "sqlite_stat%d" */, libc.VaList(bp, i)) if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10420, /* "DELETE FROM %Q.%..." */ + ts+10435, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } @@ -110702,7 +111210,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+12471, /* "DELETE FROM %Q.s..." */ + ts+12486, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -110714,7 +111222,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+12516, /* "DELETE FROM %Q.s..." */ + ts+12531, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) @@ -110744,11 +111252,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2399 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2414 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6546 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6561 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -110829,9 +111337,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zArg2 = uintptr(0) @@ -110891,7 +111399,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+12583 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12598 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -110901,14 +111409,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+12611 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12626 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+12645 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12660 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -110923,7 +111431,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+10612 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10627 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -110988,7 +111496,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+12677, /* "foreign key on %..." */ + ts+12692, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*32)).FzName, pTo)) goto fk_end __5: @@ -111001,7 +111509,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+12740 /* "number of column..." */, 0) + ts+12755 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -111085,7 +111593,7 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+12834, /* "unknown column \"..." */ + ts+12849, /* "unknown column \"..." */ libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) goto fk_end __23: @@ -111335,12 +111843,12 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+12880, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12895, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 12908 /* "FIRST" */ + return ts + 12923 /* "FIRST" */ } - return ts + 12914 /* "LAST" */ + return ts + 12929 /* "LAST" */ }())) return 1 } @@ -111498,7 +112006,7 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12919 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12934 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+136 /* &sFix */, pTblName) != 0) { goto __10 } @@ -111519,7 +112027,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+12925, /* "cannot create a ..." */ + ts+12940, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -111546,26 +112054,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12975 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12990 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+13003 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13018 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+13028 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13043 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -111592,7 +112100,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12919 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12934 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -111607,7 +112115,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+13062 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13077 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -111619,7 +112127,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+13096 /* "index %s already..." */, libc.VaList(bp+24, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13111 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -111648,7 +112156,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+13120 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+13135 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -111677,9 +112185,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -111723,7 +112231,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12919 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12934 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -111840,7 +112348,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+13143 /* "expressions proh..." */, 0) + ts+13158 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -112069,7 +112577,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+13204 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) + ts+13219 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -112125,7 +112633,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+13246 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13261 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -112183,12 +112691,12 @@ __104: __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+13263, /* "CREATE%s INDEX %..." */ + zStmt = Xsqlite3MPrintf(tls, db, ts+13278, /* "CREATE%s INDEX %..." */ libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 13283 /* " UNIQUE" */ + return ts + 13298 /* " UNIQUE" */ }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: @@ -112200,7 +112708,7 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+13291, /* "INSERT INTO %Q.s..." */ + ts+13306, /* "INSERT INTO %Q.s..." */ libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -112216,7 +112724,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+13350 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+13365 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -112400,7 +112908,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+13377 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+13392 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -112415,7 +112923,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+13395 /* "index associated..." */, libc.VaList(bp+8, 0)) + ts+13410 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -112426,9 +112934,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -112456,9 +112964,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+13468, /* "DELETE FROM %Q.s..." */ + ts+13483, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+10608 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10623 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -112609,7 +113117,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+13528, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13543, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -112821,12 +113329,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13564, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13579, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 13600 /* "ON" */ + return ts + 13615 /* "ON" */ } - return ts + 13603 /* "USING" */ + return ts + 13618 /* "USING" */ }())) goto append_from_error __1: @@ -112954,7 +113462,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13609 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13624 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -112990,9 +113498,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 13615 /* "ROLLBACK" */ + return ts + 13630 /* "ROLLBACK" */ } - return ts + 13624 /* "COMMIT" */ + return ts + 13639 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -113017,7 +113525,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 13609 /* "BEGIN" */, ts + 13631 /* "RELEASE" */, ts + 13615 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 13624 /* "BEGIN" */, ts + 13646 /* "RELEASE" */, ts + 13630 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -113033,7 +113541,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+13639 /* "unable to open a..." */, 0) + ts+13654 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -113176,17 +113684,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13709 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13724 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*32)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13720 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13735 /* ", " */, 2) } Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+754 /* "." */, 1) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+769 /* "." */, 1) Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } @@ -113209,11 +113717,11 @@ func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+11181 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+11196 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13723 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13738 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -113356,7 +113864,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+13732 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13747 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -113466,7 +113974,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13778 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13793 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -113700,7 +114208,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13808 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13823 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -114066,11 +114574,11 @@ func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int3 defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13839 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13854 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13868 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13883 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -114663,7 +115171,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13906 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13921 /* "rows deleted" */, uintptr(0)) __61: ; @@ -114808,7 +115316,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10468 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10483 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -115086,7 +115594,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 5664 /* "integer" */, ts + 5659 /* "real" */, ts + 13919 /* "text" */, ts + 13924 /* "blob" */, ts + 5654 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 5679 /* "integer" */, ts + 5674 /* "real" */, ts + 13934 /* "text" */, ts + 13939 /* "blob" */, ts + 5669 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -115150,7 +115658,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+13929 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13944 /* "integer overflow" */, -1) return } iVal = -iVal @@ -115488,7 +115996,7 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+13946 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+13961 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -115938,7 +116446,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+13951 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+13966 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -115950,7 +116458,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+13984 /* "ESCAPE expressio..." */, -1) + ts+13999 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -116016,7 +116524,7 @@ func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) } // Implementation of the sqlite_compileoption_used() function. @@ -116073,10 +116581,10 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4430 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4445 /* "%!.15g" */, libc.VaList(bp, r1)) Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+14029 /* "%!.20e" */, libc.VaList(bp+8, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+14044 /* "%!.20e" */, libc.VaList(bp+8, r1)) } Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break @@ -116150,7 +116658,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+742 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+757 /* "NULL" */, 4, uintptr(0)) break } @@ -116461,7 +116969,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 10048 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 10063 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -116482,7 +116990,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 741 /* "" */ + zIn = ts + 756 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -116508,7 +117016,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+14036 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+14051 /* "?000" */, 4, uintptr(0)) } } @@ -116536,7 +117044,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+11220 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+11235 /* "not authorized" */, -1) return } @@ -116624,7 +117132,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+13929 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13944 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -116778,7 +117286,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) } else { - zSep = ts + 11933 /* "," */ + zSep = ts + 11948 /* "," */ nSep = 1 } if zSep != 0 { @@ -116856,7 +117364,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+14041 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+14056 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -116876,14 +117384,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+14047 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+14062 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+14047 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+14062 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14047 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14047 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14062 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14062 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -116988,76 +117496,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 14052 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 14072 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 14085 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 14067 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 14087 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 14100 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14103 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14111 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14111 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14126 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14152 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14177 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14186 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14197 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14204 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14218 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14218 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14224 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14224 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14230 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14230 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14235 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14235 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14235 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14239 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 14239 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14239 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14243 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 14250 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14257 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14263 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14270 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14278 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14283 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14287 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14287 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14293 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14299 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14305 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14309 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14316 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14323 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14334 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14341 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14356 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14373 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14384 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14390 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14408 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14416 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14430 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14438 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14447 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14447 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14454 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14454 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14464 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14468 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14474 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14478 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14478 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14484 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14484 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14118 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14126 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14126 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14141 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14167 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14192 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14201 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14212 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14219 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14233 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14233 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14239 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14239 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14245 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14245 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14250 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14250 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14250 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14254 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 14254 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14254 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14258 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 14265 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14272 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14278 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14285 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14293 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14298 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14302 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14302 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14308 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14314 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14320 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14324 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14331 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14338 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14349 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14356 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14371 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14388 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14399 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14405 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14423 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14431 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14445 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14453 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14462 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14462 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14469 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14469 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14479 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14483 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14489 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14493 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14493 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14499 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14499 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14497 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14047 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14047 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14502 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14502 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14511 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14502 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14516 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14512 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14062 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14062 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14517 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14517 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14526 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14517 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14531 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -117343,7 +117851,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+14520, /* "foreign key mism..." */ + ts+14535, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -118239,8 +118747,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5863 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5859 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5878 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5874 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+32, 16 // Name of column in child table // var tToCol Token at bp+16, 16 @@ -118328,7 +118836,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4646 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4661 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -118758,7 +119266,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7340 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7355 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -119322,7 +119830,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+14565, /* "cannot INSERT in..." */ + ts+14580, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto insert_cleanup __24: @@ -119347,7 +119855,7 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+14606, /* "table %S has no ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14621, /* "table %S has no ..." */ libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup @@ -119517,7 +120025,7 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+14638, /* "table %S has %d ..." */ + ts+14653, /* "table %S has %d ..." */ libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: @@ -119527,7 +120035,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+14690 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+14705 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -119583,7 +120091,7 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+14715, /* "UPSERT not imple..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14730, /* "UPSERT not imple..." */ libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: @@ -119591,7 +120099,7 @@ __56: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+14761 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14776 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -120071,7 +120579,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14782 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14797 /* "rows inserted" */, uintptr(0)) __123: ; @@ -120415,7 +120923,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+11181 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+11196 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -121818,7 +122326,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 741 /* "" */ + zSql = ts + 756 /* "" */ __2: ; @@ -122379,7 +122887,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+11220 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+11235 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -122389,7 +122897,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 14796 /* "sqlite3_extensio..." */ + zEntry = ts + 14811 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -122409,7 +122917,7 @@ __5: if !((ii < (int32(uint64(unsafe.Sizeof(azEndings)) / uint64(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+11181 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+11196 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -122455,7 +122963,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.X__builtin___memcpy_chk(tls, zAltEntry, ts+14819 /* "sqlite3_" */, uint64(8), libc.X__builtin_object_size(tls, zAltEntry, 0)) + libc.X__builtin___memcpy_chk(tls, zAltEntry, ts+14834 /* "sqlite3_" */, uint64(8), libc.X__builtin_object_size(tls, zAltEntry, 0)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { @@ -122469,7 +122977,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14828 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14843 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -122493,7 +123001,7 @@ __17: goto __18 __18: ; - libc.X__builtin___memcpy_chk(tls, (zAltEntry + uintptr(iEntry)), ts+14832 /* "_init" */, uint64(6), libc.X__builtin_object_size(tls, (zAltEntry+uintptr(iEntry)), 0)) + libc.X__builtin___memcpy_chk(tls, (zAltEntry + uintptr(iEntry)), ts+14847 /* "_init" */, uint64(6), libc.X__builtin_object_size(tls, (zAltEntry+uintptr(iEntry)), 0)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -122511,7 +123019,7 @@ __10: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14838 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + ts+14853 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; @@ -122536,7 +123044,7 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14881 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14896 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) @@ -122576,7 +123084,7 @@ extension_not_found: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14913 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + ts+14928 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; @@ -122586,7 +123094,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 14950, /* "dylib" */ + ts + 14965, /* "dylib" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -122753,7 +123261,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+14956 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + ts+14971 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) @@ -122798,61 +123306,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 4567, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 14995, /* "seq" */ - /* 2 */ ts + 8219, /* "table" */ - /* 3 */ ts + 14999, /* "from" */ - /* 4 */ ts + 15004, /* "to" */ - /* 5 */ ts + 15007, /* "on_update" */ - /* 6 */ ts + 15017, /* "on_delete" */ - /* 7 */ ts + 15027, /* "match" */ - /* 8 */ ts + 15033, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 15037, /* "name" */ - /* 10 */ ts + 15042, /* "type" */ - /* 11 */ ts + 15047, /* "notnull" */ - /* 12 */ ts + 15055, /* "dflt_value" */ - /* 13 */ ts + 15066, /* "pk" */ - /* 14 */ ts + 15069, /* "hidden" */ + /* 0 */ ts + 4582, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 15010, /* "seq" */ + /* 2 */ ts + 8234, /* "table" */ + /* 3 */ ts + 15014, /* "from" */ + /* 4 */ ts + 15019, /* "to" */ + /* 5 */ ts + 15022, /* "on_update" */ + /* 6 */ ts + 15032, /* "on_delete" */ + /* 7 */ ts + 15042, /* "match" */ + /* 8 */ ts + 15048, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 15052, /* "name" */ + /* 10 */ ts + 15057, /* "type" */ + /* 11 */ ts + 15062, /* "notnull" */ + /* 12 */ ts + 15070, /* "dflt_value" */ + /* 13 */ ts + 15081, /* "pk" */ + /* 14 */ ts + 15084, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 15076, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 15033, /* "cid" */ - /* 17 */ ts + 15037, /* "name" */ - /* 18 */ ts + 15082, /* "desc" */ - /* 19 */ ts + 15087, /* "coll" */ - /* 20 */ ts + 15092, /* "key" */ - /* 21 */ ts + 15037, /* "name" */ // Used by: function_list - /* 22 */ ts + 15096, /* "builtin" */ - /* 23 */ ts + 15042, /* "type" */ - /* 24 */ ts + 15104, /* "enc" */ - /* 25 */ ts + 15108, /* "narg" */ - /* 26 */ ts + 15113, /* "flags" */ - /* 27 */ ts + 10612, /* "tbl" */ // Used by: stats - /* 28 */ ts + 10608, /* "idx" */ - /* 29 */ ts + 15119, /* "wdth" */ - /* 30 */ ts + 15124, /* "hght" */ - /* 31 */ ts + 15129, /* "flgs" */ - /* 32 */ ts + 14995, /* "seq" */ // Used by: index_list - /* 33 */ ts + 15037, /* "name" */ - /* 34 */ ts + 15134, /* "unique" */ - /* 35 */ ts + 15141, /* "origin" */ - /* 36 */ ts + 15148, /* "partial" */ - /* 37 */ ts + 8219, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 15156, /* "rowid" */ - /* 39 */ ts + 4570, /* "parent" */ - /* 40 */ ts + 15162, /* "fkid" */ + /* 15 */ ts + 15091, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 15048, /* "cid" */ + /* 17 */ ts + 15052, /* "name" */ + /* 18 */ ts + 15097, /* "desc" */ + /* 19 */ ts + 15102, /* "coll" */ + /* 20 */ ts + 15107, /* "key" */ + /* 21 */ ts + 15052, /* "name" */ // Used by: function_list + /* 22 */ ts + 15111, /* "builtin" */ + /* 23 */ ts + 15057, /* "type" */ + /* 24 */ ts + 15119, /* "enc" */ + /* 25 */ ts + 15123, /* "narg" */ + /* 26 */ ts + 15128, /* "flags" */ + /* 27 */ ts + 10627, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10623, /* "idx" */ + /* 29 */ ts + 15134, /* "wdth" */ + /* 30 */ ts + 15139, /* "hght" */ + /* 31 */ ts + 15144, /* "flgs" */ + /* 32 */ ts + 15010, /* "seq" */ // Used by: index_list + /* 33 */ ts + 15052, /* "name" */ + /* 34 */ ts + 15149, /* "unique" */ + /* 35 */ ts + 15156, /* "origin" */ + /* 36 */ ts + 15163, /* "partial" */ + /* 37 */ ts + 8234, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 15171, /* "rowid" */ + /* 39 */ ts + 4585, /* "parent" */ + /* 40 */ ts + 15177, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 14995, /* "seq" */ // Used by: database_list - /* 42 */ ts + 15037, /* "name" */ - /* 43 */ ts + 15167, /* "file" */ - /* 44 */ ts + 15172, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 15177, /* "log" */ - /* 46 */ ts + 15181, /* "checkpointed" */ + /* 41 */ ts + 15010, /* "seq" */ // Used by: database_list + /* 42 */ ts + 15052, /* "name" */ + /* 43 */ ts + 15182, /* "file" */ + /* 44 */ ts + 15187, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 15192, /* "log" */ + /* 46 */ ts + 15196, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 15194, /* "database" */ // Used by: lock_status - /* 48 */ ts + 15203, /* "status" */ - /* 49 */ ts + 15210, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 15209, /* "database" */ // Used by: lock_status + /* 48 */ ts + 15218, /* "status" */ + /* 49 */ ts + 15225, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 15221, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 15236, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -122869,237 +123377,237 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [66]PragmaName{ - { /* zName: */ FzName: ts + 15229, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 15244, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15244, /* "application_id" */ + { /* zName: */ FzName: ts + 15259, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 15259, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 15274, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15271, /* "automatic_index" */ + { /* zName: */ FzName: ts + 15286, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 15287, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 15302, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15210, /* "cache_size" */ + { /* zName: */ FzName: ts + 15225, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15300, /* "cache_spill" */ + { /* zName: */ FzName: ts + 15315, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15312, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 15327, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 15332, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 15347, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 15348, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 15363, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 15369, /* "collation_list" */ + { /* zName: */ FzName: ts + 15384, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 15384, /* "compile_options" */ + { /* zName: */ FzName: ts + 15399, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15400, /* "count_changes" */ + { /* zName: */ FzName: ts + 15415, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 15414, /* "data_version" */ + { /* zName: */ FzName: ts + 15429, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 15427, /* "database_list" */ + { /* zName: */ FzName: ts + 15442, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15441, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 15456, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15460, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 15475, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 15479, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 15494, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 15502, /* "encoding" */ + { /* zName: */ FzName: ts + 15517, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15511, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 15526, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 15529, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 15544, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 15546, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 15561, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 15559, /* "freelist_count" */ + { /* zName: */ FzName: ts + 15574, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 15574, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 15589, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 15592, /* "fullfsync" */ + { /* zName: */ FzName: ts + 15607, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 15602, /* "function_list" */ + { /* zName: */ FzName: ts + 15617, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15616, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 15631, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15632, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 15647, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 15657, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 15672, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 15676, /* "index_info" */ + { /* zName: */ FzName: ts + 15691, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15687, /* "index_list" */ + { /* zName: */ FzName: ts + 15702, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 15698, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 15713, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15710, /* "integrity_check" */ + { /* zName: */ FzName: ts + 15725, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15726, /* "journal_mode" */ + { /* zName: */ FzName: ts + 15741, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15739, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 15754, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15758, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 15773, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 15777, /* "lock_proxy_file" */ + { /* zName: */ FzName: ts + 15792, /* "lock_proxy_file" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCK_PROXY_FILE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 15793, /* "locking_mode" */ + { /* zName: */ FzName: ts + 15808, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15806, /* "max_page_count" */ + { /* zName: */ FzName: ts + 15821, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15821, /* "mmap_size" */ + { /* zName: */ FzName: ts + 15836, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 15831, /* "module_list" */ + { /* zName: */ FzName: ts + 15846, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15843, /* "optimize" */ + { /* zName: */ FzName: ts + 15858, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 15852, /* "page_count" */ + { /* zName: */ FzName: ts + 15867, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15863, /* "page_size" */ + { /* zName: */ FzName: ts + 15878, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15873, /* "pragma_list" */ + { /* zName: */ FzName: ts + 15888, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15885, /* "query_only" */ + { /* zName: */ FzName: ts + 15900, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 15896, /* "quick_check" */ + { /* zName: */ FzName: ts + 15911, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15908, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 15923, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 15925, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 15940, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 15944, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 15959, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 15970, /* "schema_version" */ + { /* zName: */ FzName: ts + 15985, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 15985, /* "secure_delete" */ + { /* zName: */ FzName: ts + 16000, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15999, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 16014, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 16018, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 16033, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 16032, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 16047, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16048, /* "synchronous" */ + { /* zName: */ FzName: ts + 16063, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16060, /* "table_info" */ + { /* zName: */ FzName: ts + 16075, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 16071, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 16086, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 16083, /* "temp_store" */ + { /* zName: */ FzName: ts + 16098, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16094, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 16109, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 16115, /* "threads" */ + { /* zName: */ FzName: ts + 16130, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16123, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 16138, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 16138, /* "user_version" */ + { /* zName: */ FzName: ts + 16153, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 16151, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 16166, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 16170, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 16185, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 16185, /* "writable_schema" */ + { /* zName: */ FzName: ts + 16200, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -123136,7 +123644,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 16201 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 16216 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -123153,10 +123661,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+16226 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16241 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+16236 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16251 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -123169,13 +123677,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+16243 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16258 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+16248 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16263 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+16253 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16268 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -123193,9 +123701,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+15167 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+15182 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+16265 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+16280 /* "memory" */) == 0 { return 2 } else { return 0 @@ -123211,7 +123719,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+16272 /* "temporary storag..." */, 0) + ts+16287 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) @@ -123311,19 +123819,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 16334 /* "SET NULL" */ + zName = ts + 16349 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 16343 /* "SET DEFAULT" */ + zName = ts + 16358 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 16355 /* "CASCADE" */ + zName = ts + 16370 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 16363 /* "RESTRICT" */ + zName = ts + 16378 /* "RESTRICT" */ break default: - zName = ts + 16372 /* "NO ACTION" */ + zName = ts + 16387 /* "NO ACTION" */ break } return zName @@ -123341,7 +123849,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 16382 /* "delete" */, ts + 16389 /* "persist" */, ts + 16397 /* "off" */, ts + 16401 /* "truncate" */, ts + 16265 /* "memory" */, ts + 16410, /* "wal" */ + ts + 16397 /* "delete" */, ts + 16404 /* "persist" */, ts + 16412 /* "off" */, ts + 16416 /* "truncate" */, ts + 16280 /* "memory" */, ts + 16425, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -123387,13 +123895,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 16414 /* "w" */ + zType = ts + 16429 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 16416 /* "a" */ + zType = ts + 16431 /* "a" */ } else { - zType = ts + 16418 /* "s" */ + zType = ts + 16433 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16420, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16435, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -123402,7 +123910,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 16427 /* "utf8" */, ts + 16432 /* "utf16le" */, ts + 16440 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16442 /* "utf8" */, ts + 16447 /* "utf16le" */, ts + 16455 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -123671,7 +124179,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+16448 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+16463 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -123726,7 +124234,7 @@ __8: if !(*(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) __10: ; @@ -124307,7 +124815,7 @@ __18: if !(zRight != 0) { goto __63 } - if !(Xsqlite3_stricmp(tls, zRight, ts+16452 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+16467 /* "fast" */) == 0) { goto __64 } b = 2 @@ -124396,7 +124904,7 @@ __71: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 16236 /* "normal" */ + zRet = ts + 16251 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -124437,7 +124945,7 @@ __78: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __83 } - zRet = ts + 16226 /* "exclusive" */ + zRet = ts + 16241 /* "exclusive" */ __83: ; returnSingleText(tls, v, zRet) @@ -124802,7 +125310,7 @@ __123: if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 432 /* res */)) == 0)) { goto __126 } - Xsqlite3ErrorMsg(tls, pParse, ts+16457 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16472 /* "not a writable d..." */, 0) goto pragma_out __126: ; @@ -124820,7 +125328,7 @@ __127: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __128 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+16, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+16, zRight)) goto __129 __128: Xsqlite3_temp_directory = uintptr(0) @@ -124864,7 +125372,7 @@ __133: if !(res1 != SQLITE_OK) { goto __134 } - Xsqlite3ErrorMsg(tls, pParse, ts+16482 /* "failed to set lo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16497 /* "failed to set lo..." */, 0) goto pragma_out __134: ; @@ -124890,7 +125398,7 @@ __135: goto __137 } Xsqlite3ErrorMsg(tls, pParse, - ts+16512 /* "Safety level may..." */, 0) + ts+16527 /* "Safety level may..." */, 0) goto __138 __137: if !(iDb != 1) { @@ -125049,13 +125557,13 @@ __159: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 16565 /* "issisii" */ + return ts + 16580 /* "issisii" */ } - return ts + 16573 /* "issisi" */ + return ts + 16588 /* "issisi" */ }(), libc.VaList(bp+24, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+741 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+756 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -125130,7 +125638,7 @@ __171: goto __173 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16580 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16595 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -125140,7 +125648,7 @@ __171: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __174 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16585, /* "isiX" */ + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16600, /* "isiX" */ libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) @@ -125177,8 +125685,8 @@ __177: if !(pIdx1 != 0) { goto __179 } - *(*[3]uintptr)(unsafe.Pointer(bp + 448 /* azOrigin */)) = [3]uintptr{ts + 16590 /* "c" */, ts + 16592 /* "u" */, ts + 15066 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16594, /* "isisi" */ + *(*[3]uintptr)(unsafe.Pointer(bp + 448 /* azOrigin */)) = [3]uintptr{ts + 16605 /* "c" */, ts + 16607 /* "u" */, ts + 15081 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16609, /* "isisi" */ libc.VaList(bp+128, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), @@ -125212,7 +125720,7 @@ __180: __183: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16600, /* "iss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16615, /* "iss" */ libc.VaList(bp+168, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt))) @@ -125235,7 +125743,7 @@ __184: goto __186 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16604 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16619 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __185 __185: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -125299,7 +125807,7 @@ __196: goto __198 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16418 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16433 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __197 __197: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -125316,7 +125824,7 @@ __199: if !(i6 < (int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{}))))) { goto __201 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16418 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16433 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) goto __200 __200: i6++ @@ -125352,7 +125860,7 @@ __207: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __209 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16607, /* "iissssss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16622, /* "iissssss" */ libc.VaList(bp+224, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, @@ -125360,7 +125868,7 @@ __207: (*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */)))), // ON DELETE - ts+16616 /* "NONE" */)) + ts+16631 /* "NONE" */)) goto __208 __208: j2++ @@ -125553,7 +126061,7 @@ __236: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __237: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16621 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16636 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 480 /* aiCols */))) @@ -125819,7 +126327,7 @@ __264: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+16625 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+16640 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -125909,7 +126417,7 @@ __283: __284: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+16649 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+16664 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -125949,7 +126457,7 @@ __289: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+16669, /* "CHECK constraint..." */ + zErr1 = Xsqlite3MPrintf(tls, db, ts+16684, /* "CHECK constraint..." */ libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) @@ -125983,9 +126491,9 @@ __294: // Verify that an index entry exists for the current table row jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16699 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16714 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+16704 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16719 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -126025,7 +126533,7 @@ __298: Xsqlite3VdbeJumpHere(tls, v, jmp6) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16725 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16740 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __295: @@ -126047,7 +126555,7 @@ __290: if !(!(isQuick != 0)) { goto __300 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+16752 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+16767 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __301: @@ -126098,7 +126606,7 @@ __246: } (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 488 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*24)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16781 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16796 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*24)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __305: @@ -126176,7 +126684,7 @@ __312: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __314 } - Xsqlite3ErrorMsg(tls, pParse, ts+16784 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+16799 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) __314: ; __309: @@ -126288,19 +126796,19 @@ __48: if !(zRight != 0) { goto __321 } - if !(Xsqlite3StrICmp(tls, zRight, ts+16248 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16263 /* "full" */) == 0) { goto __322 } eMode2 = SQLITE_CHECKPOINT_FULL goto __323 __322: - if !(Xsqlite3StrICmp(tls, zRight, ts+16809 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16824 /* "restart" */) == 0) { goto __324 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __325 __324: - if !(Xsqlite3StrICmp(tls, zRight, ts+16401 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16416 /* "truncate" */) == 0) { goto __326 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -126487,7 +126995,7 @@ __341: __343: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+16817, /* "ANALYZE \"%w\".\"%w..." */ + zSubSql = Xsqlite3MPrintf(tls, db, ts+16832, /* "ANALYZE \"%w\".\"%w..." */ libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __344 @@ -126671,14 +127179,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 16835 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 16840 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 16846 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 16855 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 16864 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 16872 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 16880 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 16887 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16850 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16855 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16861 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16870 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16879 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16887 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16895 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16902 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -126735,7 +127243,7 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argc _ = argv Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+64 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16893 /* "CREATE TABLE x" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16908 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -126743,7 +127251,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16908 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16923 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -126756,19 +127264,19 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16915 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16930 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16921 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16936 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16933 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16948 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4477 /* ")" */, 1) Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) rc = Xsqlite3_declare_vtab(tls, db, bp+64 /* &zBuf[0] */) @@ -126784,7 +127292,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -126947,7 +127455,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) == uintptr(0) { return SQLITE_NOMEM } @@ -126963,13 +127471,13 @@ __2: __3: ; Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16948 /* "PRAGMA " */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16963 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16956 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16971 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) } Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16960 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16975 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) } zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { @@ -126978,7 +127486,7 @@ __3: rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -127071,12 +127579,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+16964 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), + ts+16979 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 16992 /* "rename" */ + return ts + 17007 /* "rename" */ } - return ts + 16999 /* "drop column" */ + return ts + 17014 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -127088,11 +127596,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - zObj = ts + 4518 /* "?" */ + zObj = ts + 4533 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+17011 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+17026 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+17042 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+17057 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -127169,7 +127677,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (db+184 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+13246 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+13261 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -127206,13 +127714,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+17050 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+17065 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (pIndex+88 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+13246 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+13261 /* "invalid rootpage" */) } } } @@ -127255,16 +127763,16 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 8219 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 8234 /* "table" */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 7309 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 17063 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 7324 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 17078 /* "CREATE TABLE x(t..." */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*8)) = uintptr(0) (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FiDb = iDb @@ -127377,7 +127885,7 @@ __10: goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+10895 /* "attached databas..." */) + ts+10910 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -127417,7 +127925,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+17135 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+17150 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -127439,7 +127947,7 @@ __18: (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+17159, /* "SELECT*FROM\"%w\"...." */ + ts+17174, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth @@ -127799,7 +128307,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+17193 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+17208 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -127827,7 +128335,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+17223 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+17238 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -127890,7 +128398,7 @@ __19: if !(*(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+2778 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2793 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */))) goto __21 __20: @@ -128365,24 +128873,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 10048 /* " " */ + var zSp uintptr = ts + 10063 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+17242 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+17257 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+17286 /* "RIGHT and FULL O..." */, 0) + ts+17301 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 17341 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 17356 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -128588,7 +129096,7 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17375 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+17390 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { @@ -128612,7 +129120,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17425 /* "cannot have both..." */, 0) + ts+17440 /* "cannot have both..." */, 0) return 1 } @@ -128647,7 +129155,7 @@ __1: if (iRightCol < 0) || !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17480 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + ts+17495 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, @@ -129438,16 +129946,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 17544 /* "UNION ALL" */ + z = ts + 17559 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 17554 /* "INTERSECT" */ + z = ts + 17569 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 17564 /* "EXCEPT" */ + z = ts + 17579 /* "EXCEPT" */ break default: - z = ts + 17571 /* "UNION" */ + z = ts + 17586 /* "UNION" */ break } return z @@ -129465,7 +129973,7 @@ func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite bp := tls.Alloc(8) defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17577 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17592 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -129731,8 +130239,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 11780 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 15156 /* "rowid" */ + zType = ts + 11795 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 15171 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), uintptr(0)) @@ -129885,13 +130393,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 15156 /* "rowid" */ + zCol = ts + 15171 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+11181 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+11196 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -129899,7 +130407,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+17600 /* "column%d" */, libc.VaList(bp+16, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+17615 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -129988,7 +130496,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } else { - zName = ts + 15156 /* "rowid" */ + zName = ts + 15171 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -130001,7 +130509,7 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+17600 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+17615 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, @@ -130016,7 +130524,7 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+17609 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) + zName = Xsqlite3MPrintf(tls, db, ts+17624 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) if *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) > U32(3) { Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &cnt */) } @@ -130373,7 +130881,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+17617 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17632 /* "cannot use windo..." */, 0) return __1: ; @@ -130484,7 +130992,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+17666 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17681 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -130506,7 +131014,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17708 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17723 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -130549,7 +131057,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17714 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17729 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -130599,11 +131107,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17729 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17744 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 2668 /* "S" */ + return ts + 2683 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -130755,8 +131263,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17752 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17767 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17767 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17782 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -130805,7 +131313,7 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17544 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17559 /* "UNION ALL" */, 0) rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) @@ -130881,7 +131389,7 @@ __23: pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 64 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17786 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17801 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+64 /* &uniondest */) @@ -130953,7 +131461,7 @@ __26: pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 104 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17786 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17801 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+104 /* &intersectdest */) @@ -131114,10 +131622,10 @@ func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17807 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17822 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+17853, /* "SELECTs to the l..." */ + ts+17868, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -131497,9 +132005,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6647 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6662 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6647 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6662 /* "ORDER" */) } // Compute the limit registers @@ -131528,7 +132036,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) Xsqlite3SelectDestInit(tls, bp+48 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17935 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17950 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -131536,7 +132044,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17946 /* "LEFT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17961 /* "LEFT" */, 0) Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -131550,7 +132058,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17951 /* "RIGHT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17966 /* "RIGHT" */, 0) Xsqlite3Select(tls, pParse, p, bp+48 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -131747,7 +132255,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 304 /* "BINARY" */ + return ts + 319 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -132960,12 +133468,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+14235 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+14250 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+14239 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+14254 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -133034,7 +133542,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+17957 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+17972 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -133145,7 +133653,7 @@ func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* s defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17975 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17990 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -133333,7 +133841,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+17998 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+18013 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -133349,7 +133857,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18041 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18056 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { @@ -133375,7 +133883,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+18064, /* "table %s has %d ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18079, /* "table %s has %d ..." */ libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 @@ -133386,9 +133894,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18102 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18117 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18136 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18151 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -133436,7 +133944,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+18174 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+18189 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -133563,7 +134071,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+18186, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18201, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -133582,7 +134090,7 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+18225, /* "access to view \"..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18240, /* "access to view \"..." */ libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -133590,7 +134098,7 @@ __1: ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+18256, /* "unsafe use of vi..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18271, /* "unsafe use of vi..." */ libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) @@ -133705,7 +134213,7 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName } else { - zSchemaName = ts + 18289 /* "*" */ + zSchemaName = ts + 18304 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { @@ -133754,7 +134262,7 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+11181 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+11196 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { @@ -133770,7 +134278,7 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+18291, /* "%s.%s.%s" */ + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+18306, /* "%s.%s.%s" */ libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } @@ -133790,9 +134298,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+18300 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18315 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+18318 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18333 /* "no tables specif..." */, 0) } } } @@ -133802,7 +134310,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+18338 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18353 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -133990,13 +134498,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+18369 /* "DISTINCT aggrega..." */, 0) + ts+18384 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18420 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18435 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -134196,19 +134704,19 @@ func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintpt if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18453, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18468, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 18465 /* " USING COVERING ..." */ + return ts + 18480 /* " USING COVERING ..." */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) } } @@ -134228,7 +134736,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7309 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7324 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -134530,7 +135038,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+18488, /* "target object/al..." */ + ts+18503, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -134610,7 +135118,7 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18542, /* "expected %d colu..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18557, /* "expected %d colu..." */ libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: @@ -134751,7 +135259,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+741 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+756 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -134816,7 +135324,7 @@ __35: (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18582 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18597 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) @@ -134878,7 +135386,7 @@ __44: __45: ; Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18597 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18612 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { @@ -135398,9 +135906,9 @@ __97: explainTempTable(tls, pParse, func() uintptr { if ((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 18613 /* "DISTINCT" */ + return ts + 18628 /* "DISTINCT" */ } - return ts + 18622 /* "GROUP BY" */ + return ts + 18637 /* "GROUP BY" */ }()) groupBySort = 1 @@ -135812,7 +136320,7 @@ __58: if !(int32((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+18613 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+18628 /* "DISTINCT" */) __140: ; @@ -135824,9 +136332,9 @@ __140: explainTempTable(tls, pParse, func() uintptr { if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { - return ts + 18631 /* "RIGHT PART OF OR..." */ + return ts + 18646 /* "RIGHT PART OF OR..." */ } - return ts + 18654 /* "ORDER BY" */ + return ts + 18669 /* "ORDER BY" */ }()) generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) @@ -135960,7 +136468,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + z = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) if !(z == uintptr(0)) { goto __10 } @@ -135982,7 +136490,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+18663 /* "sqlite3_get_tabl..." */, 0) + ts+18678 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -136081,7 +136589,7 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } @@ -136242,7 +136750,7 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+18728 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18743 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; @@ -136303,7 +136811,7 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18774 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18789 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+40 /* &sFix */, pTableName) != 0) { goto __9 } @@ -136321,7 +136829,7 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+18782 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18797 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; @@ -136336,7 +136844,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18774 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18789 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -136352,7 +136860,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+18823 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+18838 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -136366,10 +136874,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18849 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18864 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -136379,12 +136887,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+18887, /* "cannot create %s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18902, /* "cannot create %s..." */ libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 18924 /* "BEFORE" */ + return ts + 18939 /* "BEFORE" */ } - return ts + 18931 /* "AFTER" */ + return ts + 18946 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -136393,7 +136901,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+18937 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + ts+18952 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -136423,9 +136931,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -136559,7 +137067,7 @@ __2: __3: ; Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18774 /* "trigger" */, bp+40 /* &nameToken */) + Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18789 /* "trigger" */, bp+40 /* &nameToken */) if !((Xsqlite3FixTriggerStep(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || (Xsqlite3FixExpr(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 @@ -136596,13 +137104,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+18983, /* "INSERT INTO %Q.s..." */ + ts+18998, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+19058 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+19073 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -136868,7 +137376,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+19087 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+19102 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -136909,9 +137417,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -136924,7 +137432,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+19107, /* "DELETE FROM %Q.s..." */ + ts+19122, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -137043,12 +137551,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+19169, /* "%s RETURNING is ..." */ + ts+19184, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 19217 /* "DELETE" */ + return ts + 19232 /* "DELETE" */ } - return ts + 19224 /* "UPDATE" */ + return ts + 19239 /* "UPDATE" */ }())) __15: ; @@ -137144,7 +137652,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+19231 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19246 /* "RETURNING may no..." */, 0) return 1 } @@ -137285,7 +137793,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+5539 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+5554 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -137415,7 +137923,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+19273 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+19288 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -138118,7 +138626,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+19287, /* "cannot UPDATE ge..." */ + ts+19302, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto update_cleanup __27: @@ -138150,7 +138658,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+19323 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+19338 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -138161,7 +138669,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 7084 /* "ROWID" */ + return ts + 7099 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName }(), @@ -139192,7 +139700,7 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+19342 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+19357 /* "rows updated" */, uintptr(0)) __169: ; @@ -139579,10 +140087,10 @@ __1: if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { *(*int8)(unsafe.Pointer(bp + 216 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+19355 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+19370 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+19359 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) + ts+19374 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -139673,7 +140181,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+11322 /* "corrupt database" */, -1) + ts+11337 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -139741,7 +140249,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+19432 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+19436 /* "INS" */, uint64(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+19447 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+19451 /* "INS" */, uint64(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -139891,14 +140399,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19440 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19455 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19480 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19495 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -139909,7 +140417,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19523 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19538 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -139918,7 +140426,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 741 /* "" */ + zOut = ts + 756 /* "" */ __4: ; @@ -139954,7 +140462,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+19541 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+19556 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -139975,7 +140483,7 @@ __6: goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+19564 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19579 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -139991,7 +140499,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+13609 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+13624 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -140042,7 +140550,7 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+19591, /* "SELECT sql FROM ..." */ + ts+19606, /* "SELECT sql FROM ..." */ libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 @@ -140052,7 +140560,7 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+19699, /* "SELECT sql FROM ..." */ + ts+19714, /* "SELECT sql FROM ..." */ libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 @@ -140067,7 +140575,7 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+19753, /* "SELECT'INSERT IN..." */ + ts+19768, /* "SELECT'INSERT IN..." */ libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) @@ -140084,7 +140592,7 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+19904, /* "INSERT INTO vacu..." */ + ts+19919, /* "INSERT INTO vacu..." */ libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 @@ -140464,7 +140972,7 @@ func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintp var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11552 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11567 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -140558,7 +141066,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(pEnd)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+20034 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+20049 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -140570,7 +141078,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+20058, /* "UPDATE %Q.sqlite..." */ + ts+20073, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -140580,7 +141088,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+20157 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+20172 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -140645,7 +141153,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+20176 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+20191 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -140683,9 +141191,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20218 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20233 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2778 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2793 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) @@ -140697,7 +141205,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 20248 /* "vtable construct..." */ + var zFormat uintptr = ts + 20263 /* "vtable construct..." */ *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR @@ -140713,12 +141221,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+741 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+756 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+15069 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+15084 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -140777,13 +141285,13 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+20294 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+20309 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) @@ -140845,7 +141353,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20294 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20309 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -140922,7 +141430,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)))) @@ -141294,7 +141802,7 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 @@ -141725,10 +142233,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 20313 /* "" */ + return ts + 20328 /* "" */ } if i == (-1) { - return ts + 15156 /* "rowid" */ + return ts + 15171 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*32)).FzName } @@ -141743,35 +142251,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+20320 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+20335 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+20326 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+20341 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11933 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11948 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4477 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+20326 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+20341 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11933 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11948 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+4518 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4533 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4477 /* ")" */, 1) } } @@ -141800,29 +142308,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+20328 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+20343 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+20320 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+20335 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 20331 /* "%s=?" */ + return ts + 20346 /* "%s=?" */ } - return ts + 20336 /* "ANY(%s)" */ + return ts + 20351 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+20344 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+20359 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+20346 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+20361 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4477 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -141867,11 +142375,11 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+80 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20348 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20363 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 20354 /* "SEARCH" */ + return ts + 20369 /* "SEARCH" */ } - return ts + 20361 /* "SCAN" */ + return ts + 20376 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -141881,38 +142389,38 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 10096 /* "PRIMARY KEY" */ + zFmt = ts + 10111 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 20366 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 20381 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 20399 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 20414 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 20424 /* "COVERING INDEX %..." */ + zFmt = ts + 20439 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 20442 /* "INDEX %s" */ + zFmt = ts + 20457 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20451 /* " USING " */, 7) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20466 /* " USING " */, 7) Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 20459 /* "=" */ + zRangeOp = ts + 20474 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 20461 /* ">? AND rowid<" */ + zRangeOp = ts + 20476 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 20344 /* ">" */ + zRangeOp = ts + 20359 /* ">" */ } else { - zRangeOp = ts + 20346 /* "<" */ + zRangeOp = ts + 20361 /* "<" */ } Xsqlite3_str_appendf(tls, bp+48, /* &str */ - ts+20475 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + ts+20490 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20513, /* " VIRTUAL TABLE I..." */ + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20528, /* " VIRTUAL TABLE I..." */ libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) @@ -143468,7 +143976,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20540 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20555 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -143487,7 +143995,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20555 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20570 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -144235,10 +144743,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 15027 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 14497 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 14047 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 20564 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 15042 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14512 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 14062 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20579 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -144939,7 +145447,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+20571 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20586 /* "ON clause refere..." */, 0) return } } @@ -145015,7 +145523,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6171 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6186 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -145116,7 +145624,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { - return ts + 20612 /* "NOCASE" */ + return ts + 20627 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -145418,7 +145926,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+20619, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+20634, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -146241,7 +146749,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+20655 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+20670 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*32)).FzName)) sentWarning = U8(1) __6: @@ -146322,7 +146830,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20681 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20696 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -146555,7 +147063,7 @@ __3: ((uint64(unsafe.Sizeof(sqlite3_index_constraint{})) + uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint64(nTerm))) + (uint64(unsafe.Sizeof(sqlite3_index_orderby{})) * uint64(nOrderBy))) + uint64(unsafe.Sizeof(HiddenIndexInfo1{}))))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5577 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5592 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*96) @@ -146682,9 +147190,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -148734,7 +149242,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20692 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20707 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -148782,7 +149290,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+20692 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20707 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -149171,7 +149679,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+20718 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+20733 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -149940,7 +150448,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+20753 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20768 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -150321,7 +150829,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+20771 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+20786 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) return uintptr(0) __3: ; @@ -150395,7 +150903,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20799 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20814 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -151530,7 +152038,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+20817 /* "second argument ..." */, -1) + pCtx, ts+20832 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -151679,7 +152187,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+20873 /* "argument of ntil..." */, -1) + pCtx, ts+20888 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -151776,17 +152284,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20918 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20929 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20940 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20945 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20958 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20968 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20974 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20985 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20995 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 21007 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 21012 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20933 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20944 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20955 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20960 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20973 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20983 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20989 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 21000 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 21010 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 21022 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 21027 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -151850,7 +152358,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21016 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+21031 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -151894,12 +152402,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+21035 /* "RANGE with offse..." */, 0) + ts+21050 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+21106 /* "FILTER clause ma..." */, 0) + ts+21121 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -151922,7 +152430,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7309 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7324 /* "1" */) } break } @@ -152164,7 +152672,7 @@ func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+7370 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+7385 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -152294,7 +152802,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6917 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -152434,7 +152942,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+21169 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21184 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -152500,15 +153008,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 21201 /* "PARTITION clause" */ + zErr = ts + 21216 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 21218 /* "ORDER BY clause" */ + zErr = ts + 21233 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 21234 /* "frame specificat..." */ + zErr = ts + 21249 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+21254 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+21269 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -152531,7 +153039,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+21287 /* "DISTINCT is not ..." */, 0) + ts+21302 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -152682,7 +153190,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+741 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+756 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -152704,11 +153212,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 21334, /* "frame starting o..." */ - ts + 21387, /* "frame ending off..." */ - ts + 20817, /* "second argument ..." */ - ts + 21438, /* "frame starting o..." */ - ts + 21490, /* "frame ending off..." */ + ts + 21349, /* "frame starting o..." */ + ts + 21402, /* "frame ending off..." */ + ts + 20832, /* "second argument ..." */ + ts + 21453, /* "frame starting o..." */ + ts + 21505, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -153310,7 +153818,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+741 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+756 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -154325,19 +154833,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21540, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21555, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 18654 /* "ORDER BY" */ + return ts + 18669 /* "ORDER BY" */ } - return ts + 21582 /* "LIMIT" */ + return ts + 21597 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+21588 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21603 /* "too many terms i..." */, 0) } } @@ -154417,7 +154925,7 @@ func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdT var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21622, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21637, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -155644,7 +156152,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+21660 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21675 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -156623,11 +157131,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+15156 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+15171 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+21682 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+21697 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) } } break @@ -157362,7 +157870,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21709 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21724 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -157515,7 +158023,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(bp + 96 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21718 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21733 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) @@ -157719,9 +158227,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { - return ts + 7309 /* "1" */ + return ts + 7324 /* "1" */ } - return ts + 6902 /* "0" */ + return ts + 6917 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -157996,21 +158504,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+21742 /* "qualified table ..." */, 0) + ts+21757 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21837 /* "the INDEXED BY c..." */, 0) + ts+21852 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21921 /* "the NOT INDEXED ..." */, 0) + ts+21936 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ @@ -158459,9 +158967,9 @@ func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor To _ = yymajor // Silence some compiler warnings if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21718 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21733 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+22006 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+22021 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -159668,7 +160176,7 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+22023 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+22038 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } @@ -159688,12 +160196,12 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2778 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2793 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+22050, /* "%s in \"%s\"" */ + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+22065, /* "%s in \"%s\"" */ libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ @@ -159905,7 +160413,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+22061 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+22076 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -159918,11 +160426,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18774 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18789 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+22068 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+22083 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+22073 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+22088 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -159935,9 +160443,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+22083 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+22098 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+22087 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+22102 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -160965,7 +161473,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22095 /* "unable to close ..." */, 0) + ts+22110 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -161187,23 +161695,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 22163 /* "unknown error" */ + var zErr uintptr = ts + 22178 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 22177 /* "abort due to ROL..." */ + zErr = ts + 22192 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 22199 /* "another row avai..." */ + zErr = ts + 22214 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 22221 /* "no more rows ava..." */ + zErr = ts + 22236 /* "no more rows ava..." */ break } @@ -161221,35 +161729,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 22244, /* "not an error" */ - /* SQLITE_ERROR */ ts + 22257, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 22259, /* "not an error" */ + /* SQLITE_ERROR */ ts + 22272, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 22273, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 22298, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 22312, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 22331, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 5577, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 22356, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 22393, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 22405, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 22420, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 22453, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 22471, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 22496, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 22525, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 22288, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 22313, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 22327, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 22346, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5592, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 22371, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 22408, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 22420, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 22435, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 22468, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22486, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22511, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22540, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 5307, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 4844, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 22542, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 22560, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 22578, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 5322, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4859, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22557, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22575, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22593, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 22612, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 22627, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 22633, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 22659, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 22682, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 22703, /* "warning message" */ + /* SQLITE_RANGE */ ts + 22648, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22674, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22697, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22718, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -161414,7 +161922,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22719 /* "unable to delete..." */, 0) + ts+22734 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -161547,7 +162055,7 @@ func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUs _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+22782 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+22797 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -161769,7 +162277,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22833 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22848 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -161988,7 +162496,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22854 /* "unable to delete..." */, 0) + ts+22869 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -162131,7 +162639,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22922 /* "file:" */, uint64(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22937 /* "file:" */, uint64(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -162179,10 +162687,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22928 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22943 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22938, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22953, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -162304,7 +162812,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22966 /* "vfs" */, zOpt, uint64(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22981 /* "vfs" */, zOpt, uint64(3)) == 0)) { goto __29 } zVfs = zVal @@ -162315,17 +162823,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22970 /* "cache" */, zOpt, uint64(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22985 /* "cache" */, zOpt, uint64(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 22970 /* "cache" */ + zModeType = ts + 22985 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22976 /* "mode" */, zOpt, uint64(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22991 /* "mode" */, zOpt, uint64(4)) == 0)) { goto __32 } @@ -162333,7 +162841,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 2385 /* "access" */ + zModeType = ts + 2400 /* "access" */ __32: ; @@ -162364,7 +162872,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22981 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22996 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -162372,7 +162880,7 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23001, /* "%s mode not allo..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23016, /* "%s mode not allo..." */ libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out @@ -162415,7 +162923,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23025 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23040 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -162439,15 +162947,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 23041 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 23048 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 23056 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 23063 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 23056 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 23059 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 23062 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 16265 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 23071 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 23074 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 23077 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 16280 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -162629,10 +163137,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+20612 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+20627 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+23066 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+23081 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -162678,7 +163186,7 @@ __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -162716,9 +163224,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5854 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5869 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 22068 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 22083 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -162836,7 +163344,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 23072 /* "\x00\x00" */ + zFilename = ts + 23087 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -162939,24 +163447,24 @@ func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) bp := tls.Alloc(24) defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+23075, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+23090, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+23100 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+23115 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+23120 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+23135 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+23127 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+23142 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -163083,7 +163591,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 11780 /* "INTEGER" */ + zDataType = ts + 11795 /* "INTEGER" */ primarykey = 1 __13: ; @@ -163135,14 +163643,14 @@ __19: goto __20 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+23144 /* "no such table co..." */, libc.VaList(bp, zTableName, + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+23159 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -163941,7 +164449,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+23172 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+23187 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -164102,7 +164610,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 23180 /* "database is dead..." */ + return ts + 23195 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -164902,7 +165410,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 5654 /* "null" */, ts + 6166 /* "true" */, ts + 6171 /* "false" */, ts + 5664 /* "integer" */, ts + 5659 /* "real" */, ts + 13919 /* "text" */, ts + 23203 /* "array" */, ts + 23209, /* "object" */ + ts + 5669 /* "null" */, ts + 6181 /* "true" */, ts + 6186 /* "false" */, ts + 5679 /* "integer" */, ts + 5674 /* "real" */, ts + 13934 /* "text" */, ts + 23218 /* "array" */, ts + 23224, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -165082,7 +165590,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 23216 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 23231 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -165110,7 +165618,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+5654 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+5669 /* "null" */, uint32(4)) break } @@ -165139,7 +165647,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+23233 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+23248 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -165216,19 +165724,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+5654 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5669 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+6166 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+6181 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+6171 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+6186 /* "false" */, uint32(5)) break } @@ -165794,17 +166302,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5654 /* "null" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5669 /* "null" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6166 /* "true" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6181 /* "true" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6171 /* "false" */, uint64(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6186 /* "false" */, uint64(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -165912,7 +166420,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+23262 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+23277 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -166232,7 +166740,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+23277 /* "[0]" */, uint64(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+23292 /* "[0]" */, uint64(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -166249,7 +166757,7 @@ func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190 bp := tls.Alloc(8) defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+23281 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+23296 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -166316,7 +166824,7 @@ func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlit bp := tls.Alloc(8) defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+23307, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+23322, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -166460,7 +166968,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+5654 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+5669 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -166588,14 +167096,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+23350 /* "json_object() re..." */, -1) + ts+23365 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+23401 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+23416 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -166703,7 +167211,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+14430 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+14445 /* "replace" */) return __2: ; @@ -166789,9 +167297,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 23435 /* "set" */ + return ts + 23450 /* "set" */ } - return ts + 23439 /* "insert" */ + return ts + 23454 /* "insert" */ }()) return __2: @@ -166939,7 +167447,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+23446 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23461 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -167044,7 +167552,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+23449 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23464 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -167097,7 +167605,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+23452 /* "CREATE TABLE x(k..." */) + ts+23467 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -167235,14 +167743,14 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*16) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+23535 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+23550 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 16 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23540 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23555 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } @@ -167335,9 +167843,9 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+24 /* &x */, ts+23535 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23550 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23540 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23555 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } jsonResult(tls, bp+24 /* &x */) @@ -167361,7 +167869,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 23546 /* "$" */ + zRoot = ts + 23561 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -167493,7 +168001,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+23262 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+23277 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -167634,21 +168142,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 23548 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23553 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23564 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23564 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23582 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23595 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23607 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23619 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23630 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23641 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23653 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23666 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 23675 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23675 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23685 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23563 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23568 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23579 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23579 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23597 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23610 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23622 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23634 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23645 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23656 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23668 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23681 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23690 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23690 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23700 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -167658,17 +168166,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 23696 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 23711 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 23713 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 23728 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 23731 /* "json_each" */, FpModule: 0}, - {FzName: ts + 23741 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 23746 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23756 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -168018,11 +168526,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+23751 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23766 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23759 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23774 /* "data" */, iNode, 0, (pRtree + 112 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -168267,7 +168775,7 @@ func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+23764, /* "DROP TABLE '%q'...." */ + ts+23779, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -169027,7 +169535,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23846 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23861 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -169291,7 +169799,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -170551,7 +171059,7 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+23860 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+23875 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { @@ -170563,12 +171071,12 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if iCol == 0 { var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23880 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+23895 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23912 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+23927 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } @@ -170836,7 +171344,7 @@ func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqli var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+23949 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+23964 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -170874,7 +171382,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit bp := tls.Alloc(24) defer tls.Free(24) - var zFmt uintptr = ts + 24094 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 24109 /* "SELECT stat FROM..." */ var zSql uintptr // var p uintptr at bp+16, 8 @@ -170882,7 +171390,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10468 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10483 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -170935,7 +171443,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 24150 /* "node" */, ts + 4570 /* "parent" */, ts + 15156, /* "rowid" */ + ts + 24165 /* "node" */, ts + 4585 /* "parent" */, ts + 15171, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -170979,19 +171487,19 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+24155, /* "CREATE TABLE \"%w..." */ + ts+24170, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+24217 /* ",a%d" */, libc.VaList(bp+16, ii)) + Xsqlite3_str_appendf(tls, p, ts+24232 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+24222, /* ");CREATE TABLE \"..." */ + ts+24237, /* ");CREATE TABLE \"..." */ libc.VaList(bp+24, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+24286, /* "CREATE TABLE \"%w..." */ + ts+24301, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+24356, /* "INSERT INTO \"%w\"..." */ + ts+24371, /* "INSERT INTO \"%w\"..." */ libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { @@ -171022,7 +171530,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 24405 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 24420 /* "INSERT INTO\"%w\"...." */ } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { @@ -171034,7 +171542,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+24513, /* "SELECT * FROM \"%..." */ + ts+24528, /* "SELECT * FROM \"%..." */ libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM @@ -171042,18 +171550,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+24558 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+24573 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+11933 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+11948 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+24585 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+24600 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+24607 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+24622 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+24615 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+24630 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -171069,18 +171577,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 24631, /* "INSERT OR REPLAC..." */ - ts + 24684, /* "DELETE FROM '%q'..." */ + ts + 24646, /* "INSERT OR REPLAC..." */ + ts + 24699, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 24729, /* "SELECT nodeno FR..." */ - ts + 24781, /* "INSERT OR REPLAC..." */ - ts + 24835, /* "DELETE FROM '%q'..." */ + ts + 24744, /* "SELECT nodeno FR..." */ + ts + 24796, /* "INSERT OR REPLAC..." */ + ts + 24850, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 24880, /* "SELECT parentnod..." */ - ts + 24938, /* "INSERT OR REPLAC..." */ - ts + 24993, /* "DELETE FROM '%q'..." */ + ts + 24895, /* "SELECT parentnod..." */ + ts + 24953, /* "INSERT OR REPLAC..." */ + ts + 25008, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -171127,7 +171635,7 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr var zSql uintptr if isCreate != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+25040 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, ts+25055 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) @@ -171135,19 +171643,19 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+25060, /* "SELECT length(da..." */ + ts+25075, /* "SELECT length(da..." */ libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 32 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+25117, /* "undersize RTree ..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+25132, /* "undersize RTree ..." */ libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -171198,17 +171706,17 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr ii = 4 *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 25152, /* "Wrong number of ..." */ // 1 - ts + 25195, /* "Too few columns ..." */ // 2 - ts + 25230, /* "Too many columns..." */ // 3 - ts + 25266, /* "Auxiliary rtree ..." */ // 4 + ts + 25167, /* "Wrong number of ..." */ // 1 + ts + 25210, /* "Too few columns ..." */ // 2 + ts + 25245, /* "Too many columns..." */ // 3 + ts + 25281, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) return SQLITE_ERROR __1: ; @@ -171238,7 +171746,7 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+25303, /* "CREATE TABLE x(%..." */ + Xsqlite3_str_appendf(tls, pSql, ts+25318, /* "CREATE TABLE x(%..." */ libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = 4 __3: @@ -171250,7 +171758,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+25327 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+25342 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -171273,7 +171781,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+25333 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25348 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -171284,14 +171792,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -171334,7 +171842,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) goto rtreeInit_fail __22: ; @@ -171352,7 +171860,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -171372,7 +171880,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 25336 /* ",%.*s REAL" */, ts + 25347 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 25351 /* ",%.*s REAL" */, ts + 25362 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -171427,13 +171935,13 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit nodeGetCell(tls, bp+56 /* &tree */, bp+16 /* &node */, ii, bp+1024 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+10048 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+10063 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+25357 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, ts+25372 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+25363 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+25378 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+25367 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+25382 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -171452,7 +171960,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+25369 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+25384 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -171541,12 +172049,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+25402, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+25417, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 3567 /* "\n" */ + return ts + 3582 /* "\n" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -171577,7 +172085,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+25409, /* "SELECT data FROM..." */ + ts+25424, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -171596,7 +172104,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+25454 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+25469 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -171620,8 +172128,8 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa var rc int32 var pStmt uintptr *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ - ts + 25486, /* "SELECT parentnod..." */ - ts + 25540, /* "SELECT nodeno FR..." */ + ts + 25501, /* "SELECT parentnod..." */ + ts + 25555, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) == uintptr(0) { @@ -171636,23 +172144,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+25588, /* "Mapping (%lld ->..." */ + rtreeCheckAppendMsg(tls, pCheck, ts+25603, /* "Mapping (%lld ->..." */ libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 25633 /* "%_rowid" */ + return ts + 25648 /* "%_rowid" */ } - return ts + 25641 /* "%_parent" */ + return ts + 25656 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+25650, /* "Found (%lld -> %..." */ + ts+25665, /* "Found (%lld -> %..." */ libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 25633 /* "%_rowid" */ + return ts + 25648 /* "%_rowid" */ } - return ts + 25641 /* "%_parent" */ + return ts + 25656 /* "%_parent" */ }(), iKey, iVal)) } } @@ -171695,7 +172203,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+25708 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+25723 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { @@ -171715,7 +172223,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+25756 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + ts+25771 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -171738,14 +172246,14 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr if aNode != 0 { if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+25823 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + ts+25838 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+25857 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+25872 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } @@ -171753,7 +172261,7 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr nCell = readInt16(tls, (aNode + 2)) if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+25887, /* "Node %lld is too..." */ + ts+25902, /* "Node %lld is too..." */ libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { @@ -171787,14 +172295,14 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+25942, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+25957, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+25973 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + ts+25988 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -171824,13 +172332,13 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13609 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13624 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+26040 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+26055 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) @@ -171839,12 +172347,12 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23860 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23875 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+26068 /* "Schema corrupt o..." */, 0) + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+26083 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } @@ -171859,8 +172367,8 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+32 /* &check */, ts+26099 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+32 /* &check */, ts+26106 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+26114 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+26121 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check @@ -171870,7 +172378,7 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+26114 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + var rc int32 = Xsqlite3_exec(tls, db, ts+26129 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } @@ -171916,7 +172424,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+26118 /* "wrong number of ..." */, -1) + ts+26133 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -171924,7 +172432,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 5854 /* "main" */ + zDb = ts + 5869 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -171934,7 +172442,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 16781 /* "ok" */ + return ts + 16796 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -172371,11 +172879,11 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+26169 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+26184 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+26171 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+26186 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+26182 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+26197 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -172399,19 +172907,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+26193 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+26246 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -173427,7 +173935,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+26244 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+26259 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -173436,7 +173944,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+26266 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, ts+26281 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto __3 __3: ii++ @@ -173444,7 +173952,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+25333 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25348 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -173455,7 +173963,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -173481,7 +173989,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -173714,7 +174222,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 15156 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 15171 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -173724,7 +174232,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26270 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26285 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -173732,7 +174240,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26276 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26291 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -173870,7 +174378,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+26285 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+26300 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -174015,14 +174523,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+26325 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+26340 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+26341 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+26356 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -174087,7 +174595,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+26356 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26371 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -174099,25 +174607,25 @@ var aFunc1 = [12]struct { _ [6]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26364 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26377 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26390 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 26403 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26341 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 26415 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26325 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 26438 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26452 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26465 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26479 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26495 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26379 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26392 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26405 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 26418 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26356 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 26430 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26340 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 26453 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26467 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26480 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26494 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26510 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 26507 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 26522 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -174130,26 +174638,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+26526 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26541 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26536 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26551 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26547 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26562 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26270 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26285 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26558 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26573 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -174221,7 +174729,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23846 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23861 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -175512,7 +176020,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+26568 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26583 /* "corrupt fossil d..." */, -1) return } @@ -175523,7 +176031,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+26568 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26583 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -175544,7 +176052,7 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -175562,7 +176070,7 @@ func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -175666,7 +176174,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+26589 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + ts+26604 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -175750,7 +176258,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23759 /* "data" */, zIn, uint64(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23774 /* "data" */, zIn, uint64(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -175778,17 +176286,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26760 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+26775 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 26910 /* "AND rootpage!=0 ..." */ + return ts + 26925 /* "AND rootpage!=0 ..." */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 8 /* &.pIdxIter */), (p + 64 /* &.zErrmsg */), - ts+26951 /* "SELECT name, roo..." */) + ts+26966 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -175926,7 +176434,7 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -175989,7 +176497,7 @@ func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27076 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + ts+27091 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } @@ -176007,7 +176515,7 @@ __2: *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27157 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + Xsqlite3_mprintf(tls, ts+27172 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -176025,7 +176533,7 @@ __4: } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27178 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + ts+27193 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } @@ -176049,7 +176557,7 @@ __5: ; (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27229 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + Xsqlite3_mprintf(tls, ts+27244 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } @@ -176098,7 +176606,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.X__builtin___memcpy_chk(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)), libc.X__builtin_object_size(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27250 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+27265 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 @@ -176113,7 +176621,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.X__builtin___memset_chk(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)), libc.X__builtin_object_size(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+24 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)))) { var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)), 1) if iCid >= 0 { @@ -176163,7 +176671,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+56 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+18300 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+18315 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc @@ -176176,18 +176684,18 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // of the input table. Ignore any input table columns that begin with // "rbu_". (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27307 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + Xsqlite3_mprintf(tls, ts+27322 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+27326 /* "rbu_" */, zName, 4) != 0 { + if Xsqlite3_strnicmp(tls, ts+27341 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 56 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*8)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+27331 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+27346 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } @@ -176199,12 +176707,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+27341 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+27356 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 27370 /* "may not have" */ + return ts + 27385 /* "may not have" */ } - return ts + 27383 /* "requires" */ + return ts + 27398 /* "requires" */ }())) } @@ -176213,7 +176721,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27392 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+27407 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) { var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 1) @@ -176227,7 +176735,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27414, /* "column missing f..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27429, /* "column missing f..." */ libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 5) @@ -176273,12 +176781,12 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+27441 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 13720 /* ", " */ + zList = rbuMPrintf(tls, p, ts+27456 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13735 /* ", " */ } return zList } @@ -176293,13 +176801,13 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = rbuMPrintf(tls, p, ts+27450 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+27465 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -176338,25 +176846,25 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, if bRowid != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27463 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + ts+27478 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27495 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + zRet = rbuMPrintf(tls, p, ts+27510 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+741 /* "" */, ts+13720 /* ", " */, ts+27518 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27524 /* "quote(" */, ts+27531 /* "||','||" */, ts+4462 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+741 /* "" */, ts+13720 /* ", " */, ts+741 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13735 /* ", " */, ts+27533 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27539 /* "quote(" */, ts+27546 /* "||','||" */, ts+4477 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13735 /* ", " */, ts+756 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27539, /* "SELECT %s FROM \"..." */ + ts+27554, /* "SELECT %s FROM \"..." */ libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27581 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + zRet = rbuMPrintf(tls, p, ts+27596 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } @@ -176414,12 +176922,12 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 741 /* "" */ + zSep = ts + 756 /* "" */ iCol = 0 *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 @@ -176456,7 +176964,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) goto __7 __6: - zCol = ts + 27601 /* "_rowid_" */ + zCol = ts + 27616 /* "_rowid_" */ __7: ; goto __5 @@ -176465,13 +176973,13 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+27609, /* "%z%s \"%w\" COLLAT..." */ + zLhs = rbuMPrintf(tls, p, ts+27624, /* "%z%s \"%w\" COLLAT..." */ libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+27630, /* "%z%s \"rbu_imp_%d..." */ + zOrder = rbuMPrintf(tls, p, ts+27645, /* "%z%s \"rbu_imp_%d..." */ libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+27666, /* "%z%s quote(\"rbu_..." */ + zSelect = rbuMPrintf(tls, p, ts+27681, /* "%z%s quote(\"rbu_..." */ libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ iCol++ goto __1 __2: @@ -176490,12 +176998,12 @@ __11: *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+184 /* &pSel */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27693, /* "SELECT %s FROM \"..." */ + Xsqlite3_mprintf(tls, ts+27708, /* "SELECT %s FROM \"..." */ libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))))) { goto __13 } - zSep = ts + 741 /* "" */ + zSep = ts + 756 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -176517,8 +177025,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+27741 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) - zSep = ts + 13720 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+27756 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13735 /* ", " */ goto __15 __15: iCol++ @@ -176530,7 +177038,7 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+27748 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+27763 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: @@ -176580,14 +177088,14 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 741 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 741 /* "" */ // Set to " AND " later on + var zCom uintptr = ts + 756 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 756 /* "" */ // Set to " AND " later on *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { @@ -176599,9 +177107,9 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC if iCid == -2 { var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+27760 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + zRet = Xsqlite3_mprintf(tls, ts+27775 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FzSpan, zCollate)) - zType = ts + 741 /* "" */ + zType = ts + 756 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -176613,37 +177121,37 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 27601 /* "_rowid_" */ + zCol = ts + 27616 /* "_rowid_" */ } else { - zCol = ts + 27331 /* "rbu_rowid" */ + zCol = ts + 27346 /* "rbu_rowid" */ } - zType = ts + 11780 /* "INTEGER" */ + zType = ts + 11795 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, ts+27782 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+27797 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 27518 /* " DESC" */ + return ts + 27533 /* " DESC" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+27802, /* "%z%s\"rbu_imp_%d%..." */ + zImpPK = Xsqlite3_mprintf(tls, ts+27817, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+27823, /* "%z%s\"rbu_imp_%d%..." */ + zImpCols = Xsqlite3_mprintf(tls, ts+27838, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+27856 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + ts+27871 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 13720 /* ", " */ - zAnd = ts + 20320 /* " AND " */ + zCom = ts + 13735 /* ", " */ + zAnd = ts + 20335 /* " AND " */ nBind++ } @@ -176686,16 +177194,16 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 741 /* "" */ + var zS uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, ts+27880 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+27895 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+27892 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+27907 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 13720 /* ", " */ + zS = ts + 13735 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -176704,7 +177212,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27901 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+27916 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -176724,27 +177232,27 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27916 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+27931 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+27930 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) - zSep = ts + 20320 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27945 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 20335 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+27942 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + ts+27957 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+27992 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) - zSep = ts + 20320 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+28007 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 20335 /* " AND " */ } } } @@ -176758,7 +177266,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28005 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28020 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -176787,21 +177295,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+27992, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+28007, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+28031, /* "%z%s\"%w\"=rbu_del..." */ + zList = rbuMPrintf(tls, p, ts+28046, /* "%z%s\"%w\"=rbu_del..." */ libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+28061, /* "%z%s\"%w\"=rbu_fos..." */ + zList = rbuMPrintf(tls, p, ts+28076, /* "%z%s\"%w\"=rbu_fos..." */ libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ } } } @@ -176859,19 +177367,19 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 28098 /* "PRIMARY KEY(" */ + var zSep uintptr = ts + 28113 /* "PRIMARY KEY(" */ *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27250 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+27265 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+15066 /* "pk" */) == 0) { + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+15081 /* "pk" */) == 0) { var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } @@ -176884,15 +177392,15 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 2) var zDesc uintptr if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 3) != 0 { - zDesc = ts + 27518 /* " DESC" */ + zDesc = ts + 27533 /* " DESC" */ } else { - zDesc = ts + 741 /* "" */ + zDesc = ts + 756 /* "" */ } - z = rbuMPrintf(tls, p, ts+28111 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = ts + 13720 /* ", " */ + z = rbuMPrintf(tls, p, ts+28126 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13735 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+28122 /* "%z)" */, libc.VaList(bp+48, z)) + z = rbuMPrintf(tls, p, ts+28137 /* "%z)" */, libc.VaList(bp+48, z)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */))) } return z @@ -176924,7 +177432,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 741 /* "" */ + var zComma uintptr = ts + 756 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration @@ -176932,7 +177440,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 64 /* &.zErrmsg */), - ts+28126 /* "SELECT name FROM..." */) + ts+28141 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { @@ -176941,7 +177449,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit } if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) @@ -176951,25 +177459,25 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+28176 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + zCols = rbuMPrintf(tls, p, ts+28191 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+28198 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+28213 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 27518 /* " DESC" */ + return ts + 27533 /* " DESC" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) - zComma = ts + 13720 /* ", " */ + zComma = ts + 13735 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+28208 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + zCols = rbuMPrintf(tls, p, ts+28223 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28223, /* "CREATE TABLE rbu..." */ + ts+28238, /* "CREATE TABLE rbu..." */ libc.VaList(bp+120, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 0)) } } @@ -176997,52 +177505,52 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 741 /* "" */ + var zComma uintptr = ts + 756 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 741 /* "" */ + var zPk uintptr = ts + 756 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 28285 /* "PRIMARY KEY " */ + zPk = ts + 28300 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+28298, /* "%z%s\"%w\" %s %sCO..." */ + zSql = rbuMPrintf(tls, p, ts+28313, /* "%z%s\"%w\" %s %sCO..." */ libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 28325 /* " NOT NULL" */ + return ts + 28340 /* " NOT NULL" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) - zComma = ts + 13720 /* ", " */ + zComma = ts + 13735 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+28335 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+28350 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+28342, /* "CREATE TABLE \"rb..." */ + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+28357, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 28374 /* " WITHOUT ROWID" */ + return ts + 28389 /* " WITHOUT ROWID" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 0)) } } @@ -177065,7 +177573,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 152 /* &.pTmpInsert */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+28389, /* "INSERT INTO %s.'..." */ + ts+28404, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -177102,7 +177610,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+28446 /* "SELECT trim(sql)..." */) + ts+28461 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -177212,7 +177720,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+28512 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+28527 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -177233,26 +177741,26 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 624 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28532, /* "CREATE TABLE \"rb..." */ + ts+28547, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 0)) // Create the statement to insert index entries (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28597 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+28612 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28633 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+28648 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -177269,7 +177777,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+28667, /* "SELECT %s, 0 AS ..." */ + ts+28682, /* "SELECT %s, 0 AS ..." */ libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, @@ -177277,32 +177785,32 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 28728 /* "AND" */ + return ts + 28743 /* "AND" */ } - return ts + 28732 /* "WHERE" */ + return ts + 28747 /* "WHERE" */ }() } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+28738, /* "SELECT %s, rbu_c..." */ + ts+28753, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+216, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+28799, /* "SELECT %s, rbu_c..." */ + ts+28814, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+264, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 28728 /* "AND" */ + return ts + 28743 /* "AND" */ } - return ts + 28732 /* "WHERE" */ + return ts + 28747 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -177327,8 +177835,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5863 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5859 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5878 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5874 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -177338,21 +177846,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 28958 /* "rbu_imp_" */ + return ts + 28973 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+28967, /* "INSERT INTO \"%s%..." */ + ts+28982, /* "INSERT INTO \"%s%..." */ libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 29003 /* ", _rowid_" */ + return ts + 29018 /* ", _rowid_" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zBindings))) } @@ -177362,28 +177870,28 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+29013 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + ts+29028 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 741 /* "" */ + var zRbuRowid uintptr = ts + 756 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 29041 /* ", rbu_rowid" */ + zRbuRowid = ts + 29056 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29053 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+29068 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 29129 /* ", 0 AS rbu_rowid" */ + return ts + 29144 /* ", 0 AS rbu_rowid" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29146, /* "CREATE TEMP TRIG..." */ + ts+29161, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) @@ -177391,7 +177899,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29445, /* "CREATE TEMP TRIG..." */ + ts+29460, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } @@ -177400,14 +177908,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 741 /* "" */ + var zRbuRowid uintptr = ts + 756 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 29544 /* ",_rowid_ " */ + zRbuRowid = ts + 29559 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 29554 /* ",rbu_rowid" */ + zRbuRowid = ts + 29569 /* ",rbu_rowid" */ } } @@ -177420,35 +177928,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+27601 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+27616 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+741 /* "" */, ts+13720 /* ", " */, ts+741 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13735 /* ", " */, ts+756 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+29565, /* "SELECT %s,%s rbu..." */ + ts+29580, /* "SELECT %s,%s rbu..." */ libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 29613 /* "0 AS " */ + return ts + 29628 /* "0 AS " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 18654 /* "ORDER BY" */ + return ts + 18669 /* "ORDER BY" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zOrder, zLimit))) } @@ -177523,12 +178031,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 741 /* "" */ + var zPrefix uintptr = ts + 756 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 28958 /* "rbu_imp_" */ + zPrefix = ts + 28973 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+29619, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+29634, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 8 /* &.pUpdate */), (p + 64 /* &.zErrmsg */), zUpdate) @@ -177555,7 +178063,7 @@ func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uin return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } @@ -177596,7 +178104,7 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ } *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29649 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) + Xsqlite3_mprintf(tls, ts+29664 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: @@ -177668,31 +178176,31 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29679 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29694 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29706 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+2399 /* "stat" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29721 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+2414 /* "stat" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) } else { - libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+5854 /* "main" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) + libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+5869 /* "main" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29724 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29739 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -177725,11 +178233,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29790 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29805 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22922 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22937 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -177741,16 +178249,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+29822, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+29837, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 29854 /* "&" */ + return ts + 29869 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } return zExtra }())) @@ -177766,40 +178274,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29856 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29871 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29871 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+29886 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29888 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29903 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29904 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29919 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29932 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29947 /* "rbu vfs not foun..." */, 0) } } @@ -177868,7 +178376,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29904 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29919 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -177902,7 +178410,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29950 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29965 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -178029,16 +178537,16 @@ func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ bp := tls.Alloc(16) defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+29985 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+29992 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+30000 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+30007 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -178178,7 +178686,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22560 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22575 /* "datatype mismatc..." */, 0) return } @@ -178296,7 +178804,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // var pStmt uintptr at bp+8, 8 (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+29999 /* "PRAGMA schema_ve..." */) + ts+30014 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot @@ -178309,7 +178817,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30021 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30036 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -178334,7 +178842,7 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+30048, /* "INSERT OR REPLAC..." */ + ts+30063, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+48, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -178379,9 +178887,9 @@ func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+30206 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + Xsqlite3_mprintf(tls, ts+30221 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30221, /* "PRAGMA main.%s =..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30236, /* "PRAGMA main.%s =..." */ libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) @@ -178398,11 +178906,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30241 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30256 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+30266 /* "SELECT sql FROM ..." */) + ts+30281 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -178416,12 +178924,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+30374 /* "SELECT * FROM sq..." */) + ts+30389 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8 /* &pInsert */, (p + 64 /* &.zErrmsg */), - ts+30439 /* "INSERT INTO sqli..." */) + ts+30454 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -178433,7 +178941,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30483 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30498 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -178455,8 +178963,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+16138 /* "user_version" */) - rbuCopyPragma(tls, p, ts+15244 /* "application_id" */) + rbuCopyPragma(tls, p, ts+16153 /* "user_version" */) + rbuCopyPragma(tls, p, ts+15259 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -178467,7 +178975,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30508 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+30523 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -178493,10 +179001,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -178613,7 +179121,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30536 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30551 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -178632,7 +179140,7 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ bp := tls.Alloc(8) defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+29985 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+30000 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -178654,7 +179162,7 @@ func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ // var zRnd [64]int8 at bp+12, 64 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30561 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30576 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) @@ -178693,7 +179201,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+16, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+30572 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+30587 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)), -1) } else { @@ -178736,7 +179244,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30644 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30659 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -178744,7 +179252,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30658 /* "SELECT 1 FROM sq..." */) + ts+30673 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -178756,7 +179264,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30715 /* "SELECT sum(cnt *..." */) + ts+30730 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -178802,7 +179310,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.X__builtin___memcpy_chk(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + uint64(1)), libc.X__builtin_object_size(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 0)) pCsr += (uintptr(nRbu + uint64(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2778 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2793 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -178839,7 +179347,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30789 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30804 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -178861,12 +179369,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30821, /* "database modifie..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30836, /* "database modifie..." */ libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30853 /* "vacuum" */ + return ts + 30868 /* "vacuum" */ } - return ts + 30860 /* "update" */ + return ts + 30875 /* "update" */ }())) } } @@ -178874,7 +179382,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13609 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -178888,24 +179396,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+15863 /* "page_size" */) - rbuCopyPragma(tls, p, ts+15259 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+15878 /* "page_size" */) + rbuCopyPragma(tls, p, ts+15274 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30867 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30882 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+5854 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+5869 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+30883 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + db, ts+30898 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } } @@ -178958,7 +179466,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30907 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30922 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { return rbuMisuseError(tls) } } @@ -178988,7 +179496,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); Size_t(i) < (nErrmsg - uint64(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28958 /* "rbu_imp_" */, uint64(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28973 /* "rbu_imp_" */, uint64(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -179007,7 +179515,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -179019,7 +179527,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Close any open statement handles. @@ -179031,7 +179539,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30915 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30930 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -179130,7 +179638,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -179147,19 +179655,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 13609 /* "BEGIN" */ + zBegin = ts + 13624 /* "BEGIN" */ } else { - zBegin = ts + 30867 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 30882 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30867 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30882 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -179563,7 +180071,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30942 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30957 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -179586,7 +180094,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+30965 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30980 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -179749,7 +180257,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5854 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5869 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -179764,7 +180272,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+30976 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+30991 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -180071,6 +180579,5673 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + _ [4]byte + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + _ [4]byte + FaData uintptr + FnData int32 + _ [4]byte + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 + _ [4]byte +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.X__builtin___memcpy_chk(tls, bp /* &i */, bp+8 /* &r */, uint64(8), libc.X__builtin_object_size(tls, bp /* &i */, 0)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nVarint + 1))), z, uint64(n), libc.X__builtin_object_size(tls, (aBuf+uintptr((nVarint+1))), 0)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 8 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &iVal */, 0)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.X__builtin___memcpy_chk(tls, aOut, a2, uint64(n2), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(n2) + } else { + libc.X__builtin___memcpy_chk(tls, aOut, a1, uint64(n1), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+16, 4 + + var aOld uintptr + // var nNew int32 at bp+40, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+16 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+40 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.X__builtin___memcpy_chk(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+44, 4 + + var aOld uintptr + // var nNew int32 at bp+48, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+44 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+48 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 44 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.X__builtin___memcpy_chk(tls, aOut, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 8 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &rVal */, 0)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.X__builtin___memset_chk(tls, apNew, 0, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew))), libc.X__builtin_object_size(tls, apNew, 0)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 8 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10483 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+31002 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+756 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+31123 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(uint64(nDbCol) * ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))) + uint64(1))))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*8) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.X__builtin___memcpy_chk(tls, pAlloc, zThis, (uint64(nThis + 1)), libc.X__builtin_object_size(tls, pAlloc, 0)) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.X__builtin___memcpy_chk(tls, pAlloc, zName, (uint64(nName + 1)), libc.X__builtin_object_size(tls, pAlloc, 0)) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 8 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 16 /* &.nCol */), uintptr(0), (pTab + 24 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10483 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += I64((uint64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + uint64(1)))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 24 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 32 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.X__builtin___memcpy_chk(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp+24 /* &dVal */, 0)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + // var iHash int32 at bp+48, 4 + + // var bNull int32 at bp+52, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 48 + + var p uintptr + // var p1 uintptr at bp+56, 8 + + // var p2 uintptr at bp+72, 8 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+64, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 24 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+756 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+48 /* &iHash */, bp+52 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)), bp+64 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.X__builtin___memset_chk(tls, pC, 0, uint64(unsafe.Sizeof(SessionChange{})), libc.X__builtin_object_size(tls, pC, 0)) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*32) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)), bp+64 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 48 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 8 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 + _ [4]byte +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+31152, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 20335 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+31186, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 31227 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6917 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+31232, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+31310, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 16 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+24, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+40, 8 + + // var azCol uintptr at bp+32, 8 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+16, 8 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.X__builtin___memset_chk(tls, bp /* &d */, 0, uint64(unsafe.Sizeof(SessionDiffCtx{})), libc.X__builtin_object_size(tls, bp /* &d */, 0)) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+16 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24 /* &nCol */, uintptr(0), bp+32 /* &azCol */, bp+40 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol + uintptr(i)*8))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+31363 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(Sqlite3_session{})) + uint64(nDb)) + uint64(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_session{})), libc.X__builtin_object_size(tls, pNew, 0)) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*136) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.X__builtin___memcpy_chk(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint64(nDb + 1)), libc.X__builtin_object_size(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, 0)) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 8 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 80 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionTable{})) + uint64(nName)) + uint64(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.X__builtin___memset_chk(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{})), libc.X__builtin_object_size(tls, pTab, 0)) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*56) + libc.X__builtin___memcpy_chk(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint64(nName + 1)), libc.X__builtin_object_size(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, 0)) + for ppTab = (pSession + 88 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.X__builtin___memcpy_chk(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint64(nBlob), libc.X__builtin_object_size(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), 0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.X__builtin___memcpy_chk(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint64(nStr), libc.X__builtin_object_size(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), 0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([24]int8{})) - uint64(1))), bp+8 /* &aBuf[0] */, ts+4500 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = (int32((int64(zOut) - int64((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.X__builtin___memcpy_chk(tls, bp /* &i */, bp+8 /* &r */, uint64(8), libc.X__builtin_object_size(tls, bp /* &i */, 0)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &dVal */, 0)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+32 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+32 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, (int32((int64(a) - int64(pStart)) / 1)), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10483 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+31390 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 756 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31500 /* "SELECT * FROM " */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+769 /* "." */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31515 /* " WHERE " */, bp+24 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31523 /* " IS ?" */, bp+24 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+24 /* &rc */) + zSep = ts + 20335 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.X__builtin___memcpy_chk(tls, bp /* &rVal */, bp+8 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp /* &rVal */, 0)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+40, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31529 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+16, 8 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+8 /* &azCol */, bp+16 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+24 /* &buf */, bPatchset, pTab, bp+40 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), bp+48 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+24 /* &buf */, uint8(SQLITE_INSERT), bp+40 /* &rc */) + sessionAppendByte(tls, bp+24 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+40 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+24 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), iCol, bp+40 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendUpdate(tls, bp+24 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendDelete(tls, bp+24 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31549 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{})), libc.X__builtin_object_size(tls, pRet, 0)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.X__builtin___memmove_chk(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint64(nMove), libc.X__builtin_object_size(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, 0)) + } + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+32 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 48 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.X__builtin___memcpy_chk(tls, aCopy, aData, uint64(nData), libc.X__builtin_object_size(tls, aCopy, 0)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &d */, bp+16 /* &v */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &d */, 0)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 120 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)) + uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 72 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)) + libc.X__builtin___memset_chk(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK, libc.X__builtin_object_size(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0)) + libc.X__builtin___memcpy_chk(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))), libc.X__builtin_object_size(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf+uintptr(iPK)), 0)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*8) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+100 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + libc.X__builtin___memset_chk(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)), libc.X__builtin_object_size(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0)) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+100 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*8)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var rc int32 at bp+40, 4 + // Return value + // var sOut SessionBuffer at bp, 16 + // Output buffer + // var nCol int32 at bp+20, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+24, 16 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+16, 4 + + var nVar int32 + // var nByte1 int32 at bp+44, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.X__builtin___memset_chk(tls, bp /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, bp /* &sOut */, 0)) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+16 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+20 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+24 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 16 /* nByte */)), bp+40 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 16 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+44 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */)), bp+40 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.X__builtin___memset_chk(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)), libc.X__builtin_object_size(tls, apVal, 0)) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+40 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))*8), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) + }())))*8)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+40 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+40 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.X__builtin___memset_chk(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)), libc.X__builtin_object_size(tls, apVal, 0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + // Set up the input stream + libc.X__builtin___memset_chk(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{})), libc.X__builtin_object_size(tls, bp /* &sInput */, 0)) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + var rc int32 + + // Set up the input stream + libc.X__builtin___memset_chk(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{})), libc.X__builtin_object_size(tls, bp /* &sInput */, 0)) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + _ [4]byte + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [6]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + libc.X__builtin___memset_chk(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))), libc.X__builtin_object_size(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 64 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint64(nU32)*uint64(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionUpdate{})) * uint64(nU32)) * uint64(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10483 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 756 /* "" */ + // var buf SessionBuffer at bp, 16 + + libc.X__builtin___memset_chk(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, bp /* &buf */, 0)) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*24) + libc.X__builtin___memcpy_chk(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))), libc.X__builtin_object_size(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, 0)) + + sessionAppendStr(tls, bp /* &buf */, ts+31567 /* "UPDATE main." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31580 /* " SET " */, bp+16 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31586 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+16 /* &rc */) + zSep = ts + 13735 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 756 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31515 /* " WHERE " */, bp+16 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*8)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31591 /* "idx IS CASE WHEN..." */, bp+16 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31523 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+16 /* &rc */) + } + zSep = ts + 20335 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31666 /* "DELETE FROM main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31515 /* " WHERE " */, bp+16 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31586 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 20335 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31684 /* " AND (?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31227 /* " OR " */, bp+16 /* &rc */) + + zSep = ts + 756 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31523 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 31692 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4477 /* ")" */, bp+16 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5869 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 24 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31697 /* "INSERT INTO main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+20341 /* "(" */, bp+16 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13735 /* ", " */, bp+16 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31715 /* ") VALUES(?" */, bp+16 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31726 /* ", ?" */, bp+16 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4477 /* ")" */, bp+16 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 16 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10483 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 16 /* &.pInsert */), + + ts+31730 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pDelete */), + + ts+31843 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 8 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var nCol int32 at bp+8, 4 + // Number of columns in table + // var op int32 at bp+12, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 8 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 104 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 104 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 104 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+8 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8 /* &pVal */) + } + sessionAppendValue(tls, (p + 104 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+16, 4 + + // var nCol int32 at bp+8, 4 + + // var op int32 at bp+12, 4 + + // var zDummy uintptr at bp, 8 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 88 /* &.constraints */), aBlob, nBlob, bp+16 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var zDummy uintptr at bp, 8 + + // var op int32 at bp+12, 4 + + // var nCol int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 8 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+16 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*8)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*8)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31987 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32008 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.X__builtin___memset_chk(tls, (pApply + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, (pApply+88 /* &.constraints */), 0)) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint64(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint64(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 72 /* &.tblhdr */), int64(nByte), bp+8 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + libc.X__builtin___memset_chk(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte, libc.X__builtin_object_size(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0)) + } + + for (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(368) + defer tls.Free(368) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 128 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.X__builtin___memset_chk(tls, bp+48 /* &sApply */, 0, uint64(unsafe.Sizeof(SessionApplyCtx{})), libc.X__builtin_object_size(tls, bp+48 /* &sApply */, 0)) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+32027 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32053 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+184, 4 + + // var op int32 at bp+188, 4 + + // var zNew uintptr at bp+176, 8 + + Xsqlite3changeset_op(tls, pIter, bp+176 /* &zNew */, bp+184 /* &nCol */, bp+188 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+192, 8 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.X__builtin___memset_chk(tls, (bp + 48 /* &sApply */ + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, (bp+48 /* &sApply */ +88 /* &.constraints */), 0)) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+192 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5869 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), (bp + 48 /* &sApply */ + 32 /* &.nCol */), bp+200 /* &zTab */, (bp + 48 /* &sApply */ + 40 /* &.azCol */), (bp + 48 /* &sApply */ + 48 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+32083 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+32127, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 192 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+32198 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), ts+10483 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+208, 4 + + // var notUsed int32 at bp+212, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+208 /* &nFk */, bp+212 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+216, 152 + + libc.X__builtin___memset_chk(tls, bp+216 /* &sIter */, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{})), libc.X__builtin_object_size(tls, bp+216 /* &sIter */, 0)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 216 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+216 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+32258 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32288 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+32312 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+32288 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(SessionChange{})) + uint64(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{})), libc.X__builtin_object_size(tls, pNew, 0)) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*32) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.X__builtin___memcpy_chk(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec), libc.X__builtin_object_size(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, 0)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.X__builtin___memcpy_chk(tls, pOut, pIn, uint64(nIn), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(nByte), libc.X__builtin_object_size(tls, pNew, 0)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(n1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n1) + } else { + libc.X__builtin___memcpy_chk(tls, pOut, a2, uint64(n2), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+8, 8 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(SessionChange{})) + uint64((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{})), libc.X__builtin_object_size(tls, pNew, 0)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.X__builtin___memcpy_chk(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec), libc.X__builtin_object_size(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), 0)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+16 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+24 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.X__builtin___memcpy_chk(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec), libc.X__builtin_object_size(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), 0)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */))) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var aRec uintptr at bp, 8 + + // var nRec int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+16, 8 + + // var nCol int32 at bp+24, 4 + + // var op int32 at bp+28, 4 + + var iHash int32 + // var bIndirect int32 at bp+32, 4 + + // var pChange uintptr at bp+48, 8 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+16 /* &zNew */, bp+24 /* &nCol */, bp+28 /* &op */, bp+32 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)))) + // var abPK uintptr at bp+40, 8 + + Xsqlite3changeset_pk(tls, pIter, bp+40 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(SessionTable{})) + uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + uint64(nNew)) + uint64(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.X__builtin___memset_chk(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{})), libc.X__builtin_object_size(tls, pTab, 0)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 24 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*56) + libc.X__builtin___memcpy_chk(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */))), libc.X__builtin_object_size(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, 0)) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + libc.X__builtin___memcpy_chk(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (uint64(nNew + 1)), libc.X__builtin_object_size(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, 0)) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28 /* op */)), *(*int32)(unsafe.Pointer(bp + 32 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+48 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+16 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+16 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+16 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.X__builtin___memset_chk(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3_changegroup{})), libc.X__builtin_object_size(tls, p, 0)) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.X__builtin___memcpy_chk(tls, pOut, a2, uint64(nn2), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(nn2) + } else { + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(nn1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(n1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.X__builtin___memcpy_chk(tls, pOut, a2, uint64(n2), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(n1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 16 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, bp+12 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+16 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+32 /* &rc */) + sessionAppendVarint(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+32 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_UPDATE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+40 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_INSERT), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)), (int32(int64(*(*int32)(unsafe.Pointer(bp + 8 /* nRec */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */))) - int64(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1))), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+16 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_DELETE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + libc.X__builtin___memset_chk(tls, bp+16 /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, bp+16 /* &sOut */, 0)) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_rebaser{})), libc.X__builtin_object_size(tls, pNew, 0)) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -180141,71 +186316,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -181035,7 +187145,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+30987 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+32340 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -181358,7 +187468,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+31015 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+32368 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -181637,7 +187747,7 @@ func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31046 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+32399 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -181711,7 +187821,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 31053 /* "wrong number of ..." */ + var zErr uintptr = ts + 32406 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -181878,7 +187988,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 741 /* "" */ + return ts + 756 /* "" */ } // Implementation of snippet() function. @@ -181905,7 +188015,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 31103 /* "wrong number of ..." */ + var zErr uintptr = ts + 32456 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -182247,13 +188357,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(96) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 31151 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32504 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 31159 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32512 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 31169 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32522 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -182747,7 +188857,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+5654 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+5669 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -182926,7 +189036,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+31174 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32527 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 @@ -182953,14 +189063,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31181 /* "malformed prefix..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32534 /* "malformed prefix..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+31212 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + ts+32565 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -182971,7 +189081,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31245 /* "prefix length ou..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32598 /* "prefix length ou..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -182984,7 +189094,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31282 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32635 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + uint64(1))) var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) @@ -182993,7 +189103,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31291 /* "multiple tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32644 /* "multiple tokeniz..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { @@ -183012,7 +189122,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31324 /* "parse error in t..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32677 /* "parse error in t..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, @@ -183027,14 +189137,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31358 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32711 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31366 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32719 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+31398 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32751 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } @@ -183042,9 +189152,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31404 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32757 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31418 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32771 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) @@ -183052,9 +189162,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31456 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32809 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31467 /* "malformed column..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32820 /* "malformed column..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) @@ -183062,21 +189172,21 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+4585 /* "detail" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+4600 /* "detail" */, zCmd, nCmd) == 0 { *(*[4]Fts5Enum)(unsafe.Pointer(bp + 48 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 16243 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 16248 /* "full" */}, - {FzName: ts + 31502 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {FzName: ts + 16258 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 16263 /* "full" */}, + {FzName: ts + 32855 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+48 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31510 /* "malformed detail..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32863 /* "malformed detail..." */, 0) } return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31541 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32894 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -183140,15 +189250,15 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+20940 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+15156 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31569 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20955 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+15171 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32922 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+31599 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32952 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31609 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32962 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -183166,13 +189276,13 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31640 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32993 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31645 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32998 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31652 /* ", T.c%d" */, libc.VaList(bp+16, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+33005 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } @@ -183220,8 +189330,8 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20940 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31660 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20955 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33013 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } @@ -183254,7 +189364,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31689 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33042 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { @@ -183262,7 +189372,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), pzErr) } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)), pzErr) @@ -183287,19 +189397,19 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 31358 /* "content" */ + zTail = ts + 32711 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 31709 /* "docsize" */ + zTail = ts + 33062 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+40 /* &rc */, ts+31717 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+33070 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+15156 /* "rowid" */, -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+15171 /* "rowid" */, -1) } // Formulate the zContentExprlist text @@ -183348,18 +189458,18 @@ func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31728 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+33081 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 13720 /* ", " */ + return ts + 13735 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31744 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+33097 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31751, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20940 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+33104, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20955 /* "rank" */)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -183499,7 +189609,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+31777 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+33130 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -183509,7 +189619,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31782 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33135 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -183519,7 +189629,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31791 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33144 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -183532,7 +189642,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31801 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33154 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -183542,7 +189652,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31811 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33164 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -183558,7 +189668,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20940 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20955 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 8 @@ -183585,7 +189695,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 bp := tls.Alloc(52) defer tls.Free(52) - var zSelect uintptr = ts + 31823 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 33176 /* "SELECT k, v FROM..." */ var zSql uintptr *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK @@ -183608,7 +189718,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) { var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 0) var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+31855 /* "version" */) { + if 0 == Xsqlite3_stricmp(tls, zK, ts+33208 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 48 /* bDummy */)) = 0 @@ -183623,7 +189733,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+31863, /* "invalid fts5 fil..." */ + ts+33216, /* "invalid fts5 fil..." */ libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } @@ -183757,7 +189867,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31928 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+33281 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -183770,20 +189880,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31948 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+33301 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31979 /* "OR" */, uint64(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+33332 /* "OR" */, uint64(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31982 /* "NOT" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+33335 /* "NOT" */, uint64(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28728 /* "AND" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28743 /* "AND" */, uint64(3)) == 0) { tok = FTS5_AND } break @@ -185756,9 +191866,9 @@ func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqli bp := tls.Alloc(16) defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+31986 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+33339 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+31015 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+32368 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -185774,7 +191884,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+31991 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+33344 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -185871,7 +191981,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+19323 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+19338 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -185967,7 +192077,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+32020 /* "fts5: column que..." */, 0) + ts+33373 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -186151,12 +192261,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+32073, /* "fts5: %s queries..." */ + ts+33426, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 32123 /* "phrase" */ + return ts + 33476 /* "phrase" */ } - return ts + 31986 /* "NEAR" */ + return ts + 33339 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -187629,7 +193739,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+32130 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33483 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -187717,7 +193827,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+32136, /* "REPLACE INTO '%q..." */ + ts+33489, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -187745,7 +193855,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+32187, /* "DELETE FROM '%q'..." */ + ts+33540, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+72 /* &.pDeleter */), zSql) != 0 { return @@ -187769,7 +193879,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 88 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+32236, /* "DELETE FROM '%q'..." */ + ts+33589, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -187977,7 +194087,7 @@ func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12 if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 112 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+32276 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+33629 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -189412,7 +195522,7 @@ func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:2 var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 96 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+32299, /* "SELECT pgno FROM..." */ + ts+33652, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -190669,7 +196779,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -191010,7 +197120,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 80 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+32383, /* "INSERT INTO '%q'..." */ + ts+33736, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -192227,7 +198337,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.X__builtin___memset_chk(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Fts5Structure{})), libc.X__builtin_object_size(tls, bp /* &s */, 0)) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+741 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+756 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -192248,13 +198358,13 @@ func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uint if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+32440 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33793 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+23759 /* "data" */, ts+32448 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+23774 /* "data" */, ts+33801 /* "id INTEGER PRIMA..." */, 0, pzErr) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10608, /* "idx" */ - ts+32483, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10623, /* "idx" */ + ts+33836, /* "segid, term, pgn..." */ 1, pzErr) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { @@ -192560,7 +198670,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+32130 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) + ts+33483 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))) @@ -192697,7 +198807,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+32527, /* "SELECT segid, te..." */ + ts+33880, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. @@ -192907,7 +199017,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 16 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*120), uintptr(0), bp+16 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+32613 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+33966 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fn, bp+32 /* &iOff */, bp+40 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) & int64(0x7FFFFFFF))) @@ -193318,7 +199428,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32618 /* "recursively defi..." */, 0) + ts+33971 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -193352,7 +199462,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4485 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4500 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -193368,7 +199478,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4485 /* "%d" */, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4500 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -193711,7 +199821,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -193743,7 +199853,7 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -193782,25 +199892,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+32657, /* "SELECT rowid, ra..." */ + ts+34010, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 13720 /* ", " */ + return ts + 13735 /* ", " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 32712 /* "DESC" */ + return ts + 34065 /* "DESC" */ } - return ts + 32717 /* "ASC" */ + return ts + 34070 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -193851,13 +199961,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+32721 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+34074 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4567 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4582 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32727 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+34080 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -193892,7 +200002,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+32755 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+34108 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, @@ -193924,7 +200034,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32765 /* "no such function..." */, libc.VaList(bp+8, zRank)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+34118 /* "no such function..." */, libc.VaList(bp+8, zRank)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } @@ -193956,14 +200066,14 @@ func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uin *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+32786 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+34139 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 31169 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32522 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -194029,7 +200139,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32618 /* "recursively defi..." */, 0) + ts+33971 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -194075,7 +200185,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 741 /* "" */ + zText = ts + 756 /* "" */ __14: ; iCol = 0 @@ -194264,7 +200374,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32819 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+34172 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -194401,7 +200511,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -194438,29 +200548,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+32855 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+34208 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+32866 /* "'delete-all' may..." */, 0) + ts+34219 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+32946 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+34299 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+32954 /* "'rebuild' may no..." */, 0) + ts+34307 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+15843 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+15858 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+33010 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+34363 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+33016 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+34369 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -194534,7 +200644,7 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+16382 /* "delete" */, z)) { + (0 == Xsqlite3_stricmp(tls, ts+16397 /* "delete" */, z)) { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) @@ -194559,12 +200669,12 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+33032, /* "cannot %s conten..." */ + ts+34385, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 19224 /* "UPDATE" */ + return ts + 19239 /* "UPDATE" */ } - return ts + 33069 /* "DELETE from" */ + return ts + 34422 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { @@ -195234,7 +201344,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+33081 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+34434 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -195539,7 +201649,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33102 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34455 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 16 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -195556,7 +201666,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 16 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33124 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34477 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -195603,7 +201713,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+33155 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34508 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -195614,7 +201724,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+33168 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+34521 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -195630,7 +201740,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 33259 /* "config" */, ts + 31358 /* "content" */, ts + 23759 /* "data" */, ts + 31709 /* "docsize" */, ts + 10608, /* "idx" */ + ts + 34612 /* "config" */, ts + 32711 /* "content" */, ts + 23774 /* "data" */, ts + 33062 /* "docsize" */, ts + 10623, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -195654,7 +201764,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+33266 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+34619 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -195672,13 +201782,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+33266 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34619 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+33271 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34624 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -195744,20 +201854,20 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ - ts + 33286, /* "SELECT %s FROM %..." */ - ts + 33354, /* "SELECT %s FROM %..." */ - ts + 33423, /* "SELECT %s FROM %..." */ // LOOKUP + ts + 34639, /* "SELECT %s FROM %..." */ + ts + 34707, /* "SELECT %s FROM %..." */ + ts + 34776, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 33456, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 33495, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 33535, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 33574, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 33615, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 34809, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34848, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34888, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34927, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34968, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 33654, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 35007, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 33696, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 33736, /* "SELECT %s FROM %..." */ // SCAN + ts + 35049, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 35089, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) @@ -195824,7 +201934,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -195862,18 +201972,18 @@ func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230 var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33759, /* "DROP TABLE IF EX..." */ + ts+35112, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33863, /* "DROP TABLE IF EX..." */ + ts+35216, /* "DROP TABLE IF EX..." */ libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33901, /* "DROP TABLE IF EX..." */ + ts+35254, /* "DROP TABLE IF EX..." */ libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc @@ -195885,7 +201995,7 @@ func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uin if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33939, /* "ALTER TABLE %Q.'..." */ + ts+35292, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -195897,14 +202007,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23759 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10608 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+33259 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23774 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10623 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34612 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31709 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+33062 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31358 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32711 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -195918,17 +202028,17 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn var rc int32 *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+33981, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+35334, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 28374 /* " WITHOUT ROWID" */ + return ts + 28389 /* " WITHOUT ROWID" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+34011, /* "fts5: error crea..." */ + ts+35364, /* "fts5: error crea..." */ libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } @@ -195970,27 +202080,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34055 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+35408 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34078 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+35431 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+31358 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32711 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+31709 /* "docsize" */, ts+34084 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+33062 /* "docsize" */, ts+35437 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+33259 /* "config" */, ts+34116 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+34612 /* "config" */, ts+35469 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31855 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+33208 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -196227,12 +202337,12 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34133, /* "DELETE FROM %Q.'..." */ + ts+35486, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34183, /* "DELETE FROM %Q.'..." */ + ts+35536, /* "DELETE FROM %Q.'..." */ libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } @@ -196242,7 +202352,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31855 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+33208 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -196437,7 +202547,7 @@ func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+34212, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+35565, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -196634,14 +202744,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31358 /* "content" */, bp+48 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32711 /* "content" */, bp+48 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31709 /* "docsize" */, bp+56 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+33062 /* "docsize" */, bp+56 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -196877,9 +202987,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.X__builtin___memcpy_chk(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint64(unsafe.Sizeof(aAsciiTokenChar)), libc.X__builtin_object_size(tls, p /* &.aTokenChar */, 0)) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34244 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35597 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34255 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35608 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -197119,7 +203229,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 34266 /* "L* N* Co" */ + var zCat uintptr = ts + 35619 /* "L* N* Co" */ var i int32 libc.X__builtin___memset_chk(tls, p, 0, uint64(unsafe.Sizeof(Unicode61Tokenizer{})), libc.X__builtin_object_size(tls, p, 0)) @@ -197132,7 +203242,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34275 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35628 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) } } @@ -197143,18 +203253,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34286 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35639 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34244 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35597 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34255 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35608 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34275 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35628 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -197466,7 +203576,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 34304 /* "unicode61" */ + var zBase uintptr = ts + 35657 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -197619,7 +203729,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34314 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35667 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -197627,11 +203737,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34317 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35670 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34322 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35675 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -197639,7 +203749,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34327 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35680 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -197647,7 +203757,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34330 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35683 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -197655,11 +203765,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34333 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35686 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34338 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35691 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -197667,19 +203777,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34343 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35696 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34347 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35700 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34353 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35706 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34358 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35711 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197687,11 +203797,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34362 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35715 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34366 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35719 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -197699,7 +203809,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34369 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35722 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197707,11 +203817,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34373 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35726 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34377 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35730 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197719,7 +203829,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34381 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35734 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197727,7 +203837,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34385 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35738 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197735,7 +203845,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34389 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35742 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197752,24 +203862,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34393 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35746 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34396 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+34399 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35749 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+35752 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34403 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+34389 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35756 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+35742 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -197785,137 +203895,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34406 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35759 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34414 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35767 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+34421 /* "tion" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+35774 /* "tion" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34426 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35779 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34322 /* "ence" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35675 /* "ence" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34431 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35784 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34317 /* "ance" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35670 /* "ance" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34436 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35789 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34389 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35742 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34441 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35794 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+15177 /* "log" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+15192 /* "log" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34446 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35799 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+34399 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+35752 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34450 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35803 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34455 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35808 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34358 /* "ent" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35711 /* "ent" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34461 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35814 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+34465 /* "e" */, uint64(1), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+35818 /* "e" */, uint64(1), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34467 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35820 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34381 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35734 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34473 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35826 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34389 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35742 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34481 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35834 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34487 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35840 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34492 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35845 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34498 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35851 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34385 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35738 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34506 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35859 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34514 /* "ful" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35867 /* "ful" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34518 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35871 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34381 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35734 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34526 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35879 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34532 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35885 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34385 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35738 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34538 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35891 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+34399 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+35752 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -197931,16 +204041,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34545 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35898 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34330 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35683 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34550 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35903 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -197948,21 +204058,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34555 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35908 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34330 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35683 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34561 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35914 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34330 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35683 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34514 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35867 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -197970,7 +204080,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34567 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35920 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -197978,9 +204088,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34573 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35926 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -197996,12 +204106,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34579 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35932 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+34583 /* "ee" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+35936 /* "ee" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34586 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35939 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -198010,7 +204120,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34589 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35942 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -198180,7 +204290,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34593 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35946 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -198370,22 +204480,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(128) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 34304 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35657 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 34608 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35961 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 34614 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35967 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 34621 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35974 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -199732,14 +205842,14 @@ func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uint var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+34629 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+35982 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+34633 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35986 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+34637 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35990 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34646 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35999 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) @@ -199786,19 +205896,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(36) *(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azSchema */)) = [3]uintptr{ - ts + 34680, /* "CREATE TABlE voc..." */ - ts + 34720, /* "CREATE TABlE voc..." */ - ts + 34755, /* "CREATE TABlE voc..." */ + ts + 36033, /* "CREATE TABlE voc..." */ + ts + 36073, /* "CREATE TABlE voc..." */ + ts + 36108, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+22068 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+22083 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34798 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+36151 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -199950,11 +206060,11 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34831 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+36184 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ - ts+34862, /* "SELECT t.%Q FROM..." */ + ts+36215, /* "SELECT t.%Q FROM..." */ libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+72 /* &pStmt */, uintptr(0)) @@ -199978,7 +206088,7 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34913 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+36266 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { @@ -200266,7 +206376,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 741 /* "" */ + zCopy = ts + 756 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -200383,7 +206493,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+34939 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+36292 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -200428,7 +206538,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 34949 /* "2021-06-18 18:36..." */ + return ts + 36302 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -201482,5 +207592,5 @@ func init() { *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 128 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: } -var ts1 = "COMPILER=gcc-11.1.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00nfs\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00dylib\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=gcc-11.1.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00nfs\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00dylib\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go index 5bd7aca3..be4f38fe 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_darwin_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_darwin_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_darwin_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1 -DSQLITE_WITHOUT_ZONEMALLOC', DO NOT EDIT. package sqlite3 @@ -1845,6 +1845,9 @@ const ( SEGV_MAPERR = 1 SEGV_NOOP = 0 SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 SF_APPEND = 0x00040000 SF_ARCHIVED = 0x00010000 SF_Aggregate = 0x0000008 @@ -1995,6 +1998,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -2151,6 +2165,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -2518,6 +2533,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -4345,7 +4362,7 @@ type X__float128 = float64 /* :47:21 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [18]uintptr{ +var sqlite3azCompileOpt = [19]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=gcc-11...." */ @@ -4358,14 +4375,15 @@ var sqlite3azCompileOpt = [18]uintptr{ ts + 131, /* "ENABLE_PREUPDATE..." */ ts + 153, /* "ENABLE_RBU" */ ts + 164, /* "ENABLE_RTREE" */ - ts + 177, /* "ENABLE_SNAPSHOT" */ - ts + 193, /* "ENABLE_STAT4" */ - ts + 206, /* "ENABLE_UNLOCK_NO..." */ - ts + 227, /* "LIKE_DOESNT_MATC..." */ - ts + 251, /* "MUTEX_NOOP" */ - ts + 262, /* "SOUNDEX" */ - ts + 270, /* "SYSTEM_MALLOC" */ - ts + 284, /* "THREADSAFE=1" */ + ts + 177, /* "ENABLE_SESSION" */ + ts + 192, /* "ENABLE_SNAPSHOT" */ + ts + 208, /* "ENABLE_STAT4" */ + ts + 221, /* "ENABLE_UNLOCK_NO..." */ + ts + 242, /* "LIKE_DOESNT_MATC..." */ + ts + 266, /* "MUTEX_NOOP" */ + ts + 277, /* "SOUNDEX" */ + ts + 285, /* "SYSTEM_MALLOC" */ + ts + 299, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -4681,7 +4699,7 @@ type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 297 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 312 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -7232,6 +7250,495 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + _ [4]byte + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + _ [4]byte + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -7282,10 +7789,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -15734,7 +16240,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 304 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 319 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -16937,7 +17443,7 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+311 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+326 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 @@ -16974,13 +17480,13 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+319 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+334 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+327 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+342 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -17099,7 +17605,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+331 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+346 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -17180,7 +17686,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+343 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+358 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -17362,7 +17868,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+56 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 104 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) if osLocaltime(tls, bp+104 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+347 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+362 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -17397,12 +17903,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 370 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 377 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 384 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 389 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 393 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 399 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 385 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 392 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 399 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 404 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 408 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 414 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -17441,7 +17947,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+404 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+419 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -17455,7 +17961,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+414 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+429 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -17464,7 +17970,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+424 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+439 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -17489,7 +17995,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+428 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+443 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -17514,7 +18020,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+437 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+452 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -17528,14 +18034,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+393 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+408 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+399 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+414 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+389 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+404 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -17756,7 +18262,7 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // var zBuf [100]int8 at bp+96, 100 computeYMD_HMS(tls, bp+48 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+447, /* "%04d-%02d-%02d %..." */ + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+462, /* "%04d-%02d-%02d %..." */ libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } @@ -17775,7 +18281,7 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeHMS(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+477 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+492 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -17793,7 +18299,7 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeYMD(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+492 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+507 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -17920,7 +18426,7 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (uint64(2)) break fallthrough @@ -17930,14 +18436,14 @@ __3: if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+512 /* "%06.3f" */, libc.VaList(bp+8, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+527 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (uint64(2)) break fallthrough @@ -17955,10 +18461,10 @@ __3: if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (uint64(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+519 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+534 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (uint64(3)) } break @@ -17967,19 +18473,19 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+524 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+539 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (uint64(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (uint64(2)) break fallthrough @@ -17993,7 +18499,7 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+507 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (uint64(2)) break fallthrough @@ -18006,7 +18512,7 @@ __3: fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+530 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+545 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -18063,14 +18569,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 535 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 545 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 550 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 555 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 564 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 573 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 586 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 604 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 550 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 560 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 565 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 570 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 579 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 588 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 601 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 619 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -18647,7 +19153,7 @@ func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:1 p += 8 } else { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+617 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+632 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -18698,7 +19204,7 @@ func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* } else { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+655, /* "failed memory re..." */ + ts+670, /* "failed memory re..." */ libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) } return p @@ -19883,8 +20389,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 691 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 724 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 706 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 739 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -20138,7 +20644,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+731 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+746 /* "%" */, 1) goto __5 __11: ; @@ -20721,7 +21227,7 @@ __125: if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 733 /* "NaN" */ + bufpt = ts + 748 /* "NaN" */ length = 3 goto __58 __127: @@ -20781,7 +21287,7 @@ __138: } bufpt = bp + 8 /* &buf[0] */ *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix - libc.X__builtin___memcpy_chk(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+737 /* "Inf" */, uint64(4), libc.X__builtin_object_size(tls, (bp+8 /* &buf[0] */ +uintptr((libc.Bool32(int32(prefix) != 0)))), 0)) + libc.X__builtin___memcpy_chk(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+752 /* "Inf" */, uint64(4), libc.X__builtin_object_size(tls, (bp+8 /* &buf[0] */ +uintptr((libc.Bool32(int32(prefix) != 0)))), 0)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: @@ -21138,7 +21644,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 741 /* "" */ + bufpt = ts + 756 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -21267,9 +21773,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 742 /* "NULL" */ + return ts + 757 /* "NULL" */ } - return ts + 747 /* "(NULL)" */ + return ts + 762 /* "(NULL)" */ }() __220: ; @@ -21404,7 +21910,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+754 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+769 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -21419,7 +21925,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+756 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+771 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -21482,7 +21988,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 768 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 783 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -23606,7 +24112,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 777 /* "9223372036854775..." */ + var pow63 uintptr = ts + 792 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -24256,7 +24762,7 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+796, /* "API call with %s..." */ + ts+811, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -24275,14 +24781,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+742 /* "NULL" */) + logBadConnection(tls, ts+757 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+841 /* "unopened" */) + logBadConnection(tls, ts+856 /* "unopened" */) } return 0 } else { @@ -24296,7 +24802,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+850 /* "invalid" */) + logBadConnection(tls, ts+865 /* "invalid" */) return 0 } else { return 1 @@ -24824,186 +25330,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 858, /* "Savepoint" */ - /* 1 */ ts + 868, /* "AutoCommit" */ - /* 2 */ ts + 879, /* "Transaction" */ - /* 3 */ ts + 891, /* "SorterNext" */ - /* 4 */ ts + 902, /* "Prev" */ - /* 5 */ ts + 907, /* "Next" */ - /* 6 */ ts + 912, /* "Checkpoint" */ - /* 7 */ ts + 923, /* "JournalMode" */ - /* 8 */ ts + 935, /* "Vacuum" */ - /* 9 */ ts + 942, /* "VFilter" */ - /* 10 */ ts + 950, /* "VUpdate" */ - /* 11 */ ts + 958, /* "Goto" */ - /* 12 */ ts + 963, /* "Gosub" */ - /* 13 */ ts + 969, /* "InitCoroutine" */ - /* 14 */ ts + 983, /* "Yield" */ - /* 15 */ ts + 989, /* "MustBeInt" */ - /* 16 */ ts + 999, /* "Jump" */ - /* 17 */ ts + 1004, /* "Once" */ - /* 18 */ ts + 1009, /* "If" */ - /* 19 */ ts + 1012, /* "Not" */ - /* 20 */ ts + 1016, /* "IfNot" */ - /* 21 */ ts + 1022, /* "IfNullRow" */ - /* 22 */ ts + 1032, /* "SeekLT" */ - /* 23 */ ts + 1039, /* "SeekLE" */ - /* 24 */ ts + 1046, /* "SeekGE" */ - /* 25 */ ts + 1053, /* "SeekGT" */ - /* 26 */ ts + 1060, /* "IfNotOpen" */ - /* 27 */ ts + 1070, /* "IfNoHope" */ - /* 28 */ ts + 1079, /* "NoConflict" */ - /* 29 */ ts + 1090, /* "NotFound" */ - /* 30 */ ts + 1099, /* "Found" */ - /* 31 */ ts + 1105, /* "SeekRowid" */ - /* 32 */ ts + 1115, /* "NotExists" */ - /* 33 */ ts + 1125, /* "Last" */ - /* 34 */ ts + 1130, /* "IfSmaller" */ - /* 35 */ ts + 1140, /* "SorterSort" */ - /* 36 */ ts + 1151, /* "Sort" */ - /* 37 */ ts + 1156, /* "Rewind" */ - /* 38 */ ts + 1163, /* "IdxLE" */ - /* 39 */ ts + 1169, /* "IdxGT" */ - /* 40 */ ts + 1175, /* "IdxLT" */ - /* 41 */ ts + 1181, /* "IdxGE" */ - /* 42 */ ts + 1187, /* "RowSetRead" */ - /* 43 */ ts + 1198, /* "Or" */ - /* 44 */ ts + 1201, /* "And" */ - /* 45 */ ts + 1205, /* "RowSetTest" */ - /* 46 */ ts + 1216, /* "Program" */ - /* 47 */ ts + 1224, /* "FkIfZero" */ - /* 48 */ ts + 1233, /* "IfPos" */ - /* 49 */ ts + 1239, /* "IfNotZero" */ - /* 50 */ ts + 1249, /* "IsNull" */ - /* 51 */ ts + 1256, /* "NotNull" */ - /* 52 */ ts + 1264, /* "Ne" */ - /* 53 */ ts + 1267, /* "Eq" */ - /* 54 */ ts + 1270, /* "Gt" */ - /* 55 */ ts + 1273, /* "Le" */ - /* 56 */ ts + 1276, /* "Lt" */ - /* 57 */ ts + 1279, /* "Ge" */ - /* 58 */ ts + 1282, /* "ElseEq" */ - /* 59 */ ts + 1289, /* "DecrJumpZero" */ - /* 60 */ ts + 1302, /* "IncrVacuum" */ - /* 61 */ ts + 1313, /* "VNext" */ - /* 62 */ ts + 1319, /* "Init" */ - /* 63 */ ts + 1324, /* "PureFunc" */ - /* 64 */ ts + 1333, /* "Function" */ - /* 65 */ ts + 1342, /* "Return" */ - /* 66 */ ts + 1349, /* "EndCoroutine" */ - /* 67 */ ts + 1362, /* "HaltIfNull" */ - /* 68 */ ts + 1373, /* "Halt" */ - /* 69 */ ts + 1378, /* "Integer" */ - /* 70 */ ts + 1386, /* "Int64" */ - /* 71 */ ts + 1392, /* "String" */ - /* 72 */ ts + 1399, /* "Null" */ - /* 73 */ ts + 1404, /* "SoftNull" */ - /* 74 */ ts + 1413, /* "Blob" */ - /* 75 */ ts + 1418, /* "Variable" */ - /* 76 */ ts + 1427, /* "Move" */ - /* 77 */ ts + 1432, /* "Copy" */ - /* 78 */ ts + 1437, /* "SCopy" */ - /* 79 */ ts + 1443, /* "IntCopy" */ - /* 80 */ ts + 1451, /* "ChngCntRow" */ - /* 81 */ ts + 1462, /* "ResultRow" */ - /* 82 */ ts + 1472, /* "CollSeq" */ - /* 83 */ ts + 1480, /* "AddImm" */ - /* 84 */ ts + 1487, /* "RealAffinity" */ - /* 85 */ ts + 1500, /* "Cast" */ - /* 86 */ ts + 1505, /* "Permutation" */ - /* 87 */ ts + 1517, /* "Compare" */ - /* 88 */ ts + 1525, /* "IsTrue" */ - /* 89 */ ts + 1532, /* "ZeroOrNull" */ - /* 90 */ ts + 1543, /* "Offset" */ - /* 91 */ ts + 1550, /* "Column" */ - /* 92 */ ts + 1557, /* "Affinity" */ - /* 93 */ ts + 1566, /* "MakeRecord" */ - /* 94 */ ts + 1577, /* "Count" */ - /* 95 */ ts + 1583, /* "ReadCookie" */ - /* 96 */ ts + 1594, /* "SetCookie" */ - /* 97 */ ts + 1604, /* "ReopenIdx" */ - /* 98 */ ts + 1614, /* "OpenRead" */ - /* 99 */ ts + 1623, /* "OpenWrite" */ - /* 100 */ ts + 1633, /* "OpenDup" */ - /* 101 */ ts + 1641, /* "OpenAutoindex" */ - /* 102 */ ts + 1655, /* "BitAnd" */ - /* 103 */ ts + 1662, /* "BitOr" */ - /* 104 */ ts + 1668, /* "ShiftLeft" */ - /* 105 */ ts + 1678, /* "ShiftRight" */ - /* 106 */ ts + 1689, /* "Add" */ - /* 107 */ ts + 1693, /* "Subtract" */ - /* 108 */ ts + 1702, /* "Multiply" */ - /* 109 */ ts + 1711, /* "Divide" */ - /* 110 */ ts + 1718, /* "Remainder" */ - /* 111 */ ts + 1728, /* "Concat" */ - /* 112 */ ts + 1735, /* "OpenEphemeral" */ - /* 113 */ ts + 1749, /* "BitNot" */ - /* 114 */ ts + 1756, /* "SorterOpen" */ - /* 115 */ ts + 1767, /* "SequenceTest" */ - /* 116 */ ts + 1780, /* "String8" */ - /* 117 */ ts + 1788, /* "OpenPseudo" */ - /* 118 */ ts + 1799, /* "Close" */ - /* 119 */ ts + 1805, /* "ColumnsUsed" */ - /* 120 */ ts + 1817, /* "SeekScan" */ - /* 121 */ ts + 1826, /* "SeekHit" */ - /* 122 */ ts + 1834, /* "Sequence" */ - /* 123 */ ts + 1843, /* "NewRowid" */ - /* 124 */ ts + 1852, /* "Insert" */ - /* 125 */ ts + 1859, /* "RowCell" */ - /* 126 */ ts + 1867, /* "Delete" */ - /* 127 */ ts + 1874, /* "ResetCount" */ - /* 128 */ ts + 1885, /* "SorterCompare" */ - /* 129 */ ts + 1899, /* "SorterData" */ - /* 130 */ ts + 1910, /* "RowData" */ - /* 131 */ ts + 1918, /* "Rowid" */ - /* 132 */ ts + 1924, /* "NullRow" */ - /* 133 */ ts + 1932, /* "SeekEnd" */ - /* 134 */ ts + 1940, /* "IdxInsert" */ - /* 135 */ ts + 1950, /* "SorterInsert" */ - /* 136 */ ts + 1963, /* "IdxDelete" */ - /* 137 */ ts + 1973, /* "DeferredSeek" */ - /* 138 */ ts + 1986, /* "IdxRowid" */ - /* 139 */ ts + 1995, /* "FinishSeek" */ - /* 140 */ ts + 2006, /* "Destroy" */ - /* 141 */ ts + 2014, /* "Clear" */ - /* 142 */ ts + 2020, /* "ResetSorter" */ - /* 143 */ ts + 2032, /* "CreateBtree" */ - /* 144 */ ts + 2044, /* "SqlExec" */ - /* 145 */ ts + 2052, /* "ParseSchema" */ - /* 146 */ ts + 2064, /* "LoadAnalysis" */ - /* 147 */ ts + 2077, /* "DropTable" */ - /* 148 */ ts + 2087, /* "DropIndex" */ - /* 149 */ ts + 2097, /* "DropTrigger" */ - /* 150 */ ts + 2109, /* "IntegrityCk" */ - /* 151 */ ts + 2121, /* "RowSetAdd" */ - /* 152 */ ts + 2131, /* "Real" */ - /* 153 */ ts + 2136, /* "Param" */ - /* 154 */ ts + 2142, /* "FkCounter" */ - /* 155 */ ts + 2152, /* "MemMax" */ - /* 156 */ ts + 2159, /* "OffsetLimit" */ - /* 157 */ ts + 2171, /* "AggInverse" */ - /* 158 */ ts + 2182, /* "AggStep" */ - /* 159 */ ts + 2190, /* "AggStep1" */ - /* 160 */ ts + 2199, /* "AggValue" */ - /* 161 */ ts + 2208, /* "AggFinal" */ - /* 162 */ ts + 2217, /* "Expire" */ - /* 163 */ ts + 2224, /* "CursorLock" */ - /* 164 */ ts + 2235, /* "CursorUnlock" */ - /* 165 */ ts + 2248, /* "TableLock" */ - /* 166 */ ts + 2258, /* "VBegin" */ - /* 167 */ ts + 2265, /* "VCreate" */ - /* 168 */ ts + 2273, /* "VDestroy" */ - /* 169 */ ts + 2282, /* "VOpen" */ - /* 170 */ ts + 2288, /* "VColumn" */ - /* 171 */ ts + 2296, /* "VRename" */ - /* 172 */ ts + 2304, /* "Pagecount" */ - /* 173 */ ts + 2314, /* "MaxPgcnt" */ - /* 174 */ ts + 2323, /* "Trace" */ - /* 175 */ ts + 2329, /* "CursorHint" */ - /* 176 */ ts + 2340, /* "ReleaseReg" */ - /* 177 */ ts + 2351, /* "Noop" */ - /* 178 */ ts + 2356, /* "Explain" */ - /* 179 */ ts + 2364, /* "Abortable" */ + /* 0 */ ts + 873, /* "Savepoint" */ + /* 1 */ ts + 883, /* "AutoCommit" */ + /* 2 */ ts + 894, /* "Transaction" */ + /* 3 */ ts + 906, /* "SorterNext" */ + /* 4 */ ts + 917, /* "Prev" */ + /* 5 */ ts + 922, /* "Next" */ + /* 6 */ ts + 927, /* "Checkpoint" */ + /* 7 */ ts + 938, /* "JournalMode" */ + /* 8 */ ts + 950, /* "Vacuum" */ + /* 9 */ ts + 957, /* "VFilter" */ + /* 10 */ ts + 965, /* "VUpdate" */ + /* 11 */ ts + 973, /* "Goto" */ + /* 12 */ ts + 978, /* "Gosub" */ + /* 13 */ ts + 984, /* "InitCoroutine" */ + /* 14 */ ts + 998, /* "Yield" */ + /* 15 */ ts + 1004, /* "MustBeInt" */ + /* 16 */ ts + 1014, /* "Jump" */ + /* 17 */ ts + 1019, /* "Once" */ + /* 18 */ ts + 1024, /* "If" */ + /* 19 */ ts + 1027, /* "Not" */ + /* 20 */ ts + 1031, /* "IfNot" */ + /* 21 */ ts + 1037, /* "IfNullRow" */ + /* 22 */ ts + 1047, /* "SeekLT" */ + /* 23 */ ts + 1054, /* "SeekLE" */ + /* 24 */ ts + 1061, /* "SeekGE" */ + /* 25 */ ts + 1068, /* "SeekGT" */ + /* 26 */ ts + 1075, /* "IfNotOpen" */ + /* 27 */ ts + 1085, /* "IfNoHope" */ + /* 28 */ ts + 1094, /* "NoConflict" */ + /* 29 */ ts + 1105, /* "NotFound" */ + /* 30 */ ts + 1114, /* "Found" */ + /* 31 */ ts + 1120, /* "SeekRowid" */ + /* 32 */ ts + 1130, /* "NotExists" */ + /* 33 */ ts + 1140, /* "Last" */ + /* 34 */ ts + 1145, /* "IfSmaller" */ + /* 35 */ ts + 1155, /* "SorterSort" */ + /* 36 */ ts + 1166, /* "Sort" */ + /* 37 */ ts + 1171, /* "Rewind" */ + /* 38 */ ts + 1178, /* "IdxLE" */ + /* 39 */ ts + 1184, /* "IdxGT" */ + /* 40 */ ts + 1190, /* "IdxLT" */ + /* 41 */ ts + 1196, /* "IdxGE" */ + /* 42 */ ts + 1202, /* "RowSetRead" */ + /* 43 */ ts + 1213, /* "Or" */ + /* 44 */ ts + 1216, /* "And" */ + /* 45 */ ts + 1220, /* "RowSetTest" */ + /* 46 */ ts + 1231, /* "Program" */ + /* 47 */ ts + 1239, /* "FkIfZero" */ + /* 48 */ ts + 1248, /* "IfPos" */ + /* 49 */ ts + 1254, /* "IfNotZero" */ + /* 50 */ ts + 1264, /* "IsNull" */ + /* 51 */ ts + 1271, /* "NotNull" */ + /* 52 */ ts + 1279, /* "Ne" */ + /* 53 */ ts + 1282, /* "Eq" */ + /* 54 */ ts + 1285, /* "Gt" */ + /* 55 */ ts + 1288, /* "Le" */ + /* 56 */ ts + 1291, /* "Lt" */ + /* 57 */ ts + 1294, /* "Ge" */ + /* 58 */ ts + 1297, /* "ElseEq" */ + /* 59 */ ts + 1304, /* "DecrJumpZero" */ + /* 60 */ ts + 1317, /* "IncrVacuum" */ + /* 61 */ ts + 1328, /* "VNext" */ + /* 62 */ ts + 1334, /* "Init" */ + /* 63 */ ts + 1339, /* "PureFunc" */ + /* 64 */ ts + 1348, /* "Function" */ + /* 65 */ ts + 1357, /* "Return" */ + /* 66 */ ts + 1364, /* "EndCoroutine" */ + /* 67 */ ts + 1377, /* "HaltIfNull" */ + /* 68 */ ts + 1388, /* "Halt" */ + /* 69 */ ts + 1393, /* "Integer" */ + /* 70 */ ts + 1401, /* "Int64" */ + /* 71 */ ts + 1407, /* "String" */ + /* 72 */ ts + 1414, /* "Null" */ + /* 73 */ ts + 1419, /* "SoftNull" */ + /* 74 */ ts + 1428, /* "Blob" */ + /* 75 */ ts + 1433, /* "Variable" */ + /* 76 */ ts + 1442, /* "Move" */ + /* 77 */ ts + 1447, /* "Copy" */ + /* 78 */ ts + 1452, /* "SCopy" */ + /* 79 */ ts + 1458, /* "IntCopy" */ + /* 80 */ ts + 1466, /* "ChngCntRow" */ + /* 81 */ ts + 1477, /* "ResultRow" */ + /* 82 */ ts + 1487, /* "CollSeq" */ + /* 83 */ ts + 1495, /* "AddImm" */ + /* 84 */ ts + 1502, /* "RealAffinity" */ + /* 85 */ ts + 1515, /* "Cast" */ + /* 86 */ ts + 1520, /* "Permutation" */ + /* 87 */ ts + 1532, /* "Compare" */ + /* 88 */ ts + 1540, /* "IsTrue" */ + /* 89 */ ts + 1547, /* "ZeroOrNull" */ + /* 90 */ ts + 1558, /* "Offset" */ + /* 91 */ ts + 1565, /* "Column" */ + /* 92 */ ts + 1572, /* "Affinity" */ + /* 93 */ ts + 1581, /* "MakeRecord" */ + /* 94 */ ts + 1592, /* "Count" */ + /* 95 */ ts + 1598, /* "ReadCookie" */ + /* 96 */ ts + 1609, /* "SetCookie" */ + /* 97 */ ts + 1619, /* "ReopenIdx" */ + /* 98 */ ts + 1629, /* "OpenRead" */ + /* 99 */ ts + 1638, /* "OpenWrite" */ + /* 100 */ ts + 1648, /* "OpenDup" */ + /* 101 */ ts + 1656, /* "OpenAutoindex" */ + /* 102 */ ts + 1670, /* "BitAnd" */ + /* 103 */ ts + 1677, /* "BitOr" */ + /* 104 */ ts + 1683, /* "ShiftLeft" */ + /* 105 */ ts + 1693, /* "ShiftRight" */ + /* 106 */ ts + 1704, /* "Add" */ + /* 107 */ ts + 1708, /* "Subtract" */ + /* 108 */ ts + 1717, /* "Multiply" */ + /* 109 */ ts + 1726, /* "Divide" */ + /* 110 */ ts + 1733, /* "Remainder" */ + /* 111 */ ts + 1743, /* "Concat" */ + /* 112 */ ts + 1750, /* "OpenEphemeral" */ + /* 113 */ ts + 1764, /* "BitNot" */ + /* 114 */ ts + 1771, /* "SorterOpen" */ + /* 115 */ ts + 1782, /* "SequenceTest" */ + /* 116 */ ts + 1795, /* "String8" */ + /* 117 */ ts + 1803, /* "OpenPseudo" */ + /* 118 */ ts + 1814, /* "Close" */ + /* 119 */ ts + 1820, /* "ColumnsUsed" */ + /* 120 */ ts + 1832, /* "SeekScan" */ + /* 121 */ ts + 1841, /* "SeekHit" */ + /* 122 */ ts + 1849, /* "Sequence" */ + /* 123 */ ts + 1858, /* "NewRowid" */ + /* 124 */ ts + 1867, /* "Insert" */ + /* 125 */ ts + 1874, /* "RowCell" */ + /* 126 */ ts + 1882, /* "Delete" */ + /* 127 */ ts + 1889, /* "ResetCount" */ + /* 128 */ ts + 1900, /* "SorterCompare" */ + /* 129 */ ts + 1914, /* "SorterData" */ + /* 130 */ ts + 1925, /* "RowData" */ + /* 131 */ ts + 1933, /* "Rowid" */ + /* 132 */ ts + 1939, /* "NullRow" */ + /* 133 */ ts + 1947, /* "SeekEnd" */ + /* 134 */ ts + 1955, /* "IdxInsert" */ + /* 135 */ ts + 1965, /* "SorterInsert" */ + /* 136 */ ts + 1978, /* "IdxDelete" */ + /* 137 */ ts + 1988, /* "DeferredSeek" */ + /* 138 */ ts + 2001, /* "IdxRowid" */ + /* 139 */ ts + 2010, /* "FinishSeek" */ + /* 140 */ ts + 2021, /* "Destroy" */ + /* 141 */ ts + 2029, /* "Clear" */ + /* 142 */ ts + 2035, /* "ResetSorter" */ + /* 143 */ ts + 2047, /* "CreateBtree" */ + /* 144 */ ts + 2059, /* "SqlExec" */ + /* 145 */ ts + 2067, /* "ParseSchema" */ + /* 146 */ ts + 2079, /* "LoadAnalysis" */ + /* 147 */ ts + 2092, /* "DropTable" */ + /* 148 */ ts + 2102, /* "DropIndex" */ + /* 149 */ ts + 2112, /* "DropTrigger" */ + /* 150 */ ts + 2124, /* "IntegrityCk" */ + /* 151 */ ts + 2136, /* "RowSetAdd" */ + /* 152 */ ts + 2146, /* "Real" */ + /* 153 */ ts + 2151, /* "Param" */ + /* 154 */ ts + 2157, /* "FkCounter" */ + /* 155 */ ts + 2167, /* "MemMax" */ + /* 156 */ ts + 2174, /* "OffsetLimit" */ + /* 157 */ ts + 2186, /* "AggInverse" */ + /* 158 */ ts + 2197, /* "AggStep" */ + /* 159 */ ts + 2205, /* "AggStep1" */ + /* 160 */ ts + 2214, /* "AggValue" */ + /* 161 */ ts + 2223, /* "AggFinal" */ + /* 162 */ ts + 2232, /* "Expire" */ + /* 163 */ ts + 2239, /* "CursorLock" */ + /* 164 */ ts + 2250, /* "CursorUnlock" */ + /* 165 */ ts + 2263, /* "TableLock" */ + /* 166 */ ts + 2273, /* "VBegin" */ + /* 167 */ ts + 2280, /* "VCreate" */ + /* 168 */ ts + 2288, /* "VDestroy" */ + /* 169 */ ts + 2297, /* "VOpen" */ + /* 170 */ ts + 2303, /* "VColumn" */ + /* 171 */ ts + 2311, /* "VRename" */ + /* 172 */ ts + 2319, /* "Pagecount" */ + /* 173 */ ts + 2329, /* "MaxPgcnt" */ + /* 174 */ ts + 2338, /* "Trace" */ + /* 175 */ ts + 2344, /* "CursorHint" */ + /* 176 */ ts + 2355, /* "ReleaseReg" */ + /* 177 */ ts + 2366, /* "Noop" */ + /* 178 */ ts + 2371, /* "Explain" */ + /* 179 */ ts + 2379, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -33858,67 +34364,67 @@ type unix_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [29]unix_syscall{ - {FzName: ts + 2374 /* "open" */, FpCurrent: 0}, + {FzName: ts + 2389 /* "open" */, FpCurrent: 0}, - {FzName: ts + 2379 /* "close" */, FpCurrent: 0}, + {FzName: ts + 2394 /* "close" */, FpCurrent: 0}, - {FzName: ts + 2385 /* "access" */, FpCurrent: 0}, + {FzName: ts + 2400 /* "access" */, FpCurrent: 0}, - {FzName: ts + 2392 /* "getcwd" */, FpCurrent: 0}, + {FzName: ts + 2407 /* "getcwd" */, FpCurrent: 0}, - {FzName: ts + 2399 /* "stat" */, FpCurrent: 0}, + {FzName: ts + 2414 /* "stat" */, FpCurrent: 0}, // The DJGPP compiler environment looks mostly like Unix, but it // lacks the fcntl() system call. So redefine fcntl() to be something // that always succeeds. This means that locking does not occur under // DJGPP. But it is DOS - what did you expect? - {FzName: ts + 2404 /* "fstat" */, FpCurrent: 0}, + {FzName: ts + 2419 /* "fstat" */, FpCurrent: 0}, - {FzName: ts + 2410 /* "ftruncate" */, FpCurrent: 0}, + {FzName: ts + 2425 /* "ftruncate" */, FpCurrent: 0}, - {FzName: ts + 2420 /* "fcntl" */, FpCurrent: 0}, + {FzName: ts + 2435 /* "fcntl" */, FpCurrent: 0}, - {FzName: ts + 2426 /* "read" */, FpCurrent: 0}, + {FzName: ts + 2441 /* "read" */, FpCurrent: 0}, - {FzName: ts + 2431 /* "pread" */, FpCurrent: 0}, + {FzName: ts + 2446 /* "pread" */, FpCurrent: 0}, - {FzName: ts + 2437 /* "pread64" */}, + {FzName: ts + 2452 /* "pread64" */}, - {FzName: ts + 2445 /* "write" */, FpCurrent: 0}, + {FzName: ts + 2460 /* "write" */, FpCurrent: 0}, - {FzName: ts + 2451 /* "pwrite" */, FpCurrent: 0}, + {FzName: ts + 2466 /* "pwrite" */, FpCurrent: 0}, - {FzName: ts + 2458 /* "pwrite64" */}, + {FzName: ts + 2473 /* "pwrite64" */}, - {FzName: ts + 2467 /* "fchmod" */, FpCurrent: 0}, + {FzName: ts + 2482 /* "fchmod" */, FpCurrent: 0}, - {FzName: ts + 2474 /* "fallocate" */}, + {FzName: ts + 2489 /* "fallocate" */}, - {FzName: ts + 2484 /* "unlink" */, FpCurrent: 0}, + {FzName: ts + 2499 /* "unlink" */, FpCurrent: 0}, - {FzName: ts + 2491 /* "openDirectory" */, FpCurrent: 0}, + {FzName: ts + 2506 /* "openDirectory" */, FpCurrent: 0}, - {FzName: ts + 2505 /* "mkdir" */, FpCurrent: 0}, + {FzName: ts + 2520 /* "mkdir" */, FpCurrent: 0}, - {FzName: ts + 2511 /* "rmdir" */, FpCurrent: 0}, + {FzName: ts + 2526 /* "rmdir" */, FpCurrent: 0}, - {FzName: ts + 2517 /* "fchown" */, FpCurrent: 0}, + {FzName: ts + 2532 /* "fchown" */, FpCurrent: 0}, - {FzName: ts + 2524 /* "geteuid" */, FpCurrent: 0}, + {FzName: ts + 2539 /* "geteuid" */, FpCurrent: 0}, - {FzName: ts + 2532 /* "mmap" */, FpCurrent: 0}, + {FzName: ts + 2547 /* "mmap" */, FpCurrent: 0}, - {FzName: ts + 2537 /* "munmap" */, FpCurrent: 0}, + {FzName: ts + 2552 /* "munmap" */, FpCurrent: 0}, - {FzName: ts + 2544 /* "mremap" */}, + {FzName: ts + 2559 /* "mremap" */}, - {FzName: ts + 2551 /* "getpagesize" */, FpCurrent: 0}, + {FzName: ts + 2566 /* "getpagesize" */, FpCurrent: 0}, - {FzName: ts + 2563 /* "readlink" */, FpCurrent: 0}, + {FzName: ts + 2578 /* "readlink" */, FpCurrent: 0}, - {FzName: ts + 2572 /* "lstat" */, FpCurrent: 0}, + {FzName: ts + 2587 /* "lstat" */, FpCurrent: 0}, - {FzName: ts + 2578 /* "ioctl" */}, + {FzName: ts + 2593 /* "ioctl" */}, } /* sqlite3.c:34446:3 */ // End of the overrideable system calls @@ -34052,9 +34558,9 @@ func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3 } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, fd) Xsqlite3_log(tls, SQLITE_WARNING, - ts+2584 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + ts+2599 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) fd = -1 - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2627 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2642 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { break } } @@ -34313,13 +34819,13 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // the strerror() function to obtain the human-readable error message // equivalent to errno. Otherwise, use strerror_r(). // This is a threadsafe build, but strerror_r() is not available. - zErr = ts + 741 /* "" */ + zErr = ts + 756 /* "" */ if zPath == uintptr(0) { - zPath = ts + 741 /* "" */ + zPath = ts + 756 /* "" */ } Xsqlite3_log(tls, errcode, - ts+2637, /* "os_unix.c:%d: (%..." */ + ts+2652, /* "os_unix.c:%d: (%..." */ libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) return errcode @@ -34338,7 +34844,7 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // and move on. func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, h) != 0 { - unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2379, /* "close" */ + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2394, /* "close" */ func() uintptr { if pFile != 0 { return (*UnixFile)(unsafe.Pointer(pFile)).FzPath @@ -34438,7 +34944,7 @@ func findInodeInfo(tls *libc.TLS, pFile uintptr, ppInode uintptr) int32 { /* sql // the first page of the database, no damage is done. if ((*stat)(unsafe.Pointer(bp /* &statbuf */)).Fst_size == int64(0)) && (((*UnixFile)(unsafe.Pointer(pFile)).FfsFlags & uint32(SQLITE_FSFLAGS_IS_MSDOS)) != uint32(0)) { for ok := true; ok; ok = ((rc < 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR)) { - rc = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*24 + 8 /* &.pCurrent */))))(tls, fd, ts+2668 /* "S" */, uint64(1))) + rc = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*24 + 8 /* &.pCurrent */))))(tls, fd, ts+2683 /* "S" */, uint64(1))) } if rc != 1 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) @@ -34521,19 +35027,19 @@ func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) if rc != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2670 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2685 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if int32((*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink) == 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2694 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2709 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if int32((*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink) > 1 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2723 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2738 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2750 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2765 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -36360,7 +36866,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql var fd int32 = -1 // var zDirname [513]int8 at bp+8, 513 - Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2778 /* "%s" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2793 /* "%s" */, libc.VaList(bp, zFilename)) for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { } if ii > 0 { @@ -36379,7 +36885,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql if fd >= 0 { return SQLITE_OK } - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2491 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2506 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) } // Make sure all writes to a particular file are committed to disk. @@ -36414,7 +36920,7 @@ func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793 if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2781 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2796 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) } // Also fsync the directory containing the file if the DIRSYNC flag @@ -36452,7 +36958,7 @@ func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:378 rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2410 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2425 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) } else { // If the file was just truncated to a size smaller than the currently @@ -36531,7 +37037,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if iWrite >= nSize { iWrite = (nSize - int64(1)) } - nWrite = seekAndWrite(tls, pFile, iWrite, ts+741 /* "" */, 1) + nWrite = seekAndWrite(tls, pFile, iWrite, ts+756 /* "" */, 1) if nWrite != 1 { return (SQLITE_IOERR | (int32(3) << 8)) } @@ -36544,7 +37050,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2410 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2425 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) } } @@ -36618,7 +37124,7 @@ func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK } @@ -36911,7 +37417,7 @@ func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 // help detect if a -shm file truncation is legitimate or is the work // or a rogue process. if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2410 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2425 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) } } } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { @@ -37017,7 +37523,7 @@ __4: ; libc.X__builtin___memset_chk(tls, pShmNode, 0, (uint64(unsafe.Sizeof(unixShmNode{})) + uint64(nShmFilename)), libc.X__builtin_object_size(tls, pShmNode, 0)) zShm = libc.AssignPtrUintptr(pShmNode+16 /* &.zFilename */, (pShmNode + 1*96)) - Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2792 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2807 /* "%s-shm" */, libc.VaList(bp, zBasePath)) (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode @@ -37039,7 +37545,7 @@ __5: if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { goto __7 } - if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2799 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2814 /* "readonly_shm" */, 0)) { goto __8 } (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | O_NOFOLLOW), @@ -37054,7 +37560,7 @@ __8: if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { goto __10 } - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2374 /* "open" */, zShm, 38716) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2389 /* "open" */, zShm, 38716) goto shm_open_err __10: ; @@ -37221,11 +37727,11 @@ __11: goto __13 } *(*int32)(unsafe.Pointer(bp + 144 /* x */)) = 0 - if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+741 /* "" */, 1, bp+144 /* &x */) != 1) { + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+756 /* "" */, 1, bp+144 /* &x */) != 1) { goto __14 } zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2445 /* "write" */, zFile, 38860) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2460 /* "write" */, zFile, 38860) goto shmpage_out __14: ; @@ -37273,7 +37779,7 @@ __16: if !(pMem == (libc.UintptrFromInt32(-1))) { goto __20 } - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2532 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2547 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) goto shmpage_out __20: ; @@ -37532,7 +38038,7 @@ func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ // continue accessing the database using the xRead() and xWrite() // methods. func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ - var zErr uintptr = ts + 2532 /* "mmap" */ + var zErr uintptr = ts + 2547 /* "mmap" */ var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes @@ -37829,7 +38335,7 @@ func autolockIoFinderImpl(tls *libc.TLS, filePath uintptr, pNew uintptr) uintptr (*flock)(unsafe.Pointer(bp + 2176 /* &lockInfo */)).Fl_whence = int16(SEEK_SET) (*flock)(unsafe.Pointer(bp + 2176 /* &lockInfo */)).Fl_type = int16(F_RDLCK) if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pNew)).Fh, F_GETLK, libc.VaList(bp, bp+2176 /* &lockInfo */)) != -1 { - if libc.Xstrcmp(tls, bp+8 /* &fsInfo */ +72 /* &.f_fstypename */, ts+2812 /* "nfs" */) == 0 { + if libc.Xstrcmp(tls, bp+8 /* &fsInfo */ +72 /* &.f_fstypename */, ts+2827 /* "nfs" */) == 0 { return uintptr(unsafe.Pointer(&nfsIoMethods)) } else { return uintptr(unsafe.Pointer(&posixIoMethods)) @@ -37846,11 +38352,11 @@ type Mapping = struct { } /* sqlite3.c:39574:16 */ var aMap = [6]Mapping{ - {FzFilesystem: ts + 2816 /* "hfs" */, FpMethods: 0}, - {FzFilesystem: ts + 2820 /* "ufs" */, FpMethods: 0}, - {FzFilesystem: ts + 2824 /* "afpfs" */, FpMethods: 0}, - {FzFilesystem: ts + 2830 /* "smbfs" */, FpMethods: 0}, - {FzFilesystem: ts + 2836 /* "webdav" */, FpMethods: 0}, + {FzFilesystem: ts + 2831 /* "hfs" */, FpMethods: 0}, + {FzFilesystem: ts + 2835 /* "ufs" */, FpMethods: 0}, + {FzFilesystem: ts + 2839 /* "afpfs" */, FpMethods: 0}, + {FzFilesystem: ts + 2845 /* "smbfs" */, FpMethods: 0}, + {FzFilesystem: ts + 2851 /* "webdav" */, FpMethods: 0}, {}, } /* sqlite3.c:39577:5 */ var autolockIoFinder uintptr = 0 /* sqlite3.c:39624:3 */ @@ -37887,10 +38393,10 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename } return uintptr(0) }(), - ts+2843 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + ts+2858 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2848 /* "unix-excl" */) == 0 { + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2863 /* "unix-excl" */) == 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) } @@ -37964,7 +38470,7 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename if zLockFile == uintptr(0) { rc = SQLITE_NOMEM } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2858 /* "%s.lock" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2873 /* "%s.lock" */, libc.VaList(bp, zFilename)) } (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -37994,10 +38500,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var zDir uintptr = Xsqlite3_temp_directory if !(int32(azDirs[0]) != 0) { - azDirs[0] = libc.Xgetenv(tls, ts+2866 /* "SQLITE_TMPDIR" */) + azDirs[0] = libc.Xgetenv(tls, ts+2881 /* "SQLITE_TMPDIR" */) } if !(int32(azDirs[1]) != 0) { - azDirs[1] = libc.Xgetenv(tls, ts+2880 /* "TMPDIR" */) + azDirs[1] = libc.Xgetenv(tls, ts+2895 /* "TMPDIR" */) } for 1 != 0 { if (((zDir != uintptr(0)) && @@ -38017,10 +38523,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var azDirs = [6]uintptr{ uintptr(0), uintptr(0), - ts + 2887, /* "/var/tmp" */ - ts + 2896, /* "/usr/tmp" */ - ts + 2905, /* "/tmp" */ - ts + 754, /* "." */ + ts + 2902, /* "/var/tmp" */ + ts + 2911, /* "/usr/tmp" */ + ts + 2920, /* "/tmp" */ + ts + 769, /* "." */ } /* sqlite3.c:39857:21 */ // Create a temporary file name in zBuf. zBuf must be allocated @@ -38048,7 +38554,7 @@ func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2910, /* "%s/etilqs_%llx%c" */ + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2925, /* "%s/etilqs_%llx%c" */ libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { return SQLITE_ERROR @@ -38204,7 +38710,7 @@ func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr // filename, check for the "modeof" parameter. If present, interpret // its value as a filename and try to copy the mode, uid and gid from // that file. - var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2927 /* "modeof" */) + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2942 /* "modeof" */) if z != 0 { rc = getFileMode(tls, z, pMode, pUid, pGid) } @@ -38436,7 +38942,7 @@ __15: if !(fd < 0) { goto __19 } - rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2374 /* "open" */, zName, 40257) + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2389 /* "open" */, zName, 40257) if !(rc == SQLITE_OK) { goto __20 } @@ -38500,13 +39006,13 @@ __25: return (SQLITE_IOERR | (int32(13) << 8)) __26: ; - if !(0 == libc.Xstrncmp(tls, ts+2934 /* "msdos" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { + if !(0 == libc.Xstrncmp(tls, ts+2949 /* "msdos" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { goto __27 } *(*uint32)(unsafe.Pointer(pFile + 124 /* &.fsFlags */)) |= (uint32(SQLITE_FSFLAGS_IS_MSDOS)) __27: ; - if !(0 == libc.Xstrncmp(tls, ts+2940 /* "exfat" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { + if !(0 == libc.Xstrncmp(tls, ts+2955 /* "exfat" */, bp+528 /* &fsInfo */ +72 /* &.f_fstypename */, uint64(5))) { goto __28 } *(*uint32)(unsafe.Pointer(pFile + 124 /* &.fsFlags */)) |= (uint32(SQLITE_FSFLAGS_IS_MSDOS)) @@ -38549,7 +39055,7 @@ __33: if !((((isAutoProxy != 0) && (zPath != (uintptr(0)))) && (!(noLock != 0))) && ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen != 0)) { goto __34 } - envforce = libc.Xgetenv(tls, ts+2946 /* "SQLITE_FORCE_PRO..." */) + envforce = libc.Xgetenv(tls, ts+2961 /* "SQLITE_FORCE_PRO..." */) useProxy = 0 // SQLITE_FORCE_PROXY_LOCKING==1 means force always use proxy, 0 means @@ -38570,7 +39076,7 @@ __36: if !(rc == SQLITE_OK) { goto __38 } - rc = proxyTransformUnixFile(tls, pFile, ts+2973 /* ":auto:" */) + rc = proxyTransformUnixFile(tls, pFile, ts+2988 /* ":auto:" */) if !(rc != SQLITE_OK) { goto __39 } @@ -38614,7 +39120,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == ENOENT { rc = (SQLITE_IOERR | (int32(23) << 8)) } else { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2484 /* "unlink" */, zPath, 40396) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2499 /* "unlink" */, zPath, 40396) } return rc } @@ -38624,7 +39130,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) if rc == SQLITE_OK { if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2980 /* "fsync" */, zPath, 40406) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2995 /* "fsync" */, zPath, 40406) } robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) } else { @@ -38699,7 +39205,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, zOut, (uint64(nOut-2))) == uintptr(0) { - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2392 /* "getcwd" */, zPath, 40485) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2407 /* "getcwd" */, zPath, 40485) } iOff = Xsqlite3Strlen30(tls, zOut) *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') @@ -38710,7 +39216,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) return Xsqlite3CantopenError(tls, 40494) } - Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2778 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2793 /* "%s" */, libc.VaList(bp, zPath)) // Remove duplicate '/' characters. Except, two // at the beginning // of a pathname is allowed since this is important on windows. @@ -38785,7 +39291,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*24 + 8 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) != ENOENT { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2572 /* "lstat" */, zIn, 40577) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2587 /* "lstat" */, zIn, 40577) } } else { bLink = (libc.Bool32(((int32((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode)) & S_IFMT) == S_IFLNK)) @@ -38805,7 +39311,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if rc == SQLITE_OK { nByte = int32((*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls, zIn, zDel, (uint64(nOut - 1)))) if nByte < 0 { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2563 /* "readlink" */, zIn, 40595) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2578 /* "readlink" */, zIn, 40595) } else { if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { var n int32 @@ -39150,7 +39656,7 @@ func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { unixEnterMutex(tls) zErr = libc.Xdlerror(tls) if zErr != 0 { - Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2778 /* "%s" */, libc.VaList(bp, zErr)) + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2793 /* "%s" */, libc.VaList(bp, zErr)) } unixLeaveMutex(tls) } @@ -39207,7 +39713,7 @@ func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) in { var fd int32 var got int32 - fd = robust_open(tls, ts+2986 /* "/dev/urandom" */, O_RDONLY, uint16(0)) + fd = robust_open(tls, ts+3001 /* "/dev/urandom" */, O_RDONLY, uint16(0)) if fd < 0 { // var t Time_t at bp, 8 @@ -39641,12 +40147,12 @@ func proxyGetLockPath(tls *libc.TLS, dbPath uintptr, lPath uintptr, maxLen Size_ return (SQLITE_IOERR | (int32(15) << 8)) } - len = int32(libc.Xstrlcat(tls, lPath, ts+2999 /* "sqliteplocks" */, maxLen)) + len = int32(libc.Xstrlcat(tls, lPath, ts+3014 /* "sqliteplocks" */, maxLen)) } if int32(*(*int8)(unsafe.Pointer(lPath + uintptr((len - 1))))) != '/' { - len = int32(libc.Xstrlcat(tls, lPath, ts+3012 /* "/" */, maxLen)) + len = int32(libc.Xstrlcat(tls, lPath, ts+3027 /* "/" */, maxLen)) } // transform the db path to a unique cache name @@ -39661,7 +40167,7 @@ func proxyGetLockPath(tls *libc.TLS, dbPath uintptr, lPath uintptr, maxLen Size_ }() } *(*int8)(unsafe.Pointer(lPath + uintptr((i + len)))) = int8(0) - libc.Xstrlcat(tls, lPath, ts+2973 /* ":auto:" */, maxLen) + libc.Xstrlcat(tls, lPath, ts+2988 /* ":auto:" */, maxLen) return SQLITE_OK } @@ -39813,7 +40319,7 @@ __14: (*UnixFile)(unsafe.Pointer(pNew)).FopenFlags = openFlags libc.X__builtin___memset_chk(tls, bp /* &dummyVfs */, 0, uint64(unsafe.Sizeof(Sqlite3_vfs{})), libc.X__builtin_object_size(tls, bp /* &dummyVfs */, 0)) (*Sqlite3_vfs)(unsafe.Pointer(bp /* &dummyVfs */)).FpAppData = uintptr(unsafe.Pointer(&autolockIoFinder)) - (*Sqlite3_vfs)(unsafe.Pointer(bp /* &dummyVfs */)).FzName = ts + 3014 /* "dummy" */ + (*Sqlite3_vfs)(unsafe.Pointer(bp /* &dummyVfs */)).FzName = ts + 3029 /* "dummy" */ (*UnixUnusedFd)(unsafe.Pointer(pUnused)).Ffd = fd (*UnixUnusedFd)(unsafe.Pointer(pUnused)).Fflags = openFlags (*UnixFile)(unsafe.Pointer(pNew)).FpPreallocatedUnused = pUnused @@ -39883,17 +40389,17 @@ func proxyBreakConchLock(tls *libc.TLS, pFile uintptr, myHostID uintptr) int32 { cPath = (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FconchFilePath readLen = uint64(0) pathLen = uint64(0) - *(*[64]int8)(unsafe.Pointer(bp + 1088 /* errmsg */)) = *(*[64]int8)(unsafe.Pointer(ts + 3020 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00..." */)) + *(*[64]int8)(unsafe.Pointer(bp + 1088 /* errmsg */)) = *(*[64]int8)(unsafe.Pointer(ts + 3035 /* "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00..." */)) fd = -1 rc = -1 _ = myHostID // create a new path by replace the trailing '-conch' with '-break' pathLen = libc.Xstrlcpy(tls, bp+64 /* &tPath[0] */, cPath, uint64(PATH_MAX)) - if !(((pathLen > uint64(PATH_MAX)) || (pathLen < uint64(6))) || (libc.Xstrlcpy(tls, (bp+64 /* &tPath */ +uintptr((pathLen-uint64(5)))), ts+3084 /* "break" */, uint64(6)) != uint64(5))) { + if !(((pathLen > uint64(PATH_MAX)) || (pathLen < uint64(6))) || (libc.Xstrlcpy(tls, (bp+64 /* &tPath */ +uintptr((pathLen-uint64(5)))), ts+3099 /* "break" */, uint64(6)) != uint64(5))) { goto __1 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3090 /* "path error (len ..." */, libc.VaList(bp, int32(pathLen))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3105 /* "path error (len ..." */, libc.VaList(bp, int32(pathLen))) goto end_breaklock __1: ; @@ -39902,7 +40408,7 @@ __1: if !(readLen < (uint64(PROXY_HEADERLEN + PROXY_HOSTIDLEN))) { goto __2 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3110 /* "read error (len ..." */, libc.VaList(bp+8, int32(readLen))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3125 /* "read error (len ..." */, libc.VaList(bp+8, int32(readLen))) goto end_breaklock __2: ; @@ -39911,26 +40417,26 @@ __2: if !(fd < 0) { goto __3 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3130 /* "create failed (%..." */, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3145 /* "create failed (%..." */, libc.VaList(bp+16, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) goto end_breaklock __3: ; if !((*(*func(*libc.TLS, int32, uintptr, Size_t, Off_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 12*24 + 8 /* &.pCurrent */))))(tls, fd, bp+1152 /* &buf[0] */, readLen, int64(0)) != Ssize_t(readLen)) { goto __4 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3149 /* "write failed (%d..." */, libc.VaList(bp+24, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3164 /* "write failed (%d..." */, libc.VaList(bp+24, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) goto end_breaklock __4: ; if !(libc.Xrename(tls, bp+64 /* &tPath[0] */, cPath) != 0) { goto __5 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3167 /* "rename failed (%..." */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+1088 /* &errmsg[0] */, ts+3182 /* "rename failed (%..." */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(libc.X__error(tls))))) goto end_breaklock __5: ; rc = 0 - libc.Xfprintf(tls, libc.X__stderrp, ts+3186 /* "broke stale lock..." */, libc.VaList(bp+40, cPath)) + libc.Xfprintf(tls, libc.X__stderrp, ts+3201 /* "broke stale lock..." */, libc.VaList(bp+40, cPath)) robust_close(tls, pFile, (*UnixFile)(unsafe.Pointer(conchFile)).Fh, 41282) (*UnixFile)(unsafe.Pointer(conchFile)).Fh = fd (*UnixFile)(unsafe.Pointer(conchFile)).FopenFlags = (O_RDWR | O_CREAT) @@ -39946,7 +40452,7 @@ end_breaklock: robust_close(tls, pFile, fd, 41290) __7: ; - libc.Xfprintf(tls, libc.X__stderrp, ts+3210 /* "failed to break ..." */, libc.VaList(bp+48, cPath, bp+1088 /* &errmsg[0] */)) + libc.Xfprintf(tls, libc.X__stderrp, ts+3225 /* "failed to break ..." */, libc.VaList(bp+48, cPath, bp+1088 /* &errmsg[0] */)) __6: ; return rc @@ -40404,7 +40910,7 @@ func proxyCreateConchPathname(tls *libc.TLS, dbPath uintptr, pConchPath uintptr) } // append the "-conch" suffix to the file - libc.X__builtin___memcpy_chk(tls, (conchPath + uintptr((i + 1))), ts+3248 /* "-conch" */, uint64(7), libc.X__builtin_object_size(tls, (conchPath+uintptr((i+1))), 0)) + libc.X__builtin___memcpy_chk(tls, (conchPath + uintptr((i + 1))), ts+3263 /* "-conch" */, uint64(7), libc.X__builtin_object_size(tls, (conchPath+uintptr((i+1))), 0)) return SQLITE_OK } @@ -40421,7 +40927,7 @@ func switchLockProxyPath(tls *libc.TLS, pFile uintptr, path uintptr) int32 { /* } // nothing to do if the path is NULL, :auto: or matches the existing path - if ((!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2973 /* ":auto:" */) != 0)) || ((oldPath != 0) && !(libc.Xstrncmp(tls, oldPath, path, uint64(PATH_MAX)) != 0)) { + if ((!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2988 /* ":auto:" */) != 0)) || ((oldPath != 0) && !(libc.Xstrncmp(tls, oldPath, path, uint64(PATH_MAX)) != 0)) { return SQLITE_OK } else { var lockProxy uintptr = (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxy @@ -40456,7 +40962,7 @@ func proxyGetDbPathForUnixFile(tls *libc.TLS, pFile uintptr, dbPath uintptr) int } else if (*UnixFile)(unsafe.Pointer(pFile)).FpMethod == uintptr(unsafe.Pointer(&dotlockIoMethods)) { // dot lock style uses the locking context to store the dot lock // file path - var len int32 = (int32(libc.Xstrlen(tls, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext) - libc.Xstrlen(tls, ts+3255 /* ".lock" */))) + var len int32 = (int32(libc.Xstrlen(tls, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext) - libc.Xstrlen(tls, ts+3270 /* ".lock" */))) libc.X__builtin___memcpy_chk(tls, dbPath, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext, (uint64(len + 1)), libc.X__builtin_object_size(tls, dbPath, 0)) } else { // all other styles use the locking context to store the db file path @@ -40486,7 +40992,7 @@ func proxyTransformUnixFile(tls *libc.TLS, pFile uintptr, path uintptr) int32 { return SQLITE_BUSY } proxyGetDbPathForUnixFile(tls, pFile, bp /* &dbPath[0] */) - if (!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2973 /* ":auto:" */) != 0) { + if (!(path != 0) || (int32(*(*int8)(unsafe.Pointer(path))) == 0)) || !(libc.Xstrcmp(tls, path, ts+2988 /* ":auto:" */) != 0) { lockPath = uintptr(0) } else { lockPath = path @@ -40567,7 +41073,7 @@ func proxyFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { if (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath != 0 { *(*uintptr)(unsafe.Pointer(pArg)) = (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath } else { - *(*uintptr)(unsafe.Pointer(pArg)) = ts + 3261 /* ":auto: (not held..." */ + *(*uintptr)(unsafe.Pointer(pArg)) = ts + 3276 /* ":auto: (not held..." */ } } else { *(*uintptr)(unsafe.Pointer(pArg)) = uintptr(0) @@ -40594,7 +41100,7 @@ func proxyFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { var proxyPath uintptr = pArg if isProxyStyle != 0 { var pCtx uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext - if !(libc.Xstrcmp(tls, pArg, ts+2973 /* ":auto:" */) != 0) || + if !(libc.Xstrcmp(tls, pArg, ts+2988 /* ":auto:" */) != 0) || (((*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath != 0) && !(libc.Xstrncmp(tls, (*ProxyLockingContext)(unsafe.Pointer(pCtx)).FlockProxyPath, proxyPath, uint64(PATH_MAX)) != 0)) { rc = SQLITE_OK } else { @@ -40797,15 +41303,15 @@ func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ } var aVfs = [9]Sqlite3_vfs{ - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3279 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3284 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3294 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2848 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3307 /* "unix-posix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3318 /* "unix-flock" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3329 /* "unix-afp" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3338 /* "unix-nfs" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3347 /* "unix-proxy" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3294 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3299 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3309 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2863 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3322 /* "unix-posix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3333 /* "unix-flock" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3344 /* "unix-afp" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3353 /* "unix-nfs" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 3362 /* "unix-proxy" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, } /* sqlite3.c:42091:22 */ // Shutdown the operating system interface. @@ -40900,7 +41406,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 3358, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 3373, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -41132,7 +41638,7 @@ func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int3 var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+3364 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+3379 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -41275,7 +41781,7 @@ func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+2778 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+2793 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -41392,7 +41898,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+3379 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3394 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { @@ -41465,7 +41971,7 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+3402 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3417 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } @@ -46942,7 +47448,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3417, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3432, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -48694,7 +49200,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.X__builtin___memcpy_chk(tls, pPtr, zPathname, uint64(nPathname), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += uintptr(nPathname) - libc.X__builtin___memcpy_chk(tls, pPtr, ts+3444 /* "-journal" */, uint64(8), libc.X__builtin_object_size(tls, pPtr, 0)) + libc.X__builtin___memcpy_chk(tls, pPtr, ts+3459 /* "-journal" */, uint64(8), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -48709,7 +49215,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.X__builtin___memcpy_chk(tls, pPtr, zPathname, uint64(nPathname), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += uintptr(nPathname) - libc.X__builtin___memcpy_chk(tls, pPtr, ts+3453 /* "-wal" */, uint64(4), libc.X__builtin_object_size(tls, pPtr, 0)) + libc.X__builtin___memcpy_chk(tls, pPtr, ts+3468 /* "-wal" */, uint64(4), libc.X__builtin_object_size(tls, pPtr, 0)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -48768,9 +49274,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3458 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3473 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3465 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3480 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -52666,7 +53172,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+3475, /* "recovered %d fra..." */ + ts+3490, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -53411,7 +53917,7 @@ func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13 } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+3512 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+3527 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -56191,7 +56697,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3538 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3553 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -58231,7 +58737,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3554 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3569 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -59105,7 +59611,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+3563 /* "@ " */, uint64(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+3578 /* "@ " */, uint64(3)) != 0) { goto __14 } goto page1_init_failed @@ -66619,7 +67125,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3567 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3582 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 56 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -66655,11 +67161,11 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+3569 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3584 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+3592 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + checkAppendMsg(tls, pCheck, ts+3607 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -66686,13 +67192,13 @@ func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent P if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+3617 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+3632 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+3646, /* "Bad ptr map entr..." */ + ts+3661, /* "Bad ptr map entr..." */ libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } @@ -66715,7 +67221,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } N-- if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+3700 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3715 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) @@ -66726,7 +67232,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+3722 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + ts+3737 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -66752,12 +67258,12 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+3761, /* "%s is %d but sho..." */ + ts+3776, /* "%s is %d but sho..." */ libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 3787 /* "size" */ + return ts + 3802 /* "size" */ } - return ts + 3792 /* "overflow list le..." */ + return ts + 3807 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -66901,13 +67407,13 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3813 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3828 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+3823 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+3838 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; @@ -66921,7 +67427,7 @@ __3: } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+3861 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + ts+3876 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; @@ -66929,7 +67435,7 @@ __4: goto __5 } - checkAppendMsg(tls, pCheck, ts+3899 /* "free space corru..." */, libc.VaList(bp+16, rc)) + checkAppendMsg(tls, pCheck, ts+3914 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; @@ -66937,7 +67443,7 @@ __5: hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3921 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3936 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -66959,7 +67465,7 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3947 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3962 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; @@ -66990,7 +67496,7 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+3975, /* "Offset %d out of..." */ + checkAppendMsg(tls, pCheck, ts+3990, /* "Offset %d out of..." */ libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 @@ -67001,7 +67507,7 @@ __12: if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+4005 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+4020 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: @@ -67019,7 +67525,7 @@ __13: }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+4029 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+4044 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) __15: ; *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey @@ -67060,7 +67566,7 @@ __20: if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+4053 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+4068 /* "Child page depth..." */, 0) depth = d2 __21: ; @@ -67158,7 +67664,7 @@ __29: goto __31 } checkAppendMsg(tls, pCheck, - ts+4078 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) + ts+4093 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) goto __30 goto __32 __31: @@ -67178,7 +67684,7 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+4115, /* "Fragmentation of..." */ + ts+4130, /* "Fragmentation of..." */ libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; @@ -67307,7 +67813,7 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 4167 /* "Main freelist: " */ + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 4182 /* "Main freelist: " */ checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) @@ -67345,7 +67851,7 @@ __13: goto __15 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+4183, /* "max rootpage (%d..." */ + ts+4198, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -67355,7 +67861,7 @@ __9: goto __16 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+4228 /* "incremental_vacu..." */, 0) + ts+4243 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -67405,13 +67911,13 @@ __23: if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4283 /* "Page %d is never..." */, libc.VaList(bp+16, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4298 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4305 /* "Pointer map page..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+4320 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -67730,7 +68236,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt libc.X__builtin___memset_chk(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{})), libc.X__builtin_object_size(tls, bp+16 /* &sParse */, 0)) (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2778 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2793 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) @@ -67741,7 +68247,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+4339 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+4354 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -67762,7 +68268,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+4359 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+4374 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -67789,7 +68295,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+4390 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+4405 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -68403,7 +68909,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4430, /* "%!.15g" */ + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4445, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -69044,7 +69550,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -69250,6 +69756,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -69555,7 +70063,7 @@ __9: goto __10 } rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -69627,7 +70135,7 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 741 /* "" */ + zNeg = ts + 756 /* "" */ rc = SQLITE_OK __1: @@ -69676,7 +70184,7 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 4437 /* "-" */ + zNeg = ts + 4452 /* "-" */ __6: ; @@ -69696,7 +70204,7 @@ __9: Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+4439 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+4454 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } @@ -71141,34 +71649,34 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4444 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4459 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(j)*8)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 741 /* "" */ + zColl = ts + 756 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+304 /* "BINARY" */) == 0 { - zColl = ts + 4449 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+319 /* "BINARY" */) == 0 { + zColl = ts + 4464 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4451, /* ",%s%s%s" */ + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4466, /* ",%s%s%s" */ libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 4437 /* "-" */ + return ts + 4452 /* "-" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 4459 /* "N." */ + return ts + 4474 /* "N." */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4477 /* ")" */, 1) break } @@ -71176,7 +71684,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4464 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4479 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -71184,32 +71692,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4473 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4488 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4473 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4488 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4480 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4495 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4485 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4500 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+524 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+539 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -71219,14 +71727,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4480 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4495 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+524 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+539 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 742 /* "NULL" */ + zP4 = ts + 757 /* "NULL" */ } else { - zP4 = ts + 4488 /* "(blob)" */ + zP4 = ts + 4503 /* "(blob)" */ } break @@ -71234,7 +71742,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4495 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4510 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -71245,20 +71753,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4503 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4518 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4508 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4523 /* "]" */, 1) break } case -4: { - zP4 = ts + 4510 /* "program" */ + zP4 = ts + 4525 /* "program" */ break } @@ -71290,7 +71798,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 4518 /* "?" */, ts + 4520 /* "8" */, ts + 4522 /* "16LE" */, ts + 4527 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 4533 /* "?" */, ts + 4535 /* "8" */, ts + 4537 /* "16LE" */, ts + 4542 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -71821,8 +72329,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 4532 /* "addr" */, ts + 4537 /* "opcode" */, ts + 4544 /* "p1" */, ts + 4547 /* "p2" */, ts + 4550 /* "p3" */, ts + 4553 /* "p4" */, ts + 4556 /* "p5" */, ts + 4559, /* "comment" */ - ts + 4567 /* "id" */, ts + 4570 /* "parent" */, ts + 4577 /* "notused" */, ts + 4585, /* "detail" */ + ts + 4547 /* "addr" */, ts + 4552 /* "opcode" */, ts + 4559 /* "p1" */, ts + 4562 /* "p2" */, ts + 4565 /* "p3" */, ts + 4568 /* "p4" */, ts + 4571 /* "p5" */, ts + 4574, /* "comment" */ + ts + 4582 /* "id" */, ts + 4585 /* "parent" */, ts + 4592 /* "notused" */, ts + 4600, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -72070,7 +72578,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+4592 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+4607 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } @@ -72080,16 +72588,16 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4604 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4619 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4618 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4633 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4633, /* "-mj%06X9%02X" */ + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4648, /* "-mj%06X9%02X" */ libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. @@ -72283,7 +72791,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+4646 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4661 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -72565,7 +73073,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -74116,13 +74624,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 4676 /* "a CHECK constrai..." */ + zContext = ts + 4691 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 4695 /* "a generated colu..." */ + zContext = ts + 4710 /* "a generated colu..." */ } else { - zContext = ts + 4714 /* "an index" */ + zContext = ts + 4729 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+4723, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+4738, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -74253,7 +74761,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4759 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4774 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -74263,7 +74771,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4804 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4819 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -74733,7 +75241,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4844 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4859 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -75484,7 +75992,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+4867 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+4882 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -76261,7 +76769,7 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4907 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4922 /* "-- " */, 3) Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) } @@ -76299,11 +76807,11 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 184 /* idx */))-1))*56) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+742 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+757 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4480 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4495 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4430 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4445 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc @@ -76318,21 +76826,21 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = bp + 192 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4911 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4926 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { Xsqlite3VdbeMemRelease(tls, bp+192 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4918 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4933 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4931 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4946 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4934 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4949 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4939 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4954 /* "'" */, 1) } } } @@ -80031,19 +80539,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+4941 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+4956 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4962 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4977 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4969 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4984 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -82593,7 +83101,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+4993 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5008 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -82666,7 +83174,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+5044 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + Xsqlite3VdbeError(tls, p, ts+5059 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -82676,7 +83184,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+5066 /* "cannot release s..." */, 0) + ts+5081 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -82881,7 +83389,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+5120 /* "cannot commit tr..." */, 0) + ts+5135 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -82924,13 +83432,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 5175 /* "cannot start a t..." */ + return ts + 5190 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 5223 /* "cannot rollback ..." */ + return ts + 5238 /* "cannot rollback ..." */ } - return ts + 5266 /* "cannot commit - ..." */ + return ts + 5281 /* "cannot commit - ..." */ }() }(), 0) @@ -83048,7 +83556,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+5307 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+5322 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -83430,7 +83938,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 741 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 756 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -85560,7 +86068,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+5335 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+5350 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -85993,14 +86501,14 @@ __137: goto __720 __719: - zSchema = ts + 5352 /* "sqlite_master" */ + zSchema = ts + 5367 /* "sqlite_master" */ (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FiDb = iDb3 (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmInitFlags = U32(0) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+5366, /* "SELECT*FROM\"%w\"...." */ + ts+5381, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 @@ -86333,7 +86841,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+5409 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5424 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -86778,7 +87286,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -86856,7 +87364,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -86971,12 +87479,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+5446, /* "cannot change %s..." */ + ts+5461, /* "cannot change %s..." */ libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 5498 /* "into" */ + return ts + 5513 /* "into" */ } - return ts + 5503 /* "out of" */ + return ts + 5518 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -87179,7 +87687,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+5510 /* "database table i..." */, libc.VaList(bp+112, z1)) + Xsqlite3VdbeError(tls, p, ts+5525 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -87423,7 +87931,7 @@ __833: if !((*Sqlite3_context)(unsafe.Pointer(bp+872 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) rc = (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FisError __834: ; @@ -87754,7 +88262,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -87844,7 +88352,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+5539 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+5554 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -87947,13 +88455,13 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+2778 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+2793 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+5545, /* "statement aborts..." */ + Xsqlite3_log(tls, rc, ts+5560, /* "statement aborts..." */ libc.VaList(bp+152, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { @@ -87998,14 +88506,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+4844 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4859 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+5577 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+5592 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -88018,8 +88526,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 5591 /* "NOT NULL" */, ts + 5600 /* "UNIQUE" */, ts + 5607, /* "CHECK" */ - ts + 5613 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 5606 /* "NOT NULL" */, ts + 5615 /* "UNIQUE" */, ts + 5622, /* "CHECK" */ + ts + 5628 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -88126,16 +88634,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5625, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5640, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 5654 /* "null" */ + return ts + 5669 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 5659 /* "real" */ + return ts + 5674 /* "real" */ } - return ts + 5664 /* "integer" */ + return ts + 5679 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -88155,10 +88663,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5672 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5687 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2778 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2793 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -88221,21 +88729,21 @@ __4: goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5692 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5707 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5722 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5737 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5758 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5773 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { @@ -88280,7 +88788,7 @@ __12: goto __14 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5779 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5794 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -88309,7 +88817,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FiFrom == iCol) { goto __23 } - zFault = ts + 5800 /* "foreign key" */ + zFault = ts + 5815 /* "foreign key" */ __23: ; goto __21 @@ -88342,7 +88850,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 5812 /* "indexed" */ + zFault = ts + 5827 /* "indexed" */ __30: ; goto __28 @@ -88363,7 +88871,7 @@ __26: goto __31 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5820 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5835 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -88472,7 +88980,7 @@ __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)))) @@ -88637,7 +89145,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) @@ -92195,7 +92703,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5854 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5869 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -92398,14 +92906,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5859 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5874 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5863 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5878 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -92422,7 +92930,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5867 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5882 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -92599,7 +93107,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+5876 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5891 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -92607,14 +93115,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+5907 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5922 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -92690,7 +93198,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+5962 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + ts+5977 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) return WRC_Prune @@ -92711,23 +93219,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 5997 /* "no such column" */ + zErr = ts + 6012 /* "no such column" */ } else { - zErr = ts + 6012 /* "ambiguous column..." */ + zErr = ts + 6027 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+6034 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6049 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+6047 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6062 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+6057 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6072 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -92861,15 +93369,15 @@ func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExp bp := tls.Alloc(16) defer tls.Free(16) - var zIn uintptr = ts + 6064 /* "partial index WH..." */ + var zIn uintptr = ts + 6079 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 6092 /* "index expression..." */ + zIn = ts + 6107 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 6110 /* "CHECK constraint..." */ + zIn = ts + 6125 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 6128 /* "generated column..." */ + zIn = ts + 6143 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+6146 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+6161 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -92977,10 +93485,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6166 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6181 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6171 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6186 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -93033,7 +93541,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6177 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+6192 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -93100,7 +93608,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6194 /* "second argument ..." */, 0) + ts+6209 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -93125,7 +93633,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+6265, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6280, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -93149,7 +93657,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6300 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+6315 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -93178,30 +93686,30 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6328 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + ts+6343 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 6372 /* "window" */ + zType = ts + 6387 /* "window" */ } else { - zType = ts + 6379 /* "aggregate" */ + zType = ts + 6394 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+6389 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6404 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6418 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6433 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6441, /* "wrong number of ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6456, /* "wrong number of ..." */ libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+6486, /* "FILTER may not b..." */ + ts+6501, /* "FILTER may not b..." */ libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -93276,7 +93784,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6535 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6550 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) @@ -93293,7 +93801,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6546 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6561 /* "parameters" */, pExpr) } break @@ -93353,7 +93861,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) } break @@ -93458,7 +93966,7 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 Xsqlite3ErrorMsg(tls, pParse, - ts+6557 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+6572 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -93490,7 +93998,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6613 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6628 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -93525,7 +94033,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+6647 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + resolveOutOfRangeError(tls, pParse, ts+6662 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { @@ -93596,7 +94104,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6653 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+6668 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -93624,7 +94132,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6714 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+6729 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -93913,7 +94421,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6745 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6760 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -93970,7 +94478,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6647 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6662 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -93983,7 +94491,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6789 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6804 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -93995,7 +94503,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6795 /* "aggregate functi..." */, 0) + ts+6810 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -94765,7 +95273,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) return } @@ -94841,7 +95349,7 @@ func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+6854 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+6869 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -95082,7 +95590,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6917 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -95104,7 +95612,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6904 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+6919 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -95138,7 +95646,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+6938 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6953 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -95191,7 +95699,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6957, /* "variable number ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6972, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) return } @@ -95218,7 +95726,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7000 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+7015 /* "too many SQL var..." */, 0) } } @@ -95887,7 +96395,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+7023, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7038, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -96022,7 +96530,7 @@ func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+7053 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+7068 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -96077,10 +96585,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+6166 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+6181 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+6171 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+6186 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -96525,13 +97033,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+7076 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+7091 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+7084 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+7099 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+7090 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+7105 /* "OID" */) == 0 { return 1 } return 0 @@ -96759,7 +97267,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7094 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7109 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -96850,7 +97358,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7141 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7156 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -96956,7 +97464,7 @@ func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpec defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 7172 /* "sub-select retur..." */ + var zFmt uintptr = ts + 7187 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -96974,7 +97482,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) } } @@ -97027,7 +97535,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7216 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7231 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -97063,11 +97571,11 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7239 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7254 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 7258 /* "CORRELATED " */ + return ts + 7273 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. @@ -97213,7 +97721,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7270 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+7285 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -97246,11 +97754,11 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7288 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+7303 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 7258 /* "CORRELATED " */ + return ts + 7273 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr @@ -97274,7 +97782,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6917 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -97284,7 +97792,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+7309 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+7324 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -97776,12 +98284,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+7311 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7314 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if Xsqlite3_strnicmp(tls, z, ts+7326 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+7329 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 4437 /* "-" */ + return ts + 4452 /* "-" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -97856,7 +98364,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7340 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7355 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -98415,7 +98923,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+7340, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7355, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -98667,7 +99175,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+7370 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+7385 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32)).FiMem @@ -98709,7 +99217,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+7396 /* "unknown function..." */, libc.VaList(bp+16, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7411 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -98903,7 +99411,7 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+7023, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7038, /* "%d columns assig..." */ libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; @@ -98985,7 +99493,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+5944 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5959 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -99109,7 +99617,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+7419 /* "RAISE() may only..." */, 0) + ts+7434 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -99148,7 +99656,7 @@ __3: return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7469 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7484 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -100985,11 +101493,11 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq bp := tls.Alloc(8) defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7485 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7500 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -101007,14 +101515,14 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+7513, /* "SELECT 1 FROM \"%..." */ + ts+7528, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7688, /* "SELECT 1 FROM te..." */ + ts+7703, /* "SELECT 1 FROM te..." */ libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -101030,11 +101538,11 @@ func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { Xsqlite3NestedParse(tls, pParse, - ts+7862 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+7877 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+8009 /* "UPDATE temp.sqli..." */, 0) + ts+8024 /* "UPDATE temp.sqli..." */, 0) } } @@ -101108,7 +101616,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+8160 /* "there is already..." */, libc.VaList(bp, zName)) + ts+8175 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -101121,7 +101629,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+8219 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+8234 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -101131,7 +101639,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+8225 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+8240 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -101184,24 +101692,24 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+8252 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+8267 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+8436, /* "UPDATE %Q.sqlite..." */ + ts+8451, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+8741 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+8756 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+8757, /* "UPDATE \"%w\".sqli..." */ + ts+8772, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -101214,7 +101722,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+8815 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+8830 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -101232,7 +101740,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9080 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9095 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -101247,7 +101755,7 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+9093, /* "SELECT raise(ABO..." */ + ts+9108, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -101295,12 +101803,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9131 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9146 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+9163 /* "Cannot add a UNI..." */, 0) + ts+9178 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -101313,11 +101821,11 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+9190 /* "Cannot add a REF..." */) + ts+9205 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+9249 /* "Cannot add a NOT..." */) + ts+9264 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() @@ -101333,12 +101841,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+9302 /* "Cannot add a col..." */) + ts+9317 /* "Cannot add a col..." */) } Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+9348 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+9363 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -101354,7 +101862,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+9375, /* "UPDATE \"%w\".sqli..." */ + ts+9390, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -101425,7 +101933,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+9521 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9536 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -101434,7 +101942,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+9555 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9570 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -101469,7 +101977,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Column{})) * uint64(nAlloc)))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9585 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9600 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -101516,18 +102024,18 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 9604 /* "view" */ + zType = ts + 9619 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 9609 /* "virtual table" */ + zType = ts + 9624 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9623, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9638, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 9641 /* "drop column from" */ + return ts + 9656 /* "drop column from" */ } - return ts + 9658 /* "rename columns o..." */ + return ts + 9673 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -101620,13 +102128,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+5779 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+5794 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+741 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+756 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -101644,19 +102152,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+9676, /* "UPDATE \"%w\".sqli..." */ + ts+9691, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+9894, /* "UPDATE temp.sqli..." */ + ts+9909, /* "UPDATE temp.sqli..." */ libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+9080 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+9095 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -101951,12 +102459,12 @@ func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType ui var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+10025, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+10040, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 10048 /* " " */ + return ts + 10063 /* " " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -102065,7 +102573,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+10050 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+10065 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -102115,12 +102623,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.X__builtin___memcpy_chk(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn), libc.X__builtin_object_size(tls, zBuf1, 0)) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+10056 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+10071 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 10048 /* " " */ + return ts + 10063 /* " " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -102624,7 +103132,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+741 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) + renameColumnParseError(tls, context, ts+756 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -102804,7 +103312,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+741 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) + renameColumnParseError(tls, context, ts+756 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -103086,7 +103594,7 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+10061 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+10076 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) @@ -103174,7 +103682,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+5779 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5794 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -103184,12 +103692,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+10068, /* "cannot drop %s c..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10083, /* "cannot drop %s c..." */ libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 10096 /* "PRIMARY KEY" */ + return ts + 10111 /* "PRIMARY KEY" */ } - return ts + 5600 /* "UNIQUE" */ + return ts + 5615 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -103200,7 +103708,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+10108 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+10123 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -103209,15 +103717,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+741 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+756 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+10156 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+10171 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+10277 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+10292 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -103328,11 +103836,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10295 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10316 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10336 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10355 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10374 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10310 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10331 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10351 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10370 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 10389 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -103529,7 +104037,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+10397 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + ts+10412 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } @@ -103541,10 +104049,10 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10420, /* "DELETE FROM %Q.%..." */ + ts+10435, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+10450 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+10465 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) @@ -103565,9 +104073,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 10468 /* "sqlite_stat1" */, FzCols: ts + 10481 /* "tbl,idx,stat" */}, - {FzName: ts + 10494 /* "sqlite_stat4" */, FzCols: ts + 10507 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 10535 /* "sqlite_stat3" */}, + {FzName: ts + 10483 /* "sqlite_stat1" */, FzCols: ts + 10496 /* "tbl,idx,stat" */}, + {FzName: ts + 10509 /* "sqlite_stat4" */, FzCols: ts + 10522 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10550 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -103798,7 +104306,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10548 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 10563 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -104116,7 +104624,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10558 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 10573 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -104173,7 +104681,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+10568, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+10583, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -104184,7 +104692,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+10573 /* " %llu" */, libc.VaList(bp+8, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+10588 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -104233,7 +104741,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+10579 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+10594 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -104250,7 +104758,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10585 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 10600 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -104297,7 +104805,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+10594 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+10609 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -104315,7 +104823,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*120) - libc.X__builtin___memcpy_chk(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10468 /* "sqlite_stat1" */, uint64(13), libc.X__builtin_object_size(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, 0)) + libc.X__builtin___memcpy_chk(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10483 /* "sqlite_stat1" */, uint64(13), libc.X__builtin_object_size(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, 0)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -104548,7 +105056,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10604 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10619 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -104610,7 +105118,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10604 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10619 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -104663,9 +105171,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10608 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10623 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10612 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10627 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -104760,7 +105268,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 741 /* "" */ + z = ts + 756 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -104782,15 +105290,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+10616 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+10631 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+10627 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10642 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+10637 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10652 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -105109,10 +105617,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+10494 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+10509 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+10649, /* "SELECT idx,count..." */ - ts+10703, /* "SELECT idx,neq,n..." */ + ts+10664, /* "SELECT idx,count..." */ + ts+10718, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -105163,9 +105671,9 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit // Load new statistics out of the sqlite_stat1 table (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+10468 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + if Xsqlite3FindTable(tls, db, ts+10483 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+10755 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + ts+10770 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { @@ -105257,7 +105765,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5854 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5869 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -105308,13 +105816,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 741 /* "" */ + zFile = ts + 756 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 741 /* "" */ + zName = ts + 756 /* "" */ __2: ; @@ -105324,7 +105832,7 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+3358 /* "memdb" */) + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+3373 /* "memdb" */) if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) == uintptr(0)) { goto __5 } @@ -105340,7 +105848,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10796 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10811 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -105353,7 +105861,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10799, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10814, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -105367,7 +105875,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10836 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10851 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -105438,7 +105946,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10866 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10881 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -105455,7 +105963,7 @@ __21: goto __23 } *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+10895 /* "attached databas..." */, 0) + ts+10910 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -105525,13 +106033,13 @@ __29: } Xsqlite3OomFault(tls, db) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5577 /* "out of memory" */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5592 /* "out of memory" */, 0) goto __31 __30: if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10963 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10978 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -105587,7 +106095,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 741 /* "" */ + zName = ts + 756 /* "" */ __1: ; i = 0 @@ -105619,14 +106127,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10991 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11006 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11012 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11027 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -105634,7 +106142,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11038 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11053 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -105757,7 +106265,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11060 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 11075 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -105770,7 +106278,7 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11074 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 11089 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ @@ -105785,7 +106293,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+11088 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+11103 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -105818,7 +106326,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+11112, /* "%s %T cannot ref..." */ + ts+11127, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -106017,7 +106525,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+11158 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11173 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -106041,11 +106549,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+11181 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+11196 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+11187 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+11202 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+11193 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11208 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -106097,7 +106605,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName } else { - zCol = ts + 7084 /* "ROWID" */ + zCol = ts + 7099 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -106129,7 +106637,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+11220 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11235 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -106439,25 +106947,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+5854 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+5869 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7477 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7492 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11235 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11254 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+5352 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11250 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11269 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+5367 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+11268 /* "sqlite_temp_mast..." */) + ts+11283 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11254 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11269 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), - ts+5352 /* "sqlite_master" */) + ts+5367 /* "sqlite_master" */) } } } @@ -106480,12 +106988,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7477 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11254 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+5352 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11235 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7492 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11269 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+5367 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+11250 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+11268 /* "sqlite_temp_mast..." */) + ts+11283 /* "sqlite_temp_mast..." */) } } } @@ -106521,7 +107029,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+11287 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+11302 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -106539,14 +107047,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 11295 /* "no such view" */ + zMsg = ts + 11310 /* "no such view" */ } else { - zMsg = ts + 11308 /* "no such table" */ + zMsg = ts + 11323 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6047 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6062 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+6057 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6072 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -106859,7 +107367,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+5352 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+5367 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -106886,7 +107394,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5854 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5869 /* "main" */, zName)) { goto __3 } @@ -106939,13 +107447,13 @@ func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11322 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11337 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11339 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+11354 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -106986,13 +107494,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*8))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*8))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+741 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+756 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7477 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7492 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11359, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11374, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -107161,9 +107669,9 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 @@ -107181,7 +107689,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+11401 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11416 /* "temporary table ..." */, 0) return __4: ; @@ -107209,9 +107717,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 9604 /* "view" */ + return ts + 9619 /* "view" */ } - return ts + 8219 /* "table" */ + return ts + 8234 /* "table" */ }(), zName) != 0) { goto __8 } @@ -107228,9 +107736,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -107268,7 +107776,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+11442 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+11457 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -107282,7 +107790,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+11466 /* "there is already..." */, libc.VaList(bp+8, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11481 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -107398,7 +107906,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+11501 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+11516 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -107422,7 +107930,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11518 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11533 /* "cannot use RETUR..." */, 0) } else { } @@ -107443,7 +107951,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11501 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11516 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -107455,7 +107963,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+11501 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+11516 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == (pRet + 16 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -107483,7 +107991,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11552 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11567 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -107499,7 +108007,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11575 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11590 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -107673,11 +108181,11 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11601, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11616, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11646 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11661 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. @@ -107727,7 +108235,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11687 /* "generated column..." */, 0) + ts+11702 /* "generated column..." */, 0) } } @@ -107772,7 +108280,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+11739 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11754 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -107832,7 +108340,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+741 /* "" */), ts+11780 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+756 /* "" */), ts+11795 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -107860,7 +108368,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+11788 /* "AUTOINCREMENT is..." */, 0) + ts+11803 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -107964,7 +108472,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+11844 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11859 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -107977,13 +108485,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11887 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11902 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11895 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11910 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -108016,7 +108524,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+11902, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11917, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -108158,13 +108666,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 741 /* "" */ - zSep2 = ts + 11933 /* "," */ - zEnd = ts + 4462 /* ")" */ + zSep = ts + 756 /* "" */ + zSep2 = ts + 11948 /* "," */ + zEnd = ts + 4477 /* ")" */ } else { - zSep = ts + 11935 /* "\n " */ - zSep2 = ts + 11939 /* ",\n " */ - zEnd = ts + 11944 /* "\n)" */ + zSep = ts + 11950 /* "\n " */ + zSep2 = ts + 11954 /* ",\n " */ + zEnd = ts + 11959 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -108172,7 +108680,7 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+11947 /* "CREATE TABLE " */, 0) + Xsqlite3_snprintf(tls, n, zStmt, ts+11962 /* "CREATE TABLE " */, 0) *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') @@ -108206,16 +108714,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2778 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2793 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 741, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 11961, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 11967, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 11972, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 11977, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 756, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11976, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11982, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11987, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11992, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -108652,7 +109160,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+741 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+756 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -108665,11 +109173,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11983 /* "AUTOINCREMENT no..." */, 0) + ts+11998 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+12033 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12048 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -108713,7 +109221,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12065 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12080 /* "must have at lea..." */, 0) return } } @@ -108746,12 +109254,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 8219 /* "table" */ - zType2 = ts + 12109 /* "TABLE" */ + zType = ts + 8234 /* "table" */ + zType2 = ts + 12124 /* "TABLE" */ } else { // A view - zType = ts + 9604 /* "view" */ - zType2 = ts + 12115 /* "VIEW" */ + zType = ts + 9619 /* "view" */ + zType2 = ts + 12130 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -108832,7 +109340,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+12120 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+12135 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -108840,7 +109348,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+12135, /* "UPDATE %Q.sqlite..." */ + ts+12150, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, @@ -108858,14 +109366,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+12233, /* "CREATE TABLE %Q...." */ + ts+12248, /* "CREATE TABLE %Q...." */ libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+12275 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+12290 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -108886,7 +109394,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8741 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8756 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -108923,7 +109431,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+12309 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12324 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -108945,7 +109453,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9604 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9619 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+8 /* &sFix */, pSelect) != 0) { goto __3 } @@ -109062,7 +109570,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12345 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12360 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -109204,7 +109712,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+12375 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12390 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -109218,7 +109726,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+12390, /* "UPDATE %Q.sqlite..." */ + ts+12405, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -109282,10 +109790,10 @@ func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uint for i = 1; i <= 4; i++ { // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12457 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12472 /* "sqlite_stat%d" */, libc.VaList(bp, i)) if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10420, /* "DELETE FROM %Q.%..." */ + ts+10435, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } @@ -109325,7 +109833,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+12471, /* "DELETE FROM %Q.s..." */ + ts+12486, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -109337,7 +109845,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+12516, /* "DELETE FROM %Q.s..." */ + ts+12531, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) @@ -109367,11 +109875,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2399 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2414 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6546 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6561 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -109452,9 +109960,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zArg2 = uintptr(0) @@ -109514,7 +110022,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+12583 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12598 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -109524,14 +110032,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+12611 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12626 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+12645 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12660 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -109546,7 +110054,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+10612 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10627 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -109611,7 +110119,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+12677, /* "foreign key on %..." */ + ts+12692, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*32)).FzName, pTo)) goto fk_end __5: @@ -109624,7 +110132,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+12740 /* "number of column..." */, 0) + ts+12755 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -109708,7 +110216,7 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+12834, /* "unknown column \"..." */ + ts+12849, /* "unknown column \"..." */ libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) goto fk_end __23: @@ -109958,12 +110466,12 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+12880, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12895, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 12908 /* "FIRST" */ + return ts + 12923 /* "FIRST" */ } - return ts + 12914 /* "LAST" */ + return ts + 12929 /* "LAST" */ }())) return 1 } @@ -110121,7 +110629,7 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12919 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12934 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+136 /* &sFix */, pTblName) != 0) { goto __10 } @@ -110142,7 +110650,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+12925, /* "cannot create a ..." */ + ts+12940, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -110169,26 +110677,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12975 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12990 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+13003 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13018 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+13028 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13043 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -110215,7 +110723,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12919 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12934 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -110230,7 +110738,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+13062 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13077 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -110242,7 +110750,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+13096 /* "index %s already..." */, libc.VaList(bp+24, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13111 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -110271,7 +110779,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+13120 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+13135 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -110300,9 +110808,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -110346,7 +110854,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12919 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12934 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -110463,7 +110971,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+13143 /* "expressions proh..." */, 0) + ts+13158 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -110692,7 +111200,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+13204 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) + ts+13219 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -110748,7 +111256,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+13246 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13261 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -110806,12 +111314,12 @@ __104: __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+13263, /* "CREATE%s INDEX %..." */ + zStmt = Xsqlite3MPrintf(tls, db, ts+13278, /* "CREATE%s INDEX %..." */ libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 13283 /* " UNIQUE" */ + return ts + 13298 /* " UNIQUE" */ }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: @@ -110823,7 +111331,7 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+13291, /* "INSERT INTO %Q.s..." */ + ts+13306, /* "INSERT INTO %Q.s..." */ libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -110839,7 +111347,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+13350 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+13365 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -111023,7 +111531,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+13377 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+13392 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -111038,7 +111546,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+13395 /* "index associated..." */, libc.VaList(bp+8, 0)) + ts+13410 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -111049,9 +111557,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -111079,9 +111587,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+13468, /* "DELETE FROM %Q.s..." */ + ts+13483, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+10608 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10623 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -111232,7 +111740,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+13528, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13543, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -111444,12 +111952,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13564, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13579, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 13600 /* "ON" */ + return ts + 13615 /* "ON" */ } - return ts + 13603 /* "USING" */ + return ts + 13618 /* "USING" */ }())) goto append_from_error __1: @@ -111577,7 +112085,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13609 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13624 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -111613,9 +112121,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 13615 /* "ROLLBACK" */ + return ts + 13630 /* "ROLLBACK" */ } - return ts + 13624 /* "COMMIT" */ + return ts + 13639 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -111640,7 +112148,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 13609 /* "BEGIN" */, ts + 13631 /* "RELEASE" */, ts + 13615 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 13624 /* "BEGIN" */, ts + 13646 /* "RELEASE" */, ts + 13630 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -111656,7 +112164,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+13639 /* "unable to open a..." */, 0) + ts+13654 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -111799,17 +112307,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13709 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13724 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*32)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13720 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13735 /* ", " */, 2) } Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+754 /* "." */, 1) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+769 /* "." */, 1) Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } @@ -111832,11 +112340,11 @@ func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+11181 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+11196 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13723 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13738 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -111979,7 +112487,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+13732 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13747 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -112089,7 +112597,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13778 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13793 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -112323,7 +112831,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13808 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13823 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -112689,11 +113197,11 @@ func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int3 defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13839 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13854 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13868 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13883 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -113286,7 +113794,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13906 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13921 /* "rows deleted" */, uintptr(0)) __61: ; @@ -113431,7 +113939,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10468 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10483 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -113709,7 +114217,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 5664 /* "integer" */, ts + 5659 /* "real" */, ts + 13919 /* "text" */, ts + 13924 /* "blob" */, ts + 5654 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 5679 /* "integer" */, ts + 5674 /* "real" */, ts + 13934 /* "text" */, ts + 13939 /* "blob" */, ts + 5669 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -113773,7 +114281,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+13929 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13944 /* "integer overflow" */, -1) return } iVal = -iVal @@ -114111,7 +114619,7 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+13946 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+13961 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -114561,7 +115069,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+13951 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+13966 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -114573,7 +115081,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+13984 /* "ESCAPE expressio..." */, -1) + ts+13999 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -114639,7 +115147,7 @@ func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) } // Implementation of the sqlite_compileoption_used() function. @@ -114696,10 +115204,10 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4430 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4445 /* "%!.15g" */, libc.VaList(bp, r1)) Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+14029 /* "%!.20e" */, libc.VaList(bp+8, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+14044 /* "%!.20e" */, libc.VaList(bp+8, r1)) } Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break @@ -114773,7 +115281,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+742 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+757 /* "NULL" */, 4, uintptr(0)) break } @@ -115084,7 +115592,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 10048 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 10063 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -115105,7 +115613,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 741 /* "" */ + zIn = ts + 756 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -115131,7 +115639,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+14036 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+14051 /* "?000" */, 4, uintptr(0)) } } @@ -115159,7 +115667,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+11220 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+11235 /* "not authorized" */, -1) return } @@ -115247,7 +115755,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+13929 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13944 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -115401,7 +115909,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) } else { - zSep = ts + 11933 /* "," */ + zSep = ts + 11948 /* "," */ nSep = 1 } if zSep != 0 { @@ -115479,7 +115987,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+14041 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+14056 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -115499,14 +116007,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+14047 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+14062 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+14047 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+14062 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14047 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14047 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14062 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+14062 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -115611,76 +116119,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 14052 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 14072 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 14085 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 14067 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 14087 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 14100 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14103 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14111 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14111 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14126 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14152 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14177 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14186 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14197 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14204 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14218 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14218 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14224 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14224 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14230 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14230 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14235 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14235 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14235 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14239 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 14239 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14239 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14243 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 14250 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14257 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14263 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14270 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14278 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14283 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14287 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14287 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14293 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14299 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14305 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14309 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14316 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14323 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14334 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14341 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14356 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14373 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14384 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14390 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14408 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14416 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14430 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14438 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14447 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14447 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14454 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14454 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14464 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14468 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14474 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14478 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14478 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14484 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14484 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14118 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14126 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 14126 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14141 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14167 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14192 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14201 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 14212 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14219 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14233 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14233 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14239 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 14239 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14245 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 14245 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14250 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14250 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14250 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 14254 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 14254 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 14254 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 14258 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 14265 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14272 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14278 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14285 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14293 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14298 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14302 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14302 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14308 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14314 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14320 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14324 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14331 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14338 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14349 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14356 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 14371 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14388 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14399 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14405 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14423 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14431 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14445 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14453 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14462 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14462 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14469 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14469 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14479 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14483 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14489 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14493 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14493 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14499 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14499 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14497 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14047 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14047 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14502 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14502 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14511 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14502 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14516 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14512 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14062 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14062 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14517 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14517 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14526 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14517 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14531 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -115966,7 +116474,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+14520, /* "foreign key mism..." */ + ts+14535, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -116862,8 +117370,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5863 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5859 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5878 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5874 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+32, 16 // Name of column in child table // var tToCol Token at bp+16, 16 @@ -116951,7 +117459,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4646 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4661 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -117381,7 +117889,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7340 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7355 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -117945,7 +118453,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+14565, /* "cannot INSERT in..." */ + ts+14580, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto insert_cleanup __24: @@ -117970,7 +118478,7 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+14606, /* "table %S has no ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14621, /* "table %S has no ..." */ libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup @@ -118140,7 +118648,7 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+14638, /* "table %S has %d ..." */ + ts+14653, /* "table %S has %d ..." */ libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: @@ -118150,7 +118658,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+14690 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+14705 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -118206,7 +118714,7 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+14715, /* "UPSERT not imple..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14730, /* "UPSERT not imple..." */ libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: @@ -118214,7 +118722,7 @@ __56: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+14761 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14776 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -118694,7 +119202,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14782 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14797 /* "rows inserted" */, uintptr(0)) __123: ; @@ -119038,7 +119546,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+11181 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+11196 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -119249,7 +119757,6 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt goto __4 goto __6 __6: - } } @@ -120442,7 +120949,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 741 /* "" */ + zSql = ts + 756 /* "" */ __2: ; @@ -121003,7 +121510,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+11220 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+11235 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -121013,7 +121520,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 14796 /* "sqlite3_extensio..." */ + zEntry = ts + 14811 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -121033,7 +121540,7 @@ __5: if !((ii < (int32(uint64(unsafe.Sizeof(azEndings)) / uint64(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+11181 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+11196 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -121079,7 +121586,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.X__builtin___memcpy_chk(tls, zAltEntry, ts+14819 /* "sqlite3_" */, uint64(8), libc.X__builtin_object_size(tls, zAltEntry, 0)) + libc.X__builtin___memcpy_chk(tls, zAltEntry, ts+14834 /* "sqlite3_" */, uint64(8), libc.X__builtin_object_size(tls, zAltEntry, 0)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { @@ -121093,7 +121600,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14828 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14843 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -121117,7 +121624,7 @@ __17: goto __18 __18: ; - libc.X__builtin___memcpy_chk(tls, (zAltEntry + uintptr(iEntry)), ts+14832 /* "_init" */, uint64(6), libc.X__builtin_object_size(tls, (zAltEntry+uintptr(iEntry)), 0)) + libc.X__builtin___memcpy_chk(tls, (zAltEntry + uintptr(iEntry)), ts+14847 /* "_init" */, uint64(6), libc.X__builtin_object_size(tls, (zAltEntry+uintptr(iEntry)), 0)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -121135,7 +121642,7 @@ __10: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14838 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + ts+14853 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; @@ -121160,7 +121667,7 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14881 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14896 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) @@ -121200,7 +121707,7 @@ extension_not_found: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14913 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + ts+14928 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; @@ -121210,7 +121717,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 14950, /* "dylib" */ + ts + 14965, /* "dylib" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -121377,7 +121884,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+14956 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + ts+14971 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) @@ -121422,61 +121929,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 4567, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 14995, /* "seq" */ - /* 2 */ ts + 8219, /* "table" */ - /* 3 */ ts + 14999, /* "from" */ - /* 4 */ ts + 15004, /* "to" */ - /* 5 */ ts + 15007, /* "on_update" */ - /* 6 */ ts + 15017, /* "on_delete" */ - /* 7 */ ts + 15027, /* "match" */ - /* 8 */ ts + 15033, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 15037, /* "name" */ - /* 10 */ ts + 15042, /* "type" */ - /* 11 */ ts + 15047, /* "notnull" */ - /* 12 */ ts + 15055, /* "dflt_value" */ - /* 13 */ ts + 15066, /* "pk" */ - /* 14 */ ts + 15069, /* "hidden" */ + /* 0 */ ts + 4582, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 15010, /* "seq" */ + /* 2 */ ts + 8234, /* "table" */ + /* 3 */ ts + 15014, /* "from" */ + /* 4 */ ts + 15019, /* "to" */ + /* 5 */ ts + 15022, /* "on_update" */ + /* 6 */ ts + 15032, /* "on_delete" */ + /* 7 */ ts + 15042, /* "match" */ + /* 8 */ ts + 15048, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 15052, /* "name" */ + /* 10 */ ts + 15057, /* "type" */ + /* 11 */ ts + 15062, /* "notnull" */ + /* 12 */ ts + 15070, /* "dflt_value" */ + /* 13 */ ts + 15081, /* "pk" */ + /* 14 */ ts + 15084, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 15076, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 15033, /* "cid" */ - /* 17 */ ts + 15037, /* "name" */ - /* 18 */ ts + 15082, /* "desc" */ - /* 19 */ ts + 15087, /* "coll" */ - /* 20 */ ts + 15092, /* "key" */ - /* 21 */ ts + 15037, /* "name" */ // Used by: function_list - /* 22 */ ts + 15096, /* "builtin" */ - /* 23 */ ts + 15042, /* "type" */ - /* 24 */ ts + 15104, /* "enc" */ - /* 25 */ ts + 15108, /* "narg" */ - /* 26 */ ts + 15113, /* "flags" */ - /* 27 */ ts + 10612, /* "tbl" */ // Used by: stats - /* 28 */ ts + 10608, /* "idx" */ - /* 29 */ ts + 15119, /* "wdth" */ - /* 30 */ ts + 15124, /* "hght" */ - /* 31 */ ts + 15129, /* "flgs" */ - /* 32 */ ts + 14995, /* "seq" */ // Used by: index_list - /* 33 */ ts + 15037, /* "name" */ - /* 34 */ ts + 15134, /* "unique" */ - /* 35 */ ts + 15141, /* "origin" */ - /* 36 */ ts + 15148, /* "partial" */ - /* 37 */ ts + 8219, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 15156, /* "rowid" */ - /* 39 */ ts + 4570, /* "parent" */ - /* 40 */ ts + 15162, /* "fkid" */ + /* 15 */ ts + 15091, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 15048, /* "cid" */ + /* 17 */ ts + 15052, /* "name" */ + /* 18 */ ts + 15097, /* "desc" */ + /* 19 */ ts + 15102, /* "coll" */ + /* 20 */ ts + 15107, /* "key" */ + /* 21 */ ts + 15052, /* "name" */ // Used by: function_list + /* 22 */ ts + 15111, /* "builtin" */ + /* 23 */ ts + 15057, /* "type" */ + /* 24 */ ts + 15119, /* "enc" */ + /* 25 */ ts + 15123, /* "narg" */ + /* 26 */ ts + 15128, /* "flags" */ + /* 27 */ ts + 10627, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10623, /* "idx" */ + /* 29 */ ts + 15134, /* "wdth" */ + /* 30 */ ts + 15139, /* "hght" */ + /* 31 */ ts + 15144, /* "flgs" */ + /* 32 */ ts + 15010, /* "seq" */ // Used by: index_list + /* 33 */ ts + 15052, /* "name" */ + /* 34 */ ts + 15149, /* "unique" */ + /* 35 */ ts + 15156, /* "origin" */ + /* 36 */ ts + 15163, /* "partial" */ + /* 37 */ ts + 8234, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 15171, /* "rowid" */ + /* 39 */ ts + 4585, /* "parent" */ + /* 40 */ ts + 15177, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 14995, /* "seq" */ // Used by: database_list - /* 42 */ ts + 15037, /* "name" */ - /* 43 */ ts + 15167, /* "file" */ - /* 44 */ ts + 15172, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 15177, /* "log" */ - /* 46 */ ts + 15181, /* "checkpointed" */ + /* 41 */ ts + 15010, /* "seq" */ // Used by: database_list + /* 42 */ ts + 15052, /* "name" */ + /* 43 */ ts + 15182, /* "file" */ + /* 44 */ ts + 15187, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 15192, /* "log" */ + /* 46 */ ts + 15196, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 15194, /* "database" */ // Used by: lock_status - /* 48 */ ts + 15203, /* "status" */ - /* 49 */ ts + 15210, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 15209, /* "database" */ // Used by: lock_status + /* 48 */ ts + 15218, /* "status" */ + /* 49 */ ts + 15225, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 15221, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 15236, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -121493,237 +122000,237 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [66]PragmaName{ - { /* zName: */ FzName: ts + 15229, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 15244, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15244, /* "application_id" */ + { /* zName: */ FzName: ts + 15259, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 15259, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 15274, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15271, /* "automatic_index" */ + { /* zName: */ FzName: ts + 15286, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 15287, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 15302, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15210, /* "cache_size" */ + { /* zName: */ FzName: ts + 15225, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15300, /* "cache_spill" */ + { /* zName: */ FzName: ts + 15315, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15312, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 15327, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 15332, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 15347, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 15348, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 15363, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 15369, /* "collation_list" */ + { /* zName: */ FzName: ts + 15384, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 15384, /* "compile_options" */ + { /* zName: */ FzName: ts + 15399, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15400, /* "count_changes" */ + { /* zName: */ FzName: ts + 15415, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 15414, /* "data_version" */ + { /* zName: */ FzName: ts + 15429, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 15427, /* "database_list" */ + { /* zName: */ FzName: ts + 15442, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15441, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 15456, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15460, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 15475, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 15479, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 15494, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 15502, /* "encoding" */ + { /* zName: */ FzName: ts + 15517, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15511, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 15526, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 15529, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 15544, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 15546, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 15561, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 15559, /* "freelist_count" */ + { /* zName: */ FzName: ts + 15574, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 15574, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 15589, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 15592, /* "fullfsync" */ + { /* zName: */ FzName: ts + 15607, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 15602, /* "function_list" */ + { /* zName: */ FzName: ts + 15617, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15616, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 15631, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15632, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 15647, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 15657, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 15672, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 15676, /* "index_info" */ + { /* zName: */ FzName: ts + 15691, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15687, /* "index_list" */ + { /* zName: */ FzName: ts + 15702, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 15698, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 15713, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15710, /* "integrity_check" */ + { /* zName: */ FzName: ts + 15725, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15726, /* "journal_mode" */ + { /* zName: */ FzName: ts + 15741, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15739, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 15754, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15758, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 15773, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 15777, /* "lock_proxy_file" */ + { /* zName: */ FzName: ts + 15792, /* "lock_proxy_file" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCK_PROXY_FILE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 15793, /* "locking_mode" */ + { /* zName: */ FzName: ts + 15808, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15806, /* "max_page_count" */ + { /* zName: */ FzName: ts + 15821, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15821, /* "mmap_size" */ + { /* zName: */ FzName: ts + 15836, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 15831, /* "module_list" */ + { /* zName: */ FzName: ts + 15846, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15843, /* "optimize" */ + { /* zName: */ FzName: ts + 15858, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 15852, /* "page_count" */ + { /* zName: */ FzName: ts + 15867, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15863, /* "page_size" */ + { /* zName: */ FzName: ts + 15878, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15873, /* "pragma_list" */ + { /* zName: */ FzName: ts + 15888, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15885, /* "query_only" */ + { /* zName: */ FzName: ts + 15900, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 15896, /* "quick_check" */ + { /* zName: */ FzName: ts + 15911, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15908, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 15923, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 15925, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 15940, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 15944, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 15959, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 15970, /* "schema_version" */ + { /* zName: */ FzName: ts + 15985, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 15985, /* "secure_delete" */ + { /* zName: */ FzName: ts + 16000, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15999, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 16014, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 16018, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 16033, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 16032, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 16047, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16048, /* "synchronous" */ + { /* zName: */ FzName: ts + 16063, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16060, /* "table_info" */ + { /* zName: */ FzName: ts + 16075, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 16071, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 16086, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 16083, /* "temp_store" */ + { /* zName: */ FzName: ts + 16098, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16094, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 16109, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 16115, /* "threads" */ + { /* zName: */ FzName: ts + 16130, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16123, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 16138, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 16138, /* "user_version" */ + { /* zName: */ FzName: ts + 16153, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 16151, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 16166, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 16170, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 16185, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 16185, /* "writable_schema" */ + { /* zName: */ FzName: ts + 16200, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -121760,7 +122267,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 16201 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 16216 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -121777,10 +122284,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+16226 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16241 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+16236 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16251 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -121793,13 +122300,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+16243 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16258 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+16248 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16263 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+16253 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+16268 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -121817,9 +122324,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+15167 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+15182 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+16265 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+16280 /* "memory" */) == 0 { return 2 } else { return 0 @@ -121835,7 +122342,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+16272 /* "temporary storag..." */, 0) + ts+16287 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) @@ -121935,19 +122442,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 16334 /* "SET NULL" */ + zName = ts + 16349 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 16343 /* "SET DEFAULT" */ + zName = ts + 16358 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 16355 /* "CASCADE" */ + zName = ts + 16370 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 16363 /* "RESTRICT" */ + zName = ts + 16378 /* "RESTRICT" */ break default: - zName = ts + 16372 /* "NO ACTION" */ + zName = ts + 16387 /* "NO ACTION" */ break } return zName @@ -121965,7 +122472,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 16382 /* "delete" */, ts + 16389 /* "persist" */, ts + 16397 /* "off" */, ts + 16401 /* "truncate" */, ts + 16265 /* "memory" */, ts + 16410, /* "wal" */ + ts + 16397 /* "delete" */, ts + 16404 /* "persist" */, ts + 16412 /* "off" */, ts + 16416 /* "truncate" */, ts + 16280 /* "memory" */, ts + 16425, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -122011,13 +122518,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 16414 /* "w" */ + zType = ts + 16429 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 16416 /* "a" */ + zType = ts + 16431 /* "a" */ } else { - zType = ts + 16418 /* "s" */ + zType = ts + 16433 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16420, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16435, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -122026,7 +122533,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 16427 /* "utf8" */, ts + 16432 /* "utf16le" */, ts + 16440 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16442 /* "utf8" */, ts + 16447 /* "utf16le" */, ts + 16455 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -122295,7 +122802,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+16448 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+16463 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -122350,7 +122857,7 @@ __8: if !(*(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) __10: ; @@ -122931,7 +123438,7 @@ __18: if !(zRight != 0) { goto __63 } - if !(Xsqlite3_stricmp(tls, zRight, ts+16452 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+16467 /* "fast" */) == 0) { goto __64 } b = 2 @@ -123020,7 +123527,7 @@ __71: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 16236 /* "normal" */ + zRet = ts + 16251 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -123061,7 +123568,7 @@ __78: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __83 } - zRet = ts + 16226 /* "exclusive" */ + zRet = ts + 16241 /* "exclusive" */ __83: ; returnSingleText(tls, v, zRet) @@ -123426,7 +123933,7 @@ __123: if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 432 /* res */)) == 0)) { goto __126 } - Xsqlite3ErrorMsg(tls, pParse, ts+16457 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16472 /* "not a writable d..." */, 0) goto pragma_out __126: ; @@ -123444,7 +123951,7 @@ __127: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __128 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+16, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+16, zRight)) goto __129 __128: Xsqlite3_temp_directory = uintptr(0) @@ -123488,7 +123995,7 @@ __133: if !(res1 != SQLITE_OK) { goto __134 } - Xsqlite3ErrorMsg(tls, pParse, ts+16482 /* "failed to set lo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16497 /* "failed to set lo..." */, 0) goto pragma_out __134: ; @@ -123514,7 +124021,7 @@ __135: goto __137 } Xsqlite3ErrorMsg(tls, pParse, - ts+16512 /* "Safety level may..." */, 0) + ts+16527 /* "Safety level may..." */, 0) goto __138 __137: if !(iDb != 1) { @@ -123673,13 +124180,13 @@ __159: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 16565 /* "issisii" */ + return ts + 16580 /* "issisii" */ } - return ts + 16573 /* "issisi" */ + return ts + 16588 /* "issisi" */ }(), libc.VaList(bp+24, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+741 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+756 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -123754,7 +124261,7 @@ __171: goto __173 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16580 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16595 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -123764,7 +124271,7 @@ __171: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __174 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16585, /* "isiX" */ + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16600, /* "isiX" */ libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) @@ -123801,8 +124308,8 @@ __177: if !(pIdx1 != 0) { goto __179 } - *(*[3]uintptr)(unsafe.Pointer(bp + 448 /* azOrigin */)) = [3]uintptr{ts + 16590 /* "c" */, ts + 16592 /* "u" */, ts + 15066 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16594, /* "isisi" */ + *(*[3]uintptr)(unsafe.Pointer(bp + 448 /* azOrigin */)) = [3]uintptr{ts + 16605 /* "c" */, ts + 16607 /* "u" */, ts + 15081 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16609, /* "isisi" */ libc.VaList(bp+128, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), @@ -123836,7 +124343,7 @@ __180: __183: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16600, /* "iss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16615, /* "iss" */ libc.VaList(bp+168, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt))) @@ -123859,7 +124366,7 @@ __184: goto __186 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16604 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16619 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __185 __185: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -123923,7 +124430,7 @@ __196: goto __198 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16418 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16433 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __197 __197: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -123940,7 +124447,7 @@ __199: if !(i6 < (int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{}))))) { goto __201 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16418 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16433 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) goto __200 __200: i6++ @@ -123976,7 +124483,7 @@ __207: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __209 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16607, /* "iissssss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16622, /* "iissssss" */ libc.VaList(bp+224, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, @@ -123984,7 +124491,7 @@ __207: (*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */)))), // ON DELETE - ts+16616 /* "NONE" */)) + ts+16631 /* "NONE" */)) goto __208 __208: j2++ @@ -124177,7 +124684,7 @@ __236: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __237: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16621 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16636 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 480 /* aiCols */))) @@ -124443,7 +124950,7 @@ __264: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+16625 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+16640 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -124533,7 +125040,7 @@ __283: __284: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+16649 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+16664 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -124573,7 +125080,7 @@ __289: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+16669, /* "CHECK constraint..." */ + zErr1 = Xsqlite3MPrintf(tls, db, ts+16684, /* "CHECK constraint..." */ libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) @@ -124607,9 +125114,9 @@ __294: // Verify that an index entry exists for the current table row jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16699 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16714 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+16704 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16719 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -124649,7 +125156,7 @@ __298: Xsqlite3VdbeJumpHere(tls, v, jmp6) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16725 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16740 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __295: @@ -124671,7 +125178,7 @@ __290: if !(!(isQuick != 0)) { goto __300 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+16752 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+16767 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __301: @@ -124722,7 +125229,7 @@ __246: } (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 488 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*24)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16781 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16796 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*24)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __305: @@ -124800,7 +125307,7 @@ __312: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __314 } - Xsqlite3ErrorMsg(tls, pParse, ts+16784 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+16799 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) __314: ; __309: @@ -124912,19 +125419,19 @@ __48: if !(zRight != 0) { goto __321 } - if !(Xsqlite3StrICmp(tls, zRight, ts+16248 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16263 /* "full" */) == 0) { goto __322 } eMode2 = SQLITE_CHECKPOINT_FULL goto __323 __322: - if !(Xsqlite3StrICmp(tls, zRight, ts+16809 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16824 /* "restart" */) == 0) { goto __324 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __325 __324: - if !(Xsqlite3StrICmp(tls, zRight, ts+16401 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16416 /* "truncate" */) == 0) { goto __326 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -125111,7 +125618,7 @@ __341: __343: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+16817, /* "ANALYZE \"%w\".\"%w..." */ + zSubSql = Xsqlite3MPrintf(tls, db, ts+16832, /* "ANALYZE \"%w\".\"%w..." */ libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __344 @@ -125295,14 +125802,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 16835 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 16840 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 16846 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 16855 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 16864 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 16872 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 16880 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 16887 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16850 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16855 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16861 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16870 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16879 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16887 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16895 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16902 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -125359,7 +125866,7 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argc _ = argv Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+64 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16893 /* "CREATE TABLE x" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16908 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -125367,7 +125874,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16908 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16923 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -125380,19 +125887,19 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16915 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16930 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16921 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16936 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16933 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16948 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4477 /* ")" */, 1) Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) rc = Xsqlite3_declare_vtab(tls, db, bp+64 /* &zBuf[0] */) @@ -125408,7 +125915,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -125571,7 +126078,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) == uintptr(0) { return SQLITE_NOMEM } @@ -125587,13 +126094,13 @@ __2: __3: ; Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16948 /* "PRAGMA " */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16963 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16956 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16971 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) } Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16960 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16975 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) } zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { @@ -125602,7 +126109,7 @@ __3: rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -125695,12 +126202,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+16964 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), + ts+16979 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 16992 /* "rename" */ + return ts + 17007 /* "rename" */ } - return ts + 16999 /* "drop column" */ + return ts + 17014 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -125712,11 +126219,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - zObj = ts + 4518 /* "?" */ + zObj = ts + 4533 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+17011 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+17026 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+17042 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+17057 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -125793,7 +126300,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (db+184 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+13246 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+13261 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -125830,13 +126337,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+17050 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+17065 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (pIndex+88 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+13246 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+13261 /* "invalid rootpage" */) } } } @@ -125879,16 +126386,16 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 8219 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 8234 /* "table" */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 7309 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 17063 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 7324 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 17078 /* "CREATE TABLE x(t..." */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*8)) = uintptr(0) (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FiDb = iDb @@ -126001,7 +126508,7 @@ __10: goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+10895 /* "attached databas..." */) + ts+10910 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -126041,7 +126548,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+17135 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+17150 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -126063,7 +126570,7 @@ __18: (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+17159, /* "SELECT*FROM\"%w\"...." */ + ts+17174, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth @@ -126423,7 +126930,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+17193 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+17208 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -126451,7 +126958,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+17223 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+17238 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -126514,7 +127021,7 @@ __19: if !(*(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+2778 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2793 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */))) goto __21 __20: @@ -126989,24 +127496,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 10048 /* " " */ + var zSp uintptr = ts + 10063 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+17242 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+17257 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+17286 /* "RIGHT and FULL O..." */, 0) + ts+17301 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 17341 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 17356 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -127212,7 +127719,7 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17375 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+17390 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { @@ -127236,7 +127743,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17425 /* "cannot have both..." */, 0) + ts+17440 /* "cannot have both..." */, 0) return 1 } @@ -127271,7 +127778,7 @@ __1: if (iRightCol < 0) || !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17480 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + ts+17495 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, @@ -128062,16 +128569,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 17544 /* "UNION ALL" */ + z = ts + 17559 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 17554 /* "INTERSECT" */ + z = ts + 17569 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 17564 /* "EXCEPT" */ + z = ts + 17579 /* "EXCEPT" */ break default: - z = ts + 17571 /* "UNION" */ + z = ts + 17586 /* "UNION" */ break } return z @@ -128089,7 +128596,7 @@ func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite bp := tls.Alloc(8) defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17577 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17592 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -128355,8 +128862,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 11780 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 15156 /* "rowid" */ + zType = ts + 11795 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 15171 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), uintptr(0)) @@ -128509,13 +129016,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 15156 /* "rowid" */ + zCol = ts + 15171 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+11181 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+11196 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -128523,7 +129030,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+17600 /* "column%d" */, libc.VaList(bp+16, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+17615 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -128612,7 +129119,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } else { - zName = ts + 15156 /* "rowid" */ + zName = ts + 15171 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -128625,7 +129132,7 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+17600 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+17615 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, @@ -128640,7 +129147,7 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+17609 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) + zName = Xsqlite3MPrintf(tls, db, ts+17624 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) if *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) > U32(3) { Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &cnt */) } @@ -128997,7 +129504,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+17617 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17632 /* "cannot use windo..." */, 0) return __1: ; @@ -129108,7 +129615,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+17666 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17681 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -129130,7 +129637,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17708 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17723 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -129173,7 +129680,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17714 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17729 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -129223,11 +129730,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17729 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17744 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 2668 /* "S" */ + return ts + 2683 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -129379,8 +129886,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17752 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17767 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17767 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17782 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -129429,7 +129936,7 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17544 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17559 /* "UNION ALL" */, 0) rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) @@ -129505,7 +130012,7 @@ __23: pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 64 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17786 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17801 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+64 /* &uniondest */) @@ -129577,7 +130084,7 @@ __26: pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 104 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17786 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17801 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+104 /* &intersectdest */) @@ -129738,10 +130245,10 @@ func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17807 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17822 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+17853, /* "SELECTs to the l..." */ + ts+17868, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -130121,9 +130628,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6647 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6662 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6647 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6662 /* "ORDER" */) } // Compute the limit registers @@ -130152,7 +130659,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) Xsqlite3SelectDestInit(tls, bp+48 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17935 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17950 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -130160,7 +130667,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17946 /* "LEFT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17961 /* "LEFT" */, 0) Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -130174,7 +130681,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17951 /* "RIGHT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17966 /* "RIGHT" */, 0) Xsqlite3Select(tls, pParse, p, bp+48 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -130371,7 +130878,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 304 /* "BINARY" */ + return ts + 319 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -131584,12 +132091,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+14235 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+14250 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+14239 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+14254 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -131658,7 +132165,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+17957 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+17972 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -131769,7 +132276,7 @@ func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* s defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17975 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17990 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -131957,7 +132464,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+17998 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+18013 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -131973,7 +132480,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18041 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18056 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { @@ -131999,7 +132506,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+18064, /* "table %s has %d ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18079, /* "table %s has %d ..." */ libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 @@ -132010,9 +132517,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18102 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18117 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18136 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18151 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -132060,7 +132567,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+18174 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+18189 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -132187,7 +132694,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+18186, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18201, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -132206,7 +132713,7 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+18225, /* "access to view \"..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18240, /* "access to view \"..." */ libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -132214,7 +132721,7 @@ __1: ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+18256, /* "unsafe use of vi..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18271, /* "unsafe use of vi..." */ libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) @@ -132329,7 +132836,7 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName } else { - zSchemaName = ts + 18289 /* "*" */ + zSchemaName = ts + 18304 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { @@ -132378,7 +132885,7 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+11181 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+11196 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { @@ -132394,7 +132901,7 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+18291, /* "%s.%s.%s" */ + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+18306, /* "%s.%s.%s" */ libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } @@ -132414,9 +132921,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+18300 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18315 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+18318 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18333 /* "no tables specif..." */, 0) } } } @@ -132426,7 +132933,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+18338 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18353 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -132614,13 +133121,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+18369 /* "DISTINCT aggrega..." */, 0) + ts+18384 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18420 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18435 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -132820,19 +133327,19 @@ func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintpt if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18453, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18468, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 18465 /* " USING COVERING ..." */ + return ts + 18480 /* " USING COVERING ..." */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) } } @@ -132852,7 +133359,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7309 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7324 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -133154,7 +133661,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+18488, /* "target object/al..." */ + ts+18503, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -133234,7 +133741,7 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18542, /* "expected %d colu..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18557, /* "expected %d colu..." */ libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: @@ -133375,7 +133882,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+741 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+756 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -133440,7 +133947,7 @@ __35: (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18582 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18597 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) @@ -133502,7 +134009,7 @@ __44: __45: ; Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18597 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18612 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { @@ -134022,9 +134529,9 @@ __97: explainTempTable(tls, pParse, func() uintptr { if ((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 18613 /* "DISTINCT" */ + return ts + 18628 /* "DISTINCT" */ } - return ts + 18622 /* "GROUP BY" */ + return ts + 18637 /* "GROUP BY" */ }()) groupBySort = 1 @@ -134436,7 +134943,7 @@ __58: if !(int32((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+18613 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+18628 /* "DISTINCT" */) __140: ; @@ -134448,9 +134955,9 @@ __140: explainTempTable(tls, pParse, func() uintptr { if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { - return ts + 18631 /* "RIGHT PART OF OR..." */ + return ts + 18646 /* "RIGHT PART OF OR..." */ } - return ts + 18654 /* "ORDER BY" */ + return ts + 18669 /* "ORDER BY" */ }()) generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) @@ -134584,7 +135091,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + z = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) if !(z == uintptr(0)) { goto __10 } @@ -134606,7 +135113,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+18663 /* "sqlite3_get_tabl..." */, 0) + ts+18678 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -134705,7 +135212,7 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } @@ -134866,7 +135373,7 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+18728 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18743 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; @@ -134927,7 +135434,7 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18774 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18789 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+40 /* &sFix */, pTableName) != 0) { goto __9 } @@ -134945,7 +135452,7 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+18782 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18797 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; @@ -134960,7 +135467,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18774 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18789 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -134976,7 +135483,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+18823 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+18838 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -134990,10 +135497,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7477 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7492 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18849 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18864 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -135003,12 +135510,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+18887, /* "cannot create %s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18902, /* "cannot create %s..." */ libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 18924 /* "BEFORE" */ + return ts + 18939 /* "BEFORE" */ } - return ts + 18931 /* "AFTER" */ + return ts + 18946 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -135017,7 +135524,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+18937 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + ts+18952 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -135047,9 +135554,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -135183,7 +135690,7 @@ __2: __3: ; Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18774 /* "trigger" */, bp+40 /* &nameToken */) + Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18789 /* "trigger" */, bp+40 /* &nameToken */) if !((Xsqlite3FixTriggerStep(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || (Xsqlite3FixExpr(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 @@ -135220,13 +135727,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+18983, /* "INSERT INTO %Q.s..." */ + ts+18998, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+19058 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+19073 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -135492,7 +135999,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+19087 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+19102 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -135533,9 +136040,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 11268 /* "sqlite_temp_mast..." */ + return ts + 11283 /* "sqlite_temp_mast..." */ } - return ts + 5352 /* "sqlite_master" */ + return ts + 5367 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -135548,7 +136055,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+19107, /* "DELETE FROM %Q.s..." */ + ts+19122, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -135667,12 +136174,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+19169, /* "%s RETURNING is ..." */ + ts+19184, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 19217 /* "DELETE" */ + return ts + 19232 /* "DELETE" */ } - return ts + 19224 /* "UPDATE" */ + return ts + 19239 /* "UPDATE" */ }())) __15: ; @@ -135768,7 +136275,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+19231 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19246 /* "RETURNING may no..." */, 0) return 1 } @@ -135909,7 +136416,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+5539 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+5554 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -136039,7 +136546,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+19273 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+19288 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -136742,7 +137249,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+19287, /* "cannot UPDATE ge..." */ + ts+19302, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto update_cleanup __27: @@ -136774,7 +137281,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+19323 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+19338 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -136785,7 +137292,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 7084 /* "ROWID" */ + return ts + 7099 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName }(), @@ -137816,7 +138323,7 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+19342 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+19357 /* "rows updated" */, uintptr(0)) __169: ; @@ -138203,10 +138710,10 @@ __1: if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { *(*int8)(unsafe.Pointer(bp + 216 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+19355 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+19370 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+19359 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) + ts+19374 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -138297,7 +138804,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+11322 /* "corrupt database" */, -1) + ts+11337 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -138365,7 +138872,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+19432 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+19436 /* "INS" */, uint64(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+19447 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+19451 /* "INS" */, uint64(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -138515,14 +139022,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19440 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19455 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19480 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19495 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -138533,7 +139040,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19523 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19538 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -138542,7 +139049,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 741 /* "" */ + zOut = ts + 756 /* "" */ __4: ; @@ -138578,7 +139085,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+19541 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+19556 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -138599,7 +139106,7 @@ __6: goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+19564 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19579 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -138615,7 +139122,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+13609 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+13624 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -138666,7 +139173,7 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+19591, /* "SELECT sql FROM ..." */ + ts+19606, /* "SELECT sql FROM ..." */ libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 @@ -138676,7 +139183,7 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+19699, /* "SELECT sql FROM ..." */ + ts+19714, /* "SELECT sql FROM ..." */ libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 @@ -138691,7 +139198,7 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+19753, /* "SELECT'INSERT IN..." */ + ts+19768, /* "SELECT'INSERT IN..." */ libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) @@ -138708,7 +139215,7 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+19904, /* "INSERT INTO vacu..." */ + ts+19919, /* "INSERT INTO vacu..." */ libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 @@ -139088,7 +139595,7 @@ func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintp var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11552 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11567 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -139182,7 +139689,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(pEnd)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+20034 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+20049 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -139194,7 +139701,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+20058, /* "UPDATE %Q.sqlite..." */ + ts+20073, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -139204,7 +139711,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+20157 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+20172 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -139269,7 +139776,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+20176 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+20191 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -139307,9 +139814,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20218 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20233 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2778 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2793 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) @@ -139321,7 +139828,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 20248 /* "vtable construct..." */ + var zFormat uintptr = ts + 20263 /* "vtable construct..." */ *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR @@ -139337,12 +139844,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+741 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+756 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+15069 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+15084 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -139401,13 +139908,13 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+20294 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+20309 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) @@ -139469,7 +139976,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20294 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+20309 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -139546,7 +140053,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)))) @@ -139918,7 +140425,7 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 @@ -140349,10 +140856,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 20313 /* "" */ + return ts + 20328 /* "" */ } if i == (-1) { - return ts + 15156 /* "rowid" */ + return ts + 15171 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*32)).FzName } @@ -140367,35 +140874,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+20320 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+20335 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+20326 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+20341 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11933 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11948 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4477 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+20326 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+20341 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11933 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11948 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+4518 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4533 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4477 /* ")" */, 1) } } @@ -140424,29 +140931,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+20328 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+20343 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+20320 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+20335 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 20331 /* "%s=?" */ + return ts + 20346 /* "%s=?" */ } - return ts + 20336 /* "ANY(%s)" */ + return ts + 20351 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+20344 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+20359 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+20346 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+20361 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+4462 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4477 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -140491,11 +140998,11 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+80 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20348 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20363 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 20354 /* "SEARCH" */ + return ts + 20369 /* "SEARCH" */ } - return ts + 20361 /* "SCAN" */ + return ts + 20376 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -140505,38 +141012,38 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 10096 /* "PRIMARY KEY" */ + zFmt = ts + 10111 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 20366 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 20381 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 20399 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 20414 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 20424 /* "COVERING INDEX %..." */ + zFmt = ts + 20439 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 20442 /* "INDEX %s" */ + zFmt = ts + 20457 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20451 /* " USING " */, 7) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20466 /* " USING " */, 7) Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 20459 /* "=" */ + zRangeOp = ts + 20474 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 20461 /* ">? AND rowid<" */ + zRangeOp = ts + 20476 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 20344 /* ">" */ + zRangeOp = ts + 20359 /* ">" */ } else { - zRangeOp = ts + 20346 /* "<" */ + zRangeOp = ts + 20361 /* "<" */ } Xsqlite3_str_appendf(tls, bp+48, /* &str */ - ts+20475 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + ts+20490 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20513, /* " VIRTUAL TABLE I..." */ + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20528, /* " VIRTUAL TABLE I..." */ libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) @@ -142092,7 +142599,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20540 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20555 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -142111,7 +142618,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20555 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20570 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -142859,10 +143366,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 15027 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 14497 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 14047 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 20564 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 15042 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14512 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 14062 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20579 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -143563,7 +144070,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+20571 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20586 /* "ON clause refere..." */, 0) return } } @@ -143639,7 +144146,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6171 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 6186 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -143740,7 +144247,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { - return ts + 20612 /* "NOCASE" */ + return ts + 20627 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -144042,7 +144549,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+20619, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+20634, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -144865,7 +145372,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+20655 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+20670 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*32)).FzName)) sentWarning = U8(1) __6: @@ -144946,7 +145453,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20681 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20696 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -145179,7 +145686,7 @@ __3: ((uint64(unsafe.Sizeof(sqlite3_index_constraint{})) + uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint64(nTerm))) + (uint64(unsafe.Sizeof(sqlite3_index_orderby{})) * uint64(nOrderBy))) + uint64(unsafe.Sizeof(HiddenIndexInfo1{}))))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5577 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5592 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*96) @@ -145306,9 +145813,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+2778 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+2793 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -147358,7 +147865,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20692 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20707 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -147406,7 +147913,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+20692 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20707 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -147795,7 +148302,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+20718 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+20733 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -148564,7 +149071,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+20753 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20768 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -148945,7 +149452,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+20771 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+20786 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) return uintptr(0) __3: ; @@ -149019,7 +149526,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20799 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20814 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -150154,7 +150661,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+20817 /* "second argument ..." */, -1) + pCtx, ts+20832 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -150303,7 +150810,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+20873 /* "argument of ntil..." */, -1) + pCtx, ts+20888 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -150400,17 +150907,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20918 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20929 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20940 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20945 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20958 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20968 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20974 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20985 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20995 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 21007 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 21012 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20933 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20944 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20955 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20960 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20973 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20983 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20989 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 21000 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 21010 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 21022 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 21027 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -150474,7 +150981,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21016 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+21031 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -150518,12 +151025,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+21035 /* "RANGE with offse..." */, 0) + ts+21050 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+21106 /* "FILTER clause ma..." */, 0) + ts+21121 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -150546,7 +151053,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7309 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7324 /* "1" */) } break } @@ -150788,7 +151295,7 @@ func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+7370 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+7385 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -150918,7 +151425,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6917 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -151058,7 +151565,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+21169 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21184 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -151124,15 +151631,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 21201 /* "PARTITION clause" */ + zErr = ts + 21216 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 21218 /* "ORDER BY clause" */ + zErr = ts + 21233 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 21234 /* "frame specificat..." */ + zErr = ts + 21249 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+21254 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+21269 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -151155,7 +151662,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+21287 /* "DISTINCT is not ..." */, 0) + ts+21302 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -151306,7 +151813,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+741 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+756 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -151328,11 +151835,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 21334, /* "frame starting o..." */ - ts + 21387, /* "frame ending off..." */ - ts + 20817, /* "second argument ..." */ - ts + 21438, /* "frame starting o..." */ - ts + 21490, /* "frame ending off..." */ + ts + 21349, /* "frame starting o..." */ + ts + 21402, /* "frame ending off..." */ + ts + 20832, /* "second argument ..." */ + ts + 21453, /* "frame starting o..." */ + ts + 21505, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -151934,7 +152441,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+741 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+756 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -152949,19 +153456,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21540, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21555, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 18654 /* "ORDER BY" */ + return ts + 18669 /* "ORDER BY" */ } - return ts + 21582 /* "LIMIT" */ + return ts + 21597 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+21588 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21603 /* "too many terms i..." */, 0) } } @@ -153041,7 +153548,7 @@ func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdT var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21622, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21637, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -154268,7 +154775,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+21660 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21675 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -155247,11 +155754,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+15156 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+15171 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+21682 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+21697 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) } } break @@ -155986,7 +156493,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21709 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21724 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -156139,7 +156646,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(bp + 96 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21718 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21733 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) @@ -156343,9 +156850,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { - return ts + 7309 /* "1" */ + return ts + 7324 /* "1" */ } - return ts + 6902 /* "0" */ + return ts + 6917 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -156620,21 +157127,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+21742 /* "qualified table ..." */, 0) + ts+21757 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21837 /* "the INDEXED BY c..." */, 0) + ts+21852 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21921 /* "the NOT INDEXED ..." */, 0) + ts+21936 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ @@ -157083,9 +157590,9 @@ func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor To _ = yymajor // Silence some compiler warnings if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21718 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21733 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+22006 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+22021 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -158292,7 +158799,7 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+22023 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+22038 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } @@ -158312,12 +158819,12 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2778 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2793 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+22050, /* "%s in \"%s\"" */ + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+22065, /* "%s in \"%s\"" */ libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ @@ -158529,7 +159036,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+22061 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+22076 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -158542,11 +159049,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18774 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18789 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+22068 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+22083 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+22073 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+22088 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -158559,9 +159066,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+22083 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+22098 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+22087 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+22102 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -159589,7 +160096,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22095 /* "unable to close ..." */, 0) + ts+22110 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -159811,23 +160318,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 22163 /* "unknown error" */ + var zErr uintptr = ts + 22178 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 22177 /* "abort due to ROL..." */ + zErr = ts + 22192 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 22199 /* "another row avai..." */ + zErr = ts + 22214 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 22221 /* "no more rows ava..." */ + zErr = ts + 22236 /* "no more rows ava..." */ break } @@ -159845,35 +160352,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 22244, /* "not an error" */ - /* SQLITE_ERROR */ ts + 22257, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 22259, /* "not an error" */ + /* SQLITE_ERROR */ ts + 22272, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 22273, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 22298, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 22312, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 22331, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 5577, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 22356, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 22393, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 22405, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 22420, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 22453, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 22471, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 22496, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 22525, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 22288, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 22313, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 22327, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 22346, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5592, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 22371, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 22408, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 22420, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 22435, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 22468, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22486, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22511, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22540, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 5307, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 4844, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 22542, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 22560, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 22578, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 5322, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4859, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22557, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22575, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22593, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 22612, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 22627, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 22633, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 22659, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 22682, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 22703, /* "warning message" */ + /* SQLITE_RANGE */ ts + 22648, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22674, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22697, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22718, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -160038,7 +160545,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22719 /* "unable to delete..." */, 0) + ts+22734 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -160171,7 +160678,7 @@ func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUs _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+22782 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+22797 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -160393,7 +160900,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22833 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22848 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -160612,7 +161119,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22854 /* "unable to delete..." */, 0) + ts+22869 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -160755,7 +161262,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22922 /* "file:" */, uint64(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22937 /* "file:" */, uint64(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -160803,10 +161310,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22928 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22943 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22938, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22953, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -160928,7 +161435,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22966 /* "vfs" */, zOpt, uint64(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22981 /* "vfs" */, zOpt, uint64(3)) == 0)) { goto __29 } zVfs = zVal @@ -160939,17 +161446,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22970 /* "cache" */, zOpt, uint64(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22985 /* "cache" */, zOpt, uint64(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 22970 /* "cache" */ + zModeType = ts + 22985 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22976 /* "mode" */, zOpt, uint64(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22991 /* "mode" */, zOpt, uint64(4)) == 0)) { goto __32 } @@ -160957,7 +161464,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 2385 /* "access" */ + zModeType = ts + 2400 /* "access" */ __32: ; @@ -160988,7 +161495,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22981 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22996 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -160996,7 +161503,7 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23001, /* "%s mode not allo..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23016, /* "%s mode not allo..." */ libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out @@ -161039,7 +161546,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23025 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23040 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -161063,15 +161570,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 23041 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 23048 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 23056 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 23063 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 23056 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 23059 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 23062 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 16265 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 23071 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 23074 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 23077 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 16280 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -161253,10 +161760,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+20612 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+20627 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+23066 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+23081 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -161302,7 +161809,7 @@ __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -161340,9 +161847,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5854 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5869 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 22068 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 22083 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -161460,7 +161967,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 23072 /* "\x00\x00" */ + zFilename = ts + 23087 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -161563,24 +162070,24 @@ func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) bp := tls.Alloc(24) defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+23075, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+23090, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+23100 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+23115 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+23120 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+23135 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+23127 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+23142 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -161707,7 +162214,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 11780 /* "INTEGER" */ + zDataType = ts + 11795 /* "INTEGER" */ primarykey = 1 __13: ; @@ -161759,14 +162266,14 @@ __19: goto __20 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+23144 /* "no such table co..." */, libc.VaList(bp, zTableName, + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+23159 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2778 /* "%s" */ + return ts + 2793 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -162565,7 +163072,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+23172 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+23187 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -162726,7 +163233,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 23180 /* "database is dead..." */ + return ts + 23195 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -163526,7 +164033,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 5654 /* "null" */, ts + 6166 /* "true" */, ts + 6171 /* "false" */, ts + 5664 /* "integer" */, ts + 5659 /* "real" */, ts + 13919 /* "text" */, ts + 23203 /* "array" */, ts + 23209, /* "object" */ + ts + 5669 /* "null" */, ts + 6181 /* "true" */, ts + 6186 /* "false" */, ts + 5679 /* "integer" */, ts + 5674 /* "real" */, ts + 13934 /* "text" */, ts + 23218 /* "array" */, ts + 23224, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -163706,7 +164213,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 23216 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 23231 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -163734,7 +164241,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+5654 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+5669 /* "null" */, uint32(4)) break } @@ -163763,7 +164270,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+23233 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+23248 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -163840,19 +164347,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+5654 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5669 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+6166 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+6181 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+6171 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+6186 /* "false" */, uint32(5)) break } @@ -164418,17 +164925,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5654 /* "null" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5669 /* "null" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6166 /* "true" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6181 /* "true" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6171 /* "false" */, uint64(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6186 /* "false" */, uint64(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -164536,7 +165043,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+23262 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+23277 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -164856,7 +165363,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+23277 /* "[0]" */, uint64(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+23292 /* "[0]" */, uint64(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -164873,7 +165380,7 @@ func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190 bp := tls.Alloc(8) defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+23281 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+23296 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -164940,7 +165447,7 @@ func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlit bp := tls.Alloc(8) defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+23307, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+23322, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -165084,7 +165591,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+5654 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+5669 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -165212,14 +165719,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+23350 /* "json_object() re..." */, -1) + ts+23365 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+23401 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+23416 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -165327,7 +165834,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+14430 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+14445 /* "replace" */) return __2: ; @@ -165413,9 +165920,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 23435 /* "set" */ + return ts + 23450 /* "set" */ } - return ts + 23439 /* "insert" */ + return ts + 23454 /* "insert" */ }()) return __2: @@ -165563,7 +166070,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+23446 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23461 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -165668,7 +166175,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+23449 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23464 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -165721,7 +166228,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+23452 /* "CREATE TABLE x(k..." */) + ts+23467 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -165859,14 +166366,14 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*16) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+23535 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+23550 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 16 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23540 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23555 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } @@ -165959,9 +166466,9 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+24 /* &x */, ts+23535 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23550 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23540 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23555 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } jsonResult(tls, bp+24 /* &x */) @@ -165985,7 +166492,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 23546 /* "$" */ + zRoot = ts + 23561 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -166117,7 +166624,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+23262 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+23277 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -166258,21 +166765,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 23548 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23553 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23564 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23564 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23582 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23595 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23607 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23619 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23630 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23641 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23653 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23666 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 23675 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23675 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23685 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23563 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23568 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23579 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23579 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23597 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23610 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23622 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23634 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23645 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23656 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23668 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23681 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23690 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23690 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23700 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -166282,17 +166789,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 23696 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 23711 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 23713 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 23728 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 23731 /* "json_each" */, FpModule: 0}, - {FzName: ts + 23741 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 23746 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23756 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -166642,11 +167149,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+23751 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23766 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23759 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23774 /* "data" */, iNode, 0, (pRtree + 112 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -166891,7 +167398,7 @@ func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+23764, /* "DROP TABLE '%q'...." */ + ts+23779, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -167651,7 +168158,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23846 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23861 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -167915,7 +168422,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -169175,7 +169682,7 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+23860 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+23875 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { @@ -169187,12 +169694,12 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if iCol == 0 { var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23880 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+23895 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23912 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+23927 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } @@ -169460,7 +169967,7 @@ func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqli var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+23949 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+23964 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -169498,7 +170005,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit bp := tls.Alloc(24) defer tls.Free(24) - var zFmt uintptr = ts + 24094 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 24109 /* "SELECT stat FROM..." */ var zSql uintptr // var p uintptr at bp+16, 8 @@ -169506,7 +170013,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10468 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10483 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -169559,7 +170066,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 24150 /* "node" */, ts + 4570 /* "parent" */, ts + 15156, /* "rowid" */ + ts + 24165 /* "node" */, ts + 4585 /* "parent" */, ts + 15171, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -169603,19 +170110,19 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+24155, /* "CREATE TABLE \"%w..." */ + ts+24170, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+24217 /* ",a%d" */, libc.VaList(bp+16, ii)) + Xsqlite3_str_appendf(tls, p, ts+24232 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+24222, /* ");CREATE TABLE \"..." */ + ts+24237, /* ");CREATE TABLE \"..." */ libc.VaList(bp+24, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+24286, /* "CREATE TABLE \"%w..." */ + ts+24301, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+24356, /* "INSERT INTO \"%w\"..." */ + ts+24371, /* "INSERT INTO \"%w\"..." */ libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { @@ -169646,7 +170153,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 24405 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 24420 /* "INSERT INTO\"%w\"...." */ } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { @@ -169658,7 +170165,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+24513, /* "SELECT * FROM \"%..." */ + ts+24528, /* "SELECT * FROM \"%..." */ libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM @@ -169666,18 +170173,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+24558 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+24573 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+11933 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+11948 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+24585 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+24600 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+24607 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+24622 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+24615 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+24630 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -169693,18 +170200,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 24631, /* "INSERT OR REPLAC..." */ - ts + 24684, /* "DELETE FROM '%q'..." */ + ts + 24646, /* "INSERT OR REPLAC..." */ + ts + 24699, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 24729, /* "SELECT nodeno FR..." */ - ts + 24781, /* "INSERT OR REPLAC..." */ - ts + 24835, /* "DELETE FROM '%q'..." */ + ts + 24744, /* "SELECT nodeno FR..." */ + ts + 24796, /* "INSERT OR REPLAC..." */ + ts + 24850, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 24880, /* "SELECT parentnod..." */ - ts + 24938, /* "INSERT OR REPLAC..." */ - ts + 24993, /* "DELETE FROM '%q'..." */ + ts + 24895, /* "SELECT parentnod..." */ + ts + 24953, /* "INSERT OR REPLAC..." */ + ts + 25008, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -169751,7 +170258,7 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr var zSql uintptr if isCreate != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+25040 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, ts+25055 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) @@ -169759,19 +170266,19 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+25060, /* "SELECT length(da..." */ + ts+25075, /* "SELECT length(da..." */ libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 32 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+25117, /* "undersize RTree ..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+25132, /* "undersize RTree ..." */ libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -169822,17 +170329,17 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr ii = 4 *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 25152, /* "Wrong number of ..." */ // 1 - ts + 25195, /* "Too few columns ..." */ // 2 - ts + 25230, /* "Too many columns..." */ // 3 - ts + 25266, /* "Auxiliary rtree ..." */ // 4 + ts + 25167, /* "Wrong number of ..." */ // 1 + ts + 25210, /* "Too few columns ..." */ // 2 + ts + 25245, /* "Too many columns..." */ // 3 + ts + 25281, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) return SQLITE_ERROR __1: ; @@ -169862,7 +170369,7 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+25303, /* "CREATE TABLE x(%..." */ + Xsqlite3_str_appendf(tls, pSql, ts+25318, /* "CREATE TABLE x(%..." */ libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = 4 __3: @@ -169874,7 +170381,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+25327 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+25342 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -169897,7 +170404,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+25333 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25348 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -169908,14 +170415,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -169958,7 +170465,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) goto rtreeInit_fail __22: ; @@ -169976,7 +170483,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -169996,7 +170503,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 25336 /* ",%.*s REAL" */, ts + 25347 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 25351 /* ",%.*s REAL" */, ts + 25362 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -170051,13 +170558,13 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit nodeGetCell(tls, bp+56 /* &tree */, bp+16 /* &node */, ii, bp+1024 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+10048 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+10063 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+25357 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, ts+25372 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+25363 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+25378 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+25367 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+25382 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -170076,7 +170583,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+25369 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+25384 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -170165,12 +170672,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+25402, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+25417, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 3567 /* "\n" */ + return ts + 3582 /* "\n" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -170201,7 +170708,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+25409, /* "SELECT data FROM..." */ + ts+25424, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -170220,7 +170727,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+25454 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+25469 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -170244,8 +170751,8 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa var rc int32 var pStmt uintptr *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ - ts + 25486, /* "SELECT parentnod..." */ - ts + 25540, /* "SELECT nodeno FR..." */ + ts + 25501, /* "SELECT parentnod..." */ + ts + 25555, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) == uintptr(0) { @@ -170260,23 +170767,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+25588, /* "Mapping (%lld ->..." */ + rtreeCheckAppendMsg(tls, pCheck, ts+25603, /* "Mapping (%lld ->..." */ libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 25633 /* "%_rowid" */ + return ts + 25648 /* "%_rowid" */ } - return ts + 25641 /* "%_parent" */ + return ts + 25656 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+25650, /* "Found (%lld -> %..." */ + ts+25665, /* "Found (%lld -> %..." */ libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 25633 /* "%_rowid" */ + return ts + 25648 /* "%_rowid" */ } - return ts + 25641 /* "%_parent" */ + return ts + 25656 /* "%_parent" */ }(), iKey, iVal)) } } @@ -170319,7 +170826,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+25708 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+25723 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { @@ -170339,7 +170846,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+25756 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + ts+25771 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -170362,14 +170869,14 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr if aNode != 0 { if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+25823 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + ts+25838 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+25857 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+25872 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } @@ -170377,7 +170884,7 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr nCell = readInt16(tls, (aNode + 2)) if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+25887, /* "Node %lld is too..." */ + ts+25902, /* "Node %lld is too..." */ libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { @@ -170411,14 +170918,14 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+25942, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+25957, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+25973 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + ts+25988 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -170448,13 +170955,13 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13609 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13624 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+26040 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+26055 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) @@ -170463,12 +170970,12 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23860 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23875 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+26068 /* "Schema corrupt o..." */, 0) + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+26083 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } @@ -170483,8 +170990,8 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+32 /* &check */, ts+26099 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+32 /* &check */, ts+26106 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+26114 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+26121 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check @@ -170494,7 +171001,7 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+26114 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + var rc int32 = Xsqlite3_exec(tls, db, ts+26129 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } @@ -170540,7 +171047,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+26118 /* "wrong number of ..." */, -1) + ts+26133 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -170548,7 +171055,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 5854 /* "main" */ + zDb = ts + 5869 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -170558,7 +171065,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 16781 /* "ok" */ + return ts + 16796 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -170995,11 +171502,11 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+26169 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+26184 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+26171 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+26186 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+26182 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+26197 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -171023,19 +171530,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+26193 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+26246 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -172051,7 +172558,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+26244 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+26259 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -172060,7 +172567,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+26266 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, ts+26281 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto __3 __3: ii++ @@ -172068,7 +172575,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+25333 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25348 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -172079,7 +172586,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -172105,7 +172612,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -172338,7 +172845,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 15156 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 15171 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -172348,7 +172855,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26270 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26285 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -172356,7 +172863,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26276 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 26291 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -172494,7 +173001,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+26285 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+26300 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -172639,14 +173146,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+26325 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+26340 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+26341 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+26356 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -172711,7 +173218,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+26356 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26371 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -172723,25 +173230,25 @@ var aFunc1 = [12]struct { _ [6]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26364 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26377 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26390 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 26403 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26341 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 26415 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26325 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 26438 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26452 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26465 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26479 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26495 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26379 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26392 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26405 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 26418 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26356 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 26430 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 26340 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 26453 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26467 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26480 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26494 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26510 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 26507 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 26522 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -172754,26 +173261,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+26526 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26541 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26536 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26551 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26547 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26562 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26270 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26285 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26558 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26573 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -172845,7 +173352,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23846 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23861 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -174136,7 +174643,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+26568 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26583 /* "corrupt fossil d..." */, -1) return } @@ -174147,7 +174654,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+26568 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26583 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -174168,7 +174675,7 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -174186,7 +174693,7 @@ func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -174290,7 +174797,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+26589 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + ts+26604 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -174374,7 +174881,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23759 /* "data" */, zIn, uint64(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23774 /* "data" */, zIn, uint64(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -174402,17 +174909,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26760 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+26775 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 26910 /* "AND rootpage!=0 ..." */ + return ts + 26925 /* "AND rootpage!=0 ..." */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 8 /* &.pIdxIter */), (p + 64 /* &.zErrmsg */), - ts+26951 /* "SELECT name, roo..." */) + ts+26966 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -174550,7 +175057,7 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -174613,7 +175120,7 @@ func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27076 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + ts+27091 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } @@ -174631,7 +175138,7 @@ __2: *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27157 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + Xsqlite3_mprintf(tls, ts+27172 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -174649,7 +175156,7 @@ __4: } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27178 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + ts+27193 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } @@ -174673,7 +175180,7 @@ __5: ; (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27229 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + Xsqlite3_mprintf(tls, ts+27244 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } @@ -174708,7 +175215,6 @@ __15: goto __14 goto __16 __16: - } // This is a helper function for rbuObjIterCacheTableInfo(). It populates @@ -174723,7 +175229,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.X__builtin___memcpy_chk(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)), libc.X__builtin_object_size(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27250 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+27265 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 @@ -174738,7 +175244,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.X__builtin___memset_chk(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)), libc.X__builtin_object_size(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0)) } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+24 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)))) { var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)), 1) if iCid >= 0 { @@ -174788,7 +175294,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+56 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+18300 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+18315 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc @@ -174801,18 +175307,18 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // of the input table. Ignore any input table columns that begin with // "rbu_". (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27307 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + Xsqlite3_mprintf(tls, ts+27322 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+27326 /* "rbu_" */, zName, 4) != 0 { + if Xsqlite3_strnicmp(tls, ts+27341 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 56 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*8)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+27331 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+27346 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } @@ -174824,12 +175330,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+27341 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+27356 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 27370 /* "may not have" */ + return ts + 27385 /* "may not have" */ } - return ts + 27383 /* "requires" */ + return ts + 27398 /* "requires" */ }())) } @@ -174838,7 +175344,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27392 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+27407 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) { var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 1) @@ -174852,7 +175358,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27414, /* "column missing f..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27429, /* "column missing f..." */ libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 5) @@ -174898,12 +175404,12 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+27441 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 13720 /* ", " */ + zList = rbuMPrintf(tls, p, ts+27456 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13735 /* ", " */ } return zList } @@ -174918,13 +175424,13 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = rbuMPrintf(tls, p, ts+27450 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+27465 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -174963,25 +175469,25 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, if bRowid != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27463 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + ts+27478 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27495 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + zRet = rbuMPrintf(tls, p, ts+27510 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+741 /* "" */, ts+13720 /* ", " */, ts+27518 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27524 /* "quote(" */, ts+27531 /* "||','||" */, ts+4462 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+741 /* "" */, ts+13720 /* ", " */, ts+741 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13735 /* ", " */, ts+27533 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27539 /* "quote(" */, ts+27546 /* "||','||" */, ts+4477 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13735 /* ", " */, ts+756 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27539, /* "SELECT %s FROM \"..." */ + ts+27554, /* "SELECT %s FROM \"..." */ libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27581 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + zRet = rbuMPrintf(tls, p, ts+27596 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } @@ -175039,12 +175545,12 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 741 /* "" */ + zSep = ts + 756 /* "" */ iCol = 0 *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 @@ -175081,7 +175587,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) goto __7 __6: - zCol = ts + 27601 /* "_rowid_" */ + zCol = ts + 27616 /* "_rowid_" */ __7: ; goto __5 @@ -175090,13 +175596,13 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+27609, /* "%z%s \"%w\" COLLAT..." */ + zLhs = rbuMPrintf(tls, p, ts+27624, /* "%z%s \"%w\" COLLAT..." */ libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+27630, /* "%z%s \"rbu_imp_%d..." */ + zOrder = rbuMPrintf(tls, p, ts+27645, /* "%z%s \"rbu_imp_%d..." */ libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+27666, /* "%z%s quote(\"rbu_..." */ + zSelect = rbuMPrintf(tls, p, ts+27681, /* "%z%s quote(\"rbu_..." */ libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ iCol++ goto __1 __2: @@ -175115,12 +175621,12 @@ __11: *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+184 /* &pSel */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27693, /* "SELECT %s FROM \"..." */ + Xsqlite3_mprintf(tls, ts+27708, /* "SELECT %s FROM \"..." */ libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))))) { goto __13 } - zSep = ts + 741 /* "" */ + zSep = ts + 756 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -175142,8 +175648,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+27741 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) - zSep = ts + 13720 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+27756 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13735 /* ", " */ goto __15 __15: iCol++ @@ -175155,7 +175661,7 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+27748 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+27763 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: @@ -175205,14 +175711,14 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 741 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 741 /* "" */ // Set to " AND " later on + var zCom uintptr = ts + 756 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 756 /* "" */ // Set to " AND " later on *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { @@ -175224,9 +175730,9 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC if iCid == -2 { var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+27760 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + zRet = Xsqlite3_mprintf(tls, ts+27775 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FzSpan, zCollate)) - zType = ts + 741 /* "" */ + zType = ts + 756 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -175238,37 +175744,37 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 27601 /* "_rowid_" */ + zCol = ts + 27616 /* "_rowid_" */ } else { - zCol = ts + 27331 /* "rbu_rowid" */ + zCol = ts + 27346 /* "rbu_rowid" */ } - zType = ts + 11780 /* "INTEGER" */ + zType = ts + 11795 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, ts+27782 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+27797 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 27518 /* " DESC" */ + return ts + 27533 /* " DESC" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+27802, /* "%z%s\"rbu_imp_%d%..." */ + zImpPK = Xsqlite3_mprintf(tls, ts+27817, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+27823, /* "%z%s\"rbu_imp_%d%..." */ + zImpCols = Xsqlite3_mprintf(tls, ts+27838, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+27856 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + ts+27871 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 13720 /* ", " */ - zAnd = ts + 20320 /* " AND " */ + zCom = ts + 13735 /* ", " */ + zAnd = ts + 20335 /* " AND " */ nBind++ } @@ -175311,16 +175817,16 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 741 /* "" */ + var zS uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, ts+27880 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+27895 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+27892 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+27907 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 13720 /* ", " */ + zS = ts + 13735 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -175329,7 +175835,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27901 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+27916 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -175349,27 +175855,27 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27916 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+27931 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+27930 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) - zSep = ts + 20320 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27945 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 20335 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+27942 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + ts+27957 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+27992 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) - zSep = ts + 20320 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+28007 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 20335 /* " AND " */ } } } @@ -175383,7 +175889,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28005 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28020 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -175412,21 +175918,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 741 /* "" */ + var zSep uintptr = ts + 756 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+27992, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+28007, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+28031, /* "%z%s\"%w\"=rbu_del..." */ + zList = rbuMPrintf(tls, p, ts+28046, /* "%z%s\"%w\"=rbu_del..." */ libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+28061, /* "%z%s\"%w\"=rbu_fos..." */ + zList = rbuMPrintf(tls, p, ts+28076, /* "%z%s\"%w\"=rbu_fos..." */ libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13720 /* ", " */ + zSep = ts + 13735 /* ", " */ } } } @@ -175484,19 +175990,19 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 28098 /* "PRIMARY KEY(" */ + var zSep uintptr = ts + 28113 /* "PRIMARY KEY(" */ *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27250 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+27265 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+15066 /* "pk" */) == 0) { + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+15081 /* "pk" */) == 0) { var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } @@ -175509,15 +176015,15 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 2) var zDesc uintptr if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 3) != 0 { - zDesc = ts + 27518 /* " DESC" */ + zDesc = ts + 27533 /* " DESC" */ } else { - zDesc = ts + 741 /* "" */ + zDesc = ts + 756 /* "" */ } - z = rbuMPrintf(tls, p, ts+28111 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = ts + 13720 /* ", " */ + z = rbuMPrintf(tls, p, ts+28126 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13735 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+28122 /* "%z)" */, libc.VaList(bp+48, z)) + z = rbuMPrintf(tls, p, ts+28137 /* "%z)" */, libc.VaList(bp+48, z)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */))) } return z @@ -175549,7 +176055,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 741 /* "" */ + var zComma uintptr = ts + 756 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration @@ -175557,7 +176063,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 64 /* &.zErrmsg */), - ts+28126 /* "SELECT name FROM..." */) + ts+28141 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { @@ -175566,7 +176072,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit } if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27278 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + Xsqlite3_mprintf(tls, ts+27293 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) @@ -175576,25 +176082,25 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+28176 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + zCols = rbuMPrintf(tls, p, ts+28191 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+28198 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+28213 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 27518 /* " DESC" */ + return ts + 27533 /* " DESC" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) - zComma = ts + 13720 /* ", " */ + zComma = ts + 13735 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+28208 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + zCols = rbuMPrintf(tls, p, ts+28223 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28223, /* "CREATE TABLE rbu..." */ + ts+28238, /* "CREATE TABLE rbu..." */ libc.VaList(bp+120, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 0)) } } @@ -175622,52 +176128,52 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 741 /* "" */ + var zComma uintptr = ts + 756 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 741 /* "" */ + var zPk uintptr = ts + 756 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 28285 /* "PRIMARY KEY " */ + zPk = ts + 28300 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+28298, /* "%z%s\"%w\" %s %sCO..." */ + zSql = rbuMPrintf(tls, p, ts+28313, /* "%z%s\"%w\" %s %sCO..." */ libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 28325 /* " NOT NULL" */ + return ts + 28340 /* " NOT NULL" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) - zComma = ts + 13720 /* ", " */ + zComma = ts + 13735 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+28335 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+28350 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+28342, /* "CREATE TABLE \"rb..." */ + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+28357, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 28374 /* " WITHOUT ROWID" */ + return ts + 28389 /* " WITHOUT ROWID" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 0)) } } @@ -175690,7 +176196,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 152 /* &.pTmpInsert */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+28389, /* "INSERT INTO %s.'..." */ + ts+28404, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -175727,7 +176233,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+28446 /* "SELECT trim(sql)..." */) + ts+28461 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -175837,7 +176343,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+28512 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+28527 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -175858,26 +176364,26 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 624 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28532, /* "CREATE TABLE \"rb..." */ + ts+28547, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, 0, 0)) // Create the statement to insert index entries (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28597 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+28612 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28633 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+28648 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -175894,7 +176400,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+28667, /* "SELECT %s, 0 AS ..." */ + ts+28682, /* "SELECT %s, 0 AS ..." */ libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, @@ -175902,32 +176408,32 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 28728 /* "AND" */ + return ts + 28743 /* "AND" */ } - return ts + 28732 /* "WHERE" */ + return ts + 28747 /* "WHERE" */ }() } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+28738, /* "SELECT %s, rbu_c..." */ + ts+28753, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+216, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+28799, /* "SELECT %s, rbu_c..." */ + ts+28814, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+264, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 28728 /* "AND" */ + return ts + 28743 /* "AND" */ } - return ts + 28732 /* "WHERE" */ + return ts + 28747 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -175952,8 +176458,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5863 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5859 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5878 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5874 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -175963,21 +176469,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 28958 /* "rbu_imp_" */ + return ts + 28973 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+28967, /* "INSERT INTO \"%s%..." */ + ts+28982, /* "INSERT INTO \"%s%..." */ libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 29003 /* ", _rowid_" */ + return ts + 29018 /* ", _rowid_" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zBindings))) } @@ -175987,28 +176493,28 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+29013 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + ts+29028 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 741 /* "" */ + var zRbuRowid uintptr = ts + 756 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 29041 /* ", rbu_rowid" */ + zRbuRowid = ts + 29056 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29053 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+29068 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 29129 /* ", 0 AS rbu_rowid" */ + return ts + 29144 /* ", 0 AS rbu_rowid" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29146, /* "CREATE TEMP TRIG..." */ + ts+29161, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) @@ -176016,7 +176522,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29445, /* "CREATE TEMP TRIG..." */ + ts+29460, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } @@ -176025,14 +176531,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 741 /* "" */ + var zRbuRowid uintptr = ts + 756 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 29544 /* ",_rowid_ " */ + zRbuRowid = ts + 29559 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 29554 /* ",rbu_rowid" */ + zRbuRowid = ts + 29569 /* ",rbu_rowid" */ } } @@ -176045,35 +176551,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+27601 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+27616 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+741 /* "" */, ts+13720 /* ", " */, ts+741 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13735 /* ", " */, ts+756 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+29565, /* "SELECT %s,%s rbu..." */ + ts+29580, /* "SELECT %s,%s rbu..." */ libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 29613 /* "0 AS " */ + return ts + 29628 /* "0 AS " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 18654 /* "ORDER BY" */ + return ts + 18669 /* "ORDER BY" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), zOrder, zLimit))) } @@ -176148,12 +176654,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 741 /* "" */ + var zPrefix uintptr = ts + 756 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 28958 /* "rbu_imp_" */ + zPrefix = ts + 28973 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+29619, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+29634, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 8 /* &.pUpdate */), (p + 64 /* &.zErrmsg */), zUpdate) @@ -176180,7 +176686,7 @@ func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uin return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } @@ -176221,7 +176727,7 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ } *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29649 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) + Xsqlite3_mprintf(tls, ts+29664 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: @@ -176293,31 +176799,31 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29679 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29694 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29706 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+2399 /* "stat" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29721 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+2414 /* "stat" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) } else { - libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+5854 /* "main" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) + libc.X__builtin___memcpy_chk(tls, p+48 /* &.zStateDb */, ts+5869 /* "main" */, uint64(4), libc.X__builtin_object_size(tls, p+48 /* &.zStateDb */, 0)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29724 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29739 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -176350,11 +176856,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29790 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29805 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22922 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22937 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -176366,16 +176872,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+29822, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+29837, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 29854 /* "&" */ + return ts + 29869 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } return zExtra }())) @@ -176391,40 +176897,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29856 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29871 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29871 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+29886 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29888 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29903 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29904 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29919 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29932 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29947 /* "rbu vfs not foun..." */, 0) } } @@ -176493,7 +176999,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29904 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29919 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -176527,7 +177033,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29950 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29965 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -176654,16 +177160,16 @@ func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ bp := tls.Alloc(16) defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5854 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5869 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5854 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5869 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+29985 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+29992 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+30000 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+30007 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -176803,7 +177309,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22560 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22575 /* "datatype mismatc..." */, 0) return } @@ -176921,7 +177427,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // var pStmt uintptr at bp+8, 8 (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+29999 /* "PRAGMA schema_ve..." */) + ts+30014 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot @@ -176934,7 +177440,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30021 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30036 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -176959,7 +177465,7 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+30048, /* "INSERT OR REPLAC..." */ + ts+30063, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+48, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -177004,9 +177510,9 @@ func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+30206 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + Xsqlite3_mprintf(tls, ts+30221 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30221, /* "PRAGMA main.%s =..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30236, /* "PRAGMA main.%s =..." */ libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) @@ -177023,11 +177529,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30241 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30256 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+30266 /* "SELECT sql FROM ..." */) + ts+30281 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -177041,12 +177547,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+30374 /* "SELECT * FROM sq..." */) + ts+30389 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8 /* &pInsert */, (p + 64 /* &.zErrmsg */), - ts+30439 /* "INSERT INTO sqli..." */) + ts+30454 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -177058,7 +177564,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30483 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30498 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -177080,8 +177586,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+16138 /* "user_version" */) - rbuCopyPragma(tls, p, ts+15244 /* "application_id" */) + rbuCopyPragma(tls, p, ts+16153 /* "user_version" */) + rbuCopyPragma(tls, p, ts+15259 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -177092,7 +177598,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30508 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+30523 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -177118,10 +177624,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -177238,7 +177744,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30536 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30551 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -177257,7 +177763,7 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ bp := tls.Alloc(8) defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+29985 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+30000 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -177279,7 +177785,7 @@ func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ // var zRnd [64]int8 at bp+12, 64 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30561 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30576 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) @@ -177318,7 +177824,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+16, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+30572 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+30587 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)), -1) } else { @@ -177361,7 +177867,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30644 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30659 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -177369,7 +177875,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30658 /* "SELECT 1 FROM sq..." */) + ts+30673 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -177381,7 +177887,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30715 /* "SELECT sum(cnt *..." */) + ts+30730 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -177427,7 +177933,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.X__builtin___memcpy_chk(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + uint64(1)), libc.X__builtin_object_size(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 0)) pCsr += (uintptr(nRbu + uint64(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2778 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2793 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -177464,7 +177970,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30789 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30804 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -177486,12 +177992,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30821, /* "database modifie..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30836, /* "database modifie..." */ libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30853 /* "vacuum" */ + return ts + 30868 /* "vacuum" */ } - return ts + 30860 /* "update" */ + return ts + 30875 /* "update" */ }())) } } @@ -177499,7 +178005,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13609 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -177513,24 +178019,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+15863 /* "page_size" */) - rbuCopyPragma(tls, p, ts+15259 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+15878 /* "page_size" */) + rbuCopyPragma(tls, p, ts+15274 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30867 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30882 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+5854 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+5869 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+30883 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + db, ts+30898 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } } @@ -177583,7 +178089,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30907 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30922 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { return rbuMisuseError(tls) } } @@ -177613,7 +178119,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); Size_t(i) < (nErrmsg - uint64(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28958 /* "rbu_imp_" */, uint64(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28973 /* "rbu_imp_" */, uint64(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -177632,7 +178138,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -177644,7 +178150,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Close any open statement handles. @@ -177656,7 +178162,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30915 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30930 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -177755,7 +178261,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -177772,19 +178278,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13624 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13639 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 13609 /* "BEGIN" */ + zBegin = ts + 13624 /* "BEGIN" */ } else { - zBegin = ts + 30867 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 30882 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30867 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30882 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -178188,7 +178694,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30942 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30957 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -178211,7 +178717,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+30965 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30980 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -178374,7 +178880,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5854 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5869 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -178389,7 +178895,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+30976 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+30991 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -178696,6 +179202,5673 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + _ [4]byte + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + _ [4]byte + FaData uintptr + FnData int32 + _ [4]byte + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 + _ [4]byte +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.X__builtin___memcpy_chk(tls, bp /* &i */, bp+8 /* &r */, uint64(8), libc.X__builtin_object_size(tls, bp /* &i */, 0)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nVarint + 1))), z, uint64(n), libc.X__builtin_object_size(tls, (aBuf+uintptr((nVarint+1))), 0)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 8 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &iVal */, 0)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.X__builtin___memcpy_chk(tls, aOut, a2, uint64(n2), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(n2) + } else { + libc.X__builtin___memcpy_chk(tls, aOut, a1, uint64(n1), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+16, 4 + + var aOld uintptr + // var nNew int32 at bp+40, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+16 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+40 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.X__builtin___memcpy_chk(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+44, 4 + + var aOld uintptr + // var nNew int32 at bp+48, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+44 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+48 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 44 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.X__builtin___memcpy_chk(tls, aOut, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))), libc.X__builtin_object_size(tls, aOut, 0)) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 8 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &rVal */, 0)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.X__builtin___memset_chk(tls, apNew, 0, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew))), libc.X__builtin_object_size(tls, apNew, 0)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 8 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10483 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+31002 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+756 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+31123 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(uint64(nDbCol) * ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))) + uint64(1))))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*8) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.X__builtin___memcpy_chk(tls, pAlloc, zThis, (uint64(nThis + 1)), libc.X__builtin_object_size(tls, pAlloc, 0)) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.X__builtin___memcpy_chk(tls, pAlloc, zName, (uint64(nName + 1)), libc.X__builtin_object_size(tls, pAlloc, 0)) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 8 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 16 /* &.nCol */), uintptr(0), (pTab + 24 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10483 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += I64((uint64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + uint64(1)))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 24 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 32 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.X__builtin___memcpy_chk(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp+24 /* &dVal */, 0)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + // var iHash int32 at bp+48, 4 + + // var bNull int32 at bp+52, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 48 + + var p uintptr + // var p1 uintptr at bp+56, 8 + + // var p2 uintptr at bp+72, 8 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+64, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 24 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+756 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+48 /* &iHash */, bp+52 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)), bp+64 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.X__builtin___memset_chk(tls, pC, 0, uint64(unsafe.Sizeof(SessionChange{})), libc.X__builtin_object_size(tls, pC, 0)) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*32) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)), bp+64 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 48 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 8 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 + _ [4]byte +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+31152, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 20335 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+31186, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 31227 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6917 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+31232, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+31310, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 16 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+24, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+40, 8 + + // var azCol uintptr at bp+32, 8 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+16, 8 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.X__builtin___memset_chk(tls, bp /* &d */, 0, uint64(unsafe.Sizeof(SessionDiffCtx{})), libc.X__builtin_object_size(tls, bp /* &d */, 0)) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+16 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24 /* &nCol */, uintptr(0), bp+32 /* &azCol */, bp+40 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol + uintptr(i)*8))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+31363 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(Sqlite3_session{})) + uint64(nDb)) + uint64(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_session{})), libc.X__builtin_object_size(tls, pNew, 0)) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*136) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.X__builtin___memcpy_chk(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint64(nDb + 1)), libc.X__builtin_object_size(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, 0)) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 8 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 80 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionTable{})) + uint64(nName)) + uint64(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.X__builtin___memset_chk(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{})), libc.X__builtin_object_size(tls, pTab, 0)) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*56) + libc.X__builtin___memcpy_chk(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint64(nName + 1)), libc.X__builtin_object_size(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, 0)) + for ppTab = (pSession + 88 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.X__builtin___memcpy_chk(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint64(nBlob), libc.X__builtin_object_size(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), 0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.X__builtin___memcpy_chk(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint64(nStr), libc.X__builtin_object_size(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf+uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), 0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([24]int8{})) - uint64(1))), bp+8 /* &aBuf[0] */, ts+4500 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = (int32((int64(zOut) - int64((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.X__builtin___memcpy_chk(tls, bp /* &i */, bp+8 /* &r */, uint64(8), libc.X__builtin_object_size(tls, bp /* &i */, 0)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &dVal */, 0)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+32 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+32 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, (int32((int64(a) - int64(pStart)) / 1)), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10483 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+31390 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 756 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31500 /* "SELECT * FROM " */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+769 /* "." */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31515 /* " WHERE " */, bp+24 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31523 /* " IS ?" */, bp+24 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+24 /* &rc */) + zSep = ts + 20335 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.X__builtin___memcpy_chk(tls, bp /* &rVal */, bp+8 /* &iVal */, uint64(8), libc.X__builtin_object_size(tls, bp /* &rVal */, 0)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+40, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31529 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+16, 8 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+8 /* &azCol */, bp+16 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+24 /* &buf */, bPatchset, pTab, bp+40 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), bp+48 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+24 /* &buf */, uint8(SQLITE_INSERT), bp+40 /* &rc */) + sessionAppendByte(tls, bp+24 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+40 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+24 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), iCol, bp+40 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendUpdate(tls, bp+24 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendDelete(tls, bp+24 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31549 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{})), libc.X__builtin_object_size(tls, pRet, 0)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.X__builtin___memmove_chk(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint64(nMove), libc.X__builtin_object_size(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, 0)) + } + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+32 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 48 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.X__builtin___memcpy_chk(tls, aCopy, aData, uint64(nData), libc.X__builtin_object_size(tls, aCopy, 0)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.X__builtin___memcpy_chk(tls, bp+8 /* &d */, bp+16 /* &v */, uint64(8), libc.X__builtin_object_size(tls, bp+8 /* &d */, 0)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 120 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)) + uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 72 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)) + libc.X__builtin___memset_chk(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK, libc.X__builtin_object_size(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0)) + libc.X__builtin___memcpy_chk(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))), libc.X__builtin_object_size(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf+uintptr(iPK)), 0)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*8) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+100 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + libc.X__builtin___memset_chk(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)), libc.X__builtin_object_size(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0)) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+100 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*8)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var rc int32 at bp+40, 4 + // Return value + // var sOut SessionBuffer at bp, 16 + // Output buffer + // var nCol int32 at bp+20, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+24, 16 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+16, 4 + + var nVar int32 + // var nByte1 int32 at bp+44, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.X__builtin___memset_chk(tls, bp /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, bp /* &sOut */, 0)) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+16 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+20 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+24 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 16 /* nByte */)), bp+40 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 16 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+44 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */)), bp+40 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.X__builtin___memset_chk(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)), libc.X__builtin_object_size(tls, apVal, 0)) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+40 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))*8), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) + }())))*8)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+40 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+40 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.X__builtin___memset_chk(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)), libc.X__builtin_object_size(tls, apVal, 0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + // Set up the input stream + libc.X__builtin___memset_chk(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{})), libc.X__builtin_object_size(tls, bp /* &sInput */, 0)) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + var rc int32 + + // Set up the input stream + libc.X__builtin___memset_chk(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{})), libc.X__builtin_object_size(tls, bp /* &sInput */, 0)) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + _ [4]byte + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [6]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + libc.X__builtin___memset_chk(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))), libc.X__builtin_object_size(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 64 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint64(nU32)*uint64(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionUpdate{})) * uint64(nU32)) * uint64(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10483 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 756 /* "" */ + // var buf SessionBuffer at bp, 16 + + libc.X__builtin___memset_chk(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, bp /* &buf */, 0)) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*24) + libc.X__builtin___memcpy_chk(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))), libc.X__builtin_object_size(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, 0)) + + sessionAppendStr(tls, bp /* &buf */, ts+31567 /* "UPDATE main." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31580 /* " SET " */, bp+16 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31586 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+16 /* &rc */) + zSep = ts + 13735 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 756 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31515 /* " WHERE " */, bp+16 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*8)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31591 /* "idx IS CASE WHEN..." */, bp+16 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31523 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+16 /* &rc */) + } + zSep = ts + 20335 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31666 /* "DELETE FROM main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31515 /* " WHERE " */, bp+16 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31586 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 20335 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31684 /* " AND (?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31227 /* " OR " */, bp+16 /* &rc */) + + zSep = ts + 756 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31523 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 31692 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4477 /* ")" */, bp+16 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5869 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 24 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31697 /* "INSERT INTO main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+20341 /* "(" */, bp+16 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13735 /* ", " */, bp+16 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31715 /* ") VALUES(?" */, bp+16 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31726 /* ", ?" */, bp+16 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4477 /* ")" */, bp+16 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 16 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10483 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 16 /* &.pInsert */), + + ts+31730 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pDelete */), + + ts+31843 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 8 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var nCol int32 at bp+8, 4 + // Number of columns in table + // var op int32 at bp+12, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 8 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 104 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 104 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 104 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+8 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8 /* &pVal */) + } + sessionAppendValue(tls, (p + 104 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+16, 4 + + // var nCol int32 at bp+8, 4 + + // var op int32 at bp+12, 4 + + // var zDummy uintptr at bp, 8 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 88 /* &.constraints */), aBlob, nBlob, bp+16 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var zDummy uintptr at bp, 8 + + // var op int32 at bp+12, 4 + + // var nCol int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 8 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+16 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*8)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*8)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31987 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32008 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.X__builtin___memset_chk(tls, (pApply + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, (pApply+88 /* &.constraints */), 0)) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint64(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint64(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 72 /* &.tblhdr */), int64(nByte), bp+8 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + libc.X__builtin___memset_chk(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte, libc.X__builtin_object_size(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0)) + } + + for (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(368) + defer tls.Free(368) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 128 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.X__builtin___memset_chk(tls, bp+48 /* &sApply */, 0, uint64(unsafe.Sizeof(SessionApplyCtx{})), libc.X__builtin_object_size(tls, bp+48 /* &sApply */, 0)) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+32027 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32053 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+184, 4 + + // var op int32 at bp+188, 4 + + // var zNew uintptr at bp+176, 8 + + Xsqlite3changeset_op(tls, pIter, bp+176 /* &zNew */, bp+184 /* &nCol */, bp+188 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+192, 8 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.X__builtin___memset_chk(tls, (bp + 48 /* &sApply */ + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, (bp+48 /* &sApply */ +88 /* &.constraints */), 0)) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+192 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5869 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), (bp + 48 /* &sApply */ + 32 /* &.nCol */), bp+200 /* &zTab */, (bp + 48 /* &sApply */ + 40 /* &.azCol */), (bp + 48 /* &sApply */ + 48 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+32083 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+32127, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 192 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+32198 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), ts+10483 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+208, 4 + + // var notUsed int32 at bp+212, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+208 /* &nFk */, bp+212 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+216, 152 + + libc.X__builtin___memset_chk(tls, bp+216 /* &sIter */, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{})), libc.X__builtin_object_size(tls, bp+216 /* &sIter */, 0)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 216 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+216 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+32258 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32288 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+32312 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+32288 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(SessionChange{})) + uint64(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{})), libc.X__builtin_object_size(tls, pNew, 0)) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*32) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.X__builtin___memcpy_chk(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec), libc.X__builtin_object_size(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, 0)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.X__builtin___memcpy_chk(tls, pOut, pIn, uint64(nIn), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(nByte), libc.X__builtin_object_size(tls, pNew, 0)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(n1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n1) + } else { + libc.X__builtin___memcpy_chk(tls, pOut, a2, uint64(n2), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+8, 8 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(SessionChange{})) + uint64((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{})), libc.X__builtin_object_size(tls, pNew, 0)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.X__builtin___memcpy_chk(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec), libc.X__builtin_object_size(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), 0)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+16 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+24 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.X__builtin___memcpy_chk(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec), libc.X__builtin_object_size(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), 0)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */))) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var aRec uintptr at bp, 8 + + // var nRec int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+16, 8 + + // var nCol int32 at bp+24, 4 + + // var op int32 at bp+28, 4 + + var iHash int32 + // var bIndirect int32 at bp+32, 4 + + // var pChange uintptr at bp+48, 8 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+16 /* &zNew */, bp+24 /* &nCol */, bp+28 /* &op */, bp+32 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)))) + // var abPK uintptr at bp+40, 8 + + Xsqlite3changeset_pk(tls, pIter, bp+40 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(SessionTable{})) + uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + uint64(nNew)) + uint64(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.X__builtin___memset_chk(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{})), libc.X__builtin_object_size(tls, pTab, 0)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 24 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*56) + libc.X__builtin___memcpy_chk(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */))), libc.X__builtin_object_size(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, 0)) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + libc.X__builtin___memcpy_chk(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (uint64(nNew + 1)), libc.X__builtin_object_size(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, 0)) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28 /* op */)), *(*int32)(unsafe.Pointer(bp + 32 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+48 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+16 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+16 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+16 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.X__builtin___memset_chk(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3_changegroup{})), libc.X__builtin_object_size(tls, p, 0)) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.X__builtin___memcpy_chk(tls, pOut, a2, uint64(nn2), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(nn2) + } else { + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(nn1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(n1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.X__builtin___memcpy_chk(tls, pOut, a2, uint64(n2), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.X__builtin___memcpy_chk(tls, pOut, a1, uint64(n1), libc.X__builtin_object_size(tls, pOut, 0)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 16 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, bp+12 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+16 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+32 /* &rc */) + sessionAppendVarint(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+32 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_UPDATE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+40 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_INSERT), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)), (int32(int64(*(*int32)(unsafe.Pointer(bp + 8 /* nRec */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */))) - int64(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1))), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+16 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_DELETE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + libc.X__builtin___memset_chk(tls, bp+16 /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{})), libc.X__builtin_object_size(tls, bp+16 /* &sOut */, 0)) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.X__builtin___memset_chk(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_rebaser{})), libc.X__builtin_object_size(tls, pNew, 0)) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -178766,71 +184939,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -179660,7 +185768,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+30987 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+32340 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -179983,7 +186091,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+31015 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+32368 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -180262,7 +186370,7 @@ func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31046 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+32399 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -180336,7 +186444,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 31053 /* "wrong number of ..." */ + var zErr uintptr = ts + 32406 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -180503,7 +186611,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 741 /* "" */ + return ts + 756 /* "" */ } // Implementation of snippet() function. @@ -180530,7 +186638,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 31103 /* "wrong number of ..." */ + var zErr uintptr = ts + 32456 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -180872,13 +186980,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(96) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 31151 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32504 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 31159 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32512 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 31169 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32522 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -181372,7 +187480,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+5654 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+5669 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -181551,7 +187659,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+31174 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32527 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 @@ -181578,14 +187686,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31181 /* "malformed prefix..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32534 /* "malformed prefix..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+31212 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + ts+32565 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -181596,7 +187704,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31245 /* "prefix length ou..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32598 /* "prefix length ou..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -181609,7 +187717,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31282 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32635 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + uint64(1))) var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) @@ -181618,7 +187726,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31291 /* "multiple tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32644 /* "multiple tokeniz..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { @@ -181637,7 +187745,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31324 /* "parse error in t..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32677 /* "parse error in t..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, @@ -181652,14 +187760,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31358 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32711 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31366 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32719 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+31398 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32751 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } @@ -181667,9 +187775,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31404 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32757 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31418 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32771 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) @@ -181677,9 +187785,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+31456 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32809 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31467 /* "malformed column..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32820 /* "malformed column..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) @@ -181687,21 +187795,21 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+4585 /* "detail" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+4600 /* "detail" */, zCmd, nCmd) == 0 { *(*[4]Fts5Enum)(unsafe.Pointer(bp + 48 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 16243 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 16248 /* "full" */}, - {FzName: ts + 31502 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {FzName: ts + 16258 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 16263 /* "full" */}, + {FzName: ts + 32855 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+48 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31510 /* "malformed detail..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32863 /* "malformed detail..." */, 0) } return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31541 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32894 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -181765,15 +187873,15 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+20940 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+15156 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31569 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20955 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+15171 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32922 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+31599 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32952 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31609 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32962 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -181791,13 +187899,13 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31640 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32993 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31645 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32998 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31652 /* ", T.c%d" */, libc.VaList(bp+16, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+33005 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } @@ -181845,8 +187953,8 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20940 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31660 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20955 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33013 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } @@ -181879,7 +187987,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31689 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33042 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { @@ -181887,7 +187995,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), pzErr) } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)), pzErr) @@ -181912,19 +188020,19 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 31358 /* "content" */ + zTail = ts + 32711 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 31709 /* "docsize" */ + zTail = ts + 33062 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+40 /* &rc */, ts+31717 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+33070 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+15156 /* "rowid" */, -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+15171 /* "rowid" */, -1) } // Formulate the zContentExprlist text @@ -181973,18 +188081,18 @@ func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31728 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+33081 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 741 /* "" */ + return ts + 756 /* "" */ } - return ts + 13720 /* ", " */ + return ts + 13735 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31744 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+33097 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31751, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20940 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+33104, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20955 /* "rank" */)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -182124,7 +188232,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+31777 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+33130 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -182134,7 +188242,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31782 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33135 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -182144,7 +188252,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31791 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33144 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -182157,7 +188265,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31801 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33154 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -182167,7 +188275,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31811 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+33164 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -182183,7 +188291,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20940 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20955 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 8 @@ -182210,7 +188318,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 bp := tls.Alloc(52) defer tls.Free(52) - var zSelect uintptr = ts + 31823 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 33176 /* "SELECT k, v FROM..." */ var zSql uintptr *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK @@ -182233,7 +188341,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) { var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 0) var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+31855 /* "version" */) { + if 0 == Xsqlite3_stricmp(tls, zK, ts+33208 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 48 /* bDummy */)) = 0 @@ -182248,7 +188356,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+31863, /* "invalid fts5 fil..." */ + ts+33216, /* "invalid fts5 fil..." */ libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } @@ -182382,7 +188490,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31928 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+33281 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -182395,20 +188503,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31948 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+33301 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31979 /* "OR" */, uint64(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+33332 /* "OR" */, uint64(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31982 /* "NOT" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+33335 /* "NOT" */, uint64(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28728 /* "AND" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28743 /* "AND" */, uint64(3)) == 0) { tok = FTS5_AND } break @@ -184381,9 +190489,9 @@ func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqli bp := tls.Alloc(16) defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+31986 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+33339 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+31015 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+32368 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -184399,7 +190507,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+31991 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+33344 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -184496,7 +190604,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+19323 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+19338 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -184592,7 +190700,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+32020 /* "fts5: column que..." */, 0) + ts+33373 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -184776,12 +190884,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+32073, /* "fts5: %s queries..." */ + ts+33426, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 32123 /* "phrase" */ + return ts + 33476 /* "phrase" */ } - return ts + 31986 /* "NEAR" */ + return ts + 33339 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -186254,7 +192362,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+32130 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33483 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -186342,7 +192450,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+32136, /* "REPLACE INTO '%q..." */ + ts+33489, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -186370,7 +192478,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+32187, /* "DELETE FROM '%q'..." */ + ts+33540, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+72 /* &.pDeleter */), zSql) != 0 { return @@ -186394,7 +192502,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 88 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+32236, /* "DELETE FROM '%q'..." */ + ts+33589, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -186602,7 +192710,7 @@ func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12 if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 112 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+32276 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+33629 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -188037,7 +194145,7 @@ func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:2 var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 96 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+32299, /* "SELECT pgno FROM..." */ + ts+33652, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -189294,7 +195402,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -189635,7 +195743,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 80 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+32383, /* "INSERT INTO '%q'..." */ + ts+33736, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -190852,7 +196960,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.X__builtin___memset_chk(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Fts5Structure{})), libc.X__builtin_object_size(tls, bp /* &s */, 0)) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+741 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+756 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -190873,13 +196981,13 @@ func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uint if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+32440 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33793 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+23759 /* "data" */, ts+32448 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+23774 /* "data" */, ts+33801 /* "id INTEGER PRIMA..." */, 0, pzErr) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10608, /* "idx" */ - ts+32483, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10623, /* "idx" */ + ts+33836, /* "segid, term, pgn..." */ 1, pzErr) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { @@ -191185,7 +197293,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+32130 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) + ts+33483 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))) @@ -191322,7 +197430,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+32527, /* "SELECT segid, te..." */ + ts+33880, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. @@ -191532,7 +197640,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 16 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*120), uintptr(0), bp+16 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+32613 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+33966 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fn, bp+32 /* &iOff */, bp+40 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) & int64(0x7FFFFFFF))) @@ -191943,7 +198051,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32618 /* "recursively defi..." */, 0) + ts+33971 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -191977,7 +198085,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4485 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4500 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -191993,7 +198101,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4485 /* "%d" */, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4500 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -192336,7 +198444,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -192368,7 +198476,7 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -192407,25 +198515,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+32657, /* "SELECT rowid, ra..." */ + ts+34010, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 13720 /* ", " */ + return ts + 13735 /* ", " */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 32712 /* "DESC" */ + return ts + 34065 /* "DESC" */ } - return ts + 32717 /* "ASC" */ + return ts + 34070 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -192476,13 +198584,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+32721 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+34074 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4567 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4582 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32727 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+34080 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -192517,7 +198625,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+32755 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+34108 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, @@ -192549,7 +198657,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32765 /* "no such function..." */, libc.VaList(bp+8, zRank)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+34118 /* "no such function..." */, libc.VaList(bp+8, zRank)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } @@ -192581,14 +198689,14 @@ func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uin *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+32786 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+34139 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 31169 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32522 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -192654,7 +198762,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32618 /* "recursively defi..." */, 0) + ts+33971 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -192700,7 +198808,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 741 /* "" */ + zText = ts + 756 /* "" */ __14: ; iCol = 0 @@ -192889,7 +198997,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32819 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+34172 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -193026,7 +199134,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+2778 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+2793 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -193063,29 +199171,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+32855 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+34208 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+32866 /* "'delete-all' may..." */, 0) + ts+34219 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+32946 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+34299 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+32954 /* "'rebuild' may no..." */, 0) + ts+34307 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+15843 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+15858 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+33010 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+34363 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+33016 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+34369 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -193159,7 +199267,7 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+16382 /* "delete" */, z)) { + (0 == Xsqlite3_stricmp(tls, ts+16397 /* "delete" */, z)) { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) @@ -193184,12 +199292,12 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+33032, /* "cannot %s conten..." */ + ts+34385, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 19224 /* "UPDATE" */ + return ts + 19239 /* "UPDATE" */ } - return ts + 33069 /* "DELETE from" */ + return ts + 34422 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { @@ -193859,7 +199967,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+33081 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+34434 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -194164,7 +200272,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33102 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34455 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 16 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -194181,7 +200289,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 16 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33124 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34477 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -194228,7 +200336,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+33155 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34508 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -194239,7 +200347,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+33168 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+34521 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -194255,7 +200363,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 33259 /* "config" */, ts + 31358 /* "content" */, ts + 23759 /* "data" */, ts + 31709 /* "docsize" */, ts + 10608, /* "idx" */ + ts + 34612 /* "config" */, ts + 32711 /* "content" */, ts + 23774 /* "data" */, ts + 33062 /* "docsize" */, ts + 10623, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -194279,7 +200387,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+33266 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+34619 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -194297,13 +200405,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+33266 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34619 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+33271 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34624 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -194369,20 +200477,20 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ - ts + 33286, /* "SELECT %s FROM %..." */ - ts + 33354, /* "SELECT %s FROM %..." */ - ts + 33423, /* "SELECT %s FROM %..." */ // LOOKUP + ts + 34639, /* "SELECT %s FROM %..." */ + ts + 34707, /* "SELECT %s FROM %..." */ + ts + 34776, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 33456, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 33495, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 33535, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 33574, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 33615, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 34809, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34848, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34888, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34927, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34968, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 33654, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 35007, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 33696, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 33736, /* "SELECT %s FROM %..." */ // SCAN + ts + 35049, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 35089, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) @@ -194449,7 +200557,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2778 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2793 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -194487,18 +200595,18 @@ func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230 var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33759, /* "DROP TABLE IF EX..." */ + ts+35112, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33863, /* "DROP TABLE IF EX..." */ + ts+35216, /* "DROP TABLE IF EX..." */ libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33901, /* "DROP TABLE IF EX..." */ + ts+35254, /* "DROP TABLE IF EX..." */ libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc @@ -194510,7 +200618,7 @@ func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uin if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33939, /* "ALTER TABLE %Q.'..." */ + ts+35292, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -194522,14 +200630,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23759 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10608 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+33259 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23774 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10623 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34612 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31709 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+33062 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31358 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32711 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -194543,17 +200651,17 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn var rc int32 *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+33981, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+35334, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 28374 /* " WITHOUT ROWID" */ + return ts + 28389 /* " WITHOUT ROWID" */ } - return ts + 741 /* "" */ + return ts + 756 /* "" */ }())) if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+34011, /* "fts5: error crea..." */ + ts+35364, /* "fts5: error crea..." */ libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } @@ -194595,27 +200703,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34055 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+35408 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34078 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+35431 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+31358 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32711 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+31709 /* "docsize" */, ts+34084 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+33062 /* "docsize" */, ts+35437 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+33259 /* "config" */, ts+34116 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+34612 /* "config" */, ts+35469 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31855 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+33208 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -194852,12 +200960,12 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34133, /* "DELETE FROM %Q.'..." */ + ts+35486, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34183, /* "DELETE FROM %Q.'..." */ + ts+35536, /* "DELETE FROM %Q.'..." */ libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } @@ -194867,7 +200975,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31855 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+33208 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -195062,7 +201170,7 @@ func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+34212, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+35565, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -195259,14 +201367,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31358 /* "content" */, bp+48 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32711 /* "content" */, bp+48 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31709 /* "docsize" */, bp+56 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+33062 /* "docsize" */, bp+56 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -195502,9 +201610,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.X__builtin___memcpy_chk(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint64(unsafe.Sizeof(aAsciiTokenChar)), libc.X__builtin_object_size(tls, p /* &.aTokenChar */, 0)) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34244 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35597 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34255 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35608 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -195744,7 +201852,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 34266 /* "L* N* Co" */ + var zCat uintptr = ts + 35619 /* "L* N* Co" */ var i int32 libc.X__builtin___memset_chk(tls, p, 0, uint64(unsafe.Sizeof(Unicode61Tokenizer{})), libc.X__builtin_object_size(tls, p, 0)) @@ -195757,7 +201865,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34275 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35628 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) } } @@ -195768,18 +201876,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34286 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35639 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34244 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35597 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34255 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35608 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34275 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35628 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -196091,7 +202199,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 34304 /* "unicode61" */ + var zBase uintptr = ts + 35657 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -196244,7 +202352,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34314 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35667 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -196252,11 +202360,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34317 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35670 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34322 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35675 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -196264,7 +202372,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34327 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35680 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -196272,7 +202380,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34330 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35683 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -196280,11 +202388,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34333 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35686 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34338 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35691 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -196292,19 +202400,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34343 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35696 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34347 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35700 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34353 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35706 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34358 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35711 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196312,11 +202420,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34362 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35715 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34366 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35719 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -196324,7 +202432,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34369 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35722 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196332,11 +202440,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34373 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35726 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34377 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35730 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196344,7 +202452,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34381 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35734 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196352,7 +202460,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34385 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35738 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196360,7 +202468,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34389 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35742 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196377,24 +202485,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34393 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35746 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34396 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+34399 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35749 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+35752 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34403 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+34389 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35756 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 2))), ts+35742 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-2))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -196410,137 +202518,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34406 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35759 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34414 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35767 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+34421 /* "tion" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+35774 /* "tion" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34426 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35779 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34322 /* "ence" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35675 /* "ence" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34431 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35784 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34317 /* "ance" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35670 /* "ance" */, uint64(4), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34436 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35789 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34389 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35742 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34441 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35794 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+15177 /* "log" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+15192 /* "log" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34446 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35799 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+34399 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+35752 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34450 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35803 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34455 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35808 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34358 /* "ent" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35711 /* "ent" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34461 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35814 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+34465 /* "e" */, uint64(1), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+35818 /* "e" */, uint64(1), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34467 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35820 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34381 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35734 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34473 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35826 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34389 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35742 /* "ize" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34481 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35834 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34487 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35840 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34373 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35726 /* "ate" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34492 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35845 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34498 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35851 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34385 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35738 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34506 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35859 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34514 /* "ful" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35867 /* "ful" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34518 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35871 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+34381 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 7))), ts+35734 /* "ous" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-7))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34526 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35879 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34532 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35885 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34385 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35738 /* "ive" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34538 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35891 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+34399 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 6))), ts+35752 /* "ble" */, uint64(3), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-6))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -196556,16 +202664,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34545 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35898 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+34330 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 4))), ts+35683 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-4))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34550 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35903 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -196573,21 +202681,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34555 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35908 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34330 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35683 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34561 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35914 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34330 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35683 /* "ic" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34514 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35867 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -196595,7 +202703,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34567 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35920 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -196603,9 +202711,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34573 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35926 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+34314 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 5))), ts+35667 /* "al" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-5))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -196621,12 +202729,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34579 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35932 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+34583 /* "ee" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) + libc.X__builtin___memcpy_chk(tls, (aBuf + uintptr((nBuf - 3))), ts+35936 /* "ee" */, uint64(2), libc.X__builtin_object_size(tls, (aBuf+uintptr((nBuf-3))), 0)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34586 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35939 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -196635,7 +202743,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34589 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35942 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -196805,7 +202913,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34593 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35946 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -196995,22 +203103,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(128) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 34304 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35657 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 34608 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35961 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 34614 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35967 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 34621 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35974 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -198357,14 +204465,14 @@ func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uint var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+34629 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+35982 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+34633 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35986 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+34637 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35990 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34646 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35999 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) @@ -198411,19 +204519,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(36) *(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azSchema */)) = [3]uintptr{ - ts + 34680, /* "CREATE TABlE voc..." */ - ts + 34720, /* "CREATE TABlE voc..." */ - ts + 34755, /* "CREATE TABlE voc..." */ + ts + 36033, /* "CREATE TABlE voc..." */ + ts + 36073, /* "CREATE TABlE voc..." */ + ts + 36108, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+22068 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+22083 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34798 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+36151 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -198575,11 +204683,11 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34831 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+36184 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ - ts+34862, /* "SELECT t.%Q FROM..." */ + ts+36215, /* "SELECT t.%Q FROM..." */ libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+72 /* &pStmt */, uintptr(0)) @@ -198603,7 +204711,7 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34913 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+36266 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { @@ -198891,7 +204999,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 741 /* "" */ + zCopy = ts + 756 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -199008,7 +205116,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+34939 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+36292 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -199053,7 +205161,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 34949 /* "2021-06-18 18:36..." */ + return ts + 36302 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -200107,5 +206215,5 @@ func init() { *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 128 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: } -var ts1 = "COMPILER=gcc-11.1.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00nfs\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00dylib\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=gcc-11.1.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00S\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00nfs\x00hfs\x00ufs\x00afpfs\x00smbfs\x00webdav\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00msdos\x00exfat\x00SQLITE_FORCE_PROXY_LOCKING\x00:auto:\x00fsync\x00/dev/urandom\x00sqliteplocks\x00/\x00dummy\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00break\x00path error (len %d)\x00read error (len %d)\x00create failed (%d)\x00write failed (%d)\x00rename failed (%d)\x00broke stale lock on %s\n\x00failed to break stale lock on %s, %s\n\x00-conch\x00.lock\x00:auto: (not held)\x00unix\x00unix-none\x00unix-dotfile\x00unix-posix\x00unix-flock\x00unix-afp\x00unix-nfs\x00unix-proxy\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00dylib\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00lock_proxy_file\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00failed to set lock proxy file\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go new file mode 100644 index 00000000..9bb7f6c5 --- /dev/null +++ b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go @@ -0,0 +1,189969 @@ +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_freebsd_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. + +package sqlite3 + +import ( + "math" + "reflect" + "sync/atomic" + "unsafe" + + "modernc.org/libc" + "modernc.org/libc/sys/types" +) + +var _ = math.Pi +var _ reflect.Kind +var _ atomic.Value +var _ unsafe.Pointer +var _ types.Size_t + +const ( + ALT_SCHEMA_TABLE = "sqlite_schema" + ALT_TEMP_SCHEMA_TABLE = "sqlite_temp_schema" + BITVEC_SZ = 512 + BITVEC_SZELEM = 8 + BTALLOC_ANY = 0 + BTALLOC_EXACT = 1 + BTALLOC_LE = 2 + BTCF_AtLast = 0x08 + BTCF_Incrblob = 0x10 + BTCF_Multiple = 0x20 + BTCF_Pinned = 0x40 + BTCF_ValidNKey = 0x02 + BTCF_ValidOvfl = 0x04 + BTCF_WriteFlag = 0x01 + BTCURSOR_MAX_DEPTH = 20 + BTREE_APPEND = 0x08 + BTREE_APPLICATION_ID = 8 + BTREE_AUTOVACUUM_FULL = 1 + BTREE_AUTOVACUUM_INCR = 2 + BTREE_AUTOVACUUM_NONE = 0 + BTREE_AUXDELETE = 0x04 + BTREE_BLOBKEY = 2 + BTREE_BULKLOAD = 0x00000001 + BTREE_DATA_VERSION = 15 + BTREE_DEFAULT_CACHE_SIZE = 3 + BTREE_FILE_FORMAT = 2 + BTREE_FORDELETE = 0x00000008 + BTREE_FREE_PAGE_COUNT = 0 + BTREE_HINT_RANGE = 0 + BTREE_INCR_VACUUM = 7 + BTREE_INTKEY = 1 + BTREE_LARGEST_ROOT_PAGE = 4 + BTREE_MEMORY = 2 + BTREE_OMIT_JOURNAL = 1 + BTREE_PREFORMAT = 0x80 + BTREE_SAVEPOSITION = 0x02 + BTREE_SCHEMA_VERSION = 1 + BTREE_SEEK_EQ = 0x00000002 + BTREE_SINGLE = 4 + BTREE_TEXT_ENCODING = 5 + BTREE_UNORDERED = 8 + BTREE_USER_VERSION = 6 + BTREE_WRCSR = 0x00000004 + BTS_EXCLUSIVE = 0x0040 + BTS_FAST_SECURE = 0x000c + BTS_INITIALLY_EMPTY = 0x0010 + BTS_NO_WAL = 0x0020 + BTS_OVERWRITE = 0x0008 + BTS_PAGESIZE_FIXED = 0x0002 + BTS_PENDING = 0x0080 + BTS_READ_ONLY = 0x0001 + BTS_SECURE_DELETE = 0x0004 + BUFSIZ = 1024 + CACHE_STALE = 0 + CC_AND = 24 + CC_BANG = 15 + CC_BOM = 30 + CC_COMMA = 23 + CC_DIGIT = 3 + CC_DOLLAR = 4 + CC_DOT = 26 + CC_EQ = 14 + CC_GT = 13 + CC_ID = 27 + CC_ILLEGAL = 28 + CC_KYWD = 2 + CC_KYWD0 = 1 + CC_LP = 17 + CC_LT = 12 + CC_MINUS = 11 + CC_NUL = 29 + CC_PERCENT = 22 + CC_PIPE = 10 + CC_PLUS = 20 + CC_QUOTE = 8 + CC_QUOTE2 = 9 + CC_RP = 18 + CC_SEMI = 19 + CC_SLASH = 16 + CC_SPACE = 7 + CC_STAR = 21 + CC_TILDA = 25 + CC_VARALPHA = 5 + CC_VARNUM = 6 + CC_X = 0 + CKCNSTRNT_COLUMN = 0x01 + CKCNSTRNT_ROWID = 0x02 + CLOCKS_PER_SEC = 128 + CLOCK_MONOTONIC = 4 + CLOCK_MONOTONIC_FAST = 12 + CLOCK_MONOTONIC_PRECISE = 11 + CLOCK_PROCESS_CPUTIME_ID = 15 + CLOCK_PROF = 2 + CLOCK_REALTIME = 0 + CLOCK_REALTIME_FAST = 10 + CLOCK_REALTIME_PRECISE = 9 + CLOCK_SECOND = 13 + CLOCK_THREAD_CPUTIME_ID = 14 + CLOCK_UPTIME = 5 + CLOCK_UPTIME_FAST = 8 + CLOCK_UPTIME_PRECISE = 7 + CLOCK_VIRTUAL = 1 + COLFLAG_BUSY = 0x0100 + COLFLAG_GENERATED = 0x0060 + COLFLAG_HASTYPE = 0x0004 + COLFLAG_HIDDEN = 0x0002 + COLFLAG_NOINSERT = 0x0062 + COLFLAG_NOTAVAIL = 0x0080 + COLFLAG_PRIMKEY = 0x0001 + COLFLAG_SORTERREF = 0x0010 + COLFLAG_STORED = 0x0040 + COLFLAG_UNIQUE = 0x0008 + COLFLAG_VIRTUAL = 0x0020 + COLNAME_COLUMN = 4 + COLNAME_DATABASE = 2 + COLNAME_DECLTYPE = 1 + COLNAME_N = 5 + COLNAME_NAME = 0 + COLNAME_TABLE = 3 + CURSOR_FAULT = 4 + CURSOR_INVALID = 1 + CURSOR_REQUIRESEEK = 3 + CURSOR_SKIPNEXT = 2 + CURSOR_VALID = 0 + CURTYPE_BTREE = 0 + CURTYPE_PSEUDO = 3 + CURTYPE_SORTER = 1 + CURTYPE_VTAB = 2 + DBFLAG_EncodingFixed = 0x0040 + DBFLAG_InternalFunc = 0x0020 + DBFLAG_PreferBuiltin = 0x0002 + DBFLAG_SchemaChange = 0x0001 + DBFLAG_SchemaKnownOk = 0x0010 + DBFLAG_Vacuum = 0x0004 + DBFLAG_VacuumInto = 0x0008 + DB_ResetWanted = 0x0008 + DB_SchemaLoaded = 0x0001 + DB_UnresetViews = 0x0002 + DFLT_SCHEMA_TABLE = "sqlite_master" + DFLT_TEMP_SCHEMA_TABLE = "sqlite_temp_master" + DIRECT_MODE = 0 + DOTLOCK_SUFFIX = ".lock" + DST_AUST = 2 + DST_CAN = 6 + DST_EET = 5 + DST_MET = 4 + DST_NONE = 0 + DST_USA = 1 + DST_WET = 3 + E2BIG = 7 + EACCES = 13 + EADDRINUSE = 48 + EADDRNOTAVAIL = 49 + EAFNOSUPPORT = 47 + EAGAIN = 35 + EALREADY = 37 + EAUTH = 80 + EBADF = 9 + EBADMSG = 89 + EBADRPC = 72 + EBUSY = 16 + ECANCELED = 85 + ECAPMODE = 94 + ECHILD = 10 + ECONNABORTED = 53 + ECONNREFUSED = 61 + ECONNRESET = 54 + EDEADLK = 11 + EDESTADDRREQ = 39 + EDOM = 33 + EDOOFUS = 88 + EDQUOT = 69 + EEXIST = 17 + EFAULT = 14 + EFBIG = 27 + EFTYPE = 79 + EHOSTDOWN = 64 + EHOSTUNREACH = 65 + EIDRM = 82 + EILSEQ = 86 + EINPROGRESS = 36 + EINTEGRITY = 97 + EINTR = 4 + EINVAL = 22 + EIO = 5 + EISCONN = 56 + EISDIR = 21 + ELAST = 97 + ELOOP = 62 + EMFILE = 24 + EMLINK = 31 + EMSGSIZE = 40 + EMULTIHOP = 90 + ENAMETOOLONG = 63 + ENAME_NAME = 0 + ENAME_SPAN = 1 + ENAME_TAB = 2 + ENEEDAUTH = 81 + ENETDOWN = 50 + ENETRESET = 52 + ENETUNREACH = 51 + ENFILE = 23 + ENOATTR = 87 + ENOBUFS = 55 + ENODEV = 19 + ENOENT = 2 + ENOEXEC = 8 + ENOLCK = 77 + ENOLINK = 91 + ENOMEM = 12 + ENOMSG = 83 + ENOPROTOOPT = 42 + ENOSPC = 28 + ENOSYS = 78 + ENOTBLK = 15 + ENOTCAPABLE = 93 + ENOTCONN = 57 + ENOTDIR = 20 + ENOTEMPTY = 66 + ENOTRECOVERABLE = 95 + ENOTSOCK = 38 + ENOTSUP = 45 + ENOTTY = 25 + ENXIO = 6 + EOF = -1 + EOPNOTSUPP = 45 + EOVERFLOW = 84 + EOWNERDEAD = 96 + EPERM = 1 + EPFNOSUPPORT = 46 + EPIPE = 32 + EPROCLIM = 67 + EPROCUNAVAIL = 76 + EPROGMISMATCH = 75 + EPROGUNAVAIL = 74 + EPROTO = 92 + EPROTONOSUPPORT = 43 + EPROTOTYPE = 41 + EP_Agg = 0x000010 + EP_CanBeNull = 0x100000 + EP_Collate = 0x000100 + EP_Commuted = 0x000200 + EP_ConstFunc = 0x080000 + EP_DblQuoted = 0x000040 + EP_Distinct = 0x000002 + EP_FixedCol = 0x000008 + EP_FromDDL = 0x40000000 + EP_FromJoin = 0x000001 + EP_HasFunc = 0x000004 + EP_IfNullRow = 0x020000 + EP_Immutable = 0x02 + EP_InfixFunc = 0x000080 + EP_IntValue = 0x000400 + EP_IsFalse = 0x20000000 + EP_IsTrue = 0x10000000 + EP_Leaf = 0x800000 + EP_MemToken = 0x010000 + EP_NoReduce = 0x01 + EP_Propagate = 2097412 + EP_Quoted = 0x4000000 + EP_Reduced = 0x002000 + EP_Skip = 0x001000 + EP_Static = 0x8000000 + EP_Subquery = 0x200000 + EP_Subrtn = 0x2000000 + EP_TokenOnly = 0x004000 + EP_Unlikely = 0x040000 + EP_VarSelect = 0x000020 + EP_Win = 0x008000 + EP_WinFunc = 0x1000000 + EP_xIsSelect = 0x000800 + ERANGE = 34 + EREMOTE = 71 + EROFS = 30 + ERPCMISMATCH = 73 + ESHUTDOWN = 58 + ESOCKTNOSUPPORT = 44 + ESPIPE = 29 + ESRCH = 3 + ESTALE = 70 + ETIMEDOUT = 60 + ETOOMANYREFS = 59 + ETXTBSY = 26 + EUSERS = 68 + EWOULDBLOCK = 35 + EXCLUDED_TABLE_NUMBER = 2 + EXCLUSIVE_LOCK = 4 + EXDEV = 18 + EXIT_FAILURE = 1 + EXIT_SUCCESS = 0 + EXPRDUP_REDUCE = 0x0001 + FD_CLOEXEC = 1 + FD_SETSIZE = 1024 + FILENAME_MAX = 1024 + FLAG_SIGNED = 1 + FLAG_STRING = 4 + FOPEN_MAX = 20 + FP_FAST_FMAF = 1 + FP_ILOGB0 = -2147483647 + FP_ILOGBNAN = 2147483647 + FP_INFINITE = 0x01 + FP_NAN = 0x02 + FP_NORMAL = 0x04 + FP_SUBNORMAL = 0x08 + FP_ZERO = 0x10 + FTS5CSR_EOF = 0x01 + FTS5CSR_FREE_ZRANK = 0x10 + FTS5CSR_REQUIRE_CONTENT = 0x02 + FTS5CSR_REQUIRE_DOCSIZE = 0x04 + FTS5CSR_REQUIRE_INST = 0x08 + FTS5CSR_REQUIRE_POSLIST = 0x40 + FTS5CSR_REQUIRE_RESEEK = 0x20 + FTS5INDEX_QUERY_DESC = 0x0002 + FTS5INDEX_QUERY_NOOUTPUT = 0x0020 + FTS5INDEX_QUERY_PREFIX = 0x0001 + FTS5INDEX_QUERY_SCAN = 0x0008 + FTS5INDEX_QUERY_SKIPEMPTY = 0x0010 + FTS5INDEX_QUERY_TEST_NOIDX = 0x0004 + FTS5_AND = 2 + FTS5_AVERAGES_ROWID = 1 + FTS5_BI_MATCH = 0x0001 + FTS5_BI_ORDER_DESC = 0x0080 + FTS5_BI_ORDER_RANK = 0x0020 + FTS5_BI_ORDER_ROWID = 0x0040 + FTS5_BI_RANK = 0x0002 + FTS5_BI_ROWID_EQ = 0x0004 + FTS5_BI_ROWID_GE = 0x0010 + FTS5_BI_ROWID_LE = 0x0008 + FTS5_CARET = 12 + FTS5_COLON = 5 + FTS5_COMMA = 13 + FTS5_CONTENT_EXTERNAL = 2 + FTS5_CONTENT_NONE = 1 + FTS5_CONTENT_NORMAL = 0 + FTS5_CORRUPT = 267 + FTS5_CURRENT_VERSION = 4 + FTS5_DATA_DLI_B = 1 + FTS5_DATA_HEIGHT_B = 5 + FTS5_DATA_ID_B = 16 + FTS5_DATA_PADDING = 20 + FTS5_DATA_PAGE_B = 31 + FTS5_DATA_ZERO_PADDING = 8 + FTS5_DEFAULT_AUTOMERGE = 4 + FTS5_DEFAULT_CRISISMERGE = 16 + FTS5_DEFAULT_HASHSIZE = 1048576 + FTS5_DEFAULT_NEARDIST = 10 + FTS5_DEFAULT_PAGE_SIZE = 4050 + FTS5_DEFAULT_RANK = "bm25" + FTS5_DEFAULT_USERMERGE = 4 + FTS5_DETAIL_COLUMNS = 2 + FTS5_DETAIL_FULL = 0 + FTS5_DETAIL_NONE = 1 + FTS5_EOF = 0 + FTS5_LCP = 7 + FTS5_LP = 10 + FTS5_MAIN_PREFIX = 48 + FTS5_MAX_PAGE_SIZE = 65536 + FTS5_MAX_PREFIX_INDEXES = 31 + FTS5_MAX_SEGMENT = 2000 + FTS5_MAX_TOKEN_SIZE = 32768 + FTS5_MERGE_NLIST = 16 + FTS5_MINUS = 6 + FTS5_MIN_DLIDX_SIZE = 4 + FTS5_NOT = 3 + FTS5_OPT_WORK_UNIT = 1000 + FTS5_OR = 1 + FTS5_PATTERN_GLOB = 66 + FTS5_PATTERN_LIKE = 65 + FTS5_PATTERN_NONE = 0 + FTS5_PLAN_MATCH = 1 + FTS5_PLAN_ROWID = 6 + FTS5_PLAN_SCAN = 5 + FTS5_PLAN_SORTED_MATCH = 4 + FTS5_PLAN_SOURCE = 2 + FTS5_PLAN_SPECIAL = 3 + FTS5_PLUS = 14 + FTS5_PORTER_MAX_TOKEN = 64 + FTS5_RANK_NAME = "rank" + FTS5_RCP = 8 + FTS5_REMOVE_DIACRITICS_COMPLEX = 2 + FTS5_REMOVE_DIACRITICS_NONE = 0 + FTS5_REMOVE_DIACRITICS_SIMPLE = 1 + FTS5_ROWID_NAME = "rowid" + FTS5_RP = 11 + FTS5_SEGITER_ONETERM = 0x01 + FTS5_SEGITER_REVERSE = 0x02 + FTS5_STAR = 15 + FTS5_STMT_DELETE_CONTENT = 5 + FTS5_STMT_DELETE_DOCSIZE = 7 + FTS5_STMT_INSERT_CONTENT = 3 + FTS5_STMT_LOOKUP = 2 + FTS5_STMT_LOOKUP_DOCSIZE = 8 + FTS5_STMT_REPLACE_CONFIG = 9 + FTS5_STMT_REPLACE_CONTENT = 4 + FTS5_STMT_REPLACE_DOCSIZE = 6 + FTS5_STMT_SCAN = 10 + FTS5_STMT_SCAN_ASC = 0 + FTS5_STMT_SCAN_DESC = 1 + FTS5_STRING = 9 + FTS5_STRUCTURE_ROWID = 10 + FTS5_TERM = 4 + FTS5_TOKENIZE_AUX = 0x0008 + FTS5_TOKENIZE_DOCUMENT = 0x0004 + FTS5_TOKENIZE_PREFIX = 0x0002 + FTS5_TOKENIZE_QUERY = 0x0001 + FTS5_TOKEN_COLOCATED = 0x0001 + FTS5_VOCAB_COL = 0 + FTS5_VOCAB_COL_SCHEMA = "term, col, doc, cnt" + FTS5_VOCAB_INSTANCE = 2 + FTS5_VOCAB_INST_SCHEMA = "term, doc, col, offset" + FTS5_VOCAB_ROW = 1 + FTS5_VOCAB_ROW_SCHEMA = "term, doc, cnt" + FTS5_VOCAB_TERM_EQ = 0x01 + FTS5_VOCAB_TERM_GE = 0x02 + FTS5_VOCAB_TERM_LE = 0x04 + FTS5_WORK_UNIT = 64 + FULLY_WITHIN = 2 + FUNC_PERFECT_MATCH = 6 + F_DUPFD = 0 + F_GETFD = 1 + F_GETFL = 3 + F_GETLK = 11 + F_GETOWN = 5 + F_LOCK = 1 + F_OK = 0 + F_RDLCK = 1 + F_SETFD = 2 + F_SETFL = 4 + F_SETLK = 12 + F_SETLKW = 13 + F_SETOWN = 6 + F_TEST = 3 + F_TLOCK = 2 + F_ULOCK = 0 + F_UNLCK = 2 + F_WRLCK = 3 + GCC_VERSION = 10003000 + GEOPOLY_PI = 3.1415926535897932385 + H4DISC = 7 + HASHSIZE = 97 + HASHTABLE_HASH_1 = 383 + HASHTABLE_NPAGE = 4096 + HASHTABLE_NSLOT = 8192 + HAVE_FCHOWN = 1 + HAVE_FULLFSYNC = 0 + HAVE_GETHOSTUUID = 0 + HAVE_LSTAT = 1 + HAVE_MREMAP = 0 + HAVE_READLINK = 1 + HAVE_USLEEP = 1 + INCRINIT_NORMAL = 0 + INCRINIT_ROOT = 2 + INCRINIT_TASK = 1 + INITFLAG_AlterDrop = 0x0002 + INITFLAG_AlterRename = 0x0001 + INLINEFUNC_affinity = 4 + INLINEFUNC_coalesce = 0 + INLINEFUNC_expr_compare = 3 + INLINEFUNC_expr_implies_expr = 2 + INLINEFUNC_iif = 5 + INLINEFUNC_implies_nonnull_row = 1 + INLINEFUNC_unlikely = 99 + INTERFACE = 1 + IN_INDEX_EPH = 2 + IN_INDEX_INDEX_ASC = 3 + IN_INDEX_INDEX_DESC = 4 + IN_INDEX_LOOP = 0x0004 + IN_INDEX_MEMBERSHIP = 0x0002 + IN_INDEX_NOOP = 5 + IN_INDEX_NOOP_OK = 0x0001 + IN_INDEX_ROWID = 1 + IOCPARM_MASK = 8191 + IOCPARM_MAX = 8192 + IOCPARM_SHIFT = 13 + IOC_DIRMASK = 3758096384 + IOC_IN = 0x80000000 + IOC_INOUT = 3221225472 + IOC_OUT = 0x40000000 + IOC_VOID = 0x20000000 + ITIMER_PROF = 2 + ITIMER_REAL = 0 + ITIMER_VIRTUAL = 1 + IsStat4 = 1 + JEACH_ATOM = 3 + JEACH_FULLKEY = 6 + JEACH_ID = 4 + JEACH_JSON = 8 + JEACH_KEY = 0 + JEACH_PARENT = 5 + JEACH_PATH = 7 + JEACH_ROOT = 9 + JEACH_TYPE = 2 + JEACH_VALUE = 1 + JNODE_APPEND = 0x20 + JNODE_ESCAPE = 0x02 + JNODE_LABEL = 0x40 + JNODE_PATCH = 0x10 + JNODE_RAW = 0x01 + JNODE_REMOVE = 0x04 + JNODE_REPLACE = 0x08 + JSON_ARRAY = 6 + JSON_CACHE_ID = -429938 + JSON_CACHE_SZ = 4 + JSON_FALSE = 2 + JSON_INT = 3 + JSON_MAX_DEPTH = 2000 + JSON_NULL = 0 + JSON_OBJECT = 7 + JSON_REAL = 4 + JSON_STRING = 5 + JSON_SUBTYPE = 74 + JSON_TRUE = 1 + JT_CROSS = 0x0002 + JT_ERROR = 0x0040 + JT_INNER = 0x0001 + JT_LEFT = 0x0008 + JT_NATURAL = 0x0004 + JT_OUTER = 0x0020 + JT_RIGHT = 0x0010 + KEYINFO_ORDER_BIGNULL = 0x02 + KEYINFO_ORDER_DESC = 0x01 + LOCATE_NOERR = 0x02 + LOCATE_VIEW = 0x01 + LOOKASIDE_SMALL = 128 + L_INCR = 1 + L_SET = 0 + L_XTND = 2 + L_ctermid = 1024 + L_tmpnam = 1024 + M10d_Any = 1 + M10d_No = 2 + M10d_Yes = 0 + MAP_FIXED = 0x0010 + MAP_PRIVATE = 0x0002 + MAP_SHARED = 0x0001 + MATH_ERREXCEPT = 2 + MATH_ERRNO = 1 + MAX_PATHNAME = 512 + MAX_SECTOR_SIZE = 0x10000 + MCL_CURRENT = 0x0001 + MCL_FUTURE = 0x0002 + MEMJOURNAL_DFLT_FILECHUNKSIZE = 1024 + MEMTYPE_HEAP = 0x01 + MEMTYPE_LOOKASIDE = 0x02 + MEMTYPE_PCACHE = 0x04 + MEM_AffMask = 0x003f + MEM_Agg = 0x2000 + MEM_Blob = 0x0010 + MEM_Cleared = 0x0100 + MEM_Dyn = 0x0400 + MEM_Ephem = 0x1000 + MEM_FromBind = 0x0040 + MEM_Int = 0x0004 + MEM_IntReal = 0x0020 + MEM_Null = 0x0001 + MEM_Real = 0x0008 + MEM_Static = 0x0800 + MEM_Str = 0x0002 + MEM_Subtype = 0x8000 + MEM_Term = 0x0200 + MEM_TypeMask = 0xc1bf + MEM_Undefined = 0x0080 + MEM_Zero = 0x4000 + MSVC_VERSION = 0 + MS_ASYNC = 0x0001 + MS_INVALIDATE = 0x0002 + MS_SYNC = 0x0000 + M_1_PI = 0.31830988618379067154 + M_2_PI = 0.63661977236758134308 + M_2_SQRTPI = 1.12837916709551257390 + M_E = 2.7182818284590452354 + M_LN10 = 2.30258509299404568402 + M_LN2 = 0.69314718055994530942 + M_LOG10E = 0.43429448190325182765 + M_LOG2E = 1.4426950408889634074 + M_PI = 3.14159265358979323846 + M_PI_2 = 1.57079632679489661923 + M_PI_4 = 0.78539816339744830962 + M_SQRT1_2 = 0.70710678118654752440 + M_SQRT2 = 1.41421356237309504880 + NB = 3 + NC_AllowAgg = 0x00001 + NC_AllowWin = 0x04000 + NC_Complex = 0x02000 + NC_FromDDL = 0x40000 + NC_GenCol = 0x00008 + NC_HasAgg = 0x00010 + NC_HasWin = 0x08000 + NC_IdxExpr = 0x00020 + NC_InAggFunc = 0x20000 + NC_IsCheck = 0x00004 + NC_IsDDL = 0x10000 + NC_MinMaxAgg = 0x01000 + NC_NoSelect = 0x80000 + NC_PartIdx = 0x00002 + NC_SelfRef = 0x0002e + NC_UAggInfo = 0x00100 + NC_UBaseReg = 0x00400 + NC_UEList = 0x00080 + NC_UUpsert = 0x00200 + NC_VarSelect = 0x00040 + NDEBUG = 1 + NETGRAPHDISC = 6 + NN = 1 + NOT_WITHIN = 0 + NO_LOCK = 0 + N_OR_COST = 3 + N_SORT_BUCKET = 32 + N_STATEMENT = 8 + OE_Abort = 2 + OE_Cascade = 10 + OE_Default = 11 + OE_Fail = 3 + OE_Ignore = 4 + OE_None = 0 + OE_Replace = 5 + OE_Restrict = 7 + OE_Rollback = 1 + OE_SetDflt = 9 + OE_SetNull = 8 + OE_Update = 6 + OMIT_TEMPDB = 0 + ONEPASS_MULTI = 2 + ONEPASS_OFF = 0 + ONEPASS_SINGLE = 1 + OPFLAG_APPEND = 0x08 + OPFLAG_AUXDELETE = 0x04 + OPFLAG_BULKCSR = 0x01 + OPFLAG_EPHEM = 0x01 + OPFLAG_FORDELETE = 0x08 + OPFLAG_ISNOOP = 0x40 + OPFLAG_ISUPDATE = 0x04 + OPFLAG_LASTROWID = 0x20 + OPFLAG_LENGTHARG = 0x40 + OPFLAG_NCHANGE = 0x01 + OPFLAG_NOCHNG = 0x01 + OPFLAG_NOCHNG_MAGIC = 0x6d + OPFLAG_P2ISREG = 0x10 + OPFLAG_PERMUTE = 0x01 + OPFLAG_PREFORMAT = 0x80 + OPFLAG_SAVEPOSITION = 0x02 + OPFLAG_SEEKEQ = 0x02 + OPFLAG_TYPEOFARG = 0x80 + OPFLAG_USESEEKRESULT = 0x10 + OPFLG_IN1 = 0x02 + OPFLG_IN2 = 0x04 + OPFLG_IN3 = 0x08 + OPFLG_JUMP = 0x01 + OPFLG_OUT2 = 0x10 + OPFLG_OUT3 = 0x20 + OP_Abortable = 179 + OP_Add = 106 + OP_AddImm = 83 + OP_Affinity = 92 + OP_AggFinal = 161 + OP_AggInverse = 157 + OP_AggStep = 158 + OP_AggStep1 = 159 + OP_AggValue = 160 + OP_And = 44 + OP_AutoCommit = 1 + OP_BitAnd = 102 + OP_BitNot = 113 + OP_BitOr = 103 + OP_Blob = 74 + OP_Cast = 85 + OP_Checkpoint = 6 + OP_ChngCntRow = 80 + OP_Clear = 141 + OP_Close = 118 + OP_CollSeq = 82 + OP_Column = 91 + OP_ColumnsUsed = 119 + OP_Compare = 87 + OP_Concat = 111 + OP_Copy = 77 + OP_Count = 94 + OP_CreateBtree = 143 + OP_CursorHint = 175 + OP_CursorLock = 163 + OP_CursorUnlock = 164 + OP_DecrJumpZero = 59 + OP_DeferredSeek = 137 + OP_Delete = 126 + OP_Destroy = 140 + OP_Divide = 109 + OP_DropIndex = 148 + OP_DropTable = 147 + OP_DropTrigger = 149 + OP_ElseEq = 58 + OP_EndCoroutine = 66 + OP_Eq = 53 + OP_Expire = 162 + OP_Explain = 178 + OP_FinishSeek = 139 + OP_FkCounter = 154 + OP_FkIfZero = 47 + OP_Found = 30 + OP_Function = 64 + OP_Ge = 57 + OP_Gosub = 12 + OP_Goto = 11 + OP_Gt = 54 + OP_Halt = 68 + OP_HaltIfNull = 67 + OP_IdxDelete = 136 + OP_IdxGE = 41 + OP_IdxGT = 39 + OP_IdxInsert = 134 + OP_IdxLE = 38 + OP_IdxLT = 40 + OP_IdxRowid = 138 + OP_If = 18 + OP_IfNoHope = 27 + OP_IfNot = 20 + OP_IfNotOpen = 26 + OP_IfNotZero = 49 + OP_IfNullRow = 21 + OP_IfPos = 48 + OP_IfSmaller = 34 + OP_IncrVacuum = 60 + OP_Init = 62 + OP_InitCoroutine = 13 + OP_Insert = 124 + OP_Int64 = 70 + OP_IntCopy = 79 + OP_Integer = 69 + OP_IntegrityCk = 150 + OP_IsNull = 50 + OP_IsTrue = 88 + OP_JournalMode = 7 + OP_Jump = 16 + OP_Last = 33 + OP_Le = 55 + OP_LoadAnalysis = 146 + OP_Lt = 56 + OP_MakeRecord = 93 + OP_MaxPgcnt = 173 + OP_MemMax = 155 + OP_Move = 76 + OP_Multiply = 108 + OP_MustBeInt = 15 + OP_Ne = 52 + OP_NewRowid = 123 + OP_Next = 5 + OP_NoConflict = 28 + OP_Noop = 177 + OP_Not = 19 + OP_NotExists = 32 + OP_NotFound = 29 + OP_NotNull = 51 + OP_Null = 72 + OP_NullRow = 132 + OP_Offset = 90 + OP_OffsetLimit = 156 + OP_Once = 17 + OP_OpenAutoindex = 101 + OP_OpenDup = 100 + OP_OpenEphemeral = 112 + OP_OpenPseudo = 117 + OP_OpenRead = 98 + OP_OpenWrite = 99 + OP_Or = 43 + OP_Pagecount = 172 + OP_Param = 153 + OP_ParseSchema = 145 + OP_Permutation = 86 + OP_Prev = 4 + OP_Program = 46 + OP_PureFunc = 63 + OP_ReadCookie = 95 + OP_Real = 152 + OP_RealAffinity = 84 + OP_ReleaseReg = 176 + OP_Remainder = 110 + OP_ReopenIdx = 97 + OP_ResetCount = 127 + OP_ResetSorter = 142 + OP_ResultRow = 81 + OP_Return = 65 + OP_Rewind = 37 + OP_RowCell = 125 + OP_RowData = 130 + OP_RowSetAdd = 151 + OP_RowSetRead = 42 + OP_RowSetTest = 45 + OP_Rowid = 131 + OP_SCopy = 78 + OP_Savepoint = 0 + OP_SeekEnd = 133 + OP_SeekGE = 24 + OP_SeekGT = 25 + OP_SeekHit = 121 + OP_SeekLE = 23 + OP_SeekLT = 22 + OP_SeekRowid = 31 + OP_SeekScan = 120 + OP_Sequence = 122 + OP_SequenceTest = 115 + OP_SetCookie = 96 + OP_ShiftLeft = 104 + OP_ShiftRight = 105 + OP_SoftNull = 73 + OP_Sort = 36 + OP_SorterCompare = 128 + OP_SorterData = 129 + OP_SorterInsert = 135 + OP_SorterNext = 3 + OP_SorterOpen = 114 + OP_SorterSort = 35 + OP_SqlExec = 144 + OP_String = 71 + OP_String8 = 116 + OP_Subtract = 107 + OP_TableLock = 165 + OP_Trace = 174 + OP_Transaction = 2 + OP_VBegin = 166 + OP_VColumn = 170 + OP_VCreate = 167 + OP_VDestroy = 168 + OP_VFilter = 9 + OP_VNext = 61 + OP_VOpen = 169 + OP_VRename = 171 + OP_VUpdate = 10 + OP_Vacuum = 8 + OP_Variable = 75 + OP_Yield = 14 + OP_ZeroOrNull = 89 + OS_VXWORKS = 0 + O_ACCMODE = 0x0003 + O_APPEND = 0x0008 + O_BINARY = 0 + O_CREAT = 0x0200 + O_DSYNC = 0x01000000 + O_EXCL = 0x0800 + O_LARGEFILE = 0 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0 + O_NONBLOCK = 0x0004 + O_RDONLY = 0x0000 + O_RDWR = 0x0002 + O_SYNC = 0x0080 + O_TRUNC = 0x0400 + O_WRONLY = 0x0001 + P4_ADVANCE = -5 + P4_COLLSEQ = -2 + P4_DYNAMIC = -7 + P4_DYNBLOB = -17 + P4_EXPR = -10 + P4_FREE_IF_LE = -7 + P4_FUNCCTX = -16 + P4_FUNCDEF = -8 + P4_INT32 = -3 + P4_INT64 = -14 + P4_INTARRAY = -15 + P4_KEYINFO = -9 + P4_MEM = -11 + P4_NOTUSED = 0 + P4_REAL = -13 + P4_STATIC = -1 + P4_SUBPROGRAM = -4 + P4_TABLE = -6 + P4_TRANSIENT = 0 + P4_VTAB = -12 + P5_ConstraintCheck = 3 + P5_ConstraintFK = 4 + P5_ConstraintNotNull = 1 + P5_ConstraintUnique = 2 + PAGER_CACHESPILL = 0x20 + PAGER_CKPT_FULLFSYNC = 0x10 + PAGER_ERROR = 6 + PAGER_FLAGS_MASK = 0x38 + PAGER_FULLFSYNC = 0x08 + PAGER_GET_NOCONTENT = 0x01 + PAGER_GET_READONLY = 0x02 + PAGER_JOURNALMODE_DELETE = 0 + PAGER_JOURNALMODE_MEMORY = 4 + PAGER_JOURNALMODE_OFF = 2 + PAGER_JOURNALMODE_PERSIST = 1 + PAGER_JOURNALMODE_QUERY = -1 + PAGER_JOURNALMODE_TRUNCATE = 3 + PAGER_JOURNALMODE_WAL = 5 + PAGER_LOCKINGMODE_EXCLUSIVE = 1 + PAGER_LOCKINGMODE_NORMAL = 0 + PAGER_LOCKINGMODE_QUERY = -1 + PAGER_MEMORY = 0x0002 + PAGER_OMIT_JOURNAL = 0x0001 + PAGER_OPEN = 0 + PAGER_READER = 1 + PAGER_STAT_HIT = 0 + PAGER_STAT_MISS = 1 + PAGER_STAT_SPILL = 3 + PAGER_STAT_WRITE = 2 + PAGER_SYNCHRONOUS_EXTRA = 0x04 + PAGER_SYNCHRONOUS_FULL = 0x03 + PAGER_SYNCHRONOUS_MASK = 0x07 + PAGER_SYNCHRONOUS_NORMAL = 0x02 + PAGER_SYNCHRONOUS_OFF = 0x01 + PAGER_WRITER_CACHEMOD = 3 + PAGER_WRITER_DBMOD = 4 + PAGER_WRITER_FINISHED = 5 + PAGER_WRITER_LOCKED = 2 + PARSE_MODE_DECLARE_VTAB = 1 + PARSE_MODE_NORMAL = 0 + PARSE_MODE_RENAME = 2 + PARSE_MODE_UNMAP = 3 + PARTLY_WITHIN = 1 + PCACHE1_MIGHT_USE_GROUP_MUTEX = 1 + PCACHE_DIRTYLIST_ADD = 2 + PCACHE_DIRTYLIST_FRONT = 3 + PCACHE_DIRTYLIST_REMOVE = 1 + PENDING_LOCK = 3 + PGHDR_CLEAN = 0x001 + PGHDR_DIRTY = 0x002 + PGHDR_DONT_WRITE = 0x010 + PGHDR_MMAP = 0x020 + PGHDR_NEED_SYNC = 0x008 + PGHDR_WAL_APPEND = 0x040 + PGHDR_WRITEABLE = 0x004 + POSIX_FADV_DONTNEED = 4 + POSIX_FADV_NOREUSE = 5 + POSIX_FADV_NORMAL = 0 + POSIX_FADV_RANDOM = 1 + POSIX_FADV_SEQUENTIAL = 2 + POSIX_FADV_WILLNEED = 3 + POSIX_MADV_DONTNEED = 4 + POSIX_MADV_NORMAL = 0 + POSIX_MADV_RANDOM = 1 + POSIX_MADV_SEQUENTIAL = 2 + POSIX_MADV_WILLNEED = 3 + PPPDISC = 5 + PROT_EXEC = 0x04 + PROT_NONE = 0x00 + PROT_READ = 0x01 + PROT_WRITE = 0x02 + PTF_INTKEY = 0x01 + PTF_LEAF = 0x08 + PTF_LEAFDATA = 0x04 + PTF_ZERODATA = 0x02 + PTRMAP_BTREE = 5 + PTRMAP_FREEPAGE = 2 + PTRMAP_OVERFLOW1 = 3 + PTRMAP_OVERFLOW2 = 4 + PTRMAP_ROOTPAGE = 1 + P_tmpdir = "/tmp/" + PragFlg_NeedSchema = 0x01 + PragFlg_NoColumns = 0x02 + PragFlg_NoColumns1 = 0x04 + PragFlg_ReadOnly = 0x08 + PragFlg_Result0 = 0x10 + PragFlg_Result1 = 0x20 + PragFlg_SchemaOpt = 0x40 + PragFlg_SchemaReq = 0x80 + PragTyp_ACTIVATE_EXTENSIONS = 0 + PragTyp_ANALYSIS_LIMIT = 1 + PragTyp_AUTO_VACUUM = 3 + PragTyp_BUSY_TIMEOUT = 5 + PragTyp_CACHE_SIZE = 6 + PragTyp_CACHE_SPILL = 7 + PragTyp_CASE_SENSITIVE_LIKE = 8 + PragTyp_COLLATION_LIST = 9 + PragTyp_COMPILE_OPTIONS = 10 + PragTyp_DATABASE_LIST = 12 + PragTyp_DATA_STORE_DIRECTORY = 11 + PragTyp_DEFAULT_CACHE_SIZE = 13 + PragTyp_ENCODING = 14 + PragTyp_FLAG = 4 + PragTyp_FOREIGN_KEY_CHECK = 15 + PragTyp_FOREIGN_KEY_LIST = 16 + PragTyp_FUNCTION_LIST = 17 + PragTyp_HARD_HEAP_LIMIT = 18 + PragTyp_HEADER_VALUE = 2 + PragTyp_INCREMENTAL_VACUUM = 19 + PragTyp_INDEX_INFO = 20 + PragTyp_INDEX_LIST = 21 + PragTyp_INTEGRITY_CHECK = 22 + PragTyp_JOURNAL_MODE = 23 + PragTyp_JOURNAL_SIZE_LIMIT = 24 + PragTyp_LOCKING_MODE = 26 + PragTyp_LOCK_PROXY_FILE = 25 + PragTyp_LOCK_STATUS = 43 + PragTyp_MMAP_SIZE = 28 + PragTyp_MODULE_LIST = 29 + PragTyp_OPTIMIZE = 30 + PragTyp_PAGE_COUNT = 27 + PragTyp_PAGE_SIZE = 31 + PragTyp_PRAGMA_LIST = 32 + PragTyp_SECURE_DELETE = 33 + PragTyp_SHRINK_MEMORY = 34 + PragTyp_SOFT_HEAP_LIMIT = 35 + PragTyp_STATS = 44 + PragTyp_SYNCHRONOUS = 36 + PragTyp_TABLE_INFO = 37 + PragTyp_TEMP_STORE = 38 + PragTyp_TEMP_STORE_DIRECTORY = 39 + PragTyp_THREADS = 40 + PragTyp_WAL_AUTOCHECKPOINT = 41 + PragTyp_WAL_CHECKPOINT = 42 + RAND_MAX = 0x7fffffff + RBU_CREATE_STATE = "CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)" + RBU_DELETE = 2 + RBU_ENABLE_DELTA_CKSUM = 0 + RBU_IDX_DELETE = 4 + RBU_IDX_INSERT = 5 + RBU_INSERT = 1 + RBU_PK_EXTERNAL = 3 + RBU_PK_IPK = 2 + RBU_PK_NONE = 1 + RBU_PK_NOTABLE = 0 + RBU_PK_VTAB = 5 + RBU_PK_WITHOUT_ROWID = 4 + RBU_REPLACE = 3 + RBU_STAGE_CAPTURE = 3 + RBU_STAGE_CKPT = 4 + RBU_STAGE_DONE = 5 + RBU_STAGE_MOVE = 2 + RBU_STAGE_OAL = 1 + RBU_STATE_CKPT = 6 + RBU_STATE_COOKIE = 7 + RBU_STATE_DATATBL = 10 + RBU_STATE_IDX = 3 + RBU_STATE_OALSZ = 8 + RBU_STATE_PHASEONESTEP = 9 + RBU_STATE_PROGRESS = 5 + RBU_STATE_ROW = 4 + RBU_STATE_STAGE = 1 + RBU_STATE_TBL = 2 + RBU_UPDATE = 6 + READMARK_NOT_USED = 0xffffffff + READ_LOCK = 1 + RESERVED_LOCK = 2 + RETURNING_TRIGGER_NAME = "sqlite_returning" + RNDAWAY = 0 + RNDTOWARDS = 0 + ROWSET_ALLOCATION_SIZE = 1024 + ROWSET_NEXT = 0x02 + ROWSET_SORTED = 0x01 + RTLD_DEEPBIND = 0x04000 + RTLD_DI_LINKMAP = 2 + RTLD_DI_MAX = 6 + RTLD_DI_ORIGIN = 6 + RTLD_DI_SERINFO = 4 + RTLD_DI_SERINFOSIZE = 5 + RTLD_GLOBAL = 0x100 + RTLD_LAZY = 1 + RTLD_LOCAL = 0 + RTLD_MODEMASK = 0x3 + RTLD_NODELETE = 0x01000 + RTLD_NOLOAD = 0x02000 + RTLD_NOW = 2 + RTLD_TRACE = 0x200 + RTREE_CACHE_SZ = 5 + RTREE_CHECK_MAX_ERROR = 100 + RTREE_COORD_INT32 = 1 + RTREE_COORD_REAL32 = 0 + RTREE_DEFAULT_ROWEST = 1048576 + RTREE_EQ = 0x41 + RTREE_FALSE = 0x40 + RTREE_GE = 0x44 + RTREE_GT = 0x45 + RTREE_LE = 0x42 + RTREE_LT = 0x43 + RTREE_MATCH = 0x46 + RTREE_MAXCELLS = 51 + RTREE_MAX_AUX_COLUMN = 100 + RTREE_MAX_DEPTH = 40 + RTREE_MAX_DIMENSIONS = 5 + RTREE_MIN_ROWEST = 100 + RTREE_QUERY = 0x47 + RTREE_TRUE = 0x3f + RTREE_ZERO = 0.0 + R_OK = 0x04 + SAVEPOINT_BEGIN = 0 + SAVEPOINT_RELEASE = 1 + SAVEPOINT_ROLLBACK = 2 + SCHEMA_ROOT = 1 + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 + SF_Aggregate = 0x0000008 + SF_All = 0x0000002 + SF_ComplexResult = 0x0040000 + SF_Compound = 0x0000100 + SF_Converted = 0x0010000 + SF_CopyCte = 0x4000000 + SF_Distinct = 0x0000001 + SF_Expanded = 0x0000040 + SF_FixedLimit = 0x0004000 + SF_HasAgg = 0x0000010 + SF_HasTypeInfo = 0x0000080 + SF_IncludeHidden = 0x0020000 + SF_MaybeConvert = 0x0008000 + SF_MinMaxAgg = 0x0001000 + SF_MultiPart = 0x2000000 + SF_MultiValue = 0x0000400 + SF_NestedFrom = 0x0000800 + SF_NoopOrderBy = 0x0400000 + SF_PushDown = 0x1000000 + SF_Recursive = 0x0002000 + SF_Resolved = 0x0000004 + SF_UpdateFrom = 0x0800000 + SF_UsesEphemeral = 0x0000020 + SF_Values = 0x0000200 + SF_View = 0x0200000 + SF_WhereBegin = 0x0080000 + SF_WinRewrite = 0x0100000 + SHARED_LOCK = 1 + SHARED_SIZE = 510 + SLIPDISC = 4 + SLOT_2_0 = 0x001fc07f + SLOT_4_2_0 = 0xf01fc07f + SORTER_MAX_MERGE_COUNT = 16 + SORTER_TYPE_INTEGER = 0x01 + SORTER_TYPE_TEXT = 0x02 + SORTFLAG_UseSorter = 0x01 + SPILLFLAG_NOSYNC = 0x04 + SPILLFLAG_OFF = 0x01 + SPILLFLAG_ROLLBACK = 0x02 + SQLITE3EXT_H = 0 + SQLITE3_H = 0 + SQLITE3_TEXT = 3 + SQLITEINT_H = 0 + SQLITE_ABORT = 4 + SQLITE_ABORT_ROLLBACK = 516 + SQLITE_ACCESS_EXISTS = 0 + SQLITE_ACCESS_READ = 2 + SQLITE_ACCESS_READWRITE = 1 + SQLITE_AFF_BLOB = 0x41 + SQLITE_AFF_INTEGER = 0x44 + SQLITE_AFF_MASK = 0x47 + SQLITE_AFF_NONE = 0x40 + SQLITE_AFF_NUMERIC = 0x43 + SQLITE_AFF_REAL = 0x45 + SQLITE_AFF_TEXT = 0x42 + SQLITE_ALLOW_COVERING_INDEX_SCAN = 1 + SQLITE_ALTER_TABLE = 26 + SQLITE_AMALGAMATION = 1 + SQLITE_ANALYZE = 28 + SQLITE_ANY = 5 + SQLITE_API = 0 + SQLITE_APICALL = 0 + SQLITE_ASCII = 1 + SQLITE_ATTACH = 24 + SQLITE_AUTH = 23 + SQLITE_AUTH_USER = 279 + SQLITE_AllOpts = 0xffffffff + SQLITE_AutoIndex = 0x00008000 + SQLITE_BIGENDIAN = 0 + SQLITE_BIG_DBL = 0 + SQLITE_BLDF1_INDEXED = 0x0001 + SQLITE_BLDF1_UNIQUE = 0x0002 + SQLITE_BLDF2_2NDPASS = 0x0004 + SQLITE_BLOB = 4 + SQLITE_BTREE_H = 0 + SQLITE_BUSY = 5 + SQLITE_BUSY_RECOVERY = 261 + SQLITE_BUSY_SNAPSHOT = 517 + SQLITE_BUSY_TIMEOUT = 773 + SQLITE_BYTEORDER = 1234 + SQLITE_CALLBACK = 0 + SQLITE_CANTOPEN = 14 + SQLITE_CANTOPEN_CONVPATH = 1038 + SQLITE_CANTOPEN_DIRTYWAL = 1294 + SQLITE_CANTOPEN_FULLPATH = 782 + SQLITE_CANTOPEN_ISDIR = 526 + SQLITE_CANTOPEN_NOTEMPDIR = 270 + SQLITE_CANTOPEN_SYMLINK = 1550 + SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 + SQLITE_CHECKPOINT_FULL = 1 + SQLITE_CHECKPOINT_PASSIVE = 0 + SQLITE_CHECKPOINT_RESTART = 2 + SQLITE_CHECKPOINT_TRUNCATE = 3 + SQLITE_CONFIG_COVERING_INDEX_SCAN = 20 + SQLITE_CONFIG_GETMALLOC = 5 + SQLITE_CONFIG_GETMUTEX = 11 + SQLITE_CONFIG_GETPCACHE = 15 + SQLITE_CONFIG_GETPCACHE2 = 19 + SQLITE_CONFIG_HEAP = 8 + SQLITE_CONFIG_LOG = 16 + SQLITE_CONFIG_LOOKASIDE = 13 + SQLITE_CONFIG_MALLOC = 4 + SQLITE_CONFIG_MEMDB_MAXSIZE = 29 + SQLITE_CONFIG_MEMSTATUS = 9 + SQLITE_CONFIG_MMAP_SIZE = 22 + SQLITE_CONFIG_MULTITHREAD = 2 + SQLITE_CONFIG_MUTEX = 10 + SQLITE_CONFIG_PAGECACHE = 7 + SQLITE_CONFIG_PCACHE = 14 + SQLITE_CONFIG_PCACHE2 = 18 + SQLITE_CONFIG_PCACHE_HDRSZ = 24 + SQLITE_CONFIG_PMASZ = 25 + SQLITE_CONFIG_SCRATCH = 6 + SQLITE_CONFIG_SERIALIZED = 3 + SQLITE_CONFIG_SINGLETHREAD = 1 + SQLITE_CONFIG_SMALL_MALLOC = 27 + SQLITE_CONFIG_SORTERREF_SIZE = 28 + SQLITE_CONFIG_SQLLOG = 21 + SQLITE_CONFIG_STMTJRNL_SPILL = 26 + SQLITE_CONFIG_URI = 17 + SQLITE_CONFIG_WIN32_HEAPSIZE = 23 + SQLITE_CONSTRAINT = 19 + SQLITE_CONSTRAINT_CHECK = 275 + SQLITE_CONSTRAINT_COMMITHOOK = 531 + SQLITE_CONSTRAINT_FOREIGNKEY = 787 + SQLITE_CONSTRAINT_FUNCTION = 1043 + SQLITE_CONSTRAINT_NOTNULL = 1299 + SQLITE_CONSTRAINT_PINNED = 2835 + SQLITE_CONSTRAINT_PRIMARYKEY = 1555 + SQLITE_CONSTRAINT_ROWID = 2579 + SQLITE_CONSTRAINT_TRIGGER = 1811 + SQLITE_CONSTRAINT_UNIQUE = 2067 + SQLITE_CONSTRAINT_VTAB = 2323 + SQLITE_COPY = 0 + SQLITE_CORE = 1 + SQLITE_CORRUPT = 11 + SQLITE_CORRUPT_INDEX = 779 + SQLITE_CORRUPT_SEQUENCE = 523 + SQLITE_CORRUPT_VTAB = 267 + SQLITE_CREATE_INDEX = 1 + SQLITE_CREATE_TABLE = 2 + SQLITE_CREATE_TEMP_INDEX = 3 + SQLITE_CREATE_TEMP_TABLE = 4 + SQLITE_CREATE_TEMP_TRIGGER = 5 + SQLITE_CREATE_TEMP_VIEW = 6 + SQLITE_CREATE_TRIGGER = 7 + SQLITE_CREATE_VIEW = 8 + SQLITE_CREATE_VTABLE = 29 + SQLITE_CacheSpill = 0x00000020 + SQLITE_CellSizeCk = 0x00200000 + SQLITE_CkptFullFSync = 0x00000010 + SQLITE_CountOfView = 0x00000200 + SQLITE_CoverIdxScan = 0x00000020 + SQLITE_CursorHints = 0x00000400 + SQLITE_DBCONFIG_DEFENSIVE = 1010 + SQLITE_DBCONFIG_DQS_DDL = 1014 + SQLITE_DBCONFIG_DQS_DML = 1013 + SQLITE_DBCONFIG_ENABLE_FKEY = 1002 + SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004 + SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005 + SQLITE_DBCONFIG_ENABLE_QPSG = 1007 + SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003 + SQLITE_DBCONFIG_ENABLE_VIEW = 1015 + SQLITE_DBCONFIG_LEGACY_ALTER_TABLE = 1012 + SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016 + SQLITE_DBCONFIG_LOOKASIDE = 1001 + SQLITE_DBCONFIG_MAINDBNAME = 1000 + SQLITE_DBCONFIG_MAX = 1017 + SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE = 1006 + SQLITE_DBCONFIG_RESET_DATABASE = 1009 + SQLITE_DBCONFIG_TRIGGER_EQP = 1008 + SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017 + SQLITE_DBCONFIG_WRITABLE_SCHEMA = 1011 + SQLITE_DBSTATUS_CACHE_HIT = 7 + SQLITE_DBSTATUS_CACHE_MISS = 8 + SQLITE_DBSTATUS_CACHE_SPILL = 12 + SQLITE_DBSTATUS_CACHE_USED = 1 + SQLITE_DBSTATUS_CACHE_USED_SHARED = 11 + SQLITE_DBSTATUS_CACHE_WRITE = 9 + SQLITE_DBSTATUS_DEFERRED_FKS = 10 + SQLITE_DBSTATUS_LOOKASIDE_HIT = 4 + SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6 + SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5 + SQLITE_DBSTATUS_LOOKASIDE_USED = 0 + SQLITE_DBSTATUS_MAX = 12 + SQLITE_DBSTATUS_SCHEMA_USED = 2 + SQLITE_DBSTATUS_STMT_USED = 3 + SQLITE_DEFAULT_AUTOVACUUM = 0 + SQLITE_DEFAULT_CACHE_SIZE = -2000 + SQLITE_DEFAULT_FILE_FORMAT = 4 + SQLITE_DEFAULT_FILE_PERMISSIONS = 0644 + SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT = -1 + SQLITE_DEFAULT_LOOKASIDE = 40 + SQLITE_DEFAULT_MEMSTATUS = 1 + SQLITE_DEFAULT_MMAP_SIZE = 0 + SQLITE_DEFAULT_PAGE_SIZE = 4096 + SQLITE_DEFAULT_PCACHE_INITSZ = 20 + SQLITE_DEFAULT_PROXYDIR_PERMISSIONS = 0755 + SQLITE_DEFAULT_RECURSIVE_TRIGGERS = 0 + SQLITE_DEFAULT_SECTOR_SIZE = 4096 + SQLITE_DEFAULT_SORTERREF_SIZE = 0x7fffffff + SQLITE_DEFAULT_SYNCHRONOUS = 2 + SQLITE_DEFAULT_WAL_AUTOCHECKPOINT = 1000 + SQLITE_DEFAULT_WAL_SYNCHRONOUS = 2 + SQLITE_DEFAULT_WORKER_THREADS = 0 + SQLITE_DELETE = 9 + SQLITE_DENY = 1 + SQLITE_DEPRECATED = 0 + SQLITE_DESERIALIZE_FREEONCLOSE = 1 + SQLITE_DESERIALIZE_READONLY = 4 + SQLITE_DESERIALIZE_RESIZEABLE = 2 + SQLITE_DETACH = 25 + SQLITE_DETERMINISTIC = 0x000000800 + SQLITE_DIRECTONLY = 0x000080000 + SQLITE_DONE = 101 + SQLITE_DQS = 3 + SQLITE_DROP_INDEX = 10 + SQLITE_DROP_TABLE = 11 + SQLITE_DROP_TEMP_INDEX = 12 + SQLITE_DROP_TEMP_TABLE = 13 + SQLITE_DROP_TEMP_TRIGGER = 14 + SQLITE_DROP_TEMP_VIEW = 15 + SQLITE_DROP_TRIGGER = 16 + SQLITE_DROP_VIEW = 17 + SQLITE_DROP_VTABLE = 30 + SQLITE_Defensive = 0x10000000 + SQLITE_DeferFKs = 0x00080000 + SQLITE_DistinctOpt = 0x00000010 + SQLITE_DqsDDL = 0x20000000 + SQLITE_DqsDML = 0x40000000 + SQLITE_ECEL_DUP = 0x01 + SQLITE_ECEL_FACTOR = 0x02 + SQLITE_ECEL_OMITREF = 0x08 + SQLITE_ECEL_REF = 0x04 + SQLITE_EMPTY = 16 + SQLITE_ENABLE_COLUMN_METADATA = 1 + SQLITE_ENABLE_FTS5 = 1 + SQLITE_ENABLE_GEOPOLY = 1 + SQLITE_ENABLE_JSON1 = 1 + SQLITE_ENABLE_LOCKING_STYLE = 0 + SQLITE_ENABLE_MEMORY_MANAGEMENT = 1 + SQLITE_ENABLE_OFFSET_SQL_FUNC = 1 + SQLITE_ENABLE_PREUPDATE_HOOK = 1 + SQLITE_ENABLE_RBU = 1 + SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 + SQLITE_ENABLE_SNAPSHOT = 1 + SQLITE_ENABLE_STAT4 = 1 + SQLITE_ENABLE_UNLOCK_NOTIFY = 1 + SQLITE_ERROR = 1 + SQLITE_ERROR_MISSING_COLLSEQ = 257 + SQLITE_ERROR_RETRY = 513 + SQLITE_ERROR_SNAPSHOT = 769 + SQLITE_EXPERIMENTAL = 0 + SQLITE_EXTENSION_INIT1 = 0 + SQLITE_EXTENSION_INIT3 = 0 + SQLITE_EnableQPSG = 0x00800000 + SQLITE_EnableTrigger = 0x00040000 + SQLITE_EnableView = 0x80000000 + SQLITE_FAIL = 3 + SQLITE_FAULTINJECTOR_COUNT = 1 + SQLITE_FAULTINJECTOR_MALLOC = 0 + SQLITE_FCNTL_BEGIN_ATOMIC_WRITE = 31 + SQLITE_FCNTL_BUSYHANDLER = 15 + SQLITE_FCNTL_CHUNK_SIZE = 6 + SQLITE_FCNTL_CKPT_DONE = 37 + SQLITE_FCNTL_CKPT_START = 39 + SQLITE_FCNTL_CKSM_FILE = 41 + SQLITE_FCNTL_COMMIT_ATOMIC_WRITE = 32 + SQLITE_FCNTL_COMMIT_PHASETWO = 22 + SQLITE_FCNTL_DATA_VERSION = 35 + SQLITE_FCNTL_DB_UNCHANGED = 0xca093fa0 + SQLITE_FCNTL_EXTERNAL_READER = 40 + SQLITE_FCNTL_FILE_POINTER = 7 + SQLITE_FCNTL_GET_LOCKPROXYFILE = 2 + SQLITE_FCNTL_HAS_MOVED = 20 + SQLITE_FCNTL_JOURNAL_POINTER = 28 + SQLITE_FCNTL_LAST_ERRNO = 4 + SQLITE_FCNTL_LOCKSTATE = 1 + SQLITE_FCNTL_LOCK_TIMEOUT = 34 + SQLITE_FCNTL_MMAP_SIZE = 18 + SQLITE_FCNTL_OVERWRITE = 11 + SQLITE_FCNTL_PDB = 30 + SQLITE_FCNTL_PERSIST_WAL = 10 + SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13 + SQLITE_FCNTL_PRAGMA = 14 + SQLITE_FCNTL_RBU = 26 + SQLITE_FCNTL_RBUCNT = 5149216 + SQLITE_FCNTL_RESERVE_BYTES = 38 + SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE = 33 + SQLITE_FCNTL_SET_LOCKPROXYFILE = 3 + SQLITE_FCNTL_SIZE_HINT = 5 + SQLITE_FCNTL_SIZE_LIMIT = 36 + SQLITE_FCNTL_SYNC = 21 + SQLITE_FCNTL_SYNC_OMITTED = 8 + SQLITE_FCNTL_TEMPFILENAME = 16 + SQLITE_FCNTL_TRACE = 19 + SQLITE_FCNTL_VFSNAME = 12 + SQLITE_FCNTL_VFS_POINTER = 27 + SQLITE_FCNTL_WAL_BLOCK = 24 + SQLITE_FCNTL_WIN32_AV_RETRY = 9 + SQLITE_FCNTL_WIN32_GET_HANDLE = 29 + SQLITE_FCNTL_WIN32_SET_HANDLE = 23 + SQLITE_FCNTL_ZIPVFS = 25 + SQLITE_FILE_HEADER = "SQLite format 3" + SQLITE_FLOAT = 2 + SQLITE_FORMAT = 24 + SQLITE_FP_PRECISION_LIMIT = 100000000 + SQLITE_FRAME_MAGIC = 0x879fb71e + SQLITE_FSFLAGS_IS_MSDOS = 0x1 + SQLITE_FULL = 13 + SQLITE_FUNCTION = 31 + SQLITE_FUNC_CASE = 0x0008 + SQLITE_FUNC_CONSTANT = 0x0800 + SQLITE_FUNC_COUNT = 0x0100 + SQLITE_FUNC_DIRECT = 0x00080000 + SQLITE_FUNC_ENCMASK = 0x0003 + SQLITE_FUNC_EPHEM = 0x0010 + SQLITE_FUNC_HASH_SZ = 23 + SQLITE_FUNC_INLINE = 0x00400000 + SQLITE_FUNC_INTERNAL = 0x00040000 + SQLITE_FUNC_LENGTH = 0x0040 + SQLITE_FUNC_LIKE = 0x0004 + SQLITE_FUNC_MINMAX = 0x1000 + SQLITE_FUNC_NEEDCOLL = 0x0020 + SQLITE_FUNC_OFFSET = 0x8000 + SQLITE_FUNC_SLOCHNG = 0x2000 + SQLITE_FUNC_SUBTYPE = 0x00100000 + SQLITE_FUNC_TEST = 0x4000 + SQLITE_FUNC_TYPEOF = 0x0080 + SQLITE_FUNC_UNLIKELY = 0x0400 + SQLITE_FUNC_UNSAFE = 0x00200000 + SQLITE_FUNC_WINDOW = 0x00010000 + SQLITE_FactorOutConst = 0x00000008 + SQLITE_ForeignKeys = 0x00004000 + SQLITE_Fts3Tokenizer = 0x00400000 + SQLITE_FullColNames = 0x00000004 + SQLITE_FullFSync = 0x00000008 + SQLITE_GET_LOCKPROXYFILE = 2 + SQLITE_GroupByOrder = 0x00000004 + SQLITE_HASH_H = 0 + SQLITE_HAVE_C99_MATH_FUNCS = 1 + SQLITE_IDXTYPE_APPDEF = 0 + SQLITE_IDXTYPE_IPK = 3 + SQLITE_IDXTYPE_PRIMARYKEY = 2 + SQLITE_IDXTYPE_UNIQUE = 1 + SQLITE_IGNORE = 2 + SQLITE_INDEX_CONSTRAINT_EQ = 2 + SQLITE_INDEX_CONSTRAINT_FUNCTION = 150 + SQLITE_INDEX_CONSTRAINT_GE = 32 + SQLITE_INDEX_CONSTRAINT_GLOB = 66 + SQLITE_INDEX_CONSTRAINT_GT = 4 + SQLITE_INDEX_CONSTRAINT_IS = 72 + SQLITE_INDEX_CONSTRAINT_ISNOT = 69 + SQLITE_INDEX_CONSTRAINT_ISNOTNULL = 70 + SQLITE_INDEX_CONSTRAINT_ISNULL = 71 + SQLITE_INDEX_CONSTRAINT_LE = 8 + SQLITE_INDEX_CONSTRAINT_LIKE = 65 + SQLITE_INDEX_CONSTRAINT_LT = 16 + SQLITE_INDEX_CONSTRAINT_MATCH = 64 + SQLITE_INDEX_CONSTRAINT_NE = 68 + SQLITE_INDEX_CONSTRAINT_REGEXP = 67 + SQLITE_INDEX_SCAN_UNIQUE = 1 + SQLITE_INNOCUOUS = 0x000200000 + SQLITE_INSERT = 18 + SQLITE_INTEGER = 1 + SQLITE_INTEGRITY_CHECK_ERROR_MAX = 100 + SQLITE_INTERNAL = 2 + SQLITE_INTERRUPT = 9 + SQLITE_IOCAP_ATOMIC = 0x00000001 + SQLITE_IOCAP_ATOMIC16K = 0x00000040 + SQLITE_IOCAP_ATOMIC1K = 0x00000004 + SQLITE_IOCAP_ATOMIC2K = 0x00000008 + SQLITE_IOCAP_ATOMIC32K = 0x00000080 + SQLITE_IOCAP_ATOMIC4K = 0x00000010 + SQLITE_IOCAP_ATOMIC512 = 0x00000002 + SQLITE_IOCAP_ATOMIC64K = 0x00000100 + SQLITE_IOCAP_ATOMIC8K = 0x00000020 + SQLITE_IOCAP_BATCH_ATOMIC = 0x00004000 + SQLITE_IOCAP_IMMUTABLE = 0x00002000 + SQLITE_IOCAP_POWERSAFE_OVERWRITE = 0x00001000 + SQLITE_IOCAP_SAFE_APPEND = 0x00000200 + SQLITE_IOCAP_SEQUENTIAL = 0x00000400 + SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = 0x00000800 + SQLITE_IOERR = 10 + SQLITE_IOERR_ACCESS = 3338 + SQLITE_IOERR_AUTH = 7178 + SQLITE_IOERR_BEGIN_ATOMIC = 7434 + SQLITE_IOERR_BLOCKED = 2826 + SQLITE_IOERR_CHECKRESERVEDLOCK = 3594 + SQLITE_IOERR_CLOSE = 4106 + SQLITE_IOERR_COMMIT_ATOMIC = 7690 + SQLITE_IOERR_CONVPATH = 6666 + SQLITE_IOERR_CORRUPTFS = 8458 + SQLITE_IOERR_DATA = 8202 + SQLITE_IOERR_DELETE = 2570 + SQLITE_IOERR_DELETE_NOENT = 5898 + SQLITE_IOERR_DIR_CLOSE = 4362 + SQLITE_IOERR_DIR_FSYNC = 1290 + SQLITE_IOERR_FSTAT = 1802 + SQLITE_IOERR_FSYNC = 1034 + SQLITE_IOERR_GETTEMPPATH = 6410 + SQLITE_IOERR_LOCK = 3850 + SQLITE_IOERR_MMAP = 6154 + SQLITE_IOERR_NOMEM = 3082 + SQLITE_IOERR_NOMEM_BKPT = 3082 + SQLITE_IOERR_RDLOCK = 2314 + SQLITE_IOERR_READ = 266 + SQLITE_IOERR_ROLLBACK_ATOMIC = 7946 + SQLITE_IOERR_SEEK = 5642 + SQLITE_IOERR_SHMLOCK = 5130 + SQLITE_IOERR_SHMMAP = 5386 + SQLITE_IOERR_SHMOPEN = 4618 + SQLITE_IOERR_SHMSIZE = 4874 + SQLITE_IOERR_SHORT_READ = 522 + SQLITE_IOERR_TRUNCATE = 1546 + SQLITE_IOERR_UNLOCK = 2058 + SQLITE_IOERR_VNODE = 6922 + SQLITE_IOERR_WRITE = 778 + SQLITE_IgnoreChecks = 0x00000200 + SQLITE_JUMPIFNULL = 0x10 + SQLITE_LAST_ERRNO = 4 + SQLITE_LIKE_DOESNT_MATCH_BLOBS = 1 + SQLITE_LIMIT_ATTACHED = 7 + SQLITE_LIMIT_COLUMN = 2 + SQLITE_LIMIT_COMPOUND_SELECT = 4 + SQLITE_LIMIT_EXPR_DEPTH = 3 + SQLITE_LIMIT_FUNCTION_ARG = 6 + SQLITE_LIMIT_LENGTH = 0 + SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8 + SQLITE_LIMIT_SQL_LENGTH = 1 + SQLITE_LIMIT_TRIGGER_DEPTH = 10 + SQLITE_LIMIT_VARIABLE_NUMBER = 9 + SQLITE_LIMIT_VDBE_OP = 5 + SQLITE_LIMIT_WORKER_THREADS = 11 + SQLITE_LITTLEENDIAN = 1 + SQLITE_LOCKED = 6 + SQLITE_LOCKED_SHAREDCACHE = 262 + SQLITE_LOCKED_VTAB = 518 + SQLITE_LOCK_EXCLUSIVE = 4 + SQLITE_LOCK_NONE = 0 + SQLITE_LOCK_PENDING = 3 + SQLITE_LOCK_RESERVED = 2 + SQLITE_LOCK_SHARED = 1 + SQLITE_LegacyAlter = 0x04000000 + SQLITE_LegacyFileFmt = 0x00000002 + SQLITE_LoadExtFunc = 0x00020000 + SQLITE_LoadExtension = 0x00010000 + SQLITE_MAGIC_BUSY = 0xf03b7906 + SQLITE_MAGIC_CLOSED = 0x9f3c2d33 + SQLITE_MAGIC_ERROR = 0xb5357930 + SQLITE_MAGIC_OPEN = 0xa029a697 + SQLITE_MAGIC_SICK = 0x4b771290 + SQLITE_MAGIC_ZOMBIE = 0x64cffc7f + SQLITE_MALLOC_SOFT_LIMIT = 1024 + SQLITE_MATCH = 0 + SQLITE_MAX_ATTACHED = 10 + SQLITE_MAX_COLUMN = 2000 + SQLITE_MAX_COMPOUND_SELECT = 500 + SQLITE_MAX_DB = 12 + SQLITE_MAX_DEFAULT_PAGE_SIZE = 8192 + SQLITE_MAX_EXPR_DEPTH = 1000 + SQLITE_MAX_FILE_FORMAT = 4 + SQLITE_MAX_FUNCTION_ARG = 127 + SQLITE_MAX_LENGTH = 1000000000 + SQLITE_MAX_LIKE_PATTERN_LENGTH = 50000 + SQLITE_MAX_MEMORY = 0 + SQLITE_MAX_MMAP_SIZE = 0x7fff0000 + SQLITE_MAX_PAGE_COUNT = 1073741823 + SQLITE_MAX_PAGE_SIZE = 65536 + SQLITE_MAX_PATHLEN = 1024 + SQLITE_MAX_PMASZ = 536870912 + SQLITE_MAX_SCHEMA_RETRY = 50 + SQLITE_MAX_SQL_LENGTH = 1000000000 + SQLITE_MAX_SRCLIST = 200 + SQLITE_MAX_SYMLINKS = 100 + SQLITE_MAX_TRIGGER_DEPTH = 1000 + SQLITE_MAX_VARIABLE_NUMBER = 32766 + SQLITE_MAX_VDBE_OP = 250000000 + SQLITE_MAX_WORKER_THREADS = 8 + SQLITE_MEMDB_DEFAULT_MAXSIZE = 1073741824 + SQLITE_MINIMUM_FILE_DESCRIPTOR = 3 + SQLITE_MISMATCH = 20 + SQLITE_MISUSE = 21 + SQLITE_MSVC_H = 0 + SQLITE_MUTEX_APPDEF = 1 + SQLITE_MUTEX_FAST = 0 + SQLITE_MUTEX_NOOP = 1 + SQLITE_MUTEX_RECURSIVE = 1 + SQLITE_MUTEX_STATIC_APP1 = 8 + SQLITE_MUTEX_STATIC_APP2 = 9 + SQLITE_MUTEX_STATIC_APP3 = 10 + SQLITE_MUTEX_STATIC_LRU = 6 + SQLITE_MUTEX_STATIC_LRU2 = 7 + SQLITE_MUTEX_STATIC_MAIN = 2 + SQLITE_MUTEX_STATIC_MASTER = 2 + SQLITE_MUTEX_STATIC_MEM = 3 + SQLITE_MUTEX_STATIC_MEM2 = 4 + SQLITE_MUTEX_STATIC_OPEN = 4 + SQLITE_MUTEX_STATIC_PMEM = 7 + SQLITE_MUTEX_STATIC_PRNG = 5 + SQLITE_MUTEX_STATIC_VFS1 = 11 + SQLITE_MUTEX_STATIC_VFS2 = 12 + SQLITE_MUTEX_STATIC_VFS3 = 13 + SQLITE_MX_JUMP_OPCODE = 62 + SQLITE_MinMaxOpt = 0x00010000 + SQLITE_NOLFS = 22 + SQLITE_NOMATCH = 1 + SQLITE_NOMEM = 7 + SQLITE_NOMEM_BKPT = 7 + SQLITE_NOTADB = 26 + SQLITE_NOTFOUND = 12 + SQLITE_NOTICE = 27 + SQLITE_NOTICE_RECOVER_ROLLBACK = 539 + SQLITE_NOTICE_RECOVER_WAL = 283 + SQLITE_NOTNULL = 0x90 + SQLITE_NOWILDCARDMATCH = 2 + SQLITE_NO_TSAN = 0 + SQLITE_NTUNE = 6 + SQLITE_NULL = 5 + SQLITE_NULLEQ = 0x80 + SQLITE_N_BTREE_META = 16 + SQLITE_N_KEYWORD = 147 + SQLITE_N_LIMIT = 12 + SQLITE_NoCkptOnClose = 0x00000800 + SQLITE_NoSchemaError = 0x08000000 + SQLITE_NullCallback = 0x00000100 + SQLITE_OK = 0 + SQLITE_OK_LOAD_PERMANENTLY = 256 + SQLITE_OK_SYMLINK = 512 + SQLITE_OPEN_AUTOPROXY = 0x00000020 + SQLITE_OPEN_CREATE = 0x00000004 + SQLITE_OPEN_DELETEONCLOSE = 0x00000008 + SQLITE_OPEN_EXCLUSIVE = 0x00000010 + SQLITE_OPEN_FULLMUTEX = 0x00010000 + SQLITE_OPEN_MAIN_DB = 0x00000100 + SQLITE_OPEN_MAIN_JOURNAL = 0x00000800 + SQLITE_OPEN_MASTER_JOURNAL = 0x00004000 + SQLITE_OPEN_MEMORY = 0x00000080 + SQLITE_OPEN_NOFOLLOW = 0x01000000 + SQLITE_OPEN_NOMUTEX = 0x00008000 + SQLITE_OPEN_PRIVATECACHE = 0x00040000 + SQLITE_OPEN_READONLY = 0x00000001 + SQLITE_OPEN_READWRITE = 0x00000002 + SQLITE_OPEN_SHAREDCACHE = 0x00020000 + SQLITE_OPEN_SUBJOURNAL = 0x00002000 + SQLITE_OPEN_SUPER_JOURNAL = 0x00004000 + SQLITE_OPEN_TEMP_DB = 0x00000200 + SQLITE_OPEN_TEMP_JOURNAL = 0x00001000 + SQLITE_OPEN_TRANSIENT_DB = 0x00000400 + SQLITE_OPEN_URI = 0x00000040 + SQLITE_OPEN_WAL = 0x00080000 + SQLITE_OS_SETUP_H = 0 + SQLITE_OS_UNIX = 1 + SQLITE_OS_WIN = 0 + SQLITE_OmitNoopJoin = 0x00000100 + SQLITE_OrderByIdxJoin = 0x00000040 + SQLITE_PAGER_H = 0 + SQLITE_PERM = 3 + SQLITE_POWERSAFE_OVERWRITE = 1 + SQLITE_PRAGMA = 19 + SQLITE_PREPARE_MASK = 0x0f + SQLITE_PREPARE_NORMALIZE = 0x02 + SQLITE_PREPARE_NO_VTAB = 0x04 + SQLITE_PREPARE_PERSISTENT = 0x01 + SQLITE_PREPARE_SAVESQL = 0x80 + SQLITE_PRINTF_INTERNAL = 0x01 + SQLITE_PRINTF_MALLOCED = 0x04 + SQLITE_PRINTF_SQLFUNC = 0x02 + SQLITE_PRINT_BUF_SIZE = 70 + SQLITE_PRIVATE = 0 + SQLITE_PROTOCOL = 15 + SQLITE_PTRSIZE = 8 + SQLITE_PropagateConst = 0x00008000 + SQLITE_PushDown = 0x00001000 + SQLITE_QUERY_PLANNER_LIMIT = 20000 + SQLITE_QUERY_PLANNER_LIMIT_INCR = 1000 + SQLITE_QueryFlattener = 0x00000001 + SQLITE_QueryOnly = 0x00100000 + SQLITE_RANGE = 25 + SQLITE_RBU_STATE_CHECKPOINT = 3 + SQLITE_RBU_STATE_DONE = 4 + SQLITE_RBU_STATE_ERROR = 5 + SQLITE_RBU_STATE_MOVE = 2 + SQLITE_RBU_STATE_OAL = 1 + SQLITE_RBU_UPDATE_CACHESIZE = 16 + SQLITE_READ = 20 + SQLITE_READONLY = 8 + SQLITE_READONLY_CANTINIT = 1288 + SQLITE_READONLY_CANTLOCK = 520 + SQLITE_READONLY_DBMOVED = 1032 + SQLITE_READONLY_DIRECTORY = 1544 + SQLITE_READONLY_RECOVERY = 264 + SQLITE_READONLY_ROLLBACK = 776 + SQLITE_RECURSIVE = 33 + SQLITE_REINDEX = 27 + SQLITE_REPLACE = 5 + SQLITE_ROLLBACK = 1 + SQLITE_ROW = 100 + SQLITE_ReadUncommit = 0x00000400 + SQLITE_RecTriggers = 0x00002000 + SQLITE_ResetDatabase = 0x02000000 + SQLITE_ReverseOrder = 0x00001000 + SQLITE_SAVEPOINT = 32 + SQLITE_SCANSTAT_EST = 2 + SQLITE_SCANSTAT_EXPLAIN = 4 + SQLITE_SCANSTAT_NAME = 3 + SQLITE_SCANSTAT_NLOOP = 0 + SQLITE_SCANSTAT_NVISIT = 1 + SQLITE_SCANSTAT_SELECTID = 5 + SQLITE_SCHEMA = 17 + SQLITE_SELECT = 21 + SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 + SQLITE_SET_LOCKPROXYFILE = 3 + SQLITE_SHM_EXCLUSIVE = 8 + SQLITE_SHM_LOCK = 2 + SQLITE_SHM_NLOCK = 8 + SQLITE_SHM_SHARED = 4 + SQLITE_SHM_UNLOCK = 1 + SQLITE_SORTER_PMASZ = 250 + SQLITE_SOUNDEX = 1 + SQLITE_SOURCE_ID = "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5" + SQLITE_SO_ASC = 0 + SQLITE_SO_DESC = 1 + SQLITE_SO_UNDEFINED = -1 + SQLITE_STAT4_SAMPLES = 24 + SQLITE_STATUS_MALLOC_COUNT = 9 + SQLITE_STATUS_MALLOC_SIZE = 5 + SQLITE_STATUS_MEMORY_USED = 0 + SQLITE_STATUS_PAGECACHE_OVERFLOW = 2 + SQLITE_STATUS_PAGECACHE_SIZE = 7 + SQLITE_STATUS_PAGECACHE_USED = 1 + SQLITE_STATUS_PARSER_STACK = 6 + SQLITE_STATUS_SCRATCH_OVERFLOW = 4 + SQLITE_STATUS_SCRATCH_SIZE = 8 + SQLITE_STATUS_SCRATCH_USED = 3 + SQLITE_STDCALL = 0 + SQLITE_STMTJRNL_SPILL = 65536 + SQLITE_STMTSTATUS_AUTOINDEX = 3 + SQLITE_STMTSTATUS_FULLSCAN_STEP = 1 + SQLITE_STMTSTATUS_MEMUSED = 99 + SQLITE_STMTSTATUS_REPREPARE = 5 + SQLITE_STMTSTATUS_RUN = 6 + SQLITE_STMTSTATUS_SORT = 2 + SQLITE_STMTSTATUS_VM_STEP = 4 + SQLITE_SUBTYPE = 0x000100000 + SQLITE_SYNC_DATAONLY = 0x00010 + SQLITE_SYNC_FULL = 0x00003 + SQLITE_SYNC_NORMAL = 0x00002 + SQLITE_SYSAPI = 0 + SQLITE_SYSTEM_MALLOC = 1 + SQLITE_SeekScan = 0x00020000 + SQLITE_ShortColNames = 0x00000040 + SQLITE_SimplifyJoin = 0x00002000 + SQLITE_SkipScan = 0x00004000 + SQLITE_Stat4 = 0x00000800 + SQLITE_TCLAPI = 0 + SQLITE_TEMP_FILE_PREFIX = "etilqs_" + SQLITE_TEMP_STORE = 1 + SQLITE_TESTCTRL_ALWAYS = 13 + SQLITE_TESTCTRL_ASSERT = 12 + SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS = 10 + SQLITE_TESTCTRL_BITVEC_TEST = 8 + SQLITE_TESTCTRL_BYTEORDER = 22 + SQLITE_TESTCTRL_EXPLAIN_STMT = 19 + SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS = 29 + SQLITE_TESTCTRL_FAULT_INSTALL = 9 + SQLITE_TESTCTRL_FIRST = 5 + SQLITE_TESTCTRL_IMPOSTER = 25 + SQLITE_TESTCTRL_INTERNAL_FUNCTIONS = 17 + SQLITE_TESTCTRL_ISINIT = 23 + SQLITE_TESTCTRL_ISKEYWORD = 16 + SQLITE_TESTCTRL_LAST = 32 + SQLITE_TESTCTRL_LOCALTIME_FAULT = 18 + SQLITE_TESTCTRL_NEVER_CORRUPT = 20 + SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD = 19 + SQLITE_TESTCTRL_OPTIMIZATIONS = 15 + SQLITE_TESTCTRL_PARSER_COVERAGE = 26 + SQLITE_TESTCTRL_PENDING_BYTE = 11 + SQLITE_TESTCTRL_PRNG_RESET = 7 + SQLITE_TESTCTRL_PRNG_RESTORE = 6 + SQLITE_TESTCTRL_PRNG_SAVE = 5 + SQLITE_TESTCTRL_PRNG_SEED = 28 + SQLITE_TESTCTRL_RESERVE = 14 + SQLITE_TESTCTRL_RESULT_INTREAL = 27 + SQLITE_TESTCTRL_SCRATCHMALLOC = 17 + SQLITE_TESTCTRL_SEEK_COUNT = 30 + SQLITE_TESTCTRL_SORTER_MMAP = 24 + SQLITE_TESTCTRL_TRACEFLAGS = 31 + SQLITE_TESTCTRL_TUNE = 32 + SQLITE_TESTCTRL_VDBE_COVERAGE = 21 + SQLITE_TEXT = 3 + SQLITE_THREADSAFE = 1 + SQLITE_TOKEN_KEYWORD = 0x2 + SQLITE_TOKEN_QUOTED = 0x1 + SQLITE_TOOBIG = 18 + SQLITE_TRACE_CLOSE = 0x08 + SQLITE_TRACE_LEGACY = 0x40 + SQLITE_TRACE_NONLEGACY_MASK = 0x0f + SQLITE_TRACE_PROFILE = 0x02 + SQLITE_TRACE_ROW = 0x04 + SQLITE_TRACE_STMT = 0x01 + SQLITE_TRACE_XPROFILE = 0x80 + SQLITE_TRANSACTION = 22 + SQLITE_TXN_NONE = 0 + SQLITE_TXN_READ = 1 + SQLITE_TXN_WRITE = 2 + SQLITE_Transitive = 0x00000080 + SQLITE_TriggerEQP = 0x01000000 + SQLITE_TrustedSchema = 0x00000080 + SQLITE_UPDATE = 23 + SQLITE_USE_URI = 0 + SQLITE_UTF16 = 4 + SQLITE_UTF16BE = 3 + SQLITE_UTF16LE = 2 + SQLITE_UTF16NATIVE = 2 + SQLITE_UTF16_ALIGNED = 8 + SQLITE_UTF8 = 1 + SQLITE_VDBEINT_H = 0 + SQLITE_VDBE_H = 0 + SQLITE_VERSION = "3.36.0" + SQLITE_VERSION_NUMBER = 3036000 + SQLITE_VTABRISK_High = 2 + SQLITE_VTABRISK_Low = 0 + SQLITE_VTABRISK_Normal = 1 + SQLITE_VTAB_CONSTRAINT_SUPPORT = 1 + SQLITE_VTAB_DIRECTONLY = 3 + SQLITE_VTAB_INNOCUOUS = 2 + SQLITE_WAL_H = 0 + SQLITE_WARNING = 28 + SQLITE_WARNING_AUTOINDEX = 284 + SQLITE_WHEREINT_H = 0 + SQLITE_WIN32_DATA_DIRECTORY_TYPE = 1 + SQLITE_WIN32_TEMP_DIRECTORY_TYPE = 2 + SQLITE_WSD = 0 + SQLITE_WindowFunc = 0x00000002 + SQLITE_WriteSchema = 0x00000001 + SRT_Coroutine = 13 + SRT_Discard = 4 + SRT_DistFifo = 5 + SRT_DistQueue = 6 + SRT_EphemTab = 12 + SRT_Except = 2 + SRT_Exists = 3 + SRT_Fifo = 8 + SRT_Mem = 10 + SRT_Output = 9 + SRT_Queue = 7 + SRT_Set = 11 + SRT_Table = 14 + SRT_Union = 1 + SRT_Upfrom = 15 + STAT_GET_NDLT = 4 + STAT_GET_NEQ = 2 + STAT_GET_NLT = 3 + STAT_GET_ROWID = 1 + STAT_GET_STAT1 = 0 + STDERR_FILENO = 2 + STDIN_FILENO = 0 + STDOUT_FILENO = 1 + S_IFBLK = 0060000 + S_IFCHR = 0020000 + S_IFDIR = 0040000 + S_IFIFO = 0010000 + S_IFLNK = 0120000 + S_IFMT = 0170000 + S_IFREG = 0100000 + S_IFSOCK = 0140000 + S_IRGRP = 0000040 + S_IROTH = 0000004 + S_IRUSR = 0000400 + S_IRWXG = 0000070 + S_IRWXO = 0000007 + S_IRWXU = 0000700 + S_ISGID = 0002000 + S_ISUID = 0004000 + S_ISVTX = 0001000 + S_IWGRP = 0000020 + S_IWOTH = 0000002 + S_IWUSR = 0000200 + S_IXGRP = 0000010 + S_IXOTH = 0000001 + S_IXUSR = 0000100 + TERM_ANDINFO = 0x0020 + TERM_CODED = 0x0004 + TERM_COPIED = 0x0008 + TERM_DYNAMIC = 0x0001 + TERM_HEURTRUTH = 0x2000 + TERM_HIGHTRUTH = 0x4000 + TERM_IS = 0x0800 + TERM_LIKE = 0x0400 + TERM_LIKECOND = 0x0200 + TERM_LIKEOPT = 0x0100 + TERM_ORINFO = 0x0010 + TERM_OR_OK = 0x0040 + TERM_VARSELECT = 0x1000 + TERM_VIRTUAL = 0x0002 + TERM_VNULL = 0x0080 + TF_Autoincrement = 0x0008 + TF_Ephemeral = 0x4000 + TF_Eponymous = 0x8000 + TF_HasGenerated = 0x0060 + TF_HasHidden = 0x0002 + TF_HasNotNull = 0x0800 + TF_HasPrimaryKey = 0x0004 + TF_HasStat1 = 0x0010 + TF_HasStat4 = 0x2000 + TF_HasStored = 0x0040 + TF_HasVirtual = 0x0020 + TF_NoVisibleRowid = 0x0200 + TF_OOOHidden = 0x0400 + TF_Readonly = 0x0001 + TF_Shadow = 0x1000 + TF_StatsUsed = 0x0100 + TF_WithoutRowid = 0x0080 + TIMER_ABSTIME = 0x1 + TIMER_END = 0 + TIMER_START = 0 + TIOCM_CAR = 64 + TIOCM_CD = 64 + TIOCM_CTS = 0040 + TIOCM_DCD = 0100 + TIOCM_DSR = 0400 + TIOCM_DTR = 0002 + TIOCM_LE = 0001 + TIOCM_RI = 0200 + TIOCM_RNG = 128 + TIOCM_RTS = 0004 + TIOCM_SR = 0020 + TIOCM_ST = 0010 + TIOCPKT_DATA = 0x00 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x01 + TIOCPKT_FLUSHWRITE = 0x02 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x08 + TIOCPKT_STOP = 0x04 + TK_ABORT = 27 + TK_ACTION = 28 + TK_ADD = 162 + TK_AFTER = 29 + TK_AGG_COLUMN = 168 + TK_AGG_FUNCTION = 167 + TK_ALL = 134 + TK_ALTER = 161 + TK_ALWAYS = 96 + TK_ANALYZE = 30 + TK_AND = 44 + TK_ANY = 101 + TK_AS = 24 + TK_ASC = 31 + TK_ASTERISK = 179 + TK_ATTACH = 32 + TK_AUTOINCR = 125 + TK_BEFORE = 33 + TK_BEGIN = 5 + TK_BETWEEN = 48 + TK_BITAND = 102 + TK_BITNOT = 113 + TK_BITOR = 103 + TK_BLOB = 153 + TK_BY = 34 + TK_CASCADE = 35 + TK_CASE = 156 + TK_CAST = 36 + TK_CHECK = 123 + TK_COLLATE = 112 + TK_COLUMN = 166 + TK_COLUMNKW = 60 + TK_COMMA = 26 + TK_COMMIT = 10 + TK_CONCAT = 111 + TK_CONFLICT = 37 + TK_CONSTRAINT = 118 + TK_CREATE = 17 + TK_CTIME_KW = 100 + TK_CURRENT = 85 + TK_DATABASE = 38 + TK_DEFAULT = 119 + TK_DEFERRABLE = 130 + TK_DEFERRED = 7 + TK_DELETE = 127 + TK_DESC = 39 + TK_DETACH = 40 + TK_DISTINCT = 139 + TK_DO = 61 + TK_DOT = 140 + TK_DROP = 132 + TK_EACH = 41 + TK_ELSE = 159 + TK_END = 11 + TK_EQ = 53 + TK_ERROR = 181 + TK_ESCAPE = 58 + TK_EXCEPT = 135 + TK_EXCLUDE = 91 + TK_EXCLUSIVE = 9 + TK_EXISTS = 20 + TK_EXPLAIN = 2 + TK_FAIL = 42 + TK_FILTER = 165 + TK_FIRST = 83 + TK_FLOAT = 152 + TK_FOLLOWING = 86 + TK_FOR = 62 + TK_FOREIGN = 131 + TK_FROM = 141 + TK_FUNCTION = 171 + TK_GE = 57 + TK_GENERATED = 95 + TK_GROUP = 145 + TK_GROUPS = 92 + TK_GT = 54 + TK_HAVING = 146 + TK_ID = 59 + TK_IF = 18 + TK_IF_NULL_ROW = 178 + TK_IGNORE = 63 + TK_ILLEGAL = 183 + TK_IMMEDIATE = 8 + TK_IN = 49 + TK_INDEX = 160 + TK_INDEXED = 115 + TK_INITIALLY = 64 + TK_INSERT = 126 + TK_INSTEAD = 65 + TK_INTEGER = 154 + TK_INTERSECT = 136 + TK_INTO = 150 + TK_IS = 45 + TK_ISNOT = 170 + TK_ISNULL = 50 + TK_JOIN = 142 + TK_JOIN_KW = 117 + TK_KEY = 67 + TK_LAST = 84 + TK_LE = 55 + TK_LIKE_KW = 47 + TK_LIMIT = 147 + TK_LP = 22 + TK_LSHIFT = 104 + TK_LT = 56 + TK_MATCH = 46 + TK_MATERIALIZED = 97 + TK_MINUS = 107 + TK_NE = 52 + TK_NO = 66 + TK_NOT = 19 + TK_NOTHING = 151 + TK_NOTNULL = 51 + TK_NULL = 120 + TK_NULLS = 82 + TK_OF = 68 + TK_OFFSET = 69 + TK_ON = 114 + TK_OR = 43 + TK_ORDER = 144 + TK_OTHERS = 93 + TK_OVER = 164 + TK_PARTITION = 87 + TK_PLAN = 4 + TK_PLUS = 106 + TK_PRAGMA = 70 + TK_PRECEDING = 88 + TK_PRIMARY = 121 + TK_QUERY = 3 + TK_RAISE = 71 + TK_RANGE = 89 + TK_RECURSIVE = 72 + TK_REFERENCES = 124 + TK_REGISTER = 175 + TK_REINDEX = 98 + TK_RELEASE = 14 + TK_REM = 110 + TK_RENAME = 99 + TK_REPLACE = 73 + TK_RESTRICT = 74 + TK_RETURNING = 149 + TK_ROLLBACK = 12 + TK_ROW = 75 + TK_ROWS = 76 + TK_RP = 23 + TK_RSHIFT = 105 + TK_SAVEPOINT = 13 + TK_SELECT = 137 + TK_SELECT_COLUMN = 177 + TK_SEMI = 1 + TK_SET = 129 + TK_SLASH = 109 + TK_SPACE = 182 + TK_SPAN = 180 + TK_STAR = 108 + TK_STRING = 116 + TK_TABLE = 16 + TK_TEMP = 21 + TK_THEN = 158 + TK_TIES = 94 + TK_TO = 15 + TK_TRANSACTION = 6 + TK_TRIGGER = 77 + TK_TRUEFALSE = 169 + TK_TRUTH = 174 + TK_UMINUS = 172 + TK_UNBOUNDED = 90 + TK_UNION = 133 + TK_UNIQUE = 122 + TK_UPDATE = 128 + TK_UPLUS = 173 + TK_USING = 143 + TK_VACUUM = 78 + TK_VALUES = 138 + TK_VARIABLE = 155 + TK_VECTOR = 176 + TK_VIEW = 79 + TK_VIRTUAL = 80 + TK_WHEN = 157 + TK_WHERE = 148 + TK_WINDOW = 163 + TK_WITH = 81 + TK_WITHOUT = 25 + TMP_MAX = 308915776 + TRANS_NONE = 0 + TRANS_READ = 1 + TRANS_WRITE = 2 + TRIGGER_AFTER = 2 + TRIGGER_BEFORE = 1 + TTYDISC = 0 + UNIXFILE_DELETE = 0x20 + UNIXFILE_DIRSYNC = 0x08 + UNIXFILE_EXCL = 0x01 + UNIXFILE_NOLOCK = 0x80 + UNIXFILE_PERSIST_WAL = 0x04 + UNIXFILE_PSOW = 0x10 + UNIXFILE_RDONLY = 0x02 + UNIXFILE_URI = 0x40 + UNIX_SHM_BASE = 120 + UNIX_SHM_DMS = 128 + UNKNOWN_LOCK = 5 + VDBE_DISPLAY_P4 = 1 + VDBE_MAGIC_DEAD = 0x5606c3c8 + VDBE_MAGIC_HALT = 0x319c2973 + VDBE_MAGIC_INIT = 0x16bceaa5 + VDBE_MAGIC_RESET = 0x48fa9f76 + VDBE_MAGIC_RUN = 0x2df20da3 + WALINDEX_MAX_VERSION = 3007000 + WAL_ALL_BUT_WRITE = 1 + WAL_CKPT_LOCK = 1 + WAL_EXCLUSIVE_MODE = 1 + WAL_FRAME_HDRSIZE = 24 + WAL_HDRSIZE = 32 + WAL_HEAPMEMORY_MODE = 2 + WAL_LOCK_CKPT = 1 + WAL_LOCK_READ0 = 3 + WAL_LOCK_WRITE = 0 + WAL_MAGIC = 0x377f0682 + WAL_MAX_VERSION = 3007000 + WAL_NORMAL_MODE = 0 + WAL_NREADER = 5 + WAL_RDONLY = 1 + WAL_RDWR = 0 + WAL_RECOVER_LOCK = 2 + WAL_RETRY = -1 + WAL_SAVEPOINT_NDATA = 4 + WAL_SHM_RDONLY = 2 + WAL_WRITE_LOCK = 0 + WHERE_AGG_DISTINCT = 0x0400 + WHERE_AUTO_INDEX = 0x00004000 + WHERE_BIGNULL_SORT = 0x00080000 + WHERE_BOTH_LIMIT = 0x00000030 + WHERE_BTM_LIMIT = 0x00000020 + WHERE_COLUMN_EQ = 0x00000001 + WHERE_COLUMN_IN = 0x00000004 + WHERE_COLUMN_NULL = 0x00000008 + WHERE_COLUMN_RANGE = 0x00000002 + WHERE_CONSTRAINT = 0x0000000f + WHERE_DISTINCTBY = 0x0080 + WHERE_DISTINCT_NOOP = 0 + WHERE_DISTINCT_ORDERED = 2 + WHERE_DISTINCT_UNIQUE = 1 + WHERE_DISTINCT_UNORDERED = 3 + WHERE_DUPLICATES_OK = 0x0010 + WHERE_GROUPBY = 0x0040 + WHERE_IDX_ONLY = 0x00000040 + WHERE_INDEXED = 0x00000200 + WHERE_IN_ABLE = 0x00000800 + WHERE_IN_EARLYOUT = 0x00040000 + WHERE_IN_SEEKSCAN = 0x00100000 + WHERE_IPK = 0x00000100 + WHERE_MULTI_OR = 0x00002000 + WHERE_ONEPASS_DESIRED = 0x0004 + WHERE_ONEPASS_MULTIROW = 0x0008 + WHERE_ONEROW = 0x00001000 + WHERE_ORDERBY_LIMIT = 0x0800 + WHERE_ORDERBY_MAX = 0x0002 + WHERE_ORDERBY_MIN = 0x0001 + WHERE_ORDERBY_NORMAL = 0x0000 + WHERE_OR_SUBCLAUSE = 0x0020 + WHERE_PARTIALIDX = 0x00020000 + WHERE_SKIPSCAN = 0x00008000 + WHERE_SORTBYGROUP = 0x0200 + WHERE_TOP_LIMIT = 0x00000010 + WHERE_TRANSCONS = 0x00200000 + WHERE_UNQ_WANTED = 0x00010000 + WHERE_USE_LIMIT = 0x4000 + WHERE_VIRTUALTABLE = 0x00000400 + WHERE_WANT_DISTINCT = 0x0100 + WINDOW_AGGINVERSE = 2 + WINDOW_AGGSTEP = 3 + WINDOW_ENDING_INT = 1 + WINDOW_ENDING_NUM = 4 + WINDOW_NTH_VALUE_INT = 2 + WINDOW_RETURN_ROW = 1 + WINDOW_STARTING_INT = 0 + WINDOW_STARTING_NUM = 3 + WO_ALL = 0x1fff + WO_AND = 0x0400 + WO_AUX = 0x0040 + WO_EQ = 0x0002 + WO_EQUIV = 0x0800 + WO_GE = 32 + WO_GT = 4 + WO_IN = 0x0001 + WO_IS = 0x0080 + WO_ISNULL = 0x0100 + WO_LE = 8 + WO_LT = 16 + WO_NOOP = 0x1000 + WO_OR = 0x0200 + WO_SINGLE = 0x01ff + WRC_Abort = 2 + WRC_Continue = 0 + WRC_Prune = 1 + WRITE_LOCK = 2 + W_OK = 0x02 + XN_EXPR = -2 + XN_ROWID = -1 + X_OK = 0x01 + YYFALLBACK = 1 + YYNOCODE = 317 + YYNOERRORRECOVERY = 1 + YYNRULE = 398 + YYNRULE_WITH_ACTION = 337 + YYNSTATE = 570 + YYNTOKEN = 184 + YYPARSEFREENEVERNULL = 1 + YYSTACKDEPTH = 100 + YYWILDCARD = 101 + YY_ACCEPT_ACTION = 1224 + YY_ACTTAB_COUNT = 2023 + YY_ERROR_ACTION = 1223 + YY_MAX_REDUCE = 1623 + YY_MAX_SHIFT = 569 + YY_MAX_SHIFTREDUCE = 1222 + YY_MIN_REDUCE = 1226 + YY_MIN_SHIFTREDUCE = 825 + YY_NO_ACTION = 1225 + YY_REDUCE_COUNT = 405 + YY_REDUCE_MAX = 1683 + YY_REDUCE_MIN = -266 + YY_SHIFT_COUNT = 569 + YY_SHIFT_MAX = 2009 + YY_SHIFT_MIN = 0 + X_ACCMODE_T_DECLARED = 0 + X_ANSI_STDARG_H_ = 0 + X_ANSI_STDDEF_H = 0 + X_ASSERT_H_ = 0 + X_BIG_ENDIAN = 4321 + X_BLKCNT_T_DECLARED = 0 + X_BLKSIZE_T_DECLARED = 0 + X_BSD_PTRDIFF_T_ = 0 + X_BYTE_ORDER = 1234 + X_CAP_IOCTL_T_DECLARED = 0 + X_CAP_RIGHTS_T_DECLARED = 0 + X_CLOCKID_T_DECLARED = 0 + X_CLOCK_T_DECLARED = 0 + X_CS_PATH = 1 + X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2 + X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3 + X_CS_POSIX_V6_ILP32_OFF32_LIBS = 4 + X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5 + X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6 + X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7 + X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 8 + X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9 + X_CS_POSIX_V6_LP64_OFF64_LIBS = 10 + X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11 + X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12 + X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13 + X_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14 + X_DEV_T_DECLARED = 0 + X_DLFCN_H_ = 0 + X_FFLAGS_T_DECLARED = 0 + X_FILE_OFFSET_BITS = 64 + X_FSBLKCNT_T_DECLARED = 0 + X_FSTDIO = 0 + X_FTRUNCATE_DECLARED = 0 + X_FTS5INT_H = 0 + X_FTS5_H = 0 + X_FTSINT_H = 0 + X_GCC_MAX_ALIGN_T = 0 + X_GCC_PTRDIFF_T = 0 + X_GETOPT_DECLARED = 0 + X_GID_T_DECLARED = 0 + X_GNU_SOURCE = 0 + X_ID_T_DECLARED = 0 + X_INO_T_DECLARED = 0 + X_INT16_T_DECLARED = 0 + X_INT32_T_DECLARED = 0 + X_INT64_T_DECLARED = 0 + X_INT8_T_DECLARED = 0 + X_INTMAX_T_DECLARED = 0 + X_INTPTR_T_DECLARED = 0 + X_IN_ADDR_T_DECLARED = 0 + X_IN_PORT_T_DECLARED = 0 + X_IOFBF = 0 + X_IOLBF = 1 + X_IONBF = 2 + X_KEY_T_DECLARED = 0 + X_LARGEFILE_SOURCE = 1 + X_LARGE_FILE = 1 + X_LITTLE_ENDIAN = 1234 + X_LOCALE_T_DEFINED = 0 + X_LP64 = 1 + X_LSEEK_DECLARED = 0 + X_LWPID_T_DECLARED = 0 + X_MACHINE_ENDIAN_H_ = 0 + X_MACHINE__LIMITS_H_ = 0 + X_MACHINE__TYPES_H_ = 0 + X_MADV_DONTNEED = 4 + X_MADV_NORMAL = 0 + X_MADV_RANDOM = 1 + X_MADV_SEQUENTIAL = 2 + X_MADV_WILLNEED = 3 + X_MATH_H_ = 0 + X_MKDTEMP_DECLARED = 0 + X_MKNOD_DECLARED = 0 + X_MKSTEMP_DECLARED = 0 + X_MKTEMP_DECLARED = 0 + X_MMAP_DECLARED = 0 + X_MODE_T_DECLARED = 0 + X_MQD_T_DECLARED = 0 + X_NLINK_T_DECLARED = 0 + X_Nonnull = 0 + X_Null_unspecified = 0 + X_Nullable = 0 + X_OFF64_T_DECLARED = 0 + X_OFF_T_DECLARED = 0 + X_OS_COMMON_H_ = 0 + X_PC_ALLOC_SIZE_MIN = 10 + X_PC_ASYNC_IO = 53 + X_PC_CHOWN_RESTRICTED = 7 + X_PC_FILESIZEBITS = 12 + X_PC_LINK_MAX = 1 + X_PC_MAX_CANON = 2 + X_PC_MAX_INPUT = 3 + X_PC_MIN_HOLE_SIZE = 21 + X_PC_NAME_MAX = 4 + X_PC_NO_TRUNC = 8 + X_PC_PATH_MAX = 5 + X_PC_PIPE_BUF = 6 + X_PC_PRIO_IO = 54 + X_PC_REC_INCR_XFER_SIZE = 14 + X_PC_REC_MAX_XFER_SIZE = 15 + X_PC_REC_MIN_XFER_SIZE = 16 + X_PC_REC_XFER_ALIGN = 17 + X_PC_SYMLINK_MAX = 18 + X_PC_SYNC_IO = 55 + X_PC_VDISABLE = 9 + X_PDP_ENDIAN = 3412 + X_PID_T_DECLARED = 0 + X_POSIX2_CHAR_TERM = 1 + X_POSIX2_C_BIND = 200112 + X_POSIX2_C_DEV = -1 + X_POSIX2_FORT_DEV = -1 + X_POSIX2_FORT_RUN = 200112 + X_POSIX2_LOCALEDEF = -1 + X_POSIX2_PBS = -1 + X_POSIX2_PBS_ACCOUNTING = -1 + X_POSIX2_PBS_CHECKPOINT = -1 + X_POSIX2_PBS_LOCATE = -1 + X_POSIX2_PBS_MESSAGE = -1 + X_POSIX2_PBS_TRACK = -1 + X_POSIX2_SW_DEV = -1 + X_POSIX2_UPE = 200112 + X_POSIX2_VERSION = 199212 + X_POSIX_ADVISORY_INFO = 200112 + X_POSIX_ASYNCHRONOUS_IO = 200112 + X_POSIX_BARRIERS = 200112 + X_POSIX_CHOWN_RESTRICTED = 1 + X_POSIX_CLOCK_SELECTION = -1 + X_POSIX_CPUTIME = 200112 + X_POSIX_C_SOURCE = 200112 + X_POSIX_FSYNC = 200112 + X_POSIX_IPV6 = 0 + X_POSIX_JOB_CONTROL = 1 + X_POSIX_MAPPED_FILES = 200112 + X_POSIX_MEMLOCK = -1 + X_POSIX_MEMLOCK_RANGE = 200112 + X_POSIX_MEMORY_PROTECTION = 200112 + X_POSIX_MESSAGE_PASSING = 200112 + X_POSIX_MONOTONIC_CLOCK = 200112 + X_POSIX_NO_TRUNC = 1 + X_POSIX_PRIORITIZED_IO = -1 + X_POSIX_PRIORITY_SCHEDULING = 0 + X_POSIX_RAW_SOCKETS = 200112 + X_POSIX_READER_WRITER_LOCKS = 200112 + X_POSIX_REALTIME_SIGNALS = 200112 + X_POSIX_REGEXP = 1 + X_POSIX_SEMAPHORES = 200112 + X_POSIX_SHARED_MEMORY_OBJECTS = 200112 + X_POSIX_SHELL = 1 + X_POSIX_SPAWN = 200112 + X_POSIX_SPIN_LOCKS = 200112 + X_POSIX_SPORADIC_SERVER = -1 + X_POSIX_SYNCHRONIZED_IO = -1 + X_POSIX_THREADS = 200112 + X_POSIX_THREAD_ATTR_STACKADDR = 200112 + X_POSIX_THREAD_ATTR_STACKSIZE = 200112 + X_POSIX_THREAD_CPUTIME = 200112 + X_POSIX_THREAD_PRIORITY_SCHEDULING = 200112 + X_POSIX_THREAD_PRIO_INHERIT = 200112 + X_POSIX_THREAD_PRIO_PROTECT = 200112 + X_POSIX_THREAD_PROCESS_SHARED = 200112 + X_POSIX_THREAD_SAFE_FUNCTIONS = -1 + X_POSIX_THREAD_SPORADIC_SERVER = -1 + X_POSIX_TIMEOUTS = 200112 + X_POSIX_TIMERS = 200112 + X_POSIX_TRACE = -1 + X_POSIX_TRACE_EVENT_FILTER = -1 + X_POSIX_TRACE_INHERIT = -1 + X_POSIX_TRACE_LOG = -1 + X_POSIX_TYPED_MEMORY_OBJECTS = -1 + X_POSIX_VDISABLE = 0xff + X_POSIX_VERSION = 200112 + X_PTHREAD_T_DECLARED = 0 + X_PTRDIFF_T = 0 + X_PTRDIFF_T_ = 0 + X_PTRDIFF_T_DECLARED = 0 + X_QUAD_HIGHWORD = 1 + X_QUAD_LOWWORD = 0 + X_RLIM_T_DECLARED = 0 + X_RSIZE_T_DEFINED = 0 + X_SC_2_CHAR_TERM = 20 + X_SC_2_C_BIND = 18 + X_SC_2_C_DEV = 19 + X_SC_2_FORT_DEV = 21 + X_SC_2_FORT_RUN = 22 + X_SC_2_LOCALEDEF = 23 + X_SC_2_PBS = 59 + X_SC_2_PBS_ACCOUNTING = 60 + X_SC_2_PBS_CHECKPOINT = 61 + X_SC_2_PBS_LOCATE = 62 + X_SC_2_PBS_MESSAGE = 63 + X_SC_2_PBS_TRACK = 64 + X_SC_2_SW_DEV = 24 + X_SC_2_UPE = 25 + X_SC_2_VERSION = 17 + X_SC_ADVISORY_INFO = 65 + X_SC_AIO_LISTIO_MAX = 42 + X_SC_AIO_MAX = 43 + X_SC_AIO_PRIO_DELTA_MAX = 44 + X_SC_ARG_MAX = 1 + X_SC_ASYNCHRONOUS_IO = 28 + X_SC_ATEXIT_MAX = 107 + X_SC_BARRIERS = 66 + X_SC_BC_BASE_MAX = 9 + X_SC_BC_DIM_MAX = 10 + X_SC_BC_SCALE_MAX = 11 + X_SC_BC_STRING_MAX = 12 + X_SC_CHILD_MAX = 2 + X_SC_CLK_TCK = 3 + X_SC_CLOCK_SELECTION = 67 + X_SC_COLL_WEIGHTS_MAX = 13 + X_SC_CPUTIME = 68 + X_SC_DELAYTIMER_MAX = 45 + X_SC_EXPR_NEST_MAX = 14 + X_SC_FILE_LOCKING = 69 + X_SC_FSYNC = 38 + X_SC_GETGR_R_SIZE_MAX = 70 + X_SC_GETPW_R_SIZE_MAX = 71 + X_SC_HOST_NAME_MAX = 72 + X_SC_IOV_MAX = 56 + X_SC_IPV6 = 118 + X_SC_JOB_CONTROL = 6 + X_SC_LINE_MAX = 15 + X_SC_LOGIN_NAME_MAX = 73 + X_SC_MAPPED_FILES = 29 + X_SC_MEMLOCK = 30 + X_SC_MEMLOCK_RANGE = 31 + X_SC_MEMORY_PROTECTION = 32 + X_SC_MESSAGE_PASSING = 33 + X_SC_MONOTONIC_CLOCK = 74 + X_SC_MQ_OPEN_MAX = 46 + X_SC_MQ_PRIO_MAX = 75 + X_SC_NGROUPS_MAX = 4 + X_SC_OPEN_MAX = 5 + X_SC_PAGESIZE = 47 + X_SC_PAGE_SIZE = 47 + X_SC_PHYS_PAGES = 121 + X_SC_PRIORITIZED_IO = 34 + X_SC_PRIORITY_SCHEDULING = 35 + X_SC_RAW_SOCKETS = 119 + X_SC_READER_WRITER_LOCKS = 76 + X_SC_REALTIME_SIGNALS = 36 + X_SC_REGEXP = 77 + X_SC_RE_DUP_MAX = 16 + X_SC_RTSIG_MAX = 48 + X_SC_SAVED_IDS = 7 + X_SC_SEMAPHORES = 37 + X_SC_SEM_NSEMS_MAX = 49 + X_SC_SEM_VALUE_MAX = 50 + X_SC_SHARED_MEMORY_OBJECTS = 39 + X_SC_SHELL = 78 + X_SC_SIGQUEUE_MAX = 51 + X_SC_SPAWN = 79 + X_SC_SPIN_LOCKS = 80 + X_SC_SPORADIC_SERVER = 81 + X_SC_STREAM_MAX = 26 + X_SC_SYMLOOP_MAX = 120 + X_SC_SYNCHRONIZED_IO = 40 + X_SC_THREADS = 96 + X_SC_THREAD_ATTR_STACKADDR = 82 + X_SC_THREAD_ATTR_STACKSIZE = 83 + X_SC_THREAD_CPUTIME = 84 + X_SC_THREAD_DESTRUCTOR_ITERATIONS = 85 + X_SC_THREAD_KEYS_MAX = 86 + X_SC_THREAD_PRIORITY_SCHEDULING = 89 + X_SC_THREAD_PRIO_INHERIT = 87 + X_SC_THREAD_PRIO_PROTECT = 88 + X_SC_THREAD_PROCESS_SHARED = 90 + X_SC_THREAD_SAFE_FUNCTIONS = 91 + X_SC_THREAD_SPORADIC_SERVER = 92 + X_SC_THREAD_STACK_MIN = 93 + X_SC_THREAD_THREADS_MAX = 94 + X_SC_TIMEOUTS = 95 + X_SC_TIMERS = 41 + X_SC_TIMER_MAX = 52 + X_SC_TRACE = 97 + X_SC_TRACE_EVENT_FILTER = 98 + X_SC_TRACE_INHERIT = 99 + X_SC_TRACE_LOG = 100 + X_SC_TTY_NAME_MAX = 101 + X_SC_TYPED_MEMORY_OBJECTS = 102 + X_SC_TZNAME_MAX = 27 + X_SC_V6_ILP32_OFF32 = 103 + X_SC_V6_ILP32_OFFBIG = 104 + X_SC_V6_LP64_OFF64 = 105 + X_SC_V6_LPBIG_OFFBIG = 106 + X_SC_VERSION = 8 + X_SC_XOPEN_CRYPT = 108 + X_SC_XOPEN_ENH_I18N = 109 + X_SC_XOPEN_LEGACY = 110 + X_SC_XOPEN_REALTIME = 111 + X_SC_XOPEN_REALTIME_THREADS = 112 + X_SC_XOPEN_SHM = 113 + X_SC_XOPEN_STREAMS = 114 + X_SC_XOPEN_UNIX = 115 + X_SC_XOPEN_VERSION = 116 + X_SC_XOPEN_XCU_VERSION = 117 + X_SELECT_DECLARED = 0 + X_SIGSET_T_DECLARED = 0 + X_SIG_MAXSIG = 128 + X_SIG_WORDS = 4 + X_SIZE_T_DECLARED = 0 + X_SQLITE3RBU_H = 0 + X_SQLITE3RTREE_H_ = 0 + X_SQLITE_OS_H_ = 0 + X_SSIZE_T_DECLARED = 0 + X_STDARG_H = 0 + X_STDDEF_H = 0 + X_STDDEF_H_ = 0 + X_STDFILE_DECLARED = 0 + X_STDIO_H_ = 0 + X_STDLIB_H_ = 0 + X_STDSTREAM_DECLARED = 0 + X_STRING_H_ = 0 + X_SUSECONDS_T_DECLARED = 0 + X_SWAB_DECLARED = 0 + X_SYS_CDEFS_H_ = 0 + X_SYS_ERRNO_H_ = 0 + X_SYS_FCNTL_H_ = 0 + X_SYS_FILIO_H_ = 0 + X_SYS_IOCCOM_H_ = 0 + X_SYS_IOCTL_H_ = 0 + X_SYS_MMAN_H_ = 0 + X_SYS_SELECT_H_ = 0 + X_SYS_SOCKIO_H_ = 0 + X_SYS_STAT_H_ = 0 + X_SYS_TIMESPEC_H_ = 0 + X_SYS_TIME_H_ = 0 + X_SYS_TTYCOM_H_ = 0 + X_SYS_TYPES_H_ = 0 + X_SYS_UNISTD_H_ = 0 + X_SYS__PTHREADTYPES_H_ = 0 + X_SYS__SIGSET_H_ = 0 + X_SYS__STDINT_H_ = 0 + X_SYS__TIMESPEC_H_ = 0 + X_SYS__TIMEVAL_H_ = 0 + X_SYS__TYPES_H_ = 0 + X_SYS__WINSIZE_H_ = 0 + X_TIMER_T_DECLARED = 0 + X_TIME_H_ = 0 + X_TIME_T_DECLARED = 0 + X_TRUNCATE_DECLARED = 0 + X_T_PTRDIFF = 0 + X_T_PTRDIFF_ = 0 + X_UID_T_DECLARED = 0 + X_UINT16_T_DECLARED = 0 + X_UINT32_T_DECLARED = 0 + X_UINT64_T_DECLARED = 0 + X_UINT8_T_DECLARED = 0 + X_UINTMAX_T_DECLARED = 0 + X_UINTPTR_T_DECLARED = 0 + X_UNISTD_H_ = 0 + X_USECONDS_T_DECLARED = 0 + X_V6_ILP32_OFF32 = -1 + X_V6_ILP32_OFFBIG = 0 + X_V6_LP64_OFF64 = 0 + X_V6_LPBIG_OFFBIG = -1 + X_VA_LIST = 0 + X_VA_LIST_DECLARED = 0 + X_VA_LIST_DEFINED = 0 + X_VA_LIST_T_H = 0 + X_WCHAR_T_DECLARED = 0 + X_XLOCALE_STRING1_H = 0 + X_XOPEN_CRYPT = -1 + X_XOPEN_ENH_I18N = -1 + X_XOPEN_LEGACY = -1 + X_XOPEN_REALTIME = -1 + X_XOPEN_REALTIME_THREADS = -1 + X_XOPEN_SHM = 1 + X_XOPEN_SOURCE = 600 + X_XOPEN_STREAMS = -1 + X_XOPEN_UNIX = -1 + BBatch = 0 + EtBUFSIZE = 70 + EtCHARX = 8 + EtDECIMAL = 16 + EtDYNSTRING = 6 + EtEXP = 2 + EtFLOAT = 1 + EtGENERIC = 3 + EtINVALID = 17 + EtORDINAL = 15 + EtPERCENT = 7 + EtPOINTER = 13 + EtRADIX = 0 + EtSIZE = 4 + EtSQLESCAPE = 9 + EtSQLESCAPE2 = 10 + EtSQLESCAPE3 = 14 + EtSRCITEM = 12 + EtSTRING = 5 + EtTOKEN = 11 + Fts5YYNFTS5TOKEN = 16 + Fts5YYNOCODE = 27 + Fts5YYNOERRORRECOVERY = 1 + Fts5YYNRULE = 28 + Fts5YYNRULE_WITH_ACTION = 28 + Fts5YYNSTATE = 35 + Fts5YYPARSEFREENOTNULL = 1 + Fts5YYSTACKDEPTH = 100 + Fts5YY_ACCEPT_ACTION = 81 + Fts5YY_ACTTAB_COUNT = 105 + Fts5YY_ERROR_ACTION = 80 + Fts5YY_MAX_REDUCE = 110 + Fts5YY_MAX_SHIFT = 34 + Fts5YY_MAX_SHIFTREDUCE = 79 + Fts5YY_MIN_REDUCE = 83 + Fts5YY_MIN_SHIFTREDUCE = 52 + Fts5YY_NO_ACTION = 82 + Fts5YY_REDUCE_COUNT = 17 + Fts5YY_REDUCE_MAX = 67 + Fts5YY_REDUCE_MIN = -17 + Fts5YY_SHIFT_COUNT = 34 + Fts5YY_SHIFT_MAX = 93 + Fts5YY_SHIFT_MIN = 0 + Math_errhandling = 2 + Sqlite3Fts5ParserCTX_FETCH = 0 + Sqlite3Fts5ParserCTX_PARAM = 0 + Sqlite3Fts5ParserCTX_PDECL = 0 + Sqlite3Fts5ParserCTX_SDECL = 0 + Sqlite3Fts5ParserCTX_STORE = 0 + Sqlite3ParserARG_FETCH = 0 + Sqlite3ParserARG_PARAM = 0 + Sqlite3ParserARG_PDECL = 0 + Sqlite3ParserARG_SDECL = 0 + Sqlite3ParserARG_STORE = 0 + Sqlite3Parser_ENGINEALWAYSONSTACK = 1 + TkCREATE = 4 + TkEND = 7 + TkEXPLAIN = 3 + TkOTHER = 2 + TkSEMI = 0 + TkTEMP = 5 + TkTRIGGER = 6 + TkWS = 1 + Unix = 1 + WsdAutoextInit = 0 + WsdHooksInit = 0 + WsdStatInit = 0 +) + +type Ptrdiff_t = int64 /* :3:26 */ + +type Size_t = uint64 /* :9:23 */ + +type Wchar_t = int32 /* :15:24 */ + +type X__int128_t = struct { + Flo int64 + Fhi int64 +} /* :21:43 */ // must match modernc.org/mathutil.Int128 +type X__uint128_t = struct { + Flo uint64 + Fhi uint64 +} /* :22:44 */ // must match modernc.org/mathutil.Int128 + +type X__builtin_va_list = uintptr /* :46:14 */ +type X__float128 = float64 /* :47:21 */ + +// ***************************************************************************** +// +// This file is an amalgamation of many separate C source files from SQLite +// version 3.36.0. By combining all the individual C code files into this +// single large file, the entire code can be compiled as a single translation +// unit. This allows many compilers to do optimizations that would not be +// possible if the files were compiled separately. Performance improvements +// of 5% or more are commonly seen when SQLite is compiled as a single +// translation unit. +// +// This file is all you need to compile SQLite. To use SQLite in other +// programs, you need this file and the "sqlite3.h" header file that defines +// the programming interface to the SQLite library. (If you do not have +// the "sqlite3.h" header file at hand, you will find a copy embedded within +// the text of this file. Search for "Begin file sqlite3.h" to find the start +// of the embedded sqlite3.h header file.) Additional code files may be needed +// if you want a wrapper to interface SQLite with your choice of programming +// language. The code for the "sqlite3" command-line shell is also in a +// separate file. This file contains only code for the core SQLite library. +//************* Begin file ctime.c ****************************************** +// 2010 February 23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements routines used to report what compile-time options +// SQLite was built with. + +// Include the configuration header output by 'configure' if we're using the +// autoconf-based build + +// These macros are provided to "stringify" the value of the define +// for those options in which the value is meaningful. + +// Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This +// option requires a separate macro because legal values contain a single +// comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") + +// An array of names of all compile-time options. This array should +// be sorted A-Z. +// +// This array looks large, but in a typical installation actually uses +// only a handful of compile-time options, so most times this array is usually +// rather short and uses little memory space. +var sqlite3azCompileOpt = [19]uintptr{ + + // BEGIN CODE GENERATED BY tool/mkctime.tcl + ts, /* "COMPILER=gcc-10...." */ + ts + 20, /* "ENABLE_COLUMN_ME..." */ + ts + 43, /* "ENABLE_FTS5" */ + ts + 55, /* "ENABLE_GEOPOLY" */ + ts + 70, /* "ENABLE_JSON1" */ + ts + 83, /* "ENABLE_MEMORY_MA..." */ + ts + 108, /* "ENABLE_OFFSET_SQ..." */ + ts + 131, /* "ENABLE_PREUPDATE..." */ + ts + 153, /* "ENABLE_RBU" */ + ts + 164, /* "ENABLE_RTREE" */ + ts + 177, /* "ENABLE_SESSION" */ + ts + 192, /* "ENABLE_SNAPSHOT" */ + ts + 208, /* "ENABLE_STAT4" */ + ts + 221, /* "ENABLE_UNLOCK_NO..." */ + ts + 242, /* "LIKE_DOESNT_MATC..." */ + ts + 266, /* "MUTEX_NOOP" */ + ts + 277, /* "SOUNDEX" */ + ts + 285, /* "SYSTEM_MALLOC" */ + ts + 299, /* "THREADSAFE=1" */ + // END CODE GENERATED BY tool/mkctime.tcl +} /* sqlite3.c:72:19 */ + +func Xsqlite3CompileOptions(tls *libc.TLS, pnOpt uintptr) uintptr { /* sqlite3.c:804:27: */ + *(*int32)(unsafe.Pointer(pnOpt)) = (int32(uint64(unsafe.Sizeof(sqlite3azCompileOpt)) / uint64(unsafe.Sizeof(uintptr(0))))) + return uintptr(uintptr(unsafe.Pointer(&sqlite3azCompileOpt))) +} + +//************* End of ctime.c ********************************************** +//************* Begin file sqliteInt.h ************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Internal interface definitions for SQLite. +// + +// Special Comments: +// +// Some comments have special meaning to the tools that measure test +// coverage: +// +// NO_TEST - The branches on this line are not +// measured by branch coverage. This is +// used on lines of code that actually +// implement parts of coverage testing. +// +// OPTIMIZATION-IF-TRUE - This branch is allowed to alway be false +// and the correct answer is still obtained, +// though perhaps more slowly. +// +// OPTIMIZATION-IF-FALSE - This branch is allowed to alway be true +// and the correct answer is still obtained, +// though perhaps more slowly. +// +// PREVENTS-HARMLESS-OVERREAD - This branch prevents a buffer overread +// that would be harmless and undetectable +// if it did occur. +// +// In all cases, the special comment must be enclosed in the usual +// slash-asterisk...asterisk-slash comment marks, with no spaces between the +// asterisks and the comment text. + +// Make sure the Tcl calling convention macro is defined. This macro is +// only used by test code and Tcl integration code. + +// Include the header file used to customize the compiler options for MSVC. +// This should be done first so that it can successfully prevent spurious +// compiler warnings due to subsequent content in this file and other files +// that are included by this file. +//************* Include msvc.h in the middle of sqliteInt.h ***************** +//************* Begin file msvc.h ******************************************* +// 2015 January 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code that is specific to MSVC. + +//************* End of msvc.h *********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** + +// Special setup for VxWorks +//************* Include vxworks.h in the middle of sqliteInt.h ************** +//************* Begin file vxworks.h **************************************** +// 2015-03-02 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code that is specific to Wind River's VxWorks +// This is not VxWorks. + +//************* End of vxworks.h ******************************************** +//************* Continuing where we left off in sqliteInt.h ***************** + +// These #defines should enable >2GB file support on POSIX if the +// underlying operating system supports it. If the OS lacks +// large file support, or if the OS is windows, these should be no-ops. +// +// Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any +// system #includes. Hence, this block of code must be the very first +// code in all source files. +// +// Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch +// on the compiler command line. This is necessary if you are compiling +// on a recent machine (ex: Red Hat 7.2) but you want your code to work +// on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 +// without this option, LFS is enable. But LFS does not exist in the kernel +// in Red Hat 6.0, so the code won't work. Hence, for maximum binary +// portability you should omit LFS. +// +// The previous paragraph was written in 2005. (This paragraph is written +// on 2008-11-28.) These days, all Linux kernels support large files, so +// you should probably leave LFS enabled. But some embedded platforms might +// lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful. +// +// Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. + +// The GCC_VERSION and MSVC_VERSION macros are used to +// conditionally include optimizations for each of these compilers. A +// value of 0 means that compiler is not being used. The +// SQLITE_DISABLE_INTRINSIC macro means do not use any compiler-specific +// optimizations, and hence set all compiler macros to 0 +// +// There was once also a CLANG_VERSION macro. However, we learn that the +// version numbers in clang are for "marketing" only and are inconsistent +// and unreliable. Fortunately, all versions of clang also recognize the +// gcc version numbers and have reasonable settings for gcc version numbers, +// so the GCC_VERSION macro will be set to a correct non-zero value even +// when compiling with clang. + +// Some C99 functions in "math.h" are only present for MSVC when its version +// is associated with Visual Studio 2013 or higher. + +// Needed for various definitions... + +// Macro to disable warnings about missing "break" at the end of a "case". + +// For MinGW, check to see if we can include the header file containing its +// version information, among other things. Normally, this internal MinGW +// header file would [only] be included automatically by other MinGW header +// files; however, the contained version information is now required by this +// header file to work around binary compatibility issues (see below) and +// this is the only known way to reliably obtain it. This entire #if block +// would be completely unnecessary if there was any other way of detecting +// MinGW via their preprocessor (e.g. if they customized their GCC to define +// some MinGW-specific macros). When compiling for MinGW, either the +// _HAVE_MINGW_H or _HAVE__MINGW_H (note the extra underscore) macro must be +// defined; otherwise, detection of conditions specific to MinGW will be +// disabled. + +// For MinGW version 4.x (and higher), check to see if the _USE_32BIT_TIME_T +// define is required to maintain binary compatibility with the MSVC runtime +// library in use (e.g. for Windows XP). + +// The public SQLite interface. The _FILE_OFFSET_BITS macro must appear +// first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for +// MinGW. +//************* Include sqlite3.h in the middle of sqliteInt.h ************** +//************* Begin file sqlite3.h **************************************** +// 2001-09-15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface that the SQLite library +// presents to client programs. If a C-function, structure, datatype, +// or constant definition does not appear in this file, then it is +// not a published API of SQLite, is subject to change without +// notice, and should not be referenced by programs that use SQLite. +// +// Some of the definitions that are in this file are marked as +// "experimental". Experimental interfaces are normally new +// features recently added to SQLite. We do not anticipate changes +// to experimental interfaces but reserve the right to make minor changes +// if experience from use "in the wild" suggest such changes are prudent. +// +// The official C-language API documentation for SQLite is derived +// from comments in this file. This file is the authoritative source +// on how SQLite interfaces are supposed to operate. +// +// The name of this file under configuration management is "sqlite.h.in". +// The makefile makes some minor changes to this file (such as inserting +// the version number) and changes its name to "sqlite3.h" as +// part of the build process. +// Copyright (C) 1989-2020 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. +// +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// ISO C Standard: 7.15 Variable arguments + +// Define __gnuc_va_list. + +type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:40:27 */ + +// Define the standard macros for the user, +// if this invocation was from the user program. + +// Define va_list, if desired, from __gnuc_va_list. +// We deliberately do not define va_list when called from +// stdio.h, because ANSI C says that stdio.h is not supposed to define +// va_list. stdio.h needs to have access to that data type, +// but must not use that name. It should use the name __gnuc_va_list, +// which is safe because it is reserved for the implementation. + +// The macro _VA_LIST_ is the same thing used by this file in Ultrix. +// But on BSD NET2 we must not test or define or undef it. +// (Note that the comments in NET 2's ansi.h +// are incorrect for _VA_LIST_--see stdio.h!) +// The macro _VA_LIST_DEFINED is used in Windows NT 3.5 +// The macro _VA_LIST is used in SCO Unix 3.2. +// The macro _VA_LIST_T_H is used in the Bull dpx2 +// The macro __va_list__ is used by BeOS. +type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ + +// Make sure we can call this stuff from C++. + +// Provide the ability to override linkage features of the interface. + +// These no-op macros are used in front of interfaces to mark those +// interfaces as either deprecated or experimental. New applications +// should not use deprecated interfaces - they are supported for backwards +// compatibility only. Application writers should be aware that +// experimental interfaces are subject to change in point releases. +// +// These macros used to resolve to various kinds of compiler magic that +// would generate warning messages when they were used. But that +// compiler magic ended up generating such a flurry of bug reports +// that we have taken it all out and gone back to using simple +// noop macros. + +// Ensure these symbols were not defined by some previous header file. + +// CAPI3REF: Compile-Time Library Version Numbers +// +// ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header +// evaluates to a string literal that is the SQLite version in the +// format "X.Y.Z" where X is the major version number (always 3 for +// SQLite3) and Y is the minor version number and Z is the release number.)^ +// ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer +// with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same +// numbers used in [SQLITE_VERSION].)^ +// The SQLITE_VERSION_NUMBER for any given release of SQLite will also +// be larger than the release from which it is derived. Either Y will +// be held constant and Z will be incremented or else Y will be incremented +// and Z will be reset to zero. +// +// Since [version 3.6.18] ([dateof:3.6.18]), +// SQLite source code has been stored in the +// Fossil configuration management +// system. ^The SQLITE_SOURCE_ID macro evaluates to +// a string which identifies a particular check-in of SQLite +// within its configuration management system. ^The SQLITE_SOURCE_ID +// string contains the date and time of the check-in (UTC) and a SHA1 +// or SHA3-256 hash of the entire source tree. If the source code has +// been edited in any way since it was last checked in, then the last +// four hexadecimal digits of the hash may be modified. +// +// See also: [sqlite3_libversion()], +// [sqlite3_libversion_number()], [sqlite3_sourceid()], +// [sqlite_version()] and [sqlite_source_id()]. + +// CAPI3REF: Run-Time Library Version Numbers +// KEYWORDS: sqlite3_version sqlite3_sourceid +// +// These interfaces provide the same information as the [SQLITE_VERSION], +// [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros +// but are associated with the library instead of the header file. ^(Cautious +// programmers might include assert() statements in their application to +// verify that values returned by these interfaces match the macros in +// the header, and thus ensure that the application is +// compiled with matching library and header files. +// +// +// assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); +// assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 ); +// assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); +// +// +// ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] +// macro. ^The sqlite3_libversion() function returns a pointer to the +// to the sqlite3_version[] string constant. The sqlite3_libversion() +// function is provided for use in DLLs since DLL users usually do not have +// direct access to string constants within the DLL. ^The +// sqlite3_libversion_number() function returns an integer equal to +// [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns +// a pointer to a string constant whose value is the same as the +// [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built +// using an edited copy of [the amalgamation], then the last four characters +// of the hash might be different from [SQLITE_SOURCE_ID].)^ +// +// See also: [sqlite_version()] and [sqlite_source_id()]. +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 312 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ + +// CAPI3REF: Database Connection Handle +// KEYWORDS: {database connection} {database connections} +// +// Each open SQLite database is represented by a pointer to an instance of +// the opaque structure named "sqlite3". It is useful to think of an sqlite3 +// pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and +// [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] +// and [sqlite3_close_v2()] are its destructors. There are many other +// interfaces (such as +// [sqlite3_prepare_v2()], [sqlite3_create_function()], and +// [sqlite3_busy_timeout()] to name but three) that are methods on an +// sqlite3 object. +type sqlite3 = struct { + FpVfs uintptr + FpVdbe uintptr + FpDfltColl uintptr + Fmutex uintptr + FaDb uintptr + FnDb int32 + FmDbFlags U32 + Fflags U64 + FlastRowid I64 + FszMmap I64 + FnSchemaLock U32 + FopenFlags uint32 + FerrCode int32 + FerrMask int32 + FiSysErrno int32 + FdbOptFlags U32 + Fenc U8 + FautoCommit U8 + Ftemp_store U8 + FmallocFailed U8 + FbBenignMalloc U8 + FdfltLockMode U8 + FnextAutovac int8 + FsuppressErr U8 + FvtabOnConflict U8 + FisTransactionSavepoint U8 + FmTrace U8 + FnoSharedCache U8 + FnSqlExec U8 + _ [3]byte + FnextPagesize int32 + Fmagic U32 + FnChange int32 + FnTotalChange int32 + FaLimit [12]int32 + FnMaxSorterMmap int32 + _ [4]byte + Finit struct { + FnewTnum Pgno + FiDb U8 + Fbusy U8 + _ [2]byte + ForphanTrigger uint8 /* unsigned orphanTrigger: 1, unsigned imposterTable: 1, unsigned reopenMemdb: 1 */ + _ [7]byte + FazInit uintptr + } + FnVdbeActive int32 + FnVdbeRead int32 + FnVdbeWrite int32 + FnVdbeExec int32 + FnVDestroy int32 + FnExtension int32 + FaExtension uintptr + Ftrace struct{ FxLegacy uintptr } + FpTraceArg uintptr + FxProfile uintptr + FpProfileArg uintptr + FpCommitArg uintptr + FxCommitCallback uintptr + FpRollbackArg uintptr + FxRollbackCallback uintptr + FpUpdateArg uintptr + FxUpdateCallback uintptr + FpParse uintptr + FpPreUpdateArg uintptr + FxPreUpdateCallback uintptr + FpPreUpdate uintptr + FxWalCallback uintptr + FpWalArg uintptr + FxCollNeeded uintptr + FxCollNeeded16 uintptr + FpCollNeededArg uintptr + FpErr uintptr + Fu1 struct { + _ [0]uint64 + FisInterrupted int32 + _ [4]byte + } + Flookaside Lookaside + FxAuth Sqlite3_xauth + FpAuthArg uintptr + FxProgress uintptr + FpProgressArg uintptr + FnProgressOps uint32 + FnVTrans int32 + FaModule Hash + FpVtabCtx uintptr + FaVTrans uintptr + FpDisconnect uintptr + FaFunc Hash + FaCollSeq Hash + FbusyHandler BusyHandler + FaDbStatic [2]Db + FpSavepoint uintptr + FnAnalysisLimit int32 + FbusyTimeout int32 + FnSavepoint int32 + FnStatement int32 + FnDeferredCons I64 + FnDeferredImmCons I64 + FpnBytesFreed uintptr + FpBlockingConnection uintptr + FpUnlockConnection uintptr + FpUnlockArg uintptr + FxUnlockNotify uintptr + FpNextBlocked uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: Database Connection Handle +// KEYWORDS: {database connection} {database connections} +// +// Each open SQLite database is represented by a pointer to an instance of +// the opaque structure named "sqlite3". It is useful to think of an sqlite3 +// pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and +// [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] +// and [sqlite3_close_v2()] are its destructors. There are many other +// interfaces (such as +// [sqlite3_prepare_v2()], [sqlite3_create_function()], and +// [sqlite3_busy_timeout()] to name but three) that are methods on an +// sqlite3 object. +type Sqlite3 = sqlite3 /* sqlite3.c:1331:24 */ + +// CAPI3REF: 64-Bit Integer Types +// KEYWORDS: sqlite_int64 sqlite_uint64 +// +// Because there is no cross-platform way to specify 64-bit integer types +// SQLite includes typedefs for 64-bit signed and unsigned integers. +// +// The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. +// The sqlite_int64 and sqlite_uint64 types are supported for backwards +// compatibility only. +// +// ^The sqlite3_int64 and sqlite_int64 types can store integer values +// between -9223372036854775808 and +9223372036854775807 inclusive. ^The +// sqlite3_uint64 and sqlite_uint64 types can store integer values +// between 0 and +18446744073709551615 inclusive. +type Sqlite_int64 = int64 /* sqlite3.c:1360:25 */ +type Sqlite_uint64 = uint64 /* sqlite3.c:1361:34 */ +type Sqlite3_int64 = Sqlite_int64 /* sqlite3.c:1363:22 */ +type Sqlite3_uint64 = Sqlite_uint64 /* sqlite3.c:1364:23 */ + +// The type for a callback function. +// This is legacy and deprecated. It is included for historical +// compatibility and is not documented. +type Sqlite3_callback = uintptr /* sqlite3.c:1420:13 */ + +// CAPI3REF: Result Codes +// KEYWORDS: {result code definitions} +// +// Many SQLite functions return an integer result code from the set shown +// here in order to indicate success or failure. +// +// New error codes may be added in future versions of SQLite. +// +// See also: [extended result code definitions] +// beginning-of-error-codes +// end-of-error-codes + +// CAPI3REF: Extended Result Codes +// KEYWORDS: {extended result code definitions} +// +// In its default configuration, SQLite API routines return one of 30 integer +// [result codes]. However, experience has shown that many of +// these result codes are too coarse-grained. They do not provide as +// much information about problems as programmers might like. In an effort to +// address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8] +// and later) include +// support for additional result codes that provide more detailed information +// about errors. These [extended result codes] are enabled or disabled +// on a per database connection basis using the +// [sqlite3_extended_result_codes()] API. Or, the extended code for +// the most recent error can be obtained using +// [sqlite3_extended_errcode()]. + +// CAPI3REF: Flags For File Open Operations +// +// These bit values are intended for use in the +// 3rd parameter to the [sqlite3_open_v2()] interface and +// in the 4th parameter to the [sqlite3_vfs.xOpen] method. + +// Reserved: 0x00F00000 +// Legacy compatibility: + +// CAPI3REF: Device Characteristics +// +// The xDeviceCharacteristics method of the [sqlite3_io_methods] +// object returns an integer which is a vector of these +// bit values expressing I/O characteristics of the mass storage +// device that holds the file that the [sqlite3_io_methods] +// refers to. +// +// The SQLITE_IOCAP_ATOMIC property means that all writes of +// any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +// mean that writes of blocks that are nnn bytes in size and +// are aligned to an address which is an integer multiple of +// nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +// that when data is appended to a file, the data is appended +// first then the size of the file is extended, never the other +// way around. The SQLITE_IOCAP_SEQUENTIAL property means that +// information is written to disk in the same order as calls +// to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that +// after reboot following a crash or power loss, the only bytes in a +// file that were written at the application level might have changed +// and that adjacent bytes, even bytes within the same sector are +// guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN +// flag indicates that a file cannot be deleted when open. The +// SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on +// read-only media and cannot be changed even by processes with +// elevated privileges. +// +// The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying +// filesystem supports doing multiple write operations atomically when those +// write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and +// [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. + +// CAPI3REF: File Locking Levels +// +// SQLite uses one of these integer values as the second +// argument to calls it makes to the xLock() and xUnlock() methods +// of an [sqlite3_io_methods] object. + +// CAPI3REF: Synchronization Type Flags +// +// When SQLite invokes the xSync() method of an +// [sqlite3_io_methods] object it uses a combination of +// these integer values as the second argument. +// +// When the SQLITE_SYNC_DATAONLY flag is used, it means that the +// sync operation only needs to flush data to mass storage. Inode +// information need not be flushed. If the lower four bits of the flag +// equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. +// If the lower four bits equal SQLITE_SYNC_FULL, that means +// to use Mac OS X style fullsync instead of fsync(). +// +// Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags +// with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL +// settings. The [synchronous pragma] determines when calls to the +// xSync VFS method occur and applies uniformly across all platforms. +// The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how +// energetic or rigorous or forceful the sync operations are and +// only make a difference on Mac OSX for the default SQLite code. +// (Third-party VFS implementations might also make the distinction +// between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the +// operating systems natively supported by SQLite, only Mac OSX +// cares about the difference.) + +// CAPI3REF: OS Interface Open File Handle +// +// An [sqlite3_file] object represents an open file in the +// [sqlite3_vfs | OS interface layer]. Individual OS interface +// implementations will +// want to subclass this object by appending additional fields +// for their own use. The pMethods entry is a pointer to an +// [sqlite3_io_methods] object that defines methods for performing +// I/O operations on the open file. +type sqlite3_file = struct{ FpMethods uintptr } /* sqlite3.c:1331:9 */ + +// CAPI3REF: Result Codes +// KEYWORDS: {result code definitions} +// +// Many SQLite functions return an integer result code from the set shown +// here in order to indicate success or failure. +// +// New error codes may be added in future versions of SQLite. +// +// See also: [extended result code definitions] +// beginning-of-error-codes +// end-of-error-codes + +// CAPI3REF: Extended Result Codes +// KEYWORDS: {extended result code definitions} +// +// In its default configuration, SQLite API routines return one of 30 integer +// [result codes]. However, experience has shown that many of +// these result codes are too coarse-grained. They do not provide as +// much information about problems as programmers might like. In an effort to +// address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8] +// and later) include +// support for additional result codes that provide more detailed information +// about errors. These [extended result codes] are enabled or disabled +// on a per database connection basis using the +// [sqlite3_extended_result_codes()] API. Or, the extended code for +// the most recent error can be obtained using +// [sqlite3_extended_errcode()]. + +// CAPI3REF: Flags For File Open Operations +// +// These bit values are intended for use in the +// 3rd parameter to the [sqlite3_open_v2()] interface and +// in the 4th parameter to the [sqlite3_vfs.xOpen] method. + +// Reserved: 0x00F00000 +// Legacy compatibility: + +// CAPI3REF: Device Characteristics +// +// The xDeviceCharacteristics method of the [sqlite3_io_methods] +// object returns an integer which is a vector of these +// bit values expressing I/O characteristics of the mass storage +// device that holds the file that the [sqlite3_io_methods] +// refers to. +// +// The SQLITE_IOCAP_ATOMIC property means that all writes of +// any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +// mean that writes of blocks that are nnn bytes in size and +// are aligned to an address which is an integer multiple of +// nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +// that when data is appended to a file, the data is appended +// first then the size of the file is extended, never the other +// way around. The SQLITE_IOCAP_SEQUENTIAL property means that +// information is written to disk in the same order as calls +// to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that +// after reboot following a crash or power loss, the only bytes in a +// file that were written at the application level might have changed +// and that adjacent bytes, even bytes within the same sector are +// guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN +// flag indicates that a file cannot be deleted when open. The +// SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on +// read-only media and cannot be changed even by processes with +// elevated privileges. +// +// The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying +// filesystem supports doing multiple write operations atomically when those +// write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and +// [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. + +// CAPI3REF: File Locking Levels +// +// SQLite uses one of these integer values as the second +// argument to calls it makes to the xLock() and xUnlock() methods +// of an [sqlite3_io_methods] object. + +// CAPI3REF: Synchronization Type Flags +// +// When SQLite invokes the xSync() method of an +// [sqlite3_io_methods] object it uses a combination of +// these integer values as the second argument. +// +// When the SQLITE_SYNC_DATAONLY flag is used, it means that the +// sync operation only needs to flush data to mass storage. Inode +// information need not be flushed. If the lower four bits of the flag +// equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. +// If the lower four bits equal SQLITE_SYNC_FULL, that means +// to use Mac OS X style fullsync instead of fsync(). +// +// Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags +// with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL +// settings. The [synchronous pragma] determines when calls to the +// xSync VFS method occur and applies uniformly across all platforms. +// The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how +// energetic or rigorous or forceful the sync operations are and +// only make a difference on Mac OSX for the default SQLite code. +// (Third-party VFS implementations might also make the distinction +// between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the +// operating systems natively supported by SQLite, only Mac OSX +// cares about the difference.) + +// CAPI3REF: OS Interface Open File Handle +// +// An [sqlite3_file] object represents an open file in the +// [sqlite3_vfs | OS interface layer]. Individual OS interface +// implementations will +// want to subclass this object by appending additional fields +// for their own use. The pMethods entry is a pointer to an +// [sqlite3_io_methods] object that defines methods for performing +// I/O operations on the open file. +type Sqlite3_file = sqlite3_file /* sqlite3.c:1766:29 */ +type sqlite3_io_methods = struct { + FiVersion int32 + _ [4]byte + FxClose uintptr + FxRead uintptr + FxWrite uintptr + FxTruncate uintptr + FxSync uintptr + FxFileSize uintptr + FxLock uintptr + FxUnlock uintptr + FxCheckReservedLock uintptr + FxFileControl uintptr + FxSectorSize uintptr + FxDeviceCharacteristics uintptr + FxShmMap uintptr + FxShmLock uintptr + FxShmBarrier uintptr + FxShmUnmap uintptr + FxFetch uintptr + FxUnfetch uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: OS Interface File Virtual Methods Object +// +// Every file opened by the [sqlite3_vfs.xOpen] method populates an +// [sqlite3_file] object (or, more commonly, a subclass of the +// [sqlite3_file] object) with a pointer to an instance of this object. +// This object defines the methods used to perform various operations +// against the open file represented by the [sqlite3_file] object. +// +// If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element +// to a non-NULL pointer, then the sqlite3_io_methods.xClose method +// may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The +// only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] +// is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element +// to NULL. +// +// The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or +// [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). +// The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] +// flag may be ORed in to indicate that only the data of the file +// and not its inode needs to be synced. +// +// The integer values to xLock() and xUnlock() are one of +//
    +//
  • [SQLITE_LOCK_NONE], +//
  • [SQLITE_LOCK_SHARED], +//
  • [SQLITE_LOCK_RESERVED], +//
  • [SQLITE_LOCK_PENDING], or +//
  • [SQLITE_LOCK_EXCLUSIVE]. +//
+// xLock() increases the lock. xUnlock() decreases the lock. +// The xCheckReservedLock() method checks whether any database connection, +// either in this process or in some other process, is holding a RESERVED, +// PENDING, or EXCLUSIVE lock on the file. It returns true +// if such a lock exists and false otherwise. +// +// The xFileControl() method is a generic interface that allows custom +// VFS implementations to directly control an open file using the +// [sqlite3_file_control()] interface. The second "op" argument is an +// integer opcode. The third argument is a generic pointer intended to +// point to a structure that may contain arguments or space in which to +// write return values. Potential uses for xFileControl() might be +// functions to enable blocking locks with timeouts, to change the +// locking strategy (for example to use dot-file locks), to inquire +// about the status of a lock, or to break stale locks. The SQLite +// core reserves all opcodes less than 100 for its own use. +// A [file control opcodes | list of opcodes] less than 100 is available. +// Applications that define a custom xFileControl method should use opcodes +// greater than 100 to avoid conflicts. VFS implementations should +// return [SQLITE_NOTFOUND] for file control opcodes that they do not +// recognize. +// +// The xSectorSize() method returns the sector size of the +// device that underlies the file. The sector size is the +// minimum write that can be performed without disturbing +// other bytes in the file. The xDeviceCharacteristics() +// method returns a bit vector describing behaviors of the +// underlying device: +// +//
    +//
  • [SQLITE_IOCAP_ATOMIC] +//
  • [SQLITE_IOCAP_ATOMIC512] +//
  • [SQLITE_IOCAP_ATOMIC1K] +//
  • [SQLITE_IOCAP_ATOMIC2K] +//
  • [SQLITE_IOCAP_ATOMIC4K] +//
  • [SQLITE_IOCAP_ATOMIC8K] +//
  • [SQLITE_IOCAP_ATOMIC16K] +//
  • [SQLITE_IOCAP_ATOMIC32K] +//
  • [SQLITE_IOCAP_ATOMIC64K] +//
  • [SQLITE_IOCAP_SAFE_APPEND] +//
  • [SQLITE_IOCAP_SEQUENTIAL] +//
  • [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN] +//
  • [SQLITE_IOCAP_POWERSAFE_OVERWRITE] +//
  • [SQLITE_IOCAP_IMMUTABLE] +//
  • [SQLITE_IOCAP_BATCH_ATOMIC] +//
+// +// The SQLITE_IOCAP_ATOMIC property means that all writes of +// any size are atomic. The SQLITE_IOCAP_ATOMICnnn values +// mean that writes of blocks that are nnn bytes in size and +// are aligned to an address which is an integer multiple of +// nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means +// that when data is appended to a file, the data is appended +// first then the size of the file is extended, never the other +// way around. The SQLITE_IOCAP_SEQUENTIAL property means that +// information is written to disk in the same order as calls +// to xWrite(). +// +// If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill +// in the unread portions of the buffer with zeros. A VFS that +// fails to zero-fill short reads might seem to work. However, +// failure to zero-fill short reads will eventually lead to +// database corruption. +type Sqlite3_io_methods = sqlite3_io_methods /* sqlite3.c:1865:35 */ + +// CAPI3REF: Loadable Extension Thunk +// +// A pointer to the opaque sqlite3_api_routines structure is passed as +// the third parameter to entry points of [loadable extensions]. This +// structure must be typedefed in order to work around compiler warnings +// on some platforms. +type sqlite3_api_routines = struct { + Faggregate_context uintptr + Faggregate_count uintptr + Fbind_blob uintptr + Fbind_double uintptr + Fbind_int uintptr + Fbind_int64 uintptr + Fbind_null uintptr + Fbind_parameter_count uintptr + Fbind_parameter_index uintptr + Fbind_parameter_name uintptr + Fbind_text uintptr + Fbind_text16 uintptr + Fbind_value uintptr + Fbusy_handler uintptr + Fbusy_timeout uintptr + Fchanges uintptr + Fclose uintptr + Fcollation_needed uintptr + Fcollation_needed16 uintptr + Fcolumn_blob uintptr + Fcolumn_bytes uintptr + Fcolumn_bytes16 uintptr + Fcolumn_count uintptr + Fcolumn_database_name uintptr + Fcolumn_database_name16 uintptr + Fcolumn_decltype uintptr + Fcolumn_decltype16 uintptr + Fcolumn_double uintptr + Fcolumn_int uintptr + Fcolumn_int64 uintptr + Fcolumn_name uintptr + Fcolumn_name16 uintptr + Fcolumn_origin_name uintptr + Fcolumn_origin_name16 uintptr + Fcolumn_table_name uintptr + Fcolumn_table_name16 uintptr + Fcolumn_text uintptr + Fcolumn_text16 uintptr + Fcolumn_type uintptr + Fcolumn_value uintptr + Fcommit_hook uintptr + Fcomplete uintptr + Fcomplete16 uintptr + Fcreate_collation uintptr + Fcreate_collation16 uintptr + Fcreate_function uintptr + Fcreate_function16 uintptr + Fcreate_module uintptr + Fdata_count uintptr + Fdb_handle uintptr + Fdeclare_vtab uintptr + Fenable_shared_cache uintptr + Ferrcode uintptr + Ferrmsg uintptr + Ferrmsg16 uintptr + Fexec uintptr + Fexpired uintptr + Ffinalize uintptr + Ffree uintptr + Ffree_table uintptr + Fget_autocommit uintptr + Fget_auxdata uintptr + Fget_table uintptr + Fglobal_recover uintptr + Finterruptx uintptr + Flast_insert_rowid uintptr + Flibversion uintptr + Flibversion_number uintptr + Fmalloc uintptr + Fmprintf uintptr + Fopen uintptr + Fopen16 uintptr + Fprepare uintptr + Fprepare16 uintptr + Fprofile uintptr + Fprogress_handler uintptr + Frealloc uintptr + Freset uintptr + Fresult_blob uintptr + Fresult_double uintptr + Fresult_error uintptr + Fresult_error16 uintptr + Fresult_int uintptr + Fresult_int64 uintptr + Fresult_null uintptr + Fresult_text uintptr + Fresult_text16 uintptr + Fresult_text16be uintptr + Fresult_text16le uintptr + Fresult_value uintptr + Frollback_hook uintptr + Fset_authorizer uintptr + Fset_auxdata uintptr + Fxsnprintf uintptr + Fstep uintptr + Ftable_column_metadata uintptr + Fthread_cleanup uintptr + Ftotal_changes uintptr + Ftrace uintptr + Ftransfer_bindings uintptr + Fupdate_hook uintptr + Fuser_data uintptr + Fvalue_blob uintptr + Fvalue_bytes uintptr + Fvalue_bytes16 uintptr + Fvalue_double uintptr + Fvalue_int uintptr + Fvalue_int64 uintptr + Fvalue_numeric_type uintptr + Fvalue_text uintptr + Fvalue_text16 uintptr + Fvalue_text16be uintptr + Fvalue_text16le uintptr + Fvalue_type uintptr + Fvmprintf uintptr + Foverload_function uintptr + Fprepare_v2 uintptr + Fprepare16_v2 uintptr + Fclear_bindings uintptr + Fcreate_module_v2 uintptr + Fbind_zeroblob uintptr + Fblob_bytes uintptr + Fblob_close uintptr + Fblob_open uintptr + Fblob_read uintptr + Fblob_write uintptr + Fcreate_collation_v2 uintptr + Ffile_control uintptr + Fmemory_highwater uintptr + Fmemory_used uintptr + Fmutex_alloc uintptr + Fmutex_enter uintptr + Fmutex_free uintptr + Fmutex_leave uintptr + Fmutex_try uintptr + Fopen_v2 uintptr + Frelease_memory uintptr + Fresult_error_nomem uintptr + Fresult_error_toobig uintptr + Fsleep uintptr + Fsoft_heap_limit uintptr + Fvfs_find uintptr + Fvfs_register uintptr + Fvfs_unregister uintptr + Fxthreadsafe uintptr + Fresult_zeroblob uintptr + Fresult_error_code uintptr + Ftest_control uintptr + Frandomness uintptr + Fcontext_db_handle uintptr + Fextended_result_codes uintptr + Flimit uintptr + Fnext_stmt uintptr + Fsql uintptr + Fstatus uintptr + Fbackup_finish uintptr + Fbackup_init uintptr + Fbackup_pagecount uintptr + Fbackup_remaining uintptr + Fbackup_step uintptr + Fcompileoption_get uintptr + Fcompileoption_used uintptr + Fcreate_function_v2 uintptr + Fdb_config uintptr + Fdb_mutex uintptr + Fdb_status uintptr + Fextended_errcode uintptr + Flog uintptr + Fsoft_heap_limit64 uintptr + Fsourceid uintptr + Fstmt_status uintptr + Fstrnicmp uintptr + Funlock_notify uintptr + Fwal_autocheckpoint uintptr + Fwal_checkpoint uintptr + Fwal_hook uintptr + Fblob_reopen uintptr + Fvtab_config uintptr + Fvtab_on_conflict uintptr + Fclose_v2 uintptr + Fdb_filename uintptr + Fdb_readonly uintptr + Fdb_release_memory uintptr + Ferrstr uintptr + Fstmt_busy uintptr + Fstmt_readonly uintptr + Fstricmp uintptr + Furi_boolean uintptr + Furi_int64 uintptr + Furi_parameter uintptr + Fxvsnprintf uintptr + Fwal_checkpoint_v2 uintptr + Fauto_extension uintptr + Fbind_blob64 uintptr + Fbind_text64 uintptr + Fcancel_auto_extension uintptr + Fload_extension uintptr + Fmalloc64 uintptr + Fmsize uintptr + Frealloc64 uintptr + Freset_auto_extension uintptr + Fresult_blob64 uintptr + Fresult_text64 uintptr + Fstrglob uintptr + Fvalue_dup uintptr + Fvalue_free uintptr + Fresult_zeroblob64 uintptr + Fbind_zeroblob64 uintptr + Fvalue_subtype uintptr + Fresult_subtype uintptr + Fstatus64 uintptr + Fstrlike uintptr + Fdb_cacheflush uintptr + Fsystem_errno uintptr + Ftrace_v2 uintptr + Fexpanded_sql uintptr + Fset_last_insert_rowid uintptr + Fprepare_v3 uintptr + Fprepare16_v3 uintptr + Fbind_pointer uintptr + Fresult_pointer uintptr + Fvalue_pointer uintptr + Fvtab_nochange uintptr + Fvalue_nochange uintptr + Fvtab_collation uintptr + Fkeyword_count uintptr + Fkeyword_name uintptr + Fkeyword_check uintptr + Fstr_new uintptr + Fstr_finish uintptr + Fstr_appendf uintptr + Fstr_vappendf uintptr + Fstr_append uintptr + Fstr_appendall uintptr + Fstr_appendchar uintptr + Fstr_reset uintptr + Fstr_errcode uintptr + Fstr_length uintptr + Fstr_value uintptr + Fcreate_window_function uintptr + Fnormalized_sql uintptr + Fstmt_isexplain uintptr + Fvalue_frombind uintptr + Fdrop_modules uintptr + Fhard_heap_limit64 uintptr + Furi_key uintptr + Ffilename_database uintptr + Ffilename_journal uintptr + Ffilename_wal uintptr + Fcreate_filename uintptr + Ffree_filename uintptr + Fdatabase_file_object uintptr + Ftxn_state uintptr +} /* sqlite3.c:2298:9 */ + +// CAPI3REF: Loadable Extension Thunk +// +// A pointer to the opaque sqlite3_api_routines structure is passed as +// the third parameter to entry points of [loadable extensions]. This +// structure must be typedefed in order to work around compiler warnings +// on some platforms. +type Sqlite3_api_routines = sqlite3_api_routines /* sqlite3.c:2298:37 */ + +// CAPI3REF: OS Interface Object +// +// An instance of the sqlite3_vfs object defines the interface between +// the SQLite core and the underlying operating system. The "vfs" +// in the name of the object stands for "virtual file system". See +// the [VFS | VFS documentation] for further information. +// +// The VFS interface is sometimes extended by adding new methods onto +// the end. Each time such an extension occurs, the iVersion field +// is incremented. The iVersion value started out as 1 in +// SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 +// with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased +// to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields +// may be appended to the sqlite3_vfs object and the iVersion value +// may increase again in future versions of SQLite. +// Note that due to an oversight, the structure +// of the sqlite3_vfs object changed in the transition from +// SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] +// and yet the iVersion field was not increased. +// +// The szOsFile field is the size of the subclassed [sqlite3_file] +// structure used by this VFS. mxPathname is the maximum length of +// a pathname in this VFS. +// +// Registered sqlite3_vfs objects are kept on a linked list formed by +// the pNext pointer. The [sqlite3_vfs_register()] +// and [sqlite3_vfs_unregister()] interfaces manage this list +// in a thread-safe way. The [sqlite3_vfs_find()] interface +// searches the list. Neither the application code nor the VFS +// implementation should use the pNext pointer. +// +// The pNext field is the only field in the sqlite3_vfs +// structure that SQLite will ever modify. SQLite will only access +// or modify this field while holding a particular static mutex. +// The application should never modify anything within the sqlite3_vfs +// object once the object has been registered. +// +// The zName field holds the name of the VFS module. The name must +// be unique across all VFS modules. +// +// [[sqlite3_vfs.xOpen]] +// ^SQLite guarantees that the zFilename parameter to xOpen +// is either a NULL pointer or string obtained +// from xFullPathname() with an optional suffix added. +// ^If a suffix is added to the zFilename parameter, it will +// consist of a single "-" character followed by no more than +// 11 alphanumeric and/or "-" characters. +// ^SQLite further guarantees that +// the string will be valid and unchanged until xClose() is +// called. Because of the previous sentence, +// the [sqlite3_file] can safely store a pointer to the +// filename if it needs to remember the filename for some reason. +// If the zFilename parameter to xOpen is a NULL pointer then xOpen +// must invent its own temporary name for the file. ^Whenever the +// xFilename parameter is NULL it will also be the case that the +// flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. +// +// The flags argument to xOpen() includes all bits set in +// the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] +// or [sqlite3_open16()] is used, then flags includes at least +// [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. +// If xOpen() opens a file read-only then it sets *pOutFlags to +// include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. +// +// ^(SQLite will also add one of the following flags to the xOpen() +// call, depending on the object being opened: +// +//
    +//
  • [SQLITE_OPEN_MAIN_DB] +//
  • [SQLITE_OPEN_MAIN_JOURNAL] +//
  • [SQLITE_OPEN_TEMP_DB] +//
  • [SQLITE_OPEN_TEMP_JOURNAL] +//
  • [SQLITE_OPEN_TRANSIENT_DB] +//
  • [SQLITE_OPEN_SUBJOURNAL] +//
  • [SQLITE_OPEN_SUPER_JOURNAL] +//
  • [SQLITE_OPEN_WAL] +//
)^ +// +// The file I/O implementation can use the object type flags to +// change the way it deals with files. For example, an application +// that does not care about crash recovery or rollback might make +// the open of a journal file a no-op. Writes to this journal would +// also be no-ops, and any attempt to read the journal would return +// SQLITE_IOERR. Or the implementation might recognize that a database +// file will be doing page-aligned sector reads and writes in a random +// order and set up its I/O subsystem accordingly. +// +// SQLite might also add one of the following flags to the xOpen method: +// +//
    +//
  • [SQLITE_OPEN_DELETEONCLOSE] +//
  • [SQLITE_OPEN_EXCLUSIVE] +//
+// +// The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be +// deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] +// will be set for TEMP databases and their journals, transient +// databases, and subjournals. +// +// ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction +// with the [SQLITE_OPEN_CREATE] flag, which are both directly +// analogous to the O_EXCL and O_CREAT flags of the POSIX open() +// API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the +// SQLITE_OPEN_CREATE, is used to indicate that file should always +// be created, and that it is an error if it already exists. +// It is not used to indicate the file should be opened +// for exclusive access. +// +// ^At least szOsFile bytes of memory are allocated by SQLite +// to hold the [sqlite3_file] structure passed as the third +// argument to xOpen. The xOpen method does not have to +// allocate the structure; it should just fill it in. Note that +// the xOpen method must set the sqlite3_file.pMethods to either +// a valid [sqlite3_io_methods] object or to NULL. xOpen must do +// this even if the open fails. SQLite expects that the sqlite3_file.pMethods +// element will be valid after xOpen returns regardless of the success +// or failure of the xOpen call. +// +// [[sqlite3_vfs.xAccess]] +// ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] +// to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to +// test whether a file is readable and writable, or [SQLITE_ACCESS_READ] +// to test whether a file is at least readable. The SQLITE_ACCESS_READ +// flag is never actually used and is not implemented in the built-in +// VFSes of SQLite. The file is named by the second argument and can be a +// directory. The xAccess method returns [SQLITE_OK] on success or some +// non-zero error code if there is an I/O error or if the name of +// the file given in the second argument is illegal. If SQLITE_OK +// is returned, then non-zero or zero is written into *pResOut to indicate +// whether or not the file is accessible. +// +// ^SQLite will always allocate at least mxPathname+1 bytes for the +// output buffer xFullPathname. The exact size of the output buffer +// is also passed as a parameter to both methods. If the output buffer +// is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is +// handled as a fatal error by SQLite, vfs implementations should endeavor +// to prevent this by setting mxPathname to a sufficiently large value. +// +// The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() +// interfaces are not strictly a part of the filesystem, but they are +// included in the VFS structure for completeness. +// The xRandomness() function attempts to return nBytes bytes +// of good-quality randomness into zOut. The return value is +// the actual number of bytes of randomness obtained. +// The xSleep() method causes the calling thread to sleep for at +// least the number of microseconds given. ^The xCurrentTime() +// method returns a Julian Day Number for the current date and time as +// a floating point value. +// ^The xCurrentTimeInt64() method returns, as an integer, the Julian +// Day Number multiplied by 86400000 (the number of milliseconds in +// a 24-hour day). +// ^SQLite will use the xCurrentTimeInt64() method to get the current +// date and time if that method is available (if iVersion is 2 or +// greater and the function pointer is not NULL) and will fall back +// to xCurrentTime() if xCurrentTimeInt64() is unavailable. +// +// ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces +// are not used by the SQLite core. These optional interfaces are provided +// by some VFSes to facilitate testing of the VFS code. By overriding +// system calls with functions under its control, a test program can +// simulate faults and error conditions that would otherwise be difficult +// or impossible to induce. The set of system calls that can be overridden +// varies from one VFS to another, and from one version of the same VFS to the +// next. Applications that use these interfaces must be prepared for any +// or all of these interfaces to be NULL or for their behavior to change +// from one release to the next. Applications must not attempt to access +// any of these methods if the iVersion of the VFS is less than 3. +type sqlite3_vfs = struct { + FiVersion int32 + FszOsFile int32 + FmxPathname int32 + _ [4]byte + FpNext uintptr + FzName uintptr + FpAppData uintptr + FxOpen uintptr + FxDelete uintptr + FxAccess uintptr + FxFullPathname uintptr + FxDlOpen uintptr + FxDlError uintptr + FxDlSym uintptr + FxDlClose uintptr + FxRandomness uintptr + FxSleep uintptr + FxCurrentTime uintptr + FxGetLastError uintptr + FxCurrentTimeInt64 uintptr + FxSetSystemCall uintptr + FxGetSystemCall uintptr + FxNextSystemCall uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: OS Interface Object +// +// An instance of the sqlite3_vfs object defines the interface between +// the SQLite core and the underlying operating system. The "vfs" +// in the name of the object stands for "virtual file system". See +// the [VFS | VFS documentation] for further information. +// +// The VFS interface is sometimes extended by adding new methods onto +// the end. Each time such an extension occurs, the iVersion field +// is incremented. The iVersion value started out as 1 in +// SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 +// with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased +// to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields +// may be appended to the sqlite3_vfs object and the iVersion value +// may increase again in future versions of SQLite. +// Note that due to an oversight, the structure +// of the sqlite3_vfs object changed in the transition from +// SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] +// and yet the iVersion field was not increased. +// +// The szOsFile field is the size of the subclassed [sqlite3_file] +// structure used by this VFS. mxPathname is the maximum length of +// a pathname in this VFS. +// +// Registered sqlite3_vfs objects are kept on a linked list formed by +// the pNext pointer. The [sqlite3_vfs_register()] +// and [sqlite3_vfs_unregister()] interfaces manage this list +// in a thread-safe way. The [sqlite3_vfs_find()] interface +// searches the list. Neither the application code nor the VFS +// implementation should use the pNext pointer. +// +// The pNext field is the only field in the sqlite3_vfs +// structure that SQLite will ever modify. SQLite will only access +// or modify this field while holding a particular static mutex. +// The application should never modify anything within the sqlite3_vfs +// object once the object has been registered. +// +// The zName field holds the name of the VFS module. The name must +// be unique across all VFS modules. +// +// [[sqlite3_vfs.xOpen]] +// ^SQLite guarantees that the zFilename parameter to xOpen +// is either a NULL pointer or string obtained +// from xFullPathname() with an optional suffix added. +// ^If a suffix is added to the zFilename parameter, it will +// consist of a single "-" character followed by no more than +// 11 alphanumeric and/or "-" characters. +// ^SQLite further guarantees that +// the string will be valid and unchanged until xClose() is +// called. Because of the previous sentence, +// the [sqlite3_file] can safely store a pointer to the +// filename if it needs to remember the filename for some reason. +// If the zFilename parameter to xOpen is a NULL pointer then xOpen +// must invent its own temporary name for the file. ^Whenever the +// xFilename parameter is NULL it will also be the case that the +// flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. +// +// The flags argument to xOpen() includes all bits set in +// the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] +// or [sqlite3_open16()] is used, then flags includes at least +// [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. +// If xOpen() opens a file read-only then it sets *pOutFlags to +// include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. +// +// ^(SQLite will also add one of the following flags to the xOpen() +// call, depending on the object being opened: +// +//
    +//
  • [SQLITE_OPEN_MAIN_DB] +//
  • [SQLITE_OPEN_MAIN_JOURNAL] +//
  • [SQLITE_OPEN_TEMP_DB] +//
  • [SQLITE_OPEN_TEMP_JOURNAL] +//
  • [SQLITE_OPEN_TRANSIENT_DB] +//
  • [SQLITE_OPEN_SUBJOURNAL] +//
  • [SQLITE_OPEN_SUPER_JOURNAL] +//
  • [SQLITE_OPEN_WAL] +//
)^ +// +// The file I/O implementation can use the object type flags to +// change the way it deals with files. For example, an application +// that does not care about crash recovery or rollback might make +// the open of a journal file a no-op. Writes to this journal would +// also be no-ops, and any attempt to read the journal would return +// SQLITE_IOERR. Or the implementation might recognize that a database +// file will be doing page-aligned sector reads and writes in a random +// order and set up its I/O subsystem accordingly. +// +// SQLite might also add one of the following flags to the xOpen method: +// +//
    +//
  • [SQLITE_OPEN_DELETEONCLOSE] +//
  • [SQLITE_OPEN_EXCLUSIVE] +//
+// +// The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be +// deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] +// will be set for TEMP databases and their journals, transient +// databases, and subjournals. +// +// ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction +// with the [SQLITE_OPEN_CREATE] flag, which are both directly +// analogous to the O_EXCL and O_CREAT flags of the POSIX open() +// API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the +// SQLITE_OPEN_CREATE, is used to indicate that file should always +// be created, and that it is an error if it already exists. +// It is not used to indicate the file should be opened +// for exclusive access. +// +// ^At least szOsFile bytes of memory are allocated by SQLite +// to hold the [sqlite3_file] structure passed as the third +// argument to xOpen. The xOpen method does not have to +// allocate the structure; it should just fill it in. Note that +// the xOpen method must set the sqlite3_file.pMethods to either +// a valid [sqlite3_io_methods] object or to NULL. xOpen must do +// this even if the open fails. SQLite expects that the sqlite3_file.pMethods +// element will be valid after xOpen returns regardless of the success +// or failure of the xOpen call. +// +// [[sqlite3_vfs.xAccess]] +// ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] +// to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to +// test whether a file is readable and writable, or [SQLITE_ACCESS_READ] +// to test whether a file is at least readable. The SQLITE_ACCESS_READ +// flag is never actually used and is not implemented in the built-in +// VFSes of SQLite. The file is named by the second argument and can be a +// directory. The xAccess method returns [SQLITE_OK] on success or some +// non-zero error code if there is an I/O error or if the name of +// the file given in the second argument is illegal. If SQLITE_OK +// is returned, then non-zero or zero is written into *pResOut to indicate +// whether or not the file is accessible. +// +// ^SQLite will always allocate at least mxPathname+1 bytes for the +// output buffer xFullPathname. The exact size of the output buffer +// is also passed as a parameter to both methods. If the output buffer +// is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is +// handled as a fatal error by SQLite, vfs implementations should endeavor +// to prevent this by setting mxPathname to a sufficiently large value. +// +// The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() +// interfaces are not strictly a part of the filesystem, but they are +// included in the VFS structure for completeness. +// The xRandomness() function attempts to return nBytes bytes +// of good-quality randomness into zOut. The return value is +// the actual number of bytes of randomness obtained. +// The xSleep() method causes the calling thread to sleep for at +// least the number of microseconds given. ^The xCurrentTime() +// method returns a Julian Day Number for the current date and time as +// a floating point value. +// ^The xCurrentTimeInt64() method returns, as an integer, the Julian +// Day Number multiplied by 86400000 (the number of milliseconds in +// a 24-hour day). +// ^SQLite will use the xCurrentTimeInt64() method to get the current +// date and time if that method is available (if iVersion is 2 or +// greater and the function pointer is not NULL) and will fall back +// to xCurrentTime() if xCurrentTimeInt64() is unavailable. +// +// ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces +// are not used by the SQLite core. These optional interfaces are provided +// by some VFSes to facilitate testing of the VFS code. By overriding +// system calls with functions under its control, a test program can +// simulate faults and error conditions that would otherwise be difficult +// or impossible to induce. The set of system calls that can be overridden +// varies from one VFS to another, and from one version of the same VFS to the +// next. Applications that use these interfaces must be prepared for any +// or all of these interfaces to be NULL or for their behavior to change +// from one release to the next. Applications must not attempt to access +// any of these methods if the iVersion of the VFS is less than 3. +type Sqlite3_vfs = sqlite3_vfs /* sqlite3.c:2469:28 */ +type Sqlite3_syscall_ptr = uintptr /* sqlite3.c:2470:14 */ + +// CAPI3REF: Memory Allocation Routines +// +// An instance of this object defines the interface between SQLite +// and low-level memory allocation routines. +// +// This object is used in only one place in the SQLite interface. +// A pointer to an instance of this object is the argument to +// [sqlite3_config()] when the configuration option is +// [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. +// By creating an instance of this object +// and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) +// during configuration, an application can specify an alternative +// memory allocation subsystem for SQLite to use for all of its +// dynamic memory needs. +// +// Note that SQLite comes with several [built-in memory allocators] +// that are perfectly adequate for the overwhelming majority of applications +// and that this object is only useful to a tiny minority of applications +// with specialized memory allocation requirements. This object is +// also used during testing of SQLite in order to specify an alternative +// memory allocator that simulates memory out-of-memory conditions in +// order to verify that SQLite recovers gracefully from such +// conditions. +// +// The xMalloc, xRealloc, and xFree methods must work like the +// malloc(), realloc() and free() functions from the standard C library. +// ^SQLite guarantees that the second argument to +// xRealloc is always a value returned by a prior call to xRoundup. +// +// xSize should return the allocated size of a memory allocation +// previously obtained from xMalloc or xRealloc. The allocated size +// is always at least as big as the requested size but may be larger. +// +// The xRoundup method returns what would be the allocated size of +// a memory allocation given a particular requested size. Most memory +// allocators round up memory allocations at least to the next multiple +// of 8. Some allocators round up to a larger multiple or to a power of 2. +// Every memory allocation request coming in through [sqlite3_malloc()] +// or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +// that causes the corresponding memory allocation to fail. +// +// The xInit method initializes the memory allocator. For example, +// it might allocate any required mutexes or initialize internal data +// structures. The xShutdown method is invoked (indirectly) by +// [sqlite3_shutdown()] and should deallocate any resources acquired +// by xInit. The pAppData pointer is used as the only parameter to +// xInit and xShutdown. +// +// SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes +// the xInit method, so the xInit method need not be threadsafe. The +// xShutdown method is only called from [sqlite3_shutdown()] so it does +// not need to be threadsafe either. For all other methods, SQLite +// holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the +// [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which +// it is by default) and so the methods are automatically serialized. +// However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other +// methods must be threadsafe or else make their own arrangements for +// serialization. +// +// SQLite will never invoke xInit() more than once without an intervening +// call to xShutdown(). +type sqlite3_mem_methods = struct { + FxMalloc uintptr + FxFree uintptr + FxRealloc uintptr + FxSize uintptr + FxRoundup uintptr + FxInit uintptr + FxShutdown uintptr + FpAppData uintptr +} /* sqlite3.c:2767:9 */ + +// CAPI3REF: Memory Allocation Routines +// +// An instance of this object defines the interface between SQLite +// and low-level memory allocation routines. +// +// This object is used in only one place in the SQLite interface. +// A pointer to an instance of this object is the argument to +// [sqlite3_config()] when the configuration option is +// [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. +// By creating an instance of this object +// and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) +// during configuration, an application can specify an alternative +// memory allocation subsystem for SQLite to use for all of its +// dynamic memory needs. +// +// Note that SQLite comes with several [built-in memory allocators] +// that are perfectly adequate for the overwhelming majority of applications +// and that this object is only useful to a tiny minority of applications +// with specialized memory allocation requirements. This object is +// also used during testing of SQLite in order to specify an alternative +// memory allocator that simulates memory out-of-memory conditions in +// order to verify that SQLite recovers gracefully from such +// conditions. +// +// The xMalloc, xRealloc, and xFree methods must work like the +// malloc(), realloc() and free() functions from the standard C library. +// ^SQLite guarantees that the second argument to +// xRealloc is always a value returned by a prior call to xRoundup. +// +// xSize should return the allocated size of a memory allocation +// previously obtained from xMalloc or xRealloc. The allocated size +// is always at least as big as the requested size but may be larger. +// +// The xRoundup method returns what would be the allocated size of +// a memory allocation given a particular requested size. Most memory +// allocators round up memory allocations at least to the next multiple +// of 8. Some allocators round up to a larger multiple or to a power of 2. +// Every memory allocation request coming in through [sqlite3_malloc()] +// or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, +// that causes the corresponding memory allocation to fail. +// +// The xInit method initializes the memory allocator. For example, +// it might allocate any required mutexes or initialize internal data +// structures. The xShutdown method is invoked (indirectly) by +// [sqlite3_shutdown()] and should deallocate any resources acquired +// by xInit. The pAppData pointer is used as the only parameter to +// xInit and xShutdown. +// +// SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes +// the xInit method, so the xInit method need not be threadsafe. The +// xShutdown method is only called from [sqlite3_shutdown()] so it does +// not need to be threadsafe either. For all other methods, SQLite +// holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the +// [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which +// it is by default) and so the methods are automatically serialized. +// However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other +// methods must be threadsafe or else make their own arrangements for +// serialization. +// +// SQLite will never invoke xInit() more than once without an intervening +// call to xShutdown(). +type Sqlite3_mem_methods = sqlite3_mem_methods /* sqlite3.c:2767:36 */ + +// CAPI3REF: Dynamically Typed Value Object +// KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} +// +// SQLite uses the sqlite3_value object to represent all values +// that can be stored in a database table. SQLite uses dynamic typing +// for the values it stores. ^Values stored in sqlite3_value objects +// can be integers, floating point values, strings, BLOBs, or NULL. +// +// An sqlite3_value object may be either "protected" or "unprotected". +// Some interfaces require a protected sqlite3_value. Other interfaces +// will accept either a protected or an unprotected sqlite3_value. +// Every interface that accepts sqlite3_value arguments specifies +// whether or not it requires a protected sqlite3_value. The +// [sqlite3_value_dup()] interface can be used to construct a new +// protected sqlite3_value from an unprotected sqlite3_value. +// +// The terms "protected" and "unprotected" refer to whether or not +// a mutex is held. An internal mutex is held for a protected +// sqlite3_value object but no mutex is held for an unprotected +// sqlite3_value object. If SQLite is compiled to be single-threaded +// (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) +// or if SQLite is run in one of reduced mutex modes +// [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] +// then there is no distinction between protected and unprotected +// sqlite3_value objects and they can be used interchangeably. However, +// for maximum code portability it is recommended that applications +// still make the distinction between protected and unprotected +// sqlite3_value objects even when not strictly required. +// +// ^The sqlite3_value objects that are passed as parameters into the +// implementation of [application-defined SQL functions] are protected. +// ^The sqlite3_value object returned by +// [sqlite3_column_value()] is unprotected. +// Unprotected sqlite3_value objects may only be used as arguments +// to [sqlite3_result_value()], [sqlite3_bind_value()], and +// [sqlite3_value_dup()]. +// The [sqlite3_value_blob | sqlite3_value_type()] family of +// interfaces require protected sqlite3_value objects. +type sqlite3_value = struct { + Fu struct{ Fr float64 } + Fflags U16 + Fenc U8 + FeSubtype U8 + Fn int32 + Fz uintptr + FzMalloc uintptr + FszMalloc int32 + FuTemp U32 + Fdb uintptr + FxDel uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: Dynamically Typed Value Object +// KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} +// +// SQLite uses the sqlite3_value object to represent all values +// that can be stored in a database table. SQLite uses dynamic typing +// for the values it stores. ^Values stored in sqlite3_value objects +// can be integers, floating point values, strings, BLOBs, or NULL. +// +// An sqlite3_value object may be either "protected" or "unprotected". +// Some interfaces require a protected sqlite3_value. Other interfaces +// will accept either a protected or an unprotected sqlite3_value. +// Every interface that accepts sqlite3_value arguments specifies +// whether or not it requires a protected sqlite3_value. The +// [sqlite3_value_dup()] interface can be used to construct a new +// protected sqlite3_value from an unprotected sqlite3_value. +// +// The terms "protected" and "unprotected" refer to whether or not +// a mutex is held. An internal mutex is held for a protected +// sqlite3_value object but no mutex is held for an unprotected +// sqlite3_value object. If SQLite is compiled to be single-threaded +// (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) +// or if SQLite is run in one of reduced mutex modes +// [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] +// then there is no distinction between protected and unprotected +// sqlite3_value objects and they can be used interchangeably. However, +// for maximum code portability it is recommended that applications +// still make the distinction between protected and unprotected +// sqlite3_value objects even when not strictly required. +// +// ^The sqlite3_value objects that are passed as parameters into the +// implementation of [application-defined SQL functions] are protected. +// ^The sqlite3_value object returned by +// [sqlite3_column_value()] is unprotected. +// Unprotected sqlite3_value objects may only be used as arguments +// to [sqlite3_result_value()], [sqlite3_bind_value()], and +// [sqlite3_value_dup()]. +// The [sqlite3_value_blob | sqlite3_value_type()] family of +// interfaces require protected sqlite3_value objects. +type Sqlite3_value = sqlite3_value /* sqlite3.c:5368:30 */ + +// CAPI3REF: SQL Function Context Object +// +// The context in which an SQL function executes is stored in an +// sqlite3_context object. ^A pointer to an sqlite3_context object +// is always first parameter to [application-defined SQL functions]. +// The application-defined SQL function implementation will pass this +// pointer through into calls to [sqlite3_result_int | sqlite3_result()], +// [sqlite3_aggregate_context()], [sqlite3_user_data()], +// [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], +// and/or [sqlite3_set_auxdata()]. +type sqlite3_context = struct { + FpOut uintptr + FpFunc uintptr + FpMem uintptr + FpVdbe uintptr + FiOp int32 + FisError int32 + FskipFlag U8 + Fargc U8 + _ [6]byte + Fargv [1]uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: SQL Function Context Object +// +// The context in which an SQL function executes is stored in an +// sqlite3_context object. ^A pointer to an sqlite3_context object +// is always first parameter to [application-defined SQL functions]. +// The application-defined SQL function implementation will pass this +// pointer through into calls to [sqlite3_result_int | sqlite3_result()], +// [sqlite3_aggregate_context()], [sqlite3_user_data()], +// [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], +// and/or [sqlite3_set_auxdata()]. +type Sqlite3_context = sqlite3_context /* sqlite3.c:5382:32 */ + +// CAPI3REF: Constants Defining Special Destructor Behavior +// +// These are special values for the destructor that is passed in as the +// final argument to routines like [sqlite3_result_blob()]. ^If the destructor +// argument is SQLITE_STATIC, it means that the content pointer is constant +// and will never change. It does not need to be destroyed. ^The +// SQLITE_TRANSIENT value means that the content will likely change in +// the near future and that SQLite should make its own private copy of +// the content before returning. +// +// The typedef is necessary to work around problems in certain +// C++ compilers. +type Sqlite3_destructor_type = uintptr /* sqlite3.c:6747:14 */ + +// The interface to the virtual-table mechanism is currently considered +// to be experimental. The interface might change in incompatible ways. +// If this is a problem for you, do not use the interface at this time. +// +// When the virtual-table mechanism stabilizes, we will declare the +// interface fixed, support it indefinitely, and remove this comment. + +// Structures used by the virtual table interface +type sqlite3_vtab = struct { + FpModule uintptr + FnRef int32 + _ [4]byte + FzErrMsg uintptr +} /* sqlite3.c:1331:9 */ + +// The interface to the virtual-table mechanism is currently considered +// to be experimental. The interface might change in incompatible ways. +// If this is a problem for you, do not use the interface at this time. +// +// When the virtual-table mechanism stabilizes, we will declare the +// interface fixed, support it indefinitely, and remove this comment. + +// Structures used by the virtual table interface +type Sqlite3_vtab = sqlite3_vtab /* sqlite3.c:7866:29 */ +type sqlite3_index_info = struct { + FnConstraint int32 + _ [4]byte + FaConstraint uintptr + FnOrderBy int32 + _ [4]byte + FaOrderBy uintptr + FaConstraintUsage uintptr + FidxNum int32 + _ [4]byte + FidxStr uintptr + FneedToFreeIdxStr int32 + ForderByConsumed int32 + FestimatedCost float64 + FestimatedRows Sqlite3_int64 + FidxFlags int32 + _ [4]byte + FcolUsed Sqlite3_uint64 +} /* sqlite3.c:7867:9 */ + +type Sqlite3_index_info = sqlite3_index_info /* sqlite3.c:7867:35 */ +type sqlite3_vtab_cursor = struct{ FpVtab uintptr } /* sqlite3.c:7868:9 */ + +type Sqlite3_vtab_cursor = sqlite3_vtab_cursor /* sqlite3.c:7868:36 */ +type sqlite3_module = struct { + FiVersion int32 + _ [4]byte + FxCreate uintptr + FxConnect uintptr + FxBestIndex uintptr + FxDisconnect uintptr + FxDestroy uintptr + FxOpen uintptr + FxClose uintptr + FxFilter uintptr + FxNext uintptr + FxEof uintptr + FxColumn uintptr + FxRowid uintptr + FxUpdate uintptr + FxBegin uintptr + FxSync uintptr + FxCommit uintptr + FxRollback uintptr + FxFindFunction uintptr + FxRename uintptr + FxSavepoint uintptr + FxRelease uintptr + FxRollbackTo uintptr + FxShadowName uintptr +} /* sqlite3.c:1331:9 */ + +type Sqlite3_module = sqlite3_module /* sqlite3.c:7869:31 */ + +// CAPI3REF: Virtual Table Indexing Information +// KEYWORDS: sqlite3_index_info +// +// The sqlite3_index_info structure and its substructures is used as part +// of the [virtual table] interface to +// pass information into and receive the reply from the [xBestIndex] +// method of a [virtual table module]. The fields under **Inputs** are the +// inputs to xBestIndex and are read-only. xBestIndex inserts its +// results into the **Outputs** fields. +// +// ^(The aConstraint[] array records WHERE clause constraints of the form: +// +//
column OP expr
+// +// where OP is =, <, <=, >, or >=.)^ ^(The particular operator is +// stored in aConstraint[].op using one of the +// [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ +// ^(The index of the column is stored in +// aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the +// expr on the right-hand side can be evaluated (and thus the constraint +// is usable) and false if it cannot.)^ +// +// ^The optimizer automatically inverts terms of the form "expr OP column" +// and makes other simplifications to the WHERE clause in an attempt to +// get as many WHERE clause terms into the form shown above as possible. +// ^The aConstraint[] array only reports WHERE clause terms that are +// relevant to the particular virtual table being queried. +// +// ^Information about the ORDER BY clause is stored in aOrderBy[]. +// ^Each term of aOrderBy records a column of the ORDER BY clause. +// +// The colUsed field indicates which columns of the virtual table may be +// required by the current scan. Virtual table columns are numbered from +// zero in the order in which they appear within the CREATE TABLE statement +// passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62), +// the corresponding bit is set within the colUsed mask if the column may be +// required by SQLite. If the table has at least 64 columns and any column +// to the right of the first 63 is required, then bit 63 of colUsed is also +// set. In other words, column iCol may be required if the expression +// (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to +// non-zero. +// +// The [xBestIndex] method must fill aConstraintUsage[] with information +// about what parameters to pass to xFilter. ^If argvIndex>0 then +// the right-hand side of the corresponding aConstraint[] is evaluated +// and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit +// is true, then the constraint is assumed to be fully handled by the +// virtual table and might not be checked again by the byte code.)^ ^(The +// aConstraintUsage[].omit flag is an optimization hint. When the omit flag +// is left in its default setting of false, the constraint will always be +// checked separately in byte code. If the omit flag is change to true, then +// the constraint may or may not be checked in byte code. In other words, +// when the omit flag is true there is no guarantee that the constraint will +// not be checked again using byte code.)^ +// +// ^The idxNum and idxPtr values are recorded and passed into the +// [xFilter] method. +// ^[sqlite3_free()] is used to free idxPtr if and only if +// needToFreeIdxPtr is true. +// +// ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in +// the correct order to satisfy the ORDER BY clause so that no separate +// sorting step is required. +// +// ^The estimatedCost value is an estimate of the cost of a particular +// strategy. A cost of N indicates that the cost of the strategy is similar +// to a linear scan of an SQLite table with N rows. A cost of log(N) +// indicates that the expense of the operation is similar to that of a +// binary search on a unique indexed field of an SQLite table with N rows. +// +// ^The estimatedRows value is an estimate of the number of rows that +// will be returned by the strategy. +// +// The xBestIndex method may optionally populate the idxFlags field with a +// mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag - +// SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite +// assumes that the strategy may visit at most one row. +// +// Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then +// SQLite also assumes that if a call to the xUpdate() method is made as +// part of the same statement to delete or update a virtual table row and the +// implementation returns SQLITE_CONSTRAINT, then there is no need to rollback +// any database changes. In other words, if the xUpdate() returns +// SQLITE_CONSTRAINT, the database contents must be exactly as they were +// before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not +// set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by +// the xUpdate method are automatically rolled back by SQLite. +// +// IMPORTANT: The estimatedRows field was added to the sqlite3_index_info +// structure for SQLite [version 3.8.2] ([dateof:3.8.2]). +// If a virtual table extension is +// used with an SQLite version earlier than 3.8.2, the results of attempting +// to read or write the estimatedRows field are undefined (but are likely +// to include crashing the application). The estimatedRows field should +// therefore only be used if [sqlite3_libversion_number()] returns a +// value greater than or equal to 3008002. Similarly, the idxFlags field +// was added for [version 3.9.0] ([dateof:3.9.0]). +// It may therefore only be used if +// sqlite3_libversion_number() returns a value greater than or equal to +// 3009000. +type sqlite3_index_constraint = struct { + FiColumn int32 + Fop uint8 + Fusable uint8 + _ [2]byte + FiTermOffset int32 +} /* sqlite3.c:7867:9 */ + +// CAPI3REF: Virtual Table Indexing Information +// KEYWORDS: sqlite3_index_info +// +// The sqlite3_index_info structure and its substructures is used as part +// of the [virtual table] interface to +// pass information into and receive the reply from the [xBestIndex] +// method of a [virtual table module]. The fields under **Inputs** are the +// inputs to xBestIndex and are read-only. xBestIndex inserts its +// results into the **Outputs** fields. +// +// ^(The aConstraint[] array records WHERE clause constraints of the form: +// +//
column OP expr
+// +// where OP is =, <, <=, >, or >=.)^ ^(The particular operator is +// stored in aConstraint[].op using one of the +// [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ +// ^(The index of the column is stored in +// aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the +// expr on the right-hand side can be evaluated (and thus the constraint +// is usable) and false if it cannot.)^ +// +// ^The optimizer automatically inverts terms of the form "expr OP column" +// and makes other simplifications to the WHERE clause in an attempt to +// get as many WHERE clause terms into the form shown above as possible. +// ^The aConstraint[] array only reports WHERE clause terms that are +// relevant to the particular virtual table being queried. +// +// ^Information about the ORDER BY clause is stored in aOrderBy[]. +// ^Each term of aOrderBy records a column of the ORDER BY clause. +// +// The colUsed field indicates which columns of the virtual table may be +// required by the current scan. Virtual table columns are numbered from +// zero in the order in which they appear within the CREATE TABLE statement +// passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62), +// the corresponding bit is set within the colUsed mask if the column may be +// required by SQLite. If the table has at least 64 columns and any column +// to the right of the first 63 is required, then bit 63 of colUsed is also +// set. In other words, column iCol may be required if the expression +// (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to +// non-zero. +// +// The [xBestIndex] method must fill aConstraintUsage[] with information +// about what parameters to pass to xFilter. ^If argvIndex>0 then +// the right-hand side of the corresponding aConstraint[] is evaluated +// and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit +// is true, then the constraint is assumed to be fully handled by the +// virtual table and might not be checked again by the byte code.)^ ^(The +// aConstraintUsage[].omit flag is an optimization hint. When the omit flag +// is left in its default setting of false, the constraint will always be +// checked separately in byte code. If the omit flag is change to true, then +// the constraint may or may not be checked in byte code. In other words, +// when the omit flag is true there is no guarantee that the constraint will +// not be checked again using byte code.)^ +// +// ^The idxNum and idxPtr values are recorded and passed into the +// [xFilter] method. +// ^[sqlite3_free()] is used to free idxPtr if and only if +// needToFreeIdxPtr is true. +// +// ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in +// the correct order to satisfy the ORDER BY clause so that no separate +// sorting step is required. +// +// ^The estimatedCost value is an estimate of the cost of a particular +// strategy. A cost of N indicates that the cost of the strategy is similar +// to a linear scan of an SQLite table with N rows. A cost of log(N) +// indicates that the expense of the operation is similar to that of a +// binary search on a unique indexed field of an SQLite table with N rows. +// +// ^The estimatedRows value is an estimate of the number of rows that +// will be returned by the strategy. +// +// The xBestIndex method may optionally populate the idxFlags field with a +// mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag - +// SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite +// assumes that the strategy may visit at most one row. +// +// Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then +// SQLite also assumes that if a call to the xUpdate() method is made as +// part of the same statement to delete or update a virtual table row and the +// implementation returns SQLITE_CONSTRAINT, then there is no need to rollback +// any database changes. In other words, if the xUpdate() returns +// SQLITE_CONSTRAINT, the database contents must be exactly as they were +// before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not +// set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by +// the xUpdate method are automatically rolled back by SQLite. +// +// IMPORTANT: The estimatedRows field was added to the sqlite3_index_info +// structure for SQLite [version 3.8.2] ([dateof:3.8.2]). +// If a virtual table extension is +// used with an SQLite version earlier than 3.8.2, the results of attempting +// to read or write the estimatedRows field are undefined (but are likely +// to include crashing the application). The estimatedRows field should +// therefore only be used if [sqlite3_libversion_number()] returns a +// value greater than or equal to 3008002. Similarly, the idxFlags field +// was added for [version 3.9.0] ([dateof:3.9.0]). +// It may therefore only be used if +// sqlite3_libversion_number() returns a value greater than or equal to +// 3009000. +type sqlite3_index_orderby = struct { + FiColumn int32 + Fdesc uint8 + _ [3]byte +} /* sqlite3.c:7867:9 */ + +// CAPI3REF: Virtual Table Indexing Information +// KEYWORDS: sqlite3_index_info +// +// The sqlite3_index_info structure and its substructures is used as part +// of the [virtual table] interface to +// pass information into and receive the reply from the [xBestIndex] +// method of a [virtual table module]. The fields under **Inputs** are the +// inputs to xBestIndex and are read-only. xBestIndex inserts its +// results into the **Outputs** fields. +// +// ^(The aConstraint[] array records WHERE clause constraints of the form: +// +//
column OP expr
+// +// where OP is =, <, <=, >, or >=.)^ ^(The particular operator is +// stored in aConstraint[].op using one of the +// [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ +// ^(The index of the column is stored in +// aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the +// expr on the right-hand side can be evaluated (and thus the constraint +// is usable) and false if it cannot.)^ +// +// ^The optimizer automatically inverts terms of the form "expr OP column" +// and makes other simplifications to the WHERE clause in an attempt to +// get as many WHERE clause terms into the form shown above as possible. +// ^The aConstraint[] array only reports WHERE clause terms that are +// relevant to the particular virtual table being queried. +// +// ^Information about the ORDER BY clause is stored in aOrderBy[]. +// ^Each term of aOrderBy records a column of the ORDER BY clause. +// +// The colUsed field indicates which columns of the virtual table may be +// required by the current scan. Virtual table columns are numbered from +// zero in the order in which they appear within the CREATE TABLE statement +// passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62), +// the corresponding bit is set within the colUsed mask if the column may be +// required by SQLite. If the table has at least 64 columns and any column +// to the right of the first 63 is required, then bit 63 of colUsed is also +// set. In other words, column iCol may be required if the expression +// (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to +// non-zero. +// +// The [xBestIndex] method must fill aConstraintUsage[] with information +// about what parameters to pass to xFilter. ^If argvIndex>0 then +// the right-hand side of the corresponding aConstraint[] is evaluated +// and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit +// is true, then the constraint is assumed to be fully handled by the +// virtual table and might not be checked again by the byte code.)^ ^(The +// aConstraintUsage[].omit flag is an optimization hint. When the omit flag +// is left in its default setting of false, the constraint will always be +// checked separately in byte code. If the omit flag is change to true, then +// the constraint may or may not be checked in byte code. In other words, +// when the omit flag is true there is no guarantee that the constraint will +// not be checked again using byte code.)^ +// +// ^The idxNum and idxPtr values are recorded and passed into the +// [xFilter] method. +// ^[sqlite3_free()] is used to free idxPtr if and only if +// needToFreeIdxPtr is true. +// +// ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in +// the correct order to satisfy the ORDER BY clause so that no separate +// sorting step is required. +// +// ^The estimatedCost value is an estimate of the cost of a particular +// strategy. A cost of N indicates that the cost of the strategy is similar +// to a linear scan of an SQLite table with N rows. A cost of log(N) +// indicates that the expense of the operation is similar to that of a +// binary search on a unique indexed field of an SQLite table with N rows. +// +// ^The estimatedRows value is an estimate of the number of rows that +// will be returned by the strategy. +// +// The xBestIndex method may optionally populate the idxFlags field with a +// mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag - +// SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite +// assumes that the strategy may visit at most one row. +// +// Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then +// SQLite also assumes that if a call to the xUpdate() method is made as +// part of the same statement to delete or update a virtual table row and the +// implementation returns SQLITE_CONSTRAINT, then there is no need to rollback +// any database changes. In other words, if the xUpdate() returns +// SQLITE_CONSTRAINT, the database contents must be exactly as they were +// before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not +// set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by +// the xUpdate method are automatically rolled back by SQLite. +// +// IMPORTANT: The estimatedRows field was added to the sqlite3_index_info +// structure for SQLite [version 3.8.2] ([dateof:3.8.2]). +// If a virtual table extension is +// used with an SQLite version earlier than 3.8.2, the results of attempting +// to read or write the estimatedRows field are undefined (but are likely +// to include crashing the application). The estimatedRows field should +// therefore only be used if [sqlite3_libversion_number()] returns a +// value greater than or equal to 3008002. Similarly, the idxFlags field +// was added for [version 3.9.0] ([dateof:3.9.0]). +// It may therefore only be used if +// sqlite3_libversion_number() returns a value greater than or equal to +// 3009000. +type sqlite3_index_constraint_usage = struct { + FargvIndex int32 + Fomit uint8 + _ [3]byte +} /* sqlite3.c:7867:9 */ + +// CAPI3REF: Mutex Methods Object +// +// An instance of this structure defines the low-level routines +// used to allocate and use mutexes. +// +// Usually, the default mutex implementations provided by SQLite are +// sufficient, however the application has the option of substituting a custom +// implementation for specialized deployments or systems for which SQLite +// does not provide a suitable implementation. In this case, the application +// creates and populates an instance of this structure to pass +// to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. +// Additionally, an instance of this structure can be used as an +// output variable when querying the system for the current mutex +// implementation, using the [SQLITE_CONFIG_GETMUTEX] option. +// +// ^The xMutexInit method defined by this structure is invoked as +// part of system initialization by the sqlite3_initialize() function. +// ^The xMutexInit routine is called by SQLite exactly once for each +// effective call to [sqlite3_initialize()]. +// +// ^The xMutexEnd method defined by this structure is invoked as +// part of system shutdown by the sqlite3_shutdown() function. The +// implementation of this method is expected to release all outstanding +// resources obtained by the mutex methods implementation, especially +// those obtained by the xMutexInit method. ^The xMutexEnd() +// interface is invoked exactly once for each call to [sqlite3_shutdown()]. +// +// ^(The remaining seven methods defined by this structure (xMutexAlloc, +// xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and +// xMutexNotheld) implement the following interfaces (respectively): +// +//
    +//
  • [sqlite3_mutex_alloc()]
  • +//
  • [sqlite3_mutex_free()]
  • +//
  • [sqlite3_mutex_enter()]
  • +//
  • [sqlite3_mutex_try()]
  • +//
  • [sqlite3_mutex_leave()]
  • +//
  • [sqlite3_mutex_held()]
  • +//
  • [sqlite3_mutex_notheld()]
  • +//
)^ +// +// The only difference is that the public sqlite3_XXX functions enumerated +// above silently ignore any invocations that pass a NULL pointer instead +// of a valid mutex handle. The implementations of the methods defined +// by this structure are not required to handle this case. The results +// of passing a NULL pointer instead of a valid mutex handle are undefined +// (i.e. it is acceptable to provide an implementation that segfaults if +// it is passed a NULL pointer). +// +// The xMutexInit() method must be threadsafe. It must be harmless to +// invoke xMutexInit() multiple times within the same process and without +// intervening calls to xMutexEnd(). Second and subsequent calls to +// xMutexInit() must be no-ops. +// +// xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] +// and its associates). Similarly, xMutexAlloc() must not use SQLite memory +// allocation for a static mutex. ^However xMutexAlloc() may use SQLite +// memory allocation for a fast or recursive mutex. +// +// ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is +// called, but only if the prior call to xMutexInit returned SQLITE_OK. +// If xMutexInit fails in any way, it is expected to clean up after itself +// prior to returning. +type sqlite3_mutex_methods = struct { + FxMutexInit uintptr + FxMutexEnd uintptr + FxMutexAlloc uintptr + FxMutexFree uintptr + FxMutexEnter uintptr + FxMutexTry uintptr + FxMutexLeave uintptr + FxMutexHeld uintptr + FxMutexNotheld uintptr +} /* sqlite3.c:8701:9 */ + +// CAPI3REF: Mutex Methods Object +// +// An instance of this structure defines the low-level routines +// used to allocate and use mutexes. +// +// Usually, the default mutex implementations provided by SQLite are +// sufficient, however the application has the option of substituting a custom +// implementation for specialized deployments or systems for which SQLite +// does not provide a suitable implementation. In this case, the application +// creates and populates an instance of this structure to pass +// to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. +// Additionally, an instance of this structure can be used as an +// output variable when querying the system for the current mutex +// implementation, using the [SQLITE_CONFIG_GETMUTEX] option. +// +// ^The xMutexInit method defined by this structure is invoked as +// part of system initialization by the sqlite3_initialize() function. +// ^The xMutexInit routine is called by SQLite exactly once for each +// effective call to [sqlite3_initialize()]. +// +// ^The xMutexEnd method defined by this structure is invoked as +// part of system shutdown by the sqlite3_shutdown() function. The +// implementation of this method is expected to release all outstanding +// resources obtained by the mutex methods implementation, especially +// those obtained by the xMutexInit method. ^The xMutexEnd() +// interface is invoked exactly once for each call to [sqlite3_shutdown()]. +// +// ^(The remaining seven methods defined by this structure (xMutexAlloc, +// xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and +// xMutexNotheld) implement the following interfaces (respectively): +// +//
    +//
  • [sqlite3_mutex_alloc()]
  • +//
  • [sqlite3_mutex_free()]
  • +//
  • [sqlite3_mutex_enter()]
  • +//
  • [sqlite3_mutex_try()]
  • +//
  • [sqlite3_mutex_leave()]
  • +//
  • [sqlite3_mutex_held()]
  • +//
  • [sqlite3_mutex_notheld()]
  • +//
)^ +// +// The only difference is that the public sqlite3_XXX functions enumerated +// above silently ignore any invocations that pass a NULL pointer instead +// of a valid mutex handle. The implementations of the methods defined +// by this structure are not required to handle this case. The results +// of passing a NULL pointer instead of a valid mutex handle are undefined +// (i.e. it is acceptable to provide an implementation that segfaults if +// it is passed a NULL pointer). +// +// The xMutexInit() method must be threadsafe. It must be harmless to +// invoke xMutexInit() multiple times within the same process and without +// intervening calls to xMutexEnd(). Second and subsequent calls to +// xMutexInit() must be no-ops. +// +// xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] +// and its associates). Similarly, xMutexAlloc() must not use SQLite memory +// allocation for a static mutex. ^However xMutexAlloc() may use SQLite +// memory allocation for a fast or recursive mutex. +// +// ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is +// called, but only if the prior call to xMutexInit returned SQLITE_OK. +// If xMutexInit fails in any way, it is expected to clean up after itself +// prior to returning. +type Sqlite3_mutex_methods = sqlite3_mutex_methods /* sqlite3.c:8701:38 */ + +// CAPI3REF: Dynamic String Object +// KEYWORDS: {dynamic string} +// +// An instance of the sqlite3_str object contains a dynamically-sized +// string under construction. +// +// The lifecycle of an sqlite3_str object is as follows: +//
    +//
  1. ^The sqlite3_str object is created using [sqlite3_str_new()]. +//
  2. ^Text is appended to the sqlite3_str object using various +// methods, such as [sqlite3_str_appendf()]. +//
  3. ^The sqlite3_str object is destroyed and the string it created +// is returned using the [sqlite3_str_finish()] interface. +//
+type sqlite3_str = struct { + Fdb uintptr + FzText uintptr + FnAlloc U32 + FmxAlloc U32 + FnChar U32 + FaccError U8 + FprintfFlags U8 + _ [2]byte +} /* sqlite3.c:8964:9 */ + +// CAPI3REF: Dynamic String Object +// KEYWORDS: {dynamic string} +// +// An instance of the sqlite3_str object contains a dynamically-sized +// string under construction. +// +// The lifecycle of an sqlite3_str object is as follows: +//
    +//
  1. ^The sqlite3_str object is created using [sqlite3_str_new()]. +//
  2. ^Text is appended to the sqlite3_str object using various +// methods, such as [sqlite3_str_appendf()]. +//
  3. ^The sqlite3_str object is destroyed and the string it created +// is returned using the [sqlite3_str_finish()] interface. +//
+type Sqlite3_str = sqlite3_str /* sqlite3.c:8964:28 */ + +// CAPI3REF: Custom Page Cache Object +// +// The sqlite3_pcache_page object represents a single page in the +// page cache. The page cache will allocate instances of this +// object. Various methods of the page cache use pointers to instances +// of this object as parameters or as their return value. +// +// See [sqlite3_pcache_methods2] for additional information. +type sqlite3_pcache_page = struct { + FpBuf uintptr + FpExtra uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: Custom Page Cache Object +// +// The sqlite3_pcache_page object represents a single page in the +// page cache. The page cache will allocate instances of this +// object. Various methods of the page cache use pointers to instances +// of this object as parameters or as their return value. +// +// See [sqlite3_pcache_methods2] for additional information. +type Sqlite3_pcache_page = sqlite3_pcache_page /* sqlite3.c:9457:36 */ + +// CAPI3REF: Application Defined Page Cache. +// KEYWORDS: {page cache} +// +// ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can +// register an alternative page cache implementation by passing in an +// instance of the sqlite3_pcache_methods2 structure.)^ +// In many applications, most of the heap memory allocated by +// SQLite is used for the page cache. +// By implementing a +// custom page cache using this API, an application can better control +// the amount of memory consumed by SQLite, the way in which +// that memory is allocated and released, and the policies used to +// determine exactly which parts of a database file are cached and for +// how long. +// +// The alternative page cache mechanism is an +// extreme measure that is only needed by the most demanding applications. +// The built-in page cache is recommended for most uses. +// +// ^(The contents of the sqlite3_pcache_methods2 structure are copied to an +// internal buffer by SQLite within the call to [sqlite3_config]. Hence +// the application may discard the parameter after the call to +// [sqlite3_config()] returns.)^ +// +// [[the xInit() page cache method]] +// ^(The xInit() method is called once for each effective +// call to [sqlite3_initialize()])^ +// (usually only once during the lifetime of the process). ^(The xInit() +// method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ +// The intent of the xInit() method is to set up global data structures +// required by the custom page cache implementation. +// ^(If the xInit() method is NULL, then the +// built-in default page cache is used instead of the application defined +// page cache.)^ +// +// [[the xShutdown() page cache method]] +// ^The xShutdown() method is called by [sqlite3_shutdown()]. +// It can be used to clean up +// any outstanding resources before process shutdown, if required. +// ^The xShutdown() method may be NULL. +// +// ^SQLite automatically serializes calls to the xInit method, +// so the xInit method need not be threadsafe. ^The +// xShutdown method is only called from [sqlite3_shutdown()] so it does +// not need to be threadsafe either. All other methods must be threadsafe +// in multithreaded applications. +// +// ^SQLite will never invoke xInit() more than once without an intervening +// call to xShutdown(). +// +// [[the xCreate() page cache methods]] +// ^SQLite invokes the xCreate() method to construct a new cache instance. +// SQLite will typically create one cache instance for each open database file, +// though this is not guaranteed. ^The +// first parameter, szPage, is the size in bytes of the pages that must +// be allocated by the cache. ^szPage will always a power of two. ^The +// second parameter szExtra is a number of bytes of extra storage +// associated with each page cache entry. ^The szExtra parameter will +// a number less than 250. SQLite will use the +// extra szExtra bytes on each page to store metadata about the underlying +// database page on disk. The value passed into szExtra depends +// on the SQLite version, the target platform, and how SQLite was compiled. +// ^The third argument to xCreate(), bPurgeable, is true if the cache being +// created will be used to cache database pages of a file stored on disk, or +// false if it is used for an in-memory database. The cache implementation +// does not have to do anything special based with the value of bPurgeable; +// it is purely advisory. ^On a cache where bPurgeable is false, SQLite will +// never invoke xUnpin() except to deliberately delete a page. +// ^In other words, calls to xUnpin() on a cache with bPurgeable set to +// false will always have the "discard" flag set to true. +// ^Hence, a cache created with bPurgeable false will +// never contain any unpinned pages. +// +// [[the xCachesize() page cache method]] +// ^(The xCachesize() method may be called at any time by SQLite to set the +// suggested maximum cache-size (number of pages stored by) the cache +// instance passed as the first argument. This is the value configured using +// the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable +// parameter, the implementation is not required to do anything with this +// value; it is advisory only. +// +// [[the xPagecount() page cache methods]] +// The xPagecount() method must return the number of pages currently +// stored in the cache, both pinned and unpinned. +// +// [[the xFetch() page cache methods]] +// The xFetch() method locates a page in the cache and returns a pointer to +// an sqlite3_pcache_page object associated with that page, or a NULL pointer. +// The pBuf element of the returned sqlite3_pcache_page object will be a +// pointer to a buffer of szPage bytes used to store the content of a +// single database page. The pExtra element of sqlite3_pcache_page will be +// a pointer to the szExtra bytes of extra storage that SQLite has requested +// for each entry in the page cache. +// +// The page to be fetched is determined by the key. ^The minimum key value +// is 1. After it has been retrieved using xFetch, the page is considered +// to be "pinned". +// +// If the requested page is already in the page cache, then the page cache +// implementation must return a pointer to the page buffer with its content +// intact. If the requested page is not already in the cache, then the +// cache implementation should use the value of the createFlag +// parameter to help it determined what action to take: +// +// +//
createFlag Behavior when page is not already in cache +//
0 Do not allocate a new page. Return NULL. +//
1 Allocate a new page if it easy and convenient to do so. +// Otherwise return NULL. +//
2 Make every effort to allocate a new page. Only return +// NULL if allocating a new page is effectively impossible. +//
+// +// ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite +// will only use a createFlag of 2 after a prior call with a createFlag of 1 +// failed.)^ In between the xFetch() calls, SQLite may +// attempt to unpin one or more cache pages by spilling the content of +// pinned pages to disk and synching the operating system disk cache. +// +// [[the xUnpin() page cache method]] +// ^xUnpin() is called by SQLite with a pointer to a currently pinned page +// as its second argument. If the third parameter, discard, is non-zero, +// then the page must be evicted from the cache. +// ^If the discard parameter is +// zero, then the page may be discarded or retained at the discretion of +// page cache implementation. ^The page cache implementation +// may choose to evict unpinned pages at any time. +// +// The cache must not perform any reference counting. A single +// call to xUnpin() unpins the page regardless of the number of prior calls +// to xFetch(). +// +// [[the xRekey() page cache methods]] +// The xRekey() method is used to change the key value associated with the +// page passed as the second argument. If the cache +// previously contains an entry associated with newKey, it must be +// discarded. ^Any prior cache entry associated with newKey is guaranteed not +// to be pinned. +// +// When SQLite calls the xTruncate() method, the cache must discard all +// existing cache entries with page numbers (keys) greater than or equal +// to the value of the iLimit parameter passed to xTruncate(). If any +// of these pages are pinned, they are implicitly unpinned, meaning that +// they can be safely discarded. +// +// [[the xDestroy() page cache method]] +// ^The xDestroy() method is used to delete a cache allocated by xCreate(). +// All resources associated with the specified cache should be freed. ^After +// calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] +// handle invalid, and will not use it with any other sqlite3_pcache_methods2 +// functions. +// +// [[the xShrink() page cache method]] +// ^SQLite invokes the xShrink() method when it wants the page cache to +// free up as much of heap memory as possible. The page cache implementation +// is not obligated to free any memory, but well-behaved implementations should +// do their best. +type sqlite3_pcache_methods2 = struct { + FiVersion int32 + _ [4]byte + FpArg uintptr + FxInit uintptr + FxShutdown uintptr + FxCreate uintptr + FxCachesize uintptr + FxPagecount uintptr + FxFetch uintptr + FxUnpin uintptr + FxRekey uintptr + FxTruncate uintptr + FxDestroy uintptr + FxShrink uintptr +} /* sqlite3.c:9622:9 */ + +// CAPI3REF: Application Defined Page Cache. +// KEYWORDS: {page cache} +// +// ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can +// register an alternative page cache implementation by passing in an +// instance of the sqlite3_pcache_methods2 structure.)^ +// In many applications, most of the heap memory allocated by +// SQLite is used for the page cache. +// By implementing a +// custom page cache using this API, an application can better control +// the amount of memory consumed by SQLite, the way in which +// that memory is allocated and released, and the policies used to +// determine exactly which parts of a database file are cached and for +// how long. +// +// The alternative page cache mechanism is an +// extreme measure that is only needed by the most demanding applications. +// The built-in page cache is recommended for most uses. +// +// ^(The contents of the sqlite3_pcache_methods2 structure are copied to an +// internal buffer by SQLite within the call to [sqlite3_config]. Hence +// the application may discard the parameter after the call to +// [sqlite3_config()] returns.)^ +// +// [[the xInit() page cache method]] +// ^(The xInit() method is called once for each effective +// call to [sqlite3_initialize()])^ +// (usually only once during the lifetime of the process). ^(The xInit() +// method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ +// The intent of the xInit() method is to set up global data structures +// required by the custom page cache implementation. +// ^(If the xInit() method is NULL, then the +// built-in default page cache is used instead of the application defined +// page cache.)^ +// +// [[the xShutdown() page cache method]] +// ^The xShutdown() method is called by [sqlite3_shutdown()]. +// It can be used to clean up +// any outstanding resources before process shutdown, if required. +// ^The xShutdown() method may be NULL. +// +// ^SQLite automatically serializes calls to the xInit method, +// so the xInit method need not be threadsafe. ^The +// xShutdown method is only called from [sqlite3_shutdown()] so it does +// not need to be threadsafe either. All other methods must be threadsafe +// in multithreaded applications. +// +// ^SQLite will never invoke xInit() more than once without an intervening +// call to xShutdown(). +// +// [[the xCreate() page cache methods]] +// ^SQLite invokes the xCreate() method to construct a new cache instance. +// SQLite will typically create one cache instance for each open database file, +// though this is not guaranteed. ^The +// first parameter, szPage, is the size in bytes of the pages that must +// be allocated by the cache. ^szPage will always a power of two. ^The +// second parameter szExtra is a number of bytes of extra storage +// associated with each page cache entry. ^The szExtra parameter will +// a number less than 250. SQLite will use the +// extra szExtra bytes on each page to store metadata about the underlying +// database page on disk. The value passed into szExtra depends +// on the SQLite version, the target platform, and how SQLite was compiled. +// ^The third argument to xCreate(), bPurgeable, is true if the cache being +// created will be used to cache database pages of a file stored on disk, or +// false if it is used for an in-memory database. The cache implementation +// does not have to do anything special based with the value of bPurgeable; +// it is purely advisory. ^On a cache where bPurgeable is false, SQLite will +// never invoke xUnpin() except to deliberately delete a page. +// ^In other words, calls to xUnpin() on a cache with bPurgeable set to +// false will always have the "discard" flag set to true. +// ^Hence, a cache created with bPurgeable false will +// never contain any unpinned pages. +// +// [[the xCachesize() page cache method]] +// ^(The xCachesize() method may be called at any time by SQLite to set the +// suggested maximum cache-size (number of pages stored by) the cache +// instance passed as the first argument. This is the value configured using +// the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable +// parameter, the implementation is not required to do anything with this +// value; it is advisory only. +// +// [[the xPagecount() page cache methods]] +// The xPagecount() method must return the number of pages currently +// stored in the cache, both pinned and unpinned. +// +// [[the xFetch() page cache methods]] +// The xFetch() method locates a page in the cache and returns a pointer to +// an sqlite3_pcache_page object associated with that page, or a NULL pointer. +// The pBuf element of the returned sqlite3_pcache_page object will be a +// pointer to a buffer of szPage bytes used to store the content of a +// single database page. The pExtra element of sqlite3_pcache_page will be +// a pointer to the szExtra bytes of extra storage that SQLite has requested +// for each entry in the page cache. +// +// The page to be fetched is determined by the key. ^The minimum key value +// is 1. After it has been retrieved using xFetch, the page is considered +// to be "pinned". +// +// If the requested page is already in the page cache, then the page cache +// implementation must return a pointer to the page buffer with its content +// intact. If the requested page is not already in the cache, then the +// cache implementation should use the value of the createFlag +// parameter to help it determined what action to take: +// +// +//
createFlag Behavior when page is not already in cache +//
0 Do not allocate a new page. Return NULL. +//
1 Allocate a new page if it easy and convenient to do so. +// Otherwise return NULL. +//
2 Make every effort to allocate a new page. Only return +// NULL if allocating a new page is effectively impossible. +//
+// +// ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite +// will only use a createFlag of 2 after a prior call with a createFlag of 1 +// failed.)^ In between the xFetch() calls, SQLite may +// attempt to unpin one or more cache pages by spilling the content of +// pinned pages to disk and synching the operating system disk cache. +// +// [[the xUnpin() page cache method]] +// ^xUnpin() is called by SQLite with a pointer to a currently pinned page +// as its second argument. If the third parameter, discard, is non-zero, +// then the page must be evicted from the cache. +// ^If the discard parameter is +// zero, then the page may be discarded or retained at the discretion of +// page cache implementation. ^The page cache implementation +// may choose to evict unpinned pages at any time. +// +// The cache must not perform any reference counting. A single +// call to xUnpin() unpins the page regardless of the number of prior calls +// to xFetch(). +// +// [[the xRekey() page cache methods]] +// The xRekey() method is used to change the key value associated with the +// page passed as the second argument. If the cache +// previously contains an entry associated with newKey, it must be +// discarded. ^Any prior cache entry associated with newKey is guaranteed not +// to be pinned. +// +// When SQLite calls the xTruncate() method, the cache must discard all +// existing cache entries with page numbers (keys) greater than or equal +// to the value of the iLimit parameter passed to xTruncate(). If any +// of these pages are pinned, they are implicitly unpinned, meaning that +// they can be safely discarded. +// +// [[the xDestroy() page cache method]] +// ^The xDestroy() method is used to delete a cache allocated by xCreate(). +// All resources associated with the specified cache should be freed. ^After +// calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] +// handle invalid, and will not use it with any other sqlite3_pcache_methods2 +// functions. +// +// [[the xShrink() page cache method]] +// ^SQLite invokes the xShrink() method when it wants the page cache to +// free up as much of heap memory as possible. The page cache implementation +// is not obligated to free any memory, but well-behaved implementations should +// do their best. +type Sqlite3_pcache_methods2 = sqlite3_pcache_methods2 /* sqlite3.c:9622:40 */ + +// This is the obsolete pcache_methods object that has now been replaced +// by sqlite3_pcache_methods2. This object is not used by SQLite. It is +// retained in the header file for backwards compatibility only. +type sqlite3_pcache_methods = struct { + FpArg uintptr + FxInit uintptr + FxShutdown uintptr + FxCreate uintptr + FxCachesize uintptr + FxPagecount uintptr + FxFetch uintptr + FxUnpin uintptr + FxRekey uintptr + FxTruncate uintptr + FxDestroy uintptr +} /* sqlite3.c:9645:9 */ + +// This is the obsolete pcache_methods object that has now been replaced +// by sqlite3_pcache_methods2. This object is not used by SQLite. It is +// retained in the header file for backwards compatibility only. +type Sqlite3_pcache_methods = sqlite3_pcache_methods /* sqlite3.c:9645:39 */ + +// CAPI3REF: Online Backup Object +// +// The sqlite3_backup object records state information about an ongoing +// online backup operation. ^The sqlite3_backup object is created by +// a call to [sqlite3_backup_init()] and is destroyed by a call to +// [sqlite3_backup_finish()]. +// +// See Also: [Using the SQLite Online Backup API] +type sqlite3_backup = struct { + FpDestDb uintptr + FpDest uintptr + FiDestSchema U32 + FbDestLocked int32 + FiNext Pgno + _ [4]byte + FpSrcDb uintptr + FpSrc uintptr + Frc int32 + FnRemaining Pgno + FnPagecount Pgno + FisAttached int32 + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +// CAPI3REF: Online Backup Object +// +// The sqlite3_backup object records state information about an ongoing +// online backup operation. ^The sqlite3_backup object is created by +// a call to [sqlite3_backup_init()] and is destroyed by a call to +// [sqlite3_backup_finish()]. +// +// See Also: [Using the SQLite Online Backup API] +type Sqlite3_backup = sqlite3_backup /* sqlite3.c:9671:31 */ + +// CAPI3REF: Database Snapshot +// KEYWORDS: {snapshot} {sqlite3_snapshot} +// +// An instance of the snapshot object records the state of a [WAL mode] +// database for some specific point in history. +// +// In [WAL mode], multiple [database connections] that are open on the +// same database file can each be reading a different historical version +// of the database file. When a [database connection] begins a read +// transaction, that connection sees an unchanging copy of the database +// as it existed for the point in time when the transaction first started. +// Subsequent changes to the database from other connections are not seen +// by the reader until a new read transaction is started. +// +// The sqlite3_snapshot object records state information about an historical +// version of the database file so that it is possible to later open a new read +// transaction that sees that historical version of the database rather than +// the most recent version. +type sqlite3_snapshot = struct{ Fhidden [48]uint8 } /* sqlite3.c:10712:9 */ + +// CAPI3REF: Database Snapshot +// KEYWORDS: {snapshot} {sqlite3_snapshot} +// +// An instance of the snapshot object records the state of a [WAL mode] +// database for some specific point in history. +// +// In [WAL mode], multiple [database connections] that are open on the +// same database file can each be reading a different historical version +// of the database file. When a [database connection] begins a read +// transaction, that connection sees an unchanging copy of the database +// as it existed for the point in time when the transaction first started. +// Subsequent changes to the database from other connections are not seen +// by the reader until a new read transaction is started. +// +// The sqlite3_snapshot object records state information about an historical +// version of the database file so that it is possible to later open a new read +// transaction that sees that historical version of the database rather than +// the most recent version. +type Sqlite3_snapshot = sqlite3_snapshot /* sqlite3.c:10714:3 */ + +// CAPI3REF: Flags for sqlite3_deserialize() +// +// The following are allowed values for 6th argument (the F argument) to +// the [sqlite3_deserialize(D,S,P,N,M,F)] interface. +// +// The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization +// in the P argument is held in memory obtained from [sqlite3_malloc64()] +// and that SQLite should take ownership of this memory and automatically +// free it when it has finished using it. Without this flag, the caller +// is responsible for freeing any dynamically allocated memory. +// +// The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to +// grow the size of the database using calls to [sqlite3_realloc64()]. This +// flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. +// Without this flag, the deserialized database cannot increase in size beyond +// the number of bytes specified by the M parameter. +// +// The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database +// should be treated as read-only. + +// Undo the hack that converts floating point types to integer for +// builds on processors without floating point support. + +//******* Begin file sqlite3rtree.h ******** +// 2010 August 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +type sqlite3_rtree_geometry = struct { + FpContext uintptr + FnParam int32 + _ [4]byte + FaParam uintptr + FpUser uintptr + FxDelUser uintptr +} /* sqlite3.c:11039:9 */ + +// CAPI3REF: Flags for sqlite3_deserialize() +// +// The following are allowed values for 6th argument (the F argument) to +// the [sqlite3_deserialize(D,S,P,N,M,F)] interface. +// +// The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization +// in the P argument is held in memory obtained from [sqlite3_malloc64()] +// and that SQLite should take ownership of this memory and automatically +// free it when it has finished using it. Without this flag, the caller +// is responsible for freeing any dynamically allocated memory. +// +// The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to +// grow the size of the database using calls to [sqlite3_realloc64()]. This +// flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used. +// Without this flag, the deserialized database cannot increase in size beyond +// the number of bytes specified by the M parameter. +// +// The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database +// should be treated as read-only. + +// Undo the hack that converts floating point types to integer for +// builds on processors without floating point support. + +//******* Begin file sqlite3rtree.h ******** +// 2010 August 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +type Sqlite3_rtree_geometry = sqlite3_rtree_geometry /* sqlite3.c:11039:39 */ +type sqlite3_rtree_query_info = struct { + FpContext uintptr + FnParam int32 + _ [4]byte + FaParam uintptr + FpUser uintptr + FxDelUser uintptr + FaCoord uintptr + FanQueue uintptr + FnCoord int32 + FiLevel int32 + FmxLevel int32 + _ [4]byte + FiRowid Sqlite3_int64 + FrParentScore Sqlite3_rtree_dbl + FeParentWithin int32 + FeWithin int32 + FrScore Sqlite3_rtree_dbl + FapSqlParam uintptr +} /* sqlite3.c:11040:9 */ + +type Sqlite3_rtree_query_info = sqlite3_rtree_query_info /* sqlite3.c:11040:41 */ + +// The double-precision datatype used by RTree depends on the +// SQLITE_RTREE_INT_ONLY compile-time option. +type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + _ [4]byte + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + _ [4]byte + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + +//******* End of sqlite3session.h ******** +//******* Begin file fts5.h ******** +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Interfaces to extend FTS5. Using the interfaces defined in this file, +// FTS5 may be extended with: +// +// * custom tokenizers, and +// * custom auxiliary functions. + +// ************************************************************************ +// +// CUSTOM AUXILIARY FUNCTIONS +// +// Virtual table implementations may overload SQL functions by implementing +// the sqlite3_module.xFindFunction() method. + +type Fts5ExtensionApi1 = struct { + FiVersion int32 + _ [4]byte + FxUserData uintptr + FxColumnCount uintptr + FxRowCount uintptr + FxColumnTotalSize uintptr + FxTokenize uintptr + FxPhraseCount uintptr + FxPhraseSize uintptr + FxInstCount uintptr + FxInst uintptr + FxRowid uintptr + FxColumnText uintptr + FxColumnSize uintptr + FxQueryPhrase uintptr + FxSetAuxdata uintptr + FxGetAuxdata uintptr + FxPhraseFirst uintptr + FxPhraseNext uintptr + FxPhraseFirstColumn uintptr + FxPhraseNextColumn uintptr +} /* sqlite3.c:12895:9 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + +//******* End of sqlite3session.h ******** +//******* Begin file fts5.h ******** +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Interfaces to extend FTS5. Using the interfaces defined in this file, +// FTS5 may be extended with: +// +// * custom tokenizers, and +// * custom auxiliary functions. + +// ************************************************************************ +// +// CUSTOM AUXILIARY FUNCTIONS +// +// Virtual table implementations may overload SQL functions by implementing +// the sqlite3_module.xFindFunction() method. + +type Fts5ExtensionApi = Fts5ExtensionApi1 /* sqlite3.c:12895:33 */ +type Fts5PhraseIter1 = struct { + Fa uintptr + Fb uintptr +} /* sqlite3.c:12897:9 */ + +type Fts5PhraseIter = Fts5PhraseIter1 /* sqlite3.c:12897:31 */ + +type Fts5_extension_function = uintptr /* sqlite3.c:12899:14 */ +type fts5_tokenizer = struct { + FxCreate uintptr + FxDelete uintptr + FxTokenize uintptr +} /* sqlite3.c:13358:9 */ + +type Fts5_tokenizer = fts5_tokenizer /* sqlite3.c:13358:31 */ + +// Flags that may be passed as the third argument to xTokenize() + +// Flags that may be passed by the tokenizer implementation back to FTS5 +// as the third argument to the supplied xToken callback. + +// +// END OF CUSTOM TOKENIZERS +// + +// ************************************************************************ +// +// FTS5 EXTENSION REGISTRATION API +type fts5_api = struct { + FiVersion int32 + _ [4]byte + FxCreateTokenizer uintptr + FxFindTokenizer uintptr + FxCreateFunction uintptr +} /* sqlite3.c:13394:9 */ + +// Flags that may be passed as the third argument to xTokenize() + +// Flags that may be passed by the tokenizer implementation back to FTS5 +// as the third argument to the supplied xToken callback. + +// +// END OF CUSTOM TOKENIZERS +// + +// ************************************************************************ +// +// FTS5 EXTENSION REGISTRATION API +type Fts5_api = fts5_api /* sqlite3.c:13394:25 */ + +// +// END OF REGISTRATION API +// + +//******* End of fts5.h ******** + +//************* End of sqlite3.h ******************************************** +//************* Continuing where we left off in sqliteInt.h ***************** + +// Include the configuration header output by 'configure' if we're using the +// autoconf-based build + +//************* Include sqliteLimit.h in the middle of sqliteInt.h ********** +//************* Begin file sqliteLimit.h ************************************ +// 2007 May 7 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file defines various limits of what SQLite can process. + +// The maximum length of a TEXT or BLOB in bytes. This also +// limits the size of a row in a table or index. +// +// The hard limit is the ability of a 32-bit signed integer +// to count the size: 2^31-1 or 2147483647. + +// This is the maximum number of +// +// * Columns in a table +// * Columns in an index +// * Columns in a view +// * Terms in the SET clause of an UPDATE statement +// * Terms in the result set of a SELECT statement +// * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. +// * Terms in the VALUES clause of an INSERT statement +// +// The hard upper limit here is 32676. Most database people will +// tell you that in a well-normalized database, you usually should +// not have more than a dozen or so columns in any table. And if +// that is the case, there is no point in having more than a few +// dozen values in any of the other situations described above. + +// The maximum length of a single SQL statement in bytes. +// +// It used to be the case that setting this value to zero would +// turn the limit off. That is no longer true. It is not possible +// to turn this limit off. + +// The maximum depth of an expression tree. This is limited to +// some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might +// want to place more severe limits on the complexity of an +// expression. A value of 0 means that there is no limit. + +// The maximum number of terms in a compound SELECT statement. +// The code generator for compound SELECT statements does one +// level of recursion for each term. A stack overflow can result +// if the number of terms is too large. In practice, most SQL +// never has more than 3 or 4 terms. Use a value of 0 to disable +// any limit on the number of terms in a compount SELECT. + +// The maximum number of opcodes in a VDBE program. +// Not currently enforced. + +// The maximum number of arguments to an SQL function. + +// The suggested maximum number of in-memory pages to use for +// the main database table and for temporary tables. +// +// IMPLEMENTATION-OF: R-30185-15359 The default suggested cache size is -2000, +// which means the cache size is limited to 2048000 bytes of memory. +// IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be +// altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. + +// The default number of frames to accumulate in the log file before +// checkpointing the database in WAL mode. + +// The maximum number of attached databases. This must be between 0 +// and 125. The upper bound of 125 is because the attached databases are +// counted using a signed 8-bit integer which has a maximum value of 127 +// and we have to allow 2 extra counts for the "main" and "temp" databases. + +// The maximum value of a ?nnn wildcard that the parser will accept. +// If the value exceeds 32767 then extra space is required for the Expr +// structure. But otherwise, we believe that the number can be as large +// as a signed 32-bit integer can hold. + +// Maximum page size. The upper bound on this value is 65536. This a limit +// imposed by the use of 16-bit offsets within each page. +// +// Earlier versions of SQLite allowed the user to change this value at +// compile time. This is no longer permitted, on the grounds that it creates +// a library that is technically incompatible with an SQLite library +// compiled with a different limit. If a process operating on a database +// with a page-size of 65536 bytes crashes, then an instance of SQLite +// compiled with the default page-size limit will not be able to rollback +// the aborted transaction. This could lead to database corruption. + +// The default size of a database page. + +// Ordinarily, if no value is explicitly provided, SQLite creates databases +// with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain +// device characteristics (sector-size and atomic write() support), +// SQLite may choose a larger value. This constant is the maximum value +// SQLite will choose on its own. + +// Maximum number of pages in one database file. +// +// This is really just the default value for the max_page_count pragma. +// This value can be lowered (or raised) at run-time using that the +// max_page_count macro. + +// Maximum length (in bytes) of the pattern in a LIKE or GLOB +// operator. + +// Maximum depth of recursion for triggers. +// +// A value of 1 means that a trigger program will not be able to itself +// fire any triggers. A value of 0 means that no trigger programs at all +// may be executed. + +//************* End of sqliteLimit.h **************************************** +//************* Continuing where we left off in sqliteInt.h ***************** + +// Disable nuisance warnings on Borland compilers + +// WAL mode depends on atomic aligned 32-bit loads and stores in a few +// places. The following macros try to make this explicit. + +// Include standard header files as necessary + +// The following macros are used to cast pointers to integers and +// integers to pointers. The way you do this varies from one compiler +// to the next, so we have developed the following set of #if statements +// to generate appropriate macros for a wide range of compilers. +// +// The correct "ANSI" way to do this is to use the intptr_t type. +// Unfortunately, that typedef is not available on all compilers, or +// if it is available, it requires an #include of specific headers +// that vary from one machine to the next. +// +// Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on +// the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). +// So we have to define the macros in different ways depending on the +// compiler. + +// A macro to hint to the compiler that a function should not be +// inlined. + +// Make sure that the compiler intrinsics we desire are enabled when +// compiling with an appropriate version of MSVC unless prevented by +// the SQLITE_DISABLE_INTRINSIC define. + +// The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. +// 0 means mutexes are permanently disable and the library is never +// threadsafe. 1 means the library is serialized which is the highest +// level of threadsafety. 2 means the library is multithreaded - multiple +// threads can use SQLite as long as no two threads try to use the same +// database connection at the same time. +// +// Older versions of SQLite used an optional THREADSAFE macro. +// We support that for legacy. +// +// To ensure that the correct value of "THREADSAFE" is reported when querying +// for compile-time options at runtime (e.g. "PRAGMA compile_options"), this +// logic is partially replicated in ctime.c. If it is updated here, it should +// also be updated there. + +// Powersafe overwrite is on by default. But can be turned off using +// the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option. + +// EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by +// default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in +// which case memory allocation statistics are disabled by default. + +// Exactly one of the following macros must be defined in order to +// specify which memory allocation subsystem to use. +// +// SQLITE_SYSTEM_MALLOC // Use normal system malloc() +// SQLITE_WIN32_MALLOC // Use Win32 native heap API +// SQLITE_ZERO_MALLOC // Use a stub allocator that always fails +// SQLITE_MEMDEBUG // Debugging version of system malloc() +// +// On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the +// assert() macro is enabled, each call into the Win32 native heap subsystem +// will cause HeapValidate to be called. If heap validation should fail, an +// assertion will be triggered. +// +// If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as +// the default. + +// If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the +// sizes of memory allocations below this value where possible. + +// We need to define _XOPEN_SOURCE as follows in order to enable +// recursive mutexes on most Unix systems and fchmod() on OpenBSD. +// But _XOPEN_SOURCE define causes problems for Mac OS X, so omit +// it. + +// NDEBUG and SQLITE_DEBUG are opposites. It should always be true that +// defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, +// make it true by defining or undefining NDEBUG. +// +// Setting NDEBUG makes the code smaller and faster by disabling the +// assert() statements in the code. So we want the default action +// to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG +// is set. Thus NDEBUG becomes an opt-in rather than an opt-out +// feature. + +// Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. + +// The testcase() macro is used to aid in coverage testing. When +// doing coverage testing, the condition inside the argument to +// testcase() must be evaluated both true and false in order to +// get full branch coverage. The testcase() macro is inserted +// to help ensure adequate test coverage in places where simple +// condition/decision coverage is inadequate. For example, testcase() +// can be used to make sure boundary values are tested. For +// bitmask tests, testcase() can be used to make sure each bit +// is significant and used at least once. On switch statements +// where multiple cases go to the same block of code, testcase() +// can insure that all cases are evaluated. +// + +// The TESTONLY macro is used to enclose variable declarations or +// other bits of code that are needed to support the arguments +// within testcase() and assert() macros. + +// Sometimes we need a small amount of code such as a variable initialization +// to setup for a later assert() statement. We do not want this code to +// appear when assert() is disabled. The following macro is therefore +// used to contain that setup code. The "VVA" acronym stands for +// "Verification, Validation, and Accreditation". In other words, the +// code within VVA_ONLY() will only run during verification processes. + +// The ALWAYS and NEVER macros surround boolean expressions which +// are intended to always be true or false, respectively. Such +// expressions could be omitted from the code completely. But they +// are included in a few cases in order to enhance the resilience +// of SQLite to unexpected behavior - to make the code "self-healing" +// or "ductile" rather than being "brittle" and crashing at the first +// hint of unplanned behavior. +// +// In other words, ALWAYS and NEVER are added for defensive code. +// +// When doing coverage testing ALWAYS and NEVER are hard-coded to +// be true and false so that the unreachable code they specify will +// not be counted as untested code. + +// The harmless(X) macro indicates that expression X is usually false +// but can be true without causing any problems, but we don't know of +// any way to cause X to be true. +// +// In debugging and testing builds, this macro will abort if X is ever +// true. In this way, developers are alerted to a possible test case +// that causes X to be true. If a harmless macro ever fails, that is +// an opportunity to change the macro into a testcase() and add a new +// test case to the test suite. +// +// For normal production builds, harmless(X) is a no-op, since it does +// not matter whether expression X is true or false. + +// Some conditionals are optimizations only. In other words, if the +// conditionals are replaced with a constant 1 (true) or 0 (false) then +// the correct answer is still obtained, though perhaps not as quickly. +// +// The following macros mark these optimizations conditionals. + +// Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is +// defined. We need to defend against those failures when testing with +// SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches +// during a normal build. The following macro can be used to disable tests +// that are always false except when SQLITE_TEST_REALLOC_STRESS is set. + +// Declarations used for tracing the operating system interfaces. + +// Is the sqlite3ErrName() function needed in the build? Currently, +// it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when +// OSTRACE is enabled), and by several "test*.c" files (which are +// compiled using SQLITE_TEST). + +// SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN + +// Return true (non-zero) if the input is an integer that is too large +// to fit in 32-bits. This macro is used inside of various testcase() +// macros to verify that we have tested SQLite for large-file support. + +// The macro unlikely() is a hint that surrounds a boolean +// expression that is usually false. Macro likely() surrounds +// a boolean expression that is usually true. These hints could, +// in theory, be used by the compiler to generate better code, but +// currently they are just comments for human readers. + +//************* Include hash.h in the middle of sqliteInt.h ***************** +//************* Begin file hash.h ******************************************* +// 2001 September 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the header file for the generic hash-table implementation +// used in SQLite. + +// Forward declarations of structures. +type Hash1 = struct { + Fhtsize uint32 + Fcount uint32 + Ffirst uintptr + Fht uintptr +} /* sqlite3.c:1331:9 */ + +// +// END OF REGISTRATION API +// + +//******* End of fts5.h ******** + +//************* End of sqlite3.h ******************************************** +//************* Continuing where we left off in sqliteInt.h ***************** + +// Include the configuration header output by 'configure' if we're using the +// autoconf-based build + +//************* Include sqliteLimit.h in the middle of sqliteInt.h ********** +//************* Begin file sqliteLimit.h ************************************ +// 2007 May 7 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file defines various limits of what SQLite can process. + +// The maximum length of a TEXT or BLOB in bytes. This also +// limits the size of a row in a table or index. +// +// The hard limit is the ability of a 32-bit signed integer +// to count the size: 2^31-1 or 2147483647. + +// This is the maximum number of +// +// * Columns in a table +// * Columns in an index +// * Columns in a view +// * Terms in the SET clause of an UPDATE statement +// * Terms in the result set of a SELECT statement +// * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. +// * Terms in the VALUES clause of an INSERT statement +// +// The hard upper limit here is 32676. Most database people will +// tell you that in a well-normalized database, you usually should +// not have more than a dozen or so columns in any table. And if +// that is the case, there is no point in having more than a few +// dozen values in any of the other situations described above. + +// The maximum length of a single SQL statement in bytes. +// +// It used to be the case that setting this value to zero would +// turn the limit off. That is no longer true. It is not possible +// to turn this limit off. + +// The maximum depth of an expression tree. This is limited to +// some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might +// want to place more severe limits on the complexity of an +// expression. A value of 0 means that there is no limit. + +// The maximum number of terms in a compound SELECT statement. +// The code generator for compound SELECT statements does one +// level of recursion for each term. A stack overflow can result +// if the number of terms is too large. In practice, most SQL +// never has more than 3 or 4 terms. Use a value of 0 to disable +// any limit on the number of terms in a compount SELECT. + +// The maximum number of opcodes in a VDBE program. +// Not currently enforced. + +// The maximum number of arguments to an SQL function. + +// The suggested maximum number of in-memory pages to use for +// the main database table and for temporary tables. +// +// IMPLEMENTATION-OF: R-30185-15359 The default suggested cache size is -2000, +// which means the cache size is limited to 2048000 bytes of memory. +// IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be +// altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. + +// The default number of frames to accumulate in the log file before +// checkpointing the database in WAL mode. + +// The maximum number of attached databases. This must be between 0 +// and 125. The upper bound of 125 is because the attached databases are +// counted using a signed 8-bit integer which has a maximum value of 127 +// and we have to allow 2 extra counts for the "main" and "temp" databases. + +// The maximum value of a ?nnn wildcard that the parser will accept. +// If the value exceeds 32767 then extra space is required for the Expr +// structure. But otherwise, we believe that the number can be as large +// as a signed 32-bit integer can hold. + +// Maximum page size. The upper bound on this value is 65536. This a limit +// imposed by the use of 16-bit offsets within each page. +// +// Earlier versions of SQLite allowed the user to change this value at +// compile time. This is no longer permitted, on the grounds that it creates +// a library that is technically incompatible with an SQLite library +// compiled with a different limit. If a process operating on a database +// with a page-size of 65536 bytes crashes, then an instance of SQLite +// compiled with the default page-size limit will not be able to rollback +// the aborted transaction. This could lead to database corruption. + +// The default size of a database page. + +// Ordinarily, if no value is explicitly provided, SQLite creates databases +// with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain +// device characteristics (sector-size and atomic write() support), +// SQLite may choose a larger value. This constant is the maximum value +// SQLite will choose on its own. + +// Maximum number of pages in one database file. +// +// This is really just the default value for the max_page_count pragma. +// This value can be lowered (or raised) at run-time using that the +// max_page_count macro. + +// Maximum length (in bytes) of the pattern in a LIKE or GLOB +// operator. + +// Maximum depth of recursion for triggers. +// +// A value of 1 means that a trigger program will not be able to itself +// fire any triggers. A value of 0 means that no trigger programs at all +// may be executed. + +//************* End of sqliteLimit.h **************************************** +//************* Continuing where we left off in sqliteInt.h ***************** + +// Disable nuisance warnings on Borland compilers + +// WAL mode depends on atomic aligned 32-bit loads and stores in a few +// places. The following macros try to make this explicit. + +// Include standard header files as necessary + +// The following macros are used to cast pointers to integers and +// integers to pointers. The way you do this varies from one compiler +// to the next, so we have developed the following set of #if statements +// to generate appropriate macros for a wide range of compilers. +// +// The correct "ANSI" way to do this is to use the intptr_t type. +// Unfortunately, that typedef is not available on all compilers, or +// if it is available, it requires an #include of specific headers +// that vary from one machine to the next. +// +// Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on +// the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). +// So we have to define the macros in different ways depending on the +// compiler. + +// A macro to hint to the compiler that a function should not be +// inlined. + +// Make sure that the compiler intrinsics we desire are enabled when +// compiling with an appropriate version of MSVC unless prevented by +// the SQLITE_DISABLE_INTRINSIC define. + +// The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. +// 0 means mutexes are permanently disable and the library is never +// threadsafe. 1 means the library is serialized which is the highest +// level of threadsafety. 2 means the library is multithreaded - multiple +// threads can use SQLite as long as no two threads try to use the same +// database connection at the same time. +// +// Older versions of SQLite used an optional THREADSAFE macro. +// We support that for legacy. +// +// To ensure that the correct value of "THREADSAFE" is reported when querying +// for compile-time options at runtime (e.g. "PRAGMA compile_options"), this +// logic is partially replicated in ctime.c. If it is updated here, it should +// also be updated there. + +// Powersafe overwrite is on by default. But can be turned off using +// the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option. + +// EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by +// default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in +// which case memory allocation statistics are disabled by default. + +// Exactly one of the following macros must be defined in order to +// specify which memory allocation subsystem to use. +// +// SQLITE_SYSTEM_MALLOC // Use normal system malloc() +// SQLITE_WIN32_MALLOC // Use Win32 native heap API +// SQLITE_ZERO_MALLOC // Use a stub allocator that always fails +// SQLITE_MEMDEBUG // Debugging version of system malloc() +// +// On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the +// assert() macro is enabled, each call into the Win32 native heap subsystem +// will cause HeapValidate to be called. If heap validation should fail, an +// assertion will be triggered. +// +// If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as +// the default. + +// If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the +// sizes of memory allocations below this value where possible. + +// We need to define _XOPEN_SOURCE as follows in order to enable +// recursive mutexes on most Unix systems and fchmod() on OpenBSD. +// But _XOPEN_SOURCE define causes problems for Mac OS X, so omit +// it. + +// NDEBUG and SQLITE_DEBUG are opposites. It should always be true that +// defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, +// make it true by defining or undefining NDEBUG. +// +// Setting NDEBUG makes the code smaller and faster by disabling the +// assert() statements in the code. So we want the default action +// to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG +// is set. Thus NDEBUG becomes an opt-in rather than an opt-out +// feature. + +// Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. + +// The testcase() macro is used to aid in coverage testing. When +// doing coverage testing, the condition inside the argument to +// testcase() must be evaluated both true and false in order to +// get full branch coverage. The testcase() macro is inserted +// to help ensure adequate test coverage in places where simple +// condition/decision coverage is inadequate. For example, testcase() +// can be used to make sure boundary values are tested. For +// bitmask tests, testcase() can be used to make sure each bit +// is significant and used at least once. On switch statements +// where multiple cases go to the same block of code, testcase() +// can insure that all cases are evaluated. +// + +// The TESTONLY macro is used to enclose variable declarations or +// other bits of code that are needed to support the arguments +// within testcase() and assert() macros. + +// Sometimes we need a small amount of code such as a variable initialization +// to setup for a later assert() statement. We do not want this code to +// appear when assert() is disabled. The following macro is therefore +// used to contain that setup code. The "VVA" acronym stands for +// "Verification, Validation, and Accreditation". In other words, the +// code within VVA_ONLY() will only run during verification processes. + +// The ALWAYS and NEVER macros surround boolean expressions which +// are intended to always be true or false, respectively. Such +// expressions could be omitted from the code completely. But they +// are included in a few cases in order to enhance the resilience +// of SQLite to unexpected behavior - to make the code "self-healing" +// or "ductile" rather than being "brittle" and crashing at the first +// hint of unplanned behavior. +// +// In other words, ALWAYS and NEVER are added for defensive code. +// +// When doing coverage testing ALWAYS and NEVER are hard-coded to +// be true and false so that the unreachable code they specify will +// not be counted as untested code. + +// The harmless(X) macro indicates that expression X is usually false +// but can be true without causing any problems, but we don't know of +// any way to cause X to be true. +// +// In debugging and testing builds, this macro will abort if X is ever +// true. In this way, developers are alerted to a possible test case +// that causes X to be true. If a harmless macro ever fails, that is +// an opportunity to change the macro into a testcase() and add a new +// test case to the test suite. +// +// For normal production builds, harmless(X) is a no-op, since it does +// not matter whether expression X is true or false. + +// Some conditionals are optimizations only. In other words, if the +// conditionals are replaced with a constant 1 (true) or 0 (false) then +// the correct answer is still obtained, though perhaps not as quickly. +// +// The following macros mark these optimizations conditionals. + +// Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is +// defined. We need to defend against those failures when testing with +// SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches +// during a normal build. The following macro can be used to disable tests +// that are always false except when SQLITE_TEST_REALLOC_STRESS is set. + +// Declarations used for tracing the operating system interfaces. + +// Is the sqlite3ErrName() function needed in the build? Currently, +// it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when +// OSTRACE is enabled), and by several "test*.c" files (which are +// compiled using SQLITE_TEST). + +// SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN + +// Return true (non-zero) if the input is an integer that is too large +// to fit in 32-bits. This macro is used inside of various testcase() +// macros to verify that we have tested SQLite for large-file support. + +// The macro unlikely() is a hint that surrounds a boolean +// expression that is usually false. Macro likely() surrounds +// a boolean expression that is usually true. These hints could, +// in theory, be used by the compiler to generate better code, but +// currently they are just comments for human readers. + +//************* Include hash.h in the middle of sqliteInt.h ***************** +//************* Begin file hash.h ******************************************* +// 2001 September 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the header file for the generic hash-table implementation +// used in SQLite. + +// Forward declarations of structures. +type Hash = Hash1 /* sqlite3.c:14070:21 */ +type HashElem1 = struct { + Fnext uintptr + Fprev uintptr + Fdata uintptr + FpKey uintptr +} /* sqlite3.c:1331:9 */ + +type HashElem = HashElem1 /* sqlite3.c:14071:25 */ + +// A complete hash table is an instance of the following structure. +// The internals of this structure are intended to be opaque -- client +// code should not attempt to access or modify the fields of this structure +// directly. Change this structure only by using the routines below. +// However, some of the "procedures" and "functions" for modifying and +// accessing this structure are really macros, so we can't really make +// this structure opaque. +// +// All elements of the hash table are on a single doubly-linked list. +// Hash.first points to the head of this list. +// +// There are Hash.htsize buckets. Each bucket points to a spot in +// the global doubly-linked list. The contents of the bucket are the +// element pointed to plus the next _ht.count-1 elements in the list. +// +// Hash.htsize and Hash.ht may be zero. In that case lookup is done +// by a linear search of the global list. For small tables, the +// Hash.ht table is never allocated because if there are few elements +// in the table, it is faster to do a linear search than to manage +// the hash table. +type _ht = struct { + Fcount uint32 + _ [4]byte + Fchain uintptr +} /* sqlite3.c:1331:9 */ + +// Macros for looping over all elements of a hash table. The idiom is +// like this: +// +// Hash h; +// HashElem *p; +// ... +// for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){ +// SomeStructure *pData = sqliteHashData(p); +// // do something with pData +// } +// #define sqliteHashKey(E) ((E)->pKey) // NOT USED +// #define sqliteHashKeysize(E) ((E)->nKey) // NOT USED + +// Number of entries in a hash table +// #define sqliteHashCount(H) ((H)->count) // NOT USED + +//************* End of hash.h *********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +//************* Include parse.h in the middle of sqliteInt.h **************** +//************* Begin file parse.h ****************************************** + +//************* End of parse.h ********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Chris Torek. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)stdio.h 8.5 (Berkeley) 4/29/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Testing against Clang-specific extensions. + +// This code has been put in place to help reduce the addition of +// compiler specific defines in FreeBSD code. It helps to aid in +// having a compiler-agnostic source tree. + +// Compiler memory barriers, specific to gcc and clang. + +// XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced + +// Macro to test if we're using a specific version of gcc or later. + +// The __CONCAT macro is used to concatenate parts of symbol names, e.g. +// with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. +// The __CONCAT macro is a bit tricky to use if it must work in non-ANSI +// mode -- there must be no spaces between its arguments, and for nested +// __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also +// concatenate double-quoted strings produced by the __STRING macro, but +// this only works with ANSI C. +// +// __XSTRING is like __STRING, but it expands any macros in its argument +// first. It is only available with ANSI C. + +// Compiler-dependent macros to help declare dead (non-returning) and +// pure (no side effects) functions, and unused variables. They are +// null except for versions of gcc that are known to support the features +// properly (old versions of gcc-2 supported the dead and pure features +// in a different (wrong) way). If we do not provide an implementation +// for a given compiler, let the compile fail if it is told to use +// a feature that we cannot live without. + +// Keywords added in C11. + +// Emulation of C11 _Generic(). Unlike the previously defined C11 +// keywords, it is not possible to implement this using exactly the same +// syntax. Therefore implement something similar under the name +// __generic(). Unlike _Generic(), this macro can only distinguish +// between a single type, so it requires nested invocations to +// distinguish multiple cases. + +// C99 Static array indices in function parameter declarations. Syntax such as: +// void bar(int myArray[static 10]); +// is allowed in C99 but not in C++. Define __min_size appropriately so +// headers using it can be compiled in either language. Use like this: +// void bar(int myArray[__min_size(10)]); + +// XXX: should use `#if __STDC_VERSION__ < 199901'. + +// C++11 exposes a load of C99 stuff + +// GCC 2.95 provides `__restrict' as an extension to C90 to support the +// C99-specific `restrict' type qualifier. We happen to use `__restrict' as +// a way to define the `restrict' type qualifier without disturbing older +// software that is unaware of C99 keywords. + +// GNU C version 2.96 adds explicit branch prediction so that +// the CPU back-end can hint the processor and also so that +// code blocks can be reordered such that the predicted path +// sees a more linear flow, thus improving cache behavior, etc. +// +// The following two macros provide us with a way to utilize this +// compiler feature. Use __predict_true() if you expect the expression +// to evaluate to true, and __predict_false() if you expect the +// expression to evaluate to false. +// +// A few notes about usage: +// +// * Generally, __predict_false() error condition checks (unless +// you have some _strong_ reason to do otherwise, in which case +// document it), and/or __predict_true() `no-error' condition +// checks, assuming you want to optimize for the no-error case. +// +// * Other than that, if you don't know the likelihood of a test +// succeeding from empirical or other `hard' evidence, don't +// make predictions. +// +// * These are meant to be used in places that are run `a lot'. +// It is wasteful to make predictions in code that is run +// seldomly (e.g. at subsystem initialization time) as the +// basic block reordering that this affects can often generate +// larger code. + +// We define this here since , , and +// require it. + +// Given the pointer x to the member m of the struct s, return +// a pointer to the containing structure. When using GCC, we first +// assign pointer x to a local variable, to check that its type is +// compatible with member m. + +// Compiler-dependent macros to declare that functions take printf-like +// or scanf-like arguments. They are null except for versions of gcc +// that are known to support the features properly (old versions of gcc-2 +// didn't permit keeping the keywords out of the application namespace). + +// Compiler-dependent macros that rely on FreeBSD-specific extensions. + +// Embed the rcs id of a source file in the resulting library. Note that in +// more recent ELF binutils, we use .ident allowing the ID to be stripped. +// Usage: +// __FBSDID("$FreeBSD$"); + +// - +// The following definitions are an extension of the behavior originally +// implemented in , but with a different level of granularity. +// POSIX.1 requires that the macros we test be defined before any standard +// header file is included. +// +// Here's a quick run-down of the versions: +// defined(_POSIX_SOURCE) 1003.1-1988 +// _POSIX_C_SOURCE == 1 1003.1-1990 +// _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option +// _POSIX_C_SOURCE == 199309 1003.1b-1993 +// _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, +// and the omnibus ISO/IEC 9945-1: 1996 +// _POSIX_C_SOURCE == 200112 1003.1-2001 +// _POSIX_C_SOURCE == 200809 1003.1-2008 +// +// In addition, the X/Open Portability Guide, which is now the Single UNIX +// Specification, defines a feature-test macro which indicates the version of +// that specification, and which subsumes _POSIX_C_SOURCE. +// +// Our macros begin with two underscores to avoid namespace screwage. + +// Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. + +// Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. + +// Deal with various X/Open Portability Guides and Single UNIX Spec. + +// Deal with all versions of POSIX. The ordering relative to the tests above is +// important. + +// User override __EXT1_VISIBLE + +// Old versions of GCC use non-standard ARM arch symbols; acle-compat.h +// translates them to __ARM_ARCH and the modern feature symbols defined by ARM. + +// Nullability qualifiers: currently only supported by Clang. + +// Type Safety Checking +// +// Clang provides additional attributes to enable checking type safety +// properties that cannot be enforced by the C type system. + +// Lock annotations. +// +// Clang provides support for doing basic thread-safety tests at +// compile-time, by marking which locks will/should be held when +// entering/leaving a functions. +// +// Furthermore, it is also possible to annotate variables and structure +// members to enforce that they are only accessed when certain locks are +// held. + +// Structure implements a lock. + +// Function acquires an exclusive or shared lock. + +// Function attempts to acquire an exclusive or shared lock. + +// Function releases a lock. + +// Function asserts that an exclusive or shared lock is held. + +// Function requires that an exclusive or shared lock is or is not held. + +// Function should not be analyzed. + +// Function or variable should not be sanitized, i.e. by AddressSanitizer. +// GCC has the nosanitize attribute, but as a function attribute only, and +// warns on use as a variable attribute. + +// Guard variables and structure members by lock. + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2003 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-4-Clause +// +// Copyright (c) 2002 Mike Barcroft +// Copyright (c) 1990, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. All advertising materials mentioning features or use of this software +// must display the following acknowledgement: +// This product includes software developed by the University of +// California, Berkeley and its contributors. +// 4. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 +// From: @(#)types.h 8.3 (Berkeley) 1/5/94 +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// According to ANSI (section 2.2.4.2), the values below must be usable by +// #if preprocessing directives. Additionally, the expression must have the +// same type as would an expression that is an object of the corresponding +// type converted according to the integral promotions. The subtraction for +// INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an +// unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + +// max value for an unsigned long long + +// Quads and longs are the same on the amd64. Ensure they stay in sync. + +// Minimum signal stack size. + +// Basic types upon which most other types are built. +type X__int8_t = int8 /* _types.h:55:22 */ +type X__uint8_t = uint8 /* _types.h:56:24 */ +type X__int16_t = int16 /* _types.h:57:17 */ +type X__uint16_t = uint16 /* _types.h:58:25 */ +type X__int32_t = int32 /* _types.h:59:15 */ +type X__uint32_t = uint32 /* _types.h:60:23 */ +type X__int64_t = int64 /* _types.h:62:16 */ +type X__uint64_t = uint64 /* _types.h:63:24 */ + +// Standard type definitions. +type X__clock_t = X__int32_t /* _types.h:75:19 */ // clock()... +type X__critical_t = X__int64_t /* _types.h:76:19 */ +type X__double_t = float64 /* _types.h:78:17 */ +type X__float_t = float32 /* _types.h:79:16 */ +type X__intfptr_t = X__int64_t /* _types.h:81:19 */ +type X__intptr_t = X__int64_t /* _types.h:82:19 */ +type X__intmax_t = X__int64_t /* _types.h:93:19 */ +type X__int_fast8_t = X__int32_t /* _types.h:94:19 */ +type X__int_fast16_t = X__int32_t /* _types.h:95:19 */ +type X__int_fast32_t = X__int32_t /* _types.h:96:19 */ +type X__int_fast64_t = X__int64_t /* _types.h:97:19 */ +type X__int_least8_t = X__int8_t /* _types.h:98:18 */ +type X__int_least16_t = X__int16_t /* _types.h:99:19 */ +type X__int_least32_t = X__int32_t /* _types.h:100:19 */ +type X__int_least64_t = X__int64_t /* _types.h:101:19 */ +type X__ptrdiff_t = X__int64_t /* _types.h:103:19 */ // ptr1 - ptr2 +type X__register_t = X__int64_t /* _types.h:104:19 */ +type X__segsz_t = X__int64_t /* _types.h:105:19 */ // segment size (in pages) +type X__size_t = X__uint64_t /* _types.h:106:20 */ // sizeof() +type X__ssize_t = X__int64_t /* _types.h:107:19 */ // byte count or error +type X__time_t = X__int64_t /* _types.h:108:19 */ // time()... +type X__uintfptr_t = X__uint64_t /* _types.h:109:20 */ +type X__uintptr_t = X__uint64_t /* _types.h:110:20 */ +type X__uintmax_t = X__uint64_t /* _types.h:121:20 */ +type X__uint_fast8_t = X__uint32_t /* _types.h:122:20 */ +type X__uint_fast16_t = X__uint32_t /* _types.h:123:20 */ +type X__uint_fast32_t = X__uint32_t /* _types.h:124:20 */ +type X__uint_fast64_t = X__uint64_t /* _types.h:125:20 */ +type X__uint_least8_t = X__uint8_t /* _types.h:126:19 */ +type X__uint_least16_t = X__uint16_t /* _types.h:127:20 */ +type X__uint_least32_t = X__uint32_t /* _types.h:128:20 */ +type X__uint_least64_t = X__uint64_t /* _types.h:129:20 */ +type X__u_register_t = X__uint64_t /* _types.h:131:20 */ +type X__vm_offset_t = X__uint64_t /* _types.h:132:20 */ +type X__vm_paddr_t = X__uint64_t /* _types.h:133:20 */ +type X__vm_size_t = X__uint64_t /* _types.h:134:20 */ +type X___wchar_t = int32 /* _types.h:141:14 */ + +// Standard type definitions. +type X__blksize_t = X__int32_t /* _types.h:40:19 */ // file block size +type X__blkcnt_t = X__int64_t /* _types.h:41:19 */ // file block count +type X__clockid_t = X__int32_t /* _types.h:42:19 */ // clock_gettime()... +type X__fflags_t = X__uint32_t /* _types.h:43:20 */ // file flags +type X__fsblkcnt_t = X__uint64_t /* _types.h:44:20 */ +type X__fsfilcnt_t = X__uint64_t /* _types.h:45:20 */ +type X__gid_t = X__uint32_t /* _types.h:46:20 */ +type X__id_t = X__int64_t /* _types.h:47:19 */ // can hold a gid_t, pid_t, or uid_t +type X__ino_t = X__uint64_t /* _types.h:48:20 */ // inode number +type X__key_t = int64 /* _types.h:49:15 */ // IPC key (for Sys V IPC) +type X__lwpid_t = X__int32_t /* _types.h:50:19 */ // Thread ID (a.k.a. LWP) +type X__mode_t = X__uint16_t /* _types.h:51:20 */ // permissions +type X__accmode_t = int32 /* _types.h:52:14 */ // access permissions +type X__nl_item = int32 /* _types.h:53:14 */ +type X__nlink_t = X__uint64_t /* _types.h:54:20 */ // link count +type X__off_t = X__int64_t /* _types.h:55:19 */ // file offset +type X__off64_t = X__int64_t /* _types.h:56:19 */ // file offset (alias) +type X__pid_t = X__int32_t /* _types.h:57:19 */ // process [group] +type X__rlim_t = X__int64_t /* _types.h:58:19 */ // resource limit - intentionally +// signed, because of legacy code +// that uses -1 for RLIM_INFINITY +type X__sa_family_t = X__uint8_t /* _types.h:61:19 */ +type X__socklen_t = X__uint32_t /* _types.h:62:20 */ +type X__suseconds_t = int64 /* _types.h:63:15 */ // microseconds (signed) +type X__timer_t = uintptr /* _types.h:64:24 */ // timer_gettime()... +type X__mqd_t = uintptr /* _types.h:65:21 */ // mq_open()... +type X__uid_t = X__uint32_t /* _types.h:66:20 */ +type X__useconds_t = uint32 /* _types.h:67:22 */ // microseconds (unsigned) +type X__cpuwhich_t = int32 /* _types.h:68:14 */ // which parameter for cpuset. +type X__cpulevel_t = int32 /* _types.h:69:14 */ // level parameter for cpuset. +type X__cpusetid_t = int32 /* _types.h:70:14 */ // cpuset identifier. +type X__daddr_t = X__int64_t /* _types.h:71:19 */ // bwrite(3), FIOBMAP2, etc + +// Unusual type definitions. +// rune_t is declared to be an ``int'' instead of the more natural +// ``unsigned long'' or ``long''. Two things are happening here. It is not +// unsigned so that EOF (-1) can be naturally assigned to it and used. Also, +// it looks like 10646 will be a 31 bit standard. This means that if your +// ints cannot hold 32 bits, you will be in trouble. The reason an int was +// chosen over a long is that the is*() and to*() routines take ints (says +// ANSI C), but they use __ct_rune_t instead of int. +// +// NOTE: rune_t is not covered by ANSI nor other standards, and should not +// be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and +// rune_t must be the same type. Also, wint_t should be able to hold all +// members of the largest character set plus one extra value (WEOF), and +// must be at least 16 bits. +type X__ct_rune_t = int32 /* _types.h:91:14 */ // arg type for ctype funcs +type X__rune_t = X__ct_rune_t /* _types.h:92:21 */ // rune_t (see above) +type X__wint_t = X__ct_rune_t /* _types.h:93:21 */ // wint_t (see above) + +// Clang already provides these types as built-ins, but only in C++ mode. +type X__char16_t = X__uint_least16_t /* _types.h:97:26 */ +type X__char32_t = X__uint_least32_t /* _types.h:98:26 */ +// In C++11, char16_t and char32_t are built-in types. + +type X__max_align_t = struct { + F__max_align1 int64 + F__max_align2 float64 +} /* _types.h:111:3 */ + +type X__dev_t = X__uint64_t /* _types.h:113:20 */ // device number + +type X__fixpt_t = X__uint32_t /* _types.h:115:20 */ // fixed point number + +// mbstate_t is an opaque object to keep conversion state during multibyte +// stream conversions. +type X__mbstate_t = struct { + _ [0]uint64 + F__mbstate8 [128]int8 +} /* _types.h:124:3 */ + +type X__rman_res_t = X__uintmax_t /* _types.h:126:25 */ + +// Types for varargs. These are all provided by builtin types these +// days, so centralize their definition. +type X__va_list = X__builtin_va_list /* _types.h:133:27 */ // internally known to gcc + +// When the following macro is defined, the system uses 64-bit inode numbers. +// Programs can use this to avoid including , with its associated +// namespace pollution. + +type Fpos_t = X__off_t /* stdio.h:47:18 */ + +type Rsize_t = Size_t /* stdio.h:56:16 */ + +type Off64_t = X__off64_t /* stdio.h:72:19 */ + +// NB: to fit things in six character monocase externals, the stdio +// code uses the prefix `__s' for stdio objects, typically followed +// by a three-character attempt at a mnemonic. + +// stdio buffers +type __sbuf = struct { + F_base uintptr + F_size int32 + _ [4]byte +} /* stdio.h:91:1 */ + +// stdio state variables. +// +// The following always hold: +// +// if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), +// _lbfsize is -_bf._size, else _lbfsize is 0 +// if _flags&__SRD, _w is 0 +// if _flags&__SWR, _r is 0 +// +// This ensures that the getc and putc macros (or inline functions) never +// try to write or read from a file that is in `read' or `write' mode. +// (Moreover, they can, and do, automatically switch from read mode to +// write mode, and back, on "r+" and "w+" files.) +// +// _lbfsize is used only to make the inline line-buffered output stream +// code as compact as possible. +// +// _ub, _up, and _ur are used when ungetc() pushes back more characters +// than fit in the current _bf, or when ungetc() pushes back a character +// that does not match the previous one in _bf. When this happens, +// _ub._base becomes non-nil (i.e., a stream has ungetc() data iff +// _ub._base!=NULL) and _up and _ur save the current values of _p and _r. +// +// Certain members of __sFILE are accessed directly via macros or +// inline functions. To preserve ABI compat, these members must not +// be disturbed. These members are marked below with (*). +type __sFILE = struct { + F_p uintptr + F_r int32 + F_w int32 + F_flags int16 + F_file int16 + _ [4]byte + F_bf struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_lbfsize int32 + _ [4]byte + F_cookie uintptr + F_close uintptr + F_read uintptr + F_seek uintptr + F_write uintptr + F_ub struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_up uintptr + F_ur int32 + F_ubuf [3]uint8 + F_nbuf [1]uint8 + F_lb struct { + F_base uintptr + F_size int32 + _ [4]byte + } + F_blksize int32 + _ [4]byte + F_offset Fpos_t + F_fl_mutex uintptr + F_fl_owner uintptr + F_fl_count int32 + F_orientation int32 + F_mbstate X__mbstate_t + F_flags2 int32 + _ [4]byte +} /* stdio.h:124:1 */ + +type FILE = __sFILE /* stdio.h:165:24 */ + +type Div_t = struct { + Fquot int32 + Frem int32 +} /* stdlib.h:66:3 */ + +type Ldiv_t = struct { + Fquot int64 + Frem int64 +} /* stdlib.h:71:3 */ + +// Functions added in C99 which we make conditionally available in the +// BSD^C89 namespace if the compiler supports `long long'. +// The #if test is more complicated than it ought to be because +// __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' +// is not supported in the compilation environment (which therefore means +// that it can't really be ISO C99). +// +// (The only other extension made by C99 in thie header is _Exit().) +// LONGLONG +type Lldiv_t = struct { + Fquot int64 + Frem int64 +} /* stdlib.h:142:3 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011, 2012 The FreeBSD Foundation +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Locale_t = uintptr /* _string.h:33:25 */ + +// If this symbol has done its job, get rid of it. + +// Unsigned type of `sizeof' something. + +// Define this type if we are doing the whole job, +// or if we want this type in particular. + +// Wide character type. +// Locale-writers should change this as necessary to +// be big enough to hold unique values not between 0 and 127, +// and not (wchar_t) -1, for each defined multibyte character. + +// Define this type if we are doing the whole job, +// or if we want this type in particular. + +// A null pointer constant. + +// Offset of member MEMBER in a struct of type TYPE. + +// Type whose alignment is supported in every context and is at least +// as great as that of any standard type not using alignment +// specifiers. +type Max_align_t = struct { + F__max_align_ll int64 + F__max_align_ld float64 +} /* stddef.h:426:3 */ + +// Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY. +// This allows better measurements of where memcpy() is used when running +// cachegrind. But this macro version of memcpy() is very slow so it +// should not be used in production. This is a performance measurement +// hack only. + +// If compiling for a processor that lacks floating point support, +// substitute integer for floating-point + +// OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 +// afterward. Having this macro allows us to cause the C compiler +// to omit code used by TEMP tables without messy #ifndef statements. + +// The "file format" number is an integer that is incremented whenever +// the VDBE-level file format changes. The following macros define the +// the default file format for new databases and the maximum file format +// that the library can read. + +// Determine whether triggers are recursive by default. This can be +// changed at run-time using a pragma. + +// Provide a default value for SQLITE_TEMP_STORE in case it is not specified +// on the command-line + +// If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if +// SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it +// to zero. + +// The default initial allocation for the pagecache when using separate +// pagecaches for each database connection. A positive number is the +// number of pages. A negative number N translations means that a buffer +// of -1024*N bytes is allocated and used for as many pages as it will hold. +// +// The default value of "20" was choosen to minimize the run-time of the +// speedtest1 test program with options: --shrink-memory --reprepare + +// Default value for the SQLITE_CONFIG_SORTERREF_SIZE option. + +// The compile-time options SQLITE_MMAP_READWRITE and +// SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another. +// You must choose one or the other (or neither) but not both. + +// GCC does not define the offsetof() macro so we'll have to do it +// ourselves. + +// Macros to compute minimum and maximum of two numbers. + +// Swap two objects of type TYPE. + +// Check to see if this machine uses EBCDIC. (Yes, believe it or +// not, there are still machines out there that use EBCDIC.) + +// Integers of known sizes. These typedefs might change for architectures +// where the sizes very. Preprocessor macros are available so that the +// types can be conveniently redefined at compile-type. Like this: +// +// cc '-DUINTPTR_TYPE=long long int' ... +type I64 = Sqlite_int64 /* sqlite3.c:14542:22 */ // 8-byte signed integer +type U64 = Sqlite_uint64 /* sqlite3.c:14543:23 */ // 8-byte unsigned integer +type U32 = uint32 /* sqlite3.c:14544:21 */ // 4-byte unsigned integer +type U16 = uint16 /* sqlite3.c:14545:21 */ // 2-byte unsigned integer +type I16 = int16 /* sqlite3.c:14546:20 */ // 2-byte signed integer +type U8 = uint8 /* sqlite3.c:14547:20 */ // 1-byte unsigned integer +type I8 = int8 /* sqlite3.c:14548:19 */ // 1-byte signed integer + +// SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value +// that can be stored in a u32 without loss of data. The value +// is 0x00000000ffffffff. But because of quirks of some compilers, we +// have to specify the value in the less intuitive manner shown: + +// The datatype used to store estimates of the number of rows in a +// table or index. This is an unsigned integer type. For 99.9% of +// the world, a 32-bit integer is sufficient. But a 64-bit integer +// can be used at compile-time if desired. +type TRowcnt = U32 /* sqlite3.c:14567:14 */ // 32-bit is the default + +// Estimated quantities used for query planning are stored as 16-bit +// logarithms. For quantity X, the value stored is 10*log2(X). This +// gives a possible range of values of approximately 1.0e986 to 1e-986. +// But the allowed values are "grainy". Not every value is representable. +// For example, quantities 16 and 17 are both represented by a LogEst +// of 40. However, since LogEst quantities are suppose to be estimates, +// not exact values, this imprecision is not a problem. +// +// "LogEst" is short for "Logarithmic Estimate". +// +// Examples: +// 1 -> 0 20 -> 43 10000 -> 132 +// 2 -> 10 25 -> 46 25000 -> 146 +// 3 -> 16 100 -> 66 1000000 -> 199 +// 4 -> 20 1000 -> 99 1048576 -> 200 +// 10 -> 33 1024 -> 100 4294967296 -> 320 +// +// The LogEst can be negative to indicate fractional values. +// Examples: +// +// 0.5 -> -10 0.1 -> -33 0.0625 -> -40 +type LogEst = int16 /* sqlite3.c:14593:20 */ + +// Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer + +// The uptr type is an unsigned integer large enough to hold a pointer +type Uptr = U64 /* sqlite3.c:14617:15 */ + +// An instance of the following structure is used to store the busy-handler +// callback for a given sqlite handle. +// +// The sqlite.busyHandler member of the sqlite struct contains the busy +// callback for the database handle. Each pager opened via the sqlite +// handle is passed a pointer to sqlite.busyHandler. The busy-handler +// callback is currently invoked only from within pager.c. +type BusyHandler1 = struct { + FxBusyHandler uintptr + FpBusyArg uintptr + FnBusy int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +// An instance of the following structure is used to store the busy-handler +// callback for a given sqlite handle. +// +// The sqlite.busyHandler member of the sqlite struct contains the busy +// callback for the database handle. Each pager opened via the sqlite +// handle is passed a pointer to sqlite.busyHandler. The busy-handler +// callback is currently invoked only from within pager.c. +type BusyHandler = BusyHandler1 /* sqlite3.c:14788:28 */ + +// Name of table that holds the database schema. + +// The root-page of the schema table. + +// The name of the schema table. The name is different for TEMP. + +// A convenience macro that returns the number of elements in +// an array. + +// Determine if the argument is a power of two + +// The following value as a destructor means to use sqlite3DbFree(). +// The sqlite3DbFree() routine requires two parameters instead of the +// one parameter that destructors normally want. So we have to introduce +// this magic value that the code knows to handle differently. Any +// pointer will work here as long as it is distinct from SQLITE_STATIC +// and SQLITE_TRANSIENT. + +// When SQLITE_OMIT_WSD is defined, it means that the target platform does +// not support Writable Static Data (WSD) such as global and static variables. +// All variables must either be on the stack or dynamically allocated from +// the heap. When WSD is unsupported, the variable declarations scattered +// throughout the SQLite code must become constants instead. The SQLITE_WSD +// macro is used for this purpose. And instead of referencing the variable +// directly, we use its constant as a key to lookup the run-time allocated +// buffer that holds real variable. The constant is also the initializer +// for the run-time allocated buffer. +// +// In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL +// macros become no-ops and have zero performance impact. + +// The following macros are used to suppress compiler warnings and to +// make it clear to human readers when a function parameter is deliberately +// left unused within the body of a function. This usually happens when +// a function is called via a function pointer. For example the +// implementation of an SQL aggregate step callback may not use the +// parameter indicating the number of arguments passed to the aggregate, +// if it knows that this is enforced elsewhere. +// +// When a function parameter is not used at all within the body of a function, +// it is generally named "NotUsed" or "NotUsed2" to make things even clearer. +// However, these macros may also be used to suppress warnings related to +// parameters that may or may not be used depending on compilation options. +// For example those parameters only used in assert() statements. In these +// cases the parameters are named as per the usual conventions. + +// Forward references to structures +type AggInfo1 = struct { + FdirectMode U8 + FuseSortingIdx U8 + _ [2]byte + FsortingIdx int32 + FsortingIdxPTab int32 + FnSortingColumn int32 + FmnReg int32 + FmxReg int32 + FpGroupBy uintptr + FaCol uintptr + FnColumn int32 + FnAccumulator int32 + FaFunc uintptr + FnFunc int32 + FselId U32 +} /* sqlite3.c:1331:9 */ + +// Name of table that holds the database schema. + +// The root-page of the schema table. + +// The name of the schema table. The name is different for TEMP. + +// A convenience macro that returns the number of elements in +// an array. + +// Determine if the argument is a power of two + +// The following value as a destructor means to use sqlite3DbFree(). +// The sqlite3DbFree() routine requires two parameters instead of the +// one parameter that destructors normally want. So we have to introduce +// this magic value that the code knows to handle differently. Any +// pointer will work here as long as it is distinct from SQLITE_STATIC +// and SQLITE_TRANSIENT. + +// When SQLITE_OMIT_WSD is defined, it means that the target platform does +// not support Writable Static Data (WSD) such as global and static variables. +// All variables must either be on the stack or dynamically allocated from +// the heap. When WSD is unsupported, the variable declarations scattered +// throughout the SQLite code must become constants instead. The SQLITE_WSD +// macro is used for this purpose. And instead of referencing the variable +// directly, we use its constant as a key to lookup the run-time allocated +// buffer that holds real variable. The constant is also the initializer +// for the run-time allocated buffer. +// +// In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL +// macros become no-ops and have zero performance impact. + +// The following macros are used to suppress compiler warnings and to +// make it clear to human readers when a function parameter is deliberately +// left unused within the body of a function. This usually happens when +// a function is called via a function pointer. For example the +// implementation of an SQL aggregate step callback may not use the +// parameter indicating the number of arguments passed to the aggregate, +// if it knows that this is enforced elsewhere. +// +// When a function parameter is not used at all within the body of a function, +// it is generally named "NotUsed" or "NotUsed2" to make things even clearer. +// However, these macros may also be used to suppress warnings related to +// parameters that may or may not be used depending on compilation options. +// For example those parameters only used in assert() statements. In these +// cases the parameters are named as per the usual conventions. + +// Forward references to structures +type AggInfo = AggInfo1 /* sqlite3.c:14884:24 */ +type AuthContext1 = struct { + FzAuthContext uintptr + FpParse uintptr +} /* sqlite3.c:14885:9 */ + +type AuthContext = AuthContext1 /* sqlite3.c:14885:28 */ +type AutoincInfo1 = struct { + FpNext uintptr + FpTab uintptr + FiDb int32 + FregCtr int32 +} /* sqlite3.c:1331:9 */ + +type AutoincInfo = AutoincInfo1 /* sqlite3.c:14886:28 */ +type Bitvec1 = struct { + FiSize U32 + FnSet U32 + FiDivisor U32 + _ [4]byte + Fu struct { + _ [0]uint64 + FaBitmap [496]U8 + } +} /* sqlite3.c:1331:9 */ + +type Bitvec = Bitvec1 /* sqlite3.c:14887:23 */ +type CollSeq1 = struct { + FzName uintptr + Fenc U8 + _ [7]byte + FpUser uintptr + FxCmp uintptr + FxDel uintptr +} /* sqlite3.c:1331:9 */ + +type CollSeq = CollSeq1 /* sqlite3.c:14888:24 */ +type Column1 = struct { + FzName uintptr + FpDflt uintptr + FzColl uintptr + FnotNull U8 + Faffinity int8 + FszEst U8 + FhName U8 + FcolFlags U16 + _ [2]byte +} /* sqlite3.c:1331:9 */ + +type Column = Column1 /* sqlite3.c:14889:23 */ +type Cte1 = struct { + FzName uintptr + FpCols uintptr + FpSelect uintptr + FzCteErr uintptr + FpUse uintptr + FeM10d U8 + _ [7]byte +} /* sqlite3.c:1331:9 */ + +type Cte = Cte1 /* sqlite3.c:14890:20 */ +type CteUse1 = struct { + FnUse int32 + FaddrM9e int32 + FregRtn int32 + FiCur int32 + FnRowEst LogEst + FeM10d U8 + _ [1]byte +} /* sqlite3.c:1331:9 */ + +type CteUse = CteUse1 /* sqlite3.c:14891:23 */ +type Db1 = struct { + FzDbSName uintptr + FpBt uintptr + Fsafety_level U8 + FbSyncSet U8 + _ [6]byte + FpSchema uintptr +} /* sqlite3.c:1331:9 */ + +type Db = Db1 /* sqlite3.c:14892:19 */ +type DbFixer1 = struct { + FpParse uintptr + Fw Walker + FpSchema uintptr + FbTemp U8 + _ [7]byte + FzDb uintptr + FzType uintptr + FpName uintptr +} /* sqlite3.c:14893:9 */ + +type DbFixer = DbFixer1 /* sqlite3.c:14893:24 */ +type Schema1 = struct { + Fschema_cookie int32 + FiGeneration int32 + FtblHash Hash + FidxHash Hash + FtrigHash Hash + FfkeyHash Hash + FpSeqTab uintptr + Ffile_format U8 + Fenc U8 + FschemaFlags U16 + Fcache_size int32 +} /* sqlite3.c:1331:9 */ + +type Schema = Schema1 /* sqlite3.c:14894:23 */ +type Expr1 = struct { + Fop U8 + FaffExpr int8 + Fop2 U8 + _ [1]byte + Fflags U32 + Fu struct{ FzToken uintptr } + FpLeft uintptr + FpRight uintptr + Fx struct{ FpList uintptr } + FnHeight int32 + FiTable int32 + FiColumn YnVar + FiAgg I16 + FiRightJoinTable int32 + FpAggInfo uintptr + Fy struct{ FpTab uintptr } +} /* sqlite3.c:1331:9 */ + +type Expr = Expr1 /* sqlite3.c:14895:21 */ +type ExprList1 = struct { + FnExpr int32 + FnAlloc int32 + Fa [1]struct { + FpExpr uintptr + FzEName uintptr + FsortFlags U8 + _ [3]byte + FeEName uint8 /* unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 */ + _ [3]byte + Fu struct { + _ [0]uint32 + Fx struct { + FiOrderByCol U16 + FiAlias U16 + } + } + _ [4]byte + } +} /* sqlite3.c:1331:9 */ + +type ExprList = ExprList1 /* sqlite3.c:14896:25 */ +type FKey1 = struct { + FpFrom uintptr + FpNextFrom uintptr + FzTo uintptr + FpNextTo uintptr + FpPrevTo uintptr + FnCol int32 + FisDeferred U8 + FaAction [2]U8 + _ [1]byte + FapTrigger [2]uintptr + FaCol [1]struct { + FiFrom int32 + _ [4]byte + FzCol uintptr + } +} /* sqlite3.c:1331:9 */ + +type FKey = FKey1 /* sqlite3.c:14897:21 */ +type FuncDestructor1 = struct { + FnRef int32 + _ [4]byte + FxDestroy uintptr + FpUserData uintptr +} /* sqlite3.c:14898:9 */ + +type FuncDestructor = FuncDestructor1 /* sqlite3.c:14898:31 */ +type FuncDef1 = struct { + FnArg I8 + _ [3]byte + FfuncFlags U32 + FpUserData uintptr + FpNext uintptr + FxSFunc uintptr + FxFinalize uintptr + FxValue uintptr + FxInverse uintptr + FzName uintptr + Fu struct{ FpHash uintptr } +} /* sqlite3.c:1331:9 */ + +type FuncDef = FuncDef1 /* sqlite3.c:14899:24 */ +type FuncDefHash1 = struct{ Fa [23]uintptr } /* sqlite3.c:14900:9 */ + +type FuncDefHash = FuncDefHash1 /* sqlite3.c:14900:28 */ +type IdList1 = struct { + Fa uintptr + FnId int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type IdList = IdList1 /* sqlite3.c:14901:23 */ +type Index1 = struct { + FzName uintptr + FaiColumn uintptr + FaiRowLogEst uintptr + FpTable uintptr + FzColAff uintptr + FpNext uintptr + FpSchema uintptr + FaSortOrder uintptr + FazColl uintptr + FpPartIdxWhere uintptr + FaColExpr uintptr + Ftnum Pgno + FszIdxRow LogEst + FnKeyCol U16 + FnColumn U16 + FonError U8 + _ [1]byte + FidxType uint16 /* unsigned idxType: 2, unsigned bUnordered: 1, unsigned uniqNotNull: 1, unsigned isResized: 1, unsigned isCovering: 1, unsigned noSkipScan: 1, unsigned hasStat1: 1, unsigned bNoQuery: 1, unsigned bAscKeyBug: 1, unsigned bHasVCol: 1 */ + _ [2]byte + FnSample int32 + FnSampleCol int32 + FaAvgEq uintptr + FaSample uintptr + FaiRowEst uintptr + FnRowEst0 TRowcnt + _ [4]byte + FcolNotIdxed Bitmask +} /* sqlite3.c:1331:9 */ + +type Index = Index1 /* sqlite3.c:14902:22 */ +type IndexSample1 = struct { + Fp uintptr + Fn int32 + _ [4]byte + FanEq uintptr + FanLt uintptr + FanDLt uintptr +} /* sqlite3.c:1331:9 */ + +type IndexSample = IndexSample1 /* sqlite3.c:14903:28 */ +type KeyInfo1 = struct { + FnRef U32 + Fenc U8 + _ [1]byte + FnKeyField U16 + FnAllField U16 + _ [6]byte + Fdb uintptr + FaSortFlags uintptr + FaColl [1]uintptr +} /* sqlite3.c:1331:9 */ + +type KeyInfo = KeyInfo1 /* sqlite3.c:14905:24 */ +type Lookaside1 = struct { + FbDisable U32 + Fsz U16 + FszTrue U16 + FbMalloced U8 + _ [3]byte + FnSlot U32 + FanStat [3]U32 + _ [4]byte + FpInit uintptr + FpFree uintptr + FpSmallInit uintptr + FpSmallFree uintptr + FpMiddle uintptr + FpStart uintptr + FpEnd uintptr +} /* sqlite3.c:1331:9 */ + +type Lookaside = Lookaside1 /* sqlite3.c:14906:26 */ +type LookasideSlot1 = struct{ FpNext uintptr } /* sqlite3.c:1331:9 */ + +type LookasideSlot = LookasideSlot1 /* sqlite3.c:14907:30 */ +type Module1 = struct { + FpModule uintptr + FzName uintptr + FnRefModule int32 + _ [4]byte + FpAux uintptr + FxDestroy uintptr + FpEpoTab uintptr +} /* sqlite3.c:1331:9 */ + +type Module = Module1 /* sqlite3.c:14908:23 */ +type NameContext1 = struct { + FpParse uintptr + FpSrcList uintptr + FuNC struct{ FpEList uintptr } + FpNext uintptr + FnRef int32 + FnNcErr int32 + FncFlags int32 + _ [4]byte + FpWinSelect uintptr +} /* sqlite3.c:14909:9 */ + +type NameContext = NameContext1 /* sqlite3.c:14909:28 */ +type Parse1 = struct { + Fdb uintptr + FzErrMsg uintptr + FpVdbe uintptr + Frc int32 + FcolNamesSet U8 + FcheckSchema U8 + Fnested U8 + FnTempReg U8 + FisMultiWrite U8 + FmayAbort U8 + FhasCompound U8 + FokConstFactor U8 + FdisableLookaside U8 + FdisableVtab U8 + _ [2]byte + FnRangeReg int32 + FiRangeReg int32 + FnErr int32 + FnTab int32 + FnMem int32 + FszOpAlloc int32 + FiSelfTab int32 + FnLabel int32 + FnLabelAlloc int32 + _ [4]byte + FaLabel uintptr + FpConstExpr uintptr + FconstraintName Token + FwriteMask YDbMask + FcookieMask YDbMask + FregRowid int32 + FregRoot int32 + FnMaxArg int32 + FnSelect int32 + FnTableLock int32 + _ [4]byte + FaTableLock uintptr + FpAinc uintptr + FpToplevel uintptr + FpTriggerTab uintptr + FpParentParse uintptr + Fu1 struct { + _ [0]uint64 + FaddrCrTab int32 + _ [4]byte + } + FnQueryLoop U32 + Foldmask U32 + Fnewmask U32 + FeTriggerOp U8 + FbReturning U8 + FeOrconf U8 + FdisableTriggers U8 + FaTempReg [8]int32 + FsNameToken Token + FsLastToken Token + FnVar YnVar + FiPkSortOrder U8 + Fexplain U8 + FeParseMode U8 + _ [3]byte + FnVtabLock int32 + FnHeight int32 + FaddrExplain int32 + _ [4]byte + FpVList uintptr + FpReprepare uintptr + FzTail uintptr + FpNewTable uintptr + FpNewIndex uintptr + FpNewTrigger uintptr + FzAuthContext uintptr + FsArg Token + FapVtabLock uintptr + FpTriggerPrg uintptr + FpWith uintptr + FpCleanup uintptr + FpRename uintptr +} /* sqlite3.c:1331:9 */ + +type Parse = Parse1 /* sqlite3.c:14910:22 */ +type ParseCleanup1 = struct { + FpNext uintptr + FpPtr uintptr + FxCleanup uintptr +} /* sqlite3.c:1331:9 */ + +type ParseCleanup = ParseCleanup1 /* sqlite3.c:14911:29 */ +type PreUpdate1 = struct { + Fv uintptr + FpCsr uintptr + Fop int32 + _ [4]byte + FaRecord uintptr + Fkeyinfo KeyInfo + FpUnpacked uintptr + FpNewUnpacked uintptr + FiNewReg int32 + FiBlobWrite int32 + FiKey1 I64 + FiKey2 I64 + FaNew uintptr + FpTab uintptr + FpPk uintptr +} /* sqlite3.c:1331:9 */ + +type PreUpdate = PreUpdate1 /* sqlite3.c:14912:26 */ +type PrintfArguments1 = struct { + FnArg int32 + FnUsed int32 + FapArg uintptr +} /* sqlite3.c:14913:9 */ + +type PrintfArguments = PrintfArguments1 /* sqlite3.c:14913:32 */ +type RenameToken1 = struct { + Fp uintptr + Ft Token + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +type RenameToken = RenameToken1 /* sqlite3.c:14914:28 */ +type Returning1 = struct { + FpParse uintptr + FpReturnEL uintptr + FretTrig Trigger + FretTStep TriggerStep + FiRetCur int32 + FnRetCol int32 + FiRetReg int32 + _ [4]byte +} /* sqlite3.c:14915:9 */ + +type Returning = Returning1 /* sqlite3.c:14915:26 */ +type RowSet1 = struct { + FpChunk uintptr + Fdb uintptr + FpEntry uintptr + FpLast uintptr + FpFresh uintptr + FpForest uintptr + FnFresh U16 + FrsFlags U16 + FiBatch int32 +} /* sqlite3.c:14916:9 */ + +type RowSet = RowSet1 /* sqlite3.c:14916:23 */ +type Savepoint1 = struct { + FzName uintptr + FnDeferredCons I64 + FnDeferredImmCons I64 + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +type Savepoint = Savepoint1 /* sqlite3.c:14917:26 */ +type Select1 = struct { + Fop U8 + _ [1]byte + FnSelectRow LogEst + FselFlags U32 + FiLimit int32 + FiOffset int32 + FselId U32 + FaddrOpenEphm [2]int32 + _ [4]byte + FpEList uintptr + FpSrc uintptr + FpWhere uintptr + FpGroupBy uintptr + FpHaving uintptr + FpOrderBy uintptr + FpPrior uintptr + FpNext uintptr + FpLimit uintptr + FpWith uintptr + FpWin uintptr + FpWinDefn uintptr +} /* sqlite3.c:1331:9 */ + +type Select = Select1 /* sqlite3.c:14918:23 */ +type SQLiteThread1 = struct { + FxTask uintptr + FpIn uintptr + FpResult uintptr +} /* sqlite3.c:14919:9 */ + +type SQLiteThread = SQLiteThread1 /* sqlite3.c:14919:29 */ +type SelectDest1 = struct { + FeDest U8 + _ [3]byte + FiSDParm int32 + FiSDParm2 int32 + FiSdst int32 + FnSdst int32 + _ [4]byte + FzAffSdst uintptr + FpOrderBy uintptr +} /* sqlite3.c:14920:9 */ + +type SelectDest = SelectDest1 /* sqlite3.c:14920:27 */ +type SrcItem1 = struct { + FpSchema uintptr + FzDatabase uintptr + FzName uintptr + FzAlias uintptr + FpTab uintptr + FpSelect uintptr + FaddrFillSub int32 + FregReturn int32 + FregResult int32 + Ffg struct { + _ [0]uint32 + Fjointype U8 + _ [3]byte + FnotIndexed uint16 /* unsigned notIndexed: 1, unsigned isIndexedBy: 1, unsigned isTabFunc: 1, unsigned isCorrelated: 1, unsigned viaCoroutine: 1, unsigned isRecursive: 1, unsigned fromDDL: 1, unsigned isCte: 1, unsigned notCte: 1 */ + _ [2]byte + } + FiCursor int32 + FpOn uintptr + FpUsing uintptr + FcolUsed Bitmask + Fu1 struct{ FzIndexedBy uintptr } + Fu2 struct{ FpIBIndex uintptr } +} /* sqlite3.c:1331:9 */ + +type SrcItem = SrcItem1 /* sqlite3.c:14921:24 */ +type SrcList1 = struct { + FnSrc int32 + FnAlloc U32 + Fa [1]SrcItem +} /* sqlite3.c:1331:9 */ + +type SrcList = SrcList1 /* sqlite3.c:14922:24 */ +type StrAccum = sqlite3_str /* sqlite3.c:14923:28 */ // Internal alias for sqlite3_str +type Table1 = struct { + FzName uintptr + FaCol uintptr + FpIndex uintptr + FpSelect uintptr + FpFKey uintptr + FzColAff uintptr + FpCheck uintptr + Ftnum Pgno + FnTabRef U32 + FtabFlags U32 + FiPKey I16 + FnCol I16 + FnNVCol I16 + FnRowLogEst LogEst + FszTabRow LogEst + FkeyConf U8 + _ [1]byte + FaddColOffset int32 + FnModuleArg int32 + FazModuleArg uintptr + FpVTable uintptr + FpTrigger uintptr + FpSchema uintptr +} /* sqlite3.c:1331:9 */ + +// Internal alias for sqlite3_str +type Table = Table1 /* sqlite3.c:14924:22 */ +type TableLock1 = struct { + FiDb int32 + FiTab Pgno + FisWriteLock U8 + _ [7]byte + FzLockName uintptr +} /* sqlite3.c:1331:9 */ + +type TableLock = TableLock1 /* sqlite3.c:14925:26 */ +type Token1 = struct { + Fz uintptr + Fn uint32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type Token = Token1 /* sqlite3.c:14926:22 */ +type Trigger1 = struct { + FzName uintptr + Ftable uintptr + Fop U8 + Ftr_tm U8 + FbReturning U8 + _ [5]byte + FpWhen uintptr + FpColumns uintptr + FpSchema uintptr + FpTabSchema uintptr + Fstep_list uintptr + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +type Trigger = Trigger1 /* sqlite3.c:14928:24 */ +type TriggerPrg1 = struct { + FpTrigger uintptr + FpNext uintptr + FpProgram uintptr + Forconf int32 + FaColmask [2]U32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type TriggerPrg = TriggerPrg1 /* sqlite3.c:14929:27 */ +type TriggerStep1 = struct { + Fop U8 + Forconf U8 + _ [6]byte + FpTrig uintptr + FpSelect uintptr + FzTarget uintptr + FpFrom uintptr + FpWhere uintptr + FpExprList uintptr + FpIdList uintptr + FpUpsert uintptr + FzSpan uintptr + FpNext uintptr + FpLast uintptr +} /* sqlite3.c:1331:9 */ + +type TriggerStep = TriggerStep1 /* sqlite3.c:14930:28 */ +type UnpackedRecord1 = struct { + FpKeyInfo uintptr + FaMem uintptr + FnField U16 + Fdefault_rc I8 + FerrCode U8 + Fr1 I8 + Fr2 I8 + FeqSeen U8 + _ [1]byte +} /* sqlite3.c:1331:9 */ + +type UnpackedRecord = UnpackedRecord1 /* sqlite3.c:14931:31 */ +type Upsert1 = struct { + FpUpsertTarget uintptr + FpUpsertTargetWhere uintptr + FpUpsertSet uintptr + FpUpsertWhere uintptr + FpNextUpsert uintptr + FisDoUpdate U8 + _ [7]byte + FpToFree uintptr + FpUpsertIdx uintptr + FpUpsertSrc uintptr + FregData int32 + FiDataCur int32 + FiIdxCur int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type Upsert = Upsert1 /* sqlite3.c:14932:23 */ +type VTable1 = struct { + Fdb uintptr + FpMod uintptr + FpVtab uintptr + FnRef int32 + FbConstraint U8 + FeVtabRisk U8 + _ [2]byte + FiSavepoint int32 + _ [4]byte + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +type VTable = VTable1 /* sqlite3.c:14933:23 */ +type VtabCtx1 = struct { + FpVTable uintptr + FpTab uintptr + FpPrior uintptr + FbDeclared int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type VtabCtx = VtabCtx1 /* sqlite3.c:14934:24 */ +type Walker1 = struct { + FpParse uintptr + FxExprCallback uintptr + FxSelectCallback uintptr + FxSelectCallback2 uintptr + FwalkerDepth int32 + FeCode U16 + _ [2]byte + Fu struct{ FpNC uintptr } +} /* sqlite3.c:14893:9 */ + +type Walker = Walker1 /* sqlite3.c:14935:23 */ +type WhereInfo1 = struct { + FpParse uintptr + FpTabList uintptr + FpOrderBy uintptr + FpResultSet uintptr + FpWhere uintptr + FaiCurOnePass [2]int32 + FiContinue int32 + FiBreak int32 + FsavedNQueryLoop int32 + FwctrlFlags U16 + FiLimit LogEst + FnLevel U8 + FnOBSat I8 + FeOnePass U8 + FeDistinct U8 + FbDeferredSeek uint8 /* unsigned bDeferredSeek: 1, unsigned untestedTerms: 1, unsigned bOrderedInnerLoop: 1, unsigned sorted: 1 */ + _ [1]byte + FnRowOut LogEst + FiTop int32 + FiEndWhere int32 + FpLoops uintptr + FpExprMods uintptr + FrevMask Bitmask + FsWC WhereClause + FsMaskSet WhereMaskSet + Fa [1]WhereLevel +} /* sqlite3.c:14936:9 */ + +type WhereInfo = WhereInfo1 /* sqlite3.c:14936:26 */ +type Window1 = struct { + FzName uintptr + FzBase uintptr + FpPartition uintptr + FpOrderBy uintptr + FeFrmType U8 + FeStart U8 + FeEnd U8 + FbImplicitFrame U8 + FeExclude U8 + _ [3]byte + FpStart uintptr + FpEnd uintptr + FppThis uintptr + FpNextWin uintptr + FpFilter uintptr + FpFunc uintptr + FiEphCsr int32 + FregAccum int32 + FregResult int32 + FcsrApp int32 + FregApp int32 + FregPart int32 + FpOwner uintptr + FnBufferCol int32 + FiArgCol int32 + FregOne int32 + FregStartRowid int32 + FregEndRowid int32 + FbExprArgs U8 + _ [3]byte +} /* sqlite3.c:1331:9 */ + +type Window = Window1 /* sqlite3.c:14937:23 */ +type With1 = struct { + FnCte int32 + FbView int32 + FpOuter uintptr + Fa [1]Cte +} /* sqlite3.c:1331:9 */ + +type With = With1 /* sqlite3.c:14938:21 */ + +// The bitmask datatype defined below is used for various optimizations. +// +// Changing this from a 64-bit to a 32-bit type limits the number of +// tables in a join to 32 instead of 64. But it also reduces the size +// of the library by 738 bytes on ix86. +type Bitmask = U64 /* sqlite3.c:14951:15 */ + +// The number of bits in a Bitmask. "BMS" means "BitMask Size". + +// A bit in a Bitmask + +// A VList object records a mapping between parameters/variables/wildcards +// in the SQL statement (such as $abc, @pqr, or :xyz) and the integer +// variable number associated with that parameter. See the format description +// on the sqlite3VListAdd() routine for more information. A VList is really +// just an array of integers. +type VList = int32 /* sqlite3.c:14973:13 */ + +// Defer sourcing vdbe.h and btree.h until after the "u8" and +// "BusyHandler" typedefs. vdbe.h also requires a few of the opaque +// pointer types (i.e. FuncDef) defined above. +//************* Include pager.h in the middle of sqliteInt.h **************** +//************* Begin file pager.h ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface that the sqlite page cache +// subsystem. The page cache subsystem reads and writes a file a page +// at a time and provides a journal for rollback. + +// Default maximum size for persistent journal files. A negative +// value means no limit. This value may be overridden using the +// sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". + +// The type used to represent a page number. The first page in a file +// is called page 1. 0 is used to represent "not a page". +type Pgno = U32 /* sqlite3.c:15014:13 */ + +// Each open file is managed by a separate instance of the "Pager" structure. +type Pager1 = struct { + FpVfs uintptr + FexclusiveMode U8 + FjournalMode U8 + FuseJournal U8 + FnoSync U8 + FfullSync U8 + FextraSync U8 + FsyncFlags U8 + FwalSyncFlags U8 + FtempFile U8 + FnoLock U8 + FreadOnly U8 + FmemDb U8 + FeState U8 + FeLock U8 + FchangeCountDone U8 + FsetSuper U8 + FdoNotSpill U8 + FsubjInMemory U8 + FbUseFetch U8 + FhasHeldSharedLock U8 + FdbSize Pgno + FdbOrigSize Pgno + FdbFileSize Pgno + FdbHintSize Pgno + FerrCode int32 + FnRec int32 + FcksumInit U32 + FnSubRec U32 + _ [4]byte + FpInJournal uintptr + Ffd uintptr + Fjfd uintptr + Fsjfd uintptr + FjournalOff I64 + FjournalHdr I64 + FpBackup uintptr + FaSavepoint uintptr + FnSavepoint int32 + FiDataVersion U32 + FdbFileVers [16]int8 + FnMmapOut int32 + _ [4]byte + FszMmap Sqlite3_int64 + FpMmapFreelist uintptr + FnExtra U16 + FnReserve I16 + FvfsFlags U32 + FsectorSize U32 + FpageSize int32 + FmxPgno Pgno + _ [4]byte + FjournalSizeLimit I64 + FzFilename uintptr + FzJournal uintptr + FxBusyHandler uintptr + FpBusyHandlerArg uintptr + FaStat [4]int32 + FxReiniter uintptr + FxGet uintptr + FpTmpSpace uintptr + FpPCache uintptr + FpWal uintptr + FzWal uintptr +} /* sqlite3.c:1331:9 */ + +// Each open file is managed by a separate instance of the "Pager" structure. +type Pager = Pager1 /* sqlite3.c:15019:22 */ + +// Handle type for pages. +type PgHdr2 = struct { + FpPage uintptr + FpData uintptr + FpExtra uintptr + FpCache uintptr + FpDirty uintptr + FpPager uintptr + Fpgno Pgno + Fflags U16 + FnRef I16 + FpDirtyNext uintptr + FpDirtyPrev uintptr +} /* sqlite3.c:1331:9 */ + +// Handle type for pages. +type DbPage = PgHdr2 /* sqlite3.c:15024:22 */ + +// Functions to support testing and debugging. + +//************* End of pager.h ********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +//************* Include btree.h in the middle of sqliteInt.h **************** +//************* Begin file btree.h ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface that the sqlite B-Tree file +// subsystem. See comments in the source code for a detailed description +// of what each interface routine does. + +// TODO: This definition is just included so other modules compile. It +// needs to be revisited. + +// If defined as non-zero, auto-vacuum is enabled by default. Otherwise +// it must be turned on for each database using "PRAGMA auto_vacuum = 1". + +// Forward declarations of structure +type Btree1 = struct { + Fdb uintptr + FpBt uintptr + FinTrans U8 + Fsharable U8 + Flocked U8 + FhasIncrblobCur U8 + FwantToLock int32 + FnBackup int32 + FiBDataVersion U32 + FpNext uintptr + FpPrev uintptr + Flock BtLock +} /* sqlite3.c:1331:9 */ + +// Functions to support testing and debugging. + +//************* End of pager.h ********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +//************* Include btree.h in the middle of sqliteInt.h **************** +//************* Begin file btree.h ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface that the sqlite B-Tree file +// subsystem. See comments in the source code for a detailed description +// of what each interface routine does. + +// TODO: This definition is just included so other modules compile. It +// needs to be revisited. + +// If defined as non-zero, auto-vacuum is enabled by default. Otherwise +// it must be turned on for each database using "PRAGMA auto_vacuum = 1". + +// Forward declarations of structure +type Btree = Btree1 /* sqlite3.c:15267:22 */ +type BtCursor1 = struct { + FeState U8 + FcurFlags U8 + FcurPagerFlags U8 + Fhints U8 + FskipNext int32 + FpBtree uintptr + FaOverflow uintptr + FpKey uintptr + FpBt uintptr + FpNext uintptr + Finfo CellInfo + FnKey I64 + FpgnoRoot Pgno + FiPage I8 + FcurIntKey U8 + Fix U16 + FaiIdx [19]U16 + _ [2]byte + FpKeyInfo uintptr + FpPage uintptr + FapPage [19]uintptr +} /* sqlite3.c:1331:9 */ + +type BtCursor = BtCursor1 /* sqlite3.c:15268:25 */ +type BtShared1 = struct { + FpPager uintptr + Fdb uintptr + FpCursor uintptr + FpPage1 uintptr + FopenFlags U8 + FautoVacuum U8 + FincrVacuum U8 + FbDoTruncate U8 + FinTransaction U8 + Fmax1bytePayload U8 + FnReserveWanted U8 + _ [1]byte + FbtsFlags U16 + FmaxLocal U16 + FminLocal U16 + FmaxLeaf U16 + FminLeaf U16 + _ [2]byte + FpageSize U32 + FusableSize U32 + FnTransaction int32 + FnPage U32 + _ [4]byte + FpSchema uintptr + FxFreeSchema uintptr + Fmutex uintptr + FpHasContent uintptr + FnRef int32 + _ [4]byte + FpNext uintptr + FpLock uintptr + FpWriter uintptr + FpTmpSpace uintptr + FnPreformatSize int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type BtShared = BtShared1 /* sqlite3.c:15269:25 */ +type BtreePayload1 = struct { + FpKey uintptr + FnKey Sqlite3_int64 + FpData uintptr + FaMem uintptr + FnMem U16 + _ [2]byte + FnData int32 + FnZero int32 + _ [4]byte +} /* sqlite3.c:15270:9 */ + +type BtreePayload = BtreePayload1 /* sqlite3.c:15270:29 */ + +//************* End of btree.h ********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +//************* Include vdbe.h in the middle of sqliteInt.h ***************** +//************* Begin file vdbe.h ******************************************* +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Header file for the Virtual DataBase Engine (VDBE) +// +// This header defines the interface to the virtual database engine +// or VDBE. The VDBE implements an abstract machine that runs a +// simple program to access and modify the underlying database. +// #include + +// A single VDBE is an opaque structure named "Vdbe". Only routines +// in the source file sqliteVdbe.c are allowed to see the insides +// of this structure. +type Vdbe1 = struct { + Fdb uintptr + FpPrev uintptr + FpNext uintptr + FpParse uintptr + FnVar YnVar + _ [2]byte + FiVdbeMagic U32 + FnMem int32 + FnCursor int32 + FcacheCtr U32 + Fpc int32 + Frc int32 + FnChange int32 + FiStatement int32 + _ [4]byte + FiCurrentTime I64 + FnFkConstraint I64 + FnStmtDefCons I64 + FnStmtDefImmCons I64 + FaMem uintptr + FapArg uintptr + FapCsr uintptr + FaVar uintptr + FaOp uintptr + FnOp int32 + FnOpAlloc int32 + FaColName uintptr + FpResultSet uintptr + FzErrMsg uintptr + FpVList uintptr + FstartTime I64 + FnResColumn U16 + FerrorAction U8 + FminWriteFileFormat U8 + FprepFlags U8 + FdoingRerun U8 + _ [2]byte + Fexpired uint16 /* bft expired: 2, bft explain: 2, bft changeCntOn: 1, bft runOnlyOnce: 1, bft usesStmtJournal: 1, bft readOnly: 1, bft bIsReader: 1 */ + _ [2]byte + FbtreeMask YDbMask + FlockMask YDbMask + FaCounter [7]U32 + FzSql uintptr + FpFree uintptr + FpFrame uintptr + FpDelFrame uintptr + FnFrame int32 + Fexpmask U32 + FpProgram uintptr + FpAuxData uintptr +} /* sqlite3.c:1331:9 */ + +//************* End of btree.h ********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +//************* Include vdbe.h in the middle of sqliteInt.h ***************** +//************* Begin file vdbe.h ******************************************* +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Header file for the Virtual DataBase Engine (VDBE) +// +// This header defines the interface to the virtual database engine +// or VDBE. The VDBE implements an abstract machine that runs a +// simple program to access and modify the underlying database. +// #include + +// A single VDBE is an opaque structure named "Vdbe". Only routines +// in the source file sqliteVdbe.c are allowed to see the insides +// of this structure. +type Vdbe = Vdbe1 /* sqlite3.c:15668:21 */ + +// The names of the following types declared in vdbeInt.h are required +// for the VdbeOp definition. +type Mem = sqlite3_value /* sqlite3.c:15674:30 */ +type SubProgram1 = struct { + FaOp uintptr + FnOp int32 + FnMem int32 + FnCsr int32 + _ [4]byte + FaOnce uintptr + Ftoken uintptr + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +type SubProgram = SubProgram1 /* sqlite3.c:15675:27 */ + +// A single instruction of the virtual machine has an opcode +// and as many as three operands. The instruction is recorded +// as an instance of the following structure: +type VdbeOp1 = struct { + Fopcode U8 + Fp4type int8 + Fp5 U16 + Fp1 int32 + Fp2 int32 + Fp3 int32 + Fp4 struct { + _ [0]uint64 + Fi int32 + _ [4]byte + } +} /* sqlite3.c:1331:9 */ + +// A single instruction of the virtual machine has an opcode +// and as many as three operands. The instruction is recorded +// as an instance of the following structure: +type p4union = struct { + _ [0]uint64 + Fi int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +type VdbeOp = VdbeOp1 /* sqlite3.c:15721:23 */ + +// A smaller version of VdbeOp used for the VdbeAddOpList() function because +// it takes up less space. +type VdbeOpList1 = struct { + Fopcode U8 + Fp1 int8 + Fp2 int8 + Fp3 int8 +} /* sqlite3.c:15741:1 */ + +type VdbeOpList = VdbeOpList1 /* sqlite3.c:15747:27 */ + +type RecordCompare = uintptr /* sqlite3.c:16156:13 */ + +// Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on +// each VDBE opcode. +// +// Use the SQLITE_ENABLE_MODULE_COMMENTS macro to see some extra no-op +// comments in VDBE programs that show key decision points in the code +// generator. + +// The VdbeCoverage macros are used to set a coverage testing point +// for VDBE branch instructions. The coverage testing points are line +// numbers in the sqlite3.c source file. VDBE branch coverage testing +// only works with an amalagmation build. That's ok since a VDBE branch +// coverage build designed for testing the test suite only. No application +// should ever ship with VDBE branch coverage measuring turned on. +// +// VdbeCoverage(v) // Mark the previously coded instruction +// // as a branch +// +// VdbeCoverageIf(v, conditional) // Mark previous if conditional true +// +// VdbeCoverageAlwaysTaken(v) // Previous branch is always taken +// +// VdbeCoverageNeverTaken(v) // Previous branch is never taken +// +// VdbeCoverageNeverNull(v) // Previous three-way branch is only +// // taken on the first two ways. The +// // NULL option is not possible +// +// VdbeCoverageEqNe(v) // Previous OP_Jump is only interested +// // in distingishing equal and not-equal. +// +// Every VDBE branch operation must be tagged with one of the macros above. +// If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and +// -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch() +// routine in vdbe.c, alerting the developer to the missed tag. +// +// During testing, the test application will invoke +// sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback +// routine that is invoked as each bytecode branch is taken. The callback +// contains the sqlite3.c source line number ov the VdbeCoverage macro and +// flags to indicate whether or not the branch was taken. The test application +// is responsible for keeping track of this and reporting byte-code branches +// that are never taken. +// +// See the VdbeBranchTaken() macro and vdbeTakeBranch() function in the +// vdbe.c source file for additional information. + +//************* End of vdbe.h *********************************************** +//************* Continuing where we left off in sqliteInt.h ***************** +//************* Include pcache.h in the middle of sqliteInt.h *************** +//************* Begin file pcache.h ***************************************** +// 2008 August 05 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface that the sqlite page cache +// subsystem. + +type PgHdr = PgHdr2 /* sqlite3.c:16289:22 */ +type PCache2 = struct { + FpDirty uintptr + FpDirtyTail uintptr + FpSynced uintptr + FnRefSum int32 + FszCache int32 + FszSpill int32 + FszPage int32 + FszExtra int32 + FbPurgeable U8 + FeCreate U8 + _ [2]byte + FxStress uintptr + FpStress uintptr + FpCache uintptr +} /* sqlite3.c:1331:9 */ + +type PCache = PCache2 /* sqlite3.c:16290:23 */ + +// typedef for the authorization callback function. +type Sqlite3_xauth = uintptr /* sqlite3.c:17058:15 */ + +// This is an extra SQLITE_TRACE macro that indicates "legacy" tracing +// in the style of sqlite3_trace() + +// Maximum number of sqlite3.aDb[] entries. This is the number of attached +// databases plus 2 for "main" and "temp". + +// Each database connection is an instance of the following structure. +type sqlite3InitInfo = struct { + FnewTnum Pgno + FiDb U8 + Fbusy U8 + _ [2]byte + ForphanTrigger uint8 /* unsigned orphanTrigger: 1, unsigned imposterTable: 1, unsigned reopenMemdb: 1 */ + _ [7]byte + FazInit uintptr +} /* sqlite3.c:1331:9 */ + +// Allowed values for Table.tabFlags. +// +// TF_OOOHidden applies to tables or view that have hidden columns that are +// followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING +// vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden, +// the TF_OOOHidden attribute would apply in this case. Such tables require +// special handling during INSERT processing. The "OOO" means "Out Of Order". +// +// Constraints: +// +// TF_HasVirtual == COLFLAG_VIRTUAL +// TF_HasStored == COLFLAG_STORED +// TF_HasHidden == COLFLAG_HIDDEN + +// Test to see whether or not a table is a virtual table. This is +// done as a macro so that it will be optimized out when virtual +// table support is omitted from the build. + +// Macros to determine if a column is hidden. IsOrdinaryHiddenColumn() +// only works for non-virtual tables (ordinary tables and views) and is +// always false unless SQLITE_ENABLE_HIDDEN_COLUMNS is defined. The +// IsHiddenColumn() macro is general purpose. + +// Does the table have a rowid + +// Each foreign key constraint is an instance of the following structure. +// +// A foreign key is associated with two tables. The "from" table is +// the table that contains the REFERENCES clause that creates the foreign +// key. The "to" table is the table that is named in the REFERENCES clause. +// Consider this example: +// +// CREATE TABLE ex1( +// a INTEGER PRIMARY KEY, +// b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) +// ); +// +// For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". +// Equivalent names: +// +// from-table == child-table +// to-table == parent-table +// +// Each REFERENCES clause generates an instance of the following structure +// which is attached to the from-table. The to-table need not exist when +// the from-table is created. The existence of the to-table is not checked. +// +// The list of all parents for child Table X is held at X.pFKey. +// +// A list of all children for a table named Z (which might not even exist) +// is held in Schema.fkeyHash with a hash key of Z. +type sColMap = struct { + FiFrom int32 + _ [4]byte + FzCol uintptr +} /* sqlite3.c:1331:9 */ + +// An instance of this structure contains information needed to generate +// code for a SELECT that contains aggregate functions. +// +// If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a +// pointer to this structure. The Expr.iAgg field is the index in +// AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate +// code for that node. +// +// AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the +// original Select structure that describes the SELECT statement. These +// fields do not need to be freed when deallocating the AggInfo structure. +type AggInfo_col = struct { + FpTab uintptr + FpCExpr uintptr + FiTable int32 + FiMem int32 + FiColumn I16 + FiSorterColumn I16 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +// An instance of this structure contains information needed to generate +// code for a SELECT that contains aggregate functions. +// +// If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a +// pointer to this structure. The Expr.iAgg field is the index in +// AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate +// code for that node. +// +// AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the +// original Select structure that describes the SELECT statement. These +// fields do not need to be freed when deallocating the AggInfo structure. +type AggInfo_func = struct { + FpFExpr uintptr + FpFunc uintptr + FiMem int32 + FiDistinct int32 + FiDistAddr int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +// The datatype ynVar is a signed integer, either 16-bit or 32-bit. +// Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater +// than 32767 we have to make it 32-bit. 16-bit is preferred because +// it uses less memory in the Expr object, which is a big memory user +// in systems with lots of prepared statements. And few applications +// need more than about 10 or 20 variables. But some extreme users want +// to have prepared statements with over 32766 variables, and for them +// the option is available (at compile-time). +type YnVar = I16 /* sqlite3.c:18212:13 */ + +// The following are the meanings of bits in the Expr.flags field. +// Value restrictions: +// +// EP_Agg == NC_HasAgg == SF_HasAgg +// EP_Win == NC_HasWin +// 0x400000 // Available +// 0x80000000 // Available + +// The EP_Propagate mask is a set of properties that automatically propagate +// upwards into parent nodes. + +// These macros can be used to test, set, or clear bits in the +// Expr.flags field. + +// Flags for use with Expr.vvaFlags + +// The ExprSetVVAProperty() macro is used for Verification, Validation, +// and Accreditation only. It works like ExprSetProperty() during VVA +// processes but is a no-op for delivery. + +// Macros to determine the number of bytes required by a normal Expr +// struct, an Expr struct with the EP_Reduced flag set in Expr.flags +// and an Expr struct with the EP_TokenOnly flag set. + +// Flags passed to the sqlite3ExprDup() function. See the header comment +// above sqlite3ExprDup() for details. + +// True if the expression passed as an argument was a function with +// an OVER() clause (a window function). + +// A list of expressions. Each expression may optionally have a +// name. An expr/name combination can be used in several ways, such +// as the list of "expr AS ID" fields following a "SELECT" or in the +// list of "ID = expr" items in an UPDATE. A list of expressions can +// also be used as the argument to a function, in which case the a.zName +// field is not used. +// +// In order to try to keep memory usage down, the Expr.a.zEName field +// is used for multiple purposes: +// +// eEName Usage +// ---------- ------------------------- +// ENAME_NAME (1) the AS of result set column +// (2) COLUMN= of an UPDATE +// +// ENAME_TAB DB.TABLE.NAME used to resolve names +// of subqueries +// +// ENAME_SPAN Text of the original result set +// expression. +type ExprList_item = struct { + FpExpr uintptr + FzEName uintptr + FsortFlags U8 + _ [3]byte + FeEName uint8 /* unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 */ + _ [3]byte + Fu struct { + _ [0]uint32 + Fx struct { + FiOrderByCol U16 + FiAlias U16 + } + } + _ [4]byte +} /* sqlite3.c:1331:9 */ + +// Allowed values for Expr.a.eEName + +// An instance of this structure can hold a simple list of identifiers, +// such as the list "a,b,c" in the following statements: +// +// INSERT INTO t(a,b,c) VALUES ...; +// CREATE INDEX idx ON t(a,b,c); +// CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...; +// +// The IdList.a.idx field is used when the IdList represents the list of +// column names after a table name in an INSERT statement. In the statement +// +// INSERT INTO t(a,b,c) ... +// +// If "a" is the k-th column of table "t", then IdList.a[0].idx==k. +type IdList_item = struct { + FzName uintptr + Fidx int32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +// The yDbMask datatype for the bitmask of all attached databases. +type YDbMask = uint32 /* sqlite3.c:18969:24 */ + +// A pointer to this structure is used to communicate information +// from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. +type InitData = struct { + Fdb uintptr + FpzErrMsg uintptr + FiDb int32 + Frc int32 + FmInitFlags U32 + FnInitRow U32 + FmxPage Pgno + _ [4]byte +} /* sqlite3.c:19327:3 */ + +// Allowed values for mInitFlags + +// Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled +// on debug-builds of the CLI using ".testctrl tune ID VALUE". Tuning +// parameters are for temporary use during development, to help find +// optimial values for parameters in the query planner. The should not +// be used on trunk check-ins. They are a temporary mechanism available +// for transient development builds only. +// +// Tuning parameters are numbered starting with 1. + +// Structure containing global configuration data for the SQLite library. +// +// This structure also contains some state information. +type Sqlite3Config = struct { + FbMemstat int32 + FbCoreMutex U8 + FbFullMutex U8 + FbOpenUri U8 + FbUseCis U8 + FbSmallMalloc U8 + FbExtraSchemaChecks U8 + _ [2]byte + FmxStrlen int32 + FneverCorrupt int32 + FszLookaside int32 + FnLookaside int32 + FnStmtSpill int32 + Fm Sqlite3_mem_methods + Fmutex Sqlite3_mutex_methods + Fpcache2 Sqlite3_pcache_methods2 + FpHeap uintptr + FnHeap int32 + FmnReq int32 + FmxReq int32 + _ [4]byte + FszMmap Sqlite3_int64 + FmxMmap Sqlite3_int64 + FpPage uintptr + FszPage int32 + FnPage int32 + FmxParserStack int32 + FsharedCacheEnabled int32 + FszPma U32 + FisInit int32 + FinProgress int32 + FisMutexInit int32 + FisMallocInit int32 + FisPCacheInit int32 + FnRefInitMutex int32 + _ [4]byte + FpInitMutex uintptr + FxLog uintptr + FpLogArg uintptr + FmxMemdbSize Sqlite3_int64 + FxTestCallback uintptr + FbLocaltimeFault int32 + FiOnceResetThreshold int32 + FszSorterRef U32 + FiPrngSeed uint32 +} /* sqlite3.c:19356:1 */ + +// This macro is used inside of assert() statements to indicate that +// the assert is only valid on a well-formed database. Instead of: +// +// assert( X ); +// +// One writes: +// +// assert( X || CORRUPT_DB ); +// +// CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +// that the database is definitely corrupt, only that it might be corrupt. +// For most test cases, CORRUPT_DB is set to false using a special +// sqlite3_test_control(). This enables assert() statements to prove +// things that are always true for well-formed databases. + +// Context pointer passed down through the tree-walk. +type SrcCount = struct { + FpSrc uintptr + FiSrcInner int32 + FnThis int32 + FnOther int32 + _ [4]byte +} /* sqlite3.c:19454:5 */ + +// This macro is used inside of assert() statements to indicate that +// the assert is only valid on a well-formed database. Instead of: +// +// assert( X ); +// +// One writes: +// +// assert( X || CORRUPT_DB ); +// +// CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +// that the database is definitely corrupt, only that it might be corrupt. +// For most test cases, CORRUPT_DB is set to false using a special +// sqlite3_test_control(). This enables assert() statements to prove +// things that are always true for well-formed databases. + +// Context pointer passed down through the tree-walk. +type IdxCover = struct { + FpIdx uintptr + FiCur int32 + _ [4]byte +} /* sqlite3.c:19457:5 */ + +// This macro is used inside of assert() statements to indicate that +// the assert is only valid on a well-formed database. Instead of: +// +// assert( X ); +// +// One writes: +// +// assert( X || CORRUPT_DB ); +// +// CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +// that the database is definitely corrupt, only that it might be corrupt. +// For most test cases, CORRUPT_DB is set to false using a special +// sqlite3_test_control(). This enables assert() statements to prove +// things that are always true for well-formed databases. + +// Context pointer passed down through the tree-walk. +type IdxExprTrans1 = struct { + FpIdxExpr uintptr + FiTabCur int32 + FiIdxCur int32 + FiIdxCol int32 + FiTabCol int32 + FpWInfo uintptr + Fdb uintptr +} /* sqlite3.c:19458:5 */ + +// This macro is used inside of assert() statements to indicate that +// the assert is only valid on a well-formed database. Instead of: +// +// assert( X ); +// +// One writes: +// +// assert( X || CORRUPT_DB ); +// +// CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +// that the database is definitely corrupt, only that it might be corrupt. +// For most test cases, CORRUPT_DB is set to false using a special +// sqlite3_test_control(). This enables assert() statements to prove +// things that are always true for well-formed databases. + +// Context pointer passed down through the tree-walk. +type WindowRewrite1 = struct { + FpWin uintptr + FpSrc uintptr + FpSub uintptr + FpTab uintptr + FpSubSelect uintptr +} /* sqlite3.c:19461:5 */ + +// This macro is used inside of assert() statements to indicate that +// the assert is only valid on a well-formed database. Instead of: +// +// assert( X ); +// +// One writes: +// +// assert( X || CORRUPT_DB ); +// +// CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +// that the database is definitely corrupt, only that it might be corrupt. +// For most test cases, CORRUPT_DB is set to false using a special +// sqlite3_test_control(). This enables assert() statements to prove +// things that are always true for well-formed databases. + +// Context pointer passed down through the tree-walk. +type WhereConst1 = struct { + FpParse uintptr + FpOomFault uintptr + FnConst int32 + FnChng int32 + FbHasAffBlob int32 + _ [4]byte + FapExpr uintptr +} /* sqlite3.c:19462:5 */ + +// This macro is used inside of assert() statements to indicate that +// the assert is only valid on a well-formed database. Instead of: +// +// assert( X ); +// +// One writes: +// +// assert( X || CORRUPT_DB ); +// +// CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate +// that the database is definitely corrupt, only that it might be corrupt. +// For most test cases, CORRUPT_DB is set to false using a special +// sqlite3_test_control(). This enables assert() statements to prove +// things that are always true for well-formed databases. + +// Context pointer passed down through the tree-walk. +type RenameCtx1 = struct { + FpList uintptr + FnList int32 + FiCol int32 + FpTab uintptr + FzOld uintptr +} /* sqlite3.c:19463:5 */ + +//************* End of sqliteInt.h ****************************************** +//************* Begin file global.c ***************************************** +// 2008 June 13 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains definitions of global variables and constants. +// #include "sqliteInt.h" + +// An array to map all upper-case characters into their corresponding +// lower-case character. +// +// SQLite only considers US-ASCII (or EBCDIC) characters. We do not +// handle case conversions for the UTF character set since the tables +// involved are nearly as big or bigger than SQLite itself. +var Xsqlite3UpperToLower = [274]uint8{ + uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), + uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), + uint8(36), uint8(37), uint8(38), uint8(39), uint8(40), uint8(41), uint8(42), uint8(43), uint8(44), uint8(45), uint8(46), uint8(47), uint8(48), uint8(49), uint8(50), uint8(51), uint8(52), uint8(53), + uint8(54), uint8(55), uint8(56), uint8(57), uint8(58), uint8(59), uint8(60), uint8(61), uint8(62), uint8(63), uint8(64), uint8(97), uint8(98), uint8(99), uint8(100), uint8(101), uint8(102), uint8(103), + uint8(104), uint8(105), uint8(106), uint8(107), uint8(108), uint8(109), uint8(110), uint8(111), uint8(112), uint8(113), uint8(114), uint8(115), uint8(116), uint8(117), uint8(118), uint8(119), uint8(120), uint8(121), + uint8(122), uint8(91), uint8(92), uint8(93), uint8(94), uint8(95), uint8(96), uint8(97), uint8(98), uint8(99), uint8(100), uint8(101), uint8(102), uint8(103), uint8(104), uint8(105), uint8(106), uint8(107), + uint8(108), uint8(109), uint8(110), uint8(111), uint8(112), uint8(113), uint8(114), uint8(115), uint8(116), uint8(117), uint8(118), uint8(119), uint8(120), uint8(121), uint8(122), uint8(123), uint8(124), uint8(125), + uint8(126), uint8(127), uint8(128), uint8(129), uint8(130), uint8(131), uint8(132), uint8(133), uint8(134), uint8(135), uint8(136), uint8(137), uint8(138), uint8(139), uint8(140), uint8(141), uint8(142), uint8(143), + uint8(144), uint8(145), uint8(146), uint8(147), uint8(148), uint8(149), uint8(150), uint8(151), uint8(152), uint8(153), uint8(154), uint8(155), uint8(156), uint8(157), uint8(158), uint8(159), uint8(160), uint8(161), + uint8(162), uint8(163), uint8(164), uint8(165), uint8(166), uint8(167), uint8(168), uint8(169), uint8(170), uint8(171), uint8(172), uint8(173), uint8(174), uint8(175), uint8(176), uint8(177), uint8(178), uint8(179), + uint8(180), uint8(181), uint8(182), uint8(183), uint8(184), uint8(185), uint8(186), uint8(187), uint8(188), uint8(189), uint8(190), uint8(191), uint8(192), uint8(193), uint8(194), uint8(195), uint8(196), uint8(197), + uint8(198), uint8(199), uint8(200), uint8(201), uint8(202), uint8(203), uint8(204), uint8(205), uint8(206), uint8(207), uint8(208), uint8(209), uint8(210), uint8(211), uint8(212), uint8(213), uint8(214), uint8(215), + uint8(216), uint8(217), uint8(218), uint8(219), uint8(220), uint8(221), uint8(222), uint8(223), uint8(224), uint8(225), uint8(226), uint8(227), uint8(228), uint8(229), uint8(230), uint8(231), uint8(232), uint8(233), + uint8(234), uint8(235), uint8(236), uint8(237), uint8(238), uint8(239), uint8(240), uint8(241), uint8(242), uint8(243), uint8(244), uint8(245), uint8(246), uint8(247), uint8(248), uint8(249), uint8(250), uint8(251), + uint8(252), uint8(253), uint8(254), uint8(255), + // All of the upper-to-lower conversion data is above. The following + // 18 integers are completely unrelated. They are appended to the + // sqlite3UpperToLower[] array to avoid UBSAN warnings. Here's what is + // going on: + // + // The SQL comparison operators (<>, =, >, <=, <, and >=) are implemented + // by invoking sqlite3MemCompare(A,B) which compares values A and B and + // returns negative, zero, or positive if A is less then, equal to, or + // greater than B, respectively. Then the true false results is found by + // consulting sqlite3aLTb[opcode], sqlite3aEQb[opcode], or + // sqlite3aGTb[opcode] depending on whether the result of compare(A,B) + // is negative, zero, or positive, where opcode is the specific opcode. + // The only works because the comparison opcodes are consecutive and in + // this order: NE EQ GT LE LT GE. Various assert()s throughout the code + // ensure that is the case. + // + // These elements must be appended to another array. Otherwise the + // index (here shown as [256-OP_Ne]) would be out-of-bounds and thus + // be undefined behavior. That's goofy, but the C-standards people thought + // it was a good idea, so here we are. + // NE EQ GT LE LT GE + uint8(1), uint8(0), uint8(0), uint8(1), uint8(1), uint8(0), // aLTb[]: Use when compare(A,B) less than zero + uint8(0), uint8(1), uint8(0), uint8(1), uint8(0), uint8(1), // aEQb[]: Use when compare(A,B) equals zero + uint8(1), uint8(0), uint8(1), uint8(0), uint8(0), uint8(1), // aGTb[]: Use when compare(A,B) greater than zero +} /* sqlite3.c:20818:36 */ +var Xsqlite3aLTb uintptr = 0 /* sqlite3.c:20880:36 */ +var Xsqlite3aEQb uintptr = 0 /* sqlite3.c:20881:36 */ +var Xsqlite3aGTb uintptr = 0 /* sqlite3.c:20882:36 */ + +// The following 256 byte lookup table is used to support SQLites built-in +// equivalents to the following standard library functions: +// +// isspace() 0x01 +// isalpha() 0x02 +// isdigit() 0x04 +// isalnum() 0x06 +// isxdigit() 0x08 +// toupper() 0x20 +// SQLite identifier character 0x40 +// Quote character 0x80 +// +// Bit 0x20 is set if the mapped character requires translation to upper +// case. i.e. if the character is a lower-case ASCII character. +// If x is a lower-case ASCII character, then its upper-case equivalent +// is (x - 0x20). Therefore toupper() can be implemented as: +// +// (x & ~(map[x]&0x20)) +// +// The equivalent of tolower() is implemented using the sqlite3UpperToLower[] +// array. tolower() is used more often than toupper() by SQLite. +// +// Bit 0x40 is set if the character is non-alphanumeric and can be used in an +// SQLite identifier. Identifiers are alphanumerics, "_", "$", and any +// non-ASCII UTF character. Hence the test for whether or not a character is +// part of an identifier is 0x46. +var Xsqlite3CtypeMap = [256]uint8{ + uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 00..07 ........ + uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x00), // 08..0f ........ + uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 10..17 ........ + uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 18..1f ........ + uint8(0x01), uint8(0x00), uint8(0x80), uint8(0x00), uint8(0x40), uint8(0x00), uint8(0x00), uint8(0x80), // 20..27 !"#$%&' + uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 28..2f ()*+,-./ + uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), // 30..37 01234567 + uint8(0x0c), uint8(0x0c), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 38..3f 89:;<=>? + + uint8(0x00), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x02), // 40..47 @ABCDEFG + uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), // 48..4f HIJKLMNO + uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), // 50..57 PQRSTUVW + uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x80), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x40), // 58..5f XYZ[\]^_ + uint8(0x80), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x22), // 60..67 `abcdefg + uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), // 68..6f hijklmno + uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), // 70..77 pqrstuvw + uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 78..7f xyz{|}~. + + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 80..87 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 88..8f ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 90..97 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 98..9f ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // a0..a7 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // a8..af ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // b0..b7 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // b8..bf ........ + + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // c0..c7 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // c8..cf ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // d0..d7 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // d8..df ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // e0..e7 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // e8..ef ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // f0..f7 ........ + uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // f8..ff ........ +} /* sqlite3.c:20912:36 */ + +// EVIDENCE-OF: R-02982-34736 In order to maintain full backwards +// compatibility for legacy applications, the URI filename capability is +// disabled by default. +// +// EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled +// using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options. +// +// EVIDENCE-OF: R-43642-56306 By default, URI handling is globally +// disabled. The default value may be changed by compiling with the +// SQLITE_USE_URI symbol defined. + +// EVIDENCE-OF: R-38720-18127 The default setting is determined by the +// SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if +// that compile-time option is omitted. + +// The minimum PMA size is set to this value multiplied by the database +// page size in bytes. + +// Statement journals spill to disk when their size exceeds the following +// threshold (in bytes). 0 means that statement journals are created and +// written to disk immediately (the default behavior for SQLite versions +// before 3.12.0). -1 means always keep the entire statement journal in +// memory. (The statement journal is also always held entirely in memory +// if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this +// setting.) + +// The default lookaside-configuration, the format "SZ,N". SZ is the +// number of bytes in each lookaside slot (should be a multiple of 8) +// and N is the number of slots. The lookaside-configuration can be +// changed as start-time using sqlite3_config(SQLITE_CONFIG_LOOKASIDE) +// or at run-time for an individual database connection using +// sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE); +// +// With the two-size-lookaside enhancement, less lookaside is required. +// The default configuration of 1200,40 actually provides 30 1200-byte slots +// and 93 128-byte slots, which is more lookaside than is available +// using the older 1200,100 configuration without two-size-lookaside. + +// The default maximum size of an in-memory database created using +// sqlite3_deserialize() + +// The following singleton contains the global configuration for +// the SQLite library. +var Xsqlite3Config = Sqlite3Config{ + FbMemstat: SQLITE_DEFAULT_MEMSTATUS, // bMemstat + FbCoreMutex: U8(1), // bCoreMutex + FbFullMutex: (U8(libc.Bool32(SQLITE_THREADSAFE == 1))), // bOpenUri + FbUseCis: U8(SQLITE_ALLOW_COVERING_INDEX_SCAN), // bSmallMalloc + FbExtraSchemaChecks: U8(1), // bExtraSchemaChecks + FmxStrlen: 0x7ffffffe, // neverCorrupt + FszLookaside: 1200, FnLookaside: 40, // szLookaside, nLookaside + FnStmtSpill: (64 * 1024), // szMmap + FmxMmap: int64(SQLITE_MAX_MMAP_SIZE), // szPage + FnPage: SQLITE_DEFAULT_PCACHE_INITSZ, // sharedCacheEnabled + FszPma: U32(SQLITE_SORTER_PMASZ), // pLogArg + FmxMemdbSize: int64(SQLITE_MEMDB_DEFAULT_MAXSIZE), // bLocaltimeFault + FiOnceResetThreshold: 0x7ffffffe, // iOnceResetThreshold + FszSorterRef: U32(SQLITE_DEFAULT_SORTERREF_SIZE), // iPrngSeed +} /* sqlite3.c:21032:48 */ + +// Hash table for global functions - functions common to all +// database connections. After initialization, this table is +// read-only. +var Xsqlite3BuiltinFunctions FuncDefHash /* sqlite3.c:21093:28: */ + +// The value of the "pending" byte must be 0x40000000 (1 byte past the +// 1-gibabyte boundary) in a compatible database. SQLite never uses +// the database page that contains the pending byte. It never attempts +// to read or write that page. The pending byte page is set aside +// for use by the VFS layers as space for managing file locks. +// +// During testing, it is often desirable to move the pending byte to +// a different position in the file. This allows code that has to +// deal with the pending byte to run on files that are much smaller +// than 1 GiB. The sqlite3_test_control() interface can be used to +// move the pending byte. +// +// IMPORTANT: Changing the pending byte to any value other than +// 0x40000000 results in an incompatible database file format! +// Changing the pending byte during operation will result in undefined +// and incorrect behavior. +var Xsqlite3PendingByte int32 = 0x40000000 /* sqlite3.c:21122:20 */ + +// Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS. +var Xsqlite3SelectTrace U32 = U32(0) /* sqlite3.c:21128:20 */ +var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ + +// #include "opcodes.h" +// Properties of opcodes. The OPFLG_INITIALIZER macro is +// created by mkopcodeh.awk during compilation. Data is obtained +// from the comments following the "case OP_xxxx:" statements in +// the vdbe.c file. +var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ + +// Name of the default collating sequence +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 319 /* "BINARY" */)) /* sqlite3.c:21143:27 */ + +//************* End of global.c ********************************************* +//************* Begin file status.c ***************************************** +// 2008 June 18 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This module implements the sqlite3_status() interface and related +// functionality. +// #include "sqliteInt.h" +//************* Include vdbeInt.h in the middle of status.c ***************** +//************* Begin file vdbeInt.h **************************************** +// 2003 September 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the header file for information that is private to the +// VDBE. This information used to all be at the top of the single +// source code file "vdbe.c". When that file became too big (over +// 6000 lines long) it was split up into several smaller files and +// this header information was factored out. + +// The maximum number of times that a statement will try to reparse +// itself before giving up and returning SQLITE_SCHEMA. + +// VDBE_DISPLAY_P4 is true or false depending on whether or not the +// "explain" P4 display logic is enabled. + +// SQL is translated into a sequence of instructions to be +// executed by a virtual machine. Each instruction is an instance +// of the following structure. +type Op = VdbeOp1 /* sqlite3.c:21210:23 */ + +// Boolean values +type Bool = uint32 /* sqlite3.c:21215:18 */ + +// Opaque type used by code in vdbesort.c +type VdbeSorter1 = struct { + FmnPmaSize int32 + FmxPmaSize int32 + FmxKeysize int32 + Fpgsz int32 + FpReader uintptr + FpMerger uintptr + Fdb uintptr + FpKeyInfo uintptr + FpUnpacked uintptr + Flist SorterList + FiMemory int32 + FnMemory int32 + FbUsePMA U8 + FbUseThreads U8 + FiPrev U8 + FnTask U8 + FtypeMask U8 + _ [3]byte + FaTask [1]SortSubtask +} /* sqlite3.c:21218:9 */ + +// Opaque type used by code in vdbesort.c +type VdbeSorter = VdbeSorter1 /* sqlite3.c:21218:27 */ + +// Elements of the linked list at Vdbe.pAuxData +type AuxData1 = struct { + FiAuxOp int32 + FiAuxArg int32 + FpAux uintptr + FxDeleteAux uintptr + FpNextAux uintptr +} /* sqlite3.c:1331:9 */ + +// Elements of the linked list at Vdbe.pAuxData +type AuxData = AuxData1 /* sqlite3.c:21221:24 */ + +// Types of VDBE cursors + +// A VdbeCursor is an superclass (a wrapper) for various cursor objects: +// +// * A b-tree cursor +// - In the main database or in an ephemeral database +// - On either an index or a table +// * A sorter +// * A virtual table +// * A one-row "pseudotable" stored in a single register +type VdbeCursor1 = struct { + FeCurType U8 + FiDb I8 + FnullRow U8 + FdeferredMoveto U8 + FisTable U8 + _ [3]byte + FisEphemeral uint8 /* Bool isEphemeral: 1, Bool useRandomRowid: 1, Bool isOrdered: 1, Bool hasBeenDuped: 1 */ + _ [1]byte + FseekHit U16 + _ [4]byte + FpBtx uintptr + FseqCount I64 + FaAltMap uintptr + FcacheStatus U32 + FseekResult int32 + FpAltCursor uintptr + Fuc struct{ FpCursor uintptr } + FpKeyInfo uintptr + FiHdrOffset U32 + FpgnoRoot Pgno + FnField I16 + FnHdrParsed U16 + _ [4]byte + FmovetoTarget I64 + FaOffset uintptr + FaRow uintptr + FpayloadSize U32 + FszRow U32 + FaType [1]U32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +// Types of VDBE cursors + +// A VdbeCursor is an superclass (a wrapper) for various cursor objects: +// +// * A b-tree cursor +// - In the main database or in an ephemeral database +// - On either an index or a table +// * A sorter +// * A virtual table +// * A one-row "pseudotable" stored in a single register +type VdbeCursor = VdbeCursor1 /* sqlite3.c:21239:27 */ + +// A value for VdbeCursor.cacheStatus that means the cache is always invalid. + +// When a sub-program is executed (OP_Program), a structure of this type +// is allocated to store the current value of the program counter, as +// well as the current memory cell array and various other frame specific +// values stored in the Vdbe struct. When the sub-program is finished, +// these values are copied back to the Vdbe from the VdbeFrame structure, +// restoring the state of the VM to as it was before the sub-program +// began executing. +// +// The memory for a VdbeFrame object is allocated and managed by a memory +// cell in the parent (calling) frame. When the memory cell is deleted or +// overwritten, the VdbeFrame object is not freed immediately. Instead, it +// is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame +// list is deleted when the VM is reset in VdbeHalt(). The reason for doing +// this instead of deleting the VdbeFrame immediately is to avoid recursive +// calls to sqlite3VdbeMemRelease() when the memory cells belonging to the +// child frame are released. +// +// The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is +// set to NULL if the currently executing frame is the main program. +type VdbeFrame1 = struct { + Fv uintptr + FpParent uintptr + FaOp uintptr + FanExec uintptr + FaMem uintptr + FapCsr uintptr + FaOnce uintptr + Ftoken uintptr + FlastRowid I64 + FpAuxData uintptr + FnCursor int32 + Fpc int32 + FnOp int32 + FnMem int32 + FnChildMem int32 + FnChildCsr int32 + FnChange int32 + FnDbChange int32 +} /* sqlite3.c:1331:9 */ + +// A value for VdbeCursor.cacheStatus that means the cache is always invalid. + +// When a sub-program is executed (OP_Program), a structure of this type +// is allocated to store the current value of the program counter, as +// well as the current memory cell array and various other frame specific +// values stored in the Vdbe struct. When the sub-program is finished, +// these values are copied back to the Vdbe from the VdbeFrame structure, +// restoring the state of the VM to as it was before the sub-program +// began executing. +// +// The memory for a VdbeFrame object is allocated and managed by a memory +// cell in the parent (calling) frame. When the memory cell is deleted or +// overwritten, the VdbeFrame object is not freed immediately. Instead, it +// is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame +// list is deleted when the VM is reset in VdbeHalt(). The reason for doing +// this instead of deleting the VdbeFrame immediately is to avoid recursive +// calls to sqlite3VdbeMemRelease() when the memory cells belonging to the +// child frame are released. +// +// The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is +// set to NULL if the currently executing frame is the main program. +type VdbeFrame = VdbeFrame1 /* sqlite3.c:21326:26 */ + +// Magic number for sanity checking on VdbeFrame objects + +// Return a pointer to the array of registers allocated for use +// by a VdbeFrame. + +// Internally, the vdbe manipulates nearly all SQL values as Mem +// structures. Each Mem struct may cache multiple representations (string, +// integer etc.) of the same value. +type MemValue = struct{ Fr float64 } /* sqlite3.c:1331:9 */ + +// A bitfield type for use inside of structures. Always follow with :N where +// N is the number of bits. +type Bft = uint32 /* sqlite3.c:21509:18 */ // Bit Field Type + +// The ScanStatus object holds a single value for the +// sqlite3_stmt_scanstatus() interface. +type ScanStatus1 = struct { + FaddrExplain int32 + FaddrLoop int32 + FaddrVisit int32 + FiSelectID int32 + FnEst LogEst + _ [6]byte + FzName uintptr +} /* sqlite3.c:21514:9 */ + +// Bit Field Type + +// The ScanStatus object holds a single value for the +// sqlite3_stmt_scanstatus() interface. +type ScanStatus = ScanStatus1 /* sqlite3.c:21514:27 */ + +// The DblquoteStr object holds the text of a double-quoted +// string for a prepared statement. A linked list of these objects +// is constructed during statement parsing and is held on Vdbe.pDblStr. +// When computing a normalized SQL statement for an SQL statement, that +// list is consulted for each double-quoted identifier to see if the +// identifier should really be a string literal. +type DblquoteStr1 = struct { + FpNextStr uintptr + Fz [8]int8 +} /* sqlite3.c:21531:9 */ + +// The DblquoteStr object holds the text of a double-quoted +// string for a prepared statement. A linked list of these objects +// is constructed during statement parsing and is held on Vdbe.pDblStr. +// When computing a normalized SQL statement for an SQL statement, that +// list is consulted for each double-quoted identifier to see if the +// identifier should really be a string literal. +type DblquoteStr = DblquoteStr1 /* sqlite3.c:21531:28 */ + +//************* End of vdbeInt.h ******************************************** +//************* Continuing where we left off in status.c ******************** + +// Variables in which to record status information. +type Sqlite3StatValueType = Sqlite3_int64 /* sqlite3.c:21799:23 */ +type sqlite3StatType = struct { + FnowValue [10]Sqlite3StatValueType + FmxValue [10]Sqlite3StatValueType +} /* sqlite3.c:21803:9 */ + +type Sqlite3StatType = sqlite3StatType /* sqlite3.c:21803:32 */ +var sqlite3Stat = sqlite3StatType{} /* sqlite3.c:21807:3 */ + +// Elements of sqlite3Stat[] are protected by either the memory allocator +// mutex, or by the pcache1 mutex. The following array determines which. +var statMutex = [10]int8{ + int8(0), // SQLITE_STATUS_MEMORY_USED + int8(1), // SQLITE_STATUS_PAGECACHE_USED + int8(1), // SQLITE_STATUS_PAGECACHE_OVERFLOW + int8(0), // SQLITE_STATUS_SCRATCH_USED + int8(0), // SQLITE_STATUS_SCRATCH_OVERFLOW + int8(0), // SQLITE_STATUS_MALLOC_SIZE + int8(0), // SQLITE_STATUS_PARSER_STACK + int8(1), // SQLITE_STATUS_PAGECACHE_SIZE + int8(0), // SQLITE_STATUS_SCRATCH_SIZE + int8(0), // SQLITE_STATUS_MALLOC_COUNT +} /* sqlite3.c:21813:19 */ + +// The "wsdStat" macro will resolve to the status information +// state vector. If writable static data is unsupported on the target, +// we have to locate the state vector at run-time. In the more common +// case where writable static data is supported, wsdStat can refer directly +// to the "sqlite3Stat" state vector declared above. + +// Return the current value of a status parameter. The caller must +// be holding the appropriate mutex. +func Xsqlite3StatusValue(tls *libc.TLS, op int32) Sqlite3_int64 { /* sqlite3.c:21845:30: */ + + return *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) +} + +// Add N to the value of a status record. The caller must hold the +// appropriate mutex. (Locking is checked by assert()). +// +// The StatusUp() routine can accept positive or negative values for N. +// The value of N is added to the current status value and the high-water +// mark is adjusted if necessary. +// +// The StatusDown() routine lowers the current value by N. The highwater +// mark is unchanged. N must be non-negative for StatusDown(). +func Xsqlite3StatusUp(tls *libc.TLS, op int32, N int32) { /* sqlite3.c:21865:21: */ + + *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) += (Sqlite3StatValueType(N)) + if *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) > *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) + 80 /* &.mxValue */) + uintptr(op)*8)) { + *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) + 80 /* &.mxValue */) + uintptr(op)*8)) = *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) + } +} + +func Xsqlite3StatusDown(tls *libc.TLS, op int32, N int32) { /* sqlite3.c:21876:21: */ + + *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) -= (Sqlite3StatValueType(N)) +} + +// Adjust the highwater mark if necessary. +// The caller must hold the appropriate mutex. +func Xsqlite3StatusHighwater(tls *libc.TLS, op int32, X int32) { /* sqlite3.c:21890:21: */ + var newValue Sqlite3StatValueType + + newValue = Sqlite3StatValueType(X) + + if newValue > *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) + 80 /* &.mxValue */) + uintptr(op)*8)) { + *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) + 80 /* &.mxValue */) + uintptr(op)*8)) = newValue + } +} + +// Query status information. +func Xsqlite3_status64(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) int32 { /* sqlite3.c:21910:16: */ + var pMutex uintptr + _ = pMutex + + if (op < 0) || (op >= (int32(uint64(unsafe.Sizeof([10]Sqlite3StatValueType{})) / uint64(unsafe.Sizeof(Sqlite3StatValueType(0)))))) { + return Xsqlite3MisuseError(tls, 21919) + } + if statMutex[op] != 0 { + pMutex = Xsqlite3Pcache1Mutex(tls) + } else { + pMutex = Xsqlite3MallocMutex(tls) + } + Xsqlite3_mutex_enter(tls, pMutex) + *(*Sqlite3_int64)(unsafe.Pointer(pCurrent)) = *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) + *(*Sqlite3_int64)(unsafe.Pointer(pHighwater)) = *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) + 80 /* &.mxValue */) + uintptr(op)*8)) + if resetFlag != 0 { + *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) + 80 /* &.mxValue */) + uintptr(op)*8)) = *(*Sqlite3StatValueType)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Stat)) /* &.nowValue */) + uintptr(op)*8)) + } + Xsqlite3_mutex_leave(tls, pMutex) + _ = pMutex // Prevent warning when SQLITE_THREADSAFE=0 + return SQLITE_OK +} + +func Xsqlite3_status(tls *libc.TLS, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) int32 { /* sqlite3.c:21935:16: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*Sqlite3_int64)(unsafe.Pointer(bp /* iCur */)) = int64(0) + *(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* iHwtr */)) = int64(0) + var rc int32 + rc = Xsqlite3_status64(tls, op, bp /* &iCur */, bp+8 /* &iHwtr */, resetFlag) + if rc == 0 { + *(*int32)(unsafe.Pointer(pCurrent)) = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp /* iCur */))) + *(*int32)(unsafe.Pointer(pHighwater)) = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* iHwtr */))) + } + return rc +} + +// Return the number of LookasideSlot elements on the linked list +func countLookasideSlots(tls *libc.TLS, p uintptr) U32 { /* sqlite3.c:21952:12: */ + var cnt U32 = U32(0) + for p != 0 { + p = (*LookasideSlot)(unsafe.Pointer(p)).FpNext + cnt++ + } + return cnt +} + +// Count the number of slots of lookaside memory that are outstanding +func Xsqlite3LookasideUsed(tls *libc.TLS, db uintptr, pHighwater uintptr) int32 { /* sqlite3.c:21964:20: */ + var nInit U32 = countLookasideSlots(tls, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit) + var nFree U32 = countLookasideSlots(tls, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree) + nInit = nInit + (countLookasideSlots(tls, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit)) + nFree = nFree + (countLookasideSlots(tls, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree)) + if pHighwater != 0 { + *(*int32)(unsafe.Pointer(pHighwater)) = (int32((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot - nInit)) + } + return (int32((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot - (nInit + nFree))) +} + +// Query status information for a single database connection +func Xsqlite3_db_status(tls *libc.TLS, db uintptr, op int32, pCurrent uintptr, pHighwater uintptr, resetFlag int32) int32 { /* sqlite3.c:21978:16: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var rc int32 = SQLITE_OK // Return code + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + switch op { + case SQLITE_DBSTATUS_LOOKASIDE_USED: + { + *(*int32)(unsafe.Pointer(pCurrent)) = Xsqlite3LookasideUsed(tls, db, pHighwater) + if resetFlag != 0 { + var p uintptr = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + if p != 0 { + for (*LookasideSlot)(unsafe.Pointer(p)).FpNext != 0 { + p = (*LookasideSlot)(unsafe.Pointer(p)).FpNext + } + (*LookasideSlot)(unsafe.Pointer(p)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = uintptr(0) + } + p = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + if p != 0 { + for (*LookasideSlot)(unsafe.Pointer(p)).FpNext != 0 { + p = (*LookasideSlot)(unsafe.Pointer(p)).FpNext + } + (*LookasideSlot)(unsafe.Pointer(p)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = uintptr(0) + } + } + break + + } + + case SQLITE_DBSTATUS_LOOKASIDE_HIT: + fallthrough + case SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE: + fallthrough + case SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: + { + + *(*int32)(unsafe.Pointer(pCurrent)) = 0 + *(*int32)(unsafe.Pointer(pHighwater)) = int32(*(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */) + uintptr((op-SQLITE_DBSTATUS_LOOKASIDE_HIT))*4))) + if resetFlag != 0 { + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */) + uintptr((op-SQLITE_DBSTATUS_LOOKASIDE_HIT))*4)) = U32(0) + } + break + + } + + // Return an approximation for the amount of memory currently used + // by all pagers associated with the given database connection. The + // highwater mark is meaningless and is returned as zero. + case SQLITE_DBSTATUS_CACHE_USED_SHARED: + fallthrough + case SQLITE_DBSTATUS_CACHE_USED: + { + var totalUsed int32 = 0 + var i int32 + Xsqlite3BtreeEnterAll(tls, db) + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + var pPager uintptr = Xsqlite3BtreePager(tls, pBt) + var nByte int32 = Xsqlite3PagerMemUsed(tls, pPager) + if op == SQLITE_DBSTATUS_CACHE_USED_SHARED { + nByte = (nByte / Xsqlite3BtreeConnectionCount(tls, pBt)) + } + totalUsed = totalUsed + (nByte) + } + } + Xsqlite3BtreeLeaveAll(tls, db) + *(*int32)(unsafe.Pointer(pCurrent)) = totalUsed + *(*int32)(unsafe.Pointer(pHighwater)) = 0 + break + + } + + // *pCurrent gets an accurate estimate of the amount of memory used + // to store the schema for all databases (main, temp, and any ATTACHed + // databases. *pHighwater is set to zero. + case SQLITE_DBSTATUS_SCHEMA_USED: + { + var i int32 // Used to iterate through schemas + *(*int32)(unsafe.Pointer(bp /* nByte */)) = 0 // Used to accumulate return value + + Xsqlite3BtreeEnterAll(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp /* &nByte */ + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pSchema uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpSchema + if pSchema != uintptr(0) { + var p uintptr + + *(*int32)(unsafe.Pointer(bp /* nByte */)) += int32((uint32((*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 32 /* &.xRoundup */))))(tls, int32(unsafe.Sizeof(HashElem{})))) * ((((*Schema)(unsafe.Pointer(pSchema)).FtblHash.Fcount + + (*Schema)(unsafe.Pointer(pSchema)).FtrigHash.Fcount) + + (*Schema)(unsafe.Pointer(pSchema)).FidxHash.Fcount) + + (*Schema)(unsafe.Pointer(pSchema)).FfkeyHash.Fcount))) + *(*int32)(unsafe.Pointer(bp /* nByte */)) += int32(Xsqlite3_msize(tls, (*Schema)(unsafe.Pointer(pSchema)).FtblHash.Fht)) + *(*int32)(unsafe.Pointer(bp /* nByte */)) += int32(Xsqlite3_msize(tls, (*Schema)(unsafe.Pointer(pSchema)).FtrigHash.Fht)) + *(*int32)(unsafe.Pointer(bp /* nByte */)) += int32(Xsqlite3_msize(tls, (*Schema)(unsafe.Pointer(pSchema)).FidxHash.Fht)) + *(*int32)(unsafe.Pointer(bp /* nByte */)) += int32(Xsqlite3_msize(tls, (*Schema)(unsafe.Pointer(pSchema)).FfkeyHash.Fht)) + + for p = (*Hash)(unsafe.Pointer((pSchema + 56 /* &.trigHash */))).Ffirst; p != 0; p = (*HashElem)(unsafe.Pointer(p)).Fnext { + Xsqlite3DeleteTrigger(tls, db, (*HashElem)(unsafe.Pointer(p)).Fdata) + } + for p = (*Hash)(unsafe.Pointer((pSchema + 8 /* &.tblHash */))).Ffirst; p != 0; p = (*HashElem)(unsafe.Pointer(p)).Fnext { + Xsqlite3DeleteTable(tls, db, (*HashElem)(unsafe.Pointer(p)).Fdata) + } + } + } + (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) + Xsqlite3BtreeLeaveAll(tls, db) + + *(*int32)(unsafe.Pointer(pHighwater)) = 0 + *(*int32)(unsafe.Pointer(pCurrent)) = *(*int32)(unsafe.Pointer(bp /* nByte */)) + break + + } + + // *pCurrent gets an accurate estimate of the amount of memory used + // to store all prepared statements. + // *pHighwater is set to zero. + case SQLITE_DBSTATUS_STMT_USED: + { + var pVdbe uintptr // Used to iterate through VMs + *(*int32)(unsafe.Pointer(bp + 4 /* nByte */)) = 0 // Used to accumulate return value + + (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp + 4 /* &nByte */ + for pVdbe = (*Sqlite3)(unsafe.Pointer(db)).FpVdbe; pVdbe != 0; pVdbe = (*Vdbe1)(unsafe.Pointer(pVdbe)).FpNext { + Xsqlite3VdbeClearObject(tls, db, pVdbe) + Xsqlite3DbFree(tls, db, pVdbe) + } + (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) + + *(*int32)(unsafe.Pointer(pHighwater)) = 0 // IMP: R-64479-57858 + *(*int32)(unsafe.Pointer(pCurrent)) = *(*int32)(unsafe.Pointer(bp + 4 /* nByte */)) + + break + + } + + // Set *pCurrent to the total cache hits or misses encountered by all + // pagers the database handle is connected to. *pHighwater is always set + // to zero. + case SQLITE_DBSTATUS_CACHE_SPILL: + op = (SQLITE_DBSTATUS_CACHE_WRITE + 1) + fallthrough + case SQLITE_DBSTATUS_CACHE_HIT: + fallthrough + case SQLITE_DBSTATUS_CACHE_MISS: + fallthrough + case SQLITE_DBSTATUS_CACHE_WRITE: + { + var i int32 + *(*int32)(unsafe.Pointer(bp + 8 /* nRet */)) = 0 + + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + if (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpBt != 0 { + var pPager uintptr = Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpBt) + Xsqlite3PagerCacheStat(tls, pPager, op, resetFlag, bp+8 /* &nRet */) + } + } + *(*int32)(unsafe.Pointer(pHighwater)) = 0 // IMP: R-42420-56072 + // IMP: R-54100-20147 + // IMP: R-29431-39229 + *(*int32)(unsafe.Pointer(pCurrent)) = *(*int32)(unsafe.Pointer(bp + 8 /* nRet */)) + break + + } + + // Set *pCurrent to non-zero if there are unresolved deferred foreign + // key constraints. Set *pCurrent to zero if all foreign key constraints + // have been satisfied. The *pHighwater is always set to zero. + case SQLITE_DBSTATUS_DEFERRED_FKS: + { + *(*int32)(unsafe.Pointer(pHighwater)) = 0 // IMP: R-11967-56545 + *(*int32)(unsafe.Pointer(pCurrent)) = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons > int64(0)) || ((*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons > int64(0)))) + break + + } + + default: + { + rc = SQLITE_ERROR + + } + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +//************* End of status.c ********************************************* +//************* Begin file date.c ******************************************* +// 2003 October 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement date and time +// functions for SQLite. +// +// There is only one exported symbol in this file - the function +// sqlite3RegisterDateTimeFunctions() found at the bottom of the file. +// All other code has file scope. +// +// SQLite processes all times and dates as julian day numbers. The +// dates and times are stored as the number of days since noon +// in Greenwich on November 24, 4714 B.C. according to the Gregorian +// calendar system. +// +// 1970-01-01 00:00:00 is JD 2440587.5 +// 2000-01-01 00:00:00 is JD 2451544.5 +// +// This implementation requires years to be expressed as a 4-digit number +// which means that only dates between 0000-01-01 and 9999-12-31 can +// be represented, even though julian day numbers allow a much wider +// range of dates. +// +// The Gregorian calendar system is used for all dates and times, +// even those that predate the Gregorian calendar. Historians usually +// use the julian calendar for dates prior to 1582-10-15 and for some +// dates afterwards, depending on locale. Beware of this difference. +// +// The conversion algorithms are implemented based on descriptions +// in the following text: +// +// Jean Meeus +// Astronomical Algorithms, 2nd Edition, 1998 +// ISBN 0-943396-61-1 +// Willmann-Bell, Inc +// Richmond, Virginia (USA) +// #include "sqliteInt.h" +// #include +// #include +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2003 Marcel Moolenaar +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Frequency of the clock ticks reported by clock(). + +type Clock_t = X__clock_t /* time.h:62:19 */ + +type Time_t = X__time_t /* time.h:67:18 */ + +// New in POSIX 1003.1b-1993. +type Clockid_t = X__clockid_t /* time.h:81:21 */ + +type Timer_t = X__timer_t /* time.h:86:19 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type timespec = struct { + Ftv_sec Time_t + Ftv_nsec int64 +} /* _timespec.h:46:1 */ + +// Structure defined by POSIX.1b to be like a itimerval, but with +// timespecs. Used in the timer_*() system calls. +type itimerspec = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fit_value struct { + Ftv_sec Time_t + Ftv_nsec int64 + } +} /* timespec.h:60:1 */ + +type Pid_t = X__pid_t /* time.h:95:18 */ + +// These macros are also in sys/time.h. + +type tm = struct { + Ftm_sec int32 + Ftm_min int32 + Ftm_hour int32 + Ftm_mday int32 + Ftm_mon int32 + Ftm_year int32 + Ftm_wday int32 + Ftm_yday int32 + Ftm_isdst int32 + _ [4]byte + Ftm_gmtoff int64 + Ftm_zone uintptr +} /* time.h:129:1 */ + +// The MSVC CRT on Windows CE may not have a localtime() function. +// So declare a substitute. The substitute function itself is +// defined in "os_win.c". + +// A structure for holding a single date and time. +type DateTime1 = struct { + FiJD Sqlite3_int64 + FY int32 + FM int32 + FD int32 + Fh int32 + Fm int32 + Ftz int32 + Fs float64 + FvalidJD int8 + FrawS int8 + FvalidYMD int8 + FvalidHMS int8 + FvalidTZ int8 + FtzSet int8 + FisError int8 + _ [1]byte +} /* sqlite3.c:22238:9 */ + +// The MSVC CRT on Windows CE may not have a localtime() function. +// So declare a substitute. The substitute function itself is +// defined in "os_win.c". + +// A structure for holding a single date and time. +type DateTime = DateTime1 /* sqlite3.c:22238:25 */ + +// Convert zDate into one or more integers according to the conversion +// specifier zFormat. +// +// zFormat[] contains 4 characters for each integer converted, except for +// the last integer which is specified by three characters. The meaning +// of a four-character format specifiers ABCD is: +// +// A: number of digits to convert. Always "2" or "4". +// B: minimum value. Always "0" or "1". +// C: maximum value, decoded as: +// a: 12 +// b: 14 +// c: 24 +// d: 31 +// e: 59 +// f: 9999 +// D: the separator character, or \000 to indicate this is the +// last number to convert. +// +// Example: To translate an ISO-8601 date YYYY-MM-DD, the format would +// be "40f-21a-20c". The "40f-" indicates the 4-digit year followed by "-". +// The "21a-" indicates the 2-digit month followed by "-". The "20c" indicates +// the 2-digit day which is the last integer in the set. +// +// The function returns the number of successful conversions. +func getDigits(tls *libc.TLS, zDate uintptr, zFormat uintptr, va uintptr) int32 { /* sqlite3.c:22282:12: */ + var ap Va_list + _ = ap + var cnt int32 + var nextC int8 + var N int8 + var min int8 + var val int32 + var max U16 + cnt = 0 + ap = va +__1: + N = (int8(int32(*(*int8)(unsafe.Pointer(zFormat))) - '0')) + min = (int8(int32(*(*int8)(unsafe.Pointer(zFormat + 1))) - '0')) + val = 0 + + max = aMx[(int32(*(*int8)(unsafe.Pointer(zFormat + 2))) - 'a')] + nextC = *(*int8)(unsafe.Pointer(zFormat + 3)) + val = 0 +__4: + if !(libc.PostDecInt8(&N, 1) != 0) { + goto __5 + } + if !(!((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))]) & 0x04) != 0)) { + goto __6 + } + goto end_getDigits +__6: + ; + val = (((val * 10) + int32(*(*int8)(unsafe.Pointer(zDate)))) - '0') + zDate++ + goto __4 +__5: + ; + if !(((val < int32(min)) || (val > int32(max))) || ((int32(nextC) != 0) && (int32(nextC) != int32(*(*int8)(unsafe.Pointer(zDate)))))) { + goto __7 + } + goto end_getDigits +__7: + ; + *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = val + zDate++ + cnt++ + zFormat += uintptr(4) + goto __2 +__2: + if nextC != 0 { + goto __1 + } + goto __3 +__3: + ; +end_getDigits: + _ = ap + return cnt +} + +var aMx = [6]U16{U16(12), U16(14), U16(24), U16(31), U16(59), U16(9999)} /* sqlite3.c:22285:20 */ + +// Parse a timezone extension on the end of a date-time. +// The extension is of the form: +// +// (+/-)HH:MM +// +// Or the "zulu" notation: +// +// Z +// +// If the parse is successful, write the number of minutes +// of change in p->tz and return 0. If a parser error occurs, +// return non-zero. +// +// A missing specifier is not considered an error. +func parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22336:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var sgn int32 + // var nHr int32 at bp+16, 4 + + // var nMn int32 at bp+20, 4 + + var c int32 + sgn = 0 +__1: + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))]) & 0x01) != 0) { + goto __2 + } + zDate++ + goto __1 +__2: + ; + (*DateTime)(unsafe.Pointer(p)).Ftz = 0 + c = int32(*(*int8)(unsafe.Pointer(zDate))) + if !(c == '-') { + goto __3 + } + sgn = -1 + goto __4 +__3: + if !(c == '+') { + goto __5 + } + sgn = +1 + goto __6 +__5: + if !((c == 'Z') || (c == 'z')) { + goto __7 + } + zDate++ + goto zulu_time + goto __8 +__7: + return (libc.Bool32(c != 0)) +__8: + ; +__6: + ; +__4: + ; + zDate++ + if !(getDigits(tls, zDate, ts+326 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + goto __9 + } + return 1 +__9: + ; + zDate += uintptr(5) + (*DateTime)(unsafe.Pointer(p)).Ftz = (sgn * (*(*int32)(unsafe.Pointer(bp + 20 /* nMn */)) + (*(*int32)(unsafe.Pointer(bp + 16 /* nHr */)) * 60))) +zulu_time: +__10: + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))]) & 0x01) != 0) { + goto __11 + } + zDate++ + goto __10 +__11: + ; + (*DateTime)(unsafe.Pointer(p)).FtzSet = int8(1) + return (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zDate))) != 0)) +} + +// Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. +// The HH, MM, and SS must each be exactly 2 digits. The +// fractional seconds FFFF can be one or more digits. +// +// Return 1 if there is a parsing error and 0 on success. +func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22372:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + // var h int32 at bp+24, 4 + + // var m int32 at bp+28, 4 + + // var s int32 at bp+32, 4 + + var ms float64 = 0.0 + if getDigits(tls, zDate, ts+334 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + return 1 + } + zDate += uintptr(5) + if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { + zDate++ + if getDigits(tls, zDate, ts+342 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + return 1 + } + zDate += uintptr(2) + if (int32(*(*int8)(unsafe.Pointer(zDate))) == '.') && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate + 1)))]) & 0x04) != 0) { + var rScale float64 = 1.0 + zDate++ + for (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))]) & 0x04) != 0 { + ms = (((ms * 10.0) + float64(*(*int8)(unsafe.Pointer(zDate)))) - float64('0')) + rScale = rScale * (10.0) + zDate++ + } + ms = ms / (rScale) + } + } else { + *(*int32)(unsafe.Pointer(bp + 32 /* s */)) = 0 + } + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) + (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) + (*DateTime)(unsafe.Pointer(p)).Fh = *(*int32)(unsafe.Pointer(bp + 24 /* h */)) + (*DateTime)(unsafe.Pointer(p)).Fm = *(*int32)(unsafe.Pointer(bp + 28 /* m */)) + (*DateTime)(unsafe.Pointer(p)).Fs = (float64(*(*int32)(unsafe.Pointer(bp + 32 /* s */))) + ms) + if parseTimezone(tls, zDate, p) != 0 { + return 1 + } + (*DateTime)(unsafe.Pointer(p)).FvalidTZ = func() int8 { + if (*DateTime)(unsafe.Pointer(p)).Ftz != 0 { + return int8(1) + } + return int8(0) + }() + return 0 +} + +// Put the DateTime object into its error state. +func datetimeError(tls *libc.TLS, p uintptr) { /* sqlite3.c:22412:13: */ + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(DateTime{}))) + (*DateTime)(unsafe.Pointer(p)).FisError = int8(1) +} + +// Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume +// that the YYYY-MM-DD is according to the Gregorian calendar. +// +// Reference: Meeus page 61 +func computeJD(tls *libc.TLS, p uintptr) { /* sqlite3.c:22423:13: */ + var Y int32 + var M int32 + var D int32 + var A int32 + var B int32 + var X1 int32 + var X2 int32 + + if (*DateTime)(unsafe.Pointer(p)).FvalidJD != 0 { + return + } + if (*DateTime)(unsafe.Pointer(p)).FvalidYMD != 0 { + Y = (*DateTime)(unsafe.Pointer(p)).FY + M = (*DateTime)(unsafe.Pointer(p)).FM + D = (*DateTime)(unsafe.Pointer(p)).FD + } else { + Y = 2000 // If no YMD specified, assume 2000-Jan-01 + M = 1 + D = 1 + } + if ((Y < -4713) || (Y > 9999)) || ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + datetimeError(tls, p) + return + } + if M <= 2 { + Y-- + M = M + (12) + } + A = (Y / 100) + B = ((2 - A) + (A / 4)) + X1 = ((36525 * (Y + 4716)) / 100) + X2 = ((306001 * (M + 1)) / 10000) + (*DateTime)(unsafe.Pointer(p)).FiJD = (Sqlite3_int64(((float64(((X1 + X2) + D) + B)) - 1524.5) * float64(86400000))) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + if (*DateTime)(unsafe.Pointer(p)).FvalidHMS != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += ((Sqlite3_int64(((*DateTime)(unsafe.Pointer(p)).Fh * 3600000) + ((*DateTime)(unsafe.Pointer(p)).Fm * 60000))) + (Sqlite3_int64((*DateTime)(unsafe.Pointer(p)).Fs * float64(1000)))) + if (*DateTime)(unsafe.Pointer(p)).FvalidTZ != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) -= (Sqlite3_int64((*DateTime)(unsafe.Pointer(p)).Ftz * 60000)) + (*DateTime)(unsafe.Pointer(p)).FvalidYMD = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) + } + } +} + +// Parse dates of the form +// +// YYYY-MM-DD HH:MM:SS.FFF +// YYYY-MM-DD HH:MM:SS +// YYYY-MM-DD HH:MM +// YYYY-MM-DD +// +// Write the result into the DateTime structure and return 0 +// on success and 1 if the input string is not a well-formed +// date. +func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22473:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + // var Y int32 at bp+24, 4 + + // var M int32 at bp+28, 4 + + // var D int32 at bp+32, 4 + + var neg int32 + + if int32(*(*int8)(unsafe.Pointer(zDate))) == '-' { + zDate++ + neg = 1 + } else { + neg = 0 + } + if getDigits(tls, zDate, ts+346 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + return 1 + } + zDate += uintptr(10) + for ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))]) & 0x01) != 0) || ('T' == int32(*(*U8)(unsafe.Pointer(zDate)))) { + zDate++ + } + if parseHhMmSs(tls, zDate, p) == 0 { + // We got the time + } else if int32(*(*int8)(unsafe.Pointer(zDate))) == 0 { + (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(0) + } else { + return 1 + } + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) + (*DateTime)(unsafe.Pointer(p)).FY = func() int32 { + if neg != 0 { + return -*(*int32)(unsafe.Pointer(bp + 24 /* Y */)) + } + return *(*int32)(unsafe.Pointer(bp + 24 /* Y */)) + }() + (*DateTime)(unsafe.Pointer(p)).FM = *(*int32)(unsafe.Pointer(bp + 28 /* M */)) + (*DateTime)(unsafe.Pointer(p)).FD = *(*int32)(unsafe.Pointer(bp + 32 /* D */)) + if (*DateTime)(unsafe.Pointer(p)).FvalidTZ != 0 { + computeJD(tls, p) + } + return 0 +} + +// Set the time to the current time reported by the VFS. +// +// Return the number of errors. +func setDateTimeToCurrent(tls *libc.TLS, context uintptr, p uintptr) int32 { /* sqlite3.c:22510:12: */ + (*DateTime)(unsafe.Pointer(p)).FiJD = Xsqlite3StmtCurrentTime(tls, context) + if (*DateTime)(unsafe.Pointer(p)).FiJD > int64(0) { + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + return 0 + } else { + return 1 + } + return int32(0) +} + +// Input "r" is a numeric quantity which might be a julian day number, +// or the number of seconds since 1970. If the value if r is within +// range of a julian day number, install it as such and set validJD. +// If the value is a valid unix timestamp, put it in p->s and set p->rawS. +func setRawDateNumber(tls *libc.TLS, p uintptr, r float64) { /* sqlite3.c:22526:13: */ + (*DateTime)(unsafe.Pointer(p)).Fs = r + (*DateTime)(unsafe.Pointer(p)).FrawS = int8(1) + if (r >= 0.0) && (r < 5373484.5) { + (*DateTime)(unsafe.Pointer(p)).FiJD = (Sqlite3_int64((r * 86400000.0) + 0.5)) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + } +} + +// Attempt to parse the given string into a julian day number. Return +// the number of errors. +// +// The following are acceptable forms for the input string: +// +// YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM +// DDDD.DD +// now +// +// In the first form, the +/-HH:MM is always optional. The fractional +// seconds extension (the ".FFF") is optional. The seconds portion +// (":SS.FFF") is option. The year and date can be omitted as long +// as there is a time string. The time string can be omitted as long +// as there is a year and date. +func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22551:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var r float64 at bp, 8 + + if parseYyyyMmDd(tls, zDate, p) == 0 { + return 0 + } else if parseHhMmSs(tls, zDate, p) == 0 { + return 0 + } else if (Xsqlite3StrICmp(tls, zDate, ts+358 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + return setDateTimeToCurrent(tls, context, p) + } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { + setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) + return 0 + } + return 1 +} + +// The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999. +// Multiplying this by 86400000 gives 464269060799999 as the maximum value +// for DateTime.iJD. +// +// But some older compilers (ex: gcc 4.2.1 on older Macs) cannot deal with +// such a large integer literal, so we have to encode it. + +// Return TRUE if the given julian day number is within range. +// +// The input is the JulianDay times 86400000. +func validJulianDay(tls *libc.TLS, iJD Sqlite3_int64) int32 { /* sqlite3.c:22584:12: */ + return (libc.Bool32((iJD >= int64(0)) && (iJD <= ((I64((int64(0x1a640))) << 32) | int64(0x1072fdff))))) +} + +// Compute the Year, Month, and Day from the julian day number. +func computeYMD(tls *libc.TLS, p uintptr) { /* sqlite3.c:22591:13: */ + var Z int32 + var A int32 + var B int32 + var C int32 + var D int32 + var E int32 + var X1 int32 + if (*DateTime)(unsafe.Pointer(p)).FvalidYMD != 0 { + return + } + if !(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) { + (*DateTime)(unsafe.Pointer(p)).FY = 2000 + (*DateTime)(unsafe.Pointer(p)).FM = 1 + (*DateTime)(unsafe.Pointer(p)).FD = 1 + } else if !(validJulianDay(tls, (*DateTime)(unsafe.Pointer(p)).FiJD) != 0) { + datetimeError(tls, p) + return + } else { + Z = (int32(((*DateTime)(unsafe.Pointer(p)).FiJD + int64(43200000)) / int64(86400000))) + A = (int32((float64(Z) - 1867216.25) / 36524.25)) + A = (((Z + 1) + A) - (A / 4)) + B = (A + 1524) + C = (int32((float64(B) - 122.1) / 365.25)) + D = ((36525 * (C & 32767)) / 100) + E = (int32((float64(B - D)) / 30.6001)) + X1 = (int32(30.6001 * float64(E))) + (*DateTime)(unsafe.Pointer(p)).FD = ((B - D) - X1) + (*DateTime)(unsafe.Pointer(p)).FM = func() int32 { + if E < 14 { + return (E - 1) + } + return (E - 13) + }() + (*DateTime)(unsafe.Pointer(p)).FY = func() int32 { + if (*DateTime)(unsafe.Pointer(p)).FM > 2 { + return (C - 4716) + } + return (C - 4715) + }() + } + (*DateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) +} + +// Compute the Hour, Minute, and Seconds from the julian day number. +func computeHMS(tls *libc.TLS, p uintptr) { /* sqlite3.c:22620:13: */ + var s int32 + if (*DateTime)(unsafe.Pointer(p)).FvalidHMS != 0 { + return + } + computeJD(tls, p) + s = (int32(((*DateTime)(unsafe.Pointer(p)).FiJD + int64(43200000)) % int64(86400000))) + (*DateTime)(unsafe.Pointer(p)).Fs = (float64(s) / 1000.0) + s = int32((*DateTime)(unsafe.Pointer(p)).Fs) + *(*float64)(unsafe.Pointer(p + 32 /* &.s */)) -= (float64(s)) + (*DateTime)(unsafe.Pointer(p)).Fh = (s / 3600) + s = s - ((*DateTime)(unsafe.Pointer(p)).Fh * 3600) + (*DateTime)(unsafe.Pointer(p)).Fm = (s / 60) + *(*float64)(unsafe.Pointer(p + 32 /* &.s */)) += (float64(s - ((*DateTime)(unsafe.Pointer(p)).Fm * 60))) + (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) +} + +// Compute both YMD and HMS +func computeYMD_HMS(tls *libc.TLS, p uintptr) { /* sqlite3.c:22639:13: */ + computeYMD(tls, p) + computeHMS(tls, p) +} + +// Clear the YMD and HMS and the TZ +func clearYMD_HMS_TZ(tls *libc.TLS, p uintptr) { /* sqlite3.c:22647:13: */ + (*DateTime)(unsafe.Pointer(p)).FvalidYMD = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) +} + +// On recent Windows platforms, the localtime_s() function is available +// as part of the "Secure CRT". It is essentially equivalent to +// localtime_r() available under most POSIX platforms, except that the +// order of the parameters is reversed. +// +// See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx. +// +// If the user has not indicated to use localtime_r() or localtime_s() +// already, check for an MSVC build environment that provides +// localtime_s(). + +// The following routine implements the rough equivalent of localtime_r() +// using whatever operating-system specific localtime facility that +// is available. This routine returns 0 on success and +// non-zero on any kind of error. +// +// If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this +// routine will always fail. +// +// EVIDENCE-OF: R-62172-00036 In this implementation, the standard C +// library function localtime_r() is used to assist in the calculation of +// local time. +func osLocaltime(tls *libc.TLS, t uintptr, pTm uintptr) int32 { /* sqlite3.c:22685:12: */ + var rc int32 + var pX uintptr + var mutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, mutex) + pX = libc.Xlocaltime(tls, t) + if Xsqlite3Config.FbLocaltimeFault != 0 { + pX = uintptr(0) + } + if pX != 0 { + *(*tm)(unsafe.Pointer(pTm)) = *(*tm)(unsafe.Pointer(pX)) + } + Xsqlite3_mutex_leave(tls, mutex) + rc = (libc.Bool32(pX == uintptr(0))) + return rc +} + +// Compute the difference (in milliseconds) between localtime and UTC +// (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs, +// return this value and set *pRc to SQLITE_OK. +// +// Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value +// is undefined in this case. +func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite3_int64 { /* sqlite3.c:22724:22: */ + bp := tls.Alloc(160) + defer tls.Free(160) + + // var x DateTime at bp+56, 48 + + // var y DateTime at bp+112, 48 + + // var t Time_t at bp+104, 8 + + // var sLocal tm at bp, 56 + + // Initialize the contents of sLocal to avoid a compiler warning. + libc.Xmemset(tls, bp /* &sLocal */, 0, uint64(unsafe.Sizeof(tm{}))) + + *(*DateTime)(unsafe.Pointer(bp + 56 /* x */)) = *(*DateTime)(unsafe.Pointer(p)) + computeYMD_HMS(tls, bp+56 /* &x */) + if ((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FY < 1971) || ((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FY >= 2038) { + // EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only + // works for years between 1970 and 2037. For dates outside this range, + // SQLite attempts to map the year into an equivalent year within this + // range, do the calculation, then map the year back. + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).FY = 2000 + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).FM = 1 + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).FD = 1 + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).Fh = 0 + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).Fm = 0 + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).Fs = 0.0 + } else { + var s int32 = (int32((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).Fs + 0.5)) + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).Fs = float64(s) + } + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).Ftz = 0 + (*DateTime)(unsafe.Pointer(bp + 56 /* &x */)).FvalidJD = int8(0) + computeJD(tls, bp+56 /* &x */) + *(*Time_t)(unsafe.Pointer(bp + 104 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) + if osLocaltime(tls, bp+104 /* &t */, bp /* &sLocal */) != 0 { + Xsqlite3_result_error(tls, pCtx, ts+362 /* "local time unava..." */, -1) + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR + return int64(0) + } + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FY = ((*tm)(unsafe.Pointer(bp /* &sLocal */)).Ftm_year + 1900) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FM = ((*tm)(unsafe.Pointer(bp /* &sLocal */)).Ftm_mon + 1) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FD = (*tm)(unsafe.Pointer(bp /* &sLocal */)).Ftm_mday + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).Fh = (*tm)(unsafe.Pointer(bp /* &sLocal */)).Ftm_hour + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).Fm = (*tm)(unsafe.Pointer(bp /* &sLocal */)).Ftm_min + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).Fs = float64((*tm)(unsafe.Pointer(bp /* &sLocal */)).Ftm_sec) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FvalidYMD = int8(1) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FvalidHMS = int8(1) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FvalidJD = int8(0) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FrawS = int8(0) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FvalidTZ = int8(0) + (*DateTime)(unsafe.Pointer(bp + 112 /* &y */)).FisError = int8(0) + computeJD(tls, bp+112 /* &y */) + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK + return ((*DateTime)(unsafe.Pointer(bp+112 /* &y */)).FiJD - (*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FiJD) +} + +// The following table defines various date transformations of the form +// +// 'NNN days' +// +// Where NNN is an arbitrary floating-point number and "days" can be one +// of several units of time. +var aXformType = [6]struct { + FeType U8 + FnName U8 + _ [6]byte + FzName uintptr + FrLimit float64 + FrXform float64 +}{ + {FnName: U8(6), FzName: ts + 385 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 392 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 399 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 404 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 408 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 414 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, +} /* sqlite3.c:22795:3 */ + +// Process a modifier to a date-time stamp. The modifiers are +// as follows: +// +// NNN days +// NNN hours +// NNN minutes +// NNN.NNNN seconds +// NNN months +// NNN years +// start of month +// start of year +// start of week +// start of day +// weekday N +// unixepoch +// localtime +// utc +// +// Return 0 on success and 1 if there is any kind of error. If the error +// is in a system call (i.e. localtime()), then an error message is written +// to context pCtx. If the error is an unrecognized modifier, no error is +// written to pCtx. +func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) int32 { /* sqlite3.c:22828:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = 1 + // var r float64 at bp+8, 8 + + switch int32(Xsqlite3UpperToLower[U8(*(*int8)(unsafe.Pointer(z)))]) { + case 'l': + { + // localtime + // + // Assuming the current time value is UTC (a.k.a. GMT), shift it to + // show local time. + if (Xsqlite3_stricmp(tls, z, ts+419 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + computeJD(tls, p) + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) + clearYMD_HMS_TZ(tls, p) + } + break + + } + case 'u': + { + // unixepoch + // + // Treat the current value of p->s as the number of + // seconds since 1970. Convert to a real julian day number. + if (Xsqlite3_stricmp(tls, z, ts+429 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) + if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { + clearYMD_HMS_TZ(tls, p) + (*DateTime)(unsafe.Pointer(p)).FiJD = (Sqlite3_int64(*(*float64)(unsafe.Pointer(bp + 8 /* r */)) + 0.5)) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(1) + (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + } + } else if (Xsqlite3_stricmp(tls, z, ts+439 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { + var c1 Sqlite3_int64 + computeJD(tls, p) + c1 = localtimeOffset(tls, p, pCtx, bp /* &rc */) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) -= (c1) + clearYMD_HMS_TZ(tls, p) + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (c1 - localtimeOffset(tls, p, pCtx, bp /* &rc */)) + } + (*DateTime)(unsafe.Pointer(p)).FtzSet = int8(1) + } else { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + } + } + break + + } + case 'w': + { + // weekday N + // + // Move the date to the same time on the next occurrence of + // weekday N where 0==Sunday, 1==Monday, and so forth. If the + // date is already on the appropriate weekday, this is a no-op. + if ((((Xsqlite3_strnicmp(tls, z, ts+443 /* "weekday " */, 8) == 0) && + (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && + ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { + var Z Sqlite3_int64 + computeYMD_HMS(tls, p) + (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) + computeJD(tls, p) + Z = ((((*DateTime)(unsafe.Pointer(p)).FiJD + int64(129600000)) / int64(86400000)) % int64(7)) + if Z > Sqlite3_int64(n) { + Z = Z - (int64(7)) + } + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += ((Sqlite3_int64(n) - Z) * int64(86400000)) + clearYMD_HMS_TZ(tls, p) + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + } + break + + } + case 's': + { + // start of TTTTT + // + // Move the date backwards to the beginning of the current day, + // or month or year. + if Xsqlite3_strnicmp(tls, z, ts+452 /* "start of " */, 9) != 0 { + break + } + if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { + break + } + z += uintptr(9) + computeYMD(tls, p) + (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) + (*DateTime)(unsafe.Pointer(p)).Fh = libc.AssignPtrInt32(p+24 /* &.m */, 0) + (*DateTime)(unsafe.Pointer(p)).Fs = 0.0 + (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) + if Xsqlite3_stricmp(tls, z, ts+408 /* "month" */) == 0 { + (*DateTime)(unsafe.Pointer(p)).FD = 1 + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + } else if Xsqlite3_stricmp(tls, z, ts+414 /* "year" */) == 0 { + (*DateTime)(unsafe.Pointer(p)).FM = 1 + (*DateTime)(unsafe.Pointer(p)).FD = 1 + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + } else if Xsqlite3_stricmp(tls, z, ts+404 /* "day" */) == 0 { + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + } + break + + } + case '+': + fallthrough + case '-': + fallthrough + case '0': + fallthrough + case '1': + fallthrough + case '2': + fallthrough + case '3': + fallthrough + case '4': + fallthrough + case '5': + fallthrough + case '6': + fallthrough + case '7': + fallthrough + case '8': + fallthrough + case '9': + { + var rRounder float64 + var i int32 + for n = 1; ((*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) != ':')) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(n))))]) & 0x01) != 0); n++ { + } + if Xsqlite3AtoF(tls, z, bp+8 /* &r */, n, uint8(SQLITE_UTF8)) <= 0 { + *(*int32)(unsafe.Pointer(bp /* rc */)) = 1 + break + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) == ':' { + // A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the + // specified number of hours, minutes, seconds, and fractional seconds + // to the time. The ".FFF" may be omitted. The ":SS.FFF" may be + // omitted. + var z2 uintptr = z + // var tx DateTime at bp+16, 48 + + var day Sqlite3_int64 + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2)))]) & 0x04) != 0) { + z2++ + } + libc.Xmemset(tls, bp+16 /* &tx */, 0, uint64(unsafe.Sizeof(DateTime{}))) + if parseHhMmSs(tls, z2, bp+16 /* &tx */) != 0 { + break + } + computeJD(tls, bp+16 /* &tx */) + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* &tx */ /* &.iJD */)) -= (int64(43200000)) + day = ((*DateTime)(unsafe.Pointer(bp+16 /* &tx */)).FiJD / int64(86400000)) + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* &tx */ /* &.iJD */)) -= (day * int64(86400000)) + if int32(*(*int8)(unsafe.Pointer(z))) == '-' { + (*DateTime)(unsafe.Pointer(bp + 16 /* &tx */)).FiJD = -(*DateTime)(unsafe.Pointer(bp + 16 /* &tx */)).FiJD + } + computeJD(tls, p) + clearYMD_HMS_TZ(tls, p) + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += ((*DateTime)(unsafe.Pointer(bp + 16 /* &tx */)).FiJD) + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + break + } + + // If control reaches this point, it means the transformation is + // one of the forms like "+NNN days". + z += uintptr(n) + for (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x01) != 0 { + z++ + } + n = Xsqlite3Strlen30(tls, z) + if (n > 10) || (n < 3) { + break + } + if int32(Xsqlite3UpperToLower[U8(*(*int8)(unsafe.Pointer(z + uintptr((n - 1)))))]) == 's' { + n-- + } + computeJD(tls, p) + *(*int32)(unsafe.Pointer(bp /* rc */)) = 1 + if *(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(0) { + rRounder = -0.5 + } else { + rRounder = +0.5 + } + for i = 0; i < (int32(uint64(unsafe.Sizeof(aXformType)) / uint64(unsafe.Sizeof(struct { + FeType U8 + FnName U8 + _ [6]byte + FzName uintptr + FrLimit float64 + FrXform float64 + }{})))); i++ { + if (((int32(aXformType[i].FnName) == n) && + (Xsqlite3_strnicmp(tls, aXformType[i].FzName, z, n) == 0)) && + (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) > -aXformType[i].FrLimit)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < aXformType[i].FrLimit) { + switch int32(aXformType[i].FeType) { + case 1: + { // Special processing to add months + var x int32 + computeYMD_HMS(tls, p) + *(*int32)(unsafe.Pointer(p + 12 /* &.M */)) += (int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))) + if (*DateTime)(unsafe.Pointer(p)).FM > 0 { + x = (((*DateTime)(unsafe.Pointer(p)).FM - 1) / 12) + } else { + x = (((*DateTime)(unsafe.Pointer(p)).FM - 12) / 12) + } + *(*int32)(unsafe.Pointer(p + 8 /* &.Y */)) += (x) + *(*int32)(unsafe.Pointer(p + 12 /* &.M */)) -= (x * 12) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) -= float64(int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))) + break + + } + fallthrough + case 2: + { // Special processing to add years + var y int32 = int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */))) + computeYMD_HMS(tls, p) + *(*int32)(unsafe.Pointer(p + 8 /* &.Y */)) += (y) + (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) -= float64(int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))) + break + + } + } + computeJD(tls, p) + *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (Sqlite3_int64((*(*float64)(unsafe.Pointer(bp + 8 /* r */)) * aXformType[i].FrXform) + rRounder)) + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 + break + } + } + clearYMD_HMS_TZ(tls, p) + break + + } + default: + { + break + + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Process time function arguments. argv[0] is a date-time stamp. +// argv[1] and following are modifiers. Parse them all and write +// the resulting time into the DateTime structure p. Return 0 +// on success and 1 if there are any errors. +// +// If there are zero parameters (if even argv[0] is undefined) +// then assume a default value of "now" for argv[0]. +func isDate(tls *libc.TLS, context uintptr, argc int32, argv uintptr, p uintptr) int32 { /* sqlite3.c:23045:12: */ + var i int32 + var n int32 + var z uintptr + var eType int32 + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(DateTime{}))) + if argc == 0 { + if !(Xsqlite3NotPureFunc(tls, context) != 0) { + return 1 + } + return setDateTimeToCurrent(tls, context, p) + } + if ((libc.AssignInt32(&eType, Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))))) == SQLITE_FLOAT) || + (eType == SQLITE_INTEGER) { + setRawDateNumber(tls, p, Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } else { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if !(z != 0) || (parseDateOrTime(tls, context, z, p) != 0) { + return 1 + } + } + for i = 1; i < argc; i++ { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if (z == uintptr(0)) || (parseModifier(tls, context, z, n, p) != 0) { + return 1 + } + } + computeJD(tls, p) + if ((*DateTime)(unsafe.Pointer(p)).FisError != 0) || !(validJulianDay(tls, (*DateTime)(unsafe.Pointer(p)).FiJD) != 0) { + return 1 + } + return 0 +} + +// The following routines implement the various date and time functions +// of SQLite. + +// julianday( TIMESTRING, MOD, MOD, ...) +// +// Return the julian day number of the date specified in the arguments +func juliandayFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23089:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var x DateTime at bp, 48 + + if isDate(tls, context, argc, argv, bp /* &x */) == 0 { + computeJD(tls, bp /* &x */) + Xsqlite3_result_double(tls, context, (float64((*DateTime)(unsafe.Pointer(bp /* &x */)).FiJD) / 86400000.0)) + } +} + +// datetime( TIMESTRING, MOD, MOD, ...) +// +// Return YYYY-MM-DD HH:MM:SS +func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23106:13: */ + bp := tls.Alloc(196) + defer tls.Free(196) + + // var x DateTime at bp+48, 48 + + if isDate(tls, context, argc, argv, bp+48 /* &x */) == 0 { + // var zBuf [100]int8 at bp+96, 100 + + computeYMD_HMS(tls, bp+48 /* &x */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+462, /* "%04d-%02d-%02d %..." */ + libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) + Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + } +} + +// time( TIMESTRING, MOD, MOD, ...) +// +// Return HH:MM:SS +func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23126:13: */ + bp := tls.Alloc(172) + defer tls.Free(172) + + // var x DateTime at bp+24, 48 + + if isDate(tls, context, argc, argv, bp+24 /* &x */) == 0 { + // var zBuf [100]int8 at bp+72, 100 + + computeHMS(tls, bp+24 /* &x */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+492 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + } +} + +// date( TIMESTRING, MOD, MOD, ...) +// +// Return YYYY-MM-DD +func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23145:13: */ + bp := tls.Alloc(172) + defer tls.Free(172) + + // var x DateTime at bp+24, 48 + + if isDate(tls, context, argc, argv, bp+24 /* &x */) == 0 { + // var zBuf [100]int8 at bp+72, 100 + + computeYMD(tls, bp+24 /* &x */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+507 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + } +} + +// strftime( FORMAT, TIMESTRING, MOD, MOD, ...) +// +// Return a string described by FORMAT. Conversions as follows: +// +// %d day of month +// %f ** fractional seconds SS.SSS +// %H hour 00-24 +// %j day of year 000-366 +// %J ** julian day number +// %m month 01-12 +// %M minute 00-59 +// %s seconds since 1970-01-01 +// %S seconds 00-59 +// %w day of week 0-6 sunday==0 +// %W week of year 00-53 +// %Y year 0000-9999 +// %% % +func strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23178:13: */ + bp := tls.Alloc(280) + defer tls.Free(280) + + // var x DateTime at bp+80, 48 + + var n U64 + var i Size_t + var j Size_t + var z uintptr + var db uintptr + var zFmt uintptr + // var zBuf [100]int8 at bp+128, 100 + + if argc == 0 { + return + } + zFmt = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if (zFmt == uintptr(0)) || (isDate(tls, context, (argc-1), (argv+uintptr(1)*8), bp+80 /* &x */) != 0) { + return + } + db = Xsqlite3_context_db_handle(tls, context) + i = uint64(0) + n = uint64(1) +__1: + if !(*(*int8)(unsafe.Pointer(zFmt + uintptr(i))) != 0) { + goto __3 + } + { + if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == '%' { + switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr((i + uint64(1)))))) { + case 'd': + fallthrough + case 'H': + fallthrough + case 'm': + fallthrough + case 'M': + fallthrough + case 'S': + fallthrough + case 'W': + n++ + fallthrough + // fall thru + case 'w': + fallthrough + case '%': + break + fallthrough + case 'f': + n = n + (uint64(8)) + break + fallthrough + case 'j': + n = n + (uint64(3)) + break + fallthrough + case 'Y': + n = n + (uint64(8)) + break + fallthrough + case 's': + fallthrough + case 'J': + n = n + (uint64(50)) + break + fallthrough + default: + return // ERROR. return a NULL + } + i++ + } + + } + goto __2 +__2: + i++ + n++ + goto __1 + goto __3 +__3: + ; + + if n < U64(unsafe.Sizeof([100]int8{})) { + z = bp + 128 /* &zBuf[0] */ + } else if n > U64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) { + Xsqlite3_result_error_toobig(tls, context) + return + } else { + z = Xsqlite3DbMallocRawNN(tls, db, uint64(int32(n))) + if z == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + } + computeJD(tls, bp+80 /* &x */) + computeYMD_HMS(tls, bp+80 /* &x */) + for i = libc.AssignUint64(&j, uint64(0)); *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) != 0; i++ { + if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) != '%' { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncUint64(&j, 1)))) = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) + } else { + i++ + switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { + case 'd': + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + j = j + (uint64(2)) + break + fallthrough + case 'f': + { + var s float64 = (*DateTime)(unsafe.Pointer(bp + 80 /* &x */)).Fs + if s > 59.999 { + s = 59.999 + } + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+527 /* "%06.3f" */, libc.VaList(bp+8, s)) + j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) + break + + } + fallthrough + case 'H': + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + j = j + (uint64(2)) + break + fallthrough + case 'W': + fallthrough // Fall thru + case 'j': + { + var nDay int32 // Number of days since 1st day of year + *(*DateTime)(unsafe.Pointer(bp + 232 /* y */)) = *(*DateTime)(unsafe.Pointer(bp + 80 /* x */)) + (*DateTime)(unsafe.Pointer(bp + 232 /* &y */)).FvalidJD = int8(0) + (*DateTime)(unsafe.Pointer(bp + 232 /* &y */)).FM = 1 + (*DateTime)(unsafe.Pointer(bp + 232 /* &y */)).FD = 1 + computeJD(tls, bp+232 /* &y */) + nDay = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD - (*DateTime)(unsafe.Pointer(bp+232 /* &y */)).FiJD) + int64(43200000)) / int64(86400000))) + if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { + var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday + wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + j = j + (uint64(2)) + } else { + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+534 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + j = j + (uint64(3)) + } + break + + } + fallthrough + case 'J': + { + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+539 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) + break + + } + fallthrough + case 'm': + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + j = j + (uint64(2)) + break + fallthrough + case 'M': + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + j = j + (uint64(2)) + break + fallthrough + case 's': + { + var iS I64 = (((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000))) + Xsqlite3Int64ToText(tls, iS, (z + uintptr(j))) + j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) + break + + } + fallthrough + case 'S': + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+522 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + j = j + (uint64(2)) + break + fallthrough + case 'w': + { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncUint64(&j, 1)))) = (int8(int32((int8((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(129600000)) / int64(86400000)) % int64(7)))) + '0')) + break + + } + fallthrough + case 'Y': + { + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+545 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) + break + + } + fallthrough + default: + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncUint64(&j, 1)))) = int8('%') + break + } + } + } + *(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0) + Xsqlite3_result_text(tls, context, z, -1, + func() uintptr { + if z == bp+128 /* zBuf */ { + return libc.UintptrFromInt32(-1) + } + return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault})) + }()) +} + +// current_time() +// +// This function returns the same value as time('now'). +func ctimeFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:23316:13: */ + _ = NotUsed + _ = NotUsed2 + timeFunc(tls, context, 0, uintptr(0)) +} + +// current_date() +// +// This function returns the same value as date('now'). +func cdateFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:23330:13: */ + _ = NotUsed + _ = NotUsed2 + dateFunc(tls, context, 0, uintptr(0)) +} + +// current_timestamp() +// +// This function returns the same value as datetime('now'). +func ctimestampFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:23344:13: */ + _ = NotUsed + _ = NotUsed2 + datetimeFunc(tls, context, 0, uintptr(0)) +} + +// This function registered all of the above C functions as SQL +// functions. This should be the only routine in this file with +// external linkage. +func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: */ + Xsqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&aDateTimeFuncs)), (int32(uint64(unsafe.Sizeof(aDateTimeFuncs)) / uint64(unsafe.Sizeof(FuncDef{}))))) +} + +var aDateTimeFuncs = [8]FuncDef{ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 550 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 560 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 565 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 570 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 579 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 588 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 601 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 619 /* "current_date" */}} /* sqlite3.c:23405:18 */ + +//************* End of date.c *********************************************** +//************* Begin file os.c ********************************************* +// 2005 November 29 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains OS interface code that is common to all +// architectures. +// #include "sqliteInt.h" + +// If we compile with the SQLITE_TEST macro set, then the following block +// of code will give us the ability to simulate a disk I/O error. This +// is used for testing the I/O recovery logic. + +// When testing, also keep a count of the number of open files. + +// The default SQLite sqlite3_vfs implementations do not allocate +// memory (actually, os_unix.c allocates a small amount of memory +// from within OsOpen()), but some third-party implementations may. +// So we test the effects of a malloc() failing and the sqlite3OsXXX() +// function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro. +// +// The following functions are instrumented for malloc() failure +// testing: +// +// sqlite3OsRead() +// sqlite3OsWrite() +// sqlite3OsSync() +// sqlite3OsFileSize() +// sqlite3OsLock() +// sqlite3OsCheckReservedLock() +// sqlite3OsFileControl() +// sqlite3OsShmMap() +// sqlite3OsOpen() +// sqlite3OsDelete() +// sqlite3OsAccess() +// sqlite3OsFullPathname() +// + +// The following routines are convenience wrappers around methods +// of the sqlite3_file object. This is mostly just syntactic sugar. All +// of this would be completely automatic if SQLite were coded using +// C++ instead of plain old C. +func Xsqlite3OsClose(tls *libc.TLS, pId uintptr) { /* sqlite3.c:23507:21: */ + if (*Sqlite3_file)(unsafe.Pointer(pId)).FpMethods != 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pId)).FpMethods + 8 /* &.xClose */))))(tls, pId) + (*Sqlite3_file)(unsafe.Pointer(pId)).FpMethods = uintptr(0) + } +} + +func Xsqlite3OsRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset I64) int32 { /* sqlite3.c:23513:20: */ + + return (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 16 /* &.xRead */))))(tls, id, pBuf, amt, offset) +} + +func Xsqlite3OsWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset I64) int32 { /* sqlite3.c:23517:20: */ + + return (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 24 /* &.xWrite */))))(tls, id, pBuf, amt, offset) +} + +func Xsqlite3OsTruncate(tls *libc.TLS, id uintptr, size I64) int32 { /* sqlite3.c:23521:20: */ + return (*(*func(*libc.TLS, uintptr, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 32 /* &.xTruncate */))))(tls, id, size) +} + +func Xsqlite3OsSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:23524:20: */ + + if flags != 0 { + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 40 /* &.xSync */))))(tls, id, flags) + } + return SQLITE_OK +} + +func Xsqlite3OsFileSize(tls *libc.TLS, id uintptr, pSize uintptr) int32 { /* sqlite3.c:23528:20: */ + + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 48 /* &.xFileSize */))))(tls, id, pSize) +} + +func Xsqlite3OsLock(tls *libc.TLS, id uintptr, lockType int32) int32 { /* sqlite3.c:23532:20: */ + + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 56 /* &.xLock */))))(tls, id, lockType) +} + +func Xsqlite3OsUnlock(tls *libc.TLS, id uintptr, lockType int32) int32 { /* sqlite3.c:23536:20: */ + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 64 /* &.xUnlock */))))(tls, id, lockType) +} + +func Xsqlite3OsCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) int32 { /* sqlite3.c:23539:20: */ + + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, id, pResOut) +} + +// Use sqlite3OsFileControl() when we are doing something that might fail +// and we need to know about the failures. Use sqlite3OsFileControlHint() +// when simply tossing information over the wall to the VFS and we do not +// really care if the VFS receives and understands the information since it +// is only a hint and can be safely ignored. The sqlite3OsFileControlHint() +// routine has no return value since the return value would be meaningless. +func Xsqlite3OsFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:23552:20: */ + if (*Sqlite3_file)(unsafe.Pointer(id)).FpMethods == uintptr(0) { + return SQLITE_NOTFOUND + } + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 80 /* &.xFileControl */))))(tls, id, op, pArg) +} + +func Xsqlite3OsFileControlHint(tls *libc.TLS, id uintptr, op int32, pArg uintptr) { /* sqlite3.c:23580:21: */ + if (*Sqlite3_file)(unsafe.Pointer(id)).FpMethods != 0 { + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 80 /* &.xFileControl */))))(tls, id, op, pArg) + } +} + +func Xsqlite3OsSectorSize(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:23584:20: */ + var xSectorSize uintptr = (*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods)).FxSectorSize + return func() int32 { + if xSectorSize != 0 { + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&xSectorSize)))(tls, id) + } + return SQLITE_DEFAULT_SECTOR_SIZE + }() +} + +func Xsqlite3OsDeviceCharacteristics(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:23588:20: */ + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, id) +} + +func Xsqlite3OsShmLock(tls *libc.TLS, id uintptr, offset int32, n int32, flags int32) int32 { /* sqlite3.c:23592:20: */ + return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 112 /* &.xShmLock */))))(tls, id, offset, n, flags) +} + +func Xsqlite3OsShmBarrier(tls *libc.TLS, id uintptr) { /* sqlite3.c:23595:21: */ + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 120 /* &.xShmBarrier */))))(tls, id) +} + +func Xsqlite3OsShmUnmap(tls *libc.TLS, id uintptr, deleteFlag int32) int32 { /* sqlite3.c:23598:20: */ + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 128 /* &.xShmUnmap */))))(tls, id, deleteFlag) +} + +func Xsqlite3OsShmMap(tls *libc.TLS, id uintptr, iPage int32, pgsz int32, bExtend int32, pp uintptr) int32 { /* sqlite3.c:23601:20: */ + + return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 104 /* &.xShmMap */))))(tls, id, iPage, pgsz, bExtend, libc.AtomicLoadUintptr(&pp)) +} + +// The real implementation of xFetch and xUnfetch +func Xsqlite3OsFetch(tls *libc.TLS, id uintptr, iOff I64, iAmt int32, pp uintptr) int32 { /* sqlite3.c:23615:20: */ + + return (*(*func(*libc.TLS, uintptr, Sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 136 /* &.xFetch */))))(tls, id, iOff, iAmt, pp) +} + +func Xsqlite3OsUnfetch(tls *libc.TLS, id uintptr, iOff I64, p uintptr) int32 { /* sqlite3.c:23619:20: */ + return (*(*func(*libc.TLS, uintptr, Sqlite3_int64, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods + 144 /* &.xUnfetch */))))(tls, id, iOff, p) +} + +// The next group of routines are convenience wrappers around the +// VFS methods. +func Xsqlite3OsOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags int32, pFlagsOut uintptr) int32 { /* sqlite3.c:23637:20: */ + var rc int32 + + // 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed + // down into the VFS layer. Some SQLITE_OPEN_ flags (for example, + // SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before + // reaching the VFS. + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 40 /* &.xOpen */))))(tls, pVfs, zPath, pFile, (flags & 0x1087f7f), pFlagsOut) + + return rc +} + +func Xsqlite3OsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* sqlite3.c:23654:20: */ + + if (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FxDelete != uintptr(0) { + return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pVfs + 48 /* &.xDelete */))))(tls, pVfs, zPath, dirSync) + } + return SQLITE_OK +} + +func Xsqlite3OsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* sqlite3.c:23659:20: */ + + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 56 /* &.xAccess */))))(tls, pVfs, zPath, flags, pResOut) +} + +func Xsqlite3OsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) int32 { /* sqlite3.c:23668:20: */ + + *(*int8)(unsafe.Pointer(zPathOut)) = int8(0) + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 64 /* &.xFullPathname */))))(tls, pVfs, zPath, nPathOut, zPathOut) +} + +func Xsqlite3OsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* sqlite3.c:23679:21: */ + + // tag-20210611-1 + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 72 /* &.xDlOpen */))))(tls, pVfs, zPath) +} + +func Xsqlite3OsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) { /* sqlite3.c:23684:21: */ + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pVfs + 80 /* &.xDlError */))))(tls, pVfs, nByte, zBufOut) +} + +func Xsqlite3OsDlSym(tls *libc.TLS, pVfs uintptr, pHdle uintptr, zSym uintptr) uintptr { /* sqlite3.c:23687:21: */ + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 88 /* &.xDlSym */))))(tls, pVfs, pHdle, zSym) +} + +func Xsqlite3OsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* sqlite3.c:23690:21: */ + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pVfs + 96 /* &.xDlClose */))))(tls, pVfs, pHandle) +} + +func Xsqlite3OsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* sqlite3.c:23694:20: */ + if Xsqlite3Config.FiPrngSeed != 0 { + libc.Xmemset(tls, zBufOut, 0, uint64(nByte)) + if nByte > int32(unsafe.Sizeof(uint32(0))) { + nByte = int32(unsafe.Sizeof(uint32(0))) + } + libc.Xmemcpy(tls, zBufOut, (uintptr(unsafe.Pointer(&Xsqlite3Config)) + 420 /* &.iPrngSeed */), uint64(nByte)) + return SQLITE_OK + } else { + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 104 /* &.xRandomness */))))(tls, pVfs, nByte, zBufOut) + } + return int32(0) + +} + +func Xsqlite3OsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* sqlite3.c:23705:20: */ + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pVfs + 112 /* &.xSleep */))))(tls, pVfs, nMicro) +} + +func Xsqlite3OsGetLastError(tls *libc.TLS, pVfs uintptr) int32 { /* sqlite3.c:23708:20: */ + if (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FxGetLastError != 0 { + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 128 /* &.xGetLastError */))))(tls, pVfs, 0, uintptr(0)) + } + return 0 +} + +func Xsqlite3OsCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* sqlite3.c:23711:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + // IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64() + // method to get the current date and time if that method is available + // (if iVersion is 2 or greater and the function pointer is not NULL) and + // will fall back to xCurrentTime() if xCurrentTimeInt64() is + // unavailable. + if ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion >= 2) && ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FxCurrentTimeInt64 != 0) { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 136 /* &.xCurrentTimeInt64 */))))(tls, pVfs, pTimeOut) + } else { + // var r float64 at bp, 8 + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 120 /* &.xCurrentTime */))))(tls, pVfs, bp /* &r */) + *(*Sqlite3_int64)(unsafe.Pointer(pTimeOut)) = (Sqlite3_int64(*(*float64)(unsafe.Pointer(bp /* r */)) * 86400000.0)) + } + return rc +} + +func Xsqlite3OsOpenMalloc(tls *libc.TLS, pVfs uintptr, zFile uintptr, ppFile uintptr, flags int32, pOutFlags uintptr) int32 { /* sqlite3.c:23729:20: */ + var rc int32 + var pFile uintptr + pFile = Xsqlite3MallocZero(tls, uint64((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile)) + if pFile != 0 { + rc = Xsqlite3OsOpen(tls, pVfs, zFile, pFile, flags, pOutFlags) + if rc != SQLITE_OK { + Xsqlite3_free(tls, pFile) + } else { + *(*uintptr)(unsafe.Pointer(ppFile)) = pFile + } + } else { + rc = SQLITE_NOMEM + } + return rc +} + +func Xsqlite3OsCloseFree(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:23751:21: */ + + Xsqlite3OsClose(tls, pFile) + Xsqlite3_free(tls, pFile) +} + +// This function is a wrapper around the OS specific implementation of +// sqlite3_os_init(). The purpose of the wrapper is to provide the +// ability to simulate a malloc failure, so that the handling of an +// error in sqlite3_os_init() by the upper layers can be tested. +func Xsqlite3OsInit(tls *libc.TLS) int32 { /* sqlite3.c:23763:20: */ + var p uintptr = Xsqlite3_malloc(tls, 10) + if p == uintptr(0) { + return SQLITE_NOMEM + } + Xsqlite3_free(tls, p) + return Xsqlite3_os_init(tls) +} + +// The list of all registered VFS implementations. +var vfsList uintptr = uintptr(0) /* sqlite3.c:23773:20 */ + +// Locate a VFS by name. If no name is given, simply return the +// first VFS on the list. +func Xsqlite3_vfs_find(tls *libc.TLS, zVfs uintptr) uintptr { /* sqlite3.c:23780:24: */ + var pVfs uintptr = uintptr(0) + var mutex uintptr + var rc int32 = Xsqlite3_initialize(tls) + if rc != 0 { + return uintptr(0) + } + mutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, mutex) + for pVfs = vfsList; pVfs != 0; pVfs = (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext { + if zVfs == uintptr(0) { + break + } + if libc.Xstrcmp(tls, zVfs, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName) == 0 { + break + } + } + Xsqlite3_mutex_leave(tls, mutex) + return pVfs +} + +// Unlink a VFS from the linked list +func vfsUnlink(tls *libc.TLS, pVfs uintptr) { /* sqlite3.c:23804:13: */ + + if pVfs == uintptr(0) { + // No-op + } else if vfsList == pVfs { + vfsList = (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext + } else if vfsList != 0 { + var p uintptr = vfsList + for ((*Sqlite3_vfs)(unsafe.Pointer(p)).FpNext != 0) && ((*Sqlite3_vfs)(unsafe.Pointer(p)).FpNext != pVfs) { + p = (*Sqlite3_vfs)(unsafe.Pointer(p)).FpNext + } + if (*Sqlite3_vfs)(unsafe.Pointer(p)).FpNext == pVfs { + (*Sqlite3_vfs)(unsafe.Pointer(p)).FpNext = (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext + } + } +} + +// Register a VFS with the system. It is harmless to register the same +// VFS multiple times. The new VFS becomes the default if makeDflt is +// true. +func Xsqlite3_vfs_register(tls *libc.TLS, pVfs uintptr, makeDflt int32) int32 { /* sqlite3.c:23826:16: */ + var mutex uintptr + var rc int32 = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + + mutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, mutex) + vfsUnlink(tls, pVfs) + if (makeDflt != 0) || (vfsList == uintptr(0)) { + (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext = vfsList + vfsList = pVfs + } else { + (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext = (*Sqlite3_vfs)(unsafe.Pointer(vfsList)).FpNext + (*Sqlite3_vfs)(unsafe.Pointer(vfsList)).FpNext = pVfs + } + + Xsqlite3_mutex_leave(tls, mutex) + return SQLITE_OK +} + +// Unregister a VFS so that it is no longer accessible. +func Xsqlite3_vfs_unregister(tls *libc.TLS, pVfs uintptr) int32 { /* sqlite3.c:23854:16: */ + var mutex uintptr + var rc int32 = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + mutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, mutex) + vfsUnlink(tls, pVfs) + Xsqlite3_mutex_leave(tls, mutex) + return SQLITE_OK +} + +//************* End of os.c ************************************************* +//************* Begin file fault.c ****************************************** +// 2008 Jan 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code to support the concept of "benign" +// malloc failures (when the xMalloc() or xRealloc() method of the +// sqlite3_mem_methods structure fails to allocate a block of memory +// and returns 0). +// +// Most malloc failures are non-benign. After they occur, SQLite +// abandons the current operation and returns an error code (usually +// SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily +// fatal. For example, if a malloc fails while resizing a hash table, this +// is completely recoverable simply by not carrying out the resize. The +// hash table will continue to function normally. So a malloc failure +// during a hash table resize is a benign fault. + +// #include "sqliteInt.h" + +// Global variables. +type BenignMallocHooks1 = struct { + FxBenignBegin uintptr + FxBenignEnd uintptr +} /* sqlite3.c:23902:9 */ + +//************* End of os.c ************************************************* +//************* Begin file fault.c ****************************************** +// 2008 Jan 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code to support the concept of "benign" +// malloc failures (when the xMalloc() or xRealloc() method of the +// sqlite3_mem_methods structure fails to allocate a block of memory +// and returns 0). +// +// Most malloc failures are non-benign. After they occur, SQLite +// abandons the current operation and returns an error code (usually +// SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily +// fatal. For example, if a malloc fails while resizing a hash table, this +// is completely recoverable simply by not carrying out the resize. The +// hash table will continue to function normally. So a malloc failure +// during a hash table resize is a benign fault. + +// #include "sqliteInt.h" + +// Global variables. +type BenignMallocHooks = BenignMallocHooks1 /* sqlite3.c:23902:34 */ +var sqlite3Hooks = BenignMallocHooks1{} /* sqlite3.c:23906:3 */ + +// The "wsdHooks" macro will resolve to the appropriate BenignMallocHooks +// structure. If writable static data is unsupported on the target, +// we have to locate the state vector at run-time. In the more common +// case where writable static data is supported, wsdHooks can refer directly +// to the "sqlite3Hooks" state vector declared above. + +// Register hooks to call when sqlite3BeginBenignMalloc() and +// sqlite3EndBenignMalloc() are called, respectively. +func Xsqlite3BenignMallocHooks(tls *libc.TLS, xBenignBegin uintptr, xBenignEnd uintptr) { /* sqlite3.c:23928:21: */ + + sqlite3Hooks.FxBenignBegin = xBenignBegin + sqlite3Hooks.FxBenignEnd = xBenignEnd +} + +// This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that +// subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc() +// indicates that subsequent malloc failures are non-benign. +func Xsqlite3BeginBenignMalloc(tls *libc.TLS) { /* sqlite3.c:23942:21: */ + + if sqlite3Hooks.FxBenignBegin != 0 { + (*(*func(*libc.TLS))(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Hooks)) /* &.xBenignBegin */))))(tls) + } +} + +func Xsqlite3EndBenignMalloc(tls *libc.TLS) { /* sqlite3.c:23948:21: */ + + if sqlite3Hooks.FxBenignEnd != 0 { + (*(*func(*libc.TLS))(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Hooks)) + 8 /* &.xBenignEnd */))))(tls) + } +} + +//************* End of fault.c ********************************************** +//************* Begin file mem0.c ******************************************* +// 2008 October 28 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains a no-op memory allocation drivers for use when +// SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented +// here always fail. SQLite will not operate with these drivers. These +// are merely placeholders. Real drivers must be substituted using +// sqlite3_config() before SQLite will operate. +// #include "sqliteInt.h" + +// This version of the memory allocator is the default. It is +// used when no other memory allocator is specified using compile-time +// macros. + +//************* End of mem0.c *********************************************** +//************* Begin file mem1.c ******************************************* +// 2007 August 14 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains low-level memory allocation drivers for when +// SQLite will use the standard C-library malloc/realloc/free interface +// to obtain the memory it needs. +// +// This file contains implementations of the low-level memory allocation +// routines specified in the sqlite3_mem_methods object. The content of +// this file is only used if SQLITE_SYSTEM_MALLOC is defined. The +// SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the +// SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The +// default configuration is to use memory allocation routines in this +// file. +// +// C-preprocessor macro summary: +// +// HAVE_MALLOC_USABLE_SIZE The configure script sets this symbol if +// the malloc_usable_size() interface exists +// on the target platform. Or, this symbol +// can be set manually, if desired. +// If an equivalent interface exists by +// a different name, using a separate -D +// option to rename it. +// +// SQLITE_WITHOUT_ZONEMALLOC Some older macs lack support for the zone +// memory allocator. Set this symbol to enable +// building on older macs. +// +// SQLITE_WITHOUT_MSIZE Set this symbol to disable the use of +// _msize() on windows systems. This might +// be necessary when compiling for Delphi, +// for example. +// #include "sqliteInt.h" + +// This version of the memory allocator is the default. It is +// used when no other memory allocator is specified using compile-time +// macros. + +// Use standard C library malloc and free on non-Apple systems. +// Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined. + +// The malloc.h header file is needed for malloc_usable_size() function +// on some systems (e.g. Linux). + +// Include the malloc.h header file, if necessary. Also set define macro +// SQLITE_MALLOCSIZE to the appropriate function name, which is _msize() +// for MSVC and malloc_usable_size() for most other systems (e.g. Linux). +// The memory size function can always be overridden manually by defining +// the macro SQLITE_MALLOCSIZE to the desired function name. + +// Like malloc(), but remember the size of the allocation +// so that we can find it later using sqlite3MemSize(). +// +// For this low-level routine, we are guaranteed that nByte>0 because +// cases of nByte<=0 will be intercepted and dealt with by higher level +// routines. +func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr + + p = libc.Xmalloc(tls, (uint64(nByte + 8))) + if p != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(p)) = Sqlite3_int64(nByte) + p += 8 + } else { + + Xsqlite3_log(tls, SQLITE_NOMEM, ts+632 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + } + return p +} + +// Like free() but works for allocations obtained from sqlite3MemMalloc() +// or sqlite3MemRealloc(). +// +// For this low-level routine, we already know that pPrior!=0 since +// cases where pPrior==0 will have been intecepted and dealt with +// by higher-level routines. +func sqlite3MemFree(tls *libc.TLS, pPrior uintptr) { /* sqlite3.c:24182:13: */ + var p uintptr = pPrior + + p -= 8 + libc.Xfree(tls, p) +} + +// Report the allocated size of a prior return from xMalloc() +// or xRealloc(). +func sqlite3MemSize(tls *libc.TLS, pPrior uintptr) int32 { /* sqlite3.c:24197:12: */ + var p uintptr + + p = pPrior + p -= 8 + return int32(*(*Sqlite3_int64)(unsafe.Pointer(p))) +} + +// Like realloc(). Resize an allocation previously obtained from +// sqlite3MemMalloc(). +// +// For this low-level interface, we know that pPrior!=0. Cases where +// pPrior==0 while have been intercepted by higher-level routine and +// redirected to xMalloc. Similarly, we know that nByte>0 because +// cases where nByte<=0 will have been intercepted by higher-level +// routines and redirected to xFree. +func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* sqlite3.c:24220:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr = pPrior + + // EV: R-46199-30249 + p -= 8 + p = libc.Xrealloc(tls, p, (uint64(nByte + 8))) + if p != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(p)) = Sqlite3_int64(nByte) + p += 8 + } else { + + Xsqlite3_log(tls, SQLITE_NOMEM, + ts+670, /* "failed memory re..." */ + libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) + } + return p +} + +// Round up a request size to the next valid allocation size. +func sqlite3MemRoundup(tls *libc.TLS, n int32) int32 { /* sqlite3.c:24252:12: */ + return (((n) + 7) & libc.CplInt32(7)) +} + +// Initialize this module. +func sqlite3MemInit(tls *libc.TLS, NotUsed uintptr) int32 { /* sqlite3.c:24259:12: */ + _ = NotUsed + return SQLITE_OK +} + +// Deinitialize this module. +func sqlite3MemShutdown(tls *libc.TLS, NotUsed uintptr) { /* sqlite3.c:24286:13: */ + _ = NotUsed + return +} + +// This routine is the only routine in this file with external linkage. +// +// Populate the low-level memory allocation function pointers in +// sqlite3GlobalConfig.m with pointers to the routines in this file. +func Xsqlite3MemSetDefault(tls *libc.TLS) { /* sqlite3.c:24297:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp, uintptr(unsafe.Pointer(&defaultMethods)))) +} + +var defaultMethods = Sqlite3_mem_methods{ + FxMalloc: 0, + FxFree: 0, + FxRealloc: 0, + FxSize: 0, + FxRoundup: 0, + FxInit: 0, + FxShutdown: 0, +} /* sqlite3.c:24298:36 */ + +//************* End of mem1.c *********************************************** +//************* Begin file mem2.c ******************************************* +// 2007 August 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains low-level memory allocation drivers for when +// SQLite will use the standard C-library malloc/realloc/free interface +// to obtain the memory it needs while adding lots of additional debugging +// information to each allocation in order to help detect and fix memory +// leaks and memory usage errors. +// +// This file contains implementations of the low-level memory allocation +// routines specified in the sqlite3_mem_methods object. +// #include "sqliteInt.h" + +// This version of the memory allocator is used only if the +// SQLITE_MEMDEBUG macro is defined + +//************* End of mem2.c *********************************************** +//************* Begin file mem3.c ******************************************* +// 2007 October 14 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement a memory +// allocation subsystem for use by SQLite. +// +// This version of the memory allocation subsystem omits all +// use of malloc(). The SQLite user supplies a block of memory +// before calling sqlite3_initialize() from which allocations +// are made and returned by the xMalloc() and xRealloc() +// implementations. Once sqlite3_initialize() has been called, +// the amount of memory available to SQLite is fixed and cannot +// be changed. +// +// This version of the memory allocation subsystem is included +// in the build only if SQLITE_ENABLE_MEMSYS3 is defined. +// #include "sqliteInt.h" + +// This version of the memory allocator is only built into the library +// SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not +// mean that the library will use a memory-pool by default, just that +// it is available. The mempool allocator is activated by calling +// sqlite3_config(). + +//************* End of mem3.c *********************************************** +//************* Begin file mem5.c ******************************************* +// 2007 October 14 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement a memory +// allocation subsystem for use by SQLite. +// +// This version of the memory allocation subsystem omits all +// use of malloc(). The application gives SQLite a block of memory +// before calling sqlite3_initialize() from which allocations +// are made and returned by the xMalloc() and xRealloc() +// implementations. Once sqlite3_initialize() has been called, +// the amount of memory available to SQLite is fixed and cannot +// be changed. +// +// This version of the memory allocation subsystem is included +// in the build only if SQLITE_ENABLE_MEMSYS5 is defined. +// +// This memory allocator uses the following algorithm: +// +// 1. All memory allocation sizes are rounded up to a power of 2. +// +// 2. If two adjacent free blocks are the halves of a larger block, +// then the two blocks are coalesced into the single larger block. +// +// 3. New memory is allocated from the first available free block. +// +// This algorithm is described in: J. M. Robson. "Bounds for Some Functions +// Concerning Dynamic Storage Allocation". Journal of the Association for +// Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499. +// +// Let n be the size of the largest allocation divided by the minimum +// allocation size (after rounding all sizes up to a power of 2.) Let M +// be the maximum amount of memory ever outstanding at one time. Let +// N be the total amount of memory available for allocation. Robson +// proved that this memory allocator will never breakdown due to +// fragmentation as long as the following constraint holds: +// +// N >= M*(1 + log2(n)/2) - n + 1 +// +// The sqlite3_status() logic tracks the maximum values of n and M so +// that an application can, at any time, verify this constraint. +// #include "sqliteInt.h" + +// This version of the memory allocator is used only when +// SQLITE_ENABLE_MEMSYS5 is defined. + +//************* End of mem5.c *********************************************** +//************* Begin file mutex.c ****************************************** +// 2007 August 14 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement mutexes. +// +// This file contains code that is common across all mutex implementations. +// #include "sqliteInt.h" + +// Initialize the mutex system. +func Xsqlite3MutexInit(tls *libc.TLS) int32 { /* sqlite3.c:26333:20: */ + var rc int32 = SQLITE_OK + if !(int32(Xsqlite3Config.Fmutex.FxMutexAlloc) != 0) { + // If the xMutexAlloc method has not been set, then the user did not + // install a mutex implementation via sqlite3_config() prior to + // sqlite3_initialize() being called. This block copies pointers to + // the default implementation into the sqlite3GlobalConfig structure. + var pFrom uintptr + var pTo uintptr = (uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */) + + if Xsqlite3Config.FbCoreMutex != 0 { + pFrom = Xsqlite3DefaultMutex(tls) + } else { + pFrom = Xsqlite3NoopMutex(tls) + } + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexInit = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexInit + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexEnd = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexEnd + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexFree = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexFree + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexEnter = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexEnter + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexTry = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexTry + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexLeave = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexLeave + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexHeld = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexHeld + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexNotheld = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexNotheld + + (*Sqlite3_mutex_methods)(unsafe.Pointer(pTo)).FxMutexAlloc = (*Sqlite3_mutex_methods)(unsafe.Pointer(pFrom)).FxMutexAlloc + } + + rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ /* &.xMutexInit */))))(tls) + + return rc +} + +// Shutdown the mutex system. This call frees resources allocated by +// sqlite3MutexInit(). +func Xsqlite3MutexEnd(tls *libc.TLS) int32 { /* sqlite3.c:26379:20: */ + var rc int32 = SQLITE_OK + if Xsqlite3Config.Fmutex.FxMutexEnd != 0 { + rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 8 /* &.xMutexEnd */))))(tls) + } + + return rc +} + +// Retrieve a pointer to a static mutex or allocate a new dynamic one. +func Xsqlite3_mutex_alloc(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:26395:26: */ + if (id <= SQLITE_MUTEX_RECURSIVE) && (Xsqlite3_initialize(tls) != 0) { + return uintptr(0) + } + if (id > SQLITE_MUTEX_RECURSIVE) && (Xsqlite3MutexInit(tls) != 0) { + return uintptr(0) + } + + return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 16 /* &.xMutexAlloc */))))(tls, id) +} + +func Xsqlite3MutexAlloc(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:26404:30: */ + if !(int32(Xsqlite3Config.FbCoreMutex) != 0) { + return uintptr(0) + } + + return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 16 /* &.xMutexAlloc */))))(tls, id) +} + +// Free a dynamic mutex. +func Xsqlite3_mutex_free(tls *libc.TLS, p uintptr) { /* sqlite3.c:26416:17: */ + if p != 0 { + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 24 /* &.xMutexFree */))))(tls, p) + } +} + +// Obtain the mutex p. If some other thread already has the mutex, block +// until it can be obtained. +func Xsqlite3_mutex_enter(tls *libc.TLS, p uintptr) { /* sqlite3.c:26427:17: */ + if p != 0 { + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 32 /* &.xMutexEnter */))))(tls, p) + } +} + +// Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another +// thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. +func Xsqlite3_mutex_try(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:26438:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 40 /* &.xMutexTry */))))(tls, p) + } + return rc +} + +// The sqlite3_mutex_leave() routine exits a mutex that was previously +// entered by the same thread. The behavior is undefined if the mutex +// is not currently entered. If a NULL pointer is passed as an argument +// this function is a no-op. +func Xsqlite3_mutex_leave(tls *libc.TLS, p uintptr) { /* sqlite3.c:26453:17: */ + if p != 0 { + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 96 /* &.mutex */ + 48 /* &.xMutexLeave */))))(tls, p) + } +} + +//************* End of mutex.c ********************************************** +//************* Begin file mutex_noop.c ************************************* +// 2008 October 07 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement mutexes. +// +// This implementation in this file does not provide any mutual +// exclusion and is thus suitable for use only in applications +// that use SQLite in a single thread. The routines defined +// here are place-holders. Applications can substitute working +// mutex routines at start-time using the +// +// sqlite3_config(SQLITE_CONFIG_MUTEX,...) +// +// interface. +// +// If compiled with SQLITE_DEBUG, then additional logic is inserted +// that does error checking on mutexes to make sure they are being +// called correctly. +// #include "sqliteInt.h" + +// Stub routines for all mutex methods. +// +// This routines provide no mutual exclusion or error checking. +func noopMutexInit(tls *libc.TLS) int32 { /* sqlite3.c:26516:12: */ + return SQLITE_OK +} + +func noopMutexEnd(tls *libc.TLS) int32 { /* sqlite3.c:26517:12: */ + return SQLITE_OK +} + +func noopMutexAlloc(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:26518:22: */ + _ = id + return uintptr(8) +} + +func noopMutexFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:26522:13: */ + _ = p + return +} + +func noopMutexEnter(tls *libc.TLS, p uintptr) { /* sqlite3.c:26523:13: */ + _ = p + return +} + +func noopMutexTry(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:26524:12: */ + _ = p + return SQLITE_OK +} + +func noopMutexLeave(tls *libc.TLS, p uintptr) { /* sqlite3.c:26528:13: */ + _ = p + return +} + +func Xsqlite3NoopMutex(tls *libc.TLS) uintptr { /* sqlite3.c:26530:44: */ + + return uintptr(unsafe.Pointer(&sMutex)) +} + +var sMutex = Sqlite3_mutex_methods{ + FxMutexInit: 0, + FxMutexEnd: 0, + FxMutexAlloc: 0, + FxMutexFree: 0, + FxMutexEnter: 0, + FxMutexTry: 0, + FxMutexLeave: 0, +} /* sqlite3.c:26531:38 */ + +// If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation +// is used regardless of the run-time threadsafety setting. +func Xsqlite3DefaultMutex(tls *libc.TLS) uintptr { /* sqlite3.c:26689:44: */ + return Xsqlite3NoopMutex(tls) +} + +//************* End of mutex_noop.c ***************************************** +//************* Begin file mutex_unix.c ************************************* +// 2007 August 28 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement mutexes for pthreads +// #include "sqliteInt.h" + +// The code in this file is only used if we are compiling threadsafe +// under unix with pthreads. +// +// Note that this implementation requires a version of pthreads that +// supports recursive mutexes. + +//************* End of mutex_unix.c ***************************************** +//************* Begin file mutex_w32.c ************************************** +// 2007 August 14 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C functions that implement mutexes for Win32. +// #include "sqliteInt.h" + +// The code in this file is only used if we are compiling multithreaded +// on a Win32 system. + +//************* End of mutex_w32.c ****************************************** +//************* Begin file malloc.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Memory allocation functions used throughout sqlite. +// #include "sqliteInt.h" +// #include + +// Attempt to release up to n bytes of non-essential memory currently +// held by SQLite. An example of non-essential memory is memory used to +// cache database pages that are not currently in use. +func Xsqlite3_release_memory(tls *libc.TLS, n int32) int32 { /* sqlite3.c:27808:16: */ + return Xsqlite3PcacheReleaseMemory(tls, n) +} + +// Default value of the hard heap limit. 0 means "no limit". + +// State information local to the memory allocation subsystem. +type Mem0Global = struct { + Fmutex uintptr + FalarmThreshold Sqlite3_int64 + FhardLimit Sqlite3_int64 + FnearlyFull int32 + _ [4]byte +} /* sqlite3.c:27830:19 */ + +// Default value of the hard heap limit. 0 means "no limit". + +// State information local to the memory allocation subsystem. +var mem0 = Mem0Global{} /* sqlite3.c:27840:3 */ + +// Return the memory allocator mutex. sqlite3_status() needs it. +func Xsqlite3MallocMutex(tls *libc.TLS) uintptr { /* sqlite3.c:27847:30: */ + return mem0.Fmutex +} + +// Deprecated external interface. It used to set an alarm callback +// that was invoked when memory usage grew too large. Now it is a +// no-op. +func Xsqlite3_memory_alarm(tls *libc.TLS, xCallback uintptr, pArg uintptr, iThreshold Sqlite3_int64) int32 { /* sqlite3.c:27857:16: */ + _ = xCallback + _ = pArg + _ = iThreshold + return SQLITE_OK +} + +// Set the soft heap-size limit for the library. An argument of +// zero disables the limit. A negative argument is a no-op used to +// obtain the return value. +// +// The return value is the value of the heap limit just before this +// interface was called. +// +// If the hard heap limit is enabled, then the soft heap limit cannot +// be disabled nor raised above the hard heap limit. +func Xsqlite3_soft_heap_limit64(tls *libc.TLS, n Sqlite3_int64) Sqlite3_int64 { /* sqlite3.c:27880:26: */ + var priorLimit Sqlite3_int64 + var excess Sqlite3_int64 + var nUsed Sqlite3_int64 + var rc int32 = Xsqlite3_initialize(tls) + if rc != 0 { + return int64(-1) + } + Xsqlite3_mutex_enter(tls, mem0.Fmutex) + priorLimit = mem0.FalarmThreshold + if n < int64(0) { + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + return priorLimit + } + if (mem0.FhardLimit > int64(0)) && ((n > mem0.FhardLimit) || (n == int64(0))) { + n = mem0.FhardLimit + } + mem0.FalarmThreshold = n + nUsed = Xsqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + libc.AtomicStoreNInt32((uintptr(unsafe.Pointer(&mem0)) + 24 /* &.nearlyFull */), int32((libc.Bool32((n > int64(0)) && (n <= nUsed)))), 0) + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + excess = (Xsqlite3_memory_used(tls) - n) + if excess > int64(0) { + Xsqlite3_release_memory(tls, (int32(excess & int64(0x7fffffff)))) + } + return priorLimit +} + +func Xsqlite3_soft_heap_limit(tls *libc.TLS, n int32) { /* sqlite3.c:27905:17: */ + if n < 0 { + n = 0 + } + Xsqlite3_soft_heap_limit64(tls, int64(n)) +} + +// Set the hard heap-size limit for the library. An argument of zero +// disables the hard heap limit. A negative argument is a no-op used +// to obtain the return value without affecting the hard heap limit. +// +// The return value is the value of the hard heap limit just prior to +// calling this interface. +// +// Setting the hard heap limit will also activate the soft heap limit +// and constrain the soft heap limit to be no more than the hard heap +// limit. +func Xsqlite3_hard_heap_limit64(tls *libc.TLS, n Sqlite3_int64) Sqlite3_int64 { /* sqlite3.c:27922:26: */ + var priorLimit Sqlite3_int64 + var rc int32 = Xsqlite3_initialize(tls) + if rc != 0 { + return int64(-1) + } + Xsqlite3_mutex_enter(tls, mem0.Fmutex) + priorLimit = mem0.FhardLimit + if n >= int64(0) { + mem0.FhardLimit = n + if (n < mem0.FalarmThreshold) || (mem0.FalarmThreshold == int64(0)) { + mem0.FalarmThreshold = n + } + } + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + return priorLimit +} + +// Initialize the memory allocation subsystem. +func Xsqlite3MallocInit(tls *libc.TLS) int32 { /* sqlite3.c:27944:20: */ + var rc int32 + if Xsqlite3Config.Fm.FxMalloc == uintptr(0) { + Xsqlite3MemSetDefault(tls) + } + mem0.Fmutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MEM) + if ((Xsqlite3Config.FpPage == uintptr(0)) || (Xsqlite3Config.FszPage < 512)) || + (Xsqlite3Config.FnPage <= 0) { + Xsqlite3Config.FpPage = uintptr(0) + Xsqlite3Config.FszPage = 0 + } + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 40 /* &.xInit */))))(tls, Xsqlite3Config.Fm.FpAppData) + if rc != SQLITE_OK { + libc.Xmemset(tls, uintptr(unsafe.Pointer(&mem0)), 0, uint64(unsafe.Sizeof(mem0))) + } + return rc +} + +// Return true if the heap is currently under memory pressure - in other +// words if the amount of heap used is close to the limit set by +// sqlite3_soft_heap_limit(). +func Xsqlite3HeapNearlyFull(tls *libc.TLS) int32 { /* sqlite3.c:27965:20: */ + return libc.AtomicLoadNInt32((uintptr(unsafe.Pointer(&mem0)) + 24 /* &.nearlyFull */), 0) +} + +// Deinitialize the memory allocation subsystem. +func Xsqlite3MallocEnd(tls *libc.TLS) { /* sqlite3.c:27972:21: */ + if Xsqlite3Config.Fm.FxShutdown != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 48 /* &.xShutdown */))))(tls, Xsqlite3Config.Fm.FpAppData) + } + libc.Xmemset(tls, uintptr(unsafe.Pointer(&mem0)), 0, uint64(unsafe.Sizeof(mem0))) +} + +// Return the amount of memory currently checked out. +func Xsqlite3_memory_used(tls *libc.TLS) Sqlite3_int64 { /* sqlite3.c:27982:26: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var res Sqlite3_int64 at bp, 8 + + // var mx Sqlite3_int64 at bp+8, 8 + + Xsqlite3_status64(tls, SQLITE_STATUS_MEMORY_USED, bp /* &res */, bp+8 /* &mx */, 0) + return *(*Sqlite3_int64)(unsafe.Pointer(bp /* res */)) +} + +// Return the maximum amount of memory that has ever been +// checked out since either the beginning of this process +// or since the most recent reset. +func Xsqlite3_memory_highwater(tls *libc.TLS, resetFlag int32) Sqlite3_int64 { /* sqlite3.c:27993:26: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var res Sqlite3_int64 at bp, 8 + + // var mx Sqlite3_int64 at bp+8, 8 + + Xsqlite3_status64(tls, SQLITE_STATUS_MEMORY_USED, bp /* &res */, bp+8 /* &mx */, resetFlag) + return *(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* mx */)) +} + +// Trigger the alarm +func sqlite3MallocAlarm(tls *libc.TLS, nByte int32) { /* sqlite3.c:28002:13: */ + if mem0.FalarmThreshold <= int64(0) { + return + } + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + Xsqlite3_release_memory(tls, nByte) + Xsqlite3_mutex_enter(tls, mem0.Fmutex) +} + +// Do a memory allocation with statistics and alarms. Assume the +// lock is already held. +func mallocWithAlarm(tls *libc.TLS, n int32, pp uintptr) { /* sqlite3.c:28013:13: */ + var p uintptr + var nFull int32 + + // In Firefox (circa 2017-02-08), xRoundup() is remapped to an internal + // implementation of malloc_good_size(), which must be called in debug + // mode and specifically when the DMD "Dark Matter Detector" is enabled + // or else a crash results. Hence, do not attempt to optimize out the + // following xRoundup() call. + nFull = (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 32 /* &.xRoundup */))))(tls, n) + + Xsqlite3StatusHighwater(tls, SQLITE_STATUS_MALLOC_SIZE, n) + if mem0.FalarmThreshold > int64(0) { + var nUsed Sqlite3_int64 = Xsqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + if nUsed >= (mem0.FalarmThreshold - Sqlite3_int64(nFull)) { + libc.AtomicStoreNInt32((uintptr(unsafe.Pointer(&mem0)) + 24 /* &.nearlyFull */), int32(1), 0) + sqlite3MallocAlarm(tls, nFull) + if mem0.FhardLimit != 0 { + nUsed = Xsqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED) + if nUsed >= (mem0.FhardLimit - Sqlite3_int64(nFull)) { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + return + } + } + } else { + libc.AtomicStoreNInt32((uintptr(unsafe.Pointer(&mem0)) + 24 /* &.nearlyFull */), int32(0), 0) + } + } + p = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ /* &.xMalloc */))))(tls, nFull) + if (p == uintptr(0)) && (mem0.FalarmThreshold > int64(0)) { + sqlite3MallocAlarm(tls, nFull) + p = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ /* &.xMalloc */))))(tls, nFull) + } + if p != 0 { + nFull = Xsqlite3MallocSize(tls, p) + Xsqlite3StatusUp(tls, SQLITE_STATUS_MEMORY_USED, nFull) + Xsqlite3StatusUp(tls, SQLITE_STATUS_MALLOC_COUNT, 1) + } + *(*uintptr)(unsafe.Pointer(pp)) = p +} + +// Allocate memory. This routine is like sqlite3_malloc() except that it +// assumes the memory subsystem has already been initialized. +func Xsqlite3Malloc(tls *libc.TLS, n U64) uintptr { /* sqlite3.c:28062:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var p uintptr at bp, 8 + + if (n == uint64(0)) || (n >= uint64(0x7fffff00)) { + // A memory allocation of a number of bytes which is near the maximum + // signed integer value might cause an integer overflow inside of the + // xMalloc(). Hence we limit the maximum size to 0x7fffff00, giving + // 255 bytes of overhead. SQLite itself will never use anything near + // this amount. The only way to reach the limit is with sqlite3_malloc() + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + } else if Xsqlite3Config.FbMemstat != 0 { + Xsqlite3_mutex_enter(tls, mem0.Fmutex) + mallocWithAlarm(tls, int32(n), bp /* &p */) + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + } else { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ /* &.xMalloc */))))(tls, int32(n)) + } + // IMP: R-11148-40995 + return *(*uintptr)(unsafe.Pointer(bp /* p */)) +} + +// This version of the memory allocation is for use by the application. +// First make sure the memory subsystem is initialized, then do the +// allocation. +func Xsqlite3_malloc(tls *libc.TLS, n int32) uintptr { /* sqlite3.c:28087:17: */ + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + if n <= 0 { + return uintptr(0) + } + return Xsqlite3Malloc(tls, uint64(n)) +} + +func Xsqlite3_malloc64(tls *libc.TLS, n Sqlite3_uint64) uintptr { /* sqlite3.c:28093:17: */ + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + return Xsqlite3Malloc(tls, n) +} + +// TRUE if p is a lookaside memory allocation from db +func isLookaside(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:28104:12: */ + return (libc.Bool32((Uptr((p)) >= Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart))) && (Uptr((p)) < Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd))))) +} + +// Return the size of a memory allocation previously obtained from +// sqlite3Malloc() or sqlite3_malloc(). +func Xsqlite3MallocSize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:28115:20: */ + + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 24 /* &.xSize */))))(tls, p) +} + +func lookasideMallocSize(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:28119:12: */ + if p < (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle { + return int32((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + return LOOKASIDE_SMALL +} + +func Xsqlite3DbMallocSize(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:28126:20: */ + + if db != 0 { + if (Uptr(p)) < Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd)) { + if (Uptr(p)) >= Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle)) { + + return LOOKASIDE_SMALL + } + if (Uptr(p)) >= Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart)) { + + return int32((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) + } + } + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 24 /* &.xSize */))))(tls, p) +} + +func Xsqlite3_msize(tls *libc.TLS, p uintptr) Sqlite3_uint64 { /* sqlite3.c:28155:27: */ + + if p != 0 { + return uint64((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 24 /* &.xSize */))))(tls, p)) + } + return uint64(0) +} + +// Free memory previously obtained from sqlite3Malloc(). +func Xsqlite3_free(tls *libc.TLS, p uintptr) { /* sqlite3.c:28164:17: */ + if p == uintptr(0) { + return + } // IMP: R-49053-54554 + + if Xsqlite3Config.FbMemstat != 0 { + Xsqlite3_mutex_enter(tls, mem0.Fmutex) + Xsqlite3StatusDown(tls, SQLITE_STATUS_MEMORY_USED, Xsqlite3MallocSize(tls, p)) + Xsqlite3StatusDown(tls, SQLITE_STATUS_MALLOC_COUNT, 1) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 8 /* &.xFree */))))(tls, p) + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + } else { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 8 /* &.xFree */))))(tls, p) + } +} + +// Add the size of memory allocation "p" to the count in +// *db->pnBytesFreed. +func measureAllocationSize(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:28183:29: */ + *(*int32)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed)) += (Xsqlite3DbMallocSize(tls, db, p)) +} + +// Free memory that might be associated with a particular database +// connection. Calling sqlite3DbFree(D,X) for X==0 is a harmless no-op. +// The sqlite3DbFreeNN(D,X) version requires that X be non-NULL. +func Xsqlite3DbFreeNN(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:28192:21: */ + + if db != 0 { + if (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed != 0 { + measureAllocationSize(tls, db, p) + return + } + if (Uptr(p)) < Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd)) { + if (Uptr(p)) >= Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle)) { + var pBuf uintptr = p + (*LookasideSlot)(unsafe.Pointer(pBuf)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = pBuf + return + } + if (Uptr(p)) >= Uptr(((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart)) { + var pBuf uintptr = p + (*LookasideSlot)(unsafe.Pointer(pBuf)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = pBuf + return + } + } + } + + Xsqlite3_free(tls, p) +} + +func Xsqlite3DbFree(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:28229:21: */ + + if p != 0 { + Xsqlite3DbFreeNN(tls, db, p) + } +} + +// Change the size of an existing memory allocation +func Xsqlite3Realloc(tls *libc.TLS, pOld uintptr, nBytes U64) uintptr { /* sqlite3.c:28237:21: */ + var nOld int32 + var nNew int32 + var nDiff int32 + var pNew uintptr + + if pOld == uintptr(0) { + return Xsqlite3Malloc(tls, nBytes) // IMP: R-04300-56712 + } + if nBytes == uint64(0) { + Xsqlite3_free(tls, pOld) // IMP: R-26507-47431 + return uintptr(0) + } + if nBytes >= uint64(0x7fffff00) { + // The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() + return uintptr(0) + } + nOld = Xsqlite3MallocSize(tls, pOld) + // IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second + // argument to xRealloc is always a value returned by a prior call to + // xRoundup. + nNew = (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 32 /* &.xRoundup */))))(tls, int32(nBytes)) + if nOld == nNew { + pNew = pOld + } else if Xsqlite3Config.FbMemstat != 0 { + var nUsed Sqlite3_int64 + Xsqlite3_mutex_enter(tls, mem0.Fmutex) + Xsqlite3StatusHighwater(tls, SQLITE_STATUS_MALLOC_SIZE, int32(nBytes)) + nDiff = (nNew - nOld) + if (nDiff > 0) && ((libc.AssignInt64(&nUsed, Xsqlite3StatusValue(tls, SQLITE_STATUS_MEMORY_USED))) >= (mem0.FalarmThreshold - Sqlite3_int64(nDiff))) { + sqlite3MallocAlarm(tls, nDiff) + if (mem0.FhardLimit > int64(0)) && (nUsed >= (mem0.FhardLimit - Sqlite3_int64(nDiff))) { + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + return uintptr(0) + } + } + pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 16 /* &.xRealloc */))))(tls, pOld, nNew) + if (pNew == uintptr(0)) && (mem0.FalarmThreshold > int64(0)) { + sqlite3MallocAlarm(tls, int32(nBytes)) + pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 16 /* &.xRealloc */))))(tls, pOld, nNew) + } + if pNew != 0 { + nNew = Xsqlite3MallocSize(tls, pNew) + Xsqlite3StatusUp(tls, SQLITE_STATUS_MEMORY_USED, (nNew - nOld)) + } + Xsqlite3_mutex_leave(tls, mem0.Fmutex) + } else { + pNew = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 32 /* &.m */ + 16 /* &.xRealloc */))))(tls, pOld, nNew) + } + // IMP: R-11148-40995 + return pNew +} + +// The public interface to sqlite3Realloc. Make sure that the memory +// subsystem is initialized prior to invoking sqliteRealloc. +func Xsqlite3_realloc(tls *libc.TLS, pOld uintptr, n int32) uintptr { /* sqlite3.c:28296:17: */ + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + if n < 0 { + n = 0 + } // IMP: R-26507-47431 + return Xsqlite3Realloc(tls, pOld, uint64(n)) +} + +func Xsqlite3_realloc64(tls *libc.TLS, pOld uintptr, n Sqlite3_uint64) uintptr { /* sqlite3.c:28303:17: */ + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + return Xsqlite3Realloc(tls, pOld, n) +} + +// Allocate and zero memory. +func Xsqlite3MallocZero(tls *libc.TLS, n U64) uintptr { /* sqlite3.c:28314:21: */ + var p uintptr = Xsqlite3Malloc(tls, n) + if p != 0 { + libc.Xmemset(tls, p, 0, Size_t(n)) + } + return p +} + +// Allocate and zero memory. If the allocation fails, make +// the mallocFailed flag in the connection pointer. +func Xsqlite3DbMallocZero(tls *libc.TLS, db uintptr, n U64) uintptr { /* sqlite3.c:28326:21: */ + var p uintptr + + p = Xsqlite3DbMallocRaw(tls, db, n) + if p != 0 { + libc.Xmemset(tls, p, 0, Size_t(n)) + } + return p +} + +// Finish the work of sqlite3DbMallocRawNN for the unusual and +// slower case when the allocation cannot be fulfilled using lookaside. +func dbMallocRawFinish(tls *libc.TLS, db uintptr, n U64) uintptr { /* sqlite3.c:28338:29: */ + var p uintptr + + p = Xsqlite3Malloc(tls, n) + if !(p != 0) { + Xsqlite3OomFault(tls, db) + } + + return p +} + +// Allocate memory, either lookaside (if possible) or heap. +// If the allocation fails, set the mallocFailed flag in +// the connection pointer. +// +// If db!=0 and db->mallocFailed is true (indicating a prior malloc +// failure on the same database connection) then always return 0. +// Hence for a particular database connection, once malloc starts +// failing, it fails consistently until mallocFailed is reset. +// This is an important assumption. There are many places in the +// code that do things like this: +// +// int *a = (int*)sqlite3DbMallocRaw(db, 100); +// int *b = (int*)sqlite3DbMallocRaw(db, 200); +// if( b ) a[10] = 9; +// +// In other words, if a subsequent malloc (ex: "b") worked, it is assumed +// that all prior mallocs (ex: "a") worked too. +// +// The sqlite3MallocRawNN() variant guarantees that the "db" parameter is +// not a NULL pointer. +func Xsqlite3DbMallocRaw(tls *libc.TLS, db uintptr, n U64) uintptr { /* sqlite3.c:28370:21: */ + var p uintptr + if db != 0 { + return Xsqlite3DbMallocRawNN(tls, db, n) + } + p = Xsqlite3Malloc(tls, n) + + return p +} + +func Xsqlite3DbMallocRawNN(tls *libc.TLS, db uintptr, n U64) uintptr { /* sqlite3.c:28377:21: */ + var pBuf uintptr + + if n > U64((*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz) { + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable) != 0) { + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */) + 1*4))++ + } else if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return uintptr(0) + } + return dbMallocRawFinish(tls, db, n) + } + if n <= uint64(LOOKASIDE_SMALL) { + if (libc.AssignUintptr(&pBuf, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree)) != uintptr(0) { + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = (*LookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */)))++ + return pBuf + } else if (libc.AssignUintptr(&pBuf, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit)) != uintptr(0) { + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = (*LookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */)))++ + return pBuf + } + } + if (libc.AssignUintptr(&pBuf, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree)) != uintptr(0) { + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = (*LookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */)))++ + return pBuf + } else if (libc.AssignUintptr(&pBuf, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit)) != uintptr(0) { + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = (*LookasideSlot)(unsafe.Pointer(pBuf)).FpNext + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */)))++ + return pBuf + } else { + *(*U32)(unsafe.Pointer((db + 408 /* &.lookaside */ + 16 /* &.anStat */) + 2*4))++ + } + return dbMallocRawFinish(tls, db, n) +} + +// Resize the block of memory pointed to by p to n bytes. If the +// resize fails, set the mallocFailed flag in the connection object. +func Xsqlite3DbRealloc(tls *libc.TLS, db uintptr, p uintptr, n U64) uintptr { /* sqlite3.c:28433:21: */ + + if p == uintptr(0) { + return Xsqlite3DbMallocRawNN(tls, db, n) + } + + if (Uptr(p)) < Uptr((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd) { + if (Uptr(p)) >= Uptr((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle) { + if n <= uint64(LOOKASIDE_SMALL) { + return p + } + } else if (Uptr(p)) >= Uptr((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) { + if n <= U64((*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue) { + return p + } + } + } + return dbReallocFinish(tls, db, p, n) +} + +func dbReallocFinish(tls *libc.TLS, db uintptr, p uintptr, n U64) uintptr { /* sqlite3.c:28449:29: */ + var pNew uintptr = uintptr(0) + + if int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + if isLookaside(tls, db, p) != 0 { + pNew = Xsqlite3DbMallocRawNN(tls, db, n) + if pNew != 0 { + libc.Xmemcpy(tls, pNew, p, uint64(lookasideMallocSize(tls, db, p))) + Xsqlite3DbFree(tls, db, p) + } + } else { + + pNew = Xsqlite3Realloc(tls, p, n) + if !(pNew != 0) { + Xsqlite3OomFault(tls, db) + } + + } + } + return pNew +} + +// Attempt to reallocate p. If the reallocation fails, then free p +// and set the mallocFailed flag in the database connection. +func Xsqlite3DbReallocOrFree(tls *libc.TLS, db uintptr, p uintptr, n U64) uintptr { /* sqlite3.c:28479:21: */ + var pNew uintptr + pNew = Xsqlite3DbRealloc(tls, db, p, n) + if !(pNew != 0) { + Xsqlite3DbFree(tls, db, p) + } + return pNew +} + +// Make a copy of a string in memory obtained from sqliteMalloc(). These +// functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This +// is because when memory debugging is turned on, these two functions are +// called via macros that record the current file and line number in the +// ThreadData structure. +func Xsqlite3DbStrDup(tls *libc.TLS, db uintptr, z uintptr) uintptr { /* sqlite3.c:28495:21: */ + var zNew uintptr + var n Size_t + if z == uintptr(0) { + return uintptr(0) + } + n = (libc.Xstrlen(tls, z) + uint64(1)) + zNew = Xsqlite3DbMallocRaw(tls, db, uint64(n)) + if zNew != 0 { + libc.Xmemcpy(tls, zNew, z, n) + } + return zNew +} + +func Xsqlite3DbStrNDup(tls *libc.TLS, db uintptr, z uintptr, n U64) uintptr { /* sqlite3.c:28508:21: */ + var zNew uintptr + + if z != 0 { + zNew = Xsqlite3DbMallocRawNN(tls, db, (n + uint64(1))) + } else { + zNew = uintptr(0) + } + if zNew != 0 { + libc.Xmemcpy(tls, zNew, z, Size_t(n)) + *(*int8)(unsafe.Pointer(zNew + uintptr(n))) = int8(0) + } + return zNew +} + +// The text between zStart and zEnd represents a phrase within a larger +// SQL statement. Make a copy of this phrase in space obtained form +// sqlite3DbMalloc(). Omit leading and trailing whitespace. +func Xsqlite3DbSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:28526:21: */ + var n int32 + for (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zStart)))]) & 0x01) != 0 { + zStart++ + } + n = (int32((int64(zEnd) - int64(zStart)) / 1)) + for (n > 0) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zStart + uintptr((n - 1)))))]) & 0x01) != 0) { + n-- + } + return Xsqlite3DbStrNDup(tls, db, zStart, uint64(n)) +} + +// Free any prior content in *pz and replace it with a copy of zNew. +func Xsqlite3SetString(tls *libc.TLS, pz uintptr, db uintptr, zNew uintptr) { /* sqlite3.c:28537:21: */ + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pz))) + *(*uintptr)(unsafe.Pointer(pz)) = Xsqlite3DbStrDup(tls, db, zNew) +} + +// Call this routine to record the fact that an OOM (out-of-memory) error +// has happened. This routine will set db->mallocFailed, and also +// temporarily disable the lookaside memory allocator and interrupt +// any running VDBEs. +func Xsqlite3OomFault(tls *libc.TLS, db uintptr) { /* sqlite3.c:28548:21: */ + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).FbBenignMalloc) == 0) { + (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed = U8(1) + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 0 { + libc.AtomicStoreNInt32((db + 400 /* &.u1 */ /* &.isInterrupted */), int32(1), 0) + } + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) + if (*Sqlite3)(unsafe.Pointer(db)).FpParse != 0 { + (*Parse)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpParse)).Frc = SQLITE_NOMEM + } + } +} + +// This routine reactivates the memory allocator and clears the +// db->mallocFailed flag as necessary. +// +// The memory allocator is not restarted if there are running +// VDBEs. +func Xsqlite3OomClear(tls *libc.TLS, db uintptr) { /* sqlite3.c:28568:21: */ + if ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) && ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec == 0) { + (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed = U8(0) + libc.AtomicStoreNInt32((db + 400 /* &.u1 */ /* &.isInterrupted */), int32(0), 0) + + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = func() uint16 { + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + return uint16(0) + } + return (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue + }() + } +} + +// Take actions at the end of an API call to deal with error codes. +func apiHandleError(tls *libc.TLS, db uintptr, rc int32) int32 { /* sqlite3.c:28580:28: */ + if ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { + Xsqlite3OomClear(tls, db) + Xsqlite3Error(tls, db, SQLITE_NOMEM) + return SQLITE_NOMEM + } + return (rc & (*Sqlite3)(unsafe.Pointer(db)).FerrMask) +} + +// This function must be called before exiting any API function (i.e. +// returning control to the user) that has called sqlite3_malloc or +// sqlite3_realloc. +// +// The returned value is normally a copy of the second argument to this +// function. However, if a malloc() failure has occurred since the previous +// invocation SQLITE_NOMEM is returned instead. +// +// If an OOM as occurred, then the connection error-code (the value +// returned by sqlite3_errcode()) is set to SQLITE_NOMEM. +func Xsqlite3ApiExit(tls *libc.TLS, db uintptr, rc int32) int32 { /* sqlite3.c:28601:20: */ + // If the db handle must hold the connection handle mutex here. + // Otherwise the read (and possible write) of db->mallocFailed + // is unsafe, as is the call to sqlite3Error(). + + if ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) || (rc != 0) { + return apiHandleError(tls, db, rc) + } + return (rc & (*Sqlite3)(unsafe.Pointer(db)).FerrMask) +} + +//************* End of malloc.c ********************************************* +//************* Begin file printf.c ***************************************** +// The "printf" code that follows dates from the 1980's. It is in +// the public domain. +// +// +// +// This file contains code for a set of "printf"-like routines. These +// routines format strings much like the printf() from the standard C +// library, though the implementation here has enhancements to support +// SQLite. +// #include "sqliteInt.h" + +// Conversion types fall into various categories as defined by the +// following enumeration. +// The rest are extensions, not normally found in printf() + +// An "etByte" is an 8-bit unsigned value. +type EtByte = uint8 /* sqlite3.c:28659:23 */ + +// Each builtin conversion character (ex: the 'd' in "%d") is described +// by an instance of the following structure +type et_info = struct { + Ffmttype int8 + Fbase EtByte + Fflags EtByte + Ftype EtByte + Fcharset EtByte + Fprefix EtByte +} /* sqlite3.c:28665:9 */ + +// Each builtin conversion character (ex: the 'd' in "%d") is described +// by an instance of the following structure +type Et_info = et_info /* sqlite3.c:28672:3 */ + +// Allowed values for et_info.flags + +// The following table is searched linearly, so it is good to put the +// most frequently used conversion types first. +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 706 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 739 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var fmtinfo = [23]Et_info{ + {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, + {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, + {Ffmttype: int8('g'), Fflags: EtByte(1), Ftype: EtByte(EtGENERIC), Fcharset: EtByte(30)}, + {Ffmttype: int8('z'), Fflags: EtByte(4), Ftype: EtByte(EtDYNSTRING)}, + {Ffmttype: int8('q'), Fflags: EtByte(4), Ftype: EtByte(EtSQLESCAPE)}, + {Ffmttype: int8('Q'), Fflags: EtByte(4), Ftype: EtByte(EtSQLESCAPE2)}, + {Ffmttype: int8('w'), Fflags: EtByte(4), Ftype: EtByte(EtSQLESCAPE3)}, + {Ffmttype: int8('c'), Ftype: EtByte(EtCHARX)}, + {Ffmttype: int8('o'), Fbase: EtByte(8), Fprefix: EtByte(2)}, + {Ffmttype: int8('u'), Fbase: EtByte(10), Ftype: EtByte(EtDECIMAL)}, + {Ffmttype: int8('x'), Fbase: EtByte(16), Fcharset: EtByte(16), Fprefix: EtByte(1)}, + {Ffmttype: int8('X'), Fbase: EtByte(16), Fprefix: EtByte(4)}, + {Ffmttype: int8('f'), Fflags: EtByte(1), Ftype: EtByte(EtFLOAT)}, + {Ffmttype: int8('e'), Fflags: EtByte(1), Ftype: EtByte(EtEXP), Fcharset: EtByte(30)}, + {Ffmttype: int8('E'), Fflags: EtByte(1), Ftype: EtByte(EtEXP), Fcharset: EtByte(14)}, + {Ffmttype: int8('G'), Fflags: EtByte(1), Ftype: EtByte(EtGENERIC), Fcharset: EtByte(14)}, + {Ffmttype: int8('i'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, + {Ffmttype: int8('n'), Ftype: EtByte(EtSIZE)}, + {Ffmttype: int8('%'), Ftype: EtByte(EtPERCENT)}, + {Ffmttype: int8('p'), Fbase: EtByte(16), Ftype: EtByte(EtPOINTER), Fprefix: EtByte(1)}, + + // All the rest are undocumented and are for internal use only + {Ffmttype: int8('T'), Ftype: EtByte(EtTOKEN)}, + {Ffmttype: int8('S'), Ftype: EtByte(EtSRCITEM)}, + {Ffmttype: int8('r'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtORDINAL)}, +} /* sqlite3.c:28687:22 */ + +// Notes: +// +// %S Takes a pointer to SrcItem. Shows name or database.name +// %!S Like %S but prefer the zName over the zAlias + +// Floating point constants used for rounding +var arRound = [10]float64{ + 5.0e-01, 5.0e-02, 5.0e-03, 5.0e-04, 5.0e-05, + 5.0e-06, 5.0e-07, 5.0e-08, 5.0e-09, 5.0e-10, +} /* sqlite3.c:28724:21 */ + +// If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point +// conversions will work. +// "*val" is a double such that 0.1 <= *val < 10.0 +// Return the ascii code for the leading digit of *val, then +// multiply "*val" by 10.0 to renormalize. +// +// Example: +// input: *val = 3.14159 +// output: *val = 1.4159 function return = '3' +// +// The counter *cnt is incremented each time. After counter exceeds +// 16 (the number of significant digits in a 64-bit float) '0' is +// always returned. +func et_getdigit(tls *libc.TLS, val uintptr, cnt uintptr) int8 { /* sqlite3.c:28747:13: */ + var digit int32 + var d float64 + if (*(*int32)(unsafe.Pointer(cnt))) <= 0 { + return int8('0') + } + (*(*int32)(unsafe.Pointer(cnt)))-- + digit = int32(*(*float64)(unsafe.Pointer(val))) + d = float64(digit) + digit = digit + ('0') + *(*float64)(unsafe.Pointer(val)) = ((*(*float64)(unsafe.Pointer(val)) - d) * 10.0) + return int8(digit) +} + +// Set the StrAccum object to an error mode. +func setStrAccumError(tls *libc.TLS, p uintptr, eError U8) { /* sqlite3.c:28763:13: */ + + (*StrAccum)(unsafe.Pointer(p)).FaccError = eError + if (*StrAccum)(unsafe.Pointer(p)).FmxAlloc != 0 { + Xsqlite3_str_reset(tls, p) + } + if int32(eError) == SQLITE_TOOBIG { + Xsqlite3ErrorToParser(tls, (*StrAccum)(unsafe.Pointer(p)).Fdb, int32(eError)) + } +} + +// Extra argument values from a PrintfArguments object +func getIntArg(tls *libc.TLS, p uintptr) Sqlite3_int64 { /* sqlite3.c:28773:22: */ + if (*PrintfArguments)(unsafe.Pointer(p)).FnArg <= (*PrintfArguments)(unsafe.Pointer(p)).FnUsed { + return int64(0) + } + return Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer((*PrintfArguments)(unsafe.Pointer(p)).FapArg + uintptr(libc.PostIncInt32(&(*PrintfArguments)(unsafe.Pointer(p)).FnUsed, 1))*8))) +} + +func getDoubleArg(tls *libc.TLS, p uintptr) float64 { /* sqlite3.c:28777:15: */ + if (*PrintfArguments)(unsafe.Pointer(p)).FnArg <= (*PrintfArguments)(unsafe.Pointer(p)).FnUsed { + return 0.0 + } + return Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer((*PrintfArguments)(unsafe.Pointer(p)).FapArg + uintptr(libc.PostIncInt32(&(*PrintfArguments)(unsafe.Pointer(p)).FnUsed, 1))*8))) +} + +func getTextArg(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:28781:13: */ + if (*PrintfArguments)(unsafe.Pointer(p)).FnArg <= (*PrintfArguments)(unsafe.Pointer(p)).FnUsed { + return uintptr(0) + } + return Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer((*PrintfArguments)(unsafe.Pointer(p)).FapArg + uintptr(libc.PostIncInt32(&(*PrintfArguments)(unsafe.Pointer(p)).FnUsed, 1))*8))) +} + +// Allocate memory for a temporary buffer needed for printf rendering. +// +// If the requested size of the temp buffer is larger than the size +// of the output buffer in pAccum, then cause an SQLITE_TOOBIG error. +// Do the size check before the memory allocation to prevent rogue +// SQL from requesting large allocations using the precision or width +// field of the printf() function. +func printfTempBuf(tls *libc.TLS, pAccum uintptr, n Sqlite3_int64) uintptr { /* sqlite3.c:28795:13: */ + var z uintptr + if (*Sqlite3_str)(unsafe.Pointer(pAccum)).FaccError != 0 { + return uintptr(0) + } + if (n > Sqlite3_int64((*Sqlite3_str)(unsafe.Pointer(pAccum)).FnAlloc)) && (n > Sqlite3_int64((*Sqlite3_str)(unsafe.Pointer(pAccum)).FmxAlloc)) { + setStrAccumError(tls, pAccum, uint8(SQLITE_TOOBIG)) + return uintptr(0) + } + z = Xsqlite3DbMallocRaw(tls, (*Sqlite3_str)(unsafe.Pointer(pAccum)).Fdb, uint64(n)) + if z == uintptr(0) { + setStrAccumError(tls, pAccum, uint8(SQLITE_NOMEM)) + } + return z +} + +// On machines with a small stack size, you can redefine the +// SQLITE_PRINT_BUF_SIZE to be something smaller, if desired. + +// Hard limit on the precision of floating-point conversions. + +// Render a string given by "fmt" into the StrAccum object. +func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Va_list) { /* sqlite3.c:28828:17: */ + bp := tls.Alloc(108) + defer tls.Free(108) + + var c int32 // Next character in the format string + var bufpt uintptr // Pointer to the conversion buffer + var precision int32 // Precision of the current field + var length int32 // Length of the field + var idx int32 // A general purpose loop counter + var width int32 // Width of the current field + var flag_leftjustify EtByte // True if "-" flag is present + var flag_prefix EtByte // '+' or ' ' or 0 for prefix + var flag_alternateform EtByte // True if "#" flag is present + var flag_altform2 EtByte // True if "!" flag is present + var flag_zeropad EtByte // True if field width constant starts with zero + var flag_long EtByte // 1 for the "l" flag, 2 for "ll", 0 by default + var done EtByte // Loop termination flag + var cThousand EtByte // Thousands separator for %d and %u + var xtype EtByte // Conversion paradigm + var bArgList U8 // True for SQLITE_PRINTF_SQLFUNC + var prefix int8 // Prefix character. "+" or "-" or " " or '\0'. + var longvalue Sqlite_uint64 // Value for integer types + // var realvalue float64 at bp+96, 8 + // Value for real types + var infop uintptr // Pointer to the appropriate info structure + var zOut uintptr // Rendering buffer + var nOut int32 // Size of the rendering buffer + var zExtra uintptr // Malloced memory used by some conversion + var exp int32 + var e2 int32 // exponent of real numbers + // var nsd int32 at bp+104, 4 + // Number of significant digits returned + var rounder float64 // Used for rounding floating point values + var flag_dp EtByte // True if decimal point should be shown + var flag_rtz EtByte // True if trailing zeros should be removed + var pArgList uintptr // Arguments for SQLITE_PRINTF_SQLFUNC + // var buf [70]int8 at bp+8, 70 + + var wx uint32 + var px uint32 + var v I64 + var n U64 + var x int32 + var cset uintptr + var base U8 + var nn int32 // Number of "," to insert + var ix int32 // Add "0" or "0x" + var pre uintptr + var x1 int8 + // var rx float64 at bp+88, 8 + + // var u Sqlite3_uint64 at bp+80, 8 + + var ex int32 + var scale float64 + var szBufNeeded I64 + var i int32 + var nPad int32 + var ch uint32 + // Set length to the number of bytes needed in order to display + // precision characters + var z uintptr + // Adjust width to account for extra bytes in UTF-8 characters + var ii int32 // %w: Escape " characters + var i1 int32 + var j int32 + var k int32 + var n1 int32 + var isnull int32 + var needQuote int32 + var ch1 int8 + var q int8 // Quote character + var escarg uintptr + var pToken uintptr + var pItem uintptr + xtype = EtByte(EtINVALID) + zExtra = uintptr(0) + pArgList = uintptr(0) // Conversion buffer + + // pAccum never starts out with an empty buffer that was obtained from + // malloc(). This precondition is required by the mprintf("%z...") + // optimization. + + bufpt = uintptr(0) + if !((int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags) & SQLITE_PRINTF_SQLFUNC) != 0) { + goto __1 + } + pArgList = libc.VaUintptr(&ap) + bArgList = U8(1) + goto __2 +__1: + bArgList = U8(0) +__2: + ; +__3: + if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(fmt))))) != 0) { + goto __5 + } + if !(c != '%') { + goto __6 + } + bufpt = fmt +__7: + fmt++ + goto __8 +__8: + if (*(*int8)(unsafe.Pointer(fmt)) != 0) && (int32(*(*int8)(unsafe.Pointer(fmt))) != '%') { + goto __7 + } + goto __9 +__9: + ; + Xsqlite3_str_append(tls, pAccum, bufpt, (int32((int64(fmt) - int64(bufpt)) / 1))) + if !(int32(*(*int8)(unsafe.Pointer(fmt))) == 0) { + goto __10 + } + goto __5 +__10: + ; +__6: + ; + if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { + goto __11 + } + Xsqlite3_str_append(tls, pAccum, ts+746 /* "%" */, 1) + goto __5 +__11: + ; + // Find out what flags are present + flag_leftjustify = libc.AssignUint8(&flag_prefix, libc.AssignUint8(&cThousand, libc.AssignUint8(&flag_alternateform, libc.AssignUint8(&flag_altform2, libc.AssignUint8(&flag_zeropad, EtByte(0)))))) + done = EtByte(0) + width = 0 + flag_long = EtByte(0) + precision = -1 +__12: + switch c { + case '-': + goto __16 + case '+': + goto __17 + case ' ': + goto __18 + case '#': + goto __19 + case '!': + goto __20 + case '0': + goto __21 + case ',': + goto __22 + default: + goto __23 + case 'l': + goto __24 + case '1': + goto __25 + case '2': + goto __26 + case '3': + goto __27 + case '4': + goto __28 + case '5': + goto __29 + case '6': + goto __30 + case '7': + goto __31 + case '8': + goto __32 + case '9': + goto __33 + case '*': + goto __34 + case '.': + goto __35 + } + goto __15 +__16: + flag_leftjustify = EtByte(1) + goto __15 +__17: + flag_prefix = EtByte('+') + goto __15 +__18: + flag_prefix = EtByte(' ') + goto __15 +__19: + flag_alternateform = EtByte(1) + goto __15 +__20: + flag_altform2 = EtByte(1) + goto __15 +__21: + flag_zeropad = EtByte(1) + goto __15 +__22: + cThousand = EtByte(',') + goto __15 +__23: + done = EtByte(1) + goto __15 +__24: + flag_long = EtByte(1) + c = int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))) + if !(c == 'l') { + goto __36 + } + c = int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))) + flag_long = EtByte(2) +__36: + ; + done = EtByte(1) + goto __15 + +__25: +__26: +__27: +__28: +__29: +__30: +__31: +__32: +__33: + wx = (uint32(c - '0')) +__37: + if !(((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) >= '0') && (c <= '9')) { + goto __38 + } + wx = (((wx * uint32(10)) + uint32(c)) - uint32('0')) + goto __37 +__38: + ; + + width = (int32(wx & uint32(0x7fffffff))) + if !((c != '.') && (c != 'l')) { + goto __39 + } + done = EtByte(1) + goto __40 +__39: + fmt-- +__40: + ; + goto __15 + +__34: + if !(bArgList != 0) { + goto __41 + } + width = int32(getIntArg(tls, pArgList)) + goto __42 +__41: + width = int32(libc.VaInt32(&ap)) +__42: + ; + if !(width < 0) { + goto __43 + } + flag_leftjustify = EtByte(1) + if width >= -2147483647 { + width = -width + } else { + width = 0 + } +__43: + ; + if !(((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(fmt + 1))))) != '.') && (c != 'l')) { + goto __44 + } + c = int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))) + done = EtByte(1) +__44: + ; + goto __15 + +__35: + c = int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))) + if !(c == '*') { + goto __45 + } + if !(bArgList != 0) { + goto __47 + } + precision = int32(getIntArg(tls, pArgList)) + goto __48 +__47: + precision = int32(libc.VaInt32(&ap)) +__48: + ; + if !(precision < 0) { + goto __49 + } + if precision >= -2147483647 { + precision = -precision + } else { + precision = -1 + } +__49: + ; + c = int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))) + goto __46 +__45: + px = uint32(0) +__50: + if !((c >= '0') && (c <= '9')) { + goto __51 + } + px = (((px * uint32(10)) + uint32(c)) - uint32('0')) + c = int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))) + goto __50 +__51: + ; + + precision = (int32(px & uint32(0x7fffffff))) +__46: + ; + if !(c == 'l') { + goto __52 + } + fmt-- + goto __53 +__52: + done = EtByte(1) +__53: + ; + goto __15 + +__15: + ; + goto __13 +__13: + if !(done != 0) && ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) != 0) { + goto __12 + } + goto __14 +__14: + ; + + // Fetch the info entry for the field + infop = (uintptr(unsafe.Pointer(&fmtinfo))) + xtype = EtByte(EtINVALID) + idx = 0 +__54: + if !(idx < (int32(uint64(unsafe.Sizeof(fmtinfo)) / uint64(unsafe.Sizeof(Et_info{}))))) { + goto __56 + } + if !(c == int32(fmtinfo[idx].Ffmttype)) { + goto __57 + } + infop = (uintptr(unsafe.Pointer(&fmtinfo)) + uintptr(idx)*6) + xtype = (*Et_info)(unsafe.Pointer(infop)).Ftype + goto __56 +__57: + ; + goto __55 +__55: + idx++ + goto __54 + goto __56 +__56: + ; + + // At this point, variables are initialized as follows: + // + // flag_alternateform TRUE if a '#' is present. + // flag_altform2 TRUE if a '!' is present. + // flag_prefix '+' or ' ' or zero + // flag_leftjustify TRUE if a '-' is present or if the + // field width was negative. + // flag_zeropad TRUE if the width began with 0. + // flag_long 1 for "l", 2 for "ll" + // width The specified field width. This is + // always non-negative. Zero is the default. + // precision The specified precision. The default + // is -1. + // xtype The class of the conversion. + // infop Pointer to the appropriate info struct. + + switch int32(xtype) { + case EtPOINTER: + goto __59 + case EtORDINAL: + goto __60 + case EtRADIX: + goto __61 + case EtDECIMAL: + goto __62 + case EtFLOAT: + goto __63 + case EtEXP: + goto __64 + case EtGENERIC: + goto __65 + case EtSIZE: + goto __66 + case EtPERCENT: + goto __67 + case EtCHARX: + goto __68 + case EtSTRING: + goto __69 + case EtDYNSTRING: + goto __70 + case EtSQLESCAPE: + goto __71 // %q: Escape ' characters + case EtSQLESCAPE2: + goto __72 // %Q: Escape ' and enclose in '...' + case EtSQLESCAPE3: + goto __73 + case EtTOKEN: + goto __74 + case EtSRCITEM: + goto __75 + default: + goto __76 + } + goto __58 +__59: + if uint64(unsafe.Sizeof(uintptr(0))) == uint64(unsafe.Sizeof(I64(0))) { + flag_long = uint8(2) + } else { + if uint64(unsafe.Sizeof(uintptr(0))) == uint64(unsafe.Sizeof(int64(0))) { + flag_long = uint8(1) + } else { + flag_long = uint8(0) + } + } +__60: +__61: + cThousand = EtByte(0) +__62: + if !((int32((*Et_info)(unsafe.Pointer(infop)).Fflags) & FLAG_SIGNED) != 0) { + goto __77 + } + if !(bArgList != 0) { + goto __79 + } + v = getIntArg(tls, pArgList) + goto __80 +__79: + if !(flag_long != 0) { + goto __81 + } + if !(int32(flag_long) == 2) { + goto __83 + } + v = I64(libc.VaInt64(&ap)) + goto __84 +__83: + v = I64(libc.VaInt64(&ap)) +__84: + ; + goto __82 +__81: + v = I64(libc.VaInt32(&ap)) +__82: + ; +__80: + ; + if !(v < int64(0)) { + goto __85 + } + + longvalue = Sqlite_uint64(^v) + longvalue++ + prefix = int8('-') + goto __86 +__85: + longvalue = Sqlite_uint64(v) + prefix = int8(flag_prefix) +__86: + ; + goto __78 +__77: + if !(bArgList != 0) { + goto __87 + } + longvalue = U64(getIntArg(tls, pArgList)) + goto __88 +__87: + if !(flag_long != 0) { + goto __89 + } + if !(int32(flag_long) == 2) { + goto __91 + } + longvalue = Sqlite_uint64(libc.VaUint64(&ap)) + goto __92 +__91: + longvalue = Sqlite_uint64(libc.VaUint64(&ap)) +__92: + ; + goto __90 +__89: + longvalue = Sqlite_uint64(libc.VaUint32(&ap)) +__90: + ; +__88: + ; + prefix = int8(0) +__78: + ; + if !(longvalue == uint64(0)) { + goto __93 + } + flag_alternateform = EtByte(0) +__93: + ; + if !((flag_zeropad != 0) && (precision < (width - (libc.Bool32(int32(prefix) != 0))))) { + goto __94 + } + precision = (width - (libc.Bool32(int32(prefix) != 0))) +__94: + ; + if !(precision < ((SQLITE_PRINT_BUF_SIZE - 10) - (SQLITE_PRINT_BUF_SIZE / 3))) { + goto __95 + } + nOut = SQLITE_PRINT_BUF_SIZE + zOut = bp + 8 /* &buf[0] */ + goto __96 +__95: + n = (U64(precision) + uint64(10)) + if !(cThousand != 0) { + goto __97 + } + n = n + (U64(precision / 3)) +__97: + ; + zOut = libc.AssignUintptr(&zExtra, printfTempBuf(tls, pAccum, int64(n))) + if !(zOut == uintptr(0)) { + goto __98 + } + return +__98: + ; + nOut = int32(n) +__96: + ; + bufpt = (zOut + uintptr((nOut - 1))) + if !(int32(xtype) == EtORDINAL) { + goto __99 + } + x = (int32(longvalue % uint64(10))) + if !((x >= 4) || (((longvalue / uint64(10)) % uint64(10)) == uint64(1))) { + goto __100 + } + x = 0 +__100: + ; + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = zOrd[((x * 2) + 1)] + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = zOrd[(x * 2)] +__99: + ; + + cset = (uintptr(unsafe.Pointer(&aDigits)) + uintptr((*Et_info)(unsafe.Pointer(infop)).Fcharset)) + base = (*Et_info)(unsafe.Pointer(infop)).Fbase +__101: // Convert to ascii + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = *(*int8)(unsafe.Pointer(cset + uintptr((longvalue % Sqlite_uint64(base))))) + longvalue = (longvalue / Sqlite_uint64(base)) + goto __102 +__102: + if longvalue > uint64(0) { + goto __101 + } + goto __103 +__103: + ; + + length = (int32((int64((zOut + uintptr((nOut - 1)))) - int64(bufpt)) / 1)) +__104: + if !(precision > length) { + goto __105 + } + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = int8('0') // Zero pad + length++ + goto __104 +__105: + ; + if !(cThousand != 0) { + goto __106 + } + nn = ((length - 1) / 3) // Number of "," to insert + ix = (((length - 1) % 3) + 1) + bufpt -= uintptr(nn) + idx = 0 +__107: + if !(nn > 0) { + goto __109 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(idx))) = *(*int8)(unsafe.Pointer(bufpt + uintptr((idx + nn)))) + ix-- + if !(ix == 0) { + goto __110 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PreIncInt32(&idx, 1)))) = int8(cThousand) + nn-- + ix = 3 +__110: + ; + goto __108 +__108: + idx++ + goto __107 + goto __109 +__109: + ; +__106: + ; + if !(prefix != 0) { + goto __111 + } + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = prefix +__111: + ; // Add sign + if !((flag_alternateform != 0) && ((*Et_info)(unsafe.Pointer(infop)).Fprefix != 0)) { + goto __112 + } + pre = (uintptr(unsafe.Pointer(&aPrefix)) + uintptr((*Et_info)(unsafe.Pointer(infop)).Fprefix)) +__113: + if !((int32(libc.AssignInt8(&x1, *(*int8)(unsafe.Pointer(pre))))) != 0) { + goto __115 + } + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = x1 + goto __114 +__114: + pre++ + goto __113 + goto __115 +__115: + ; +__112: + ; + length = (int32((int64((zOut + uintptr((nOut - 1)))) - int64(bufpt)) / 1)) + goto __58 +__63: +__64: +__65: + if !(bArgList != 0) { + goto __116 + } + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) = getDoubleArg(tls, pArgList) + goto __117 +__116: + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) = float64(libc.VaFloat64(&ap)) +__117: + ; + if !(precision < 0) { + goto __118 + } + precision = 6 +__118: + ; // Set default precision + if !(precision > SQLITE_FP_PRECISION_LIMIT) { + goto __119 + } + precision = SQLITE_FP_PRECISION_LIMIT +__119: + ; + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) < 0.0) { + goto __120 + } + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) = -*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) + prefix = int8('-') + goto __121 +__120: + prefix = int8(flag_prefix) +__121: + ; + if !((int32(xtype) == EtGENERIC) && (precision > 0)) { + goto __122 + } + precision-- +__122: + ; + + idx = (precision & 0xfff) + rounder = arRound[(idx % 10)] +__123: + if !(idx >= 10) { + goto __124 + } + rounder = rounder * (1.0e-10) + idx = idx - (10) + goto __123 +__124: + ; + if !(int32(xtype) == EtFLOAT) { + goto __125 + } + *(*float64)(unsafe.Pointer(bp + 88 /* rx */)) = *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) + libc.Xmemcpy(tls, bp+80 /* &u */, bp+88 /* &rx */, uint64(unsafe.Sizeof(Sqlite3_uint64(0)))) + ex = (-1023 + (int32((*(*Sqlite3_uint64)(unsafe.Pointer(bp + 80 /* u */)) >> 52) & uint64(0x7ff)))) + if !((precision + (ex / 3)) < 15) { + goto __126 + } + rounder = rounder + (*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) * 3e-16) +__126: + ; + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) += rounder +__125: + ; + // Normalize realvalue to within 10.0 > realvalue >= 1.0 + exp = 0 + if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { + goto __127 + } + bufpt = ts + 748 /* "NaN" */ + length = 3 + goto __58 +__127: + ; + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) > 0.0) { + goto __128 + } + scale = 1.0 +__129: + if !((*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= (1e100 * scale)) && (exp <= 350)) { + goto __130 + } + scale = scale * (1e100) + exp = exp + (100) + goto __129 +__130: + ; +__131: + if !((*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= (1e10 * scale)) && (exp <= 350)) { + goto __132 + } + scale = scale * (1e10) + exp = exp + (10) + goto __131 +__132: + ; +__133: + if !((*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= (10.0 * scale)) && (exp <= 350)) { + goto __134 + } + scale = scale * (10.0) + exp++ + goto __133 +__134: + ; + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) /= scale +__135: + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) < 1e-8) { + goto __136 + } + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) *= 1e8 + exp = exp - (8) + goto __135 +__136: + ; +__137: + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) < 1.0) { + goto __138 + } + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) *= 10.0 + exp-- + goto __137 +__138: + ; + if !(exp > 350) { + goto __139 + } + bufpt = bp + 8 /* &buf[0] */ + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix + libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+752 /* "Inf" */, uint64(4)) + length = (3 + (libc.Bool32(int32(prefix) != 0))) + goto __58 +__139: + ; +__128: + ; + bufpt = bp + 8 /* &buf[0] */ + // If the field type is etGENERIC, then convert to either etEXP + // or etFLOAT, as appropriate. + if !(int32(xtype) != EtFLOAT) { + goto __140 + } + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) += rounder + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= 10.0) { + goto __141 + } + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) *= 0.1 + exp++ +__141: + ; +__140: + ; + if !(int32(xtype) == EtGENERIC) { + goto __142 + } + flag_rtz = libc.BoolUint8(!(flag_alternateform != 0)) + if !((exp < -4) || (exp > precision)) { + goto __144 + } + xtype = EtByte(EtEXP) + goto __145 +__144: + precision = (precision - exp) + xtype = EtByte(EtFLOAT) +__145: + ; + goto __143 +__142: + flag_rtz = flag_altform2 +__143: + ; + if !(int32(xtype) == EtEXP) { + goto __146 + } + e2 = 0 + goto __147 +__146: + e2 = exp +__147: + ; + // Size of a temporary buffer needed + szBufNeeded = ((((func() int64 { + if (e2) > (0) { + return int64(e2) + } + return int64(0) + }()) + I64(precision)) + I64(width)) + int64(15)) + if !(szBufNeeded > int64(SQLITE_PRINT_BUF_SIZE)) { + goto __148 + } + bufpt = libc.AssignUintptr(&zExtra, printfTempBuf(tls, pAccum, szBufNeeded)) + if !(bufpt == uintptr(0)) { + goto __149 + } + return +__149: + ; +__148: + ; + + zOut = bufpt + *(*int32)(unsafe.Pointer(bp + 104 /* nsd */)) = (16 + (int32(flag_altform2) * 10)) + flag_dp = (EtByte(((func() int32 { + if precision > 0 { + return 1 + } + return 0 + }()) | int32(flag_alternateform)) | int32(flag_altform2))) + // The sign in front of the number + if !(prefix != 0) { + goto __150 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = prefix +__150: + ; + // Digits prior to the decimal point + if !(e2 < 0) { + goto __151 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = int8('0') + goto __152 +__151: + ; +__153: + if !(e2 >= 0) { + goto __155 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = et_getdigit(tls, bp+96 /* &realvalue */, bp+104 /* &nsd */) + goto __154 +__154: + e2-- + goto __153 + goto __155 +__155: + ; +__152: + ; + // The decimal point + if !(flag_dp != 0) { + goto __156 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = int8('.') +__156: + ; + // "0" digits after the decimal point but before the first + // significant digit of the number + e2++ +__157: + if !(e2 < 0) { + goto __159 + } + + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = int8('0') + goto __158 +__158: + precision-- + e2++ + goto __157 + goto __159 +__159: + ; + // Significant digits after the decimal point +__160: + if !((libc.PostDecInt32(&precision, 1)) > 0) { + goto __161 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = et_getdigit(tls, bp+96 /* &realvalue */, bp+104 /* &nsd */) + goto __160 +__161: + ; + // Remove trailing zeros and the "." if no digits follow the "." + if !((flag_rtz != 0) && (flag_dp != 0)) { + goto __162 + } +__163: + if !(int32(*(*int8)(unsafe.Pointer(bufpt + libc.UintptrFromInt32(-1)))) == '0') { + goto __164 + } + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = int8(0) + goto __163 +__164: + ; + + if !(int32(*(*int8)(unsafe.Pointer(bufpt + libc.UintptrFromInt32(-1)))) == '.') { + goto __165 + } + if !(flag_altform2 != 0) { + goto __166 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = int8('0') + goto __167 +__166: + *(*int8)(unsafe.Pointer(libc.PreDecUintptr(&bufpt, 1))) = int8(0) +__167: + ; +__165: + ; +__162: + ; + // Add the "eNNN" suffix + if !(int32(xtype) == EtEXP) { + goto __168 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = aDigits[(*Et_info)(unsafe.Pointer(infop)).Fcharset] + if !(exp < 0) { + goto __169 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = int8('-') + exp = -exp + goto __170 +__169: + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = int8('+') +__170: + ; + if !(exp >= 100) { + goto __171 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = (int8((exp / 100) + '0')) // 100's digit + exp = exp % (100) +__171: + ; + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = (int8((exp / 10) + '0')) // 10's digit + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = (int8((exp % 10) + '0')) // 1's digit +__168: + ; + *(*int8)(unsafe.Pointer(bufpt)) = int8(0) + + // The converted number is in buf[] and zero terminated. Output it. + // Note that the number is in the usual order, not reversed as with + // integer conversions. + length = (int32((int64(bufpt) - int64(zOut)) / 1)) + bufpt = zOut + + // Special case: Add leading zeros if the flag_zeropad flag is + // set and we are not left justified + if !(((flag_zeropad != 0) && !(flag_leftjustify != 0)) && (length < width)) { + goto __172 + } + nPad = (width - length) + i = width +__173: + if !(i >= nPad) { + goto __175 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(i))) = *(*int8)(unsafe.Pointer(bufpt + uintptr((i - nPad)))) + goto __174 +__174: + i-- + goto __173 + goto __175 +__175: + ; + i = (libc.Bool32(int32(prefix) != 0)) +__176: + if !(libc.PostDecInt32(&nPad, 1) != 0) { + goto __177 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PostIncInt32(&i, 1)))) = int8('0') + goto __176 +__177: + ; + length = width +__172: + ; + goto __58 +__66: + if !(!(bArgList != 0)) { + goto __178 + } + *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FnChar) +__178: + ; + length = libc.AssignInt32(&width, 0) + goto __58 +__67: + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = int8('%') + bufpt = bp + 8 /* &buf[0] */ + length = 1 + goto __58 +__68: + if !(bArgList != 0) { + goto __179 + } + bufpt = getTextArg(tls, pArgList) + length = 1 + if !(bufpt != 0) { + goto __181 + } + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = int8(libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1)))))) + if !((c & 0xc0) == 0xc0) { + goto __183 + } +__184: + if !((length < 4) && ((int32(*(*int8)(unsafe.Pointer(bufpt))) & 0xc0) == 0x80)) { + goto __185 + } + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + uintptr(libc.PostIncInt32(&length, 1)))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) + goto __184 +__185: + ; +__183: + ; + goto __182 +__181: + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = int8(0) +__182: + ; + goto __180 +__179: + ch = uint32(libc.VaUint32(&ap)) + if !(ch < uint32(0x00080)) { + goto __186 + } + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(ch & uint32(0xff))) + length = 1 + goto __187 +__186: + if !(ch < uint32(0x00800)) { + goto __188 + } + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(0xc0 + int32((U8((ch >> 6) & uint32(0x1f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) + length = 2 + goto __189 +__188: + if !(ch < uint32(0x10000)) { + goto __190 + } + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(0xe0 + int32((U8((ch >> 12) & uint32(0x0f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8((ch >> 6) & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 2)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) + length = 3 + goto __191 +__190: + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(0xf0 + int32((U8((ch >> 18) & uint32(0x07)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8((ch >> 12) & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 2)) = (int8(0x80 + int32((U8((ch >> 6) & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 3)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) + length = 4 +__191: + ; +__189: + ; +__187: + ; +__180: + ; + if !(precision > 1) { + goto __192 + } + width = width - (precision - 1) + if !((width > 1) && !(flag_leftjustify != 0)) { + goto __193 + } + Xsqlite3_str_appendchar(tls, pAccum, (width - 1), int8(' ')) + width = 0 +__193: + ; +__194: + if !(libc.PostDecInt32(&precision, 1) > 1) { + goto __195 + } + Xsqlite3_str_append(tls, pAccum, bp+8 /* &buf[0] */, length) + goto __194 +__195: + ; +__192: + ; + bufpt = bp + 8 /* &buf[0] */ + flag_altform2 = EtByte(1) + goto adjust_width_for_utf8 +__69: +__70: + if !(bArgList != 0) { + goto __196 + } + bufpt = getTextArg(tls, pArgList) + xtype = EtByte(EtSTRING) + goto __197 +__196: + bufpt = libc.VaUintptr(&ap) +__197: + ; + if !(bufpt == uintptr(0)) { + goto __198 + } + bufpt = ts + 756 /* "" */ + goto __199 +__198: + if !(int32(xtype) == EtDYNSTRING) { + goto __200 + } + if !((((((*Sqlite3_str)(unsafe.Pointer(pAccum)).FnChar == U32(0)) && + ((*Sqlite3_str)(unsafe.Pointer(pAccum)).FmxAlloc != 0)) && + (width == 0)) && + (precision < 0)) && + (int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FaccError) == 0)) { + goto __201 + } + // Special optimization for sqlite3_mprintf("%z..."): + // Extend an existing memory allocation rather than creating + // a new one. + + (*Sqlite3_str)(unsafe.Pointer(pAccum)).FzText = bufpt + (*Sqlite3_str)(unsafe.Pointer(pAccum)).FnAlloc = U32(Xsqlite3DbMallocSize(tls, (*Sqlite3_str)(unsafe.Pointer(pAccum)).Fdb, bufpt)) + (*Sqlite3_str)(unsafe.Pointer(pAccum)).FnChar = (U32(0x7fffffff & int32(libc.Xstrlen(tls, bufpt)))) + *(*U8)(unsafe.Pointer(pAccum + 29 /* &.printfFlags */)) |= U8((SQLITE_PRINTF_MALLOCED)) + length = 0 + goto __58 +__201: + ; + zExtra = bufpt +__200: + ; +__199: + ; + if !(precision >= 0) { + goto __202 + } + if !(flag_altform2 != 0) { + goto __204 + } + // Set length to the number of bytes needed in order to display + // precision characters + z = bufpt +__206: + if !((libc.PostDecInt32(&precision, 1) > 0) && (*(*uint8)(unsafe.Pointer(z)) != 0)) { + goto __207 + } + if !((int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0) { + goto __208 + } +__209: + if !((int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80) { + goto __210 + } + z++ + goto __209 +__210: + ; +__208: + ; + + goto __206 +__207: + ; + length = (int32((int64(z) - int64(bufpt)) / 1)) + goto __205 +__204: + length = 0 +__211: + if !((length < precision) && (*(*int8)(unsafe.Pointer(bufpt + uintptr(length))) != 0)) { + goto __213 + } + goto __212 +__212: + length++ + goto __211 + goto __213 +__213: + ; +__205: + ; + goto __203 +__202: + length = (0x7fffffff & int32(libc.Xstrlen(tls, bufpt))) +__203: + ; +adjust_width_for_utf8: + if !((flag_altform2 != 0) && (width > 0)) { + goto __214 + } + // Adjust width to account for extra bytes in UTF-8 characters + ii = (length - 1) +__215: + if !(ii >= 0) { + goto __216 + } + if !((int32(*(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PostDecInt32(&ii, 1))))) & 0xc0) == 0x80) { + goto __217 + } + width++ +__217: + ; + goto __215 +__216: + ; +__214: + ; + goto __58 +__71: // %q: Escape ' characters +__72: // %Q: Escape ' and enclose in '...' +__73: + q = func() int8 { + if int32(xtype) == EtSQLESCAPE3 { + return int8('"') + } + return int8('\'') + }() + + if !(bArgList != 0) { + goto __218 + } + escarg = getTextArg(tls, pArgList) + goto __219 +__218: + escarg = libc.VaUintptr(&ap) +__219: + ; + isnull = (libc.Bool32(escarg == uintptr(0))) + if !(isnull != 0) { + goto __220 + } + escarg = func() uintptr { + if int32(xtype) == EtSQLESCAPE2 { + return ts + 757 /* "NULL" */ + } + return ts + 762 /* "(NULL)" */ + }() +__220: + ; + // For %q, %Q, and %w, the precision is the number of bytes (or + // characters if the ! flags is present) to use from the input. + // Because of the extra quoting characters inserted, the number + // of output characters may be larger than the precision. + k = precision + i1 = libc.AssignInt32(&n1, 0) +__221: + if !((k != 0) && ((int32(libc.AssignInt8(&ch1, *(*int8)(unsafe.Pointer(escarg + uintptr(i1)))))) != 0)) { + goto __223 + } + if !(int32(ch1) == int32(q)) { + goto __224 + } + n1++ +__224: + ; + if !((flag_altform2 != 0) && ((int32(ch1) & 0xc0) == 0xc0)) { + goto __225 + } +__226: + if !((int32(*(*int8)(unsafe.Pointer(escarg + uintptr((i1 + 1))))) & 0xc0) == 0x80) { + goto __227 + } + i1++ + goto __226 +__227: + ; +__225: + ; + goto __222 +__222: + i1++ + k-- + goto __221 + goto __223 +__223: + ; + needQuote = (libc.Bool32(!(isnull != 0) && (int32(xtype) == EtSQLESCAPE2))) + n1 = n1 + (i1 + 3) + if !(n1 > SQLITE_PRINT_BUF_SIZE) { + goto __228 + } + bufpt = libc.AssignUintptr(&zExtra, printfTempBuf(tls, pAccum, int64(n1))) + if !(bufpt == uintptr(0)) { + goto __230 + } + return +__230: + ; + goto __229 +__228: + bufpt = bp + 8 /* &buf[0] */ +__229: + ; + j = 0 + if !(needQuote != 0) { + goto __231 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PostIncInt32(&j, 1)))) = q +__231: + ; + k = i1 + i1 = 0 +__232: + if !(i1 < k) { + goto __234 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PostIncInt32(&j, 1)))) = libc.AssignInt8(&ch1, *(*int8)(unsafe.Pointer(escarg + uintptr(i1)))) + if !(int32(ch1) == int32(q)) { + goto __235 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PostIncInt32(&j, 1)))) = ch1 +__235: + ; + goto __233 +__233: + i1++ + goto __232 + goto __234 +__234: + ; + if !(needQuote != 0) { + goto __236 + } + *(*int8)(unsafe.Pointer(bufpt + uintptr(libc.PostIncInt32(&j, 1)))) = q +__236: + ; + *(*int8)(unsafe.Pointer(bufpt + uintptr(j))) = int8(0) + length = j + goto adjust_width_for_utf8 + +__74: + if !((int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags) & SQLITE_PRINTF_INTERNAL) == 0) { + goto __237 + } + return +__237: + ; + pToken = libc.VaUintptr(&ap) + + if !((pToken != 0) && ((*Token)(unsafe.Pointer(pToken)).Fn != 0)) { + goto __238 + } + Xsqlite3_str_append(tls, pAccum, (*Token)(unsafe.Pointer(pToken)).Fz, int32((*Token)(unsafe.Pointer(pToken)).Fn)) +__238: + ; + length = libc.AssignInt32(&width, 0) + goto __58 + +__75: + if !((int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FprintfFlags) & SQLITE_PRINTF_INTERNAL) == 0) { + goto __239 + } + return +__239: + ; + pItem = libc.VaUintptr(&ap) + + if !(((*SrcItem)(unsafe.Pointer(pItem)).FzAlias != 0) && !(flag_altform2 != 0)) { + goto __240 + } + Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzAlias) + goto __241 +__240: + if !((*SrcItem)(unsafe.Pointer(pItem)).FzName != 0) { + goto __242 + } + if !((*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0) { + goto __244 + } + Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) + Xsqlite3_str_append(tls, pAccum, ts+769 /* "." */, 1) +__244: + ; + Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) + goto __243 +__242: + if !((*SrcItem)(unsafe.Pointer(pItem)).FzAlias != 0) { + goto __245 + } + Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzAlias) + goto __246 +__245: + if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { + goto __247 + } + Xsqlite3_str_appendf(tls, pAccum, ts+771 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) +__247: + ; +__246: + ; +__243: + ; +__241: + ; + length = libc.AssignInt32(&width, 0) + goto __58 + +__76: + ; + return + +__58: + ; // End switch over the format type + // The text of the conversion is pointed to by "bufpt" and is + // "length" characters long. The field width is "width". Do + // the output. Both length and width are in bytes, not characters, + // at this point. If the "!" flag was present on string conversions + // indicating that width and precision should be expressed in characters, + // then the values have been translated prior to reaching this point. + width = width - (length) + if !(width > 0) { + goto __248 + } + if !(!(flag_leftjustify != 0)) { + goto __250 + } + Xsqlite3_str_appendchar(tls, pAccum, width, int8(' ')) +__250: + ; + Xsqlite3_str_append(tls, pAccum, bufpt, length) + if !(flag_leftjustify != 0) { + goto __251 + } + Xsqlite3_str_appendchar(tls, pAccum, width, int8(' ')) +__251: + ; + goto __249 +__248: + Xsqlite3_str_append(tls, pAccum, bufpt, length) +__249: + ; + + if !(zExtra != 0) { + goto __252 + } + Xsqlite3DbFree(tls, (*Sqlite3_str)(unsafe.Pointer(pAccum)).Fdb, zExtra) + zExtra = uintptr(0) +__252: + ; + goto __4 +__4: + fmt++ + goto __3 + goto __5 +__5: + // End for loop over the format string +} + +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 783 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ + +// End of function + +// Enlarge the memory allocation on a StrAccum object so that it is +// able to accept at least N more bytes of text. +// +// Return the number of bytes of text that StrAccum is able to accept +// after the attempted enlargement. The value returned might be zero. +func sqlite3StrAccumEnlarge(tls *libc.TLS, p uintptr, N int32) int32 { /* sqlite3.c:29534:12: */ + var zNew uintptr + // Only called if really needed + if (*StrAccum)(unsafe.Pointer(p)).FaccError != 0 { + + return 0 + } + if (*StrAccum)(unsafe.Pointer(p)).FmxAlloc == U32(0) { + setStrAccumError(tls, p, uint8(SQLITE_TOOBIG)) + return (int32(((*StrAccum)(unsafe.Pointer(p)).FnAlloc - (*StrAccum)(unsafe.Pointer(p)).FnChar) - U32(1))) + } else { + var zOld uintptr + if (int32((*StrAccum)(unsafe.Pointer((p))).FprintfFlags) & SQLITE_PRINTF_MALLOCED) != 0 { + zOld = (*StrAccum)(unsafe.Pointer(p)).FzText + } else { + zOld = uintptr(0) + } + var szNew I64 = I64((*StrAccum)(unsafe.Pointer(p)).FnChar) + szNew = szNew + (Sqlite3_int64(N) + int64(1)) + if (szNew + I64((*StrAccum)(unsafe.Pointer(p)).FnChar)) <= I64((*StrAccum)(unsafe.Pointer(p)).FmxAlloc) { + // Force exponential buffer size growth as long as it does not overflow, + // to avoid having to call this routine too often + szNew = szNew + (I64((*StrAccum)(unsafe.Pointer(p)).FnChar)) + } + if szNew > I64((*StrAccum)(unsafe.Pointer(p)).FmxAlloc) { + Xsqlite3_str_reset(tls, p) + setStrAccumError(tls, p, uint8(SQLITE_TOOBIG)) + return 0 + } else { + (*StrAccum)(unsafe.Pointer(p)).FnAlloc = U32(int32(szNew)) + } + if (*StrAccum)(unsafe.Pointer(p)).Fdb != 0 { + zNew = Xsqlite3DbRealloc(tls, (*StrAccum)(unsafe.Pointer(p)).Fdb, zOld, uint64((*StrAccum)(unsafe.Pointer(p)).FnAlloc)) + } else { + zNew = Xsqlite3Realloc(tls, zOld, uint64((*StrAccum)(unsafe.Pointer(p)).FnAlloc)) + } + if zNew != 0 { + + if !((int32((*StrAccum)(unsafe.Pointer((p))).FprintfFlags) & SQLITE_PRINTF_MALLOCED) != 0) && ((*StrAccum)(unsafe.Pointer(p)).FnChar > U32(0)) { + libc.Xmemcpy(tls, zNew, (*StrAccum)(unsafe.Pointer(p)).FzText, uint64((*StrAccum)(unsafe.Pointer(p)).FnChar)) + } + (*StrAccum)(unsafe.Pointer(p)).FzText = zNew + (*StrAccum)(unsafe.Pointer(p)).FnAlloc = U32(Xsqlite3DbMallocSize(tls, (*StrAccum)(unsafe.Pointer(p)).Fdb, zNew)) + *(*U8)(unsafe.Pointer(p + 29 /* &.printfFlags */)) |= U8((SQLITE_PRINTF_MALLOCED)) + } else { + Xsqlite3_str_reset(tls, p) + setStrAccumError(tls, p, uint8(SQLITE_NOMEM)) + return 0 + } + } + return N +} + +// Append N copies of character c to the given string buffer. +func Xsqlite3_str_appendchar(tls *libc.TLS, p uintptr, N int32, c int8) { /* sqlite3.c:29584:17: */ + + if ((I64((*Sqlite3_str)(unsafe.Pointer(p)).FnChar) + I64(N)) >= I64((*Sqlite3_str)(unsafe.Pointer(p)).FnAlloc)) && ((libc.AssignInt32(&N, sqlite3StrAccumEnlarge(tls, p, N))) <= 0) { + return + } + for (libc.PostDecInt32(&N, 1)) > 0 { + *(*int8)(unsafe.Pointer((*Sqlite3_str)(unsafe.Pointer(p)).FzText + uintptr(libc.PostIncUint32(&(*Sqlite3_str)(unsafe.Pointer(p)).FnChar, 1)))) = c + } +} + +// The StrAccum "p" is not large enough to accept N new bytes of z[]. +// So enlarge if first, then do the append. +// +// This is a helper routine to sqlite3_str_append() that does special-case +// work (enlarging the buffer) using tail recursion, so that the +// sqlite3_str_append() routine can use fast calling semantics. +func enlargeAndAppend(tls *libc.TLS, p uintptr, z uintptr, N int32) { /* sqlite3.c:29600:29: */ + N = sqlite3StrAccumEnlarge(tls, p, N) + if N > 0 { + libc.Xmemcpy(tls, ((*StrAccum)(unsafe.Pointer(p)).FzText + uintptr((*StrAccum)(unsafe.Pointer(p)).FnChar)), z, uint64(N)) + *(*U32)(unsafe.Pointer(p + 24 /* &.nChar */)) += (U32(N)) + } +} + +// Append N bytes of text from z to the StrAccum object. Increase the +// size of the memory allocation for StrAccum if necessary. +func Xsqlite3_str_append(tls *libc.TLS, p uintptr, z uintptr, N int32) { /* sqlite3.c:29612:17: */ + + if ((*Sqlite3_str)(unsafe.Pointer(p)).FnChar + U32(N)) >= (*Sqlite3_str)(unsafe.Pointer(p)).FnAlloc { + enlargeAndAppend(tls, p, z, N) + } else if N != 0 { + + *(*U32)(unsafe.Pointer(p + 24 /* &.nChar */)) += (U32(N)) + libc.Xmemcpy(tls, ((*Sqlite3_str)(unsafe.Pointer(p)).FzText + uintptr(((*Sqlite3_str)(unsafe.Pointer(p)).FnChar - U32(N)))), z, uint64(N)) + } +} + +// Append the complete text of zero-terminated string z[] to the p string. +func Xsqlite3_str_appendall(tls *libc.TLS, p uintptr, z uintptr) { /* sqlite3.c:29629:17: */ + Xsqlite3_str_append(tls, p, z, Xsqlite3Strlen30(tls, z)) +} + +// Finish off a string by making sure it is zero-terminated. +// Return a pointer to the resulting string. Return a NULL +// pointer if any kind of error was encountered. +func strAccumFinishRealloc(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:29639:29: */ + var zText uintptr + + zText = Xsqlite3DbMallocRaw(tls, (*StrAccum)(unsafe.Pointer(p)).Fdb, (uint64((*StrAccum)(unsafe.Pointer(p)).FnChar + U32(1)))) + if zText != 0 { + libc.Xmemcpy(tls, zText, (*StrAccum)(unsafe.Pointer(p)).FzText, (uint64((*StrAccum)(unsafe.Pointer(p)).FnChar + U32(1)))) + *(*U8)(unsafe.Pointer(p + 29 /* &.printfFlags */)) |= U8((SQLITE_PRINTF_MALLOCED)) + } else { + setStrAccumError(tls, p, uint8(SQLITE_NOMEM)) + } + (*StrAccum)(unsafe.Pointer(p)).FzText = zText + return zText +} + +func Xsqlite3StrAccumFinish(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:29652:21: */ + if (*StrAccum)(unsafe.Pointer(p)).FzText != 0 { + *(*int8)(unsafe.Pointer((*StrAccum)(unsafe.Pointer(p)).FzText + uintptr((*StrAccum)(unsafe.Pointer(p)).FnChar))) = int8(0) + if ((*StrAccum)(unsafe.Pointer(p)).FmxAlloc > U32(0)) && !((int32((*StrAccum)(unsafe.Pointer((p))).FprintfFlags) & SQLITE_PRINTF_MALLOCED) != 0) { + return strAccumFinishRealloc(tls, p) + } + } + return (*StrAccum)(unsafe.Pointer(p)).FzText +} + +// This singleton is an sqlite3_str object that is returned if +// sqlite3_malloc() fails to provide space for a real one. This +// sqlite3_str object accepts no new text and always returns +// an SQLITE_NOMEM error. +var sqlite3OomStr = Sqlite3_str{FaccError: U8(SQLITE_NOMEM)} /* sqlite3.c:29668:20 */ + +// Finalize a string created using sqlite3_str_new(). +func Xsqlite3_str_finish(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:29674:17: */ + var z uintptr + if (p != uintptr(0)) && (p != uintptr(unsafe.Pointer(&sqlite3OomStr))) { + z = Xsqlite3StrAccumFinish(tls, p) + Xsqlite3_free(tls, p) + } else { + z = uintptr(0) + } + return z +} + +// Return any error code associated with p +func Xsqlite3_str_errcode(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:29686:16: */ + if p != 0 { + return int32((*Sqlite3_str)(unsafe.Pointer(p)).FaccError) + } + return SQLITE_NOMEM +} + +// Return the current length of p in bytes +func Xsqlite3_str_length(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:29691:16: */ + if p != 0 { + return int32((*Sqlite3_str)(unsafe.Pointer(p)).FnChar) + } + return 0 +} + +// Return the current value for p +func Xsqlite3_str_value(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:29696:17: */ + if (p == uintptr(0)) || ((*Sqlite3_str)(unsafe.Pointer(p)).FnChar == U32(0)) { + return uintptr(0) + } + *(*int8)(unsafe.Pointer((*Sqlite3_str)(unsafe.Pointer(p)).FzText + uintptr((*Sqlite3_str)(unsafe.Pointer(p)).FnChar))) = int8(0) + return (*Sqlite3_str)(unsafe.Pointer(p)).FzText +} + +// Reset an StrAccum string. Reclaim all malloced memory. +func Xsqlite3_str_reset(tls *libc.TLS, p uintptr) { /* sqlite3.c:29705:17: */ + if (int32((*StrAccum)(unsafe.Pointer((p))).FprintfFlags) & SQLITE_PRINTF_MALLOCED) != 0 { + Xsqlite3DbFree(tls, (*StrAccum)(unsafe.Pointer(p)).Fdb, (*StrAccum)(unsafe.Pointer(p)).FzText) + *(*U8)(unsafe.Pointer(p + 29 /* &.printfFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(SQLITE_PRINTF_MALLOCED))) + } + (*StrAccum)(unsafe.Pointer(p)).FnAlloc = U32(0) + (*StrAccum)(unsafe.Pointer(p)).FnChar = U32(0) + (*StrAccum)(unsafe.Pointer(p)).FzText = uintptr(0) +} + +// Initialize a string accumulator. +// +// p: The accumulator to be initialized. +// db: Pointer to a database connection. May be NULL. Lookaside +// memory is used if not NULL. db->mallocFailed is set appropriately +// when not NULL. +// zBase: An initial buffer. May be NULL in which case the initial buffer +// is malloced. +// n: Size of zBase in bytes. If total space requirements never exceed +// n then no memory allocations ever occur. +// mx: Maximum number of bytes to accumulate. If mx==0 then no memory +// allocations will ever occur. +func Xsqlite3StrAccumInit(tls *libc.TLS, p uintptr, db uintptr, zBase uintptr, n int32, mx int32) { /* sqlite3.c:29729:21: */ + (*StrAccum)(unsafe.Pointer(p)).FzText = zBase + (*StrAccum)(unsafe.Pointer(p)).Fdb = db + (*StrAccum)(unsafe.Pointer(p)).FnAlloc = U32(n) + (*StrAccum)(unsafe.Pointer(p)).FmxAlloc = U32(mx) + (*StrAccum)(unsafe.Pointer(p)).FnChar = U32(0) + (*StrAccum)(unsafe.Pointer(p)).FaccError = U8(0) + (*StrAccum)(unsafe.Pointer(p)).FprintfFlags = U8(0) +} + +// Allocate and initialize a new dynamic string object +func Xsqlite3_str_new(tls *libc.TLS, db uintptr) uintptr { /* sqlite3.c:29740:24: */ + var p uintptr = Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(Sqlite3_str{}))) + if p != 0 { + Xsqlite3StrAccumInit(tls, p, uintptr(0), uintptr(0), 0, + func() int32 { + if db != 0 { + return *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))) + } + return SQLITE_MAX_LENGTH + }()) + } else { + p = uintptr(unsafe.Pointer(&sqlite3OomStr)) + } + return p +} + +// Print into memory obtained from sqliteMalloc(). Use the internal +// %-conversion extensions. +func Xsqlite3VMPrintf(tls *libc.TLS, db uintptr, zFormat uintptr, ap Va_list) uintptr { /* sqlite3.c:29755:21: */ + bp := tls.Alloc(102) + defer tls.Free(102) + + var z uintptr + // var zBase [70]int8 at bp+32, 70 + + // var acc StrAccum at bp, 32 + + Xsqlite3StrAccumInit(tls, bp /* &acc */, db, bp+32 /* &zBase[0] */, int32(unsafe.Sizeof([70]int8{})), + *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) + (*StrAccum)(unsafe.Pointer(bp /* &acc */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) + Xsqlite3_str_vappendf(tls, bp /* &acc */, zFormat, ap) + z = Xsqlite3StrAccumFinish(tls, bp /* &acc */) + if int32((*StrAccum)(unsafe.Pointer(bp /* &acc */)).FaccError) == SQLITE_NOMEM { + Xsqlite3OomFault(tls, db) + } + return z +} + +// Print into memory obtained from sqliteMalloc(). Use the internal +// %-conversion extensions. +func Xsqlite3MPrintf(tls *libc.TLS, db uintptr, zFormat uintptr, va uintptr) uintptr { /* sqlite3.c:29775:21: */ + var ap Va_list + _ = ap + var z uintptr + ap = va + z = Xsqlite3VMPrintf(tls, db, zFormat, ap) + _ = ap + return z +} + +// Print into memory obtained from sqlite3_malloc(). Omit the internal +// %-conversion extensions. +func Xsqlite3_vmprintf(tls *libc.TLS, zFormat uintptr, ap Va_list) uintptr { /* sqlite3.c:29788:17: */ + bp := tls.Alloc(102) + defer tls.Free(102) + + var z uintptr + // var zBase [70]int8 at bp+32, 70 + + // var acc StrAccum at bp, 32 + + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + Xsqlite3StrAccumInit(tls, bp /* &acc */, uintptr(0), bp+32 /* &zBase[0] */, int32(unsafe.Sizeof([70]int8{})), SQLITE_MAX_LENGTH) + Xsqlite3_str_vappendf(tls, bp /* &acc */, zFormat, ap) + z = Xsqlite3StrAccumFinish(tls, bp /* &acc */) + return z +} + +// Print into memory obtained from sqlite3_malloc()(). Omit the internal +// %-conversion extensions. +func Xsqlite3_mprintf(tls *libc.TLS, zFormat uintptr, va uintptr) uintptr { /* sqlite3.c:29812:17: */ + var ap Va_list + _ = ap + var z uintptr + if Xsqlite3_initialize(tls) != 0 { + return uintptr(0) + } + ap = va + z = Xsqlite3_vmprintf(tls, zFormat, ap) + _ = ap + return z +} + +// sqlite3_snprintf() works like snprintf() except that it ignores the +// current locale settings. This is important for SQLite because we +// are not able to use a "," as the decimal point in place of "." as +// specified by some locales. +// +// Oops: The first two arguments of sqlite3_snprintf() are backwards +// from the snprintf() standard. Unfortunately, it is too late to change +// this without breaking compatibility, so we just have to live with the +// mistake. +// +// sqlite3_vsnprintf() is the varargs version. +func Xsqlite3_vsnprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, ap Va_list) uintptr { /* sqlite3.c:29837:17: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var acc StrAccum at bp, 32 + + if n <= 0 { + return zBuf + } + Xsqlite3StrAccumInit(tls, bp /* &acc */, uintptr(0), zBuf, n, 0) + Xsqlite3_str_vappendf(tls, bp /* &acc */, zFormat, ap) + *(*int8)(unsafe.Pointer(zBuf + uintptr((*StrAccum)(unsafe.Pointer(bp /* &acc */)).FnChar))) = int8(0) + return zBuf +} + +func Xsqlite3_snprintf(tls *libc.TLS, n int32, zBuf uintptr, zFormat uintptr, va uintptr) uintptr { /* sqlite3.c:29852:17: */ + var z uintptr + var ap Va_list + _ = ap + ap = va + z = Xsqlite3_vsnprintf(tls, n, zBuf, zFormat, ap) + _ = ap + return z +} + +// This is the routine that actually formats the sqlite3_log() message. +// We house it in a separate routine from sqlite3_log() to avoid using +// stack space on small-stack systems when logging is disabled. +// +// sqlite3_log() must render into a static buffer. It cannot dynamically +// allocate memory because it might be called while the memory allocator +// mutex is held. +// +// sqlite3_str_vappendf() might ask for *temporary* memory allocations for +// certain format characters (%q) or for very large precisions or widths. +// Care must be taken that any sqlite3_log() calls that occur while the +// memory mutex is held do not use these mechanisms. +func renderLogMsg(tls *libc.TLS, iErrCode int32, zFormat uintptr, ap Va_list) { /* sqlite3.c:29875:13: */ + bp := tls.Alloc(242) + defer tls.Free(242) + + // var acc StrAccum at bp, 32 + // String accumulator + // var zMsg [210]int8 at bp+32, 210 + // Complete log message + + Xsqlite3StrAccumInit(tls, bp /* &acc */, uintptr(0), bp+32 /* &zMsg[0] */, int32(unsafe.Sizeof([210]int8{})), 0) + Xsqlite3_str_vappendf(tls, bp /* &acc */, zFormat, ap) + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 376 /* &.xLog */))))(tls, Xsqlite3Config.FpLogArg, iErrCode, + Xsqlite3StrAccumFinish(tls, bp /* &acc */)) +} + +// Format and write a message to the log if logging is enabled. +func Xsqlite3_log(tls *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { /* sqlite3.c:29888:17: */ + var ap Va_list + _ = ap // Vararg list + if Xsqlite3Config.FxLog != 0 { + ap = va + renderLogMsg(tls, iErrCode, zFormat, ap) + _ = ap + } +} + +// variable-argument wrapper around sqlite3_str_vappendf(). The bFlags argument +// can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats. +func Xsqlite3_str_appendf(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:29929:17: */ + var ap Va_list + _ = ap + ap = va + Xsqlite3_str_vappendf(tls, p, zFormat, ap) + _ = ap +} + +//************* End of printf.c ********************************************* +//************* Begin file treeview.c *************************************** +// 2015-06-08 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains C code to implement the TreeView debugging routines. +// These routines print a parse tree to standard output for debugging and +// analysis. +// +// The interfaces in this file is only available when compiling +// with SQLITE_DEBUG. +// #include "sqliteInt.h" + +//************* End of treeview.c ******************************************* +//************* Begin file random.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code to implement a pseudo-random number +// generator (PRNG) for SQLite. +// +// Random numbers are used by some of the database backends in order +// to generate random integer keys for tables or random filenames. +// #include "sqliteInt.h" + +// All threads share a single random number generator. +// This structure is the current state of the generator. +type sqlite3PrngType = struct { + FisInit uint8 + Fi uint8 + Fj uint8 + Fs [256]uint8 +} /* sqlite3.c:30748:19 */ + +//************* End of printf.c ********************************************* +//************* Begin file treeview.c *************************************** +// 2015-06-08 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains C code to implement the TreeView debugging routines. +// These routines print a parse tree to standard output for debugging and +// analysis. +// +// The interfaces in this file is only available when compiling +// with SQLITE_DEBUG. +// #include "sqliteInt.h" + +//************* End of treeview.c ******************************************* +//************* Begin file random.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code to implement a pseudo-random number +// generator (PRNG) for SQLite. +// +// Random numbers are used by some of the database backends in order +// to generate random integer keys for tables or random filenames. +// #include "sqliteInt.h" + +// All threads share a single random number generator. +// This structure is the current state of the generator. +var sqlite3Prng sqlite3PrngType /* sqlite3.c:30752:3: */ + +// Return N random bytes. +func Xsqlite3_randomness(tls *libc.TLS, N int32, pBuf uintptr) { /* sqlite3.c:30757:17: */ + bp := tls.Alloc(256) + defer tls.Free(256) + + var t uint8 + var zBuf uintptr = pBuf + + // The "wsdPrng" macro will resolve to the pseudo-random number generator + // state vector. If writable static data is unsupported on the target, + // we have to locate the state vector at run-time. In the more common + // case where writable static data is supported, wsdPrng can refer directly + // to the "sqlite3Prng" state vector declared above. + + var mutex uintptr + + if Xsqlite3_initialize(tls) != 0 { + return + } + + mutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_PRNG) + + Xsqlite3_mutex_enter(tls, mutex) + if (N <= 0) || (pBuf == uintptr(0)) { + sqlite3Prng.FisInit = uint8(0) + Xsqlite3_mutex_leave(tls, mutex) + return + } + + // Initialize the state of the random number generator once, + // the first time this routine is called. The seed value does + // not need to contain a lot of randomness since we are not + // trying to do secure encryption or anything like that... + // + // Nothing in this file or anywhere else in SQLite does any kind of + // encryption. The RC4 algorithm is being used as a PRNG (pseudo-random + // number generator) not as an encryption device. + if !(int32(sqlite3Prng.FisInit) != 0) { + var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) + var i int32 + // var k [256]int8 at bp, 256 + + sqlite3Prng.Fj = uint8(0) + sqlite3Prng.Fi = uint8(0) + if pVfs == uintptr(0) { + libc.Xmemset(tls, bp /* &k[0] */, 0, uint64(unsafe.Sizeof([256]int8{}))) + } else { + Xsqlite3OsRandomness(tls, pVfs, 256, bp /* &k[0] */) + } + for i = 0; i < 256; i++ { + *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(i))) = U8(i) + } + for i = 0; i < 256; i++ { + *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Prng)) + 2 /* &.j */)) += uint8((int32(*(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(i)))) + int32(*(*int8)(unsafe.Pointer(bp /* &k[0] */ + uintptr(i)))))) + t = *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fj))) + *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fj))) = *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(i))) + *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(i))) = t + } + sqlite3Prng.FisInit = uint8(1) + } + + for ok := true; ok; ok = libc.PreDecInt32(&N, 1) != 0 { + sqlite3Prng.Fi++ + t = *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fi))) + *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Prng)) + 2 /* &.j */)) += uint8((int32(t))) + *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fi))) = *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fj))) + *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fj))) = t + t = uint8(int32(t) + (int32(*(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(sqlite3Prng.Fi)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zBuf, 1))) = *(*uint8)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3Prng)) + 3 /* &.s */) + uintptr(t))) + } + Xsqlite3_mutex_leave(tls, mutex) +} + +// For testing purposes, we sometimes want to preserve the state of +// PRNG and restore the PRNG to its saved state at a later time, or +// to reset the PRNG to its initial state. These routines accomplish +// those tasks. +// +// The sqlite3_test_control() interface calls these routines to +// control the PRNG. +var sqlite3SavedPrng sqlite3PrngType /* sqlite3.c:30848:42: */ + +func Xsqlite3PrngSaveState(tls *libc.TLS) { /* sqlite3.c:30849:21: */ + libc.Xmemcpy(tls, + uintptr(unsafe.Pointer(&sqlite3SavedPrng)), + uintptr(unsafe.Pointer(&sqlite3Prng)), + uint64(unsafe.Sizeof(sqlite3Prng))) +} + +func Xsqlite3PrngRestoreState(tls *libc.TLS) { /* sqlite3.c:30856:21: */ + libc.Xmemcpy(tls, + uintptr(unsafe.Pointer(&sqlite3Prng)), + uintptr(unsafe.Pointer(&sqlite3SavedPrng)), + uint64(unsafe.Sizeof(sqlite3Prng))) +} + +// Create a new thread +func Xsqlite3ThreadCreate(tls *libc.TLS, ppThread uintptr, xTask uintptr, pIn uintptr) int32 { /* sqlite3.c:31092:20: */ + var p uintptr + + *(*uintptr)(unsafe.Pointer(ppThread)) = uintptr(0) + p = Xsqlite3Malloc(tls, uint64(unsafe.Sizeof(SQLiteThread{}))) + if p == uintptr(0) { + return SQLITE_NOMEM + } + if (((int32(p)) / 17) & 1) != 0 { + (*SQLiteThread)(unsafe.Pointer(p)).FxTask = xTask + (*SQLiteThread)(unsafe.Pointer(p)).FpIn = pIn + } else { + (*SQLiteThread)(unsafe.Pointer(p)).FxTask = uintptr(0) + (*SQLiteThread)(unsafe.Pointer(p)).FpResult = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(&xTask)))(tls, pIn) + } + *(*uintptr)(unsafe.Pointer(ppThread)) = p + return SQLITE_OK +} + +// Get the results of the thread +func Xsqlite3ThreadJoin(tls *libc.TLS, p uintptr, ppOut uintptr) int32 { /* sqlite3.c:31116:20: */ + + if p == uintptr(0) { + return SQLITE_NOMEM + } + if (*SQLiteThread)(unsafe.Pointer(p)).FxTask != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer((p /* &.xTask */))))(tls, (*SQLiteThread)(unsafe.Pointer(p)).FpIn) + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SQLiteThread)(unsafe.Pointer(p)).FpResult + } + Xsqlite3_free(tls, p) + + return SQLITE_OK +} + +//***************************** End Single-Threaded ************************ + +//************* End of threads.c ******************************************** +//************* Begin file utf.c ******************************************** +// 2004 April 13 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains routines used to translate between UTF-8, +// UTF-16, UTF-16BE, and UTF-16LE. +// +// Notes on UTF-8: +// +// Byte-0 Byte-1 Byte-2 Byte-3 Value +// 0xxxxxxx 00000000 00000000 0xxxxxxx +// 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx +// 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx +// 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx 000uuuuu zzzzyyyy yyxxxxxx +// +// +// Notes on UTF-16: (with wwww+1==uuuuu) +// +// Word-0 Word-1 Value +// 110110ww wwzzzzyy 110111yy yyxxxxxx 000uuuuu zzzzyyyy yyxxxxxx +// zzzzyyyy yyxxxxxx 00000000 zzzzyyyy yyxxxxxx +// +// +// BOM or Byte Order Mark: +// 0xff 0xfe little-endian utf-16 follows +// 0xfe 0xff big-endian utf-16 follows +// +// #include "sqliteInt.h" +// #include +// #include "vdbeInt.h" + +// This lookup table is used to help decode the first byte of +// a multi-byte UTF8 character. +var sqlite3Utf8Trans1 = [64]uint8{ + uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07), + uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f), + uint8(0x10), uint8(0x11), uint8(0x12), uint8(0x13), uint8(0x14), uint8(0x15), uint8(0x16), uint8(0x17), + uint8(0x18), uint8(0x19), uint8(0x1a), uint8(0x1b), uint8(0x1c), uint8(0x1d), uint8(0x1e), uint8(0x1f), + uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07), + uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f), + uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07), + uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x00), +} /* sqlite3.c:31195:28 */ + +// Translate a single UTF-8 character. Return the unicode value. +// +// During translation, assume that the byte that zTerm points +// is a 0x00. +// +// Write a pointer to the next unread byte back into *pzNext. +// +// Notes On Invalid UTF-8: +// +// * This routine never allows a 7-bit character (0x00 through 0x7f) to +// be encoded as a multi-byte character. Any multi-byte character that +// attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd. +// +// * This routine never allows a UTF16 surrogate value to be encoded. +// If a multi-byte character attempts to encode a value between +// 0xd800 and 0xe000 then it is rendered as 0xfffd. +// +// * Bytes in the range of 0x80 through 0xbf which occur as the first +// byte of a character are interpreted as single-byte characters +// and rendered as themselves even though they are technically +// invalid characters. +// +// * This routine accepts over-length UTF8 encodings +// for unicode values 0x80 and greater. It does not change over-length +// encodings to 0xfffd as some systems recommend. +func Xsqlite3Utf8Read(tls *libc.TLS, pz uintptr) U32 { /* sqlite3.c:31289:20: */ + var c uint32 + + // Same as READ_UTF8() above but without the zTerm parameter. + // For this routine, we assume the UTF8 string is always zero-terminated. + c = uint32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&(*(*uintptr)(unsafe.Pointer(pz))), 1)))) + if c >= uint32(0xc0) { + c = uint32(sqlite3Utf8Trans1[(c - uint32(0xc0))]) + for (int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pz))))) & 0xc0) == 0x80 { + c = ((c << 6) + (uint32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&(*(*uintptr)(unsafe.Pointer(pz))), 1))))))) + } + if ((c < uint32(0x80)) || + ((c & 0xFFFFF800) == uint32(0xD800))) || + ((c & 0xFFFFFFFE) == uint32(0xFFFE)) { + c = uint32(0xFFFD) + } + } + return c +} + +// If the TRANSLATE_TRACE macro is defined, the value of each Mem is +// printed on stderr on the way into and out of sqlite3VdbeMemTranslate(). +// #define TRANSLATE_TRACE 1 + +// This routine transforms the internal text encoding used by pMem to +// desiredEnc. It is an error if the string is already of the desired +// encoding, or if *pMem does not contain a string value. +func Xsqlite3VdbeMemTranslate(tls *libc.TLS, pMem uintptr, desiredEnc U8) int32 { /* sqlite3.c:31325:36: */ + var len Sqlite3_int64 // Maximum length of output string in bytes + var zOut uintptr // Output buffer + var zIn uintptr // Input iterator + var zTerm uintptr // End of input + var z uintptr // Output iterator + var c uint32 + var temp U8 + var rc int32 + var c2 int32 + var c21 int32 + + // If the translation is between UTF-16 little and big endian, then + // all that is required is to swap the byte order. This case is handled + // differently from the others. + if !((int32((*Mem)(unsafe.Pointer(pMem)).Fenc) != SQLITE_UTF8) && (int32(desiredEnc) != SQLITE_UTF8)) { + goto __1 + } + rc = Xsqlite3VdbeMemMakeWriteable(tls, pMem) + if !(rc != SQLITE_OK) { + goto __2 + } + + return SQLITE_NOMEM +__2: + ; + zIn = (*Mem)(unsafe.Pointer(pMem)).Fz + zTerm = (zIn + uintptr(((*Mem)(unsafe.Pointer(pMem)).Fn & libc.CplInt32(1)))) +__3: + if !(zIn < zTerm) { + goto __4 + } + temp = *(*uint8)(unsafe.Pointer(zIn)) + *(*uint8)(unsafe.Pointer(zIn)) = *(*uint8)(unsafe.Pointer((zIn + uintptr(1)))) + zIn++ + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) = temp + goto __3 +__4: + ; + (*Mem)(unsafe.Pointer(pMem)).Fenc = desiredEnc + goto translate_out +__1: + ; + + // Set len to the maximum number of bytes required in the output buffer. + if !(int32(desiredEnc) == SQLITE_UTF8) { + goto __5 + } + // When converting from UTF-16, the maximum growth results from + // translating a 2-byte character to a 4-byte UTF-8 character. + // A single byte is required for the output string + // nul-terminator. + *(*int32)(unsafe.Pointer(pMem + 12 /* &.n */)) &= (libc.CplInt32(1)) + len = ((int64(2) * Sqlite3_int64((*Mem)(unsafe.Pointer(pMem)).Fn)) + int64(1)) + goto __6 +__5: + // When converting from UTF-8 to UTF-16 the maximum growth is caused + // when a 1-byte UTF-8 character is translated into a 2-byte UTF-16 + // character. Two bytes are required in the output buffer for the + // nul-terminator. + len = ((int64(2) * Sqlite3_int64((*Mem)(unsafe.Pointer(pMem)).Fn)) + int64(2)) +__6: + ; + + // Set zIn to point at the start of the input buffer and zTerm to point 1 + // byte past the end. + // + // Variable zOut is set to point at the output buffer, space obtained + // from sqlite3_malloc(). + zIn = (*Mem)(unsafe.Pointer(pMem)).Fz + zTerm = (zIn + uintptr((*Mem)(unsafe.Pointer(pMem)).Fn)) + zOut = Xsqlite3DbMallocRaw(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, uint64(len)) + if !(!(zOut != 0)) { + goto __7 + } + return SQLITE_NOMEM +__7: + ; + z = zOut + + if !(int32((*Mem)(unsafe.Pointer(pMem)).Fenc) == SQLITE_UTF8) { + goto __8 + } + if !(int32(desiredEnc) == SQLITE_UTF16LE) { + goto __10 + } + // UTF-8 -> UTF-16 Little-endian +__12: + if !(zIn < zTerm) { + goto __13 + } + c = uint32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + if !(c >= uint32(0xc0)) { + goto __14 + } + c = uint32(sqlite3Utf8Trans1[(c - uint32(0xc0))]) +__15: + if !((zIn != zTerm) && ((int32(*(*uint8)(unsafe.Pointer(zIn))) & 0xc0) == 0x80)) { + goto __16 + } + c = ((c << 6) + (uint32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))))) + goto __15 +__16: + ; + if !(((c < uint32(0x80)) || ((c & 0xFFFFF800) == uint32(0xD800))) || ((c & 0xFFFFFFFE) == uint32(0xFFFE))) { + goto __17 + } + c = uint32(0xFFFD) +__17: + ; +__14: + ; + + if !(c <= uint32(0xFFFF)) { + goto __18 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(c & uint32(0x00FF))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8((c >> 8) & uint32(0x00FF))) + goto __19 +__18: + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(((c >> 10) & uint32(0x003F)) + (((c - uint32(0x10000)) >> 10) & uint32(0x00C0)))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(uint32(0x00D8) + (((c - uint32(0x10000)) >> 18) & uint32(0x03)))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(c & uint32(0x00FF))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(uint32(0x00DC) + ((c >> 8) & uint32(0x03)))) +__19: + ; + + goto __12 +__13: + ; + goto __11 +__10: + ; + // UTF-8 -> UTF-16 Big-endian +__20: + if !(zIn < zTerm) { + goto __21 + } + c = uint32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + if !(c >= uint32(0xc0)) { + goto __22 + } + c = uint32(sqlite3Utf8Trans1[(c - uint32(0xc0))]) +__23: + if !((zIn != zTerm) && ((int32(*(*uint8)(unsafe.Pointer(zIn))) & 0xc0) == 0x80)) { + goto __24 + } + c = ((c << 6) + (uint32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))))) + goto __23 +__24: + ; + if !(((c < uint32(0x80)) || ((c & 0xFFFFF800) == uint32(0xD800))) || ((c & 0xFFFFFFFE) == uint32(0xFFFE))) { + goto __25 + } + c = uint32(0xFFFD) +__25: + ; +__22: + ; + + if !(c <= uint32(0xFFFF)) { + goto __26 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8((c >> 8) & uint32(0x00FF))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(c & uint32(0x00FF))) + goto __27 +__26: + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(uint32(0x00D8) + (((c - uint32(0x10000)) >> 18) & uint32(0x03)))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(((c >> 10) & uint32(0x003F)) + (((c - uint32(0x10000)) >> 10) & uint32(0x00C0)))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(uint32(0x00DC) + ((c >> 8) & uint32(0x03)))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(c & uint32(0x00FF))) +__27: + ; + + goto __20 +__21: + ; +__11: + ; + (*Mem)(unsafe.Pointer(pMem)).Fn = (int32((int64(z) - int64(zOut)) / 1)) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = uint8(0) + goto __9 +__8: + ; + if !(int32((*Mem)(unsafe.Pointer(pMem)).Fenc) == SQLITE_UTF16LE) { + goto __28 + } + // UTF-16 Little-endian -> UTF-8 +__30: + if !(zIn < zTerm) { + goto __31 + } + c = uint32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + c = c + (uint32((int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))) << 8)) + if !((c >= uint32(0xd800)) && (c < uint32(0xe000))) { + goto __32 + } + if !(zIn < zTerm) { + goto __33 + } + c2 = int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + c2 = c2 + ((int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))) << 8) + c = (((uint32(c2 & 0x03FF)) + ((c & uint32(0x003F)) << 10)) + (((c & uint32(0x03C0)) + uint32(0x0040)) << 10)) +__33: + ; +__32: + ; + if !(c < uint32(0x00080)) { + goto __34 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(c & uint32(0xFF))) + goto __35 +__34: + if !(c < uint32(0x00800)) { + goto __36 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0xC0 + int32((U8((c >> 6) & uint32(0x1F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + goto __37 +__36: + if !(c < uint32(0x10000)) { + goto __38 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0xE0 + int32((U8((c >> 12) & uint32(0x0F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8((c >> 6) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + goto __39 +__38: + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0xF0 + int32((U8((c >> 18) & uint32(0x07)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8((c >> 12) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8((c >> 6) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) +__39: + ; +__37: + ; +__35: + ; + + goto __30 +__31: + ; + goto __29 +__28: + // UTF-16 Big-endian -> UTF-8 +__40: + if !(zIn < zTerm) { + goto __41 + } + c = (uint32((int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))) << 8)) + c = c + (uint32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))) + if !((c >= uint32(0xd800)) && (c < uint32(0xe000))) { + goto __42 + } + if !(zIn < zTerm) { + goto __43 + } + c21 = ((int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))) << 8) + c21 = c21 + (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))) + c = (((uint32(c21 & 0x03FF)) + ((c & uint32(0x003F)) << 10)) + (((c & uint32(0x03C0)) + uint32(0x0040)) << 10)) +__43: + ; +__42: + ; + if !(c < uint32(0x00080)) { + goto __44 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (U8(c & uint32(0xFF))) + goto __45 +__44: + if !(c < uint32(0x00800)) { + goto __46 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0xC0 + int32((U8((c >> 6) & uint32(0x1F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + goto __47 +__46: + if !(c < uint32(0x10000)) { + goto __48 + } + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0xE0 + int32((U8((c >> 12) & uint32(0x0F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8((c >> 6) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + goto __49 +__48: + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0xF0 + int32((U8((c >> 18) & uint32(0x07)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8((c >> 12) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8((c >> 6) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) +__49: + ; +__47: + ; +__45: + ; + + goto __40 +__41: + ; +__29: + ; + (*Mem)(unsafe.Pointer(pMem)).Fn = (int32((int64(z) - int64(zOut)) / 1)) +__9: + ; + *(*uint8)(unsafe.Pointer(z)) = uint8(0) + + c = (uint32((MEM_Str | MEM_Term) | (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_AffMask | MEM_Subtype)))) + Xsqlite3VdbeMemRelease(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(c) + (*Mem)(unsafe.Pointer(pMem)).Fenc = desiredEnc + (*Mem)(unsafe.Pointer(pMem)).Fz = zOut + (*Mem)(unsafe.Pointer(pMem)).FzMalloc = (*Mem)(unsafe.Pointer(pMem)).Fz + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = Xsqlite3DbMallocSize(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).Fz) + +translate_out: + return SQLITE_OK +} + +// This routine checks for a byte-order mark at the beginning of the +// UTF-16 string stored in *pMem. If one is present, it is removed and +// the encoding of the Mem adjusted. This routine does not do any +// byte-swapping, it just sets Mem.enc appropriately. +// +// The allocation (static, dynamic etc.) and encoding of the Mem may be +// changed by this function. +func Xsqlite3VdbeMemHandleBom(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:31520:20: */ + var rc int32 = SQLITE_OK + var bom U8 = U8(0) + + if (*Mem)(unsafe.Pointer(pMem)).Fn > 1 { + var b1 U8 = *(*U8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz)) + var b2 U8 = *(*U8)(unsafe.Pointer((((*Mem)(unsafe.Pointer(pMem)).Fz) + uintptr(1)))) + if (int32(b1) == 0xFE) && (int32(b2) == 0xFF) { + bom = U8(SQLITE_UTF16BE) + } + if (int32(b1) == 0xFF) && (int32(b2) == 0xFE) { + bom = U8(SQLITE_UTF16LE) + } + } + + if bom != 0 { + rc = Xsqlite3VdbeMemMakeWriteable(tls, pMem) + if rc == SQLITE_OK { + *(*int32)(unsafe.Pointer(pMem + 12 /* &.n */)) -= (2) + libc.Xmemmove(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, ((*Mem)(unsafe.Pointer(pMem)).Fz + 2), uint64((*Mem)(unsafe.Pointer(pMem)).Fn)) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr((*Mem)(unsafe.Pointer(pMem)).Fn))) = int8(0) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr(((*Mem)(unsafe.Pointer(pMem)).Fn + 1)))) = int8(0) + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) |= U16((MEM_Term)) + (*Mem)(unsafe.Pointer(pMem)).Fenc = bom + } + } + return rc +} + +// pZ is a UTF-8 encoded unicode string. If nByte is less than zero, +// return the number of unicode characters in pZ up to (but not including) +// the first 0x00 byte. If nByte is not less than zero, return the +// number of unicode characters in the first nByte of pZ (or up to +// the first 0x00, whichever comes first). +func Xsqlite3Utf8CharLen(tls *libc.TLS, zIn uintptr, nByte int32) int32 { /* sqlite3.c:31558:20: */ + var r int32 = 0 + var z uintptr = zIn + var zTerm uintptr + if nByte >= 0 { + zTerm = (z + uintptr(nByte)) + } else { + zTerm = libc.UintptrFromInt32(-1) + } + + for (int32(*(*U8)(unsafe.Pointer(z))) != 0) && (z < zTerm) { + { + if (int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0 { + for (int32(*(*U8)(unsafe.Pointer(z))) & 0xc0) == 0x80 { + z++ + } + } + } + + r++ + } + return r +} + +// This test function is not currently used by the automated test-suite. +// Hence it is only available in debug builds. + +// Convert a UTF-16 string in the native encoding into a UTF-8 string. +// Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must +// be freed by the calling function. +// +// NULL is returned if there is an allocation error. +func Xsqlite3Utf16to8(tls *libc.TLS, db uintptr, z uintptr, nByte int32, enc U8) uintptr { /* sqlite3.c:31612:21: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var m Mem at bp, 56 + + libc.Xmemset(tls, bp /* &m */, 0, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(bp /* &m */)).Fdb = db + Xsqlite3VdbeMemSetStr(tls, bp /* &m */, z, int64(nByte), enc, uintptr(0)) + Xsqlite3VdbeChangeEncoding(tls, bp /* &m */, SQLITE_UTF8) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3VdbeMemRelease(tls, bp /* &m */) + (*Mem)(unsafe.Pointer(bp /* &m */)).Fz = uintptr(0) + } + + return (*Mem)(unsafe.Pointer(bp /* &m */)).Fz +} + +// zIn is a UTF-16 encoded unicode string at least nChar characters long. +// Return the number of bytes in the first nChar unicode characters +// in pZ. nChar must be non-negative. +func Xsqlite3Utf16ByteLen(tls *libc.TLS, zIn uintptr, nChar int32) int32 { /* sqlite3.c:31633:20: */ + var c int32 + var z uintptr = zIn + var n int32 = 0 + + if SQLITE_UTF16LE == SQLITE_UTF16LE { + z++ + } + for n < nChar { + c = int32(*(*uint8)(unsafe.Pointer(z))) + z += uintptr(2) + if (((c >= 0xd8) && (c < 0xdc)) && (int32(*(*uint8)(unsafe.Pointer(z))) >= 0xdc)) && (int32(*(*uint8)(unsafe.Pointer(z))) < 0xe0) { + z += uintptr(2) + } + n++ + } + return ((int32((int64(z) - int64(zIn)) / 1)) - + (libc.Bool32(SQLITE_UTF16LE == SQLITE_UTF16LE))) +} + +//************* End of utf.c ************************************************ +//************* Begin file util.c ******************************************* +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Utility functions used throughout sqlite. +// +// This file contains functions for allocating memory, comparing +// strings, and stuff like that. +// +// #include "sqliteInt.h" +// #include +// ==================================================== +// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +// +// Developed at SunPro, a Sun Microsystems, Inc. business. +// Permission to use, copy, modify, and distribute this +// software is freely granted, provided that this notice +// is preserved. +// ==================================================== + +// from: @(#)fdlibm.h 5.1 93/09/24 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// This file is in the public domain. +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)limits.h 8.3 (Berkeley) 1/4/94 +// $FreeBSD$ + +// ANSI/POSIX +type __infinity_un = struct { + _ [0]uint64 + F__uc [8]uint8 +} /* math.h:27:14 */ + +type __nan_un = struct { + _ [0]uint32 + F__uc [4]uint8 +} /* math.h:32:14 */ + +// Symbolic constants to classify floating point numbers. + +type Double_t = X__double_t /* math.h:136:20 */ +type Float_t = X__float_t /* math.h:137:19 */ + +// Routine needed to support the testcase() macro. + +// Calls to sqlite3FaultSim() are used to simulate a failure during testing, +// or to bypass normal error detection during testing in order to let +// execute proceed futher downstream. +// +// In deployment, sqlite3FaultSim() *always* return SQLITE_OK (0). The +// sqlite3FaultSim() function only returns non-zero during testing. +// +// During testing, if the test harness has set a fault-sim callback using +// a call to sqlite3_test_control(SQLITE_TESTCTRL_FAULT_INSTALL), then +// each call to sqlite3FaultSim() is relayed to that application-supplied +// callback and the integer return value form the application-supplied +// callback is returned by sqlite3FaultSim(). +// +// The integer argument to sqlite3FaultSim() is a code to identify which +// sqlite3FaultSim() instance is being invoked. Each call to sqlite3FaultSim() +// should have a unique code. To prevent legacy testing applications from +// breaking, the codes should not be changed or reused. +func Xsqlite3FaultSim(tls *libc.TLS, iTest int32) int32 { /* sqlite3.c:31735:20: */ + var xCallback uintptr = Xsqlite3Config.FxTestCallback + if xCallback != 0 { + return (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer(&xCallback)))(tls, iTest) + } + return SQLITE_OK +} + +// Return true if the floating point value is Not a Number (NaN). +func Xsqlite3IsNaN(tls *libc.TLS, x float64) int32 { /* sqlite3.c:31745:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp + 8)) = x + + // var y U64 at bp, 8 + + libc.Xmemcpy(tls, bp /* &y */, bp+8 /* &x */, uint64(unsafe.Sizeof(U64(0)))) + return (libc.Bool32((((*(*U64)(unsafe.Pointer(bp /* y */))) & (U64((uint64(0x7ff))) << 52)) == (U64((uint64(0x7ff))) << 52)) && (((*(*U64)(unsafe.Pointer(bp /* y */))) & ((U64((uint64(1))) << 52) - uint64(1))) != uint64(0)))) +} + +// Compute a string length that is limited to what can be stored in +// lower 30 bits of a 32-bit signed integer. +// +// The value returned will never be negative. Nor will it ever be greater +// than the actual length of the string. For very long strings (greater +// than 1GiB) the value returned might be less than the true string length. +func Xsqlite3Strlen30(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:31760:20: */ + if z == uintptr(0) { + return 0 + } + return (0x3fffffff & int32(libc.Xstrlen(tls, z))) +} + +// Return the declared type of a column. Or return zDflt if the column +// has no declared type. +// +// The column type is an extra string stored after the zero-terminator on +// the column name if and only if the COLFLAG_HASTYPE flag is set. +func Xsqlite3ColumnType(tls *libc.TLS, pCol uintptr, zDflt uintptr) uintptr { /* sqlite3.c:31772:21: */ + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_HASTYPE) == 0 { + return zDflt + } + return (((*Column)(unsafe.Pointer(pCol)).FzName + uintptr(libc.Xstrlen(tls, (*Column)(unsafe.Pointer(pCol)).FzName))) + uintptr(1)) +} + +// Helper function for sqlite3Error() - called rarely. Broken out into +// a separate routine to avoid unnecessary register saves on entry to +// sqlite3Error(). +func sqlite3ErrorFinish(tls *libc.TLS, db uintptr, err_code int32) { /* sqlite3.c:31782:30: */ + if (*Sqlite3)(unsafe.Pointer(db)).FpErr != 0 { + Xsqlite3ValueSetNull(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + } + Xsqlite3SystemError(tls, db, err_code) +} + +// Set the current error code to err_code and clear any prior error message. +// Also set iSysErrno (by calling sqlite3System) if the err_code indicates +// that would be appropriate. +func Xsqlite3Error(tls *libc.TLS, db uintptr, err_code int32) { /* sqlite3.c:31792:21: */ + + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = err_code + if (err_code != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FpErr != 0) { + sqlite3ErrorFinish(tls, db, err_code) + } +} + +// The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state +// and error message. +func Xsqlite3ErrorClear(tls *libc.TLS, db uintptr) { /* sqlite3.c:31802:21: */ + + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_OK + if (*Sqlite3)(unsafe.Pointer(db)).FpErr != 0 { + Xsqlite3ValueSetNull(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + } +} + +// Load the sqlite3.iSysErrno field if that is an appropriate thing +// to do based on the SQLite error code in rc. +func Xsqlite3SystemError(tls *libc.TLS, db uintptr, rc int32) { /* sqlite3.c:31812:21: */ + if rc == (SQLITE_IOERR | (int32(12) << 8)) { + return + } + rc = rc & (0xff) + if (rc == SQLITE_CANTOPEN) || (rc == SQLITE_IOERR) { + (*Sqlite3)(unsafe.Pointer(db)).FiSysErrno = Xsqlite3OsGetLastError(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs) + } +} + +// Set the most recent error code and error string for the sqlite +// handle "db". The error code is set to "err_code". +// +// If it is not NULL, string zFormat specifies the format of the +// error string in the style of the printf functions: The following +// format characters are allowed: +// +// %s Insert a string +// %z A string that should be freed after use +// %d Insert an integer +// %T Insert a token +// %S Insert the first element of a SrcList +// +// zFormat and any string tokens that follow it are assumed to be +// encoded in UTF-8. +// +// To clear the most recent error for sqlite handle "db", sqlite3Error +// should be called with err_code set to SQLITE_OK and zFormat set +// to NULL. +func Xsqlite3ErrorWithMsg(tls *libc.TLS, db uintptr, err_code int32, zFormat uintptr, va uintptr) { /* sqlite3.c:31841:21: */ + + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = err_code + Xsqlite3SystemError(tls, db, err_code) + if zFormat == uintptr(0) { + Xsqlite3Error(tls, db, err_code) + } else if ((*Sqlite3)(unsafe.Pointer(db)).FpErr != 0) || ((libc.AssignPtrUintptr(db+392 /* &.pErr */, Xsqlite3ValueNew(tls, db))) != uintptr(0)) { + var z uintptr + var ap Va_list + _ = ap + ap = va + z = Xsqlite3VMPrintf(tls, db, zFormat, ap) + _ = ap + Xsqlite3ValueSetStr(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr, -1, z, uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) + } +} + +// Add an error message to pParse->zErrMsg and increment pParse->nErr. +// The following formatting characters are allowed: +// +// %s Insert a string +// %z A string that should be freed after use +// %d Insert an integer +// %T Insert a token +// %S Insert the first element of a SrcList +// +// This function should be used to report any error that occurs while +// compiling an SQL statement (i.e. within sqlite3_prepare()). The +// last thing the sqlite3_prepare() function does is copy the error +// stored by this function into the database handle using sqlite3Error(). +// Functions sqlite3Error() or sqlite3ErrorWithMsg() should be used +// during statement execution (sqlite3_step() etc.). +func Xsqlite3ErrorMsg(tls *libc.TLS, pParse uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:31874:21: */ + var zMsg uintptr + var ap Va_list + _ = ap + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + ap = va + zMsg = Xsqlite3VMPrintf(tls, db, zFormat, ap) + _ = ap + if (*Sqlite3)(unsafe.Pointer(db)).FsuppressErr != 0 { + Xsqlite3DbFree(tls, db, zMsg) + } else { + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + Xsqlite3DbFree(tls, db, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = zMsg + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + (*Parse)(unsafe.Pointer(pParse)).FpWith = uintptr(0) + } +} + +// If database connection db is currently parsing SQL, then transfer +// error code errCode to that parser if the parser has not already +// encountered some other kind of error. +func Xsqlite3ErrorToParser(tls *libc.TLS, db uintptr, errCode int32) int32 { /* sqlite3.c:31897:20: */ + var pParse uintptr + if (db == uintptr(0)) || ((libc.AssignUintptr(&pParse, (*Sqlite3)(unsafe.Pointer(db)).FpParse)) == uintptr(0)) { + return errCode + } + (*Parse)(unsafe.Pointer(pParse)).Frc = errCode + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + return errCode +} + +// Convert an SQL-style quoted string into a normal string by removing +// the quote characters. The conversion is done in-place. If the +// input does not begin with a quote character, then this routine +// is a no-op. +// +// The input string must be zero-terminated. A new zero-terminator +// is added to the dequoted string. +// +// The return value is -1 if no dequoting occurs or the length of the +// dequoted string, exclusive of the zero terminator, if dequoting does +// occur. +// +// 2002-02-14: This routine is extended to remove MS-Access style +// brackets from around identifiers. For example: "[a-b-c]" becomes +// "a-b-c". +func Xsqlite3Dequote(tls *libc.TLS, z uintptr) { /* sqlite3.c:31922:21: */ + var quote int8 + var i int32 + var j int32 + if z == uintptr(0) { + return + } + quote = *(*int8)(unsafe.Pointer(z)) + if !((int32(Xsqlite3CtypeMap[uint8(quote)]) & 0x80) != 0) { + return + } + if int32(quote) == '[' { + quote = int8(']') + } + i = 1 + j = 0 + for ; ; i++ { + + if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(quote) { + if int32(*(*int8)(unsafe.Pointer(z + uintptr((i + 1))))) == int32(quote) { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = quote + i++ + } else { + break + } + } else { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(i))) + } + } + *(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0) +} + +func Xsqlite3DequoteExpr(tls *libc.TLS, p uintptr) { /* sqlite3.c:31944:21: */ + + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) |= (func() uint32 { + if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))))) == '"' { + return (uint32(EP_Quoted | EP_DblQuoted)) + } + return uint32(EP_Quoted) + }()) + Xsqlite3Dequote(tls, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))) +} + +// Generate a Token object from a string +func Xsqlite3TokenInit(tls *libc.TLS, p uintptr, z uintptr) { /* sqlite3.c:31953:21: */ + (*Token)(unsafe.Pointer(p)).Fz = z + (*Token)(unsafe.Pointer(p)).Fn = uint32(Xsqlite3Strlen30(tls, z)) +} + +// Convenient short-hand + +// Some systems have stricmp(). Others have strcasecmp(). Because +// there is no consistency, we will define our own. +// +// IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and +// sqlite3_strnicmp() APIs allow applications and extensions to compare +// the contents of two buffers containing UTF-8 strings in a +// case-independent fashion, using the same definition of "case +// independence" that SQLite uses internally when comparing identifiers. +func Xsqlite3_stricmp(tls *libc.TLS, zLeft uintptr, zRight uintptr) int32 { /* sqlite3.c:31971:16: */ + if zLeft == uintptr(0) { + if zRight != 0 { + return -1 + } + return 0 + } else if zRight == uintptr(0) { + return 1 + } + return Xsqlite3StrICmp(tls, zLeft, zRight) +} + +func Xsqlite3StrICmp(tls *libc.TLS, zLeft uintptr, zRight uintptr) int32 { /* sqlite3.c:31979:20: */ + var a uintptr + var b uintptr + var c int32 + var x int32 + a = zLeft + b = zRight + for { + c = int32(*(*uint8)(unsafe.Pointer(a))) + x = int32(*(*uint8)(unsafe.Pointer(b))) + if c == x { + if c == 0 { + break + } + } else { + c = (int32(Xsqlite3UpperToLower[c]) - int32(Xsqlite3UpperToLower[x])) + if c != 0 { + break + } + } + a++ + b++ + } + return c +} + +func Xsqlite3_strnicmp(tls *libc.TLS, zLeft uintptr, zRight uintptr, N int32) int32 { /* sqlite3.c:31998:16: */ + var a uintptr + var b uintptr + if zLeft == uintptr(0) { + if zRight != 0 { + return -1 + } + return 0 + } else if zRight == uintptr(0) { + return 1 + } + a = zLeft + b = zRight + for ((libc.PostDecInt32(&N, 1) > 0) && (int32(*(*uint8)(unsafe.Pointer(a))) != 0)) && (int32(Xsqlite3UpperToLower[*(*uint8)(unsafe.Pointer(a))]) == int32(Xsqlite3UpperToLower[*(*uint8)(unsafe.Pointer(b))])) { + a++ + b++ + } + if N < 0 { + return 0 + } + return (int32(Xsqlite3UpperToLower[*(*uint8)(unsafe.Pointer(a))]) - int32(Xsqlite3UpperToLower[*(*uint8)(unsafe.Pointer(b))])) +} + +// Compute an 8-bit hash on a string that is insensitive to case differences +func Xsqlite3StrIHash(tls *libc.TLS, z uintptr) U8 { /* sqlite3.c:32014:19: */ + var h U8 = U8(0) + if z == uintptr(0) { + return U8(0) + } + for *(*int8)(unsafe.Pointer(z)) != 0 { + h = U8(int32(h) + (int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z)))]))) + z++ + } + return h +} + +// Compute 10 to the E-th power. Examples: E==1 results in 10. +// E==2 results in 100. E==50 results in 1.0e50. +// +// This routine only works for values of E between 1 and 341. +func sqlite3Pow10(tls *libc.TLS, E int32) float64 { /* sqlite3.c:32030:24: */ + var x float64 = 10.0 + var r float64 = 1.0 + for 1 != 0 { + if (E & 1) != 0 { + r = r * (x) + } + E >>= 1 + if E == 0 { + break + } + x = x * (x) + } + return r +} + +// The string z[] is an text representation of a real number. +// Convert this string to a double and write it into *pResult. +// +// The string z[] is length bytes in length (bytes, not characters) and +// uses the encoding enc. The string is not necessarily zero-terminated. +// +// Return TRUE if the result is a valid real number (or integer) and FALSE +// if the string is empty or contains extraneous text. More specifically +// return +// 1 => The input string is a pure integer +// 2 or more => The input has a decimal point or eNNN clause +// 0 or less => The input string is not a valid number +// -1 => Not a valid number, but has a valid prefix which +// includes a decimal point and/or an eNNN clause +// +// Valid numbers are in one of these formats: +// +// [+-]digits[E[+-]digits] +// [+-]digits.[digits][E[+-]digits] +// [+-].digits[E[+-]digits] +// +// Leading and trailing whitespace is ignored for the purpose of determining +// validity. +// +// If some prefix of the input string is a valid number, this routine +// returns FALSE but it still converts the prefix and writes the result +// into *pResult. +func Xsqlite3AtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32, enc U8) int32 { /* sqlite3.c:32095:20: */ + var incr int32 + var zEnd uintptr + // sign * significand * (10 ^ (esign * exponent)) + var sign int32 // sign of significand + var s I64 // significand + var d int32 // adjust exponent for shifting decimal point + var esign int32 // sign of exponent + var e int32 // exponent + var eValid int32 // True exponent is either not used or is well-formed + var result float64 + var nDigit int32 // Number of digits processed + var eType int32 + var i int32 //OPTIMIZATION-IF-TRUE + var scale float64 + var scale1 float64 + sign = 1 + s = int64(0) + d = 0 + esign = 1 + e = 0 + eValid = 1 + nDigit = 0 + eType = 1 // 1: pure integer, 2+: fractional -1 or less: bad UTF16 + + *(*float64)(unsafe.Pointer(pResult)) = 0.0 // Default return value, in case of an error + if !(length == 0) { + goto __1 + } + return 0 +__1: + ; + + if !(int32(enc) == SQLITE_UTF8) { + goto __2 + } + incr = 1 + zEnd = (z + uintptr(length)) + goto __3 +__2: + incr = 2 + length = length & (libc.CplInt32(1)) + + i = (3 - int32(enc)) +__4: + if !((i < length) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == 0)) { + goto __6 + } + goto __5 +__5: + i = i + (2) + goto __4 + goto __6 +__6: + ; + if !(i < length) { + goto __7 + } + eType = -100 +__7: + ; + zEnd = (z + uintptr((i ^ 1))) + z += (uintptr(int32(enc) & 1)) +__3: + ; + + // skip leading spaces +__8: + if !((z < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x01) != 0)) { + goto __9 + } + z += uintptr(incr) + goto __8 +__9: + ; + if !(z >= zEnd) { + goto __10 + } + return 0 +__10: + ; + + // get sign of significand + if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') { + goto __11 + } + sign = -1 + z += uintptr(incr) + goto __12 +__11: + if !(int32(*(*int8)(unsafe.Pointer(z))) == '+') { + goto __13 + } + z += uintptr(incr) +__13: + ; +__12: + ; + + // copy max significant digits to significand +__14: + if !((z < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0)) { + goto __15 + } + s = ((s * int64(10)) + (I64(int32(*(*int8)(unsafe.Pointer(z))) - '0'))) + z += uintptr(incr) + nDigit++ + if !(s >= (((int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) - int64(9)) / int64(10))) { + goto __16 + } + // skip non-significant significand digits + // (increase exponent by d to shift decimal left) +__17: + if !((z < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0)) { + goto __18 + } + z += uintptr(incr) + d++ + goto __17 +__18: + ; +__16: + ; + goto __14 +__15: + ; + if !(z >= zEnd) { + goto __19 + } + goto do_atof_calc +__19: + ; + + // if decimal point is present + if !(int32(*(*int8)(unsafe.Pointer(z))) == '.') { + goto __20 + } + z += uintptr(incr) + eType++ + // copy digits from after decimal to significand + // (decrease exponent by d to shift decimal right) +__21: + if !((z < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0)) { + goto __22 + } + if !(s < (((int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) - int64(9)) / int64(10))) { + goto __23 + } + s = ((s * int64(10)) + (I64(int32(*(*int8)(unsafe.Pointer(z))) - '0'))) + d-- + nDigit++ +__23: + ; + z += uintptr(incr) + goto __21 +__22: + ; +__20: + ; + if !(z >= zEnd) { + goto __24 + } + goto do_atof_calc +__24: + ; + + // if exponent is present + if !((int32(*(*int8)(unsafe.Pointer(z))) == 'e') || (int32(*(*int8)(unsafe.Pointer(z))) == 'E')) { + goto __25 + } + z += uintptr(incr) + eValid = 0 + eType++ + + // This branch is needed to avoid a (harmless) buffer overread. The + // special comment alerts the mutation tester that the correct answer + // is obtained even if the branch is omitted + if !(z >= zEnd) { + goto __26 + } + goto do_atof_calc +__26: + ; //PREVENTS-HARMLESS-OVERREAD + + // get sign of exponent + if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') { + goto __27 + } + esign = -1 + z += uintptr(incr) + goto __28 +__27: + if !(int32(*(*int8)(unsafe.Pointer(z))) == '+') { + goto __29 + } + z += uintptr(incr) +__29: + ; +__28: + ; + // copy digits to exponent +__30: + if !((z < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0)) { + goto __31 + } + if e < 10000 { + e = ((e * 10) + (int32(*(*int8)(unsafe.Pointer(z))) - '0')) + } else { + e = 10000 + } + z += uintptr(incr) + eValid = 1 + goto __30 +__31: + ; +__25: + ; + + // skip trailing spaces +__32: + if !((z < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x01) != 0)) { + goto __33 + } + z += uintptr(incr) + goto __32 +__33: + ; + +do_atof_calc: + // adjust exponent by d, and update sign + e = ((e * esign) + d) + if !(e < 0) { + goto __34 + } + esign = -1 + e = e * (-1) + goto __35 +__34: + esign = 1 +__35: + ; + + if !(s == int64(0)) { + goto __36 + } + // In the IEEE 754 standard, zero is signed. + if sign < 0 { + result = -libc.Float64FromFloat64(float64(0)) + } else { + result = float64(0) + } + goto __37 +__36: + // Attempt to reduce exponent. + // + // Branches that are not required for the correct answer but which only + // help to obtain the correct answer faster are marked with special + // comments, as a hint to the mutation tester. +__38: + if !(e > 0) { + goto __39 + } //OPTIMIZATION-IF-TRUE + if !(esign > 0) { + goto __40 + } + if !(s >= ((int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) / int64(10))) { + goto __42 + } + goto __39 +__42: + ; //OPTIMIZATION-IF-FALSE + s = s * (int64(10)) + goto __41 +__40: + if !((s % int64(10)) != int64(0)) { + goto __43 + } + goto __39 +__43: + ; //OPTIMIZATION-IF-FALSE + s = s / (int64(10)) +__41: + ; + e-- + goto __38 +__39: + ; + + // adjust the sign of significand + if sign < 0 { + s = -s + } else { + s = s + } + + if !(e == 0) { + goto __44 + } //OPTIMIZATION-IF-TRUE + result = float64(s) + goto __45 +__44: + // attempt to handle extremely small/large numbers better + if !(e > 307) { + goto __46 + } //OPTIMIZATION-IF-TRUE + if !(e < 342) { + goto __48 + } //OPTIMIZATION-IF-TRUE + scale = sqlite3Pow10(tls, (e - 308)) + if !(esign < 0) { + goto __50 + } + result = (float64(s) / scale) + result = result / (1.0e+308) + goto __51 +__50: + result = (float64(s) * scale) + result = result * (1.0e+308) +__51: + ; + goto __49 +__48: + ; + if !(esign < 0) { + goto __52 + } + result = (0.0 * float64(s)) + goto __53 +__52: + result = (float64(libc.X__builtin_inff(tls) * float32(s))) +__53: + ; +__49: + ; + goto __47 +__46: + scale1 = sqlite3Pow10(tls, e) + if !(esign < 0) { + goto __54 + } + result = (float64(s) / scale1) + goto __55 +__54: + result = (float64(s) * scale1) +__55: + ; +__47: + ; +__45: + ; +__37: + ; + + // store the result + *(*float64)(unsafe.Pointer(pResult)) = result + + // return true if number and no extra non-whitespace chracters after + if !((((z == zEnd) && (nDigit > 0)) && (eValid != 0)) && (eType > 0)) { + goto __56 + } + return eType + goto __57 +__56: + if !(((eType >= 2) && ((eType == 3) || (eValid != 0))) && (nDigit > 0)) { + goto __58 + } + return -1 + goto __59 +__58: + return 0 +__59: + ; +__57: + ; + return int32(0) +} + +// Render an signed 64-bit integer as text. Store the result in zOut[]. +// +// The caller must ensure that zOut[] is at least 21 bytes in size. +func Xsqlite3Int64ToText(tls *libc.TLS, v I64, zOut uintptr) { /* sqlite3.c:32294:21: */ + bp := tls.Alloc(22) + defer tls.Free(22) + + var i int32 + var x U64 + // var zTemp [22]int8 at bp, 22 + + if v < int64(0) { + if v == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) { + x = (U64((uint64(1))) << 63) + } else { + x = U64(-v) + } + } else { + x = U64(v) + } + i = (int32(uint64(unsafe.Sizeof([22]int8{})) - uint64(2))) + *(*int8)(unsafe.Pointer(bp /* &zTemp[0] */ + 21)) = int8(0) + for ok := true; ok; ok = x != 0 { + *(*int8)(unsafe.Pointer(bp /* &zTemp[0] */ + uintptr(libc.PostDecInt32(&i, 1)))) = (int8((x % uint64(10)) + uint64('0'))) + x = (x / uint64(10)) + } + if v < int64(0) { + *(*int8)(unsafe.Pointer(bp /* &zTemp[0] */ + uintptr(libc.PostDecInt32(&i, 1)))) = int8('-') + } + libc.Xmemcpy(tls, zOut, (bp /* &zTemp */ + uintptr((i + 1))), ((uint64(unsafe.Sizeof([22]int8{})) - uint64(1)) - uint64(i))) +} + +// Compare the 19-character string zNum against the text representation +// value 2^63: 9223372036854775808. Return negative, zero, or positive +// if zNum is less than, equal to, or greater than the string. +// Note that zNum must contain exactly 19 characters. +// +// Unlike memcmp() this routine is guaranteed to return the difference +// in the values of the last digit if the only difference is in the +// last digit. So, for example, +// +// compare2pow63("9223372036854775800", 1) +// +// will return -8. +func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c:32327:12: */ + var c int32 = 0 + var i int32 + // 012345678901234567 + var pow63 uintptr = ts + 792 /* "9223372036854775..." */ + for i = 0; (c == 0) && (i < 18); i++ { + c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) + } + if c == 0 { + c = (int32(*(*int8)(unsafe.Pointer(zNum + uintptr((18 * incr))))) - '8') + + } + return c +} + +// Convert zNum to a 64-bit signed integer. zNum must be decimal. This +// routine does *not* accept hexadecimal notation. +// +// Returns: +// +// -1 Not even a prefix of the input text looks like an integer +// 0 Successful transformation. Fits in a 64-bit signed integer. +// 1 Excess non-space text after the integer value +// 2 Integer too large for a 64-bit signed integer or is malformed +// 3 Special case of 9223372036854775808 +// +// length is the number of bytes in the string (bytes, not characters). +// The string is not necessarily zero-terminated. The encoding is +// given by enc. +func Xsqlite3Atoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32, enc U8) int32 { /* sqlite3.c:32360:20: */ + var incr int32 + var u U64 = uint64(0) + var neg int32 = 0 // assume positive + var i int32 + var c int32 = 0 + var nonNum int32 = 0 // True if input contains UTF16 with high byte non-zero + var rc int32 // Baseline return code + var zStart uintptr + var zEnd uintptr = (zNum + uintptr(length)) + + if int32(enc) == SQLITE_UTF8 { + incr = 1 + } else { + incr = 2 + length = length & (libc.CplInt32(1)) + + for i = (3 - int32(enc)); (i < length) && (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))) == 0); i = i + (2) { + } + nonNum = (libc.Bool32(i < length)) + zEnd = (zNum + uintptr((i ^ 1))) + zNum += (uintptr(int32(enc) & 1)) + } + for (zNum < zEnd) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum)))]) & 0x01) != 0) { + zNum += uintptr(incr) + } + if zNum < zEnd { + if int32(*(*int8)(unsafe.Pointer(zNum))) == '-' { + neg = 1 + zNum += uintptr(incr) + } else if int32(*(*int8)(unsafe.Pointer(zNum))) == '+' { + zNum += uintptr(incr) + } + } + zStart = zNum + for (zNum < zEnd) && (int32(*(*int8)(unsafe.Pointer(zNum))) == '0') { + zNum += uintptr(incr) + } // Skip leading zeros. + for i = 0; (((zNum + uintptr(i)) < zEnd) && ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))))) >= '0')) && (c <= '9'); i = i + (incr) { + u = (((u * uint64(10)) + U64(c)) - uint64('0')) + } + + if u > (uint64(int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) { + // This test and assignment is needed only to suppress UB warnings + // from clang and -fsanitize=undefined. This test and assignment make + // the code a little larger and slower, and no harm comes from omitting + // them, but we must appaise the undefined-behavior pharisees. + *(*I64)(unsafe.Pointer(pNum)) = func() int64 { + if neg != 0 { + return ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + } + return (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) + }() + } else if neg != 0 { + *(*I64)(unsafe.Pointer(pNum)) = -I64(u) + } else { + *(*I64)(unsafe.Pointer(pNum)) = I64(u) + } + rc = 0 + if (i == 0) && (zStart == zNum) { // No digits + rc = -1 + } else if nonNum != 0 { // UTF16 with high-order bytes non-zero + rc = 1 + } else if (zNum + uintptr(i)) < zEnd { // Extra bytes at the end + var jj int32 = i + for ok := true; ok; ok = ((zNum + uintptr(jj)) < zEnd) { + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + uintptr(jj))))]) & 0x01) != 0) { + rc = 1 // Extra non-space text after the integer + break + } + jj = jj + (incr) + } + } + if i < (19 * incr) { + // Less than 19 digits, so we know that it fits in 64 bits + + return rc + } else { + // zNum is a 19-digit numbers. Compare it against 9223372036854775808. + if i > (19 * incr) { + c = 1 + } else { + c = compare2pow63(tls, zNum, incr) + } + if c < 0 { + // zNum is less than 9223372036854775808 so it fits + + return rc + } else { + *(*I64)(unsafe.Pointer(pNum)) = func() int64 { + if neg != 0 { + return ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + } + return (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) + }() + if c > 0 { + // zNum is greater than 9223372036854775808 so it overflows + return 2 + } else { + // zNum is exactly 9223372036854775808. Fits if negative. The + // special case 2 overflow if positive + + if neg != 0 { + return rc + } + return 3 + } + } + } + return int32(0) +} + +// Transform a UTF-8 integer literal, in either decimal or hexadecimal, +// into a 64-bit signed integer. This routine accepts hexadecimal literals, +// whereas sqlite3Atoi64() does not. +// +// Returns: +// +// 0 Successful transformation. Fits in a 64-bit signed integer. +// 1 Excess text after the integer value +// 2 Integer too large for a 64-bit signed integer or is malformed +// 3 Special case of 9223372036854775808 +func Xsqlite3DecOrHexToI64(tls *libc.TLS, z uintptr, pOut uintptr) int32 { /* sqlite3.c:32463:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (int32(*(*int8)(unsafe.Pointer(z))) == '0') && + ((int32(*(*int8)(unsafe.Pointer(z + 1))) == 'x') || (int32(*(*int8)(unsafe.Pointer(z + 1))) == 'X')) { + *(*U64)(unsafe.Pointer(bp /* u */)) = uint64(0) + var i int32 + var k int32 + for i = 2; int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == '0'; i++ { + } + for k = i; (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(k))))]) & 0x08) != 0; k++ { + *(*U64)(unsafe.Pointer(bp /* u */)) = ((*(*U64)(unsafe.Pointer(bp /* u */)) * uint64(16)) + U64(Xsqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(k))))))) + } + libc.Xmemcpy(tls, pOut, bp /* &u */, uint64(8)) + if (int32(*(*int8)(unsafe.Pointer(z + uintptr(k)))) == 0) && ((k - i) <= 16) { + return 0 + } + return 2 + } else { + return Xsqlite3Atoi64(tls, z, pOut, Xsqlite3Strlen30(tls, z), uint8(SQLITE_UTF8)) + } + return int32(0) +} + +// If zNum represents an integer that will fit in 32-bits, then set +// *pValue to that integer and return true. Otherwise return false. +// +// This routine accepts both decimal and hexadecimal notation for integers. +// +// Any non-numeric characters that following zNum are ignored. +// This is different from sqlite3Atoi64() which requires the +// input number to be zero-terminated. +func Xsqlite3GetInt32(tls *libc.TLS, zNum uintptr, pValue uintptr) int32 { /* sqlite3.c:32493:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var v Sqlite_int64 = int64(0) + var i int32 + var c int32 + var neg int32 = 0 + if int32(*(*int8)(unsafe.Pointer(zNum))) == '-' { + neg = 1 + zNum++ + } else if int32(*(*int8)(unsafe.Pointer(zNum))) == '+' { + zNum++ + } else if ((int32(*(*int8)(unsafe.Pointer(zNum))) == '0') && + ((int32(*(*int8)(unsafe.Pointer(zNum + 1))) == 'x') || (int32(*(*int8)(unsafe.Pointer(zNum + 1))) == 'X'))) && + ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + 2)))]) & 0x08) != 0) { + *(*U32)(unsafe.Pointer(bp /* u */)) = U32(0) + zNum += uintptr(2) + for int32(*(*int8)(unsafe.Pointer(zNum))) == '0' { + zNum++ + } + for i = 0; ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + uintptr(i))))]) & 0x08) != 0) && (i < 8); i++ { + *(*U32)(unsafe.Pointer(bp /* u */)) = ((*(*U32)(unsafe.Pointer(bp /* u */)) * U32(16)) + U32(Xsqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i))))))) + } + if ((*(*U32)(unsafe.Pointer(bp /* u */)) & 0x80000000) == U32(0)) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum + uintptr(i))))]) & 0x08) == 0) { + libc.Xmemcpy(tls, pValue, bp /* &u */, uint64(4)) + return 1 + } else { + return 0 + } + } + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zNum)))]) & 0x04) != 0) { + return 0 + } + for int32(*(*int8)(unsafe.Pointer(zNum))) == '0' { + zNum++ + } + for i = 0; ((i < 11) && ((libc.AssignInt32(&c, (int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))) - '0'))) >= 0)) && (c <= 9); i++ { + v = ((v * int64(10)) + Sqlite_int64(c)) + } + + // The longest decimal representation of a 32 bit integer is 10 digits: + // + // 1234567890 + // 2^31 -> 2147483648 + + if i > 10 { + return 0 + } + + if (v - Sqlite_int64(neg)) > int64(2147483647) { + return 0 + } + if neg != 0 { + v = -v + } + *(*int32)(unsafe.Pointer(pValue)) = int32(v) + return 1 +} + +// Return a 32-bit integer value extracted from a string. If the +// string is not an integer, just return 0. +func Xsqlite3Atoi(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:32552:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* x */)) = 0 + Xsqlite3GetInt32(tls, z, bp /* &x */) + return *(*int32)(unsafe.Pointer(bp /* x */)) +} + +// Try to convert z into an unsigned 32-bit integer. Return true on +// success and false if there is an error. +// +// Only decimal notation is accepted. +func Xsqlite3GetUInt32(tls *libc.TLS, z uintptr, pI uintptr) int32 { /* sqlite3.c:32564:20: */ + var v U64 = uint64(0) + var i int32 + for i = 0; (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))]) & 0x04) != 0; i++ { + v = (((v * uint64(10)) + U64(*(*int8)(unsafe.Pointer(z + uintptr(i))))) - uint64('0')) + if v > uint64(4294967296) { + *(*U32)(unsafe.Pointer(pI)) = U32(0) + return 0 + } + } + if (i == 0) || (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != 0) { + *(*U32)(unsafe.Pointer(pI)) = U32(0) + return 0 + } + *(*U32)(unsafe.Pointer(pI)) = U32(v) + return 1 +} + +// The variable-length integer encoding is as follows: +// +// KEY: +// A = 0xxxxxxx 7 bits of data and one flag bit +// B = 1xxxxxxx 7 bits of data and one flag bit +// C = xxxxxxxx 8 bits of data +// +// 7 bits - A +// 14 bits - BA +// 21 bits - BBA +// 28 bits - BBBA +// 35 bits - BBBBA +// 42 bits - BBBBBA +// 49 bits - BBBBBBA +// 56 bits - BBBBBBBA +// 64 bits - BBBBBBBBC + +// Write a 64-bit variable-length integer to memory starting at p[0]. +// The length of data write will be between 1 and 9 bytes. The number +// of bytes written is returned. +// +// A variable-length integer consists of the lower 7 bits of each byte +// for all bytes that have the 8th bit set and one byte with the 8th +// bit clear. Except, if we get to the 9th byte, it stores the full +// 8 bits and is the last byte. +func putVarint64(tls *libc.TLS, p uintptr, v U64) int32 { /* sqlite3.c:32605:28: */ + bp := tls.Alloc(10) + defer tls.Free(10) + + var i int32 + var j int32 + var n int32 + // var buf [10]U8 at bp, 10 + + if (v & (U64((uint64(0xff000000))) << 32)) != 0 { + *(*uint8)(unsafe.Pointer(p + 8)) = U8(v) + v >>= 8 + for i = 7; i >= 0; i-- { + *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (U8((v & uint64(0x7f)) | uint64(0x80))) + v >>= 7 + } + return 9 + } + n = 0 + for ok := true; ok; ok = (v != uint64(0)) { + *(*U8)(unsafe.Pointer(bp /* &buf[0] */ + uintptr(libc.PostIncInt32(&n, 1)))) = (U8((v & uint64(0x7f)) | uint64(0x80))) + v >>= 7 + } + *(*U8)(unsafe.Pointer(bp /* &buf */)) &= U8((0x7f)) + + i = 0 + j = (n - 1) +__1: + if !(j >= 0) { + goto __3 + } + { + *(*uint8)(unsafe.Pointer(p + uintptr(i))) = *(*U8)(unsafe.Pointer(bp /* &buf[0] */ + uintptr(j))) + + } + goto __2 +__2: + j-- + i++ + goto __1 + goto __3 +__3: + ; + return n +} + +func Xsqlite3PutVarint(tls *libc.TLS, p uintptr, v U64) int32 { /* sqlite3.c:32629:20: */ + if v <= uint64(0x7f) { + *(*uint8)(unsafe.Pointer(p)) = (uint8(v & uint64(0x7f))) + return 1 + } + if v <= uint64(0x3fff) { + *(*uint8)(unsafe.Pointer(p)) = (uint8(((v >> 7) & uint64(0x7f)) | uint64(0x80))) + *(*uint8)(unsafe.Pointer(p + 1)) = (uint8(v & uint64(0x7f))) + return 2 + } + return putVarint64(tls, p, v) +} + +// Bitmasks used by sqlite3GetVarint(). These precomputed constants +// are defined here rather than simply putting the constant expressions +// inline in order to work around bugs in the RVT compiler. +// +// SLOT_2_0 A mask for (0x7f<<14) | 0x7f +// +// SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0 + +// Read a 64-bit variable-length integer from memory starting at p[0]. +// Return the number of bytes read. The value is stored in *v. +func Xsqlite3GetVarint(tls *libc.TLS, p uintptr, v uintptr) U8 { /* sqlite3.c:32659:19: */ + var a U32 + var b U32 + var s U32 + + if int32(*(*int8)(unsafe.Pointer((p)))) >= 0 { + *(*U64)(unsafe.Pointer(v)) = U64(*(*uint8)(unsafe.Pointer(p))) + return U8(1) + } + if int32(*(*int8)(unsafe.Pointer((p) + 1))) >= 0 { + *(*U64)(unsafe.Pointer(v)) = (U64(((U32(int32(*(*uint8)(unsafe.Pointer(p))) & 0x7f)) << 7) | U32(*(*uint8)(unsafe.Pointer(p + 1))))) + return U8(2) + } + + // Verify that constants are precomputed correctly + + a = ((U32(*(*uint8)(unsafe.Pointer(p)))) << 14) + b = U32(*(*uint8)(unsafe.Pointer(p + 1))) + p += uintptr(2) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p0<<14 | p2 (unmasked) + if !((a & U32(0x80)) != 0) { + a = a & (U32(SLOT_2_0)) + b = b & (U32(0x7f)) + b = (b << 7) + a = a | (b) + *(*U64)(unsafe.Pointer(v)) = U64(a) + return U8(3) + } + + // CSE1 from below + a = a & (U32(SLOT_2_0)) + p++ + b = (b << 14) + b = b | (U32(*(*uint8)(unsafe.Pointer(p)))) + // b: p1<<14 | p3 (unmasked) + if !((b & U32(0x80)) != 0) { + b = b & (U32(SLOT_2_0)) + // moved CSE1 up + // a &= (0x7f<<14)|(0x7f); + a = (a << 7) + a = a | (b) + *(*U64)(unsafe.Pointer(v)) = U64(a) + return U8(4) + } + + // a: p0<<14 | p2 (masked) + // b: p1<<14 | p3 (unmasked) + // 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) + // moved CSE1 up + // a &= (0x7f<<14)|(0x7f); + b = b & (U32(SLOT_2_0)) + s = a + // s: p0<<14 | p2 (masked) + + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p0<<28 | p2<<14 | p4 (unmasked) + if !((a & U32(0x80)) != 0) { + // we can skip these cause they were (effectively) done above + // while calculating s + // a &= (0x7f<<28)|(0x7f<<14)|(0x7f); + // b &= (0x7f<<14)|(0x7f); + b = (b << 7) + a = a | (b) + s = (s >> 18) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(5) + } + + // 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) + s = (s << 7) + s = s | (b) + // s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) + + p++ + b = (b << 14) + b = b | (U32(*(*uint8)(unsafe.Pointer(p)))) + // b: p1<<28 | p3<<14 | p5 (unmasked) + if !((b & U32(0x80)) != 0) { + // we can skip this cause it was (effectively) done above in calc'ing s + // b &= (0x7f<<28)|(0x7f<<14)|(0x7f); + a = a & (U32(SLOT_2_0)) + a = (a << 7) + a = a | (b) + s = (s >> 18) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(6) + } + + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p2<<28 | p4<<14 | p6 (unmasked) + if !((a & U32(0x80)) != 0) { + a = a & (SLOT_4_2_0) + b = b & (U32(SLOT_2_0)) + b = (b << 7) + a = a | (b) + s = (s >> 11) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(7) + } + + // CSE2 from below + a = a & (U32(SLOT_2_0)) + p++ + b = (b << 14) + b = b | (U32(*(*uint8)(unsafe.Pointer(p)))) + // b: p3<<28 | p5<<14 | p7 (unmasked) + if !((b & U32(0x80)) != 0) { + b = b & (SLOT_4_2_0) + // moved CSE2 up + // a &= (0x7f<<14)|(0x7f); + a = (a << 7) + a = a | (b) + s = (s >> 4) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(8) + } + + p++ + a = (a << 15) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p4<<29 | p6<<15 | p8 (unmasked) + + // moved CSE2 up + // a &= (0x7f<<29)|(0x7f<<15)|(0xff); + b = b & (U32(SLOT_2_0)) + b = (b << 8) + a = a | (b) + + s = (s << 4) + b = U32(*(*uint8)(unsafe.Pointer(p + libc.UintptrFromInt32(-4)))) + b = b & (U32(0x7f)) + b = (b >> 3) + s = s | (b) + + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + + return U8(9) +} + +// Read a 32-bit variable-length integer from memory starting at p[0]. +// Return the number of bytes read. The value is stored in *v. +// +// If the varint stored in p[0] is larger than can fit in a 32-bit unsigned +// integer, then set *v to 0xffffffff. +// +// A MACRO version, getVarint32, is provided which inlines the +// single-byte case. All code should use the MACRO version as +// this function assumes the single-byte case has already been handled. +func Xsqlite3GetVarint32(tls *libc.TLS, p uintptr, v uintptr) U8 { /* sqlite3.c:32820:19: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var a U32 + var b U32 + + // The 1-byte case. Overwhelmingly the most common. Handled inline + // by the getVarin32() macro + a = U32(*(*uint8)(unsafe.Pointer(p))) + // a: p0 (unmasked) + + // The 2-byte case + p++ + b = U32(*(*uint8)(unsafe.Pointer(p))) + // b: p1 (unmasked) + if !((b & U32(0x80)) != 0) { + // Values between 128 and 16383 + a = a & (U32(0x7f)) + a = (a << 7) + *(*U32)(unsafe.Pointer(v)) = (a | b) + return U8(2) + } + + // The 3-byte case + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p0<<14 | p2 (unmasked) + if !((a & U32(0x80)) != 0) { + // Values between 16384 and 2097151 + a = a & (U32((int32(0x7f) << 14) | (0x7f))) + b = b & (U32(0x7f)) + b = (b << 7) + *(*U32)(unsafe.Pointer(v)) = (a | b) + return U8(3) + } + + /* A 32-bit varint is used to store size information in btrees. + ** Objects are rarely larger than 2MiB limit of a 3-byte varint. + ** A 3-byte varint is sufficient, for example, to record the size + ** of a 1048569-byte BLOB or string. + ** + ** We only unroll the first 1-, 2-, and 3- byte cases. The very + ** rare larger cases can be handled by the slower 64-bit varint + ** routine. + */ + { + // var v64 U64 at bp, 8 + + var n U8 + + n = Xsqlite3GetVarint(tls, (p - uintptr(2)), bp /* &v64 */) + + if (*(*U64)(unsafe.Pointer(bp /* v64 */)) & ((U64((uint64(1))) << 32) - uint64(1))) != *(*U64)(unsafe.Pointer(bp /* v64 */)) { + *(*U32)(unsafe.Pointer(v)) = 0xffffffff + } else { + *(*U32)(unsafe.Pointer(v)) = U32(*(*U64)(unsafe.Pointer(bp /* v64 */))) + } + return n + + } + return U8(0) + +} + +// Return the number of bytes that will be needed to store the given +// 64-bit integer. +func Xsqlite3VarintLen(tls *libc.TLS, v U64) int32 { /* sqlite3.c:32942:20: */ + var i int32 + for i = 1; (libc.AssignShrUint64(&v, int(uint64(7)))) != uint64(0); i++ { + } + return i +} + +// Read or write a four-byte big-endian integer value. +func Xsqlite3Get4byte(tls *libc.TLS, p uintptr) U32 { /* sqlite3.c:32952:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var x U32 at bp, 4 + + libc.Xmemcpy(tls, bp /* &x */, p, uint64(4)) + return libc.X__builtin_bswap32(tls, *(*U32)(unsafe.Pointer(bp /* x */))) +} + +func Xsqlite3Put4byte(tls *libc.TLS, p uintptr, v U32) { /* sqlite3.c:32970:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*U32)(unsafe.Pointer(bp /* x */)) = libc.X__builtin_bswap32(tls, v) + libc.Xmemcpy(tls, p, bp /* &x */, uint64(4)) +} + +// Translate a single byte of Hex into an integer. +// This routine only works if h really is a valid hexadecimal +// character: 0..9a..fA..F +func Xsqlite3HexToInt(tls *libc.TLS, h int32) U8 { /* sqlite3.c:32994:19: */ + + h = h + (9 * (1 & (h >> 6))) + return (U8(h & 0xf)) +} + +// Convert a BLOB literal of the form "x'hhhhhh'" into its binary +// value. Return a pointer to its binary value. Space to hold the +// binary value has been obtained from malloc and must be freed by +// the calling routine. +func Xsqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) uintptr { /* sqlite3.c:33012:21: */ + var zBlob uintptr + var i int32 + + zBlob = Xsqlite3DbMallocRawNN(tls, db, (uint64((n / 2) + 1))) + n-- + if zBlob != 0 { + for i = 0; i < n; i = i + (2) { + *(*int8)(unsafe.Pointer(zBlob + uintptr((i / 2)))) = (int8((int32(Xsqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))))) << 4) | int32(Xsqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + uintptr((i + 1))))))))) + } + *(*int8)(unsafe.Pointer(zBlob + uintptr((i / 2)))) = int8(0) + } + return zBlob +} + +// Log an error that is an API call on a connection pointer that should +// not have been used. The "type" of connection pointer is given as the +// argument. The zType is a word like "NULL" or "closed" or "invalid". +func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + Xsqlite3_log(tls, SQLITE_MISUSE, + ts+811, /* "API call with %s..." */ + libc.VaList(bp, zType)) +} + +// Check to make sure we have a valid db pointer. This test is not +// foolproof but it does provide some measure of protection against +// misuse of the interface such as passing in db pointers that are +// NULL or which have been previously closed. If this routine returns +// 1 it means that the db pointer is valid and 0 if it should not be +// dereferenced for any reason. The calling function should invoke +// SQLITE_MISUSE immediately. +// +// sqlite3SafetyCheckOk() requires that the db pointer be valid for +// use. sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to +// open properly and is not fit for general use but which can be +// used as an argument to sqlite3_errmsg() or sqlite3_close(). +func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ + var magic U32 + if db == uintptr(0) { + logBadConnection(tls, ts+757 /* "NULL" */) + return 0 + } + magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic + if magic != SQLITE_MAGIC_OPEN { + if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { + + logBadConnection(tls, ts+856 /* "unopened" */) + } + return 0 + } else { + return 1 + } + return int32(0) +} + +func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33071:20: */ + var magic U32 + magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic + if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { + + logBadConnection(tls, ts+865 /* "invalid" */) + return 0 + } else { + return 1 + } + return int32(0) +} + +// Attempt to add, substract, or multiply the 64-bit signed value iB against +// the other 64-bit signed integer at *pA and store the result in *pA. +// Return 0 on success. Or if the operation would have resulted in an +// overflow, leave *pA unchanged and return 1. +func Xsqlite3AddInt64(tls *libc.TLS, pA uintptr, iB I64) int32 { /* sqlite3.c:33091:20: */ + return libc.X__builtin_add_overflowInt64(tls, *(*I64)(unsafe.Pointer(pA)), iB, pA) +} + +func Xsqlite3SubInt64(tls *libc.TLS, pA uintptr, iB I64) int32 { /* sqlite3.c:33111:20: */ + return libc.X__builtin_sub_overflowInt64(tls, *(*I64)(unsafe.Pointer(pA)), iB, pA) +} + +func Xsqlite3MulInt64(tls *libc.TLS, pA uintptr, iB I64) int32 { /* sqlite3.c:33126:20: */ + return libc.X__builtin_mul_overflowInt64(tls, *(*I64)(unsafe.Pointer(pA)), iB, pA) +} + +// Compute the absolute value of a 32-bit signed integer, of possible. Or +// if the integer has a value of -2147483648, return +2147483647 +func Xsqlite3AbsInt32(tls *libc.TLS, x int32) int32 { /* sqlite3.c:33152:20: */ + if x >= 0 { + return x + } + if x == libc.Int32FromUint32(0x80000000) { + return 0x7fffffff + } + return -x +} + +// Find (an approximate) sum of two LogEst values. This computation is +// not a simple "+" operator because LogEst is stored as a logarithmic +// value. +// +func Xsqlite3LogEstAdd(tls *libc.TLS, a LogEst, b LogEst) LogEst { /* sqlite3.c:33195:23: */ + if int32(a) >= int32(b) { + if int32(a) > (int32(b) + 49) { + return a + } + if int32(a) > (int32(b) + 31) { + return (LogEst(int32(a) + 1)) + } + return (LogEst(int32(a) + int32(x[(int32(a)-int32(b))]))) + } else { + if int32(b) > (int32(a) + 49) { + return b + } + if int32(b) > (int32(a) + 31) { + return (LogEst(int32(b) + 1)) + } + return (LogEst(int32(b) + int32(x[(int32(b)-int32(a))]))) + } + return LogEst(0) +} + +var x = [32]uint8{ + uint8(10), uint8(10), // 0,1 + uint8(9), uint8(9), // 2,3 + uint8(8), uint8(8), // 4,5 + uint8(7), uint8(7), uint8(7), // 6,7,8 + uint8(6), uint8(6), uint8(6), // 9,10,11 + uint8(5), uint8(5), uint8(5), // 12-14 + uint8(4), uint8(4), uint8(4), uint8(4), // 15-18 + uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), // 19-24 + uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), // 25-31 +} /* sqlite3.c:33196:30 */ + +// Convert an integer into a LogEst. In other words, compute an +// approximation for 10*log2(x). +func Xsqlite3LogEst(tls *libc.TLS, x U64) LogEst { /* sqlite3.c:33222:23: */ + var y LogEst = int16(40) + if x < uint64(8) { + if x < uint64(2) { + return int16(0) + } + for x < uint64(8) { + y = int16(int32(y) - (10)) + x <<= 1 + } + } else { + var i int32 = (60 - libc.X__builtin_clzll(tls, x)) + y = LogEst(int32(y) + (i * 10)) + x >>= i + } + return (LogEst((int32(a[(x&uint64(7))]) + int32(y)) - 10)) +} + +var a = [8]LogEst{int16(0), int16(2), int16(3), int16(5), int16(6), int16(7), int16(8), int16(9)} /* sqlite3.c:33223:17 */ + +// Convert a double into a LogEst +// In other words, compute an approximation for 10*log2(x). +func Xsqlite3LogEstFromDouble(tls *libc.TLS, x float64) LogEst { /* sqlite3.c:33246:23: */ + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp + 8)) = x + + // var a U64 at bp, 8 + + var e LogEst + + if *(*float64)(unsafe.Pointer(bp + 8 /* x */)) <= float64(1) { + return int16(0) + } + if *(*float64)(unsafe.Pointer(bp + 8 /* x */)) <= float64(2000000000) { + return Xsqlite3LogEst(tls, U64(*(*float64)(unsafe.Pointer(bp + 8 /* x */)))) + } + libc.Xmemcpy(tls, bp /* &a */, bp+8 /* &x */, uint64(8)) + e = (LogEst((*(*U64)(unsafe.Pointer(bp /* a */)) >> 52) - uint64(1022))) + return (LogEst(int32(e) * 10)) +} + +// Convert a LogEst into an integer. +// +// Note that this routine is only used when one or more of various +// non-standard compile-time options is enabled. +func Xsqlite3LogEstToInt(tls *libc.TLS, x LogEst) U64 { /* sqlite3.c:33267:20: */ + var n U64 + n = (U64(int32(x) % 10)) + x = int16(int32(x) / (10)) + if n >= uint64(5) { + n = n - (uint64(2)) + } else if n >= uint64(1) { + n = n - (uint64(1)) + } + // If only SQLITE_ENABLE_STAT4 is on, then the largest input + // possible to this routine is 310, resulting in a maximum x of 31 + + if int32(x) >= 3 { + return ((n + uint64(8)) << (int32(x) - 3)) + } + return ((n + uint64(8)) >> (3 - int32(x))) +} + +// Add a new name/number pair to a VList. This might require that the +// VList object be reallocated, so return the new VList. If an OOM +// error occurs, the original VList returned and the +// db->mallocFailed flag is set. +// +// A VList is really just an array of integers. To destroy a VList, +// simply pass it to sqlite3DbFree(). +// +// The first integer is the number of integers allocated for the whole +// VList. The second integer is the number of integers actually used. +// Each name/number pair is encoded by subsequent groups of 3 or more +// integers. +// +// Each name/number pair starts with two integers which are the numeric +// value for the pair and the size of the name/number pair, respectively. +// The text name overlays one or more following integers. The text name +// is always zero-terminated. +// +// Conceptually: +// +// struct VList { +// int nAlloc; // Number of allocated slots +// int nUsed; // Number of used slots +// struct VListEntry { +// int iValue; // Value for this entry +// int nSlot; // Slots used by this entry +// // ... variable name goes here +// } a[0]; +// } +// +// During code generation, pointers to the variable names within the +// VList are taken. When that happens, nAlloc is set to zero as an +// indication that the VList may never again be enlarged, since the +// accompanying realloc() would invalidate the pointers. +func Xsqlite3VListAdd(tls *libc.TLS, db uintptr, pIn uintptr, zName uintptr, nName int32, iVal int32) uintptr { /* sqlite3.c:33321:22: */ + var nInt int32 // number of sizeof(int) objects needed for zName + var z uintptr // Pointer to where zName will be stored + var i int32 // Index in pIn[] where zName is stored + + nInt = ((nName / 4) + 3) + // Verify ok to add new elements + if (pIn == uintptr(0)) || ((*(*VList)(unsafe.Pointer(pIn + 1*4)) + nInt) > *(*VList)(unsafe.Pointer(pIn))) { + // Enlarge the allocation + var nAlloc Sqlite3_int64 = ((func() int64 { + if pIn != 0 { + return (int64(2) * Sqlite3_int64(*(*VList)(unsafe.Pointer(pIn)))) + } + return int64(10) + }()) + Sqlite3_int64(nInt)) + var pOut uintptr = Xsqlite3DbRealloc(tls, db, pIn, (uint64(nAlloc) * uint64(unsafe.Sizeof(int32(0))))) + if pOut == uintptr(0) { + return pIn + } + if pIn == uintptr(0) { + *(*VList)(unsafe.Pointer(pOut + 1*4)) = 2 + } + pIn = pOut + *(*VList)(unsafe.Pointer(pIn)) = VList(nAlloc) + } + i = *(*VList)(unsafe.Pointer(pIn + 1*4)) + *(*VList)(unsafe.Pointer(pIn + uintptr(i)*4)) = iVal + *(*VList)(unsafe.Pointer(pIn + uintptr((i+1))*4)) = nInt + z = (pIn + uintptr((i+2))*4) + *(*VList)(unsafe.Pointer(pIn + 1*4)) = (i + nInt) + + libc.Xmemcpy(tls, z, zName, uint64(nName)) + *(*int8)(unsafe.Pointer(z + uintptr(nName))) = int8(0) + return pIn +} + +// Return a pointer to the name of a variable in the given VList that +// has the value iVal. Or return a NULL if there is no such variable in +// the list +func Xsqlite3VListNumToName(tls *libc.TLS, pIn uintptr, iVal int32) uintptr { /* sqlite3.c:33359:27: */ + var i int32 + var mx int32 + if pIn == uintptr(0) { + return uintptr(0) + } + mx = *(*VList)(unsafe.Pointer(pIn + 1*4)) + i = 2 + for ok := true; ok; ok = (i < mx) { + if *(*VList)(unsafe.Pointer(pIn + uintptr(i)*4)) == iVal { + return (pIn + uintptr((i+2))*4) + } + i = i + (*(*VList)(unsafe.Pointer(pIn + uintptr((i+1))*4))) + } + return uintptr(0) +} + +// Return the number of the variable named zName, if it is in VList. +// or return 0 if there is no such variable. +func Xsqlite3VListNameToNum(tls *libc.TLS, pIn uintptr, zName uintptr, nName int32) int32 { /* sqlite3.c:33375:20: */ + var i int32 + var mx int32 + if pIn == uintptr(0) { + return 0 + } + mx = *(*VList)(unsafe.Pointer(pIn + 1*4)) + i = 2 + for ok := true; ok; ok = (i < mx) { + var z uintptr = (pIn + uintptr((i+2))*4) + if (libc.Xstrncmp(tls, z, zName, uint64(nName)) == 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(nName)))) == 0) { + return *(*VList)(unsafe.Pointer(pIn + uintptr(i)*4)) + } + i = i + (*(*VList)(unsafe.Pointer(pIn + uintptr((i+1))*4))) + } + return 0 +} + +//************* End of util.c *********************************************** +//************* Begin file hash.c ******************************************* +// 2001 September 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the implementation of generic hash-tables +// used in SQLite. +// #include "sqliteInt.h" +// #include + +// Turn bulk memory into a hash table object by initializing the +// fields of the Hash structure. +// +// "pNew" is a pointer to the hash table that is to be initialized. +func Xsqlite3HashInit(tls *libc.TLS, pNew uintptr) { /* sqlite3.c:33412:21: */ + + (*Hash)(unsafe.Pointer(pNew)).Ffirst = uintptr(0) + (*Hash)(unsafe.Pointer(pNew)).Fcount = uint32(0) + (*Hash)(unsafe.Pointer(pNew)).Fhtsize = uint32(0) + (*Hash)(unsafe.Pointer(pNew)).Fht = uintptr(0) +} + +// Remove all entries from a hash table. Reclaim all memory. +// Call this routine to delete a hash table or to reset a hash table +// to the empty state. +func Xsqlite3HashClear(tls *libc.TLS, pH uintptr) { /* sqlite3.c:33424:21: */ + var elem uintptr // For looping over all elements of the table + + elem = (*Hash)(unsafe.Pointer(pH)).Ffirst + (*Hash)(unsafe.Pointer(pH)).Ffirst = uintptr(0) + Xsqlite3_free(tls, (*Hash)(unsafe.Pointer(pH)).Fht) + (*Hash)(unsafe.Pointer(pH)).Fht = uintptr(0) + (*Hash)(unsafe.Pointer(pH)).Fhtsize = uint32(0) + for elem != 0 { + var next_elem uintptr = (*HashElem)(unsafe.Pointer(elem)).Fnext + Xsqlite3_free(tls, elem) + elem = next_elem + } + (*Hash)(unsafe.Pointer(pH)).Fcount = uint32(0) +} + +// The hashing function. +func strHash(tls *libc.TLS, z uintptr) uint32 { /* sqlite3.c:33444:21: */ + var h uint32 = uint32(0) + var c uint8 + for (int32(libc.AssignUint8(&c, uint8(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))))) != 0 { //OPTIMIZATION-IF-TRUE + // Knuth multiplicative hashing. (Sorting & Searching, p. 510). + // 0x9e3779b1 is 2654435761 which is the closest prime number to + // (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. + h = h + (uint32(Xsqlite3UpperToLower[c])) + h = h * (0x9e3779b1) + } + return h +} + +// Link pNew element into the hash table pH. If pEntry!=0 then also +// insert pNew into the pEntry hash bucket. +func insertElement(tls *libc.TLS, pH uintptr, pEntry uintptr, pNew uintptr) { /* sqlite3.c:33461:13: */ + var pHead uintptr // First element already in pEntry + if pEntry != 0 { + if (*_ht)(unsafe.Pointer(pEntry)).Fcount != 0 { + pHead = (*_ht)(unsafe.Pointer(pEntry)).Fchain + } else { + pHead = uintptr(0) + } + (*_ht)(unsafe.Pointer(pEntry)).Fcount++ + (*_ht)(unsafe.Pointer(pEntry)).Fchain = pNew + } else { + pHead = uintptr(0) + } + if pHead != 0 { + (*HashElem)(unsafe.Pointer(pNew)).Fnext = pHead + (*HashElem)(unsafe.Pointer(pNew)).Fprev = (*HashElem)(unsafe.Pointer(pHead)).Fprev + if (*HashElem)(unsafe.Pointer(pHead)).Fprev != 0 { + (*HashElem)(unsafe.Pointer((*HashElem)(unsafe.Pointer(pHead)).Fprev)).Fnext = pNew + } else { + (*Hash)(unsafe.Pointer(pH)).Ffirst = pNew + } + (*HashElem)(unsafe.Pointer(pHead)).Fprev = pNew + } else { + (*HashElem)(unsafe.Pointer(pNew)).Fnext = (*Hash)(unsafe.Pointer(pH)).Ffirst + if (*Hash)(unsafe.Pointer(pH)).Ffirst != 0 { + (*HashElem)(unsafe.Pointer((*Hash)(unsafe.Pointer(pH)).Ffirst)).Fprev = pNew + } + (*HashElem)(unsafe.Pointer(pNew)).Fprev = uintptr(0) + (*Hash)(unsafe.Pointer(pH)).Ffirst = pNew + } +} + +// Resize the hash table so that it cantains "new_size" buckets. +// +// The hash table might fail to resize if sqlite3_malloc() fails or +// if the new size is the same as the prior size. +// Return TRUE if the resize occurs and false if not. +func rehash(tls *libc.TLS, pH uintptr, new_size uint32) int32 { /* sqlite3.c:33495:12: */ + var new_ht uintptr // The new hash table + var elem uintptr + var next_elem uintptr // For looping over existing elements + + if (uint64(new_size) * uint64(unsafe.Sizeof(_ht{}))) > uint64(SQLITE_MALLOC_SOFT_LIMIT) { + new_size = (uint32(uint64(SQLITE_MALLOC_SOFT_LIMIT) / uint64(unsafe.Sizeof(_ht{})))) + } + if new_size == (*Hash)(unsafe.Pointer(pH)).Fhtsize { + return 0 + } + + // The inability to allocates space for a larger hash table is + // a performance hit but it is not a fatal error. So mark the + // allocation as a benign. Use sqlite3Malloc()/memset(0) instead of + // sqlite3MallocZero() to make the allocation, as sqlite3MallocZero() + // only zeroes the requested number of bytes whereas this module will + // use the actual amount of space allocated for the hash table (which + // may be larger than the requested amount). + Xsqlite3BeginBenignMalloc(tls) + new_ht = Xsqlite3Malloc(tls, (uint64(uint64(new_size) * uint64(unsafe.Sizeof(_ht{}))))) + Xsqlite3EndBenignMalloc(tls) + + if new_ht == uintptr(0) { + return 0 + } + Xsqlite3_free(tls, (*Hash)(unsafe.Pointer(pH)).Fht) + (*Hash)(unsafe.Pointer(pH)).Fht = new_ht + (*Hash)(unsafe.Pointer(pH)).Fhtsize = libc.AssignUint32(&new_size, (uint32(uint64(Xsqlite3MallocSize(tls, new_ht)) / uint64(unsafe.Sizeof(_ht{}))))) + libc.Xmemset(tls, new_ht, 0, (uint64(new_size) * uint64(unsafe.Sizeof(_ht{})))) + elem = (*Hash)(unsafe.Pointer(pH)).Ffirst + (*Hash)(unsafe.Pointer(pH)).Ffirst = uintptr(0) + for ; elem != 0; elem = next_elem { + var h uint32 = (strHash(tls, (*HashElem)(unsafe.Pointer(elem)).FpKey) % new_size) + next_elem = (*HashElem)(unsafe.Pointer(elem)).Fnext + insertElement(tls, pH, (new_ht + uintptr(h)*16), elem) + } + return 1 +} + +// This function (for internal use only) locates an element in an +// hash table that matches the given key. If no element is found, +// a pointer to a static null element with HashElem.data==0 is returned. +// If pH is not NULL, then the hash for this key is written to *pH. +func findElementWithHash(tls *libc.TLS, pH uintptr, pKey uintptr, pHash uintptr) uintptr { /* sqlite3.c:33536:17: */ + var elem uintptr // Used to loop thru the element list + var count uint32 // Number of elements left to test + var h uint32 + + if (*Hash)(unsafe.Pointer(pH)).Fht != 0 { //OPTIMIZATION-IF-TRUE + var pEntry uintptr + h = (strHash(tls, pKey) % (*Hash)(unsafe.Pointer(pH)).Fhtsize) + pEntry = ((*Hash)(unsafe.Pointer(pH)).Fht + uintptr(h)*16) + elem = (*_ht)(unsafe.Pointer(pEntry)).Fchain + count = (*_ht)(unsafe.Pointer(pEntry)).Fcount + } else { + h = uint32(0) + elem = (*Hash)(unsafe.Pointer(pH)).Ffirst + count = (*Hash)(unsafe.Pointer(pH)).Fcount + } + if pHash != 0 { + *(*uint32)(unsafe.Pointer(pHash)) = h + } + for libc.PostDecUint32(&count, 1) != 0 { + + if Xsqlite3StrICmp(tls, (*HashElem)(unsafe.Pointer(elem)).FpKey, pKey) == 0 { + return elem + } + elem = (*HashElem)(unsafe.Pointer(elem)).Fnext + } + return uintptr(unsafe.Pointer(&nullElement)) +} + +var nullElement = HashElem{} /* sqlite3.c:33544:19 */ + +// Remove a single entry from the hash table given a pointer to that +// element and a hash on the element's key. +func removeElementGivenHash(tls *libc.TLS, pH uintptr, elem uintptr, h uint32) { /* sqlite3.c:33571:13: */ + var pEntry uintptr + if (*HashElem)(unsafe.Pointer(elem)).Fprev != 0 { + (*HashElem)(unsafe.Pointer((*HashElem)(unsafe.Pointer(elem)).Fprev)).Fnext = (*HashElem)(unsafe.Pointer(elem)).Fnext + } else { + (*Hash)(unsafe.Pointer(pH)).Ffirst = (*HashElem)(unsafe.Pointer(elem)).Fnext + } + if (*HashElem)(unsafe.Pointer(elem)).Fnext != 0 { + (*HashElem)(unsafe.Pointer((*HashElem)(unsafe.Pointer(elem)).Fnext)).Fprev = (*HashElem)(unsafe.Pointer(elem)).Fprev + } + if (*Hash)(unsafe.Pointer(pH)).Fht != 0 { + pEntry = ((*Hash)(unsafe.Pointer(pH)).Fht + uintptr(h)*16) + if (*_ht)(unsafe.Pointer(pEntry)).Fchain == elem { + (*_ht)(unsafe.Pointer(pEntry)).Fchain = (*HashElem)(unsafe.Pointer(elem)).Fnext + } + + (*_ht)(unsafe.Pointer(pEntry)).Fcount-- + } + Xsqlite3_free(tls, elem) + (*Hash)(unsafe.Pointer(pH)).Fcount-- + if (*Hash)(unsafe.Pointer(pH)).Fcount == uint32(0) { + + Xsqlite3HashClear(tls, pH) + } +} + +// Attempt to locate an element of the hash table pH with a key +// that matches pKey. Return the data for this element if it is +// found, or NULL if there is no match. +func Xsqlite3HashFind(tls *libc.TLS, pH uintptr, pKey uintptr) uintptr { /* sqlite3.c:33606:21: */ + + return (*HashElem)(unsafe.Pointer(findElementWithHash(tls, pH, pKey, uintptr(0)))).Fdata +} + +// Insert an element into the hash table pH. The key is pKey +// and the data is "data". +// +// If no element exists with a matching key, then a new +// element is created and NULL is returned. +// +// If another element already exists with the same key, then the +// new data replaces the old data and the old data is returned. +// The key is not copied in this instance. If a malloc fails, then +// the new data is returned and the hash table is unchanged. +// +// If the "data" parameter to this function is NULL, then the +// element corresponding to "key" is removed from the hash table. +func Xsqlite3HashInsert(tls *libc.TLS, pH uintptr, pKey uintptr, data uintptr) uintptr { /* sqlite3.c:33626:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var h uint32 at bp, 4 + // the hash of the key modulo hash table size + var elem uintptr // Used to loop thru the element list + var new_elem uintptr // New element added to the pH + + elem = findElementWithHash(tls, pH, pKey, bp /* &h */) + if (*HashElem)(unsafe.Pointer(elem)).Fdata != 0 { + var old_data uintptr = (*HashElem)(unsafe.Pointer(elem)).Fdata + if data == uintptr(0) { + removeElementGivenHash(tls, pH, elem, *(*uint32)(unsafe.Pointer(bp /* h */))) + } else { + (*HashElem)(unsafe.Pointer(elem)).Fdata = data + (*HashElem)(unsafe.Pointer(elem)).FpKey = pKey + } + return old_data + } + if data == uintptr(0) { + return uintptr(0) + } + new_elem = Xsqlite3Malloc(tls, uint64(unsafe.Sizeof(HashElem{}))) + if new_elem == uintptr(0) { + return data + } + (*HashElem)(unsafe.Pointer(new_elem)).FpKey = pKey + (*HashElem)(unsafe.Pointer(new_elem)).Fdata = data + (*Hash)(unsafe.Pointer(pH)).Fcount++ + if ((*Hash)(unsafe.Pointer(pH)).Fcount >= uint32(10)) && ((*Hash)(unsafe.Pointer(pH)).Fcount > (uint32(2) * (*Hash)(unsafe.Pointer(pH)).Fhtsize)) { + if rehash(tls, pH, ((*Hash)(unsafe.Pointer(pH)).Fcount*uint32(2))) != 0 { + + *(*uint32)(unsafe.Pointer(bp /* h */)) = (strHash(tls, pKey) % (*Hash)(unsafe.Pointer(pH)).Fhtsize) + } + } + insertElement(tls, pH, func() uintptr { + if (*Hash)(unsafe.Pointer(pH)).Fht != 0 { + return ((*Hash)(unsafe.Pointer(pH)).Fht + uintptr(*(*uint32)(unsafe.Pointer(bp /* h */)))*16) + } + return uintptr(0) + }(), new_elem) + return uintptr(0) +} + +//************* End of hash.c *********************************************** +//************* Begin file opcodes.c **************************************** +// Automatically generated. Do not edit +// See the tool/mkopcodec.tcl script for details. +func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: */ + return azName[i] +} + +var azName = [180]uintptr{ + /* 0 */ ts + 873, /* "Savepoint" */ + /* 1 */ ts + 883, /* "AutoCommit" */ + /* 2 */ ts + 894, /* "Transaction" */ + /* 3 */ ts + 906, /* "SorterNext" */ + /* 4 */ ts + 917, /* "Prev" */ + /* 5 */ ts + 922, /* "Next" */ + /* 6 */ ts + 927, /* "Checkpoint" */ + /* 7 */ ts + 938, /* "JournalMode" */ + /* 8 */ ts + 950, /* "Vacuum" */ + /* 9 */ ts + 957, /* "VFilter" */ + /* 10 */ ts + 965, /* "VUpdate" */ + /* 11 */ ts + 973, /* "Goto" */ + /* 12 */ ts + 978, /* "Gosub" */ + /* 13 */ ts + 984, /* "InitCoroutine" */ + /* 14 */ ts + 998, /* "Yield" */ + /* 15 */ ts + 1004, /* "MustBeInt" */ + /* 16 */ ts + 1014, /* "Jump" */ + /* 17 */ ts + 1019, /* "Once" */ + /* 18 */ ts + 1024, /* "If" */ + /* 19 */ ts + 1027, /* "Not" */ + /* 20 */ ts + 1031, /* "IfNot" */ + /* 21 */ ts + 1037, /* "IfNullRow" */ + /* 22 */ ts + 1047, /* "SeekLT" */ + /* 23 */ ts + 1054, /* "SeekLE" */ + /* 24 */ ts + 1061, /* "SeekGE" */ + /* 25 */ ts + 1068, /* "SeekGT" */ + /* 26 */ ts + 1075, /* "IfNotOpen" */ + /* 27 */ ts + 1085, /* "IfNoHope" */ + /* 28 */ ts + 1094, /* "NoConflict" */ + /* 29 */ ts + 1105, /* "NotFound" */ + /* 30 */ ts + 1114, /* "Found" */ + /* 31 */ ts + 1120, /* "SeekRowid" */ + /* 32 */ ts + 1130, /* "NotExists" */ + /* 33 */ ts + 1140, /* "Last" */ + /* 34 */ ts + 1145, /* "IfSmaller" */ + /* 35 */ ts + 1155, /* "SorterSort" */ + /* 36 */ ts + 1166, /* "Sort" */ + /* 37 */ ts + 1171, /* "Rewind" */ + /* 38 */ ts + 1178, /* "IdxLE" */ + /* 39 */ ts + 1184, /* "IdxGT" */ + /* 40 */ ts + 1190, /* "IdxLT" */ + /* 41 */ ts + 1196, /* "IdxGE" */ + /* 42 */ ts + 1202, /* "RowSetRead" */ + /* 43 */ ts + 1213, /* "Or" */ + /* 44 */ ts + 1216, /* "And" */ + /* 45 */ ts + 1220, /* "RowSetTest" */ + /* 46 */ ts + 1231, /* "Program" */ + /* 47 */ ts + 1239, /* "FkIfZero" */ + /* 48 */ ts + 1248, /* "IfPos" */ + /* 49 */ ts + 1254, /* "IfNotZero" */ + /* 50 */ ts + 1264, /* "IsNull" */ + /* 51 */ ts + 1271, /* "NotNull" */ + /* 52 */ ts + 1279, /* "Ne" */ + /* 53 */ ts + 1282, /* "Eq" */ + /* 54 */ ts + 1285, /* "Gt" */ + /* 55 */ ts + 1288, /* "Le" */ + /* 56 */ ts + 1291, /* "Lt" */ + /* 57 */ ts + 1294, /* "Ge" */ + /* 58 */ ts + 1297, /* "ElseEq" */ + /* 59 */ ts + 1304, /* "DecrJumpZero" */ + /* 60 */ ts + 1317, /* "IncrVacuum" */ + /* 61 */ ts + 1328, /* "VNext" */ + /* 62 */ ts + 1334, /* "Init" */ + /* 63 */ ts + 1339, /* "PureFunc" */ + /* 64 */ ts + 1348, /* "Function" */ + /* 65 */ ts + 1357, /* "Return" */ + /* 66 */ ts + 1364, /* "EndCoroutine" */ + /* 67 */ ts + 1377, /* "HaltIfNull" */ + /* 68 */ ts + 1388, /* "Halt" */ + /* 69 */ ts + 1393, /* "Integer" */ + /* 70 */ ts + 1401, /* "Int64" */ + /* 71 */ ts + 1407, /* "String" */ + /* 72 */ ts + 1414, /* "Null" */ + /* 73 */ ts + 1419, /* "SoftNull" */ + /* 74 */ ts + 1428, /* "Blob" */ + /* 75 */ ts + 1433, /* "Variable" */ + /* 76 */ ts + 1442, /* "Move" */ + /* 77 */ ts + 1447, /* "Copy" */ + /* 78 */ ts + 1452, /* "SCopy" */ + /* 79 */ ts + 1458, /* "IntCopy" */ + /* 80 */ ts + 1466, /* "ChngCntRow" */ + /* 81 */ ts + 1477, /* "ResultRow" */ + /* 82 */ ts + 1487, /* "CollSeq" */ + /* 83 */ ts + 1495, /* "AddImm" */ + /* 84 */ ts + 1502, /* "RealAffinity" */ + /* 85 */ ts + 1515, /* "Cast" */ + /* 86 */ ts + 1520, /* "Permutation" */ + /* 87 */ ts + 1532, /* "Compare" */ + /* 88 */ ts + 1540, /* "IsTrue" */ + /* 89 */ ts + 1547, /* "ZeroOrNull" */ + /* 90 */ ts + 1558, /* "Offset" */ + /* 91 */ ts + 1565, /* "Column" */ + /* 92 */ ts + 1572, /* "Affinity" */ + /* 93 */ ts + 1581, /* "MakeRecord" */ + /* 94 */ ts + 1592, /* "Count" */ + /* 95 */ ts + 1598, /* "ReadCookie" */ + /* 96 */ ts + 1609, /* "SetCookie" */ + /* 97 */ ts + 1619, /* "ReopenIdx" */ + /* 98 */ ts + 1629, /* "OpenRead" */ + /* 99 */ ts + 1638, /* "OpenWrite" */ + /* 100 */ ts + 1648, /* "OpenDup" */ + /* 101 */ ts + 1656, /* "OpenAutoindex" */ + /* 102 */ ts + 1670, /* "BitAnd" */ + /* 103 */ ts + 1677, /* "BitOr" */ + /* 104 */ ts + 1683, /* "ShiftLeft" */ + /* 105 */ ts + 1693, /* "ShiftRight" */ + /* 106 */ ts + 1704, /* "Add" */ + /* 107 */ ts + 1708, /* "Subtract" */ + /* 108 */ ts + 1717, /* "Multiply" */ + /* 109 */ ts + 1726, /* "Divide" */ + /* 110 */ ts + 1733, /* "Remainder" */ + /* 111 */ ts + 1743, /* "Concat" */ + /* 112 */ ts + 1750, /* "OpenEphemeral" */ + /* 113 */ ts + 1764, /* "BitNot" */ + /* 114 */ ts + 1771, /* "SorterOpen" */ + /* 115 */ ts + 1782, /* "SequenceTest" */ + /* 116 */ ts + 1795, /* "String8" */ + /* 117 */ ts + 1803, /* "OpenPseudo" */ + /* 118 */ ts + 1814, /* "Close" */ + /* 119 */ ts + 1820, /* "ColumnsUsed" */ + /* 120 */ ts + 1832, /* "SeekScan" */ + /* 121 */ ts + 1841, /* "SeekHit" */ + /* 122 */ ts + 1849, /* "Sequence" */ + /* 123 */ ts + 1858, /* "NewRowid" */ + /* 124 */ ts + 1867, /* "Insert" */ + /* 125 */ ts + 1874, /* "RowCell" */ + /* 126 */ ts + 1882, /* "Delete" */ + /* 127 */ ts + 1889, /* "ResetCount" */ + /* 128 */ ts + 1900, /* "SorterCompare" */ + /* 129 */ ts + 1914, /* "SorterData" */ + /* 130 */ ts + 1925, /* "RowData" */ + /* 131 */ ts + 1933, /* "Rowid" */ + /* 132 */ ts + 1939, /* "NullRow" */ + /* 133 */ ts + 1947, /* "SeekEnd" */ + /* 134 */ ts + 1955, /* "IdxInsert" */ + /* 135 */ ts + 1965, /* "SorterInsert" */ + /* 136 */ ts + 1978, /* "IdxDelete" */ + /* 137 */ ts + 1988, /* "DeferredSeek" */ + /* 138 */ ts + 2001, /* "IdxRowid" */ + /* 139 */ ts + 2010, /* "FinishSeek" */ + /* 140 */ ts + 2021, /* "Destroy" */ + /* 141 */ ts + 2029, /* "Clear" */ + /* 142 */ ts + 2035, /* "ResetSorter" */ + /* 143 */ ts + 2047, /* "CreateBtree" */ + /* 144 */ ts + 2059, /* "SqlExec" */ + /* 145 */ ts + 2067, /* "ParseSchema" */ + /* 146 */ ts + 2079, /* "LoadAnalysis" */ + /* 147 */ ts + 2092, /* "DropTable" */ + /* 148 */ ts + 2102, /* "DropIndex" */ + /* 149 */ ts + 2112, /* "DropTrigger" */ + /* 150 */ ts + 2124, /* "IntegrityCk" */ + /* 151 */ ts + 2136, /* "RowSetAdd" */ + /* 152 */ ts + 2146, /* "Real" */ + /* 153 */ ts + 2151, /* "Param" */ + /* 154 */ ts + 2157, /* "FkCounter" */ + /* 155 */ ts + 2167, /* "MemMax" */ + /* 156 */ ts + 2174, /* "OffsetLimit" */ + /* 157 */ ts + 2186, /* "AggInverse" */ + /* 158 */ ts + 2197, /* "AggStep" */ + /* 159 */ ts + 2205, /* "AggStep1" */ + /* 160 */ ts + 2214, /* "AggValue" */ + /* 161 */ ts + 2223, /* "AggFinal" */ + /* 162 */ ts + 2232, /* "Expire" */ + /* 163 */ ts + 2239, /* "CursorLock" */ + /* 164 */ ts + 2250, /* "CursorUnlock" */ + /* 165 */ ts + 2263, /* "TableLock" */ + /* 166 */ ts + 2273, /* "VBegin" */ + /* 167 */ ts + 2280, /* "VCreate" */ + /* 168 */ ts + 2288, /* "VDestroy" */ + /* 169 */ ts + 2297, /* "VOpen" */ + /* 170 */ ts + 2303, /* "VColumn" */ + /* 171 */ ts + 2311, /* "VRename" */ + /* 172 */ ts + 2319, /* "Pagecount" */ + /* 173 */ ts + 2329, /* "MaxPgcnt" */ + /* 174 */ ts + 2338, /* "Trace" */ + /* 175 */ ts + 2344, /* "CursorHint" */ + /* 176 */ ts + 2355, /* "ReleaseReg" */ + /* 177 */ ts + 2366, /* "Noop" */ + /* 178 */ ts + 2371, /* "Explain" */ + /* 179 */ ts + 2379, /* "Abortable" */ +} /* sqlite3.c:33673:20 */ +type pthread_once = struct { + Fstate int32 + _ [4]byte + Fmutex Pthread_mutex_t +} /* _pthreadtypes.h:52:1 */ + +// Primitive system data type definitions required by P1003.1c. +// +// Note that P1003.1c specifies that there are no defined comparison +// or assignment operators for the types pthread_attr_t, pthread_cond_t, +// pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. +type Pthread_t = uintptr /* _pthreadtypes.h:67:26 */ +type Pthread_attr_t = uintptr /* _pthreadtypes.h:70:30 */ +type Pthread_mutex_t = uintptr /* _pthreadtypes.h:71:31 */ +type Pthread_mutexattr_t = uintptr /* _pthreadtypes.h:72:35 */ +type Pthread_cond_t = uintptr /* _pthreadtypes.h:73:30 */ +type Pthread_condattr_t = uintptr /* _pthreadtypes.h:74:34 */ +type Pthread_key_t = int32 /* _pthreadtypes.h:75:20 */ +type Pthread_once_t = pthread_once /* _pthreadtypes.h:76:30 */ +type Pthread_rwlock_t = uintptr /* _pthreadtypes.h:77:32 */ +type Pthread_rwlockattr_t = uintptr /* _pthreadtypes.h:78:35 */ +type Pthread_barrier_t = uintptr /* _pthreadtypes.h:79:33 */ +type Pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */ +type Pthread_spinlock_t = uintptr /* _pthreadtypes.h:81:33 */ + +// Additional type definitions: +// +// Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for +// use in header symbols. +type Pthread_addr_t = uintptr /* _pthreadtypes.h:89:14 */ +type Pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */ + +// XXX POSIX sized integrals that should appear only in . +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2011 David E. O'Brien +// Copyright (c) 2001 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type Int8_t = X__int8_t /* _stdint.h:36:19 */ + +type Int16_t = X__int16_t /* _stdint.h:41:20 */ + +type Int32_t = X__int32_t /* _stdint.h:46:20 */ + +type Int64_t = X__int64_t /* _stdint.h:51:20 */ + +type Uint8_t = X__uint8_t /* _stdint.h:56:20 */ + +type Uint16_t = X__uint16_t /* _stdint.h:61:21 */ + +type Uint32_t = X__uint32_t /* _stdint.h:66:21 */ + +type Uint64_t = X__uint64_t /* _stdint.h:71:21 */ + +type Intptr_t = X__intptr_t /* _stdint.h:76:21 */ +type Uintptr_t = X__uintptr_t /* _stdint.h:80:22 */ +type Intmax_t = X__intmax_t /* _stdint.h:84:21 */ +type Uintmax_t = X__uintmax_t /* _stdint.h:88:22 */ + +type U_int8_t = X__uint8_t /* types.h:67:19 */ // unsigned integrals (deprecated) +type U_int16_t = X__uint16_t /* types.h:68:20 */ +type U_int32_t = X__uint32_t /* types.h:69:20 */ +type U_int64_t = X__uint64_t /* types.h:70:20 */ + +type U_quad_t = X__uint64_t /* types.h:72:20 */ // quads (deprecated) +type Quad_t = X__int64_t /* types.h:73:19 */ +type Qaddr_t = uintptr /* types.h:74:16 */ + +type Caddr_t = uintptr /* types.h:76:14 */ // core address +type C_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const + +type Blksize_t = X__blksize_t /* types.h:80:21 */ + +type Cpuwhich_t = X__cpuwhich_t /* types.h:84:22 */ +type Cpulevel_t = X__cpulevel_t /* types.h:85:22 */ +type Cpusetid_t = X__cpusetid_t /* types.h:86:22 */ + +type Blkcnt_t = X__blkcnt_t /* types.h:89:20 */ + +type Critical_t = X__critical_t /* types.h:103:22 */ // Critical section value +type Daddr_t = X__daddr_t /* types.h:104:19 */ // disk address + +type Dev_t = X__dev_t /* types.h:107:18 */ // device number or struct cdev + +type Fflags_t = X__fflags_t /* types.h:112:20 */ // file flags + +type Fixpt_t = X__fixpt_t /* types.h:116:19 */ // fixed point number + +type Fsblkcnt_t = X__fsblkcnt_t /* types.h:119:22 */ +type Fsfilcnt_t = X__fsfilcnt_t /* types.h:120:22 */ + +type Gid_t = X__gid_t /* types.h:125:18 */ // group id + +type In_addr_t = X__uint32_t /* types.h:130:20 */ // base type for internet address + +type In_port_t = X__uint16_t /* types.h:135:20 */ + +type Id_t = X__id_t /* types.h:140:17 */ // can hold a uid_t or pid_t + +type Ino_t = X__ino_t /* types.h:145:18 */ // inode number + +type Key_t = X__key_t /* types.h:150:18 */ // IPC key (for Sys V IPC) + +type Lwpid_t = X__lwpid_t /* types.h:155:19 */ // Thread ID (a.k.a. LWP) + +type Mode_t = X__mode_t /* types.h:160:18 */ // permissions + +type Accmode_t = X__accmode_t /* types.h:165:21 */ // access permissions + +type Nlink_t = X__nlink_t /* types.h:170:19 */ // link count + +type Off_t = X__off_t /* types.h:175:18 */ // file offset + +type Register_t = X__register_t /* types.h:189:22 */ + +type Rlim_t = X__rlim_t /* types.h:192:18 */ // resource limit + +type Sbintime_t = X__int64_t /* types.h:196:19 */ + +type Segsz_t = X__segsz_t /* types.h:198:19 */ // segment size (in pages) + +type Ssize_t = X__ssize_t /* types.h:206:19 */ + +type Suseconds_t = X__suseconds_t /* types.h:211:23 */ // microseconds (signed) + +type Mqd_t = X__mqd_t /* types.h:226:17 */ + +type U_register_t = X__u_register_t /* types.h:230:24 */ + +type Uid_t = X__uid_t /* types.h:233:18 */ // user id + +type Useconds_t = X__useconds_t /* types.h:238:22 */ // microseconds (unsigned) + +type Cap_ioctl_t = uint64 /* types.h:244:23 */ + +// Types suitable for exporting physical addresses, virtual addresses +// (pointers), and memory object sizes from the kernel independent of native +// word size. These should be used in place of vm_paddr_t, (u)intptr_t, and +// size_t in structs which contain such types that are shared with userspace. +type Kpaddr_t = X__uint64_t /* types.h:260:20 */ +type Kvaddr_t = X__uint64_t /* types.h:261:20 */ +type Ksize_t = X__uint64_t /* types.h:262:20 */ +type Kssize_t = X__int64_t /* types.h:263:19 */ + +type Vm_offset_t = X__vm_offset_t /* types.h:265:23 */ +type Vm_ooffset_t = X__uint64_t /* types.h:266:20 */ +type Vm_paddr_t = X__vm_paddr_t /* types.h:267:22 */ +type Vm_pindex_t = X__uint64_t /* types.h:268:20 */ +type Vm_size_t = X__vm_size_t /* types.h:269:21 */ + +type Rman_res_t = X__rman_res_t /* types.h:271:25 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)stat.h 8.12 (Berkeley) 6/16/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +type stat = struct { + Fst_dev Dev_t + Fst_ino Ino_t + Fst_nlink Nlink_t + Fst_mode Mode_t + Fst_padding0 X__int16_t + Fst_uid Uid_t + Fst_gid Gid_t + Fst_padding1 X__int32_t + Fst_rdev Dev_t + Fst_atim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_mtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_ctim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_birthtim struct { + Ftv_sec Time_t + Ftv_nsec int64 + } + Fst_size Off_t + Fst_blocks Blkcnt_t + Fst_blksize Blksize_t + Fst_flags Fflags_t + Fst_gen X__uint64_t + Fst_spare [10]X__uint64_t +} /* stat.h:160:1 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1983, 1990, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)fcntl.h 8.3 (Berkeley) 1/21/94 +// $FreeBSD$ + +// This file includes the definitions for open and fcntl +// described by POSIX for ; it also includes +// related kernel definitions. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// File status flags: these are used by open(2), fcntl(2). +// They are also used (indirectly) in the kernel file structure f_flags, +// which is a superset of the open/fcntl flags. Open flags and f_flags +// are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). +// Open/fcntl flags begin with O_; kernel-internal flags begin with F. +// open-only flags + +// Kernel encoding of open mode; separate read and write bits that are +// independently testable: 1 greater than the above. +// +// XXX +// FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, +// which was documented to use FREAD/FWRITE, continues to work. + +// Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. + +// XXX missing O_RSYNC. + +// The O_* flags used to have only F* names, which were used in the kernel +// and by fcntl. We retain the F* names for the kernel f_flag field +// and for backward compatibility for fcntl. These flags are deprecated. + +// Historically, we ran out of bits in f_flag (which was once a short). +// However, the flag bits not set in FMASK are only meaningful in the +// initial open syscall. Those bits were thus given a +// different meaning for fcntl(2). + +// Constants used for fcntl(2) + +// command values + +// file descriptor flags (F_GETFD, F_SETFD) + +// record locking flags (F_GETLK, F_SETLK, F_SETLKW) + +// Advisory file segment locking data type - +// information passed to system by user +type flock = struct { + Fl_start Off_t + Fl_len Off_t + Fl_pid Pid_t + Fl_type int16 + Fl_whence int16 + Fl_sysid int32 + _ [4]byte +} /* fcntl.h:294:1 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)filio.h 8.1 (Berkeley) 3/28/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ioccom.h 8.3 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Generic file-descriptor ioctl's. +type fiodgname_arg = struct { + Flen int32 + _ [4]byte + Fbuf uintptr +} /* filio.h:56:1 */ + +// Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. +type fiobmap2_arg = struct { + Fbn X__daddr_t + Frunp int32 + Frunb int32 +} /* filio.h:66:1 */ + +// Get the file's bmap info for the logical block bn. +// POSIX shm largepage set/get config + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)sockio.h 8.1 (Berkeley) 3/28/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ioccom.h 8.3 (Berkeley) 1/9/95 +// $FreeBSD$ + +// Socket ioctl's. + +// SIOCADDRT _IOW('r', 10, struct ortentry) 4.3BSD +// SIOCDELRT _IOW('r', 11, struct ortentry) 4.3BSD + +// OSIOCGIFADDR _IOWR('i', 13, struct ifreq) 4.3BSD +// OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) 4.3BSD +// OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) 4.3BSD +// OSIOCGIFCONF _IOWR('i', 20, struct ifconf) 4.3BSD +// OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) 4.3BSD +// SIOCALIFADDR _IOW('i', 27, struct if_laddrreq) KAME +// SIOCGLIFADDR _IOWR('i', 28, struct if_laddrreq) KAME +// SIOCDLIFADDR _IOW('i', 29, struct if_laddrreq) KAME + +// SIOCSLIFPHYADDR _IOW('i', 74, struct if_laddrreq) KAME +// SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) KAME + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttycom.h 8.1 (Berkeley) 3/28/94 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1990, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ioccom.h 8.3 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1988, 1989, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)ttycom.h 8.1 (Berkeley) 3/28/94 +// $FreeBSD$ + +// Window/terminal size structure. This information is stored by the kernel +// in order to provide a consistent interface, but is not used by the kernel. +type winsize = struct { + Fws_row uint16 + Fws_col uint16 + Fws_xpixel uint16 + Fws_ypixel uint16 +} /* _winsize.h:42:1 */ + +// #include +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// Structure returned by gettimeofday(2) system call, and used in other calls. +type timeval = struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t +} /* _timeval.h:49:1 */ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1991, 1993, 1994 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)types.h 8.6 (Berkeley) 2/19/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +type timezone = struct { + Ftz_minuteswest int32 + Ftz_dsttime int32 +} /* time.h:42:1 */ + +// Operations on timespecs + +// Names of the interval timers, and structure +// defining a timer setting. + +type itimerval = struct { + Fit_interval struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + } + Fit_value struct { + Ftv_sec Time_t + Ftv_usec Suseconds_t + } +} /* time.h:447:1 */ + +// Getkerninfo clock information structure +type clockinfo = struct { + Fhz int32 + Ftick int32 + Fspare int32 + Fstathz int32 + Fprofhz int32 +} /* time.h:455:1 */ + +// These macros are also in time.h. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type __sigset = struct{ F__bits [4]X__uint32_t } /* _sigset.h:53:9 */ + +// These macros are also in time.h. + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1989, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.3 (Berkeley) 1/21/94 + +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1992, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1991, 1993 +// The Regents of the University of California. All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Berkeley Software Design, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)cdefs.h 8.8 (Berkeley) 1/9/95 +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1989, 1991, 1993 +// The Regents of the University of California. All rights reserved. +// (c) UNIX System Laboratories, Inc. +// All or some portions of this file are derived from material licensed +// to the University of California by American Telephone and Telegraph +// Co. or Unix System Laboratories, Inc. and are reproduced herein with +// the permission of UNIX System Laboratories, Inc. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)signal.h 8.4 (Berkeley) 5/4/95 +// $FreeBSD$ + +// sigset_t macros. + +type X__sigset_t = __sigset /* _sigset.h:55:3 */ + +// - +// SPDX-License-Identifier: BSD-2-Clause-FreeBSD +// +// Copyright (c) 2002 Mike Barcroft +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// $FreeBSD$ + +// - +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright (c) 1982, 1986, 1993 +// The Regents of the University of California. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the University nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// @(#)time.h 8.5 (Berkeley) 5/4/95 +// from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp +// $FreeBSD$ + +type X__fd_mask = uint64 /* select.h:44:23 */ + +type Sigset_t = X__sigset_t /* select.h:51:20 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type fd_set = struct{ F__fds_bits [16]X__fd_mask } /* select.h:73:9 */ + +// Select uses bit masks of file descriptors in longs. These macros +// manipulate such bit fields (the filesystem macros use chars). +// FD_SETSIZE may be defined by the user, but the default here should +// be enough for most uses. + +type Fd_set = fd_set /* select.h:75:3 */ + +// Try to determine if gethostuuid() is available based on standard +// macros. This might sometimes compute the wrong value for some +// obscure platforms. For those cases, simply compile with one of +// the following: +// +// -DHAVE_GETHOSTUUID=0 +// -DHAVE_GETHOSTUUID=1 +// +// None if this matters except when building on Apple products with +// -DSQLITE_ENABLE_LOCKING_STYLE. + +// Allowed values of unixFile.fsFlags + +// If we are to be thread-safe, include the pthreads header. +// # include + +// Default permissions when creating a new file + +// Default permissions when creating auto proxy dir + +// Maximum supported path-length. + +// Maximum supported symbolic links + +// Always cast the getpid() return type for compatibility with +// kernel modules in VxWorks. + +// Only set the lastErrno if the error code is a real error and not +// a normal expected return code of SQLITE_BUSY or SQLITE_OK + +// Forward references +type unixShm = struct { + FpShmNode uintptr + FpNext uintptr + FhasMutex U8 + Fid U8 + FsharedMask U16 + FexclMask U16 + _ [2]byte +} /* sqlite3.c:34057:9 */ + +// Try to determine if gethostuuid() is available based on standard +// macros. This might sometimes compute the wrong value for some +// obscure platforms. For those cases, simply compile with one of +// the following: +// +// -DHAVE_GETHOSTUUID=0 +// -DHAVE_GETHOSTUUID=1 +// +// None if this matters except when building on Apple products with +// -DSQLITE_ENABLE_LOCKING_STYLE. + +// Allowed values of unixFile.fsFlags + +// If we are to be thread-safe, include the pthreads header. +// # include + +// Default permissions when creating a new file + +// Default permissions when creating auto proxy dir + +// Maximum supported path-length. + +// Maximum supported symbolic links + +// Always cast the getpid() return type for compatibility with +// kernel modules in VxWorks. + +// Only set the lastErrno if the error code is a real error and not +// a normal expected return code of SQLITE_BUSY or SQLITE_OK + +// Forward references +type UnixShm = unixShm /* sqlite3.c:34057:24 */ // Connection shared memory +type unixShmNode = struct { + FpInode uintptr + FpShmMutex uintptr + FzFilename uintptr + FhShm int32 + FszRegion int32 + FnRegion U16 + FisReadonly U8 + FisUnlocked U8 + _ [4]byte + FapRegion uintptr + FnRef int32 + _ [4]byte + FpFirst uintptr + FaLock [8]int32 +} /* sqlite3.c:34057:9 */ + +// Connection shared memory +type UnixShmNode = unixShmNode /* sqlite3.c:34058:28 */ // Shared memory instance +type unixInodeInfo = struct { + FfileId struct { + Fdev Dev_t + Fino U64 + } + FpLockMutex uintptr + FnShared int32 + FnLock int32 + FeFileLock uint8 + FbProcessLock uint8 + _ [6]byte + FpUnused uintptr + FnRef int32 + _ [4]byte + FpShmNode uintptr + FpNext uintptr + FpPrev uintptr +} /* sqlite3.c:34057:9 */ + +// Shared memory instance +type UnixInodeInfo = unixInodeInfo /* sqlite3.c:34059:30 */ // An i-node +type UnixUnusedFd1 = struct { + Ffd int32 + Fflags int32 + FpNext uintptr +} /* sqlite3.c:34057:9 */ + +// An i-node +type UnixUnusedFd = UnixUnusedFd1 /* sqlite3.c:34060:29 */ + +// The unixFile structure is subclass of sqlite3_file specific to the unix +// VFS implementations. +type unixFile = struct { + FpMethod uintptr + FpVfs uintptr + FpInode uintptr + Fh int32 + FeFileLock uint8 + _ [1]byte + FctrlFlags uint16 + FlastErrno int32 + _ [4]byte + FlockingContext uintptr + FpPreallocatedUnused uintptr + FzPath uintptr + FpShm uintptr + FszChunk int32 + FnFetchOut int32 + FmmapSize Sqlite3_int64 + FmmapSizeActual Sqlite3_int64 + FmmapSizeMax Sqlite3_int64 + FpMapRegion uintptr + FsectorSize int32 + FdeviceCharacteristics int32 +} /* sqlite3.c:34078:9 */ + +// The unixFile structure is subclass of sqlite3_file specific to the unix +// VFS implementations. +type UnixFile = unixFile /* sqlite3.c:34078:25 */ + +// This variable holds the process id (pid) from when the xRandomness() +// method was called. If xOpen() is called from a different process id, +// indicating that a fork() has occurred, the PRNG will be reset. +var randomnessPid Pid_t = 0 /* sqlite3.c:34139:14 */ + +// Allowed values for the unixFile.ctrlFlags bitmask: + +// Include code that is common to all os_*.c files +//************* Include os_common.h in the middle of os_unix.c ************** +//************* Begin file os_common.h ************************************** +// 2004 May 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains macros and a little bit of code that is common to +// all of the platform-specific files (os_*.c) and is #included into those +// files. +// +// This file should be #included by the os_*.c files only. It is not a +// general purpose header file. + +// At least two bugs have slipped in because we changed the MEMORY_DEBUG +// macro to SQLITE_DEBUG and some older makefiles have not yet made the +// switch. The following code should catch this problem at compile-time. + +// Macros for performance tracing. Normally turned off. Only works +// on i486 hardware. + +// If we compile with the SQLITE_TEST macro set, then the following block +// of code will give us the ability to simulate a disk I/O error. This +// is used for testing the I/O recovery logic. + +// When testing, keep a count of the number of open files. + +//************* End of os_common.h ****************************************** +//************* Continuing where we left off in os_unix.c ******************* + +// Define various macros that are missing from some systems. + +// The threadid macro resolves to the thread-id or to 0. Used for +// testing and debugging only. + +// HAVE_MREMAP defaults to true on Linux and false everywhere else. + +// Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek() +// is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined. + +// Different Unix systems declare open() in different ways. Same use +// open(const char*,int,mode_t). Others use open(const char*,int,...). +// The difference is important when using a pointer to the function. +// +// The safest way to deal with the problem is to always use this wrapper +// which always has the same well-defined interface. +func posixOpen(tls *libc.TLS, zFile uintptr, flags int32, mode int32) int32 { /* sqlite3.c:34428:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + return libc.Xopen(tls, zFile, flags, libc.VaList(bp, mode)) +} + +// Many system calls are accessed through pointer-to-functions so that +// they may be overridden at runtime to facilitate fault injection during +// testing and sandboxing. The following array holds the names and pointers +// to all overrideable system calls. +type unix_syscall = struct { + FzName uintptr + FpCurrent Sqlite3_syscall_ptr + FpDefault Sqlite3_syscall_ptr +} /* sqlite3.c:34442:8 */ + +// Many system calls are accessed through pointer-to-functions so that +// they may be overridden at runtime to facilitate fault injection during +// testing and sandboxing. The following array holds the names and pointers +// to all overrideable system calls. +var aSyscall = [29]unix_syscall{ + {FzName: ts + 2389 /* "open" */, FpCurrent: 0}, + + {FzName: ts + 2394 /* "close" */, FpCurrent: 0}, + + {FzName: ts + 2400 /* "access" */, FpCurrent: 0}, + + {FzName: ts + 2407 /* "getcwd" */, FpCurrent: 0}, + + {FzName: ts + 2414 /* "stat" */, FpCurrent: 0}, + + // The DJGPP compiler environment looks mostly like Unix, but it + // lacks the fcntl() system call. So redefine fcntl() to be something + // that always succeeds. This means that locking does not occur under + // DJGPP. But it is DOS - what did you expect? + {FzName: ts + 2419 /* "fstat" */, FpCurrent: 0}, + + {FzName: ts + 2425 /* "ftruncate" */, FpCurrent: 0}, + + {FzName: ts + 2435 /* "fcntl" */, FpCurrent: 0}, + + {FzName: ts + 2441 /* "read" */, FpCurrent: 0}, + + {FzName: ts + 2446 /* "pread" */}, + + {FzName: ts + 2452 /* "pread64" */}, + + {FzName: ts + 2460 /* "write" */, FpCurrent: 0}, + + {FzName: ts + 2466 /* "pwrite" */}, + + {FzName: ts + 2473 /* "pwrite64" */}, + + {FzName: ts + 2482 /* "fchmod" */, FpCurrent: 0}, + + {FzName: ts + 2489 /* "fallocate" */}, + + {FzName: ts + 2499 /* "unlink" */, FpCurrent: 0}, + + {FzName: ts + 2506 /* "openDirectory" */, FpCurrent: 0}, + + {FzName: ts + 2520 /* "mkdir" */, FpCurrent: 0}, + + {FzName: ts + 2526 /* "rmdir" */, FpCurrent: 0}, + + {FzName: ts + 2532 /* "fchown" */, FpCurrent: 0}, + + {FzName: ts + 2539 /* "geteuid" */, FpCurrent: 0}, + + {FzName: ts + 2547 /* "mmap" */, FpCurrent: 0}, + + {FzName: ts + 2552 /* "munmap" */, FpCurrent: 0}, + + {FzName: ts + 2559 /* "mremap" */}, + + {FzName: ts + 2566 /* "getpagesize" */, FpCurrent: 0}, + + {FzName: ts + 2578 /* "readlink" */, FpCurrent: 0}, + + {FzName: ts + 2587 /* "lstat" */, FpCurrent: 0}, + + {FzName: ts + 2593 /* "ioctl" */}, +} /* sqlite3.c:34446:3 */ + +// End of the overrideable system calls + +// On some systems, calls to fchown() will trigger a message in a security +// log if they come from non-root processes. So avoid calling fchown() if +// we are not running as root. +func robustFchown(tls *libc.TLS, fd int32, uid Uid_t, gid Gid_t) int32 { /* sqlite3.c:34616:12: */ + if (*(*func(*libc.TLS) Uid_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 21*24 + 8 /* &.pCurrent */))))(tls) != 0 { + return 0 + } + return (*(*func(*libc.TLS, int32, Uid_t, Gid_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 20*24 + 8 /* &.pCurrent */))))(tls, fd, uid, gid) +} + +// This is the xSetSystemCall() method of sqlite3_vfs for all of the +// "unix" VFSes. Return SQLITE_OK opon successfully updating the +// system call pointer, or SQLITE_NOTFOUND if there is no configurable +// system call named zName. +func unixSetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr, pNewFunc Sqlite3_syscall_ptr) int32 { /* sqlite3.c:34630:12: */ + var i uint32 + var rc int32 = SQLITE_NOTFOUND + + _ = pNotUsed + if zName == uintptr(0) { + // If no zName is given, restore all system calls to their default + // settings and return NULL + rc = SQLITE_OK + for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof(aSyscall)) / uint64(unsafe.Sizeof(unix_syscall{}))); i++ { + if aSyscall[i].FpDefault != 0 { + aSyscall[i].FpCurrent = aSyscall[i].FpDefault + } + } + } else { + // If zName is specified, operate on only the one system call + // specified. + for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof(aSyscall)) / uint64(unsafe.Sizeof(unix_syscall{}))); i++ { + if libc.Xstrcmp(tls, zName, aSyscall[i].FzName) == 0 { + if aSyscall[i].FpDefault == uintptr(0) { + aSyscall[i].FpDefault = aSyscall[i].FpCurrent + } + rc = SQLITE_OK + if pNewFunc == uintptr(0) { + pNewFunc = aSyscall[i].FpDefault + } + aSyscall[i].FpCurrent = pNewFunc + break + } + } + } + return rc +} + +// Return the value of a system call. Return NULL if zName is not a +// recognized system call name. NULL is also returned if the system call +// is currently undefined. +func unixGetSystemCall(tls *libc.TLS, pNotUsed uintptr, zName uintptr) Sqlite3_syscall_ptr { /* sqlite3.c:34673:28: */ + var i uint32 + + _ = pNotUsed + for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof(aSyscall)) / uint64(unsafe.Sizeof(unix_syscall{}))); i++ { + if libc.Xstrcmp(tls, zName, aSyscall[i].FzName) == 0 { + return aSyscall[i].FpCurrent + } + } + return uintptr(0) +} + +// Return the name of the first system call after zName. If zName==NULL +// then return the name of the first system call. Return NULL if zName +// is the last system call or if zName is not the name of a valid +// system call. +func unixNextSystemCall(tls *libc.TLS, p uintptr, zName uintptr) uintptr { /* sqlite3.c:34692:19: */ + var i int32 = -1 + + _ = p + if zName != 0 { + for i = 0; i < ((int32(uint64(unsafe.Sizeof(aSyscall)) / uint64(unsafe.Sizeof(unix_syscall{})))) - 1); i++ { + if libc.Xstrcmp(tls, zName, aSyscall[i].FzName) == 0 { + break + } + } + } + for i++; i < (int32(uint64(unsafe.Sizeof(aSyscall)) / uint64(unsafe.Sizeof(unix_syscall{})))); i++ { + if aSyscall[i].FpCurrent != uintptr(0) { + return aSyscall[i].FzName + } + } + return uintptr(0) +} + +// Do not accept any file descriptor less than this value, in order to avoid +// opening database file using file descriptors that are commonly used for +// standard input, output, and error. + +// Invoke open(). Do so multiple times, until it either succeeds or +// fails for some reason other than EINTR. +// +// If the file creation mode "m" is 0 then set it to the default for +// SQLite. The default is SQLITE_DEFAULT_FILE_PERMISSIONS (normally +// 0644) as modified by the system umask. If m is not 0, then +// make the file creation mode be exactly m ignoring the umask. +// +// The m parameter will be non-zero only when creating -wal, -journal, +// and -shm files. We want those files to have *exactly* the same +// permissions as their original database, unadulterated by the umask. +// In that way, if a database file is -rw-rw-rw or -rw-rw-r-, and a +// transaction crashes and leaves behind hot journals, then any +// process that is able to write to the database will also be able to +// recover the hot journals. +func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3.c:34733:12: */ + bp := tls.Alloc(256) + defer tls.Free(256) + + var fd int32 + var m2 Mode_t + if m != 0 { + m2 = m + } else { + m2 = uint16(SQLITE_DEFAULT_FILE_PERMISSIONS) + } + for 1 != 0 { + fd = (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, z, f, int32(m2)) + if fd < 0 { + if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR { + continue + } + break + } + if fd >= SQLITE_MINIMUM_FILE_DESCRIPTOR { + break + } + (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, fd) + Xsqlite3_log(tls, SQLITE_WARNING, + ts+2599 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + fd = -1 + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2642 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + break + } + } + if fd >= 0 { + if int32(m) != 0 { + // var statbuf stat at bp+32, 224 + + if (((*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, fd, bp+32 /* &statbuf */) == 0) && + ((*stat)(unsafe.Pointer(bp+32 /* &statbuf */)).Fst_size == int64(0))) && + ((int32((*stat)(unsafe.Pointer(bp+32 /* &statbuf */)).Fst_mode) & 0777) != int32(m)) { + (*(*func(*libc.TLS, int32, Mode_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 14*24 + 8 /* &.pCurrent */))))(tls, fd, m) + } + } + (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, fd, F_SETFD, libc.VaList(bp+16, ((*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, fd, F_GETFD, libc.VaList(bp+24, 0))|FD_CLOEXEC))) + } + return fd +} + +// Helper functions to obtain and relinquish the global mutex. The +// global mutex is used to protect the unixInodeInfo and +// vxworksFileId objects used by this file, all of which may be +// shared by multiple threads. +// +// Function unixMutexHeld() is used to assert() that the global mutex +// is held when required. This function is only used as part of assert() +// statements. e.g. +// +// unixEnterMutex() +// assert( unixMutexHeld() ); +// unixEnterLeave() +// +// To prevent deadlock, the global unixBigLock must must be acquired +// before the unixInodeInfo.pLockMutex mutex, if both are held. It is +// OK to get the pLockMutex without holding unixBigLock first, but if +// that happens, the unixBigLock mutex must not be acquired until after +// pLockMutex is released. +// +// OK: enter(unixBigLock), enter(pLockInfo) +// OK: enter(unixBigLock) +// OK: enter(pLockInfo) +// ERROR: enter(pLockInfo), enter(unixBigLock) +var unixBigLock uintptr = uintptr(0) /* sqlite3.c:34795:22 */ + +func unixEnterMutex(tls *libc.TLS) { /* sqlite3.c:34796:13: */ + // Not a recursive mutex + Xsqlite3_mutex_enter(tls, unixBigLock) +} + +func unixLeaveMutex(tls *libc.TLS) { /* sqlite3.c:34800:13: */ + + Xsqlite3_mutex_leave(tls, unixBigLock) +} + +// Retry ftruncate() calls that fail due to EINTR +// +// All calls to ftruncate() within this file should be made through +// this wrapper. On the Android platform, bypassing the logic below +// could lead to a corrupt database. +func robust_ftruncate(tls *libc.TLS, h int32, sz Sqlite3_int64) int32 { /* sqlite3.c:34896:12: */ + var rc int32 + for ok := true; ok; ok = ((rc < 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR)) { + rc = (*(*func(*libc.TLS, int32, Off_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 6*24 + 8 /* &.pCurrent */))))(tls, h, int64(sz)) + } + return rc +} + +// This routine translates a standard POSIX errno code into something +// useful to the clients of the sqlite3 functions. Specifically, it is +// intended to translate a variety of "try again" errors into SQLITE_BUSY +// and a variety of "please close the file descriptor NOW" errors into +// SQLITE_IOERR +// +// Errors during initialization of locks, or file system support for locks, +// should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately. +func sqliteErrorFromPosixError(tls *libc.TLS, posixError int32, sqliteIOErr int32) int32 { /* sqlite3.c:34921:12: */ + + switch posixError { + case EACCES: + fallthrough + case EAGAIN: + fallthrough + case ETIMEDOUT: + fallthrough + case EBUSY: + fallthrough + case EINTR: + fallthrough + case ENOLCK: + // random NFS retry error, unless during file system support + // introspection, in which it actually means what it says + return SQLITE_BUSY + + case EPERM: + return SQLITE_PERM + + default: + return sqliteIOErr + } + return int32(0) +} + +// ***************************************************************************** +// +// Begin Unique File ID Utility Used By VxWorks *************** +// +// On most versions of unix, we can get a unique ID for a file by concatenating +// the device number and the inode number. But this does not work on VxWorks. +// On VxWorks, a unique file id must be based on the canonical filename. +// +// A pointer to an instance of the following structure can be used as a +// unique file ID in VxWorks. Each instance of this structure contains +// a copy of the canonical filename. There is also a reference count. +// The structure is reclaimed when the number of pointers to it drops to +// zero. +// +// There are never very many files open at one time and lookups are not +// a performance-critical path, so it is sufficient to put these +// structures on a linked list. +type vxworksFileId = struct { + FpNext uintptr + FnRef int32 + FnName int32 + FzCanonicalName uintptr +} /* sqlite3.c:34963:1 */ + +// ************** End of Unique File ID Utility Used By VxWorks **************** +// +// + +// ***************************************************************************** +// +// Posix Advisory Locking **************************** +// +// POSIX advisory locks are broken by design. ANSI STD 1003.1 (1996) +// section 6.5.2.2 lines 483 through 490 specify that when a process +// sets or clears a lock, that operation overrides any prior locks set +// by the same process. It does not explicitly say so, but this implies +// that it overrides locks set by the same process using a different +// file descriptor. Consider this test case: +// +// int fd1 = open("./file1", O_RDWR|O_CREAT, 0644); +// int fd2 = open("./file2", O_RDWR|O_CREAT, 0644); +// +// Suppose ./file1 and ./file2 are really the same file (because +// one is a hard or symbolic link to the other) then if you set +// an exclusive lock on fd1, then try to get an exclusive lock +// on fd2, it works. I would have expected the second lock to +// fail since there was already a lock on the file due to fd1. +// But not so. Since both locks came from the same process, the +// second overrides the first, even though they were on different +// file descriptors opened on different file names. +// +// This means that we cannot use POSIX locks to synchronize file access +// among competing threads of the same process. POSIX locks will work fine +// to synchronize access for threads in separate processes, but not +// threads within the same process. +// +// To work around the problem, SQLite has to manage file locks internally +// on its own. Whenever a new database is opened, we have to find the +// specific inode of the database file (the inode is determined by the +// st_dev and st_ino fields of the stat structure that fstat() fills in) +// and check for locks already existing on that inode. When locks are +// created or removed, we have to look at our own internal record of the +// locks to see if another thread has previously set a lock on that same +// inode. +// +// (Aside: The use of inode numbers as unique IDs does not work on VxWorks. +// For VxWorks, we have to use the alternative unique ID system based on +// canonical filename and implemented in the previous division.) +// +// The sqlite3_file structure for POSIX is no longer just an integer file +// descriptor. It is now a structure that holds the integer file +// descriptor and a pointer to a structure that describes the internal +// locks on the corresponding inode. There is one locking structure +// per inode, so if the same inode is opened twice, both unixFile structures +// point to the same locking structure. The locking structure keeps +// a reference count (so we will know when to delete it) and a "cnt" +// field that tells us its internal lock status. cnt==0 means the +// file is unlocked. cnt==-1 means the file has an exclusive lock. +// cnt>0 means there are cnt shared locks on the file. +// +// Any attempt to lock or unlock a file first checks the locking +// structure. The fcntl() system call is only invoked to set a +// POSIX lock if the internal lock structure transitions between +// a locked and an unlocked state. +// +// But wait: there are yet more problems with POSIX advisory locks. +// +// If you close a file descriptor that points to a file that has locks, +// all locks on that file that are owned by the current process are +// released. To work around this problem, each unixInodeInfo object +// maintains a count of the number of pending locks on tha inode. +// When an attempt is made to close an unixFile, if there are +// other unixFile open on the same inode that are holding locks, the call +// to close() the file descriptor is deferred until all of the locks clear. +// The unixInodeInfo structure keeps a list of file descriptors that need to +// be closed and that list is walked (and cleared) when the last lock +// clears. +// +// Yet another problem: LinuxThreads do not play well with posix locks. +// +// Many older versions of linux use the LinuxThreads library which is +// not posix compliant. Under LinuxThreads, a lock created by thread +// A cannot be modified or overridden by a different thread B. +// Only thread A can modify the lock. Locking behavior is correct +// if the appliation uses the newer Native Posix Thread Library (NPTL) +// on linux - with NPTL a lock created by thread A can override locks +// in thread B. But there is no way to know at compile-time which +// threading library is being used. So there is no way to know at +// compile-time whether or not thread A can override locks on thread B. +// One has to do a run-time check to discover the behavior of the +// current process. +// +// SQLite used to support LinuxThreads. But support for LinuxThreads +// was dropped beginning with version 3.7.0. SQLite will still work with +// LinuxThreads provided that (1) there is no more than one connection +// per database file in the same process and (2) database connections +// do not move across threads. + +// An instance of the following structure serves as the key used +// to locate a particular unixInodeInfo object. +type unixFileId = struct { + Fdev Dev_t + Fino U64 +} /* sqlite3.c:34057:9 */ + +// A lists of all unixInodeInfo objects. +// +// Must hold unixBigLock in order to read or write this variable. +var inodeList uintptr = uintptr(0) /* sqlite3.c:35245:22 */ + +// All unixInodeInfo objects + +// +// This function - unixLogErrorAtLine(), is only ever called via the macro +// unixLogError(). +// +// It is invoked after an error occurs in an OS function and errno has been +// set. It logs a message using sqlite3_log() containing the current value of +// errno and, if possible, the human-readable equivalent from strerror() or +// strerror_r(). +// +// The first argument passed to the macro should be the error code that +// will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). +// The two subsequent arguments should be the name of the OS function that +// failed (e.g. "unlink", "open") and the associated file-system path, +// if any. +func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintptr, iLine int32) int32 { /* sqlite3.c:35280:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zErr uintptr // Message from strerror() or equivalent + var iErrno int32 = *(*int32)(unsafe.Pointer(libc.X__error(tls))) // Saved syscall error number + + // If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use + // the strerror() function to obtain the human-readable error message + // equivalent to errno. Otherwise, use strerror_r(). + // This is a threadsafe build, but strerror_r() is not available. + zErr = ts + 756 /* "" */ + + if zPath == uintptr(0) { + zPath = ts + 756 /* "" */ + } + Xsqlite3_log(tls, errcode, + ts+2652, /* "os_unix.c:%d: (%..." */ + libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) + + return errcode +} + +// Close a file descriptor. +// +// We assume that close() almost always works, since it is only in a +// very sick application or on a very sick platform that it might fail. +// If it does fail, simply leak the file descriptor, but do log the +// error. +// +// Note that it is not safe to retry close() after EINTR since the +// file descriptor might have already been reused by another thread. +// So we don't even try to recover from an EINTR. Just log the error +// and move on. +func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ + if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, h) != 0 { + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2394, /* "close" */ + func() uintptr { + if pFile != 0 { + return (*UnixFile)(unsafe.Pointer(pFile)).FzPath + } + return uintptr(0) + }(), lineno) + } +} + +// Set the pFile->lastErrno. Do this in a subroutine as that provides +// a convenient place to set a breakpoint. +func storeLastErrno(tls *libc.TLS, pFile uintptr, error int32) { /* sqlite3.c:35356:13: */ + (*UnixFile)(unsafe.Pointer(pFile)).FlastErrno = error +} + +// Close all file descriptors accumuated in the unixInodeInfo->pUnused list. +func closePendingFds(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35363:13: */ + var pInode uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + var p uintptr + var pNext uintptr + + for p = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpUnused; p != 0; p = pNext { + pNext = (*UnixUnusedFd)(unsafe.Pointer(p)).FpNext + robust_close(tls, pFile, (*UnixUnusedFd)(unsafe.Pointer(p)).Ffd, 35370) + Xsqlite3_free(tls, p) + } + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpUnused = uintptr(0) +} + +// Release a unixInodeInfo structure previously allocated by findInodeInfo(). +// +// The global mutex must be held when this routine is called, but the mutex +// on the inode being deleted must NOT be held. +func releaseInodeInfo(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35382:13: */ + var pInode uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + + if pInode != 0 { + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnRef-- + if (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnRef == 0 { + + Xsqlite3_mutex_enter(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + closePendingFds(tls, pFile) + Xsqlite3_mutex_leave(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + if (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpPrev != 0 { + + (*UnixInodeInfo)(unsafe.Pointer((*UnixInodeInfo)(unsafe.Pointer(pInode)).FpPrev)).FpNext = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } else { + + inodeList = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } + if (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext != 0 { + + (*UnixInodeInfo)(unsafe.Pointer((*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext)).FpPrev = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpPrev + } + Xsqlite3_mutex_free(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + Xsqlite3_free(tls, pInode) + } + } +} + +// Given a file descriptor, locate the unixInodeInfo object that +// describes that file descriptor. Create a new one if necessary. The +// return value might be uninitialized if an error occurs. +// +// The global mutex must held when calling this routine. +// +// Return an appropriate error code. +func findInodeInfo(tls *libc.TLS, pFile uintptr, ppInode uintptr) int32 { /* sqlite3.c:35419:12: */ + bp := tls.Alloc(240) + defer tls.Free(240) + + var rc int32 // System call return code + var fd int32 // The file descriptor for pFile + // var fileId unixFileId at bp+224, 16 + // Lookup key for the unixInodeInfo + // var statbuf stat at bp, 224 + // Low-level file information + var pInode uintptr = uintptr(0) // Candidate unixInodeInfo object + + // Get low-level information about the file that we can used to + // create a unique name for the file. + fd = (*UnixFile)(unsafe.Pointer(pFile)).Fh + rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, fd, bp /* &statbuf */) + if rc != 0 { + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + return SQLITE_IOERR + } + + libc.Xmemset(tls, bp+224 /* &fileId */, 0, uint64(unsafe.Sizeof(unixFileId{}))) + (*unixFileId)(unsafe.Pointer(bp + 224 /* &fileId */)).Fdev = (*stat)(unsafe.Pointer(bp /* &statbuf */)).Fst_dev + (*unixFileId)(unsafe.Pointer(bp + 224 /* &fileId */)).Fino = U64((*stat)(unsafe.Pointer(bp /* &statbuf */)).Fst_ino) + + pInode = inodeList + for (pInode != 0) && (libc.Xmemcmp(tls, bp+224 /* &fileId */, (pInode /* &.fileId */), uint64(unsafe.Sizeof(unixFileId{}))) != 0) { + pInode = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } + if pInode == uintptr(0) { + pInode = Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(UnixInodeInfo{}))) + if pInode == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pInode, 0, uint64(unsafe.Sizeof(UnixInodeInfo{}))) + libc.Xmemcpy(tls, (pInode /* &.fileId */), bp+224 /* &fileId */, uint64(unsafe.Sizeof(unixFileId{}))) + if Xsqlite3Config.FbCoreMutex != 0 { + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex = Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST) + if (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex == uintptr(0) { + Xsqlite3_free(tls, pInode) + return SQLITE_NOMEM + } + } + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnRef = 1 + + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext = inodeList + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpPrev = uintptr(0) + if inodeList != 0 { + (*UnixInodeInfo)(unsafe.Pointer(inodeList)).FpPrev = pInode + } + inodeList = pInode + } else { + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnRef++ + } + *(*uintptr)(unsafe.Pointer(ppInode)) = pInode + return SQLITE_OK +} + +// Return TRUE if pFile has been renamed or unlinked since it was first opened. +func fileHasMoved(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:35511:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + // var buf stat at bp, 224 + + return (libc.Bool32(((*UnixFile)(unsafe.Pointer(pFile)).FpInode != uintptr(0)) && (((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, bp /* &buf */) != 0) || + (U64((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_ino) != (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpInode)).FfileId.Fino)))) +} + +// Check a unixFile that is a database. Verify the following: +// +// (1) There is exactly one hard link on the file +// (2) The file is not a symbolic link +// (3) The file has not been renamed or unlinked +// +// Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right. +func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ + bp := tls.Alloc(256) + defer tls.Free(256) + + // var buf stat at bp+32, 224 + + var rc int32 + + // These verifications occurs for the main database only + if (int32((*UnixFile)(unsafe.Pointer(pFile)).FctrlFlags) & UNIXFILE_NOLOCK) != 0 { + return + } + + rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) + if rc != 0 { + Xsqlite3_log(tls, SQLITE_WARNING, ts+2683 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } + if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink == uint64(0) { + Xsqlite3_log(tls, SQLITE_WARNING, ts+2707 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } + if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink > uint64(1) { + Xsqlite3_log(tls, SQLITE_WARNING, ts+2736 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } + if fileHasMoved(tls, pFile) != 0 { + Xsqlite3_log(tls, SQLITE_WARNING, ts+2763 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + return + } +} + +// This routine checks if there is a RESERVED lock held on the specified +// file by this or any other process. If such a lock is held, set *pResOut +// to a non-zero value otherwise *pResOut is set to zero. The return value +// is set to SQLITE_OK unless an I/O error occurs during lock checking. +func unixCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) int32 { /* sqlite3.c:35565:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var rc int32 = SQLITE_OK + var reserved int32 = 0 + var pFile uintptr = id + + Xsqlite3_mutex_enter(tls, (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpInode)).FpLockMutex) + + // Check if a thread in this process holds such a lock + if int32((*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpInode)).FeFileLock) > SHARED_LOCK { + reserved = 1 + } + + // Otherwise see if some other process holds it. + if !(reserved != 0) && !(int32((*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpInode)).FbProcessLock) != 0) { + // var lock flock at bp+8, 32 + + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_start = (Off_t(Xsqlite3PendingByte + 1)) + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_len = int64(1) + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_type = int16(F_WRLCK) + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, F_GETLK, libc.VaList(bp, bp+8 /* &lock */)) != 0 { + rc = (SQLITE_IOERR | (int32(14) << 8)) + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) != F_UNLCK { + reserved = 1 + } + } + + Xsqlite3_mutex_leave(tls, (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpInode)).FpLockMutex) + + *(*int32)(unsafe.Pointer(pResOut)) = reserved + return rc +} + +// Set a posix-advisory-lock. +// +// There are two versions of this routine. If compiled with +// SQLITE_ENABLE_SETLK_TIMEOUT then the routine has an extra parameter +// which is a pointer to a unixFile. If the unixFile->iBusyTimeout +// value is set, then it is the number of milliseconds to wait before +// failing the lock. The iBusyTimeout value is always reset back to +// zero on each call. +// +// If SQLITE_ENABLE_SETLK_TIMEOUT is not defined, then do a non-blocking +// attempt to set the lock. + +// Attempt to set a system-lock on the file pFile. The lock is +// described by pLock. +// +// If the pFile was opened read/write from unix-excl, then the only lock +// ever obtained is an exclusive lock, and it is obtained exactly once +// the first time any lock is attempted. All subsequent system locking +// operations become no-ops. Locking operations still happen internally, +// in order to coordinate access between separate database connections +// within this process, but all of that is handled in memory and the +// operating system does not participate. +// +// This function is a pass-through to fcntl(F_SETLK) if pFile is using +// any VFS other than "unix-excl" or if pFile is opened on "unix-excl" +// and is read-only. +// +// Zero is returned if the call completes successfully, or -1 if a call +// to fcntl() fails. In this case, errno is set appropriately (by fcntl()). +func unixFileLock(tls *libc.TLS, pFile uintptr, pLock uintptr) int32 { /* sqlite3.c:35666:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var rc int32 + var pInode uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + + if (int32((*UnixFile)(unsafe.Pointer(pFile)).FctrlFlags) & (UNIXFILE_EXCL | UNIXFILE_RDONLY)) == UNIXFILE_EXCL { + if int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0 { + // var lock flock at bp+16, 32 + + (*flock)(unsafe.Pointer(bp + 16 /* &lock */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp + 16 /* &lock */)).Fl_start = (Off_t(Xsqlite3PendingByte + 2)) + (*flock)(unsafe.Pointer(bp + 16 /* &lock */)).Fl_len = int64(SHARED_SIZE) + (*flock)(unsafe.Pointer(bp + 16 /* &lock */)).Fl_type = int16(F_WRLCK) + rc = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, F_SETLK, libc.VaList(bp, bp+16 /* &lock */)) + if rc < 0 { + return rc + } + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock = uint8(1) + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnLock++ + } else { + rc = 0 + } + } else { + rc = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, F_SETLK, libc.VaList(bp+8, pLock)) + } + return rc +} + +// Lock the file with the lock specified by parameter eFileLock - one +// of the following: +// +// (1) SHARED_LOCK +// (2) RESERVED_LOCK +// (3) PENDING_LOCK +// (4) EXCLUSIVE_LOCK +// +// Sometimes when requesting one lock state, additional lock states +// are inserted in between. The locking might fail on one of the later +// transitions leaving the lock state different from what it started but +// still short of its goal. The following chart shows the allowed +// transitions and the inserted intermediate states: +// +// UNLOCKED -> SHARED +// SHARED -> RESERVED +// SHARED -> (PENDING) -> EXCLUSIVE +// RESERVED -> (PENDING) -> EXCLUSIVE +// PENDING -> EXCLUSIVE +// +// This routine will only increase a lock. Use the sqlite3OsUnlock() +// routine to lower a locking level. +func unixLock(tls *libc.TLS, id uintptr, eFileLock int32) int32 { /* sqlite3.c:35716:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // The following describes the implementation of the various locks and + // lock transitions in terms of the POSIX advisory shared and exclusive + // lock primitives (called read-locks and write-locks below, to avoid + // confusion with SQLite lock names). The algorithms are complicated + // slightly in order to be compatible with Windows95 systems simultaneously + // accessing the same database file, in case that is ever required. + // + // Symbols defined in os.h indentify the 'pending byte' and the 'reserved + // byte', each single bytes at well known offsets, and the 'shared byte + // range', a range of 510 bytes at a well known offset. + // + // To obtain a SHARED lock, a read-lock is obtained on the 'pending + // byte'. If this is successful, 'shared byte range' is read-locked + // and the lock on the 'pending byte' released. (Legacy note: When + // SQLite was first developed, Windows95 systems were still very common, + // and Widnows95 lacks a shared-lock capability. So on Windows95, a + // single randomly selected by from the 'shared byte range' is locked. + // Windows95 is now pretty much extinct, but this work-around for the + // lack of shared-locks on Windows95 lives on, for backwards + // compatibility.) + // + // A process may only obtain a RESERVED lock after it has a SHARED lock. + // A RESERVED lock is implemented by grabbing a write-lock on the + // 'reserved byte'. + // + // A process may only obtain a PENDING lock after it has obtained a + // SHARED lock. A PENDING lock is implemented by obtaining a write-lock + // on the 'pending byte'. This ensures that no new SHARED locks can be + // obtained, but existing SHARED locks are allowed to persist. A process + // does not have to obtain a RESERVED lock on the way to a PENDING lock. + // This property is used by the algorithm for rolling back a journal file + // after a crash. + // + // An EXCLUSIVE lock, obtained after a PENDING lock is held, is + // implemented by obtaining a write-lock on the entire 'shared byte + // range'. Since all other locks require a read-lock on one of the bytes + // within this range, this ensures that no other locks are held on the + // database. + var rc int32 + var pFile uintptr + var pInode uintptr + // var lock flock at bp, 32 + + var tErrno int32 + rc = SQLITE_OK + pFile = id + tErrno = 0 + + // If there is already a lock of this type or more restrictive on the + // unixFile, do nothing. Don't use the end_lock: exit path, as + // unixEnterMutex() hasn't been called yet. + if !(int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) >= eFileLock) { + goto __1 + } + + return SQLITE_OK +__1: + ; + + // Make sure the locking sequence is correct. + // (1) We never move from unlocked to anything higher than shared lock. + // (2) SQLite never explicitly requests a pendig lock. + // (3) A shared lock is always held when a reserve lock is requested. + + // This mutex is needed because pFile->pInode is shared across threads + pInode = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + Xsqlite3_mutex_enter(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + + // If some thread using this PID has a lock via a different unixFile* + // handle that precludes the requested lock, return BUSY. + if !((int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) != int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock)) && ((int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) >= PENDING_LOCK) || (eFileLock > SHARED_LOCK))) { + goto __2 + } + rc = SQLITE_BUSY + goto end_lock +__2: + ; + + // If a SHARED lock is requested, and some thread using this PID already + // has a SHARED or RESERVED lock, then increment reference counts and + // return SQLITE_OK. + if !((eFileLock == SHARED_LOCK) && ((int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == SHARED_LOCK) || (int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock) == RESERVED_LOCK))) { + goto __3 + } + + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnShared++ + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnLock++ + goto end_lock +__3: + ; + + // A PENDING lock is needed before acquiring a SHARED lock and before + // acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will + // be released. + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = 1 + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_whence = int16(SEEK_SET) + if !((eFileLock == SHARED_LOCK) || + ((eFileLock == EXCLUSIVE_LOCK) && (int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) < PENDING_LOCK))) { + goto __4 + } + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_type = func() int16 { + if eFileLock == SHARED_LOCK { + return int16(F_RDLCK) + } + return int16(F_WRLCK) + }() + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = Off_t(Xsqlite3PendingByte) + if !(unixFileLock(tls, pFile, bp /* &lock */) != 0) { + goto __5 + } + tErrno = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + rc = sqliteErrorFromPosixError(tls, tErrno, (SQLITE_IOERR | (int32(15) << 8))) + if !(rc != SQLITE_BUSY) { + goto __6 + } + storeLastErrno(tls, pFile, tErrno) +__6: + ; + goto end_lock +__5: + ; +__4: + ; + + // If control gets to this point, then actually go ahead and make + // operating system calls for the specified lock. + if !(eFileLock == SHARED_LOCK) { + goto __7 + } + + // Now get the read-lock + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = (Off_t(Xsqlite3PendingByte + 2)) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = int64(SHARED_SIZE) + if !(unixFileLock(tls, pFile, bp /* &lock */) != 0) { + goto __9 + } + tErrno = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + rc = sqliteErrorFromPosixError(tls, tErrno, (SQLITE_IOERR | (int32(15) << 8))) +__9: + ; + + // Drop the temporary PENDING lock + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = Off_t(Xsqlite3PendingByte) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = 1 + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_type = int16(F_UNLCK) + if !((unixFileLock(tls, pFile, bp /* &lock */) != 0) && (rc == SQLITE_OK)) { + goto __10 + } + // This could happen with a network mount + tErrno = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + rc = (SQLITE_IOERR | (int32(8) << 8)) +__10: + ; + + if !(rc != 0) { + goto __11 + } + if !(rc != SQLITE_BUSY) { + goto __13 + } + storeLastErrno(tls, pFile, tErrno) +__13: + ; + goto end_lock + goto __12 +__11: + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnLock++ + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnShared = 1 +__12: + ; + goto __8 +__7: + if !((eFileLock == EXCLUSIVE_LOCK) && ((*UnixInodeInfo)(unsafe.Pointer(pInode)).FnShared > 1)) { + goto __14 + } + // We are trying for an exclusive lock but another thread in this + // same process is still holding a shared lock. + rc = SQLITE_BUSY + goto __15 +__14: + // The request was for a RESERVED or EXCLUSIVE lock. It is + // assumed that there is a SHARED or greater lock on the file + // already. + ; + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_type = int16(F_WRLCK) + + if !(eFileLock == RESERVED_LOCK) { + goto __16 + } + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = (Off_t(Xsqlite3PendingByte + 1)) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = 1 + goto __17 +__16: + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = (Off_t(Xsqlite3PendingByte + 2)) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = int64(SHARED_SIZE) +__17: + ; + + if !(unixFileLock(tls, pFile, bp /* &lock */) != 0) { + goto __18 + } + tErrno = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + rc = sqliteErrorFromPosixError(tls, tErrno, (SQLITE_IOERR | (int32(15) << 8))) + if !(rc != SQLITE_BUSY) { + goto __19 + } + storeLastErrno(tls, pFile, tErrno) +__19: + ; +__18: + ; +__15: + ; +__8: + ; + + if !(rc == SQLITE_OK) { + goto __20 + } + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(eFileLock) + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(eFileLock) + goto __21 +__20: + if !(eFileLock == EXCLUSIVE_LOCK) { + goto __22 + } + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(PENDING_LOCK) + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(PENDING_LOCK) +__22: + ; +__21: + ; + +end_lock: + Xsqlite3_mutex_leave(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + + return rc +} + +// Add the file descriptor used by file handle pFile to the corresponding +// pUnused list. +func setPendingFd(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35943:13: */ + var pInode uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + var p uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused + + (*UnixUnusedFd)(unsafe.Pointer(p)).FpNext = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpUnused + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpUnused = p + (*UnixFile)(unsafe.Pointer(pFile)).Fh = -1 + (*UnixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused = uintptr(0) +} + +// Lower the locking level on file descriptor pFile to eFileLock. eFileLock +// must be either NO_LOCK or SHARED_LOCK. +// +// If the locking level of the file descriptor is already at or below +// the requested locking level, this routine is a no-op. +// +// If handleNFSUnlock is true, then on downgrading an EXCLUSIVE_LOCK to SHARED +// the byte range is divided into 2 parts and the first part is unlocked then +// set to a read lock, then the other part is simply unlocked. This works +// around a bug in BSD NFS lockd (also seen on MacOSX 10.3+) that fails to +// remove the write lock on a region when a read lock is set. +func posixUnlock(tls *libc.TLS, id uintptr, eFileLock int32, handleNFSUnlock int32) int32 { /* sqlite3.c:35966:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pFile uintptr + var pInode uintptr + // var lock flock at bp, 32 + + var rc int32 + pFile = id + rc = SQLITE_OK + + if !(int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) <= eFileLock) { + goto __1 + } + return SQLITE_OK +__1: + ; + pInode = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + Xsqlite3_mutex_enter(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + + if !(int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) > SHARED_LOCK) { + goto __2 + } + + // downgrading to a shared lock on NFS involves clearing the write lock + // before establishing the readlock - to avoid a race condition we downgrade + // the lock in 2 blocks, so that part of the range will be covered by a + // write lock until the rest is covered by a read lock: + // 1: [WWWWW] + // 2: [....W] + // 3: [RRRRW] + // 4: [RRRR.] + if !(eFileLock == SHARED_LOCK) { + goto __3 + } + _ = handleNFSUnlock + + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_type = int16(F_RDLCK) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = (Off_t(Xsqlite3PendingByte + 2)) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = int64(SHARED_SIZE) + if !(unixFileLock(tls, pFile, bp /* &lock */) != 0) { + goto __4 + } + // In theory, the call to unixFileLock() cannot fail because another + // process is holding an incompatible lock. If it does, this + // indicates that the other process is not following the locking + // protocol. If this happens, return SQLITE_IOERR_RDLOCK. Returning + // SQLITE_BUSY would confuse the upper layer (in practice it causes + // an assert to fail). + rc = (SQLITE_IOERR | (int32(9) << 8)) + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + goto end_unlock +__4: + ; + +__3: + ; + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_type = int16(F_UNLCK) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = Off_t(Xsqlite3PendingByte) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_len = 2 + if !(unixFileLock(tls, pFile, bp /* &lock */) == 0) { + goto __5 + } + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(SHARED_LOCK) + goto __6 +__5: + rc = (SQLITE_IOERR | (int32(8) << 8)) + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + goto end_unlock +__6: + ; +__2: + ; + if !(eFileLock == NO_LOCK) { + goto __7 + } + // Decrement the shared lock counter. Release the lock using an + // OS call only when all threads in this same process have released + // the lock. + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnShared-- + if !((*UnixInodeInfo)(unsafe.Pointer(pInode)).FnShared == 0) { + goto __8 + } + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_type = int16(F_UNLCK) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp /* &lock */)).Fl_start = libc.AssignPtrInt64(bp /* &lock */ +8 /* &.l_len */, 0) + if !(unixFileLock(tls, pFile, bp /* &lock */) == 0) { + goto __9 + } + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(NO_LOCK) + goto __10 +__9: + rc = (SQLITE_IOERR | (int32(8) << 8)) + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FeFileLock = uint8(NO_LOCK) + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(NO_LOCK) +__10: + ; +__8: + ; + + // Decrement the count of locks against this same file. When the + // count reaches zero, close any other file descriptors whose close + // was deferred because of outstanding locks. + (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnLock-- + + if !((*UnixInodeInfo)(unsafe.Pointer(pInode)).FnLock == 0) { + goto __11 + } + closePendingFds(tls, pFile) +__11: + ; +__7: + ; + +end_unlock: + Xsqlite3_mutex_leave(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + if !(rc == SQLITE_OK) { + goto __12 + } + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(eFileLock) +__12: + ; + return rc +} + +// Lower the locking level on file descriptor pFile to eFileLock. eFileLock +// must be either NO_LOCK or SHARED_LOCK. +// +// If the locking level of the file descriptor is already at or below +// the requested locking level, this routine is a no-op. +func unixUnlock(tls *libc.TLS, id uintptr, eFileLock int32) int32 { /* sqlite3.c:36126:12: */ + + return posixUnlock(tls, id, eFileLock, 0) +} + +// This function performs the parts of the "close file" operation +// common to all locking schemes. It closes the directory and file +// handles, if they are valid, and sets all fields of the unixFile +// structure to 0. +// +// It is *not* necessary to hold the mutex when this routine is called, +// even on VxWorks. A mutex will be acquired on VxWorks by the +// vxworksReleaseFileId() routine. +func closeUnixFile(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:36148:12: */ + var pFile uintptr = id + unixUnmapfile(tls, pFile) + if (*UnixFile)(unsafe.Pointer(pFile)).Fh >= 0 { + robust_close(tls, pFile, (*UnixFile)(unsafe.Pointer(pFile)).Fh, 36154) + (*UnixFile)(unsafe.Pointer(pFile)).Fh = -1 + } + + Xsqlite3_free(tls, (*UnixFile)(unsafe.Pointer(pFile)).FpPreallocatedUnused) + libc.Xmemset(tls, pFile, 0, uint64(unsafe.Sizeof(UnixFile{}))) + return SQLITE_OK +} + +// Close a file. +func unixClose(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:36183:12: */ + var rc int32 = SQLITE_OK + var pFile uintptr = id + var pInode uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FpInode + + verifyDbFile(tls, pFile) + unixUnlock(tls, id, NO_LOCK) + + unixEnterMutex(tls) + + // unixFile.pInode is always valid here. Otherwise, a different close + // routine (e.g. nolockClose()) would be called instead. + + Xsqlite3_mutex_enter(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + if (*UnixInodeInfo)(unsafe.Pointer(pInode)).FnLock != 0 { + // If there are outstanding locks, do not actually close the file just + // yet because that would clear those locks. Instead, add the file + // descriptor to pInode->pUnused list. It will be automatically closed + // when the last lock is cleared. + setPendingFd(tls, pFile) + } + Xsqlite3_mutex_leave(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + releaseInodeInfo(tls, pFile) + + rc = closeUnixFile(tls, id) + unixLeaveMutex(tls) + return rc +} + +// ************* End of the posix advisory lock implementation ***************** +// +// + +// ***************************************************************************** +// +// No-op Locking ********************************** +// +// Of the various locking implementations available, this is by far the +// simplest: locking is ignored. No attempt is made to lock the database +// file for reading or writing. +// +// This locking mode is appropriate for use on read-only databases +// (ex: databases that are burned into CD-ROM, for example.) It can +// also be used if the application employs some external mechanism to +// prevent simultaneous access of the same database by two or more +// database connections. But there is a serious risk of database +// corruption if this locking mode is used in situations where multiple +// database connections are accessing the same database file at the same +// time and one or more of those connections are writing. + +func nolockCheckReservedLock(tls *libc.TLS, NotUsed uintptr, pResOut uintptr) int32 { /* sqlite3.c:36235:12: */ + _ = NotUsed + *(*int32)(unsafe.Pointer(pResOut)) = 0 + return SQLITE_OK +} + +func nolockLock(tls *libc.TLS, NotUsed uintptr, NotUsed2 int32) int32 { /* sqlite3.c:36240:12: */ + _ = NotUsed + _ = NotUsed2 + return SQLITE_OK +} + +func nolockUnlock(tls *libc.TLS, NotUsed uintptr, NotUsed2 int32) int32 { /* sqlite3.c:36244:12: */ + _ = NotUsed + _ = NotUsed2 + return SQLITE_OK +} + +// Close the file. +func nolockClose(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:36252:12: */ + return closeUnixFile(tls, id) +} + +// ****************** End of the no-op lock implementation ********************* +// +// + +// ***************************************************************************** +// +// Begin dot-file Locking ****************************** +// +// The dotfile locking implementation uses the existence of separate lock +// files (really a directory) to control access to the database. This works +// on just about every filesystem imaginable. But there are serious downsides: +// +// (1) There is zero concurrency. A single reader blocks all other +// connections from reading or writing the database. +// +// (2) An application crash or power loss can leave stale lock files +// sitting around that need to be cleared manually. +// +// Nevertheless, a dotlock is an appropriate locking mode for use if no +// other locking strategy is available. +// +// Dotfile locking works by creating a subdirectory in the same directory as +// the database and with the same name but with a ".lock" extension added. +// The existence of a lock directory implies an EXCLUSIVE lock. All other +// lock types (SHARED, RESERVED, PENDING) are mapped into EXCLUSIVE. + +// The file suffix added to the data base filename in order to create the +// lock directory. + +// This routine checks if there is a RESERVED lock held on the specified +// file by this or any other process. If such a lock is held, set *pResOut +// to a non-zero value otherwise *pResOut is set to zero. The return value +// is set to SQLITE_OK unless an I/O error occurs during lock checking. +// +// In dotfile locking, either a lock exists or it does not. So in this +// variation of CheckReservedLock(), *pResOut is set to true if any lock +// is held on the file and false if the file is unlocked. +func dotlockCheckReservedLock(tls *libc.TLS, id uintptr, pResOut uintptr) int32 { /* sqlite3.c:36297:12: */ + var rc int32 = SQLITE_OK + var reserved int32 = 0 + var pFile uintptr = id + + reserved = (libc.Bool32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext, 0) == 0)) + + *(*int32)(unsafe.Pointer(pResOut)) = reserved + return rc +} + +// Lock the file with the lock specified by parameter eFileLock - one +// of the following: +// +// (1) SHARED_LOCK +// (2) RESERVED_LOCK +// (3) PENDING_LOCK +// (4) EXCLUSIVE_LOCK +// +// Sometimes when requesting one lock state, additional lock states +// are inserted in between. The locking might fail on one of the later +// transitions leaving the lock state different from what it started but +// still short of its goal. The following chart shows the allowed +// transitions and the inserted intermediate states: +// +// UNLOCKED -> SHARED +// SHARED -> RESERVED +// SHARED -> (PENDING) -> EXCLUSIVE +// RESERVED -> (PENDING) -> EXCLUSIVE +// PENDING -> EXCLUSIVE +// +// This routine will only increase a lock. Use the sqlite3OsUnlock() +// routine to lower a locking level. +// +// With dotfile locking, we really only support state (4): EXCLUSIVE. +// But we track the other locking levels internally. +func dotlockLock(tls *libc.TLS, id uintptr, eFileLock int32) int32 { /* sqlite3.c:36338:12: */ + var pFile uintptr = id + var zLockFile uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext + var rc int32 = SQLITE_OK + + // If we have any lock, then the lock file already exists. All we have + // to do is adjust our internal record of the lock level. + if int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) > NO_LOCK { + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(eFileLock) + // Always update the timestamp on the old file + libc.Xutimes(tls, zLockFile, uintptr(0)) + return SQLITE_OK + } + + // grab an exclusive lock + rc = (*(*func(*libc.TLS, uintptr, Mode_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 18*24 + 8 /* &.pCurrent */))))(tls, zLockFile, uint16(0777)) + if rc < 0 { + // failed to open/create the lock directory + var tErrno int32 = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + if EEXIST == tErrno { + rc = SQLITE_BUSY + } else { + rc = sqliteErrorFromPosixError(tls, tErrno, (SQLITE_IOERR | (int32(15) << 8))) + if rc != SQLITE_BUSY { + storeLastErrno(tls, pFile, tErrno) + } + } + return rc + } + + // got it, set the type and return ok + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(eFileLock) + return rc +} + +// Lower the locking level on file descriptor pFile to eFileLock. eFileLock +// must be either NO_LOCK or SHARED_LOCK. +// +// If the locking level of the file descriptor is already at or below +// the requested locking level, this routine is a no-op. +// +// When the locking level reaches NO_LOCK, delete the lock file. +func dotlockUnlock(tls *libc.TLS, id uintptr, eFileLock int32) int32 { /* sqlite3.c:36388:12: */ + var pFile uintptr = id + var zLockFile uintptr = (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext + var rc int32 + + // no-op if possible + if int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) == eFileLock { + return SQLITE_OK + } + + // To downgrade to shared, simply update our internal notion of the + // lock state. No need to mess with the file on disk. + if eFileLock == SHARED_LOCK { + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(SHARED_LOCK) + return SQLITE_OK + } + + // To fully unlock the database, delete the lock file + + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 19*24 + 8 /* &.pCurrent */))))(tls, zLockFile) + if rc < 0 { + var tErrno int32 = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + if tErrno == ENOENT { + rc = SQLITE_OK + } else { + rc = (SQLITE_IOERR | (int32(8) << 8)) + storeLastErrno(tls, pFile, tErrno) + } + return rc + } + (*UnixFile)(unsafe.Pointer(pFile)).FeFileLock = uint8(NO_LOCK) + return SQLITE_OK +} + +// Close a file. Make sure the lock has been released before closing. +func dotlockClose(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:36431:12: */ + var pFile uintptr = id + + dotlockUnlock(tls, id, NO_LOCK) + Xsqlite3_free(tls, (*UnixFile)(unsafe.Pointer(pFile)).FlockingContext) + return closeUnixFile(tls, id) +} + +// ***************** End of the dot-file lock implementation ******************* +// +// + +// ***************************************************************************** +// +// Begin flock Locking ******************************** +// +// Use the flock() system call to do file locking. +// +// flock() locking is like dot-file locking in that the various +// fine-grain locking levels supported by SQLite are collapsed into +// a single exclusive lock. In other words, SHARED, RESERVED, and +// PENDING locks are the same thing as an EXCLUSIVE lock. SQLite +// still works when you do this, but concurrency is reduced since +// only a single process can be reading the database at a time. +// +// Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off + +// ****************** End of the flock lock implementation ********************* +// +// + +// ***************************************************************************** +// +// Begin Named Semaphore Locking ************************ +// +// Named semaphore locking is only supported on VxWorks. +// +// Semaphore locking is like dot-lock and flock in that it really only +// supports EXCLUSIVE locking. Only a single process can read or write +// the database file at a time. This reduces potential concurrency, but +// makes the lock implementation much easier. +// +// Named semaphore locking is only available on VxWorks. +// +// End of the named semaphore lock implementation **************** +// + +// ***************************************************************************** +// +// Begin AFP Locking ********************************* +// +// AFP is the Apple Filing Protocol. AFP is a network filesystem found +// on Apple Macintosh computers - both OS9 and OSX. +// +// Third-party implementations of AFP are available. But this code here +// only works on OSX. + +// +// The code above is the AFP lock implementation. The code is specific +// to MacOSX and does not work on other unix platforms. No alternative +// is available. If you don't compile for a mac, then the "unix-afp" +// VFS is not available. +// +// End of the AFP lock implementation ********************** +// + +// ***************************************************************************** +// +// Begin NFS Locking ******************************* + +// +// The code above is the NFS lock implementation. The code is specific +// to MacOSX and does not work on other unix platforms. No alternative +// is available. +// +// End of the NFS lock implementation ********************** +// + +// ***************************************************************************** +// +// Non-locking sqlite3_file methods ***************************** +// +// The next division contains implementations for all methods of the +// sqlite3_file object other than the locking methods. The locking +// methods were defined in divisions above (one locking method per +// division). Those methods that are common to all locking modes +// are gather together into this division. + +// Seek to the offset passed as the second argument, then read cnt +// bytes into pBuf. Return the number of bytes actually read. +// +// NB: If you define USE_PREAD or USE_PREAD64, then it might also +// be necessary to define _XOPEN_SOURCE to be 500. This varies from +// one system to another. Since SQLite does not define USE_PREAD +// in any form by default, we will not attempt to define _XOPEN_SOURCE. +// See tickets #2741 and #2681. +// +// To avoid stomping the errno value on a failed read the lastErrno value +// is set before returning. +func seekAndRead(tls *libc.TLS, id uintptr, offset Sqlite3_int64, pBuf uintptr, cnt int32) int32 { /* sqlite3.c:37345:12: */ + var got int32 + var prior int32 = 0 + var newOffset I64 + + for ok := true; ok; ok = (got > 0) { + newOffset = I64(libc.Xlseek(tls, (*UnixFile)(unsafe.Pointer(id)).Fh, int64(offset), SEEK_SET)) + + if newOffset < int64(0) { + storeLastErrno(tls, id, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + return -1 + } + got = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(id)).Fh, pBuf, uint64(cnt))) + if got == cnt { + break + } + if got < 0 { + if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR { + got = 1 + continue + } + prior = 0 + storeLastErrno(tls, id, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + break + } else if got > 0 { + cnt = cnt - (got) + offset = offset + (Sqlite3_int64(got)) + prior = prior + (got) + pBuf = (uintptr(got) + pBuf) + } + } + + return (got + prior) +} + +// Read data from a file into a buffer. Return SQLITE_OK if all +// bytes were read successfully and SQLITE_IOERR if anything goes +// wrong. +func unixRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Sqlite3_int64) int32 { /* sqlite3.c:37394:12: */ + var pFile uintptr = id + var got int32 + + // If this is a database file (not a journal, super-journal or temp + // file), the bytes in the locking range should never be read or written. + + // Deal with as much of this read request as possible by transfering + // data from the memory mapping using memcpy(). + if offset < (*UnixFile)(unsafe.Pointer(pFile)).FmmapSize { + if (offset + Sqlite3_int64(amt)) <= (*UnixFile)(unsafe.Pointer(pFile)).FmmapSize { + libc.Xmemcpy(tls, pBuf, (((*UnixFile)(unsafe.Pointer(pFile)).FpMapRegion) + uintptr(offset)), uint64(amt)) + return SQLITE_OK + } else { + var nCopy int32 = (int32((*UnixFile)(unsafe.Pointer(pFile)).FmmapSize - offset)) + libc.Xmemcpy(tls, pBuf, (((*UnixFile)(unsafe.Pointer(pFile)).FpMapRegion) + uintptr(offset)), uint64(nCopy)) + pBuf = ((pBuf) + uintptr(nCopy)) + amt = amt - (nCopy) + offset = offset + (Sqlite3_int64(nCopy)) + } + } + + got = seekAndRead(tls, pFile, offset, pBuf, amt) + if got == amt { + return SQLITE_OK + } else if got < 0 { + // pFile->lastErrno has been set by seekAndRead(). + // Usually we return SQLITE_IOERR_READ here, though for some + // kinds of errors we return SQLITE_IOERR_CORRUPTFS. The + // SQLITE_IOERR_CORRUPTFS will be converted into SQLITE_CORRUPT + // prior to returning to the application by the sqlite3ApiExit() + // routine. + switch (*UnixFile)(unsafe.Pointer(pFile)).FlastErrno { + case ERANGE: + fallthrough + case EIO: + fallthrough + case ENXIO: + return (SQLITE_IOERR | (int32(33) << 8)) + } + return (SQLITE_IOERR | (int32(1) << 8)) + } else { + storeLastErrno(tls, pFile, 0) // not a system error + // Unread parts of the buffer must be zero-filled + libc.Xmemset(tls, ((pBuf) + uintptr(got)), 0, (uint64(amt - got))) + return (SQLITE_IOERR | (int32(2) << 8)) + } + return int32(0) +} + +// Attempt to seek the file-descriptor passed as the first argument to +// absolute offset iOff, then attempt to write nBuf bytes of data from +// pBuf to it. If an error occurs, return -1 and set *piErrno. Otherwise, +// return the actual number of bytes written (which may be less than +// nBuf). +func seekAndWriteFd(tls *libc.TLS, fd int32, iOff I64, pBuf uintptr, nBuf int32, piErrno uintptr) int32 { /* sqlite3.c:37470:12: */ + var rc int32 = 0 // Value returned by system call + + nBuf = nBuf & (0x1ffff) + + for ok := true; ok; ok = ((rc < 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR)) { + var iSeek I64 = I64(libc.Xlseek(tls, fd, int64(iOff), SEEK_SET)) + + if iSeek < int64(0) { + rc = -1 + break + } + rc = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*24 + 8 /* &.pCurrent */))))(tls, fd, pBuf, uint64(nBuf))) + } + + if rc < 0 { + *(*int32)(unsafe.Pointer(piErrno)) = *(*int32)(unsafe.Pointer(libc.X__error(tls))) + } + return rc +} + +// Seek to the offset in id->offset then read cnt bytes into pBuf. +// Return the number of bytes actually read. Update the offset. +// +// To avoid stomping the errno value on a failed write the lastErrno value +// is set before returning. +func seekAndWrite(tls *libc.TLS, id uintptr, offset I64, pBuf uintptr, cnt int32) int32 { /* sqlite3.c:37516:12: */ + return seekAndWriteFd(tls, (*UnixFile)(unsafe.Pointer(id)).Fh, offset, pBuf, cnt, (id + 32 /* &.lastErrno */)) +} + +// Write data from a buffer into a file. Return SQLITE_OK on success +// or some other error code on failure. +func unixWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Sqlite3_int64) int32 { /* sqlite3.c:37525:12: */ + var pFile uintptr = id + var wrote int32 = 0 + + // If this is a database file (not a journal, super-journal or temp + // file), the bytes in the locking range should never be read or written. + + for ((libc.AssignInt32(&wrote, seekAndWrite(tls, pFile, offset, pBuf, amt))) < amt) && (wrote > 0) { + amt = amt - (wrote) + offset = offset + (Sqlite3_int64(wrote)) + pBuf = ((pBuf) + uintptr(wrote)) + } + + if amt > wrote { + if (wrote < 0) && ((*UnixFile)(unsafe.Pointer(pFile)).FlastErrno != ENOSPC) { + // lastErrno set by seekAndWrite + return (SQLITE_IOERR | (int32(3) << 8)) + } else { + storeLastErrno(tls, pFile, 0) // not a system error + return SQLITE_FULL + } + } + + return SQLITE_OK +} + +// We do not trust systems to provide a working fdatasync(). Some do. +// Others do no. To be safe, we will stick with the (slightly slower) +// fsync(). If you know that your system does support fdatasync() correctly, +// then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC + +// Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not +// the F_FULLFSYNC macro is defined. F_FULLFSYNC is currently +// only available on Mac OS X. But that could change. + +// The fsync() system call does not work as advertised on many +// unix systems. The following procedure is an attempt to make +// it work better. +// +// The SQLITE_NO_SYNC macro disables all fsync()s. This is useful +// for testing when we want to run through the test suite quickly. +// You are strongly advised *not* to deploy with SQLITE_NO_SYNC +// enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash +// or power failure will likely corrupt the database file. +// +// SQLite sets the dataOnly flag if the size of the file is unchanged. +// The idea behind dataOnly is that it should only write the file content +// to disk, not the inode. We only set dataOnly if the file size is +// unchanged since the file size is part of the inode. However, +// Ted Ts'o tells us that fdatasync() will also write the inode if the +// file size has changed. The only real difference between fdatasync() +// and fsync(), Ted tells us, is that fdatasync() will not flush the +// inode if the mtime or owner or other inode attributes have changed. +// We only care about the file size, not the other file attributes, so +// as far as SQLite is concerned, an fdatasync() is always adequate. +// So, we always use fdatasync() if it is available, regardless of +// the value of the dataOnly flag. +func full_fsync(tls *libc.TLS, fd int32, fullSync int32, dataOnly int32) int32 { /* sqlite3.c:37660:12: */ + var rc int32 + + // The following "ifdef/elif/else/" block has the same structure as + // the one below. It is replicated here solely to avoid cluttering + // up the real code with the UNUSED_PARAMETER() macros. + _ = fullSync + _ = dataOnly + + // Record the number of times that we do a normal fsync() and + // FULLSYNC. This is used during testing to verify that this procedure + // gets called with the correct arguments. + + // If we compiled with the SQLITE_NO_SYNC flag, then syncing is a + // no-op. But go ahead and call fstat() to validate the file + // descriptor as we need a method to provoke a failure during + // coverate testing. + rc = libc.Xfsync(tls, fd) + + if (0 != 0) && (rc != -1) { + rc = 0 + } + return rc +} + +// Open a file descriptor to the directory containing file zFilename. +// If successful, *pFd is set to the opened file descriptor and +// SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM +// or SQLITE_CANTOPEN is returned and *pFd is set to an undefined +// value. +// +// The directory file descriptor is used for only one thing - to +// fsync() a directory to make sure file creation and deletion events +// are flushed to disk. Such fsyncs are not needed on newer +// journaling filesystems, but are required on older filesystems. +// +// This routine can be overridden using the xSetSysCall interface. +// The ability to override this routine was added in support of the +// chromium sandbox. Opening a directory is a security risk (we are +// told) so making it overrideable allows the chromium sandbox to +// replace this routine with a harmless no-op. To make this routine +// a no-op, replace it with a stub that returns SQLITE_OK but leaves +// *pFd set to a negative number. +// +// If SQLITE_OK is returned, the caller is responsible for closing +// the file descriptor *pFd using close(). +func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sqlite3.c:37756:12: */ + bp := tls.Alloc(521) + defer tls.Free(521) + + var ii int32 + var fd int32 = -1 + // var zDirname [513]int8 at bp+8, 513 + + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2791 /* "%s" */, libc.VaList(bp, zFilename)) + for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { + } + if ii > 0 { + *(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii))) = int8(0) + } else { + if int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */))) != '/' { + *(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */)) = int8('.') + } + *(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + 1)) = int8(0) + } + fd = robust_open(tls, bp+8 /* &zDirname[0] */, (O_RDONLY | O_BINARY), uint16(0)) + if fd >= 0 { + + } + *(*int32)(unsafe.Pointer(pFd)) = fd + if fd >= 0 { + return SQLITE_OK + } + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2506 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) +} + +// Make sure all writes to a particular file are committed to disk. +// +// If dataOnly==0 then both the file itself and its metadata (file +// size, access time, etc) are synced. If dataOnly!=0 then only the +// file data is synced. +// +// Under Unix, also make sure that the directory entry for the file +// has been created by fsync-ing the directory that contains the file. +// If we do not do this and we encounter a power failure, the directory +// entry for the journal might not exist after we reboot. The next +// SQLite to access the file will not know that the journal exists (because +// the directory entry for the journal was never created) and the transaction +// will not roll back - possibly leading to database corruption. +func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 + var pFile uintptr = id + + var isDataOnly int32 = (flags & SQLITE_SYNC_DATAONLY) + var isFullsync int32 = (libc.Bool32((flags & 0x0F) == SQLITE_SYNC_FULL)) + + // Check that one of SQLITE_SYNC_NORMAL or FULL was passed + + // Unix cannot, but some systems may return SQLITE_FULL from here. This + // line is to test that doing so does not cause any problems. + + rc = full_fsync(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, isFullsync, isDataOnly) + + if rc != 0 { + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2794 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + } + + // Also fsync the directory containing the file if the DIRSYNC flag + // is set. This is a one-time occurrence. Many systems (examples: AIX) + // are unable to fsync a directory, so ignore errors on the fsync. + if (int32((*UnixFile)(unsafe.Pointer(pFile)).FctrlFlags) & UNIXFILE_DIRSYNC) != 0 { + // var dirfd int32 at bp, 4 + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, bp /* &dirfd */) + if rc == SQLITE_OK { + full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* dirfd */)), 0, 0) + robust_close(tls, pFile, *(*int32)(unsafe.Pointer(bp /* dirfd */)), 37830) + } else { + + rc = SQLITE_OK + } + *(*uint16)(unsafe.Pointer(pFile + 30 /* &.ctrlFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(UNIXFILE_DIRSYNC))) + } + return rc +} + +// Truncate an open file to a specified size +func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:37843:12: */ + var pFile uintptr = id + var rc int32 + + // If the user has configured a chunk-size for this file, truncate the + // file so that it consists of an integer number of chunks (i.e. the + // actual file size after the operation may be larger than the requested + // size). + if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk > 0 { + nByte = ((((nByte + I64((*UnixFile)(unsafe.Pointer(pFile)).FszChunk)) - int64(1)) / I64((*UnixFile)(unsafe.Pointer(pFile)).FszChunk)) * I64((*UnixFile)(unsafe.Pointer(pFile)).FszChunk)) + } + + rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) + if rc != 0 { + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2425 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + } else { + + // If the file was just truncated to a size smaller than the currently + // mapped region, reduce the effective mapping size as well. SQLite will + // use read() and write() to access data beyond this point from now on. + if nByte < (*UnixFile)(unsafe.Pointer(pFile)).FmmapSize { + (*UnixFile)(unsafe.Pointer(pFile)).FmmapSize = nByte + } + + return SQLITE_OK + } + return int32(0) +} + +// Determine the current size of a file in bytes +func unixFileSize(tls *libc.TLS, id uintptr, pSize uintptr) int32 { /* sqlite3.c:37893:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + var rc int32 + // var buf stat at bp, 224 + + rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(id)).Fh, bp /* &buf */) + + if rc != 0 { + storeLastErrno(tls, id, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + return (SQLITE_IOERR | (int32(7) << 8)) + } + *(*I64)(unsafe.Pointer(pSize)) = I64((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_size) + + // When opening a zero-size database, the findInodeInfo() procedure + // writes a single byte into that file in order to work around a bug + // in the OS-X msdos filesystem. In order to avoid problems with upper + // layers, we need to report this file size as zero even though it is + // really 1. Ticket #3260. + if *(*I64)(unsafe.Pointer(pSize)) == int64(1) { + *(*I64)(unsafe.Pointer(pSize)) = int64(0) + } + + return SQLITE_OK +} + +// This function is called to handle the SQLITE_FCNTL_SIZE_HINT +// file-control operation. Enlarge the database to nBytes in size +// (rounded up to the next chunk-size). If the database is already +// nBytes or larger, this routine is a no-op. +func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c:37931:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk > 0 { + var nSize I64 // Required file size + // var buf stat at bp, 224 + // Used to hold return values of fstat() + + if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp /* &buf */) != 0 { + return (SQLITE_IOERR | (int32(7) << 8)) + } + + nSize = ((((nByte + I64((*UnixFile)(unsafe.Pointer(pFile)).FszChunk)) - int64(1)) / I64((*UnixFile)(unsafe.Pointer(pFile)).FszChunk)) * I64((*UnixFile)(unsafe.Pointer(pFile)).FszChunk)) + if nSize > I64((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_size) { + + // If the OS does not have posix_fallocate(), fake it. Write a + // single byte to the last byte in each block that falls entirely + // within the extended region. Then, if required, a single byte + // at offset (nSize-1), to set the size of the file correctly. + // This is a similar technique to that used by glibc on systems + // that do not have a real fallocate() call. + var nBlk int32 = (*stat)(unsafe.Pointer(bp /* &buf */)).Fst_blksize // File-system block size + var nWrite int32 = 0 // Number of bytes written by seekAndWrite + var iWrite I64 // Next offset to write to + + iWrite = (I64(((((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_size / Off_t(nBlk)) * Off_t(nBlk)) + Off_t(nBlk)) - int64(1))) + + for ; iWrite < ((nSize + I64(nBlk)) - int64(1)); iWrite = iWrite + (I64(nBlk)) { + if iWrite >= nSize { + iWrite = (nSize - int64(1)) + } + nWrite = seekAndWrite(tls, pFile, iWrite, ts+756 /* "" */, 1) + if nWrite != 1 { + return (SQLITE_IOERR | (int32(3) << 8)) + } + } + } + } + + if ((*UnixFile)(unsafe.Pointer(pFile)).FmmapSizeMax > int64(0)) && (nByte > (*UnixFile)(unsafe.Pointer(pFile)).FmmapSize) { + var rc int32 + if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { + if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { + storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__error(tls)))) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2425 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + } + } + + rc = unixMapfile(tls, pFile, nByte) + return rc + } + + return SQLITE_OK +} + +// If *pArg is initially negative then this is a query. Set *pArg to +// 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. +// +// If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. +func unixModeBit(tls *libc.TLS, pFile uintptr, mask uint8, pArg uintptr) { /* sqlite3.c:38000:13: */ + if *(*int32)(unsafe.Pointer(pArg)) < 0 { + *(*int32)(unsafe.Pointer(pArg)) = (libc.Bool32((int32((*UnixFile)(unsafe.Pointer(pFile)).FctrlFlags) & int32(mask)) != 0)) + } else if (*(*int32)(unsafe.Pointer(pArg))) == 0 { + *(*uint16)(unsafe.Pointer(pFile + 30 /* &.ctrlFlags */)) &= uint16((^int32(mask))) + } else { + *(*uint16)(unsafe.Pointer(pFile + 30 /* &.ctrlFlags */)) |= uint16((int32(mask))) + } +} + +// Information and control of an open file handle. +func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:38017:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pFile uintptr = id + switch op { + + case SQLITE_FCNTL_LOCKSTATE: + { + *(*int32)(unsafe.Pointer(pArg)) = int32((*UnixFile)(unsafe.Pointer(pFile)).FeFileLock) + return SQLITE_OK + + } + case SQLITE_FCNTL_LAST_ERRNO: + { + *(*int32)(unsafe.Pointer(pArg)) = (*UnixFile)(unsafe.Pointer(pFile)).FlastErrno + return SQLITE_OK + + } + case SQLITE_FCNTL_CHUNK_SIZE: + { + (*UnixFile)(unsafe.Pointer(pFile)).FszChunk = *(*int32)(unsafe.Pointer(pArg)) + return SQLITE_OK + + } + case SQLITE_FCNTL_SIZE_HINT: + { + var rc int32 + + rc = fcntlSizeHint(tls, pFile, *(*I64)(unsafe.Pointer(pArg))) + + return rc + + } + case SQLITE_FCNTL_PERSIST_WAL: + { + unixModeBit(tls, pFile, uint8(UNIXFILE_PERSIST_WAL), pArg) + return SQLITE_OK + + } + case SQLITE_FCNTL_POWERSAFE_OVERWRITE: + { + unixModeBit(tls, pFile, uint8(UNIXFILE_PSOW), pArg) + return SQLITE_OK + + } + case SQLITE_FCNTL_VFSNAME: + { + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + return SQLITE_OK + + } + case SQLITE_FCNTL_TEMPFILENAME: + { + var zTFile uintptr = Xsqlite3_malloc64(tls, uint64((*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FmxPathname)) + if zTFile != 0 { + unixGetTempname(tls, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FmxPathname, zTFile) + *(*uintptr)(unsafe.Pointer(pArg)) = zTFile + } + return SQLITE_OK + + } + case SQLITE_FCNTL_HAS_MOVED: + { + *(*int32)(unsafe.Pointer(pArg)) = fileHasMoved(tls, pFile) + return SQLITE_OK + + } + case SQLITE_FCNTL_MMAP_SIZE: + { + var newLimit I64 = *(*I64)(unsafe.Pointer(pArg)) + var rc int32 = SQLITE_OK + if newLimit > Xsqlite3Config.FmxMmap { + newLimit = Xsqlite3Config.FmxMmap + } + + // The value of newLimit may be eventually cast to (size_t) and passed + // to mmap(). Restrict its value to 2GB if (size_t) is not at least a + // 64-bit type. + if (newLimit > int64(0)) && (uint64(unsafe.Sizeof(Size_t(0))) < uint64(8)) { + newLimit = (newLimit & int64(0x7FFFFFFF)) + } + + *(*I64)(unsafe.Pointer(pArg)) = (*UnixFile)(unsafe.Pointer(pFile)).FmmapSizeMax + if ((newLimit >= int64(0)) && (newLimit != (*UnixFile)(unsafe.Pointer(pFile)).FmmapSizeMax)) && ((*UnixFile)(unsafe.Pointer(pFile)).FnFetchOut == 0) { + (*UnixFile)(unsafe.Pointer(pFile)).FmmapSizeMax = newLimit + if (*UnixFile)(unsafe.Pointer(pFile)).FmmapSize > int64(0) { + unixUnmapfile(tls, pFile) + rc = unixMapfile(tls, pFile, int64(-1)) + } + } + return rc + + } + + case SQLITE_FCNTL_EXTERNAL_READER: + { + return unixFcntlExternalReader(tls, id, pArg) + + } + } + return SQLITE_NOTFOUND +} + +// If pFd->sectorSize is non-zero when this function is called, it is a +// no-op. Otherwise, the values of pFd->sectorSize and +// pFd->deviceCharacteristics are set according to the file-system +// characteristics. +// +// There are two versions of this function. One for QNX and one for all +// other systems. +func setDeviceCharacteristics(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:38147:13: */ + + if (*UnixFile)(unsafe.Pointer(pFd)).FsectorSize == 0 { + + // Set the POWERSAFE_OVERWRITE flag if requested. + if (int32((*UnixFile)(unsafe.Pointer(pFd)).FctrlFlags) & UNIXFILE_PSOW) != 0 { + *(*int32)(unsafe.Pointer(pFd + 116 /* &.deviceCharacteristics */)) |= (SQLITE_IOCAP_POWERSAFE_OVERWRITE) + } + + (*UnixFile)(unsafe.Pointer(pFd)).FsectorSize = SQLITE_DEFAULT_SECTOR_SIZE + } +} + +// Return the sector size in bytes of the underlying block device for +// the specified file. This is almost always 512 bytes, but may be +// larger for some devices. +// +// SQLite code assumes this function cannot fail. It also assumes that +// if two files are created in the same file-system directory (i.e. +// a database and its journal file) that the sector size will be the +// same for both. +func unixSectorSize(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:38254:12: */ + var pFd uintptr = id + setDeviceCharacteristics(tls, pFd) + return (*UnixFile)(unsafe.Pointer(pFd)).FsectorSize +} + +// Return the device characteristics for the file. +// +// This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default. +// However, that choice is controversial since technically the underlying +// file system does not always provide powersafe overwrites. (In other +// words, after a power-loss event, parts of the file that were never +// written might end up being altered.) However, non-PSOW behavior is very, +// very rare. And asserting PSOW makes a large reduction in the amount +// of required I/O for journaling, since a lot of padding is eliminated. +// Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control +// available to turn it off and URI query parameter available to turn it off. +func unixDeviceCharacteristics(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:38273:12: */ + var pFd uintptr = id + setDeviceCharacteristics(tls, pFd) + return (*UnixFile)(unsafe.Pointer(pFd)).FdeviceCharacteristics +} + +// Return the system page size. +// +// This function should not be called directly by other code in this file. +// Instead, it should be called via macro osGetpagesize(). +func unixGetpagesize(tls *libc.TLS) int32 { /* sqlite3.c:38287:12: */ + return int32(libc.Xsysconf(tls, X_SC_PAGESIZE)) +} + +// Constants used for locking + +// Use F_GETLK to check whether or not there are any readers with open +// wal-mode transactions in other processes on database file pFile. If +// no error occurs, return SQLITE_OK and set (*piOut) to 1 if there are +// such transactions, or 0 otherwise. If an error occurs, return an +// SQLite error code. The final value of *piOut is undefined in this +// case. +func unixFcntlExternalReader(tls *libc.TLS, pFile uintptr, piOut uintptr) int32 { /* sqlite3.c:38386:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(piOut)) = 0 + if (*UnixFile)(unsafe.Pointer(pFile)).FpShm != 0 { + var pShmNode uintptr = (*UnixShm)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpShm)).FpShmNode + // var f flock at bp+8, 32 + + libc.Xmemset(tls, bp+8 /* &f */, 0, uint64(unsafe.Sizeof(flock{}))) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_type = int16(F_WRLCK) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_start = (int64(((22 + SQLITE_SHM_NLOCK) * 4) + 3)) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_len = (int64(SQLITE_SHM_NLOCK - 3)) + + Xsqlite3_mutex_enter(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, F_GETLK, libc.VaList(bp, bp+8 /* &f */)) < 0 { + rc = (SQLITE_IOERR | (int32(15) << 8)) + } else { + *(*int32)(unsafe.Pointer(piOut)) = (libc.Bool32(int32((*flock)(unsafe.Pointer(bp+8 /* &f */)).Fl_type) != F_UNLCK)) + } + Xsqlite3_mutex_leave(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + } + + return rc +} + +// Apply posix advisory locks for all bytes from ofst through ofst+n-1. +// +// Locks block if the mask is exactly UNIX_SHM_C and are non-blocking +// otherwise. +func unixShmSystemLock(tls *libc.TLS, pFile uintptr, lockType int32, ofst int32, n int32) int32 { /* sqlite3.c:38418:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var pShmNode uintptr // Apply locks to this open shared-memory segment + // var f flock at bp+8, 32 + // The posix advisory locking structure + var rc int32 = SQLITE_OK // Result code form fcntl() + + // Access to the unixShmNode object is serialized by the caller + pShmNode = (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpInode)).FpShmNode + + // Shared locks never span more than one byte + + // Locks are within range + + if (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0 { + var res int32 + // Initialize the locking parameters + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_type = int16(lockType) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_start = Off_t(ofst) + (*flock)(unsafe.Pointer(bp + 8 /* &f */)).Fl_len = Off_t(n) + res = (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, F_SETLK, libc.VaList(bp, bp+8 /* &f */)) + if res == -1 { + rc = SQLITE_BUSY + } + } + + // Update the global lock state and do debug tracing + + return rc +} + +// Return the minimum number of 32KB shm regions that should be mapped at +// a time, assuming that each mapping must be an integer multiple of the +// current system page-size. +// +// Usually, this is 1. The exception seems to be systems that are configured +// to use 64KB pages - in this case each mapping must cover at least two +// shm regions. +func unixShmRegionPerMap(tls *libc.TLS) int32 { /* sqlite3.c:38503:12: */ + var shmsz int32 = (32 * 1024) // SHM region size + var pgsz int32 = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 25*24 + 8 /* &.pCurrent */))))(tls) // System page size + // Page size must be a power of 2 + if pgsz < shmsz { + return 1 + } + return (pgsz / shmsz) +} + +// Purge the unixShmNodeList list of all entries with unixShmNode.nRef==0. +// +// This is not a VFS shared-memory method; it is a utility function called +// by VFS shared-memory methods. +func unixShmPurge(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:38517:13: */ + var p uintptr = (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFd)).FpInode)).FpShmNode + + if (p != 0) && ((*UnixShmNode)(unsafe.Pointer(p)).FnRef == 0) { + var nShmPerMap int32 = unixShmRegionPerMap(tls) + var i int32 + + Xsqlite3_mutex_free(tls, (*UnixShmNode)(unsafe.Pointer(p)).FpShmMutex) + for i = 0; i < int32((*UnixShmNode)(unsafe.Pointer(p)).FnRegion); i = i + (nShmPerMap) { + if (*UnixShmNode)(unsafe.Pointer(p)).FhShm >= 0 { + (*(*func(*libc.TLS, uintptr, Size_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 23*24 + 8 /* &.pCurrent */))))(tls, *(*uintptr)(unsafe.Pointer((*UnixShmNode)(unsafe.Pointer(p)).FapRegion + uintptr(i)*8)), uint64((*UnixShmNode)(unsafe.Pointer(p)).FszRegion)) + } else { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*UnixShmNode)(unsafe.Pointer(p)).FapRegion + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*UnixShmNode)(unsafe.Pointer(p)).FapRegion) + if (*UnixShmNode)(unsafe.Pointer(p)).FhShm >= 0 { + robust_close(tls, pFd, (*UnixShmNode)(unsafe.Pointer(p)).FhShm, 38534) + (*UnixShmNode)(unsafe.Pointer(p)).FhShm = -1 + } + (*UnixInodeInfo)(unsafe.Pointer((*UnixShmNode)(unsafe.Pointer(p)).FpInode)).FpShmNode = uintptr(0) + Xsqlite3_free(tls, p) + } +} + +// The DMS lock has not yet been taken on shm file pShmNode. Attempt to +// take it now. Return SQLITE_OK if successful, or an SQLite error +// code otherwise. +// +// If the DMS cannot be locked because this is a readonly_shm=1 +// connection and no other process already holds a lock, return +// SQLITE_READONLY_CANTINIT and set pShmNode->isUnlocked=1. +func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 { /* sqlite3.c:38551:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + // var lock flock at bp+8, 32 + + var rc int32 = SQLITE_OK + + // Use F_GETLK to determine the locks other processes are holding + // on the DMS byte. If it indicates that another process is holding + // a SHARED lock, then this process may also take a SHARED lock + // and proceed with opening the *-shm file. + // + // Or, if no other process is holding any lock, then this process + // is the first to open it. In this case take an EXCLUSIVE lock on the + // DMS byte and truncate the *-shm file to zero bytes in size. Then + // downgrade to a SHARED lock on the DMS byte. + // + // If another process is holding an EXCLUSIVE lock on the DMS byte, + // return SQLITE_BUSY to the caller (it will try again). An earlier + // version of this code attempted the SHARED lock at this point. But + // this introduced a subtle race condition: if the process holding + // EXCLUSIVE failed just before truncating the *-shm file, then this + // process might open and use the *-shm file without truncating it. + // And if the *-shm file has been corrupted by a power failure or + // system crash, the database itself may also become corrupt. + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_whence = int16(SEEK_SET) + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_start = (int64(((22 + SQLITE_SHM_NLOCK) * 4) + SQLITE_SHM_NLOCK)) + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_len = int64(1) + (*flock)(unsafe.Pointer(bp + 8 /* &lock */)).Fl_type = int16(F_WRLCK) + if (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*24 + 8 /* &.pCurrent */))))(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, F_GETLK, libc.VaList(bp, bp+8 /* &lock */)) != 0 { + rc = (SQLITE_IOERR | (int32(15) << 8)) + } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_UNLCK { + if (*UnixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly != 0 { + (*UnixShmNode)(unsafe.Pointer(pShmNode)).FisUnlocked = U8(1) + rc = (SQLITE_READONLY | (int32(5) << 8)) + } else { + rc = unixShmSystemLock(tls, pDbFd, F_WRLCK, (((22 + SQLITE_SHM_NLOCK) * 4) + SQLITE_SHM_NLOCK), 1) + // The first connection to attach must truncate the -shm file. We + // truncate to 3 bytes (an arbitrary small number, less than the + // -shm header size) rather than 0 as a system debugging aid, to + // help detect if a -shm file truncation is legitimate or is the work + // or a rogue process. + if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2425 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + } + } + } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { + rc = SQLITE_BUSY + } + + if rc == SQLITE_OK { + + rc = unixShmSystemLock(tls, pDbFd, F_RDLCK, (((22 + SQLITE_SHM_NLOCK) * 4) + SQLITE_SHM_NLOCK), 1) + } + return rc +} + +// Open a shared-memory area associated with open database file pDbFd. +// This particular implementation uses mmapped files. +// +// The file used to implement shared-memory is in the same directory +// as the open database file and has the same name as the open database +// file with the "-shm" suffix added. For example, if the database file +// is "/home/user1/config.db" then the file that is created and mmapped +// for shared memory will be called "/home/user1/config.db-shm". +// +// Another approach to is to use files in /dev/shm or /dev/tmp or an +// some other tmpfs mount. But if a file in a different directory +// from the database file is used, then differing access permissions +// or a chroot() might cause two different processes on the same +// database to end up using different files for shared memory - +// meaning that their memory would not really be shared - resulting +// in database corruption. Nevertheless, this tmpfs file usage +// can be enabled at compile-time using -DSQLITE_SHM_DIRECTORY="/dev/shm" +// or the equivalent. The use of the SQLITE_SHM_DIRECTORY compile-time +// option results in an incompatible build of SQLite; builds of SQLite +// that with differing SQLITE_SHM_DIRECTORY settings attempt to use the +// same database file at the same time, database corruption will likely +// result. The SQLITE_SHM_DIRECTORY compile-time option is considered +// "unsupported" and may go away in a future SQLite release. +// +// When opening a new shared-memory file, if no other instances of that +// file are currently open, in this process or in other processes, then +// the file must be truncated to zero length or have its header cleared. +// +// If the original database file (pDbFd) is using the "unix-excl" VFS +// that means that an exclusive lock is held on the database file and +// that no other processes are able to read or write the database. In +// that case, we do not really need shared memory. No shared memory +// file is created. The shared memory will be simulated with heap memory. +func unixOpenSharedMemory(tls *libc.TLS, pDbFd uintptr) int32 { /* sqlite3.c:38640:12: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + var p uintptr // The connection to be opened + var pShmNode uintptr // The underlying mmapped file + var rc int32 // Result code + var pInode uintptr // The inode of fd + var zShm uintptr // Name of the file used for SHM + var nShmFilename int32 + // var sStat stat at bp+8, 224 + // fstat() info for database file + var zBasePath uintptr + p = uintptr(0) + rc = SQLITE_OK // Size of the SHM filename in bytes + + // Allocate space for the new unixShm object. + p = Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(unixShm{}))) + if !(p == uintptr(0)) { + goto __1 + } + return SQLITE_NOMEM +__1: + ; + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(unixShm{}))) + + // Check to see if a unixShmNode object already exists. Reuse an existing + // one if present. Create a new one if necessary. + + unixEnterMutex(tls) + pInode = (*UnixFile)(unsafe.Pointer(pDbFd)).FpInode + pShmNode = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpShmNode + if !(pShmNode == uintptr(0)) { + goto __2 + } // fstat() info for database file + zBasePath = (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath + + // Call fstat() to figure out the permissions on the database file. If + // a new *-shm file is created, an attempt will be made to create it + // with the same permissions. + if !((*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).Fh, bp+8 /* &sStat */) != 0) { + goto __3 + } + rc = (SQLITE_IOERR | (int32(7) << 8)) + goto shm_open_err +__3: + ; + + nShmFilename = (6 + int32(libc.Xstrlen(tls, zBasePath))) + pShmNode = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(unixShmNode{})) + uint64(nShmFilename)))) + if !(pShmNode == uintptr(0)) { + goto __4 + } + rc = SQLITE_NOMEM + goto shm_open_err +__4: + ; + libc.Xmemset(tls, pShmNode, 0, (uint64(unsafe.Sizeof(unixShmNode{})) + uint64(nShmFilename))) + zShm = libc.AssignPtrUintptr(pShmNode+16 /* &.zFilename */, (pShmNode + 1*96)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2805 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + + (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 + (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode + (*unixShmNode)(unsafe.Pointer(pShmNode)).FpInode = (*UnixFile)(unsafe.Pointer(pDbFd)).FpInode + if !(Xsqlite3Config.FbCoreMutex != 0) { + goto __5 + } + (*unixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex = Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST) + if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex == uintptr(0)) { + goto __6 + } + rc = SQLITE_NOMEM + goto shm_open_err +__6: + ; +__5: + ; + + if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { + goto __7 + } + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2812 /* "readonly_shm" */, 0)) { + goto __8 + } + (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | O_NOFOLLOW), + (uint16(int32((*stat)(unsafe.Pointer(bp+8 /* &sStat */)).Fst_mode) & 0777))) +__8: + ; + if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { + goto __9 + } + (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, (O_RDONLY | O_NOFOLLOW), + (uint16(int32((*stat)(unsafe.Pointer(bp+8 /* &sStat */)).Fst_mode) & 0777))) + if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { + goto __10 + } + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2389 /* "open" */, zShm, 38716) + goto shm_open_err +__10: + ; + (*unixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly = U8(1) +__9: + ; + + // If this process is running as root, make sure that the SHM file + // is owned by the same user that owns the original database. Otherwise, + // the original owner will not be able to connect. + robustFchown(tls, (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (*stat)(unsafe.Pointer(bp+8 /* &sStat */)).Fst_uid, (*stat)(unsafe.Pointer(bp+8 /* &sStat */)).Fst_gid) + + rc = unixLockSharedMemory(tls, pDbFd, pShmNode) + if !((rc != SQLITE_OK) && (rc != (SQLITE_READONLY | (int32(5) << 8)))) { + goto __11 + } + goto shm_open_err +__11: + ; +__7: + ; +__2: + ; + + // Make the new connection a child of the unixShmNode + (*unixShm)(unsafe.Pointer(p)).FpShmNode = pShmNode + (*unixShmNode)(unsafe.Pointer(pShmNode)).FnRef++ + (*UnixFile)(unsafe.Pointer(pDbFd)).FpShm = p + unixLeaveMutex(tls) + + // The reference count on pShmNode has already been incremented under + // the cover of the unixEnterMutex() mutex and the pointer from the + // new (struct unixShm) object to the pShmNode has been set. All that is + // left to do is to link the new object into the linked list starting + // at pShmNode->pFirst. This must be done while holding the + // pShmNode->pShmMutex. + Xsqlite3_mutex_enter(tls, (*unixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + (*unixShm)(unsafe.Pointer(p)).FpNext = (*unixShmNode)(unsafe.Pointer(pShmNode)).FpFirst + (*unixShmNode)(unsafe.Pointer(pShmNode)).FpFirst = p + Xsqlite3_mutex_leave(tls, (*unixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + return rc + + // Jump here on any error +shm_open_err: + unixShmPurge(tls, pDbFd) // This call frees pShmNode if required + Xsqlite3_free(tls, p) + unixLeaveMutex(tls) + return rc +} + +// This function is called to obtain a pointer to region iRegion of the +// shared-memory associated with the database file fd. Shared-memory regions +// are numbered starting from zero. Each shared-memory region is szRegion +// bytes in size. +// +// If an error occurs, an error code is returned and *pp is set to NULL. +// +// Otherwise, if the bExtend parameter is 0 and the requested shared-memory +// region has not been allocated (by any client, including one running in a +// separate process), then *pp is set to NULL and SQLITE_OK returned. If +// bExtend is non-zero and the requested shared-memory region has not yet +// been allocated, it is allocated by this function. +// +// If the shared-memory region has already been allocated or is allocated by +// this call as described above, then it is mapped into this processes +// address space (if it is not already), *pp is set to point to the mapped +// memory and SQLITE_OK returned. +func unixShmMap(tls *libc.TLS, fd uintptr, iRegion int32, szRegion int32, bExtend int32, pp uintptr) int32 { /* sqlite3.c:38782:12: */ + bp := tls.Alloc(228) + defer tls.Free(228) + + var pDbFd uintptr + var p uintptr + var pShmNode uintptr + var rc int32 + var nShmPerMap int32 + var nReqRegion int32 + var zFile uintptr + // var x int32 at bp+224, 4 + + var iPg int32 + var nMap int32 + var i int32 + var pMem uintptr + var apNew uintptr // New apRegion[] array + var nByte int32 // Minimum required file size + // var sStat stat at bp, 224 + pDbFd = fd + rc = SQLITE_OK + nShmPerMap = unixShmRegionPerMap(tls) + + // If the shared-memory file has not yet been opened, open it now. + if !((*UnixFile)(unsafe.Pointer(pDbFd)).FpShm == uintptr(0)) { + goto __1 + } + rc = unixOpenSharedMemory(tls, pDbFd) + if !(rc != SQLITE_OK) { + goto __2 + } + return rc +__2: + ; +__1: + ; + + p = (*UnixFile)(unsafe.Pointer(pDbFd)).FpShm + pShmNode = (*UnixShm)(unsafe.Pointer(p)).FpShmNode + Xsqlite3_mutex_enter(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + if !((*UnixShmNode)(unsafe.Pointer(pShmNode)).FisUnlocked != 0) { + goto __3 + } + rc = unixLockSharedMemory(tls, pDbFd, pShmNode) + if !(rc != SQLITE_OK) { + goto __4 + } + goto shmpage_out +__4: + ; + (*UnixShmNode)(unsafe.Pointer(pShmNode)).FisUnlocked = U8(0) +__3: + ; + + // Minimum number of regions required to be mapped. + nReqRegion = (((iRegion + nShmPerMap) / nShmPerMap) * nShmPerMap) + + if !(int32((*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRegion) < nReqRegion) { + goto __5 + } // New apRegion[] array + nByte = (nReqRegion * szRegion) // Used by fstat() + + (*UnixShmNode)(unsafe.Pointer(pShmNode)).FszRegion = szRegion + + if !((*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0) { + goto __6 + } + // The requested region is not mapped into this processes address space. + // Check to see if it has been allocated (i.e. if the wal-index file is + // large enough to contain the requested region). + if !((*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, bp /* &sStat */) != 0) { + goto __7 + } + rc = (SQLITE_IOERR | (int32(19) << 8)) + goto shmpage_out +__7: + ; + + if !((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_size < Off_t(nByte)) { + goto __8 + } + // The requested memory region does not exist. If bExtend is set to + // false, exit early. *pp will be set to NULL and SQLITE_OK returned. + if !(!(bExtend != 0)) { + goto __9 + } + goto shmpage_out + goto __10 +__9: + + // Write to the last byte of each newly allocated or extended page + ; + iPg = (int32((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_size / Off_t(pgsz))) +__11: + if !(iPg < (nByte / pgsz)) { + goto __13 + } + *(*int32)(unsafe.Pointer(bp + 224 /* x */)) = 0 + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+756 /* "" */, 1, bp+224 /* &x */) != 1) { + goto __14 + } + zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2460 /* "write" */, zFile, 38860) + goto shmpage_out +__14: + ; + goto __12 +__12: + iPg++ + goto __11 + goto __13 +__13: + ; +__10: + ; +__8: + ; +__6: + ; + + // Map the requested memory region into this processes address space. + apNew = Xsqlite3_realloc(tls, + (*UnixShmNode)(unsafe.Pointer(pShmNode)).FapRegion, (int32(uint64(nReqRegion) * uint64(unsafe.Sizeof(uintptr(0)))))) + if !(!(apNew != 0)) { + goto __15 + } + rc = (SQLITE_IOERR | (int32(12) << 8)) + goto shmpage_out +__15: + ; + (*UnixShmNode)(unsafe.Pointer(pShmNode)).FapRegion = apNew +__16: + if !(int32((*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRegion) < nReqRegion) { + goto __17 + } + nMap = (szRegion * nShmPerMap) + if !((*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0) { + goto __18 + } + pMem = (*(*func(*libc.TLS, uintptr, Size_t, int32, int32, int32, Off_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 22*24 + 8 /* &.pCurrent */))))(tls, uintptr(0), uint64(nMap), + func() int32 { + if (*UnixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly != 0 { + return PROT_READ + } + return (PROT_READ | PROT_WRITE) + }(), + MAP_SHARED, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(I64(szRegion) * I64((*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRegion)))) + if !(pMem == (libc.UintptrFromInt32(-1))) { + goto __20 + } + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2547 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + goto shmpage_out +__20: + ; + goto __19 +__18: + pMem = Xsqlite3_malloc64(tls, uint64(nMap)) + if !(pMem == uintptr(0)) { + goto __21 + } + rc = SQLITE_NOMEM + goto shmpage_out +__21: + ; + libc.Xmemset(tls, pMem, 0, uint64(nMap)) +__19: + ; + + i = 0 +__22: + if !(i < nShmPerMap) { + goto __24 + } + *(*uintptr)(unsafe.Pointer((*UnixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr((int32((*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRegion)+i))*8)) = ((pMem) + uintptr((szRegion * i))) + goto __23 +__23: + i++ + goto __22 + goto __24 +__24: + ; + *(*U16)(unsafe.Pointer(pShmNode + 32 /* &.nRegion */)) += U16((nShmPerMap)) + goto __16 +__17: + ; +__5: + ; + +shmpage_out: + if !(int32((*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRegion) > iRegion) { + goto __25 + } + *(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&pp))) = *(*uintptr)(unsafe.Pointer((*UnixShmNode)(unsafe.Pointer(pShmNode)).FapRegion + uintptr(iRegion)*8)) + goto __26 +__25: + *(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&pp))) = uintptr(0) +__26: + ; + if !(((*UnixShmNode)(unsafe.Pointer(pShmNode)).FisReadonly != 0) && (rc == SQLITE_OK)) { + goto __27 + } + rc = SQLITE_READONLY +__27: + ; + Xsqlite3_mutex_leave(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + return rc +} + +var pgsz int32 = 4096 /* sqlite3.c:38851:28 */ + +// Check that the pShmNode->aLock[] array comports with the locking bitmasks +// held by each client. Return true if it does, or false otherwise. This +// is to be used in an assert(). e.g. +// +// assert( assertLockingArrayOk(pShmNode) ); + +// Change the lock state for a shared-memory segment. +// +// Note that the relationship between SHAREd and EXCLUSIVE locks is a little +// different here than in posix. In xShmLock(), one can go from unlocked +// to shared and back or from unlocked to exclusive and back. But one may +// not go from shared to exclusive or from exclusive to shared. +func unixShmLock(tls *libc.TLS, fd uintptr, ofst int32, n int32, flags int32) int32 { /* sqlite3.c:38957:12: */ + var pDbFd uintptr = fd // Connection holding shared memory + var p uintptr = (*UnixFile)(unsafe.Pointer(pDbFd)).FpShm // The shared memory being locked + var pShmNode uintptr = (*UnixShm)(unsafe.Pointer(p)).FpShmNode // The underlying file iNode + var rc int32 = SQLITE_OK // Result code + var mask U16 // Mask of locks to take or release + var aLock uintptr = pShmNode + 64 /* &.aLock */ + + // Check that, if this to be a blocking lock, no locks that occur later + // in the following list than the lock being obtained are already held: + // + // 1. Checkpointer lock (ofst==1). + // 2. Write lock (ofst==0). + // 3. Read locks (ofst>=3 && ofst (func() int32 { + if (int32((*UnixShm)(unsafe.Pointer(p)).FsharedMask) & (int32(1) << ii)) != 0 { + return 1 + } + return 0 + }()) { + bUnlock = 0 + } + } + + if bUnlock != 0 { + rc = unixShmSystemLock(tls, pDbFd, F_UNLCK, (ofst + ((22 + SQLITE_SHM_NLOCK) * 4)), n) + if rc == SQLITE_OK { + libc.Xmemset(tls, (aLock + uintptr(ofst)*4), 0, (uint64(unsafe.Sizeof(int32(0))) * uint64(n))) + } + } else if (int32((*UnixShm)(unsafe.Pointer(p)).FsharedMask) & (int32(1) << ofst)) != 0 { + + *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4))-- + } + + // Undo the local locks + if rc == SQLITE_OK { + *(*U16)(unsafe.Pointer(p + 20 /* &.exclMask */)) &= U16((^int32(mask))) + *(*U16)(unsafe.Pointer(p + 18 /* &.sharedMask */)) &= U16((^int32(mask))) + } + } + } else if (flags & SQLITE_SHM_SHARED) != 0 { + + if (int32((*UnixShm)(unsafe.Pointer(p)).FsharedMask) & int32(mask)) == 0 { + if *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4)) < 0 { + rc = SQLITE_BUSY + } else if *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4)) == 0 { + rc = unixShmSystemLock(tls, pDbFd, F_RDLCK, (ofst + ((22 + SQLITE_SHM_NLOCK) * 4)), n) + } + + // Get the local shared locks + if rc == SQLITE_OK { + *(*U16)(unsafe.Pointer(p + 18 /* &.sharedMask */)) |= U16((int32(mask))) + *(*int32)(unsafe.Pointer(aLock + uintptr(ofst)*4))++ + } + } + } else { + // Make sure no sibling connections hold locks that will block this + // lock. If any do, return SQLITE_BUSY right away. + var ii int32 + for ii = ofst; ii < (ofst + n); ii++ { + + if ((int32((*UnixShm)(unsafe.Pointer(p)).FexclMask) & (int32(1) << ii)) == 0) && (*(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) != 0) { + rc = SQLITE_BUSY + break + } + } + + // Get the exclusive locks at the system level. Then if successful + // also update the in-memory values. + if rc == SQLITE_OK { + rc = unixShmSystemLock(tls, pDbFd, F_WRLCK, (ofst + ((22 + SQLITE_SHM_NLOCK) * 4)), n) + if rc == SQLITE_OK { + + *(*U16)(unsafe.Pointer(p + 20 /* &.exclMask */)) |= U16((int32(mask))) + for ii = ofst; ii < (ofst + n); ii++ { + *(*int32)(unsafe.Pointer(aLock + uintptr(ii)*4)) = -1 + } + } + } + } + + Xsqlite3_mutex_leave(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + + return rc +} + +// Implement a memory barrier or memory fence on shared memory. +// +// All loads and stores begun before the barrier must complete before +// any load or store begun after the barrier. +func unixShmBarrier(tls *libc.TLS, fd uintptr) { /* sqlite3.c:39089:13: */ + _ = fd + // compiler-defined memory barrier + + unixEnterMutex(tls) // Also mutex, for redundancy + unixLeaveMutex(tls) +} + +// Close a connection to shared-memory. Delete the underlying +// storage if deleteFlag is true. +// +// If there is no shared memory associated with the connection then this +// routine is a harmless no-op. +func unixShmUnmap(tls *libc.TLS, fd uintptr, deleteFlag int32) int32 { /* sqlite3.c:39108:12: */ + var p uintptr // The connection to be closed + var pShmNode uintptr // The underlying shared-memory file + var pp uintptr // For looping over sibling connections + var pDbFd uintptr // The underlying database file + + pDbFd = fd + p = (*UnixFile)(unsafe.Pointer(pDbFd)).FpShm + if p == uintptr(0) { + return SQLITE_OK + } + pShmNode = (*UnixShm)(unsafe.Pointer(p)).FpShmNode + + // Remove connection p from the set of connections associated + // with pShmNode + Xsqlite3_mutex_enter(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + for pp = (pShmNode + 56 /* &.pFirst */); (*(*uintptr)(unsafe.Pointer(pp))) != p; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 8 /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = (*UnixShm)(unsafe.Pointer(p)).FpNext + + // Free the connection p + Xsqlite3_free(tls, p) + (*UnixFile)(unsafe.Pointer(pDbFd)).FpShm = uintptr(0) + Xsqlite3_mutex_leave(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FpShmMutex) + + // If pShmNode->nRef has reached 0, then close the underlying + // shared-memory file, too + + unixEnterMutex(tls) + + (*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRef-- + if (*UnixShmNode)(unsafe.Pointer(pShmNode)).FnRef == 0 { + if (deleteFlag != 0) && ((*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm >= 0) { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 16*24 + 8 /* &.pCurrent */))))(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename) + } + unixShmPurge(tls, pDbFd) + } + unixLeaveMutex(tls) + + return SQLITE_OK +} + +// If it is currently memory mapped, unmap file pFd. +func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ + + if (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion != 0 { + (*(*func(*libc.TLS, uintptr, Size_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 23*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion, uint64((*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual)) + (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion = uintptr(0) + (*UnixFile)(unsafe.Pointer(pFd)).FmmapSize = int64(0) + (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual = int64(0) + } +} + +// Attempt to set the size of the memory mapping maintained by file +// descriptor pFd to nNew bytes. Any existing mapping is discarded. +// +// If successful, this function sets the following variables: +// +// unixFile.pMapRegion +// unixFile.mmapSize +// unixFile.mmapSizeActual +// +// If unsuccessful, an error message is logged via sqlite3_log() and +// the three variables above are zeroed. In this case SQLite should +// continue accessing the database using the xRead() and xWrite() +// methods. +func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ + var zErr uintptr = ts + 2547 /* "mmap" */ + var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file + var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping + var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes + var pNew uintptr = uintptr(0) // Location of new mapping + var flags int32 = PROT_READ // Flags to pass to mmap() + + if pOrig != 0 { + var szSyspage int32 = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 25*24 + 8 /* &.pCurrent */))))(tls) + var nReuse I64 = ((*UnixFile)(unsafe.Pointer(pFd)).FmmapSize & Sqlite3_int64(^(szSyspage - 1))) + var pReq uintptr = (pOrig + uintptr(nReuse)) + + // Unmap any pages of the existing mapping that cannot be reused. + if nReuse != nOrig { + (*(*func(*libc.TLS, uintptr, Size_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 23*24 + 8 /* &.pCurrent */))))(tls, pReq, (uint64(nOrig - nReuse))) + } + + pNew = (*(*func(*libc.TLS, uintptr, Size_t, int32, int32, int32, Off_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 22*24 + 8 /* &.pCurrent */))))(tls, pReq, (uint64(nNew - nReuse)), flags, MAP_SHARED, h, int64(nReuse)) + if pNew != (libc.UintptrFromInt32(-1)) { + if pNew != pReq { + (*(*func(*libc.TLS, uintptr, Size_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 23*24 + 8 /* &.pCurrent */))))(tls, pNew, (uint64(nNew - nReuse))) + pNew = uintptr(0) + } else { + pNew = pOrig + } + } + + // The attempt to extend the existing mapping failed. Free it. + if (pNew == (libc.UintptrFromInt32(-1))) || (pNew == uintptr(0)) { + (*(*func(*libc.TLS, uintptr, Size_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 23*24 + 8 /* &.pCurrent */))))(tls, pOrig, uint64(nReuse)) + } + } + + // If pNew is still NULL, try to create an entirely new mapping. + if pNew == uintptr(0) { + pNew = (*(*func(*libc.TLS, uintptr, Size_t, int32, int32, int32, Off_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 22*24 + 8 /* &.pCurrent */))))(tls, uintptr(0), uint64(nNew), flags, MAP_SHARED, h, int64(0)) + } + + if pNew == (libc.UintptrFromInt32(-1)) { + pNew = uintptr(0) + nNew = int64(0) + unixLogErrorAtLine(tls, SQLITE_OK, zErr, (*UnixFile)(unsafe.Pointer(pFd)).FzPath, 39255) + + // If the mmap() above failed, assume that all subsequent mmap() calls + // will probably fail too. Fall back to using xRead/xWrite exclusively + // in this case. + (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeMax = int64(0) + } + (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion = pNew + (*UnixFile)(unsafe.Pointer(pFd)).FmmapSize = libc.AssignPtrInt64(pFd+88 /* &.mmapSizeActual */, nNew) +} + +// Memory map or remap the file opened by file-descriptor pFd (if the file +// is already mapped, the existing mapping is replaced by the new). Or, if +// there already exists a mapping for this file, and there are still +// outstanding xFetch() references to it, this function is a no-op. +// +// If parameter nByte is non-negative, then it is the requested size of +// the mapping to create. Otherwise, if nByte is less than zero, then the +// requested size is the size of the file on disk. The actual size of the +// created mapping is either the requested size or the value configured +// using SQLITE_FCNTL_MMAP_LIMIT, whichever is smaller. +// +// SQLITE_OK is returned if no error occurs (even if the mapping is not +// recreated as a result of outstanding references) or an SQLite error +// code otherwise. +func unixMapfile(tls *libc.TLS, pFd uintptr, nMap I64) int32 { /* sqlite3.c:39282:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + if (*UnixFile)(unsafe.Pointer(pFd)).FnFetchOut > 0 { + return SQLITE_OK + } + + if nMap < int64(0) { + // var statbuf stat at bp, 224 + // Low-level file information + if (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFd)).Fh, bp /* &statbuf */) != 0 { + return (SQLITE_IOERR | (int32(7) << 8)) + } + nMap = I64((*stat)(unsafe.Pointer(bp /* &statbuf */)).Fst_size) + } + if nMap > (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeMax { + nMap = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeMax + } + + if nMap != (*UnixFile)(unsafe.Pointer(pFd)).FmmapSize { + unixRemapfile(tls, pFd, nMap) + } + + return SQLITE_OK +} + +// If possible, return a pointer to a mapping of file fd starting at offset +// iOff. The mapping must be valid for at least nAmt bytes. +// +// If such a pointer can be obtained, store it in *pp and return SQLITE_OK. +// Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK. +// Finally, if an error does occur, return an SQLite error code. The final +// value of *pp is undefined in this case. +// +// If this function does return a pointer, the caller must eventually +// release the reference by calling unixUnfetch(). +func unixFetch(tls *libc.TLS, fd uintptr, iOff I64, nAmt int32, pp uintptr) int32 { /* sqlite3.c:39319:12: */ + var pFd uintptr = fd // The underlying database file + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + if (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeMax > int64(0) { + if (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion == uintptr(0) { + var rc int32 = unixMapfile(tls, pFd, int64(-1)) + if rc != SQLITE_OK { + return rc + } + } + if (*UnixFile)(unsafe.Pointer(pFd)).FmmapSize >= (iOff + I64(nAmt)) { + *(*uintptr)(unsafe.Pointer(pp)) = (((*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion) + uintptr(iOff)) + (*UnixFile)(unsafe.Pointer(pFd)).FnFetchOut++ + } + } + return SQLITE_OK +} + +// If the third argument is non-NULL, then this function releases a +// reference obtained by an earlier call to unixFetch(). The second +// argument passed to this function must be the same as the corresponding +// argument that was passed to the unixFetch() invocation. +// +// Or, if the third argument is NULL, then this function is being called +// to inform the VFS layer that, according to POSIX, any existing mapping +// may now be invalid and should be unmapped. +func unixUnfetch(tls *libc.TLS, fd uintptr, iOff I64, p uintptr) int32 { /* sqlite3.c:39350:12: */ + var pFd uintptr = fd // The underlying database file + _ = iOff + + // If p==0 (unmap the entire file) then there must be no outstanding + // xFetch references. Or, if p!=0 (meaning it is an xFetch reference), + // then there must be at least one outstanding. + + // If p!=0, it must match the iOff value. + + if p != 0 { + (*UnixFile)(unsafe.Pointer(pFd)).FnFetchOut-- + } else { + unixUnmapfile(tls, pFd) + } + + return SQLITE_OK +} + +// +// Here ends the implementation of all sqlite3_file methods. +// +// End sqlite3_file Methods ******************************* +// + +// This division contains definitions of sqlite3_io_methods objects that +// implement various file locking strategies. It also contains definitions +// of "finder" functions. A finder-function is used to locate the appropriate +// sqlite3_io_methods object for a particular database file. The pAppData +// field of the sqlite3_vfs VFS objects are initialized to be pointers to +// the correct finder-function for that VFS. +// +// Most finder functions return a pointer to a fixed sqlite3_io_methods +// object. The only interesting finder-function is autolockIoFinder, which +// looks at the filesystem type and tries to guess the best locking +// strategy from that. +// +// For finder-function F, two objects are created: +// +// (1) The real finder-function named "FImpt()". +// +// (2) A constant pointer to this function named just "F". +// +// +// A pointer to the F pointer is used as the pAppData value for VFS +// objects. We have to do this instead of letting pAppData point +// directly at the finder-function since C90 rules prevent a void* +// from be cast into a function pointer. +// +// +// Each instance of this macro generates two objects: +// +// * A constant sqlite3_io_methods object call METHOD that has locking +// methods CLOSE, LOCK, UNLOCK, CKRESLOCK. +// +// * An I/O method finder function called FINDER that returns a pointer +// to the METHOD object in the previous bullet. + +// Here are all of the sqlite3_io_methods objects for each of the +// locking strategies. Functions that return pointers to these methods +// are also created. +var posixIoMethods = Sqlite3_io_methods{FiVersion: 3 /* iVersion */, FxClose: 0 /* xClose */, FxRead: 0 /* xRead */, FxWrite: 0 /* xWrite */, FxTruncate: 0 /* xTruncate */, FxSync: 0 /* xSync */, FxFileSize: 0 /* xFileSize */, FxLock: 0 /* xLock */, FxUnlock: 0 /* xUnlock */, FxCheckReservedLock: 0 /* xCheckReservedLock */, FxFileControl: 0 /* xFileControl */, FxSectorSize: 0 /* xSectorSize */, FxDeviceCharacteristics: 0 /* xDeviceCapabilities */, FxShmMap: 0 /* xShmMap */, FxShmLock: 0 /* xShmLock */, FxShmBarrier: 0 /* xShmBarrier */, FxShmUnmap: 0 /* xShmUnmap */, FxFetch: 0 /* xFetch */, FxUnfetch: 0 /* xUnfetch */} /* sqlite3.c:39452:1 */ + +func posixIoFinderImpl(tls *libc.TLS, z uintptr, p uintptr) uintptr { /* sqlite3.c:39452:1: */ + _ = z + _ = p + return uintptr(unsafe.Pointer(&posixIoMethods)) +} + +var posixIoFinder uintptr = 0 /* sqlite3.c:39452:1 */ +var nolockIoMethods = Sqlite3_io_methods{FiVersion: 3 /* iVersion */, FxClose: 0 /* xClose */, FxRead: 0 /* xRead */, FxWrite: 0 /* xWrite */, FxTruncate: 0 /* xTruncate */, FxSync: 0 /* xSync */, FxFileSize: 0 /* xFileSize */, FxLock: 0 /* xLock */, FxUnlock: 0 /* xUnlock */, FxCheckReservedLock: 0 /* xCheckReservedLock */, FxFileControl: 0 /* xFileControl */, FxSectorSize: 0 /* xSectorSize */, FxDeviceCharacteristics: 0 /* xShmMap */, FxShmLock: 0 /* xShmLock */, FxShmBarrier: 0 /* xShmBarrier */, FxShmUnmap: 0 /* xShmUnmap */, FxFetch: 0 /* xFetch */, FxUnfetch: 0 /* xUnfetch */} /* sqlite3.c:39462:1 */ + +func nolockIoFinderImpl(tls *libc.TLS, z uintptr, p uintptr) uintptr { /* sqlite3.c:39462:1: */ + _ = z + _ = p + return uintptr(unsafe.Pointer(&nolockIoMethods)) +} + +var nolockIoFinder uintptr = 0 /* sqlite3.c:39462:1 */ +var dotlockIoMethods = Sqlite3_io_methods{FiVersion: 1 /* iVersion */, FxClose: 0 /* xClose */, FxRead: 0 /* xRead */, FxWrite: 0 /* xWrite */, FxTruncate: 0 /* xTruncate */, FxSync: 0 /* xSync */, FxFileSize: 0 /* xFileSize */, FxLock: 0 /* xLock */, FxUnlock: 0 /* xUnlock */, FxCheckReservedLock: 0 /* xCheckReservedLock */, FxFileControl: 0 /* xFileControl */, FxSectorSize: 0 /* xSectorSize */, FxDeviceCharacteristics: 0 /* xShmMap */, FxShmLock: 0 /* xShmLock */, FxShmBarrier: 0 /* xShmBarrier */, FxShmUnmap: 0 /* xShmUnmap */, FxFetch: 0 /* xFetch */, FxUnfetch: 0 /* xUnfetch */} /* sqlite3.c:39472:1 */ + +func dotlockIoFinderImpl(tls *libc.TLS, z uintptr, p uintptr) uintptr { /* sqlite3.c:39472:1: */ + _ = z + _ = p + return uintptr(unsafe.Pointer(&dotlockIoMethods)) +} + +var dotlockIoFinder uintptr = 0 /* sqlite3.c:39472:1 */ + +// The proxy locking method is a "super-method" in the sense that it +// opens secondary file descriptors for the conch and lock files and +// it uses proxy, dot-file, AFP, and flock() locking methods on those +// secondary files. For this reason, the division that implements +// proxy locking is located much further down in the file. But we need +// to go ahead and define the sqlite3_io_methods and finder function +// for proxy locking here. So we forward declare the I/O methods. + +// nfs lockd on OSX 10.3+ doesn't clear write locks when a read lock is set + +// An abstract type for a pointer to an IO method finder function: +type Finder_type = uintptr /* sqlite3.c:39667:34 */ + +// *************************************************************************** +// +// sqlite3_vfs methods **************************** +// +// This division contains the implementation of methods on the +// sqlite3_vfs object. + +// Initialize the contents of the unixFile structure pointed to by pId. +func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename uintptr, ctrlFlags int32) int32 { /* sqlite3.c:39680:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pLockingStyle uintptr + var pNew uintptr = pId + var rc int32 = SQLITE_OK + + // No locking occurs in temporary files + + (*UnixFile)(unsafe.Pointer(pNew)).Fh = h + (*UnixFile)(unsafe.Pointer(pNew)).FpVfs = pVfs + (*UnixFile)(unsafe.Pointer(pNew)).FzPath = zFilename + (*UnixFile)(unsafe.Pointer(pNew)).FctrlFlags = uint16(U8(ctrlFlags)) + (*UnixFile)(unsafe.Pointer(pNew)).FmmapSizeMax = Xsqlite3Config.FszMmap + if Xsqlite3_uri_boolean(tls, func() uintptr { + if (ctrlFlags & UNIXFILE_URI) != 0 { + return zFilename + } + return uintptr(0) + }(), + ts+2825 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) + } + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2830 /* "unix-excl" */) == 0 { + *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) + } + + if (ctrlFlags & UNIXFILE_NOLOCK) != 0 { + pLockingStyle = uintptr(unsafe.Pointer(&nolockIoMethods)) + } else { + pLockingStyle = (**(**func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 32 /* &.pAppData */))))(tls, zFilename, pNew) + } + + if pLockingStyle == uintptr(unsafe.Pointer(&posixIoMethods)) { + unixEnterMutex(tls) + rc = findInodeInfo(tls, pNew, (pNew + 16 /* &.pInode */)) + if rc != SQLITE_OK { + // If an error occurred in findInodeInfo(), close the file descriptor + // immediately, before releasing the mutex. findInodeInfo() may fail + // in two scenarios: + // + // (a) A call to fstat() failed. + // (b) A malloc failed. + // + // Scenario (b) may only occur if the process is holding no other + // file descriptors open on the same file. If there were other file + // descriptors on this file, then no malloc would be required by + // findInodeInfo(). If this is the case, it is quite safe to close + // handle h - as it is guaranteed that no posix locks will be released + // by doing so. + // + // If scenario (a) caused the error then things are not so safe. The + // implicit assumption here is that if fstat() fails, things are in + // such bad shape that dropping a lock or two doesn't matter much. + robust_close(tls, pNew, h, 39758) + h = -1 + } + unixLeaveMutex(tls) + } else if pLockingStyle == uintptr(unsafe.Pointer(&dotlockIoMethods)) { + // Dotfile locking uses the file path so it needs to be included in + // the dotlockLockingContext + var zLockFile uintptr + var nFilename int32 + + nFilename = (int32(libc.Xstrlen(tls, zFilename)) + 6) + zLockFile = Xsqlite3_malloc64(tls, uint64(nFilename)) + if zLockFile == uintptr(0) { + rc = SQLITE_NOMEM + } else { + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2840 /* "%s.lock" */, libc.VaList(bp, zFilename)) + } + (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile + } + + storeLastErrno(tls, pNew, 0) + if rc != SQLITE_OK { + if h >= 0 { + robust_close(tls, pNew, h, 39843) + } + } else { + (*Sqlite3_file)(unsafe.Pointer(pId)).FpMethods = pLockingStyle + + verifyDbFile(tls, pNew) + } + return rc +} + +// Return the name of a directory in which to put temporary files. +// If no suitable temporary file directory can be found, return NULL. +func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + var i uint32 = uint32(0) + // var buf stat at bp, 224 + + var zDir uintptr = Xsqlite3_temp_directory + + if !(int32(azDirs[0]) != 0) { + azDirs[0] = libc.Xgetenv(tls, ts+2848 /* "SQLITE_TMPDIR" */) + } + if !(int32(azDirs[1]) != 0) { + azDirs[1] = libc.Xgetenv(tls, ts+2862 /* "TMPDIR" */) + } + for 1 != 0 { + if (((zDir != uintptr(0)) && + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*24 + 8 /* &.pCurrent */))))(tls, zDir, bp /* &buf */) == 0)) && + (((int32((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode)) & 0170000) == 0040000)) && + ((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*24 + 8 /* &.pCurrent */))))(tls, zDir, 03) == 0) { + return zDir + } + if uint64(i) >= (uint64(unsafe.Sizeof(azDirs)) / uint64(unsafe.Sizeof(uintptr(0)))) { + break + } + zDir = azDirs[libc.PostIncUint32(&i, 1)] + } + return uintptr(0) +} + +var azDirs = [6]uintptr{ + uintptr(0), + uintptr(0), + ts + 2869, /* "/var/tmp" */ + ts + 2878, /* "/usr/tmp" */ + ts + 2887, /* "/tmp" */ + ts + 769, /* "." */ +} /* sqlite3.c:39857:21 */ + +// Create a temporary file name in zBuf. zBuf must be allocated +// by the calling process and must be big enough to hold at least +// pVfs->mxPathname bytes. +func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3.c:39890:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var zDir uintptr + var iLimit int32 = 0 + + // It's odd to simulate an io-error here, but really this is just + // using the io-error infrastructure to test that SQLite handles this + // function failing. + *(*int8)(unsafe.Pointer(zBuf)) = int8(0) + + zDir = unixTempFileDir(tls) + if zDir == uintptr(0) { + return (SQLITE_IOERR | (int32(25) << 8)) + } + for ok := true; ok; ok = ((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*24 + 8 /* &.pCurrent */))))(tls, zBuf, 0) == 0) { + // var r U64 at bp+24, 8 + + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) + + *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2892, /* "%s/etilqs_%llx%c" */ + libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) + if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { + return SQLITE_ERROR + } + } + return SQLITE_OK +} + +// Search for an unused file descriptor that was opened on the database +// file (not a journal or super-journal file) identified by pathname +// zPath with SQLITE_OPEN_XXX flags matching those passed as the second +// argument to this function. +// +// Such a file descriptor may exist if a database connection was closed +// but the associated file descriptor could not be closed because some +// other file descriptor open on the same file is holding a file-lock. +// Refer to comments in the unixClose() function and the lengthy comment +// describing "Posix Advisory Locking" at the start of this file for +// further details. Also, ticket #4018. +// +// If a suitable file descriptor is found, then it is returned. If no +// such file descriptor is located, -1 is returned. +func findReusableFd(tls *libc.TLS, zPath uintptr, flags int32) uintptr { /* sqlite3.c:39940:21: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + var pUnused uintptr = uintptr(0) + + // Do not search for an unused file descriptor on vxworks. Not because + // vxworks would not benefit from the change (it might, we're not sure), + // but because no way to test it is currently available. It is better + // not to risk breaking vxworks support for the sake of such an obscure + // feature. + // var sStat stat at bp, 224 + // Results of stat() call + + unixEnterMutex(tls) + + // A stat() call may fail for various reasons. If this happens, it is + // almost certain that an open() call on the same path will also fail. + // For this reason, if an error occurs in the stat() call here, it is + // ignored and -1 is returned. The caller will try to open a new file + // descriptor on the same path, fail, and return an error to SQLite. + // + // Even if a subsequent open() call does succeed, the consequences of + // not searching for a reusable file descriptor are not dire. + if (inodeList != uintptr(0)) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &sStat */)) { + var pInode uintptr + + pInode = inodeList + for (pInode != 0) && (((*UnixInodeInfo)(unsafe.Pointer(pInode)).FfileId.Fdev != (*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_dev) || + ((*UnixInodeInfo)(unsafe.Pointer(pInode)).FfileId.Fino != U64((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_ino))) { + pInode = (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpNext + } + if pInode != 0 { + var pp uintptr + + Xsqlite3_mutex_enter(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + flags = flags & (SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE) + for pp = (pInode + 40 /* &.pUnused */); (*(*uintptr)(unsafe.Pointer(pp)) != 0) && ((*UnixUnusedFd)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fflags != flags); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 8 /* &.pNext */) { + } + pUnused = *(*uintptr)(unsafe.Pointer(pp)) + if pUnused != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*UnixUnusedFd)(unsafe.Pointer(pUnused)).FpNext + } + Xsqlite3_mutex_leave(tls, (*UnixInodeInfo)(unsafe.Pointer(pInode)).FpLockMutex) + } + } + unixLeaveMutex(tls) + return pUnused +} + +// Find the mode, uid and gid of file zFile. +func getFileMode(tls *libc.TLS, zFile uintptr, pMode uintptr, pUid uintptr, pGid uintptr) int32 { /* sqlite3.c:39990:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + // var sStat stat at bp, 224 + // Output of stat() on database file + var rc int32 = SQLITE_OK + if 0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*24 + 8 /* &.pCurrent */))))(tls, zFile, bp /* &sStat */) { + *(*Mode_t)(unsafe.Pointer(pMode)) = (Mode_t(int32((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_mode) & 0777)) + *(*Uid_t)(unsafe.Pointer(pUid)) = (*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_uid + *(*Gid_t)(unsafe.Pointer(pGid)) = (*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_gid + } else { + rc = (SQLITE_IOERR | (int32(7) << 8)) + } + return rc +} + +// This function is called by unixOpen() to determine the unix permissions +// to create new files with. If no error occurs, then SQLITE_OK is returned +// and a value suitable for passing as the third argument to open(2) is +// written to *pMode. If an IO error occurs, an SQLite error code is +// returned and the value of *pMode is not modified. +// +// In most cases, this routine sets *pMode to 0, which will become +// an indication to robust_open() to create the file using +// SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask. +// But if the file being opened is a WAL or regular journal file, then +// this function queries the file-system for the permissions on the +// corresponding database file and sets *pMode to this value. Whenever +// possible, WAL and journal files are created using the same permissions +// as the associated database file. +// +// If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the +// original filename is unavailable. But 8_3_NAMES is only used for +// FAT filesystems and permissions do not matter there, so just use +// the default permissions. In 8_3_NAMES mode, leave *pMode set to zero. +func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr, pUid uintptr, pGid uintptr) int32 { /* sqlite3.c:40029:12: */ + bp := tls.Alloc(513) + defer tls.Free(513) + + var rc int32 = SQLITE_OK // Return Code + *(*Mode_t)(unsafe.Pointer(pMode)) = Mode_t(0) + *(*Uid_t)(unsafe.Pointer(pUid)) = Uid_t(0) + *(*Gid_t)(unsafe.Pointer(pGid)) = Gid_t(0) + if (flags & (SQLITE_OPEN_WAL | SQLITE_OPEN_MAIN_JOURNAL)) != 0 { + // var zDb [513]int8 at bp, 513 + // Database file path + var nDb int32 // Number of valid bytes in zDb + + // zPath is a path to a WAL or journal file. The following block derives + // the path to the associated database file from zPath. This block handles + // the following naming conventions: + // + // "-journal" + // "-wal" + // "-journalNN" + // "-walNN" + // + // where NN is a decimal number. The NN naming schemes are + // used by the test_multiplex.c module. + nDb = (Xsqlite3Strlen30(tls, zPath) - 1) + for int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nDb)))) != '-' { + // In normal operation, the journal file name will always contain + // a '-' character. However in 8+3 filename mode, or if a corrupt + // rollback journal specifies a super-journal with a goofy name, then + // the '-' might be missing. + if (nDb == 0) || (int32(*(*int8)(unsafe.Pointer(zPath + uintptr(nDb)))) == '.') { + return SQLITE_OK + } + nDb-- + } + libc.Xmemcpy(tls, bp /* &zDb[0] */, zPath, uint64(nDb)) + *(*int8)(unsafe.Pointer(bp /* &zDb[0] */ + uintptr(nDb))) = int8(0) + + rc = getFileMode(tls, bp /* &zDb[0] */, pMode, pUid, pGid) + } else if (flags & SQLITE_OPEN_DELETEONCLOSE) != 0 { + *(*Mode_t)(unsafe.Pointer(pMode)) = Mode_t(0600) + } else if (flags & SQLITE_OPEN_URI) != 0 { + // If this is a main database file and the file was opened using a URI + // filename, check for the "modeof" parameter. If present, interpret + // its value as a filename and try to copy the mode, uid and gid from + // that file. + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2909 /* "modeof" */) + if z != 0 { + rc = getFileMode(tls, z, pMode, pUid, pGid) + } + } + return rc +} + +// Open the file zPath. +// +// Previously, the SQLite OS layer used three functions in place of this +// one: +// +// sqlite3OsOpenReadWrite(); +// sqlite3OsOpenReadOnly(); +// sqlite3OsOpenExclusive(); +// +// These calls correspond to the following combinations of flags: +// +// ReadWrite() -> (READWRITE | CREATE) +// ReadOnly() -> (READONLY) +// OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE) +// +// The old OpenExclusive() accepted a boolean argument - "delFlag". If +// true, the file was configured to be automatically deleted when the +// file handle closed. To achieve the same effect using this new +// interface, add the DELETEONCLOSE flag to those specified above for +// OpenExclusive(). +func unixOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* sqlite3.c:40106:12: */ + bp := tls.Alloc(524) + defer tls.Free(524) + + var p uintptr + var fd int32 // File descriptor returned by open() + var openFlags int32 // Flags to pass to open() + var eType int32 // Type of file to open + var noLock int32 // True to omit locking primitives + var rc int32 // Function Return Code + var ctrlFlags int32 // UNIXFILE_* flags + + var isExclusive int32 + var isDelete int32 + var isCreate int32 + var isReadonly int32 + var isReadWrite int32 + + // If creating a super- or main-file journal, this function will open + // a file-descriptor on the directory too. The first time unixSync() + // is called the directory file descriptor will be fsync()ed and close()d. + var isNewJrnl int32 + + // If argument zPath is a NULL pointer, this function is required to open + // a temporary file. Use this buffer to store the file name in. + // var zTmpname [514]int8 at bp, 514 + + var zName uintptr + var pUnused uintptr + var rc2 int32 + // var openMode Mode_t at bp+514, 2 + // Permissions to create file with + // var uid Uid_t at bp+516, 4 + // Userid for the file + // var gid Gid_t at bp+520, 4 + p = pFile + fd = -1 + openFlags = 0 + eType = (flags & 0x0FFF00) + rc = SQLITE_OK + ctrlFlags = 0 + isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE) + isDelete = (flags & SQLITE_OPEN_DELETEONCLOSE) + isCreate = (flags & SQLITE_OPEN_CREATE) + isReadonly = (flags & SQLITE_OPEN_READONLY) + isReadWrite = (flags & SQLITE_OPEN_READWRITE) + isNewJrnl = (libc.Bool32((isCreate != 0) && (((eType == SQLITE_OPEN_SUPER_JOURNAL) || + (eType == SQLITE_OPEN_MAIN_JOURNAL)) || + (eType == SQLITE_OPEN_WAL)))) + zName = zPath + + // Check the following statements are true: + // + // (a) Exactly one of the READWRITE and READONLY flags must be set, and + // (b) if CREATE is set, then READWRITE must also be set, and + // (c) if EXCLUSIVE is set, then CREATE must also be set. + // (d) if DELETEONCLOSE is set, then CREATE must also be set. + + // The main DB, main journal, WAL file and super-journal are never + // automatically deleted. Nor are they ever temporary files. + + // Assert that the upper layer has set one of the "file-type" flags. + + // Detect a pid change and reset the PRNG. There is a race condition + // here such that two or more threads all trying to open databases at + // the same instant might all reset the PRNG. But multiple resets + // are harmless. + if !(randomnessPid != libc.Xgetpid(tls)) { + goto __1 + } + randomnessPid = libc.Xgetpid(tls) + Xsqlite3_randomness(tls, 0, uintptr(0)) +__1: + ; + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(UnixFile{}))) + + if !(eType == SQLITE_OPEN_MAIN_DB) { + goto __2 + } + pUnused = findReusableFd(tls, zName, flags) + if !(pUnused != 0) { + goto __4 + } + fd = (*UnixUnusedFd)(unsafe.Pointer(pUnused)).Ffd + goto __5 +__4: + pUnused = Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(UnixUnusedFd{}))) + if !(!(pUnused != 0)) { + goto __6 + } + return SQLITE_NOMEM +__6: + ; +__5: + ; + (*UnixFile)(unsafe.Pointer(p)).FpPreallocatedUnused = pUnused + + // Database filenames are double-zero terminated if they are not + // URIs with parameters. Hence, they can always be passed into + // sqlite3_uri_parameter(). + + goto __3 +__2: + if !(!(zName != 0)) { + goto __7 + } + // If zName is NULL, the upper layer is requesting a temp file. + + rc = unixGetTempname(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname, bp /* &zTmpname[0] */) + if !(rc != SQLITE_OK) { + goto __8 + } + return rc +__8: + ; + zName = bp /* &zTmpname[0] */ + + // Generated temporary filenames are always double-zero terminated + // for use by sqlite3_uri_parameter(). + +__7: + ; +__3: + ; + + // Determine the value of the flags parameter passed to POSIX function + // open(). These must be calculated even if open() is not called, as + // they may be stored as part of the file handle and used by the + // 'conch file' locking functions later on. + if !(isReadonly != 0) { + goto __9 + } + openFlags = openFlags | (O_RDONLY) +__9: + ; + if !(isReadWrite != 0) { + goto __10 + } + openFlags = openFlags | (O_RDWR) +__10: + ; + if !(isCreate != 0) { + goto __11 + } + openFlags = openFlags | (O_CREAT) +__11: + ; + if !(isExclusive != 0) { + goto __12 + } + openFlags = openFlags | (O_EXCL | O_NOFOLLOW) +__12: + ; + openFlags = openFlags | ((O_LARGEFILE | O_BINARY) | O_NOFOLLOW) + + if !(fd < 0) { + goto __13 + } // Groupid for the file + rc = findCreateFileMode(tls, zName, flags, bp+514 /* &openMode */, bp+516 /* &uid */, bp+520 /* &gid */) + if !(rc != SQLITE_OK) { + goto __14 + } + + return rc +__14: + ; + fd = robust_open(tls, zName, openFlags, *(*Mode_t)(unsafe.Pointer(bp + 514 /* openMode */))) + + if !(fd < 0) { + goto __15 + } + if !(((isNewJrnl != 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EACCES)) && ((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*24 + 8 /* &.pCurrent */))))(tls, zName, F_OK) != 0)) { + goto __16 + } + // If unable to create a journal because the directory is not + // writable, change the error code to indicate that. + rc = (SQLITE_READONLY | (int32(6) << 8)) + goto __17 +__16: + if !(((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) != EISDIR) && (isReadWrite != 0)) { + goto __18 + } + // Failed to open the file for read/write access. Try read-only. + flags = flags & (libc.CplInt32((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE))) + openFlags = openFlags & (libc.CplInt32((O_RDWR | O_CREAT))) + flags = flags | (SQLITE_OPEN_READONLY) + openFlags = openFlags | (O_RDONLY) + isReadonly = 1 + fd = robust_open(tls, zName, openFlags, *(*Mode_t)(unsafe.Pointer(bp + 514 /* openMode */))) +__18: + ; +__17: + ; +__15: + ; + if !(fd < 0) { + goto __19 + } + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2389 /* "open" */, zName, 40257) + if !(rc == SQLITE_OK) { + goto __20 + } + rc = rc2 +__20: + ; + goto open_finished +__19: + ; + + // The owner of the rollback journal or WAL file should always be the + // same as the owner of the database file. Try to ensure that this is + // the case. The chown() system call will be a no-op if the current + // process lacks root privileges, be we should at least try. Without + // this step, if a root process opens a database file, it can leave + // behinds a journal/WAL that is owned by root and hence make the + // database inaccessible to unprivileged processes. + // + // If openMode==0, then that means uid and gid are not set correctly + // (probably because SQLite is configured to use 8+3 filename mode) and + // in that case we do not want to attempt the chown(). + if !((*(*Mode_t)(unsafe.Pointer(bp + 514 /* openMode */)) != 0) && ((flags & (SQLITE_OPEN_WAL | SQLITE_OPEN_MAIN_JOURNAL)) != 0)) { + goto __21 + } + robustFchown(tls, fd, *(*Uid_t)(unsafe.Pointer(bp + 516 /* uid */)), *(*Gid_t)(unsafe.Pointer(bp + 520 /* gid */))) +__21: + ; +__13: + ; + + if !(pOutFlags != 0) { + goto __22 + } + *(*int32)(unsafe.Pointer(pOutFlags)) = flags +__22: + ; + + if !((*UnixFile)(unsafe.Pointer(p)).FpPreallocatedUnused != 0) { + goto __23 + } + (*UnixUnusedFd)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(p)).FpPreallocatedUnused)).Ffd = fd + (*UnixUnusedFd)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(p)).FpPreallocatedUnused)).Fflags = (flags & (SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE)) +__23: + ; + + if !(isDelete != 0) { + goto __24 + } + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 16*24 + 8 /* &.pCurrent */))))(tls, zName) +__24: + ; + + // Set up appropriate ctrlFlags + if !(isDelete != 0) { + goto __25 + } + ctrlFlags = ctrlFlags | (UNIXFILE_DELETE) +__25: + ; + if !(isReadonly != 0) { + goto __26 + } + ctrlFlags = ctrlFlags | (UNIXFILE_RDONLY) +__26: + ; + noLock = (libc.Bool32(eType != SQLITE_OPEN_MAIN_DB)) + if !(noLock != 0) { + goto __27 + } + ctrlFlags = ctrlFlags | (UNIXFILE_NOLOCK) +__27: + ; + if !(isNewJrnl != 0) { + goto __28 + } + ctrlFlags = ctrlFlags | (UNIXFILE_DIRSYNC) +__28: + ; + if !((flags & SQLITE_OPEN_URI) != 0) { + goto __29 + } + ctrlFlags = ctrlFlags | (UNIXFILE_URI) +__29: + ; + + rc = fillInUnixFile(tls, pVfs, fd, pFile, zPath, ctrlFlags) + +open_finished: + if !(rc != SQLITE_OK) { + goto __30 + } + Xsqlite3_free(tls, (*UnixFile)(unsafe.Pointer(p)).FpPreallocatedUnused) +__30: + ; + return rc +} + +// Delete the file at zPath. If the dirSync argument is true, fsync() +// the directory after deleting the file. +func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) int32 { /* sqlite3.c:40380:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + _ = NotUsed + + if (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 16*24 + 8 /* &.pCurrent */))))(tls, zPath) == (-1) { + if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == ENOENT { + rc = (SQLITE_IOERR | (int32(23) << 8)) + } else { + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2499 /* "unlink" */, zPath, 40396) + } + return rc + } + if (dirSync & 1) != 0 { + // var fd int32 at bp, 4 + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) + if rc == SQLITE_OK { + if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2916 /* "fsync" */, zPath, 40406) + } + robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) + } else { + + rc = SQLITE_OK + } + } + return rc +} + +// Test the existence of or access permissions of file zPath. The +// test performed depends on the value of flags: +// +// SQLITE_ACCESS_EXISTS: Return 1 if the file exists +// SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable. +// SQLITE_ACCESS_READONLY: Return 1 if the file is readable. +// +// Otherwise return 0. +func unixAccess(tls *libc.TLS, NotUsed uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* sqlite3.c:40428:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + _ = NotUsed + + // The spec says there are three possible values for flags. But only + // two of them are actually used + + if flags == SQLITE_ACCESS_EXISTS { + // var buf stat at bp, 224 + + *(*int32)(unsafe.Pointer(pResOut)) = (libc.Bool32((0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &buf */)) && (!(((int32((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode)) & 0170000) == 0100000) || ((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_size > int64(0))))) + } else { + *(*int32)(unsafe.Pointer(pResOut)) = (libc.Bool32((*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*24 + 8 /* &.pCurrent */))))(tls, zPath, (W_OK|R_OK)) == 0)) + } + return SQLITE_OK +} + +// If the last component of the pathname in z[0]..z[j-1] is something +// other than ".." then back it out and return true. If the last +// component is empty or if it is ".." then return false. +func unixBackupDir(tls *libc.TLS, z uintptr, pJ uintptr) int32 { /* sqlite3.c:40457:12: */ + var j int32 = *(*int32)(unsafe.Pointer(pJ)) + var i int32 + if j <= 0 { + return 0 + } + for i = (j - 1); (i > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((i - 1))))) != '/'); i-- { + } + if i == 0 { + return 0 + } + if ((int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == '.') && (i == (j - 2))) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((i + 1))))) == '.') { + return 0 + } + *(*int32)(unsafe.Pointer(pJ)) = (i - 1) + return 1 +} + +// Convert a relative pathname into a full pathname. Also +// simplify the pathname as follows: +// +// Remove all instances of /./ +// Remove all isntances of /X/../ for any X +func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int32 { /* sqlite3.c:40475:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var nPath int32 = Xsqlite3Strlen30(tls, zPath) + var iOff int32 = 0 + var i int32 + // var j int32 at bp+8, 4 + + if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { + if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, zOut, (uint64(nOut-2))) == uintptr(0) { + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2407 /* "getcwd" */, zPath, 40485) + } + iOff = Xsqlite3Strlen30(tls, zOut) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') + } + if ((iOff + nPath) + 1) > nOut { + // SQLite assumes that xFullPathname() nul-terminates the output buffer + // even if it returns an error. + *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) + return Xsqlite3CantopenError(tls, 40494) + } + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2791 /* "%s" */, libc.VaList(bp, zPath)) + + // Remove duplicate '/' characters. Except, two // at the beginning + // of a pathname is allowed since this is important on windows. + for i = libc.AssignPtrInt32(bp+8 /* j */, 1); *(*int8)(unsafe.Pointer(zOut + uintptr(i))) != 0; i++ { + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* j */)), 1)))) = *(*int8)(unsafe.Pointer(zOut + uintptr(i))) + for (int32(*(*int8)(unsafe.Pointer(zOut + uintptr(i)))) == '/') && (int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 1))))) == '/') { + i++ + } + } + *(*int8)(unsafe.Pointer(zOut + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* j */))))) = int8(0) + + for i = libc.AssignPtrInt32(bp+8 /* j */, 0); *(*int8)(unsafe.Pointer(zOut + uintptr(i))) != 0; i++ { + if int32(*(*int8)(unsafe.Pointer(zOut + uintptr(i)))) == '/' { + // Skip over internal "/." directory components + if (int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 1))))) == '.') && (int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 2))))) == '/') { + i = i + (1) + continue + } + + // If this is a "/.." directory component then back out the + // previous term of the directory if it is something other than "..". + if (((int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 1))))) == '.') && + (int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 2))))) == '.')) && + (int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 3))))) == '/')) && + (unixBackupDir(tls, zOut, bp+8 /* &j */) != 0) { + i = i + (2) + continue + } + } + if *(*int32)(unsafe.Pointer(bp + 8 /* j */)) >= 0 { + *(*int8)(unsafe.Pointer(zOut + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* j */))))) = *(*int8)(unsafe.Pointer(zOut + uintptr(i))) + } + *(*int32)(unsafe.Pointer(bp + 8 /* j */))++ + } + if *(*int32)(unsafe.Pointer(bp + 8 /* j */)) == 0 { + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* j */)), 1)))) = int8('/') + } + *(*int8)(unsafe.Pointer(zOut + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* j */))))) = int8(0) + return SQLITE_OK +} + +// Turn a relative pathname into a full pathname. The relative path +// is stored as a nul-terminated string in the buffer pointed to by +// zPath. +// +// zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes +// (in this case, MAX_PATHNAME bytes). The full-path is written to +// this buffer before returning. +func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* sqlite3.c:40544:12: */ + bp := tls.Alloc(224) + defer tls.Free(224) + + var rc int32 = SQLITE_OK + var nByte int32 + var nLink int32 = 0 // Number of symbolic links followed so far + var zIn uintptr = zPath // Input path for each iteration of loop + var zDel uintptr = uintptr(0) + + _ = pVfs + + // It's odd to simulate an io-error here, but really this is just + // using the io-error infrastructure to test that SQLite handles this + // function failing. This function could fail if, for example, the + // current working directory has been unlinked. + + for ok := true; ok; ok = (rc == SQLITE_OK) { + + // Call stat() on path zIn. Set bLink to true if the path is a symbolic + // link, or false otherwise. + var bLink int32 = 0 + // var buf stat at bp, 224 + + if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*24 + 8 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { + if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) != ENOENT { + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2587 /* "lstat" */, zIn, 40577) + } + } else { + bLink = (libc.Bool32(((int32((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode)) & 0170000) == 0120000)) + } + + if bLink != 0 { + nLink++ + if zDel == uintptr(0) { + zDel = Xsqlite3_malloc(tls, nOut) + if zDel == uintptr(0) { + rc = SQLITE_NOMEM + } + } else if nLink >= SQLITE_MAX_SYMLINKS { + rc = Xsqlite3CantopenError(tls, 40589) + } + + if rc == SQLITE_OK { + nByte = int32((*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls, zIn, zDel, (uint64(nOut - 1)))) + if nByte < 0 { + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2578 /* "readlink" */, zIn, 40595) + } else { + if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { + var n int32 + for n = Xsqlite3Strlen30(tls, zIn); (n > 0) && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr((n - 1))))) != '/'); n-- { + } + if ((nByte + n) + 1) > nOut { + rc = Xsqlite3CantopenError(tls, 40601) + } else { + libc.Xmemmove(tls, (zDel + uintptr(n)), zDel, (uint64(nByte + 1))) + libc.Xmemcpy(tls, zDel, zIn, uint64(n)) + nByte = nByte + (n) + } + } + *(*int8)(unsafe.Pointer(zDel + uintptr(nByte))) = int8(0) + } + } + + zIn = zDel + } + + if (rc == SQLITE_OK) && (zIn != zOut) { + rc = mkFullPathname(tls, zIn, zOut, nOut) + } + if bLink == 0 { + break + } + zIn = zOut + } + + Xsqlite3_free(tls, zDel) + if (rc == SQLITE_OK) && (nLink != 0) { + rc = (SQLITE_OK | (int32(2) << 8)) + } + return rc +} + +func unixDlOpen(tls *libc.TLS, NotUsed uintptr, zFilename uintptr) uintptr { /* sqlite3.c:40636:13: */ + _ = NotUsed + return libc.Xdlopen(tls, zFilename, (RTLD_NOW | RTLD_GLOBAL)) +} + +// SQLite calls this function immediately after a call to unixDlSym() or +// unixDlOpen() fails (returns a null pointer). If a more detailed error +// message is available, it is written to zBufOut. If no error message +// is available, zBufOut is left unmodified and SQLite uses a default +// error message. +func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { /* sqlite3.c:40648:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var zErr uintptr + _ = NotUsed + unixEnterMutex(tls) + zErr = libc.Xdlerror(tls) + if zErr != 0 { + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2791 /* "%s" */, libc.VaList(bp, zErr)) + } + unixLeaveMutex(tls) +} + +func unixDlSym(tls *libc.TLS, NotUsed uintptr, p uintptr, zSym uintptr) uintptr { /* sqlite3.c:40658:13: */ + // GCC with -pedantic-errors says that C90 does not allow a void* to be + // cast into a pointer to a function. And yet the library dlsym() routine + // returns a void* which is really a pointer to a function. So how do we + // use dlsym() with -pedantic-errors? + // + // Variable x below is defined to be a pointer to a function taking + // parameters void* and const char* and returning a pointer to a function. + // We initialize x by assigning it a pointer to the dlsym() function. + // (That assignment requires a cast.) Then we call the function that + // x points to. + // + // This work-around is unlikely to work correctly on any system where + // you really cannot cast a function pointer into void*. But then, on the + // other hand, dlsym() will not work on such a system either, so we have + // not really lost anything. + var x uintptr + _ = NotUsed + x = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) uintptr + }{libc.Xdlsym})) + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&x)))(tls, p, zSym) +} + +func unixDlClose(tls *libc.TLS, NotUsed uintptr, pHandle uintptr) { /* sqlite3.c:40681:13: */ + _ = NotUsed + libc.Xdlclose(tls, pHandle) +} + +// Write nBuf bytes of random data to the supplied buffer zBuf. +func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) int32 { /* sqlite3.c:40695:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + _ = NotUsed + + // We have to initialize zBuf to prevent valgrind from reporting + // errors. The reports issued by valgrind are incorrect - we would + // prefer that the randomness be increased by making use of the + // uninitialized space in zBuf - but valgrind errors tend to worry + // some users. Rather than argue, it seems easier just to initialize + // the whole array and silence valgrind, even if that means less randomness + // in the random seed. + // + // When testing, initializing zBuf[] to zero is all we do. That means + // that we always use the same random number sequence. This makes the + // tests repeatable. + libc.Xmemset(tls, zBuf, 0, uint64(nBuf)) + randomnessPid = libc.Xgetpid(tls) + { + var fd int32 + var got int32 + fd = robust_open(tls, ts+2922 /* "/dev/urandom" */, O_RDONLY, uint16(0)) + if fd < 0 { + // var t Time_t at bp, 8 + + libc.Xtime(tls, bp /* &t */) + libc.Xmemcpy(tls, zBuf, bp /* &t */, uint64(unsafe.Sizeof(Time_t(0)))) + libc.Xmemcpy(tls, (zBuf + 8), uintptr(unsafe.Pointer(&randomnessPid)), uint64(unsafe.Sizeof(randomnessPid))) + + nBuf = (int32(uint64(unsafe.Sizeof(Time_t(0))) + uint64(unsafe.Sizeof(randomnessPid)))) + } else { + for ok := true; ok; ok = ((got < 0) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == EINTR)) { + got = int32((*(*func(*libc.TLS, int32, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8*24 + 8 /* &.pCurrent */))))(tls, fd, zBuf, uint64(nBuf))) + } + robust_close(tls, uintptr(0), fd, 40726) + } + + } + return nBuf +} + +// Sleep for a little while. Return the amount of time slept. +// The argument is the number of microseconds we want to sleep. +// The return value is the number of microseconds of sleep actually +// requested from the underlying operating system, a number which +// might be greater than or equal to the argument, but not less +// than the argument. +func unixSleep(tls *libc.TLS, NotUsed uintptr, microseconds int32) int32 { /* sqlite3.c:40742:12: */ + if microseconds >= 1000000 { + libc.Xsleep(tls, (uint32(microseconds / 1000000))) + } + if (microseconds % 1000000) != 0 { + libc.Xusleep(tls, (uint32(microseconds % 1000000))) + } + _ = NotUsed + return microseconds +} + +// The following variable, if set to a non-zero value, is interpreted as +// the number of seconds since 1970 and is used to set the result of +// sqlite3OsCurrentTime() during testing. + +// Find the current time (in Universal Coordinated Time). Write into *piNow +// the current time and date as a Julian Day number times 86_400_000. In +// other words, write into *piNow the number of milliseconds since the Julian +// epoch of noon in Greenwich on November 24, 4714 B.C according to the +// proleptic Gregorian calendar. +// +// On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date +// cannot be found. +func unixCurrentTimeInt64(tls *libc.TLS, NotUsed uintptr, piNow uintptr) int32 { /* sqlite3.c:40783:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 = SQLITE_OK + // var sNow timeval at bp, 16 + + libc.Xgettimeofday(tls, bp /* &sNow */, uintptr(0)) // Cannot fail given valid arguments + *(*Sqlite3_int64)(unsafe.Pointer(piNow)) = ((unixEpoch + (int64(1000) * Sqlite3_int64((*timeval)(unsafe.Pointer(bp /* &sNow */)).Ftv_sec))) + (Sqlite3_int64((*timeval)(unsafe.Pointer(bp /* &sNow */)).Ftv_usec / int64(1000)))) + + _ = NotUsed + return rc +} + +var unixEpoch Sqlite3_int64 = (int64(24405875) * int64(8640000)) /* sqlite3.c:40784:30 */ + +// Find the current time (in Universal Coordinated Time). Write the +// current time and date as a Julian Day number into *prNow and +// return 0. Return 1 if the time and date cannot be found. +func unixCurrentTime(tls *libc.TLS, NotUsed uintptr, prNow uintptr) int32 { /* sqlite3.c:40815:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = int64(0) + var rc int32 + _ = NotUsed + rc = unixCurrentTimeInt64(tls, uintptr(0), bp /* &i */) + *(*float64)(unsafe.Pointer(prNow)) = (float64(*(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) / 86400000.0) + return rc +} + +// The xGetLastError() method is designed to return a better +// low-level error message when operating-system problems come up +// during SQLite operation. Only the integer return code is currently +// used. +func unixGetLastError(tls *libc.TLS, NotUsed uintptr, NotUsed2 int32, NotUsed3 uintptr) int32 { /* sqlite3.c:40833:12: */ + _ = NotUsed + _ = NotUsed2 + _ = NotUsed3 + return *(*int32)(unsafe.Pointer(libc.X__error(tls))) +} + +// +// End of sqlite3_vfs methods *************************** +// + +// ***************************************************************************** +// +// Begin Proxy Locking ******************************** +// +// Proxy locking is a "uber-locking-method" in this sense: It uses the +// other locking methods on secondary lock files. Proxy locking is a +// meta-layer over top of the primitive locking implemented above. For +// this reason, the division that implements of proxy locking is deferred +// until late in the file (here) after all of the other I/O methods have +// been defined - so that the primitive locking methods are available +// as services to help with the implementation of proxy locking. +// +// +// +// The default locking schemes in SQLite use byte-range locks on the +// database file to coordinate safe, concurrent access by multiple readers +// and writers [http://sqlite.org/lockingv3.html]. The five file locking +// states (UNLOCKED, PENDING, SHARED, RESERVED, EXCLUSIVE) are implemented +// as POSIX read & write locks over fixed set of locations (via fsctl), +// on AFP and SMB only exclusive byte-range locks are available via fsctl +// with _IOWR('z', 23, struct ByteRangeLockPB2) to track the same 5 states. +// To simulate a F_RDLCK on the shared range, on AFP a randomly selected +// address in the shared range is taken for a SHARED lock, the entire +// shared range is taken for an EXCLUSIVE lock): +// +// PENDING_BYTE 0x40000000 +// RESERVED_BYTE 0x40000001 +// SHARED_RANGE 0x40000002 -> 0x40000200 +// +// This works well on the local file system, but shows a nearly 100x +// slowdown in read performance on AFP because the AFP client disables +// the read cache when byte-range locks are present. Enabling the read +// cache exposes a cache coherency problem that is present on all OS X +// supported network file systems. NFS and AFP both observe the +// close-to-open semantics for ensuring cache coherency +// [http://nfs.sourceforge.net/#faq_a8], which does not effectively +// address the requirements for concurrent database access by multiple +// readers and writers +// [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html]. +// +// To address the performance and cache coherency issues, proxy file locking +// changes the way database access is controlled by limiting access to a +// single host at a time and moving file locks off of the database file +// and onto a proxy file on the local file system. +// +// +// Using proxy locks +// ----------------- +// +// C APIs +// +// sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE, +// | ":auto:"); +// sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE, +// &); +// +// +// SQL pragmas +// +// PRAGMA [database.]lock_proxy_file= | :auto: +// PRAGMA [database.]lock_proxy_file +// +// Specifying ":auto:" means that if there is a conch file with a matching +// host ID in it, the proxy path in the conch file will be used, otherwise +// a proxy path based on the user's temp dir +// (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the +// actual proxy file name is generated from the name and path of the +// database file. For example: +// +// For database path "/Users/me/foo.db" +// The lock path will be "/sqliteplocks/_Users_me_foo.db:auto:") +// +// Once a lock proxy is configured for a database connection, it can not +// be removed, however it may be switched to a different proxy path via +// the above APIs (assuming the conch file is not being held by another +// connection or process). +// +// +// How proxy locking works +// ----------------------- +// +// Proxy file locking relies primarily on two new supporting files: +// +// * conch file to limit access to the database file to a single host +// at a time +// +// * proxy file to act as a proxy for the advisory locks normally +// taken on the database +// +// The conch file - to use a proxy file, sqlite must first "hold the conch" +// by taking an sqlite-style shared lock on the conch file, reading the +// contents and comparing the host's unique host ID (see below) and lock +// proxy path against the values stored in the conch. The conch file is +// stored in the same directory as the database file and the file name +// is patterned after the database file name as ".-conch". +// If the conch file does not exist, or its contents do not match the +// host ID and/or proxy path, then the lock is escalated to an exclusive +// lock and the conch file contents is updated with the host ID and proxy +// path and the lock is downgraded to a shared lock again. If the conch +// is held by another process (with a shared lock), the exclusive lock +// will fail and SQLITE_BUSY is returned. +// +// The proxy file - a single-byte file used for all advisory file locks +// normally taken on the database file. This allows for safe sharing +// of the database file for multiple readers and writers on the same +// host (the conch ensures that they all use the same local lock file). +// +// Requesting the lock proxy does not immediately take the conch, it is +// only taken when the first request to lock database file is made. +// This matches the semantics of the traditional locking behavior, where +// opening a connection to a database file does not take a lock on it. +// The shared lock and an open file descriptor are maintained until +// the connection to the database is closed. +// +// The proxy file and the lock file are never deleted so they only need +// to be created the first time they are used. +// +// Configuration options +// --------------------- +// +// SQLITE_PREFER_PROXY_LOCKING +// +// Database files accessed on non-local file systems are +// automatically configured for proxy locking, lock files are +// named automatically using the same logic as +// PRAGMA lock_proxy_file=":auto:" +// +// SQLITE_PROXY_DEBUG +// +// Enables the logging of error messages during host id file +// retrieval and creation +// +// LOCKPROXYDIR +// +// Overrides the default directory used for lock proxy files that +// are named automatically via the ":auto:" setting +// +// SQLITE_DEFAULT_PROXYDIR_PERMISSIONS +// +// Permissions to use when creating a directory for storing the +// lock proxy files, only used when LOCKPROXYDIR is not set. +// +// +// As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING, +// setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will +// force proxy locking to be used for every database file opened, and 0 +// will force automatic proxy locking to be disabled for all database +// files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or +// sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING). + +// Proxy locking is only available on MacOSX +// +// The proxy locking style is intended for use with AFP filesystems. +// And since AFP is only supported on MacOSX, the proxy locking is also +// restricted to MacOSX. +// +// +// End of the proxy lock implementation ********************** +// + +// Initialize the operating system interface. +// +// This routine registers all VFS implementations for unix-like operating +// systems. This routine, and the sqlite3_os_end() routine that follows, +// should be the only routines in this file that are visible from other +// files. +// +// This routine is called once during SQLite initialization and by a +// single thread. The memory allocation and mutex subsystems have not +// necessarily been initialized when this routine is called, and so they +// should not be used. +func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ + var i uint32 // Loop counter + + // Double-check that the aSyscall[] array has been constructed + // correctly. See ticket [bb3a86e890c8e96ab] + + // Register all VFSes defined in the aVfs[] array + for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof(aVfs)) / uint64(unsafe.Sizeof(Sqlite3_vfs{}))); i++ { + Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&aVfs)) + uintptr(i)*168), (libc.Bool32(i == uint32(0)))) + } + unixBigLock = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_VFS1) + + // Validate lock assumptions + // Number of available locks + // Start of locking area + // Locks: + // WRITE UNIX_SHM_BASE 120 + // CKPT UNIX_SHM_BASE+1 121 + // RECOVER UNIX_SHM_BASE+2 122 + // READ-0 UNIX_SHM_BASE+3 123 + // READ-1 UNIX_SHM_BASE+4 124 + // READ-2 UNIX_SHM_BASE+5 125 + // READ-3 UNIX_SHM_BASE+6 126 + // READ-4 UNIX_SHM_BASE+7 127 + // DMS UNIX_SHM_BASE+8 128 + // Byte offset of the deadman-switch + + return SQLITE_OK +} + +var aVfs = [4]Sqlite3_vfs{ + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2935 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2940 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2950 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2830 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, +} /* sqlite3.c:42091:22 */ + +// Shutdown the operating system interface. +// +// Some operating systems might need to do some cleanup in this routine, +// to release dynamically allocated objects. But not on unix. +// This routine is a no-op for unix. +func Xsqlite3_os_end(tls *libc.TLS) int32 { /* sqlite3.c:42157:16: */ + unixBigLock = uintptr(0) + return SQLITE_OK +} + +//************* End of os_unix.c ******************************************** +//************* Begin file os_win.c ***************************************** +// 2004 May 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code that is specific to Windows. +// #include "sqliteInt.h" + +//************* End of os_win.c ********************************************* +//************* Begin file memdb.c ****************************************** +// 2016-09-07 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements an in-memory VFS. A database is held as a contiguous +// block of memory. +// +// This file also implements interface sqlite3_serialize() and +// sqlite3_deserialize(). +// #include "sqliteInt.h" + +// Forward declaration of objects used by this utility +type MemVfs = sqlite3_vfs /* sqlite3.c:48545:28 */ +type MemFile1 = struct { + Fbase Sqlite3_file + FpStore uintptr + FeLock int32 + _ [4]byte +} /* sqlite3.c:48546:9 */ + +type MemFile = MemFile1 /* sqlite3.c:48546:24 */ +type MemStore1 = struct { + Fsz Sqlite3_int64 + FszAlloc Sqlite3_int64 + FszMax Sqlite3_int64 + FaData uintptr + FpMutex uintptr + FnMmap int32 + FmFlags uint32 + FnRdLock int32 + FnWrLock int32 + FnRef int32 + _ [4]byte + FzFName uintptr +} /* sqlite3.c:48546:9 */ + +type MemStore = MemStore1 /* sqlite3.c:48547:25 */ + +// File-scope variables for holding the memdb files that are accessible +// to multiple database connections in separate threads. +// +// Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object. +type MemFS = struct { + FnMemStore int32 + _ [4]byte + FapMemStore uintptr +} /* sqlite3.c:48617:8 */ + +// File-scope variables for holding the memdb files that are accessible +// to multiple database connections in separate threads. +// +// Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object. +var memdb_g MemFS /* sqlite3.c:48620:3: */ + +var memdb_vfs = Sqlite3_vfs{ + FiVersion: 2, // szOsFile (set when registered) + FmxPathname: 1024, // pNext + FzName: ts + 2963, /* "memdb" */ // pAppData (set when registered) + FxOpen: 0, /* memdbDelete, */ // xDelete + FxAccess: 0, // xAccess + FxFullPathname: 0, // xFullPathname + FxDlOpen: 0, // xDlOpen + FxDlError: 0, // xDlError + FxDlSym: 0, // xDlSym + FxDlClose: 0, // xDlClose + FxRandomness: 0, // xRandomness + FxSleep: 0, /* memdbCurrentTime, */ // xCurrentTime + FxGetLastError: 0, // xGetLastError + FxCurrentTimeInt64: 0, // xNextSystemCall +} /* sqlite3.c:48656:20 */ + +var memdb_io_methods = Sqlite3_io_methods{ + FiVersion: 3, // iVersion + FxClose: 0, // xClose + FxRead: 0, // xRead + FxWrite: 0, // xWrite + FxTruncate: 0, // xTruncate + FxSync: 0, // xSync + FxFileSize: 0, // xFileSize + FxLock: 0, // xLock + FxUnlock: 0, /* memdbCheckReservedLock, */ // xCheckReservedLock + FxFileControl: 0, /* memdbSectorSize,*/ // xSectorSize + FxDeviceCharacteristics: 0, // xShmUnmap + FxFetch: 0, // xFetch + FxUnfetch: 0, // xUnfetch +} /* sqlite3.c:48681:33 */ + +// Enter/leave the mutex on a MemStore +func memdbEnter(tls *libc.TLS, p uintptr) { /* sqlite3.c:48714:13: */ + Xsqlite3_mutex_enter(tls, (*MemStore)(unsafe.Pointer(p)).FpMutex) +} + +func memdbLeave(tls *libc.TLS, p uintptr) { /* sqlite3.c:48717:13: */ + Xsqlite3_mutex_leave(tls, (*MemStore)(unsafe.Pointer(p)).FpMutex) +} + +// Close an memdb-file. +// Free the underlying MemStore object when its refcount drops to zero +// or less. +func memdbClose(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:48729:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + if (*MemStore)(unsafe.Pointer(p)).FzFName != 0 { + var i int32 + var pVfsMutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_VFS1) + Xsqlite3_mutex_enter(tls, pVfsMutex) + for i = 0; i < memdb_g.FnMemStore; i++ { + if *(*uintptr)(unsafe.Pointer(memdb_g.FapMemStore + uintptr(i)*8)) == p { + memdbEnter(tls, p) + if (*MemStore)(unsafe.Pointer(p)).FnRef == 1 { + *(*uintptr)(unsafe.Pointer(memdb_g.FapMemStore + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(memdb_g.FapMemStore + uintptr(libc.PreDecInt32(&memdb_g.FnMemStore, 1))*8)) + if memdb_g.FnMemStore == 0 { + Xsqlite3_free(tls, memdb_g.FapMemStore) + memdb_g.FapMemStore = uintptr(0) + } + } + break + } + } + Xsqlite3_mutex_leave(tls, pVfsMutex) + } else { + memdbEnter(tls, p) + } + (*MemStore)(unsafe.Pointer(p)).FnRef-- + if (*MemStore)(unsafe.Pointer(p)).FnRef <= 0 { + if ((*MemStore)(unsafe.Pointer(p)).FmFlags & uint32(SQLITE_DESERIALIZE_FREEONCLOSE)) != 0 { + Xsqlite3_free(tls, (*MemStore)(unsafe.Pointer(p)).FaData) + } + memdbLeave(tls, p) + Xsqlite3_mutex_free(tls, (*MemStore)(unsafe.Pointer(p)).FpMutex) + Xsqlite3_free(tls, p) + } else { + memdbLeave(tls, p) + } + return SQLITE_OK +} + +// Read data from an memdb-file. +func memdbRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst Sqlite_int64) int32 { /* sqlite3.c:48771:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + memdbEnter(tls, p) + if (iOfst + Sqlite_int64(iAmt)) > (*MemStore)(unsafe.Pointer(p)).Fsz { + libc.Xmemset(tls, zBuf, 0, uint64(iAmt)) + if iOfst < (*MemStore)(unsafe.Pointer(p)).Fsz { + libc.Xmemcpy(tls, zBuf, ((*MemStore)(unsafe.Pointer(p)).FaData + uintptr(iOfst)), (uint64((*MemStore)(unsafe.Pointer(p)).Fsz - iOfst))) + } + memdbLeave(tls, p) + return (SQLITE_IOERR | (int32(2) << 8)) + } + libc.Xmemcpy(tls, zBuf, ((*MemStore)(unsafe.Pointer(p)).FaData + uintptr(iOfst)), uint64(iAmt)) + memdbLeave(tls, p) + return SQLITE_OK +} + +// Try to enlarge the memory allocation to hold at least sz bytes +func memdbEnlarge(tls *libc.TLS, p uintptr, newSz Sqlite3_int64) int32 { /* sqlite3.c:48793:12: */ + var pNew uintptr + if (((*MemStore)(unsafe.Pointer(p)).FmFlags & uint32(SQLITE_DESERIALIZE_RESIZEABLE)) == uint32(0)) || ((*MemStore)(unsafe.Pointer(p)).FnMmap > 0) { + return SQLITE_FULL + } + if newSz > (*MemStore)(unsafe.Pointer(p)).FszMax { + return SQLITE_FULL + } + newSz = newSz * (int64(2)) + if newSz > (*MemStore)(unsafe.Pointer(p)).FszMax { + newSz = (*MemStore)(unsafe.Pointer(p)).FszMax + } + pNew = Xsqlite3Realloc(tls, (*MemStore)(unsafe.Pointer(p)).FaData, uint64(newSz)) + if pNew == uintptr(0) { + return (SQLITE_IOERR | (int32(12) << 8)) + } + (*MemStore)(unsafe.Pointer(p)).FaData = pNew + (*MemStore)(unsafe.Pointer(p)).FszAlloc = newSz + return SQLITE_OK +} + +// Write data to an memdb-file. +func memdbWrite(tls *libc.TLS, pFile uintptr, z uintptr, iAmt int32, iOfst Sqlite_int64) int32 { /* sqlite3.c:48813:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + memdbEnter(tls, p) + if ((*MemStore)(unsafe.Pointer(p)).FmFlags & uint32(SQLITE_DESERIALIZE_READONLY)) != 0 { + // Can't happen: memdbLock() will return SQLITE_READONLY before + // reaching this point + memdbLeave(tls, p) + return (SQLITE_IOERR | (int32(3) << 8)) + } + if (iOfst + Sqlite_int64(iAmt)) > (*MemStore)(unsafe.Pointer(p)).Fsz { + var rc int32 + if ((iOfst + Sqlite_int64(iAmt)) > (*MemStore)(unsafe.Pointer(p)).FszAlloc) && + ((libc.AssignInt32(&rc, memdbEnlarge(tls, p, (iOfst+Sqlite_int64(iAmt))))) != SQLITE_OK) { + memdbLeave(tls, p) + return rc + } + if iOfst > (*MemStore)(unsafe.Pointer(p)).Fsz { + libc.Xmemset(tls, ((*MemStore)(unsafe.Pointer(p)).FaData + uintptr((*MemStore)(unsafe.Pointer(p)).Fsz)), 0, (uint64(iOfst - (*MemStore)(unsafe.Pointer(p)).Fsz))) + } + (*MemStore)(unsafe.Pointer(p)).Fsz = (iOfst + Sqlite_int64(iAmt)) + } + libc.Xmemcpy(tls, ((*MemStore)(unsafe.Pointer(p)).FaData + uintptr(iOfst)), z, uint64(iAmt)) + memdbLeave(tls, p) + return SQLITE_OK +} + +// Truncate an memdb-file. +// +// In rollback mode (which is always the case for memdb, as it does not +// support WAL mode) the truncate() method is only used to reduce +// the size of a file, never to increase the size. +func memdbTruncate(tls *libc.TLS, pFile uintptr, size Sqlite_int64) int32 { /* sqlite3.c:48850:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + var rc int32 = SQLITE_OK + memdbEnter(tls, p) + if size > (*MemStore)(unsafe.Pointer(p)).Fsz { + rc = SQLITE_FULL + } else { + (*MemStore)(unsafe.Pointer(p)).Fsz = size + } + memdbLeave(tls, p) + return rc +} + +// Sync an memdb-file. +func memdbSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* sqlite3.c:48866:12: */ + _ = pFile + _ = flags + return SQLITE_OK +} + +// Return the current file-size of an memdb-file. +func memdbFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* sqlite3.c:48875:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + memdbEnter(tls, p) + *(*Sqlite_int64)(unsafe.Pointer(pSize)) = (*MemStore)(unsafe.Pointer(p)).Fsz + memdbLeave(tls, p) + return SQLITE_OK +} + +// Lock an memdb-file. +func memdbLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* sqlite3.c:48886:12: */ + var pThis uintptr = pFile + var p uintptr = (*MemFile)(unsafe.Pointer(pThis)).FpStore + var rc int32 = SQLITE_OK + if eLock == (*MemFile)(unsafe.Pointer(pThis)).FeLock { + return SQLITE_OK + } + memdbEnter(tls, p) + if eLock > SQLITE_LOCK_SHARED { + if ((*MemStore)(unsafe.Pointer(p)).FmFlags & uint32(SQLITE_DESERIALIZE_READONLY)) != 0 { + rc = SQLITE_READONLY + } else if (*MemFile)(unsafe.Pointer(pThis)).FeLock <= SQLITE_LOCK_SHARED { + if (*MemStore)(unsafe.Pointer(p)).FnWrLock != 0 { + rc = SQLITE_BUSY + } else { + (*MemStore)(unsafe.Pointer(p)).FnWrLock = 1 + } + } + } else if eLock == SQLITE_LOCK_SHARED { + if (*MemFile)(unsafe.Pointer(pThis)).FeLock > SQLITE_LOCK_SHARED { + + (*MemStore)(unsafe.Pointer(p)).FnWrLock = 0 + } else if (*MemStore)(unsafe.Pointer(p)).FnWrLock != 0 { + rc = SQLITE_BUSY + } else { + (*MemStore)(unsafe.Pointer(p)).FnRdLock++ + } + } else { + + if (*MemFile)(unsafe.Pointer(pThis)).FeLock > SQLITE_LOCK_SHARED { + + (*MemStore)(unsafe.Pointer(p)).FnWrLock = 0 + } + + (*MemStore)(unsafe.Pointer(p)).FnRdLock-- + } + if rc == SQLITE_OK { + (*MemFile)(unsafe.Pointer(pThis)).FeLock = eLock + } + memdbLeave(tls, p) + return rc +} + +// File control method. For custom operations on an memdb-file. +func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:48940:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + var rc int32 = SQLITE_NOTFOUND + memdbEnter(tls, p) + if op == SQLITE_FCNTL_VFSNAME { + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2969 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + rc = SQLITE_OK + } + if op == SQLITE_FCNTL_SIZE_LIMIT { + var iLimit Sqlite3_int64 = *(*Sqlite3_int64)(unsafe.Pointer(pArg)) + if iLimit < (*MemStore)(unsafe.Pointer(p)).Fsz { + if iLimit < int64(0) { + iLimit = (*MemStore)(unsafe.Pointer(p)).FszMax + } else { + iLimit = (*MemStore)(unsafe.Pointer(p)).Fsz + } + } + (*MemStore)(unsafe.Pointer(p)).FszMax = iLimit + *(*Sqlite3_int64)(unsafe.Pointer(pArg)) = iLimit + rc = SQLITE_OK + } + memdbLeave(tls, p) + return rc +} + +// Return the device characteristic flags supported by an memdb-file. +func memdbDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:48977:12: */ + _ = pFile + return (((SQLITE_IOCAP_ATOMIC | SQLITE_IOCAP_POWERSAFE_OVERWRITE) | SQLITE_IOCAP_SAFE_APPEND) | SQLITE_IOCAP_SEQUENTIAL) +} + +// Fetch a page of a memory-mapped file +func memdbFetch(tls *libc.TLS, pFile uintptr, iOfst Sqlite3_int64, iAmt int32, pp uintptr) int32 { /* sqlite3.c:48986:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + memdbEnter(tls, p) + if (iOfst + Sqlite3_int64(iAmt)) > (*MemStore)(unsafe.Pointer(p)).Fsz { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } else { + (*MemStore)(unsafe.Pointer(p)).FnMmap++ + *(*uintptr)(unsafe.Pointer(pp)) = ((*MemStore)(unsafe.Pointer(p)).FaData + uintptr(iOfst)) + } + memdbLeave(tls, p) + return SQLITE_OK +} + +// Release a memory-mapped page +func memdbUnfetch(tls *libc.TLS, pFile uintptr, iOfst Sqlite3_int64, pPage uintptr) int32 { /* sqlite3.c:49005:12: */ + var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore + _ = iOfst + _ = pPage + memdbEnter(tls, p) + (*MemStore)(unsafe.Pointer(p)).FnMmap-- + memdbLeave(tls, p) + return SQLITE_OK +} + +// Open an mem file handle. +func memdbOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFd uintptr, flags int32, pOutFlags uintptr) int32 { /* sqlite3.c:49018:12: */ + var pFile uintptr = pFd + var p uintptr = uintptr(0) + var szName int32 + if (flags & SQLITE_OPEN_MAIN_DB) == 0 { + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 40 /* &.xOpen */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName, pFd, flags, pOutFlags) + } + libc.Xmemset(tls, pFile, 0, uint64(unsafe.Sizeof(MemStore{}))) + szName = Xsqlite3Strlen30(tls, zName) + if (szName > 1) && (int32(*(*int8)(unsafe.Pointer(zName))) == '/') { + var i int32 + var pVfsMutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_VFS1) + Xsqlite3_mutex_enter(tls, pVfsMutex) + for i = 0; i < memdb_g.FnMemStore; i++ { + if libc.Xstrcmp(tls, (*MemStore)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(memdb_g.FapMemStore + uintptr(i)*8)))).FzFName, zName) == 0 { + p = *(*uintptr)(unsafe.Pointer(memdb_g.FapMemStore + uintptr(i)*8)) + break + } + } + if p == uintptr(0) { + var apNew uintptr + p = Xsqlite3Malloc(tls, (uint64((uint64(unsafe.Sizeof(MemStore{})) + uint64(szName)) + uint64(3)))) + if p == uintptr(0) { + Xsqlite3_mutex_leave(tls, pVfsMutex) + return SQLITE_NOMEM + } + apNew = Xsqlite3Realloc(tls, memdb_g.FapMemStore, + (uint64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(memdb_g.FnMemStore + 1))))) + if apNew == uintptr(0) { + Xsqlite3_free(tls, p) + Xsqlite3_mutex_leave(tls, pVfsMutex) + return SQLITE_NOMEM + } + *(*uintptr)(unsafe.Pointer(apNew + uintptr(libc.PostIncInt32(&memdb_g.FnMemStore, 1))*8)) = p + memdb_g.FapMemStore = apNew + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(MemStore{}))) + (*MemStore)(unsafe.Pointer(p)).FmFlags = (uint32(SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE)) + (*MemStore)(unsafe.Pointer(p)).FszMax = Xsqlite3Config.FmxMemdbSize + (*MemStore)(unsafe.Pointer(p)).FzFName = (p + 1*72) + libc.Xmemcpy(tls, (*MemStore)(unsafe.Pointer(p)).FzFName, zName, (uint64(szName + 1))) + (*MemStore)(unsafe.Pointer(p)).FpMutex = Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST) + if (*MemStore)(unsafe.Pointer(p)).FpMutex == uintptr(0) { + memdb_g.FnMemStore-- + Xsqlite3_free(tls, p) + Xsqlite3_mutex_leave(tls, pVfsMutex) + return SQLITE_NOMEM + } + (*MemStore)(unsafe.Pointer(p)).FnRef = 1 + memdbEnter(tls, p) + } else { + memdbEnter(tls, p) + (*MemStore)(unsafe.Pointer(p)).FnRef++ + } + Xsqlite3_mutex_leave(tls, pVfsMutex) + } else { + p = Xsqlite3Malloc(tls, uint64(unsafe.Sizeof(MemStore{}))) + if p == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(MemStore{}))) + (*MemStore)(unsafe.Pointer(p)).FmFlags = (uint32(SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE)) + (*MemStore)(unsafe.Pointer(p)).FszMax = Xsqlite3Config.FmxMemdbSize + } + (*MemFile)(unsafe.Pointer(pFile)).FpStore = p + // True because flags==SQLITE_OPEN_MAIN_DB + *(*int32)(unsafe.Pointer(pOutFlags)) = (flags | SQLITE_OPEN_MEMORY) + (*Sqlite3_file)(unsafe.Pointer(pFd)).FpMethods = uintptr(unsafe.Pointer(&memdb_io_methods)) + memdbLeave(tls, p) + return SQLITE_OK +} + +// Test for access permissions. Return true if the requested permission +// is available, or false otherwise. +// +// With memdb, no files ever exist on disk. So always return false. +func memdbAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* sqlite3.c:49115:12: */ + _ = pVfs + _ = zPath + _ = flags + *(*int32)(unsafe.Pointer(pResOut)) = 0 + return SQLITE_OK +} + +// Populate buffer zOut with the full canonical pathname corresponding +// to the pathname in zPath. zOut is guaranteed to point to a buffer +// of at least (INST_MAX_PATHNAME+1) bytes. +func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* sqlite3.c:49133:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + _ = pVfs + Xsqlite3_snprintf(tls, nOut, zOut, ts+2791 /* "%s" */, libc.VaList(bp, zPath)) + return SQLITE_OK +} + +// Open the dynamic library located at zPath and return a handle. +func memdbDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* sqlite3.c:49147:13: */ + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 72 /* &.xDlOpen */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath) +} + +// Populate the buffer zErrMsg (size nByte bytes) with a human readable +// utf-8 string describing the most recent error encountered associated +// with dynamic libraries. +func memdbDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* sqlite3.c:49156:13: */ + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 80 /* &.xDlError */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zErrMsg) +} + +// Return a pointer to the symbol zSymbol in the dynamic library pHandle. +func memdbDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* sqlite3.c:49163:13: */ + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 88 /* &.xDlSym */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p, zSym) +} + +// Close the dynamic library handle pHandle. +func memdbDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* sqlite3.c:49170:13: */ + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 96 /* &.xDlClose */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pHandle) +} + +// Populate the buffer pointed to by zBufOut with nByte bytes of +// random data. +func memdbRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* sqlite3.c:49178:12: */ + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 104 /* &.xRandomness */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zBufOut) +} + +// Sleep for nMicro microseconds. Return the number of microseconds +// actually slept. +func memdbSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* sqlite3.c:49186:12: */ + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 112 /* &.xSleep */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nMicro) +} + +func memdbGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* sqlite3.c:49199:12: */ + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 128 /* &.xGetLastError */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, a, b) +} + +func memdbCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* sqlite3.c:49202:12: */ + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 136 /* &.xCurrentTimeInt64 */))))(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p) +} + +// Translate a database connection pointer and schema name into a +// MemFile pointer. +func memdbFromDbSchema(tls *libc.TLS, db uintptr, zSchema uintptr) uintptr { /* sqlite3.c:49210:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + var pStore uintptr + var rc int32 = Xsqlite3_file_control(tls, db, zSchema, SQLITE_FCNTL_FILE_POINTER, bp /* &p */) + if rc != 0 { + return uintptr(0) + } + if (*MemFile)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fbase.FpMethods != uintptr(unsafe.Pointer(&memdb_io_methods)) { + return uintptr(0) + } + pStore = (*MemFile)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpStore + memdbEnter(tls, pStore) + if (*MemStore)(unsafe.Pointer(pStore)).FzFName != uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + } + memdbLeave(tls, pStore) + return *(*uintptr)(unsafe.Pointer(bp /* p */)) +} + +// Return the serialization of a database +func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintptr, mFlags uint32) uintptr { /* sqlite3.c:49226:26: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var p uintptr + var iDb int32 + var pBt uintptr + var sz Sqlite3_int64 + var szPage int32 = 0 + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) + var pOut uintptr + var zSql uintptr + var rc int32 + + if zSchema == uintptr(0) { + zSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName + } + p = memdbFromDbSchema(tls, db, zSchema) + iDb = Xsqlite3FindDbName(tls, db, zSchema) + if piSize != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(piSize)) = int64(-1) + } + if iDb < 0 { + return uintptr(0) + } + if p != 0 { + var pStore uintptr = (*MemFile)(unsafe.Pointer(p)).FpStore + + if piSize != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(piSize)) = (*MemStore)(unsafe.Pointer(pStore)).Fsz + } + if (mFlags & uint32(SQLITE_SERIALIZE_NOCOPY)) != 0 { + pOut = (*MemStore)(unsafe.Pointer(pStore)).FaData + } else { + pOut = Xsqlite3_malloc64(tls, uint64((*MemStore)(unsafe.Pointer(pStore)).Fsz)) + if pOut != 0 { + libc.Xmemcpy(tls, pOut, (*MemStore)(unsafe.Pointer(pStore)).FaData, uint64((*MemStore)(unsafe.Pointer(pStore)).Fsz)) + } + } + return pOut + } + pBt = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + if pBt == uintptr(0) { + return uintptr(0) + } + szPage = Xsqlite3BtreeGetPageSize(tls, pBt) + zSql = Xsqlite3_mprintf(tls, ts+2984 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + if zSql != 0 { + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) + } else { + rc = SQLITE_NOMEM + } + Xsqlite3_free(tls, zSql) + if rc != 0 { + return uintptr(0) + } + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + if rc != SQLITE_ROW { + pOut = uintptr(0) + } else { + sz = (Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) * Sqlite_int64(szPage)) + if piSize != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(piSize)) = sz + } + if (mFlags & uint32(SQLITE_SERIALIZE_NOCOPY)) != 0 { + pOut = uintptr(0) + } else { + pOut = Xsqlite3_malloc64(tls, uint64(sz)) + if pOut != 0 { + var nPage int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) + var pPager uintptr = Xsqlite3BtreePager(tls, pBt) + var pgno int32 + for pgno = 1; pgno <= nPage; pgno++ { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pPage */)) = uintptr(0) + var pTo uintptr = (pOut + uintptr((Sqlite3_int64(szPage) * (Sqlite3_int64(pgno - 1))))) + rc = Xsqlite3PagerGet(tls, pPager, uint32(pgno), bp+16 /* &pPage */, 0) + if rc == SQLITE_OK { + libc.Xmemcpy(tls, pTo, Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pPage */))), uint64(szPage)) + } else { + libc.Xmemset(tls, pTo, 0, uint64(szPage)) + } + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pPage */))) + } + } + } + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + return pOut +} + +// Convert zSchema to a MemDB and initialize its content. +func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uintptr, szDb Sqlite3_int64, szBuf Sqlite3_int64, mFlags uint32) int32 { /* sqlite3.c:49307:16: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr + var zSql uintptr + // var pStmt uintptr at bp+8, 8 + + var rc int32 + var iDb int32 + var pStore uintptr + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if !(zSchema == uintptr(0)) { + goto __1 + } + zSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName +__1: + ; + iDb = Xsqlite3FindDbName(tls, db, zSchema) + if !(iDb < 0) { + goto __2 + } + rc = SQLITE_ERROR + goto end_deserialize +__2: + ; + zSql = Xsqlite3_mprintf(tls, ts+3007 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + if !(zSql == uintptr(0)) { + goto __3 + } + rc = SQLITE_NOMEM + goto __4 +__3: + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zSql) +__4: + ; + if !(rc != 0) { + goto __5 + } + goto end_deserialize +__5: + ; + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(iDb) + libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.reopenMemdb */, uint32(1), 2, 0x4) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.reopenMemdb */, uint32(0), 2, 0x4) + if !(rc != SQLITE_DONE) { + goto __6 + } + rc = SQLITE_ERROR + goto end_deserialize +__6: + ; + p = memdbFromDbSchema(tls, db, zSchema) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_ERROR + goto __8 +__7: + pStore = (*MemFile)(unsafe.Pointer(p)).FpStore + (*MemStore)(unsafe.Pointer(pStore)).FaData = pData + pData = uintptr(0) + (*MemStore)(unsafe.Pointer(pStore)).Fsz = szDb + (*MemStore)(unsafe.Pointer(pStore)).FszAlloc = szBuf + (*MemStore)(unsafe.Pointer(pStore)).FszMax = szBuf + if !((*MemStore)(unsafe.Pointer(pStore)).FszMax < Xsqlite3Config.FmxMemdbSize) { + goto __9 + } + (*MemStore)(unsafe.Pointer(pStore)).FszMax = Xsqlite3Config.FmxMemdbSize +__9: + ; + (*MemStore)(unsafe.Pointer(pStore)).FmFlags = mFlags + rc = SQLITE_OK +__8: + ; + +end_deserialize: + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + if !((pData != 0) && ((mFlags & uint32(SQLITE_DESERIALIZE_FREEONCLOSE)) != uint32(0))) { + goto __10 + } + Xsqlite3_free(tls, pData) +__10: + ; + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// This routine is called when the extension is loaded. +// Register the new VFS. +func Xsqlite3MemdbInit(tls *libc.TLS) int32 { /* sqlite3.c:49382:20: */ + var pLower uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) + var sz uint32 + if pLower == uintptr(0) { + return SQLITE_ERROR + } + sz = uint32((*Sqlite3_vfs)(unsafe.Pointer(pLower)).FszOsFile) + memdb_vfs.FpAppData = pLower + // The following conditional can only be true when compiled for + // Windows x86 and SQLITE_MAX_MMAP_SIZE=0. We always leave + // it in, to be safe, but it is marked as NO_TEST since there + // is no way to reach it under most builds. + if (uint64(sz) < uint64(unsafe.Sizeof(MemFile{}))) { + sz = uint32(unsafe.Sizeof(MemFile{})) + } //NO_TEST + memdb_vfs.FszOsFile = int32(sz) + return Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&memdb_vfs)), 0) +} + +// Create a new bitmap object able to handle bits between 0 and iSize, +// inclusive. Return a pointer to the new object. Return NULL if +// malloc fails. +func Xsqlite3BitvecCreate(tls *libc.TLS, iSize U32) uintptr { /* sqlite3.c:49514:23: */ + var p uintptr + + p = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(Bitvec{}))) + if p != 0 { + (*Bitvec)(unsafe.Pointer(p)).FiSize = iSize + } + return p +} + +// Check to see if the i-th bit is set. Return true or false. +// If p is NULL (if the bitmap has not been created) or if +// i is out of range, then return false. +func Xsqlite3BitvecTestNotNull(tls *libc.TLS, p uintptr, i U32) int32 { /* sqlite3.c:49529:20: */ + + i-- + if i >= (*Bitvec)(unsafe.Pointer(p)).FiSize { + return 0 + } + for (*Bitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + var bin U32 = (i / (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + i = (i % (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + p = *(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(bin)*8)) + if !(p != 0) { + return 0 + } + } + if uint64((*Bitvec)(unsafe.Pointer(p)).FiSize) <= (((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U8(0)))) * uint64(BITVEC_SZELEM)) { + return (libc.Bool32((int32(*(*U8)(unsafe.Pointer((p + 16 /* &.u */ /* &.aBitmap */) + uintptr((i / U32(BITVEC_SZELEM)))))) & (int32(1) << (i & (U32(BITVEC_SZELEM - 1))))) != 0)) + } else { + var h U32 = (U32((uint64((libc.PostIncUint32(&i, 1)) * U32(1))) % ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))))) + for *(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) != 0 { + if *(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) == i { + return 1 + } + h = (U32((uint64(h + U32(1))) % ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))))) + } + return 0 + } + return int32(0) +} + +func Xsqlite3BitvecTest(tls *libc.TLS, p uintptr, i U32) int32 { /* sqlite3.c:49552:20: */ + return (libc.Bool32((p != uintptr(0)) && (Xsqlite3BitvecTestNotNull(tls, p, i) != 0))) +} + +// Set the i-th bit. Return 0 on success and an error code if +// anything goes wrong. +// +// This routine might cause sub-bitmaps to be allocated. Failing +// to get the memory needed to hold the sub-bitmap is the only +// that can go wrong with an insert, assuming p and i are valid. +// +// The calling function must ensure that p is a valid Bitvec object +// and that the value for "i" is within range of the Bitvec object. +// Otherwise the behavior is undefined. +func Xsqlite3BitvecSet(tls *libc.TLS, p uintptr, i U32) int32 { /* sqlite3.c:49568:20: */ + var h U32 + var bin U32 + var j uint32 + var rc int32 + var aiValues uintptr + if !(p == uintptr(0)) { + goto __1 + } + return SQLITE_OK +__1: + ; + + i-- +__2: + if !((uint64((*Bitvec)(unsafe.Pointer(p)).FiSize) > (((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U8(0)))) * uint64(BITVEC_SZELEM))) && ((*Bitvec)(unsafe.Pointer(p)).FiDivisor != 0)) { + goto __3 + } + bin = (i / (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + i = (i % (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + if !(*(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(bin)*8)) == uintptr(0)) { + goto __4 + } + *(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(bin)*8)) = Xsqlite3BitvecCreate(tls, (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + if !(*(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(bin)*8)) == uintptr(0)) { + goto __5 + } + return SQLITE_NOMEM +__5: + ; +__4: + ; + p = *(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(bin)*8)) + goto __2 +__3: + ; + if !(uint64((*Bitvec)(unsafe.Pointer(p)).FiSize) <= (((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U8(0)))) * uint64(BITVEC_SZELEM))) { + goto __6 + } + *(*U8)(unsafe.Pointer((p + 16 /* &.u */ /* &.aBitmap */) + uintptr((i / U32(BITVEC_SZELEM))))) |= U8((int32(1) << (i & (U32(BITVEC_SZELEM - 1))))) + return SQLITE_OK +__6: + ; + h = (U32((uint64((libc.PostIncUint32(&i, 1)) * U32(1))) % ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))))) + // if there wasn't a hash collision, and this doesn't + // completely fill the hash, then just add it without + // worring about sub-dividing and re-hashing. + if !(!(int32(*(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4))) != 0)) { + goto __7 + } + if !(uint64((*Bitvec)(unsafe.Pointer(p)).FnSet) < (((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))) - uint64(1))) { + goto __8 + } + goto bitvec_set_end + goto __9 +__8: + goto bitvec_set_rehash +__9: + ; +__7: + ; + // there was a collision, check to see if it's already + // in hash, if not, try to find a spot for it +__10: + if !(*(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) == i) { + goto __13 + } + return SQLITE_OK +__13: + ; + h++ + if !(uint64(h) >= ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0))))) { + goto __14 + } + h = U32(0) +__14: + ; + goto __11 +__11: + if *(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) != 0 { + goto __10 + } + goto __12 +__12: + ; + // we didn't find it in the hash. h points to the first + // available free spot. check to see if this is going to + // make our hash too "full". +bitvec_set_rehash: + if !(uint64((*Bitvec)(unsafe.Pointer(p)).FnSet) >= (((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))) / uint64(2))) { + goto __15 + } + aiValues = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(unsafe.Sizeof([124]U32{}))) + if !(aiValues == uintptr(0)) { + goto __16 + } + return SQLITE_NOMEM + goto __17 +__16: + libc.Xmemcpy(tls, aiValues, p+16 /* &.u */ /* &.aHash */, uint64(unsafe.Sizeof([124]U32{}))) + libc.Xmemset(tls, p+16 /* &.u */ /* &.apSub */, 0, uint64(unsafe.Sizeof([62]uintptr{}))) + (*Bitvec)(unsafe.Pointer(p)).FiDivisor = (U32(((uint64((*Bitvec)(unsafe.Pointer(p)).FiSize) + ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(uintptr(0))))) - uint64(1)) / ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(uintptr(0)))))) + rc = Xsqlite3BitvecSet(tls, p, i) + j = uint32(0) +__18: + if !(uint64(j) < ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0))))) { + goto __20 + } + if !(*(*U32)(unsafe.Pointer(aiValues + uintptr(j)*4)) != 0) { + goto __21 + } + rc = rc | (Xsqlite3BitvecSet(tls, p, *(*U32)(unsafe.Pointer(aiValues + uintptr(j)*4)))) +__21: + ; + goto __19 +__19: + j++ + goto __18 + goto __20 +__20: + ; + Xsqlite3DbFree(tls, uintptr(0), aiValues) + return rc +__17: + ; +__15: + ; +bitvec_set_end: + (*Bitvec)(unsafe.Pointer(p)).FnSet++ + *(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) = i + return SQLITE_OK +} + +// Clear the i-th bit. +// +// pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage +// that BitvecClear can use to rebuilt its hash table. +func Xsqlite3BitvecClear(tls *libc.TLS, p uintptr, i U32, pBuf uintptr) { /* sqlite3.c:49639:21: */ + if p == uintptr(0) { + return + } + + i-- + for (*Bitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + var bin U32 = (i / (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + i = (i % (*Bitvec)(unsafe.Pointer(p)).FiDivisor) + p = *(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(bin)*8)) + if !(p != 0) { + return + } + } + if uint64((*Bitvec)(unsafe.Pointer(p)).FiSize) <= (((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U8(0)))) * uint64(BITVEC_SZELEM)) { + *(*U8)(unsafe.Pointer((p + 16 /* &.u */ /* &.aBitmap */) + uintptr((i / U32(BITVEC_SZELEM))))) &= U8((^(int32(1) << (i & (U32(BITVEC_SZELEM - 1)))))) + } else { + var j uint32 + var aiValues uintptr = pBuf + libc.Xmemcpy(tls, aiValues, p+16 /* &.u */ /* &.aHash */, uint64(unsafe.Sizeof([124]U32{}))) + libc.Xmemset(tls, p+16 /* &.u */ /* &.aHash */, 0, uint64(unsafe.Sizeof([124]U32{}))) + (*Bitvec)(unsafe.Pointer(p)).FnSet = U32(0) + for j = uint32(0); uint64(j) < ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))); j++ { + if (*(*U32)(unsafe.Pointer(aiValues + uintptr(j)*4)) != 0) && (*(*U32)(unsafe.Pointer(aiValues + uintptr(j)*4)) != (i + U32(1))) { + var h U32 = (U32((uint64((*(*U32)(unsafe.Pointer(aiValues + uintptr(j)*4)) - U32(1)) * U32(1))) % ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))))) + (*Bitvec)(unsafe.Pointer(p)).FnSet++ + for *(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) != 0 { + h++ + if uint64(h) >= ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(U32(0)))) { + h = U32(0) + } + } + *(*U32)(unsafe.Pointer((p + 16 /* &.u */ /* &.aHash */) + uintptr(h)*4)) = *(*U32)(unsafe.Pointer(aiValues + uintptr(j)*4)) + } + } + } +} + +// Destroy a bitmap object. Reclaim all memory used. +func Xsqlite3BitvecDestroy(tls *libc.TLS, p uintptr) { /* sqlite3.c:49676:21: */ + if p == uintptr(0) { + return + } + if (*Bitvec)(unsafe.Pointer(p)).FiDivisor != 0 { + var i uint32 + for i = uint32(0); uint64(i) < ((((uint64(BITVEC_SZ) - (uint64(3) * uint64(unsafe.Sizeof(U32(0))))) / uint64(unsafe.Sizeof(uintptr(0)))) * uint64(unsafe.Sizeof(uintptr(0)))) / uint64(unsafe.Sizeof(uintptr(0)))); i++ { + Xsqlite3BitvecDestroy(tls, *(*uintptr)(unsafe.Pointer((p + 16 /* &.u */ /* &.apSub */) + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, p) +} + +// Return the value of the iSize parameter specified when Bitvec *p +// was created. +func Xsqlite3BitvecSize(tls *libc.TLS, p uintptr) U32 { /* sqlite3.c:49691:20: */ + return (*Bitvec)(unsafe.Pointer(p)).FiSize +} + +// Let V[] be an array of unsigned characters sufficient to hold +// up to N bits. Let I be an integer between 0 and N. 0<=I 0) { + goto __11 + } + nx = 0 +__11: + ; + pc = pc + (nx) + *(*int32)(unsafe.Pointer(bp /* i */)) = ((*(*int32)(unsafe.Pointer(bp /* i */)) & 0x7fffffff) % sz) + if !((op & 1) != 0) { + goto __12 + } + *(*uint8)(unsafe.Pointer(pV + uintptr(((*(*int32)(unsafe.Pointer(bp /* i */)) + 1) >> 3)))) |= uint8((int32(1) << ((*(*int32)(unsafe.Pointer(bp /* i */)) + 1) & 7))) + if !(op != 5) { + goto __14 + } + if !(Xsqlite3BitvecSet(tls, pBitvec, (uint32(*(*int32)(unsafe.Pointer(bp /* i */))+1))) != 0) { + goto __15 + } + goto bitvec_end +__15: + ; +__14: + ; + goto __13 +__12: + *(*uint8)(unsafe.Pointer(pV + uintptr(((*(*int32)(unsafe.Pointer(bp /* i */)) + 1) >> 3)))) &= uint8((^(int32(1) << ((*(*int32)(unsafe.Pointer(bp /* i */)) + 1) & 7)))) + Xsqlite3BitvecClear(tls, pBitvec, (uint32(*(*int32)(unsafe.Pointer(bp /* i */)) + 1)), pTmpSpace) +__13: + ; + goto __2 +__3: + ; + + // Test to make sure the linear array exactly matches the + // Bitvec object. Start with the assumption that they do + // match (rc==0). Change rc to non-zero if a discrepancy + // is found. + rc = (int32((U32((Xsqlite3BitvecTest(tls, uintptr(0), uint32(0)) + Xsqlite3BitvecTest(tls, pBitvec, (uint32(sz+1)))) + + Xsqlite3BitvecTest(tls, pBitvec, uint32(0)))) + + (Xsqlite3BitvecSize(tls, pBitvec) - U32(sz)))) + *(*int32)(unsafe.Pointer(bp /* i */)) = 1 +__16: + if !(*(*int32)(unsafe.Pointer(bp /* i */)) <= sz) { + goto __18 + } + if !((libc.Bool32((int32(*(*uint8)(unsafe.Pointer(pV + uintptr((*(*int32)(unsafe.Pointer(bp /* i */)) >> 3))))) & (int32(1) << (*(*int32)(unsafe.Pointer(bp /* i */)) & 7))) != 0)) != Xsqlite3BitvecTest(tls, pBitvec, uint32(*(*int32)(unsafe.Pointer(bp /* i */))))) { + goto __19 + } + rc = *(*int32)(unsafe.Pointer(bp /* i */)) + goto __18 +__19: + ; + goto __17 +__17: + *(*int32)(unsafe.Pointer(bp /* i */))++ + goto __16 + goto __18 +__18: + ; + + // Free allocated structure +bitvec_end: + Xsqlite3_free(tls, pTmpSpace) + Xsqlite3_free(tls, pV) + Xsqlite3BitvecDestroy(tls, pBitvec) + return rc +} + +//********************************* Test and Debug Logic ********************* +// Debug tracing macros. Enable by by changing the "0" to "1" and +// recompiling. +// +// When sqlite3PcacheTrace is 1, single line trace messages are issued. +// When sqlite3PcacheTrace is 2, a dump of the pcache showing all cache entries +// is displayed for many operations, resulting in a lot of output. + +// Check invariants on a PgHdr entry. Return true if everything is OK. +// Return false if any invariant is violated. +// +// This routine is for use inside of assert() statements only. For +// example: +// +// assert( sqlite3PcachePageSanity(pPg) ); + +//********************************* Linked List Management ******************* + +// Allowed values for second argument to pcacheManageDirtyList() + +// Manage pPage's participation on the dirty list. Bits of the addRemove +// argument determines what operation to do. The 0x01 bit means first +// remove pPage from the dirty list. The 0x02 means add pPage back to +// the dirty list. Doing both moves pPage to the front of the dirty list. +func pcacheManageDirtyList(tls *libc.TLS, pPage uintptr, addRemove U8) { /* sqlite3.c:49971:13: */ + var p uintptr = (*PgHdr)(unsafe.Pointer(pPage)).FpCache + + if (int32(addRemove) & PCACHE_DIRTYLIST_REMOVE) != 0 { + + // Update the PCache1.pSynced variable if necessary. + if (*PCache)(unsafe.Pointer(p)).FpSynced == pPage { + (*PCache)(unsafe.Pointer(p)).FpSynced = (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev + } + + if (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext != 0 { + (*PgHdr)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext)).FpDirtyPrev = (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev + } else { + + (*PCache)(unsafe.Pointer(p)).FpDirtyTail = (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev + } + if (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev != 0 { + (*PgHdr)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev)).FpDirtyNext = (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext + } else { + // If there are now no dirty pages in the cache, set eCreate to 2. + // This is an optimization that allows sqlite3PcacheFetch() to skip + // searching for a dirty page to eject from the cache when it might + // otherwise have to. + + (*PCache)(unsafe.Pointer(p)).FpDirty = (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext + + if (*PCache)(unsafe.Pointer(p)).FpDirty == uintptr(0) { //OPTIMIZATION-IF-TRUE + + (*PCache)(unsafe.Pointer(p)).FeCreate = U8(2) + } + } + } + if (int32(addRemove) & PCACHE_DIRTYLIST_ADD) != 0 { + (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyPrev = uintptr(0) + (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext = (*PCache)(unsafe.Pointer(p)).FpDirty + if (*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext != 0 { + + (*PgHdr)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(pPage)).FpDirtyNext)).FpDirtyPrev = pPage + } else { + (*PCache)(unsafe.Pointer(p)).FpDirtyTail = pPage + if (*PCache)(unsafe.Pointer(p)).FbPurgeable != 0 { + + (*PCache)(unsafe.Pointer(p)).FeCreate = U8(1) + } + } + (*PCache)(unsafe.Pointer(p)).FpDirty = pPage + + // If pSynced is NULL and this page has a clear NEED_SYNC flag, set + // pSynced to point to it. Checking the NEED_SYNC flag is an + // optimization, as if pSynced points to a page with the NEED_SYNC + // flag set sqlite3PcacheFetchStress() searches through all newer + // entries of the dirty-list for a page with NEED_SYNC clear anyway. + if !(int32((*PCache)(unsafe.Pointer(p)).FpSynced) != 0) && + (0 == (int32((*PgHdr)(unsafe.Pointer(pPage)).Fflags) & PGHDR_NEED_SYNC)) { + (*PCache)(unsafe.Pointer(p)).FpSynced = pPage + } + } + +} + +// Wrapper around the pluggable caches xUnpin method. If the cache is +// being used for an in-memory database, this function is a no-op. +func pcacheUnpin(tls *libc.TLS, p uintptr) { /* sqlite3.c:50041:13: */ + if (*PCache)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(p)).FpCache)).FbPurgeable != 0 { + + (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 64 /* &.xUnpin */))))(tls, (*PCache)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(p)).FpCache)).FpCache, (*PgHdr)(unsafe.Pointer(p)).FpPage, 0) + + } +} + +// Compute the number of pages of cache requested. p->szCache is the +// cache size requested by the "PRAGMA cache_size" statement. +func numberOfCachePages(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:50053:12: */ + if (*PCache)(unsafe.Pointer(p)).FszCache >= 0 { + // IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the + // suggested cache size is set to N. + return (*PCache)(unsafe.Pointer(p)).FszCache + } else { + // IMPLEMANTATION-OF: R-59858-46238 If the argument N is negative, then the + // number of cache pages is adjusted to be a number of pages that would + // use approximately abs(N*1024) bytes of memory based on the current + // page size. + return (int32((int64(-1024) * I64((*PCache)(unsafe.Pointer(p)).FszCache)) / (I64((*PCache)(unsafe.Pointer(p)).FszPage + (*PCache)(unsafe.Pointer(p)).FszExtra)))) + } + return int32(0) +} + +// ************************************************** General Interfaces ****** +// +// +// Initialize and shutdown the page cache subsystem. Neither of these +// functions are threadsafe. +func Xsqlite3PcacheInitialize(tls *libc.TLS) int32 { /* sqlite3.c:50072:20: */ + if Xsqlite3Config.Fpcache2.FxInit == uintptr(0) { + // IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the + // built-in default page cache is used instead of the application defined + // page cache. + Xsqlite3PCacheSetDefault(tls) + + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 16 /* &.xInit */))))(tls, Xsqlite3Config.Fpcache2.FpArg) +} + +func Xsqlite3PcacheShutdown(tls *libc.TLS) { /* sqlite3.c:50082:21: */ + if Xsqlite3Config.Fpcache2.FxShutdown != 0 { + // IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 24 /* &.xShutdown */))))(tls, Xsqlite3Config.Fpcache2.FpArg) + } +} + +// Return the size in bytes of a PCache object. +func Xsqlite3PcacheSize(tls *libc.TLS) int32 { /* sqlite3.c:50092:20: */ + return int32(unsafe.Sizeof(PCache{})) +} + +// Create a new PCache object. Storage space to hold the object +// has already been allocated and is passed in as the p pointer. +// The caller discovers how much space needs to be allocated by +// calling sqlite3PcacheSize(). +// +// szExtra is some extra space allocated for each page. The first +// 8 bytes of the extra space will be zeroed as the page is allocated, +// but remaining content will be uninitialized. Though it is opaque +// to this module, the extra space really ends up being the MemPage +// structure in the pager. +func Xsqlite3PcacheOpen(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32, xStress uintptr, pStress uintptr, p uintptr) int32 { /* sqlite3.c:50106:20: */ + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(PCache{}))) + (*PCache)(unsafe.Pointer(p)).FszPage = 1 + (*PCache)(unsafe.Pointer(p)).FszExtra = szExtra + // First 8 bytes will be zeroed + (*PCache)(unsafe.Pointer(p)).FbPurgeable = U8(bPurgeable) + (*PCache)(unsafe.Pointer(p)).FeCreate = U8(2) + (*PCache)(unsafe.Pointer(p)).FxStress = xStress + (*PCache)(unsafe.Pointer(p)).FpStress = pStress + (*PCache)(unsafe.Pointer(p)).FszCache = 100 + (*PCache)(unsafe.Pointer(p)).FszSpill = 1 + + return Xsqlite3PcacheSetPageSize(tls, p, szPage) +} + +// Change the page size for PCache object. The caller must ensure that there +// are no outstanding page references when this function is called. +func Xsqlite3PcacheSetPageSize(tls *libc.TLS, pCache uintptr, szPage int32) int32 { /* sqlite3.c:50132:20: */ + + if (*PCache)(unsafe.Pointer(pCache)).FszPage != 0 { + var pNew uintptr + pNew = (*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 32 /* &.xCreate */))))(tls, + szPage, (int32(uint64((*PCache)(unsafe.Pointer(pCache)).FszExtra) + (((uint64(unsafe.Sizeof(PgHdr{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))))), + int32((*PCache)(unsafe.Pointer(pCache)).FbPurgeable)) + if pNew == uintptr(0) { + return SQLITE_NOMEM + } + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 40 /* &.xCachesize */))))(tls, pNew, numberOfCachePages(tls, pCache)) + if (*PCache)(unsafe.Pointer(pCache)).FpCache != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 88 /* &.xDestroy */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache) + } + (*PCache)(unsafe.Pointer(pCache)).FpCache = pNew + (*PCache)(unsafe.Pointer(pCache)).FszPage = szPage + + } + return SQLITE_OK +} + +// Try to obtain a page from the cache. +// +// This routine returns a pointer to an sqlite3_pcache_page object if +// such an object is already in cache, or if a new one is created. +// This routine returns a NULL pointer if the object was not in cache +// and could not be created. +// +// The createFlags should be 0 to check for existing pages and should +// be 3 (not 1, but 3) to try to create a new page. +// +// If the createFlag is 0, then NULL is always returned if the page +// is not already in the cache. If createFlag is 1, then a new page +// is created only if that can be done without spilling dirty pages +// and without exceeding the cache size limit. +// +// The caller needs to invoke sqlite3PcacheFetchFinish() to properly +// initialize the sqlite3_pcache_page object and convert it into a +// PgHdr object. The sqlite3PcacheFetch() and sqlite3PcacheFetchFinish() +// routines are split this way for performance reasons. When separated +// they can both (usually) operate without having to push values to +// the stack on entry and pop them back off on exit, which saves a +// lot of pushing and popping. +func Xsqlite3PcacheFetch(tls *libc.TLS, pCache uintptr, pgno Pgno, createFlag int32) uintptr { /* sqlite3.c:50176:36: */ + var eCreate int32 + var pRes uintptr + + // eCreate defines what to do if the page does not exist. + // 0 Do not allocate a new page. (createFlag==0) + // 1 Allocate a new page if doing so is inexpensive. + // (createFlag==1 AND bPurgeable AND pDirty) + // 2 Allocate a new page even it doing so is difficult. + // (createFlag==1 AND !(bPurgeable AND pDirty) + eCreate = (createFlag & int32((*PCache)(unsafe.Pointer(pCache)).FeCreate)) + + pRes = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 56 /* &.xFetch */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache, pgno, eCreate) + + return pRes +} + +// If the sqlite3PcacheFetch() routine is unable to allocate a new +// page because no clean pages are available for reuse and the cache +// size limit has been reached, then this routine can be invoked to +// try harder to allocate a page. This routine might invoke the stress +// callback to spill dirty pages to the journal. It will then try to +// allocate the new page and will only fail to allocate a new page on +// an OOM error. +// +// This routine should be invoked only after sqlite3PcacheFetch() fails. +func Xsqlite3PcacheFetchStress(tls *libc.TLS, pCache uintptr, pgno Pgno, ppPage uintptr) int32 { /* sqlite3.c:50217:20: */ + var pPg uintptr + if int32((*PCache)(unsafe.Pointer(pCache)).FeCreate) == 2 { + return 0 + } + + if Xsqlite3PcachePagecount(tls, pCache) > (*PCache)(unsafe.Pointer(pCache)).FszSpill { + // Find a dirty page to write-out and recycle. First try to find a + // page that does not require a journal-sync (one with PGHDR_NEED_SYNC + // cleared), but if that is not possible settle for any other + // unreferenced dirty page. + // + // If the LRU page in the dirty list that has a clear PGHDR_NEED_SYNC + // flag is currently referenced, then the following may leave pSynced + // set incorrectly (pointing to other than the LRU page with NEED_SYNC + // cleared). This is Ok, as pSynced is just an optimization. + for pPg = (*PCache)(unsafe.Pointer(pCache)).FpSynced; (pPg != 0) && (((*PgHdr)(unsafe.Pointer(pPg)).FnRef != 0) || ((int32((*PgHdr)(unsafe.Pointer(pPg)).Fflags) & PGHDR_NEED_SYNC) != 0)); pPg = (*PgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev { + } + (*PCache)(unsafe.Pointer(pCache)).FpSynced = pPg + if !(pPg != 0) { + for pPg = (*PCache)(unsafe.Pointer(pCache)).FpDirtyTail; (pPg != 0) && ((*PgHdr)(unsafe.Pointer(pPg)).FnRef != 0); pPg = (*PgHdr)(unsafe.Pointer(pPg)).FpDirtyPrev { + } + } + if pPg != 0 { + var rc int32 + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pCache + 48 /* &.xStress */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpStress, pPg) + + if (rc != SQLITE_OK) && (rc != SQLITE_BUSY) { + return rc + } + } + } + *(*uintptr)(unsafe.Pointer(ppPage)) = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 56 /* &.xFetch */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache, pgno, 2) + if *(*uintptr)(unsafe.Pointer(ppPage)) == uintptr(0) { + return SQLITE_NOMEM + } + return SQLITE_OK +} + +// This is a helper routine for sqlite3PcacheFetchFinish() +// +// In the uncommon case where the page being fetched has not been +// initialized, this routine is invoked to do the initialization. +// This routine is broken out into a separate function since it +// requires extra stack manipulation that can be avoided in the common +// case. +func pcacheFetchFinishWithInit(tls *libc.TLS, pCache uintptr, pgno Pgno, pPage uintptr) uintptr { /* sqlite3.c:50273:30: */ + var pPgHdr uintptr + + pPgHdr = (*Sqlite3_pcache_page)(unsafe.Pointer(pPage)).FpExtra + + libc.Xmemset(tls, (pPgHdr + 32 /* &.pDirty */), 0, (uint64(unsafe.Sizeof(PgHdr{})) - (uint64((uintptr(0) + 32 /* &.pDirty */))))) + (*PgHdr)(unsafe.Pointer(pPgHdr)).FpPage = pPage + (*PgHdr)(unsafe.Pointer(pPgHdr)).FpData = (*Sqlite3_pcache_page)(unsafe.Pointer(pPage)).FpBuf + (*PgHdr)(unsafe.Pointer(pPgHdr)).FpExtra = (pPgHdr + 1*72) + libc.Xmemset(tls, (*PgHdr)(unsafe.Pointer(pPgHdr)).FpExtra, 0, uint64(8)) + (*PgHdr)(unsafe.Pointer(pPgHdr)).FpCache = pCache + (*PgHdr)(unsafe.Pointer(pPgHdr)).Fpgno = pgno + (*PgHdr)(unsafe.Pointer(pPgHdr)).Fflags = U16(PGHDR_CLEAN) + return Xsqlite3PcacheFetchFinish(tls, pCache, pgno, pPage) +} + +// This routine converts the sqlite3_pcache_page object returned by +// sqlite3PcacheFetch() into an initialized PgHdr object. This routine +// must be called after sqlite3PcacheFetch() in order to get a usable +// result. +func Xsqlite3PcacheFetchFinish(tls *libc.TLS, pCache uintptr, pgno Pgno, pPage uintptr) uintptr { /* sqlite3.c:50299:22: */ + var pPgHdr uintptr + + pPgHdr = (*Sqlite3_pcache_page)(unsafe.Pointer(pPage)).FpExtra + + if !(int32((*PgHdr)(unsafe.Pointer(pPgHdr)).FpPage) != 0) { + return pcacheFetchFinishWithInit(tls, pCache, pgno, pPage) + } + (*PCache)(unsafe.Pointer(pCache)).FnRefSum++ + (*PgHdr)(unsafe.Pointer(pPgHdr)).FnRef++ + + return pPgHdr +} + +// Decrement the reference count on a page. If the page is clean and the +// reference count drops to 0, then it is made eligible for recycling. +func Xsqlite3PcacheRelease(tls *libc.TLS, p uintptr) { /* sqlite3.c:50322:37: */ + + (*PCache)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum-- + if (int32(libc.PreDecInt16(&(*PgHdr)(unsafe.Pointer(p)).FnRef, 1))) == 0 { + if (int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & PGHDR_CLEAN) != 0 { + pcacheUnpin(tls, p) + } else { + pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_FRONT)) + } + } +} + +// Increase the reference count of a supplied page by 1. +func Xsqlite3PcacheRef(tls *libc.TLS, p uintptr) { /* sqlite3.c:50337:21: */ + + (*PgHdr)(unsafe.Pointer(p)).FnRef++ + (*PCache)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum++ +} + +// Drop a page from the cache. There must be exactly one reference to the +// page. This function deletes that reference, so after it returns the +// page pointed to by p is invalid. +func Xsqlite3PcacheDrop(tls *libc.TLS, p uintptr) { /* sqlite3.c:50349:21: */ + + if (int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & PGHDR_DIRTY) != 0 { + pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_REMOVE)) + } + (*PCache)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(p)).FpCache)).FnRefSum-- + (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 64 /* &.xUnpin */))))(tls, (*PCache)(unsafe.Pointer((*PgHdr)(unsafe.Pointer(p)).FpCache)).FpCache, (*PgHdr)(unsafe.Pointer(p)).FpPage, 1) +} + +// Make sure the page is marked as dirty. If it isn't dirty already, +// make it so. +func Xsqlite3PcacheMakeDirty(tls *libc.TLS, p uintptr) { /* sqlite3.c:50363:21: */ + + if (int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & (PGHDR_CLEAN | PGHDR_DONT_WRITE)) != 0 { //OPTIMIZATION-IF-FALSE + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(PGHDR_DONT_WRITE))) + if (int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & PGHDR_CLEAN) != 0 { + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) ^= U16((PGHDR_DIRTY | PGHDR_CLEAN)) + + pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_ADD)) + } + + } +} + +// Make sure the page is marked as clean. If it isn't clean already, +// make it so. +func Xsqlite3PcacheMakeClean(tls *libc.TLS, p uintptr) { /* sqlite3.c:50382:21: */ + + pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_REMOVE)) + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((PGHDR_DIRTY | PGHDR_NEED_SYNC) | PGHDR_WRITEABLE)))) + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) |= U16((PGHDR_CLEAN)) + + if int32((*PgHdr)(unsafe.Pointer(p)).FnRef) == 0 { + pcacheUnpin(tls, p) + } +} + +// Make every page in the cache clean. +func Xsqlite3PcacheCleanAll(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:50399:21: */ + var p uintptr + + for (libc.AssignUintptr(&p, (*PCache)(unsafe.Pointer(pCache)).FpDirty)) != uintptr(0) { + Xsqlite3PcacheMakeClean(tls, p) + } +} + +// Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages. +func Xsqlite3PcacheClearWritable(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:50410:21: */ + var p uintptr + + for p = (*PCache)(unsafe.Pointer(pCache)).FpDirty; p != 0; p = (*PgHdr)(unsafe.Pointer(p)).FpDirtyNext { + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32((PGHDR_NEED_SYNC | PGHDR_WRITEABLE)))) + } + (*PCache)(unsafe.Pointer(pCache)).FpSynced = (*PCache)(unsafe.Pointer(pCache)).FpDirtyTail +} + +// Clear the PGHDR_NEED_SYNC flag from all dirty pages. +func Xsqlite3PcacheClearSyncFlags(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:50422:21: */ + var p uintptr + for p = (*PCache)(unsafe.Pointer(pCache)).FpDirty; p != 0; p = (*PgHdr)(unsafe.Pointer(p)).FpDirtyNext { + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(PGHDR_NEED_SYNC))) + } + (*PCache)(unsafe.Pointer(pCache)).FpSynced = (*PCache)(unsafe.Pointer(pCache)).FpDirtyTail +} + +// Change the page number of page p to newPgno. +func Xsqlite3PcacheMove(tls *libc.TLS, p uintptr, newPgno Pgno) { /* sqlite3.c:50433:21: */ + var pCache uintptr = (*PgHdr)(unsafe.Pointer(p)).FpCache + + (*(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 72 /* &.xRekey */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache, (*PgHdr)(unsafe.Pointer(p)).FpPage, (*PgHdr)(unsafe.Pointer(p)).Fpgno, newPgno) + (*PgHdr)(unsafe.Pointer(p)).Fpgno = newPgno + if ((int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & PGHDR_DIRTY) != 0) && ((int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & PGHDR_NEED_SYNC) != 0) { + pcacheManageDirtyList(tls, p, uint8(PCACHE_DIRTYLIST_FRONT)) + } +} + +// Drop every cache entry whose page number is greater than "pgno". The +// caller must ensure that there are no outstanding references to any pages +// other than page 1 with a page number greater than pgno. +// +// If there is a reference to page 1 and the pgno parameter passed to this +// function is 0, then the data area associated with page 1 is zeroed, but +// the page object is not dropped. +func Xsqlite3PcacheTruncate(tls *libc.TLS, pCache uintptr, pgno Pgno) { /* sqlite3.c:50455:21: */ + if (*PCache)(unsafe.Pointer(pCache)).FpCache != 0 { + var p uintptr + var pNext uintptr + + for p = (*PCache)(unsafe.Pointer(pCache)).FpDirty; p != 0; p = pNext { + pNext = (*PgHdr)(unsafe.Pointer(p)).FpDirtyNext + // This routine never gets call with a positive pgno except right + // after sqlite3PcacheCleanAll(). So if there are dirty pages, + // it must be that pgno==0. + + if (*PgHdr)(unsafe.Pointer(p)).Fpgno > pgno { + + Xsqlite3PcacheMakeClean(tls, p) + } + } + if (pgno == Pgno(0)) && ((*PCache)(unsafe.Pointer(pCache)).FnRefSum != 0) { + var pPage1 uintptr + pPage1 = (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 56 /* &.xFetch */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache, uint32(1), 0) + if pPage1 != 0 { // Page 1 is always available in cache, because + // pCache->nRefSum>0 + libc.Xmemset(tls, (*Sqlite3_pcache_page)(unsafe.Pointer(pPage1)).FpBuf, 0, uint64((*PCache)(unsafe.Pointer(pCache)).FszPage)) + pgno = Pgno(1) + } + } + (*(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 80 /* &.xTruncate */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache, (pgno + Pgno(1))) + } +} + +// Close a cache. +func Xsqlite3PcacheClose(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:50488:21: */ + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 88 /* &.xDestroy */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache) +} + +// Discard the contents of the cache. +func Xsqlite3PcacheClear(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:50497:21: */ + Xsqlite3PcacheTruncate(tls, pCache, uint32(0)) +} + +// Merge two lists of pages connected by pDirty and in pgno order. +// Do not bother fixing the pDirtyPrev pointers. +func pcacheMergeDirtyList(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* sqlite3.c:50505:14: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var result PgHdr at bp, 72 + + var pTail uintptr + pTail = bp /* &result */ + + for { + if (*PgHdr)(unsafe.Pointer(pA)).Fpgno < (*PgHdr)(unsafe.Pointer(pB)).Fpgno { + (*PgHdr)(unsafe.Pointer(pTail)).FpDirty = pA + pTail = pA + pA = (*PgHdr)(unsafe.Pointer(pA)).FpDirty + if pA == uintptr(0) { + (*PgHdr)(unsafe.Pointer(pTail)).FpDirty = pB + break + } + } else { + (*PgHdr)(unsafe.Pointer(pTail)).FpDirty = pB + pTail = pB + pB = (*PgHdr)(unsafe.Pointer(pB)).FpDirty + if pB == uintptr(0) { + (*PgHdr)(unsafe.Pointer(pTail)).FpDirty = pA + break + } + } + } + return (*PgHdr)(unsafe.Pointer(bp /* &result */)).FpDirty +} + +// Sort the list of pages in accending order by pgno. Pages are +// connected by pDirty pointers. The pDirtyPrev pointers are +// corrupted by this sort. +// +// Since there cannot be more than 2^31 distinct pages in a database, +// there cannot be more than 31 buckets required by the merge sorter. +// One extra bucket is added to catch overflow in case something +// ever changes to make the previous sentence incorrect. +func pcacheSortDirtyList(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:50542:14: */ + bp := tls.Alloc(256) + defer tls.Free(256) + + // var a [32]uintptr at bp, 256 + + var p uintptr + var i int32 + libc.Xmemset(tls, bp /* &a[0] */, 0, uint64(unsafe.Sizeof([32]uintptr{}))) + for pIn != 0 { + p = pIn + pIn = (*PgHdr)(unsafe.Pointer(p)).FpDirty + (*PgHdr)(unsafe.Pointer(p)).FpDirty = uintptr(0) + for i = 0; i < (N_SORT_BUCKET - 1); i++ { + if *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = p + break + } else { + p = pcacheMergeDirtyList(tls, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)), p) + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = uintptr(0) + } + } + if i == (N_SORT_BUCKET - 1) { + // To get here, there need to be 2^(N_SORT_BUCKET) elements in + // the input list. But that is impossible. + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = pcacheMergeDirtyList(tls, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)), p) + } + } + p = *(*uintptr)(unsafe.Pointer(bp /* &a[0] */)) + for i = 1; i < N_SORT_BUCKET; i++ { + if *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) == uintptr(0) { + continue + } + if p != 0 { + p = pcacheMergeDirtyList(tls, p, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8))) + } else { + p = *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) + } + } + return p +} + +// Return a list of all dirty pages in the cache, sorted by page number. +func Xsqlite3PcacheDirtyList(tls *libc.TLS, pCache uintptr) uintptr { /* sqlite3.c:50577:22: */ + var p uintptr + for p = (*PCache)(unsafe.Pointer(pCache)).FpDirty; p != 0; p = (*PgHdr)(unsafe.Pointer(p)).FpDirtyNext { + (*PgHdr)(unsafe.Pointer(p)).FpDirty = (*PgHdr)(unsafe.Pointer(p)).FpDirtyNext + } + return pcacheSortDirtyList(tls, (*PCache)(unsafe.Pointer(pCache)).FpDirty) +} + +// Return the total number of references to all pages held by the cache. +// +// This is not the total number of pages referenced, but the sum of the +// reference count for all pages. +func Xsqlite3PcacheRefCount(tls *libc.TLS, pCache uintptr) int32 { /* sqlite3.c:50591:20: */ + return (*PCache)(unsafe.Pointer(pCache)).FnRefSum +} + +// Return the number of references to the page supplied as an argument. +func Xsqlite3PcachePageRefcount(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:50598:20: */ + return int32((*PgHdr)(unsafe.Pointer(p)).FnRef) +} + +// Return the total number of pages in the cache. +func Xsqlite3PcachePagecount(tls *libc.TLS, pCache uintptr) int32 { /* sqlite3.c:50605:20: */ + + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 48 /* &.xPagecount */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache) +} + +// Set the suggested cache-size value. +func Xsqlite3PcacheSetCachesize(tls *libc.TLS, pCache uintptr, mxPage int32) { /* sqlite3.c:50622:21: */ + + (*PCache)(unsafe.Pointer(pCache)).FszCache = mxPage + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 40 /* &.xCachesize */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache, + numberOfCachePages(tls, pCache)) +} + +// Set the suggested cache-spill value. Make no changes if if the +// argument is zero. Return the effective cache-spill size, which will +// be the larger of the szSpill and szCache. +func Xsqlite3PcacheSetSpillsize(tls *libc.TLS, p uintptr, mxPage int32) int32 { /* sqlite3.c:50634:20: */ + var res int32 + + if mxPage != 0 { + if mxPage < 0 { + mxPage = (int32((int64(-1024) * I64(mxPage)) / (I64((*PCache)(unsafe.Pointer(p)).FszPage + (*PCache)(unsafe.Pointer(p)).FszExtra)))) + } + (*PCache)(unsafe.Pointer(p)).FszSpill = mxPage + } + res = numberOfCachePages(tls, p) + if res < (*PCache)(unsafe.Pointer(p)).FszSpill { + res = (*PCache)(unsafe.Pointer(p)).FszSpill + } + return res +} + +// Free up as much memory as possible from the page cache. +func Xsqlite3PcacheShrink(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:50651:21: */ + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3Config)) + 168 /* &.pcache2 */ + 96 /* &.xShrink */))))(tls, (*PCache)(unsafe.Pointer(pCache)).FpCache) +} + +// Return the size of the header added by this middleware layer +// in the page-cache hierarchy. +func Xsqlite3HeaderSizePcache(tls *libc.TLS) int32 { /* sqlite3.c:50660:20: */ + return (int32(((uint64(unsafe.Sizeof(PgHdr{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) +} + +// Return the number of dirty pages currently in the cache, as a percentage +// of the configured cache size. +func Xsqlite3PCachePercentDirty(tls *libc.TLS, pCache uintptr) int32 { /* sqlite3.c:50666:20: */ + var pDirty uintptr + var nDirty int32 = 0 + var nCache int32 = numberOfCachePages(tls, pCache) + for pDirty = (*PCache)(unsafe.Pointer(pCache)).FpDirty; pDirty != 0; pDirty = (*PgHdr)(unsafe.Pointer(pDirty)).FpDirtyNext { + nDirty++ + } + if nCache != 0 { + return (int32((I64(nDirty) * int64(100)) / I64(nCache))) + } + return 0 +} + +//************* End of pcache.c ********************************************* +//************* Begin file pcache1.c **************************************** +// 2008 November 05 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements the default page cache implementation (the +// sqlite3_pcache interface). It also contains part of the implementation +// of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. +// If the default page cache implementation is overridden, then neither of +// these two features are available. +// +// A Page cache line looks like this: +// +// ------------------------------------------------------------- +// | database page content | PgHdr1 | MemPage | PgHdr | +// ------------------------------------------------------------- +// +// The database page content is up front (so that buffer overreads tend to +// flow harmlessly into the PgHdr1, MemPage, and PgHdr extensions). MemPage +// is the extension added by the btree.c module containing information such +// as the database page number and how that database page is used. PgHdr +// is added by the pcache.c layer and contains information used to keep track +// of which pages are "dirty". PgHdr1 is an extension added by this +// module (pcache1.c). The PgHdr1 header is a subclass of sqlite3_pcache_page. +// PgHdr1 contains information needed to look up a page by its page number. +// The superclass sqlite3_pcache_page.pBuf points to the start of the +// database page content and sqlite3_pcache_page.pExtra points to PgHdr. +// +// The size of the extension (MemPage+PgHdr+PgHdr1) can be determined at +// runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The +// sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this +// size can vary according to architecture, compile-time options, and +// SQLite library version number. +// +// If SQLITE_PCACHE_SEPARATE_HEADER is defined, then the extension is obtained +// using a separate memory allocation from the database page content. This +// seeks to overcome the "clownshoe" problem (also called "internal +// fragmentation" in academic literature) of allocating a few bytes more +// than a power of two with the memory allocator rounding up to the next +// power of two, and leaving the rounded-up space unused. +// +// This module tracks pointers to PgHdr1 objects. Only pcache.c communicates +// with this module. Information is passed back and forth as PgHdr1 pointers. +// +// The pcache.c and pager.c modules deal pointers to PgHdr objects. +// The btree.c module deals with pointers to MemPage objects. +// +// SOURCE OF PAGE CACHE MEMORY: +// +// Memory for a page might come from any of three sources: +// +// (1) The general-purpose memory allocator - sqlite3Malloc() +// (2) Global page-cache memory provided using sqlite3_config() with +// SQLITE_CONFIG_PAGECACHE. +// (3) PCache-local bulk allocation. +// +// The third case is a chunk of heap memory (defaulting to 100 pages worth) +// that is allocated when the page cache is created. The size of the local +// bulk allocation can be adjusted using +// +// sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N). +// +// If N is positive, then N pages worth of memory are allocated using a single +// sqlite3Malloc() call and that memory is used for the first N pages allocated. +// Or if N is negative, then -1024*N bytes of memory are allocated and used +// for as many pages as can be accomodated. +// +// Only one of (2) or (3) can be used. Once the memory available to (2) or +// (3) is exhausted, subsequent allocations fail over to the general-purpose +// memory allocator (1). +// +// Earlier versions of SQLite used only methods (1) and (2). But experiments +// show that method (3) with N==100 provides about a 5% performance boost for +// common workloads. +// #include "sqliteInt.h" + +type PCache11 = struct { + FpGroup uintptr + FpnPurgeable uintptr + FszPage int32 + FszExtra int32 + FszAlloc int32 + FbPurgeable int32 + FnMin uint32 + FnMax uint32 + Fn90pct uint32 + FiMaxKey uint32 + FnPurgeableDummy uint32 + FnRecyclable uint32 + FnPage uint32 + FnHash uint32 + FapHash uintptr + FpFree uintptr + FpBulk uintptr +} /* sqlite3.c:50783:9 */ + +//************* End of pcache.c ********************************************* +//************* Begin file pcache1.c **************************************** +// 2008 November 05 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements the default page cache implementation (the +// sqlite3_pcache interface). It also contains part of the implementation +// of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. +// If the default page cache implementation is overridden, then neither of +// these two features are available. +// +// A Page cache line looks like this: +// +// ------------------------------------------------------------- +// | database page content | PgHdr1 | MemPage | PgHdr | +// ------------------------------------------------------------- +// +// The database page content is up front (so that buffer overreads tend to +// flow harmlessly into the PgHdr1, MemPage, and PgHdr extensions). MemPage +// is the extension added by the btree.c module containing information such +// as the database page number and how that database page is used. PgHdr +// is added by the pcache.c layer and contains information used to keep track +// of which pages are "dirty". PgHdr1 is an extension added by this +// module (pcache1.c). The PgHdr1 header is a subclass of sqlite3_pcache_page. +// PgHdr1 contains information needed to look up a page by its page number. +// The superclass sqlite3_pcache_page.pBuf points to the start of the +// database page content and sqlite3_pcache_page.pExtra points to PgHdr. +// +// The size of the extension (MemPage+PgHdr+PgHdr1) can be determined at +// runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size). The +// sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this +// size can vary according to architecture, compile-time options, and +// SQLite library version number. +// +// If SQLITE_PCACHE_SEPARATE_HEADER is defined, then the extension is obtained +// using a separate memory allocation from the database page content. This +// seeks to overcome the "clownshoe" problem (also called "internal +// fragmentation" in academic literature) of allocating a few bytes more +// than a power of two with the memory allocator rounding up to the next +// power of two, and leaving the rounded-up space unused. +// +// This module tracks pointers to PgHdr1 objects. Only pcache.c communicates +// with this module. Information is passed back and forth as PgHdr1 pointers. +// +// The pcache.c and pager.c modules deal pointers to PgHdr objects. +// The btree.c module deals with pointers to MemPage objects. +// +// SOURCE OF PAGE CACHE MEMORY: +// +// Memory for a page might come from any of three sources: +// +// (1) The general-purpose memory allocator - sqlite3Malloc() +// (2) Global page-cache memory provided using sqlite3_config() with +// SQLITE_CONFIG_PAGECACHE. +// (3) PCache-local bulk allocation. +// +// The third case is a chunk of heap memory (defaulting to 100 pages worth) +// that is allocated when the page cache is created. The size of the local +// bulk allocation can be adjusted using +// +// sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N). +// +// If N is positive, then N pages worth of memory are allocated using a single +// sqlite3Malloc() call and that memory is used for the first N pages allocated. +// Or if N is negative, then -1024*N bytes of memory are allocated and used +// for as many pages as can be accomodated. +// +// Only one of (2) or (3) can be used. Once the memory available to (2) or +// (3) is exhausted, subsequent allocations fail over to the general-purpose +// memory allocator (1). +// +// Earlier versions of SQLite used only methods (1) and (2). But experiments +// show that method (3) with N==100 provides about a 5% performance boost for +// common workloads. +// #include "sqliteInt.h" + +type PCache1 = PCache11 /* sqlite3.c:50783:24 */ +type PgHdr11 = struct { + Fpage Sqlite3_pcache_page + FiKey uint32 + FisBulkLocal U16 + FisAnchor U16 + FpNext uintptr + FpCache uintptr + FpLruNext uintptr + FpLruPrev uintptr +} /* sqlite3.c:50783:9 */ + +type PgHdr1 = PgHdr11 /* sqlite3.c:50784:23 */ +type PgFreeslot1 = struct{ FpNext uintptr } /* sqlite3.c:50785:9 */ + +type PgFreeslot = PgFreeslot1 /* sqlite3.c:50785:27 */ +type PGroup1 = struct { + Fmutex uintptr + FnMaxPage uint32 + FnMinPage uint32 + FmxPinned uint32 + FnPurgeable uint32 + Flru PgHdr1 +} /* sqlite3.c:50783:9 */ + +type PGroup = PGroup1 /* sqlite3.c:50786:23 */ + +// Global data used by this cache. +type PCacheGlobal = struct { + Fgrp PGroup + FisInit int32 + FseparateCache int32 + FnInitPage int32 + FszSlot int32 + FnSlot int32 + FnReserve int32 + FpStart uintptr + FpEnd uintptr + Fmutex uintptr + FpFree uintptr + FnFreeSlot int32 + FbUnderPressure int32 +} /* sqlite3.c:50903:19 */ + +// Global data used by this cache. +var pcache1_g PCacheGlobal /* sqlite3.c:50927:3: */ + +// All code in this file should access the global structure above via the +// alias "pcache1". This ensures that the WSD emulation is used when +// compiling for systems that do not support real WSD. + +// Macros to enter and leave the PCache LRU mutex. + +//**************************************************************************** +//******* Page Allocation/SQLITE_CONFIG_PCACHE Related Functions ************* + +// This function is called during initialization if a static buffer is +// supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE +// verb to sqlite3_config(). Parameter pBuf points to an allocation large +// enough to contain 'n' buffers of 'sz' bytes each. +// +// This routine is called from sqlite3_initialize() and so it is guaranteed +// to be serialized already. There is no need for further mutexing. +func Xsqlite3PCacheBufferSetup(tls *libc.TLS, pBuf uintptr, sz int32, n int32) { /* sqlite3.c:50962:21: */ + if pcache1_g.FisInit != 0 { + var p uintptr + if pBuf == uintptr(0) { + sz = libc.AssignInt32(&n, 0) + } + if n == 0 { + sz = 0 + } + sz = ((sz) & libc.CplInt32(7)) + pcache1_g.FszSlot = sz + pcache1_g.FnSlot = libc.AssignPtrInt32(uintptr(unsafe.Pointer(&pcache1_g))+136 /* &.nFreeSlot */, n) + pcache1_g.FnReserve = func() int32 { + if n > 90 { + return 10 + } + return ((n / 10) + 1) + }() + pcache1_g.FpStart = pBuf + pcache1_g.FpFree = uintptr(0) + pcache1_g.FbUnderPressure = 0 + for libc.PostDecInt32(&n, 1) != 0 { + p = pBuf + (*PgFreeslot)(unsafe.Pointer(p)).FpNext = pcache1_g.FpFree + pcache1_g.FpFree = p + pBuf = ((pBuf) + uintptr(sz)) + } + pcache1_g.FpEnd = pBuf + } +} + +// Try to initialize the pCache->pFree and pCache->pBulk fields. Return +// true if pCache->pFree ends up containing one or more free pages. +func pcache1InitBulk(tls *libc.TLS, pCache uintptr) int32 { /* sqlite3.c:50988:12: */ + var szBulk I64 + var zBulk uintptr + if pcache1_g.FnInitPage == 0 { + return 0 + } + // Do not bother with a bulk allocation if the cache size very small + if (*PCache1)(unsafe.Pointer(pCache)).FnMax < uint32(3) { + return 0 + } + Xsqlite3BeginBenignMalloc(tls) + if pcache1_g.FnInitPage > 0 { + szBulk = (I64((*PCache1)(unsafe.Pointer(pCache)).FszAlloc) * I64(pcache1_g.FnInitPage)) + } else { + szBulk = (int64(-1024) * I64(pcache1_g.FnInitPage)) + } + if szBulk > (I64((*PCache1)(unsafe.Pointer(pCache)).FszAlloc) * I64((*PCache1)(unsafe.Pointer(pCache)).FnMax)) { + szBulk = (I64((*PCache1)(unsafe.Pointer(pCache)).FszAlloc) * I64((*PCache1)(unsafe.Pointer(pCache)).FnMax)) + } + zBulk = libc.AssignPtrUintptr(pCache+80 /* &.pBulk */, Xsqlite3Malloc(tls, uint64(szBulk))) + Xsqlite3EndBenignMalloc(tls) + if zBulk != 0 { + var nBulk int32 = (Xsqlite3MallocSize(tls, zBulk) / (*PCache1)(unsafe.Pointer(pCache)).FszAlloc) + for ok := true; ok; ok = libc.PreDecInt32(&nBulk, 1) != 0 { + var pX uintptr = (zBulk + uintptr((*PCache1)(unsafe.Pointer(pCache)).FszPage)) + (*PgHdr1)(unsafe.Pointer(pX)).Fpage.FpBuf = zBulk + (*PgHdr1)(unsafe.Pointer(pX)).Fpage.FpExtra = (pX + 1*56) + (*PgHdr1)(unsafe.Pointer(pX)).FisBulkLocal = U16(1) + (*PgHdr1)(unsafe.Pointer(pX)).FisAnchor = U16(0) + (*PgHdr1)(unsafe.Pointer(pX)).FpNext = (*PCache1)(unsafe.Pointer(pCache)).FpFree + (*PgHdr1)(unsafe.Pointer(pX)).FpLruPrev = uintptr(0) // Initializing this saves a valgrind error + (*PCache1)(unsafe.Pointer(pCache)).FpFree = pX + zBulk += uintptr((*PCache1)(unsafe.Pointer(pCache)).FszAlloc) + } + } + return (libc.Bool32((*PCache1)(unsafe.Pointer(pCache)).FpFree != uintptr(0))) +} + +// Malloc function used within this file to allocate space from the buffer +// configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no +// such buffer exists or there is no space left in it, this function falls +// back to sqlite3Malloc(). +// +// Multiple threads can run this routine at the same time. Global variables +// in pcache1 need to be protected via mutex. +func pcache1Alloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:51031:13: */ + var p uintptr = uintptr(0) + + if nByte <= pcache1_g.FszSlot { + Xsqlite3_mutex_enter(tls, pcache1_g.Fmutex) + p = pcache1_g.FpFree + if p != 0 { + pcache1_g.FpFree = (*PgFreeslot)(unsafe.Pointer(pcache1_g.FpFree)).FpNext + pcache1_g.FnFreeSlot-- + pcache1_g.FbUnderPressure = (libc.Bool32(pcache1_g.FnFreeSlot < pcache1_g.FnReserve)) + + Xsqlite3StatusHighwater(tls, SQLITE_STATUS_PAGECACHE_SIZE, nByte) + Xsqlite3StatusUp(tls, SQLITE_STATUS_PAGECACHE_USED, 1) + } + Xsqlite3_mutex_leave(tls, pcache1_g.Fmutex) + } + if p == uintptr(0) { + // Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get + // it from sqlite3Malloc instead. + p = Xsqlite3Malloc(tls, uint64(nByte)) + if p != 0 { + var sz int32 = Xsqlite3MallocSize(tls, p) + Xsqlite3_mutex_enter(tls, pcache1_g.Fmutex) + Xsqlite3StatusHighwater(tls, SQLITE_STATUS_PAGECACHE_SIZE, nByte) + Xsqlite3StatusUp(tls, SQLITE_STATUS_PAGECACHE_OVERFLOW, sz) + Xsqlite3_mutex_leave(tls, pcache1_g.Fmutex) + } + + } + return p +} + +// Free an allocated buffer obtained from pcache1Alloc(). +func pcache1Free(tls *libc.TLS, p uintptr) { /* sqlite3.c:51069:13: */ + if p == uintptr(0) { + return + } + if (Uptr((p)) >= Uptr((pcache1_g.FpStart))) && (Uptr((p)) < Uptr((pcache1_g.FpEnd))) { + var pSlot uintptr + Xsqlite3_mutex_enter(tls, pcache1_g.Fmutex) + Xsqlite3StatusDown(tls, SQLITE_STATUS_PAGECACHE_USED, 1) + pSlot = p + (*PgFreeslot)(unsafe.Pointer(pSlot)).FpNext = pcache1_g.FpFree + pcache1_g.FpFree = pSlot + pcache1_g.FnFreeSlot++ + pcache1_g.FbUnderPressure = (libc.Bool32(pcache1_g.FnFreeSlot < pcache1_g.FnReserve)) + + Xsqlite3_mutex_leave(tls, pcache1_g.Fmutex) + } else { + + { + var nFreed int32 = 0 + nFreed = Xsqlite3MallocSize(tls, p) + Xsqlite3_mutex_enter(tls, pcache1_g.Fmutex) + Xsqlite3StatusDown(tls, SQLITE_STATUS_PAGECACHE_OVERFLOW, nFreed) + Xsqlite3_mutex_leave(tls, pcache1_g.Fmutex) + + } + Xsqlite3_free(tls, p) + } +} + +// Return the size of a pcache allocation +func pcache1MemSize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:51102:12: */ + if (p >= pcache1_g.FpStart) && (p < pcache1_g.FpEnd) { + return pcache1_g.FszSlot + } else { + var iSize int32 + + iSize = Xsqlite3MallocSize(tls, p) + + return iSize + } + return int32(0) +} + +// Allocate a new page object initially associated with cache pCache. +func pcache1AllocPage(tls *libc.TLS, pCache uintptr, benignMalloc int32) uintptr { /* sqlite3.c:51119:15: */ + var p uintptr = uintptr(0) + var pPg uintptr + + if ((*PCache1)(unsafe.Pointer(pCache)).FpFree != 0) || (((*PCache1)(unsafe.Pointer(pCache)).FnPage == uint32(0)) && (pcache1InitBulk(tls, pCache) != 0)) { + + p = (*PCache1)(unsafe.Pointer(pCache)).FpFree + (*PCache1)(unsafe.Pointer(pCache)).FpFree = (*PgHdr1)(unsafe.Pointer(p)).FpNext + (*PgHdr1)(unsafe.Pointer(p)).FpNext = uintptr(0) + } else { + // The group mutex must be released before pcache1Alloc() is called. This + // is because it might call sqlite3_release_memory(), which assumes that + // this mutex is not held. + + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + if benignMalloc != 0 { + Xsqlite3BeginBenignMalloc(tls) + } + pPg = pcache1Alloc(tls, (*PCache1)(unsafe.Pointer(pCache)).FszAlloc) + if benignMalloc != 0 { + Xsqlite3EndBenignMalloc(tls) + } + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + if pPg == uintptr(0) { + return uintptr(0) + } + p = ((pPg) + uintptr((*PCache1)(unsafe.Pointer(pCache)).FszPage)) + (*PgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf = pPg + (*PgHdr1)(unsafe.Pointer(p)).Fpage.FpExtra = (p + 1*56) + (*PgHdr1)(unsafe.Pointer(p)).FisBulkLocal = U16(0) + (*PgHdr1)(unsafe.Pointer(p)).FisAnchor = U16(0) + (*PgHdr1)(unsafe.Pointer(p)).FpLruPrev = uintptr(0) // Initializing this saves a valgrind error + } + (*(*uint32)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpnPurgeable)))++ + return p +} + +// Free a page object allocated by pcache1AllocPage(). +func pcache1FreePage(tls *libc.TLS, p uintptr) { /* sqlite3.c:51171:13: */ + var pCache uintptr + + pCache = (*PgHdr1)(unsafe.Pointer(p)).FpCache + + if (*PgHdr1)(unsafe.Pointer(p)).FisBulkLocal != 0 { + (*PgHdr1)(unsafe.Pointer(p)).FpNext = (*PCache1)(unsafe.Pointer(pCache)).FpFree + (*PCache1)(unsafe.Pointer(pCache)).FpFree = p + } else { + pcache1Free(tls, (*PgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf) + } + (*(*uint32)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpnPurgeable)))-- +} + +// Malloc function used by SQLite to obtain space from the buffer configured +// using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer +// exists, this function falls back to sqlite3Malloc(). +func Xsqlite3PageMalloc(tls *libc.TLS, sz int32) uintptr { /* sqlite3.c:51193:21: */ + // These allocations are never very large + return pcache1Alloc(tls, sz) +} + +// Free an allocated buffer obtained from sqlite3PageMalloc(). +func Xsqlite3PageFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:51201:21: */ + pcache1Free(tls, p) +} + +// Return true if it desirable to avoid allocating a new page cache +// entry. +// +// If memory was allocated specifically to the page cache using +// SQLITE_CONFIG_PAGECACHE but that memory has all been used, then +// it is desirable to avoid allocating a new page cache entry because +// presumably SQLITE_CONFIG_PAGECACHE was suppose to be sufficient +// for all page cache needs and we should not need to spill the +// allocation onto the heap. +// +// Or, the heap is used for all page cache memory but the heap is +// under memory pressure, then again it is desirable to avoid +// allocating a new page cache entry in order to avoid stressing +// the heap even further. +func pcache1UnderMemoryPressure(tls *libc.TLS, pCache uintptr) int32 { /* sqlite3.c:51222:12: */ + if (pcache1_g.FnSlot != 0) && (((*PCache1)(unsafe.Pointer(pCache)).FszPage + (*PCache1)(unsafe.Pointer(pCache)).FszExtra) <= pcache1_g.FszSlot) { + return pcache1_g.FbUnderPressure + } else { + return Xsqlite3HeapNearlyFull(tls) + } + return int32(0) +} + +//**************************************************************************** +//******* General Implementation Functions *********************************** + +// This function is used to resize the hash table used by the cache passed +// as the first argument. +// +// The PCache mutex must be held when this function is called. +func pcache1ResizeHash(tls *libc.TLS, p uintptr) { /* sqlite3.c:51239:13: */ + var apNew uintptr + var nNew uint32 + var i uint32 + + nNew = ((*PCache1)(unsafe.Pointer(p)).FnHash * uint32(2)) + if nNew < uint32(256) { + nNew = uint32(256) + } + + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(p)).FpGroup)).Fmutex) + if (*PCache1)(unsafe.Pointer(p)).FnHash != 0 { + Xsqlite3BeginBenignMalloc(tls) + } + apNew = Xsqlite3MallocZero(tls, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if (*PCache1)(unsafe.Pointer(p)).FnHash != 0 { + Xsqlite3EndBenignMalloc(tls) + } + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(p)).FpGroup)).Fmutex) + if apNew != 0 { + for i = uint32(0); i < (*PCache1)(unsafe.Pointer(p)).FnHash; i++ { + var pPage uintptr + var pNext uintptr = *(*uintptr)(unsafe.Pointer((*PCache1)(unsafe.Pointer(p)).FapHash + uintptr(i)*8)) + for (libc.AssignUintptr(&pPage, pNext)) != uintptr(0) { + var h uint32 = ((*PgHdr1)(unsafe.Pointer(pPage)).FiKey % nNew) + pNext = (*PgHdr1)(unsafe.Pointer(pPage)).FpNext + (*PgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(h)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(h)*8)) = pPage + } + } + Xsqlite3_free(tls, (*PCache1)(unsafe.Pointer(p)).FapHash) + (*PCache1)(unsafe.Pointer(p)).FapHash = apNew + (*PCache1)(unsafe.Pointer(p)).FnHash = nNew + } +} + +// This function is used internally to remove the page pPage from the +// PGroup LRU list, if is part of it. If pPage is not part of the PGroup +// LRU list, then this function is a no-op. +// +// The PGroup mutex must be held when this function is called. +func pcache1PinPage(tls *libc.TLS, pPage uintptr) uintptr { /* sqlite3.c:51280:15: */ + + (*PgHdr1)(unsafe.Pointer((*PgHdr1)(unsafe.Pointer(pPage)).FpLruPrev)).FpLruNext = (*PgHdr1)(unsafe.Pointer(pPage)).FpLruNext + (*PgHdr1)(unsafe.Pointer((*PgHdr1)(unsafe.Pointer(pPage)).FpLruNext)).FpLruPrev = (*PgHdr1)(unsafe.Pointer(pPage)).FpLruPrev + (*PgHdr1)(unsafe.Pointer(pPage)).FpLruNext = uintptr(0) + // pPage->pLruPrev = 0; + // No need to clear pLruPrev as it is never accessed if pLruNext is 0 + + (*PCache1)(unsafe.Pointer((*PgHdr1)(unsafe.Pointer(pPage)).FpCache)).FnRecyclable-- + return pPage +} + +// Remove the page supplied as an argument from the hash table +// (PCache1.apHash structure) that it is currently stored in. +// Also free the page if freePage is true. +// +// The PGroup mutex must be held when this function is called. +func pcache1RemoveFromHash(tls *libc.TLS, pPage uintptr, freeFlag int32) { /* sqlite3.c:51305:13: */ + var h uint32 + var pCache uintptr = (*PgHdr1)(unsafe.Pointer(pPage)).FpCache + var pp uintptr + + h = ((*PgHdr1)(unsafe.Pointer(pPage)).FiKey % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + for pp = ((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8); (*(*uintptr)(unsafe.Pointer(pp))) != pPage; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = (*PgHdr1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + + (*PCache1)(unsafe.Pointer(pCache)).FnPage-- + if freeFlag != 0 { + pcache1FreePage(tls, pPage) + } +} + +// If there are currently more than nMaxPage pages allocated, try +// to recycle pages to reduce the number allocated to nMaxPage. +func pcache1EnforceMaxPage(tls *libc.TLS, pCache uintptr) { /* sqlite3.c:51323:13: */ + var pGroup uintptr = (*PCache1)(unsafe.Pointer(pCache)).FpGroup + var p uintptr + + for ((*PGroup)(unsafe.Pointer(pGroup)).FnPurgeable > (*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage) && + (int32((*PgHdr1)(unsafe.Pointer((libc.AssignUintptr(&p, (*PGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev)))).FisAnchor) == 0) { + + pcache1PinPage(tls, p) + pcache1RemoveFromHash(tls, p, 1) + } + if ((*PCache1)(unsafe.Pointer(pCache)).FnPage == uint32(0)) && ((*PCache1)(unsafe.Pointer(pCache)).FpBulk != 0) { + Xsqlite3_free(tls, (*PCache1)(unsafe.Pointer(pCache)).FpBulk) + (*PCache1)(unsafe.Pointer(pCache)).FpBulk = libc.AssignPtrUintptr(pCache+72 /* &.pFree */, uintptr(0)) + } +} + +// Discard all pages from cache pCache with a page number (key value) +// greater than or equal to iLimit. Any pinned pages that meet this +// criteria are unpinned before they are discarded. +// +// The PCache mutex must be held when this function is called. +func pcache1TruncateUnsafe(tls *libc.TLS, pCache uintptr, iLimit uint32) { /* sqlite3.c:51348:13: */ + var h uint32 + var iStop uint32 + + if ((*PCache1)(unsafe.Pointer(pCache)).FiMaxKey - iLimit) < (*PCache1)(unsafe.Pointer(pCache)).FnHash { + // If we are just shaving the last few pages off the end of the + // cache, then there is no point in scanning the entire hash table. + // Only scan those hash slots that might contain pages that need to + // be removed. + h = (iLimit % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + iStop = ((*PCache1)(unsafe.Pointer(pCache)).FiMaxKey % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + + } else { + // This is the general case where many pages are being removed. + // It is necessary to scan the entire hash table + h = ((*PCache1)(unsafe.Pointer(pCache)).FnHash / uint32(2)) + iStop = (h - uint32(1)) + } + for { + var pp uintptr + var pPage uintptr + + pp = ((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8) + for (libc.AssignUintptr(&pPage, *(*uintptr)(unsafe.Pointer(pp)))) != uintptr(0) { + if (*PgHdr1)(unsafe.Pointer(pPage)).FiKey >= iLimit { + (*PCache1)(unsafe.Pointer(pCache)).FnPage-- + *(*uintptr)(unsafe.Pointer(pp)) = (*PgHdr1)(unsafe.Pointer(pPage)).FpNext + if (*PgHdr1)(unsafe.Pointer((pPage))).FpLruNext != uintptr(0) { + pcache1PinPage(tls, pPage) + } + pcache1FreePage(tls, pPage) + } else { + pp = (pPage + 24 /* &.pNext */) + + } + } + if h == iStop { + break + } + h = ((h + uint32(1)) % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + } + +} + +//**************************************************************************** +//******* sqlite3_pcache Methods ********************************************* + +// Implementation of the sqlite3_pcache.xInit method. +func pcache1Init(tls *libc.TLS, NotUsed uintptr) int32 { /* sqlite3.c:51399:12: */ + _ = NotUsed + + libc.Xmemset(tls, uintptr(unsafe.Pointer(&pcache1_g)), 0, uint64(unsafe.Sizeof(pcache1_g))) + + // The pcache1.separateCache variable is true if each PCache has its own + // private PGroup (mode-1). pcache1.separateCache is false if the single + // PGroup in pcache1.grp is used for all page caches (mode-2). + // + // * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT + // + // * Use a unified cache in single-threaded applications that have + // configured a start-time buffer for use as page-cache memory using + // sqlite3_config(SQLITE_CONFIG_PAGECACHE, pBuf, sz, N) with non-NULL + // pBuf argument. + // + // * Otherwise use separate caches (mode-1) + pcache1_g.FseparateCache = 0 + + if Xsqlite3Config.FbCoreMutex != 0 { + pcache1_g.Fgrp.Fmutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_LRU) + pcache1_g.Fmutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_PMEM) + } + if ((pcache1_g.FseparateCache != 0) && + (Xsqlite3Config.FnPage != 0)) && + (Xsqlite3Config.FpPage == uintptr(0)) { + pcache1_g.FnInitPage = Xsqlite3Config.FnPage + } else { + pcache1_g.FnInitPage = 0 + } + pcache1_g.Fgrp.FmxPinned = uint32(10) + pcache1_g.FisInit = 1 + return SQLITE_OK +} + +// Implementation of the sqlite3_pcache.xShutdown method. +// Note that the static mutex allocated in xInit does +// not need to be freed. +func pcache1Shutdown(tls *libc.TLS, NotUsed uintptr) { /* sqlite3.c:51452:13: */ + _ = NotUsed + + libc.Xmemset(tls, uintptr(unsafe.Pointer(&pcache1_g)), 0, uint64(unsafe.Sizeof(pcache1_g))) +} + +// Implementation of the sqlite3_pcache.xCreate method. +// +// Allocate a new cache. +func pcache1Create(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32) uintptr { /* sqlite3.c:51466:23: */ + var pCache uintptr // The newly created page cache + var pGroup uintptr // The group the new page cache will belong to + var sz int32 // Bytes of memory required to allocate the new cache + + sz = (int32(uint64(unsafe.Sizeof(PCache1{})) + (uint64(unsafe.Sizeof(PGroup{})) * uint64(pcache1_g.FseparateCache)))) + pCache = Xsqlite3MallocZero(tls, uint64(sz)) + if pCache != 0 { + if pcache1_g.FseparateCache != 0 { + pGroup = (pCache + 1*88) + (*PGroup)(unsafe.Pointer(pGroup)).FmxPinned = uint32(10) + } else { + pGroup = (uintptr(unsafe.Pointer(&pcache1_g)) /* &.grp */) + } + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + if int32((*PGroup)(unsafe.Pointer(pGroup)).Flru.FisAnchor) == 0 { + (*PGroup)(unsafe.Pointer(pGroup)).Flru.FisAnchor = U16(1) + (*PGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev = libc.AssignPtrUintptr(pGroup+24 /* &.lru */ +40 /* &.pLruNext */, (pGroup + 24 /* &.lru */)) + } + (*PCache1)(unsafe.Pointer(pCache)).FpGroup = pGroup + (*PCache1)(unsafe.Pointer(pCache)).FszPage = szPage + (*PCache1)(unsafe.Pointer(pCache)).FszExtra = szExtra + (*PCache1)(unsafe.Pointer(pCache)).FszAlloc = (int32((uint64(szPage + szExtra)) + (((uint64(unsafe.Sizeof(PgHdr1{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))))) + (*PCache1)(unsafe.Pointer(pCache)).FbPurgeable = func() int32 { + if bPurgeable != 0 { + return 1 + } + return 0 + }() + pcache1ResizeHash(tls, pCache) + if bPurgeable != 0 { + (*PCache1)(unsafe.Pointer(pCache)).FnMin = uint32(10) + *(*uint32)(unsafe.Pointer(pGroup + 12 /* &.nMinPage */)) += ((*PCache1)(unsafe.Pointer(pCache)).FnMin) + (*PGroup)(unsafe.Pointer(pGroup)).FmxPinned = (((*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10)) - (*PGroup)(unsafe.Pointer(pGroup)).FnMinPage) + (*PCache1)(unsafe.Pointer(pCache)).FpnPurgeable = (pGroup + 20 /* &.nPurgeable */) + } else { + (*PCache1)(unsafe.Pointer(pCache)).FpnPurgeable = (pCache + 48 /* &.nPurgeableDummy */) + } + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + if (*PCache1)(unsafe.Pointer(pCache)).FnHash == uint32(0) { + pcache1Destroy(tls, pCache) + pCache = uintptr(0) + } + } + return pCache +} + +// Implementation of the sqlite3_pcache.xCachesize method. +// +// Configure the cache_size limit for a cache. +func pcache1Cachesize(tls *libc.TLS, p uintptr, nMax int32) { /* sqlite3.c:51516:13: */ + var pCache uintptr = p + if (*PCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 { + var pGroup uintptr = (*PCache1)(unsafe.Pointer(pCache)).FpGroup + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + *(*uint32)(unsafe.Pointer(pGroup + 8 /* &.nMaxPage */)) += (uint32(nMax) - (*PCache1)(unsafe.Pointer(pCache)).FnMax) + (*PGroup)(unsafe.Pointer(pGroup)).FmxPinned = (((*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10)) - (*PGroup)(unsafe.Pointer(pGroup)).FnMinPage) + (*PCache1)(unsafe.Pointer(pCache)).FnMax = uint32(nMax) + (*PCache1)(unsafe.Pointer(pCache)).Fn90pct = (((*PCache1)(unsafe.Pointer(pCache)).FnMax * uint32(9)) / uint32(10)) + pcache1EnforceMaxPage(tls, pCache) + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + } +} + +// Implementation of the sqlite3_pcache.xShrink method. +// +// Free up as much memory as possible. +func pcache1Shrink(tls *libc.TLS, p uintptr) { /* sqlite3.c:51535:13: */ + var pCache uintptr = p + if (*PCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0 { + var pGroup uintptr = (*PCache1)(unsafe.Pointer(pCache)).FpGroup + var savedMaxPage int32 + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + savedMaxPage = int32((*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage) + (*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage = uint32(0) + pcache1EnforceMaxPage(tls, pCache) + (*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage = uint32(savedMaxPage) + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + } +} + +// Implementation of the sqlite3_pcache.xPagecount method. +func pcache1Pagecount(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:51552:12: */ + var n int32 + var pCache uintptr = p + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + n = int32((*PCache1)(unsafe.Pointer(pCache)).FnPage) + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + return n +} + +// Implement steps 3, 4, and 5 of the pcache1Fetch() algorithm described +// in the header of the pcache1Fetch() procedure. +// +// This steps are broken out into a separate procedure because they are +// usually not needed, and by avoiding the stack initialization required +// for these steps, the main pcache1Fetch() procedure can run faster. +func pcache1FetchStage2(tls *libc.TLS, pCache uintptr, iKey uint32, createFlag int32) uintptr { /* sqlite3.c:51570:31: */ + var nPinned uint32 + var pGroup uintptr = (*PCache1)(unsafe.Pointer(pCache)).FpGroup + var pPage uintptr = uintptr(0) + + // Step 3: Abort if createFlag is 1 but the cache is nearly full + + nPinned = ((*PCache1)(unsafe.Pointer(pCache)).FnPage - (*PCache1)(unsafe.Pointer(pCache)).FnRecyclable) + + if (createFlag == 1) && (((nPinned >= (*PGroup)(unsafe.Pointer(pGroup)).FmxPinned) || + (nPinned >= (*PCache1)(unsafe.Pointer(pCache)).Fn90pct)) || + ((pcache1UnderMemoryPressure(tls, pCache) != 0) && ((*PCache1)(unsafe.Pointer(pCache)).FnRecyclable < nPinned))) { + return uintptr(0) + } + + if (*PCache1)(unsafe.Pointer(pCache)).FnPage >= (*PCache1)(unsafe.Pointer(pCache)).FnHash { + pcache1ResizeHash(tls, pCache) + } + + // Step 4. Try to recycle a page. + if (((*PCache1)(unsafe.Pointer(pCache)).FbPurgeable != 0) && + !(int32((*PgHdr1)(unsafe.Pointer((*PGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev)).FisAnchor) != 0)) && + ((((*PCache1)(unsafe.Pointer(pCache)).FnPage + uint32(1)) >= (*PCache1)(unsafe.Pointer(pCache)).FnMax) || (pcache1UnderMemoryPressure(tls, pCache) != 0)) { + var pOther uintptr + pPage = (*PGroup)(unsafe.Pointer(pGroup)).Flru.FpLruPrev + + pcache1RemoveFromHash(tls, pPage, 0) + pcache1PinPage(tls, pPage) + pOther = (*PgHdr1)(unsafe.Pointer(pPage)).FpCache + if (*PCache1)(unsafe.Pointer(pOther)).FszAlloc != (*PCache1)(unsafe.Pointer(pCache)).FszAlloc { + pcache1FreePage(tls, pPage) + pPage = uintptr(0) + } else { + *(*uint32)(unsafe.Pointer(pGroup + 20 /* &.nPurgeable */)) -= (uint32((*PCache1)(unsafe.Pointer(pOther)).FbPurgeable - (*PCache1)(unsafe.Pointer(pCache)).FbPurgeable)) + } + } + + // Step 5. If a usable page buffer has still not been found, + // attempt to allocate a new one. + if !(pPage != 0) { + pPage = pcache1AllocPage(tls, pCache, (libc.Bool32(createFlag == 1))) + } + + if pPage != 0 { + var h uint32 = (iKey % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + (*PCache1)(unsafe.Pointer(pCache)).FnPage++ + (*PgHdr1)(unsafe.Pointer(pPage)).FiKey = iKey + (*PgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8)) + (*PgHdr1)(unsafe.Pointer(pPage)).FpCache = pCache + (*PgHdr1)(unsafe.Pointer(pPage)).FpLruNext = uintptr(0) + // pPage->pLruPrev = 0; + // No need to clear pLruPrev since it is not accessed when pLruNext==0 + *(*uintptr)(unsafe.Pointer((*PgHdr1)(unsafe.Pointer(pPage)).Fpage.FpExtra)) = uintptr(0) + *(*uintptr)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8)) = pPage + if iKey > (*PCache1)(unsafe.Pointer(pCache)).FiMaxKey { + (*PCache1)(unsafe.Pointer(pCache)).FiMaxKey = iKey + } + } + return pPage +} + +// Implementation of the sqlite3_pcache.xFetch method. +// +// Fetch a page by key value. +// +// Whether or not a new page may be allocated by this function depends on +// the value of the createFlag argument. 0 means do not allocate a new +// page. 1 means allocate a new page if space is easily available. 2 +// means to try really hard to allocate a new page. +// +// For a non-purgeable cache (a cache used as the storage for an in-memory +// database) there is really no difference between createFlag 1 and 2. So +// the calling function (pcache.c) will never have a createFlag of 1 on +// a non-purgeable cache. +// +// There are three different approaches to obtaining space for a page, +// depending on the value of parameter createFlag (which may be 0, 1 or 2). +// +// 1. Regardless of the value of createFlag, the cache is searched for a +// copy of the requested page. If one is found, it is returned. +// +// 2. If createFlag==0 and the page is not already in the cache, NULL is +// returned. +// +// 3. If createFlag is 1, and the page is not already in the cache, then +// return NULL (do not allocate a new page) if any of the following +// conditions are true: +// +// (a) the number of pages pinned by the cache is greater than +// PCache1.nMax, or +// +// (b) the number of pages pinned by the cache is greater than +// the sum of nMax for all purgeable caches, less the sum of +// nMin for all other purgeable caches, or +// +// 4. If none of the first three conditions apply and the cache is marked +// as purgeable, and if one of the following is true: +// +// (a) The number of pages allocated for the cache is already +// PCache1.nMax, or +// +// (b) The number of pages allocated for all purgeable caches is +// already equal to or greater than the sum of nMax for all +// purgeable caches, +// +// (c) The system is under memory pressure and wants to avoid +// unnecessary pages cache entry allocations +// +// then attempt to recycle a page from the LRU list. If it is the right +// size, return the recycled buffer. Otherwise, free the buffer and +// proceed to step 5. +// +// 5. Otherwise, allocate and return a new page buffer. +// +// There are two versions of this routine. pcache1FetchWithMutex() is +// the general case. pcache1FetchNoMutex() is a faster implementation for +// the common case where pGroup->mutex is NULL. The pcache1Fetch() wrapper +// invokes the appropriate routine. +func pcache1FetchNoMutex(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) uintptr { /* sqlite3.c:51698:15: */ + var pCache uintptr = p + var pPage uintptr = uintptr(0) + + // Step 1: Search the hash table for an existing entry. + pPage = *(*uintptr)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr((iKey%(*PCache1)(unsafe.Pointer(pCache)).FnHash))*8)) + for (pPage != 0) && ((*PgHdr1)(unsafe.Pointer(pPage)).FiKey != iKey) { + pPage = (*PgHdr1)(unsafe.Pointer(pPage)).FpNext + } + + // Step 2: If the page was found in the hash table, then return it. + // If the page was not in the hash table and createFlag is 0, abort. + // Otherwise (page not in hash and createFlag!=0) continue with + // subsequent steps to try to create the page. + if pPage != 0 { + if (*PgHdr1)(unsafe.Pointer((pPage))).FpLruNext != uintptr(0) { + return pcache1PinPage(tls, pPage) + } else { + return pPage + } + } else if createFlag != 0 { + // Steps 3, 4, and 5 implemented by this subroutine + return pcache1FetchStage2(tls, pCache, iKey, createFlag) + } else { + return uintptr(0) + } + return uintptr(0) +} + +func pcache1FetchWithMutex(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) uintptr { /* sqlite3.c:51728:15: */ + var pCache uintptr = p + var pPage uintptr + + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + pPage = pcache1FetchNoMutex(tls, p, iKey, createFlag) + + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + return pPage +} + +func pcache1Fetch(tls *libc.TLS, p uintptr, iKey uint32, createFlag int32) uintptr { /* sqlite3.c:51743:28: */ + var pCache uintptr = p + + if (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex != 0 { + return pcache1FetchWithMutex(tls, p, iKey, createFlag) + } else { + return pcache1FetchNoMutex(tls, p, iKey, createFlag) + } + return uintptr(0) +} + +// Implementation of the sqlite3_pcache.xUnpin method. +// +// Mark a page as unpinned (eligible for asynchronous recycling). +func pcache1Unpin(tls *libc.TLS, p uintptr, pPg uintptr, reuseUnlikely int32) { /* sqlite3.c:51774:13: */ + var pCache uintptr = p + var pPage uintptr = pPg + var pGroup uintptr = (*PCache1)(unsafe.Pointer(pCache)).FpGroup + + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + + // It is an error to call this function if the page is already + // part of the PGroup LRU list. + + if (reuseUnlikely != 0) || ((*PGroup)(unsafe.Pointer(pGroup)).FnPurgeable > (*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage) { + pcache1RemoveFromHash(tls, pPage, 1) + } else { + // Add the page to the PGroup LRU list. + var ppFirst uintptr = (pGroup + 24 /* &.lru */ + 40 /* &.pLruNext */) + (*PgHdr1)(unsafe.Pointer(pPage)).FpLruPrev = (pGroup + 24 /* &.lru */) + (*PgHdr1)(unsafe.Pointer(libc.AssignPtrUintptr(pPage+40 /* &.pLruNext */, *(*uintptr)(unsafe.Pointer(ppFirst))))).FpLruPrev = pPage + *(*uintptr)(unsafe.Pointer(ppFirst)) = pPage + (*PCache1)(unsafe.Pointer(pCache)).FnRecyclable++ + } + + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) +} + +// Implementation of the sqlite3_pcache.xRekey method. +func pcache1Rekey(tls *libc.TLS, p uintptr, pPg uintptr, iOld uint32, iNew uint32) { /* sqlite3.c:51809:13: */ + var pCache uintptr = p + var pPage uintptr = pPg + var pp uintptr + var h uint32 + + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + + h = (iOld % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + pp = ((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8) + for (*(*uintptr)(unsafe.Pointer(pp))) != pPage { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) + } + *(*uintptr)(unsafe.Pointer(pp)) = (*PgHdr1)(unsafe.Pointer(pPage)).FpNext + + h = (iNew % (*PCache1)(unsafe.Pointer(pCache)).FnHash) + (*PgHdr1)(unsafe.Pointer(pPage)).FiKey = iNew + (*PgHdr1)(unsafe.Pointer(pPage)).FpNext = *(*uintptr)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8)) + *(*uintptr)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FapHash + uintptr(h)*8)) = pPage + if iNew > (*PCache1)(unsafe.Pointer(pCache)).FiMaxKey { + (*PCache1)(unsafe.Pointer(pCache)).FiMaxKey = iNew + } + + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) +} + +// Implementation of the sqlite3_pcache.xTruncate method. +// +// Discard all unpinned pages in the cache with a page number equal to +// or greater than parameter iLimit. Any pinned pages with a page number +// equal to or greater than iLimit are implicitly unpinned. +func pcache1Truncate(tls *libc.TLS, p uintptr, iLimit uint32) { /* sqlite3.c:51849:13: */ + var pCache uintptr = p + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) + if iLimit <= (*PCache1)(unsafe.Pointer(pCache)).FiMaxKey { + pcache1TruncateUnsafe(tls, pCache, iLimit) + (*PCache1)(unsafe.Pointer(pCache)).FiMaxKey = (iLimit - uint32(1)) + } + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((*PCache1)(unsafe.Pointer(pCache)).FpGroup)).Fmutex) +} + +// Implementation of the sqlite3_pcache.xDestroy method. +// +// Destroy a cache allocated using pcache1Create(). +func pcache1Destroy(tls *libc.TLS, p uintptr) { /* sqlite3.c:51864:13: */ + var pCache uintptr = p + var pGroup uintptr = (*PCache1)(unsafe.Pointer(pCache)).FpGroup + + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + if (*PCache1)(unsafe.Pointer(pCache)).FnPage != 0 { + pcache1TruncateUnsafe(tls, pCache, uint32(0)) + } + + *(*uint32)(unsafe.Pointer(pGroup + 8 /* &.nMaxPage */)) -= ((*PCache1)(unsafe.Pointer(pCache)).FnMax) + + *(*uint32)(unsafe.Pointer(pGroup + 12 /* &.nMinPage */)) -= ((*PCache1)(unsafe.Pointer(pCache)).FnMin) + (*PGroup)(unsafe.Pointer(pGroup)).FmxPinned = (((*PGroup)(unsafe.Pointer(pGroup)).FnMaxPage + uint32(10)) - (*PGroup)(unsafe.Pointer(pGroup)).FnMinPage) + pcache1EnforceMaxPage(tls, pCache) + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer(pGroup)).Fmutex) + Xsqlite3_free(tls, (*PCache1)(unsafe.Pointer(pCache)).FpBulk) + Xsqlite3_free(tls, (*PCache1)(unsafe.Pointer(pCache)).FapHash) + Xsqlite3_free(tls, pCache) +} + +// This function is called during initialization (sqlite3_initialize()) to +// install the default pluggable cache module, assuming the user has not +// already provided an alternative. +func Xsqlite3PCacheSetDefault(tls *libc.TLS) { /* sqlite3.c:51887:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp, uintptr(unsafe.Pointer(&defaultMethods1)))) +} + +var defaultMethods1 = Sqlite3_pcache_methods2{ + FiVersion: 1, // pArg + FxInit: 0, // xInit + FxShutdown: 0, // xShutdown + FxCreate: 0, // xCreate + FxCachesize: 0, // xCachesize + FxPagecount: 0, // xPagecount + FxFetch: 0, // xFetch + FxUnpin: 0, // xUnpin + FxRekey: 0, // xRekey + FxTruncate: 0, // xTruncate + FxDestroy: 0, // xDestroy + FxShrink: 0, // xShrink +} /* sqlite3.c:51888:40 */ + +// Return the size of the header on each page of this PCACHE implementation. +func Xsqlite3HeaderSizePcache1(tls *libc.TLS) int32 { /* sqlite3.c:51909:20: */ + return (int32(((uint64(unsafe.Sizeof(PgHdr1{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) +} + +// Return the global mutex used by this PCACHE implementation. The +// sqlite3_status() routine needs access to this mutex. +func Xsqlite3Pcache1Mutex(tls *libc.TLS) uintptr { /* sqlite3.c:51915:30: */ + return pcache1_g.Fmutex +} + +// This function is called to free superfluous dynamically allocated memory +// held by the pager system. Memory in use by any SQLite pager allocated +// by the current thread may be sqlite3_free()ed. +// +// nReq is the number of bytes of memory required. Once this much has +// been released, the function returns. The return value is the total number +// of bytes of memory released. +func Xsqlite3PcacheReleaseMemory(tls *libc.TLS, nReq int32) int32 { /* sqlite3.c:51929:20: */ + var nFree int32 = 0 + + if Xsqlite3Config.FpPage == uintptr(0) { + var p uintptr + Xsqlite3_mutex_enter(tls, (*PGroup)(unsafe.Pointer((uintptr(unsafe.Pointer(&pcache1_g)) /* &.grp */))).Fmutex) + for (((nReq < 0) || (nFree < nReq)) && + ((libc.AssignUintptr(&p, pcache1_g.Fgrp.Flru.FpLruPrev)) != uintptr(0))) && + (int32((*PgHdr1)(unsafe.Pointer(p)).FisAnchor) == 0) { + nFree = nFree + (pcache1MemSize(tls, (*PgHdr1)(unsafe.Pointer(p)).Fpage.FpBuf)) + + pcache1PinPage(tls, p) + pcache1RemoveFromHash(tls, p, 1) + } + Xsqlite3_mutex_leave(tls, (*PGroup)(unsafe.Pointer((uintptr(unsafe.Pointer(&pcache1_g)) /* &.grp */))).Fmutex) + } + return nFree +} + +//************* End of pcache1.c ******************************************** +//************* Begin file rowset.c ***************************************** +// 2008 December 3 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This module implements an object we call a "RowSet". +// +// The RowSet object is a collection of rowids. Rowids +// are inserted into the RowSet in an arbitrary order. Inserts +// can be intermixed with tests to see if a given rowid has been +// previously inserted into the RowSet. +// +// After all inserts are finished, it is possible to extract the +// elements of the RowSet in sorted order. Once this extraction +// process has started, no new elements may be inserted. +// +// Hence, the primitive operations for a RowSet are: +// +// CREATE +// INSERT +// TEST +// SMALLEST +// DESTROY +// +// The CREATE and DESTROY primitives are the constructor and destructor, +// obviously. The INSERT primitive adds a new element to the RowSet. +// TEST checks to see if an element is already in the RowSet. SMALLEST +// extracts the least value from the RowSet. +// +// The INSERT primitive might allocate additional memory. Memory is +// allocated in chunks so most INSERTs do no allocation. There is an +// upper bound on the size of allocated memory. No memory is freed +// until DESTROY. +// +// The TEST primitive includes a "batch" number. The TEST primitive +// will only see elements that were inserted before the last change +// in the batch number. In other words, if an INSERT occurs between +// two TESTs where the TESTs have the same batch nubmer, then the +// value added by the INSERT will not be visible to the second TEST. +// The initial batch number is zero, so if the very first TEST contains +// a non-zero batch number, it will see all prior INSERTs. +// +// No INSERTs may occurs after a SMALLEST. An assertion will fail if +// that is attempted. +// +// The cost of an INSERT is roughly constant. (Sometimes new memory +// has to be allocated on an INSERT.) The cost of a TEST with a new +// batch number is O(NlogN) where N is the number of elements in the RowSet. +// The cost of a TEST using the same batch number is O(logN). The cost +// of the first SMALLEST is O(NlogN). Second and subsequent SMALLEST +// primitives are constant time. The cost of DESTROY is O(N). +// +// TEST and SMALLEST may not be used by the same RowSet. This used to +// be possible, but the feature was not used, so it was removed in order +// to simplify the code. +// #include "sqliteInt.h" + +// Target size for allocation chunks. + +// The number of rowset entries per allocation chunk. + +// Each entry in a RowSet is an instance of the following object. +// +// This same object is reused to store a linked list of trees of RowSetEntry +// objects. In that alternative use, pRight points to the next entry +// in the list, pLeft points to the tree, and v is unused. The +// RowSet.pForest value points to the head of this forest list. +type RowSetEntry = struct { + Fv I64 + FpRight uintptr + FpLeft uintptr +} /* sqlite3.c:14916:9 */ + +// RowSetEntry objects are allocated in large chunks (instances of the +// following structure) to reduce memory allocation overhead. The +// chunks are kept on a linked list so that they can be deallocated +// when the RowSet is destroyed. +type RowSetChunk = struct { + FpNextChunk uintptr + FaEntry [42]struct { + Fv I64 + FpRight uintptr + FpLeft uintptr + } +} /* sqlite3.c:14916:9 */ + +// Allowed values for RowSet.rsFlags + +// Allocate a RowSet object. Return NULL if a memory allocation +// error occurs. +func Xsqlite3RowSetInit(tls *libc.TLS, db uintptr) uintptr { /* sqlite3.c:52109:23: */ + var p uintptr = Xsqlite3DbMallocRawNN(tls, db, uint64(unsafe.Sizeof(RowSet{}))) + if p != 0 { + var N int32 = Xsqlite3DbMallocSize(tls, db, p) + (*RowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).Fdb = db + (*RowSet)(unsafe.Pointer(p)).FpEntry = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FpLast = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FpForest = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FpFresh = (uintptr((((uint64(unsafe.Sizeof(RowSet{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) + p) + (*RowSet)(unsafe.Pointer(p)).FnFresh = (U16((uint64(N) - (((uint64(unsafe.Sizeof(RowSet{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) / uint64(unsafe.Sizeof(RowSetEntry{})))) + (*RowSet)(unsafe.Pointer(p)).FrsFlags = U16(ROWSET_SORTED) + (*RowSet)(unsafe.Pointer(p)).FiBatch = 0 + } + return p +} + +// Deallocate all chunks from a RowSet. This frees all memory that +// the RowSet has allocated over its lifetime. This routine is +// the destructor for the RowSet. +func Xsqlite3RowSetClear(tls *libc.TLS, pArg uintptr) { /* sqlite3.c:52131:21: */ + var p uintptr = pArg + var pChunk uintptr + var pNextChunk uintptr + for pChunk = (*RowSet)(unsafe.Pointer(p)).FpChunk; pChunk != 0; pChunk = pNextChunk { + pNextChunk = (*RowSetChunk)(unsafe.Pointer(pChunk)).FpNextChunk + Xsqlite3DbFree(tls, (*RowSet)(unsafe.Pointer(p)).Fdb, pChunk) + } + (*RowSet)(unsafe.Pointer(p)).FpChunk = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FnFresh = U16(0) + (*RowSet)(unsafe.Pointer(p)).FpEntry = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FpLast = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FpForest = uintptr(0) + (*RowSet)(unsafe.Pointer(p)).FrsFlags = U16(ROWSET_SORTED) +} + +// Deallocate all chunks from a RowSet. This frees all memory that +// the RowSet has allocated over its lifetime. This routine is +// the destructor for the RowSet. +func Xsqlite3RowSetDelete(tls *libc.TLS, pArg uintptr) { /* sqlite3.c:52151:21: */ + Xsqlite3RowSetClear(tls, pArg) + Xsqlite3DbFree(tls, (*RowSet)(unsafe.Pointer(pArg)).Fdb, pArg) +} + +// Allocate a new RowSetEntry object that is associated with the +// given RowSet. Return a pointer to the new and completely uninitialized +// object. +// +// In an OOM situation, the RowSet.db->mallocFailed flag is set and this +// routine returns NULL. +func rowSetEntryAlloc(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:52164:27: */ + + if int32((*RowSet)(unsafe.Pointer(p)).FnFresh) == 0 { //OPTIMIZATION-IF-FALSE + // We could allocate a fresh RowSetEntry each time one is needed, but it + // is more efficient to pull a preallocated entry from the pool + var pNew uintptr + pNew = Xsqlite3DbMallocRawNN(tls, (*RowSet)(unsafe.Pointer(p)).Fdb, uint64(unsafe.Sizeof(RowSetChunk{}))) + if pNew == uintptr(0) { + return uintptr(0) + } + (*RowSetChunk)(unsafe.Pointer(pNew)).FpNextChunk = (*RowSet)(unsafe.Pointer(p)).FpChunk + (*RowSet)(unsafe.Pointer(p)).FpChunk = pNew + (*RowSet)(unsafe.Pointer(p)).FpFresh = pNew + 8 /* &.aEntry */ + (*RowSet)(unsafe.Pointer(p)).FnFresh = (uint16((uint64(ROWSET_ALLOCATION_SIZE - 8)) / uint64(unsafe.Sizeof(RowSetEntry{})))) + } + (*RowSet)(unsafe.Pointer(p)).FnFresh-- + return libc.PostIncUintptr(&(*RowSet)(unsafe.Pointer(p)).FpFresh, 24) +} + +// Insert a new value into a RowSet. +// +// The mallocFailed flag of the database connection is set if a +// memory allocation fails. +func Xsqlite3RowSetInsert(tls *libc.TLS, p uintptr, rowid I64) { /* sqlite3.c:52189:21: */ + var pEntry uintptr // The new entry + var pLast uintptr // The last prior entry + + // This routine is never called after sqlite3RowSetNext() + + pEntry = rowSetEntryAlloc(tls, p) + if pEntry == uintptr(0) { + return + } + (*RowSetEntry)(unsafe.Pointer(pEntry)).Fv = rowid + (*RowSetEntry)(unsafe.Pointer(pEntry)).FpRight = uintptr(0) + pLast = (*RowSet)(unsafe.Pointer(p)).FpLast + if pLast != 0 { + if rowid <= (*RowSetEntry)(unsafe.Pointer(pLast)).Fv { //OPTIMIZATION-IF-FALSE + // Avoid unnecessary sorts by preserving the ROWSET_SORTED flags + // where possible + *(*U16)(unsafe.Pointer(p + 50 /* &.rsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(ROWSET_SORTED))) + } + (*RowSetEntry)(unsafe.Pointer(pLast)).FpRight = pEntry + } else { + (*RowSet)(unsafe.Pointer(p)).FpEntry = pEntry + } + (*RowSet)(unsafe.Pointer(p)).FpLast = pEntry +} + +// Merge two lists of RowSetEntry objects. Remove duplicates. +// +// The input lists are connected via pRight pointers and are +// assumed to each already be in sorted order. +func rowSetEntryMerge(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* sqlite3.c:52220:27: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var head RowSetEntry at bp, 24 + + var pTail uintptr + + pTail = bp /* &head */ + + for { + + if (*RowSetEntry)(unsafe.Pointer(pA)).Fv <= (*RowSetEntry)(unsafe.Pointer(pB)).Fv { + if (*RowSetEntry)(unsafe.Pointer(pA)).Fv < (*RowSetEntry)(unsafe.Pointer(pB)).Fv { + pTail = libc.AssignPtrUintptr(pTail+8 /* &.pRight */, pA) + } + pA = (*RowSetEntry)(unsafe.Pointer(pA)).FpRight + if pA == uintptr(0) { + (*RowSetEntry)(unsafe.Pointer(pTail)).FpRight = pB + break + } + } else { + pTail = libc.AssignPtrUintptr(pTail+8 /* &.pRight */, pB) + pB = (*RowSetEntry)(unsafe.Pointer(pB)).FpRight + if pB == uintptr(0) { + (*RowSetEntry)(unsafe.Pointer(pTail)).FpRight = pA + break + } + } + } + return (*RowSetEntry)(unsafe.Pointer(bp /* &head */)).FpRight +} + +// Sort all elements on the list of RowSetEntry objects into order of +// increasing v. +func rowSetEntrySort(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:52255:27: */ + bp := tls.Alloc(320) + defer tls.Free(320) + + var i uint32 + var pNext uintptr + // var aBucket [40]uintptr at bp, 320 + + libc.Xmemset(tls, bp /* &aBucket[0] */, 0, uint64(unsafe.Sizeof([40]uintptr{}))) + for pIn != 0 { + pNext = (*RowSetEntry)(unsafe.Pointer(pIn)).FpRight + (*RowSetEntry)(unsafe.Pointer(pIn)).FpRight = uintptr(0) + for i = uint32(0); *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8)) != 0; i++ { + pIn = rowSetEntryMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8)), pIn) + *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8)) = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8)) = pIn + pIn = pNext + } + pIn = *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */)) + for i = uint32(1); uint64(i) < (uint64(unsafe.Sizeof([40]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))); i++ { + if *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8)) == uintptr(0) { + continue + } + if pIn != 0 { + pIn = rowSetEntryMerge(tls, pIn, *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8))) + } else { + pIn = *(*uintptr)(unsafe.Pointer(bp /* &aBucket[0] */ + uintptr(i)*8)) + } + } + return pIn +} + +// The input, pIn, is a binary tree (or subtree) of RowSetEntry objects. +// Convert this tree into a linked list connected by the pRight pointers +// and return pointers to the first and last elements of the new list. +func rowSetTreeToList(tls *libc.TLS, pIn uintptr, ppFirst uintptr, ppLast uintptr) { /* sqlite3.c:52284:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*RowSetEntry)(unsafe.Pointer(pIn)).FpLeft != 0 { + // var p uintptr at bp, 8 + + rowSetTreeToList(tls, (*RowSetEntry)(unsafe.Pointer(pIn)).FpLeft, ppFirst, bp /* &p */) + (*RowSetEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpRight = pIn + } else { + *(*uintptr)(unsafe.Pointer(ppFirst)) = pIn + } + if (*RowSetEntry)(unsafe.Pointer(pIn)).FpRight != 0 { + rowSetTreeToList(tls, (*RowSetEntry)(unsafe.Pointer(pIn)).FpRight, (pIn + 8 /* &.pRight */), ppLast) + } else { + *(*uintptr)(unsafe.Pointer(ppLast)) = pIn + } + +} + +// Convert a sorted list of elements (connected by pRight) into a binary +// tree with depth of iDepth. A depth of 1 means the tree contains a single +// node taken from the head of *ppList. A depth of 2 means a tree with +// three nodes. And so forth. +// +// Use as many entries from the input list as required and update the +// *ppList to point to the unused elements of the list. If the input +// list contains too few elements, then construct an incomplete tree +// and leave *ppList set to NULL. +// +// Return a pointer to the root of the constructed binary tree. +func rowSetNDeepTree(tls *libc.TLS, ppList uintptr, iDepth int32) uintptr { /* sqlite3.c:52319:27: */ + var p uintptr // Root of the new tree + var pLeft uintptr // Left subtree + if *(*uintptr)(unsafe.Pointer(ppList)) == uintptr(0) { //OPTIMIZATION-IF-TRUE + // Prevent unnecessary deep recursion when we run out of entries + return uintptr(0) + } + if iDepth > 1 { //OPTIMIZATION-IF-TRUE + // This branch causes a *balanced* tree to be generated. A valid tree + // is still generated without this branch, but the tree is wildly + // unbalanced and inefficient. + pLeft = rowSetNDeepTree(tls, ppList, (iDepth - 1)) + p = *(*uintptr)(unsafe.Pointer(ppList)) + if p == uintptr(0) { //OPTIMIZATION-IF-FALSE + // It is safe to always return here, but the resulting tree + // would be unbalanced + return pLeft + } + (*RowSetEntry)(unsafe.Pointer(p)).FpLeft = pLeft + *(*uintptr)(unsafe.Pointer(ppList)) = (*RowSetEntry)(unsafe.Pointer(p)).FpRight + (*RowSetEntry)(unsafe.Pointer(p)).FpRight = rowSetNDeepTree(tls, ppList, (iDepth - 1)) + } else { + p = *(*uintptr)(unsafe.Pointer(ppList)) + *(*uintptr)(unsafe.Pointer(ppList)) = (*RowSetEntry)(unsafe.Pointer(p)).FpRight + (*RowSetEntry)(unsafe.Pointer(p)).FpLeft = libc.AssignPtrUintptr(p+8 /* &.pRight */, uintptr(0)) + } + return p +} + +// Convert a sorted list of elements into a binary tree. Make the tree +// as deep as it needs to be in order to contain the entire list. +func rowSetListToTree(tls *libc.TLS, pList uintptr) uintptr { /* sqlite3.c:52355:27: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = pList + + var iDepth int32 // Depth of the tree so far + var p uintptr // Current tree root + var pLeft uintptr // Left subtree + + p = *(*uintptr)(unsafe.Pointer(bp /* pList */)) + *(*uintptr)(unsafe.Pointer(bp /* pList */)) = (*RowSetEntry)(unsafe.Pointer(p)).FpRight + (*RowSetEntry)(unsafe.Pointer(p)).FpLeft = libc.AssignPtrUintptr(p+8 /* &.pRight */, uintptr(0)) + for iDepth = 1; *(*uintptr)(unsafe.Pointer(bp /* pList */)) != 0; iDepth++ { + pLeft = p + p = *(*uintptr)(unsafe.Pointer(bp /* pList */)) + *(*uintptr)(unsafe.Pointer(bp /* pList */)) = (*RowSetEntry)(unsafe.Pointer(p)).FpRight + (*RowSetEntry)(unsafe.Pointer(p)).FpLeft = pLeft + (*RowSetEntry)(unsafe.Pointer(p)).FpRight = rowSetNDeepTree(tls, bp /* &pList */, iDepth) + } + return p +} + +// Extract the smallest element from the RowSet. +// Write the element into *pRowid. Return 1 on success. Return +// 0 if the RowSet is already empty. +// +// After this routine has been called, the sqlite3RowSetInsert() +// routine may not be called again. +// +// This routine may not be called after sqlite3RowSetTest() has +// been used. Older versions of RowSet allowed that, but as the +// capability was not used by the code generator, it was removed +// for code economy. +func Xsqlite3RowSetNext(tls *libc.TLS, p uintptr, pRowid uintptr) int32 { /* sqlite3.c:52387:20: */ + + // Cannot be used with sqlite3RowSetText() + + // Merge the forest into a single sorted list on first call + if (int32((*RowSet)(unsafe.Pointer(p)).FrsFlags) & ROWSET_NEXT) == 0 { //OPTIMIZATION-IF-FALSE + if (int32((*RowSet)(unsafe.Pointer(p)).FrsFlags) & ROWSET_SORTED) == 0 { //OPTIMIZATION-IF-FALSE + (*RowSet)(unsafe.Pointer(p)).FpEntry = rowSetEntrySort(tls, (*RowSet)(unsafe.Pointer(p)).FpEntry) + } + *(*U16)(unsafe.Pointer(p + 50 /* &.rsFlags */)) |= U16((ROWSET_SORTED | ROWSET_NEXT)) + } + + // Return the next entry on the list + if (*RowSet)(unsafe.Pointer(p)).FpEntry != 0 { + *(*I64)(unsafe.Pointer(pRowid)) = (*RowSetEntry)(unsafe.Pointer((*RowSet)(unsafe.Pointer(p)).FpEntry)).Fv + (*RowSet)(unsafe.Pointer(p)).FpEntry = (*RowSetEntry)(unsafe.Pointer((*RowSet)(unsafe.Pointer(p)).FpEntry)).FpRight + if (*RowSet)(unsafe.Pointer(p)).FpEntry == uintptr(0) { //OPTIMIZATION-IF-TRUE + // Free memory immediately, rather than waiting on sqlite3_finalize() + Xsqlite3RowSetClear(tls, p) + } + return 1 + } else { + return 0 + } + return int32(0) +} + +// Check to see if element iRowid was inserted into the rowset as +// part of any insert batch prior to iBatch. Return 1 or 0. +// +// If this is the first test of a new batch and if there exist entries +// on pRowSet->pEntry, then sort those entries into the forest at +// pRowSet->pForest so that they can be tested. +func Xsqlite3RowSetTest(tls *libc.TLS, pRowSet uintptr, iBatch int32, iRowid Sqlite3_int64) int32 { /* sqlite3.c:52421:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr + var pTree uintptr + + // This routine is never called after sqlite3RowSetNext() + + // Sort entries into the forest on the first test of a new batch. + // To save unnecessary work, only do this when the batch number changes. + if iBatch != (*RowSet)(unsafe.Pointer(pRowSet)).FiBatch { //OPTIMIZATION-IF-FALSE + p = (*RowSet)(unsafe.Pointer(pRowSet)).FpEntry + if p != 0 { + var ppPrevTree uintptr = (pRowSet + 40 /* &.pForest */) + if (int32((*RowSet)(unsafe.Pointer(pRowSet)).FrsFlags) & ROWSET_SORTED) == 0 { //OPTIMIZATION-IF-FALSE + // Only sort the current set of entries if they need it + p = rowSetEntrySort(tls, p) + } + for pTree = (*RowSet)(unsafe.Pointer(pRowSet)).FpForest; pTree != 0; pTree = (*RowSetEntry)(unsafe.Pointer(pTree)).FpRight { + ppPrevTree = (pTree + 8 /* &.pRight */) + if (*RowSetEntry)(unsafe.Pointer(pTree)).FpLeft == uintptr(0) { + (*RowSetEntry)(unsafe.Pointer(pTree)).FpLeft = rowSetListToTree(tls, p) + break + } else { + // var pAux uintptr at bp, 8 + + // var pTail uintptr at bp+8, 8 + + rowSetTreeToList(tls, (*RowSetEntry)(unsafe.Pointer(pTree)).FpLeft, bp /* &pAux */, bp+8 /* &pTail */) + (*RowSetEntry)(unsafe.Pointer(pTree)).FpLeft = uintptr(0) + p = rowSetEntryMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* pAux */)), p) + } + } + if pTree == uintptr(0) { + *(*uintptr)(unsafe.Pointer(ppPrevTree)) = libc.AssignUintptr(&pTree, rowSetEntryAlloc(tls, pRowSet)) + if pTree != 0 { + (*RowSetEntry)(unsafe.Pointer(pTree)).Fv = int64(0) + (*RowSetEntry)(unsafe.Pointer(pTree)).FpRight = uintptr(0) + (*RowSetEntry)(unsafe.Pointer(pTree)).FpLeft = rowSetListToTree(tls, p) + } + } + (*RowSet)(unsafe.Pointer(pRowSet)).FpEntry = uintptr(0) + (*RowSet)(unsafe.Pointer(pRowSet)).FpLast = uintptr(0) + *(*U16)(unsafe.Pointer(pRowSet + 50 /* &.rsFlags */)) |= U16((ROWSET_SORTED)) + } + (*RowSet)(unsafe.Pointer(pRowSet)).FiBatch = iBatch + } + + // Test to see if the iRowid value appears anywhere in the forest. + // Return 1 if it does and 0 if not. + for pTree = (*RowSet)(unsafe.Pointer(pRowSet)).FpForest; pTree != 0; pTree = (*RowSetEntry)(unsafe.Pointer(pTree)).FpRight { + p = (*RowSetEntry)(unsafe.Pointer(pTree)).FpLeft + for p != 0 { + if (*RowSetEntry)(unsafe.Pointer(p)).Fv < iRowid { + p = (*RowSetEntry)(unsafe.Pointer(p)).FpRight + } else if (*RowSetEntry)(unsafe.Pointer(p)).Fv > iRowid { + p = (*RowSetEntry)(unsafe.Pointer(p)).FpLeft + } else { + return 1 + } + } + } + return 0 +} + +//************* End of rowset.c ********************************************* +//************* Begin file pager.c ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the implementation of the page cache subsystem or "pager". +// +// The pager is used to access a database disk file. It implements +// atomic commit and rollback through the use of a journal file that +// is separate from the database file. The pager also implements file +// locking to prevent two processes from writing the same database +// file simultaneously, or one process from reading the database while +// another is writing. +// #include "sqliteInt.h" +//************* Include wal.h in the middle of pager.c ********************** +//************* Begin file wal.h ******************************************** +// 2010 February 1 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface to the write-ahead logging +// system. Refer to the comments below and the header comment attached to +// the implementation of each function in log.c for further details. + +// #include "sqliteInt.h" + +// Macros for extracting appropriate sync flags for either transaction +// commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)): + +// Connection to a write-ahead log (WAL) file. +// There is one object of this type for each pager. +type Wal1 = struct { + FpVfs uintptr + FpDbFd uintptr + FpWalFd uintptr + FiCallback U32 + _ [4]byte + FmxWalSize I64 + FnWiData int32 + FszFirstBlock int32 + FapWiData uintptr + FszPage U32 + FreadLock I16 + FsyncFlags U8 + FexclusiveMode U8 + FwriteLock U8 + FckptLock U8 + FreadOnly U8 + FtruncateOnCommit U8 + FsyncHeader U8 + FpadToSectorBoundary U8 + FbShmUnreliable U8 + _ [1]byte + Fhdr WalIndexHdr + FminFrame U32 + FiReCksum U32 + FzWalName uintptr + FnCkpt U32 + _ [4]byte + FpSnapshot uintptr +} /* sqlite3.c:1331:9 */ + +//************* End of rowset.c ********************************************* +//************* Begin file pager.c ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the implementation of the page cache subsystem or "pager". +// +// The pager is used to access a database disk file. It implements +// atomic commit and rollback through the use of a journal file that +// is separate from the database file. The pager also implements file +// locking to prevent two processes from writing the same database +// file simultaneously, or one process from reading the database while +// another is writing. +// #include "sqliteInt.h" +//************* Include wal.h in the middle of pager.c ********************** +//************* Begin file wal.h ******************************************** +// 2010 February 1 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This header file defines the interface to the write-ahead logging +// system. Refer to the comments below and the header comment attached to +// the implementation of each function in log.c for further details. + +// #include "sqliteInt.h" + +// Macros for extracting appropriate sync flags for either transaction +// commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)): + +// Connection to a write-ahead log (WAL) file. +// There is one object of this type for each pager. +type Wal = Wal1 /* sqlite3.c:52563:20 */ + +//************* End of wal.h ************************************************ +//************* Continuing where we left off in pager.c ********************* + +// ****************** NOTES ON THE DESIGN OF THE PAGER ************************ +// +// +// This comment block describes invariants that hold when using a rollback +// journal. These invariants do not apply for journal_mode=WAL, +// journal_mode=MEMORY, or journal_mode=OFF. +// +// Within this comment block, a page is deemed to have been synced +// automatically as soon as it is written when PRAGMA synchronous=OFF. +// Otherwise, the page is not synced until the xSync method of the VFS +// is called successfully on the file containing the page. +// +// Definition: A page of the database file is said to be "overwriteable" if +// one or more of the following are true about the page: +// +// (a) The original content of the page as it was at the beginning of +// the transaction has been written into the rollback journal and +// synced. +// +// (b) The page was a freelist leaf page at the start of the transaction. +// +// (c) The page number is greater than the largest page that existed in +// the database file at the start of the transaction. +// +// (1) A page of the database file is never overwritten unless one of the +// following are true: +// +// (a) The page and all other pages on the same sector are overwriteable. +// +// (b) The atomic page write optimization is enabled, and the entire +// transaction other than the update of the transaction sequence +// number consists of a single page change. +// +// (2) The content of a page written into the rollback journal exactly matches +// both the content in the database when the rollback journal was written +// and the content in the database at the beginning of the current +// transaction. +// +// (3) Writes to the database file are an integer multiple of the page size +// in length and are aligned on a page boundary. +// +// (4) Reads from the database file are either aligned on a page boundary and +// an integer multiple of the page size in length or are taken from the +// first 100 bytes of the database file. +// +// (5) All writes to the database file are synced prior to the rollback journal +// being deleted, truncated, or zeroed. +// +// (6) If a super-journal file is used, then all writes to the database file +// are synced prior to the super-journal being deleted. +// +// Definition: Two databases (or the same database at two points it time) +// are said to be "logically equivalent" if they give the same answer to +// all queries. Note in particular the content of freelist leaf +// pages can be changed arbitrarily without affecting the logical equivalence +// of the database. +// +// (7) At any time, if any subset, including the empty set and the total set, +// of the unsynced changes to a rollback journal are removed and the +// journal is rolled back, the resulting database file will be logically +// equivalent to the database file at the beginning of the transaction. +// +// (8) When a transaction is rolled back, the xTruncate method of the VFS +// is called to restore the database file to the same size it was at +// the beginning of the transaction. (In some VFSes, the xTruncate +// method is a no-op, but that does not change the fact the SQLite will +// invoke it.) +// +// (9) Whenever the database file is modified, at least one bit in the range +// of bytes from 24 through 39 inclusive will be changed prior to releasing +// the EXCLUSIVE lock, thus signaling other connections on the same +// database to flush their caches. +// +// (10) The pattern of bits in bytes 24 through 39 shall not repeat in less +// than one billion transactions. +// +// (11) A database file is well-formed at the beginning and at the conclusion +// of every transaction. +// +// (12) An EXCLUSIVE lock is held on the database file when writing to +// the database file. +// +// (13) A SHARED lock is held on the database file while reading any +// content out of the database file. +// +// + +// Macros for troubleshooting. Normally turned off + +// The following two macros are used within the PAGERTRACE() macros above +// to print out file-descriptors. +// +// PAGERID() takes a pointer to a Pager struct as its argument. The +// associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file +// struct as its argument. + +// The Pager.eState variable stores the current 'state' of a pager. A +// pager may be in any one of the seven states shown in the following +// state diagram. +// +// OPEN <------+------+ +// | | | +// V | | +// +---------> READER-------+ | +// | | | +// | V | +// |<-------WRITER_LOCKED------> ERROR +// | | ^ +// | V | +// |<------WRITER_CACHEMOD-------->| +// | | | +// | V | +// |<-------WRITER_DBMOD---------->| +// | | | +// | V | +// +<------WRITER_FINISHED-------->+ +// +// +// List of state transitions and the C [function] that performs each: +// +// OPEN -> READER [sqlite3PagerSharedLock] +// READER -> OPEN [pager_unlock] +// +// READER -> WRITER_LOCKED [sqlite3PagerBegin] +// WRITER_LOCKED -> WRITER_CACHEMOD [pager_open_journal] +// WRITER_CACHEMOD -> WRITER_DBMOD [syncJournal] +// WRITER_DBMOD -> WRITER_FINISHED [sqlite3PagerCommitPhaseOne] +// WRITER_*** -> READER [pager_end_transaction] +// +// WRITER_*** -> ERROR [pager_error] +// ERROR -> OPEN [pager_unlock] +// +// +// OPEN: +// +// The pager starts up in this state. Nothing is guaranteed in this +// state - the file may or may not be locked and the database size is +// unknown. The database may not be read or written. +// +// * No read or write transaction is active. +// * Any lock, or no lock at all, may be held on the database file. +// * The dbSize, dbOrigSize and dbFileSize variables may not be trusted. +// +// READER: +// +// In this state all the requirements for reading the database in +// rollback (non-WAL) mode are met. Unless the pager is (or recently +// was) in exclusive-locking mode, a user-level read transaction is +// open. The database size is known in this state. +// +// A connection running with locking_mode=normal enters this state when +// it opens a read-transaction on the database and returns to state +// OPEN after the read-transaction is completed. However a connection +// running in locking_mode=exclusive (including temp databases) remains in +// this state even after the read-transaction is closed. The only way +// a locking_mode=exclusive connection can transition from READER to OPEN +// is via the ERROR state (see below). +// +// * A read transaction may be active (but a write-transaction cannot). +// * A SHARED or greater lock is held on the database file. +// * The dbSize variable may be trusted (even if a user-level read +// transaction is not active). The dbOrigSize and dbFileSize variables +// may not be trusted at this point. +// * If the database is a WAL database, then the WAL connection is open. +// * Even if a read-transaction is not open, it is guaranteed that +// there is no hot-journal in the file-system. +// +// WRITER_LOCKED: +// +// The pager moves to this state from READER when a write-transaction +// is first opened on the database. In WRITER_LOCKED state, all locks +// required to start a write-transaction are held, but no actual +// modifications to the cache or database have taken place. +// +// In rollback mode, a RESERVED or (if the transaction was opened with +// BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when +// moving to this state, but the journal file is not written to or opened +// to in this state. If the transaction is committed or rolled back while +// in WRITER_LOCKED state, all that is required is to unlock the database +// file. +// +// IN WAL mode, WalBeginWriteTransaction() is called to lock the log file. +// If the connection is running with locking_mode=exclusive, an attempt +// is made to obtain an EXCLUSIVE lock on the database file. +// +// * A write transaction is active. +// * If the connection is open in rollback-mode, a RESERVED or greater +// lock is held on the database file. +// * If the connection is open in WAL-mode, a WAL write transaction +// is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully +// called). +// * The dbSize, dbOrigSize and dbFileSize variables are all valid. +// * The contents of the pager cache have not been modified. +// * The journal file may or may not be open. +// * Nothing (not even the first header) has been written to the journal. +// +// WRITER_CACHEMOD: +// +// A pager moves from WRITER_LOCKED state to this state when a page is +// first modified by the upper layer. In rollback mode the journal file +// is opened (if it is not already open) and a header written to the +// start of it. The database file on disk has not been modified. +// +// * A write transaction is active. +// * A RESERVED or greater lock is held on the database file. +// * The journal file is open and the first header has been written +// to it, but the header has not been synced to disk. +// * The contents of the page cache have been modified. +// +// WRITER_DBMOD: +// +// The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state +// when it modifies the contents of the database file. WAL connections +// never enter this state (since they do not modify the database file, +// just the log file). +// +// * A write transaction is active. +// * An EXCLUSIVE or greater lock is held on the database file. +// * The journal file is open and the first header has been written +// and synced to disk. +// * The contents of the page cache have been modified (and possibly +// written to disk). +// +// WRITER_FINISHED: +// +// It is not possible for a WAL connection to enter this state. +// +// A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD +// state after the entire transaction has been successfully written into the +// database file. In this state the transaction may be committed simply +// by finalizing the journal file. Once in WRITER_FINISHED state, it is +// not possible to modify the database further. At this point, the upper +// layer must either commit or rollback the transaction. +// +// * A write transaction is active. +// * An EXCLUSIVE or greater lock is held on the database file. +// * All writing and syncing of journal and database data has finished. +// If no error occurred, all that remains is to finalize the journal to +// commit the transaction. If an error did occur, the caller will need +// to rollback the transaction. +// +// ERROR: +// +// The ERROR state is entered when an IO or disk-full error (including +// SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it +// difficult to be sure that the in-memory pager state (cache contents, +// db size etc.) are consistent with the contents of the file-system. +// +// Temporary pager files may enter the ERROR state, but in-memory pagers +// cannot. +// +// For example, if an IO error occurs while performing a rollback, +// the contents of the page-cache may be left in an inconsistent state. +// At this point it would be dangerous to change back to READER state +// (as usually happens after a rollback). Any subsequent readers might +// report database corruption (due to the inconsistent cache), and if +// they upgrade to writers, they may inadvertently corrupt the database +// file. To avoid this hazard, the pager switches into the ERROR state +// instead of READER following such an error. +// +// Once it has entered the ERROR state, any attempt to use the pager +// to read or write data returns an error. Eventually, once all +// outstanding transactions have been abandoned, the pager is able to +// transition back to OPEN state, discarding the contents of the +// page-cache and any other in-memory state at the same time. Everything +// is reloaded from disk (and, if necessary, hot-journal rollback peformed) +// when a read-transaction is next opened on the pager (transitioning +// the pager into READER state). At that point the system has recovered +// from the error. +// +// Specifically, the pager jumps into the ERROR state if: +// +// 1. An error occurs while attempting a rollback. This happens in +// function sqlite3PagerRollback(). +// +// 2. An error occurs while attempting to finalize a journal file +// following a commit in function sqlite3PagerCommitPhaseTwo(). +// +// 3. An error occurs while attempting to write to the journal or +// database file in function pagerStress() in order to free up +// memory. +// +// In other cases, the error is returned to the b-tree layer. The b-tree +// layer then attempts a rollback operation. If the error condition +// persists, the pager enters the ERROR state via condition (1) above. +// +// Condition (3) is necessary because it can be triggered by a read-only +// statement executed within a transaction. In this case, if the error +// code were simply returned to the user, the b-tree layer would not +// automatically attempt a rollback, as it assumes that an error in a +// read-only statement cannot leave the pager in an internally inconsistent +// state. +// +// * The Pager.errCode variable is set to something other than SQLITE_OK. +// * There are one or more outstanding references to pages (after the +// last reference is dropped the pager should move back to OPEN state). +// * The pager is not an in-memory pager. +// +// +// Notes: +// +// * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the +// connection is open in WAL mode. A WAL connection is always in one +// of the first four states. +// +// * Normally, a connection open in exclusive mode is never in PAGER_OPEN +// state. There are two exceptions: immediately after exclusive-mode has +// been turned on (and before any read or write transactions are +// executed), and when the pager is leaving the "error state". +// +// * See also: assert_pager_state(). + +// The Pager.eLock variable is almost always set to one of the +// following locking-states, according to the lock currently held on +// the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK. +// This variable is kept up to date as locks are taken and released by +// the pagerLockDb() and pagerUnlockDb() wrappers. +// +// If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY +// (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not +// the operation was successful. In these circumstances pagerLockDb() and +// pagerUnlockDb() take a conservative approach - eLock is always updated +// when unlocking the file, and only updated when locking the file if the +// VFS call is successful. This way, the Pager.eLock variable may be set +// to a less exclusive (lower) value than the lock that is actually held +// at the system level, but it is never set to a more exclusive value. +// +// This is usually safe. If an xUnlock fails or appears to fail, there may +// be a few redundant xLock() calls or a lock may be held for longer than +// required, but nothing really goes wrong. +// +// The exception is when the database file is unlocked as the pager moves +// from ERROR to OPEN state. At this point there may be a hot-journal file +// in the file-system that needs to be rolled back (as part of an OPEN->SHARED +// transition, by the same pager or any other). If the call to xUnlock() +// fails at this point and the pager is left holding an EXCLUSIVE lock, this +// can confuse the call to xCheckReservedLock() call made later as part +// of hot-journal detection. +// +// xCheckReservedLock() is defined as returning true "if there is a RESERVED +// lock held by this process or any others". So xCheckReservedLock may +// return true because the caller itself is holding an EXCLUSIVE lock (but +// doesn't know it because of a previous error in xUnlock). If this happens +// a hot-journal may be mistaken for a journal being created by an active +// transaction in another process, causing SQLite to read from the database +// without rolling it back. +// +// To work around this, if a call to xUnlock() fails when unlocking the +// database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It +// is only changed back to a real locking state after a successful call +// to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition +// omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK +// lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE +// lock on the database file before attempting to roll it back. See function +// PagerSharedLock() for more detail. +// +// Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in +// PAGER_OPEN state. + +// The maximum allowed sector size. 64KiB. If the xSectorsize() method +// returns a value larger than this, then MAX_SECTOR_SIZE is used instead. +// This could conceivably cause corruption following a power failure on +// such a system. This is currently an undocumented limit. + +// An instance of the following structure is allocated for each active +// savepoint and statement transaction in the system. All such structures +// are stored in the Pager.aSavepoint[] array, which is allocated and +// resized using sqlite3Realloc(). +// +// When a savepoint is created, the PagerSavepoint.iHdrOffset field is +// set to 0. If a journal-header is written into the main journal while +// the savepoint is active, then iHdrOffset is set to the byte offset +// immediately following the last journal record written into the main +// journal before the journal-header. This is required during savepoint +// rollback (see pagerPlaybackSavepoint()). +type PagerSavepoint1 = struct { + FiOffset I64 + FiHdrOffset I64 + FpInSavepoint uintptr + FnOrig Pgno + FiSubRec Pgno + FbTruncateOnRelease int32 + FaWalData [4]U32 + _ [4]byte +} /* sqlite3.c:1331:9 */ + +//************* End of wal.h ************************************************ +//************* Continuing where we left off in pager.c ********************* + +// ****************** NOTES ON THE DESIGN OF THE PAGER ************************ +// +// +// This comment block describes invariants that hold when using a rollback +// journal. These invariants do not apply for journal_mode=WAL, +// journal_mode=MEMORY, or journal_mode=OFF. +// +// Within this comment block, a page is deemed to have been synced +// automatically as soon as it is written when PRAGMA synchronous=OFF. +// Otherwise, the page is not synced until the xSync method of the VFS +// is called successfully on the file containing the page. +// +// Definition: A page of the database file is said to be "overwriteable" if +// one or more of the following are true about the page: +// +// (a) The original content of the page as it was at the beginning of +// the transaction has been written into the rollback journal and +// synced. +// +// (b) The page was a freelist leaf page at the start of the transaction. +// +// (c) The page number is greater than the largest page that existed in +// the database file at the start of the transaction. +// +// (1) A page of the database file is never overwritten unless one of the +// following are true: +// +// (a) The page and all other pages on the same sector are overwriteable. +// +// (b) The atomic page write optimization is enabled, and the entire +// transaction other than the update of the transaction sequence +// number consists of a single page change. +// +// (2) The content of a page written into the rollback journal exactly matches +// both the content in the database when the rollback journal was written +// and the content in the database at the beginning of the current +// transaction. +// +// (3) Writes to the database file are an integer multiple of the page size +// in length and are aligned on a page boundary. +// +// (4) Reads from the database file are either aligned on a page boundary and +// an integer multiple of the page size in length or are taken from the +// first 100 bytes of the database file. +// +// (5) All writes to the database file are synced prior to the rollback journal +// being deleted, truncated, or zeroed. +// +// (6) If a super-journal file is used, then all writes to the database file +// are synced prior to the super-journal being deleted. +// +// Definition: Two databases (or the same database at two points it time) +// are said to be "logically equivalent" if they give the same answer to +// all queries. Note in particular the content of freelist leaf +// pages can be changed arbitrarily without affecting the logical equivalence +// of the database. +// +// (7) At any time, if any subset, including the empty set and the total set, +// of the unsynced changes to a rollback journal are removed and the +// journal is rolled back, the resulting database file will be logically +// equivalent to the database file at the beginning of the transaction. +// +// (8) When a transaction is rolled back, the xTruncate method of the VFS +// is called to restore the database file to the same size it was at +// the beginning of the transaction. (In some VFSes, the xTruncate +// method is a no-op, but that does not change the fact the SQLite will +// invoke it.) +// +// (9) Whenever the database file is modified, at least one bit in the range +// of bytes from 24 through 39 inclusive will be changed prior to releasing +// the EXCLUSIVE lock, thus signaling other connections on the same +// database to flush their caches. +// +// (10) The pattern of bits in bytes 24 through 39 shall not repeat in less +// than one billion transactions. +// +// (11) A database file is well-formed at the beginning and at the conclusion +// of every transaction. +// +// (12) An EXCLUSIVE lock is held on the database file when writing to +// the database file. +// +// (13) A SHARED lock is held on the database file while reading any +// content out of the database file. +// +// + +// Macros for troubleshooting. Normally turned off + +// The following two macros are used within the PAGERTRACE() macros above +// to print out file-descriptors. +// +// PAGERID() takes a pointer to a Pager struct as its argument. The +// associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file +// struct as its argument. + +// The Pager.eState variable stores the current 'state' of a pager. A +// pager may be in any one of the seven states shown in the following +// state diagram. +// +// OPEN <------+------+ +// | | | +// V | | +// +---------> READER-------+ | +// | | | +// | V | +// |<-------WRITER_LOCKED------> ERROR +// | | ^ +// | V | +// |<------WRITER_CACHEMOD-------->| +// | | | +// | V | +// |<-------WRITER_DBMOD---------->| +// | | | +// | V | +// +<------WRITER_FINISHED-------->+ +// +// +// List of state transitions and the C [function] that performs each: +// +// OPEN -> READER [sqlite3PagerSharedLock] +// READER -> OPEN [pager_unlock] +// +// READER -> WRITER_LOCKED [sqlite3PagerBegin] +// WRITER_LOCKED -> WRITER_CACHEMOD [pager_open_journal] +// WRITER_CACHEMOD -> WRITER_DBMOD [syncJournal] +// WRITER_DBMOD -> WRITER_FINISHED [sqlite3PagerCommitPhaseOne] +// WRITER_*** -> READER [pager_end_transaction] +// +// WRITER_*** -> ERROR [pager_error] +// ERROR -> OPEN [pager_unlock] +// +// +// OPEN: +// +// The pager starts up in this state. Nothing is guaranteed in this +// state - the file may or may not be locked and the database size is +// unknown. The database may not be read or written. +// +// * No read or write transaction is active. +// * Any lock, or no lock at all, may be held on the database file. +// * The dbSize, dbOrigSize and dbFileSize variables may not be trusted. +// +// READER: +// +// In this state all the requirements for reading the database in +// rollback (non-WAL) mode are met. Unless the pager is (or recently +// was) in exclusive-locking mode, a user-level read transaction is +// open. The database size is known in this state. +// +// A connection running with locking_mode=normal enters this state when +// it opens a read-transaction on the database and returns to state +// OPEN after the read-transaction is completed. However a connection +// running in locking_mode=exclusive (including temp databases) remains in +// this state even after the read-transaction is closed. The only way +// a locking_mode=exclusive connection can transition from READER to OPEN +// is via the ERROR state (see below). +// +// * A read transaction may be active (but a write-transaction cannot). +// * A SHARED or greater lock is held on the database file. +// * The dbSize variable may be trusted (even if a user-level read +// transaction is not active). The dbOrigSize and dbFileSize variables +// may not be trusted at this point. +// * If the database is a WAL database, then the WAL connection is open. +// * Even if a read-transaction is not open, it is guaranteed that +// there is no hot-journal in the file-system. +// +// WRITER_LOCKED: +// +// The pager moves to this state from READER when a write-transaction +// is first opened on the database. In WRITER_LOCKED state, all locks +// required to start a write-transaction are held, but no actual +// modifications to the cache or database have taken place. +// +// In rollback mode, a RESERVED or (if the transaction was opened with +// BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when +// moving to this state, but the journal file is not written to or opened +// to in this state. If the transaction is committed or rolled back while +// in WRITER_LOCKED state, all that is required is to unlock the database +// file. +// +// IN WAL mode, WalBeginWriteTransaction() is called to lock the log file. +// If the connection is running with locking_mode=exclusive, an attempt +// is made to obtain an EXCLUSIVE lock on the database file. +// +// * A write transaction is active. +// * If the connection is open in rollback-mode, a RESERVED or greater +// lock is held on the database file. +// * If the connection is open in WAL-mode, a WAL write transaction +// is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully +// called). +// * The dbSize, dbOrigSize and dbFileSize variables are all valid. +// * The contents of the pager cache have not been modified. +// * The journal file may or may not be open. +// * Nothing (not even the first header) has been written to the journal. +// +// WRITER_CACHEMOD: +// +// A pager moves from WRITER_LOCKED state to this state when a page is +// first modified by the upper layer. In rollback mode the journal file +// is opened (if it is not already open) and a header written to the +// start of it. The database file on disk has not been modified. +// +// * A write transaction is active. +// * A RESERVED or greater lock is held on the database file. +// * The journal file is open and the first header has been written +// to it, but the header has not been synced to disk. +// * The contents of the page cache have been modified. +// +// WRITER_DBMOD: +// +// The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state +// when it modifies the contents of the database file. WAL connections +// never enter this state (since they do not modify the database file, +// just the log file). +// +// * A write transaction is active. +// * An EXCLUSIVE or greater lock is held on the database file. +// * The journal file is open and the first header has been written +// and synced to disk. +// * The contents of the page cache have been modified (and possibly +// written to disk). +// +// WRITER_FINISHED: +// +// It is not possible for a WAL connection to enter this state. +// +// A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD +// state after the entire transaction has been successfully written into the +// database file. In this state the transaction may be committed simply +// by finalizing the journal file. Once in WRITER_FINISHED state, it is +// not possible to modify the database further. At this point, the upper +// layer must either commit or rollback the transaction. +// +// * A write transaction is active. +// * An EXCLUSIVE or greater lock is held on the database file. +// * All writing and syncing of journal and database data has finished. +// If no error occurred, all that remains is to finalize the journal to +// commit the transaction. If an error did occur, the caller will need +// to rollback the transaction. +// +// ERROR: +// +// The ERROR state is entered when an IO or disk-full error (including +// SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it +// difficult to be sure that the in-memory pager state (cache contents, +// db size etc.) are consistent with the contents of the file-system. +// +// Temporary pager files may enter the ERROR state, but in-memory pagers +// cannot. +// +// For example, if an IO error occurs while performing a rollback, +// the contents of the page-cache may be left in an inconsistent state. +// At this point it would be dangerous to change back to READER state +// (as usually happens after a rollback). Any subsequent readers might +// report database corruption (due to the inconsistent cache), and if +// they upgrade to writers, they may inadvertently corrupt the database +// file. To avoid this hazard, the pager switches into the ERROR state +// instead of READER following such an error. +// +// Once it has entered the ERROR state, any attempt to use the pager +// to read or write data returns an error. Eventually, once all +// outstanding transactions have been abandoned, the pager is able to +// transition back to OPEN state, discarding the contents of the +// page-cache and any other in-memory state at the same time. Everything +// is reloaded from disk (and, if necessary, hot-journal rollback peformed) +// when a read-transaction is next opened on the pager (transitioning +// the pager into READER state). At that point the system has recovered +// from the error. +// +// Specifically, the pager jumps into the ERROR state if: +// +// 1. An error occurs while attempting a rollback. This happens in +// function sqlite3PagerRollback(). +// +// 2. An error occurs while attempting to finalize a journal file +// following a commit in function sqlite3PagerCommitPhaseTwo(). +// +// 3. An error occurs while attempting to write to the journal or +// database file in function pagerStress() in order to free up +// memory. +// +// In other cases, the error is returned to the b-tree layer. The b-tree +// layer then attempts a rollback operation. If the error condition +// persists, the pager enters the ERROR state via condition (1) above. +// +// Condition (3) is necessary because it can be triggered by a read-only +// statement executed within a transaction. In this case, if the error +// code were simply returned to the user, the b-tree layer would not +// automatically attempt a rollback, as it assumes that an error in a +// read-only statement cannot leave the pager in an internally inconsistent +// state. +// +// * The Pager.errCode variable is set to something other than SQLITE_OK. +// * There are one or more outstanding references to pages (after the +// last reference is dropped the pager should move back to OPEN state). +// * The pager is not an in-memory pager. +// +// +// Notes: +// +// * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the +// connection is open in WAL mode. A WAL connection is always in one +// of the first four states. +// +// * Normally, a connection open in exclusive mode is never in PAGER_OPEN +// state. There are two exceptions: immediately after exclusive-mode has +// been turned on (and before any read or write transactions are +// executed), and when the pager is leaving the "error state". +// +// * See also: assert_pager_state(). + +// The Pager.eLock variable is almost always set to one of the +// following locking-states, according to the lock currently held on +// the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK. +// This variable is kept up to date as locks are taken and released by +// the pagerLockDb() and pagerUnlockDb() wrappers. +// +// If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY +// (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not +// the operation was successful. In these circumstances pagerLockDb() and +// pagerUnlockDb() take a conservative approach - eLock is always updated +// when unlocking the file, and only updated when locking the file if the +// VFS call is successful. This way, the Pager.eLock variable may be set +// to a less exclusive (lower) value than the lock that is actually held +// at the system level, but it is never set to a more exclusive value. +// +// This is usually safe. If an xUnlock fails or appears to fail, there may +// be a few redundant xLock() calls or a lock may be held for longer than +// required, but nothing really goes wrong. +// +// The exception is when the database file is unlocked as the pager moves +// from ERROR to OPEN state. At this point there may be a hot-journal file +// in the file-system that needs to be rolled back (as part of an OPEN->SHARED +// transition, by the same pager or any other). If the call to xUnlock() +// fails at this point and the pager is left holding an EXCLUSIVE lock, this +// can confuse the call to xCheckReservedLock() call made later as part +// of hot-journal detection. +// +// xCheckReservedLock() is defined as returning true "if there is a RESERVED +// lock held by this process or any others". So xCheckReservedLock may +// return true because the caller itself is holding an EXCLUSIVE lock (but +// doesn't know it because of a previous error in xUnlock). If this happens +// a hot-journal may be mistaken for a journal being created by an active +// transaction in another process, causing SQLite to read from the database +// without rolling it back. +// +// To work around this, if a call to xUnlock() fails when unlocking the +// database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It +// is only changed back to a real locking state after a successful call +// to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition +// omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK +// lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE +// lock on the database file before attempting to roll it back. See function +// PagerSharedLock() for more detail. +// +// Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in +// PAGER_OPEN state. + +// The maximum allowed sector size. 64KiB. If the xSectorsize() method +// returns a value larger than this, then MAX_SECTOR_SIZE is used instead. +// This could conceivably cause corruption following a power failure on +// such a system. This is currently an undocumented limit. + +// An instance of the following structure is allocated for each active +// savepoint and statement transaction in the system. All such structures +// are stored in the Pager.aSavepoint[] array, which is allocated and +// resized using sqlite3Realloc(). +// +// When a savepoint is created, the PagerSavepoint.iHdrOffset field is +// set to 0. If a journal-header is written into the main journal while +// the savepoint is active, then iHdrOffset is set to the byte offset +// immediately following the last journal record written into the main +// journal before the journal-header. This is required during savepoint +// rollback (see pagerPlaybackSavepoint()). +type PagerSavepoint = PagerSavepoint1 /* sqlite3.c:53074:31 */ + +// Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains +// the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS +// or CACHE_WRITE to sqlite3_db_status(). + +// The following global variables hold counters used for +// testing purposes only. These variables do not exist in +// a non-testing build. These variables are not thread-safe. + +// Journal files begin with the following magic string. The data +// was obtained from /dev/random. It is used only as a sanity check. +// +// Since version 2.8.0, the journal format contains additional sanity +// checking information. If the power fails while the journal is being +// written, semi-random garbage data might appear in the journal +// file after power is restored. If an attempt is then made +// to roll the journal back, the database could be corrupted. The additional +// sanity checking data is an attempt to discover the garbage in the +// journal and ignore it. +// +// The sanity checking information for the new journal format consists +// of a 32-bit checksum on each page of data. The checksum covers both +// the page number and the pPager->pageSize bytes of data for the page. +// This cksum is initialized to a 32-bit random value that appears in the +// journal file right after the header. The random initializer is important, +// because garbage data that appears at the end of a journal is likely +// data that was once in other files that have now been deleted. If the +// garbage data came from an obsolete journal file, the checksums might +// be correct. But by initializing the checksum to random value which +// is different for every journal, we minimize that risk. +var aJournalMagic = [8]uint8{ + uint8(0xd9), uint8(0xd5), uint8(0x05), uint8(0xf9), uint8(0x20), uint8(0xa1), uint8(0x63), uint8(0xd7), +} /* sqlite3.c:53395:28 */ + +// Set the Pager.xGet method for the appropriate routine used to fetch +// content from the pager. +func setGetterMethod(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:53688:13: */ + if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + (*Pager)(unsafe.Pointer(pPager)).FxGet = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Pgno, uintptr, int32) int32 + }{getPageError})) + } else if (*Pager)(unsafe.Pointer(pPager)).FbUseFetch != 0 { + (*Pager)(unsafe.Pointer(pPager)).FxGet = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Pgno, uintptr, int32) int32 + }{getPageMMap})) + } else { + (*Pager)(unsafe.Pointer(pPager)).FxGet = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Pgno, uintptr, int32) int32 + }{getPageNormal})) + } +} + +// Return true if it is necessary to write page *pPg into the sub-journal. +// A page needs to be written into the sub-journal if there exists one +// or more open savepoints for which: +// +// * The page-number is less than or equal to PagerSavepoint.nOrig, and +// * The bit corresponding to the page-number is not set in +// PagerSavepoint.pInSavepoint. +func subjRequiresPage(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:53709:12: */ + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + var p uintptr + var pgno Pgno = (*PgHdr)(unsafe.Pointer(pPg)).Fpgno + var i int32 + for i = 0; i < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint; i++ { + p = ((*Pager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56) + if ((*PagerSavepoint)(unsafe.Pointer(p)).FnOrig >= pgno) && (0 == Xsqlite3BitvecTestNotNull(tls, (*PagerSavepoint)(unsafe.Pointer(p)).FpInSavepoint, pgno)) { + for i = (i + 1); i < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint; i++ { + (*PagerSavepoint)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(i)*56)).FbTruncateOnRelease = 0 + } + return 1 + } + } + return 0 +} + +// Read a 32-bit integer from the given file descriptor. Store the integer +// that is read in *pRes. Return SQLITE_OK if everything worked, or an +// error code is something goes wrong. +// +// All values are stored on disk as big-endian. +func read32bits(tls *libc.TLS, fd uintptr, offset I64, pRes uintptr) int32 { /* sqlite3.c:53742:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var ac [4]uint8 at bp, 4 + + var rc int32 = Xsqlite3OsRead(tls, fd, bp /* &ac[0] */, int32(unsafe.Sizeof([4]uint8{})), offset) + if rc == SQLITE_OK { + *(*U32)(unsafe.Pointer(pRes)) = Xsqlite3Get4byte(tls, bp /* &ac[0] */) + } + return rc +} + +// Write a 32-bit integer into a string buffer in big-endian byte order. + +// Write a 32-bit integer into the given file descriptor. Return SQLITE_OK +// on success or an error code is something goes wrong. +func write32bits(tls *libc.TLS, fd uintptr, offset I64, val U32) int32 { /* sqlite3.c:53761:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var ac [4]int8 at bp, 4 + + Xsqlite3Put4byte(tls, bp /* ac */, val) + return Xsqlite3OsWrite(tls, fd, bp /* &ac[0] */, 4, offset) +} + +// Unlock the database file to level eLock, which must be either NO_LOCK +// or SHARED_LOCK. Regardless of whether or not the call to xUnlock() +// succeeds, set the Pager.eLock variable to match the (attempted) new lock. +// +// Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is +// called, do not modify it. See the comment above the #define of +// UNKNOWN_LOCK for an explanation of this. +func pagerUnlockDb(tls *libc.TLS, pPager uintptr, eLock int32) int32 { /* sqlite3.c:53776:12: */ + var rc int32 = SQLITE_OK + + if (*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0) { + + if (*Pager)(unsafe.Pointer(pPager)).FnoLock != 0 { + rc = SQLITE_OK + } else { + rc = Xsqlite3OsUnlock(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, eLock) + } + if int32((*Pager)(unsafe.Pointer(pPager)).FeLock) != (EXCLUSIVE_LOCK + 1) { + (*Pager)(unsafe.Pointer(pPager)).FeLock = U8(eLock) + } + + } + (*Pager)(unsafe.Pointer(pPager)).FchangeCountDone = (*Pager)(unsafe.Pointer(pPager)).FtempFile // ticket fb3b3024ea238d5c + return rc +} + +// Lock the database file to level eLock, which must be either SHARED_LOCK, +// RESERVED_LOCK or EXCLUSIVE_LOCK. If the caller is successful, set the +// Pager.eLock variable to the new locking state. +// +// Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is +// called, do not modify it unless the new locking state is EXCLUSIVE_LOCK. +// See the comment above the #define of UNKNOWN_LOCK for an explanation +// of this. +func pagerLockDb(tls *libc.TLS, pPager uintptr, eLock int32) int32 { /* sqlite3.c:53804:12: */ + var rc int32 = SQLITE_OK + + if (int32((*Pager)(unsafe.Pointer(pPager)).FeLock) < eLock) || (int32((*Pager)(unsafe.Pointer(pPager)).FeLock) == (EXCLUSIVE_LOCK + 1)) { + if (*Pager)(unsafe.Pointer(pPager)).FnoLock != 0 { + rc = SQLITE_OK + } else { + rc = Xsqlite3OsLock(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, eLock) + } + if (rc == SQLITE_OK) && ((int32((*Pager)(unsafe.Pointer(pPager)).FeLock) != (EXCLUSIVE_LOCK + 1)) || (eLock == EXCLUSIVE_LOCK)) { + (*Pager)(unsafe.Pointer(pPager)).FeLock = U8(eLock) + + } + } + return rc +} + +// This function determines whether or not the atomic-write or +// atomic-batch-write optimizations can be used with this pager. The +// atomic-write optimization can be used if: +// +// (a) the value returned by OsDeviceCharacteristics() indicates that +// a database page may be written atomically, and +// (b) the value returned by OsSectorSize() is less than or equal +// to the page size. +// +// If it can be used, then the value returned is the size of the journal +// file when it contains rollback data for exactly one page. +// +// The atomic-batch-write optimization can be used if OsDeviceCharacteristics() +// returns a value with the SQLITE_IOCAP_BATCH_ATOMIC bit set. -1 is +// returned in this case. +// +// If neither optimization can be used, 0 is returned. +func jrnlBufferSize(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:53837:12: */ + + _ = pPager + + return 0 +} + +// If SQLITE_CHECK_PAGES is defined then we do some sanity checking +// on the cache using a hash function. This is used for testing +// and debugging only. + +// When this is called the journal file for pager pPager must be open. +// This function attempts to read a super-journal file name from the +// end of the file and, if successful, copies it into memory supplied +// by the caller. See comments above writeSuperJournal() for the format +// used to store a super-journal file name at the end of a journal file. +// +// zSuper must point to a buffer of at least nSuper bytes allocated by +// the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is +// enough space to write the super-journal name). If the super-journal +// name in the journal is longer than nSuper bytes (including a +// nul-terminator), then this is handled as if no super-journal name +// were present in the journal. +// +// If a super-journal file name is present at the end of the journal +// file, then it is copied into the buffer pointed to by zSuper. A +// nul-terminator byte is appended to the buffer following the +// super-journal file name. +// +// If it is determined that no super-journal file name is present +// zSuper[0] is set to 0 and SQLITE_OK returned. +// +// If an error occurs while reading from the journal file, an SQLite +// error code is returned. +func readSuperJournal(tls *libc.TLS, pJrnl uintptr, zSuper uintptr, nSuper U32) int32 { /* sqlite3.c:53942:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 // Return code + // var len U32 at bp+8, 4 + // Length in bytes of super-journal name + // var szJ I64 at bp, 8 + // Total size in bytes of journal file pJrnl + // var cksum U32 at bp+12, 4 + // MJ checksum value read from journal + var u U32 // Unsigned loop counter + // var aMagic [8]uint8 at bp+16, 8 + // A buffer to hold the magic header + *(*int8)(unsafe.Pointer(zSuper)) = int8(0) + + if (((((((((SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsFileSize(tls, pJrnl, bp /* &szJ */)))) || + (*(*I64)(unsafe.Pointer(bp /* szJ */)) < int64(16))) || + (SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, pJrnl, (*(*I64)(unsafe.Pointer(bp /* szJ */))-int64(16)), bp+8 /* &len */))))) || + (*(*U32)(unsafe.Pointer(bp + 8 /* len */)) >= nSuper)) || + (I64(*(*U32)(unsafe.Pointer(bp + 8 /* len */))) > (*(*I64)(unsafe.Pointer(bp /* szJ */)) - int64(16)))) || + (*(*U32)(unsafe.Pointer(bp + 8 /* len */)) == U32(0))) || + (SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, pJrnl, (*(*I64)(unsafe.Pointer(bp /* szJ */))-int64(12)), bp+12 /* &cksum */))))) || + (SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsRead(tls, pJrnl, bp+16 /* &aMagic[0] */, 8, (*(*I64)(unsafe.Pointer(bp /* szJ */))-int64(8))))))) || + (libc.Xmemcmp(tls, bp+16 /* &aMagic[0] */, uintptr(unsafe.Pointer(&aJournalMagic)), uint64(8)) != 0)) || + (SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsRead(tls, pJrnl, zSuper, int32(*(*U32)(unsafe.Pointer(bp + 8 /* len */))), ((*(*I64)(unsafe.Pointer(bp /* szJ */))-int64(16))-I64(*(*U32)(unsafe.Pointer(bp + 8 /* len */)))))))) { + return rc + } + + // See if the checksum matches the super-journal name + for u = U32(0); u < *(*U32)(unsafe.Pointer(bp + 8 /* len */)); u++ { + *(*U32)(unsafe.Pointer(bp + 12 /* cksum */)) -= U32(*(*int8)(unsafe.Pointer(zSuper + uintptr(u)))) + } + if *(*U32)(unsafe.Pointer(bp + 12 /* cksum */)) != 0 { + // If the checksum doesn't add up, then one or more of the disk sectors + // containing the super-journal filename is corrupted. This means + // definitely roll back, so just return SQLITE_OK and report a (nul) + // super-journal filename. + *(*U32)(unsafe.Pointer(bp + 8 /* len */)) = U32(0) + } + *(*int8)(unsafe.Pointer(zSuper + uintptr(*(*U32)(unsafe.Pointer(bp + 8 /* len */))))) = int8(0) + *(*int8)(unsafe.Pointer(zSuper + uintptr((*(*U32)(unsafe.Pointer(bp + 8 /* len */)) + U32(1))))) = int8(0) + + return SQLITE_OK +} + +// Return the offset of the sector boundary at or immediately +// following the value in pPager->journalOff, assuming a sector +// size of pPager->sectorSize bytes. +// +// i.e for a sector size of 512: +// +// Pager.journalOff Return value +// --------------------------------------- +// 0 0 +// 512 512 +// 100 512 +// 2000 2048 +// +func journalHdrOffset(tls *libc.TLS, pPager uintptr) I64 { /* sqlite3.c:53998:12: */ + var offset I64 = int64(0) + var c I64 = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + if c != 0 { + offset = ((((c - int64(1)) / (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) + int64(1)) * (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) + } + + return offset +} + +// The journal file must be open when this function is called. +// +// This function is a no-op if the journal file has not been written to +// within the current transaction (i.e. if Pager.journalOff==0). +// +// If doTruncate is non-zero or the Pager.journalSizeLimit variable is +// set to 0, then truncate the journal file to zero bytes in size. Otherwise, +// zero the 28-byte header at the start of the journal file. In either case, +// if the pager is not in no-sync mode, sync the journal file immediately +// after writing or truncating it. +// +// If Pager.journalSizeLimit is set to a positive, non-zero value, and +// following the truncation or zeroing described above the size of the +// journal file in bytes is larger than this value, then truncate the +// journal file to Pager.journalSizeLimit bytes. The journal file does +// not need to be synced following this operation. +// +// If an IO error occurs, abandon processing and return the IO error code. +// Otherwise, return SQLITE_OK. +func zeroJournalHdr(tls *libc.TLS, pPager uintptr, doTruncate int32) int32 { /* sqlite3.c:54031:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK // Return code + + if (*Pager)(unsafe.Pointer(pPager)).FjournalOff != 0 { + var iLimit I64 = (*Pager)(unsafe.Pointer(pPager)).FjournalSizeLimit // Local cache of jsl + + if (doTruncate != 0) || (iLimit == int64(0)) { + rc = Xsqlite3OsTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, int64(0)) + } else { + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, uintptr(unsafe.Pointer(&zeroHdr)), int32(unsafe.Sizeof(zeroHdr)), int64(0)) + } + if (rc == SQLITE_OK) && !(int32((*Pager)(unsafe.Pointer(pPager)).FnoSync) != 0) { + rc = Xsqlite3OsSync(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (SQLITE_SYNC_DATAONLY | int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags))) + } + + // At this point the transaction is committed but the write lock + // is still held on the file. If there is a size limit configured for + // the persistent journal and the journal file currently consumes more + // space than that limit allows for, truncate it now. There is no need + // to sync the file following this operation. + if (rc == SQLITE_OK) && (iLimit > int64(0)) { + // var sz I64 at bp, 8 + + rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp /* &sz */) + if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp /* sz */)) > iLimit) { + rc = Xsqlite3OsTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, iLimit) + } + } + } + return rc +} + +var zeroHdr = [28]int8{0: int8(0)} /* sqlite3.c:54042:25 */ + +// The journal file must be open when this routine is called. A journal +// header (JOURNAL_HDR_SZ bytes) is written into the journal file at the +// current location. +// +// The format for the journal header is as follows: +// - 8 bytes: Magic identifying journal format. +// - 4 bytes: Number of records in journal, or -1 no-sync mode is on. +// - 4 bytes: Random number used for page hash. +// - 4 bytes: Initial database page count. +// - 4 bytes: Sector size used by the process that wrote this journal. +// - 4 bytes: Database page size. +// +// Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space. +func writeJournalHdr(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:54081:12: */ + var rc int32 = SQLITE_OK // Return code + var zHeader uintptr = (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace // Temporary space used to build header + var nHeader U32 = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) // Size of buffer pointed to by zHeader + var nWrite U32 // Bytes of header sector written + var ii int32 // Loop counter + + // Journal file must be open. + + if nHeader > ((*Pager)(unsafe.Pointer(pPager)).FsectorSize) { + nHeader = (*Pager)(unsafe.Pointer(pPager)).FsectorSize + } + + // If there are active savepoints and any of them were created + // since the most recent journal header was written, update the + // PagerSavepoint.iHdrOffset fields now. + for ii = 0; ii < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint; ii++ { + if (*PagerSavepoint)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FaSavepoint+uintptr(ii)*56)).FiHdrOffset == int64(0) { + (*PagerSavepoint)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56)).FiHdrOffset = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + } + } + + (*Pager)(unsafe.Pointer(pPager)).FjournalHdr = libc.AssignPtrInt64(pPager+96 /* &.journalOff */, journalHdrOffset(tls, pPager)) + + // Write the nRec Field - the number of page records that follow this + // journal header. Normally, zero is written to this value at this time. + // After the records are added to the journal (and the journal synced, + // if in full-sync mode), the zero is overwritten with the true number + // of records (see syncJournal()). + // + // A faster alternative is to write 0xFFFFFFFF to the nRec field. When + // reading the journal this value tells SQLite to assume that the + // rest of the journal file contains valid page records. This assumption + // is dangerous, as if a failure occurred whilst writing to the journal + // file it may contain some garbage data. There are two scenarios + // where this risk can be ignored: + // + // * When the pager is in no-sync mode. Corruption can follow a + // power failure in this case anyway. + // + // * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees + // that garbage data is never appended to the journal file. + + if (((*Pager)(unsafe.Pointer(pPager)).FnoSync != 0) || (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_MEMORY)) || + ((Xsqlite3OsDeviceCharacteristics(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd) & SQLITE_IOCAP_SAFE_APPEND) != 0) { + libc.Xmemcpy(tls, zHeader, uintptr(unsafe.Pointer(&aJournalMagic)), uint64(unsafe.Sizeof(aJournalMagic))) + Xsqlite3Put4byte(tls, (zHeader + 8), 0xffffffff) + } else { + libc.Xmemset(tls, zHeader, 0, (uint64(unsafe.Sizeof(aJournalMagic)) + uint64(4))) + } + + // The random check-hash initializer + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), (pPager + 52 /* &.cksumInit */)) + Xsqlite3Put4byte(tls, (zHeader + 12), (*Pager)(unsafe.Pointer(pPager)).FcksumInit) + // The initial database size + Xsqlite3Put4byte(tls, (zHeader + 16), (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize) + // The assumed sector size for this process + Xsqlite3Put4byte(tls, (zHeader + 20), (*Pager)(unsafe.Pointer(pPager)).FsectorSize) + + // The page size + Xsqlite3Put4byte(tls, (zHeader + 24), uint32((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + + // Initializing the tail of the buffer is not necessary. Everything + // works find if the following memset() is omitted. But initializing + // the memory prevents valgrind from complaining, so we are willing to + // take the performance hit. + libc.Xmemset(tls, (zHeader + 28), 0, + (uint64(nHeader) - (uint64(unsafe.Sizeof(aJournalMagic)) + uint64(20)))) + + // In theory, it is only necessary to write the 28 bytes that the + // journal header consumes to the journal file here. Then increment the + // Pager.journalOff variable by JOURNAL_HDR_SZ so that the next + // record is written to the following sector (leaving a gap in the file + // that will be implicitly filled in by the OS). + // + // However it has been discovered that on some systems this pattern can + // be significantly slower than contiguously writing data to the file, + // even if that means explicitly writing data to the block of + // (JOURNAL_HDR_SZ - 28) bytes that will not be used. So that is what + // is done. + // + // The loop is required here in case the sector-size is larger than the + // database page size. Since the zHeader buffer is only Pager.pageSize + // bytes in size, more than one call to sqlite3OsWrite() may be required + // to populate the entire journal header sector. + for nWrite = U32(0); (rc == SQLITE_OK) && (nWrite < ((*Pager)(unsafe.Pointer(pPager)).FsectorSize)); nWrite = nWrite + (nHeader) { + + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, zHeader, int32(nHeader), (*Pager)(unsafe.Pointer(pPager)).FjournalOff) + + *(*I64)(unsafe.Pointer(pPager + 96 /* &.journalOff */)) += (I64(nHeader)) + } + + return rc +} + +// The journal file must be open when this is called. A journal header file +// (JOURNAL_HDR_SZ bytes) is read from the current location in the journal +// file. The current location in the journal file is given by +// pPager->journalOff. See comments above function writeJournalHdr() for +// a description of the journal header format. +// +// If the header is read successfully, *pNRec is set to the number of +// page records following this header and *pDbSize is set to the size of the +// database before the transaction began, in pages. Also, pPager->cksumInit +// is set to the value read from the journal header. SQLITE_OK is returned +// in this case. +// +// If the journal header file appears to be corrupted, SQLITE_DONE is +// returned and *pNRec and *PDbSize are undefined. If JOURNAL_HDR_SZ bytes +// cannot be read from the journal file an error code is returned. +func readJournalHdr(tls *libc.TLS, pPager uintptr, isHot int32, journalSize I64, pNRec uintptr, pDbSize uintptr) int32 { /* sqlite3.c:54199:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var aMagic [8]uint8 at bp, 8 + // A buffer to hold the magic header + var iHdrOff I64 // Offset of journal header being read + + // Journal file must be open. + + // Advance Pager.journalOff to the start of the next sector. If the + // journal file is too small for there to be a header stored at this + // point, return SQLITE_DONE. + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = journalHdrOffset(tls, pPager) + if ((*Pager)(unsafe.Pointer(pPager)).FjournalOff + (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) > journalSize { + return SQLITE_DONE + } + iHdrOff = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + + // Read in the first 8 bytes of the journal header. If they do not match + // the magic string found at the start of each journal header, return + // SQLITE_DONE. If an IO error occurs, return an error code. Otherwise, + // proceed. + if (isHot != 0) || (iHdrOff != (*Pager)(unsafe.Pointer(pPager)).FjournalHdr) { + rc = Xsqlite3OsRead(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp /* &aMagic[0] */, int32(unsafe.Sizeof([8]uint8{})), iHdrOff) + if rc != 0 { + return rc + } + if libc.Xmemcmp(tls, bp /* &aMagic[0] */, uintptr(unsafe.Pointer(&aJournalMagic)), uint64(unsafe.Sizeof([8]uint8{}))) != 0 { + return SQLITE_DONE + } + } + + // Read the first three 32-bit fields of the journal header: The nRec + // field, the checksum-initializer and the database size at the start + // of the transaction. Return an error code if anything goes wrong. + if ((SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (iHdrOff+int64(8)), pNRec)))) || + (SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (iHdrOff+int64(12)), (pPager+52 /* &.cksumInit */)))))) || + (SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (iHdrOff+int64(16)), pDbSize)))) { + return rc + } + + if (*Pager)(unsafe.Pointer(pPager)).FjournalOff == int64(0) { + // var iPageSize U32 at bp+12, 4 + // Page-size field of journal header + // var iSectorSize U32 at bp+8, 4 + // Sector-size field of journal header + + // Read the page-size and sector-size journal header fields. + if (SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (iHdrOff+int64(20)), bp+8 /* &iSectorSize */)))) || + (SQLITE_OK != (libc.AssignInt32(&rc, read32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (iHdrOff+int64(24)), bp+12 /* &iPageSize */)))) { + return rc + } + + // Versions of SQLite prior to 3.5.8 set the page-size field of the + // journal header to zero. In this case, assume that the Pager.pageSize + // variable is already set to the correct page size. + if *(*U32)(unsafe.Pointer(bp + 12 /* iPageSize */)) == U32(0) { + *(*U32)(unsafe.Pointer(bp + 12 /* iPageSize */)) = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) + } + + // Check that the values read from the page-size and sector-size fields + // are within range. To be 'in range', both values need to be a power + // of two greater than or equal to 512 or 32, and not greater than their + // respective compile time maximum limits. + if (((((*(*U32)(unsafe.Pointer(bp + 12 /* iPageSize */)) < U32(512)) || (*(*U32)(unsafe.Pointer(bp + 8 /* iSectorSize */)) < U32(32))) || + (*(*U32)(unsafe.Pointer(bp + 12 /* iPageSize */)) > U32(SQLITE_MAX_PAGE_SIZE))) || (*(*U32)(unsafe.Pointer(bp + 8 /* iSectorSize */)) > U32(MAX_SECTOR_SIZE))) || + (((*(*U32)(unsafe.Pointer(bp + 12 /* iPageSize */)) - U32(1)) & *(*U32)(unsafe.Pointer(bp + 12 /* iPageSize */))) != U32(0))) || (((*(*U32)(unsafe.Pointer(bp + 8 /* iSectorSize */)) - U32(1)) & *(*U32)(unsafe.Pointer(bp + 8 /* iSectorSize */))) != U32(0)) { + // If the either the page-size or sector-size in the journal-header is + // invalid, then the process that wrote the journal-header must have + // crashed before the header was synced. In this case stop reading + // the journal file here. + return SQLITE_DONE + } + + // Update the page-size to match the value read from the journal. + // Use a testcase() macro to make sure that malloc failure within + // PagerSetPagesize() is tested. + rc = Xsqlite3PagerSetPagesize(tls, pPager, bp+12 /* &iPageSize */, -1) + + // Update the assumed sector-size to match the value used by + // the process that created this journal. If this journal was + // created by a process other than this one, then this routine + // is being called from within pager_playback(). The local value + // of Pager.sectorSize is restored at the end of that routine. + (*Pager)(unsafe.Pointer(pPager)).FsectorSize = *(*U32)(unsafe.Pointer(bp + 8 /* iSectorSize */)) + } + + *(*I64)(unsafe.Pointer(pPager + 96 /* &.journalOff */)) += (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize)) + return rc +} + +// Write the supplied super-journal name into the journal file for pager +// pPager at the current location. The super-journal name must be the last +// thing written to a journal file. If the pager is in full-sync mode, the +// journal file descriptor is advanced to the next sector boundary before +// anything is written. The format is: +// +// + 4 bytes: PAGER_MJ_PGNO. +// + N bytes: super-journal filename in utf-8. +// + 4 bytes: N (length of super-journal name in bytes, no nul-terminator). +// + 4 bytes: super-journal name checksum. +// + 8 bytes: aJournalMagic[]. +// +// The super-journal page checksum is the sum of the bytes in thesuper-journal +// name, where each byte is interpreted as a signed 8-bit integer. +// +// If zSuper is a NULL pointer (occurs for a single database transaction), +// this call is a no-op. +func writeSuperJournal(tls *libc.TLS, pPager uintptr, zSuper uintptr) int32 { /* sqlite3.c:54324:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 // Return code + var nSuper int32 // Length of string zSuper + var iHdrOff I64 // Offset of header in journal file + // var jrnlSize I64 at bp, 8 + // Size of journal file on disk + var cksum U32 = U32(0) // Checksum of string zSuper + + if (!(zSuper != 0) || + (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_MEMORY)) || + !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) { + return SQLITE_OK + } + (*Pager)(unsafe.Pointer(pPager)).FsetSuper = U8(1) + + // Calculate the length in bytes and the checksum of zSuper + for nSuper = 0; *(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper))) != 0; nSuper++ { + cksum = cksum + (U32(*(*int8)(unsafe.Pointer(zSuper + uintptr(nSuper))))) + } + + // If in full-sync mode, advance to the next disk sector before writing + // the super-journal name. This is in case the previous page written to + // the journal has already been synced. + if (*Pager)(unsafe.Pointer(pPager)).FfullSync != 0 { + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = journalHdrOffset(tls, pPager) + } + iHdrOff = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + + // Write the super-journal data to the end of the journal file. If + // an error occurs, return the error code to the caller. + if ((((0 != (libc.AssignInt32(&rc, write32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, iHdrOff, (Pgno((Xsqlite3PendingByte/((*Pager)(unsafe.Pointer(pPager)).FpageSize))+1)))))) || + (0 != (libc.AssignInt32(&rc, Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, zSuper, nSuper, (iHdrOff+int64(4))))))) || + (0 != (libc.AssignInt32(&rc, write32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, ((iHdrOff+int64(4))+I64(nSuper)), uint32(nSuper)))))) || + (0 != (libc.AssignInt32(&rc, write32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (((iHdrOff+int64(4))+I64(nSuper))+int64(4)), cksum))))) || + (0 != (libc.AssignInt32(&rc, Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, uintptr(unsafe.Pointer(&aJournalMagic)), 8, + (((iHdrOff+int64(4))+I64(nSuper))+int64(8)))))) { + return rc + } + *(*I64)(unsafe.Pointer(pPager + 96 /* &.journalOff */)) += (I64(nSuper + 20)) + + // If the pager is in peristent-journal mode, then the physical + // journal-file may extend past the end of the super-journal name + // and 8 bytes of magic data just written to the file. This is + // dangerous because the code to rollback a hot-journal file + // will not be able to find the super-journal name to determine + // whether or not the journal is hot. + // + // Easiest thing to do in this scenario is to truncate the journal + // file to the required size. + if (SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp /* &jrnlSize */)))) && + (*(*I64)(unsafe.Pointer(bp /* jrnlSize */)) > (*Pager)(unsafe.Pointer(pPager)).FjournalOff) { + rc = Xsqlite3OsTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (*Pager)(unsafe.Pointer(pPager)).FjournalOff) + } + return rc +} + +// Discard the entire contents of the in-memory page-cache. +func pager_reset(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:54392:13: */ + (*Pager)(unsafe.Pointer(pPager)).FiDataVersion++ + Xsqlite3BackupRestart(tls, (*Pager)(unsafe.Pointer(pPager)).FpBackup) + Xsqlite3PcacheClear(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) +} + +// Return the pPager->iDataVersion value +func Xsqlite3PagerDataVersion(tls *libc.TLS, pPager uintptr) U32 { /* sqlite3.c:54401:20: */ + return (*Pager)(unsafe.Pointer(pPager)).FiDataVersion +} + +// Free all structures in the Pager.aSavepoint[] array and set both +// Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal +// if it is open and the pager is not in exclusive mode. +func releaseAllSavepoints(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:54410:13: */ + var ii int32 // Iterator for looping through Pager.aSavepoint + for ii = 0; ii < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint; ii++ { + Xsqlite3BitvecDestroy(tls, (*PagerSavepoint)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FaSavepoint+uintptr(ii)*56)).FpInSavepoint) + } + if !(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) || (Xsqlite3JournalIsInMemory(tls, (*Pager)(unsafe.Pointer(pPager)).Fsjfd) != 0) { + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fsjfd) + } + Xsqlite3_free(tls, (*Pager)(unsafe.Pointer(pPager)).FaSavepoint) + (*Pager)(unsafe.Pointer(pPager)).FaSavepoint = uintptr(0) + (*Pager)(unsafe.Pointer(pPager)).FnSavepoint = 0 + (*Pager)(unsafe.Pointer(pPager)).FnSubRec = U32(0) +} + +// Set the bit number pgno in the PagerSavepoint.pInSavepoint +// bitvecs of all open savepoints. Return SQLITE_OK if successful +// or SQLITE_NOMEM if a malloc failure occurs. +func addToSavepointBitvecs(tls *libc.TLS, pPager uintptr, pgno Pgno) int32 { /* sqlite3.c:54429:12: */ + var ii int32 // Loop counter + var rc int32 = SQLITE_OK // Result code + + for ii = 0; ii < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint; ii++ { + var p uintptr = ((*Pager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(ii)*56) + if pgno <= (*PagerSavepoint)(unsafe.Pointer(p)).FnOrig { + rc = rc | (Xsqlite3BitvecSet(tls, (*PagerSavepoint)(unsafe.Pointer(p)).FpInSavepoint, pgno)) + + } + } + return rc +} + +// This function is a no-op if the pager is in exclusive mode and not +// in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN +// state. +// +// If the pager is not in exclusive-access mode, the database file is +// completely unlocked. If the file is unlocked and the file-system does +// not exhibit the UNDELETABLE_WHEN_OPEN property, the journal file is +// closed (if it is open). +// +// If the pager is in ERROR state when this function is called, the +// contents of the pager cache are discarded before switching back to +// the OPEN state. Regardless of whether the pager is in exclusive-mode +// or not, any journal file left in the file-system will be treated +// as a hot-journal and rolled back the next time a read-transaction +// is opened (by this or by any other connection). +func pager_unlock(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:54461:13: */ + + Xsqlite3BitvecDestroy(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal) + (*Pager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) + releaseAllSavepoints(tls, pPager) + + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + + Xsqlite3WalEndReadTransaction(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_OPEN) + } else if !(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) { + var rc int32 // Error code returned by pagerUnlockDb() + var iDc int32 + if (*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0) { + iDc = Xsqlite3OsDeviceCharacteristics(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd) + } else { + iDc = 0 + } + + // If the operating system support deletion of open files, then + // close the journal file when dropping the database lock. Otherwise + // another connection with journal_mode=delete might delete the file + // out from under us. + + if (0 == (iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN)) || + (1 != (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) & 5)) { + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + } + + // If the pager is in the ERROR state and the call to unlock the database + // file fails, set the current lock to UNKNOWN_LOCK. See the comment + // above the #define for UNKNOWN_LOCK for an explanation of why this + // is necessary. + rc = pagerUnlockDb(tls, pPager, NO_LOCK) + if (rc != SQLITE_OK) && (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_ERROR) { + (*Pager)(unsafe.Pointer(pPager)).FeLock = (U8(EXCLUSIVE_LOCK + 1)) + } + + // The pager state may be changed from PAGER_ERROR to PAGER_OPEN here + // without clearing the error code. This is intentional - the error + // code is cleared and the cache reset in the block below. + + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_OPEN) + } + + // If Pager.errCode is set, the contents of the pager cache cannot be + // trusted. Now that there are no outstanding references to the pager, + // it can safely move back to PAGER_OPEN state. This happens in both + // normal and exclusive-locking mode. + + if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + if int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) == 0 { + pager_reset(tls, pPager) + (*Pager)(unsafe.Pointer(pPager)).FchangeCountDone = U8(0) + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_OPEN) + } else { + (*Pager)(unsafe.Pointer(pPager)).FeState = func() uint8 { + if (*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0) { + return uint8(PAGER_OPEN) + } + return uint8(PAGER_READER) + }() + } + if (*Pager)(unsafe.Pointer(pPager)).FbUseFetch != 0 { + Xsqlite3OsUnfetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, int64(0), uintptr(0)) + } + (*Pager)(unsafe.Pointer(pPager)).FerrCode = SQLITE_OK + setGetterMethod(tls, pPager) + } + + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + (*Pager)(unsafe.Pointer(pPager)).FjournalHdr = int64(0) + (*Pager)(unsafe.Pointer(pPager)).FsetSuper = U8(0) +} + +// This function is called whenever an IOERR or FULL error that requires +// the pager to transition into the ERROR state may ahve occurred. +// The first argument is a pointer to the pager structure, the second +// the error-code about to be returned by a pager API function. The +// value returned is a copy of the second argument to this function. +// +// If the second argument is SQLITE_FULL, SQLITE_IOERR or one of the +// IOERR sub-codes, the pager enters the ERROR state and the error code +// is stored in Pager.errCode. While the pager remains in the ERROR state, +// all major API calls on the Pager will immediately return Pager.errCode. +// +// The ERROR state indicates that the contents of the pager-cache +// cannot be trusted. This state can be cleared by completely discarding +// the contents of the pager-cache. If a transaction was active when +// the persistent error occurred, then the rollback journal may need +// to be replayed to restore the contents of the database file (as if +// it were a hot-journal). +func pager_error(tls *libc.TLS, pPager uintptr, rc int32) int32 { /* sqlite3.c:54558:12: */ + var rc2 int32 = (rc & 0xff) + + if (rc2 == SQLITE_FULL) || (rc2 == SQLITE_IOERR) { + (*Pager)(unsafe.Pointer(pPager)).FerrCode = rc + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_ERROR) + setGetterMethod(tls, pPager) + } + return rc +} + +// The write transaction open on pPager is being committed (bCommit==1) +// or rolled back (bCommit==0). +// +// Return TRUE if and only if all dirty pages should be flushed to disk. +// +// Rules: +// +// * For non-TEMP databases, always sync to disk. This is necessary +// for transactions to be durable. +// +// * Sync TEMP database only on a COMMIT (not a ROLLBACK) when the backing +// file has been created already (via a spill on pagerStress()) and +// when the number of dirty pages in memory exceeds 25% of the total +// cache size. +func pagerFlushOnCommit(tls *libc.TLS, pPager uintptr, bCommit int32) int32 { /* sqlite3.c:54592:12: */ + if int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) == 0 { + return 1 + } + if !(bCommit != 0) { + return 0 + } + if !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) { + return 0 + } + return (libc.Bool32(Xsqlite3PCachePercentDirty(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) >= 25)) +} + +// This routine ends a transaction. A transaction is usually ended by +// either a COMMIT or a ROLLBACK operation. This routine may be called +// after rollback of a hot-journal, or if an error occurs while opening +// the journal file or writing the very first journal-header of a +// database transaction. +// +// This routine is never called in PAGER_ERROR state. If it is called +// in PAGER_NONE or PAGER_SHARED state and the lock held is less +// exclusive than a RESERVED lock, it is a no-op. +// +// Otherwise, any active savepoints are released. +// +// If the journal file is open, then it is "finalized". Once a journal +// file has been finalized it is not possible to use it to roll back a +// transaction. Nor will it be considered to be a hot-journal by this +// or any other database connection. Exactly how a journal is finalized +// depends on whether or not the pager is running in exclusive mode and +// the current journal-mode (Pager.journalMode value), as follows: +// +// journalMode==MEMORY +// Journal file descriptor is simply closed. This destroys an +// in-memory journal. +// +// journalMode==TRUNCATE +// Journal file is truncated to zero bytes in size. +// +// journalMode==PERSIST +// The first 28 bytes of the journal file are zeroed. This invalidates +// the first journal header in the file, and hence the entire journal +// file. An invalid journal file cannot be rolled back. +// +// journalMode==DELETE +// The journal file is closed and deleted using sqlite3OsDelete(). +// +// If the pager is running in exclusive mode, this method of finalizing +// the journal file is never used. Instead, if the journalMode is +// DELETE and the pager is in exclusive mode, the method described under +// journalMode==PERSIST is used instead. +// +// After the journal is finalized, the pager moves to PAGER_READER state. +// If running in non-exclusive rollback mode, the lock on the file is +// downgraded to a SHARED_LOCK. +// +// SQLITE_OK is returned if no error occurs. If an error occurs during +// any of the IO operations to finalize the journal file or unlock the +// database then the IO error code is returned to the user. If the +// operation to finalize the journal file fails, then the code still +// tries to unlock the database file if not in exclusive mode. If the +// unlock operation fails as well, then the first error code related +// to the first error encountered (the journal finalization one) is +// returned. +func pager_end_transaction(tls *libc.TLS, pPager uintptr, hasSuper int32, bCommit int32) int32 { /* sqlite3.c:54652:12: */ + var rc int32 = SQLITE_OK // Error code from journal finalization operation + var rc2 int32 = SQLITE_OK // Error code from db file unlock operation + + // Do nothing if the pager does not have an open write transaction + // or at least a RESERVED lock. This function may be called when there + // is no write-transaction active but a RESERVED or greater lock is + // held under two circumstances: + // + // 1. After a successful hot-journal rollback, it is called with + // eState==PAGER_NONE and eLock==EXCLUSIVE_LOCK. + // + // 2. If a connection with locking_mode=exclusive holding an EXCLUSIVE + // lock switches back to locking_mode=normal and then executes a + // read-transaction, this function is called with eState==PAGER_READER + // and eLock==EXCLUSIVE_LOCK when the read-transaction is closed. + + if (int32((*Pager)(unsafe.Pointer(pPager)).FeState) < PAGER_WRITER_LOCKED) && (int32((*Pager)(unsafe.Pointer(pPager)).FeLock) < RESERVED_LOCK) { + return SQLITE_OK + } + + releaseAllSavepoints(tls, pPager) + + if (*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0) { + + // Finalize the journal file. + if Xsqlite3JournalIsInMemory(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) != 0 { + // assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + } else if int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_TRUNCATE { + if (*Pager)(unsafe.Pointer(pPager)).FjournalOff == int64(0) { + rc = SQLITE_OK + } else { + rc = Xsqlite3OsTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, int64(0)) + if (rc == SQLITE_OK) && ((*Pager)(unsafe.Pointer(pPager)).FfullSync != 0) { + // Make sure the new file size is written into the inode right away. + // Otherwise the journal might resurrect following a power loss and + // cause the last transaction to roll back. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1072773 + rc = Xsqlite3OsSync(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags)) + } + } + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + } else if (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_PERSIST) || + (((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) && (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) != PAGER_JOURNALMODE_WAL)) { + rc = zeroJournalHdr(tls, pPager, (libc.Bool32((hasSuper != 0) || ((*Pager)(unsafe.Pointer(pPager)).FtempFile != 0)))) + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + } else { + // This branch may be executed with Pager.journalMode==MEMORY if + // a hot-journal was just rolled back. In this case the journal + // file should be closed and deleted. If this connection writes to + // the database file, it will do so using an in-memory journal. + var bDelete int32 = libc.BoolInt32(!((*Pager)(unsafe.Pointer(pPager)).FtempFile != 0)) + + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + if bDelete != 0 { + rc = Xsqlite3OsDelete(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, int32((*Pager)(unsafe.Pointer(pPager)).FextraSync)) + } + } + } + + Xsqlite3BitvecDestroy(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal) + (*Pager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) + (*Pager)(unsafe.Pointer(pPager)).FnRec = 0 + if rc == SQLITE_OK { + if ((*Pager)(unsafe.Pointer(pPager)).FmemDb != 0) || (pagerFlushOnCommit(tls, pPager, bCommit) != 0) { + Xsqlite3PcacheCleanAll(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + } else { + Xsqlite3PcacheClearWritable(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + } + Xsqlite3PcacheTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, (*Pager)(unsafe.Pointer(pPager)).FdbSize) + } + + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + // Drop the WAL write-lock, if any. Also, if the connection was in + // locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE + // lock held on the database file. + rc2 = Xsqlite3WalEndWriteTransaction(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + + } else if ((rc == SQLITE_OK) && (bCommit != 0)) && ((*Pager)(unsafe.Pointer(pPager)).FdbFileSize > (*Pager)(unsafe.Pointer(pPager)).FdbSize) { + // This branch is taken when committing a transaction in rollback-journal + // mode if the database file on disk is larger than the database image. + // At this point the journal has been finalized and the transaction + // successfully committed, but the EXCLUSIVE lock is still held on the + // file. So it is safe to truncate the database file to its minimum + // required size. + + rc = pager_truncate(tls, pPager, (*Pager)(unsafe.Pointer(pPager)).FdbSize) + } + + if (rc == SQLITE_OK) && (bCommit != 0) { + rc = Xsqlite3OsFileControl(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, SQLITE_FCNTL_COMMIT_PHASETWO, uintptr(0)) + if rc == SQLITE_NOTFOUND { + rc = SQLITE_OK + } + } + + if !(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) && + (!((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) || (Xsqlite3WalExclusiveMode(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, 0) != 0)) { + rc2 = pagerUnlockDb(tls, pPager, SHARED_LOCK) + } + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_READER) + (*Pager)(unsafe.Pointer(pPager)).FsetSuper = U8(0) + + return func() int32 { + if rc == SQLITE_OK { + return rc2 + } + return rc + }() +} + +// Execute a rollback if a transaction is active and unlock the +// database file. +// +// If the pager has already entered the ERROR state, do not attempt +// the rollback at this time. Instead, pager_unlock() is called. The +// call to pager_unlock() will discard all in-memory pages, unlock +// the database file and move the pager back to OPEN state. If this +// means that there is a hot-journal left in the file-system, the next +// connection to obtain a shared lock on the pager (which may be this one) +// will roll it back. +// +// If the pager has not already entered the ERROR state, but an IO or +// malloc error occurs during a rollback, then this will itself cause +// the pager to enter the ERROR state. Which will be cleared by the +// call to pager_unlock(), as described above. +func pagerUnlockAndRollback(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:54799:13: */ + if (int32((*Pager)(unsafe.Pointer(pPager)).FeState) != PAGER_ERROR) && (int32((*Pager)(unsafe.Pointer(pPager)).FeState) != PAGER_OPEN) { + + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) >= PAGER_WRITER_LOCKED { + Xsqlite3BeginBenignMalloc(tls) + Xsqlite3PagerRollback(tls, pPager) + Xsqlite3EndBenignMalloc(tls) + } else if !(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) { + + pager_end_transaction(tls, pPager, 0, 0) + } + } + pager_unlock(tls, pPager) +} + +// Parameter aData must point to a buffer of pPager->pageSize bytes +// of data. Compute and return a checksum based ont the contents of the +// page of data and the current value of pPager->cksumInit. +// +// This is not a real checksum. It is really just the sum of the +// random initial value (pPager->cksumInit) and every 200th byte +// of the page data, starting with byte offset (pPager->pageSize%200). +// Each byte is interpreted as an 8-bit unsigned integer. +// +// Changing the formula used to compute this checksum results in an +// incompatible journal file format. +// +// If journal corruption occurs due to a power failure, the most likely +// scenario is that one end or the other of the record will be changed. +// It is much less likely that the two ends of the journal record will be +// correct and the middle be corrupt. Thus, this "checksum" scheme, +// though fast and simple, catches the mostly likely kind of corruption. +func pager_cksum(tls *libc.TLS, pPager uintptr, aData uintptr) U32 { /* sqlite3.c:54833:12: */ + var cksum U32 = (*Pager)(unsafe.Pointer(pPager)).FcksumInit // Checksum value to return + var i int32 = ((*Pager)(unsafe.Pointer(pPager)).FpageSize - 200) // Loop counter + for i > 0 { + cksum = cksum + (U32(*(*U8)(unsafe.Pointer(aData + uintptr(i))))) + i = i - (200) + } + return cksum +} + +// Read a single page from either the journal file (if isMainJrnl==1) or +// from the sub-journal (if isMainJrnl==0) and playback that page. +// The page begins at offset *pOffset into the file. The *pOffset +// value is increased to the start of the next page in the journal. +// +// The main rollback journal uses checksums - the statement journal does +// not. +// +// If the page number of the page record read from the (sub-)journal file +// is greater than the current value of Pager.dbSize, then playback is +// skipped and SQLITE_OK is returned. +// +// If pDone is not NULL, then it is a record of pages that have already +// been played back. If the page at *pOffset has already been played back +// (if the corresponding pDone bit is set) then skip the playback. +// Make sure the pDone bit corresponding to the *pOffset page is set +// prior to returning. +// +// If the page record is successfully read from the (sub-)journal file +// and played back, then SQLITE_OK is returned. If an IO error occurs +// while reading the record from the (sub-)journal file or while writing +// to the database file, then the IO error code is returned. If data +// is successfully read from the (sub-)journal file but appears to be +// corrupted, SQLITE_DONE is returned. Data is considered corrupted in +// two circumstances: +// +// * If the record page-number is illegal (0 or PAGER_MJ_PGNO), or +// * If the record is being rolled back from the main journal file +// and the checksum field does not match the record content. +// +// Neither of these two scenarios are possible during a savepoint rollback. +// +// If this is a savepoint rollback, then memory may have to be dynamically +// allocated by this function. If this is the case and an allocation fails, +// SQLITE_NOMEM is returned. +func pager_playback_one_page(tls *libc.TLS, pPager uintptr, pOffset uintptr, pDone uintptr, isMainJrnl int32, isSavepnt int32) int32 { /* sqlite3.c:54880:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 + // var pPg uintptr at bp+8, 8 + // An existing page in the cache + // var pgno Pgno at bp, 4 + // The page number of a page in journal + // var cksum U32 at bp+4, 4 + // Checksum used for sanity checking + var aData uintptr // Temporary storage for the page + var jfd uintptr // The file descriptor for the journal file + var isSynced int32 // True if journal page is synced + + // isMainJrnl is 0 or 1 + // isSavepnt is 0 or 1 + // pDone always used on sub-journals + // pDone never used on non-savepoint + + aData = (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace + // Temp storage must have already been allocated + + // Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction + // or savepoint rollback done at the request of the caller) or this is + // a hot-journal rollback. If it is a hot-journal rollback, the pager + // is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback + // only reads from the main journal, not the sub-journal. + + // Read the page number and page data from the journal or sub-journal + // file. Return an error code to the caller if an IO error occurs. + if isMainJrnl != 0 { + jfd = (*Pager)(unsafe.Pointer(pPager)).Fjfd + } else { + jfd = (*Pager)(unsafe.Pointer(pPager)).Fsjfd + } + rc = read32bits(tls, jfd, *(*I64)(unsafe.Pointer(pOffset)), bp /* &pgno */) + if rc != SQLITE_OK { + return rc + } + rc = Xsqlite3OsRead(tls, jfd, aData, (*Pager)(unsafe.Pointer(pPager)).FpageSize, ((*(*I64)(unsafe.Pointer(pOffset))) + int64(4))) + if rc != SQLITE_OK { + return rc + } + *(*I64)(unsafe.Pointer(pOffset)) += (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize + 4) + (isMainJrnl * 4))) + + // Sanity checking on the page. This is more important that I originally + // thought. If a power failure occurs while the journal is being written, + // it could cause invalid data to be written into the journal. We need to + // detect this invalid data (with high probability) and ignore it. + if (*(*Pgno)(unsafe.Pointer(bp /* pgno */)) == Pgno(0)) || (*(*Pgno)(unsafe.Pointer(bp /* pgno */)) == (Pgno((Xsqlite3PendingByte / ((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + 1))) { + + return SQLITE_DONE + } + if (*(*Pgno)(unsafe.Pointer(bp /* pgno */)) > (*Pager)(unsafe.Pointer(pPager)).FdbSize) || (Xsqlite3BitvecTest(tls, pDone, *(*Pgno)(unsafe.Pointer(bp /* pgno */))) != 0) { + return SQLITE_OK + } + if isMainJrnl != 0 { + rc = read32bits(tls, jfd, ((*(*I64)(unsafe.Pointer(pOffset))) - int64(4)), bp+4 /* &cksum */) + if rc != 0 { + return rc + } + if !(isSavepnt != 0) && (pager_cksum(tls, pPager, aData) != *(*U32)(unsafe.Pointer(bp + 4 /* cksum */))) { + return SQLITE_DONE + } + } + + // If this page has already been played back before during the current + // rollback, then don't bother to play it back again. + if (pDone != 0) && ((libc.AssignInt32(&rc, Xsqlite3BitvecSet(tls, pDone, *(*Pgno)(unsafe.Pointer(bp /* pgno */))))) != SQLITE_OK) { + return rc + } + + // When playing back page 1, restore the nReserve setting + if (*(*Pgno)(unsafe.Pointer(bp /* pgno */)) == Pgno(1)) && (int32((*Pager)(unsafe.Pointer(pPager)).FnReserve) != int32(*(*U8)(unsafe.Pointer((aData) + 20)))) { + (*Pager)(unsafe.Pointer(pPager)).FnReserve = I16(*(*U8)(unsafe.Pointer((aData) + 20))) + } + + // If the pager is in CACHEMOD state, then there must be a copy of this + // page in the pager cache. In this case just update the pager cache, + // not the database file. The page is left marked dirty in this case. + // + // An exception to the above rule: If the database is in no-sync mode + // and a page is moved during an incremental vacuum then the page may + // not be in the pager cache. Later: if a malloc() or IO error occurs + // during a Movepage() call, then the page may not be in the cache + // either. So the condition described in the above paragraph is not + // assert()able. + // + // If in WRITER_DBMOD, WRITER_FINISHED or OPEN state, then we update the + // pager cache if it exists and the main file. The page is then marked + // not dirty. Since this code is only executed in PAGER_OPEN state for + // a hot-journal rollback, it is guaranteed that the page-cache is empty + // if the pager is in OPEN state. + // + // Ticket #1171: The statement journal might contain page content that is + // different from the page content at the start of the transaction. + // This occurs when a page is changed prior to the start of a statement + // then changed again within the statement. When rolling back such a + // statement we must not write to the original database unless we know + // for certain that original page contents are synced into the main rollback + // journal. Otherwise, a power loss might leave modified data in the + // database file without an entry in the rollback journal that can + // restore the database to its original form. Two conditions must be + // met before writing to the database files. (1) the database must be + // locked. (2) we know that the original page content is fully synced + // in the main journal either because the page is not in cache or else + // the page is marked as needSync==0. + // + // 2008-04-14: When attempting to vacuum a corrupt database file, it + // is possible to fail a statement on a database that does not yet exist. + // Do not attempt to write if database file has never been opened. + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)) = uintptr(0) + } else { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)) = Xsqlite3PagerLookup(tls, pPager, *(*Pgno)(unsafe.Pointer(bp /* pgno */))) + } + + if isMainJrnl != 0 { + isSynced = (libc.Bool32(((*Pager)(unsafe.Pointer(pPager)).FnoSync != 0) || (*(*I64)(unsafe.Pointer(pOffset)) <= (*Pager)(unsafe.Pointer(pPager)).FjournalHdr))) + } else { + isSynced = (libc.Bool32((*(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)) == uintptr(0)) || (0 == (int32((*PgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)))).Fflags) & PGHDR_NEED_SYNC)))) + } + if (((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) && + ((int32((*Pager)(unsafe.Pointer(pPager)).FeState) >= PAGER_WRITER_DBMOD) || (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN))) && + (isSynced != 0) { + var ofst I64 = ((I64(*(*Pgno)(unsafe.Pointer(bp /* pgno */)) - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + + // Write the data read from the journal back into the database file. + // This is usually safe even for an encrypted database - as the data + // was encrypted before it was written to the journal file. The exception + // is if the data was just read from an in-memory sub-journal. In that + // case it must be encrypted here before it is copied into the database + // file. + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, aData, (*Pager)(unsafe.Pointer(pPager)).FpageSize, ofst) + + if *(*Pgno)(unsafe.Pointer(bp /* pgno */)) > (*Pager)(unsafe.Pointer(pPager)).FdbFileSize { + (*Pager)(unsafe.Pointer(pPager)).FdbFileSize = *(*Pgno)(unsafe.Pointer(bp /* pgno */)) + } + if (*Pager)(unsafe.Pointer(pPager)).FpBackup != 0 { + Xsqlite3BackupUpdate(tls, (*Pager)(unsafe.Pointer(pPager)).FpBackup, *(*Pgno)(unsafe.Pointer(bp /* pgno */)), aData) + } + } else if !(isMainJrnl != 0) && (*(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)) == uintptr(0)) { + // If this is a rollback of a savepoint and data was not written to + // the database and the page is not in-memory, there is a potential + // problem. When the page is next fetched by the b-tree layer, it + // will be read from the database file, which may or may not be + // current. + // + // There are a couple of different ways this can happen. All are quite + // obscure. When running in synchronous mode, this can only happen + // if the page is on the free-list at the start of the transaction, then + // populated, then moved using sqlite3PagerMovepage(). + // + // The solution is to add an in-memory page to the cache containing + // the data just read from the sub-journal. Mark the page as dirty + // and if the pager requires a journal-sync, then mark the page as + // requiring a journal-sync before it is written. + + *(*U8)(unsafe.Pointer(pPager + 24 /* &.doNotSpill */)) |= U8((SPILLFLAG_ROLLBACK)) + rc = Xsqlite3PagerGet(tls, pPager, *(*Pgno)(unsafe.Pointer(bp /* pgno */)), bp+8 /* &pPg */, 1) + + *(*U8)(unsafe.Pointer(pPager + 24 /* &.doNotSpill */)) &= libc.Uint8FromInt32((libc.CplInt32(SPILLFLAG_ROLLBACK))) + if rc != SQLITE_OK { + return rc + } + Xsqlite3PcacheMakeDirty(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */))) + } + if *(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)) != 0 { + // No page should ever be explicitly rolled back that is in use, except + // for page 1 which is held in use in order to keep the lock on the + // database active. However such a page may be rolled back as a result + // of an internal error resulting in an automatic call to + // sqlite3PagerRollback(). + var pData uintptr + pData = (*PgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */)))).FpData + libc.Xmemcpy(tls, pData, aData, uint64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pPager + 256 /* &.xReiniter */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */))) + // It used to be that sqlite3PcacheMakeClean(pPg) was called here. But + // that call was dangerous and had no detectable benefit since the cache + // is normally cleaned by sqlite3PcacheCleanAll() after rollback and so + // has been removed. + + // If this was page 1, then restore the value of Pager.dbFileVers. + // Do this before any decoding. + if *(*Pgno)(unsafe.Pointer(bp /* pgno */)) == Pgno(1) { + libc.Xmemcpy(tls, (pPager + 136 /* &.dbFileVers */), ((pData) + 24), uint64(unsafe.Sizeof([16]int8{}))) + } + Xsqlite3PcacheRelease(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPg */))) + } + return rc +} + +// Parameter zSuper is the name of a super-journal file. A single journal +// file that referred to the super-journal file has just been rolled back. +// This routine checks if it is possible to delete the super-journal file, +// and does so if it is. +// +// Argument zSuper may point to Pager.pTmpSpace. So that buffer is not +// available for use within this function. +// +// When a super-journal file is created, it is populated with the names +// of all of its child journals, one after another, formatted as utf-8 +// encoded text. The end of each child journal file is marked with a +// nul-terminator byte (0x00). i.e. the entire contents of a super-journal +// file for a transaction involving two databases might be: +// +// "/home/bill/a.db-journal\x00/home/bill/b.db-journal\x00" +// +// A super-journal file may only be deleted once all of its child +// journals have been rolled back. +// +// This function reads the contents of the super-journal file into +// memory and loops through each of the child journal names. For +// each child journal, it checks if: +// +// * if the child journal exists, and if so +// * if the child journal contains a reference to super-journal +// file zSuper +// +// If a child journal can be found that matches both of the criteria +// above, this function returns without doing anything. Otherwise, if +// no such child journal can be found, file zSuper is deleted from +// the file-system using sqlite3OsDelete(). +// +// If an IO error within this function, an error code is returned. This +// function allocates memory by calling sqlite3Malloc(). If an allocation +// fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors +// occur, SQLITE_OK is returned. +// +// TODO: This function allocates a single block of memory to load +// the entire contents of the super-journal file. This could be +// a couple of kilobytes or so - potentially larger than the page +// size. +func pager_delsuper(tls *libc.TLS, pPager uintptr, zSuper uintptr) int32 { /* sqlite3.c:55127:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pVfs uintptr + var rc int32 // Return code + var pSuper uintptr // Malloc'd super-journal file descriptor + var pJournal uintptr // Malloc'd child-journal file descriptor + var zSuperJournal uintptr // Contents of super-journal file + // var nSuperJournal I64 at bp, 8 + // Size of super-journal file + var zJournal uintptr // Pointer to one journal within MJ file + var zSuperPtr uintptr // Space to hold super-journal filename + var zFree uintptr // Free this buffer + var nSuperPtr int32 + var flags int32 + // One of the journals pointed to by the super-journal exists. + // Open it and check if it points at the super-journal. If + // so, return without deleting the super-journal file. + // NB: zJournal is really a MAIN_JOURNAL. But call it a + // SUPER_JOURNAL here so that the VFS will not send the zJournal + // name into sqlite3_database_file_object(). + var c int32 + var flags1 int32 + // var exists int32 at bp+8, 4 + pVfs = (*Pager)(unsafe.Pointer(pPager)).FpVfs + zSuperJournal = uintptr(0) + zFree = uintptr(0) // Amount of space allocated to zSuperPtr[] + + // Allocate space for both the pJournal and pSuper file descriptors. + // If successful, open the super-journal file for reading. + pSuper = Xsqlite3MallocZero(tls, (uint64((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile * 2))) + if !(!(pSuper != 0)) { + goto __1 + } + rc = SQLITE_NOMEM + pJournal = uintptr(0) + goto __2 +__1: + flags = (SQLITE_OPEN_READONLY | SQLITE_OPEN_SUPER_JOURNAL) + rc = Xsqlite3OsOpen(tls, pVfs, zSuper, pSuper, flags, uintptr(0)) + pJournal = ((pSuper) + uintptr((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile)) +__2: + ; + if !(rc != SQLITE_OK) { + goto __3 + } + goto delsuper_out +__3: + ; + + // Load the entire super-journal file into space obtained from + // sqlite3_malloc() and pointed to by zSuperJournal. Also obtain + // sufficient space (in zSuperPtr) to hold the names of super-journal + // files extracted from regular rollback-journals. + rc = Xsqlite3OsFileSize(tls, pSuper, bp /* &nSuperJournal */) + if !(rc != SQLITE_OK) { + goto __4 + } + goto delsuper_out +__4: + ; + nSuperPtr = ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname + 1) + zFree = Xsqlite3Malloc(tls, (uint64(((int64(4) + *(*I64)(unsafe.Pointer(bp /* nSuperJournal */))) + I64(nSuperPtr)) + int64(2)))) + if !(!(zFree != 0)) { + goto __5 + } + rc = SQLITE_NOMEM + goto delsuper_out +__5: + ; + *(*int8)(unsafe.Pointer(zFree)) = libc.AssignPtrInt8(zFree+1, libc.AssignPtrInt8(zFree+2, libc.AssignPtrInt8(zFree+3, int8(0)))) + zSuperJournal = (zFree + 4) + zSuperPtr = (zSuperJournal + uintptr((*(*I64)(unsafe.Pointer(bp /* nSuperJournal */)) + int64(2)))) + rc = Xsqlite3OsRead(tls, pSuper, zSuperJournal, int32(*(*I64)(unsafe.Pointer(bp /* nSuperJournal */))), int64(0)) + if !(rc != SQLITE_OK) { + goto __6 + } + goto delsuper_out +__6: + ; + *(*int8)(unsafe.Pointer(zSuperJournal + uintptr(*(*I64)(unsafe.Pointer(bp /* nSuperJournal */))))) = int8(0) + *(*int8)(unsafe.Pointer(zSuperJournal + uintptr((*(*I64)(unsafe.Pointer(bp /* nSuperJournal */)) + int64(1))))) = int8(0) + + zJournal = zSuperJournal +__7: + if !((I64((int64(zJournal) - int64(zSuperJournal)) / 1)) < *(*I64)(unsafe.Pointer(bp /* nSuperJournal */))) { + goto __8 + } + rc = Xsqlite3OsAccess(tls, pVfs, zJournal, SQLITE_ACCESS_EXISTS, bp+8 /* &exists */) + if !(rc != SQLITE_OK) { + goto __9 + } + goto delsuper_out +__9: + ; + if !(*(*int32)(unsafe.Pointer(bp + 8 /* exists */)) != 0) { + goto __10 + } + flags1 = (SQLITE_OPEN_READONLY | SQLITE_OPEN_SUPER_JOURNAL) + rc = Xsqlite3OsOpen(tls, pVfs, zJournal, pJournal, flags1, uintptr(0)) + if !(rc != SQLITE_OK) { + goto __11 + } + goto delsuper_out +__11: + ; + + rc = readSuperJournal(tls, pJournal, zSuperPtr, uint32(nSuperPtr)) + Xsqlite3OsClose(tls, pJournal) + if !(rc != SQLITE_OK) { + goto __12 + } + goto delsuper_out +__12: + ; + + c = (libc.Bool32((int32(*(*int8)(unsafe.Pointer(zSuperPtr))) != 0) && (libc.Xstrcmp(tls, zSuperPtr, zSuper) == 0))) + if !(c != 0) { + goto __13 + } + // We have a match. Do not delete the super-journal file. + goto delsuper_out +__13: + ; +__10: + ; + zJournal += (uintptr(Xsqlite3Strlen30(tls, zJournal) + 1)) + goto __7 +__8: + ; + + Xsqlite3OsClose(tls, pSuper) + rc = Xsqlite3OsDelete(tls, pVfs, zSuper, 0) + +delsuper_out: + Xsqlite3_free(tls, zFree) + if !(pSuper != 0) { + goto __14 + } + Xsqlite3OsClose(tls, pSuper) + + Xsqlite3_free(tls, pSuper) +__14: + ; + return rc +} + +// This function is used to change the actual size of the database +// file in the file-system. This only happens when committing a transaction, +// or rolling back a transaction (including rolling back a hot-journal). +// +// If the main database file is not open, or the pager is not in either +// DBMOD or OPEN state, this function is a no-op. Otherwise, the size +// of the file is changed to nPage pages (nPage*pPager->pageSize bytes). +// If the file on disk is currently larger than nPage pages, then use the VFS +// xTruncate() method to truncate it. +// +// Or, it might be the case that the file on disk is smaller than +// nPage pages. Some operating system implementations can get confused if +// you try to truncate a file to some size that is larger than it +// currently is, so detect this case and write a single zero byte to +// the end of the new file instead. +// +// If successful, return SQLITE_OK. If an IO error occurs while modifying +// the database file, return the error code to the caller. +func pager_truncate(tls *libc.TLS, pPager uintptr, nPage Pgno) int32 { /* sqlite3.c:55245:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + + if ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) && + ((int32((*Pager)(unsafe.Pointer(pPager)).FeState) >= PAGER_WRITER_DBMOD) || (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN)) { + // var currentSize I64 at bp, 8 + + var newSize I64 + var szPage int32 = (*Pager)(unsafe.Pointer(pPager)).FpageSize + + // TODO: Is it safe to use Pager.dbFileSize here? + rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, bp /* ¤tSize */) + newSize = (I64(szPage) * I64(nPage)) + if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp /* currentSize */)) != newSize) { + if *(*I64)(unsafe.Pointer(bp /* currentSize */)) > newSize { + rc = Xsqlite3OsTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, newSize) + } else if (*(*I64)(unsafe.Pointer(bp /* currentSize */)) + I64(szPage)) <= newSize { + var pTmp uintptr = (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace + libc.Xmemset(tls, pTmp, 0, uint64(szPage)) + + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, pTmp, szPage, (newSize - I64(szPage))) + } + if rc == SQLITE_OK { + (*Pager)(unsafe.Pointer(pPager)).FdbFileSize = nPage + } + } + } + return rc +} + +// Return a sanitized version of the sector-size of OS file pFile. The +// return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE. +func Xsqlite3SectorSize(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:55281:20: */ + var iRet int32 = Xsqlite3OsSectorSize(tls, pFile) + if iRet < 32 { + iRet = 512 + } else if iRet > MAX_SECTOR_SIZE { + + iRet = MAX_SECTOR_SIZE + } + return iRet +} + +// Set the value of the Pager.sectorSize variable for the given +// pager based on the value returned by the xSectorSize method +// of the open database file. The sector size will be used +// to determine the size and alignment of journal header and +// super-journal pointers within created journal files. +// +// For temporary files the effective sector size is always 512 bytes. +// +// Otherwise, for non-temporary files, the effective sector size is +// the value returned by the xSectorSize() method rounded up to 32 if +// it is less than 32, or rounded down to MAX_SECTOR_SIZE if it +// is greater than MAX_SECTOR_SIZE. +// +// If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set +// the effective sector size to its minimum value (512). The purpose of +// pPager->sectorSize is to define the "blast radius" of bytes that +// might change if a crash occurs while writing to a single byte in +// that range. But with POWERSAFE_OVERWRITE, the blast radius is zero +// (that is what POWERSAFE_OVERWRITE means), so we minimize the sector +// size. For backwards compatibility of the rollback journal file format, +// we cannot reduce the effective sector size below 512. +func setSectorSize(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:55315:13: */ + + if ((*Pager)(unsafe.Pointer(pPager)).FtempFile != 0) || + ((Xsqlite3OsDeviceCharacteristics(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd) & SQLITE_IOCAP_POWERSAFE_OVERWRITE) != 0) { + // Sector size doesn't matter for temporary files. Also, the file + // may not have been opened yet, in which case the OsSectorSize() + // call will segfault. + (*Pager)(unsafe.Pointer(pPager)).FsectorSize = U32(512) + } else { + (*Pager)(unsafe.Pointer(pPager)).FsectorSize = U32(Xsqlite3SectorSize(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd)) + } +} + +// Playback the journal and thus restore the database file to +// the state it was in before we started making changes. +// +// The journal file format is as follows: +// +// (1) 8 byte prefix. A copy of aJournalMagic[]. +// (2) 4 byte big-endian integer which is the number of valid page records +// in the journal. If this value is 0xffffffff, then compute the +// number of page records from the journal size. +// (3) 4 byte big-endian integer which is the initial value for the +// sanity checksum. +// (4) 4 byte integer which is the number of pages to truncate the +// database to during a rollback. +// (5) 4 byte big-endian integer which is the sector size. The header +// is this many bytes in size. +// (6) 4 byte big-endian integer which is the page size. +// (7) zero padding out to the next sector size. +// (8) Zero or more pages instances, each as follows: +// + 4 byte page number. +// + pPager->pageSize bytes of data. +// + 4 byte checksum +// +// When we speak of the journal header, we mean the first 7 items above. +// Each entry in the journal is an instance of the 8th item. +// +// Call the value from the second bullet "nRec". nRec is the number of +// valid page entries in the journal. In most cases, you can compute the +// value of nRec from the size of the journal file. But if a power +// failure occurred while the journal was being written, it could be the +// case that the size of the journal file had already been increased but +// the extra entries had not yet made it safely to disk. In such a case, +// the value of nRec computed from the file size would be too large. For +// that reason, we always use the nRec value in the header. +// +// If the nRec value is 0xffffffff it means that nRec should be computed +// from the file size. This value is used when the user selects the +// no-sync option for the journal. A power failure could lead to corruption +// in this case. But for things like temporary table (which will be +// deleted when the power is restored) we don't care. +// +// If the file opened as the journal file is not a well-formed +// journal file then all pages up to the first corrupted page are rolled +// back (or no pages if the journal header is corrupted). The journal file +// is then deleted and SQLITE_OK returned, just as if no corruption had +// been encountered. +// +// If an I/O or malloc() error occurs, the journal-file is not deleted +// and an error code is returned. +// +// The isHot parameter indicates that we are trying to rollback a journal +// that might be a hot journal. Or, it could be that the journal is +// preserved because of JOURNALMODE_PERSIST or JOURNALMODE_TRUNCATE. +// If the journal really is hot, reset the pager cache prior rolling +// back any content. If the journal is merely persistent, no reset is +// needed. +func pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) int32 { /* sqlite3.c:55388:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var pVfs uintptr + // var szJ I64 at bp+16, 8 + // Size of the journal file in bytes + // var nRec U32 at bp+28, 4 + // Number of Records in the journal + var u U32 // Unsigned loop counter + // var mxPg Pgno at bp+32, 4 + // Size of the original file in pages + var rc int32 // Result code of a subroutine + // var res int32 at bp+24, 4 + // Value returned by sqlite3OsAccess() + var zSuper uintptr // Name of super-journal file if any + var needPagerReset int32 // True to reset page prior to first page rollback + var nPlayback int32 // Total number of pages restored from journal + // var savedPageSize U32 at bp+36, 4 + pVfs = (*Pager)(unsafe.Pointer(pPager)).FpVfs + *(*Pgno)(unsafe.Pointer(bp + 32 /* mxPg */)) = Pgno(0) + *(*int32)(unsafe.Pointer(bp + 24 /* res */)) = 1 + zSuper = uintptr(0) + nPlayback = 0 + *(*U32)(unsafe.Pointer(bp + 36 /* savedPageSize */)) = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) + + // Figure out how many records are in the journal. Abort early if + // the journal is empty. + + rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp+16 /* &szJ */) + if !(rc != SQLITE_OK) { + goto __1 + } + goto end_playback +__1: + ; + + // Read the super-journal name from the journal, if it is present. + // If a super-journal file name is specified, but the file is not + // present on disk, then the journal is not hot and does not need to be + // played back. + // + // TODO: Technically the following is an error because it assumes that + // buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that + // (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c, + // mxPathname is 512, which is the same as the minimum allowable value + // for pageSize. + zSuper = (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace + rc = readSuperJournal(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, zSuper, (uint32((*Sqlite3_vfs)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FpVfs)).FmxPathname + 1))) + if !((rc == SQLITE_OK) && (*(*int8)(unsafe.Pointer(zSuper)) != 0)) { + goto __2 + } + rc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+24 /* &res */) +__2: + ; + zSuper = uintptr(0) + if !((rc != SQLITE_OK) || !(*(*int32)(unsafe.Pointer(bp + 24 /* res */)) != 0)) { + goto __3 + } + goto end_playback +__3: + ; + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + needPagerReset = isHot + + // This loop terminates either when a readJournalHdr() or + // pager_playback_one_page() call returns SQLITE_DONE or an IO error + // occurs. +__4: + if !(1 != 0) { + goto __5 + } + // Read the next journal header from the journal file. If there are + // not enough bytes left in the journal file for a complete header, or + // it is corrupted, then a process must have failed while writing it. + // This indicates nothing more needs to be rolled back. + rc = readJournalHdr(tls, pPager, isHot, *(*I64)(unsafe.Pointer(bp + 16 /* szJ */)), bp+28 /* &nRec */, bp+32 /* &mxPg */) + if !(rc != SQLITE_OK) { + goto __6 + } + if !(rc == SQLITE_DONE) { + goto __7 + } + rc = SQLITE_OK +__7: + ; + goto end_playback +__6: + ; + + // If nRec is 0xffffffff, then this journal was created by a process + // working in no-sync mode. This means that the rest of the journal + // file consists of pages, there are no more journal headers. Compute + // the value of nRec based on this assumption. + if !(*(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) == 0xffffffff) { + goto __8 + } + + *(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) = U32((int32((*(*I64)(unsafe.Pointer(bp + 16 /* szJ */)) - (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8))))) +__8: + ; + + // If nRec is 0 and this rollback is of a transaction created by this + // process and if this is the final header in the journal, then it means + // that this part of the journal was being filled but has not yet been + // synced to disk. Compute the number of pages based on the remaining + // size of the file. + // + // The third term of the test was added to fix ticket #2565. + // When rolling back a hot journal, nRec==0 always means that the next + // chunk of the journal contains zero pages to be rolled back. But + // when doing a ROLLBACK and the nRec==0 chunk is the last chunk in + // the journal, it means that the journal might contain additional + // pages that need to be rolled back and that the number of pages + // should be computed based on the journal file size. + if !(((*(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) == U32(0)) && !(isHot != 0)) && (((*Pager)(unsafe.Pointer(pPager)).FjournalHdr + (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) == (*Pager)(unsafe.Pointer(pPager)).FjournalOff)) { + goto __9 + } + *(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) = U32((int32((*(*I64)(unsafe.Pointer(bp + 16 /* szJ */)) - (*Pager)(unsafe.Pointer(pPager)).FjournalOff) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8))))) +__9: + ; + + // If this is the first header read from the journal, truncate the + // database file back to its original size. + if !((*Pager)(unsafe.Pointer(pPager)).FjournalOff == (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) { + goto __10 + } + rc = pager_truncate(tls, pPager, *(*Pgno)(unsafe.Pointer(bp + 32 /* mxPg */))) + if !(rc != SQLITE_OK) { + goto __11 + } + goto end_playback +__11: + ; + (*Pager)(unsafe.Pointer(pPager)).FdbSize = *(*Pgno)(unsafe.Pointer(bp + 32 /* mxPg */)) +__10: + ; + + // Copy original pages out of the journal and back into the + // database file and/or page cache. + u = U32(0) +__12: + if !(u < *(*U32)(unsafe.Pointer(bp + 28 /* nRec */))) { + goto __14 + } + if !(needPagerReset != 0) { + goto __15 + } + pager_reset(tls, pPager) + needPagerReset = 0 +__15: + ; + rc = pager_playback_one_page(tls, pPager, (pPager + 96 /* &.journalOff */), uintptr(0), 1, 0) + if !(rc == SQLITE_OK) { + goto __16 + } + nPlayback++ + goto __17 +__16: + if !(rc == SQLITE_DONE) { + goto __18 + } + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = *(*I64)(unsafe.Pointer(bp + 16 /* szJ */)) + goto __14 + goto __19 +__18: + if !(rc == (SQLITE_IOERR | (int32(2) << 8))) { + goto __20 + } + // If the journal has been truncated, simply stop reading and + // processing the journal. This might happen if the journal was + // not completely written and synced prior to a crash. In that + // case, the database should have never been written in the + // first place so it is OK to simply abandon the rollback. + rc = SQLITE_OK + goto end_playback + goto __21 +__20: + // If we are unable to rollback, quit and return the error + // code. This will cause the pager to enter the error state + // so that no further harm will be done. Perhaps the next + // process to come along will be able to rollback the database. + goto end_playback +__21: + ; +__19: + ; +__17: + ; + goto __13 +__13: + u++ + goto __12 + goto __14 +__14: + ; + goto __4 +__5: + ; + //NOTREACHED + +end_playback: + if !(rc == SQLITE_OK) { + goto __22 + } + rc = Xsqlite3PagerSetPagesize(tls, pPager, bp+36 /* &savedPageSize */, -1) +__22: + ; + // Following a rollback, the database file should be back in its original + // state prior to the start of the transaction, so invoke the + // SQLITE_FCNTL_DB_UNCHANGED file-control method to disable the + // assertion that the transaction counter was modified. + + // If this playback is happening automatically as a result of an IO or + // malloc error that occurred after the change-counter was updated but + // before the transaction was committed, then the change-counter + // modification may just have been reverted. If this happens in exclusive + // mode, then subsequent transactions performed by the connection will not + // update the change-counter at all. This may lead to cache inconsistency + // problems for other processes at some point in the future. So, just + // in case this has happened, clear the changeCountDone flag now. + (*Pager)(unsafe.Pointer(pPager)).FchangeCountDone = (*Pager)(unsafe.Pointer(pPager)).FtempFile + + if !(rc == SQLITE_OK) { + goto __23 + } + // Leave 4 bytes of space before the super-journal filename in memory. + // This is because it may end up being passed to sqlite3OsOpen(), in + // which case it requires 4 0x00 bytes in memory immediately before + // the filename. + zSuper = ((*Pager)(unsafe.Pointer(pPager)).FpTmpSpace + 4) + rc = readSuperJournal(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, zSuper, (uint32((*Sqlite3_vfs)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FpVfs)).FmxPathname + 1))) + +__23: + ; + if !((rc == SQLITE_OK) && + ((int32((*Pager)(unsafe.Pointer(pPager)).FeState) >= PAGER_WRITER_DBMOD) || (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN))) { + goto __24 + } + rc = Xsqlite3PagerSync(tls, pPager, uintptr(0)) +__24: + ; + if !(rc == SQLITE_OK) { + goto __25 + } + rc = pager_end_transaction(tls, pPager, (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zSuper))) != 0)), 0) + +__25: + ; + if !(((rc == SQLITE_OK) && (*(*int8)(unsafe.Pointer(zSuper)) != 0)) && (*(*int32)(unsafe.Pointer(bp + 24 /* res */)) != 0)) { + goto __26 + } + // If there was a super-journal and this routine will return success, + // see if it is possible to delete the super-journal. + + libc.Xmemset(tls, (zSuper + libc.UintptrFromInt32(-4)), 0, uint64(4)) + rc = pager_delsuper(tls, pPager, zSuper) + +__26: + ; + if !((isHot != 0) && (nPlayback != 0)) { + goto __27 + } + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3022, /* "recovered %d pag..." */ + libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) +__27: + ; + + // The Pager.sectorSize variable may have been updated while rolling + // back a journal created by a process with a different sector size + // value. Reset it to the correct value for this process. + setSectorSize(tls, pPager) + return rc +} + +// Read the content for page pPg out of the database file (or out of +// the WAL if that is where the most recent copy if found) into +// pPg->pData. A shared lock or greater must be held on the database +// file before this function is called. +// +// If page 1 is read, then the value of Pager.dbFileVers[] is set to +// the value read from the database file. +// +// If an IO error occurs, then the IO error is returned to the caller. +// Otherwise, SQLITE_OK is returned. +func readDbPage(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:55605:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager // Pager object associated with page pPg + var rc int32 = SQLITE_OK // Return code + + *(*U32)(unsafe.Pointer(bp /* iFrame */)) = U32(0) // Frame of WAL containing pgno + + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + rc = Xsqlite3WalFindFrame(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno, bp /* &iFrame */) + if rc != 0 { + return rc + } + } + if *(*U32)(unsafe.Pointer(bp /* iFrame */)) != 0 { + rc = Xsqlite3WalReadFrame(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, *(*U32)(unsafe.Pointer(bp /* iFrame */)), (*Pager)(unsafe.Pointer(pPager)).FpageSize, (*PgHdr)(unsafe.Pointer(pPg)).FpData) + } else { + var iOffset I64 = ((I64((*PgHdr)(unsafe.Pointer(pPg)).Fpgno - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + rc = Xsqlite3OsRead(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, (*PgHdr)(unsafe.Pointer(pPg)).FpData, (*Pager)(unsafe.Pointer(pPager)).FpageSize, iOffset) + if rc == (SQLITE_IOERR | (int32(2) << 8)) { + rc = SQLITE_OK + } + } + + if (*PgHdr)(unsafe.Pointer(pPg)).Fpgno == Pgno(1) { + if rc != 0 { + // If the read is unsuccessful, set the dbFileVers[] to something + // that will never be a valid file version. dbFileVers[] is a copy + // of bytes 24..39 of the database. Bytes 28..31 should always be + // zero or the size of the database in page. Bytes 32..35 and 35..39 + // should be page numbers which are never 0xffffffff. So filling + // pPager->dbFileVers[] with all 0xff bytes should suffice. + // + // For an encrypted database, the situation is more complex: bytes + // 24..39 of the database are white noise. But the probability of + // white noise equaling 16 bytes of 0xff is vanishingly small so + // we should still be ok. + libc.Xmemset(tls, pPager+136 /* &.dbFileVers */, 0xff, uint64(unsafe.Sizeof([16]int8{}))) + } else { + var dbFileVers uintptr = (((*PgHdr)(unsafe.Pointer(pPg)).FpData) + 24) + libc.Xmemcpy(tls, (pPager + 136 /* &.dbFileVers */), dbFileVers, uint64(unsafe.Sizeof([16]int8{}))) + } + } + + return rc +} + +// Update the value of the change-counter at offsets 24 and 92 in +// the header and the sqlite version number at offset 96. +// +// This is an unconditional update. See also the pager_incr_changecounter() +// routine which only updates the change-counter if the update is actually +// needed, as determined by the pPager->changeCountDone state variable. +func pager_write_changecounter(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:55668:13: */ + var change_counter U32 + + // Increment the value just read and write it back to byte 24. + change_counter = (Xsqlite3Get4byte(tls, (*PgHdr)(unsafe.Pointer(pPg)).FpPager+136 /* &.dbFileVers */) + U32(1)) + Xsqlite3Put4byte(tls, (((*PgHdr)(unsafe.Pointer(pPg)).FpData) + uintptr(24)), change_counter) + + // Also store the SQLite version number in bytes 96..99 and in + // bytes 92..95 store the change counter for which the version number + // is valid. + Xsqlite3Put4byte(tls, (((*PgHdr)(unsafe.Pointer(pPg)).FpData) + uintptr(92)), change_counter) + Xsqlite3Put4byte(tls, (((*PgHdr)(unsafe.Pointer(pPg)).FpData) + uintptr(96)), uint32(SQLITE_VERSION_NUMBER)) +} + +// This function is invoked once for each page that has already been +// written into the log file when a WAL transaction is rolled back. +// Parameter iPg is the page number of said page. The pCtx argument +// is actually a pointer to the Pager structure. +// +// If page iPg is present in the cache, and has no outstanding references, +// it is discarded. Otherwise, if there are one or more outstanding +// references, the page content is reloaded from the database. If the +// attempt to reload content from the database is required and fails, +// return an SQLite error code. Otherwise, SQLITE_OK. +func pagerUndoCallback(tls *libc.TLS, pCtx uintptr, iPg Pgno) int32 { /* sqlite3.c:55695:12: */ + var rc int32 = SQLITE_OK + var pPager uintptr = pCtx + var pPg uintptr + + pPg = Xsqlite3PagerLookup(tls, pPager, iPg) + if pPg != 0 { + if Xsqlite3PcachePageRefcount(tls, pPg) == 1 { + Xsqlite3PcacheDrop(tls, pPg) + } else { + rc = readDbPage(tls, pPg) + if rc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pPager + 256 /* &.xReiniter */))))(tls, pPg) + } + Xsqlite3PagerUnrefNotNull(tls, pPg) + } + } + + // Normally, if a transaction is rolled back, any backup processes are + // updated as data is copied out of the rollback journal and into the + // database. This is not generally possible with a WAL database, as + // rollback involves simply truncating the log file. Therefore, if one + // or more frames have already been written to the log (and therefore + // also copied into the backup databases) as part of this transaction, + // the backups must be restarted. + Xsqlite3BackupRestart(tls, (*Pager)(unsafe.Pointer(pPager)).FpBackup) + + return rc +} + +// This function is called to rollback a transaction on a WAL database. +func pagerRollbackWal(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:55730:12: */ + var rc int32 // Return Code + var pList uintptr // List of dirty pages to revert + + // For all pages in the cache that are currently dirty or have already + // been written (but not committed) to the log file, do one of the + // following: + // + // + Discard the cached page (if refcount==0), or + // + Reload page content from the database (if refcount>0). + (*Pager)(unsafe.Pointer(pPager)).FdbSize = (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize + rc = Xsqlite3WalUndo(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Pgno) int32 + }{pagerUndoCallback})), pPager) + pList = Xsqlite3PcacheDirtyList(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + for (pList != 0) && (rc == SQLITE_OK) { + var pNext uintptr = (*PgHdr)(unsafe.Pointer(pList)).FpDirty + rc = pagerUndoCallback(tls, pPager, (*PgHdr)(unsafe.Pointer(pList)).Fpgno) + pList = pNext + } + + return rc +} + +// This function is a wrapper around sqlite3WalFrames(). As well as logging +// the contents of the list of pages headed by pList (connected by pDirty), +// this function notifies any active backup processes that the pages have +// changed. +// +// The list of pages passed into this routine is always sorted by page number. +// Hence, if page 1 appears anywhere on the list, it will be the first page. +func pagerWalFrames(tls *libc.TLS, pPager uintptr, pList uintptr, nTruncate Pgno, isCommit int32) int32 { /* sqlite3.c:55762:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = pList + + var rc int32 // Return code + var nList int32 // Number of pages in pList + var p uintptr // For looping over pages + + if isCommit != 0 { + // If a WAL transaction is being committed, there is no point in writing + // any pages with page numbers greater than nTruncate into the WAL file. + // They will never be read by any client. So remove them from the pDirty + // list here. + var ppNext uintptr = bp /* &pList */ + nList = 0 + for p = *(*uintptr)(unsafe.Pointer(bp /* pList */)); (libc.AssignPtrUintptr(ppNext, p)) != uintptr(0); p = (*PgHdr)(unsafe.Pointer(p)).FpDirty { + if (*PgHdr)(unsafe.Pointer(p)).Fpgno <= nTruncate { + ppNext = (p + 32 /* &.pDirty */) + nList++ + } + } + + } else { + nList = 1 + } + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + 2*4)) += (nList) + + if (*PgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pList */)))).Fpgno == Pgno(1) { + pager_write_changecounter(tls, *(*uintptr)(unsafe.Pointer(bp /* pList */))) + } + rc = Xsqlite3WalFrames(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, + (*Pager)(unsafe.Pointer(pPager)).FpageSize, *(*uintptr)(unsafe.Pointer(bp /* pList */)), nTruncate, isCommit, int32((*Pager)(unsafe.Pointer(pPager)).FwalSyncFlags)) + if (rc == SQLITE_OK) && ((*Pager)(unsafe.Pointer(pPager)).FpBackup != 0) { + for p = *(*uintptr)(unsafe.Pointer(bp /* pList */)); p != 0; p = (*PgHdr)(unsafe.Pointer(p)).FpDirty { + Xsqlite3BackupUpdate(tls, (*Pager)(unsafe.Pointer(pPager)).FpBackup, (*PgHdr)(unsafe.Pointer(p)).Fpgno, (*PgHdr)(unsafe.Pointer(p)).FpData) + } + } + + return rc +} + +// Begin a read transaction on the WAL. +// +// This routine used to be called "pagerOpenSnapshot()" because it essentially +// makes a snapshot of the database at the current point in time and preserves +// that snapshot for use by the reader in spite of concurrently changes by +// other writers or checkpointers. +func pagerBeginReadTransaction(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:55829:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 // Return code + *(*int32)(unsafe.Pointer(bp /* changed */)) = 0 // True if cache must be reset + + // sqlite3WalEndReadTransaction() was not called for the previous + // transaction in locking_mode=EXCLUSIVE. So call it now. If we + // are in locking_mode=NORMAL and EndRead() was previously called, + // the duplicate call is harmless. + Xsqlite3WalEndReadTransaction(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + + rc = Xsqlite3WalBeginReadTransaction(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, bp /* &changed */) + if (rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp /* changed */)) != 0) { + pager_reset(tls, pPager) + if (*Pager)(unsafe.Pointer(pPager)).FbUseFetch != 0 { + Xsqlite3OsUnfetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, int64(0), uintptr(0)) + } + } + + return rc +} + +// This function is called as part of the transition from PAGER_OPEN +// to PAGER_READER state to determine the size of the database file +// in pages (assuming the page size currently stored in Pager.pageSize). +// +// If no error occurs, SQLITE_OK is returned and the size of the database +// in pages is stored in *pnPage. Otherwise, an error code (perhaps +// SQLITE_IOERR_FSTAT) is returned and *pnPage is left unmodified. +func pagerPagecount(tls *libc.TLS, pPager uintptr, pnPage uintptr) int32 { /* sqlite3.c:55862:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var nPage Pgno // Value to return via *pnPage + + // Query the WAL sub-system for the database size. The WalDbsize() + // function returns zero if the WAL is not open (i.e. Pager.pWal==0), or + // if the database size is not available. The database size is not + // available from the WAL sub-system if the log file is empty or + // contains no valid committed transactions. + + nPage = Xsqlite3WalDbsize(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + + // If the number of pages in the database is not available from the + // WAL sub-system, determine the page count based on the size of + // the database file. If the size of the database file is not an + // integer multiple of the page-size, round up the result. + if (nPage == Pgno(0)) && ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) { + *(*I64)(unsafe.Pointer(bp /* n */)) = int64(0) // Size of db file in bytes + var rc int32 = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, bp /* &n */) + if rc != SQLITE_OK { + return rc + } + nPage = (Pgno(((*(*I64)(unsafe.Pointer(bp /* n */)) + I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) - int64(1)) / I64((*Pager)(unsafe.Pointer(pPager)).FpageSize))) + } + + // If the current number of pages in the file is greater than the + // configured maximum pager number, increase the allowed limit so + // that the file can be read. + if nPage > (*Pager)(unsafe.Pointer(pPager)).FmxPgno { + (*Pager)(unsafe.Pointer(pPager)).FmxPgno = nPage + } + + *(*Pgno)(unsafe.Pointer(pnPage)) = nPage + return SQLITE_OK +} + +// Check if the *-wal file that corresponds to the database opened by pPager +// exists if the database is not empy, or verify that the *-wal file does +// not exist (by deleting it) if the database file is empty. +// +// If the database is not empty and the *-wal file exists, open the pager +// in WAL mode. If the database is empty or if no *-wal file exists and +// if no error occurs, make sure Pager.journalMode is not set to +// PAGER_JOURNALMODE_WAL. +// +// Return SQLITE_OK or an error code. +// +// The caller must hold a SHARED lock on the database file to call this +// function. Because an EXCLUSIVE lock on the db file is required to delete +// a WAL on a none-empty database, this ensures there is no race condition +// between the xAccess() below and an xDelete() being executed by some +// other connection. +func pagerOpenWalIfPresent(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:55922:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + + if !(int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) != 0) { + // var isWal int32 at bp, 4 + // True if WAL file exists + rc = Xsqlite3OsAccess(tls, + (*Pager)(unsafe.Pointer(pPager)).FpVfs, (*Pager)(unsafe.Pointer(pPager)).FzWal, SQLITE_ACCESS_EXISTS, bp /* &isWal */) + if rc == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp /* isWal */)) != 0 { + // var nPage Pgno at bp+4, 4 + // Size of the database file + + rc = pagerPagecount(tls, pPager, bp+4 /* &nPage */) + if rc != 0 { + return rc + } + if *(*Pgno)(unsafe.Pointer(bp + 4 /* nPage */)) == Pgno(0) { + rc = Xsqlite3OsDelete(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, (*Pager)(unsafe.Pointer(pPager)).FzWal, 0) + } else { + + rc = Xsqlite3PagerOpenWal(tls, pPager, uintptr(0)) + } + } else if int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_WAL { + (*Pager)(unsafe.Pointer(pPager)).FjournalMode = U8(PAGER_JOURNALMODE_DELETE) + } + } + } + return rc +} + +// Playback savepoint pSavepoint. Or, if pSavepoint==NULL, then playback +// the entire super-journal file. The case pSavepoint==NULL occurs when +// a ROLLBACK TO command is invoked on a SAVEPOINT that is a transaction +// savepoint. +// +// When pSavepoint is not NULL (meaning a non-transaction savepoint is +// being rolled back), then the rollback consists of up to three stages, +// performed in the order specified: +// +// * Pages are played back from the main journal starting at byte +// offset PagerSavepoint.iOffset and continuing to +// PagerSavepoint.iHdrOffset, or to the end of the main journal +// file if PagerSavepoint.iHdrOffset is zero. +// +// * If PagerSavepoint.iHdrOffset is not zero, then pages are played +// back starting from the journal header immediately following +// PagerSavepoint.iHdrOffset to the end of the main journal file. +// +// * Pages are then played back from the sub-journal file, starting +// with the PagerSavepoint.iSubRec and continuing to the end of +// the journal file. +// +// Throughout the rollback process, each time a page is rolled back, the +// corresponding bit is set in a bitvec structure (variable pDone in the +// implementation below). This is used to ensure that a page is only +// rolled back the first time it is encountered in either journal. +// +// If pSavepoint is NULL, then pages are only played back from the main +// journal file. There is no need for a bitvec in this case. +// +// In either case, before playback commences the Pager.dbSize variable +// is reset to the value that it held at the start of the savepoint +// (or transaction). No page with a page-number greater than this value +// is played back. If one is encountered it is simply skipped. +func pagerPlaybackSavepoint(tls *libc.TLS, pPager uintptr, pSavepoint uintptr) int32 { /* sqlite3.c:55989:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var szJ I64 // Effective size of the main journal + var iHdrOff I64 // End of first segment of main-journal records + var rc int32 = SQLITE_OK // Return code + var pDone uintptr = uintptr(0) // Bitvec to ensure pages played back only once + + // Allocate a bitvec to use to store the set of pages rolled back + if pSavepoint != 0 { + pDone = Xsqlite3BitvecCreate(tls, (*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FnOrig) + if !(pDone != 0) { + return SQLITE_NOMEM + } + } + + // Set the database size back to the value it was before the savepoint + // being reverted was opened. + (*Pager)(unsafe.Pointer(pPager)).FdbSize = func() uint32 { + if pSavepoint != 0 { + return (*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FnOrig + } + return (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize + }() + (*Pager)(unsafe.Pointer(pPager)).FchangeCountDone = (*Pager)(unsafe.Pointer(pPager)).FtempFile + + if !(pSavepoint != 0) && ((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) { + return pagerRollbackWal(tls, pPager) + } + + // Use pPager->journalOff as the effective size of the main rollback + // journal. The actual file might be larger than this in + // PAGER_JOURNALMODE_TRUNCATE or PAGER_JOURNALMODE_PERSIST. But anything + // past pPager->journalOff is off-limits to us. + szJ = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + + // Begin by rolling back records from the main journal starting at + // PagerSavepoint.iOffset and continuing to the next journal header. + // There might be records in the main journal that have a page number + // greater than the current database size (pPager->dbSize) but those + // will be skipped automatically. Pages are added to pDone as they + // are played back. + if (pSavepoint != 0) && !((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) { + if (*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FiHdrOffset != 0 { + iHdrOff = (*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FiHdrOffset + } else { + iHdrOff = szJ + } + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = (*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FiOffset + for (rc == SQLITE_OK) && ((*Pager)(unsafe.Pointer(pPager)).FjournalOff < iHdrOff) { + rc = pager_playback_one_page(tls, pPager, (pPager + 96 /* &.journalOff */), pDone, 1, 1) + } + + } else { + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + } + + // Continue rolling back records out of the main journal starting at + // the first journal header seen and continuing until the effective end + // of the main journal file. Continue to skip out-of-range pages and + // continue adding pages rolled back to pDone. + for (rc == SQLITE_OK) && ((*Pager)(unsafe.Pointer(pPager)).FjournalOff < szJ) { + var ii U32 // Loop counter + *(*U32)(unsafe.Pointer(bp /* nJRec */)) = U32(0) // Number of Journal Records + // var dummy U32 at bp+4, 4 + + rc = readJournalHdr(tls, pPager, 0, szJ, bp /* &nJRec */, bp+4 /* &dummy */) + + // The "pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff" + // test is related to ticket #2565. See the discussion in the + // pager_playback() function for additional information. + if (*(*U32)(unsafe.Pointer(bp /* nJRec */)) == U32(0)) && + (((*Pager)(unsafe.Pointer(pPager)).FjournalHdr + (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) == (*Pager)(unsafe.Pointer(pPager)).FjournalOff) { + *(*U32)(unsafe.Pointer(bp /* nJRec */)) = (U32((szJ - (*Pager)(unsafe.Pointer(pPager)).FjournalOff) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8)))) + } + for ii = U32(0); ((rc == SQLITE_OK) && (ii < *(*U32)(unsafe.Pointer(bp /* nJRec */)))) && ((*Pager)(unsafe.Pointer(pPager)).FjournalOff < szJ); ii++ { + rc = pager_playback_one_page(tls, pPager, (pPager + 96 /* &.journalOff */), pDone, 1, 1) + } + + } + + // Finally, rollback pages from the sub-journal. Page that were + // previously rolled back out of the main journal (and are hence in pDone) + // will be skipped. Out-of-range pages are also skipped. + if pSavepoint != 0 { + var ii U32 // Loop counter + *(*I64)(unsafe.Pointer(bp + 8 /* offset */)) = (I64((*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FiSubRec) * (I64(4 + (*Pager)(unsafe.Pointer(pPager)).FpageSize))) + + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + rc = Xsqlite3WalSavepointUndo(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, pSavepoint+36 /* &.aWalData */) + } + for ii = (*PagerSavepoint)(unsafe.Pointer(pSavepoint)).FiSubRec; (rc == SQLITE_OK) && (ii < (*Pager)(unsafe.Pointer(pPager)).FnSubRec); ii++ { + + rc = pager_playback_one_page(tls, pPager, bp+8 /* &offset */, pDone, 0, 1) + } + + } + + Xsqlite3BitvecDestroy(tls, pDone) + if rc == SQLITE_OK { + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = szJ + } + + return rc +} + +// Change the maximum number of in-memory pages that are allowed +// before attempting to recycle clean and unused pages. +func Xsqlite3PagerSetCachesize(tls *libc.TLS, pPager uintptr, mxPage int32) { /* sqlite3.c:56101:21: */ + Xsqlite3PcacheSetCachesize(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, mxPage) +} + +// Change the maximum number of in-memory pages that are allowed +// before attempting to spill pages to journal. +func Xsqlite3PagerSetSpillsize(tls *libc.TLS, pPager uintptr, mxPage int32) int32 { /* sqlite3.c:56109:20: */ + return Xsqlite3PcacheSetSpillsize(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, mxPage) +} + +// Invoke SQLITE_FCNTL_MMAP_SIZE based on the current value of szMmap. +func pagerFixMaplimit(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:56116:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var fd uintptr = (*Pager)(unsafe.Pointer(pPager)).Ffd + if ((*Sqlite3_file)(unsafe.Pointer((fd))).FpMethods != uintptr(0)) && ((*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer(fd)).FpMethods)).FiVersion >= 3) { + // var sz Sqlite3_int64 at bp, 8 + + *(*Sqlite3_int64)(unsafe.Pointer(bp /* sz */)) = (*Pager)(unsafe.Pointer(pPager)).FszMmap + (*Pager)(unsafe.Pointer(pPager)).FbUseFetch = (U8(libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp /* sz */)) > int64(0)))) + setGetterMethod(tls, pPager) + Xsqlite3OsFileControlHint(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, SQLITE_FCNTL_MMAP_SIZE, bp /* &sz */) + } +} + +// Change the maximum size of any memory mapping made of the database file. +func Xsqlite3PagerSetMmapLimit(tls *libc.TLS, pPager uintptr, szMmap Sqlite3_int64) { /* sqlite3.c:56132:21: */ + (*Pager)(unsafe.Pointer(pPager)).FszMmap = szMmap + pagerFixMaplimit(tls, pPager) +} + +// Free as much memory as possible from the pager. +func Xsqlite3PagerShrink(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:56140:21: */ + Xsqlite3PcacheShrink(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) +} + +// Adjust settings of the pager to those specified in the pgFlags parameter. +// +// The "level" in pgFlags & PAGER_SYNCHRONOUS_MASK sets the robustness +// of the database to damage due to OS crashes or power failures by +// changing the number of syncs()s when writing the journals. +// There are four levels: +// +// OFF sqlite3OsSync() is never called. This is the default +// for temporary and transient files. +// +// NORMAL The journal is synced once before writes begin on the +// database. This is normally adequate protection, but +// it is theoretically possible, though very unlikely, +// that an inopertune power failure could leave the journal +// in a state which would cause damage to the database +// when it is rolled back. +// +// FULL The journal is synced twice before writes begin on the +// database (with some additional information - the nRec field +// of the journal header - being written in between the two +// syncs). If we assume that writing a +// single disk sector is atomic, then this mode provides +// assurance that the journal will not be corrupted to the +// point of causing damage to the database during rollback. +// +// EXTRA This is like FULL except that is also syncs the directory +// that contains the rollback journal after the rollback +// journal is unlinked. +// +// The above is for a rollback-journal mode. For WAL mode, OFF continues +// to mean that no syncs ever occur. NORMAL means that the WAL is synced +// prior to the start of checkpoint and that the database file is synced +// at the conclusion of the checkpoint if the entire content of the WAL +// was written back into the database. But no sync operations occur for +// an ordinary commit in NORMAL mode with WAL. FULL means that the WAL +// file is synced following each commit operation, in addition to the +// syncs associated with NORMAL. There is no difference between FULL +// and EXTRA for WAL mode. +// +// Do not confuse synchronous=FULL with SQLITE_SYNC_FULL. The +// SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync +// using fcntl(F_FULLFSYNC). SQLITE_SYNC_NORMAL means to do an +// ordinary fsync() call. There is no difference between SQLITE_SYNC_FULL +// and SQLITE_SYNC_NORMAL on platforms other than MacOSX. But the +// synchronous=FULL versus synchronous=NORMAL setting determines when +// the xSync primitive is called and is relevant to all platforms. +// +// Numeric values associated with these states are OFF==1, NORMAL=2, +// and FULL=3. +func Xsqlite3PagerSetFlags(tls *libc.TLS, pPager uintptr, pgFlags uint32) { /* sqlite3.c:56196:21: */ + var level uint32 = (pgFlags & uint32(PAGER_SYNCHRONOUS_MASK)) + if (*Pager)(unsafe.Pointer(pPager)).FtempFile != 0 { + (*Pager)(unsafe.Pointer(pPager)).FnoSync = U8(1) + (*Pager)(unsafe.Pointer(pPager)).FfullSync = U8(0) + (*Pager)(unsafe.Pointer(pPager)).FextraSync = U8(0) + } else { + (*Pager)(unsafe.Pointer(pPager)).FnoSync = func() uint8 { + if level == uint32(PAGER_SYNCHRONOUS_OFF) { + return uint8(1) + } + return uint8(0) + }() + (*Pager)(unsafe.Pointer(pPager)).FfullSync = func() uint8 { + if level >= uint32(PAGER_SYNCHRONOUS_FULL) { + return uint8(1) + } + return uint8(0) + }() + (*Pager)(unsafe.Pointer(pPager)).FextraSync = func() uint8 { + if level == uint32(PAGER_SYNCHRONOUS_EXTRA) { + return uint8(1) + } + return uint8(0) + }() + } + if (*Pager)(unsafe.Pointer(pPager)).FnoSync != 0 { + (*Pager)(unsafe.Pointer(pPager)).FsyncFlags = U8(0) + } else if (pgFlags & uint32(PAGER_FULLFSYNC)) != 0 { + (*Pager)(unsafe.Pointer(pPager)).FsyncFlags = U8(SQLITE_SYNC_FULL) + } else { + (*Pager)(unsafe.Pointer(pPager)).FsyncFlags = U8(SQLITE_SYNC_NORMAL) + } + (*Pager)(unsafe.Pointer(pPager)).FwalSyncFlags = (U8(int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags) << 2)) + if (*Pager)(unsafe.Pointer(pPager)).FfullSync != 0 { + *(*U8)(unsafe.Pointer(pPager + 15 /* &.walSyncFlags */)) |= U8((int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags))) + } + if ((pgFlags & uint32(PAGER_CKPT_FULLFSYNC)) != 0) && !(int32((*Pager)(unsafe.Pointer(pPager)).FnoSync) != 0) { + *(*U8)(unsafe.Pointer(pPager + 15 /* &.walSyncFlags */)) |= U8((int32(SQLITE_SYNC_FULL) << 2)) + } + if (pgFlags & uint32(PAGER_CACHESPILL)) != 0 { + *(*U8)(unsafe.Pointer(pPager + 24 /* &.doNotSpill */)) &= libc.Uint8FromInt32((libc.CplInt32(SPILLFLAG_OFF))) + } else { + *(*U8)(unsafe.Pointer(pPager + 24 /* &.doNotSpill */)) |= U8((SPILLFLAG_OFF)) + } +} + +// The following global variable is incremented whenever the library +// attempts to open a temporary file. This information is used for +// testing and analysis only. + +// Open a temporary file. +// +// Write the file descriptor into *pFile. Return SQLITE_OK on success +// or some other error code if we fail. The OS will automatically +// delete the temporary file when it is closed. +// +// The flags passed to the VFS layer xOpen() call are those specified +// by parameter vfsFlags ORed with the following: +// +// SQLITE_OPEN_READWRITE +// SQLITE_OPEN_CREATE +// SQLITE_OPEN_EXCLUSIVE +// SQLITE_OPEN_DELETEONCLOSE +func pagerOpentemp(tls *libc.TLS, pPager uintptr, pFile uintptr, vfsFlags int32) int32 { /* sqlite3.c:56256:12: */ + var rc int32 // Return code + + vfsFlags = vfsFlags | (((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) + rc = Xsqlite3OsOpen(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, uintptr(0), pFile, vfsFlags, uintptr(0)) + + return rc +} + +// Set the busy handler function. +// +// The pager invokes the busy-handler if sqlite3OsLock() returns +// SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock, +// or when trying to upgrade from a RESERVED lock to an EXCLUSIVE +// lock. It does *not* invoke the busy handler when upgrading from +// SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE +// (which occurs during hot-journal rollback). Summary: +// +// Transition | Invokes xBusyHandler +// -------------------------------------------------------- +// NO_LOCK -> SHARED_LOCK | Yes +// SHARED_LOCK -> RESERVED_LOCK | No +// SHARED_LOCK -> EXCLUSIVE_LOCK | No +// RESERVED_LOCK -> EXCLUSIVE_LOCK | Yes +// +// If the busy-handler callback returns non-zero, the lock is +// retried. If it returns zero, then the SQLITE_BUSY error is +// returned to the caller of the pager API function. +func Xsqlite3PagerSetBusyHandler(tls *libc.TLS, pPager uintptr, xBusyHandler uintptr, pBusyHandlerArg uintptr) { /* sqlite3.c:56295:21: */ + var ap uintptr + (*Pager)(unsafe.Pointer(pPager)).FxBusyHandler = xBusyHandler + (*Pager)(unsafe.Pointer(pPager)).FpBusyHandlerArg = pBusyHandlerArg + ap = (pPager + 224 /* &.xBusyHandler */) + + Xsqlite3OsFileControlHint(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, SQLITE_FCNTL_BUSYHANDLER, ap) +} + +// Change the page size used by the Pager object. The new page size +// is passed in *pPageSize. +// +// If the pager is in the error state when this function is called, it +// is a no-op. The value returned is the error state error code (i.e. +// one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL). +// +// Otherwise, if all of the following are true: +// +// * the new page size (value of *pPageSize) is valid (a power +// of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and +// +// * there are no outstanding page references, and +// +// * the database is either not an in-memory database or it is +// an in-memory database that currently consists of zero pages. +// +// then the pager object page size is set to *pPageSize. +// +// If the page size is changed, then this function uses sqlite3PagerMalloc() +// to obtain a new Pager.pTmpSpace buffer. If this allocation attempt +// fails, SQLITE_NOMEM is returned and the page size remains unchanged. +// In all other cases, SQLITE_OK is returned. +// +// If the page size is not changed, either because one of the enumerated +// conditions above is not true, the pager was in error state when this +// function was called, or because the memory allocation attempt failed, +// then *pPageSize is set to the old, retained page size before returning. +func Xsqlite3PagerSetPagesize(tls *libc.TLS, pPager uintptr, pPageSize uintptr, nReserve int32) int32 { /* sqlite3.c:56339:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + + // It is not possible to do a full assert_pager_state() here, as this + // function may be called from within PagerOpen(), before the state + // of the Pager object is internally consistent. + // + // At one point this function returned an error if the pager was in + // PAGER_ERROR state. But since PAGER_ERROR state guarantees that + // there is at least one outstanding page reference, this function + // is a no-op for that case anyhow. + + var pageSize U32 = *(*U32)(unsafe.Pointer(pPageSize)) + + if ((((int32((*Pager)(unsafe.Pointer(pPager)).FmemDb) == 0) || ((*Pager)(unsafe.Pointer(pPager)).FdbSize == Pgno(0))) && + (Xsqlite3PcacheRefCount(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) == 0)) && + (pageSize != 0)) && (pageSize != U32((*Pager)(unsafe.Pointer(pPager)).FpageSize)) { + var pNew uintptr = uintptr(0) // New temp space + *(*I64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + + if (int32((*Pager)(unsafe.Pointer(pPager)).FeState) > PAGER_OPEN) && ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) { + rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, bp /* &nByte */) + } + if rc == SQLITE_OK { + // 8 bytes of zeroed overrun space is sufficient so that the b-tree + // cell header parser will never run off the end of the allocation + pNew = Xsqlite3PageMalloc(tls, (int32(pageSize + U32(8)))) + if !(pNew != 0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, (pNew + uintptr(pageSize)), 0, uint64(8)) + } + } + + if rc == SQLITE_OK { + pager_reset(tls, pPager) + rc = Xsqlite3PcacheSetPageSize(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, int32(pageSize)) + } + if rc == SQLITE_OK { + Xsqlite3PageFree(tls, (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace) + (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace = pNew + (*Pager)(unsafe.Pointer(pPager)).FdbSize = (Pgno(((*(*I64)(unsafe.Pointer(bp /* nByte */)) + I64(pageSize)) - int64(1)) / I64(pageSize))) + (*Pager)(unsafe.Pointer(pPager)).FpageSize = int32(pageSize) + } else { + Xsqlite3PageFree(tls, pNew) + } + } + + *(*U32)(unsafe.Pointer(pPageSize)) = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) + if rc == SQLITE_OK { + if nReserve < 0 { + nReserve = int32((*Pager)(unsafe.Pointer(pPager)).FnReserve) + } + + (*Pager)(unsafe.Pointer(pPager)).FnReserve = I16(nReserve) + pagerFixMaplimit(tls, pPager) + } + return rc +} + +// Return a pointer to the "temporary page" buffer held internally +// by the pager. This is a buffer that is big enough to hold the +// entire content of a database page. This buffer is used internally +// during rollback and will be overwritten whenever a rollback +// occurs. But other modules are free to use it too, as long as +// no rollbacks are happening. +func Xsqlite3PagerTempSpace(tls *libc.TLS, pPager uintptr) uintptr { /* sqlite3.c:56407:21: */ + return (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace +} + +// Attempt to set the maximum database page count if mxPage is positive. +// Make no changes if mxPage is zero or negative. And never reduce the +// maximum page count below the current size of the database. +// +// Regardless of mxPage, return the current maximum page count. +func Xsqlite3PagerMaxPageCount(tls *libc.TLS, pPager uintptr, mxPage Pgno) Pgno { /* sqlite3.c:56418:21: */ + if mxPage > Pgno(0) { + (*Pager)(unsafe.Pointer(pPager)).FmxPgno = mxPage + } + // Called only by OP_MaxPgcnt + // assert( pPager->mxPgno>=pPager->dbSize ); + // OP_MaxPgcnt ensures that the parameter passed to this function is not + // less than the total number of valid pages in the database. But this + // may be less than Pager.dbSize, and so the assert() above is not valid + return (*Pager)(unsafe.Pointer(pPager)).FmxPgno +} + +// The following set of routines are used to disable the simulated +// I/O error mechanism. These routines are used to avoid simulated +// errors in places where we do not care about errors. +// +// Unless -DSQLITE_TEST=1 is used, these routines are all no-ops +// and generate no code. + +// Read the first N bytes from the beginning of the file into memory +// that pDest points to. +// +// If the pager was opened on a transient file (zFilename==""), or +// opened on a file less than N bytes in size, the output buffer is +// zeroed and SQLITE_OK returned. The rationale for this is that this +// function is used to read database headers, and a new transient or +// zero sized database has a header than consists entirely of zeroes. +// +// If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered, +// the error code is returned to the caller and the contents of the +// output buffer undefined. +func Xsqlite3PagerReadFileheader(tls *libc.TLS, pPager uintptr, N int32, pDest uintptr) int32 { /* sqlite3.c:56468:20: */ + var rc int32 = SQLITE_OK + libc.Xmemset(tls, pDest, 0, uint64(N)) + + // This routine is only called by btree immediately after creating + // the Pager object. There has not been an opportunity to transition + // to WAL mode yet. + + if (*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0) { + + rc = Xsqlite3OsRead(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, pDest, N, int64(0)) + if rc == (SQLITE_IOERR | (int32(2) << 8)) { + rc = SQLITE_OK + } + } + return rc +} + +// This function may only be called when a read-transaction is open on +// the pager. It returns the total number of pages in the database. +// +// However, if the file is between 1 and bytes in size, then +// this is considered a 1 page file. +func Xsqlite3PagerPagecount(tls *libc.TLS, pPager uintptr, pnPage uintptr) { /* sqlite3.c:56496:21: */ + + *(*int32)(unsafe.Pointer(pnPage)) = int32((*Pager)(unsafe.Pointer(pPager)).FdbSize) +} + +// Try to obtain a lock of type locktype on the database file. If +// a similar or greater lock is already held, this function is a no-op +// (returning SQLITE_OK immediately). +// +// Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke +// the busy callback if the lock is currently not available. Repeat +// until the busy callback returns false or until the attempt to +// obtain the lock succeeds. +// +// Return SQLITE_OK on success and an error code if we cannot obtain +// the lock. If the lock is obtained successfully, set the Pager.state +// variable to locktype before returning. +func pager_wait_on_lock(tls *libc.TLS, pPager uintptr, locktype int32) int32 { /* sqlite3.c:56517:12: */ + var rc int32 // Return code + + // Check that this is either a no-op (because the requested lock is + // already held), or one of the transitions that the busy-handler + // may be invoked during, according to the comment above + // sqlite3PagerSetBusyhandler(). + + for ok := true; ok; ok = ((rc == SQLITE_BUSY) && ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pPager + 224 /* &.xBusyHandler */))))(tls, (*Pager)(unsafe.Pointer(pPager)).FpBusyHandlerArg) != 0)) { + rc = pagerLockDb(tls, pPager, locktype) + } + return rc +} + +// Function assertTruncateConstraint(pPager) checks that one of the +// following is true for all dirty pages currently in the page-cache: +// +// a) The page number is less than or equal to the size of the +// current database image, in pages, OR +// +// b) if the page content were written at this time, it would not +// be necessary to write the current content out to the sub-journal +// (as determined by function subjRequiresPage()). +// +// If the condition asserted by this function were not true, and the +// dirty page were to be discarded from the cache via the pagerStress() +// routine, pagerStress() would not write the current page content to +// the database file. If a savepoint transaction were rolled back after +// this happened, the correct behavior would be to restore the current +// content of the page. However, since this content is not present in either +// the database file or the portion of the rollback journal and +// sub-journal rolled back the content could not be restored and the +// database image would become corrupt. It is therefore fortunate that +// this circumstance cannot arise. + +// Truncate the in-memory database file image to nPage pages. This +// function does not actually modify the database file on disk. It +// just sets the internal state of the pager object so that the +// truncation will be done when the current transaction is committed. +// +// This function is only called right before committing a transaction. +// Once this function has been called, the transaction must either be +// rolled back or committed. It is not safe to call this function and +// then continue writing to the database. +func Xsqlite3PagerTruncateImage(tls *libc.TLS, pPager uintptr, nPage Pgno) { /* sqlite3.c:56581:21: */ + + (*Pager)(unsafe.Pointer(pPager)).FdbSize = nPage + + // At one point the code here called assertTruncateConstraint() to + // ensure that all pages being truncated away by this operation are, + // if one or more savepoints are open, present in the savepoint + // journal so that they can be restored if the savepoint is rolled + // back. This is no longer necessary as this function is now only + // called right before committing a transaction. So although the + // Pager object may still have open savepoints (Pager.nSavepoint!=0), + // they cannot be rolled back. So the assertTruncateConstraint() call + // is no longer correct. +} + +// This function is called before attempting a hot-journal rollback. It +// syncs the journal file to disk, then sets pPager->journalHdr to the +// size of the journal file so that the pager_playback() routine knows +// that the entire journal file has been synced. +// +// Syncing a hot-journal to disk before attempting to roll it back ensures +// that if a power-failure occurs during the rollback, the process that +// attempts rollback following system recovery sees the same journal +// content as this process. +// +// If everything goes as planned, SQLITE_OK is returned. Otherwise, +// an SQLite error code. +func pagerSyncHotJournal(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:56613:12: */ + var rc int32 = SQLITE_OK + if !(int32((*Pager)(unsafe.Pointer(pPager)).FnoSync) != 0) { + rc = Xsqlite3OsSync(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, SQLITE_SYNC_NORMAL) + } + if rc == SQLITE_OK { + rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (pPager + 104 /* &.journalHdr */)) + } + return rc +} + +// Obtain a reference to a memory mapped page object for page number pgno. +// The new object will use the pointer pData, obtained from xFetch(). +// If successful, set *ppPage to point to the new page reference +// and return SQLITE_OK. Otherwise, return an SQLite error code and set +// *ppPage to zero. +// +// Page references obtained by calling this function should be released +// by calling pagerReleaseMapPage(). +func pagerAcquireMapPage(tls *libc.TLS, pPager uintptr, pgno Pgno, pData uintptr, ppPage uintptr) int32 { /* sqlite3.c:56635:12: */ + var p uintptr // Memory mapped page to return + + if (*Pager)(unsafe.Pointer(pPager)).FpMmapFreelist != 0 { + *(*uintptr)(unsafe.Pointer(ppPage)) = libc.AssignUintptr(&p, (*Pager)(unsafe.Pointer(pPager)).FpMmapFreelist) + (*Pager)(unsafe.Pointer(pPager)).FpMmapFreelist = (*PgHdr)(unsafe.Pointer(p)).FpDirty + (*PgHdr)(unsafe.Pointer(p)).FpDirty = uintptr(0) + + libc.Xmemset(tls, (*PgHdr)(unsafe.Pointer(p)).FpExtra, 0, uint64(8)) + } else { + *(*uintptr)(unsafe.Pointer(ppPage)) = libc.AssignUintptr(&p, Xsqlite3MallocZero(tls, (uint64(uint64(unsafe.Sizeof(PgHdr{}))+uint64((*Pager)(unsafe.Pointer(pPager)).FnExtra))))) + if p == uintptr(0) { + Xsqlite3OsUnfetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, ((I64(pgno - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)), pData) + return SQLITE_NOMEM + } + (*PgHdr)(unsafe.Pointer(p)).FpExtra = (p + 1*72) + (*PgHdr)(unsafe.Pointer(p)).Fflags = U16(PGHDR_MMAP) + (*PgHdr)(unsafe.Pointer(p)).FnRef = int16(1) + (*PgHdr)(unsafe.Pointer(p)).FpPager = pPager + } + + (*PgHdr)(unsafe.Pointer(p)).Fpgno = pgno + (*PgHdr)(unsafe.Pointer(p)).FpData = pData + (*Pager)(unsafe.Pointer(pPager)).FnMmapOut++ + + return SQLITE_OK +} + +// Release a reference to page pPg. pPg must have been returned by an +// earlier call to pagerAcquireMapPage(). +func pagerReleaseMapPage(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:56679:13: */ + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + (*Pager)(unsafe.Pointer(pPager)).FnMmapOut-- + (*PgHdr)(unsafe.Pointer(pPg)).FpDirty = (*Pager)(unsafe.Pointer(pPager)).FpMmapFreelist + (*Pager)(unsafe.Pointer(pPager)).FpMmapFreelist = pPg + + Xsqlite3OsUnfetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, ((I64((*PgHdr)(unsafe.Pointer(pPg)).Fpgno - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)), (*PgHdr)(unsafe.Pointer(pPg)).FpData) +} + +// Free all PgHdr objects stored in the Pager.pMmapFreelist list. +func pagerFreeMapHdrs(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:56692:13: */ + var p uintptr + var pNext uintptr + for p = (*Pager)(unsafe.Pointer(pPager)).FpMmapFreelist; p != 0; p = pNext { + pNext = (*PgHdr)(unsafe.Pointer(p)).FpDirty + Xsqlite3_free(tls, p) + } +} + +// Verify that the database file has not be deleted or renamed out from +// under the pager. Return SQLITE_OK if the database is still where it ought +// to be on disk. Return non-zero (SQLITE_READONLY_DBMOVED or some other error +// code from sqlite3OsAccess()) if the database has gone missing. +func databaseIsUnmoved(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:56706:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* bHasMoved */)) = 0 + var rc int32 + + if (*Pager)(unsafe.Pointer(pPager)).FtempFile != 0 { + return SQLITE_OK + } + if (*Pager)(unsafe.Pointer(pPager)).FdbSize == Pgno(0) { + return SQLITE_OK + } + + rc = Xsqlite3OsFileControl(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, SQLITE_FCNTL_HAS_MOVED, bp /* &bHasMoved */) + if rc == SQLITE_NOTFOUND { + // If the HAS_MOVED file-control is unimplemented, assume that the file + // has not been moved. That is the historical behavior of SQLite: prior to + // version 3.8.3, it never checked + rc = SQLITE_OK + } else if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* bHasMoved */)) != 0) { + rc = (SQLITE_READONLY | (int32(4) << 8)) + } + return rc +} + +// Shutdown the page cache. Free all memory and close all files. +// +// If a transaction was in progress when this routine is called, that +// transaction is rolled back. All outstanding pages are invalidated +// and their memory is freed. Any attempt to use a page associated +// with this page cache after this function returns will likely +// result in a coredump. +// +// This function always succeeds. If a transaction is active an attempt +// is made to roll it back. If an error occurs during the rollback +// a hot journal may be left in the filesystem but no error is returned +// to the caller. +func Xsqlite3PagerClose(tls *libc.TLS, pPager uintptr, db uintptr) int32 { /* sqlite3.c:56740:20: */ + var pTmp uintptr = (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace + + Xsqlite3BeginBenignMalloc(tls) + pagerFreeMapHdrs(tls, pPager) + // pPager->errCode = 0; + (*Pager)(unsafe.Pointer(pPager)).FexclusiveMode = U8(0) + { + var a uintptr = uintptr(0) + + if ((db != 0) && (uint64(0) == ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_NoCkptOnClose)))) && + (SQLITE_OK == databaseIsUnmoved(tls, pPager)) { + a = pTmp + } + Xsqlite3WalClose(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, db, int32((*Pager)(unsafe.Pointer(pPager)).FwalSyncFlags), (*Pager)(unsafe.Pointer(pPager)).FpageSize, a) + (*Pager)(unsafe.Pointer(pPager)).FpWal = uintptr(0) + + } + pager_reset(tls, pPager) + if (*Pager)(unsafe.Pointer(pPager)).FmemDb != 0 { + pager_unlock(tls, pPager) + } else { + // If it is open, sync the journal file before calling UnlockAndRollback. + // If this is not done, then an unsynced portion of the open journal + // file may be played back into the database. If a power failure occurs + // while this is happening, the database could become corrupt. + // + // If an error occurs while trying to sync the journal, shift the pager + // into the ERROR state. This causes UnlockAndRollback to unlock the + // database and close the journal file without attempting to roll it + // back or finalize it. The next database user will have to do hot-journal + // rollback before accessing the database file. + if (*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0) { + pager_error(tls, pPager, pagerSyncHotJournal(tls, pPager)) + } + pagerUnlockAndRollback(tls, pPager) + } + Xsqlite3EndBenignMalloc(tls) + + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd) + Xsqlite3PageFree(tls, pTmp) + Xsqlite3PcacheClose(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + + Xsqlite3_free(tls, pPager) + return SQLITE_OK +} + +// Increment the reference count for page pPg. +func Xsqlite3PagerRef(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:56809:21: */ + Xsqlite3PcacheRef(tls, pPg) +} + +// Sync the journal. In other words, make sure all the pages that have +// been written to the journal have actually reached the surface of the +// disk and can be restored in the event of a hot-journal rollback. +// +// If the Pager.noSync flag is set, then this function is a no-op. +// Otherwise, the actions required depend on the journal-mode and the +// device characteristics of the file-system, as follows: +// +// * If the journal file is an in-memory journal file, no action need +// be taken. +// +// * Otherwise, if the device does not support the SAFE_APPEND property, +// then the nRec field of the most recently written journal header +// is updated to contain the number of journal records that have +// been written following it. If the pager is operating in full-sync +// mode, then the journal file is synced before this field is updated. +// +// * If the device does not support the SEQUENTIAL property, then +// journal file is synced. +// +// Or, in pseudo-code: +// +// if( NOT ){ +// if( NOT SAFE_APPEND ){ +// if( ) xSync(); +// +// } +// if( NOT SEQUENTIAL ) xSync(); +// } +// +// If successful, this routine clears the PGHDR_NEED_SYNC flag of every +// page currently held in memory before returning SQLITE_OK. If an IO +// error is encountered, then the IO error code is returned to the caller. +func syncJournal(tls *libc.TLS, pPager uintptr, newHdr int32) int32 { /* sqlite3.c:56848:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var rc int32 // Return code + + rc = Xsqlite3PagerExclusiveLock(tls, pPager) + if rc != SQLITE_OK { + return rc + } + + if !(int32((*Pager)(unsafe.Pointer(pPager)).FnoSync) != 0) { + + if ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) && (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) != PAGER_JOURNALMODE_MEMORY) { + var iDc int32 = Xsqlite3OsDeviceCharacteristics(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd) + + if 0 == (iDc & SQLITE_IOCAP_SAFE_APPEND) { + // This block deals with an obscure problem. If the last connection + // that wrote to this database was operating in persistent-journal + // mode, then the journal file may at this point actually be larger + // than Pager.journalOff bytes. If the next thing in the journal + // file happens to be a journal-header (written as part of the + // previous connection's transaction), and a crash or power-failure + // occurs after nRec is updated but before this connection writes + // anything else to the journal file (or commits/rolls back its + // transaction), then SQLite may become confused when doing the + // hot-journal rollback following recovery. It may roll back all + // of this connections data, then proceed to rolling back the old, + // out-of-date data that follows it. Database corruption. + // + // To work around this, if the journal file does appear to contain + // a valid header following Pager.journalOff, then write a 0x00 + // byte to the start of it to prevent it from being recognized. + // + // Variable iNextHdrOffset is set to the offset at which this + // problematic header will occur, if it exists. aMagic is used + // as a temporary buffer to inspect the first couple of bytes of + // the potential journal header. + var iNextHdrOffset I64 + // var aMagic [8]U8 at bp+12, 8 + + // var zHeader [12]U8 at bp, 12 + + libc.Xmemcpy(tls, bp /* &zHeader[0] */, uintptr(unsafe.Pointer(&aJournalMagic)), uint64(unsafe.Sizeof(aJournalMagic))) + Xsqlite3Put4byte(tls, (bp /* &zHeader */ + 8), uint32((*Pager)(unsafe.Pointer(pPager)).FnRec)) + + iNextHdrOffset = journalHdrOffset(tls, pPager) + rc = Xsqlite3OsRead(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp+12 /* &aMagic[0] */, 8, iNextHdrOffset) + if (rc == SQLITE_OK) && (0 == libc.Xmemcmp(tls, bp+12 /* &aMagic[0] */, uintptr(unsafe.Pointer(&aJournalMagic)), uint64(8))) { + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, uintptr(unsafe.Pointer(&zerobyte)), 1, iNextHdrOffset) + } + if (rc != SQLITE_OK) && (rc != (SQLITE_IOERR | (int32(2) << 8))) { + return rc + } + + // Write the nRec value into the journal file header. If in + // full-synchronous mode, sync the journal first. This ensures that + // all data has really hit the disk before nRec is updated to mark + // it as a candidate for rollback. + // + // This is not required if the persistent media supports the + // SAFE_APPEND property. Because in this case it is not possible + // for garbage data to be appended to the file, the nRec field + // is populated with 0xFFFFFFFF when the journal header is written + // and never needs to be updated. + if ((*Pager)(unsafe.Pointer(pPager)).FfullSync != 0) && (0 == (iDc & SQLITE_IOCAP_SEQUENTIAL)) { + + rc = Xsqlite3OsSync(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags)) + if rc != SQLITE_OK { + return rc + } + } + + rc = Xsqlite3OsWrite(tls, + (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp /* &zHeader[0] */, int32(unsafe.Sizeof([12]U8{})), (*Pager)(unsafe.Pointer(pPager)).FjournalHdr) + if rc != SQLITE_OK { + return rc + } + } + if 0 == (iDc & SQLITE_IOCAP_SEQUENTIAL) { + + rc = Xsqlite3OsSync(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, (int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags) | (func() int32 { + if int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags) == SQLITE_SYNC_FULL { + return SQLITE_SYNC_DATAONLY + } + return 0 + }()))) + if rc != SQLITE_OK { + return rc + } + } + + (*Pager)(unsafe.Pointer(pPager)).FjournalHdr = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + if (newHdr != 0) && (0 == (iDc & SQLITE_IOCAP_SAFE_APPEND)) { + (*Pager)(unsafe.Pointer(pPager)).FnRec = 0 + rc = writeJournalHdr(tls, pPager) + if rc != SQLITE_OK { + return rc + } + } + } else { + (*Pager)(unsafe.Pointer(pPager)).FjournalHdr = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + } + } + + // Unless the pager is in noSync mode, the journal file was just + // successfully synced. Either way, clear the PGHDR_NEED_SYNC flag on + // all pages. + Xsqlite3PcacheClearSyncFlags(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_WRITER_DBMOD) + + return SQLITE_OK +} + +var zerobyte U8 = U8(0) /* sqlite3.c:56899:27 */ + +// The argument is the first in a linked list of dirty pages connected +// by the PgHdr.pDirty pointer. This function writes each one of the +// in-memory pages in the list to the database file. The argument may +// be NULL, representing an empty list. In this case this function is +// a no-op. +// +// The pager must hold at least a RESERVED lock when this function +// is called. Before writing anything to the database file, this lock +// is upgraded to an EXCLUSIVE lock. If the lock cannot be obtained, +// SQLITE_BUSY is returned and no data is written to the database file. +// +// If the pager is a temp-file pager and the actual file-system file +// is not yet open, it is created and opened before any data is +// written out. +// +// Once the lock has been upgraded and, if necessary, the file opened, +// the pages are written out to the database file in list order. Writing +// a page is skipped if it meets either of the following criteria: +// +// * The page number is greater than Pager.dbSize, or +// * The PGHDR_DONT_WRITE flag is set on the page. +// +// If writing out a page causes the database file to grow, Pager.dbFileSize +// is updated accordingly. If page 1 is written out, then the value cached +// in Pager.dbFileVers[] is updated to match the new value stored in +// the database file. +// +// If everything is successful, SQLITE_OK is returned. If an IO error +// occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot +// be obtained, SQLITE_BUSY is returned. +func pager_write_pagelist(tls *libc.TLS, pPager uintptr, pList uintptr) int32 { /* sqlite3.c:56991:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK // Return code + + // This function is only called for rollback pagers in WRITER_DBMOD state. + + // If the file is a temp-file has not yet been opened, open it now. It + // is not possible for rc to be other than SQLITE_OK if this branch + // is taken, as pager_wait_on_lock() is a no-op for temp-files. + if !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) { + + rc = pagerOpentemp(tls, pPager, (*Pager)(unsafe.Pointer(pPager)).Ffd, int32((*Pager)(unsafe.Pointer(pPager)).FvfsFlags)) + } + + // Before the first write, give the VFS a hint of what the final + // file size will be. + + if ((rc == SQLITE_OK) && + ((*Pager)(unsafe.Pointer(pPager)).FdbHintSize < (*Pager)(unsafe.Pointer(pPager)).FdbSize)) && + (((*PgHdr)(unsafe.Pointer(pList)).FpDirty != 0) || ((*PgHdr)(unsafe.Pointer(pList)).Fpgno > (*Pager)(unsafe.Pointer(pPager)).FdbHintSize)) { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* szFile */)) = (Sqlite3_int64((*Pager)(unsafe.Pointer(pPager)).FpageSize) * Sqlite3_int64((*Pager)(unsafe.Pointer(pPager)).FdbSize)) + Xsqlite3OsFileControlHint(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, SQLITE_FCNTL_SIZE_HINT, bp /* &szFile */) + (*Pager)(unsafe.Pointer(pPager)).FdbHintSize = (*Pager)(unsafe.Pointer(pPager)).FdbSize + } + + for (rc == SQLITE_OK) && (pList != 0) { + var pgno Pgno = (*PgHdr)(unsafe.Pointer(pList)).Fpgno + + // If there are dirty pages in the page cache with page numbers greater + // than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to + // make the file smaller (presumably by auto-vacuum code). Do not write + // any such pages to the file. + // + // Also, do not write out any page that has the PGHDR_DONT_WRITE flag + // set (set by sqlite3PagerDontWrite()). + if (pgno <= (*Pager)(unsafe.Pointer(pPager)).FdbSize) && (0 == (int32((*PgHdr)(unsafe.Pointer(pList)).Fflags) & PGHDR_DONT_WRITE)) { + var offset I64 = ((I64(pgno - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) // Offset to write + var pData uintptr // Data to write + + if (*PgHdr)(unsafe.Pointer(pList)).Fpgno == Pgno(1) { + pager_write_changecounter(tls, pList) + } + + pData = (*PgHdr)(unsafe.Pointer(pList)).FpData + + // Write out the page data. + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, pData, (*Pager)(unsafe.Pointer(pPager)).FpageSize, offset) + + // If page 1 was just written, update Pager.dbFileVers to match + // the value now stored in the database file. If writing this + // page caused the database file to grow, update dbFileSize. + if pgno == Pgno(1) { + libc.Xmemcpy(tls, (pPager + 136 /* &.dbFileVers */), (pData + 24), uint64(unsafe.Sizeof([16]int8{}))) + } + if pgno > (*Pager)(unsafe.Pointer(pPager)).FdbFileSize { + (*Pager)(unsafe.Pointer(pPager)).FdbFileSize = pgno + } + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + 2*4))++ + + // Update any backup objects copying the contents of this pager. + Xsqlite3BackupUpdate(tls, (*Pager)(unsafe.Pointer(pPager)).FpBackup, pgno, (*PgHdr)(unsafe.Pointer(pList)).FpData) + + } else { + + } + + pList = (*PgHdr)(unsafe.Pointer(pList)).FpDirty + } + + return rc +} + +// Ensure that the sub-journal file is open. If it is already open, this +// function is a no-op. +// +// SQLITE_OK is returned if everything goes according to plan. An +// SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen() +// fails. +func openSubJournal(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:57082:12: */ + var rc int32 = SQLITE_OK + if !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fsjfd))).FpMethods != uintptr(0)) { + var flags int32 = ((((SQLITE_OPEN_SUBJOURNAL | SQLITE_OPEN_READWRITE) | + SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | + SQLITE_OPEN_DELETEONCLOSE) + var nStmtSpill int32 = Xsqlite3Config.FnStmtSpill + if (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_MEMORY) || ((*Pager)(unsafe.Pointer(pPager)).FsubjInMemory != 0) { + nStmtSpill = -1 + } + rc = Xsqlite3JournalOpen(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, uintptr(0), (*Pager)(unsafe.Pointer(pPager)).Fsjfd, flags, nStmtSpill) + } + return rc +} + +// Append a record of the current state of page pPg to the sub-journal. +// +// If successful, set the bit corresponding to pPg->pgno in the bitvecs +// for all open savepoints before returning. +// +// This function returns SQLITE_OK if everything is successful, an IO +// error code if the attempt to write to the sub-journal fails, or +// SQLITE_NOMEM if a malloc fails while setting a bit in a savepoint +// bitvec. +func subjournalPage(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:57108:12: */ + var rc int32 = SQLITE_OK + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + if int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) != PAGER_JOURNALMODE_OFF { + + // Open the sub-journal, if it has not already been opened + + rc = openSubJournal(tls, pPager) + + // If the sub-journal was opened successfully (or was already open), + // write the journal record into the file. + if rc == SQLITE_OK { + var pData uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpData + var offset I64 = (I64((*Pager)(unsafe.Pointer(pPager)).FnSubRec) * (I64(4 + (*Pager)(unsafe.Pointer(pPager)).FpageSize))) + var pData2 uintptr + pData2 = pData + + rc = write32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fsjfd, offset, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) + if rc == SQLITE_OK { + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fsjfd, pData2, (*Pager)(unsafe.Pointer(pPager)).FpageSize, (offset + int64(4))) + } + } + } + if rc == SQLITE_OK { + (*Pager)(unsafe.Pointer(pPager)).FnSubRec++ + + rc = addToSavepointBitvecs(tls, pPager, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) + } + return rc +} + +func subjournalPageIfRequired(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:57144:12: */ + if subjRequiresPage(tls, pPg) != 0 { + return subjournalPage(tls, pPg) + } else { + return SQLITE_OK + } + return int32(0) +} + +// This function is called by the pcache layer when it has reached some +// soft memory limit. The first argument is a pointer to a Pager object +// (cast as a void*). The pager is always 'purgeable' (not an in-memory +// database). The second argument is a reference to a page that is +// currently dirty but has no outstanding references. The page +// is always associated with the Pager object passed as the first +// argument. +// +// The job of this function is to make pPg clean by writing its contents +// out to the database file, if possible. This may involve syncing the +// journal file. +// +// If successful, sqlite3PcacheMakeClean() is called on the page and +// SQLITE_OK returned. If an IO error occurs while trying to make the +// page clean, the IO error code is returned. If the page cannot be +// made clean for some other reason, but no error occurs, then SQLITE_OK +// is returned by sqlite3PcacheMakeClean() is not called. +func pagerStress(tls *libc.TLS, p uintptr, pPg uintptr) int32 { /* sqlite3.c:57171:12: */ + var pPager uintptr = p + var rc int32 = SQLITE_OK + + // The doNotSpill NOSYNC bit is set during times when doing a sync of + // journal (and adding a new header) is not allowed. This occurs + // during calls to sqlite3PagerWrite() while trying to journal multiple + // pages belonging to the same sector. + // + // The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling + // regardless of whether or not a sync is required. This is set during + // a rollback or by user request, respectively. + // + // Spilling is also prohibited when in an error state since that could + // lead to database corruption. In the current implementation it + // is impossible for sqlite3PcacheFetch() to be called with createFlag==3 + // while in the error state, hence it is impossible for this routine to + // be called in the error state. Nevertheless, we include a NEVER() + // test for the error state as a safeguard against future changes. + if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return SQLITE_OK + } + + if ((*Pager)(unsafe.Pointer(pPager)).FdoNotSpill != 0) && + (((int32((*Pager)(unsafe.Pointer(pPager)).FdoNotSpill) & (SPILLFLAG_ROLLBACK | SPILLFLAG_OFF)) != 0) || + ((int32((*PgHdr)(unsafe.Pointer(pPg)).Fflags) & PGHDR_NEED_SYNC) != 0)) { + return SQLITE_OK + } + + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + 3*4))++ + (*PgHdr)(unsafe.Pointer(pPg)).FpDirty = uintptr(0) + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + // Write a single frame for this page to the log. + rc = subjournalPageIfRequired(tls, pPg) + if rc == SQLITE_OK { + rc = pagerWalFrames(tls, pPager, pPg, uint32(0), 0) + } + } else { + + // Sync the journal file if required. + if ((int32((*PgHdr)(unsafe.Pointer(pPg)).Fflags) & PGHDR_NEED_SYNC) != 0) || + (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_WRITER_CACHEMOD) { + rc = syncJournal(tls, pPager, 1) + } + + // Write the contents of the page out to the database file. + if rc == SQLITE_OK { + + rc = pager_write_pagelist(tls, pPager, pPg) + } + } + + // Mark the page as clean. + if rc == SQLITE_OK { + + Xsqlite3PcacheMakeClean(tls, pPg) + } + + return pager_error(tls, pPager, rc) +} + +// Flush all unreferenced dirty pages to disk. +func Xsqlite3PagerFlush(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:57248:20: */ + var rc int32 = (*Pager)(unsafe.Pointer(pPager)).FerrCode + if !(int32((*Pager)(unsafe.Pointer(pPager)).FmemDb) != 0) { + var pList uintptr = Xsqlite3PcacheDirtyList(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + + for (rc == SQLITE_OK) && (pList != 0) { + var pNext uintptr = (*PgHdr)(unsafe.Pointer(pList)).FpDirty + if int32((*PgHdr)(unsafe.Pointer(pList)).FnRef) == 0 { + rc = pagerStress(tls, pPager, pList) + } + pList = pNext + } + } + + return rc +} + +// Allocate and initialize a new Pager object and put a pointer to it +// in *ppPager. The pager should eventually be freed by passing it +// to sqlite3PagerClose(). +// +// The zFilename argument is the path to the database file to open. +// If zFilename is NULL then a randomly-named temporary file is created +// and used as the file to be cached. Temporary files are be deleted +// automatically when they are closed. If zFilename is ":memory:" then +// all information is held in cache. It is never written to disk. +// This can be used to implement an in-memory database. +// +// The nExtra parameter specifies the number of bytes of space allocated +// along with each page reference. This space is available to the user +// via the sqlite3PagerGetExtra() API. When a new page is allocated, the +// first 8 bytes of this space are zeroed but the remainder is uninitialized. +// (The extra space is used by btree as the MemPage object.) +// +// The flags argument is used to specify properties that affect the +// operation of the pager. It should be passed some bitwise combination +// of the PAGER_* flags. +// +// The vfsFlags parameter is a bitmask to pass to the flags parameter +// of the xOpen() method of the supplied VFS when opening files. +// +// If the pager object is allocated and the specified file opened +// successfully, SQLITE_OK is returned and *ppPager set to point to +// the new pager object. If an error occurs, *ppPager is set to NULL +// and error code returned. This function may return SQLITE_NOMEM +// (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or +// various SQLITE_IO_XXX errors. +func Xsqlite3PagerOpen(tls *libc.TLS, pVfs uintptr, ppPager uintptr, zFilename uintptr, nExtra int32, flags int32, vfsFlags int32, xReinit uintptr) int32 { /* sqlite3.c:57297:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pPtr uintptr + // var pPager uintptr at bp, 8 + // Pager object to allocate and return + var rc int32 // Return code + var tempFile int32 // True for temp files (incl. in-memory files) + var memDb int32 // True if this is an in-memory file + var memJM int32 // Memory journal mode + var readOnly int32 // True if this is a read-only file + var journalFileSize int32 // Bytes to allocate for each journal fd + var zPathname uintptr // Full path to database file + var nPathname int32 // Number of bytes in zPathname + var useJournal int32 // False to omit journal + var pcacheSize int32 // Bytes to allocate for PCache + // var szPageDflt U32 at bp+12, 4 + // Default page size + var zUri uintptr // URI args to copy + var nUriByte int32 // Number of bytes of URI args at *zUri + var nUri int32 + var z uintptr + var iDc int32 + // var fout int32 at bp+8, 4 + *(*uintptr)(unsafe.Pointer(bp /* pPager */)) = uintptr(0) + rc = SQLITE_OK + tempFile = 0 + memDb = 0 + memJM = 0 + readOnly = 0 + zPathname = uintptr(0) + nPathname = 0 + useJournal = (libc.Bool32((flags & PAGER_OMIT_JOURNAL) == 0)) + pcacheSize = Xsqlite3PcacheSize(tls) + *(*U32)(unsafe.Pointer(bp + 12 /* szPageDflt */)) = U32(SQLITE_DEFAULT_PAGE_SIZE) + zUri = uintptr(0) + nUriByte = 1 + nUri = 0 // Number of URI parameters + + // Figure out how much space is required for each journal file-handle + // (there are two of them, the main journal and the sub-journal). + journalFileSize = (((Xsqlite3JournalSize(tls, pVfs)) + 7) & libc.CplInt32(7)) + + // Set the output variable to NULL in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppPager)) = uintptr(0) + + if !((flags & PAGER_MEMORY) != 0) { + goto __1 + } + memDb = 1 + if !((zFilename != 0) && (*(*int8)(unsafe.Pointer(zFilename)) != 0)) { + goto __2 + } + zPathname = Xsqlite3DbStrDup(tls, uintptr(0), zFilename) + if !(zPathname == uintptr(0)) { + goto __3 + } + return SQLITE_NOMEM +__3: + ; + nPathname = Xsqlite3Strlen30(tls, zPathname) + zFilename = uintptr(0) +__2: + ; +__1: + ; + + // Compute and store the full pathname in an allocated buffer pointed + // to by zPathname, length nPathname. Or, if this is a temporary file, + // leave both nPathname and zPathname set to 0. + if !((zFilename != 0) && (*(*int8)(unsafe.Pointer(zFilename)) != 0)) { + goto __4 + } + nPathname = ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname + 1) + zPathname = Xsqlite3DbMallocRaw(tls, uintptr(0), (uint64(nPathname * 2))) + if !(zPathname == uintptr(0)) { + goto __5 + } + return SQLITE_NOMEM +__5: + ; + *(*int8)(unsafe.Pointer(zPathname)) = int8(0) // Make sure initialized even if FullPathname() fails + rc = Xsqlite3OsFullPathname(tls, pVfs, zFilename, nPathname, zPathname) + if !(rc != SQLITE_OK) { + goto __6 + } + if !(rc == (SQLITE_OK | (int32(2) << 8))) { + goto __7 + } + if !((vfsFlags & SQLITE_OPEN_NOFOLLOW) != 0) { + goto __8 + } + rc = (SQLITE_CANTOPEN | (int32(6) << 8)) + goto __9 +__8: + rc = SQLITE_OK +__9: + ; +__7: + ; +__6: + ; + nPathname = Xsqlite3Strlen30(tls, zPathname) + z = libc.AssignUintptr(&zUri, (zFilename + uintptr((Xsqlite3Strlen30(tls, zFilename) + 1)))) +__10: + if !(*(*int8)(unsafe.Pointer(z)) != 0) { + goto __11 + } + z += (uintptr(libc.Xstrlen(tls, z) + uint64(1))) + z += (uintptr(libc.Xstrlen(tls, z) + uint64(1))) + nUri++ + goto __10 +__11: + ; + nUriByte = (int32((int64((z + 1)) - int64(zUri)) / 1)) + + if !((rc == SQLITE_OK) && ((nPathname + 8) > (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname)) { + goto __12 + } + // This branch is taken when the journal path required by + // the database being opened will be more than pVfs->mxPathname + // bytes in length. This means the database cannot be opened, + // as it will not be possible to open the journal file or even + // check for a hot-journal before reading. + rc = Xsqlite3CantopenError(tls, 57384) +__12: + ; + if !(rc != SQLITE_OK) { + goto __13 + } + Xsqlite3DbFree(tls, uintptr(0), zPathname) + return rc +__13: + ; +__4: + ; + + // Allocate memory for the Pager structure, PCache object, the + // three file descriptors, the database file name and the journal + // file name. The layout in memory is as follows: + // + // Pager object (sizeof(Pager) bytes) + // PCache object (sqlite3PcacheSize() bytes) + // Database file handle (pVfs->szOsFile bytes) + // Sub-journal file handle (journalFileSize bytes) + // Main journal file handle (journalFileSize bytes) + // Ptr back to the Pager (sizeof(Pager*) bytes) + // \0\0\0\0 database prefix (4 bytes) + // Database file name (nPathname+1 bytes) + // URI query parameters (nUriByte bytes) + // Journal filename (nPathname+8+1 bytes) + // WAL filename (nPathname+4+1 bytes) + // \0\0\0 terminator (3 bytes) + // + // Some 3rd-party software, over which we have no control, depends on + // the specific order of the filenames and the \0 separators between them + // so that it can (for example) find the database filename given the WAL + // filename without using the sqlite3_filename_database() API. This is a + // misuse of SQLite and a bug in the 3rd-party software, but the 3rd-party + // software is in widespread use, so we try to avoid changing the filename + // order and formatting if possible. In particular, the details of the + // filename format expected by 3rd-party software should be as follows: + // + // - Main Database Path + // - \0 + // - Multiple URI components consisting of: + // - Key + // - \0 + // - Value + // - \0 + // - \0 + // - Journal Path + // - \0 + // - WAL Path (zWALName) + // - \0 + // + // The sqlite3_create_filename() interface and the databaseFilename() utility + // that is used by sqlite3_filename_database() and kin also depend on the + // specific formatting and order of the various filenames, so if the format + // changes here, be sure to change it there as well. + pPtr = Xsqlite3MallocZero(tls, + (uint64((((((((((((((((((uint64(unsafe.Sizeof(Pager{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))) + (uint64(((pcacheSize) + 7) & libc.CplInt32(7)))) + (uint64((((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile) + 7) & libc.CplInt32(7)))) + (uint64(journalFileSize * 2))) + uint64(unsafe.Sizeof(uintptr(0)))) + uint64(4)) + uint64(nPathname)) + uint64(1)) + uint64(nUriByte)) + uint64(nPathname)) + uint64(8)) + uint64(1)) + uint64(nPathname)) + uint64(4)) + uint64(1)) + uint64(3)))) + + if !(!(pPtr != 0)) { + goto __14 + } + Xsqlite3DbFree(tls, uintptr(0), zPathname) + return SQLITE_NOMEM +__14: + ; + *(*uintptr)(unsafe.Pointer(bp /* pPager */)) = pPtr + pPtr += (uintptr(((uint64(unsafe.Sizeof(Pager{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FpPCache = pPtr + pPtr += (uintptr(((pcacheSize) + 7) & libc.CplInt32(7))) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).Ffd = pPtr + pPtr += (uintptr((((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile) + 7) & libc.CplInt32(7))) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).Fsjfd = pPtr + pPtr += uintptr(journalFileSize) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).Fjfd = pPtr + pPtr += uintptr(journalFileSize) + + libc.Xmemcpy(tls, pPtr, bp /* &pPager */, uint64(unsafe.Sizeof(uintptr(0)))) + pPtr += uintptr(unsafe.Sizeof(uintptr(0))) + + // Fill in the Pager.zFilename and pPager.zQueryParam fields + pPtr += uintptr(4) // Skip zero prefix + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename = pPtr + if !(nPathname > 0) { + goto __15 + } + libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) + pPtr += (uintptr(nPathname + 1)) + if !(zUri != 0) { + goto __16 + } + libc.Xmemcpy(tls, pPtr, zUri, uint64(nUriByte)) + pPtr += uintptr(nUriByte) + goto __17 +__16: + pPtr++ +__17: + ; +__15: + ; + + // Fill in Pager.zJournal + if !(nPathname > 0) { + goto __18 + } + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr + libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) + pPtr += uintptr(nPathname) + libc.Xmemcpy(tls, pPtr, ts+3049 /* "-journal" */, uint64(8)) + pPtr += (uintptr(8 + 1)) + goto __19 +__18: + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = uintptr(0) +__19: + ; + + // Fill in Pager.zWal + if !(nPathname > 0) { + goto __20 + } + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr + libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) + pPtr += uintptr(nPathname) + libc.Xmemcpy(tls, pPtr, ts+3058 /* "-wal" */, uint64(4)) + pPtr += (uintptr(4 + 1)) + goto __21 +__20: + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = uintptr(0) +__21: + ; + + if !(nPathname != 0) { + goto __22 + } + Xsqlite3DbFree(tls, uintptr(0), zPathname) +__22: + ; + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FpVfs = pVfs + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FvfsFlags = U32(vfsFlags) + + // Open the pager file. + if !((zFilename != 0) && (*(*int8)(unsafe.Pointer(zFilename)) != 0)) { + goto __23 + } + *(*int32)(unsafe.Pointer(bp + 8 /* fout */)) = 0 // VFS flags returned by xOpen() + rc = Xsqlite3OsOpen(tls, pVfs, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).Ffd, vfsFlags, bp+8 /* &fout */) + + memJM = (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 8 /* fout */)) & SQLITE_OPEN_MEMORY) != 0)) + readOnly = (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 8 /* fout */)) & SQLITE_OPEN_READONLY) != 0)) + + // If the file was successfully opened for read/write access, + // choose a default page size in case we have to create the + // database file. The default page size is the maximum of: + // + // + SQLITE_DEFAULT_PAGE_SIZE, + // + The value returned by sqlite3OsSectorSize() + // + The largest page size that can be written atomically. + if !(rc == SQLITE_OK) { + goto __25 + } + iDc = Xsqlite3OsDeviceCharacteristics(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).Ffd) + if !(!(readOnly != 0)) { + goto __26 + } + setSectorSize(tls, *(*uintptr)(unsafe.Pointer(bp /* pPager */))) + + if !(*(*U32)(unsafe.Pointer(bp + 12 /* szPageDflt */)) < (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FsectorSize) { + goto __27 + } + if !((*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FsectorSize > U32(SQLITE_MAX_DEFAULT_PAGE_SIZE)) { + goto __28 + } + *(*U32)(unsafe.Pointer(bp + 12 /* szPageDflt */)) = U32(SQLITE_MAX_DEFAULT_PAGE_SIZE) + goto __29 +__28: + *(*U32)(unsafe.Pointer(bp + 12 /* szPageDflt */)) = (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FsectorSize +__29: + ; +__27: + ; +__26: + ; + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3063 /* "nolock" */, 0)) + if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3070 /* "immutable" */, 0) != 0)) { + goto __30 + } + vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) + goto act_like_temp_file +__30: + ; +__25: + ; + goto __24 +__23: + // If a temporary file is requested, it is not opened immediately. + // In this case we accept the default page size and delay actually + // opening the file until the first call to OsWrite(). + // + // This branch is also run for an in-memory database. An in-memory + // database is the same as a temp-file that is never written out to + // disk and uses an in-memory rollback journal. + // + // This branch also runs for files marked as immutable. +act_like_temp_file: + tempFile = 1 + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FeState = U8(PAGER_READER) // Pretend we already have a lock + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FeLock = U8(EXCLUSIVE_LOCK) // Pretend we are in EXCLUSIVE mode + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(1) // Do no locking + readOnly = (vfsFlags & SQLITE_OPEN_READONLY) +__24: + ; + + // The following call to PagerSetPagesize() serves to set the value of + // Pager.pageSize and to allocate the Pager.pTmpSpace buffer. + if !(rc == SQLITE_OK) { + goto __31 + } + + rc = Xsqlite3PagerSetPagesize(tls, *(*uintptr)(unsafe.Pointer(bp /* pPager */)), bp+12 /* &szPageDflt */, -1) + +__31: + ; + + // Initialize the PCache object. + if !(rc == SQLITE_OK) { + goto __32 + } + nExtra = (((nExtra) + 7) & libc.CplInt32(7)) + + rc = Xsqlite3PcacheOpen(tls, int32(*(*U32)(unsafe.Pointer(bp + 12 /* szPageDflt */))), nExtra, libc.BoolInt32(!(memDb != 0)), + func() uintptr { + if !(memDb != 0) { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{pagerStress})) + } + return uintptr(0) + }(), *(*uintptr)(unsafe.Pointer(bp /* pPager */)), (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FpPCache) +__32: + ; + + // If an error occurred above, free the Pager structure and close the file. + if !(rc != SQLITE_OK) { + goto __33 + } + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).Ffd) + Xsqlite3PageFree(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FpTmpSpace) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp /* pPager */))) + return rc +__33: + ; + + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FuseJournal = U8(useJournal) + // pPager->stmtOpen = 0; + // pPager->stmtInUse = 0; + // pPager->nRef = 0; + // pPager->stmtSize = 0; + // pPager->stmtJSize = 0; + // pPager->nPage = 0; + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FmxPgno = Pgno(SQLITE_MAX_PAGE_COUNT) + // pPager->state = PAGER_UNLOCK; + // pPager->errMask = 0; + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FtempFile = U8(tempFile) + + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FexclusiveMode = U8(tempFile) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FchangeCountDone = (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FtempFile + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FmemDb = U8(memDb) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FreadOnly = U8(readOnly) + + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoSync = (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FtempFile + if !((*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoSync != 0) { + goto __34 + } + + goto __35 +__34: + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FfullSync = U8(1) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FextraSync = U8(0) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FsyncFlags = U8(SQLITE_SYNC_NORMAL) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FwalSyncFlags = (U8(SQLITE_SYNC_NORMAL | (int32(SQLITE_SYNC_NORMAL) << 2))) +__35: + ; + // pPager->pFirst = 0; + // pPager->pFirstSynced = 0; + // pPager->pLast = 0; + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnExtra = U16(nExtra) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FjournalSizeLimit = int64(-1) + + setSectorSize(tls, *(*uintptr)(unsafe.Pointer(bp /* pPager */))) + if !(!(useJournal != 0)) { + goto __36 + } + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FjournalMode = U8(PAGER_JOURNALMODE_OFF) + goto __37 +__36: + if !((memDb != 0) || (memJM != 0)) { + goto __38 + } + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FjournalMode = U8(PAGER_JOURNALMODE_MEMORY) +__38: + ; +__37: + ; + // pPager->xBusyHandler = 0; + // pPager->pBusyHandlerArg = 0; + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FxReiniter = xReinit + setGetterMethod(tls, *(*uintptr)(unsafe.Pointer(bp /* pPager */))) + // memset(pPager->aHash, 0, sizeof(pPager->aHash)); + // pPager->szMmap = SQLITE_DEFAULT_MMAP_SIZE // will be set by btree.c + + *(*uintptr)(unsafe.Pointer(ppPager)) = *(*uintptr)(unsafe.Pointer(bp /* pPager */)) + return SQLITE_OK +} + +// Return the sqlite3_file for the main database given the name +// of the corresonding WAL or Journal name as passed into +// xOpen. +func Xsqlite3_database_file_object(tls *libc.TLS, zName uintptr) uintptr { /* sqlite3.c:57668:25: */ + var pPager uintptr + for (((int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-1)))) != 0) || (int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-2)))) != 0)) || (int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-3)))) != 0)) || (int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-4)))) != 0) { + zName-- + } + pPager = *(*uintptr)(unsafe.Pointer(((zName - uintptr(4)) - uintptr(uint64(unsafe.Sizeof(uintptr(0))))))) + return (*Pager)(unsafe.Pointer(pPager)).Ffd +} + +// This function is called after transitioning from PAGER_UNLOCK to +// PAGER_SHARED state. It tests if there is a hot journal present in +// the file-system for the given pager. A hot journal is one that +// needs to be played back. According to this function, a hot-journal +// file exists if the following criteria are met: +// +// * The journal file exists in the file system, and +// * No process holds a RESERVED or greater lock on the database file, and +// * The database file itself is greater than 0 bytes in size, and +// * The first byte of the journal file exists and is not 0x00. +// +// If the current size of the database file is 0 but a journal file +// exists, that is probably an old journal left over from a prior +// database with the same name. In this case the journal file is +// just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK +// is returned. +// +// This routine does not check if there is a super-journal filename +// at the end of the file. If there is, and that super-journal file +// does not exist, then the journal file is not really hot. In this +// case this routine will return a false-positive. The pager_playback() +// routine will discover that the journal file is not really hot and +// will not roll it back. +// +// If a hot-journal file is found to exist, *pExists is set to 1 and +// SQLITE_OK returned. If no hot-journal file is present, *pExists is +// set to 0 and SQLITE_OK returned. If an IO error occurs while trying +// to determine whether or not a hot-journal file exists, the IO error +// code is returned and the value of *pExists is undefined. +func hasHotJournal(tls *libc.TLS, pPager uintptr, pExists uintptr) int32 { /* sqlite3.c:57709:12: */ + bp := tls.Alloc(17) + defer tls.Free(17) + + var pVfs uintptr = (*Pager)(unsafe.Pointer(pPager)).FpVfs + var rc int32 = SQLITE_OK // Return code + *(*int32)(unsafe.Pointer(bp /* exists */)) = 1 // True if a journal file is present + var jrnlOpen int32 = libc.BoolInt32(!(!((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)))) + + *(*int32)(unsafe.Pointer(pExists)) = 0 + if !(jrnlOpen != 0) { + rc = Xsqlite3OsAccess(tls, pVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, SQLITE_ACCESS_EXISTS, bp /* &exists */) + } + if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* exists */)) != 0) { + *(*int32)(unsafe.Pointer(bp + 4 /* locked */)) = 0 // True if some process holds a RESERVED lock + + // Race condition here: Another process might have been holding the + // the RESERVED lock and have a journal open at the sqlite3OsAccess() + // call above, but then delete the journal and drop the lock before + // we get to the following sqlite3OsCheckReservedLock() call. If that + // is the case, this routine might think there is a hot journal when + // in fact there is none. This results in a false-positive which will + // be dealt with by the playback routine. Ticket #3883. + rc = Xsqlite3OsCheckReservedLock(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, bp+4 /* &locked */) + if (rc == SQLITE_OK) && !(*(*int32)(unsafe.Pointer(bp + 4 /* locked */)) != 0) { + // var nPage Pgno at bp+8, 4 + // Number of pages in database file + + rc = pagerPagecount(tls, pPager, bp+8 /* &nPage */) + if rc == SQLITE_OK { + // If the database is zero pages in size, that means that either (1) the + // journal is a remnant from a prior database with the same name where + // the database file but not the journal was deleted, or (2) the initial + // transaction that populates a new database is being rolled back. + // In either case, the journal file can be deleted. However, take care + // not to delete the journal file if it is already open due to + // journal_mode=PERSIST. + if (*(*Pgno)(unsafe.Pointer(bp + 8 /* nPage */)) == Pgno(0)) && !(jrnlOpen != 0) { + Xsqlite3BeginBenignMalloc(tls) + if pagerLockDb(tls, pPager, RESERVED_LOCK) == SQLITE_OK { + Xsqlite3OsDelete(tls, pVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, 0) + if !(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) { + pagerUnlockDb(tls, pPager, SHARED_LOCK) + } + } + Xsqlite3EndBenignMalloc(tls) + } else { + // The journal file exists and no other connection has a reserved + // or greater lock on the database file. Now check that there is + // at least one non-zero bytes at the start of the journal file. + // If there is, then we consider this journal to be hot. If not, + // it can be ignored. + if !(jrnlOpen != 0) { + *(*int32)(unsafe.Pointer(bp + 12 /* f */)) = (SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_JOURNAL) + rc = Xsqlite3OsOpen(tls, pVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, (*Pager)(unsafe.Pointer(pPager)).Fjfd, *(*int32)(unsafe.Pointer(bp + 12 /* f */)), bp+12 /* &f */) + } + if rc == SQLITE_OK { + *(*U8)(unsafe.Pointer(bp + 16 /* first */)) = U8(0) + rc = Xsqlite3OsRead(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp+16 /* &first */, 1, int64(0)) + if rc == (SQLITE_IOERR | (int32(2) << 8)) { + rc = SQLITE_OK + } + if !(jrnlOpen != 0) { + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + } + *(*int32)(unsafe.Pointer(pExists)) = (libc.Bool32(int32(*(*U8)(unsafe.Pointer(bp + 16 /* first */))) != 0)) + } else if rc == SQLITE_CANTOPEN { + // If we cannot open the rollback journal file in order to see if + // it has a zero header, that might be due to an I/O error, or + // it might be due to the race condition described above and in + // ticket #3883. Either way, assume that the journal is hot. + // This might be a false positive. But if it is, then the + // automatic journal playback and recovery mechanism will deal + // with it under an EXCLUSIVE lock where we do not need to + // worry so much with race conditions. + *(*int32)(unsafe.Pointer(pExists)) = 1 + rc = SQLITE_OK + } + } + } + } + } + + return rc +} + +// This function is called to obtain a shared lock on the database file. +// It is illegal to call sqlite3PagerGet() until after this function +// has been successfully called. If a shared-lock is already held when +// this function is called, it is a no-op. +// +// The following operations are also performed by this function. +// +// 1) If the pager is currently in PAGER_OPEN state (no lock held +// on the database file), then an attempt is made to obtain a +// SHARED lock on the database file. Immediately after obtaining +// the SHARED lock, the file-system is checked for a hot-journal, +// which is played back if present. Following any hot-journal +// rollback, the contents of the cache are validated by checking +// the 'change-counter' field of the database file header and +// discarded if they are found to be invalid. +// +// 2) If the pager is running in exclusive-mode, and there are currently +// no outstanding references to any pages, and is in the error state, +// then an attempt is made to clear the error state by discarding +// the contents of the page cache and rolling back any open journal +// file. +// +// If everything is successful, SQLITE_OK is returned. If an IO error +// occurs while locking the database, checking for a hot-journal file or +// rolling back a journal file, the IO error code is returned. +func Xsqlite3PagerSharedLock(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:57829:20: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var rc int32 + // var fout int32 at bp+8, 4 + + var f int32 + var pVfs uintptr + // var bExists int32 at bp+4, 4 + + // The shared-lock has just been acquired then check to + // see if the database has been modified. If the database has changed, + // flush the cache. The hasHeldSharedLock flag prevents this from + // occurring on the very first access to a file, in order to save a + // single unnecessary sqlite3OsRead() call at the start-up. + // + // Database changes are detected by looking at 15 bytes beginning + // at offset 24 into the file. The first 4 of these 16 bytes are + // a 32-bit counter that is incremented with each change. The + // other bytes change randomly with each file change when + // a codec is in use. + // + // There is a vanishingly small chance that a change will not be + // detected. The chance of an undetected change is so small that + // it can be neglected. + // var dbFileVers [16]int8 at bp+12, 16 + + // var bHotJournal int32 at bp, 4 + rc = SQLITE_OK // Return code + + // This routine is only called from b-tree and only when there are no + // outstanding pages. This implies that the pager state should either + // be OPEN or READER. READER is only possible if the pager is or was in + // exclusive access mode. + + if !(!((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) && (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN)) { + goto __1 + } + *(*int32)(unsafe.Pointer(bp /* bHotJournal */)) = 1 // True if there exists a hot journal-file + + rc = pager_wait_on_lock(tls, pPager, SHARED_LOCK) + if !(rc != SQLITE_OK) { + goto __2 + } + + goto failed +__2: + ; + + // If a journal file exists, and there is no RESERVED lock on the + // database file, then it either needs to be played back or deleted. + if !(int32((*Pager)(unsafe.Pointer(pPager)).FeLock) <= SHARED_LOCK) { + goto __3 + } + rc = hasHotJournal(tls, pPager, bp /* &bHotJournal */) +__3: + ; + if !(rc != SQLITE_OK) { + goto __4 + } + goto failed +__4: + ; + if !(*(*int32)(unsafe.Pointer(bp /* bHotJournal */)) != 0) { + goto __5 + } + if !((*Pager)(unsafe.Pointer(pPager)).FreadOnly != 0) { + goto __6 + } + rc = (SQLITE_READONLY | (int32(3) << 8)) + goto failed +__6: + ; + + // Get an EXCLUSIVE lock on the database file. At this point it is + // important that a RESERVED lock is not obtained on the way to the + // EXCLUSIVE lock. If it were, another process might open the + // database file, detect the RESERVED lock, and conclude that the + // database is safe to read while this process is still rolling the + // hot-journal back. + // + // Because the intermediate RESERVED lock is not requested, any + // other process attempting to access the database file will get to + // this point in the code and fail to obtain its own EXCLUSIVE lock + // on the database file. + // + // Unless the pager is in locking_mode=exclusive mode, the lock is + // downgraded to SHARED_LOCK before this function returns. + rc = pagerLockDb(tls, pPager, EXCLUSIVE_LOCK) + if !(rc != SQLITE_OK) { + goto __7 + } + goto failed +__7: + ; + + // If it is not already open and the file exists on disk, open the + // journal for read/write access. Write access is required because + // in exclusive-access mode the file descriptor will be kept open + // and possibly used for a transaction later on. Also, write-access + // is usually required to finalize the journal in journal_mode=persist + // mode (and also for journal_mode=truncate on some systems). + // + // If the journal does not exist, it usually means that some + // other connection managed to get in and roll it back before + // this connection obtained the exclusive lock above. Or, it + // may mean that the pager was in the error-state when this + // function was called and the journal file does not exist. + if !(!((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0))) { + goto __8 + } + pVfs = (*Pager)(unsafe.Pointer(pPager)).FpVfs // True if journal file exists + rc = Xsqlite3OsAccess(tls, + pVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, SQLITE_ACCESS_EXISTS, bp+4 /* &bExists */) + if !((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 4 /* bExists */)) != 0)) { + goto __9 + } + *(*int32)(unsafe.Pointer(bp + 8 /* fout */)) = 0 + f = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_MAIN_JOURNAL) + + rc = Xsqlite3OsOpen(tls, pVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, (*Pager)(unsafe.Pointer(pPager)).Fjfd, f, bp+8 /* &fout */) + + if !((rc == SQLITE_OK) && ((*(*int32)(unsafe.Pointer(bp + 8 /* fout */)) & SQLITE_OPEN_READONLY) != 0)) { + goto __10 + } + rc = Xsqlite3CantopenError(tls, 57913) + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) +__10: + ; +__9: + ; +__8: + ; + + // Playback and delete the journal. Drop the database write + // lock and reacquire the read lock. Purge the cache before + // playing back the hot-journal so that we don't end up with + // an inconsistent cache. Sync the hot journal before playing + // it back since the process that crashed and left the hot journal + // probably did not sync it and we are required to always sync + // the journal before playing it back. + if !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) { + goto __11 + } + + rc = pagerSyncHotJournal(tls, pPager) + if !(rc == SQLITE_OK) { + goto __13 + } + rc = pager_playback(tls, pPager, libc.BoolInt32(!((*Pager)(unsafe.Pointer(pPager)).FtempFile != 0))) + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_OPEN) +__13: + ; + goto __12 +__11: + if !(!(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0)) { + goto __14 + } + pagerUnlockDb(tls, pPager, SHARED_LOCK) +__14: + ; +__12: + ; + + if !(rc != SQLITE_OK) { + goto __15 + } + // This branch is taken if an error occurs while trying to open + // or roll back a hot-journal while holding an EXCLUSIVE lock. The + // pager_unlock() routine will be called before returning to unlock + // the file. If the unlock attempt fails, then Pager.eLock must be + // set to UNKNOWN_LOCK (see the comment above the #define for + // UNKNOWN_LOCK above for an explanation). + // + // In order to get pager_unlock() to do this, set Pager.eState to + // PAGER_ERROR now. This is not actually counted as a transition + // to ERROR state in the state diagram at the top of this file, + // since we know that the same call to pager_unlock() will very + // shortly transition the pager object to the OPEN state. Calling + // assert_pager_state() would fail now, as it should not be possible + // to be in ERROR state when there are zero outstanding page + // references. + pager_error(tls, pPager, rc) + goto failed +__15: + ; + +__5: + ; + + if !(!(int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) != 0) && ((*Pager)(unsafe.Pointer(pPager)).FhasHeldSharedLock != 0)) { + goto __16 + } + + rc = Xsqlite3OsRead(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, bp+12 /* &dbFileVers */, int32(unsafe.Sizeof([16]int8{})), int64(24)) + if !(rc != SQLITE_OK) { + goto __17 + } + if !(rc != (SQLITE_IOERR | (int32(2) << 8))) { + goto __18 + } + goto failed +__18: + ; + libc.Xmemset(tls, bp+12 /* &dbFileVers[0] */, 0, uint64(unsafe.Sizeof([16]int8{}))) +__17: + ; + + if !(libc.Xmemcmp(tls, pPager+136 /* &.dbFileVers */, bp+12 /* &dbFileVers[0] */, uint64(unsafe.Sizeof([16]int8{}))) != 0) { + goto __19 + } + pager_reset(tls, pPager) + + // Unmap the database file. It is possible that external processes + // may have truncated the database file and then extended it back + // to its original size while this process was not holding a lock. + // In this case there may exist a Pager.pMap mapping that appears + // to be the right size but is not actually valid. Avoid this + // possibility by unmapping the db here. + if !((*Pager)(unsafe.Pointer(pPager)).FbUseFetch != 0) { + goto __20 + } + Xsqlite3OsUnfetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, int64(0), uintptr(0)) +__20: + ; +__19: + ; +__16: + ; + + // If there is a WAL file in the file-system, open this database in WAL + // mode. Otherwise, the following function call is a no-op. + rc = pagerOpenWalIfPresent(tls, pPager) + +__1: + ; + + if !((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) { + goto __21 + } + + rc = pagerBeginReadTransaction(tls, pPager) +__21: + ; + + if !(((int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) == 0) && (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_OPEN)) && (rc == SQLITE_OK)) { + goto __22 + } + rc = pagerPagecount(tls, pPager, (pPager + 28 /* &.dbSize */)) +__22: + ; + +failed: + if !(rc != SQLITE_OK) { + goto __23 + } + + pager_unlock(tls, pPager) + + goto __24 +__23: + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_READER) + (*Pager)(unsafe.Pointer(pPager)).FhasHeldSharedLock = U8(1) +__24: + ; + return rc +} + +// If the reference count has reached zero, rollback any active +// transaction and unlock the pager. +// +// Except, in locking_mode=EXCLUSIVE when there is nothing to in +// the rollback journal, the unlock is not performed and there is +// nothing to rollback, so this routine is a no-op. +func pagerUnlockIfUnused(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:58046:13: */ + if Xsqlite3PcacheRefCount(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) == 0 { + // because page1 is never memory mapped + pagerUnlockAndRollback(tls, pPager) + } +} + +// The page getter methods each try to acquire a reference to a +// page with page number pgno. If the requested reference is +// successfully obtained, it is copied to *ppPage and SQLITE_OK returned. +// +// There are different implementations of the getter method depending +// on the current state of the pager. +// +// getPageNormal() -- The normal getter +// getPageError() -- Used if the pager is in an error state +// getPageMmap() -- Used if memory-mapped I/O is enabled +// +// If the requested page is already in the cache, it is returned. +// Otherwise, a new page object is allocated and populated with data +// read from the database file. In some cases, the pcache module may +// choose not to allocate a new page object and may reuse an existing +// object with no outstanding references. +// +// The extra data appended to a page is always initialized to zeros the +// first time a page is loaded into memory. If the page requested is +// already in the cache when this function is called, then the extra +// data is left as it was when the page object was last used. +// +// If the database image is smaller than the requested page or if +// the flags parameter contains the PAGER_GET_NOCONTENT bit and the +// requested page is not already stored in the cache, then no +// actual disk read occurs. In this case the memory image of the +// page is initialized to all zeros. +// +// If PAGER_GET_NOCONTENT is true, it means that we do not care about +// the contents of the page. This occurs in two scenarios: +// +// a) When reading a free-list leaf page from the database, and +// +// b) When a savepoint is being rolled back and we need to load +// a new page into the cache to be filled with the data read +// from the savepoint journal. +// +// If PAGER_GET_NOCONTENT is true, then the data returned is zeroed instead +// of being read from the database. Additionally, the bits corresponding +// to pgno in Pager.pInJournal (bitvec of pages already written to the +// journal file) and the PagerSavepoint.pInSavepoint bitvecs of any open +// savepoints are set. This means if the page is made writable at any +// point in the future, using a call to sqlite3PagerWrite(), its contents +// will not be journaled. This saves IO. +// +// The acquisition might fail for several reasons. In all cases, +// an appropriate error code is returned and *ppPage is set to NULL. +// +// See also sqlite3PagerLookup(). Both this routine and Lookup() attempt +// to find a page in the in-memory cache first. If the page is not already +// in memory, this routine goes to disk to read it in whereas Lookup() +// just returns 0. This routine acquires a read-lock the first time it +// has to go to disk, and could also playback an old journal if necessary. +// Since Lookup() never goes to disk, it never has to deal with locks +// or journal files. +func getPageNormal(tls *libc.TLS, pPager uintptr, pgno Pgno, ppPage uintptr, flags int32) int32 { /* sqlite3.c:58110:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + var pPg uintptr + var noContent U8 // True if PAGER_GET_NOCONTENT is set + // var pBase uintptr at bp, 8 + rc = SQLITE_OK + + if !(pgno == Pgno(0)) { + goto __1 + } + return Xsqlite3CorruptError(tls, 58126) +__1: + ; + *(*uintptr)(unsafe.Pointer(bp /* pBase */)) = Xsqlite3PcacheFetch(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, pgno, 3) + if !(*(*uintptr)(unsafe.Pointer(bp /* pBase */)) == uintptr(0)) { + goto __2 + } + pPg = uintptr(0) + rc = Xsqlite3PcacheFetchStress(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, pgno, bp /* &pBase */) + if !(rc != SQLITE_OK) { + goto __3 + } + goto pager_acquire_err +__3: + ; + if !(*(*uintptr)(unsafe.Pointer(bp /* pBase */)) == uintptr(0)) { + goto __4 + } + rc = SQLITE_NOMEM + goto pager_acquire_err +__4: + ; +__2: + ; + pPg = libc.AssignPtrUintptr(ppPage, Xsqlite3PcacheFetchFinish(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, pgno, *(*uintptr)(unsafe.Pointer(bp /* pBase */)))) + + noContent = (U8(libc.Bool32((flags & PAGER_GET_NOCONTENT) != 0))) + if !(((*PgHdr)(unsafe.Pointer(pPg)).FpPager != 0) && !(noContent != 0)) { + goto __5 + } + // In this case the pcache already contains an initialized copy of + // the page. Return without further ado. + + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */)))++ + return SQLITE_OK + + goto __6 +__5: + // The pager cache has created a new page. Its content needs to + // be initialized. But first some error checks: + // + // (*) obsolete. Was: maximum page number is 2^31 + // (2) Never try to fetch the locking page + if !(pgno == (Pgno((Xsqlite3PendingByte / ((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + 1))) { + goto __7 + } + rc = Xsqlite3CorruptError(tls, 58158) + goto pager_acquire_err +__7: + ; + + (*PgHdr)(unsafe.Pointer(pPg)).FpPager = pPager + + if !((!((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Ffd))).FpMethods != uintptr(0)) || ((*Pager)(unsafe.Pointer(pPager)).FdbSize < pgno)) || (noContent != 0)) { + goto __8 + } + if !(pgno > (*Pager)(unsafe.Pointer(pPager)).FmxPgno) { + goto __10 + } + rc = SQLITE_FULL + goto pager_acquire_err +__10: + ; + if !(noContent != 0) { + goto __11 + } + // Failure to set the bits in the InJournal bit-vectors is benign. + // It merely means that we might do some extra work to journal a + // page that does not need to be journaled. Nevertheless, be sure + // to test the case where a malloc error occurs while trying to set + // a bit in a bit vector. + Xsqlite3BeginBenignMalloc(tls) + if !(pgno <= (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize) { + goto __12 + } + Xsqlite3BitvecSet(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal, pgno) + +__12: + ; + addToSavepointBitvecs(tls, pPager, pgno) + + Xsqlite3EndBenignMalloc(tls) +__11: + ; + libc.Xmemset(tls, (*PgHdr)(unsafe.Pointer(pPg)).FpData, 0, uint64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + + goto __9 +__8: + ; + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + 1*4))++ + rc = readDbPage(tls, pPg) + if !(rc != SQLITE_OK) { + goto __13 + } + goto pager_acquire_err +__13: + ; +__9: + ; + +__6: + ; + return SQLITE_OK + +pager_acquire_err: + ; + if !(pPg != 0) { + goto __14 + } + Xsqlite3PcacheDrop(tls, pPg) +__14: + ; + pagerUnlockIfUnused(tls, pPager) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc +} + +// The page getter for when memory-mapped I/O is enabled +func getPageMMap(tls *libc.TLS, pPager uintptr, pgno Pgno, ppPage uintptr, flags int32) int32 { /* sqlite3.c:58212:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */)) = uintptr(0) + *(*U32)(unsafe.Pointer(bp /* iFrame */)) = U32(0) // Frame to read from WAL file + + // It is acceptable to use a read-only (mmap) page for any page except + // page 1 if there is no write-transaction open or the ACQUIRE_READONLY + // flag was specified by the caller. And so long as the db is not a + // temporary or in-memory database. + var bMmapOk int32 = (libc.Bool32((pgno > Pgno(1)) && + ((int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_READER) || ((flags & PAGER_GET_READONLY) != 0)))) + + // Optimization note: Adding the "pgno<=1" term before "pgno==0" here + // allows the compiler optimizer to reuse the results of the "pgno>1" + // test in the previous statement, and avoid testing pgno==0 in the + // common case where pgno is large. + if (pgno <= Pgno(1)) && (pgno == Pgno(0)) { + return Xsqlite3CorruptError(tls, 58237) + } + + if (bMmapOk != 0) && ((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) { + rc = Xsqlite3WalFindFrame(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, pgno, bp /* &iFrame */) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc + } + } + if (bMmapOk != 0) && (*(*U32)(unsafe.Pointer(bp /* iFrame */)) == U32(0)) { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pData */)) = uintptr(0) + rc = Xsqlite3OsFetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, + ((I64(pgno - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)), (*Pager)(unsafe.Pointer(pPager)).FpageSize, bp+8 /* &pData */) + if (rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 8 /* pData */)) != 0) { + if (int32((*Pager)(unsafe.Pointer(pPager)).FeState) > PAGER_READER) || ((*Pager)(unsafe.Pointer(pPager)).FtempFile != 0) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */)) = Xsqlite3PagerLookup(tls, pPager, pgno) + } + if *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */)) == uintptr(0) { + rc = pagerAcquireMapPage(tls, pPager, pgno, *(*uintptr)(unsafe.Pointer(bp + 8 /* pData */)), bp+16 /* &pPg */) + } else { + Xsqlite3OsUnfetch(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, ((I64(pgno - Pgno(1))) * I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)), *(*uintptr)(unsafe.Pointer(bp + 8 /* pData */))) + } + if *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */)) != 0 { + + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */)) + return SQLITE_OK + } + } + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return rc + } + } + return getPageNormal(tls, pPager, pgno, ppPage, flags) +} + +// The page getter method for when the pager is an error state +func getPageError(tls *libc.TLS, pPager uintptr, pgno Pgno, ppPage uintptr, flags int32) int32 { /* sqlite3.c:58281:12: */ + _ = pgno + _ = flags + + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return (*Pager)(unsafe.Pointer(pPager)).FerrCode +} + +// Dispatch all page fetch requests to the appropriate getter method. +func Xsqlite3PagerGet(tls *libc.TLS, pPager uintptr, pgno Pgno, ppPage uintptr, flags int32) int32 { /* sqlite3.c:58297:20: */ + return (*(*func(*libc.TLS, uintptr, Pgno, uintptr, int32) int32)(unsafe.Pointer((pPager + 264 /* &.xGet */))))(tls, pPager, pgno, ppPage, flags) +} + +// Acquire a page if it is already in the in-memory cache. Do +// not read the page from disk. Return a pointer to the page, +// or 0 if the page is not in cache. +// +// See also sqlite3PagerGet(). The difference between this routine +// and sqlite3PagerGet() is that _get() will go to the disk and read +// in the page if the page is not already in cache. This routine +// returns NULL if the page is not in cache or if a disk I/O error +// has ever happened. +func Xsqlite3PagerLookup(tls *libc.TLS, pPager uintptr, pgno Pgno) uintptr { /* sqlite3.c:58317:23: */ + var pPage uintptr + + pPage = Xsqlite3PcacheFetch(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, pgno, 0) + + if pPage == uintptr(0) { + return uintptr(0) + } + return Xsqlite3PcacheFetchFinish(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache, pgno, pPage) +} + +// Release a page reference. +// +// The sqlite3PagerUnref() and sqlite3PagerUnrefNotNull() may only be +// used if we know that the page being released is not the last page. +// The btree layer always holds page1 open until the end, so these first +// to routines can be used to release any page other than BtShared.pPage1. +// +// Use sqlite3PagerUnrefPageOne() to release page1. This latter routine +// checks the total number of outstanding pages and if the number of +// pages reaches zero it drops the database lock. +func Xsqlite3PagerUnrefNotNull(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:58340:21: */ + + if (int32((*DbPage)(unsafe.Pointer(pPg)).Fflags) & PGHDR_MMAP) != 0 { + // Page1 is never memory mapped + pagerReleaseMapPage(tls, pPg) + } else { + Xsqlite3PcacheRelease(tls, pPg) + } + // Do not use this routine to release the last reference to page1 + +} + +func Xsqlite3PagerUnref(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:58352:21: */ + if pPg != 0 { + Xsqlite3PagerUnrefNotNull(tls, pPg) + } +} + +func Xsqlite3PagerUnrefPageOne(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:58355:21: */ + var pPager uintptr + + // Page1 is never memory mapped + pPager = (*DbPage)(unsafe.Pointer(pPg)).FpPager + Xsqlite3PcacheRelease(tls, pPg) + pagerUnlockIfUnused(tls, pPager) +} + +// This function is called at the start of every write transaction. +// There must already be a RESERVED or EXCLUSIVE lock on the database +// file when this routine is called. +// +// Open the journal file for pager pPager and write a journal header +// to the start of it. If there are active savepoints, open the sub-journal +// as well. This function is only used when the journal file is being +// opened to write a rollback log for a transaction. It is not used +// when opening a hot journal file to roll it back. +// +// If the journal file is already open (as it may be in exclusive mode), +// then this function just writes a journal header to the start of the +// already open file. +// +// Whether or not the journal file is opened by this function, the +// Pager.pInJournal bitvec structure is allocated. +// +// Return SQLITE_OK if everything is successful. Otherwise, return +// SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or +// an IO error code if opening or writing the journal file fails. +func pager_open_journal(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:58387:12: */ + var rc int32 = SQLITE_OK // Return code + var pVfs uintptr = (*Pager)(unsafe.Pointer(pPager)).FpVfs // Local cache of vfs pointer + + // If already in the error state, this function is a no-op. But on + // the other hand, this routine is never called if we are already in + // an error state. + if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*Pager)(unsafe.Pointer(pPager)).FerrCode + } + + if !((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) && (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) != PAGER_JOURNALMODE_OFF) { + (*Pager)(unsafe.Pointer(pPager)).FpInJournal = Xsqlite3BitvecCreate(tls, (*Pager)(unsafe.Pointer(pPager)).FdbSize) + if (*Pager)(unsafe.Pointer(pPager)).FpInJournal == uintptr(0) { + return SQLITE_NOMEM + } + + // Open the journal file if it is not already open. + if !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) { + if int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_MEMORY { + Xsqlite3MemJournalOpen(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + } else { + var flags int32 = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) + var nSpill int32 + + if (*Pager)(unsafe.Pointer(pPager)).FtempFile != 0 { + flags = flags | (SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_TEMP_JOURNAL) + nSpill = Xsqlite3Config.FnStmtSpill + } else { + flags = flags | (SQLITE_OPEN_MAIN_JOURNAL) + nSpill = jrnlBufferSize(tls, pPager) + } + + // Verify that the database still has the same name as it did when + // it was originally opened. + rc = databaseIsUnmoved(tls, pPager) + if rc == SQLITE_OK { + rc = Xsqlite3JournalOpen(tls, + pVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, (*Pager)(unsafe.Pointer(pPager)).Fjfd, flags, nSpill) + } + } + + } + + // Write the first journal header to the journal file and open + // the sub-journal if necessary. + if rc == SQLITE_OK { + // TODO: Check if all of these are really required. + (*Pager)(unsafe.Pointer(pPager)).FnRec = 0 + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + (*Pager)(unsafe.Pointer(pPager)).FsetSuper = U8(0) + (*Pager)(unsafe.Pointer(pPager)).FjournalHdr = int64(0) + rc = writeJournalHdr(tls, pPager) + } + } + + if rc != SQLITE_OK { + Xsqlite3BitvecDestroy(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal) + (*Pager)(unsafe.Pointer(pPager)).FpInJournal = uintptr(0) + } else { + + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_WRITER_CACHEMOD) + } + + return rc +} + +// Begin a write-transaction on the specified pager object. If a +// write-transaction has already been opened, this function is a no-op. +// +// If the exFlag argument is false, then acquire at least a RESERVED +// lock on the database file. If exFlag is true, then acquire at least +// an EXCLUSIVE lock. If such a lock is already held, no locking +// functions need be called. +// +// If the subjInMemory argument is non-zero, then any sub-journal opened +// within this transaction will be opened as an in-memory file. This +// has no effect if the sub-journal is already opened (as it may be when +// running in exclusive mode) or if the transaction does not require a +// sub-journal. If the subjInMemory argument is zero, then any required +// sub-journal is implemented in-memory if pPager is an in-memory database, +// or using a temporary file otherwise. +func Xsqlite3PagerBegin(tls *libc.TLS, pPager uintptr, exFlag int32, subjInMemory int32) int32 { /* sqlite3.c:58476:20: */ + var rc int32 = SQLITE_OK + + if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*Pager)(unsafe.Pointer(pPager)).FerrCode + } + + (*Pager)(unsafe.Pointer(pPager)).FsubjInMemory = U8(subjInMemory) + + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_READER { + + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + // If the pager is configured to use locking_mode=exclusive, and an + // exclusive lock on the database is not already held, obtain it now. + if ((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) && (Xsqlite3WalExclusiveMode(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, -1) != 0) { + rc = pagerLockDb(tls, pPager, EXCLUSIVE_LOCK) + if rc != SQLITE_OK { + return rc + } + Xsqlite3WalExclusiveMode(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, 1) + } + + // Grab the write lock on the log file. If successful, upgrade to + // PAGER_RESERVED state. Otherwise, return an error code to the caller. + // The busy-handler is not invoked if another connection already + // holds the write-lock. If possible, the upper layer will call it. + rc = Xsqlite3WalBeginWriteTransaction(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + } else { + // Obtain a RESERVED lock on the database file. If the exFlag parameter + // is true, then immediately upgrade this to an EXCLUSIVE lock. The + // busy-handler callback can be used when upgrading to the EXCLUSIVE + // lock, but not when obtaining the RESERVED lock. + rc = pagerLockDb(tls, pPager, RESERVED_LOCK) + if (rc == SQLITE_OK) && (exFlag != 0) { + rc = pager_wait_on_lock(tls, pPager, EXCLUSIVE_LOCK) + } + } + + if rc == SQLITE_OK { + // Change to WRITER_LOCKED state. + // + // WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD + // when it has an open transaction, but never to DBMOD or FINISHED. + // This is because in those states the code to roll back savepoint + // transactions may copy data from the sub-journal into the database + // file as well as into the page cache. Which would be incorrect in + // WAL mode. + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_WRITER_LOCKED) + (*Pager)(unsafe.Pointer(pPager)).FdbHintSize = (*Pager)(unsafe.Pointer(pPager)).FdbSize + (*Pager)(unsafe.Pointer(pPager)).FdbFileSize = (*Pager)(unsafe.Pointer(pPager)).FdbSize + (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize = (*Pager)(unsafe.Pointer(pPager)).FdbSize + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = int64(0) + } + + } + + return rc +} + +// Write page pPg onto the end of the rollback journal. +func pagerAddPageToRollbackJournal(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:58545:28: */ + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + var rc int32 + var cksum U32 + var pData2 uintptr + var iOff I64 = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + + // We should never write to the journal file the page that + // contains the database locks. The following assert verifies + // that we do not. + + pData2 = (*PgHdr)(unsafe.Pointer(pPg)).FpData + cksum = pager_cksum(tls, pPager, pData2) + + // Even if an IO or diskfull error occurs while journalling the + // page in the block above, set the need-sync flag for the page. + // Otherwise, when the transaction is rolled back, the logic in + // playback_one_page() will think that the page needs to be restored + // in the database file. And if an IO error occurs while doing so, + // then corruption may follow. + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) |= U16((PGHDR_NEED_SYNC)) + + rc = write32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, iOff, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) + if rc != SQLITE_OK { + return rc + } + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, pData2, (*Pager)(unsafe.Pointer(pPager)).FpageSize, (iOff + int64(4))) + if rc != SQLITE_OK { + return rc + } + rc = write32bits(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, ((iOff + I64((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + int64(4)), cksum) + if rc != SQLITE_OK { + return rc + } + + *(*I64)(unsafe.Pointer(pPager + 96 /* &.journalOff */)) += (I64(8 + (*Pager)(unsafe.Pointer(pPager)).FpageSize)) + (*Pager)(unsafe.Pointer(pPager)).FnRec++ + + rc = Xsqlite3BitvecSet(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) + + rc = rc | (addToSavepointBitvecs(tls, pPager, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno)) + + return rc +} + +// Mark a single data page as writeable. The page is written into the +// main journal or sub-journal as required. If the page is written into +// one of the journals, the corresponding bit is set in the +// Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs +// of any open savepoints as appropriate. +func pager_write(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:58602:12: */ + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + var rc int32 = SQLITE_OK + + // This routine is not called unless a write-transaction has already + // been started. The journal file may or may not be open at this point. + // It is never called in the ERROR state. + + // The journal file needs to be opened. Higher level routines have already + // obtained the necessary locks to begin the write-transaction, but the + // rollback journal might not yet be open. Open it now if this is the case. + // + // This is done before calling sqlite3PcacheMakeDirty() on the page. + // Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then + // an error might occur and the pager would end up in WRITER_LOCKED state + // with pages marked as dirty in the cache. + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_WRITER_LOCKED { + rc = pager_open_journal(tls, pPager) + if rc != SQLITE_OK { + return rc + } + } + + // Mark the page that is about to be modified as dirty. + Xsqlite3PcacheMakeDirty(tls, pPg) + + // If a rollback journal is in use, them make sure the page that is about + // to change is in the rollback journal, or if the page is a new page off + // then end of the file, make sure it is marked as PGHDR_NEED_SYNC. + + if ((*Pager)(unsafe.Pointer(pPager)).FpInJournal != uintptr(0)) && + (Xsqlite3BitvecTestNotNull(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal, (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) == 0) { + + if (*PgHdr)(unsafe.Pointer(pPg)).Fpgno <= (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize { + rc = pagerAddPageToRollbackJournal(tls, pPg) + if rc != SQLITE_OK { + return rc + } + } else { + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) != PAGER_WRITER_DBMOD { + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) |= U16((PGHDR_NEED_SYNC)) + } + + } + } + + // The PGHDR_DIRTY bit is set above when the page was added to the dirty-list + // and before writing the page into the rollback journal. Wait until now, + // after the page has been successfully journalled, before setting the + // PGHDR_WRITEABLE bit that indicates that the page can be safely modified. + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) |= U16((PGHDR_WRITEABLE)) + + // If the statement journal is open and the page is not in it, + // then write the page into the statement journal. + if (*Pager)(unsafe.Pointer(pPager)).FnSavepoint > 0 { + rc = subjournalPageIfRequired(tls, pPg) + } + + // Update the database size and return. + if (*Pager)(unsafe.Pointer(pPager)).FdbSize < (*PgHdr)(unsafe.Pointer(pPg)).Fpgno { + (*Pager)(unsafe.Pointer(pPager)).FdbSize = (*PgHdr)(unsafe.Pointer(pPg)).Fpgno + } + return rc +} + +// This is a variant of sqlite3PagerWrite() that runs when the sector size +// is larger than the page size. SQLite makes the (reasonable) assumption that +// all bytes of a sector are written together by hardware. Hence, all bytes of +// a sector need to be journalled in case of a power loss in the middle of +// a write. +// +// Usually, the sector size is less than or equal to the page size, in which +// case pages can be individually written. This routine only runs in the +// exceptional case where the page size is smaller than the sector size. +func pagerWriteLargeSector(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:58694:28: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK // Return code + var nPageCount Pgno // Total number of pages in database file + var pg1 Pgno // First page of the sector pPg is located on. + var nPage int32 = 0 // Number of pages starting at pg1 to journal + var ii int32 // Loop counter + var needSync int32 = 0 // True if any page has PGHDR_NEED_SYNC + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager // The pager that owns pPg + var nPagePerSector Pgno = ((*Pager)(unsafe.Pointer(pPager)).FsectorSize / U32((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + + // Set the doNotSpill NOSYNC bit to 1. This is because we cannot allow + // a journal header to be written between the pages journaled by + // this function. + + *(*U8)(unsafe.Pointer(pPager + 24 /* &.doNotSpill */)) |= U8((SPILLFLAG_NOSYNC)) + + // This trick assumes that both the page-size and sector-size are + // an integer power of 2. It sets variable pg1 to the identifier + // of the first page of the sector pPg is located on. + pg1 = ((((*PgHdr)(unsafe.Pointer(pPg)).Fpgno - Pgno(1)) & ^(nPagePerSector - Pgno(1))) + Pgno(1)) + + nPageCount = (*Pager)(unsafe.Pointer(pPager)).FdbSize + if (*PgHdr)(unsafe.Pointer(pPg)).Fpgno > nPageCount { + nPage = (int32(((*PgHdr)(unsafe.Pointer(pPg)).Fpgno - pg1) + Pgno(1))) + } else if ((pg1 + nPagePerSector) - Pgno(1)) > nPageCount { + nPage = (int32((nPageCount + Pgno(1)) - pg1)) + } else { + nPage = int32(nPagePerSector) + } + + for ii = 0; (ii < nPage) && (rc == SQLITE_OK); ii++ { + var pg Pgno = (pg1 + Pgno(ii)) + // var pPage uintptr at bp, 8 + + if (pg == (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) || !(Xsqlite3BitvecTest(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal, pg) != 0) { + if pg != (Pgno((Xsqlite3PendingByte / ((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + 1)) { + rc = Xsqlite3PagerGet(tls, pPager, pg, bp /* &pPage */, 0) + if rc == SQLITE_OK { + rc = pager_write(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + if (int32((*PgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).Fflags) & PGHDR_NEED_SYNC) != 0 { + needSync = 1 + } + Xsqlite3PagerUnrefNotNull(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + } + } + } else if (libc.AssignPtrUintptr(bp /* pPage */, Xsqlite3PagerLookup(tls, pPager, pg))) != uintptr(0) { + if (int32((*PgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).Fflags) & PGHDR_NEED_SYNC) != 0 { + needSync = 1 + } + Xsqlite3PagerUnrefNotNull(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + } + } + + // If the PGHDR_NEED_SYNC flag is set for any of the nPage pages + // starting at pg1, then it needs to be set for all of them. Because + // writing to any of these nPage pages may damage the others, the + // journal file must contain sync()ed copies of all of them + // before any of them can be written out to the database file. + if (rc == SQLITE_OK) && (needSync != 0) { + + for ii = 0; ii < nPage; ii++ { + var pPage uintptr = Xsqlite3PagerLookup(tls, pPager, (pg1 + Pgno(ii))) + if pPage != 0 { + *(*U16)(unsafe.Pointer(pPage + 52 /* &.flags */)) |= U16((PGHDR_NEED_SYNC)) + Xsqlite3PagerUnrefNotNull(tls, pPage) + } + } + } + + *(*U8)(unsafe.Pointer(pPager + 24 /* &.doNotSpill */)) &= libc.Uint8FromInt32((libc.CplInt32(SPILLFLAG_NOSYNC))) + return rc +} + +// Mark a data page as writeable. This routine must be called before +// making changes to a page. The caller must check the return value +// of this function and be careful not to change any page data unless +// this routine returns SQLITE_OK. +// +// The difference between this function and pager_write() is that this +// function also deals with the special case where 2 or more pages +// fit on a single disk sector. In this case all co-resident pages +// must have been written to the journal file before returning. +// +// If an error occurs, SQLITE_NOMEM or an IO error code is returned +// as appropriate. Otherwise, SQLITE_OK. +func Xsqlite3PagerWrite(tls *libc.TLS, pPg uintptr) int32 { /* sqlite3.c:58788:20: */ + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + + if ((int32((*PgHdr)(unsafe.Pointer(pPg)).Fflags) & PGHDR_WRITEABLE) != 0) && ((*Pager)(unsafe.Pointer(pPager)).FdbSize >= (*PgHdr)(unsafe.Pointer(pPg)).Fpgno) { + if (*Pager)(unsafe.Pointer(pPager)).FnSavepoint != 0 { + return subjournalPageIfRequired(tls, pPg) + } + return SQLITE_OK + } else if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*Pager)(unsafe.Pointer(pPager)).FerrCode + } else if (*Pager)(unsafe.Pointer(pPager)).FsectorSize > U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) { + + return pagerWriteLargeSector(tls, pPg) + } else { + return pager_write(tls, pPg) + } + return int32(0) +} + +// Return TRUE if the page given in the argument was previously passed +// to sqlite3PagerWrite(). In other words, return TRUE if it is ok +// to change the content of the page. + +// A call to this routine tells the pager that it is not necessary to +// write the information on page pPg back to the disk, even though +// that page might be marked as dirty. This happens, for example, when +// the page has been added as a leaf of the freelist and so its +// content no longer matters. +// +// The overlying software layer calls this routine when all of the data +// on the given page is unused. The pager marks the page as clean so +// that it does not get written to disk. +// +// Tests show that this optimization can quadruple the speed of large +// DELETE operations. +// +// This optimization cannot be used with a temp-file, as the page may +// have been dirty at the start of the transaction. In that case, if +// memory pressure forces page pPg out of the cache, the data does need +// to be written out to disk so that it may be read back in if the +// current transaction is rolled back. +func Xsqlite3PagerDontWrite(tls *libc.TLS, pPg uintptr) { /* sqlite3.c:58837:21: */ + var pPager uintptr = (*PgHdr)(unsafe.Pointer(pPg)).FpPager + if (!(int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) != 0) && ((int32((*PgHdr)(unsafe.Pointer(pPg)).Fflags) & PGHDR_DIRTY) != 0)) && ((*Pager)(unsafe.Pointer(pPager)).FnSavepoint == 0) { + + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) |= U16((PGHDR_DONT_WRITE)) + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(PGHDR_WRITEABLE))) + + } +} + +// This routine is called to increment the value of the database file +// change-counter, stored as a 4-byte big-endian integer starting at +// byte offset 24 of the pager file. The secondary change counter at +// 92 is also updated, as is the SQLite version number at offset 96. +// +// But this only happens if the pPager->changeCountDone flag is false. +// To avoid excess churning of page 1, the update only happens once. +// See also the pager_write_changecounter() routine that does an +// unconditional update of the change counters. +// +// If the isDirectMode flag is zero, then this is done by calling +// sqlite3PagerWrite() on page 1, then modifying the contents of the +// page data. In this case the file will be updated when the current +// transaction is committed. +// +// The isDirectMode flag may only be non-zero if the library was compiled +// with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case, +// if isDirect is non-zero, then the database file is updated directly +// by writing an updated version of page 1 using a call to the +// sqlite3OsWrite() function. +func pager_incr_changecounter(tls *libc.TLS, pPager uintptr, isDirectMode int32) int32 { /* sqlite3.c:58871:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + + // Declare and initialize constant integer 'isDirect'. If the + // atomic-write optimization is enabled in this build, then isDirect + // is initialized to the value passed as the isDirectMode parameter + // to this function. Otherwise, it is always set to zero. + // + // The idea is that if the atomic-write optimization is not + // enabled at compile time, the compiler can omit the tests of + // 'isDirect' below, as well as the block enclosed in the + // "if( isDirect )" condition. + + _ = isDirectMode + + if !(int32((*Pager)(unsafe.Pointer(pPager)).FchangeCountDone) != 0) && ((*Pager)(unsafe.Pointer(pPager)).FdbSize > Pgno(0)) { + // var pPgHdr uintptr at bp, 8 + // Reference to page 1 + + // Open page 1 of the file for writing. + rc = Xsqlite3PagerGet(tls, pPager, uint32(1), bp /* &pPgHdr */, 0) + + // If page one was fetched successfully, and this function is not + // operating in direct-mode, make page 1 writable. When not in + // direct mode, page 1 is always held in cache and hence the PagerGet() + // above is always successful - hence the ALWAYS on rc==SQLITE_OK. + if !(0 != 0) && (rc == SQLITE_OK) { + rc = Xsqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp /* pPgHdr */))) + } + + if rc == SQLITE_OK { + // Actually do the update of the change counter + pager_write_changecounter(tls, *(*uintptr)(unsafe.Pointer(bp /* pPgHdr */))) + + // If running in direct mode, write the contents of page 1 to the file. + if 0 != 0 { + var zBuf uintptr + + zBuf = (*PgHdr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPgHdr */)))).FpData + if rc == SQLITE_OK { + rc = Xsqlite3OsWrite(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, zBuf, (*Pager)(unsafe.Pointer(pPager)).FpageSize, int64(0)) + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + 2*4))++ + } + if rc == SQLITE_OK { + // Update the pager's copy of the change-counter. Otherwise, the + // next time a read transaction is opened the cache will be + // flushed (as the change-counter values will not match). + var pCopy uintptr = ((zBuf) + 24) + libc.Xmemcpy(tls, (pPager + 136 /* &.dbFileVers */), pCopy, uint64(unsafe.Sizeof([16]int8{}))) + (*Pager)(unsafe.Pointer(pPager)).FchangeCountDone = U8(1) + } + } else { + (*Pager)(unsafe.Pointer(pPager)).FchangeCountDone = U8(1) + } + } + + // Release the page reference. + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pPgHdr */))) + } + return rc +} + +// Sync the database file to disk. This is a no-op for in-memory databases +// or pages with the Pager.noSync flag set. +// +// If successful, or if called on a pager for which it is a no-op, this +// function returns SQLITE_OK. Otherwise, an IO error code is returned. +func Xsqlite3PagerSync(tls *libc.TLS, pPager uintptr, zSuper uintptr) int32 { /* sqlite3.c:58954:20: */ + var rc int32 = SQLITE_OK + var pArg uintptr = zSuper + rc = Xsqlite3OsFileControl(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, SQLITE_FCNTL_SYNC, pArg) + if rc == SQLITE_NOTFOUND { + rc = SQLITE_OK + } + if (rc == SQLITE_OK) && !(int32((*Pager)(unsafe.Pointer(pPager)).FnoSync) != 0) { + + rc = Xsqlite3OsSync(tls, (*Pager)(unsafe.Pointer(pPager)).Ffd, int32((*Pager)(unsafe.Pointer(pPager)).FsyncFlags)) + } + return rc +} + +// This function may only be called while a write-transaction is active in +// rollback. If the connection is in WAL mode, this call is a no-op. +// Otherwise, if the connection does not already have an EXCLUSIVE lock on +// the database file, an attempt is made to obtain one. +// +// If the EXCLUSIVE lock is already held or the attempt to obtain it is +// successful, or the connection is in WAL mode, SQLITE_OK is returned. +// Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is +// returned. +func Xsqlite3PagerExclusiveLock(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:58977:20: */ + var rc int32 = (*Pager)(unsafe.Pointer(pPager)).FerrCode + + if rc == SQLITE_OK { + + if 0 == (libc.Bool32((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0))) { + rc = pager_wait_on_lock(tls, pPager, EXCLUSIVE_LOCK) + } + } + return rc +} + +// Sync the database file for the pager pPager. zSuper points to the name +// of a super-journal file that should be written into the individual +// journal file. zSuper may be NULL, which is interpreted as no +// super-journal (a single database transaction). +// +// This routine ensures that: +// +// * The database file change-counter is updated, +// * the journal is synced (unless the atomic-write optimization is used), +// * all dirty pages are written to the database file, +// * the database file is truncated (if required), and +// * the database file synced. +// +// The only thing that remains to commit the transaction is to finalize +// (delete, truncate or zero the first part of) the journal file (or +// delete the super-journal file if specified). +// +// Note that if zSuper==NULL, this does not overwrite a previous value +// passed to an sqlite3PagerCommitPhaseOne() call. +// +// If the final parameter - noSync - is true, then the database file itself +// is not synced. The caller must call sqlite3PagerSync() directly to +// sync the database file before calling CommitPhaseTwo() to delete the +// journal file in this case. +func Xsqlite3PagerCommitPhaseOne(tls *libc.TLS, pPager uintptr, zSuper uintptr, noSync int32) int32 { /* sqlite3.c:59019:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + // var pPageOne uintptr at bp, 8 + + var nNew Pgno + var pList uintptr + rc = SQLITE_OK // Return code + + // If a prior error occurred, report that error again. + if !((*Pager)(unsafe.Pointer(pPager)).FerrCode != 0) { + goto __1 + } + return (*Pager)(unsafe.Pointer(pPager)).FerrCode +__1: + ; + + // Provide the ability to easily simulate an I/O error during testing + if !(Xsqlite3FaultSim(tls, 400) != 0) { + goto __2 + } + return SQLITE_IOERR +__2: + ; + + // If no database changes have been made, return early. + if !(int32((*Pager)(unsafe.Pointer(pPager)).FeState) < PAGER_WRITER_CACHEMOD) { + goto __3 + } + return SQLITE_OK +__3: + ; + + if !(0 == pagerFlushOnCommit(tls, pPager, 1)) { + goto __4 + } + // If this is an in-memory db, or no pages have been written to, or this + // function has already been called, it is mostly a no-op. However, any + // backup in progress needs to be restarted. + Xsqlite3BackupRestart(tls, (*Pager)(unsafe.Pointer(pPager)).FpBackup) + goto __5 +__4: + if !((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) { + goto __6 + } + *(*uintptr)(unsafe.Pointer(bp /* pPageOne */)) = uintptr(0) + pList = Xsqlite3PcacheDirtyList(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + if !(pList == uintptr(0)) { + goto __8 + } + // Must have at least one page for the WAL commit flag. + // Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 + rc = Xsqlite3PagerGet(tls, pPager, uint32(1), bp /* &pPageOne */, 0) + pList = *(*uintptr)(unsafe.Pointer(bp /* pPageOne */)) + (*PgHdr)(unsafe.Pointer(pList)).FpDirty = uintptr(0) +__8: + ; + + if !(pList != 0) { + goto __9 + } + rc = pagerWalFrames(tls, pPager, pList, (*Pager)(unsafe.Pointer(pPager)).FdbSize, 1) +__9: + ; + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pPageOne */))) + if !(rc == SQLITE_OK) { + goto __10 + } + Xsqlite3PcacheCleanAll(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) +__10: + ; + goto __7 +__6: + // The bBatch boolean is true if the batch-atomic-write commit method + // should be used. No rollback journal is created if batch-atomic-write + // is enabled. + + rc = pager_incr_changecounter(tls, pPager, 0) + if !(rc != SQLITE_OK) { + goto __11 + } + goto commit_phase_one_exit +__11: + ; + + // Write the super-journal name into the journal file. If a + // super-journal file name has already been written to the journal file, + // or if zSuper is NULL (no super-journal), then this call is a no-op. + rc = writeSuperJournal(tls, pPager, zSuper) + if !(rc != SQLITE_OK) { + goto __12 + } + goto commit_phase_one_exit +__12: + ; + + // Sync the journal file and write all dirty pages to the database. + // If the atomic-update optimization is being used, this sync will not + // create the journal file or perform any real IO. + // + // Because the change-counter page was just modified, unless the + // atomic-update optimization is used it is almost certain that the + // journal requires a sync here. However, in locking_mode=exclusive + // on a system under memory pressure it is just possible that this is + // not the case. In this case it is likely enough that the redundant + // xSync() call will be changed to a no-op by the OS anyhow. + rc = syncJournal(tls, pPager, 0) + if !(rc != SQLITE_OK) { + goto __13 + } + goto commit_phase_one_exit +__13: + ; + + pList = Xsqlite3PcacheDirtyList(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + + if !(BBatch == 0) { + goto __14 + } + rc = pager_write_pagelist(tls, pPager, pList) +__14: + ; + if !(rc != SQLITE_OK) { + goto __15 + } + + goto commit_phase_one_exit +__15: + ; + Xsqlite3PcacheCleanAll(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache) + + // If the file on disk is smaller than the database image, use + // pager_truncate to grow the file here. This can happen if the database + // image was extended as part of the current transaction and then the + // last page in the db image moved to the free-list. In this case the + // last page is never written out to disk, leaving the database file + // undersized. Fix this now if it is the case. + if !((*Pager)(unsafe.Pointer(pPager)).FdbSize > (*Pager)(unsafe.Pointer(pPager)).FdbFileSize) { + goto __16 + } + nNew = ((*Pager)(unsafe.Pointer(pPager)).FdbSize - (Pgno(libc.Bool32((*Pager)(unsafe.Pointer(pPager)).FdbSize == (Pgno((Xsqlite3PendingByte / ((*Pager)(unsafe.Pointer(pPager)).FpageSize)) + 1)))))) + + rc = pager_truncate(tls, pPager, nNew) + if !(rc != SQLITE_OK) { + goto __17 + } + goto commit_phase_one_exit +__17: + ; +__16: + ; + + // Finally, sync the database file. + if !(!(noSync != 0)) { + goto __18 + } + rc = Xsqlite3PagerSync(tls, pPager, zSuper) +__18: + ; + +__7: + ; +__5: + ; + +commit_phase_one_exit: + if !((rc == SQLITE_OK) && !((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0))) { + goto __19 + } + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_WRITER_FINISHED) +__19: + ; + return rc +} + +// When this function is called, the database file has been completely +// updated to reflect the changes made by the current transaction and +// synced to disk. The journal file still exists in the file-system +// though, and if a failure occurs at this point it will eventually +// be used as a hot-journal and the current transaction rolled back. +// +// This function finalizes the journal file, either by deleting, +// truncating or partially zeroing it, so that it cannot be used +// for hot-journal rollback. Once this is done the transaction is +// irrevocably committed. +// +// If an error occurs, an IO error code is returned and the pager +// moves into the error state. Otherwise, SQLITE_OK is returned. +func Xsqlite3PagerCommitPhaseTwo(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:59249:20: */ + var rc int32 = SQLITE_OK // Return code + + // This routine should not be called if a prior error has occurred. + // But if (due to a coding error elsewhere in the system) it does get + // called, just return the same error code without doing anything. + if (*Pager)(unsafe.Pointer(pPager)).FerrCode != 0 { + return (*Pager)(unsafe.Pointer(pPager)).FerrCode + } + (*Pager)(unsafe.Pointer(pPager)).FiDataVersion++ + + // An optimization. If the database was not actually modified during + // this transaction, the pager is running in exclusive-mode and is + // using persistent journals, then this function is a no-op. + // + // The start of the journal file currently contains a single journal + // header with the nRec field set to 0. If such a journal is used as + // a hot-journal during hot-journal rollback, 0 changes will be made + // to the database file. So there is no need to zero the journal + // header. Since the pager is in exclusive mode, there is no need + // to drop any locks either. + if ((int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_WRITER_LOCKED) && + ((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode != 0)) && + (int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) == PAGER_JOURNALMODE_PERSIST) { + + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_READER) + return SQLITE_OK + } + + rc = pager_end_transaction(tls, pPager, int32((*Pager)(unsafe.Pointer(pPager)).FsetSuper), 1) + return pager_error(tls, pPager, rc) +} + +// If a write transaction is open, then all changes made within the +// transaction are reverted and the current write-transaction is closed. +// The pager falls back to PAGER_READER state if successful, or PAGER_ERROR +// state if an error occurs. +// +// If the pager is already in PAGER_ERROR state when this function is called, +// it returns Pager.errCode immediately. No work is performed in this case. +// +// Otherwise, in rollback mode, this function performs two functions: +// +// 1) It rolls back the journal file, restoring all database file and +// in-memory cache pages to the state they were in when the transaction +// was opened, and +// +// 2) It finalizes the journal file, so that it is not used for hot +// rollback at any point in the future. +// +// Finalization of the journal file (task 2) is only performed if the +// rollback is successful. +// +// In WAL mode, all cache-entries containing data modified within the +// current transaction are either expelled from the cache or reverted to +// their pre-transaction state by re-reading data from the database or +// WAL files. The WAL transaction is then closed. +func Xsqlite3PagerRollback(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:59315:20: */ + var rc int32 = SQLITE_OK // Return code + + // PagerRollback() is a no-op if called in READER or OPEN state. If + // the pager is already in the ERROR state, the rollback is not + // attempted here. Instead, the error code is returned to the caller. + + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_ERROR { + return (*Pager)(unsafe.Pointer(pPager)).FerrCode + } + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) <= PAGER_READER { + return SQLITE_OK + } + + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + var rc2 int32 + rc = Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_ROLLBACK, -1) + rc2 = pager_end_transaction(tls, pPager, int32((*Pager)(unsafe.Pointer(pPager)).FsetSuper), 0) + if rc == SQLITE_OK { + rc = rc2 + } + } else if !((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) || (int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_WRITER_LOCKED) { + var eState int32 = int32((*Pager)(unsafe.Pointer(pPager)).FeState) + rc = pager_end_transaction(tls, pPager, 0, 0) + if !(int32((*Pager)(unsafe.Pointer(pPager)).FmemDb) != 0) && (eState > PAGER_WRITER_LOCKED) { + // This can happen using journal_mode=off. Move the pager to the error + // state to indicate that the contents of the cache may not be trusted. + // Any active readers will get SQLITE_ABORT. + (*Pager)(unsafe.Pointer(pPager)).FerrCode = SQLITE_ABORT + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_ERROR) + setGetterMethod(tls, pPager) + return rc + } + } else { + rc = pager_playback(tls, pPager, 0) + } + + // If an error occurs during a ROLLBACK, we can no longer trust the pager + // cache. So call pager_error() on the way out to make any error persistent. + return pager_error(tls, pPager, rc) +} + +// Return TRUE if the database file is opened read-only. Return FALSE +// if the database is (in theory) writable. +func Xsqlite3PagerIsreadonly(tls *libc.TLS, pPager uintptr) U8 { /* sqlite3.c:59365:19: */ + return (*Pager)(unsafe.Pointer(pPager)).FreadOnly +} + +// Return the approximate number of bytes of memory currently +// used by the pager and its associated cache. +func Xsqlite3PagerMemUsed(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:59382:20: */ + var perPageSize int32 = (int32(((uint64((*Pager)(unsafe.Pointer(pPager)).FpageSize + int32((*Pager)(unsafe.Pointer(pPager)).FnExtra))) + uint64(unsafe.Sizeof(PgHdr{}))) + + (uint64(5) * uint64(unsafe.Sizeof(uintptr(0)))))) + return (((perPageSize * Xsqlite3PcachePagecount(tls, (*Pager)(unsafe.Pointer(pPager)).FpPCache)) + + Xsqlite3MallocSize(tls, pPager)) + + (*Pager)(unsafe.Pointer(pPager)).FpageSize) +} + +// Return the number of references to the specified page. +func Xsqlite3PagerPageRefcount(tls *libc.TLS, pPage uintptr) int32 { /* sqlite3.c:59393:20: */ + return Xsqlite3PcachePageRefcount(tls, pPage) +} + +// Parameter eStat must be one of SQLITE_DBSTATUS_CACHE_HIT, _MISS, _WRITE, +// or _WRITE+1. The SQLITE_DBSTATUS_CACHE_WRITE+1 case is a translation +// of SQLITE_DBSTATUS_CACHE_SPILL. The _SPILL case is not contiguous because +// it was added later. +// +// Before returning, *pnVal is incremented by the +// current cache hit or miss count, according to the value of eStat. If the +// reset parameter is non-zero, the cache hit or miss count is zeroed before +// returning. +func Xsqlite3PagerCacheStat(tls *libc.TLS, pPager uintptr, eStat int32, reset int32, pnVal uintptr) { /* sqlite3.c:59429:21: */ + + eStat = eStat - (SQLITE_DBSTATUS_CACHE_HIT) + *(*int32)(unsafe.Pointer(pnVal)) += (*(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + uintptr(eStat)*4))) + if reset != 0 { + *(*int32)(unsafe.Pointer((pPager + 240 /* &.aStat */) + uintptr(eStat)*4)) = 0 + } +} + +// Return true if this is an in-memory or temp-file backed pager. +func Xsqlite3PagerIsMemdb(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:59452:20: */ + return int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) +} + +// Check that there are at least nSavepoint savepoints open. If there are +// currently less than nSavepoints open, then open one or more savepoints +// to make up the difference. If the number of savepoints is already +// equal to nSavepoint, then this function is a no-op. +// +// If a memory allocation fails, SQLITE_NOMEM is returned. If an error +// occurs while opening the sub-journal file, then an IO error code is +// returned. Otherwise, SQLITE_OK. +func pagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) int32 { /* sqlite3.c:59466:28: */ + var rc int32 = SQLITE_OK // Return code + var nCurrent int32 = (*Pager)(unsafe.Pointer(pPager)).FnSavepoint // Current number of savepoints + var ii int32 // Iterator variable + var aNew uintptr // New Pager.aSavepoint array + + // Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM + // if the allocation fails. Otherwise, zero the new portion in case a + // malloc failure occurs while populating it in the for(...) loop below. + aNew = Xsqlite3Realloc(tls, + (*Pager)(unsafe.Pointer(pPager)).FaSavepoint, (uint64(uint64(unsafe.Sizeof(PagerSavepoint{})) * uint64(nSavepoint)))) + if !(aNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, (aNew + uintptr(nCurrent)*56), 0, ((uint64(nSavepoint - nCurrent)) * uint64(unsafe.Sizeof(PagerSavepoint{})))) + (*Pager)(unsafe.Pointer(pPager)).FaSavepoint = aNew + + // Populate the PagerSavepoint structures just allocated. + for ii = nCurrent; ii < nSavepoint; ii++ { + (*PagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56)).FnOrig = (*Pager)(unsafe.Pointer(pPager)).FdbSize + if ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) && ((*Pager)(unsafe.Pointer(pPager)).FjournalOff > int64(0)) { + (*PagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56)).FiOffset = (*Pager)(unsafe.Pointer(pPager)).FjournalOff + } else { + (*PagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56)).FiOffset = I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize) + } + (*PagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56)).FiSubRec = (*Pager)(unsafe.Pointer(pPager)).FnSubRec + (*PagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56)).FpInSavepoint = Xsqlite3BitvecCreate(tls, (*Pager)(unsafe.Pointer(pPager)).FdbSize) + (*PagerSavepoint)(unsafe.Pointer(aNew + uintptr(ii)*56)).FbTruncateOnRelease = 1 + if !(int32((*PagerSavepoint)(unsafe.Pointer(aNew+uintptr(ii)*56)).FpInSavepoint) != 0) { + return SQLITE_NOMEM + } + if (*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0) { + Xsqlite3WalSavepoint(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, aNew+uintptr(ii)*56+36 /* &.aWalData */) + } + (*Pager)(unsafe.Pointer(pPager)).FnSavepoint = (ii + 1) + } + + return rc +} + +func Xsqlite3PagerOpenSavepoint(tls *libc.TLS, pPager uintptr, nSavepoint int32) int32 { /* sqlite3.c:59512:20: */ + + if (nSavepoint > (*Pager)(unsafe.Pointer(pPager)).FnSavepoint) && ((*Pager)(unsafe.Pointer(pPager)).FuseJournal != 0) { + return pagerOpenSavepoint(tls, pPager, nSavepoint) + } else { + return SQLITE_OK + } + return int32(0) +} + +// This function is called to rollback or release (commit) a savepoint. +// The savepoint to release or rollback need not be the most recently +// created savepoint. +// +// Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE. +// If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with +// index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes +// that have occurred since the specified savepoint was created. +// +// The savepoint to rollback or release is identified by parameter +// iSavepoint. A value of 0 means to operate on the outermost savepoint +// (the first created). A value of (Pager.nSavepoint-1) means operate +// on the most recently created savepoint. If iSavepoint is greater than +// (Pager.nSavepoint-1), then this function is a no-op. +// +// If a negative value is passed to this function, then the current +// transaction is rolled back. This is different to calling +// sqlite3PagerRollback() because this function does not terminate +// the transaction or unlock the database, it just restores the +// contents of the database to its original state. +// +// In any case, all savepoints with an index greater than iSavepoint +// are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE), +// then savepoint iSavepoint is also destroyed. +// +// This function may return SQLITE_NOMEM if a memory allocation fails, +// or an IO error code if an IO error occurs while rolling back a +// savepoint. If no errors occur, SQLITE_OK is returned. +func Xsqlite3PagerSavepoint(tls *libc.TLS, pPager uintptr, op int32, iSavepoint int32) int32 { /* sqlite3.c:59554:20: */ + var rc int32 = (*Pager)(unsafe.Pointer(pPager)).FerrCode + + if (rc == SQLITE_OK) && (iSavepoint < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint) { + var ii int32 // Iterator variable + var nNew int32 // Number of remaining savepoints after this op. + + // Figure out how many savepoints will still be active after this + // operation. Store this value in nNew. Then free resources associated + // with any savepoints that are destroyed by this operation. + nNew = (iSavepoint + (func() int32 { + if op == SAVEPOINT_RELEASE { + return 0 + } + return 1 + }())) + for ii = nNew; ii < (*Pager)(unsafe.Pointer(pPager)).FnSavepoint; ii++ { + Xsqlite3BitvecDestroy(tls, (*PagerSavepoint)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).FaSavepoint+uintptr(ii)*56)).FpInSavepoint) + } + (*Pager)(unsafe.Pointer(pPager)).FnSavepoint = nNew + + // If this is a release of the outermost savepoint, truncate + // the sub-journal to zero bytes in size. + if op == SAVEPOINT_RELEASE { + var pRel uintptr = ((*Pager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr(nNew)*56) + if ((*PagerSavepoint)(unsafe.Pointer(pRel)).FbTruncateOnRelease != 0) && ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fsjfd))).FpMethods != uintptr(0)) { + // Only truncate if it is an in-memory sub-journal. + if Xsqlite3JournalIsInMemory(tls, (*Pager)(unsafe.Pointer(pPager)).Fsjfd) != 0 { + var sz I64 = (I64((Pgno((*Pager)(unsafe.Pointer(pPager)).FpageSize + 4)) * (*PagerSavepoint)(unsafe.Pointer(pRel)).FiSubRec)) + rc = Xsqlite3OsTruncate(tls, (*Pager)(unsafe.Pointer(pPager)).Fsjfd, sz) + + } + (*Pager)(unsafe.Pointer(pPager)).FnSubRec = (*PagerSavepoint)(unsafe.Pointer(pRel)).FiSubRec + } + } else if ((*Pager)(unsafe.Pointer((pPager))).FpWal != uintptr(0)) || ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) { + var pSavepoint uintptr + if nNew == 0 { + pSavepoint = uintptr(0) + } else { + pSavepoint = ((*Pager)(unsafe.Pointer(pPager)).FaSavepoint + uintptr((nNew-1))*56) + } + rc = pagerPlaybackSavepoint(tls, pPager, pSavepoint) + + } + + } + + return rc +} + +// Return the full pathname of the database file. +// +// Except, if the pager is in-memory only, then return an empty string if +// nullIfMemDb is true. This routine is called with nullIfMemDb==1 when +// used to report the filename to the user, for compatibility with legacy +// behavior. But when the Btree needs to know the filename for matching to +// shared cache, it uses nullIfMemDb==0 so that in-memory databases can +// participate in shared-cache. +// +// The return value to this routine is always safe to use with +// sqlite3_uri_parameter() and sqlite3_filename_database() and friends. +func Xsqlite3PagerFilename(tls *libc.TLS, pPager uintptr, nullIfMemDb int32) uintptr { /* sqlite3.c:59635:27: */ + if (nullIfMemDb != 0) && ((*Pager)(unsafe.Pointer(pPager)).FmemDb != 0) { + return (uintptr(unsafe.Pointer(&zFake)) + 4) + } + return (*Pager)(unsafe.Pointer(pPager)).FzFilename +} + +var zFake = [8]int8{int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0)} /* sqlite3.c:59636:21 */ + +// Return the VFS structure for the pager. +func Xsqlite3PagerVfs(tls *libc.TLS, pPager uintptr) uintptr { /* sqlite3.c:59643:28: */ + return (*Pager)(unsafe.Pointer(pPager)).FpVfs +} + +// Return the file handle for the database file associated +// with the pager. This might return NULL if the file has +// not yet been opened. +func Xsqlite3PagerFile(tls *libc.TLS, pPager uintptr) uintptr { /* sqlite3.c:59652:29: */ + return (*Pager)(unsafe.Pointer(pPager)).Ffd +} + +// Return the file handle for the journal file (if it exists). +// This will be either the rollback journal or the WAL file. +func Xsqlite3PagerJrnlFile(tls *libc.TLS, pPager uintptr) uintptr { /* sqlite3.c:59660:29: */ + if (*Pager)(unsafe.Pointer(pPager)).FpWal != 0 { + return Xsqlite3WalFile(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + } + return (*Pager)(unsafe.Pointer(pPager)).Fjfd +} + +// Return the full pathname of the journal file. +func Xsqlite3PagerJournalname(tls *libc.TLS, pPager uintptr) uintptr { /* sqlite3.c:59671:27: */ + return (*Pager)(unsafe.Pointer(pPager)).FzJournal +} + +// Move the page pPg to location pgno in the file. +// +// There must be no references to the page previously located at +// pgno (which we call pPgOld) though that page is allowed to be +// in cache. If the page previously located at pgno is not already +// in the rollback journal, it is not put there by by this routine. +// +// References to the page pPg remain valid. Updating any +// meta-data associated with pPg (i.e. data stored in the nExtra bytes +// allocated along with the page) is the responsibility of the caller. +// +// A transaction must be active when this routine is called. It used to be +// required that a statement transaction was not active, but this restriction +// has been removed (CREATE INDEX needs to move a page when a statement +// transaction is active). +// +// If the fourth argument, isCommit, is non-zero, then this page is being +// moved as part of a database reorganization just before the transaction +// is being committed. In this case, it is guaranteed that the database page +// pPg refers to will not be written to again within this transaction. +// +// This function may return SQLITE_NOMEM or an IO error code if an error +// occurs. Otherwise, it returns SQLITE_OK. +func Xsqlite3PagerMovepage(tls *libc.TLS, pPager uintptr, pPg uintptr, pgno Pgno, isCommit int32) int32 { /* sqlite3.c:59701:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pPgOld uintptr // The page being overwritten. + var needSyncPgno Pgno = Pgno(0) // Old value of pPg->pgno, if sync is required + var rc int32 // Return code + var origPgno Pgno // The original page number + + // In order to be able to rollback, an in-memory database must journal + // the page we are moving from. + + if (*Pager)(unsafe.Pointer(pPager)).FtempFile != 0 { + rc = Xsqlite3PagerWrite(tls, pPg) + if rc != 0 { + return rc + } + } + + // If the page being moved is dirty and has not been saved by the latest + // savepoint, then save the current contents of the page into the + // sub-journal now. This is required to handle the following scenario: + // + // BEGIN; + // + // SAVEPOINT one; + // + // ROLLBACK TO one; + // + // If page X were not written to the sub-journal here, it would not + // be possible to restore its contents when the "ROLLBACK TO one" + // statement were is processed. + // + // subjournalPage() may need to allocate space to store pPg->pgno into + // one or more savepoint bitvecs. This is the reason this function + // may return SQLITE_NOMEM. + if ((int32((*DbPage)(unsafe.Pointer(pPg)).Fflags) & PGHDR_DIRTY) != 0) && + (SQLITE_OK != (libc.AssignInt32(&rc, subjournalPageIfRequired(tls, pPg)))) { + return rc + } + + // If the journal needs to be sync()ed before page pPg->pgno can + // be written to, store pPg->pgno in local variable needSyncPgno. + // + // If the isCommit flag is set, there is no need to remember that + // the journal needs to be sync()ed before database page pPg->pgno + // can be written to. The caller has already promised not to write to it. + if ((int32((*DbPage)(unsafe.Pointer(pPg)).Fflags) & PGHDR_NEED_SYNC) != 0) && !(isCommit != 0) { + needSyncPgno = (*DbPage)(unsafe.Pointer(pPg)).Fpgno + + } + + // If the cache contains a page with page-number pgno, remove it + // from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for + // page pgno before the 'move' operation, it needs to be retained + // for the page moved there. + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(PGHDR_NEED_SYNC))) + pPgOld = Xsqlite3PagerLookup(tls, pPager, pgno) + + if pPgOld != 0 { + if int32((*PgHdr)(unsafe.Pointer(pPgOld)).FnRef) > 1 { + Xsqlite3PagerUnrefNotNull(tls, pPgOld) + return Xsqlite3CorruptError(tls, 59775) + } + *(*U16)(unsafe.Pointer(pPg + 52 /* &.flags */)) |= U16((int32((*PgHdr)(unsafe.Pointer(pPgOld)).Fflags) & PGHDR_NEED_SYNC)) + if (*Pager)(unsafe.Pointer(pPager)).FtempFile != 0 { + // Do not discard pages from an in-memory database since we might + // need to rollback later. Just move the page out of the way. + Xsqlite3PcacheMove(tls, pPgOld, ((*Pager)(unsafe.Pointer(pPager)).FdbSize + Pgno(1))) + } else { + Xsqlite3PcacheDrop(tls, pPgOld) + } + } + + origPgno = (*DbPage)(unsafe.Pointer(pPg)).Fpgno + Xsqlite3PcacheMove(tls, pPg, pgno) + Xsqlite3PcacheMakeDirty(tls, pPg) + + // For an in-memory database, make sure the original page continues + // to exist, in case the transaction needs to roll back. Use pPgOld + // as the original page since it has already been allocated. + if ((*Pager)(unsafe.Pointer(pPager)).FtempFile != 0) && (pPgOld != 0) { + Xsqlite3PcacheMove(tls, pPgOld, origPgno) + Xsqlite3PagerUnrefNotNull(tls, pPgOld) + } + + if needSyncPgno != 0 { + // If needSyncPgno is non-zero, then the journal file needs to be + // sync()ed before any data is written to database file page needSyncPgno. + // Currently, no such page exists in the page-cache and the + // "is journaled" bitvec flag has been set. This needs to be remedied by + // loading the page into the pager-cache and setting the PGHDR_NEED_SYNC + // flag. + // + // If the attempt to load the page into the page-cache fails, (due + // to a malloc() or IO failure), clear the bit in the pInJournal[] + // array. Otherwise, if the page is loaded and written again in + // this transaction, it may be written to the database file before + // it is synced into the journal file. This way, it may end up in + // the journal file twice, but that is not a problem. + // var pPgHdr uintptr at bp, 8 + + rc = Xsqlite3PagerGet(tls, pPager, needSyncPgno, bp /* &pPgHdr */, 0) + if rc != SQLITE_OK { + if needSyncPgno <= (*Pager)(unsafe.Pointer(pPager)).FdbOrigSize { + + Xsqlite3BitvecClear(tls, (*Pager)(unsafe.Pointer(pPager)).FpInJournal, needSyncPgno, (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace) + } + return rc + } + *(*U16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPgHdr */)) + 52 /* &.flags */)) |= U16((PGHDR_NEED_SYNC)) + Xsqlite3PcacheMakeDirty(tls, *(*uintptr)(unsafe.Pointer(bp /* pPgHdr */))) + Xsqlite3PagerUnrefNotNull(tls, *(*uintptr)(unsafe.Pointer(bp /* pPgHdr */))) + } + + return SQLITE_OK +} + +// The page handle passed as the first argument refers to a dirty page +// with a page number other than iNew. This function changes the page's +// page number to iNew and sets the value of the PgHdr.flags field to +// the value passed as the third parameter. +func Xsqlite3PagerRekey(tls *libc.TLS, pPg uintptr, iNew Pgno, flags U16) { /* sqlite3.c:59839:21: */ + + (*DbPage)(unsafe.Pointer(pPg)).Fflags = flags + Xsqlite3PcacheMove(tls, pPg, iNew) +} + +// Return a pointer to the data for the specified page. +func Xsqlite3PagerGetData(tls *libc.TLS, pPg uintptr) uintptr { /* sqlite3.c:59848:21: */ + + return (*DbPage)(unsafe.Pointer(pPg)).FpData +} + +// Return a pointer to the Pager.nExtra bytes of "extra" space +// allocated along with the specified page. +func Xsqlite3PagerGetExtra(tls *libc.TLS, pPg uintptr) uintptr { /* sqlite3.c:59857:21: */ + return (*DbPage)(unsafe.Pointer(pPg)).FpExtra +} + +// Get/set the locking-mode for this pager. Parameter eMode must be one +// of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or +// PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then +// the locking-mode is set to the value specified. +// +// The returned value is either PAGER_LOCKINGMODE_NORMAL or +// PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated) +// locking-mode. +func Xsqlite3PagerLockingMode(tls *libc.TLS, pPager uintptr, eMode int32) int32 { /* sqlite3.c:59871:20: */ + + if ((eMode >= 0) && !(int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) != 0)) && !(Xsqlite3WalHeapMemory(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) != 0) { + (*Pager)(unsafe.Pointer(pPager)).FexclusiveMode = U8(eMode) + } + return int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) +} + +// Set the journal-mode for this pager. Parameter eMode must be one of: +// +// PAGER_JOURNALMODE_DELETE +// PAGER_JOURNALMODE_TRUNCATE +// PAGER_JOURNALMODE_PERSIST +// PAGER_JOURNALMODE_OFF +// PAGER_JOURNALMODE_MEMORY +// PAGER_JOURNALMODE_WAL +// +// The journalmode is set to the value specified if the change is allowed. +// The change may be disallowed for the following reasons: +// +// * An in-memory database can only have its journal_mode set to _OFF +// or _MEMORY. +// +// * Temporary databases cannot have _WAL journalmode. +// +// The returned indicate the current (possibly updated) journal-mode. +func Xsqlite3PagerSetJournalMode(tls *libc.TLS, pPager uintptr, eMode int32) int32 { /* sqlite3.c:59904:20: */ + var eOld U8 = (*Pager)(unsafe.Pointer(pPager)).FjournalMode // Prior journalmode + + // The eMode parameter is always valid + + // This routine is only called from the OP_JournalMode opcode, and + // the logic there will never allow a temporary file to be changed + // to WAL mode. + + // Do allow the journalmode of an in-memory database to be set to + // anything other than MEMORY or OFF + if (*Pager)(unsafe.Pointer(pPager)).FmemDb != 0 { + + if (eMode != PAGER_JOURNALMODE_MEMORY) && (eMode != PAGER_JOURNALMODE_OFF) { + eMode = int32(eOld) + } + } + + if eMode != int32(eOld) { + + // Change the journal mode. + + (*Pager)(unsafe.Pointer(pPager)).FjournalMode = U8(eMode) + + // When transistioning from TRUNCATE or PERSIST to any other journal + // mode except WAL, unless the pager is in locking_mode=exclusive mode, + // delete the journal file. + + if (!(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) && ((int32(eOld) & 5) == 1)) && ((eMode & 1) == 0) { + + // In this case we would like to delete the journal file. If it is + // not possible, then that is not a problem. Deleting the journal file + // here is an optimization only. + // + // Before deleting the journal file, obtain a RESERVED lock on the + // database file. This ensures that the journal file is not deleted + // while it is in use by some other client. + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + if int32((*Pager)(unsafe.Pointer(pPager)).FeLock) >= RESERVED_LOCK { + Xsqlite3OsDelete(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, 0) + } else { + var rc int32 = SQLITE_OK + var state int32 = int32((*Pager)(unsafe.Pointer(pPager)).FeState) + + if state == PAGER_OPEN { + rc = Xsqlite3PagerSharedLock(tls, pPager) + } + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) == PAGER_READER { + + rc = pagerLockDb(tls, pPager, RESERVED_LOCK) + } + if rc == SQLITE_OK { + Xsqlite3OsDelete(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, (*Pager)(unsafe.Pointer(pPager)).FzJournal, 0) + } + if (rc == SQLITE_OK) && (state == PAGER_READER) { + pagerUnlockDb(tls, pPager, SHARED_LOCK) + } else if state == PAGER_OPEN { + pager_unlock(tls, pPager) + } + + } + } else if eMode == PAGER_JOURNALMODE_OFF { + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + } + } + + // Return the new journal mode + return int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) +} + +// Return the current journal mode. +func Xsqlite3PagerGetJournalMode(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:59995:20: */ + return int32((*Pager)(unsafe.Pointer(pPager)).FjournalMode) +} + +// Return TRUE if the pager is in a state where it is OK to change the +// journalmode. Journalmode changes can only happen when the database +// is unmodified. +func Xsqlite3PagerOkToChangeJournalMode(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:60004:20: */ + + if int32((*Pager)(unsafe.Pointer(pPager)).FeState) >= PAGER_WRITER_CACHEMOD { + return 0 + } + if ((*Sqlite3_file)(unsafe.Pointer(((*Pager)(unsafe.Pointer(pPager)).Fjfd))).FpMethods != uintptr(0)) && ((*Pager)(unsafe.Pointer(pPager)).FjournalOff > int64(0)) { + return 0 + } + return 1 +} + +// Get/set the size-limit used for persistent journal files. +// +// Setting the size limit to -1 means no limit is enforced. +// An attempt to set a limit smaller than -1 is a no-op. +func Xsqlite3PagerJournalSizeLimit(tls *libc.TLS, pPager uintptr, iLimit I64) I64 { /* sqlite3.c:60017:20: */ + if iLimit >= int64(-1) { + (*Pager)(unsafe.Pointer(pPager)).FjournalSizeLimit = iLimit + Xsqlite3WalLimit(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, iLimit) + } + return (*Pager)(unsafe.Pointer(pPager)).FjournalSizeLimit +} + +// Return a pointer to the pPager->pBackup variable. The backup module +// in backup.c maintains the content of this variable. This module +// uses it opaquely as an argument to sqlite3BackupRestart() and +// sqlite3BackupUpdate() only. +func Xsqlite3PagerBackupPtr(tls *libc.TLS, pPager uintptr) uintptr { /* sqlite3.c:60031:31: */ + return (pPager + 112 /* &.pBackup */) +} + +// Unless this is an in-memory or temporary database, clear the pager cache. +func Xsqlite3PagerClearCache(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:60039:21: */ + + if int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) == 0 { + pager_reset(tls, pPager) + } +} + +// This function is called when the user invokes "PRAGMA wal_checkpoint", +// "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() +// or wal_blocking_checkpoint() API functions. +// +// Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. +func Xsqlite3PagerCheckpoint(tls *libc.TLS, pPager uintptr, db uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) int32 { /* sqlite3.c:60054:20: */ + var rc int32 = SQLITE_OK + if (*Pager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = Xsqlite3WalCheckpoint(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, db, eMode, + func() uintptr { + if eMode == SQLITE_CHECKPOINT_PASSIVE { + return uintptr(0) + } + return (*Pager)(unsafe.Pointer(pPager)).FxBusyHandler + }(), + (*Pager)(unsafe.Pointer(pPager)).FpBusyHandlerArg, + int32((*Pager)(unsafe.Pointer(pPager)).FwalSyncFlags), (*Pager)(unsafe.Pointer(pPager)).FpageSize, (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace, + pnLog, pnCkpt) + } + return rc +} + +func Xsqlite3PagerWalCallback(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:60073:20: */ + return Xsqlite3WalCallback(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) +} + +// Return true if the underlying VFS for the given pager supports the +// primitives necessary for write-ahead logging. +func Xsqlite3PagerWalSupported(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:60081:20: */ + var pMethods uintptr = (*Sqlite3_file)(unsafe.Pointer((*Pager)(unsafe.Pointer(pPager)).Ffd)).FpMethods + if (*Pager)(unsafe.Pointer(pPager)).FnoLock != 0 { + return 0 + } + return (libc.Bool32(((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode != 0) || (((*Sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion >= 2) && ((*Sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmMap != 0)))) +} + +// Attempt to take an exclusive lock on the database file. If a PENDING lock +// is obtained instead, immediately release it. +func pagerExclusiveLock(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:60091:12: */ + var rc int32 // Return code + + rc = pagerLockDb(tls, pPager, EXCLUSIVE_LOCK) + if rc != SQLITE_OK { + // If the attempt to grab the exclusive lock failed, release the + // pending lock that may have been obtained instead. + pagerUnlockDb(tls, pPager, SHARED_LOCK) + } + + return rc +} + +// Call sqlite3WalOpen() to open the WAL handle. If the pager is in +// exclusive-locking mode when this function is called, take an EXCLUSIVE +// lock on the database file and use heap-memory to store the wal-index +// in. Otherwise, use the normal shared-memory. +func pagerOpenWal(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:60111:12: */ + var rc int32 = SQLITE_OK + + // If the pager is already in exclusive-mode, the WAL module will use + // heap-memory for the wal-index instead of the VFS shared-memory + // implementation. Take the exclusive lock now, before opening the WAL + // file, to make sure this is safe. + if (*Pager)(unsafe.Pointer(pPager)).FexclusiveMode != 0 { + rc = pagerExclusiveLock(tls, pPager) + } + + // Open the connection to the log file. If this operation fails, + // (e.g. due to malloc() failure), return an error code. + if rc == SQLITE_OK { + rc = Xsqlite3WalOpen(tls, (*Pager)(unsafe.Pointer(pPager)).FpVfs, + (*Pager)(unsafe.Pointer(pPager)).Ffd, (*Pager)(unsafe.Pointer(pPager)).FzWal, int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode), + (*Pager)(unsafe.Pointer(pPager)).FjournalSizeLimit, (pPager + 288 /* &.pWal */)) + } + pagerFixMaplimit(tls, pPager) + + return rc +} + +// The caller must be holding a SHARED lock on the database file to call +// this function. +// +// If the pager passed as the first argument is open on a real database +// file (not a temp file or an in-memory database), and the WAL file +// is not already open, make an attempt to open it now. If successful, +// return SQLITE_OK. If an error occurs or the VFS used by the pager does +// not support the xShmXXX() methods, return an error code. *pbOpen is +// not modified in either case. +// +// If the pager is open on a temp-file (or in-memory database), or if +// the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK +// without doing anything. +func Xsqlite3PagerOpenWal(tls *libc.TLS, pPager uintptr, pbOpen uintptr) int32 { /* sqlite3.c:60156:20: */ + var rc int32 = SQLITE_OK // Return code + + if !(int32((*Pager)(unsafe.Pointer(pPager)).FtempFile) != 0) && !(int32((*Pager)(unsafe.Pointer(pPager)).FpWal) != 0) { + if !(Xsqlite3PagerWalSupported(tls, pPager) != 0) { + return SQLITE_CANTOPEN + } + + // Close any rollback journal previously open + Xsqlite3OsClose(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd) + + rc = pagerOpenWal(tls, pPager) + if rc == SQLITE_OK { + (*Pager)(unsafe.Pointer(pPager)).FjournalMode = U8(PAGER_JOURNALMODE_WAL) + (*Pager)(unsafe.Pointer(pPager)).FeState = U8(PAGER_OPEN) + } + } else { + *(*int32)(unsafe.Pointer(pbOpen)) = 1 + } + + return rc +} + +// This function is called to close the connection to the log file prior +// to switching from WAL to rollback mode. +// +// Before closing the log file, this function attempts to take an +// EXCLUSIVE lock on the database file. If this cannot be obtained, an +// error (SQLITE_BUSY) is returned and the log connection is not closed. +// If successful, the EXCLUSIVE lock is not released before returning. +func Xsqlite3PagerCloseWal(tls *libc.TLS, pPager uintptr, db uintptr) int32 { /* sqlite3.c:60195:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + + // If the log file is not already open, but does exist in the file-system, + // it may need to be checkpointed before the connection can switch to + // rollback mode. Open it now so this can happen. + if !(int32((*Pager)(unsafe.Pointer(pPager)).FpWal) != 0) { + *(*int32)(unsafe.Pointer(bp /* logexists */)) = 0 + rc = pagerLockDb(tls, pPager, SHARED_LOCK) + if rc == SQLITE_OK { + rc = Xsqlite3OsAccess(tls, + (*Pager)(unsafe.Pointer(pPager)).FpVfs, (*Pager)(unsafe.Pointer(pPager)).FzWal, SQLITE_ACCESS_EXISTS, bp /* &logexists */) + } + if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* logexists */)) != 0) { + rc = pagerOpenWal(tls, pPager) + } + } + + // Checkpoint and close the log. Because an EXCLUSIVE lock is held on + // the database file, the log and log-summary files will be deleted. + if (rc == SQLITE_OK) && ((*Pager)(unsafe.Pointer(pPager)).FpWal != 0) { + rc = pagerExclusiveLock(tls, pPager) + if rc == SQLITE_OK { + rc = Xsqlite3WalClose(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, db, int32((*Pager)(unsafe.Pointer(pPager)).FwalSyncFlags), + (*Pager)(unsafe.Pointer(pPager)).FpageSize, (*Pager)(unsafe.Pointer(pPager)).FpTmpSpace) + (*Pager)(unsafe.Pointer(pPager)).FpWal = uintptr(0) + pagerFixMaplimit(tls, pPager) + if (rc != 0) && !(int32((*Pager)(unsafe.Pointer(pPager)).FexclusiveMode) != 0) { + pagerUnlockDb(tls, pPager, SHARED_LOCK) + } + } + } + return rc +} + +// If this is a WAL database, obtain a snapshot handle for the snapshot +// currently open. Otherwise, return an error. +func Xsqlite3PagerSnapshotGet(tls *libc.TLS, pPager uintptr, ppSnapshot uintptr) int32 { /* sqlite3.c:60264:20: */ + var rc int32 = SQLITE_ERROR + if (*Pager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = Xsqlite3WalSnapshotGet(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, ppSnapshot) + } + return rc +} + +// If this is a WAL database, store a pointer to pSnapshot. Next time a +// read transaction is opened, attempt to read from the snapshot it +// identifies. If this is not a WAL database, return an error. +func Xsqlite3PagerSnapshotOpen(tls *libc.TLS, pPager uintptr, pSnapshot uintptr) int32 { /* sqlite3.c:60277:20: */ + var rc int32 = SQLITE_OK + if (*Pager)(unsafe.Pointer(pPager)).FpWal != 0 { + Xsqlite3WalSnapshotOpen(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, pSnapshot) + } else { + rc = SQLITE_ERROR + } + return rc +} + +// If this is a WAL database, call sqlite3WalSnapshotRecover(). If this +// is not a WAL database, return an error. +func Xsqlite3PagerSnapshotRecover(tls *libc.TLS, pPager uintptr) int32 { /* sqlite3.c:60294:20: */ + var rc int32 + if (*Pager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = Xsqlite3WalSnapshotRecover(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) + } else { + rc = SQLITE_ERROR + } + return rc +} + +// The caller currently has a read transaction open on the database. +// If this is not a WAL database, SQLITE_ERROR is returned. Otherwise, +// this function takes a SHARED lock on the CHECKPOINTER slot and then +// checks if the snapshot passed as the second argument is still +// available. If so, SQLITE_OK is returned. +// +// If the snapshot is not available, SQLITE_ERROR is returned. Or, if +// the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error +// occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER +// lock is released before returning. +func Xsqlite3PagerSnapshotCheck(tls *libc.TLS, pPager uintptr, pSnapshot uintptr) int32 { /* sqlite3.c:60316:20: */ + var rc int32 + if (*Pager)(unsafe.Pointer(pPager)).FpWal != 0 { + rc = Xsqlite3WalSnapshotCheck(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal, pSnapshot) + } else { + rc = SQLITE_ERROR + } + return rc +} + +// Release a lock obtained by an earlier successful call to +// sqlite3PagerSnapshotCheck(). +func Xsqlite3PagerSnapshotUnlock(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:60330:21: */ + + Xsqlite3WalSnapshotUnlock(tls, (*Pager)(unsafe.Pointer(pPager)).FpWal) +} + +//************* End of pager.c ********************************************** +//************* Begin file wal.c ******************************************** +// 2010 February 1 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains the implementation of a write-ahead log (WAL) used in +// "journal_mode=WAL" mode. +// +// WRITE-AHEAD LOG (WAL) FILE FORMAT +// +// A WAL file consists of a header followed by zero or more "frames". +// Each frame records the revised content of a single page from the +// database file. All changes to the database are recorded by writing +// frames into the WAL. Transactions commit when a frame is written that +// contains a commit marker. A single WAL can and usually does record +// multiple transactions. Periodically, the content of the WAL is +// transferred back into the database file in an operation called a +// "checkpoint". +// +// A single WAL file can be used multiple times. In other words, the +// WAL can fill up with frames and then be checkpointed and then new +// frames can overwrite the old ones. A WAL always grows from beginning +// toward the end. Checksums and counters attached to each frame are +// used to determine which frames within the WAL are valid and which +// are leftovers from prior checkpoints. +// +// The WAL header is 32 bytes in size and consists of the following eight +// big-endian 32-bit unsigned integer values: +// +// 0: Magic number. 0x377f0682 or 0x377f0683 +// 4: File format version. Currently 3007000 +// 8: Database page size. Example: 1024 +// 12: Checkpoint sequence number +// 16: Salt-1, random integer incremented with each checkpoint +// 20: Salt-2, a different random integer changing with each ckpt +// 24: Checksum-1 (first part of checksum for first 24 bytes of header). +// 28: Checksum-2 (second part of checksum for first 24 bytes of header). +// +// Immediately following the wal-header are zero or more frames. Each +// frame consists of a 24-byte frame-header followed by a bytes +// of page data. The frame-header is six big-endian 32-bit unsigned +// integer values, as follows: +// +// 0: Page number. +// 4: For commit records, the size of the database image in pages +// after the commit. For all other records, zero. +// 8: Salt-1 (copied from the header) +// 12: Salt-2 (copied from the header) +// 16: Checksum-1. +// 20: Checksum-2. +// +// A frame is considered valid if and only if the following conditions are +// true: +// +// (1) The salt-1 and salt-2 values in the frame-header match +// salt values in the wal-header +// +// (2) The checksum values in the final 8 bytes of the frame-header +// exactly match the checksum computed consecutively on the +// WAL header and the first 8 bytes and the content of all frames +// up to and including the current frame. +// +// The checksum is computed using 32-bit big-endian integers if the +// magic number in the first 4 bytes of the WAL is 0x377f0683 and it +// is computed using little-endian if the magic number is 0x377f0682. +// The checksum values are always stored in the frame header in a +// big-endian format regardless of which byte order is used to compute +// the checksum. The checksum is computed by interpreting the input as +// an even number of unsigned 32-bit integers: x[0] through x[N]. The +// algorithm used for the checksum is as follows: +// +// for i from 0 to n-1 step 2: +// s0 += x[i] + s1; +// s1 += x[i+1] + s0; +// endfor +// +// Note that s0 and s1 are both weighted checksums using fibonacci weights +// in reverse order (the largest fibonacci weight occurs on the first element +// of the sequence being summed.) The s1 value spans all 32-bit +// terms of the sequence whereas s0 omits the final term. +// +// On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the +// WAL is transferred into the database, then the database is VFS.xSync-ed. +// The VFS.xSync operations serve as write barriers - all writes launched +// before the xSync must complete before any write that launches after the +// xSync begins. +// +// After each checkpoint, the salt-1 value is incremented and the salt-2 +// value is randomized. This prevents old and new frames in the WAL from +// being considered valid at the same time and being checkpointing together +// following a crash. +// +// READER ALGORITHM +// +// To read a page from the database (call it page number P), a reader +// first checks the WAL to see if it contains page P. If so, then the +// last valid instance of page P that is a followed by a commit frame +// or is a commit frame itself becomes the value read. If the WAL +// contains no copies of page P that are valid and which are a commit +// frame or are followed by a commit frame, then page P is read from +// the database file. +// +// To start a read transaction, the reader records the index of the last +// valid frame in the WAL. The reader uses this recorded "mxFrame" value +// for all subsequent read operations. New transactions can be appended +// to the WAL, but as long as the reader uses its original mxFrame value +// and ignores the newly appended content, it will see a consistent snapshot +// of the database from a single point in time. This technique allows +// multiple concurrent readers to view different versions of the database +// content simultaneously. +// +// The reader algorithm in the previous paragraphs works correctly, but +// because frames for page P can appear anywhere within the WAL, the +// reader has to scan the entire WAL looking for page P frames. If the +// WAL is large (multiple megabytes is typical) that scan can be slow, +// and read performance suffers. To overcome this problem, a separate +// data structure called the wal-index is maintained to expedite the +// search for frames of a particular page. +// +// WAL-INDEX FORMAT +// +// Conceptually, the wal-index is shared memory, though VFS implementations +// might choose to implement the wal-index using a mmapped file. Because +// the wal-index is shared memory, SQLite does not support journal_mode=WAL +// on a network filesystem. All users of the database must be able to +// share memory. +// +// In the default unix and windows implementation, the wal-index is a mmapped +// file whose name is the database name with a "-shm" suffix added. For that +// reason, the wal-index is sometimes called the "shm" file. +// +// The wal-index is transient. After a crash, the wal-index can (and should +// be) reconstructed from the original WAL file. In fact, the VFS is required +// to either truncate or zero the header of the wal-index when the last +// connection to it closes. Because the wal-index is transient, it can +// use an architecture-specific format; it does not have to be cross-platform. +// Hence, unlike the database and WAL file formats which store all values +// as big endian, the wal-index can store multi-byte values in the native +// byte order of the host computer. +// +// The purpose of the wal-index is to answer this question quickly: Given +// a page number P and a maximum frame index M, return the index of the +// last frame in the wal before frame M for page P in the WAL, or return +// NULL if there are no frames for page P in the WAL prior to M. +// +// The wal-index consists of a header region, followed by an one or +// more index blocks. +// +// The wal-index header contains the total number of frames within the WAL +// in the mxFrame field. +// +// Each index block except for the first contains information on +// HASHTABLE_NPAGE frames. The first index block contains information on +// HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and +// HASHTABLE_NPAGE are selected so that together the wal-index header and +// first index block are the same size as all other index blocks in the +// wal-index. +// +// Each index block contains two sections, a page-mapping that contains the +// database page number associated with each wal frame, and a hash-table +// that allows readers to query an index block for a specific page number. +// The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE +// for the first index block) 32-bit page numbers. The first entry in the +// first index-block contains the database page number corresponding to the +// first frame in the WAL file. The first entry in the second index block +// in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in +// the log, and so on. +// +// The last index block in a wal-index usually contains less than the full +// complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers, +// depending on the contents of the WAL file. This does not change the +// allocated size of the page-mapping array - the page-mapping array merely +// contains unused entries. +// +// Even without using the hash table, the last frame for page P +// can be found by scanning the page-mapping sections of each index block +// starting with the last index block and moving toward the first, and +// within each index block, starting at the end and moving toward the +// beginning. The first entry that equals P corresponds to the frame +// holding the content for that page. +// +// The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers. +// HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the +// hash table for each page number in the mapping section, so the hash +// table is never more than half full. The expected number of collisions +// prior to finding a match is 1. Each entry of the hash table is an +// 1-based index of an entry in the mapping section of the same +// index block. Let K be the 1-based index of the largest entry in +// the mapping section. (For index blocks other than the last, K will +// always be exactly HASHTABLE_NPAGE (4096) and for the last index block +// K will be (mxFrame%HASHTABLE_NPAGE).) Unused slots of the hash table +// contain a value of 0. +// +// To look for page P in the hash table, first compute a hash iKey on +// P as follows: +// +// iKey = (P * 383) % HASHTABLE_NSLOT +// +// Then start scanning entries of the hash table, starting with iKey +// (wrapping around to the beginning when the end of the hash table is +// reached) until an unused hash slot is found. Let the first unused slot +// be at index iUnused. (iUnused might be less than iKey if there was +// wrap-around.) Because the hash table is never more than half full, +// the search is guaranteed to eventually hit an unused entry. Let +// iMax be the value between iKey and iUnused, closest to iUnused, +// where aHash[iMax]==P. If there is no iMax entry (if there exists +// no hash slot such that aHash[i]==p) then page P is not in the +// current index block. Otherwise the iMax-th mapping entry of the +// current index block corresponds to the last entry that references +// page P. +// +// A hash search begins with the last index block and moves toward the +// first index block, looking for entries corresponding to page P. On +// average, only two or three slots in each index block need to be +// examined in order to either find the last entry for page P, or to +// establish that no such entry exists in the block. Each index block +// holds over 4000 entries. So two or three index blocks are sufficient +// to cover a typical 10 megabyte WAL file, assuming 1K pages. 8 or 10 +// comparisons (on average) suffice to either locate a frame in the +// WAL or to establish that the frame does not exist in the WAL. This +// is much faster than scanning the entire 10MB WAL. +// +// Note that entries are added in order of increasing K. Hence, one +// reader might be using some value K0 and a second reader that started +// at a later time (after additional transactions were added to the WAL +// and to the wal-index) might be using a different value K1, where K1>K0. +// Both readers can use the same hash table and mapping section to get +// the correct result. There may be entries in the hash table with +// K>K0 but to the first reader, those entries will appear to be unused +// slots in the hash table and so the first reader will get an answer as +// if no values greater than K0 had ever been inserted into the hash table +// in the first place - which is what reader one wants. Meanwhile, the +// second reader using K1 will see additional values that were inserted +// later, which is exactly what reader two wants. +// +// When a rollback occurs, the value of K is decreased. Hash table entries +// that correspond to frames greater than the new K value are removed +// from the hash table at this point. + +// #include "wal.h" + +// Trace output macros + +// The maximum (and only) versions of the wal and wal-index formats +// that may be interpreted by this version of SQLite. +// +// If a client begins recovering a WAL file and finds that (a) the checksum +// values in the wal-header are correct and (b) the version field is not +// WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN. +// +// Similarly, if a client successfully reads a wal-index header (i.e. the +// checksum test is successful) and finds that the version field is not +// WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite +// returns SQLITE_CANTOPEN. + +// Index numbers for various locking bytes. WAL_NREADER is the number +// of available reader locks and should be at least 3. The default +// is SQLITE_SHM_NLOCK==8 and WAL_NREADER==5. +// +// Technically, the various VFSes are free to implement these locks however +// they see fit. However, compatibility is encouraged so that VFSes can +// interoperate. The standard implemention used on both unix and windows +// is for the index number to indicate a byte offset into the +// WalCkptInfo.aLock[] array in the wal-index header. In other words, all +// locks are on the shm file. The WALINDEX_LOCK_OFFSET constant (which +// should be 120) is the location in the shm file for the first locking +// byte. + +// Object declarations +type WalIndexHdr1 = struct { + FiVersion U32 + Funused U32 + FiChange U32 + FisInit U8 + FbigEndCksum U8 + FszPage U16 + FmxFrame U32 + FnPage U32 + FaFrameCksum [2]U32 + FaSalt [2]U32 + FaCksum [2]U32 +} /* sqlite3.c:1331:9 */ + +//************* End of pager.c ********************************************** +//************* Begin file wal.c ******************************************** +// 2010 February 1 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains the implementation of a write-ahead log (WAL) used in +// "journal_mode=WAL" mode. +// +// WRITE-AHEAD LOG (WAL) FILE FORMAT +// +// A WAL file consists of a header followed by zero or more "frames". +// Each frame records the revised content of a single page from the +// database file. All changes to the database are recorded by writing +// frames into the WAL. Transactions commit when a frame is written that +// contains a commit marker. A single WAL can and usually does record +// multiple transactions. Periodically, the content of the WAL is +// transferred back into the database file in an operation called a +// "checkpoint". +// +// A single WAL file can be used multiple times. In other words, the +// WAL can fill up with frames and then be checkpointed and then new +// frames can overwrite the old ones. A WAL always grows from beginning +// toward the end. Checksums and counters attached to each frame are +// used to determine which frames within the WAL are valid and which +// are leftovers from prior checkpoints. +// +// The WAL header is 32 bytes in size and consists of the following eight +// big-endian 32-bit unsigned integer values: +// +// 0: Magic number. 0x377f0682 or 0x377f0683 +// 4: File format version. Currently 3007000 +// 8: Database page size. Example: 1024 +// 12: Checkpoint sequence number +// 16: Salt-1, random integer incremented with each checkpoint +// 20: Salt-2, a different random integer changing with each ckpt +// 24: Checksum-1 (first part of checksum for first 24 bytes of header). +// 28: Checksum-2 (second part of checksum for first 24 bytes of header). +// +// Immediately following the wal-header are zero or more frames. Each +// frame consists of a 24-byte frame-header followed by a bytes +// of page data. The frame-header is six big-endian 32-bit unsigned +// integer values, as follows: +// +// 0: Page number. +// 4: For commit records, the size of the database image in pages +// after the commit. For all other records, zero. +// 8: Salt-1 (copied from the header) +// 12: Salt-2 (copied from the header) +// 16: Checksum-1. +// 20: Checksum-2. +// +// A frame is considered valid if and only if the following conditions are +// true: +// +// (1) The salt-1 and salt-2 values in the frame-header match +// salt values in the wal-header +// +// (2) The checksum values in the final 8 bytes of the frame-header +// exactly match the checksum computed consecutively on the +// WAL header and the first 8 bytes and the content of all frames +// up to and including the current frame. +// +// The checksum is computed using 32-bit big-endian integers if the +// magic number in the first 4 bytes of the WAL is 0x377f0683 and it +// is computed using little-endian if the magic number is 0x377f0682. +// The checksum values are always stored in the frame header in a +// big-endian format regardless of which byte order is used to compute +// the checksum. The checksum is computed by interpreting the input as +// an even number of unsigned 32-bit integers: x[0] through x[N]. The +// algorithm used for the checksum is as follows: +// +// for i from 0 to n-1 step 2: +// s0 += x[i] + s1; +// s1 += x[i+1] + s0; +// endfor +// +// Note that s0 and s1 are both weighted checksums using fibonacci weights +// in reverse order (the largest fibonacci weight occurs on the first element +// of the sequence being summed.) The s1 value spans all 32-bit +// terms of the sequence whereas s0 omits the final term. +// +// On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the +// WAL is transferred into the database, then the database is VFS.xSync-ed. +// The VFS.xSync operations serve as write barriers - all writes launched +// before the xSync must complete before any write that launches after the +// xSync begins. +// +// After each checkpoint, the salt-1 value is incremented and the salt-2 +// value is randomized. This prevents old and new frames in the WAL from +// being considered valid at the same time and being checkpointing together +// following a crash. +// +// READER ALGORITHM +// +// To read a page from the database (call it page number P), a reader +// first checks the WAL to see if it contains page P. If so, then the +// last valid instance of page P that is a followed by a commit frame +// or is a commit frame itself becomes the value read. If the WAL +// contains no copies of page P that are valid and which are a commit +// frame or are followed by a commit frame, then page P is read from +// the database file. +// +// To start a read transaction, the reader records the index of the last +// valid frame in the WAL. The reader uses this recorded "mxFrame" value +// for all subsequent read operations. New transactions can be appended +// to the WAL, but as long as the reader uses its original mxFrame value +// and ignores the newly appended content, it will see a consistent snapshot +// of the database from a single point in time. This technique allows +// multiple concurrent readers to view different versions of the database +// content simultaneously. +// +// The reader algorithm in the previous paragraphs works correctly, but +// because frames for page P can appear anywhere within the WAL, the +// reader has to scan the entire WAL looking for page P frames. If the +// WAL is large (multiple megabytes is typical) that scan can be slow, +// and read performance suffers. To overcome this problem, a separate +// data structure called the wal-index is maintained to expedite the +// search for frames of a particular page. +// +// WAL-INDEX FORMAT +// +// Conceptually, the wal-index is shared memory, though VFS implementations +// might choose to implement the wal-index using a mmapped file. Because +// the wal-index is shared memory, SQLite does not support journal_mode=WAL +// on a network filesystem. All users of the database must be able to +// share memory. +// +// In the default unix and windows implementation, the wal-index is a mmapped +// file whose name is the database name with a "-shm" suffix added. For that +// reason, the wal-index is sometimes called the "shm" file. +// +// The wal-index is transient. After a crash, the wal-index can (and should +// be) reconstructed from the original WAL file. In fact, the VFS is required +// to either truncate or zero the header of the wal-index when the last +// connection to it closes. Because the wal-index is transient, it can +// use an architecture-specific format; it does not have to be cross-platform. +// Hence, unlike the database and WAL file formats which store all values +// as big endian, the wal-index can store multi-byte values in the native +// byte order of the host computer. +// +// The purpose of the wal-index is to answer this question quickly: Given +// a page number P and a maximum frame index M, return the index of the +// last frame in the wal before frame M for page P in the WAL, or return +// NULL if there are no frames for page P in the WAL prior to M. +// +// The wal-index consists of a header region, followed by an one or +// more index blocks. +// +// The wal-index header contains the total number of frames within the WAL +// in the mxFrame field. +// +// Each index block except for the first contains information on +// HASHTABLE_NPAGE frames. The first index block contains information on +// HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and +// HASHTABLE_NPAGE are selected so that together the wal-index header and +// first index block are the same size as all other index blocks in the +// wal-index. +// +// Each index block contains two sections, a page-mapping that contains the +// database page number associated with each wal frame, and a hash-table +// that allows readers to query an index block for a specific page number. +// The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE +// for the first index block) 32-bit page numbers. The first entry in the +// first index-block contains the database page number corresponding to the +// first frame in the WAL file. The first entry in the second index block +// in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in +// the log, and so on. +// +// The last index block in a wal-index usually contains less than the full +// complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers, +// depending on the contents of the WAL file. This does not change the +// allocated size of the page-mapping array - the page-mapping array merely +// contains unused entries. +// +// Even without using the hash table, the last frame for page P +// can be found by scanning the page-mapping sections of each index block +// starting with the last index block and moving toward the first, and +// within each index block, starting at the end and moving toward the +// beginning. The first entry that equals P corresponds to the frame +// holding the content for that page. +// +// The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers. +// HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the +// hash table for each page number in the mapping section, so the hash +// table is never more than half full. The expected number of collisions +// prior to finding a match is 1. Each entry of the hash table is an +// 1-based index of an entry in the mapping section of the same +// index block. Let K be the 1-based index of the largest entry in +// the mapping section. (For index blocks other than the last, K will +// always be exactly HASHTABLE_NPAGE (4096) and for the last index block +// K will be (mxFrame%HASHTABLE_NPAGE).) Unused slots of the hash table +// contain a value of 0. +// +// To look for page P in the hash table, first compute a hash iKey on +// P as follows: +// +// iKey = (P * 383) % HASHTABLE_NSLOT +// +// Then start scanning entries of the hash table, starting with iKey +// (wrapping around to the beginning when the end of the hash table is +// reached) until an unused hash slot is found. Let the first unused slot +// be at index iUnused. (iUnused might be less than iKey if there was +// wrap-around.) Because the hash table is never more than half full, +// the search is guaranteed to eventually hit an unused entry. Let +// iMax be the value between iKey and iUnused, closest to iUnused, +// where aHash[iMax]==P. If there is no iMax entry (if there exists +// no hash slot such that aHash[i]==p) then page P is not in the +// current index block. Otherwise the iMax-th mapping entry of the +// current index block corresponds to the last entry that references +// page P. +// +// A hash search begins with the last index block and moves toward the +// first index block, looking for entries corresponding to page P. On +// average, only two or three slots in each index block need to be +// examined in order to either find the last entry for page P, or to +// establish that no such entry exists in the block. Each index block +// holds over 4000 entries. So two or three index blocks are sufficient +// to cover a typical 10 megabyte WAL file, assuming 1K pages. 8 or 10 +// comparisons (on average) suffice to either locate a frame in the +// WAL or to establish that the frame does not exist in the WAL. This +// is much faster than scanning the entire 10MB WAL. +// +// Note that entries are added in order of increasing K. Hence, one +// reader might be using some value K0 and a second reader that started +// at a later time (after additional transactions were added to the WAL +// and to the wal-index) might be using a different value K1, where K1>K0. +// Both readers can use the same hash table and mapping section to get +// the correct result. There may be entries in the hash table with +// K>K0 but to the first reader, those entries will appear to be unused +// slots in the hash table and so the first reader will get an answer as +// if no values greater than K0 had ever been inserted into the hash table +// in the first place - which is what reader one wants. Meanwhile, the +// second reader using K1 will see additional values that were inserted +// later, which is exactly what reader two wants. +// +// When a rollback occurs, the value of K is decreased. Hash table entries +// that correspond to frames greater than the new K value are removed +// from the hash table at this point. + +// #include "wal.h" + +// Trace output macros + +// The maximum (and only) versions of the wal and wal-index formats +// that may be interpreted by this version of SQLite. +// +// If a client begins recovering a WAL file and finds that (a) the checksum +// values in the wal-header are correct and (b) the version field is not +// WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN. +// +// Similarly, if a client successfully reads a wal-index header (i.e. the +// checksum test is successful) and finds that the version field is not +// WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite +// returns SQLITE_CANTOPEN. + +// Index numbers for various locking bytes. WAL_NREADER is the number +// of available reader locks and should be at least 3. The default +// is SQLITE_SHM_NLOCK==8 and WAL_NREADER==5. +// +// Technically, the various VFSes are free to implement these locks however +// they see fit. However, compatibility is encouraged so that VFSes can +// interoperate. The standard implemention used on both unix and windows +// is for the index number to indicate a byte offset into the +// WalCkptInfo.aLock[] array in the wal-index header. In other words, all +// locks are on the shm file. The WALINDEX_LOCK_OFFSET constant (which +// should be 120) is the location in the shm file for the first locking +// byte. + +// Object declarations +type WalIndexHdr = WalIndexHdr1 /* sqlite3.c:60655:28 */ +type WalIterator1 = struct { + FiPrior U32 + FnSegment int32 + FaSegment [1]struct { + FiNext int32 + _ [4]byte + FaIndex uintptr + FaPgno uintptr + FnEntry int32 + FiZero int32 + } +} /* sqlite3.c:60656:9 */ + +type WalIterator = WalIterator1 /* sqlite3.c:60656:28 */ +type WalCkptInfo1 = struct { + FnBackfill U32 + FaReadMark [5]U32 + FaLock [8]U8 + FnBackfillAttempted U32 + FnotUsed0 U32 +} /* sqlite3.c:60657:9 */ + +type WalCkptInfo = WalCkptInfo1 /* sqlite3.c:60657:28 */ + +// Candidate values for Wal.exclusiveMode. + +// Possible values for WAL.readOnly + +// Each page of the wal-index mapping contains a hash-table made up of +// an array of HASHTABLE_NSLOT elements of the following type. +type Ht_slot = U16 /* sqlite3.c:60848:13 */ + +// This structure is used to implement an iterator that loops through +// all frames in the WAL in database page order. Where two or more frames +// correspond to the same database page, the iterator visits only the +// frame most recently written to the WAL (in other words, the frame with +// the largest index). +// +// The internals of this structure are only accessed by: +// +// walIteratorInit() - Create a new iterator, +// walIteratorNext() - Step an iterator, +// walIteratorFree() - Free an iterator. +// +// This functionality is used by the checkpoint code (see walCheckpoint()). +type WalSegment = struct { + FiNext int32 + _ [4]byte + FaIndex uintptr + FaPgno uintptr + FnEntry int32 + FiZero int32 +} /* sqlite3.c:60656:9 */ + +// Define the parameters of the hash tables in the wal-index file. There +// is a hash-table following every HASHTABLE_NPAGE page numbers in the +// wal-index. +// +// Changing any of these constants will alter the wal-index format and +// create incompatibilities. + +// The block of page numbers associated with the first hash-table in a +// wal-index is smaller than usual. This is so that there is a complete +// hash-table on each aligned 32KB page of the wal-index. + +// The wal-index is divided into pages of WALINDEX_PGSZ bytes each. + +// Obtain a pointer to the iPage'th page of the wal-index. The wal-index +// is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are +// numbered from zero. +// +// If the wal-index is currently smaller the iPage pages then the size +// of the wal-index might be increased, but only if it is safe to do +// so. It is safe to enlarge the wal-index if pWal->writeLock is true +// or pWal->exclusiveMode==WAL_HEAPMEMORY_MODE. +// +// If this call is successful, *ppPage is set to point to the wal-index +// page and SQLITE_OK is returned. If an error (an OOM or VFS error) occurs, +// then an SQLite error code is returned and *ppPage is set to 0. +func walIndexPageRealloc(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintptr) int32 { /* sqlite3.c:60915:28: */ + var rc int32 = SQLITE_OK + + // Enlarge the pWal->apWiData[] array if required + if (*Wal)(unsafe.Pointer(pWal)).FnWiData <= iPage { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(iPage + 1)))) + var apNew uintptr + libc.AtomicStoreUintptr(&apNew, uintptr(Xsqlite3Realloc(tls, (*Wal)(unsafe.Pointer(pWal)).FapWiData, uint64(nByte)))) + if !(libc.AtomicLoadUintptr(&apNew) != 0) { + *(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&ppPage))) = uintptr(0) + return SQLITE_NOMEM + } + libc.Xmemset(tls, (libc.AtomicLoadUintptr(&apNew) + uintptr((*Wal)(unsafe.Pointer(pWal)).FnWiData)*8), 0, + (uint64(unsafe.Sizeof(uintptr(0))) * (uint64((iPage + 1) - (*Wal)(unsafe.Pointer(pWal)).FnWiData)))) + (*Wal)(unsafe.Pointer(pWal)).FapWiData = libc.AtomicLoadUintptr(&apNew) + (*Wal)(unsafe.Pointer(pWal)).FnWiData = (iPage + 1) + } + + // Request a pointer to the required page from the VFS + + if int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_HEAPMEMORY_MODE { + *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) = Xsqlite3MallocZero(tls, ((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0)))))) + if !(int32(*(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8))) != 0) { + rc = SQLITE_NOMEM + } + } else { + rc = Xsqlite3OsShmMap(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, iPage, (int32((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0)))))), + int32((*Wal)(unsafe.Pointer(pWal)).FwriteLock), ((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) + + if rc == SQLITE_OK { + if (iPage > 0) && (Xsqlite3FaultSim(tls, 600) != 0) { + rc = SQLITE_NOMEM + } + } else if (rc & 0xff) == SQLITE_READONLY { + *(*U8)(unsafe.Pointer(pWal + 66 /* &.readOnly */)) |= U8((WAL_SHM_RDONLY)) + if rc == SQLITE_READONLY { + rc = SQLITE_OK + } + } + } + + *(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&ppPage))) = *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)) + + return rc +} + +func walIndexPage(tls *libc.TLS, pWal uintptr, iPage int32, ppPage uintptr) int32 { /* sqlite3.c:60962:12: */ + if ((*Wal)(unsafe.Pointer(pWal)).FnWiData <= iPage) || ((libc.AssignPtrUintptr(libc.AtomicLoadUintptr(&ppPage), *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPage)*8)))) == uintptr(0)) { + return walIndexPageRealloc(tls, pWal, iPage, libc.AtomicLoadUintptr(&ppPage)) + } + return SQLITE_OK +} + +// Return a pointer to the WalCkptInfo structure in the wal-index. +func walCkptInfo(tls *libc.TLS, pWal uintptr) uintptr { /* sqlite3.c:60976:29: */ + + return (*(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData)) + 24*4) +} + +// Return a pointer to the WalIndexHdr structure in the wal-index. +func walIndexHdr(tls *libc.TLS, pWal uintptr) uintptr { /* sqlite3.c:60984:29: */ + + return *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData)) +} + +// The argument to this macro must be of type u32. On a little-endian +// architecture, it returns the u32 value that results from interpreting +// the 4 bytes as a big-endian value. On a big-endian architecture, it +// returns the value that would be produced by interpreting the 4 bytes +// of the input value as a little-endian integer. + +// Generate or extend an 8 byte checksum based on the data in +// array aByte[] and the initial values of aIn[0] and aIn[1] (or +// initial values of 0 and 0 if aIn==NULL). +// +// The checksum is written back into aOut[] before returning. +// +// nByte must be a positive multiple of 8. +func walChecksumBytes(tls *libc.TLS, nativeCksum int32, a uintptr, nByte int32, aIn uintptr, aOut uintptr) { /* sqlite3.c:61010:13: */ + var s1 U32 + var s2 U32 + var aData uintptr = a + var aEnd uintptr = (a + uintptr(nByte)) + + if aIn != 0 { + s1 = *(*U32)(unsafe.Pointer(aIn)) + s2 = *(*U32)(unsafe.Pointer(aIn + 1*4)) + } else { + s1 = libc.AssignUint32(&s2, U32(0)) + } + + if nativeCksum != 0 { + for ok := true; ok; ok = (aData < aEnd) { + s1 = s1 + (*(*U32)(unsafe.Pointer(libc.PostIncUintptr(&aData, 4))) + s2) + s2 = s2 + (*(*U32)(unsafe.Pointer(libc.PostIncUintptr(&aData, 4))) + s1) + } + } else { + for ok1 := true; ok1; ok1 = (aData < aEnd) { + s1 = s1 + (((((((*(*U32)(unsafe.Pointer(aData))) & U32(0x000000FF)) << 24) + (((*(*U32)(unsafe.Pointer(aData))) & U32(0x0000FF00)) << 8)) + (((*(*U32)(unsafe.Pointer(aData))) & U32(0x00FF0000)) >> 8)) + (((*(*U32)(unsafe.Pointer(aData))) & 0xFF000000) >> 24)) + s2) + s2 = s2 + (((((((*(*U32)(unsafe.Pointer(aData + 1*4))) & U32(0x000000FF)) << 24) + (((*(*U32)(unsafe.Pointer(aData + 1*4))) & U32(0x0000FF00)) << 8)) + (((*(*U32)(unsafe.Pointer(aData + 1*4))) & U32(0x00FF0000)) >> 8)) + (((*(*U32)(unsafe.Pointer(aData + 1*4))) & 0xFF000000) >> 24)) + s1) + aData += 4 * (uintptr(2)) + } + } + + *(*U32)(unsafe.Pointer(aOut)) = s1 + *(*U32)(unsafe.Pointer(aOut + 1*4)) = s2 +} + +// If there is the possibility of concurrent access to the SHM file +// from multiple threads and/or processes, then do a memory barrier. +func walShmBarrier(tls *libc.TLS, pWal uintptr) { /* sqlite3.c:61053:13: */ + if int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) != WAL_HEAPMEMORY_MODE { + Xsqlite3OsShmBarrier(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd) + } +} + +// Add the SQLITE_NO_TSAN as part of the return-type of a function +// definition as a hint that the function contains constructs that +// might give false-positive TSAN warnings. +// +// See tag-20200519-1. + +// Write the header information in pWal->hdr into the wal-index. +// +// The checksum on pWal->hdr is updated before it is written. +func walIndexWriteHdr(tls *libc.TLS, pWal uintptr) { /* sqlite3.c:61077:28: */ + var aHdr uintptr = walIndexHdr(tls, pWal) + var nCksum int32 = int32((uintptr(0) + 40 /* &.aCksum */)) + + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FisInit = U8(1) + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FiVersion = U32(WALINDEX_MAX_VERSION) + walChecksumBytes(tls, 1, (pWal + 72 /* &.hdr */), nCksum, uintptr(0), pWal+72 /* &.hdr */ +40 /* &.aCksum */) + // Possible TSAN false-positive. See tag-20200519-1 + libc.Xmemcpy(tls, (libc.AtomicLoadUintptr(&aHdr) + 1*48), (pWal + 72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) + walShmBarrier(tls, pWal) + libc.Xmemcpy(tls, (libc.AtomicLoadUintptr(&aHdr)), (pWal + 72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) +} + +// This function encodes a single frame header and writes it to a buffer +// supplied by the caller. A frame-header is made up of a series of +// 4-byte big-endian integers, as follows: +// +// 0: Page number. +// 4: For commit records, the size of the database image in pages +// after the commit. For all other records, zero. +// 8: Salt-1 (copied from the wal-header) +// 12: Salt-2 (copied from the wal-header) +// 16: Checksum-1. +// 20: Checksum-2. +func walEncodeFrame(tls *libc.TLS, pWal uintptr, iPage U32, nTruncate U32, aData uintptr, aFrame uintptr) { /* sqlite3.c:61104:13: */ + var nativeCksum int32 // True for native byte-order checksums + var aCksum uintptr = pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */ + + Xsqlite3Put4byte(tls, (aFrame), iPage) + Xsqlite3Put4byte(tls, (aFrame + 4), nTruncate) + if (*Wal)(unsafe.Pointer(pWal)).FiReCksum == U32(0) { + libc.Xmemcpy(tls, (aFrame + 8), pWal+72 /* &.hdr */ +32 /* &.aSalt */, uint64(8)) + + nativeCksum = (libc.Bool32(int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN)) + walChecksumBytes(tls, nativeCksum, aFrame, 8, aCksum, aCksum) + walChecksumBytes(tls, nativeCksum, aData, int32((*Wal)(unsafe.Pointer(pWal)).FszPage), aCksum, aCksum) + + Xsqlite3Put4byte(tls, (aFrame + 16), *(*U32)(unsafe.Pointer(aCksum))) + Xsqlite3Put4byte(tls, (aFrame + 20), *(*U32)(unsafe.Pointer(aCksum + 1*4))) + } else { + libc.Xmemset(tls, (aFrame + 8), 0, uint64(16)) + } +} + +// Check to see if the frame with header in aFrame[] and content +// in aData[] is valid. If it is a valid frame, fill *piPage and +// *pnTruncate and return true. Return if the frame is not valid. +func walDecodeFrame(tls *libc.TLS, pWal uintptr, piPage uintptr, pnTruncate uintptr, aData uintptr, aFrame uintptr) int32 { /* sqlite3.c:61135:12: */ + var nativeCksum int32 // True for native byte-order checksums + var aCksum uintptr = pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */ + var pgno U32 // Page number of the frame + + // A frame is only valid if the salt values in the frame-header + // match the salt values in the wal-header. + if libc.Xmemcmp(tls, (pWal+72 /* &.hdr */ +32 /* &.aSalt */), (aFrame+8), uint64(8)) != 0 { + return 0 + } + + // A frame is only valid if the page number is creater than zero. + pgno = Xsqlite3Get4byte(tls, (aFrame)) + if pgno == U32(0) { + return 0 + } + + // A frame is only valid if a checksum of the WAL header, + // all prior frams, the first 16 bytes of this frame-header, + // and the frame-data matches the checksum in the last 8 + // bytes of this frame-header. + nativeCksum = (libc.Bool32(int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN)) + walChecksumBytes(tls, nativeCksum, aFrame, 8, aCksum, aCksum) + walChecksumBytes(tls, nativeCksum, aData, int32((*Wal)(unsafe.Pointer(pWal)).FszPage), aCksum, aCksum) + if (*(*U32)(unsafe.Pointer(aCksum)) != Xsqlite3Get4byte(tls, (aFrame+16))) || + (*(*U32)(unsafe.Pointer(aCksum + 1*4)) != Xsqlite3Get4byte(tls, (aFrame+20))) { + // Checksum failed. + return 0 + } + + // If we reach this point, the frame is valid. Return the page number + // and the new database size. + *(*U32)(unsafe.Pointer(piPage)) = pgno + *(*U32)(unsafe.Pointer(pnTruncate)) = Xsqlite3Get4byte(tls, (aFrame + 4)) + return 1 +} + +// Set or release locks on the WAL. Locks are either shared or exclusive. +// A lock cannot be moved directly between shared and exclusive - it must go +// through the unlocked state first. +// +// In locking_mode=EXCLUSIVE, all of these routines become no-ops. +func walLockShared(tls *libc.TLS, pWal uintptr, lockIdx int32) int32 { /* sqlite3.c:61214:12: */ + var rc int32 + if (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return SQLITE_OK + } + rc = Xsqlite3OsShmLock(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, 1, + (SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)) + + return rc +} + +func walUnlockShared(tls *libc.TLS, pWal uintptr, lockIdx int32) { /* sqlite3.c:61224:13: */ + if (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return + } + Xsqlite3OsShmLock(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, 1, + (SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)) + +} + +func walLockExclusive(tls *libc.TLS, pWal uintptr, lockIdx int32, n int32) int32 { /* sqlite3.c:61230:12: */ + var rc int32 + if (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return SQLITE_OK + } + rc = Xsqlite3OsShmLock(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, n, + (SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)) + + return rc +} + +func walUnlockExclusive(tls *libc.TLS, pWal uintptr, lockIdx int32, n int32) { /* sqlite3.c:61240:13: */ + if (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode != 0 { + return + } + Xsqlite3OsShmLock(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, lockIdx, n, + (SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE)) + +} + +// Compute a hash on a page number. The resulting hash value must land +// between 0 and (HASHTABLE_NSLOT-1). The walHashNext() function advances +// the hash to the next value in the event of a collision. +func walHash(tls *libc.TLS, iPage U32) int32 { /* sqlite3.c:61253:12: */ + + return (int32((iPage * U32(HASHTABLE_HASH_1)) & (U32((HASHTABLE_NPAGE * 2) - 1)))) +} + +func walNextHash(tls *libc.TLS, iPriorHash int32) int32 { /* sqlite3.c:61258:12: */ + return ((iPriorHash + 1) & ((HASHTABLE_NPAGE * 2) - 1)) +} + +// An instance of the WalHashLoc object is used to describe the location +// of a page hash table in the wal-index. This becomes the return value +// from walHashGet(). +type WalHashLoc1 = struct { + FaHash uintptr + FaPgno uintptr + FiZero U32 + _ [4]byte +} /* sqlite3.c:61267:9 */ + +// An instance of the WalHashLoc object is used to describe the location +// of a page hash table in the wal-index. This becomes the return value +// from walHashGet(). +type WalHashLoc = WalHashLoc1 /* sqlite3.c:61267:27 */ + +// Return pointers to the hash table and page number array stored on +// page iHash of the wal-index. The wal-index is broken into 32KB pages +// numbered starting from 0. +// +// Set output variable pLoc->aHash to point to the start of the hash table +// in the wal-index file. Set pLoc->iZero to one less than the frame +// number of the first frame indexed by this hash table. If a +// slot in the hash table is set to N, it refers to frame number +// (pLoc->iZero+N) in the log. +// +// Finally, set pLoc->aPgno so that pLoc->aPgno[1] is the page number of the +// first frame indexed by the hash table, frame (pLoc->iZero+1). +func walHashGet(tls *libc.TLS, pWal uintptr, iHash int32, pLoc uintptr) int32 { /* sqlite3.c:61288:12: */ + var rc int32 // Return code + + rc = walIndexPage(tls, pWal, iHash, (pLoc + 8 /* &.aPgno */)) + + if rc == SQLITE_OK { + (*WalHashLoc)(unsafe.Pointer(pLoc)).FaHash = ((*WalHashLoc)(unsafe.Pointer(pLoc)).FaPgno + 4096*4) + if iHash == 0 { + (*WalHashLoc)(unsafe.Pointer(pLoc)).FaPgno = ((*WalHashLoc)(unsafe.Pointer(pLoc)).FaPgno + 34*4) + (*WalHashLoc)(unsafe.Pointer(pLoc)).FiZero = U32(0) + } else { + (*WalHashLoc)(unsafe.Pointer(pLoc)).FiZero = (U32((uint64(HASHTABLE_NPAGE) - (((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{}))) / uint64(unsafe.Sizeof(U32(0))))) + (uint64((iHash - 1) * HASHTABLE_NPAGE)))) + } + (*WalHashLoc)(unsafe.Pointer(pLoc)).FaPgno = ((*WalHashLoc)(unsafe.Pointer(pLoc)).FaPgno + libc.UintptrFromInt32(-1)*4) + } + return rc +} + +// Return the number of the wal-index page that contains the hash-table +// and page-number array that contain entries corresponding to WAL frame +// iFrame. The wal-index is broken up into 32KB pages. Wal-index pages +// are numbered starting from 0. +func walFramePage(tls *libc.TLS, iFrame U32) int32 { /* sqlite3.c:61317:12: */ + var iHash int32 = (int32((((uint64(iFrame + U32(HASHTABLE_NPAGE))) - (uint64(HASHTABLE_NPAGE) - (((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{}))) / uint64(unsafe.Sizeof(U32(0)))))) - uint64(1)) / uint64(HASHTABLE_NPAGE))) + + return iHash +} + +// Return the page number associated with frame iFrame in this WAL. +func walFramePgno(tls *libc.TLS, pWal uintptr, iFrame U32) U32 { /* sqlite3.c:61332:12: */ + var iHash int32 = walFramePage(tls, iFrame) + if iHash == 0 { + return *(*U32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData)) + uintptr((((((uint64(unsafe.Sizeof(WalIndexHdr{}))*uint64(2))+uint64(unsafe.Sizeof(WalCkptInfo{})))/uint64(unsafe.Sizeof(U32(0))))+uint64(iFrame))-uint64(1)))*4)) + } + return *(*U32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iHash)*8)) + uintptr((((uint64(iFrame-U32(1)))-(uint64(HASHTABLE_NPAGE)-(((uint64(unsafe.Sizeof(WalIndexHdr{}))*uint64(2))+uint64(unsafe.Sizeof(WalCkptInfo{})))/uint64(unsafe.Sizeof(U32(0))))))%uint64(HASHTABLE_NPAGE)))*4)) +} + +// Remove entries from the hash table that point to WAL slots greater +// than pWal->hdr.mxFrame. +// +// This function is called whenever pWal->hdr.mxFrame is decreased due +// to a rollback or savepoint. +// +// At most only the hash table containing pWal->hdr.mxFrame needs to be +// updated. Any later hash tables will be automatically cleared when +// pWal->hdr.mxFrame advances to the point where those hash tables are +// actually needed. +func walCleanupHash(tls *libc.TLS, pWal uintptr) { /* sqlite3.c:61352:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var sLoc WalHashLoc at bp, 24 + // Hash table location + var iLimit int32 = 0 // Zero values greater than this + var nByte int32 // Number of bytes to zero in aPgno[] + var i int32 // Used to iterate through aHash[] + + if (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame == U32(0) { + return + } + + // Obtain pointers to the hash-table and page-number array containing + // the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed + // that the page said hash-table and array reside on is already mapped.(1) + + i = walHashGet(tls, pWal, walFramePage(tls, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame), bp /* &sLoc */) + if i != 0 { + return + } // Defense-in-depth, in case (1) above is wrong + + // Zero all hash-table entries that correspond to frame numbers greater + // than pWal->hdr.mxFrame. + iLimit = (int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame - (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero)) + + for i = 0; i < (HASHTABLE_NPAGE * 2); i++ { + if int32(*(*Ht_slot)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash + uintptr(i)*2))) > iLimit { + *(*Ht_slot)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash + uintptr(i)*2)) = Ht_slot(0) + } + } + + // Zero the entries in the aPgno array that correspond to frames with + // frame numbers greater than pWal->hdr.mxFrame. + nByte = (int32((int64((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash) - int64(((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + uintptr((iLimit+1))*4))) / 1)) + libc.Xmemset(tls, ((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + uintptr((iLimit+1))*4), 0, uint64(nByte)) + +} + +// Set an entry in the wal-index that will map database page number +// pPage into WAL frame iFrame. +func walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame U32, iPage U32) int32 { /* sqlite3.c:61413:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 // Return code + // var sLoc WalHashLoc at bp, 24 + // Wal-index hash table location + + rc = walHashGet(tls, pWal, walFramePage(tls, iFrame), bp /* &sLoc */) + + // Assuming the wal-index file was successfully mapped, populate the + // page number array and hash table entry. + if rc == SQLITE_OK { + var iKey int32 // Hash table key + var idx int32 // Value to write to hash-table slot + var nCollide int32 // Number of hash collisions + + idx = (int32(iFrame - (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero)) + + // If this is the first entry to be added to this hash-table, zero the + // entire hash table and aPgno[] array before proceeding. + if idx == 1 { + var nByte int32 = (int32((int64(((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash + 8192*2)) - + int64(((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + 1*4))) / 1)) + libc.Xmemset(tls, ((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + 1*4), 0, uint64(nByte)) + } + + // If the entry in aPgno[] is already set, then the previous writer + // must have exited unexpectedly in the middle of a transaction (after + // writing one or more dirty pages to the WAL to free up memory). + // Remove the remnants of that writers uncommitted transaction from + // the hash-table before writing any new entries. + if *(*U32)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + uintptr(idx)*4)) != 0 { + walCleanupHash(tls, pWal) + + } + + // Write the aPgno[] array entry and the hash-table slot. + nCollide = idx + for iKey = walHash(tls, iPage); *(*Ht_slot)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash + uintptr(iKey)*2)) != 0; iKey = walNextHash(tls, iKey) { + if (libc.PostDecInt32(&nCollide, 1)) == 0 { + return Xsqlite3CorruptError(tls, 61453) + } + } + *(*U32)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + uintptr(idx)*4)) = iPage + libc.AtomicStoreNUint16(((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash + uintptr(iKey)*2), uint16(Ht_slot(idx)), 0) + + } + + return rc +} + +// Recover the wal-index by reading the write-ahead log file. +// +// This routine first tries to establish an exclusive lock on the +// wal-index to prevent other threads/processes from doing anything +// with the WAL or wal-index while recovery is running. The +// WAL_RECOVER_LOCK is also held so that other threads will know +// that this thread is running recovery. If unable to establish +// the necessary locks, this routine returns SQLITE_BUSY. +func walIndexRecover(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:61503:12: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var rc int32 // Return Code + // var nSize I64 at bp+16, 8 + // Size of log file + // var aFrameCksum [2]U32 at bp+72, 8 + + var iLock int32 + var iOffset I64 + // var pgno U32 at bp+64, 4 + // Database page number for frame + // var nTruncate U32 at bp+68, 4 + + // var aShare uintptr at bp+56, 8 + + var iFrame U32 // Index of last frame read + var iLast U32 + var iFirst U32 + var nHdr U32 + var nHdr32 U32 + // var aBuf [32]U8 at bp+24, 32 + // Buffer to load WAL header into + var aPrivate uintptr // Heap copy of *-shm hash being populated + var aFrame uintptr // Malloc'd buffer to load entire frame + var szFrame int32 // Number of bytes in buffer aFrame[] + var aData uintptr // Pointer to data part of aFrame buffer + var szPage int32 // Page size according to the log + var magic U32 // Magic value read from WAL header + var version U32 // Magic value read from WAL header + var isValid int32 // True if this frame is valid + var iPg U32 // Current 32KB wal-index page + var iLastFrame U32 + var pInfo uintptr + var i int32 + *(*[2]U32)(unsafe.Pointer(bp + 72 /* aFrameCksum */)) = [2]U32{U32(0), U32(0)} // Lock offset to lock for checkpoint + + // Obtain an exclusive lock on all byte in the locking range not already + // locked by the caller. The caller is guaranteed to have locked the + // WAL_WRITE_LOCK byte, and may have also locked the WAL_CKPT_LOCK byte. + // If successful, the same bytes that are locked here are unlocked before + // this function returns. + + iLock = (WAL_ALL_BUT_WRITE + int32((*Wal)(unsafe.Pointer(pWal)).FckptLock)) + rc = walLockExclusive(tls, pWal, iLock, ((3 + (0)) - iLock)) + if !(rc != 0) { + goto __1 + } + return rc +__1: + ; + + libc.Xmemset(tls, (pWal + 72 /* &.hdr */), 0, uint64(unsafe.Sizeof(WalIndexHdr{}))) + + rc = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+16 /* &nSize */) + if !(rc != SQLITE_OK) { + goto __2 + } + goto recovery_error +__2: + ; + + if !(*(*I64)(unsafe.Pointer(bp + 16 /* nSize */)) > int64(WAL_HDRSIZE)) { + goto __3 + } // Buffer to load WAL header into + aPrivate = uintptr(0) // Heap copy of *-shm hash being populated + aFrame = uintptr(0) // Last frame in wal, based on nSize alone + + // Read in the WAL header. + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+24 /* &aBuf[0] */, WAL_HDRSIZE, int64(0)) + if !(rc != SQLITE_OK) { + goto __4 + } + goto recovery_error +__4: + ; + + // If the database page size is not a power of two, or is greater than + // SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid + // data. Similarly, if the 'magic' value is invalid, ignore the whole + // WAL file. + magic = Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */)) + szPage = int32(Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */ + 8))) + if !(((((magic & 0xFFFFFFFE) != U32(WAL_MAGIC)) || + ((szPage & (szPage - 1)) != 0)) || + (szPage > SQLITE_MAX_PAGE_SIZE)) || + (szPage < 512)) { + goto __5 + } + goto finished +__5: + ; + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum = (U8(magic & U32(0x00000001))) + (*Wal)(unsafe.Pointer(pWal)).FszPage = U32(szPage) + (*Wal)(unsafe.Pointer(pWal)).FnCkpt = Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */ + 12)) + libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */ + 32 /* &.aSalt */), (bp + 24 /* &aBuf */ + 16), uint64(8)) + + // Verify that the WAL header checksum is correct + walChecksumBytes(tls, (libc.Bool32(int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN)), + bp+24 /* &aBuf[0] */, (WAL_HDRSIZE - (2 * 4)), uintptr(0), pWal+72 /* &.hdr */ +24 /* &.aFrameCksum */) + if !((*(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) != Xsqlite3Get4byte(tls, (bp+24 /* &aBuf */ +24))) || + (*(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) != Xsqlite3Get4byte(tls, (bp+24 /* &aBuf */ +28)))) { + goto __6 + } + goto finished +__6: + ; + + // Verify that the version number on the WAL format is one that + // are able to understand + version = Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */ + 4)) + if !(version != U32(WAL_MAX_VERSION)) { + goto __7 + } + rc = Xsqlite3CantopenError(tls, 61586) + goto finished +__7: + ; + + // Malloc a buffer to read frames into. + szFrame = (szPage + WAL_FRAME_HDRSIZE) + aFrame = Xsqlite3_malloc64(tls, (uint64(uint64(szFrame) + ((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0)))))))) + if !(!(aFrame != 0)) { + goto __8 + } + rc = SQLITE_NOMEM + goto recovery_error +__8: + ; + aData = (aFrame + 24) + aPrivate = (aData + uintptr(szPage)) + + // Read all frames from the log file. + iLastFrame = (U32((*(*I64)(unsafe.Pointer(bp + 16 /* nSize */)) - int64(WAL_HDRSIZE)) / I64(szFrame))) + iPg = U32(0) +__9: + if !(iPg <= U32(walFramePage(tls, iLastFrame))) { + goto __11 + } // Index of last frame read + iLast = func() uint32 { + if (uint64(iLastFrame)) < ((uint64(HASHTABLE_NPAGE) - (((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{}))) / uint64(unsafe.Sizeof(U32(0))))) + (uint64(iPg * U32(HASHTABLE_NPAGE)))) { + return iLastFrame + } + return (uint32((uint64(HASHTABLE_NPAGE) - (((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{}))) / uint64(unsafe.Sizeof(U32(0))))) + (uint64(iPg * U32(HASHTABLE_NPAGE))))) + }() + iFirst = (U32(uint64(1) + (func() uint64 { + if iPg == U32(0) { + return uint64(0) + } + return ((uint64(HASHTABLE_NPAGE) - (((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{}))) / uint64(unsafe.Sizeof(U32(0))))) + (uint64((iPg - U32(1)) * U32(HASHTABLE_NPAGE)))) + }()))) + rc = walIndexPage(tls, pWal, int32(iPg), bp+56 /* &aShare */) + if !(rc != 0) { + goto __12 + } + goto __11 +__12: + ; + *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = aPrivate + + iFrame = iFirst +__13: + if !(iFrame <= iLast) { + goto __15 + } + iOffset = (int64(WAL_HDRSIZE) + ((I64((iFrame) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) // dbsize field from frame header + + // Read and decode the next log frame. + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, aFrame, szFrame, iOffset) + if !(rc != SQLITE_OK) { + goto __16 + } + goto __15 +__16: + ; + isValid = walDecodeFrame(tls, pWal, bp+64 /* &pgno */, bp+68 /* &nTruncate */, aData, aFrame) + if !(!(isValid != 0)) { + goto __17 + } + goto __15 +__17: + ; + rc = walIndexAppend(tls, pWal, iFrame, *(*U32)(unsafe.Pointer(bp + 64 /* pgno */))) + if !(rc != SQLITE_OK) { + goto __18 + } + goto __15 +__18: + ; + + // If nTruncate is non-zero, this is a commit record. + if !(*(*U32)(unsafe.Pointer(bp + 68 /* nTruncate */)) != 0) { + goto __19 + } + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = iFrame + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage = *(*U32)(unsafe.Pointer(bp + 68 /* nTruncate */)) + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage = (U16((szPage & 0xff00) | (szPage >> 16))) + + *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) + *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */ + 1*4)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) +__19: + ; + goto __14 +__14: + iFrame++ + goto __13 + goto __15 +__15: + ; + *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 56 /* aShare */)) + nHdr = func() uint32 { + if iPg == U32(0) { + return (uint32((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{})))) + } + return uint32(0) + }() + nHdr32 = (U32(uint64(nHdr) / uint64(unsafe.Sizeof(U32(0))))) + // Memcpy() should work fine here, on all reasonable implementations. + // Technically, memcpy() might change the destination to some + // intermediate value before setting to the final value, and that might + // cause a concurrent reader to malfunction. Memcpy() is allowed to + // do that, according to the spec, but no memcpy() implementation that + // we know of actually does that, which is why we say that memcpy() + // is safe for this. Memcpy() is certainly a lot faster. + libc.Xmemcpy(tls, (*(*uintptr)(unsafe.Pointer(bp + 56 /* aShare */)) + uintptr(nHdr32)*4), (aPrivate + uintptr(nHdr32)*4), (((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0))))) - uint64(nHdr))) + if !(iFrame <= iLast) { + goto __20 + } + goto __11 +__20: + ; + goto __10 +__10: + iPg++ + goto __9 + goto __11 +__11: + ; + + Xsqlite3_free(tls, aFrame) +__3: + ; + +finished: + if !(rc == SQLITE_OK) { + goto __21 + } + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */ + 1*4)) + walIndexWriteHdr(tls, pWal) + + // Reset the checkpoint-header. This is safe because this thread is + // currently holding locks that exclude all other writers and + // checkpointers. Then set the values of read-mark slots 1 through N. + libc.AtomicStoreUintptr(&pInfo, uintptr(walCkptInfo(tls, pWal))) + (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill = U32(0) + (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + *(*U32)(unsafe.Pointer((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */))) = U32(0) + i = 1 +__22: + if !(i < (SQLITE_SHM_NLOCK - 3)) { + goto __24 + } + rc = walLockExclusive(tls, pWal, (3 + (i)), 1) + if !(rc == SQLITE_OK) { + goto __25 + } + if !((i == 1) && ((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0)) { + goto __27 + } + *(*U32)(unsafe.Pointer((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4)) = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + goto __28 +__27: + *(*U32)(unsafe.Pointer((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4)) = READMARK_NOT_USED +__28: + ; + walUnlockExclusive(tls, pWal, (3 + (i)), 1) + goto __26 +__25: + if !(rc != SQLITE_BUSY) { + goto __29 + } + goto recovery_error +__29: + ; +__26: + ; + goto __23 +__23: + i++ + goto __22 + goto __24 +__24: + ; + + // If more than one frame was recovered from the log file, report an + // event via sqlite3_log(). This is to help with identifying performance + // problems caused by applications routinely shutting down without + // checkpointing the log file. + if !((*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage != 0) { + goto __30 + } + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), + ts+3080, /* "recovered %d fra..." */ + libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) +__30: + ; +__21: + ; + +recovery_error: + ; + walUnlockExclusive(tls, pWal, iLock, ((3 + (0)) - iLock)) + return rc +} + +// Close an open wal-index. +func walIndexClose(tls *libc.TLS, pWal uintptr, isDelete int32) { /* sqlite3.c:61725:13: */ + if (int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_HEAPMEMORY_MODE) || ((*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable != 0) { + var i int32 + for i = 0; i < (*Wal)(unsafe.Pointer(pWal)).FnWiData; i++ { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(i)*8)) = uintptr(0) + } + } + if int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) != WAL_HEAPMEMORY_MODE { + Xsqlite3OsShmUnmap(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, isDelete) + } +} + +// Open a connection to the WAL file zWalName. The database file must +// already be opened on connection pDbFd. The buffer that zWalName points +// to must remain valid for the lifetime of the returned Wal* handle. +// +// A SHARED lock should be held on the database file when this function +// is called. The purpose of this SHARED lock is to prevent any other +// client from unlinking the WAL or wal-index file. If another process +// were to do this just after this client opened one of these files, the +// system would be badly broken. +// +// If the log file is successfully opened, SQLITE_OK is returned and +// *ppWal is set to point to a new WAL handle. If an error occurs, +// an SQLite error code is returned and *ppWal is left unmodified. +func Xsqlite3WalOpen(tls *libc.TLS, pVfs uintptr, pDbFd uintptr, zWalName uintptr, bNoShm int32, mxWalSize I64, ppWal uintptr) int32 { /* sqlite3.c:61753:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 // Return Code + var pRet uintptr // Object to allocate and return + // var flags int32 at bp, 4 + // Flags passed to OsOpen() + + // In the amalgamation, the os_unix.c and os_win.c source files come before + // this source file. Verify that the #defines of the locking byte offsets + // in os_unix.c and os_win.c agree with the WALINDEX_LOCK_OFFSET value. + // For that matter, if the lock offset ever changes from its initial design + // value of 120, we need to know that so there is an assert() to check it. + + // Allocate an instance of struct Wal to return. + *(*uintptr)(unsafe.Pointer(ppWal)) = uintptr(0) + pRet = Xsqlite3MallocZero(tls, (uint64(uint64(unsafe.Sizeof(Wal{})) + uint64((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile)))) + if !(pRet != 0) { + return SQLITE_NOMEM + } + + (*Wal)(unsafe.Pointer(pRet)).FpVfs = pVfs + (*Wal)(unsafe.Pointer(pRet)).FpWalFd = (pRet + 1*152) + (*Wal)(unsafe.Pointer(pRet)).FpDbFd = pDbFd + (*Wal)(unsafe.Pointer(pRet)).FreadLock = int16(-1) + (*Wal)(unsafe.Pointer(pRet)).FmxWalSize = mxWalSize + (*Wal)(unsafe.Pointer(pRet)).FzWalName = zWalName + (*Wal)(unsafe.Pointer(pRet)).FsyncHeader = U8(1) + (*Wal)(unsafe.Pointer(pRet)).FpadToSectorBoundary = U8(1) + (*Wal)(unsafe.Pointer(pRet)).FexclusiveMode = func() uint8 { + if bNoShm != 0 { + return uint8(WAL_HEAPMEMORY_MODE) + } + return uint8(WAL_NORMAL_MODE) + }() + + // Open file handle on the write-ahead log file. + *(*int32)(unsafe.Pointer(bp /* flags */)) = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_WAL) + rc = Xsqlite3OsOpen(tls, pVfs, zWalName, (*Wal)(unsafe.Pointer(pRet)).FpWalFd, *(*int32)(unsafe.Pointer(bp /* flags */)), bp /* &flags */) + if (rc == SQLITE_OK) && ((*(*int32)(unsafe.Pointer(bp /* flags */)) & SQLITE_OPEN_READONLY) != 0) { + (*Wal)(unsafe.Pointer(pRet)).FreadOnly = U8(WAL_RDONLY) + } + + if rc != SQLITE_OK { + walIndexClose(tls, pRet, 0) + Xsqlite3OsClose(tls, (*Wal)(unsafe.Pointer(pRet)).FpWalFd) + Xsqlite3_free(tls, pRet) + } else { + var iDC int32 = Xsqlite3OsDeviceCharacteristics(tls, pDbFd) + if (iDC & SQLITE_IOCAP_SEQUENTIAL) != 0 { + (*Wal)(unsafe.Pointer(pRet)).FsyncHeader = U8(0) + } + if (iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE) != 0 { + (*Wal)(unsafe.Pointer(pRet)).FpadToSectorBoundary = U8(0) + } + *(*uintptr)(unsafe.Pointer(ppWal)) = pRet + + } + return rc +} + +// Change the size to which the WAL file is trucated on each reset. +func Xsqlite3WalLimit(tls *libc.TLS, pWal uintptr, iLimit I64) { /* sqlite3.c:61827:21: */ + if pWal != 0 { + (*Wal)(unsafe.Pointer(pWal)).FmxWalSize = iLimit + } +} + +// Find the smallest page number out of all pages held in the WAL that +// has not been returned by any prior invocation of this method on the +// same WalIterator object. Write into *piFrame the frame index where +// that page was last written into the WAL. Write into *piPage the page +// number. +// +// Return 0 on success. If there are no pages in the WAL with a page +// number larger than *piPage, then return 1. +func walIteratorNext(tls *libc.TLS, p uintptr, piPage uintptr, piFrame uintptr) int32 { /* sqlite3.c:61841:12: */ + var iMin U32 // Result pgno must be greater than iMin + var iRet U32 = 0xFFFFFFFF // 0xffffffff is never a valid page number + var i int32 // For looping through segments + + iMin = (*WalIterator)(unsafe.Pointer(p)).FiPrior + + for i = ((*WalIterator)(unsafe.Pointer(p)).FnSegment - 1); i >= 0; i-- { + var pSegment uintptr = ((p + 8 /* &.aSegment */) + uintptr(i)*32) + for (*WalSegment)(unsafe.Pointer(pSegment)).FiNext < (*WalSegment)(unsafe.Pointer(pSegment)).FnEntry { + var iPg U32 = *(*U32)(unsafe.Pointer((*WalSegment)(unsafe.Pointer(pSegment)).FaPgno + uintptr(*(*Ht_slot)(unsafe.Pointer((*WalSegment)(unsafe.Pointer(pSegment)).FaIndex + uintptr((*WalSegment)(unsafe.Pointer(pSegment)).FiNext)*2)))*4)) + if iPg > iMin { + if iPg < iRet { + iRet = iPg + *(*U32)(unsafe.Pointer(piFrame)) = (U32((*WalSegment)(unsafe.Pointer(pSegment)).FiZero + int32(*(*Ht_slot)(unsafe.Pointer((*WalSegment)(unsafe.Pointer(pSegment)).FaIndex + uintptr((*WalSegment)(unsafe.Pointer(pSegment)).FiNext)*2))))) + } + break + } + (*WalSegment)(unsafe.Pointer(pSegment)).FiNext++ + } + } + + *(*U32)(unsafe.Pointer(piPage)) = libc.AssignPtrUint32(p /* &.iPrior */, iRet) + return (libc.Bool32(iRet == 0xFFFFFFFF)) +} + +// This function merges two sorted lists into a single sorted list. +// +// aLeft[] and aRight[] are arrays of indices. The sort key is +// aContent[aLeft[]] and aContent[aRight[]]. Upon entry, the following +// is guaranteed for all J= nRight) || (*(*U32)(unsafe.Pointer(aContent + uintptr(*(*Ht_slot)(unsafe.Pointer(aLeft + uintptr(iLeft)*2)))*4)) < *(*U32)(unsafe.Pointer(aContent + uintptr(*(*Ht_slot)(unsafe.Pointer(aRight + uintptr(iRight)*2)))*4)))) { + logpage = *(*Ht_slot)(unsafe.Pointer(aLeft + uintptr(libc.PostIncInt32(&iLeft, 1))*2)) + } else { + logpage = *(*Ht_slot)(unsafe.Pointer(aRight + uintptr(libc.PostIncInt32(&iRight, 1))*2)) + } + dbpage = *(*U32)(unsafe.Pointer(aContent + uintptr(logpage)*4)) + + *(*Ht_slot)(unsafe.Pointer(aTmp + uintptr(libc.PostIncInt32(&iOut, 1))*2)) = logpage + if (iLeft < nLeft) && (*(*U32)(unsafe.Pointer(aContent + uintptr(*(*Ht_slot)(unsafe.Pointer(aLeft + uintptr(iLeft)*2)))*4)) == dbpage) { + iLeft++ + } + + } + + *(*uintptr)(unsafe.Pointer(paRight)) = aLeft + *(*int32)(unsafe.Pointer(pnRight)) = iOut + libc.Xmemcpy(tls, aLeft, aTmp, (uint64(unsafe.Sizeof(Ht_slot(0))) * uint64(iOut))) +} + +// Sort the elements in list aList using aContent[] as the sort key. +// Remove elements with duplicate keys, preferring to keep the +// larger aList[] values. +// +// The aList[] entries are indices into aContent[]. The values in +// aList[] are to be sorted so that for all J0). + + iLast = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + + // Allocate space for the WalIterator object. + nSegment = (walFramePage(tls, iLast) + 1) + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(WalIterator{})) + + ((uint64(nSegment - 1)) * uint64(unsafe.Sizeof(WalSegment{})))) + + (uint64(iLast) * uint64(unsafe.Sizeof(Ht_slot(0)))))) + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(p != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, p, 0, uint64(nByte)) + (*WalIterator)(unsafe.Pointer(p)).FnSegment = nSegment + + // Allocate temporary space used by the merge-sort routine. This block + // of memory will be freed before this function returns. + aTmp = Xsqlite3_malloc64(tls, + (uint64(uint64(unsafe.Sizeof(Ht_slot(0))) * (func() uint64 { + if iLast > U32(HASHTABLE_NPAGE) { + return uint64(HASHTABLE_NPAGE) + } + return uint64(iLast) + }())))) + if !(aTmp != 0) { + rc = SQLITE_NOMEM + } + + for i = walFramePage(tls, (nBackfill + U32(1))); (rc == SQLITE_OK) && (i < nSegment); i++ { + // var sLoc WalHashLoc at bp, 24 + + rc = walHashGet(tls, pWal, i, bp /* &sLoc */) + if rc == SQLITE_OK { + var j int32 // Counter variable + // var nEntry int32 at bp+24, 4 + // Number of entries in this segment + var aIndex uintptr // Sorted index for this segment + + (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno += 4 + if (i + 1) == nSegment { + *(*int32)(unsafe.Pointer(bp + 24 /* nEntry */)) = (int32(iLast - (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero)) + } else { + *(*int32)(unsafe.Pointer(bp + 24 /* nEntry */)) = (int32((int64((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash) - int64((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno)) / 4)) + } + aIndex = (((p + 8 /* &.aSegment */) + uintptr((*WalIterator)(unsafe.Pointer(p)).FnSegment)*32) + uintptr((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero)*2) + (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero++ + + for j = 0; j < *(*int32)(unsafe.Pointer(bp + 24 /* nEntry */)); j++ { + *(*Ht_slot)(unsafe.Pointer(aIndex + uintptr(j)*2)) = Ht_slot(j) + } + walMergesort(tls, (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno, aTmp, aIndex, bp+24 /* &nEntry */) + (*WalSegment)(unsafe.Pointer((p + 8 /* &.aSegment */) + uintptr(i)*32)).FiZero = int32((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero) + (*WalSegment)(unsafe.Pointer((p + 8 /* &.aSegment */) + uintptr(i)*32)).FnEntry = *(*int32)(unsafe.Pointer(bp + 24 /* nEntry */)) + (*WalSegment)(unsafe.Pointer((p + 8 /* &.aSegment */) + uintptr(i)*32)).FaIndex = aIndex + (*WalSegment)(unsafe.Pointer((p + 8 /* &.aSegment */) + uintptr(i)*32)).FaPgno = (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + } + } + Xsqlite3_free(tls, aTmp) + + if rc != SQLITE_OK { + walIteratorFree(tls, p) + p = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and +// n. If the attempt fails and parameter xBusy is not NULL, then it is a +// busy-handler function. Invoke it and retry the lock until either the +// lock is successfully obtained or the busy-handler returns 0. +func walBusyLock(tls *libc.TLS, pWal uintptr, xBusy uintptr, pBusyArg uintptr, lockIdx int32, n int32) int32 { /* sqlite3.c:62195:12: */ + var rc int32 + for ok := true; ok; ok = (((xBusy != 0) && (rc == SQLITE_BUSY)) && ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&xBusy)))(tls, pBusyArg) != 0)) { + rc = walLockExclusive(tls, pWal, lockIdx, n) + } + return rc +} + +// The cache of the wal-index header must be valid to call this function. +// Return the page-size in bytes used by the database. +func walPagesize(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:62219:12: */ + return ((int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage) & 0xfe00) + ((int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage) & 0x0001) << 16)) +} + +// The following is guaranteed when this function is called: +// +// a) the WRITER lock is held, +// b) the entire log file has been checkpointed, and +// c) any existing readers are reading exclusively from the database +// file - there are no readers that may attempt to read a frame from +// the log file. +// +// This function updates the shared-memory structures so that the next +// client to write to the database (which may be this one) does so by +// writing frames into the start of the log file. +// +// The value of parameter salt1 is used as the aSalt[1] value in the +// new wal-index header. It should be passed a pseudo-random value (i.e. +// one obtained from sqlite3_randomness()). +func walRestartHdr(tls *libc.TLS, pWal uintptr, salt1 U32) { /* sqlite3.c:62240:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + *(*U32)(unsafe.Pointer(bp)) = salt1 + + var pInfo uintptr = walCkptInfo(tls, pWal) + var i int32 // Loop counter + var aSalt uintptr = pWal + 72 /* &.hdr */ + 32 /* &.aSalt */ // Big-endian salt values + (*Wal)(unsafe.Pointer(pWal)).FnCkpt++ + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = U32(0) + Xsqlite3Put4byte(tls, (aSalt), (U32(1) + Xsqlite3Get4byte(tls, (aSalt)))) + libc.Xmemcpy(tls, ((pWal + 72 /* &.hdr */ + 32 /* &.aSalt */) + 1*4), bp /* &salt1 */, uint64(4)) + walIndexWriteHdr(tls, pWal) + libc.AtomicStoreNInt32((libc.AtomicLoadUintptr(&pInfo) /* &.nBackfill */), int32(0), 0) + (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted = U32(0) + *(*U32)(unsafe.Pointer((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + 1*4)) = U32(0) + for i = 2; i < (SQLITE_SHM_NLOCK - 3); i++ { + *(*U32)(unsafe.Pointer((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4)) = READMARK_NOT_USED + } + +} + +// Copy as much content as we can from the WAL back into the database file +// in response to an sqlite3_wal_checkpoint() request or the equivalent. +// +// The amount of information copies from WAL to database might be limited +// by active readers. This routine will never overwrite a database page +// that a concurrent reader might be using. +// +// All I/O barrier operations (a.k.a fsyncs) occur in this routine when +// SQLite is in WAL-mode in synchronous=NORMAL. That means that if +// checkpoints are always run by a background thread or background +// process, foreground threads will never block on a lengthy fsync call. +// +// Fsync is called on the WAL before writing content out of the WAL and +// into the database. This ensures that if the new content is persistent +// in the WAL and can be recovered following a power-loss or hard reset. +// +// Fsync is also called on the database file if (and only if) the entire +// WAL content is copied into the database file. This second fsync makes +// it safe to delete the WAL since the new content will persist in the +// database file. +// +// This routine uses and updates the nBackfill field of the wal-index header. +// This is the only routine that will increase the value of nBackfill. +// (A WAL reset or recovery will revert nBackfill to zero, but not increase +// its value.) +// +// The caller must be holding sufficient locks to ensure that no other +// checkpoint is running (in any other thread or process) at the same +// time. +func walCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy uintptr, pBusyArg uintptr, sync_flags int32, zBuf uintptr) int32 { /* sqlite3.c:62287:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + var rc int32 // Return code + var szPage int32 // Database page-size + // var pIter uintptr at bp, 8 + // Wal iterator context + // var iDbpage U32 at bp+24, 4 + // Next database page to write + // var iFrame U32 at bp+28, 4 + // Wal frame containing data for iDbpage + var mxSafeFrame U32 // Max frame that can be backfilled + var mxPage U32 // Max database page to write + var i int32 // Loop counter + var pInfo uintptr + var iMark U32 + var y U32 + // var nReq I64 at bp+16, 8 + + // var nSize I64 at bp+8, 8 + + var iOffset I64 + var szDb I64 + var nBackfill U32 + // var salt1 U32 at bp+32, 4 + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) + *(*U32)(unsafe.Pointer(bp + 24 /* iDbpage */)) = U32(0) + *(*U32)(unsafe.Pointer(bp + 28 /* iFrame */)) = U32(0) // The checkpoint status information + + szPage = walPagesize(tls, pWal) + + libc.AtomicStoreUintptr(&pInfo, uintptr(walCkptInfo(tls, pWal))) + if !((*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill < (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame) { + goto __1 + } + + // EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked + // in the SQLITE_CHECKPOINT_PASSIVE mode. + + // Compute in mxSafeFrame the index of the last frame of the WAL that is + // safe to write into the database. Frames beyond mxSafeFrame might + // overwrite database pages that are in use by active readers and thus + // cannot be backfilled from the WAL. + mxSafeFrame = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + mxPage = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage + i = 1 +__2: + if !(i < (SQLITE_SHM_NLOCK - 3)) { + goto __4 + } + y = U32(libc.AtomicLoadNUint32(((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4), 0)) + if !(mxSafeFrame > y) { + goto __5 + } + + rc = walBusyLock(tls, pWal, xBusy, pBusyArg, (3 + (i)), 1) + if !(rc == SQLITE_OK) { + goto __6 + } + iMark = func() uint32 { + if i == 1 { + return mxSafeFrame + } + return READMARK_NOT_USED + }() + libc.AtomicStoreNUint32(((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4), uint32(iMark), 0) + walUnlockExclusive(tls, pWal, (3 + (i)), 1) + goto __7 +__6: + if !(rc == SQLITE_BUSY) { + goto __8 + } + mxSafeFrame = y + xBusy = uintptr(0) + goto __9 +__8: + goto walcheckpoint_out +__9: + ; +__7: + ; +__5: + ; + goto __3 +__3: + i++ + goto __2 + goto __4 +__4: + ; + + // Allocate the iterator + if !((*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill < mxSafeFrame) { + goto __10 + } + rc = walIteratorInit(tls, pWal, (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill, bp /* &pIter */) + +__10: + ; + + if !((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) != 0) && + ((libc.AssignInt32(&rc, walBusyLock(tls, pWal, xBusy, pBusyArg, (3+(0)), 1))) == SQLITE_OK)) { + goto __11 + } + nBackfill = (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill + + (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted = mxSafeFrame + + // Sync the WAL to disk + rc = Xsqlite3OsSync(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, (((sync_flags) >> 2) & 0x03)) + + // If the database may grow as a result of this checkpoint, hint + // about the eventual size of the db file to the VFS layer. + if !(rc == SQLITE_OK) { + goto __12 + } + *(*I64)(unsafe.Pointer(bp + 16 /* nReq */)) = (I64(mxPage) * I64(szPage)) // Current size of database file + Xsqlite3OsFileControl(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, SQLITE_FCNTL_CKPT_START, uintptr(0)) + rc = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, bp+8 /* &nSize */) + if !((rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 8 /* nSize */)) < *(*I64)(unsafe.Pointer(bp + 16 /* nReq */)))) { + goto __13 + } + if !(((*(*I64)(unsafe.Pointer(bp + 8 /* nSize */)) + int64(65536)) + (I64((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame) * I64(szPage))) < *(*I64)(unsafe.Pointer(bp + 16 /* nReq */))) { + goto __14 + } + // If the size of the final database is larger than the current + // database plus the amount of data in the wal file, plus the + // maximum size of the pending-byte page (65536 bytes), then + // must be corruption somewhere. + rc = Xsqlite3CorruptError(tls, 62371) + goto __15 +__14: + Xsqlite3OsFileControlHint(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, SQLITE_FCNTL_SIZE_HINT, bp+16 /* &nReq */) +__15: + ; +__13: + ; + +__12: + ; + + // Iterate through the contents of the WAL, copying data to the db file +__16: + if !((rc == SQLITE_OK) && (0 == walIteratorNext(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), bp+24 /* &iDbpage */, bp+28 /* &iFrame */))) { + goto __17 + } + + if !(libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0) { + goto __18 + } + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = SQLITE_NOMEM + } else { + rc = SQLITE_INTERRUPT + } + goto __17 +__18: + ; + if !(((*(*U32)(unsafe.Pointer(bp + 28 /* iFrame */)) <= nBackfill) || (*(*U32)(unsafe.Pointer(bp + 28 /* iFrame */)) > mxSafeFrame)) || (*(*U32)(unsafe.Pointer(bp + 24 /* iDbpage */)) > mxPage)) { + goto __19 + } + goto __16 +__19: + ; + iOffset = ((int64(WAL_HDRSIZE) + ((I64((*(*U32)(unsafe.Pointer(bp + 28 /* iFrame */))) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + int64(WAL_FRAME_HDRSIZE)) + // testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, zBuf, szPage, iOffset) + if !(rc != SQLITE_OK) { + goto __20 + } + goto __17 +__20: + ; + iOffset = ((I64(*(*U32)(unsafe.Pointer(bp + 24 /* iDbpage */)) - U32(1))) * I64(szPage)) + + rc = Xsqlite3OsWrite(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, zBuf, szPage, iOffset) + if !(rc != SQLITE_OK) { + goto __21 + } + goto __17 +__21: + ; + goto __16 +__17: + ; + Xsqlite3OsFileControl(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, SQLITE_FCNTL_CKPT_DONE, uintptr(0)) + + // If work was actually accomplished... + if !(rc == SQLITE_OK) { + goto __22 + } + if !(mxSafeFrame == (*WalIndexHdr)(unsafe.Pointer(walIndexHdr(tls, pWal))).FmxFrame) { + goto __23 + } + szDb = (I64((*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage) * I64(szPage)) + + rc = Xsqlite3OsTruncate(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, szDb) + if !(rc == SQLITE_OK) { + goto __24 + } + rc = Xsqlite3OsSync(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, (((sync_flags) >> 2) & 0x03)) +__24: + ; +__23: + ; + if !(rc == SQLITE_OK) { + goto __25 + } + libc.AtomicStoreNUint32((libc.AtomicLoadUintptr(&pInfo) /* &.nBackfill */), uint32(mxSafeFrame), 0) +__25: + ; +__22: + ; + + // Release the reader lock held while backfilling + walUnlockExclusive(tls, pWal, (3 + (0)), 1) +__11: + ; + + if !(rc == SQLITE_BUSY) { + goto __26 + } + // Reset the return code so as not to report a checkpoint failure + // just because there are active readers. + rc = SQLITE_OK +__26: + ; +__1: + ; + + // If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the + // entire wal file has been copied into the database file, then block + // until all readers have finished using the wal file. This ensures that + // the next process to write to the database restarts the wal file. + if !((rc == SQLITE_OK) && (eMode != SQLITE_CHECKPOINT_PASSIVE)) { + goto __27 + } + + if !((*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill < (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame) { + goto __28 + } + rc = SQLITE_BUSY + goto __29 +__28: + if !(eMode >= SQLITE_CHECKPOINT_RESTART) { + goto __30 + } + Xsqlite3_randomness(tls, 4, bp+32 /* &salt1 */) + + rc = walBusyLock(tls, pWal, xBusy, pBusyArg, (3 + (1)), ((SQLITE_SHM_NLOCK - 3) - 1)) + if !(rc == SQLITE_OK) { + goto __31 + } + if !(eMode == SQLITE_CHECKPOINT_TRUNCATE) { + goto __32 + } + // IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as + // SQLITE_CHECKPOINT_RESTART with the addition that it also + // truncates the log file to zero bytes just prior to a + // successful return. + // + // In theory, it might be safe to do this without updating the + // wal-index header in shared memory, as all subsequent reader or + // writer clients should see that the entire log file has been + // checkpointed and behave accordingly. This seems unsafe though, + // as it would leave the system in a state where the contents of + // the wal-index header do not match the contents of the + // file-system. To avoid this, update the wal-index header to + // indicate that the log file contains zero valid frames. + walRestartHdr(tls, pWal, *(*U32)(unsafe.Pointer(bp + 32 /* salt1 */))) + rc = Xsqlite3OsTruncate(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, int64(0)) +__32: + ; + walUnlockExclusive(tls, pWal, (3 + (1)), ((SQLITE_SHM_NLOCK - 3) - 1)) +__31: + ; +__30: + ; +__29: + ; +__27: + ; + +walcheckpoint_out: + walIteratorFree(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// If the WAL file is currently larger than nMax bytes in size, truncate +// it to exactly nMax bytes. If an error occurs while doing so, ignore it. +func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var sz I64 at bp+8, 8 + + var rx int32 + Xsqlite3BeginBenignMalloc(tls) + rx = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+8 /* &sz */) + if (rx == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 8 /* sz */)) > nMax) { + rx = Xsqlite3OsTruncate(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, nMax) + } + Xsqlite3EndBenignMalloc(tls) + if rx != 0 { + Xsqlite3_log(tls, rx, ts+3117 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + } +} + +// Close a connection to a log file. +func Xsqlite3WalClose(tls *libc.TLS, pWal uintptr, db uintptr, sync_flags int32, nBuf int32, zBuf uintptr) int32 { /* sqlite3.c:62490:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + if pWal != 0 { + var isDelete int32 = 0 // True to unlink wal and wal-index files + + // If an EXCLUSIVE lock can be obtained on the database file (using the + // ordinary, rollback-mode locking methods, this guarantees that the + // connection associated with this log file is the only connection to + // the database. In this case checkpoint the database and unlink both + // the wal and wal-index files. + // + // The EXCLUSIVE lock is not released before returning. + if (zBuf != uintptr(0)) && + (SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3OsLock(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, SQLITE_LOCK_EXCLUSIVE)))) { + if int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_NORMAL_MODE { + (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode = U8(WAL_EXCLUSIVE_MODE) + } + rc = Xsqlite3WalCheckpoint(tls, pWal, db, + SQLITE_CHECKPOINT_PASSIVE, uintptr(0), uintptr(0), sync_flags, nBuf, zBuf, uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp /* bPersist */)) = -1 + Xsqlite3OsFileControlHint(tls, + (*Wal)(unsafe.Pointer(pWal)).FpDbFd, SQLITE_FCNTL_PERSIST_WAL, bp /* &bPersist */) + if *(*int32)(unsafe.Pointer(bp /* bPersist */)) != 1 { + // Try to delete the WAL file if the checkpoint completed and + // fsyned (rc==SQLITE_OK) and if we are not in persistent-wal + // mode (!bPersist) + isDelete = 1 + } else if (*Wal)(unsafe.Pointer(pWal)).FmxWalSize >= int64(0) { + // Try to truncate the WAL file to zero bytes if the checkpoint + // completed and fsynced (rc==SQLITE_OK) and we are in persistent + // WAL mode (bPersist) and if the PRAGMA journal_size_limit is a + // non-negative value (pWal->mxWalSize>=0). Note that we truncate + // to zero bytes as truncating to the journal_size_limit might + // leave a corrupt WAL file on disk. + walLimitSize(tls, pWal, int64(0)) + } + } + } + + walIndexClose(tls, pWal, isDelete) + Xsqlite3OsClose(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd) + if isDelete != 0 { + Xsqlite3BeginBenignMalloc(tls) + Xsqlite3OsDelete(tls, (*Wal)(unsafe.Pointer(pWal)).FpVfs, (*Wal)(unsafe.Pointer(pWal)).FzWalName, 0) + Xsqlite3EndBenignMalloc(tls) + } + + Xsqlite3_free(tls, (*Wal)(unsafe.Pointer(pWal)).FapWiData) + Xsqlite3_free(tls, pWal) + } + return rc +} + +// Try to read the wal-index header. Return 0 on success and 1 if +// there is a problem. +// +// The wal-index is in shared memory. Another thread or process might +// be writing the header at the same time this procedure is trying to +// read it, which might result in inconsistency. A dirty read is detected +// by verifying that both copies of the header are the same and also by +// a checksum on the header. +// +// If and only if the read is consistent and the header is different from +// pWal->hdr, then pWal->hdr is updated to the content of the new header +// and *pChanged is set to 1. +// +// If the checksum cannot be verified return non-zero. If the header +// is read successfully and the checksum verified, return zero. +func walIndexTryHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) int32 { /* sqlite3.c:62571:27: */ + bp := tls.Alloc(104) + defer tls.Free(104) + + // var aCksum [2]U32 at bp+96, 8 + // Checksum on the header content + // var h1 WalIndexHdr at bp, 48 + + // var h2 WalIndexHdr at bp+48, 48 + // Two copies of the header content + var aHdr uintptr // Header in shared memory + + // The first page of the wal-index must be mapped at this point. + + // Read the header. This might happen concurrently with a write to the + // same area of shared memory on a different CPU in a SMP, + // meaning it is possible that an inconsistent snapshot is read + // from the file. If this happens, return non-zero. + // + // tag-20200519-1: + // There are two copies of the header at the beginning of the wal-index. + // When reading, read [0] first then [1]. Writes are in the reverse order. + // Memory barriers are used to prevent the compiler or the hardware from + // reordering the reads and writes. TSAN and similar tools can sometimes + // give false-positive warnings about these accesses because the tools do not + // account for the double-read and the memory barrier. The use of mutexes + // here would be problematic as the memory being accessed is potentially + // shared among multiple processes and not all mutex implementions work + // reliably in that environment. + libc.AtomicStoreUintptr(&aHdr, uintptr(walIndexHdr(tls, pWal))) + libc.Xmemcpy(tls, bp /* &h1 */, (libc.AtomicLoadUintptr(&aHdr)), uint64(unsafe.Sizeof(WalIndexHdr{}))) // Possible TSAN false-positive + walShmBarrier(tls, pWal) + libc.Xmemcpy(tls, bp+48 /* &h2 */, (libc.AtomicLoadUintptr(&aHdr) + 1*48), uint64(unsafe.Sizeof(WalIndexHdr{}))) + + if (libc.Xmemcmp(tls, bp /* &h1 */, bp+48 /* &h2 */, uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0) { + return 1 // Dirty read + } + if int32((*WalIndexHdr)(unsafe.Pointer(bp /* &h1 */)).FisInit) == 0 { + return 1 // Malformed header - probably all zeros + } + walChecksumBytes(tls, 1, bp /* &h1 */, (int32(uint64(unsafe.Sizeof(WalIndexHdr{})) - uint64(unsafe.Sizeof([2]U32{})))), uintptr(0), bp+96 /* &aCksum[0] */) + if (*(*U32)(unsafe.Pointer(bp + 96 /* &aCksum[0] */)) != *(*U32)(unsafe.Pointer((bp /* &h1 */ + 40 /* &.aCksum */)))) || (*(*U32)(unsafe.Pointer(bp + 96 /* &aCksum[0] */ + 1*4)) != *(*U32)(unsafe.Pointer((bp /* &h1 */ + 40 /* &.aCksum */) + 1*4))) { + return 1 // Checksum does not match + } + + if libc.Xmemcmp(tls, (pWal+72 /* &.hdr */), bp /* &h1 */, uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0 { + *(*int32)(unsafe.Pointer(pChanged)) = 1 + libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */), bp /* &h1 */, uint64(unsafe.Sizeof(WalIndexHdr{}))) + (*Wal)(unsafe.Pointer(pWal)).FszPage = (U32((int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage) & 0xfe00) + ((int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage) & 0x0001) << 16))) + + } + + // The header was successfully read. Return zero. + return 0 +} + +// This is the value that walTryBeginRead returns when it needs to +// be retried. + +// Read the wal-index header from the wal-index and into pWal->hdr. +// If the wal-header appears to be corrupt, try to reconstruct the +// wal-index from the WAL before returning. +// +// Set *pChanged to 1 if the wal-index header value in pWal->hdr is +// changed by this operation. If pWal->hdr is unchanged, set *pChanged +// to 0. +// +// If the wal-index header is successfully read, return SQLITE_OK. +// Otherwise an SQLite error code. +func walIndexReadHdr(tls *libc.TLS, pWal uintptr, pChanged uintptr) int32 { /* sqlite3.c:62641:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 // Return code + var badHdr int32 // True if a header read failed + // var page0 uintptr at bp, 8 + // Chunk of wal-index containing header + + // Ensure that page 0 of the wal-index (the page that contains the + // wal-index header) is mapped. Return early if an error occurs here. + + rc = walIndexPage(tls, pWal, 0, bp /* &page0 */) + if rc != SQLITE_OK { + // READONLY changed to OK in walIndexPage + if rc == (SQLITE_READONLY | (int32(5) << 8)) { + // The SQLITE_READONLY_CANTINIT return means that the shared-memory + // was openable but is not writable, and this thread is unable to + // confirm that another write-capable connection has the shared-memory + // open, and hence the content of the shared-memory is unreliable, + // since the shared-memory might be inconsistent with the WAL file + // and there is no writer on hand to fix it. + + (*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable = U8(1) + (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode = U8(WAL_HEAPMEMORY_MODE) + *(*int32)(unsafe.Pointer(pChanged)) = 1 + } else { + return rc // Any other non-OK return is just an error + } + } else { + // page0 can be NULL if the SHM is zero bytes in size and pWal->writeLock + // is zero, which prevents the SHM from growing + + } + + // If the first page of the wal-index has been mapped, try to read the + // wal-index header immediately, without holding any lock. This usually + // works, but may fail if the wal-index header is corrupt or currently + // being modified by another thread or process. + badHdr = func() int32 { + if libc.AtomicLoadPUintptr(bp /* page0 */) != 0 { + return walIndexTryHdr(tls, pWal, pChanged) + } + return 1 + }() + + // If the first attempt failed, it might have been due to a race + // with a writer. So get a WRITE lock and try again. + if badHdr != 0 { + if (int32((*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable) == 0) && ((int32((*Wal)(unsafe.Pointer(pWal)).FreadOnly) & WAL_SHM_RDONLY) != 0) { + if SQLITE_OK == (libc.AssignInt32(&rc, walLockShared(tls, pWal, WAL_WRITE_LOCK))) { + walUnlockShared(tls, pWal, WAL_WRITE_LOCK) + rc = (SQLITE_READONLY | (int32(1) << 8)) + } + } else { + var bWriteLock int32 = int32((*Wal)(unsafe.Pointer(pWal)).FwriteLock) + if (bWriteLock != 0) || (SQLITE_OK == (libc.AssignInt32(&rc, walLockExclusive(tls, pWal, WAL_WRITE_LOCK, 1)))) { + (*Wal)(unsafe.Pointer(pWal)).FwriteLock = U8(1) + if SQLITE_OK == (libc.AssignInt32(&rc, walIndexPage(tls, pWal, 0, bp /* &page0 */))) { + badHdr = walIndexTryHdr(tls, pWal, pChanged) + if badHdr != 0 { + // If the wal-index header is still malformed even while holding + // a WRITE lock, it can only mean that the header is corrupted and + // needs to be reconstructed. So run recovery to do exactly that. + rc = walIndexRecover(tls, pWal) + *(*int32)(unsafe.Pointer(pChanged)) = 1 + } + } + if bWriteLock == 0 { + (*Wal)(unsafe.Pointer(pWal)).FwriteLock = U8(0) + walUnlockExclusive(tls, pWal, WAL_WRITE_LOCK, 1) + } + } + } + } + + // If the header is read successfully, check the version number to make + // sure the wal-index was not constructed with some future format that + // this version of SQLite cannot understand. + if (badHdr == 0) && ((*Wal)(unsafe.Pointer(pWal)).Fhdr.FiVersion != U32(WALINDEX_MAX_VERSION)) { + rc = Xsqlite3CantopenError(tls, 62720) + } + if (*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable != 0 { + if rc != SQLITE_OK { + walIndexClose(tls, pWal, 0) + (*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable = U8(0) + + // walIndexRecover() might have returned SHORT_READ if a concurrent + // writer truncated the WAL out from under it. If that happens, it + // indicates that a writer has fixed the SHM file for us, so retry + if rc == (SQLITE_IOERR | (int32(2) << 8)) { + rc = -1 + } + } + (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode = U8(WAL_NORMAL_MODE) + } + + return rc +} + +// Open a transaction in a connection where the shared-memory is read-only +// and where we cannot verify that there is a separate write-capable connection +// on hand to keep the shared-memory up-to-date with the WAL file. +// +// This can happen, for example, when the shared-memory is implemented by +// memory-mapping a *-shm file, where a prior writer has shut down and +// left the *-shm file on disk, and now the present connection is trying +// to use that database but lacks write permission on the *-shm file. +// Other scenarios are also possible, depending on the VFS implementation. +// +// Precondition: +// +// The *-wal file has been read and an appropriate wal-index has been +// constructed in pWal->apWiData[] using heap memory instead of shared +// memory. +// +// If this function returns SQLITE_OK, then the read transaction has +// been successfully opened. In this case output variable (*pChanged) +// is set to true before returning if the caller should discard the +// contents of the page cache before proceeding. Or, if it returns +// WAL_RETRY, then the heap memory wal-index has been discarded and +// the caller should retry opening the read transaction from the +// beginning (including attempting to map the *-shm file). +// +// If an error occurs, an SQLite error code is returned. +func walBeginShmUnreliable(tls *libc.TLS, pWal uintptr, pChanged uintptr) int32 { /* sqlite3.c:62765:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + // var szWal I64 at bp+8, 8 + // Size of wal file on disk in bytes + var iOffset I64 // Current offset when reading wal file + // var aBuf [32]U8 at bp+16, 32 + // Buffer to load WAL header into + var aFrame uintptr // Malloc'd buffer to load entire frame + var szFrame int32 // Number of bytes in buffer aFrame[] + var aData uintptr // Pointer to data part of aFrame buffer + // var pDummy uintptr at bp, 8 + // Dummy argument for xShmMap + var rc int32 // Return code + // var aSaveCksum [2]U32 at bp+48, 8 + + // var pgno U32 at bp+56, 4 + // Database page number for frame + // var nTruncate U32 at bp+60, 4 + + var i int32 + aFrame = uintptr(0) // Saved copy of pWal->hdr.aFrameCksum + + // Take WAL_READ_LOCK(0). This has the effect of preventing any + // writers from running a checkpoint, but does not stop them + // from running recovery. + rc = walLockShared(tls, pWal, (3 + (0))) + if !(rc != SQLITE_OK) { + goto __1 + } + if !(rc == SQLITE_BUSY) { + goto __2 + } + rc = -1 +__2: + ; + goto begin_unreliable_shm_out +__1: + ; + (*Wal)(unsafe.Pointer(pWal)).FreadLock = int16(0) + + // Check to see if a separate writer has attached to the shared-memory area, + // thus making the shared-memory "reliable" again. Do this by invoking + // the xShmMap() routine of the VFS and looking to see if the return + // is SQLITE_READONLY instead of SQLITE_READONLY_CANTINIT. + // + // If the shared-memory is now "reliable" return WAL_RETRY, which will + // cause the heap-memory WAL-index to be discarded and the actual + // shared memory to be used in its place. + // + // This step is important because, even though this connection is holding + // the WAL_READ_LOCK(0) which prevents a checkpoint, a writer might + // have already checkpointed the WAL file and, while the current + // is active, wrap the WAL and start overwriting frames that this + // process wants to use. + // + // Once sqlite3OsShmMap() has been called for an sqlite3_file and has + // returned any SQLITE_READONLY value, it must return only SQLITE_READONLY + // or SQLITE_READONLY_CANTINIT or some error for all subsequent invocations, + // even if some external agent does a "chmod" to make the shared-memory + // writable by us, until sqlite3OsShmUnmap() has been called. + // This is a requirement on the VFS implementation. + rc = Xsqlite3OsShmMap(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, 0, (int32((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0)))))), 0, bp /* &pDummy */) + // SQLITE_OK not possible for read-only connection + if !(rc != (SQLITE_READONLY | (int32(5) << 8))) { + goto __3 + } + rc = func() int32 { + if rc == SQLITE_READONLY { + return -1 + } + return rc + }() + goto begin_unreliable_shm_out +__3: + ; + + // We reach this point only if the real shared-memory is still unreliable. + // Assume the in-memory WAL-index substitute is correct and load it + // into pWal->hdr. + libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */), walIndexHdr(tls, pWal), uint64(unsafe.Sizeof(WalIndexHdr{}))) + + // Make sure some writer hasn't come in and changed the WAL file out + // from under us, then disconnected, while we were not looking. + rc = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+8 /* &szWal */) + if !(rc != SQLITE_OK) { + goto __4 + } + goto begin_unreliable_shm_out +__4: + ; + if !(*(*I64)(unsafe.Pointer(bp + 8 /* szWal */)) < int64(WAL_HDRSIZE)) { + goto __5 + } + // If the wal file is too small to contain a wal-header and the + // wal-index header has mxFrame==0, then it must be safe to proceed + // reading the database file only. However, the page cache cannot + // be trusted, as a read/write connection may have connected, written + // the db, run a checkpoint, truncated the wal file and disconnected + // since this client's last read transaction. + *(*int32)(unsafe.Pointer(pChanged)) = 1 + rc = func() int32 { + if (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame == U32(0) { + return SQLITE_OK + } + return -1 + }() + goto begin_unreliable_shm_out +__5: + ; + + // Check the salt keys at the start of the wal file still match. + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+16 /* &aBuf[0] */, WAL_HDRSIZE, int64(0)) + if !(rc != SQLITE_OK) { + goto __6 + } + goto begin_unreliable_shm_out +__6: + ; + if !(libc.Xmemcmp(tls, (pWal+72 /* &.hdr */ +32 /* &.aSalt */), (bp+16 /* &aBuf */ +16), uint64(8)) != 0) { + goto __7 + } + // Some writer has wrapped the WAL file while we were not looking. + // Return WAL_RETRY which will cause the in-memory WAL-index to be + // rebuilt. + rc = -1 + goto begin_unreliable_shm_out +__7: + ; + + // Allocate a buffer to read frames into + szFrame = (int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage) + WAL_FRAME_HDRSIZE) + aFrame = Xsqlite3_malloc64(tls, uint64(szFrame)) + if !(aFrame == uintptr(0)) { + goto __8 + } + rc = SQLITE_NOMEM + goto begin_unreliable_shm_out +__8: + ; + aData = (aFrame + 24) + + // Check to see if a complete transaction has been appended to the + // wal file since the heap-memory wal-index was created. If so, the + // heap-memory wal-index is discarded and WAL_RETRY returned to + // the caller. + *(*U32)(unsafe.Pointer(bp + 48 /* &aSaveCksum[0] */)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) + *(*U32)(unsafe.Pointer(bp + 48 /* &aSaveCksum[0] */ + 1*4)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) + iOffset = (int64(WAL_HDRSIZE) + ((I64(((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + U32(1)) - U32(1))) * (I64((int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage)) + WAL_FRAME_HDRSIZE)))) +__9: + if !((iOffset + I64(szFrame)) <= *(*I64)(unsafe.Pointer(bp + 8 /* szWal */))) { + goto __11 + } // dbsize field from frame header + + // Read and decode the next log frame. + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, aFrame, szFrame, iOffset) + if !(rc != SQLITE_OK) { + goto __12 + } + goto __11 +__12: + ; + if !(!(walDecodeFrame(tls, pWal, bp+56 /* &pgno */, bp+60 /* &nTruncate */, aData, aFrame) != 0)) { + goto __13 + } + goto __11 +__13: + ; + + // If nTruncate is non-zero, then a complete transaction has been + // appended to this wal file. Set rc to WAL_RETRY and break out of + // the loop. + if !(*(*U32)(unsafe.Pointer(bp + 60 /* nTruncate */)) != 0) { + goto __14 + } + rc = -1 + goto __11 +__14: + ; + goto __10 +__10: + iOffset = iOffset + (I64(szFrame)) + goto __9 + goto __11 +__11: + ; + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = *(*U32)(unsafe.Pointer(bp + 48 /* &aSaveCksum[0] */)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = *(*U32)(unsafe.Pointer(bp + 48 /* &aSaveCksum[0] */ + 1*4)) + +begin_unreliable_shm_out: + Xsqlite3_free(tls, aFrame) + if !(rc != SQLITE_OK) { + goto __15 + } + i = 0 +__16: + if !(i < (*Wal)(unsafe.Pointer(pWal)).FnWiData) { + goto __18 + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(i)*8)) = uintptr(0) + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + (*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable = U8(0) + Xsqlite3WalEndReadTransaction(tls, pWal) + *(*int32)(unsafe.Pointer(pChanged)) = 1 +__15: + ; + return rc +} + +// Attempt to start a read transaction. This might fail due to a race or +// other transient condition. When that happens, it returns WAL_RETRY to +// indicate to the caller that it is safe to retry immediately. +// +// On success return SQLITE_OK. On a permanent failure (such an +// I/O error or an SQLITE_BUSY because another process is running +// recovery) return a positive error code. +// +// The useWal parameter is true to force the use of the WAL and disable +// the case where the WAL is bypassed because it has been completely +// checkpointed. If useWal==0 then this routine calls walIndexReadHdr() +// to make a copy of the wal-index header into pWal->hdr. If the +// wal-index header has changed, *pChanged is set to 1 (as an indication +// to the caller that the local page cache is obsolete and needs to be +// flushed.) When useWal==1, the wal-index header is assumed to already +// be loaded and the pChanged parameter is unused. +// +// The caller must set the cnt parameter to the number of prior calls to +// this routine during the current read attempt that returned WAL_RETRY. +// This routine will start taking more aggressive measures to clear the +// race conditions after multiple WAL_RETRY returns, and after an excessive +// number of errors will ultimately return SQLITE_PROTOCOL. The +// SQLITE_PROTOCOL return indicates that some other process has gone rogue +// and is not honoring the locking protocol. There is a vanishingly small +// chance that SQLITE_PROTOCOL could be returned because of a run of really +// bad luck when there is lots of contention for the wal-index, but that +// possibility is so small that it can be safely neglected, we believe. +// +// On success, this routine obtains a read lock on +// WAL_READ_LOCK(pWal->readLock). The pWal->readLock integer is +// in the range 0 <= pWal->readLock < WAL_NREADER. If pWal->readLock==(-1) +// that means the Wal does not hold any read lock. The reader must not +// access any database page that is modified by a WAL frame up to and +// including frame number aReadMark[pWal->readLock]. The reader will +// use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0 +// Or if pWal->readLock==0, then the reader will ignore the WAL +// completely and get all content directly from the database file. +// If the useWal parameter is 1 then the WAL will never be ignored and +// this routine will always set pWal->readLock>0 on success. +// When the read transaction is completed, the caller must release the +// lock on WAL_READ_LOCK(pWal->readLock) and set pWal->readLock to -1. +// +// This routine uses the nBackfill and aReadMark[] fields of the header +// to select a particular WAL_READ_LOCK() that strives to let the +// checkpoint process do as much work as possible. This routine might +// update values of the aReadMark[] array in the header, but if it does +// so it takes care to hold an exclusive lock on the corresponding +// WAL_READ_LOCK() while changing values. +func walTryBeginRead(tls *libc.TLS, pWal uintptr, pChanged uintptr, useWal int32, cnt int32) int32 { /* sqlite3.c:62960:12: */ + var pInfo uintptr // Checkpoint information in wal-index + var mxReadMark U32 // Largest aReadMark[] value + var mxI int32 // Index of largest aReadMark[] value + var i int32 // Loop counter + var rc int32 = SQLITE_OK // Return code + var mxFrame U32 // Wal frame to lock to + + // Not currently locked + + // useWal may only be set for read/write connections + + // Take steps to avoid spinning forever if there is a protocol error. + // + // Circumstances that cause a RETRY should only last for the briefest + // instances of time. No I/O or other system calls are done while the + // locks are held, so the locks should not be held for very long. But + // if we are unlucky, another process that is holding a lock might get + // paged out or take a page-fault that is time-consuming to resolve, + // during the few nanoseconds that it is holding the lock. In that case, + // it might take longer than normal for the lock to free. + // + // After 5 RETRYs, we begin calling sqlite3OsSleep(). The first few + // calls to sqlite3OsSleep() have a delay of 1 microsecond. Really this + // is more of a scheduler yield than an actual delay. But on the 10th + // an subsequent retries, the delays start becoming longer and longer, + // so that on the 100th (and last) RETRY we delay for 323 milliseconds. + // The total delay time before giving up is less than 10 seconds. + if cnt > 5 { + var nDelay int32 = 1 // Pause time in microseconds + if cnt > 100 { + + return SQLITE_PROTOCOL + } + if cnt >= 10 { + nDelay = (((cnt - 9) * (cnt - 9)) * 39) + } + Xsqlite3OsSleep(tls, (*Wal)(unsafe.Pointer(pWal)).FpVfs, nDelay) + } + + if !(useWal != 0) { + + if int32((*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable) == 0 { + rc = walIndexReadHdr(tls, pWal, pChanged) + } + if rc == SQLITE_BUSY { + // If there is not a recovery running in another thread or process + // then convert BUSY errors to WAL_RETRY. If recovery is known to + // be running, convert BUSY to BUSY_RECOVERY. There is a race here + // which might cause WAL_RETRY to be returned even if BUSY_RECOVERY + // would be technically correct. But the race is benign since with + // WAL_RETRY this routine will be called again and will probably be + // right on the second iteration. + if *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData)) == uintptr(0) { + // This branch is taken when the xShmMap() method returns SQLITE_BUSY. + // We assume this is a transient condition, so return WAL_RETRY. The + // xShmMap() implementation used by the default unix and win32 VFS + // modules may return SQLITE_BUSY due to a race condition in the + // code that determines whether or not the shared-memory region + // must be zeroed before the requested page is returned. + rc = -1 + } else if SQLITE_OK == (libc.AssignInt32(&rc, walLockShared(tls, pWal, WAL_RECOVER_LOCK))) { + walUnlockShared(tls, pWal, WAL_RECOVER_LOCK) + rc = -1 + } else if rc == SQLITE_BUSY { + rc = (SQLITE_BUSY | (int32(1) << 8)) + } + } + if rc != SQLITE_OK { + return rc + } else if (*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable != 0 { + return walBeginShmUnreliable(tls, pWal, pChanged) + } + } + + libc.AtomicStoreUintptr(&pInfo, uintptr(walCkptInfo(tls, pWal))) + if (!(useWal != 0) && (U32(libc.AtomicLoadNUint32((libc.AtomicLoadUintptr(&pInfo) /* &.nBackfill */), 0)) == (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame)) && + (((*Wal)(unsafe.Pointer(pWal)).FpSnapshot == uintptr(0)) || ((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame == U32(0))) { + // The WAL has been completely backfilled (or it is empty). + // and can be safely ignored. + rc = walLockShared(tls, pWal, (3 + (0))) + walShmBarrier(tls, pWal) + if rc == SQLITE_OK { + if libc.Xmemcmp(tls, walIndexHdr(tls, pWal), (pWal+72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0 { + // It is not safe to allow the reader to continue here if frames + // may have been appended to the log before READ_LOCK(0) was obtained. + // When holding READ_LOCK(0), the reader ignores the entire log file, + // which implies that the database file contains a trustworthy + // snapshot. Since holding READ_LOCK(0) prevents a checkpoint from + // happening, this is usually correct. + // + // However, if frames have been appended to the log (or if the log + // is wrapped and written for that matter) before the READ_LOCK(0) + // is obtained, that is not necessarily true. A checkpointer may + // have started to backfill the appended frames but crashed before + // it finished. Leaving a corrupt image in the database file. + walUnlockShared(tls, pWal, (3 + (0))) + return -1 + } + (*Wal)(unsafe.Pointer(pWal)).FreadLock = int16(0) + return SQLITE_OK + } else if rc != SQLITE_BUSY { + return rc + } + } + + // If we get this far, it means that the reader will want to use + // the WAL to get at content from recent commits. The job now is + // to select one of the aReadMark[] entries that is closest to + // but not exceeding pWal->hdr.mxFrame and lock that entry. + mxReadMark = U32(0) + mxI = 0 + mxFrame = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + if ((*Wal)(unsafe.Pointer(pWal)).FpSnapshot != 0) && ((*WalIndexHdr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FpSnapshot)).FmxFrame < mxFrame) { + mxFrame = (*WalIndexHdr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FpSnapshot)).FmxFrame + } + for i = 1; i < (SQLITE_SHM_NLOCK - 3); i++ { + var thisMark U32 = U32(libc.AtomicLoadNUint32(((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4), 0)) + if (mxReadMark <= thisMark) && (thisMark <= mxFrame) { + + mxReadMark = thisMark + mxI = i + } + } + if ((int32((*Wal)(unsafe.Pointer(pWal)).FreadOnly) & WAL_SHM_RDONLY) == 0) && + ((mxReadMark < mxFrame) || (mxI == 0)) { + for i = 1; i < (SQLITE_SHM_NLOCK - 3); i++ { + rc = walLockExclusive(tls, pWal, (3 + (i)), 1) + if rc == SQLITE_OK { + libc.AtomicStoreNUint32(((libc.AtomicLoadUintptr(&pInfo) + 4 /* &.aReadMark */) + uintptr(i)*4), uint32(mxFrame), 0) + mxReadMark = mxFrame + mxI = i + walUnlockExclusive(tls, pWal, (3 + (i)), 1) + break + } else if rc != SQLITE_BUSY { + return rc + } + } + } + if mxI == 0 { + + if rc == SQLITE_BUSY { + return -1 + } + return (SQLITE_READONLY | (int32(5) << 8)) + } + + rc = walLockShared(tls, pWal, (3 + (mxI))) + if rc != 0 { + if rc == SQLITE_BUSY { + return -1 + } + return rc + } + // Now that the read-lock has been obtained, check that neither the + // value in the aReadMark[] array or the contents of the wal-index + // header have changed. + // + // It is necessary to check that the wal-index header did not change + // between the time it was read and when the shared-lock was obtained + // on WAL_READ_LOCK(mxI) was obtained to account for the possibility + // that the log file may have been wrapped by a writer, or that frames + // that occur later in the log than pWal->hdr.mxFrame may have been + // copied into the database by a checkpointer. If either of these things + // happened, then reading the database with the current value of + // pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry + // instead. + // + // Before checking that the live wal-index header has not changed + // since it was read, set Wal.minFrame to the first frame in the wal + // file that has not yet been checkpointed. This client will not need + // to read any frames earlier than minFrame from the wal file - they + // can be safely read directly from the database file. + // + // Because a ShmBarrier() call is made between taking the copy of + // nBackfill and checking that the wal-header in shared-memory still + // matches the one cached in pWal->hdr, it is guaranteed that the + // checkpointer that set nBackfill was not working with a wal-index + // header newer than that cached in pWal->hdr. If it were, that could + // cause a problem. The checkpointer could omit to checkpoint + // a version of page X that lies before pWal->minFrame (call that version + // A) on the basis that there is a newer version (version B) of the same + // page later in the wal file. But if version B happens to like past + // frame pWal->hdr.mxFrame - then the client would incorrectly assume + // that it can read version A from the database file. However, since + // we can guarantee that the checkpointer that set nBackfill could not + // see any pages past pWal->hdr.mxFrame, this problem does not come up. + (*Wal)(unsafe.Pointer(pWal)).FminFrame = (U32(libc.AtomicLoadNUint32((libc.AtomicLoadUintptr(&pInfo) /* &.nBackfill */), 0) + 1)) + walShmBarrier(tls, pWal) + if (U32(libc.AtomicLoadNUint32(((libc.AtomicLoadUintptr(&pInfo)+4 /* &.aReadMark */)+uintptr(mxI)*4), 0)) != mxReadMark) || + (libc.Xmemcmp(tls, walIndexHdr(tls, pWal), (pWal+72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0) { + walUnlockShared(tls, pWal, (3 + (mxI))) + return -1 + } else { + + (*Wal)(unsafe.Pointer(pWal)).FreadLock = I16(mxI) + } + return rc +} + +// Attempt to reduce the value of the WalCkptInfo.nBackfillAttempted +// variable so that older snapshots can be accessed. To do this, loop +// through all wal frames from nBackfillAttempted to (nBackfill+1), +// comparing their content to the corresponding page with the database +// file, if any. Set nBackfillAttempted to the frame number of the +// first frame for which the wal file content matches the db file. +// +// This is only really safe if the file-system is such that any page +// writes made by earlier checkpointers were atomic operations, which +// is not always true. It is also possible that nBackfillAttempted +// may be left set to a value larger than expected, if a wal frame +// contains content that duplicate of an earlier version of the same +// page. +// +// SQLITE_OK is returned if successful, or an SQLite error code if an +// error occurs. It is not an error if nBackfillAttempted cannot be +// decreased at all. +func Xsqlite3WalSnapshotRecover(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:63190:20: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var rc int32 + + rc = walLockExclusive(tls, pWal, WAL_CKPT_LOCK, 1) + if rc == SQLITE_OK { + var pInfo uintptr = walCkptInfo(tls, pWal) + var szPage int32 = int32((*Wal)(unsafe.Pointer(pWal)).FszPage) + // var szDb I64 at bp, 8 + // Size of db file in bytes + + rc = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, bp /* &szDb */) + if rc == SQLITE_OK { + var pBuf1 uintptr = Xsqlite3_malloc(tls, szPage) + var pBuf2 uintptr = Xsqlite3_malloc(tls, szPage) + if (pBuf1 == uintptr(0)) || (pBuf2 == uintptr(0)) { + rc = SQLITE_NOMEM + } else { + var i U32 = (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted + for i = (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted; i > U32(libc.AtomicLoadNUint32((libc.AtomicLoadUintptr(&pInfo) /* &.nBackfill */), 0)); i-- { + // var sLoc WalHashLoc at bp+8, 24 + // Hash table location + var pgno U32 // Page number in db file + var iDbOff I64 // Offset of db file entry + var iWalOff I64 // Offset of wal file entry + + rc = walHashGet(tls, pWal, walFramePage(tls, i), bp+8 /* &sLoc */) + if rc != SQLITE_OK { + break + } + pgno = *(*U32)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp+8 /* &sLoc */)).FaPgno + uintptr((i-(*WalHashLoc)(unsafe.Pointer(bp+8 /* &sLoc */)).FiZero))*4)) + iDbOff = ((I64(pgno - U32(1))) * I64(szPage)) + + if (iDbOff + I64(szPage)) <= *(*I64)(unsafe.Pointer(bp /* szDb */)) { + iWalOff = ((int64(WAL_HDRSIZE) + ((I64((i) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + int64(WAL_FRAME_HDRSIZE)) + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, pBuf1, szPage, iWalOff) + + if rc == SQLITE_OK { + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, pBuf2, szPage, iDbOff) + } + + if (rc != SQLITE_OK) || (0 == libc.Xmemcmp(tls, pBuf1, pBuf2, uint64(szPage))) { + break + } + } + + (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted = (i - U32(1)) + } + } + + Xsqlite3_free(tls, pBuf1) + Xsqlite3_free(tls, pBuf2) + } + walUnlockExclusive(tls, pWal, WAL_CKPT_LOCK, 1) + } + + return rc +} + +// Begin a read transaction on the database. +// +// This routine used to be called sqlite3OpenSnapshot() and with good reason: +// it takes a snapshot of the state of the WAL and wal-index for the current +// instant in time. The current thread will continue to use this snapshot. +// Other threads might append new content to the WAL and wal-index but +// that extra content is ignored by the current thread. +// +// If the database contents have changes since the previous read +// transaction, then *pChanged is set to 1 before returning. The +// Pager layer will use this to know that its cache is stale and +// needs to be flushed. +func Xsqlite3WalBeginReadTransaction(tls *libc.TLS, pWal uintptr, pChanged uintptr) int32 { /* sqlite3.c:63260:20: */ + var rc int32 // Return code + var cnt int32 = 0 // Number of TryBeginRead attempts + var bChanged int32 = 0 + var pSnapshot uintptr = (*Wal)(unsafe.Pointer(pWal)).FpSnapshot + + if pSnapshot != 0 { + if (libc.Xmemcmp(tls, pSnapshot, (pWal+72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0) { + bChanged = 1 + } + + // It is possible that there is a checkpointer thread running + // concurrent with this code. If this is the case, it may be that the + // checkpointer has already determined that it will checkpoint + // snapshot X, where X is later in the wal file than pSnapshot, but + // has not yet set the pInfo->nBackfillAttempted variable to indicate + // its intent. To avoid the race condition this leads to, ensure that + // there is no checkpointer process by taking a shared CKPT lock + // before checking pInfo->nBackfillAttempted. + + rc = walLockShared(tls, pWal, WAL_CKPT_LOCK) + + if rc != SQLITE_OK { + return rc + } + (*Wal)(unsafe.Pointer(pWal)).FckptLock = U8(1) + } + + for ok := true; ok; ok = (rc == (-1)) { + rc = walTryBeginRead(tls, pWal, pChanged, 0, libc.PreIncInt32(&cnt, 1)) + } + + if rc == SQLITE_OK { + if (pSnapshot != 0) && (libc.Xmemcmp(tls, pSnapshot, (pWal+72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0) { + // At this point the client has a lock on an aReadMark[] slot holding + // a value equal to or smaller than pSnapshot->mxFrame, but pWal->hdr + // is populated with the wal-index header corresponding to the head + // of the wal file. Verify that pSnapshot is still valid before + // continuing. Reasons why pSnapshot might no longer be valid: + // + // (1) The WAL file has been reset since the snapshot was taken. + // In this case, the salt will have changed. + // + // (2) A checkpoint as been attempted that wrote frames past + // pSnapshot->mxFrame into the database file. Note that the + // checkpoint need not have completed for this to cause problems. + var pInfo uintptr = walCkptInfo(tls, pWal) + + // Check that the wal file has not been wrapped. Assuming that it has + // not, also check that no checkpointer has attempted to checkpoint any + // frames beyond pSnapshot->mxFrame. If either of these conditions are + // true, return SQLITE_ERROR_SNAPSHOT. Otherwise, overwrite pWal->hdr + // with *pSnapshot and set *pChanged as appropriate for opening the + // snapshot. + if !(libc.Xmemcmp(tls, pSnapshot+32 /* &.aSalt */, pWal+72 /* &.hdr */ +32 /* &.aSalt */, uint64(unsafe.Sizeof([2]U32{}))) != 0) && + ((*WalIndexHdr)(unsafe.Pointer(pSnapshot)).FmxFrame >= (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfillAttempted) { + + libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */), pSnapshot, uint64(unsafe.Sizeof(WalIndexHdr{}))) + *(*int32)(unsafe.Pointer(pChanged)) = bChanged + } else { + rc = (SQLITE_ERROR | (int32(3) << 8)) + } + + // A client using a non-current snapshot may not ignore any frames + // from the start of the wal file. This is because, for a system + // where (minFrame < iSnapshot < maxFrame), a checkpointer may + // have omitted to checkpoint a frame earlier than minFrame in + // the file because there exists a frame after iSnapshot that + // is the same database page. + (*Wal)(unsafe.Pointer(pWal)).FminFrame = U32(1) + + if rc != SQLITE_OK { + Xsqlite3WalEndReadTransaction(tls, pWal) + } + } + } + + // Release the shared CKPT lock obtained above. + if (*Wal)(unsafe.Pointer(pWal)).FckptLock != 0 { + + walUnlockShared(tls, pWal, WAL_CKPT_LOCK) + (*Wal)(unsafe.Pointer(pWal)).FckptLock = U8(0) + } + return rc +} + +// Finish with a read transaction. All this does is release the +// read-lock. +func Xsqlite3WalEndReadTransaction(tls *libc.TLS, pWal uintptr) { /* sqlite3.c:63368:21: */ + Xsqlite3WalEndWriteTransaction(tls, pWal) + if int32((*Wal)(unsafe.Pointer(pWal)).FreadLock) >= 0 { + walUnlockShared(tls, pWal, (3 + (int32((*Wal)(unsafe.Pointer(pWal)).FreadLock)))) + (*Wal)(unsafe.Pointer(pWal)).FreadLock = int16(-1) + } +} + +// Search the wal file for page pgno. If found, set *piRead to the frame that +// contains the page. Otherwise, if pgno is not in the wal file, set *piRead +// to zero. +// +// Return SQLITE_OK if successful, or an error code if an error occurs. If an +// error does occur, the final value of *piRead is undefined. +func Xsqlite3WalFindFrame(tls *libc.TLS, pWal uintptr, pgno Pgno, piRead uintptr) int32 { /* sqlite3.c:63384:20: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var iRead U32 = U32(0) // If !=0, WAL frame to return data from + var iLast U32 = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame // Last page in WAL for this reader + var iHash int32 // Used to loop through N hash tables + var iMinHash int32 + + // This routine is only be called from within a read transaction. + + // If the "last page" field of the wal-index header snapshot is 0, then + // no data will be read from the wal under any circumstances. Return early + // in this case as an optimization. Likewise, if pWal->readLock==0, + // then the WAL is ignored by the reader so return early, as if the + // WAL were empty. + if (iLast == U32(0)) || ((int32((*Wal)(unsafe.Pointer(pWal)).FreadLock) == 0) && (int32((*Wal)(unsafe.Pointer(pWal)).FbShmUnreliable) == 0)) { + *(*U32)(unsafe.Pointer(piRead)) = U32(0) + return SQLITE_OK + } + + // Search the hash table or tables for an entry matching page number + // pgno. Each iteration of the following for() loop searches one + // hash table (each hash table indexes up to HASHTABLE_NPAGE frames). + // + // This code might run concurrently to the code in walIndexAppend() + // that adds entries to the wal-index (and possibly to this hash + // table). This means the value just read from the hash + // slot (aHash[iKey]) may have been added before or after the + // current read transaction was opened. Values added after the + // read transaction was opened may have been written incorrectly - + // i.e. these slots may contain garbage data. However, we assume + // that any slots written before the current read transaction was + // opened remain unmodified. + // + // For the reasons above, the if(...) condition featured in the inner + // loop of the following block is more stringent that would be required + // if we had exclusive access to the hash-table: + // + // (aPgno[iFrame]==pgno): + // This condition filters out normal hash-table collisions. + // + // (iFrame<=iLast): + // This condition filters out entries that were added to the hash + // table after the current read-transaction had started. + iMinHash = walFramePage(tls, (*Wal)(unsafe.Pointer(pWal)).FminFrame) + for iHash = walFramePage(tls, iLast); iHash >= iMinHash; iHash-- { + // var sLoc WalHashLoc at bp, 24 + // Hash table location + var iKey int32 // Hash slot index + var nCollide int32 // Number of hash collisions remaining + var rc int32 // Error code + var iH U32 + + rc = walHashGet(tls, pWal, iHash, bp /* &sLoc */) + if rc != SQLITE_OK { + return rc + } + nCollide = (HASHTABLE_NPAGE * 2) + iKey = walHash(tls, pgno) + for (libc.AssignUint32(&iH, U32(libc.AtomicLoadNUint16(((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaHash+uintptr(iKey)*2), 0)))) != U32(0) { + var iFrame U32 = (iH + (*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FiZero) + if ((iFrame <= iLast) && (iFrame >= (*Wal)(unsafe.Pointer(pWal)).FminFrame)) && (*(*U32)(unsafe.Pointer((*WalHashLoc)(unsafe.Pointer(bp /* &sLoc */)).FaPgno + uintptr(iH)*4)) == pgno) { + + iRead = iFrame + } + if (libc.PostDecInt32(&nCollide, 1)) == 0 { + return Xsqlite3CorruptError(tls, 63454) + } + iKey = walNextHash(tls, iKey) + } + if iRead != 0 { + break + } + } + + *(*U32)(unsafe.Pointer(piRead)) = iRead + return SQLITE_OK +} + +// Read the contents of frame iRead from the wal file into buffer pOut +// (which is nOut bytes in size). Return SQLITE_OK if successful, or an +// error code otherwise. +func Xsqlite3WalReadFrame(tls *libc.TLS, pWal uintptr, iRead U32, nOut int32, pOut uintptr) int32 { /* sqlite3.c:63488:20: */ + var sz int32 + var iOffset I64 + sz = int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage) + sz = ((sz & 0xfe00) + ((sz & 0x0001) << 16)) + + iOffset = ((int64(WAL_HDRSIZE) + ((I64((iRead) - U32(1))) * (I64((sz) + WAL_FRAME_HDRSIZE)))) + int64(WAL_FRAME_HDRSIZE)) + // testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL + return Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, pOut, func() int32 { + if nOut > sz { + return sz + } + return nOut + }(), iOffset) +} + +// Return the size of the database in pages (or zero, if unknown). +func Xsqlite3WalDbsize(tls *libc.TLS, pWal uintptr) Pgno { /* sqlite3.c:63508:21: */ + if (pWal != 0) && (int32((*Wal)(unsafe.Pointer(pWal)).FreadLock) >= 0) { + return (*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage + } + return Pgno(0) +} + +// This function starts a write transaction on the WAL. +// +// A read transaction must have already been started by a prior call +// to sqlite3WalBeginReadTransaction(). +// +// If another thread or process has written into the database since +// the read transaction was started, then it is not possible for this +// thread to write as doing so would cause a fork. So this routine +// returns SQLITE_BUSY in that case and no write transaction is started. +// +// There can only be a single writer active at a time. +func Xsqlite3WalBeginWriteTransaction(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:63529:20: */ + var rc int32 + + // Cannot start a write transaction without first holding a read + // transaction. + + if (*Wal)(unsafe.Pointer(pWal)).FreadOnly != 0 { + return SQLITE_READONLY + } + + // Only one writer allowed at a time. Get the write lock. Return + // SQLITE_BUSY if unable. + rc = walLockExclusive(tls, pWal, WAL_WRITE_LOCK, 1) + if rc != 0 { + return rc + } + (*Wal)(unsafe.Pointer(pWal)).FwriteLock = U8(1) + + // If another connection has written to the database file since the + // time the read transaction on this connection was started, then + // the write is disallowed. + if (libc.Xmemcmp(tls, (pWal+72 /* &.hdr */), walIndexHdr(tls, pWal), uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0) { + walUnlockExclusive(tls, pWal, WAL_WRITE_LOCK, 1) + (*Wal)(unsafe.Pointer(pWal)).FwriteLock = U8(0) + rc = (SQLITE_BUSY | (int32(2) << 8)) + } + + return rc +} + +// End a write transaction. The commit has already been done. This +// routine merely releases the lock. +func Xsqlite3WalEndWriteTransaction(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:63577:20: */ + if (*Wal)(unsafe.Pointer(pWal)).FwriteLock != 0 { + walUnlockExclusive(tls, pWal, WAL_WRITE_LOCK, 1) + (*Wal)(unsafe.Pointer(pWal)).FwriteLock = U8(0) + (*Wal)(unsafe.Pointer(pWal)).FiReCksum = U32(0) + (*Wal)(unsafe.Pointer(pWal)).FtruncateOnCommit = U8(0) + } + return SQLITE_OK +} + +// If any data has been written (but not committed) to the log file, this +// function moves the write-pointer back to the start of the transaction. +// +// Additionally, the callback function is invoked for each frame written +// to the WAL since the start of the transaction. If the callback returns +// other than SQLITE_OK, it is not invoked again and the error code is +// returned to the caller. +// +// Otherwise, if the callback function does not return an error, this +// function returns SQLITE_OK. +func Xsqlite3WalUndo(tls *libc.TLS, pWal uintptr, xUndo uintptr, pUndoCtx uintptr) int32 { /* sqlite3.c:63599:20: */ + var rc int32 = SQLITE_OK + if (*Wal)(unsafe.Pointer(pWal)).FwriteLock != 0 { + var iMax Pgno = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + var iFrame Pgno + + // Restore the clients cache of the wal-index header to the state it + // was in before the client began writing to the database. + libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */), walIndexHdr(tls, pWal), uint64(unsafe.Sizeof(WalIndexHdr{}))) + + for iFrame = ((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + U32(1)); (rc == SQLITE_OK) && (iFrame <= iMax); iFrame++ { + // This call cannot fail. Unless the page for which the page number + // is passed as the second argument is (a) in the cache and + // (b) has an outstanding reference, then xUndo is either a no-op + // (if (a) is false) or simply expels the page from the cache (if (b) + // is false). + // + // If the upper layer is doing a rollback, it is guaranteed that there + // are no outstanding references to any page other than page 1. And + // page 1 is never written to the log until the transaction is + // committed. As a result, the call to xUndo may not fail. + + rc = (*(*func(*libc.TLS, uintptr, Pgno) int32)(unsafe.Pointer(&xUndo)))(tls, pUndoCtx, walFramePgno(tls, pWal, iFrame)) + } + if iMax != (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame { + walCleanupHash(tls, pWal) + } + } + return rc +} + +// Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32 +// values. This function populates the array with values required to +// "rollback" the write position of the WAL handle back to the current +// point in the event of a savepoint rollback (via WalSavepointUndo()). +func Xsqlite3WalSavepoint(tls *libc.TLS, pWal uintptr, aWalData uintptr) { /* sqlite3.c:63639:21: */ + + *(*U32)(unsafe.Pointer(aWalData)) = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + *(*U32)(unsafe.Pointer(aWalData + 1*4)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) + *(*U32)(unsafe.Pointer(aWalData + 2*4)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) + *(*U32)(unsafe.Pointer(aWalData + 3*4)) = (*Wal)(unsafe.Pointer(pWal)).FnCkpt +} + +// Move the write position of the WAL back to the point identified by +// the values in the aWalData[] array. aWalData must point to an array +// of WAL_SAVEPOINT_NDATA u32 values that has been previously populated +// by a call to WalSavepoint(). +func Xsqlite3WalSavepointUndo(tls *libc.TLS, pWal uintptr, aWalData uintptr) int32 { /* sqlite3.c:63653:20: */ + var rc int32 = SQLITE_OK + + if *(*U32)(unsafe.Pointer(aWalData + 3*4)) != (*Wal)(unsafe.Pointer(pWal)).FnCkpt { + // This savepoint was opened immediately after the write-transaction + // was started. Right after that, the writer decided to wrap around + // to the start of the log. Update the savepoint values to match. + *(*U32)(unsafe.Pointer(aWalData)) = U32(0) + *(*U32)(unsafe.Pointer(aWalData + 3*4)) = (*Wal)(unsafe.Pointer(pWal)).FnCkpt + } + + if *(*U32)(unsafe.Pointer(aWalData)) < (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame { + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = *(*U32)(unsafe.Pointer(aWalData)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = *(*U32)(unsafe.Pointer(aWalData + 1*4)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = *(*U32)(unsafe.Pointer(aWalData + 2*4)) + walCleanupHash(tls, pWal) + } + + return rc +} + +// This function is called just before writing a set of frames to the log +// file (see sqlite3WalFrames()). It checks to see if, instead of appending +// to the current log file, it is possible to overwrite the start of the +// existing log file with the new frames (i.e. "reset" the log). If so, +// it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left +// unchanged. +// +// SQLITE_OK is returned if no error is encountered (regardless of whether +// or not pWal->hdr.mxFrame is modified). An SQLite error code is returned +// if an error occurs. +func walRestartLog(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:63690:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var cnt int32 + + if int32((*Wal)(unsafe.Pointer(pWal)).FreadLock) == 0 { + var pInfo uintptr = walCkptInfo(tls, pWal) + + if (*WalCkptInfo)(unsafe.Pointer(libc.AtomicLoadUintptr(&pInfo))).FnBackfill > U32(0) { + // var salt1 U32 at bp, 4 + + Xsqlite3_randomness(tls, 4, bp /* &salt1 */) + rc = walLockExclusive(tls, pWal, (3 + (1)), ((SQLITE_SHM_NLOCK - 3) - 1)) + if rc == SQLITE_OK { + // If all readers are using WAL_READ_LOCK(0) (in other words if no + // readers are currently using the WAL), then the transactions + // frames will overwrite the start of the existing log. Update the + // wal-index header to reflect this. + // + // In theory it would be Ok to update the cache of the header only + // at this point. But updating the actual wal-index header is also + // safe and means there is no special case for sqlite3WalUndo() + // to handle if this transaction is rolled back. + walRestartHdr(tls, pWal, *(*U32)(unsafe.Pointer(bp /* salt1 */))) + walUnlockExclusive(tls, pWal, (3 + (1)), ((SQLITE_SHM_NLOCK - 3) - 1)) + } else if rc != SQLITE_BUSY { + return rc + } + } + walUnlockShared(tls, pWal, (3 + (0))) + (*Wal)(unsafe.Pointer(pWal)).FreadLock = int16(-1) + cnt = 0 + for ok := true; ok; ok = (rc == (-1)) { + // var notUsed int32 at bp+4, 4 + + rc = walTryBeginRead(tls, pWal, bp+4 /* ¬Used */, 1, libc.PreIncInt32(&cnt, 1)) + } + // BUSY not possible when useWal==1 + + } + return rc +} + +// Information about the current state of the WAL file and where +// the next fsync should occur - passed from sqlite3WalFrames() into +// walWriteToLog(). +type WalWriter1 = struct { + FpWal uintptr + FpFd uintptr + FiSyncPoint Sqlite3_int64 + FsyncFlags int32 + FszPage int32 +} /* sqlite3.c:63737:9 */ + +// Information about the current state of the WAL file and where +// the next fsync should occur - passed from sqlite3WalFrames() into +// walWriteToLog(). +type WalWriter = WalWriter1 /* sqlite3.c:63743:3 */ + +// Write iAmt bytes of content into the WAL file beginning at iOffset. +// Do a sync when crossing the p->iSyncPoint boundary. +// +// In other words, if iSyncPoint is in between iOffset and iOffset+iAmt, +// first write the part before iSyncPoint, then sync, then write the +// rest. +func walWriteToLog(tls *libc.TLS, p uintptr, pContent uintptr, iAmt int32, iOffset Sqlite3_int64) int32 { /* sqlite3.c:63753:12: */ + var rc int32 + if (iOffset < (*WalWriter)(unsafe.Pointer(p)).FiSyncPoint) && ((iOffset + Sqlite3_int64(iAmt)) >= (*WalWriter)(unsafe.Pointer(p)).FiSyncPoint) { + var iFirstAmt int32 = (int32((*WalWriter)(unsafe.Pointer(p)).FiSyncPoint - iOffset)) + rc = Xsqlite3OsWrite(tls, (*WalWriter)(unsafe.Pointer(p)).FpFd, pContent, iFirstAmt, iOffset) + if rc != 0 { + return rc + } + iOffset = iOffset + (Sqlite3_int64(iFirstAmt)) + iAmt = iAmt - (iFirstAmt) + pContent = (uintptr(iFirstAmt) + pContent) + + rc = Xsqlite3OsSync(tls, (*WalWriter)(unsafe.Pointer(p)).FpFd, (((*WalWriter)(unsafe.Pointer(p)).FsyncFlags) & 0x03)) + if (iAmt == 0) || (rc != 0) { + return rc + } + } + rc = Xsqlite3OsWrite(tls, (*WalWriter)(unsafe.Pointer(p)).FpFd, pContent, iAmt, iOffset) + return rc +} + +// Write out a single frame of the WAL +func walWriteOneFrame(tls *libc.TLS, p uintptr, pPage uintptr, nTruncate int32, iOffset Sqlite3_int64) int32 { /* sqlite3.c:63778:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 // Result code from subfunctions + var pData uintptr // Data actually written + // var aFrame [24]U8 at bp, 24 + // Buffer to assemble frame-header in + pData = (*PgHdr)(unsafe.Pointer(pPage)).FpData + walEncodeFrame(tls, (*WalWriter)(unsafe.Pointer(p)).FpWal, (*PgHdr)(unsafe.Pointer(pPage)).Fpgno, uint32(nTruncate), pData, bp /* &aFrame[0] */) + rc = walWriteToLog(tls, p, bp /* &aFrame[0] */, int32(unsafe.Sizeof([24]U8{})), iOffset) + if rc != 0 { + return rc + } + // Write the page data + rc = walWriteToLog(tls, p, pData, (*WalWriter)(unsafe.Pointer(p)).FszPage, (int64(uint64(iOffset) + uint64(unsafe.Sizeof([24]U8{}))))) + return rc +} + +// This function is called as part of committing a transaction within which +// one or more frames have been overwritten. It updates the checksums for +// all frames written to the wal file by the current transaction starting +// with the earliest to have been overwritten. +// +// SQLITE_OK is returned if successful, or an SQLite error code otherwise. +func walRewriteChecksums(tls *libc.TLS, pWal uintptr, iLast U32) int32 { /* sqlite3.c:63804:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var szPage int32 = int32((*Wal)(unsafe.Pointer(pWal)).FszPage) // Database page size + var rc int32 = SQLITE_OK // Return code + var aBuf uintptr // Buffer to load data from wal file into + // var aFrame [24]U8 at bp, 24 + // Buffer to assemble frame-headers in + var iRead U32 // Next frame to read from wal file + var iCksumOff I64 + + aBuf = Xsqlite3_malloc(tls, (szPage + WAL_FRAME_HDRSIZE)) + if aBuf == uintptr(0) { + return SQLITE_NOMEM + } + + // Find the checksum values to use as input for the recalculating the + // first checksum. If the first frame is frame 1 (implying that the current + // transaction restarted the wal file), these values must be read from the + // wal-file header. Otherwise, read them from the frame header of the + // previous frame. + + if (*Wal)(unsafe.Pointer(pWal)).FiReCksum == U32(1) { + iCksumOff = int64(24) + } else { + iCksumOff = ((int64(WAL_HDRSIZE) + ((I64(((*Wal)(unsafe.Pointer(pWal)).FiReCksum - U32(1)) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + int64(16)) + } + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, aBuf, (int32(uint64(unsafe.Sizeof(U32(0))) * uint64(2))), iCksumOff) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = Xsqlite3Get4byte(tls, aBuf) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = Xsqlite3Get4byte(tls, (aBuf + 4)) + + iRead = (*Wal)(unsafe.Pointer(pWal)).FiReCksum + (*Wal)(unsafe.Pointer(pWal)).FiReCksum = U32(0) + for ; (rc == SQLITE_OK) && (iRead <= iLast); iRead++ { + var iOff I64 = (int64(WAL_HDRSIZE) + ((I64((iRead) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, aBuf, (szPage + WAL_FRAME_HDRSIZE), iOff) + if rc == SQLITE_OK { + var iPgno U32 + var nDbSize U32 + iPgno = Xsqlite3Get4byte(tls, aBuf) + nDbSize = Xsqlite3Get4byte(tls, (aBuf + 4)) + + walEncodeFrame(tls, pWal, iPgno, nDbSize, (aBuf + 24), bp /* &aFrame[0] */) + rc = Xsqlite3OsWrite(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp /* &aFrame[0] */, int32(unsafe.Sizeof([24]U8{})), iOff) + } + } + + Xsqlite3_free(tls, aBuf) + return rc +} + +// Write a set of frames to the log. The caller must hold the write-lock +// on the log file (obtained using sqlite3WalBeginWriteTransaction()). +func Xsqlite3WalFrames(tls *libc.TLS, pWal uintptr, szPage int32, pList uintptr, nTruncate Pgno, isCommit int32, sync_flags int32) int32 { /* sqlite3.c:63853:20: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var rc int32 // Used to catch return codes + var iFrame U32 // Next frame address + var p uintptr // Iterator to run through pList with. + var pLast uintptr = uintptr(0) // Last frame in list + var nExtra int32 = 0 // Number of extra copies of last page + var szFrame int32 // The size of a single frame + var iOffset I64 // Next byte to write in WAL file + // var w WalWriter at bp+48, 32 + // The writer + var iFirst U32 = U32(0) // First frame that may be overwritten + var pLive uintptr // Pointer to shared header + + // If this frame set completes a transaction, then nTruncate>0. If + // nTruncate==0 then this frame set does not complete the transaction. + + pLive = walIndexHdr(tls, pWal) + if (libc.Xmemcmp(tls, (pWal+72 /* &.hdr */), pLive, uint64(unsafe.Sizeof(WalIndexHdr{}))) != 0) { + iFirst = ((*WalIndexHdr)(unsafe.Pointer(pLive)).FmxFrame + U32(1)) + } + + // See if it is possible to write these frames into the start of the + // log file, instead of appending to it at pWal->hdr.mxFrame. + if SQLITE_OK != (libc.AssignInt32(&rc, walRestartLog(tls, pWal))) { + return rc + } + + // If this is the first frame written into the log, write the WAL + // header to the start of the WAL file. See comments at the top of + // this source file for a description of the WAL header format. + iFrame = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + if iFrame == U32(0) { + // var aWalHdr [32]U8 at bp, 32 + // Buffer to assemble wal-header in + // var aCksum [2]U32 at bp+32, 8 + // Checksum for wal-header + + Xsqlite3Put4byte(tls, (bp /* &aWalHdr */), (uint32(WAL_MAGIC | SQLITE_BIGENDIAN))) + Xsqlite3Put4byte(tls, (bp /* &aWalHdr */ + 4), uint32(WAL_MAX_VERSION)) + Xsqlite3Put4byte(tls, (bp /* &aWalHdr */ + 8), uint32(szPage)) + Xsqlite3Put4byte(tls, (bp /* &aWalHdr */ + 12), (*Wal)(unsafe.Pointer(pWal)).FnCkpt) + if (*Wal)(unsafe.Pointer(pWal)).FnCkpt == U32(0) { + Xsqlite3_randomness(tls, 8, pWal+72 /* &.hdr */ +32 /* &.aSalt */) + } + libc.Xmemcpy(tls, (bp /* &aWalHdr */ + 16), pWal+72 /* &.hdr */ +32 /* &.aSalt */, uint64(8)) + walChecksumBytes(tls, 1, bp /* &aWalHdr[0] */, (WAL_HDRSIZE - (2 * 4)), uintptr(0), bp+32 /* &aCksum[0] */) + Xsqlite3Put4byte(tls, (bp /* &aWalHdr */ + 24), *(*U32)(unsafe.Pointer(bp + 32 /* &aCksum[0] */))) + Xsqlite3Put4byte(tls, (bp /* &aWalHdr */ + 28), *(*U32)(unsafe.Pointer(bp + 32 /* &aCksum[0] */ + 1*4))) + + (*Wal)(unsafe.Pointer(pWal)).FszPage = U32(szPage) + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum = U8(SQLITE_BIGENDIAN) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = *(*U32)(unsafe.Pointer(bp + 32 /* &aCksum[0] */)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = *(*U32)(unsafe.Pointer(bp + 32 /* &aCksum[0] */ + 1*4)) + (*Wal)(unsafe.Pointer(pWal)).FtruncateOnCommit = U8(1) + + rc = Xsqlite3OsWrite(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp /* &aWalHdr[0] */, int32(unsafe.Sizeof([32]U8{})), int64(0)) + + if rc != SQLITE_OK { + return rc + } + + // Sync the header (unless SQLITE_IOCAP_SEQUENTIAL is true or unless + // all syncing is turned off by PRAGMA synchronous=OFF). Otherwise + // an out-of-order write following a WAL restart could result in + // database corruption. See the ticket: + // + // https://sqlite.org/src/info/ff5be73dee + if (*Wal)(unsafe.Pointer(pWal)).FsyncHeader != 0 { + rc = Xsqlite3OsSync(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, (((sync_flags) >> 2) & 0x03)) + if rc != 0 { + return rc + } + } + } + + // Setup information needed to write frames into the WAL + (*WalWriter)(unsafe.Pointer(bp + 48 /* &w */)).FpWal = pWal + (*WalWriter)(unsafe.Pointer(bp + 48 /* &w */)).FpFd = (*Wal)(unsafe.Pointer(pWal)).FpWalFd + (*WalWriter)(unsafe.Pointer(bp + 48 /* &w */)).FiSyncPoint = int64(0) + (*WalWriter)(unsafe.Pointer(bp + 48 /* &w */)).FsyncFlags = sync_flags + (*WalWriter)(unsafe.Pointer(bp + 48 /* &w */)).FszPage = szPage + iOffset = (int64(WAL_HDRSIZE) + ((I64((iFrame + U32(1)) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + szFrame = (szPage + WAL_FRAME_HDRSIZE) + + // Write all frames into the log file exactly once + for p = pList; p != 0; p = (*PgHdr)(unsafe.Pointer(p)).FpDirty { + var nDbSize int32 // 0 normally. Positive == commit flag + + // Check if this page has already been written into the wal file by + // the current transaction. If so, overwrite the existing frame and + // set Wal.writeLock to WAL_WRITELOCK_RECKSUM - indicating that + // checksums must be recomputed when the transaction is committed. + if (iFirst != 0) && (((*PgHdr)(unsafe.Pointer(p)).FpDirty != 0) || (isCommit == 0)) { + *(*U32)(unsafe.Pointer(bp + 40 /* iWrite */)) = U32(0) + Xsqlite3WalFindFrame(tls, pWal, (*PgHdr)(unsafe.Pointer(p)).Fpgno, bp+40 /* &iWrite */) + + if *(*U32)(unsafe.Pointer(bp + 40 /* iWrite */)) >= iFirst { + var iOff I64 = ((int64(WAL_HDRSIZE) + ((I64((*(*U32)(unsafe.Pointer(bp + 40 /* iWrite */))) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + int64(WAL_FRAME_HDRSIZE)) + var pData uintptr + if ((*Wal)(unsafe.Pointer(pWal)).FiReCksum == U32(0)) || (*(*U32)(unsafe.Pointer(bp + 40 /* iWrite */)) < (*Wal)(unsafe.Pointer(pWal)).FiReCksum) { + (*Wal)(unsafe.Pointer(pWal)).FiReCksum = *(*U32)(unsafe.Pointer(bp + 40 /* iWrite */)) + } + pData = (*PgHdr)(unsafe.Pointer(p)).FpData + rc = Xsqlite3OsWrite(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, pData, szPage, iOff) + if rc != 0 { + return rc + } + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(PGHDR_WAL_APPEND))) + continue + } + } + + iFrame++ + + if (isCommit != 0) && ((*PgHdr)(unsafe.Pointer(p)).FpDirty == uintptr(0)) { + nDbSize = int32(nTruncate) + } else { + nDbSize = 0 + } + rc = walWriteOneFrame(tls, bp+48 /* &w */, p, nDbSize, iOffset) + if rc != 0 { + return rc + } + pLast = p + iOffset = iOffset + (I64(szFrame)) + *(*U16)(unsafe.Pointer(p + 52 /* &.flags */)) |= U16((PGHDR_WAL_APPEND)) + } + + // Recalculate checksums within the wal file if required. + if (isCommit != 0) && ((*Wal)(unsafe.Pointer(pWal)).FiReCksum != 0) { + rc = walRewriteChecksums(tls, pWal, iFrame) + if rc != 0 { + return rc + } + } + + // If this is the end of a transaction, then we might need to pad + // the transaction and/or sync the WAL file. + // + // Padding and syncing only occur if this set of frames complete a + // transaction and if PRAGMA synchronous=FULL. If synchronous==NORMAL + // or synchronous==OFF, then no padding or syncing are needed. + // + // If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not + // needed and only the sync is done. If padding is needed, then the + // final frame is repeated (with its commit mark) until the next sector + // boundary is crossed. Only the part of the WAL prior to the last + // sector boundary is synced; the part of the last frame that extends + // past the sector boundary is written after the sync. + if (isCommit != 0) && (((sync_flags) & 0x03) != 0) { + var bSync int32 = 1 + if (*Wal)(unsafe.Pointer(pWal)).FpadToSectorBoundary != 0 { + var sectorSize int32 = Xsqlite3SectorSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd) + (*WalWriter)(unsafe.Pointer(bp + 48 /* &w */)).FiSyncPoint = ((((iOffset + I64(sectorSize)) - int64(1)) / I64(sectorSize)) * I64(sectorSize)) + bSync = (libc.Bool32((*WalWriter)(unsafe.Pointer(bp+48 /* &w */)).FiSyncPoint == iOffset)) + + for iOffset < (*WalWriter)(unsafe.Pointer(bp+48 /* &w */)).FiSyncPoint { + rc = walWriteOneFrame(tls, bp+48 /* &w */, pLast, int32(nTruncate), iOffset) + if rc != 0 { + return rc + } + iOffset = iOffset + (I64(szFrame)) + nExtra++ + + } + } + if bSync != 0 { + + rc = Xsqlite3OsSync(tls, (*WalWriter)(unsafe.Pointer(bp+48 /* &w */)).FpFd, ((sync_flags) & 0x03)) + } + } + + // If this frame set completes the first transaction in the WAL and + // if PRAGMA journal_size_limit is set, then truncate the WAL to the + // journal size limit, if possible. + if ((isCommit != 0) && ((*Wal)(unsafe.Pointer(pWal)).FtruncateOnCommit != 0)) && ((*Wal)(unsafe.Pointer(pWal)).FmxWalSize >= int64(0)) { + var sz I64 = (*Wal)(unsafe.Pointer(pWal)).FmxWalSize + if (int64(WAL_HDRSIZE) + ((I64(((iFrame + U32(nExtra)) + U32(1)) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) > (*Wal)(unsafe.Pointer(pWal)).FmxWalSize { + sz = (int64(WAL_HDRSIZE) + ((I64(((iFrame + U32(nExtra)) + U32(1)) - U32(1))) * (I64((szPage) + WAL_FRAME_HDRSIZE)))) + } + walLimitSize(tls, pWal, sz) + (*Wal)(unsafe.Pointer(pWal)).FtruncateOnCommit = U8(0) + } + + // Append data to the wal-index. It is not necessary to lock the + // wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index + // guarantees that there are no other writers, and no data that may + // be in use by existing readers is being overwritten. + iFrame = (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame + for p = pList; (p != 0) && (rc == SQLITE_OK); p = (*PgHdr)(unsafe.Pointer(p)).FpDirty { + if (int32((*PgHdr)(unsafe.Pointer(p)).Fflags) & PGHDR_WAL_APPEND) == 0 { + continue + } + iFrame++ + rc = walIndexAppend(tls, pWal, iFrame, (*PgHdr)(unsafe.Pointer(p)).Fpgno) + } + + for (rc == SQLITE_OK) && (nExtra > 0) { + iFrame++ + nExtra-- + rc = walIndexAppend(tls, pWal, iFrame, (*PgHdr)(unsafe.Pointer(pLast)).Fpgno) + } + + if rc == SQLITE_OK { + // Update the private copy of the header. + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage = (U16((szPage & 0xff00) | (szPage >> 16))) + + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = iFrame + if isCommit != 0 { + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FiChange++ + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage = nTruncate + } + // If this is a commit, update the wal-index header too. + if isCommit != 0 { + walIndexWriteHdr(tls, pWal) + (*Wal)(unsafe.Pointer(pWal)).FiCallback = iFrame + } + } + + return rc +} + +// This routine is called to implement sqlite3_wal_checkpoint() and +// related interfaces. +// +// Obtain a CHECKPOINT lock and then backfill as much information as +// we can from WAL into the database. +// +// If parameter xBusy is not NULL, it is a pointer to a busy-handler +// callback. In this case this function runs a blocking checkpoint. +func Xsqlite3WalCheckpoint(tls *libc.TLS, pWal uintptr, db uintptr, eMode int32, xBusy uintptr, pBusyArg uintptr, sync_flags int32, nBuf int32, zBuf uintptr, pnLog uintptr, pnCkpt uintptr) int32 { /* sqlite3.c:64091:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 // Return code + *(*int32)(unsafe.Pointer(bp /* isChanged */)) = 0 // True if a new wal-index header is loaded + var eMode2 int32 = eMode // Mode to pass to walCheckpoint() + var xBusy2 uintptr = xBusy // Busy handler for eMode2 + + // EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked + // in the SQLITE_CHECKPOINT_PASSIVE mode. + + if (*Wal)(unsafe.Pointer(pWal)).FreadOnly != 0 { + return SQLITE_READONLY + } + + // Enable blocking locks, if possible. If blocking locks are successfully + // enabled, set xBusy2=0 so that the busy-handler is never invoked. + + // IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive + // "checkpoint" lock on the database file. + // EVIDENCE-OF: R-10421-19736 If any other process is running a + // checkpoint operation at the same time, the lock cannot be obtained and + // SQLITE_BUSY is returned. + // EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured, + // it will not be invoked in this case. + rc = walLockExclusive(tls, pWal, WAL_CKPT_LOCK, 1) + + if rc == SQLITE_OK { + (*Wal)(unsafe.Pointer(pWal)).FckptLock = U8(1) + + // IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and + // TRUNCATE modes also obtain the exclusive "writer" lock on the database + // file. + // + // EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained + // immediately, and a busy-handler is configured, it is invoked and the + // writer lock retried until either the busy-handler returns 0 or the + // lock is successfully obtained. + if eMode != SQLITE_CHECKPOINT_PASSIVE { + rc = walBusyLock(tls, pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, 1) + if rc == SQLITE_OK { + (*Wal)(unsafe.Pointer(pWal)).FwriteLock = U8(1) + } else if rc == SQLITE_BUSY { + eMode2 = SQLITE_CHECKPOINT_PASSIVE + xBusy2 = uintptr(0) + rc = SQLITE_OK + } + } + } + + // Read the wal-index header. + if rc == SQLITE_OK { + + rc = walIndexReadHdr(tls, pWal, bp /* &isChanged */) + + if (*(*int32)(unsafe.Pointer(bp /* isChanged */)) != 0) && ((*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FpDbFd)).FpMethods)).FiVersion >= 3) { + Xsqlite3OsUnfetch(tls, (*Wal)(unsafe.Pointer(pWal)).FpDbFd, int64(0), uintptr(0)) + } + } + + // Copy data from the log to the database file. + if rc == SQLITE_OK { + + if ((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame != 0) && (walPagesize(tls, pWal) != nBuf) { + rc = Xsqlite3CorruptError(tls, 64173) + } else { + rc = walCheckpoint(tls, pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf) + } + + // If no error occurred, set the output variables. + if (rc == SQLITE_OK) || (rc == SQLITE_BUSY) { + if pnLog != 0 { + *(*int32)(unsafe.Pointer(pnLog)) = int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame) + } + if pnCkpt != 0 { + *(*int32)(unsafe.Pointer(pnCkpt)) = int32((*WalCkptInfo)(unsafe.Pointer(walCkptInfo(tls, pWal))).FnBackfill) + } + } + } + + if *(*int32)(unsafe.Pointer(bp /* isChanged */)) != 0 { + // If a new wal-index header was loaded before the checkpoint was + // performed, then the pager-cache associated with pWal is now + // out of date. So zero the cached wal-index header to ensure that + // next time the pager opens a snapshot on this database it knows that + // the cache needs to be reset. + libc.Xmemset(tls, (pWal + 72 /* &.hdr */), 0, uint64(unsafe.Sizeof(WalIndexHdr{}))) + } + + // Release the locks. + Xsqlite3WalEndWriteTransaction(tls, pWal) + if (*Wal)(unsafe.Pointer(pWal)).FckptLock != 0 { + walUnlockExclusive(tls, pWal, WAL_CKPT_LOCK, 1) + (*Wal)(unsafe.Pointer(pWal)).FckptLock = U8(0) + } + + return func() int32 { + if (rc == SQLITE_OK) && (eMode != eMode2) { + return SQLITE_BUSY + } + return rc + }() +} + +// Return the value to pass to a sqlite3_wal_hook callback, the +// number of frames in the WAL at the point of the last commit since +// sqlite3WalCallback() was called. If no commits have occurred since +// the last call, then return 0. +func Xsqlite3WalCallback(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:64216:20: */ + var ret U32 = U32(0) + if pWal != 0 { + ret = (*Wal)(unsafe.Pointer(pWal)).FiCallback + (*Wal)(unsafe.Pointer(pWal)).FiCallback = U32(0) + } + return int32(ret) +} + +// This function is called to change the WAL subsystem into or out +// of locking_mode=EXCLUSIVE. +// +// If op is zero, then attempt to change from locking_mode=EXCLUSIVE +// into locking_mode=NORMAL. This means that we must acquire a lock +// on the pWal->readLock byte. If the WAL is already in locking_mode=NORMAL +// or if the acquisition of the lock fails, then return 0. If the +// transition out of exclusive-mode is successful, return 1. This +// operation must occur while the pager is still holding the exclusive +// lock on the main database file. +// +// If op is one, then change from locking_mode=NORMAL into +// locking_mode=EXCLUSIVE. This means that the pWal->readLock must +// be released. Return 1 if the transition is made and 0 if the +// WAL is already in exclusive-locking mode - meaning that this +// routine is a no-op. The pager must already hold the exclusive lock +// on the main database file before invoking this operation. +// +// If op is negative, then do a dry-run of the op==1 case but do +// not actually change anything. The pager uses this to see if it +// should acquire the database exclusive lock prior to invoking +// the op==1 case. +func Xsqlite3WalExclusiveMode(tls *libc.TLS, pWal uintptr, op int32) int32 { /* sqlite3.c:64249:20: */ + var rc int32 + + // pWal->readLock is usually set, but might be -1 if there was a + // prior error while attempting to acquire are read-lock. This cannot + // happen if the connection is actually in exclusive mode (as no xShmLock + // locks are taken in this case). Nor should the pager attempt to + // upgrade to exclusive-mode following such an error. + + if op == 0 { + if int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) != WAL_NORMAL_MODE { + (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode = U8(WAL_NORMAL_MODE) + if walLockShared(tls, pWal, (3+(int32((*Wal)(unsafe.Pointer(pWal)).FreadLock)))) != SQLITE_OK { + (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode = U8(WAL_EXCLUSIVE_MODE) + } + rc = (libc.Bool32(int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_NORMAL_MODE)) + } else { + // Already in locking_mode=NORMAL + rc = 0 + } + } else if op > 0 { + + walUnlockShared(tls, pWal, (3 + (int32((*Wal)(unsafe.Pointer(pWal)).FreadLock)))) + (*Wal)(unsafe.Pointer(pWal)).FexclusiveMode = U8(WAL_EXCLUSIVE_MODE) + rc = 1 + } else { + rc = (libc.Bool32(int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_NORMAL_MODE)) + } + return rc +} + +// Return true if the argument is non-NULL and the WAL module is using +// heap-memory for the wal-index. Otherwise, if the argument is NULL or the +// WAL module is using shared-memory, return false. +func Xsqlite3WalHeapMemory(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:64291:20: */ + return (libc.Bool32((pWal != 0) && (int32((*Wal)(unsafe.Pointer(pWal)).FexclusiveMode) == WAL_HEAPMEMORY_MODE))) +} + +// Create a snapshot object. The content of a snapshot is opaque to +// every other subsystem, so the WAL module can put whatever it needs +// in the object. +func Xsqlite3WalSnapshotGet(tls *libc.TLS, pWal uintptr, ppSnapshot uintptr) int32 { /* sqlite3.c:64300:20: */ + var rc int32 = SQLITE_OK + var pRet uintptr + + if libc.Xmemcmp(tls, (pWal+72 /* &.hdr */ +24 /* &.aFrameCksum */), uintptr(unsafe.Pointer(&aZero)), uint64(16)) == 0 { + *(*uintptr)(unsafe.Pointer(ppSnapshot)) = uintptr(0) + return SQLITE_ERROR + } + pRet = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(WalIndexHdr{}))) + if pRet == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemcpy(tls, pRet, (pWal + 72 /* &.hdr */), uint64(unsafe.Sizeof(WalIndexHdr{}))) + *(*uintptr)(unsafe.Pointer(ppSnapshot)) = pRet + } + + return rc +} + +var aZero = [4]U32{U32(0), U32(0), U32(0), U32(0)} /* sqlite3.c:64303:20 */ + +// Try to open on pSnapshot when the next read-transaction starts +func Xsqlite3WalSnapshotOpen(tls *libc.TLS, pWal uintptr, pSnapshot uintptr) { /* sqlite3.c:64324:21: */ + (*Wal)(unsafe.Pointer(pWal)).FpSnapshot = pSnapshot +} + +// Return a +ve value if snapshot p1 is newer than p2. A -ve value if +// p1 is older than p2 and zero if p1 and p2 are the same snapshot. +func Xsqlite3_snapshot_cmp(tls *libc.TLS, p1 uintptr, p2 uintptr) int32 { /* sqlite3.c:64335:16: */ + var pHdr1 uintptr = p1 + var pHdr2 uintptr = p2 + + // aSalt[0] is a copy of the value stored in the wal file header. It + // is incremented each time the wal file is restarted. + if *(*U32)(unsafe.Pointer((pHdr1 + 32 /* &.aSalt */))) < *(*U32)(unsafe.Pointer((pHdr2 + 32 /* &.aSalt */))) { + return -1 + } + if *(*U32)(unsafe.Pointer((pHdr1 + 32 /* &.aSalt */))) > *(*U32)(unsafe.Pointer((pHdr2 + 32 /* &.aSalt */))) { + return +1 + } + if (*WalIndexHdr)(unsafe.Pointer(pHdr1)).FmxFrame < (*WalIndexHdr)(unsafe.Pointer(pHdr2)).FmxFrame { + return -1 + } + if (*WalIndexHdr)(unsafe.Pointer(pHdr1)).FmxFrame > (*WalIndexHdr)(unsafe.Pointer(pHdr2)).FmxFrame { + return +1 + } + return 0 +} + +// The caller currently has a read transaction open on the database. +// This function takes a SHARED lock on the CHECKPOINTER slot and then +// checks if the snapshot passed as the second argument is still +// available. If so, SQLITE_OK is returned. +// +// If the snapshot is not available, SQLITE_ERROR is returned. Or, if +// the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error +// occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER +// lock is released before returning. +func Xsqlite3WalSnapshotCheck(tls *libc.TLS, pWal uintptr, pSnapshot uintptr) int32 { /* sqlite3.c:64359:20: */ + var rc int32 + rc = walLockShared(tls, pWal, WAL_CKPT_LOCK) + if rc == SQLITE_OK { + var pNew uintptr = pSnapshot + if (libc.Xmemcmp(tls, pNew+32 /* &.aSalt */, pWal+72 /* &.hdr */ +32 /* &.aSalt */, uint64(unsafe.Sizeof([2]U32{}))) != 0) || + ((*WalIndexHdr)(unsafe.Pointer(pNew)).FmxFrame < (*WalCkptInfo)(unsafe.Pointer(walCkptInfo(tls, pWal))).FnBackfillAttempted) { + rc = (SQLITE_ERROR | (int32(3) << 8)) + walUnlockShared(tls, pWal, WAL_CKPT_LOCK) + } + } + return rc +} + +// Release a lock obtained by an earlier successful call to +// sqlite3WalSnapshotCheck(). +func Xsqlite3WalSnapshotUnlock(tls *libc.TLS, pWal uintptr) { /* sqlite3.c:64378:21: */ + + walUnlockShared(tls, pWal, WAL_CKPT_LOCK) +} + +// Return the sqlite3_file object for the WAL file +func Xsqlite3WalFile(tls *libc.TLS, pWal uintptr) uintptr { /* sqlite3.c:64400:29: */ + return (*Wal)(unsafe.Pointer(pWal)).FpWalFd +} + +//************* End of wal.c ************************************************ +//************* Begin file btmutex.c **************************************** +// 2007 August 27 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code used to implement mutexes on Btree objects. +// This code really belongs in btree.c. But btree.c is getting too +// big and we want to break it down some. This packaged seemed like +// a good breakout. +//************* Include btreeInt.h in the middle of btmutex.c *************** +//************* Begin file btreeInt.h *************************************** +// 2004 April 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file implements an external (disk-based) database using BTrees. +// For a detailed discussion of BTrees, refer to +// +// Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3: +// "Sorting And Searching", pages 473-480. Addison-Wesley +// Publishing Company, Reading, Massachusetts. +// +// The basic idea is that each page of the file contains N database +// entries and N+1 pointers to subpages. +// +// ---------------------------------------------------------------- +// | Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) | +// ---------------------------------------------------------------- +// +// All of the keys on the page that Ptr(0) points to have values less +// than Key(0). All of the keys on page Ptr(1) and its subpages have +// values greater than Key(0) and less than Key(1). All of the keys +// on Ptr(N) and its subpages have values greater than Key(N-1). And +// so forth. +// +// Finding a particular key requires reading O(log(M)) pages from the +// disk where M is the number of entries in the tree. +// +// In this implementation, a single file can hold one or more separate +// BTrees. Each BTree is identified by the index of its root page. The +// key and data for any entry are combined to form the "payload". A +// fixed amount of payload can be carried directly on the database +// page. If the payload is larger than the preset amount then surplus +// bytes are stored on overflow pages. The payload for an entry +// and the preceding pointer are combined to form a "Cell". Each +// page has a small header which contains the Ptr(N) pointer and other +// information such as the size of key and data. +// +// FORMAT DETAILS +// +// The file is divided into pages. The first page is called page 1, +// the second is page 2, and so forth. A page number of zero indicates +// "no such page". The page size can be any power of 2 between 512 and 65536. +// Each page can be either a btree page, a freelist page, an overflow +// page, or a pointer-map page. +// +// The first page is always a btree page. The first 100 bytes of the first +// page contain a special header (the "file header") that describes the file. +// The format of the file header is as follows: +// +// OFFSET SIZE DESCRIPTION +// 0 16 Header string: "SQLite format 3\000" +// 16 2 Page size in bytes. (1 means 65536) +// 18 1 File format write version +// 19 1 File format read version +// 20 1 Bytes of unused space at the end of each page +// 21 1 Max embedded payload fraction (must be 64) +// 22 1 Min embedded payload fraction (must be 32) +// 23 1 Min leaf payload fraction (must be 32) +// 24 4 File change counter +// 28 4 Reserved for future use +// 32 4 First freelist page +// 36 4 Number of freelist pages in the file +// 40 60 15 4-byte meta values passed to higher layers +// +// 40 4 Schema cookie +// 44 4 File format of schema layer +// 48 4 Size of page cache +// 52 4 Largest root-page (auto/incr_vacuum) +// 56 4 1=UTF-8 2=UTF16le 3=UTF16be +// 60 4 User version +// 64 4 Incremental vacuum mode +// 68 4 Application-ID +// 72 20 unused +// 92 4 The version-valid-for number +// 96 4 SQLITE_VERSION_NUMBER +// +// All of the integer values are big-endian (most significant byte first). +// +// The file change counter is incremented when the database is changed +// This counter allows other processes to know when the file has changed +// and thus when they need to flush their cache. +// +// The max embedded payload fraction is the amount of the total usable +// space in a page that can be consumed by a single cell for standard +// B-tree (non-LEAFDATA) tables. A value of 255 means 100%. The default +// is to limit the maximum cell size so that at least 4 cells will fit +// on one page. Thus the default max embedded payload fraction is 64. +// +// If the payload for a cell is larger than the max payload, then extra +// payload is spilled to overflow pages. Once an overflow page is allocated, +// as many bytes as possible are moved into the overflow pages without letting +// the cell size drop below the min embedded payload fraction. +// +// The min leaf payload fraction is like the min embedded payload fraction +// except that it applies to leaf nodes in a LEAFDATA tree. The maximum +// payload fraction for a LEAFDATA tree is always 100% (or 255) and it +// not specified in the header. +// +// Each btree pages is divided into three sections: The header, the +// cell pointer array, and the cell content area. Page 1 also has a 100-byte +// file header that occurs before the page header. +// +// |----------------| +// | file header | 100 bytes. Page 1 only. +// |----------------| +// | page header | 8 bytes for leaves. 12 bytes for interior nodes +// |----------------| +// | cell pointer | | 2 bytes per cell. Sorted order. +// | array | | Grows downward +// | | v +// |----------------| +// | unallocated | +// | space | +// |----------------| ^ Grows upwards +// | cell content | | Arbitrary order interspersed with freeblocks. +// | area | | and free space fragments. +// |----------------| +// +// The page headers looks like this: +// +// OFFSET SIZE DESCRIPTION +// 0 1 Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf +// 1 2 byte offset to the first freeblock +// 3 2 number of cells on this page +// 5 2 first byte of the cell content area +// 7 1 number of fragmented free bytes +// 8 4 Right child (the Ptr(N) value). Omitted on leaves. +// +// The flags define the format of this btree page. The leaf flag means that +// this page has no children. The zerodata flag means that this page carries +// only keys and no data. The intkey flag means that the key is an integer +// which is stored in the key size entry of the cell header rather than in +// the payload area. +// +// The cell pointer array begins on the first byte after the page header. +// The cell pointer array contains zero or more 2-byte numbers which are +// offsets from the beginning of the page to the cell content in the cell +// content area. The cell pointers occur in sorted order. The system strives +// to keep free space after the last cell pointer so that new cells can +// be easily added without having to defragment the page. +// +// Cell content is stored at the very end of the page and grows toward the +// beginning of the page. +// +// Unused space within the cell content area is collected into a linked list of +// freeblocks. Each freeblock is at least 4 bytes in size. The byte offset +// to the first freeblock is given in the header. Freeblocks occur in +// increasing order. Because a freeblock must be at least 4 bytes in size, +// any group of 3 or fewer unused bytes in the cell content area cannot +// exist on the freeblock chain. A group of 3 or fewer free bytes is called +// a fragment. The total number of bytes in all fragments is recorded. +// in the page header at offset 7. +// +// SIZE DESCRIPTION +// 2 Byte offset of the next freeblock +// 2 Bytes in this freeblock +// +// Cells are of variable length. Cells are stored in the cell content area at +// the end of the page. Pointers to the cells are in the cell pointer array +// that immediately follows the page header. Cells is not necessarily +// contiguous or in order, but cell pointers are contiguous and in order. +// +// Cell content makes use of variable length integers. A variable +// length integer is 1 to 9 bytes where the lower 7 bits of each +// byte are used. The integer consists of all bytes that have bit 8 set and +// the first byte with bit 8 clear. The most significant byte of the integer +// appears first. A variable-length integer may not be more than 9 bytes long. +// As a special case, all 8 bytes of the 9th byte are used as data. This +// allows a 64-bit integer to be encoded in 9 bytes. +// +// 0x00 becomes 0x00000000 +// 0x7f becomes 0x0000007f +// 0x81 0x00 becomes 0x00000080 +// 0x82 0x00 becomes 0x00000100 +// 0x80 0x7f becomes 0x0000007f +// 0x8a 0x91 0xd1 0xac 0x78 becomes 0x12345678 +// 0x81 0x81 0x81 0x81 0x01 becomes 0x10204081 +// +// Variable length integers are used for rowids and to hold the number of +// bytes of key and data in a btree cell. +// +// The content of a cell looks like this: +// +// SIZE DESCRIPTION +// 4 Page number of the left child. Omitted if leaf flag is set. +// var Number of bytes of data. Omitted if the zerodata flag is set. +// var Number of bytes of key. Or the key itself if intkey flag is set. +// * Payload +// 4 First page of the overflow chain. Omitted if no overflow +// +// Overflow pages form a linked list. Each page except the last is completely +// filled with data (pagesize - 4 bytes). The last page can have as little +// as 1 byte of data. +// +// SIZE DESCRIPTION +// 4 Page number of next overflow page +// * Data +// +// Freelist pages come in two subtypes: trunk pages and leaf pages. The +// file header points to the first in a linked list of trunk page. Each trunk +// page points to multiple leaf pages. The content of a leaf page is +// unspecified. A trunk page looks like this: +// +// SIZE DESCRIPTION +// 4 Page number of next trunk page +// 4 Number of leaf pointers on this page +// * zero or more pages numbers of leaves +// #include "sqliteInt.h" + +// The following value is the maximum cell size assuming a maximum page +// size give above. + +// The maximum number of cells on a single page of the database. This +// assumes a minimum cell size of 6 bytes (4 bytes for the cell itself +// plus 2 bytes for the index to the cell in the page header). Such +// small cells will be rare, but they are possible. + +// Forward declarations +type MemPage1 = struct { + FisInit U8 + FbBusy U8 + FintKey U8 + FintKeyLeaf U8 + Fpgno Pgno + Fleaf U8 + FhdrOffset U8 + FchildPtrSize U8 + Fmax1bytePayload U8 + FnOverflow U8 + _ [1]byte + FmaxLocal U16 + FminLocal U16 + FcellOffset U16 + FnFree int32 + FnCell U16 + FmaskPage U16 + FaiOvfl [4]U16 + _ [4]byte + FapOvfl [4]uintptr + FpBt uintptr + FaData uintptr + FaDataEnd uintptr + FaCellIdx uintptr + FaDataOfst uintptr + FpDbPage uintptr + FxCellSize uintptr + FxParseCell uintptr +} /* sqlite3.c:1331:9 */ + +//************* End of wal.c ************************************************ +//************* Begin file btmutex.c **************************************** +// 2007 August 27 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code used to implement mutexes on Btree objects. +// This code really belongs in btree.c. But btree.c is getting too +// big and we want to break it down some. This packaged seemed like +// a good breakout. +//************* Include btreeInt.h in the middle of btmutex.c *************** +//************* Begin file btreeInt.h *************************************** +// 2004 April 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file implements an external (disk-based) database using BTrees. +// For a detailed discussion of BTrees, refer to +// +// Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3: +// "Sorting And Searching", pages 473-480. Addison-Wesley +// Publishing Company, Reading, Massachusetts. +// +// The basic idea is that each page of the file contains N database +// entries and N+1 pointers to subpages. +// +// ---------------------------------------------------------------- +// | Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) | +// ---------------------------------------------------------------- +// +// All of the keys on the page that Ptr(0) points to have values less +// than Key(0). All of the keys on page Ptr(1) and its subpages have +// values greater than Key(0) and less than Key(1). All of the keys +// on Ptr(N) and its subpages have values greater than Key(N-1). And +// so forth. +// +// Finding a particular key requires reading O(log(M)) pages from the +// disk where M is the number of entries in the tree. +// +// In this implementation, a single file can hold one or more separate +// BTrees. Each BTree is identified by the index of its root page. The +// key and data for any entry are combined to form the "payload". A +// fixed amount of payload can be carried directly on the database +// page. If the payload is larger than the preset amount then surplus +// bytes are stored on overflow pages. The payload for an entry +// and the preceding pointer are combined to form a "Cell". Each +// page has a small header which contains the Ptr(N) pointer and other +// information such as the size of key and data. +// +// FORMAT DETAILS +// +// The file is divided into pages. The first page is called page 1, +// the second is page 2, and so forth. A page number of zero indicates +// "no such page". The page size can be any power of 2 between 512 and 65536. +// Each page can be either a btree page, a freelist page, an overflow +// page, or a pointer-map page. +// +// The first page is always a btree page. The first 100 bytes of the first +// page contain a special header (the "file header") that describes the file. +// The format of the file header is as follows: +// +// OFFSET SIZE DESCRIPTION +// 0 16 Header string: "SQLite format 3\000" +// 16 2 Page size in bytes. (1 means 65536) +// 18 1 File format write version +// 19 1 File format read version +// 20 1 Bytes of unused space at the end of each page +// 21 1 Max embedded payload fraction (must be 64) +// 22 1 Min embedded payload fraction (must be 32) +// 23 1 Min leaf payload fraction (must be 32) +// 24 4 File change counter +// 28 4 Reserved for future use +// 32 4 First freelist page +// 36 4 Number of freelist pages in the file +// 40 60 15 4-byte meta values passed to higher layers +// +// 40 4 Schema cookie +// 44 4 File format of schema layer +// 48 4 Size of page cache +// 52 4 Largest root-page (auto/incr_vacuum) +// 56 4 1=UTF-8 2=UTF16le 3=UTF16be +// 60 4 User version +// 64 4 Incremental vacuum mode +// 68 4 Application-ID +// 72 20 unused +// 92 4 The version-valid-for number +// 96 4 SQLITE_VERSION_NUMBER +// +// All of the integer values are big-endian (most significant byte first). +// +// The file change counter is incremented when the database is changed +// This counter allows other processes to know when the file has changed +// and thus when they need to flush their cache. +// +// The max embedded payload fraction is the amount of the total usable +// space in a page that can be consumed by a single cell for standard +// B-tree (non-LEAFDATA) tables. A value of 255 means 100%. The default +// is to limit the maximum cell size so that at least 4 cells will fit +// on one page. Thus the default max embedded payload fraction is 64. +// +// If the payload for a cell is larger than the max payload, then extra +// payload is spilled to overflow pages. Once an overflow page is allocated, +// as many bytes as possible are moved into the overflow pages without letting +// the cell size drop below the min embedded payload fraction. +// +// The min leaf payload fraction is like the min embedded payload fraction +// except that it applies to leaf nodes in a LEAFDATA tree. The maximum +// payload fraction for a LEAFDATA tree is always 100% (or 255) and it +// not specified in the header. +// +// Each btree pages is divided into three sections: The header, the +// cell pointer array, and the cell content area. Page 1 also has a 100-byte +// file header that occurs before the page header. +// +// |----------------| +// | file header | 100 bytes. Page 1 only. +// |----------------| +// | page header | 8 bytes for leaves. 12 bytes for interior nodes +// |----------------| +// | cell pointer | | 2 bytes per cell. Sorted order. +// | array | | Grows downward +// | | v +// |----------------| +// | unallocated | +// | space | +// |----------------| ^ Grows upwards +// | cell content | | Arbitrary order interspersed with freeblocks. +// | area | | and free space fragments. +// |----------------| +// +// The page headers looks like this: +// +// OFFSET SIZE DESCRIPTION +// 0 1 Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf +// 1 2 byte offset to the first freeblock +// 3 2 number of cells on this page +// 5 2 first byte of the cell content area +// 7 1 number of fragmented free bytes +// 8 4 Right child (the Ptr(N) value). Omitted on leaves. +// +// The flags define the format of this btree page. The leaf flag means that +// this page has no children. The zerodata flag means that this page carries +// only keys and no data. The intkey flag means that the key is an integer +// which is stored in the key size entry of the cell header rather than in +// the payload area. +// +// The cell pointer array begins on the first byte after the page header. +// The cell pointer array contains zero or more 2-byte numbers which are +// offsets from the beginning of the page to the cell content in the cell +// content area. The cell pointers occur in sorted order. The system strives +// to keep free space after the last cell pointer so that new cells can +// be easily added without having to defragment the page. +// +// Cell content is stored at the very end of the page and grows toward the +// beginning of the page. +// +// Unused space within the cell content area is collected into a linked list of +// freeblocks. Each freeblock is at least 4 bytes in size. The byte offset +// to the first freeblock is given in the header. Freeblocks occur in +// increasing order. Because a freeblock must be at least 4 bytes in size, +// any group of 3 or fewer unused bytes in the cell content area cannot +// exist on the freeblock chain. A group of 3 or fewer free bytes is called +// a fragment. The total number of bytes in all fragments is recorded. +// in the page header at offset 7. +// +// SIZE DESCRIPTION +// 2 Byte offset of the next freeblock +// 2 Bytes in this freeblock +// +// Cells are of variable length. Cells are stored in the cell content area at +// the end of the page. Pointers to the cells are in the cell pointer array +// that immediately follows the page header. Cells is not necessarily +// contiguous or in order, but cell pointers are contiguous and in order. +// +// Cell content makes use of variable length integers. A variable +// length integer is 1 to 9 bytes where the lower 7 bits of each +// byte are used. The integer consists of all bytes that have bit 8 set and +// the first byte with bit 8 clear. The most significant byte of the integer +// appears first. A variable-length integer may not be more than 9 bytes long. +// As a special case, all 8 bytes of the 9th byte are used as data. This +// allows a 64-bit integer to be encoded in 9 bytes. +// +// 0x00 becomes 0x00000000 +// 0x7f becomes 0x0000007f +// 0x81 0x00 becomes 0x00000080 +// 0x82 0x00 becomes 0x00000100 +// 0x80 0x7f becomes 0x0000007f +// 0x8a 0x91 0xd1 0xac 0x78 becomes 0x12345678 +// 0x81 0x81 0x81 0x81 0x01 becomes 0x10204081 +// +// Variable length integers are used for rowids and to hold the number of +// bytes of key and data in a btree cell. +// +// The content of a cell looks like this: +// +// SIZE DESCRIPTION +// 4 Page number of the left child. Omitted if leaf flag is set. +// var Number of bytes of data. Omitted if the zerodata flag is set. +// var Number of bytes of key. Or the key itself if intkey flag is set. +// * Payload +// 4 First page of the overflow chain. Omitted if no overflow +// +// Overflow pages form a linked list. Each page except the last is completely +// filled with data (pagesize - 4 bytes). The last page can have as little +// as 1 byte of data. +// +// SIZE DESCRIPTION +// 4 Page number of next overflow page +// * Data +// +// Freelist pages come in two subtypes: trunk pages and leaf pages. The +// file header points to the first in a linked list of trunk page. Each trunk +// page points to multiple leaf pages. The content of a leaf page is +// unspecified. A trunk page looks like this: +// +// SIZE DESCRIPTION +// 4 Page number of next trunk page +// 4 Number of leaf pointers on this page +// * zero or more pages numbers of leaves +// #include "sqliteInt.h" + +// The following value is the maximum cell size assuming a maximum page +// size give above. + +// The maximum number of cells on a single page of the database. This +// assumes a minimum cell size of 6 bytes (4 bytes for the cell itself +// plus 2 bytes for the index to the cell in the page header). Such +// small cells will be rare, but they are possible. + +// Forward declarations +type MemPage = MemPage1 /* sqlite3.c:64658:24 */ +type BtLock1 = struct { + FpBtree uintptr + FiTable Pgno + FeLock U8 + _ [3]byte + FpNext uintptr +} /* sqlite3.c:1331:9 */ + +type BtLock = BtLock1 /* sqlite3.c:64659:23 */ +type CellInfo1 = struct { + FnKey I64 + FpPayload uintptr + FnPayload U32 + FnLocal U16 + FnSize U16 +} /* sqlite3.c:1331:9 */ + +type CellInfo = CellInfo1 /* sqlite3.c:64660:25 */ + +// Legal values for BtCursor.curFlags + +// Potential values for BtCursor.eState. +// +// CURSOR_INVALID: +// Cursor does not point to a valid entry. This can happen (for example) +// because the table is empty or because BtreeCursorFirst() has not been +// called. +// +// CURSOR_VALID: +// Cursor points to a valid entry. getPayload() etc. may be called. +// +// CURSOR_SKIPNEXT: +// Cursor is valid except that the Cursor.skipNext field is non-zero +// indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious() +// operation should be a no-op. +// +// CURSOR_REQUIRESEEK: +// The table that this cursor was opened on still exists, but has been +// modified since the cursor was last used. The cursor position is saved +// in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in +// this state, restoreCursorPosition() can be called to attempt to +// seek the cursor to the saved position. +// +// CURSOR_FAULT: +// An unrecoverable error (an I/O error or a malloc failure) has occurred +// on a different connection that shares the BtShared cache with this +// cursor. The error has left the cache in an inconsistent state. +// Do nothing else with this cursor. Any attempt to use the cursor +// should return the error code stored in BtCursor.skipNext + +// The database page the PENDING_BYTE occupies. This page is never used. + +// These macros define the location of the pointer-map entry for a +// database page. The first argument to each is the number of usable +// bytes on each page of the database (often 1024). The second is the +// page number to look up in the pointer map. +// +// PTRMAP_PAGENO returns the database page number of the pointer-map +// page that stores the required pointer. PTRMAP_PTROFFSET returns +// the offset of the requested map entry. +// +// If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page, +// then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be +// used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements +// this test. + +// The pointer map is a lookup table that identifies the parent page for +// each child page in the database file. The parent page is the page that +// contains a pointer to the child. Every page in the database contains +// 0 or 1 parent pages. (In this context 'database page' refers +// to any page that is not part of the pointer map itself.) Each pointer map +// entry consists of a single byte 'type' and a 4 byte parent page number. +// The PTRMAP_XXX identifiers below are the valid types. +// +// The purpose of the pointer map is to facility moving pages from one +// position in the file to another as part of autovacuum. When a page +// is moved, the pointer in its parent must be updated to point to the +// new location. The pointer map is used to locate the parent page quickly. +// +// PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not +// used in this case. +// +// PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number +// is not used in this case. +// +// PTRMAP_OVERFLOW1: The database page is the first page in a list of +// overflow pages. The page number identifies the page that +// contains the cell with a pointer to this overflow page. +// +// PTRMAP_OVERFLOW2: The database page is the second or later page in a list of +// overflow pages. The page-number identifies the previous +// page in the overflow page list. +// +// PTRMAP_BTREE: The database page is a non-root btree page. The page number +// identifies the parent page in the btree. + +// A bunch of assert() statements to check the transaction state variables +// of handle p (type Btree*) are internally consistent. + +// The ISAUTOVACUUM macro is used within balance_nonroot() to determine +// if the database supports auto-vacuum or not. Because it is used +// within an expression that is an argument to another macro +// (sqliteMallocRaw), it is not possible to use conditional compilation. +// So, this macro is defined instead. + +// This structure is passed around through all the sanity checking routines +// in order to keep track of some global state information. +// +// The aRef[] array is allocated so that there is 1 bit for each page in +// the database. As the integrity-check proceeds, for each page used in +// the database the corresponding bit is set. This allows integrity-check to +// detect pages that are used twice and orphaned pages (both of which +// indicate corruption). +type IntegrityCk1 = struct { + FpBt uintptr + FpPager uintptr + FaPgRef uintptr + FnPage Pgno + FmxErr int32 + FnErr int32 + FbOomFault int32 + FzPfx uintptr + Fv1 Pgno + Fv2 int32 + FerrMsg StrAccum + Fheap uintptr + Fdb uintptr +} /* sqlite3.c:65118:9 */ + +// Legal values for BtCursor.curFlags + +// Potential values for BtCursor.eState. +// +// CURSOR_INVALID: +// Cursor does not point to a valid entry. This can happen (for example) +// because the table is empty or because BtreeCursorFirst() has not been +// called. +// +// CURSOR_VALID: +// Cursor points to a valid entry. getPayload() etc. may be called. +// +// CURSOR_SKIPNEXT: +// Cursor is valid except that the Cursor.skipNext field is non-zero +// indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious() +// operation should be a no-op. +// +// CURSOR_REQUIRESEEK: +// The table that this cursor was opened on still exists, but has been +// modified since the cursor was last used. The cursor position is saved +// in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in +// this state, restoreCursorPosition() can be called to attempt to +// seek the cursor to the saved position. +// +// CURSOR_FAULT: +// An unrecoverable error (an I/O error or a malloc failure) has occurred +// on a different connection that shares the BtShared cache with this +// cursor. The error has left the cache in an inconsistent state. +// Do nothing else with this cursor. Any attempt to use the cursor +// should return the error code stored in BtCursor.skipNext + +// The database page the PENDING_BYTE occupies. This page is never used. + +// These macros define the location of the pointer-map entry for a +// database page. The first argument to each is the number of usable +// bytes on each page of the database (often 1024). The second is the +// page number to look up in the pointer map. +// +// PTRMAP_PAGENO returns the database page number of the pointer-map +// page that stores the required pointer. PTRMAP_PTROFFSET returns +// the offset of the requested map entry. +// +// If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page, +// then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be +// used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements +// this test. + +// The pointer map is a lookup table that identifies the parent page for +// each child page in the database file. The parent page is the page that +// contains a pointer to the child. Every page in the database contains +// 0 or 1 parent pages. (In this context 'database page' refers +// to any page that is not part of the pointer map itself.) Each pointer map +// entry consists of a single byte 'type' and a 4 byte parent page number. +// The PTRMAP_XXX identifiers below are the valid types. +// +// The purpose of the pointer map is to facility moving pages from one +// position in the file to another as part of autovacuum. When a page +// is moved, the pointer in its parent must be updated to point to the +// new location. The pointer map is used to locate the parent page quickly. +// +// PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not +// used in this case. +// +// PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number +// is not used in this case. +// +// PTRMAP_OVERFLOW1: The database page is the first page in a list of +// overflow pages. The page number identifies the page that +// contains the cell with a pointer to this overflow page. +// +// PTRMAP_OVERFLOW2: The database page is the second or later page in a list of +// overflow pages. The page-number identifies the previous +// page in the overflow page list. +// +// PTRMAP_BTREE: The database page is a non-root btree page. The page number +// identifies the parent page in the btree. + +// A bunch of assert() statements to check the transaction state variables +// of handle p (type Btree*) are internally consistent. + +// The ISAUTOVACUUM macro is used within balance_nonroot() to determine +// if the database supports auto-vacuum or not. Because it is used +// within an expression that is an argument to another macro +// (sqliteMallocRaw), it is not possible to use conditional compilation. +// So, this macro is defined instead. + +// This structure is passed around through all the sanity checking routines +// in order to keep track of some global state information. +// +// The aRef[] array is allocated so that there is 1 bit for each page in +// the database. As the integrity-check proceeds, for each page used in +// the database the corresponding bit is set. This allows integrity-check to +// detect pages that are used twice and orphaned pages (both of which +// indicate corruption). +type IntegrityCk = IntegrityCk1 /* sqlite3.c:65118:28 */ + +// Routines to read or write a two- and four-byte big-endian integer values. + +// get2byteAligned(), unlike get2byte(), requires that its argument point to a +// two-byte aligned address. get2bytea() is only used for accessing the +// cell addresses in a btree header. + +//************* End of btreeInt.h ******************************************* +//************* Continuing where we left off in btmutex.c ******************* + +// Obtain the BtShared mutex associated with B-Tree handle p. Also, +// set BtShared.db to the database handle associated with p and the +// p->locked boolean to true. +func lockBtreeMutex(tls *libc.TLS, p uintptr) { /* sqlite3.c:65168:13: */ + + Xsqlite3_mutex_enter(tls, (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).Fmutex) + (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).Fdb = (*Btree)(unsafe.Pointer(p)).Fdb + (*Btree)(unsafe.Pointer(p)).Flocked = U8(1) +} + +// Release the BtShared mutex associated with B-Tree handle p and +// clear the p->locked boolean. +func unlockBtreeMutex(tls *libc.TLS, p uintptr) { /* sqlite3.c:65182:29: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3_mutex_leave(tls, (*BtShared)(unsafe.Pointer(pBt)).Fmutex) + (*Btree)(unsafe.Pointer(p)).Flocked = U8(0) +} + +// Enter a mutex on the given BTree object. +// +// If the object is not sharable, then no mutex is ever required +// and this routine is a no-op. The underlying mutex is non-recursive. +// But we keep a reference count in Btree.wantToLock so the behavior +// of this interface is recursive. +// +// To avoid deadlocks, multiple Btrees are locked in the same order +// by all database connections. The p->pNext is a list of other +// Btrees belonging to the same database connection as the p Btree +// which need to be locked after p. If we cannot get a lock on +// p, then first unlock all of the others on p->pNext, then wait +// for the lock to become available on p, then relock all of the +// subsequent Btrees that desire a lock. +func Xsqlite3BtreeEnter(tls *libc.TLS, p uintptr) { /* sqlite3.c:65212:21: */ + // Some basic sanity checking on the Btree. The list of Btrees + // connected by pNext and pPrev should be in sorted order by + // Btree.pBt value. All elements of the list should belong to + // the same connection. Only shared Btrees are on the list. + + // Check for locking consistency + + // We should already hold a lock on the database connection + + // Unless the database is sharable and unlocked, then BtShared.db + // should already be set correctly. + + if !(int32((*Btree)(unsafe.Pointer(p)).Fsharable) != 0) { + return + } + (*Btree)(unsafe.Pointer(p)).FwantToLock++ + if (*Btree)(unsafe.Pointer(p)).Flocked != 0 { + return + } + btreeLockCarefully(tls, p) +} + +// This is a helper function for sqlite3BtreeLock(). By moving +// complex, but seldom used logic, out of sqlite3BtreeLock() and +// into this routine, we avoid unnecessary stack pointer changes +// and thus help the sqlite3BtreeLock() routine to run much faster +// in the common case. +func btreeLockCarefully(tls *libc.TLS, p uintptr) { /* sqlite3.c:65246:29: */ + var pLater uintptr + + // In most cases, we should be able to acquire the lock we + // want without having to go through the ascending lock + // procedure that follows. Just be sure not to block. + if Xsqlite3_mutex_try(tls, (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).Fmutex) == SQLITE_OK { + (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).Fdb = (*Btree)(unsafe.Pointer(p)).Fdb + (*Btree)(unsafe.Pointer(p)).Flocked = U8(1) + return + } + + // To avoid deadlock, first release all locks with a larger + // BtShared address. Then acquire our lock. Then reacquire + // the other BtShared locks that we used to hold in ascending + // order. + for pLater = (*Btree)(unsafe.Pointer(p)).FpNext; pLater != 0; pLater = (*Btree)(unsafe.Pointer(pLater)).FpNext { + + if (*Btree)(unsafe.Pointer(pLater)).Flocked != 0 { + unlockBtreeMutex(tls, pLater) + } + } + lockBtreeMutex(tls, p) + for pLater = (*Btree)(unsafe.Pointer(p)).FpNext; pLater != 0; pLater = (*Btree)(unsafe.Pointer(pLater)).FpNext { + if (*Btree)(unsafe.Pointer(pLater)).FwantToLock != 0 { + lockBtreeMutex(tls, pLater) + } + } +} + +// Exit the recursive mutex on a Btree. +func Xsqlite3BtreeLeave(tls *libc.TLS, p uintptr) { /* sqlite3.c:65284:21: */ + + if (*Btree)(unsafe.Pointer(p)).Fsharable != 0 { + + (*Btree)(unsafe.Pointer(p)).FwantToLock-- + if (*Btree)(unsafe.Pointer(p)).FwantToLock == 0 { + unlockBtreeMutex(tls, p) + } + } +} + +// Enter the mutex on every Btree associated with a database +// connection. This is needed (for example) prior to parsing +// a statement since we will be comparing table and column names +// against all schemas and we do not want those schemas being +// reset out from under us. +// +// There is a corresponding leave-all procedures. +// +// Enter the mutexes in accending order by BtShared pointer address +// to avoid the possibility of deadlock when two threads with +// two or more btrees in common both try to lock all their btrees +// at the same instant. +func btreeEnterAll(tls *libc.TLS, db uintptr) { /* sqlite3.c:65327:29: */ + var i int32 + var skipOk int32 = 1 + var p uintptr + + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + p = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if (p != 0) && ((*Btree)(unsafe.Pointer(p)).Fsharable != 0) { + Xsqlite3BtreeEnter(tls, p) + skipOk = 0 + } + } + (*Sqlite3)(unsafe.Pointer(db)).FnoSharedCache = U8(skipOk) +} + +func Xsqlite3BtreeEnterAll(tls *libc.TLS, db uintptr) { /* sqlite3.c:65341:21: */ + if int32((*Sqlite3)(unsafe.Pointer(db)).FnoSharedCache) == 0 { + btreeEnterAll(tls, db) + } +} + +func btreeLeaveAll(tls *libc.TLS, db uintptr) { /* sqlite3.c:65344:29: */ + var i int32 + var p uintptr + + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + p = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if p != 0 { + Xsqlite3BtreeLeave(tls, p) + } + } +} + +func Xsqlite3BtreeLeaveAll(tls *libc.TLS, db uintptr) { /* sqlite3.c:65353:21: */ + if int32((*Sqlite3)(unsafe.Pointer(db)).FnoSharedCache) == 0 { + btreeLeaveAll(tls, db) + } +} + +// Enter a mutex on a Btree given a cursor owned by that Btree. +// +// These entry points are used by incremental I/O only. Enter() is required +// any time OMIT_SHARED_CACHE is not defined, regardless of whether or not +// the build is threadsafe. Leave() is only required by threadsafe builds. +func Xsqlite3BtreeEnterCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65439:21: */ + Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree) +} + +func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443:21: */ + Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree) +} + +//************* End of btmutex.c ******************************************** +//************* Begin file btree.c ****************************************** +// 2004 April 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file implements an external (disk-based) database using BTrees. +// See the header comment on "btreeInt.h" for additional information. +// Including a description of file format and an overview of operation. +// #include "btreeInt.h" + +// The header string that appears at the beginning of every +// SQLite database. +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3143 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ + +// Set this global variable to 1 to enable tracing using the TRACE +// macro. + +// Extract a 2-byte big-endian integer from an array of unsigned bytes. +// But if the value is zero, make it 65536. +// +// This routine is used to extract the "offset to cell content area" value +// from the header of a btree page. If the page size is 65536 and the page +// is empty, the offset should be 65536, but the 2-byte value stores zero. +// This routine makes the necessary adjustment to 65536. + +// Values passed as the 5th argument to allocateBtreePage() + +// Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not +// defined, or 0 if it is. For example: +// +// bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum); + +// A list of BtShared objects that are eligible for participation +// in shared cache. This variable has file scope during normal builds, +// but the test harness needs to access it so we make it global for +// test builds. +// +// Access to this variable is protected by SQLITE_MUTEX_STATIC_MAIN. +var sqlite3SharedCacheList uintptr = uintptr(0) /* sqlite3.c:65529:17 */ + +// Enable or disable the shared pager and schema features. +// +// This routine has no effect on existing database connections. +// The shared cache setting effects only future calls to +// sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(). +func Xsqlite3_enable_shared_cache(tls *libc.TLS, enable int32) int32 { /* sqlite3.c:65541:16: */ + Xsqlite3Config.FsharedCacheEnabled = enable + return SQLITE_OK +} + +// Implementation of the SQLITE_CORRUPT_PAGE() macro. Takes a single +// (MemPage*) as an argument. The (MemPage*) must not be NULL. +// +// If SQLITE_DEBUG is not defined, then this macro is equivalent to +// SQLITE_CORRUPT_BKPT. Or, if SQLITE_DEBUG is set, then the log message +// normally produced as a side-effect of SQLITE_CORRUPT_BKPT is augmented +// with the page number and filename associated with the (MemPage*). + +// Query to see if Btree handle p may obtain a lock of type eLock +// (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return +// SQLITE_OK if the lock may be obtained (by calling +// setSharedCacheTableLock()), or SQLITE_LOCKED if not. +func querySharedCacheTableLock(tls *libc.TLS, p uintptr, iTab Pgno, eLock U8) int32 { /* sqlite3.c:65740:12: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var pIter uintptr + + // If requesting a write-lock, then the Btree must have an open write + // transaction on this file. And, obviously, for this to be so there + // must be an open write transaction on the file itself. + + // This routine is a no-op if the shared-cache is not enabled + if !(int32((*Btree)(unsafe.Pointer(p)).Fsharable) != 0) { + return SQLITE_OK + } + + // If some other connection is holding an exclusive lock, the + // requested lock may not be obtained. + if ((*BtShared)(unsafe.Pointer(pBt)).FpWriter != p) && ((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_EXCLUSIVE) != 0) { + Xsqlite3ConnectionBlocked(tls, (*Btree)(unsafe.Pointer(p)).Fdb, (*Btree)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpWriter)).Fdb) + return (SQLITE_LOCKED | (int32(1) << 8)) + } + + for pIter = (*BtShared)(unsafe.Pointer(pBt)).FpLock; pIter != 0; pIter = (*BtLock)(unsafe.Pointer(pIter)).FpNext { + // The condition (pIter->eLock!=eLock) in the following if(...) + // statement is a simplification of: + // + // (eLock==WRITE_LOCK || pIter->eLock==WRITE_LOCK) + // + // since we know that if eLock==WRITE_LOCK, then no other connection + // may hold a WRITE_LOCK on any table in this file (since there can + // only be a single writer). + + if (((*BtLock)(unsafe.Pointer(pIter)).FpBtree != p) && ((*BtLock)(unsafe.Pointer(pIter)).FiTable == iTab)) && (int32((*BtLock)(unsafe.Pointer(pIter)).FeLock) != int32(eLock)) { + Xsqlite3ConnectionBlocked(tls, (*Btree)(unsafe.Pointer(p)).Fdb, (*Btree)(unsafe.Pointer((*BtLock)(unsafe.Pointer(pIter)).FpBtree)).Fdb) + if int32(eLock) == WRITE_LOCK { + + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_PENDING)) + } + return (SQLITE_LOCKED | (int32(1) << 8)) + } + } + return SQLITE_OK +} + +// Add a lock on the table with root-page iTable to the shared-btree used +// by Btree handle p. Parameter eLock must be either READ_LOCK or +// WRITE_LOCK. +// +// This function assumes the following: +// +// (a) The specified Btree object p is connected to a sharable +// database (one with the BtShared.sharable flag set), and +// +// (b) No other Btree objects hold a lock that conflicts +// with the requested lock (i.e. querySharedCacheTableLock() has +// already been called and returned SQLITE_OK). +// +// SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM +// is returned if a malloc attempt fails. +func setSharedCacheTableLock(tls *libc.TLS, p uintptr, iTable Pgno, eLock U8) int32 { /* sqlite3.c:65812:12: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var pLock uintptr = uintptr(0) + var pIter uintptr + + // A connection with the read-uncommitted flag set will never try to + // obtain a read-lock using this function. The only read-lock obtained + // by a connection in read-uncommitted mode is on the sqlite_schema + // table, and that lock is obtained in BtreeBeginTrans(). + + // This function should only be called on a sharable b-tree after it + // has been determined that no other b-tree holds a conflicting lock. + + // First search the list for an existing lock on this table. + for pIter = (*BtShared)(unsafe.Pointer(pBt)).FpLock; pIter != 0; pIter = (*BtLock)(unsafe.Pointer(pIter)).FpNext { + if ((*BtLock)(unsafe.Pointer(pIter)).FiTable == iTable) && ((*BtLock)(unsafe.Pointer(pIter)).FpBtree == p) { + pLock = pIter + break + } + } + + // If the above search did not find a BtLock struct associating Btree p + // with table iTable, allocate one and link it into the list. + if !(pLock != 0) { + pLock = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(BtLock{}))) + if !(pLock != 0) { + return SQLITE_NOMEM + } + (*BtLock)(unsafe.Pointer(pLock)).FiTable = iTable + (*BtLock)(unsafe.Pointer(pLock)).FpBtree = p + (*BtLock)(unsafe.Pointer(pLock)).FpNext = (*BtShared)(unsafe.Pointer(pBt)).FpLock + (*BtShared)(unsafe.Pointer(pBt)).FpLock = pLock + } + + // Set the BtLock.eLock variable to the maximum of the current lock + // and the requested lock. This means if a write-lock was already held + // and a read-lock requested, we don't incorrectly downgrade the lock. + + if int32(eLock) > int32((*BtLock)(unsafe.Pointer(pLock)).FeLock) { + (*BtLock)(unsafe.Pointer(pLock)).FeLock = eLock + } + + return SQLITE_OK +} + +// Release all the table locks (locks obtained via calls to +// the setSharedCacheTableLock() procedure) held by Btree object p. +// +// This function assumes that Btree p has an open read or write +// transaction. If it does not, then the BTS_PENDING flag +// may be incorrectly cleared. +func clearAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { /* sqlite3.c:65876:13: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var ppIter uintptr = (pBt + 120 /* &.pLock */) + + for *(*uintptr)(unsafe.Pointer(ppIter)) != 0 { + var pLock uintptr = *(*uintptr)(unsafe.Pointer(ppIter)) + + if (*BtLock)(unsafe.Pointer(pLock)).FpBtree == p { + *(*uintptr)(unsafe.Pointer(ppIter)) = (*BtLock)(unsafe.Pointer(pLock)).FpNext + + if (*BtLock)(unsafe.Pointer(pLock)).FiTable != Pgno(1) { + Xsqlite3_free(tls, pLock) + } + } else { + ppIter = (pLock + 16 /* &.pNext */) + } + } + + if (*BtShared)(unsafe.Pointer(pBt)).FpWriter == p { + (*BtShared)(unsafe.Pointer(pBt)).FpWriter = uintptr(0) + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32((BTS_EXCLUSIVE | BTS_PENDING)))) + } else if (*BtShared)(unsafe.Pointer(pBt)).FnTransaction == 2 { + // This function is called when Btree p is concluding its + // transaction. If there currently exists a writer, and p is not + // that writer, then the number of locks held by connections other + // than the writer must be about to drop to zero. In this case + // set the BTS_PENDING flag to 0. + // + // If there is not currently a writer, then BTS_PENDING must + // be zero already. So this next line is harmless in that case. + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_PENDING))) + } +} + +// This function changes all write-locks held by Btree p into read-locks. +func downgradeAllSharedCacheTableLocks(tls *libc.TLS, p uintptr) { /* sqlite3.c:65920:13: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + if (*BtShared)(unsafe.Pointer(pBt)).FpWriter == p { + var pLock uintptr + (*BtShared)(unsafe.Pointer(pBt)).FpWriter = uintptr(0) + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32((BTS_EXCLUSIVE | BTS_PENDING)))) + for pLock = (*BtShared)(unsafe.Pointer(pBt)).FpLock; pLock != 0; pLock = (*BtLock)(unsafe.Pointer(pLock)).FpNext { + + (*BtLock)(unsafe.Pointer(pLock)).FeLock = U8(READ_LOCK) + } + } +} + +// Forward reference + +// This routine is used inside of assert() only **** +// +// Verify that the cursor holds the mutex on its BtShared + +// Invalidate the overflow cache of the cursor passed as the first argument. +// on the shared btree structure pBt. + +// Invalidate the overflow page-list cache for all cursors opened +// on the shared btree structure pBt. +func invalidateAllOverflowCache(tls *libc.TLS, pBt uintptr) { /* sqlite3.c:65973:13: */ + var p uintptr + + for p = (*BtShared)(unsafe.Pointer(pBt)).FpCursor; p != 0; p = (*BtCursor)(unsafe.Pointer(p)).FpNext { + *(*U8)(unsafe.Pointer(p + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_ValidOvfl))) + } +} + +// This function is called before modifying the contents of a table +// to invalidate any incrblob cursors that are open on the +// row or one of the rows being modified. +// +// If argument isClearTable is true, then the entire contents of the +// table is about to be deleted. In this case invalidate all incrblob +// cursors open on any row within the table with root-page pgnoRoot. +// +// Otherwise, if argument isClearTable is false, then the row with +// rowid iRow is being replaced or deleted. In this case invalidate +// only those incrblob cursors open on that specific row. +func invalidateIncrblobCursors(tls *libc.TLS, pBtree uintptr, pgnoRoot Pgno, iRow I64, isClearTable int32) { /* sqlite3.c:65995:13: */ + var p uintptr + + (*Btree)(unsafe.Pointer(pBtree)).FhasIncrblobCur = U8(0) + for p = (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBtree)).FpBt)).FpCursor; p != 0; p = (*BtCursor)(unsafe.Pointer(p)).FpNext { + if (int32((*BtCursor)(unsafe.Pointer(p)).FcurFlags) & BTCF_Incrblob) != 0 { + (*Btree)(unsafe.Pointer(pBtree)).FhasIncrblobCur = U8(1) + if ((*BtCursor)(unsafe.Pointer(p)).FpgnoRoot == pgnoRoot) && ((isClearTable != 0) || ((*BtCursor)(unsafe.Pointer(p)).Finfo.FnKey == iRow)) { + (*BtCursor)(unsafe.Pointer(p)).FeState = U8(CURSOR_INVALID) + } + } + } +} + +// Set bit pgno of the BtShared.pHasContent bitvec. This is called +// when a page that previously contained data becomes a free-list leaf +// page. +// +// The BtShared.pHasContent bitvec exists to work around an obscure +// bug caused by the interaction of two useful IO optimizations surrounding +// free-list leaf pages: +// +// 1) When all data is deleted from a page and the page becomes +// a free-list leaf page, the page is not written to the database +// (as free-list leaf pages contain no meaningful data). Sometimes +// such a page is not even journalled (as it will not be modified, +// why bother journalling it?). +// +// 2) When a free-list leaf page is reused, its content is not read +// from the database or written to the journal file (why should it +// be, if it is not at all meaningful?). +// +// By themselves, these optimizations work fine and provide a handy +// performance boost to bulk delete or insert operations. However, if +// a page is moved to the free-list and then reused within the same +// transaction, a problem comes up. If the page is not journalled when +// it is moved to the free-list and it is also not journalled when it +// is extracted from the free-list and reused, then the original data +// may be lost. In the event of a rollback, it may not be possible +// to restore the database to its original configuration. +// +// The solution is the BtShared.pHasContent bitvec. Whenever a page is +// moved to become a free-list leaf page, the corresponding bit is +// set in the bitvec. Whenever a leaf page is extracted from the free-list, +// optimization 2 above is omitted if the corresponding bit is already +// set in BtShared.pHasContent. The contents of the bitvec are cleared +// at the end of every transaction. +func btreeSetHasContent(tls *libc.TLS, pBt uintptr, pgno Pgno) int32 { /* sqlite3.c:66055:12: */ + var rc int32 = SQLITE_OK + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FpHasContent) != 0) { + + (*BtShared)(unsafe.Pointer(pBt)).FpHasContent = Xsqlite3BitvecCreate(tls, (*BtShared)(unsafe.Pointer(pBt)).FnPage) + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FpHasContent) != 0) { + rc = SQLITE_NOMEM + } + } + if (rc == SQLITE_OK) && (pgno <= Xsqlite3BitvecSize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpHasContent)) { + rc = Xsqlite3BitvecSet(tls, (*BtShared)(unsafe.Pointer(pBt)).FpHasContent, pgno) + } + return rc +} + +// Query the BtShared.pHasContent vector. +// +// This function is called when a free-list leaf page is removed from the +// free-list for reuse. It returns false if it is safe to retrieve the +// page from the pager layer with the 'no-content' flag set. True otherwise. +func btreeGetHasContent(tls *libc.TLS, pBt uintptr, pgno Pgno) int32 { /* sqlite3.c:66077:12: */ + var p uintptr = (*BtShared)(unsafe.Pointer(pBt)).FpHasContent + return (libc.Bool32((p != 0) && ((pgno > Xsqlite3BitvecSize(tls, p)) || (Xsqlite3BitvecTestNotNull(tls, p, pgno) != 0)))) +} + +// Clear (destroy) the BtShared.pHasContent bitvec. This should be +// invoked at the conclusion of each write-transaction. +func btreeClearHasContent(tls *libc.TLS, pBt uintptr) { /* sqlite3.c:66086:13: */ + Xsqlite3BitvecDestroy(tls, (*BtShared)(unsafe.Pointer(pBt)).FpHasContent) + (*BtShared)(unsafe.Pointer(pBt)).FpHasContent = uintptr(0) +} + +// Release all of the apPage[] pages for a cursor. +func btreeReleaseAllCursorPages(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:66094:13: */ + var i int32 + if int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) >= 0 { + for i = 0; i < int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage); i++ { + releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr(i)*8))) + } + releasePageNotNull(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpPage) + (*BtCursor)(unsafe.Pointer(pCur)).FiPage = int8(-1) + } +} + +// The cursor passed as the only argument must point to a valid entry +// when this function is called (i.e. have eState==CURSOR_VALID). This +// function saves the current cursor key in variables pCur->nKey and +// pCur->pKey. SQLITE_OK is returned if successful or an SQLite error +// code otherwise. +// +// If the cursor is open on an intkey table, then the integer key +// (the rowid) is stored in pCur->nKey and pCur->pKey is left set to +// NULL. If the cursor is open on a non-intkey table, then pCur->pKey is +// set to point to a malloced buffer pCur->nKey bytes in size containing +// the key. +func saveCursorKey(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:66118:12: */ + var rc int32 = SQLITE_OK + + if (*BtCursor)(unsafe.Pointer(pCur)).FcurIntKey != 0 { + // Only the rowid is required for a table btree + (*BtCursor)(unsafe.Pointer(pCur)).FnKey = Xsqlite3BtreeIntegerKey(tls, pCur) + } else { + // For an index btree, save the complete key content. It is possible + // that the current key is corrupt. In that case, it is possible that + // the sqlite3VdbeRecordUnpack() function may overread the buffer by + // up to the size of 1 varint plus 1 8-byte value when the cursor + // position is restored. Hence the 17 bytes of padding allocated + // below. + var pKey uintptr + (*BtCursor)(unsafe.Pointer(pCur)).FnKey = I64(Xsqlite3BtreePayloadSize(tls, pCur)) + pKey = Xsqlite3Malloc(tls, (uint64(((*BtCursor)(unsafe.Pointer(pCur)).FnKey + int64(9)) + int64(8)))) + if pKey != 0 { + rc = Xsqlite3BtreePayload(tls, pCur, uint32(0), uint32(int32((*BtCursor)(unsafe.Pointer(pCur)).FnKey)), pKey) + if rc == SQLITE_OK { + libc.Xmemset(tls, ((pKey) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FnKey)), 0, (uint64(9 + 8))) + (*BtCursor)(unsafe.Pointer(pCur)).FpKey = pKey + } else { + Xsqlite3_free(tls, pKey) + } + } else { + rc = SQLITE_NOMEM + } + } + + return rc +} + +// Save the current cursor position in the variables BtCursor.nKey +// and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK. +// +// The caller must ensure that the cursor is valid (has eState==CURSOR_VALID) +// prior to calling this routine. +func saveCursorPosition(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:66160:12: */ + var rc int32 + + if (int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_Pinned) != 0 { + return (SQLITE_CONSTRAINT | (int32(11) << 8)) + } + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_SKIPNEXT { + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_VALID) + } else { + (*BtCursor)(unsafe.Pointer(pCur)).FskipNext = 0 + } + + rc = saveCursorKey(tls, pCur) + if rc == SQLITE_OK { + btreeReleaseAllCursorPages(tls, pCur) + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_REQUIRESEEK) + } + + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(((BTCF_ValidNKey | BTCF_ValidOvfl) | BTCF_AtLast)))) + return rc +} + +// Save the positions of all cursors (except pExcept) that are open on +// the table with root-page iRoot. "Saving the cursor position" means that +// the location in the btree is remembered in such a way that it can be +// moved back to the same spot after the btree has been modified. This +// routine is called just before cursor pExcept is used to modify the +// table, for example in BtreeDelete() or BtreeInsert(). +// +// If there are two or more cursors on the same btree, then all such +// cursors should have their BTCF_Multiple flag set. The btreeCursor() +// routine enforces that rule. This routine only needs to be called in +// the uncommon case when pExpect has the BTCF_Multiple flag set. +// +// If pExpect!=NULL and if no other cursors are found on the same root-page, +// then the BTCF_Multiple flag on pExpect is cleared, to avoid another +// pointless call to this routine. +// +// Implementation note: This routine merely checks to see if any cursors +// need to be saved. It calls out to saveCursorsOnList() in the (unusual) +// event that cursors are in need to being saved. +func saveAllCursors(tls *libc.TLS, pBt uintptr, iRoot Pgno, pExcept uintptr) int32 { /* sqlite3.c:66210:12: */ + var p uintptr + + for p = (*BtShared)(unsafe.Pointer(pBt)).FpCursor; p != 0; p = (*BtCursor)(unsafe.Pointer(p)).FpNext { + if (p != pExcept) && ((Pgno(0) == iRoot) || ((*BtCursor)(unsafe.Pointer(p)).FpgnoRoot == iRoot)) { + break + } + } + if p != 0 { + return saveCursorsOnList(tls, p, iRoot, pExcept) + } + if pExcept != 0 { + *(*U8)(unsafe.Pointer(pExcept + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_Multiple))) + } + return SQLITE_OK +} + +// This helper routine to saveAllCursors does the actual work of saving +// the cursors if and when a cursor is found that actually requires saving. +// The common case is that no cursors need to be saved, so this routine is +// broken out from its caller to avoid unnecessary stack pointer movement. +func saveCursorsOnList(tls *libc.TLS, p uintptr, iRoot Pgno, pExcept uintptr) int32 { /* sqlite3.c:66227:28: */ + for ok := true; ok; ok = p != 0 { + if (p != pExcept) && ((Pgno(0) == iRoot) || ((*BtCursor)(unsafe.Pointer(p)).FpgnoRoot == iRoot)) { + if (int32((*BtCursor)(unsafe.Pointer(p)).FeState) == CURSOR_VALID) || (int32((*BtCursor)(unsafe.Pointer(p)).FeState) == CURSOR_SKIPNEXT) { + var rc int32 = saveCursorPosition(tls, p) + if SQLITE_OK != rc { + return rc + } + } else { + + btreeReleaseAllCursorPages(tls, p) + } + } + p = (*BtCursor)(unsafe.Pointer(p)).FpNext + } + return SQLITE_OK +} + +// Clear the current cursor position. +func Xsqlite3BtreeClearCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:66252:21: */ + + Xsqlite3_free(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpKey) + (*BtCursor)(unsafe.Pointer(pCur)).FpKey = uintptr(0) + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) +} + +// In this version of BtreeMoveto, pKey is a packed index record +// such as is generated by the OP_MakeRecord opcode. Unpack the +// record and then call BtreeMovetoUnpacked() to do the work. +func btreeMoveto(tls *libc.TLS, pCur uintptr, pKey uintptr, nKey I64, bias int32, pRes uintptr) int32 { /* sqlite3.c:66264:12: */ + var rc int32 // Status code + var pIdxKey uintptr + var pKeyInfo uintptr // Unpacked index key + + if !(pKey != 0) { + goto __1 + } + pKeyInfo = (*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo + + pIdxKey = Xsqlite3VdbeAllocUnpackedRecord(tls, pKeyInfo) + if !(pIdxKey == uintptr(0)) { + goto __3 + } + return SQLITE_NOMEM +__3: + ; + Xsqlite3VdbeRecordUnpack(tls, pKeyInfo, int32(nKey), pKey, pIdxKey) + if !((int32((*UnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) == 0) || (int32((*UnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField) > int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField))) { + goto __4 + } + rc = Xsqlite3CorruptError(tls, 66281) + goto moveto_done +__4: + ; + goto __2 +__1: + pIdxKey = uintptr(0) +__2: + ; + rc = Xsqlite3BtreeMovetoUnpacked(tls, pCur, pIdxKey, nKey, bias, pRes) +moveto_done: + if !(pIdxKey != 0) { + goto __5 + } + Xsqlite3DbFree(tls, (*KeyInfo1)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo)).Fdb, pIdxKey) +__5: + ; + return rc +} + +// Restore the cursor to the position it was in (or as close to as possible) +// when saveCursorPosition() was called. Note that this call deletes the +// saved position info stored by saveCursorPosition(), so there can be +// at most one effective restoreCursorPosition() call after each +// saveCursorPosition(). +func btreeRestoreCursorPosition(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:66302:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 + *(*int32)(unsafe.Pointer(bp /* skipNext */)) = 0 + + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_FAULT { + return (*BtCursor)(unsafe.Pointer(pCur)).FskipNext + } + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + if Xsqlite3FaultSim(tls, 410) != 0 { + rc = SQLITE_IOERR + } else { + rc = btreeMoveto(tls, pCur, (*BtCursor)(unsafe.Pointer(pCur)).FpKey, (*BtCursor)(unsafe.Pointer(pCur)).FnKey, 0, bp /* &skipNext */) + } + if rc == SQLITE_OK { + Xsqlite3_free(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpKey) + (*BtCursor)(unsafe.Pointer(pCur)).FpKey = uintptr(0) + + if *(*int32)(unsafe.Pointer(bp /* skipNext */)) != 0 { + (*BtCursor)(unsafe.Pointer(pCur)).FskipNext = *(*int32)(unsafe.Pointer(bp /* skipNext */)) + } + if ((*BtCursor)(unsafe.Pointer(pCur)).FskipNext != 0) && (int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID) { + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_SKIPNEXT) + } + } + return rc +} + +// Determine whether or not a cursor has moved from the position where +// it was last placed, or has been invalidated for any other reason. +// Cursors can move when the row they are pointing at is deleted out +// from under them, for example. Cursor might also move if a btree +// is rebalanced. +// +// Calling this routine with a NULL cursor pointer returns false. +// +// Use the separate sqlite3BtreeCursorRestore() routine to restore a cursor +// back to where it ought to be if this routine returns true. +func Xsqlite3BtreeCursorHasMoved(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:66345:20: */ + + return (libc.Bool32(CURSOR_VALID != int32(*(*U8)(unsafe.Pointer(pCur))))) +} + +// Return a pointer to a fake BtCursor object that will always answer +// false to the sqlite3BtreeCursorHasMoved() routine above. The fake +// cursor returned must not be used with any other Btree interface. +func Xsqlite3BtreeFakeValidCursor(tls *libc.TLS) uintptr { /* sqlite3.c:66358:25: */ + + return uintptr(unsafe.Pointer(&fakeCursor)) +} + +var fakeCursor U8 = U8(CURSOR_VALID) /* sqlite3.c:66359:13 */ + +// This routine restores a cursor back to its original position after it +// has been moved by some outside activity (such as a btree rebalance or +// a row having been deleted out from under the cursor). +// +// On success, the *pDifferentRow parameter is false if the cursor is left +// pointing at exactly the same row. *pDifferntRow is the row the cursor +// was pointing to has been deleted, forcing the cursor to point to some +// nearby row. +// +// This routine should only be called for a cursor that just returned +// TRUE from sqlite3BtreeCursorHasMoved(). +func Xsqlite3BtreeCursorRestore(tls *libc.TLS, pCur uintptr, pDifferentRow uintptr) int32 { /* sqlite3.c:66377:20: */ + var rc int32 + + rc = func() int32 { + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) >= CURSOR_REQUIRESEEK { + return btreeRestoreCursorPosition(tls, pCur) + } + return SQLITE_OK + }() + if rc != 0 { + *(*int32)(unsafe.Pointer(pDifferentRow)) = 1 + return rc + } + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + *(*int32)(unsafe.Pointer(pDifferentRow)) = 1 + } else { + *(*int32)(unsafe.Pointer(pDifferentRow)) = 0 + } + return SQLITE_OK +} + +// Provide flag hints to the cursor. +func Xsqlite3BtreeCursorHintFlags(tls *libc.TLS, pCur uintptr, x uint32) { /* sqlite3.c:66409:21: */ + + (*BtCursor)(unsafe.Pointer(pCur)).Fhints = U8(x) +} + +// Given a page number of a regular database page, return the page +// number for the pointer-map page that contains the entry for the +// input page number. +// +// Return 0 (not a valid page) for pgno==1 since there is +// no pointer map associated with page 1. The integrity_check logic +// requires that ptrmapPageno(*,1)!=1. +func ptrmapPageno(tls *libc.TLS, pBt uintptr, pgno Pgno) Pgno { /* sqlite3.c:66425:13: */ + var nPagesPerMapPage int32 + var iPtrMap Pgno + var ret Pgno + + if pgno < Pgno(2) { + return Pgno(0) + } + nPagesPerMapPage = (int32(((*BtShared)(unsafe.Pointer(pBt)).FusableSize / U32(5)) + U32(1))) + iPtrMap = ((pgno - Pgno(2)) / Pgno(nPagesPerMapPage)) + ret = ((iPtrMap * Pgno(nPagesPerMapPage)) + Pgno(2)) + if ret == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1)) { + ret++ + } + return ret +} + +// Write an entry into the pointer map. +// +// This routine updates the pointer map entry for page number 'key' +// so that it maps to type 'eType' and parent page number 'pgno'. +// +// If *pRC is initially non-zero (non-SQLITE_OK) then this routine is +// a no-op. If an error occurs, the appropriate error code is written +// into *pRC. +func ptrmapPut(tls *libc.TLS, pBt uintptr, key Pgno, eType U8, parent Pgno, pRC uintptr) { /* sqlite3.c:66449:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pDbPage uintptr at bp, 8 + // The pointer map page + var pPtrmap uintptr // The pointer map data + var iPtrmap Pgno // The pointer map page number + var offset int32 // Offset in pointer map page + var rc int32 // Return code from subfunctions + + if !(*(*int32)(unsafe.Pointer(pRC)) != 0) { + goto __1 + } + return +__1: + ; + + // The super-journal page number must never be used as a pointer map page + + if !(key == Pgno(0)) { + goto __2 + } + *(*int32)(unsafe.Pointer(pRC)) = Xsqlite3CorruptError(tls, 66464) + return +__2: + ; + iPtrmap = ptrmapPageno(tls, pBt, key) + rc = Xsqlite3PagerGet(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, iPtrmap, bp /* &pDbPage */, 0) + if !(rc != SQLITE_OK) { + goto __3 + } + *(*int32)(unsafe.Pointer(pRC)) = rc + return +__3: + ; + if !(int32(*(*int8)(unsafe.Pointer((Xsqlite3PagerGetExtra(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))))))) != 0) { + goto __4 + } + // The first byte of the extra data is the MemPage.isInit byte. + // If that byte is set, it means this page is also being used + // as a btree page. + *(*int32)(unsafe.Pointer(pRC)) = Xsqlite3CorruptError(tls, 66477) + goto ptrmap_exit +__4: + ; + offset = (int32(Pgno(5) * ((key - iPtrmap) - Pgno(1)))) + if !(offset < 0) { + goto __5 + } + *(*int32)(unsafe.Pointer(pRC)) = Xsqlite3CorruptError(tls, 66482) + goto ptrmap_exit +__5: + ; + + pPtrmap = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))) + + if !((int32(eType) != int32(*(*U8)(unsafe.Pointer(pPtrmap + uintptr(offset))))) || (Xsqlite3Get4byte(tls, (pPtrmap+uintptr((offset+1)))) != parent)) { + goto __6 + } + + *(*int32)(unsafe.Pointer(pRC)) = libc.AssignInt32(&rc, Xsqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */)))) + if !(rc == SQLITE_OK) { + goto __7 + } + *(*U8)(unsafe.Pointer(pPtrmap + uintptr(offset))) = eType + Xsqlite3Put4byte(tls, (pPtrmap + uintptr((offset + 1))), parent) +__7: + ; +__6: + ; + +ptrmap_exit: + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))) +} + +// Read an entry from the pointer map. +// +// This routine retrieves the pointer map entry for page 'key', writing +// the type and parent page number to *pEType and *pPgno respectively. +// An error code is returned if something goes wrong, otherwise SQLITE_OK. +func ptrmapGet(tls *libc.TLS, pBt uintptr, key Pgno, pEType uintptr, pPgno uintptr) int32 { /* sqlite3.c:66508:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pDbPage uintptr at bp, 8 + // The pointer map page + var iPtrmap int32 // Pointer map page index + var pPtrmap uintptr // Pointer map page data + var offset int32 // Offset of entry in pointer map + var rc int32 + + iPtrmap = int32(ptrmapPageno(tls, pBt, key)) + rc = Xsqlite3PagerGet(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, uint32(iPtrmap), bp /* &pDbPage */, 0) + if rc != 0 { + return rc + } + pPtrmap = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))) + + offset = (int32(Pgno(5) * ((key - Pgno(iPtrmap)) - Pgno(1)))) + if offset < 0 { + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))) + return Xsqlite3CorruptError(tls, 66527) + } + + *(*U8)(unsafe.Pointer(pEType)) = *(*U8)(unsafe.Pointer(pPtrmap + uintptr(offset))) + if pPgno != 0 { + *(*Pgno)(unsafe.Pointer(pPgno)) = Xsqlite3Get4byte(tls, (pPtrmap + uintptr((offset + 1)))) + } + + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))) + if (int32(*(*U8)(unsafe.Pointer(pEType))) < 1) || (int32(*(*U8)(unsafe.Pointer(pEType))) > 5) { + return Xsqlite3CorruptError(tls, 66535) + } + return SQLITE_OK +} + +// Given a btree page and a cell index (0 means the first cell on +// the page, 1 means the second cell, and so forth) return a pointer +// to the cell content. +// +// findCellPastPtr() does the same except it skips past the initial +// 4-byte child pointer found on interior pages, if there is one. +// +// This routine works only for pages that do not contain overflow cells. + +// This is common tail processing for btreeParseCellPtr() and +// btreeParseCellPtrIndex() for the case when the cell does not fit entirely +// on a single B-tree page. Make necessary adjustments to the CellInfo +// structure. +func btreeParseCellAdjustSizeForOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { /* sqlite3.c:66567:29: */ + // If the payload will not fit completely on the local page, we have + // to decide how much to store locally and how much to spill onto + // overflow pages. The strategy is to minimize the amount of unused + // space on overflow pages while keeping the amount of local storage + // in between minLocal and maxLocal. + // + // Warning: changing the way overflow payload is distributed in any + // way will result in an incompatible file format. + var minLocal int32 // Minimum amount of payload held locally + var maxLocal int32 // Maximum amount of payload held locally + var surplus int32 // Overflow payload available for local storage + + minLocal = int32((*MemPage)(unsafe.Pointer(pPage)).FminLocal) + maxLocal = int32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) + surplus = (int32(U32(minLocal) + (((*CellInfo)(unsafe.Pointer(pInfo)).FnPayload - U32(minLocal)) % ((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - U32(4))))) + + if surplus <= maxLocal { + (*CellInfo)(unsafe.Pointer(pInfo)).FnLocal = U16(surplus) + } else { + (*CellInfo)(unsafe.Pointer(pInfo)).FnLocal = U16(minLocal) + } + (*CellInfo)(unsafe.Pointer(pInfo)).FnSize = (U16(int32((U16((int64(((*CellInfo)(unsafe.Pointer(pInfo)).FpPayload + uintptr((*CellInfo)(unsafe.Pointer(pInfo)).FnLocal))) - int64(pCell)) / 1))) + 4)) +} + +// Given a record with nPayload bytes of payload stored within btree +// page pPage, return the number of bytes of payload stored locally. +func btreePayloadToLocal(tls *libc.TLS, pPage uintptr, nPayload I64) int32 { /* sqlite3.c:66602:12: */ + var maxLocal int32 // Maximum amount of payload held locally + maxLocal = int32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) + if nPayload <= I64(maxLocal) { + return int32(nPayload) + } else { + var minLocal int32 // Minimum amount of payload held locally + var surplus int32 // Overflow payload available for local storage + minLocal = int32((*MemPage)(unsafe.Pointer(pPage)).FminLocal) + surplus = (int32(I64(minLocal) + ((nPayload - I64(minLocal)) % (I64((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - U32(4)))))) + if surplus <= maxLocal { + return surplus + } + return minLocal + } + return int32(0) +} + +// The following routines are implementations of the MemPage.xParseCell() +// method. +// +// Parse a cell content block and fill in the CellInfo structure. +// +// btreeParseCellPtr() => table btree leaf nodes +// btreeParseCellNoPayload() => table btree internal nodes +// btreeParseCellPtrIndex() => index btree nodes +// +// There is also a wrapper function btreeParseCell() that works for +// all MemPage types and that references the cell by index rather than +// by pointer. +func btreeParseCellPtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { /* sqlite3.c:66630:13: */ + + _ = pPage + (*CellInfo)(unsafe.Pointer(pInfo)).FnSize = (U16(4 + int32(Xsqlite3GetVarint(tls, (pCell+4), (pInfo /* &.nKey */))))) + (*CellInfo)(unsafe.Pointer(pInfo)).FnPayload = U32(0) + (*CellInfo)(unsafe.Pointer(pInfo)).FnLocal = U16(0) + (*CellInfo)(unsafe.Pointer(pInfo)).FpPayload = uintptr(0) + return +} + +func btreeParseCellPtr(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { /* sqlite3.c:66647:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pIter uintptr // For scanning through pCell + var nPayload U32 // Number of bytes of cell payload + // var iKey U64 at bp, 8 + // Extracted Key value + + pIter = pCell + + // The next block of code is equivalent to: + // + // pIter += getVarint32(pIter, nPayload); + // + // The code is inlined to avoid a function call. + nPayload = U32(*(*U8)(unsafe.Pointer(pIter))) + if nPayload >= U32(0x80) { + var pEnd uintptr = (pIter + 8) + nPayload = nPayload & (U32(0x7f)) + for ok := true; ok; ok = (((int32(*(*U8)(unsafe.Pointer(pIter)))) >= 0x80) && (pIter < pEnd)) { + nPayload = ((nPayload << 7) | (U32(int32(*(*U8)(unsafe.Pointer(libc.PreIncUintptr(&pIter, 1)))) & 0x7f))) + } + } + pIter++ + + // The next block of code is equivalent to: + // + // pIter += getVarint(pIter, (u64*)&pInfo->nKey); + // + // The code is inlined to avoid a function call. + *(*U64)(unsafe.Pointer(bp /* iKey */)) = U64(*(*U8)(unsafe.Pointer(pIter))) + if *(*U64)(unsafe.Pointer(bp /* iKey */)) >= uint64(0x80) { + var pEnd uintptr = (pIter + 7) + *(*U64)(unsafe.Pointer(bp /* iKey */)) &= uint64(0x7f) + for 1 != 0 { + *(*U64)(unsafe.Pointer(bp /* iKey */)) = ((*(*U64)(unsafe.Pointer(bp /* iKey */)) << 7) | (U64(int32(*(*U8)(unsafe.Pointer(libc.PreIncUintptr(&pIter, 1)))) & 0x7f))) + if (int32(*(*U8)(unsafe.Pointer(pIter)))) < 0x80 { + break + } + if pIter >= pEnd { + *(*U64)(unsafe.Pointer(bp /* iKey */)) = ((*(*U64)(unsafe.Pointer(bp /* iKey */)) << 8) | U64(*(*U8)(unsafe.Pointer(libc.PreIncUintptr(&pIter, 1))))) + break + } + } + } + pIter++ + + (*CellInfo)(unsafe.Pointer(pInfo)).FnKey = *(*I64)(unsafe.Pointer(bp /* &iKey */)) + (*CellInfo)(unsafe.Pointer(pInfo)).FnPayload = nPayload + (*CellInfo)(unsafe.Pointer(pInfo)).FpPayload = pIter + + if nPayload <= U32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + // This is the (easy) common case where the entire payload fits + // on the local page. No overflow is required. + (*CellInfo)(unsafe.Pointer(pInfo)).FnSize = (U16(nPayload + U32((U16((int64(pIter) - int64(pCell)) / 1))))) + if int32((*CellInfo)(unsafe.Pointer(pInfo)).FnSize) < 4 { + (*CellInfo)(unsafe.Pointer(pInfo)).FnSize = U16(4) + } + (*CellInfo)(unsafe.Pointer(pInfo)).FnLocal = U16(nPayload) + } else { + btreeParseCellAdjustSizeForOverflow(tls, pPage, pCell, pInfo) + } +} + +func btreeParseCellPtrIndex(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) { /* sqlite3.c:66715:13: */ + var pIter uintptr // For scanning through pCell + var nPayload U32 // Number of bytes of cell payload + + pIter = (pCell + uintptr((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + nPayload = U32(*(*U8)(unsafe.Pointer(pIter))) + if nPayload >= U32(0x80) { + var pEnd uintptr = (pIter + 8) + nPayload = nPayload & (U32(0x7f)) + for ok := true; ok; ok = ((int32(*(*U8)(unsafe.Pointer(pIter))) >= 0x80) && (pIter < pEnd)) { + nPayload = ((nPayload << 7) | (U32(int32(*(*U8)(unsafe.Pointer(libc.PreIncUintptr(&pIter, 1)))) & 0x7f))) + } + } + pIter++ + (*CellInfo)(unsafe.Pointer(pInfo)).FnKey = I64(nPayload) + (*CellInfo)(unsafe.Pointer(pInfo)).FnPayload = nPayload + (*CellInfo)(unsafe.Pointer(pInfo)).FpPayload = pIter + + if nPayload <= U32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + // This is the (easy) common case where the entire payload fits + // on the local page. No overflow is required. + (*CellInfo)(unsafe.Pointer(pInfo)).FnSize = (U16(nPayload + U32((U16((int64(pIter) - int64(pCell)) / 1))))) + if int32((*CellInfo)(unsafe.Pointer(pInfo)).FnSize) < 4 { + (*CellInfo)(unsafe.Pointer(pInfo)).FnSize = U16(4) + } + (*CellInfo)(unsafe.Pointer(pInfo)).FnLocal = U16(nPayload) + } else { + btreeParseCellAdjustSizeForOverflow(tls, pPage, pCell, pInfo) + } +} + +func btreeParseCell(tls *libc.TLS, pPage uintptr, iCell int32, pInfo uintptr) { /* sqlite3.c:66752:13: */ + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (iCell))))))))))), pInfo) +} + +// The following routines are implementations of the MemPage.xCellSize +// method. +// +// Compute the total number of bytes that a Cell needs in the cell +// data area of the btree-page. The return number includes the cell +// data header and the local payload, but not any overflow page or +// the space used by the cell pointer. +// +// cellSizePtrNoPayload() => table internal nodes +// cellSizePtr() => all index nodes & table leaf nodes +func cellSizePtr(tls *libc.TLS, pPage uintptr, pCell uintptr) U16 { /* sqlite3.c:66772:12: */ + var pIter uintptr = (pCell + uintptr((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) // For looping over bytes of pCell + var pEnd uintptr // End mark for a varint + var nSize U32 // Size value to return + + nSize = U32(*(*U8)(unsafe.Pointer(pIter))) + if nSize >= U32(0x80) { + pEnd = (pIter + 8) + nSize = nSize & (U32(0x7f)) + for ok := true; ok; ok = ((int32(*(*U8)(unsafe.Pointer(pIter))) >= 0x80) && (pIter < pEnd)) { + nSize = ((nSize << 7) | (U32(int32(*(*U8)(unsafe.Pointer(libc.PreIncUintptr(&pIter, 1)))) & 0x7f))) + } + } + pIter++ + if (*MemPage)(unsafe.Pointer(pPage)).FintKey != 0 { + // pIter now points at the 64-bit integer key value, a variable length + // integer. The following block moves pIter to point at the first byte + // past the end of the key value. + pEnd = (pIter + 9) + for (((int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pIter, 1))))) & 0x80) != 0) && (pIter < pEnd) { + } + } + + if nSize <= U32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + nSize = nSize + (U32((int64(pIter) - int64(pCell)) / 1)) + if nSize < U32(4) { + nSize = U32(4) + } + } else { + var minLocal int32 = int32((*MemPage)(unsafe.Pointer(pPage)).FminLocal) + nSize = (U32(minLocal) + ((nSize - U32(minLocal)) % ((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - U32(4)))) + + if nSize > U32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + nSize = U32(minLocal) + } + nSize = nSize + (U32(4 + int32((U16((int64(pIter) - int64(pCell)) / 1))))) + } + + return U16(nSize) +} + +func cellSizePtrNoPayload(tls *libc.TLS, pPage uintptr, pCell uintptr) U16 { /* sqlite3.c:66820:12: */ + var pIter uintptr = (pCell + uintptr(4)) // For looping over bytes of pCell + var pEnd uintptr // End mark for a varint + + _ = pPage + + pEnd = (pIter + uintptr(9)) + for (((int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pIter, 1))))) & 0x80) != 0) && (pIter < pEnd) { + } + + return (U16((int64(pIter) - int64(pCell)) / 1)) +} + +// The cell pCell is currently part of page pSrc but will ultimately be part +// of pPage. (pSrc and pPager are often the same.) If pCell contains a +// pointer to an overflow page, insert an entry into the pointer-map for +// the overflow page that will be valid after pCell has been moved to pPage. +func ptrmapPutOvflPtr(tls *libc.TLS, pPage uintptr, pSrc uintptr, pCell uintptr, pRC uintptr) { /* sqlite3.c:66858:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var info CellInfo at bp, 24 + + if *(*int32)(unsafe.Pointer(pRC)) != 0 { + return + } + + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, pCell, bp /* &info */) + if U32((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnLocal) < (*CellInfo)(unsafe.Pointer(bp /* &info */)).FnPayload { + var ovfl Pgno + if (Uptr(((*MemPage)(unsafe.Pointer(pSrc)).FaDataEnd)) >= Uptr((pCell))) && (Uptr(((*MemPage)(unsafe.Pointer(pSrc)).FaDataEnd)) < Uptr((pCell + uintptr((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnLocal)))) { + + *(*int32)(unsafe.Pointer(pRC)) = Xsqlite3CorruptError(tls, 66867) + return + } + ovfl = Xsqlite3Get4byte(tls, (pCell + uintptr((int32((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnSize) - 4)))) + ptrmapPut(tls, (*MemPage)(unsafe.Pointer(pPage)).FpBt, ovfl, uint8(PTRMAP_OVERFLOW1), (*MemPage)(unsafe.Pointer(pPage)).Fpgno, pRC) + } +} + +// Defragment the page given. This routine reorganizes cells within the +// page so that there are no free-blocks on the free-block list. +// +// Parameter nMaxFrag is the maximum amount of fragmented space that may be +// present in the page after this routine returns. +// +// EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a +// b-tree page so that there are no freeblocks or fragment bytes, all +// unused bytes are contained in the unallocated space region, and all +// cells are packed tightly at the end of the page. +func defragmentPage(tls *libc.TLS, pPage uintptr, nMaxFrag int32) int32 { /* sqlite3.c:66889:12: */ + var i int32 // Loop counter + var pc int32 // Address of the i-th cell + var hdr int32 // Offset to the page header + var size int32 // Size of a cell + var usableSize int32 // Number of usable bytes on a page + var cellOffset int32 // Offset to the cell pointer array + var cbrk int32 // Offset to the cell content area + var nCell int32 // Number of cells on the page + var data uintptr // The page data + var temp uintptr // Temp area for cell content + var src uintptr // Source of content + var iCellFirst int32 // First allowable cell index + var iCellLast int32 // Last possible cell index + var iCellStart int32 + var pEnd uintptr + var pAddr uintptr + var sz2 int32 + var sz int32 + var top int32 + var iFree2 int32 + var iFree int32 + var pAddr1 uintptr // First cell offset in input + + temp = uintptr(0) + src = libc.AssignUintptr(&data, (*MemPage)(unsafe.Pointer(pPage)).FaData) + hdr = int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + cellOffset = int32((*MemPage)(unsafe.Pointer(pPage)).FcellOffset) + nCell = int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) + + iCellFirst = (cellOffset + (2 * nCell)) + usableSize = int32((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + + // This block handles pages with two or fewer free blocks and nMaxFrag + // or fewer fragmented bytes. In this case it is faster to move the + // two (or one) blocks of cells using memmove() and add the required + // offsets to each pointer in the cell-pointer array than it is to + // reconstruct the entire page. + if !(int32(*(*uint8)(unsafe.Pointer(data + uintptr((hdr + 7))))) <= nMaxFrag) { + goto __1 + } + iFree = ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((hdr + 1)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((hdr + 1))) + 1)))) + if !(iFree > (usableSize - 4)) { + goto __2 + } + return Xsqlite3CorruptError(tls, 66926) +__2: + ; + if !(iFree != 0) { + goto __3 + } + iFree2 = ((int32(*(*uint8)(unsafe.Pointer((data + uintptr(iFree))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr(iFree)) + 1)))) + if !(iFree2 > (usableSize - 4)) { + goto __4 + } + return Xsqlite3CorruptError(tls, 66929) +__4: + ; + if !((0 == iFree2) || ((int32(*(*uint8)(unsafe.Pointer(data + uintptr(iFree2)))) == 0) && (int32(*(*uint8)(unsafe.Pointer(data + uintptr((iFree2 + 1))))) == 0))) { + goto __5 + } + pEnd = (data + uintptr((cellOffset + (nCell * 2)))) + sz2 = 0 + sz = ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((iFree + 2)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((iFree + 2))) + 1)))) + top = ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) + if !(top >= iFree) { + goto __6 + } + return Xsqlite3CorruptError(tls, 66937) +__6: + ; + if !(iFree2 != 0) { + goto __7 + } + if !((iFree + sz) > iFree2) { + goto __9 + } + return Xsqlite3CorruptError(tls, 66940) +__9: + ; + sz2 = ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((iFree2 + 2)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((iFree2 + 2))) + 1)))) + if !((iFree2 + sz2) > usableSize) { + goto __10 + } + return Xsqlite3CorruptError(tls, 66942) +__10: + ; + libc.Xmemmove(tls, (data + uintptr(((iFree + sz) + sz2))), (data + uintptr((iFree + sz))), (uint64(iFree2 - (iFree + sz)))) + sz = sz + (sz2) + goto __8 +__7: + if !((iFree + sz) > usableSize) { + goto __11 + } + return Xsqlite3CorruptError(tls, 66946) +__11: + ; +__8: + ; + + cbrk = (top + sz) + + libc.Xmemmove(tls, (data + uintptr(cbrk)), (data + uintptr(top)), (uint64(iFree - top))) + pAddr = (data + uintptr(cellOffset)) +__12: + if !(pAddr < pEnd) { + goto __14 + } + pc = ((int32(*(*U8)(unsafe.Pointer((pAddr)))) << 8) | int32(*(*U8)(unsafe.Pointer((pAddr) + 1)))) + if !(pc < iFree) { + goto __15 + } + *(*U8)(unsafe.Pointer((pAddr))) = (U8((pc + sz) >> 8)) + *(*U8)(unsafe.Pointer((pAddr) + 1)) = (U8(pc + sz)) + goto __16 +__15: + if !(pc < iFree2) { + goto __17 + } + *(*U8)(unsafe.Pointer((pAddr))) = (U8((pc + sz2) >> 8)) + *(*U8)(unsafe.Pointer((pAddr) + 1)) = (U8(pc + sz2)) +__17: + ; +__16: + ; + goto __13 +__13: + pAddr += uintptr(2) + goto __12 + goto __14 +__14: + ; + goto defragment_out +__5: + ; +__3: + ; +__1: + ; + + cbrk = usableSize + iCellLast = (usableSize - 4) + iCellStart = ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) + i = 0 +__18: + if !(i < nCell) { + goto __20 + } // The i-th cell pointer + pAddr1 = (data + uintptr((cellOffset + (i * 2)))) + pc = ((int32(*(*U8)(unsafe.Pointer((pAddr1)))) << 8) | int32(*(*U8)(unsafe.Pointer((pAddr1) + 1)))) + + // These conditions have already been verified in btreeInitPage() + // if PRAGMA cell_size_check=ON. + if !((pc < iCellStart) || (pc > iCellLast)) { + goto __21 + } + return Xsqlite3CorruptError(tls, 66975) +__21: + ; + + size = int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pPage + 120 /* &.xCellSize */))))(tls, pPage, (src + uintptr(pc)))) + cbrk = cbrk - (size) + if !((cbrk < iCellStart) || ((pc + size) > usableSize)) { + goto __22 + } + return Xsqlite3CorruptError(tls, 66981) +__22: + ; + + *(*U8)(unsafe.Pointer((pAddr1))) = (U8((cbrk) >> 8)) + *(*U8)(unsafe.Pointer((pAddr1) + 1)) = U8(cbrk) + if !(temp == uintptr(0)) { + goto __23 + } + if !(cbrk == pc) { + goto __24 + } + goto __19 +__24: + ; + temp = Xsqlite3PagerTempSpace(tls, (*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FpPager) + libc.Xmemcpy(tls, (temp + uintptr(iCellStart)), (data + uintptr(iCellStart)), (uint64(usableSize - iCellStart))) + src = temp +__23: + ; + libc.Xmemcpy(tls, (data + uintptr(cbrk)), (src + uintptr(pc)), uint64(size)) + goto __19 +__19: + i++ + goto __18 + goto __20 +__20: + ; + *(*uint8)(unsafe.Pointer(data + uintptr((hdr + 7)))) = uint8(0) + +defragment_out: + ; + if !(((int32(*(*uint8)(unsafe.Pointer(data + uintptr((hdr + 7))))) + cbrk) - iCellFirst) != (*MemPage)(unsafe.Pointer(pPage)).FnFree) { + goto __25 + } + return Xsqlite3CorruptError(tls, 67000) +__25: + ; + + *(*uint8)(unsafe.Pointer((data + uintptr((hdr + 5))))) = (U8((cbrk) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)) = U8(cbrk) + *(*uint8)(unsafe.Pointer(data + uintptr((hdr + 1)))) = uint8(0) + *(*uint8)(unsafe.Pointer(data + uintptr((hdr + 2)))) = uint8(0) + libc.Xmemset(tls, (data + uintptr(iCellFirst)), 0, (uint64(cbrk - iCellFirst))) + + return SQLITE_OK +} + +// Search the free-list on page pPg for space to store a cell nByte bytes in +// size. If one can be found, return a pointer to the space and remove it +// from the free-list. +// +// If no suitable space can be found on the free-list, return NULL. +// +// This function may detect corruption within pPg. If corruption is +// detected then *pRc is set to SQLITE_CORRUPT and NULL is returned. +// +// Slots on the free list that are between 1 and 3 bytes larger than nByte +// will be ignored if adding the extra space to the fragmentation count +// causes the fragmentation count to exceed 60. +func pageFindSlot(tls *libc.TLS, pPg uintptr, nByte int32, pRc uintptr) uintptr { /* sqlite3.c:67025:11: */ + var hdr int32 = int32((*MemPage)(unsafe.Pointer(pPg)).FhdrOffset) // Offset to page header + var aData uintptr = (*MemPage)(unsafe.Pointer(pPg)).FaData // Page data + var iAddr int32 = (hdr + 1) // Address of ptr to pc + var pc int32 = ((int32(*(*U8)(unsafe.Pointer((aData + uintptr(iAddr))))) << 8) | int32(*(*U8)(unsafe.Pointer((aData + uintptr(iAddr)) + 1)))) // Address of a free slot + var x int32 // Excess size of the slot + var maxPC int32 = (int32((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPg)).FpBt)).FusableSize - U32(nByte))) // Max address for a usable slot + var size int32 // Size of the free slot + + for pc <= maxPC { + // EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each + // freeblock form a big-endian integer which is the size of the freeblock + // in bytes, including the 4-byte header. + size = ((int32(*(*U8)(unsafe.Pointer((aData + uintptr((pc + 2)))))) << 8) | int32(*(*U8)(unsafe.Pointer((aData + uintptr((pc + 2))) + 1)))) + if (libc.AssignInt32(&x, (size - nByte))) >= 0 { + + if x < 4 { + // EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total + // number of bytes in fragments may not exceed 60. + if int32(*(*U8)(unsafe.Pointer(aData + uintptr((hdr + 7))))) > 57 { + return uintptr(0) + } + + // Remove the slot from the free-list. Update the number of + // fragmented bytes within the page. + libc.Xmemcpy(tls, (aData + uintptr(iAddr)), (aData + uintptr(pc)), uint64(2)) + *(*U8)(unsafe.Pointer(aData + uintptr((hdr + 7)))) += U8((int32(U8(x)))) + } else if (x + pc) > maxPC { + // This slot extends off the end of the usable part of the page + *(*int32)(unsafe.Pointer(pRc)) = Xsqlite3CorruptError(tls, 67054) + return uintptr(0) + } else { + // The slot remains on the free-list. Reduce its size to account + // for the portion used by the new allocation. + *(*U8)(unsafe.Pointer((aData + uintptr((pc + 2))))) = (U8((x) >> 8)) + *(*U8)(unsafe.Pointer((aData + uintptr((pc + 2))) + 1)) = U8(x) + } + return (aData + uintptr((pc + x))) + } + iAddr = pc + pc = ((int32(*(*U8)(unsafe.Pointer((aData + uintptr(pc))))) << 8) | int32(*(*U8)(unsafe.Pointer((aData + uintptr(pc)) + 1)))) + if pc <= (iAddr + size) { + if pc != 0 { + // The next slot in the chain is not past the end of the current slot + *(*int32)(unsafe.Pointer(pRc)) = Xsqlite3CorruptError(tls, 67068) + } + return uintptr(0) + } + } + if pc > ((maxPC + nByte) - 4) { + // The free slot chain extends off the end of the page + *(*int32)(unsafe.Pointer(pRc)) = Xsqlite3CorruptError(tls, 67075) + } + return uintptr(0) +} + +// Allocate nByte bytes of space from within the B-Tree page passed +// as the first argument. Write into *pIdx the index into pPage->aData[] +// of the first byte of allocated space. Return either SQLITE_OK or +// an error code (usually SQLITE_CORRUPT). +// +// The caller guarantees that there is sufficient space to make the +// allocation. This routine might need to defragment in order to bring +// all the space together, however. This routine will avoid using +// the first two bytes past the cell pointer area since presumably this +// allocation is being made in order to insert a new cell, so we will +// also end up needing a new cell pointer. +func allocateSpace(tls *libc.TLS, pPage uintptr, nByte int32, pIdx uintptr) int32 { /* sqlite3.c:67093:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var hdr int32 = int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) // Local cache of pPage->hdrOffset + var data uintptr = (*MemPage)(unsafe.Pointer(pPage)).FaData // Local cache of pPage->aData + var top int32 // First byte of cell content area + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Integer return code + var gap int32 // First byte of gap between cell pointers and cell content + + // Minimum cell size is 4 + + gap = (int32((*MemPage)(unsafe.Pointer(pPage)).FcellOffset) + (2 * int32((*MemPage)(unsafe.Pointer(pPage)).FnCell))) + + // EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size + // and the reserved space is zero (the usual value for reserved space) + // then the cell content offset of an empty page wants to be 65536. + // However, that integer is too large to be stored in a 2-byte unsigned + // integer, so a value of 0 is used in its place. + top = ((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) + // by btreeComputeFreeSpace() + if gap > top { + if (top == 0) && ((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize == U32(65536)) { + top = 65536 + } else { + return Xsqlite3CorruptError(tls, 67122) + } + } + + // If there is enough space between gap and top for one more cell pointer, + // and if the freelist is not empty, then search the + // freelist looking for a slot big enough to satisfy the request. + + if ((*(*U8)(unsafe.Pointer(data + uintptr((hdr + 2)))) != 0) || (*(*U8)(unsafe.Pointer(data + uintptr((hdr + 1)))) != 0)) && ((gap + 2) <= top) { + var pSpace uintptr = pageFindSlot(tls, pPage, nByte, bp /* &rc */) + if pSpace != 0 { + var g2 int32 + + *(*int32)(unsafe.Pointer(pIdx)) = libc.AssignInt32(&g2, (int32((int64(pSpace) - int64(data)) / 1))) + if g2 <= gap { + return Xsqlite3CorruptError(tls, 67140) + } else { + return SQLITE_OK + } + } else if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } + + // The request could not be fulfilled using a freelist slot. Check + // to see if defragmentation is necessary. + + if ((gap + 2) + nByte) > top { + + *(*int32)(unsafe.Pointer(bp /* rc */)) = defragmentPage(tls, pPage, func() int32 { + if (4) < ((*MemPage)(unsafe.Pointer(pPage)).FnFree - (2 + nByte)) { + return 4 + } + return ((*MemPage)(unsafe.Pointer(pPage)).FnFree - (2 + nByte)) + }()) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + top = (((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1) + + } + + // Allocate memory from the gap in between the cell pointer array + // and the cell content area. The btreeComputeFreeSpace() call has already + // validated the freelist. Given that the freelist is valid, there + // is no way that the allocation can extend off the end of the page. + // The assert() below verifies the previous sentence. + top = top - (nByte) + *(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))))) = (U8((top) >> 8)) + *(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)) = U8(top) + + *(*int32)(unsafe.Pointer(pIdx)) = top + return SQLITE_OK +} + +// Return a section of the pPage->aData to the freelist. +// The first byte of the new free block is pPage->aData[iStart] +// and the size of the block is iSize bytes. +// +// Adjacent freeblocks are coalesced. +// +// Even though the freeblock list was checked by btreeComputeFreeSpace(), +// that routine will not detect overlap between cells or freeblocks. Nor +// does it detect cells or freeblocks that encrouch into the reserved bytes +// at the end of the page. So do additional corruption checks inside this +// routine and return SQLITE_CORRUPT if any problems are found. +func freeSpace(tls *libc.TLS, pPage uintptr, iStart U16, iSize U16) int32 { /* sqlite3.c:67189:12: */ + var iPtr U16 // Address of ptr to next freeblock + var iFreeBlk U16 // Address of the next freeblock + var hdr U8 // Page header size. 0 or 100 + var nFrag U8 = U8(0) // Reduction in fragmentation + var iOrigSize U16 = iSize // Original value of iSize + var x U16 // Offset to cell content area + var iEnd U32 = (U32(int32(iStart) + int32(iSize))) // First byte past the iStart buffer + var data uintptr = (*MemPage)(unsafe.Pointer(pPage)).FaData // Page content + + // Minimum cell size is 4 + + // The list of freeblocks must be in ascending order. Find the + // spot on the list where iStart should be inserted. + hdr = (*MemPage)(unsafe.Pointer(pPage)).FhdrOffset + iPtr = (U16(int32(hdr) + 1)) + if (int32(*(*uint8)(unsafe.Pointer(data + uintptr((int32(iPtr) + 1))))) == 0) && (int32(*(*uint8)(unsafe.Pointer(data + uintptr(iPtr)))) == 0) { + iFreeBlk = U16(0) // Shortcut for the case when the freelist is empty + } else { + for (int32(libc.AssignUint16(&iFreeBlk, (U16((int32(*(*uint8)(unsafe.Pointer((data + uintptr(iPtr))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr(iPtr)) + 1)))))))) < int32(iStart) { + if int32(iFreeBlk) < (int32(iPtr) + 4) { + if int32(iFreeBlk) == 0 { + break + } // TH3: corrupt082.100 + return Xsqlite3CorruptError(tls, 67218) + } + iPtr = iFreeBlk + } + if U32(iFreeBlk) > ((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - U32(4)) { // TH3: corrupt081.100 + return Xsqlite3CorruptError(tls, 67223) + } + + // At this point: + // iFreeBlk: First freeblock after iStart, or zero if none + // iPtr: The address of a pointer to iFreeBlk + // + // Check to see if iFreeBlk should be coalesced onto the end of iStart. + if (iFreeBlk != 0) && ((iEnd + U32(3)) >= U32(iFreeBlk)) { + nFrag = (U8(U32(iFreeBlk) - iEnd)) + if iEnd > U32(iFreeBlk) { + return Xsqlite3CorruptError(tls, 67235) + } + iEnd = (U32(int32(iFreeBlk) + ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((int32(iFreeBlk) + 2)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((int32(iFreeBlk) + 2))) + 1)))))) + if iEnd > (*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { + return Xsqlite3CorruptError(tls, 67238) + } + iSize = (U16(iEnd - U32(iStart))) + iFreeBlk = (U16((int32(*(*uint8)(unsafe.Pointer((data + uintptr(iFreeBlk))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr(iFreeBlk)) + 1))))) + } + + // If iPtr is another freeblock (that is, if iPtr is not the freelist + // pointer in the page header) then check to see if iStart should be + // coalesced onto the end of iPtr. + if int32(iPtr) > (int32(hdr) + 1) { + var iPtrEnd int32 = (int32(iPtr) + ((int32(*(*uint8)(unsafe.Pointer((data + uintptr((int32(iPtr) + 2)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((int32(iPtr) + 2))) + 1))))) + if (iPtrEnd + 3) >= int32(iStart) { + if iPtrEnd > int32(iStart) { + return Xsqlite3CorruptError(tls, 67251) + } + nFrag = U8(int32(nFrag) + (int32(iStart) - iPtrEnd)) + iSize = (U16(iEnd - U32(iPtr))) + iStart = iPtr + } + } + if int32(nFrag) > int32(*(*uint8)(unsafe.Pointer(data + uintptr((int32(hdr) + 7))))) { + return Xsqlite3CorruptError(tls, 67257) + } + *(*uint8)(unsafe.Pointer(data + uintptr((int32(hdr) + 7)))) -= uint8((int32(nFrag))) + } + x = (U16((int32(*(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5)))))) << 8) | int32(*(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5))) + 1))))) + if int32(iStart) <= int32(x) { + // The new freeblock is at the beginning of the cell content area, + // so just extend the cell content area rather than create another + // freelist entry + if int32(iStart) < int32(x) { + return Xsqlite3CorruptError(tls, 67265) + } + if int32(iPtr) != (int32(hdr) + 1) { + return Xsqlite3CorruptError(tls, 67266) + } + *(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 1))))) = (U8((int32(iFreeBlk)) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 1))) + 1)) = U8(iFreeBlk) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5))))) = (U8((iEnd) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5))) + 1)) = U8(iEnd) + } else { + // Insert the new freeblock into the freelist + *(*uint8)(unsafe.Pointer((data + uintptr(iPtr)))) = (U8((int32(iStart)) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr(iPtr)) + 1)) = U8(iStart) + } + if (int32((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FbtsFlags) & BTS_FAST_SECURE) != 0 { + // Overwrite deleted information with zeros when the secure_delete + // option is enabled + libc.Xmemset(tls, (data + uintptr(iStart)), 0, uint64(iSize)) + } + *(*uint8)(unsafe.Pointer((data + uintptr(iStart)))) = (U8((int32(iFreeBlk)) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr(iStart)) + 1)) = U8(iFreeBlk) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(iStart) + 2))))) = (U8((int32(iSize)) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(iStart) + 2))) + 1)) = U8(iSize) + *(*int32)(unsafe.Pointer(pPage + 20 /* &.nFree */)) += (int32(iOrigSize)) + return SQLITE_OK +} + +// Decode the flags byte (the first byte of the header) for a page +// and initialize fields of the MemPage structure accordingly. +// +// Only the following combinations are supported. Anything different +// indicates a corrupt database files: +// +// PTF_ZERODATA +// PTF_ZERODATA | PTF_LEAF +// PTF_LEAFDATA | PTF_INTKEY +// PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF +func decodeFlags(tls *libc.TLS, pPage uintptr, flagByte int32) int32 { /* sqlite3.c:67296:12: */ + var pBt uintptr // A copy of pPage->pBt + + (*MemPage)(unsafe.Pointer(pPage)).Fleaf = (U8(flagByte >> 3)) + flagByte = flagByte & (libc.CplInt32(PTF_LEAF)) + (*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize = (U8(4 - (4 * int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf)))) + (*MemPage)(unsafe.Pointer(pPage)).FxCellSize = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) U16 + }{cellSizePtr})) + pBt = (*MemPage)(unsafe.Pointer(pPage)).FpBt + if flagByte == (PTF_LEAFDATA | PTF_INTKEY) { + // EVIDENCE-OF: R-07291-35328 A value of 5 (0x05) means the page is an + // interior table b-tree page. + + // EVIDENCE-OF: R-26900-09176 A value of 13 (0x0d) means the page is a + // leaf table b-tree page. + + (*MemPage)(unsafe.Pointer(pPage)).FintKey = U8(1) + if (*MemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + (*MemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = U8(1) + (*MemPage)(unsafe.Pointer(pPage)).FxParseCell = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) + }{btreeParseCellPtr})) + } else { + (*MemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = U8(0) + (*MemPage)(unsafe.Pointer(pPage)).FxCellSize = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) U16 + }{cellSizePtrNoPayload})) + (*MemPage)(unsafe.Pointer(pPage)).FxParseCell = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) + }{btreeParseCellPtrNoPayload})) + } + (*MemPage)(unsafe.Pointer(pPage)).FmaxLocal = (*BtShared)(unsafe.Pointer(pBt)).FmaxLeaf + (*MemPage)(unsafe.Pointer(pPage)).FminLocal = (*BtShared)(unsafe.Pointer(pBt)).FminLeaf + } else if flagByte == PTF_ZERODATA { + // EVIDENCE-OF: R-43316-37308 A value of 2 (0x02) means the page is an + // interior index b-tree page. + + // EVIDENCE-OF: R-59615-42828 A value of 10 (0x0a) means the page is a + // leaf index b-tree page. + + (*MemPage)(unsafe.Pointer(pPage)).FintKey = U8(0) + (*MemPage)(unsafe.Pointer(pPage)).FintKeyLeaf = U8(0) + (*MemPage)(unsafe.Pointer(pPage)).FxParseCell = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) + }{btreeParseCellPtrIndex})) + (*MemPage)(unsafe.Pointer(pPage)).FmaxLocal = (*BtShared)(unsafe.Pointer(pBt)).FmaxLocal + (*MemPage)(unsafe.Pointer(pPage)).FminLocal = (*BtShared)(unsafe.Pointer(pBt)).FminLocal + } else { + // EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is + // an error. + return Xsqlite3CorruptError(tls, 67339) + } + (*MemPage)(unsafe.Pointer(pPage)).Fmax1bytePayload = (*BtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload + return SQLITE_OK +} + +// Compute the amount of freespace on the page. In other words, fill +// in the pPage->nFree field. +func btreeComputeFreeSpace(tls *libc.TLS, pPage uintptr) int32 { /* sqlite3.c:67349:12: */ + var pc int32 // Address of a freeblock within pPage->aData[] + var hdr U8 // Offset to beginning of page header + var data uintptr // Equal to pPage->aData + var usableSize int32 // Amount of usable space on each page + var nFree int32 // Number of unused bytes on the page + var top int32 // First byte of the cell content area + var iCellFirst int32 // First allowable cell or freeblock offset + var iCellLast int32 // Last possible cell or freeblock offset + + usableSize = int32((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + hdr = (*MemPage)(unsafe.Pointer(pPage)).FhdrOffset + data = (*MemPage)(unsafe.Pointer(pPage)).FaData + // EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates + // the start of the cell content area. A zero value for this integer is + // interpreted as 65536. + top = (((((int32(*(*U8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5))) + 1)))) - 1) & 0xffff) + 1) + iCellFirst = (((int32(hdr) + 8) + int32((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + (2 * int32((*MemPage)(unsafe.Pointer(pPage)).FnCell))) + iCellLast = (usableSize - 4) + + // Compute the total free space on the page + // EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the + // start of the first freeblock on the page, or is zero if there are no + // freeblocks. + pc = ((int32(*(*U8)(unsafe.Pointer((data + uintptr((int32(hdr) + 1)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((int32(hdr) + 1))) + 1)))) + nFree = (int32(*(*U8)(unsafe.Pointer(data + uintptr((int32(hdr) + 7))))) + top) // Init nFree to non-freeblock free space + if pc > 0 { + var next U32 + var size U32 + if pc < top { + // EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will + // always be at least one cell before the first freeblock. + return Xsqlite3CorruptError(tls, 67390) + } + for 1 != 0 { + if pc > iCellLast { + // Freeblock off the end of the page + return Xsqlite3CorruptError(tls, 67395) + } + next = (U32((int32(*(*U8)(unsafe.Pointer((data + uintptr(pc))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr(pc)) + 1))))) + size = (U32((int32(*(*U8)(unsafe.Pointer((data + uintptr((pc + 2)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((pc + 2))) + 1))))) + nFree = (int32(U32(nFree) + size)) + if next <= ((U32(pc) + size) + U32(3)) { + break + } + pc = int32(next) + } + if next > U32(0) { + // Freeblock not in ascending order + return Xsqlite3CorruptError(tls, 67405) + } + if (U32(pc) + size) > uint32(usableSize) { + // Last freeblock extends past page end + return Xsqlite3CorruptError(tls, 67409) + } + } + + // At this point, nFree contains the sum of the offset to the start + // of the cell-content area plus the number of free bytes within + // the cell-content area. If this is greater than the usable-size + // of the page, then the page must be corrupted. This check also + // serves to verify that the offset to the start of the cell-content + // area, according to the page header, lies within the page. + if (nFree > usableSize) || (nFree < iCellFirst) { + return Xsqlite3CorruptError(tls, 67421) + } + (*MemPage)(unsafe.Pointer(pPage)).FnFree = int32((U16(nFree - iCellFirst))) + return SQLITE_OK +} + +// Do additional sanity check after btreeInitPage() if +// PRAGMA cell_size_check=ON +func btreeCellSizeCheck(tls *libc.TLS, pPage uintptr) int32 { /* sqlite3.c:67431:28: */ + var iCellFirst int32 // First allowable cell or freeblock offset + var iCellLast int32 // Last possible cell or freeblock offset + var i int32 // Index into the cell pointer array + var sz int32 // Size of a cell + var pc int32 // Address of a freeblock within pPage->aData[] + var data uintptr // Equal to pPage->aData + var usableSize int32 // Maximum usable space on the page + var cellOffset int32 // Start of cell content area + + iCellFirst = (int32((*MemPage)(unsafe.Pointer(pPage)).FcellOffset) + (2 * int32((*MemPage)(unsafe.Pointer(pPage)).FnCell))) + usableSize = int32((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + iCellLast = (usableSize - 4) + data = (*MemPage)(unsafe.Pointer(pPage)).FaData + cellOffset = int32((*MemPage)(unsafe.Pointer(pPage)).FcellOffset) + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + iCellLast-- + } + for i = 0; i < int32((*MemPage)(unsafe.Pointer(pPage)).FnCell); i++ { + pc = int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer((data + uintptr((cellOffset + (i * 2)))))))) + + if (pc < iCellFirst) || (pc > iCellLast) { + return Xsqlite3CorruptError(tls, 67452) + } + sz = int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pPage + 120 /* &.xCellSize */))))(tls, pPage, (data + uintptr(pc)))) + + if (pc + sz) > usableSize { + return Xsqlite3CorruptError(tls, 67457) + } + } + return SQLITE_OK +} + +// Initialize the auxiliary information for a disk block. +// +// Return SQLITE_OK on success. If we see that the page does +// not contain a well-formed database page, then return +// SQLITE_CORRUPT. Note that a return of SQLITE_OK does not +// guarantee that the page is well-formed. It only shows that +// we failed to detect any corruption. +func btreeInitPage(tls *libc.TLS, pPage uintptr) int32 { /* sqlite3.c:67472:12: */ + var data uintptr // Equal to pPage->aData + var pBt uintptr // The main btree structure + + pBt = (*MemPage)(unsafe.Pointer(pPage)).FpBt + data = ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset)) + // EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating + // the b-tree page type. + if decodeFlags(tls, pPage, int32(*(*U8)(unsafe.Pointer(data)))) != 0 { + return Xsqlite3CorruptError(tls, 67489) + } + + (*MemPage)(unsafe.Pointer(pPage)).FmaskPage = (U16((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(1))) + (*MemPage)(unsafe.Pointer(pPage)).FnOverflow = U8(0) + (*MemPage)(unsafe.Pointer(pPage)).FcellOffset = (U16((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 8) + int32((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize))) + (*MemPage)(unsafe.Pointer(pPage)).FaCellIdx = ((data + uintptr((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + uintptr(8)) + (*MemPage)(unsafe.Pointer(pPage)).FaDataEnd = ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*BtShared)(unsafe.Pointer(pBt)).FusableSize)) + (*MemPage)(unsafe.Pointer(pPage)).FaDataOfst = ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + // EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the + // number of cells on the page. + (*MemPage)(unsafe.Pointer(pPage)).FnCell = (U16((int32(*(*U8)(unsafe.Pointer((data + 3)))) << 8) | int32(*(*U8)(unsafe.Pointer((data + 3) + 1))))) + if U32((*MemPage)(unsafe.Pointer(pPage)).FnCell) > (((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(8)) / U32(6)) { + // To many cells for a single page. The page must be corrupt + return Xsqlite3CorruptError(tls, 67503) + } + + // EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only + // possible for a root page of a table that contains no rows) then the + // offset to the cell content area will equal the page size minus the + // bytes of reserved space. + + (*MemPage)(unsafe.Pointer(pPage)).FnFree = -1 // Indicate that this value is yet uncomputed + (*MemPage)(unsafe.Pointer(pPage)).FisInit = U8(1) + if ((*Sqlite3)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags & uint64(SQLITE_CellSizeCk)) != 0 { + return btreeCellSizeCheck(tls, pPage) + } + return SQLITE_OK +} + +// Set up a raw page so that it looks like a database page holding +// no entries. +func zeroPage(tls *libc.TLS, pPage uintptr, flags int32) { /* sqlite3.c:67525:13: */ + var data uintptr = (*MemPage)(unsafe.Pointer(pPage)).FaData + var pBt uintptr = (*MemPage)(unsafe.Pointer(pPage)).FpBt + var hdr U8 = (*MemPage)(unsafe.Pointer(pPage)).FhdrOffset + var first U16 + + if (int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_FAST_SECURE) != 0 { + libc.Xmemset(tls, (data + uintptr(hdr)), 0, (uint64((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(hdr)))) + } + *(*uint8)(unsafe.Pointer(data + uintptr(hdr))) = uint8(int8(flags)) + first = (U16(int32(hdr) + (func() int32 { + if (flags & PTF_LEAF) == 0 { + return 12 + } + return 8 + }()))) + libc.Xmemset(tls, (data + uintptr((int32(hdr) + 1))), 0, uint64(4)) + *(*uint8)(unsafe.Pointer(data + uintptr((int32(hdr) + 7)))) = uint8(0) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5))))) = (U8(((*BtShared)(unsafe.Pointer(pBt)).FusableSize) >> 8)) + *(*uint8)(unsafe.Pointer((data + uintptr((int32(hdr) + 5))) + 1)) = U8((*BtShared)(unsafe.Pointer(pBt)).FusableSize) + (*MemPage)(unsafe.Pointer(pPage)).FnFree = int32((U16((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(first)))) + decodeFlags(tls, pPage, flags) + (*MemPage)(unsafe.Pointer(pPage)).FcellOffset = first + (*MemPage)(unsafe.Pointer(pPage)).FaDataEnd = (data + uintptr((*BtShared)(unsafe.Pointer(pBt)).FusableSize)) + (*MemPage)(unsafe.Pointer(pPage)).FaCellIdx = (data + uintptr(first)) + (*MemPage)(unsafe.Pointer(pPage)).FaDataOfst = (data + uintptr((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + (*MemPage)(unsafe.Pointer(pPage)).FnOverflow = U8(0) + + (*MemPage)(unsafe.Pointer(pPage)).FmaskPage = (U16((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(1))) + (*MemPage)(unsafe.Pointer(pPage)).FnCell = U16(0) + (*MemPage)(unsafe.Pointer(pPage)).FisInit = U8(1) +} + +// Convert a DbPage obtained from the pager into a MemPage used by +// the btree layer. +func btreePageFromDbPage(tls *libc.TLS, pDbPage uintptr, pgno Pgno, pBt uintptr) uintptr { /* sqlite3.c:67562:16: */ + var pPage uintptr = Xsqlite3PagerGetExtra(tls, pDbPage) + if pgno != (*MemPage)(unsafe.Pointer(pPage)).Fpgno { + (*MemPage)(unsafe.Pointer(pPage)).FaData = Xsqlite3PagerGetData(tls, pDbPage) + (*MemPage)(unsafe.Pointer(pPage)).FpDbPage = pDbPage + (*MemPage)(unsafe.Pointer(pPage)).FpBt = pBt + (*MemPage)(unsafe.Pointer(pPage)).Fpgno = pgno + (*MemPage)(unsafe.Pointer(pPage)).FhdrOffset = func() uint8 { + if pgno == Pgno(1) { + return uint8(100) + } + return uint8(0) + }() + } + + return pPage +} + +// Get a page from the pager. Initialize the MemPage.pBt and +// MemPage.aData elements if needed. See also: btreeGetUnusedPage(). +// +// If the PAGER_GET_NOCONTENT flag is set, it means that we do not care +// about the content of the page at this time. So do not go to the disk +// to fetch the content. Just fill in the content with zeros for now. +// If in the future we call sqlite3PagerWrite() on this page, that +// means we have started to be concerned about content and the disk +// read should occur at that point. +func btreeGetPage(tls *libc.TLS, pBt uintptr, pgno Pgno, ppPage uintptr, flags int32) int32 { /* sqlite3.c:67586:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + // var pDbPage uintptr at bp, 8 + + rc = Xsqlite3PagerGet(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp /* &pDbPage */, flags) + if rc != 0 { + return rc + } + *(*uintptr)(unsafe.Pointer(ppPage)) = btreePageFromDbPage(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */)), pgno, pBt) + return SQLITE_OK +} + +// Retrieve a page from the pager cache. If the requested page is not +// already in the pager cache return NULL. Initialize the MemPage.pBt and +// MemPage.aData elements if needed. +func btreePageLookup(tls *libc.TLS, pBt uintptr, pgno Pgno) uintptr { /* sqlite3.c:67608:16: */ + var pDbPage uintptr + + pDbPage = Xsqlite3PagerLookup(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, pgno) + if pDbPage != 0 { + return btreePageFromDbPage(tls, pDbPage, pgno, pBt) + } + return uintptr(0) +} + +// Return the size of the database file in pages. If there is any kind of +// error, return ((unsigned int)-1). +func btreePagecount(tls *libc.TLS, pBt uintptr) Pgno { /* sqlite3.c:67622:13: */ + return (*BtShared)(unsafe.Pointer(pBt)).FnPage +} + +func Xsqlite3BtreeLastPage(tls *libc.TLS, p uintptr) Pgno { /* sqlite3.c:67625:21: */ + + return btreePagecount(tls, (*Btree)(unsafe.Pointer(p)).FpBt) +} + +// Get a page from the pager and initialize it. +// +// If pCur!=0 then the page is being fetched as part of a moveToChild() +// call. Do additional sanity checking on the page in this case. +// And if the fetch fails, this routine must decrement pCur->iPage. +// +// The page is fetched as read-write unless pCur is not NULL and is +// a read-only cursor. +// +// If an error occurs, then *ppPage is undefined. It +// may remain unchanged, or it may be set to an invalid value. +func getAndInitPage(tls *libc.TLS, pBt uintptr, pgno Pgno, ppPage uintptr, pCur uintptr, bReadOnly int32) int32 { /* sqlite3.c:67643:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + // var pDbPage uintptr at bp, 8 + + if !(pgno > btreePagecount(tls, pBt)) { + goto __1 + } + rc = Xsqlite3CorruptError(tls, 67658) + goto getAndInitPage_error1 +__1: + ; + rc = Xsqlite3PagerGet(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, pgno, bp /* &pDbPage */, bReadOnly) + if !(rc != 0) { + goto __2 + } + goto getAndInitPage_error1 +__2: + ; + *(*uintptr)(unsafe.Pointer(ppPage)) = Xsqlite3PagerGetExtra(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */))) + if !(int32((*MemPage)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(ppPage))))).FisInit) == 0) { + goto __3 + } + btreePageFromDbPage(tls, *(*uintptr)(unsafe.Pointer(bp /* pDbPage */)), pgno, pBt) + rc = btreeInitPage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + if !(rc != SQLITE_OK) { + goto __4 + } + goto getAndInitPage_error2 +__4: + ; +__3: + ; + + // If obtaining a child page for a cursor, we must verify that the page is + // compatible with the root page. + if !((pCur != 0) && ((int32((*MemPage)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(ppPage))))).FnCell) < 1) || (int32((*MemPage)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(ppPage))))).FintKey) != int32((*BtCursor)(unsafe.Pointer(pCur)).FcurIntKey)))) { + goto __5 + } + rc = Xsqlite3CorruptError(tls, 67679) + goto getAndInitPage_error2 +__5: + ; + return SQLITE_OK + +getAndInitPage_error2: + releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) +getAndInitPage_error1: + if !(pCur != 0) { + goto __6 + } + (*BtCursor)(unsafe.Pointer(pCur)).FiPage-- + (*BtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) +__6: + ; + + return rc +} + +// Release a MemPage. This should be called once for each prior +// call to btreeGetPage. +// +// Page1 is a special case and must be released using releasePageOne(). +func releasePageNotNull(tls *libc.TLS, pPage uintptr) { /* sqlite3.c:67702:13: */ + + Xsqlite3PagerUnrefNotNull(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) +} + +func releasePage(tls *libc.TLS, pPage uintptr) { /* sqlite3.c:67711:13: */ + if pPage != 0 { + releasePageNotNull(tls, pPage) + } +} + +func releasePageOne(tls *libc.TLS, pPage uintptr) { /* sqlite3.c:67714:13: */ + + Xsqlite3PagerUnrefPageOne(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) +} + +// Get an unused page. +// +// This works just like btreeGetPage() with the addition: +// +// * If the page is already in use for some other purpose, immediately +// release it and return an SQLITE_CURRUPT error. +// * Make sure the isInit flag is clear +func btreeGetUnusedPage(tls *libc.TLS, pBt uintptr, pgno Pgno, ppPage uintptr, flags int32) int32 { /* sqlite3.c:67734:12: */ + var rc int32 = btreeGetPage(tls, pBt, pgno, ppPage, flags) + if rc == SQLITE_OK { + if Xsqlite3PagerPageRefcount(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) > 1 { + releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + return Xsqlite3CorruptError(tls, 67745) + } + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FisInit = U8(0) + } else { + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) + } + return rc +} + +// During a rollback, when the pager reloads information into the cache +// so that the cache is restored to its original state at the start of +// the transaction, for each page restored this routine is called. +// +// This routine needs to reset the extra data section at the end of the +// page to agree with the restored data. +func pageReinit(tls *libc.TLS, pData uintptr) { /* sqlite3.c:67763:13: */ + var pPage uintptr + pPage = Xsqlite3PagerGetExtra(tls, pData) + + if (*MemPage)(unsafe.Pointer(pPage)).FisInit != 0 { + + (*MemPage)(unsafe.Pointer(pPage)).FisInit = U8(0) + if Xsqlite3PagerPageRefcount(tls, pData) > 1 { + // pPage might not be a btree page; it might be an overflow page + // or ptrmap page or a free page. In those cases, the following + // call to btreeInitPage() will likely return SQLITE_CORRUPT. + // But no harm is done by this. And it is very important that + // btreeInitPage() be called on every btree page so we make + // the call for every page that comes in for re-initing. + btreeInitPage(tls, pPage) + } + } +} + +// Invoke the busy handler for a btree. +func btreeInvokeBusyHandler(tls *libc.TLS, pArg uintptr) int32 { /* sqlite3.c:67785:12: */ + var pBt uintptr = pArg + + return Xsqlite3InvokeBusyHandler(tls, ((*BtShared)(unsafe.Pointer(pBt)).Fdb + 632 /* &.busyHandler */)) +} + +// Open a database file. +// +// zFilename is the name of the database file. If zFilename is NULL +// then an ephemeral database is created. The ephemeral database might +// be exclusively in memory, or it might use a disk-based memory cache. +// Either way, the ephemeral database will be automatically deleted +// when sqlite3BtreeClose() is called. +// +// If zFilename is ":memory:" then an in-memory database is created +// that is automatically destroyed when it is closed. +// +// The "flags" parameter is a bitmask that might contain bits like +// BTREE_OMIT_JOURNAL and/or BTREE_MEMORY. +// +// If the database is already opened in the same database connection +// and we are in shared cache mode, then the open will fail with an +// SQLITE_CONSTRAINT error. We cannot allow two or more BtShared +// objects in the same database connection since doing so will lead +// to problems with locking. +func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintptr, ppBtree uintptr, flags int32, vfsFlags int32) int32 { /* sqlite3.c:67813:20: */ + bp := tls.Alloc(100) + defer tls.Free(100) + + var pBt uintptr // Shared part of btree structure + var p uintptr // Handle to return + var mutexOpen uintptr // Prevents a race condition. Ticket #3537 + var rc int32 // Result code from this function + var nReserve U8 // Byte of unused space on each page + // var zDbHeader [100]uint8 at bp, 100 + // Database header content + + // True if opening an ephemeral, temporary database + var isTempDb int32 + + // Set the variable isMemdb to true for an in-memory database, or + // false for a file-based database. + var isMemdb int32 + var pExisting uintptr + var iDb int32 + var nFilename int32 + var nFullPathname int32 + var zFullPathname uintptr + var mutexShared uintptr + var mutexShared1 uintptr + var i int32 + var pSib uintptr + var pFile uintptr + pBt = uintptr(0) + mutexOpen = uintptr(0) + rc = SQLITE_OK + isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3159 /* ":memory:" */) == 0)) || + ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || + ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) + + // flags fit in 8 bits + + // Only a BTREE_SINGLE database can be BTREE_UNORDERED + + // A BTREE_SINGLE database is always a temporary and/or ephemeral + + if !(isMemdb != 0) { + goto __1 + } + flags = flags | (BTREE_MEMORY) +__1: + ; + if !(((vfsFlags & SQLITE_OPEN_MAIN_DB) != 0) && ((isMemdb != 0) || (isTempDb != 0))) { + goto __2 + } + vfsFlags = ((vfsFlags & libc.CplInt32(SQLITE_OPEN_MAIN_DB)) | SQLITE_OPEN_TEMP_DB) +__2: + ; + p = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(Btree{}))) + if !(!(p != 0)) { + goto __3 + } + return SQLITE_NOMEM +__3: + ; + (*Btree)(unsafe.Pointer(p)).FinTrans = U8(TRANS_NONE) + (*Btree)(unsafe.Pointer(p)).Fdb = db + (*Btree)(unsafe.Pointer(p)).Flock.FpBtree = p + (*Btree)(unsafe.Pointer(p)).Flock.FiTable = Pgno(1) + + // If this Btree is a candidate for shared cache, try to find an + // existing BtShared object that we can share with + if !((isTempDb == 0) && ((isMemdb == 0) || ((vfsFlags & SQLITE_OPEN_URI) != 0))) { + goto __4 + } + if !((vfsFlags & SQLITE_OPEN_SHAREDCACHE) != 0) { + goto __5 + } + nFilename = (Xsqlite3Strlen30(tls, zFilename) + 1) + nFullPathname = ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname + 1) + zFullPathname = Xsqlite3Malloc(tls, func() uint64 { + if (nFullPathname) > (nFilename) { + return uint64(nFullPathname) + } + return uint64(nFilename) + }()) + + (*Btree)(unsafe.Pointer(p)).Fsharable = U8(1) + if !(!(zFullPathname != 0)) { + goto __6 + } + Xsqlite3_free(tls, p) + return SQLITE_NOMEM +__6: + ; + if !(isMemdb != 0) { + goto __7 + } + libc.Xmemcpy(tls, zFullPathname, zFilename, uint64(nFilename)) + goto __8 +__7: + rc = Xsqlite3OsFullPathname(tls, pVfs, zFilename, + nFullPathname, zFullPathname) + if !(rc != 0) { + goto __9 + } + if !(rc == (SQLITE_OK | (int32(2) << 8))) { + goto __10 + } + rc = SQLITE_OK + goto __11 +__10: + Xsqlite3_free(tls, zFullPathname) + Xsqlite3_free(tls, p) + return rc +__11: + ; +__9: + ; +__8: + ; + mutexOpen = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_OPEN) + Xsqlite3_mutex_enter(tls, mutexOpen) + mutexShared = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, mutexShared) + pBt = sqlite3SharedCacheList +__12: + if !(pBt != 0) { + goto __14 + } + + if !((0 == libc.Xstrcmp(tls, zFullPathname, Xsqlite3PagerFilename(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, 0))) && + (Xsqlite3PagerVfs(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) == pVfs)) { + goto __15 + } + iDb = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) +__16: + if !(iDb >= 0) { + goto __18 + } + pExisting = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + if !((pExisting != 0) && ((*Btree)(unsafe.Pointer(pExisting)).FpBt == pBt)) { + goto __19 + } + Xsqlite3_mutex_leave(tls, mutexShared) + Xsqlite3_mutex_leave(tls, mutexOpen) + Xsqlite3_free(tls, zFullPathname) + Xsqlite3_free(tls, p) + return SQLITE_CONSTRAINT +__19: + ; + goto __17 +__17: + iDb-- + goto __16 + goto __18 +__18: + ; + (*Btree)(unsafe.Pointer(p)).FpBt = pBt + (*BtShared)(unsafe.Pointer(pBt)).FnRef++ + goto __14 +__15: + ; + goto __13 +__13: + pBt = (*BtShared)(unsafe.Pointer(pBt)).FpNext + goto __12 + goto __14 +__14: + ; + Xsqlite3_mutex_leave(tls, mutexShared) + Xsqlite3_free(tls, zFullPathname) +__5: + ; +__4: + ; + if !(pBt == uintptr(0)) { + goto __20 + } + // The following asserts make sure that structures used by the btree are + // the right size. This is to guard against size changes that result + // when compiling on a different architecture. + + pBt = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(BtShared{}))) + if !(pBt == uintptr(0)) { + goto __21 + } + rc = SQLITE_NOMEM + goto btree_open_out +__21: + ; + rc = Xsqlite3PagerOpen(tls, pVfs, (pBt /* &.pPager */), zFilename, + int32(unsafe.Sizeof(MemPage{})), flags, vfsFlags, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{pageReinit}))) + if !(rc == SQLITE_OK) { + goto __22 + } + Xsqlite3PagerSetMmapLimit(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (*Sqlite3)(unsafe.Pointer(db)).FszMmap) + rc = Xsqlite3PagerReadFileheader(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, int32(unsafe.Sizeof([100]uint8{})), bp /* &zDbHeader[0] */) +__22: + ; + if !(rc != SQLITE_OK) { + goto __23 + } + goto btree_open_out +__23: + ; + (*BtShared)(unsafe.Pointer(pBt)).FopenFlags = U8(flags) + (*BtShared)(unsafe.Pointer(pBt)).Fdb = db + Xsqlite3PagerSetBusyHandler(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{btreeInvokeBusyHandler})), pBt) + (*Btree)(unsafe.Pointer(p)).FpBt = pBt + + (*BtShared)(unsafe.Pointer(pBt)).FpCursor = uintptr(0) + (*BtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) + if !(Xsqlite3PagerIsreadonly(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) != 0) { + goto __24 + } + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_READ_ONLY)) +__24: + ; + // EVIDENCE-OF: R-51873-39618 The page size for a database file is + // determined by the 2-byte integer located at an offset of 16 bytes from + // the beginning of the database file. + (*BtShared)(unsafe.Pointer(pBt)).FpageSize = (U32((int32(*(*uint8)(unsafe.Pointer(bp /* &zDbHeader[0] */ + 16))) << 8) | (int32(*(*uint8)(unsafe.Pointer(bp /* &zDbHeader[0] */ + 17))) << 16))) + if !((((*BtShared)(unsafe.Pointer(pBt)).FpageSize < U32(512)) || ((*BtShared)(unsafe.Pointer(pBt)).FpageSize > U32(SQLITE_MAX_PAGE_SIZE))) || + ((((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(1)) & (*BtShared)(unsafe.Pointer(pBt)).FpageSize) != U32(0))) { + goto __25 + } + (*BtShared)(unsafe.Pointer(pBt)).FpageSize = U32(0) + // If the magic name ":memory:" will create an in-memory database, then + // leave the autoVacuum mode at 0 (do not auto-vacuum), even if + // SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if + // SQLITE_OMIT_MEMORYDB has been defined, then ":memory:" is just a + // regular file-name. In this case the auto-vacuum applies as per normal. + if !((zFilename != 0) && !(isMemdb != 0)) { + goto __27 + } + (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum = func() uint8 { + if 0 != 0 { + return uint8(1) + } + return uint8(0) + }() + (*BtShared)(unsafe.Pointer(pBt)).FincrVacuum = func() uint8 { + if SQLITE_DEFAULT_AUTOVACUUM == 2 { + return uint8(1) + } + return uint8(0) + }() +__27: + ; + nReserve = U8(0) + goto __26 +__25: + // EVIDENCE-OF: R-37497-42412 The size of the reserved region is + // determined by the one-byte unsigned integer found at an offset of 20 + // into the database file header. + nReserve = *(*uint8)(unsafe.Pointer(bp /* &zDbHeader[0] */ + 20)) + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_PAGESIZE_FIXED)) + (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum = func() uint8 { + if Xsqlite3Get4byte(tls, (bp /* &zDbHeader */ +52)) != 0 { + return uint8(1) + } + return uint8(0) + }() + (*BtShared)(unsafe.Pointer(pBt)).FincrVacuum = func() uint8 { + if Xsqlite3Get4byte(tls, (bp /* &zDbHeader */ +64)) != 0 { + return uint8(1) + } + return uint8(0) + }() +__26: + ; + rc = Xsqlite3PagerSetPagesize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (pBt + 52 /* &.pageSize */), int32(nReserve)) + if !(rc != 0) { + goto __28 + } + goto btree_open_out +__28: + ; + (*BtShared)(unsafe.Pointer(pBt)).FusableSize = ((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(nReserve)) + // 8-byte alignment of pageSize + + // Add the new BtShared object to the linked list sharable BtShareds. + (*BtShared)(unsafe.Pointer(pBt)).FnRef = 1 + if !((*Btree)(unsafe.Pointer(p)).Fsharable != 0) { + goto __29 + } + mutexShared1 = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + if !((1 != 0) && (Xsqlite3Config.FbCoreMutex != 0)) { + goto __30 + } + (*BtShared)(unsafe.Pointer(pBt)).Fmutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_FAST) + if !((*BtShared)(unsafe.Pointer(pBt)).Fmutex == uintptr(0)) { + goto __31 + } + rc = SQLITE_NOMEM + goto btree_open_out +__31: + ; +__30: + ; + Xsqlite3_mutex_enter(tls, mutexShared1) + (*BtShared)(unsafe.Pointer(pBt)).FpNext = sqlite3SharedCacheList + sqlite3SharedCacheList = pBt + Xsqlite3_mutex_leave(tls, mutexShared1) +__29: + ; +__20: + ; + + // If the new Btree uses a sharable pBtShared, then link the new + // Btree into the list of all sharable Btrees for the same connection. + // The list is kept in ascending order by pBt address. + if !((*Btree)(unsafe.Pointer(p)).Fsharable != 0) { + goto __32 + } + i = 0 +__33: + if !(i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __35 + } + if !(((libc.AssignUintptr(&pSib, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpBt)) != uintptr(0)) && ((*Btree)(unsafe.Pointer(pSib)).Fsharable != 0)) { + goto __36 + } +__37: + if !((*Btree)(unsafe.Pointer(pSib)).FpPrev != 0) { + goto __38 + } + pSib = (*Btree)(unsafe.Pointer(pSib)).FpPrev + goto __37 +__38: + ; + if !(Uptr((*Btree)(unsafe.Pointer(p)).FpBt) < Uptr((*Btree)(unsafe.Pointer(pSib)).FpBt)) { + goto __39 + } + (*Btree)(unsafe.Pointer(p)).FpNext = pSib + (*Btree)(unsafe.Pointer(p)).FpPrev = uintptr(0) + (*Btree)(unsafe.Pointer(pSib)).FpPrev = p + goto __40 +__39: +__41: + if !(((*Btree)(unsafe.Pointer(pSib)).FpNext != 0) && (Uptr((*Btree)(unsafe.Pointer((*Btree)(unsafe.Pointer(pSib)).FpNext)).FpBt) < Uptr((*Btree)(unsafe.Pointer(p)).FpBt))) { + goto __42 + } + pSib = (*Btree)(unsafe.Pointer(pSib)).FpNext + goto __41 +__42: + ; + (*Btree)(unsafe.Pointer(p)).FpNext = (*Btree)(unsafe.Pointer(pSib)).FpNext + (*Btree)(unsafe.Pointer(p)).FpPrev = pSib + if !((*Btree)(unsafe.Pointer(p)).FpNext != 0) { + goto __43 + } + (*Btree)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpNext)).FpPrev = p +__43: + ; + (*Btree)(unsafe.Pointer(pSib)).FpNext = p +__40: + ; + goto __35 +__36: + ; + goto __34 +__34: + i++ + goto __33 + goto __35 +__35: + ; +__32: + ; + *(*uintptr)(unsafe.Pointer(ppBtree)) = p + +btree_open_out: + if !(rc != SQLITE_OK) { + goto __44 + } + if !((pBt != 0) && ((*BtShared)(unsafe.Pointer(pBt)).FpPager != 0)) { + goto __46 + } + Xsqlite3PagerClose(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, uintptr(0)) +__46: + ; + Xsqlite3_free(tls, pBt) + Xsqlite3_free(tls, p) + *(*uintptr)(unsafe.Pointer(ppBtree)) = uintptr(0) + goto __45 +__44: + + // If the B-Tree was successfully opened, set the pager-cache size to the + // default value. Except, when opening on an existing shared pager-cache, + // do not change the pager-cache size. + if !(Xsqlite3BtreeSchema(tls, p, 0, uintptr(0)) == uintptr(0)) { + goto __47 + } + Xsqlite3BtreeSetCacheSize(tls, p, -2000) +__47: + ; + + pFile = Xsqlite3PagerFile(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) + if !((*Sqlite3_file)(unsafe.Pointer(pFile)).FpMethods != 0) { + goto __48 + } + Xsqlite3OsFileControlHint(tls, pFile, SQLITE_FCNTL_PDB, (pBt + 8 /* &.db */)) +__48: + ; +__45: + ; + if !(mutexOpen != 0) { + goto __49 + } + + Xsqlite3_mutex_leave(tls, mutexOpen) +__49: + ; + + return rc +} + +// Decrement the BtShared.nRef counter. When it reaches zero, +// remove the BtShared structure from the sharing list. Return +// true if the BtShared.nRef counter reaches zero and return +// false if it is still positive. +func removeFromSharingList(tls *libc.TLS, pBt uintptr) int32 { /* sqlite3.c:68111:12: */ + var pMainMtx uintptr + var pList uintptr + var removed int32 = 0 + + pMainMtx = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, pMainMtx) + (*BtShared)(unsafe.Pointer(pBt)).FnRef-- + if (*BtShared)(unsafe.Pointer(pBt)).FnRef <= 0 { + if sqlite3SharedCacheList == pBt { + sqlite3SharedCacheList = (*BtShared)(unsafe.Pointer(pBt)).FpNext + } else { + pList = sqlite3SharedCacheList + for (pList != 0) && ((*BtShared)(unsafe.Pointer(pList)).FpNext != pBt) { + pList = (*BtShared)(unsafe.Pointer(pList)).FpNext + } + if pList != 0 { + (*BtShared)(unsafe.Pointer(pList)).FpNext = (*BtShared)(unsafe.Pointer(pBt)).FpNext + } + } + if 1 != 0 { + Xsqlite3_mutex_free(tls, (*BtShared)(unsafe.Pointer(pBt)).Fmutex) + } + removed = 1 + } + Xsqlite3_mutex_leave(tls, pMainMtx) + return removed +} + +// Make sure pBt->pTmpSpace points to an allocation of +// MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child +// pointer. +func allocateTempSpace(tls *libc.TLS, pBt uintptr) { /* sqlite3.c:68150:13: */ + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace) != 0) { + (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace = Xsqlite3PageMalloc(tls, int32((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + + // One of the uses of pBt->pTmpSpace is to format cells before + // inserting them into a leaf page (function fillInCell()). If + // a cell is less than 4 bytes in size, it is rounded up to 4 bytes + // by the various routines that manipulate binary cells. Which + // can mean that fillInCell() only initializes the first 2 or 3 + // bytes of pTmpSpace, but that the first 4 bytes are copied from + // it into a database page. This is not actually a problem, but it + // does cause a valgrind error when the 1 or 2 bytes of unitialized + // data is passed to system call write(). So to avoid this error, + // zero the first 4 bytes of temp space here. + // + // Also: Provide four bytes of initialized space before the + // beginning of pTmpSpace as an area available to prepend the + // left-child pointer to the beginning of a cell. + if (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace != 0 { + libc.Xmemset(tls, (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace, 0, uint64(8)) + *(*uintptr)(unsafe.Pointer(pBt + 136 /* &.pTmpSpace */)) += (uintptr(4)) + } + } +} + +// Free the pBt->pTmpSpace allocation +func freeTempSpace(tls *libc.TLS, pBt uintptr) { /* sqlite3.c:68179:13: */ + if (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace != 0 { + *(*uintptr)(unsafe.Pointer(pBt + 136 /* &.pTmpSpace */)) -= (uintptr(4)) + Xsqlite3PageFree(tls, (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace) + (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace = uintptr(0) + } +} + +// Close an open database and invalidate all cursors. +func Xsqlite3BtreeClose(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:68190:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + // Close all cursors opened via this handle. + + Xsqlite3BtreeEnter(tls, p) + + // Verify that no other cursors have this Btree open + + // Rollback any active transaction and free the handle structure. + // The call to sqlite3BtreeRollback() drops any table-locks held by + // this handle. + Xsqlite3BtreeRollback(tls, p, SQLITE_OK, 0) + Xsqlite3BtreeLeave(tls, p) + + // If there are still other outstanding references to the shared-btree + // structure, return now. The remainder of this procedure cleans + // up the shared-btree. + + if !(int32((*Btree)(unsafe.Pointer(p)).Fsharable) != 0) || (removeFromSharingList(tls, pBt) != 0) { + // The pBt is no longer on the sharing list, so we can access + // it without having to hold the mutex. + // + // Clean out and delete the BtShared object. + + Xsqlite3PagerClose(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (*Btree)(unsafe.Pointer(p)).Fdb) + if ((*BtShared)(unsafe.Pointer(pBt)).FxFreeSchema != 0) && ((*BtShared)(unsafe.Pointer(pBt)).FpSchema != 0) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pBt + 80 /* &.xFreeSchema */))))(tls, (*BtShared)(unsafe.Pointer(pBt)).FpSchema) + } + Xsqlite3DbFree(tls, uintptr(0), (*BtShared)(unsafe.Pointer(pBt)).FpSchema) + freeTempSpace(tls, pBt) + Xsqlite3_free(tls, pBt) + } + + if (*Btree)(unsafe.Pointer(p)).FpPrev != 0 { + (*Btree)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpPrev)).FpNext = (*Btree)(unsafe.Pointer(p)).FpNext + } + if (*Btree)(unsafe.Pointer(p)).FpNext != 0 { + (*Btree)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpNext)).FpPrev = (*Btree)(unsafe.Pointer(p)).FpPrev + } + + Xsqlite3_free(tls, p) + return SQLITE_OK +} + +// Change the "soft" limit on the number of pages in the cache. +// Unused and unmodified pages will be recycled when the number of +// pages in the cache exceeds this soft limit. But the size of the +// cache is allowed to grow larger than this limit if it contains +// dirty pages or pages still in active use. +func Xsqlite3BtreeSetCacheSize(tls *libc.TLS, p uintptr, mxPage int32) int32 { /* sqlite3.c:68256:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + Xsqlite3PagerSetCachesize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, mxPage) + Xsqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// Change the "spill" limit on the number of pages in the cache. +// If the number of pages exceeds this limit during a write transaction, +// the pager might attempt to "spill" pages to the journal early in +// order to free up memory. +// +// The value returned is the current spill size. If zero is passed +// as an argument, no changes are made to the spill size setting, so +// using mxPage of 0 is a way to query the current spill size. +func Xsqlite3BtreeSetSpillSize(tls *libc.TLS, p uintptr, mxPage int32) int32 { /* sqlite3.c:68275:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var res int32 + + Xsqlite3BtreeEnter(tls, p) + res = Xsqlite3PagerSetSpillsize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, mxPage) + Xsqlite3BtreeLeave(tls, p) + return res +} + +// Change the limit on the amount of the database file that may be +// memory mapped. +func Xsqlite3BtreeSetMmapLimit(tls *libc.TLS, p uintptr, szMmap Sqlite3_int64) int32 { /* sqlite3.c:68290:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + Xsqlite3PagerSetMmapLimit(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, szMmap) + Xsqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// Change the way data is synced to disk in order to increase or decrease +// how well the database resists damage due to OS crashes and power +// failures. Level 1 is the same as asynchronous (no syncs() occur and +// there is a high probability of damage) Level 2 is the default. There +// is a very low but non-zero probability of damage. Level 3 reduces the +// probability of damage to near zero but with a write performance reduction. +func Xsqlite3BtreeSetPagerFlags(tls *libc.TLS, p uintptr, pgFlags uint32) int32 { /* sqlite3.c:68309:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + Xsqlite3PagerSetFlags(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, pgFlags) + Xsqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// Change the default pages size and the number of reserved bytes per page. +// Or, if the page size has already been fixed, return SQLITE_READONLY +// without changing anything. +// +// The page size must be a power of 2 between 512 and 65536. If the page +// size supplied does not meet this constraint then the page size is not +// changed. +// +// Page sizes are constrained to be a power of two so that the region +// of the database file used for locking (beginning at PENDING_BYTE, +// the first byte past the 1GB boundary, 0x40000000) needs to occur +// at the beginning of a page. +// +// If parameter nReserve is less than zero, then the number of reserved +// bytes per page is left unchanged. +// +// If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size +// and autovacuum mode can no longer be changed. +func Xsqlite3BtreeSetPageSize(tls *libc.TLS, p uintptr, pageSize int32, nReserve int32, iFix int32) int32 { /* sqlite3.c:68342:20: */ + var rc int32 = SQLITE_OK + var x int32 + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + (*BtShared)(unsafe.Pointer(pBt)).FnReserveWanted = U8(nReserve) + x = (int32((*BtShared)(unsafe.Pointer(pBt)).FpageSize - (*BtShared)(unsafe.Pointer(pBt)).FusableSize)) + if nReserve < x { + nReserve = x + } + if (int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_PAGESIZE_FIXED) != 0 { + Xsqlite3BtreeLeave(tls, p) + return SQLITE_READONLY + } + + if ((pageSize >= 512) && (pageSize <= SQLITE_MAX_PAGE_SIZE)) && (((pageSize - 1) & pageSize) == 0) { + + if (nReserve > 32) && (pageSize == 512) { + pageSize = 1024 + } + (*BtShared)(unsafe.Pointer(pBt)).FpageSize = U32(pageSize) + freeTempSpace(tls, pBt) + } + rc = Xsqlite3PagerSetPagesize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (pBt + 52 /* &.pageSize */), nReserve) + (*BtShared)(unsafe.Pointer(pBt)).FusableSize = ((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(U16(nReserve))) + if iFix != 0 { + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_PAGESIZE_FIXED)) + } + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Return the currently defined page size +func Xsqlite3BtreeGetPageSize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:68374:20: */ + return int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpageSize) +} + +// This function is similar to sqlite3BtreeGetReserve(), except that it +// may only be called if it is guaranteed that the b-tree mutex is already +// held. +// +// This is useful in one special case in the backup API code where it is +// known that the shared b-tree mutex is held, but the mutex on the +// database handle that owns *p is not. In this case if sqlite3BtreeEnter() +// were to be called, it might collide with some other operation on the +// database handle that owns *p, causing undefined behavior. +func Xsqlite3BtreeGetReserveNoMutex(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:68389:20: */ + var n int32 + + n = (int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpageSize - (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FusableSize)) + return n +} + +// Return the number of bytes of space at the end of every page that +// are intentually left unused. This is the "reserved" space that is +// sometimes used by extensions. +// +// The value returned is the larger of the current reserve size and +// the latest reserve size requested by SQLITE_FILECTRL_RESERVE_BYTES. +// The amount of reserve can only grow - never shrink. +func Xsqlite3BtreeGetRequestedReserve(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:68405:20: */ + var n1 int32 + var n2 int32 + Xsqlite3BtreeEnter(tls, p) + n1 = int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FnReserveWanted) + n2 = Xsqlite3BtreeGetReserveNoMutex(tls, p) + Xsqlite3BtreeLeave(tls, p) + if n1 > n2 { + return n1 + } + return n2 +} + +// Set the maximum page count for a database if mxPage is positive. +// No changes are made if mxPage is 0 or negative. +// Regardless of the value of mxPage, return the maximum page count. +func Xsqlite3BtreeMaxPageCount(tls *libc.TLS, p uintptr, mxPage Pgno) Pgno { /* sqlite3.c:68420:21: */ + var n Pgno + Xsqlite3BtreeEnter(tls, p) + n = Xsqlite3PagerMaxPageCount(tls, (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpPager, mxPage) + Xsqlite3BtreeLeave(tls, p) + return n +} + +// Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags: +// +// newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared +// newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared +// newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set +// newFlag==(-1) No changes +// +// This routine acts as a query if newFlag is less than zero +// +// With BTS_OVERWRITE set, deleted content is overwritten by zeros, but +// freelist leaf pages are not written back to the database. Thus in-page +// deleted content is cleared, but freelist deleted content is not. +// +// With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition +// that freelist leaf pages are written back into the database, increasing +// the amount of disk I/O. +func Xsqlite3BtreeSecureDelete(tls *libc.TLS, p uintptr, newFlag int32) int32 { /* sqlite3.c:68446:20: */ + var b int32 + if p == uintptr(0) { + return 0 + } + Xsqlite3BtreeEnter(tls, p) + + if newFlag >= 0 { + *(*U16)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_FAST_SECURE))) + *(*U16)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt + 40 /* &.btsFlags */)) |= U16((BTS_SECURE_DELETE * newFlag)) + } + b = ((int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FbtsFlags) & BTS_FAST_SECURE) / BTS_SECURE_DELETE) + Xsqlite3BtreeLeave(tls, p) + return b +} + +// Change the 'auto-vacuum' property of the database. If the 'autoVacuum' +// parameter is non-zero, then auto-vacuum mode is enabled. If zero, it +// is disabled. The default value for the auto-vacuum property is +// determined by the SQLITE_DEFAULT_AUTOVACUUM macro. +func Xsqlite3BtreeSetAutoVacuum(tls *libc.TLS, p uintptr, autoVacuum int32) int32 { /* sqlite3.c:68467:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var rc int32 = SQLITE_OK + var av U8 = U8(autoVacuum) + + Xsqlite3BtreeEnter(tls, p) + if ((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_PAGESIZE_FIXED) != 0) && ((func() int32 { + if av != 0 { + return 1 + } + return 0 + }()) != int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum)) { + rc = SQLITE_READONLY + } else { + (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum = func() uint8 { + if av != 0 { + return uint8(1) + } + return uint8(0) + }() + (*BtShared)(unsafe.Pointer(pBt)).FincrVacuum = func() uint8 { + if int32(av) == 2 { + return uint8(1) + } + return uint8(0) + }() + } + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Return the value of the 'auto-vacuum' property. If auto-vacuum is +// enabled 1 is returned. Otherwise 0. +func Xsqlite3BtreeGetAutoVacuum(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:68491:20: */ + var rc int32 + Xsqlite3BtreeEnter(tls, p) + rc = func() int32 { + if !(int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FautoVacuum) != 0) { + return BTREE_AUTOVACUUM_NONE + } + return func() int32 { + if !(int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FincrVacuum) != 0) { + return BTREE_AUTOVACUUM_FULL + } + return BTREE_AUTOVACUUM_INCR + }() + }() + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Get a reference to pPage1 of the database file. This will +// also acquire a readlock on that file. +// +// SQLITE_OK is returned on success. If the file is not a +// well-formed database file, then SQLITE_CORRUPT is returned. +// SQLITE_BUSY is returned if the database is locked. SQLITE_NOMEM +// is returned if we run out of memory. +func lockBtree(tls *libc.TLS, pBt uintptr) int32 { /* sqlite3.c:68547:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Result code from subfunctions + // var pPage1 uintptr at bp, 8 + // Page 1 of the database file + var nPage U32 // Number of pages in the database + // var nPageFile U32 at bp+8, 4 + // Number of pages in the database file + var nPageHeader U32 + _ = nPageHeader + // var isOpen int32 at bp+12, 4 + + var pageSize U32 + var usableSize U32 + var page1 uintptr + *(*U32)(unsafe.Pointer(bp + 8 /* nPageFile */)) = U32(0) // Number of pages in the database according to hdr + + rc = Xsqlite3PagerSharedLock(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) + if !(rc != SQLITE_OK) { + goto __1 + } + return rc +__1: + ; + rc = btreeGetPage(tls, pBt, uint32(1), bp /* &pPage1 */, 0) + if !(rc != SQLITE_OK) { + goto __2 + } + return rc +__2: + ; + + // Do some checking to help insure the file we opened really is + // a valid database file. + nPage = libc.AssignUint32(&nPageHeader, Xsqlite3Get4byte(tls, (uintptr(28)+(*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage1 */)))).FaData))) + Xsqlite3PagerPagecount(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, bp+8 /* &nPageFile */) + if !((nPage == U32(0)) || (libc.Xmemcmp(tls, (uintptr(24)+(*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage1 */)))).FaData), (uintptr(92)+(*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage1 */)))).FaData), uint64(4)) != 0)) { + goto __3 + } + nPage = *(*U32)(unsafe.Pointer(bp + 8 /* nPageFile */)) +__3: + ; + if !(((*Sqlite3)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags & uint64(SQLITE_ResetDatabase)) != uint64(0)) { + goto __4 + } + nPage = U32(0) +__4: + ; + if !(nPage > U32(0)) { + goto __5 + } + page1 = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage1 */)))).FaData + rc = SQLITE_NOTADB + // EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins + // with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d + // 61 74 20 33 00. + if !(libc.Xmemcmp(tls, page1, uintptr(unsafe.Pointer(&zMagicHeader)), uint64(16)) != 0) { + goto __6 + } + goto page1_init_failed +__6: + ; + + if !(int32(*(*U8)(unsafe.Pointer(page1 + 18))) > 2) { + goto __7 + } + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_READ_ONLY)) +__7: + ; + if !(int32(*(*U8)(unsafe.Pointer(page1 + 19))) > 2) { + goto __8 + } + goto page1_init_failed +__8: + ; + + // If the write version is set to 2, this database should be accessed + // in WAL mode. If the log is not already open, open it now. Then + // return SQLITE_OK and return without populating BtShared.pPage1. + // The caller detects this and calls this function again. This is + // required as the version of page 1 currently in the page1 buffer + // may not be the latest version - there may be a newer one in the log + // file. + if !((int32(*(*U8)(unsafe.Pointer(page1 + 19))) == 2) && ((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_NO_WAL) == 0)) { + goto __9 + } + *(*int32)(unsafe.Pointer(bp + 12 /* isOpen */)) = 0 + rc = Xsqlite3PagerOpenWal(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, bp+12 /* &isOpen */) + if !(rc != SQLITE_OK) { + goto __11 + } + goto page1_init_failed + goto __12 +__11: + ; + if !(*(*int32)(unsafe.Pointer(bp + 12 /* isOpen */)) == 0) { + goto __13 + } + releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage1 */))) + return SQLITE_OK +__13: + ; +__12: + ; + rc = SQLITE_NOTADB + goto __10 +__9: + ; +__10: + ; + + // EVIDENCE-OF: R-15465-20813 The maximum and minimum embedded payload + // fractions and the leaf payload fraction values must be 64, 32, and 32. + // + // The original design allowed these amounts to vary, but as of + // version 3.6.0, we require them to be fixed. + if !(libc.Xmemcmp(tls, (page1+21), ts+3168 /* "@ " */, uint64(3)) != 0) { + goto __14 + } + goto page1_init_failed +__14: + ; + // EVIDENCE-OF: R-51873-39618 The page size for a database file is + // determined by the 2-byte integer located at an offset of 16 bytes from + // the beginning of the database file. + pageSize = (U32((int32(*(*U8)(unsafe.Pointer(page1 + 16))) << 8) | (int32(*(*U8)(unsafe.Pointer(page1 + 17))) << 16))) + // EVIDENCE-OF: R-25008-21688 The size of a page is a power of two + // between 512 and 65536 inclusive. + if !(((((pageSize - U32(1)) & pageSize) != U32(0)) || + (pageSize > U32(SQLITE_MAX_PAGE_SIZE))) || + (pageSize <= U32(256))) { + goto __15 + } + goto page1_init_failed +__15: + ; + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_PAGESIZE_FIXED)) + + // EVIDENCE-OF: R-59310-51205 The "reserved space" size in the 1-byte + // integer at offset 20 is the number of bytes of space at the end of + // each page to reserve for extensions. + // + // EVIDENCE-OF: R-37497-42412 The size of the reserved region is + // determined by the one-byte unsigned integer found at an offset of 20 + // into the database file header. + usableSize = (pageSize - U32(*(*U8)(unsafe.Pointer(page1 + 20)))) + if !(pageSize != (*BtShared)(unsafe.Pointer(pBt)).FpageSize) { + goto __16 + } + // After reading the first page of the database assuming a page size + // of BtShared.pageSize, we have discovered that the page-size is + // actually pageSize. Unlock the database, leave pBt->pPage1 at + // zero and return SQLITE_OK. The caller will call this function + // again with the correct page-size. + releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage1 */))) + (*BtShared)(unsafe.Pointer(pBt)).FusableSize = usableSize + (*BtShared)(unsafe.Pointer(pBt)).FpageSize = pageSize + freeTempSpace(tls, pBt) + rc = Xsqlite3PagerSetPagesize(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (pBt + 52 /* &.pageSize */), + (int32(pageSize - usableSize))) + return rc +__16: + ; + if !((Xsqlite3WritableSchema(tls, (*BtShared)(unsafe.Pointer(pBt)).Fdb) == 0) && (nPage > *(*U32)(unsafe.Pointer(bp + 8 /* nPageFile */)))) { + goto __17 + } + rc = Xsqlite3CorruptError(tls, 68672) + goto page1_init_failed +__17: + ; + // EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to + // be less than 480. In other words, if the page size is 512, then the + // reserved space size cannot exceed 32. + if !(usableSize < U32(480)) { + goto __18 + } + goto page1_init_failed +__18: + ; + (*BtShared)(unsafe.Pointer(pBt)).FpageSize = pageSize + (*BtShared)(unsafe.Pointer(pBt)).FusableSize = usableSize + (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum = func() uint8 { + if Xsqlite3Get4byte(tls, (page1+52)) != 0 { + return uint8(1) + } + return uint8(0) + }() + (*BtShared)(unsafe.Pointer(pBt)).FincrVacuum = func() uint8 { + if Xsqlite3Get4byte(tls, (page1+64)) != 0 { + return uint8(1) + } + return uint8(0) + }() +__5: + ; + + // maxLocal is the maximum amount of payload to store locally for + // a cell. Make sure it is small enough so that at least minFanout + // cells can will fit on one page. We assume a 10-byte page header. + // Besides the payload, the cell must store: + // 2-byte pointer to the cell + // 4-byte child pointer + // 9-byte nKey value + // 4-byte nData value + // 4-byte overflow page pointer + // So a cell consists of a 2-byte pointer, a header which is as much as + // 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow + // page pointer. + (*BtShared)(unsafe.Pointer(pBt)).FmaxLocal = (U16(((((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(12)) * U32(64)) / U32(255)) - U32(23))) + (*BtShared)(unsafe.Pointer(pBt)).FminLocal = (U16(((((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(12)) * U32(32)) / U32(255)) - U32(23))) + (*BtShared)(unsafe.Pointer(pBt)).FmaxLeaf = (U16((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(35))) + (*BtShared)(unsafe.Pointer(pBt)).FminLeaf = (U16(((((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(12)) * U32(32)) / U32(255)) - U32(23))) + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FmaxLocal) > 127) { + goto __19 + } + (*BtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload = U8(127) + goto __20 +__19: + (*BtShared)(unsafe.Pointer(pBt)).Fmax1bytePayload = U8((*BtShared)(unsafe.Pointer(pBt)).FmaxLocal) +__20: + ; + + (*BtShared)(unsafe.Pointer(pBt)).FpPage1 = *(*uintptr)(unsafe.Pointer(bp /* pPage1 */)) + (*BtShared)(unsafe.Pointer(pBt)).FnPage = nPage + return SQLITE_OK + +page1_init_failed: + releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage1 */))) + (*BtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) + return rc +} + +// If there are no outstanding cursors and we are not in the middle +// of a transaction but there is a read lock on the database, then +// this routine unrefs the first page of the database file which +// has the effect of releasing the read lock. +// +// If there is a transaction in progress, this routine is a no-op. +func unlockBtreeIfUnused(tls *libc.TLS, pBt uintptr) { /* sqlite3.c:68754:13: */ + + if (int32((*BtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_NONE) && ((*BtShared)(unsafe.Pointer(pBt)).FpPage1 != uintptr(0)) { + var pPage1 uintptr = (*BtShared)(unsafe.Pointer(pBt)).FpPage1 + + (*BtShared)(unsafe.Pointer(pBt)).FpPage1 = uintptr(0) + releasePageOne(tls, pPage1) + } +} + +// If pBt points to an empty file then convert that empty file +// into a new empty database by initializing the first page of +// the database. +func newDatabase(tls *libc.TLS, pBt uintptr) int32 { /* sqlite3.c:68771:12: */ + var pP1 uintptr + var data uintptr + var rc int32 + + if (*BtShared)(unsafe.Pointer(pBt)).FnPage > U32(0) { + return SQLITE_OK + } + pP1 = (*BtShared)(unsafe.Pointer(pBt)).FpPage1 + + data = (*MemPage)(unsafe.Pointer(pP1)).FaData + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pP1)).FpDbPage) + if rc != 0 { + return rc + } + libc.Xmemcpy(tls, data, uintptr(unsafe.Pointer(&zMagicHeader)), uint64(unsafe.Sizeof(zMagicHeader))) + + *(*uint8)(unsafe.Pointer(data + 16)) = (U8(((*BtShared)(unsafe.Pointer(pBt)).FpageSize >> 8) & U32(0xff))) + *(*uint8)(unsafe.Pointer(data + 17)) = (U8(((*BtShared)(unsafe.Pointer(pBt)).FpageSize >> 16) & U32(0xff))) + *(*uint8)(unsafe.Pointer(data + 18)) = uint8(1) + *(*uint8)(unsafe.Pointer(data + 19)) = uint8(1) + + *(*uint8)(unsafe.Pointer(data + 20)) = (U8((*BtShared)(unsafe.Pointer(pBt)).FpageSize - (*BtShared)(unsafe.Pointer(pBt)).FusableSize)) + *(*uint8)(unsafe.Pointer(data + 21)) = uint8(64) + *(*uint8)(unsafe.Pointer(data + 22)) = uint8(32) + *(*uint8)(unsafe.Pointer(data + 23)) = uint8(32) + libc.Xmemset(tls, (data + 24), 0, (uint64(100 - 24))) + zeroPage(tls, pP1, ((PTF_INTKEY | PTF_LEAF) | PTF_LEAFDATA)) + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_PAGESIZE_FIXED)) + + Xsqlite3Put4byte(tls, (data + 52), uint32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum)) + Xsqlite3Put4byte(tls, (data + 64), uint32((*BtShared)(unsafe.Pointer(pBt)).FincrVacuum)) + (*BtShared)(unsafe.Pointer(pBt)).FnPage = U32(1) + *(*uint8)(unsafe.Pointer(data + 31)) = uint8(1) + return SQLITE_OK +} + +// Initialize the first page of the database file (creating a database +// consisting of a single page and no schema objects). Return SQLITE_OK +// if successful, or an SQLite error code otherwise. +func Xsqlite3BtreeNewDb(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:68815:20: */ + var rc int32 + Xsqlite3BtreeEnter(tls, p) + (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FnPage = U32(0) + rc = newDatabase(tls, (*Btree)(unsafe.Pointer(p)).FpBt) + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Attempt to start a new transaction. A write-transaction +// is started if the second argument is nonzero, otherwise a read- +// transaction. If the second argument is 2 or more and exclusive +// transaction is started, meaning that no other process is allowed +// to access the database. A preexisting transaction may not be +// upgraded to exclusive by calling this routine a second time - the +// exclusivity flag only works for a new transaction. +// +// A write-transaction must be started before attempting any +// changes to the database. None of the following routines +// will work unless a transaction is started first: +// +// sqlite3BtreeCreateTable() +// sqlite3BtreeCreateIndex() +// sqlite3BtreeClearTable() +// sqlite3BtreeDropTable() +// sqlite3BtreeInsert() +// sqlite3BtreeDelete() +// sqlite3BtreeUpdateMeta() +// +// If an initial attempt to acquire the lock fails because of lock contention +// and the database was previously unlocked, then invoke the busy handler +// if there is one. But if there was previously a read-lock, do not +// invoke the busy handler - just return SQLITE_BUSY. SQLITE_BUSY is +// returned when there is already a read-lock in order to avoid a deadlock. +// +// Suppose there are two processes A and B. A has a read lock and B has +// a reserved lock. B tries to promote to exclusive but is blocked because +// of A's read lock. A tries to promote to reserved but is blocked by B. +// One or the other of the two processes must give way or there can be +// no progress. By returning SQLITE_BUSY and not invoking the busy callback +// when A already has a read lock, we encourage A to give up and let B +// proceed. +func Xsqlite3BtreeBeginTrans(tls *libc.TLS, p uintptr, wrflag int32, pSchemaVersion uintptr) int32 { /* sqlite3.c:68859:20: */ + var pBt uintptr + var pPager uintptr + var rc int32 + var pIter uintptr + var pBlock uintptr + var pPage1 uintptr + pBt = (*Btree)(unsafe.Pointer(p)).FpBt + pPager = (*BtShared)(unsafe.Pointer(pBt)).FpPager + rc = SQLITE_OK + + Xsqlite3BtreeEnter(tls, p) + + // If the btree is already in a write-transaction, or it + // is already in a read-transaction and a read-transaction + // is requested, this is a no-op. + if !((int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_WRITE) || ((int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_READ) && !(wrflag != 0))) { + goto __1 + } + goto trans_begun +__1: + ; + + if !((((*Sqlite3)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).Fdb)).Fflags & uint64(SQLITE_ResetDatabase)) != 0) && + (int32(Xsqlite3PagerIsreadonly(tls, pPager)) == 0)) { + goto __2 + } + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_READ_ONLY))) +__2: + ; + + // Write transactions are not possible on a read-only database + if !(((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_READ_ONLY) != 0) && (wrflag != 0)) { + goto __3 + } + rc = SQLITE_READONLY + goto trans_begun +__3: + ; + + pBlock = uintptr(0) + // If another database handle has already opened a write transaction + // on this shared-btree structure and a second write transaction is + // requested, return SQLITE_LOCKED. + if !(((wrflag != 0) && (int32((*BtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_WRITE)) || + ((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_PENDING) != 0)) { + goto __4 + } + pBlock = (*Btree)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpWriter)).Fdb + goto __5 +__4: + if !(wrflag > 1) { + goto __6 + } + pIter = (*BtShared)(unsafe.Pointer(pBt)).FpLock +__7: + if !(pIter != 0) { + goto __9 + } + if !((*BtLock)(unsafe.Pointer(pIter)).FpBtree != p) { + goto __10 + } + pBlock = (*Btree)(unsafe.Pointer((*BtLock)(unsafe.Pointer(pIter)).FpBtree)).Fdb + goto __9 +__10: + ; + goto __8 +__8: + pIter = (*BtLock)(unsafe.Pointer(pIter)).FpNext + goto __7 + goto __9 +__9: + ; +__6: + ; +__5: + ; + if !(pBlock != 0) { + goto __11 + } + Xsqlite3ConnectionBlocked(tls, (*Btree)(unsafe.Pointer(p)).Fdb, pBlock) + rc = (SQLITE_LOCKED | (int32(1) << 8)) + goto trans_begun +__11: + ; + + // Any read-only or read-write transaction implies a read-lock on + // page 1. So if some other shared-cache client already has a write-lock + // on page 1, the transaction cannot be opened. + rc = querySharedCacheTableLock(tls, p, uint32(SCHEMA_ROOT), uint8(READ_LOCK)) + if !(SQLITE_OK != rc) { + goto __12 + } + goto trans_begun +__12: + ; + + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_INITIALLY_EMPTY))) + if !((*BtShared)(unsafe.Pointer(pBt)).FnPage == U32(0)) { + goto __13 + } + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_INITIALLY_EMPTY)) +__13: + ; +__14: + ; + + // Call lockBtree() until either pBt->pPage1 is populated or + // lockBtree() returns something other than SQLITE_OK. lockBtree() + // may return SQLITE_OK but leave pBt->pPage1 set to 0 if after + // reading page 1 it discovers that the page-size of the database + // file is not pBt->pageSize. In this case lockBtree() will update + // pBt->pageSize to the page-size of the file on disk. +__17: + if !(((*BtShared)(unsafe.Pointer(pBt)).FpPage1 == uintptr(0)) && (SQLITE_OK == (libc.AssignInt32(&rc, lockBtree(tls, pBt))))) { + goto __18 + } + goto __17 +__18: + ; + + if !((rc == SQLITE_OK) && (wrflag != 0)) { + goto __19 + } + if !((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_READ_ONLY) != 0) { + goto __20 + } + rc = SQLITE_READONLY + goto __21 +__20: + rc = Xsqlite3PagerBegin(tls, pPager, (libc.Bool32(wrflag > 1)), Xsqlite3TempInMemory(tls, (*Btree)(unsafe.Pointer(p)).Fdb)) + if !(rc == SQLITE_OK) { + goto __22 + } + rc = newDatabase(tls, pBt) + goto __23 +__22: + if !((rc == (SQLITE_BUSY | (int32(2) << 8))) && (int32((*BtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_NONE)) { + goto __24 + } + // if there was no transaction opened when this function was + // called and SQLITE_BUSY_SNAPSHOT is returned, change the error + // code to SQLITE_BUSY. + rc = SQLITE_BUSY +__24: + ; +__23: + ; +__21: + ; +__19: + ; + + if !(rc != SQLITE_OK) { + goto __25 + } + + unlockBtreeIfUnused(tls, pBt) +__25: + ; + goto __15 +__15: + if (((rc & 0xFF) == SQLITE_BUSY) && (int32((*BtShared)(unsafe.Pointer(pBt)).FinTransaction) == TRANS_NONE)) && (btreeInvokeBusyHandler(tls, pBt) != 0) { + goto __14 + } + goto __16 +__16: + ; + + if !(rc == SQLITE_OK) { + goto __26 + } + if !(int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_NONE) { + goto __27 + } + (*BtShared)(unsafe.Pointer(pBt)).FnTransaction++ + if !((*Btree)(unsafe.Pointer(p)).Fsharable != 0) { + goto __28 + } + + (*Btree)(unsafe.Pointer(p)).Flock.FeLock = U8(READ_LOCK) + (*Btree)(unsafe.Pointer(p)).Flock.FpNext = (*BtShared)(unsafe.Pointer(pBt)).FpLock + (*BtShared)(unsafe.Pointer(pBt)).FpLock = (p + 48 /* &.lock */) +__28: + ; +__27: + ; + (*Btree)(unsafe.Pointer(p)).FinTrans = func() uint8 { + if wrflag != 0 { + return uint8(TRANS_WRITE) + } + return uint8(TRANS_READ) + }() + if !(int32((*Btree)(unsafe.Pointer(p)).FinTrans) > int32((*BtShared)(unsafe.Pointer(pBt)).FinTransaction)) { + goto __29 + } + (*BtShared)(unsafe.Pointer(pBt)).FinTransaction = (*Btree)(unsafe.Pointer(p)).FinTrans +__29: + ; + if !(wrflag != 0) { + goto __30 + } + pPage1 = (*BtShared)(unsafe.Pointer(pBt)).FpPage1 + + (*BtShared)(unsafe.Pointer(pBt)).FpWriter = p + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_EXCLUSIVE))) + if !(wrflag > 1) { + goto __31 + } + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_EXCLUSIVE)) +__31: + ; + + // If the db-size header field is incorrect (as it may be if an old + // client has been writing the database file), update it now. Doing + // this sooner rather than later means the database size can safely + // re-read the database size from page 1 if a savepoint or transaction + // rollback occurs within the transaction. + if !((*BtShared)(unsafe.Pointer(pBt)).FnPage != Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData+28))) { + goto __32 + } + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage1)).FpDbPage) + if !(rc == SQLITE_OK) { + goto __33 + } + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 28), (*BtShared)(unsafe.Pointer(pBt)).FnPage) +__33: + ; +__32: + ; +__30: + ; +__26: + ; + +trans_begun: + if !(rc == SQLITE_OK) { + goto __34 + } + if !(pSchemaVersion != 0) { + goto __35 + } + *(*int32)(unsafe.Pointer(pSchemaVersion)) = int32(Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 40))) +__35: + ; + if !(wrflag != 0) { + goto __36 + } + // This call makes sure that the pager has the correct number of + // open savepoints. If the second parameter is greater than 0 and + // the sub-journal is not already open, then it will be opened here. + rc = Xsqlite3PagerOpenSavepoint(tls, pPager, (*Sqlite3)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).Fdb)).FnSavepoint) +__36: + ; +__34: + ; + + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Set the pointer-map entries for all children of page pPage. Also, if +// pPage contains cells that point to overflow pages, set the pointer +// map entries for the overflow pages as well. +func setChildPtrmaps(tls *libc.TLS, pPage uintptr) int32 { /* sqlite3.c:69039:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 // Counter variable + var nCell int32 // Number of cells in page pPage + // var rc int32 at bp, 4 + // Return code + var pBt uintptr = (*MemPage)(unsafe.Pointer(pPage)).FpBt + var pgno Pgno = (*MemPage)(unsafe.Pointer(pPage)).Fpgno + + if (*MemPage)(unsafe.Pointer(pPage)).FisInit != 0 { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + } else { + *(*int32)(unsafe.Pointer(bp /* rc */)) = btreeInitPage(tls, pPage) + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + nCell = int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) + + for i = 0; i < nCell; i++ { + var pCell uintptr = ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (i))))))))))) + + ptrmapPutOvflPtr(tls, pPage, pPage, pCell, bp /* &rc */) + + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + var childPgno Pgno = Xsqlite3Get4byte(tls, pCell) + ptrmapPut(tls, pBt, childPgno, uint8(PTRMAP_BTREE), pgno, bp /* &rc */) + } + } + + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + var childPgno Pgno = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 8)))) + ptrmapPut(tls, pBt, childPgno, uint8(PTRMAP_BTREE), pgno, bp /* &rc */) + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Somewhere on pPage is a pointer to page iFrom. Modify this pointer so +// that it points to iTo. Parameter eType describes the type of pointer to +// be modified, as follows: +// +// PTRMAP_BTREE: pPage is a btree-page. The pointer points at a child +// page of pPage. +// +// PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow +// page pointed to by one of the cells on pPage. +// +// PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next +// overflow page in the list. +func modifyPagePointer(tls *libc.TLS, pPage uintptr, iFrom Pgno, iTo Pgno, eType U8) int32 { /* sqlite3.c:69084:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if int32(eType) == PTRMAP_OVERFLOW2 { + // The pointer is always the first 4 bytes of the page in this case. + if Xsqlite3Get4byte(tls, (*MemPage)(unsafe.Pointer(pPage)).FaData) != iFrom { + return Xsqlite3CorruptError(tls, 69090) + } + Xsqlite3Put4byte(tls, (*MemPage)(unsafe.Pointer(pPage)).FaData, iTo) + } else { + var i int32 + var nCell int32 + var rc int32 + + if (*MemPage)(unsafe.Pointer(pPage)).FisInit != 0 { + rc = SQLITE_OK + } else { + rc = btreeInitPage(tls, pPage) + } + if rc != 0 { + return rc + } + nCell = int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) + + for i = 0; i < nCell; i++ { + var pCell uintptr = ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (i))))))))))) + if int32(eType) == PTRMAP_OVERFLOW1 { + // var info CellInfo at bp, 24 + + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, pCell, bp /* &info */) + if U32((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnLocal) < (*CellInfo)(unsafe.Pointer(bp /* &info */)).FnPayload { + if (pCell + uintptr((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnSize)) > ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize)) { + return Xsqlite3CorruptError(tls, 69109) + } + if iFrom == Xsqlite3Get4byte(tls, ((pCell+uintptr((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnSize))-uintptr(4))) { + Xsqlite3Put4byte(tls, ((pCell + uintptr((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnSize)) - uintptr(4)), iTo) + break + } + } + } else { + if Xsqlite3Get4byte(tls, pCell) == iFrom { + Xsqlite3Put4byte(tls, pCell, iTo) + break + } + } + } + + if i == nCell { + if (int32(eType) != PTRMAP_BTREE) || (Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData+uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset)+8)))) != iFrom) { + return Xsqlite3CorruptError(tls, 69127) + } + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 8))), iTo) + } + } + return SQLITE_OK +} + +// Move the open database page pDbPage to location iFreePage in the +// database. The pDbPage reference remains valid. +// +// The isCommit flag indicates that there is no need to remember that +// the journal needs to be sync()ed before database page pDbPage->pgno +// can be written to. The caller has already promised not to write to that +// page. +func relocatePage(tls *libc.TLS, pBt uintptr, pDbPage uintptr, eType U8, iPtrPage Pgno, iFreePage Pgno, isCommit int32) int32 { /* sqlite3.c:69145:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var pPtrPage uintptr at bp+8, 8 + // The page that contains a pointer to pDbPage + var iDbPage Pgno = (*MemPage)(unsafe.Pointer(pDbPage)).Fpgno + var pPager uintptr = (*BtShared)(unsafe.Pointer(pBt)).FpPager + // var rc int32 at bp, 4 + + if iDbPage < Pgno(3) { + return Xsqlite3CorruptError(tls, 69162) + } + + // Move page iDbPage from its current location to page number iFreePage + + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3PagerMovepage(tls, pPager, (*MemPage)(unsafe.Pointer(pDbPage)).FpDbPage, iFreePage, isCommit) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + (*MemPage)(unsafe.Pointer(pDbPage)).Fpgno = iFreePage + + // If pDbPage was a btree-page, then it may have child pages and/or cells + // that point to overflow pages. The pointer map entries for all these + // pages need to be changed. + // + // If pDbPage is an overflow page, then the first 4 bytes may store a + // pointer to a subsequent overflow page. If this is the case, then + // the pointer map needs to be updated for the subsequent overflow page. + if (int32(eType) == PTRMAP_BTREE) || (int32(eType) == PTRMAP_ROOTPAGE) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = setChildPtrmaps(tls, pDbPage) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } else { + var nextOvfl Pgno = Xsqlite3Get4byte(tls, (*MemPage)(unsafe.Pointer(pDbPage)).FaData) + if nextOvfl != Pgno(0) { + ptrmapPut(tls, pBt, nextOvfl, uint8(PTRMAP_OVERFLOW2), iFreePage, bp /* &rc */) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } + } + + // Fix the database pointer on page iPtrPage that pointed at iDbPage so + // that it points at iFreePage. Also fix the pointer map entry for + // iPtrPage. + if int32(eType) != PTRMAP_ROOTPAGE { + *(*int32)(unsafe.Pointer(bp /* rc */)) = btreeGetPage(tls, pBt, iPtrPage, bp+8 /* &pPtrPage */, 0) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pPtrPage */)))).FpDbPage) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPtrPage */))) + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + *(*int32)(unsafe.Pointer(bp /* rc */)) = modifyPagePointer(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPtrPage */)), iDbPage, iFreePage, eType) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPtrPage */))) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + ptrmapPut(tls, pBt, iFreePage, eType, iPtrPage, bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Perform a single step of an incremental-vacuum. If successful, return +// SQLITE_OK. If there is no work to do (and therefore no point in +// calling this function again), return SQLITE_DONE. Or, if an error +// occurs, return some other error code. +// +// More specifically, this function attempts to re-organize the database so +// that the last page of the file currently in use is no longer in use. +// +// Parameter nFin is the number of pages that this database would contain +// were this function called until it returns SQLITE_DONE. +// +// If the bCommit parameter is non-zero, this function assumes that the +// caller will keep calling incrVacuumStep() until it returns SQLITE_DONE +// or an error. bCommit is passed true for an auto-vacuum-on-commit +// operation, or false for an incremental vacuum. +func incrVacuumStep(tls *libc.TLS, pBt uintptr, nFin Pgno, iLastPg Pgno, bCommit int32) int32 { /* sqlite3.c:69239:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + var nFreeList Pgno // Number of pages still on the free-list + var rc int32 + + if !(ptrmapPageno(tls, pBt, iLastPg) == (iLastPg)) && (iLastPg != ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + // var eType U8 at bp, 1 + + // var iPtrPage Pgno at bp+4, 4 + + nFreeList = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 36)) + if nFreeList == Pgno(0) { + return SQLITE_DONE + } + + rc = ptrmapGet(tls, pBt, iLastPg, bp /* &eType */, bp+4 /* &iPtrPage */) + if rc != SQLITE_OK { + return rc + } + if int32(*(*U8)(unsafe.Pointer(bp /* eType */))) == PTRMAP_ROOTPAGE { + return Xsqlite3CorruptError(tls, 69260) + } + + if int32(*(*U8)(unsafe.Pointer(bp /* eType */))) == PTRMAP_FREEPAGE { + if bCommit == 0 { + // Remove the page from the files free-list. This is not required + // if bCommit is non-zero. In that case, the free-list will be + // truncated to zero after this function returns, so it doesn't + // matter if it still contains some garbage entries. + // var iFreePg Pgno at bp+16, 4 + + // var pFreePg uintptr at bp+8, 8 + + rc = allocateBtreePage(tls, pBt, bp+8 /* &pFreePg */, bp+16 /* &iFreePg */, iLastPg, uint8(BTALLOC_EXACT)) + if rc != SQLITE_OK { + return rc + } + + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pFreePg */))) + } + } else { + // var iFreePg Pgno at bp+40, 4 + // Index of free page to move pLastPg to + // var pLastPg uintptr at bp+24, 8 + + var eMode U8 = U8(BTALLOC_ANY) // Mode parameter for allocateBtreePage() + var iNear Pgno = Pgno(0) // nearby parameter for allocateBtreePage() + + rc = btreeGetPage(tls, pBt, iLastPg, bp+24 /* &pLastPg */, 0) + if rc != SQLITE_OK { + return rc + } + + // If bCommit is zero, this loop runs exactly once and page pLastPg + // is swapped with the first free page pulled off the free list. + // + // On the other hand, if bCommit is greater than zero, then keep + // looping until a free-page located within the first nFin pages + // of the file is found. + if bCommit == 0 { + eMode = U8(BTALLOC_LE) + iNear = nFin + } + for ok := true; ok; ok = ((bCommit != 0) && (*(*Pgno)(unsafe.Pointer(bp + 40 /* iFreePg */)) > nFin)) { + // var pFreePg uintptr at bp+32, 8 + + rc = allocateBtreePage(tls, pBt, bp+32 /* &pFreePg */, bp+40 /* &iFreePg */, iNear, eMode) + if rc != SQLITE_OK { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pLastPg */))) + return rc + } + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pFreePg */))) + } + + rc = relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 24 /* pLastPg */)), *(*U8)(unsafe.Pointer(bp /* eType */)), *(*Pgno)(unsafe.Pointer(bp + 4 /* iPtrPage */)), *(*Pgno)(unsafe.Pointer(bp + 40 /* iFreePg */)), bCommit) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pLastPg */))) + if rc != SQLITE_OK { + return rc + } + } + } + + if bCommit == 0 { + for ok1 := true; ok1; ok1 = ((iLastPg == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) || (ptrmapPageno(tls, pBt, iLastPg) == (iLastPg))) { + iLastPg-- + } + (*BtShared)(unsafe.Pointer(pBt)).FbDoTruncate = U8(1) + (*BtShared)(unsafe.Pointer(pBt)).FnPage = iLastPg + } + return SQLITE_OK +} + +// The database opened by the first argument is an auto-vacuum database +// nOrig pages in size containing nFree free pages. Return the expected +// size of the database in pages following an auto-vacuum operation. +func finalDbSize(tls *libc.TLS, pBt uintptr, nOrig Pgno, nFree Pgno) Pgno { /* sqlite3.c:69335:13: */ + var nEntry int32 // Number of entries on one ptrmap page + var nPtrmap Pgno // Number of PtrMap pages to be freed + var nFin Pgno // Return value + + nEntry = (int32((*BtShared)(unsafe.Pointer(pBt)).FusableSize / U32(5))) + nPtrmap = ((((nFree - nOrig) + ptrmapPageno(tls, pBt, nOrig)) + Pgno(nEntry)) / Pgno(nEntry)) + nFin = ((nOrig - nFree) - nPtrmap) + if (nOrig > ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) && (nFin < ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + nFin-- + } + for (ptrmapPageno(tls, pBt, nFin) == (nFin)) || (nFin == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + nFin-- + } + + return nFin +} + +// A write-transaction must be opened before calling this function. +// It performs a single unit of work towards an incremental vacuum. +// +// If the incremental vacuum is finished after this function has run, +// SQLITE_DONE is returned. If it is not finished, but no error occurred, +// SQLITE_OK is returned. Otherwise an SQLite error code. +func Xsqlite3BtreeIncrVacuum(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:69361:20: */ + var rc int32 + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0) { + rc = SQLITE_DONE + } else { + var nOrig Pgno = btreePagecount(tls, pBt) + var nFree Pgno = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 36)) + var nFin Pgno = finalDbSize(tls, pBt, nOrig, nFree) + + if (nOrig < nFin) || (nFree >= nOrig) { + rc = Xsqlite3CorruptError(tls, 69375) + } else if nFree > Pgno(0) { + rc = saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + if rc == SQLITE_OK { + invalidateAllOverflowCache(tls, pBt) + rc = incrVacuumStep(tls, pBt, nFin, nOrig, 0) + } + if rc == SQLITE_OK { + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 28), (*BtShared)(unsafe.Pointer(pBt)).FnPage) + } + } else { + rc = SQLITE_DONE + } + } + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// This routine is called prior to sqlite3PagerCommit when a transaction +// is committed for an auto-vacuum database. +// +// If SQLITE_OK is returned, then *pnTrunc is set to the number of pages +// the database file should be truncated to during the commit process. +// i.e. the database has been reorganized so that only the first *pnTrunc +// pages are in use. +func autoVacuumCommit(tls *libc.TLS, pBt uintptr) int32 { /* sqlite3.c:69403:12: */ + var rc int32 = SQLITE_OK + var pPager uintptr = (*BtShared)(unsafe.Pointer(pBt)).FpPager + + invalidateAllOverflowCache(tls, pBt) + + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FincrVacuum) != 0) { + var nFin Pgno // Number of pages in database after autovacuuming + var nFree Pgno // Number of pages on the freelist initially + var iFree Pgno // The next page to be freed + var nOrig Pgno // Database size before freeing + + nOrig = btreePagecount(tls, pBt) + if (ptrmapPageno(tls, pBt, nOrig) == (nOrig)) || (nOrig == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + // It is not possible to create a database for which the final page + // is either a pointer-map page or the pending-byte page. If one + // is encountered, this indicates corruption. + return Xsqlite3CorruptError(tls, 69423) + } + + nFree = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 36)) + nFin = finalDbSize(tls, pBt, nOrig, nFree) + if nFin > nOrig { + return Xsqlite3CorruptError(tls, 69428) + } + if nFin < nOrig { + rc = saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + } + for iFree = nOrig; (iFree > nFin) && (rc == SQLITE_OK); iFree-- { + rc = incrVacuumStep(tls, pBt, nFin, iFree, 1) + } + if ((rc == SQLITE_DONE) || (rc == SQLITE_OK)) && (nFree > Pgno(0)) { + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 32), uint32(0)) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 36), uint32(0)) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 28), nFin) + (*BtShared)(unsafe.Pointer(pBt)).FbDoTruncate = U8(1) + (*BtShared)(unsafe.Pointer(pBt)).FnPage = nFin + } + if rc != SQLITE_OK { + Xsqlite3PagerRollback(tls, pPager) + } + } + + return rc +} + +// This routine does the first phase of a two-phase commit. This routine +// causes a rollback journal to be created (if it does not already exist) +// and populated with enough information so that if a power loss occurs +// the database can be restored to its original state by playing back +// the journal. Then the contents of the journal are flushed out to +// the disk. After the journal is safely on oxide, the changes to the +// database are written into the database file and flushed to oxide. +// At the end of this call, the rollback journal still exists on the +// disk and we are still holding all locks, so the transaction has not +// committed. See sqlite3BtreeCommitPhaseTwo() for the second phase of the +// commit process. +// +// This call is a no-op if no write-transaction is currently active on pBt. +// +// Otherwise, sync the database file for the btree pBt. zSuperJrnl points to +// the name of a super-journal file that should be written into the +// individual journal file, or is NULL, indicating no super-journal file +// (single database transaction). +// +// When this is called, the super-journal should already have been +// created, populated with this journal pointer and synced to disk. +// +// Once this is routine has returned, the only thing required to commit +// the write-transaction for this database file is to delete the journal. +func Xsqlite3BtreeCommitPhaseOne(tls *libc.TLS, p uintptr, zSuperJrnl uintptr) int32 { /* sqlite3.c:69482:20: */ + var rc int32 = SQLITE_OK + if int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_WRITE { + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + Xsqlite3BtreeEnter(tls, p) + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + rc = autoVacuumCommit(tls, pBt) + if rc != SQLITE_OK { + Xsqlite3BtreeLeave(tls, p) + return rc + } + } + if (*BtShared)(unsafe.Pointer(pBt)).FbDoTruncate != 0 { + Xsqlite3PagerTruncateImage(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (*BtShared)(unsafe.Pointer(pBt)).FnPage) + } + rc = Xsqlite3PagerCommitPhaseOne(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, zSuperJrnl, 0) + Xsqlite3BtreeLeave(tls, p) + } + return rc +} + +// This function is called from both BtreeCommitPhaseTwo() and BtreeRollback() +// at the conclusion of a transaction. +func btreeEndTransaction(tls *libc.TLS, p uintptr) { /* sqlite3.c:69509:13: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var db uintptr = (*Btree)(unsafe.Pointer(p)).Fdb + + (*BtShared)(unsafe.Pointer(pBt)).FbDoTruncate = U8(0) + if (int32((*Btree)(unsafe.Pointer(p)).FinTrans) > TRANS_NONE) && ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeRead > 1) { + // If there are other active statements that belong to this database + // handle, downgrade to a read-only transaction. The other statements + // may still be reading from the database. + downgradeAllSharedCacheTableLocks(tls, p) + (*Btree)(unsafe.Pointer(p)).FinTrans = U8(TRANS_READ) + } else { + // If the handle had any kind of transaction open, decrement the + // transaction count of the shared btree. If the transaction count + // reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused() + // call below will unlock the pager. + if int32((*Btree)(unsafe.Pointer(p)).FinTrans) != TRANS_NONE { + clearAllSharedCacheTableLocks(tls, p) + (*BtShared)(unsafe.Pointer(pBt)).FnTransaction-- + if 0 == (*BtShared)(unsafe.Pointer(pBt)).FnTransaction { + (*BtShared)(unsafe.Pointer(pBt)).FinTransaction = U8(TRANS_NONE) + } + } + + // Set the current transaction state to TRANS_NONE and unlock the + // pager if this call closed the only read or write transaction. + (*Btree)(unsafe.Pointer(p)).FinTrans = U8(TRANS_NONE) + unlockBtreeIfUnused(tls, pBt) + } + +} + +// Commit the transaction currently in progress. +// +// This routine implements the second phase of a 2-phase commit. The +// sqlite3BtreeCommitPhaseOne() routine does the first phase and should +// be invoked prior to calling this routine. The sqlite3BtreeCommitPhaseOne() +// routine did all the work of writing information out to disk and flushing the +// contents so that they are written onto the disk platter. All this +// routine has to do is delete or truncate or zero the header in the +// the rollback journal (which causes the transaction to commit) and +// drop locks. +// +// Normally, if an error occurs while the pager layer is attempting to +// finalize the underlying journal file, this function returns an error and +// the upper layer will attempt a rollback. However, if the second argument +// is non-zero then this b-tree transaction is part of a multi-file +// transaction. In this case, the transaction has already been committed +// (by deleting a super-journal file) and the caller will ignore this +// functions return code. So, even if an error occurs in the pager layer, +// reset the b-tree objects internal state to indicate that the write +// transaction has been closed. This is quite safe, as the pager will have +// transitioned to the error state. +// +// This will release the write lock on the database file. If there +// are no active cursors, it also releases the read lock. +func Xsqlite3BtreeCommitPhaseTwo(tls *libc.TLS, p uintptr, bCleanup int32) int32 { /* sqlite3.c:69571:20: */ + + if int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_NONE { + return SQLITE_OK + } + Xsqlite3BtreeEnter(tls, p) + + // If the handle has a write-transaction open, commit the shared-btrees + // transaction and set the shared state to TRANS_READ. + if int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_WRITE { + var rc int32 + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + rc = Xsqlite3PagerCommitPhaseTwo(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) + if (rc != SQLITE_OK) && (bCleanup == 0) { + Xsqlite3BtreeLeave(tls, p) + return rc + } + (*Btree)(unsafe.Pointer(p)).FiBDataVersion-- // Compensate for pPager->iDataVersion++; + (*BtShared)(unsafe.Pointer(pBt)).FinTransaction = U8(TRANS_READ) + btreeClearHasContent(tls, pBt) + } + + btreeEndTransaction(tls, p) + Xsqlite3BtreeLeave(tls, p) + return SQLITE_OK +} + +// Do both phases of a commit. +func Xsqlite3BtreeCommit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:69603:20: */ + var rc int32 + Xsqlite3BtreeEnter(tls, p) + rc = Xsqlite3BtreeCommitPhaseOne(tls, p, uintptr(0)) + if rc == SQLITE_OK { + rc = Xsqlite3BtreeCommitPhaseTwo(tls, p, 0) + } + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// This routine sets the state to CURSOR_FAULT and the error +// code to errCode for every cursor on any BtShared that pBtree +// references. Or if the writeOnly flag is set to 1, then only +// trip write cursors and leave read cursors unchanged. +// +// Every cursor is a candidate to be tripped, including cursors +// that belong to other database connections that happen to be +// sharing the cache with pBtree. +// +// This routine gets called when a rollback occurs. If the writeOnly +// flag is true, then only write-cursors need be tripped - read-only +// cursors save their current positions so that they may continue +// following the rollback. Or, if writeOnly is false, all cursors are +// tripped. In general, writeOnly is false if the transaction being +// rolled back modified the database schema. In this case b-tree root +// pages may be moved or deleted from the database altogether, making +// it unsafe for read cursors to continue. +// +// If the writeOnly flag is true and an error is encountered while +// saving the current position of a read-only cursor, all cursors, +// including all read-cursors are tripped. +// +// SQLITE_OK is returned if successful, or if an error occurs while +// saving a cursor position, an SQLite error code. +func Xsqlite3BtreeTripAllCursors(tls *libc.TLS, pBtree uintptr, errCode int32, writeOnly int32) int32 { /* sqlite3.c:69640:20: */ + var p uintptr + var rc int32 = SQLITE_OK + + if pBtree != 0 { + Xsqlite3BtreeEnter(tls, pBtree) + for p = (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBtree)).FpBt)).FpCursor; p != 0; p = (*BtCursor)(unsafe.Pointer(p)).FpNext { + if (writeOnly != 0) && ((int32((*BtCursor)(unsafe.Pointer(p)).FcurFlags) & BTCF_WriteFlag) == 0) { + if (int32((*BtCursor)(unsafe.Pointer(p)).FeState) == CURSOR_VALID) || (int32((*BtCursor)(unsafe.Pointer(p)).FeState) == CURSOR_SKIPNEXT) { + rc = saveCursorPosition(tls, p) + if rc != SQLITE_OK { + Xsqlite3BtreeTripAllCursors(tls, pBtree, rc, 0) + break + } + } + } else { + Xsqlite3BtreeClearCursor(tls, p) + (*BtCursor)(unsafe.Pointer(p)).FeState = U8(CURSOR_FAULT) + (*BtCursor)(unsafe.Pointer(p)).FskipNext = errCode + } + btreeReleaseAllCursorPages(tls, p) + } + Xsqlite3BtreeLeave(tls, pBtree) + } + return rc +} + +// Set the pBt->nPage field correctly, according to the current +// state of the database. Assume pBt->pPage1 is valid. +func btreeSetNPage(tls *libc.TLS, pBt uintptr, pPage1 uintptr) { /* sqlite3.c:69672:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* nPage */)) = int32(Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 28))) + + if *(*int32)(unsafe.Pointer(bp /* nPage */)) == 0 { + Xsqlite3PagerPagecount(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, bp /* &nPage */) + } + + (*BtShared)(unsafe.Pointer(pBt)).FnPage = U32(*(*int32)(unsafe.Pointer(bp /* nPage */))) +} + +// Rollback the transaction in progress. +// +// If tripCode is not SQLITE_OK then cursors will be invalidated (tripped). +// Only write cursors are tripped if writeOnly is true but all cursors are +// tripped if writeOnly is false. Any attempt to use +// a tripped cursor will result in an error. +// +// This will release the write lock on the database file. If there +// are no active cursors, it also releases the read lock. +func Xsqlite3BtreeRollback(tls *libc.TLS, p uintptr, tripCode int32, writeOnly int32) int32 { /* sqlite3.c:69691:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + // var pPage1 uintptr at bp, 8 + + Xsqlite3BtreeEnter(tls, p) + if tripCode == SQLITE_OK { + rc = libc.AssignInt32(&tripCode, saveAllCursors(tls, pBt, uint32(0), uintptr(0))) + if rc != 0 { + writeOnly = 0 + } + } else { + rc = SQLITE_OK + } + if tripCode != 0 { + var rc2 int32 = Xsqlite3BtreeTripAllCursors(tls, p, tripCode, writeOnly) + + if rc2 != SQLITE_OK { + rc = rc2 + } + } + + if int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_WRITE { + var rc2 int32 + + rc2 = Xsqlite3PagerRollback(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) + if rc2 != SQLITE_OK { + rc = rc2 + } + + // The rollback may have destroyed the pPage1->aData value. So + // call btreeGetPage() on page 1 again to make + // sure pPage1->aData is set correctly. + if btreeGetPage(tls, pBt, uint32(1), bp /* &pPage1 */, 0) == SQLITE_OK { + btreeSetNPage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp /* pPage1 */))) + releasePageOne(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage1 */))) + } + + (*BtShared)(unsafe.Pointer(pBt)).FinTransaction = U8(TRANS_READ) + btreeClearHasContent(tls, pBt) + } + + btreeEndTransaction(tls, p) + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Start a statement subtransaction. The subtransaction can be rolled +// back independently of the main transaction. You must start a transaction +// before starting a subtransaction. The subtransaction is ended automatically +// if the main transaction commits or rolls back. +// +// Statement subtransactions are used around individual SQL statements +// that are contained within a BEGIN...COMMIT block. If a constraint +// error occurs within the statement, the effect of that one statement +// can be rolled back without having to rollback the entire transaction. +// +// A statement sub-transaction is implemented as an anonymous savepoint. The +// value passed as the second parameter is the total number of savepoints, +// including the new anonymous savepoint, open on the B-Tree. i.e. if there +// are no active savepoints and no other statement-transactions open, +// iStatement is 1. This anonymous savepoint can be released or rolled back +// using the sqlite3BtreeSavepoint() function. +func Xsqlite3BtreeBeginStmt(tls *libc.TLS, p uintptr, iStatement int32) int32 { /* sqlite3.c:69756:20: */ + var rc int32 + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + Xsqlite3BtreeEnter(tls, p) + + // At the pager level, a statement transaction is a savepoint with + // an index greater than all savepoints created explicitly using + // SQL statements. It is illegal to open, release or rollback any + // such savepoints while the statement transaction savepoint is active. + rc = Xsqlite3PagerOpenSavepoint(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, iStatement) + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// The second argument to this function, op, is always SAVEPOINT_ROLLBACK +// or SAVEPOINT_RELEASE. This function either releases or rolls back the +// savepoint identified by parameter iSavepoint, depending on the value +// of op. +// +// Normally, iSavepoint is greater than or equal to zero. However, if op is +// SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the +// contents of the entire transaction are rolled back. This is different +// from a normal transaction rollback, as no locks are released and the +// transaction remains open. +func Xsqlite3BtreeSavepoint(tls *libc.TLS, p uintptr, op int32, iSavepoint int32) int32 { /* sqlite3.c:69787:20: */ + var rc int32 = SQLITE_OK + if (p != 0) && (int32((*Btree)(unsafe.Pointer(p)).FinTrans) == TRANS_WRITE) { + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + if op == SAVEPOINT_ROLLBACK { + rc = saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3PagerSavepoint(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, op, iSavepoint) + } + if rc == SQLITE_OK { + if (iSavepoint < 0) && ((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_INITIALLY_EMPTY) != 0) { + (*BtShared)(unsafe.Pointer(pBt)).FnPage = U32(0) + } + rc = newDatabase(tls, pBt) + btreeSetNPage(tls, pBt, (*BtShared)(unsafe.Pointer(pBt)).FpPage1) + + // pBt->nPage might be zero if the database was corrupt when + // the transaction was started. Otherwise, it must be at least 1. + + } + Xsqlite3BtreeLeave(tls, p) + } + return rc +} + +// Create a new cursor for the BTree whose root is on the page +// iTable. If a read-only cursor is requested, it is assumed that +// the caller already has at least a read-only transaction open +// on the database already. If a write-cursor is requested, then +// the caller is assumed to have an open write transaction. +// +// If the BTREE_WRCSR bit of wrFlag is clear, then the cursor can only +// be used for reading. If the BTREE_WRCSR bit is set, then the cursor +// can be used for reading or for writing if other conditions for writing +// are also met. These are the conditions that must be met in order +// for writing to be allowed: +// +// 1: The cursor must have been opened with wrFlag containing BTREE_WRCSR +// +// 2: Other database connections that share the same pager cache +// but which are not in the READ_UNCOMMITTED state may not have +// cursors open with wrFlag==0 on the same table. Otherwise +// the changes made by this write cursor would be visible to +// the read cursors in the other database connection. +// +// 3: The database must be writable (not on read-only media) +// +// 4: There must be an active transaction. +// +// The BTREE_FORDELETE bit of wrFlag may optionally be set if BTREE_WRCSR +// is set. If FORDELETE is set, that is a hint to the implementation that +// this cursor will only be used to seek to and delete entries of an index +// as part of a larger DELETE statement. The FORDELETE hint is not used by +// this implementation. But in a hypothetical alternative storage engine +// in which index entries are automatically deleted when corresponding table +// rows are deleted, the FORDELETE flag is a hint that all SEEK and DELETE +// operations on this cursor can be no-ops and all READ operations can +// return a null row (2-bytes: 0x01 0x00). +// +// No checking is done to make sure that page iTable really is the +// root page of a b-tree. If it is not, then the cursor acquired +// will not work correctly. +// +// It is assumed that the sqlite3BtreeCursorZero() has been called +// on pCur to initialize the memory space prior to invoking this routine. +func btreeCursor(tls *libc.TLS, p uintptr, iTable Pgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) int32 { /* sqlite3.c:69858:12: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt // Shared b-tree handle + var pX uintptr // Looping over other all cursors + + // The following assert statements verify that if this is a sharable + // b-tree database, the connection is holding the required table locks, + // and that no other connection has any open cursor that conflicts with + // this lock. The iTable<1 term disables the check for corrupt schemas. + + // Assert that the caller has opened the required transaction. + + if wrFlag != 0 { + allocateTempSpace(tls, pBt) + if (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace == uintptr(0) { + return SQLITE_NOMEM + } + } + if iTable <= Pgno(1) { + if iTable < Pgno(1) { + return Xsqlite3CorruptError(tls, 69894) + } else if btreePagecount(tls, pBt) == Pgno(0) { + + iTable = Pgno(0) + } + } + + // Now that no other errors can occur, finish filling in the BtCursor + // variables and link the cursor into the BtShared list. + (*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot = iTable + (*BtCursor)(unsafe.Pointer(pCur)).FiPage = int8(-1) + (*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo = pKeyInfo + (*BtCursor)(unsafe.Pointer(pCur)).FpBtree = p + (*BtCursor)(unsafe.Pointer(pCur)).FpBt = pBt + (*BtCursor)(unsafe.Pointer(pCur)).FcurFlags = func() uint8 { + if wrFlag != 0 { + return uint8(BTCF_WriteFlag) + } + return uint8(0) + }() + (*BtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags = func() uint8 { + if wrFlag != 0 { + return uint8(0) + } + return uint8(PAGER_GET_READONLY) + }() + // If there are two or more cursors on the same btree, then all such + // cursors *must* have the BTCF_Multiple flag set. + for pX = (*BtShared)(unsafe.Pointer(pBt)).FpCursor; pX != 0; pX = (*BtCursor)(unsafe.Pointer(pX)).FpNext { + if (*BtCursor)(unsafe.Pointer(pX)).FpgnoRoot == iTable { + *(*U8)(unsafe.Pointer(pX + 1 /* &.curFlags */)) |= U8((BTCF_Multiple)) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_Multiple)) + } + } + (*BtCursor)(unsafe.Pointer(pCur)).FpNext = (*BtShared)(unsafe.Pointer(pBt)).FpCursor + (*BtShared)(unsafe.Pointer(pBt)).FpCursor = pCur + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + return SQLITE_OK +} + +func btreeCursorWithLock(tls *libc.TLS, p uintptr, iTable Pgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) int32 { /* sqlite3.c:69923:12: */ + var rc int32 + Xsqlite3BtreeEnter(tls, p) + rc = btreeCursor(tls, p, iTable, wrFlag, pKeyInfo, pCur) + Xsqlite3BtreeLeave(tls, p) + return rc +} + +func Xsqlite3BtreeCursor(tls *libc.TLS, p uintptr, iTable Pgno, wrFlag int32, pKeyInfo uintptr, pCur uintptr) int32 { /* sqlite3.c:69936:20: */ + if (*Btree)(unsafe.Pointer(p)).Fsharable != 0 { + return btreeCursorWithLock(tls, p, iTable, wrFlag, pKeyInfo, pCur) + } else { + return btreeCursor(tls, p, iTable, wrFlag, pKeyInfo, pCur) + } + return int32(0) +} + +// Return the size of a BtCursor object in bytes. +// +// This interfaces is needed so that users of cursors can preallocate +// sufficient storage to hold a cursor. The BtCursor object is opaque +// to users so they cannot do the sizeof() themselves - they must call +// this routine. +func Xsqlite3BtreeCursorSize(tls *libc.TLS) int32 { /* sqlite3.c:69958:20: */ + return (int32(((uint64(unsafe.Sizeof(BtCursor{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) +} + +// Initialize memory that will be converted into a BtCursor object. +// +// The simple approach here would be to memset() the entire object +// to zero. But it turns out that the apPage[] and aiIdx[] arrays +// do not need to be zeroed and they are large, so we can save a lot +// of run-time by skipping the initialization of those elements. +func Xsqlite3BtreeCursorZero(tls *libc.TLS, p uintptr) { /* sqlite3.c:69970:21: */ + libc.Xmemset(tls, p, 0, uint64((uintptr(0) + 32 /* &.pBt */))) +} + +// Close a cursor. The read lock on the database file is released +// when the last cursor is closed. +func Xsqlite3BtreeCloseCursor(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:69978:20: */ + var pBtree uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBtree + if pBtree != 0 { + var pBt uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBt + Xsqlite3BtreeEnter(tls, pBtree) + + if (*BtShared)(unsafe.Pointer(pBt)).FpCursor == pCur { + (*BtShared)(unsafe.Pointer(pBt)).FpCursor = (*BtCursor)(unsafe.Pointer(pCur)).FpNext + } else { + var pPrev uintptr = (*BtShared)(unsafe.Pointer(pBt)).FpCursor + for ok := true; ok; ok = (pPrev != 0) { + if (*BtCursor)(unsafe.Pointer(pPrev)).FpNext == pCur { + (*BtCursor)(unsafe.Pointer(pPrev)).FpNext = (*BtCursor)(unsafe.Pointer(pCur)).FpNext + break + } + pPrev = (*BtCursor)(unsafe.Pointer(pPrev)).FpNext + } + } + btreeReleaseAllCursorPages(tls, pCur) + unlockBtreeIfUnused(tls, pBt) + Xsqlite3_free(tls, (*BtCursor)(unsafe.Pointer(pCur)).FaOverflow) + Xsqlite3_free(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpKey) + if ((int32((*BtShared)(unsafe.Pointer(pBt)).FopenFlags) & BTREE_SINGLE) != 0) && ((*BtShared)(unsafe.Pointer(pBt)).FpCursor == uintptr(0)) { + // Since the BtShared is not sharable, there is no need to + // worry about the missing sqlite3BtreeLeave() call here. + + Xsqlite3BtreeClose(tls, pBtree) + } else { + Xsqlite3BtreeLeave(tls, pBtree) + } + (*BtCursor)(unsafe.Pointer(pCur)).FpBtree = uintptr(0) + } + return SQLITE_OK +} + +// Make sure the BtCursor* given in the argument has a valid +// BtCursor.info structure. If it is not already valid, call +// btreeParseCell() to fill it in. +// +// BtCursor.info is a cache of the information in the current cell. +// Using this cache reduces the number of calls to btreeParseCell(). +func getCellInfo(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:70039:29: */ + if int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize) == 0 { + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_ValidNKey)) + btreeParseCell(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpPage, int32((*BtCursor)(unsafe.Pointer(pCur)).Fix), (pCur + 48 /* &.info */)) + } else { + + } +} + +func Xsqlite3BtreeCursorIsValidNN(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:70058:20: */ + + return (libc.Bool32(int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID)) +} + +// Return the value of the integer key or "rowid" for a table btree. +// This routine is only valid for a cursor that is pointing into a +// ordinary table btree. If the cursor points to an index btree or +// is invalid, the result of this routine is undefined. +func Xsqlite3BtreeIntegerKey(tls *libc.TLS, pCur uintptr) I64 { /* sqlite3.c:70069:20: */ + + getCellInfo(tls, pCur) + return (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey +} + +// Pin or unpin a cursor. +func Xsqlite3BtreeCursorPin(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:70080:21: */ + + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_Pinned)) +} + +func Xsqlite3BtreeCursorUnpin(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:70084:21: */ + + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_Pinned))) +} + +// Return the offset into the database file for the start of the +// payload to which the cursor is pointing. +func Xsqlite3BtreeOffset(tls *libc.TLS, pCur uintptr) I64 { /* sqlite3.c:70094:20: */ + + getCellInfo(tls, pCur) + return ((I64((*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize) * (I64((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).Fpgno) - int64(1))) + (I64((int64((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload) - int64((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FaData)) / 1))) +} + +// Return the number of bytes of payload for the entry that pCur is +// currently pointing to. For table btrees, this will be the amount +// of data. For index btrees, this will be the size of the key. +// +// The caller must guarantee that the cursor is pointing to a non-NULL +// valid entry. In other words, the calling procedure must guarantee +// that the cursor has Cursor.eState==CURSOR_VALID. +func Xsqlite3BtreePayloadSize(tls *libc.TLS, pCur uintptr) U32 { /* sqlite3.c:70112:20: */ + + getCellInfo(tls, pCur) + return (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload +} + +// Return an upper bound on the size of any record for the table +// that the cursor is pointing into. +// +// This is an optimization. Everything will still work if this +// routine always returns 2147483647 (which is the largest record +// that SQLite can handle) or more. But returning a smaller value might +// prevent large memory allocations when trying to interpret a +// corrupt datrabase. +// +// The current implementation merely returns the size of the underlying +// database file. +func Xsqlite3BtreeMaxRecordSize(tls *libc.TLS, pCur uintptr) Sqlite3_int64 { /* sqlite3.c:70132:30: */ + + return (Sqlite3_int64((*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize) * Sqlite3_int64((*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage)) +} + +// Given the page number of an overflow page in the database (parameter +// ovfl), this function finds the page number of the next page in the +// linked list of overflow pages. If possible, it uses the auto-vacuum +// pointer-map data instead of reading the content of page ovfl to do so. +// +// If an error occurs an SQLite error code is returned. Otherwise: +// +// The page number of the next overflow page in the linked list is +// written to *pPgnoNext. If page ovfl is the last page in its linked +// list, *pPgnoNext is set to zero. +// +// If ppPage is not NULL, and a reference to the MemPage object corresponding +// to page number pOvfl was obtained, then *ppPage is set to point to that +// reference. It is the responsibility of the caller to call releasePage() +// on *ppPage to free the reference. In no reference was obtained (because +// the pointer-map was used to obtain the value for *pPgnoNext), then +// *ppPage is set to zero. +func getOverflowPage(tls *libc.TLS, pBt uintptr, ovfl Pgno, ppPage uintptr, pPgnoNext uintptr) int32 { /* sqlite3.c:70157:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var next Pgno = Pgno(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pPage */)) = uintptr(0) + var rc int32 = SQLITE_OK + + // Try to find the next page in the overflow list using the + // autovacuum pointer-map pages. Guess that the next page in + // the overflow list is page number (ovfl+1). If that guess turns + // out to be wrong, fall back to loading the data of page + // number ovfl to determine the next page number. + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + // var pgno Pgno at bp+4, 4 + + var iGuess Pgno = (ovfl + Pgno(1)) + // var eType U8 at bp, 1 + + for (ptrmapPageno(tls, pBt, iGuess) == (iGuess)) || (iGuess == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + iGuess++ + } + + if iGuess <= btreePagecount(tls, pBt) { + rc = ptrmapGet(tls, pBt, iGuess, bp /* &eType */, bp+4 /* &pgno */) + if ((rc == SQLITE_OK) && (int32(*(*U8)(unsafe.Pointer(bp /* eType */))) == PTRMAP_OVERFLOW2)) && (*(*Pgno)(unsafe.Pointer(bp + 4 /* pgno */)) == ovfl) { + next = iGuess + rc = SQLITE_DONE + } + } + } + + if rc == SQLITE_OK { + rc = btreeGetPage(tls, pBt, ovfl, bp+8 /* &pPage */, func() int32 { + if ppPage == uintptr(0) { + return PAGER_GET_READONLY + } + return 0 + }()) + + if rc == SQLITE_OK { + next = Xsqlite3Get4byte(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pPage */)))).FaData) + } + } + + *(*Pgno)(unsafe.Pointer(pPgnoNext)) = next + if ppPage != 0 { + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp + 8 /* pPage */)) + } else { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPage */))) + } + return func() int32 { + if rc == SQLITE_DONE { + return SQLITE_OK + } + return rc + }() +} + +// Copy data from a buffer to a page, or from a page to a buffer. +// +// pPayload is a pointer to data stored on database page pDbPage. +// If argument eOp is false, then nByte bytes of data are copied +// from pPayload to the buffer pointed at by pBuf. If eOp is true, +// then sqlite3PagerWrite() is called on pDbPage and nByte bytes +// of data are copied from the buffer pBuf to pPayload. +// +// SQLITE_OK is returned on success, otherwise an error code. +func copyPayload(tls *libc.TLS, pPayload uintptr, pBuf uintptr, nByte int32, eOp int32, pDbPage uintptr) int32 { /* sqlite3.c:70225:12: */ + if eOp != 0 { + // Copy data from buffer to page (a write operation) + var rc int32 = Xsqlite3PagerWrite(tls, pDbPage) + if rc != SQLITE_OK { + return rc + } + libc.Xmemcpy(tls, pPayload, pBuf, uint64(nByte)) + } else { + // Copy data from page to buffer (a read operation) + libc.Xmemcpy(tls, pBuf, pPayload, uint64(nByte)) + } + return SQLITE_OK +} + +// This function is used to read or overwrite payload information +// for the entry that the pCur cursor is pointing to. The eOp +// argument is interpreted as follows: +// +// 0: The operation is a read. Populate the overflow cache. +// 1: The operation is a write. Populate the overflow cache. +// +// A total of "amt" bytes are read or written beginning at "offset". +// Data is read to or from the buffer pBuf. +// +// The content being read or written might appear on the main page +// or be scattered out on multiple overflow pages. +// +// If the current cursor entry uses one or more overflow pages +// this function may allocate space for and lazily populate +// the overflow page-list cache array (BtCursor.aOverflow). +// Subsequent calls use this cache to make seeking to the supplied offset +// more efficient. +// +// Once an overflow page-list cache has been allocated, it must be +// invalidated if some other cursor writes to the same table, or if +// the cursor is moved to a different row. Additionally, in auto-vacuum +// mode, the following events may invalidate an overflow page-list cache. +// +// * An incremental vacuum, +// * A commit in auto_vacuum="full" mode, +// * Creating a table (may require moving an overflow page). +func accessPayload(tls *libc.TLS, pCur uintptr, offset U32, amt U32, pBuf uintptr, eOp int32) int32 { /* sqlite3.c:70275:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var aPayload uintptr + var rc int32 = SQLITE_OK + var iIdx int32 = 0 + var pPage uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpPage // Btree page of current entry + var pBt uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBt // Btree this cursor belongs to + + getCellInfo(tls, pCur) + aPayload = (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload + + if (Uptr((int64(aPayload) - int64((*MemPage)(unsafe.Pointer(pPage)).FaData)) / 1)) > (Uptr((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal))) { + // Trying to read or write past the end of the data is an error. The + // conditional above is really: + // &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] + // but is recast into its current form to avoid integer overflow problems + return Xsqlite3CorruptError(tls, 70308) + } + + // Check if data must be read/written to/from the btree page itself. + if offset < U32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { + var a int32 = int32(amt) + if (U32(a) + offset) > U32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) { + a = (int32(U32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) - offset)) + } + rc = copyPayload(tls, (aPayload + uintptr(offset)), pBuf, a, eOp, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) + offset = U32(0) + pBuf += uintptr(a) + amt = amt - (U32(a)) + } else { + offset = offset - (U32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) + } + + if (rc == SQLITE_OK) && (amt > U32(0)) { + var ovflSize U32 = ((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(4)) // Bytes content per ovfl page + // var nextPage Pgno at bp, 4 + + *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) = Xsqlite3Get4byte(tls, (aPayload + uintptr((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal))) + + // If the BtCursor.aOverflow[] has not been allocated, allocate it now. + // + // The aOverflow[] array is sized at one entry for each overflow page + // in the overflow chain. The page number of the first overflow page is + // stored in aOverflow[0], etc. A value of 0 in the aOverflow[] array + // means "not yet known" (the cache is lazily populated). + if (int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_ValidOvfl) == 0 { + var nOvfl int32 = (int32(((((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload - U32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) + ovflSize) - U32(1)) / ovflSize)) + if ((*BtCursor)(unsafe.Pointer(pCur)).FaOverflow == uintptr(0)) || + ((nOvfl * int32(unsafe.Sizeof(Pgno(0)))) > Xsqlite3MallocSize(tls, (*BtCursor)(unsafe.Pointer(pCur)).FaOverflow)) { + var aNew uintptr = Xsqlite3Realloc(tls, + (*BtCursor)(unsafe.Pointer(pCur)).FaOverflow, (uint64((uint64(nOvfl * 2)) * uint64(unsafe.Sizeof(Pgno(0)))))) + if aNew == uintptr(0) { + return SQLITE_NOMEM + } else { + (*BtCursor)(unsafe.Pointer(pCur)).FaOverflow = aNew + } + } + libc.Xmemset(tls, (*BtCursor)(unsafe.Pointer(pCur)).FaOverflow, 0, (uint64(nOvfl) * uint64(unsafe.Sizeof(Pgno(0))))) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_ValidOvfl)) + } else { + // If the overflow page-list cache has been allocated and the + // entry for the first required overflow page is valid, skip + // directly to it. + if *(*Pgno)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr((offset/ovflSize))*4)) != 0 { + iIdx = (int32(offset / ovflSize)) + *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) = *(*Pgno)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) + offset = (offset % ovflSize) + } + } + + for *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) != 0 { + // If required, populate the overflow page-list cache. + if *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) > (*BtShared)(unsafe.Pointer(pBt)).FnPage { + return Xsqlite3CorruptError(tls, 70370) + } + + *(*Pgno)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr(iIdx)*4)) = *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) + + if offset >= ovflSize { + // The only reason to read this page is to obtain the page + // number for the next page in the overflow chain. The page + // data is not required. So first try to lookup the overflow + // page-list cache, if any, then fall back to the getOverflowPage() + // function. + + if *(*Pgno)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr((iIdx+1))*4)) != 0 { + *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) = *(*Pgno)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FaOverflow + uintptr((iIdx+1))*4)) + } else { + rc = getOverflowPage(tls, pBt, *(*Pgno)(unsafe.Pointer(bp /* nextPage */)), uintptr(0), bp /* &nextPage */) + } + offset = offset - (ovflSize) + } else { + // Need to read this page properly. It contains some of the + // range of data that is being read (eOp==0) or written (eOp!=0). + var a int32 = int32(amt) + if (U32(a) + offset) > ovflSize { + a = (int32(ovflSize - offset)) + } + + { + // var pDbPage uintptr at bp+8, 8 + + rc = Xsqlite3PagerGet(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, *(*Pgno)(unsafe.Pointer(bp /* nextPage */)), bp+8, /* &pDbPage */ + func() int32 { + if eOp == 0 { + return PAGER_GET_READONLY + } + return 0 + }()) + if rc == SQLITE_OK { + aPayload = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pDbPage */))) + *(*Pgno)(unsafe.Pointer(bp /* nextPage */)) = Xsqlite3Get4byte(tls, aPayload) + rc = copyPayload(tls, (aPayload + uintptr((offset + U32(4)))), pBuf, a, eOp, *(*uintptr)(unsafe.Pointer(bp + 8 /* pDbPage */))) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pDbPage */))) + offset = U32(0) + } + + } + amt = amt - (U32(a)) + if amt == U32(0) { + return rc + } + pBuf += uintptr(a) + } + if rc != 0 { + break + } + iIdx++ + } + } + + if (rc == SQLITE_OK) && (amt > U32(0)) { + // Overflow chain ends prematurely + return Xsqlite3CorruptError(tls, 70455) + } + return rc +} + +// Read part of the payload for the row at which that cursor pCur is currently +// pointing. "amt" bytes will be transferred into pBuf[]. The transfer +// begins at "offset". +// +// pCur can be pointing to either a table or an index b-tree. +// If pointing to a table btree, then the content section is read. If +// pCur is pointing to an index b-tree then the key section is read. +// +// For sqlite3BtreePayload(), the caller must ensure that pCur is pointing +// to a valid row in the table. For sqlite3BtreePayloadChecked(), the +// cursor might be invalid or might need to be restored before being read. +// +// Return SQLITE_OK on success or an error code if anything goes +// wrong. An error is returned if "offset+amt" is larger than +// the available payload. +func Xsqlite3BtreePayload(tls *libc.TLS, pCur uintptr, offset U32, amt U32, pBuf uintptr) int32 { /* sqlite3.c:70477:20: */ + + return accessPayload(tls, pCur, offset, amt, pBuf, 0) +} + +// This variant of sqlite3BtreePayload() works even if the cursor has not +// in the CURSOR_VALID state. It is only used by the sqlite3_blob_read() +// interface. +func accessPayloadChecked(tls *libc.TLS, pCur uintptr, offset U32, amt U32, pBuf uintptr) int32 { /* sqlite3.c:70491:28: */ + var rc int32 + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_INVALID { + return SQLITE_ABORT + } + + rc = btreeRestoreCursorPosition(tls, pCur) + if rc != 0 { + return rc + } + return accessPayload(tls, pCur, offset, amt, pBuf, 0) +} + +func Xsqlite3BtreePayloadChecked(tls *libc.TLS, pCur uintptr, offset U32, amt U32, pBuf uintptr) int32 { /* sqlite3.c:70505:20: */ + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID { + + return accessPayload(tls, pCur, offset, amt, pBuf, 0) + } else { + return accessPayloadChecked(tls, pCur, offset, amt, pBuf) + } + return int32(0) +} + +// Return a pointer to payload information from the entry that the +// pCur cursor is pointing to. The pointer is to the beginning of +// the key if index btrees (pPage->intKey==0) and is the data for +// table btrees (pPage->intKey==1). The number of bytes of available +// key/data is written into *pAmt. If *pAmt==0, then the value +// returned will not be a valid pointer. +// +// This routine is an optimization. It is common for the entire key +// and data to fit on the local page and for there to be no overflow +// pages. When that is so, this routine can be used to access the +// key and data without making a copy. If the key and/or data spills +// onto overflow pages, then accessPayload() must be used to reassemble +// the key/data and copy it into a preallocated buffer. +// +// The pointer returned by this routine looks directly into the cached +// page of the database. The data might change or move the next time +// any btree routine is called. +func fetchPayload(tls *libc.TLS, pCur uintptr, pAmt uintptr) uintptr { /* sqlite3.c:70534:19: */ + var amt int32 + + amt = int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) + if amt > (int32((int64((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd) - int64((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) / 1)) { + // There is too little space on the page for the expected amount + // of local content. Database must be corrupt. + + amt = func() int32 { + if (0) > (int32((int64((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd) - int64((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) / 1)) { + return 0 + } + return (int32((int64((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FaDataEnd) - int64((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload)) / 1)) + }() + } + *(*U32)(unsafe.Pointer(pAmt)) = U32(amt) + return (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload +} + +// For the entry that cursor pCur is point to, return as +// many bytes of the key or data as are available on the local +// b-tree page. Write the number of available bytes into *pAmt. +// +// The pointer returned is ephemeral. The key/data may move +// or be destroyed on the next call to any Btree routine, +// including calls from other threads against the same cache. +// Hence, a mutex on the BtShared should be held prior to calling +// this routine. +// +// These routines is used to get quick access to key and data +// in the common case where no overflow pages are used. +func Xsqlite3BtreePayloadFetch(tls *libc.TLS, pCur uintptr, pAmt uintptr) uintptr { /* sqlite3.c:70573:27: */ + return fetchPayload(tls, pCur, pAmt) +} + +// Move the cursor down to a new child page. The newPgno argument is the +// page number of the child page to move to. +// +// This function returns SQLITE_CORRUPT if the page-header flags field of +// the new child page does not match the flags field of the parent (i.e. +// if an intkey page appears to be the parent of a non-intkey page, or +// vice-versa). +func moveToChild(tls *libc.TLS, pCur uintptr, newPgno U32) int32 { /* sqlite3.c:70587:12: */ + var pBt uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBt + + if int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) >= (BTCURSOR_MAX_DEPTH - 1) { + return Xsqlite3CorruptError(tls, 70595) + } + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32((BTCF_ValidNKey | BTCF_ValidOvfl)))) + *(*U16)(unsafe.Pointer((pCur + 88 /* &.aiIdx */) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FiPage)*2)) = (*BtCursor)(unsafe.Pointer(pCur)).Fix + *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(0) + (*BtCursor)(unsafe.Pointer(pCur)).FiPage++ + return getAndInitPage(tls, pBt, newPgno, (pCur + 136 /* &.pPage */), pCur, int32((*BtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) +} + +// Move the cursor up to the parent page. +// +// pCur->idx is set to the cell index that contains the pointer +// to the page we are coming from. If we are coming from the +// right-most child page then pCur->idx is set to one more than +// the largest cell index. +func moveToParent(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:70636:13: */ + var pLeaf uintptr + + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32((BTCF_ValidNKey | BTCF_ValidOvfl)))) + (*BtCursor)(unsafe.Pointer(pCur)).Fix = *(*U16)(unsafe.Pointer((pCur + 88 /* &.aiIdx */) + uintptr((int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage)-1))*2)) + pLeaf = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + (*BtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr(libc.PreDecInt8(&(*BtCursor)(unsafe.Pointer(pCur)).FiPage, 1))*8)) + releasePageNotNull(tls, pLeaf) +} + +// Move the cursor to point to the root page of its b-tree structure. +// +// If the table has a virtual root page, then the cursor is moved to point +// to the virtual root page instead of the actual root page. A table has a +// virtual root page when the actual root page contains no cells and a +// single child page. This can only happen with the table rooted at page 1. +// +// If the b-tree structure is empty, the cursor state is set to +// CURSOR_INVALID and this routine returns SQLITE_EMPTY. Otherwise, +// the cursor is set to point to the first cell located on the root +// (or virtual root) page and the cursor state is set to CURSOR_VALID. +// +// If this function returns successfully, it may be assumed that the +// page-header flags indicate that the [virtual] root-page is the expected +// kind of b-tree page (i.e. if when opening the cursor the caller did not +// specify a KeyInfo structure the flags byte is set to 0x05 or 0x0D, +// indicating a table b-tree, or if the caller did specify a KeyInfo +// structure the flags byte is set to 0x02 or 0x0A, indicating an index +// b-tree). +func moveToRoot(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:70677:12: */ + var pRoot uintptr + var rc int32 + var subpage Pgno + rc = SQLITE_OK + + if !(int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) >= 0) { + goto __1 + } + if !((*BtCursor)(unsafe.Pointer(pCur)).FiPage != 0) { + goto __3 + } + releasePageNotNull(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpPage) +__4: + if !(libc.PreDecInt8(&(*BtCursor)(unsafe.Pointer(pCur)).FiPage, 1) != 0) { + goto __5 + } + releasePageNotNull(tls, *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FiPage)*8))) + goto __4 +__5: + ; + (*BtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */))) + goto skip_init +__3: + ; + goto __2 +__1: + if !((*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot == Pgno(0)) { + goto __6 + } + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + return SQLITE_EMPTY + goto __7 +__6: + ; + if !(int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) >= CURSOR_REQUIRESEEK) { + goto __8 + } + if !(int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_FAULT) { + goto __9 + } + + return (*BtCursor)(unsafe.Pointer(pCur)).FskipNext +__9: + ; + Xsqlite3BtreeClearCursor(tls, pCur) +__8: + ; + rc = getAndInitPage(tls, (*Btree)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBtree)).FpBt, (*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, (pCur + 136 /* &.pPage */), + uintptr(0), int32((*BtCursor)(unsafe.Pointer(pCur)).FcurPagerFlags)) + if !(rc != SQLITE_OK) { + goto __10 + } + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + return rc +__10: + ; + (*BtCursor)(unsafe.Pointer(pCur)).FiPage = int8(0) + (*BtCursor)(unsafe.Pointer(pCur)).FcurIntKey = (*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FintKey +__7: + ; +__2: + ; + pRoot = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + + // If pCur->pKeyInfo is not NULL, then the caller that opened this cursor + // expected to open it on an index b-tree. Otherwise, if pKeyInfo is + // NULL, the caller expects a table b-tree. If this is not the case, + // return an SQLITE_CORRUPT error. + // + // Earlier versions of SQLite assumed that this test could not fail + // if the root page was already loaded when this function was called (i.e. + // if pCur->iPage>=0). But this is not so if the database is corrupted + // in such a way that page pRoot is linked into a second b-tree table + // (or the freelist). + + if !((int32((*MemPage)(unsafe.Pointer(pRoot)).FisInit) == 0) || ((libc.Bool32((*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0))) != int32((*MemPage)(unsafe.Pointer(pRoot)).FintKey))) { + goto __11 + } + return Xsqlite3CorruptError(tls, 70733) +__11: + ; + +skip_init: + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(0) + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(((BTCF_AtLast | BTCF_ValidNKey) | BTCF_ValidOvfl)))) + + pRoot = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + if !(int32((*MemPage)(unsafe.Pointer(pRoot)).FnCell) > 0) { + goto __12 + } + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_VALID) + goto __13 +__12: + if !(!(int32((*MemPage)(unsafe.Pointer(pRoot)).Fleaf) != 0)) { + goto __14 + } + if !((*MemPage)(unsafe.Pointer(pRoot)).Fpgno != Pgno(1)) { + goto __16 + } + return Xsqlite3CorruptError(tls, 70746) +__16: + ; + subpage = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pRoot)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pRoot)).FhdrOffset) + 8)))) + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_VALID) + rc = moveToChild(tls, pCur, subpage) + goto __15 +__14: + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + rc = SQLITE_EMPTY +__15: + ; +__13: + ; + return rc +} + +// Move the cursor down to the left-most leaf entry beneath the +// entry to which it is currently pointing. +// +// The left-most leaf is the one with the smallest key - the first +// in ascending order. +func moveToLeftmost(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:70764:12: */ + var pgno Pgno + var rc int32 = SQLITE_OK + var pPage uintptr + + for (rc == SQLITE_OK) && !(int32((*MemPage)(unsafe.Pointer(libc.AssignUintptr(&pPage, (*BtCursor)(unsafe.Pointer(pCur)).FpPage))).Fleaf) != 0) { + + pgno = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (int32((*BtCursor)(unsafe.Pointer(pCur)).Fix))))))))))))) + rc = moveToChild(tls, pCur, pgno) + } + return rc +} + +// Move the cursor down to the right-most leaf entry beneath the +// page to which it is currently pointing. Notice the difference +// between moveToLeftmost() and moveToRightmost(). moveToLeftmost() +// finds the left-most entry beneath the *entry* whereas moveToRightmost() +// finds the right-most entry beneath the *page*. +// +// The right-most entry is the one with the largest key - the last +// key in ascending order. +func moveToRightmost(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:70789:12: */ + var pgno Pgno + var rc int32 = SQLITE_OK + var pPage uintptr = uintptr(0) + + for !(int32((*MemPage)(unsafe.Pointer(libc.AssignUintptr(&pPage, (*BtCursor)(unsafe.Pointer(pCur)).FpPage))).Fleaf) != 0) { + pgno = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 8)))) + (*BtCursor)(unsafe.Pointer(pCur)).Fix = (*MemPage)(unsafe.Pointer(pPage)).FnCell + rc = moveToChild(tls, pCur, pgno) + if rc != 0 { + return rc + } + } + (*BtCursor)(unsafe.Pointer(pCur)).Fix = (U16(int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) - 1)) + + return SQLITE_OK +} + +// Move the cursor to the first entry in the table. Return SQLITE_OK +// on success. Set *pRes to 0 if the cursor actually points to something +// or set *pRes to 1 if the table is empty. +func Xsqlite3BtreeFirst(tls *libc.TLS, pCur uintptr, pRes uintptr) int32 { /* sqlite3.c:70812:20: */ + var rc int32 + + rc = moveToRoot(tls, pCur) + if rc == SQLITE_OK { + + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = moveToLeftmost(tls, pCur) + } else if rc == SQLITE_EMPTY { + + *(*int32)(unsafe.Pointer(pRes)) = 1 + rc = SQLITE_OK + } + return rc +} + +// Move the cursor to the last entry in the table. Return SQLITE_OK +// on success. Set *pRes to 0 if the cursor actually points to something +// or set *pRes to 1 if the table is empty. +func Xsqlite3BtreeLast(tls *libc.TLS, pCur uintptr, pRes uintptr) int32 { /* sqlite3.c:70834:20: */ + var rc int32 + + // If the cursor already points to the last entry, this is a no-op. + if (CURSOR_VALID == int32((*BtCursor)(unsafe.Pointer(pCur)).FeState)) && ((int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_AtLast) != 0) { + *(*int32)(unsafe.Pointer(pRes)) = 0 + return SQLITE_OK + } + + rc = moveToRoot(tls, pCur) + if rc == SQLITE_OK { + + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = moveToRightmost(tls, pCur) + if rc == SQLITE_OK { + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_AtLast)) + } else { + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_AtLast))) + } + } else if rc == SQLITE_EMPTY { + + *(*int32)(unsafe.Pointer(pRes)) = 1 + rc = SQLITE_OK + } + return rc +} + +// Move the cursor so that it points to an entry near the key +// specified by pIdxKey or intKey. Return a success code. +// +// For INTKEY tables, the intKey parameter is used. pIdxKey +// must be NULL. For index tables, pIdxKey is used and intKey +// is ignored. +// +// If an exact match is not found, then the cursor is always +// left pointing at a leaf page which would hold the entry if it +// were present. The cursor might point to an entry that comes +// before or after the key. +// +// An integer is written into *pRes which is the result of +// comparing the key with the entry to which the cursor is +// pointing. The meaning of the integer written into +// *pRes is as follows: +// +// *pRes<0 The cursor is left pointing at an entry that +// is smaller than intKey/pIdxKey or if the table is empty +// and the cursor is therefore left point to nothing. +// +// *pRes==0 The cursor is left pointing at an entry that +// exactly matches intKey/pIdxKey. +// +// *pRes>0 The cursor is left pointing at an entry that +// is larger than intKey/pIdxKey. +// +// For index tables, the pIdxKey->eqSeen field is set to 1 if there +// exists an entry in the table that exactly matches pIdxKey. +func Xsqlite3BtreeMovetoUnpacked(tls *libc.TLS, pCur uintptr, pIdxKey uintptr, intKey I64, biasRight int32, pRes uintptr) int32 { /* sqlite3.c:70906:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + var xRecordCompare RecordCompare + // var nCellKey I64 at bp, 8 + + // The record flows over onto one or more overflow pages. In + // this case the whole cell needs to be parsed, a buffer allocated + // and accessPayload() used to retrieve the record into the + // buffer before VdbeRecordCompare() can be called. + // + // If the record is corrupt, the xRecordCompare routine may read + // up to two varints past the end of the buffer. An extra 18 + // bytes of padding is allocated at the end of the buffer in + // case this happens. + var pCellKey uintptr + var pCellBody uintptr + var nOverrun int32 + var nCell int32 + var lwr int32 + var upr int32 + var idx int32 + var c int32 + var chldPg Pgno + var pPage uintptr + var pCell uintptr + + // If the cursor is already positioned at the point we are trying + // to move to, then just return without doing any work + if !(((pIdxKey == uintptr(0)) && + (int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_VALID)) && ((int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_ValidNKey) != 0)) { + goto __1 + } + if !((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey == intKey) { + goto __2 + } + *(*int32)(unsafe.Pointer(pRes)) = 0 + return SQLITE_OK +__2: + ; + if !((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey < intKey) { + goto __3 + } + if !((int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_AtLast) != 0) { + goto __4 + } + *(*int32)(unsafe.Pointer(pRes)) = -1 + return SQLITE_OK +__4: + ; + // If the requested key is one more than the previous key, then + // try to get there using sqlite3BtreeNext() rather than a full + // binary search. This is an optimization only. The correct answer + // is still obtained without this case, only a little more slowely + if !(((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey + int64(1)) == intKey) { + goto __5 + } + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = Xsqlite3BtreeNext(tls, pCur, 0) + if !(rc == SQLITE_OK) { + goto __6 + } + getCellInfo(tls, pCur) + if !((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey == intKey) { + goto __8 + } + return SQLITE_OK +__8: + ; + goto __7 +__6: + if !(rc == SQLITE_DONE) { + goto __9 + } + rc = SQLITE_OK + goto __10 +__9: + return rc +__10: + ; +__7: + ; +__5: + ; +__3: + ; +__1: + ; + + if !(pIdxKey != 0) { + goto __11 + } + xRecordCompare = Xsqlite3VdbeFindCompare(tls, pIdxKey) + (*UnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode = U8(0) + + goto __12 +__11: + xRecordCompare = uintptr(0) // All keys are integers +__12: + ; + + rc = moveToRoot(tls, pCur) + if !(rc != 0) { + goto __13 + } + if !(rc == SQLITE_EMPTY) { + goto __14 + } + + *(*int32)(unsafe.Pointer(pRes)) = -1 + return SQLITE_OK +__14: + ; + return rc +__13: + ; + +__15: + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage // Pointer to current cell in pPage + + // pPage->nCell must be greater than zero. If this is the root-page + // the cursor would have been INVALID above and this for(;;) loop + // not run. If this is not the root-page, then the moveToChild() routine + // would have already detected db corruption. Similarly, pPage must + // be the right kind (index or table) of b-tree page. Otherwise + // a moveToChild() or moveToRoot() call would have detected corruption. + + lwr = 0 + upr = (int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) - 1) + + idx = (upr >> (1 - biasRight)) // idx = biasRight ? upr : (lwr+upr)/2; + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(idx) + if !(xRecordCompare == uintptr(0)) { + goto __18 + } +__20: + pCell = ((*MemPage)(unsafe.Pointer((pPage))).FaDataOfst + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (idx))))))))))) + if !((*MemPage)(unsafe.Pointer(pPage)).FintKeyLeaf != 0) { + goto __23 + } +__24: + if !(0x80 <= int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCell, 1))))) { + goto __25 + } + if !(pCell >= (*MemPage)(unsafe.Pointer(pPage)).FaDataEnd) { + goto __26 + } + return Xsqlite3CorruptError(tls, 71013) +__26: + ; + goto __24 +__25: + ; +__23: + ; + Xsqlite3GetVarint(tls, pCell, bp /* &nCellKey */) + if !(*(*I64)(unsafe.Pointer(bp /* nCellKey */)) < intKey) { + goto __27 + } + lwr = (idx + 1) + if !(lwr > upr) { + goto __29 + } + c = -1 + goto __22 +__29: + ; + goto __28 +__27: + if !(*(*I64)(unsafe.Pointer(bp /* nCellKey */)) > intKey) { + goto __30 + } + upr = (idx - 1) + if !(lwr > upr) { + goto __32 + } + c = +1 + goto __22 +__32: + ; + goto __31 +__30: + ; + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(idx) + if !(!(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0)) { + goto __33 + } + lwr = idx + goto moveto_next_layer + goto __34 +__33: + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_ValidNKey)) + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey = *(*I64)(unsafe.Pointer(bp /* nCellKey */)) + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + *(*int32)(unsafe.Pointer(pRes)) = 0 + return SQLITE_OK +__34: + ; +__31: + ; +__28: + ; + + idx = ((lwr + upr) >> 1) // idx = (lwr+upr)/2; + goto __21 +__21: + goto __20 + goto __22 +__22: + ; + goto __19 +__18: +__35: // Size of the pCell cell in bytes + pCell = ((*MemPage)(unsafe.Pointer((pPage))).FaDataOfst + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (idx))))))))))) + + // The maximum supported page-size is 65536 bytes. This means that + // the maximum number of record bytes stored on an index B-Tree + // page is less than 16384 bytes and may be stored as a 2-byte + // varint. This information is used to attempt to avoid parsing + // the entire cell by checking for the cases where the record is + // stored entirely within the b-tree page by inspecting the first + // 2 bytes of the cell. + nCell = int32(*(*U8)(unsafe.Pointer(pCell))) + if !(nCell <= int32((*MemPage)(unsafe.Pointer(pPage)).Fmax1bytePayload)) { + goto __38 + } + // This branch runs if the record-size field of the cell is a + // single byte varint and the record fits entirely on the main + // b-tree page. + + c = (*(*func(*libc.TLS, int32, uintptr, uintptr) int32)(unsafe.Pointer(&xRecordCompare)))(tls, nCell, (pCell + 1), pIdxKey) + goto __39 +__38: + if !(!((int32(*(*U8)(unsafe.Pointer(pCell + 1))) & 0x80) != 0) && + ((libc.AssignInt32(&nCell, (((nCell & 0x7f) << 7) + int32(*(*U8)(unsafe.Pointer(pCell + 1)))))) <= int32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal))) { + goto __40 + } + // The record-size field is a 2 byte varint and the record + // fits entirely on the main b-tree page. + + c = (*(*func(*libc.TLS, int32, uintptr, uintptr) int32)(unsafe.Pointer(&xRecordCompare)))(tls, nCell, (pCell + 2), pIdxKey) + goto __41 +__40: + pCellBody = (pCell - uintptr((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) + nOverrun = 18 // Size of the overrun padding + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, pCellBody, (pCur + 48 /* &.info */)) + nCell = int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey) + // True if key size is 2^32 or more + // Invalid key size: 0x80 0x80 0x00 + // Invalid key size: 0x80 0x80 0x01 + // Minimum legal index key size + if !((nCell < 2) || ((U32(nCell) / (*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize) > (*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FnPage)) { + goto __42 + } + rc = Xsqlite3CorruptError(tls, 71088) + goto moveto_finish +__42: + ; + pCellKey = Xsqlite3Malloc(tls, (uint64(nCell + nOverrun))) + if !(pCellKey == uintptr(0)) { + goto __43 + } + rc = SQLITE_NOMEM + goto moveto_finish +__43: + ; + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(idx) + rc = accessPayload(tls, pCur, uint32(0), uint32(nCell), pCellKey, 0) + libc.Xmemset(tls, ((pCellKey) + uintptr(nCell)), 0, uint64(nOverrun)) // Fix uninit warnings + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_ValidOvfl))) + if !(rc != 0) { + goto __44 + } + Xsqlite3_free(tls, pCellKey) + goto moveto_finish +__44: + ; + c = Xsqlite3VdbeRecordCompare(tls, nCell, pCellKey, pIdxKey) + Xsqlite3_free(tls, pCellKey) +__41: + ; +__39: + ; + + if !(c < 0) { + goto __45 + } + lwr = (idx + 1) + goto __46 +__45: + if !(c > 0) { + goto __47 + } + upr = (idx - 1) + goto __48 +__47: + ; + *(*int32)(unsafe.Pointer(pRes)) = 0 + rc = SQLITE_OK + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(idx) + if !((*UnpackedRecord)(unsafe.Pointer(pIdxKey)).FerrCode != 0) { + goto __49 + } + rc = Xsqlite3CorruptError(tls, 71120) +__49: + ; + goto moveto_finish +__48: + ; +__46: + ; + if !(lwr > upr) { + goto __50 + } + goto __37 +__50: + ; + + idx = ((lwr + upr) >> 1) // idx = (lwr+upr)/2 + goto __36 +__36: + goto __35 + goto __37 +__37: + ; +__19: + ; + + if !((*MemPage)(unsafe.Pointer(pPage)).Fleaf != 0) { + goto __51 + } + + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(idx) + *(*int32)(unsafe.Pointer(pRes)) = c + rc = SQLITE_OK + goto moveto_finish +__51: + ; +moveto_next_layer: + if !(lwr >= int32((*MemPage)(unsafe.Pointer(pPage)).FnCell)) { + goto __52 + } + chldPg = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 8)))) + goto __53 +__52: + chldPg = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (lwr)))))))))))) +__53: + ; + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(lwr) + rc = moveToChild(tls, pCur, chldPg) + if !(rc != 0) { + goto __54 + } + goto __17 +__54: + ; + goto __16 +__16: + goto __15 + goto __17 +__17: + ; +moveto_finish: + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + + return rc +} + +// Return TRUE if the cursor is not pointing at an entry of the table. +// +// TRUE will be returned after a call to sqlite3BtreeNext() moves +// past the last entry in the table or sqlite3BtreePrev() moves past +// the first entry. TRUE is also returned if the table is empty. +func Xsqlite3BtreeEof(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:71161:20: */ + // TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries + // have been deleted? This API will need to change to return an error code + // as well as the boolean result value. + return (libc.Bool32(CURSOR_VALID != int32((*BtCursor)(unsafe.Pointer(pCur)).FeState))) +} + +// Return an estimate for the number of rows in the table that pCur is +// pointing to. Return a negative number if no estimate is currently +// available. +func Xsqlite3BtreeRowCountEst(tls *libc.TLS, pCur uintptr) I64 { /* sqlite3.c:71174:20: */ + var n I64 + var i U8 + + // Currently this interface is only called by the OP_IfSmaller + // opcode, and it that case the cursor will always be valid and + // will always point to a leaf node. + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + return int64(-1) + } + if int32((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).Fleaf) == 0 { + return int64(-1) + } + + n = I64((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell) + for i = U8(0); int32(i) < int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage); i++ { + n = n * (I64((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr(i)*8)))).FnCell)) + } + return n +} + +// Advance the cursor to the next entry in the database. +// Return value: +// +// SQLITE_OK success +// SQLITE_DONE cursor is already pointing at the last element +// otherwise some kind of error occurred +// +// The main entry point is sqlite3BtreeNext(). That routine is optimized +// for the common case of merely incrementing the cell counter BtCursor.aiIdx +// to the next cell on the current page. The (slower) btreeNext() helper +// routine is called when it is necessary to move to a different page or +// to restore the cursor. +// +// If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the +// cursor corresponds to an SQL index and this routine could have been +// skipped if the SQL index had been a unique index. The F argument +// is a hint to the implement. SQLite btree implementation does not use +// this hint, but COMDB2 does. +func btreeNext(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:71214:28: */ + var rc int32 + var idx int32 + var pPage uintptr + + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + + rc = func() int32 { + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) >= CURSOR_REQUIRESEEK { + return btreeRestoreCursorPosition(tls, pCur) + } + return SQLITE_OK + }() + if rc != SQLITE_OK { + return rc + } + if CURSOR_INVALID == int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) { + return SQLITE_DONE + } + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_SKIPNEXT { + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_VALID) + if (*BtCursor)(unsafe.Pointer(pCur)).FskipNext > 0 { + return SQLITE_OK + } + } + } + + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + idx = int32(libc.PreIncUint16(&(*BtCursor)(unsafe.Pointer(pCur)).Fix, 1)) + if !(int32((*MemPage)(unsafe.Pointer(pPage)).FisInit) != 0) || (Xsqlite3FaultSim(tls, 412) != 0) { + // The only known way for this to happen is for there to be a + // recursive SQL function that does a DELETE operation as part of a + // SELECT which deletes content out from under an active cursor + // in a corrupt database file where the table being DELETE-ed from + // has pages in common with the table being queried. See TH3 + // module cov1/btree78.test testcase 220 (2018-06-08) for an + // example. + return Xsqlite3CorruptError(tls, 71245) + } + + // If the database file is corrupt, it is possible for the value of idx + // to be invalid here. This can only occur if a second cursor modifies + // the page while cursor pCur is holding a reference to it. Which can + // only happen if the database is corrupt in such a way as to link the + // page into more than one b-tree structure. + // + // Update 2019-12-23: appears to long longer be possible after the + // addition of anotherValidCursor() condition on balance_deeper(). + + if idx >= int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) { + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + rc = moveToChild(tls, pCur, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData+uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset)+8))))) + if rc != 0 { + return rc + } + return moveToLeftmost(tls, pCur) + } + for ok := true; ok; ok = (int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*MemPage)(unsafe.Pointer(pPage)).FnCell)) { + if int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) == 0 { + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + return SQLITE_DONE + } + moveToParent(tls, pCur) + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + } + if (*MemPage)(unsafe.Pointer(pPage)).FintKey != 0 { + return Xsqlite3BtreeNext(tls, pCur, 0) + } else { + return SQLITE_OK + } + } + if (*MemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + return SQLITE_OK + } else { + return moveToLeftmost(tls, pCur) + } + return int32(0) +} + +func Xsqlite3BtreeNext(tls *libc.TLS, pCur uintptr, flags int32) int32 { /* sqlite3.c:71284:20: */ + var pPage uintptr + _ = flags // Used in COMDB2 but not native SQLite + + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32((BTCF_ValidNKey | BTCF_ValidOvfl)))) + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + return btreeNext(tls, pCur) + } + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + if (int32(libc.PreIncUint16(&(*BtCursor)(unsafe.Pointer(pCur)).Fix, 1))) >= int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) { + (*BtCursor)(unsafe.Pointer(pCur)).Fix-- + return btreeNext(tls, pCur) + } + if (*MemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + return SQLITE_OK + } else { + return moveToLeftmost(tls, pCur) + } + return int32(0) +} + +// Step the cursor to the back to the previous entry in the database. +// Return values: +// +// SQLITE_OK success +// SQLITE_DONE the cursor is already on the first element of the table +// otherwise some kind of error occurred +// +// The main entry point is sqlite3BtreePrevious(). That routine is optimized +// for the common case of merely decrementing the cell counter BtCursor.aiIdx +// to the previous cell on the current page. The (slower) btreePrevious() +// helper routine is called when it is necessary to move to a different page +// or to restore the cursor. +// +// If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then +// the cursor corresponds to an SQL index and this routine could have been +// skipped if the SQL index had been a unique index. The F argument is a +// hint to the implement. The native SQLite btree implementation does not +// use this hint, but COMDB2 does. +func btreePrevious(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:71324:28: */ + var rc int32 + var pPage uintptr + + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID { + rc = func() int32 { + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) >= CURSOR_REQUIRESEEK { + return btreeRestoreCursorPosition(tls, pCur) + } + return SQLITE_OK + }() + if rc != SQLITE_OK { + return rc + } + if CURSOR_INVALID == int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) { + return SQLITE_DONE + } + if CURSOR_SKIPNEXT == int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) { + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_VALID) + if (*BtCursor)(unsafe.Pointer(pCur)).FskipNext < 0 { + return SQLITE_OK + } + } + } + + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + var idx int32 = int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) + rc = moveToChild(tls, pCur, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((pPage))).FaData+uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (idx))))))))))))) + if rc != 0 { + return rc + } + rc = moveToRightmost(tls, pCur) + } else { + for int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) == 0 { + if int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) == 0 { + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + return SQLITE_DONE + } + moveToParent(tls, pCur) + } + + (*BtCursor)(unsafe.Pointer(pCur)).Fix-- + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + if ((*MemPage)(unsafe.Pointer(pPage)).FintKey != 0) && !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + rc = Xsqlite3BtreePrevious(tls, pCur, 0) + } else { + rc = SQLITE_OK + } + } + return rc +} + +func Xsqlite3BtreePrevious(tls *libc.TLS, pCur uintptr, flags int32) int32 { /* sqlite3.c:71373:20: */ + + _ = flags // Used in COMDB2 but not native SQLite + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(((BTCF_AtLast | BTCF_ValidOvfl) | BTCF_ValidNKey)))) + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + if ((int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID) || + (int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) == 0)) || + (int32((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).Fleaf) == 0) { + return btreePrevious(tls, pCur) + } + (*BtCursor)(unsafe.Pointer(pCur)).Fix-- + return SQLITE_OK +} + +// Allocate a new page from the database file. +// +// The new page is marked as dirty. (In other words, sqlite3PagerWrite() +// has already been called on the new page.) The new page has also +// been referenced and the calling routine is responsible for calling +// sqlite3PagerUnref() on the new page when it is done. +// +// SQLITE_OK is returned on success. Any other return value indicates +// an error. *ppPage is set to NULL in the event of an error. +// +// If the "nearby" parameter is not 0, then an effort is made to +// locate a page close to the page number "nearby". This can be used in an +// attempt to keep related pages close to each other in the database file, +// which in turn can make database access faster. +// +// If the eMode parameter is BTALLOC_EXACT and the nearby page exists +// anywhere on the free-list, then it is guaranteed to be returned. If +// eMode is BTALLOC_LT then the page returned will be less than or equal +// to nearby if any such page exists. If eMode is BTALLOC_ANY then there +// are no restrictions on which page is returned. +func allocateBtreePage(tls *libc.TLS, pBt uintptr, ppPage uintptr, pPgno uintptr, nearby Pgno, eMode U8) int32 { /* sqlite3.c:71411:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pPage1 uintptr + var rc int32 + var n U32 // Number of pages on the freelist + var k U32 // Number of leaves on the trunk of the freelist + // var pTrunk uintptr at bp+8, 8 + + var pPrevTrunk uintptr + var mxPage Pgno + // var eType U8 at bp, 1 + + // The trunk page is required by the caller but it contains + // pointers to free-list leaves. The first leaf becomes a trunk + // page in this case. + // var pNewTrunk uintptr at bp+16, 8 + + var iNewTrunk Pgno + var d2 int32 + var dist int32 + var i U32 + var noContent int32 + // Extract a leaf from the trunk + var closest U32 + var iPage Pgno + var aData uintptr + // There are pages on the freelist. Reuse one of those pages. + var iTrunk Pgno + var searchList U8 // If the free-list must be searched for 'nearby' + var nSearch U32 + // If *pPgno refers to a pointer-map page, allocate two new pages + // at the end of the file instead of one. The first allocated page + // becomes a new pointer-map page, the second is used by the caller. + // var pPg uintptr at bp+24, 8 + + // There are no pages on the freelist, so append a new page to the + // database image. + // + // Normally, new pages allocated by this block can be requested from the + // pager layer with the 'no-content' flag set. This prevents the pager + // from trying to read the pages content from disk. However, if the + // current transaction has already run one or more incremental-vacuum + // steps, then the page we are about to allocate may contain content + // that is required in the event of a rollback. In this case, do + // not set the no-content flag. This causes the pager to load and journal + // the current page content before overwriting it. + // + // Note that the pager will not actually attempt to load or journal + // content for any page that really does lie past the end of the database + // file on disk. So the effects of disabling the no-content optimization + // here are confined to those pages that lie between the end of the + // database image and the end of the database file. + var bNoContent int32 + *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) = uintptr(0) + pPrevTrunk = uintptr(0) // Total size of the database file + + pPage1 = (*BtShared)(unsafe.Pointer(pBt)).FpPage1 + mxPage = btreePagecount(tls, pBt) + // EVIDENCE-OF: R-05119-02637 The 4-byte big-endian integer at offset 36 + // stores stores the total number of pages on the freelist. + n = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 36)) + + if !(n >= mxPage) { + goto __1 + } + return Xsqlite3CorruptError(tls, 71435) +__1: + ; + if !(n > U32(0)) { + goto __2 + } + searchList = U8(0) // If the free-list must be searched for 'nearby' + nSearch = U32(0) // Count of the number of search attempts + + // If eMode==BTALLOC_EXACT and a query of the pointer-map + // shows that the page 'nearby' is somewhere on the free-list, then + // the entire-list will be searched for that page. + if !(int32(eMode) == BTALLOC_EXACT) { + goto __4 + } + if !(nearby <= mxPage) { + goto __6 + } + + rc = ptrmapGet(tls, pBt, nearby, bp /* &eType */, uintptr(0)) + if !(rc != 0) { + goto __7 + } + return rc +__7: + ; + if !(int32(*(*U8)(unsafe.Pointer(bp /* eType */))) == PTRMAP_FREEPAGE) { + goto __8 + } + searchList = U8(1) +__8: + ; +__6: + ; + goto __5 +__4: + if !(int32(eMode) == BTALLOC_LE) { + goto __9 + } + searchList = U8(1) +__9: + ; +__5: + ; + + // Decrement the free-list count by 1. Set iTrunk to the index of the + // first free-list trunk page. iPrevTrunk is initially 1. + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage1)).FpDbPage) + if !(rc != 0) { + goto __10 + } + return rc +__10: + ; + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 36), (n - U32(1))) + + // The code within this loop is run only once if the 'searchList' variable + // is not true. Otherwise, it runs once for each trunk-page on the + // free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT) + // or until a page less than 'nearby' is located (eMode==BTALLOC_LT) +__11: + pPrevTrunk = *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) + if !(pPrevTrunk != 0) { + goto __14 + } + // EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page + // is the page number of the next freelist trunk page in the list or + // zero if this is the last freelist trunk page. + iTrunk = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPrevTrunk)).FaData)) + goto __15 +__14: + // EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32 + // stores the page number of the first page of the freelist, or zero if + // the freelist is empty. + iTrunk = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 32)) +__15: + ; + + if !((iTrunk > mxPage) || (libc.PostIncUint32(&nSearch, 1) > n)) { + goto __16 + } + rc = Xsqlite3CorruptError(tls, 71491) + goto __17 +__16: + rc = btreeGetUnusedPage(tls, pBt, iTrunk, bp+8 /* &pTrunk */, 0) +__17: + ; + if !(rc != 0) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) = uintptr(0) + goto end_allocate_page +__18: + ; + + // EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page + // is the number of leaf page pointers to follow. + k = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData + 4)) + if !((k == U32(0)) && !(searchList != 0)) { + goto __19 + } + // The trunk has no leaves and the list is not being searched. + // So extract the trunk page itself and use it as the newly + // allocated page + + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FpDbPage) + if !(rc != 0) { + goto __21 + } + goto end_allocate_page +__21: + ; + *(*Pgno)(unsafe.Pointer(pPgno)) = iTrunk + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 32), ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData), uint64(4)) + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) = uintptr(0) + + goto __20 +__19: + if !(k > (((*BtShared)(unsafe.Pointer(pBt)).FusableSize / U32(4)) - U32(2))) { + goto __22 + } + // Value of k is out of range. Database corruption + rc = Xsqlite3CorruptError(tls, 71520) + goto end_allocate_page + goto __23 +__22: + if !((searchList != 0) && + ((nearby == iTrunk) || ((iTrunk < nearby) && (int32(eMode) == BTALLOC_LE)))) { + goto __24 + } + // The list is being searched and this trunk page is the page + // to allocate, regardless of whether it has leaves. + *(*Pgno)(unsafe.Pointer(pPgno)) = iTrunk + *(*uintptr)(unsafe.Pointer(ppPage)) = *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) + searchList = U8(0) + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FpDbPage) + if !(rc != 0) { + goto __26 + } + goto end_allocate_page +__26: + ; + if !(k == U32(0)) { + goto __27 + } + if !(!(pPrevTrunk != 0)) { + goto __29 + } + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 32), ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData), uint64(4)) + goto __30 +__29: + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPrevTrunk)).FpDbPage) + if !(rc != SQLITE_OK) { + goto __31 + } + goto end_allocate_page +__31: + ; + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(pPrevTrunk)).FaData), ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData), uint64(4)) +__30: + ; + goto __28 +__27: + iNewTrunk = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData + 8)) + if !(iNewTrunk > mxPage) { + goto __32 + } + rc = Xsqlite3CorruptError(tls, 71554) + goto end_allocate_page +__32: + ; + + rc = btreeGetUnusedPage(tls, pBt, iNewTrunk, bp+16 /* &pNewTrunk */, 0) + if !(rc != SQLITE_OK) { + goto __33 + } + goto end_allocate_page +__33: + ; + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNewTrunk */)))).FpDbPage) + if !(rc != SQLITE_OK) { + goto __34 + } + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pNewTrunk */))) + goto end_allocate_page +__34: + ; + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNewTrunk */)))).FaData), ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData), uint64(4)) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNewTrunk */)))).FaData + 4), (k - U32(1))) + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNewTrunk */)))).FaData + 8), ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData + 12), (uint64((k - U32(1)) * U32(4)))) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pNewTrunk */))) + if !(!(pPrevTrunk != 0)) { + goto __35 + } + + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 32), iNewTrunk) + goto __36 +__35: + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPrevTrunk)).FpDbPage) + if !(rc != 0) { + goto __37 + } + goto end_allocate_page +__37: + ; + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPrevTrunk)).FaData), iNewTrunk) +__36: + ; +__28: + ; + *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)) = uintptr(0) + + goto __25 +__24: + if !(k > U32(0)) { + goto __38 + } + aData = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FaData + if !(nearby > Pgno(0)) { + goto __39 + } + closest = U32(0) + if !(int32(eMode) == BTALLOC_LE) { + goto __41 + } + i = U32(0) +__43: + if !(i < k) { + goto __45 + } + iPage = Xsqlite3Get4byte(tls, (aData + uintptr((U32(8) + (i * U32(4)))))) + if !(iPage <= nearby) { + goto __46 + } + closest = i + goto __45 +__46: + ; + goto __44 +__44: + i++ + goto __43 + goto __45 +__45: + ; + goto __42 +__41: + dist = Xsqlite3AbsInt32(tls, (int32(Xsqlite3Get4byte(tls, (aData+8)) - nearby))) + i = U32(1) +__47: + if !(i < k) { + goto __49 + } + d2 = Xsqlite3AbsInt32(tls, (int32(Xsqlite3Get4byte(tls, (aData+uintptr((U32(8)+(i*U32(4)))))) - nearby))) + if !(d2 < dist) { + goto __50 + } + closest = i + dist = d2 +__50: + ; + goto __48 +__48: + i++ + goto __47 + goto __49 +__49: + ; +__42: + ; + goto __40 +__39: + closest = U32(0) +__40: + ; + + iPage = Xsqlite3Get4byte(tls, (aData + uintptr((U32(8) + (closest * U32(4)))))) + + if !((iPage > mxPage) || (iPage < Pgno(2))) { + goto __51 + } + rc = Xsqlite3CorruptError(tls, 71619) + goto end_allocate_page +__51: + ; + + if !(!(searchList != 0) || + ((iPage == nearby) || ((iPage < nearby) && (int32(eMode) == BTALLOC_LE)))) { + goto __52 + } + *(*Pgno)(unsafe.Pointer(pPgno)) = iPage + + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */)))).FpDbPage) + if !(rc != 0) { + goto __53 + } + goto end_allocate_page +__53: + ; + if !(closest < (k - U32(1))) { + goto __54 + } + libc.Xmemcpy(tls, (aData + uintptr((U32(8) + (closest * U32(4))))), (aData + uintptr((U32(4) + (k * U32(4))))), uint64(4)) +__54: + ; + Xsqlite3Put4byte(tls, (aData + 4), (k - U32(1))) + if !(btreeGetHasContent(tls, pBt, *(*Pgno)(unsafe.Pointer(pPgno))) != 0) { + noContent = PAGER_GET_NOCONTENT + } else { + noContent = 0 + } + rc = btreeGetUnusedPage(tls, pBt, *(*Pgno)(unsafe.Pointer(pPgno)), ppPage, noContent) + if !(rc == SQLITE_OK) { + goto __55 + } + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) + if !(rc != SQLITE_OK) { + goto __56 + } + releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) +__56: + ; +__55: + ; + searchList = U8(0) +__52: + ; +__38: + ; +__25: + ; +__23: + ; +__20: + ; + releasePage(tls, pPrevTrunk) + pPrevTrunk = uintptr(0) + goto __12 +__12: + if searchList != 0 { + goto __11 + } + goto __13 +__13: + ; + goto __3 +__2: + // There are no pages on the freelist, so append a new page to the + // database image. + // + // Normally, new pages allocated by this block can be requested from the + // pager layer with the 'no-content' flag set. This prevents the pager + // from trying to read the pages content from disk. However, if the + // current transaction has already run one or more incremental-vacuum + // steps, then the page we are about to allocate may contain content + // that is required in the event of a rollback. In this case, do + // not set the no-content flag. This causes the pager to load and journal + // the current page content before overwriting it. + // + // Note that the pager will not actually attempt to load or journal + // content for any page that really does lie past the end of the database + // file on disk. So the effects of disabling the no-content optimization + // here are confined to those pages that lie between the end of the + // database image and the end of the database file. + if 0 == (int32((*BtShared)(unsafe.Pointer(pBt)).FbDoTruncate)) { + bNoContent = PAGER_GET_NOCONTENT + } else { + bNoContent = 0 + } + + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if !(rc != 0) { + goto __57 + } + return rc +__57: + ; + (*BtShared)(unsafe.Pointer(pBt)).FnPage++ + if !((*BtShared)(unsafe.Pointer(pBt)).FnPage == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + goto __58 + } + (*BtShared)(unsafe.Pointer(pBt)).FnPage++ +__58: + ; + + if !(((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && (ptrmapPageno(tls, pBt, (*BtShared)(unsafe.Pointer(pBt)).FnPage) == ((*BtShared)(unsafe.Pointer(pBt)).FnPage))) { + goto __59 + } + // If *pPgno refers to a pointer-map page, allocate two new pages + // at the end of the file instead of one. The first allocated page + // becomes a new pointer-map page, the second is used by the caller. + *(*uintptr)(unsafe.Pointer(bp + 24 /* pPg */)) = uintptr(0) + + rc = btreeGetUnusedPage(tls, pBt, (*BtShared)(unsafe.Pointer(pBt)).FnPage, bp+24 /* &pPg */, bNoContent) + if !(rc == SQLITE_OK) { + goto __60 + } + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pPg */)))).FpDbPage) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPg */))) +__60: + ; + if !(rc != 0) { + goto __61 + } + return rc +__61: + ; + (*BtShared)(unsafe.Pointer(pBt)).FnPage++ + if !((*BtShared)(unsafe.Pointer(pBt)).FnPage == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + goto __62 + } + (*BtShared)(unsafe.Pointer(pBt)).FnPage++ +__62: + ; +__59: + ; + Xsqlite3Put4byte(tls, (uintptr(28) + (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData), (*BtShared)(unsafe.Pointer(pBt)).FnPage) + *(*Pgno)(unsafe.Pointer(pPgno)) = (*BtShared)(unsafe.Pointer(pBt)).FnPage + + rc = btreeGetUnusedPage(tls, pBt, *(*Pgno)(unsafe.Pointer(pPgno)), ppPage, bNoContent) + if !(rc != 0) { + goto __63 + } + return rc +__63: + ; + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppPage)))).FpDbPage) + if !(rc != SQLITE_OK) { + goto __64 + } + releasePage(tls, *(*uintptr)(unsafe.Pointer(ppPage))) + *(*uintptr)(unsafe.Pointer(ppPage)) = uintptr(0) +__64: + ; + +__3: + ; + +end_allocate_page: + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTrunk */))) + releasePage(tls, pPrevTrunk) + + return rc +} + +// This function is used to add page iPage to the database file free-list. +// It is assumed that the page is not already a part of the free-list. +// +// The value passed as the second argument to this function is optional. +// If the caller happens to have a pointer to the MemPage object +// corresponding to page iPage handy, it may pass it as the second value. +// Otherwise, it may pass NULL. +// +// If a pointer to a MemPage object is passed as the second argument, +// its reference count is not altered by this function. +func freePage2(tls *libc.TLS, pBt uintptr, pMemPage uintptr, iPage Pgno) int32 { /* sqlite3.c:71733:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var pTrunk uintptr at bp+16, 8 + // Free-list trunk page + var iTrunk Pgno // Page number of free-list trunk page + var pPage1 uintptr // Local reference to page 1 + // var pPage uintptr at bp, 8 + // Page being freed. May be NULL. + // var rc int32 at bp+8, 4 + // Return Code + var nFree U32 + var nLeaf U32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pTrunk */)) = uintptr(0) + iTrunk = Pgno(0) + pPage1 = (*BtShared)(unsafe.Pointer(pBt)).FpPage1 // Initial number of pages on free-list + + if !((iPage < Pgno(2)) || (iPage > (*BtShared)(unsafe.Pointer(pBt)).FnPage)) { + goto __1 + } + return Xsqlite3CorruptError(tls, 71746) +__1: + ; + if !(pMemPage != 0) { + goto __2 + } + *(*uintptr)(unsafe.Pointer(bp /* pPage */)) = pMemPage + Xsqlite3PagerRef(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage) + goto __3 +__2: + *(*uintptr)(unsafe.Pointer(bp /* pPage */)) = btreePageLookup(tls, pBt, iPage) +__3: + ; + + // Increment the free page count on pPage1 + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage1)).FpDbPage) + if !(*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != 0) { + goto __4 + } + goto freepage_out +__4: + ; + nFree = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 36)) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 36), (nFree + U32(1))) + + if !((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_SECURE_DELETE) != 0) { + goto __5 + } + // If the secure_delete option is enabled, then + // always fully overwrite deleted information with zeros. + if !((!(*(*uintptr)(unsafe.Pointer(bp /* pPage */)) != 0) && ((libc.AssignPtrInt32(bp+8 /* rc */, btreeGetPage(tls, pBt, iPage, bp /* &pPage */, 0))) != 0)) || + ((libc.AssignPtrInt32(bp+8 /* rc */, Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage))) != 0)) { + goto __6 + } + goto freepage_out +__6: + ; + libc.Xmemset(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData, 0, uint64((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpBt)).FpageSize)) +__5: + ; + + // If the database supports auto-vacuum, write an entry in the pointer-map + // to indicate that the page is free. + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __7 + } + ptrmapPut(tls, pBt, iPage, uint8(PTRMAP_FREEPAGE), uint32(0), bp+8 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != 0) { + goto __8 + } + goto freepage_out +__8: + ; +__7: + ; + + // Now manipulate the actual database free-list structure. There are two + // possibilities. If the free-list is currently empty, or if the first + // trunk page in the free-list is full, then this page will become a + // new free-list trunk page. Otherwise, it will become a leaf of the + // first trunk page in the current free-list. This block tests if it + // is possible to add the page as a new free-list leaf. + if !(nFree != U32(0)) { + goto __9 + } // Initial number of leaf cells on trunk page + + iTrunk = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 32)) + if !(iTrunk > btreePagecount(tls, pBt)) { + goto __10 + } + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = Xsqlite3CorruptError(tls, 71793) + goto freepage_out +__10: + ; + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = btreeGetPage(tls, pBt, iTrunk, bp+16 /* &pTrunk */, 0) + if !(*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK) { + goto __11 + } + goto freepage_out +__11: + ; + + nLeaf = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTrunk */)))).FaData + 4)) + + if !(nLeaf > (((*BtShared)(unsafe.Pointer(pBt)).FusableSize / U32(4)) - U32(2))) { + goto __12 + } + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = Xsqlite3CorruptError(tls, 71804) + goto freepage_out +__12: + ; + if !(nLeaf < (((*BtShared)(unsafe.Pointer(pBt)).FusableSize / U32(4)) - U32(8))) { + goto __13 + } + // In this case there is room on the trunk page to insert the page + // being freed as a new leaf. + // + // Note that the trunk page is not really full until it contains + // usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have + // coded. But due to a coding error in versions of SQLite prior to + // 3.6.0, databases with freelist trunk pages holding more than + // usableSize/4 - 8 entries will be reported as corrupt. In order + // to maintain backwards compatibility with older versions of SQLite, + // we will continue to restrict the number of entries to usableSize/4 - 8 + // for now. At some point in the future (once everyone has upgraded + // to 3.6.0 or later) we should consider fixing the conditional above + // to read "usableSize/4-2" instead of "usableSize/4-8". + // + // EVIDENCE-OF: R-19920-11576 However, newer versions of SQLite still + // avoid using the last six entries in the freelist trunk page array in + // order that database files created by newer versions of SQLite can be + // read by older versions of SQLite. + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTrunk */)))).FpDbPage) + if !(*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) { + goto __14 + } + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTrunk */)))).FaData + 4), (nLeaf + U32(1))) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTrunk */)))).FaData + uintptr((U32(8) + (nLeaf * U32(4))))), iPage) + if !((*(*uintptr)(unsafe.Pointer(bp /* pPage */)) != 0) && ((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_SECURE_DELETE) == 0)) { + goto __15 + } + Xsqlite3PagerDontWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage) +__15: + ; + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = btreeSetHasContent(tls, pBt, iPage) +__14: + ; + + goto freepage_out +__13: + ; +__9: + ; + + // If control flows to this point, then it was not possible to add the + // the page being freed as a leaf page of the first trunk in the free-list. + // Possibly because the free-list is empty, or possibly because the + // first trunk in the free-list is full. Either way, the page being freed + // will become the new first trunk page in the free-list. + if !((*(*uintptr)(unsafe.Pointer(bp /* pPage */)) == uintptr(0)) && (SQLITE_OK != (libc.AssignPtrInt32(bp+8 /* rc */, btreeGetPage(tls, pBt, iPage, bp /* &pPage */, 0))))) { + goto __16 + } + goto freepage_out +__16: + ; + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage) + if !(*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK) { + goto __17 + } + goto freepage_out +__17: + ; + Xsqlite3Put4byte(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData, iTrunk) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData + 4), uint32(0)) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pPage1)).FaData + 32), iPage) + +freepage_out: + if !(*(*uintptr)(unsafe.Pointer(bp /* pPage */)) != 0) { + goto __18 + } + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FisInit = U8(0) +__18: + ; + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTrunk */))) + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +func freePage(tls *libc.TLS, pPage uintptr, pRC uintptr) { /* sqlite3.c:71867:13: */ + if (*(*int32)(unsafe.Pointer(pRC))) == SQLITE_OK { + *(*int32)(unsafe.Pointer(pRC)) = freePage2(tls, (*MemPage)(unsafe.Pointer(pPage)).FpBt, pPage, (*MemPage)(unsafe.Pointer(pPage)).Fpgno) + } +} + +// Free the overflow pages associated with the given Cell. +func clearCellOverflow(tls *libc.TLS, pPage uintptr, pCell uintptr, pInfo uintptr) int32 { /* sqlite3.c:71876:28: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pBt uintptr + var ovflPgno Pgno + var rc int32 + var nOvfl int32 + var ovflPageSize U32 + + if (pCell + uintptr((*CellInfo)(unsafe.Pointer(pInfo)).FnSize)) > (*MemPage)(unsafe.Pointer(pPage)).FaDataEnd { + // Cell extends past end of page + return Xsqlite3CorruptError(tls, 71893) + } + ovflPgno = Xsqlite3Get4byte(tls, ((pCell + uintptr((*CellInfo)(unsafe.Pointer(pInfo)).FnSize)) - uintptr(4))) + pBt = (*MemPage)(unsafe.Pointer(pPage)).FpBt + + ovflPageSize = ((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(4)) + nOvfl = (int32(((((*CellInfo)(unsafe.Pointer(pInfo)).FnPayload - U32((*CellInfo)(unsafe.Pointer(pInfo)).FnLocal)) + ovflPageSize) - U32(1)) / ovflPageSize)) + + for libc.PostDecInt32(&nOvfl, 1) != 0 { + *(*Pgno)(unsafe.Pointer(bp + 8 /* iNext */)) = Pgno(0) + *(*uintptr)(unsafe.Pointer(bp /* pOvfl */)) = uintptr(0) + if (ovflPgno < Pgno(2)) || (ovflPgno > btreePagecount(tls, pBt)) { + // 0 is not a legal page number and page 1 cannot be an + // overflow page. Therefore if ovflPgno<2 or past the end of the + // file the database must be corrupt. + return Xsqlite3CorruptError(tls, 71910) + } + if nOvfl != 0 { + rc = getOverflowPage(tls, pBt, ovflPgno, bp /* &pOvfl */, bp+8 /* &iNext */) + if rc != 0 { + return rc + } + } + + if ((*(*uintptr)(unsafe.Pointer(bp /* pOvfl */)) != 0) || ((libc.AssignPtrUintptr(bp /* pOvfl */, btreePageLookup(tls, pBt, ovflPgno))) != uintptr(0))) && + (Xsqlite3PagerPageRefcount(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pOvfl */)))).FpDbPage) != 1) { + // There is no reason any cursor should have an outstanding reference + // to an overflow page belonging to a cell that is being deleted/updated. + // So if there exists more than one reference to this page, then it + // must not really be an overflow page and the database must be corrupt. + // It is helpful to detect this before calling freePage2(), as + // freePage2() may zero the page contents if secure-delete mode is + // enabled. If this 'overflow' page happens to be a page that the + // caller is iterating through or using in some other way, this + // can be problematic. + rc = Xsqlite3CorruptError(tls, 71930) + } else { + rc = freePage2(tls, pBt, *(*uintptr)(unsafe.Pointer(bp /* pOvfl */)), ovflPgno) + } + + if *(*uintptr)(unsafe.Pointer(bp /* pOvfl */)) != 0 { + Xsqlite3PagerUnref(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pOvfl */)))).FpDbPage) + } + if rc != 0 { + return rc + } + ovflPgno = *(*Pgno)(unsafe.Pointer(bp + 8 /* iNext */)) + } + return SQLITE_OK +} + +// Call xParseCell to compute the size of a cell. If the cell contains +// overflow, then invoke cellClearOverflow to clear out that overflow. +// STore the result code (SQLITE_OK or some error code) in rc. +// +// Implemented as macro to force inlining for performance. + +// Create the byte sequence used to represent a cell on page pPage +// and write that byte sequence into pCell[]. Overflow pages are +// allocated and filled in as necessary. The calling procedure +// is responsible for making sure sufficient space has been allocated +// for pCell[]. +// +// Note that pCell does not necessary need to point to the pPage->aData +// area. pCell might point to some temporary storage. The cell will +// be constructed in this temporary area then copied into pPage->aData +// later. +func fillInCell(tls *libc.TLS, pPage uintptr, pCell uintptr, pX uintptr, pnSize uintptr) int32 { /* sqlite3.c:71971:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nPayload int32 + var pSrc uintptr + var nSrc int32 + var n int32 + // var rc int32 at bp+12, 4 + + var mn int32 + var spaceLeft int32 + var pToRelease uintptr + var pPrior uintptr + var pPayload uintptr + var pBt uintptr + // var pgnoOvfl Pgno at bp+8, 4 + + var nHeader int32 + + // pPage is not necessarily writeable since pCell might be auxiliary + // buffer space that is separate from the pPage buffer area + + // Fill in the header. + nHeader = int32((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize) + if (*MemPage)(unsafe.Pointer(pPage)).FintKey != 0 { + nPayload = ((*BtreePayload)(unsafe.Pointer(pX)).FnData + (*BtreePayload)(unsafe.Pointer(pX)).FnZero) + pSrc = (*BtreePayload)(unsafe.Pointer(pX)).FpData + nSrc = (*BtreePayload)(unsafe.Pointer(pX)).FnData + // fillInCell() only called for leaves + nHeader = nHeader + (int32(func() uint8 { + if (U32(nPayload)) < U32(0x80) { + return uint8(func() int32 { *(*uint8)(unsafe.Pointer((pCell + uintptr(nHeader)))) = uint8(nPayload); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, (pCell + uintptr(nHeader)), uint64(nPayload))) + }())) + nHeader = nHeader + (Xsqlite3PutVarint(tls, (pCell + uintptr(nHeader)), *(*U64)(unsafe.Pointer((pX + 8 /* &.nKey */))))) + } else { + + nSrc = libc.AssignInt32(&nPayload, int32((*BtreePayload)(unsafe.Pointer(pX)).FnKey)) + pSrc = (*BtreePayload)(unsafe.Pointer(pX)).FpKey + nHeader = nHeader + (int32(func() uint8 { + if (U32(nPayload)) < U32(0x80) { + return uint8(func() int32 { *(*uint8)(unsafe.Pointer((pCell + uintptr(nHeader)))) = uint8(nPayload); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, (pCell + uintptr(nHeader)), uint64(nPayload))) + }())) + } + + // Fill in the payload + pPayload = (pCell + uintptr(nHeader)) + if nPayload <= int32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + // This is the common case where everything fits on the btree page + // and no overflow pages are required. + n = (nHeader + nPayload) + + if n < 4 { + n = 4 + } + *(*int32)(unsafe.Pointer(pnSize)) = n + + libc.Xmemcpy(tls, pPayload, pSrc, uint64(nSrc)) + libc.Xmemset(tls, (pPayload + uintptr(nSrc)), 0, (uint64(nPayload - nSrc))) + return SQLITE_OK + } + + // If we reach this point, it means that some of the content will need + // to spill onto overflow pages. + mn = int32((*MemPage)(unsafe.Pointer(pPage)).FminLocal) + n = (int32(U32(mn) + ((U32(nPayload - mn)) % ((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - U32(4))))) + + if n > int32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal) { + n = mn + } + spaceLeft = n + *(*int32)(unsafe.Pointer(pnSize)) = ((n + nHeader) + 4) + pPrior = (pCell + uintptr((nHeader + n))) + pToRelease = uintptr(0) + *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */)) = Pgno(0) + pBt = (*MemPage)(unsafe.Pointer(pPage)).FpBt + + // At this point variables should be set as follows: + // + // nPayload Total payload size in bytes + // pPayload Begin writing payload here + // spaceLeft Space available at pPayload. If nPayload>spaceLeft, + // that means content must spill into overflow pages. + // *pnSize Size of the local cell (not counting overflow pages) + // pPrior Where to write the pgno of the first overflow page + // + // Use a call to btreeParseCellPtr() to verify that the values above + // were computed correctly. + + // Write the payload into the local Cell and any extra into overflow pages + for 1 != 0 { + n = nPayload + if n > spaceLeft { + n = spaceLeft + } + + // If pToRelease is not zero than pPayload points into the data area + // of pToRelease. Make sure pToRelease is still writeable. + + // If pPayload is part of the data area of pPage, then make sure pPage + // is still writeable + + if nSrc >= n { + libc.Xmemcpy(tls, pPayload, pSrc, uint64(n)) + } else if nSrc > 0 { + n = nSrc + libc.Xmemcpy(tls, pPayload, pSrc, uint64(n)) + } else { + libc.Xmemset(tls, pPayload, 0, uint64(n)) + } + nPayload = nPayload - (n) + if nPayload <= 0 { + break + } + pPayload += uintptr(n) + pSrc += uintptr(n) + nSrc = nSrc - (n) + spaceLeft = spaceLeft - (n) + if spaceLeft == 0 { + *(*uintptr)(unsafe.Pointer(bp /* pOvfl */)) = uintptr(0) + var pgnoPtrmap Pgno = *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */)) // Overflow page pointer-map entry page + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + for ok := true; ok; ok = ((ptrmapPageno(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */))) == (*(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */)))) || (*(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */)) == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1)))) { + *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */))++ + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = allocateBtreePage(tls, pBt, bp /* &pOvfl */, bp+8 /* &pgnoOvfl */, *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */)), uint8(0)) + // If the database supports auto-vacuum, and the second or subsequent + // overflow page is being allocated, add an entry to the pointer-map + // for that page now. + // + // If this is the first overflow page, then write a partial entry + // to the pointer-map. If we write nothing to this pointer-map slot, + // then the optimistic overflow chain processing in clearCell() + // may misinterpret the uninitialized values and delete the + // wrong pages from the database. + if ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && (*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) { + var eType U8 = func() uint8 { + if pgnoPtrmap != 0 { + return uint8(PTRMAP_OVERFLOW2) + } + return uint8(PTRMAP_OVERFLOW1) + }() + ptrmapPut(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */)), eType, pgnoPtrmap, bp+12 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != 0 { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pOvfl */))) + } + } + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != 0 { + releasePage(tls, pToRelease) + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + + // If pToRelease is not zero than pPrior points into the data area + // of pToRelease. Make sure pToRelease is still writeable. + + // If pPrior is part of the data area of pPage, then make sure pPage + // is still writeable + + Xsqlite3Put4byte(tls, pPrior, *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoOvfl */))) + releasePage(tls, pToRelease) + pToRelease = *(*uintptr)(unsafe.Pointer(bp /* pOvfl */)) + pPrior = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pOvfl */)))).FaData + Xsqlite3Put4byte(tls, pPrior, uint32(0)) + pPayload = ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pOvfl */)))).FaData + 4) + spaceLeft = (int32((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(4))) + } + } + releasePage(tls, pToRelease) + return SQLITE_OK +} + +// Remove the i-th cell from pPage. This routine effects pPage only. +// The cell content is not freed or deallocated. It is assumed that +// the cell content has been copied someplace else. This routine just +// removes the reference to the cell from pPage. +// +// "sz" must be the number of bytes in the cell. +func dropCell(tls *libc.TLS, pPage uintptr, idx int32, sz int32, pRC uintptr) { /* sqlite3.c:72161:13: */ + var pc U32 // Offset to cell content of cell being deleted + var data uintptr // pPage->aData + var ptr uintptr // Used to move bytes around within data[] + var rc int32 // The return code + var hdr int32 // Beginning of the header. 0 most pages. 100 page 1 + + if *(*int32)(unsafe.Pointer(pRC)) != 0 { + return + } + + data = (*MemPage)(unsafe.Pointer(pPage)).FaData + ptr = ((*MemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr((2 * idx))) + pc = (U32((int32(*(*U8)(unsafe.Pointer((ptr)))) << 8) | int32(*(*U8)(unsafe.Pointer((ptr) + 1))))) + hdr = int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + + if (pc + U32(sz)) > (*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize { + *(*int32)(unsafe.Pointer(pRC)) = Xsqlite3CorruptError(tls, 72181) + return + } + rc = freeSpace(tls, pPage, uint16(pc), uint16(sz)) + if rc != 0 { + *(*int32)(unsafe.Pointer(pRC)) = rc + return + } + (*MemPage)(unsafe.Pointer(pPage)).FnCell-- + if int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { + libc.Xmemset(tls, (data + uintptr((hdr + 1))), 0, uint64(4)) + *(*U8)(unsafe.Pointer(data + uintptr((hdr + 7)))) = U8(0) + *(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))))) = (U8(((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) >> 8)) + *(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)) = U8((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize) + (*MemPage)(unsafe.Pointer(pPage)).FnFree = (int32((((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FusableSize - U32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset)) - + U32((*MemPage)(unsafe.Pointer(pPage)).FchildPtrSize)) - U32(8))) + } else { + libc.Xmemmove(tls, ptr, (ptr + uintptr(2)), (uint64(2 * (int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) - idx)))) + *(*U8)(unsafe.Pointer((data + uintptr((hdr + 3))))) = (U8((int32((*MemPage)(unsafe.Pointer(pPage)).FnCell)) >> 8)) + *(*U8)(unsafe.Pointer((data + uintptr((hdr + 3))) + 1)) = U8((*MemPage)(unsafe.Pointer(pPage)).FnCell) + *(*int32)(unsafe.Pointer(pPage + 20 /* &.nFree */)) += (2) + } +} + +// Insert a new cell on pPage at cell index "i". pCell points to the +// content of the cell. +// +// If the cell content will fit on the page, then put it there. If it +// will not fit, then make a copy of the cell content into pTemp if +// pTemp is not null. Regardless of pTemp, allocate a new entry +// in pPage->apOvfl[] and make it point to the cell content (either +// in pTemp or the original pCell) and also record its index. +// Allocating a new entry in pPage->aCell[] implies that +// pPage->nOverflow is incremented. +// +// *pRC must be SQLITE_OK when this routine is called. +func insertCell(tls *libc.TLS, pPage uintptr, i int32, pCell uintptr, sz int32, pTemp uintptr, iChild Pgno, pRC uintptr) { /* sqlite3.c:72217:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* idx */)) = 0 // Where to write new cell content in data[] + var j int32 // Loop counter + var data uintptr // The content of the whole page + var pIns uintptr // The point in pPage->aCellIdx[] where no cell inserted + + if ((*MemPage)(unsafe.Pointer(pPage)).FnOverflow != 0) || ((sz + 2) > (*MemPage)(unsafe.Pointer(pPage)).FnFree) { + if pTemp != 0 { + libc.Xmemcpy(tls, pTemp, pCell, uint64(sz)) + pCell = pTemp + } + if iChild != 0 { + Xsqlite3Put4byte(tls, pCell, iChild) + } + j = int32(libc.PostIncUint8(&(*MemPage)(unsafe.Pointer(pPage)).FnOverflow, 1)) + // Comparison against ArraySize-1 since we hold back one extra slot + // as a contingency. In other words, never need more than 3 overflow + // slots but 4 are allocated, just to be safe. + + *(*uintptr)(unsafe.Pointer((pPage + 40 /* &.apOvfl */) + uintptr(j)*8)) = pCell + *(*U16)(unsafe.Pointer((pPage + 28 /* &.aiOvfl */) + uintptr(j)*2)) = U16(i) + + // When multiple overflows occur, they are always sequential and in + // sorted order. This invariants arise because multiple overflows can + // only occur when inserting divider cells into the parent page during + // balancing, and the dividers are adjacent and sorted. + // Overflows in sorted order + // Overflows are sequential + } else { + var rc int32 = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc != SQLITE_OK { + *(*int32)(unsafe.Pointer(pRC)) = rc + return + } + + data = (*MemPage)(unsafe.Pointer(pPage)).FaData + + rc = allocateSpace(tls, pPage, sz, bp /* &idx */) + if rc != 0 { + *(*int32)(unsafe.Pointer(pRC)) = rc + return + } + // The allocateSpace() routine guarantees the following properties + // if it returns successfully + + *(*int32)(unsafe.Pointer(pPage + 20 /* &.nFree */)) -= (int32((U16(2 + sz)))) + if iChild != 0 { + // In a corrupt database where an entry in the cell index section of + // a btree page has a value of 3 or less, the pCell value might point + // as many as 4 bytes in front of the start of the aData buffer for + // the source page. Make sure this does not cause problems by not + // reading the first 4 bytes + libc.Xmemcpy(tls, (data + uintptr((*(*int32)(unsafe.Pointer(bp /* idx */)) + 4))), (pCell + uintptr(4)), (uint64(sz - 4))) + Xsqlite3Put4byte(tls, (data + uintptr(*(*int32)(unsafe.Pointer(bp /* idx */)))), iChild) + } else { + libc.Xmemcpy(tls, (data + uintptr(*(*int32)(unsafe.Pointer(bp /* idx */)))), pCell, uint64(sz)) + } + pIns = ((*MemPage)(unsafe.Pointer(pPage)).FaCellIdx + uintptr((i * 2))) + libc.Xmemmove(tls, (pIns + uintptr(2)), pIns, (uint64(2 * (int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) - i)))) + *(*U8)(unsafe.Pointer((pIns))) = (U8((*(*int32)(unsafe.Pointer(bp /* idx */))) >> 8)) + *(*U8)(unsafe.Pointer((pIns) + 1)) = U8(*(*int32)(unsafe.Pointer(bp /* idx */))) + (*MemPage)(unsafe.Pointer(pPage)).FnCell++ + // increment the cell count + if (int32(libc.PreIncUint8(&*(*U8)(unsafe.Pointer(data + uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 4)))), 1))) == 0 { + *(*U8)(unsafe.Pointer(data + uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset) + 3))))++ + } + + if (*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPage)).FpBt)).FautoVacuum != 0 { + // The cell may contain a pointer to an overflow page. If so, write + // the entry for the overflow page into the pointer map. + ptrmapPutOvflPtr(tls, pPage, pPage, pCell, pRC) + } + } +} + +// The following parameters determine how many adjacent pages get involved +// in a balancing operation. NN is the number of neighbors on either side +// of the page that participate in the balancing operation. NB is the +// total number of pages that participate, including the target page and +// NN neighbors on either side. +// +// The minimum value of NN is 1 (of course). Increasing NN above 1 +// (to 2 or 3) gives a modest improvement in SELECT and DELETE performance +// in exchange for a larger degradation in INSERT and UPDATE performance. +// The value of NN appears to give the best results overall. +// +// (Later:) The description above makes it seem as if these values are +// tunable - as if you could change them and recompile and it would all work. +// But that is unlikely. NB has been 3 since the inception of SQLite and +// we have never tested any other value. + +// A CellArray object contains a cache of pointers and sizes for a +// consecutive sequence of cells that might be held on multiple pages. +// +// The cells in this array are the divider cell or cells from the pParent +// page plus up to three child pages. There are a total of nCell cells. +// +// pRef is a pointer to one of the pages that contributes cells. This is +// used to access information such as MemPage.intKey and MemPage.pBt->pageSize +// which should be common to all pages that contribute cells to this array. +// +// apCell[] and szCell[] hold, respectively, pointers to the start of each +// cell and the size of each cell. Some of the apCell[] pointers might refer +// to overflow cells. In other words, some apCel[] pointers might not point +// to content area of the pages. +// +// A szCell[] of zero means the size of that cell has not yet been computed. +// +// The cells come from as many as four different pages: +// +// ----------- +// | Parent | +// ----------- +// / | ** / | ** --------- --------- --------- +// |Child-1| |Child-2| |Child-3| +// --------- --------- --------- +// +// The order of cells is in the array is for an index btree is: +// +// 1. All cells from Child-1 in order +// 2. The first divider cell from Parent +// 3. All cells from Child-2 in order +// 4. The second divider cell from Parent +// 5. All cells from Child-3 in order +// +// For a table-btree (with rowids) the items 2 and 4 are empty because +// content exists only in leaves and there are no divider cells. +// +// For an index btree, the apEnd[] array holds pointer to the end of page +// for Child-1, the Parent, Child-2, the Parent (again), and Child-3, +// respectively. The ixNx[] array holds the number of cells contained in +// each of these 5 stages, and all stages to the left. Hence: +// +// ixNx[0] = Number of cells in Child-1. +// ixNx[1] = Number of cells in Child-1 plus 1 for first divider. +// ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider. +// ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells +// ixNx[4] = Total number of cells. +// +// For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2] +// are used and they point to the leaf pages only, and the ixNx value are: +// +// ixNx[0] = Number of cells in Child-1. +// ixNx[1] = Number of cells in Child-1 and Child-2. +// ixNx[2] = Total number of cells. +// +// Sometimes when deleting, a child page can have zero cells. In those +// cases, ixNx[] entries with higher indexes, and the corresponding apEnd[] +// entries, shift down. The end result is that each ixNx[] entry should +// be larger than the previous +type CellArray1 = struct { + FnCell int32 + _ [4]byte + FpRef uintptr + FapCell uintptr + FszCell uintptr + FapEnd [6]uintptr + FixNx [6]int32 +} /* sqlite3.c:72392:9 */ + +// The following parameters determine how many adjacent pages get involved +// in a balancing operation. NN is the number of neighbors on either side +// of the page that participate in the balancing operation. NB is the +// total number of pages that participate, including the target page and +// NN neighbors on either side. +// +// The minimum value of NN is 1 (of course). Increasing NN above 1 +// (to 2 or 3) gives a modest improvement in SELECT and DELETE performance +// in exchange for a larger degradation in INSERT and UPDATE performance. +// The value of NN appears to give the best results overall. +// +// (Later:) The description above makes it seem as if these values are +// tunable - as if you could change them and recompile and it would all work. +// But that is unlikely. NB has been 3 since the inception of SQLite and +// we have never tested any other value. + +// A CellArray object contains a cache of pointers and sizes for a +// consecutive sequence of cells that might be held on multiple pages. +// +// The cells in this array are the divider cell or cells from the pParent +// page plus up to three child pages. There are a total of nCell cells. +// +// pRef is a pointer to one of the pages that contributes cells. This is +// used to access information such as MemPage.intKey and MemPage.pBt->pageSize +// which should be common to all pages that contribute cells to this array. +// +// apCell[] and szCell[] hold, respectively, pointers to the start of each +// cell and the size of each cell. Some of the apCell[] pointers might refer +// to overflow cells. In other words, some apCel[] pointers might not point +// to content area of the pages. +// +// A szCell[] of zero means the size of that cell has not yet been computed. +// +// The cells come from as many as four different pages: +// +// ----------- +// | Parent | +// ----------- +// / | ** / | ** --------- --------- --------- +// |Child-1| |Child-2| |Child-3| +// --------- --------- --------- +// +// The order of cells is in the array is for an index btree is: +// +// 1. All cells from Child-1 in order +// 2. The first divider cell from Parent +// 3. All cells from Child-2 in order +// 4. The second divider cell from Parent +// 5. All cells from Child-3 in order +// +// For a table-btree (with rowids) the items 2 and 4 are empty because +// content exists only in leaves and there are no divider cells. +// +// For an index btree, the apEnd[] array holds pointer to the end of page +// for Child-1, the Parent, Child-2, the Parent (again), and Child-3, +// respectively. The ixNx[] array holds the number of cells contained in +// each of these 5 stages, and all stages to the left. Hence: +// +// ixNx[0] = Number of cells in Child-1. +// ixNx[1] = Number of cells in Child-1 plus 1 for first divider. +// ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider. +// ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells +// ixNx[4] = Total number of cells. +// +// For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2] +// are used and they point to the leaf pages only, and the ixNx value are: +// +// ixNx[0] = Number of cells in Child-1. +// ixNx[1] = Number of cells in Child-1 and Child-2. +// ixNx[2] = Total number of cells. +// +// Sometimes when deleting, a child page can have zero cells. In those +// cases, ixNx[] entries with higher indexes, and the corresponding apEnd[] +// entries, shift down. The end result is that each ixNx[] entry should +// be larger than the previous +type CellArray = CellArray1 /* sqlite3.c:72392:26 */ + +// Make sure the cell sizes at idx, idx+1, ..., idx+N-1 have been +// computed. +func populateCellCache(tls *libc.TLS, p uintptr, idx int32, N int32) { /* sqlite3.c:72406:13: */ + + for N > 0 { + + if int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FszCell + uintptr(idx)*2))) == 0 { + *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FszCell + uintptr(idx)*2)) = (*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer(((*CellArray)(unsafe.Pointer(p)).FpRef + 120 /* &.xCellSize */))))(tls, (*CellArray)(unsafe.Pointer(p)).FpRef, *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FapCell + uintptr(idx)*8))) + } else { + + } + idx++ + N-- + } +} + +// Return the size of the Nth element of the cell array +func computeCellSize(tls *libc.TLS, p uintptr, N int32) U16 { /* sqlite3.c:72424:28: */ + + *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) = (*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer(((*CellArray)(unsafe.Pointer(p)).FpRef + 120 /* &.xCellSize */))))(tls, (*CellArray)(unsafe.Pointer(p)).FpRef, *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FapCell + uintptr(N)*8))) + return *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) +} + +func cachedCellSize(tls *libc.TLS, p uintptr, N int32) U16 { /* sqlite3.c:72430:12: */ + + if *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) != 0 { + return *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(p)).FszCell + uintptr(N)*2)) + } + return computeCellSize(tls, p, N) +} + +// Array apCell[] contains pointers to nCell b-tree page cells. The +// szCell[] array contains the size in bytes of each cell. This function +// replaces the current contents of page pPg with the contents of the cell +// array. +// +// Some of the cells in apCell[] may currently be stored in pPg. This +// function works around problems caused by this by making a copy of any +// such cells before overwriting the page data. +// +// The MemPage.nFree field is invalidated by this function. It is the +// responsibility of the caller to set it correctly. +func rebuildPage(tls *libc.TLS, pCArray uintptr, iFirst int32, nCell int32, pPg uintptr) int32 { /* sqlite3.c:72449:12: */ + var hdr int32 = int32((*MemPage)(unsafe.Pointer(pPg)).FhdrOffset) // Offset of header on pPg + var aData uintptr = (*MemPage)(unsafe.Pointer(pPg)).FaData // Pointer to data for pPg + var usableSize int32 = int32((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPg)).FpBt)).FusableSize) + var pEnd uintptr = (aData + uintptr(usableSize)) + var i int32 = iFirst // Which cell to copy from pCArray + var j U32 // Start of cell content area + var iEnd int32 = (i + nCell) // Loop terminator + var pCellptr uintptr = (*MemPage)(unsafe.Pointer(pPg)).FaCellIdx + var pTmp uintptr = Xsqlite3PagerTempSpace(tls, (*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPg)).FpBt)).FpPager) + var pData uintptr + var k int32 // Current slot in pCArray->apEnd[] + var pSrcEnd uintptr // Current pCArray->apEnd[k] value + + j = (U32((int32(*(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5))) + 1))))) + if j > U32(usableSize) { + j = U32(0) + } + libc.Xmemcpy(tls, (pTmp + uintptr(j)), (aData + uintptr(j)), (uint64(U32(usableSize) - j))) + + for k = 0; (*(*int32)(unsafe.Pointer((pCArray + 80 /* &.ixNx */) + uintptr(k)*4)) <= i) && (k < (NB * 2)); k++ { + } + pSrcEnd = *(*uintptr)(unsafe.Pointer((pCArray + 32 /* &.apEnd */) + uintptr(k)*8)) + + pData = pEnd + for 1 != 0 { + var pCell uintptr = *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)) + var sz U16 = *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2)) + + if (Uptr((pCell)) >= Uptr((aData + uintptr(j)))) && (Uptr((pCell)) < Uptr((pEnd))) { + if (Uptr((pCell + uintptr(sz)))) > Uptr(pEnd) { + return Xsqlite3CorruptError(tls, 72482) + } + pCell = (pTmp + uintptr(((int64(pCell) - int64(aData)) / 1))) + } else if (Uptr((pCell + uintptr(sz))) > Uptr(pSrcEnd)) && + (Uptr((pCell)) < Uptr(pSrcEnd)) { + return Xsqlite3CorruptError(tls, 72487) + } + + pData -= uintptr(sz) + *(*U8)(unsafe.Pointer((pCellptr))) = (U8(((int64(pData) - int64(aData)) / 1) >> 8)) + *(*U8)(unsafe.Pointer((pCellptr) + 1)) = (U8((int64(pData) - int64(aData)) / 1)) + pCellptr += uintptr(2) + if pData < pCellptr { + return Xsqlite3CorruptError(tls, 72493) + } + libc.Xmemmove(tls, pData, pCell, uint64(sz)) + + i++ + if i >= iEnd { + break + } + if *(*int32)(unsafe.Pointer((pCArray + 80 /* &.ixNx */) + uintptr(k)*4)) <= i { + k++ + pSrcEnd = *(*uintptr)(unsafe.Pointer((pCArray + 32 /* &.apEnd */) + uintptr(k)*8)) + } + } + + // The pPg->nFree field is now set incorrectly. The caller will fix it. + (*MemPage)(unsafe.Pointer(pPg)).FnCell = U16(nCell) + (*MemPage)(unsafe.Pointer(pPg)).FnOverflow = U8(0) + + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 1))))) = (U8(int32((0)) >> 8)) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 1))) + 1)) = U8(0) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 3))))) = (U8((int32((*MemPage)(unsafe.Pointer(pPg)).FnCell)) >> 8)) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 3))) + 1)) = U8((*MemPage)(unsafe.Pointer(pPg)).FnCell) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5))))) = (U8(((int64(pData) - int64(aData)) / 1) >> 8)) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5))) + 1)) = (U8((int64(pData) - int64(aData)) / 1)) + *(*U8)(unsafe.Pointer(aData + uintptr((hdr + 7)))) = U8(0x00) + return SQLITE_OK +} + +// The pCArray objects contains pointers to b-tree cells and the cell sizes. +// This function attempts to add the cells stored in the array to page pPg. +// If it cannot (because the page needs to be defragmented before the cells +// will fit), non-zero is returned. Otherwise, if the cells are added +// successfully, zero is returned. +// +// Argument pCellptr points to the first entry in the cell-pointer array +// (part of page pPg) to populate. After cell apCell[0] is written to the +// page body, a 16-bit offset is written to pCellptr. And so on, for each +// cell in the array. It is the responsibility of the caller to ensure +// that it is safe to overwrite this part of the cell-pointer array. +// +// When this function is called, *ppData points to the start of the +// content area on page pPg. If the size of the content area is extended, +// *ppData is updated to point to the new start of the content area +// before returning. +// +// Finally, argument pBegin points to the byte immediately following the +// end of the space required by this page for the cell-pointer area (for +// all cells - not just those inserted by the current call). If the content +// area must be extended to before this point in order to accomodate all +// cells in apCell[], then the cells do not fit and non-zero is returned. +func pageInsertArray(tls *libc.TLS, pPg uintptr, pBegin uintptr, ppData uintptr, pCellptr uintptr, iFirst int32, nCell int32, pCArray uintptr) int32 { /* sqlite3.c:72539:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 = iFirst // Loop counter - cell index to insert + var aData uintptr = (*MemPage)(unsafe.Pointer(pPg)).FaData // Complete page + var pData uintptr = *(*uintptr)(unsafe.Pointer(ppData)) // Content area. A subset of aData[] + var iEnd int32 = (iFirst + nCell) // End of loop. One past last cell to ins + var k int32 // Current slot in pCArray->apEnd[] + var pEnd uintptr // Maximum extent of cell data + // Never called on page 1 + if iEnd <= iFirst { + return 0 + } + for k = 0; (*(*int32)(unsafe.Pointer((pCArray + 80 /* &.ixNx */) + uintptr(k)*4)) <= i) && (k < (NB * 2)); k++ { + } + pEnd = *(*uintptr)(unsafe.Pointer((pCArray + 32 /* &.apEnd */) + uintptr(k)*8)) + for 1 != 0 { + var sz int32 + // var rc int32 at bp, 4 + + var pSlot uintptr + + sz = int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2))) + if ((int32(*(*U8)(unsafe.Pointer(aData + 1))) == 0) && (int32(*(*U8)(unsafe.Pointer(aData + 2))) == 0)) || ((libc.AssignUintptr(&pSlot, pageFindSlot(tls, pPg, sz, bp /* &rc */))) == uintptr(0)) { + if ((int64(pData) - int64(pBegin)) / 1) < int64(sz) { + return 1 + } + pData -= uintptr(sz) + pSlot = pData + } + // pSlot and pCArray->apCell[i] will never overlap on a well-formed + // database. But they might for a corrupt database. Hence use memmove() + // since memcpy() sends SIGABORT with overlapping buffers on OpenBSD + + if (Uptr((*(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)) + uintptr(sz))) > Uptr(pEnd)) && + (Uptr((*(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)))) < Uptr(pEnd)) { + + Xsqlite3CorruptError(tls, 72578) + return 1 + } + libc.Xmemmove(tls, pSlot, *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)), uint64(sz)) + *(*U8)(unsafe.Pointer((pCellptr))) = (U8(((int64(pSlot) - int64(aData)) / 1) >> 8)) + *(*U8)(unsafe.Pointer((pCellptr) + 1)) = (U8((int64(pSlot) - int64(aData)) / 1)) + pCellptr += uintptr(2) + i++ + if i >= iEnd { + break + } + if *(*int32)(unsafe.Pointer((pCArray + 80 /* &.ixNx */) + uintptr(k)*4)) <= i { + k++ + pEnd = *(*uintptr)(unsafe.Pointer((pCArray + 32 /* &.apEnd */) + uintptr(k)*8)) + } + } + *(*uintptr)(unsafe.Pointer(ppData)) = pData + return 0 +} + +// The pCArray object contains pointers to b-tree cells and their sizes. +// +// This function adds the space associated with each cell in the array +// that is currently stored within the body of pPg to the pPg free-list. +// The cell-pointers and other fields of the page are not updated. +// +// This function returns the total number of cells added to the free-list. +func pageFreeArray(tls *libc.TLS, pPg uintptr, iFirst int32, nCell int32, pCArray uintptr) int32 { /* sqlite3.c:72604:12: */ + var aData uintptr = (*MemPage)(unsafe.Pointer(pPg)).FaData + var pEnd uintptr = (aData + uintptr((*BtShared)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pPg)).FpBt)).FusableSize)) + var pStart uintptr = (aData + uintptr(((int32((*MemPage)(unsafe.Pointer(pPg)).FhdrOffset) + 8) + int32((*MemPage)(unsafe.Pointer(pPg)).FchildPtrSize)))) + var nRet int32 = 0 + var i int32 + var iEnd int32 = (iFirst + nCell) + var pFree uintptr = uintptr(0) + var szFree int32 = 0 + + for i = iFirst; i < iEnd; i++ { + var pCell uintptr = *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FapCell + uintptr(i)*8)) + if (Uptr((pCell)) >= Uptr((pStart))) && (Uptr((pCell)) < Uptr((pEnd))) { + var sz int32 + // No need to use cachedCellSize() here. The sizes of all cells that + // are to be freed have already been computing while deciding which + // cells need freeing + sz = int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(pCArray)).FszCell + uintptr(i)*2))) + if pFree != (pCell + uintptr(sz)) { + if pFree != 0 { + + freeSpace(tls, pPg, (U16((int64(pFree) - int64(aData)) / 1)), uint16(szFree)) + } + pFree = pCell + szFree = sz + if (pFree + uintptr(sz)) > pEnd { + return 0 + } + } else { + pFree = pCell + szFree = szFree + (sz) + } + nRet++ + } + } + if pFree != 0 { + + freeSpace(tls, pPg, (U16((int64(pFree) - int64(aData)) / 1)), uint16(szFree)) + } + return nRet +} + +// pCArray contains pointers to and sizes of all cells in the page being +// balanced. The current page, pPg, has pPg->nCell cells starting with +// pCArray->apCell[iOld]. After balancing, this page should hold nNew cells +// starting at apCell[iNew]. +// +// This routine makes the necessary adjustments to pPg so that it contains +// the correct cells after being balanced. +// +// The pPg->nFree field is invalid when this function returns. It is the +// responsibility of the caller to set it correctly. +func editPage(tls *libc.TLS, pPg uintptr, iOld int32, iNew int32, nNew int32, pCArray uintptr) int32 { /* sqlite3.c:72663:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var aData uintptr + var hdr int32 + var pBegin uintptr + var nCell int32 // Cells stored on pPg + // var pData uintptr at bp, 8 + + var pCellptr uintptr + var i int32 + var iOldEnd int32 + var iNewEnd int32 + var nShift int32 + var nTail int32 + var nAdd int32 + var iCell int32 + aData = (*MemPage)(unsafe.Pointer(pPg)).FaData + hdr = int32((*MemPage)(unsafe.Pointer(pPg)).FhdrOffset) + pBegin = ((*MemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr((nNew * 2))) + nCell = int32((*MemPage)(unsafe.Pointer(pPg)).FnCell) + iOldEnd = ((iOld + int32((*MemPage)(unsafe.Pointer(pPg)).FnCell)) + int32((*MemPage)(unsafe.Pointer(pPg)).FnOverflow)) + iNewEnd = (iNew + nNew) + + // Remove cells from the start and end of the page + + if !(iOld < iNew) { + goto __1 + } + nShift = pageFreeArray(tls, pPg, iOld, (iNew - iOld), pCArray) + if !(nShift > nCell) { + goto __2 + } + return Xsqlite3CorruptError(tls, 72689) +__2: + ; + libc.Xmemmove(tls, (*MemPage)(unsafe.Pointer(pPg)).FaCellIdx, ((*MemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr((nShift * 2))), (uint64(nCell * 2))) + nCell = nCell - (nShift) +__1: + ; + if !(iNewEnd < iOldEnd) { + goto __3 + } + nTail = pageFreeArray(tls, pPg, iNewEnd, (iOldEnd - iNewEnd), pCArray) + + nCell = nCell - (nTail) +__3: + ; + + *(*uintptr)(unsafe.Pointer(bp /* pData */)) = (aData + uintptr((((((int32(*(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1))) + if !(*(*uintptr)(unsafe.Pointer(bp /* pData */)) < pBegin) { + goto __4 + } + goto editpage_fail +__4: + ; + + // Add cells to the start of the page + if !(iNew < iOld) { + goto __5 + } + nAdd = func() int32 { + if (nNew) < (iOld - iNew) { + return nNew + } + return (iOld - iNew) + }() + + pCellptr = (*MemPage)(unsafe.Pointer(pPg)).FaCellIdx + libc.Xmemmove(tls, (pCellptr + uintptr((nAdd * 2))), pCellptr, (uint64(nCell * 2))) + if !(pageInsertArray(tls, + pPg, pBegin, bp /* &pData */, pCellptr, + iNew, nAdd, pCArray) != 0) { + goto __6 + } + goto editpage_fail +__6: + ; + nCell = nCell + (nAdd) +__5: + ; + + // Add any overflow cells + i = 0 +__7: + if !(i < int32((*MemPage)(unsafe.Pointer(pPg)).FnOverflow)) { + goto __9 + } + iCell = ((iOld + int32(*(*U16)(unsafe.Pointer((pPg + 28 /* &.aiOvfl */) + uintptr(i)*2)))) - iNew) + if !((iCell >= 0) && (iCell < nNew)) { + goto __10 + } + pCellptr = ((*MemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr((iCell * 2))) + if !(nCell > iCell) { + goto __11 + } + libc.Xmemmove(tls, (pCellptr + 2), pCellptr, (uint64((nCell - iCell) * 2))) +__11: + ; + nCell++ + cachedCellSize(tls, pCArray, (iCell + iNew)) + if !(pageInsertArray(tls, + pPg, pBegin, bp /* &pData */, pCellptr, + (iCell+iNew), 1, pCArray) != 0) { + goto __12 + } + goto editpage_fail +__12: + ; +__10: + ; + goto __8 +__8: + i++ + goto __7 + goto __9 +__9: + ; + + // Append cells to the end of the page + + pCellptr = ((*MemPage)(unsafe.Pointer(pPg)).FaCellIdx + uintptr((nCell * 2))) + if !(pageInsertArray(tls, + pPg, pBegin, bp /* &pData */, pCellptr, + (iNew+nCell), (nNew-nCell), pCArray) != 0) { + goto __13 + } + goto editpage_fail +__13: + ; + + (*MemPage)(unsafe.Pointer(pPg)).FnCell = U16(nNew) + (*MemPage)(unsafe.Pointer(pPg)).FnOverflow = U8(0) + + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 3))))) = (U8((int32((*MemPage)(unsafe.Pointer(pPg)).FnCell)) >> 8)) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 3))) + 1)) = U8((*MemPage)(unsafe.Pointer(pPg)).FnCell) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5))))) = (U8(((int64(*(*uintptr)(unsafe.Pointer(bp /* pData */))) - int64(aData)) / 1) >> 8)) + *(*U8)(unsafe.Pointer((aData + uintptr((hdr + 5))) + 1)) = (U8((int64(*(*uintptr)(unsafe.Pointer(bp /* pData */))) - int64(aData)) / 1)) + + return SQLITE_OK +editpage_fail: + // Unable to edit this page. Rebuild it from scratch instead. + populateCellCache(tls, pCArray, iNew, nNew) + return rebuildPage(tls, pCArray, iNew, nNew, pPg) +} + +// This version of balance() handles the common special case where +// a new entry is being inserted on the extreme right-end of the +// tree, in other words, when the new entry will become the largest +// entry in the tree. +// +// Instead of trying to balance the 3 right-most leaf pages, just add +// a new page to the right-hand side and put the one new entry in +// that page. This leaves the right side of the tree somewhat +// unbalanced. But odds are that we will be inserting new entries +// at the end soon afterwards so the nearly empty page will quickly +// fill up. On average. +// +// pPage is the leaf page which is the right-most page in the tree. +// pParent is its parent. pPage must have a single overflow entry +// which is also the right-most entry on the page. +// +// The pSpace buffer is used to store a temporary copy of the divider +// cell that will be inserted into pParent. Such a cell consists of a 4 +// byte page number followed by a variable length integer. In other +// words, at most 13 bytes. Hence the pSpace buffer must be at +// least 13 bytes in size. +func balance_quick(tls *libc.TLS, pParent uintptr, pPage uintptr, pSpace uintptr) int32 { /* sqlite3.c:72791:12: */ + bp := tls.Alloc(140) + defer tls.Free(140) + + var pBt uintptr = (*MemPage)(unsafe.Pointer(pPage)).FpBt // B-Tree Database + // var pNew uintptr at bp, 8 + // Newly allocated page + // var rc int32 at bp+136, 4 + // Return Code + // var pgnoNew Pgno at bp+8, 4 + // Page number of pNew + + if int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) == 0 { + return Xsqlite3CorruptError(tls, 72801) + } // dbfuzz001.test + + // Allocate a new page. This page will become the right-sibling of + // pPage. Make the parent page writable, so that the new divider cell + // may be inserted. If both these operations are successful, proceed. + *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) = allocateBtreePage(tls, pBt, bp /* &pNew */, bp+8 /* &pgnoNew */, uint32(0), uint8(0)) + + if *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) == SQLITE_OK { + + var pOut uintptr = (pSpace + 4) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)) = *(*uintptr)(unsafe.Pointer((pPage + 40 /* &.apOvfl */))) + *(*U16)(unsafe.Pointer(bp + 24 /* szCell */)) = (*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pPage + 120 /* &.xCellSize */))))(tls, pPage, *(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */))) + var pStop uintptr + // var b CellArray at bp+32, 104 + + zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */)), ((PTF_INTKEY | PTF_LEAFDATA) | PTF_LEAF)) + (*CellArray)(unsafe.Pointer(bp + 32 /* &b */)).FnCell = 1 + (*CellArray)(unsafe.Pointer(bp + 32 /* &b */)).FpRef = pPage + (*CellArray)(unsafe.Pointer(bp + 32 /* &b */)).FapCell = bp + 16 /* &pCell */ + (*CellArray)(unsafe.Pointer(bp + 32 /* &b */)).FszCell = bp + 24 /* &szCell */ + *(*uintptr)(unsafe.Pointer((bp + 32 /* &b */ + 32 /* &.apEnd */))) = (*MemPage)(unsafe.Pointer(pPage)).FaDataEnd + *(*int32)(unsafe.Pointer((bp + 32 /* &b */ + 80 /* &.ixNx */))) = 2 + *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) = rebuildPage(tls, bp+32 /* &b */, 0, 1, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + if *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) != 0 { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + return *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) + } + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).FnFree = (int32((((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).FcellOffset)) - U32(2)) - U32(*(*U16)(unsafe.Pointer(bp + 24 /* szCell */))))) + + // If this is an auto-vacuum database, update the pointer map + // with entries for the new page, and any pointer from the + // cell on the page to an overflow page. If either of these + // operations fails, the return code is set, but the contents + // of the parent page are still manipulated by thh code below. + // That is Ok, at this point the parent page is guaranteed to + // be marked as dirty. Returning an error code will cause a + // rollback, undoing any changes made to the parent page. + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + ptrmapPut(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoNew */)), uint8(PTRMAP_BTREE), (*MemPage)(unsafe.Pointer(pParent)).Fpgno, bp+136 /* &rc */) + if int32(*(*U16)(unsafe.Pointer(bp + 24 /* szCell */))) > int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).FminLocal) { + ptrmapPutOvflPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */)), *(*uintptr)(unsafe.Pointer(bp /* pNew */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)), bp+136 /* &rc */) + } + } + + // Create a divider cell to insert into pParent. The divider cell + // consists of a 4-byte page number (the page number of pPage) and + // a variable length key value (which must be the same value as the + // largest key on pPage). + // + // To find the largest key value on pPage, first find the right-most + // cell on pPage. The first two fields of this cell are the + // record-length (a variable length integer at most 32-bits in size) + // and the key value (a variable length integer, may have any value). + // The first of the while(...) loops below skips over the record-length + // field. The second while(...) loop copies the key value from the + // cell on pPage into the pSpace buffer. + *(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)) = ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) - 1))))))))))) + pStop = (*(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)) + 9) + for ((int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)), 1)))) & 0x80) != 0) && (*(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)) < pStop) { + } + pStop = (*(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)) + 9) + for (((int32(libc.AssignPtrUint8(libc.PostIncUintptr(&pOut, 1), *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)), 1)))))) & 0x80) != 0) && (*(*uintptr)(unsafe.Pointer(bp + 16 /* pCell */)) < pStop) { + } + + // Insert the new divider cell into pParent. + if *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) == SQLITE_OK { + insertCell(tls, pParent, int32((*MemPage)(unsafe.Pointer(pParent)).FnCell), pSpace, (int32((int64(pOut) - int64(pSpace)) / 1)), + uintptr(0), (*MemPage)(unsafe.Pointer(pPage)).Fpgno, bp+136 /* &rc */) + } + + // Set the right-child pointer of pParent to point to the new page. + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pParent)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pParent)).FhdrOffset) + 8))), *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoNew */))) + + // Release the reference to the new page. + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + } + + return *(*int32)(unsafe.Pointer(bp + 136 /* rc */)) +} + +// This function is used to copy the contents of the b-tree node stored +// on page pFrom to page pTo. If page pFrom was not a leaf page, then +// the pointer-map entries for each child page are updated so that the +// parent page stored in the pointer map is page pTo. If pFrom contained +// any cells with overflow page pointers, then the corresponding pointer +// map entries are also updated so that the parent page is page pTo. +// +// If pFrom is currently carrying any overflow cells (entries in the +// MemPage.apOvfl[] array), they are not copied to pTo. +// +// Before returning, page pTo is reinitialized using btreeInitPage(). +// +// The performance of this function is not critical. It is only used by +// the balance_shallower() and balance_deeper() procedures, neither of +// which are called often under normal circumstances. +func copyNodeContent(tls *libc.TLS, pFrom uintptr, pTo uintptr, pRC uintptr) { /* sqlite3.c:72946:13: */ + if (*(*int32)(unsafe.Pointer(pRC))) == SQLITE_OK { + var pBt uintptr = (*MemPage)(unsafe.Pointer(pFrom)).FpBt + var aFrom uintptr = (*MemPage)(unsafe.Pointer(pFrom)).FaData + var aTo uintptr = (*MemPage)(unsafe.Pointer(pTo)).FaData + var iFromHdr int32 = int32((*MemPage)(unsafe.Pointer(pFrom)).FhdrOffset) + var iToHdr int32 = func() int32 { + if (*MemPage)(unsafe.Pointer(pTo)).Fpgno == Pgno(1) { + return 100 + } + return 0 + }() + var rc int32 + var iData int32 + + // Copy the b-tree node content from page pFrom to page pTo. + iData = ((int32(*(*U8)(unsafe.Pointer((aFrom + uintptr((iFromHdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((aFrom + uintptr((iFromHdr + 5))) + 1)))) + libc.Xmemcpy(tls, (aTo + uintptr(iData)), (aFrom + uintptr(iData)), (uint64((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(iData)))) + libc.Xmemcpy(tls, (aTo + uintptr(iToHdr)), (aFrom + uintptr(iFromHdr)), (uint64(int32((*MemPage)(unsafe.Pointer(pFrom)).FcellOffset) + (2 * int32((*MemPage)(unsafe.Pointer(pFrom)).FnCell))))) + + // Reinitialize page pTo so that the contents of the MemPage structure + // match the new data. The initialization of pTo can actually fail under + // fairly obscure circumstances, even though it is a copy of initialized + // page pFrom. + (*MemPage)(unsafe.Pointer(pTo)).FisInit = U8(0) + rc = btreeInitPage(tls, pTo) + if rc == SQLITE_OK { + rc = btreeComputeFreeSpace(tls, pTo) + } + if rc != SQLITE_OK { + *(*int32)(unsafe.Pointer(pRC)) = rc + return + } + + // If this is an auto-vacuum database, update the pointer-map entries + // for any b-tree or overflow pages that pTo now contains the pointers to. + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + *(*int32)(unsafe.Pointer(pRC)) = setChildPtrmaps(tls, pTo) + } + } +} + +// This routine redistributes cells on the iParentIdx'th child of pParent +// (hereafter "the page") and up to 2 siblings so that all pages have about the +// same amount of free space. Usually a single sibling on either side of the +// page are used in the balancing, though both siblings might come from one +// side if the page is the first or last child of its parent. If the page +// has fewer than 2 siblings (something which can only happen if the page +// is a root page or a child of a root page) then all available siblings +// participate in the balancing. +// +// The number of siblings of the page might be increased or decreased by +// one or two in an effort to keep pages nearly full but not over full. +// +// Note that when this routine is called, some of the cells on the page +// might not actually be stored in MemPage.aData[]. This can happen +// if the page is overfull. This routine ensures that all cells allocated +// to the page and its siblings fit into MemPage.aData[] before returning. +// +// In the course of balancing the page and its siblings, cells may be +// inserted into or removed from the parent page (pParent). Doing so +// may cause the parent page to become overfull or underfull. If this +// happens, it is the responsibility of the caller to invoke the correct +// balancing routine to fix this problem (see the balance() routine). +// +// If this routine fails for any reason, it might leave the database +// in a corrupted state. So if this routine fails, the database should +// be rolled back. +// +// The third argument to this function, aOvflSpace, is a pointer to a +// buffer big enough to hold one page. If while inserting cells into the parent +// page (pParent) the parent page becomes overfull, this buffer is +// used to store the parent's overflow cells. Because this function inserts +// a maximum of four divider cells into the parent page, and the maximum +// size of a cell stored within an internal node is always less than 1/4 +// of the page-size, the aOvflSpace[] buffer is guaranteed to be large +// enough for all overflow cells. +// +// If aOvflSpace is set to a null pointer, this function returns +// SQLITE_NOMEM. +func balance_nonroot(tls *libc.TLS, pParent uintptr, iParentIdx int32, aOvflSpace uintptr, isRoot int32, bBulk int32) int32 { /* sqlite3.c:73028:12: */ + bp := tls.Alloc(352) + defer tls.Free(352) + + var pBt uintptr // The whole database + var nMaxCells int32 // Allocated size of apCell, szCell, aFrom. + var nNew int32 // Number of pages in apNew[] + var nOld int32 // Number of pages in apOld[] + var i int32 + var j int32 + var k int32 // Loop counters + var nxDiv int32 // Next divider slot in pParent->aCell[] + // var rc int32 at bp+68, 4 + // The return code + var leafCorrection U16 // 4 if pPage is a leaf. 0 if not + var leafData int32 // True if pPage is a leaf of a LEAFDATA tree + var usableSpace int32 // Bytes in pPage beyond the header + var pageFlags int32 // Value of pPage->aData[0] + var iSpace1 int32 // First unused byte of aSpace1[] + var iOvflSpace int32 // First unused byte of aOvflSpace[] + var szScratch int32 // Size of scratch memory requested + // var apOld [3]uintptr at bp+8, 24 + // pPage and up to two siblings + // var apNew [5]uintptr at bp+224, 40 + // pPage and up to NB siblings after balancing + var pRight uintptr // Location in parent of right-sibling pointer + // var apDiv [2]uintptr at bp+32, 16 + // Divider cells in pParent + // var cntNew [5]int32 at bp+200, 20 + // Index in b.paCell[] of cell after i-th page + // var cntOld [5]int32 at bp+72, 20 + // Old index in b.apCell[] + // var szNew [5]int32 at bp+48, 20 + // Combined size of cells placed on i-th page + var aSpace1 uintptr // Space for copies of dividers cells + // var pgno Pgno at bp+272, 4 + // Temp var to store a page number in + // var abDone [5]U8 at bp, 5 + // True after i'th new page is populated + // var aPgno [5]Pgno at bp+296, 20 + // Page numbers of new pages before shuffling + // var aPgOrder [5]Pgno at bp+276, 20 + // Copy of aPgno[] used for sorting pages + // var aPgFlags [5]U16 at bp+316, 10 + // flags field of new pages before shuffling + // var b CellArray at bp+96, 104 + + var iOff int32 + var sz U16 + var pTemp uintptr + var pOld uintptr + var limit int32 + var aData uintptr + var maskPage U16 + var piCell uintptr + var piEnd uintptr + var p uintptr + var sz1 int32 + var szRight int32 // Size of sibling on the right + var szLeft int32 // Size of sibling on the left + var r int32 // Index of right-most cell in left sibling + var d int32 + // var pNew uintptr at bp+264, 8 + + var iBest int32 + var pOld1 uintptr + var pCell uintptr + var pOld2 uintptr + var pNew1 uintptr + var cntOldNext int32 + var iNew int32 + var iOld int32 + // If the tree is a leaf-data tree, and the siblings are leaves, + // then there is no divider cell in b.apCell[]. Instead, the divider + // cell consists of the integer key for the right-most cell of + // the sibling-page assembled above only. + // var info CellInfo at bp+328, 24 + + var pCell1 uintptr + var pTemp1 uintptr + var sz2 int32 + var pSrcEnd uintptr + var pNew2 uintptr + var iNew1 int32 + var iOld1 int32 + var nNewCell int32 + var iPg int32 + var key U32 + nMaxCells = 0 + nNew = 0 + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = SQLITE_OK + iSpace1 = 0 + iOvflSpace = 0 // Parsed information on cells being balanced + + libc.Xmemset(tls, bp /* &abDone[0] */, 0, uint64(unsafe.Sizeof([5]U8{}))) + (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FnCell = 0 + (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FapCell = uintptr(0) + pBt = (*MemPage)(unsafe.Pointer(pParent)).FpBt + + // At this point pParent may have at most one overflow cell. And if + // this overflow cell is present, it must be the cell with + // index iParentIdx. This scenario comes about when this function + // is called (indirectly) from sqlite3BtreeDelete(). + + if !(!(aOvflSpace != 0)) { + goto __1 + } + return SQLITE_NOMEM +__1: + ; + + // Find the sibling pages to balance. Also locate the cells in pParent + // that divide the siblings. An attempt is made to find NN siblings on + // either side of pPage. More siblings are taken from one side, however, + // if there are fewer than NN siblings on the other side. If pParent + // has NB or fewer children then all children of pParent are taken. + // + // This loop also drops the divider cells from the parent page. This + // way, the remainder of the function does not have to deal with any + // overflow cells in the parent page, since if any existed they will + // have already been removed. + i = (int32((*MemPage)(unsafe.Pointer(pParent)).FnOverflow) + int32((*MemPage)(unsafe.Pointer(pParent)).FnCell)) + if !(i < 2) { + goto __2 + } + nxDiv = 0 + goto __3 +__2: + ; + if !(iParentIdx == 0) { + goto __4 + } + nxDiv = 0 + goto __5 +__4: + if !(iParentIdx == i) { + goto __6 + } + nxDiv = ((i - 2) + bBulk) + goto __7 +__6: + nxDiv = (iParentIdx - 1) +__7: + ; +__5: + ; + i = (2 - bBulk) +__3: + ; + nOld = (i + 1) + if !(((i + nxDiv) - int32((*MemPage)(unsafe.Pointer(pParent)).FnOverflow)) == int32((*MemPage)(unsafe.Pointer(pParent)).FnCell)) { + goto __8 + } + pRight = ((*MemPage)(unsafe.Pointer(pParent)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pParent)).FhdrOffset) + 8))) + goto __9 +__8: + pRight = ((*MemPage)(unsafe.Pointer((pParent))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pParent))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pParent))).FaCellIdx + uintptr((2 * ((i + nxDiv) - int32((*MemPage)(unsafe.Pointer(pParent)).FnOverflow)))))))))))) +__9: + ; + *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)) = Xsqlite3Get4byte(tls, pRight) +__10: + if !(1 != 0) { + goto __11 + } + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) == SQLITE_OK) { + goto __12 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = getAndInitPage(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)), (bp + 8 /* &apOld */ + uintptr(i)*8), uintptr(0), 0) +__12: + ; + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != 0) { + goto __13 + } + libc.Xmemset(tls, bp+8 /* &apOld[0] */, 0, ((uint64(i + 1)) * uint64(unsafe.Sizeof(uintptr(0))))) + goto balance_cleanup +__13: + ; + if !((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8)))).FnFree < 0) { + goto __14 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = btreeComputeFreeSpace(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8))) + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != 0) { + goto __15 + } + libc.Xmemset(tls, bp+8 /* &apOld[0] */, 0, ((uint64(i)) * uint64(unsafe.Sizeof(uintptr(0))))) + goto balance_cleanup +__15: + ; +__14: + ; + if !((libc.PostDecInt32(&i, 1)) == 0) { + goto __16 + } + goto __11 +__16: + ; + + if !(((*MemPage)(unsafe.Pointer(pParent)).FnOverflow != 0) && ((i + nxDiv) == int32(*(*U16)(unsafe.Pointer((pParent + 28 /* &.aiOvfl */)))))) { + goto __17 + } + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((pParent + 40 /* &.apOvfl */))) + *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)) = Xsqlite3Get4byte(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8))) + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) = int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pParent + 120 /* &.xCellSize */))))(tls, pParent, *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)))) + (*MemPage)(unsafe.Pointer(pParent)).FnOverflow = U8(0) + goto __18 +__17: + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)) = ((*MemPage)(unsafe.Pointer((pParent))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pParent))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pParent))).FaCellIdx + uintptr((2 * ((i + nxDiv) - int32((*MemPage)(unsafe.Pointer(pParent)).FnOverflow)))))))))))) + *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)) = Xsqlite3Get4byte(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8))) + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) = int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pParent + 120 /* &.xCellSize */))))(tls, pParent, *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)))) + + // Drop the cell from the parent page. apDiv[i] still points to + // the cell within the parent, even though it has been dropped. + // This is safe because dropping a cell only overwrites the first + // four bytes of it, and this function does not need the first + // four bytes of the divider cell. So the pointer is safe to use + // later on. + // + // But not if we are in secure-delete mode. In secure-delete mode, + // the dropCell() routine will overwrite the entire cell with zeroes. + // In this case, temporarily copy the cell into the aOvflSpace[] + // buffer. It will be copied out again as soon as the aSpace[] buffer + // is allocated. + if !((int32((*BtShared)(unsafe.Pointer(pBt)).FbtsFlags) & BTS_FAST_SECURE) != 0) { + goto __19 + } + + // If the following if() condition is not true, the db is corrupted. + // The call to dropCell() below will detect this. + iOff = ((int32(*(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)))) - (int32((*MemPage)(unsafe.Pointer(pParent)).FaData))) + if !((iOff + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4))) <= int32((*BtShared)(unsafe.Pointer(pBt)).FusableSize)) { + goto __20 + } + libc.Xmemcpy(tls, (aOvflSpace + uintptr(iOff)), *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)), uint64(*(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)))) + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)) = (aOvflSpace + uintptr(((int64(*(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8))) - int64((*MemPage)(unsafe.Pointer(pParent)).FaData)) / 1))) +__20: + ; +__19: + ; + dropCell(tls, pParent, ((i + nxDiv) - int32((*MemPage)(unsafe.Pointer(pParent)).FnOverflow)), *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)), bp+68 /* &rc */) +__18: + ; + goto __10 +__11: + ; + + // Make nMaxCells a multiple of 4 in order to preserve 8-byte + // alignment + nMaxCells = (int32(U32(nOld) * ((((*BtShared)(unsafe.Pointer(pBt)).FpageSize - U32(8)) / U32(6)) + (U32((int32(uint64(unsafe.Sizeof([4]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))))))))) + nMaxCells = ((nMaxCells + 3) & libc.CplInt32(3)) + + // Allocate space for memory structures + szScratch = (int32(((uint64(nMaxCells) * uint64(unsafe.Sizeof(uintptr(0)))) + // b.apCell + (uint64(nMaxCells) * uint64(unsafe.Sizeof(U16(0))))) + // b.szCell + uint64((*BtShared)(unsafe.Pointer(pBt)).FpageSize))) // aSpace1 + + (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FapCell = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(szScratch)) + if !((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell == uintptr(0)) { + goto __21 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = SQLITE_NOMEM + goto balance_cleanup +__21: + ; + (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FszCell = ((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr(nMaxCells)*8) + aSpace1 = ((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(nMaxCells)*2) + + // Load pointers to all cells on sibling pages and the divider cells + // into the local b.apCell[] array. Make copies of the divider cells + // into space obtained from aSpace1[]. The divider cells have already + // been removed from pParent. + // + // If the siblings are on leaf pages, then the child pointers of the + // divider cells are stripped from the cells before they are copied + // into aSpace1[]. In this way, all cells in b.apCell[] are without + // child pointers. If siblings are not leaves, then all cell in + // b.apCell[] include child pointers. Either way, all cells in b.apCell[] + // are alike. + // + // leafCorrection: 4 if pPage is a leaf. 0 if pPage is not a leaf. + // leafData: 1 if pPage holds key+data and pParent holds only keys. + (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FpRef = *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */)) + leafCorrection = (U16(int32((*MemPage)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FpRef)).Fleaf) * 4)) + leafData = int32((*MemPage)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FpRef)).FintKeyLeaf) + i = 0 +__22: + if !(i < nOld) { + goto __24 + } + pOld = *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8)) + limit = int32((*MemPage)(unsafe.Pointer(pOld)).FnCell) + aData = (*MemPage)(unsafe.Pointer(pOld)).FaData + maskPage = (*MemPage)(unsafe.Pointer(pOld)).FmaskPage + piCell = (aData + uintptr((*MemPage)(unsafe.Pointer(pOld)).FcellOffset)) + + // Verify that all sibling pages are of the same "type" (table-leaf, + // table-interior, index-leaf, or index-interior). + if !(int32(*(*U8)(unsafe.Pointer((*MemPage)(unsafe.Pointer(pOld)).FaData))) != int32(*(*U8)(unsafe.Pointer((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */)))).FaData)))) { + goto __25 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73225) + goto balance_cleanup +__25: + ; + + // Load b.apCell[] with pointers to all cells in pOld. If pOld + // contains overflow cells, include them in the b.apCell[] array + // in the correct spot. + // + // Note that when there are multiple overflow cells, it is always the + // case that they are sequential and adjacent. This invariant arises + // because multiple overflows can only occurs when inserting divider + // cells into a parent on a prior balance, and divider cells are always + // adjacent and are inserted in order. There is an assert() tagged + // with "NOTE 1" in the overflow cell insertion loop to prove this + // invariant. + // + // This must be done in advance. Once the balance starts, the cell + // offset section of the btree page will be overwritten and we will no + // long be able to find the cells if a pointer to each cell is not saved + // first. + libc.Xmemset(tls, ((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*2), 0, (uint64(unsafe.Sizeof(U16(0))) * (uint64(limit + int32((*MemPage)(unsafe.Pointer(pOld)).FnOverflow))))) + if !(int32((*MemPage)(unsafe.Pointer(pOld)).FnOverflow) > 0) { + goto __26 + } + if !(limit < int32(*(*U16)(unsafe.Pointer((pOld + 28 /* &.aiOvfl */))))) { + goto __27 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73249) + goto balance_cleanup +__27: + ; + limit = int32(*(*U16)(unsafe.Pointer((pOld + 28 /* &.aiOvfl */)))) + j = 0 +__28: + if !(j < limit) { + goto __30 + } + *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*8)) = (aData + uintptr((int32(maskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(piCell))))))) + piCell += uintptr(2) + (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell++ + goto __29 +__29: + j++ + goto __28 + goto __30 +__30: + ; + k = 0 +__31: + if !(k < int32((*MemPage)(unsafe.Pointer(pOld)).FnOverflow)) { + goto __33 + } + // NOTE 1 + *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*8)) = *(*uintptr)(unsafe.Pointer((pOld + 40 /* &.apOvfl */) + uintptr(k)*8)) + (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell++ + goto __32 +__32: + k++ + goto __31 + goto __33 +__33: + ; +__26: + ; + piEnd = ((aData + uintptr((*MemPage)(unsafe.Pointer(pOld)).FcellOffset)) + uintptr((2 * int32((*MemPage)(unsafe.Pointer(pOld)).FnCell)))) +__34: + if !(piCell < piEnd) { + goto __35 + } + + *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*8)) = (aData + uintptr((int32(maskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(piCell))))))) + piCell += uintptr(2) + (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell++ + goto __34 +__35: + ; + + *(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr(i)*4)) = (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FnCell + if !((i < (nOld - 1)) && !(leafData != 0)) { + goto __36 + } + sz = U16(*(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4))) + + *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*2)) = sz + pTemp = (aSpace1 + uintptr(iSpace1)) + iSpace1 = iSpace1 + (int32(sz)) + + libc.Xmemcpy(tls, pTemp, *(*uintptr)(unsafe.Pointer(bp + 32 /* &apDiv[0] */ + uintptr(i)*8)), uint64(sz)) + *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*8)) = (pTemp + uintptr(leafCorrection)) + + *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*2)) = (U16(int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*2))) - int32(leafCorrection))) + if !(!(int32((*MemPage)(unsafe.Pointer(pOld)).Fleaf) != 0)) { + goto __37 + } + + // The right pointer of the child page pOld becomes the left + // pointer of the divider cell + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*8)), ((*MemPage)(unsafe.Pointer(pOld)).FaData + 8), uint64(4)) + goto __38 +__37: + ; +__39: + if !(int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*2))) < 4) { + goto __40 + } + // Do not allow any cells smaller than 4 bytes. If a smaller cell + // does exist, pad it with 0x00 bytes. + + *(*U8)(unsafe.Pointer(aSpace1 + uintptr(libc.PostIncInt32(&iSpace1, 1)))) = U8(0x00) + *(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell)*2))++ + goto __39 +__40: + ; +__38: + ; + (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell++ +__36: + ; + goto __23 +__23: + i++ + goto __22 + goto __24 +__24: + ; + + // Figure out the number of pages needed to hold all b.nCell cells. + // Store this number in "k". Also compute szNew[] which is the total + // size of all cells on the i-th page and cntNew[] which is the index + // in b.apCell[] of the cell that divides page i from page i+1. + // cntNew[k] should equal b.nCell. + // + // Values computed by this block: + // + // k: The total number of sibling pages + // szNew[i]: Spaced used on the i-th sibling page. + // cntNew[i]: Index in b.apCell[] and b.szCell[] for the first cell to + // the right of the i-th sibling page. + // usableSpace: Number of bytes of space available on each sibling. + // + usableSpace = (int32(((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(12)) + U32(leafCorrection))) + i = libc.AssignInt32(&k, 0) +__41: + if !(i < nOld) { + goto __43 + } + p = *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer((bp + 96 /* &b */ + 32 /* &.apEnd */) + uintptr(k)*8)) = (*MemPage)(unsafe.Pointer(p)).FaDataEnd + *(*int32)(unsafe.Pointer((bp + 96 /* &b */ + 80 /* &.ixNx */) + uintptr(k)*4)) = *(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr(i)*4)) + if !((k != 0) && (*(*int32)(unsafe.Pointer((bp + 96 /* &b */ + 80 /* &.ixNx */) + uintptr(k)*4)) == *(*int32)(unsafe.Pointer((bp + 96 /* &b */ + 80 /* &.ixNx */) + uintptr((k-1))*4)))) { + goto __44 + } + k-- // Omit b.ixNx[] entry for child pages with no cells +__44: + ; + if !(!(leafData != 0)) { + goto __45 + } + k++ + *(*uintptr)(unsafe.Pointer((bp + 96 /* &b */ + 32 /* &.apEnd */) + uintptr(k)*8)) = (*MemPage)(unsafe.Pointer(pParent)).FaDataEnd + *(*int32)(unsafe.Pointer((bp + 96 /* &b */ + 80 /* &.ixNx */) + uintptr(k)*4)) = (*(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr(i)*4)) + 1) +__45: + ; + + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) = (usableSpace - (*MemPage)(unsafe.Pointer(p)).FnFree) + j = 0 +__46: + if !(j < int32((*MemPage)(unsafe.Pointer(p)).FnOverflow)) { + goto __48 + } + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew */ + uintptr(i)*4)) += (2 + int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((p + 120 /* &.xCellSize */))))(tls, p, *(*uintptr)(unsafe.Pointer((p + 40 /* &.apOvfl */) + uintptr(j)*8))))) + goto __47 +__47: + j++ + goto __46 + goto __48 +__48: + ; + *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) = *(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr(i)*4)) + goto __42 +__42: + i++ + k++ + goto __41 + goto __43 +__43: + ; + k = nOld + i = 0 +__49: + if !(i < k) { + goto __51 + } +__52: + if !(*(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) > usableSpace) { + goto __53 + } + if !((i + 1) >= k) { + goto __54 + } + k = (i + 2) + if !(k > (NB + 2)) { + goto __55 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73350) + goto balance_cleanup +__55: + ; + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr((k-1))*4)) = 0 + *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((k-1))*4)) = (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FnCell +__54: + ; + sz1 = (2 + int32(cachedCellSize(tls, bp+96 /* &b */, (*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4))-1)))) + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew */ + uintptr(i)*4)) -= (sz1) + if !(!(leafData != 0)) { + goto __56 + } + if !(*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) < (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell) { + goto __57 + } + sz1 = (2 + int32(cachedCellSize(tls, bp+96 /* &b */, *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4))))) + goto __58 +__57: + sz1 = 0 +__58: + ; +__56: + ; + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew */ + uintptr((i+1))*4)) += (sz1) + *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4))-- + goto __52 +__53: + ; +__59: + if !(*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) < (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell) { + goto __60 + } + sz1 = (2 + int32(cachedCellSize(tls, bp+96 /* &b */, *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4))))) + if !((*(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) + sz1) > usableSpace) { + goto __61 + } + goto __60 +__61: + ; + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew */ + uintptr(i)*4)) += (sz1) + *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4))++ + if !(!(leafData != 0)) { + goto __62 + } + if !(*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) < (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell) { + goto __63 + } + sz1 = (2 + int32(cachedCellSize(tls, bp+96 /* &b */, *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4))))) + goto __64 +__63: + sz1 = 0 +__64: + ; +__62: + ; + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew */ + uintptr((i+1))*4)) -= (sz1) + goto __59 +__60: + ; + if !(*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) >= (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell) { + goto __65 + } + k = (i + 1) + goto __66 +__65: + if !(*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) <= (func() int32 { + if i > 0 { + return *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((i-1))*4)) + } + return 0 + }())) { + goto __67 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73383) + goto balance_cleanup +__67: + ; +__66: + ; + goto __50 +__50: + i++ + goto __49 + goto __51 +__51: + ; + + // The packing computed by the previous block is biased toward the siblings + // on the left side (siblings with smaller keys). The left siblings are + // always nearly full, while the right-most sibling might be nearly empty. + // The next block of code attempts to adjust the packing of siblings to + // get a better balance. + // + // This adjustment is more than an optimization. The packing above might + // be so out of balance as to be illegal. For example, the right-most + // sibling might be completely empty. This adjustment is not optional. + i = (k - 1) +__68: + if !(i > 0) { + goto __70 + } + szRight = *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) // Size of sibling on the right + szLeft = *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr((i-1))*4)) // Index of first cell to the left of right sibling + + r = (*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((i-1))*4)) - 1) + d = ((r + 1) - leafData) + cachedCellSize(tls, bp+96 /* &b */, d) +__71: + ; + + cachedCellSize(tls, bp+96 /* &b */, r) + if !((szRight != 0) && + ((bBulk != 0) || (((szRight + int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(d)*2)))) + 2) > (szLeft - (int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(r)*2))) + (func() int32 { + if i == (k - 1) { + return 0 + } + return 2 + }())))))) { + goto __74 + } + goto __73 +__74: + ; + szRight = szRight + (int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(d)*2))) + 2) + szLeft = szLeft - (int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(r)*2))) + 2) + *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((i-1))*4)) = r + r-- + d-- + goto __72 +__72: + if r >= 0 { + goto __71 + } + goto __73 +__73: + ; + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(i)*4)) = szRight + *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr((i-1))*4)) = szLeft + if !(*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((i-1))*4)) <= (func() int32 { + if i > 1 { + return *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((i-2))*4)) + } + return 0 + }())) { + goto __75 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73425) + goto balance_cleanup +__75: + ; + goto __69 +__69: + i-- + goto __68 + goto __70 +__70: + ; + + // Sanity check: For a non-corrupt database file one of the follwing + // must be true: + // (1) We found one or more cells (cntNew[0])>0), or + // (2) pPage is a virtual root page. A virtual root page is when + // the real root page is page 1 and we are the only child of + // that page. + + // Allocate k new pages. Reuse old pages where possible. + pageFlags = int32(*(*U8)(unsafe.Pointer((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */)))).FaData))) + i = 0 +__76: + if !(i < k) { + goto __78 + } + if !(i < nOld) { + goto __79 + } + *(*uintptr)(unsafe.Pointer(bp + 264 /* pNew */)) = libc.AssignPtrUintptr(bp+224 /* &apNew */ +uintptr(i)*8, *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 264 /* pNew */)))).FpDbPage) + nNew++ + if !(Xsqlite3PagerPageRefcount(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 264 /* pNew */)))).FpDbPage) != (1 + (libc.Bool32(i == (iParentIdx - nxDiv))))) { + goto __81 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73456) +__81: + ; + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != 0) { + goto __82 + } + goto balance_cleanup +__82: + ; + goto __80 +__79: + ; + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = allocateBtreePage(tls, pBt, bp+264 /* &pNew */, bp+272 /* &pgno */, func() uint32 { + if bBulk != 0 { + return uint32(1) + } + return *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)) + }(), uint8(0)) + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != 0) { + goto __83 + } + goto balance_cleanup +__83: + ; + zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp + 264 /* pNew */)), pageFlags) + *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(bp + 264 /* pNew */)) + nNew++ + *(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr(i)*4)) = (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FnCell + + // Set the pointer-map entry for the new sibling page. + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __84 + } + ptrmapPut(tls, pBt, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 264 /* pNew */)))).Fpgno, uint8(PTRMAP_BTREE), (*MemPage)(unsafe.Pointer(pParent)).Fpgno, bp+68 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != SQLITE_OK) { + goto __85 + } + goto balance_cleanup +__85: + ; +__84: + ; +__80: + ; + goto __77 +__77: + i++ + goto __76 + goto __78 +__78: + ; + + // Reassign page numbers so that the new pages are in ascending order. + // This helps to keep entries in the disk file in order so that a scan + // of the table is closer to a linear scan through the file. That in turn + // helps the operating system to deliver pages from the disk more rapidly. + // + // An O(n^2) insertion sort algorithm is used, but since n is never more + // than (NB+2) (a small constant), that should not be a problem. + // + // When NB==3, this one optimization makes the database about 25% faster + // for large insertions and deletions. + i = 0 +__86: + if !(i < nNew) { + goto __88 + } + *(*Pgno)(unsafe.Pointer(bp + 276 /* &aPgOrder[0] */ + uintptr(i)*4)) = libc.AssignPtrUint32(bp+296 /* &aPgno */ +uintptr(i)*4, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)))).Fpgno) + *(*U16)(unsafe.Pointer(bp + 316 /* &aPgFlags[0] */ + uintptr(i)*2)) = (*DbPage)(unsafe.Pointer((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)))).FpDbPage)).Fflags + j = 0 +__89: + if !(j < i) { + goto __91 + } + if !(*(*Pgno)(unsafe.Pointer(bp + 296 /* &aPgno[0] */ + uintptr(j)*4)) == *(*Pgno)(unsafe.Pointer(bp + 296 /* &aPgno[0] */ + uintptr(i)*4))) { + goto __92 + } + // This branch is taken if the set of sibling pages somehow contains + // duplicate entries. This can happen if the database is corrupt. + // It would be simpler to detect this as part of the loop below, but + // we do the detection here in order to avoid populating the pager + // cache with two separate objects associated with the same + // page number. + + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73502) + goto balance_cleanup +__92: + ; + goto __90 +__90: + j++ + goto __89 + goto __91 +__91: + ; + goto __87 +__87: + i++ + goto __86 + goto __88 +__88: + ; + i = 0 +__93: + if !(i < nNew) { + goto __95 + } + iBest = 0 // aPgno[] index of page number to use + j = 1 +__96: + if !(j < nNew) { + goto __98 + } + if !(*(*Pgno)(unsafe.Pointer(bp + 276 /* &aPgOrder[0] */ + uintptr(j)*4)) < *(*Pgno)(unsafe.Pointer(bp + 276 /* &aPgOrder[0] */ + uintptr(iBest)*4))) { + goto __99 + } + iBest = j +__99: + ; + goto __97 +__97: + j++ + goto __96 + goto __98 +__98: + ; + *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)) = *(*Pgno)(unsafe.Pointer(bp + 276 /* &aPgOrder[0] */ + uintptr(iBest)*4)) + *(*Pgno)(unsafe.Pointer(bp + 276 /* &aPgOrder[0] */ + uintptr(iBest)*4)) = 0xffffffff + if !(iBest != i) { + goto __100 + } + if !(iBest > i) { + goto __101 + } + Xsqlite3PagerRekey(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(iBest)*8)))).FpDbPage, (((*BtShared)(unsafe.Pointer(pBt)).FnPage + U32(iBest)) + U32(1)), uint16(0)) +__101: + ; + Xsqlite3PagerRekey(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)))).FpDbPage, *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)), *(*U16)(unsafe.Pointer(bp + 316 /* &aPgFlags[0] */ + uintptr(iBest)*2))) + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)))).Fpgno = *(*Pgno)(unsafe.Pointer(bp + 272 /* pgno */)) +__100: + ; + goto __94 +__94: + i++ + goto __93 + goto __95 +__95: + ; + + Xsqlite3Put4byte(tls, pRight, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr((nNew-1))*8)))).Fpgno) + + // If the sibling pages are not leaves, ensure that the right-child pointer + // of the right-most new sibling page is set to the value that was + // originally in the same field of the right-most old sibling page. + if !(((pageFlags & PTF_LEAF) == 0) && (nOld != nNew)) { + goto __102 + } + pOld1 = *(*uintptr)(unsafe.Pointer(func() uintptr { + if nNew > nOld { + return bp + 224 /* &apNew[0] */ + } + return bp + 8 /* &apOld[0] */ + }() + uintptr((nOld-1))*8)) + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr((nNew-1))*8)))).FaData + 8), ((*MemPage)(unsafe.Pointer(pOld1)).FaData + 8), uint64(4)) +__102: + ; + + // Make any required updates to pointer map entries associated with + // cells stored on sibling pages following the balance operation. Pointer + // map entries associated with divider cells are set by the insertCell() + // routine. The associated pointer map entries are: + // + // a) if the cell contains a reference to an overflow chain, the + // entry associated with the first page in the overflow chain, and + // + // b) if the sibling pages are not leaves, the child page associated + // with the cell. + // + // If the sibling pages are not leaves, then the pointer map entry + // associated with the right-child of each sibling may also need to be + // updated. This happens below, after the sibling pages have been + // populated, not here. + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __103 + } + pNew1 = libc.AssignUintptr(&pOld2, *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */))) + cntOldNext = (int32((*MemPage)(unsafe.Pointer(pNew1)).FnCell) + int32((*MemPage)(unsafe.Pointer(pNew1)).FnOverflow)) + iNew = 0 + iOld = 0 + + i = 0 +__104: + if !(i < (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FnCell) { + goto __106 + } + pCell = *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr(i)*8)) +__107: + if !(i == cntOldNext) { + goto __108 + } + iOld++ + + if iOld < nNew { + pOld2 = *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(iOld)*8)) + } else { + pOld2 = *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(iOld)*8)) + } + cntOldNext = cntOldNext + ((int32((*MemPage)(unsafe.Pointer(pOld2)).FnCell) + int32((*MemPage)(unsafe.Pointer(pOld2)).FnOverflow)) + libc.BoolInt32(!(leafData != 0))) + goto __107 +__108: + ; + if !(i == *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(iNew)*4))) { + goto __109 + } + pNew1 = *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(libc.PreIncInt32(&iNew, 1))*8)) + if !(!(leafData != 0)) { + goto __110 + } + goto __105 +__110: + ; +__109: + ; + + // Cell pCell is destined for new sibling page pNew. Originally, it + // was either part of sibling page iOld (possibly an overflow cell), + // or else the divider cell to the left of sibling page iOld. So, + // if sibling page iOld had the same page number as pNew, and if + // pCell really was a part of sibling page iOld (not a divider or + // overflow cell), we can skip updating the pointer map entries. + if !(((iOld >= nNew) || + ((*MemPage)(unsafe.Pointer(pNew1)).Fpgno != *(*Pgno)(unsafe.Pointer(bp + 296 /* &aPgno[0] */ + uintptr(iOld)*4)))) || + !((Uptr((pCell)) >= Uptr(((*MemPage)(unsafe.Pointer(pOld2)).FaData))) && (Uptr((pCell)) < Uptr(((*MemPage)(unsafe.Pointer(pOld2)).FaDataEnd))))) { + goto __111 + } + if !(!(leafCorrection != 0)) { + goto __112 + } + ptrmapPut(tls, pBt, Xsqlite3Get4byte(tls, pCell), uint8(PTRMAP_BTREE), (*MemPage)(unsafe.Pointer(pNew1)).Fpgno, bp+68 /* &rc */) +__112: + ; + if !(int32(cachedCellSize(tls, bp+96 /* &b */, i)) > int32((*MemPage)(unsafe.Pointer(pNew1)).FminLocal)) { + goto __113 + } + ptrmapPutOvflPtr(tls, pNew1, pOld2, pCell, bp+68 /* &rc */) +__113: + ; + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != 0) { + goto __114 + } + goto balance_cleanup +__114: + ; +__111: + ; + goto __105 +__105: + i++ + goto __104 + goto __106 +__106: + ; +__103: + ; + + // Insert new divider cells into pParent. + i = 0 +__115: + if !(i < (nNew - 1)) { + goto __117 + } + pNew2 = *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)) + j = *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(i)*4)) + + pCell1 = *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr(j)*8)) + sz2 = (int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(j)*2))) + int32(leafCorrection)) + pTemp1 = (aOvflSpace + uintptr(iOvflSpace)) + if !(!(int32((*MemPage)(unsafe.Pointer(pNew2)).Fleaf) != 0)) { + goto __118 + } + libc.Xmemcpy(tls, ((*MemPage)(unsafe.Pointer(pNew2)).FaData + 8), pCell1, uint64(4)) + goto __119 +__118: + if !(leafData != 0) { + goto __120 + } + j-- + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pNew2 + 128 /* &.xParseCell */))))(tls, pNew2, *(*uintptr)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell + uintptr(j)*8)), bp+328 /* &info */) + pCell1 = pTemp1 + sz2 = (4 + Xsqlite3PutVarint(tls, (pCell1+4), uint64((*CellInfo)(unsafe.Pointer(bp+328 /* &info */)).FnKey))) + pTemp1 = uintptr(0) + goto __121 +__120: + pCell1 -= uintptr(4) + // Obscure case for non-leaf-data trees: If the cell at pCell was + // previously stored on a leaf node, and its reported size was 4 + // bytes, then it may actually be smaller than this + // (see btreeParseCellPtr(), 4 bytes is the minimum size of + // any cell). But it is important to pass the correct size to + // insertCell(), so reparse the cell now. + // + // This can only happen for b-trees used to evaluate "IN (SELECT ...)" + // and WITHOUT ROWID tables with exactly one column which is the + // primary key. + if !(int32(*(*U16)(unsafe.Pointer((*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FszCell + uintptr(j)*2))) == 4) { + goto __122 + } + + sz2 = int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pParent + 120 /* &.xCellSize */))))(tls, pParent, pCell1)) +__122: + ; +__121: + ; +__119: + ; + iOvflSpace = iOvflSpace + (sz2) + + k = 0 +__123: + if !((*(*int32)(unsafe.Pointer((bp + 96 /* &b */ + 80 /* &.ixNx */) + uintptr(k)*4)) <= i) && (k < (NB * 2))) { + goto __125 + } + goto __124 +__124: + k++ + goto __123 + goto __125 +__125: + ; + pSrcEnd = *(*uintptr)(unsafe.Pointer((bp + 96 /* &b */ + 32 /* &.apEnd */) + uintptr(k)*8)) + if !((Uptr((pSrcEnd)) >= Uptr((pCell1))) && (Uptr((pSrcEnd)) < Uptr((pCell1 + uintptr(sz2))))) { + goto __126 + } + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = Xsqlite3CorruptError(tls, 73659) + goto balance_cleanup +__126: + ; + insertCell(tls, pParent, (nxDiv + i), pCell1, sz2, pTemp1, (*MemPage)(unsafe.Pointer(pNew2)).Fpgno, bp+68 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != SQLITE_OK) { + goto __127 + } + goto balance_cleanup +__127: + ; + + goto __116 +__116: + i++ + goto __115 + goto __117 +__117: + ; + + // Now update the actual sibling pages. The order in which they are updated + // is important, as this code needs to avoid disrupting any page from which + // cells may still to be read. In practice, this means: + // + // (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1]) + // then it is not safe to update page apNew[iPg] until after + // the left-hand sibling apNew[iPg-1] has been updated. + // + // (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1]) + // then it is not safe to update page apNew[iPg] until after + // the right-hand sibling apNew[iPg+1] has been updated. + // + // If neither of the above apply, the page is safe to update. + // + // The iPg value in the following loop starts at nNew-1 goes down + // to 0, then back up to nNew-1 again, thus making two passes over + // the pages. On the initial downward pass, only condition (1) above + // needs to be tested because (2) will always be true from the previous + // step. On the upward pass, both conditions are always true, so the + // upwards pass simply processes pages that were missed on the downward + // pass. + i = (1 - nNew) +__128: + if !(i < nNew) { + goto __130 + } + if i < 0 { + iPg = -i + } else { + iPg = i + } + + if !(*(*U8)(unsafe.Pointer(bp /* &abDone[0] */ + uintptr(iPg))) != 0) { + goto __131 + } + goto __129 +__131: + ; // Skip pages already processed + if !((i >= 0) || // On the upwards pass, or... + (*(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr((iPg-1))*4)) >= *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((iPg-1))*4)))) { + goto __132 + } + + // Verify condition (1): If cells are moving left, update iPg + // only after iPg-1 has already been updated. + + // Verify condition (2): If cells are moving right, update iPg + // only after iPg+1 has already been updated. + + if !(iPg == 0) { + goto __133 + } + iNew1 = libc.AssignInt32(&iOld1, 0) + nNewCell = *(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */)) + goto __134 +__133: + if iPg < nOld { + iOld1 = (*(*int32)(unsafe.Pointer(bp + 72 /* &cntOld[0] */ + uintptr((iPg-1))*4)) + libc.BoolInt32(!(leafData != 0))) + } else { + iOld1 = (*CellArray)(unsafe.Pointer(bp + 96 /* &b */)).FnCell + } + iNew1 = (*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr((iPg-1))*4)) + libc.BoolInt32(!(leafData != 0))) + nNewCell = (*(*int32)(unsafe.Pointer(bp + 200 /* &cntNew[0] */ + uintptr(iPg)*4)) - iNew1) +__134: + ; + + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = editPage(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(iPg)*8)), iOld1, iNew1, nNewCell, bp+96 /* &b */) + if !(*(*int32)(unsafe.Pointer(bp + 68 /* rc */)) != 0) { + goto __135 + } + goto balance_cleanup +__135: + ; + *(*U8)(unsafe.Pointer(bp /* &abDone[0] */ + uintptr(iPg)))++ + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(iPg)*8)))).FnFree = (usableSpace - *(*int32)(unsafe.Pointer(bp + 48 /* &szNew[0] */ + uintptr(iPg)*4))) + +__132: + ; + goto __129 +__129: + i++ + goto __128 + goto __130 +__130: + ; + + // All pages have been processed exactly once + + if !(((isRoot != 0) && (int32((*MemPage)(unsafe.Pointer(pParent)).FnCell) == 0)) && (int32((*MemPage)(unsafe.Pointer(pParent)).FhdrOffset) <= (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */)))).FnFree)) { + goto __136 + } + // The root page of the b-tree now contains no cells. The only sibling + // page is the right-child of the parent. Copy the contents of the + // child page into the parent, decreasing the overall height of the + // b-tree structure by one. This is described as the "balance-shallower" + // sub-algorithm in some documentation. + // + // If this is an auto-vacuum database, the call to copyNodeContent() + // sets all pointer-map entries corresponding to database image pages + // for which the pointer is stored within the content being copied. + // + // It is critical that the child page be defragmented before being + // copied into the parent, because if the parent is page 1 then it will + // by smaller than the child due to the database header, and so all the + // free space needs to be up front. + + *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) = defragmentPage(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */)), -1) + + copyNodeContent(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */)), pParent, bp+68 /* &rc */) + freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */)), bp+68 /* &rc */) + goto __137 +__136: + if !(((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && !(leafCorrection != 0)) { + goto __138 + } + // Fix the pointer map entries associated with the right-child of each + // sibling page. All other pointer map entries have already been taken + // care of. + i = 0 +__139: + if !(i < nNew) { + goto __141 + } + key = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)))).FaData + 8)) + ptrmapPut(tls, pBt, key, uint8(PTRMAP_BTREE), (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8)))).Fpgno, bp+68 /* &rc */) + goto __140 +__140: + i++ + goto __139 + goto __141 +__141: + ; +__138: + ; +__137: + ; + + // Free any old pages that were not reused as new pages. + i = nNew +__142: + if !(i < nOld) { + goto __144 + } + freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8)), bp+68 /* &rc */) + goto __143 +__143: + i++ + goto __142 + goto __144 +__144: + ; + + // Cleanup before returning. +balance_cleanup: + Xsqlite3DbFree(tls, uintptr(0), (*CellArray)(unsafe.Pointer(bp+96 /* &b */)).FapCell) + i = 0 +__145: + if !(i < nOld) { + goto __147 + } + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* &apOld[0] */ + uintptr(i)*8))) + goto __146 +__146: + i++ + goto __145 + goto __147 +__147: + ; + i = 0 +__148: + if !(i < nNew) { + goto __150 + } + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* &apNew[0] */ + uintptr(i)*8))) + goto __149 +__149: + i++ + goto __148 + goto __150 +__150: + ; + + return *(*int32)(unsafe.Pointer(bp + 68 /* rc */)) +} + +// This function is called when the root page of a b-tree structure is +// overfull (has one or more overflow pages). +// +// A new child page is allocated and the contents of the current root +// page, including overflow cells, are copied into the child. The root +// page is then overwritten to make it an empty page with the right-child +// pointer pointing to the new page. +// +// Before returning, all pointer-map entries corresponding to pages +// that the new child-page now contains pointers to are updated. The +// entry corresponding to the new right-child pointer of the root +// page is also updated. +// +// If successful, *ppChild is set to contain a reference to the child +// page and SQLITE_OK is returned. In this case the caller is required +// to call releasePage() on *ppChild exactly once. If an error occurs, +// an error code is returned and *ppChild is set to 0. +func balance_deeper(tls *libc.TLS, pRoot uintptr, ppChild uintptr) int32 { /* sqlite3.c:73824:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var rc int32 at bp+12, 4 + // Return value from subprocedures + *(*uintptr)(unsafe.Pointer(bp /* pChild */)) = uintptr(0) // Pointer to a new child page + *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoChild */)) = Pgno(0) // Page number of the new child page + var pBt uintptr = (*MemPage)(unsafe.Pointer(pRoot)).FpBt // The BTree + + // Make pRoot, the root page of the b-tree, writable. Allocate a new + // page that will become the new right-child of pPage. Copy the contents + // of the node stored on pRoot into the new child page. + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pRoot)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = allocateBtreePage(tls, pBt, bp /* &pChild */, bp+8 /* &pgnoChild */, (*MemPage)(unsafe.Pointer(pRoot)).Fpgno, uint8(0)) + copyNodeContent(tls, pRoot, *(*uintptr)(unsafe.Pointer(bp /* pChild */)), bp+12 /* &rc */) + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + ptrmapPut(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoChild */)), uint8(PTRMAP_BTREE), (*MemPage)(unsafe.Pointer(pRoot)).Fpgno, bp+12 /* &rc */) + } + } + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != 0 { + *(*uintptr)(unsafe.Pointer(ppChild)) = uintptr(0) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pChild */))) + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + + // Copy the overflow cells from pRoot to pChild + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp /* pChild */))+28 /* &.aiOvfl */, pRoot+28, /* &.aiOvfl */ + (uint64((*MemPage)(unsafe.Pointer(pRoot)).FnOverflow) * uint64(unsafe.Sizeof(U16(0))))) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp /* pChild */))+40 /* &.apOvfl */, pRoot+40, /* &.apOvfl */ + (uint64((*MemPage)(unsafe.Pointer(pRoot)).FnOverflow) * uint64(unsafe.Sizeof(uintptr(0))))) + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pChild */)))).FnOverflow = (*MemPage)(unsafe.Pointer(pRoot)).FnOverflow + + // Zero the contents of pRoot. Then install pChild as the right-child. + zeroPage(tls, pRoot, (int32(*(*U8)(unsafe.Pointer((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pChild */)))).FaData))) & libc.CplInt32(PTF_LEAF))) + Xsqlite3Put4byte(tls, ((*MemPage)(unsafe.Pointer(pRoot)).FaData + uintptr((int32((*MemPage)(unsafe.Pointer(pRoot)).FhdrOffset) + 8))), *(*Pgno)(unsafe.Pointer(bp + 8 /* pgnoChild */))) + + *(*uintptr)(unsafe.Pointer(ppChild)) = *(*uintptr)(unsafe.Pointer(bp /* pChild */)) + return SQLITE_OK +} + +// Return SQLITE_CORRUPT if any cursor other than pCur is currently valid +// on the same B-tree as pCur. +// +// This can if a database is corrupt with two or more SQL tables +// pointing to the same b-tree. If an insert occurs on one SQL table +// and causes a BEFORE TRIGGER to do a secondary insert on the other SQL +// table linked to the same b-tree. If the secondary insert causes a +// rebalance, that can change content out from under the cursor on the +// first SQL table, violating invariants on the first insert. +func anotherValidCursor(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:73882:12: */ + var pOther uintptr + for pOther = (*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FpCursor; pOther != 0; pOther = (*BtCursor)(unsafe.Pointer(pOther)).FpNext { + if ((pOther != pCur) && + (int32((*BtCursor)(unsafe.Pointer(pOther)).FeState) == CURSOR_VALID)) && + ((*BtCursor)(unsafe.Pointer(pOther)).FpPage == (*BtCursor)(unsafe.Pointer(pCur)).FpPage) { + return Xsqlite3CorruptError(tls, 73889) + } + } + return SQLITE_OK +} + +// The page that pCur currently points to has just been modified in +// some way. This function figures out if this modification means the +// tree needs to be balanced, and if so calls the appropriate balancing +// routine. Balancing routines are: +// +// balance_quick() +// balance_deeper() +// balance_nonroot() +func balance(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:73905:12: */ + bp := tls.Alloc(13) + defer tls.Free(13) + + var rc int32 = SQLITE_OK + var nMin int32 = (int32(((*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FusableSize * U32(2)) / U32(3))) + // var aBalanceQuickSpace [13]U8 at bp, 13 + + var pFree uintptr = uintptr(0) + + for ok := true; ok; ok = (rc == SQLITE_OK) { + var iPage int32 + var pPage uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + + if ((*MemPage)(unsafe.Pointer(pPage)).FnFree < 0) && (btreeComputeFreeSpace(tls, pPage) != 0) { + break + } + if (int32((*MemPage)(unsafe.Pointer(pPage)).FnOverflow) == 0) && ((*MemPage)(unsafe.Pointer(pPage)).FnFree <= nMin) { + break + } else if (libc.AssignInt32(&iPage, int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage))) == 0 { + if ((*MemPage)(unsafe.Pointer(pPage)).FnOverflow != 0) && ((libc.AssignInt32(&rc, anotherValidCursor(tls, pCur))) == SQLITE_OK) { + // The root page of the b-tree is overfull. In this case call the + // balance_deeper() function to create a new child for the root-page + // and copy the current contents of the root-page to it. The + // next iteration of the do-loop will balance the child page. + + rc = balance_deeper(tls, pPage, ((pCur + 144 /* &.apPage */) + 1*8)) + if rc == SQLITE_OK { + (*BtCursor)(unsafe.Pointer(pCur)).FiPage = int8(1) + (*BtCursor)(unsafe.Pointer(pCur)).Fix = U16(0) + *(*U16)(unsafe.Pointer((pCur + 88 /* &.aiIdx */))) = U16(0) + *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */))) = pPage + (*BtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + 1*8)) + + } + } else { + break + } + } else { + var pParent uintptr = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((iPage-1))*8)) + var iIdx int32 = int32(*(*U16)(unsafe.Pointer((pCur + 88 /* &.aiIdx */) + uintptr((iPage-1))*2))) + + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pParent)).FpDbPage) + if (rc == SQLITE_OK) && ((*MemPage)(unsafe.Pointer(pParent)).FnFree < 0) { + rc = btreeComputeFreeSpace(tls, pParent) + } + if rc == SQLITE_OK { + if (((((*MemPage)(unsafe.Pointer(pPage)).FintKeyLeaf != 0) && + (int32((*MemPage)(unsafe.Pointer(pPage)).FnOverflow) == 1)) && + (int32(*(*U16)(unsafe.Pointer((pPage + 28 /* &.aiOvfl */)))) == int32((*MemPage)(unsafe.Pointer(pPage)).FnCell))) && + ((*MemPage)(unsafe.Pointer(pParent)).Fpgno != Pgno(1))) && + (int32((*MemPage)(unsafe.Pointer(pParent)).FnCell) == iIdx) { + // Call balance_quick() to create a new sibling of pPage on which + // to store the overflow cell. balance_quick() inserts a new cell + // into pParent, which may cause pParent overflow. If this + // happens, the next iteration of the do-loop will balance pParent + // use either balance_nonroot() or balance_deeper(). Until this + // happens, the overflow cell is stored in the aBalanceQuickSpace[] + // buffer. + // + // The purpose of the following assert() is to check that only a + // single call to balance_quick() is made for each call to this + // function. If this were not verified, a subtle bug involving reuse + // of the aBalanceQuickSpace[] might sneak in. + + rc = balance_quick(tls, pParent, pPage, bp /* &aBalanceQuickSpace[0] */) + } else { + // In this case, call balance_nonroot() to redistribute cells + // between pPage and up to 2 of its sibling pages. This involves + // modifying the contents of pParent, which may cause pParent to + // become overfull or underfull. The next iteration of the do-loop + // will balance the parent page to correct this. + // + // If the parent page becomes overfull, the overflow cell or cells + // are stored in the pSpace buffer allocated immediately below. + // A subsequent iteration of the do-loop will deal with this by + // calling balance_nonroot() (balance_deeper() may be called first, + // but it doesn't deal with overflow cells - just moves them to a + // different page). Once this subsequent call to balance_nonroot() + // has completed, it is safe to release the pSpace buffer used by + // the previous call, as the overflow cell data will have been + // copied either into the body of a database page or into the new + // pSpace buffer passed to the latter call to balance_nonroot(). + var pSpace uintptr = Xsqlite3PageMalloc(tls, int32((*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBt)).FpageSize)) + rc = balance_nonroot(tls, pParent, iIdx, pSpace, (libc.Bool32(iPage == 1)), + (int32((*BtCursor)(unsafe.Pointer(pCur)).Fhints) & BTREE_BULKLOAD)) + if pFree != 0 { + // If pFree is not NULL, it points to the pSpace buffer used + // by a previous call to balance_nonroot(). Its contents are + // now stored either on real database pages or within the + // new pSpace buffer, so it may be safely freed here. + Xsqlite3PageFree(tls, pFree) + } + + // The pSpace buffer will be freed after the next call to + // balance_nonroot(), or just before this function returns, whichever + // comes first. + pFree = pSpace + } + } + + (*MemPage)(unsafe.Pointer(pPage)).FnOverflow = U8(0) + + // The next iteration of the do-loop balances the parent page. + releasePage(tls, pPage) + (*BtCursor)(unsafe.Pointer(pCur)).FiPage-- + + (*BtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) + } + } + + if pFree != 0 { + Xsqlite3PageFree(tls, pFree) + } + return rc +} + +// Overwrite content from pX into pDest. Only do the write if the +// content is different from what is already there. +func btreeOverwriteContent(tls *libc.TLS, pPage uintptr, pDest uintptr, pX uintptr, iOffset int32, iAmt int32) int32 { /* sqlite3.c:74031:12: */ + var nData int32 = ((*BtreePayload)(unsafe.Pointer(pX)).FnData - iOffset) + if nData <= 0 { + // Overwritting with zeros + var i int32 + for i = 0; (i < iAmt) && (int32(*(*U8)(unsafe.Pointer(pDest + uintptr(i)))) == 0); i++ { + } + if i < iAmt { + var rc int32 = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc != 0 { + return rc + } + libc.Xmemset(tls, (pDest + uintptr(i)), 0, (uint64(iAmt - i))) + } + } else { + if nData < iAmt { + // Mixed read data and zeros at the end. Make a recursive call + // to write the zeros then fall through to write the real data + var rc int32 = btreeOverwriteContent(tls, pPage, (pDest + uintptr(nData)), pX, (iOffset + nData), + (iAmt - nData)) + if rc != 0 { + return rc + } + iAmt = nData + } + if libc.Xmemcmp(tls, pDest, (((*BtreePayload)(unsafe.Pointer(pX)).FpData)+uintptr(iOffset)), uint64(iAmt)) != 0 { + var rc int32 = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) + if rc != 0 { + return rc + } + // In a corrupt database, it is possible for the source and destination + // buffers to overlap. This is harmless since the database is already + // corrupt but it does cause valgrind and ASAN warnings. So use + // memmove(). + libc.Xmemmove(tls, pDest, (((*BtreePayload)(unsafe.Pointer(pX)).FpData) + uintptr(iOffset)), uint64(iAmt)) + } + } + return SQLITE_OK +} + +// Overwrite the cell that cursor pCur is pointing to with fresh content +// contained in pX. +func btreeOverwriteCell(tls *libc.TLS, pCur uintptr, pX uintptr) int32 { /* sqlite3.c:74074:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var iOffset int32 // Next byte of pX->pData to write + var nTotal int32 = ((*BtreePayload)(unsafe.Pointer(pX)).FnData + (*BtreePayload)(unsafe.Pointer(pX)).FnZero) // Total bytes of to write + var rc int32 // Return code + *(*uintptr)(unsafe.Pointer(bp /* pPage */)) = (*BtCursor)(unsafe.Pointer(pCur)).FpPage // Page being written + var pBt uintptr // Btree + var ovflPgno Pgno // Next overflow page to write + var ovflPageSize U32 // Size to write on overflow page + + if (((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload + uintptr((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) > (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaDataEnd) || + ((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload < ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData + uintptr((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FcellOffset))) { + return Xsqlite3CorruptError(tls, 74086) + } + // Overwrite the local portion first + rc = btreeOverwriteContent(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload, pX, + 0, int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal)) + if rc != 0 { + return rc + } + if int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) == nTotal { + return SQLITE_OK + } + + // Now overwrite the overflow pages + iOffset = int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnLocal) + + ovflPgno = Xsqlite3Get4byte(tls, ((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FpPayload + uintptr(iOffset))) + pBt = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpBt + ovflPageSize = ((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(4)) + for ok := true; ok; ok = (iOffset < nTotal) { + rc = btreeGetPage(tls, pBt, ovflPgno, bp /* &pPage */, 0) + if rc != 0 { + return rc + } + if Xsqlite3PagerPageRefcount(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage) != 1 { + rc = Xsqlite3CorruptError(tls, 74105) + } else { + if (U32(iOffset) + ovflPageSize) < U32(nTotal) { + ovflPgno = Xsqlite3Get4byte(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData) + } else { + ovflPageSize = (U32(nTotal - iOffset)) + } + rc = btreeOverwriteContent(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData + uintptr(4)), pX, + iOffset, int32(ovflPageSize)) + } + Xsqlite3PagerUnref(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage) + if rc != 0 { + return rc + } + iOffset = int32(U32(iOffset) + (ovflPageSize)) + } + return SQLITE_OK +} + +// Insert a new record into the BTree. The content of the new record +// is described by the pX object. The pCur cursor is used only to +// define what table the record should be inserted into, and is left +// pointing at a random location. +// +// For a table btree (used for rowid tables), only the pX.nKey value of +// the key is used. The pX.pKey value must be NULL. The pX.nKey is the +// rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields +// hold the content of the row. +// +// For an index btree (used for indexes and WITHOUT ROWID tables), the +// key is an arbitrary byte sequence stored in pX.pKey,nKey. The +// pX.pData,nData,nZero fields must be zero. +// +// If the seekResult parameter is non-zero, then a successful call to +// MovetoUnpacked() to seek cursor pCur to (pKey,nKey) has already +// been performed. In other words, if seekResult!=0 then the cursor +// is currently pointing to a cell that will be adjacent to the cell +// to be inserted. If seekResult<0 then pCur points to a cell that is +// smaller then (pKey,nKey). If seekResult>0 then pCur points to a cell +// that is larger than (pKey,nKey). +// +// If seekResult==0, that means pCur is pointing at some unknown location. +// In that case, this routine must seek the cursor to the correct insertion +// point for (pKey,nKey) before doing the insertion. For index btrees, +// if pX->nMem is non-zero, then pX->aMem contains pointers to the unpacked +// key values and pX->aMem can be used instead of pX->pKey to avoid having +// to decode the key. +func Xsqlite3BtreeInsert(tls *libc.TLS, pCur uintptr, pX uintptr, flags int32, seekResult int32) int32 { /* sqlite3.c:74153:20: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + // var rc int32 at bp+104, 4 + + // var loc int32 at bp, 4 + // -1: before desired location +1: after + // var szNew int32 at bp+108, 4 + + var idx int32 + var pPage uintptr + var p uintptr + var pBt uintptr + var oldCell uintptr + var newCell uintptr + // var r UnpackedRecord at bp+8, 24 + + // var x2 BtreePayload at bp+32, 48 + + var ovfl Pgno + // var info CellInfo at bp+80, 24 + + // var info1 CellInfo at bp+112, 24 + *(*int32)(unsafe.Pointer(bp /* loc */)) = seekResult + *(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) = 0 + p = (*BtCursor)(unsafe.Pointer(pCur)).FpBtree + pBt = (*Btree)(unsafe.Pointer(p)).FpBt + newCell = uintptr(0) + + if !(int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_FAULT) { + goto __1 + } + + return (*BtCursor)(unsafe.Pointer(pCur)).FskipNext +__1: + ; + + // Assert that the caller has been consistent. If this cursor was opened + // expecting an index b-tree, then the caller should be inserting blob + // keys with no associated data. If the cursor was opened expecting an + // intkey table, the caller should be inserting integer keys with a + // blob of associated data. + + // Save the positions of any other cursors open on this table. + // + // In some cases, the call to btreeMoveto() below is a no-op. For + // example, when inserting data into a table with auto-generated integer + // keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the + // integer key to use. It then calls this function to actually insert the + // data into the intkey B-Tree. In this case btreeMoveto() recognizes + // that the cursor is already where it needs to be and returns without + // doing any work. To avoid thwarting these optimizations, it is important + // not to clear the cursor here. + if !((int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_Multiple) != 0) { + goto __2 + } + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = saveAllCursors(tls, pBt, (*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, pCur) + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __3 + } + return *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) +__3: + ; + if !((*(*int32)(unsafe.Pointer(bp /* loc */)) != 0) && (int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) < 0)) { + goto __4 + } + // This can only happen if the schema is corrupt such that there is more + // than one table or index with the same root page as used by the cursor. + // Which can only happen if the SQLITE_NoSchemaError flag was set when + // the schema was loaded. This cannot be asserted though, as a user might + // set the flag, load the schema, and then unset the flag. + return Xsqlite3CorruptError(tls, 74210) +__4: + ; +__2: + ; + + if !((*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) { + goto __5 + } + + // If this is an insert into a table b-tree, invalidate any incrblob + // cursors open on the row being replaced + if !((*Btree)(unsafe.Pointer(p)).FhasIncrblobCur != 0) { + goto __7 + } + invalidateIncrblobCursors(tls, p, (*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, (*BtreePayload)(unsafe.Pointer(pX)).FnKey, 0) +__7: + ; + + // If BTREE_SAVEPOSITION is set, the cursor must already be pointing + // to a row with the same key as the new entry being inserted. + + // On the other hand, BTREE_SAVEPOSITION==0 does not imply + // that the cursor is not pointing to a row to be overwritten. + // So do a complete check. + if !(((int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_ValidNKey) != 0) && ((*BtreePayload)(unsafe.Pointer(pX)).FnKey == (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey)) { + goto __8 + } + // The cursor is pointing to the entry that is to be + // overwritten + + if !((int32((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize) != 0) && + ((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnPayload == (U32((*BtreePayload)(unsafe.Pointer(pX)).FnData) + U32((*BtreePayload)(unsafe.Pointer(pX)).FnZero)))) { + goto __10 + } + // New entry is the same size as the old. Do an overwrite + return btreeOverwriteCell(tls, pCur, pX) +__10: + ; + + goto __9 +__8: + if !(*(*int32)(unsafe.Pointer(bp /* loc */)) == 0) { + goto __11 + } + // The cursor is *not* pointing to the cell to be overwritten, nor + // to an adjacent cell. Move the cursor so that it is pointing either + // to the cell to be overwritten or an adjacent cell. + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = Xsqlite3BtreeMovetoUnpacked(tls, pCur, uintptr(0), (*BtreePayload)(unsafe.Pointer(pX)).FnKey, (libc.Bool32(flags != 0)), bp /* &loc */) + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __12 + } + return *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) +__12: + ; +__11: + ; +__9: + ; + goto __6 +__5: + // This is an index or a WITHOUT ROWID table + + // If BTREE_SAVEPOSITION is set, the cursor must already be pointing + // to a row with the same key as the new entry being inserted. + ; + + // If the cursor is not already pointing either to the cell to be + // overwritten, or if a new cell is being inserted, if the cursor is + // not pointing to an immediately adjacent cell, then move the cursor + // so that it does. + if !((*(*int32)(unsafe.Pointer(bp /* loc */)) == 0) && ((flags & BTREE_SAVEPOSITION) == 0)) { + goto __13 + } + if !((*BtreePayload)(unsafe.Pointer(pX)).FnMem != 0) { + goto __14 + } + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).FpKeyInfo = (*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).FaMem = (*BtreePayload)(unsafe.Pointer(pX)).FaMem + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).FnField = (*BtreePayload)(unsafe.Pointer(pX)).FnMem + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).Fdefault_rc = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).FerrCode = U8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).Fr1 = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).Fr2 = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 8 /* &r */)).FeqSeen = U8(0) + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = Xsqlite3BtreeMovetoUnpacked(tls, pCur, bp+8 /* &r */, int64(0), (libc.Bool32(flags != 0)), bp /* &loc */) + goto __15 +__14: + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = btreeMoveto(tls, pCur, (*BtreePayload)(unsafe.Pointer(pX)).FpKey, (*BtreePayload)(unsafe.Pointer(pX)).FnKey, (libc.Bool32(flags != 0)), bp /* &loc */) +__15: + ; + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __16 + } + return *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) +__16: + ; +__13: + ; + + // If the cursor is currently pointing to an entry to be overwritten + // and the new content is the same as as the old, then use the + // overwrite optimization. + if !(*(*int32)(unsafe.Pointer(bp /* loc */)) == 0) { + goto __17 + } + getCellInfo(tls, pCur) + if !((*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey == (*BtreePayload)(unsafe.Pointer(pX)).FnKey) { + goto __18 + } + (*BtreePayload)(unsafe.Pointer(bp + 32 /* &x2 */)).FpData = (*BtreePayload)(unsafe.Pointer(pX)).FpKey + (*BtreePayload)(unsafe.Pointer(bp + 32 /* &x2 */)).FnData = int32((*BtreePayload)(unsafe.Pointer(pX)).FnKey) + (*BtreePayload)(unsafe.Pointer(bp + 32 /* &x2 */)).FnZero = 0 + return btreeOverwriteCell(tls, pCur, bp+32 /* &x2 */) +__18: + ; +__17: + ; +__6: + ; + + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + + if !((*MemPage)(unsafe.Pointer(pPage)).FnFree < 0) { + goto __19 + } + if !(int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) > CURSOR_INVALID) { + goto __20 + } + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = Xsqlite3CorruptError(tls, 74311) + goto __21 +__20: + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = btreeComputeFreeSpace(tls, pPage) +__21: + ; + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __22 + } + return *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) +__22: + ; +__19: + ; + + newCell = (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace + + if !((flags & BTREE_PREFORMAT) != 0) { + goto __23 + } + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) = (*BtShared)(unsafe.Pointer(pBt)).FnPreformatSize + if !(*(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) < 4) { + goto __25 + } + *(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) = 4 +__25: + ; + if !(((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && (*(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) > int32((*MemPage)(unsafe.Pointer(pPage)).FmaxLocal))) { + goto __26 + } + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, newCell, bp+80 /* &info */) + if !((*CellInfo)(unsafe.Pointer(bp+80 /* &info */)).FnPayload != U32((*CellInfo)(unsafe.Pointer(bp+80 /* &info */)).FnLocal)) { + goto __27 + } + ovfl = Xsqlite3Get4byte(tls, (newCell + uintptr((*(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) - 4)))) + ptrmapPut(tls, pBt, ovfl, uint8(PTRMAP_OVERFLOW1), (*MemPage)(unsafe.Pointer(pPage)).Fpgno, bp+104 /* &rc */) +__27: + ; +__26: + ; + goto __24 +__23: + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = fillInCell(tls, pPage, newCell, pX, bp+108 /* &szNew */) +__24: + ; + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __28 + } + goto end_insert +__28: + ; + + idx = int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) + if !(*(*int32)(unsafe.Pointer(bp /* loc */)) == 0) { + goto __29 + } + + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __31 + } + goto end_insert +__31: + ; + oldCell = ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (idx))))))))))) + if !(!(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0)) { + goto __32 + } + libc.Xmemcpy(tls, newCell, oldCell, uint64(4)) +__32: + ; + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, oldCell, bp+112 /* &info1 */) + if !(U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info1 */)).FnLocal) != (*CellInfo)(unsafe.Pointer(bp+112 /* &info1 */)).FnPayload) { + goto __33 + } + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = clearCellOverflow(tls, pPage, oldCell, bp+112 /* &info1 */) + goto __34 +__33: + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_OK +__34: + ; + + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_ValidOvfl))) + if !(((int32((*CellInfo)(unsafe.Pointer(bp+112 /* &info1 */)).FnSize) == *(*int32)(unsafe.Pointer(bp + 108 /* szNew */))) && (U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info1 */)).FnLocal) == (*CellInfo)(unsafe.Pointer(bp+112 /* &info1 */)).FnPayload)) && + (!(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0) || (*(*int32)(unsafe.Pointer(bp + 108 /* szNew */)) < int32((*MemPage)(unsafe.Pointer(pPage)).FminLocal)))) { + goto __35 + } + // Overwrite the old cell with the new if they are the same size. + // We could also try to do this if the old cell is smaller, then add + // the leftover space to the free list. But experiments show that + // doing that is no faster then skipping this optimization and just + // calling dropCell() and insertCell(). + // + // This optimization cannot be used on an autovacuum database if the + // new entry uses overflow pages, as the insertCell() call below is + // necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. + // clearCell never fails when nLocal==nPayload + if !(oldCell < (((*MemPage)(unsafe.Pointer(pPage)).FaData + uintptr((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset)) + uintptr(10))) { + goto __36 + } + return Xsqlite3CorruptError(tls, 74371) +__36: + ; + if !((oldCell + uintptr(*(*int32)(unsafe.Pointer(bp + 108 /* szNew */)))) > (*MemPage)(unsafe.Pointer(pPage)).FaDataEnd) { + goto __37 + } + return Xsqlite3CorruptError(tls, 74374) +__37: + ; + libc.Xmemcpy(tls, oldCell, newCell, uint64(*(*int32)(unsafe.Pointer(bp + 108 /* szNew */)))) + return SQLITE_OK +__35: + ; + dropCell(tls, pPage, idx, int32((*CellInfo)(unsafe.Pointer(bp+112 /* &info1 */)).FnSize), bp+104 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != 0) { + goto __38 + } + goto end_insert +__38: + ; + goto __30 +__29: + if !((*(*int32)(unsafe.Pointer(bp /* loc */)) < 0) && (int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) > 0)) { + goto __39 + } + + idx = int32(libc.PreIncUint16(&(*BtCursor)(unsafe.Pointer(pCur)).Fix, 1)) + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_ValidNKey))) + goto __40 +__39: + ; +__40: + ; +__30: + ; + insertCell(tls, pPage, idx, newCell, *(*int32)(unsafe.Pointer(bp + 108 /* szNew */)), uintptr(0), uint32(0), bp+104 /* &rc */) + + // If no error has occurred and pPage has an overflow cell, call balance() + // to redistribute the cells within the tree. Since balance() may move + // the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey + // variables. + // + // Previous versions of SQLite called moveToRoot() to move the cursor + // back to the root page as balance() used to invalidate the contents + // of BtCursor.apPage[] and BtCursor.aiIdx[]. Instead of doing that, + // set the cursor state to "invalid". This makes common insert operations + // slightly faster. + // + // There is a subtle but important optimization here too. When inserting + // multiple records into an intkey b-tree using a single cursor (as can + // happen while processing an "INSERT INTO ... SELECT" statement), it + // is advantageous to leave the cursor pointing to the last entry in + // the b-tree if possible. If the cursor is left pointing to the last + // entry in the table, and the next row inserted has an integer key + // larger than the largest existing key, it is possible to insert the + // row without seeking the cursor. This can be a big performance boost. + (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnSize = U16(0) + if !((*MemPage)(unsafe.Pointer(pPage)).FnOverflow != 0) { + goto __41 + } + + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) &= libc.Uint8FromInt32((libc.CplInt32(BTCF_ValidNKey))) + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = balance(tls, pCur) + + // Must make sure nOverflow is reset to zero even if the balance() + // fails. Internal data structure corruption will result otherwise. + // Also, set the cursor state to invalid. This stops saveCursorPosition() + // from trying to save the current position of the cursor. + (*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FnOverflow = U8(0) + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_INVALID) + if !(((flags & BTREE_SAVEPOSITION) != 0) && (*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) == SQLITE_OK)) { + goto __42 + } + btreeReleaseAllCursorPages(tls, pCur) + if !((*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo != 0) { + goto __43 + } + + (*BtCursor)(unsafe.Pointer(pCur)).FpKey = Xsqlite3Malloc(tls, uint64((*BtreePayload)(unsafe.Pointer(pX)).FnKey)) + if !((*BtCursor)(unsafe.Pointer(pCur)).FpKey == uintptr(0)) { + goto __44 + } + *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_NOMEM + goto __45 +__44: + libc.Xmemcpy(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpKey, (*BtreePayload)(unsafe.Pointer(pX)).FpKey, uint64((*BtreePayload)(unsafe.Pointer(pX)).FnKey)) +__45: + ; +__43: + ; + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_REQUIRESEEK) + (*BtCursor)(unsafe.Pointer(pCur)).FnKey = (*BtreePayload)(unsafe.Pointer(pX)).FnKey +__42: + ; +__41: + ; + +end_insert: + return *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) +} + +// This function is used as part of copying the current row from cursor +// pSrc into cursor pDest. If the cursors are open on intkey tables, then +// parameter iKey is used as the rowid value when the record is copied +// into pDest. Otherwise, the record is copied verbatim. +// +// This function does not actually write the new value to cursor pDest. +// Instead, it creates and populates any required overflow pages and +// writes the data for the new cell into the BtShared.pTmpSpace buffer +// for the destination database. The size of the cell, in bytes, is left +// in BtShared.nPreformatSize. The caller completes the insertion by +// calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified. +// +// SQLITE_OK is returned if successful, or an SQLite error code otherwise. +func Xsqlite3BtreeTransferRow(tls *libc.TLS, pDest uintptr, pSrc uintptr, iKey I64) int32 { /* sqlite3.c:74460:20: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = SQLITE_OK + var pBt uintptr = (*BtCursor)(unsafe.Pointer(pDest)).FpBt + var aOut uintptr = (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace // Pointer to next output buffer + var aIn uintptr // Pointer to next input buffer + var nIn U32 // Size of input buffer aIn[] + var nRem U32 // Bytes of data still to copy + + getCellInfo(tls, pSrc) + aOut += uintptr(func() uint8 { + if ((*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload) < U32(0x80) { + return uint8(func() int32 { + *(*U8)(unsafe.Pointer(aOut)) = uint8((*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload) + return 1 + }()) + } + return uint8(Xsqlite3PutVarint(tls, aOut, uint64((*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload))) + }()) + if (*BtCursor)(unsafe.Pointer(pDest)).FpKeyInfo == uintptr(0) { + aOut += uintptr(Xsqlite3PutVarint(tls, aOut, uint64(iKey))) + } + nIn = U32((*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnLocal) + aIn = (*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload + if (aIn + uintptr(nIn)) > (*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { + return Xsqlite3CorruptError(tls, 74474) + } + nRem = (*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload + if (nIn == nRem) && (nIn < U32((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pDest)).FpPage)).FmaxLocal)) { + libc.Xmemcpy(tls, aOut, aIn, uint64(nIn)) + (*BtShared)(unsafe.Pointer(pBt)).FnPreformatSize = (int32(int64(nIn) + ((int64(aOut) - int64((*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace)) / 1))) + } else { + var pSrcPager uintptr = (*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pSrc)).FpBt)).FpPager + var pPgnoOut uintptr = uintptr(0) + var ovflIn Pgno = Pgno(0) + *(*uintptr)(unsafe.Pointer(bp /* pPageIn */)) = uintptr(0) + var pPageOut uintptr = uintptr(0) + var nOut U32 // Size of output buffer aOut[] + + nOut = U32(btreePayloadToLocal(tls, (*BtCursor)(unsafe.Pointer(pDest)).FpPage, int64((*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload))) + (*BtShared)(unsafe.Pointer(pBt)).FnPreformatSize = (int32(int64(nOut) + ((int64(aOut) - int64((*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace)) / 1))) + if nOut < (*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FnPayload { + pPgnoOut = (aOut + uintptr(nOut)) + *(*int32)(unsafe.Pointer(pBt + 144 /* &.nPreformatSize */)) += (4) + } + + if nRem > nIn { + if ((aIn + uintptr(nIn)) + uintptr(4)) > (*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pSrc)).FpPage)).FaDataEnd { + return Xsqlite3CorruptError(tls, 74497) + } + ovflIn = Xsqlite3Get4byte(tls, ((*BtCursor)(unsafe.Pointer(pSrc)).Finfo.FpPayload + uintptr(nIn))) + } + + for ok := true; ok; ok = ((nRem > U32(0)) && (*(*int32)(unsafe.Pointer(bp + 20 /* rc */)) == SQLITE_OK)) { + nRem = nRem - (nOut) + for ok1 := true; ok1; ok1 = ((*(*int32)(unsafe.Pointer(bp + 20 /* rc */)) == SQLITE_OK) && (nOut > U32(0))) { + + if nIn > U32(0) { + var nCopy int32 = func() int32 { + if (nOut) < (nIn) { + return int32(nOut) + } + return int32(nIn) + }() + libc.Xmemcpy(tls, aOut, aIn, uint64(nCopy)) + nOut = nOut - (U32(nCopy)) + nIn = nIn - (U32(nCopy)) + aOut += uintptr(nCopy) + aIn += uintptr(nCopy) + } + if nOut > U32(0) { + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pPageIn */))) + *(*uintptr)(unsafe.Pointer(bp /* pPageIn */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = Xsqlite3PagerGet(tls, pSrcPager, ovflIn, bp /* &pPageIn */, PAGER_GET_READONLY) + if *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) == SQLITE_OK { + aIn = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp /* pPageIn */))) + ovflIn = Xsqlite3Get4byte(tls, aIn) + aIn += uintptr(4) + nIn = ((*BtShared)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pSrc)).FpBt)).FusableSize - U32(4)) + } + } + } + + if (*(*int32)(unsafe.Pointer(bp + 20 /* rc */)) == SQLITE_OK) && (nRem > U32(0)) { + // var pgnoNew Pgno at bp+16, 4 + + *(*uintptr)(unsafe.Pointer(bp + 8 /* pNew */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = allocateBtreePage(tls, pBt, bp+8 /* &pNew */, bp+16 /* &pgnoNew */, uint32(0), uint8(0)) + Xsqlite3Put4byte(tls, pPgnoOut, *(*Pgno)(unsafe.Pointer(bp + 16 /* pgnoNew */))) + if ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && (pPageOut != 0) { + ptrmapPut(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 16 /* pgnoNew */)), uint8(PTRMAP_OVERFLOW2), (*MemPage)(unsafe.Pointer(pPageOut)).Fpgno, bp+20 /* &rc */) + } + releasePage(tls, pPageOut) + pPageOut = *(*uintptr)(unsafe.Pointer(bp + 8 /* pNew */)) + if pPageOut != 0 { + pPgnoOut = (*MemPage)(unsafe.Pointer(pPageOut)).FaData + Xsqlite3Put4byte(tls, pPgnoOut, uint32(0)) + aOut = (pPgnoOut + 4) + nOut = func() uint32 { + if ((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(4)) < (nRem) { + return ((*BtShared)(unsafe.Pointer(pBt)).FusableSize - U32(4)) + } + return nRem + }() + } + } + } + + releasePage(tls, pPageOut) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pPageIn */))) + } + + return *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) +} + +// Delete the entry that the cursor is pointing to. +// +// If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then +// the cursor is left pointing at an arbitrary location after the delete. +// But if that bit is set, then the cursor is left in a state such that +// the next call to BtreeNext() or BtreePrev() moves it to the same row +// as it would have been on if the call to BtreeDelete() had been omitted. +// +// The BTREE_AUXDELETE bit of flags indicates that is one of several deletes +// associated with a single table entry and its indexes. Only one of those +// deletes is considered the "primary" delete. The primary delete occurs +// on a cursor that is not a BTREE_FORDELETE cursor. All but one delete +// operation on non-FORDELETE cursors is tagged with the AUXDELETE flag. +// The BTREE_AUXDELETE bit is a hint that is not used by this implementation, +// but which might be used by alternative storage engines. +func Xsqlite3BtreeDelete(tls *libc.TLS, pCur uintptr, flags U8) int32 { /* sqlite3.c:74570:20: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var p uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBtree + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + // var rc int32 at bp+24, 4 + // Return code + var pPage uintptr // Page to delete cell from + var pCell uintptr // Pointer to cell to delete + var iCellIdx int32 // Index of cell to delete + var iCellDepth int32 // Depth of node containing pCell + // var info CellInfo at bp, 24 + // Size of the cell being deleted + var bSkipnext int32 = 0 // Leaf cursor in SKIPNEXT state + var bPreserve U8 = (U8(int32(flags) & BTREE_SAVEPOSITION)) // Keep cursor valid + + if int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) == CURSOR_REQUIRESEEK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = btreeRestoreCursorPosition(tls, pCur) + + if (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0) || (int32((*BtCursor)(unsafe.Pointer(pCur)).FeState) != CURSOR_VALID) { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + } + + iCellDepth = int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) + iCellIdx = int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + pCell = ((*MemPage)(unsafe.Pointer((pPage))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (iCellIdx))))))))))) + if ((*MemPage)(unsafe.Pointer(pPage)).FnFree < 0) && (btreeComputeFreeSpace(tls, pPage) != 0) { + return SQLITE_CORRUPT + } + + // If the bPreserve flag is set to true, then the cursor position must + // be preserved following this delete operation. If the current delete + // will cause a b-tree rebalance, then this is done by saving the cursor + // key and leaving the cursor in CURSOR_REQUIRESEEK state before + // returning. + // + // Or, if the current delete will not cause a rebalance, then the cursor + // will be left in CURSOR_SKIPNEXT state pointing to the entry immediately + // before or after the deleted entry. In this case set bSkipnext to true. + if bPreserve != 0 { + if (!(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) || + ((((*MemPage)(unsafe.Pointer(pPage)).FnFree + int32(cellSizePtr(tls, pPage, pCell))) + 2) > (int32(((*BtShared)(unsafe.Pointer(pBt)).FusableSize * U32(2)) / U32(3))))) || + (int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) == 1) { + // A b-tree rebalance will be required after deleting this entry. + // Save the cursor key. + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = saveCursorKey(tls, pCur) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + } else { + bSkipnext = 1 + } + } + + // If the page containing the entry to delete is not a leaf page, move + // the cursor to the largest entry in the tree that is smaller than + // the entry being deleted. This cell will replace the cell being deleted + // from the internal node. The 'previous' entry is used for this instead + // of the 'next' entry, as the previous entry is always a part of the + // sub-tree headed by the child page of the cell being deleted. This makes + // balancing the tree following the delete operation easier. + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3BtreePrevious(tls, pCur, 0) + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + } + + // Save the positions of any other cursors open on this table before + // making any modifications. + if (int32((*BtCursor)(unsafe.Pointer(pCur)).FcurFlags) & BTCF_Multiple) != 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = saveAllCursors(tls, pBt, (*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, pCur) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + } + + // If this is a delete operation to remove a row from a table b-tree, + // invalidate any incrblob cursors open on the row being deleted. + if ((*BtCursor)(unsafe.Pointer(pCur)).FpKeyInfo == uintptr(0)) && ((*Btree)(unsafe.Pointer(p)).FhasIncrblobCur != 0) { + invalidateIncrblobCursors(tls, p, (*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot, (*BtCursor)(unsafe.Pointer(pCur)).Finfo.FnKey, 0) + } + + // Make the page containing the entry to be deleted writable. Then free any + // overflow pages associated with the entry and finally remove the cell + // itself from within the page. + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pPage)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pPage + 128 /* &.xParseCell */))))(tls, pPage, pCell, bp /* &info */) + if U32((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnLocal) != (*CellInfo)(unsafe.Pointer(bp /* &info */)).FnPayload { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = clearCellOverflow(tls, pPage, pCell, bp /* &info */) + } else { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + } + + dropCell(tls, pPage, iCellIdx, int32((*CellInfo)(unsafe.Pointer(bp /* &info */)).FnSize), bp+24 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + + // If the cell deleted was not located on a leaf page, then the cursor + // is currently pointing to the largest entry in the sub-tree headed + // by the child-page of the cell that was just deleted from an internal + // node. The cell from the leaf node needs to be moved to the internal + // node to replace the deleted cell. + if !(int32((*MemPage)(unsafe.Pointer(pPage)).Fleaf) != 0) { + var pLeaf uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + var nCell int32 + var n Pgno + var pTmp uintptr + + if (*MemPage)(unsafe.Pointer(pLeaf)).FnFree < 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = btreeComputeFreeSpace(tls, pLeaf) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + } + if iCellDepth < (int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) - 1) { + n = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((iCellDepth+1))*8)))).Fpgno + } else { + n = (*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).Fpgno + } + pCell = ((*MemPage)(unsafe.Pointer((pLeaf))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((pLeaf))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pLeaf))).FaCellIdx + uintptr((2 * (int32((*MemPage)(unsafe.Pointer(pLeaf)).FnCell) - 1))))))))))) + if pCell < ((*MemPage)(unsafe.Pointer(pLeaf)).FaData + 4) { + return Xsqlite3CorruptError(tls, 74681) + } + nCell = int32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((pLeaf + 120 /* &.xCellSize */))))(tls, pLeaf, pCell)) + + pTmp = (*BtShared)(unsafe.Pointer(pBt)).FpTmpSpace + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(pLeaf)).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + insertCell(tls, pPage, iCellIdx, (pCell - uintptr(4)), (nCell + 4), pTmp, n, bp+24 /* &rc */) + } + dropCell(tls, pLeaf, (int32((*MemPage)(unsafe.Pointer(pLeaf)).FnCell) - 1), nCell, bp+24 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + } + + // Balance the tree. If the entry deleted was located on a leaf page, + // then the cursor still points to that page. In this case the first + // call to balance() repairs the tree, and the if(...) condition is + // never true. + // + // Otherwise, if the entry deleted was on an internal node page, then + // pCur is pointing to the leaf page from which a cell was removed to + // replace the cell deleted from the internal node. This is slightly + // tricky as the leaf node may be underfull, and the internal node may + // be either under or overfull. In this case run the balancing algorithm + // on the leaf node first. If the balance proceeds far enough up the + // tree that we can be sure that any problem in the internal node has + // been corrected, so be it. Otherwise, after balancing the leaf node, + // walk the cursor up the tree to the internal node and balance it as + // well. + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = balance(tls, pCur) + if (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) > iCellDepth) { + releasePageNotNull(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpPage) + (*BtCursor)(unsafe.Pointer(pCur)).FiPage-- + for int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) > iCellDepth { + releasePage(tls, *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr(libc.PostDecInt8(&(*BtCursor)(unsafe.Pointer(pCur)).FiPage, 1))*8))) + } + (*BtCursor)(unsafe.Pointer(pCur)).FpPage = *(*uintptr)(unsafe.Pointer((pCur + 144 /* &.apPage */) + uintptr((*BtCursor)(unsafe.Pointer(pCur)).FiPage)*8)) + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = balance(tls, pCur) + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + if bSkipnext != 0 { + + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_SKIPNEXT) + if iCellIdx >= int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) { + (*BtCursor)(unsafe.Pointer(pCur)).FskipNext = -1 + (*BtCursor)(unsafe.Pointer(pCur)).Fix = (U16(int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) - 1)) + } else { + (*BtCursor)(unsafe.Pointer(pCur)).FskipNext = 1 + } + } else { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = moveToRoot(tls, pCur) + if bPreserve != 0 { + btreeReleaseAllCursorPages(tls, pCur) + (*BtCursor)(unsafe.Pointer(pCur)).FeState = U8(CURSOR_REQUIRESEEK) + } + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_EMPTY { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + } + } + } + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Create a new BTree table. Write into *piTable the page +// number for the root page of the new table. +// +// The type of type is determined by the flags parameter. Only the +// following values of flags are currently in use. Other values for +// flags might not work: +// +// BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys +// BTREE_ZERODATA Used for SQL indices +func btreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, createTabFlags int32) int32 { /* sqlite3.c:74755:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + // var pRoot uintptr at bp+24, 8 + + // var pgnoRoot Pgno at bp, 4 + + // var rc int32 at bp+40, 4 + + var ptfFlags int32 // Page-type flage for the root page of new table + + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + // var pgnoMove Pgno at bp+16, 4 + // Move a page here to make room for the root-page + // var pPageMove uintptr at bp+8, 8 + // The page to move to. + + // Creating a new table may probably require moving an existing database + // to make room for the new tables root page. In case this page turns + // out to be an overflow page, delete all overflow page-map caches + // held by open cursors. + invalidateAllOverflowCache(tls, pBt) + + // Read the value of meta[3] from the database to determine where the + // root page of the new table should go. meta[3] is the largest root-page + // created so far, so the new root-page is (meta[3]+1). + Xsqlite3BtreeGetMeta(tls, p, BTREE_LARGEST_ROOT_PAGE, bp /* &pgnoRoot */) + if *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)) > btreePagecount(tls, pBt) { + return Xsqlite3CorruptError(tls, 74789) + } + *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */))++ + + // The new root-page may not be allocated on a pointer-map page, or the + // PENDING_BYTE page. + for (*(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)) == ptrmapPageno(tls, pBt, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)))) || (*(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)) == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) { + *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */))++ + } + + // Allocate a page. The page that currently resides at pgnoRoot will + // be moved to the allocated page (unless the allocated page happens + // to reside at pgnoRoot). + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = allocateBtreePage(tls, pBt, bp+8 /* &pPageMove */, bp+16 /* &pgnoMove */, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)), uint8(BTALLOC_EXACT)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + if *(*Pgno)(unsafe.Pointer(bp + 16 /* pgnoMove */)) != *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)) { + // pgnoRoot is the page that will be used for the root-page of + // the new table (assuming an error did not occur). But we were + // allocated pgnoMove. If required (i.e. if it was not allocated + // by extending the file), the current page at position pgnoMove + // is already journaled. + *(*U8)(unsafe.Pointer(bp + 32 /* eType */)) = U8(0) + *(*Pgno)(unsafe.Pointer(bp + 36 /* iPtrPage */)) = Pgno(0) + + // Save the positions of any open cursors. This is required in + // case they are holding a reference to an xFetch reference + // corresponding to page pgnoRoot. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = saveAllCursors(tls, pBt, uint32(0), uintptr(0)) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pPageMove */))) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + // Move the page currently at pgnoRoot to pgnoMove. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = btreeGetPage(tls, pBt, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)), bp+24 /* &pRoot */, 0) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = ptrmapGet(tls, pBt, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)), bp+32 /* &eType */, bp+36 /* &iPtrPage */) + if (int32(*(*U8)(unsafe.Pointer(bp + 32 /* eType */))) == PTRMAP_ROOTPAGE) || (int32(*(*U8)(unsafe.Pointer(bp + 32 /* eType */))) == PTRMAP_FREEPAGE) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 74837) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)), *(*U8)(unsafe.Pointer(bp + 32 /* eType */)), *(*Pgno)(unsafe.Pointer(bp + 36 /* iPtrPage */)), *(*Pgno)(unsafe.Pointer(bp + 16 /* pgnoMove */)), 0) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + + // Obtain the page at pgnoRoot + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = btreeGetPage(tls, pBt, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)), bp+24 /* &pRoot */, 0) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)))).FpDbPage) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + } else { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) = *(*uintptr)(unsafe.Pointer(bp + 8 /* pPageMove */)) + } + + // Update the pointer-map and meta-data with the new root-page number. + ptrmapPut(tls, pBt, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)), uint8(PTRMAP_ROOTPAGE), uint32(0), bp+40 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0 { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + // When the new root page was allocated, page 1 was made writable in + // order either to increase the database filesize, or to decrement the + // freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail. + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3BtreeUpdateMeta(tls, p, 4, *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */))) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0 { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = allocateBtreePage(tls, pBt, bp+24 /* &pRoot */, bp /* &pgnoRoot */, uint32(1), uint8(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + } + + if (createTabFlags & BTREE_INTKEY) != 0 { + ptfFlags = ((PTF_INTKEY | PTF_LEAFDATA) | PTF_LEAF) + } else { + ptfFlags = (PTF_ZERODATA | PTF_LEAF) + } + zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)), ptfFlags) + Xsqlite3PagerUnref(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)))).FpDbPage) + + *(*Pgno)(unsafe.Pointer(piTable)) = *(*Pgno)(unsafe.Pointer(bp /* pgnoRoot */)) + return SQLITE_OK +} + +func Xsqlite3BtreeCreateTable(tls *libc.TLS, p uintptr, piTable uintptr, flags int32) int32 { /* sqlite3.c:74900:20: */ + var rc int32 + Xsqlite3BtreeEnter(tls, p) + rc = btreeCreateTable(tls, p, piTable, flags) + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Erase the given database page and all its children. Return +// the page to the freelist. +func clearDatabasePage(tls *libc.TLS, pBt uintptr, pgno Pgno, freePageFlag int32, pnChange uintptr) int32 { /* sqlite3.c:74912:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + // var pPage uintptr at bp, 8 + + // var rc int32 at bp+32, 4 + + var pCell uintptr + var i int32 + var hdr int32 + // var info CellInfo at bp+8, 24 + + if !(pgno > btreePagecount(tls, pBt)) { + goto __1 + } + return Xsqlite3CorruptError(tls, 74927) +__1: + ; + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = getAndInitPage(tls, pBt, pgno, bp /* &pPage */, uintptr(0), 0) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __2 + } + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +__2: + ; + if !((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FbBusy != 0) { + goto __3 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3CorruptError(tls, 74932) + goto cleardatabasepage_out +__3: + ; + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FbBusy = U8(1) + hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FhdrOffset) + i = 0 +__4: + if !(i < int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FnCell)) { + goto __6 + } + pCell = ((*MemPage)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pPage */))))).FaData + uintptr((int32((*MemPage)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pPage */))))).FmaskPage) & int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pPage */))))).FaCellIdx + uintptr((2 * (i))))))))))) + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).Fleaf) != 0)) { + goto __7 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = clearDatabasePage(tls, pBt, Xsqlite3Get4byte(tls, pCell), 1, pnChange) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __8 + } + goto cleardatabasepage_out +__8: + ; +__7: + ; + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pPage */)) + 128 /* &.xParseCell */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), pCell, bp+8 /* &info */) + if !(U32((*CellInfo)(unsafe.Pointer(bp+8 /* &info */)).FnLocal) != (*CellInfo)(unsafe.Pointer(bp+8 /* &info */)).FnPayload) { + goto __9 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = clearCellOverflow(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), pCell, bp+8 /* &info */) + goto __10 +__9: + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK +__10: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __11 + } + goto cleardatabasepage_out +__11: + ; + goto __5 +__5: + i++ + goto __4 + goto __6 +__6: + ; + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).Fleaf) != 0)) { + goto __12 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = clearDatabasePage(tls, pBt, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData+uintptr((hdr+8)))), 1, pnChange) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __13 + } + goto cleardatabasepage_out +__13: + ; +__12: + ; + if !(pnChange != 0) { + goto __14 + } + + *(*int32)(unsafe.Pointer(pnChange)) += (int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FnCell)) +__14: + ; + if !(freePageFlag != 0) { + goto __15 + } + freePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), bp+32 /* &rc */) + goto __16 +__15: + if !((libc.AssignPtrInt32(bp+32 /* rc */, Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FpDbPage))) == 0) { + goto __17 + } + zeroPage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), (int32(*(*U8)(unsafe.Pointer((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FaData + uintptr(hdr)))) | PTF_LEAF)) +__17: + ; +__16: + ; + +cleardatabasepage_out: + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPage */)))).FbBusy = U8(0) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Delete all information from a single table in the database. iTable is +// the page number of the root of the table. After this routine returns, +// the root page is empty, but still exists. +// +// This routine will fail with SQLITE_LOCKED if there are any open +// read cursors on the table. Open write cursors are moved to the +// root of the table. +// +// If pnChange is not NULL, then the integer value pointed to by pnChange +// is incremented by the number of entries in the table. +func Xsqlite3BtreeClearTable(tls *libc.TLS, p uintptr, iTable int32, pnChange uintptr) int32 { /* sqlite3.c:74978:20: */ + var rc int32 + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + Xsqlite3BtreeEnter(tls, p) + + rc = saveAllCursors(tls, pBt, Pgno(iTable), uintptr(0)) + + if SQLITE_OK == rc { + // Invalidate all incrblob cursors open on table iTable (assuming iTable + // is the root of a table b-tree - if it is not, the following call is + // a no-op). + if (*Btree)(unsafe.Pointer(p)).FhasIncrblobCur != 0 { + invalidateIncrblobCursors(tls, p, Pgno(iTable), int64(0), 1) + } + rc = clearDatabasePage(tls, pBt, Pgno(iTable), 0, pnChange) + } + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Delete all information from the single table that pCur is open on. +// +// This routine only work for pCur on an ephemeral table. +func Xsqlite3BtreeClearTableOfCursor(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:75004:20: */ + return Xsqlite3BtreeClearTable(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree, int32((*BtCursor)(unsafe.Pointer(pCur)).FpgnoRoot), uintptr(0)) +} + +// Erase all information in a table and add the root of the table to +// the freelist. Except, the root of the principle table (the one on +// page 1) is never added to the freelist. +// +// This routine will fail with SQLITE_LOCKED if there are any open +// cursors on the table. +// +// If AUTOVACUUM is enabled and the page at iTable is not the last +// root page in the database file, then the last root page +// in the database file is moved into the slot formerly occupied by +// iTable and that last slot formerly occupied by the last root page +// is added to the freelist instead of iTable. In this say, all +// root pages are kept at the beginning of the database file, which +// is necessary for AUTOVACUUM to work right. *piMoved is set to the +// page number that used to be the last root page in the file before +// the move. If no page gets moved, *piMoved is set to 0. +// The last root page is recorded in meta[3] and the value of +// meta[3] is updated by this procedure. +func btreeDropTable(tls *libc.TLS, p uintptr, iTable Pgno, piMoved uintptr) int32 { /* sqlite3.c:75028:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var rc int32 at bp+12, 4 + + *(*uintptr)(unsafe.Pointer(bp /* pPage */)) = uintptr(0) + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + if iTable > btreePagecount(tls, pBt) { + return Xsqlite3CorruptError(tls, 75037) + } + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = btreeGetPage(tls, pBt, iTable, bp /* &pPage */, 0) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3BtreeClearTable(tls, p, int32(iTable), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != 0 { + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + + *(*int32)(unsafe.Pointer(piMoved)) = 0 + + if (*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0 { + // var maxRootPgno Pgno at bp+8, 4 + + Xsqlite3BtreeGetMeta(tls, p, BTREE_LARGEST_ROOT_PAGE, bp+8 /* &maxRootPgno */) + + if iTable == *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */)) { + // If the table being dropped is the table with the largest root-page + // number in the database, put the root page on the free list. + freePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), bp+12 /* &rc */) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + } else { + // The table being dropped does not have the largest root-page + // number in the database. So move the page that does into the + // gap left by the deleted root-page. + // var pMove uintptr at bp+16, 8 + + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = btreeGetPage(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */)), bp+16 /* &pMove */, 0) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = relocatePage(tls, pBt, *(*uintptr)(unsafe.Pointer(bp + 16 /* pMove */)), uint8(PTRMAP_ROOTPAGE), uint32(0), iTable, 0) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pMove */))) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + *(*uintptr)(unsafe.Pointer(bp + 16 /* pMove */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = btreeGetPage(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */)), bp+16 /* &pMove */, 0) + freePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pMove */)), bp+12 /* &rc */) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pMove */))) + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) + } + *(*int32)(unsafe.Pointer(piMoved)) = int32(*(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */))) + } + + // Set the new 'max-root-page' value in the database header. This + // is the old value less one, less one more if that happens to + // be a root-page number, less one again if that is the + // PENDING_BYTE_PAGE. + *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */))-- + for (*(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */)) == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1))) || + (ptrmapPageno(tls, pBt, *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */))) == (*(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */)))) { + *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */))-- + } + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3BtreeUpdateMeta(tls, p, 4, *(*Pgno)(unsafe.Pointer(bp + 8 /* maxRootPgno */))) + } else { + freePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */)), bp+12 /* &rc */) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp /* pPage */))) + } + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +func Xsqlite3BtreeDropTable(tls *libc.TLS, p uintptr, iTable int32, piMoved uintptr) int32 { /* sqlite3.c:75113:20: */ + var rc int32 + Xsqlite3BtreeEnter(tls, p) + rc = btreeDropTable(tls, p, uint32(iTable), piMoved) + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// This function may only be called if the b-tree connection already +// has a read or write transaction open on the database. +// +// Read the meta-information out of a database file. Meta[0] +// is the number of free pages currently in the database. Meta[1] +// through meta[15] are available for use by higher layers. Meta[0] +// is read-only, the others are read/write. +// +// The schema layer numbers meta values differently. At the schema +// layer (and the SetCookie and ReadCookie opcodes) the number of +// free pages is not visible. So Cookie[0] is the same as Meta[1]. +// +// This routine treats Meta[BTREE_DATA_VERSION] as a special case. Instead +// of reading the value out of the header, it instead loads the "DataVersion" +// from the pager. The BTREE_DATA_VERSION value is not actually stored in the +// database file. It is a number computed by the pager. But its access +// pattern is the same as header meta values, and so it is convenient to +// read it from this routine. +func Xsqlite3BtreeGetMeta(tls *libc.TLS, p uintptr, idx int32, pMeta uintptr) { /* sqlite3.c:75142:21: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + + Xsqlite3BtreeEnter(tls, p) + + if idx == BTREE_DATA_VERSION { + *(*U32)(unsafe.Pointer(pMeta)) = (Xsqlite3PagerDataVersion(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager) + (*Btree)(unsafe.Pointer(p)).FiBDataVersion) + } else { + *(*U32)(unsafe.Pointer(pMeta)) = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + uintptr((36 + (idx * 4))))) + } + + // If auto-vacuum is disabled in this build and this is an auto-vacuum + // database, mark the database as read-only. + + Xsqlite3BtreeLeave(tls, p) +} + +// Write meta-information back into the database. Meta[0] is +// read-only and may not be written. +func Xsqlite3BtreeUpdateMeta(tls *libc.TLS, p uintptr, idx int32, iMeta U32) int32 { /* sqlite3.c:75172:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + var pP1 uintptr + var rc int32 + + Xsqlite3BtreeEnter(tls, p) + + pP1 = (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if rc == SQLITE_OK { + Xsqlite3Put4byte(tls, (pP1 + uintptr((36 + (idx * 4)))), iMeta) + if idx == BTREE_INCR_VACUUM { + + (*BtShared)(unsafe.Pointer(pBt)).FincrVacuum = U8(iMeta) + } + } + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// The first argument, pCur, is a cursor opened on some b-tree. Count the +// number of entries in the b-tree and write the result to *pnEntry. +// +// SQLITE_OK is returned if the operation is successfully executed. +// Otherwise, if an error is encountered (i.e. an IO error or database +// corruption) an SQLite error code is returned. +func Xsqlite3BtreeCount(tls *libc.TLS, db uintptr, pCur uintptr, pnEntry uintptr) int32 { /* sqlite3.c:75204:20: */ + var nEntry I64 = int64(0) // Value to return in *pnEntry + var rc int32 // Return code + + rc = moveToRoot(tls, pCur) + if rc == SQLITE_EMPTY { + *(*I64)(unsafe.Pointer(pnEntry)) = int64(0) + return SQLITE_OK + } + + // Unless an error occurs, the following loop runs one iteration for each + // page in the B-Tree structure (not including overflow pages). + for (rc == SQLITE_OK) && !(libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0) { + var iIdx int32 // Index of child node in parent + var pPage uintptr // Current page of the b-tree + + // If this is a leaf page or the tree is not an int-key tree, then + // this page contains countable entries. Increment the entry counter + // accordingly. + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + if ((*MemPage)(unsafe.Pointer(pPage)).Fleaf != 0) || !(int32((*MemPage)(unsafe.Pointer(pPage)).FintKey) != 0) { + nEntry = nEntry + (I64((*MemPage)(unsafe.Pointer(pPage)).FnCell)) + } + + // pPage is a leaf node. This loop navigates the cursor so that it + // points to the first interior cell that it points to the parent of + // the next page in the tree that has not yet been visited. The + // pCur->aiIdx[pCur->iPage] value is set to the index of the parent cell + // of the page, or to the number of cells in the page if the next page + // to visit is the right-child of its parent. + // + // If all pages in the tree have been visited, return SQLITE_OK to the + // caller. + if (*MemPage)(unsafe.Pointer(pPage)).Fleaf != 0 { + for ok := true; ok; ok = (int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) >= int32((*MemPage)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpPage)).FnCell)) { + if int32((*BtCursor)(unsafe.Pointer(pCur)).FiPage) == 0 { + // All pages of the b-tree have been visited. Return successfully. + *(*I64)(unsafe.Pointer(pnEntry)) = nEntry + return moveToRoot(tls, pCur) + } + moveToParent(tls, pCur) + } + + (*BtCursor)(unsafe.Pointer(pCur)).Fix++ + pPage = (*BtCursor)(unsafe.Pointer(pCur)).FpPage + } + + // Descend to the child node of the cell that the cursor currently + // points at. This is the right-child if (iIdx==pPage->nCell). + iIdx = int32((*BtCursor)(unsafe.Pointer(pCur)).Fix) + if iIdx == int32((*MemPage)(unsafe.Pointer(pPage)).FnCell) { + rc = moveToChild(tls, pCur, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer(pPage)).FaData+uintptr((int32((*MemPage)(unsafe.Pointer(pPage)).FhdrOffset)+8))))) + } else { + rc = moveToChild(tls, pCur, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((pPage))).FaData+uintptr((int32((*MemPage)(unsafe.Pointer((pPage))).FmaskPage)&int32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(((*MemPage)(unsafe.Pointer((pPage))).FaCellIdx + uintptr((2 * (iIdx))))))))))))) + } + } + + // An error has occurred. Return an error code. + return rc +} + +// Return the pager associated with a BTree. This routine is used for +// testing and debugging only. +func Xsqlite3BtreePager(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:75273:22: */ + return (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpPager +} + +// Append a message to the error message string. +func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:75281:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var ap Va_list + _ = ap + if !((*IntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { + return + } + (*IntegrityCk)(unsafe.Pointer(pCheck)).FmxErr-- + (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ + ap = va + if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { + Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3172 /* "\n" */, 1) + } + if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { + Xsqlite3_str_appendf(tls, (pCheck + 56 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) + } + Xsqlite3_str_vappendf(tls, (pCheck + 56 /* &.errMsg */), zFormat, ap) + _ = ap + if int32((*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FaccError) == SQLITE_NOMEM { + (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 + } +} + +// Return non-zero if the bit in the IntegrityCk.aPgRef[] array that +// corresponds to page iPg is already set. +func getPageReferenced(tls *libc.TLS, pCheck uintptr, iPg Pgno) int32 { /* sqlite3.c:75311:12: */ + + return (int32(*(*U8)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FaPgRef + uintptr((iPg / Pgno(8)))))) & (int32(1) << (iPg & Pgno(0x07)))) +} + +// Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg. +func setPageReferenced(tls *libc.TLS, pCheck uintptr, iPg Pgno) { /* sqlite3.c:75319:13: */ + + *(*U8)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FaPgRef + uintptr((iPg / Pgno(8))))) |= U8((int32(1) << (iPg & Pgno(0x07)))) +} + +// Add 1 to the reference count for page iPage. If this is the second +// reference to the page, add an error message to pCheck->zErrMsg. +// Return 1 if there are 2 or more references to the page and 0 if +// if this is the first reference to the page. +// +// Also check that the page number is in bounds. +func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75333:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { + checkAppendMsg(tls, pCheck, ts+3174 /* "invalid page num..." */, libc.VaList(bp, iPage)) + return 1 + } + if getPageReferenced(tls, pCheck, iPage) != 0 { + checkAppendMsg(tls, pCheck, ts+3197 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + return 1 + } + if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { + return 1 + } + setPageReferenced(tls, pCheck, iPage) + return 0 +} + +// Check that the entry in the pointer-map for page iChild maps to +// page iParent, pointer type ptrType. If not, append an error message +// to pCheck. +func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent Pgno) { /* sqlite3.c:75353:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 + // var ePtrmapType U8 at bp+48, 1 + + // var iPtrmapParent Pgno at bp+52, 4 + + rc = ptrmapGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt, iChild, bp+48 /* &ePtrmapType */, bp+52 /* &iPtrmapParent */) + if rc != SQLITE_OK { + if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { + (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 + } + checkAppendMsg(tls, pCheck, ts+3222 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + return + } + + if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { + checkAppendMsg(tls, pCheck, + ts+3251, /* "Bad ptr map entr..." */ + libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) + } +} + +// Check the integrity of the freelist or of an overflow page list. +// Verify that the number of pages on the list is N. +func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U32) { /* sqlite3.c:75382:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var i int32 + var expected U32 = N + var nErrAtStart int32 = (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr + for (iPage != Pgno(0)) && ((*IntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { + // var pOvflPage uintptr at bp+40, 8 + + var pOvflData uintptr + if checkRef(tls, pCheck, iPage) != 0 { + break + } + N-- + if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { + checkAppendMsg(tls, pCheck, ts+3305 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + break + } + pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) + if isFreeList != 0 { + var n U32 = Xsqlite3Get4byte(tls, (pOvflData + 4)) + if (*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 { + checkPtrmap(tls, pCheck, iPage, uint8(PTRMAP_FREEPAGE), uint32(0)) + } + if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { + checkAppendMsg(tls, pCheck, + ts+3327 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + N-- + } else { + for i = 0; i < int32(n); i++ { + var iFreePage Pgno = Xsqlite3Get4byte(tls, (pOvflData + uintptr((8 + (i * 4))))) + if (*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 { + checkPtrmap(tls, pCheck, iFreePage, uint8(PTRMAP_FREEPAGE), uint32(0)) + } + checkRef(tls, pCheck, iFreePage) + } + N = N - (n) + } + } else { + // If this database supports auto-vacuum and iPage is not the last + // page in this overflow list, check that the pointer-map entry for + // the following page matches iPage. + if ((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0) && (N > U32(0)) { + i = int32(Xsqlite3Get4byte(tls, pOvflData)) + checkPtrmap(tls, pCheck, uint32(i), uint8(PTRMAP_OVERFLOW2), iPage) + } + } + iPage = Xsqlite3Get4byte(tls, pOvflData) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) + } + if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { + checkAppendMsg(tls, pCheck, + ts+3366, /* "%s is %d but sho..." */ + libc.VaList(bp+16, func() uintptr { + if isFreeList != 0 { + return ts + 3392 /* "size" */ + } + return ts + 3397 /* "overflow list le..." */ + }(), + (expected-N), expected)) + } +} + +// An implementation of a min-heap. +// +// aHeap[0] is the number of elements on the heap. aHeap[1] is the +// root element. The daughter nodes of aHeap[N] are aHeap[N*2] +// and aHeap[N*2+1]. +// +// The heap property is this: Every node is less than or equal to both +// of its daughter nodes. A consequence of the heap property is that the +// root node aHeap[1] is always the minimum value currently in the heap. +// +// The btreeHeapInsert() routine inserts an unsigned 32-bit number onto +// the heap, preserving the heap property. The btreeHeapPull() routine +// removes the root element from the heap (the minimum value in the heap) +// and then moves other nodes around as necessary to preserve the heap +// property. +// +// This heap is used for cell overlap and coverage testing. Each u32 +// entry represents the span of a cell or freeblock on a btree page. +// The upper 16 bits are the index of the first byte of a range and the +// lower 16 bits are the index of the last byte of that range. +func btreeHeapInsert(tls *libc.TLS, aHeap uintptr, x U32) { /* sqlite3.c:75471:13: */ + var j U32 + var i U32 = libc.PreIncUint32(&*(*U32)(unsafe.Pointer(aHeap)), 1) + *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4)) = x + for ((libc.AssignUint32(&j, (i / U32(2)))) > U32(0)) && (*(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) > *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4))) { + x = *(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) + *(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) = *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4)) + *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4)) = x + i = j + } +} + +func btreeHeapPull(tls *libc.TLS, aHeap uintptr, pOut uintptr) int32 { /* sqlite3.c:75481:12: */ + var j U32 + var i U32 + var x U32 + if (libc.AssignUint32(&x, *(*U32)(unsafe.Pointer(aHeap)))) == U32(0) { + return 0 + } + *(*U32)(unsafe.Pointer(pOut)) = *(*U32)(unsafe.Pointer(aHeap + 1*4)) + *(*U32)(unsafe.Pointer(aHeap + 1*4)) = *(*U32)(unsafe.Pointer(aHeap + uintptr(x)*4)) + *(*U32)(unsafe.Pointer(aHeap + uintptr(x)*4)) = 0xffffffff + *(*U32)(unsafe.Pointer(aHeap))-- + i = U32(1) + for (libc.AssignUint32(&j, (i * U32(2)))) <= *(*U32)(unsafe.Pointer(aHeap)) { + if *(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) > *(*U32)(unsafe.Pointer(aHeap + uintptr((j+U32(1)))*4)) { + j++ + } + if *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4)) < *(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) { + break + } + x = *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4)) + *(*U32)(unsafe.Pointer(aHeap + uintptr(i)*4)) = *(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) + *(*U32)(unsafe.Pointer(aHeap + uintptr(j)*4)) = x + i = j + } + return 1 +} + +// Do various sanity checks on a single page of a tree. Return +// the tree depth. Root pages return 0. Parents of root pages +// return 1, and so forth. +// +// These checks are done: +// +// 1. Make sure that cells and freeblocks do not overlap +// but combine to completely cover the page. +// 2. Make sure integer cell keys are in order. +// 3. Check the integrity of overflow pages. +// 4. Recursively call checkTreePage on all children. +// 5. Verify that the depth of all children is the same. +func checkTreePage(tls *libc.TLS, pCheck uintptr, iPage Pgno, piMinKey uintptr, maxKey I64) int32 { /* sqlite3.c:75515:12: */ + bp := tls.Alloc(140) + defer tls.Free(140) + *(*I64)(unsafe.Pointer(bp + 104)) = maxKey + + // var pPage uintptr at bp+96, 8 + // The page being analyzed + var i int32 // Loop counter + var rc int32 // Result code from subroutine call + var depth int32 + var d2 int32 // Depth of a subtree + var pgno int32 // Page number + var nFrag int32 // Number of fragmented bytes on the page + var hdr int32 // Offset to the page header + var cellStart int32 // Offset to the start of the cell pointer array + var nCell int32 // Number of cells + var doCoverageCheck int32 // True if cell coverage checking should be done + var keyCanBeEqual int32 // True if IPK can be equal to maxKey + // False if IPK must be strictly less than maxKey + var data uintptr // Page content + var pCell uintptr // Cell content + var pCellIdx uintptr // Next element of the cell pointer array + var pBt uintptr // The BtShared object that owns pPage + var pc U32 // Address of a cell + var usableSize U32 // Usable size of the page + var contentOffset U32 // Offset to the start of the cell content area + var heap uintptr // Min-heap used for checking cell coverage + // var x U32 at bp+136, 4 + + var prev U32 // Next and previous entry on the min-heap + var saved_zPfx uintptr + var saved_v1 int32 + var saved_v2 int32 + var savedIsInit U8 + var nPage U32 // Number of pages on the overflow chain + var pgnoOvfl Pgno + // var info CellInfo at bp+112, 24 + + var size U32 + var size1 int32 + var j int32 + *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)) = uintptr(0) + depth = -1 + doCoverageCheck = 1 + keyCanBeEqual = 1 + heap = uintptr(0) + prev = U32(0) + saved_zPfx = (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx + saved_v1 = int32((*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1) + saved_v2 = (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2 + savedIsInit = U8(0) + + // Check that the page exists + pBt = (*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt + usableSize = (*BtShared)(unsafe.Pointer(pBt)).FusableSize + if !(iPage == Pgno(0)) { + goto __1 + } + return 0 +__1: + ; + if !(checkRef(tls, pCheck, iPage) != 0) { + goto __2 + } + return 0 +__2: + ; + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3418 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage + if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { + goto __3 + } + checkAppendMsg(tls, pCheck, + ts+3428 /* "unable to get th..." */, libc.VaList(bp, rc)) + goto end_of_check +__3: + ; + + // Clear MemPage.isInit to make sure the corruption detection code in + // btreeInitPage() is executed. + savedIsInit = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FisInit + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FisInit = U8(0) + if !((libc.AssignInt32(&rc, btreeInitPage(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */))))) != 0) { + goto __4 + } + // The only possible error from InitPage + checkAppendMsg(tls, pCheck, + ts+3466 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + goto end_of_check +__4: + ; + if !((libc.AssignInt32(&rc, btreeComputeFreeSpace(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */))))) != 0) { + goto __5 + } + + checkAppendMsg(tls, pCheck, ts+3504 /* "free space corru..." */, libc.VaList(bp+16, rc)) + goto end_of_check +__5: + ; + data = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FaData + hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) + + // Set up for cell analysis + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3526 /* "On tree page %u ..." */ + contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) + // Enforced by btreeInitPage() + + // EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the + // number of cells on the page. + nCell = ((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 3)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 3))) + 1)))) + + // EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page + // immediately follows the b-tree page header. + cellStart = ((hdr + 12) - (4 * int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf))) + + pCellIdx = (data + uintptr((cellStart + (2 * (nCell - 1))))) + + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf) != 0)) { + goto __6 + } + // Analyze the right-child page of internal pages + pgno = int32(Xsqlite3Get4byte(tls, (data + uintptr((hdr + 8))))) + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __8 + } + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3552 /* "On page %u at ri..." */ + checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) +__8: + ; + depth = checkTreePage(tls, pCheck, uint32(pgno), bp+104 /* &maxKey */, *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */))) + keyCanBeEqual = 0 + goto __7 +__6: + // For leaf pages, the coverage check will occur in the same loop + // as the other cell checks, so initialize the heap. + heap = (*IntegrityCk)(unsafe.Pointer(pCheck)).Fheap + *(*U32)(unsafe.Pointer(heap)) = U32(0) +__7: + ; + + // EVIDENCE-OF: R-02776-14802 The cell pointer array consists of K 2-byte + // integer offsets to the cell contents. + i = (nCell - 1) +__9: + if !((i >= 0) && ((*IntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0)) { + goto __11 + } + + // Check cell size + (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = i + + pc = U32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer(pCellIdx)))) + pCellIdx -= uintptr(2) + if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { + goto __12 + } + checkAppendMsg(tls, pCheck, ts+3580, /* "Offset %d out of..." */ + libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) + doCoverageCheck = 0 + goto __10 +__12: + ; + pCell = (data + uintptr(pc)) + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)) + 128 /* &.xParseCell */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)), pCell, bp+112 /* &info */) + if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { + goto __13 + } + checkAppendMsg(tls, pCheck, ts+3610 /* "Extends off end ..." */, 0) + doCoverageCheck = 0 + goto __10 +__13: + ; + + // Check for integer primary key out of range + if !((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FintKey != 0) { + goto __14 + } + if !(func() int32 { + if keyCanBeEqual != 0 { + return (libc.Bool32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey > *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)))) + } + return (libc.Bool32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey >= *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)))) + }() != 0) { + goto __15 + } + checkAppendMsg(tls, pCheck, ts+3634 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) +__15: + ; + *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey + keyCanBeEqual = 0 // Only the first key on the page may ==maxKey +__14: + ; + + // Check the content overflow list + if !((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnPayload > U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnLocal)) { + goto __16 + } // First page of the overflow chain + + nPage = (((((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnPayload - U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnLocal)) + usableSize) - U32(5)) / (usableSize - U32(4))) + pgnoOvfl = Xsqlite3Get4byte(tls, (pCell + uintptr((int32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize) - 4)))) + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __17 + } + checkPtrmap(tls, pCheck, pgnoOvfl, uint8(PTRMAP_OVERFLOW1), iPage) +__17: + ; + checkList(tls, pCheck, 0, pgnoOvfl, nPage) +__16: + ; + + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf) != 0)) { + goto __18 + } + // Check sanity of left child page for internal pages + pgno = int32(Xsqlite3Get4byte(tls, pCell)) + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __20 + } + checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) +__20: + ; + d2 = checkTreePage(tls, pCheck, uint32(pgno), bp+104 /* &maxKey */, *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */))) + keyCanBeEqual = 0 + if !(d2 != depth) { + goto __21 + } + checkAppendMsg(tls, pCheck, ts+3658 /* "Child page depth..." */, 0) + depth = d2 +__21: + ; + goto __19 +__18: + // Populate the coverage-checking heap for leaf pages + btreeHeapInsert(tls, heap, ((pc << 16) | ((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) - U32(1)))) +__19: + ; + goto __10 +__10: + i-- + goto __9 + goto __11 +__11: + ; + *(*I64)(unsafe.Pointer(piMinKey)) = *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) + + // Check for complete coverage of the page + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = uintptr(0) + if !((doCoverageCheck != 0) && ((*IntegrityCk)(unsafe.Pointer(pCheck)).FmxErr > 0)) { + goto __22 + } + // For leaf pages, the min-heap has already been initialized and the + // cells have already been inserted. But for internal pages, that has + // not yet been done, so do it now + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf) != 0)) { + goto __23 + } + heap = (*IntegrityCk)(unsafe.Pointer(pCheck)).Fheap + *(*U32)(unsafe.Pointer(heap)) = U32(0) + i = (nCell - 1) +__24: + if !(i >= 0) { + goto __26 + } + pc = U32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer((data + uintptr((cellStart + (i * 2)))))))) + size = U32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)) + 120 /* &.xCellSize */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)), (data + uintptr(pc)))) + btreeHeapInsert(tls, heap, ((pc << 16) | ((pc + size) - U32(1)))) + goto __25 +__25: + i-- + goto __24 + goto __26 +__26: + ; +__23: + ; + // Add the freeblocks to the min-heap + // + // EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header + // is the offset of the first freeblock, or zero if there are no + // freeblocks on the page. + i = ((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 1)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 1))) + 1)))) +__27: + if !(i > 0) { + goto __28 + } + // Enforced by btreeComputeFreeSpace() + size1 = ((int32(*(*U8)(unsafe.Pointer((data + uintptr((i + 2)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((i + 2))) + 1)))) + // due to btreeComputeFreeSpace() + btreeHeapInsert(tls, heap, (((U32(i)) << 16) | (U32((i + size1) - 1)))) + // EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a + // big-endian integer which is the offset in the b-tree page of the next + // freeblock in the chain, or zero if the freeblock is the last on the + // chain. + j = ((int32(*(*U8)(unsafe.Pointer((data + uintptr(i))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr(i)) + 1)))) + // EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of + // increasing offset. + // Enforced by btreeComputeFreeSpace() + // Enforced by btreeComputeFreeSpace() + i = j + goto __27 +__28: + ; + // Analyze the min-heap looking for overlap between cells and/or + // freeblocks, and counting the number of untracked bytes in nFrag. + // + // Each min-heap entry is of the form: (start_address<<16)|end_address. + // There is an implied first entry the covers the page header, the cell + // pointer index, and the gap between the cell pointer index and the start + // of cell content. + // + // The loop below pulls entries from the min-heap in order and compares + // the start_address against the previous end_address. If there is an + // overlap, that means bytes are used multiple times. If there is a gap, + // that gap is added to the fragmentation count. + nFrag = 0 + prev = (contentOffset - U32(1)) // Implied first min-heap entry +__29: + if !(btreeHeapPull(tls, heap, bp+136 /* &x */) != 0) { + goto __30 + } + if !((prev & U32(0xffff)) >= (*(*U32)(unsafe.Pointer(bp + 136 /* x */)) >> 16)) { + goto __31 + } + checkAppendMsg(tls, pCheck, + ts+3683 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) + goto __30 + goto __32 +__31: + nFrag = int32(U32(nFrag) + (((*(*U32)(unsafe.Pointer(bp + 136 /* x */)) >> 16) - (prev & U32(0xffff))) - U32(1))) + prev = *(*U32)(unsafe.Pointer(bp + 136 /* x */)) +__32: + ; + goto __29 +__30: + ; + nFrag = int32(U32(nFrag) + ((usableSize - (prev & U32(0xffff))) - U32(1))) + // EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments + // is stored in the fifth field of the b-tree page header. + // EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the + // number of fragmented free bytes within the cell content area. + if !((*(*U32)(unsafe.Pointer(heap)) == U32(0)) && (nFrag != int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))))) { + goto __33 + } + checkAppendMsg(tls, pCheck, + ts+3720, /* "Fragmentation of..." */ + libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) +__33: + ; +__22: + ; + +end_of_check: + if !(!(doCoverageCheck != 0)) { + goto __34 + } + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FisInit = savedIsInit +__34: + ; + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */))) + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = saved_zPfx + (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = Pgno(saved_v1) + (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = saved_v2 + return (depth + 1) +} + +// This routine does a complete check of the given BTree file. aRoot[] is +// an array of pages numbers were each page number is the root page of +// a table. nRoot is the number of entries in aRoot. +// +// A read-only or read-write transaction must be opened before calling +// this function. +// +// Write the number of error seen in *pnErr. Except for some memory +// allocation errors, an error message held in memory obtained from +// malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is +// returned. If a memory allocation error occurs, NULL is returned. +// +// If the first entry in aRoot[] is 0, that indicates that the list of +// root pages is incomplete. This is a "partial integrity-check". This +// happens when performing an integrity check on a single table. The +// zero is skipped, of course. But in addition, the freelist checks +// and the checks to make sure every page is referenced are also skipped, +// since obviously it is not possible to know which pages are covered by +// the unverified btrees. Except, if aRoot[1] is 1, then the freelist +// checks are still performed. +func Xsqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uintptr, nRoot int32, mxErr int32, pnErr uintptr) uintptr { /* sqlite3.c:75794:21: */ + bp := tls.Alloc(248) + defer tls.Free(248) + + var i Pgno + // var sCheck IntegrityCk at bp+32, 104 + + var pBt uintptr + var savedDbFlags U64 + // var zErr [100]int8 at bp+136, 100 + + var bPartial int32 // True if not checking all btrees + var bCkFreelist int32 + var mx Pgno + var mxInHdr Pgno + // var notUsed I64 at bp+240, 8 + pBt = (*Btree)(unsafe.Pointer(p)).FpBt + savedDbFlags = (*Sqlite3)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags + bPartial = 0 + bCkFreelist = 1 // True to scan the freelist + + // aRoot[0]==0 means this is a partial check + if !(*(*Pgno)(unsafe.Pointer(aRoot)) == Pgno(0)) { + goto __1 + } + + bPartial = 1 + if !(*(*Pgno)(unsafe.Pointer(aRoot + 1*4)) != Pgno(1)) { + goto __2 + } + bCkFreelist = 0 +__2: + ; +__1: + ; + + Xsqlite3BtreeEnter(tls, p) + + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fdb = db + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FpBt = pBt + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FpPager = (*BtShared)(unsafe.Pointer(pBt)).FpPager + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FnPage = btreePagecount(tls, (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FpBt) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FmxErr = mxErr + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FnErr = 0 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FbOomFault = 0 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fv1 = Pgno(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fv2 = 0 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FaPgRef = uintptr(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fheap = uintptr(0) + Xsqlite3StrAccumInit(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */), uintptr(0), bp+136 /* &zErr[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FerrMsg.FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage == Pgno(0)) { + goto __3 + } + goto integrity_ck_cleanup +__3: + ; + + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FaPgRef = Xsqlite3MallocZero(tls, (uint64(((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage / Pgno(8)) + Pgno(1)))) + if !(!(int32((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FaPgRef) != 0)) { + goto __4 + } + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FbOomFault = 1 + goto integrity_ck_cleanup +__4: + ; + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fheap = Xsqlite3PageMalloc(tls, int32((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).Fheap == uintptr(0)) { + goto __5 + } + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FbOomFault = 1 + goto integrity_ck_cleanup +__5: + ; + + i = ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1)) + if !(i <= (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage) { + goto __6 + } + setPageReferenced(tls, bp+32 /* &sCheck */, i) +__6: + ; + + // Check the integrity of the freelist + if !(bCkFreelist != 0) { + goto __7 + } + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3772 /* "Main freelist: " */ + checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), + Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) +__7: + ; + + // Check all the tables. + if !(!(bPartial != 0)) { + goto __8 + } + if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { + goto __9 + } + mx = Pgno(0) + i = Pgno(0) +__11: + if !(int32(i) < nRoot) { + goto __13 + } + if !(mx < *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4))) { + goto __14 + } + mx = *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) +__14: + ; + goto __12 +__12: + i++ + goto __11 + goto __13 +__13: + ; + mxInHdr = Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + 52)) + if !(mx != mxInHdr) { + goto __15 + } + checkAppendMsg(tls, bp+32, /* &sCheck */ + ts+3788, /* "max rootpage (%d..." */ + libc.VaList(bp, mx, mxInHdr)) +__15: + ; + goto __10 +__9: + if !(Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64)) != U32(0)) { + goto __16 + } + checkAppendMsg(tls, bp+32, /* &sCheck */ + ts+3833 /* "incremental_vacu..." */, 0) +__16: + ; +__10: + ; +__8: + ; + + *(*U64)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_CellSizeCk))) + i = Pgno(0) +__17: + if !((int32(i) < nRoot) && ((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FmxErr != 0)) { + goto __19 + } + if !(*(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) == Pgno(0)) { + goto __20 + } + goto __18 +__20: + ; + if !((((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && (*(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) > Pgno(1))) && !(bPartial != 0)) { + goto __21 + } + checkPtrmap(tls, bp+32 /* &sCheck */, *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), uint8(PTRMAP_ROOTPAGE), uint32(0)) +__21: + ; + checkTreePage(tls, bp+32 /* &sCheck */, *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+240 /* ¬Used */, (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + goto __18 +__18: + i++ + goto __17 + goto __19 +__19: + ; + (*Sqlite3)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags = savedDbFlags + + // Make sure every page in the file is referenced + if !(!(bPartial != 0)) { + goto __22 + } + i = Pgno(1) +__23: + if !((i <= (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage) && ((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FmxErr != 0)) { + goto __25 + } + // If the database supports auto-vacuum, make sure no tables contain + // references to pointer-map pages. + if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { + goto __26 + } + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3888 /* "Page %d is never..." */, libc.VaList(bp+16, i)) +__26: + ; + if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { + goto __27 + } + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3910 /* "Pointer map page..." */, libc.VaList(bp+24, i)) +__27: + ; + goto __24 +__24: + i++ + goto __23 + goto __25 +__25: + ; +__22: + ; + + // Clean up and report errors. +integrity_ck_cleanup: + Xsqlite3PageFree(tls, (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).Fheap) + Xsqlite3_free(tls, (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FaPgRef) + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FbOomFault != 0) { + goto __28 + } + Xsqlite3_str_reset(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */)) + (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnErr++ +__28: + ; + *(*int32)(unsafe.Pointer(pnErr)) = (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FnErr + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnErr == 0) { + goto __29 + } + Xsqlite3_str_reset(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */)) +__29: + ; + // Make sure this analysis did not leave any unref() pages. + + Xsqlite3BtreeLeave(tls, p) + return Xsqlite3StrAccumFinish(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */)) +} + +// Return the full pathname of the underlying database file. Return +// an empty string if the database is in-memory or a TEMP database. +// +// The pager filename is invariant as long as the pager is +// open so it is safe to access without the BtShared mutex. +func Xsqlite3BtreeGetFilename(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:75949:27: */ + + return Xsqlite3PagerFilename(tls, (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpPager, 1) +} + +// Return the pathname of the journal file for this database. The return +// value of this routine is the same regardless of whether the journal file +// has been created or not. +// +// The pager journal filename is invariant as long as the pager is +// open so it is safe to access without the BtShared mutex. +func Xsqlite3BtreeGetJournalname(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:75962:27: */ + + return Xsqlite3PagerJournalname(tls, (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FpPager) +} + +// Return one of SQLITE_TXN_NONE, SQLITE_TXN_READ, or SQLITE_TXN_WRITE +// to describe the current transaction state of Btree p. +func Xsqlite3BtreeTxnState(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:75971:20: */ + + if p != 0 { + return int32((*Btree)(unsafe.Pointer(p)).FinTrans) + } + return 0 +} + +// Run a checkpoint on the Btree passed as the first argument. +// +// Return SQLITE_LOCKED if this or any other connection has an open +// transaction on the shared-cache the argument Btree is connected to. +// +// Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. +func Xsqlite3BtreeCheckpoint(tls *libc.TLS, p uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) int32 { /* sqlite3.c:75985:20: */ + var rc int32 = SQLITE_OK + if p != 0 { + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + Xsqlite3BtreeEnter(tls, p) + if int32((*BtShared)(unsafe.Pointer(pBt)).FinTransaction) != TRANS_NONE { + rc = SQLITE_LOCKED + } else { + rc = Xsqlite3PagerCheckpoint(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, (*Btree)(unsafe.Pointer(p)).Fdb, eMode, pnLog, pnCkpt) + } + Xsqlite3BtreeLeave(tls, p) + } + return rc +} + +// Return true if there is currently a backup running on Btree p. +func Xsqlite3BtreeIsInBackup(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76004:20: */ + + return (libc.Bool32((*Btree)(unsafe.Pointer(p)).FnBackup != 0)) +} + +// This function returns a pointer to a blob of memory associated with +// a single shared-btree. The memory is used by client code for its own +// purposes (for example, to store a high-level schema associated with +// the shared-btree). The btree layer manages reference counting issues. +// +// The first time this is called on a shared-btree, nBytes bytes of memory +// are allocated, zeroed, and returned to the caller. For each subsequent +// call the nBytes parameter is ignored and a pointer to the same blob +// of memory returned. +// +// If the nBytes parameter is 0 and the blob of memory has not yet been +// allocated, a null pointer is returned. If the blob has already been +// allocated, it is returned as normal. +// +// Just before the shared-btree is closed, the function passed as the +// xFree argument when the memory allocation was made is invoked on the +// blob of allocated memory. The xFree function should not call sqlite3_free() +// on the memory, the btree layer does that. +func Xsqlite3BtreeSchema(tls *libc.TLS, p uintptr, nBytes int32, xFree uintptr) uintptr { /* sqlite3.c:76030:21: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(p)).FpBt + Xsqlite3BtreeEnter(tls, p) + if !(int32((*BtShared)(unsafe.Pointer(pBt)).FpSchema) != 0) && (nBytes != 0) { + (*BtShared)(unsafe.Pointer(pBt)).FpSchema = Xsqlite3DbMallocZero(tls, uintptr(0), uint64(nBytes)) + (*BtShared)(unsafe.Pointer(pBt)).FxFreeSchema = xFree + } + Xsqlite3BtreeLeave(tls, p) + return (*BtShared)(unsafe.Pointer(pBt)).FpSchema +} + +// Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared +// btree as the argument handle holds an exclusive lock on the +// sqlite_schema table. Otherwise SQLITE_OK. +func Xsqlite3BtreeSchemaLocked(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76046:20: */ + var rc int32 + + Xsqlite3BtreeEnter(tls, p) + rc = querySharedCacheTableLock(tls, p, uint32(SCHEMA_ROOT), uint8(READ_LOCK)) + + Xsqlite3BtreeLeave(tls, p) + return rc +} + +// Obtain a lock on the table whose root page is iTab. The +// lock is a write lock if isWritelock is true or a read lock +// if it is false. +func Xsqlite3BtreeLockTable(tls *libc.TLS, p uintptr, iTab int32, isWriteLock U8) int32 { /* sqlite3.c:76063:20: */ + var rc int32 = SQLITE_OK + + if (*Btree)(unsafe.Pointer(p)).Fsharable != 0 { + var lockType U8 = (U8(READ_LOCK + int32(isWriteLock))) + + Xsqlite3BtreeEnter(tls, p) + rc = querySharedCacheTableLock(tls, p, uint32(iTab), lockType) + if rc == SQLITE_OK { + rc = setSharedCacheTableLock(tls, p, uint32(iTab), lockType) + } + Xsqlite3BtreeLeave(tls, p) + } + return rc +} + +// Argument pCsr must be a cursor opened for writing on an +// INTKEY table currently pointing at a valid table entry. +// This function modifies the data stored as part of that entry. +// +// Only the data content may only be modified, it is not possible to +// change the length of the data stored. If this function is called with +// parameters that attempt to write past the end of the existing data, +// no modifications are made and SQLITE_CORRUPT is returned. +func Xsqlite3BtreePutData(tls *libc.TLS, pCsr uintptr, offset U32, amt U32, z uintptr) int32 { /* sqlite3.c:76093:20: */ + var rc int32 + + rc = func() int32 { + if int32((*BtCursor)(unsafe.Pointer(pCsr)).FeState) >= CURSOR_REQUIRESEEK { + return btreeRestoreCursorPosition(tls, pCsr) + } + return SQLITE_OK + }() + if rc != SQLITE_OK { + return rc + } + + if int32((*BtCursor)(unsafe.Pointer(pCsr)).FeState) != CURSOR_VALID { + return SQLITE_ABORT + } + + // Save the positions of all other cursors open on this table. This is + // required in case any of them are holding references to an xFetch + // version of the b-tree page modified by the accessPayload call below. + // + // Note that pCsr must be open on a INTKEY table and saveCursorPosition() + // and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence + // saveAllCursors can only return SQLITE_OK. + saveAllCursors(tls, (*BtCursor)(unsafe.Pointer(pCsr)).FpBt, (*BtCursor)(unsafe.Pointer(pCsr)).FpgnoRoot, pCsr) + + // Check some assumptions: + // (a) the cursor is open for writing, + // (b) there is a read/write transaction open, + // (c) the connection holds a write-lock on the table (if required), + // (d) there are no conflicting read-locks, and + // (e) the cursor points at a valid row of an intKey table. + if (int32((*BtCursor)(unsafe.Pointer(pCsr)).FcurFlags) & BTCF_WriteFlag) == 0 { + return SQLITE_READONLY + } + + return accessPayload(tls, pCsr, offset, amt, z, 1) +} + +// Mark this cursor as an incremental blob cursor. +func Xsqlite3BtreeIncrblobCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:76141:21: */ + *(*U8)(unsafe.Pointer(pCur + 1 /* &.curFlags */)) |= U8((BTCF_Incrblob)) + (*Btree)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBtree)).FhasIncrblobCur = U8(1) +} + +// Set both the "read version" (single byte at byte offset 18) and +// "write version" (single byte at byte offset 19) fields in the database +// header to iVersion. +func Xsqlite3BtreeSetVersion(tls *libc.TLS, pBtree uintptr, iVersion int32) int32 { /* sqlite3.c:76152:20: */ + var pBt uintptr = (*Btree)(unsafe.Pointer(pBtree)).FpBt + var rc int32 // Return code + + // If setting the version fields to 1, do not automatically open the + // WAL connection, even if the version fields are currently set to 2. + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_NO_WAL))) + if iVersion == 1 { + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) |= U16((BTS_NO_WAL)) + } + + rc = Xsqlite3BtreeBeginTrans(tls, pBtree, 0, uintptr(0)) + if rc == SQLITE_OK { + var aData uintptr = (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData + if (int32(*(*U8)(unsafe.Pointer(aData + 18))) != int32(U8(iVersion))) || (int32(*(*U8)(unsafe.Pointer(aData + 19))) != int32(U8(iVersion))) { + rc = Xsqlite3BtreeBeginTrans(tls, pBtree, 2, uintptr(0)) + if rc == SQLITE_OK { + rc = Xsqlite3PagerWrite(tls, (*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FpDbPage) + if rc == SQLITE_OK { + *(*U8)(unsafe.Pointer(aData + 18)) = U8(iVersion) + *(*U8)(unsafe.Pointer(aData + 19)) = U8(iVersion) + } + } + } + } + + *(*U16)(unsafe.Pointer(pBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_NO_WAL))) + return rc +} + +// Return true if the cursor has a hint specified. This routine is +// only used from within assert() statements +func Xsqlite3BtreeCursorHasHint(tls *libc.TLS, pCsr uintptr, mask uint32) int32 { /* sqlite3.c:76187:20: */ + return (libc.Bool32((uint32((*BtCursor)(unsafe.Pointer(pCsr)).Fhints) & mask) != uint32(0))) +} + +// Return true if the given Btree is read-only. +func Xsqlite3BtreeIsReadonly(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76194:20: */ + return (libc.Bool32((int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FbtsFlags) & BTS_READ_ONLY) != 0)) +} + +// Return the size of the header added to each page by this module. +func Xsqlite3HeaderSizeBtree(tls *libc.TLS) int32 { /* sqlite3.c:76201:20: */ + return (int32(((uint64(unsafe.Sizeof(MemPage{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) +} + +// Return true if the Btree passed as the only argument is sharable. +func Xsqlite3BtreeSharable(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76207:20: */ + return int32((*Btree)(unsafe.Pointer(p)).Fsharable) +} + +// Return the number of connections to the BtShared object accessed by +// the Btree handle passed as the only argument. For private caches +// this is always 1. For shared caches it may be 1 or greater. +func Xsqlite3BtreeConnectionCount(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76216:20: */ + + return (*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer(p)).FpBt)).FnRef +} + +// THREAD SAFETY NOTES: +// +// Once it has been created using backup_init(), a single sqlite3_backup +// structure may be accessed via two groups of thread-safe entry points: +// +// * Via the sqlite3_backup_XXX() API function backup_step() and +// backup_finish(). Both these functions obtain the source database +// handle mutex and the mutex associated with the source BtShared +// structure, in that order. +// +// * Via the BackupUpdate() and BackupRestart() functions, which are +// invoked by the pager layer to report various state changes in +// the page cache associated with the source database. The mutex +// associated with the source database BtShared structure will always +// be held when either of these functions are invoked. +// +// The other sqlite3_backup_XXX() API functions, backup_remaining() and +// backup_pagecount() are not thread-safe functions. If they are called +// while some other thread is calling backup_step() or backup_finish(), +// the values returned may be invalid. There is no way for a call to +// BackupUpdate() or BackupRestart() to interfere with backup_remaining() +// or backup_pagecount(). +// +// Depending on the SQLite configuration, the database handles and/or +// the Btree objects may have their own mutexes that require locking. +// Non-sharable Btrees (in-memory databases for example), do not have +// associated mutexes. + +// Return a pointer corresponding to database zDb (i.e. "main", "temp") +// in connection handle pDb. If such a database cannot be found, return +// a NULL pointer and write an error message to pErrorDb. +// +// If the "temp" database is requested, it may need to be opened by this +// function. If an error occurs while doing so, return 0 and write an +// error message to pErrorDb. +func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintptr { /* sqlite3.c:76305:14: */ + bp := tls.Alloc(424) + defer tls.Free(424) + + var i int32 = Xsqlite3FindDbName(tls, pDb, zDb) + + if i == 1 { + // var sParse Parse at bp+16, 408 + + var rc int32 = 0 + libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb + if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2791 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + rc = SQLITE_ERROR + } + Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) + Xsqlite3ParserReset(tls, bp+16 /* &sParse */) + if rc != 0 { + return uintptr(0) + } + } + + if i < 0 { + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3944 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + return uintptr(0) + } + + return (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(pDb)).FaDb + uintptr(i)*32)).FpBt +} + +// Attempt to set the page size of the destination to match the page size +// of the source. +func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ + var rc int32 + rc = Xsqlite3BtreeSetPageSize(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest, Xsqlite3BtreeGetPageSize(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc), 0, 0) + return rc +} + +// Check that there is no open read-transaction on the b-tree passed as the +// second argument. If there is not, return SQLITE_OK. Otherwise, if there +// is an open read-transaction, return SQLITE_ERROR and leave an error +// message in database handle db. +func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ + if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3964 /* "destination data..." */, 0) + return SQLITE_ERROR + } + return SQLITE_OK +} + +// Create an sqlite3_backup process to copy the contents of zSrcDb from +// connection handle pSrcDb to zDestDb in pDestDb. If successful, return +// a pointer to the new sqlite3_backup object. +// +// If an error occurs, NULL is returned and an error code and error message +// stored in database handle pDestDb. +func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcDb uintptr, zSrcDb uintptr) uintptr { /* sqlite3.c:76364:27: */ + var p uintptr // Value to return + + // Lock the source database handle. The destination database + // handle is not locked in this routine, but it is locked in + // sqlite3_backup_step(). The user is required to ensure that no + // other thread accesses the destination handle for the duration + // of the backup operation. Any attempt to use the destination + // database connection while a backup is in progress may cause + // a malfunction or a deadlock. + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(pDestDb)).Fmutex) + + if pSrcDb == pDestDb { + Xsqlite3ErrorWithMsg(tls, + pDestDb, SQLITE_ERROR, ts+3995 /* "source and desti..." */, 0) + p = uintptr(0) + } else { + // Allocate space for a new sqlite3_backup object... + // EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a + // call to sqlite3_backup_init() and is destroyed by a call to + // sqlite3_backup_finish(). + p = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(Sqlite3_backup{}))) + if !(p != 0) { + Xsqlite3Error(tls, pDestDb, SQLITE_NOMEM) + } + } + + // If the allocation succeeded, populate the new object. + if p != 0 { + (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc = findBtree(tls, pDestDb, pSrcDb, zSrcDb) + (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest = findBtree(tls, pDestDb, pDestDb, zDestDb) + (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb = pDestDb + (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrcDb = pSrcDb + (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext = Pgno(1) + (*Sqlite3_backup)(unsafe.Pointer(p)).FisAttached = 0 + + if ((uintptr(0) == (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) || (uintptr(0) == (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest)) || + (checkReadTransaction(tls, pDestDb, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest) != SQLITE_OK) { + // One (or both) of the named databases did not exist or an OOM + // error was hit. Or there is a transaction open on the destination + // database. The error has already been written into the pDestDb + // handle. All that is left to do here is free the sqlite3_backup + // structure. + Xsqlite3_free(tls, p) + p = uintptr(0) + } + } + if p != 0 { + (*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FnBackup++ + } + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(pDestDb)).Fmutex) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) + return p +} + +// Argument rc is an SQLite error code. Return true if this error is +// considered fatal if encountered during a backup operation. All errors +// are considered fatal except for SQLITE_BUSY and SQLITE_LOCKED. +func isFatalError(tls *libc.TLS, rc int32) int32 { /* sqlite3.c:76441:12: */ + return (libc.Bool32(((rc != SQLITE_OK) && (rc != SQLITE_BUSY)) && (rc != SQLITE_LOCKED))) +} + +// Parameter zSrcData points to a buffer containing the data for +// page iSrcPg from the source database. Copy this data into the +// destination database. +func backupOnePage(tls *libc.TLS, p uintptr, iSrcPg Pgno, zSrcData uintptr, bUpdate int32) int32 { /* sqlite3.c:76450:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pDestPager uintptr = Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest) + var nSrcPgsz int32 = Xsqlite3BtreeGetPageSize(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) + var nDestPgsz int32 = Xsqlite3BtreeGetPageSize(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest) + var nCopy int32 = func() int32 { + if (nSrcPgsz) < (nDestPgsz) { + return nSrcPgsz + } + return nDestPgsz + }() + var iEnd I64 = (I64(iSrcPg) * I64(nSrcPgsz)) + var rc int32 = SQLITE_OK + var iOff I64 + + // Catch the case where the destination is an in-memory database and the + // page sizes of the source and destination differ. + if (nSrcPgsz != nDestPgsz) && (Xsqlite3PagerIsMemdb(tls, pDestPager) != 0) { + rc = SQLITE_READONLY + } + + // This loop runs once for each destination page spanned by the source + // page. For each iteration, variable iOff is set to the byte offset + // of the destination page. + for iOff = (iEnd - I64(nSrcPgsz)); (rc == SQLITE_OK) && (iOff < iEnd); iOff = iOff + (I64(nDestPgsz)) { + *(*uintptr)(unsafe.Pointer(bp /* pDestPg */)) = uintptr(0) + var iDest Pgno = ((Pgno(iOff / I64(nDestPgsz))) + Pgno(1)) + if iDest == ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDest)).FpBt)).FpageSize)) + U32(1)) { + continue + } + if (SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3PagerGet(tls, pDestPager, iDest, bp /* &pDestPg */, 0)))) && + (SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp /* pDestPg */)))))) { + var zIn uintptr = (zSrcData + uintptr((iOff % I64(nSrcPgsz)))) + var zDestData uintptr = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp /* pDestPg */))) + var zOut uintptr = (zDestData + uintptr((iOff % I64(nDestPgsz)))) + + // Copy the data from the source page into the destination page. + // Then clear the Btree layer MemPage.isInit flag. Both this module + // and the pager code use this trick (clearing the first byte + // of the page 'extra' space to invalidate the Btree layers + // cached parse of the page). MemPage.isInit is marked + // "MUST BE FIRST" for this purpose. + libc.Xmemcpy(tls, zOut, zIn, uint64(nCopy)) + *(*U8)(unsafe.Pointer((Xsqlite3PagerGetExtra(tls, *(*uintptr)(unsafe.Pointer(bp /* pDestPg */)))))) = U8(0) + if (iOff == int64(0)) && (bUpdate == 0) { + Xsqlite3Put4byte(tls, (zOut + 28), Xsqlite3BtreeLastPage(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + } + } + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pDestPg */))) + } + + return rc +} + +// If pFile is currently larger than iSize bytes, then truncate it to +// exactly iSize bytes. If pFile is not larger than iSize bytes, then +// this function is a no-op. +// +// Return SQLITE_OK if everything is successful, or an SQLite error +// code if an error occurs. +func backupTruncateFile(tls *libc.TLS, pFile uintptr, iSize I64) int32 { /* sqlite3.c:76519:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var iCurrent I64 at bp, 8 + + var rc int32 = Xsqlite3OsFileSize(tls, pFile, bp /* &iCurrent */) + if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp /* iCurrent */)) > iSize) { + rc = Xsqlite3OsTruncate(tls, pFile, iSize) + } + return rc +} + +// Register this backup object with the associated source pager for +// callbacks when pages are changed or the cache invalidated. +func attachBackupObject(tls *libc.TLS, p uintptr) { /* sqlite3.c:76532:13: */ + var pp uintptr + + pp = Xsqlite3PagerBackupPtr(tls, Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + (*Sqlite3_backup)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = p + (*Sqlite3_backup)(unsafe.Pointer(p)).FisAttached = 1 +} + +// Copy nPage pages from the source b-tree to the destination. +func Xsqlite3_backup_step(tls *libc.TLS, p uintptr, nPage int32) int32 { /* sqlite3.c:76544:16: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var rc int32 + var destMode int32 // Destination journal mode + var pgszSrc int32 = 0 // Source page size + var pgszDest int32 = 0 // Destination page size + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpSrcDb)).Fmutex) + Xsqlite3BtreeEnter(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb)).Fmutex) + } + + rc = (*Sqlite3_backup)(unsafe.Pointer(p)).Frc + if !(isFatalError(tls, rc) != 0) { + var pSrcPager uintptr = Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) // Source pager + var pDestPager uintptr = Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest) // Dest pager + var ii int32 // Iterator variable + var nSrcPage int32 = -1 // Size of source db in pages + var bCloseTrans int32 = 0 // True if src db requires unlocking + + // If the source pager is currently in a write-transaction, return + // SQLITE_BUSY immediately. + if ((*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0) && (int32((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FpBt)).FinTransaction) == TRANS_WRITE) { + rc = SQLITE_BUSY + } else { + rc = SQLITE_OK + } + + // If there is no open read-transaction on the source database, open + // one now. If a transaction is opened here, then it will be closed + // before this function exits. + if (rc == SQLITE_OK) && (SQLITE_TXN_NONE == Xsqlite3BtreeTxnState(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)) { + rc = Xsqlite3BtreeBeginTrans(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc, 0, uintptr(0)) + bCloseTrans = 1 + } + + // If the destination database has not yet been locked (i.e. if this + // is the first call to backup_step() for the current backup operation), + // try to set its page size to the same as the source database. This + // is especially important on ZipVFS systems, as in that case it is + // not possible to create a database file that uses one page size by + // writing to it with another. + if (((*Sqlite3_backup)(unsafe.Pointer(p)).FbDestLocked == 0) && (rc == SQLITE_OK)) && (setDestPgsz(tls, p) == SQLITE_NOMEM) { + rc = SQLITE_NOMEM + } + + // Lock the destination database, if it is not locked already. + if ((SQLITE_OK == rc) && ((*Sqlite3_backup)(unsafe.Pointer(p)).FbDestLocked == 0)) && + (SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3BtreeBeginTrans(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest, 2, + (p+16 /* &.iDestSchema */))))) { + (*Sqlite3_backup)(unsafe.Pointer(p)).FbDestLocked = 1 + } + + // Do not allow backup if the destination database is in WAL mode + // and the page sizes are different between source and destination + pgszSrc = Xsqlite3BtreeGetPageSize(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) + pgszDest = Xsqlite3BtreeGetPageSize(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest) + destMode = Xsqlite3PagerGetJournalMode(tls, Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest)) + if ((SQLITE_OK == rc) && (destMode == PAGER_JOURNALMODE_WAL)) && (pgszSrc != pgszDest) { + rc = SQLITE_READONLY + } + + // Now that there is a read-lock on the source database, query the + // source pager for the number of pages in the database. + nSrcPage = int32(Xsqlite3BtreeLastPage(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + + for ii = 0; (((nPage < 0) || (ii < nPage)) && ((*Sqlite3_backup)(unsafe.Pointer(p)).FiNext <= Pgno(nSrcPage))) && !(rc != 0); ii++ { + var iSrcPg Pgno = (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext // Source page number + if iSrcPg != ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FpBt)).FpageSize)) + U32(1)) { + // var pSrcPg uintptr at bp, 8 + // Source page object + rc = Xsqlite3PagerGet(tls, pSrcPager, iSrcPg, bp /* &pSrcPg */, PAGER_GET_READONLY) + if rc == SQLITE_OK { + rc = backupOnePage(tls, p, iSrcPg, Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp /* pSrcPg */))), 0) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp /* pSrcPg */))) + } + } + (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext++ + } + if rc == SQLITE_OK { + (*Sqlite3_backup)(unsafe.Pointer(p)).FnPagecount = Pgno(nSrcPage) + (*Sqlite3_backup)(unsafe.Pointer(p)).FnRemaining = ((Pgno(nSrcPage + 1)) - (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext) + if (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext > Pgno(nSrcPage) { + rc = SQLITE_DONE + } else if !((*Sqlite3_backup)(unsafe.Pointer(p)).FisAttached != 0) { + attachBackupObject(tls, p) + } + } + + // Update the schema version field in the destination database. This + // is to make sure that the schema-version really does change in + // the case where the source and destination databases have the + // same schema version. + if rc == SQLITE_DONE { + if nSrcPage == 0 { + rc = Xsqlite3BtreeNewDb(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest) + nSrcPage = 1 + } + if (rc == SQLITE_OK) || (rc == SQLITE_DONE) { + rc = Xsqlite3BtreeUpdateMeta(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest, 1, ((*Sqlite3_backup)(unsafe.Pointer(p)).FiDestSchema + U32(1))) + } + if rc == SQLITE_OK { + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + Xsqlite3ResetAllSchemasOfConnection(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb) + } + if destMode == PAGER_JOURNALMODE_WAL { + rc = Xsqlite3BtreeSetVersion(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest, 2) + } + } + if rc == SQLITE_OK { + var nDestTruncate int32 + // Set nDestTruncate to the final number of pages in the destination + // database. The complication here is that the destination page + // size may be different to the source page size. + // + // If the source page size is smaller than the destination page size, + // round up. In this case the call to sqlite3OsTruncate() below will + // fix the size of the file. However it is important to call + // sqlite3PagerTruncateImage() here so that any pages in the + // destination file that lie beyond the nDestTruncate page mark are + // journalled by PagerCommitPhaseOne() before they are destroyed + // by the file truncation. + + if pgszSrc < pgszDest { + var ratio int32 = (pgszDest / pgszSrc) + nDestTruncate = (((nSrcPage + ratio) - 1) / ratio) + if nDestTruncate == (int32(((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDest)).FpBt)).FpageSize)) + U32(1)))) { + nDestTruncate-- + } + } else { + nDestTruncate = (nSrcPage * (pgszSrc / pgszDest)) + } + + if pgszSrc < pgszDest { + // If the source page-size is smaller than the destination page-size, + // two extra things may need to happen: + // + // * The destination may need to be truncated, and + // + // * Data stored on the pages immediately following the + // pending-byte page in the source database may need to be + // copied into the destination database. + var iSize I64 = (I64(pgszSrc) * I64(nSrcPage)) + var pFile uintptr = Xsqlite3PagerFile(tls, pDestPager) + var iPg Pgno + // var nDstPage int32 at bp+8, 4 + + var iOff I64 + var iEnd I64 + + // This block ensures that all data required to recreate the original + // database has been stored in the journal for pDestPager and the + // journal synced to disk. So at this point we may safely modify + // the database file in any way, knowing that if a power failure + // occurs, the original database will be reconstructed from the + // journal file. + Xsqlite3PagerPagecount(tls, pDestPager, bp+8 /* &nDstPage */) + for iPg = Pgno(nDestTruncate); (rc == SQLITE_OK) && (iPg <= Pgno(*(*int32)(unsafe.Pointer(bp + 8 /* nDstPage */)))); iPg++ { + if iPg != ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer((*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDest)).FpBt)).FpageSize)) + U32(1)) { + // var pPg uintptr at bp+16, 8 + + rc = Xsqlite3PagerGet(tls, pDestPager, iPg, bp+16 /* &pPg */, 0) + if rc == SQLITE_OK { + rc = Xsqlite3PagerWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */))) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pPg */))) + } + } + } + if rc == SQLITE_OK { + rc = Xsqlite3PagerCommitPhaseOne(tls, pDestPager, uintptr(0), 1) + } + + // Write the extra pages and truncate the database file as required + iEnd = func() int64 { + if (I64(Xsqlite3PendingByte + pgszDest)) < (iSize) { + return (int64(Xsqlite3PendingByte + pgszDest)) + } + return iSize + }() + for iOff = (I64(Xsqlite3PendingByte + pgszSrc)); (rc == SQLITE_OK) && (iOff < iEnd); iOff = iOff + (I64(pgszSrc)) { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pSrcPg */)) = uintptr(0) + var iSrcPg Pgno = (Pgno((iOff / I64(pgszSrc)) + int64(1))) + rc = Xsqlite3PagerGet(tls, pSrcPager, iSrcPg, bp+24 /* &pSrcPg */, 0) + if rc == SQLITE_OK { + var zData uintptr = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pSrcPg */))) + rc = Xsqlite3OsWrite(tls, pFile, zData, pgszSrc, iOff) + } + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pSrcPg */))) + } + if rc == SQLITE_OK { + rc = backupTruncateFile(tls, pFile, iSize) + } + + // Sync the database file to disk. + if rc == SQLITE_OK { + rc = Xsqlite3PagerSync(tls, pDestPager, uintptr(0)) + } + } else { + Xsqlite3PagerTruncateImage(tls, pDestPager, uint32(nDestTruncate)) + rc = Xsqlite3PagerCommitPhaseOne(tls, pDestPager, uintptr(0), 0) + } + + // Finish committing the transaction to the destination database. + if (SQLITE_OK == rc) && + (SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3BtreeCommitPhaseTwo(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest, 0)))) { + rc = SQLITE_DONE + } + } + } + + // If bCloseTrans is true, then this function opened a read transaction + // on the source database. Close the read transaction here. There is + // no need to check the return values of the btree methods here, as + // "committing" a read-only transaction cannot fail. + if bCloseTrans != 0 { + + Xsqlite3BtreeCommitPhaseOne(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc, uintptr(0)) + Xsqlite3BtreeCommitPhaseTwo(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc, 0) + + } + + if rc == (SQLITE_IOERR | (int32(12) << 8)) { + rc = SQLITE_NOMEM + } + (*Sqlite3_backup)(unsafe.Pointer(p)).Frc = rc + } + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb)).Fmutex) + } + Xsqlite3BtreeLeave(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpSrcDb)).Fmutex) + return rc +} + +// Release all resources associated with an sqlite3_backup* handle. +func Xsqlite3_backup_finish(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76798:16: */ + var pp uintptr // Ptr to head of pagers backup list + var pSrcDb uintptr // Source database connection + var rc int32 // Value to return + + // Enter the mutexes + if p == uintptr(0) { + return SQLITE_OK + } + pSrcDb = (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrcDb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(pSrcDb)).Fmutex) + Xsqlite3BtreeEnter(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb)).Fmutex) + } + + // Detach this backup from the source pager. + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + (*Btree)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)).FnBackup-- + } + if (*Sqlite3_backup)(unsafe.Pointer(p)).FisAttached != 0 { + pp = Xsqlite3PagerBackupPtr(tls, Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc)) + + for *(*uintptr)(unsafe.Pointer(pp)) != p { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 64 /* &.pNext */) + + } + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_backup)(unsafe.Pointer(p)).FpNext + } + + // If a transaction is still open on the Btree, roll it back. + Xsqlite3BtreeRollback(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDest, SQLITE_OK, 0) + + // Set the error code of the destination database handle. + if (*Sqlite3_backup)(unsafe.Pointer(p)).Frc == SQLITE_DONE { + rc = SQLITE_OK + } else { + rc = (*Sqlite3_backup)(unsafe.Pointer(p)).Frc + } + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + Xsqlite3Error(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb, rc) + + // Exit the mutexes and free the backup context structure. + Xsqlite3LeaveMutexAndCloseZombie(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb) + } + Xsqlite3BtreeLeave(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).FpSrc) + if (*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb != 0 { + // EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a + // call to sqlite3_backup_init() and is destroyed by a call to + // sqlite3_backup_finish(). + Xsqlite3_free(tls, p) + } + Xsqlite3LeaveMutexAndCloseZombie(tls, pSrcDb) + return rc +} + +// Return the number of pages still to be backed up as of the most recent +// call to sqlite3_backup_step(). +func Xsqlite3_backup_remaining(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76852:16: */ + return int32((*Sqlite3_backup)(unsafe.Pointer(p)).FnRemaining) +} + +// Return the total number of pages in the source database as of the most +// recent call to sqlite3_backup_step(). +func Xsqlite3_backup_pagecount(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76866:16: */ + return int32((*Sqlite3_backup)(unsafe.Pointer(p)).FnPagecount) +} + +// This function is called after the contents of page iPage of the +// source database have been modified. If page iPage has already been +// copied into the destination database, then the data written to the +// destination is now invalidated. The destination copy of iPage needs +// to be updated with the new data before the backup operation is +// complete. +// +// It is assumed that the mutex associated with the BtShared object +// corresponding to the source database is held when this function is +// called. +func backupUpdate(tls *libc.TLS, p uintptr, iPage Pgno, aData uintptr) { /* sqlite3.c:76888:29: */ + + for ok := true; ok; ok = ((libc.AssignUintptr(&p, (*Sqlite3_backup)(unsafe.Pointer(p)).FpNext)) != uintptr(0)) { + + if !(isFatalError(tls, (*Sqlite3_backup)(unsafe.Pointer(p)).Frc) != 0) && (iPage < (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext) { + // The backup process p has already copied page iPage. But now it + // has been modified by a transaction on the source pager. Copy + // the new data into the backup. + var rc int32 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb)).Fmutex) + rc = backupOnePage(tls, p, iPage, aData, 1) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Sqlite3_backup)(unsafe.Pointer(p)).FpDestDb)).Fmutex) + + if rc != SQLITE_OK { + (*Sqlite3_backup)(unsafe.Pointer(p)).Frc = rc + } + } + } +} + +func Xsqlite3BackupUpdate(tls *libc.TLS, pBackup uintptr, iPage Pgno, aData uintptr) { /* sqlite3.c:76913:21: */ + if pBackup != 0 { + backupUpdate(tls, pBackup, iPage, aData) + } +} + +// Restart the backup process. This is called when the pager layer +// detects that the database has been modified by an external database +// connection. In this case there is no way of knowing which of the +// pages that have been copied into the destination database are still +// valid and which are not, so the entire process needs to be restarted. +// +// It is assumed that the mutex associated with the BtShared object +// corresponding to the source database is held when this function is +// called. +func Xsqlite3BackupRestart(tls *libc.TLS, pBackup uintptr) { /* sqlite3.c:76928:21: */ + var p uintptr // Iterator variable + for p = pBackup; p != 0; p = (*Sqlite3_backup)(unsafe.Pointer(p)).FpNext { + + (*Sqlite3_backup)(unsafe.Pointer(p)).FiNext = Pgno(1) + } +} + +// Copy the complete content of pBtFrom into pBtTo. A transaction +// must be active for both files. +// +// The size of file pTo may be reduced by this operation. If anything +// goes wrong, the transaction on pTo is rolled back. If successful, the +// transaction is committed before returning. +func Xsqlite3BtreeCopyFile(tls *libc.TLS, pTo uintptr, pFrom uintptr) int32 { /* sqlite3.c:76945:20: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var rc int32 + var pFd uintptr // File descriptor for database pTo + // var b Sqlite3_backup at bp+8, 72 + + // var nByte I64 at bp, 8 + + Xsqlite3BtreeEnter(tls, pTo) + Xsqlite3BtreeEnter(tls, pFrom) + + pFd = Xsqlite3PagerFile(tls, Xsqlite3BtreePager(tls, pTo)) + if !((*Sqlite3_file)(unsafe.Pointer(pFd)).FpMethods != 0) { + goto __1 + } + *(*I64)(unsafe.Pointer(bp /* nByte */)) = (I64(Xsqlite3BtreeGetPageSize(tls, pFrom)) * I64(Xsqlite3BtreeLastPage(tls, pFrom))) + rc = Xsqlite3OsFileControl(tls, pFd, SQLITE_FCNTL_OVERWRITE, bp /* &nByte */) + if !(rc == SQLITE_NOTFOUND) { + goto __2 + } + rc = SQLITE_OK +__2: + ; + if !(rc != 0) { + goto __3 + } + goto copy_finished +__3: + ; +__1: + ; + + // Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set + // to 0. This is used by the implementations of sqlite3_backup_step() + // and sqlite3_backup_finish() to detect that they are being called + // from this function, not directly by the user. + libc.Xmemset(tls, bp+8 /* &b */, 0, uint64(unsafe.Sizeof(Sqlite3_backup{}))) + (*Sqlite3_backup)(unsafe.Pointer(bp + 8 /* &b */)).FpSrcDb = (*Btree)(unsafe.Pointer(pFrom)).Fdb + (*Sqlite3_backup)(unsafe.Pointer(bp + 8 /* &b */)).FpSrc = pFrom + (*Sqlite3_backup)(unsafe.Pointer(bp + 8 /* &b */)).FpDest = pTo + (*Sqlite3_backup)(unsafe.Pointer(bp + 8 /* &b */)).FiNext = Pgno(1) + + // 0x7FFFFFFF is the hard limit for the number of pages in a database + // file. By passing this as the number of pages to copy to + // sqlite3_backup_step(), we can guarantee that the copy finishes + // within a single call (unless an error occurs). The assert() statement + // checks this assumption - (p->rc) should be set to either SQLITE_DONE + // or an error code. + Xsqlite3_backup_step(tls, bp+8 /* &b */, 0x7FFFFFFF) + + rc = Xsqlite3_backup_finish(tls, bp+8 /* &b */) + if !(rc == SQLITE_OK) { + goto __4 + } + *(*U16)(unsafe.Pointer((*Btree)(unsafe.Pointer(pTo)).FpBt + 40 /* &.btsFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(BTS_PAGESIZE_FIXED))) + goto __5 +__4: + Xsqlite3PagerClearCache(tls, Xsqlite3BtreePager(tls, (*Sqlite3_backup)(unsafe.Pointer(bp+8 /* &b */)).FpDest)) +__5: + ; + +copy_finished: + Xsqlite3BtreeLeave(tls, pFrom) + Xsqlite3BtreeLeave(tls, pTo) + return rc +} + +//************* End of backup.c ********************************************* +//************* Begin file vdbemem.c **************************************** +// 2004 May 26 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code use to manipulate "Mem" structure. A "Mem" +// stores a single value in the VDBE. Mem is an opaque structure visible +// only within the VDBE. Interface routines refer to a Mem using the +// name sqlite_value +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// True if X is a power of two. 0 is considered a power of two here. +// In other words, return true if X has at most one bit set. + +// Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal +// into a buffer. +func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sqlite3.c:77103:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var acc StrAccum at bp+16, 32 + + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Int) != 0 { + // Work-around for GCC bug + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270 + // var x I64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &x */, (p /* &.u */), (uint64((int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Int) * 2))) + Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) + } else { + Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4035, /* "%!.15g" */ + libc.VaList(bp, func() float64 { + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { + return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) + } + return *(*float64)(unsafe.Pointer(p /* &.u */)) + }())) + + *(*int8)(unsafe.Pointer(zBuf + uintptr((*StrAccum)(unsafe.Pointer(bp+16 /* &acc */)).FnChar))) = int8(0) // Fast version of sqlite3StrAccumFinish(&acc) + } +} + +// If pMem is an object with a valid string representation, this routine +// ensures the internal encoding for the string representation is +// 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE. +// +// If pMem is not a string object, or the encoding of the string +// representation is already stored using the requested encoding, then this +// routine is a no-op. +// +// SQLITE_OK is returned if the conversion is successful (or not required). +// SQLITE_NOMEM may be returned if a malloc() fails during conversion +// between formats. +func Xsqlite3VdbeChangeEncoding(tls *libc.TLS, pMem uintptr, desiredEnc int32) int32 { /* sqlite3.c:77196:20: */ + var rc int32 + + if !((int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0) || (int32((*Mem)(unsafe.Pointer(pMem)).Fenc) == desiredEnc) { + return SQLITE_OK + } + + // MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned, + // then the encoding of the value may not have changed. + rc = Xsqlite3VdbeMemTranslate(tls, pMem, U8(desiredEnc)) + + return rc +} + +// Make sure pMem->z points to a writable allocation of at least n bytes. +// +// If the bPreserve argument is true, then copy of the content of +// pMem->z into the new allocation. pMem must be either a string or +// blob if bPreserve is true. If bPreserve is false, any prior content +// in pMem->z is discarded. +func Xsqlite3VdbeMemGrow(tls *libc.TLS, pMem uintptr, n int32, bPreserve int32) int32 { /* sqlite3.c:77230:36: */ + + // If the bPreserve flag is set to true, then the memory cell must already + // contain a valid string or blob value. + + if (((*Mem)(unsafe.Pointer(pMem)).FszMalloc > 0) && (bPreserve != 0)) && ((*Mem)(unsafe.Pointer(pMem)).Fz == (*Mem)(unsafe.Pointer(pMem)).FzMalloc) { + if (*Mem)(unsafe.Pointer(pMem)).Fdb != 0 { + (*Mem)(unsafe.Pointer(pMem)).Fz = libc.AssignPtrUintptr(pMem+24 /* &.zMalloc */, Xsqlite3DbReallocOrFree(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).Fz, uint64(n))) + } else { + (*Mem)(unsafe.Pointer(pMem)).FzMalloc = Xsqlite3Realloc(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, uint64(n)) + if (*Mem)(unsafe.Pointer(pMem)).FzMalloc == uintptr(0) { + Xsqlite3_free(tls, (*Mem)(unsafe.Pointer(pMem)).Fz) + } + (*Mem)(unsafe.Pointer(pMem)).Fz = (*Mem)(unsafe.Pointer(pMem)).FzMalloc + } + bPreserve = 0 + } else { + if (*Mem)(unsafe.Pointer(pMem)).FszMalloc > 0 { + Xsqlite3DbFreeNN(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).FzMalloc) + } + (*Mem)(unsafe.Pointer(pMem)).FzMalloc = Xsqlite3DbMallocRaw(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, uint64(n)) + } + if (*Mem)(unsafe.Pointer(pMem)).FzMalloc == uintptr(0) { + Xsqlite3VdbeMemSetNull(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fz = uintptr(0) + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = 0 + return SQLITE_NOMEM + } else { + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = Xsqlite3DbMallocSize(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).FzMalloc) + } + + if (bPreserve != 0) && ((*Mem)(unsafe.Pointer(pMem)).Fz != 0) { + + libc.Xmemcpy(tls, (*Mem)(unsafe.Pointer(pMem)).FzMalloc, (*Mem)(unsafe.Pointer(pMem)).Fz, uint64((*Mem)(unsafe.Pointer(pMem)).Fn)) + } + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Dyn) != 0 { + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pMem + 48 /* &.xDel */))))(tls, (*Mem)(unsafe.Pointer(pMem)).Fz) + } + + (*Mem)(unsafe.Pointer(pMem)).Fz = (*Mem)(unsafe.Pointer(pMem)).FzMalloc + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((MEM_Dyn | MEM_Ephem) | MEM_Static)))) + return SQLITE_OK +} + +// Change the pMem->zMalloc allocation to be at least szNew bytes. +// If pMem->zMalloc already meets or exceeds the requested size, this +// routine is a no-op. +// +// Any prior string or blob content in the pMem object may be discarded. +// The pMem->xDel destructor is called, if it exists. Though MEM_Str +// and MEM_Blob values may be discarded, MEM_Int, MEM_Real, MEM_IntReal, +// and MEM_Null values are preserved. +// +// Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM) +// if unable to complete the resizing. +func Xsqlite3VdbeMemClearAndResize(tls *libc.TLS, pMem uintptr, szNew int32) int32 { /* sqlite3.c:77293:20: */ + + if (*Mem)(unsafe.Pointer(pMem)).FszMalloc < szNew { + return Xsqlite3VdbeMemGrow(tls, pMem, szNew, 0) + } + + (*Mem)(unsafe.Pointer(pMem)).Fz = (*Mem)(unsafe.Pointer(pMem)).FzMalloc + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= U16((((MEM_Null | MEM_Int) | MEM_Real) | MEM_IntReal)) + return SQLITE_OK +} + +// It is already known that pMem contains an unterminated string. +// Add the zero terminator. +// +// Three bytes of zero are added. In this way, there is guaranteed +// to be a double-zero byte at an even byte boundary in order to +// terminate a UTF16 string, even if the initial size of the buffer +// is an odd number of bytes. +func vdbeMemAddTerminator(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77314:28: */ + if Xsqlite3VdbeMemGrow(tls, pMem, ((*Mem)(unsafe.Pointer(pMem)).Fn+3), 1) != 0 { + return SQLITE_NOMEM + } + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr((*Mem)(unsafe.Pointer(pMem)).Fn))) = int8(0) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr(((*Mem)(unsafe.Pointer(pMem)).Fn + 1)))) = int8(0) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr(((*Mem)(unsafe.Pointer(pMem)).Fn + 2)))) = int8(0) + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) |= U16((MEM_Term)) + return SQLITE_OK +} + +// Change pMem so that its MEM_Str or MEM_Blob value is stored in +// MEM.zMalloc, where it can be safely written. +// +// Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails. +func Xsqlite3VdbeMemMakeWriteable(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77331:20: */ + + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Str | MEM_Blob)) != 0 { + if func() int32 { + if (int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pMem) + } + return 0 + }() != 0 { + return SQLITE_NOMEM + } + if ((*Mem)(unsafe.Pointer(pMem)).FszMalloc == 0) || ((*Mem)(unsafe.Pointer(pMem)).Fz != (*Mem)(unsafe.Pointer(pMem)).FzMalloc) { + var rc int32 = vdbeMemAddTerminator(tls, pMem) + if rc != 0 { + return rc + } + } + } + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Ephem))) + + return SQLITE_OK +} + +// If the given Mem* has a zero-filled tail, turn it into an ordinary +// blob stored in dynamically allocated space. +func Xsqlite3VdbeMemExpandBlob(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77354:20: */ + var nByte int32 + + // Set nByte to the number of bytes required to store the expanded blob. + nByte = ((*Mem)(unsafe.Pointer(pMem)).Fn + *(*int32)(unsafe.Pointer(pMem /* &.u */))) + if nByte <= 0 { + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Blob) == 0 { + return SQLITE_OK + } + nByte = 1 + } + if Xsqlite3VdbeMemGrow(tls, pMem, nByte, 1) != 0 { + return SQLITE_NOMEM + } + + libc.Xmemset(tls, ((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr((*Mem)(unsafe.Pointer(pMem)).Fn)), 0, uint64(*(*int32)(unsafe.Pointer(pMem /* &.u */)))) + *(*int32)(unsafe.Pointer(pMem + 12 /* &.n */)) += (*(*int32)(unsafe.Pointer(pMem /* &.u */))) + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32((MEM_Zero | MEM_Term)))) + return SQLITE_OK +} + +// Make sure the given Mem is \u0000 terminated. +func Xsqlite3VdbeMemNulTerminate(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77382:20: */ + + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Term | MEM_Str)) != MEM_Str { + return SQLITE_OK // Nothing to do + } else { + return vdbeMemAddTerminator(tls, pMem) + } + return int32(0) +} + +// Add MEM_Str to the set of representations for the given Mem. This +// routine is only called if pMem is a number of some kind, not a NULL +// or a BLOB. +// +// Existing representations MEM_Int, MEM_Real, or MEM_IntReal are invalidated +// if bForce is true but are retained if bForce is false. +// +// A MEM_Null value will never be passed to this function. This function is +// used for converting values to text for returning to the user (i.e. via +// sqlite3_value_text()), or for ensuring that values to be used as btree +// keys are strings. In the former case a NULL pointer is returned the +// user and the latter is an internal programming error. +func Xsqlite3VdbeMemStringify(tls *libc.TLS, pMem uintptr, enc U8, bForce U8) int32 { /* sqlite3.c:77407:20: */ + var nByte int32 = 32 + + if Xsqlite3VdbeMemClearAndResize(tls, pMem, nByte) != 0 { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(0) + return SQLITE_NOMEM + } + + vdbeMemRenderNum(tls, nByte, (*Mem)(unsafe.Pointer(pMem)).Fz, pMem) + + (*Mem)(unsafe.Pointer(pMem)).Fn = (int32(libc.Xstrlen(tls, (*Mem)(unsafe.Pointer(pMem)).Fz) & uint64(0x3fffffff))) + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) |= U16((MEM_Str | MEM_Term)) + if bForce != 0 { + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((MEM_Int | MEM_Real) | MEM_IntReal)))) + } + Xsqlite3VdbeChangeEncoding(tls, pMem, int32(enc)) + return SQLITE_OK +} + +// Memory cell pMem contains the context of an aggregate function. +// This routine calls the finalize method for that function. The +// result of the aggregate is stored back into pMem. +// +// Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK +// otherwise. +func Xsqlite3VdbeMemFinalize(tls *libc.TLS, pMem uintptr, pFunc uintptr) int32 { /* sqlite3.c:77441:20: */ + bp := tls.Alloc(112) + defer tls.Free(112) + + // var ctx Sqlite3_context at bp, 56 + + // var t Mem at bp+56, 56 + + libc.Xmemset(tls, bp /* &ctx */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) + libc.Xmemset(tls, bp+56 /* &t */, 0, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(bp + 56 /* &t */)).Fflags = U16(MEM_Null) + (*Mem)(unsafe.Pointer(bp + 56 /* &t */)).Fdb = (*Mem)(unsafe.Pointer(pMem)).Fdb + (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FpOut = bp + 56 /* &t */ + (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FpMem = pMem + (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FpFunc = pFunc + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pFunc + 32 /* &.xFinalize */))))(tls, bp /* &ctx */) // IMP: R-24505-23230 + + if (*Mem)(unsafe.Pointer(pMem)).FszMalloc > 0 { + Xsqlite3DbFreeNN(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).FzMalloc) + } + libc.Xmemcpy(tls, pMem, bp+56 /* &t */, uint64(unsafe.Sizeof(Mem{}))) + return (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FisError +} + +// Memory cell pAccum contains the context of an aggregate function. +// This routine calls the xValue method for that function and stores +// the results in memory cell pMem. +// +// SQLITE_ERROR is returned if xValue() reports an error. SQLITE_OK +// otherwise. +func Xsqlite3VdbeMemAggValue(tls *libc.TLS, pAccum uintptr, pOut uintptr, pFunc uintptr) int32 { /* sqlite3.c:77471:20: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var ctx Sqlite3_context at bp, 56 + + libc.Xmemset(tls, bp /* &ctx */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) + Xsqlite3VdbeMemSetNull(tls, pOut) + (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FpOut = pOut + (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FpMem = pAccum + (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FpFunc = pFunc + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pFunc + 40 /* &.xValue */))))(tls, bp /* &ctx */) + return (*Sqlite3_context)(unsafe.Pointer(bp /* &ctx */)).FisError +} + +// If the memory cell contains a value that must be freed by +// invoking the external callback in Mem.xDel, then this routine +// will free that value. It also sets Mem.flags to MEM_Null. +// +// This is a helper routine for sqlite3VdbeMemSetNull() and +// for sqlite3VdbeMemRelease(). Use those other routines as the +// entry point for releasing Mem resources. +func vdbeMemClearExternAndSetNull(tls *libc.TLS, p uintptr) { /* sqlite3.c:77496:29: */ + + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Agg) != 0 { + Xsqlite3VdbeMemFinalize(tls, p, *(*uintptr)(unsafe.Pointer(p /* &.u */))) + + } + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Dyn) != 0 { + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 48 /* &.xDel */))))(tls, (*Mem)(unsafe.Pointer(p)).Fz) + } + (*Mem)(unsafe.Pointer(p)).Fflags = U16(MEM_Null) +} + +// Release memory held by the Mem p, both external memory cleared +// by p->xDel and memory in p->zMalloc. +// +// This is a helper routine invoked by sqlite3VdbeMemRelease() in +// the unusual case where there really is memory in p that needs +// to be freed. +func vdbeMemClear(tls *libc.TLS, p uintptr) { /* sqlite3.c:77519:29: */ + if (int32((*Mem)(unsafe.Pointer((p))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { + vdbeMemClearExternAndSetNull(tls, p) + } + if (*Mem)(unsafe.Pointer(p)).FszMalloc != 0 { + Xsqlite3DbFreeNN(tls, (*Mem)(unsafe.Pointer(p)).Fdb, (*Mem)(unsafe.Pointer(p)).FzMalloc) + (*Mem)(unsafe.Pointer(p)).FszMalloc = 0 + } + (*Mem)(unsafe.Pointer(p)).Fz = uintptr(0) +} + +// Release any memory resources held by the Mem. Both the memory that is +// free by Mem.xDel and the Mem.zMalloc allocation are freed. +// +// Use this routine prior to clean up prior to abandoning a Mem, or to +// reset a Mem back to its minimum memory utilization. +// +// Use sqlite3VdbeMemSetNull() to release just the Mem.xDel space +// prior to inserting new content into the Mem. +func Xsqlite3VdbeMemRelease(tls *libc.TLS, p uintptr) { /* sqlite3.c:77540:21: */ + + if ((int32((*Mem)(unsafe.Pointer((p))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0) || ((*Mem)(unsafe.Pointer(p)).FszMalloc != 0) { + vdbeMemClear(tls, p) + } +} + +// Convert a 64-bit IEEE double into a 64-bit signed integer. +// If the double is out of range of a 64-bit signed integer then +// return the closest available 64-bit signed integer. +func doubleToInt64(tls *libc.TLS, r float64) I64 { /* sqlite3.c:77552:28: */ + + if r <= float64(minInt) { + return minInt + } else if r >= float64(maxInt) { + return maxInt + } else { + return I64(r) + } + return I64(0) +} + +var maxInt I64 = (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) /* sqlite3.c:77564:20 */ +var minInt I64 = ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) /* sqlite3.c:77565:20 */ + +// Return some kind of integer value which is the best we can do +// at representing the value that *pMem describes as an integer. +// If pMem is an integer, then the value is exact. If pMem is +// a floating-point then the value returned is the integer part. +// If pMem is a string or blob, then we make an attempt to convert +// it into an integer and return that. If pMem represents an +// an SQL-NULL value, return 0. +// +// If pMem represents a string value, its encoding might be changed. +func memIntValue(tls *libc.TLS, pMem uintptr) I64 { /* sqlite3.c:77588:28: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*I64)(unsafe.Pointer(bp /* value */)) = int64(0) + Xsqlite3Atoi64(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, bp /* &value */, (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) + return *(*I64)(unsafe.Pointer(bp /* value */)) +} + +func Xsqlite3VdbeIntValue(tls *libc.TLS, pMem uintptr) I64 { /* sqlite3.c:77593:20: */ + var flags int32 + + flags = int32((*Mem)(unsafe.Pointer(pMem)).Fflags) + if (flags & (MEM_Int | MEM_IntReal)) != 0 { + + return *(*I64)(unsafe.Pointer(pMem /* &.u */)) + } else if (flags & MEM_Real) != 0 { + return doubleToInt64(tls, *(*float64)(unsafe.Pointer(pMem /* &.u */))) + } else if ((flags & (MEM_Str | MEM_Blob)) != 0) && ((*Mem)(unsafe.Pointer(pMem)).Fz != uintptr(0)) { + return memIntValue(tls, pMem) + } else { + return int64(0) + } + return I64(0) +} + +// Return the best representation of pMem that we can get into a +// double. If pMem is already a double or an integer, return its +// value. If it is a string or blob, try to convert it to a double. +// If it is a NULL, return 0.0. +func memRealValue(tls *libc.TLS, pMem uintptr) float64 { /* sqlite3.c:77616:31: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // (double)0 In case of SQLITE_OMIT_FLOATING_POINT... + *(*float64)(unsafe.Pointer(bp /* val */)) = float64(0) + Xsqlite3AtoF(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, bp /* &val */, (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) + return *(*float64)(unsafe.Pointer(bp /* val */)) +} + +func Xsqlite3VdbeRealValue(tls *libc.TLS, pMem uintptr) float64 { /* sqlite3.c:77622:23: */ + + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { + return *(*float64)(unsafe.Pointer(pMem /* &.u */)) + } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { + + return float64(*(*I64)(unsafe.Pointer(pMem /* &.u */))) + } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Str | MEM_Blob)) != 0 { + return memRealValue(tls, pMem) + } else { + // (double)0 In case of SQLITE_OMIT_FLOATING_POINT... + return float64(0) + } + return float64(0) +} + +// Return 1 if pMem represents true, and return 0 if pMem represents false. +// Return the value ifNull if pMem is NULL. +func Xsqlite3VdbeBooleanValue(tls *libc.TLS, pMem uintptr, ifNull int32) int32 { /* sqlite3.c:77642:20: */ + + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { + return (libc.Bool32(*(*I64)(unsafe.Pointer(pMem /* &.u */)) != int64(0))) + } + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { + return ifNull + } + return (libc.Bool32(Xsqlite3VdbeRealValue(tls, pMem) != 0.0)) +} + +// The MEM structure is already a MEM_Real. Try to also make it a +// MEM_Int if we can. +func Xsqlite3VdbeIntegerAffinity(tls *libc.TLS, pMem uintptr) { /* sqlite3.c:77653:21: */ + var ix I64 + + ix = doubleToInt64(tls, *(*float64)(unsafe.Pointer(pMem /* &.u */))) + + // Only mark the value as an integer if + // + // (1) the round-trip conversion real->int->real is a no-op, and + // (2) The integer is neither the largest nor the smallest + // possible integer (ticket #3922) + // + // The second and third terms in the following conditional enforces + // the second condition under the assumption that addition overflow causes + // values to wrap around. + if ((*(*float64)(unsafe.Pointer(pMem /* &.u */)) == float64(ix)) && (ix > ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) && (ix < (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) { + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = ix + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) + } +} + +// Convert pMem to type integer. Invalidate any prior representations. +func Xsqlite3VdbeMemIntegerify(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77681:20: */ + + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = Xsqlite3VdbeIntValue(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) + return SQLITE_OK +} + +// Convert pMem so that it is of type MEM_Real. +// Invalidate any prior representations. +func Xsqlite3VdbeMemRealify(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77695:20: */ + + *(*float64)(unsafe.Pointer(pMem /* &.u */)) = Xsqlite3VdbeRealValue(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Real)) + return SQLITE_OK +} + +// Compare a floating point value to an integer. Return true if the two +// values are the same within the precision of the floating point value. +// +// This function assumes that i was obtained by assignment from r1. +// +// For some versions of GCC on 32-bit machines, if you do the more obvious +// comparison of "r1==(double)i" you sometimes get an answer of false even +// though the r1 and (double)i values are bit-for-bit the same. +func Xsqlite3RealSameAsInt(tls *libc.TLS, r1 float64, i Sqlite3_int64) int32 { /* sqlite3.c:77713:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + *(*float64)(unsafe.Pointer(bp)) = r1 + + *(*float64)(unsafe.Pointer(bp + 8 /* r2 */)) = float64(i) + return (libc.Bool32((*(*float64)(unsafe.Pointer(bp /* r1 */)) == 0.0) || + (((libc.Xmemcmp(tls, bp /* &r1 */, bp+8 /* &r2 */, uint64(unsafe.Sizeof(float64(0)))) == 0) && + (i >= -2251799813685248)) && (i < 2251799813685248)))) +} + +// Convert pMem so that it has type MEM_Real or MEM_Int. +// Invalidate any prior representations. +// +// Every effort is made to force the conversion, even if the input +// is a string that does not look completely like a number. Convert +// as much of the string as we can and ignore the rest. +func Xsqlite3VdbeMemNumerify(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77728:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (((MEM_Int | MEM_Real) | MEM_IntReal) | MEM_Null)) == 0 { + var rc int32 + // var ix Sqlite3_int64 at bp, 8 + + rc = Xsqlite3AtoF(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, (pMem /* &.u */ /* &.r */), (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) + if (((rc == 0) || (rc == 1)) && (Xsqlite3Atoi64(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, bp /* &ix */, (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) <= 1)) || + (Xsqlite3RealSameAsInt(tls, *(*float64)(unsafe.Pointer(pMem /* &.u */)), libc.AssignPtrInt64(bp /* ix */, I64(*(*float64)(unsafe.Pointer(pMem /* &.u */))))) != 0) { + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = *(*Sqlite3_int64)(unsafe.Pointer(bp /* ix */)) + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) + } else { + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Real)) + } + } + + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((MEM_Str | MEM_Blob) | MEM_Zero)))) + return SQLITE_OK +} + +// Cast the datatype of the value in pMem according to the affinity +// "aff". Casting is different from applying affinity in that a cast +// is forced. In other words, the value is converted into the desired +// affinity even if that results in loss of data. This routine is +// used (for example) to implement the SQL "cast()" operator. +func Xsqlite3VdbeMemCast(tls *libc.TLS, pMem uintptr, aff U8, encoding U8) int32 { /* sqlite3.c:77760:20: */ + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { + return SQLITE_OK + } + switch int32(aff) { + case SQLITE_AFF_BLOB: + { // Really a cast to BLOB + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Blob) == 0 { + Xsqlite3ValueApplyAffinity(tls, pMem, uint8(SQLITE_AFF_TEXT), encoding) + + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Blob)) + } + } else { + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32((MEM_TypeMask & libc.CplInt32(MEM_Blob))))) + } + break + + } + case SQLITE_AFF_NUMERIC: + { + Xsqlite3VdbeMemNumerify(tls, pMem) + break + + } + case SQLITE_AFF_INTEGER: + { + Xsqlite3VdbeMemIntegerify(tls, pMem) + break + + } + case SQLITE_AFF_REAL: + { + Xsqlite3VdbeMemRealify(tls, pMem) + break + + } + default: + { + + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) |= U16(((int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Blob) >> 3)) + Xsqlite3ValueApplyAffinity(tls, pMem, uint8(SQLITE_AFF_TEXT), encoding) + + *(*U16)(unsafe.Pointer(pMem + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((((MEM_Int | MEM_Real) | MEM_IntReal) | MEM_Blob) | MEM_Zero)))) + return Xsqlite3VdbeChangeEncoding(tls, pMem, int32(encoding)) + + } + } + return SQLITE_OK +} + +// Initialize bulk memory to be a consistent Mem object. +// +// The minimum amount of initialization feasible is performed. +func Xsqlite3VdbeMemInit(tls *libc.TLS, pMem uintptr, db uintptr, flags U16) { /* sqlite3.c:77803:21: */ + + (*Mem)(unsafe.Pointer(pMem)).Fflags = flags + (*Mem)(unsafe.Pointer(pMem)).Fdb = db + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = 0 +} + +// Delete any previous value and set the value stored in *pMem to NULL. +// +// This routine calls the Mem.xDel destructor to dispose of values that +// require the destructor. But it preserves the Mem.zMalloc memory allocation. +// To free all resources, use sqlite3VdbeMemRelease(), which both calls this +// routine to invoke the destructor and deallocates Mem.zMalloc. +// +// Use this routine to reset the Mem prior to insert a new value. +// +// Use sqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it. +func Xsqlite3VdbeMemSetNull(tls *libc.TLS, pMem uintptr) { /* sqlite3.c:77823:21: */ + if (int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { + vdbeMemClearExternAndSetNull(tls, pMem) + } else { + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Null) + } +} + +func Xsqlite3ValueSetNull(tls *libc.TLS, p uintptr) { /* sqlite3.c:77830:21: */ + Xsqlite3VdbeMemSetNull(tls, p) +} + +// Delete any previous value and set the value to be a BLOB of length +// n containing all zeros. +func Xsqlite3VdbeMemSetZeroBlob(tls *libc.TLS, pMem uintptr, n int32) { /* sqlite3.c:77838:21: */ + Xsqlite3VdbeMemRelease(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(MEM_Blob | MEM_Zero)) + (*Mem)(unsafe.Pointer(pMem)).Fn = 0 + if n < 0 { + n = 0 + } + *(*int32)(unsafe.Pointer(pMem /* &.u */)) = n + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) + (*Mem)(unsafe.Pointer(pMem)).Fz = uintptr(0) +} + +// The pMem is known to contain content that needs to be destroyed prior +// to a value change. So invoke the destructor, then set the value to +// a 64-bit integer. +func vdbeReleaseAndSetInt64(tls *libc.TLS, pMem uintptr, val I64) { /* sqlite3.c:77853:29: */ + Xsqlite3VdbeMemSetNull(tls, pMem) + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = val + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) +} + +// Delete any previous value and set the value stored in *pMem to val, +// manifest type INTEGER. +func Xsqlite3VdbeMemSetInt64(tls *libc.TLS, pMem uintptr, val I64) { /* sqlite3.c:77863:21: */ + if (int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { + vdbeReleaseAndSetInt64(tls, pMem, val) + } else { + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = val + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + } +} + +// A no-op destructor +func Xsqlite3NoopDestructor(tls *libc.TLS, p uintptr) { /* sqlite3.c:77873:21: */ + _ = p +} + +// Set the value stored in *pMem should already be a NULL. +// Also store a pointer to go with it. +func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType uintptr, xDestructor uintptr) { /* sqlite3.c:77879:21: */ + + *(*uintptr)(unsafe.Pointer(pMem /* &.u */)) = func() uintptr { + if zPType != 0 { + return zPType + } + return ts + 756 /* "" */ + }() + (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) + (*Mem)(unsafe.Pointer(pMem)).FeSubtype = U8('p') + (*Mem)(unsafe.Pointer(pMem)).FxDel = func() uintptr { + if xDestructor != 0 { + return xDestructor + } + return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3NoopDestructor})) + }() +} + +// Delete any previous value and set the value stored in *pMem to val, +// manifest type REAL. +func Xsqlite3VdbeMemSetDouble(tls *libc.TLS, pMem uintptr, val float64) { /* sqlite3.c:77898:21: */ + Xsqlite3VdbeMemSetNull(tls, pMem) + if !(Xsqlite3IsNaN(tls, val) != 0) { + *(*float64)(unsafe.Pointer(pMem /* &.u */)) = val + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Real) + } +} + +// Delete any previous value and set the value of pMem to be an +// empty boolean index. +// +// Return SQLITE_OK on success and SQLITE_NOMEM if a memory allocation +// error occurs. +func Xsqlite3VdbeMemSetRowSet(tls *libc.TLS, pMem uintptr) int32 { /* sqlite3.c:77925:20: */ + var db uintptr = (*Mem)(unsafe.Pointer(pMem)).Fdb + var p uintptr + + Xsqlite3VdbeMemRelease(tls, pMem) + p = Xsqlite3RowSetInit(tls, db) + if p == uintptr(0) { + return SQLITE_NOMEM + } + (*Mem)(unsafe.Pointer(pMem)).Fz = p + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(MEM_Blob | MEM_Dyn)) + (*Mem)(unsafe.Pointer(pMem)).FxDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3RowSetDelete})) + return SQLITE_OK +} + +// Return true if the Mem object contains a TEXT or BLOB that is +// too large - whose size exceeds SQLITE_MAX_LENGTH. +func Xsqlite3VdbeMemTooBig(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:77943:20: */ + + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & (MEM_Str | MEM_Blob)) != 0 { + var n int32 = (*Mem)(unsafe.Pointer(p)).Fn + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Zero) != 0 { + n = n + (*(*int32)(unsafe.Pointer(p /* &.u */))) + } + return (libc.Bool32(n > *(*int32)(unsafe.Pointer(((*Mem)(unsafe.Pointer(p)).Fdb + 128 /* &.aLimit */))))) + } + return 0 +} + +// Make an shallow copy of pFrom into pTo. Prior contents of +// pTo are freed. The pFrom->z field is not duplicated. If +// pFrom->z is used, then pTo->z points to the same thing as pFrom->z +// and flags gets srcType (either MEM_Ephem or MEM_Static). +func vdbeClrCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, eType int32) { /* sqlite3.c:77999:29: */ + vdbeMemClearExternAndSetNull(tls, pTo) + + Xsqlite3VdbeMemShallowCopy(tls, pTo, pFrom, eType) +} + +func Xsqlite3VdbeMemShallowCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr, srcType int32) { /* sqlite3.c:78004:21: */ + + if (int32((*Mem)(unsafe.Pointer((pTo))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { + vdbeClrCopy(tls, pTo, pFrom, srcType) + return + } + libc.Xmemcpy(tls, pTo, pFrom, uint64((uintptr(0) + 24 /* &.zMalloc */))) + if (int32((*Mem)(unsafe.Pointer(pFrom)).Fflags) & MEM_Static) == 0 { + *(*U16)(unsafe.Pointer(pTo + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((MEM_Dyn | MEM_Static) | MEM_Ephem)))) + + *(*U16)(unsafe.Pointer(pTo + 8 /* &.flags */)) |= U16((srcType)) + } +} + +// Make a full copy of pFrom into pTo. Prior contents of pTo are +// freed before the copy is made. +func Xsqlite3VdbeMemCopy(tls *libc.TLS, pTo uintptr, pFrom uintptr) int32 { /* sqlite3.c:78020:20: */ + var rc int32 = SQLITE_OK + + if (int32((*Mem)(unsafe.Pointer((pTo))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { + vdbeMemClearExternAndSetNull(tls, pTo) + } + libc.Xmemcpy(tls, pTo, pFrom, uint64((uintptr(0) + 24 /* &.zMalloc */))) + *(*U16)(unsafe.Pointer(pTo + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Dyn))) + if (int32((*Mem)(unsafe.Pointer(pTo)).Fflags) & (MEM_Str | MEM_Blob)) != 0 { + if 0 == (int32((*Mem)(unsafe.Pointer(pFrom)).Fflags) & MEM_Static) { + *(*U16)(unsafe.Pointer(pTo + 8 /* &.flags */)) |= U16((MEM_Ephem)) + rc = Xsqlite3VdbeMemMakeWriteable(tls, pTo) + } + } + + return rc +} + +// Transfer the contents of pFrom to pTo. Any existing value in pTo is +// freed. If pFrom contains ephemeral data, a copy is made. +// +// pFrom contains an SQL NULL when this routine returns. +func Xsqlite3VdbeMemMove(tls *libc.TLS, pTo uintptr, pFrom uintptr) { /* sqlite3.c:78043:21: */ + + Xsqlite3VdbeMemRelease(tls, pTo) + libc.Xmemcpy(tls, pTo, pFrom, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(pFrom)).Fflags = U16(MEM_Null) + (*Mem)(unsafe.Pointer(pFrom)).FszMalloc = 0 +} + +// Change the value of a Mem to be a string or a BLOB. +// +// The memory management strategy depends on the value of the xDel +// parameter. If the value passed is SQLITE_TRANSIENT, then the +// string is copied into a (possibly existing) buffer managed by the +// Mem structure. Otherwise, any existing buffer is freed and the +// pointer copied. +// +// If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH +// size limit) then no memory allocation occurs. If the string can be +// stored without allocating memory, then it is. If a memory allocation +// is required to store the string, then value of pMem is unchanged. In +// either case, SQLITE_TOOBIG is returned. +func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8, xDel uintptr) int32 { /* sqlite3.c:78069:20: */ + var nByte I64 = n // New value for pMem->n + var iLimit int32 // Maximum allowed string or blob size + var flags U16 = U16(0) // New value for pMem->flags + + // If z is a NULL pointer, set pMem to contain an SQL NULL. + if !(z != 0) { + Xsqlite3VdbeMemSetNull(tls, pMem) + return SQLITE_OK + } + + if (*Mem)(unsafe.Pointer(pMem)).Fdb != 0 { + iLimit = *(*int32)(unsafe.Pointer(((*Mem)(unsafe.Pointer(pMem)).Fdb + 128 /* &.aLimit */))) + } else { + iLimit = SQLITE_MAX_LENGTH + } + flags = func() uint16 { + if int32(enc) == 0 { + return uint16(MEM_Blob) + } + return uint16(MEM_Str) + }() + if nByte < int64(0) { + + if int32(enc) == SQLITE_UTF8 { + nByte = I64(libc.Xstrlen(tls, z)) + } else { + for nByte = int64(0); (nByte <= I64(iLimit)) && ((int32(*(*int8)(unsafe.Pointer(z + uintptr(nByte)))) | int32(*(*int8)(unsafe.Pointer(z + uintptr((nByte + int64(1))))))) != 0); nByte = nByte + (int64(2)) { + } + } + flags = U16(int32(flags) | (MEM_Term)) + } + + // The following block sets the new values of Mem.z and Mem.xDel. It + // also sets a flag in local variable "flags" to indicate the memory + // management (one of MEM_Dyn or MEM_Static). + if xDel == (libc.UintptrFromInt32(-1)) { + var nAlloc I64 = nByte + if (int32(flags) & MEM_Term) != 0 { + nAlloc = nAlloc + (func() int64 { + if int32(enc) == SQLITE_UTF8 { + return int64(1) + } + return int64(2) + }()) + } + if nByte > I64(iLimit) { + return Xsqlite3ErrorToParser(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, SQLITE_TOOBIG) + } + + if Xsqlite3VdbeMemClearAndResize(tls, pMem, func() int32 { + if (nAlloc) > (int64(32)) { + return int32(nAlloc) + } + return 32 + }()) != 0 { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, z, uint64(nAlloc)) + } else { + Xsqlite3VdbeMemRelease(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fz = z + if xDel == (*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) { + (*Mem)(unsafe.Pointer(pMem)).FzMalloc = (*Mem)(unsafe.Pointer(pMem)).Fz + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = Xsqlite3DbMallocSize(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).FzMalloc) + } else { + (*Mem)(unsafe.Pointer(pMem)).FxDel = xDel + flags = U16(int32(flags) | (func() int32 { + if xDel == (uintptr(0)) { + return MEM_Static + } + return MEM_Dyn + }())) + } + } + + (*Mem)(unsafe.Pointer(pMem)).Fn = (int32(nByte & int64(0x7fffffff))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = flags + if enc != 0 { + (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) + } else { + + (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc + } + + if (int32(enc) > SQLITE_UTF8) && (Xsqlite3VdbeMemHandleBom(tls, pMem) != 0) { + return SQLITE_NOMEM + } + + if nByte > I64(iLimit) { + return Xsqlite3ErrorToParser(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, SQLITE_TOOBIG) + } + + return SQLITE_OK +} + +// Move data out of a btree key or data field and into a Mem structure. +// The data is payload from the entry that pCur is currently pointing +// to. offset and amt determine what portion of the data or key to retrieve. +// The result is written into the pMem element. +// +// The pMem object must have been initialized. This routine will use +// pMem->zMalloc to hold the content from the btree, if possible. New +// pMem->zMalloc space will be allocated if necessary. The calling routine +// is responsible for making sure that the pMem object is eventually +// destroyed. +// +// If this routine fails for any reason (malloc returns NULL or unable +// to read from the disk) then the pMem is left in an inconsistent state. +func Xsqlite3VdbeMemFromBtree(tls *libc.TLS, pCur uintptr, offset U32, amt U32, pMem uintptr) int32 { /* sqlite3.c:78177:20: */ + var rc int32 + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Null) + if Xsqlite3BtreeMaxRecordSize(tls, pCur) < (Sqlite3_int64(offset + amt)) { + return Xsqlite3CorruptError(tls, 78186) + } + if SQLITE_OK == (libc.AssignInt32(&rc, Xsqlite3VdbeMemClearAndResize(tls, pMem, (int32(amt+U32(1)))))) { + rc = Xsqlite3BtreePayload(tls, pCur, offset, amt, (*Mem)(unsafe.Pointer(pMem)).Fz) + if rc == SQLITE_OK { + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr(amt))) = int8(0) // Overrun area used when reading malformed records + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Blob) + (*Mem)(unsafe.Pointer(pMem)).Fn = int32(amt) + } else { + Xsqlite3VdbeMemRelease(tls, pMem) + } + } + return rc +} + +func Xsqlite3VdbeMemFromBtreeZeroOffset(tls *libc.TLS, pCur uintptr, amt U32, pMem uintptr) int32 { /* sqlite3.c:78200:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*U32)(unsafe.Pointer(bp /* available */)) = U32(0) // Number of bytes available on the local btree page + var rc int32 = SQLITE_OK // Return code + + // Note: the calls to BtreeKeyFetch() and DataFetch() below assert() + // that both the BtShared and database handle mutexes are held. + + (*Mem)(unsafe.Pointer(pMem)).Fz = Xsqlite3BtreePayloadFetch(tls, pCur, bp /* &available */) + + if amt <= *(*U32)(unsafe.Pointer(bp /* available */)) { + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(MEM_Blob | MEM_Ephem)) + (*Mem)(unsafe.Pointer(pMem)).Fn = int32(amt) + } else { + rc = Xsqlite3VdbeMemFromBtree(tls, pCur, uint32(0), amt, pMem) + } + + return rc +} + +// The pVal argument is known to be a value other than NULL. +// Convert it into a string with encoding enc and return a pointer +// to a zero-terminated version of that string. +func valueToText(tls *libc.TLS, pVal uintptr, enc U8) uintptr { /* sqlite3.c:78232:35: */ + + if (int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fflags) & (MEM_Blob | MEM_Str)) != 0 { + if func() int32 { + if (int32((*Sqlite3_value)(unsafe.Pointer((pVal))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pVal) + } + return 0 + }() != 0 { + return uintptr(0) + } + *(*U16)(unsafe.Pointer(pVal + 8 /* &.flags */)) |= U16((MEM_Str)) + if int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fenc) != (int32(enc) & libc.CplInt32(SQLITE_UTF16_ALIGNED)) { + Xsqlite3VdbeChangeEncoding(tls, pVal, (int32(enc) & libc.CplInt32(SQLITE_UTF16_ALIGNED))) + } + if ((int32(enc) & SQLITE_UTF16_ALIGNED) != 0) && (1 == (1 & (int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz)))) { + + if Xsqlite3VdbeMemMakeWriteable(tls, pVal) != SQLITE_OK { + return uintptr(0) + } + } + Xsqlite3VdbeMemNulTerminate(tls, pVal) // IMP: R-31275-44060 + } else { + Xsqlite3VdbeMemStringify(tls, pVal, enc, uint8(0)) + + } + + if int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fenc) == (int32(enc) & libc.CplInt32(SQLITE_UTF16_ALIGNED)) { + + return (*Sqlite3_value)(unsafe.Pointer(pVal)).Fz + } else { + return uintptr(0) + } + return uintptr(0) +} + +// This function is only available internally, it is not part of the +// external API. It works in a similar way to sqlite3_value_text(), +// except the data returned is in the encoding specified by the second +// parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or +// SQLITE_UTF8. +// +// (2006-02-16:) The enc value can be or-ed with SQLITE_UTF16_ALIGNED. +// If that is the case, then the result must be aligned on an even byte +// boundary. +func Xsqlite3ValueText(tls *libc.TLS, pVal uintptr, enc U8) uintptr { /* sqlite3.c:78275:27: */ + if !(pVal != 0) { + return uintptr(0) + } + + if ((int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fflags) & (MEM_Str | MEM_Term)) == (MEM_Str | MEM_Term)) && (int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc)) { + + return (*Sqlite3_value)(unsafe.Pointer(pVal)).Fz + } + if (int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fflags) & MEM_Null) != 0 { + return uintptr(0) + } + return valueToText(tls, pVal, enc) +} + +// Create a new sqlite3_value object. +func Xsqlite3ValueNew(tls *libc.TLS, db uintptr) uintptr { /* sqlite3.c:78293:30: */ + var p uintptr = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Mem{}))) + if p != 0 { + (*Mem)(unsafe.Pointer(p)).Fflags = U16(MEM_Null) + (*Mem)(unsafe.Pointer(p)).Fdb = db + } + return p +} + +// Context object passed by sqlite3Stat4ProbeSetValue() through to +// valueNew(). See comments above valueNew() for details. +type ValueNewStat4Ctx = struct { + FpParse uintptr + FpIdx uintptr + FppRec uintptr + FiVal int32 + _ [4]byte +} /* sqlite3.c:78306:1 */ + +// Allocate and return a pointer to a new sqlite3_value object. If +// the second argument to this function is NULL, the object is allocated +// by calling sqlite3ValueNew(). +// +// Otherwise, if the second argument is non-zero, then this function is +// being called indirectly by sqlite3Stat4ProbeSetValue(). If it has not +// already been allocated, allocate the UnpackedRecord structure that +// that function will return to its caller here. Then return a pointer to +// an sqlite3_value within the UnpackedRecord.a[] array. +func valueNew(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:78324:22: */ + if p != 0 { + var pRec uintptr = *(*uintptr)(unsafe.Pointer((*ValueNewStat4Ctx)(unsafe.Pointer(p)).FppRec)) + + if pRec == uintptr(0) { + var pIdx uintptr = (*ValueNewStat4Ctx)(unsafe.Pointer(p)).FpIdx // Index being probed + var nByte int32 // Bytes of space to allocate + var i int32 // Counter variable + var nCol int32 = int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) // Number of index columns including rowid + + nByte = (int32((uint64(unsafe.Sizeof(Mem{})) * uint64(nCol)) + (((uint64(unsafe.Sizeof(UnpackedRecord{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))))) + pRec = Xsqlite3DbMallocZero(tls, db, uint64(nByte)) + if pRec != 0 { + (*UnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo = Xsqlite3KeyInfoOfIndex(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(p)).FpParse, pIdx) + if (*UnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo != 0 { + + (*UnpackedRecord)(unsafe.Pointer(pRec)).FaMem = (pRec + uintptr((((uint64(unsafe.Sizeof(UnpackedRecord{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))))) + for i = 0; i < nCol; i++ { + (*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr(i)*56)).Fflags = U16(MEM_Null) + (*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr(i)*56)).Fdb = db + } + } else { + Xsqlite3DbFreeNN(tls, db, pRec) + pRec = uintptr(0) + } + } + if pRec == uintptr(0) { + return uintptr(0) + } + *(*uintptr)(unsafe.Pointer((*ValueNewStat4Ctx)(unsafe.Pointer(p)).FppRec)) = pRec + } + + (*UnpackedRecord)(unsafe.Pointer(pRec)).FnField = (U16((*ValueNewStat4Ctx)(unsafe.Pointer(p)).FiVal + 1)) + return ((*UnpackedRecord)(unsafe.Pointer(pRec)).FaMem + uintptr((*ValueNewStat4Ctx)(unsafe.Pointer(p)).FiVal)*56) + } + return Xsqlite3ValueNew(tls, db) +} + +// The expression object indicated by the second argument is guaranteed +// to be a scalar SQL function. If +// +// * all function arguments are SQL literals, +// * one of the SQLITE_FUNC_CONSTANT or _SLOCHNG function flags is set, and +// * the SQLITE_FUNC_NEEDCOLL function flag is not set, +// +// then this routine attempts to invoke the SQL function. Assuming no +// error occurs, output parameter (*ppVal) is set to point to a value +// object containing the result before returning SQLITE_OK. +// +// Affinity aff is applied to the result of the function before returning. +// If the result is a text value, the sqlite3_value object uses encoding +// enc. +// +// If the conditions above are not met, this function returns SQLITE_OK +// and sets (*ppVal) to NULL. Or, if an error occurs, (*ppVal) is set to +// NULL and an SQLite error code returned. +func valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc U8, aff U8, ppVal uintptr, pCtx uintptr) int32 { /* sqlite3.c:78386:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + // var ctx Sqlite3_context at bp+8, 56 + // Context object for function invocation + var apVal uintptr // Function arguments + var nVal int32 // Size of apVal[] array + var pFunc uintptr // Function definition + var pVal uintptr // New value + var rc int32 // Return code + var pList uintptr // Function arguments + var i int32 + apVal = uintptr(0) + nVal = 0 + pFunc = uintptr(0) + pVal = uintptr(0) + rc = SQLITE_OK + pList = uintptr(0) // Iterator variable + + pList = *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) + if !(pList != 0) { + goto __1 + } + nVal = (*ExprList)(unsafe.Pointer(pList)).FnExpr +__1: + ; + pFunc = Xsqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)), nVal, enc, uint8(0)) + + if !((((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & (U32(SQLITE_FUNC_CONSTANT | SQLITE_FUNC_SLOCHNG))) == U32(0)) || + (((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != 0)) { + goto __2 + } + return SQLITE_OK +__2: + ; + + if !(pList != 0) { + goto __3 + } + apVal = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nVal)))) + if !(apVal == uintptr(0)) { + goto __4 + } + rc = SQLITE_NOMEM + goto value_from_function_out +__4: + ; + i = 0 +__5: + if !(i < nVal) { + goto __7 + } + rc = Xsqlite3ValueFromExpr(tls, db, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr, enc, aff, (apVal + uintptr(i)*8)) + if !((*(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) == uintptr(0)) || (rc != SQLITE_OK)) { + goto __8 + } + goto value_from_function_out +__8: + ; + goto __6 +__6: + i++ + goto __5 + goto __7 +__7: + ; +__3: + ; + + pVal = valueNew(tls, db, pCtx) + if !(pVal == uintptr(0)) { + goto __9 + } + rc = SQLITE_NOMEM + goto value_from_function_out +__9: + ; + + libc.Xmemset(tls, bp+8 /* &ctx */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) + (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FpOut = pVal + (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FpFunc = pFunc + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pFunc + 24 /* &.xSFunc */))))(tls, bp+8 /* &ctx */, nVal, apVal) + if !((*Sqlite3_context)(unsafe.Pointer(bp+8 /* &ctx */)).FisError != 0) { + goto __10 + } + rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + goto __11 +__10: + Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) + + rc = Xsqlite3VdbeChangeEncoding(tls, pVal, int32(enc)) + if !((rc == SQLITE_OK) && (Xsqlite3VdbeMemTooBig(tls, pVal) != 0)) { + goto __12 + } + rc = SQLITE_TOOBIG + (*Parse)(unsafe.Pointer((*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).FnErr++ +__12: + ; +__11: + ; + (*Parse)(unsafe.Pointer((*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).Frc = rc + +value_from_function_out: + if !(rc != SQLITE_OK) { + goto __13 + } + pVal = uintptr(0) +__13: + ; + if !(apVal != 0) { + goto __14 + } + i = 0 +__15: + if !(i < nVal) { + goto __17 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + goto __16 +__16: + i++ + goto __15 + goto __17 +__17: + ; + Xsqlite3DbFreeNN(tls, db, apVal) +__14: + ; + + *(*uintptr)(unsafe.Pointer(ppVal)) = pVal + return rc +} + +// Extract a value from the supplied expression in the manner described +// above sqlite3ValueFromExpr(). Allocate the sqlite3_value object +// using valueNew(). +// +// If pCtx is NULL and an error occurs after the sqlite3_value object +// has been allocated, it is freed before returning. Or, if pCtx is not +// NULL, it is assumed that the caller will free any allocated object +// in all cases. +func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8, ppVal uintptr, pCtx uintptr) int32 { /* sqlite3.c:78480:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var op int32 + var zVal uintptr + // var pVal uintptr at bp+16, 8 + + var negInt int32 + var zNeg uintptr + var rc int32 + var aff U8 + var nVal int32 + zVal = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) + negInt = 1 + zNeg = ts + 756 /* "" */ + rc = SQLITE_OK + +__1: + if !(((libc.AssignInt32(&op, int32((*Expr)(unsafe.Pointer(pExpr)).Fop))) == TK_UPLUS) || (op == TK_SPAN)) { + goto __2 + } + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + goto __1 +__2: + ; + if !(op == TK_REGISTER) { + goto __3 + } + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) +__3: + ; + + // Compressed expressions only appear when parsing the DEFAULT clause + // on a table column definition, and hence only when pCtx==0. This + // check ensures that an EP_TokenOnly expression is never passed down + // into valueFromFunction(). + + if !(op == TK_CAST) { + goto __4 + } + aff = U8(Xsqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), uintptr(0))) + rc = valueFromExpr(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, enc, aff, ppVal, pCtx) + + if !(*(*uintptr)(unsafe.Pointer(ppVal)) != 0) { + goto __5 + } + Xsqlite3VdbeMemCast(tls, *(*uintptr)(unsafe.Pointer(ppVal)), aff, uint8(SQLITE_UTF8)) + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(ppVal)), affinity, uint8(SQLITE_UTF8)) +__5: + ; + return rc +__4: + ; + + // Handle negative integers in a single step. This is needed in the + // case when the value is -9223372036854775808. + if !((op == TK_UMINUS) && + ((int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == TK_INTEGER) || (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == TK_FLOAT))) { + goto __6 + } + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) + negInt = -1 + zNeg = ts + 4042 /* "-" */ +__6: + ; + + if !(((op == TK_STRING) || (op == TK_FLOAT)) || (op == TK_INTEGER)) { + goto __7 + } + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) == uintptr(0)) { + goto __9 + } + goto no_mem +__9: + ; + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_IntValue))) != U32(0)) { + goto __10 + } + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) + goto __11 +__10: + zVal = Xsqlite3MPrintf(tls, db, ts+4044 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + if !(zVal == uintptr(0)) { + goto __12 + } + goto no_mem +__12: + ; + Xsqlite3ValueSetStr(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), -1, zVal, uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) +__11: + ; + if !(((op == TK_INTEGER) || (op == TK_FLOAT)) && (int32(affinity) == SQLITE_AFF_BLOB)) { + goto __13 + } + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), uint8(SQLITE_AFF_NUMERIC), uint8(SQLITE_UTF8)) + goto __14 +__13: + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), affinity, uint8(SQLITE_UTF8)) +__14: + ; + + if !((int32((*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags) & ((MEM_Int | MEM_IntReal) | MEM_Real)) != 0) { + goto __15 + } + + *(*U16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Str))) +__15: + ; + if !(int32(enc) != SQLITE_UTF8) { + goto __16 + } + rc = Xsqlite3VdbeChangeEncoding(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), int32(enc)) +__16: + ; + goto __8 +__7: + if !(op == TK_UMINUS) { + goto __17 + } + // This branch happens for multiple negative signs. Ex: -(-5) + if !((SQLITE_OK == valueFromExpr(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, enc, affinity, bp+16 /* &pVal */, pCtx)) && + (*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) != uintptr(0))) { + goto __19 + } + Xsqlite3VdbeMemNumerify(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) + if !((int32((*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags) & MEM_Real) != 0) { + goto __20 + } + *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = -*(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) + goto __21 +__20: + if !(*(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) { + goto __22 + } + *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = -(float64((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) + (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags = (U16((int32((*Sqlite3_value)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Real)) + goto __23 +__22: + *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = -*(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) +__23: + ; +__21: + ; + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), affinity, enc) +__19: + ; + goto __18 +__17: + if !(op == TK_NULL) { + goto __24 + } + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) == uintptr(0)) { + goto __26 + } + goto no_mem +__26: + ; + Xsqlite3VdbeMemSetNull(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) + goto __25 +__24: + if !(op == TK_BLOB) { + goto __27 + } + + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(!(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) != 0)) { + goto __29 + } + goto no_mem +__29: + ; + zVal = (*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 2) + nVal = (Xsqlite3Strlen30(tls, zVal) - 1) + + Xsqlite3VdbeMemSetStr(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), Xsqlite3HexToBlob(tls, db, zVal, nVal), (int64(nVal / 2)), + uint8(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) + goto __28 +__27: + if !((op == TK_FUNCTION) && (pCtx != uintptr(0))) { + goto __30 + } + rc = valueFromFunction(tls, db, pExpr, enc, affinity, bp+16 /* &pVal */, pCtx) + goto __31 +__30: + if !(op == TK_TRUEFALSE) { + goto __32 + } + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) != 0) { + goto __33 + } + (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags = U16(MEM_Int) + *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = (I64(libc.Bool32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 4))) == 0))) +__33: + ; +__32: + ; +__31: + ; +__28: + ; +__25: + ; +__18: + ; +__8: + ; + + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) + return rc + +no_mem: + if !((pCtx == uintptr(0)) || ((*Parse)(unsafe.Pointer((*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse)).FnErr == 0)) { + goto __34 + } + Xsqlite3OomFault(tls, db) +__34: + ; + Xsqlite3DbFree(tls, db, zVal) + + if !(pCtx == uintptr(0)) { + goto __35 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) +__35: + ; + return SQLITE_NOMEM +} + +// Create a new sqlite3_value object, containing the value of pExpr. +// +// This only works for very simple expressions that consist of one constant +// token (i.e. "5", "5.1", "'a string'"). If the expression can +// be converted directly into a value, then the value is allocated and +// a pointer written to *ppVal. The caller is responsible for deallocating +// the value by passing it to sqlite3ValueFree() later on. If the expression +// cannot be converted to a value, then *ppVal is set to NULL. +func Xsqlite3ValueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8, ppVal uintptr) int32 { /* sqlite3.c:78635:20: */ + if pExpr != 0 { + return valueFromExpr(tls, db, pExpr, enc, affinity, ppVal, uintptr(0)) + } + return 0 +} + +// Attempt to extract a value from pExpr and use it to construct *ppVal. +// +// If pAlloc is not NULL, then an UnpackedRecord object is created for +// pAlloc if one does not exist and the new value is added to the +// UnpackedRecord object. +// +// A value is extracted in the following cases: +// +// * (pExpr==0). In this case the value is assumed to be an SQL NULL, +// +// * The expression is a bound variable, and this is a reprepare, or +// +// * The expression is a literal value. +// +// On success, *ppVal is made to point to the extracted value. The caller +// is responsible for ensuring that the value is eventually freed. +func stat4ValueFromExpr(tls *libc.TLS, pParse uintptr, pExpr uintptr, affinity U8, pAlloc uintptr, ppVal uintptr) int32 { /* sqlite3.c:78664:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + // Skip over any TK_COLLATE nodes + pExpr = Xsqlite3ExprSkipCollate(tls, pExpr) + + if !(pExpr != 0) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = valueNew(tls, db, pAlloc) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) != 0 { + Xsqlite3VdbeMemSetNull(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } else if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_VARIABLE) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableQPSG)) == uint64(0)) { + var v uintptr + var iBindVar int32 = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + Xsqlite3VdbeSetVarmask(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, iBindVar) + if (libc.AssignUintptr(&v, (*Parse)(unsafe.Pointer(pParse)).FpReprepare)) != uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = valueNew(tls, db, pAlloc) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) != 0 { + rc = Xsqlite3VdbeMemCopy(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */)), ((*Vdbe)(unsafe.Pointer(v)).FaVar + uintptr((iBindVar-1))*56)) + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */)), affinity, (*Sqlite3)(unsafe.Pointer(db)).Fenc) + (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pVal */)))).Fdb = (*Parse)(unsafe.Pointer(pParse)).Fdb + } + } + } else { + rc = valueFromExpr(tls, db, pExpr, (*Sqlite3)(unsafe.Pointer(db)).Fenc, affinity, bp /* &pVal */, pAlloc) + } + + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +// This function is used to allocate and populate UnpackedRecord +// structures intended to be compared against sample index keys stored +// in the sqlite_stat4 table. +// +// A single call to this function populates zero or more fields of the +// record starting with field iVal (fields are numbered from left to +// right starting with 0). A single field is populated if: +// +// * (pExpr==0). In this case the value is assumed to be an SQL NULL, +// +// * The expression is a bound variable, and this is a reprepare, or +// +// * The sqlite3ValueFromExpr() function is able to extract a value +// from the expression (i.e. the expression is a literal value). +// +// Or, if pExpr is a TK_VECTOR, one field is populated for each of the +// vector components that match either of the two latter criteria listed +// above. +// +// Before any value is appended to the record, the affinity of the +// corresponding column within index pIdx is applied to it. Before +// this function returns, output parameter *pnExtract is set to the +// number of values appended to the record. +// +// When this function is called, *ppRec must either point to an object +// allocated by an earlier call to this function, or must be NULL. If it +// is NULL and a value can be successfully extracted, a new UnpackedRecord +// is allocated (and *ppRec set to point to it) before returning. +// +// Unless an error is encountered, SQLITE_OK is returned. It is not an +// error if a value cannot be extracted from pExpr. If an error does +// occur, an SQLite error code is returned. +func Xsqlite3Stat4ProbeSetValue(tls *libc.TLS, pParse uintptr, pIdx uintptr, ppRec uintptr, pExpr uintptr, nElem int32, iVal int32, pnExtract uintptr) int32 { /* sqlite3.c:78739:20: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var rc int32 = SQLITE_OK + var nExtract int32 = 0 + + if (pExpr == uintptr(0)) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) { + var i int32 + // var alloc ValueNewStat4Ctx at bp, 32 + + (*ValueNewStat4Ctx)(unsafe.Pointer(bp /* &alloc */)).FpParse = pParse + (*ValueNewStat4Ctx)(unsafe.Pointer(bp /* &alloc */)).FpIdx = pIdx + (*ValueNewStat4Ctx)(unsafe.Pointer(bp /* &alloc */)).FppRec = ppRec + + for i = 0; i < nElem; i++ { + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVal */)) = uintptr(0) + var pElem uintptr = func() uintptr { + if pExpr != 0 { + return Xsqlite3VectorFieldSubexpr(tls, pExpr, i) + } + return uintptr(0) + }() + var aff U8 = U8(Xsqlite3IndexColumnAffinity(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pIdx, (iVal + i))) + (*ValueNewStat4Ctx)(unsafe.Pointer(bp /* &alloc */)).FiVal = (iVal + i) + rc = stat4ValueFromExpr(tls, pParse, pElem, aff, bp /* &alloc */, bp+32 /* &pVal */) + if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVal */)) != 0) { + break + } + nExtract++ + } + } + + *(*int32)(unsafe.Pointer(pnExtract)) = nExtract + return rc +} + +// Attempt to extract a value from expression pExpr using the methods +// as described for sqlite3Stat4ProbeSetValue() above. +// +// If successful, set *ppVal to point to a new value object and return +// SQLITE_OK. If no value can be extracted, but no other error occurs +// (e.g. OOM), return SQLITE_OK and set *ppVal to NULL. Or, if an error +// does occur, return an SQLite error code. The final value of *ppVal +// is undefined in this case. +func Xsqlite3Stat4ValueFromExpr(tls *libc.TLS, pParse uintptr, pExpr uintptr, affinity U8, ppVal uintptr) int32 { /* sqlite3.c:78784:20: */ + return stat4ValueFromExpr(tls, pParse, pExpr, affinity, uintptr(0), ppVal) +} + +// Extract the iCol-th column from the nRec-byte record in pRec. Write +// the column value into *ppVal. If *ppVal is initially NULL then a new +// sqlite3_value object is allocated. +// +// If *ppVal is initially NULL then the caller is responsible for +// ensuring that the value written into *ppVal is eventually freed. +func Xsqlite3Stat4Column(tls *libc.TLS, db uintptr, pRec uintptr, nRec int32, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:78801:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*U32)(unsafe.Pointer(bp + 4 /* t */)) = U32(0) // a column type code + // var nHdr int32 at bp, 4 + // Size of the header in the record + var iHdr int32 // Next unread header byte + var iField int32 // Next unread data byte + var szField int32 = 0 // Size of the current data field + var i int32 // Column index + var a uintptr = pRec // Typecast byte array + var pMem uintptr = *(*uintptr)(unsafe.Pointer(ppVal)) // Write result into this Mem object + + iHdr = int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(a))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*int32)(unsafe.Pointer(bp /* nHdr */))) = int32(U32(*(*U8)(unsafe.Pointer(a)))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, a, bp /* &nHdr */) + }()) + if (*(*int32)(unsafe.Pointer(bp /* nHdr */)) > nRec) || (iHdr >= *(*int32)(unsafe.Pointer(bp /* nHdr */))) { + return Xsqlite3CorruptError(tls, 78819) + } + iField = *(*int32)(unsafe.Pointer(bp /* nHdr */)) + for i = 0; i <= iCol; i++ { + iHdr = iHdr + (int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer((a + uintptr(iHdr))))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*U32)(unsafe.Pointer(bp + 4 /* t */))) = U32(*(*U8)(unsafe.Pointer((a + uintptr(iHdr))))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, (a + uintptr(iHdr)), bp+4 /* &t */) + }())) + + if iHdr > *(*int32)(unsafe.Pointer(bp /* nHdr */)) { + return Xsqlite3CorruptError(tls, 78825) + } + szField = int32(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 4 /* t */)))) + iField = iField + (szField) + } + + if iField > nRec { + return Xsqlite3CorruptError(tls, 78831) + } + if pMem == uintptr(0) { + pMem = libc.AssignPtrUintptr(ppVal, Xsqlite3ValueNew(tls, db)) + if pMem == uintptr(0) { + return SQLITE_NOMEM + } + } + Xsqlite3VdbeSerialGet(tls, (a + uintptr((iField - szField))), *(*U32)(unsafe.Pointer(bp + 4 /* t */)), pMem) + (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer(db)).Fenc + return SQLITE_OK +} + +// Unless it is NULL, the argument must be an UnpackedRecord object returned +// by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes +// the object. +func Xsqlite3Stat4ProbeFree(tls *libc.TLS, pRec uintptr) { /* sqlite3.c:78846:21: */ + if pRec != 0 { + var i int32 + var nCol int32 = int32((*KeyInfo)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo)).FnAllField) + var aMem uintptr = (*UnpackedRecord)(unsafe.Pointer(pRec)).FaMem + var db uintptr = (*Mem)(unsafe.Pointer(aMem)).Fdb + for i = 0; i < nCol; i++ { + Xsqlite3VdbeMemRelease(tls, (aMem + uintptr(i)*56)) + } + Xsqlite3KeyInfoUnref(tls, (*UnpackedRecord)(unsafe.Pointer(pRec)).FpKeyInfo) + Xsqlite3DbFreeNN(tls, db, pRec) + } +} + +// Change the string value of an sqlite3_value object +func Xsqlite3ValueSetStr(tls *libc.TLS, v uintptr, n int32, z uintptr, enc U8, xDel uintptr) { /* sqlite3.c:78864:21: */ + if v != 0 { + Xsqlite3VdbeMemSetStr(tls, v, z, int64(n), enc, xDel) + } +} + +// Free an sqlite3_value object +func Xsqlite3ValueFree(tls *libc.TLS, v uintptr) { /* sqlite3.c:78877:21: */ + if !(v != 0) { + return + } + Xsqlite3VdbeMemRelease(tls, v) + Xsqlite3DbFreeNN(tls, (*Mem)(unsafe.Pointer(v)).Fdb, v) +} + +// The sqlite3ValueBytes() routine returns the number of bytes in the +// sqlite3_value object assuming that it uses the encoding "enc". +// The valueBytes() routine is a helper function. +func valueBytes(tls *libc.TLS, pVal uintptr, enc U8) int32 { /* sqlite3.c:78888:28: */ + if valueToText(tls, pVal, enc) != uintptr(0) { + return (*Sqlite3_value)(unsafe.Pointer(pVal)).Fn + } + return 0 +} + +func Xsqlite3ValueBytes(tls *libc.TLS, pVal uintptr, enc U8) int32 { /* sqlite3.c:78891:20: */ + var p uintptr = pVal + + if ((int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Str) != 0) && (int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fenc) == int32(enc)) { + return (*Mem)(unsafe.Pointer(p)).Fn + } + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Blob) != 0 { + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Zero) != 0 { + return ((*Mem)(unsafe.Pointer(p)).Fn + *(*int32)(unsafe.Pointer(p /* &.u */))) + } else { + return (*Mem)(unsafe.Pointer(p)).Fn + } + } + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Null) != 0 { + return 0 + } + return valueBytes(tls, pVal, enc) +} + +// Create a new virtual database engine. +func Xsqlite3VdbeCreate(tls *libc.TLS, pParse uintptr) uintptr { /* sqlite3.c:78934:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var p uintptr + p = Xsqlite3DbMallocRawNN(tls, db, uint64(unsafe.Sizeof(Vdbe{}))) + if p == uintptr(0) { + return uintptr(0) + } + libc.Xmemset(tls, (p + 136 /* &.aOp */), 0, (uint64(unsafe.Sizeof(Vdbe{})) - (uint64((uintptr(0) + 136 /* &.aOp */))))) + (*Vdbe)(unsafe.Pointer(p)).Fdb = db + if (*Sqlite3)(unsafe.Pointer(db)).FpVdbe != 0 { + (*Vdbe1)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpVdbe)).FpPrev = p + } + (*Vdbe)(unsafe.Pointer(p)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).FpVdbe + (*Vdbe)(unsafe.Pointer(p)).FpPrev = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FpVdbe = p + (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic = U32(VDBE_MAGIC_INIT) + (*Vdbe)(unsafe.Pointer(p)).FpParse = pParse + (*Parse)(unsafe.Pointer(pParse)).FpVdbe = p + + Xsqlite3VdbeAddOp2(tls, p, OP_Init, 0, 1) + return p +} + +// Return the Parse object that owns a Vdbe object. +func Xsqlite3VdbeParser(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:78961:22: */ + return (*Vdbe)(unsafe.Pointer(p)).FpParse +} + +// Change the error string stored in Vdbe.zErrMsg +func Xsqlite3VdbeError(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:78968:21: */ + var ap Va_list + _ = ap + Xsqlite3DbFree(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) + ap = va + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3VMPrintf(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, zFormat, ap) + _ = ap +} + +// Remember the SQL string for a prepared statement. +func Xsqlite3VdbeSetSql(tls *libc.TLS, p uintptr, z uintptr, n int32, prepFlags U8) { /* sqlite3.c:78979:21: */ + if p == uintptr(0) { + return + } + (*Vdbe)(unsafe.Pointer(p)).FprepFlags = prepFlags + if (int32(prepFlags) & SQLITE_PREPARE_SAVESQL) == 0 { + (*Vdbe)(unsafe.Pointer(p)).Fexpmask = U32(0) + } + + (*Vdbe)(unsafe.Pointer(p)).FzSql = Xsqlite3DbStrNDup(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, z, uint64(n)) +} + +// Swap all content between two VDBE structures. +func Xsqlite3VdbeSwap(tls *libc.TLS, pA uintptr, pB uintptr) { /* sqlite3.c:79029:21: */ + var tmp Vdbe + var pTmp uintptr + var zTmp uintptr + + tmp = *(*Vdbe)(unsafe.Pointer(pA)) + *(*Vdbe)(unsafe.Pointer(pA)) = *(*Vdbe)(unsafe.Pointer(pB)) + *(*Vdbe)(unsafe.Pointer(pB)) = tmp + pTmp = (*Vdbe)(unsafe.Pointer(pA)).FpNext + (*Vdbe)(unsafe.Pointer(pA)).FpNext = (*Vdbe)(unsafe.Pointer(pB)).FpNext + (*Vdbe)(unsafe.Pointer(pB)).FpNext = pTmp + pTmp = (*Vdbe)(unsafe.Pointer(pA)).FpPrev + (*Vdbe)(unsafe.Pointer(pA)).FpPrev = (*Vdbe)(unsafe.Pointer(pB)).FpPrev + (*Vdbe)(unsafe.Pointer(pB)).FpPrev = pTmp + zTmp = (*Vdbe)(unsafe.Pointer(pA)).FzSql + (*Vdbe)(unsafe.Pointer(pA)).FzSql = (*Vdbe)(unsafe.Pointer(pB)).FzSql + (*Vdbe)(unsafe.Pointer(pB)).FzSql = zTmp + (*Vdbe)(unsafe.Pointer(pB)).Fexpmask = (*Vdbe)(unsafe.Pointer(pA)).Fexpmask + (*Vdbe)(unsafe.Pointer(pB)).FprepFlags = (*Vdbe)(unsafe.Pointer(pA)).FprepFlags + libc.Xmemcpy(tls, pB+212 /* &.aCounter */, pA+212 /* &.aCounter */, uint64(unsafe.Sizeof([7]U32{}))) + *(*U32)(unsafe.Pointer((pB + 212 /* &.aCounter */) + 5*4))++ +} + +// Resize the Vdbe.aOp array so that it is at least nOp elements larger +// than its current size. nOp is guaranteed to be less than or equal +// to 1024/sizeof(Op). +// +// If an out-of-memory error occurs while resizing the array, return +// SQLITE_NOMEM. In this case Vdbe.aOp and Vdbe.nOpAlloc remain +// unchanged (this is so that any opcodes already allocated can be +// correctly deallocated along with the rest of the Vdbe). +func growOpArray(tls *libc.TLS, v uintptr, nOp int32) int32 { /* sqlite3.c:79066:12: */ + var pNew uintptr + var p uintptr = (*Vdbe)(unsafe.Pointer(v)).FpParse + + // The SQLITE_TEST_REALLOC_STRESS compile-time option is designed to force + // more frequent reallocs and hence provide more opportunities for + // simulated OOM faults. SQLITE_TEST_REALLOC_STRESS is generally used + // during testing only. With SQLITE_TEST_REALLOC_STRESS grow the op array + // by the minimum* amount required until the size reaches 512. Normal + // operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current + // size of the op array or add 1KB of space, whichever is smaller. + var nNew Sqlite3_int64 = func() int64 { + if (*Vdbe)(unsafe.Pointer(v)).FnOpAlloc != 0 { + return (int64(2) * Sqlite3_int64((*Vdbe)(unsafe.Pointer(v)).FnOpAlloc)) + } + return (int64(uint64(1024) / uint64(unsafe.Sizeof(Op{})))) + }() + _ = nOp + + // Ensure that the size of a VDBE does not grow too large + if nNew > Sqlite3_int64(*(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(p)).Fdb + 128 /* &.aLimit */) + 5*4))) { + Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(p)).Fdb) + return SQLITE_NOMEM + } + + pNew = Xsqlite3DbRealloc(tls, (*Parse)(unsafe.Pointer(p)).Fdb, (*Vdbe)(unsafe.Pointer(v)).FaOp, (uint64(nNew) * uint64(unsafe.Sizeof(Op{})))) + if pNew != 0 { + (*Parse)(unsafe.Pointer(p)).FszOpAlloc = Xsqlite3DbMallocSize(tls, (*Parse)(unsafe.Pointer(p)).Fdb, pNew) + (*Vdbe)(unsafe.Pointer(v)).FnOpAlloc = (int32(uint64((*Parse)(unsafe.Pointer(p)).FszOpAlloc) / uint64(unsafe.Sizeof(Op{})))) + (*Vdbe)(unsafe.Pointer(v)).FaOp = pNew + } + return func() int32 { + if pNew != 0 { + return SQLITE_OK + } + return SQLITE_NOMEM + }() +} + +// Add a new instruction to the list of instructions current in the +// VDBE. Return the address of the new instruction. +// +// Parameters: +// +// p Pointer to the VDBE +// +// op The opcode for this instruction +// +// p1, p2, p3 Operands +// +// Use the sqlite3VdbeResolveLabel() function to fix an address and +// the sqlite3VdbeChangeP4() function to change the value of the P4 +// operand. +func growOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32) int32 { /* sqlite3.c:79137:28: */ + + if growOpArray(tls, p, 1) != 0 { + return 1 + } + + return Xsqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) +} + +func Xsqlite3VdbeAddOp3(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32) int32 { /* sqlite3.c:79143:20: */ + var i int32 + var pOp uintptr + + i = (*Vdbe)(unsafe.Pointer(p)).FnOp + + if (*Vdbe)(unsafe.Pointer(p)).FnOpAlloc <= i { + return growOp3(tls, p, op, p1, p2, p3) + } + (*Vdbe)(unsafe.Pointer(p)).FnOp++ + pOp = ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(i)*24) + (*VdbeOp)(unsafe.Pointer(pOp)).Fopcode = U8(op) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp5 = U16(0) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = p1 + (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 = p2 + (*VdbeOp)(unsafe.Pointer(pOp)).Fp3 = p3 + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = uintptr(0) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(P4_NOTUSED) + return i +} + +func Xsqlite3VdbeAddOp0(tls *libc.TLS, p uintptr, op int32) int32 { /* sqlite3.c:79180:20: */ + return Xsqlite3VdbeAddOp3(tls, p, op, 0, 0, 0) +} + +func Xsqlite3VdbeAddOp1(tls *libc.TLS, p uintptr, op int32, p1 int32) int32 { /* sqlite3.c:79183:20: */ + return Xsqlite3VdbeAddOp3(tls, p, op, p1, 0, 0) +} + +func Xsqlite3VdbeAddOp2(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32) int32 { /* sqlite3.c:79186:20: */ + return Xsqlite3VdbeAddOp3(tls, p, op, p1, p2, 0) +} + +// Generate code for an unconditional jump to instruction iDest +func Xsqlite3VdbeGoto(tls *libc.TLS, p uintptr, iDest int32) int32 { /* sqlite3.c:79192:20: */ + return Xsqlite3VdbeAddOp3(tls, p, OP_Goto, 0, iDest, 0) +} + +// Generate code to cause the string zStr to be loaded into +// register iDest +func Xsqlite3VdbeLoadString(tls *libc.TLS, p uintptr, iDest int32, zStr uintptr) int32 { /* sqlite3.c:79199:20: */ + return Xsqlite3VdbeAddOp4(tls, p, OP_String8, 0, iDest, 0, zStr, 0) +} + +// Generate code that initializes multiple registers to string or integer +// constants. The registers begin with iDest and increase consecutively. +// One register is initialized for each characgter in zTypes[]. For each +// "s" character in zTypes[], the register is a string if the argument is +// not NULL, or OP_Null if the value is a null pointer. For each "i" character +// in zTypes[], the register is initialized to an integer. +// +// If the input string does not end with "X" then an OP_ResultRow instruction +// is generated for the values inserted. +func Xsqlite3VdbeMultiLoad(tls *libc.TLS, p uintptr, iDest int32, zTypes uintptr, va uintptr) { /* sqlite3.c:79214:21: */ + var ap Va_list + _ = ap + var i int32 + var c int8 + var z uintptr + ap = va + i = 0 +__1: + if !((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zTypes + uintptr(i)))))) != 0) { + goto __3 + } + if !(int32(c) == 's') { + goto __4 + } + z = libc.VaUintptr(&ap) + Xsqlite3VdbeAddOp4(tls, p, func() int32 { + if z == uintptr(0) { + return OP_Null + } + return OP_String8 + }(), 0, (iDest + i), 0, z, 0) + goto __5 +__4: + if !(int32(c) == 'i') { + goto __6 + } + Xsqlite3VdbeAddOp2(tls, p, OP_Integer, int32(libc.VaInt32(&ap)), (iDest + i)) + goto __7 +__6: + goto skip_op_resultrow +__7: + ; +__5: + ; + goto __2 +__2: + i++ + goto __1 + goto __3 +__3: + ; + Xsqlite3VdbeAddOp2(tls, p, OP_ResultRow, iDest, i) +skip_op_resultrow: + _ = ap +} + +// Add an opcode that includes the p4 value as a pointer. +func Xsqlite3VdbeAddOp4(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, zP4 uintptr, p4type int32) int32 { /* sqlite3.c:79237:20: */ + var addr int32 = Xsqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) + Xsqlite3VdbeChangeP4(tls, p, addr, zP4, p4type) + return addr +} + +// Add an OP_Function or OP_PureFunc opcode. +// +// The eCallCtx argument is information (typically taken from Expr.op2) +// that describes the calling context of the function. 0 means a general +// function call. NC_IsCheck means called by a check constraint, +// NC_IdxExpr means called as part of an index expression. NC_PartIdx +// means in the WHERE clause of a partial index. NC_GenCol means called +// while computing a generated column value. 0 is the usual case. +func Xsqlite3VdbeAddFunctionCall(tls *libc.TLS, pParse uintptr, p1 int32, p2 int32, p3 int32, nArg int32, pFunc uintptr, eCallCtx int32) int32 { /* sqlite3.c:79261:20: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var nByte int32 + var addr int32 + var pCtx uintptr + + nByte = (int32(uint64(unsafe.Sizeof(Sqlite3_context{})) + ((uint64(nArg - 1)) * uint64(unsafe.Sizeof(uintptr(0)))))) + pCtx = Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(nByte)) + if pCtx == uintptr(0) { + + freeEphemeralFunction(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pFunc) + return 0 + } + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut = uintptr(0) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc = pFunc + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe = uintptr(0) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = 0 + (*Sqlite3_context)(unsafe.Pointer(pCtx)).Fargc = U8(nArg) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FiOp = Xsqlite3VdbeCurrentAddr(tls, v) + addr = Xsqlite3VdbeAddOp4(tls, v, func() int32 { + if eCallCtx != 0 { + return OP_PureFunc + } + return OP_Function + }(), + p1, p2, p3, pCtx, -16) + Xsqlite3VdbeChangeP5(tls, v, (uint16(eCallCtx & NC_SelfRef))) + return addr +} + +// Add an opcode that includes the p4 value with a P4_INT64 or +// P4_REAL type. +func Xsqlite3VdbeAddOp4Dup8(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, zP4 uintptr, p4type int32) int32 { /* sqlite3.c:79298:20: */ + var p4copy uintptr = Xsqlite3DbMallocRawNN(tls, Xsqlite3VdbeDb(tls, p), uint64(8)) + if p4copy != 0 { + libc.Xmemcpy(tls, p4copy, zP4, uint64(8)) + } + return Xsqlite3VdbeAddOp4(tls, p, op, p1, p2, p3, p4copy, p4type) +} + +// Return the address of the current EXPLAIN QUERY PLAN baseline. +// 0 means "none". +func Xsqlite3VdbeExplainParent(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:79317:20: */ + var pOp uintptr + if (*Parse)(unsafe.Pointer(pParse)).FaddrExplain == 0 { + return 0 + } + pOp = Xsqlite3VdbeGetOp(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, (*Parse)(unsafe.Pointer(pParse)).FaddrExplain) + return (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 +} + +// Set a debugger breakpoint on the following routine in order to +// monitor the EXPLAIN QUERY PLAN code generation. + +// Add a new OP_Explain opcode. +// +// If the bPush flag is true, then make this opcode the parent for +// subsequent Explains until sqlite3VdbeExplainPop() is called. +func Xsqlite3VdbeExplain(tls *libc.TLS, pParse uintptr, bPush U8, zFmt uintptr, va uintptr) { /* sqlite3.c:79341:21: */ + // Always include the OP_Explain opcodes if SQLITE_DEBUG is defined. + // But omit them (for performance) during production builds + if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { + var zMsg uintptr + var v uintptr + var ap Va_list + _ = ap + var iThis int32 + ap = va + zMsg = Xsqlite3VMPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, zFmt, ap) + _ = ap + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + iThis = (*Vdbe)(unsafe.Pointer(v)).FnOp + Xsqlite3VdbeAddOp4(tls, v, OP_Explain, iThis, (*Parse)(unsafe.Pointer(pParse)).FaddrExplain, 0, + zMsg, -7) + + if bPush != 0 { + (*Parse)(unsafe.Pointer(pParse)).FaddrExplain = iThis + } + } +} + +// Pop the EXPLAIN QUERY PLAN stack one level. +func Xsqlite3VdbeExplainPop(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:79369:21: */ + + (*Parse)(unsafe.Pointer(pParse)).FaddrExplain = Xsqlite3VdbeExplainParent(tls, pParse) +} + +// Add an OP_ParseSchema opcode. This routine is broken out from +// sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees +// as having been used. +// +// The zWhere string must have been obtained from sqlite3_malloc(). +// This routine will take ownership of the allocated memory. +func Xsqlite3VdbeAddParseSchemaOp(tls *libc.TLS, p uintptr, iDb int32, zWhere uintptr, p5 U16) { /* sqlite3.c:79383:21: */ + var j int32 + Xsqlite3VdbeAddOp4(tls, p, OP_ParseSchema, iDb, 0, 0, zWhere, -7) + Xsqlite3VdbeChangeP5(tls, p, p5) + for j = 0; j < (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FnDb; j++ { + Xsqlite3VdbeUsesBtree(tls, p, j) + } + Xsqlite3MayAbort(tls, (*Vdbe)(unsafe.Pointer(p)).FpParse) +} + +// Add an opcode that includes the p4 value as an integer. +func Xsqlite3VdbeAddOp4Int(tls *libc.TLS, p uintptr, op int32, p1 int32, p2 int32, p3 int32, p4 int32) int32 { /* sqlite3.c:79394:20: */ + var addr int32 = Xsqlite3VdbeAddOp3(tls, p, op, p1, p2, p3) + if int32((*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed) == 0 { + var pOp uintptr = ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(-3) + *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = p4 + } + return addr +} + +// Insert the end of a co-routine +func Xsqlite3VdbeEndCoroutine(tls *libc.TLS, v uintptr, regYield int32) { /* sqlite3.c:79413:21: */ + Xsqlite3VdbeAddOp1(tls, v, OP_EndCoroutine, regYield) + + // Clear the temporary register cache, thereby ensuring that each + // co-routine has its own independent set of registers, because co-routines + // might expect their registers to be preserved across an OP_Yield, and + // that could cause problems if two or more co-routines are using the same + // temporary register. + (*Parse)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FpParse)).FnTempReg = U8(0) + (*Parse)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FpParse)).FnRangeReg = 0 +} + +// Create a new symbolic label for an instruction that has yet to be +// coded. The symbolic label is really just a negative number. The +// label can be used as the P2 value of an operation. Later, when +// the label is resolved to a specific address, the VDBE will scan +// through its operation list and change all values of P2 which match +// the label into the resolved address. +// +// The VDBE knows that a P2 value is a label because labels are +// always negative and P2 values are suppose to be non-negative. +// Hence, a negative P2 value is a label that has yet to be resolved. +// (Later:) This is only true for opcodes that have the OPFLG_JUMP +// property. +// +// Variable usage notes: +// +// Parse.aLabel[x] Stores the address that the x-th label resolves +// into. For testing (SQLITE_DEBUG), unresolved +// labels stores -1, but that is not required. +// Parse.nLabelAlloc Number of slots allocated to Parse.aLabel[] +// Parse.nLabel The *negative* of the number of labels that have +// been issued. The negative is stored because +// that gives a performance improvement over storing +// the equivalent positive value. +func Xsqlite3VdbeMakeLabel(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:79451:20: */ + return libc.PreDecInt32(&(*Parse)(unsafe.Pointer(pParse)).FnLabel, 1) +} + +// Resolve label "x" to be the address of the next instruction to +// be inserted. The parameter "x" must have been obtained from +// a prior call to sqlite3VdbeMakeLabel(). +func resizeResolveLabel(tls *libc.TLS, p uintptr, v uintptr, j int32) { /* sqlite3.c:79460:29: */ + var nNewSize int32 = (10 - (*Parse)(unsafe.Pointer(p)).FnLabel) + (*Parse)(unsafe.Pointer(p)).FaLabel = Xsqlite3DbReallocOrFree(tls, (*Parse)(unsafe.Pointer(p)).Fdb, (*Parse)(unsafe.Pointer(p)).FaLabel, + (uint64(uint64(nNewSize) * uint64(unsafe.Sizeof(int32(0)))))) + if (*Parse)(unsafe.Pointer(p)).FaLabel == uintptr(0) { + (*Parse)(unsafe.Pointer(p)).FnLabelAlloc = 0 + } else { + (*Parse)(unsafe.Pointer(p)).FnLabelAlloc = nNewSize + *(*int32)(unsafe.Pointer((*Parse)(unsafe.Pointer(p)).FaLabel + uintptr(j)*4)) = (*Vdbe)(unsafe.Pointer(v)).FnOp + } +} + +func Xsqlite3VdbeResolveLabel(tls *libc.TLS, v uintptr, x int32) { /* sqlite3.c:79475:21: */ + var p uintptr = (*Vdbe)(unsafe.Pointer(v)).FpParse + var j int32 = ^x + + if ((*Parse)(unsafe.Pointer(p)).FnLabelAlloc + (*Parse)(unsafe.Pointer(p)).FnLabel) < 0 { + resizeResolveLabel(tls, p, v, j) + } else { + // Labels may only be resolved once + *(*int32)(unsafe.Pointer((*Parse)(unsafe.Pointer(p)).FaLabel + uintptr(j)*4)) = (*Vdbe)(unsafe.Pointer(v)).FnOp + } +} + +// Mark the VDBE as one that can only be run one time. +func Xsqlite3VdbeRunOnlyOnce(tls *libc.TLS, p uintptr) { /* sqlite3.c:79497:21: */ + libc.SetBitFieldPtr16Uint32(p+200 /* &.runOnlyOnce */, Bft(1), 5, 0x20) +} + +// Mark the VDBE as one that can only be run multiple times. +func Xsqlite3VdbeReusable(tls *libc.TLS, p uintptr) { /* sqlite3.c:79504:21: */ + libc.SetBitFieldPtr16Uint32(p+200 /* &.runOnlyOnce */, Bft(0), 5, 0x20) +} + +// This routine is called after all opcodes have been inserted. It loops +// through all the opcodes and fixes up some details. +// +// (1) For each jump instruction with a negative P2 value (a label) +// resolve the P2 value to an actual address. +// +// (2) Compute the maximum number of arguments used by any SQL function +// and store that value in *pMaxFuncArgs. +// +// (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately +// indicate what the prepared statement actually does. +// +// (4) Initialize the p4.xAdvance pointer on opcodes that use it. +// +// (5) Reclaim the memory allocated for storing labels. +// +// This routine will only function correctly if the mkopcodeh.tcl generator +// script numbers the opcodes correctly. Changes to this routine must be +// coordinated with changes to mkopcodeh.tcl. +func resolveP2Values(tls *libc.TLS, p uintptr, pMaxFuncArgs uintptr) { /* sqlite3.c:79700:13: */ + var nMaxArgs int32 = *(*int32)(unsafe.Pointer(pMaxFuncArgs)) + var pOp uintptr + var pParse uintptr = (*Vdbe)(unsafe.Pointer(p)).FpParse + var aLabel uintptr = (*Parse)(unsafe.Pointer(pParse)).FaLabel + libc.SetBitFieldPtr16Uint32(p+200 /* &.readOnly */, Bft(1), 7, 0x80) + libc.SetBitFieldPtr16Uint32(p+200 /* &.bIsReader */, Bft(0), 8, 0x100) + pOp = ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(((*Vdbe)(unsafe.Pointer(p)).FnOp-1))*24) + for 1 != 0 { + + // Only JUMP opcodes and the short list of special opcodes in the switch + // below need to be considered. The mkopcodeh.tcl generator script groups + // all these opcodes together near the front of the opcode list. Skip + // any opcode that does not need processing by virtual of the fact that + // it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization. + if int32((*Op)(unsafe.Pointer(pOp)).Fopcode) <= SQLITE_MX_JUMP_OPCODE { + // NOTE: Be sure to update mkopcodeh.tcl when adding or removing + // cases from this switch! + switch int32((*Op)(unsafe.Pointer(pOp)).Fopcode) { + case OP_Transaction: + { + if (*Op)(unsafe.Pointer(pOp)).Fp2 != 0 { + libc.SetBitFieldPtr16Uint32(p+200 /* &.readOnly */, Bft(0), 7, 0x80) + } + + } + fallthrough + case OP_AutoCommit: + fallthrough + case OP_Savepoint: + { + libc.SetBitFieldPtr16Uint32(p+200 /* &.bIsReader */, Bft(1), 8, 0x100) + break + + } + fallthrough + case OP_Checkpoint: + fallthrough + case OP_Vacuum: + fallthrough + case OP_JournalMode: + { + libc.SetBitFieldPtr16Uint32(p+200 /* &.readOnly */, Bft(0), 7, 0x80) + libc.SetBitFieldPtr16Uint32(p+200 /* &.bIsReader */, Bft(1), 8, 0x100) + break + + } + fallthrough + case OP_Next: + fallthrough + case OP_SorterNext: + { + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32) int32 + }{Xsqlite3BtreeNext})) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(-5) + // The code generator never codes any of these opcodes as a jump + // to a label. They are always coded as a jump backwards to a + // known address + + break + + } + fallthrough + case OP_Prev: + { + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32) int32 + }{Xsqlite3BtreePrevious})) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(-5) + // The code generator never codes any of these opcodes as a jump + // to a label. They are always coded as a jump backwards to a + // known address + + break + + } + fallthrough + case OP_VUpdate: + { + if (*Op)(unsafe.Pointer(pOp)).Fp2 > nMaxArgs { + nMaxArgs = (*Op)(unsafe.Pointer(pOp)).Fp2 + } + break + + } + fallthrough + case OP_VFilter: + { + var n int32 + + n = (*Op)(unsafe.Pointer(pOp + libc.UintptrFromInt32(-1)*24)).Fp1 + if n > nMaxArgs { + nMaxArgs = n + } + + } + fallthrough + default: + { + if (*Op)(unsafe.Pointer(pOp)).Fp2 < 0 { + // The mkopcodeh.tcl script has so arranged things that the only + // non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to + // have non-negative values for P2. + + (*Op)(unsafe.Pointer(pOp)).Fp2 = *(*int32)(unsafe.Pointer(aLabel + uintptr(^(*Op)(unsafe.Pointer(pOp)).Fp2)*4)) + } + break + + } + } + // The mkopcodeh.tcl script has so arranged things that the only + // non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to + // have non-negative values for P2. + + } + if pOp == (*Vdbe)(unsafe.Pointer(p)).FaOp { + break + } + pOp -= 24 + } + Xsqlite3DbFree(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, (*Parse)(unsafe.Pointer(pParse)).FaLabel) + (*Parse)(unsafe.Pointer(pParse)).FaLabel = uintptr(0) + (*Parse)(unsafe.Pointer(pParse)).FnLabel = 0 + *(*int32)(unsafe.Pointer(pMaxFuncArgs)) = nMaxArgs + +} + +// Return the address of the next instruction to be inserted. +func Xsqlite3VdbeCurrentAddr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:79802:20: */ + + return (*Vdbe)(unsafe.Pointer(p)).FnOp +} + +// Verify that at least N opcode slots are available in p without +// having to malloc for more space (except when compiled using +// SQLITE_TEST_REALLOC_STRESS). This interface is used during testing +// to verify that certain calls to sqlite3VdbeAddOpList() can never +// fail due to a OOM fault and hence that the return value from +// sqlite3VdbeAddOpList() will always be non-NULL. + +// Verify that the VM passed as the only argument does not contain +// an OP_ResultRow opcode. Fail an assert() if it does. This is used +// by code in pragma.c to ensure that the implementation of certain +// pragmas comports with the flags specified in the mkpragmatab.tcl +// script. + +// Generate code (a single OP_Abortable opcode) that will +// verify that the VDBE program can safely call Abort in the current +// context. + +// This function returns a pointer to the array of opcodes associated with +// the Vdbe passed as the first argument. It is the callers responsibility +// to arrange for the returned array to be eventually freed using the +// vdbeFreeOpArray() function. +// +// Before returning, *pnOp is set to the number of entries in the returned +// array. Also, *pnMaxArg is set to the larger of its current value and +// the number of entries in the Vdbe.apArg[] array required to execute the +// returned program. +func Xsqlite3VdbeTakeOpArray(tls *libc.TLS, p uintptr, pnOp uintptr, pnMaxArg uintptr) uintptr { /* sqlite3.c:79859:23: */ + var aOp uintptr = (*Vdbe)(unsafe.Pointer(p)).FaOp + + // Check that sqlite3VdbeUsesBtree() was not called on this VM + + resolveP2Values(tls, p, pnMaxArg) + *(*int32)(unsafe.Pointer(pnOp)) = (*Vdbe)(unsafe.Pointer(p)).FnOp + (*Vdbe)(unsafe.Pointer(p)).FaOp = uintptr(0) + return aOp +} + +// Add a whole list of operations to the operation stack. Return a +// pointer to the first operation inserted. +// +// Non-zero P2 arguments to jump instructions are automatically adjusted +// so that the jump target is relative to the first operation inserted. +func Xsqlite3VdbeAddOpList(tls *libc.TLS, p uintptr, nOp int32, aOp uintptr, iLineno int32) uintptr { /* sqlite3.c:79879:23: */ + var i int32 + var pOut uintptr + var pFirst uintptr + + if (((*Vdbe)(unsafe.Pointer(p)).FnOp + nOp) > (*Vdbe)(unsafe.Pointer(p)).FnOpAlloc) && (growOpArray(tls, p, nOp) != 0) { + return uintptr(0) + } + pFirst = libc.AssignUintptr(&pOut, ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr((*Vdbe)(unsafe.Pointer(p)).FnOp)*24)) + i = 0 +__1: + if !(i < nOp) { + goto __3 + } + { + (*VdbeOp)(unsafe.Pointer(pOut)).Fopcode = (*VdbeOpList)(unsafe.Pointer(aOp)).Fopcode + (*VdbeOp)(unsafe.Pointer(pOut)).Fp1 = int32((*VdbeOpList)(unsafe.Pointer(aOp)).Fp1) + (*VdbeOp)(unsafe.Pointer(pOut)).Fp2 = int32((*VdbeOpList)(unsafe.Pointer(aOp)).Fp2) + + if ((int32(Xsqlite3OpcodeProperty[(*VdbeOpList)(unsafe.Pointer(aOp)).Fopcode]) & OPFLG_JUMP) != 0) && (int32((*VdbeOpList)(unsafe.Pointer(aOp)).Fp2) > 0) { + *(*int32)(unsafe.Pointer(pOut + 8 /* &.p2 */)) += ((*Vdbe)(unsafe.Pointer(p)).FnOp) + } + (*VdbeOp)(unsafe.Pointer(pOut)).Fp3 = int32((*VdbeOpList)(unsafe.Pointer(aOp)).Fp3) + (*VdbeOp)(unsafe.Pointer(pOut)).Fp4type = int8(P4_NOTUSED) + *(*uintptr)(unsafe.Pointer(pOut + 16 /* &.p4 */)) = uintptr(0) + (*VdbeOp)(unsafe.Pointer(pOut)).Fp5 = U16(0) + _ = iLineno + + } + goto __2 +__2: + i++ + aOp += 4 + pOut += 24 + goto __1 + goto __3 +__3: + ; + *(*int32)(unsafe.Pointer(p + 144 /* &.nOp */)) += (nOp) + return pFirst +} + +// Change the value of the opcode, or P1, P2, P3, or P5 operands +// for a specific instruction. +func Xsqlite3VdbeChangeOpcode(tls *libc.TLS, p uintptr, addr int32, iNewOpcode U8) { /* sqlite3.c:79955:21: */ + (*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, p, addr))).Fopcode = iNewOpcode +} + +func Xsqlite3VdbeChangeP1(tls *libc.TLS, p uintptr, addr int32, val int32) { /* sqlite3.c:79958:21: */ + (*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, p, addr))).Fp1 = val +} + +func Xsqlite3VdbeChangeP2(tls *libc.TLS, p uintptr, addr int32, val int32) { /* sqlite3.c:79961:21: */ + (*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, p, addr))).Fp2 = val +} + +func Xsqlite3VdbeChangeP3(tls *libc.TLS, p uintptr, addr int32, val int32) { /* sqlite3.c:79964:21: */ + (*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, p, addr))).Fp3 = val +} + +func Xsqlite3VdbeChangeP5(tls *libc.TLS, p uintptr, p5 U16) { /* sqlite3.c:79967:21: */ + + if (*Vdbe)(unsafe.Pointer(p)).FnOp > 0 { + (*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(((*Vdbe)(unsafe.Pointer(p)).FnOp-1))*24)).Fp5 = p5 + } +} + +// Change the P2 operand of instruction addr so that it points to +// the address of the next instruction to be coded. +func Xsqlite3VdbeJumpHere(tls *libc.TLS, p uintptr, addr int32) { /* sqlite3.c:79976:21: */ + Xsqlite3VdbeChangeP2(tls, p, addr, (*Vdbe)(unsafe.Pointer(p)).FnOp) +} + +// Change the P2 operand of the jump instruction at addr so that +// the jump lands on the next opcode. Or if the jump instruction was +// the previous opcode (and is thus a no-op) then simply back up +// the next instruction counter by one slot so that the jump is +// overwritten by the next inserted opcode. +// +// This routine is an optimization of sqlite3VdbeJumpHere() that +// strives to omit useless byte-code like this: +// +// 7 Once 0 8 0 +// 8 ... +func Xsqlite3VdbeJumpHereOrPopInst(tls *libc.TLS, p uintptr, addr int32) { /* sqlite3.c:79993:21: */ + if addr == ((*Vdbe)(unsafe.Pointer(p)).FnOp - 1) { + + (*Vdbe)(unsafe.Pointer(p)).FnOp-- + } else { + Xsqlite3VdbeChangeP2(tls, p, addr, (*Vdbe)(unsafe.Pointer(p)).FnOp) + } +} + +// If the input FuncDef structure is ephemeral, then free it. If +// the FuncDef is not ephermal, then do nothing. +func freeEphemeralFunction(tls *libc.TLS, db uintptr, pDef uintptr) { /* sqlite3.c:80013:13: */ + if ((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_EPHEM)) != U32(0) { + Xsqlite3DbFreeNN(tls, db, pDef) + } +} + +// Delete a P4 value if necessary. +func freeP4Mem(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:80022:29: */ + if (*Mem)(unsafe.Pointer(p)).FszMalloc != 0 { + Xsqlite3DbFree(tls, db, (*Mem)(unsafe.Pointer(p)).FzMalloc) + } + Xsqlite3DbFreeNN(tls, db, p) +} + +func freeP4FuncCtx(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:80026:29: */ + freeEphemeralFunction(tls, db, (*Sqlite3_context)(unsafe.Pointer(p)).FpFunc) + Xsqlite3DbFreeNN(tls, db, p) +} + +func freeP4(tls *libc.TLS, db uintptr, p4type int32, p4 uintptr) { /* sqlite3.c:80030:13: */ + + switch p4type { + case -16: + { + freeP4FuncCtx(tls, db, p4) + break + + } + case -13: + fallthrough + case -14: + fallthrough + case -7: + fallthrough + case -17: + fallthrough + case -15: + { + Xsqlite3DbFree(tls, db, p4) + break + + } + case -9: + { + if (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + Xsqlite3KeyInfoUnref(tls, p4) + } + break + + } + case -8: + { + freeEphemeralFunction(tls, db, p4) + break + + } + case -11: + { + if (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + Xsqlite3ValueFree(tls, p4) + } else { + freeP4Mem(tls, db, p4) + } + break + + } + case -12: + { + if (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0) { + Xsqlite3VtabUnlock(tls, p4) + } + break + + } + } +} + +// Free the space allocated for aOp and any p4 values allocated for the +// opcodes contained within. If aOp is not NULL it is assumed to contain +// nOp entries. +func vdbeFreeOpArray(tls *libc.TLS, db uintptr, aOp uintptr, nOp int32) { /* sqlite3.c:80079:13: */ + if aOp != 0 { + var pOp uintptr + for pOp = (aOp + uintptr((nOp-1))*24); pOp >= aOp; pOp -= 24 { + if int32((*Op)(unsafe.Pointer(pOp)).Fp4type) <= (-7) { + freeP4(tls, db, int32((*Op)(unsafe.Pointer(pOp)).Fp4type), *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + } + } + Xsqlite3DbFreeNN(tls, db, aOp) + } +} + +// Link the SubProgram object passed as the second argument into the linked +// list at Vdbe.pSubProgram. This list is used to delete all sub-program +// objects when the VM is no longer required. +func Xsqlite3VdbeLinkSubProgram(tls *libc.TLS, pVdbe uintptr, p uintptr) { /* sqlite3.c:80097:21: */ + (*SubProgram)(unsafe.Pointer(p)).FpNext = (*Vdbe)(unsafe.Pointer(pVdbe)).FpProgram + (*Vdbe)(unsafe.Pointer(pVdbe)).FpProgram = p +} + +// Return true if the given Vdbe has any SubPrograms. +func Xsqlite3VdbeHasSubProgram(tls *libc.TLS, pVdbe uintptr) int32 { /* sqlite3.c:80105:20: */ + return (libc.Bool32((*Vdbe)(unsafe.Pointer(pVdbe)).FpProgram != uintptr(0))) +} + +// Change the opcode at addr into OP_Noop +func Xsqlite3VdbeChangeToNoop(tls *libc.TLS, p uintptr, addr int32) int32 { /* sqlite3.c:80112:20: */ + var pOp uintptr + if (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + return 0 + } + + pOp = ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24) + freeP4(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp4type), *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(P4_NOTUSED) + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = uintptr(0) + (*VdbeOp)(unsafe.Pointer(pOp)).Fopcode = U8(OP_Noop) + return 1 +} + +// If the last opcode is "op" and it is not a jump destination, +// then remove it. Return true if and only if an opcode was removed. +func Xsqlite3VdbeDeletePriorOpcode(tls *libc.TLS, p uintptr, op U8) int32 { /* sqlite3.c:80128:20: */ + if ((*Vdbe)(unsafe.Pointer(p)).FnOp > 0) && (int32((*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp+uintptr(((*Vdbe)(unsafe.Pointer(p)).FnOp-1))*24)).Fopcode) == int32(op)) { + return Xsqlite3VdbeChangeToNoop(tls, p, ((*Vdbe)(unsafe.Pointer(p)).FnOp - 1)) + } else { + return 0 + } + return int32(0) +} + +// Change the value of the P4 operand for a specific instruction. +// This routine is useful when a large program is loaded from a +// static array using sqlite3VdbeAddOpList but we want to make a +// few minor changes to the program. +// +// If n>=0 then the P4 operand is dynamic, meaning that a copy of +// the string is made into memory obtained from sqlite3_malloc(). +// A value of n==0 means copy bytes of zP4 up to and including the +// first null byte. If n>0 then copy n+1 bytes of zP4. +// +// Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points +// to a string or structure that is guaranteed to exist for the lifetime of +// the Vdbe. In these cases we can just copy the pointer. +// +// If addr<0 then change P4 on the most recently inserted instruction. +func vdbeChangeP4Full(tls *libc.TLS, p uintptr, pOp uintptr, zP4 uintptr, n int32) { /* sqlite3.c:80188:29: */ + if (*Op)(unsafe.Pointer(pOp)).Fp4type != 0 { + freeP4(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, int32((*Op)(unsafe.Pointer(pOp)).Fp4type), *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(0) + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = uintptr(0) + } + if n < 0 { + Xsqlite3VdbeChangeP4(tls, p, (int32((int64(pOp) - int64((*Vdbe)(unsafe.Pointer(p)).FaOp)) / 24)), zP4, n) + } else { + if n == 0 { + n = Xsqlite3Strlen30(tls, zP4) + } + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = Xsqlite3DbStrNDup(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, zP4, uint64(n)) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(-7) + } +} + +func Xsqlite3VdbeChangeP4(tls *libc.TLS, p uintptr, addr int32, zP4 uintptr, n int32) { /* sqlite3.c:80207:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = zP4 + + var pOp uintptr + var db uintptr + + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + if n != (-12) { + freeP4(tls, db, n, *(*uintptr)(unsafe.Pointer(bp /* &zP4 */))) + } + return + } + + if addr < 0 { + addr = ((*Vdbe)(unsafe.Pointer(p)).FnOp - 1) + } + pOp = ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24) + if (n >= 0) || ((*Op)(unsafe.Pointer(pOp)).Fp4type != 0) { + vdbeChangeP4Full(tls, p, pOp, *(*uintptr)(unsafe.Pointer(bp /* zP4 */)), n) + return + } + if n == (-3) { + // Note: this cast is safe, because the origin data point was an int + // that was cast to a (const char *). + *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = int32(*(*uintptr)(unsafe.Pointer(bp /* zP4 */))) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(-3) + } else if *(*uintptr)(unsafe.Pointer(bp /* zP4 */)) != uintptr(0) { + + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = *(*uintptr)(unsafe.Pointer(bp /* zP4 */)) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(n) + if n == (-12) { + Xsqlite3VtabLock(tls, *(*uintptr)(unsafe.Pointer(bp /* zP4 */))) + } + } +} + +// Change the P4 operand of the most recently coded instruction +// to the value defined by the arguments. This is a high-speed +// version of sqlite3VdbeChangeP4(). +// +// The P4 operand must not have been previously defined. And the new +// P4 must not be P4_INT32. Use sqlite3VdbeChangeP4() in either of +// those cases. +func Xsqlite3VdbeAppendP4(tls *libc.TLS, p uintptr, pP4 uintptr, n int32) { /* sqlite3.c:80250:21: */ + var pOp uintptr + + if (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + freeP4(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, n, pP4) + } else { + + pOp = ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(((*Vdbe)(unsafe.Pointer(p)).FnOp-1))*24) + + (*VdbeOp)(unsafe.Pointer(pOp)).Fp4type = int8(n) + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = pP4 + } +} + +// Set the P4 on the most recently added opcode to the KeyInfo for the +// index given. +func Xsqlite3VdbeSetP4KeyInfo(tls *libc.TLS, pParse uintptr, pIdx uintptr) { /* sqlite3.c:80270:21: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var pKeyInfo uintptr + + pKeyInfo = Xsqlite3KeyInfoOfIndex(tls, pParse, pIdx) + if pKeyInfo != 0 { + Xsqlite3VdbeAppendP4(tls, v, pKeyInfo, -9) + } +} + +// Return the opcode for a given address. If the address is -1, then +// return the most recently inserted opcode. +// +// If a memory allocation error has occurred prior to the calling of this +// routine, then a pointer to a dummy VdbeOp will be returned. That opcode +// is readable but not writable, though it is cast to a writable value. +// The return of a dummy opcode allows the call to continue functioning +// after an OOM fault without having to check to see if the return from +// this routine is a valid pointer. But because the dummy.opcode is 0, +// dummy will never be written to. This is verified by code inspection and +// by running with Valgrind. +func Xsqlite3VdbeGetOp(tls *libc.TLS, p uintptr, addr int32) uintptr { /* sqlite3.c:80337:23: */ // Ignore the MSVC warning about no initializer + + if addr < 0 { + addr = ((*Vdbe)(unsafe.Pointer(p)).FnOp - 1) + } + + if (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + return uintptr(unsafe.Pointer(&dummy)) + } else { + return ((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(addr)*24) + } + return uintptr(0) +} + +var dummy VdbeOp /* sqlite3.c:80340:17: */ + +// Compute a string that describes the P4 parameter for an opcode. +// Use zTemp for any required temporary buffer space. +func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* sqlite3.c:80540:21: */ + bp := tls.Alloc(176) + defer tls.Free(176) + + var zP4 uintptr = uintptr(0) + // var x StrAccum at bp+144, 32 + + Xsqlite3StrAccumInit(tls, bp+144 /* &x */, uintptr(0), uintptr(0), 0, SQLITE_MAX_LENGTH) + switch int32((*Op)(unsafe.Pointer(pOp)).Fp4type) { + case -9: + { + var j int32 + var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4049 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { + var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(j)*8)) + var zColl uintptr + if pColl != 0 { + zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName + } else { + zColl = ts + 756 /* "" */ + } + if libc.Xstrcmp(tls, zColl, ts+319 /* "BINARY" */) == 0 { + zColl = ts + 4054 /* "B" */ + } + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4056, /* ",%s%s%s" */ + libc.VaList(bp+8, func() uintptr { + if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { + return ts + 4042 /* "-" */ + } + return ts + 756 /* "" */ + }(), + func() uintptr { + if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { + return ts + 4064 /* "N." */ + } + return ts + 756 /* "" */ + }(), + zColl)) + } + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4067 /* ")" */, 1) + break + + } + case -2: + { + var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) + break + + } + case -8: + { + var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4078 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + break + + } + case -16: + { + var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4078 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + break + + } + case -14: + { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4085 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + break + + } + case -3: + { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4090 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + break + + } + case -13: + { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+539 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + break + + } + case -11: + { + var pMem uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { + zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz + } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4085 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+539 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { + zP4 = ts + 757 /* "NULL" */ + } else { + + zP4 = ts + 4093 /* "(blob)" */ + } + break + + } + case -12: + { + var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4100 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + break + + } + case -15: + { + var i U32 + var ai uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the + // count of the number of elements to follow + for i = U32(1); i <= n; i++ { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4108 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + if i == U32(1) { + return '[' + } + return ',' + }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) + } + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4113 /* "]" */, 1) + break + + } + case -4: + { + zP4 = ts + 4115 /* "program" */ + break + + } + case -17: + fallthrough + case -5: + { + break + + } + case -6: + { + zP4 = (*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FzName + break + + } + default: + { + zP4 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + } + } + if zP4 != 0 { + Xsqlite3_str_appendall(tls, bp+144 /* &x */, zP4) + } + if (int32((*StrAccum)(unsafe.Pointer(bp+144 /* &x */)).FaccError) & SQLITE_NOMEM) != 0 { + Xsqlite3OomFault(tls, db) + } + return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) +} + +var encnames = [4]uintptr{ts + 4123 /* "?" */, ts + 4125 /* "8" */, ts + 4127 /* "16LE" */, ts + 4132 /* "16BE" */} /* sqlite3.c:80570:25 */ + +// Declare to the Vdbe that the BTree object at db->aDb[i] is used. +// +// The prepared statements need to know in advance the complete set of +// attached databases that will be use. A mask of these databases +// is maintained in p->btreeMask. The p->lockMask value is the subset of +// p->btreeMask of databases that will require a lock. +func Xsqlite3VdbeUsesBtree(tls *libc.TLS, p uintptr, i int32) { /* sqlite3.c:80665:21: */ + + *(*YDbMask)(unsafe.Pointer(p + 204 /* &.btreeMask */)) |= (YDbMask((YDbMask(1))) << (i)) + if (i != 1) && (Xsqlite3BtreeSharable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FaDb+uintptr(i)*32)).FpBt) != 0) { + *(*YDbMask)(unsafe.Pointer(p + 208 /* &.lockMask */)) |= (YDbMask((YDbMask(1))) << (i)) + } +} + +// If SQLite is compiled to support shared-cache mode and to be threadsafe, +// this routine obtains the mutex associated with each BtShared structure +// that may be accessed by the VM passed as an argument. In doing so it also +// sets the BtShared.db member of each of the BtShared structures, ensuring +// that the correct busy-handler callback is invoked if required. +// +// If SQLite is not threadsafe but does support shared-cache mode, then +// sqlite3BtreeEnter() is invoked to set the BtShared.db variables +// of all of BtShared structures accessible via the database handle +// associated with the VM. +// +// If SQLite is not threadsafe and does not support shared-cache mode, this +// function is a no-op. +// +// The p->btreeMask field is a bitmask of all btrees that the prepared +// statement p will ever use. Let N be the number of bits in p->btreeMask +// corresponding to btrees that use shared cache. Then the runtime of +// this routine is N*N. But as N is rarely more than 1, this should not +// be a problem. +func Xsqlite3VdbeEnter(tls *libc.TLS, p uintptr) { /* sqlite3.c:80696:21: */ + var i int32 + var db uintptr + var aDb uintptr + var nDb int32 + if ((*Vdbe)(unsafe.Pointer(p)).FlockMask) == YDbMask(0) { + return + } // The common case + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + aDb = (*Sqlite3)(unsafe.Pointer(db)).FaDb + nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb + for i = 0; i < nDb; i++ { + if ((i != 1) && ((((*Vdbe)(unsafe.Pointer(p)).FlockMask) & (YDbMask((YDbMask(1))) << (i))) != YDbMask(0))) && ((*Db)(unsafe.Pointer(aDb+uintptr(i)*32)).FpBt != uintptr(0)) { + Xsqlite3BtreeEnter(tls, (*Db)(unsafe.Pointer(aDb+uintptr(i)*32)).FpBt) + } + } +} + +// Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter(). +func vdbeLeave(tls *libc.TLS, p uintptr) { /* sqlite3.c:80717:29: */ + var i int32 + var db uintptr + var aDb uintptr + var nDb int32 + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + aDb = (*Sqlite3)(unsafe.Pointer(db)).FaDb + nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb + for i = 0; i < nDb; i++ { + if ((i != 1) && ((((*Vdbe)(unsafe.Pointer(p)).FlockMask) & (YDbMask((YDbMask(1))) << (i))) != YDbMask(0))) && ((*Db)(unsafe.Pointer(aDb+uintptr(i)*32)).FpBt != uintptr(0)) { + Xsqlite3BtreeLeave(tls, (*Db)(unsafe.Pointer(aDb+uintptr(i)*32)).FpBt) + } + } +} + +func Xsqlite3VdbeLeave(tls *libc.TLS, p uintptr) { /* sqlite3.c:80731:21: */ + if ((*Vdbe)(unsafe.Pointer(p)).FlockMask) == YDbMask(0) { + return + } // The common case + vdbeLeave(tls, p) +} + +// Initialize an array of N Mem element. +func initMemArray(tls *libc.TLS, p uintptr, N int32, db uintptr, flags U16) { /* sqlite3.c:80773:13: */ + for (libc.PostDecInt32(&N, 1)) > 0 { + (*Mem)(unsafe.Pointer(p)).Fdb = db + (*Mem)(unsafe.Pointer(p)).Fflags = flags + (*Mem)(unsafe.Pointer(p)).FszMalloc = 0 + p += 56 + } +} + +// Release an array of N Mem elements +func releaseMemArray(tls *libc.TLS, p uintptr, N int32) { /* sqlite3.c:80788:13: */ + if (p != 0) && (N != 0) { + var pEnd uintptr = (p + uintptr(N)*56) + var db uintptr = (*Mem)(unsafe.Pointer(p)).Fdb + if (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed != 0 { + for ok := true; ok; ok = ((libc.PreIncUintptr(&p, 56)) < pEnd) { + if (*Mem)(unsafe.Pointer(p)).FszMalloc != 0 { + Xsqlite3DbFree(tls, db, (*Mem)(unsafe.Pointer(p)).FzMalloc) + } + } + return + } + for ok1 := true; ok1; ok1 = ((libc.PreIncUintptr(&p, 56)) < pEnd) { + + // This block is really an inlined version of sqlite3VdbeMemRelease() + // that takes advantage of the fact that the memory cell value is + // being set to NULL after releasing any dynamic resources. + // + // The justification for duplicating code is that according to + // callgrind, this causes a certain test case to hit the CPU 4.7 + // percent less (x86 linux, gcc version 4.1.2, -O6) than if + // sqlite3MemRelease() were called from here. With -O2, this jumps + // to 6.6 percent. The test case is inserting 1000 rows into a table + // with no indexes using a single prepared INSERT statement, bind() + // and reset(). Inserts are grouped into a transaction. + + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { + Xsqlite3VdbeMemRelease(tls, p) + } else if (*Mem)(unsafe.Pointer(p)).FszMalloc != 0 { + Xsqlite3DbFreeNN(tls, db, (*Mem)(unsafe.Pointer(p)).FzMalloc) + (*Mem)(unsafe.Pointer(p)).FszMalloc = 0 + } + + (*Mem)(unsafe.Pointer(p)).Fflags = U16(MEM_Undefined) + } + } +} + +// This is a destructor on a Mem object (which is really an sqlite3_value) +// that deletes the Frame object that is attached to it as a blob. +// +// This routine does not delete the Frame right away. It merely adds the +// frame to a list of frames to be deleted when the Vdbe halts. +func Xsqlite3VdbeFrameMemDel(tls *libc.TLS, pArg uintptr) { /* sqlite3.c:80850:21: */ + var pFrame uintptr = pArg + + (*VdbeFrame)(unsafe.Pointer(pFrame)).FpParent = (*Vdbe)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer(pFrame)).Fv)).FpDelFrame + (*Vdbe)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer(pFrame)).Fv)).FpDelFrame = pFrame +} + +// Locate the next opcode to be displayed in EXPLAIN or EXPLAIN +// QUERY PLAN output. +// +// Return SQLITE_ROW on success. Return SQLITE_DONE if there are no +// more opcodes to be displayed. +func Xsqlite3VdbeNextOpcode(tls *libc.TLS, p uintptr, pSub uintptr, eMode int32, piPc uintptr, piAddr uintptr, paOp uintptr) int32 { /* sqlite3.c:80865:20: */ + var nRow int32 // Stop when row count reaches this + var nSub int32 = 0 // Number of sub-vdbes seen so far + var apSub uintptr = uintptr(0) // Array of sub-vdbes + var i int32 // Next instruction address + var rc int32 = SQLITE_OK // Result code + var aOp uintptr = uintptr(0) // Opcode array + var iPc int32 // Rowid. Copy of value in *piPc + + // When the number of output rows reaches nRow, that means the + // listing has finished and sqlite3_step() should return SQLITE_DONE. + // nRow is the sum of the number of rows in the main program, plus + // the sum of the number of rows in all trigger subprograms encountered + // so far. The nRow value will increase as new trigger subprograms are + // encountered, but p->pc will eventually catch up to nRow. + nRow = (*Vdbe)(unsafe.Pointer(p)).FnOp + if pSub != uintptr(0) { + if (int32((*Mem)(unsafe.Pointer(pSub)).Fflags) & MEM_Blob) != 0 { + // pSub is initiallly NULL. It is initialized to a BLOB by + // the P4_SUBPROGRAM processing logic below + nSub = (int32(uint64((*Mem)(unsafe.Pointer(pSub)).Fn) / uint64(unsafe.Sizeof(uintptr(0))))) + apSub = (*Mem)(unsafe.Pointer(pSub)).Fz + } + for i = 0; i < nSub; i++ { + nRow = nRow + ((*SubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(i)*8)))).FnOp) + } + } + iPc = *(*int32)(unsafe.Pointer(piPc)) + for 1 != 0 { // Loop exits via break + i = libc.PostIncInt32(&iPc, 1) + if i >= nRow { + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + rc = SQLITE_DONE + break + } + if i < (*Vdbe)(unsafe.Pointer(p)).FnOp { + // The rowid is small enough that we are still in the + // main program. + aOp = (*Vdbe)(unsafe.Pointer(p)).FaOp + } else { + // We are currently listing subprograms. Figure out which one and + // pick up the appropriate opcode. + var j int32 + i = i - ((*Vdbe)(unsafe.Pointer(p)).FnOp) + + for j = 0; i >= (*SubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp; j++ { + i = i - ((*SubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FnOp) + + } + aOp = (*SubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)))).FaOp + } + + // When an OP_Program opcode is encounter (the only opcode that has + // a P4_SUBPROGRAM argument), expand the size of the array of subprograms + // kept in p->aMem[9].z to hold the new program - assuming this subprogram + // has not already been seen. + if (pSub != uintptr(0)) && (int32((*Op)(unsafe.Pointer(aOp+uintptr(i)*24)).Fp4type) == (-4)) { + var nByte int32 = (int32((uint64(nSub + 1)) * uint64(unsafe.Sizeof(uintptr(0))))) + var j int32 + for j = 0; j < nSub; j++ { + if *(*uintptr)(unsafe.Pointer(apSub + uintptr(j)*8)) == *(*uintptr)(unsafe.Pointer(aOp + uintptr(i)*24 + 16 /* &.p4 */)) { + break + } + } + if j == nSub { + (*Vdbe)(unsafe.Pointer(p)).Frc = Xsqlite3VdbeMemGrow(tls, pSub, nByte, (libc.Bool32(nSub != 0))) + if (*Vdbe)(unsafe.Pointer(p)).Frc != SQLITE_OK { + rc = SQLITE_ERROR + break + } + apSub = (*Mem)(unsafe.Pointer(pSub)).Fz + *(*uintptr)(unsafe.Pointer(apSub + uintptr(libc.PostIncInt32(&nSub, 1))*8)) = *(*uintptr)(unsafe.Pointer(aOp + uintptr(i)*24 + 16 /* &.p4 */)) + (*Mem)(unsafe.Pointer(pSub)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pSub))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Blob)) + (*Mem)(unsafe.Pointer(pSub)).Fn = (int32(uint64(nSub) * uint64(unsafe.Sizeof(uintptr(0))))) + nRow = nRow + ((*SubProgram)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aOp + uintptr(i)*24 + 16 /* &.p4 */)))).FnOp) + } + } + if eMode == 0 { + break + } + { + + if int32((*Op)(unsafe.Pointer(aOp+uintptr(i)*24)).Fopcode) == OP_Explain { + break + } + if (int32((*Op)(unsafe.Pointer(aOp+uintptr(i)*24)).Fopcode) == OP_Init) && (iPc > 1) { + break + } + + } + } + *(*int32)(unsafe.Pointer(piPc)) = iPc + *(*int32)(unsafe.Pointer(piAddr)) = i + *(*uintptr)(unsafe.Pointer(paOp)) = aOp + return rc +} + +// Delete a VdbeFrame object and its contents. VdbeFrame objects are +// allocated by the OP_Program opcode in sqlite3VdbeExec(). +func Xsqlite3VdbeFrameDelete(tls *libc.TLS, p uintptr) { /* sqlite3.c:80977:21: */ + var i int32 + var aMem uintptr = ((p) + 112) + var apCsr uintptr = (aMem + uintptr((*VdbeFrame)(unsafe.Pointer(p)).FnChildMem)*56) + + for i = 0; i < (*VdbeFrame)(unsafe.Pointer(p)).FnChildCsr; i++ { + Xsqlite3VdbeFreeCursor(tls, (*VdbeFrame)(unsafe.Pointer(p)).Fv, *(*uintptr)(unsafe.Pointer(apCsr + uintptr(i)*8))) + } + releaseMemArray(tls, aMem, (*VdbeFrame)(unsafe.Pointer(p)).FnChildMem) + Xsqlite3VdbeDeleteAuxData(tls, (*Vdbe)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer(p)).Fv)).Fdb, (p + 72 /* &.pAuxData */), -1, 0) + Xsqlite3DbFree(tls, (*Vdbe)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer(p)).Fv)).Fdb, p) +} + +// Give a listing of the program in the virtual machine. +// +// The interface is the same as sqlite3VdbeExec(). But instead of +// running the code, it invokes the callback once for each instruction. +// This feature is used to implement "EXPLAIN". +// +// When p->explain==1, each instruction is listed. When +// p->explain==2, only OP_Explain instructions are listed and these +// are shown in a different format. p->explain==2 is used to implement +// EXPLAIN QUERY PLAN. +// 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers +// are also shown, so that the boundaries between the main program and +// each trigger are clear. +// +// When p->explain==1, first the main program is listed, then each of +// the trigger subprograms are listed one by one. +func Xsqlite3VdbeList(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:81009:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pSub uintptr = uintptr(0) // Memory cell hold array of subprogs + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb // The database connection + // var i int32 at bp, 4 + // Loop counter + var rc int32 = SQLITE_OK // Return code + var pMem uintptr = ((*Vdbe)(unsafe.Pointer(p)).FaMem + 1*56) // First Mem of result set + var bListSubprogs int32 = (libc.Bool32(((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.explain */)) & 0xc >> 2)) == 1) || (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TriggerEQP)) != uint64(0)))) + // var aOp uintptr at bp+8, 8 + // Array of opcodes + var pOp uintptr // Current opcode + + // Even though this opcode does not use dynamic strings for + // the result, result columns may become dynamic if the user calls + // sqlite3_column_text16(), causing a translation to UTF-16 encoding. + releaseMemArray(tls, pMem, 8) + (*Vdbe)(unsafe.Pointer(p)).FpResultSet = uintptr(0) + + if (*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_NOMEM { + // This happens if a malloc() inside a call to sqlite3_column_text() or + // sqlite3_column_text16() failed. + Xsqlite3OomFault(tls, db) + return SQLITE_ERROR + } + + if bListSubprogs != 0 { + // The first 8 memory cells are used for the result set. So we will + // commandeer the 9th cell to use as storage for an array of pointers + // to trigger subprograms. The VDBE is guaranteed to have at least 9 + // cells. + + pSub = ((*Vdbe)(unsafe.Pointer(p)).FaMem + 9*56) + } else { + pSub = uintptr(0) + } + + // Figure out which opcode is next to display + rc = Xsqlite3VdbeNextOpcode(tls, p, pSub, (libc.Bool32((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.explain */)) & 0xc >> 2)) == 2)), (p + 52 /* &.pc */), bp /* &i */, bp+8 /* &aOp */) + + if rc == SQLITE_OK { + pOp = (*(*uintptr)(unsafe.Pointer(bp + 8 /* aOp */)) + uintptr(*(*int32)(unsafe.Pointer(bp /* i */)))*24) + if libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_INTERRUPT + rc = SQLITE_ERROR + Xsqlite3VdbeError(tls, p, Xsqlite3ErrStr(tls, (*Vdbe)(unsafe.Pointer(p)).Frc), 0) + } else { + var zP4 uintptr = Xsqlite3VdbeDisplayP4(tls, db, pOp) + if (int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.explain */)) & 0xc >> 2)) == 2 { + Xsqlite3VdbeMemSetInt64(tls, pMem, int64((*Op)(unsafe.Pointer(pOp)).Fp1)) + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(1)*56), int64((*Op)(unsafe.Pointer(pOp)).Fp2)) + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(2)*56), int64((*Op)(unsafe.Pointer(pOp)).Fp3)) + Xsqlite3VdbeMemSetStr(tls, (pMem + uintptr(3)*56), zP4, int64(-1), uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + (*Vdbe)(unsafe.Pointer(p)).FnResColumn = U16(4) + } else { + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(0)*56), int64(*(*int32)(unsafe.Pointer(bp /* i */)))) + Xsqlite3VdbeMemSetStr(tls, (pMem + uintptr(1)*56), Xsqlite3OpcodeName(tls, int32((*Op)(unsafe.Pointer(pOp)).Fopcode)), + int64(-1), uint8(SQLITE_UTF8), uintptr(0)) + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(2)*56), int64((*Op)(unsafe.Pointer(pOp)).Fp1)) + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(3)*56), int64((*Op)(unsafe.Pointer(pOp)).Fp2)) + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(4)*56), int64((*Op)(unsafe.Pointer(pOp)).Fp3)) + // pMem+5 for p4 is done last + Xsqlite3VdbeMemSetInt64(tls, (pMem + uintptr(6)*56), int64((*Op)(unsafe.Pointer(pOp)).Fp5)) + Xsqlite3VdbeMemSetNull(tls, (pMem + uintptr(7)*56)) + Xsqlite3VdbeMemSetStr(tls, (pMem + uintptr(5)*56), zP4, int64(-1), uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + (*Vdbe)(unsafe.Pointer(p)).FnResColumn = U16(8) + } + (*Vdbe)(unsafe.Pointer(p)).FpResultSet = pMem + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + rc = SQLITE_ERROR + } else { + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + rc = SQLITE_ROW + } + } + } + return rc +} + +// An instance of this object describes bulk memory available for use +// by subcomponents of a prepared statement. Space is allocated out +// of a ReusableSpace object by the allocSpace() routine below. +type ReusableSpace = struct { + FpSpace uintptr + FnFree Sqlite3_int64 + FnNeeded Sqlite3_int64 +} /* sqlite3.c:81154:1 */ + +// Try to allocate nByte bytes of 8-byte aligned bulk memory for pBuf +// from the ReusableSpace object. Return a pointer to the allocated +// memory on success. If insufficient memory is available in the +// ReusableSpace object, increase the ReusableSpace.nNeeded +// value by the amount needed and return NULL. +// +// If pBuf is not initially NULL, that means that the memory has already +// been allocated by a prior call to this routine, so just return a copy +// of pBuf and leave ReusableSpace unchanged. +// +// This allocator is employed to repurpose unused slots at the end of the +// opcode array of prepared state for other memory needs of the prepared +// statement. +func allocSpace(tls *libc.TLS, p uintptr, pBuf uintptr, nByte Sqlite3_int64) uintptr { /* sqlite3.c:81174:13: */ + + if pBuf == uintptr(0) { + nByte = (((nByte) + int64(7)) & int64(libc.CplInt32(7))) + if nByte <= (*ReusableSpace)(unsafe.Pointer(p)).FnFree { + *(*Sqlite3_int64)(unsafe.Pointer(p + 8 /* &.nFree */)) -= (nByte) + pBuf = ((*ReusableSpace)(unsafe.Pointer(p)).FpSpace + uintptr((*ReusableSpace)(unsafe.Pointer(p)).FnFree)) + } else { + *(*Sqlite3_int64)(unsafe.Pointer(p + 16 /* &.nNeeded */)) += (nByte) + } + } + + return pBuf +} + +// Rewind the VDBE back to the beginning in preparation for +// running it. +func Xsqlite3VdbeRewind(tls *libc.TLS, p uintptr) { /* sqlite3.c:81197:21: */ + + // There should be at least one opcode. + + // Set the magic to VDBE_MAGIC_RUN sooner rather than later. + (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic = U32(VDBE_MAGIC_RUN) + + (*Vdbe)(unsafe.Pointer(p)).Fpc = -1 + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + (*Vdbe)(unsafe.Pointer(p)).FcacheCtr = U32(1) + (*Vdbe)(unsafe.Pointer(p)).FminWriteFileFormat = U8(255) + (*Vdbe)(unsafe.Pointer(p)).FiStatement = 0 + (*Vdbe)(unsafe.Pointer(p)).FnFkConstraint = int64(0) +} + +// Prepare a virtual machine for execution for the first time after +// creating the virtual machine. This involves things such +// as allocating registers and initializing the program counter. +// After the VDBE has be prepped, it can be executed by one or more +// calls to sqlite3VdbeExec(). +// +// This function may be called exactly once on each virtual machine. +// After this routine is called the VM has been "packaged" and is ready +// to run. After this routine is called, further calls to +// sqlite3VdbeAddOp() functions are prohibited. This routine disconnects +// the Vdbe from the Parse object that helped generate it so that the +// the Vdbe becomes an independent entity and the Parse object can be +// destroyed. +// +// Use the sqlite3VdbeRewind() procedure to restore a virtual machine back +// to its initial state after it has been run. +func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite3.c:81250:21: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var db uintptr // The database connection + var nVar int32 // Number of parameters + var nMem int32 // Number of VM memory registers + var nCursor int32 // Number of cursors required + // var nArg int32 at bp, 4 + // Number of arguments in subprograms + var n int32 // Loop counter + // var x ReusableSpace at bp+8, 24 + // Reusable bulk memory + + (*Vdbe)(unsafe.Pointer(p)).FpVList = (*Parse)(unsafe.Pointer(pParse)).FpVList + (*Parse)(unsafe.Pointer(pParse)).FpVList = uintptr(0) + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + + nVar = int32((*Parse)(unsafe.Pointer(pParse)).FnVar) + nMem = (*Parse)(unsafe.Pointer(pParse)).FnMem + nCursor = (*Parse)(unsafe.Pointer(pParse)).FnTab + *(*int32)(unsafe.Pointer(bp /* nArg */)) = (*Parse)(unsafe.Pointer(pParse)).FnMaxArg + + // Each cursor uses a memory cell. The first cursor (cursor 0) can + // use aMem[0] which is not otherwise used by the VDBE program. Allocate + // space at the end of aMem[] for cursors 1 and greater. + // See also: allocateCursor(). + nMem = nMem + (nCursor) + if (nCursor == 0) && (nMem > 0) { + nMem++ + } // Space for aMem[0] even if not used + + // Figure out how much reusable memory is available at the end of the + // opcode array. This extra memory will be reallocated for other elements + // of the prepared statement. + n = (int32(((uint64(unsafe.Sizeof(Op{})) * uint64((*Vdbe)(unsafe.Pointer(p)).FnOp)) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) // Bytes of opcode memory used + (*ReusableSpace)(unsafe.Pointer(bp + 8 /* &x */)).FpSpace = (((*Vdbe)(unsafe.Pointer(p)).FaOp) + uintptr(n)) // Unused opcode memory + + (*ReusableSpace)(unsafe.Pointer(bp + 8 /* &x */)).FnFree = (Sqlite3_int64(((*Parse)(unsafe.Pointer(pParse)).FszOpAlloc - n) & libc.CplInt32(7))) // Bytes of unused memory + + resolveP2Values(tls, p, bp /* &nArg */) + libc.SetBitFieldPtr16Uint32(p+200 /* &.usesStmtJournal */, Bft((U8(libc.Bool32(((*Parse)(unsafe.Pointer(pParse)).FisMultiWrite != 0) && ((*Parse)(unsafe.Pointer(pParse)).FmayAbort != 0))))), 6, 0x40) + if (*Parse)(unsafe.Pointer(pParse)).Fexplain != 0 { + var iFirst int32 + var mx int32 + var i int32 + if nMem < 10 { + nMem = 10 + } + libc.SetBitFieldPtr16Uint32(p+200 /* &.explain */, Bft((*Parse)(unsafe.Pointer(pParse)).Fexplain), 2, 0xc) + if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { + Xsqlite3VdbeSetNumCols(tls, p, 4) + iFirst = 8 + mx = 12 + } else { + Xsqlite3VdbeSetNumCols(tls, p, 8) + iFirst = 0 + mx = 8 + } + for i = iFirst; i < mx; i++ { + Xsqlite3VdbeSetColName(tls, p, (i - iFirst), COLNAME_NAME, + azColName[i], uintptr(0)) + } + } + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(0), 0, 0x3) + + // Memory for registers, parameters, cursor, etc, is allocated in one or two + // passes. On the first pass, we try to reuse unused memory at the + // end of the opcode array. If we are unable to satisfy all memory + // requirements by reusing the opcode array tail, then the second + // pass will fill in the remainder using a fresh memory allocation. + // + // This two-pass approach that reuses as much memory as possible from + // the leftover memory at the end of the opcode array. This can significantly + // reduce the amount of memory held by a prepared statement. + (*ReusableSpace)(unsafe.Pointer(bp + 8 /* &x */)).FnNeeded = int64(0) + (*Vdbe)(unsafe.Pointer(p)).FaMem = allocSpace(tls, bp+8 /* &x */, uintptr(0), (int64(uint64(nMem) * uint64(unsafe.Sizeof(Mem{}))))) + (*Vdbe)(unsafe.Pointer(p)).FaVar = allocSpace(tls, bp+8 /* &x */, uintptr(0), (int64(uint64(nVar) * uint64(unsafe.Sizeof(Mem{}))))) + (*Vdbe)(unsafe.Pointer(p)).FapArg = allocSpace(tls, bp+8 /* &x */, uintptr(0), (int64(uint64(*(*int32)(unsafe.Pointer(bp /* nArg */))) * uint64(unsafe.Sizeof(uintptr(0)))))) + (*Vdbe)(unsafe.Pointer(p)).FapCsr = allocSpace(tls, bp+8 /* &x */, uintptr(0), (int64(uint64(nCursor) * uint64(unsafe.Sizeof(uintptr(0)))))) + if (*ReusableSpace)(unsafe.Pointer(bp+8 /* &x */)).FnNeeded != 0 { + (*ReusableSpace)(unsafe.Pointer(bp + 8 /* &x */)).FpSpace = libc.AssignPtrUintptr(p+248 /* &.pFree */, Xsqlite3DbMallocRawNN(tls, db, uint64((*ReusableSpace)(unsafe.Pointer(bp+8 /* &x */)).FnNeeded))) + (*ReusableSpace)(unsafe.Pointer(bp + 8 /* &x */)).FnFree = (*ReusableSpace)(unsafe.Pointer(bp + 8 /* &x */)).FnNeeded + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + (*Vdbe)(unsafe.Pointer(p)).FaMem = allocSpace(tls, bp+8 /* &x */, (*Vdbe)(unsafe.Pointer(p)).FaMem, (int64(uint64(nMem) * uint64(unsafe.Sizeof(Mem{}))))) + (*Vdbe)(unsafe.Pointer(p)).FaVar = allocSpace(tls, bp+8 /* &x */, (*Vdbe)(unsafe.Pointer(p)).FaVar, (int64(uint64(nVar) * uint64(unsafe.Sizeof(Mem{}))))) + (*Vdbe)(unsafe.Pointer(p)).FapArg = allocSpace(tls, bp+8 /* &x */, (*Vdbe)(unsafe.Pointer(p)).FapArg, (int64(uint64(*(*int32)(unsafe.Pointer(bp /* nArg */))) * uint64(unsafe.Sizeof(uintptr(0)))))) + (*Vdbe)(unsafe.Pointer(p)).FapCsr = allocSpace(tls, bp+8 /* &x */, (*Vdbe)(unsafe.Pointer(p)).FapCsr, (int64(uint64(nCursor) * uint64(unsafe.Sizeof(uintptr(0)))))) + } + } + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*Vdbe)(unsafe.Pointer(p)).FnVar = int16(0) + (*Vdbe)(unsafe.Pointer(p)).FnCursor = 0 + (*Vdbe)(unsafe.Pointer(p)).FnMem = 0 + } else { + (*Vdbe)(unsafe.Pointer(p)).FnCursor = nCursor + (*Vdbe)(unsafe.Pointer(p)).FnVar = YnVar(nVar) + initMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaVar, nVar, db, uint16(MEM_Null)) + (*Vdbe)(unsafe.Pointer(p)).FnMem = nMem + initMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaMem, nMem, db, uint16(MEM_Undefined)) + libc.Xmemset(tls, (*Vdbe)(unsafe.Pointer(p)).FapCsr, 0, (uint64(nCursor) * uint64(unsafe.Sizeof(uintptr(0))))) + } + Xsqlite3VdbeRewind(tls, p) +} + +var azColName = [12]uintptr{ + ts + 4137 /* "addr" */, ts + 4142 /* "opcode" */, ts + 4149 /* "p1" */, ts + 4152 /* "p2" */, ts + 4155 /* "p3" */, ts + 4158 /* "p4" */, ts + 4161 /* "p5" */, ts + 4164, /* "comment" */ + ts + 4172 /* "id" */, ts + 4175 /* "parent" */, ts + 4182 /* "notused" */, ts + 4190, /* "detail" */ +} /* sqlite3.c:81298:23 */ + +// Close a VDBE cursor and release all the resources that cursor +// happens to hold. +func Xsqlite3VdbeFreeCursor(tls *libc.TLS, p uintptr, pCx uintptr) { /* sqlite3.c:81375:21: */ + if pCx == uintptr(0) { + return + } + + switch int32((*VdbeCursor)(unsafe.Pointer(pCx)).FeCurType) { + case CURTYPE_SORTER: + { + Xsqlite3VdbeSorterClose(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, pCx) + break + + } + case CURTYPE_BTREE: + { + + Xsqlite3BtreeCloseCursor(tls, *(*uintptr)(unsafe.Pointer(pCx + 56 /* &.uc */))) + break + + } + case CURTYPE_VTAB: + { + var pVCur uintptr = *(*uintptr)(unsafe.Pointer(pCx + 56 /* &.uc */)) + var pModule uintptr = (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pVCur)).FpVtab)).FpModule + + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pVCur)).FpVtab)).FnRef-- + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule + 56 /* &.xClose */))))(tls, pVCur) + break + + } + } +} + +// Close all cursors in the current frame. +func closeCursorsInFrame(tls *libc.TLS, p uintptr) { /* sqlite3.c:81407:13: */ + if (*Vdbe)(unsafe.Pointer(p)).FapCsr != 0 { + var i int32 + for i = 0; i < (*Vdbe)(unsafe.Pointer(p)).FnCursor; i++ { + var pC uintptr = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr(i)*8)) + if pC != 0 { + Xsqlite3VdbeFreeCursor(tls, p, pC) + *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr(i)*8)) = uintptr(0) + } + } + } +} + +// Copy the values stored in the VdbeFrame structure to its Vdbe. This +// is used, for example, when a trigger sub-program is halted to restore +// control to the main program. +func Xsqlite3VdbeFrameRestore(tls *libc.TLS, pFrame uintptr) int32 { /* sqlite3.c:81425:20: */ + var v uintptr = (*VdbeFrame)(unsafe.Pointer(pFrame)).Fv + closeCursorsInFrame(tls, v) + (*Vdbe)(unsafe.Pointer(v)).FaOp = (*VdbeFrame)(unsafe.Pointer(pFrame)).FaOp + (*Vdbe)(unsafe.Pointer(v)).FnOp = (*VdbeFrame)(unsafe.Pointer(pFrame)).FnOp + (*Vdbe)(unsafe.Pointer(v)).FaMem = (*VdbeFrame)(unsafe.Pointer(pFrame)).FaMem + (*Vdbe)(unsafe.Pointer(v)).FnMem = (*VdbeFrame)(unsafe.Pointer(pFrame)).FnMem + (*Vdbe)(unsafe.Pointer(v)).FapCsr = (*VdbeFrame)(unsafe.Pointer(pFrame)).FapCsr + (*Vdbe)(unsafe.Pointer(v)).FnCursor = (*VdbeFrame)(unsafe.Pointer(pFrame)).FnCursor + (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).Fdb)).FlastRowid = (*VdbeFrame)(unsafe.Pointer(pFrame)).FlastRowid + (*Vdbe)(unsafe.Pointer(v)).FnChange = (*VdbeFrame)(unsafe.Pointer(pFrame)).FnChange + (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).Fdb)).FnChange = (*VdbeFrame)(unsafe.Pointer(pFrame)).FnDbChange + Xsqlite3VdbeDeleteAuxData(tls, (*Vdbe)(unsafe.Pointer(v)).Fdb, (v + 288 /* &.pAuxData */), -1, 0) + (*Vdbe)(unsafe.Pointer(v)).FpAuxData = (*VdbeFrame)(unsafe.Pointer(pFrame)).FpAuxData + (*VdbeFrame)(unsafe.Pointer(pFrame)).FpAuxData = uintptr(0) + return (*VdbeFrame)(unsafe.Pointer(pFrame)).Fpc +} + +// Close all cursors. +// +// Also release any dynamic memory held by the VM in the Vdbe.aMem memory +// cell array. This is necessary as the memory cell array may contain +// pointers to VdbeFrame objects, which may in turn contain pointers to +// open cursors. +func closeAllCursors(tls *libc.TLS, p uintptr) { /* sqlite3.c:81454:13: */ + if (*Vdbe)(unsafe.Pointer(p)).FpFrame != 0 { + var pFrame uintptr + for pFrame = (*Vdbe)(unsafe.Pointer(p)).FpFrame; (*VdbeFrame)(unsafe.Pointer(pFrame)).FpParent != 0; pFrame = (*VdbeFrame)(unsafe.Pointer(pFrame)).FpParent { + } + Xsqlite3VdbeFrameRestore(tls, pFrame) + (*Vdbe)(unsafe.Pointer(p)).FpFrame = uintptr(0) + (*Vdbe)(unsafe.Pointer(p)).FnFrame = 0 + } + + closeCursorsInFrame(tls, p) + if (*Vdbe)(unsafe.Pointer(p)).FaMem != 0 { + releaseMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaMem, (*Vdbe)(unsafe.Pointer(p)).FnMem) + } + for (*Vdbe)(unsafe.Pointer(p)).FpDelFrame != 0 { + var pDel uintptr = (*Vdbe)(unsafe.Pointer(p)).FpDelFrame + (*Vdbe)(unsafe.Pointer(p)).FpDelFrame = (*VdbeFrame)(unsafe.Pointer(pDel)).FpParent + Xsqlite3VdbeFrameDelete(tls, pDel) + } + + // Delete any auxdata allocations made by the VM + if (*Vdbe)(unsafe.Pointer(p)).FpAuxData != 0 { + Xsqlite3VdbeDeleteAuxData(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, (p + 288 /* &.pAuxData */), -1, 0) + } + +} + +// Set the number of result columns that will be returned by this SQL +// statement. This is now set at compile time, rather than during +// execution of the vdbe program so that sqlite3_column_count() can +// be called on an SQL statement before sqlite3_step(). +func Xsqlite3VdbeSetNumCols(tls *libc.TLS, p uintptr, nResColumn int32) { /* sqlite3.c:81484:21: */ + var n int32 + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb + + if (*Vdbe)(unsafe.Pointer(p)).FnResColumn != 0 { + releaseMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaColName, (int32((*Vdbe)(unsafe.Pointer(p)).FnResColumn) * COLNAME_N)) + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FaColName) + } + n = (nResColumn * COLNAME_N) + (*Vdbe)(unsafe.Pointer(p)).FnResColumn = U16(nResColumn) + (*Vdbe)(unsafe.Pointer(p)).FaColName = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(Mem{})) * uint64(n)))) + if (*Vdbe)(unsafe.Pointer(p)).FaColName == uintptr(0) { + return + } + initMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaColName, n, db, uint16(MEM_Null)) +} + +// Set the name of the idx'th column to be returned by the SQL statement. +// zName must be a pointer to a nul terminated string. +// +// This call must be made after a call to sqlite3VdbeSetNumCols(). +// +// The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC +// or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed +// to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed. +func Xsqlite3VdbeSetColName(tls *libc.TLS, p uintptr, idx int32, var1 int32, zName uintptr, xDel uintptr) int32 { /* sqlite3.c:81509:20: */ + var rc int32 + var pColName uintptr + + if (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FmallocFailed != 0 { + + return SQLITE_NOMEM + } + + pColName = ((*Vdbe)(unsafe.Pointer(p)).FaColName + uintptr((idx+(var1*int32((*Vdbe)(unsafe.Pointer(p)).FnResColumn))))*56) + rc = Xsqlite3VdbeMemSetStr(tls, pColName, zName, int64(-1), uint8(SQLITE_UTF8), xDel) + + return rc +} + +// A read or write transaction may or may not be active on database handle +// db. If a transaction is active, commit it. If there is a +// write-transaction spanning more than one database file, this routine +// takes care of the super-journal trickery. +func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var i int32 + var nTrans int32 = 0 // Number of databases with an active write-transaction + // that are candidates for a two-phase commit using a + // super-journal + var rc int32 = SQLITE_OK + var needXcommit int32 = 0 + + // Before doing anything else, call the xSync() callback for any + // virtual module tables written in this transaction. This has to + // be done before determining whether a super-journal file is + // required, as an xSync() callback may add an attached database + // to the transaction. + rc = Xsqlite3VtabSync(tls, db, p) + + // This loop determines (a) if the commit hook should be invoked and + // (b) how many database files have open write transactions, not + // including the temp database. (b) is important because if more than + // one database file has an open write transaction, a super-journal + // file is required for an atomic commit. + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if Xsqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_WRITE { + var pPager uintptr // Pager associated with pBt + needXcommit = 1 + Xsqlite3BtreeEnter(tls, pBt) + pPager = Xsqlite3BtreePager(tls, pBt) + if ((int32((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).Fsafety_level) != PAGER_SYNCHRONOUS_OFF) && + (aMJNeeded[Xsqlite3PagerGetJournalMode(tls, pPager)] != 0)) && + (Xsqlite3PagerIsMemdb(tls, pPager) == 0) { + + nTrans++ + } + rc = Xsqlite3PagerExclusiveLock(tls, pPager) + Xsqlite3BtreeLeave(tls, pBt) + } + } + if rc != SQLITE_OK { + return rc + } + + // If there are any write-transactions at all, invoke the commit hook + if (needXcommit != 0) && ((*Sqlite3)(unsafe.Pointer(db)).FxCommitCallback != 0) { + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((db + 280 /* &.xCommitCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpCommitArg) + if rc != 0 { + return (SQLITE_CONSTRAINT | (int32(2) << 8)) + } + } + + // The simple case - no more than one database file (not counting the + // TEMP database) has a transaction active. There is no need for the + // super-journal. + // + // If the return value of sqlite3BtreeGetFilename() is a zero length + // string, it means the main database is :memory: or a temp file. In + // that case we do not support atomic multi-file commits, so use the + // simple case then too. + if (0 == Xsqlite3Strlen30(tls, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt))) || + (nTrans <= 1) { + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + rc = Xsqlite3BtreeCommitPhaseOne(tls, pBt, uintptr(0)) + } + } + + // Do the commit only if all databases successfully complete phase 1. + // If one of the BtreeCommitPhaseOne() calls fails, this indicates an + // IO error while deleting or truncating a journal file. It is unlikely, + // but could happen. In this case abandon processing and return the error. + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + rc = Xsqlite3BtreeCommitPhaseTwo(tls, pBt, 0) + } + } + if rc == SQLITE_OK { + Xsqlite3VtabCommit(tls, db) + } + } else { + var pVfs uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpVfs + var zSuper uintptr = uintptr(0) // File-name for the super-journal + var zMainFile uintptr = Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)) = uintptr(0) + var offset I64 = int64(0) + // var res int32 at bp+60, 4 + + var retryCount int32 = 0 + var nMainFile int32 + + // Select a super-journal file name + nMainFile = Xsqlite3Strlen30(tls, zMainFile) + zSuper = Xsqlite3MPrintf(tls, db, ts+4197 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + if zSuper == uintptr(0) { + return SQLITE_NOMEM + } + zSuper += uintptr(4) + for ok := true; ok; ok = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 60 /* res */)) != 0)) { + // var iRandom U32 at bp+56, 4 + + if retryCount != 0 { + if retryCount > 100 { + Xsqlite3_log(tls, SQLITE_FULL, ts+4209 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3OsDelete(tls, pVfs, zSuper, 0) + break + } else if retryCount == 1 { + Xsqlite3_log(tls, SQLITE_FULL, ts+4223 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + } + } + retryCount++ + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4238, /* "-mj%06X9%02X" */ + libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) + // The antipenultimate character of the super-journal name must + // be "9" to avoid name collisions when using 8+3 filenames. + + rc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+60 /* &res */) + } + if rc == SQLITE_OK { + // Open the super-journal. + rc = Xsqlite3OsOpenMalloc(tls, pVfs, zSuper, bp+64, /* &pSuperJrnl */ + (((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_SUPER_JOURNAL), uintptr(0)) + } + if rc != SQLITE_OK { + Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) + return rc + } + + // Write the name of each database file in the transaction into the new + // super-journal file. If an error occurs at this point close + // and delete the super-journal file. All the individual journal files + // still have 'null' as the super-journal pointer, so they will roll + // back independently if a failure occurs. + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if Xsqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_WRITE { + var zFile uintptr = Xsqlite3BtreeGetJournalname(tls, pBt) + if zFile == uintptr(0) { + continue // Ignore TEMP and :memory: databases + } + + rc = Xsqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)), zFile, (Xsqlite3Strlen30(tls, zFile) + 1), offset) + offset = offset + (I64(Xsqlite3Strlen30(tls, zFile) + 1)) + if rc != SQLITE_OK { + Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) + Xsqlite3OsDelete(tls, pVfs, zSuper, 0) + Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) + return rc + } + } + } + + // Sync the super-journal file. If the IOCAP_SEQUENTIAL device + // flag is set this is not required. + if (0 == (Xsqlite3OsDeviceCharacteristics(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) & SQLITE_IOCAP_SEQUENTIAL)) && + (SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsSync(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)), SQLITE_SYNC_NORMAL)))) { + Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) + Xsqlite3OsDelete(tls, pVfs, zSuper, 0) + Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) + return rc + } + + // Sync all the db files involved in the transaction. The same call + // sets the super-journal pointer in each individual journal. If + // an error occurs here, do not delete the super-journal file. + // + // If the error occurs during the first call to + // sqlite3BtreeCommitPhaseOne(), then there is a chance that the + // super-journal file will be orphaned. But we cannot delete it, + // in case the super-journal file name was written into the journal + // file before the failure occurred. + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + rc = Xsqlite3BtreeCommitPhaseOne(tls, pBt, zSuper) + } + } + Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) + + if rc != SQLITE_OK { + Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) + return rc + } + + // Delete the super-journal file. This commits the transaction. After + // doing this the directory is synced again before any individual + // transaction files are deleted. + rc = Xsqlite3OsDelete(tls, pVfs, zSuper, 1) + Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) + zSuper = uintptr(0) + if rc != 0 { + return rc + } + + // All files and directories have already been synced, so the following + // calls to sqlite3BtreeCommitPhaseTwo() are only closing files and + // deleting or truncating journals. If something goes wrong while + // this is happening we don't really care. The integrity of the + // transaction is already guaranteed, but some stray 'cold' journals + // may be lying around. Returning an error code won't help matters. + + Xsqlite3BeginBenignMalloc(tls) + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + Xsqlite3BtreeCommitPhaseTwo(tls, pBt, 1) + } + } + Xsqlite3EndBenignMalloc(tls) + + Xsqlite3VtabCommit(tls, db) + } + + return rc +} + +var aMJNeeded = [6]U8{ + /* DELETE */ U8(1), + /* PERSIST */ U8(1), + /* OFF */ U8(0), + /* TRUNCATE */ U8(1), + /* MEMORY */ U8(0), + /* WAL */ U8(0), +} /* sqlite3.c:81572:23 */ + +// This routine checks that the sqlite3.nVdbeActive count variable +// matches the number of vdbe's in the list sqlite3.pVdbe that are +// currently active. An assertion fails if the two counts do not match. +// This is an internal self-check only - it is not an essential processing +// step. +// +// This is a no-op if NDEBUG is defined. + +// If the Vdbe passed as the first argument opened a statement-transaction, +// close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or +// SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement +// transaction is rolled back. If eOp is SAVEPOINT_RELEASE, then the +// statement transaction is committed. +// +// If an IO error occurs, an SQLITE_IOERR_XXX error code is returned. +// Otherwise SQLITE_OK. +func vdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) int32 { /* sqlite3.c:81833:28: */ + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb + var rc int32 = SQLITE_OK + var i int32 + var iSavepoint int32 = ((*Vdbe)(unsafe.Pointer(p)).FiStatement - 1) + + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var rc2 int32 = SQLITE_OK + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + if eOp == SAVEPOINT_ROLLBACK { + rc2 = Xsqlite3BtreeSavepoint(tls, pBt, SAVEPOINT_ROLLBACK, iSavepoint) + } + if rc2 == SQLITE_OK { + rc2 = Xsqlite3BtreeSavepoint(tls, pBt, SAVEPOINT_RELEASE, iSavepoint) + } + if rc == SQLITE_OK { + rc = rc2 + } + } + } + (*Sqlite3)(unsafe.Pointer(db)).FnStatement-- + (*Vdbe)(unsafe.Pointer(p)).FiStatement = 0 + + if rc == SQLITE_OK { + if eOp == SAVEPOINT_ROLLBACK { + rc = Xsqlite3VtabSavepoint(tls, db, SAVEPOINT_ROLLBACK, iSavepoint) + } + if rc == SQLITE_OK { + rc = Xsqlite3VtabSavepoint(tls, db, SAVEPOINT_RELEASE, iSavepoint) + } + } + + // If the statement transaction is being rolled back, also restore the + // database handles deferred constraint counter to the value it had when + // the statement transaction was opened. + if eOp == SAVEPOINT_ROLLBACK { + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons = (*Vdbe)(unsafe.Pointer(p)).FnStmtDefCons + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = (*Vdbe)(unsafe.Pointer(p)).FnStmtDefImmCons + } + return rc +} + +func Xsqlite3VdbeCloseStatement(tls *libc.TLS, p uintptr, eOp int32) int32 { /* sqlite3.c:81879:20: */ + if ((*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FnStatement != 0) && ((*Vdbe)(unsafe.Pointer(p)).FiStatement != 0) { + return vdbeCloseStatement(tls, p, eOp) + } + return SQLITE_OK +} + +// This function is called when a transaction opened by the database +// handle associated with the VM passed as an argument is about to be +// committed. If there are outstanding deferred foreign key constraint +// violations, return SQLITE_ERROR. Otherwise, SQLITE_OK. +// +// If there are outstanding FK violations and this function returns +// SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY +// and write an error message to it. Then return SQLITE_ERROR. +func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sqlite3.c:81898:20: */ + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb + if ((deferred != 0) && (((*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons) > int64(0))) || + (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { + (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) + (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) + Xsqlite3VdbeError(tls, p, ts+4251 /* "FOREIGN KEY cons..." */, 0) + return SQLITE_ERROR + } + return SQLITE_OK +} + +// This routine is called the when a VDBE tries to halt. If the VDBE +// has made changes and is in autocommit mode, then commit those +// changes. If a rollback is needed, then do the rollback. +// +// This routine is the only way to move the state of a VM from +// SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT. It is harmless to +// call this on a VM that is in the SQLITE_MAGIC_HALT state. +// +// Return an error code. If the commit could not complete because of +// lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it +// means the close did not happen and needs to be repeated. +func Xsqlite3VdbeHalt(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:81925:20: */ + var rc int32 // Used to store transient return codes + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb + + // This function contains the logic that determines if a statement or + // transaction will be committed or rolled back as a result of the + // execution of this virtual machine. + // + // If any of the following errors occur: + // + // SQLITE_NOMEM + // SQLITE_IOERR + // SQLITE_FULL + // SQLITE_INTERRUPT + // + // Then the internal cache might have been left in an inconsistent + // state. We need to rollback the statement transaction, if there is + // one, or the complete transaction if there is no statement transaction. + + if (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic != U32(VDBE_MAGIC_RUN) { + return SQLITE_OK + } + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } + closeAllCursors(tls, p) + + // No commit or rollback needed if the program never started or if the + // SQL statement does not read or write a database file. + if ((*Vdbe)(unsafe.Pointer(p)).Fpc >= 0) && ((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.bIsReader */)) & 0x100 >> 8))) != 0) { + var mrc int32 // Primary error code from p->rc + var eStatementOp int32 = 0 + var isSpecialError int32 // Set to true if a 'special' error + + // Lock all btrees used by the statement + Xsqlite3VdbeEnter(tls, p) + + // Check for one of the special errors + mrc = ((*Vdbe)(unsafe.Pointer(p)).Frc & 0xff) + isSpecialError = (libc.Bool32((((mrc == SQLITE_NOMEM) || (mrc == SQLITE_IOERR)) || + (mrc == SQLITE_INTERRUPT)) || (mrc == SQLITE_FULL))) + if isSpecialError != 0 { + // If the query was read-only and the error code is SQLITE_INTERRUPT, + // no rollback is necessary. Otherwise, at least a savepoint + // transaction must be rolled back to restore the database to a + // consistent state. + // + // Even if the statement is read-only, it is important to perform + // a statement or transaction rollback operation. If the error + // occurred while writing to the journal, sub-journal or database + // file as part of an effort to free up cache space (see function + // pagerStress() in pager.c), the rollback is required to restore + // the pager to a consistent state. + if !((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.readOnly */)) & 0x80 >> 7)) != 0) || (mrc != SQLITE_INTERRUPT) { + if ((mrc == SQLITE_NOMEM) || (mrc == SQLITE_FULL)) && ((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.usesStmtJournal */)) & 0x40 >> 6))) != 0) { + eStatementOp = SAVEPOINT_ROLLBACK + } else { + // We are forced to roll back the active transaction. Before doing + // so, abort any other statements this handle currently has active. + Xsqlite3RollbackAll(tls, db, (SQLITE_ABORT | (int32(2) << 8))) + Xsqlite3CloseSavepoints(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + } + } + } + + // Check for immediate foreign key violations. + if ((*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK) || ((int32((*Vdbe)(unsafe.Pointer(p)).FerrorAction) == OE_Fail) && !(isSpecialError != 0)) { + Xsqlite3VdbeCheckFk(tls, p, 0) + } + + // If the auto-commit flag is set and this is the only active writer + // VM, then we do either a commit or rollback of the current transaction. + // + // Note: This block also runs if one of the special errors handled + // above has occurred. + if (!(((*Sqlite3)(unsafe.Pointer((db))).FnVTrans > 0) && ((*Sqlite3)(unsafe.Pointer((db))).FaVTrans == uintptr(0))) && + ((*Sqlite3)(unsafe.Pointer(db)).FautoCommit != 0)) && + ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeWrite == (libc.Bool32((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.readOnly */)) & 0x80 >> 7)) == 0))) { + if ((*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK) || ((int32((*Vdbe)(unsafe.Pointer(p)).FerrorAction) == OE_Fail) && !(isSpecialError != 0)) { + rc = Xsqlite3VdbeCheckFk(tls, p, 1) + if rc != SQLITE_OK { + if (Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.readOnly */)) & 0x80 >> 7))) != 0 { + Xsqlite3VdbeLeave(tls, p) + return SQLITE_ERROR + } + rc = (SQLITE_CONSTRAINT | (int32(3) << 8)) + } else { + // The auto-commit flag is true, the vdbe program was successful + // or hit an 'OR FAIL' constraint and there are no deferred foreign + // key constraints to hold up the transaction. This means a commit + // is required. + rc = vdbeCommit(tls, db, p) + } + if (rc == SQLITE_BUSY) && ((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.readOnly */)) & 0x80 >> 7))) != 0) { + Xsqlite3VdbeLeave(tls, p) + return SQLITE_BUSY + } else if rc != SQLITE_OK { + (*Vdbe)(unsafe.Pointer(p)).Frc = rc + Xsqlite3RollbackAll(tls, db, SQLITE_OK) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + } else { + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons = int64(0) + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = int64(0) + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_DeferFKs))) + Xsqlite3CommitInternalChanges(tls, db) + } + } else { + Xsqlite3RollbackAll(tls, db, SQLITE_OK) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + } + (*Sqlite3)(unsafe.Pointer(db)).FnStatement = 0 + } else if eStatementOp == 0 { + if ((*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK) || (int32((*Vdbe)(unsafe.Pointer(p)).FerrorAction) == OE_Fail) { + eStatementOp = SAVEPOINT_RELEASE + } else if int32((*Vdbe)(unsafe.Pointer(p)).FerrorAction) == OE_Abort { + eStatementOp = SAVEPOINT_ROLLBACK + } else { + Xsqlite3RollbackAll(tls, db, (SQLITE_ABORT | (int32(2) << 8))) + Xsqlite3CloseSavepoints(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + } + } + + // If eStatementOp is non-zero, then a statement transaction needs to + // be committed or rolled back. Call sqlite3VdbeCloseStatement() to + // do so. If this operation returns an error, and the current statement + // error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the + // current statement error code. + if eStatementOp != 0 { + rc = Xsqlite3VdbeCloseStatement(tls, p, eStatementOp) + if rc != 0 { + if ((*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK) || (((*Vdbe)(unsafe.Pointer(p)).Frc & 0xff) == SQLITE_CONSTRAINT) { + (*Vdbe)(unsafe.Pointer(p)).Frc = rc + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = uintptr(0) + } + Xsqlite3RollbackAll(tls, db, (SQLITE_ABORT | (int32(2) << 8))) + Xsqlite3CloseSavepoints(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + } + } + + // If this was an INSERT, UPDATE or DELETE and no statement transaction + // has been rolled back, update the database connection change-counter. + if (Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.changeCntOn */)) & 0x10 >> 4))) != 0 { + if eStatementOp != SAVEPOINT_ROLLBACK { + Xsqlite3VdbeSetChanges(tls, db, (*Vdbe)(unsafe.Pointer(p)).FnChange) + } else { + Xsqlite3VdbeSetChanges(tls, db, 0) + } + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + } + + // Release the locks + Xsqlite3VdbeLeave(tls, p) + } + + // We have successfully halted and closed the VM. Record this fact. + if (*Vdbe)(unsafe.Pointer(p)).Fpc >= 0 { + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive-- + if !((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.readOnly */)) & 0x80 >> 7)) != 0) { + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeWrite-- + } + if (Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.bIsReader */)) & 0x100 >> 8))) != 0 { + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeRead-- + } + + } + (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic = U32(VDBE_MAGIC_HALT) + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } + + // If the auto-commit flag is set to true, then any locks that were held + // by connection db have now been released. Call sqlite3ConnectionUnlocked() + // to invoke any required unlock-notify callbacks. + if (*Sqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { + Xsqlite3ConnectionUnlocked(tls, db) + } + + return func() int32 { + if (*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_BUSY { + return SQLITE_BUSY + } + return SQLITE_OK + }() +} + +// Each VDBE holds the result of the most recent sqlite3_step() call +// in p->rc. This routine sets that result back to SQLITE_OK. +func Xsqlite3VdbeResetStepResult(tls *libc.TLS, p uintptr) { /* sqlite3.c:82126:21: */ + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK +} + +// Copy the error code and error message belonging to the VDBE passed +// as the first argument to its database handle (so that they will be +// returned by calls to sqlite3_errcode() and sqlite3_errmsg()). +// +// This function does not clear the VDBE error code or message, just +// copies them to the database handle. +func Xsqlite3VdbeTransferError(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82138:20: */ + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb + var rc int32 = (*Vdbe)(unsafe.Pointer(p)).Frc + if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { + (*Sqlite3)(unsafe.Pointer(db)).FbBenignMalloc++ + Xsqlite3BeginBenignMalloc(tls) + if (*Sqlite3)(unsafe.Pointer(db)).FpErr == uintptr(0) { + (*Sqlite3)(unsafe.Pointer(db)).FpErr = Xsqlite3ValueNew(tls, db) + } + Xsqlite3ValueSetStr(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr, -1, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, uint8(SQLITE_UTF8), libc.UintptrFromInt32(-1)) + Xsqlite3EndBenignMalloc(tls) + (*Sqlite3)(unsafe.Pointer(db)).FbBenignMalloc-- + } else if (*Sqlite3)(unsafe.Pointer(db)).FpErr != 0 { + Xsqlite3ValueSetNull(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + } + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = rc + return rc +} + +// Clean up a VDBE after execution but do not delete the VDBE just yet. +// Write any error messages into *pzErrMsg. Return the result code. +// +// After this routine is run, the VDBE should be ready to be executed +// again. +// +// To look at it another way, this routine resets the state of the +// virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to +// VDBE_MAGIC_INIT. +func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + + // If the VM did not run to completion or if it encountered an + // error, then it might not have been halted properly. So halt + // it now. + Xsqlite3VdbeHalt(tls, p) + + // If the VDBE has been run even partially, then transfer the error code + // and error message from the VDBE into the main database structure. But + // if the VDBE has just been set to run but has not actually executed any + // instructions yet, leave the main database error information unchanged. + if (*Vdbe)(unsafe.Pointer(p)).Fpc >= 0 { + + if ((*Sqlite3)(unsafe.Pointer(db)).FpErr != 0) || ((*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0) { + Xsqlite3VdbeTransferError(tls, p) + } else { + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = (*Vdbe)(unsafe.Pointer(p)).Frc + } + if (Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.runOnlyOnce */)) & 0x20 >> 5))) != 0 { + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(1), 0, 0x3) + } + } else if ((*Vdbe)(unsafe.Pointer(p)).Frc != 0) && ((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.expired */)) & 0x3 >> 0))) != 0) { + // The expired flag was set on the VDBE before the first call + // to sqlite3_step(). For consistency (since sqlite3_step() was + // called), set the database error in this case as well. + Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { + if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { + return ts + 2791 /* "%s" */ + } + return uintptr(0) + }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + } + + // Reset register contents and reclaim error message memory. + if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = uintptr(0) + } + (*Vdbe)(unsafe.Pointer(p)).FpResultSet = uintptr(0) + + // Save profiling information from this VDBE run. + (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic = U32(VDBE_MAGIC_RESET) + return ((*Vdbe)(unsafe.Pointer(p)).Frc & (*Sqlite3)(unsafe.Pointer(db)).FerrMask) +} + +// Clean up and delete a VDBE after execution. Return an integer which is +// the result code. Write any error message text into *pzErrMsg. +func Xsqlite3VdbeFinalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82284:20: */ + var rc int32 = SQLITE_OK + if ((*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic == U32(VDBE_MAGIC_RUN)) || ((*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic == U32(VDBE_MAGIC_HALT)) { + rc = Xsqlite3VdbeReset(tls, p) + + } + Xsqlite3VdbeDelete(tls, p) + return rc +} + +// If parameter iOp is less than zero, then invoke the destructor for +// all auxiliary data pointers currently cached by the VM passed as +// the first argument. +// +// Or, if iOp is greater than or equal to zero, then the destructor is +// only invoked for those auxiliary data pointers created by the user +// function invoked by the OP_Function opcode at instruction iOp of +// VM pVdbe, and only then if: +// +// * the associated function parameter is the 32nd or later (counting +// from left to right), or +// +// * the corresponding bit in argument mask is clear (where the first +// function parameter corresponds to bit 0 etc.). +func Xsqlite3VdbeDeleteAuxData(tls *libc.TLS, db uintptr, pp uintptr, iOp int32, mask int32) { /* sqlite3.c:82310:21: */ + for *(*uintptr)(unsafe.Pointer(pp)) != 0 { + var pAux uintptr = *(*uintptr)(unsafe.Pointer(pp)) + if (iOp < 0) || + ((((*AuxData)(unsafe.Pointer(pAux)).FiAuxOp == iOp) && + ((*AuxData)(unsafe.Pointer(pAux)).FiAuxArg >= 0)) && + (((*AuxData)(unsafe.Pointer(pAux)).FiAuxArg > 31) || !((uint32(mask) & (uint32((uint32(1))) << ((*AuxData)(unsafe.Pointer(pAux)).FiAuxArg))) != 0))) { + + if (*AuxData)(unsafe.Pointer(pAux)).FxDeleteAux != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pAux + 16 /* &.xDeleteAux */))))(tls, (*AuxData)(unsafe.Pointer(pAux)).FpAux) + } + *(*uintptr)(unsafe.Pointer(pp)) = (*AuxData)(unsafe.Pointer(pAux)).FpNextAux + Xsqlite3DbFree(tls, db, pAux) + } else { + pp = (pAux + 24 /* &.pNextAux */) + } + } +} + +// Free all memory associated with the Vdbe passed as the second argument, +// except for object itself, which is preserved. +// +// The difference between this function and sqlite3VdbeDelete() is that +// VdbeDelete() also unlinks the Vdbe from the list of VMs associated with +// the database connection and frees the object itself. +func Xsqlite3VdbeClearObject(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:82338:21: */ + var pSub uintptr + var pNext uintptr + + releaseMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaColName, (int32((*Vdbe)(unsafe.Pointer(p)).FnResColumn) * COLNAME_N)) + for pSub = (*Vdbe)(unsafe.Pointer(p)).FpProgram; pSub != 0; pSub = pNext { + pNext = (*SubProgram)(unsafe.Pointer(pSub)).FpNext + vdbeFreeOpArray(tls, db, (*SubProgram)(unsafe.Pointer(pSub)).FaOp, (*SubProgram)(unsafe.Pointer(pSub)).FnOp) + Xsqlite3DbFree(tls, db, pSub) + } + if (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic != U32(VDBE_MAGIC_INIT) { + releaseMemArray(tls, (*Vdbe)(unsafe.Pointer(p)).FaVar, int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FpVList) + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FpFree) + } + vdbeFreeOpArray(tls, db, (*Vdbe)(unsafe.Pointer(p)).FaOp, (*Vdbe)(unsafe.Pointer(p)).FnOp) + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FaColName) + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzSql) +} + +// Delete an entire VDBE. +func Xsqlite3VdbeDelete(tls *libc.TLS, p uintptr) { /* sqlite3.c:82379:21: */ + var db uintptr + + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + + Xsqlite3VdbeClearObject(tls, db, p) + if (*Vdbe)(unsafe.Pointer(p)).FpPrev != 0 { + (*Vdbe)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FpPrev)).FpNext = (*Vdbe)(unsafe.Pointer(p)).FpNext + } else { + + (*Sqlite3)(unsafe.Pointer(db)).FpVdbe = (*Vdbe)(unsafe.Pointer(p)).FpNext + } + if (*Vdbe)(unsafe.Pointer(p)).FpNext != 0 { + (*Vdbe)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FpNext)).FpPrev = (*Vdbe)(unsafe.Pointer(p)).FpPrev + } + (*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic = U32(VDBE_MAGIC_DEAD) + (*Vdbe)(unsafe.Pointer(p)).Fdb = uintptr(0) + Xsqlite3DbFreeNN(tls, db, p) +} + +// The cursor "p" has a pending seek operation that has not yet been +// carried out. Seek the cursor now. If an error occurs, return +// the appropriate error code. +func Xsqlite3VdbeFinishMoveto(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82405:36: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var res int32 at bp, 4 + + var rc int32 + + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(p + 56 /* &.uc */)), uintptr(0), (*VdbeCursor)(unsafe.Pointer(p)).FmovetoTarget, 0, bp /* &res */) + if rc != 0 { + return rc + } + if *(*int32)(unsafe.Pointer(bp /* res */)) != 0 { + return Xsqlite3CorruptError(tls, 82415) + } + (*VdbeCursor)(unsafe.Pointer(p)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(p)).FcacheStatus = U32(CACHE_STALE) + return SQLITE_OK +} + +// Something has moved cursor "p" out of place. Maybe the row it was +// pointed to was deleted out from under it. Or maybe the btree was +// rebalanced. Whatever the cause, try to restore "p" to the place it +// is supposed to be pointing. If the row was deleted out from under the +// cursor, set the cursor to point to a NULL row. +func handleMovedCursor(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82431:28: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var isDifferentRow int32 at bp, 4 + + var rc int32 + + rc = Xsqlite3BtreeCursorRestore(tls, *(*uintptr)(unsafe.Pointer(p + 56 /* &.uc */)), bp /* &isDifferentRow */) + (*VdbeCursor)(unsafe.Pointer(p)).FcacheStatus = U32(CACHE_STALE) + if *(*int32)(unsafe.Pointer(bp /* isDifferentRow */)) != 0 { + (*VdbeCursor)(unsafe.Pointer(p)).FnullRow = U8(1) + } + return rc +} + +// Check to ensure that the cursor is valid. Restore the cursor +// if need be. Return any I/O error from the restore operation. +func Xsqlite3VdbeCursorRestore(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82446:20: */ + + if Xsqlite3BtreeCursorHasMoved(tls, *(*uintptr)(unsafe.Pointer(p + 56 /* &.uc */))) != 0 { + return handleMovedCursor(tls, p) + } + return SQLITE_OK +} + +// Make sure the cursor p is ready to read or write the row to which it +// was last positioned. Return an error code if an OOM fault or I/O error +// prevents us from positioning the cursor to its correct position. +// +// If a MoveTo operation is pending on the given cursor, then do that +// MoveTo now. If no move is pending, check to see if the row has been +// deleted out from under the cursor and if it has, mark the row as +// a NULL row. +// +// If the cursor is already pointing to the correct row and that row has +// not been deleted out from under the cursor, then this routine is a no-op. +func Xsqlite3VdbeCursorMoveto(tls *libc.TLS, pp uintptr, piCol uintptr) int32 { /* sqlite3.c:82467:20: */ + var p uintptr = *(*uintptr)(unsafe.Pointer(pp)) + + if (*VdbeCursor)(unsafe.Pointer(p)).FdeferredMoveto != 0 { + var iMap U32 + + if (((*VdbeCursor)(unsafe.Pointer(p)).FaAltMap != 0) && ((libc.AssignUint32(&iMap, *(*U32)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(p)).FaAltMap + uintptr((U32(1)+*(*U32)(unsafe.Pointer(piCol))))*4)))) > U32(0))) && !(int32((*VdbeCursor)(unsafe.Pointer(p)).FnullRow) != 0) { + *(*uintptr)(unsafe.Pointer(pp)) = (*VdbeCursor)(unsafe.Pointer(p)).FpAltCursor + *(*U32)(unsafe.Pointer(piCol)) = (iMap - U32(1)) + return SQLITE_OK + } + return Xsqlite3VdbeFinishMoveto(tls, p) + } + if Xsqlite3BtreeCursorHasMoved(tls, *(*uintptr)(unsafe.Pointer(p + 56 /* &.uc */))) != 0 { + return handleMovedCursor(tls, p) + } + return SQLITE_OK +} + +// The following functions: +// +// sqlite3VdbeSerialType() +// sqlite3VdbeSerialTypeLen() +// sqlite3VdbeSerialLen() +// sqlite3VdbeSerialPut() +// sqlite3VdbeSerialGet() +// +// encapsulate the code that serializes values for storage in SQLite +// data and index records. Each serialized value consists of a +// 'serial-type' and a blob of data. The serial type is an 8-byte unsigned +// integer, stored as a varint. +// +// In an SQLite index record, the serial type is stored directly before +// the blob of data that it corresponds to. In a table record, all serial +// types are stored at the start of the record, and the blobs of data at +// the end. Hence these functions allow the caller to handle the +// serial-type and data blob separately. +// +// The following table describes the various storage classes for data: +// +// serial type bytes of data type +// -------------- --------------- --------------- +// 0 0 NULL +// 1 1 signed integer +// 2 2 signed integer +// 3 3 signed integer +// 4 4 signed integer +// 5 6 signed integer +// 6 8 signed integer +// 7 8 IEEE float +// 8 0 Integer constant 0 +// 9 0 Integer constant 1 +// 10,11 reserved for expansion +// N>=12 and even (N-12)/2 BLOB +// N>=13 and odd (N-13)/2 text +// +// The 8 and 9 types were added in 3.3.0, file format 4. Prior versions +// of SQLite will not understand those serial types. + +// The sizes for serial types less than 128 +var sqlite3SmallTypeSizes = [128]U8{ + // 0 1 2 3 4 5 6 7 8 9 + /* 0 */ U8(0), U8(1), U8(2), U8(3), U8(4), U8(6), U8(8), U8(8), U8(0), U8(0), + /* 10 */ U8(0), U8(0), U8(0), U8(0), U8(1), U8(1), U8(2), U8(2), U8(3), U8(3), + /* 20 */ U8(4), U8(4), U8(5), U8(5), U8(6), U8(6), U8(7), U8(7), U8(8), U8(8), + /* 30 */ U8(9), U8(9), U8(10), U8(10), U8(11), U8(11), U8(12), U8(12), U8(13), U8(13), + /* 40 */ U8(14), U8(14), U8(15), U8(15), U8(16), U8(16), U8(17), U8(17), U8(18), U8(18), + /* 50 */ U8(19), U8(19), U8(20), U8(20), U8(21), U8(21), U8(22), U8(22), U8(23), U8(23), + /* 60 */ U8(24), U8(24), U8(25), U8(25), U8(26), U8(26), U8(27), U8(27), U8(28), U8(28), + /* 70 */ U8(29), U8(29), U8(30), U8(30), U8(31), U8(31), U8(32), U8(32), U8(33), U8(33), + /* 80 */ U8(34), U8(34), U8(35), U8(35), U8(36), U8(36), U8(37), U8(37), U8(38), U8(38), + /* 90 */ U8(39), U8(39), U8(40), U8(40), U8(41), U8(41), U8(42), U8(42), U8(43), U8(43), + /* 100 */ U8(44), U8(44), U8(45), U8(45), U8(46), U8(46), U8(47), U8(47), U8(48), U8(48), + /* 110 */ U8(49), U8(49), U8(50), U8(50), U8(51), U8(51), U8(52), U8(52), U8(53), U8(53), + /* 120 */ U8(54), U8(54), U8(55), U8(55), U8(56), U8(56), U8(57), U8(57), +} /* sqlite3.c:82604:17 */ + +// Return the length of the data corresponding to the supplied serial-type. +func Xsqlite3VdbeSerialTypeLen(tls *libc.TLS, serial_type U32) U32 { /* sqlite3.c:82624:20: */ + if serial_type >= U32(128) { + return ((serial_type - U32(12)) / U32(2)) + } else { + + return U32(sqlite3SmallTypeSizes[serial_type]) + } + return U32(0) +} + +func Xsqlite3VdbeOneByteSerialTypeLen(tls *libc.TLS, serial_type U8) U8 { /* sqlite3.c:82633:19: */ + + return sqlite3SmallTypeSizes[serial_type] +} + +// If we are on an architecture with mixed-endian floating +// points (ex: ARM7) then swap the lower 4 bytes with the +// upper 4 bytes. Return the result. +// +// For most architectures, this is a no-op. +// +// (later): It is reported to me that the mixed-endian problem +// on ARM7 is an issue with GCC, not with the ARM7 chip. It seems +// that early versions of GCC stored the two words of a 64-bit +// float in the wrong order. And that error has been propagated +// ever since. The blame is not necessarily with GCC, though. +// GCC might have just copying the problem from a prior compiler. +// I am also told that newer versions of GCC that follow a different +// ABI get the byte order right. +// +// Developers using SQLite on an ARM7 should compile and run their +// application using -DSQLITE_DEBUG=1 at least once. With DEBUG +// enabled, some asserts below will ensure that the byte order of +// floating point values is correct. +// +// (2007-08-30) Frank van Vugt has studied this problem closely +// and has send his findings to the SQLite developers. Frank +// writes that some Linux kernels offer floating point hardware +// emulation that uses only 32-bit mantissas instead of a full +// 48-bits as required by the IEEE standard. (This is the +// CONFIG_FPE_FASTFPE option.) On such systems, floating point +// byte swapping becomes very complicated. To avoid problems, +// the necessary byte swapping is carried out using a 64-bit integer +// rather than a 64-bit float. Frank assures us that the code here +// works for him. We, the developers, have no way to independently +// verify this, but Frank seems to know what he is talking about +// so we trust him. + +// Write the serialized data blob for the value stored in pMem into +// buf. It is assumed that the caller has allocated sufficient space. +// Return the number of bytes written. +// +// nBuf is the amount of space left in buf[]. The caller is responsible +// for allocating enough space to buf[] to hold the entire field, exclusive +// of the pMem->u.nZero bytes for a MEM_Zero value. +// +// Return the number of bytes actually written into buf[]. The number +// of bytes in the zero-filled tail is included in the return value only +// if those bytes were zeroed in buf[]. +func Xsqlite3VdbeSerialPut(tls *libc.TLS, buf uintptr, pMem uintptr, serial_type U32) U32 { /* sqlite3.c:82704:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var len U32 + + // Integer and Real + if (serial_type <= U32(7)) && (serial_type > U32(0)) { + // var v U64 at bp, 8 + + var i U32 + if serial_type == U32(7) { + + libc.Xmemcpy(tls, bp /* &v */, (pMem /* &.u */ /* &.r */), uint64(unsafe.Sizeof(U64(0)))) + + } else { + *(*U64)(unsafe.Pointer(bp /* v */)) = U64(*(*I64)(unsafe.Pointer(pMem /* &.u */))) + } + len = libc.AssignUint32(&i, U32(sqlite3SmallTypeSizes[serial_type])) + + for ok := true; ok; ok = i != 0 { + *(*U8)(unsafe.Pointer(buf + uintptr(libc.PreDecUint32(&i, 1)))) = (U8(*(*U64)(unsafe.Pointer(bp /* v */)) & uint64(0xFF))) + *(*U64)(unsafe.Pointer(bp /* v */)) >>= 8 + } + return len + } + + // String or blob + if serial_type >= U32(12) { + + len = U32((*Mem)(unsafe.Pointer(pMem)).Fn) + if len > U32(0) { + libc.Xmemcpy(tls, buf, (*Mem)(unsafe.Pointer(pMem)).Fz, uint64(len)) + } + return len + } + + // NULL or constants 0 or 1 + return U32(0) +} + +// Input "x" is a sequence of unsigned characters that represent a +// big-endian integer. Return the equivalent native integer + +// Deserialize the data blob pointed to by buf as serial type serial_type +// and store the result in pMem. Return the number of bytes read. +// +// This function is implemented as two separate routines for performance. +// The few cases that require local variables are broken out into a separate +// routine so that in most cases the overhead of moving the stack pointer +// is avoided. +func serialGet(tls *libc.TLS, buf uintptr, serial_type U32, pMem uintptr) U32 { /* sqlite3.c:82758:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*U64)(unsafe.Pointer(bp /* x */)) = (U64((((U32(*(*uint8)(unsafe.Pointer((buf)))) << 24) | (U32(int32(*(*uint8)(unsafe.Pointer((buf) + 1))) << 16))) | (U32(int32(*(*uint8)(unsafe.Pointer((buf) + 2))) << 8))) | U32(*(*uint8)(unsafe.Pointer((buf) + 3))))) + var y U32 = ((((U32(*(*uint8)(unsafe.Pointer((buf + uintptr(4))))) << 24) | (U32(int32(*(*uint8)(unsafe.Pointer((buf + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*uint8)(unsafe.Pointer((buf + uintptr(4)) + 2))) << 8))) | U32(*(*uint8)(unsafe.Pointer((buf + uintptr(4)) + 3)))) + *(*U64)(unsafe.Pointer(bp /* x */)) = ((*(*U64)(unsafe.Pointer(bp /* x */)) << 32) + U64(y)) + if serial_type == U32(6) { + // EVIDENCE-OF: R-29851-52272 Value is a big-endian 64-bit + // twos-complement integer. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = *(*I64)(unsafe.Pointer(bp /* &x */)) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + + } else { + // EVIDENCE-OF: R-57343-49114 Value is a big-endian IEEE 754-2008 64-bit + // floating point number. + + libc.Xmemcpy(tls, (pMem /* &.u */ /* &.r */), bp /* &x */, uint64(unsafe.Sizeof(U64(0)))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = func() uint16 { + if (((*(*U64)(unsafe.Pointer(bp /* x */))) & (U64((uint64(0x7ff))) << 52)) == (U64((uint64(0x7ff))) << 52)) && (((*(*U64)(unsafe.Pointer(bp /* x */))) & ((U64((uint64(1))) << 52) - uint64(1))) != uint64(0)) { + return uint16(MEM_Null) + } + return uint16(MEM_Real) + }() + } + return U32(8) +} + +func Xsqlite3VdbeSerialGet(tls *libc.TLS, buf uintptr, serial_type U32, pMem uintptr) U32 { /* sqlite3.c:82794:20: */ + switch serial_type { + case U32(10): + { // Internal use only: NULL with virtual table + // UPDATE no-change flag set + (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(MEM_Null | MEM_Zero)) + (*Mem)(unsafe.Pointer(pMem)).Fn = 0 + *(*int32)(unsafe.Pointer(pMem /* &.u */)) = 0 + break + + } + case U32(11): + fallthrough // Reserved for future use + case U32(0): + { // Null + // EVIDENCE-OF: R-24078-09375 Value is a NULL. + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Null) + break + + } + case U32(1): + { + // EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement + // integer. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = I64(I8(*(*uint8)(unsafe.Pointer((buf))))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + + return U32(1) + + } + case U32(2): + { // 2-byte signed integer + // EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit + // twos-complement integer. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = (I64((256 * int32((I8(*(*uint8)(unsafe.Pointer((buf))))))) | int32(*(*uint8)(unsafe.Pointer((buf) + 1))))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + + return U32(2) + + } + case U32(3): + { // 3-byte signed integer + // EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit + // twos-complement integer. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = (I64(((65536 * int32((I8(*(*uint8)(unsafe.Pointer((buf))))))) | (int32(*(*uint8)(unsafe.Pointer((buf) + 1))) << 8)) | int32(*(*uint8)(unsafe.Pointer((buf) + 2))))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + + return U32(3) + + } + case U32(4): + { // 4-byte signed integer + // EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit + // twos-complement integer. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = (I64((((16777216 * int32((I8(*(*uint8)(unsafe.Pointer((buf))))))) | (int32(*(*uint8)(unsafe.Pointer((buf) + 1))) << 16)) | (int32(*(*uint8)(unsafe.Pointer((buf) + 2))) << 8)) | int32(*(*uint8)(unsafe.Pointer((buf) + 3))))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + + return U32(4) + + } + case U32(5): + { // 6-byte signed integer + // EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit + // twos-complement integer. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = ((I64((((U32(*(*uint8)(unsafe.Pointer((buf + uintptr(2))))) << 24) | (U32(int32(*(*uint8)(unsafe.Pointer((buf + uintptr(2)) + 1))) << 16))) | (U32(int32(*(*uint8)(unsafe.Pointer((buf + uintptr(2)) + 2))) << 8))) | U32(*(*uint8)(unsafe.Pointer((buf + uintptr(2)) + 3))))) + ((I64((int64(1))) << 32) * (I64((256 * int32((I8(*(*uint8)(unsafe.Pointer((buf))))))) | int32(*(*uint8)(unsafe.Pointer((buf) + 1))))))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + + return U32(6) + + } + case U32(6): + fallthrough // 8-byte signed integer + case U32(7): + { // IEEE floating point + // These use local variables, so do them in a separate routine + // to avoid having to move the frame pointer in the common case + return serialGet(tls, buf, serial_type, pMem) + + } + case U32(8): + fallthrough // Integer 0 + case U32(9): + { // Integer 1 + // EVIDENCE-OF: R-12976-22893 Value is the integer 0. + // EVIDENCE-OF: R-18143-12121 Value is the integer 1. + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = (I64(serial_type - U32(8))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Int) + return U32(0) + + } + default: + { + (*Mem)(unsafe.Pointer(pMem)).Fz = buf + (*Mem)(unsafe.Pointer(pMem)).Fn = (int32((serial_type - U32(12)) / U32(2))) + (*Mem)(unsafe.Pointer(pMem)).Fflags = aFlag[(serial_type & U32(1))] + return U32((*Mem)(unsafe.Pointer(pMem)).Fn) + + } + } + return U32(0) +} + +var aFlag = [2]U16{(U16(MEM_Blob | MEM_Ephem)), (U16(MEM_Str | MEM_Ephem))} /* sqlite3.c:82876:24 */ + +// This routine is used to allocate sufficient space for an UnpackedRecord +// structure large enough to be used with sqlite3VdbeRecordUnpack() if +// the first argument is a pointer to KeyInfo structure pKeyInfo. +// +// The space is either allocated using sqlite3DbMallocRaw() or from within +// the unaligned buffer passed via the second and third arguments (presumably +// stack space). If the former, then *ppFree is set to a pointer that should +// be eventually freed by the caller using sqlite3DbFree(). Or, if the +// allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL +// before returning. +// +// If an OOM error occurs, NULL is returned. +func Xsqlite3VdbeAllocUnpackedRecord(tls *libc.TLS, pKeyInfo uintptr) uintptr { /* sqlite3.c:82899:31: */ + var p uintptr // Unpacked record to return + var nByte int32 // Number of bytes required for *p + nByte = (int32((((uint64(unsafe.Sizeof(UnpackedRecord{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))) + (uint64(unsafe.Sizeof(Mem{})) * (uint64(int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField) + 1))))) + p = Xsqlite3DbMallocRaw(tls, (*KeyInfo)(unsafe.Pointer(pKeyInfo)).Fdb, uint64(nByte)) + if !(p != 0) { + return uintptr(0) + } + (*UnpackedRecord)(unsafe.Pointer(p)).FaMem = ((p) + 24) + + (*UnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo = pKeyInfo + (*UnpackedRecord)(unsafe.Pointer(p)).FnField = (U16(int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField) + 1)) + return p +} + +// Given the nKey-byte encoding of a record in pKey[], populate the +// UnpackedRecord structure indicated by the fourth argument with the +// contents of the decoded record. +func Xsqlite3VdbeRecordUnpack(tls *libc.TLS, pKeyInfo uintptr, nKey int32, pKey uintptr, p uintptr) { /* sqlite3.c:82919:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var aKey uintptr = pKey + var d U32 + var idx U32 // Offset in aKey[] to read from + var u U16 // Unsigned loop counter + // var szHdr U32 at bp, 4 + + var pMem uintptr = (*UnpackedRecord)(unsafe.Pointer(p)).FaMem + + (*UnpackedRecord)(unsafe.Pointer(p)).Fdefault_rc = int8(0) + + idx = U32(func() uint8 { + if int32(*(*uint8)(unsafe.Pointer(aKey))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*U32)(unsafe.Pointer(bp /* szHdr */))) = U32(*(*uint8)(unsafe.Pointer(aKey))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, aKey, bp /* &szHdr */) + }()) + d = *(*U32)(unsafe.Pointer(bp /* szHdr */)) + u = U16(0) + for (idx < *(*U32)(unsafe.Pointer(bp /* szHdr */))) && (d <= U32(nKey)) { + // var serial_type U32 at bp+4, 4 + + idx = idx + (U32(func() uint8 { + if int32(*(*uint8)(unsafe.Pointer((aKey + uintptr(idx))))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*U32)(unsafe.Pointer(bp + 4 /* serial_type */))) = U32(*(*uint8)(unsafe.Pointer((aKey + uintptr(idx))))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, (aKey + uintptr(idx)), bp+4 /* &serial_type */) + }())) + (*Mem)(unsafe.Pointer(pMem)).Fenc = (*KeyInfo)(unsafe.Pointer(pKeyInfo)).Fenc + (*Mem)(unsafe.Pointer(pMem)).Fdb = (*KeyInfo)(unsafe.Pointer(pKeyInfo)).Fdb + // pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = 0 + (*Mem)(unsafe.Pointer(pMem)).Fz = uintptr(0) + d = d + (Xsqlite3VdbeSerialGet(tls, (aKey + uintptr(d)), *(*U32)(unsafe.Pointer(bp + 4 /* serial_type */)), pMem)) + pMem += 56 + if (int32(libc.PreIncUint16(&u, 1))) >= int32((*UnpackedRecord)(unsafe.Pointer(p)).FnField) { + break + } + } + if (d > U32(nKey)) && (u != 0) { + + // In a corrupt record entry, the last pMem might have been set up using + // uninitialized memory. Overwrite its value with NULL, to prevent + // warnings from MSAN. + Xsqlite3VdbeMemSetNull(tls, (pMem - uintptr(1)*56)) + } + + (*UnpackedRecord)(unsafe.Pointer(p)).FnField = u +} + +// Both *pMem1 and *pMem2 contain string values. Compare the two values +// using the collation sequence pColl. As usual, return a negative , zero +// or positive value if *pMem1 is less than, equal to or greater than +// *pMem2, respectively. Similar in spirit to "rc = (*pMem1) - (*pMem2);". +func vdbeCompareMemString(tls *libc.TLS, pMem1 uintptr, pMem2 uintptr, pColl uintptr, prcErr uintptr) int32 { /* sqlite3.c:83114:12: */ + bp := tls.Alloc(112) + defer tls.Free(112) + + if int32((*Mem)(unsafe.Pointer(pMem1)).Fenc) == int32((*CollSeq)(unsafe.Pointer(pColl)).Fenc) { + // The strings are already in the correct encoding. Call the + // comparison function directly + return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((pColl + 24 /* &.xCmp */))))(tls, (*CollSeq)(unsafe.Pointer(pColl)).FpUser, (*Mem)(unsafe.Pointer(pMem1)).Fn, (*Mem)(unsafe.Pointer(pMem1)).Fz, (*Mem)(unsafe.Pointer(pMem2)).Fn, (*Mem)(unsafe.Pointer(pMem2)).Fz) + } else { + var rc int32 + var v1 uintptr + var v2 uintptr + // var c1 Mem at bp, 56 + + // var c2 Mem at bp+56, 56 + + Xsqlite3VdbeMemInit(tls, bp /* &c1 */, (*Mem)(unsafe.Pointer(pMem1)).Fdb, uint16(MEM_Null)) + Xsqlite3VdbeMemInit(tls, bp+56 /* &c2 */, (*Mem)(unsafe.Pointer(pMem1)).Fdb, uint16(MEM_Null)) + Xsqlite3VdbeMemShallowCopy(tls, bp /* &c1 */, pMem1, MEM_Ephem) + Xsqlite3VdbeMemShallowCopy(tls, bp+56 /* &c2 */, pMem2, MEM_Ephem) + v1 = Xsqlite3ValueText(tls, bp /* &c1 */, (*CollSeq)(unsafe.Pointer(pColl)).Fenc) + v2 = Xsqlite3ValueText(tls, bp+56 /* &c2 */, (*CollSeq)(unsafe.Pointer(pColl)).Fenc) + if (v1 == uintptr(0)) || (v2 == uintptr(0)) { + if prcErr != 0 { + *(*U8)(unsafe.Pointer(prcErr)) = U8(SQLITE_NOMEM) + } + rc = 0 + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((pColl + 24 /* &.xCmp */))))(tls, (*CollSeq)(unsafe.Pointer(pColl)).FpUser, (*Mem)(unsafe.Pointer(bp /* &c1 */)).Fn, v1, (*Mem)(unsafe.Pointer(bp+56 /* &c2 */)).Fn, v2) + } + Xsqlite3VdbeMemRelease(tls, bp /* &c1 */) + Xsqlite3VdbeMemRelease(tls, bp+56 /* &c2 */) + return rc + } + return int32(0) +} + +// The input pBlob is guaranteed to be a Blob that is not marked +// with MEM_Zero. Return true if it could be a zero-blob. +func isAllZero(tls *libc.TLS, z uintptr, n int32) int32 { /* sqlite3.c:83151:12: */ + var i int32 + for i = 0; i < n; i++ { + if *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0 { + return 0 + } + } + return 1 +} + +// Compare two blobs. Return negative, zero, or positive if the first +// is less than, equal to, or greater than the second, respectively. +// If one blob is a prefix of the other, then the shorter is the lessor. +func Xsqlite3BlobCompare(tls *libc.TLS, pB1 uintptr, pB2 uintptr) int32 { /* sqlite3.c:83164:36: */ + var c int32 + var n1 int32 = (*Mem)(unsafe.Pointer(pB1)).Fn + var n2 int32 = (*Mem)(unsafe.Pointer(pB2)).Fn + + // It is possible to have a Blob value that has some non-zero content + // followed by zero content. But that only comes up for Blobs formed + // by the OP_MakeRecord opcode, and such Blobs never get passed into + // sqlite3MemCompare(). + + if ((int32((*Mem)(unsafe.Pointer(pB1)).Fflags) | int32((*Mem)(unsafe.Pointer(pB2)).Fflags)) & MEM_Zero) != 0 { + if ((int32((*Mem)(unsafe.Pointer(pB1)).Fflags) & int32((*Mem)(unsafe.Pointer(pB2)).Fflags)) & MEM_Zero) != 0 { + return (*(*int32)(unsafe.Pointer(pB1 /* &.u */)) - *(*int32)(unsafe.Pointer(pB2 /* &.u */))) + } else if (int32((*Mem)(unsafe.Pointer(pB1)).Fflags) & MEM_Zero) != 0 { + if !(isAllZero(tls, (*Mem)(unsafe.Pointer(pB2)).Fz, (*Mem)(unsafe.Pointer(pB2)).Fn) != 0) { + return -1 + } + return (*(*int32)(unsafe.Pointer(pB1 /* &.u */)) - n2) + } else { + if !(isAllZero(tls, (*Mem)(unsafe.Pointer(pB1)).Fz, (*Mem)(unsafe.Pointer(pB1)).Fn) != 0) { + return +1 + } + return (n1 - *(*int32)(unsafe.Pointer(pB2 /* &.u */))) + } + } + c = libc.Xmemcmp(tls, (*Mem)(unsafe.Pointer(pB1)).Fz, (*Mem)(unsafe.Pointer(pB2)).Fz, func() uint64 { + if n1 > n2 { + return uint64(n2) + } + return uint64(n1) + }()) + if c != 0 { + return c + } + return (n1 - n2) +} + +// Do a comparison between a 64-bit signed integer and a 64-bit floating-point +// number. Return negative, zero, or positive if the first (i64) is less than, +// equal to, or greater than the second (double). +func sqlite3IntFloatCompare(tls *libc.TLS, i I64, r float64) int32 { /* sqlite3.c:83197:12: */ + if uint64(unsafe.Sizeof(float64(0))) > uint64(8) { + var x float64 = float64(i) + + if x < r { + return -1 + } + if x > r { + return +1 + } /*NO_TEST*/ // work around bugs in gcov + return 0 /*NO_TEST*/ // work around bugs in gcov + } else { + var y I64 + var s float64 + if r < -9223372036854775808.0 { + return +1 + } + if r >= 9223372036854775808.0 { + return -1 + } + y = I64(r) + if i < y { + return -1 + } + if i > y { + return +1 + } + s = float64(i) + if s < r { + return -1 + } + if s > r { + return +1 + } + return 0 + } + return int32(0) +} + +// Compare the values contained by the two memory cells, returning +// negative, zero or positive if pMem1 is less than, equal to, or greater +// than pMem2. Sorting order is NULL's first, followed by numbers (integers +// and reals) sorted numerically, followed by text ordered by the collating +// sequence pColl and finally blob's ordered by memcmp(). +// +// Two NULL values are considered equal by this function. +func Xsqlite3MemCompare(tls *libc.TLS, pMem1 uintptr, pMem2 uintptr, pColl uintptr) int32 { /* sqlite3.c:83230:20: */ + var f1 int32 + var f2 int32 + var combined_flags int32 + + f1 = int32((*Mem)(unsafe.Pointer(pMem1)).Fflags) + f2 = int32((*Mem)(unsafe.Pointer(pMem2)).Fflags) + combined_flags = (f1 | f2) + + // If one value is NULL, it is less than the other. If both values + // are NULL, return 0. + if (combined_flags & MEM_Null) != 0 { + return ((f2 & MEM_Null) - (f1 & MEM_Null)) + } + + // At least one of the two values is a number + if (combined_flags & ((MEM_Int | MEM_Real) | MEM_IntReal)) != 0 { + + if ((f1 & f2) & (MEM_Int | MEM_IntReal)) != 0 { + + if *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) < *(*I64)(unsafe.Pointer(pMem2 /* &.u */)) { + return -1 + } + if *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) > *(*I64)(unsafe.Pointer(pMem2 /* &.u */)) { + return +1 + } + return 0 + } + if ((f1 & f2) & MEM_Real) != 0 { + if *(*float64)(unsafe.Pointer(pMem1 /* &.u */)) < *(*float64)(unsafe.Pointer(pMem2 /* &.u */)) { + return -1 + } + if *(*float64)(unsafe.Pointer(pMem1 /* &.u */)) > *(*float64)(unsafe.Pointer(pMem2 /* &.u */)) { + return +1 + } + return 0 + } + if (f1 & (MEM_Int | MEM_IntReal)) != 0 { + + if (f2 & MEM_Real) != 0 { + return sqlite3IntFloatCompare(tls, *(*I64)(unsafe.Pointer(pMem1 /* &.u */)), *(*float64)(unsafe.Pointer(pMem2 /* &.u */))) + } else if (f2 & (MEM_Int | MEM_IntReal)) != 0 { + if *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) < *(*I64)(unsafe.Pointer(pMem2 /* &.u */)) { + return -1 + } + if *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) > *(*I64)(unsafe.Pointer(pMem2 /* &.u */)) { + return +1 + } + return 0 + } else { + return -1 + } + } + if (f1 & MEM_Real) != 0 { + if (f2 & (MEM_Int | MEM_IntReal)) != 0 { + + return -sqlite3IntFloatCompare(tls, *(*I64)(unsafe.Pointer(pMem2 /* &.u */)), *(*float64)(unsafe.Pointer(pMem1 /* &.u */))) + } else { + return -1 + } + } + return +1 + } + + // If one value is a string and the other is a blob, the string is less. + // If both are strings, compare using the collating functions. + if (combined_flags & MEM_Str) != 0 { + if (f1 & MEM_Str) == 0 { + return 1 + } + if (f2 & MEM_Str) == 0 { + return -1 + } + + // The collation sequence must be defined at this point, even if + // the user deletes the collation sequence after the vdbe program is + // compiled (this was not always the case). + + if pColl != 0 { + return vdbeCompareMemString(tls, pMem1, pMem2, pColl, uintptr(0)) + } + // If a NULL pointer was passed as the collate function, fall through + // to the blob case and use memcmp(). + } + + // Both values must be blobs. Compare using memcmp(). + return Xsqlite3BlobCompare(tls, pMem1, pMem2) +} + +// The first argument passed to this function is a serial-type that +// corresponds to an integer - all values between 1 and 9 inclusive +// except 7. The second points to a buffer containing an integer value +// serialized according to serial_type. This function deserializes +// and returns the value. +func vdbeRecordDecodeInt(tls *libc.TLS, serial_type U32, aKey uintptr) I64 { /* sqlite3.c:83329:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var y U32 at bp, 4 + + switch serial_type { + case U32(0): + fallthrough + case U32(1): + + return I64(I8(*(*U8)(unsafe.Pointer((aKey))))) + case U32(2): + + return (I64((256 * int32((I8(*(*U8)(unsafe.Pointer((aKey))))))) | int32(*(*U8)(unsafe.Pointer((aKey) + 1))))) + case U32(3): + + return (I64(((65536 * int32((I8(*(*U8)(unsafe.Pointer((aKey))))))) | (int32(*(*U8)(unsafe.Pointer((aKey) + 1))) << 8)) | int32(*(*U8)(unsafe.Pointer((aKey) + 2))))) + case U32(4): + { + + *(*U32)(unsafe.Pointer(bp /* y */)) = ((((U32(*(*U8)(unsafe.Pointer((aKey)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey) + 3)))) + return I64(*(*int32)(unsafe.Pointer(bp /* &y */))) + + } + case U32(5): + { + + return ((I64((((U32(*(*U8)(unsafe.Pointer((aKey + uintptr(2))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(2)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(2)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey + uintptr(2)) + 3))))) + ((I64((int64(1))) << 32) * (I64((256 * int32((I8(*(*U8)(unsafe.Pointer((aKey))))))) | int32(*(*U8)(unsafe.Pointer((aKey) + 1))))))) + + } + case U32(6): + { + *(*U64)(unsafe.Pointer(bp + 8 /* x */)) = (U64((((U32(*(*U8)(unsafe.Pointer((aKey)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey) + 3))))) + + *(*U64)(unsafe.Pointer(bp + 8 /* x */)) = ((*(*U64)(unsafe.Pointer(bp + 8 /* x */)) << 32) | (U64((((U32(*(*U8)(unsafe.Pointer((aKey + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey + uintptr(4)) + 3)))))) + return *(*I64)(unsafe.Pointer(bp + 8 /* &x */)) + + } + } + + return (I64(serial_type - U32(8))) +} + +// This function compares the two table rows or index records +// specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero +// or positive integer if key1 is less than, equal to or +// greater than key2. The {nKey1, pKey1} key must be a blob +// created by the OP_MakeRecord opcode of the VDBE. The pPKey2 +// key must be a parsed key such as obtained from +// sqlite3VdbeParseRecord. +// +// If argument bSkip is non-zero, it is assumed that the caller has already +// determined that the first fields of the keys are equal. +// +// Key1 and Key2 do not have to contain the same number of fields. If all +// fields that appear in both keys are equal, then pPKey2->default_rc is +// returned. +// +// If database corruption is discovered, set pPKey2->errCode to +// SQLITE_CORRUPT and return 0. If an OOM error is encountered, +// pPKey2->errCode is set to SQLITE_NOMEM and, if it is not NULL, the +// malloc-failed flag set on database handle (pPKey2->pKeyInfo->db). +func Xsqlite3VdbeRecordCompareWithSkip(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr, bSkip int32) int32 { /* sqlite3.c:83384:20: */ + bp := tls.Alloc(68) + defer tls.Free(68) + + var d1 U32 // Offset into aKey[] of next data element + var i int32 // Index of next field to compare + // var szHdr1 U32 at bp+4, 4 + // Size of record header in bytes + var idx1 U32 // Offset of first type in header + var rc int32 = 0 // Return value + var pRhs uintptr = (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem // Next field of pPKey2 to compare + var pKeyInfo uintptr + var aKey1 uintptr = pKey1 + // var mem1 Mem at bp+8, 56 + + // If bSkip is true, then the caller has already determined that the first + // two elements in the keys are equal. Fix the various stack variables so + // that this routine begins comparing at the second field. + if bSkip != 0 { + // var s1 U32 at bp, 4 + + idx1 = (U32(1 + int32((func() uint8 { + if int32(*(*uint8)(unsafe.Pointer((aKey1 + 1)))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*U32)(unsafe.Pointer(bp /* s1 */))) = U32(*(*uint8)(unsafe.Pointer((aKey1 + 1)))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, (aKey1 + 1), bp /* &s1 */) + }())))) + *(*U32)(unsafe.Pointer(bp + 4 /* szHdr1 */)) = U32(*(*uint8)(unsafe.Pointer(aKey1))) + d1 = (*(*U32)(unsafe.Pointer(bp + 4 /* szHdr1 */)) + Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp /* s1 */)))) + i = 1 + pRhs += 56 + } else { + idx1 = U32(func() uint8 { + if int32(*(*uint8)(unsafe.Pointer(aKey1))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*U32)(unsafe.Pointer(bp + 4 /* szHdr1 */))) = U32(*(*uint8)(unsafe.Pointer(aKey1))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, aKey1, bp+4 /* &szHdr1 */) + }()) + d1 = *(*U32)(unsafe.Pointer(bp + 4 /* szHdr1 */)) + i = 0 + } + if d1 > uint32(nKey1) { + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = U8(Xsqlite3CorruptError(tls, 83415)) + return 0 // Corruption + } + + for ok := true; ok; ok = ((idx1 < *(*U32)(unsafe.Pointer(bp + 4 /* szHdr1 */))) && (d1 <= uint32(nKey1))) { + // var serial_type U32 at bp+64, 4 + + // RHS is an integer + if (int32((*Mem)(unsafe.Pointer(pRhs)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { + + *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) = U32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + + if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) >= U32(10) { + rc = +1 + } else if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) == U32(0) { + rc = -1 + } else if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) == U32(7) { + Xsqlite3VdbeSerialGet(tls, (aKey1 + uintptr(d1)), *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)), bp+8 /* &mem1 */) + rc = -sqlite3IntFloatCompare(tls, *(*I64)(unsafe.Pointer(pRhs /* &.u */)), *(*float64)(unsafe.Pointer(bp + 8 /* &mem1 */ /* &.u */))) + } else { + var lhs I64 = vdbeRecordDecodeInt(tls, *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)), (aKey1 + uintptr(d1))) + var rhs I64 = *(*I64)(unsafe.Pointer(pRhs /* &.u */)) + if lhs < rhs { + rc = -1 + } else if lhs > rhs { + rc = +1 + } + } + } else if (int32((*Mem)(unsafe.Pointer(pRhs)).Fflags) & MEM_Real) != 0 { + *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) = U32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) >= U32(10) { + // Serial types 12 or greater are strings and blobs (greater than + // numbers). Types 10 and 11 are currently "reserved for future + // use", so it doesn't really matter what the results of comparing + // them to numberic values are. + rc = +1 + } else if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) == U32(0) { + rc = -1 + } else { + Xsqlite3VdbeSerialGet(tls, (aKey1 + uintptr(d1)), *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)), bp+8 /* &mem1 */) + if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) == U32(7) { + if *(*float64)(unsafe.Pointer(bp + 8 /* &mem1 */ /* &.u */)) < *(*float64)(unsafe.Pointer(pRhs /* &.u */)) { + rc = -1 + } else if *(*float64)(unsafe.Pointer(bp + 8 /* &mem1 */ /* &.u */)) > *(*float64)(unsafe.Pointer(pRhs /* &.u */)) { + rc = +1 + } + } else { + rc = sqlite3IntFloatCompare(tls, *(*I64)(unsafe.Pointer(bp + 8 /* &mem1 */ /* &.u */)), *(*float64)(unsafe.Pointer(pRhs /* &.u */))) + } + } + } else if (int32((*Mem)(unsafe.Pointer(pRhs)).Fflags) & MEM_Str) != 0 { + *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) = U32(*(*uint8)(unsafe.Pointer((aKey1 + uintptr(idx1))))) + if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) >= U32(0x80) { + Xsqlite3GetVarint32(tls, (aKey1 + uintptr(idx1)), bp+64 /* &serial_type */) + } + + if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) < U32(12) { + rc = -1 + } else if !((*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) & U32(0x01)) != 0) { + rc = +1 + } else { + (*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fn = (int32((*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) - U32(12)) / U32(2))) + + if ((d1 + U32((*Mem)(unsafe.Pointer(bp+8 /* &mem1 */)).Fn)) > uint32(nKey1)) || + (int32((*KeyInfo)(unsafe.Pointer((libc.AssignUintptr(&pKeyInfo, (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FpKeyInfo)))).FnAllField) <= i) { + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = U8(Xsqlite3CorruptError(tls, 83492)) + return 0 // Corruption + } else if *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(i)*8)) != 0 { + (*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fenc = (*KeyInfo)(unsafe.Pointer(pKeyInfo)).Fenc + (*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fdb = (*KeyInfo)(unsafe.Pointer(pKeyInfo)).Fdb + (*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fflags = U16(MEM_Str) + (*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fz = (aKey1 + uintptr(d1)) + rc = vdbeCompareMemString(tls, + bp+8 /* &mem1 */, pRhs, *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(i)*8)), (pPKey2 + 19 /* &.errCode */)) + } else { + var nCmp int32 = func() int32 { + if ((*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fn) < ((*Mem)(unsafe.Pointer(pRhs)).Fn) { + return (*Mem)(unsafe.Pointer(bp + 8 /* &mem1 */)).Fn + } + return (*Mem)(unsafe.Pointer(pRhs)).Fn + }() + rc = libc.Xmemcmp(tls, (aKey1 + uintptr(d1)), (*Mem)(unsafe.Pointer(pRhs)).Fz, uint64(nCmp)) + if rc == 0 { + rc = ((*Mem)(unsafe.Pointer(bp+8 /* &mem1 */)).Fn - (*Mem)(unsafe.Pointer(pRhs)).Fn) + } + } + } + } else if (int32((*Mem)(unsafe.Pointer(pRhs)).Fflags) & MEM_Blob) != 0 { + + *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) = U32(*(*uint8)(unsafe.Pointer((aKey1 + uintptr(idx1))))) + if *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) >= U32(0x80) { + Xsqlite3GetVarint32(tls, (aKey1 + uintptr(idx1)), bp+64 /* &serial_type */) + } + + if (*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) < U32(12)) || ((*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) & U32(0x01)) != 0) { + rc = -1 + } else { + var nStr int32 = (int32((*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) - U32(12)) / U32(2))) + + if (d1 + U32(nStr)) > uint32(nKey1) { + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = U8(Xsqlite3CorruptError(tls, 83522)) + return 0 // Corruption + } else if (int32((*Mem)(unsafe.Pointer(pRhs)).Fflags) & MEM_Zero) != 0 { + if !(isAllZero(tls, (aKey1+uintptr(d1)), nStr) != 0) { + rc = 1 + } else { + rc = (nStr - *(*int32)(unsafe.Pointer(pRhs /* &.u */))) + } + } else { + var nCmp int32 = func() int32 { + if (nStr) < ((*Mem)(unsafe.Pointer(pRhs)).Fn) { + return nStr + } + return (*Mem)(unsafe.Pointer(pRhs)).Fn + }() + rc = libc.Xmemcmp(tls, (aKey1 + uintptr(d1)), (*Mem)(unsafe.Pointer(pRhs)).Fz, uint64(nCmp)) + if rc == 0 { + rc = (nStr - (*Mem)(unsafe.Pointer(pRhs)).Fn) + } + } + } + } else { + *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) = U32(*(*uint8)(unsafe.Pointer(aKey1 + uintptr(idx1)))) + rc = (libc.Bool32(*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) != U32(0))) + } + + if rc != 0 { + var sortFlags int32 = int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FpKeyInfo)).FaSortFlags + uintptr(i)))) + if sortFlags != 0 { + if ((sortFlags & KEYINFO_ORDER_BIGNULL) == 0) || + ((sortFlags & KEYINFO_ORDER_DESC) != + (libc.Bool32((*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)) == U32(0)) || ((int32((*Mem)(unsafe.Pointer(pRhs)).Fflags) & MEM_Null) != 0)))) { + rc = -rc + } + } + + // See comment below + return rc + } + + i++ + if i == int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FnField) { + break + } + pRhs += 56 + d1 = d1 + (Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)))) + idx1 = idx1 + (U32(Xsqlite3VarintLen(tls, uint64(*(*U32)(unsafe.Pointer(bp + 64 /* serial_type */)))))) + } + + // No memory allocation is ever used on mem1. Prove this using + // the following assert(). If the assert() fails, it indicates a + // memory leak and a need to call sqlite3VdbeMemRelease(&mem1). + + // rc==0 here means that one or both of the keys ran out of fields and + // all the fields up to that point were equal. Return the default_rc + // value. + + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = U8(1) + return int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) +} + +func Xsqlite3VdbeRecordCompare(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) int32 { /* sqlite3.c:83581:20: */ + return Xsqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, pPKey2, 0) +} + +// This function is an optimized version of sqlite3VdbeRecordCompare() +// that (a) the first field of pPKey2 is an integer, and (b) the +// size-of-header varint at the start of (pKey1/nKey1) fits in a single +// byte (i.e. is less than 128). +// +// To avoid concerns about buffer overreads, this routine is only used +// on schemas where the maximum valid header size is 63 bytes or less. +func vdbeRecordCompareInt(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) int32 { /* sqlite3.c:83598:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var aKey uintptr = ((pKey1) + uintptr((int32(*(*U8)(unsafe.Pointer(pKey1))) & 0x3F))) + var serial_type int32 = int32(*(*U8)(unsafe.Pointer((pKey1) + 1))) + var res int32 + // var y U32 at bp, 4 + + // var x U64 at bp+8, 8 + + var v I64 + var lhs I64 + + switch serial_type { + case 1: + { // 1-byte signed integer + lhs = I64(I8(*(*U8)(unsafe.Pointer((aKey))))) + + break + + } + case 2: + { // 2-byte signed integer + lhs = (I64((256 * int32((I8(*(*U8)(unsafe.Pointer((aKey))))))) | int32(*(*U8)(unsafe.Pointer((aKey) + 1))))) + + break + + } + case 3: + { // 3-byte signed integer + lhs = (I64(((65536 * int32((I8(*(*U8)(unsafe.Pointer((aKey))))))) | (int32(*(*U8)(unsafe.Pointer((aKey) + 1))) << 8)) | int32(*(*U8)(unsafe.Pointer((aKey) + 2))))) + + break + + } + case 4: + { // 4-byte signed integer + *(*U32)(unsafe.Pointer(bp /* y */)) = ((((U32(*(*U8)(unsafe.Pointer((aKey)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey) + 3)))) + lhs = I64(*(*int32)(unsafe.Pointer(bp /* &y */))) + + break + + } + case 5: + { // 6-byte signed integer + lhs = ((I64((((U32(*(*U8)(unsafe.Pointer((aKey + uintptr(2))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(2)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(2)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey + uintptr(2)) + 3))))) + ((I64((int64(1))) << 32) * (I64((256 * int32((I8(*(*U8)(unsafe.Pointer((aKey))))))) | int32(*(*U8)(unsafe.Pointer((aKey) + 1))))))) + + break + + } + case 6: + { // 8-byte signed integer + *(*U64)(unsafe.Pointer(bp + 8 /* x */)) = (U64((((U32(*(*U8)(unsafe.Pointer((aKey)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey) + 3))))) + *(*U64)(unsafe.Pointer(bp + 8 /* x */)) = ((*(*U64)(unsafe.Pointer(bp + 8 /* x */)) << 32) | (U64((((U32(*(*U8)(unsafe.Pointer((aKey + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aKey + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aKey + uintptr(4)) + 3)))))) + lhs = *(*I64)(unsafe.Pointer(bp + 8 /* &x */)) + + break + + } + case 8: + lhs = int64(0) + break + case 9: + lhs = int64(1) + break + + // This case could be removed without changing the results of running + // this code. Including it causes gcc to generate a faster switch + // statement (since the range of switch targets now starts at zero and + // is contiguous) but does not cause any duplicate code to be generated + // (as gcc is clever enough to combine the two like cases). Other + // compilers might be similar. + case 0: + fallthrough + case 7: + return Xsqlite3VdbeRecordCompare(tls, nKey1, pKey1, pPKey2) + + default: + return Xsqlite3VdbeRecordCompare(tls, nKey1, pKey1, pPKey2) + } + + v = *(*I64)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem /* &.u */)) + if v > lhs { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) + } else if v < lhs { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) + } else if int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FnField) > 1 { + // The first fields of the two keys are equal. Compare the trailing + // fields. + res = Xsqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, pPKey2, 1) + } else { + // The first fields of the two keys are equal and there are no trailing + // fields. Return pPKey2->default_rc in this case. + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = U8(1) + } + + return res +} + +// This function is an optimized version of sqlite3VdbeRecordCompare() +// that (a) the first field of pPKey2 is a string, that (b) the first field +// uses the collation sequence BINARY and (c) that the size-of-header varint +// at the start of (pKey1/nKey1) fits in a single byte. +func vdbeRecordCompareString(tls *libc.TLS, nKey1 int32, pKey1 uintptr, pPKey2 uintptr) int32 { /* sqlite3.c:83692:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aKey1 uintptr = pKey1 + // var serial_type int32 at bp, 4 + + var res int32 + + *(*int32)(unsafe.Pointer(bp /* serial_type */)) = int32(*(*U8)(unsafe.Pointer(aKey1 + 1))) + if *(*int32)(unsafe.Pointer(bp /* serial_type */)) >= 0x80 { + Xsqlite3GetVarint32(tls, (aKey1 + 1), bp /* &serial_type */) + } + if *(*int32)(unsafe.Pointer(bp /* serial_type */)) < 12 { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) // (pKey1/nKey1) is a number or a null + } else if !((*(*int32)(unsafe.Pointer(bp /* serial_type */)) & 0x01) != 0) { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) // (pKey1/nKey1) is a blob + } else { + var nCmp int32 + var nStr int32 + var szHdr int32 = int32(*(*U8)(unsafe.Pointer(aKey1))) + + nStr = ((*(*int32)(unsafe.Pointer(bp /* serial_type */)) - 12) / 2) + if (szHdr + nStr) > nKey1 { + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FerrCode = U8(Xsqlite3CorruptError(tls, 83717)) + return 0 // Corruption + } + nCmp = func() int32 { + if ((*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem)).Fn) < (nStr) { + return (*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem)).Fn + } + return nStr + }() + res = libc.Xmemcmp(tls, (aKey1 + uintptr(szHdr)), (*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem)).Fz, uint64(nCmp)) + + if res > 0 { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) + } else if res < 0 { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) + } else { + res = (nStr - (*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FaMem)).Fn) + if res == 0 { + if int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).FnField) > 1 { + res = Xsqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, pPKey2, 1) + } else { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fdefault_rc) + (*UnpackedRecord)(unsafe.Pointer(pPKey2)).FeqSeen = U8(1) + } + } else if res > 0 { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr2) + } else { + res = int32((*UnpackedRecord)(unsafe.Pointer(pPKey2)).Fr1) + } + } + } + + return res +} + +// Return a pointer to an sqlite3VdbeRecordCompare() compatible function +// suitable for comparing serialized records to the unpacked record passed +// as the only argument. +func Xsqlite3VdbeFindCompare(tls *libc.TLS, p uintptr) RecordCompare { /* sqlite3.c:83756:30: */ + // varintRecordCompareInt() and varintRecordCompareString() both assume + // that the size-of-header varint that occurs at the start of each record + // fits in a single byte (i.e. is 127 or less). varintRecordCompareInt() + // also assumes that it is safe to overread a buffer by at least the + // maximum possible legal header size plus 8 bytes. Because there is + // guaranteed to be at least 74 (but not 136) bytes of padding following each + // buffer passed to varintRecordCompareInt() this makes it convenient to + // limit the size of the header to 64 bytes in cases where the first field + // is an integer. + // + // The easiest way to enforce this limit is to consider only records with + // 13 fields or less. If the first field is an integer, the maximum legal + // header size is (12*5 + 1 + 1) bytes. + if int32((*KeyInfo)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo)).FnAllField) <= 13 { + var flags int32 = int32((*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(p)).FaMem)).Fflags) + if *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo)).FaSortFlags)) != 0 { + if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo)).FaSortFlags))) & KEYINFO_ORDER_BIGNULL) != 0 { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr, uintptr) int32 + }{Xsqlite3VdbeRecordCompare})) + } + (*UnpackedRecord)(unsafe.Pointer(p)).Fr1 = int8(1) + (*UnpackedRecord)(unsafe.Pointer(p)).Fr2 = int8(-1) + } else { + (*UnpackedRecord)(unsafe.Pointer(p)).Fr1 = int8(-1) + (*UnpackedRecord)(unsafe.Pointer(p)).Fr2 = int8(1) + } + if (flags & MEM_Int) != 0 { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr, uintptr) int32 + }{vdbeRecordCompareInt})) + } + + if ((flags & (((MEM_Real | MEM_IntReal) | MEM_Null) | MEM_Blob)) == 0) && + (*(*uintptr)(unsafe.Pointer(((*UnpackedRecord)(unsafe.Pointer(p)).FpKeyInfo + 32 /* &.aColl */))) == uintptr(0)) { + + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr, uintptr) int32 + }{vdbeRecordCompareString})) + } + } + + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr, uintptr) int32 + }{Xsqlite3VdbeRecordCompare})) +} + +// pCur points at an index entry created using the OP_MakeRecord opcode. +// Read the rowid (the last field in the record) and store it in *rowid. +// Return SQLITE_OK if everything works, or an error code otherwise. +// +// pCur might be pointing to text obtained from a corrupt database file. +// So the content cannot be trusted. Do appropriate checks on the content. +func Xsqlite3VdbeIdxRowid(tls *libc.TLS, db uintptr, pCur uintptr, rowid uintptr) int32 { /* sqlite3.c:83807:20: */ + bp := tls.Alloc(120) + defer tls.Free(120) + + var nCellKey I64 + var rc int32 + // var szHdr U32 at bp+56, 4 + // Size of the header + // var typeRowid U32 at bp+60, 4 + // Serial type of the rowid + var lenRowid U32 // Size of the rowid + // var m Mem at bp, 56 + + // var v Mem at bp+64, 56 + nCellKey = int64(0) + + // Get the size of the index entry. Only indices entries of less + // than 2GiB are support - anything large must be database corruption. + // Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so + // this code can safely assume that nCellKey is 32-bits + + nCellKey = I64(Xsqlite3BtreePayloadSize(tls, pCur)) + + // Read in the complete content of the index entry + Xsqlite3VdbeMemInit(tls, bp /* &m */, db, uint16(0)) + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, U32(nCellKey), bp /* &m */) + if !(rc != 0) { + goto __1 + } + return rc +__1: + ; + + // The index entry must begin with a header size + *(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) = U32(*(*U8)(unsafe.Pointer((*Mem)(unsafe.Pointer(bp /* &m */)).Fz))) + if !(*(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) >= U32(0x80)) { + goto __2 + } + Xsqlite3GetVarint32(tls, (*Mem)(unsafe.Pointer(bp /* &m */)).Fz, bp+56 /* &szHdr */) +__2: + ; + + if !((*(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) < U32(3)) || (*(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) > uint32((*Mem)(unsafe.Pointer(bp /* &m */)).Fn))) { + goto __3 + } + goto idx_rowid_corruption +__3: + ; + + // The last field of the index should be an integer - the ROWID. + // Verify that the last entry really is an integer. + *(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */)) = U32(*(*U8)(unsafe.Pointer(((*Mem)(unsafe.Pointer(bp /* &m */)).Fz + uintptr((*(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) - U32(1))))))) + if !(*(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */)) >= U32(0x80)) { + goto __4 + } + Xsqlite3GetVarint32(tls, ((*Mem)(unsafe.Pointer(bp /* &m */)).Fz + uintptr((*(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) - U32(1)))), bp+60 /* &typeRowid */) +__4: + ; + + if !(((*(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */)) < U32(1)) || (*(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */)) > U32(9))) || (*(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */)) == U32(7))) { + goto __5 + } + goto idx_rowid_corruption +__5: + ; + lenRowid = U32(sqlite3SmallTypeSizes[*(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */))]) + + if !(U32((*Mem)(unsafe.Pointer(bp /* &m */)).Fn) < (*(*U32)(unsafe.Pointer(bp + 56 /* szHdr */)) + lenRowid)) { + goto __6 + } + goto idx_rowid_corruption +__6: + ; + + // Fetch the integer off the end of the index record + Xsqlite3VdbeSerialGet(tls, ((*Mem)(unsafe.Pointer(bp /* &m */)).Fz + uintptr((U32((*Mem)(unsafe.Pointer(bp /* &m */)).Fn) - lenRowid))), *(*U32)(unsafe.Pointer(bp + 60 /* typeRowid */)), bp+64 /* &v */) + *(*I64)(unsafe.Pointer(rowid)) = *(*I64)(unsafe.Pointer(bp + 64 /* &v */ /* &.u */)) + Xsqlite3VdbeMemRelease(tls, bp /* &m */) + return SQLITE_OK + + // Jump here if database corruption is detected after m has been + // allocated. Free the m object and return SQLITE_CORRUPT. +idx_rowid_corruption: + ; + Xsqlite3VdbeMemRelease(tls, bp /* &m */) + return Xsqlite3CorruptError(tls, 83872) +} + +// Compare the key of the index entry that cursor pC is pointing to against +// the key string in pUnpacked. Write into *pRes a number +// that is negative, zero, or positive if pC is less than, equal to, +// or greater than pUnpacked. Return SQLITE_OK on success. +// +// pUnpacked is either created without a rowid or is truncated so that it +// omits the rowid at the end. The rowid at the end of the index entry +// is ignored as well. Hence, this routine only compares the prefixes +// of the keys prior to the final rowid, not the entire key. +func Xsqlite3VdbeIdxKeyCompare(tls *libc.TLS, db uintptr, pC uintptr, pUnpacked uintptr, res uintptr) int32 { /* sqlite3.c:83886:20: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var nCellKey I64 = int64(0) + var rc int32 + var pCur uintptr + // var m Mem at bp, 56 + + pCur = *(*uintptr)(unsafe.Pointer(pC + 56 /* &.uc */)) + + nCellKey = I64(Xsqlite3BtreePayloadSize(tls, pCur)) + // nCellKey will always be between 0 and 0xffffffff because of the way + // that btreeParseCellPtr() and sqlite3GetVarint32() are implemented + if (nCellKey <= int64(0)) || (nCellKey > int64(0x7fffffff)) { + *(*int32)(unsafe.Pointer(res)) = 0 + return Xsqlite3CorruptError(tls, 83905) + } + Xsqlite3VdbeMemInit(tls, bp /* &m */, db, uint16(0)) + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, pCur, U32(nCellKey), bp /* &m */) + if rc != 0 { + return rc + } + *(*int32)(unsafe.Pointer(res)) = Xsqlite3VdbeRecordCompareWithSkip(tls, (*Mem)(unsafe.Pointer(bp /* &m */)).Fn, (*Mem)(unsafe.Pointer(bp /* &m */)).Fz, pUnpacked, 0) + Xsqlite3VdbeMemRelease(tls, bp /* &m */) + return SQLITE_OK +} + +// This routine sets the value to be returned by subsequent calls to +// sqlite3_changes() on the database handle 'db'. +func Xsqlite3VdbeSetChanges(tls *libc.TLS, db uintptr, nChange int32) { /* sqlite3.c:83921:21: */ + + (*Sqlite3)(unsafe.Pointer(db)).FnChange = nChange + *(*int32)(unsafe.Pointer(db + 124 /* &.nTotalChange */)) += (nChange) +} + +// Set a flag in the vdbe to update the change counter when it is finalised +// or reset. +func Xsqlite3VdbeCountChanges(tls *libc.TLS, v uintptr) { /* sqlite3.c:83931:21: */ + libc.SetBitFieldPtr16Uint32(v+200 /* &.changeCntOn */, Bft(1), 4, 0x10) +} + +// Mark every prepared statement associated with a database connection +// as expired. +// +// An expired statement means that recompilation of the statement is +// recommend. Statements expire when things happen that make their +// programs obsolete. Removing user-defined functions or collating +// sequences, or changing an authorization function are the types of +// things that make prepared statements obsolete. +// +// If iCode is 1, then expiration is advisory. The statement should +// be reprepared before being restarted, but if it is already running +// it is allowed to run to completion. +// +// Internally, this function just sets the Vdbe.expired flag on all +// prepared statements. The flag is set to 1 for an immediate expiration +// and set to 2 for an advisory expiration. +func Xsqlite3ExpirePreparedStatements(tls *libc.TLS, db uintptr, iCode int32) { /* sqlite3.c:83953:21: */ + var p uintptr + for p = (*Sqlite3)(unsafe.Pointer(db)).FpVdbe; p != 0; p = (*Vdbe)(unsafe.Pointer(p)).FpNext { + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, (Bft(iCode + 1)), 0, 0x3) + } +} + +// Return the database associated with the Vdbe. +func Xsqlite3VdbeDb(tls *libc.TLS, v uintptr) uintptr { /* sqlite3.c:83963:24: */ + return (*Vdbe)(unsafe.Pointer(v)).Fdb +} + +// Return the SQLITE_PREPARE flags for a Vdbe. +func Xsqlite3VdbePrepareFlags(tls *libc.TLS, v uintptr) U8 { /* sqlite3.c:83970:19: */ + return (*Vdbe)(unsafe.Pointer(v)).FprepFlags +} + +// Return a pointer to an sqlite3_value structure containing the value bound +// parameter iVar of VM v. Except, if the value is an SQL NULL, return +// 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* +// constants) to the value before returning it. +// +// The returned value must be freed by the caller using sqlite3ValueFree(). +func Xsqlite3VdbeGetBoundValue(tls *libc.TLS, v uintptr, iVar int32, aff U8) uintptr { /* sqlite3.c:83982:30: */ + + if v != 0 { + var pMem uintptr = ((*Vdbe)(unsafe.Pointer(v)).FaVar + uintptr((iVar-1))*56) + + if 0 == (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) { + var pRet uintptr = Xsqlite3ValueNew(tls, (*Vdbe)(unsafe.Pointer(v)).Fdb) + if pRet != 0 { + Xsqlite3VdbeMemCopy(tls, pRet, pMem) + Xsqlite3ValueApplyAffinity(tls, pRet, aff, uint8(SQLITE_UTF8)) + } + return pRet + } + } + return uintptr(0) +} + +// Configure SQL variable iVar so that binding a new value to it signals +// to sqlite3_reoptimize() that re-preparing the statement may result +// in a better query plan. +func Xsqlite3VdbeSetVarmask(tls *libc.TLS, v uintptr, iVar int32) { /* sqlite3.c:84004:21: */ + + if iVar >= 32 { + *(*U32)(unsafe.Pointer(v + 276 /* &.expmask */)) |= (0x80000000) + } else { + *(*U32)(unsafe.Pointer(v + 276 /* &.expmask */)) |= (U32(U32(1)) << (iVar - 1)) + } +} + +// Cause a function to throw an error if it was call from OP_PureFunc +// rather than OP_Function. +// +// OP_PureFunc means that the function must be deterministic, and should +// throw an error if it is given inputs that would make it non-deterministic. +// This routine is invoked by date/time functions that use non-deterministic +// features such as 'now'. +func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pOp uintptr + if (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe == uintptr(0) { + return 1 + } + pOp = ((*Vdbe)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FaOp + uintptr((*Sqlite3_context)(unsafe.Pointer(pCtx)).FiOp)*24) + if int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_PureFunc { + var zContext uintptr + var zMsg uintptr + if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { + zContext = ts + 4281 /* "a CHECK constrai..." */ + } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { + zContext = ts + 4300 /* "a generated colu..." */ + } else { + zContext = ts + 4319 /* "an index" */ + } + zMsg = Xsqlite3_mprintf(tls, ts+4328, /* "non-deterministi..." */ + libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) + Xsqlite3_result_error(tls, pCtx, zMsg, -1) + Xsqlite3_free(tls, zMsg) + return 0 + } + return 1 +} + +// Transfer error message text from an sqlite3_vtab.zErrMsg (text stored +// in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored +// in memory obtained from sqlite3DbMalloc). +func Xsqlite3VtabImportErrmsg(tls *libc.TLS, p uintptr, pVtab uintptr) { /* sqlite3.c:84054:21: */ + if (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg != 0 { + var db uintptr = (*Vdbe)(unsafe.Pointer(p)).Fdb + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) + Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = uintptr(0) + } +} + +// If the second argument is not NULL, release any allocations associated +// with the memory cells in the p->aMem[] array. Also free the UnpackedRecord +// structure itself, using sqlite3DbFree(). +// +// This function is used to free UnpackedRecord structures allocated by +// the vdbeUnpackRecord() function found in vdbeapi.c. +func vdbeFreeUnpacked(tls *libc.TLS, db uintptr, nField int32, p uintptr) { /* sqlite3.c:84075:13: */ + if p != 0 { + var i int32 + for i = 0; i < nField; i++ { + var pMem uintptr = ((*UnpackedRecord)(unsafe.Pointer(p)).FaMem + uintptr(i)*56) + if (*Mem)(unsafe.Pointer(pMem)).FzMalloc != 0 { + Xsqlite3VdbeMemRelease(tls, pMem) + } + } + Xsqlite3DbFreeNN(tls, db, p) + } +} + +// Invoke the pre-update hook. If this is an UPDATE or DELETE pre-update call, +// then cursor passed as the second argument should point to the row about +// to be update or deleted. If the application calls sqlite3_preupdate_old(), +// the required value will be read from the row the cursor points to. +func Xsqlite3VdbePreUpdateHook(tls *libc.TLS, v uintptr, pCsr uintptr, op int32, zDb uintptr, pTab uintptr, iKey1 I64, iReg int32, iBlobWrite int32) { /* sqlite3.c:84094:21: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var db uintptr = (*Vdbe)(unsafe.Pointer(v)).Fdb + var iKey2 I64 + // var preupdate PreUpdate at bp, 136 + + var zTbl uintptr = (*Table)(unsafe.Pointer(pTab)).FzName + + libc.Xmemset(tls, bp /* &preupdate */, 0, uint64(unsafe.Sizeof(PreUpdate{}))) + if (libc.Bool32(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) == 0 { + iKey1 = libc.AssignInt64(&iKey2, int64(0)) + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FpPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + } else { + if op == SQLITE_UPDATE { + iKey2 = *(*I64)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FaMem + uintptr(iReg)*56 /* &.u */)) + } else { + iKey2 = iKey1 + } + } + + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fv = v + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FpCsr = pCsr + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fop = op + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FiNewReg = iReg + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fkeyinfo.Fdb = db + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fkeyinfo.Fenc = (*Sqlite3)(unsafe.Pointer(db)).Fenc + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fkeyinfo.FnKeyField = U16((*Table)(unsafe.Pointer(pTab)).FnCol) + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fkeyinfo.FaSortFlags = uintptr(unsafe.Pointer(&fakeSortOrder)) + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FiKey1 = iKey1 + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FiKey2 = iKey2 + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FpTab = pTab + (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FiBlobWrite = iBlobWrite + + (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate = bp /* &preupdate */ + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64))(unsafe.Pointer((db + 336 /* &.xPreUpdateCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdateArg, db, op, zDb, zTbl, iKey1, iKey2) + (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate = uintptr(0) + Xsqlite3DbFree(tls, db, (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FaRecord) + vdbeFreeUnpacked(tls, db, (int32((*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fkeyinfo.FnKeyField) + 1), (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FpUnpacked) + vdbeFreeUnpacked(tls, db, (int32((*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).Fkeyinfo.FnKeyField) + 1), (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FpNewUnpacked) + if (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FaNew != 0 { + var i int32 + for i = 0; i < int32((*VdbeCursor)(unsafe.Pointer(pCsr)).FnField); i++ { + Xsqlite3VdbeMemRelease(tls, ((*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FaNew + uintptr(i)*56)) + } + Xsqlite3DbFreeNN(tls, db, (*PreUpdate)(unsafe.Pointer(bp /* &preupdate */)).FaNew) + } +} + +var fakeSortOrder U8 = U8(0) /* sqlite3.c:84108:19 */ + +//************* End of vdbeaux.c ******************************************** +//************* Begin file vdbeapi.c **************************************** +// 2004 May 26 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code use to implement APIs that are part of the +// VDBE. +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// Return TRUE (non-zero) of the statement supplied as an argument needs +// to be recompiled. A statement needs to be recompiled whenever the +// execution environment changes in a way that would alter the program +// that sqlite3_prepare() generates. For example, if new functions or +// collating sequences are registered or if an authorizer function is +// added or changed. +func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:16: */ + var p uintptr = pStmt + return (libc.Bool32((p == uintptr(0)) || ((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.expired */)) & 0x3 >> 0))) != 0))) +} + +// Check on a Vdbe to make sure it has not been finalized. Log +// an error and return true if it has been finalized (or is otherwise +// invalid). Return false if it is ok. +func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ + if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4364 /* "API called with ..." */, 0) + return 1 + } else { + return 0 + } + return int32(0) +} + +func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ + if p == uintptr(0) { + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4409 /* "API called with ..." */, 0) + return 1 + } else { + return vdbeSafety(tls, p) + } + return int32(0) +} + +// Invoke the profile callback. This routine is only called if we already +// know that the profile callback is defined and needs to be invoked. +func invokeProfileCallback(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:84218:29: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var iNow Sqlite3_int64 at bp, 8 + + // var iElapse Sqlite3_int64 at bp+8, 8 + + Xsqlite3OsCurrentTimeInt64(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, bp /* &iNow */) + *(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* iElapse */)) = ((*(*Sqlite3_int64)(unsafe.Pointer(bp /* iNow */)) - (*Vdbe)(unsafe.Pointer(p)).FstartTime) * int64(1000000)) + if (*Sqlite3)(unsafe.Pointer(db)).FxProfile != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, U64))(unsafe.Pointer((db + 256 /* &.xProfile */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpProfileArg, (*Vdbe)(unsafe.Pointer(p)).FzSql, uint64(*(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* iElapse */)))) + } + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmTrace) & SQLITE_TRACE_PROFILE) != 0 { + (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_PROFILE), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, bp+8 /* &iElapse */) + } + (*Vdbe)(unsafe.Pointer(p)).FstartTime = int64(0) +} + +// The checkProfileCallback(DB,P) macro checks to see if a profile callback +// is needed, and it invokes the callback if it is needed. + +// The following routine destroys a virtual machine that is created by +// the sqlite3_compile() routine. The integer returned is an SQLITE_ +// success/failure code that describes the result of executing the virtual +// machine. +// +// This routine sets the error code and string returned by +// sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). +func Xsqlite3_finalize(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84256:16: */ + var rc int32 + if pStmt == uintptr(0) { + // IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL + // pointer is a harmless no-op. + rc = SQLITE_OK + } else { + var v uintptr = pStmt + var db uintptr = (*Vdbe)(unsafe.Pointer(v)).Fdb + if vdbeSafety(tls, v) != 0 { + return Xsqlite3MisuseError(tls, 84265) + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if ((*Vdbe)(unsafe.Pointer(v)).FstartTime) > int64(0) { + invokeProfileCallback(tls, db, v) + } + + rc = Xsqlite3VdbeFinalize(tls, v) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3LeaveMutexAndCloseZombie(tls, db) + } + return rc +} + +// Terminate the current execution of an SQL statement and reset it +// back to its starting state so that it can be reused. A success code from +// the prior execution is returned. +// +// This routine sets the error code and string returned by +// sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). +func Xsqlite3_reset(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84283:16: */ + var rc int32 + if pStmt == uintptr(0) { + rc = SQLITE_OK + } else { + var v uintptr = pStmt + var db uintptr = (*Vdbe)(unsafe.Pointer(v)).Fdb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if ((*Vdbe)(unsafe.Pointer(v)).FstartTime) > int64(0) { + invokeProfileCallback(tls, db, v) + } + + rc = Xsqlite3VdbeReset(tls, v) + Xsqlite3VdbeRewind(tls, v) + + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + } + return rc +} + +// Set all the parameters in the compiled SQL statement to NULL. +func Xsqlite3_clear_bindings(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84304:16: */ + var i int32 + var rc int32 = SQLITE_OK + var p uintptr = pStmt + var mutex uintptr = (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(pStmt)).Fdb)).Fmutex + Xsqlite3_mutex_enter(tls, mutex) + for i = 0; i < int32((*Vdbe)(unsafe.Pointer(p)).FnVar); i++ { + Xsqlite3VdbeMemRelease(tls, ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56)) + (*Mem)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56)).Fflags = U16(MEM_Null) + } + + if (*Vdbe)(unsafe.Pointer(p)).Fexpmask != 0 { + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(1), 0, 0x3) + } + Xsqlite3_mutex_leave(tls, mutex) + return rc +} + +// *************************** sqlite3_value_ ******************************* +// +// The following routines extract information from a Mem or sqlite3_value +// structure. +func Xsqlite3_value_blob(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:84329:23: */ + var p uintptr = pVal + if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & (MEM_Blob | MEM_Str)) != 0 { + if (func() int32 { + if (int32((*Mem)(unsafe.Pointer((p))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, p) + } + return 0 + }()) != SQLITE_OK { + + return uintptr(0) + } + *(*U16)(unsafe.Pointer(p + 8 /* &.flags */)) |= U16((MEM_Blob)) + if (*Mem)(unsafe.Pointer(p)).Fn != 0 { + return (*Mem)(unsafe.Pointer(p)).Fz + } + return uintptr(0) + } else { + return Xsqlite3_value_text(tls, pVal) + } + return uintptr(0) +} + +func Xsqlite3_value_bytes(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:84342:16: */ + return Xsqlite3ValueBytes(tls, pVal, uint8(SQLITE_UTF8)) +} + +func Xsqlite3_value_bytes16(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:84345:16: */ + return Xsqlite3ValueBytes(tls, pVal, uint8(SQLITE_UTF16LE)) +} + +func Xsqlite3_value_double(tls *libc.TLS, pVal uintptr) float64 { /* sqlite3.c:84348:19: */ + return Xsqlite3VdbeRealValue(tls, pVal) +} + +func Xsqlite3_value_int(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:84351:16: */ + return int32(Xsqlite3VdbeIntValue(tls, pVal)) +} + +func Xsqlite3_value_int64(tls *libc.TLS, pVal uintptr) Sqlite_int64 { /* sqlite3.c:84354:25: */ + return Xsqlite3VdbeIntValue(tls, pVal) +} + +func Xsqlite3_value_subtype(tls *libc.TLS, pVal uintptr) uint32 { /* sqlite3.c:84357:25: */ + var pMem uintptr = pVal + return func() uint32 { + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Subtype) != 0 { + return uint32((*Mem)(unsafe.Pointer(pMem)).FeSubtype) + } + return uint32(0) + }() +} + +func Xsqlite3_value_pointer(tls *libc.TLS, pVal uintptr, zPType uintptr) uintptr { /* sqlite3.c:84361:17: */ + var p uintptr = pVal + if ((((int32((*Mem)(unsafe.Pointer(p)).Fflags) & ((MEM_TypeMask | MEM_Term) | MEM_Subtype)) == ((MEM_Null | MEM_Term) | MEM_Subtype)) && + (zPType != uintptr(0))) && + (int32((*Mem)(unsafe.Pointer(p)).FeSubtype) == 'p')) && + (libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(p /* &.u */)), zPType) == 0) { + return (*Mem)(unsafe.Pointer(p)).Fz + } else { + return uintptr(0) + } + return uintptr(0) +} + +func Xsqlite3_value_text(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:84374:32: */ + return Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8)) +} + +func Xsqlite3_value_text16(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:84378:23: */ + return Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE)) +} + +func Xsqlite3_value_text16be(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:84381:23: */ + return Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16BE)) +} + +func Xsqlite3_value_text16le(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:84384:23: */ + return Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE)) +} + +// EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five +// fundamental datatypes: 64-bit signed integer 64-bit IEEE floating +// point number string BLOB NULL +func Xsqlite3_value_type(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:84392:16: */ + return int32(aType[(int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fflags) & MEM_AffMask)]) +} + +var aType = [64]U8{ + U8(SQLITE_BLOB), // 0x00 (not possible) + U8(SQLITE_NULL), // 0x01 NULL + U8(SQLITE_TEXT), // 0x02 TEXT + U8(SQLITE_NULL), // 0x03 (not possible) + U8(SQLITE_INTEGER), // 0x04 INTEGER + U8(SQLITE_NULL), // 0x05 (not possible) + U8(SQLITE_INTEGER), // 0x06 INTEGER + TEXT + U8(SQLITE_NULL), // 0x07 (not possible) + U8(SQLITE_FLOAT), // 0x08 FLOAT + U8(SQLITE_NULL), // 0x09 (not possible) + U8(SQLITE_FLOAT), // 0x0a FLOAT + TEXT + U8(SQLITE_NULL), // 0x0b (not possible) + U8(SQLITE_INTEGER), // 0x0c (not possible) + U8(SQLITE_NULL), // 0x0d (not possible) + U8(SQLITE_INTEGER), // 0x0e (not possible) + U8(SQLITE_NULL), // 0x0f (not possible) + U8(SQLITE_BLOB), // 0x10 BLOB + U8(SQLITE_NULL), // 0x11 (not possible) + U8(SQLITE_TEXT), // 0x12 (not possible) + U8(SQLITE_NULL), // 0x13 (not possible) + U8(SQLITE_INTEGER), // 0x14 INTEGER + BLOB + U8(SQLITE_NULL), // 0x15 (not possible) + U8(SQLITE_INTEGER), // 0x16 (not possible) + U8(SQLITE_NULL), // 0x17 (not possible) + U8(SQLITE_FLOAT), // 0x18 FLOAT + BLOB + U8(SQLITE_NULL), // 0x19 (not possible) + U8(SQLITE_FLOAT), // 0x1a (not possible) + U8(SQLITE_NULL), // 0x1b (not possible) + U8(SQLITE_INTEGER), // 0x1c (not possible) + U8(SQLITE_NULL), // 0x1d (not possible) + U8(SQLITE_INTEGER), // 0x1e (not possible) + U8(SQLITE_NULL), // 0x1f (not possible) + U8(SQLITE_FLOAT), // 0x20 INTREAL + U8(SQLITE_NULL), // 0x21 (not possible) + U8(SQLITE_TEXT), // 0x22 INTREAL + TEXT + U8(SQLITE_NULL), // 0x23 (not possible) + U8(SQLITE_FLOAT), // 0x24 (not possible) + U8(SQLITE_NULL), // 0x25 (not possible) + U8(SQLITE_FLOAT), // 0x26 (not possible) + U8(SQLITE_NULL), // 0x27 (not possible) + U8(SQLITE_FLOAT), // 0x28 (not possible) + U8(SQLITE_NULL), // 0x29 (not possible) + U8(SQLITE_FLOAT), // 0x2a (not possible) + U8(SQLITE_NULL), // 0x2b (not possible) + U8(SQLITE_FLOAT), // 0x2c (not possible) + U8(SQLITE_NULL), // 0x2d (not possible) + U8(SQLITE_FLOAT), // 0x2e (not possible) + U8(SQLITE_NULL), // 0x2f (not possible) + U8(SQLITE_BLOB), // 0x30 (not possible) + U8(SQLITE_NULL), // 0x31 (not possible) + U8(SQLITE_TEXT), // 0x32 (not possible) + U8(SQLITE_NULL), // 0x33 (not possible) + U8(SQLITE_FLOAT), // 0x34 (not possible) + U8(SQLITE_NULL), // 0x35 (not possible) + U8(SQLITE_FLOAT), // 0x36 (not possible) + U8(SQLITE_NULL), // 0x37 (not possible) + U8(SQLITE_FLOAT), // 0x38 (not possible) + U8(SQLITE_NULL), // 0x39 (not possible) + U8(SQLITE_FLOAT), // 0x3a (not possible) + U8(SQLITE_NULL), // 0x3b (not possible) + U8(SQLITE_FLOAT), // 0x3c (not possible) + U8(SQLITE_NULL), // 0x3d (not possible) + U8(SQLITE_FLOAT), // 0x3e (not possible) + U8(SQLITE_NULL), // 0x3f (not possible) +} /* sqlite3.c:84393:19 */ + +// Return true if a parameter to xUpdate represents an unchanged column +func Xsqlite3_value_nochange(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:84478:16: */ + return (libc.Bool32((int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fflags) & (MEM_Null | MEM_Zero)) == (MEM_Null | MEM_Zero))) +} + +// Return true if a parameter value originated from an sqlite3_bind() +func Xsqlite3_value_frombind(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:84483:16: */ + return (libc.Bool32((int32((*Sqlite3_value)(unsafe.Pointer(pVal)).Fflags) & MEM_FromBind) != 0)) +} + +// Make a copy of an sqlite3_value object +func Xsqlite3_value_dup(tls *libc.TLS, pOrig uintptr) uintptr { /* sqlite3.c:84489:26: */ + var pNew uintptr + if pOrig == uintptr(0) { + return uintptr(0) + } + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_value{}))) + if pNew == uintptr(0) { + return uintptr(0) + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_value{}))) + libc.Xmemcpy(tls, pNew, pOrig, uint64((uintptr(0) + 24 /* &.zMalloc */))) + *(*U16)(unsafe.Pointer(pNew + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Dyn))) + (*Sqlite3_value)(unsafe.Pointer(pNew)).Fdb = uintptr(0) + if (int32((*Sqlite3_value)(unsafe.Pointer(pNew)).Fflags) & (MEM_Str | MEM_Blob)) != 0 { + *(*U16)(unsafe.Pointer(pNew + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32((MEM_Static | MEM_Dyn)))) + *(*U16)(unsafe.Pointer(pNew + 8 /* &.flags */)) |= U16((MEM_Ephem)) + if Xsqlite3VdbeMemMakeWriteable(tls, pNew) != SQLITE_OK { + Xsqlite3ValueFree(tls, pNew) + pNew = uintptr(0) + } + } + return pNew +} + +// Destroy an sqlite3_value object previously obtained from +// sqlite3_value_dup(). +func Xsqlite3_value_free(tls *libc.TLS, pOld uintptr) { /* sqlite3.c:84512:17: */ + Xsqlite3ValueFree(tls, pOld) +} + +// *************************** sqlite3_result_ ******************************* +// +// The following routines are used by user-defined functions to specify +// the function result. +// +// The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the +// result as a string or blob but if the string or blob is too large, it +// then sets the error code to SQLITE_TOOBIG +// +// The invokeValueDestructor(P,X) routine invokes destructor function X() +// on value P is not going to be used and need to be destroyed. +func setResultStrOrError(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, enc U8, xDel uintptr) { /* sqlite3.c:84528:13: */ + if Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), enc, xDel) == SQLITE_TOOBIG { + Xsqlite3_result_error_toobig(tls, pCtx) + } +} + +func invokeValueDestructor(tls *libc.TLS, p uintptr, xDel uintptr, pCtx uintptr) int32 { /* sqlite3.c:84539:12: */ + + if xDel == uintptr(0) { + // noop + } else if xDel == (libc.UintptrFromInt32(-1)) { + // noop + } else { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDel)))(tls, p) + } + Xsqlite3_result_error_toobig(tls, pCtx) + return SQLITE_TOOBIG +} + +func Xsqlite3_result_blob(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { /* sqlite3.c:84555:17: */ + + setResultStrOrError(tls, pCtx, z, n, uint8(0), xDel) +} + +func Xsqlite3_result_blob64(tls *libc.TLS, pCtx uintptr, z uintptr, n Sqlite3_uint64, xDel uintptr) { /* sqlite3.c:84565:17: */ + + if n > uint64(0x7fffffff) { + invokeValueDestructor(tls, z, xDel, pCtx) + } else { + setResultStrOrError(tls, pCtx, z, int32(n), uint8(0), xDel) + } +} + +func Xsqlite3_result_double(tls *libc.TLS, pCtx uintptr, rVal float64) { /* sqlite3.c:84579:17: */ + + Xsqlite3VdbeMemSetDouble(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, rVal) +} + +func Xsqlite3_result_error(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) { /* sqlite3.c:84583:17: */ + + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_ERROR + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF8), libc.UintptrFromInt32(-1)) +} + +func Xsqlite3_result_error16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32) { /* sqlite3.c:84589:17: */ + + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_ERROR + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, z, int64(n), uint8(SQLITE_UTF16LE), libc.UintptrFromInt32(-1)) +} + +func Xsqlite3_result_int(tls *libc.TLS, pCtx uintptr, iVal int32) { /* sqlite3.c:84595:17: */ + + Xsqlite3VdbeMemSetInt64(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, I64(iVal)) +} + +func Xsqlite3_result_int64(tls *libc.TLS, pCtx uintptr, iVal I64) { /* sqlite3.c:84599:17: */ + + Xsqlite3VdbeMemSetInt64(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, iVal) +} + +func Xsqlite3_result_null(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84603:17: */ + + Xsqlite3VdbeMemSetNull(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut) +} + +func Xsqlite3_result_pointer(tls *libc.TLS, pCtx uintptr, pPtr uintptr, zPType uintptr, xDestructor uintptr) { /* sqlite3.c:84607:17: */ + var pOut uintptr = (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut + + Xsqlite3VdbeMemRelease(tls, pOut) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Null) + Xsqlite3VdbeMemSetPointer(tls, pOut, pPtr, zPType, xDestructor) +} + +func Xsqlite3_result_subtype(tls *libc.TLS, pCtx uintptr, eSubtype uint32) { /* sqlite3.c:84619:17: */ + var pOut uintptr = (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut + + (*Mem)(unsafe.Pointer(pOut)).FeSubtype = (U8(eSubtype & uint32(0xff))) + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) |= U16((MEM_Subtype)) +} + +func Xsqlite3_result_text(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { /* sqlite3.c:84625:17: */ + + setResultStrOrError(tls, pCtx, z, n, uint8(SQLITE_UTF8), xDel) +} + +func Xsqlite3_result_text64(tls *libc.TLS, pCtx uintptr, z uintptr, n Sqlite3_uint64, xDel uintptr, enc uint8) { /* sqlite3.c:84634:17: */ + + if int32(enc) == SQLITE_UTF16 { + enc = uint8(SQLITE_UTF16LE) + } + if n > uint64(0x7fffffff) { + invokeValueDestructor(tls, z, xDel, pCtx) + } else { + setResultStrOrError(tls, pCtx, z, int32(n), enc, xDel) + } +} + +func Xsqlite3_result_text16(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { /* sqlite3.c:84651:17: */ + + setResultStrOrError(tls, pCtx, z, n, uint8(SQLITE_UTF16LE), xDel) +} + +func Xsqlite3_result_text16be(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { /* sqlite3.c:84660:17: */ + + setResultStrOrError(tls, pCtx, z, n, uint8(SQLITE_UTF16BE), xDel) +} + +func Xsqlite3_result_text16le(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, xDel uintptr) { /* sqlite3.c:84669:17: */ + + setResultStrOrError(tls, pCtx, z, n, uint8(SQLITE_UTF16LE), xDel) +} + +func Xsqlite3_result_value(tls *libc.TLS, pCtx uintptr, pValue uintptr) { /* sqlite3.c:84679:17: */ + + Xsqlite3VdbeMemCopy(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, pValue) +} + +func Xsqlite3_result_zeroblob(tls *libc.TLS, pCtx uintptr, n int32) { /* sqlite3.c:84683:17: */ + + Xsqlite3VdbeMemSetZeroBlob(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, n) +} + +func Xsqlite3_result_zeroblob64(tls *libc.TLS, pCtx uintptr, n U64) int32 { /* sqlite3.c:84687:16: */ + var pOut uintptr = (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut + + if n > U64(*(*int32)(unsafe.Pointer(((*Mem)(unsafe.Pointer(pOut)).Fdb + 128 /* &.aLimit */)))) { + return SQLITE_TOOBIG + } + Xsqlite3VdbeMemSetZeroBlob(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, int32(n)) + return SQLITE_OK +} + +func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* sqlite3.c:84696:17: */ + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = func() int32 { + if errCode != 0 { + return errCode + } + return -1 + }() + if (int32((*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fflags) & MEM_Null) != 0 { + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, Xsqlite3ErrStr(tls, errCode), int64(-1), + uint8(SQLITE_UTF8), uintptr(0)) + } +} + +// Force an SQLITE_TOOBIG error. +func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ + + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4449 /* "string or blob t..." */, int64(-1), + uint8(SQLITE_UTF8), uintptr(0)) +} + +// An SQLITE_NOMEM error. +func Xsqlite3_result_error_nomem(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84716:17: */ + + Xsqlite3VdbeMemSetNull(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_NOMEM + Xsqlite3OomFault(tls, (*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fdb) +} + +// Force the INT64 value currently stored as the result to be +// a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL +// test-control. +func Xsqlite3ResultIntReal(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84728:21: */ + + if (int32((*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut)).Fflags) & MEM_Int) != 0 { + *(*U16)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Int))) + *(*U16)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut + 8 /* &.flags */)) |= U16((MEM_IntReal)) + } +} + +// This function is called after a transaction has been committed. It +// invokes callbacks registered with sqlite3_wal_hook() as required. +func doWalCallbacks(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:84742:12: */ + var rc int32 = SQLITE_OK + var i int32 + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + var nEntry int32 + Xsqlite3BtreeEnter(tls, pBt) + nEntry = Xsqlite3PagerWalCallback(tls, Xsqlite3BtreePager(tls, pBt)) + Xsqlite3BtreeLeave(tls, pBt) + if ((nEntry > 0) && ((*Sqlite3)(unsafe.Pointer(db)).FxWalCallback != 0)) && (rc == SQLITE_OK) { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32) int32)(unsafe.Pointer((db + 352 /* &.xWalCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpWalArg, db, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FzDbSName, nEntry) + } + } + } + return rc +} + +// Execute the statement pStmt, either until a row of data is ready, the +// statement is completely executed or an error occurs. +// +// This routine implements the bulk of the logic behind the sqlite_step() +// API. The only thing omitted is the automatic recompile if a +// schema change has occurred. That detail is handled by the +// outer sqlite3_step() wrapper procedure. +func sqlite3Step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84772:12: */ + var db uintptr + var rc int32 + + if !((*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic != U32(VDBE_MAGIC_RUN)) { + goto __1 + } + // We used to require that sqlite3_reset() be called before retrying + // sqlite3_step() after any error or after SQLITE_DONE. But beginning + // with version 3.7.0, we changed this so that sqlite3_reset() would + // be called automatically instead of throwing the SQLITE_MISUSE error. + // This "automatic-reset" change is not technically an incompatibility, + // since any application that receives an SQLITE_MISUSE is broken by + // definition. + // + // Nevertheless, some published applications that were originally written + // for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE + // returns, and those were broken by the automatic-reset change. As a + // a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the + // legacy behavior of returning SQLITE_MISUSE for cases where the + // previous sqlite3_step() returned something other than a SQLITE_LOCKED + // or SQLITE_BUSY error. + Xsqlite3_reset(tls, p) +__1: + ; + + // Check that malloc() has not failed. If it has, return early. + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __2 + } + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + return SQLITE_NOMEM +__2: + ; + + if !(((*Vdbe)(unsafe.Pointer(p)).Fpc < 0) && ((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.expired */)) & 0x3 >> 0))) != 0)) { + goto __3 + } + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_SCHEMA + rc = SQLITE_ERROR + if !((int32((*Vdbe)(unsafe.Pointer(p)).FprepFlags) & SQLITE_PREPARE_SAVESQL) != 0) { + goto __4 + } + // If this statement was prepared using saved SQL and an + // error has occurred, then return the error code in p->rc to the + // caller. Set the error code in the database handle to the same value. + rc = Xsqlite3VdbeTransferError(tls, p) +__4: + ; + goto end_of_step +__3: + ; + if !((*Vdbe)(unsafe.Pointer(p)).Fpc < 0) { + goto __5 + } + // If there are no other statements currently running, then + // reset the interrupt flag. This prevents a call to sqlite3_interrupt + // from interrupting a statement that has not yet started. + if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0) { + goto __6 + } + libc.AtomicStoreNInt32((db + 400 /* &.u1 */ /* &.isInterrupted */), int32(0), 0) +__6: + ; + + if !((((int32((*Sqlite3)(unsafe.Pointer(db)).FmTrace) & (SQLITE_TRACE_PROFILE | SQLITE_TRACE_XPROFILE)) != 0) && + !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0)) && ((*Vdbe)(unsafe.Pointer(p)).FzSql != 0)) { + goto __7 + } + Xsqlite3OsCurrentTimeInt64(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, (p + 184 /* &.startTime */)) + goto __8 +__7: + ; +__8: + ; + + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive++ + if !((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.readOnly */)) & 0x80 >> 7)) == 0) { + goto __9 + } + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeWrite++ +__9: + ; + if !((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.bIsReader */)) & 0x100 >> 8))) != 0) { + goto __10 + } + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeRead++ +__10: + ; + (*Vdbe)(unsafe.Pointer(p)).Fpc = 0 +__5: + ; + if !((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.explain */)) & 0xc >> 2))) != 0) { + goto __11 + } + rc = Xsqlite3VdbeList(tls, p) + goto __12 +__11: + + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec++ + rc = Xsqlite3VdbeExec(tls, p) + (*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec-- +__12: + ; + + if !(rc != SQLITE_ROW) { + goto __13 + } + // If the statement completed successfully, invoke the profile callback + if !(((*Vdbe)(unsafe.Pointer(p)).FstartTime) > int64(0)) { + goto __14 + } + invokeProfileCallback(tls, db, p) +__14: + ; + + if !((rc == SQLITE_DONE) && ((*Sqlite3)(unsafe.Pointer(db)).FautoCommit != 0)) { + goto __15 + } + + (*Vdbe)(unsafe.Pointer(p)).Frc = doWalCallbacks(tls, db) + if !((*Vdbe)(unsafe.Pointer(p)).Frc != SQLITE_OK) { + goto __17 + } + rc = SQLITE_ERROR +__17: + ; + goto __16 +__15: + if !((rc != SQLITE_DONE) && ((int32((*Vdbe)(unsafe.Pointer(p)).FprepFlags) & SQLITE_PREPARE_SAVESQL) != 0)) { + goto __18 + } + // If this statement was prepared using saved SQL and an + // error has occurred, then return the error code in p->rc to the + // caller. Set the error code in the database handle to the same value. + rc = Xsqlite3VdbeTransferError(tls, p) +__18: + ; +__16: + ; +__13: + ; + + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = rc + if !(SQLITE_NOMEM == Xsqlite3ApiExit(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, (*Vdbe)(unsafe.Pointer(p)).Frc)) { + goto __19 + } + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + if !((int32((*Vdbe)(unsafe.Pointer(p)).FprepFlags) & SQLITE_PREPARE_SAVESQL) != 0) { + goto __20 + } + rc = (*Vdbe)(unsafe.Pointer(p)).Frc +__20: + ; +__19: + ; +end_of_step: + // There are only a limited number of result codes allowed from the + // statements prepared using the legacy sqlite3_prepare() interface + ; + return (rc & (*Sqlite3)(unsafe.Pointer(db)).FerrMask) +} + +// This is the top-level implementation of sqlite3_step(). Call +// sqlite3Step() to do most of the work. If a schema error occurs, +// call sqlite3Reprepare() and try again. +func Xsqlite3_step(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84906:16: */ + var rc int32 = SQLITE_OK // Result from sqlite3Step() + var v uintptr = pStmt // the prepared statement + var cnt int32 = 0 // Counter to prevent infinite loop of reprepares + var db uintptr // The database connection + + if vdbeSafetyNotNull(tls, v) != 0 { + return Xsqlite3MisuseError(tls, 84913) + } + db = (*Vdbe)(unsafe.Pointer(v)).Fdb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Vdbe)(unsafe.Pointer(v)).FdoingRerun = U8(0) + for ((libc.AssignInt32(&rc, sqlite3Step(tls, v))) == SQLITE_SCHEMA) && + (libc.PostIncInt32(&cnt, 1) < SQLITE_MAX_SCHEMA_RETRY) { + var savedPc int32 = (*Vdbe)(unsafe.Pointer(v)).Fpc + rc = Xsqlite3Reprepare(tls, v) + if rc != SQLITE_OK { + // This case occurs after failing to recompile an sql statement. + // The error message from the SQL compiler has already been loaded + // into the database handle. This block copies the error message + // from the database handle into the statement and sets the statement + // program counter to 0 to ensure that when the statement is + // finalized or reset the parser error message is available via + // sqlite3_errmsg() and sqlite3_errcode(). + var zErr uintptr = Xsqlite3_value_text(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(v)).FzErrMsg) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + (*Vdbe)(unsafe.Pointer(v)).FzErrMsg = Xsqlite3DbStrDup(tls, db, zErr) + (*Vdbe)(unsafe.Pointer(v)).Frc = libc.AssignInt32(&rc, Xsqlite3ApiExit(tls, db, rc)) + } else { + (*Vdbe)(unsafe.Pointer(v)).FzErrMsg = uintptr(0) + (*Vdbe)(unsafe.Pointer(v)).Frc = libc.AssignInt32(&rc, SQLITE_NOMEM) + } + break + } + Xsqlite3_reset(tls, pStmt) + if savedPc >= 0 { + (*Vdbe)(unsafe.Pointer(v)).FdoingRerun = U8(1) + } + + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Extract the user data from a sqlite3_context structure and return a +// pointer to it. +func Xsqlite3_user_data(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:84955:17: */ + + return (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(p)).FpFunc)).FpUserData +} + +// Extract the user data from a sqlite3_context structure and return a +// pointer to it. +// +// IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface +// returns a copy of the pointer to the database connection (the 1st +// parameter) of the sqlite3_create_function() and +// sqlite3_create_function16() routines that originally registered the +// application defined function. +func Xsqlite3_context_db_handle(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:84970:20: */ + + return (*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(p)).FpOut)).Fdb +} + +// If this routine is invoked from within an xColumn method of a virtual +// table, then it returns true if and only if the the call is during an +// UPDATE operation and the value of the column will not be modified +// by the UPDATE. +// +// If this routine is called from any context other than within the +// xColumn method of a virtual table, then the return value is meaningless +// and arbitrary. +// +// Virtual table implements might use this routine to optimize their +// performance by substituting a NULL result, or some other light-weight +// value, as a signal to the xUpdate routine that the column is unchanged. +func Xsqlite3_vtab_nochange(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84989:16: */ + + return Xsqlite3_value_nochange(tls, (*Sqlite3_context)(unsafe.Pointer(p)).FpOut) +} + +// Return the current time for a statement. If the current time +// is requested more than once within the same run of a single prepared +// statement, the exact same time is returned for each invocation regardless +// of the amount of time that elapses between invocations. In other words, +// the time returned is always the time of the first call. +func Xsqlite3StmtCurrentTime(tls *libc.TLS, p uintptr) Sqlite3_int64 { /* sqlite3.c:85001:30: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + *(*Sqlite3_int64)(unsafe.Pointer(bp /* iTime */)) = int64(0) + var piTime uintptr + if (*Sqlite3_context)(unsafe.Pointer(p)).FpVdbe != uintptr(0) { + piTime = ((*Sqlite3_context)(unsafe.Pointer(p)).FpVdbe + 72 /* &.iCurrentTime */) + } else { + piTime = bp /* &iTime */ + } + if *(*Sqlite3_int64)(unsafe.Pointer(piTime)) == int64(0) { + rc = Xsqlite3OsCurrentTimeInt64(tls, (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(p)).FpOut)).Fdb)).FpVfs, piTime) + if rc != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(piTime)) = int64(0) + } + } + return *(*Sqlite3_int64)(unsafe.Pointer(piTime)) +} + +// Create a new aggregate context for p and return a pointer to +// its pMem->z element. +func createAggContext(tls *libc.TLS, p uintptr, nByte int32) uintptr { /* sqlite3.c:85021:29: */ + var pMem uintptr = (*Sqlite3_context)(unsafe.Pointer(p)).FpMem + + if nByte <= 0 { + Xsqlite3VdbeMemSetNull(tls, pMem) + (*Mem)(unsafe.Pointer(pMem)).Fz = uintptr(0) + } else { + Xsqlite3VdbeMemClearAndResize(tls, pMem, nByte) + (*Mem)(unsafe.Pointer(pMem)).Fflags = U16(MEM_Agg) + *(*uintptr)(unsafe.Pointer(pMem /* &.u */)) = (*Sqlite3_context)(unsafe.Pointer(p)).FpFunc + if (*Mem)(unsafe.Pointer(pMem)).Fz != 0 { + libc.Xmemset(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, 0, uint64(nByte)) + } + } + return (*Mem)(unsafe.Pointer(pMem)).Fz +} + +// Allocate or return the aggregate context for a user function. A new +// context is allocated on the first call. Subsequent calls return the +// same context that was returned on prior calls. +func Xsqlite3_aggregate_context(tls *libc.TLS, p uintptr, nByte int32) uintptr { /* sqlite3.c:85043:17: */ + + if (int32((*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(p)).FpMem)).Fflags) & MEM_Agg) == 0 { + return createAggContext(tls, p, nByte) + } else { + return (*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(p)).FpMem)).Fz + } + return uintptr(0) +} + +// Return the auxiliary data pointer, if any, for the iArg'th argument to +// the user-function defined by pCtx. +// +// The left-most argument is 0. +// +// Undocumented behavior: If iArg is negative then access a cache of +// auxiliary data pointers that is available to all functions within a +// single prepared statement. The iArg values must match. +func Xsqlite3_get_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32) uintptr { /* sqlite3.c:85064:17: */ + var pAuxData uintptr + + if (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe == uintptr(0) { + return uintptr(0) + } + for pAuxData = (*Vdbe)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe)).FpAuxData; pAuxData != 0; pAuxData = (*AuxData)(unsafe.Pointer(pAuxData)).FpNextAux { + if ((*AuxData)(unsafe.Pointer(pAuxData)).FiAuxArg == iArg) && (((*AuxData)(unsafe.Pointer(pAuxData)).FiAuxOp == (*Sqlite3_context)(unsafe.Pointer(pCtx)).FiOp) || (iArg < 0)) { + return (*AuxData)(unsafe.Pointer(pAuxData)).FpAux + } + } + return uintptr(0) +} + +// Set the auxiliary data pointer and delete function, for the iArg'th +// argument to the user-function defined by pCtx. Any previous value is +// deleted by calling the delete function specified when it was set. +// +// The left-most argument is 0. +// +// Undocumented behavior: If iArg is negative then make the data available +// to all functions within the current prepared statement using iArg as an +// access code. +func Xsqlite3_set_auxdata(tls *libc.TLS, pCtx uintptr, iArg int32, pAux uintptr, xDelete uintptr) { /* sqlite3.c:85092:17: */ + var pAuxData uintptr + var pVdbe uintptr + pVdbe = (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe + + if !(pVdbe == uintptr(0)) { + goto __1 + } + goto failed +__1: + ; + + pAuxData = (*Vdbe)(unsafe.Pointer(pVdbe)).FpAuxData +__2: + if !(pAuxData != 0) { + goto __4 + } + if !(((*AuxData)(unsafe.Pointer(pAuxData)).FiAuxArg == iArg) && (((*AuxData)(unsafe.Pointer(pAuxData)).FiAuxOp == (*Sqlite3_context)(unsafe.Pointer(pCtx)).FiOp) || (iArg < 0))) { + goto __5 + } + goto __4 +__5: + ; + goto __3 +__3: + pAuxData = (*AuxData)(unsafe.Pointer(pAuxData)).FpNextAux + goto __2 + goto __4 +__4: + ; + if !(pAuxData == uintptr(0)) { + goto __6 + } + pAuxData = Xsqlite3DbMallocZero(tls, (*Vdbe)(unsafe.Pointer(pVdbe)).Fdb, uint64(unsafe.Sizeof(AuxData{}))) + if !(!(pAuxData != 0)) { + goto __8 + } + goto failed +__8: + ; + (*AuxData)(unsafe.Pointer(pAuxData)).FiAuxOp = (*Sqlite3_context)(unsafe.Pointer(pCtx)).FiOp + (*AuxData)(unsafe.Pointer(pAuxData)).FiAuxArg = iArg + (*AuxData)(unsafe.Pointer(pAuxData)).FpNextAux = (*Vdbe)(unsafe.Pointer(pVdbe)).FpAuxData + (*Vdbe)(unsafe.Pointer(pVdbe)).FpAuxData = pAuxData + if !((*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError == 0) { + goto __9 + } + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = -1 +__9: + ; + goto __7 +__6: + if !((*AuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux != 0) { + goto __10 + } + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pAuxData + 16 /* &.xDeleteAux */))))(tls, (*AuxData)(unsafe.Pointer(pAuxData)).FpAux) +__10: + ; +__7: + ; + + (*AuxData)(unsafe.Pointer(pAuxData)).FpAux = pAux + (*AuxData)(unsafe.Pointer(pAuxData)).FxDeleteAux = xDelete + return + +failed: + if !(xDelete != 0) { + goto __11 + } + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDelete)))(tls, pAux) +__11: +} + +// Return the number of times the Step function of an aggregate has been +// called. +// +// This function is deprecated. Do not use it for new code. It is +// provide only to avoid breaking legacy code. New aggregate function +// implementations should keep their own counts within their aggregate +// context. +func Xsqlite3_aggregate_count(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:85145:16: */ + + return (*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(p)).FpMem)).Fn +} + +// Return the number of columns in the result set for the statement pStmt. +func Xsqlite3_column_count(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:85154:16: */ + var pVm uintptr = pStmt + if pVm != 0 { + return int32((*Vdbe)(unsafe.Pointer(pVm)).FnResColumn) + } + return 0 +} + +// Return the number of values available from the current row of the +// currently executing statement pStmt. +func Xsqlite3_data_count(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:85163:16: */ + var pVm uintptr = pStmt + if (pVm == uintptr(0)) || ((*Vdbe)(unsafe.Pointer(pVm)).FpResultSet == uintptr(0)) { + return 0 + } + return int32((*Vdbe)(unsafe.Pointer(pVm)).FnResColumn) +} + +// Return a pointer to static memory containing an SQL NULL value. +func columnNullValue(tls *libc.TLS) uintptr { /* sqlite3.c:85172:18: */ + return uintptr(unsafe.Pointer(&nullMem)) +} + +var nullMem = Mem{ + /* .flags = */ Fflags: U16(MEM_Null), +} /* sqlite3.c:85182:20 */ + +// Check to see if column iCol of the given statement is valid. If +// it is, return a pointer to the Mem for the value of that column. +// If iCol is not valid, return a pointer to a Mem which has a value +// of NULL. +func columnMem(tls *libc.TLS, pStmt uintptr, i int32) uintptr { /* sqlite3.c:85212:12: */ + var pVm uintptr + var pOut uintptr + + pVm = pStmt + if pVm == uintptr(0) { + return columnNullValue(tls) + } + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(pVm)).Fdb)).Fmutex) + if (((*Vdbe)(unsafe.Pointer(pVm)).FpResultSet != uintptr(0)) && (i < int32((*Vdbe)(unsafe.Pointer(pVm)).FnResColumn))) && (i >= 0) { + pOut = ((*Vdbe)(unsafe.Pointer(pVm)).FpResultSet + uintptr(i)*56) + } else { + Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(pVm)).Fdb, SQLITE_RANGE) + pOut = columnNullValue(tls) + } + return pOut +} + +// This function is called after invoking an sqlite3_value_XXX function on a +// column value (i.e. a value returned by evaluating an SQL expression in the +// select list of a SELECT statement) that may cause a malloc() failure. If +// malloc() has failed, the threads mallocFailed flag is cleared and the result +// code of statement pStmt set to SQLITE_NOMEM. +// +// Specifically, this is called from within: +// +// sqlite3_column_int() +// sqlite3_column_int64() +// sqlite3_column_text() +// sqlite3_column_text16() +// sqlite3_column_real() +// sqlite3_column_bytes() +// sqlite3_column_bytes16() +// sqiite3_column_blob() +func columnMallocFailure(tls *libc.TLS, pStmt uintptr) { /* sqlite3.c:85247:13: */ + // If malloc() failed during an encoding conversion within an + // sqlite3_column_XXX API, then set the return code of the statement to + // SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR + // and _finalize() will return NOMEM. + var p uintptr = pStmt + if p != 0 { + + (*Vdbe)(unsafe.Pointer(p)).Frc = Xsqlite3ApiExit(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, (*Vdbe)(unsafe.Pointer(p)).Frc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } +} + +// *************************** sqlite3_column_ ******************************* +// +// The following routines are used to access elements of the current row +// in the result set. +func Xsqlite3_column_blob(tls *libc.TLS, pStmt uintptr, i int32) uintptr { /* sqlite3.c:85267:23: */ + var val uintptr + val = Xsqlite3_value_blob(tls, columnMem(tls, pStmt, i)) + // Even though there is no encoding conversion, value_blob() might + // need to call malloc() to expand the result of a zeroblob() + // expression. + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_bytes(tls *libc.TLS, pStmt uintptr, i int32) int32 { /* sqlite3.c:85277:16: */ + var val int32 = Xsqlite3_value_bytes(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_bytes16(tls *libc.TLS, pStmt uintptr, i int32) int32 { /* sqlite3.c:85282:16: */ + var val int32 = Xsqlite3_value_bytes16(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_double(tls *libc.TLS, pStmt uintptr, i int32) float64 { /* sqlite3.c:85287:19: */ + var val float64 = Xsqlite3_value_double(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_int(tls *libc.TLS, pStmt uintptr, i int32) int32 { /* sqlite3.c:85292:16: */ + var val int32 = Xsqlite3_value_int(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_int64(tls *libc.TLS, pStmt uintptr, i int32) Sqlite_int64 { /* sqlite3.c:85297:25: */ + var val Sqlite_int64 = Xsqlite3_value_int64(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_text(tls *libc.TLS, pStmt uintptr, i int32) uintptr { /* sqlite3.c:85302:32: */ + var val uintptr = Xsqlite3_value_text(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_value(tls *libc.TLS, pStmt uintptr, i int32) uintptr { /* sqlite3.c:85307:26: */ + var pOut uintptr = columnMem(tls, pStmt, i) + if (int32((*Mem)(unsafe.Pointer(pOut)).Fflags) & MEM_Static) != 0 { + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Static))) + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) |= U16((MEM_Ephem)) + } + columnMallocFailure(tls, pStmt) + return pOut +} + +func Xsqlite3_column_text16(tls *libc.TLS, pStmt uintptr, i int32) uintptr { /* sqlite3.c:85317:23: */ + var val uintptr = Xsqlite3_value_text16(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return val +} + +func Xsqlite3_column_type(tls *libc.TLS, pStmt uintptr, i int32) int32 { /* sqlite3.c:85323:16: */ + var iType int32 = Xsqlite3_value_type(tls, columnMem(tls, pStmt, i)) + columnMallocFailure(tls, pStmt) + return iType +} + +// Convert the N-th element of pStmt->pColName[] into a string using +// xFunc() then return that string. If N is out of range, return 0. +// +// There are up to 5 names for each column. useType determines which +// name is returned. Here are the names: +// +// 0 The column name as it should be displayed for output +// 1 The datatype name for the column +// 2 The name of the database that the column derives from +// 3 The name of the table that the column derives from +// 4 The name of the table column that the result column derives from +// +// If the result is not a simple column reference (if it is an expression +// or a constant) then useTypes 2, 3, and 4 return NULL. +func columnName(tls *libc.TLS, pStmt uintptr, N int32, useUtf16 int32, useType int32) uintptr { /* sqlite3.c:85345:19: */ + var ret uintptr + var p uintptr + var n int32 + var db uintptr + ret = uintptr(0) + p = pStmt + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + + n = Xsqlite3_column_count(tls, pStmt) + if (N < n) && (N >= 0) { + N = N + (useType * n) + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + if useUtf16 != 0 { + ret = Xsqlite3_value_text16(tls, ((*Vdbe)(unsafe.Pointer(p)).FaColName + uintptr(N)*56)) + } else { + ret = Xsqlite3_value_text(tls, ((*Vdbe)(unsafe.Pointer(p)).FaColName + uintptr(N)*56)) + } + // A malloc may have failed inside of the _text() call. If this + // is the case, clear the mallocFailed flag and return NULL. + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3OomClear(tls, db) + ret = uintptr(0) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + } + return ret +} + +// Return the name of the Nth column of the result set returned by SQL +// statement pStmt. +func Xsqlite3_column_name(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85394:23: */ + return columnName(tls, pStmt, N, 0, COLNAME_NAME) +} + +func Xsqlite3_column_name16(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85398:23: */ + return columnName(tls, pStmt, N, 1, COLNAME_NAME) +} + +// Constraint: If you have ENABLE_COLUMN_METADATA then you must +// not define OMIT_DECLTYPE. + +// Return the column declaration type (if applicable) of the 'i'th column +// of the result set of SQL statement pStmt. +func Xsqlite3_column_decltype(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85417:23: */ + return columnName(tls, pStmt, N, 0, COLNAME_DECLTYPE) +} + +func Xsqlite3_column_decltype16(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85421:23: */ + return columnName(tls, pStmt, N, 1, COLNAME_DECLTYPE) +} + +// Return the name of the database from which a result column derives. +// NULL is returned if the result column is an expression or constant or +// anything else which is not an unambiguous reference to a database column. +func Xsqlite3_column_database_name(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85433:23: */ + return columnName(tls, pStmt, N, 0, COLNAME_DATABASE) +} + +func Xsqlite3_column_database_name16(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85437:23: */ + return columnName(tls, pStmt, N, 1, COLNAME_DATABASE) +} + +// Return the name of the table from which a result column derives. +// NULL is returned if the result column is an expression or constant or +// anything else which is not an unambiguous reference to a database column. +func Xsqlite3_column_table_name(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85447:23: */ + return columnName(tls, pStmt, N, 0, COLNAME_TABLE) +} + +func Xsqlite3_column_table_name16(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85451:23: */ + return columnName(tls, pStmt, N, 1, COLNAME_TABLE) +} + +// Return the name of the table column from which a result column derives. +// NULL is returned if the result column is an expression or constant or +// anything else which is not an unambiguous reference to a database column. +func Xsqlite3_column_origin_name(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85461:23: */ + return columnName(tls, pStmt, N, 0, COLNAME_COLUMN) +} + +func Xsqlite3_column_origin_name16(tls *libc.TLS, pStmt uintptr, N int32) uintptr { /* sqlite3.c:85465:23: */ + return columnName(tls, pStmt, N, 1, COLNAME_COLUMN) +} + +// ****************************** sqlite3_bind_ *************************** +// +// +// Routines used to attach values to wildcards in a compiled SQL statement. +// Unbind the value bound to variable i in virtual machine p. This is the +// the same as binding a NULL value to the column. If the "i" parameter is +// out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK. +// +// A successful evaluation of this routine acquires the mutex on p. +// the mutex is released if any kind of error occurs. +// +// The error code stored in database p->db is overwritten with the return +// value in any case. +func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pVar uintptr + if vdbeSafetyNotNull(tls, p) != 0 { + return Xsqlite3MisuseError(tls, 85490) + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + if ((*Vdbe)(unsafe.Pointer(p)).FiVdbeMagic != U32(VDBE_MAGIC_RUN)) || ((*Vdbe)(unsafe.Pointer(p)).Fpc >= 0) { + Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + Xsqlite3_log(tls, SQLITE_MISUSE, + ts+4472 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + return Xsqlite3MisuseError(tls, 85498) + } + if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { + Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_RANGE) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + return SQLITE_RANGE + } + i-- + pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr(i)*56) + Xsqlite3VdbeMemRelease(tls, pVar) + (*Mem)(unsafe.Pointer(pVar)).Fflags = U16(MEM_Null) + (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FerrCode = SQLITE_OK + + // If the bit corresponding to this variable in Vdbe.expmask is set, then + // binding a new value to this variable invalidates the current query plan. + // + // IMPLEMENTATION-OF: R-57496-20354 If the specific value bound to a host + // parameter in the WHERE clause might influence the choice of query plan + // for a statement, then the statement will be automatically recompiled, + // as if there had been a schema change, on the first sqlite3_step() call + // following any change to the bindings of that parameter. + + if ((*Vdbe)(unsafe.Pointer(p)).Fexpmask != U32(0)) && (((*Vdbe)(unsafe.Pointer(p)).Fexpmask & (func() uint32 { + if i >= 31 { + return 0x80000000 + } + return (U32(U32(1)) << i) + }())) != U32(0)) { + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(1), 0, 0x3) + } + return SQLITE_OK +} + +// Bind a text or BLOB value. +func bindText(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData I64, xDel uintptr, encoding U8) int32 { /* sqlite3.c:85530:12: */ + var p uintptr = pStmt + var pVar uintptr + var rc int32 + + rc = vdbeUnbind(tls, p, i) + if rc == SQLITE_OK { + if zData != uintptr(0) { + pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((i-1))*56) + rc = Xsqlite3VdbeMemSetStr(tls, pVar, zData, nData, encoding, xDel) + if (rc == SQLITE_OK) && (int32(encoding) != 0) { + rc = Xsqlite3VdbeChangeEncoding(tls, pVar, int32((*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fenc)) + } + if rc != 0 { + Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, rc) + rc = Xsqlite3ApiExit(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, rc) + } + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } else if (xDel != (uintptr(0))) && (xDel != (libc.UintptrFromInt32(-1))) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDel)))(tls, zData) + } + return rc +} + +// Bind a blob value to an SQL statement variable. +func Xsqlite3_bind_blob(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) int32 { /* sqlite3.c:85566:16: */ + return bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(0)) +} + +func Xsqlite3_bind_blob64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Sqlite3_uint64, xDel uintptr) int32 { /* sqlite3.c:85578:16: */ + + return bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(0)) +} + +func Xsqlite3_bind_double(tls *libc.TLS, pStmt uintptr, i int32, rValue float64) int32 { /* sqlite3.c:85588:16: */ + var rc int32 + var p uintptr = pStmt + rc = vdbeUnbind(tls, p, i) + if rc == SQLITE_OK { + Xsqlite3VdbeMemSetDouble(tls, ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((i-1))*56), rValue) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_int(tls *libc.TLS, p uintptr, i int32, iValue int32) int32 { /* sqlite3.c:85598:16: */ + return Xsqlite3_bind_int64(tls, p, i, I64(iValue)) +} + +func Xsqlite3_bind_int64(tls *libc.TLS, pStmt uintptr, i int32, iValue Sqlite_int64) int32 { /* sqlite3.c:85601:16: */ + var rc int32 + var p uintptr = pStmt + rc = vdbeUnbind(tls, p, i) + if rc == SQLITE_OK { + Xsqlite3VdbeMemSetInt64(tls, ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((i-1))*56), iValue) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_null(tls *libc.TLS, pStmt uintptr, i int32) int32 { /* sqlite3.c:85611:16: */ + var rc int32 + var p uintptr = pStmt + rc = vdbeUnbind(tls, p, i) + if rc == SQLITE_OK { + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_pointer(tls *libc.TLS, pStmt uintptr, i int32, pPtr uintptr, zPTtype uintptr, xDestructor uintptr) int32 { /* sqlite3.c:85620:16: */ + var rc int32 + var p uintptr = pStmt + rc = vdbeUnbind(tls, p, i) + if rc == SQLITE_OK { + Xsqlite3VdbeMemSetPointer(tls, ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((i-1))*56), pPtr, zPTtype, xDestructor) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } else if xDestructor != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestructor)))(tls, pPtr) + } + return rc +} + +func Xsqlite3_bind_text(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) int32 { /* sqlite3.c:85638:16: */ + return bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(SQLITE_UTF8)) +} + +func Xsqlite3_bind_text64(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData Sqlite3_uint64, xDel uintptr, enc uint8) int32 { /* sqlite3.c:85647:16: */ + + if int32(enc) == SQLITE_UTF16 { + enc = uint8(SQLITE_UTF16LE) + } + return bindText(tls, pStmt, i, zData, int64(nData), xDel, enc) +} + +func Xsqlite3_bind_text16(tls *libc.TLS, pStmt uintptr, i int32, zData uintptr, nData int32, xDel uintptr) int32 { /* sqlite3.c:85660:16: */ + return bindText(tls, pStmt, i, zData, int64(nData), xDel, uint8(SQLITE_UTF16LE)) +} + +func Xsqlite3_bind_value(tls *libc.TLS, pStmt uintptr, i int32, pValue uintptr) int32 { /* sqlite3.c:85670:16: */ + var rc int32 + switch Xsqlite3_value_type(tls, pValue) { + case SQLITE_INTEGER: + { + rc = Xsqlite3_bind_int64(tls, pStmt, i, *(*I64)(unsafe.Pointer(pValue /* &.u */))) + break + + } + case SQLITE_FLOAT: + { + rc = Xsqlite3_bind_double(tls, pStmt, i, *(*float64)(unsafe.Pointer(pValue /* &.u */))) + break + + } + case SQLITE_BLOB: + { + if (int32((*Sqlite3_value)(unsafe.Pointer(pValue)).Fflags) & MEM_Zero) != 0 { + rc = Xsqlite3_bind_zeroblob(tls, pStmt, i, *(*int32)(unsafe.Pointer(pValue /* &.u */))) + } else { + rc = Xsqlite3_bind_blob(tls, pStmt, i, (*Sqlite3_value)(unsafe.Pointer(pValue)).Fz, (*Sqlite3_value)(unsafe.Pointer(pValue)).Fn, libc.UintptrFromInt32(-1)) + } + break + + } + case SQLITE_TEXT: + { + rc = bindText(tls, pStmt, i, (*Sqlite3_value)(unsafe.Pointer(pValue)).Fz, int64((*Sqlite3_value)(unsafe.Pointer(pValue)).Fn), libc.UintptrFromInt32(-1), + (*Sqlite3_value)(unsafe.Pointer(pValue)).Fenc) + break + + } + default: + { + rc = Xsqlite3_bind_null(tls, pStmt, i) + break + + } + } + return rc +} + +func Xsqlite3_bind_zeroblob(tls *libc.TLS, pStmt uintptr, i int32, n int32) int32 { /* sqlite3.c:85701:16: */ + var rc int32 + var p uintptr = pStmt + rc = vdbeUnbind(tls, p, i) + if rc == SQLITE_OK { + Xsqlite3VdbeMemSetZeroBlob(tls, ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((i-1))*56), n) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return rc +} + +func Xsqlite3_bind_zeroblob64(tls *libc.TLS, pStmt uintptr, i int32, n Sqlite3_uint64) int32 { /* sqlite3.c:85711:16: */ + var rc int32 + var p uintptr = pStmt + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + if n > U64(*(*int32)(unsafe.Pointer(((*Vdbe)(unsafe.Pointer(p)).Fdb + 128 /* &.aLimit */)))) { + rc = SQLITE_TOOBIG + } else { + + rc = Xsqlite3_bind_zeroblob(tls, pStmt, i, int32(n)) + } + rc = Xsqlite3ApiExit(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + return rc +} + +// Return the number of wildcards that can be potentially bound to. +// This routine is added to support DBD::SQLite. +func Xsqlite3_bind_parameter_count(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:85730:16: */ + var p uintptr = pStmt + if p != 0 { + return int32((*Vdbe)(unsafe.Pointer(p)).FnVar) + } + return 0 +} + +// Return the name of a wildcard parameter. Return NULL if the index +// is out of range or if the wildcard is unnamed. +// +// The result is always UTF-8. +func Xsqlite3_bind_parameter_name(tls *libc.TLS, pStmt uintptr, i int32) uintptr { /* sqlite3.c:85741:23: */ + var p uintptr = pStmt + if p == uintptr(0) { + return uintptr(0) + } + return Xsqlite3VListNumToName(tls, (*Vdbe)(unsafe.Pointer(p)).FpVList, i) +} + +// Given a wildcard parameter name, return the index of the variable +// with that name. If there is no variable with the given name, +// return 0. +func Xsqlite3VdbeParameterIndex(tls *libc.TLS, p uintptr, zName uintptr, nName int32) int32 { /* sqlite3.c:85752:20: */ + if (p == uintptr(0)) || (zName == uintptr(0)) { + return 0 + } + return Xsqlite3VListNameToNum(tls, (*Vdbe)(unsafe.Pointer(p)).FpVList, zName, nName) +} + +func Xsqlite3_bind_parameter_index(tls *libc.TLS, pStmt uintptr, zName uintptr) int32 { /* sqlite3.c:85756:16: */ + return Xsqlite3VdbeParameterIndex(tls, pStmt, zName, Xsqlite3Strlen30(tls, zName)) +} + +// Transfer all bindings from the first statement over to the second. +func Xsqlite3TransferBindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) int32 { /* sqlite3.c:85763:20: */ + var pFrom uintptr = pFromStmt + var pTo uintptr = pToStmt + var i int32 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) + for i = 0; i < int32((*Vdbe)(unsafe.Pointer(pFrom)).FnVar); i++ { + Xsqlite3VdbeMemMove(tls, ((*Vdbe)(unsafe.Pointer(pTo)).FaVar + uintptr(i)*56), ((*Vdbe)(unsafe.Pointer(pFrom)).FaVar + uintptr(i)*56)) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(pTo)).Fdb)).Fmutex) + return SQLITE_OK +} + +// Deprecated external interface. Internal/core SQLite code +// should call sqlite3TransferBindings. +// +// It is misuse to call this routine with statements from different +// database connections. But as this is a deprecated interface, we +// will not bother to check for that condition. +// +// If the two statements contain a different number of bindings, then +// an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise +// SQLITE_OK is returned. +func Xsqlite3_transfer_bindings(tls *libc.TLS, pFromStmt uintptr, pToStmt uintptr) int32 { /* sqlite3.c:85790:16: */ + var pFrom uintptr = pFromStmt + var pTo uintptr = pToStmt + if int32((*Vdbe)(unsafe.Pointer(pFrom)).FnVar) != int32((*Vdbe)(unsafe.Pointer(pTo)).FnVar) { + return SQLITE_ERROR + } + + if (*Vdbe)(unsafe.Pointer(pTo)).Fexpmask != 0 { + libc.SetBitFieldPtr16Uint32(pTo+200 /* &.expired */, Bft(1), 0, 0x3) + } + + if (*Vdbe)(unsafe.Pointer(pFrom)).Fexpmask != 0 { + libc.SetBitFieldPtr16Uint32(pFrom+200 /* &.expired */, Bft(1), 0, 0x3) + } + return Xsqlite3TransferBindings(tls, pFromStmt, pToStmt) +} + +// Return the sqlite3* database handle to which the prepared statement given +// in the argument belongs. This is the same database handle that was +// the first argument to the sqlite3_prepare() that was used to create +// the statement in the first place. +func Xsqlite3_db_handle(tls *libc.TLS, pStmt uintptr) uintptr { /* sqlite3.c:85814:20: */ + if pStmt != 0 { + return (*Vdbe)(unsafe.Pointer(pStmt)).Fdb + } + return uintptr(0) +} + +// Return true if the prepared statement is guaranteed to not modify the +// database. +func Xsqlite3_stmt_readonly(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:85822:16: */ + if pStmt != 0 { + return (int32(*(*uint16)(unsafe.Pointer(pStmt + 200 /* &.readOnly */)) & 0x80 >> 7)) + } + return 1 +} + +// Return 1 if the statement is an EXPLAIN and return 2 if the +// statement is an EXPLAIN QUERY PLAN +func Xsqlite3_stmt_isexplain(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:85830:16: */ + if pStmt != 0 { + return (int32(*(*uint16)(unsafe.Pointer(pStmt + 200 /* &.explain */)) & 0xc >> 2)) + } + return 0 +} + +// Return true if the prepared statement is in need of being reset. +func Xsqlite3_stmt_busy(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:85837:16: */ + var v uintptr = pStmt + return (libc.Bool32(((v != uintptr(0)) && ((*Vdbe)(unsafe.Pointer(v)).FiVdbeMagic == U32(VDBE_MAGIC_RUN))) && ((*Vdbe)(unsafe.Pointer(v)).Fpc >= 0))) +} + +// Return a pointer to the next prepared statement after pStmt associated +// with database connection pDb. If pStmt is NULL, return the first +// prepared statement for the database connection. Return NULL if there +// are no more. +func Xsqlite3_next_stmt(tls *libc.TLS, pDb uintptr, pStmt uintptr) uintptr { /* sqlite3.c:85848:25: */ + var pNext uintptr + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(pDb)).Fmutex) + if pStmt == uintptr(0) { + pNext = (*Sqlite3)(unsafe.Pointer(pDb)).FpVdbe + } else { + pNext = (*Vdbe)(unsafe.Pointer(pStmt)).FpNext + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(pDb)).Fmutex) + return pNext +} + +// Return the value of a status counter for a prepared statement +func Xsqlite3_stmt_status(tls *libc.TLS, pStmt uintptr, op int32, resetFlag int32) int32 { /* sqlite3.c:85869:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pVdbe uintptr = pStmt + // var v U32 at bp, 4 + + if op == SQLITE_STMTSTATUS_MEMUSED { + var db uintptr = (*Vdbe)(unsafe.Pointer(pVdbe)).Fdb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + *(*U32)(unsafe.Pointer(bp /* v */)) = U32(0) + (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed = bp /* &v */ + Xsqlite3VdbeClearObject(tls, db, pVdbe) + Xsqlite3DbFree(tls, db, pVdbe) + (*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed = uintptr(0) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + } else { + *(*U32)(unsafe.Pointer(bp /* v */)) = *(*U32)(unsafe.Pointer((pVdbe + 212 /* &.aCounter */) + uintptr(op)*4)) + if resetFlag != 0 { + *(*U32)(unsafe.Pointer((pVdbe + 212 /* &.aCounter */) + uintptr(op)*4)) = U32(0) + } + } + return int32(*(*U32)(unsafe.Pointer(bp /* v */))) +} + +// Return the SQL associated with a prepared statement +func Xsqlite3_sql(tls *libc.TLS, pStmt uintptr) uintptr { /* sqlite3.c:85899:23: */ + var p uintptr = pStmt + if p != 0 { + return (*Vdbe)(unsafe.Pointer(p)).FzSql + } + return uintptr(0) +} + +// Return the SQL associated with a prepared statement with +// bound parameters expanded. Space to hold the returned string is +// obtained from sqlite3_malloc(). The caller is responsible for +// freeing the returned string by passing it to sqlite3_free(). +// +// The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of +// expanded bound parameters. +func Xsqlite3_expanded_sql(tls *libc.TLS, pStmt uintptr) uintptr { /* sqlite3.c:85913:17: */ + var z uintptr = uintptr(0) + var zSql uintptr = Xsqlite3_sql(tls, pStmt) + if zSql != 0 { + var p uintptr = pStmt + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + z = Xsqlite3VdbeExpandSql(tls, p, zSql) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) + } + return z +} + +// Allocate and populate an UnpackedRecord structure based on the serialized +// record in nKey/pKey. Return a pointer to the new UnpackedRecord structure +// if successful, or a NULL pointer if an OOM error is encountered. +func vdbeUnpackRecord(tls *libc.TLS, pKeyInfo uintptr, nKey int32, pKey uintptr) uintptr { /* sqlite3.c:85951:23: */ + var pRet uintptr // Return value + + pRet = Xsqlite3VdbeAllocUnpackedRecord(tls, pKeyInfo) + if pRet != 0 { + libc.Xmemset(tls, (*UnpackedRecord)(unsafe.Pointer(pRet)).FaMem, 0, (uint64(unsafe.Sizeof(Mem{})) * (uint64(int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField) + 1)))) + Xsqlite3VdbeRecordUnpack(tls, pKeyInfo, nKey, pKey, pRet) + } + return pRet +} + +// This function is called from within a pre-update callback to retrieve +// a field of the row currently being updated or deleted. +func Xsqlite3_preupdate_old(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintptr) int32 { /* sqlite3.c:85970:16: */ + var p uintptr + var pMem uintptr + var rc int32 + var nRec U32 + var aRec uintptr + p = (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate + rc = SQLITE_OK + + // Test that this call is being made from within an SQLITE_DELETE or + // SQLITE_UPDATE pre-update callback, and that iIdx is within range. + if !(!(p != 0) || ((*PreUpdate)(unsafe.Pointer(p)).Fop == SQLITE_INSERT)) { + goto __1 + } + rc = Xsqlite3MisuseError(tls, 85978) + goto preupdate_old_out +__1: + ; + if !((*PreUpdate)(unsafe.Pointer(p)).FpPk != 0) { + goto __2 + } + iIdx = int32(Xsqlite3TableColumnToIndex(tls, (*PreUpdate)(unsafe.Pointer(p)).FpPk, int16(iIdx))) +__2: + ; + if !((iIdx >= int32((*VdbeCursor)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField)) || (iIdx < 0)) { + goto __3 + } + rc = SQLITE_RANGE + goto preupdate_old_out +__3: + ; + + // If the old.* record has not yet been loaded into memory, do so now. + if !((*PreUpdate)(unsafe.Pointer(p)).FpUnpacked == uintptr(0)) { + goto __4 + } + + nRec = Xsqlite3BtreePayloadSize(tls, *(*uintptr)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpCsr + 56 /* &.uc */))) + aRec = Xsqlite3DbMallocRaw(tls, db, uint64(nRec)) + if !(!(aRec != 0)) { + goto __5 + } + goto preupdate_old_out +__5: + ; + rc = Xsqlite3BtreePayload(tls, *(*uintptr)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpCsr + 56 /* &.uc */)), uint32(0), nRec, aRec) + if !(rc == SQLITE_OK) { + goto __6 + } + (*PreUpdate)(unsafe.Pointer(p)).FpUnpacked = vdbeUnpackRecord(tls, (p + 32 /* &.keyinfo */), int32(nRec), aRec) + if !(!(int32((*PreUpdate)(unsafe.Pointer(p)).FpUnpacked) != 0)) { + goto __7 + } + rc = SQLITE_NOMEM +__7: + ; +__6: + ; + if !(rc != SQLITE_OK) { + goto __8 + } + Xsqlite3DbFree(tls, db, aRec) + goto preupdate_old_out +__8: + ; + (*PreUpdate)(unsafe.Pointer(p)).FaRecord = aRec +__4: + ; + + pMem = libc.AssignPtrUintptr(ppValue, ((*UnpackedRecord)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpUnpacked)).FaMem + uintptr(iIdx)*56)) + if !(iIdx == int32((*Table)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey)) { + goto __9 + } + Xsqlite3VdbeMemSetInt64(tls, pMem, (*PreUpdate)(unsafe.Pointer(p)).FiKey1) + goto __10 +__9: + if !(iIdx >= int32((*UnpackedRecord)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpUnpacked)).FnField)) { + goto __11 + } + *(*uintptr)(unsafe.Pointer(ppValue)) = columnNullValue(tls) + goto __12 +__11: + if !(int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpTab)).FaCol+uintptr(iIdx)*32)).Faffinity) == SQLITE_AFF_REAL) { + goto __13 + } + if !((int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0) { + goto __14 + } + + Xsqlite3VdbeMemRealify(tls, pMem) +__14: + ; +__13: + ; +__12: + ; +__10: + ; + +preupdate_old_out: + Xsqlite3Error(tls, db, rc) + return Xsqlite3ApiExit(tls, db, rc) +} + +// This function is called from within a pre-update callback to retrieve +// the number of columns in the row being updated, deleted or inserted. +func Xsqlite3_preupdate_count(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:86033:16: */ + var p uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate + return func() int32 { + if p != 0 { + return int32((*PreUpdate)(unsafe.Pointer(p)).Fkeyinfo.FnKeyField) + } + return 0 + }() +} + +// This function is designed to be called from within a pre-update callback +// only. It returns zero if the change that caused the callback was made +// immediately by a user SQL statement. Or, if the change was made by a +// trigger program, it returns the number of trigger programs currently +// on the stack (1 for a top-level trigger, 2 for a trigger fired by a +// top-level trigger etc.). +// +// For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL +// or SET DEFAULT action is considered a trigger. +func Xsqlite3_preupdate_depth(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:86051:16: */ + var p uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate + return func() int32 { + if p != 0 { + return (*Vdbe)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).Fv)).FnFrame + } + return 0 + }() +} + +// This function is designed to be called from within a pre-update callback +// only. +func Xsqlite3_preupdate_blobwrite(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:86062:16: */ + var p uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate + return func() int32 { + if p != 0 { + return (*PreUpdate)(unsafe.Pointer(p)).FiBlobWrite + } + return -1 + }() +} + +// This function is called from within a pre-update callback to retrieve +// a field of the row currently being updated or inserted. +func Xsqlite3_preupdate_new(tls *libc.TLS, db uintptr, iIdx int32, ppValue uintptr) int32 { /* sqlite3.c:86073:16: */ + var p uintptr + var rc int32 + var pMem uintptr + var pData uintptr + // For an INSERT, memory cell p->iNewReg contains the serialized record + // that is being inserted. Deserialize it. + var pUnpack uintptr + p = (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdate + rc = SQLITE_OK + + if !(!(p != 0) || ((*PreUpdate)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + goto __1 + } + rc = Xsqlite3MisuseError(tls, 86079) + goto preupdate_new_out +__1: + ; + if !(((*PreUpdate)(unsafe.Pointer(p)).FpPk != 0) && ((*PreUpdate)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE)) { + goto __2 + } + iIdx = int32(Xsqlite3TableColumnToIndex(tls, (*PreUpdate)(unsafe.Pointer(p)).FpPk, int16(iIdx))) +__2: + ; + if !((iIdx >= int32((*VdbeCursor)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField)) || (iIdx < 0)) { + goto __3 + } + rc = SQLITE_RANGE + goto preupdate_new_out +__3: + ; + + if !((*PreUpdate)(unsafe.Pointer(p)).Fop == SQLITE_INSERT) { + goto __4 + } + // For an INSERT, memory cell p->iNewReg contains the serialized record + // that is being inserted. Deserialize it. + pUnpack = (*PreUpdate)(unsafe.Pointer(p)).FpNewUnpacked + if !(!(pUnpack != 0)) { + goto __6 + } + pData = ((*Vdbe)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).Fv)).FaMem + uintptr((*PreUpdate)(unsafe.Pointer(p)).FiNewReg)*56) + rc = func() int32 { + if (int32((*Mem)(unsafe.Pointer((pData))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pData) + } + return 0 + }() + if !(rc != SQLITE_OK) { + goto __7 + } + goto preupdate_new_out +__7: + ; + pUnpack = vdbeUnpackRecord(tls, (p + 32 /* &.keyinfo */), (*Mem)(unsafe.Pointer(pData)).Fn, (*Mem)(unsafe.Pointer(pData)).Fz) + if !(!(pUnpack != 0)) { + goto __8 + } + rc = SQLITE_NOMEM + goto preupdate_new_out +__8: + ; + (*PreUpdate)(unsafe.Pointer(p)).FpNewUnpacked = pUnpack +__6: + ; + pMem = ((*UnpackedRecord)(unsafe.Pointer(pUnpack)).FaMem + uintptr(iIdx)*56) + if !(iIdx == int32((*Table)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey)) { + goto __9 + } + Xsqlite3VdbeMemSetInt64(tls, pMem, (*PreUpdate)(unsafe.Pointer(p)).FiKey2) + goto __10 +__9: + if !(iIdx >= int32((*UnpackedRecord)(unsafe.Pointer(pUnpack)).FnField)) { + goto __11 + } + pMem = columnNullValue(tls) +__11: + ; +__10: + ; + goto __5 +__4: + // For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required + // value. Make a copy of the cell contents and return a pointer to it. + // It is not safe to return a pointer to the memory cell itself as the + // caller may modify the value text encoding. + ; + if !(!(int32((*PreUpdate)(unsafe.Pointer(p)).FaNew) != 0)) { + goto __12 + } + (*PreUpdate)(unsafe.Pointer(p)).FaNew = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Mem{})) * uint64((*VdbeCursor)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpCsr)).FnField)))) + if !(!(int32((*PreUpdate)(unsafe.Pointer(p)).FaNew) != 0)) { + goto __13 + } + rc = SQLITE_NOMEM + goto preupdate_new_out +__13: + ; +__12: + ; + + pMem = ((*PreUpdate)(unsafe.Pointer(p)).FaNew + uintptr(iIdx)*56) + if !(int32((*Mem)(unsafe.Pointer(pMem)).Fflags) == 0) { + goto __14 + } + if !(iIdx == int32((*Table)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).FpTab)).FiPKey)) { + goto __15 + } + Xsqlite3VdbeMemSetInt64(tls, pMem, (*PreUpdate)(unsafe.Pointer(p)).FiKey2) + goto __16 +__15: + rc = Xsqlite3VdbeMemCopy(tls, pMem, ((*Vdbe)(unsafe.Pointer((*PreUpdate)(unsafe.Pointer(p)).Fv)).FaMem + uintptr((((*PreUpdate)(unsafe.Pointer(p)).FiNewReg+1)+iIdx))*56)) + if !(rc != SQLITE_OK) { + goto __17 + } + goto preupdate_new_out +__17: + ; +__16: + ; +__14: + ; +__5: + ; + *(*uintptr)(unsafe.Pointer(ppValue)) = pMem + +preupdate_new_out: + Xsqlite3Error(tls, db, rc) + return Xsqlite3ApiExit(tls, db, rc) +} + +//************* End of vdbeapi.c ******************************************** +//************* Begin file vdbetrace.c ************************************** +// 2009 November 25 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code used to insert the values of host parameters +// (aka "wildcards") into the SQL text output by sqlite3_trace(). +// +// The Vdbe parse-tree explainer is also found here. +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// zSql is a zero-terminated string of UTF-8 SQL text. Return the number of +// bytes in this text up to but excluding the first character in +// a host parameter. If the text contains no host parameters, return +// the total number of bytes in the text. +func findNextHostParameter(tls *libc.TLS, zSql uintptr, pnToken uintptr) int32 { /* sqlite3.c:86243:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var tokenType int32 at bp, 4 + + var nTotal int32 = 0 + var n int32 + + *(*int32)(unsafe.Pointer(pnToken)) = 0 + for *(*int8)(unsafe.Pointer(zSql)) != 0 { + n = Xsqlite3GetToken(tls, zSql, bp /* &tokenType */) + + if *(*int32)(unsafe.Pointer(bp /* tokenType */)) == TK_VARIABLE { + *(*int32)(unsafe.Pointer(pnToken)) = n + break + } + nTotal = nTotal + (n) + zSql += uintptr(n) + } + return nTotal +} + +// This function returns a pointer to a nul-terminated string in memory +// obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the +// string contains a copy of zRawSql but with host parameters expanded to +// their current bindings. Or, if sqlite3.nVdbeExec is greater than 1, +// then the returned string holds a copy of zRawSql with "-- " prepended +// to each line of text. +// +// If the SQLITE_TRACE_SIZE_LIMIT macro is defined to an integer, then +// then long strings and blobs are truncated to that many bytes. This +// can be used to prevent unreasonably large trace strings when dealing +// with large (multi-megabyte) strings and blobs. +// +// The calling function is responsible for making sure the memory returned +// is eventually freed. +// +// ALGORITHM: Scan the input string looking for host parameters in any of +// these forms: ?, ?N, $A, @A, :A. Take care to avoid text within +// string literals, quoted identifier names, and comments. For text forms, +// the host parameter index is found by scanning the prepared +// statement for the corresponding OP_Variable opcode. Once the host +// parameter index is known, locate the value in p->aVar[]. Then render +// the value as a literal in place of the host parameter name. +func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { /* sqlite3.c:86286:21: */ + bp := tls.Alloc(248) + defer tls.Free(248) + + var db uintptr // The database connection + *(*int32)(unsafe.Pointer(bp + 184 /* idx */)) = 0 // Index of a host parameter + var nextIndex int32 = 1 // Index of next ? host parameter + var n int32 // Length of a token prefix + // var nToken int32 at bp+180, 4 + // Length of the parameter token + var i int32 // Loop counter + var pVar uintptr // Value of a host parameter + // var out StrAccum at bp+48, 32 + // Accumulate the output here + // var utf8 Mem at bp+192, 56 + // Used to convert UTF16 into UTF8 for display + // var zBase [100]int8 at bp+80, 100 + // Initial working space + + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + Xsqlite3StrAccumInit(tls, bp+48 /* &out */, uintptr(0), bp+80 /* &zBase[0] */, int32(unsafe.Sizeof([100]int8{})), + *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1 { + for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { + var zStart uintptr = zRawSql + for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { + } + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4512 /* "-- " */, 3) + + Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) + } + } else if int32((*Vdbe)(unsafe.Pointer(p)).FnVar) == 0 { + Xsqlite3_str_append(tls, bp+48 /* &out */, zRawSql, Xsqlite3Strlen30(tls, zRawSql)) + } else { + for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { + n = findNextHostParameter(tls, zRawSql, bp+180 /* &nToken */) + + Xsqlite3_str_append(tls, bp+48 /* &out */, zRawSql, n) + zRawSql += uintptr(n) + + if *(*int32)(unsafe.Pointer(bp + 180 /* nToken */)) == 0 { + break + } + if int32(*(*int8)(unsafe.Pointer(zRawSql))) == '?' { + if *(*int32)(unsafe.Pointer(bp + 180 /* nToken */)) > 1 { + + Xsqlite3GetInt32(tls, (zRawSql + 1), bp+184 /* &idx */) + } else { + *(*int32)(unsafe.Pointer(bp + 184 /* idx */)) = nextIndex + } + } else { + + *(*int32)(unsafe.Pointer(bp + 184 /* idx */)) = Xsqlite3VdbeParameterIndex(tls, p, zRawSql, *(*int32)(unsafe.Pointer(bp + 180 /* nToken */))) + + } + zRawSql += uintptr(*(*int32)(unsafe.Pointer(bp + 180 /* nToken */))) + nextIndex = func() int32 { + if (*(*int32)(unsafe.Pointer(bp + 184 /* idx */)) + 1) > (nextIndex) { + return (*(*int32)(unsafe.Pointer(bp + 184 /* idx */)) + 1) + } + return nextIndex + }() + + pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 184 /* idx */))-1))*56) + if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+757 /* "NULL" */, 4) + } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4085 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4035 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { + var nOut int32 // Number of bytes of the string text to include in output + var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc + if int32(enc) != SQLITE_UTF8 { + libc.Xmemset(tls, bp+192 /* &utf8 */, 0, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(bp + 192 /* &utf8 */)).Fdb = db + Xsqlite3VdbeMemSetStr(tls, bp+192 /* &utf8 */, (*Mem)(unsafe.Pointer(pVar)).Fz, int64((*Mem)(unsafe.Pointer(pVar)).Fn), enc, uintptr(0)) + if SQLITE_NOMEM == Xsqlite3VdbeChangeEncoding(tls, bp+192 /* &utf8 */, SQLITE_UTF8) { + (*StrAccum)(unsafe.Pointer(bp + 48 /* &out */)).FaccError = U8(SQLITE_NOMEM) + (*StrAccum)(unsafe.Pointer(bp + 48 /* &out */)).FnAlloc = U32(0) + } + pVar = bp + 192 /* &utf8 */ + } + nOut = (*Mem)(unsafe.Pointer(pVar)).Fn + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4516 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + if int32(enc) != SQLITE_UTF8 { + Xsqlite3VdbeMemRelease(tls, bp+192 /* &utf8 */) + } + } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4523 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + } else { + var nOut int32 // Number of bytes of the blob to include in output + + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4536 /* "x'" */, 2) + nOut = (*Mem)(unsafe.Pointer(pVar)).Fn + for i = 0; i < nOut; i++ { + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4539 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + } + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4544 /* "'" */, 1) + } + } + } + if (*StrAccum)(unsafe.Pointer(bp+48 /* &out */)).FaccError != 0 { + Xsqlite3_str_reset(tls, bp+48 /* &out */) + } + return Xsqlite3StrAccumFinish(tls, bp+48 /* &out */) +} + +//************* End of vdbetrace.c ****************************************** +//************* Begin file vdbe.c ******************************************* +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// The code in this file implements the function that runs the +// bytecode of a prepared statement. +// +// Various scripts scan this source file in order to generate HTML +// documentation, headers files, or other derived files. The formatting +// of the code in this file is, therefore, important. See other comments +// in this file for details. If in doubt, do not deviate from existing +// commenting and indentation practices when changing or adding code. +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// Invoke this macro on memory cells just prior to changing the +// value of the cell. This macro verifies that shallow copies are +// not misused. A shallow copy of a string or blob just copies a +// pointer to the string or blob, not the content. If the original +// is changed while the copy is still in use, the string or blob might +// be changed out from under the copy. This macro verifies that nothing +// like that ever happens. + +// The following global variable is incremented every time a cursor +// moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test +// procedures use this information to make sure that indices are +// working correctly. This variable has no function other than to +// help verify the correct operation of the library. + +// When this global variable is positive, it gets decremented once before +// each instruction in the VDBE. When it reaches zero, the u1.isInterrupted +// field of the sqlite3 structure is set in order to simulate an interrupt. +// +// This facility is used for testing purposes only. It does not function +// in an ordinary build. + +// The next global variable is incremented each type the OP_Sort opcode +// is executed. The test procedures use this information to make sure that +// sorting is occurring or not occurring at appropriate times. This variable +// has no function other than to help verify the correct operation of the +// library. + +// The next global variable records the size of the largest MEM_Blob +// or MEM_Str that has been used by a VDBE opcode. The test procedures +// use this information to make sure that the zero-blob functionality +// is working correctly. This variable has no function other than to +// help verify the correct operation of the library. + +// This macro evaluates to true if either the update hook or the preupdate +// hook are enabled for database connect DB. + +// The next global variable is incremented each time the OP_Found opcode +// is executed. This is used to test whether or not the foreign key +// operation implemented using OP_FkIsZero is working. This variable +// has no function other than to help verify the correct operation of the +// library. + +// Test a register to see if it exceeds the current maximum blob size. +// If it does, record the new maximum blob size. + +// Invoke the VDBE coverage callback, if that callback is defined. This +// feature is used for test suite validation only and does not appear an +// production builds. +// +// M is the type of branch. I is the direction taken for this instance of +// the branch. +// +// M: 2 - two-way branch (I=0: fall-thru 1: jump ) +// 3 - two-way + NULL (I=0: fall-thru 1: jump 2: NULL ) +// 4 - OP_Jump (I=0: jump p1 1: jump p2 2: jump p3) +// +// In other words, if M is 2, then I is either 0 (for fall-through) or +// 1 (for when the branch is taken). If M is 3, the I is 0 for an +// ordinary fall-through, I is 1 if the branch was taken, and I is 2 +// if the result of comparison is NULL. For M=3, I=2 the jump may or +// may not be taken, depending on the SQLITE_JUMPIFNULL flags in p5. +// When M is 4, that means that an OP_Jump is being run. I is 0, 1, or 2 +// depending on if the operands are less than, equal, or greater than. +// +// iSrcLine is the source code line (from the __LINE__ macro) that +// generated the VDBE instruction combined with flag bits. The source +// code line number is in the lower 24 bits of iSrcLine and the upper +// 8 bytes are flags. The lower three bits of the flags indicate +// values for I that should never occur. For example, if the branch is +// always taken, the flags should be 0x05 since the fall-through and +// alternate branch are never taken. If a branch is never taken then +// flags should be 0x06 since only the fall-through approach is allowed. +// +// Bit 0x08 of the flags indicates an OP_Jump opcode that is only +// interested in equal or not-equal. In other words, I==0 and I==2 +// should be treated as equivalent +// +// Since only a line number is retained, not the filename, this macro +// only works for amalgamation builds. But that is ok, since these macros +// should be no-ops except for special builds used to measure test coverage. + +// An ephemeral string value (signified by the MEM_Ephem flag) contains +// a pointer to a dynamically allocated string where some other entity +// is responsible for deallocating that string. Because the register +// does not control the string, it might be deleted without the register +// knowing it. +// +// This routine converts an ephemeral string into a dynamically allocated +// string that the register itself controls. In other words, it +// converts an MEM_Ephem string into a string with P.z==P.zMalloc. + +// Return true if the cursor was opened using the OP_OpenSorter opcode. + +// Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL +// if we run out of memory. +func allocateCursor(tls *libc.TLS, p uintptr, iCur int32, nField int32, iDb int32, eCurType U8) uintptr { /* sqlite3.c:86651:19: */ + // Find the memory cell that will be used to store the blob of memory + // required for this VdbeCursor structure. It is convenient to use a + // vdbe memory cell to manage the memory allocation required for a + // VdbeCursor structure for the following reasons: + // + // * Sometimes cursor numbers are used for a couple of different + // purposes in a vdbe program. The different uses might require + // different sized allocations. Memory cells provide growable + // allocations. + // + // * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can + // be freed lazily via the sqlite3_release_memory() API. This + // minimizes the number of malloc calls made by the system. + // + // The memory cell for cursor 0 is aMem[0]. The rest are allocated from + // the top of the register space. Cursor 1 is at Mem[p->nMem-1]. + // Cursor 2 is at Mem[p->nMem-2]. And so forth. + var pMem uintptr + if iCur > 0 { + pMem = ((*Vdbe)(unsafe.Pointer(p)).FaMem + uintptr(((*Vdbe)(unsafe.Pointer(p)).FnMem-iCur))*56) + } else { + pMem = (*Vdbe)(unsafe.Pointer(p)).FaMem + } + var nByte int32 + var pCx uintptr = uintptr(0) + nByte = (int32(((((uint64(unsafe.Sizeof(VdbeCursor{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))) + ((uint64(2) * uint64(unsafe.Sizeof(U32(0)))) * uint64(nField))) + (func() uint64 { + if int32(eCurType) == CURTYPE_BTREE { + return uint64(Xsqlite3BtreeCursorSize(tls)) + } + return uint64(0) + }()))) + + if *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) != 0 { //OPTIMIZATION-IF-FALSE + Xsqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8))) + *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) = uintptr(0) + } + + // There used to be a call to sqlite3VdbeMemClearAndResize() to make sure + // the pMem used to hold space for the cursor has enough storage available + // in pMem->zMalloc. But for the special case of the aMem[] entries used + // to hold cursors, it is faster to in-line the logic. + + if (*Mem)(unsafe.Pointer(pMem)).FszMalloc < nByte { + if (*Mem)(unsafe.Pointer(pMem)).FszMalloc > 0 { + Xsqlite3DbFreeNN(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, (*Mem)(unsafe.Pointer(pMem)).FzMalloc) + } + (*Mem)(unsafe.Pointer(pMem)).Fz = libc.AssignPtrUintptr(pMem+24 /* &.zMalloc */, Xsqlite3DbMallocRaw(tls, (*Mem)(unsafe.Pointer(pMem)).Fdb, uint64(nByte))) + if (*Mem)(unsafe.Pointer(pMem)).FzMalloc == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = 0 + return uintptr(0) + } + (*Mem)(unsafe.Pointer(pMem)).FszMalloc = nByte + } + + *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr(iCur)*8)) = libc.AssignUintptr(&pCx, (*Mem)(unsafe.Pointer(pMem)).FzMalloc) + libc.Xmemset(tls, pCx, 0, uint64((uintptr(0) + 48 /* &.pAltCursor */))) + (*VdbeCursor)(unsafe.Pointer(pCx)).FeCurType = eCurType + (*VdbeCursor)(unsafe.Pointer(pCx)).FiDb = I8(iDb) + (*VdbeCursor)(unsafe.Pointer(pCx)).FnField = I16(nField) + (*VdbeCursor)(unsafe.Pointer(pCx)).FaOffset = ((pCx + 120 /* &.aType */) + uintptr(nField)*4) + if int32(eCurType) == CURTYPE_BTREE { + *(*uintptr)(unsafe.Pointer(pCx + 56 /* &.uc */)) = ((*Mem)(unsafe.Pointer(pMem)).Fz + uintptr(((((uint64(unsafe.Sizeof(VdbeCursor{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))) + ((uint64(2) * uint64(unsafe.Sizeof(U32(0)))) * uint64(nField))))) + Xsqlite3BtreeCursorZero(tls, *(*uintptr)(unsafe.Pointer(pCx + 56 /* &.uc */))) + } + return pCx +} + +// The string in pRec is known to look like an integer and to have a +// floating point value of rValue. Return true and set *piValue to the +// integer value if the string is in range to be an integer. Otherwise, +// return false. +func alsoAnInt(tls *libc.TLS, pRec uintptr, rValue float64, piValue uintptr) int32 { /* sqlite3.c:86729:12: */ + var iValue I64 = I64(rValue) + if Xsqlite3RealSameAsInt(tls, rValue, iValue) != 0 { + *(*I64)(unsafe.Pointer(piValue)) = iValue + return 1 + } + return (libc.Bool32(0 == Xsqlite3Atoi64(tls, (*Mem)(unsafe.Pointer(pRec)).Fz, piValue, (*Mem)(unsafe.Pointer(pRec)).Fn, (*Mem)(unsafe.Pointer(pRec)).Fenc))) +} + +// Try to convert a value into a numeric representation if we can +// do so without loss of information. In other words, if the string +// looks like a number, convert it into a number. If it does not +// look like a number, leave it alone. +// +// If the bTryForInt flag is true, then extra effort is made to give +// an integer representation. Strings that look like floating point +// values but which have no fractional component (example: '48.00') +// will have a MEM_Int representation when bTryForInt is true. +// +// If bTryForInt is false, then if the input string contains a decimal +// point or exponential notation, the result is only MEM_Real, even +// if there is an exact integer representation of the quantity. +func applyNumericAffinity(tls *libc.TLS, pRec uintptr, bTryForInt int32) { /* sqlite3.c:86753:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rValue float64 at bp, 8 + + var enc U8 = (*Mem)(unsafe.Pointer(pRec)).Fenc + var rc int32 + + rc = Xsqlite3AtoF(tls, (*Mem)(unsafe.Pointer(pRec)).Fz, bp /* &rValue */, (*Mem)(unsafe.Pointer(pRec)).Fn, enc) + if rc <= 0 { + return + } + if (rc == 1) && (alsoAnInt(tls, pRec, *(*float64)(unsafe.Pointer(bp /* rValue */)), (pRec /* &.u */ /* &.i */)) != 0) { + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) |= U16((MEM_Int)) + } else { + *(*float64)(unsafe.Pointer(pRec /* &.u */)) = *(*float64)(unsafe.Pointer(bp /* rValue */)) + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) |= U16((MEM_Real)) + if bTryForInt != 0 { + Xsqlite3VdbeIntegerAffinity(tls, pRec) + } + } + // TEXT->NUMERIC is many->one. Hence, it is important to invalidate the + // string representation after computing a numeric equivalent, because the + // string representation might not be the canonical representation for the + // numeric value. Ticket [343634942dd54ab57b7024] 2018-01-31. + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Str))) +} + +// Processing is determine by the affinity parameter: +// +// SQLITE_AFF_INTEGER: +// SQLITE_AFF_REAL: +// SQLITE_AFF_NUMERIC: +// Try to convert pRec to an integer representation or a +// floating-point representation if an integer representation +// is not possible. Note that the integer representation is +// always preferred, even if the affinity is REAL, because +// an integer representation is more space efficient on disk. +// +// SQLITE_AFF_TEXT: +// Convert pRec to a text representation. +// +// SQLITE_AFF_BLOB: +// SQLITE_AFF_NONE: +// No-op. pRec is unchanged. +func applyAffinity(tls *libc.TLS, pRec uintptr, affinity int8, enc U8) { /* sqlite3.c:86793:13: */ + if int32(affinity) >= SQLITE_AFF_NUMERIC { + + if (int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Int) == 0 { //OPTIMIZATION-IF-FALSE + if (int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Real) == 0 { + if (int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Str) != 0 { + applyNumericAffinity(tls, pRec, 1) + } + } else { + Xsqlite3VdbeIntegerAffinity(tls, pRec) + } + } + } else if int32(affinity) == SQLITE_AFF_TEXT { + // Only attempt the conversion to TEXT if there is an integer or real + // representation (blob and NULL do not get converted) but no string + // representation. It would be harmless to repeat the conversion if + // there is already a string rep, but it is pointless to waste those + // CPU cycles. + if 0 == (int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Str) { //OPTIMIZATION-IF-FALSE + if (int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & ((MEM_Real | MEM_Int) | MEM_IntReal)) != 0 { + + Xsqlite3VdbeMemStringify(tls, pRec, enc, uint8(1)) + } + } + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(((MEM_Real | MEM_Int) | MEM_IntReal)))) + } +} + +// Try to convert the type of a function argument or a result column +// into a numeric representation. Use either INTEGER or REAL whichever +// is appropriate. But only do the conversion if it is possible without +// loss of information and return the revised type of the argument. +func Xsqlite3_value_numeric_type(tls *libc.TLS, pVal uintptr) int32 { /* sqlite3.c:86832:16: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + if eType == SQLITE_TEXT { + var pMem uintptr = pVal + applyNumericAffinity(tls, pMem, 0) + eType = Xsqlite3_value_type(tls, pVal) + } + return eType +} + +// Exported version of applyAffinity(). This one works on sqlite3_value*, +// not the internal Mem* type. +func Xsqlite3ValueApplyAffinity(tls *libc.TLS, pVal uintptr, affinity U8, enc U8) { /* sqlite3.c:86846:21: */ + applyAffinity(tls, pVal, int8(affinity), enc) +} + +// pMem currently only holds a string type (or maybe a BLOB that we can +// interpret as a string if we want to). Compute its corresponding +// numeric type, if has one. Set the pMem->u.r and pMem->u.i fields +// accordingly. +func computeNumericType(tls *libc.TLS, pMem uintptr) U16 { /* sqlite3.c:86860:28: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + // var ix Sqlite3_int64 at bp, 8 + + if func() int32 { + if (int32((*Mem)(unsafe.Pointer((pMem))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pMem) + } + return 0 + }() != 0 { + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = int64(0) + return U16(MEM_Int) + } + rc = Xsqlite3AtoF(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, (pMem /* &.u */ /* &.r */), (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) + if rc <= 0 { + if (rc == 0) && (Xsqlite3Atoi64(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, bp /* &ix */, (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) <= 1) { + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = *(*Sqlite3_int64)(unsafe.Pointer(bp /* ix */)) + return U16(MEM_Int) + } else { + return U16(MEM_Real) + } + } else if (rc == 1) && (Xsqlite3Atoi64(tls, (*Mem)(unsafe.Pointer(pMem)).Fz, bp /* &ix */, (*Mem)(unsafe.Pointer(pMem)).Fn, (*Mem)(unsafe.Pointer(pMem)).Fenc) == 0) { + *(*I64)(unsafe.Pointer(pMem /* &.u */)) = *(*Sqlite3_int64)(unsafe.Pointer(bp /* ix */)) + return U16(MEM_Int) + } + return U16(MEM_Real) +} + +// Return the numeric type for pMem, either MEM_Int or MEM_Real or both or +// none. +// +// Unlike applyNumericAffinity(), this routine does not modify pMem->flags. +// But it does set pMem->u.r and pMem->u.i appropriately. +func numericType(tls *libc.TLS, pMem uintptr) U16 { /* sqlite3.c:86891:12: */ + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & ((MEM_Int | MEM_Real) | MEM_IntReal)) != 0 { + + return (U16(int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & ((MEM_Int | MEM_Real) | MEM_IntReal))) + } + if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Str | MEM_Blob)) != 0 { + + return computeNumericType(tls, pMem) + } + return U16(0) +} + +// Return the register of pOp->p2 after first preparing it to be +// overwritten with an integer value. +func out2PrereleaseWithClear(tls *libc.TLS, pOut uintptr) uintptr { /* sqlite3.c:87155:28: */ + Xsqlite3VdbeMemSetNull(tls, pOut) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Int) + return pOut +} + +func out2Prerelease(tls *libc.TLS, p uintptr, pOp uintptr) uintptr { /* sqlite3.c:87160:12: */ + var pOut uintptr + + pOut = ((*Vdbe)(unsafe.Pointer(p)).FaMem + uintptr((*VdbeOp)(unsafe.Pointer(pOp)).Fp2)*56) + + if (int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0 { //OPTIMIZATION-IF-FALSE + return out2PrereleaseWithClear(tls, pOut) + } else { + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Int) + return pOut + } + return uintptr(0) +} + +// Execute as much of a VDBE program as we can. +// This is the core of sqlite3_step(). +func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: */ + bp := tls.Alloc(936) + defer tls.Free(936) + + var aOp uintptr // Copy of p->aOp + var pOp uintptr // Current operation + var rc int32 // Value to return + var db uintptr // The database + var resetSchemaOnFault U8 // Reset schema after an error if positive + var encoding U8 // The database encoding + var iCompare int32 // Result of last comparison + var nVmStep U64 // Number of virtual machine steps + var nProgressLimit U64 // Invoke xProgress() when nVmStep reaches this + var aMem uintptr // Copy of p->aMem + var pIn1 uintptr // 1st input operand + var pIn2 uintptr // 2nd input operand + var pIn3 uintptr // 3rd input operand + var pOut uintptr + var iPrior U32 // in1 + var pCaller uintptr // in1, jump + var pcDest int32 + var pFrame uintptr + var pcx int32 // out2 + var cnt int32 + var nullFlag U16 // out2 + var pVar uintptr + var n int32 // Number of registers left to copy + var p1 int32 // Register to copy from + var p2 int32 + var n1 int32 + var pMem uintptr + var i int32 // same as TK_CONCAT, in1, in2, out3 + var nByte I64 // Total size of the output string or blob + var flags1 U16 // Initial flags for P1 + var flags2 U16 // same as TK_REM, in1, in2, out3 + var flags U16 // Combined MEM_* flags from both inputs + var type1 U16 // Numeric type of left operand + var type2 U16 // Numeric type of right operand + var iA I64 // Integer value of left operand + // var iB I64 at bp+176, 8 + // Integer value of right operand + var rA float64 // Real value of left operand + var rB float64 // same as TK_RSHIFT, in1, in2, out3 + // var iA1 I64 at bp+192, 8 + + // var uA U64 at bp+184, 8 + + var iB1 I64 + var op U8 // same as TK_GE, jump, in1, in3 + var res int32 + var res2 int32 // Result of the comparison of pIn1 against pIn3 + var affinity int8 // Affinity to use for comparison + var flags11 U16 // Copy of initial value of pIn1->flags + var flags3 U16 + var n2 int32 + var i1 int32 + var p11 int32 + var p21 int32 + var pKeyInfo uintptr + var idx U32 + var pColl uintptr // Collating sequence to use on this term + var bRev int32 // True for DESCENDING sort order + var aPermute uintptr // same as TK_OR, in1, in2, out3 + var v1 int32 // Left operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL + var v2 int32 // jump + var iAddr U32 // jump, in1 + var c int32 // jump, in1 + var c1 int32 // out3 + var pC uintptr + // var p22 U32 at bp+208, 4 + // column number to retrieve + // var pC1 uintptr at bp+200, 8 + // The VDBE cursor + var pCrsr uintptr // The BTree cursor + var aOffset uintptr // aOffset[i] is offset to start of data for i-th column + var len int32 // The length of the serialized data for the column + var i2 int32 // Loop counter + var pDest uintptr // Where to write the extracted value + // var sMem Mem at bp+216, 56 + // For storing the record being decoded + var zData uintptr // Part of the record being decoded + var zHdr uintptr // Next unparsed byte of the header + var zEndHdr uintptr // Pointer to first byte after the header + var offset64 U64 // 64-bit offset + // var t U32 at bp+272, 4 + // A type code from the record header + var pReg uintptr + var zAffinity uintptr + // Figure out whether to use 1, 2, 4, 6 or 8 bytes. + var i3 I64 + var uu U64 + var pRec uintptr // The new record + var nData U64 // Number of bytes of data space + var nHdr int32 // Number of bytes of header space + var nByte1 I64 // Data space required for this record + var nZero I64 // Number of zero bytes at the end of the record + var nVarint int32 // Number of bytes in a varint + var serial_type U32 // Type field + var pData0 uintptr // First field to be combined into the record + var pLast uintptr // Last field of the record + var nField int32 // Number of fields in the record + var zAffinity1 uintptr // The affinity string for the record + var file_format int32 // File format to use for encoding + var len1 U32 // Length of a field + var zHdr1 uintptr // Where to write next byte of the header + var zPayload uintptr // out2 + // var nEntry I64 at bp+280, 8 + + var pCrsr1 uintptr + var isSchemaChange int32 + + // Determine whether or not this is a transaction savepoint. If so, + // and this is a RELEASE command, then the current transaction + // is committed. + var isTransaction int32 + var p12 int32 // Value of P1 operand + var zName uintptr // Name of savepoint + var nName int32 + var pNew uintptr + var pSavepoint uintptr + var pTmp uintptr + var iSavepoint int32 + var ii int32 + var desiredAutoCommit int32 + var iRollback int32 + var pBt uintptr + // var iMeta int32 at bp+288, 4 + // out2 + // var iMeta1 int32 at bp+292, 4 + + var iDb int32 + var iCookie int32 + var pDb uintptr + var nField1 int32 + var pKeyInfo1 uintptr + var p23 U32 + var iDb1 int32 + var wrFlag int32 + var pX uintptr + var pCur uintptr + var pDb1 uintptr + var pOrig uintptr // The original cursor to be duplicated + var pCx uintptr + var pCx1 uintptr + var pKeyInfo2 uintptr + var pCx2 uintptr + var pC2 uintptr + var pCx3 uintptr + var flags31 U16 + var newType U16 // jump, in3, group + // var res1 int32 at bp+296, 4 + // Comparison result + var oc int32 // Opcode + var pC3 uintptr // The cursor to seek + // var r UnpackedRecord at bp+304, 24 + // The key to seek for + var nField2 int32 // Number of columns or fields in the key + var iKey I64 // The rowid we are to seek to + var eqOnly int32 + var pC4 uintptr + // var res3 int32 at bp+352, 4 + + var nStep int32 + // var r1 UnpackedRecord at bp+328, 24 + + var pC5 uintptr // jump, in3 + var pC6 uintptr // jump, in3 + var alreadyExists int32 + var takeJump int32 + var ii1 int32 + var pC7 uintptr + // var res4 int32 at bp+384, 4 + + var pFree uintptr + var pIdxKey uintptr + // var r2 UnpackedRecord at bp+360, 24 + + // If pIn3->u.i does not contain an integer, compute iKey as the + // integer value of pIn3. Jump to P2 if pIn3 cannot be converted + // into an integer without loss of information. Take care to avoid + // changing the datatype of pIn3, however, as it is used by other + // parts of the prepared statement. + // var x Mem at bp+392, 56 + // jump, in3 + var pC8 uintptr + var pCrsr2 uintptr + // var res5 int32 at bp+448, 4 + + var iKey1 U64 // out2 + // var v I64 at bp+456, 8 + // The new rowid + var pC9 uintptr // Cursor of table to get the new rowid + // var res6 int32 at bp+452, 4 + // Result of an sqlite3BtreeLast() + var cnt1 int32 // Counter to limit the number of searches + var pMem1 uintptr // Register holding largest rowid for AUTOINCREMENT + var pFrame1 uintptr + var pData uintptr // MEM cell holding data for the record to be inserted + var pKey uintptr // MEM cell holding key for the record + var pC10 uintptr // Cursor to table into which insert is written + var seekResult int32 // Result of prior seek or 0 if no USESEEKRESULT flag + var zDb uintptr // database name - used by the update hook + var pTab uintptr // Table structure - used by update and pre-update hooks + // var x1 BtreePayload at bp+464, 48 + + var pDest1 uintptr // Cursor to write to + var pSrc uintptr // Cursor to read from + var iKey2 I64 + var pC11 uintptr + var zDb1 uintptr + var pTab1 uintptr + var opflags int32 + var pC12 uintptr + // var res7 int32 at bp+512, 4 + + var nKeyCol int32 + var pC13 uintptr + var pC14 uintptr + var pCrsr3 uintptr + var n3 U32 // out2 + var pC15 uintptr + // var v3 I64 at bp+520, 8 + + var pVtab uintptr + var pModule uintptr + var pC16 uintptr // jump + var pC17 uintptr + var pCrsr4 uintptr + // var res8 int32 at bp+528, 4 + // jump + var pC18 uintptr + var pCrsr5 uintptr + // var res9 int32 at bp+532, 4 + + var sz I64 // jump + var pC19 uintptr + var pCrsr6 uintptr + // var res10 int32 at bp+536, 4 + // jump + var pC20 uintptr // in2 + var pC21 uintptr + // var x2 BtreePayload at bp+544, 48 + // in2 + var pC22 uintptr + var pC23 uintptr + var pCrsr7 uintptr + // var res11 int32 at bp+616, 4 + + // var r3 UnpackedRecord at bp+592, 24 + // out2 + var pC24 uintptr // The P1 index cursor + var pTabCur uintptr // The P2 table cursor (OP_DeferredSeek only) + // var rowid I64 at bp+624, 8 + + var pC25 uintptr + var nCellKey I64 + var pCur1 uintptr + // var m Mem at bp+632, 56 + // jump + var pC26 uintptr + var res12 int32 + // var r4 UnpackedRecord at bp+688, 24 + // out2 + // var iMoved int32 at bp+712, 4 + + var iDb2 int32 + // var nChange int32 at bp+716, 4 + + var pC27 uintptr // out2 + // var pgno Pgno at bp+720, 4 + + var pDb2 uintptr + var iDb3 int32 + var zSchema uintptr + var zSql uintptr + // var initData InitData at bp+728, 40 + + var nRoot int32 // Number of tables to check. (Number of root pages.) + var aRoot uintptr // Array of rootpage numbers for tables to be checked + // var nErr int32 at bp+768, 4 + // Number of errors reported + var z uintptr // Text of the error report + var pnErr uintptr // jump, in1, out3 + // var val I64 at bp+776, 8 + // jump, in1, in3 + var iSet int32 + var exists int32 // jump + var nMem int32 // Number of memory registers for sub-program + var nByte2 int32 // Bytes of runtime space required for sub-program + var pRt uintptr // Register to allocate runtime space + var pMem2 uintptr // Used to iterate through memory cells + var pEnd uintptr // Last memory cell in new array + var pFrame2 uintptr // New vdbe frame to execute in + var pProgram uintptr // Sub-program to execute + var t1 uintptr // out2 + var pFrame3 uintptr + var pIn uintptr // in2 + var pFrame4 uintptr // in1, out2, in3 + // var x3 I64 at bp+784, 8 + + var n4 int32 + var pCtx uintptr + var i4 int32 + var pCtx1 uintptr + var pMem3 uintptr + var pMem4 uintptr + var i5 int32 // Loop counter + // var aRes [3]int32 at bp+792, 12 + // Results + var pMem5 uintptr // out2 + var pBt1 uintptr // Btree to change journal mode of + var pPager uintptr // Pager associated with pBt + var eNew int32 // New journal mode + var eOld int32 // The old journal mode + var zFilename uintptr // jump + var pBt2 uintptr + var pC28 uintptr + var pC29 uintptr + var z1 uintptr + var p13 int32 + var isWriteLock U8 + var pVTab uintptr + // var sMem1 Mem at bp+808, 56 + // For storing the record being decoded + var zTab uintptr + var pCur2 uintptr + // var pVCur uintptr at bp+864, 8 + + var pVtab1 uintptr + var pModule1 uintptr // jump + var nArg int32 + var iQuery int32 + var pModule2 uintptr + var pQuery uintptr + var pArgc uintptr + var pVCur1 uintptr + var pVtab2 uintptr + var pCur3 uintptr + var res13 int32 + var i6 int32 + var apArg uintptr + var pVtab3 uintptr + var pModule3 uintptr + var pDest2 uintptr + // var sContext Sqlite3_context at bp+872, 56 + + var pCur4 uintptr // jump + var pVtab4 uintptr + var pModule4 uintptr + var res14 int32 + var pCur5 uintptr + var pVtab5 uintptr + var pName uintptr + var isLegacy int32 + var vtabOnConflict U8 + var pVtab6 uintptr + var pModule5 uintptr + var nArg1 int32 + var i7 int32 + // var rowid1 Sqlite_int64 at bp+928, 8 + + var apArg1 uintptr + var pX1 uintptr // out2 + var newMax uint32 + var pBt3 uintptr // group + var i8 int32 + var pCtx2 uintptr + var z2 uintptr + var z3 uintptr // jump + var i9 int32 + var zTrace uintptr + aOp = (*Vdbe)(unsafe.Pointer(p)).FaOp + pOp = aOp + rc = SQLITE_OK + db = (*Vdbe)(unsafe.Pointer(p)).Fdb + resetSchemaOnFault = U8(0) + encoding = (*Sqlite3)(unsafe.Pointer(db)).Fenc + iCompare = 0 + nVmStep = uint64(0) + aMem = (*Vdbe)(unsafe.Pointer(p)).FaMem + pIn1 = uintptr(0) + pIn2 = uintptr(0) + pIn3 = uintptr(0) + pOut = uintptr(0) // Output operand + //** INSERT STACK UNION HERE ** + + // sqlite3_step() verifies this + Xsqlite3VdbeEnter(tls, p) + if !((*Sqlite3)(unsafe.Pointer(db)).FxProgress != 0) { + goto __1 + } + iPrior = *(*U32)(unsafe.Pointer((p + 212 /* &.aCounter */) + 4*4)) + + nProgressLimit = (U64((*Sqlite3)(unsafe.Pointer(db)).FnProgressOps - (iPrior % (*Sqlite3)(unsafe.Pointer(db)).FnProgressOps))) + goto __2 +__1: + nProgressLimit = (uint64(0xffffffff) | (U64((uint64(0xffffffff))) << 32)) +__2: + ; + if !((*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_NOMEM) { + goto __3 + } + // This happens if a malloc() inside a call to sqlite3_column_text() or + // sqlite3_column_text16() failed. + goto no_mem +__3: + ; + + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_OK + + (*Vdbe)(unsafe.Pointer(p)).FiCurrentTime = int64(0) + + (*Vdbe)(unsafe.Pointer(p)).FpResultSet = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + if !(libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0) { + goto __4 + } + goto abort_due_to_interrupt +__4: + ; + + pOp = (aOp + uintptr((*Vdbe)(unsafe.Pointer(p)).Fpc)*24) +__5: + if !(1 != 0) { + goto __7 + } + // Errors are detected by individual opcodes, with an immediate + // jumps to abort_due_to_error. + + nVmStep++ + + // Only allow tracing if SQLITE_DEBUG is defined. + + // Check to see if we need to simulate an interrupt. This only happens + // if we have a special test build. + + // Sanity checking on other operands + + switch int32((*Op)(unsafe.Pointer(pOp)).Fopcode) { + + // **************************************************************************** + // + // What follows is a massive switch statement where each case implements a + // separate instruction in the virtual machine. If we follow the usual + // indentation conventions, each case should be indented by 6 spaces. But + // that is a lot of wasted space on the left margin. So the code within + // the switch statement will break with convention and be flush-left. Another + // big comment (similar to this one) will mark the point in the code where + // we transition back to normal indentation. + // + // The formatting of each case is important. The makefile for SQLite + // generates two C files "opcodes.h" and "opcodes.c" by scanning this + // file looking for lines that begin with "case OP_". The opcodes.h files + // will be filled with #defines that give unique integer values to each + // opcode and the opcodes.c file is filled with an array of strings where + // each string is the symbolic name for the corresponding opcode. If the + // case statement is followed by a comment of the form "/# same as ... #/" + // that comment is used to determine the particular value of the opcode. + // + // Other keywords in the comment that follows each case are used to + // construct the OPFLG_INITIALIZER value that initializes opcodeProperty[]. + // Keywords include: in1, in2, in3, out2, out3. See + // the mkopcodeh.awk script for additional information. + // + // Documentation about VDBE opcodes is generated by scanning this file + // for lines of that contain "Opcode:". That line and all subsequent + // comment lines are used in the generation of the opcode.html documentation + // file. + // + // SUMMARY: + // + // Formatting is important to scripts that scan this file. + // Do not deviate from the formatting style currently in use. + // + // + + // Opcode: Goto * P2 * * * + // + // An unconditional jump to address P2. + // The next instruction executed will be + // the one at index P2 from the beginning of + // the program. + // + // The P1 parameter is not actually used by this opcode. However, it + // is sometimes set to 1 instead of 0 as a hint to the command-line shell + // that this Goto is the bottom of a loop and that the lines from P2 down + // to the current line should be indented for EXPLAIN output. + case OP_Goto: + goto __9 + + // Opcode: Gosub P1 P2 * * * + // + // Write the current address onto register P1 + // and then jump to address P2. + case OP_Gosub: + goto __10 + + // Opcode: Return P1 * * * * + // + // Jump to the next instruction after the address in register P1. After + // the jump, register P1 becomes undefined. + case OP_Return: + goto __11 + + // Opcode: InitCoroutine P1 P2 P3 * * + // + // Set up register P1 so that it will Yield to the coroutine + // located at address P3. + // + // If P2!=0 then the coroutine implementation immediately follows + // this opcode. So jump over the coroutine implementation to + // address P2. + // + // See also: EndCoroutine + case OP_InitCoroutine: + goto __12 + + // Opcode: EndCoroutine P1 * * * * + // + // The instruction at the address in register P1 is a Yield. + // Jump to the P2 parameter of that Yield. + // After the jump, register P1 becomes undefined. + // + // See also: InitCoroutine + case OP_EndCoroutine: + goto __13 + + // Opcode: Yield P1 P2 * * * + // + // Swap the program counter with the value in register P1. This + // has the effect of yielding to a coroutine. + // + // If the coroutine that is launched by this instruction ends with + // Yield or Return then continue to the next instruction. But if + // the coroutine launched by this instruction ends with + // EndCoroutine, then jump to P2 rather than continuing with the + // next instruction. + // + // See also: InitCoroutine + case OP_Yield: + goto __14 + + // Opcode: HaltIfNull P1 P2 P3 P4 P5 + // Synopsis: if r[P3]=null halt + // + // Check the value in register P3. If it is NULL then Halt using + // parameter P1, P2, and P4 as if this were a Halt instruction. If the + // value in register P3 is not NULL, then this routine is a no-op. + // The P5 parameter should be 1. + case OP_HaltIfNull: + goto __15 + + // Opcode: Halt P1 P2 * P4 P5 + // + // Exit immediately. All open cursors, etc are closed + // automatically. + // + // P1 is the result code returned by sqlite3_exec(), sqlite3_reset(), + // or sqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0). + // For errors, it can be some other value. If P1!=0 then P2 will determine + // whether or not to rollback the current transaction. Do not rollback + // if P2==OE_Fail. Do the rollback if P2==OE_Rollback. If P2==OE_Abort, + // then back out all changes that have occurred during this execution of the + // VDBE, but do not rollback the transaction. + // + // If P4 is not null then it is an error message string. + // + // P5 is a value between 0 and 4, inclusive, that modifies the P4 string. + // + // 0: (no change) + // 1: NOT NULL contraint failed: P4 + // 2: UNIQUE constraint failed: P4 + // 3: CHECK constraint failed: P4 + // 4: FOREIGN KEY constraint failed: P4 + // + // If P5 is not zero and P4 is NULL, then everything after the ":" is + // omitted. + // + // There is an implied "Halt 0 0 0" instruction inserted at the very end of + // every program. So a jump past the last instruction of the program + // is the same as executing Halt. + case OP_Halt: + goto __16 + + // Opcode: Integer P1 P2 * * * + // Synopsis: r[P2]=P1 + // + // The 32-bit integer value P1 is written into register P2. + case OP_Integer: + goto __17 + + // Opcode: Int64 * P2 * P4 * + // Synopsis: r[P2]=P4 + // + // P4 is a pointer to a 64-bit integer value. + // Write that value into register P2. + case OP_Int64: + goto __18 + + // Opcode: Real * P2 * P4 * + // Synopsis: r[P2]=P4 + // + // P4 is a pointer to a 64-bit floating point value. + // Write that value into register P2. + case OP_Real: + goto __19 + + // Opcode: String8 * P2 * P4 * + // Synopsis: r[P2]='P4' + // + // P4 points to a nul terminated UTF-8 string. This opcode is transformed + // into a String opcode before it is executed for the first time. During + // this transformation, the length of string P4 is computed and stored + // as the P1 parameter. + case OP_String8: + goto __20 + + // Opcode: String P1 P2 P3 P4 P5 + // Synopsis: r[P2]='P4' (len=P1) + // + // The string value P4 of length P1 (bytes) is stored in register P2. + // + // If P3 is not zero and the content of register P3 is equal to P5, then + // the datatype of the register P2 is converted to BLOB. The content is + // the same sequence of bytes, it is merely interpreted as a BLOB instead + // of a string, as if it had been CAST. In other words: + // + // if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) + case OP_String: + goto __21 + + // Opcode: Null P1 P2 P3 * * + // Synopsis: r[P2..P3]=NULL + // + // Write a NULL into registers P2. If P3 greater than P2, then also write + // NULL into register P3 and every register in between P2 and P3. If P3 + // is less than P2 (typically P3 is zero) then only register P2 is + // set to NULL. + // + // If the P1 value is non-zero, then also set the MEM_Cleared flag so that + // NULL values will not compare equal even if SQLITE_NULLEQ is set on + // OP_Ne or OP_Eq. + case OP_Null: + goto __22 + + // Opcode: SoftNull P1 * * * * + // Synopsis: r[P1]=NULL + // + // Set register P1 to have the value NULL as seen by the OP_MakeRecord + // instruction, but do not free any string or blob memory associated with + // the register, so that if the value was a string or blob that was + // previously copied using OP_SCopy, the copies will continue to be valid. + case OP_SoftNull: + goto __23 + + // Opcode: Blob P1 P2 * P4 * + // Synopsis: r[P2]=P4 (len=P1) + // + // P4 points to a blob of data P1 bytes long. Store this + // blob in register P2. + case OP_Blob: + goto __24 + + // Opcode: Variable P1 P2 * P4 * + // Synopsis: r[P2]=parameter(P1,P4) + // + // Transfer the values of bound parameter P1 into register P2 + // + // If the parameter is named, then its name appears in P4. + // The P4 value is used by sqlite3_bind_parameter_name(). + case OP_Variable: + goto __25 + + // Opcode: Move P1 P2 P3 * * + // Synopsis: r[P2@P3]=r[P1@P3] + // + // Move the P3 values in register P1..P1+P3-1 over into + // registers P2..P2+P3-1. Registers P1..P1+P3-1 are + // left holding a NULL. It is an error for register ranges + // P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error + // for P3 to be less than 1. + case OP_Move: + goto __26 + + // Opcode: Copy P1 P2 P3 * * + // Synopsis: r[P2@P3+1]=r[P1@P3+1] + // + // Make a copy of registers P1..P1+P3 into registers P2..P2+P3. + // + // This instruction makes a deep copy of the value. A duplicate + // is made of any string or blob constant. See also OP_SCopy. + case OP_Copy: + goto __27 + + // Opcode: SCopy P1 P2 * * * + // Synopsis: r[P2]=r[P1] + // + // Make a shallow copy of register P1 into register P2. + // + // This instruction makes a shallow copy of the value. If the value + // is a string or blob, then the copy is only a pointer to the + // original and hence if the original changes so will the copy. + // Worse, if the original is deallocated, the copy becomes invalid. + // Thus the program must guarantee that the original will not change + // during the lifetime of the copy. Use OP_Copy to make a complete + // copy. + case OP_SCopy: + goto __28 + + // Opcode: IntCopy P1 P2 * * * + // Synopsis: r[P2]=r[P1] + // + // Transfer the integer value held in register P1 into register P2. + // + // This is an optimized version of SCopy that works only for integer + // values. + case OP_IntCopy: + goto __29 + + // Opcode: ChngCntRow P1 P2 * * * + // Synopsis: output=r[P1] + // + // Output value in register P1 as the chance count for a DML statement, + // due to the "PRAGMA count_changes=ON" setting. Or, if there was a + // foreign key error in the statement, trigger the error now. + // + // This opcode is a variant of OP_ResultRow that checks the foreign key + // immediate constraint count and throws an error if the count is + // non-zero. The P2 opcode must be 1. + case OP_ChngCntRow: + goto __30 + + // Opcode: ResultRow P1 P2 * * * + // Synopsis: output=r[P1@P2] + // + // The registers P1 through P1+P2-1 contain a single row of + // results. This opcode causes the sqlite3_step() call to terminate + // with an SQLITE_ROW return code and it sets up the sqlite3_stmt + // structure to provide access to the r(P1)..r(P1+P2-1) values as + // the result row. + case OP_ResultRow: + goto __31 + + // Opcode: Concat P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]+r[P1] + // + // Add the text in register P1 onto the end of the text in + // register P2 and store the result in register P3. + // If either the P1 or P2 text are NULL then store NULL in P3. + // + // P3 = P2 || P1 + // + // It is illegal for P1 and P3 to be the same register. Sometimes, + // if P3 is the same register as P2, the implementation is able + // to avoid a memcpy(). + case OP_Concat: + goto __32 + + // Opcode: Add P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]+r[P2] + // + // Add the value in register P1 to the value in register P2 + // and store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: Multiply P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]*r[P2] + // + // + // Multiply the value in register P1 by the value in register P2 + // and store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: Subtract P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]-r[P1] + // + // Subtract the value in register P1 from the value in register P2 + // and store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: Divide P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]/r[P1] + // + // Divide the value in register P1 by the value in register P2 + // and store the result in register P3 (P3=P2/P1). If the value in + // register P1 is zero, then the result is NULL. If either input is + // NULL, the result is NULL. + // Opcode: Remainder P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]%r[P1] + // + // Compute the remainder after integer register P2 is divided by + // register P1 and store the result in register P3. + // If the value in register P1 is zero the result is NULL. + // If either operand is NULL, the result is NULL. + case OP_Add: + goto __33 // same as TK_PLUS, in1, in2, out3 + case OP_Subtract: + goto __34 // same as TK_MINUS, in1, in2, out3 + case OP_Multiply: + goto __35 // same as TK_STAR, in1, in2, out3 + case OP_Divide: + goto __36 // same as TK_SLASH, in1, in2, out3 + case OP_Remainder: + goto __37 + + // Opcode: CollSeq P1 * * P4 + // + // P4 is a pointer to a CollSeq object. If the next call to a user function + // or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will + // be returned. This is used by the built-in min(), max() and nullif() + // functions. + // + // If P1 is not zero, then it is a register that a subsequent min() or + // max() aggregate will set to 1 if the current row is not the minimum or + // maximum. The P1 register is initialized to 0 by this instruction. + // + // The interface used by the implementation of the aforementioned functions + // to retrieve the collation sequence set by this opcode is not available + // publicly. Only built-in functions have access to this feature. + case OP_CollSeq: + goto __38 + + // Opcode: BitAnd P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]&r[P2] + // + // Take the bit-wise AND of the values in register P1 and P2 and + // store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: BitOr P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]|r[P2] + // + // Take the bit-wise OR of the values in register P1 and P2 and + // store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: ShiftLeft P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]<>r[P1] + // + // Shift the integer value in register P2 to the right by the + // number of bits specified by the integer in register P1. + // Store the result in register P3. + // If either input is NULL, the result is NULL. + case OP_BitAnd: + goto __39 // same as TK_BITAND, in1, in2, out3 + case OP_BitOr: + goto __40 // same as TK_BITOR, in1, in2, out3 + case OP_ShiftLeft: + goto __41 // same as TK_LSHIFT, in1, in2, out3 + case OP_ShiftRight: + goto __42 + + // Opcode: AddImm P1 P2 * * * + // Synopsis: r[P1]=r[P1]+P2 + // + // Add the constant P2 to the value in register P1. + // The result is always an integer. + // + // To force any register to be an integer, just add 0. + case OP_AddImm: + goto __43 + + // Opcode: MustBeInt P1 P2 * * * + // + // Force the value in register P1 to be an integer. If the value + // in P1 is not an integer and cannot be converted into an integer + // without data loss, then jump immediately to P2, or if P2==0 + // raise an SQLITE_MISMATCH exception. + case OP_MustBeInt: + goto __44 + + // Opcode: RealAffinity P1 * * * * + // + // If register P1 holds an integer convert it to a real value. + // + // This opcode is used when extracting information from a column that + // has REAL affinity. Such column values may still be stored as + // integers, for space efficiency, but after extraction we want them + // to have only a real value. + case OP_RealAffinity: + goto __45 + + // Opcode: Cast P1 P2 * * * + // Synopsis: affinity(r[P1]) + // + // Force the value in register P1 to be the type defined by P2. + // + //
    + //
  • P2=='A' → BLOB + //
  • P2=='B' → TEXT + //
  • P2=='C' → NUMERIC + //
  • P2=='D' → INTEGER + //
  • P2=='E' → REAL + //
+ // + // A NULL value is not changed by this routine. It remains NULL. + case OP_Cast: + goto __46 + + // Opcode: Eq P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]==r[P1] + // + // Compare the values in register P1 and P3. If reg(P3)==reg(P1) then + // jump to address P2. + // + // The SQLITE_AFF_MASK portion of P5 must be an affinity character - + // SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made + // to coerce both inputs according to this affinity before the + // comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric + // affinity is used. Note that the affinity conversions are stored + // back into the input registers P1 and P3. So this opcode can cause + // persistent changes to registers P1 and P3. + // + // Once any conversions have taken place, and neither value is NULL, + // the values are compared. If both values are blobs then memcmp() is + // used to determine the results of the comparison. If both values + // are text, then the appropriate collating function specified in + // P4 is used to do the comparison. If P4 is not specified then + // memcmp() is used to compare text string. If both values are + // numeric, then a numeric comparison is used. If the two values + // are of different types, then numbers are considered less than + // strings and strings are considered less than blobs. + // + // If SQLITE_NULLEQ is set in P5 then the result of comparison is always either + // true or false and is never NULL. If both operands are NULL then the result + // of comparison is true. If either operand is NULL then the result is false. + // If neither operand is NULL the result is the same as it would be if + // the SQLITE_NULLEQ flag were omitted from P5. + // + // This opcode saves the result of comparison for use by the new + // OP_Jump opcode. + // Opcode: Ne P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]!=r[P1] + // + // This works just like the Eq opcode except that the jump is taken if + // the operands in registers P1 and P3 are not equal. See the Eq opcode for + // additional information. + // Opcode: Lt P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]r[P1] + // + // This works just like the Lt opcode except that the jump is taken if + // the content of register P3 is greater than the content of + // register P1. See the Lt opcode for additional information. + // Opcode: Ge P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]>=r[P1] + // + // This works just like the Lt opcode except that the jump is taken if + // the content of register P3 is greater than or equal to the content of + // register P1. See the Lt opcode for additional information. + case OP_Eq: + goto __47 // same as TK_EQ, jump, in1, in3 + case OP_Ne: + goto __48 // same as TK_NE, jump, in1, in3 + case OP_Lt: + goto __49 // same as TK_LT, jump, in1, in3 + case OP_Le: + goto __50 // same as TK_LE, jump, in1, in3 + case OP_Gt: + goto __51 // same as TK_GT, jump, in1, in3 + case OP_Ge: + goto __52 + + // Opcode: ElseEq * P2 * * * + // + // This opcode must follow an OP_Lt or OP_Gt comparison operator. There + // can be zero or more OP_ReleaseReg opcodes intervening, but no other + // opcodes are allowed to occur between this instruction and the previous + // OP_Lt or OP_Gt. + // + // If result of an OP_Eq comparison on the same two operands as the + // prior OP_Lt or OP_Gt would have been true, then jump to P2. + // If the result of an OP_Eq comparison on the two previous + // operands would have been false or NULL, then fall through. + case OP_ElseEq: + goto __53 + + // Opcode: Permutation * * * P4 * + // + // Set the permutation used by the OP_Compare operator in the next + // instruction. The permutation is stored in the P4 operand. + // + // The permutation is only valid until the next OP_Compare that has + // the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should + // occur immediately prior to the OP_Compare. + // + // The first integer in the P4 integer array is the length of the array + // and does not become part of the permutation. + case OP_Permutation: + goto __54 + + // Opcode: Compare P1 P2 P3 P4 P5 + // Synopsis: r[P1@P3] <-> r[P2@P3] + // + // Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this + // vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of + // the comparison for use by the next OP_Jump instruct. + // + // If P5 has the OPFLAG_PERMUTE bit set, then the order of comparison is + // determined by the most recent OP_Permutation operator. If the + // OPFLAG_PERMUTE bit is clear, then register are compared in sequential + // order. + // + // P4 is a KeyInfo structure that defines collating sequences and sort + // orders for the comparison. The permutation applies to registers + // only. The KeyInfo elements are used sequentially. + // + // The comparison is a sort comparison, so NULLs compare equal, + // NULLs are less than numbers, numbers are less than strings, + // and strings are less than blobs. + case OP_Compare: + goto __55 + + // Opcode: Jump P1 P2 P3 * * + // + // Jump to the instruction at address P1, P2, or P3 depending on whether + // in the most recent OP_Compare instruction the P1 vector was less than + // equal to, or greater than the P2 vector, respectively. + case OP_Jump: + goto __56 + + // Opcode: And P1 P2 P3 * * + // Synopsis: r[P3]=(r[P1] && r[P2]) + // + // Take the logical AND of the values in registers P1 and P2 and + // write the result into register P3. + // + // If either P1 or P2 is 0 (false) then the result is 0 even if + // the other input is NULL. A NULL and true or two NULLs give + // a NULL output. + // Opcode: Or P1 P2 P3 * * + // Synopsis: r[P3]=(r[P1] || r[P2]) + // + // Take the logical OR of the values in register P1 and P2 and + // store the answer in register P3. + // + // If either P1 or P2 is nonzero (true) then the result is 1 (true) + // even if the other input is NULL. A NULL and false or two NULLs + // give a NULL output. + case OP_And: + goto __57 // same as TK_AND, in1, in2, out3 + case OP_Or: + goto __58 + + // Opcode: IsTrue P1 P2 P3 P4 * + // Synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 + // + // This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and + // IS NOT FALSE operators. + // + // Interpret the value in register P1 as a boolean value. Store that + // boolean (a 0 or 1) in register P2. Or if the value in register P1 is + // NULL, then the P3 is stored in register P2. Invert the answer if P4 + // is 1. + // + // The logic is summarized like this: + // + //
    + //
  • If P3==0 and P4==0 then r[P2] := r[P1] IS TRUE + //
  • If P3==1 and P4==1 then r[P2] := r[P1] IS FALSE + //
  • If P3==0 and P4==1 then r[P2] := r[P1] IS NOT TRUE + //
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE + //
+ case OP_IsTrue: + goto __59 + + // Opcode: Not P1 P2 * * * + // Synopsis: r[P2]= !r[P1] + // + // Interpret the value in register P1 as a boolean value. Store the + // boolean complement in register P2. If the value in register P1 is + // NULL, then a NULL is stored in P2. + case OP_Not: + goto __60 + + // Opcode: BitNot P1 P2 * * * + // Synopsis: r[P2]= ~r[P1] + // + // Interpret the content of register P1 as an integer. Store the + // ones-complement of the P1 value into register P2. If P1 holds + // a NULL then store a NULL in P2. + case OP_BitNot: + goto __61 + + // Opcode: Once P1 P2 * * * + // + // Fall through to the next instruction the first time this opcode is + // encountered on each invocation of the byte-code program. Jump to P2 + // on the second and all subsequent encounters during the same invocation. + // + // Top-level programs determine first invocation by comparing the P1 + // operand against the P1 operand on the OP_Init opcode at the beginning + // of the program. If the P1 values differ, then fall through and make + // the P1 of this opcode equal to the P1 of OP_Init. If P1 values are + // the same then take the jump. + // + // For subprograms, there is a bitmask in the VdbeFrame that determines + // whether or not the jump should be taken. The bitmask is necessary + // because the self-altering code trick does not work for recursive + // triggers. + case OP_Once: + goto __62 + + // Opcode: If P1 P2 P3 * * + // + // Jump to P2 if the value in register P1 is true. The value + // is considered true if it is numeric and non-zero. If the value + // in P1 is NULL then take the jump if and only if P3 is non-zero. + case OP_If: + goto __63 + + // Opcode: IfNot P1 P2 P3 * * + // + // Jump to P2 if the value in register P1 is False. The value + // is considered false if it has a numeric value of zero. If the value + // in P1 is NULL then take the jump if and only if P3 is non-zero. + case OP_IfNot: + goto __64 + + // Opcode: IsNull P1 P2 * * * + // Synopsis: if r[P1]==NULL goto P2 + // + // Jump to P2 if the value in register P1 is NULL. + case OP_IsNull: + goto __65 + + // Opcode: ZeroOrNull P1 P2 P3 * * + // Synopsis: r[P2] = 0 OR NULL + // + // If all both registers P1 and P3 are NOT NULL, then store a zero in + // register P2. If either registers P1 or P3 are NULL then put + // a NULL in register P2. + case OP_ZeroOrNull: + goto __66 + + // Opcode: NotNull P1 P2 * * * + // Synopsis: if r[P1]!=NULL goto P2 + // + // Jump to P2 if the value in register P1 is not NULL. + case OP_NotNull: + goto __67 + + // Opcode: IfNullRow P1 P2 P3 * * + // Synopsis: if P1.nullRow then r[P3]=NULL, goto P2 + // + // Check the cursor P1 to see if it is currently pointing at a NULL row. + // If it is, then set register P3 to NULL and jump immediately to P2. + // If P1 is not on a NULL row, then fall through without making any + // changes. + case OP_IfNullRow: + goto __68 + + // Opcode: Offset P1 P2 P3 * * + // Synopsis: r[P3] = sqlite_offset(P1) + // + // Store in register r[P3] the byte offset into the database file that is the + // start of the payload for the record at which that cursor P1 is currently + // pointing. + // + // P2 is the column number for the argument to the sqlite_offset() function. + // This opcode does not use P2 itself, but the P2 value is used by the + // code generator. The P1, P2, and P3 operands to this opcode are the + // same as for OP_Column. + // + // This opcode is only available if SQLite is compiled with the + // -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. + case OP_Offset: + goto __69 + + // Opcode: Column P1 P2 P3 P4 P5 + // Synopsis: r[P3]=PX + // + // Interpret the data that cursor P1 points to as a structure built using + // the MakeRecord instruction. (See the MakeRecord opcode for additional + // information about the format of the data.) Extract the P2-th column + // from this record. If there are less that (P2+1) + // values in the record, extract a NULL. + // + // The value extracted is stored in register P3. + // + // If the record contains fewer than P2 fields, then extract a NULL. Or, + // if the P4 argument is a P4_MEM use the value of the P4 argument as + // the result. + // + // If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 then + // the result is guaranteed to only be used as the argument of a length() + // or typeof() function, respectively. The loading of large blobs can be + // skipped for length() and all content loading can be skipped for typeof(). + case OP_Column: + goto __70 + + // Opcode: Affinity P1 P2 * P4 * + // Synopsis: affinity(r[P1@P2]) + // + // Apply affinities to a range of P2 registers starting with P1. + // + // P4 is a string that is P2 characters long. The N-th character of the + // string indicates the column affinity that should be used for the N-th + // memory cell in the range. + case OP_Affinity: + goto __71 + + // Opcode: MakeRecord P1 P2 P3 P4 * + // Synopsis: r[P3]=mkrec(r[P1@P2]) + // + // Convert P2 registers beginning with P1 into the [record format] + // use as a data record in a database table or as a key + // in an index. The OP_Column opcode can decode the record later. + // + // P4 may be a string that is P2 characters long. The N-th character of the + // string indicates the column affinity that should be used for the N-th + // field of the index key. + // + // The mapping from character to affinity is given by the SQLITE_AFF_ + // macros defined in sqliteInt.h. + // + // If P4 is NULL then all index fields have the affinity BLOB. + // + // The meaning of P5 depends on whether or not the SQLITE_ENABLE_NULL_TRIM + // compile-time option is enabled: + // + // * If SQLITE_ENABLE_NULL_TRIM is enabled, then the P5 is the index + // of the right-most table that can be null-trimmed. + // + // * If SQLITE_ENABLE_NULL_TRIM is omitted, then P5 has the value + // OPFLAG_NOCHNG_MAGIC if the OP_MakeRecord opcode is allowed to + // accept no-change records with serial_type 10. This value is + // only used inside an assert() and does not affect the end result. + case OP_MakeRecord: + goto __72 + + // Opcode: Count P1 P2 p3 * * + // Synopsis: r[P2]=count() + // + // Store the number of entries (an integer value) in the table or index + // opened by cursor P1 in register P2. + // + // If P3==0, then an exact count is obtained, which involves visiting + // every btree page of the table. But if P3 is non-zero, an estimate + // is returned based on the current cursor position. + case OP_Count: + goto __73 + + // Opcode: Savepoint P1 * * P4 * + // + // Open, release or rollback the savepoint named by parameter P4, depending + // on the value of P1. To open a new savepoint set P1==0 (SAVEPOINT_BEGIN). + // To release (commit) an existing savepoint set P1==1 (SAVEPOINT_RELEASE). + // To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). + case OP_Savepoint: + goto __74 + + // Opcode: AutoCommit P1 P2 * * * + // + // Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll + // back any currently active btree transactions. If there are any active + // VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if + // there are active writing VMs or active VMs that use shared cache. + // + // This instruction causes the VM to halt. + case OP_AutoCommit: + goto __75 + + // Opcode: Transaction P1 P2 P3 P4 P5 + // + // Begin a transaction on database P1 if a transaction is not already + // active. + // If P2 is non-zero, then a write-transaction is started, or if a + // read-transaction is already active, it is upgraded to a write-transaction. + // If P2 is zero, then a read-transaction is started. If P2 is 2 or more + // then an exclusive transaction is started. + // + // P1 is the index of the database file on which the transaction is + // started. Index 0 is the main database file and index 1 is the + // file used for temporary tables. Indices of 2 or more are used for + // attached databases. + // + // If a write-transaction is started and the Vdbe.usesStmtJournal flag is + // true (this flag is set if the Vdbe may modify more than one row and may + // throw an ABORT exception), a statement transaction may also be opened. + // More specifically, a statement transaction is opened iff the database + // connection is currently not in autocommit mode, or if there are other + // active statements. A statement transaction allows the changes made by this + // VDBE to be rolled back after an error without having to roll back the + // entire transaction. If no error is encountered, the statement transaction + // will automatically commit when the VDBE halts. + // + // If P5!=0 then this opcode also checks the schema cookie against P3 + // and the schema generation counter against P4. + // The cookie changes its value whenever the database schema changes. + // This operation is used to detect when that the cookie has changed + // and that the current process needs to reread the schema. If the schema + // cookie in P3 differs from the schema cookie in the database header or + // if the schema generation counter in P4 differs from the current + // generation counter, then an SQLITE_SCHEMA error is raised and execution + // halts. The sqlite3_step() wrapper function might then reprepare the + // statement and rerun it from the beginning. + case OP_Transaction: + goto __76 + + // Opcode: ReadCookie P1 P2 P3 * * + // + // Read cookie number P3 from database P1 and write it into register P2. + // P3==1 is the schema version. P3==2 is the database format. + // P3==3 is the recommended pager cache size, and so forth. P1==0 is + // the main database file and P1==1 is the database file used to store + // temporary tables. + // + // There must be a read-lock on the database (either a transaction + // must be started or there must be an open cursor) before + // executing this instruction. + case OP_ReadCookie: + goto __77 + + // Opcode: SetCookie P1 P2 P3 * P5 + // + // Write the integer value P3 into cookie number P2 of database P1. + // P2==1 is the schema version. P2==2 is the database format. + // P2==3 is the recommended pager cache + // size, and so forth. P1==0 is the main database file and P1==1 is the + // database file used to store temporary tables. + // + // A transaction must be started before executing this opcode. + // + // If P2 is the SCHEMA_VERSION cookie (cookie number 1) then the internal + // schema version is set to P3-P5. The "PRAGMA schema_version=N" statement + // has P5 set to 1, so that the internal schema version will be different + // from the database schema version, resulting in a schema reset. + case OP_SetCookie: + goto __78 + + // Opcode: OpenRead P1 P2 P3 P4 P5 + // Synopsis: root=P2 iDb=P3 + // + // Open a read-only cursor for the database table whose root page is + // P2 in a database file. The database file is determined by P3. + // P3==0 means the main database, P3==1 means the database used for + // temporary tables, and P3>1 means used the corresponding attached + // database. Give the new cursor an identifier of P1. The P1 + // values need not be contiguous but all P1 values should be small integers. + // It is an error for P1 to be negative. + // + // Allowed P5 bits: + //
    + //
  • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + // equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + // of OP_SeekLE/OP_IdxLT) + //
+ // + // The P4 value may be either an integer (P4_INT32) or a pointer to + // a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo + // object, then table being opened must be an [index b-tree] where the + // KeyInfo object defines the content and collating + // sequence of that index b-tree. Otherwise, if P4 is an integer + // value, then the table being opened must be a [table b-tree] with a + // number of columns no less than the value of P4. + // + // See also: OpenWrite, ReopenIdx + // Opcode: ReopenIdx P1 P2 P3 P4 P5 + // Synopsis: root=P2 iDb=P3 + // + // The ReopenIdx opcode works like OP_OpenRead except that it first + // checks to see if the cursor on P1 is already open on the same + // b-tree and if it is this opcode becomes a no-op. In other words, + // if the cursor is already open, do not reopen it. + // + // The ReopenIdx opcode may only be used with P5==0 or P5==OPFLAG_SEEKEQ + // and with P4 being a P4_KEYINFO object. Furthermore, the P3 value must + // be the same as every other ReopenIdx or OpenRead for the same cursor + // number. + // + // Allowed P5 bits: + //
    + //
  • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + // equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + // of OP_SeekLE/OP_IdxLT) + //
+ // + // See also: OP_OpenRead, OP_OpenWrite + // Opcode: OpenWrite P1 P2 P3 P4 P5 + // Synopsis: root=P2 iDb=P3 + // + // Open a read/write cursor named P1 on the table or index whose root + // page is P2 (or whose root page is held in register P2 if the + // OPFLAG_P2ISREG bit is set in P5 - see below). + // + // The P4 value may be either an integer (P4_INT32) or a pointer to + // a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo + // object, then table being opened must be an [index b-tree] where the + // KeyInfo object defines the content and collating + // sequence of that index b-tree. Otherwise, if P4 is an integer + // value, then the table being opened must be a [table b-tree] with a + // number of columns no less than the value of P4. + // + // Allowed P5 bits: + //
    + //
  • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + // equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + // of OP_SeekLE/OP_IdxLT) + //
  • 0x08 OPFLAG_FORDELETE: This cursor is used only to seek + // and subsequently delete entries in an index btree. This is a + // hint to the storage engine that the storage engine is allowed to + // ignore. The hint is not used by the official SQLite b*tree storage + // engine, but is used by COMDB2. + //
  • 0x10 OPFLAG_P2ISREG: Use the content of register P2 + // as the root page, not the value of P2 itself. + //
+ // + // This instruction works like OpenRead except that it opens the cursor + // in read/write mode. + // + // See also: OP_OpenRead, OP_ReopenIdx + case OP_ReopenIdx: + goto __79 + // If the cursor is not currently open or is open on a different + // index, then fall through into OP_OpenRead to force a reopen + case OP_OpenRead: + goto __80 + case OP_OpenWrite: + goto __81 + + // Opcode: OpenDup P1 P2 * * * + // + // Open a new cursor P1 that points to the same ephemeral table as + // cursor P2. The P2 cursor must have been opened by a prior OP_OpenEphemeral + // opcode. Only ephemeral cursors may be duplicated. + // + // Duplicate ephemeral cursors are used for self-joins of materialized views. + case OP_OpenDup: + goto __82 + + // Opcode: OpenEphemeral P1 P2 P3 P4 P5 + // Synopsis: nColumn=P2 + // + // Open a new cursor P1 to a transient table. + // The cursor is always opened read/write even if + // the main database is read-only. The ephemeral + // table is deleted automatically when the cursor is closed. + // + // If the cursor P1 is already opened on an ephemeral table, the table + // is cleared (all content is erased). + // + // P2 is the number of columns in the ephemeral table. + // The cursor points to a BTree table if P4==0 and to a BTree index + // if P4 is not 0. If P4 is not NULL, it points to a KeyInfo structure + // that defines the format of keys in the index. + // + // The P5 parameter can be a mask of the BTREE_* flags defined + // in btree.h. These flags control aspects of the operation of + // the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are + // added automatically. + // + // If P3 is positive, then reg[P3] is modified slightly so that it + // can be used as zero-length data for OP_Insert. This is an optimization + // that avoids an extra OP_Blob opcode to initialize that register. + // Opcode: OpenAutoindex P1 P2 * P4 * + // Synopsis: nColumn=P2 + // + // This opcode works the same as OP_OpenEphemeral. It has a + // different name to distinguish its use. Tables created using + // by this opcode will be used for automatically created transient + // indices in joins. + case OP_OpenAutoindex: + goto __83 + case OP_OpenEphemeral: + goto __84 + + // Opcode: SorterOpen P1 P2 P3 P4 * + // + // This opcode works like OP_OpenEphemeral except that it opens + // a transient index that is specifically designed to sort large + // tables using an external merge-sort algorithm. + // + // If argument P3 is non-zero, then it indicates that the sorter may + // assume that a stable sort considering the first P3 fields of each + // key is sufficient to produce the required results. + case OP_SorterOpen: + goto __85 + + // Opcode: SequenceTest P1 P2 * * * + // Synopsis: if( cursor[P1].ctr++ ) pc = P2 + // + // P1 is a sorter cursor. If the sequence counter is currently zero, jump + // to P2. Regardless of whether or not the jump is taken, increment the + // the sequence value. + case OP_SequenceTest: + goto __86 + + // Opcode: OpenPseudo P1 P2 P3 * * + // Synopsis: P3 columns in r[P2] + // + // Open a new cursor that points to a fake table that contains a single + // row of data. The content of that one row is the content of memory + // register P2. In other words, cursor P1 becomes an alias for the + // MEM_Blob content contained in register P2. + // + // A pseudo-table created by this opcode is used to hold a single + // row output from the sorter so that the row can be decomposed into + // individual columns using the OP_Column opcode. The OP_Column opcode + // is the only cursor opcode that works with a pseudo-table. + // + // P3 is the number of fields in the records that will be stored by + // the pseudo-table. + case OP_OpenPseudo: + goto __87 + + // Opcode: Close P1 * * * * + // + // Close a cursor previously opened as P1. If P1 is not + // currently open, this instruction is a no-op. + case OP_Close: + goto __88 + + // Opcode: SeekGE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as the key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the smallest entry that + // is greater than or equal to the key value. If there are no records + // greater than or equal to the key and P2 is not zero, then jump to P2. + // + // If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this + // opcode will either land on a record that exactly matches the key, or + // else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ, + // this opcode must be followed by an IdxLE opcode with the same arguments. + // The IdxGT opcode will be skipped if this opcode succeeds, but the + // IdxGT opcode will be used on subsequent loop iterations. The + // OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this + // is an equality search. + // + // This opcode leaves the cursor configured to move in forward order, + // from the beginning toward the end. In other words, the cursor is + // configured to use Next, not Prev. + // + // See also: Found, NotFound, SeekLt, SeekGt, SeekLe + // Opcode: SeekGT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as a key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the smallest entry that + // is greater than the key value. If there are no records greater than + // the key and P2 is not zero, then jump to P2. + // + // This opcode leaves the cursor configured to move in forward order, + // from the beginning toward the end. In other words, the cursor is + // configured to use Next, not Prev. + // + // See also: Found, NotFound, SeekLt, SeekGe, SeekLe + // Opcode: SeekLT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as a key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the largest entry that + // is less than the key value. If there are no records less than + // the key and P2 is not zero, then jump to P2. + // + // This opcode leaves the cursor configured to move in reverse order, + // from the end toward the beginning. In other words, the cursor is + // configured to use Prev, not Next. + // + // See also: Found, NotFound, SeekGt, SeekGe, SeekLe + // Opcode: SeekLE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as a key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the largest entry that + // is less than or equal to the key value. If there are no records + // less than or equal to the key and P2 is not zero, then jump to P2. + // + // This opcode leaves the cursor configured to move in reverse order, + // from the end toward the beginning. In other words, the cursor is + // configured to use Prev, not Next. + // + // If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this + // opcode will either land on a record that exactly matches the key, or + // else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ, + // this opcode must be followed by an IdxLE opcode with the same arguments. + // The IdxGE opcode will be skipped if this opcode succeeds, but the + // IdxGE opcode will be used on subsequent loop iterations. The + // OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this + // is an equality search. + // + // See also: Found, NotFound, SeekGt, SeekGe, SeekLt + case OP_SeekLT: + goto __89 // jump, in3, group + case OP_SeekLE: + goto __90 // jump, in3, group + case OP_SeekGE: + goto __91 // jump, in3, group + case OP_SeekGT: + goto __92 + + // Opcode: SeekScan P1 P2 * * * + // Synopsis: Scan-ahead up to P1 rows + // + // This opcode is a prefix opcode to OP_SeekGE. In other words, this + // opcode must be immediately followed by OP_SeekGE. This constraint is + // checked by assert() statements. + // + // This opcode uses the P1 through P4 operands of the subsequent + // OP_SeekGE. In the text that follows, the operands of the subsequent + // OP_SeekGE opcode are denoted as SeekOP.P1 through SeekOP.P4. Only + // the P1 and P2 operands of this opcode are also used, and are called + // This.P1 and This.P2. + // + // This opcode helps to optimize IN operators on a multi-column index + // where the IN operator is on the later terms of the index by avoiding + // unnecessary seeks on the btree, substituting steps to the next row + // of the b-tree instead. A correct answer is obtained if this opcode + // is omitted or is a no-op. + // + // The SeekGE.P3 and SeekGE.P4 operands identify an unpacked key which + // is the desired entry that we want the cursor SeekGE.P1 to be pointing + // to. Call this SeekGE.P4/P5 row the "target". + // + // If the SeekGE.P1 cursor is not currently pointing to a valid row, + // then this opcode is a no-op and control passes through into the OP_SeekGE. + // + // If the SeekGE.P1 cursor is pointing to a valid row, then that row + // might be the target row, or it might be near and slightly before the + // target row. This opcode attempts to position the cursor on the target + // row by, perhaps by invoking sqlite3BtreeStep() on the cursor + // between 0 and This.P1 times. + // + // There are three possible outcomes from this opcode:
    + // + //
  1. If after This.P1 steps, the cursor is still pointing to a place that + // is earlier in the btree than the target row, then fall through + // into the subsquence OP_SeekGE opcode. + // + //
  2. If the cursor is successfully moved to the target row by 0 or more + // sqlite3BtreeNext() calls, then jump to This.P2, which will land just + // past the OP_IdxGT or OP_IdxGE opcode that follows the OP_SeekGE. + // + //
  3. If the cursor ends up past the target row (indicating the the target + // row does not exist in the btree) then jump to SeekOP.P2. + //
+ case OP_SeekScan: + goto __93 + + // Opcode: SeekHit P1 P2 P3 * * + // Synopsis: set P2<=seekHit<=P3 + // + // Increase or decrease the seekHit value for cursor P1, if necessary, + // so that it is no less than P2 and no greater than P3. + // + // The seekHit integer represents the maximum of terms in an index for which + // there is known to be at least one match. If the seekHit value is smaller + // than the total number of equality terms in an index lookup, then the + // OP_IfNoHope opcode might run to see if the IN loop can be abandoned + // early, thus saving work. This is part of the IN-early-out optimization. + // + // P1 must be a valid b-tree cursor. + case OP_SeekHit: + goto __94 + + // Opcode: IfNotOpen P1 P2 * * * + // Synopsis: if( !csr[P1] ) goto P2 + // + // If cursor P1 is not open, jump to instruction P2. Otherwise, fall through. + case OP_IfNotOpen: + goto __95 + + // Opcode: Found P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If P4==0 then register P3 holds a blob constructed by MakeRecord. If + // P4>0 then register P3 is the first of P4 registers that form an unpacked + // record. + // + // Cursor P1 is on an index btree. If the record identified by P3 and P4 + // is a prefix of any entry in P1 then a jump is made to P2 and + // P1 is left pointing at the matching entry. + // + // This operation leaves the cursor in a state where it can be + // advanced in the forward direction. The Next instruction will work, + // but not the Prev instruction. + // + // See also: NotFound, NoConflict, NotExists. SeekGe + // Opcode: NotFound P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If P4==0 then register P3 holds a blob constructed by MakeRecord. If + // P4>0 then register P3 is the first of P4 registers that form an unpacked + // record. + // + // Cursor P1 is on an index btree. If the record identified by P3 and P4 + // is not the prefix of any entry in P1 then a jump is made to P2. If P1 + // does contain an entry whose prefix matches the P3/P4 record then control + // falls through to the next instruction and P1 is left pointing at the + // matching entry. + // + // This operation leaves the cursor in a state where it cannot be + // advanced in either direction. In other words, the Next and Prev + // opcodes do not work after this operation. + // + // See also: Found, NotExists, NoConflict, IfNoHope + // Opcode: IfNoHope P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // Register P3 is the first of P4 registers that form an unpacked + // record. Cursor P1 is an index btree. P2 is a jump destination. + // In other words, the operands to this opcode are the same as the + // operands to OP_NotFound and OP_IdxGT. + // + // This opcode is an optimization attempt only. If this opcode always + // falls through, the correct answer is still obtained, but extra works + // is performed. + // + // A value of N in the seekHit flag of cursor P1 means that there exists + // a key P3:N that will match some record in the index. We want to know + // if it is possible for a record P3:P4 to match some record in the + // index. If it is not possible, we can skips some work. So if seekHit + // is less than P4, attempt to find out if a match is possible by running + // OP_NotFound. + // + // This opcode is used in IN clause processing for a multi-column key. + // If an IN clause is attached to an element of the key other than the + // left-most element, and if there are no matches on the most recent + // seek over the whole key, then it might be that one of the key element + // to the left is prohibiting a match, and hence there is "no hope" of + // any match regardless of how many IN clause elements are checked. + // In such a case, we abandon the IN clause search early, using this + // opcode. The opcode name comes from the fact that the + // jump is taken if there is "no hope" of achieving a match. + // + // See also: NotFound, SeekHit + // Opcode: NoConflict P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If P4==0 then register P3 holds a blob constructed by MakeRecord. If + // P4>0 then register P3 is the first of P4 registers that form an unpacked + // record. + // + // Cursor P1 is on an index btree. If the record identified by P3 and P4 + // contains any NULL value, jump immediately to P2. If all terms of the + // record are not-NULL then a check is done to determine if any row in the + // P1 index btree has a matching key prefix. If there are no matches, jump + // immediately to P2. If there is a match, fall through and leave the P1 + // cursor pointing to the matching row. + // + // This opcode is similar to OP_NotFound with the exceptions that the + // branch is always taken if any part of the search key input is NULL. + // + // This operation leaves the cursor in a state where it cannot be + // advanced in either direction. In other words, the Next and Prev + // opcodes do not work after this operation. + // + // See also: NotFound, Found, NotExists + case OP_IfNoHope: + goto __96 + case OP_NoConflict: + goto __97 // jump, in3 + case OP_NotFound: + goto __98 // jump, in3 + case OP_Found: + goto __99 + + // Opcode: SeekRowid P1 P2 P3 * * + // Synopsis: intkey=r[P3] + // + // P1 is the index of a cursor open on an SQL table btree (with integer + // keys). If register P3 does not contain an integer or if P1 does not + // contain a record with rowid P3 then jump immediately to P2. + // Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain + // a record with rowid P3 then + // leave the cursor pointing at that record and fall through to the next + // instruction. + // + // The OP_NotExists opcode performs the same operation, but with OP_NotExists + // the P3 register must be guaranteed to contain an integer value. With this + // opcode, register P3 might not contain an integer. + // + // The OP_NotFound opcode performs the same operation on index btrees + // (with arbitrary multi-value keys). + // + // This opcode leaves the cursor in a state where it cannot be advanced + // in either direction. In other words, the Next and Prev opcodes will + // not work following this opcode. + // + // See also: Found, NotFound, NoConflict, SeekRowid + // Opcode: NotExists P1 P2 P3 * * + // Synopsis: intkey=r[P3] + // + // P1 is the index of a cursor open on an SQL table btree (with integer + // keys). P3 is an integer rowid. If P1 does not contain a record with + // rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an + // SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then + // leave the cursor pointing at that record and fall through to the next + // instruction. + // + // The OP_SeekRowid opcode performs the same operation but also allows the + // P3 register to contain a non-integer value, in which case the jump is + // always taken. This opcode requires that P3 always contain an integer. + // + // The OP_NotFound opcode performs the same operation on index btrees + // (with arbitrary multi-value keys). + // + // This opcode leaves the cursor in a state where it cannot be advanced + // in either direction. In other words, the Next and Prev opcodes will + // not work following this opcode. + // + // See also: Found, NotFound, NoConflict, SeekRowid + case OP_SeekRowid: + goto __100 + case OP_NotExists: + goto __101 + + // Opcode: Sequence P1 P2 * * * + // Synopsis: r[P2]=cursor[P1].ctr++ + // + // Find the next available sequence number for cursor P1. + // Write the sequence number into register P2. + // The sequence number on the cursor is incremented after this + // instruction. + case OP_Sequence: + goto __102 + + // Opcode: NewRowid P1 P2 P3 * * + // Synopsis: r[P2]=rowid + // + // Get a new integer record number (a.k.a "rowid") used as the key to a table. + // The record number is not previously used as a key in the database + // table that cursor P1 points to. The new record number is written + // written to register P2. + // + // If P3>0 then P3 is a register in the root frame of this VDBE that holds + // the largest previously generated record number. No new record numbers are + // allowed to be less than this value. When this value reaches its maximum, + // an SQLITE_FULL error is generated. The P3 register is updated with the ' + // generated record number. This P3 mechanism is used to help implement the + // AUTOINCREMENT feature. + case OP_NewRowid: + goto __103 + + // Opcode: Insert P1 P2 P3 P4 P5 + // Synopsis: intkey=r[P3] data=r[P2] + // + // Write an entry into the table of cursor P1. A new entry is + // created if it doesn't already exist or the data for an existing + // entry is overwritten. The data is the value MEM_Blob stored in register + // number P2. The key is stored in register P3. The key must + // be a MEM_Int. + // + // If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is + // incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, + // then rowid is stored for subsequent return by the + // sqlite3_last_insert_rowid() function (otherwise it is unmodified). + // + // If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might + // run faster by avoiding an unnecessary seek on cursor P1. However, + // the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior + // seeks on the cursor or if the most recent seek used a key equal to P3. + // + // If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an + // UPDATE operation. Otherwise (if the flag is clear) then this opcode + // is part of an INSERT operation. The difference is only important to + // the update hook. + // + // Parameter P4 may point to a Table structure, or may be NULL. If it is + // not NULL, then the update-hook (sqlite3.xUpdateCallback) is invoked + // following a successful insert. + // + // (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically + // allocated, then ownership of P2 is transferred to the pseudo-cursor + // and register P2 becomes ephemeral. If the cursor is changed, the + // value of register P2 will then change. Make sure this does not + // cause any problems.) + // + // This instruction only works on tables. The equivalent instruction + // for indices is OP_IdxInsert. + case OP_Insert: + goto __104 + + // Opcode: RowCell P1 P2 P3 * * + // + // P1 and P2 are both open cursors. Both must be opened on the same type + // of table - intkey or index. This opcode is used as part of copying + // the current row from P2 into P1. If the cursors are opened on intkey + // tables, register P3 contains the rowid to use with the new record in + // P1. If they are opened on index tables, P3 is not used. + // + // This opcode must be followed by either an Insert or InsertIdx opcode + // with the OPFLAG_PREFORMAT flag set to complete the insert operation. + case OP_RowCell: + goto __105 + + // Opcode: Delete P1 P2 P3 P4 P5 + // + // Delete the record at which the P1 cursor is currently pointing. + // + // If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then + // the cursor will be left pointing at either the next or the previous + // record in the table. If it is left pointing at the next record, then + // the next Next instruction will be a no-op. As a result, in this case + // it is ok to delete a record from within a Next loop. If + // OPFLAG_SAVEPOSITION bit of P5 is clear, then the cursor will be + // left in an undefined state. + // + // If the OPFLAG_AUXDELETE bit is set on P5, that indicates that this + // delete one of several associated with deleting a table row and all its + // associated index entries. Exactly one of those deletes is the "primary" + // delete. The others are all on OPFLAG_FORDELETE cursors or else are + // marked with the AUXDELETE flag. + // + // If the OPFLAG_NCHANGE flag of P2 (NB: P2 not P5) is set, then the row + // change count is incremented (otherwise not). + // + // P1 must not be pseudo-table. It has to be a real table with + // multiple rows. + // + // If P4 is not NULL then it points to a Table object. In this case either + // the update or pre-update hook, or both, may be invoked. The P1 cursor must + // have been positioned using OP_NotFound prior to invoking this opcode in + // this case. Specifically, if one is configured, the pre-update hook is + // invoked if P4 is not NULL. The update-hook is invoked if one is configured, + // P4 is not NULL, and the OPFLAG_NCHANGE flag is set in P2. + // + // If the OPFLAG_ISUPDATE flag is set in P2, then P3 contains the address + // of the memory cell that contains the value that the rowid of the row will + // be set to by the update. + case OP_Delete: + goto __106 + // Opcode: ResetCount * * * * * + // + // The value of the change counter is copied to the database handle + // change counter (returned by subsequent calls to sqlite3_changes()). + // Then the VMs internal change counter resets to 0. + // This is used by trigger programs. + case OP_ResetCount: + goto __107 + + // Opcode: SorterCompare P1 P2 P3 P4 + // Synopsis: if key(P1)!=trim(r[P3],P4) goto P2 + // + // P1 is a sorter cursor. This instruction compares a prefix of the + // record blob in register P3 against a prefix of the entry that + // the sorter cursor currently points to. Only the first P4 fields + // of r[P3] and the sorter record are compared. + // + // If either P3 or the sorter contains a NULL in one of their significant + // fields (not counting the P4 fields at the end which are ignored) then + // the comparison is assumed to be equal. + // + // Fall through to next instruction if the two records compare equal to + // each other. Jump to P2 if they are different. + case OP_SorterCompare: + goto __108 + + // Opcode: SorterData P1 P2 P3 * * + // Synopsis: r[P2]=data + // + // Write into register P2 the current sorter data for sorter cursor P1. + // Then clear the column header cache on cursor P3. + // + // This opcode is normally use to move a record out of the sorter and into + // a register that is the source for a pseudo-table cursor created using + // OpenPseudo. That pseudo-table cursor is the one that is identified by + // parameter P3. Clearing the P3 column cache as part of this opcode saves + // us from having to issue a separate NullRow instruction to clear that cache. + case OP_SorterData: + goto __109 + + // Opcode: RowData P1 P2 P3 * * + // Synopsis: r[P2]=data + // + // Write into register P2 the complete row content for the row at + // which cursor P1 is currently pointing. + // There is no interpretation of the data. + // It is just copied onto the P2 register exactly as + // it is found in the database file. + // + // If cursor P1 is an index, then the content is the key of the row. + // If cursor P2 is a table, then the content extracted is the data. + // + // If the P1 cursor must be pointing to a valid row (not a NULL row) + // of a real table, not a pseudo-table. + // + // If P3!=0 then this opcode is allowed to make an ephemeral pointer + // into the database page. That means that the content of the output + // register will be invalidated as soon as the cursor moves - including + // moves caused by other cursors that "save" the current cursors + // position in order that they can write to the same table. If P3==0 + // then a copy of the data is made into memory. P3!=0 is faster, but + // P3==0 is safer. + // + // If P3!=0 then the content of the P2 register is unsuitable for use + // in OP_Result and any OP_Result will invalidate the P2 register content. + // The P2 register content is invalidated by opcodes like OP_Function or + // by any use of another cursor pointing to the same table. + case OP_RowData: + goto __110 + + // Opcode: Rowid P1 P2 * * * + // Synopsis: r[P2]=rowid + // + // Store in register P2 an integer which is the key of the table entry that + // P1 is currently point to. + // + // P1 can be either an ordinary table or a virtual table. There used to + // be a separate OP_VRowid opcode for use with virtual tables, but this + // one opcode now works for both table types. + case OP_Rowid: + goto __111 + + // Opcode: NullRow P1 * * * * + // + // Move the cursor P1 to a null row. Any OP_Column operations + // that occur while the cursor is on the null row will always + // write a NULL. + case OP_NullRow: + goto __112 + + // Opcode: SeekEnd P1 * * * * + // + // Position cursor P1 at the end of the btree for the purpose of + // appending a new entry onto the btree. + // + // It is assumed that the cursor is used only for appending and so + // if the cursor is valid, then the cursor must already be pointing + // at the end of the btree and so no changes are made to + // the cursor. + // Opcode: Last P1 P2 * * * + // + // The next use of the Rowid or Column or Prev instruction for P1 + // will refer to the last entry in the database table or index. + // If the table or index is empty and P2>0, then jump immediately to P2. + // If P2 is 0 or if the table or index is not empty, fall through + // to the following instruction. + // + // This opcode leaves the cursor configured to move in reverse order, + // from the end toward the beginning. In other words, the cursor is + // configured to use Prev, not Next. + case OP_SeekEnd: + goto __113 + case OP_Last: + goto __114 + + // Opcode: IfSmaller P1 P2 P3 * * + // + // Estimate the number of rows in the table P1. Jump to P2 if that + // estimate is less than approximately 2**(0.1*P3). + case OP_IfSmaller: + goto __115 + + // Opcode: SorterSort P1 P2 * * * + // + // After all records have been inserted into the Sorter object + // identified by P1, invoke this opcode to actually do the sorting. + // Jump to P2 if there are no records to be sorted. + // + // This opcode is an alias for OP_Sort and OP_Rewind that is used + // for Sorter objects. + // Opcode: Sort P1 P2 * * * + // + // This opcode does exactly the same thing as OP_Rewind except that + // it increments an undocumented global variable used for testing. + // + // Sorting is accomplished by writing records into a sorting index, + // then rewinding that index and playing it back from beginning to + // end. We use the OP_Sort opcode instead of OP_Rewind to do the + // rewinding so that the global variable will be incremented and + // regression tests can determine whether or not the optimizer is + // correctly optimizing out sorts. + case OP_SorterSort: + goto __116 // jump + case OP_Sort: + goto __117 + // Opcode: Rewind P1 P2 * * * + // + // The next use of the Rowid or Column or Next instruction for P1 + // will refer to the first entry in the database table or index. + // If the table or index is empty, jump immediately to P2. + // If the table or index is not empty, fall through to the following + // instruction. + // + // This opcode leaves the cursor configured to move in forward order, + // from the beginning toward the end. In other words, the cursor is + // configured to use Next, not Prev. + case OP_Rewind: + goto __118 + + // Opcode: Next P1 P2 P3 P4 P5 + // + // Advance cursor P1 so that it points to the next key/data pair in its + // table or index. If there are no more key/value pairs then fall through + // to the following instruction. But if the cursor advance was successful, + // jump immediately to P2. + // + // The Next opcode is only valid following an SeekGT, SeekGE, or + // OP_Rewind opcode used to position the cursor. Next is not allowed + // to follow SeekLT, SeekLE, or OP_Last. + // + // The P1 cursor must be for a real table, not a pseudo-table. P1 must have + // been opened prior to this opcode or the program will segfault. + // + // The P3 value is a hint to the btree implementation. If P3==1, that + // means P1 is an SQL index and that this instruction could have been + // omitted if that index had been unique. P3 is usually 0. P3 is + // always either 0 or 1. + // + // P4 is always of type P4_ADVANCE. The function pointer points to + // sqlite3BtreeNext(). + // + // If P5 is positive and the jump is taken, then event counter + // number P5-1 in the prepared statement is incremented. + // + // See also: Prev + // Opcode: Prev P1 P2 P3 P4 P5 + // + // Back up cursor P1 so that it points to the previous key/data pair in its + // table or index. If there is no previous key/value pairs then fall through + // to the following instruction. But if the cursor backup was successful, + // jump immediately to P2. + // + // + // The Prev opcode is only valid following an SeekLT, SeekLE, or + // OP_Last opcode used to position the cursor. Prev is not allowed + // to follow SeekGT, SeekGE, or OP_Rewind. + // + // The P1 cursor must be for a real table, not a pseudo-table. If P1 is + // not open then the behavior is undefined. + // + // The P3 value is a hint to the btree implementation. If P3==1, that + // means P1 is an SQL index and that this instruction could have been + // omitted if that index had been unique. P3 is usually 0. P3 is + // always either 0 or 1. + // + // P4 is always of type P4_ADVANCE. The function pointer points to + // sqlite3BtreePrevious(). + // + // If P5 is positive and the jump is taken, then event counter + // number P5-1 in the prepared statement is incremented. + // Opcode: SorterNext P1 P2 * * P5 + // + // This opcode works just like OP_Next except that P1 must be a + // sorter object for which the OP_SorterSort opcode has been + // invoked. This opcode advances the cursor to the next sorted + // record, or jumps to P2 if there are no more sorted records. + case OP_SorterNext: + goto __119 + case OP_Prev: + goto __120 // jump + case OP_Next: + goto __121 + + // Opcode: IdxInsert P1 P2 P3 P4 P5 + // Synopsis: key=r[P2] + // + // Register P2 holds an SQL index key made using the + // MakeRecord instructions. This opcode writes that key + // into the index P1. Data for the entry is nil. + // + // If P4 is not zero, then it is the number of values in the unpacked + // key of reg(P2). In that case, P3 is the index of the first register + // for the unpacked key. The availability of the unpacked key can sometimes + // be an optimization. + // + // If P5 has the OPFLAG_APPEND bit set, that is a hint to the b-tree layer + // that this insert is likely to be an append. + // + // If P5 has the OPFLAG_NCHANGE bit set, then the change counter is + // incremented by this instruction. If the OPFLAG_NCHANGE bit is clear, + // then the change counter is unchanged. + // + // If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might + // run faster by avoiding an unnecessary seek on cursor P1. However, + // the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior + // seeks on the cursor or if the most recent seek used a key equivalent + // to P2. + // + // This instruction only works for indices. The equivalent instruction + // for tables is OP_Insert. + case OP_IdxInsert: + goto __122 + + // Opcode: SorterInsert P1 P2 * * * + // Synopsis: key=r[P2] + // + // Register P2 holds an SQL index key made using the + // MakeRecord instructions. This opcode writes that key + // into the sorter P1. Data for the entry is nil. + case OP_SorterInsert: + goto __123 + + // Opcode: IdxDelete P1 P2 P3 * P5 + // Synopsis: key=r[P2@P3] + // + // The content of P3 registers starting at register P2 form + // an unpacked index key. This opcode removes that entry from the + // index opened by cursor P1. + // + // If P5 is not zero, then raise an SQLITE_CORRUPT_INDEX error + // if no matching index entry is found. This happens when running + // an UPDATE or DELETE statement and the index entry to be updated + // or deleted is not found. For some uses of IdxDelete + // (example: the EXCEPT operator) it does not matter that no matching + // entry is found. For those cases, P5 is zero. + case OP_IdxDelete: + goto __124 + + // Opcode: DeferredSeek P1 * P3 P4 * + // Synopsis: Move P3 to P1.rowid if needed + // + // P1 is an open index cursor and P3 is a cursor on the corresponding + // table. This opcode does a deferred seek of the P3 table cursor + // to the row that corresponds to the current row of P1. + // + // This is a deferred seek. Nothing actually happens until + // the cursor is used to read a record. That way, if no reads + // occur, no unnecessary I/O happens. + // + // P4 may be an array of integers (type P4_INTARRAY) containing + // one entry for each column in the P3 table. If array entry a(i) + // is non-zero, then reading column a(i)-1 from cursor P3 is + // equivalent to performing the deferred seek and then reading column i + // from P1. This information is stored in P3 and used to redirect + // reads against P3 over to P1, thus possibly avoiding the need to + // seek and read cursor P3. + // Opcode: IdxRowid P1 P2 * * * + // Synopsis: r[P2]=rowid + // + // Write into register P2 an integer which is the last entry in the record at + // the end of the index key pointed to by cursor P1. This integer should be + // the rowid of the table entry to which this index entry points. + // + // See also: Rowid, MakeRecord. + case OP_DeferredSeek: + goto __125 + case OP_IdxRowid: + goto __126 + + // Opcode: FinishSeek P1 * * * * + // + // If cursor P1 was previously moved via OP_DeferredSeek, complete that + // seek operation now, without further delay. If the cursor seek has + // already occurred, this instruction is a no-op. + case OP_FinishSeek: + goto __127 + + // Opcode: IdxGE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY. Compare this key value against the index + // that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID + // fields at the end. + // + // If the P1 index entry is greater than or equal to the key value + // then jump to P2. Otherwise fall through to the next instruction. + // Opcode: IdxGT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY. Compare this key value against the index + // that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID + // fields at the end. + // + // If the P1 index entry is greater than the key value + // then jump to P2. Otherwise fall through to the next instruction. + // Opcode: IdxLT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY or ROWID. Compare this key value against + // the index that P1 is currently pointing to, ignoring the PRIMARY KEY or + // ROWID on the P1 index. + // + // If the P1 index entry is less than the key value then jump to P2. + // Otherwise fall through to the next instruction. + // Opcode: IdxLE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY or ROWID. Compare this key value against + // the index that P1 is currently pointing to, ignoring the PRIMARY KEY or + // ROWID on the P1 index. + // + // If the P1 index entry is less than or equal to the key value then jump + // to P2. Otherwise fall through to the next instruction. + case OP_IdxLE: + goto __128 // jump + case OP_IdxGT: + goto __129 // jump + case OP_IdxLT: + goto __130 // jump + case OP_IdxGE: + goto __131 + + // Opcode: Destroy P1 P2 P3 * * + // + // Delete an entire database table or index whose root page in the database + // file is given by P1. + // + // The table being destroyed is in the main database file if P3==0. If + // P3==1 then the table to be clear is in the auxiliary database file + // that is used to store tables create using CREATE TEMPORARY TABLE. + // + // If AUTOVACUUM is enabled then it is possible that another root page + // might be moved into the newly deleted root page in order to keep all + // root pages contiguous at the beginning of the database. The former + // value of the root page that moved - its value before the move occurred - + // is stored in register P2. If no page movement was required (because the + // table being dropped was already the last one in the database) then a + // zero is stored in register P2. If AUTOVACUUM is disabled then a zero + // is stored in register P2. + // + // This opcode throws an error if there are any active reader VMs when + // it is invoked. This is done to avoid the difficulty associated with + // updating existing cursors when a root page is moved in an AUTOVACUUM + // database. This error is thrown even if the database is not an AUTOVACUUM + // db in order to avoid introducing an incompatibility between autovacuum + // and non-autovacuum modes. + // + // See also: Clear + case OP_Destroy: + goto __132 + + // Opcode: Clear P1 P2 P3 + // + // Delete all contents of the database table or index whose root page + // in the database file is given by P1. But, unlike Destroy, do not + // remove the table or index from the database file. + // + // The table being clear is in the main database file if P2==0. If + // P2==1 then the table to be clear is in the auxiliary database file + // that is used to store tables create using CREATE TEMPORARY TABLE. + // + // If the P3 value is non-zero, then the row change count is incremented + // by the number of rows in the table being cleared. If P3 is greater + // than zero, then the value stored in register P3 is also incremented + // by the number of rows in the table being cleared. + // + // See also: Destroy + case OP_Clear: + goto __133 + + // Opcode: ResetSorter P1 * * * * + // + // Delete all contents from the ephemeral table or sorter + // that is open on cursor P1. + // + // This opcode only works for cursors used for sorting and + // opened with OP_OpenEphemeral or OP_SorterOpen. + case OP_ResetSorter: + goto __134 + + // Opcode: CreateBtree P1 P2 P3 * * + // Synopsis: r[P2]=root iDb=P1 flags=P3 + // + // Allocate a new b-tree in the main database file if P1==0 or in the + // TEMP database file if P1==1 or in an attached database if + // P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table + // it must be 2 (BTREE_BLOBKEY) for an index or WITHOUT ROWID table. + // The root page number of the new b-tree is stored in register P2. + case OP_CreateBtree: + goto __135 + + // Opcode: SqlExec * * * P4 * + // + // Run the SQL statement or statements specified in the P4 string. + case OP_SqlExec: + goto __136 + + // Opcode: ParseSchema P1 * * P4 * + // + // Read and parse all entries from the schema table of database P1 + // that match the WHERE clause P4. If P4 is a NULL pointer, then the + // entire schema for P1 is reparsed. + // + // This opcode invokes the parser to create a new virtual machine, + // then runs the new virtual machine. It is thus a re-entrant opcode. + case OP_ParseSchema: + goto __137 + + // Opcode: LoadAnalysis P1 * * * * + // + // Read the sqlite_stat1 table for database P1 and load the content + // of that table into the internal index hash table. This will cause + // the analysis to be used when preparing all subsequent queries. + case OP_LoadAnalysis: + goto __138 + + // Opcode: DropTable P1 * * P4 * + // + // Remove the internal (in-memory) data structures that describe + // the table named P4 in database P1. This is called after a table + // is dropped from disk (using the Destroy opcode) in order to keep + // the internal representation of the + // schema consistent with what is on disk. + case OP_DropTable: + goto __139 + + // Opcode: DropIndex P1 * * P4 * + // + // Remove the internal (in-memory) data structures that describe + // the index named P4 in database P1. This is called after an index + // is dropped from disk (using the Destroy opcode) + // in order to keep the internal representation of the + // schema consistent with what is on disk. + case OP_DropIndex: + goto __140 + + // Opcode: DropTrigger P1 * * P4 * + // + // Remove the internal (in-memory) data structures that describe + // the trigger named P4 in database P1. This is called after a trigger + // is dropped from disk (using the Destroy opcode) in order to keep + // the internal representation of the + // schema consistent with what is on disk. + case OP_DropTrigger: + goto __141 + + // Opcode: IntegrityCk P1 P2 P3 P4 P5 + // + // Do an analysis of the currently open database. Store in + // register P1 the text of an error message describing any problems. + // If no problems are found, store a NULL in register P1. + // + // The register P3 contains one less than the maximum number of allowed errors. + // At most reg(P3) errors will be reported. + // In other words, the analysis stops as soon as reg(P1) errors are + // seen. Reg(P1) is updated with the number of errors remaining. + // + // The root page numbers of all tables in the database are integers + // stored in P4_INTARRAY argument. + // + // If P5 is not zero, the check is done on the auxiliary database + // file, not the main database file. + // + // This opcode is used to implement the integrity_check pragma. + case OP_IntegrityCk: + goto __142 + + // Opcode: RowSetAdd P1 P2 * * * + // Synopsis: rowset(P1)=r[P2] + // + // Insert the integer value held by register P2 into a RowSet object + // held in register P1. + // + // An assertion fails if P2 is not an integer. + case OP_RowSetAdd: + goto __143 + + // Opcode: RowSetRead P1 P2 P3 * * + // Synopsis: r[P3]=rowset(P1) + // + // Extract the smallest value from the RowSet object in P1 + // and put that value into register P3. + // Or, if RowSet object P1 is initially empty, leave P3 + // unchanged and jump to instruction P2. + case OP_RowSetRead: + goto __144 + + // Opcode: RowSetTest P1 P2 P3 P4 + // Synopsis: if r[P3] in rowset(P1) goto P2 + // + // Register P3 is assumed to hold a 64-bit integer value. If register P1 + // contains a RowSet object and that RowSet object contains + // the value held in P3, jump to register P2. Otherwise, insert the + // integer in P3 into the RowSet and continue on to the + // next opcode. + // + // The RowSet object is optimized for the case where sets of integers + // are inserted in distinct phases, which each set contains no duplicates. + // Each set is identified by a unique P4 value. The first set + // must have P4==0, the final set must have P4==-1, and for all other sets + // must have P4>0. + // + // This allows optimizations: (a) when P4==0 there is no need to test + // the RowSet object for P3, as it is guaranteed not to contain it, + // (b) when P4==-1 there is no need to insert the value, as it will + // never be tested for, and (c) when a value that is part of set X is + // inserted, there is no need to search to see if the same value was + // previously inserted as part of set X (only if it was previously + // inserted as part of some other set). + case OP_RowSetTest: + goto __145 + + // Opcode: Program P1 P2 P3 P4 P5 + // + // Execute the trigger program passed as P4 (type P4_SUBPROGRAM). + // + // P1 contains the address of the memory cell that contains the first memory + // cell in an array of values used as arguments to the sub-program. P2 + // contains the address to jump to if the sub-program throws an IGNORE + // exception using the RAISE() function. Register P3 contains the address + // of a memory cell in this (the parent) VM that is used to allocate the + // memory required by the sub-vdbe at runtime. + // + // P4 is a pointer to the VM containing the trigger program. + // + // If P5 is non-zero, then recursive program invocation is enabled. + case OP_Program: + goto __146 + + // Opcode: Param P1 P2 * * * + // + // This opcode is only ever present in sub-programs called via the + // OP_Program instruction. Copy a value currently stored in a memory + // cell of the calling (parent) frame to cell P2 in the current frames + // address space. This is used by trigger programs to access the new.* + // and old.* values. + // + // The address of the cell in the parent frame is determined by adding + // the value of the P1 argument to the value of the P1 argument to the + // calling OP_Program instruction. + case OP_Param: + goto __147 + + // Opcode: FkCounter P1 P2 * * * + // Synopsis: fkctr[P1]+=P2 + // + // Increment a "constraint counter" by P2 (P2 may be negative or positive). + // If P1 is non-zero, the database constraint counter is incremented + // (deferred foreign key constraints). Otherwise, if P1 is zero, the + // statement counter is incremented (immediate foreign key constraints). + case OP_FkCounter: + goto __148 + + // Opcode: FkIfZero P1 P2 * * * + // Synopsis: if fkctr[P1]==0 goto P2 + // + // This opcode tests if a foreign key constraint-counter is currently zero. + // If so, jump to instruction P2. Otherwise, fall through to the next + // instruction. + // + // If P1 is non-zero, then the jump is taken if the database constraint-counter + // is zero (the one that counts deferred constraint violations). If P1 is + // zero, the jump is taken if the statement constraint-counter is zero + // (immediate foreign key constraint violations). + case OP_FkIfZero: + goto __149 + + // Opcode: MemMax P1 P2 * * * + // Synopsis: r[P1]=max(r[P1],r[P2]) + // + // P1 is a register in the root frame of this VM (the root frame is + // different from the current frame if this instruction is being executed + // within a sub-program). Set the value of register P1 to the maximum of + // its current value and the value in register P2. + // + // This instruction throws an error if the memory cell is not initially + // an integer. + case OP_MemMax: + goto __150 + + // Opcode: IfPos P1 P2 P3 * * + // Synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 + // + // Register P1 must contain an integer. + // If the value of register P1 is 1 or greater, subtract P3 from the + // value in P1 and jump to P2. + // + // If the initial value of register P1 is less than 1, then the + // value is unchanged and control passes through to the next instruction. + case OP_IfPos: + goto __151 + + // Opcode: OffsetLimit P1 P2 P3 * * + // Synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) + // + // This opcode performs a commonly used computation associated with + // LIMIT and OFFSET process. r[P1] holds the limit counter. r[P3] + // holds the offset counter. The opcode computes the combined value + // of the LIMIT and OFFSET and stores that value in r[P2]. The r[P2] + // value computed is the total number of rows that will need to be + // visited in order to complete the query. + // + // If r[P3] is zero or negative, that means there is no OFFSET + // and r[P2] is set to be the value of the LIMIT, r[P1]. + // + // if r[P1] is zero or negative, that means there is no LIMIT + // and r[P2] is set to -1. + // + // Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. + case OP_OffsetLimit: + goto __152 + + // Opcode: IfNotZero P1 P2 * * * + // Synopsis: if r[P1]!=0 then r[P1]--, goto P2 + // + // Register P1 must contain an integer. If the content of register P1 is + // initially greater than zero, then decrement the value in register P1. + // If it is non-zero (negative or positive) and then also jump to P2. + // If register P1 is initially zero, leave it unchanged and fall through. + case OP_IfNotZero: + goto __153 + + // Opcode: DecrJumpZero P1 P2 * * * + // Synopsis: if (--r[P1])==0 goto P2 + // + // Register P1 must hold an integer. Decrement the value in P1 + // and jump to P2 if the new value is exactly zero. + case OP_DecrJumpZero: + goto __154 + + // Opcode: AggStep * P2 P3 P4 P5 + // Synopsis: accum=r[P3] step(r[P2@P5]) + // + // Execute the xStep function for an aggregate. + // The function has P5 arguments. P4 is a pointer to the + // FuncDef structure that specifies the function. Register P3 is the + // accumulator. + // + // The P5 arguments are taken from register P2 and its + // successors. + // Opcode: AggInverse * P2 P3 P4 P5 + // Synopsis: accum=r[P3] inverse(r[P2@P5]) + // + // Execute the xInverse function for an aggregate. + // The function has P5 arguments. P4 is a pointer to the + // FuncDef structure that specifies the function. Register P3 is the + // accumulator. + // + // The P5 arguments are taken from register P2 and its + // successors. + // Opcode: AggStep1 P1 P2 P3 P4 P5 + // Synopsis: accum=r[P3] step(r[P2@P5]) + // + // Execute the xStep (if P1==0) or xInverse (if P1!=0) function for an + // aggregate. The function has P5 arguments. P4 is a pointer to the + // FuncDef structure that specifies the function. Register P3 is the + // accumulator. + // + // The P5 arguments are taken from register P2 and its + // successors. + // + // This opcode is initially coded as OP_AggStep0. On first evaluation, + // the FuncDef stored in P4 is converted into an sqlite3_context and + // the opcode is changed. In this way, the initialization of the + // sqlite3_context only happens once, instead of on each call to the + // step function. + case OP_AggInverse: + goto __155 + case OP_AggStep: + goto __156 + case OP_AggStep1: + goto __157 + + // Opcode: AggFinal P1 P2 * P4 * + // Synopsis: accum=r[P1] N=P2 + // + // P1 is the memory location that is the accumulator for an aggregate + // or window function. Execute the finalizer function + // for an aggregate and store the result in P1. + // + // P2 is the number of arguments that the step function takes and + // P4 is a pointer to the FuncDef for this function. The P2 + // argument is not used by this opcode. It is only there to disambiguate + // functions that can take varying numbers of arguments. The + // P4 argument is only needed for the case where + // the step function was not previously called. + // Opcode: AggValue * P2 P3 P4 * + // Synopsis: r[P3]=value N=P2 + // + // Invoke the xValue() function and store the result in register P3. + // + // P2 is the number of arguments that the step function takes and + // P4 is a pointer to the FuncDef for this function. The P2 + // argument is not used by this opcode. It is only there to disambiguate + // functions that can take varying numbers of arguments. The + // P4 argument is only needed for the case where + // the step function was not previously called. + case OP_AggValue: + goto __158 + case OP_AggFinal: + goto __159 + + // Opcode: Checkpoint P1 P2 P3 * * + // + // Checkpoint database P1. This is a no-op if P1 is not currently in + // WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL, + // RESTART, or TRUNCATE. Write 1 or 0 into mem[P3] if the checkpoint returns + // SQLITE_BUSY or not, respectively. Write the number of pages in the + // WAL after the checkpoint into mem[P3+1] and the number of pages + // in the WAL that have been checkpointed after the checkpoint + // completes into mem[P3+2]. However on an error, mem[P3+1] and + // mem[P3+2] are initialized to -1. + case OP_Checkpoint: + goto __160 + + // Opcode: JournalMode P1 P2 P3 * * + // + // Change the journal mode of database P1 to P3. P3 must be one of the + // PAGER_JOURNALMODE_XXX values. If changing between the various rollback + // modes (delete, truncate, persist, off and memory), this is a simple + // operation. No IO is required. + // + // If changing into or out of WAL mode the procedure is more complicated. + // + // Write a string containing the final journal-mode to register P2. + case OP_JournalMode: + goto __161 + + // Opcode: Vacuum P1 P2 * * * + // + // Vacuum the entire database P1. P1 is 0 for "main", and 2 or more + // for an attached database. The "temp" database may not be vacuumed. + // + // If P2 is not zero, then it is a register holding a string which is + // the file into which the result of vacuum should be written. When + // P2 is zero, the vacuum overwrites the original database. + case OP_Vacuum: + goto __162 + + // Opcode: IncrVacuum P1 P2 * * * + // + // Perform a single step of the incremental vacuum procedure on + // the P1 database. If the vacuum has finished, jump to instruction + // P2. Otherwise, fall through to the next instruction. + case OP_IncrVacuum: + goto __163 + + // Opcode: Expire P1 P2 * * * + // + // Cause precompiled statements to expire. When an expired statement + // is executed using sqlite3_step() it will either automatically + // reprepare itself (if it was originally created using sqlite3_prepare_v2()) + // or it will fail with SQLITE_SCHEMA. + // + // If P1 is 0, then all SQL statements become expired. If P1 is non-zero, + // then only the currently executing statement is expired. + // + // If P2 is 0, then SQL statements are expired immediately. If P2 is 1, + // then running SQL statements are allowed to continue to run to completion. + // The P2==1 case occurs when a CREATE INDEX or similar schema change happens + // that might help the statement run faster but which does not affect the + // correctness of operation. + case OP_Expire: + goto __164 + + // Opcode: CursorLock P1 * * * * + // + // Lock the btree to which cursor P1 is pointing so that the btree cannot be + // written by an other cursor. + case OP_CursorLock: + goto __165 + + // Opcode: CursorUnlock P1 * * * * + // + // Unlock the btree to which cursor P1 is pointing so that it can be + // written by other cursors. + case OP_CursorUnlock: + goto __166 + + // Opcode: TableLock P1 P2 P3 P4 * + // Synopsis: iDb=P1 root=P2 write=P3 + // + // Obtain a lock on a particular table. This instruction is only used when + // the shared-cache feature is enabled. + // + // P1 is the index of the database in sqlite3.aDb[] of the database + // on which the lock is acquired. A readlock is obtained if P3==0 or + // a write lock if P3==1. + // + // P2 contains the root-page of the table to lock. + // + // P4 contains a pointer to the name of the table being locked. This is only + // used to generate an error message if the lock cannot be obtained. + case OP_TableLock: + goto __167 + + // Opcode: VBegin * * * P4 * + // + // P4 may be a pointer to an sqlite3_vtab structure. If so, call the + // xBegin method for that table. + // + // Also, whether or not P4 is set, check that this is not being called from + // within a callback to a virtual table xSync() method. If it is, the error + // code will be set to SQLITE_LOCKED. + case OP_VBegin: + goto __168 + + // Opcode: VCreate P1 P2 * * * + // + // P2 is a register that holds the name of a virtual table in database + // P1. Call the xCreate method for that table. + case OP_VCreate: + goto __169 + + // Opcode: VDestroy P1 * * P4 * + // + // P4 is the name of a virtual table in database P1. Call the xDestroy method + // of that table. + case OP_VDestroy: + goto __170 + + // Opcode: VOpen P1 * * P4 * + // + // P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + // P1 is a cursor number. This opcode opens a cursor to the virtual + // table and stores that cursor in P1. + case OP_VOpen: + goto __171 + + // Opcode: VFilter P1 P2 P3 P4 * + // Synopsis: iplan=r[P3] zplan='P4' + // + // P1 is a cursor opened using VOpen. P2 is an address to jump to if + // the filtered result set is empty. + // + // P4 is either NULL or a string that was generated by the xBestIndex + // method of the module. The interpretation of the P4 string is left + // to the module implementation. + // + // This opcode invokes the xFilter method on the virtual table specified + // by P1. The integer query plan parameter to xFilter is stored in register + // P3. Register P3+1 stores the argc parameter to be passed to the + // xFilter method. Registers P3+2..P3+1+argc are the argc + // additional parameters which are passed to + // xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter. + // + // A jump is made to P2 if the result set after filtering would be empty. + case OP_VFilter: + goto __172 + + // Opcode: VColumn P1 P2 P3 * P5 + // Synopsis: r[P3]=vcolumn(P2) + // + // Store in register P3 the value of the P2-th column of + // the current row of the virtual-table of cursor P1. + // + // If the VColumn opcode is being used to fetch the value of + // an unchanging column during an UPDATE operation, then the P5 + // value is OPFLAG_NOCHNG. This will cause the sqlite3_vtab_nochange() + // function to return true inside the xColumn method of the virtual + // table implementation. The P5 column might also contain other + // bits (OPFLAG_LENGTHARG or OPFLAG_TYPEOFARG) but those bits are + // unused by OP_VColumn. + case OP_VColumn: + goto __173 + + // Opcode: VNext P1 P2 * * * + // + // Advance virtual table P1 to the next row in its result set and + // jump to instruction P2. Or, if the virtual table has reached + // the end of its result set, then fall through to the next instruction. + case OP_VNext: + goto __174 + + // Opcode: VRename P1 * * P4 * + // + // P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + // This opcode invokes the corresponding xRename method. The value + // in register P1 is passed as the zName argument to the xRename method. + case OP_VRename: + goto __175 + + // Opcode: VUpdate P1 P2 P3 P4 P5 + // Synopsis: data=r[P3@P2] + // + // P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + // This opcode invokes the corresponding xUpdate method. P2 values + // are contiguous memory cells starting at P3 to pass to the xUpdate + // invocation. The value in register (P3+P2-1) corresponds to the + // p2th element of the argv array passed to xUpdate. + // + // The xUpdate method will do a DELETE or an INSERT or both. + // The argv[0] element (which corresponds to memory cell P3) + // is the rowid of a row to delete. If argv[0] is NULL then no + // deletion occurs. The argv[1] element is the rowid of the new + // row. This can be NULL to have the virtual table select the new + // rowid for itself. The subsequent elements in the array are + // the values of columns in the new row. + // + // If P2==1 then no insert is performed. argv[0] is the rowid of + // a row to delete. + // + // P1 is a boolean flag. If it is set to true and the xUpdate call + // is successful, then the value returned by sqlite3_last_insert_rowid() + // is set to the value of the rowid for the row just inserted. + // + // P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to + // apply in the case of a constraint failure on an insert or update. + case OP_VUpdate: + goto __176 + + // Opcode: Pagecount P1 P2 * * * + // + // Write the current number of pages in database P1 to memory cell P2. + case OP_Pagecount: + goto __177 + + // Opcode: MaxPgcnt P1 P2 P3 * * + // + // Try to set the maximum page count for database P1 to the value in P3. + // Do not let the maximum page count fall below the current page count and + // do not change the maximum page count value if P3==0. + // + // Store the maximum page count after the change in register P2. + case OP_MaxPgcnt: + goto __178 + + // Opcode: Function P1 P2 P3 P4 * + // Synopsis: r[P3]=func(r[P2@NP]) + // + // Invoke a user function (P4 is a pointer to an sqlite3_context object that + // contains a pointer to the function to be run) with arguments taken + // from register P2 and successors. The number of arguments is in + // the sqlite3_context object that P4 points to. + // The result of the function is stored + // in register P3. Register P3 must not be one of the function inputs. + // + // P1 is a 32-bit bitmask indicating whether or not each argument to the + // function was determined to be constant at compile time. If the first + // argument was constant then bit 0 of P1 is set. This is used to determine + // whether meta data associated with a user function argument using the + // sqlite3_set_auxdata() API may be safely retained until the next + // invocation of this opcode. + // + // See also: AggStep, AggFinal, PureFunc + // Opcode: PureFunc P1 P2 P3 P4 * + // Synopsis: r[P3]=func(r[P2@NP]) + // + // Invoke a user function (P4 is a pointer to an sqlite3_context object that + // contains a pointer to the function to be run) with arguments taken + // from register P2 and successors. The number of arguments is in + // the sqlite3_context object that P4 points to. + // The result of the function is stored + // in register P3. Register P3 must not be one of the function inputs. + // + // P1 is a 32-bit bitmask indicating whether or not each argument to the + // function was determined to be constant at compile time. If the first + // argument was constant then bit 0 of P1 is set. This is used to determine + // whether meta data associated with a user function argument using the + // sqlite3_set_auxdata() API may be safely retained until the next + // invocation of this opcode. + // + // This opcode works exactly like OP_Function. The only difference is in + // its name. This opcode is used in places where the function must be + // purely non-deterministic. Some built-in date/time functions can be + // either determinitic of non-deterministic, depending on their arguments. + // When those function are used in a non-deterministic way, they will check + // to see if they were called using OP_PureFunc instead of OP_Function, and + // if they were, they throw an error. + // + // See also: AggStep, AggFinal, Function + case OP_PureFunc: + goto __179 // group + case OP_Function: + goto __180 + + // Opcode: Trace P1 P2 * P4 * + // + // Write P4 on the statement trace output if statement tracing is + // enabled. + // + // Operand P1 must be 0x7fffffff and P2 must positive. + // Opcode: Init P1 P2 P3 P4 * + // Synopsis: Start at P2 + // + // Programs contain a single instance of this opcode as the very first + // opcode. + // + // If tracing is enabled (by the sqlite3_trace()) interface, then + // the UTF-8 string contained in P4 is emitted on the trace callback. + // Or if P4 is blank, use the string returned by sqlite3_sql(). + // + // If P2 is not zero, jump to instruction P2. + // + // Increment the value of P1 so that OP_Once opcodes will jump the + // first time they are evaluated for this run. + // + // If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT + // error is encountered. + case OP_Trace: + goto __181 + case OP_Init: + goto __182 + + // Opcode: Noop * * * * * + // + // Do nothing. This instruction is often useful as a jump + // destination. + // The magic Explain opcode are only inserted when explain==2 (which + // is to say when the EXPLAIN QUERY PLAN syntax is used.) + // This opcode records information from the optimizer. It is the + // the same as a no-op. This opcodesnever appears in a real VM program. + default: + goto __183 + } + goto __8 + + // **************************************************************************** + // + // What follows is a massive switch statement where each case implements a + // separate instruction in the virtual machine. If we follow the usual + // indentation conventions, each case should be indented by 6 spaces. But + // that is a lot of wasted space on the left margin. So the code within + // the switch statement will break with convention and be flush-left. Another + // big comment (similar to this one) will mark the point in the code where + // we transition back to normal indentation. + // + // The formatting of each case is important. The makefile for SQLite + // generates two C files "opcodes.h" and "opcodes.c" by scanning this + // file looking for lines that begin with "case OP_". The opcodes.h files + // will be filled with #defines that give unique integer values to each + // opcode and the opcodes.c file is filled with an array of strings where + // each string is the symbolic name for the corresponding opcode. If the + // case statement is followed by a comment of the form "/# same as ... #/" + // that comment is used to determine the particular value of the opcode. + // + // Other keywords in the comment that follows each case are used to + // construct the OPFLG_INITIALIZER value that initializes opcodeProperty[]. + // Keywords include: in1, in2, in3, out2, out3. See + // the mkopcodeh.awk script for additional information. + // + // Documentation about VDBE opcodes is generated by scanning this file + // for lines of that contain "Opcode:". That line and all subsequent + // comment lines are used in the generation of the opcode.html documentation + // file. + // + // SUMMARY: + // + // Formatting is important to scripts that scan this file. + // Do not deviate from the formatting style currently in use. + // + // + + // Opcode: Goto * P2 * * * + // + // An unconditional jump to address P2. + // The next instruction executed will be + // the one at index P2 from the beginning of + // the program. + // + // The P1 parameter is not actually used by this opcode. However, it + // is sometimes set to 1 instead of 0 as a hint to the command-line shell + // that this Goto is the bottom of a loop and that the lines from P2 down + // to the current line should be indented for EXPLAIN output. +__9: // jump + +jump_to_p2_and_check_for_interrupt: + pOp = (aOp + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp2-1))*24) + + // Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, + // OP_VNext, or OP_SorterNext) all jump here upon + // completion. Check to see if sqlite3_interrupt() has been called + // or if the progress callback needs to be invoked. + // + // This code uses unstructured "goto" statements and does not look clean. + // But that is not due to sloppy coding habits. The code is written this + // way for performance, to avoid having to run the interrupt and progress + // checks on every opcode. This helps sqlite3_step() to run about 1.5% + // faster according to "valgrind --tool=cachegrind" +check_for_interrupt: + if !(libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0) { + goto __184 + } + goto abort_due_to_interrupt +__184: + ; + // Call the progress callback if it is configured and the required number + // of VDBE ops have been executed (either since this invocation of + // sqlite3VdbeExec() or since last time the progress callback was called). + // If the progress callback returns non-zero, exit the virtual machine with + // a return code SQLITE_ABORT. +__185: + if !((nVmStep >= nProgressLimit) && ((*Sqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0))) { + goto __186 + } + + nProgressLimit = nProgressLimit + (U64((*Sqlite3)(unsafe.Pointer(db)).FnProgressOps)) + if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((db + 512 /* &.xProgress */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0) { + goto __187 + } + nProgressLimit = (uint64(0xffffffff) | (U64((uint64(0xffffffff))) << 32)) + rc = SQLITE_INTERRUPT + goto abort_due_to_error +__187: + ; + goto __185 +__186: + ; + + goto __8 + + // Opcode: Gosub P1 P2 * * * + // + // Write the current address onto register P1 + // and then jump to address P2. +__10: // jump + ; + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + (*Mem)(unsafe.Pointer(pIn1)).Fflags = U16(MEM_Int) + *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) = I64((int32((int64(pOp) - int64(aOp)) / 24))) + + // Most jump operations do a goto to this spot in order to update + // the pOp pointer. +jump_to_p2: + pOp = (aOp + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp2-1))*24) + goto __8 + + // Opcode: Return P1 * * * * + // + // Jump to the next instruction after the address in register P1. After + // the jump, register P1 becomes undefined. +__11: // in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + pOp = (aOp + uintptr(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)))*24) + (*Mem)(unsafe.Pointer(pIn1)).Fflags = U16(MEM_Undefined) + goto __8 + + // Opcode: InitCoroutine P1 P2 P3 * * + // + // Set up register P1 so that it will Yield to the coroutine + // located at address P3. + // + // If P2!=0 then the coroutine implementation immediately follows + // this opcode. So jump over the coroutine implementation to + // address P2. + // + // See also: EndCoroutine +__12: // jump + ; + + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = (I64((*Op)(unsafe.Pointer(pOp)).Fp3 - 1)) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Int) + if !((*Op)(unsafe.Pointer(pOp)).Fp2 != 0) { + goto __188 + } + goto jump_to_p2 +__188: + ; + goto __8 + + // Opcode: EndCoroutine P1 * * * * + // + // The instruction at the address in register P1 is a Yield. + // Jump to the P2 parameter of that Yield. + // After the jump, register P1 becomes undefined. + // + // See also: InitCoroutine +__13: + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + pCaller = (aOp + uintptr(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)))*24) + + pOp = (aOp + uintptr(((*VdbeOp)(unsafe.Pointer(pCaller)).Fp2-1))*24) + (*Mem)(unsafe.Pointer(pIn1)).Fflags = U16(MEM_Undefined) + goto __8 + + // Opcode: Yield P1 P2 * * * + // + // Swap the program counter with the value in register P1. This + // has the effect of yielding to a coroutine. + // + // If the coroutine that is launched by this instruction ends with + // Yield or Return then continue to the next instruction. But if + // the coroutine launched by this instruction ends with + // EndCoroutine, then jump to P2 rather than continuing with the + // next instruction. + // + // See also: InitCoroutine +__14: + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + (*Mem)(unsafe.Pointer(pIn1)).Fflags = U16(MEM_Int) + pcDest = int32(*(*I64)(unsafe.Pointer(pIn1 /* &.u */))) + *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) = I64((int32((int64(pOp) - int64(aOp)) / 24))) + + pOp = (aOp + uintptr(pcDest)*24) + goto __8 + + // Opcode: HaltIfNull P1 P2 P3 P4 P5 + // Synopsis: if r[P3]=null halt + // + // Check the value in register P3. If it is NULL then Halt using + // parameter P1, P2, and P4 as if this were a Halt instruction. If the + // value in register P3 is not NULL, then this routine is a no-op. + // The P5 parameter should be 1. +__15: // in3 + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + if !((int32((*Mem)(unsafe.Pointer(pIn3)).Fflags) & MEM_Null) == 0) { + goto __189 + } + goto __8 +__189: + ; + + // Opcode: Halt P1 P2 * P4 P5 + // + // Exit immediately. All open cursors, etc are closed + // automatically. + // + // P1 is the result code returned by sqlite3_exec(), sqlite3_reset(), + // or sqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0). + // For errors, it can be some other value. If P1!=0 then P2 will determine + // whether or not to rollback the current transaction. Do not rollback + // if P2==OE_Fail. Do the rollback if P2==OE_Rollback. If P2==OE_Abort, + // then back out all changes that have occurred during this execution of the + // VDBE, but do not rollback the transaction. + // + // If P4 is not null then it is an error message string. + // + // P5 is a value between 0 and 4, inclusive, that modifies the P4 string. + // + // 0: (no change) + // 1: NOT NULL contraint failed: P4 + // 2: UNIQUE constraint failed: P4 + // 3: CHECK constraint failed: P4 + // 4: FOREIGN KEY constraint failed: P4 + // + // If P5 is not zero and P4 is NULL, then everything after the ":" is + // omitted. + // + // There is an implied "Halt 0 0 0" instruction inserted at the very end of + // every program. So a jump past the last instruction of the program + // is the same as executing Halt. +__16: + + pcx = (int32((int64(pOp) - int64(aOp)) / 24)) + if !(((*Op)(unsafe.Pointer(pOp)).Fp1 == SQLITE_OK) && ((*Vdbe)(unsafe.Pointer(p)).FpFrame != 0)) { + goto __190 + } + // Halt the sub-program. Return control to the parent frame. + pFrame = (*Vdbe)(unsafe.Pointer(p)).FpFrame + (*Vdbe)(unsafe.Pointer(p)).FpFrame = (*VdbeFrame)(unsafe.Pointer(pFrame)).FpParent + (*Vdbe)(unsafe.Pointer(p)).FnFrame-- + Xsqlite3VdbeSetChanges(tls, db, (*Vdbe)(unsafe.Pointer(p)).FnChange) + pcx = Xsqlite3VdbeFrameRestore(tls, pFrame) + if !((*Op)(unsafe.Pointer(pOp)).Fp2 == OE_Ignore) { + goto __191 + } + // Instruction pcx is the OP_Program that invoked the sub-program + // currently being halted. If the p2 instruction of this OP_Halt + // instruction is set to OE_Ignore, then the sub-program is throwing + // an IGNORE exception. In this case jump to the address specified + // as the p2 of the calling OP_Program. + pcx = ((*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp+uintptr(pcx)*24)).Fp2 - 1) +__191: + ; + aOp = (*Vdbe)(unsafe.Pointer(p)).FaOp + aMem = (*Vdbe)(unsafe.Pointer(p)).FaMem + pOp = (aOp + uintptr(pcx)*24) + goto __8 +__190: + ; + (*Vdbe)(unsafe.Pointer(p)).Frc = (*Op)(unsafe.Pointer(pOp)).Fp1 + (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8((*Op)(unsafe.Pointer(pOp)).Fp2) + (*Vdbe)(unsafe.Pointer(p)).Fpc = pcx + + if !((*Vdbe)(unsafe.Pointer(p)).Frc != 0) { + goto __192 + } + if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { + goto __193 + } + + Xsqlite3VdbeError(tls, p, ts+4546 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { + goto __195 + } + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4567 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) +__195: + ; + goto __194 +__193: + Xsqlite3VdbeError(tls, p, ts+2791 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) +__194: + ; + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4574 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) +__192: + ; + rc = Xsqlite3VdbeHalt(tls, p) + + if !(rc == SQLITE_BUSY) { + goto __196 + } + (*Vdbe)(unsafe.Pointer(p)).Frc = SQLITE_BUSY + goto __197 +__196: + ; + + if (*Vdbe)(unsafe.Pointer(p)).Frc != 0 { + rc = SQLITE_ERROR + } else { + rc = SQLITE_DONE + } +__197: + ; + goto vdbe_return + + // Opcode: Integer P1 P2 * * * + // Synopsis: r[P2]=P1 + // + // The 32-bit integer value P1 is written into register P2. +__17: // out2 + pOut = out2Prerelease(tls, p, pOp) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64((*Op)(unsafe.Pointer(pOp)).Fp1) + goto __8 + + // Opcode: Int64 * P2 * P4 * + // Synopsis: r[P2]=P4 + // + // P4 is a pointer to a 64-bit integer value. + // Write that value into register P2. +__18: // out2 + pOut = out2Prerelease(tls, p, pOp) + + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + goto __8 + + // Opcode: Real * P2 * P4 * + // Synopsis: r[P2]=P4 + // + // P4 is a pointer to a 64-bit floating point value. + // Write that value into register P2. +__19: // same as TK_FLOAT, out2 + pOut = out2Prerelease(tls, p, pOp) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Real) + + *(*float64)(unsafe.Pointer(pOut /* &.u */)) = *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + goto __8 + + // Opcode: String8 * P2 * P4 * + // Synopsis: r[P2]='P4' + // + // P4 points to a nul terminated UTF-8 string. This opcode is transformed + // into a String opcode before it is executed for the first time. During + // this transformation, the length of string P4 is computed and stored + // as the P1 parameter. +__20: // same as TK_STRING, out2 + ; + pOut = out2Prerelease(tls, p, pOp) + (*Op)(unsafe.Pointer(pOp)).Fp1 = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + + if !(int32(encoding) != SQLITE_UTF8) { + goto __198 + } + rc = Xsqlite3VdbeMemSetStr(tls, pOut, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)), int64(-1), uint8(SQLITE_UTF8), uintptr(0)) + + if !(rc != 0) { + goto __199 + } + goto too_big +__199: + ; + if !(SQLITE_OK != Xsqlite3VdbeChangeEncoding(tls, pOut, int32(encoding))) { + goto __200 + } + goto no_mem +__200: + ; + + (*Mem)(unsafe.Pointer(pOut)).FszMalloc = 0 + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) |= U16((MEM_Static)) + if !(int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-7)) { + goto __201 + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) +__201: + ; + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(-7) + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = (*Mem)(unsafe.Pointer(pOut)).Fz + (*Op)(unsafe.Pointer(pOp)).Fp1 = (*Mem)(unsafe.Pointer(pOut)).Fn +__198: + ; + if !((*Op)(unsafe.Pointer(pOp)).Fp1 > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) { + goto __202 + } + goto too_big +__202: + ; + (*Op)(unsafe.Pointer(pOp)).Fopcode = U8(OP_String) + + // Opcode: String P1 P2 P3 P4 P5 + // Synopsis: r[P2]='P4' (len=P1) + // + // The string value P4 of length P1 (bytes) is stored in register P2. + // + // If P3 is not zero and the content of register P3 is equal to P5, then + // the datatype of the register P2 is converted to BLOB. The content is + // the same sequence of bytes, it is merely interpreted as a BLOB instead + // of a string, as if it had been CAST. In other words: + // + // if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB) +__21: // out2 + ; + pOut = out2Prerelease(tls, p, pOp) + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((MEM_Str | MEM_Static) | MEM_Term)) + (*Mem)(unsafe.Pointer(pOut)).Fz = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + (*Mem)(unsafe.Pointer(pOut)).Fn = (*Op)(unsafe.Pointer(pOp)).Fp1 + (*Mem)(unsafe.Pointer(pOut)).Fenc = encoding + + goto __8 + + // Opcode: Null P1 P2 P3 * * + // Synopsis: r[P2..P3]=NULL + // + // Write a NULL into registers P2. If P3 greater than P2, then also write + // NULL into register P3 and every register in between P2 and P3. If P3 + // is less than P2 (typically P3 is zero) then only register P2 is + // set to NULL. + // + // If the P1 value is non-zero, then also set the MEM_Cleared flag so that + // NULL values will not compare equal even if SQLITE_NULLEQ is set on + // OP_Ne or OP_Eq. +__22: + pOut = out2Prerelease(tls, p, pOp) + cnt = ((*Op)(unsafe.Pointer(pOp)).Fp3 - (*Op)(unsafe.Pointer(pOp)).Fp2) + + (*Mem)(unsafe.Pointer(pOut)).Fflags = libc.AssignUint16(&nullFlag, func() uint16 { + if (*Op)(unsafe.Pointer(pOp)).Fp1 != 0 { + return (uint16(MEM_Null | MEM_Cleared)) + } + return uint16(MEM_Null) + }()) + (*Mem)(unsafe.Pointer(pOut)).Fn = 0 +__203: + if !(cnt > 0) { + goto __204 + } + pOut += 56 + + Xsqlite3VdbeMemSetNull(tls, pOut) + (*Mem)(unsafe.Pointer(pOut)).Fflags = nullFlag + (*Mem)(unsafe.Pointer(pOut)).Fn = 0 + cnt-- + goto __203 +__204: + ; + goto __8 + + // Opcode: SoftNull P1 * * * * + // Synopsis: r[P1]=NULL + // + // Set register P1 to have the value NULL as seen by the OP_MakeRecord + // instruction, but do not free any string or blob memory associated with + // the register, so that if the value was a string or blob that was + // previously copied using OP_SCopy, the copies will continue to be valid. +__23: + ; + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer(pOut)).Fflags) & libc.CplInt32((MEM_Undefined | MEM_AffMask))) | MEM_Null)) + goto __8 + + // Opcode: Blob P1 P2 * P4 * + // Synopsis: r[P2]=P4 (len=P1) + // + // P4 points to a blob of data P1 bytes long. Store this + // blob in register P2. +__24: // out2 + ; + pOut = out2Prerelease(tls, p, pOp) + Xsqlite3VdbeMemSetStr(tls, pOut, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)), int64((*Op)(unsafe.Pointer(pOp)).Fp1), uint8(0), uintptr(0)) + (*Mem)(unsafe.Pointer(pOut)).Fenc = encoding + + goto __8 + + // Opcode: Variable P1 P2 * P4 * + // Synopsis: r[P2]=parameter(P1,P4) + // + // Transfer the values of bound parameter P1 into register P2 + // + // If the parameter is named, then its name appears in P4. + // The P4 value is used by sqlite3_bind_parameter_name(). +__25: // Value being transferred + + ; + + pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp1-1))*56) + if !(Xsqlite3VdbeMemTooBig(tls, pVar) != 0) { + goto __205 + } + goto too_big +__205: + ; + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + if !((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0) { + goto __206 + } + Xsqlite3VdbeMemSetNull(tls, pOut) +__206: + ; + libc.Xmemcpy(tls, pOut, pVar, uint64((uintptr(0) + 24 /* &.zMalloc */))) + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32((MEM_Dyn | MEM_Ephem)))) + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) |= U16((MEM_Static | MEM_FromBind)) + + goto __8 + + // Opcode: Move P1 P2 P3 * * + // Synopsis: r[P2@P3]=r[P1@P3] + // + // Move the P3 values in register P1..P1+P3-1 over into + // registers P2..P2+P3-1. Registers P1..P1+P3-1 are + // left holding a NULL. It is an error for register ranges + // P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error + // for P3 to be less than 1. +__26: // Register to copy to + + n = (*Op)(unsafe.Pointer(pOp)).Fp3 + p1 = (*Op)(unsafe.Pointer(pOp)).Fp1 + p2 = (*Op)(unsafe.Pointer(pOp)).Fp2 + + pIn1 = (aMem + uintptr(p1)*56) + pOut = (aMem + uintptr(p2)*56) +__207: + ; + + Xsqlite3VdbeMemMove(tls, pOut, pIn1) + if !(((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & MEM_Ephem) != 0) && (Xsqlite3VdbeMemMakeWriteable(tls, pOut) != 0)) { + goto __210 + } + goto no_mem +__210: + ; + + pIn1 += 56 + pOut += 56 + goto __208 +__208: + if libc.PreDecInt32(&n, 1) != 0 { + goto __207 + } + goto __209 +__209: + ; + goto __8 + + // Opcode: Copy P1 P2 P3 * * + // Synopsis: r[P2@P3+1]=r[P1@P3+1] + // + // Make a copy of registers P1..P1+P3 into registers P2..P2+P3. + // + // This instruction makes a deep copy of the value. A duplicate + // is made of any string or blob constant. See also OP_SCopy. +__27: + + n1 = (*Op)(unsafe.Pointer(pOp)).Fp3 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + +__211: + if !(1 != 0) { + goto __212 + } + + Xsqlite3VdbeMemShallowCopy(tls, pOut, pIn1, MEM_Ephem) + if !(((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & MEM_Ephem) != 0) && (Xsqlite3VdbeMemMakeWriteable(tls, pOut) != 0)) { + goto __213 + } + goto no_mem +__213: + ; + + if !((libc.PostDecInt32(&n1, 1)) == 0) { + goto __214 + } + goto __212 +__214: + ; + pOut += 56 + pIn1 += 56 + goto __211 +__212: + ; + goto __8 + + // Opcode: SCopy P1 P2 * * * + // Synopsis: r[P2]=r[P1] + // + // Make a shallow copy of register P1 into register P2. + // + // This instruction makes a shallow copy of the value. If the value + // is a string or blob, then the copy is only a pointer to the + // original and hence if the original changes so will the copy. + // Worse, if the original is deallocated, the copy becomes invalid. + // Thus the program must guarantee that the original will not change + // during the lifetime of the copy. Use OP_Copy to make a complete + // copy. +__28: // out2 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + + Xsqlite3VdbeMemShallowCopy(tls, pOut, pIn1, MEM_Ephem) + goto __8 + + // Opcode: IntCopy P1 P2 * * * + // Synopsis: r[P2]=r[P1] + // + // Transfer the integer value held in register P1 into register P2. + // + // This is an optimized version of SCopy that works only for integer + // values. +__29: // out2 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + Xsqlite3VdbeMemSetInt64(tls, pOut, *(*I64)(unsafe.Pointer(pIn1 /* &.u */))) + goto __8 + + // Opcode: ChngCntRow P1 P2 * * * + // Synopsis: output=r[P1] + // + // Output value in register P1 as the chance count for a DML statement, + // due to the "PRAGMA count_changes=ON" setting. Or, if there was a + // foreign key error in the statement, trigger the error now. + // + // This opcode is a variant of OP_ResultRow that checks the foreign key + // immediate constraint count and throws an error if the count is + // non-zero. The P2 opcode must be 1. +__30: + ; + if !((libc.AssignInt32(&rc, Xsqlite3VdbeCheckFk(tls, p, 0))) != SQLITE_OK) { + goto __215 + } + goto abort_due_to_error +__215: + ; + + // Opcode: ResultRow P1 P2 * * * + // Synopsis: output=r[P1@P2] + // + // The registers P1 through P1+P2-1 contain a single row of + // results. This opcode causes the sqlite3_step() call to terminate + // with an SQLITE_ROW return code and it sets up the sqlite3_stmt + // structure to provide access to the r(P1)..r(P1+P2-1) values as + // the result row. +__31: + ; + + // Invalidate all ephemeral cursor row caches + (*Vdbe)(unsafe.Pointer(p)).FcacheCtr = (((*Vdbe)(unsafe.Pointer(p)).FcacheCtr + U32(2)) | U32(1)) + + // Make sure the results of the current row are \000 terminated + // and have an assigned type. The results are de-ephemeralized as + // a side effect. + pMem = libc.AssignPtrUintptr(p+160 /* &.pResultSet */, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56)) + i = 0 +__216: + if !(i < (*Op)(unsafe.Pointer(pOp)).Fp2) { + goto __218 + } + + if !(((int32((*Mem)(unsafe.Pointer((pMem + uintptr(i)*56))).Fflags) & MEM_Ephem) != 0) && (Xsqlite3VdbeMemMakeWriteable(tls, (pMem+uintptr(i)*56)) != 0)) { + goto __219 + } + goto no_mem +__219: + ; + + Xsqlite3VdbeMemNulTerminate(tls, (pMem + uintptr(i)*56)) + + goto __217 +__217: + i++ + goto __216 + goto __218 +__218: + ; + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __220 + } + goto no_mem +__220: + ; + + if !((int32((*Sqlite3)(unsafe.Pointer(db)).FmTrace) & SQLITE_TRACE_ROW) != 0) { + goto __221 + } + (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_ROW), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, uintptr(0)) +__221: + ; + + // Return SQLITE_ROW + (*Vdbe)(unsafe.Pointer(p)).Fpc = ((int32((int64(pOp) - int64(aOp)) / 24)) + 1) + rc = SQLITE_ROW + goto vdbe_return + + // Opcode: Concat P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]+r[P1] + // + // Add the text in register P1 onto the end of the text in + // register P2 and store the result in register P3. + // If either the P1 or P2 text are NULL then store NULL in P3. + // + // P3 = P2 || P1 + // + // It is illegal for P1 and P3 to be the same register. Sometimes, + // if P3 is the same register as P2, the implementation is able + // to avoid a memcpy(). +__32: // Initial flags for P2 + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + flags1 = (*Mem)(unsafe.Pointer(pIn1)).Fflags + + if !(((int32(flags1) | int32((*Mem)(unsafe.Pointer(pIn2)).Fflags)) & MEM_Null) != 0) { + goto __222 + } + Xsqlite3VdbeMemSetNull(tls, pOut) + goto __8 +__222: + ; + if !((int32(flags1) & (MEM_Str | MEM_Blob)) == 0) { + goto __223 + } + if !(Xsqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(0)) != 0) { + goto __225 + } + goto no_mem +__225: + ; + flags1 = (U16(int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & libc.CplInt32(MEM_Str))) + goto __224 +__223: + if !((int32(flags1) & MEM_Zero) != 0) { + goto __226 + } + if !(Xsqlite3VdbeMemExpandBlob(tls, pIn1) != 0) { + goto __227 + } + goto no_mem +__227: + ; + flags1 = (U16(int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & libc.CplInt32(MEM_Str))) +__226: + ; +__224: + ; + flags2 = (*Mem)(unsafe.Pointer(pIn2)).Fflags + if !((int32(flags2) & (MEM_Str | MEM_Blob)) == 0) { + goto __228 + } + if !(Xsqlite3VdbeMemStringify(tls, pIn2, encoding, uint8(0)) != 0) { + goto __230 + } + goto no_mem +__230: + ; + flags2 = (U16(int32((*Mem)(unsafe.Pointer(pIn2)).Fflags) & libc.CplInt32(MEM_Str))) + goto __229 +__228: + if !((int32(flags2) & MEM_Zero) != 0) { + goto __231 + } + if !(Xsqlite3VdbeMemExpandBlob(tls, pIn2) != 0) { + goto __232 + } + goto no_mem +__232: + ; + flags2 = (U16(int32((*Mem)(unsafe.Pointer(pIn2)).Fflags) & libc.CplInt32(MEM_Str))) +__231: + ; +__229: + ; + nByte = (I64((*Mem)(unsafe.Pointer(pIn1)).Fn + (*Mem)(unsafe.Pointer(pIn2)).Fn)) + if !(nByte > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))))) { + goto __233 + } + goto too_big +__233: + ; + if !(Xsqlite3VdbeMemGrow(tls, pOut, (int32(nByte)+3), (libc.Bool32(pOut == pIn2))) != 0) { + goto __234 + } + goto no_mem +__234: + ; + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Str)) + if !(pOut != pIn2) { + goto __235 + } + libc.Xmemcpy(tls, (*Mem)(unsafe.Pointer(pOut)).Fz, (*Mem)(unsafe.Pointer(pIn2)).Fz, uint64((*Mem)(unsafe.Pointer(pIn2)).Fn)) + + (*Mem)(unsafe.Pointer(pIn2)).Fflags = flags2 +__235: + ; + libc.Xmemcpy(tls, ((*Mem)(unsafe.Pointer(pOut)).Fz + uintptr((*Mem)(unsafe.Pointer(pIn2)).Fn)), (*Mem)(unsafe.Pointer(pIn1)).Fz, uint64((*Mem)(unsafe.Pointer(pIn1)).Fn)) + + (*Mem)(unsafe.Pointer(pIn1)).Fflags = flags1 + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pOut)).Fz + uintptr(nByte))) = int8(0) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pOut)).Fz + uintptr((nByte + int64(1))))) = int8(0) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pOut)).Fz + uintptr((nByte + int64(2))))) = int8(0) + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) |= U16((MEM_Term)) + (*Mem)(unsafe.Pointer(pOut)).Fn = int32(nByte) + (*Mem)(unsafe.Pointer(pOut)).Fenc = encoding + + goto __8 + + // Opcode: Add P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]+r[P2] + // + // Add the value in register P1 to the value in register P2 + // and store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: Multiply P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]*r[P2] + // + // + // Multiply the value in register P1 by the value in register P2 + // and store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: Subtract P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]-r[P1] + // + // Subtract the value in register P1 from the value in register P2 + // and store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: Divide P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]/r[P1] + // + // Divide the value in register P1 by the value in register P2 + // and store the result in register P3 (P3=P2/P1). If the value in + // register P1 is zero, then the result is NULL. If either input is + // NULL, the result is NULL. + // Opcode: Remainder P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]%r[P1] + // + // Compute the remainder after integer register P2 is divided by + // register P1 and store the result in register P3. + // If the value in register P1 is zero the result is NULL. + // If either operand is NULL, the result is NULL. +__33: // same as TK_PLUS, in1, in2, out3 +__34: // same as TK_MINUS, in1, in2, out3 +__35: // same as TK_STAR, in1, in2, out3 +__36: // same as TK_SLASH, in1, in2, out3 +__37: // Real value of right operand + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + type1 = numericType(tls, pIn1) + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + type2 = numericType(tls, pIn2) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + flags = (U16(int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) | int32((*Mem)(unsafe.Pointer(pIn2)).Fflags))) + if !(((int32(type1) & int32(type2)) & MEM_Int) != 0) { + goto __236 + } + iA = *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) = *(*I64)(unsafe.Pointer(pIn2 /* &.u */)) + switch int32((*Op)(unsafe.Pointer(pOp)).Fopcode) { + case OP_Add: + goto __239 + case OP_Subtract: + goto __240 + case OP_Multiply: + goto __241 + case OP_Divide: + goto __242 + default: + goto __243 + } + goto __238 +__239: + if !(Xsqlite3AddInt64(tls, bp+176 /* &iB */, iA) != 0) { + goto __244 + } + goto fp_math +__244: + ; + goto __238 +__240: + if !(Xsqlite3SubInt64(tls, bp+176 /* &iB */, iA) != 0) { + goto __245 + } + goto fp_math +__245: + ; + goto __238 +__241: + if !(Xsqlite3MulInt64(tls, bp+176 /* &iB */, iA) != 0) { + goto __246 + } + goto fp_math +__246: + ; + goto __238 +__242: + if !(iA == int64(0)) { + goto __247 + } + goto arithmetic_result_is_null +__247: + ; + if !((iA == int64(-1)) && (*(*I64)(unsafe.Pointer(bp + 176 /* iB */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { + goto __248 + } + goto fp_math +__248: + ; + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) /= iA + goto __238 + +__243: + if !(iA == int64(0)) { + goto __249 + } + goto arithmetic_result_is_null +__249: + ; + if !(iA == int64(-1)) { + goto __250 + } + iA = int64(1) +__250: + ; + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) %= iA + goto __238 + +__238: + ; + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) + goto __237 +__236: + if !((int32(flags) & MEM_Null) != 0) { + goto __251 + } + goto arithmetic_result_is_null + goto __252 +__251: +fp_math: + rA = Xsqlite3VdbeRealValue(tls, pIn1) + rB = Xsqlite3VdbeRealValue(tls, pIn2) + switch int32((*Op)(unsafe.Pointer(pOp)).Fopcode) { + case OP_Add: + goto __254 + case OP_Subtract: + goto __255 + case OP_Multiply: + goto __256 + case OP_Divide: + goto __257 + default: + goto __258 + } + goto __253 +__254: + rB = rB + (rA) + goto __253 +__255: + rB = rB - (rA) + goto __253 +__256: + rB = rB * (rA) + goto __253 +__257: + // (double)0 In case of SQLITE_OMIT_FLOATING_POINT... + if !(rA == float64(0)) { + goto __259 + } + goto arithmetic_result_is_null +__259: + ; + rB = rB / (rA) + goto __253 + +__258: + iA = Xsqlite3VdbeIntValue(tls, pIn1) + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) = Xsqlite3VdbeIntValue(tls, pIn2) + if !(iA == int64(0)) { + goto __260 + } + goto arithmetic_result_is_null +__260: + ; + if !(iA == int64(-1)) { + goto __261 + } + iA = int64(1) +__261: + ; + rB = (float64(*(*I64)(unsafe.Pointer(bp + 176 /* iB */)) % iA)) + goto __253 + +__253: + ; + if !(Xsqlite3IsNaN(tls, rB) != 0) { + goto __262 + } + goto arithmetic_result_is_null +__262: + ; + *(*float64)(unsafe.Pointer(pOut /* &.u */)) = rB + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Real)) +__252: + ; +__237: + ; + goto __8 + +arithmetic_result_is_null: + Xsqlite3VdbeMemSetNull(tls, pOut) + goto __8 + + // Opcode: CollSeq P1 * * P4 + // + // P4 is a pointer to a CollSeq object. If the next call to a user function + // or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will + // be returned. This is used by the built-in min(), max() and nullif() + // functions. + // + // If P1 is not zero, then it is a register that a subsequent min() or + // max() aggregate will set to 1 if the current row is not the minimum or + // maximum. The P1 register is initialized to 0 by this instruction. + // + // The interface used by the implementation of the aforementioned functions + // to retrieve the collation sequence set by this opcode is not available + // publicly. Only built-in functions have access to this feature. +__38: + ; + if !((*Op)(unsafe.Pointer(pOp)).Fp1 != 0) { + goto __263 + } + Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56), int64(0)) +__263: + ; + goto __8 + + // Opcode: BitAnd P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]&r[P2] + // + // Take the bit-wise AND of the values in register P1 and P2 and + // store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: BitOr P1 P2 P3 * * + // Synopsis: r[P3]=r[P1]|r[P2] + // + // Take the bit-wise OR of the values in register P1 and P2 and + // store the result in register P3. + // If either input is NULL, the result is NULL. + // Opcode: ShiftLeft P1 P2 P3 * * + // Synopsis: r[P3]=r[P2]<>r[P1] + // + // Shift the integer value in register P2 to the right by the + // number of bits specified by the integer in register P1. + // Store the result in register P3. + // If either input is NULL, the result is NULL. +__39: // same as TK_BITAND, in1, in2, out3 +__40: // same as TK_BITOR, in1, in2, out3 +__41: // same as TK_LSHIFT, in1, in2, out3 +__42: + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + if !(((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) | int32((*Mem)(unsafe.Pointer(pIn2)).Fflags)) & MEM_Null) != 0) { + goto __264 + } + Xsqlite3VdbeMemSetNull(tls, pOut) + goto __8 +__264: + ; + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) = Xsqlite3VdbeIntValue(tls, pIn2) + iB1 = Xsqlite3VdbeIntValue(tls, pIn1) + op = (*Op)(unsafe.Pointer(pOp)).Fopcode + if !(int32(op) == OP_BitAnd) { + goto __265 + } + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) &= iB1 + goto __266 +__265: + if !(int32(op) == OP_BitOr) { + goto __267 + } + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) |= iB1 + goto __268 +__267: + if !(iB1 != int64(0)) { + goto __269 + } + + // If shifting by a negative amount, shift in the other direction + if !(iB1 < int64(0)) { + goto __270 + } + + op = (U8(((2 * OP_ShiftLeft) + 1) - int32(op))) + if iB1 > (int64(-64)) { + iB1 = -iB1 + } else { + iB1 = int64(64) + } +__270: + ; + + if !(iB1 >= int64(64)) { + goto __271 + } + if (*(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) >= int64(0)) || (int32(op) == OP_ShiftLeft) { + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) = int64(0) + } else { + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) = int64(-1) + } + goto __272 +__271: + libc.Xmemcpy(tls, bp+184 /* &uA */, bp+192 /* &iA1 */, uint64(unsafe.Sizeof(U64(0)))) + if !(int32(op) == OP_ShiftLeft) { + goto __273 + } + *(*U64)(unsafe.Pointer(bp + 184 /* uA */)) <<= iB1 + goto __274 +__273: + *(*U64)(unsafe.Pointer(bp + 184 /* uA */)) >>= iB1 + // Sign-extend on a right shift of a negative number + if !(*(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) < int64(0)) { + goto __275 + } + *(*U64)(unsafe.Pointer(bp + 184 /* uA */)) |= (U64(((U64((uint64(0xffffffff))) << 32) | uint64(0xffffffff))) << (int64(64) - iB1)) +__275: + ; +__274: + ; + libc.Xmemcpy(tls, bp+192 /* &iA1 */, bp+184 /* &uA */, uint64(unsafe.Sizeof(I64(0)))) +__272: + ; +__269: + ; +__268: + ; +__266: + ; + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) + goto __8 + + // Opcode: AddImm P1 P2 * * * + // Synopsis: r[P1]=r[P1]+P2 + // + // Add the constant P2 to the value in register P1. + // The result is always an integer. + // + // To force any register to be an integer, just add 0. +__43: // in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + Xsqlite3VdbeMemIntegerify(tls, pIn1) + *(*I64)(unsafe.Pointer(pIn1 /* &.u */ /* &.i */)) += (I64((*Op)(unsafe.Pointer(pOp)).Fp2)) + goto __8 + + // Opcode: MustBeInt P1 P2 * * * + // + // Force the value in register P1 to be an integer. If the value + // in P1 is not an integer and cannot be converted into an integer + // without data loss, then jump immediately to P2, or if P2==0 + // raise an SQLITE_MISMATCH exception. +__44: // jump, in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Int) == 0) { + goto __276 + } + applyAffinity(tls, pIn1, int8(SQLITE_AFF_NUMERIC), encoding) + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Int) == 0) { + goto __277 + } + + if !((*Op)(unsafe.Pointer(pOp)).Fp2 == 0) { + goto __278 + } + rc = SQLITE_MISMATCH + goto abort_due_to_error + goto __279 +__278: + goto jump_to_p2 +__279: + ; +__277: + ; +__276: + ; + + (*Mem)(unsafe.Pointer(pIn1)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pIn1))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) + goto __8 + + // Opcode: RealAffinity P1 * * * * + // + // If register P1 holds an integer convert it to a real value. + // + // This opcode is used when extracting information from a column that + // has REAL affinity. Such column values may still be stored as + // integers, for space efficiency, but after extraction we want them + // to have only a real value. +__45: // in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & (MEM_Int | MEM_IntReal)) != 0) { + goto __280 + } + + Xsqlite3VdbeMemRealify(tls, pIn1) + +__280: + ; + goto __8 + + // Opcode: Cast P1 P2 * * * + // Synopsis: affinity(r[P1]) + // + // Force the value in register P1 to be the type defined by P2. + // + //
    + //
  • P2=='A' → BLOB + //
  • P2=='B' → TEXT + //
  • P2=='C' → NUMERIC + //
  • P2=='D' → INTEGER + //
  • P2=='E' → REAL + //
+ // + // A NULL value is not changed by this routine. It remains NULL. +__46: // in1 + ; + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + rc = func() int32 { + if (int32((*Mem)(unsafe.Pointer((pIn1))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pIn1) + } + return 0 + }() + if !(rc != 0) { + goto __281 + } + goto abort_due_to_error +__281: + ; + rc = Xsqlite3VdbeMemCast(tls, pIn1, uint8((*Op)(unsafe.Pointer(pOp)).Fp2), encoding) + if !(rc != 0) { + goto __282 + } + goto abort_due_to_error +__282: + ; + + goto __8 + + // Opcode: Eq P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]==r[P1] + // + // Compare the values in register P1 and P3. If reg(P3)==reg(P1) then + // jump to address P2. + // + // The SQLITE_AFF_MASK portion of P5 must be an affinity character - + // SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made + // to coerce both inputs according to this affinity before the + // comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric + // affinity is used. Note that the affinity conversions are stored + // back into the input registers P1 and P3. So this opcode can cause + // persistent changes to registers P1 and P3. + // + // Once any conversions have taken place, and neither value is NULL, + // the values are compared. If both values are blobs then memcmp() is + // used to determine the results of the comparison. If both values + // are text, then the appropriate collating function specified in + // P4 is used to do the comparison. If P4 is not specified then + // memcmp() is used to compare text string. If both values are + // numeric, then a numeric comparison is used. If the two values + // are of different types, then numbers are considered less than + // strings and strings are considered less than blobs. + // + // If SQLITE_NULLEQ is set in P5 then the result of comparison is always either + // true or false and is never NULL. If both operands are NULL then the result + // of comparison is true. If either operand is NULL then the result is false. + // If neither operand is NULL the result is the same as it would be if + // the SQLITE_NULLEQ flag were omitted from P5. + // + // This opcode saves the result of comparison for use by the new + // OP_Jump opcode. + // Opcode: Ne P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]!=r[P1] + // + // This works just like the Eq opcode except that the jump is taken if + // the operands in registers P1 and P3 are not equal. See the Eq opcode for + // additional information. + // Opcode: Lt P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]r[P1] + // + // This works just like the Lt opcode except that the jump is taken if + // the content of register P3 is greater than the content of + // register P1. See the Lt opcode for additional information. + // Opcode: Ge P1 P2 P3 P4 P5 + // Synopsis: IF r[P3]>=r[P1] + // + // This works just like the Lt opcode except that the jump is taken if + // the content of register P3 is greater than or equal to the content of + // register P1. See the Lt opcode for additional information. +__47: // same as TK_EQ, jump, in1, in3 +__48: // same as TK_NE, jump, in1, in3 +__49: // same as TK_LT, jump, in1, in3 +__50: // same as TK_LE, jump, in1, in3 +__51: // same as TK_GT, jump, in1, in3 +__52: // Copy of initial value of pIn3->flags + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + flags11 = (*Mem)(unsafe.Pointer(pIn1)).Fflags + flags3 = (*Mem)(unsafe.Pointer(pIn3)).Fflags + if !(((int32(flags11) & int32(flags3)) & MEM_Int) != 0) { + goto __283 + } + + // Common case of comparison of two integers + if !(*(*I64)(unsafe.Pointer(pIn3 /* &.u */)) > *(*I64)(unsafe.Pointer(pIn1 /* &.u */))) { + goto __284 + } + iCompare = +1 + if !(*(*uint8)(unsafe.Pointer(Xsqlite3aGTb + uintptr((*Op)(unsafe.Pointer(pOp)).Fopcode))) != 0) { + goto __286 + } + + goto jump_to_p2 +__286: + ; + goto __285 +__284: + if !(*(*I64)(unsafe.Pointer(pIn3 /* &.u */)) < *(*I64)(unsafe.Pointer(pIn1 /* &.u */))) { + goto __287 + } + iCompare = -1 + if !(*(*uint8)(unsafe.Pointer(Xsqlite3aLTb + uintptr((*Op)(unsafe.Pointer(pOp)).Fopcode))) != 0) { + goto __289 + } + + goto jump_to_p2 +__289: + ; + goto __288 +__287: + iCompare = 0 + if !(*(*uint8)(unsafe.Pointer(Xsqlite3aEQb + uintptr((*Op)(unsafe.Pointer(pOp)).Fopcode))) != 0) { + goto __290 + } + + goto jump_to_p2 +__290: + ; +__288: + ; +__285: + ; + + goto __8 +__283: + ; + if !(((int32(flags11) | int32(flags3)) & MEM_Null) != 0) { + goto __291 + } + // One or both operands are NULL + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & SQLITE_NULLEQ) != 0) { + goto __293 + } + // If SQLITE_NULLEQ is set (which will only happen if the operator is + // OP_Eq or OP_Ne) then take the jump or not depending on whether + // or not both operands are null. + + if !((((int32(flags11) & int32(flags3)) & MEM_Null) != 0) && + ((int32(flags3) & MEM_Cleared) == 0)) { + goto __295 + } + res = 0 // Operands are equal + goto __296 +__295: + res = func() int32 { + if (int32(flags3) & MEM_Null) != 0 { + return -1 + } + return +1 + }() // Operands are not equal +__296: + ; + goto __294 +__293: + // SQLITE_NULLEQ is clear and at least one operand is NULL, + // then the result is always NULL. + // The jump is taken if the SQLITE_JUMPIFNULL bit is set. + iCompare = 1 // Operands are not equal + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & SQLITE_JUMPIFNULL) != 0) { + goto __297 + } + goto jump_to_p2 +__297: + ; + goto __8 +__294: + ; + goto __292 +__291: + // Neither operand is NULL and we couldn't do the special high-speed + // integer comparison case. So do a general-case comparison. + affinity = (int8(int32((*Op)(unsafe.Pointer(pOp)).Fp5) & SQLITE_AFF_MASK)) + if !(int32(affinity) >= SQLITE_AFF_NUMERIC) { + goto __298 + } + if !(((int32(flags11) | int32(flags3)) & MEM_Str) != 0) { + goto __300 + } + if !((int32(flags11) & (((MEM_Int | MEM_IntReal) | MEM_Real) | MEM_Str)) == MEM_Str) { + goto __301 + } + applyNumericAffinity(tls, pIn1, 0) + + flags3 = (*Mem)(unsafe.Pointer(pIn3)).Fflags +__301: + ; + if !((int32(flags3) & (((MEM_Int | MEM_IntReal) | MEM_Real) | MEM_Str)) == MEM_Str) { + goto __302 + } + applyNumericAffinity(tls, pIn3, 0) +__302: + ; +__300: + ; + goto __299 +__298: + if !(int32(affinity) == SQLITE_AFF_TEXT) { + goto __303 + } + if !(((int32(flags11) & MEM_Str) == 0) && ((int32(flags11) & ((MEM_Int | MEM_Real) | MEM_IntReal)) != 0)) { + goto __304 + } + + Xsqlite3VdbeMemStringify(tls, pIn1, encoding, uint8(1)) + + flags11 = (U16((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & libc.CplInt32(MEM_TypeMask)) | (int32(flags11) & MEM_TypeMask))) + if !(pIn1 == pIn3) { + goto __305 + } + flags3 = (U16(int32(flags11) | MEM_Str)) +__305: + ; +__304: + ; + if !(((int32(flags3) & MEM_Str) == 0) && ((int32(flags3) & ((MEM_Int | MEM_Real) | MEM_IntReal)) != 0)) { + goto __306 + } + + Xsqlite3VdbeMemStringify(tls, pIn3, encoding, uint8(1)) + + flags3 = (U16((int32((*Mem)(unsafe.Pointer(pIn3)).Fflags) & libc.CplInt32(MEM_TypeMask)) | (int32(flags3) & MEM_TypeMask))) +__306: + ; +__303: + ; +__299: + ; + + res = Xsqlite3MemCompare(tls, pIn3, pIn1, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) +__292: + ; + + // At this point, res is negative, zero, or positive if reg[P1] is + // less than, equal to, or greater than reg[P3], respectively. Compute + // the answer to this operator in res2, depending on what the comparison + // operator actually is. The next block of code depends on the fact + // that the 6 comparison operators are consecutive integers in this + // order: NE, EQ, GT, LE, LT, GE + + if !(res < 0) { + goto __307 + } + res2 = int32(*(*uint8)(unsafe.Pointer(Xsqlite3aLTb + uintptr((*Op)(unsafe.Pointer(pOp)).Fopcode)))) + goto __308 +__307: + if !(res == 0) { + goto __309 + } + res2 = int32(*(*uint8)(unsafe.Pointer(Xsqlite3aEQb + uintptr((*Op)(unsafe.Pointer(pOp)).Fopcode)))) + goto __310 +__309: + res2 = int32(*(*uint8)(unsafe.Pointer(Xsqlite3aGTb + uintptr((*Op)(unsafe.Pointer(pOp)).Fopcode)))) +__310: + ; +__308: + ; + iCompare = res + + // Undo any changes made by applyAffinity() to the input registers. + + (*Mem)(unsafe.Pointer(pIn3)).Fflags = flags3 + + (*Mem)(unsafe.Pointer(pIn1)).Fflags = flags11 + + if !(res2 != 0) { + goto __311 + } + goto jump_to_p2 +__311: + ; + goto __8 + + // Opcode: ElseEq * P2 * * * + // + // This opcode must follow an OP_Lt or OP_Gt comparison operator. There + // can be zero or more OP_ReleaseReg opcodes intervening, but no other + // opcodes are allowed to occur between this instruction and the previous + // OP_Lt or OP_Gt. + // + // If result of an OP_Eq comparison on the same two operands as the + // prior OP_Lt or OP_Gt would have been true, then jump to P2. + // If the result of an OP_Eq comparison on the two previous + // operands would have been false or NULL, then fall through. +__53: // same as TK_ESCAPE, jump + + ; + if !(iCompare == 0) { + goto __312 + } + goto jump_to_p2 +__312: + ; + goto __8 + + // Opcode: Permutation * * * P4 * + // + // Set the permutation used by the OP_Compare operator in the next + // instruction. The permutation is stored in the P4 operand. + // + // The permutation is only valid until the next OP_Compare that has + // the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should + // occur immediately prior to the OP_Compare. + // + // The first integer in the P4 integer array is the length of the array + // and does not become part of the permutation. +__54: + ; + + goto __8 + + // Opcode: Compare P1 P2 P3 P4 P5 + // Synopsis: r[P1@P3] <-> r[P2@P3] + // + // Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this + // vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of + // the comparison for use by the next OP_Jump instruct. + // + // If P5 has the OPFLAG_PERMUTE bit set, then the order of comparison is + // determined by the most recent OP_Permutation operator. If the + // OPFLAG_PERMUTE bit is clear, then register are compared in sequential + // order. + // + // P4 is a KeyInfo structure that defines collating sequences and sort + // orders for the comparison. The permutation applies to registers + // only. The KeyInfo elements are used sequentially. + // + // The comparison is a sort comparison, so NULLs compare equal, + // NULLs are less than numbers, numbers are less than strings, + // and strings are less than blobs. +__55: // The permutation + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_PERMUTE) == 0) { + goto __313 + } + aPermute = uintptr(0) + goto __314 +__313: + ; + + aPermute = (*(*uintptr)(unsafe.Pointer(pOp + libc.UintptrFromInt32(-1)*24 + 16 /* &.p4 */)) + uintptr(1)*4) + +__314: + ; + n2 = (*Op)(unsafe.Pointer(pOp)).Fp3 + pKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + p11 = (*Op)(unsafe.Pointer(pOp)).Fp1 + p21 = (*Op)(unsafe.Pointer(pOp)).Fp2 + i1 = 0 +__315: + if !(i1 < n2) { + goto __317 + } + if aPermute != 0 { + idx = *(*U32)(unsafe.Pointer(aPermute + uintptr(i1)*4)) + } else { + idx = U32(i1) + } + + pColl = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(i1)*8)) + bRev = (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i1)))) & KEYINFO_ORDER_DESC) + iCompare = Xsqlite3MemCompare(tls, (aMem + uintptr((U32(p11)+idx))*56), (aMem + uintptr((U32(p21)+idx))*56), pColl) + if !(iCompare != 0) { + goto __318 + } + if !(((int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(i1)))) & KEYINFO_ORDER_BIGNULL) != 0) && + (((int32((*Mem)(unsafe.Pointer(aMem+uintptr((U32(p11)+idx))*56)).Fflags) & MEM_Null) != 0) || ((int32((*Mem)(unsafe.Pointer(aMem+uintptr((U32(p21)+idx))*56)).Fflags) & MEM_Null) != 0))) { + goto __319 + } + iCompare = -iCompare +__319: + ; + if !(bRev != 0) { + goto __320 + } + iCompare = -iCompare +__320: + ; + goto __317 +__318: + ; + goto __316 +__316: + i1++ + goto __315 + goto __317 +__317: + ; + goto __8 + + // Opcode: Jump P1 P2 P3 * * + // + // Jump to the instruction at address P1, P2, or P3 depending on whether + // in the most recent OP_Compare instruction the P1 vector was less than + // equal to, or greater than the P2 vector, respectively. +__56: // jump + if !(iCompare < 0) { + goto __321 + } + pOp = (aOp + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp1-1))*24) + goto __322 +__321: + if !(iCompare == 0) { + goto __323 + } + pOp = (aOp + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp2-1))*24) + goto __324 +__323: + ; + pOp = (aOp + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp3-1))*24) +__324: + ; +__322: + ; + goto __8 + + // Opcode: And P1 P2 P3 * * + // Synopsis: r[P3]=(r[P1] && r[P2]) + // + // Take the logical AND of the values in registers P1 and P2 and + // write the result into register P3. + // + // If either P1 or P2 is 0 (false) then the result is 0 even if + // the other input is NULL. A NULL and true or two NULLs give + // a NULL output. + // Opcode: Or P1 P2 P3 * * + // Synopsis: r[P3]=(r[P1] || r[P2]) + // + // Take the logical OR of the values in register P1 and P2 and + // store the answer in register P3. + // + // If either P1 or P2 is nonzero (true) then the result is 1 (true) + // even if the other input is NULL. A NULL and false or two NULLs + // give a NULL output. +__57: // same as TK_AND, in1, in2, out3 +__58: // Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL + + v1 = Xsqlite3VdbeBooleanValue(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56), 2) + v2 = Xsqlite3VdbeBooleanValue(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56), 2) + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_And) { + goto __325 + } + v1 = int32(and_logic[((v1 * 3) + v2)]) + goto __326 +__325: + v1 = int32(or_logic[((v1 * 3) + v2)]) +__326: + ; + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + if !(v1 == 2) { + goto __327 + } + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Null)) + goto __328 +__327: + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(v1) + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) +__328: + ; + goto __8 + + // Opcode: IsTrue P1 P2 P3 P4 * + // Synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 + // + // This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and + // IS NOT FALSE operators. + // + // Interpret the value in register P1 as a boolean value. Store that + // boolean (a 0 or 1) in register P2. Or if the value in register P1 is + // NULL, then the P3 is stored in register P2. Invert the answer if P4 + // is 1. + // + // The logic is summarized like this: + // + //
    + //
  • If P3==0 and P4==0 then r[P2] := r[P1] IS TRUE + //
  • If P3==1 and P4==1 then r[P2] := r[P1] IS FALSE + //
  • If P3==0 and P4==1 then r[P2] := r[P1] IS NOT TRUE + //
  • If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE + //
+__59: // in1, out2 + ; + + Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56), + (int64(Xsqlite3VdbeBooleanValue(tls, (aMem+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56), (*Op)(unsafe.Pointer(pOp)).Fp3) ^ *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))))) + goto __8 + + // Opcode: Not P1 P2 * * * + // Synopsis: r[P2]= !r[P1] + // + // Interpret the value in register P1 as a boolean value. Store the + // boolean complement in register P2. If the value in register P1 is + // NULL, then a NULL is stored in P2. +__60: // same as TK_NOT, in1, out2 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Null) == 0) { + goto __329 + } + Xsqlite3VdbeMemSetInt64(tls, pOut, libc.BoolInt64(!(Xsqlite3VdbeBooleanValue(tls, pIn1, 0) != 0))) + goto __330 +__329: + Xsqlite3VdbeMemSetNull(tls, pOut) +__330: + ; + goto __8 + + // Opcode: BitNot P1 P2 * * * + // Synopsis: r[P2]= ~r[P1] + // + // Interpret the content of register P1 as an integer. Store the + // ones-complement of the P1 value into register P2. If P1 holds + // a NULL then store a NULL in P2. +__61: // same as TK_BITNOT, in1, out2 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + Xsqlite3VdbeMemSetNull(tls, pOut) + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Null) == 0) { + goto __331 + } + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Int) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = ^Xsqlite3VdbeIntValue(tls, pIn1) +__331: + ; + goto __8 + + // Opcode: Once P1 P2 * * * + // + // Fall through to the next instruction the first time this opcode is + // encountered on each invocation of the byte-code program. Jump to P2 + // on the second and all subsequent encounters during the same invocation. + // + // Top-level programs determine first invocation by comparing the P1 + // operand against the P1 operand on the OP_Init opcode at the beginning + // of the program. If the P1 values differ, then fall through and make + // the P1 of this opcode equal to the P1 of OP_Init. If P1 values are + // the same then take the jump. + // + // For subprograms, there is a bitmask in the VdbeFrame that determines + // whether or not the jump should be taken. The bitmask is necessary + // because the self-altering code trick does not work for recursive + // triggers. +__62: // Address of this instruction + ; + if !((*Vdbe)(unsafe.Pointer(p)).FpFrame != 0) { + goto __332 + } + iAddr = U32((int32((int64(pOp) - int64((*Vdbe)(unsafe.Pointer(p)).FaOp)) / 24))) + if !((int32(*(*U8)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr((iAddr / U32(8)))))) & (int32(1) << (iAddr & U32(7)))) != 0) { + goto __334 + } + + goto jump_to_p2 +__334: + ; + *(*U8)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FpFrame)).FaOnce + uintptr((iAddr / U32(8))))) |= U8((int32(1) << (iAddr & U32(7)))) + goto __333 +__332: + if !((*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp)).Fp1 == (*Op)(unsafe.Pointer(pOp)).Fp1) { + goto __335 + } + + goto jump_to_p2 +__335: + ; +__333: + ; + + (*Op)(unsafe.Pointer(pOp)).Fp1 = (*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp)).Fp1 + goto __8 + + // Opcode: If P1 P2 P3 * * + // + // Jump to P2 if the value in register P1 is true. The value + // is considered true if it is numeric and non-zero. If the value + // in P1 is NULL then take the jump if and only if P3 is non-zero. +__63: + c = Xsqlite3VdbeBooleanValue(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56), (*Op)(unsafe.Pointer(pOp)).Fp3) + + if !(c != 0) { + goto __336 + } + goto jump_to_p2 +__336: + ; + goto __8 + + // Opcode: IfNot P1 P2 P3 * * + // + // Jump to P2 if the value in register P1 is False. The value + // is considered false if it has a numeric value of zero. If the value + // in P1 is NULL then take the jump if and only if P3 is non-zero. +__64: + c1 = libc.BoolInt32(!(Xsqlite3VdbeBooleanValue(tls, (aMem+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56), libc.BoolInt32(!((*Op)(unsafe.Pointer(pOp)).Fp3 != 0))) != 0)) + + if !(c1 != 0) { + goto __337 + } + goto jump_to_p2 +__337: + ; + goto __8 + + // Opcode: IsNull P1 P2 * * * + // Synopsis: if r[P1]==NULL goto P2 + // + // Jump to P2 if the value in register P1 is NULL. +__65: // same as TK_ISNULL, jump, in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Null) != 0) { + goto __338 + } + goto jump_to_p2 +__338: + ; + goto __8 + + // Opcode: ZeroOrNull P1 P2 P3 * * + // Synopsis: r[P2] = 0 OR NULL + // + // If all both registers P1 and P3 are NOT NULL, then store a zero in + // register P2. If either registers P1 or P3 are NULL then put + // a NULL in register P2. +__66: // in1, in2, out2, in3 + if !(((int32((*Mem)(unsafe.Pointer(aMem+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56)).Fflags) & MEM_Null) != 0) || + ((int32((*Mem)(unsafe.Pointer(aMem+uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fflags) & MEM_Null) != 0)) { + goto __339 + } + Xsqlite3VdbeMemSetNull(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56)) + goto __340 +__339: + Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56), int64(0)) +__340: + ; + goto __8 + + // Opcode: NotNull P1 P2 * * * + // Synopsis: if r[P1]!=NULL goto P2 + // + // Jump to P2 if the value in register P1 is not NULL. +__67: // same as TK_NOTNULL, jump, in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Null) == 0) { + goto __341 + } + goto jump_to_p2 +__341: + ; + goto __8 + + // Opcode: IfNullRow P1 P2 P3 * * + // Synopsis: if P1.nullRow then r[P3]=NULL, goto P2 + // + // Check the cursor P1 to see if it is currently pointing at a NULL row. + // If it is, then set register P3 to NULL and jump immediately to P2. + // If P1 is not on a NULL row, then fall through without making any + // changes. +__68: // jump + ; + + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)))).FnullRow != 0) { + goto __342 + } + Xsqlite3VdbeMemSetNull(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)) + goto jump_to_p2 +__342: + ; + goto __8 + + // Opcode: Offset P1 P2 P3 * * + // Synopsis: r[P3] = sqlite_offset(P1) + // + // Store in register r[P3] the byte offset into the database file that is the + // start of the payload for the record at which that cursor P1 is currently + // pointing. + // + // P2 is the column number for the argument to the sqlite_offset() function. + // This opcode does not use P2 itself, but the P2 value is used by the + // code generator. The P1, P2, and P3 operands to this opcode are the + // same as for OP_Column. + // + // This opcode is only available if SQLite is compiled with the + // -DSQLITE_ENABLE_OFFSET_SQL_FUNC option. +__69: // The VDBE cursor + ; + pC = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + pOut = ((*Vdbe)(unsafe.Pointer(p)).FaMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + if !((pC == uintptr(0)) || (int32((*VdbeCursor)(unsafe.Pointer(pC)).FeCurType) != CURTYPE_BTREE)) { + goto __343 + } + Xsqlite3VdbeMemSetNull(tls, pOut) + goto __344 +__343: + Xsqlite3VdbeMemSetInt64(tls, pOut, Xsqlite3BtreeOffset(tls, *(*uintptr)(unsafe.Pointer(pC + 56 /* &.uc */)))) +__344: + ; + goto __8 + + // Opcode: Column P1 P2 P3 P4 P5 + // Synopsis: r[P3]=PX + // + // Interpret the data that cursor P1 points to as a structure built using + // the MakeRecord instruction. (See the MakeRecord opcode for additional + // information about the format of the data.) Extract the P2-th column + // from this record. If there are less that (P2+1) + // values in the record, extract a NULL. + // + // The value extracted is stored in register P3. + // + // If the record contains fewer than P2 fields, then extract a NULL. Or, + // if the P4 argument is a P4_MEM use the value of the P4 argument as + // the result. + // + // If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 then + // the result is guaranteed to only be used as the argument of a length() + // or typeof() function, respectively. The loading of large blobs can be + // skipped for length() and all content loading can be skipped for typeof(). +__70: // PseudoTable input register + + ; + *(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + *(*U32)(unsafe.Pointer(bp + 208 /* p22 */)) = U32((*Op)(unsafe.Pointer(pOp)).Fp2) + + // If the cursor cache is stale (meaning it is not currently point at + // the correct row) then bring it up-to-date by doing the necessary + // B-Tree seek. + rc = Xsqlite3VdbeCursorMoveto(tls, bp+200 /* &pC1 */, bp+208 /* &p22 */) + if !(rc != 0) { + goto __345 + } + goto abort_due_to_error +__345: + ; + + pDest = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + aOffset = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaOffset + + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FcacheStatus != (*Vdbe)(unsafe.Pointer(p)).FcacheCtr) { + goto __346 + } //OPTIMIZATION-IF-FALSE + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnullRow != 0) { + goto __347 + } + if !(int32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FeCurType) == CURTYPE_PSEUDO) { + goto __349 + } + // For the special case of as pseudo-cursor, the seekResult field + // identifies the register that holds the record + + pReg = (aMem + uintptr((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FseekResult)*56) + + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize = libc.AssignPtrUint32(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */))+116 /* &.szRow */, U32((*Mem)(unsafe.Pointer(pReg)).Fn)) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow = (*Mem)(unsafe.Pointer(pReg)).Fz + goto __350 +__349: + Xsqlite3VdbeMemSetNull(tls, pDest) + goto op_column_out +__350: + ; + goto __348 +__347: + pCrsr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 56 /* &.uc */)) + + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize = Xsqlite3BtreePayloadSize(tls, pCrsr) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow = Xsqlite3BtreePayloadFetch(tls, pCrsr, (*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 116 /* &.szRow */)) + + // Maximum page size is 64KiB + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize > U32(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))))) { + goto __351 + } + goto too_big +__351: + ; +__348: + ; + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FcacheStatus = (*Vdbe)(unsafe.Pointer(p)).FcacheCtr + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset = U32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow))) < int32(U8(0x80)) { + return uint8(func() int32 { + (*(*U32)(unsafe.Pointer(aOffset))) = U32(*(*U8)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow))) + return 1 + }()) + } + return Xsqlite3GetVarint32(tls, (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow, (aOffset)) + }()) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed = U16(0) + + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FszRow < *(*U32)(unsafe.Pointer(aOffset))) { + goto __352 + } //OPTIMIZATION-IF-FALSE + // pC->aRow does not have to hold the entire row, but it does at least + // need to cover the header of the record. If pC->aRow does not contain + // the complete header, then set it to zero, forcing the header to be + // dynamically allocated. + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow = uintptr(0) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FszRow = U32(0) + + // Make sure a corrupt database has not given us an oversize header. + // Do this now to avoid an oversize memory allocation. + // + // Type entries can be between 1 and 5 bytes each. But 4 and 5 byte + // types use so much data space that there can only be 4096 and 32 of + // them, respectively. So the maximum header length results from a + // 3-byte type for each of the maximum of 32768 columns plus three + // extra bytes for the header length itself. 32768*3 + 3 = 98307. + if !((*(*U32)(unsafe.Pointer(aOffset)) > U32(98307)) || (*(*U32)(unsafe.Pointer(aOffset)) > (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize)) { + goto __354 + } + goto op_column_corrupt +__354: + ; + goto __353 +__352: + // This is an optimization. By skipping over the first few tests + // (ex: pC->nHdrParsed<=p2) in the next section, we achieve a + // measurable performance gain. + // + // This branch is taken even if aOffset[0]==0. Such a record is never + // generated by SQLite, and could be considered corruption, but we + // accept it for historical reasons. When aOffset[0]==0, the code this + // branch jumps to reads past the end of the record, but never more + // than a few bytes. Even if the record occurs at the end of the page + // content area, the "page header" comes after the page content and so + // this overread is harmless. Similar overreads can occur for a corrupt + // database file. + zData = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow + // Conditional skipped + + goto op_column_read_header +__353: + ; +__346: + ; + + // Make sure at least the first p2+1 entries of the header have been + // parsed and valid information is in aOffset[] and pC->aType[]. + if !(U32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed) <= *(*U32)(unsafe.Pointer(bp + 208 /* p22 */))) { + goto __355 + } + // If there is more header available for parsing in the record, try + // to extract additional fields up through the p2+1-th field + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset < *(*U32)(unsafe.Pointer(aOffset))) { + goto __357 + } + // Make sure zData points to enough of the record to cover the header. + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow == uintptr(0)) { + goto __359 + } + libc.Xmemset(tls, bp+216 /* &sMem */, 0, uint64(unsafe.Sizeof(Mem{}))) + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 56 /* &.uc */)), *(*U32)(unsafe.Pointer(aOffset)), bp+216 /* &sMem */) + if !(rc != SQLITE_OK) { + goto __361 + } + goto abort_due_to_error +__361: + ; + zData = (*Mem)(unsafe.Pointer(bp + 216 /* &sMem */)).Fz + goto __360 +__359: + zData = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow +__360: + ; + + // Fill in pC->aType[i] and aOffset[i] values through the p2-th field. +op_column_read_header: + i2 = int32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed) + offset64 = U64(*(*U32)(unsafe.Pointer(aOffset + uintptr(i2)*4))) + zHdr = (zData + uintptr((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset)) + zEndHdr = (zData + uintptr(*(*U32)(unsafe.Pointer(aOffset)))) + +__362: + if !((libc.AssignPtrUint32((*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */))+120 /* &.aType */)+uintptr(i2)*4, libc.AssignPtrUint32(bp+272 /* t */, U32(*(*U8)(unsafe.Pointer(zHdr)))))) < U32(0x80)) { + goto __365 + } + zHdr++ + offset64 = offset64 + (U64(Xsqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*U32)(unsafe.Pointer(bp + 272 /* t */)))))) + goto __366 +__365: + zHdr += uintptr(Xsqlite3GetVarint32(tls, zHdr, bp+272 /* &t */)) + *(*U32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 120 /* &.aType */) + uintptr(i2)*4)) = *(*U32)(unsafe.Pointer(bp + 272 /* t */)) + offset64 = offset64 + (U64(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 272 /* t */))))) +__366: + ; + *(*U32)(unsafe.Pointer(aOffset + uintptr(libc.PreIncInt32(&i2, 1))*4)) = (U32(offset64 & uint64(0xffffffff))) + goto __363 +__363: + if (U32(i2) <= *(*U32)(unsafe.Pointer(bp + 208 /* p22 */))) && (zHdr < zEndHdr) { + goto __362 + } + goto __364 +__364: + ; + + // The record is corrupt if any of the following are true: + // (1) the bytes of the header extend past the declared header size + // (2) the entire header was used but not all data was used + // (3) the end of the data extends beyond the end of the record. + if !(((zHdr >= zEndHdr) && ((zHdr > zEndHdr) || (offset64 != U64((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize)))) || + (offset64 > U64((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize))) { + goto __367 + } + if !(*(*U32)(unsafe.Pointer(aOffset)) == U32(0)) { + goto __368 + } + i2 = 0 + zHdr = zEndHdr + goto __369 +__368: + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow == uintptr(0)) { + goto __370 + } + Xsqlite3VdbeMemRelease(tls, bp+216 /* &sMem */) +__370: + ; + goto op_column_corrupt +__369: + ; +__367: + ; + + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed = U16(i2) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset = (U32((int64(zHdr) - int64(zData)) / 1)) + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow == uintptr(0)) { + goto __371 + } + Xsqlite3VdbeMemRelease(tls, bp+216 /* &sMem */) +__371: + ; + goto __358 +__357: + *(*U32)(unsafe.Pointer(bp + 272 /* t */)) = U32(0) +__358: + ; + + // If after trying to extract new entries from the header, nHdrParsed is + // still not up to p2, that means that the record has fewer than p2 + // columns. So the result will be either the default value or a NULL. + if !(U32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed) <= *(*U32)(unsafe.Pointer(bp + 208 /* p22 */))) { + goto __372 + } + if !(int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-11)) { + goto __373 + } + Xsqlite3VdbeMemShallowCopy(tls, pDest, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)), MEM_Static) + goto __374 +__373: + Xsqlite3VdbeMemSetNull(tls, pDest) +__374: + ; + goto op_column_out +__372: + ; + goto __356 +__355: + *(*U32)(unsafe.Pointer(bp + 272 /* t */)) = *(*U32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 120 /* &.aType */) + uintptr(*(*U32)(unsafe.Pointer(bp + 208 /* p22 */)))*4)) +__356: + ; + + // Extract the content for the p2+1-th column. Control can only + // reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are + // all valid. + + if !((int32((*Mem)(unsafe.Pointer((pDest))).Fflags) & (MEM_Agg | MEM_Dyn)) != 0) { + goto __375 + } + Xsqlite3VdbeMemSetNull(tls, pDest) +__375: + ; + + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FszRow >= *(*U32)(unsafe.Pointer(aOffset + uintptr((*(*U32)(unsafe.Pointer(bp + 208 /* p22 */))+U32(1)))*4))) { + goto __376 + } + // This is the common case where the desired content fits on the original + // page - where the content is not on an overflow page + zData = ((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow + uintptr(*(*U32)(unsafe.Pointer(aOffset + uintptr(*(*U32)(unsafe.Pointer(bp + 208 /* p22 */)))*4)))) + if !(*(*U32)(unsafe.Pointer(bp + 272 /* t */)) < U32(12)) { + goto __378 + } + Xsqlite3VdbeSerialGet(tls, zData, *(*U32)(unsafe.Pointer(bp + 272 /* t */)), pDest) + goto __379 +__378: + (*Mem)(unsafe.Pointer(pDest)).Fn = libc.AssignInt32(&len, (int32((*(*U32)(unsafe.Pointer(bp + 272 /* t */)) - U32(12)) / U32(2)))) + (*Mem)(unsafe.Pointer(pDest)).Fenc = encoding + if !((*Mem)(unsafe.Pointer(pDest)).FszMalloc < (len + 2)) { + goto __380 + } + (*Mem)(unsafe.Pointer(pDest)).Fflags = U16(MEM_Null) + if !(Xsqlite3VdbeMemGrow(tls, pDest, (len+2), 0) != 0) { + goto __382 + } + goto no_mem +__382: + ; + goto __381 +__380: + (*Mem)(unsafe.Pointer(pDest)).Fz = (*Mem)(unsafe.Pointer(pDest)).FzMalloc +__381: + ; + libc.Xmemcpy(tls, (*Mem)(unsafe.Pointer(pDest)).Fz, zData, uint64(len)) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pDest)).Fz + uintptr(len))) = int8(0) + *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pDest)).Fz + uintptr((len + 1)))) = int8(0) + (*Mem)(unsafe.Pointer(pDest)).Fflags = aFlag1[(*(*U32)(unsafe.Pointer(bp + 272 /* t */)) & U32(1))] +__379: + ; + goto __377 +__376: + (*Mem)(unsafe.Pointer(pDest)).Fenc = encoding + // This branch happens only when content is on overflow pages + if !((((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & (OPFLAG_LENGTHARG | OPFLAG_TYPEOFARG)) != 0) && + (((*(*U32)(unsafe.Pointer(bp + 272 /* t */)) >= U32(12)) && ((*(*U32)(unsafe.Pointer(bp + 272 /* t */)) & U32(1)) == U32(0))) || ((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_TYPEOFARG) != 0))) || + ((libc.AssignInt32(&len, int32(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 272 /* t */)))))) == 0)) { + goto __383 + } + // Content is irrelevant for + // 1. the typeof() function, + // 2. the length(X) function if X is a blob, and + // 3. if the content length is zero. + // So we might as well use bogus content rather than reading + // content from disk. + // + // Although sqlite3VdbeSerialGet() may read at most 8 bytes from the + // buffer passed to it, debugging function VdbeMemPrettyPrint() may + // read more. Use the global constant sqlite3CtypeMap[] as the array, + // as that array is 256 bytes long (plenty for VdbeMemPrettyPrint()) + // and it begins with a bunch of zeros. + Xsqlite3VdbeSerialGet(tls, uintptr(uintptr(unsafe.Pointer(&Xsqlite3CtypeMap))), *(*U32)(unsafe.Pointer(bp + 272 /* t */)), pDest) + goto __384 +__383: + rc = Xsqlite3VdbeMemFromBtree(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 56 /* &.uc */)), *(*U32)(unsafe.Pointer(aOffset + uintptr(*(*U32)(unsafe.Pointer(bp + 208 /* p22 */)))*4)), uint32(len), pDest) + if !(rc != SQLITE_OK) { + goto __385 + } + goto abort_due_to_error +__385: + ; + Xsqlite3VdbeSerialGet(tls, (*Mem)(unsafe.Pointer(pDest)).Fz, *(*U32)(unsafe.Pointer(bp + 272 /* t */)), pDest) + *(*U16)(unsafe.Pointer(pDest + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Ephem))) +__384: + ; +__377: + ; + +op_column_out: + ; + + goto __8 + +op_column_corrupt: + if !((*Op)(unsafe.Pointer(aOp)).Fp3 > 0) { + goto __386 + } + pOp = (aOp + uintptr(((*Op)(unsafe.Pointer(aOp)).Fp3-1))*24) + goto __8 + goto __387 +__386: + rc = Xsqlite3CorruptError(tls, 89368) + goto abort_due_to_error +__387: + ; + + // Opcode: Affinity P1 P2 * P4 * + // Synopsis: affinity(r[P1@P2]) + // + // Apply affinities to a range of P2 registers starting with P1. + // + // P4 is a string that is P2 characters long. The N-th character of the + // string indicates the column affinity that should be used for the N-th + // memory cell in the range. +__71: // The affinity to be applied + + zAffinity = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) +__388: + if !(1 != 0) { + goto __389 + } + + applyAffinity(tls, pIn1, *(*int8)(unsafe.Pointer(zAffinity)), encoding) + if !((int32(*(*int8)(unsafe.Pointer(zAffinity))) == SQLITE_AFF_REAL) && ((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Int) != 0)) { + goto __390 + } + // When applying REAL affinity, if the result is still an MEM_Int + // that will fit in 6 bytes, then change the type to MEM_IntReal + // so that we keep the high-resolution integer value but know that + // the type really wants to be REAL. + + if !((*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) <= 140737488355327) && (*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) >= -140737488355328)) { + goto __391 + } + *(*U16)(unsafe.Pointer(pIn1 + 8 /* &.flags */)) |= U16((MEM_IntReal)) + *(*U16)(unsafe.Pointer(pIn1 + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Int))) + goto __392 +__391: + *(*float64)(unsafe.Pointer(pIn1 /* &.u */)) = float64(*(*I64)(unsafe.Pointer(pIn1 /* &.u */))) + *(*U16)(unsafe.Pointer(pIn1 + 8 /* &.flags */)) |= U16((MEM_Real)) + *(*U16)(unsafe.Pointer(pIn1 + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Int))) +__392: + ; +__390: + ; + + zAffinity++ + if !(int32(*(*int8)(unsafe.Pointer(zAffinity))) == 0) { + goto __393 + } + goto __389 +__393: + ; + pIn1 += 56 + goto __388 +__389: + ; + goto __8 + + // Opcode: MakeRecord P1 P2 P3 P4 * + // Synopsis: r[P3]=mkrec(r[P1@P2]) + // + // Convert P2 registers beginning with P1 into the [record format] + // use as a data record in a database table or as a key + // in an index. The OP_Column opcode can decode the record later. + // + // P4 may be a string that is P2 characters long. The N-th character of the + // string indicates the column affinity that should be used for the N-th + // field of the index key. + // + // The mapping from character to affinity is given by the SQLITE_AFF_ + // macros defined in sqliteInt.h. + // + // If P4 is NULL then all index fields have the affinity BLOB. + // + // The meaning of P5 depends on whether or not the SQLITE_ENABLE_NULL_TRIM + // compile-time option is enabled: + // + // * If SQLITE_ENABLE_NULL_TRIM is enabled, then the P5 is the index + // of the right-most table that can be null-trimmed. + // + // * If SQLITE_ENABLE_NULL_TRIM is omitted, then P5 has the value + // OPFLAG_NOCHNG_MAGIC if the OP_MakeRecord opcode is allowed to + // accept no-change records with serial_type 10. This value is + // only used inside an assert() and does not affect the end result. +__72: // Where to write next byte of the payload + + // Assuming the record contains N fields, the record format looks + // like this: + // + // ------------------------------------------------------------------------ + // | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | + // ------------------------------------------------------------------------ + // + // Data(0) is taken from register P1. Data(1) comes from register P1+1 + // and so forth. + // + // Each type field is a varint representing the serial type of the + // corresponding data element (see sqlite3VdbeSerialType()). The + // hdr-size field is also a varint which is the offset from the beginning + // of the record to data0. + nData = uint64(0) // Number of bytes of data space + nHdr = 0 // Number of bytes of header space + nZero = int64(0) // Number of zero bytes at the end of the record + nField = (*Op)(unsafe.Pointer(pOp)).Fp1 + zAffinity1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + pData0 = (aMem + uintptr(nField)*56) + nField = (*Op)(unsafe.Pointer(pOp)).Fp2 + pLast = (pData0 + uintptr((nField-1))*56) + file_format = int32((*Vdbe)(unsafe.Pointer(p)).FminWriteFileFormat) + + // Identify the output register + + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + // Apply the requested affinity to all inputs + + if !(zAffinity1 != 0) { + goto __394 + } + pRec = pData0 +__395: + applyAffinity(tls, pRec, *(*int8)(unsafe.Pointer(zAffinity1)), encoding) + if !((int32(*(*int8)(unsafe.Pointer(zAffinity1))) == SQLITE_AFF_REAL) && ((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Int) != 0)) { + goto __398 + } + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) |= U16((MEM_IntReal)) + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Int))) +__398: + ; + + zAffinity1++ + pRec += 56 + + goto __396 +__396: + if *(*int8)(unsafe.Pointer(zAffinity1)) != 0 { + goto __395 + } + goto __397 +__397: + ; +__394: + ; + + // Loop through the elements that will make up the record to figure + // out how much space is required for the new record. After this loop, + // the Mem.uTemp field of each term should hold the serial-type that will + // be used for that term in the generated record: + // + // Mem.uTemp value type + // --------------- --------------- + // 0 NULL + // 1 1-byte signed integer + // 2 2-byte signed integer + // 3 3-byte signed integer + // 4 4-byte signed integer + // 5 6-byte signed integer + // 6 8-byte signed integer + // 7 IEEE float + // 8 Integer constant 0 + // 9 Integer constant 1 + // 10,11 reserved for expansion + // N>=12 and even BLOB + // N>=13 and odd text + // + // The following additional values are computed: + // nHdr Number of bytes needed for the record header + // nData Number of bytes of data space needed for the record + // nZero Zero bytes at the end of the record + pRec = pLast +__399: + ; + if !((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Null) != 0) { + goto __402 + } + if !((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Zero) != 0) { + goto __404 + } + // Values with MEM_Null and MEM_Zero are created by xColumn virtual + // table methods that never invoke sqlite3_result_xxxxx() while + // computing an unchanging column value in an UPDATE statement. + // Give such values a special internal-use-only serial-type of 10 + // so that they can be passed through to xUpdate and have + // a true sqlite3_value_nochange(). + + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(10) + goto __405 +__404: + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(0) +__405: + ; + nHdr++ + goto __403 +__402: + if !((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & (MEM_Int | MEM_IntReal)) != 0) { + goto __406 + } + // Figure out whether to use 1, 2, 4, 6 or 8 bytes. + i3 = *(*I64)(unsafe.Pointer(pRec /* &.u */)) + + if !(i3 < int64(0)) { + goto __408 + } + uu = U64(^i3) + goto __409 +__408: + uu = U64(i3) +__409: + ; + nHdr++ + + if !(uu <= uint64(127)) { + goto __410 + } + if !(((i3 & int64(1)) == i3) && (file_format >= 4)) { + goto __412 + } + (*Mem)(unsafe.Pointer(pRec)).FuTemp = (U32(8) + U32(uu)) + goto __413 +__412: + nData++ + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(1) +__413: + ; + goto __411 +__410: + if !(uu <= uint64(32767)) { + goto __414 + } + nData = nData + (uint64(2)) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(2) + goto __415 +__414: + if !(uu <= uint64(8388607)) { + goto __416 + } + nData = nData + (uint64(3)) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(3) + goto __417 +__416: + if !(uu <= uint64(2147483647)) { + goto __418 + } + nData = nData + (uint64(4)) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(4) + goto __419 +__418: + if !(uu <= uint64(140737488355327)) { + goto __420 + } + nData = nData + (uint64(6)) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(5) + goto __421 +__420: + nData = nData + (uint64(8)) + if !((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_IntReal) != 0) { + goto __422 + } + // If the value is IntReal and is going to take up 8 bytes to store + // as an integer, then we might as well make it an 8-byte floating + // point value + *(*float64)(unsafe.Pointer(pRec /* &.u */)) = float64(*(*I64)(unsafe.Pointer(pRec /* &.u */))) + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_IntReal))) + *(*U16)(unsafe.Pointer(pRec + 8 /* &.flags */)) |= U16((MEM_Real)) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(7) + goto __423 +__422: + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(6) +__423: + ; +__421: + ; +__419: + ; +__417: + ; +__415: + ; +__411: + ; + goto __407 +__406: + if !((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Real) != 0) { + goto __424 + } + nHdr++ + nData = nData + (uint64(8)) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = U32(7) + goto __425 +__424: + ; + + len1 = U32((*Mem)(unsafe.Pointer(pRec)).Fn) + serial_type = (((len1 * U32(2)) + U32(12)) + (U32(libc.Bool32((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Str) != 0)))) + if !((int32((*Mem)(unsafe.Pointer(pRec)).Fflags) & MEM_Zero) != 0) { + goto __426 + } + serial_type = serial_type + (U32(*(*int32)(unsafe.Pointer(pRec /* &.u */)) * 2)) + if !(nData != 0) { + goto __427 + } + if !(Xsqlite3VdbeMemExpandBlob(tls, pRec) != 0) { + goto __429 + } + goto no_mem +__429: + ; + len1 = len1 + (U32(*(*int32)(unsafe.Pointer(pRec /* &.u */)))) + goto __428 +__427: + nZero = nZero + (I64(*(*int32)(unsafe.Pointer(pRec /* &.u */)))) +__428: + ; +__426: + ; + nData = nData + (U64(len1)) + nHdr = nHdr + (Xsqlite3VarintLen(tls, uint64(serial_type))) + (*Mem)(unsafe.Pointer(pRec)).FuTemp = serial_type +__425: + ; +__407: + ; +__403: + ; + if !(pRec == pData0) { + goto __430 + } + goto __401 +__430: + ; + pRec -= 56 + goto __400 +__400: + if 1 != 0 { + goto __399 + } + goto __401 +__401: + ; + + // EVIDENCE-OF: R-22564-11647 The header begins with a single varint + // which determines the total number of bytes in the header. The varint + // value is the size of the header in bytes including the size varint + // itself. + + if !(nHdr <= 126) { + goto __431 + } + // The common case + nHdr = nHdr + (1) + goto __432 +__431: + // Rare case of a really large header + nVarint = Xsqlite3VarintLen(tls, uint64(nHdr)) + nHdr = nHdr + (nVarint) + if !(nVarint < Xsqlite3VarintLen(tls, uint64(nHdr))) { + goto __433 + } + nHdr++ +__433: + ; +__432: + ; + nByte1 = (I64(U64(nHdr) + nData)) + + // Make sure the output register has a buffer large enough to store + // the new record. The output register (pOp->p3) is not allowed to + // be one of the input registers (because the following call to + // sqlite3VdbeMemClearAndResize() could clobber the value before it is used). + if !((nByte1 + nZero) <= I64((*Mem)(unsafe.Pointer(pOut)).FszMalloc)) { + goto __434 + } + // The output register is already large enough to hold the record. + // No error checks or buffer enlargement is required + (*Mem)(unsafe.Pointer(pOut)).Fz = (*Mem)(unsafe.Pointer(pOut)).FzMalloc + goto __435 +__434: + // Need to make sure that the output is not too big and then enlarge + // the output register to hold the full result + if !((nByte1 + nZero) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))))) { + goto __436 + } + goto too_big +__436: + ; + if !(Xsqlite3VdbeMemClearAndResize(tls, pOut, int32(nByte1)) != 0) { + goto __437 + } + goto no_mem +__437: + ; +__435: + ; + (*Mem)(unsafe.Pointer(pOut)).Fn = int32(nByte1) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Blob) + if !(nZero != 0) { + goto __438 + } + *(*int32)(unsafe.Pointer(pOut /* &.u */)) = int32(nZero) + *(*U16)(unsafe.Pointer(pOut + 8 /* &.flags */)) |= U16((MEM_Zero)) +__438: + ; + + zHdr1 = (*Mem)(unsafe.Pointer(pOut)).Fz + zPayload = (zHdr1 + uintptr(nHdr)) + + // Write the record + zHdr1 += uintptr(func() uint8 { + if (U32(nHdr)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(zHdr1)) = uint8(nHdr); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, zHdr1, uint64(nHdr))) + }()) + + pRec = pData0 +__439: + serial_type = (*Mem)(unsafe.Pointer(pRec)).FuTemp + // EVIDENCE-OF: R-06529-47362 Following the size varint are one or more + // additional varints, one per column. + zHdr1 += uintptr(func() uint8 { + if (serial_type) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(zHdr1)) = uint8(serial_type); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, zHdr1, uint64(serial_type))) + }()) // serial type + // EVIDENCE-OF: R-64536-51728 The values for each column in the record + // immediately follow the header. + zPayload += uintptr(Xsqlite3VdbeSerialPut(tls, zPayload, pRec, serial_type)) // content + goto __440 +__440: + if (libc.PreIncUintptr(&pRec, 56)) <= pLast { + goto __439 + } + goto __441 +__441: + ; + + goto __8 + + // Opcode: Count P1 P2 p3 * * + // Synopsis: r[P2]=count() + // + // Store the number of entries (an integer value) in the table or index + // opened by cursor P1 in register P2. + // + // If P3==0, then an exact count is obtained, which involves visiting + // every btree page of the table. But if P3 is non-zero, an estimate + // is returned based on the current cursor position. +__73: + ; + pCrsr1 = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + 56 /* &.uc */)) + + if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { + goto __442 + } + *(*I64)(unsafe.Pointer(bp + 280 /* nEntry */)) = Xsqlite3BtreeRowCountEst(tls, pCrsr1) + goto __443 +__442: + *(*I64)(unsafe.Pointer(bp + 280 /* nEntry */)) = int64(0) // Not needed. Only used to silence a warning. + rc = Xsqlite3BtreeCount(tls, db, pCrsr1, bp+280 /* &nEntry */) + if !(rc != 0) { + goto __444 + } + goto abort_due_to_error +__444: + ; +__443: + ; + pOut = out2Prerelease(tls, p, pOp) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 280 /* nEntry */)) + goto check_for_interrupt + + // Opcode: Savepoint P1 * * P4 * + // + // Open, release or rollback the savepoint named by parameter P4, depending + // on the value of P1. To open a new savepoint set P1==0 (SAVEPOINT_BEGIN). + // To release (commit) an existing savepoint set P1==1 (SAVEPOINT_RELEASE). + // To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK). +__74: + + p12 = (*Op)(unsafe.Pointer(pOp)).Fp1 + zName = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + // Assert that the p1 parameter is valid. Also that if there is no open + // transaction, then there cannot be any savepoints. + + if !(p12 == SAVEPOINT_BEGIN) { + goto __445 + } + if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0) { + goto __447 + } + // A new savepoint cannot be created if there are active write + // statements (i.e. open read/write incremental blob handles). + Xsqlite3VdbeError(tls, p, ts+4598 /* "cannot open save..." */, 0) + rc = SQLITE_BUSY + goto __448 +__447: + nName = Xsqlite3Strlen30(tls, zName) + + // This call is Ok even if this savepoint is actually a transaction + // savepoint (and therefore should not prompt xSavepoint()) callbacks. + // If this is a transaction savepoint being opened, it is guaranteed + // that the db->aVTrans[] array is empty. + + rc = Xsqlite3VtabSavepoint(tls, db, SAVEPOINT_BEGIN, + ((*Sqlite3)(unsafe.Pointer(db)).FnStatement + (*Sqlite3)(unsafe.Pointer(db)).FnSavepoint)) + if !(rc != SQLITE_OK) { + goto __449 + } + goto abort_due_to_error +__449: + ; + + // Create a new savepoint structure. + pNew = Xsqlite3DbMallocRawNN(tls, db, (uint64((uint64(unsafe.Sizeof(Savepoint{})) + uint64(nName)) + uint64(1)))) + if !(pNew != 0) { + goto __450 + } + (*Savepoint)(unsafe.Pointer(pNew)).FzName = (pNew + 1*32) + libc.Xmemcpy(tls, (*Savepoint)(unsafe.Pointer(pNew)).FzName, zName, (uint64(nName + 1))) + + // If there is no open transaction, then mark this as a special + // "transaction savepoint". + if !((*Sqlite3)(unsafe.Pointer(db)).FautoCommit != 0) { + goto __451 + } + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(0) + (*Sqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint = U8(1) + goto __452 +__451: + (*Sqlite3)(unsafe.Pointer(db)).FnSavepoint++ +__452: + ; + + // Link the new savepoint into the database handle's list. + (*Savepoint)(unsafe.Pointer(pNew)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint + (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint = pNew + (*Savepoint)(unsafe.Pointer(pNew)).FnDeferredCons = (*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons + (*Savepoint)(unsafe.Pointer(pNew)).FnDeferredImmCons = (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons +__450: + ; +__448: + ; + goto __446 +__445: + ; + iSavepoint = 0 + + // Find the named savepoint. If there is no such savepoint, then an + // an error is returned to the user. + pSavepoint = (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint +__453: + if !((pSavepoint != 0) && (Xsqlite3StrICmp(tls, (*Savepoint)(unsafe.Pointer(pSavepoint)).FzName, zName) != 0)) { + goto __455 + } + iSavepoint++ + goto __454 +__454: + pSavepoint = (*Savepoint)(unsafe.Pointer(pSavepoint)).FpNext + goto __453 + goto __455 +__455: + ; + if !(!(pSavepoint != 0)) { + goto __456 + } + Xsqlite3VdbeError(tls, p, ts+4649 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + rc = SQLITE_ERROR + goto __457 +__456: + if !(((*Sqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0) && (p12 == SAVEPOINT_RELEASE)) { + goto __458 + } + // It is not possible to release (commit) a savepoint if there are + // active write statements. + Xsqlite3VdbeError(tls, p, + ts+4671 /* "cannot release s..." */, 0) + rc = SQLITE_BUSY + goto __459 +__458: + + // Determine whether or not this is a transaction savepoint. If so, + // and this is a RELEASE command, then the current transaction + // is committed. + isTransaction = (libc.Bool32(((*Savepoint)(unsafe.Pointer(pSavepoint)).FpNext == uintptr(0)) && ((*Sqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint != 0))) + if !((isTransaction != 0) && (p12 == SAVEPOINT_RELEASE)) { + goto __460 + } + if !((libc.AssignInt32(&rc, Xsqlite3VdbeCheckFk(tls, p, 1))) != SQLITE_OK) { + goto __462 + } + goto vdbe_return +__462: + ; + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + if !(Xsqlite3VdbeHalt(tls, p) == SQLITE_BUSY) { + goto __463 + } + (*Vdbe)(unsafe.Pointer(p)).Fpc = (int32((int64(pOp) - int64(aOp)) / 24)) + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(0) + (*Vdbe)(unsafe.Pointer(p)).Frc = libc.AssignInt32(&rc, SQLITE_BUSY) + goto vdbe_return +__463: + ; + rc = (*Vdbe)(unsafe.Pointer(p)).Frc + if !(rc != 0) { + goto __464 + } + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(0) + goto __465 +__464: + (*Sqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint = U8(0) +__465: + ; + goto __461 +__460: + iSavepoint = (((*Sqlite3)(unsafe.Pointer(db)).FnSavepoint - iSavepoint) - 1) + if !(p12 == SAVEPOINT_ROLLBACK) { + goto __466 + } + isSchemaChange = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_SchemaChange)) != U32(0))) + ii = 0 +__468: + if !(ii < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __470 + } + rc = Xsqlite3BtreeTripAllCursors(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii)*32)).FpBt, + (SQLITE_ABORT | (int32(2) << 8)), + (libc.Bool32(isSchemaChange == 0))) + if !(rc != SQLITE_OK) { + goto __471 + } + goto abort_due_to_error +__471: + ; + goto __469 +__469: + ii++ + goto __468 + goto __470 +__470: + ; + goto __467 +__466: + ; + isSchemaChange = 0 +__467: + ; + ii = 0 +__472: + if !(ii < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __474 + } + rc = Xsqlite3BtreeSavepoint(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii)*32)).FpBt, p12, iSavepoint) + if !(rc != SQLITE_OK) { + goto __475 + } + goto abort_due_to_error +__475: + ; + goto __473 +__473: + ii++ + goto __472 + goto __474 +__474: + ; + if !(isSchemaChange != 0) { + goto __476 + } + Xsqlite3ExpirePreparedStatements(tls, db, 0) + Xsqlite3ResetAllSchemasOfConnection(tls, db) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) +__476: + ; +__461: + ; + if !(rc != 0) { + goto __477 + } + goto abort_due_to_error +__477: + ; + + // Regardless of whether this is a RELEASE or ROLLBACK, destroy all + // savepoints nested inside of the savepoint being operated on. +__478: + if !((*Sqlite3)(unsafe.Pointer(db)).FpSavepoint != pSavepoint) { + goto __479 + } + pTmp = (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint + (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint = (*Savepoint)(unsafe.Pointer(pTmp)).FpNext + Xsqlite3DbFree(tls, db, pTmp) + (*Sqlite3)(unsafe.Pointer(db)).FnSavepoint-- + goto __478 +__479: + ; + + // If it is a RELEASE, then destroy the savepoint being operated on + // too. If it is a ROLLBACK TO, then set the number of deferred + // constraint violations present in the database to the value stored + // when the savepoint was created. + if !(p12 == SAVEPOINT_RELEASE) { + goto __480 + } + + (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint = (*Savepoint)(unsafe.Pointer(pSavepoint)).FpNext + Xsqlite3DbFree(tls, db, pSavepoint) + if !(!(isTransaction != 0)) { + goto __482 + } + (*Sqlite3)(unsafe.Pointer(db)).FnSavepoint-- +__482: + ; + goto __481 +__480: + ; + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons = (*Savepoint)(unsafe.Pointer(pSavepoint)).FnDeferredCons + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = (*Savepoint)(unsafe.Pointer(pSavepoint)).FnDeferredImmCons +__481: + ; + + if !(!(isTransaction != 0) || (p12 == SAVEPOINT_ROLLBACK)) { + goto __483 + } + rc = Xsqlite3VtabSavepoint(tls, db, p12, iSavepoint) + if !(rc != SQLITE_OK) { + goto __484 + } + goto abort_due_to_error +__484: + ; +__483: + ; +__459: + ; +__457: + ; +__446: + ; + if !(rc != 0) { + goto __485 + } + goto abort_due_to_error +__485: + ; + + goto __8 + + // Opcode: AutoCommit P1 P2 * * * + // + // Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll + // back any currently active btree transactions. If there are any active + // VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if + // there are active writing VMs or active VMs that use shared cache. + // + // This instruction causes the VM to halt. +__75: + + desiredAutoCommit = (*Op)(unsafe.Pointer(pOp)).Fp1 + iRollback = (*Op)(unsafe.Pointer(pOp)).Fp2 + + // At least this one VM is active + + if !(desiredAutoCommit != int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit)) { + goto __486 + } + if !(iRollback != 0) { + goto __488 + } + + Xsqlite3RollbackAll(tls, db, (SQLITE_ABORT | (int32(2) << 8))) + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + goto __489 +__488: + if !((desiredAutoCommit != 0) && ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeWrite > 0)) { + goto __490 + } + // If this instruction implements a COMMIT and other VMs are writing + // return an error indicating that the other VMs must complete first. + Xsqlite3VdbeError(tls, p, + ts+4725 /* "cannot commit tr..." */, 0) + rc = SQLITE_BUSY + goto abort_due_to_error + goto __491 +__490: + if !((libc.AssignInt32(&rc, Xsqlite3VdbeCheckFk(tls, p, 1))) != SQLITE_OK) { + goto __492 + } + goto vdbe_return + goto __493 +__492: + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(desiredAutoCommit) +__493: + ; +__491: + ; +__489: + ; + if !(Xsqlite3VdbeHalt(tls, p) == SQLITE_BUSY) { + goto __494 + } + (*Vdbe)(unsafe.Pointer(p)).Fpc = (int32((int64(pOp) - int64(aOp)) / 24)) + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = (U8(1 - desiredAutoCommit)) + (*Vdbe)(unsafe.Pointer(p)).Frc = libc.AssignInt32(&rc, SQLITE_BUSY) + goto vdbe_return +__494: + ; + Xsqlite3CloseSavepoints(tls, db) + if !((*Vdbe)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + goto __495 + } + rc = SQLITE_DONE + goto __496 +__495: + rc = SQLITE_ERROR +__496: + ; + goto vdbe_return + goto __487 +__486: + Xsqlite3VdbeError(tls, p, + func() uintptr { + if !(desiredAutoCommit != 0) { + return ts + 4780 /* "cannot start a t..." */ + } + return func() uintptr { + if iRollback != 0 { + return ts + 4828 /* "cannot rollback ..." */ + } + return ts + 4871 /* "cannot commit - ..." */ + }() + }(), 0) + + rc = SQLITE_ERROR + goto abort_due_to_error +__487: + ; + /*NOTREACHED*/ + + // Opcode: Transaction P1 P2 P3 P4 P5 + // + // Begin a transaction on database P1 if a transaction is not already + // active. + // If P2 is non-zero, then a write-transaction is started, or if a + // read-transaction is already active, it is upgraded to a write-transaction. + // If P2 is zero, then a read-transaction is started. If P2 is 2 or more + // then an exclusive transaction is started. + // + // P1 is the index of the database file on which the transaction is + // started. Index 0 is the main database file and index 1 is the + // file used for temporary tables. Indices of 2 or more are used for + // attached databases. + // + // If a write-transaction is started and the Vdbe.usesStmtJournal flag is + // true (this flag is set if the Vdbe may modify more than one row and may + // throw an ABORT exception), a statement transaction may also be opened. + // More specifically, a statement transaction is opened iff the database + // connection is currently not in autocommit mode, or if there are other + // active statements. A statement transaction allows the changes made by this + // VDBE to be rolled back after an error without having to roll back the + // entire transaction. If no error is encountered, the statement transaction + // will automatically commit when the VDBE halts. + // + // If P5!=0 then this opcode also checks the schema cookie against P3 + // and the schema generation counter against P4. + // The cookie changes its value whenever the database schema changes. + // This operation is used to detect when that the cookie has changed + // and that the current process needs to reread the schema. If the schema + // cookie in P3 differs from the schema cookie in the database header or + // if the schema generation counter in P4 differs from the current + // generation counter, then an SQLITE_SCHEMA error is raised and execution + // halts. The sqlite3_step() wrapper function might then reprepare the + // statement and rerun it from the beginning. +__76: + *(*int32)(unsafe.Pointer(bp + 288 /* iMeta */)) = 0 + + if !(((*Op)(unsafe.Pointer(pOp)).Fp2 != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_QueryOnly)) != uint64(0))) { + goto __497 + } + rc = SQLITE_READONLY + goto abort_due_to_error +__497: + ; + pBt = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpBt + + if !(pBt != 0) { + goto __498 + } + rc = Xsqlite3BtreeBeginTrans(tls, pBt, (*Op)(unsafe.Pointer(pOp)).Fp2, bp+288 /* &iMeta */) + + if !(rc != SQLITE_OK) { + goto __499 + } + if !((rc & 0xff) == SQLITE_BUSY) { + goto __500 + } + (*Vdbe)(unsafe.Pointer(p)).Fpc = (int32((int64(pOp) - int64(aOp)) / 24)) + (*Vdbe)(unsafe.Pointer(p)).Frc = rc + goto vdbe_return +__500: + ; + goto abort_due_to_error +__499: + ; + + if !((((Bft(int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.usesStmtJournal */)) & 0x40 >> 6))) != 0) && + ((*Op)(unsafe.Pointer(pOp)).Fp2 != 0)) && + ((int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) == 0) || ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeRead > 1))) { + goto __501 + } + + if !((*Vdbe)(unsafe.Pointer(p)).FiStatement == 0) { + goto __502 + } + + (*Sqlite3)(unsafe.Pointer(db)).FnStatement++ + (*Vdbe)(unsafe.Pointer(p)).FiStatement = ((*Sqlite3)(unsafe.Pointer(db)).FnSavepoint + (*Sqlite3)(unsafe.Pointer(db)).FnStatement) +__502: + ; + + rc = Xsqlite3VtabSavepoint(tls, db, SAVEPOINT_BEGIN, ((*Vdbe)(unsafe.Pointer(p)).FiStatement - 1)) + if !(rc == SQLITE_OK) { + goto __503 + } + rc = Xsqlite3BtreeBeginStmt(tls, pBt, (*Vdbe)(unsafe.Pointer(p)).FiStatement) +__503: + ; + + // Store the current value of the database handles deferred constraint + // counter. If the statement transaction needs to be rolled back, + // the value of this counter needs to be restored too. + (*Vdbe)(unsafe.Pointer(p)).FnStmtDefCons = (*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons + (*Vdbe)(unsafe.Pointer(p)).FnStmtDefImmCons = (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons +__501: + ; +__498: + ; + + if !(((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) && + ((*(*int32)(unsafe.Pointer(bp + 288 /* iMeta */)) != (*Op)(unsafe.Pointer(pOp)).Fp3) || + ((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpSchema)).FiGeneration != *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))))) { + goto __504 + } + // IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema + // version is checked to ensure that the schema has not changed since the + // SQL statement was prepared. + Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4912 /* "database schema ..." */) + // If the schema-cookie from the database file matches the cookie + // stored with the in-memory representation of the schema, do + // not reload the schema from the database file. + // + // If virtual-tables are in use, this is not just an optimization. + // Often, v-tables store their data in other SQLite tables, which + // are queried from within xNext() and other v-table methods using + // prepared queries. If such a query is out-of-date, we do not want to + // discard the database schema, as the user code implementing the + // v-table would have to be ready for the sqlite3_vtab structure itself + // to be invalidated whenever sqlite3_step() is called from within + // a v-table method. + if !((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpSchema)).Fschema_cookie != *(*int32)(unsafe.Pointer(bp + 288 /* iMeta */))) { + goto __505 + } + Xsqlite3ResetOneSchema(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1) +__505: + ; + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(1), 0, 0x3) + rc = SQLITE_SCHEMA +__504: + ; + if !(rc != 0) { + goto __506 + } + goto abort_due_to_error +__506: + ; + goto __8 + + // Opcode: ReadCookie P1 P2 P3 * * + // + // Read cookie number P3 from database P1 and write it into register P2. + // P3==1 is the schema version. P3==2 is the database format. + // P3==3 is the recommended pager cache size, and so forth. P1==0 is + // the main database file and P1==1 is the database file used to store + // temporary tables. + // + // There must be a read-lock on the database (either a transaction + // must be started or there must be an open cursor) before + // executing this instruction. +__77: + ; + iDb = (*Op)(unsafe.Pointer(pOp)).Fp1 + iCookie = (*Op)(unsafe.Pointer(pOp)).Fp3 + + Xsqlite3BtreeGetMeta(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpBt, iCookie, bp+292 /* &iMeta1 */) + pOut = out2Prerelease(tls, p, pOp) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*int32)(unsafe.Pointer(bp + 292 /* iMeta1 */))) + goto __8 + + // Opcode: SetCookie P1 P2 P3 * P5 + // + // Write the integer value P3 into cookie number P2 of database P1. + // P2==1 is the schema version. P2==2 is the database format. + // P2==3 is the recommended pager cache + // size, and so forth. P1==0 is the main database file and P1==1 is the + // database file used to store temporary tables. + // + // A transaction must be started before executing this opcode. + // + // If P2 is the SCHEMA_VERSION cookie (cookie number 1) then the internal + // schema version is set to P3-P5. The "PRAGMA schema_version=N" statement + // has P5 set to 1, so that the internal schema version will be different + // from the database schema version, resulting in a schema reset. +__78: + ; + + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32) + + // See note about index shifting on OP_ReadCookie + rc = Xsqlite3BtreeUpdateMeta(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (*Op)(unsafe.Pointer(pOp)).Fp2, uint32((*Op)(unsafe.Pointer(pOp)).Fp3)) + if !((*Op)(unsafe.Pointer(pOp)).Fp2 == BTREE_SCHEMA_VERSION) { + goto __507 + } + // When the schema cookie changes, record the new cookie internally + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fschema_cookie = ((*Op)(unsafe.Pointer(pOp)).Fp3 - int32((*Op)(unsafe.Pointer(pOp)).Fp5)) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) + goto __508 +__507: + if !((*Op)(unsafe.Pointer(pOp)).Fp2 == BTREE_FILE_FORMAT) { + goto __509 + } + // Record changes in the file format + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = U8((*Op)(unsafe.Pointer(pOp)).Fp3) +__509: + ; +__508: + ; + if !((*Op)(unsafe.Pointer(pOp)).Fp1 == 1) { + goto __510 + } + // Invalidate all prepared statements whenever the TEMP database + // schema is changed. Ticket #1644 + Xsqlite3ExpirePreparedStatements(tls, db, 0) + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(0), 0, 0x3) +__510: + ; + if !(rc != 0) { + goto __511 + } + goto abort_due_to_error +__511: + ; + goto __8 + + // Opcode: OpenRead P1 P2 P3 P4 P5 + // Synopsis: root=P2 iDb=P3 + // + // Open a read-only cursor for the database table whose root page is + // P2 in a database file. The database file is determined by P3. + // P3==0 means the main database, P3==1 means the database used for + // temporary tables, and P3>1 means used the corresponding attached + // database. Give the new cursor an identifier of P1. The P1 + // values need not be contiguous but all P1 values should be small integers. + // It is an error for P1 to be negative. + // + // Allowed P5 bits: + //
    + //
  • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + // equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + // of OP_SeekLE/OP_IdxLT) + //
+ // + // The P4 value may be either an integer (P4_INT32) or a pointer to + // a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo + // object, then table being opened must be an [index b-tree] where the + // KeyInfo object defines the content and collating + // sequence of that index b-tree. Otherwise, if P4 is an integer + // value, then the table being opened must be a [table b-tree] with a + // number of columns no less than the value of P4. + // + // See also: OpenWrite, ReopenIdx + // Opcode: ReopenIdx P1 P2 P3 P4 P5 + // Synopsis: root=P2 iDb=P3 + // + // The ReopenIdx opcode works like OP_OpenRead except that it first + // checks to see if the cursor on P1 is already open on the same + // b-tree and if it is this opcode becomes a no-op. In other words, + // if the cursor is already open, do not reopen it. + // + // The ReopenIdx opcode may only be used with P5==0 or P5==OPFLAG_SEEKEQ + // and with P4 being a P4_KEYINFO object. Furthermore, the P3 value must + // be the same as every other ReopenIdx or OpenRead for the same cursor + // number. + // + // Allowed P5 bits: + //
    + //
  • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + // equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + // of OP_SeekLE/OP_IdxLT) + //
+ // + // See also: OP_OpenRead, OP_OpenWrite + // Opcode: OpenWrite P1 P2 P3 P4 P5 + // Synopsis: root=P2 iDb=P3 + // + // Open a read/write cursor named P1 on the table or index whose root + // page is P2 (or whose root page is held in register P2 if the + // OPFLAG_P2ISREG bit is set in P5 - see below). + // + // The P4 value may be either an integer (P4_INT32) or a pointer to + // a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo + // object, then table being opened must be an [index b-tree] where the + // KeyInfo object defines the content and collating + // sequence of that index b-tree. Otherwise, if P4 is an integer + // value, then the table being opened must be a [table b-tree] with a + // number of columns no less than the value of P4. + // + // Allowed P5 bits: + //
    + //
  • 0x02 OPFLAG_SEEKEQ: This cursor will only be used for + // equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT + // of OP_SeekLE/OP_IdxLT) + //
  • 0x08 OPFLAG_FORDELETE: This cursor is used only to seek + // and subsequently delete entries in an index btree. This is a + // hint to the storage engine that the storage engine is allowed to + // ignore. The hint is not used by the official SQLite b*tree storage + // engine, but is used by COMDB2. + //
  • 0x10 OPFLAG_P2ISREG: Use the content of register P2 + // as the root page, not the value of P2 itself. + //
+ // + // This instruction works like OpenRead except that it opens the cursor + // in read/write mode. + // + // See also: OP_OpenRead, OP_ReopenIdx +__79: + ; + + pCur = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + if !((pCur != 0) && ((*VdbeCursor)(unsafe.Pointer(pCur)).FpgnoRoot == U32((*Op)(unsafe.Pointer(pOp)).Fp2))) { + goto __512 + } + // Guaranteed by the code generator + goto open_cursor_set_hints +__512: + ; + // If the cursor is not currently open or is open on a different + // index, then fall through into OP_OpenRead to force a reopen +__80: +__81: + ; + + if !((int32(*(*uint16)(unsafe.Pointer(p + 200 /* &.expired */)) & 0x3 >> 0)) == 1) { + goto __513 + } + rc = (SQLITE_ABORT | (int32(2) << 8)) + goto abort_due_to_error +__513: + ; + + nField1 = 0 + pKeyInfo1 = uintptr(0) + p23 = U32((*Op)(unsafe.Pointer(pOp)).Fp2) + iDb1 = (*Op)(unsafe.Pointer(pOp)).Fp3 + + pDb1 = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb1)*32) + pX = (*Db)(unsafe.Pointer(pDb1)).FpBt + + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_OpenWrite) { + goto __514 + } + + wrFlag = (BTREE_WRCSR | (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_FORDELETE)) + + if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb1)).FpSchema)).Ffile_format) < int32((*Vdbe)(unsafe.Pointer(p)).FminWriteFileFormat)) { + goto __516 + } + (*Vdbe)(unsafe.Pointer(p)).FminWriteFileFormat = (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb1)).FpSchema)).Ffile_format +__516: + ; + goto __515 +__514: + wrFlag = 0 +__515: + ; + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_P2ISREG) != 0) { + goto __517 + } + + pIn2 = (aMem + uintptr(p23)*56) + + Xsqlite3VdbeMemIntegerify(tls, pIn2) + p23 = U32(int32(*(*I64)(unsafe.Pointer(pIn2 /* &.u */)))) + // The p2 value always comes from a prior OP_CreateBtree opcode and + // that opcode will always set the p2 value to 2 or more or else fail. + // If there were a failure, the prepared statement would have halted + // before reaching this instruction. + +__517: + ; + if !(int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-9)) { + goto __518 + } + pKeyInfo1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + nField1 = int32((*KeyInfo)(unsafe.Pointer(pKeyInfo1)).FnAllField) + goto __519 +__518: + if !(int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-3)) { + goto __520 + } + nField1 = *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) +__520: + ; +__519: + ; + + // Table with INTEGER PRIMARY KEY and nothing else + pCur = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, nField1, iDb1, uint8(CURTYPE_BTREE)) + if !(pCur == uintptr(0)) { + goto __521 + } + goto no_mem +__521: + ; + (*VdbeCursor)(unsafe.Pointer(pCur)).FnullRow = U8(1) + libc.SetBitFieldPtr8Uint32(pCur+8 /* &.isOrdered */, Bool(1), 2, 0x4) + (*VdbeCursor)(unsafe.Pointer(pCur)).FpgnoRoot = p23 + rc = Xsqlite3BtreeCursor(tls, pX, p23, wrFlag, pKeyInfo1, *(*uintptr)(unsafe.Pointer(pCur + 56 /* &.uc */))) + (*VdbeCursor)(unsafe.Pointer(pCur)).FpKeyInfo = pKeyInfo1 + // Set the VdbeCursor.isTable variable. Previous versions of + // SQLite used to check if the root-page flags were sane at this point + // and report database corruption if they were not, but this check has + // since moved into the btree layer. + (*VdbeCursor)(unsafe.Pointer(pCur)).FisTable = (U8(libc.Bool32(int32((*Op)(unsafe.Pointer(pOp)).Fp4type) != (-9)))) + +open_cursor_set_hints: + ; + + Xsqlite3BtreeCursorHintFlags(tls, *(*uintptr)(unsafe.Pointer(pCur + 56 /* &.uc */)), + (uint32(int32((*Op)(unsafe.Pointer(pOp)).Fp5) & (OPFLAG_BULKCSR | OPFLAG_SEEKEQ)))) + if !(rc != 0) { + goto __522 + } + goto abort_due_to_error +__522: + ; + goto __8 + + // Opcode: OpenDup P1 P2 * * * + // + // Open a new cursor P1 that points to the same ephemeral table as + // cursor P2. The P2 cursor must have been opened by a prior OP_OpenEphemeral + // opcode. Only ephemeral cursors may be duplicated. + // + // Duplicate ephemeral cursors are used for self-joins of materialized views. +__82: // The new cursor + + pOrig = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*8)) + + // Only ephemeral cursors can be duplicated + + pCx = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, int32((*VdbeCursor)(unsafe.Pointer(pOrig)).FnField), -1, uint8(CURTYPE_BTREE)) + if !(pCx == uintptr(0)) { + goto __523 + } + goto no_mem +__523: + ; + (*VdbeCursor)(unsafe.Pointer(pCx)).FnullRow = U8(1) + libc.SetBitFieldPtr8Uint32(pCx+8 /* &.isEphemeral */, Bool(1), 0, 0x1) + (*VdbeCursor)(unsafe.Pointer(pCx)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pOrig)).FpKeyInfo + (*VdbeCursor)(unsafe.Pointer(pCx)).FisTable = (*VdbeCursor)(unsafe.Pointer(pOrig)).FisTable + (*VdbeCursor)(unsafe.Pointer(pCx)).FpgnoRoot = (*VdbeCursor)(unsafe.Pointer(pOrig)).FpgnoRoot + libc.SetBitFieldPtr8Uint32(pCx+8 /* &.isOrdered */, (Bool(int32(*(*uint8)(unsafe.Pointer(pOrig + 8 /* &.isOrdered */)) & 0x4 >> 2))), 2, 0x4) + (*VdbeCursor)(unsafe.Pointer(pCx)).FpBtx = (*VdbeCursor)(unsafe.Pointer(pOrig)).FpBtx + libc.SetBitFieldPtr8Uint32(pCx+8 /* &.hasBeenDuped */, Bool(1), 3, 0x8) + libc.SetBitFieldPtr8Uint32(pOrig+8 /* &.hasBeenDuped */, Bool(1), 3, 0x8) + rc = Xsqlite3BtreeCursor(tls, (*VdbeCursor)(unsafe.Pointer(pCx)).FpBtx, (*VdbeCursor)(unsafe.Pointer(pCx)).FpgnoRoot, BTREE_WRCSR, + (*VdbeCursor)(unsafe.Pointer(pCx)).FpKeyInfo, *(*uintptr)(unsafe.Pointer(pCx + 56 /* &.uc */))) + // The sqlite3BtreeCursor() routine can only fail for the first cursor + // opened for a database. Since there is already an open cursor when this + // opcode is run, the sqlite3BtreeCursor() cannot fail + + goto __8 + + // Opcode: OpenEphemeral P1 P2 P3 P4 P5 + // Synopsis: nColumn=P2 + // + // Open a new cursor P1 to a transient table. + // The cursor is always opened read/write even if + // the main database is read-only. The ephemeral + // table is deleted automatically when the cursor is closed. + // + // If the cursor P1 is already opened on an ephemeral table, the table + // is cleared (all content is erased). + // + // P2 is the number of columns in the ephemeral table. + // The cursor points to a BTree table if P4==0 and to a BTree index + // if P4 is not 0. If P4 is not NULL, it points to a KeyInfo structure + // that defines the format of keys in the index. + // + // The P5 parameter can be a mask of the BTREE_* flags defined + // in btree.h. These flags control aspects of the operation of + // the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are + // added automatically. + // + // If P3 is positive, then reg[P3] is modified slightly so that it + // can be used as zero-length data for OP_Insert. This is an optimization + // that avoids an extra OP_Blob opcode to initialize that register. + // Opcode: OpenAutoindex P1 P2 * P4 * + // Synopsis: nColumn=P2 + // + // This opcode works the same as OP_OpenEphemeral. It has a + // different name to distinguish its use. Tables created using + // by this opcode will be used for automatically created transient + // indices in joins. +__83: +__84: + ; + + if !((*Op)(unsafe.Pointer(pOp)).Fp3 > 0) { + goto __524 + } + // Make register reg[P3] into a value that can be used as the data + // form sqlite3BtreeInsert() where the length of the data is zero. + // Only used when number of columns is zero + + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fn = 0 + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 756 /* "" */ +__524: + ; + pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + if !((pCx1 != 0) && !((int32(*(*uint8)(unsafe.Pointer(pCx1 + 8 /* &.hasBeenDuped */)) & 0x8 >> 3)) != 0)) { + goto __525 + } + // If the ephermeral table is already open and has no duplicates from + // OP_OpenDup, then erase all existing content so that the table is + // empty again, rather than creating a new table. + + (*VdbeCursor)(unsafe.Pointer(pCx1)).FseqCount = int64(0) + (*VdbeCursor)(unsafe.Pointer(pCx1)).FcacheStatus = U32(CACHE_STALE) + rc = Xsqlite3BtreeClearTable(tls, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpBtx, int32((*VdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot), uintptr(0)) + goto __526 +__525: + pCx1 = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, (*Op)(unsafe.Pointer(pOp)).Fp2, -1, uint8(CURTYPE_BTREE)) + if !(pCx1 == uintptr(0)) { + goto __527 + } + goto no_mem +__527: + ; + libc.SetBitFieldPtr8Uint32(pCx1+8 /* &.isEphemeral */, Bool(1), 0, 0x1) + rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, (pCx1 + 16 /* &.pBtx */), + ((BTREE_OMIT_JOURNAL | BTREE_SINGLE) | int32((*Op)(unsafe.Pointer(pOp)).Fp5)), + vfsFlags) + if !(rc == SQLITE_OK) { + goto __528 + } + rc = Xsqlite3BtreeBeginTrans(tls, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpBtx, 1, uintptr(0)) + if !(rc == SQLITE_OK) { + goto __529 + } + // If a transient index is required, create it by calling + // sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before + // opening it. If a transient table is required, just use the + // automatically created table with root-page 1 (an BLOB_INTKEY table). + if !((libc.AssignPtrUintptr(pCx1+64 /* &.pKeyInfo */, libc.AssignUintptr(&pKeyInfo2, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))))) != uintptr(0)) { + goto __530 + } + + rc = Xsqlite3BtreeCreateTable(tls, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpBtx, (pCx1 + 76 /* &.pgnoRoot */), + (BTREE_BLOBKEY | int32((*Op)(unsafe.Pointer(pOp)).Fp5))) + if !(rc == SQLITE_OK) { + goto __532 + } + + rc = Xsqlite3BtreeCursor(tls, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpBtx, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot, BTREE_WRCSR, + pKeyInfo2, *(*uintptr)(unsafe.Pointer(pCx1 + 56 /* &.uc */))) +__532: + ; + (*VdbeCursor)(unsafe.Pointer(pCx1)).FisTable = U8(0) + goto __531 +__530: + (*VdbeCursor)(unsafe.Pointer(pCx1)).FpgnoRoot = Pgno(SCHEMA_ROOT) + rc = Xsqlite3BtreeCursor(tls, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpBtx, uint32(SCHEMA_ROOT), BTREE_WRCSR, + uintptr(0), *(*uintptr)(unsafe.Pointer(pCx1 + 56 /* &.uc */))) + (*VdbeCursor)(unsafe.Pointer(pCx1)).FisTable = U8(1) +__531: + ; +__529: + ; + libc.SetBitFieldPtr8Uint32(pCx1+8 /* &.isOrdered */, (Bool(libc.Bool32(int32((*Op)(unsafe.Pointer(pOp)).Fp5) != BTREE_UNORDERED))), 2, 0x4) + if !(rc != 0) { + goto __533 + } + Xsqlite3BtreeClose(tls, (*VdbeCursor)(unsafe.Pointer(pCx1)).FpBtx) +__533: + ; +__528: + ; +__526: + ; + if !(rc != 0) { + goto __534 + } + goto abort_due_to_error +__534: + ; + (*VdbeCursor)(unsafe.Pointer(pCx1)).FnullRow = U8(1) + goto __8 + + // Opcode: SorterOpen P1 P2 P3 P4 * + // + // This opcode works like OP_OpenEphemeral except that it opens + // a transient index that is specifically designed to sort large + // tables using an external merge-sort algorithm. + // + // If argument P3 is non-zero, then it indicates that the sorter may + // assume that a stable sort considering the first P3 fields of each + // key is sufficient to produce the required results. +__85: + ; + + pCx2 = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, (*Op)(unsafe.Pointer(pOp)).Fp2, -1, uint8(CURTYPE_SORTER)) + if !(pCx2 == uintptr(0)) { + goto __535 + } + goto no_mem +__535: + ; + (*VdbeCursor)(unsafe.Pointer(pCx2)).FpKeyInfo = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + rc = Xsqlite3VdbeSorterInit(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp3, pCx2) + if !(rc != 0) { + goto __536 + } + goto abort_due_to_error +__536: + ; + goto __8 + + // Opcode: SequenceTest P1 P2 * * * + // Synopsis: if( cursor[P1].ctr++ ) pc = P2 + // + // P1 is a sorter cursor. If the sequence counter is currently zero, jump + // to P2. Regardless of whether or not the jump is taken, increment the + // the sequence value. +__86: + ; + pC2 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + if !((libc.PostIncInt64(&(*VdbeCursor)(unsafe.Pointer(pC2)).FseqCount, 1)) == int64(0)) { + goto __537 + } + goto jump_to_p2 +__537: + ; + goto __8 + + // Opcode: OpenPseudo P1 P2 P3 * * + // Synopsis: P3 columns in r[P2] + // + // Open a new cursor that points to a fake table that contains a single + // row of data. The content of that one row is the content of memory + // register P2. In other words, cursor P1 becomes an alias for the + // MEM_Blob content contained in register P2. + // + // A pseudo-table created by this opcode is used to hold a single + // row output from the sorter so that the row can be decomposed into + // individual columns using the OP_Column opcode. The OP_Column opcode + // is the only cursor opcode that works with a pseudo-table. + // + // P3 is the number of fields in the records that will be stored by + // the pseudo-table. +__87: + ; + + pCx3 = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, (*Op)(unsafe.Pointer(pOp)).Fp3, -1, uint8(CURTYPE_PSEUDO)) + if !(pCx3 == uintptr(0)) { + goto __538 + } + goto no_mem +__538: + ; + (*VdbeCursor)(unsafe.Pointer(pCx3)).FnullRow = U8(1) + (*VdbeCursor)(unsafe.Pointer(pCx3)).FseekResult = (*Op)(unsafe.Pointer(pOp)).Fp2 + (*VdbeCursor)(unsafe.Pointer(pCx3)).FisTable = U8(1) + // Give this pseudo-cursor a fake BtCursor pointer so that pCx + // can be safely passed to sqlite3VdbeCursorMoveto(). This avoids a test + // for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto() + // which is a performance optimization + *(*uintptr)(unsafe.Pointer(pCx3 + 56 /* &.uc */)) = Xsqlite3BtreeFakeValidCursor(tls) + + goto __8 + + // Opcode: Close P1 * * * * + // + // Close a cursor previously opened as P1. If P1 is not + // currently open, this instruction is a no-op. +__88: + ; + Xsqlite3VdbeFreeCursor(tls, p, *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8))) + *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) = uintptr(0) + goto __8 + + // Opcode: SeekGE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as the key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the smallest entry that + // is greater than or equal to the key value. If there are no records + // greater than or equal to the key and P2 is not zero, then jump to P2. + // + // If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this + // opcode will either land on a record that exactly matches the key, or + // else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ, + // this opcode must be followed by an IdxLE opcode with the same arguments. + // The IdxGT opcode will be skipped if this opcode succeeds, but the + // IdxGT opcode will be used on subsequent loop iterations. The + // OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this + // is an equality search. + // + // This opcode leaves the cursor configured to move in forward order, + // from the beginning toward the end. In other words, the cursor is + // configured to use Next, not Prev. + // + // See also: Found, NotFound, SeekLt, SeekGt, SeekLe + // Opcode: SeekGT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as a key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the smallest entry that + // is greater than the key value. If there are no records greater than + // the key and P2 is not zero, then jump to P2. + // + // This opcode leaves the cursor configured to move in forward order, + // from the beginning toward the end. In other words, the cursor is + // configured to use Next, not Prev. + // + // See also: Found, NotFound, SeekLt, SeekGe, SeekLe + // Opcode: SeekLT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as a key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the largest entry that + // is less than the key value. If there are no records less than + // the key and P2 is not zero, then jump to P2. + // + // This opcode leaves the cursor configured to move in reverse order, + // from the end toward the beginning. In other words, the cursor is + // configured to use Prev, not Next. + // + // See also: Found, NotFound, SeekGt, SeekGe, SeekLe + // Opcode: SeekLE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If cursor P1 refers to an SQL table (B-Tree that uses integer keys), + // use the value in register P3 as a key. If cursor P1 refers + // to an SQL index, then P3 is the first in an array of P4 registers + // that are used as an unpacked index key. + // + // Reposition cursor P1 so that it points to the largest entry that + // is less than or equal to the key value. If there are no records + // less than or equal to the key and P2 is not zero, then jump to P2. + // + // This opcode leaves the cursor configured to move in reverse order, + // from the end toward the beginning. In other words, the cursor is + // configured to use Prev, not Next. + // + // If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this + // opcode will either land on a record that exactly matches the key, or + // else it will cause a jump to P2. When the cursor is OPFLAG_SEEKEQ, + // this opcode must be followed by an IdxLE opcode with the same arguments. + // The IdxGE opcode will be skipped if this opcode succeeds, but the + // IdxGE opcode will be used on subsequent loop iterations. The + // OPFLAG_SEEKEQ flags is a hint to the btree layer to say that this + // is an equality search. + // + // See also: Found, NotFound, SeekGt, SeekGe, SeekLt +__89: // jump, in3, group +__90: // jump, in3, group +__91: // jump, in3, group +__92: // Only interested in == results + + ; + + pC3 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + oc = int32((*Op)(unsafe.Pointer(pOp)).Fopcode) + eqOnly = 0 + (*VdbeCursor)(unsafe.Pointer(pC3)).FnullRow = U8(0) + + (*VdbeCursor)(unsafe.Pointer(pC3)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC3)).FcacheStatus = U32(CACHE_STALE) + if !((*VdbeCursor)(unsafe.Pointer(pC3)).FisTable != 0) { + goto __539 + } + // The OPFLAG_SEEKEQ/BTREE_SEEK_EQ flag is only set on index cursors + + // The input value in P3 might be of any type: integer, real, string, + // blob, or NULL. But it needs to be an integer before we can do + // the seek, so convert it. + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + flags31 = (*Mem)(unsafe.Pointer(pIn3)).Fflags + if !((int32(flags31) & (((MEM_Int | MEM_Real) | MEM_IntReal) | MEM_Str)) == MEM_Str) { + goto __541 + } + applyNumericAffinity(tls, pIn3, 0) +__541: + ; + iKey = Xsqlite3VdbeIntValue(tls, pIn3) // Get the integer key value + newType = (*Mem)(unsafe.Pointer(pIn3)).Fflags // Record the type after applying numeric affinity + (*Mem)(unsafe.Pointer(pIn3)).Fflags = flags31 // But convert the type back to its original + + // If the P3 value could not be converted into an integer without + // loss of information, then special processing is required... + if !((int32(newType) & (MEM_Int | MEM_IntReal)) == 0) { + goto __542 + } + if !((int32(newType) & MEM_Real) == 0) { + goto __543 + } + if !(((int32(newType) & MEM_Null) != 0) || (oc >= OP_SeekGE)) { + goto __545 + } + + goto jump_to_p2 + goto __546 +__545: + rc = Xsqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), bp+296 /* &res1 */) + if !(rc != SQLITE_OK) { + goto __547 + } + goto abort_due_to_error +__547: + ; + goto seek_not_found +__546: + ; + goto __544 +__543: + + // If the approximation iKey is larger than the actual real search + // term, substitute >= for > and < for <=. e.g. if the search term + // is 4.9 and the integer approximation 5: + // + // (x > 4.9) -> (x >= 5) + // (x <= 4.9) -> (x < 5) + if !(*(*float64)(unsafe.Pointer(pIn3 /* &.u */)) < float64(iKey)) { + goto __548 + } + + if !((oc & 0x0001) == (OP_SeekGT & 0x0001)) { + goto __550 + } + oc-- +__550: + ; + goto __549 +__548: + if !(*(*float64)(unsafe.Pointer(pIn3 /* &.u */)) > float64(iKey)) { + goto __551 + } + + if !((oc & 0x0001) == (OP_SeekLT & 0x0001)) { + goto __552 + } + oc++ +__552: + ; +__551: + ; +__549: + ; +__544: + ; +__542: + ; + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), uintptr(0), int64(U64(iKey)), 0, bp+296 /* &res1 */) + (*VdbeCursor)(unsafe.Pointer(pC3)).FmovetoTarget = iKey // Used by OP_Delete + if !(rc != SQLITE_OK) { + goto __553 + } + goto abort_due_to_error +__553: + ; + goto __540 +__539: + // For a cursor with the OPFLAG_SEEKEQ/BTREE_SEEK_EQ hint, only the + // OP_SeekGE and OP_SeekLE opcodes are allowed, and these must be + // immediately followed by an OP_IdxGT or OP_IdxLT opcode, respectively, + // with the same key. + if !(Xsqlite3BtreeCursorHasHint(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), uint32(BTREE_SEEK_EQ)) != 0) { + goto __554 + } + eqOnly = 1 + +__554: + ; + + nField2 = *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC3)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FnField = U16(nField2) + + // The next line of code computes as follows, only faster: + // if( oc==OP_SeekGT || oc==OP_SeekLE ){ + // r.default_rc = -1; + // }else{ + // r.default_rc = +1; + // } + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).Fdefault_rc = func() int8 { + if (1 & (oc - OP_SeekLT)) != 0 { + return int8(-1) + } + return +int8(1) + }() + + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FeqSeen = U8(0) + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), bp+304 /* &r */, int64(0), 0, bp+296 /* &res1 */) + if !(rc != SQLITE_OK) { + goto __555 + } + goto abort_due_to_error +__555: + ; + if !((eqOnly != 0) && (int32((*UnpackedRecord)(unsafe.Pointer(bp+304 /* &r */)).FeqSeen) == 0)) { + goto __556 + } + + goto seek_not_found +__556: + ; +__540: + ; + if !(oc >= OP_SeekGE) { + goto __557 + } + if !((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) < 0) || ((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) == 0) && (oc == OP_SeekGT))) { + goto __559 + } + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 0 + rc = Xsqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), 0) + if !(rc != SQLITE_OK) { + goto __561 + } + if !(rc == SQLITE_DONE) { + goto __562 + } + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 1 + goto __563 +__562: + goto abort_due_to_error +__563: + ; +__561: + ; + goto __560 +__559: + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 0 +__560: + ; + goto __558 +__557: + ; + if !((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) > 0) || ((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) == 0) && (oc == OP_SeekLT))) { + goto __564 + } + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 0 + rc = Xsqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), 0) + if !(rc != SQLITE_OK) { + goto __566 + } + if !(rc == SQLITE_DONE) { + goto __567 + } + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 1 + goto __568 +__567: + goto abort_due_to_error +__568: + ; +__566: + ; + goto __565 +__564: + // res might be negative because the table is empty. Check to + // see if this is the case. + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = Xsqlite3BtreeEof(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */))) +__565: + ; +__558: + ; +seek_not_found: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) != 0) { + goto __569 + } + goto jump_to_p2 + goto __570 +__569: + if !(eqOnly != 0) { + goto __571 + } + + pOp += 24 // Skip the OP_IdxLt or OP_IdxGT that follows +__571: + ; +__570: + ; + goto __8 + + // Opcode: SeekScan P1 P2 * * * + // Synopsis: Scan-ahead up to P1 rows + // + // This opcode is a prefix opcode to OP_SeekGE. In other words, this + // opcode must be immediately followed by OP_SeekGE. This constraint is + // checked by assert() statements. + // + // This opcode uses the P1 through P4 operands of the subsequent + // OP_SeekGE. In the text that follows, the operands of the subsequent + // OP_SeekGE opcode are denoted as SeekOP.P1 through SeekOP.P4. Only + // the P1 and P2 operands of this opcode are also used, and are called + // This.P1 and This.P2. + // + // This opcode helps to optimize IN operators on a multi-column index + // where the IN operator is on the later terms of the index by avoiding + // unnecessary seeks on the btree, substituting steps to the next row + // of the b-tree instead. A correct answer is obtained if this opcode + // is omitted or is a no-op. + // + // The SeekGE.P3 and SeekGE.P4 operands identify an unpacked key which + // is the desired entry that we want the cursor SeekGE.P1 to be pointing + // to. Call this SeekGE.P4/P5 row the "target". + // + // If the SeekGE.P1 cursor is not currently pointing to a valid row, + // then this opcode is a no-op and control passes through into the OP_SeekGE. + // + // If the SeekGE.P1 cursor is pointing to a valid row, then that row + // might be the target row, or it might be near and slightly before the + // target row. This opcode attempts to position the cursor on the target + // row by, perhaps by invoking sqlite3BtreeStep() on the cursor + // between 0 and This.P1 times. + // + // There are three possible outcomes from this opcode:
    + // + //
  1. If after This.P1 steps, the cursor is still pointing to a place that + // is earlier in the btree than the target row, then fall through + // into the subsquence OP_SeekGE opcode. + // + //
  2. If the cursor is successfully moved to the target row by 0 or more + // sqlite3BtreeNext() calls, then jump to This.P2, which will land just + // past the OP_IdxGT or OP_IdxGE opcode that follows the OP_SeekGE. + // + //
  3. If the cursor ends up past the target row (indicating the the target + // row does not exist in the btree) then jump to SeekOP.P2. + //
+__93: + ; + + // pOp->p2 points to the first instruction past the OP_IdxGT that + // follows the OP_SeekGE. + + pC4 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp+1*24)).Fp1)*8)) + + if !(!(Xsqlite3BtreeCursorIsValidNN(tls, *(*uintptr)(unsafe.Pointer(pC4 + 56 /* &.uc */))) != 0)) { + goto __572 + } + goto __8 +__572: + ; + nStep = (*Op)(unsafe.Pointer(pOp)).Fp1 + + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC4)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 1*24 + 16 /* &.p4 */))) + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).Fdefault_rc = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp+1*24)).Fp3)*56) + *(*int32)(unsafe.Pointer(bp + 352 /* res3 */)) = 0 // Not needed. Only used to silence a warning. +__573: + if !(1 != 0) { + goto __574 + } + rc = Xsqlite3VdbeIdxKeyCompare(tls, db, pC4, bp+328 /* &r1 */, bp+352 /* &res3 */) + if !(rc != 0) { + goto __575 + } + goto abort_due_to_error +__575: + ; + if !(*(*int32)(unsafe.Pointer(bp + 352 /* res3 */)) > 0) { + goto __576 + } +seekscan_search_fail: + ; + pOp += 24 + goto jump_to_p2 +__576: + ; + if !(*(*int32)(unsafe.Pointer(bp + 352 /* res3 */)) == 0) { + goto __577 + } + + goto jump_to_p2 + goto __574 +__577: + ; + if !(nStep <= 0) { + goto __578 + } + + goto __574 +__578: + ; + nStep-- + rc = Xsqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC4 + 56 /* &.uc */)), 0) + if !(rc != 0) { + goto __579 + } + if !(rc == SQLITE_DONE) { + goto __580 + } + rc = SQLITE_OK + goto seekscan_search_fail + goto __581 +__580: + goto abort_due_to_error +__581: + ; +__579: + ; + goto __573 +__574: + ; + + goto __8 + + // Opcode: SeekHit P1 P2 P3 * * + // Synopsis: set P2<=seekHit<=P3 + // + // Increase or decrease the seekHit value for cursor P1, if necessary, + // so that it is no less than P2 and no greater than P3. + // + // The seekHit integer represents the maximum of terms in an index for which + // there is known to be at least one match. If the seekHit value is smaller + // than the total number of equality terms in an index lookup, then the + // OP_IfNoHope opcode might run to see if the IN loop can be abandoned + // early, thus saving work. This is part of the IN-early-out optimization. + // + // P1 must be a valid b-tree cursor. +__94: + ; + pC5 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + if !(int32((*VdbeCursor)(unsafe.Pointer(pC5)).FseekHit) < (*Op)(unsafe.Pointer(pOp)).Fp2) { + goto __582 + } + (*VdbeCursor)(unsafe.Pointer(pC5)).FseekHit = U16((*Op)(unsafe.Pointer(pOp)).Fp2) + goto __583 +__582: + if !(int32((*VdbeCursor)(unsafe.Pointer(pC5)).FseekHit) > (*Op)(unsafe.Pointer(pOp)).Fp3) { + goto __584 + } + (*VdbeCursor)(unsafe.Pointer(pC5)).FseekHit = U16((*Op)(unsafe.Pointer(pOp)).Fp3) +__584: + ; +__583: + ; + goto __8 + + // Opcode: IfNotOpen P1 P2 * * * + // Synopsis: if( !csr[P1] ) goto P2 + // + // If cursor P1 is not open, jump to instruction P2. Otherwise, fall through. +__95: // jump + ; + + if !(!(int32(*(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8))) != 0)) { + goto __585 + } + goto jump_to_p2_and_check_for_interrupt +__585: + ; + goto __8 + + // Opcode: Found P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If P4==0 then register P3 holds a blob constructed by MakeRecord. If + // P4>0 then register P3 is the first of P4 registers that form an unpacked + // record. + // + // Cursor P1 is on an index btree. If the record identified by P3 and P4 + // is a prefix of any entry in P1 then a jump is made to P2 and + // P1 is left pointing at the matching entry. + // + // This operation leaves the cursor in a state where it can be + // advanced in the forward direction. The Next instruction will work, + // but not the Prev instruction. + // + // See also: NotFound, NoConflict, NotExists. SeekGe + // Opcode: NotFound P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If P4==0 then register P3 holds a blob constructed by MakeRecord. If + // P4>0 then register P3 is the first of P4 registers that form an unpacked + // record. + // + // Cursor P1 is on an index btree. If the record identified by P3 and P4 + // is not the prefix of any entry in P1 then a jump is made to P2. If P1 + // does contain an entry whose prefix matches the P3/P4 record then control + // falls through to the next instruction and P1 is left pointing at the + // matching entry. + // + // This operation leaves the cursor in a state where it cannot be + // advanced in either direction. In other words, the Next and Prev + // opcodes do not work after this operation. + // + // See also: Found, NotExists, NoConflict, IfNoHope + // Opcode: IfNoHope P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // Register P3 is the first of P4 registers that form an unpacked + // record. Cursor P1 is an index btree. P2 is a jump destination. + // In other words, the operands to this opcode are the same as the + // operands to OP_NotFound and OP_IdxGT. + // + // This opcode is an optimization attempt only. If this opcode always + // falls through, the correct answer is still obtained, but extra works + // is performed. + // + // A value of N in the seekHit flag of cursor P1 means that there exists + // a key P3:N that will match some record in the index. We want to know + // if it is possible for a record P3:P4 to match some record in the + // index. If it is not possible, we can skips some work. So if seekHit + // is less than P4, attempt to find out if a match is possible by running + // OP_NotFound. + // + // This opcode is used in IN clause processing for a multi-column key. + // If an IN clause is attached to an element of the key other than the + // left-most element, and if there are no matches on the most recent + // seek over the whole key, then it might be that one of the key element + // to the left is prohibiting a match, and hence there is "no hope" of + // any match regardless of how many IN clause elements are checked. + // In such a case, we abandon the IN clause search early, using this + // opcode. The opcode name comes from the fact that the + // jump is taken if there is "no hope" of achieving a match. + // + // See also: NotFound, SeekHit + // Opcode: NoConflict P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // If P4==0 then register P3 holds a blob constructed by MakeRecord. If + // P4>0 then register P3 is the first of P4 registers that form an unpacked + // record. + // + // Cursor P1 is on an index btree. If the record identified by P3 and P4 + // contains any NULL value, jump immediately to P2. If all terms of the + // record are not-NULL then a check is done to determine if any row in the + // P1 index btree has a matching key prefix. If there are no matches, jump + // immediately to P2. If there is a match, fall through and leave the P1 + // cursor pointing to the matching row. + // + // This opcode is similar to OP_NotFound with the exceptions that the + // branch is always taken if any part of the search key input is NULL. + // + // This operation leaves the cursor in a state where it cannot be + // advanced in either direction. In other words, the Next and Prev + // opcodes do not work after this operation. + // + // See also: NotFound, Found, NotExists +__96: + ; + pC6 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + if !(int32((*VdbeCursor)(unsafe.Pointer(pC6)).FseekHit) >= *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) { + goto __586 + } + goto __8 +__586: + ; + +__97: // jump, in3 +__98: // jump, in3 +__99: + ; + + pC7 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + if !(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) > 0) { + goto __587 + } + (*UnpackedRecord)(unsafe.Pointer(bp + 360 /* &r2 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC7)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 360 /* &r2 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + (*UnpackedRecord)(unsafe.Pointer(bp + 360 /* &r2 */)).FaMem = pIn3 + pIdxKey = bp + 360 /* &r2 */ + pFree = uintptr(0) + goto __588 +__587: + ; + rc = func() int32 { + if (int32((*Mem)(unsafe.Pointer((pIn3))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pIn3) + } + return 0 + }() + + if !(rc != 0) { + goto __589 + } + goto no_mem +__589: + ; + pFree = libc.AssignUintptr(&pIdxKey, Xsqlite3VdbeAllocUnpackedRecord(tls, (*VdbeCursor)(unsafe.Pointer(pC7)).FpKeyInfo)) + if !(pIdxKey == uintptr(0)) { + goto __590 + } + goto no_mem +__590: + ; + Xsqlite3VdbeRecordUnpack(tls, (*VdbeCursor)(unsafe.Pointer(pC7)).FpKeyInfo, (*Mem)(unsafe.Pointer(pIn3)).Fn, (*Mem)(unsafe.Pointer(pIn3)).Fz, pIdxKey) +__588: + ; + (*UnpackedRecord)(unsafe.Pointer(pIdxKey)).Fdefault_rc = int8(0) + takeJump = 0 + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_NoConflict) { + goto __591 + } + // For the OP_NoConflict opcode, take the jump if any of the + // input fields are NULL, since any key with a NULL will not + // conflict + ii1 = 0 +__592: + if !(ii1 < int32((*UnpackedRecord)(unsafe.Pointer(pIdxKey)).FnField)) { + goto __594 + } + if !((int32((*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(pIdxKey)).FaMem+uintptr(ii1)*56)).Fflags) & MEM_Null) != 0) { + goto __595 + } + takeJump = 1 + goto __594 +__595: + ; + goto __593 +__593: + ii1++ + goto __592 + goto __594 +__594: + ; +__591: + ; + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC7 + 56 /* &.uc */)), pIdxKey, int64(0), 0, bp+384 /* &res4 */) + if !(pFree != 0) { + goto __596 + } + Xsqlite3DbFreeNN(tls, db, pFree) +__596: + ; + if !(rc != SQLITE_OK) { + goto __597 + } + goto abort_due_to_error +__597: + ; + (*VdbeCursor)(unsafe.Pointer(pC7)).FseekResult = *(*int32)(unsafe.Pointer(bp + 384 /* res4 */)) + alreadyExists = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 384 /* res4 */)) == 0)) + (*VdbeCursor)(unsafe.Pointer(pC7)).FnullRow = (U8(1 - alreadyExists)) + (*VdbeCursor)(unsafe.Pointer(pC7)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC7)).FcacheStatus = U32(CACHE_STALE) + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_Found) { + goto __598 + } + + if !(alreadyExists != 0) { + goto __600 + } + goto jump_to_p2 +__600: + ; + goto __599 +__598: + ; + if !((takeJump != 0) || !(alreadyExists != 0)) { + goto __601 + } + goto jump_to_p2 +__601: + ; + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_IfNoHope) { + goto __602 + } + (*VdbeCursor)(unsafe.Pointer(pC7)).FseekHit = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) +__602: + ; +__599: + ; + goto __8 + + // Opcode: SeekRowid P1 P2 P3 * * + // Synopsis: intkey=r[P3] + // + // P1 is the index of a cursor open on an SQL table btree (with integer + // keys). If register P3 does not contain an integer or if P1 does not + // contain a record with rowid P3 then jump immediately to P2. + // Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain + // a record with rowid P3 then + // leave the cursor pointing at that record and fall through to the next + // instruction. + // + // The OP_NotExists opcode performs the same operation, but with OP_NotExists + // the P3 register must be guaranteed to contain an integer value. With this + // opcode, register P3 might not contain an integer. + // + // The OP_NotFound opcode performs the same operation on index btrees + // (with arbitrary multi-value keys). + // + // This opcode leaves the cursor in a state where it cannot be advanced + // in either direction. In other words, the Next and Prev opcodes will + // not work following this opcode. + // + // See also: Found, NotFound, NoConflict, SeekRowid + // Opcode: NotExists P1 P2 P3 * * + // Synopsis: intkey=r[P3] + // + // P1 is the index of a cursor open on an SQL table btree (with integer + // keys). P3 is an integer rowid. If P1 does not contain a record with + // rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an + // SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then + // leave the cursor pointing at that record and fall through to the next + // instruction. + // + // The OP_SeekRowid opcode performs the same operation but also allows the + // P3 register to contain a non-integer value, in which case the jump is + // always taken. This opcode requires that P3 always contain an integer. + // + // The OP_NotFound opcode performs the same operation on index btrees + // (with arbitrary multi-value keys). + // + // This opcode leaves the cursor in a state where it cannot be advanced + // in either direction. In other words, the Next and Prev opcodes will + // not work following this opcode. + // + // See also: Found, NotFound, NoConflict, SeekRowid +__100: + + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + if !((int32((*Mem)(unsafe.Pointer(pIn3)).Fflags) & (MEM_Int | MEM_IntReal)) == 0) { + goto __603 + } + // If pIn3->u.i does not contain an integer, compute iKey as the + // integer value of pIn3. Jump to P2 if pIn3 cannot be converted + // into an integer without loss of information. Take care to avoid + // changing the datatype of pIn3, however, as it is used by other + // parts of the prepared statement. + *(*Mem)(unsafe.Pointer(bp + 392 /* x */)) = *(*Mem)(unsafe.Pointer(pIn3)) + applyAffinity(tls, bp+392 /* &x */, int8(SQLITE_AFF_NUMERIC), encoding) + if !((int32((*Mem)(unsafe.Pointer(bp+392 /* &x */)).Fflags) & MEM_Int) == 0) { + goto __604 + } + goto jump_to_p2 +__604: + ; + iKey1 = U64(*(*I64)(unsafe.Pointer(bp + 392 /* &x */ /* &.u */))) + goto notExistsWithKey +__603: + ; +__101: // jump, in3 + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + iKey1 = U64(*(*I64)(unsafe.Pointer(pIn3 /* &.u */))) +notExistsWithKey: + pC8 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pCrsr2 = *(*uintptr)(unsafe.Pointer(pC8 + 56 /* &.uc */)) + + *(*int32)(unsafe.Pointer(bp + 448 /* res5 */)) = 0 + rc = Xsqlite3BtreeMovetoUnpacked(tls, pCrsr2, uintptr(0), int64(iKey1), 0, bp+448 /* &res5 */) + + (*VdbeCursor)(unsafe.Pointer(pC8)).FmovetoTarget = I64(iKey1) // Used by OP_Delete + (*VdbeCursor)(unsafe.Pointer(pC8)).FnullRow = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC8)).FcacheStatus = U32(CACHE_STALE) + (*VdbeCursor)(unsafe.Pointer(pC8)).FdeferredMoveto = U8(0) + + (*VdbeCursor)(unsafe.Pointer(pC8)).FseekResult = *(*int32)(unsafe.Pointer(bp + 448 /* res5 */)) + if !(*(*int32)(unsafe.Pointer(bp + 448 /* res5 */)) != 0) { + goto __605 + } + + if !((*Op)(unsafe.Pointer(pOp)).Fp2 == 0) { + goto __606 + } + rc = Xsqlite3CorruptError(tls, 91396) + goto __607 +__606: + goto jump_to_p2 +__607: + ; +__605: + ; + if !(rc != 0) { + goto __608 + } + goto abort_due_to_error +__608: + ; + goto __8 + + // Opcode: Sequence P1 P2 * * * + // Synopsis: r[P2]=cursor[P1].ctr++ + // + // Find the next available sequence number for cursor P1. + // Write the sequence number into register P2. + // The sequence number on the cursor is incremented after this + // instruction. +__102: // out2 + ; + + pOut = out2Prerelease(tls, p, pOp) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = libc.PostIncInt64(&(*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)))).FseqCount, 1) + goto __8 + + // Opcode: NewRowid P1 P2 P3 * * + // Synopsis: r[P2]=rowid + // + // Get a new integer record number (a.k.a "rowid") used as the key to a table. + // The record number is not previously used as a key in the database + // table that cursor P1 points to. The new record number is written + // written to register P2. + // + // If P3>0 then P3 is a register in the root frame of this VDBE that holds + // the largest previously generated record number. No new record numbers are + // allowed to be less than this value. When this value reaches its maximum, + // an SQLITE_FULL error is generated. The P3 register is updated with the ' + // generated record number. This P3 mechanism is used to help implement the + // AUTOINCREMENT feature. +__103: // Root frame of VDBE + + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) = 0 + pOut = out2Prerelease(tls, p, pOp) + + pC9 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + // The next rowid or record number (different terms for the same + // thing) is obtained in a two-step algorithm. + // + // First we attempt to find the largest existing rowid and add one + // to that. But if the largest existing rowid is already the maximum + // positive integer, we have to fall through to the second + // probabilistic algorithm + // + // The second algorithm is to select a rowid at random and see if + // it already exists in the table. If it does not exist, we have + // succeeded. If the random rowid does exist, we select a new one + // and try again, up to 100 times. + + // Some compilers complain about constants of the form 0x7fffffffffffffff. + // Others complain about 0x7ffffffffffffffffLL. The following macro seems + // to provide the constant while making all compilers happy. + + if !(!((int32(*(*uint8)(unsafe.Pointer(pC9 + 8 /* &.useRandomRowid */)) & 0x2 >> 1)) != 0)) { + goto __609 + } + rc = Xsqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */)), bp+452 /* &res6 */) + if !(rc != SQLITE_OK) { + goto __610 + } + goto abort_due_to_error +__610: + ; + if !(*(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) != 0) { + goto __611 + } + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = int64(1) // IMP: R-61914-48074 + goto __612 +__611: + ; + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */))) + if !(*(*I64)(unsafe.Pointer(bp + 456 /* v */)) >= (int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) { + goto __613 + } + libc.SetBitFieldPtr8Uint32(pC9+8 /* &.useRandomRowid */, Bool(1), 1, 0x2) + goto __614 +__613: + *(*I64)(unsafe.Pointer(bp + 456 /* v */))++ // IMP: R-29538-34987 +__614: + ; +__612: + ; +__609: + ; + + if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { + goto __615 + } + // Assert that P3 is a valid memory cell. + + if !((*Vdbe)(unsafe.Pointer(p)).FpFrame != 0) { + goto __616 + } + pFrame1 = (*Vdbe)(unsafe.Pointer(p)).FpFrame +__618: + if !((*VdbeFrame)(unsafe.Pointer(pFrame1)).FpParent != 0) { + goto __620 + } + goto __619 +__619: + pFrame1 = (*VdbeFrame)(unsafe.Pointer(pFrame1)).FpParent + goto __618 + goto __620 +__620: + ; + // Assert that P3 is a valid memory cell. + + pMem1 = ((*VdbeFrame)(unsafe.Pointer(pFrame1)).FaMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + goto __617 +__616: + // Assert that P3 is a valid memory cell. + ; + pMem1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + +__617: + ; + + Xsqlite3VdbeMemIntegerify(tls, pMem1) + // mem(P3) holds an integer + if !((*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) == (int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) || ((Bool(int32(*(*uint8)(unsafe.Pointer(pC9 + 8 /* &.useRandomRowid */)) & 0x2 >> 1))) != 0)) { + goto __621 + } + rc = SQLITE_FULL // IMP: R-17817-00630 + goto abort_due_to_error +__621: + ; + if !(*(*I64)(unsafe.Pointer(bp + 456 /* v */)) < (*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) + int64(1))) { + goto __622 + } + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = (*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) + int64(1)) +__622: + ; + *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 456 /* v */)) +__615: + ; + if !((Bool(int32(*(*uint8)(unsafe.Pointer(pC9 + 8 /* &.useRandomRowid */)) & 0x2 >> 1))) != 0) { + goto __623 + } + // IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the + // largest possible integer (9223372036854775807) then the database + // engine starts picking positive candidate ROWIDs at random until + // it finds one that is not previously used. + // We cannot be in random rowid mode if this is + // an AUTOINCREMENT table. + cnt1 = 0 +__624: + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(I64(0))), bp+456 /* &v */) + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) &= (I64((int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) >> 1) + *(*I64)(unsafe.Pointer(bp + 456 /* v */))++ // Ensure that v is greater than zero + goto __625 +__625: + if (((libc.AssignInt32(&rc, Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */)), uintptr(0), int64(U64(*(*I64)(unsafe.Pointer(bp + 456 /* v */)))), + 0, bp+452 /* &res6 */))) == SQLITE_OK) && + (*(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) == 0)) && + (libc.PreIncInt32(&cnt1, 1) < 100) { + goto __624 + } + goto __626 +__626: + ; + if !(rc != 0) { + goto __627 + } + goto abort_due_to_error +__627: + ; + if !(*(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) == 0) { + goto __628 + } + rc = SQLITE_FULL // IMP: R-38219-53002 + goto abort_due_to_error +__628: + ; + // EV: R-40812-03570 +__623: + ; + (*VdbeCursor)(unsafe.Pointer(pC9)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC9)).FcacheStatus = U32(CACHE_STALE) + + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 456 /* v */)) + goto __8 + + // Opcode: Insert P1 P2 P3 P4 P5 + // Synopsis: intkey=r[P3] data=r[P2] + // + // Write an entry into the table of cursor P1. A new entry is + // created if it doesn't already exist or the data for an existing + // entry is overwritten. The data is the value MEM_Blob stored in register + // number P2. The key is stored in register P3. The key must + // be a MEM_Int. + // + // If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is + // incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, + // then rowid is stored for subsequent return by the + // sqlite3_last_insert_rowid() function (otherwise it is unmodified). + // + // If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might + // run faster by avoiding an unnecessary seek on cursor P1. However, + // the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior + // seeks on the cursor or if the most recent seek used a key equal to P3. + // + // If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an + // UPDATE operation. Otherwise (if the flag is clear) then this opcode + // is part of an INSERT operation. The difference is only important to + // the update hook. + // + // Parameter P4 may point to a Table structure, or may be NULL. If it is + // not NULL, then the update-hook (sqlite3.xUpdateCallback) is invoked + // following a successful insert. + // + // (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically + // allocated, then ownership of P2 is transferred to the pseudo-cursor + // and register P2 becomes ephemeral. If the cursor is changed, the + // value of register P2 will then change. Make sure this does not + // cause any problems.) + // + // This instruction only works on tables. The equivalent instruction + // for indices is OP_IdxInsert. +__104: // Payload to be inserted + + pData = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + + pC10 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pKey = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnKey = *(*I64)(unsafe.Pointer(pKey /* &.u */)) + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-6)) && (((*Sqlite3)(unsafe.Pointer((db))).FxPreUpdateCallback != 0) || ((*Sqlite3)(unsafe.Pointer((db))).FxUpdateCallback != 0))) { + goto __629 + } + + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*VdbeCursor)(unsafe.Pointer(pC10)).FiDb)*32)).FzDbSName + pTab = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + goto __630 +__629: + pTab = uintptr(0) + zDb = uintptr(0) // Not needed. Silence a compiler warning. +__630: + ; + + // Invoke the pre-update hook, if any + if !(pTab != 0) { + goto __631 + } + if !(((*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0) && !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_ISUPDATE) != 0)) { + goto __632 + } + Xsqlite3VdbePreUpdateHook(tls, p, pC10, SQLITE_INSERT, zDb, pTab, (*BtreePayload)(unsafe.Pointer(bp+464 /* &x1 */)).FnKey, (*Op)(unsafe.Pointer(pOp)).Fp2, -1) +__632: + ; + if !(((*Sqlite3)(unsafe.Pointer(db)).FxUpdateCallback == uintptr(0)) || ((*Table)(unsafe.Pointer(pTab)).FaCol == uintptr(0))) { + goto __633 + } + // Prevent post-update hook from running in cases when it should not + pTab = uintptr(0) +__633: + ; +__631: + ; + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_ISNOOP) != 0) { + goto __634 + } + goto __8 +__634: + ; + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_NCHANGE) != 0) { + goto __635 + } + (*Vdbe)(unsafe.Pointer(p)).FnChange++ +__635: + ; + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_LASTROWID) != 0) { + goto __636 + } + (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnKey +__636: + ; + + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FpData = (*Mem)(unsafe.Pointer(pData)).Fz + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnData = (*Mem)(unsafe.Pointer(pData)).Fn + seekResult = func() int32 { + if (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_USESEEKRESULT) != 0 { + return (*VdbeCursor)(unsafe.Pointer(pC10)).FseekResult + } + return 0 + }() + if !((int32((*Mem)(unsafe.Pointer(pData)).Fflags) & MEM_Zero) != 0) { + goto __637 + } + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnZero = *(*int32)(unsafe.Pointer(pData /* &.u */)) + goto __638 +__637: + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnZero = 0 +__638: + ; + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FpKey = uintptr(0) + rc = Xsqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC10 + 56 /* &.uc */)), bp+464, /* &x1 */ + (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & ((OPFLAG_APPEND | OPFLAG_SAVEPOSITION) | OPFLAG_PREFORMAT)), + seekResult) + (*VdbeCursor)(unsafe.Pointer(pC10)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC10)).FcacheStatus = U32(CACHE_STALE) + + // Invoke the update-hook if required. + if !(rc != 0) { + goto __639 + } + goto abort_due_to_error +__639: + ; + if !(pTab != 0) { + goto __640 + } + + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Sqlite_int64))(unsafe.Pointer((db + 312 /* &.xUpdateCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpUpdateArg, + func() int32 { + if (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_ISUPDATE) != 0 { + return SQLITE_UPDATE + } + return SQLITE_INSERT + }(), + zDb, (*Table)(unsafe.Pointer(pTab)).FzName, (*BtreePayload)(unsafe.Pointer(bp+464 /* &x1 */)).FnKey) +__640: + ; + goto __8 + + // Opcode: RowCell P1 P2 P3 * * + // + // P1 and P2 are both open cursors. Both must be opened on the same type + // of table - intkey or index. This opcode is used as part of copying + // the current row from P2 into P1. If the cursors are opened on intkey + // tables, register P3 contains the rowid to use with the new record in + // P1. If they are opened on index tables, P3 is not used. + // + // This opcode must be followed by either an Insert or InsertIdx opcode + // with the OPFLAG_PREFORMAT flag set to complete the insert operation. +__105: // Rowid value to insert with + ; + + pDest1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + pSrc = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*8)) + if (*Op)(unsafe.Pointer(pOp)).Fp3 != 0 { + iKey2 = *(*I64)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56 /* &.u */)) + } else { + iKey2 = int64(0) + } + rc = Xsqlite3BtreeTransferRow(tls, *(*uintptr)(unsafe.Pointer(pDest1 + 56 /* &.uc */)), *(*uintptr)(unsafe.Pointer(pSrc + 56 /* &.uc */)), iKey2) + if !(rc != SQLITE_OK) { + goto __641 + } + goto abort_due_to_error +__641: + ; + goto __8 + + // Opcode: Delete P1 P2 P3 P4 P5 + // + // Delete the record at which the P1 cursor is currently pointing. + // + // If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then + // the cursor will be left pointing at either the next or the previous + // record in the table. If it is left pointing at the next record, then + // the next Next instruction will be a no-op. As a result, in this case + // it is ok to delete a record from within a Next loop. If + // OPFLAG_SAVEPOSITION bit of P5 is clear, then the cursor will be + // left in an undefined state. + // + // If the OPFLAG_AUXDELETE bit is set on P5, that indicates that this + // delete one of several associated with deleting a table row and all its + // associated index entries. Exactly one of those deletes is the "primary" + // delete. The others are all on OPFLAG_FORDELETE cursors or else are + // marked with the AUXDELETE flag. + // + // If the OPFLAG_NCHANGE flag of P2 (NB: P2 not P5) is set, then the row + // change count is incremented (otherwise not). + // + // P1 must not be pseudo-table. It has to be a real table with + // multiple rows. + // + // If P4 is not NULL then it points to a Table object. In this case either + // the update or pre-update hook, or both, may be invoked. The P1 cursor must + // have been positioned using OP_NotFound prior to invoking this opcode in + // this case. Specifically, if one is configured, the pre-update hook is + // invoked if P4 is not NULL. The update-hook is invoked if one is configured, + // P4 is not NULL, and the OPFLAG_NCHANGE flag is set in P2. + // + // If the OPFLAG_ISUPDATE flag is set in P2, then P3 contains the address + // of the memory cell that contains the value that the rowid of the row will + // be set to by the update. +__106: + + opflags = (*Op)(unsafe.Pointer(pOp)).Fp2 + + pC11 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + // If the update-hook or pre-update-hook will be invoked, set zDb to + // the name of the db to pass as to it. Also set local pTab to a copy + // of p4.pTab. Finally, if p5 is true, indicating that this cursor was + // last moved with OP_Next or OP_Prev, not Seek or NotFound, set + // VdbeCursor.movetoTarget to the current rowid. + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-6)) && (((*Sqlite3)(unsafe.Pointer((db))).FxPreUpdateCallback != 0) || ((*Sqlite3)(unsafe.Pointer((db))).FxUpdateCallback != 0))) { + goto __642 + } + + zDb1 = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*VdbeCursor)(unsafe.Pointer(pC11)).FiDb)*32)).FzDbSName + pTab1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + if !(((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_SAVEPOSITION) != 0) && ((*VdbeCursor)(unsafe.Pointer(pC11)).FisTable != 0)) { + goto __644 + } + (*VdbeCursor)(unsafe.Pointer(pC11)).FmovetoTarget = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC11 + 56 /* &.uc */))) +__644: + ; + goto __643 +__642: + zDb1 = uintptr(0) // Not needed. Silence a compiler warning. + pTab1 = uintptr(0) // Not needed. Silence a compiler warning. +__643: + ; + + // Invoke the pre-update-hook if required. + if !(((*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0) && (*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0)) { + goto __645 + } + + Xsqlite3VdbePreUpdateHook(tls, p, pC11, + func() int32 { + if (opflags & OPFLAG_ISUPDATE) != 0 { + return SQLITE_UPDATE + } + return SQLITE_DELETE + }(), + zDb1, pTab1, (*VdbeCursor)(unsafe.Pointer(pC11)).FmovetoTarget, + (*Op)(unsafe.Pointer(pOp)).Fp3, -1) +__645: + ; + if !((opflags & OPFLAG_ISNOOP) != 0) { + goto __646 + } + goto __8 +__646: + ; + + // Only flags that can be set are SAVEPOISTION and AUXDELETE + + rc = Xsqlite3BtreeDelete(tls, *(*uintptr)(unsafe.Pointer(pC11 + 56 /* &.uc */)), uint8((*Op)(unsafe.Pointer(pOp)).Fp5)) + (*VdbeCursor)(unsafe.Pointer(pC11)).FcacheStatus = U32(CACHE_STALE) + (*VdbeCursor)(unsafe.Pointer(pC11)).FseekResult = 0 + if !(rc != 0) { + goto __647 + } + goto abort_due_to_error +__647: + ; + + // Invoke the update-hook if required. + if !((opflags & OPFLAG_NCHANGE) != 0) { + goto __648 + } + (*Vdbe)(unsafe.Pointer(p)).FnChange++ + if !(((*Sqlite3)(unsafe.Pointer(db)).FxUpdateCallback != 0) && (((*Table)(unsafe.Pointer((pTab1))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __649 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, Sqlite_int64))(unsafe.Pointer((db + 312 /* &.xUpdateCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpUpdateArg, SQLITE_DELETE, zDb1, (*Table)(unsafe.Pointer(pTab1)).FzName, + (*VdbeCursor)(unsafe.Pointer(pC11)).FmovetoTarget) + +__649: + ; +__648: + ; + + goto __8 + + // Opcode: ResetCount * * * * * + // + // The value of the change counter is copied to the database handle + // change counter (returned by subsequent calls to sqlite3_changes()). + // Then the VMs internal change counter resets to 0. + // This is used by trigger programs. +__107: + Xsqlite3VdbeSetChanges(tls, db, (*Vdbe)(unsafe.Pointer(p)).FnChange) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + goto __8 + + // Opcode: SorterCompare P1 P2 P3 P4 + // Synopsis: if key(P1)!=trim(r[P3],P4) goto P2 + // + // P1 is a sorter cursor. This instruction compares a prefix of the + // record blob in register P3 against a prefix of the entry that + // the sorter cursor currently points to. Only the first P4 fields + // of r[P3] and the sorter record are compared. + // + // If either P3 or the sorter contains a NULL in one of their significant + // fields (not counting the P4 fields at the end which are ignored) then + // the comparison is assumed to be equal. + // + // Fall through to next instruction if the two records compare equal to + // each other. Jump to P2 if they are different. +__108: + + pC12 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + nKeyCol = *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + *(*int32)(unsafe.Pointer(bp + 512 /* res7 */)) = 0 + rc = Xsqlite3VdbeSorterCompare(tls, pC12, pIn3, nKeyCol, bp+512 /* &res7 */) + + if !(rc != 0) { + goto __650 + } + goto abort_due_to_error +__650: + ; + if !(*(*int32)(unsafe.Pointer(bp + 512 /* res7 */)) != 0) { + goto __651 + } + goto jump_to_p2 +__651: + ; + goto __8 + + // Opcode: SorterData P1 P2 P3 * * + // Synopsis: r[P2]=data + // + // Write into register P2 the current sorter data for sorter cursor P1. + // Then clear the column header cache on cursor P3. + // + // This opcode is normally use to move a record out of the sorter and into + // a register that is the source for a pseudo-table cursor created using + // OpenPseudo. That pseudo-table cursor is the one that is identified by + // parameter P3. Clearing the P3 column cache as part of this opcode saves + // us from having to issue a separate NullRow instruction to clear that cache. +__109: + + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + pC13 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + rc = Xsqlite3VdbeSorterRowkey(tls, pC13, pOut) + + if !(rc != 0) { + goto __652 + } + goto abort_due_to_error +__652: + ; + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*8)))).FcacheStatus = U32(CACHE_STALE) + goto __8 + + // Opcode: RowData P1 P2 P3 * * + // Synopsis: r[P2]=data + // + // Write into register P2 the complete row content for the row at + // which cursor P1 is currently pointing. + // There is no interpretation of the data. + // It is just copied onto the P2 register exactly as + // it is found in the database file. + // + // If cursor P1 is an index, then the content is the key of the row. + // If cursor P2 is a table, then the content extracted is the data. + // + // If the P1 cursor must be pointing to a valid row (not a NULL row) + // of a real table, not a pseudo-table. + // + // If P3!=0 then this opcode is allowed to make an ephemeral pointer + // into the database page. That means that the content of the output + // register will be invalidated as soon as the cursor moves - including + // moves caused by other cursors that "save" the current cursors + // position in order that they can write to the same table. If P3==0 + // then a copy of the data is made into memory. P3!=0 is faster, but + // P3==0 is safer. + // + // If P3!=0 then the content of the P2 register is unsuitable for use + // in OP_Result and any OP_Result will invalidate the P2 register content. + // The P2 register content is invalidated by opcodes like OP_Function or + // by any use of another cursor pointing to the same table. +__110: + + pOut = out2Prerelease(tls, p, pOp) + + pC14 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pCrsr3 = *(*uintptr)(unsafe.Pointer(pC14 + 56 /* &.uc */)) + + // The OP_RowData opcodes always follow OP_NotExists or + // OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions + // that might invalidate the cursor. + // If this where not the case, on of the following assert()s + // would fail. Should this ever change (because of changes in the code + // generator) then the fix would be to insert a call to + // sqlite3VdbeCursorMoveto(). + + n3 = Xsqlite3BtreePayloadSize(tls, pCrsr3) + if !(n3 > U32(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))))) { + goto __653 + } + goto too_big +__653: + ; + + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, pCrsr3, n3, pOut) + if !(rc != 0) { + goto __654 + } + goto abort_due_to_error +__654: + ; + if !(!((*Op)(unsafe.Pointer(pOp)).Fp3 != 0)) { + goto __655 + } + if !(((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & MEM_Ephem) != 0) && (Xsqlite3VdbeMemMakeWriteable(tls, pOut) != 0)) { + goto __656 + } + goto no_mem +__656: + ; +__655: + ; + + goto __8 + + // Opcode: Rowid P1 P2 * * * + // Synopsis: r[P2]=rowid + // + // Store in register P2 an integer which is the key of the table entry that + // P1 is currently point to. + // + // P1 can be either an ordinary table or a virtual table. There used to + // be a separate OP_VRowid opcode for use with virtual tables, but this + // one opcode now works for both table types. +__111: + + pOut = out2Prerelease(tls, p, pOp) + + pC15 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + if !((*VdbeCursor)(unsafe.Pointer(pC15)).FnullRow != 0) { + goto __657 + } + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Null) + goto __8 + goto __658 +__657: + if !((*VdbeCursor)(unsafe.Pointer(pC15)).FdeferredMoveto != 0) { + goto __659 + } + *(*I64)(unsafe.Pointer(bp + 520 /* v3 */)) = (*VdbeCursor)(unsafe.Pointer(pC15)).FmovetoTarget + goto __660 +__659: + if !(int32((*VdbeCursor)(unsafe.Pointer(pC15)).FeCurType) == CURTYPE_VTAB) { + goto __661 + } + + pVtab = (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */)))).FpVtab + pModule = (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pModule + 96 /* &.xRowid */))))(tls, *(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */)), bp+520 /* &v3 */) + Xsqlite3VtabImportErrmsg(tls, p, pVtab) + if !(rc != 0) { + goto __663 + } + goto abort_due_to_error +__663: + ; + goto __662 +__661: + ; + + rc = Xsqlite3VdbeCursorRestore(tls, pC15) + if !(rc != 0) { + goto __664 + } + goto abort_due_to_error +__664: + ; + if !((*VdbeCursor)(unsafe.Pointer(pC15)).FnullRow != 0) { + goto __665 + } + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Null) + goto __8 +__665: + ; + *(*I64)(unsafe.Pointer(bp + 520 /* v3 */)) = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */))) +__662: + ; +__660: + ; +__658: + ; + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 520 /* v3 */)) + goto __8 + + // Opcode: NullRow P1 * * * * + // + // Move the cursor P1 to a null row. Any OP_Column operations + // that occur while the cursor is on the null row will always + // write a NULL. +__112: + ; + pC16 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + (*VdbeCursor)(unsafe.Pointer(pC16)).FnullRow = U8(1) + (*VdbeCursor)(unsafe.Pointer(pC16)).FcacheStatus = U32(CACHE_STALE) + if !(int32((*VdbeCursor)(unsafe.Pointer(pC16)).FeCurType) == CURTYPE_BTREE) { + goto __666 + } + + Xsqlite3BtreeClearCursor(tls, *(*uintptr)(unsafe.Pointer(pC16 + 56 /* &.uc */))) +__666: + ; + goto __8 + + // Opcode: SeekEnd P1 * * * * + // + // Position cursor P1 at the end of the btree for the purpose of + // appending a new entry onto the btree. + // + // It is assumed that the cursor is used only for appending and so + // if the cursor is valid, then the cursor must already be pointing + // at the end of the btree and so no changes are made to + // the cursor. + // Opcode: Last P1 P2 * * * + // + // The next use of the Rowid or Column or Prev instruction for P1 + // will refer to the last entry in the database table or index. + // If the table or index is empty and P2>0, then jump immediately to P2. + // If P2 is 0 or if the table or index is not empty, fall through + // to the following instruction. + // + // This opcode leaves the cursor configured to move in reverse order, + // from the end toward the beginning. In other words, the cursor is + // configured to use Prev, not Next. +__113: +__114: + ; + pC17 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pCrsr4 = *(*uintptr)(unsafe.Pointer(pC17 + 56 /* &.uc */)) + *(*int32)(unsafe.Pointer(bp + 528 /* res8 */)) = 0 + + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_SeekEnd) { + goto __667 + } + + (*VdbeCursor)(unsafe.Pointer(pC17)).FseekResult = -1 + if !(Xsqlite3BtreeCursorIsValidNN(tls, pCrsr4) != 0) { + goto __668 + } + goto __8 +__668: + ; +__667: + ; + rc = Xsqlite3BtreeLast(tls, pCrsr4, bp+528 /* &res8 */) + (*VdbeCursor)(unsafe.Pointer(pC17)).FnullRow = U8(*(*int32)(unsafe.Pointer(bp + 528 /* res8 */))) + (*VdbeCursor)(unsafe.Pointer(pC17)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC17)).FcacheStatus = U32(CACHE_STALE) + if !(rc != 0) { + goto __669 + } + goto abort_due_to_error +__669: + ; + if !((*Op)(unsafe.Pointer(pOp)).Fp2 > 0) { + goto __670 + } + + if !(*(*int32)(unsafe.Pointer(bp + 528 /* res8 */)) != 0) { + goto __671 + } + goto jump_to_p2 +__671: + ; +__670: + ; + goto __8 + + // Opcode: IfSmaller P1 P2 P3 * * + // + // Estimate the number of rows in the table P1. Jump to P2 if that + // estimate is less than approximately 2**(0.1*P3). +__115: + ; + pC18 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pCrsr5 = *(*uintptr)(unsafe.Pointer(pC18 + 56 /* &.uc */)) + + rc = Xsqlite3BtreeFirst(tls, pCrsr5, bp+532 /* &res9 */) + if !(rc != 0) { + goto __672 + } + goto abort_due_to_error +__672: + ; + if !(*(*int32)(unsafe.Pointer(bp + 532 /* res9 */)) == 0) { + goto __673 + } + sz = Xsqlite3BtreeRowCountEst(tls, pCrsr5) + if !((sz >= int64(0)) && (int32(Xsqlite3LogEst(tls, U64(sz))) < (*Op)(unsafe.Pointer(pOp)).Fp3)) { + goto __674 + } + *(*int32)(unsafe.Pointer(bp + 532 /* res9 */)) = 1 +__674: + ; +__673: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 532 /* res9 */)) != 0) { + goto __675 + } + goto jump_to_p2 +__675: + ; + goto __8 + + // Opcode: SorterSort P1 P2 * * * + // + // After all records have been inserted into the Sorter object + // identified by P1, invoke this opcode to actually do the sorting. + // Jump to P2 if there are no records to be sorted. + // + // This opcode is an alias for OP_Sort and OP_Rewind that is used + // for Sorter objects. + // Opcode: Sort P1 P2 * * * + // + // This opcode does exactly the same thing as OP_Rewind except that + // it increments an undocumented global variable used for testing. + // + // Sorting is accomplished by writing records into a sorting index, + // then rewinding that index and playing it back from beginning to + // end. We use the OP_Sort opcode instead of OP_Rewind to do the + // rewinding so that the global variable will be incremented and + // regression tests can determine whether or not the optimizer is + // correctly optimizing out sorts. +__116: // jump +__117: // jump + *(*U32)(unsafe.Pointer((p + 212 /* &.aCounter */) + 2*4))++ + + // Opcode: Rewind P1 P2 * * * + // + // The next use of the Rowid or Column or Next instruction for P1 + // will refer to the first entry in the database table or index. + // If the table or index is empty, jump immediately to P2. + // If the table or index is not empty, fall through to the following + // instruction. + // + // This opcode leaves the cursor configured to move in forward order, + // from the beginning toward the end. In other words, the cursor is + // configured to use Next, not Prev. +__118: + ; + + pC19 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + *(*int32)(unsafe.Pointer(bp + 536 /* res10 */)) = 1 + if !(int32((*VdbeCursor)(unsafe.Pointer((pC19))).FeCurType) == CURTYPE_SORTER) { + goto __676 + } + rc = Xsqlite3VdbeSorterRewind(tls, pC19, bp+536 /* &res10 */) + goto __677 +__676: + ; + pCrsr6 = *(*uintptr)(unsafe.Pointer(pC19 + 56 /* &.uc */)) + + rc = Xsqlite3BtreeFirst(tls, pCrsr6, bp+536 /* &res10 */) + (*VdbeCursor)(unsafe.Pointer(pC19)).FdeferredMoveto = U8(0) + (*VdbeCursor)(unsafe.Pointer(pC19)).FcacheStatus = U32(CACHE_STALE) +__677: + ; + if !(rc != 0) { + goto __678 + } + goto abort_due_to_error +__678: + ; + (*VdbeCursor)(unsafe.Pointer(pC19)).FnullRow = U8(*(*int32)(unsafe.Pointer(bp + 536 /* res10 */))) + + if !(*(*int32)(unsafe.Pointer(bp + 536 /* res10 */)) != 0) { + goto __679 + } + goto jump_to_p2 +__679: + ; + goto __8 + + // Opcode: Next P1 P2 P3 P4 P5 + // + // Advance cursor P1 so that it points to the next key/data pair in its + // table or index. If there are no more key/value pairs then fall through + // to the following instruction. But if the cursor advance was successful, + // jump immediately to P2. + // + // The Next opcode is only valid following an SeekGT, SeekGE, or + // OP_Rewind opcode used to position the cursor. Next is not allowed + // to follow SeekLT, SeekLE, or OP_Last. + // + // The P1 cursor must be for a real table, not a pseudo-table. P1 must have + // been opened prior to this opcode or the program will segfault. + // + // The P3 value is a hint to the btree implementation. If P3==1, that + // means P1 is an SQL index and that this instruction could have been + // omitted if that index had been unique. P3 is usually 0. P3 is + // always either 0 or 1. + // + // P4 is always of type P4_ADVANCE. The function pointer points to + // sqlite3BtreeNext(). + // + // If P5 is positive and the jump is taken, then event counter + // number P5-1 in the prepared statement is incremented. + // + // See also: Prev + // Opcode: Prev P1 P2 P3 P4 P5 + // + // Back up cursor P1 so that it points to the previous key/data pair in its + // table or index. If there is no previous key/value pairs then fall through + // to the following instruction. But if the cursor backup was successful, + // jump immediately to P2. + // + // + // The Prev opcode is only valid following an SeekLT, SeekLE, or + // OP_Last opcode used to position the cursor. Prev is not allowed + // to follow SeekGT, SeekGE, or OP_Rewind. + // + // The P1 cursor must be for a real table, not a pseudo-table. If P1 is + // not open then the behavior is undefined. + // + // The P3 value is a hint to the btree implementation. If P3==1, that + // means P1 is an SQL index and that this instruction could have been + // omitted if that index had been unique. P3 is usually 0. P3 is + // always either 0 or 1. + // + // P4 is always of type P4_ADVANCE. The function pointer points to + // sqlite3BtreePrevious(). + // + // If P5 is positive and the jump is taken, then event counter + // number P5-1 in the prepared statement is incremented. + // Opcode: SorterNext P1 P2 * * P5 + // + // This opcode works just like OP_Next except that P1 must be a + // sorter object for which the OP_SorterSort opcode has been + // invoked. This opcode advances the cursor to the next sorted + // record, or jumps to P2 if there are no more sorted records. +__119: + + pC20 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + rc = Xsqlite3VdbeSorterNext(tls, db, pC20) + goto next_tail +__120: // jump +__121: // jump + ; + + pC20 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + // The Next opcode is only used after SeekGT, SeekGE, Rewind, and Found. + // The Prev opcode is only used after SeekLT, SeekLE, and Last. + + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pOp + 16 /* &.p4 */ /* &.xAdvance */))))(tls, *(*uintptr)(unsafe.Pointer(pC20 + 56 /* &.uc */)), (*Op)(unsafe.Pointer(pOp)).Fp3) +next_tail: + (*VdbeCursor)(unsafe.Pointer(pC20)).FcacheStatus = U32(CACHE_STALE) + + if !(rc == SQLITE_OK) { + goto __680 + } + (*VdbeCursor)(unsafe.Pointer(pC20)).FnullRow = U8(0) + *(*U32)(unsafe.Pointer((p + 212 /* &.aCounter */) + uintptr((*Op)(unsafe.Pointer(pOp)).Fp5)*4))++ + goto jump_to_p2_and_check_for_interrupt +__680: + ; + if !(rc != SQLITE_DONE) { + goto __681 + } + goto abort_due_to_error +__681: + ; + rc = SQLITE_OK + (*VdbeCursor)(unsafe.Pointer(pC20)).FnullRow = U8(1) + goto check_for_interrupt + + // Opcode: IdxInsert P1 P2 P3 P4 P5 + // Synopsis: key=r[P2] + // + // Register P2 holds an SQL index key made using the + // MakeRecord instructions. This opcode writes that key + // into the index P1. Data for the entry is nil. + // + // If P4 is not zero, then it is the number of values in the unpacked + // key of reg(P2). In that case, P3 is the index of the first register + // for the unpacked key. The availability of the unpacked key can sometimes + // be an optimization. + // + // If P5 has the OPFLAG_APPEND bit set, that is a hint to the b-tree layer + // that this insert is likely to be an append. + // + // If P5 has the OPFLAG_NCHANGE bit set, then the change counter is + // incremented by this instruction. If the OPFLAG_NCHANGE bit is clear, + // then the change counter is unchanged. + // + // If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might + // run faster by avoiding an unnecessary seek on cursor P1. However, + // the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior + // seeks on the cursor or if the most recent seek used a key equivalent + // to P2. + // + // This instruction only works for indices. The equivalent instruction + // for tables is OP_Insert. +__122: + ; + pC21 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_NCHANGE) != 0) { + goto __682 + } + (*Vdbe)(unsafe.Pointer(p)).FnChange++ +__682: + ; + + rc = func() int32 { + if (int32((*Mem)(unsafe.Pointer((pIn2))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pIn2) + } + return 0 + }() + if !(rc != 0) { + goto __683 + } + goto abort_due_to_error +__683: + ; + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FnKey = Sqlite3_int64((*Mem)(unsafe.Pointer(pIn2)).Fn) + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FpKey = (*Mem)(unsafe.Pointer(pIn2)).Fz + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FnMem = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + rc = Xsqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC21 + 56 /* &.uc */)), bp+544, /* &x2 */ + (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & ((OPFLAG_APPEND | OPFLAG_SAVEPOSITION) | OPFLAG_PREFORMAT)), + func() int32 { + if (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_USESEEKRESULT) != 0 { + return (*VdbeCursor)(unsafe.Pointer(pC21)).FseekResult + } + return 0 + }()) + + (*VdbeCursor)(unsafe.Pointer(pC21)).FcacheStatus = U32(CACHE_STALE) + if !(rc != 0) { + goto __684 + } + goto abort_due_to_error +__684: + ; + goto __8 + + // Opcode: SorterInsert P1 P2 * * * + // Synopsis: key=r[P2] + // + // Register P2 holds an SQL index key made using the + // MakeRecord instructions. This opcode writes that key + // into the sorter P1. Data for the entry is nil. +__123: + ; + pC22 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + + rc = func() int32 { + if (int32((*Mem)(unsafe.Pointer((pIn2))).Fflags) & MEM_Zero) != 0 { + return Xsqlite3VdbeMemExpandBlob(tls, pIn2) + } + return 0 + }() + if !(rc != 0) { + goto __685 + } + goto abort_due_to_error +__685: + ; + rc = Xsqlite3VdbeSorterWrite(tls, pC22, pIn2) + if !(rc != 0) { + goto __686 + } + goto abort_due_to_error +__686: + ; + goto __8 + + // Opcode: IdxDelete P1 P2 P3 * P5 + // Synopsis: key=r[P2@P3] + // + // The content of P3 registers starting at register P2 form + // an unpacked index key. This opcode removes that entry from the + // index opened by cursor P1. + // + // If P5 is not zero, then raise an SQLITE_CORRUPT_INDEX error + // if no matching index entry is found. This happens when running + // an UPDATE or DELETE statement and the index entry to be updated + // or deleted is not found. For some uses of IdxDelete + // (example: the EXCEPT operator) it does not matter that no matching + // entry is found. For those cases, P5 is zero. +__124: + ; + + pC23 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pCrsr7 = *(*uintptr)(unsafe.Pointer(pC23 + 56 /* &.uc */)) + + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC23)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).FnField = U16((*Op)(unsafe.Pointer(pOp)).Fp3) + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).Fdefault_rc = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + rc = Xsqlite3BtreeMovetoUnpacked(tls, pCrsr7, bp+592 /* &r3 */, int64(0), 0, bp+616 /* &res11 */) + if !(rc != 0) { + goto __687 + } + goto abort_due_to_error +__687: + ; + if !(*(*int32)(unsafe.Pointer(bp + 616 /* res11 */)) == 0) { + goto __688 + } + rc = Xsqlite3BtreeDelete(tls, pCrsr7, uint8(BTREE_AUXDELETE)) + if !(rc != 0) { + goto __690 + } + goto abort_due_to_error +__690: + ; + goto __689 +__688: + if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { + goto __691 + } + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4940 /* "index corruption" */) + goto abort_due_to_error +__691: + ; +__689: + ; + + (*VdbeCursor)(unsafe.Pointer(pC23)).FcacheStatus = U32(CACHE_STALE) + (*VdbeCursor)(unsafe.Pointer(pC23)).FseekResult = 0 + goto __8 + + // Opcode: DeferredSeek P1 * P3 P4 * + // Synopsis: Move P3 to P1.rowid if needed + // + // P1 is an open index cursor and P3 is a cursor on the corresponding + // table. This opcode does a deferred seek of the P3 table cursor + // to the row that corresponds to the current row of P1. + // + // This is a deferred seek. Nothing actually happens until + // the cursor is used to read a record. That way, if no reads + // occur, no unnecessary I/O happens. + // + // P4 may be an array of integers (type P4_INTARRAY) containing + // one entry for each column in the P3 table. If array entry a(i) + // is non-zero, then reading column a(i)-1 from cursor P3 is + // equivalent to performing the deferred seek and then reading column i + // from P1. This information is stored in P3 and used to redirect + // reads against P3 over to P1, thus possibly avoiding the need to + // seek and read cursor P3. + // Opcode: IdxRowid P1 P2 * * * + // Synopsis: r[P2]=rowid + // + // Write into register P2 an integer which is the last entry in the record at + // the end of the index key pointed to by cursor P1. This integer should be + // the rowid of the table entry to which this index entry points. + // + // See also: Rowid, MakeRecord. +__125: +__126: // Rowid that P1 current points to + + ; + pC24 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + // The IdxRowid and Seek opcodes are combined because of the commonality + // of sqlite3VdbeCursorRestore() and sqlite3VdbeIdxRowid(). + rc = Xsqlite3VdbeCursorRestore(tls, pC24) + + // sqlite3VbeCursorRestore() can only fail if the record has been deleted + // out from under the cursor. That will never happens for an IdxRowid + // or Seek opcode + if !(rc != SQLITE_OK) { + goto __692 + } + goto abort_due_to_error +__692: + ; + + if !(!(int32((*VdbeCursor)(unsafe.Pointer(pC24)).FnullRow) != 0)) { + goto __693 + } + *(*I64)(unsafe.Pointer(bp + 624 /* rowid */)) = int64(0) // Not needed. Only used to silence a warning. + rc = Xsqlite3VdbeIdxRowid(tls, db, *(*uintptr)(unsafe.Pointer(pC24 + 56 /* &.uc */)), bp+624 /* &rowid */) + if !(rc != SQLITE_OK) { + goto __695 + } + goto abort_due_to_error +__695: + ; + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_DeferredSeek) { + goto __696 + } + + pTabCur = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*8)) + + (*VdbeCursor)(unsafe.Pointer(pTabCur)).FnullRow = U8(0) + (*VdbeCursor)(unsafe.Pointer(pTabCur)).FmovetoTarget = *(*I64)(unsafe.Pointer(bp + 624 /* rowid */)) + (*VdbeCursor)(unsafe.Pointer(pTabCur)).FdeferredMoveto = U8(1) + + (*VdbeCursor)(unsafe.Pointer(pTabCur)).FaAltMap = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + (*VdbeCursor)(unsafe.Pointer(pTabCur)).FpAltCursor = pC24 + goto __697 +__696: + pOut = out2Prerelease(tls, p, pOp) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 624 /* rowid */)) +__697: + ; + goto __694 +__693: + ; + Xsqlite3VdbeMemSetNull(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56)) +__694: + ; + goto __8 + + // Opcode: FinishSeek P1 * * * * + // + // If cursor P1 was previously moved via OP_DeferredSeek, complete that + // seek operation now, without further delay. If the cursor seek has + // already occurred, this instruction is a no-op. +__127: // The P1 index cursor + + ; + pC25 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + if !((*VdbeCursor)(unsafe.Pointer(pC25)).FdeferredMoveto != 0) { + goto __698 + } + rc = Xsqlite3VdbeFinishMoveto(tls, pC25) + if !(rc != 0) { + goto __699 + } + goto abort_due_to_error +__699: + ; +__698: + ; + goto __8 + + // Opcode: IdxGE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY. Compare this key value against the index + // that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID + // fields at the end. + // + // If the P1 index entry is greater than or equal to the key value + // then jump to P2. Otherwise fall through to the next instruction. + // Opcode: IdxGT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY. Compare this key value against the index + // that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID + // fields at the end. + // + // If the P1 index entry is greater than the key value + // then jump to P2. Otherwise fall through to the next instruction. + // Opcode: IdxLT P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY or ROWID. Compare this key value against + // the index that P1 is currently pointing to, ignoring the PRIMARY KEY or + // ROWID on the P1 index. + // + // If the P1 index entry is less than the key value then jump to P2. + // Otherwise fall through to the next instruction. + // Opcode: IdxLE P1 P2 P3 P4 * + // Synopsis: key=r[P3@P4] + // + // The P4 register values beginning with P3 form an unpacked index + // key that omits the PRIMARY KEY or ROWID. Compare this key value against + // the index that P1 is currently pointing to, ignoring the PRIMARY KEY or + // ROWID on the P1 index. + // + // If the P1 index entry is less than or equal to the key value then jump + // to P2. Otherwise fall through to the next instruction. +__128: // jump +__129: // jump +__130: // jump +__131: + ; + pC26 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC26)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) < OP_IdxLT) { + goto __700 + } + + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).Fdefault_rc = int8(-1) + goto __701 +__700: + ; + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).Fdefault_rc = int8(0) +__701: + ; + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + /* Inlined version of sqlite3VdbeIdxKeyCompare() */ + + nCellKey = int64(0) + + pCur1 = *(*uintptr)(unsafe.Pointer(pC26 + 56 /* &.uc */)) + + nCellKey = I64(Xsqlite3BtreePayloadSize(tls, pCur1)) + // nCellKey will always be between 0 and 0xffffffff because of the way + // that btreeParseCellPtr() and sqlite3GetVarint32() are implemented + if !((nCellKey <= int64(0)) || (nCellKey > int64(0x7fffffff))) { + goto __702 + } + rc = Xsqlite3CorruptError(tls, 92650) + goto abort_due_to_error +__702: + ; + Xsqlite3VdbeMemInit(tls, bp+632 /* &m */, db, uint16(0)) + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, pCur1, U32(nCellKey), bp+632 /* &m */) + if !(rc != 0) { + goto __703 + } + goto abort_due_to_error +__703: + ; + res12 = Xsqlite3VdbeRecordCompareWithSkip(tls, (*Mem)(unsafe.Pointer(bp+632 /* &m */)).Fn, (*Mem)(unsafe.Pointer(bp+632 /* &m */)).Fz, bp+688 /* &r4 */, 0) + Xsqlite3VdbeMemRelease(tls, bp+632 /* &m */) + + // End of inlined sqlite3VdbeIdxKeyCompare() + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fopcode) & 1) == (OP_IdxLT & 1)) { + goto __704 + } + + res12 = -res12 + goto __705 +__704: + ; + res12++ +__705: + ; + + if !(res12 > 0) { + goto __706 + } + goto jump_to_p2 +__706: + ; + goto __8 + + // Opcode: Destroy P1 P2 P3 * * + // + // Delete an entire database table or index whose root page in the database + // file is given by P1. + // + // The table being destroyed is in the main database file if P3==0. If + // P3==1 then the table to be clear is in the auxiliary database file + // that is used to store tables create using CREATE TEMPORARY TABLE. + // + // If AUTOVACUUM is enabled then it is possible that another root page + // might be moved into the newly deleted root page in order to keep all + // root pages contiguous at the beginning of the database. The former + // value of the root page that moved - its value before the move occurred - + // is stored in register P2. If no page movement was required (because the + // table being dropped was already the last one in the database) then a + // zero is stored in register P2. If AUTOVACUUM is disabled then a zero + // is stored in register P2. + // + // This opcode throws an error if there are any active reader VMs when + // it is invoked. This is done to avoid the difficulty associated with + // updating existing cursors when a root page is moved in an AUTOVACUUM + // database. This error is thrown even if the database is not an AUTOVACUUM + // db in order to avoid introducing an incompatibility between autovacuum + // and non-autovacuum modes. + // + // See also: Clear +__132: + ; + + pOut = out2Prerelease(tls, p, pOp) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Null) + if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeRead > ((*Sqlite3)(unsafe.Pointer(db)).FnVDestroy + 1)) { + goto __707 + } + rc = SQLITE_LOCKED + (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) + goto abort_due_to_error + goto __708 +__707: + iDb2 = (*Op)(unsafe.Pointer(pOp)).Fp3 + + *(*int32)(unsafe.Pointer(bp + 712 /* iMoved */)) = 0 // Not needed. Only to silence a warning. + rc = Xsqlite3BtreeDropTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb2)*32)).FpBt, (*Op)(unsafe.Pointer(pOp)).Fp1, bp+712 /* &iMoved */) + (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Int) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*int32)(unsafe.Pointer(bp + 712 /* iMoved */))) + if !(rc != 0) { + goto __709 + } + goto abort_due_to_error +__709: + ; + if !(*(*int32)(unsafe.Pointer(bp + 712 /* iMoved */)) != 0) { + goto __710 + } + Xsqlite3RootPageMoved(tls, db, iDb2, uint32(*(*int32)(unsafe.Pointer(bp + 712 /* iMoved */))), uint32((*Op)(unsafe.Pointer(pOp)).Fp1)) + // All OP_Destroy operations occur on the same btree + + resetSchemaOnFault = (U8(iDb2 + 1)) +__710: + ; +__708: + ; + goto __8 + + // Opcode: Clear P1 P2 P3 + // + // Delete all contents of the database table or index whose root page + // in the database file is given by P1. But, unlike Destroy, do not + // remove the table or index from the database file. + // + // The table being clear is in the main database file if P2==0. If + // P2==1 then the table to be clear is in the auxiliary database file + // that is used to store tables create using CREATE TEMPORARY TABLE. + // + // If the P3 value is non-zero, then the row change count is incremented + // by the number of rows in the table being cleared. If P3 is greater + // than zero, then the value stored in register P3 is also incremented + // by the number of rows in the table being cleared. + // + // See also: Destroy +__133: + ; + *(*int32)(unsafe.Pointer(bp + 716 /* nChange */)) = 0 + + rc = Xsqlite3BtreeClearTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*32)).FpBt, int32(U32((*Op)(unsafe.Pointer(pOp)).Fp1)), bp+716 /* &nChange */) + if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { + goto __711 + } + *(*int32)(unsafe.Pointer(p + 60 /* &.nChange */)) += (*(*int32)(unsafe.Pointer(bp + 716 /* nChange */))) + if !((*Op)(unsafe.Pointer(pOp)).Fp3 > 0) { + goto __712 + } + + *(*I64)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56 /* &.u */ /* &.i */)) += (I64(*(*int32)(unsafe.Pointer(bp + 716 /* nChange */)))) +__712: + ; +__711: + ; + if !(rc != 0) { + goto __713 + } + goto abort_due_to_error +__713: + ; + goto __8 + + // Opcode: ResetSorter P1 * * * * + // + // Delete all contents from the ephemeral table or sorter + // that is open on cursor P1. + // + // This opcode only works for cursors used for sorting and + // opened with OP_OpenEphemeral or OP_SorterOpen. +__134: + ; + pC27 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + if !(int32((*VdbeCursor)(unsafe.Pointer((pC27))).FeCurType) == CURTYPE_SORTER) { + goto __714 + } + Xsqlite3VdbeSorterReset(tls, db, *(*uintptr)(unsafe.Pointer(pC27 + 56 /* &.uc */))) + goto __715 +__714: + ; + + rc = Xsqlite3BtreeClearTableOfCursor(tls, *(*uintptr)(unsafe.Pointer(pC27 + 56 /* &.uc */))) + if !(rc != 0) { + goto __716 + } + goto abort_due_to_error +__716: + ; +__715: + ; + goto __8 + + // Opcode: CreateBtree P1 P2 P3 * * + // Synopsis: r[P2]=root iDb=P1 flags=P3 + // + // Allocate a new b-tree in the main database file if P1==0 or in the + // TEMP database file if P1==1 or in an attached database if + // P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table + // it must be 2 (BTREE_BLOBKEY) for an index or WITHOUT ROWID table. + // The root page number of the new b-tree is stored in register P2. +__135: + ; + pOut = out2Prerelease(tls, p, pOp) + *(*Pgno)(unsafe.Pointer(bp + 720 /* pgno */)) = Pgno(0) + + pDb2 = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32) + + rc = Xsqlite3BtreeCreateTable(tls, (*Db)(unsafe.Pointer(pDb2)).FpBt, bp+720 /* &pgno */, (*Op)(unsafe.Pointer(pOp)).Fp3) + if !(rc != 0) { + goto __717 + } + goto abort_due_to_error +__717: + ; + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*Pgno)(unsafe.Pointer(bp + 720 /* pgno */))) + goto __8 + + // Opcode: SqlExec * * * P4 * + // + // Run the SQL statement or statements specified in the P4 string. +__136: + ; + (*Sqlite3)(unsafe.Pointer(db)).FnSqlExec++ + rc = Xsqlite3_exec(tls, db, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)), uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3)(unsafe.Pointer(db)).FnSqlExec-- + if !(rc != 0) { + goto __718 + } + goto abort_due_to_error +__718: + ; + goto __8 + + // Opcode: ParseSchema P1 * * P4 * + // + // Read and parse all entries from the schema table of database P1 + // that match the WHERE clause P4. If P4 is a NULL pointer, then the + // entire schema for P1 is reparsed. + // + // This opcode invokes the parser to create a new virtual machine, + // then runs the new virtual machine. It is thus a re-entrant opcode. +__137: + + // Any prepared statement that invokes this opcode will hold mutexes + // on every btree. This is a prerequisite for invoking + // sqlite3InitCallback(). + + iDb3 = (*Op)(unsafe.Pointer(pOp)).Fp1 + + if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) == uintptr(0)) { + goto __719 + } + Xsqlite3SchemaClear(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpSchema) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_SchemaKnownOk))) + rc = Xsqlite3InitOne(tls, db, iDb3, (p + 168 /* &.zErrMsg */), uint32((*Op)(unsafe.Pointer(pOp)).Fp5)) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(0), 0, 0x3) + goto __720 +__719: + + zSchema = ts + 4957 /* "sqlite_master" */ + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Fdb = db + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FiDb = iDb3 + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmInitFlags = U32(0) + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) + zSql = Xsqlite3MPrintf(tls, db, + ts+4971, /* "SELECT*FROM\"%w\"...." */ + libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + if !(zSql == uintptr(0)) { + goto __721 + } + rc = SQLITE_NOMEM + goto __722 +__721: + ; + (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy = U8(1) + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Frc = SQLITE_OK + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FnInitRow = U32(0) + + rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 + }{Xsqlite3InitCallback})), bp+728 /* &initData */, uintptr(0)) + if !(rc == SQLITE_OK) { + goto __723 + } + rc = (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Frc +__723: + ; + if !((rc == SQLITE_OK) && ((*InitData)(unsafe.Pointer(bp+728 /* &initData */)).FnInitRow == U32(0))) { + goto __724 + } + // The OP_ParseSchema opcode with a non-NULL P4 argument should parse + // at least one SQL statement. Any less than that indicates that + // the sqlite_schema table is corrupt. + rc = Xsqlite3CorruptError(tls, 92902) +__724: + ; + Xsqlite3DbFreeNN(tls, db, zSql) + (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy = U8(0) +__722: + ; +__720: + ; + if !(rc != 0) { + goto __725 + } + Xsqlite3ResetAllSchemasOfConnection(tls, db) + if !(rc == SQLITE_NOMEM) { + goto __726 + } + goto no_mem +__726: + ; + goto abort_due_to_error +__725: + ; + goto __8 + + // Opcode: LoadAnalysis P1 * * * * + // + // Read the sqlite_stat1 table for database P1 and load the content + // of that table into the internal index hash table. This will cause + // the analysis to be used when preparing all subsequent queries. +__138: + ; + rc = Xsqlite3AnalysisLoad(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1) + if !(rc != 0) { + goto __727 + } + goto abort_due_to_error +__727: + ; + goto __8 + + // Opcode: DropTable P1 * * P4 * + // + // Remove the internal (in-memory) data structures that describe + // the table named P4 in database P1. This is called after a table + // is dropped from disk (using the Destroy opcode) in order to keep + // the internal representation of the + // schema consistent with what is on disk. +__139: + ; + Xsqlite3UnlinkAndDeleteTable(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + goto __8 + + // Opcode: DropIndex P1 * * P4 * + // + // Remove the internal (in-memory) data structures that describe + // the index named P4 in database P1. This is called after an index + // is dropped from disk (using the Destroy opcode) + // in order to keep the internal representation of the + // schema consistent with what is on disk. +__140: + ; + Xsqlite3UnlinkAndDeleteIndex(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + goto __8 + + // Opcode: DropTrigger P1 * * P4 * + // + // Remove the internal (in-memory) data structures that describe + // the trigger named P4 in database P1. This is called after a trigger + // is dropped from disk (using the Destroy opcode) in order to keep + // the internal representation of the + // schema consistent with what is on disk. +__141: + ; + Xsqlite3UnlinkAndDeleteTrigger(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + goto __8 + + // Opcode: IntegrityCk P1 P2 P3 P4 P5 + // + // Do an analysis of the currently open database. Store in + // register P1 the text of an error message describing any problems. + // If no problems are found, store a NULL in register P1. + // + // The register P3 contains one less than the maximum number of allowed errors. + // At most reg(P3) errors will be reported. + // In other words, the analysis stops as soon as reg(P1) errors are + // seen. Reg(P1) is updated with the number of errors remaining. + // + // The root page numbers of all tables in the database are integers + // stored in P4_INTARRAY argument. + // + // If P5 is not zero, the check is done on the auxiliary database + // file, not the main database file. + // + // This opcode is used to implement the integrity_check pragma. +__142: // Register keeping track of errors remaining + + ; + nRoot = (*Op)(unsafe.Pointer(pOp)).Fp2 + aRoot = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + pnErr = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + z = Xsqlite3BtreeIntegrityCheck(tls, db, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp5)*32)).FpBt, (aRoot + 1*4), nRoot, + (int32(*(*I64)(unsafe.Pointer(pnErr /* &.u */))) + 1), bp+768 /* &nErr */) + Xsqlite3VdbeMemSetNull(tls, pIn1) + if !(*(*int32)(unsafe.Pointer(bp + 768 /* nErr */)) == 0) { + goto __728 + } + + goto __729 +__728: + if !(z == uintptr(0)) { + goto __730 + } + goto no_mem + goto __731 +__730: + *(*I64)(unsafe.Pointer(pnErr /* &.u */ /* &.i */)) -= (I64(*(*int32)(unsafe.Pointer(bp + 768 /* nErr */)) - 1)) + Xsqlite3VdbeMemSetStr(tls, pIn1, z, int64(-1), uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) +__731: + ; +__729: + ; + + Xsqlite3VdbeChangeEncoding(tls, pIn1, int32(encoding)) + goto check_for_interrupt + + // Opcode: RowSetAdd P1 P2 * * * + // Synopsis: rowset(P1)=r[P2] + // + // Insert the integer value held by register P2 into a RowSet object + // held in register P1. + // + // An assertion fails if P2 is not an integer. +__143: // in1, in2 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Blob) == 0) { + goto __732 + } + if !(Xsqlite3VdbeMemSetRowSet(tls, pIn1) != 0) { + goto __733 + } + goto no_mem +__733: + ; +__732: + ; + + Xsqlite3RowSetInsert(tls, (*Mem)(unsafe.Pointer(pIn1)).Fz, *(*I64)(unsafe.Pointer(pIn2 /* &.u */))) + goto __8 + + // Opcode: RowSetRead P1 P2 P3 * * + // Synopsis: r[P3]=rowset(P1) + // + // Extract the smallest value from the RowSet object in P1 + // and put that value into register P3. + // Or, if RowSet object P1 is initially empty, leave P3 + // unchanged and jump to instruction P2. +__144: + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !(((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Blob) == 0) || + (Xsqlite3RowSetNext(tls, (*Mem)(unsafe.Pointer(pIn1)).Fz, bp+776 /* &val */) == 0)) { + goto __734 + } + // The boolean index is empty + Xsqlite3VdbeMemSetNull(tls, pIn1) + + goto jump_to_p2_and_check_for_interrupt + goto __735 +__734: + // A value was pulled from the index + ; + Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56), *(*I64)(unsafe.Pointer(bp + 776 /* val */))) +__735: + ; + goto check_for_interrupt + + // Opcode: RowSetTest P1 P2 P3 P4 + // Synopsis: if r[P3] in rowset(P1) goto P2 + // + // Register P3 is assumed to hold a 64-bit integer value. If register P1 + // contains a RowSet object and that RowSet object contains + // the value held in P3, jump to register P2. Otherwise, insert the + // integer in P3 into the RowSet and continue on to the + // next opcode. + // + // The RowSet object is optimized for the case where sets of integers + // are inserted in distinct phases, which each set contains no duplicates. + // Each set is identified by a unique P4 value. The first set + // must have P4==0, the final set must have P4==-1, and for all other sets + // must have P4>0. + // + // This allows optimizations: (a) when P4==0 there is no need to test + // the RowSet object for P3, as it is guaranteed not to contain it, + // (b) when P4==-1 there is no need to insert the value, as it will + // never be tested for, and (c) when a value that is part of set X is + // inserted, there is no need to search to see if the same value was + // previously inserted as part of set X (only if it was previously + // inserted as part of some other set). +__145: + + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + iSet = *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + // If there is anything other than a rowset object in memory cell P1, + // delete it now and initialize P1 with an empty rowset + if !((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Blob) == 0) { + goto __736 + } + if !(Xsqlite3VdbeMemSetRowSet(tls, pIn1) != 0) { + goto __737 + } + goto no_mem +__737: + ; +__736: + ; + + if !(iSet != 0) { + goto __738 + } + exists = Xsqlite3RowSetTest(tls, (*Mem)(unsafe.Pointer(pIn1)).Fz, iSet, *(*I64)(unsafe.Pointer(pIn3 /* &.u */))) + + if !(exists != 0) { + goto __739 + } + goto jump_to_p2 +__739: + ; +__738: + ; + if !(iSet >= 0) { + goto __740 + } + Xsqlite3RowSetInsert(tls, (*Mem)(unsafe.Pointer(pIn1)).Fz, *(*I64)(unsafe.Pointer(pIn3 /* &.u */))) +__740: + ; + goto __8 + + // Opcode: Program P1 P2 P3 P4 P5 + // + // Execute the trigger program passed as P4 (type P4_SUBPROGRAM). + // + // P1 contains the address of the memory cell that contains the first memory + // cell in an array of values used as arguments to the sub-program. P2 + // contains the address to jump to if the sub-program throws an IGNORE + // exception using the RAISE() function. Register P3 contains the address + // of a memory cell in this (the parent) VM that is used to allocate the + // memory required by the sub-vdbe at runtime. + // + // P4 is a pointer to the VM containing the trigger program. + // + // If P5 is non-zero, then recursive program invocation is enabled. +__146: // Token identifying trigger + + pProgram = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + pRt = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + // If the p5 flag is clear, then recursive invocation of triggers is + // disabled for backwards compatibility (p5 is set if this sub-program + // is really a trigger, not a foreign key action, and the flag set + // and cleared by the "PRAGMA recursive_triggers" command is clear). + // + // It is recursive invocation of triggers, at the SQL level, that is + // disabled. In some cases a single trigger may generate more than one + // SubProgram (if the trigger may be executed with more than one different + // ON CONFLICT algorithm). SubProgram structures associated with a + // single trigger all have the same value for the SubProgram.token + // variable. + if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { + goto __741 + } + t1 = (*SubProgram)(unsafe.Pointer(pProgram)).Ftoken + pFrame2 = (*Vdbe)(unsafe.Pointer(p)).FpFrame +__742: + if !((pFrame2 != 0) && ((*VdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken != t1)) { + goto __744 + } + goto __743 +__743: + pFrame2 = (*VdbeFrame)(unsafe.Pointer(pFrame2)).FpParent + goto __742 + goto __744 +__744: + ; + if !(pFrame2 != 0) { + goto __745 + } + goto __8 +__745: + ; +__741: + ; + + if !((*Vdbe)(unsafe.Pointer(p)).FnFrame >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 10*4))) { + goto __746 + } + rc = SQLITE_ERROR + Xsqlite3VdbeError(tls, p, ts+5014 /* "too many levels ..." */, 0) + goto abort_due_to_error +__746: + ; + + // Register pRt is used to store the memory required to save the state + // of the current program, and the memory required at runtime to execute + // the trigger program. If this trigger has been fired before, then pRt + // is already allocated. Otherwise, it must be initialized. + if !((int32((*Mem)(unsafe.Pointer(pRt)).Fflags) & MEM_Blob) == 0) { + goto __747 + } + // SubProgram.nMem is set to the number of memory cells used by the + // program stored in SubProgram.aOp. As well as these, one memory + // cell is required for each cursor used by the program. Set local + // variable nMem (and later, VdbeFrame.nChildMem) to this value. + nMem = ((*SubProgram)(unsafe.Pointer(pProgram)).FnMem + (*SubProgram)(unsafe.Pointer(pProgram)).FnCsr) + + if !((*SubProgram)(unsafe.Pointer(pProgram)).FnCsr == 0) { + goto __749 + } + nMem++ +__749: + ; + nByte2 = (int32((((((uint64(unsafe.Sizeof(VdbeFrame{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))) + + (uint64(nMem) * uint64(unsafe.Sizeof(Mem{})))) + + (uint64((*SubProgram)(unsafe.Pointer(pProgram)).FnCsr) * uint64(unsafe.Sizeof(uintptr(0))))) + + (uint64(((*SubProgram)(unsafe.Pointer(pProgram)).FnOp + 7) / 8)))) + pFrame2 = Xsqlite3DbMallocZero(tls, db, uint64(nByte2)) + if !(!(pFrame2 != 0)) { + goto __750 + } + goto no_mem +__750: + ; + Xsqlite3VdbeMemRelease(tls, pRt) + (*Mem)(unsafe.Pointer(pRt)).Fflags = (U16(MEM_Blob | MEM_Dyn)) + (*Mem)(unsafe.Pointer(pRt)).Fz = pFrame2 + (*Mem)(unsafe.Pointer(pRt)).Fn = nByte2 + (*Mem)(unsafe.Pointer(pRt)).FxDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3VdbeFrameMemDel})) + + (*VdbeFrame)(unsafe.Pointer(pFrame2)).Fv = p + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem = nMem + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr = (*SubProgram)(unsafe.Pointer(pProgram)).FnCsr + (*VdbeFrame)(unsafe.Pointer(pFrame2)).Fpc = (int32((int64(pOp) - int64(aOp)) / 24)) + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FaMem = (*Vdbe)(unsafe.Pointer(p)).FaMem + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnMem = (*Vdbe)(unsafe.Pointer(p)).FnMem + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FapCsr = (*Vdbe)(unsafe.Pointer(p)).FapCsr + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnCursor = (*Vdbe)(unsafe.Pointer(p)).FnCursor + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FaOp = (*Vdbe)(unsafe.Pointer(p)).FaOp + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnOp = (*Vdbe)(unsafe.Pointer(p)).FnOp + (*VdbeFrame)(unsafe.Pointer(pFrame2)).Ftoken = (*SubProgram)(unsafe.Pointer(pProgram)).Ftoken + + pEnd = (((pFrame2) + 112) + uintptr((*VdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem)*56) + pMem2 = ((pFrame2) + 112) +__751: + if !(pMem2 != pEnd) { + goto __753 + } + (*Mem)(unsafe.Pointer(pMem2)).Fflags = U16(MEM_Undefined) + (*Mem)(unsafe.Pointer(pMem2)).Fdb = db + goto __752 +__752: + pMem2 += 56 + goto __751 + goto __753 +__753: + ; + goto __748 +__747: + pFrame2 = (*Mem)(unsafe.Pointer(pRt)).Fz + +__748: + ; + + (*Vdbe)(unsafe.Pointer(p)).FnFrame++ + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FpParent = (*Vdbe)(unsafe.Pointer(p)).FpFrame + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FlastRowid = (*Sqlite3)(unsafe.Pointer(db)).FlastRowid + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnChange = (*Vdbe)(unsafe.Pointer(p)).FnChange + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnDbChange = (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).FnChange + + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FpAuxData = (*Vdbe)(unsafe.Pointer(p)).FpAuxData + (*Vdbe)(unsafe.Pointer(p)).FpAuxData = uintptr(0) + (*Vdbe)(unsafe.Pointer(p)).FnChange = 0 + (*Vdbe)(unsafe.Pointer(p)).FpFrame = pFrame2 + (*Vdbe)(unsafe.Pointer(p)).FaMem = libc.AssignUintptr(&aMem, ((pFrame2) + 112)) + (*Vdbe)(unsafe.Pointer(p)).FnMem = (*VdbeFrame)(unsafe.Pointer(pFrame2)).FnChildMem + (*Vdbe)(unsafe.Pointer(p)).FnCursor = int32(U16((*VdbeFrame)(unsafe.Pointer(pFrame2)).FnChildCsr)) + (*Vdbe)(unsafe.Pointer(p)).FapCsr = (aMem + uintptr((*Vdbe)(unsafe.Pointer(p)).FnMem)*56) + (*VdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce = ((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*SubProgram)(unsafe.Pointer(pProgram)).FnCsr)*8) + libc.Xmemset(tls, (*VdbeFrame)(unsafe.Pointer(pFrame2)).FaOnce, 0, (uint64(((*SubProgram)(unsafe.Pointer(pProgram)).FnOp + 7) / 8))) + (*Vdbe)(unsafe.Pointer(p)).FaOp = libc.AssignUintptr(&aOp, (*SubProgram)(unsafe.Pointer(pProgram)).FaOp) + (*Vdbe)(unsafe.Pointer(p)).FnOp = (*SubProgram)(unsafe.Pointer(pProgram)).FnOp + pOp = (aOp + libc.UintptrFromInt32(-1)*24) + goto check_for_interrupt + + // Opcode: Param P1 P2 * * * + // + // This opcode is only ever present in sub-programs called via the + // OP_Program instruction. Copy a value currently stored in a memory + // cell of the calling (parent) frame to cell P2 in the current frames + // address space. This is used by trigger programs to access the new.* + // and old.* values. + // + // The address of the cell in the parent frame is determined by adding + // the value of the P1 argument to the value of the P1 argument to the + // calling OP_Program instruction. +__147: + pOut = out2Prerelease(tls, p, pOp) + pFrame3 = (*Vdbe)(unsafe.Pointer(p)).FpFrame + pIn = ((*VdbeFrame)(unsafe.Pointer(pFrame3)).FaMem + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp1+(*Op)(unsafe.Pointer((*VdbeFrame)(unsafe.Pointer(pFrame3)).FaOp+uintptr((*VdbeFrame)(unsafe.Pointer(pFrame3)).Fpc)*24)).Fp1))*56) + Xsqlite3VdbeMemShallowCopy(tls, pOut, pIn, MEM_Ephem) + goto __8 + + // Opcode: FkCounter P1 P2 * * * + // Synopsis: fkctr[P1]+=P2 + // + // Increment a "constraint counter" by P2 (P2 may be negative or positive). + // If P1 is non-zero, the database constraint counter is incremented + // (deferred foreign key constraints). Otherwise, if P1 is zero, the + // statement counter is incremented (immediate foreign key constraints). +__148: + if !(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DeferFKs)) != 0) { + goto __754 + } + *(*I64)(unsafe.Pointer(db + 752 /* &.nDeferredImmCons */)) += (I64((*Op)(unsafe.Pointer(pOp)).Fp2)) + goto __755 +__754: + if !((*Op)(unsafe.Pointer(pOp)).Fp1 != 0) { + goto __756 + } + *(*I64)(unsafe.Pointer(db + 744 /* &.nDeferredCons */)) += (I64((*Op)(unsafe.Pointer(pOp)).Fp2)) + goto __757 +__756: + *(*I64)(unsafe.Pointer(p + 80 /* &.nFkConstraint */)) += (I64((*Op)(unsafe.Pointer(pOp)).Fp2)) +__757: + ; +__755: + ; + goto __8 + + // Opcode: FkIfZero P1 P2 * * * + // Synopsis: if fkctr[P1]==0 goto P2 + // + // This opcode tests if a foreign key constraint-counter is currently zero. + // If so, jump to instruction P2. Otherwise, fall through to the next + // instruction. + // + // If P1 is non-zero, then the jump is taken if the database constraint-counter + // is zero (the one that counts deferred constraint violations). If P1 is + // zero, the jump is taken if the statement constraint-counter is zero + // (immediate foreign key constraint violations). +__149: // jump + if !((*Op)(unsafe.Pointer(pOp)).Fp1 != 0) { + goto __758 + } + + if !(((*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons == int64(0)) && ((*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == int64(0))) { + goto __760 + } + goto jump_to_p2 +__760: + ; + goto __759 +__758: + ; + if !(((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint == int64(0)) && ((*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons == int64(0))) { + goto __761 + } + goto jump_to_p2 +__761: + ; +__759: + ; + goto __8 + + // Opcode: MemMax P1 P2 * * * + // Synopsis: r[P1]=max(r[P1],r[P2]) + // + // P1 is a register in the root frame of this VM (the root frame is + // different from the current frame if this instruction is being executed + // within a sub-program). Set the value of register P1 to the maximum of + // its current value and the value in register P2. + // + // This instruction throws an error if the memory cell is not initially + // an integer. +__150: + if !((*Vdbe)(unsafe.Pointer(p)).FpFrame != 0) { + goto __762 + } + pFrame4 = (*Vdbe)(unsafe.Pointer(p)).FpFrame +__764: + if !((*VdbeFrame)(unsafe.Pointer(pFrame4)).FpParent != 0) { + goto __766 + } + goto __765 +__765: + pFrame4 = (*VdbeFrame)(unsafe.Pointer(pFrame4)).FpParent + goto __764 + goto __766 +__766: + ; + pIn1 = ((*VdbeFrame)(unsafe.Pointer(pFrame4)).FaMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + goto __763 +__762: + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) +__763: + ; + + Xsqlite3VdbeMemIntegerify(tls, pIn1) + pIn2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + Xsqlite3VdbeMemIntegerify(tls, pIn2) + if !(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) < *(*I64)(unsafe.Pointer(pIn2 /* &.u */))) { + goto __767 + } + *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) = *(*I64)(unsafe.Pointer(pIn2 /* &.u */)) +__767: + ; + goto __8 + + // Opcode: IfPos P1 P2 P3 * * + // Synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 + // + // Register P1 must contain an integer. + // If the value of register P1 is 1 or greater, subtract P3 from the + // value in P1 and jump to P2. + // + // If the initial value of register P1 is less than 1, then the + // value is unchanged and control passes through to the next instruction. +__151: // jump, in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) > int64(0)) { + goto __768 + } + *(*I64)(unsafe.Pointer(pIn1 /* &.u */ /* &.i */)) -= (I64((*Op)(unsafe.Pointer(pOp)).Fp3)) + goto jump_to_p2 +__768: + ; + goto __8 + + // Opcode: OffsetLimit P1 P2 P3 * * + // Synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) + // + // This opcode performs a commonly used computation associated with + // LIMIT and OFFSET process. r[P1] holds the limit counter. r[P3] + // holds the offset counter. The opcode computes the combined value + // of the LIMIT and OFFSET and stores that value in r[P2]. The r[P2] + // value computed is the total number of rows that will need to be + // visited in order to complete the query. + // + // If r[P3] is zero or negative, that means there is no OFFSET + // and r[P2] is set to be the value of the LIMIT, r[P1]. + // + // if r[P1] is zero or negative, that means there is no LIMIT + // and r[P2] is set to -1. + // + // Otherwise, r[P2] is set to the sum of r[P1] and r[P3]. +__152: + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + pOut = out2Prerelease(tls, p, pOp) + + *(*I64)(unsafe.Pointer(bp + 784 /* x3 */)) = *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) + if !((*(*I64)(unsafe.Pointer(bp + 784 /* x3 */)) <= int64(0)) || (Xsqlite3AddInt64(tls, bp+784 /* &x3 */, func() int64 { + if *(*I64)(unsafe.Pointer(pIn3 /* &.u */)) > int64(0) { + return *(*I64)(unsafe.Pointer(pIn3 /* &.u */)) + } + return int64(0) + }()) != 0)) { + goto __769 + } + // If the LIMIT is less than or equal to zero, loop forever. This + // is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then + // also loop forever. This is undocumented. In fact, one could argue + // that the loop should terminate. But assuming 1 billion iterations + // per second (far exceeding the capabilities of any current hardware) + // it would take nearly 300 years to actually reach the limit. So + // looping forever is a reasonable approximation. + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = int64(-1) + goto __770 +__769: + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 784 /* x3 */)) +__770: + ; + goto __8 + + // Opcode: IfNotZero P1 P2 * * * + // Synopsis: if r[P1]!=0 then r[P1]--, goto P2 + // + // Register P1 must contain an integer. If the content of register P1 is + // initially greater than zero, then decrement the value in register P1. + // If it is non-zero (negative or positive) and then also jump to P2. + // If register P1 is initially zero, leave it unchanged and fall through. +__153: // jump, in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) != 0) { + goto __771 + } + if !(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) > int64(0)) { + goto __772 + } + *(*I64)(unsafe.Pointer(pIn1 /* &.u */))-- +__772: + ; + goto jump_to_p2 +__771: + ; + goto __8 + + // Opcode: DecrJumpZero P1 P2 * * * + // Synopsis: if (--r[P1])==0 goto P2 + // + // Register P1 must hold an integer. Decrement the value in P1 + // and jump to P2 if the new value is exactly zero. +__154: // jump, in1 + pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) > ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) { + goto __773 + } + *(*I64)(unsafe.Pointer(pIn1 /* &.u */))-- +__773: + ; + + if !(*(*I64)(unsafe.Pointer(pIn1 /* &.u */)) == int64(0)) { + goto __774 + } + goto jump_to_p2 +__774: + ; + goto __8 + + // Opcode: AggStep * P2 P3 P4 P5 + // Synopsis: accum=r[P3] step(r[P2@P5]) + // + // Execute the xStep function for an aggregate. + // The function has P5 arguments. P4 is a pointer to the + // FuncDef structure that specifies the function. Register P3 is the + // accumulator. + // + // The P5 arguments are taken from register P2 and its + // successors. + // Opcode: AggInverse * P2 P3 P4 P5 + // Synopsis: accum=r[P3] inverse(r[P2@P5]) + // + // Execute the xInverse function for an aggregate. + // The function has P5 arguments. P4 is a pointer to the + // FuncDef structure that specifies the function. Register P3 is the + // accumulator. + // + // The P5 arguments are taken from register P2 and its + // successors. + // Opcode: AggStep1 P1 P2 P3 P4 P5 + // Synopsis: accum=r[P3] step(r[P2@P5]) + // + // Execute the xStep (if P1==0) or xInverse (if P1!=0) function for an + // aggregate. The function has P5 arguments. P4 is a pointer to the + // FuncDef structure that specifies the function. Register P3 is the + // accumulator. + // + // The P5 arguments are taken from register P2 and its + // successors. + // + // This opcode is initially coded as OP_AggStep0. On first evaluation, + // the FuncDef stored in P4 is converted into an sqlite3_context and + // the opcode is changed. In this way, the initialization of the + // sqlite3_context only happens once, instead of on each call to the + // step function. +__155: +__156: + ; + n4 = int32((*Op)(unsafe.Pointer(pOp)).Fp5) + + pCtx = Xsqlite3DbMallocRawNN(tls, db, (uint64((uint64(n4) * uint64(unsafe.Sizeof(uintptr(0)))) + ((uint64(unsafe.Sizeof(Sqlite3_context{})) + uint64(unsafe.Sizeof(Mem{}))) - uint64(unsafe.Sizeof(uintptr(0))))))) + if !(pCtx == uintptr(0)) { + goto __775 + } + goto no_mem +__775: + ; + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpMem = uintptr(0) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut = ((pCtx + 48 /* &.argv */) + uintptr(n4)*8) + Xsqlite3VdbeMemInit(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, db, uint16(MEM_Null)) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FiOp = (int32((int64(pOp) - int64(aOp)) / 24)) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe = p + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FskipFlag = U8(0) + (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = 0 + (*Sqlite3_context)(unsafe.Pointer(pCtx)).Fargc = U8(n4) + (*Op)(unsafe.Pointer(pOp)).Fp4type = int8(-16) + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = pCtx + + // OP_AggInverse must have P1==1 and OP_AggStep must have P1==0 + + (*Op)(unsafe.Pointer(pOp)).Fopcode = U8(OP_AggStep1) + +__157: + ; + pCtx1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + pMem3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + // If this function is inside of a trigger, the register array in aMem[] + // might change from one evaluation to the next. The next block of code + // checks to see if the register array has changed, and if so it + // reinitializes the relavant parts of the sqlite3_context object + if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpMem != pMem3) { + goto __776 + } + (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpMem = pMem3 + i4 = (int32((*Sqlite3_context)(unsafe.Pointer(pCtx1)).Fargc) - 1) +__777: + if !(i4 >= 0) { + goto __779 + } + *(*uintptr)(unsafe.Pointer((pCtx1 + 48 /* &.argv */) + uintptr(i4)*8)) = (aMem + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp2+i4))*56) + goto __778 +__778: + i4-- + goto __777 + goto __779 +__779: + ; +__776: + ; + + (*Mem)(unsafe.Pointer(pMem3)).Fn++ + + if !((*Op)(unsafe.Pointer(pOp)).Fp1 != 0) { + goto __780 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpFunc + 48 /* &.xInverse */))))(tls, pCtx1, int32((*Sqlite3_context)(unsafe.Pointer(pCtx1)).Fargc), pCtx1+48 /* &.argv */) + goto __781 +__780: + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpFunc + 24 /* &.xSFunc */))))(tls, pCtx1, int32((*Sqlite3_context)(unsafe.Pointer(pCtx1)).Fargc), pCtx1+48 /* &.argv */) +__781: + ; // IMP: R-24505-23230 + + if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError != 0) { + goto __782 + } + if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { + goto __783 + } + Xsqlite3VdbeError(tls, p, ts+2791 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError +__783: + ; + if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FskipFlag != 0) { + goto __784 + } + + i4 = (*Op)(unsafe.Pointer(pOp + libc.UintptrFromInt32(-1)*24)).Fp1 + if !(i4 != 0) { + goto __785 + } + Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr(i4)*56), int64(1)) +__785: + ; + (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FskipFlag = U8(0) +__784: + ; + Xsqlite3VdbeMemRelease(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut) + (*Mem)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut)).Fflags = U16(MEM_Null) + (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError = 0 + if !(rc != 0) { + goto __786 + } + goto abort_due_to_error +__786: + ; +__782: + ; + + goto __8 + + // Opcode: AggFinal P1 P2 * P4 * + // Synopsis: accum=r[P1] N=P2 + // + // P1 is the memory location that is the accumulator for an aggregate + // or window function. Execute the finalizer function + // for an aggregate and store the result in P1. + // + // P2 is the number of arguments that the step function takes and + // P4 is a pointer to the FuncDef for this function. The P2 + // argument is not used by this opcode. It is only there to disambiguate + // functions that can take varying numbers of arguments. The + // P4 argument is only needed for the case where + // the step function was not previously called. + // Opcode: AggValue * P2 P3 P4 * + // Synopsis: r[P3]=value N=P2 + // + // Invoke the xValue() function and store the result in register P3. + // + // P2 is the number of arguments that the step function takes and + // P4 is a pointer to the FuncDef for this function. The P2 + // argument is not used by this opcode. It is only there to disambiguate + // functions that can take varying numbers of arguments. The + // P4 argument is only needed for the case where + // the step function was not previously called. +__158: +__159: + ; + + pMem4 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { + goto __787 + } + + rc = Xsqlite3VdbeMemAggValue(tls, pMem4, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56), *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + pMem4 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + goto __788 +__787: + + rc = Xsqlite3VdbeMemFinalize(tls, pMem4, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) +__788: + ; + + if !(rc != 0) { + goto __789 + } + Xsqlite3VdbeError(tls, p, ts+2791 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + goto abort_due_to_error +__789: + ; + Xsqlite3VdbeChangeEncoding(tls, pMem4, int32(encoding)) + + if !(Xsqlite3VdbeMemTooBig(tls, pMem4) != 0) { + goto __790 + } + goto too_big +__790: + ; + goto __8 + + // Opcode: Checkpoint P1 P2 P3 * * + // + // Checkpoint database P1. This is a no-op if P1 is not currently in + // WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL, + // RESTART, or TRUNCATE. Write 1 or 0 into mem[P3] if the checkpoint returns + // SQLITE_BUSY or not, respectively. Write the number of pages in the + // WAL after the checkpoint into mem[P3+1] and the number of pages + // in the WAL that have been checkpointed after the checkpoint + // completes into mem[P3+2]. However on an error, mem[P3+1] and + // mem[P3+2] are initialized to -1. +__160: // Write results here + + ; + *(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */)) = 0 + *(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */ + 1*4)) = libc.AssignPtrInt32(bp+792 /* &aRes */ +2*4, -1) + + rc = Xsqlite3Checkpoint(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, (*Op)(unsafe.Pointer(pOp)).Fp2, (bp + 792 /* &aRes */ + 1*4), (bp + 792 /* &aRes */ + 2*4)) + if !(rc != 0) { + goto __791 + } + if !(rc != SQLITE_BUSY) { + goto __792 + } + goto abort_due_to_error +__792: + ; + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */)) = 1 +__791: + ; + i5 = 0 + pMem5 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) +__793: + if !(i5 < 3) { + goto __795 + } + Xsqlite3VdbeMemSetInt64(tls, pMem5, I64(*(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */ + uintptr(i5)*4)))) + goto __794 +__794: + i5++ + pMem5 += 56 + goto __793 + goto __795 +__795: + ; + goto __8 + + // Opcode: JournalMode P1 P2 P3 * * + // + // Change the journal mode of database P1 to P3. P3 must be one of the + // PAGER_JOURNALMODE_XXX values. If changing between the various rollback + // modes (delete, truncate, persist, off and memory), this is a simple + // operation. No IO is required. + // + // If changing into or out of WAL mode the procedure is more complicated. + // + // Write a string containing the final journal-mode to register P2. +__161: // Name of database file for pPager + + pOut = out2Prerelease(tls, p, pOp) + eNew = (*Op)(unsafe.Pointer(pOp)).Fp3 + + pBt1 = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpBt + pPager = Xsqlite3BtreePager(tls, pBt1) + eOld = Xsqlite3PagerGetJournalMode(tls, pPager) + if !(eNew == (-1)) { + goto __796 + } + eNew = eOld +__796: + ; + + if !(!(Xsqlite3PagerOkToChangeJournalMode(tls, pPager) != 0)) { + goto __797 + } + eNew = eOld +__797: + ; + + zFilename = Xsqlite3PagerFilename(tls, pPager, 1) + + // Do not allow a transition to journal_mode=WAL for a database + // in temporary storage or if the VFS does not support shared memory + if !((eNew == PAGER_JOURNALMODE_WAL) && + ((Xsqlite3Strlen30(tls, zFilename) == 0) || // Temp file + !(Xsqlite3PagerWalSupported(tls, pPager) != 0))) { + goto __798 + } + eNew = eOld +__798: + ; + + if !((eNew != eOld) && + ((eOld == PAGER_JOURNALMODE_WAL) || (eNew == PAGER_JOURNALMODE_WAL))) { + goto __799 + } + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeRead > 1)) { + goto __800 + } + rc = SQLITE_ERROR + Xsqlite3VdbeError(tls, p, + ts+5051, /* "cannot change %s..." */ + libc.VaList(bp+104, func() uintptr { + if eNew == PAGER_JOURNALMODE_WAL { + return ts + 5103 /* "into" */ + } + return ts + 5108 /* "out of" */ + }())) + goto abort_due_to_error + goto __801 +__800: + + if !(eOld == PAGER_JOURNALMODE_WAL) { + goto __802 + } + // If leaving WAL mode, close the log file. If successful, the call + // to PagerCloseWal() checkpoints and deletes the write-ahead-log + // file. An EXCLUSIVE lock may still be held on the database file + // after a successful return. + rc = Xsqlite3PagerCloseWal(tls, pPager, db) + if !(rc == SQLITE_OK) { + goto __804 + } + Xsqlite3PagerSetJournalMode(tls, pPager, eNew) +__804: + ; + goto __803 +__802: + if !(eOld == PAGER_JOURNALMODE_MEMORY) { + goto __805 + } + // Cannot transition directly from MEMORY to WAL. Use mode OFF + // as an intermediate + Xsqlite3PagerSetJournalMode(tls, pPager, PAGER_JOURNALMODE_OFF) +__805: + ; +__803: + ; + + // Open a transaction on the database file. Regardless of the journal + // mode, this transaction always uses a rollback journal. + + if !(rc == SQLITE_OK) { + goto __806 + } + rc = Xsqlite3BtreeSetVersion(tls, pBt1, func() int32 { + if eNew == PAGER_JOURNALMODE_WAL { + return 2 + } + return 1 + }()) +__806: + ; +__801: + ; +__799: + ; + + if !(rc != 0) { + goto __807 + } + eNew = eOld +__807: + ; + eNew = Xsqlite3PagerSetJournalMode(tls, pPager, eNew) + + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((MEM_Str | MEM_Static) | MEM_Term)) + (*Mem)(unsafe.Pointer(pOut)).Fz = Xsqlite3JournalModename(tls, eNew) + (*Mem)(unsafe.Pointer(pOut)).Fn = Xsqlite3Strlen30(tls, (*Mem)(unsafe.Pointer(pOut)).Fz) + (*Mem)(unsafe.Pointer(pOut)).Fenc = U8(SQLITE_UTF8) + Xsqlite3VdbeChangeEncoding(tls, pOut, int32(encoding)) + if !(rc != 0) { + goto __808 + } + goto abort_due_to_error +__808: + ; + goto __8 + + // Opcode: Vacuum P1 P2 * * * + // + // Vacuum the entire database P1. P1 is 0 for "main", and 2 or more + // for an attached database. The "temp" database may not be vacuumed. + // + // If P2 is not zero, then it is a register holding a string which is + // the file into which the result of vacuum should be written. When + // P2 is zero, the vacuum overwrites the original database. +__162: + ; + rc = Xsqlite3RunVacuum(tls, (p + 168 /* &.zErrMsg */), db, (*Op)(unsafe.Pointer(pOp)).Fp1, + func() uintptr { + if (*Op)(unsafe.Pointer(pOp)).Fp2 != 0 { + return (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + } + return uintptr(0) + }()) + if !(rc != 0) { + goto __809 + } + goto abort_due_to_error +__809: + ; + goto __8 + + // Opcode: IncrVacuum P1 P2 * * * + // + // Perform a single step of the incremental vacuum procedure on + // the P1 database. If the vacuum has finished, jump to instruction + // P2. Otherwise, fall through to the next instruction. +__163: + ; + + pBt2 = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpBt + rc = Xsqlite3BtreeIncrVacuum(tls, pBt2) + + if !(rc != 0) { + goto __810 + } + if !(rc != SQLITE_DONE) { + goto __811 + } + goto abort_due_to_error +__811: + ; + rc = SQLITE_OK + goto jump_to_p2 +__810: + ; + goto __8 + + // Opcode: Expire P1 P2 * * * + // + // Cause precompiled statements to expire. When an expired statement + // is executed using sqlite3_step() it will either automatically + // reprepare itself (if it was originally created using sqlite3_prepare_v2()) + // or it will fail with SQLITE_SCHEMA. + // + // If P1 is 0, then all SQL statements become expired. If P1 is non-zero, + // then only the currently executing statement is expired. + // + // If P2 is 0, then SQL statements are expired immediately. If P2 is 1, + // then running SQL statements are allowed to continue to run to completion. + // The P2==1 case occurs when a CREATE INDEX or similar schema change happens + // that might help the statement run faster but which does not affect the + // correctness of operation. +__164: + ; + if !(!((*Op)(unsafe.Pointer(pOp)).Fp1 != 0)) { + goto __812 + } + Xsqlite3ExpirePreparedStatements(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp2) + goto __813 +__812: + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, (Bft((*Op)(unsafe.Pointer(pOp)).Fp2 + 1)), 0, 0x3) +__813: + ; + goto __8 + + // Opcode: CursorLock P1 * * * * + // + // Lock the btree to which cursor P1 is pointing so that the btree cannot be + // written by an other cursor. +__165: + ; + pC28 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + Xsqlite3BtreeCursorPin(tls, *(*uintptr)(unsafe.Pointer(pC28 + 56 /* &.uc */))) + goto __8 + + // Opcode: CursorUnlock P1 * * * * + // + // Unlock the btree to which cursor P1 is pointing so that it can be + // written by other cursors. +__166: + ; + pC29 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + Xsqlite3BtreeCursorUnpin(tls, *(*uintptr)(unsafe.Pointer(pC29 + 56 /* &.uc */))) + goto __8 + + // Opcode: TableLock P1 P2 P3 P4 * + // Synopsis: iDb=P1 root=P2 write=P3 + // + // Obtain a lock on a particular table. This instruction is only used when + // the shared-cache feature is enabled. + // + // P1 is the index of the database in sqlite3.aDb[] of the database + // on which the lock is acquired. A readlock is obtained if P3==0 or + // a write lock if P3==1. + // + // P2 contains the root-page of the table to lock. + // + // P4 contains a pointer to the name of the table being locked. This is only + // used to generate an error message if the lock cannot be obtained. +__167: + isWriteLock = U8((*Op)(unsafe.Pointer(pOp)).Fp3) + if !((isWriteLock != 0) || (uint64(0) == ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ReadUncommit)))) { + goto __814 + } + p13 = (*Op)(unsafe.Pointer(pOp)).Fp1 + + rc = Xsqlite3BtreeLockTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(p13)*32)).FpBt, (*Op)(unsafe.Pointer(pOp)).Fp2, isWriteLock) + if !(rc != 0) { + goto __815 + } + if !((rc & 0xFF) == SQLITE_LOCKED) { + goto __816 + } + z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + Xsqlite3VdbeError(tls, p, ts+5115 /* "database table i..." */, libc.VaList(bp+112, z1)) +__816: + ; + goto abort_due_to_error +__815: + ; +__814: + ; + goto __8 + + // Opcode: VBegin * * * P4 * + // + // P4 may be a pointer to an sqlite3_vtab structure. If so, call the + // xBegin method for that table. + // + // Also, whether or not P4 is set, check that this is not being called from + // within a callback to a virtual table xSync() method. If it is, the error + // code will be set to SQLITE_LOCKED. +__168: + pVTab = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + rc = Xsqlite3VtabBegin(tls, db, pVTab) + if !(pVTab != 0) { + goto __817 + } + Xsqlite3VtabImportErrmsg(tls, p, (*VTable)(unsafe.Pointer(pVTab)).FpVtab) +__817: + ; + if !(rc != 0) { + goto __818 + } + goto abort_due_to_error +__818: + ; + goto __8 + + // Opcode: VCreate P1 P2 * * * + // + // P2 is a register that holds the name of a virtual table in database + // P1. Call the xCreate method for that table. +__169: // Name of the virtual table + + libc.Xmemset(tls, bp+808 /* &sMem1 */, 0, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(bp + 808 /* &sMem1 */)).Fdb = db + // Because P2 is always a static string, it is impossible for the + // sqlite3VdbeMemCopy() to fail + + rc = Xsqlite3VdbeMemCopy(tls, bp+808 /* &sMem1 */, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56)) + + zTab = Xsqlite3_value_text(tls, bp+808 /* &sMem1 */) + + if !(zTab != 0) { + goto __819 + } + rc = Xsqlite3VtabCallCreate(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, zTab, (p + 168 /* &.zErrMsg */)) +__819: + ; + Xsqlite3VdbeMemRelease(tls, bp+808 /* &sMem1 */) + if !(rc != 0) { + goto __820 + } + goto abort_due_to_error +__820: + ; + goto __8 + + // Opcode: VDestroy P1 * * P4 * + // + // P4 is the name of a virtual table in database P1. Call the xDestroy method + // of that table. +__170: + (*Sqlite3)(unsafe.Pointer(db)).FnVDestroy++ + rc = Xsqlite3VtabCallDestroy(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + (*Sqlite3)(unsafe.Pointer(db)).FnVDestroy-- + + if !(rc != 0) { + goto __821 + } + goto abort_due_to_error +__821: + ; + goto __8 + + // Opcode: VOpen P1 * * P4 * + // + // P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + // P1 is a cursor number. This opcode opens a cursor to the virtual + // table and stores that cursor in P1. +__171: + ; + pCur2 = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */)) = uintptr(0) + pVtab1 = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab + if !((pVtab1 == uintptr(0)) || ((*Sqlite3_vtab)(unsafe.Pointer(pVtab1)).FpModule == uintptr(0))) { + goto __822 + } + rc = SQLITE_LOCKED + goto abort_due_to_error +__822: + ; + pModule1 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab1)).FpModule + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pModule1 + 48 /* &.xOpen */))))(tls, pVtab1, bp+864 /* &pVCur */) + Xsqlite3VtabImportErrmsg(tls, p, pVtab1) + if !(rc != 0) { + goto __823 + } + goto abort_due_to_error +__823: + ; + + // Initialize sqlite3_vtab_cursor base class + (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */)))).FpVtab = pVtab1 + + // Initialize vdbe cursor object + pCur2 = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, 0, -1, uint8(CURTYPE_VTAB)) + if !(pCur2 != 0) { + goto __824 + } + *(*uintptr)(unsafe.Pointer(pCur2 + 56 /* &.uc */)) = *(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */)) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab1)).FnRef++ + goto __825 +__824: + ; + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule1 + 56 /* &.xClose */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */))) + goto no_mem +__825: + ; + goto __8 + + // Opcode: VFilter P1 P2 P3 P4 * + // Synopsis: iplan=r[P3] zplan='P4' + // + // P1 is a cursor opened using VOpen. P2 is an address to jump to if + // the filtered result set is empty. + // + // P4 is either NULL or a string that was generated by the xBestIndex + // method of the module. The interpretation of the P4 string is left + // to the module implementation. + // + // This opcode invokes the xFilter method on the virtual table specified + // by P1. The integer query plan parameter to xFilter is stored in register + // P3. Register P3+1 stores the argc parameter to be passed to the + // xFilter method. Registers P3+2..P3+1+argc are the argc + // additional parameters which are passed to + // xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter. + // + // A jump is made to P2 if the result set after filtering would be empty. +__172: + + pQuery = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + pArgc = (pQuery + 1*56) + pCur3 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pVCur1 = *(*uintptr)(unsafe.Pointer(pCur3 + 56 /* &.uc */)) + pVtab2 = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pVCur1)).FpVtab + pModule2 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab2)).FpModule + + // Grab the index number and argc parameters + + nArg = int32(*(*I64)(unsafe.Pointer(pArgc /* &.u */))) + iQuery = int32(*(*I64)(unsafe.Pointer(pQuery /* &.u */))) + + // Invoke the xFilter method + res13 = 0 + apArg = (*Vdbe)(unsafe.Pointer(p)).FapArg + i6 = 0 +__826: + if !(i6 < nArg) { + goto __828 + } + *(*uintptr)(unsafe.Pointer(apArg + uintptr(i6)*8)) = (pArgc + uintptr((i6+1))*56) + goto __827 +__827: + i6++ + goto __826 + goto __828 +__828: + ; + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((pModule2 + 64 /* &.xFilter */))))(tls, pVCur1, iQuery, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)), nArg, apArg) + Xsqlite3VtabImportErrmsg(tls, p, pVtab2) + if !(rc != 0) { + goto __829 + } + goto abort_due_to_error +__829: + ; + res13 = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule2 + 80 /* &.xEof */))))(tls, pVCur1) + (*VdbeCursor)(unsafe.Pointer(pCur3)).FnullRow = U8(0) + + if !(res13 != 0) { + goto __830 + } + goto jump_to_p2 +__830: + ; + goto __8 + + // Opcode: VColumn P1 P2 P3 * P5 + // Synopsis: r[P3]=vcolumn(P2) + // + // Store in register P3 the value of the P2-th column of + // the current row of the virtual-table of cursor P1. + // + // If the VColumn opcode is being used to fetch the value of + // an unchanging column during an UPDATE operation, then the P5 + // value is OPFLAG_NOCHNG. This will cause the sqlite3_vtab_nochange() + // function to return true inside the xColumn method of the virtual + // table implementation. The P5 column might also contain other + // bits (OPFLAG_LENGTHARG or OPFLAG_TYPEOFARG) but those bits are + // unused by OP_VColumn. +__173: + + pCur4 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + pDest2 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + + if !((*VdbeCursor)(unsafe.Pointer(pCur4)).FnullRow != 0) { + goto __831 + } + Xsqlite3VdbeMemSetNull(tls, pDest2) + goto __8 +__831: + ; + pVtab3 = (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur4 + 56 /* &.uc */)))).FpVtab + pModule3 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab3)).FpModule + + libc.Xmemset(tls, bp+872 /* &sContext */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) + (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FpOut = pDest2 + + if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_NOCHNG) != 0) { + goto __832 + } + Xsqlite3VdbeMemSetNull(tls, pDest2) + (*Mem)(unsafe.Pointer(pDest2)).Fflags = (U16(MEM_Null | MEM_Zero)) + *(*int32)(unsafe.Pointer(pDest2 /* &.u */)) = 0 + goto __833 +__832: + (*Mem)(unsafe.Pointer(pDest2)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pDest2))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Null)) +__833: + ; + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pModule3 + 88 /* &.xColumn */))))(tls, *(*uintptr)(unsafe.Pointer(pCur4 + 56 /* &.uc */)), bp+872 /* &sContext */, (*Op)(unsafe.Pointer(pOp)).Fp2) + Xsqlite3VtabImportErrmsg(tls, p, pVtab3) + if !((*Sqlite3_context)(unsafe.Pointer(bp+872 /* &sContext */)).FisError > 0) { + goto __834 + } + Xsqlite3VdbeError(tls, p, ts+2791 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + rc = (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FisError +__834: + ; + Xsqlite3VdbeChangeEncoding(tls, pDest2, int32(encoding)) + + if !(Xsqlite3VdbeMemTooBig(tls, pDest2) != 0) { + goto __835 + } + goto too_big +__835: + ; + if !(rc != 0) { + goto __836 + } + goto abort_due_to_error +__836: + ; + goto __8 + + // Opcode: VNext P1 P2 * * * + // + // Advance virtual table P1 to the next row in its result set and + // jump to instruction P2. Or, if the virtual table has reached + // the end of its result set, then fall through to the next instruction. +__174: + + res14 = 0 + pCur5 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + + if !((*VdbeCursor)(unsafe.Pointer(pCur5)).FnullRow != 0) { + goto __837 + } + goto __8 +__837: + ; + pVtab4 = (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur5 + 56 /* &.uc */)))).FpVtab + pModule4 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab4)).FpModule + + // Invoke the xNext() method of the module. There is no way for the + // underlying implementation to return an error if one occurs during + // xNext(). Instead, if an error occurs, true is returned (indicating that + // data is available) and the error code returned when xColumn or + // some other method is next invoked on the save virtual table cursor. + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule4 + 72 /* &.xNext */))))(tls, *(*uintptr)(unsafe.Pointer(pCur5 + 56 /* &.uc */))) + Xsqlite3VtabImportErrmsg(tls, p, pVtab4) + if !(rc != 0) { + goto __838 + } + goto abort_due_to_error +__838: + ; + res14 = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule4 + 80 /* &.xEof */))))(tls, *(*uintptr)(unsafe.Pointer(pCur5 + 56 /* &.uc */))) + + if !(!(res14 != 0)) { + goto __839 + } + // If there is data, jump to P2 + goto jump_to_p2_and_check_for_interrupt +__839: + ; + goto check_for_interrupt + + // Opcode: VRename P1 * * P4 * + // + // P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + // This opcode invokes the corresponding xRename method. The value + // in register P1 is passed as the zName argument to the xRename method. +__175: + + isLegacy = (int32((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LegacyAlter))) + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(SQLITE_LegacyAlter)) + pVtab5 = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab + pName = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) + + rc = Xsqlite3VdbeChangeEncoding(tls, pName, SQLITE_UTF8) + if !(rc != 0) { + goto __840 + } + goto abort_due_to_error +__840: + ; + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vtab)(unsafe.Pointer(pVtab5)).FpModule + 152 /* &.xRename */))))(tls, pVtab5, (*Mem)(unsafe.Pointer(pName)).Fz) + if !(isLegacy == 0) { + goto __841 + } + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_LegacyAlter))) +__841: + ; + Xsqlite3VtabImportErrmsg(tls, p, pVtab5) + libc.SetBitFieldPtr16Uint32(p+200 /* &.expired */, Bft(0), 0, 0x3) + if !(rc != 0) { + goto __842 + } + goto abort_due_to_error +__842: + ; + goto __8 + + // Opcode: VUpdate P1 P2 P3 P4 P5 + // Synopsis: data=r[P3@P2] + // + // P4 is a pointer to a virtual table object, an sqlite3_vtab structure. + // This opcode invokes the corresponding xUpdate method. P2 values + // are contiguous memory cells starting at P3 to pass to the xUpdate + // invocation. The value in register (P3+P2-1) corresponds to the + // p2th element of the argv array passed to xUpdate. + // + // The xUpdate method will do a DELETE or an INSERT or both. + // The argv[0] element (which corresponds to memory cell P3) + // is the rowid of a row to delete. If argv[0] is NULL then no + // deletion occurs. The argv[1] element is the rowid of the new + // row. This can be NULL to have the virtual table select the new + // rowid for itself. The subsequent elements in the array are + // the values of columns in the new row. + // + // If P2==1 then no insert is performed. argv[0] is the rowid of + // a row to delete. + // + // P1 is a boolean flag. If it is set to true and the xUpdate call + // is successful, then the value returned by sqlite3_last_insert_rowid() + // is set to the value of the rowid for the row just inserted. + // + // P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to + // apply in the case of a constraint failure on an insert or update. +__176: + ; + + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __843 + } + goto no_mem +__843: + ; + + pVtab6 = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab + if !((pVtab6 == uintptr(0)) || ((*Sqlite3_vtab)(unsafe.Pointer(pVtab6)).FpModule == uintptr(0))) { + goto __844 + } + rc = SQLITE_LOCKED + goto abort_due_to_error +__844: + ; + pModule5 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab6)).FpModule + nArg1 = (*Op)(unsafe.Pointer(pOp)).Fp2 + + if !((*Sqlite3_module)(unsafe.Pointer(pModule5)).FxUpdate != 0) { + goto __845 + } + vtabOnConflict = (*Sqlite3)(unsafe.Pointer(db)).FvtabOnConflict + apArg1 = (*Vdbe)(unsafe.Pointer(p)).FapArg + pX1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + i7 = 0 +__846: + if !(i7 < nArg1) { + goto __848 + } + + *(*uintptr)(unsafe.Pointer(apArg1 + uintptr(i7)*8)) = pX1 + pX1 += 56 + goto __847 +__847: + i7++ + goto __846 + goto __848 +__848: + ; + (*Sqlite3)(unsafe.Pointer(db)).FvtabOnConflict = U8((*Op)(unsafe.Pointer(pOp)).Fp5) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pModule5 + 104 /* &.xUpdate */))))(tls, pVtab6, nArg1, apArg1, bp+928 /* &rowid1 */) + (*Sqlite3)(unsafe.Pointer(db)).FvtabOnConflict = vtabOnConflict + Xsqlite3VtabImportErrmsg(tls, p, pVtab6) + if !((rc == SQLITE_OK) && ((*Op)(unsafe.Pointer(pOp)).Fp1 != 0)) { + goto __849 + } + + (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = *(*Sqlite_int64)(unsafe.Pointer(bp + 928 /* rowid1 */)) +__849: + ; + if !(((rc & 0xff) == SQLITE_CONSTRAINT) && ((*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FbConstraint != 0)) { + goto __850 + } + if !(int32((*Op)(unsafe.Pointer(pOp)).Fp5) == OE_Ignore) { + goto __852 + } + rc = SQLITE_OK + goto __853 +__852: + (*Vdbe)(unsafe.Pointer(p)).FerrorAction = func() uint8 { + if int32((*Op)(unsafe.Pointer(pOp)).Fp5) == OE_Replace { + return uint8(OE_Abort) + } + return uint8((*Op)(unsafe.Pointer(pOp)).Fp5) + }() +__853: + ; + goto __851 +__850: + (*Vdbe)(unsafe.Pointer(p)).FnChange++ +__851: + ; + if !(rc != 0) { + goto __854 + } + goto abort_due_to_error +__854: + ; +__845: + ; + goto __8 + + // Opcode: Pagecount P1 P2 * * * + // + // Write the current number of pages in database P1 to memory cell P2. +__177: // out2 + pOut = out2Prerelease(tls, p, pOp) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpBt)) + goto __8 + + // Opcode: MaxPgcnt P1 P2 P3 * * + // + // Try to set the maximum page count for database P1 to the value in P3. + // Do not let the maximum page count fall below the current page count and + // do not change the maximum page count value if P3==0. + // + // Store the maximum page count after the change in register P2. +__178: + + pOut = out2Prerelease(tls, p, pOp) + pBt3 = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpBt + newMax = uint32(0) + if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { + goto __855 + } + newMax = Xsqlite3BtreeLastPage(tls, pBt3) + if !(newMax < uint32((*Op)(unsafe.Pointer(pOp)).Fp3)) { + goto __856 + } + newMax = uint32((*Op)(unsafe.Pointer(pOp)).Fp3) +__856: + ; +__855: + ; + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(Xsqlite3BtreeMaxPageCount(tls, pBt3, newMax)) + goto __8 + + // Opcode: Function P1 P2 P3 P4 * + // Synopsis: r[P3]=func(r[P2@NP]) + // + // Invoke a user function (P4 is a pointer to an sqlite3_context object that + // contains a pointer to the function to be run) with arguments taken + // from register P2 and successors. The number of arguments is in + // the sqlite3_context object that P4 points to. + // The result of the function is stored + // in register P3. Register P3 must not be one of the function inputs. + // + // P1 is a 32-bit bitmask indicating whether or not each argument to the + // function was determined to be constant at compile time. If the first + // argument was constant then bit 0 of P1 is set. This is used to determine + // whether meta data associated with a user function argument using the + // sqlite3_set_auxdata() API may be safely retained until the next + // invocation of this opcode. + // + // See also: AggStep, AggFinal, PureFunc + // Opcode: PureFunc P1 P2 P3 P4 * + // Synopsis: r[P3]=func(r[P2@NP]) + // + // Invoke a user function (P4 is a pointer to an sqlite3_context object that + // contains a pointer to the function to be run) with arguments taken + // from register P2 and successors. The number of arguments is in + // the sqlite3_context object that P4 points to. + // The result of the function is stored + // in register P3. Register P3 must not be one of the function inputs. + // + // P1 is a 32-bit bitmask indicating whether or not each argument to the + // function was determined to be constant at compile time. If the first + // argument was constant then bit 0 of P1 is set. This is used to determine + // whether meta data associated with a user function argument using the + // sqlite3_set_auxdata() API may be safely retained until the next + // invocation of this opcode. + // + // This opcode works exactly like OP_Function. The only difference is in + // its name. This opcode is used in places where the function must be + // purely non-deterministic. Some built-in date/time functions can be + // either determinitic of non-deterministic, depending on their arguments. + // When those function are used in a non-deterministic way, they will check + // to see if they were called using OP_PureFunc instead of OP_Function, and + // if they were, they throw an error. + // + // See also: AggStep, AggFinal, Function +__179: // group +__180: + ; + pCtx2 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + // If this function is inside of a trigger, the register array in aMem[] + // might change from one evaluation to the next. The next block of code + // checks to see if the register array has changed, and if so it + // reinitializes the relavant parts of the sqlite3_context object + pOut = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FpOut != pOut) { + goto __857 + } + (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FpVdbe = p + (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FpOut = pOut + i8 = (int32((*Sqlite3_context)(unsafe.Pointer(pCtx2)).Fargc) - 1) +__858: + if !(i8 >= 0) { + goto __860 + } + *(*uintptr)(unsafe.Pointer((pCtx2 + 48 /* &.argv */) + uintptr(i8)*8)) = (aMem + uintptr(((*Op)(unsafe.Pointer(pOp)).Fp2+i8))*56) + goto __859 +__859: + i8-- + goto __858 + goto __860 +__860: + ; +__857: + ; + + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Null)) + + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FpFunc + 24 /* &.xSFunc */))))(tls, pCtx2, int32((*Sqlite3_context)(unsafe.Pointer(pCtx2)).Fargc), pCtx2+48 /* &.argv */) // IMP: R-24505-23230 + + // If the function returned an error, throw an exception + if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError != 0) { + goto __861 + } + if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { + goto __862 + } + Xsqlite3VdbeError(tls, p, ts+2791 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError +__862: + ; + Xsqlite3VdbeDeleteAuxData(tls, db, (p + 288 /* &.pAuxData */), (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FiOp, (*Op)(unsafe.Pointer(pOp)).Fp1) + (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError = 0 + if !(rc != 0) { + goto __863 + } + goto abort_due_to_error +__863: + ; +__861: + ; + + // Copy the result of the function into register P3 + if !((int32((*Mem)(unsafe.Pointer(pOut)).Fflags) & (MEM_Str | MEM_Blob)) != 0) { + goto __864 + } + Xsqlite3VdbeChangeEncoding(tls, pOut, int32(encoding)) + if !(Xsqlite3VdbeMemTooBig(tls, pOut) != 0) { + goto __865 + } + goto too_big +__865: + ; +__864: + ; + + goto __8 + + // Opcode: Trace P1 P2 * P4 * + // + // Write P4 on the statement trace output if statement tracing is + // enabled. + // + // Operand P1 must be 0x7fffffff and P2 must positive. + // Opcode: Init P1 P2 P3 P4 * + // Synopsis: Start at P2 + // + // Programs contain a single instance of this opcode as the very first + // opcode. + // + // If tracing is enabled (by the sqlite3_trace()) interface, then + // the UTF-8 string contained in P4 is emitted on the trace callback. + // Or if P4 is blank, use the string returned by sqlite3_sql(). + // + // If P2 is not zero, jump to instruction P2. + // + // Increment the value of P1 so that OP_Once opcodes will jump the + // first time they are evaluated for this run. + // + // If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT + // error is encountered. +__181: +__182: + + // If the P4 argument is not NULL, then it must be an SQL comment string. + // The "--" string is broken up to prevent false-positives with srcck1.c. + // + // This assert() provides evidence for: + // EVIDENCE-OF: R-50676-09860 The callback can compute the same text that + // would have been returned by the legacy sqlite3_trace() interface by + // using the X argument when X begins with "--" and invoking + // sqlite3_expanded_sql(P) otherwise. + ; + + // OP_Init is always instruction 0 + + if !((((int32((*Sqlite3)(unsafe.Pointer(db)).FmTrace) & (SQLITE_TRACE_STMT | SQLITE_TRACE_LEGACY)) != 0) && + !(int32((*Vdbe)(unsafe.Pointer(p)).FdoingRerun) != 0)) && + ((libc.AssignUintptr(&zTrace, func() uintptr { + if *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0 { + return *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + } + return (*Vdbe)(unsafe.Pointer(p)).FzSql + }())) != uintptr(0))) { + goto __866 + } + if !((int32((*Sqlite3)(unsafe.Pointer(db)).FmTrace) & SQLITE_TRACE_LEGACY) != 0) { + goto __867 + } + z2 = Xsqlite3VdbeExpandSql(tls, p, zTrace) + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((db + 240 /* &.trace */ /* &.xLegacy */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, z2) + Xsqlite3_free(tls, z2) + goto __868 +__867: + if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { + goto __869 + } + z3 = Xsqlite3MPrintf(tls, db, ts+5144 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) + Xsqlite3DbFree(tls, db, z3) + goto __870 +__869: + (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, zTrace) +__870: + ; +__868: + ; +__866: + ; + + if !((*Op)(unsafe.Pointer(pOp)).Fp1 >= Xsqlite3Config.FiOnceResetThreshold) { + goto __871 + } + if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_Trace) { + goto __872 + } + goto __8 +__872: + ; + i9 = 1 +__873: + if !(i9 < (*Vdbe)(unsafe.Pointer(p)).FnOp) { + goto __875 + } + if !(int32((*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp+uintptr(i9)*24)).Fopcode) == OP_Once) { + goto __876 + } + (*Op)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FaOp + uintptr(i9)*24)).Fp1 = 0 +__876: + ; + goto __874 +__874: + i9++ + goto __873 + goto __875 +__875: + ; + (*Op)(unsafe.Pointer(pOp)).Fp1 = 0 +__871: + ; + (*Op)(unsafe.Pointer(pOp)).Fp1++ + *(*U32)(unsafe.Pointer((p + 212 /* &.aCounter */) + 6*4))++ + goto jump_to_p2 + + // Opcode: Noop * * * * * + // + // Do nothing. This instruction is often useful as a jump + // destination. + // The magic Explain opcode are only inserted when explain==2 (which + // is to say when the EXPLAIN QUERY PLAN syntax is used.) + // This opcode records information from the optimizer. It is the + // the same as a no-op. This opcodesnever appears in a real VM program. +__183: // This is really OP_Noop, OP_Explain + ; + + goto __8 + + // **************************************************************************** + // + // The cases of the switch statement above this line should all be indented + // by 6 spaces. But the left-most 6 spaces have been removed to improve the + // readability. From this point on down, the normal indentation rules are + // restored. + // +__8: + ; + + // The following code adds nothing to the actual functionality + // of the program. It is only here for testing and debugging. + // On the other hand, it does burn CPU cycles every time through + // the evaluator loop. So we can leave it out when NDEBUG is defined. + goto __6 +__6: + pOp += 24 + goto __5 + goto __7 +__7: + ; // The end of the for(;;) loop the loops through opcodes + + // If we reach this point, it means that execution is finished with + // an error of some kind. +abort_due_to_error: + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __877 + } + rc = SQLITE_NOMEM + goto __878 +__877: + if !(rc == (SQLITE_IOERR | (int32(33) << 8))) { + goto __879 + } + rc = Xsqlite3CorruptError(tls, 94739) +__879: + ; +__878: + ; + + if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { + goto __880 + } + Xsqlite3VdbeError(tls, p, ts+2791 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) +__880: + ; + (*Vdbe)(unsafe.Pointer(p)).Frc = rc + Xsqlite3SystemError(tls, db, rc) + + Xsqlite3_log(tls, rc, ts+5150, /* "statement aborts..." */ + libc.VaList(bp+152, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3VdbeHalt(tls, p) + if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { + goto __881 + } + Xsqlite3OomFault(tls, db) +__881: + ; + rc = SQLITE_ERROR + if !(int32(resetSchemaOnFault) > 0) { + goto __882 + } + Xsqlite3ResetOneSchema(tls, db, (int32(resetSchemaOnFault) - 1)) +__882: + ; + + // This is the only way out of this procedure. We have to + // release the mutexes on btrees that were acquired at the + // top. +vdbe_return: +__883: + if !((nVmStep >= nProgressLimit) && ((*Sqlite3)(unsafe.Pointer(db)).FxProgress != uintptr(0))) { + goto __884 + } + nProgressLimit = nProgressLimit + (U64((*Sqlite3)(unsafe.Pointer(db)).FnProgressOps)) + if !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((db + 512 /* &.xProgress */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpProgressArg) != 0) { + goto __885 + } + nProgressLimit = (uint64(0xffffffff) | (U64((uint64(0xffffffff))) << 32)) + rc = SQLITE_INTERRUPT + goto abort_due_to_error +__885: + ; + goto __883 +__884: + ; + *(*U32)(unsafe.Pointer((p + 212 /* &.aCounter */) + 4*4)) += (U32(int32(nVmStep))) + Xsqlite3VdbeLeave(tls, p) + + return rc + + // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH + // is encountered. +too_big: + Xsqlite3VdbeError(tls, p, ts+4449 /* "string or blob t..." */, 0) + rc = SQLITE_TOOBIG + goto abort_due_to_error + + // Jump to here if a malloc() fails. +no_mem: + Xsqlite3OomFault(tls, db) + Xsqlite3VdbeError(tls, p, ts+5182 /* "out of memory" */, 0) + rc = SQLITE_NOMEM + goto abort_due_to_error + + // Jump to here if the sqlite3_interrupt() API sets the interrupt + // flag. +abort_due_to_interrupt: + ; + rc = SQLITE_INTERRUPT + goto abort_due_to_error + return int32(0) +} + +var azType = [4]uintptr{ts + 5196 /* "NOT NULL" */, ts + 5205 /* "UNIQUE" */, ts + 5212, /* "CHECK" */ + ts + 5218 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ +var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ +var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ +var vfsFlags int32 = ((((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) | SQLITE_OPEN_TRANSIENT_DB) /* sqlite3.c:90453:20 */ + +//************* End of vdbe.c *********************************************** +//************* Begin file vdbeblob.c *************************************** +// 2007 May 1 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code used to implement incremental BLOB I/O. + +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// Valid sqlite3_blob* handles point to Incrblob structures. +type Incrblob1 = struct { + FnByte int32 + FiOffset int32 + FiCol U16 + _ [6]byte + FpCsr uintptr + FpStmt uintptr + Fdb uintptr + FzDb uintptr + FpTab uintptr +} /* sqlite3.c:94829:9 */ + +//************* End of vdbe.c *********************************************** +//************* Begin file vdbeblob.c *************************************** +// 2007 May 1 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code used to implement incremental BLOB I/O. + +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// Valid sqlite3_blob* handles point to Incrblob structures. +type Incrblob = Incrblob1 /* sqlite3.c:94829:25 */ + +// This function is used by both blob_open() and blob_reopen(). It seeks +// the b-tree cursor associated with blob handle p to point to row iRow. +// If successful, SQLITE_OK is returned and subsequent calls to +// sqlite3_blob_read() or sqlite3_blob_write() access the specified row. +// +// If an error occurs, or if the specified row does not exist or does not +// contain a value of type TEXT or BLOB in the column nominated when the +// blob handle was opened, then an error code is returned and *pzErr may +// be set to point to a buffer containing an error message. It is the +// responsibility of the caller to free the error message buffer using +// sqlite3DbFree(). +// +// If an error does occur, then the b-tree cursor is closed. All subsequent +// calls to sqlite3_blob_read(), blob_write() or blob_reopen() will +// immediately return SQLITE_ABORT. +func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) int32 { /* sqlite3.c:94859:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 // Error code + var zErr uintptr = uintptr(0) // Error message + var v uintptr = (*Incrblob)(unsafe.Pointer(p)).FpStmt + + // Set the value of register r[1] in the SQL statement to integer iRow. + // This is done directly as a performance optimization + (*Mem)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FaMem + 1*56)).Fflags = U16(MEM_Int) + *(*I64)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FaMem + 1*56 /* &.u */)) = iRow + + // If the statement has been run before (and is paused at the OP_ResultRow) + // then back it up to the point where it does the OP_NotExists. This could + // have been down with an extra OP_Goto, but simply setting the program + // counter is faster. + if (*Vdbe)(unsafe.Pointer(v)).Fpc > 4 { + (*Vdbe)(unsafe.Pointer(v)).Fpc = 4 + + rc = Xsqlite3VdbeExec(tls, v) + } else { + rc = Xsqlite3_step(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) + } + if rc == SQLITE_ROW { + var pC uintptr = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FapCsr)) + var type1 U32 + if int32((*VdbeCursor)(unsafe.Pointer(pC)).FnHdrParsed) > int32((*Incrblob)(unsafe.Pointer(p)).FiCol) { + type1 = *(*U32)(unsafe.Pointer((pC + 120 /* &.aType */) + uintptr((*Incrblob)(unsafe.Pointer(p)).FiCol)*4)) + } else { + type1 = uint32(0) + } + + if type1 < U32(12) { + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5230, /* "cannot open valu..." */ + libc.VaList(bp, func() uintptr { + if type1 == U32(0) { + return ts + 5259 /* "null" */ + } + return func() uintptr { + if type1 == U32(7) { + return ts + 5264 /* "real" */ + } + return ts + 5269 /* "integer" */ + }() + }())) + rc = SQLITE_ERROR + Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) + (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) + } else { + (*Incrblob)(unsafe.Pointer(p)).FiOffset = int32(*(*U32)(unsafe.Pointer((pC + 120 /* &.aType */) + uintptr((int32((*Incrblob)(unsafe.Pointer(p)).FiCol)+int32((*VdbeCursor)(unsafe.Pointer(pC)).FnField)))*4))) + (*Incrblob)(unsafe.Pointer(p)).FnByte = int32(Xsqlite3VdbeSerialTypeLen(tls, type1)) + (*Incrblob)(unsafe.Pointer(p)).FpCsr = *(*uintptr)(unsafe.Pointer(pC + 56 /* &.uc */)) + Xsqlite3BtreeIncrblobCursor(tls, (*Incrblob)(unsafe.Pointer(p)).FpCsr) + } + } + + if rc == SQLITE_ROW { + rc = SQLITE_OK + } else if (*Incrblob)(unsafe.Pointer(p)).FpStmt != 0 { + rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) + (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) + if rc == SQLITE_OK { + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5277 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + rc = SQLITE_ERROR + } else { + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2791 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + } + } + + *(*uintptr)(unsafe.Pointer(pzErr)) = zErr + return rc +} + +// Open a blob handle. +func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, zColumn uintptr, iRow Sqlite_int64, wrFlag int32, ppBlob uintptr) int32 { /* sqlite3.c:94924:16: */ + bp := tls.Alloc(464) + defer tls.Free(464) + + var nAttempt int32 + var iCol int32 // Index of zColumn in row-record + var rc int32 + // var zErr uintptr at bp+456, 8 + + var pTab uintptr + var pBlob uintptr + // var sParse Parse at bp+48, 408 + + var j int32 + // Check that the column is not part of an FK child key definition. It + // is not necessary to check if it is part of a parent key, as parent + // key columns must be indexed. The check below will pick up this + // case. + var pFKey uintptr + var j1 int32 + var zFault uintptr + var pIdx uintptr + var v uintptr + var iDb int32 + var aOp uintptr + nAttempt = 0 + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = uintptr(0) + pBlob = uintptr(0) + + *(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0) + wrFlag = libc.BoolInt32(!(!(wrFlag != 0))) // wrFlag = (wrFlag ? 1 : 0); + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + pBlob = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Incrblob{}))) +__1: + libc.Xmemset(tls, bp+48 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) + if !(!(pBlob != 0)) { + goto __4 + } + goto blob_open_out +__4: + ; + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).Fdb = db + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = uintptr(0) + + Xsqlite3BtreeEnterAll(tls, db) + pTab = Xsqlite3LocateTable(tls, bp+48 /* &sParse */, uint32(0), zTable, zDb) + if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) { + goto __5 + } + pTab = uintptr(0) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5297 /* "cannot open virt..." */, libc.VaList(bp, zTable)) +__5: + ; + if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __6 + } + pTab = uintptr(0) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5327 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) +__6: + ; + if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { + goto __7 + } + pTab = uintptr(0) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5363 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) +__7: + ; + if !(!(pTab != 0)) { + goto __8 + } + if !((*Parse)(unsafe.Pointer(bp+48 /* &sParse */)).FzErrMsg != 0) { + goto __9 + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FzErrMsg + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FzErrMsg = uintptr(0) +__9: + ; + rc = SQLITE_ERROR + Xsqlite3BtreeLeaveAll(tls, db) + goto blob_open_out +__8: + ; + (*Incrblob)(unsafe.Pointer(pBlob)).FpTab = pTab + (*Incrblob)(unsafe.Pointer(pBlob)).FzDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema))*32)).FzDbSName + + // Now search pTab for the exact column. + iCol = 0 +__10: + if !(iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __12 + } + if !(Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName, zColumn) == 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + iCol++ + goto __10 + goto __12 +__12: + ; + if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __14 + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5384 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + rc = SQLITE_ERROR + Xsqlite3BtreeLeaveAll(tls, db) + goto blob_open_out +__14: + ; + + // If the value is being opened for writing, check that the + // column is not indexed, and that it is not part of a foreign key. + if !(wrFlag != 0) { + goto __15 + } + zFault = uintptr(0) + if !(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) { + goto __16 + } + pFKey = (*Table)(unsafe.Pointer(pTab)).FpFKey +__17: + if !(pFKey != 0) { + goto __19 + } + j = 0 +__20: + if !(j < (*FKey)(unsafe.Pointer(pFKey)).FnCol) { + goto __22 + } + if !((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FiFrom == iCol) { + goto __23 + } + zFault = ts + 5405 /* "foreign key" */ +__23: + ; + goto __21 +__21: + j++ + goto __20 + goto __22 +__22: + ; + goto __18 +__18: + pFKey = (*FKey)(unsafe.Pointer(pFKey)).FpNextFrom + goto __17 + goto __19 +__19: + ; +__16: + ; + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__24: + if !(pIdx != 0) { + goto __26 + } + j1 = 0 +__27: + if !(j1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)) { + goto __29 + } + // FIXME: Be smarter about indexes that use expressions + if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { + goto __30 + } + zFault = ts + 5417 /* "indexed" */ +__30: + ; + goto __28 +__28: + j1++ + goto __27 + goto __29 +__29: + ; + goto __25 +__25: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __24 + goto __26 +__26: + ; + if !(zFault != 0) { + goto __31 + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5425 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + rc = SQLITE_ERROR + Xsqlite3BtreeLeaveAll(tls, db) + goto blob_open_out +__31: + ; +__15: + ; + + (*Incrblob)(unsafe.Pointer(pBlob)).FpStmt = Xsqlite3VdbeCreate(tls, bp+48 /* &sParse */) + + if !((*Incrblob)(unsafe.Pointer(pBlob)).FpStmt != 0) { + goto __32 + } + v = (*Incrblob)(unsafe.Pointer(pBlob)).FpStmt + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + Xsqlite3VdbeAddOp4Int(tls, v, OP_Transaction, iDb, wrFlag, + (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpSchema)).Fschema_cookie, + (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpSchema)).FiGeneration) + Xsqlite3VdbeChangeP5(tls, v, uint16(1)) + + aOp = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(openBlob)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&openBlob)), iLn) + + // Make sure a mutex is held on the table to be accessed + Xsqlite3VdbeUsesBtree(tls, v, iDb) + + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) { + goto __33 + } + + // Configure the OP_TableLock instruction + (*VdbeOp)(unsafe.Pointer(aOp)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp)).Fp2 = int32((*Table)(unsafe.Pointer(pTab)).Ftnum) + (*VdbeOp)(unsafe.Pointer(aOp)).Fp3 = wrFlag + Xsqlite3VdbeChangeP4(tls, v, 2, (*Table)(unsafe.Pointer(pTab)).FzName, P4_TRANSIENT) +__33: + ; + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) { + goto __34 + } + + // Remove either the OP_OpenWrite or OpenRead. Set the P2 + // parameter of the other to pTab->tnum. + if !(wrFlag != 0) { + goto __35 + } + (*VdbeOp)(unsafe.Pointer(aOp + 1*24)).Fopcode = U8(OP_OpenWrite) +__35: + ; + (*VdbeOp)(unsafe.Pointer(aOp + 1*24)).Fp2 = int32((*Table)(unsafe.Pointer(pTab)).Ftnum) + (*VdbeOp)(unsafe.Pointer(aOp + 1*24)).Fp3 = iDb + + // Configure the number of columns. Configure the cursor to + // think that the table has one more column than it really + // does. An OP_Column to retrieve this imaginary column will + // always return an SQL NULL. This is useful because it means + // we can invoke OP_Column to fill in the vdbe cursors type + // and offset cache without causing any IO. + (*VdbeOp)(unsafe.Pointer(aOp + 1*24)).Fp4type = int8(-3) + *(*int32)(unsafe.Pointer(aOp + 1*24 + 16 /* &.p4 */)) = (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1) + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp2 = int32((*Table)(unsafe.Pointer(pTab)).FnCol) + + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FnVar = int16(0) + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FnMem = 1 + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FnTab = 1 + Xsqlite3VdbeMakeReady(tls, v, bp+48 /* &sParse */) +__34: + ; +__32: + ; + + (*Incrblob)(unsafe.Pointer(pBlob)).FiCol = U16(iCol) + (*Incrblob)(unsafe.Pointer(pBlob)).Fdb = db + Xsqlite3BtreeLeaveAll(tls, db) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __36 + } + goto blob_open_out +__36: + ; + rc = blobSeekToRow(tls, pBlob, iRow, bp+456 /* &zErr */) + goto __2 +__2: + if ((libc.PreIncInt32(&nAttempt, 1)) < SQLITE_MAX_SCHEMA_RETRY) && (rc == SQLITE_SCHEMA) { + goto __1 + } + goto __3 +__3: + ; + +blob_open_out: + if !((rc == SQLITE_OK) && (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0)) { + goto __37 + } + *(*uintptr)(unsafe.Pointer(ppBlob)) = pBlob + goto __38 +__37: + if !((pBlob != 0) && ((*Incrblob)(unsafe.Pointer(pBlob)).FpStmt != 0)) { + goto __39 + } + Xsqlite3VdbeFinalize(tls, (*Incrblob)(unsafe.Pointer(pBlob)).FpStmt) +__39: + ; + Xsqlite3DbFree(tls, db, pBlob) +__38: + ; + Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) != 0 { + return ts + 2791 /* "%s" */ + } + return uintptr(0) + }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + Xsqlite3ParserReset(tls, bp+48 /* &sParse */) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +var iLn int32 = 0 /* sqlite3.c:95067:24 */ +var openBlob = [6]VdbeOpList{ + {Fopcode: U8(OP_TableLock)}, // 0: Acquire a read or write lock + {Fopcode: U8(OP_OpenRead)}, // 1: Open a cursor + // blobSeekToRow() will initialize r[1] to the desired rowid + {Fopcode: U8(OP_NotExists), Fp2: int8(5), Fp3: int8(1)}, // 2: Seek the cursor to rowid=r[1] + {Fopcode: U8(OP_Column), Fp3: int8(1)}, // 3 + {Fopcode: U8(OP_ResultRow), Fp1: int8(1)}, // 4 + {Fopcode: U8(OP_Halt)}, // 5 +} /* sqlite3.c:95068:31 */ + +// Close a blob handle that was previously created using +// sqlite3_blob_open(). +func Xsqlite3_blob_close(tls *libc.TLS, pBlob uintptr) int32 { /* sqlite3.c:95157:16: */ + var p uintptr = pBlob + var rc int32 + var db uintptr + + if p != 0 { + var pStmt uintptr = (*Incrblob)(unsafe.Pointer(p)).FpStmt + db = (*Incrblob)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3DbFree(tls, db, p) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + rc = Xsqlite3_finalize(tls, pStmt) + } else { + rc = SQLITE_OK + } + return rc +} + +// Perform a read or write operation on a blob +func blobReadWrite(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset int32, xCall uintptr) int32 { /* sqlite3.c:95178:12: */ + var rc int32 + var p uintptr = pBlob + var v uintptr + var db uintptr + + if p == uintptr(0) { + return Xsqlite3MisuseError(tls, 95190) + } + db = (*Incrblob)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + v = (*Incrblob)(unsafe.Pointer(p)).FpStmt + + if ((n < 0) || (iOffset < 0)) || ((Sqlite3_int64(iOffset) + Sqlite3_int64(n)) > Sqlite3_int64((*Incrblob)(unsafe.Pointer(p)).FnByte)) { + // Request is out of range. Return a transient error. + rc = SQLITE_ERROR + } else if v == uintptr(0) { + // If there is no statement handle, then the blob-handle has + // already been invalidated. Return SQLITE_ABORT in this case. + rc = SQLITE_ABORT + } else { + // Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is + // returned, clean-up the statement handle. + + Xsqlite3BtreeEnterCursor(tls, (*Incrblob)(unsafe.Pointer(p)).FpCsr) + + if (xCall == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, U32, U32, uintptr) int32 + }{Xsqlite3BtreePutData}))) && ((*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0) { + // If a pre-update hook is registered and this is a write cursor, + // invoke it here. + // + // TODO: The preupdate-hook is passed SQLITE_DELETE, even though this + // operation should really be an SQLITE_UPDATE. This is probably + // incorrect, but is convenient because at this point the new.* values + // are not easily obtainable. And for the sessions module, an + // SQLITE_UPDATE where the PK columns do not change is handled in the + // same way as an SQLITE_DELETE (the SQLITE_DELETE code is actually + // slightly more efficient). Since you cannot write to a PK column + // using the incremental-blob API, this works. For the sessions module + // anyhow. + var iKey Sqlite3_int64 + iKey = Xsqlite3BtreeIntegerKey(tls, (*Incrblob)(unsafe.Pointer(p)).FpCsr) + Xsqlite3VdbePreUpdateHook(tls, + v, *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(v)).FapCsr)), SQLITE_DELETE, (*Incrblob)(unsafe.Pointer(p)).FzDb, (*Incrblob)(unsafe.Pointer(p)).FpTab, iKey, -1, int32((*Incrblob)(unsafe.Pointer(p)).FiCol)) + } + + rc = (*(*func(*libc.TLS, uintptr, U32, U32, uintptr) int32)(unsafe.Pointer(&xCall)))(tls, (*Incrblob)(unsafe.Pointer(p)).FpCsr, (uint32(iOffset + (*Incrblob)(unsafe.Pointer(p)).FiOffset)), uint32(n), z) + Xsqlite3BtreeLeaveCursor(tls, (*Incrblob)(unsafe.Pointer(p)).FpCsr) + if rc == SQLITE_ABORT { + Xsqlite3VdbeFinalize(tls, v) + (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) + } else { + (*Vdbe)(unsafe.Pointer(v)).Frc = rc + } + } + Xsqlite3Error(tls, db, rc) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Read data from a blob handle. +func Xsqlite3_blob_read(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset int32) int32 { /* sqlite3.c:95251:16: */ + return blobReadWrite(tls, pBlob, z, n, iOffset, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, U32, U32, uintptr) int32 + }{Xsqlite3BtreePayloadChecked}))) +} + +// Write data to a blob handle. +func Xsqlite3_blob_write(tls *libc.TLS, pBlob uintptr, z uintptr, n int32, iOffset int32) int32 { /* sqlite3.c:95258:16: */ + return blobReadWrite(tls, pBlob, z, n, iOffset, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, U32, U32, uintptr) int32 + }{Xsqlite3BtreePutData}))) +} + +// Query a blob handle for the size of the data. +// +// The Incrblob.nByte field is fixed for the lifetime of the Incrblob +// so no mutex is required for access. +func Xsqlite3_blob_bytes(tls *libc.TLS, pBlob uintptr) int32 { /* sqlite3.c:95268:16: */ + var p uintptr = pBlob + if (p != 0) && ((*Incrblob)(unsafe.Pointer(p)).FpStmt != 0) { + return (*Incrblob)(unsafe.Pointer(p)).FnByte + } + return 0 +} + +// Move an existing blob handle to point to a different row of the same +// database table. +// +// If an error occurs, or if the specified row does not exist or does not +// contain a blob or text value, then an error code is returned and the +// database handle error code and message set. If this happens, then all +// subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) +// immediately return SQLITE_ABORT. +func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int32 { /* sqlite3.c:95283:16: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 + var p uintptr = pBlob + var db uintptr + + if p == uintptr(0) { + return Xsqlite3MisuseError(tls, 95288) + } + db = (*Incrblob)(unsafe.Pointer(p)).Fdb + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + if (*Incrblob)(unsafe.Pointer(p)).FpStmt == uintptr(0) { + // If there is no statement handle, then the blob-handle has + // already been invalidated. Return SQLITE_ABORT in this case. + rc = SQLITE_ABORT + } else { + // var zErr uintptr at bp+8, 8 + + (*Vdbe)(unsafe.Pointer((*Incrblob)(unsafe.Pointer(p)).FpStmt)).Frc = SQLITE_OK + rc = blobSeekToRow(tls, p, iRow, bp+8 /* &zErr */) + if rc != SQLITE_OK { + Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { + return ts + 2791 /* "%s" */ + } + return uintptr(0) + }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) + } + + } + + rc = Xsqlite3ApiExit(tls, db, rc) + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +//************* End of vdbeblob.c ******************************************* +//************* Begin file vdbesort.c *************************************** +// 2011-07-09 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code for the VdbeSorter object, used in concert with +// a VdbeCursor to sort large numbers of keys for CREATE INDEX statements +// or by SELECT statements with ORDER BY clauses that cannot be satisfied +// using indexes and without LIMIT clauses. +// +// The VdbeSorter object implements a multi-threaded external merge sort +// algorithm that is efficient even if the number of elements being sorted +// exceeds the available memory. +// +// Here is the (internal, non-API) interface between this module and the +// rest of the SQLite system: +// +// sqlite3VdbeSorterInit() Create a new VdbeSorter object. +// +// sqlite3VdbeSorterWrite() Add a single new row to the VdbeSorter +// object. The row is a binary blob in the +// OP_MakeRecord format that contains both +// the ORDER BY key columns and result columns +// in the case of a SELECT w/ ORDER BY, or +// the complete record for an index entry +// in the case of a CREATE INDEX. +// +// sqlite3VdbeSorterRewind() Sort all content previously added. +// Position the read cursor on the +// first sorted element. +// +// sqlite3VdbeSorterNext() Advance the read cursor to the next sorted +// element. +// +// sqlite3VdbeSorterRowkey() Return the complete binary blob for the +// row currently under the read cursor. +// +// sqlite3VdbeSorterCompare() Compare the binary blob for the row +// currently under the read cursor against +// another binary blob X and report if +// X is strictly less than the read cursor. +// Used to enforce uniqueness in a +// CREATE UNIQUE INDEX statement. +// +// sqlite3VdbeSorterClose() Close the VdbeSorter object and reclaim +// all resources. +// +// sqlite3VdbeSorterReset() Refurbish the VdbeSorter for reuse. This +// is like Close() followed by Init() only +// much faster. +// +// The interfaces above must be called in a particular order. Write() can +// only occur in between Init()/Reset() and Rewind(). Next(), Rowkey(), and +// Compare() can only occur in between Rewind() and Close()/Reset(). i.e. +// +// Init() +// for each record: Write() +// Rewind() +// Rowkey()/Compare() +// Next() +// Close() +// +// Algorithm: +// +// Records passed to the sorter via calls to Write() are initially held +// unsorted in main memory. Assuming the amount of memory used never exceeds +// a threshold, when Rewind() is called the set of records is sorted using +// an in-memory merge sort. In this case, no temporary files are required +// and subsequent calls to Rowkey(), Next() and Compare() read records +// directly from main memory. +// +// If the amount of space used to store records in main memory exceeds the +// threshold, then the set of records currently in memory are sorted and +// written to a temporary file in "Packed Memory Array" (PMA) format. +// A PMA created at this point is known as a "level-0 PMA". Higher levels +// of PMAs may be created by merging existing PMAs together - for example +// merging two or more level-0 PMAs together creates a level-1 PMA. +// +// The threshold for the amount of main memory to use before flushing +// records to a PMA is roughly the same as the limit configured for the +// page-cache of the main database. Specifically, the threshold is set to +// the value returned by "PRAGMA main.page_size" multipled by +// that returned by "PRAGMA main.cache_size", in bytes. +// +// If the sorter is running in single-threaded mode, then all PMAs generated +// are appended to a single temporary file. Or, if the sorter is running in +// multi-threaded mode then up to (N+1) temporary files may be opened, where +// N is the configured number of worker threads. In this case, instead of +// sorting the records and writing the PMA to a temporary file itself, the +// calling thread usually launches a worker thread to do so. Except, if +// there are already N worker threads running, the main thread does the work +// itself. +// +// The sorter is running in multi-threaded mode if (a) the library was built +// with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater +// than zero, and (b) worker threads have been enabled at runtime by calling +// "PRAGMA threads=N" with some value of N greater than 0. +// +// When Rewind() is called, any data remaining in memory is flushed to a +// final PMA. So at this point the data is stored in some number of sorted +// PMAs within temporary files on disk. +// +// If there are fewer than SORTER_MAX_MERGE_COUNT PMAs in total and the +// sorter is running in single-threaded mode, then these PMAs are merged +// incrementally as keys are retreived from the sorter by the VDBE. The +// MergeEngine object, described in further detail below, performs this +// merge. +// +// Or, if running in multi-threaded mode, then a background thread is +// launched to merge the existing PMAs. Once the background thread has +// merged T bytes of data into a single sorted PMA, the main thread +// begins reading keys from that PMA while the background thread proceeds +// with merging the next T bytes of data. And so on. +// +// Parameter T is set to half the value of the memory threshold used +// by Write() above to determine when to create a new PMA. +// +// If there are more than SORTER_MAX_MERGE_COUNT PMAs in total when +// Rewind() is called, then a hierarchy of incremental-merges is used. +// First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on +// disk are merged together. Then T bytes of data from the second set, and +// so on, such that no operation ever merges more than SORTER_MAX_MERGE_COUNT +// PMAs at a time. This done is to improve locality. +// +// If running in multi-threaded mode and there are more than +// SORTER_MAX_MERGE_COUNT PMAs on disk when Rewind() is called, then more +// than one background thread may be created. Specifically, there may be +// one background thread for each temporary file on disk, and one background +// thread to merge the output of each of the others to a single PMA for +// the main thread to read from. +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various +// messages to stderr that may be helpful in understanding the performance +// characteristics of the sorter in multi-threaded mode. + +// Hard-coded maximum amount of data to accumulate in memory before flushing +// to a level 0 PMA. The purpose of this limit is to prevent various integer +// overflows. 512MiB. + +// Private objects used by the sorter +type MergeEngine1 = struct { + FnTree int32 + _ [4]byte + FpTask uintptr + FaTree uintptr + FaReadr uintptr +} /* sqlite3.c:21218:9 */ + +//************* End of vdbeblob.c ******************************************* +//************* Begin file vdbesort.c *************************************** +// 2011-07-09 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code for the VdbeSorter object, used in concert with +// a VdbeCursor to sort large numbers of keys for CREATE INDEX statements +// or by SELECT statements with ORDER BY clauses that cannot be satisfied +// using indexes and without LIMIT clauses. +// +// The VdbeSorter object implements a multi-threaded external merge sort +// algorithm that is efficient even if the number of elements being sorted +// exceeds the available memory. +// +// Here is the (internal, non-API) interface between this module and the +// rest of the SQLite system: +// +// sqlite3VdbeSorterInit() Create a new VdbeSorter object. +// +// sqlite3VdbeSorterWrite() Add a single new row to the VdbeSorter +// object. The row is a binary blob in the +// OP_MakeRecord format that contains both +// the ORDER BY key columns and result columns +// in the case of a SELECT w/ ORDER BY, or +// the complete record for an index entry +// in the case of a CREATE INDEX. +// +// sqlite3VdbeSorterRewind() Sort all content previously added. +// Position the read cursor on the +// first sorted element. +// +// sqlite3VdbeSorterNext() Advance the read cursor to the next sorted +// element. +// +// sqlite3VdbeSorterRowkey() Return the complete binary blob for the +// row currently under the read cursor. +// +// sqlite3VdbeSorterCompare() Compare the binary blob for the row +// currently under the read cursor against +// another binary blob X and report if +// X is strictly less than the read cursor. +// Used to enforce uniqueness in a +// CREATE UNIQUE INDEX statement. +// +// sqlite3VdbeSorterClose() Close the VdbeSorter object and reclaim +// all resources. +// +// sqlite3VdbeSorterReset() Refurbish the VdbeSorter for reuse. This +// is like Close() followed by Init() only +// much faster. +// +// The interfaces above must be called in a particular order. Write() can +// only occur in between Init()/Reset() and Rewind(). Next(), Rowkey(), and +// Compare() can only occur in between Rewind() and Close()/Reset(). i.e. +// +// Init() +// for each record: Write() +// Rewind() +// Rowkey()/Compare() +// Next() +// Close() +// +// Algorithm: +// +// Records passed to the sorter via calls to Write() are initially held +// unsorted in main memory. Assuming the amount of memory used never exceeds +// a threshold, when Rewind() is called the set of records is sorted using +// an in-memory merge sort. In this case, no temporary files are required +// and subsequent calls to Rowkey(), Next() and Compare() read records +// directly from main memory. +// +// If the amount of space used to store records in main memory exceeds the +// threshold, then the set of records currently in memory are sorted and +// written to a temporary file in "Packed Memory Array" (PMA) format. +// A PMA created at this point is known as a "level-0 PMA". Higher levels +// of PMAs may be created by merging existing PMAs together - for example +// merging two or more level-0 PMAs together creates a level-1 PMA. +// +// The threshold for the amount of main memory to use before flushing +// records to a PMA is roughly the same as the limit configured for the +// page-cache of the main database. Specifically, the threshold is set to +// the value returned by "PRAGMA main.page_size" multipled by +// that returned by "PRAGMA main.cache_size", in bytes. +// +// If the sorter is running in single-threaded mode, then all PMAs generated +// are appended to a single temporary file. Or, if the sorter is running in +// multi-threaded mode then up to (N+1) temporary files may be opened, where +// N is the configured number of worker threads. In this case, instead of +// sorting the records and writing the PMA to a temporary file itself, the +// calling thread usually launches a worker thread to do so. Except, if +// there are already N worker threads running, the main thread does the work +// itself. +// +// The sorter is running in multi-threaded mode if (a) the library was built +// with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater +// than zero, and (b) worker threads have been enabled at runtime by calling +// "PRAGMA threads=N" with some value of N greater than 0. +// +// When Rewind() is called, any data remaining in memory is flushed to a +// final PMA. So at this point the data is stored in some number of sorted +// PMAs within temporary files on disk. +// +// If there are fewer than SORTER_MAX_MERGE_COUNT PMAs in total and the +// sorter is running in single-threaded mode, then these PMAs are merged +// incrementally as keys are retreived from the sorter by the VDBE. The +// MergeEngine object, described in further detail below, performs this +// merge. +// +// Or, if running in multi-threaded mode, then a background thread is +// launched to merge the existing PMAs. Once the background thread has +// merged T bytes of data into a single sorted PMA, the main thread +// begins reading keys from that PMA while the background thread proceeds +// with merging the next T bytes of data. And so on. +// +// Parameter T is set to half the value of the memory threshold used +// by Write() above to determine when to create a new PMA. +// +// If there are more than SORTER_MAX_MERGE_COUNT PMAs in total when +// Rewind() is called, then a hierarchy of incremental-merges is used. +// First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on +// disk are merged together. Then T bytes of data from the second set, and +// so on, such that no operation ever merges more than SORTER_MAX_MERGE_COUNT +// PMAs at a time. This done is to improve locality. +// +// If running in multi-threaded mode and there are more than +// SORTER_MAX_MERGE_COUNT PMAs on disk when Rewind() is called, then more +// than one background thread may be created. Specifically, there may be +// one background thread for each temporary file on disk, and one background +// thread to merge the output of each of the others to a single PMA for +// the main thread to read from. +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various +// messages to stderr that may be helpful in understanding the performance +// characteristics of the sorter in multi-threaded mode. + +// Hard-coded maximum amount of data to accumulate in memory before flushing +// to a level 0 PMA. The purpose of this limit is to prevent various integer +// overflows. 512MiB. + +// Private objects used by the sorter +type MergeEngine = MergeEngine1 /* sqlite3.c:95477:28 */ // Merge PMAs together +type PmaReader1 = struct { + FiReadOff I64 + FiEof I64 + FnAlloc int32 + FnKey int32 + FpFd uintptr + FaAlloc uintptr + FaKey uintptr + FaBuffer uintptr + FnBuffer int32 + _ [4]byte + FaMap uintptr + FpIncr uintptr +} /* sqlite3.c:21218:9 */ + +// Merge PMAs together +type PmaReader = PmaReader1 /* sqlite3.c:95478:26 */ // Incrementally read one PMA +type PmaWriter1 = struct { + FeFWErr int32 + _ [4]byte + FaBuffer uintptr + FnBuffer int32 + FiBufStart int32 + FiBufEnd int32 + _ [4]byte + FiWriteOff I64 + FpFd uintptr +} /* sqlite3.c:95479:9 */ + +// Incrementally read one PMA +type PmaWriter = PmaWriter1 /* sqlite3.c:95479:26 */ // Incrementally write one PMA +type SorterRecord1 = struct { + FnVal int32 + _ [4]byte + Fu struct{ FpNext uintptr } +} /* sqlite3.c:21218:9 */ + +// Incrementally write one PMA +type SorterRecord = SorterRecord1 /* sqlite3.c:95480:29 */ // A record being sorted +type SortSubtask1 = struct { + FpThread uintptr + FbDone int32 + _ [4]byte + FpSorter uintptr + FpUnpacked uintptr + Flist SorterList + FnPMA int32 + _ [4]byte + FxCompare SorterCompare + Ffile SorterFile + Ffile2 SorterFile +} /* sqlite3.c:21218:9 */ + +// A record being sorted +type SortSubtask = SortSubtask1 /* sqlite3.c:95481:28 */ // A sub-task in the sort process +type SorterFile1 = struct { + FpFd uintptr + FiEof I64 +} /* sqlite3.c:21218:9 */ + +// A sub-task in the sort process +type SorterFile = SorterFile1 /* sqlite3.c:95482:27 */ // Temporary file object wrapper +type SorterList1 = struct { + FpList uintptr + FaMemory uintptr + FszPMA int32 + _ [4]byte +} /* sqlite3.c:21218:9 */ + +// Temporary file object wrapper +type SorterList = SorterList1 /* sqlite3.c:95483:27 */ // In-memory list of records +type IncrMerger1 = struct { + FpTask uintptr + FpMerger uintptr + FiStartOff I64 + FmxSz int32 + FbEof int32 + FbUseThread int32 + _ [4]byte + FaFile [2]SorterFile +} /* sqlite3.c:21218:9 */ + +// In-memory list of records +type IncrMerger = IncrMerger1 /* sqlite3.c:95484:27 */ + +// This object represents a single thread of control in a sort operation. +// Exactly VdbeSorter.nTask instances of this object are allocated +// as part of each VdbeSorter object. Instances are never allocated any +// other way. VdbeSorter.nTask is set to the number of worker threads allowed +// (see SQLITE_CONFIG_WORKER_THREADS) plus one (the main thread). Thus for +// single-threaded operation, there is exactly one instance of this object +// and for multi-threaded operation there are two or more instances. +// +// Essentially, this structure contains all those fields of the VdbeSorter +// structure for which each thread requires a separate instance. For example, +// each thread requries its own UnpackedRecord object to unpack records in +// as part of comparison operations. +// +// Before a background thread is launched, variable bDone is set to 0. Then, +// right before it exits, the thread itself sets bDone to 1. This is used for +// two purposes: +// +// 1. When flushing the contents of memory to a level-0 PMA on disk, to +// attempt to select a SortSubtask for which there is not already an +// active background thread (since doing so causes the main thread +// to block until it finishes). +// +// 2. If SQLITE_DEBUG_SORTER_THREADS is defined, to determine if a call +// to sqlite3ThreadJoin() is likely to block. Cases that are likely to +// block provoke debugging output. +// +// In both cases, the effects of the main thread seeing (bDone==0) even +// after the thread has finished are not dire. So we don't worry about +// memory barriers and such here. +type SorterCompare = uintptr /* sqlite3.c:95611:13 */ + +// Free all memory belonging to the PmaReader object passed as the +// argument. All structure fields are set to zero before returning. +func vdbePmaReaderClear(tls *libc.TLS, pReadr uintptr) { /* sqlite3.c:95786:13: */ + Xsqlite3_free(tls, (*PmaReader)(unsafe.Pointer(pReadr)).FaAlloc) + Xsqlite3_free(tls, (*PmaReader)(unsafe.Pointer(pReadr)).FaBuffer) + if (*PmaReader)(unsafe.Pointer(pReadr)).FaMap != 0 { + Xsqlite3OsUnfetch(tls, (*PmaReader)(unsafe.Pointer(pReadr)).FpFd, int64(0), (*PmaReader)(unsafe.Pointer(pReadr)).FaMap) + } + vdbeIncrFree(tls, (*PmaReader)(unsafe.Pointer(pReadr)).FpIncr) + libc.Xmemset(tls, pReadr, 0, uint64(unsafe.Sizeof(PmaReader{}))) +} + +// Read the next nByte bytes of data from the PMA p. +// If successful, set *ppOut to point to a buffer containing the data +// and return SQLITE_OK. Otherwise, if an error occurs, return an SQLite +// error code. +// +// The buffer returned in *ppOut is only valid until the +// next call to this function. +func vdbePmaReadBlob(tls *libc.TLS, p uintptr, nByte int32, ppOut uintptr) int32 { /* sqlite3.c:95803:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var iBuf int32 // Offset within buffer to read from + var nAvail int32 // Bytes of data available in buffer + + if (*PmaReader)(unsafe.Pointer(p)).FaMap != 0 { + *(*uintptr)(unsafe.Pointer(ppOut)) = ((*PmaReader)(unsafe.Pointer(p)).FaMap + uintptr((*PmaReader)(unsafe.Pointer(p)).FiReadOff)) + *(*I64)(unsafe.Pointer(p /* &.iReadOff */)) += (I64(nByte)) + return SQLITE_OK + } + + // If there is no more data to be read from the buffer, read the next + // p->nBuffer bytes of data from the file into it. Or, if there are less + // than p->nBuffer bytes remaining in the PMA, read all remaining data. + iBuf = (int32((*PmaReader)(unsafe.Pointer(p)).FiReadOff % I64((*PmaReader)(unsafe.Pointer(p)).FnBuffer))) + if iBuf == 0 { + var nRead int32 // Bytes to read from disk + var rc int32 // sqlite3OsRead() return code + + // Determine how many bytes of data to read. + if ((*PmaReader)(unsafe.Pointer(p)).FiEof - (*PmaReader)(unsafe.Pointer(p)).FiReadOff) > I64((*PmaReader)(unsafe.Pointer(p)).FnBuffer) { + nRead = (*PmaReader)(unsafe.Pointer(p)).FnBuffer + } else { + nRead = (int32((*PmaReader)(unsafe.Pointer(p)).FiEof - (*PmaReader)(unsafe.Pointer(p)).FiReadOff)) + } + + // Readr data from the file. Return early if an error occurs. + rc = Xsqlite3OsRead(tls, (*PmaReader)(unsafe.Pointer(p)).FpFd, (*PmaReader)(unsafe.Pointer(p)).FaBuffer, nRead, (*PmaReader)(unsafe.Pointer(p)).FiReadOff) + + if rc != SQLITE_OK { + return rc + } + } + nAvail = ((*PmaReader)(unsafe.Pointer(p)).FnBuffer - iBuf) + + if nByte <= nAvail { + // The requested data is available in the in-memory buffer. In this + // case there is no need to make a copy of the data, just return a + // pointer into the buffer to the caller. + *(*uintptr)(unsafe.Pointer(ppOut)) = ((*PmaReader)(unsafe.Pointer(p)).FaBuffer + uintptr(iBuf)) + *(*I64)(unsafe.Pointer(p /* &.iReadOff */)) += (I64(nByte)) + } else { + // The requested data is not all available in the in-memory buffer. + // In this case, allocate space at p->aAlloc[] to copy the requested + // range into. Then return a copy of pointer p->aAlloc to the caller. + var nRem int32 // Bytes remaining to copy + + // Extend the p->aAlloc[] allocation if required. + if (*PmaReader)(unsafe.Pointer(p)).FnAlloc < nByte { + var aNew uintptr + var nNew Sqlite3_int64 = func() int64 { + if (int64(128)) > (int64(2) * Sqlite3_int64((*PmaReader)(unsafe.Pointer(p)).FnAlloc)) { + return int64(128) + } + return (int64(2) * Sqlite3_int64((*PmaReader)(unsafe.Pointer(p)).FnAlloc)) + }() + for Sqlite3_int64(nByte) > nNew { + nNew = (nNew * int64(2)) + } + aNew = Xsqlite3Realloc(tls, (*PmaReader)(unsafe.Pointer(p)).FaAlloc, uint64(nNew)) + if !(aNew != 0) { + return SQLITE_NOMEM + } + (*PmaReader)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + (*PmaReader)(unsafe.Pointer(p)).FaAlloc = aNew + } + + // Copy as much data as is available in the buffer into the start of + // p->aAlloc[]. + libc.Xmemcpy(tls, (*PmaReader)(unsafe.Pointer(p)).FaAlloc, ((*PmaReader)(unsafe.Pointer(p)).FaBuffer + uintptr(iBuf)), uint64(nAvail)) + *(*I64)(unsafe.Pointer(p /* &.iReadOff */)) += (I64(nAvail)) + nRem = (nByte - nAvail) + + // The following loop copies up to p->nBuffer bytes per iteration into + // the p->aAlloc[] buffer. + for nRem > 0 { + var rc int32 // vdbePmaReadBlob() return code + var nCopy int32 // Number of bytes to copy + // var aNext uintptr at bp, 8 + // Pointer to buffer to copy data from + + nCopy = nRem + if nRem > (*PmaReader)(unsafe.Pointer(p)).FnBuffer { + nCopy = (*PmaReader)(unsafe.Pointer(p)).FnBuffer + } + rc = vdbePmaReadBlob(tls, p, nCopy, bp /* &aNext */) + if rc != SQLITE_OK { + return rc + } + + libc.Xmemcpy(tls, ((*PmaReader)(unsafe.Pointer(p)).FaAlloc + uintptr((nByte - nRem))), *(*uintptr)(unsafe.Pointer(bp /* aNext */)), uint64(nCopy)) + nRem = nRem - (nCopy) + } + + *(*uintptr)(unsafe.Pointer(ppOut)) = (*PmaReader)(unsafe.Pointer(p)).FaAlloc + } + + return SQLITE_OK +} + +// Read a varint from the stream of data accessed by p. Set *pnOut to +// the value read. +func vdbePmaReadVarint(tls *libc.TLS, p uintptr, pnOut uintptr) int32 { /* sqlite3.c:95897:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var iBuf int32 + + if (*PmaReader)(unsafe.Pointer(p)).FaMap != 0 { + *(*I64)(unsafe.Pointer(p /* &.iReadOff */)) += (I64(Xsqlite3GetVarint(tls, ((*PmaReader)(unsafe.Pointer(p)).FaMap + uintptr((*PmaReader)(unsafe.Pointer(p)).FiReadOff)), pnOut))) + } else { + iBuf = (int32((*PmaReader)(unsafe.Pointer(p)).FiReadOff % I64((*PmaReader)(unsafe.Pointer(p)).FnBuffer))) + if (iBuf != 0) && (((*PmaReader)(unsafe.Pointer(p)).FnBuffer - iBuf) >= 9) { + *(*I64)(unsafe.Pointer(p /* &.iReadOff */)) += (I64(Xsqlite3GetVarint(tls, ((*PmaReader)(unsafe.Pointer(p)).FaBuffer + uintptr(iBuf)), pnOut))) + } else { + // var aVarint [16]U8 at bp+8, 16 + + // var a uintptr at bp, 8 + + var i int32 = 0 + var rc int32 + for ok := true; ok; ok = ((int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* a */))))) & 0x80) != 0) { + rc = vdbePmaReadBlob(tls, p, 1, bp /* &a */) + if rc != 0 { + return rc + } + *(*U8)(unsafe.Pointer(bp + 8 /* &aVarint[0] */ + uintptr(((libc.PostIncInt32(&i, 1)) & 0xf)))) = *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* a */)))) + } + Xsqlite3GetVarint(tls, bp+8 /* &aVarint[0] */, pnOut) + } + } + + return SQLITE_OK +} + +// Attempt to memory map file pFile. If successful, set *pp to point to the +// new mapping and return SQLITE_OK. If the mapping is not attempted +// (because the file is too large or the VFS layer is configured not to use +// mmap), return SQLITE_OK and set *pp to NULL. +// +// Or, if an error occurs, return an SQLite error code. The final value of +// *pp is undefined in this case. +func vdbeSorterMapFile(tls *libc.TLS, pTask uintptr, pFile uintptr, pp uintptr) int32 { /* sqlite3.c:95930:12: */ + var rc int32 = SQLITE_OK + if (*SorterFile)(unsafe.Pointer(pFile)).FiEof <= (I64((*Sqlite3)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb)).FnMaxSorterMmap)) { + var pFd uintptr = (*SorterFile)(unsafe.Pointer(pFile)).FpFd + if (*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer(pFd)).FpMethods)).FiVersion >= 3 { + rc = Xsqlite3OsFetch(tls, pFd, int64(0), int32((*SorterFile)(unsafe.Pointer(pFile)).FiEof), pp) + + } + } + return rc +} + +// Attach PmaReader pReadr to file pFile (if it is not already attached to +// that file) and seek it to offset iOff within the file. Return SQLITE_OK +// if successful, or an SQLite error code if an error occurs. +func vdbePmaReaderSeek(tls *libc.TLS, pTask uintptr, pReadr uintptr, pFile uintptr, iOff I64) int32 { /* sqlite3.c:95947:12: */ + var rc int32 = SQLITE_OK + + if Xsqlite3FaultSim(tls, 201) != 0 { + return (SQLITE_IOERR | (int32(1) << 8)) + } + if (*PmaReader)(unsafe.Pointer(pReadr)).FaMap != 0 { + Xsqlite3OsUnfetch(tls, (*PmaReader)(unsafe.Pointer(pReadr)).FpFd, int64(0), (*PmaReader)(unsafe.Pointer(pReadr)).FaMap) + (*PmaReader)(unsafe.Pointer(pReadr)).FaMap = uintptr(0) + } + (*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff = iOff + (*PmaReader)(unsafe.Pointer(pReadr)).FiEof = (*SorterFile)(unsafe.Pointer(pFile)).FiEof + (*PmaReader)(unsafe.Pointer(pReadr)).FpFd = (*SorterFile)(unsafe.Pointer(pFile)).FpFd + + rc = vdbeSorterMapFile(tls, pTask, pFile, (pReadr + 64 /* &.aMap */)) + if (rc == SQLITE_OK) && ((*PmaReader)(unsafe.Pointer(pReadr)).FaMap == uintptr(0)) { + var pgsz int32 = (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fpgsz + var iBuf int32 = (int32((*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff % I64(pgsz))) + if (*PmaReader)(unsafe.Pointer(pReadr)).FaBuffer == uintptr(0) { + (*PmaReader)(unsafe.Pointer(pReadr)).FaBuffer = Xsqlite3Malloc(tls, uint64(pgsz)) + if (*PmaReader)(unsafe.Pointer(pReadr)).FaBuffer == uintptr(0) { + rc = SQLITE_NOMEM + } + (*PmaReader)(unsafe.Pointer(pReadr)).FnBuffer = pgsz + } + if (rc == SQLITE_OK) && (iBuf != 0) { + var nRead int32 = (pgsz - iBuf) + if ((*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff + I64(nRead)) > (*PmaReader)(unsafe.Pointer(pReadr)).FiEof { + nRead = (int32((*PmaReader)(unsafe.Pointer(pReadr)).FiEof - (*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff)) + } + rc = Xsqlite3OsRead(tls, + (*PmaReader)(unsafe.Pointer(pReadr)).FpFd, ((*PmaReader)(unsafe.Pointer(pReadr)).FaBuffer + uintptr(iBuf)), nRead, (*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff) + + } + } + + return rc +} + +// Advance PmaReader pReadr to the next key in its PMA. Return SQLITE_OK if +// no error occurs, or an SQLite error code if one does. +func vdbePmaReaderNext(tls *libc.TLS, pReadr uintptr) int32 { /* sqlite3.c:95994:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK // Return Code + *(*U64)(unsafe.Pointer(bp /* nRec */)) = uint64(0) // Size of record in bytes + + if (*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff >= (*PmaReader)(unsafe.Pointer(pReadr)).FiEof { + var pIncr uintptr = (*PmaReader)(unsafe.Pointer(pReadr)).FpIncr + var bEof int32 = 1 + if pIncr != 0 { + rc = vdbeIncrSwap(tls, pIncr) + if (rc == SQLITE_OK) && ((*IncrMerger)(unsafe.Pointer(pIncr)).FbEof == 0) { + rc = vdbePmaReaderSeek(tls, + (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask, pReadr, (pIncr + 40 /* &.aFile */), (*IncrMerger)(unsafe.Pointer(pIncr)).FiStartOff) + bEof = 0 + } + } + + if bEof != 0 { + // This is an EOF condition + vdbePmaReaderClear(tls, pReadr) + + return rc + } + } + + if rc == SQLITE_OK { + rc = vdbePmaReadVarint(tls, pReadr, bp /* &nRec */) + } + if rc == SQLITE_OK { + (*PmaReader)(unsafe.Pointer(pReadr)).FnKey = int32(*(*U64)(unsafe.Pointer(bp /* nRec */))) + rc = vdbePmaReadBlob(tls, pReadr, int32(*(*U64)(unsafe.Pointer(bp /* nRec */))), (pReadr + 40 /* &.aKey */)) + + } + + return rc +} + +// Initialize PmaReader pReadr to scan through the PMA stored in file pFile +// starting at offset iStart and ending at offset iEof-1. This function +// leaves the PmaReader pointing to the first key in the PMA (or EOF if the +// PMA is empty). +// +// If the pnByte parameter is NULL, then it is assumed that the file +// contains a single PMA, and that that PMA omits the initial length varint. +func vdbePmaReaderInit(tls *libc.TLS, pTask uintptr, pFile uintptr, iStart I64, pReadr uintptr, pnByte uintptr) int32 { /* sqlite3.c:96041:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + + rc = vdbePmaReaderSeek(tls, pTask, pReadr, pFile, iStart) + if rc == SQLITE_OK { + *(*U64)(unsafe.Pointer(bp /* nByte */)) = uint64(0) // Size of PMA in bytes + rc = vdbePmaReadVarint(tls, pReadr, bp /* &nByte */) + (*PmaReader)(unsafe.Pointer(pReadr)).FiEof = (I64(U64((*PmaReader)(unsafe.Pointer(pReadr)).FiReadOff) + *(*U64)(unsafe.Pointer(bp /* nByte */)))) + *(*I64)(unsafe.Pointer(pnByte)) += I64((*(*U64)(unsafe.Pointer(bp /* nByte */)))) + } + + if rc == SQLITE_OK { + rc = vdbePmaReaderNext(tls, pReadr) + } + return rc +} + +// A version of vdbeSorterCompare() that assumes that it has already been +// determined that the first field of key1 is equal to the first field of +// key2. +func vdbeSorterCompareTail(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) int32 { /* sqlite3.c:96074:12: */ + var r2 uintptr = (*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked + if *(*int32)(unsafe.Pointer(pbKey2Cached)) == 0 { + Xsqlite3VdbeRecordUnpack(tls, (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo, nKey2, pKey2, r2) + *(*int32)(unsafe.Pointer(pbKey2Cached)) = 1 + } + return Xsqlite3VdbeRecordCompareWithSkip(tls, nKey1, pKey1, r2, 1) +} + +// Compare key1 (buffer pKey1, size nKey1 bytes) with key2 (buffer pKey2, +// size nKey2 bytes). Use (pTask->pKeyInfo) for the collation sequences +// used by the comparison. Return the result of the comparison. +// +// If IN/OUT parameter *pbKey2Cached is true when this function is called, +// it is assumed that (pTask->pUnpacked) contains the unpacked version +// of key2. If it is false, (pTask->pUnpacked) is populated with the unpacked +// version of key2 and *pbKey2Cached set to true before returning. +// +// If an OOM error is encountered, (pTask->pUnpacked->error_rc) is set +// to SQLITE_NOMEM. +func vdbeSorterCompare(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) int32 { /* sqlite3.c:96101:12: */ + var r2 uintptr = (*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked + if !(*(*int32)(unsafe.Pointer(pbKey2Cached)) != 0) { + Xsqlite3VdbeRecordUnpack(tls, (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo, nKey2, pKey2, r2) + *(*int32)(unsafe.Pointer(pbKey2Cached)) = 1 + } + return Xsqlite3VdbeRecordCompare(tls, nKey1, pKey1, r2) +} + +// A specially optimized version of vdbeSorterCompare() that assumes that +// the first field of each key is a TEXT value and that the collation +// sequence to compare them with is BINARY. +func vdbeSorterCompareText(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) int32 { /* sqlite3.c:96120:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p1 uintptr = pKey1 + var p2 uintptr = pKey2 + var v1 uintptr = (p1 + uintptr(*(*U8)(unsafe.Pointer(p1)))) // Pointer to value 1 + var v2 uintptr = (p2 + uintptr(*(*U8)(unsafe.Pointer(p2)))) // Pointer to value 2 + + // var n1 int32 at bp, 4 + + // var n2 int32 at bp+4, 4 + + var res int32 + + *(*int32)(unsafe.Pointer(bp /* n1 */)) = int32(U32(*(*U8)(unsafe.Pointer((p1 + 1))))) + if *(*int32)(unsafe.Pointer(bp /* n1 */)) >= 0x80 { + Xsqlite3GetVarint32(tls, (p1 + 1), bp /* &n1 */) + } + *(*int32)(unsafe.Pointer(bp + 4 /* n2 */)) = int32(U32(*(*U8)(unsafe.Pointer((p2 + 1))))) + if *(*int32)(unsafe.Pointer(bp + 4 /* n2 */)) >= 0x80 { + Xsqlite3GetVarint32(tls, (p2 + 1), bp+4 /* &n2 */) + } + res = libc.Xmemcmp(tls, v1, v2, (uint64(((func() int32 { + if (*(*int32)(unsafe.Pointer(bp /* n1 */))) < (*(*int32)(unsafe.Pointer(bp + 4 /* n2 */))) { + return *(*int32)(unsafe.Pointer(bp /* n1 */)) + } + return *(*int32)(unsafe.Pointer(bp + 4 /* n2 */)) + }()) - 13) / 2))) + if res == 0 { + res = (*(*int32)(unsafe.Pointer(bp /* n1 */)) - *(*int32)(unsafe.Pointer(bp + 4 /* n2 */))) + } + + if res == 0 { + if int32((*KeyInfo)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FnKeyField) > 1 { + res = vdbeSorterCompareTail(tls, + pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2) + } + } else { + + if *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FaSortFlags)) != 0 { + res = (res * -1) + } + } + + return res +} + +// A specially optimized version of vdbeSorterCompare() that assumes that +// the first field of each key is an INTEGER value. +func vdbeSorterCompareInt(tls *libc.TLS, pTask uintptr, pbKey2Cached uintptr, pKey1 uintptr, nKey1 int32, pKey2 uintptr, nKey2 int32) int32 { /* sqlite3.c:96162:12: */ + var p1 uintptr = pKey1 + var p2 uintptr = pKey2 + var s1 int32 = int32(*(*U8)(unsafe.Pointer(p1 + 1))) // Left hand serial type + var s2 int32 = int32(*(*U8)(unsafe.Pointer(p2 + 1))) // Right hand serial type + var v1 uintptr = (p1 + uintptr(*(*U8)(unsafe.Pointer(p1)))) // Pointer to value 1 + var v2 uintptr = (p2 + uintptr(*(*U8)(unsafe.Pointer(p2)))) // Pointer to value 2 + var res int32 // Return value + + if s1 == s2 { + var n U8 = aLen[s1] + var i int32 + res = 0 + for i = 0; i < int32(n); i++ { + if (libc.AssignInt32(&res, (int32(*(*U8)(unsafe.Pointer(v1 + uintptr(i)))) - int32(*(*U8)(unsafe.Pointer(v2 + uintptr(i))))))) != 0 { + if ((int32(*(*U8)(unsafe.Pointer(v1))) ^ int32(*(*U8)(unsafe.Pointer(v2)))) & 0x80) != 0 { + if (int32(*(*U8)(unsafe.Pointer(v1))) & 0x80) != 0 { + res = -1 + } else { + res = +1 + } + } + break + } + } + } else if (s1 > 7) && (s2 > 7) { + res = (s1 - s2) + } else { + if s2 > 7 { + res = +1 + } else if s1 > 7 { + res = -1 + } else { + res = (s1 - s2) + } + + if res > 0 { + if (int32(*(*U8)(unsafe.Pointer(v1))) & 0x80) != 0 { + res = -1 + } + } else { + if (int32(*(*U8)(unsafe.Pointer(v2))) & 0x80) != 0 { + res = +1 + } + } + } + + if res == 0 { + if int32((*KeyInfo)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FnKeyField) > 1 { + res = vdbeSorterCompareTail(tls, + pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2) + } + } else if *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FaSortFlags)) != 0 { + + res = (res * -1) + } + + return res +} + +var aLen = [10]U8{U8(0), U8(1), U8(2), U8(3), U8(4), U8(6), U8(8), U8(0), U8(0), U8(0)} /* sqlite3.c:96181:21 */ + +// Initialize the temporary index cursor just opened as a sorter cursor. +// +// Usually, the sorter module uses the value of (pCsr->pKeyInfo->nKeyField) +// to determine the number of fields that should be compared from the +// records being sorted. However, if the value passed as argument nField +// is non-zero and the sorter is able to guarantee a stable sort, nField +// is used instead. This is used when sorting records for a CREATE INDEX +// statement. In this case, keys are always delivered to the sorter in +// order of the primary key, which happens to be make up the final part +// of the records being sorted. So if the sort is stable, there is never +// any reason to compare PK fields and they can be ignored for a small +// performance boost. +// +// The sorter can guarantee a stable sort when running in single-threaded +// mode, but not in multi-threaded mode. +// +// SQLITE_OK is returned if successful, or an SQLite error code otherwise. +func Xsqlite3VdbeSorterInit(tls *libc.TLS, db uintptr, nField int32, pCsr uintptr) int32 { /* sqlite3.c:96245:20: */ + var pgsz int32 // Page size of main database + var i int32 // Used to iterate through aTask[] + var pSorter uintptr // The new sorter + var pKeyInfo uintptr // Copy of pCsr->pKeyInfo with db==0 + var szKeyInfo int32 // Size of pCsr->pKeyInfo in bytes + var sz int32 // Size of pSorter in bytes + var rc int32 = SQLITE_OK + var nWorker int32 + + // Initialize the upper limit on the number of worker threads + if (Xsqlite3TempInMemory(tls, db) != 0) || (int32(Xsqlite3Config.FbCoreMutex) == 0) { + nWorker = 0 + } else { + nWorker = *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 11*4)) + } + + // Do not allow the total number of threads (main thread + all workers) + // to exceed the maximum merge count + + szKeyInfo = (int32(uint64(unsafe.Sizeof(KeyInfo{})) + ((uint64(int32((*KeyInfo)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo)).FnKeyField) - 1)) * uint64(unsafe.Sizeof(uintptr(0)))))) + sz = (int32(uint64(unsafe.Sizeof(VdbeSorter{})) + (uint64(nWorker) * uint64(unsafe.Sizeof(SortSubtask{}))))) + + pSorter = Xsqlite3DbMallocZero(tls, db, (uint64(sz + szKeyInfo))) + *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) = pSorter + if pSorter == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt + (*VdbeSorter)(unsafe.Pointer(pSorter)).FpKeyInfo = libc.AssignUintptr(&pKeyInfo, (pSorter + uintptr(sz))) + libc.Xmemcpy(tls, pKeyInfo, (*VdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo, uint64(szKeyInfo)) + (*KeyInfo)(unsafe.Pointer(pKeyInfo)).Fdb = uintptr(0) + if (nField != 0) && (nWorker == 0) { + (*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField = U16(nField) + } + Xsqlite3BtreeEnter(tls, pBt) + (*VdbeSorter)(unsafe.Pointer(pSorter)).Fpgsz = libc.AssignInt32(&pgsz, Xsqlite3BtreeGetPageSize(tls, pBt)) + Xsqlite3BtreeLeave(tls, pBt) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask = (U8(nWorker + 1)) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FiPrev = (U8(nWorker - 1)) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads = (U8(libc.Bool32(int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask) > 1))) + (*VdbeSorter)(unsafe.Pointer(pSorter)).Fdb = db + for i = 0; i < int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask); i++ { + var pTask uintptr = ((pSorter + 96 /* &.aTask */) + uintptr(i)*104) + (*SortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter + } + + if !(Xsqlite3TempInMemory(tls, db) != 0) { + var mxCache I64 // Cache size in bytes + var szPma U32 = Xsqlite3Config.FszPma + (*VdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize = (int32(szPma * U32(pgsz))) + + mxCache = I64((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema)).Fcache_size) + if mxCache < int64(0) { + // A negative cache-size value C indicates that the cache is abs(C) + // KiB in size. + mxCache = (mxCache * int64(-1024)) + } else { + mxCache = (mxCache * I64(pgsz)) + } + mxCache = func() int64 { + if (mxCache) < (int64(int32(1) << 29)) { + return mxCache + } + return (int64(int32(1) << 29)) + }() + (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize = func() int32 { + if ((*VdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize) > (int32(mxCache)) { + return (*VdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize + } + return int32(mxCache) + }() + + // Avoid large memory allocations if the application has requested + // SQLITE_CONFIG_SMALL_MALLOC. + if int32(Xsqlite3Config.FbSmallMalloc) == 0 { + + (*VdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = pgsz + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = Xsqlite3Malloc(tls, uint64(pgsz)) + if !(int32((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory) != 0) { + rc = SQLITE_NOMEM + } + } + } + + if ((int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField) < 13) && + ((*(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */))) == uintptr(0)) || (*(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */))) == (*Sqlite3)(unsafe.Pointer(db)).FpDfltColl))) && + ((int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags))) & KEYINFO_ORDER_BIGNULL) == 0) { + (*VdbeSorter)(unsafe.Pointer(pSorter)).FtypeMask = (U8(SORTER_TYPE_INTEGER | SORTER_TYPE_TEXT)) + } + } + + return rc +} + +// Free the list of sorted records starting at pRecord. +func vdbeSorterRecordFree(tls *libc.TLS, db uintptr, pRecord uintptr) { /* sqlite3.c:96350:13: */ + var p uintptr + var pNext uintptr + for p = pRecord; p != 0; p = pNext { + pNext = *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) + Xsqlite3DbFree(tls, db, p) + } +} + +// Free all resources owned by the object indicated by argument pTask. All +// fields of *pTask are zeroed before returning. +func vdbeSortSubtaskCleanup(tls *libc.TLS, db uintptr, pTask uintptr) { /* sqlite3.c:96363:13: */ + Xsqlite3DbFree(tls, db, (*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked) + // pTask->list.aMemory can only be non-zero if it was handed memory + // from the main thread. That only occurs SQLITE_MAX_WORKER_THREADS>0 + if (*SortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory != 0 { + Xsqlite3_free(tls, (*SortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory) + } else { + + vdbeSorterRecordFree(tls, uintptr(0), (*SortSubtask)(unsafe.Pointer(pTask)).Flist.FpList) + } + if (*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd != 0 { + Xsqlite3OsCloseFree(tls, (*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd) + } + if (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd != 0 { + Xsqlite3OsCloseFree(tls, (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd) + } + libc.Xmemset(tls, pTask, 0, uint64(unsafe.Sizeof(SortSubtask{}))) +} + +// Join thread pTask->thread. +func vdbeSorterJoinThread(tls *libc.TLS, pTask uintptr) int32 { /* sqlite3.c:96429:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + if (*SortSubtask)(unsafe.Pointer(pTask)).FpThread != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pRet */)) = uintptr(int64(SQLITE_ERROR)) + + Xsqlite3ThreadJoin(tls, (*SortSubtask)(unsafe.Pointer(pTask)).FpThread, bp /* &pRet */) + + rc = int32(*(*uintptr)(unsafe.Pointer(bp /* pRet */))) + + (*SortSubtask)(unsafe.Pointer(pTask)).FbDone = 0 + (*SortSubtask)(unsafe.Pointer(pTask)).FpThread = uintptr(0) + } + return rc +} + +// Launch a background thread to run xTask(pIn). +func vdbeSorterCreateThread(tls *libc.TLS, pTask uintptr, xTask uintptr, pIn uintptr) int32 { /* sqlite3.c:96450:12: */ + + return Xsqlite3ThreadCreate(tls, (pTask /* &.pThread */), xTask, pIn) +} + +// Join all outstanding threads launched by SorterWrite() to create +// level-0 PMAs. +func vdbeSorterJoinAll(tls *libc.TLS, pSorter uintptr, rcin int32) int32 { /* sqlite3.c:96463:12: */ + var rc int32 = rcin + var i int32 + + // This function is always called by the main user thread. + // + // If this function is being called after SorterRewind() has been called, + // it is possible that thread pSorter->aTask[pSorter->nTask-1].pThread + // is currently attempt to join one of the other threads. To avoid a race + // condition where this thread also attempts to join the same object, join + // thread pSorter->aTask[pSorter->nTask-1].pThread first. + for i = (int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask) - 1); i >= 0; i-- { + var pTask uintptr = ((pSorter + 96 /* &.aTask */) + uintptr(i)*104) + var rc2 int32 = vdbeSorterJoinThread(tls, pTask) + if rc == SQLITE_OK { + rc = rc2 + } + } + return rc +} + +// Allocate a new MergeEngine object capable of handling up to +// nReader PmaReader inputs. +// +// nReader is automatically rounded up to the next power of two. +// nReader may not exceed SORTER_MAX_MERGE_COUNT even after rounding up. +func vdbeMergeEngineNew(tls *libc.TLS, nReader int32) uintptr { /* sqlite3.c:96493:20: */ + var N int32 = 2 // Smallest power of two >= nReader + var nByte int32 // Total bytes of space to allocate + var pNew uintptr // Pointer to allocated object to return + + for N < nReader { + N = N + (N) + } + nByte = (int32(uint64(unsafe.Sizeof(MergeEngine{})) + (uint64(N) * (uint64(unsafe.Sizeof(int32(0))) + uint64(unsafe.Sizeof(PmaReader{})))))) + + if Xsqlite3FaultSim(tls, 100) != 0 { + pNew = uintptr(0) + } else { + pNew = Xsqlite3MallocZero(tls, uint64(nByte)) + } + if pNew != 0 { + (*MergeEngine)(unsafe.Pointer(pNew)).FnTree = N + (*MergeEngine)(unsafe.Pointer(pNew)).FpTask = uintptr(0) + (*MergeEngine)(unsafe.Pointer(pNew)).FaReadr = (pNew + 1*32) + (*MergeEngine)(unsafe.Pointer(pNew)).FaTree = ((*MergeEngine)(unsafe.Pointer(pNew)).FaReadr + uintptr(N)*80) + } + return pNew +} + +// Free the MergeEngine object passed as the only argument. +func vdbeMergeEngineFree(tls *libc.TLS, pMerger uintptr) { /* sqlite3.c:96516:13: */ + var i int32 + if pMerger != 0 { + for i = 0; i < (*MergeEngine)(unsafe.Pointer(pMerger)).FnTree; i++ { + vdbePmaReaderClear(tls, ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(i)*80)) + } + } + Xsqlite3_free(tls, pMerger) +} + +// Free all resources associated with the IncrMerger object indicated by +// the first argument. +func vdbeIncrFree(tls *libc.TLS, pIncr uintptr) { /* sqlite3.c:96530:13: */ + if pIncr != 0 { + if (*IncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + vdbeSorterJoinThread(tls, (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask) + if (*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))).FpFd != 0 { + Xsqlite3OsCloseFree(tls, (*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))).FpFd) + } + if (*SorterFile)(unsafe.Pointer((pIncr+40 /* &.aFile */)+1*16)).FpFd != 0 { + Xsqlite3OsCloseFree(tls, (*SorterFile)(unsafe.Pointer((pIncr+40 /* &.aFile */)+1*16)).FpFd) + } + } + vdbeMergeEngineFree(tls, (*IncrMerger)(unsafe.Pointer(pIncr)).FpMerger) + Xsqlite3_free(tls, pIncr) + } +} + +// Reset a sorting cursor back to its original empty state. +func Xsqlite3VdbeSorterReset(tls *libc.TLS, db uintptr, pSorter uintptr) { /* sqlite3.c:96547:21: */ + var i int32 + vdbeSorterJoinAll(tls, pSorter, SQLITE_OK) + + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader != 0 { + vdbePmaReaderClear(tls, (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader) + Xsqlite3DbFree(tls, db, (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader = uintptr(0) + } + vdbeMergeEngineFree(tls, (*VdbeSorter)(unsafe.Pointer(pSorter)).FpMerger) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FpMerger = uintptr(0) + for i = 0; i < int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask); i++ { + var pTask uintptr = ((pSorter + 96 /* &.aTask */) + uintptr(i)*104) + vdbeSortSubtaskCleanup(tls, db, pTask) + (*SortSubtask)(unsafe.Pointer(pTask)).FpSorter = pSorter + } + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { + vdbeSorterRecordFree(tls, uintptr(0), (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList) + } + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = uintptr(0) + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 + (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA = U8(0) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FiMemory = 0 + (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxKeysize = 0 + Xsqlite3DbFree(tls, db, (*VdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked = uintptr(0) +} + +// Free any cursor components allocated by sqlite3VdbeSorterXXX routines. +func Xsqlite3VdbeSorterClose(tls *libc.TLS, db uintptr, pCsr uintptr) { /* sqlite3.c:96580:21: */ + var pSorter uintptr + + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) + if pSorter != 0 { + Xsqlite3VdbeSorterReset(tls, db, pSorter) + Xsqlite3_free(tls, (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory) + Xsqlite3DbFree(tls, db, pSorter) + *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) = uintptr(0) + } +} + +// The first argument is a file-handle open on a temporary file. The file +// is guaranteed to be nByte bytes or smaller in size. This function +// attempts to extend the file to nByte bytes in size and to ensure that +// the VFS has memory mapped it. +// +// Whether or not the file does end up memory mapped of course depends on +// the specific VFS implementation. +func vdbeSorterExtendFile(tls *libc.TLS, db uintptr, pFd uintptr, nByte I64) { /* sqlite3.c:96602:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + *(*I64)(unsafe.Pointer(bp + 8)) = nByte + + if (*(*I64)(unsafe.Pointer(bp + 8 /* nByte */)) <= (I64((*Sqlite3)(unsafe.Pointer(db)).FnMaxSorterMmap))) && ((*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer(pFd)).FpMethods)).FiVersion >= 3) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp /* chunksize */)) = (4 * 1024) + Xsqlite3OsFileControlHint(tls, pFd, SQLITE_FCNTL_CHUNK_SIZE, bp /* &chunksize */) + Xsqlite3OsFileControlHint(tls, pFd, SQLITE_FCNTL_SIZE_HINT, bp+8 /* &nByte */) + Xsqlite3OsFetch(tls, pFd, int64(0), int32(*(*I64)(unsafe.Pointer(bp + 8 /* nByte */))), bp+16 /* &p */) + Xsqlite3OsUnfetch(tls, pFd, int64(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) + } +} + +// Allocate space for a file-handle and open a temporary file. If successful, +// set *ppFd to point to the malloc'd file-handle and return SQLITE_OK. +// Otherwise, set *ppFd to 0 and return an SQLite error code. +func vdbeSorterOpenTempFile(tls *libc.TLS, db uintptr, nExtend I64, ppFd uintptr) int32 { /* sqlite3.c:96621:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var rc int32 at bp, 4 + + if Xsqlite3FaultSim(tls, 202) != 0 { + return (SQLITE_IOERR | (int32(13) << 8)) + } + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3OsOpenMalloc(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), ppFd, + ((((SQLITE_OPEN_TEMP_JOURNAL | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE), bp /* &rc */) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*I64)(unsafe.Pointer(bp + 8 /* max */)) = int64(SQLITE_MAX_MMAP_SIZE) + Xsqlite3OsFileControlHint(tls, *(*uintptr)(unsafe.Pointer(ppFd)), SQLITE_FCNTL_MMAP_SIZE, bp+8 /* &max */) + if nExtend > int64(0) { + vdbeSorterExtendFile(tls, db, *(*uintptr)(unsafe.Pointer(ppFd)), nExtend) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// If it has not already been allocated, allocate the UnpackedRecord +// structure at pTask->pUnpacked. Return SQLITE_OK if successful (or +// if no allocation was required), or SQLITE_NOMEM otherwise. +func vdbeSortAllocUnpacked(tls *libc.TLS, pTask uintptr) int32 { /* sqlite3.c:96648:12: */ + if (*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked == uintptr(0) { + (*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked = Xsqlite3VdbeAllocUnpackedRecord(tls, (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo) + if (*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked == uintptr(0) { + return SQLITE_NOMEM + } + (*UnpackedRecord)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FnField = (*KeyInfo)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FpKeyInfo)).FnKeyField + (*UnpackedRecord)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode = U8(0) + } + return SQLITE_OK +} + +// Merge the two sorted lists p1 and p2 into a single list. +func vdbeSorterMerge(tls *libc.TLS, pTask uintptr, p1 uintptr, p2 uintptr) uintptr { /* sqlite3.c:96662:21: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*uintptr)(unsafe.Pointer(bp /* pFinal */)) = uintptr(0) + var pp uintptr = bp /* &pFinal */ + *(*int32)(unsafe.Pointer(bp + 8 /* bCached */)) = 0 + + for { + var res int32 + res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer((pTask + 64 /* &.xCompare */))))(tls, + pTask, bp+8 /* &bCached */, ((p1) + uintptr(1)*16), (*SorterRecord)(unsafe.Pointer(p1)).FnVal, ((p2) + uintptr(1)*16), (*SorterRecord)(unsafe.Pointer(p2)).FnVal) + + if res <= 0 { + *(*uintptr)(unsafe.Pointer(pp)) = p1 + pp = (p1 + 8 /* &.u */ /* &.pNext */) + p1 = *(*uintptr)(unsafe.Pointer(p1 + 8 /* &.u */)) + if p1 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pp)) = p2 + break + } + } else { + *(*uintptr)(unsafe.Pointer(pp)) = p2 + pp = (p2 + 8 /* &.u */ /* &.pNext */) + p2 = *(*uintptr)(unsafe.Pointer(p2 + 8 /* &.u */)) + *(*int32)(unsafe.Pointer(bp + 8 /* bCached */)) = 0 + if p2 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pp)) = p1 + break + } + } + } + return *(*uintptr)(unsafe.Pointer(bp /* pFinal */)) +} + +// Return the SorterCompare function to compare values collected by the +// sorter object passed as the only argument. +func vdbeSorterGetCompare(tls *libc.TLS, p uintptr) SorterCompare { /* sqlite3.c:96704:22: */ + if int32((*VdbeSorter)(unsafe.Pointer(p)).FtypeMask) == SORTER_TYPE_INTEGER { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32 + }{vdbeSorterCompareInt})) + } else if int32((*VdbeSorter)(unsafe.Pointer(p)).FtypeMask) == SORTER_TYPE_TEXT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32 + }{vdbeSorterCompareText})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32 + }{vdbeSorterCompare})) +} + +// Sort the linked list of records headed at pTask->pList. Return +// SQLITE_OK if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if +// an error occurs. +func vdbeSorterSort(tls *libc.TLS, pTask uintptr, pList uintptr) int32 { /* sqlite3.c:96718:12: */ + bp := tls.Alloc(512) + defer tls.Free(512) + + var i int32 + var p uintptr + var rc int32 + // var aSlot [64]uintptr at bp, 512 + + rc = vdbeSortAllocUnpacked(tls, pTask) + if rc != SQLITE_OK { + return rc + } + + p = (*SorterList)(unsafe.Pointer(pList)).FpList + (*SortSubtask)(unsafe.Pointer(pTask)).FxCompare = vdbeSorterGetCompare(tls, (*SortSubtask)(unsafe.Pointer(pTask)).FpSorter) + libc.Xmemset(tls, bp /* &aSlot[0] */, 0, uint64(unsafe.Sizeof([64]uintptr{}))) + + for p != 0 { + var pNext uintptr + if (*SorterList)(unsafe.Pointer(pList)).FaMemory != 0 { + if p == (*SorterList)(unsafe.Pointer(pList)).FaMemory { + pNext = uintptr(0) + } else { + + pNext = ((*SorterList)(unsafe.Pointer(pList)).FaMemory + uintptr(*(*int32)(unsafe.Pointer(p + 8 /* &.u */)))) + } + } else { + pNext = *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) + } + + *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) = uintptr(0) + for i = 0; *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8)) != 0; i++ { + p = vdbeSorterMerge(tls, pTask, p, *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8)) = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8)) = p + p = pNext + } + + p = uintptr(0) + for i = 0; i < (int32(uint64(unsafe.Sizeof([64]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))); i++ { + if *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8)) == uintptr(0) { + continue + } + if p != 0 { + p = vdbeSorterMerge(tls, pTask, p, *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8))) + } else { + p = *(*uintptr)(unsafe.Pointer(bp /* &aSlot[0] */ + uintptr(i)*8)) + } + } + (*SorterList)(unsafe.Pointer(pList)).FpList = p + + return int32((*UnpackedRecord)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) +} + +// Initialize a PMA-writer object. +func vdbePmaWriterInit(tls *libc.TLS, pFd uintptr, p uintptr, nBuf int32, iStart I64) { /* sqlite3.c:96769:13: */ + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(PmaWriter{}))) + (*PmaWriter)(unsafe.Pointer(p)).FaBuffer = Xsqlite3Malloc(tls, uint64(nBuf)) + if !(int32((*PmaWriter)(unsafe.Pointer(p)).FaBuffer) != 0) { + (*PmaWriter)(unsafe.Pointer(p)).FeFWErr = SQLITE_NOMEM + } else { + (*PmaWriter)(unsafe.Pointer(p)).FiBufEnd = libc.AssignPtrInt32(p+20 /* &.iBufStart */, (int32(iStart % I64(nBuf)))) + (*PmaWriter)(unsafe.Pointer(p)).FiWriteOff = (iStart - I64((*PmaWriter)(unsafe.Pointer(p)).FiBufStart)) + (*PmaWriter)(unsafe.Pointer(p)).FnBuffer = nBuf + (*PmaWriter)(unsafe.Pointer(p)).FpFd = pFd + } +} + +// Write nData bytes of data to the PMA. Return SQLITE_OK +// if successful, or an SQLite error code if an error occurs. +func vdbePmaWriteBlob(tls *libc.TLS, p uintptr, pData uintptr, nData int32) { /* sqlite3.c:96791:13: */ + var nRem int32 = nData + for (nRem > 0) && ((*PmaWriter)(unsafe.Pointer(p)).FeFWErr == 0) { + var nCopy int32 = nRem + if nCopy > ((*PmaWriter)(unsafe.Pointer(p)).FnBuffer - (*PmaWriter)(unsafe.Pointer(p)).FiBufEnd) { + nCopy = ((*PmaWriter)(unsafe.Pointer(p)).FnBuffer - (*PmaWriter)(unsafe.Pointer(p)).FiBufEnd) + } + + libc.Xmemcpy(tls, ((*PmaWriter)(unsafe.Pointer(p)).FaBuffer + uintptr((*PmaWriter)(unsafe.Pointer(p)).FiBufEnd)), (pData + uintptr((nData - nRem))), uint64(nCopy)) + *(*int32)(unsafe.Pointer(p + 24 /* &.iBufEnd */)) += (nCopy) + if (*PmaWriter)(unsafe.Pointer(p)).FiBufEnd == (*PmaWriter)(unsafe.Pointer(p)).FnBuffer { + (*PmaWriter)(unsafe.Pointer(p)).FeFWErr = Xsqlite3OsWrite(tls, (*PmaWriter)(unsafe.Pointer(p)).FpFd, + ((*PmaWriter)(unsafe.Pointer(p)).FaBuffer + uintptr((*PmaWriter)(unsafe.Pointer(p)).FiBufStart)), ((*PmaWriter)(unsafe.Pointer(p)).FiBufEnd - (*PmaWriter)(unsafe.Pointer(p)).FiBufStart), + ((*PmaWriter)(unsafe.Pointer(p)).FiWriteOff + I64((*PmaWriter)(unsafe.Pointer(p)).FiBufStart))) + (*PmaWriter)(unsafe.Pointer(p)).FiBufStart = libc.AssignPtrInt32(p+24 /* &.iBufEnd */, 0) + *(*I64)(unsafe.Pointer(p + 32 /* &.iWriteOff */)) += (I64((*PmaWriter)(unsafe.Pointer(p)).FnBuffer)) + } + + nRem = nRem - (nCopy) + } +} + +// Flush any buffered data to disk and clean up the PMA-writer object. +// The results of using the PMA-writer after this call are undefined. +// Return SQLITE_OK if flushing the buffered data succeeds or is not +// required. Otherwise, return an SQLite error code. +// +// Before returning, set *piEof to the offset immediately following the +// last byte written to the file. +func vdbePmaWriterFinish(tls *libc.TLS, p uintptr, piEof uintptr) int32 { /* sqlite3.c:96824:12: */ + var rc int32 + if (((*PmaWriter)(unsafe.Pointer(p)).FeFWErr == 0) && ((*PmaWriter)(unsafe.Pointer(p)).FaBuffer != 0)) && ((*PmaWriter)(unsafe.Pointer(p)).FiBufEnd > (*PmaWriter)(unsafe.Pointer(p)).FiBufStart) { + (*PmaWriter)(unsafe.Pointer(p)).FeFWErr = Xsqlite3OsWrite(tls, (*PmaWriter)(unsafe.Pointer(p)).FpFd, + ((*PmaWriter)(unsafe.Pointer(p)).FaBuffer + uintptr((*PmaWriter)(unsafe.Pointer(p)).FiBufStart)), ((*PmaWriter)(unsafe.Pointer(p)).FiBufEnd - (*PmaWriter)(unsafe.Pointer(p)).FiBufStart), + ((*PmaWriter)(unsafe.Pointer(p)).FiWriteOff + I64((*PmaWriter)(unsafe.Pointer(p)).FiBufStart))) + } + *(*I64)(unsafe.Pointer(piEof)) = ((*PmaWriter)(unsafe.Pointer(p)).FiWriteOff + I64((*PmaWriter)(unsafe.Pointer(p)).FiBufEnd)) + Xsqlite3_free(tls, (*PmaWriter)(unsafe.Pointer(p)).FaBuffer) + rc = (*PmaWriter)(unsafe.Pointer(p)).FeFWErr + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(PmaWriter{}))) + return rc +} + +// Write value iVal encoded as a varint to the PMA. Return +// SQLITE_OK if successful, or an SQLite error code if an error occurs. +func vdbePmaWriteVarint(tls *libc.TLS, p uintptr, iVal U64) { /* sqlite3.c:96843:13: */ + bp := tls.Alloc(10) + defer tls.Free(10) + + var nByte int32 + // var aByte [10]U8 at bp, 10 + + nByte = Xsqlite3PutVarint(tls, bp /* &aByte[0] */, iVal) + vdbePmaWriteBlob(tls, p, bp /* &aByte[0] */, nByte) +} + +// Write the current contents of in-memory linked-list pList to a level-0 +// PMA in the temp file belonging to sub-task pTask. Return SQLITE_OK if +// successful, or an SQLite error code otherwise. +// +// The format of a PMA is: +// +// * A varint. This varint contains the total number of bytes of content +// in the PMA (not including the varint itself). +// +// * One or more records packed end-to-end in order of ascending keys. +// Each record consists of a varint followed by a blob of data (the +// key). The varint is the number of bytes in the blob of data. +func vdbeSorterListToPMA(tls *libc.TLS, pTask uintptr, pList uintptr) int32 { /* sqlite3.c:96864:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var db uintptr = (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb + var rc int32 = SQLITE_OK // Return code + // var writer PmaWriter at bp, 48 + // Object used to write to the file + + libc.Xmemset(tls, bp /* &writer */, 0, uint64(unsafe.Sizeof(PmaWriter{}))) + + // If the first temporary PMA file has not been opened, open it now. + if (*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd == uintptr(0) { + rc = vdbeSorterOpenTempFile(tls, db, int64(0), (pTask + 72 /* &.file */ /* &.pFd */)) + + } + + // Try to get the file to memory map + if rc == SQLITE_OK { + vdbeSorterExtendFile(tls, db, (*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd, (((*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FiEof + I64((*SorterList)(unsafe.Pointer(pList)).FszPMA)) + int64(9))) + } + + // Sort the list + if rc == SQLITE_OK { + rc = vdbeSorterSort(tls, pTask, pList) + } + + if rc == SQLITE_OK { + var p uintptr + var pNext uintptr = uintptr(0) + + vdbePmaWriterInit(tls, (*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FpFd, bp /* &writer */, (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fpgsz, + (*SortSubtask)(unsafe.Pointer(pTask)).Ffile.FiEof) + (*SortSubtask)(unsafe.Pointer(pTask)).FnPMA++ + vdbePmaWriteVarint(tls, bp /* &writer */, uint64((*SorterList)(unsafe.Pointer(pList)).FszPMA)) + for p = (*SorterList)(unsafe.Pointer(pList)).FpList; p != 0; p = pNext { + pNext = *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) + vdbePmaWriteVarint(tls, bp /* &writer */, uint64((*SorterRecord)(unsafe.Pointer(p)).FnVal)) + vdbePmaWriteBlob(tls, bp /* &writer */, ((p) + uintptr(1)*16), (*SorterRecord)(unsafe.Pointer(p)).FnVal) + if (*SorterList)(unsafe.Pointer(pList)).FaMemory == uintptr(0) { + Xsqlite3_free(tls, p) + } + } + (*SorterList)(unsafe.Pointer(pList)).FpList = p + rc = vdbePmaWriterFinish(tls, bp /* &writer */, (pTask + 72 /* &.file */ + 8 /* &.iEof */)) + } + + return rc +} + +// Advance the MergeEngine to its next entry. +// Set *pbEof to true there is no next entry because +// the MergeEngine has reached the end of all its inputs. +// +// Return SQLITE_OK if successful or an error code if an error occurs. +func vdbeMergeEngineStep(tls *libc.TLS, pMerger uintptr, pbEof uintptr) int32 { /* sqlite3.c:96928:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 + var iPrev int32 = *(*int32)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)) // Index of PmaReader to advance + var pTask uintptr = (*MergeEngine)(unsafe.Pointer(pMerger)).FpTask + + // Advance the current PmaReader + rc = vdbePmaReaderNext(tls, ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(iPrev)*80)) + + // Update contents of aTree[] + if rc == SQLITE_OK { + var i int32 // Index of aTree[] to recalculate + var pReadr1 uintptr // First PmaReader to compare + var pReadr2 uintptr // Second PmaReader to compare + *(*int32)(unsafe.Pointer(bp /* bCached */)) = 0 + + // Find the first two PmaReaders to compare. The one that was just + // advanced (iPrev) and the one next to it in the array. + pReadr1 = ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr((iPrev&0xFFFE))*80) + pReadr2 = ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr((iPrev|0x0001))*80) + + for i = (((*MergeEngine)(unsafe.Pointer(pMerger)).FnTree + iPrev) / 2); i > 0; i = (i / 2) { + // Compare pReadr1 and pReadr2. Store the result in variable iRes. + var iRes int32 + if (*PmaReader)(unsafe.Pointer(pReadr1)).FpFd == uintptr(0) { + iRes = +1 + } else if (*PmaReader)(unsafe.Pointer(pReadr2)).FpFd == uintptr(0) { + iRes = -1 + } else { + iRes = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer((pTask + 64 /* &.xCompare */))))(tls, pTask, bp, /* &bCached */ + (*PmaReader)(unsafe.Pointer(pReadr1)).FaKey, (*PmaReader)(unsafe.Pointer(pReadr1)).FnKey, (*PmaReader)(unsafe.Pointer(pReadr2)).FaKey, (*PmaReader)(unsafe.Pointer(pReadr2)).FnKey) + } + + // If pReadr1 contained the smaller value, set aTree[i] to its index. + // Then set pReadr2 to the next PmaReader to compare to pReadr1. In this + // case there is no cache of pReadr2 in pTask->pUnpacked, so set + // pKey2 to point to the record belonging to pReadr2. + // + // Alternatively, if pReadr2 contains the smaller of the two values, + // set aTree[i] to its index and update pReadr1. If vdbeSorterCompare() + // was actually called above, then pTask->pUnpacked now contains + // a value equivalent to pReadr2. So set pKey2 to NULL to prevent + // vdbeSorterCompare() from decoding pReadr2 again. + // + // If the two values were equal, then the value from the oldest + // PMA should be considered smaller. The VdbeSorter.aReadr[] array + // is sorted from oldest to newest, so pReadr1 contains older values + // than pReadr2 iff (pReadr1nTask-1) tasks. Except, if + // the background thread from a sub-tasks previous turn is still running, + // skip it. If the first (pSorter->nTask-1) sub-tasks are all still busy, + // fall back to using the final sub-task. The first (pSorter->nTask-1) + // sub-tasks are prefered as they use background threads - the final + // sub-task uses the main thread. + for i = 0; i < nWorker; i++ { + var iTest int32 = (((int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FiPrev) + i) + 1) % nWorker) + pTask = ((pSorter + 96 /* &.aTask */) + uintptr(iTest)*104) + if (*SortSubtask)(unsafe.Pointer(pTask)).FbDone != 0 { + rc = vdbeSorterJoinThread(tls, pTask) + } + if (rc != SQLITE_OK) || ((*SortSubtask)(unsafe.Pointer(pTask)).FpThread == uintptr(0)) { + break + } + } + + if rc == SQLITE_OK { + if i == nWorker { + // Use the foreground thread for this operation + rc = vdbeSorterListToPMA(tls, ((pSorter + 96 /* &.aTask */) + uintptr(nWorker)*104), (pSorter + 56 /* &.list */)) + } else { + // Launch a background thread for this operation + var aMem uintptr + var pCtx uintptr + + aMem = (*SortSubtask)(unsafe.Pointer(pTask)).Flist.FaMemory + pCtx = pTask + (*VdbeSorter)(unsafe.Pointer(pSorter)).FiPrev = (U8(int64((pTask - (pSorter + 96 /* &.aTask */)) / 104))) + (*SortSubtask)(unsafe.Pointer(pTask)).Flist = (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = uintptr(0) + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 + if aMem != 0 { + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = aMem + (*VdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = Xsqlite3MallocSize(tls, aMem) + } else if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0 { + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = Xsqlite3Malloc(tls, uint64((*VdbeSorter)(unsafe.Pointer(pSorter)).FnMemory)) + if !(int32((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory) != 0) { + return SQLITE_NOMEM + } + } + + rc = vdbeSorterCreateThread(tls, pTask, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) uintptr + }{vdbeSorterFlushThread})), pCtx) + } + } + + return rc +} + +// Add a record to the sorter. +func Xsqlite3VdbeSorterWrite(tls *libc.TLS, pCsr uintptr, pVal uintptr) int32 { /* sqlite3.c:97083:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSorter uintptr + var rc int32 = SQLITE_OK // Return Code + var pNew uintptr // New list element + var bFlush int32 // True to flush contents of memory to PMA + var nReq int32 // Bytes of memory required + var nPMA int32 // Bytes of PMA space required + // var t int32 at bp, 4 + // serial type of first record field + + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) + *(*int32)(unsafe.Pointer(bp /* t */)) = int32(U32(*(*U8)(unsafe.Pointer(((*Mem)(unsafe.Pointer(pVal)).Fz + 1))))) + if *(*int32)(unsafe.Pointer(bp /* t */)) >= 0x80 { + Xsqlite3GetVarint32(tls, ((*Mem)(unsafe.Pointer(pVal)).Fz + 1), bp /* &t */) + } + if ((*(*int32)(unsafe.Pointer(bp /* t */)) > 0) && (*(*int32)(unsafe.Pointer(bp /* t */)) < 10)) && (*(*int32)(unsafe.Pointer(bp /* t */)) != 7) { + *(*U8)(unsafe.Pointer(pSorter + 92 /* &.typeMask */)) &= U8((SORTER_TYPE_INTEGER)) + } else if (*(*int32)(unsafe.Pointer(bp /* t */)) > 10) && ((*(*int32)(unsafe.Pointer(bp /* t */)) & 0x01) != 0) { + *(*U8)(unsafe.Pointer(pSorter + 92 /* &.typeMask */)) &= U8((SORTER_TYPE_TEXT)) + } else { + (*VdbeSorter)(unsafe.Pointer(pSorter)).FtypeMask = U8(0) + } + + // Figure out whether or not the current contents of memory should be + // flushed to a PMA before continuing. If so, do so. + // + // If using the single large allocation mode (pSorter->aMemory!=0), then + // flush the contents of memory to a new PMA if (a) at least one value is + // already in memory and (b) the new value will not fit in memory. + // + // Or, if using separate allocations for each record, flush the contents + // of memory to a PMA if either of the following are true: + // + // * The total memory allocated for the in-memory list is greater + // than (page-size * cache-size), or + // + // * The total memory allocated for the in-memory list is greater + // than (page-size * 10) and sqlite3HeapNearlyFull() returns true. + nReq = (int32(uint64((*Mem)(unsafe.Pointer(pVal)).Fn) + uint64(unsafe.Sizeof(SorterRecord{})))) + nPMA = ((*Mem)(unsafe.Pointer(pVal)).Fn + Xsqlite3VarintLen(tls, uint64((*Mem)(unsafe.Pointer(pVal)).Fn))) + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize != 0 { + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0 { + bFlush = (libc.Bool32(((*VdbeSorter)(unsafe.Pointer(pSorter)).FiMemory != 0) && (((*VdbeSorter)(unsafe.Pointer(pSorter)).FiMemory + nReq) > (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize))) + } else { + bFlush = (libc.Bool32(((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA > (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize) || + (((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA > (*VdbeSorter)(unsafe.Pointer(pSorter)).FmnPmaSize) && (Xsqlite3HeapNearlyFull(tls) != 0)))) + } + if bFlush != 0 { + rc = vdbeSorterFlushPMA(tls, pSorter) + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FszPMA = 0 + (*VdbeSorter)(unsafe.Pointer(pSorter)).FiMemory = 0 + + } + } + + *(*int32)(unsafe.Pointer(pSorter + 56 /* &.list */ + 16 /* &.szPMA */)) += (nPMA) + if nPMA > (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxKeysize { + (*VdbeSorter)(unsafe.Pointer(pSorter)).FmxKeysize = nPMA + } + + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory != 0 { + var nMin int32 = ((*VdbeSorter)(unsafe.Pointer(pSorter)).FiMemory + nReq) + + if nMin > (*VdbeSorter)(unsafe.Pointer(pSorter)).FnMemory { + var aNew uintptr + var nNew Sqlite3_int64 = (int64(2) * Sqlite3_int64((*VdbeSorter)(unsafe.Pointer(pSorter)).FnMemory)) + var iListOff int32 = -1 + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + iListOff = (int32((int64((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList) - int64((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory)) / 1)) + } + for nNew < Sqlite3_int64(nMin) { + nNew = (nNew * int64(2)) + } + if nNew > Sqlite3_int64((*VdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize) { + nNew = Sqlite3_int64((*VdbeSorter)(unsafe.Pointer(pSorter)).FmxPmaSize) + } + if nNew < Sqlite3_int64(nMin) { + nNew = Sqlite3_int64(nMin) + } + aNew = Xsqlite3Realloc(tls, (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory, uint64(nNew)) + if !(aNew != 0) { + return SQLITE_NOMEM + } + if iListOff >= 0 { + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = (aNew + uintptr(iListOff)) + } + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory = aNew + (*VdbeSorter)(unsafe.Pointer(pSorter)).FnMemory = int32(nNew) + } + + pNew = ((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory + uintptr((*VdbeSorter)(unsafe.Pointer(pSorter)).FiMemory)) + *(*int32)(unsafe.Pointer(pSorter + 80 /* &.iMemory */)) += (((nReq) + 7) & libc.CplInt32(7)) + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + *(*int32)(unsafe.Pointer(pNew + 8 /* &.u */)) = (int32((int64(((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList)) - int64((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory)) / 1)) + } + } else { + pNew = Xsqlite3Malloc(tls, uint64(nReq)) + if pNew == uintptr(0) { + return SQLITE_NOMEM + } + *(*uintptr)(unsafe.Pointer(pNew + 8 /* &.u */)) = (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList + } + + libc.Xmemcpy(tls, ((pNew) + uintptr(1)*16), (*Mem)(unsafe.Pointer(pVal)).Fz, uint64((*Mem)(unsafe.Pointer(pVal)).Fn)) + (*SorterRecord)(unsafe.Pointer(pNew)).FnVal = (*Mem)(unsafe.Pointer(pVal)).Fn + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = pNew + + return rc +} + +// Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format +// of the data stored in aFile[1] is the same as that used by regular PMAs, +// except that the number-of-bytes varint is omitted from the start. +func vdbeIncrPopulate(tls *libc.TLS, pIncr uintptr) int32 { /* sqlite3.c:97195:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var rc int32 = SQLITE_OK + var rc2 int32 + var iStart I64 = (*IncrMerger)(unsafe.Pointer(pIncr)).FiStartOff + var pOut uintptr = ((pIncr + 40 /* &.aFile */) + 1*16) + var pTask uintptr = (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask + var pMerger uintptr = (*IncrMerger)(unsafe.Pointer(pIncr)).FpMerger + // var writer PmaWriter at bp, 48 + + vdbePmaWriterInit(tls, (*SorterFile)(unsafe.Pointer(pOut)).FpFd, bp /* &writer */, (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fpgsz, iStart) + for rc == SQLITE_OK { + // var dummy int32 at bp+48, 4 + + var pReader uintptr = ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(pMerger)).FaTree + 1*4)))*80) + var nKey int32 = (*PmaReader)(unsafe.Pointer(pReader)).FnKey + var iEof I64 = ((*PmaWriter)(unsafe.Pointer(bp /* &writer */)).FiWriteOff + I64((*PmaWriter)(unsafe.Pointer(bp /* &writer */)).FiBufEnd)) + + // Check if the output file is full or if the input has been exhausted. + // In either case exit the loop. + if (*PmaReader)(unsafe.Pointer(pReader)).FpFd == uintptr(0) { + break + } + if ((iEof + I64(nKey)) + I64(Xsqlite3VarintLen(tls, uint64(nKey)))) > (iStart + I64((*IncrMerger)(unsafe.Pointer(pIncr)).FmxSz)) { + break + } + + // Write the next key to the output. + vdbePmaWriteVarint(tls, bp /* &writer */, uint64(nKey)) + vdbePmaWriteBlob(tls, bp /* &writer */, (*PmaReader)(unsafe.Pointer(pReader)).FaKey, nKey) + + rc = vdbeMergeEngineStep(tls, (*IncrMerger)(unsafe.Pointer(pIncr)).FpMerger, bp+48 /* &dummy */) + } + + rc2 = vdbePmaWriterFinish(tls, bp /* &writer */, (pOut + 8 /* &.iEof */)) + if rc == SQLITE_OK { + rc = rc2 + } + + return rc +} + +// The main routine for background threads that populate aFile[1] of +// multi-threaded IncrMerger objects. +func vdbeIncrPopulateThread(tls *libc.TLS, pCtx uintptr) uintptr { /* sqlite3.c:97237:13: */ + var pIncr uintptr = pCtx + var pRet uintptr = uintptr(int64(vdbeIncrPopulate(tls, pIncr))) + (*SortSubtask)(unsafe.Pointer((*IncrMerger)(unsafe.Pointer(pIncr)).FpTask)).FbDone = 1 + return pRet +} + +// Launch a background thread to populate aFile[1] of pIncr. +func vdbeIncrBgPopulate(tls *libc.TLS, pIncr uintptr) int32 { /* sqlite3.c:97247:12: */ + var p uintptr = pIncr + + return vdbeSorterCreateThread(tls, (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) uintptr + }{vdbeIncrPopulateThread})), p) +} + +// This function is called when the PmaReader corresponding to pIncr has +// finished reading the contents of aFile[0]. Its purpose is to "refill" +// aFile[0] such that the PmaReader should start rereading it from the +// beginning. +// +// For single-threaded objects, this is accomplished by literally reading +// keys from pIncr->pMerger and repopulating aFile[0]. +// +// For multi-threaded objects, all that is required is to wait until the +// background thread is finished (if it is not already) and then swap +// aFile[0] and aFile[1] in place. If the contents of pMerger have not +// been exhausted, this function also launches a new background thread +// to populate the new aFile[1]. +// +// SQLITE_OK is returned on success, or an SQLite error code otherwise. +func vdbeIncrSwap(tls *libc.TLS, pIncr uintptr) int32 { /* sqlite3.c:97271:12: */ + var rc int32 = SQLITE_OK + + if (*IncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + rc = vdbeSorterJoinThread(tls, (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask) + + if rc == SQLITE_OK { + var f0 = *(*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))) + *(*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))) = *(*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */) + 1*16)) + *(*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */) + 1*16)) = f0 + } + + if rc == SQLITE_OK { + if (*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))).FiEof == (*IncrMerger)(unsafe.Pointer(pIncr)).FiStartOff { + (*IncrMerger)(unsafe.Pointer(pIncr)).FbEof = 1 + } else { + rc = vdbeIncrBgPopulate(tls, pIncr) + } + } + } else { + rc = vdbeIncrPopulate(tls, pIncr) + *(*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))) = *(*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */) + 1*16)) + if (*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */))).FiEof == (*IncrMerger)(unsafe.Pointer(pIncr)).FiStartOff { + (*IncrMerger)(unsafe.Pointer(pIncr)).FbEof = 1 + } + } + + return rc +} + +// Allocate and return a new IncrMerger object to read data from pMerger. +// +// If an OOM condition is encountered, return NULL. In this case free the +// pMerger argument before returning. +func vdbeIncrMergerNew(tls *libc.TLS, pTask uintptr, pMerger uintptr, ppOut uintptr) int32 { /* sqlite3.c:97310:12: */ + var rc int32 = SQLITE_OK + var pIncr uintptr = libc.AssignPtrUintptr(ppOut, func() uintptr { + if Xsqlite3FaultSim(tls, 100) != 0 { + return uintptr(0) + } + return Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(IncrMerger{}))) + }()) + if pIncr != 0 { + (*IncrMerger)(unsafe.Pointer(pIncr)).FpMerger = pMerger + (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask = pTask + (*IncrMerger)(unsafe.Pointer(pIncr)).FmxSz = func() int32 { + if ((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxKeysize + 9) > ((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxPmaSize / 2) { + return ((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxKeysize + 9) + } + return ((*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).FmxPmaSize / 2) + }() + *(*I64)(unsafe.Pointer(pTask + 88 /* &.file2 */ + 8 /* &.iEof */)) += (I64((*IncrMerger)(unsafe.Pointer(pIncr)).FmxSz)) + } else { + vdbeMergeEngineFree(tls, pMerger) + rc = SQLITE_NOMEM + } + return rc +} + +// Set the "use-threads" flag on object pIncr. +func vdbeIncrMergerSetThreads(tls *libc.TLS, pIncr uintptr) { /* sqlite3.c:97334:13: */ + (*IncrMerger)(unsafe.Pointer(pIncr)).FbUseThread = 1 + *(*I64)(unsafe.Pointer((*IncrMerger)(unsafe.Pointer(pIncr)).FpTask + 88 /* &.file2 */ + 8 /* &.iEof */)) -= (I64((*IncrMerger)(unsafe.Pointer(pIncr)).FmxSz)) +} + +// Recompute pMerger->aTree[iOut] by comparing the next keys on the +// two PmaReaders that feed that entry. Neither of the PmaReaders +// are advanced. This routine merely does the comparison. +func vdbeMergeEngineCompare(tls *libc.TLS, pMerger uintptr, iOut int32) { /* sqlite3.c:97347:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i1 int32 + var i2 int32 + var iRes int32 + var p1 uintptr + var p2 uintptr + + if iOut >= ((*MergeEngine)(unsafe.Pointer(pMerger)).FnTree / 2) { + i1 = ((iOut - ((*MergeEngine)(unsafe.Pointer(pMerger)).FnTree / 2)) * 2) + i2 = (i1 + 1) + } else { + i1 = *(*int32)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(pMerger)).FaTree + uintptr((iOut*2))*4)) + i2 = *(*int32)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(pMerger)).FaTree + uintptr(((iOut*2)+1))*4)) + } + + p1 = ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(i1)*80) + p2 = ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(i2)*80) + + if (*PmaReader)(unsafe.Pointer(p1)).FpFd == uintptr(0) { + iRes = i2 + } else if (*PmaReader)(unsafe.Pointer(p2)).FpFd == uintptr(0) { + iRes = i1 + } else { + var pTask uintptr = (*MergeEngine)(unsafe.Pointer(pMerger)).FpTask + *(*int32)(unsafe.Pointer(bp /* bCached */)) = 0 + var res int32 + // from vdbeSortSubtaskMain() + res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr, int32) int32)(unsafe.Pointer((pTask + 64 /* &.xCompare */))))(tls, + pTask, bp /* &bCached */, (*PmaReader)(unsafe.Pointer(p1)).FaKey, (*PmaReader)(unsafe.Pointer(p1)).FnKey, (*PmaReader)(unsafe.Pointer(p2)).FaKey, (*PmaReader)(unsafe.Pointer(p2)).FnKey) + if res <= 0 { + iRes = i1 + } else { + iRes = i2 + } + } + + *(*int32)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(pMerger)).FaTree + uintptr(iOut)*4)) = iRes +} + +// Initialize the MergeEngine object passed as the second argument. Once this +// function returns, the first key of merged data may be read from the +// MergeEngine object in the usual fashion. +// +// If argument eMode is INCRINIT_ROOT, then it is assumed that any IncrMerge +// objects attached to the PmaReader objects that the merger reads from have +// already been populated, but that they have not yet populated aFile[0] and +// set the PmaReader objects up to read from it. In this case all that is +// required is to call vdbePmaReaderNext() on each PmaReader to point it at +// its first key. +// +// Otherwise, if eMode is any value other than INCRINIT_ROOT, then use +// vdbePmaReaderIncrMergeInit() to initialize each PmaReader that feeds data +// to pMerger. +// +// SQLITE_OK is returned if successful, or an SQLite error code otherwise. +func vdbeMergeEngineInit(tls *libc.TLS, pTask uintptr, pMerger uintptr, eMode int32) int32 { /* sqlite3.c:97429:12: */ + var rc int32 = SQLITE_OK // Return code + var i int32 // For looping over PmaReader objects + var nTree int32 // Number of subtrees to merge + + // Failure to allocate the merge would have been detected prior to + // invoking this routine + + // eMode is always INCRINIT_NORMAL in single-threaded mode + + // Verify that the MergeEngine is assigned to a single thread + + (*MergeEngine)(unsafe.Pointer(pMerger)).FpTask = pTask + + nTree = (*MergeEngine)(unsafe.Pointer(pMerger)).FnTree + for i = 0; i < nTree; i++ { + if (SQLITE_MAX_WORKER_THREADS > 0) && (eMode == INCRINIT_ROOT) { + // PmaReaders should be normally initialized in order, as if they are + // reading from the same temp file this makes for more linear file IO. + // However, in the INCRINIT_ROOT case, if PmaReader aReadr[nTask-1] is + // in use it will block the vdbePmaReaderNext() call while it uses + // the main thread to fill its buffer. So calling PmaReaderNext() + // on this PmaReader before any of the multi-threaded PmaReaders takes + // better advantage of multi-processor hardware. + rc = vdbePmaReaderNext(tls, ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(((nTree-i)-1))*80)) + } else { + rc = vdbePmaReaderIncrInit(tls, ((*MergeEngine)(unsafe.Pointer(pMerger)).FaReadr + uintptr(i)*80), INCRINIT_NORMAL) + } + if rc != SQLITE_OK { + return rc + } + } + + for i = ((*MergeEngine)(unsafe.Pointer(pMerger)).FnTree - 1); i > 0; i-- { + vdbeMergeEngineCompare(tls, pMerger, i) + } + return int32((*UnpackedRecord)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpUnpacked)).FerrCode) +} + +// The PmaReader passed as the first argument is guaranteed to be an +// incremental-reader (pReadr->pIncr!=0). This function serves to open +// and/or initialize the temp file related fields of the IncrMerge +// object at (pReadr->pIncr). +// +// If argument eMode is set to INCRINIT_NORMAL, then all PmaReaders +// in the sub-tree headed by pReadr are also initialized. Data is then +// loaded into the buffers belonging to pReadr and it is set to point to +// the first key in its range. +// +// If argument eMode is set to INCRINIT_TASK, then pReadr is guaranteed +// to be a multi-threaded PmaReader and this function is being called in a +// background thread. In this case all PmaReaders in the sub-tree are +// initialized as for INCRINIT_NORMAL and the aFile[1] buffer belonging to +// pReadr is populated. However, pReadr itself is not set up to point +// to its first key. A call to vdbePmaReaderNext() is still required to do +// that. +// +// The reason this function does not call vdbePmaReaderNext() immediately +// in the INCRINIT_TASK case is that vdbePmaReaderNext() assumes that it has +// to block on thread (pTask->thread) before accessing aFile[1]. But, since +// this entire function is being run by thread (pTask->thread), that will +// lead to the current background thread attempting to join itself. +// +// Finally, if argument eMode is set to INCRINIT_ROOT, it may be assumed +// that pReadr->pIncr is a multi-threaded IncrMerge objects, and that all +// child-trees have already been initialized using IncrInit(INCRINIT_TASK). +// In this case vdbePmaReaderNext() is called on all child PmaReaders and +// the current PmaReader set to point to the first key in its range. +// +// SQLITE_OK is returned if successful, or an SQLite error code otherwise. +func vdbePmaReaderIncrMergeInit(tls *libc.TLS, pReadr uintptr, eMode int32) int32 { /* sqlite3.c:97505:12: */ + var rc int32 = SQLITE_OK + var pIncr uintptr = (*PmaReader)(unsafe.Pointer(pReadr)).FpIncr + var pTask uintptr = (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask + var db uintptr = (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask)).FpSorter)).Fdb + + // eMode is always INCRINIT_NORMAL in single-threaded mode + + rc = vdbeMergeEngineInit(tls, pTask, (*IncrMerger)(unsafe.Pointer(pIncr)).FpMerger, eMode) + + // Set up the required files for pIncr. A multi-theaded IncrMerge object + // requires two temp files to itself, whereas a single-threaded object + // only requires a region of pTask->file2. + if rc == SQLITE_OK { + var mxSz int32 = (*IncrMerger)(unsafe.Pointer(pIncr)).FmxSz + if (*IncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + rc = vdbeSorterOpenTempFile(tls, db, int64(mxSz), (pIncr + 40 /* &.aFile */) /* &.pFd */) + if rc == SQLITE_OK { + rc = vdbeSorterOpenTempFile(tls, db, int64(mxSz), ((pIncr + 40 /* &.aFile */) + 1*16 /* &.pFd */)) + } + } else { + if (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd == uintptr(0) { + + rc = vdbeSorterOpenTempFile(tls, db, (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof, (pTask + 88 /* &.file2 */ /* &.pFd */)) + (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof = int64(0) + } + if rc == SQLITE_OK { + (*SorterFile)(unsafe.Pointer((pIncr + 40 /* &.aFile */) + 1*16)).FpFd = (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FpFd + (*IncrMerger)(unsafe.Pointer(pIncr)).FiStartOff = (*SortSubtask)(unsafe.Pointer(pTask)).Ffile2.FiEof + *(*I64)(unsafe.Pointer(pTask + 88 /* &.file2 */ + 8 /* &.iEof */)) += (I64(mxSz)) + } + } + } + + if (rc == SQLITE_OK) && ((*IncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0) { + // Use the current thread to populate aFile[1], even though this + // PmaReader is multi-threaded. If this is an INCRINIT_TASK object, + // then this function is already running in background thread + // pIncr->pTask->thread. + // + // If this is the INCRINIT_ROOT object, then it is running in the + // main VDBE thread. But that is Ok, as that thread cannot return + // control to the VDBE or proceed with anything useful until the + // first results are ready from this merger object anyway. + + rc = vdbeIncrPopulate(tls, pIncr) + } + + if (rc == SQLITE_OK) && ((SQLITE_MAX_WORKER_THREADS == 0) || (eMode != INCRINIT_TASK)) { + rc = vdbePmaReaderNext(tls, pReadr) + } + + return rc +} + +// The main routine for vdbePmaReaderIncrMergeInit() operations run in +// background threads. +func vdbePmaReaderBgIncrInit(tls *libc.TLS, pCtx uintptr) uintptr { /* sqlite3.c:97572:13: */ + var pReader uintptr = pCtx + var pRet uintptr = uintptr(int64(vdbePmaReaderIncrMergeInit(tls, pReader, INCRINIT_TASK))) + (*SortSubtask)(unsafe.Pointer((*IncrMerger)(unsafe.Pointer((*PmaReader)(unsafe.Pointer(pReader)).FpIncr)).FpTask)).FbDone = 1 + return pRet +} + +// If the PmaReader passed as the first argument is not an incremental-reader +// (if pReadr->pIncr==0), then this function is a no-op. Otherwise, it invokes +// the vdbePmaReaderIncrMergeInit() function with the parameters passed to +// this routine to initialize the incremental merge. +// +// If the IncrMerger object is multi-threaded (IncrMerger.bUseThread==1), +// then a background thread is launched to call vdbePmaReaderIncrMergeInit(). +// Or, if the IncrMerger is single threaded, the same function is called +// using the current thread. +func vdbePmaReaderIncrInit(tls *libc.TLS, pReadr uintptr, eMode int32) int32 { /* sqlite3.c:97593:12: */ + var pIncr uintptr = (*PmaReader)(unsafe.Pointer(pReadr)).FpIncr // Incremental merger + var rc int32 = SQLITE_OK // Return code + if pIncr != 0 { + + if (*IncrMerger)(unsafe.Pointer(pIncr)).FbUseThread != 0 { + var pCtx uintptr = pReadr + rc = vdbeSorterCreateThread(tls, (*IncrMerger)(unsafe.Pointer(pIncr)).FpTask, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) uintptr + }{vdbePmaReaderBgIncrInit})), pCtx) + } else { + rc = vdbePmaReaderIncrMergeInit(tls, pReadr, eMode) + } + } + return rc +} + +// Allocate a new MergeEngine object to merge the contents of nPMA level-0 +// PMAs from pTask->file. If no error occurs, set *ppOut to point to +// the new object and return SQLITE_OK. Or, if an error does occur, set *ppOut +// to NULL and return an SQLite error code. +// +// When this function is called, *piOffset is set to the offset of the +// first PMA to read from pTask->file. Assuming no error occurs, it is +// set to the offset immediately following the last byte of the last +// PMA before returning. If an error does occur, then the final value of +// *piOffset is undefined. +func vdbeMergeEngineLevel0(tls *libc.TLS, pTask uintptr, nPMA int32, piOffset uintptr, ppOut uintptr) int32 { /* sqlite3.c:97623:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pNew uintptr // Merge engine to return + var iOff I64 = *(*I64)(unsafe.Pointer(piOffset)) + var i int32 + var rc int32 = SQLITE_OK + + *(*uintptr)(unsafe.Pointer(ppOut)) = libc.AssignUintptr(&pNew, vdbeMergeEngineNew(tls, nPMA)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } + + for i = 0; (i < nPMA) && (rc == SQLITE_OK); i++ { + *(*I64)(unsafe.Pointer(bp /* nDummy */)) = int64(0) + var pReadr uintptr = ((*MergeEngine)(unsafe.Pointer(pNew)).FaReadr + uintptr(i)*80) + rc = vdbePmaReaderInit(tls, pTask, (pTask + 72 /* &.file */), iOff, pReadr, bp /* &nDummy */) + iOff = (*PmaReader)(unsafe.Pointer(pReadr)).FiEof + } + + if rc != SQLITE_OK { + vdbeMergeEngineFree(tls, pNew) + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } + *(*I64)(unsafe.Pointer(piOffset)) = iOff + return rc +} + +// Return the depth of a tree comprising nPMA PMAs, assuming a fanout of +// SORTER_MAX_MERGE_COUNT. The returned value does not include leaf nodes. +// +// i.e. +// +// nPMA<=16 -> TreeDepth() == 0 +// nPMA<=256 -> TreeDepth() == 1 +// nPMA<=65536 -> TreeDepth() == 2 +func vdbeSorterTreeDepth(tls *libc.TLS, nPMA int32) int32 { /* sqlite3.c:97662:12: */ + var nDepth int32 = 0 + var nDiv I64 = int64(SORTER_MAX_MERGE_COUNT) + for nDiv < I64(nPMA) { + nDiv = (nDiv * int64(SORTER_MAX_MERGE_COUNT)) + nDepth++ + } + return nDepth +} + +// pRoot is the root of an incremental merge-tree with depth nDepth (according +// to vdbeSorterTreeDepth()). pLeaf is the iSeq'th leaf to be added to the +// tree, counting from zero. This function adds pLeaf to the tree. +// +// If successful, SQLITE_OK is returned. If an error occurs, an SQLite error +// code is returned and pLeaf is freed. +func vdbeSorterAddToTree(tls *libc.TLS, pTask uintptr, nDepth int32, iSeq int32, pRoot uintptr, pLeaf uintptr) int32 { /* sqlite3.c:97680:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var nDiv int32 = 1 + var i int32 + var p uintptr = pRoot + // var pIncr uintptr at bp, 8 + + rc = vdbeIncrMergerNew(tls, pTask, pLeaf, bp /* &pIncr */) + + for i = 1; i < nDepth; i++ { + nDiv = (nDiv * SORTER_MAX_MERGE_COUNT) + } + + for i = 1; (i < nDepth) && (rc == SQLITE_OK); i++ { + var iIter int32 = ((iSeq / nDiv) % SORTER_MAX_MERGE_COUNT) + var pReadr uintptr = ((*MergeEngine)(unsafe.Pointer(p)).FaReadr + uintptr(iIter)*80) + + if (*PmaReader)(unsafe.Pointer(pReadr)).FpIncr == uintptr(0) { + var pNew uintptr = vdbeMergeEngineNew(tls, SORTER_MAX_MERGE_COUNT) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = vdbeIncrMergerNew(tls, pTask, pNew, (pReadr + 72 /* &.pIncr */)) + } + } + if rc == SQLITE_OK { + p = (*IncrMerger)(unsafe.Pointer((*PmaReader)(unsafe.Pointer(pReadr)).FpIncr)).FpMerger + nDiv = (nDiv / SORTER_MAX_MERGE_COUNT) + } + } + + if rc == SQLITE_OK { + (*PmaReader)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(p)).FaReadr + uintptr((iSeq%SORTER_MAX_MERGE_COUNT))*80)).FpIncr = *(*uintptr)(unsafe.Pointer(bp /* pIncr */)) + } else { + vdbeIncrFree(tls, *(*uintptr)(unsafe.Pointer(bp /* pIncr */))) + } + return rc +} + +// This function is called as part of a SorterRewind() operation on a sorter +// that has already written two or more level-0 PMAs to one or more temp +// files. It builds a tree of MergeEngine/IncrMerger/PmaReader objects that +// can be used to incrementally merge all PMAs on disk. +// +// If successful, SQLITE_OK is returned and *ppOut set to point to the +// MergeEngine object at the root of the tree before returning. Or, if an +// error occurs, an SQLite error code is returned and the final value +// of *ppOut is undefined. +func vdbeSorterMergeTreeBuild(tls *libc.TLS, pSorter uintptr, ppOut uintptr) int32 { /* sqlite3.c:97736:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pMain uintptr = uintptr(0) + var rc int32 = SQLITE_OK + var iTask int32 + + // If the sorter uses more than one task, then create the top-level + // MergeEngine here. This MergeEngine will read data from exactly + // one PmaReader per sub-task. + + if int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask) > 1 { + pMain = vdbeMergeEngineNew(tls, int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask)) + if pMain == uintptr(0) { + rc = SQLITE_NOMEM + } + } + + for iTask = 0; (rc == SQLITE_OK) && (iTask < int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask)); iTask++ { + var pTask uintptr = ((pSorter + 96 /* &.aTask */) + uintptr(iTask)*104) + + if (SQLITE_MAX_WORKER_THREADS == 0) || ((*SortSubtask)(unsafe.Pointer(pTask)).FnPMA != 0) { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */)) = uintptr(0) // Root node of tree for this task + var nDepth int32 = vdbeSorterTreeDepth(tls, (*SortSubtask)(unsafe.Pointer(pTask)).FnPMA) + *(*I64)(unsafe.Pointer(bp /* iReadOff */)) = int64(0) + + if (*SortSubtask)(unsafe.Pointer(pTask)).FnPMA <= SORTER_MAX_MERGE_COUNT { + rc = vdbeMergeEngineLevel0(tls, pTask, (*SortSubtask)(unsafe.Pointer(pTask)).FnPMA, bp /* &iReadOff */, bp+8 /* &pRoot */) + } else { + var i int32 + var iSeq int32 = 0 + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */)) = vdbeMergeEngineNew(tls, SORTER_MAX_MERGE_COUNT) + if *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */)) == uintptr(0) { + rc = SQLITE_NOMEM + } + for i = 0; (i < (*SortSubtask)(unsafe.Pointer(pTask)).FnPMA) && (rc == SQLITE_OK); i = i + (SORTER_MAX_MERGE_COUNT) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pMerger */)) = uintptr(0) // New level-0 PMA merger + var nReader int32 // Number of level-0 PMAs to merge + + nReader = func() int32 { + if ((*SortSubtask)(unsafe.Pointer(pTask)).FnPMA - i) < (SORTER_MAX_MERGE_COUNT) { + return ((*SortSubtask)(unsafe.Pointer(pTask)).FnPMA - i) + } + return SORTER_MAX_MERGE_COUNT + }() + rc = vdbeMergeEngineLevel0(tls, pTask, nReader, bp /* &iReadOff */, bp+16 /* &pMerger */) + if rc == SQLITE_OK { + rc = vdbeSorterAddToTree(tls, pTask, nDepth, libc.PostIncInt32(&iSeq, 1), *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* pMerger */))) + } + } + } + + if rc == SQLITE_OK { + if pMain != uintptr(0) { + rc = vdbeIncrMergerNew(tls, pTask, *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */)), ((*MergeEngine)(unsafe.Pointer(pMain)).FaReadr + uintptr(iTask)*80 + 72 /* &.pIncr */)) + } else { + + pMain = *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */)) + } + } else { + vdbeMergeEngineFree(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pRoot */))) + } + } + } + + if rc != SQLITE_OK { + vdbeMergeEngineFree(tls, pMain) + pMain = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(ppOut)) = pMain + return rc +} + +// This function is called as part of an sqlite3VdbeSorterRewind() operation +// on a sorter that has written two or more PMAs to temporary files. It sets +// up either VdbeSorter.pMerger (for single threaded sorters) or pReader +// (for multi-threaded sorters) so that it can be used to iterate through +// all records stored in the sorter. +// +// SQLITE_OK is returned if successful, or an SQLite error code otherwise. +func vdbeSorterSetupMerge(tls *libc.TLS, pSorter uintptr) int32 { /* sqlite3.c:97815:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 // Return code + var pTask0 uintptr = (pSorter + 96 /* &.aTask */) + *(*uintptr)(unsafe.Pointer(bp /* pMain */)) = uintptr(0) + var db uintptr = (*VdbeSorter)(unsafe.Pointer((*SortSubtask)(unsafe.Pointer(pTask0)).FpSorter)).Fdb + var i int32 + var xCompare SorterCompare = vdbeSorterGetCompare(tls, pSorter) + for i = 0; i < int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask); i++ { + (*SortSubtask)(unsafe.Pointer((pSorter + 96 /* &.aTask */) + uintptr(i)*104)).FxCompare = xCompare + } + + rc = vdbeSorterMergeTreeBuild(tls, pSorter, bp /* &pMain */) + if rc == SQLITE_OK { + + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { + var iTask int32 + var pReadr uintptr = uintptr(0) + var pLast uintptr = ((pSorter + 96 /* &.aTask */) + uintptr((int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask)-1))*104) + rc = vdbeSortAllocUnpacked(tls, pLast) + if rc == SQLITE_OK { + pReadr = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(PmaReader{}))) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader = pReadr + if pReadr == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + rc = vdbeIncrMergerNew(tls, pLast, *(*uintptr)(unsafe.Pointer(bp /* pMain */)), (pReadr + 72 /* &.pIncr */)) + if rc == SQLITE_OK { + vdbeIncrMergerSetThreads(tls, (*PmaReader)(unsafe.Pointer(pReadr)).FpIncr) + for iTask = 0; iTask < (int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask) - 1); iTask++ { + var pIncr uintptr + if libc.AssignUintptr(&pIncr, (*PmaReader)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pMain */)))).FaReadr+uintptr(iTask)*80)).FpIncr) != 0 { + vdbeIncrMergerSetThreads(tls, pIncr) + + } + } + for iTask = 0; (rc == SQLITE_OK) && (iTask < int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FnTask)); iTask++ { + // Check that: + // + // a) The incremental merge object is configured to use the + // right task, and + // b) If it is using task (nTask-1), it is configured to run + // in single-threaded mode. This is important, as the + // root merge (INCRINIT_ROOT) will be using the same task + // object. + var p uintptr = ((*MergeEngine)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pMain */)))).FaReadr + uintptr(iTask)*80) + + rc = vdbePmaReaderIncrInit(tls, p, INCRINIT_TASK) + } + } + *(*uintptr)(unsafe.Pointer(bp /* pMain */)) = uintptr(0) + } + if rc == SQLITE_OK { + rc = vdbePmaReaderIncrMergeInit(tls, pReadr, INCRINIT_ROOT) + } + } else { + rc = vdbeMergeEngineInit(tls, pTask0, *(*uintptr)(unsafe.Pointer(bp /* pMain */)), INCRINIT_NORMAL) + (*VdbeSorter)(unsafe.Pointer(pSorter)).FpMerger = *(*uintptr)(unsafe.Pointer(bp /* pMain */)) + *(*uintptr)(unsafe.Pointer(bp /* pMain */)) = uintptr(0) + } + } + + if rc != SQLITE_OK { + vdbeMergeEngineFree(tls, *(*uintptr)(unsafe.Pointer(bp /* pMain */))) + } + return rc +} + +// Once the sorter has been populated by calls to sqlite3VdbeSorterWrite, +// this function is called to prepare for iterating through the records +// in sorted order. +func Xsqlite3VdbeSorterRewind(tls *libc.TLS, pCsr uintptr, pbEof uintptr) int32 { /* sqlite3.c:97897:20: */ + var pSorter uintptr + var rc int32 = SQLITE_OK // Return code + + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) + + // If no data has been written to disk, then do not do so now. Instead, + // sort the VdbeSorter.pRecord list. The vdbe layer will read data directly + // from the in-memory list. + if int32((*VdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA) == 0 { + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + *(*int32)(unsafe.Pointer(pbEof)) = 0 + rc = vdbeSorterSort(tls, (pSorter + 96 /* &.aTask */), (pSorter + 56 /* &.list */)) + } else { + *(*int32)(unsafe.Pointer(pbEof)) = 1 + } + return rc + } + + // Write the current in-memory list to a PMA. When the VdbeSorterWrite() + // function flushes the contents of memory to disk, it immediately always + // creates a new list consisting of a single key immediately afterwards. + // So the list is never empty at this point. + + rc = vdbeSorterFlushPMA(tls, pSorter) + + // Join all threads + rc = vdbeSorterJoinAll(tls, pSorter, rc) + + // Assuming no errors have occurred, set up a merger structure to + // incrementally read and merge all remaining PMAs. + + if rc == SQLITE_OK { + rc = vdbeSorterSetupMerge(tls, pSorter) + *(*int32)(unsafe.Pointer(pbEof)) = 0 + } + + return rc +} + +// Advance to the next element in the sorter. Return value: +// +// SQLITE_OK success +// SQLITE_DONE end of data +// otherwise some kind of error. +func Xsqlite3VdbeSorterNext(tls *libc.TLS, db uintptr, pCsr uintptr) int32 { /* sqlite3.c:97949:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSorter uintptr + var rc int32 // Return code + + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) + + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA != 0 { + + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { + rc = vdbePmaReaderNext(tls, (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader) + if (rc == SQLITE_OK) && ((*PmaReader)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader)).FpFd == uintptr(0)) { + rc = SQLITE_DONE + } + } else { + *(*int32)(unsafe.Pointer(bp /* res */)) = 0 + + rc = vdbeMergeEngineStep(tls, (*VdbeSorter)(unsafe.Pointer(pSorter)).FpMerger, bp /* &res */) + if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* res */)) != 0) { + rc = SQLITE_DONE + } + } + } else { + var pFree uintptr = (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList + (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList = *(*uintptr)(unsafe.Pointer(pFree + 8 /* &.u */)) + *(*uintptr)(unsafe.Pointer(pFree + 8 /* &.u */)) = uintptr(0) + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FaMemory == uintptr(0) { + vdbeSorterRecordFree(tls, db, pFree) + } + if (*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList != 0 { + rc = SQLITE_OK + } else { + rc = SQLITE_DONE + } + } + return rc +} + +// Return a pointer to a buffer owned by the sorter that contains the +// current key. +func vdbeSorterRowkey(tls *libc.TLS, pSorter uintptr, pnKey uintptr) uintptr { /* sqlite3.c:97987:13: */ + var pKey uintptr + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUsePMA != 0 { + var pReader uintptr + if (*VdbeSorter)(unsafe.Pointer(pSorter)).FbUseThreads != 0 { + pReader = (*VdbeSorter)(unsafe.Pointer(pSorter)).FpReader + } else { + pReader = ((*MergeEngine)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer(pSorter)).FpMerger)).FaReadr + uintptr(*(*int32)(unsafe.Pointer((*MergeEngine)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer(pSorter)).FpMerger)).FaTree + 1*4)))*80) + } + *(*int32)(unsafe.Pointer(pnKey)) = (*PmaReader)(unsafe.Pointer(pReader)).FnKey + pKey = (*PmaReader)(unsafe.Pointer(pReader)).FaKey + } else { + *(*int32)(unsafe.Pointer(pnKey)) = (*SorterRecord)(unsafe.Pointer((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList)).FnVal + pKey = (((*VdbeSorter)(unsafe.Pointer(pSorter)).Flist.FpList) + uintptr(1)*16) + } + return pKey +} + +// Copy the current sorter key into the memory cell pOut. +func Xsqlite3VdbeSorterRowkey(tls *libc.TLS, pCsr uintptr, pOut uintptr) int32 { /* sqlite3.c:98014:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSorter uintptr + var pKey uintptr + // var nKey int32 at bp, 4 + // Sorter key to copy into pOut + + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) + pKey = vdbeSorterRowkey(tls, pSorter, bp /* &nKey */) + if Xsqlite3VdbeMemClearAndResize(tls, pOut, *(*int32)(unsafe.Pointer(bp /* nKey */))) != 0 { + return SQLITE_NOMEM + } + (*Mem)(unsafe.Pointer(pOut)).Fn = *(*int32)(unsafe.Pointer(bp /* nKey */)) + (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Blob)) + libc.Xmemcpy(tls, (*Mem)(unsafe.Pointer(pOut)).Fz, pKey, uint64(*(*int32)(unsafe.Pointer(bp /* nKey */)))) + + return SQLITE_OK +} + +// Compare the key in memory cell pVal with the key that the sorter cursor +// passed as the first argument currently points to. For the purposes of +// the comparison, ignore the rowid field at the end of each record. +// +// If the sorter cursor key contains any NULL values, consider it to be +// less than pVal. Even if pVal also contains NULL values. +// +// If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM). +// Otherwise, set *pRes to a negative, zero or positive value if the +// key in pVal is smaller than, equal to or larger than the current sorter +// key. +// +// This routine forms the core of the OP_SorterCompare opcode, which in +// turn is used to verify uniqueness when constructing a UNIQUE INDEX. +func Xsqlite3VdbeSorterCompare(tls *libc.TLS, pCsr uintptr, pVal uintptr, nKeyCol int32, pRes uintptr) int32 { /* sqlite3.c:98047:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSorter uintptr + var r2 uintptr + var pKeyInfo uintptr + var i int32 + var pKey uintptr + // var nKey int32 at bp, 4 + // Sorter key to compare pVal with + + pSorter = *(*uintptr)(unsafe.Pointer(pCsr + 56 /* &.uc */)) + r2 = (*VdbeSorter)(unsafe.Pointer(pSorter)).FpUnpacked + pKeyInfo = (*VdbeCursor)(unsafe.Pointer(pCsr)).FpKeyInfo + if r2 == uintptr(0) { + r2 = libc.AssignPtrUintptr(pSorter+48 /* &.pUnpacked */, Xsqlite3VdbeAllocUnpackedRecord(tls, pKeyInfo)) + if r2 == uintptr(0) { + return SQLITE_NOMEM + } + (*UnpackedRecord)(unsafe.Pointer(r2)).FnField = U16(nKeyCol) + } + + pKey = vdbeSorterRowkey(tls, pSorter, bp /* &nKey */) + Xsqlite3VdbeRecordUnpack(tls, pKeyInfo, *(*int32)(unsafe.Pointer(bp /* nKey */)), pKey, r2) + for i = 0; i < nKeyCol; i++ { + if (int32((*Mem)(unsafe.Pointer((*UnpackedRecord)(unsafe.Pointer(r2)).FaMem+uintptr(i)*56)).Fflags) & MEM_Null) != 0 { + *(*int32)(unsafe.Pointer(pRes)) = -1 + return SQLITE_OK + } + } + + *(*int32)(unsafe.Pointer(pRes)) = Xsqlite3VdbeRecordCompare(tls, (*Mem)(unsafe.Pointer(pVal)).Fn, (*Mem)(unsafe.Pointer(pVal)).Fz, r2) + return SQLITE_OK +} + +//************* End of vdbesort.c ******************************************* +//************* Begin file vdbevtab.c *************************************** +// 2020-03-23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements virtual-tables for examining the bytecode content +// of a prepared statement. +// #include "sqliteInt.h" + +//************* End of vdbevtab.c ******************************************* +//************* Begin file memjournal.c ************************************* +// 2008 October 7 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code use to implement an in-memory rollback journal. +// The in-memory rollback journal is used to journal transactions for +// ":memory:" databases and when the journal_mode=MEMORY pragma is used. +// +// Update: The in-memory journal is also used to temporarily cache +// smaller journals that are not critical for power-loss recovery. +// For example, statement journals that are not too big will be held +// entirely in memory, thus reducing the number of file I/O calls, and +// more importantly, reducing temporary file creation events. If these +// journals become too large for memory, they are spilled to disk. But +// in the common case, they are usually small and no file I/O needs to +// occur. +// #include "sqliteInt.h" + +// Forward references to internal structures +type MemJournal1 = struct { + FpMethod uintptr + FnChunkSize int32 + FnSpill int32 + FpFirst uintptr + Fendpoint FilePoint + Freadpoint FilePoint + Fflags int32 + _ [4]byte + FpVfs uintptr + FzJournal uintptr +} /* sqlite3.c:98540:9 */ + +//************* End of vdbesort.c ******************************************* +//************* Begin file vdbevtab.c *************************************** +// 2020-03-23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements virtual-tables for examining the bytecode content +// of a prepared statement. +// #include "sqliteInt.h" + +//************* End of vdbevtab.c ******************************************* +//************* Begin file memjournal.c ************************************* +// 2008 October 7 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code use to implement an in-memory rollback journal. +// The in-memory rollback journal is used to journal transactions for +// ":memory:" databases and when the journal_mode=MEMORY pragma is used. +// +// Update: The in-memory journal is also used to temporarily cache +// smaller journals that are not critical for power-loss recovery. +// For example, statement journals that are not too big will be held +// entirely in memory, thus reducing the number of file I/O calls, and +// more importantly, reducing temporary file creation events. If these +// journals become too large for memory, they are spilled to disk. But +// in the common case, they are usually small and no file I/O needs to +// occur. +// #include "sqliteInt.h" + +// Forward references to internal structures +type MemJournal = MemJournal1 /* sqlite3.c:98540:27 */ +type FilePoint1 = struct { + FiOffset Sqlite3_int64 + FpChunk uintptr +} /* sqlite3.c:98540:9 */ + +type FilePoint = FilePoint1 /* sqlite3.c:98541:26 */ +type FileChunk1 = struct { + FpNext uintptr + FzChunk [8]U8 +} /* sqlite3.c:98540:9 */ + +type FileChunk = FileChunk1 /* sqlite3.c:98542:26 */ + +// Read data from the in-memory journal file. This is the implementation +// of the sqlite3_vfs.xRead method. +func memjrnlRead(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst Sqlite_int64) int32 { /* sqlite3.c:98597:12: */ + var p uintptr = pJfd + var zOut uintptr = zBuf + var nRead int32 = iAmt + var iChunkOffset int32 + var pChunk uintptr + + if (Sqlite_int64(iAmt) + iOfst) > (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { + return (SQLITE_IOERR | (int32(2) << 8)) + } + + if ((*MemJournal)(unsafe.Pointer(p)).Freadpoint.FiOffset != iOfst) || (iOfst == int64(0)) { + var iOff Sqlite3_int64 = int64(0) + for pChunk = (*MemJournal)(unsafe.Pointer(p)).FpFirst; (pChunk != 0) && ((iOff + Sqlite3_int64((*MemJournal)(unsafe.Pointer(p)).FnChunkSize)) <= iOfst); pChunk = (*FileChunk)(unsafe.Pointer(pChunk)).FpNext { + iOff = iOff + (Sqlite3_int64((*MemJournal)(unsafe.Pointer(p)).FnChunkSize)) + } + } else { + pChunk = (*MemJournal)(unsafe.Pointer(p)).Freadpoint.FpChunk + + } + + iChunkOffset = (int32(iOfst % Sqlite_int64((*MemJournal)(unsafe.Pointer(p)).FnChunkSize))) + for ok := true; ok; ok = (((nRead >= 0) && ((libc.AssignUintptr(&pChunk, (*FileChunk)(unsafe.Pointer(pChunk)).FpNext)) != uintptr(0))) && (nRead > 0)) { + var iSpace int32 = ((*MemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset) + var nCopy int32 = func() int32 { + if (nRead) < ((*MemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset) { + return nRead + } + return ((*MemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset) + }() + libc.Xmemcpy(tls, zOut, (pChunk + 8 /* &.zChunk */ + uintptr(iChunkOffset)), uint64(nCopy)) + zOut += uintptr(nCopy) + nRead = nRead - (iSpace) + iChunkOffset = 0 + } + (*MemJournal)(unsafe.Pointer(p)).Freadpoint.FiOffset = func() int64 { + if pChunk != 0 { + return (iOfst + Sqlite_int64(iAmt)) + } + return int64(0) + }() + (*MemJournal)(unsafe.Pointer(p)).Freadpoint.FpChunk = pChunk + + return SQLITE_OK +} + +// Free the list of FileChunk structures headed at MemJournal.pFirst. +func memjrnlFreeChunks(tls *libc.TLS, pFirst uintptr) { /* sqlite3.c:98644:13: */ + var pIter uintptr + var pNext uintptr + for pIter = pFirst; pIter != 0; pIter = pNext { + pNext = (*FileChunk)(unsafe.Pointer(pIter)).FpNext + Xsqlite3_free(tls, pIter) + } +} + +// Flush the contents of memory to a real file on disk. +func memjrnlCreateFile(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:98656:12: */ + var rc int32 + var pReal uintptr = p + var copy = *(*MemJournal)(unsafe.Pointer(p)) + + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(MemJournal{}))) + rc = Xsqlite3OsOpen(tls, copy.FpVfs, copy.FzJournal, pReal, copy.Fflags, uintptr(0)) + if rc == SQLITE_OK { + var nChunk int32 = copy.FnChunkSize + var iOff I64 = int64(0) + var pIter uintptr + for pIter = copy.FpFirst; pIter != 0; pIter = (*FileChunk)(unsafe.Pointer(pIter)).FpNext { + if (iOff + I64(nChunk)) > copy.Fendpoint.FiOffset { + nChunk = (int32(copy.Fendpoint.FiOffset - iOff)) + } + rc = Xsqlite3OsWrite(tls, pReal, pIter+8 /* &.zChunk */, nChunk, iOff) + if rc != 0 { + break + } + iOff = iOff + (I64(nChunk)) + } + if rc == SQLITE_OK { + // No error has occurred. Free the in-memory buffers. + memjrnlFreeChunks(tls, copy.FpFirst) + } + } + if rc != SQLITE_OK { + // If an error occurred while creating or writing to the file, restore + // the original before returning. This way, SQLite uses the in-memory + // journal data to roll back changes made to the internal page-cache + // before this function was called. + Xsqlite3OsClose(tls, pReal) + *(*MemJournal)(unsafe.Pointer(p)) = copy + } + return rc +} + +// Write data to the file. +func memjrnlWrite(tls *libc.TLS, pJfd uintptr, zBuf uintptr, iAmt int32, iOfst Sqlite_int64) int32 { /* sqlite3.c:98695:12: */ + var p uintptr = pJfd + var nWrite int32 = iAmt + var zWrite uintptr = zBuf + + // If the file should be created now, create it and write the new data + // into the file on disk. + if ((*MemJournal)(unsafe.Pointer(p)).FnSpill > 0) && ((Sqlite_int64(iAmt) + iOfst) > Sqlite_int64((*MemJournal)(unsafe.Pointer(p)).FnSpill)) { + var rc int32 = memjrnlCreateFile(tls, p) + if rc == SQLITE_OK { + rc = Xsqlite3OsWrite(tls, pJfd, zBuf, iAmt, iOfst) + } + return rc + } else { + // An in-memory journal file should only ever be appended to. Random + // access writes are not required. The only exception to this is when + // the in-memory journal is being used by a connection using the + // atomic-write optimization. In this case the first 28 bytes of the + // journal file may be written as part of committing the transaction. + + { + for nWrite > 0 { + var pChunk uintptr = (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FpChunk + var iChunkOffset int32 = (int32((*MemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset % Sqlite3_int64((*MemJournal)(unsafe.Pointer(p)).FnChunkSize))) + var iSpace int32 = func() int32 { + if (nWrite) < ((*MemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset) { + return nWrite + } + return ((*MemJournal)(unsafe.Pointer(p)).FnChunkSize - iChunkOffset) + }() + + if iChunkOffset == 0 { + // New chunk is required to extend the file. + var pNew uintptr = Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(FileChunk{})) + (uint64(((*MemJournal)(unsafe.Pointer(p)).FnChunkSize) - 8))))) + if !(pNew != 0) { + return (SQLITE_IOERR | (int32(12) << 8)) + } + (*FileChunk)(unsafe.Pointer(pNew)).FpNext = uintptr(0) + if pChunk != 0 { + + (*FileChunk)(unsafe.Pointer(pChunk)).FpNext = pNew + } else { + + (*MemJournal)(unsafe.Pointer(p)).FpFirst = pNew + } + (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FpChunk = pNew + } + + libc.Xmemcpy(tls, ((*MemJournal)(unsafe.Pointer(p)).Fendpoint.FpChunk + 8 /* &.zChunk */ + uintptr(iChunkOffset)), zWrite, uint64(iSpace)) + zWrite += uintptr(iSpace) + nWrite = nWrite - (iSpace) + *(*Sqlite3_int64)(unsafe.Pointer(p + 24 /* &.endpoint */ /* &.iOffset */)) += (Sqlite3_int64(iSpace)) + } + + } + } + + return SQLITE_OK +} + +// Truncate the in-memory file. +func memjrnlTruncate(tls *libc.TLS, pJfd uintptr, size Sqlite_int64) int32 { /* sqlite3.c:98769:12: */ + var p uintptr = pJfd + + if size < (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset { + var pIter uintptr = uintptr(0) + if size == int64(0) { + memjrnlFreeChunks(tls, (*MemJournal)(unsafe.Pointer(p)).FpFirst) + (*MemJournal)(unsafe.Pointer(p)).FpFirst = uintptr(0) + } else { + var iOff I64 = I64((*MemJournal)(unsafe.Pointer(p)).FnChunkSize) + for pIter = (*MemJournal)(unsafe.Pointer(p)).FpFirst; (pIter != 0) && (iOff <= size); pIter = (*FileChunk)(unsafe.Pointer(pIter)).FpNext { + iOff = iOff + (I64((*MemJournal)(unsafe.Pointer(p)).FnChunkSize)) + } + if pIter != 0 { + memjrnlFreeChunks(tls, (*FileChunk)(unsafe.Pointer(pIter)).FpNext) + (*FileChunk)(unsafe.Pointer(pIter)).FpNext = uintptr(0) + } + } + + (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FpChunk = pIter + (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset = size + (*MemJournal)(unsafe.Pointer(p)).Freadpoint.FpChunk = uintptr(0) + (*MemJournal)(unsafe.Pointer(p)).Freadpoint.FiOffset = int64(0) + } + return SQLITE_OK +} + +// Close the file. +func memjrnlClose(tls *libc.TLS, pJfd uintptr) int32 { /* sqlite3.c:98799:12: */ + var p uintptr = pJfd + memjrnlFreeChunks(tls, (*MemJournal)(unsafe.Pointer(p)).FpFirst) + return SQLITE_OK +} + +// Sync the file. +// +// If the real file has been created, call its xSync method. Otherwise, +// syncing an in-memory journal is a no-op. +func memjrnlSync(tls *libc.TLS, pJfd uintptr, flags int32) int32 { /* sqlite3.c:98811:12: */ + _ = pJfd + _ = flags + return SQLITE_OK +} + +// Query the size of the file in bytes. +func memjrnlFileSize(tls *libc.TLS, pJfd uintptr, pSize uintptr) int32 { /* sqlite3.c:98819:12: */ + var p uintptr = pJfd + *(*Sqlite_int64)(unsafe.Pointer(pSize)) = (*MemJournal)(unsafe.Pointer(p)).Fendpoint.FiOffset + return SQLITE_OK +} + +// Table of methods for MemJournal sqlite3_file object. +var sMemJournalMethods = sqlite3_io_methods{ + FiVersion: 1, // iVersion + FxClose: 0, // xClose + FxRead: 0, // xRead + FxWrite: 0, // xWrite + FxTruncate: 0, // xTruncate + FxSync: 0, // xSync + FxFileSize: 0, // xUnfetch +} /* sqlite3.c:98828:40 */ + +// Open a journal file. +// +// The behaviour of the journal file depends on the value of parameter +// nSpill. If nSpill is 0, then the journal file is always create and +// accessed using the underlying VFS. If nSpill is less than zero, then +// all content is always stored in main-memory. Finally, if nSpill is a +// positive value, then the journal file is initially created in-memory +// but may be flushed to disk later on. In this case the journal file is +// flushed to disk either when it grows larger than nSpill bytes in size, +// or when sqlite3JournalCreate() is called. +func Xsqlite3JournalOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pJfd uintptr, flags int32, nSpill int32) int32 { /* sqlite3.c:98862:20: */ + var p uintptr = pJfd + + // Zero the file-handle object. If nSpill was passed zero, initialize + // it using the sqlite3OsOpen() function of the underlying VFS. In this + // case none of the code in this module is executed as a result of calls + // made on the journal file-handle. + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(MemJournal{}))) + if nSpill == 0 { + return Xsqlite3OsOpen(tls, pVfs, zName, pJfd, flags, uintptr(0)) + } + + if nSpill > 0 { + (*MemJournal)(unsafe.Pointer(p)).FnChunkSize = nSpill + } else { + (*MemJournal)(unsafe.Pointer(p)).FnChunkSize = (int32((uint64(8 + MEMJOURNAL_DFLT_FILECHUNKSIZE)) - uint64(unsafe.Sizeof(FileChunk{})))) + + } + + (*Sqlite3_file)(unsafe.Pointer(pJfd)).FpMethods = uintptr(unsafe.Pointer(&sMemJournalMethods)) + (*MemJournal)(unsafe.Pointer(p)).FnSpill = nSpill + (*MemJournal)(unsafe.Pointer(p)).Fflags = flags + (*MemJournal)(unsafe.Pointer(p)).FzJournal = zName + (*MemJournal)(unsafe.Pointer(p)).FpVfs = pVfs + return SQLITE_OK +} + +// Open an in-memory journal file. +func Xsqlite3MemJournalOpen(tls *libc.TLS, pJfd uintptr) { /* sqlite3.c:98898:21: */ + Xsqlite3JournalOpen(tls, uintptr(0), uintptr(0), pJfd, 0, -1) +} + +// The file-handle passed as the only argument is open on a journal file. +// Return true if this "journal file" is currently stored in heap memory, +// or false otherwise. +func Xsqlite3JournalIsInMemory(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:98937:20: */ + return (libc.Bool32((*Sqlite3_file)(unsafe.Pointer(p)).FpMethods == uintptr(unsafe.Pointer(&sMemJournalMethods)))) +} + +// Return the number of bytes required to store a JournalFile that uses vfs +// pVfs to create the underlying on-disk files. +func Xsqlite3JournalSize(tls *libc.TLS, pVfs uintptr) int32 { /* sqlite3.c:98945:20: */ + return func() int32 { + if ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile) > (int32(unsafe.Sizeof(MemJournal{}))) { + return (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile + } + return int32(unsafe.Sizeof(MemJournal{})) + }() +} + +//************* End of memjournal.c ***************************************** +//************* Begin file walker.c ***************************************** +// 2008 August 16 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains routines used for walking the parser tree for +// an SQL statement. +// #include "sqliteInt.h" +// #include +// #include + +// Walk all expressions linked into the list of Window objects passed +// as the second argument. +func walkWindowList(tls *libc.TLS, pWalker uintptr, pList uintptr, bOneOnly int32) int32 { /* sqlite3.c:98975:12: */ + var pWin uintptr + for pWin = pList; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var rc int32 + rc = Xsqlite3WalkExprList(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpOrderBy) + if rc != 0 { + return WRC_Abort + } + rc = Xsqlite3WalkExprList(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpPartition) + if rc != 0 { + return WRC_Abort + } + rc = Xsqlite3WalkExpr(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpFilter) + if rc != 0 { + return WRC_Abort + } + rc = Xsqlite3WalkExpr(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpStart) + if rc != 0 { + return WRC_Abort + } + rc = Xsqlite3WalkExpr(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpEnd) + if rc != 0 { + return WRC_Abort + } + if bOneOnly != 0 { + break + } + } + return WRC_Continue +} + +// Walk an expression tree. Invoke the callback once for each node +// of the expression, while descending. (In other words, the callback +// is invoked before visiting children.) +// +// The return value from the callback should be one of the WRC_* +// constants to specify how to proceed with the walk. +// +// WRC_Continue Continue descending down the tree. +// +// WRC_Prune Do not descend into child nodes, but allow +// the walk to continue with sibling nodes. +// +// WRC_Abort Do no more callbacks. Unwind the stack and +// return from the top-level walk call. +// +// The return value from this routine is WRC_Abort to abandon the tree walk +// and WRC_Continue to continue. +func walkExpr(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:99014:28: */ + var rc int32 + + for 1 != 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pWalker + 8 /* &.xExprCallback */))))(tls, pWalker, pExpr) + if rc != 0 { + return (rc & WRC_Abort) + } + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_TokenOnly | EP_Leaf))) != U32(0)) { + + if ((*Expr)(unsafe.Pointer(pExpr)).FpLeft != 0) && (walkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) != 0) { + return WRC_Abort + } + if (*Expr)(unsafe.Pointer(pExpr)).FpRight != 0 { + + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpRight + continue + } else if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + + if Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) != 0 { + return WRC_Abort + } + } else { + if *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) != 0 { + if Xsqlite3WalkExprList(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) != 0 { + return WRC_Abort + } + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + if walkWindowList(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)), 1) != 0 { + return WRC_Abort + } + } + } + } + break + } + return WRC_Continue +} + +func Xsqlite3WalkExpr(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:99046:20: */ + if pExpr != 0 { + return walkExpr(tls, pWalker, pExpr) + } + return WRC_Continue +} + +// Call sqlite3WalkExpr() for every expression in list p or until +// an abort request is seen. +func Xsqlite3WalkExprList(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:99054:20: */ + var i int32 + var pItem uintptr + if p != 0 { + i = (*ExprList)(unsafe.Pointer(p)).FnExpr + pItem = p + 8 /* &.a */ + __1: + if !(i > 0) { + goto __3 + } + { + if Xsqlite3WalkExpr(tls, pWalker, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr) != 0 { + return WRC_Abort + } + + } + goto __2 + __2: + i-- + pItem += 32 + goto __1 + goto __3 + __3: + } + return WRC_Continue +} + +// This is a no-op callback for Walker->xSelectCallback2. If this +// callback is set, then the Select->pWinDefn list is traversed. +func Xsqlite3WalkWinDefnDummyCallback(tls *libc.TLS, pWalker uintptr, p uintptr) { /* sqlite3.c:99069:21: */ + _ = pWalker + _ = p + // No-op +} + +// Walk all expressions associated with SELECT statement p. Do +// not invoke the SELECT callback on p, but do (of course) invoke +// any expr callbacks and SELECT callbacks that come from subqueries. +// Return WRC_Abort or WRC_Continue. +func Xsqlite3WalkSelectExpr(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:99081:20: */ + if Xsqlite3WalkExprList(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpEList) != 0 { + return WRC_Abort + } + if Xsqlite3WalkExpr(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpWhere) != 0 { + return WRC_Abort + } + if Xsqlite3WalkExprList(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpGroupBy) != 0 { + return WRC_Abort + } + if Xsqlite3WalkExpr(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { + return WRC_Abort + } + if Xsqlite3WalkExprList(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpOrderBy) != 0 { + return WRC_Abort + } + if Xsqlite3WalkExpr(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpLimit) != 0 { + return WRC_Abort + } + if (*Select)(unsafe.Pointer(p)).FpWinDefn != 0 { + var pParse uintptr + if (((*Walker)(unsafe.Pointer(pWalker)).FxSelectCallback2 == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3WalkWinDefnDummyCallback}))) || + (((libc.AssignUintptr(&pParse, (*Walker)(unsafe.Pointer(pWalker)).FpParse)) != uintptr(0)) && (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME))) || + ((*Walker)(unsafe.Pointer(pWalker)).FxSelectCallback2 == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3SelectPopWith}))) { + // The following may return WRC_Abort if there are unresolvable + // symbols (e.g. a table that does not exist) in a window definition. + var rc int32 = walkWindowList(tls, pWalker, (*Select)(unsafe.Pointer(p)).FpWinDefn, 0) + return rc + } + } + return WRC_Continue +} + +// Walk the parse trees associated with all subqueries in the +// FROM clause of SELECT statement p. Do not invoke the select +// callback on p, but do invoke it on each FROM clause subquery +// and on any subqueries further down in the tree. Return +// WRC_Abort or WRC_Continue; +func Xsqlite3WalkSelectFrom(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:99114:20: */ + var pSrc uintptr + var i int32 + var pItem uintptr + + pSrc = (*Select)(unsafe.Pointer(p)).FpSrc + if pSrc != 0 { + i = (*SrcList)(unsafe.Pointer(pSrc)).FnSrc + pItem = pSrc + 8 /* &.a */ + __1: + if !(i > 0) { + goto __3 + } + { + if ((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) && (Xsqlite3WalkSelect(tls, pWalker, (*SrcItem)(unsafe.Pointer(pItem)).FpSelect) != 0) { + return WRC_Abort + } + if ((uint32(int32(*(*uint16)(unsafe.Pointer((pItem + 60 /* &.fg */) + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0) && + (Xsqlite3WalkExprList(tls, pWalker, *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */))) != 0) { + return WRC_Abort + } + + } + goto __2 + __2: + i-- + pItem += 112 + goto __1 + goto __3 + __3: + } + return WRC_Continue +} + +// Call sqlite3WalkExpr() for every expression in Select statement p. +// Invoke sqlite3WalkSelect() for subqueries in the FROM clause and +// on the compound select chain, p->pPrior. +// +// If it is not NULL, the xSelectCallback() callback is invoked before +// the walk of the expressions and FROM clause. The xSelectCallback2() +// method is invoked following the walk of the expressions and FROM clause, +// but only if both xSelectCallback and xSelectCallback2 are both non-NULL +// and if the expressions and FROM clause both return WRC_Continue; +// +// Return WRC_Continue under normal conditions. Return WRC_Abort if +// there is an abort request. +// +// If the Walker does not have an xSelectCallback() then this routine +// is a no-op returning WRC_Continue. +func Xsqlite3WalkSelect(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:99152:20: */ + var rc int32 + if p == uintptr(0) { + return WRC_Continue + } + if (*Walker)(unsafe.Pointer(pWalker)).FxSelectCallback == uintptr(0) { + return WRC_Continue + } + for ok := true; ok; ok = (p != uintptr(0)) { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pWalker + 16 /* &.xSelectCallback */))))(tls, pWalker, p) + if rc != 0 { + return (rc & WRC_Abort) + } + if (Xsqlite3WalkSelectExpr(tls, pWalker, p) != 0) || + (Xsqlite3WalkSelectFrom(tls, pWalker, p) != 0) { + return WRC_Abort + } + if (*Walker)(unsafe.Pointer(pWalker)).FxSelectCallback2 != 0 { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pWalker + 24 /* &.xSelectCallback2 */))))(tls, pWalker, p) + } + p = (*Select)(unsafe.Pointer(p)).FpPrior + } + return WRC_Continue +} + +// Increase the walkerDepth when entering a subquery, and +// descrease when leaving the subquery. +func Xsqlite3WalkerDepthIncrease(tls *libc.TLS, pWalker uintptr, pSelect uintptr) int32 { /* sqlite3.c:99175:20: */ + _ = pSelect + (*Walker)(unsafe.Pointer(pWalker)).FwalkerDepth++ + return WRC_Continue +} + +func Xsqlite3WalkerDepthDecrease(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { /* sqlite3.c:99180:21: */ + _ = pSelect + (*Walker)(unsafe.Pointer(pWalker)).FwalkerDepth-- +} + +// No-op routine for the parse-tree walker. +// +// When this routine is the Walker.xExprCallback then expression trees +// are walked without any actions being taken at each node. Presumably, +// when this routine is used for Walker.xExprCallback then +// Walker.xSelectCallback is set to do something useful for every +// subquery in the parser tree. +func Xsqlite3ExprWalkNoop(tls *libc.TLS, NotUsed uintptr, NotUsed2 uintptr) int32 { /* sqlite3.c:99195:20: */ + _ = NotUsed + _ = NotUsed2 + return WRC_Continue +} + +// No-op routine for the parse-tree walker for SELECT statements. +// subquery in the parser tree. +func Xsqlite3SelectWalkNoop(tls *libc.TLS, NotUsed uintptr, NotUsed2 uintptr) int32 { /* sqlite3.c:99204:20: */ + _ = NotUsed + _ = NotUsed2 + return WRC_Continue +} + +//************* End of walker.c ********************************************* +//************* Begin file resolve.c **************************************** +// 2008 August 18 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains routines used for walking the parser tree and +// resolve all identifiers by associating them with a particular +// table and column. +// #include "sqliteInt.h" + +// Magic table number to mean the EXCLUDED table in an UPSERT statement. + +// Walk the expression tree pExpr and increase the aggregate function +// depth (the Expr.op2 field) by N on every TK_AGG_FUNCTION node. +// This needs to occur when copying a TK_AGG_FUNCTION node from an +// outer query into an inner subquery. +// +// incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..) +// is a helper function - a callback for the tree walker. +// +// See also the sqlite3WindowExtraAggFuncDepth() routine in window.c +func incrAggDepth(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:99245:12: */ + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION { + *(*U8)(unsafe.Pointer(pExpr + 2 /* &.op2 */)) += U8((*(*int32)(unsafe.Pointer(pWalker + 40 /* &.u */)))) + } + return WRC_Continue +} + +func incrAggFunctionDepth(tls *libc.TLS, pExpr uintptr, N int32) { /* sqlite3.c:99249:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + if N > 0 { + // var w Walker at bp, 48 + + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{incrAggDepth})) + *(*int32)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = N + Xsqlite3WalkExpr(tls, bp /* &w */, pExpr) + } +} + +// Turn the pExpr expression into an alias for the iCol-th column of the +// result set in pEList. +// +// If the reference is followed by a COLLATE operator, then make sure +// the COLLATE operator is preserved. For example: +// +// SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase; +// +// Should be transformed into: +// +// SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase; +// +// The nSubquery parameter specifies how many levels of subquery the +// alias is removed from the original expression. The usual value is +// zero but it might be more if the alias is contained within a subquery +// of the original expression. The Expr.op2 field of TK_AGG_FUNCTION +// structures must be increased by the nSubquery amount. +func resolveAlias(tls *libc.TLS, pParse uintptr, pEList uintptr, iCol int32, pExpr uintptr, nSubquery int32) { /* sqlite3.c:99278:13: */ + var pOrig uintptr // The iCol-th column of the result set + var pDup uintptr // Copy of pOrig + var db uintptr // The database connection + + pOrig = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(iCol)*32)).FpExpr + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pDup = Xsqlite3ExprDup(tls, db, pOrig, 0) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3ExprDelete(tls, db, pDup) + pDup = uintptr(0) + } else { + incrAggFunctionDepth(tls, pDup, nSubquery) + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLLATE { + pDup = Xsqlite3ExprAddCollateString(tls, pParse, pDup, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */))) + } + + // Before calling sqlite3ExprDelete(), set the EP_Static flag. This + // prevents ExprDelete() from deleting the Expr structure itself, + // allowing it to be repopulated by the memcpy() on the following line. + // The pExpr->u.zToken might point into memory that will be freed by the + // sqlite3DbFree(db, pDup) on the last line of this block, so be sure to + // make a copy of the token before doing the sqlite3DbFree(). + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_Static)) + Xsqlite3ExprDelete(tls, db, pExpr) + libc.Xmemcpy(tls, pExpr, pDup, uint64(unsafe.Sizeof(Expr{}))) + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_IntValue))) != U32(0)) && (*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) != uintptr(0)) { + + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = Xsqlite3DbStrDup(tls, db, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */))) + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_MemToken)) + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + if *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) != uintptr(0) { + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpOwner = pExpr + } + } + Xsqlite3DbFree(tls, db, pDup) + } +} + +// Return TRUE if the name zCol occurs anywhere in the USING clause. +// +// Return FALSE if the USING clause is NULL or if it does not contain +// zCol. +func nameInUsingClause(tls *libc.TLS, pUsing uintptr, zCol uintptr) int32 { /* sqlite3.c:99334:12: */ + if pUsing != 0 { + var k int32 + for k = 0; k < (*IdList)(unsafe.Pointer(pUsing)).FnId; k++ { + if Xsqlite3StrICmp(tls, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pUsing)).Fa+uintptr(k)*16)).FzName, zCol) == 0 { + return 1 + } + } + } + return 0 +} + +// Subqueries stores the original database, table and column names for their +// result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN". +// Check to see if the zSpan given to this routine matches the zDb, zTab, +// and zCol. If any of zDb, zTab, and zCol are NULL then those fields will +// match anything. +func Xsqlite3MatchEName(tls *libc.TLS, pItem uintptr, zCol uintptr, zTab uintptr, zDb uintptr) int32 { /* sqlite3.c:99351:20: */ + var n int32 + var zSpan uintptr + if (int32(*(*uint8)(unsafe.Pointer(pItem + 20 /* &.eEName */)) & 0x3 >> 0)) != ENAME_TAB { + return 0 + } + zSpan = (*ExprList_item)(unsafe.Pointer(pItem)).FzEName + for n = 0; (*(*int8)(unsafe.Pointer(zSpan + uintptr(n))) != 0) && (int32(*(*int8)(unsafe.Pointer(zSpan + uintptr(n)))) != '.'); n++ { + } + if (zDb != 0) && ((Xsqlite3_strnicmp(tls, zSpan, zDb, n) != 0) || (int32(*(*int8)(unsafe.Pointer(zDb + uintptr(n)))) != 0)) { + return 0 + } + zSpan += (uintptr(n + 1)) + for n = 0; (*(*int8)(unsafe.Pointer(zSpan + uintptr(n))) != 0) && (int32(*(*int8)(unsafe.Pointer(zSpan + uintptr(n)))) != '.'); n++ { + } + if (zTab != 0) && ((Xsqlite3_strnicmp(tls, zSpan, zTab, n) != 0) || (int32(*(*int8)(unsafe.Pointer(zTab + uintptr(n)))) != 0)) { + return 0 + } + zSpan += (uintptr(n + 1)) + if (zCol != 0) && (Xsqlite3StrICmp(tls, zSpan, zCol) != 0) { + return 0 + } + return 1 +} + +// Return TRUE if the double-quoted string mis-feature should be supported. +func areDoubleQuotedStringsEnabled(tls *libc.TLS, db uintptr, pTopNC uintptr) int32 { /* sqlite3.c:99380:12: */ + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + return 1 + } // Always support for legacy schemas + if ((*NameContext)(unsafe.Pointer(pTopNC)).FncFlags & NC_IsDDL) != 0 { + // Currently parsing a DDL statement + if (Xsqlite3WritableSchema(tls, db) != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DqsDML)) != uint64(0)) { + return 1 + } + return (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DqsDDL)) != uint64(0))) + } else { + // Currently parsing a DML statement + return (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DqsDML)) != uint64(0))) + } + return int32(0) +} + +// The argument is guaranteed to be a non-NULL Expr node of type TK_COLUMN. +// return the appropriate colUsed mask. +func Xsqlite3ExprColUsed(tls *libc.TLS, pExpr uintptr) Bitmask { /* sqlite3.c:99398:24: */ + var n int32 + var pExTab uintptr + + n = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + pExTab = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + + if (((*Table)(unsafe.Pointer(pExTab)).FtabFlags & U32(TF_HasGenerated)) != U32(0)) && + ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pExTab)).FaCol+uintptr(n)*32)).FcolFlags) & COLFLAG_GENERATED) != 0) { + + if int32((*Table)(unsafe.Pointer(pExTab)).FnCol) >= (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) { + return libc.Uint64(libc.Uint64FromInt32(-1)) + } + return ((Bitmask((uint64(1))) << (int32((*Table)(unsafe.Pointer(pExTab)).FnCol))) - uint64(1)) + } else { + + if n >= (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) { + n = ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) + } + return (Bitmask((uint64(1))) << n) + } + return Bitmask(0) +} + +// Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up +// that name in the set of source tables in pSrcList and make the pExpr +// expression node refer back to that source column. The following changes +// are made to pExpr: +// +// pExpr->iDb Set the index in db->aDb[] of the database X +// (even if X is implied). +// pExpr->iTable Set to the cursor number for the table obtained +// from pSrcList. +// pExpr->y.pTab Points to the Table structure of X.Y (even if +// X and/or Y are implied.) +// pExpr->iColumn Set to the column number within the table. +// pExpr->op Set to TK_COLUMN. +// pExpr->pLeft Any expression this points to is deleted +// pExpr->pRight Any expression this points to is deleted. +// +// The zDb variable is the name of the database (the "X"). This value may be +// NULL meaning that name is of the form Y.Z or Z. Any available database +// can be used. The zTable variable is the name of the table (the "Y"). This +// value can be NULL if zDb is also NULL. If zTable is NULL it +// means that the form of the name is Z and that columns from any table +// can be used. +// +// If the name cannot be resolved unambiguously, leave an error message +// in pParse and return WRC_Abort. Return WRC_Prune on success. +func lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol uintptr, pNC uintptr, pExpr uintptr) int32 { /* sqlite3.c:99446:12: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + var i int32 + var j int32 // Loop counters + var cnt int32 // Number of matching column names + var cntTab int32 // Number of matching table names + var nSubquery int32 // How many levels of subquery + var db uintptr // The database connection + var pItem uintptr // Use for looping over pSrcList items + var pMatch uintptr // The matching pSrcList item + var pTopNC uintptr // First namecontext in the list + var pSchema uintptr // Schema of the expression + var eNewExprOp int32 // New value for pExpr->op on success + var pTab uintptr // Table hold the row + var pCol uintptr + var hit int32 + var zTabName uintptr + var hCol U8 + var op int32 + var pUpsert uintptr + var iCol int32 + var hCol1 U8 + var pOrig uintptr + var zAs uintptr + var pEList uintptr + var pSrcList uintptr + var zErr uintptr + cnt = 0 + cntTab = 0 + nSubquery = 0 + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pMatch = uintptr(0) + pTopNC = pNC + pSchema = uintptr(0) + eNewExprOp = TK_COLUMN + pTab = uintptr(0) // A column of pTab + + // the name context cannot be NULL. + // The Z in X.Y.Z cannot be NULL + + // Initialize the node to no-match + (*Expr)(unsafe.Pointer(pExpr)).FiTable = -1 + + // Translate the schema name in zDb into a pointer to the corresponding + // schema. If not found, pSchema will remain NULL and nothing will match + // resulting in an appropriate error message toward the end of this routine + if !(zDb != 0) { + goto __1 + } + + if !(((*NameContext)(unsafe.Pointer(pNC)).FncFlags & (NC_PartIdx | NC_IsCheck)) != 0) { + goto __2 + } + // Silently ignore database qualifiers inside CHECK constraints and + // partial indices. Do not raise errors because that might break + // legacy and because it does not hurt anything to just ignore the + // database name. + zDb = uintptr(0) + goto __3 +__2: + i = 0 +__4: + if !(i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __6 + } + + if !(Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FzDbSName, zDb) == 0) { + goto __7 + } + pSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpSchema + goto __6 +__7: + ; + goto __5 +__5: + i++ + goto __4 + goto __6 +__6: + ; + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5459 /* "main" */, zDb) == 0)) { + goto __8 + } + // This branch is taken when the main database has been renamed + // using SQLITE_DBCONFIG_MAINDBNAME. + pSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName +__8: + ; +__3: + ; +__1: + ; + + // Start at the inner-most context and move outward until a match is found + +__9: + pSrcList = (*NameContext)(unsafe.Pointer(pNC)).FpSrcList + + if !(pSrcList != 0) { + goto __12 + } + i = 0 + pItem = pSrcList + 8 /* &.a */ +__13: + if !(i < (*SrcList)(unsafe.Pointer(pSrcList)).FnSrc) { + goto __15 + } + pTab = (*SrcItem)(unsafe.Pointer(pItem)).FpTab + + if !(((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) && (((*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselFlags & U32(SF_NestedFrom)) != U32(0))) { + goto __16 + } + hit = 0 + pEList = (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpEList + j = 0 +__17: + if !(j < (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { + goto __19 + } + if !(Xsqlite3MatchEName(tls, ((pEList+8 /* &.a */)+uintptr(j)*32), zCol, zTab, zDb) != 0) { + goto __20 + } + cnt++ + cntTab = 2 + pMatch = pItem + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = YnVar(j) + hit = 1 +__20: + ; + goto __18 +__18: + j++ + goto __17 + goto __19 +__19: + ; + if !((hit != 0) || (zTab == uintptr(0))) { + goto __21 + } + goto __14 +__21: + ; +__16: + ; + if !((zDb != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != pSchema)) { + goto __22 + } + goto __14 +__22: + ; + if !(zTab != 0) { + goto __23 + } + if (*SrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 { + zTabName = (*SrcItem)(unsafe.Pointer(pItem)).FzAlias + } else { + zTabName = (*Table)(unsafe.Pointer(pTab)).FzName + } + + if !(Xsqlite3StrICmp(tls, zTabName, zTab) != 0) { + goto __24 + } + goto __14 +__24: + ; + if !((int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && ((*SrcItem)(unsafe.Pointer(pItem)).FzAlias != 0)) { + goto __25 + } + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), (pExpr + 64 /* &.y */ /* &.pTab */)) +__25: + ; +__23: + ; + if !(0 == (libc.PostIncInt32(&cntTab, 1))) { + goto __26 + } + pMatch = pItem +__26: + ; + hCol = Xsqlite3StrIHash(tls, zCol) + j = 0 + pCol = (*Table)(unsafe.Pointer(pTab)).FaCol +__27: + if !(j < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __29 + } + if !((int32((*Column)(unsafe.Pointer(pCol)).FhName) == int32(hCol)) && (Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer(pCol)).FzName, zCol) == 0)) { + goto __30 + } + // If there has been exactly one prior match and this match + // is for the right-hand table of a NATURAL JOIN or is in a + // USING clause, then skip this match. + if !(cnt == 1) { + goto __31 + } + if !((int32((*SrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype) & JT_NATURAL) != 0) { + goto __32 + } + goto __28 +__32: + ; + if !(nameInUsingClause(tls, (*SrcItem)(unsafe.Pointer(pItem)).FpUsing, zCol) != 0) { + goto __33 + } + goto __28 +__33: + ; +__31: + ; + cnt++ + pMatch = pItem + // Substitute the rowid (column -1) for the INTEGER PRIMARY KEY + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = func() int16 { + if j == int32((*Table)(unsafe.Pointer(pTab)).FiPKey) { + return int16(-1) + } + return I16(j) + }() + goto __29 +__30: + ; + goto __28 +__28: + j++ + pCol += 32 + goto __27 + goto __29 +__29: + ; + goto __14 +__14: + i++ + pItem += 112 + goto __13 + goto __15 +__15: + ; + if !(pMatch != 0) { + goto __34 + } + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (*SrcItem)(unsafe.Pointer(pMatch)).FiCursor + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = (*SrcItem)(unsafe.Pointer(pMatch)).FpTab + // RIGHT JOIN not (yet) supported + + if !((int32((*SrcItem)(unsafe.Pointer(pMatch)).Ffg.Fjointype) & JT_LEFT) != 0) { + goto __35 + } + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_CanBeNull)) +__35: + ; + pSchema = (*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpSchema +__34: + ; +__12: + ; // if( pSrcList ) + + // If we have not already resolved the name, then maybe + // it is a new.* or old.* trigger argument reference. Or + // maybe it is an excluded.* from an upsert. Or maybe it is + // a reference in the RETURNING clause to a table being modified. + if !((cnt == 0) && (zDb == uintptr(0))) { + goto __36 + } + pTab = uintptr(0) + if !((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab != uintptr(0)) { + goto __37 + } + op = int32((*Parse)(unsafe.Pointer(pParse)).FeTriggerOp) + + if !((*Parse)(unsafe.Pointer(pParse)).FbReturning != 0) { + goto __38 + } + if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_UBaseReg) != 0) && + ((zTab == uintptr(0)) || (Xsqlite3StrICmp(tls, zTab, (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab)).FzName) == 0))) { + goto __40 + } + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (libc.Bool32(op != TK_DELETE)) + pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab +__40: + ; + goto __39 +__38: + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5464 /* "new" */, zTab) == 0)) { + goto __41 + } + (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 + pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab + goto __42 +__41: + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5468 /* "old" */, zTab) == 0)) { + goto __43 + } + (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 + pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab +__43: + ; +__42: + ; +__39: + ; +__37: + ; + if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_UUpsert) != 0) && (zTab != uintptr(0))) { + goto __44 + } + pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5472 /* "excluded" */, zTab) == 0)) { + goto __45 + } + pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab + (*Expr)(unsafe.Pointer(pExpr)).FiTable = EXCLUDED_TABLE_NUMBER +__45: + ; +__44: + ; + + if !(pTab != 0) { + goto __46 + } + hCol1 = Xsqlite3StrIHash(tls, zCol) + pSchema = (*Table)(unsafe.Pointer(pTab)).FpSchema + cntTab++ + iCol = 0 + pCol = (*Table)(unsafe.Pointer(pTab)).FaCol +__47: + if !(iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __49 + } + if !((int32((*Column)(unsafe.Pointer(pCol)).FhName) == int32(hCol1)) && (Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer(pCol)).FzName, zCol) == 0)) { + goto __50 + } + if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __51 + } + iCol = -1 +__51: + ; + goto __49 +__50: + ; + goto __48 +__48: + iCol++ + pCol += 32 + goto __47 + goto __49 +__49: + ; + if !(((iCol >= int32((*Table)(unsafe.Pointer(pTab)).FnCol)) && (Xsqlite3IsRowid(tls, zCol) != 0)) && (((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_NoVisibleRowid)) == U32(0))) { + goto __52 + } + // IMP: R-51414-32910 + iCol = -1 +__52: + ; + if !(iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __53 + } + cnt++ + pMatch = uintptr(0) + if !((*Expr)(unsafe.Pointer(pExpr)).FiTable == EXCLUDED_TABLE_NUMBER) { + goto __54 + } + + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __56 + } + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = YnVar(iCol) + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = pTab + eNewExprOp = TK_COLUMN + goto __57 +__56: + (*Expr)(unsafe.Pointer(pExpr)).FiTable = ((*Upsert)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)))).FregData + int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(iCol)))) + eNewExprOp = TK_REGISTER +__57: + ; + goto __55 +__54: + + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = pTab + if !((*Parse)(unsafe.Pointer(pParse)).FbReturning != 0) { + goto __58 + } + eNewExprOp = TK_REGISTER + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (((*(*int32)(unsafe.Pointer(pNC + 16 /* &.uNC */)) + ((int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1) * (*Expr)(unsafe.Pointer(pExpr)).FiTable)) + int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(iCol)))) + 1) + goto __59 +__58: + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = I16(iCol) + eNewExprOp = TK_TRIGGER + if !(iCol < 0) { + goto __60 + } + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + goto __61 +__60: + if !((*Expr)(unsafe.Pointer(pExpr)).FiTable == 0) { + goto __62 + } + + *(*U32)(unsafe.Pointer(pParse + 196 /* &.oldmask */)) |= (func() uint32 { + if iCol >= 32 { + return 0xffffffff + } + return (U32((U32(1))) << iCol) + }()) + goto __63 +__62: + ; + + *(*U32)(unsafe.Pointer(pParse + 200 /* &.newmask */)) |= (func() uint32 { + if iCol >= 32 { + return 0xffffffff + } + return (U32((U32(1))) << iCol) + }()) +__63: + ; +__61: + ; +__59: + ; +__55: + ; +__53: + ; +__46: + ; +__36: + ; + + // Perhaps the name is a reference to the ROWID + if !((((((cnt == 0) && + (cntTab == 1)) && + (pMatch != 0)) && + (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & (NC_IdxExpr | NC_GenCol)) == 0)) && + (Xsqlite3IsRowid(tls, zCol) != 0)) && + (((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pMatch)).FpTab))).FtabFlags & U32(TF_NoVisibleRowid)) == U32(0))) { + goto __64 + } + cnt = 1 + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = int16(-1) + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) +__64: + ; + + // If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z + // might refer to an result-set alias. This happens, for example, when + // we are resolving names in the WHERE clause of the following command: + // + // SELECT a+b AS x FROM table WHERE x<10; + // + // In cases like this, replace pExpr with a copy of the expression that + // forms the result set entry ("a+b" in the example) and return immediately. + // Note that the expression in the result set should have already been + // resolved by the time the WHERE clause is resolved. + // + // The ability to use an output result-set column in the WHERE, GROUP BY, + // or HAVING clauses, or as part of a larger expression in the ORDER BY + // clause is not standard SQL. This is a (goofy) SQLite extension, that + // is supported for backwards compatibility only. Hence, we issue a warning + // on sqlite3_log() whenever the capability is used. + if !(((cnt == 0) && + (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_UEList) != 0)) && + (zTab == uintptr(0))) { + goto __65 + } + pEList = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) + + j = 0 +__66: + if !(j < (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { + goto __68 + } + zAs = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(j)*32)).FzEName + if !(((int32(*(*uint8)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(j)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME) && + (Xsqlite3_stricmp(tls, zAs, zCol) == 0)) { + goto __69 + } + + pOrig = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(j)*32)).FpExpr + if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { + goto __70 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5481 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + return WRC_Abort +__70: + ; + if !((((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Win))) != U32(0)) && + ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { + goto __71 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5512 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + return WRC_Abort +__71: + ; + if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { + goto __72 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5549 /* "row value misuse..." */, 0) + return WRC_Abort +__72: + ; + resolveAlias(tls, pParse, pEList, j, pExpr, nSubquery) + cnt = 1 + pMatch = uintptr(0) + + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __73 + } + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr) +__73: + ; + goto lookupname_end +__69: + ; + goto __67 +__67: + j++ + goto __66 + goto __68 +__68: + ; +__65: + ; + + // Advance to the next name context. The loop will exit when either + // we have a match (cnt>0) or when we run out of name contexts. + if !(cnt != 0) { + goto __74 + } + goto __11 +__74: + ; + pNC = (*NameContext)(unsafe.Pointer(pNC)).FpNext + nSubquery++ + goto __10 +__10: + if pNC != 0 { + goto __9 + } + goto __11 +__11: + ; + + // If X and Y are NULL (in other words if only the column name Z is + // supplied) and the value of Z is enclosed in double-quotes, then + // Z is a string literal if it doesn't match any column names. In that + // case, we need to return right away and not make any changes to + // pExpr. + // + // Because no reference was made to outer contexts, the pNC->nRef + // fields are not changed in any context. + if !((cnt == 0) && (zTab == uintptr(0))) { + goto __75 + } + + if !((((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_DblQuoted))) != U32(0)) && + (areDoubleQuotedStringsEnabled(tls, db, pTopNC) != 0)) { + goto __76 + } + // If a double-quoted identifier does not match any known column name, + // then treat it as a string. + // + // This hack was added in the early days of SQLite in a misguided attempt + // to be compatible with MySQL 3.x, which used double-quotes for strings. + // I now sorely regret putting in this hack. The effect of this hack is + // that misspelled identifier names are silently converted into strings + // rather than causing an error, to the frustration of countless + // programmers. To all those frustrated programmers, my apologies. + // + // Someday, I hope to get rid of this hack. Unfortunately there is + // a huge amount of legacy SQL that uses it. So for now, we just + // issue a warning. + Xsqlite3_log(tls, SQLITE_WARNING, + ts+5567 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) + return WRC_Prune +__76: + ; + if !(Xsqlite3ExprIdToTrueFalse(tls, pExpr) != 0) { + goto __77 + } + return WRC_Prune +__77: + ; +__75: + ; + + // cnt==0 means there was not match. cnt>1 means there were two or + // more matches. Either way, we have an error. + if !(cnt != 1) { + goto __78 + } + if cnt == 0 { + zErr = ts + 5602 /* "no such column" */ + } else { + zErr = ts + 5617 /* "ambiguous column..." */ + } + if !(zDb != 0) { + goto __79 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5639 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + goto __80 +__79: + if !(zTab != 0) { + goto __81 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5652 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + goto __82 +__81: + Xsqlite3ErrorMsg(tls, pParse, ts+5662 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) +__82: + ; +__80: + ; + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + (*NameContext)(unsafe.Pointer(pTopNC)).FnNcErr++ +__78: + ; + + // If a column from a table in pSrcList is referenced, then record + // this fact in the pSrcList.a[].colUsed bitmask. Column 0 causes + // bit 0 to be set. Column 1 sets bit 1. And so forth. Bit 63 is + // set if the 63rd or any subsequent column is used. + // + // The colUsed mask is an optimization used to help determine if an + // index is a covering index. The correct answer is still obtained + // if the mask contains extra set bits. However, it is important to + // avoid setting bits beyond the maximum column number of the table. + // (See ticket [b92e5e8ec2cdbaa1]). + // + // If a generated column is referenced, set bits for every column + // of the table. + if !((int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) >= 0) && (pMatch != uintptr(0))) { + goto __83 + } + *(*Bitmask)(unsafe.Pointer(pMatch + 88 /* &.colUsed */)) |= (Xsqlite3ExprColUsed(tls, pExpr)) +__83: + ; + + // Clean up and return + if !(!(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_TokenOnly | EP_Leaf))) != U32(0))) { + goto __84 + } + Xsqlite3ExprDelete(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + (*Expr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + Xsqlite3ExprDelete(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + (*Expr)(unsafe.Pointer(pExpr)).FpRight = uintptr(0) +__84: + ; + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(eNewExprOp) + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_Leaf)) +lookupname_end: + if !(cnt == 1) { + goto __85 + } + + if !(((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FxAuth != 0) && + ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_TRIGGER))) { + goto __87 + } + Xsqlite3AuthRead(tls, pParse, pExpr, pSchema, (*NameContext)(unsafe.Pointer(pNC)).FpSrcList) +__87: + ; + // Increment the nRef value on all name contexts from TopNC up to + // the point where the name matched. +__88: + ; + (*NameContext)(unsafe.Pointer(pTopNC)).FnRef++ + if !(pTopNC == pNC) { + goto __91 + } + goto __90 +__91: + ; + pTopNC = (*NameContext)(unsafe.Pointer(pTopNC)).FpNext + goto __89 +__89: + goto __88 + goto __90 +__90: + ; + return WRC_Prune + goto __86 +__85: + return WRC_Abort +__86: + ; + return int32(0) +} + +// Allocate and return a pointer to an expression to load the column iCol +// from datasource iSrc in SrcList pSrc. +func Xsqlite3CreateColumnExpr(tls *libc.TLS, db uintptr, pSrc uintptr, iSrc int32, iCol int32) uintptr { /* sqlite3.c:99880:21: */ + var p uintptr = Xsqlite3ExprAlloc(tls, db, TK_COLUMN, uintptr(0), 0) + if p != 0 { + var pItem uintptr = ((pSrc + 8 /* &.a */) + uintptr(iSrc)*112) + var pTab uintptr = libc.AssignPtrUintptr(p+64 /* &.y */ /* &.pTab */, (*SrcItem)(unsafe.Pointer(pItem)).FpTab) + (*Expr)(unsafe.Pointer(p)).FiTable = (*SrcItem)(unsafe.Pointer(pItem)).FiCursor + if int32((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FiPKey) == iCol { + (*Expr)(unsafe.Pointer(p)).FiColumn = int16(-1) + } else { + (*Expr)(unsafe.Pointer(p)).FiColumn = YnVar(iCol) + if (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != U32(0)) && + ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_GENERATED) != 0) { + + (*SrcItem)(unsafe.Pointer(pItem)).FcolUsed = func() uint64 { + if int32((*Table)(unsafe.Pointer(pTab)).FnCol) >= 64 { + return libc.Uint64(libc.Uint64FromInt32(-1)) + } + return ((Bitmask((uint64(1))) << (int32((*Table)(unsafe.Pointer(pTab)).FnCol))) - uint64(1)) + }() + } else { + + *(*Bitmask)(unsafe.Pointer(pItem + 88 /* &.colUsed */)) |= (Bitmask((uint64(1))) << (func() int32 { + if iCol >= (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) { + return ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) + } + return iCol + }())) + } + } + } + return p +} + +// Report an error that an expression is not valid for some set of +// pNC->ncFlags values determined by validMask. +// +// static void notValid( +// Parse *pParse, // Leave error message here +// NameContext *pNC, // The name context +// const char *zMsg, // Type of error +// int validMask, // Set of contexts for which prohibited +// Expr *pExpr // Invalidate this expression on error +// ){...} +// +// As an optimization, since the conditional is almost always false +// (because errors are rare), the conditional is moved outside of the +// function call using a macro. +func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExpr uintptr) { /* sqlite3.c:99922:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var zIn uintptr = ts + 5669 /* "partial index WH..." */ + if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { + zIn = ts + 5697 /* "index expression..." */ + } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { + zIn = ts + 5715 /* "CHECK constraint..." */ + } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { + zIn = ts + 5733 /* "generated column..." */ + } + Xsqlite3ErrorMsg(tls, pParse, ts+5751 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + if pExpr != 0 { + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) + } +} + +// Expression p should encode a floating point value between 1.0 and 0.0. +// Return 1024 times this value. Or return -1 if p is not a floating point +// value between 1.0 and 0.0. +func exprProbability(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:99948:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*float64)(unsafe.Pointer(bp /* r */)) = -1.0 + if int32((*Expr)(unsafe.Pointer(p)).Fop) != TK_FLOAT { + return -1 + } + Xsqlite3AtoF(tls, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)), bp /* &r */, Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))), uint8(SQLITE_UTF8)) + + if *(*float64)(unsafe.Pointer(bp /* r */)) > 1.0 { + return -1 + } + return (int32(*(*float64)(unsafe.Pointer(bp /* r */)) * 134217728.0)) +} + +// This routine is callback for sqlite3WalkExpr(). +// +// Resolve symbolic names into TK_COLUMN operators for the current +// node in the expression tree. Return 0 to continue the search down +// the tree or 2 to abort the tree walk. +// +// This routine also does error checking and name resolution for +// function names. The operator for aggregate functions is changed +// to TK_AGG_FUNCTION. +func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:99968:12: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + var pNC uintptr + var pParse uintptr + + pNC = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + + pParse = (*NameContext)(unsafe.Pointer(pNC)).FpParse + + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + + // The special operator TK_ROW means use the rowid for the first + // column in the FROM clause. This is used by the LIMIT and ORDER BY + // clause processing on UPDATE and DELETE statements, and by + // UPDATE ... FROM statement processing. + case TK_ROW: + { + var pSrcList uintptr = (*NameContext)(unsafe.Pointer(pNC)).FpSrcList + var pItem uintptr + + pItem = pSrcList + 8 /* &.a */ + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_COLUMN) + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = (*SrcItem)(unsafe.Pointer(pItem)).FpTab + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (*SrcItem)(unsafe.Pointer(pItem)).FiCursor + (*Expr)(unsafe.Pointer(pExpr)).FiColumn-- + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + break + + } + + // An optimization: Attempt to convert + // + // "expr IS NOT NULL" --> "TRUE" + // "expr IS NULL" --> "FALSE" + // + // if we can prove that "expr" is never NULL. Call this the + // "NOT NULL strength reduction optimization". + // + // If this optimization occurs, also restore the NameContext ref-counts + // to the state they where in before the "column" LHS expression was + // resolved. This prevents "column" from being counted as having been + // referenced, which might prevent a SELECT from being erroneously + // marked as correlated. + case TK_NOTNULL: + fallthrough + case TK_ISNULL: + { + // var anRef [8]int32 at bp+96, 32 + + var p uintptr + var i int32 + i = 0 + p = pNC + __1: + if !((p != 0) && (i < (int32(uint64(unsafe.Sizeof([8]int32{})) / uint64(unsafe.Sizeof(int32(0))))))) { + goto __3 + } + { + *(*int32)(unsafe.Pointer(bp + 96 /* &anRef[0] */ + uintptr(i)*4)) = (*NameContext)(unsafe.Pointer(p)).FnRef + + } + goto __2 + __2: + p = (*NameContext)(unsafe.Pointer(p)).FpNext + i++ + goto __1 + goto __3 + __3: + ; + Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5771 /* "true" */ + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) + } else { + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5776 /* "false" */ + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) + } + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) + i = 0 + p = pNC + __4: + if !((p != 0) && (i < (int32(uint64(unsafe.Sizeof([8]int32{})) / uint64(unsafe.Sizeof(int32(0))))))) { + goto __6 + } + { + (*NameContext)(unsafe.Pointer(p)).FnRef = *(*int32)(unsafe.Pointer(bp + 96 /* &anRef[0] */ + uintptr(i)*4)) + + } + goto __5 + __5: + p = (*NameContext)(unsafe.Pointer(p)).FpNext + i++ + goto __4 + goto __6 + __6: + ; + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + (*Expr)(unsafe.Pointer(pExpr)).FpLeft = uintptr(0) + } + return WRC_Prune + + } + + // A column name: ID + // Or table name and column name: ID.ID + // Or a database, table and column: ID.ID.ID + // + // The TK_ID and TK_OUT cases are combined so that there will only + // be one call to lookupName(). Then the compiler will in-line + // lookupName() for a size reduction and performance increase. + case TK_ID: + fallthrough + case TK_DOT: + { + var zColumn uintptr + var zTable uintptr + var zDb uintptr + var pRight uintptr + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_ID { + zDb = uintptr(0) + zTable = uintptr(0) + zColumn = *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + } else { + var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + + if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { + notValidImpl(tls, pParse, pNC, ts+5782 /* "the \".\" operator" */, uintptr(0)) + } + + pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight + if int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_ID { + zDb = uintptr(0) + } else { + + zDb = *(*uintptr)(unsafe.Pointer(pLeft + 8 /* &.u */)) + pLeft = (*Expr)(unsafe.Pointer(pRight)).FpLeft + pRight = (*Expr)(unsafe.Pointer(pRight)).FpRight + } + zTable = *(*uintptr)(unsafe.Pointer(pLeft + 8 /* &.u */)) + zColumn = *(*uintptr)(unsafe.Pointer(pRight + 8 /* &.u */)) + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenRemap(tls, pParse, pExpr, pRight) + Xsqlite3RenameTokenRemap(tls, pParse, (pExpr + 64 /* &.y */ /* &.pTab */), pLeft) + } + } + return lookupName(tls, pParse, zDb, zTable, zColumn, pNC, pExpr) + + } + + // Resolve function names + case TK_FUNCTION: + { + var pList uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) // The argument list + var n int32 + if pList != 0 { + n = (*ExprList)(unsafe.Pointer(pList)).FnExpr + } else { + n = 0 + } // Number of arguments + var no_such_func int32 = 0 // True if no such function exists + var wrong_num_args int32 = 0 // True if wrong number of arguments + var is_agg int32 = 0 // True if is an aggregate function + var nId int32 // Number of characters in function name + var zId uintptr // The function name. + var pDef uintptr // Information about the function + var enc U8 = (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fenc // The database encoding + var savedAllowFlags int32 = ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & (NC_AllowAgg | NC_AllowWin)) + var pWin uintptr = func() uintptr { + if (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) && (int32((*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FeFrmType) != TK_FILTER) { + return *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + } + return uintptr(0) + }() + + zId = *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + nId = Xsqlite3Strlen30(tls, zId) + pDef = Xsqlite3FindFunction(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, zId, n, enc, uint8(0)) + if pDef == uintptr(0) { + pDef = Xsqlite3FindFunction(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, zId, -2, enc, uint8(0)) + if pDef == uintptr(0) { + no_such_func = 1 + } else { + wrong_num_args = 1 + } + } else { + is_agg = (libc.Bool32((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) + if ((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_UNLIKELY)) != 0 { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_Unlikely)) + if n == 2 { + (*Expr)(unsafe.Pointer(pExpr)).FiTable = exprProbability(tls, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+1*32)).FpExpr) + if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { + Xsqlite3ErrorMsg(tls, pParse, + + ts+5799 /* "second argument ..." */, 0) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } + } else { + // EVIDENCE-OF: R-61304-29449 The unlikely(X) function is + // equivalent to likelihood(X, 0.0625). + // EVIDENCE-OF: R-01283-11636 The unlikely(X) function is + // short-hand for likelihood(X,0.0625). + // EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand + // for likelihood(X,0.9375). + // EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent + // to likelihood(X,0.9375). + // TUNING: unlikely() probability is 0.0625. likely() is 0.9375 + (*Expr)(unsafe.Pointer(pExpr)).FiTable = func() int32 { + if int32(*(*int8)(unsafe.Pointer((*FuncDef)(unsafe.Pointer(pDef)).FzName))) == 'u' { + return 8388608 + } + return 125829120 + }() + } + } + { + var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) + if auth != SQLITE_OK { + if auth == SQLITE_DENY { + Xsqlite3ErrorMsg(tls, pParse, ts+5870, /* "not authorized t..." */ + libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) + return WRC_Prune + } + + } + if ((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & (U32(SQLITE_FUNC_CONSTANT | SQLITE_FUNC_SLOCHNG))) != 0 { + // For the purposes of the EP_ConstFunc flag, date and time + // functions and other functions that change slowly are considered + // constant because they are constant for the duration of one query. + // This allows them to be factored out of inner loops. + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_ConstFunc)) + } + if ((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_CONSTANT)) == U32(0) { + // Clearly non-deterministic functions like random(), but also + // date/time functions that use 'now', and other functions like + // sqlite_version() that might change over time cannot be used + // in an index or generated column. Curiously, they can be used + // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all + // all this. + if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { + notValidImpl(tls, pParse, pNC, ts+5905 /* "non-deterministi..." */, uintptr(0)) + } + + } else { + // Must fit in 8 bits + (*Expr)(unsafe.Pointer(pExpr)).Fop2 = (U8((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_SelfRef)) + if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_FromDDL) != 0 { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_FromDDL)) + } + } + if ((((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_INTERNAL)) != U32(0)) && + (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0)) && + (((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmDbFlags & U32(DBFLAG_InternalFunc)) == U32(0)) { + // Internal-use-only functions are disallowed unless the + // SQL is being compiled using sqlite3NestedParse() or + // the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be + // used to activate internal functionsn for testing purposes + no_such_func = 1 + pDef = uintptr(0) + } else if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & (U32(SQLITE_FUNC_DIRECT | SQLITE_FUNC_UNSAFE))) != U32(0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + Xsqlite3ExprFunctionUsable(tls, pParse, pExpr, pDef) + } + } + + if 0 == (libc.Bool32(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) { + + if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { + Xsqlite3ErrorMsg(tls, pParse, + ts+5933 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || + (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || + (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { + var zType uintptr + if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { + zType = ts + 5977 /* "window" */ + } else { + zType = ts + 5984 /* "aggregate" */ + } + Xsqlite3ErrorMsg(tls, pParse, ts+5994 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + is_agg = 0 + } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+6023 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else if wrong_num_args != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6046, /* "wrong number of ..." */ + libc.VaList(bp+64, nId, zId)) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + Xsqlite3ErrorMsg(tls, pParse, + ts+6091, /* "FILTER may not b..." */ + libc.VaList(bp+80, nId, zId)) + (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ + } + if is_agg != 0 { + // Window functions may not be arguments of aggregate functions. + // Or arguments of other window functions. But aggregate functions + // may be arguments for window functions. + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) &= (^(NC_AllowWin | (func() int32 { + if !(pWin != 0) { + return NC_AllowAgg + } + return 0 + }()))) + } + } else if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + is_agg = 1 + } + Xsqlite3WalkExprList(tls, pWalker, pList) + if is_agg != 0 { + if pWin != 0 { + var pSel uintptr = (*NameContext)(unsafe.Pointer(pNC)).FpWinSelect + + if (libc.Bool32(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) == 0 { + Xsqlite3WindowUpdate(tls, pParse, func() uintptr { + if pSel != 0 { + return (*Select)(unsafe.Pointer(pSel)).FpWinDefn + } + return uintptr(0) + }(), pWin, pDef) + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + break + } + } + Xsqlite3WalkExprList(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpPartition) + Xsqlite3WalkExprList(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpOrderBy) + Xsqlite3WalkExpr(tls, pWalker, (*Window)(unsafe.Pointer(pWin)).FpFilter) + Xsqlite3WindowLink(tls, pSel, pWin) + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) |= (NC_HasWin) + } else { + var pNC2 uintptr = pNC + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_AGG_FUNCTION) + (*Expr)(unsafe.Pointer(pExpr)).Fop2 = U8(0) + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + Xsqlite3WalkExpr(tls, pWalker, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpFilter) + } + for (pNC2 != 0) && !(Xsqlite3FunctionUsesThisSrc(tls, pExpr, (*NameContext)(unsafe.Pointer(pNC2)).FpSrcList) != 0) { + (*Expr)(unsafe.Pointer(pExpr)).Fop2++ + pNC2 = (*NameContext)(unsafe.Pointer(pNC2)).FpNext + } + + if (pNC2 != 0) && (pDef != 0) { + + *(*int32)(unsafe.Pointer(pNC2 + 40 /* &.ncFlags */)) |= int32((U32(NC_HasAgg) | ((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_MINMAX)))) + + } + } + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) |= (savedAllowFlags) + } + // FIX ME: Compute pExpr->affinity based on the expected return + // type of the function + return WRC_Prune + + } + case TK_SELECT: + fallthrough + case TK_EXISTS: + fallthrough + case TK_IN: + { + + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef + + if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { + notValidImpl(tls, pParse, pNC, ts+6140 /* "subqueries" */, pExpr) + } + + Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + + if nRef != (*NameContext)(unsafe.Pointer(pNC)).FnRef { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_VarSelect)) + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) |= (NC_VarSelect) + } + } + break + + } + case TK_VARIABLE: + { + + if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { + notValidImpl(tls, pParse, pNC, ts+6151 /* "parameters" */, pExpr) + } + + break + + } + case TK_IS: + fallthrough + case TK_ISNOT: + { + var pRight uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + + // Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE", + // and "x IS NOT FALSE". + if (pRight != 0) && ((int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_ID) || (int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_TRUEFALSE)) { + var rc int32 = resolveExprStep(tls, pWalker, pRight) + if rc == WRC_Abort { + return WRC_Abort + } + if int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_TRUEFALSE { + (*Expr)(unsafe.Pointer(pExpr)).Fop2 = (*Expr)(unsafe.Pointer(pExpr)).Fop + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUTH) + return WRC_Continue + } + } + + } + fallthrough + case TK_BETWEEN: + fallthrough + case TK_EQ: + fallthrough + case TK_NE: + fallthrough + case TK_LT: + fallthrough + case TK_LE: + fallthrough + case TK_GT: + fallthrough + case TK_GE: + { + var nLeft int32 + var nRight int32 + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + break + } + + nLeft = Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_BETWEEN { + nRight = Xsqlite3ExprVectorSize(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */))).FpExpr) + if nRight == nLeft { + nRight = Xsqlite3ExprVectorSize(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))+8 /* &.a */)+1*32)).FpExpr) + } + } else { + + nRight = Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + } + if nLeft != nRight { + + Xsqlite3ErrorMsg(tls, pParse, ts+5549 /* "row value misuse..." */, 0) + } + break + + } + } + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + return WRC_Abort + } + return WRC_Continue +} + +// pEList is a list of expressions which are really the result set of the +// a SELECT statement. pE is a term in an ORDER BY or GROUP BY clause. +// This routine checks to see if pE is a simple identifier which corresponds +// to the AS-name of one of the terms of the expression list. If it is, +// this routine return an integer between 1 and N where N is the number of +// elements in pEList, corresponding to the matching entry. If there is +// no match, or if pE is not a simple identifier, then this routine +// return 0. +// +// pEList has been resolved. pE has not. +func resolveAsName(tls *libc.TLS, pParse uintptr, pEList uintptr, pE uintptr) int32 { /* sqlite3.c:100410:12: */ + var i int32 // Loop counter + + _ = pParse + + if int32((*Expr)(unsafe.Pointer(pE)).Fop) == TK_ID { + var zCol uintptr = *(*uintptr)(unsafe.Pointer(pE + 8 /* &.u */)) + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + if ((int32(*(*uint8)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME) && + (Xsqlite3_stricmp(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FzEName, zCol) == 0) { + return (i + 1) + } + } + } + return 0 +} + +// pE is a pointer to an expression which is a single term in the +// ORDER BY of a compound SELECT. The expression has not been +// name resolved. +// +// At the point this routine is called, we already know that the +// ORDER BY term is not an integer index into the result set. That +// case is handled by the calling routine. +// +// Attempt to match pE against result set columns in the left-most +// SELECT statement. Return the index i of the matching column, +// as an indication to the caller that it should sort by the i-th column. +// The left-most column is 1. In other words, the value returned is the +// same integer value that would be used in the SQL statement to indicate +// the column. +// +// If there is no match, return 0. Return -1 if an error occurs. +func resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintptr, pE uintptr) int32 { /* sqlite3.c:100450:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var i int32 // Loop counter + var pEList uintptr // The columns of the result set + // var nc NameContext at bp, 56 + // Name context for resolving pE + var db uintptr // Database connection + var rc int32 // Return code from subprocedures + var savedSuppErr U8 // Saved value of db->suppressErr + + pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList + + // Resolve all names in the ORDER BY term expression + libc.Xmemset(tls, bp /* &nc */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &nc */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp /* &nc */)).FpSrcList = (*Select)(unsafe.Pointer(pSelect)).FpSrc + *(*uintptr)(unsafe.Pointer(bp /* &nc */ + 16 /* &.uNC */)) = pEList + (*NameContext)(unsafe.Pointer(bp /* &nc */)).FncFlags = ((NC_AllowAgg | NC_UEList) | NC_NoSelect) + (*NameContext)(unsafe.Pointer(bp /* &nc */)).FnNcErr = 0 + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + savedSuppErr = (*Sqlite3)(unsafe.Pointer(db)).FsuppressErr + (*Sqlite3)(unsafe.Pointer(db)).FsuppressErr = U8(1) + rc = Xsqlite3ResolveExprNames(tls, bp /* &nc */, pE) + (*Sqlite3)(unsafe.Pointer(db)).FsuppressErr = savedSuppErr + if rc != 0 { + return 0 + } + + // Try to match the ORDER BY expression against an expression + // in the result set. Return an 1-based index of the matching + // result-set entry. + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + if Xsqlite3ExprCompare(tls, uintptr(0), (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FpExpr, pE, -1) < 2 { + return (i + 1) + } + } + + // If no match, return 0. + return 0 +} + +// Generate an ORDER BY or GROUP BY term out-of-range error. +func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32) { /* sqlite3.c:100497:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + Xsqlite3ErrorMsg(tls, pParse, + + ts+6162 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) +} + +// Analyze the ORDER BY clause in a compound SELECT statement. Modify +// each term of the ORDER BY clause is a constant integer between 1 +// and N where N is the number of columns in the compound SELECT. +// +// ORDER BY terms that are already an integer between 1 and N are +// unmodified. ORDER BY terms that are integers outside the range of +// 1 through N generate an error. ORDER BY terms that are expressions +// are matched against result set expressions of compound SELECT +// beginning with the left-most SELECT and working toward the right. +// At the first match, the ORDER BY expression is transformed into +// the integer column number. +// +// Return the number of errors seen. +func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int32 { /* sqlite3.c:100523:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var i int32 + var pOrderBy uintptr + var pEList uintptr + var db uintptr + var moreToDo int32 = 1 + + pOrderBy = (*Select)(unsafe.Pointer(pSelect)).FpOrderBy + if pOrderBy == uintptr(0) { + return 0 + } + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { + Xsqlite3ErrorMsg(tls, pParse, ts+6218 /* "too many terms i..." */, 0) + return 1 + } + for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { + libc.SetBitFieldPtr8Uint32((pOrderBy+8 /* &.a */)+uintptr(i)*32+20 /* &.done */, uint32(0), 2, 0x4) + } + (*Select)(unsafe.Pointer(pSelect)).FpNext = uintptr(0) + for (*Select)(unsafe.Pointer(pSelect)).FpPrior != 0 { + (*Select)(unsafe.Pointer((*Select)(unsafe.Pointer(pSelect)).FpPrior)).FpNext = pSelect + pSelect = (*Select)(unsafe.Pointer(pSelect)).FpPrior + } + for (pSelect != 0) && (moreToDo != 0) { + var pItem uintptr + moreToDo = 0 + pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList + + i = 0 + pItem = pOrderBy + 8 /* &.a */ + __1: + if !(i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + goto __3 + } + { + *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) = -1 + var pE uintptr + var pDup uintptr + if (uint32(int32(*(*uint8)(unsafe.Pointer(pItem + 20 /* &.done */)) & 0x4 >> 2))) != 0 { + goto __2 + } + pE = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr) + if pE == uintptr(0) { + goto __2 + } + if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { + if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { + resolveOutOfRangeError(tls, pParse, ts+6252 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + return 1 + } + } else { + *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) = resolveAsName(tls, pParse, pEList, pE) + if *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) == 0 { + // Now test if expression pE matches one of the values returned + // by pSelect. In the usual case this is done by duplicating the + // expression, resolving any symbols in it, and then comparing + // it against each expression returned by the SELECT statement. + // Once the comparisons are finished, the duplicate expression + // is deleted. + // + // If this is running as part of an ALTER TABLE operation and + // the symbols resolve successfully, also resolve the symbols in the + // actual expression. This allows the code in alter.c to modify + // column references within the ORDER BY expression as required. + pDup = Xsqlite3ExprDup(tls, db, pE, 0) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + + *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) = resolveOrderByTermToExprList(tls, pParse, pSelect, pDup) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > 0) { + resolveOrderByTermToExprList(tls, pParse, pSelect, pE) + } + } + Xsqlite3ExprDelete(tls, db, pDup) + } + } + if *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > 0 { + // Convert the ORDER BY term into an integer column number iCol, + // taking care to preserve the COLLATE clause if it exists. + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, uintptr(0)) + if pNew == uintptr(0) { + return 1 + } + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_IntValue)) + *(*int32)(unsafe.Pointer(pNew + 8 /* &.u */)) = *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) + if (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr == pE { + (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr = pNew + } else { + var pParent uintptr = (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr + + for int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pParent)).FpLeft)).Fop) == TK_COLLATE { + pParent = (*Expr)(unsafe.Pointer(pParent)).FpLeft + } + + (*Expr)(unsafe.Pointer(pParent)).FpLeft = pNew + } + Xsqlite3ExprDelete(tls, db, pE) + *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(*(*int32)(unsafe.Pointer(bp + 8 /* iCol */))) + } + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.done */, uint32(1), 2, 0x4) + } else { + moreToDo = 1 + } + + } + goto __2 + __2: + i++ + pItem += 32 + goto __1 + goto __3 + __3: + ; + pSelect = (*Select)(unsafe.Pointer(pSelect)).FpNext + } + for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { + if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.done */)) & 0x4 >> 2)) == 0 { + Xsqlite3ErrorMsg(tls, pParse, + ts+6258 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + return 1 + } + } + return 0 +} + +// Check every term in the ORDER BY or GROUP BY clause pOrderBy of +// the SELECT statement pSelect. If any term is reference to a +// result set expression (as determined by the ExprList.a.u.x.iOrderByCol +// field) then convert that term into a copy of the corresponding result set +// column. +// +// If any errors are detected, add an error message to pParse and +// return non-zero. Return zero if no errors are seen. +func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, pOrderBy uintptr, zType uintptr) int32 { /* sqlite3.c:100636:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pEList uintptr + var pItem uintptr + + if ((pOrderBy == uintptr(0)) || ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0)) || (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + return 0 + } + if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { + Xsqlite3ErrorMsg(tls, pParse, ts+6319 /* "too many terms i..." */, libc.VaList(bp, zType)) + return 1 + } + pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList + // sqlite3SelectNew() guarantees this + i = 0 + pItem = pOrderBy + 8 /* &.a */ +__1: + if !(i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + goto __3 + } + { + if *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) != 0 { + if int32(*(*U16)(unsafe.Pointer((pItem + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr { + resolveOutOfRangeError(tls, pParse, zType, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + return 1 + } + resolveAlias(tls, pParse, pEList, (int32(*(*U16)(unsafe.Pointer((pItem + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) - 1), (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr, 0) + } + + } + goto __2 +__2: + i++ + pItem += 32 + goto __1 + goto __3 +__3: + ; + return 0 +} + +// Walker callback for windowRemoveExprFromSelect(). +func resolveRemoveWindowsCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:100670:12: */ + _ = pWalker + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + var pWin uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + Xsqlite3WindowUnlinkFromSelect(tls, pWin) + } + return WRC_Continue +} + +// Remove any Window objects owned by the expression pExpr from the +// Select.pWin list of Select object pSelect. +func windowRemoveExprFromSelect(tls *libc.TLS, pSelect uintptr, pExpr uintptr) { /* sqlite3.c:100683:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + if (*Select)(unsafe.Pointer(pSelect)).FpWin != 0 { + // var sWalker Walker at bp, 48 + + libc.Xmemset(tls, bp /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveRemoveWindowsCb})) + *(*uintptr)(unsafe.Pointer(bp /* &sWalker */ + 40 /* &.u */)) = pSelect + Xsqlite3WalkExpr(tls, bp /* &sWalker */, pExpr) + } +} + +// pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect. +// The Name context of the SELECT statement is pNC. zType is either +// "ORDER" or "GROUP" depending on which type of clause pOrderBy is. +// +// This routine resolves each term of the clause into an expression. +// If the order-by term is an integer I between 1 and N (where N is the +// number of columns in the result set of the SELECT) then the expression +// in the resolution is a copy of the I-th result-set expression. If +// the order-by term is an identifier that corresponds to the AS-name of +// a result-set expression, then the term resolves to a copy of the +// result-set expression. Otherwise, the expression is resolved in +// the usual way - using sqlite3ResolveExprNames(). +// +// This routine returns the number of errors. If errors occur, then +// an appropriate error message might be left in pParse. (OOM errors +// excepted.) +func resolveOrderGroupBy(tls *libc.TLS, pNC uintptr, pSelect uintptr, pOrderBy uintptr, zType uintptr) int32 { /* sqlite3.c:100714:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 + var j int32 // Loop counters + // var iCol int32 at bp, 4 + // Column number + var pItem uintptr // A term of the ORDER BY clause + var pParse uintptr // Parsing context + var nResult int32 // Number of terms in the result set + + nResult = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSelect)).FpEList)).FnExpr + pParse = (*NameContext)(unsafe.Pointer(pNC)).FpParse + i = 0 + pItem = pOrderBy + 8 /* &.a */ +__1: + if !(i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr) { + goto __3 + } + { + var pE uintptr = (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr + var pE2 uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, pE) + if pE2 == uintptr(0) { + goto __2 + } + if int32(*(*int8)(unsafe.Pointer(zType))) != 'G' { + *(*int32)(unsafe.Pointer(bp /* iCol */)) = resolveAsName(tls, pParse, (*Select)(unsafe.Pointer(pSelect)).FpEList, pE2) + if *(*int32)(unsafe.Pointer(bp /* iCol */)) > 0 { + // If an AS-name match is found, mark this ORDER BY column as being + // a copy of the iCol-th result-set column. The subsequent call to + // sqlite3ResolveOrderGroupBy() will convert the expression to a + // copy of the iCol-th result-set expression. + *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(*(*int32)(unsafe.Pointer(bp /* iCol */))) + goto __2 + } + } + if Xsqlite3ExprIsInteger(tls, pE2, bp /* &iCol */) != 0 { + // The ORDER BY term is an integer constant. Again, set the column + // number so that sqlite3ResolveOrderGroupBy() will convert the + // order-by term to a copy of the result-set expression + if (*(*int32)(unsafe.Pointer(bp /* iCol */)) < 1) || (*(*int32)(unsafe.Pointer(bp /* iCol */)) > 0xffff) { + resolveOutOfRangeError(tls, pParse, zType, (i + 1), nResult) + return 1 + } + *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(*(*int32)(unsafe.Pointer(bp /* iCol */))) + goto __2 + } + + // Otherwise, treat the ORDER BY term as an ordinary expression + *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(0) + if Xsqlite3ResolveExprNames(tls, pNC, pE) != 0 { + return 1 + } + for j = 0; j < (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSelect)).FpEList)).FnExpr; j++ { + if Xsqlite3ExprCompare(tls, uintptr(0), pE, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSelect)).FpEList+8 /* &.a */)+uintptr(j)*32)).FpExpr, -1) == 0 { + // Since this expresion is being changed into a reference + // to an identical expression in the result set, remove all Window + // objects belonging to the expression from the Select.pWin list. + windowRemoveExprFromSelect(tls, pSelect, pE) + *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = (U16(j + 1)) + } + } + + } + goto __2 +__2: + i++ + pItem += 32 + goto __1 + goto __3 +__3: + ; + return Xsqlite3ResolveOrderGroupBy(tls, pParse, pSelect, pOrderBy, zType) +} + +// Resolve names in the SELECT statement p and all of its descendants. +func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:100777:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var pOuterNC uintptr // Context that contains this SELECT + // var sNC NameContext at bp, 56 + // Name context of this SELECT + var isCompound int32 // True if p is a compound select + var nCompound int32 // Number of compound terms processed so far + var pParse uintptr // Parsing context + var i int32 // Loop counter + var pGroupBy uintptr // The GROUP BY clause + var pLeftmost uintptr // Left-most of SELECT of a compound + var db uintptr // Database connection + + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Resolved)) != 0 { + return WRC_Prune + } + pOuterNC = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + pParse = (*Walker)(unsafe.Pointer(pWalker)).FpParse + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + // Normally sqlite3SelectExpand() will be called first and will have + // already expanded this SELECT. However, if this is a subquery within + // an expression, sqlite3ResolveExprNames() will be called without a + // prior call to sqlite3SelectExpand(). When that happens, let + // sqlite3SelectPrep() do all of the processing for this SELECT. + // sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and + // this routine in the correct order. + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Expanded)) == U32(0) { + Xsqlite3SelectPrep(tls, pParse, p, pOuterNC) + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return WRC_Abort + } + return WRC_Prune + } + + isCompound = (libc.Bool32((*Select)(unsafe.Pointer(p)).FpPrior != uintptr(0))) + nCompound = 0 + pLeftmost = p + for p != 0 { + + // SF_Resolved not set if errors suppressed + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_Resolved)) + + // Resolve the expressions in the LIMIT and OFFSET clauses. These + // are not allowed to refer to any names, so pass an empty NameContext. + libc.Xmemset(tls, bp /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpWinSelect = p + if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpLimit) != 0 { + return WRC_Abort + } + + // If the SF_Converted flags is set, then this Select object was + // was created by the convertCompoundSelectToSubquery() function. + // In this case the ORDER BY clause (p->pOrderBy) should be resolved + // as if it were part of the sub-query, not the parent. This block + // moves the pOrderBy down to the sub-query. It will be moved back + // after the names have been resolved. + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Converted)) != 0 { + var pSub uintptr = (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpSelect + + (*Select)(unsafe.Pointer(pSub)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy + (*Select)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + } + + // Recursively resolve names in all subqueries + for i = 0; i < (*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpSrc)).FnSrc; i++ { + var pItem uintptr = (((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */) + uintptr(i)*112) + if ((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) && (((*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselFlags & U32(SF_Resolved)) == U32(0)) { + var nRef int32 + if pOuterNC != 0 { + nRef = (*NameContext)(unsafe.Pointer(pOuterNC)).FnRef + } else { + nRef = 0 + } + var zSavedContext uintptr = (*Parse)(unsafe.Pointer(pParse)).FzAuthContext + + if (*SrcItem)(unsafe.Pointer(pItem)).FzName != 0 { + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = (*SrcItem)(unsafe.Pointer(pItem)).FzName + } + Xsqlite3ResolveSelectNames(tls, pParse, (*SrcItem)(unsafe.Pointer(pItem)).FpSelect, pOuterNC) + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedContext + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return WRC_Abort + } + + // If the number of references to the outer context changed when + // expressions in the sub-select were resolved, the sub-select + // is correlated. It is not required to check the refcount on any + // but the innermost outer context object, as lookupName() increments + // the refcount on all contexts between the current one and the + // context containing the column when it resolves a name. + if pOuterNC != 0 { + + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isCorrelated */, (uint32(libc.Bool32((*NameContext)(unsafe.Pointer(pOuterNC)).FnRef > nRef))), 3, 0x8) + } + } + } + + // Set up the local name-context to pass to sqlite3ResolveExprNames() to + // resolve the result-set expression list. + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FncFlags = (NC_AllowAgg | NC_AllowWin) + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = (*Select)(unsafe.Pointer(p)).FpSrc + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpNext = pOuterNC + + // Resolve names in the result set. + if Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpEList) != 0 { + return WRC_Abort + } + *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) &= (libc.CplInt32(NC_AllowWin)) + + // If there are no aggregate functions in the result-set, and no GROUP BY + // expression, do not allow aggregates in any of the other expressions. + + pGroupBy = (*Select)(unsafe.Pointer(p)).FpGroupBy + if (pGroupBy != 0) || (((*NameContext)(unsafe.Pointer(bp /* &sNC */)).FncFlags & NC_HasAgg) != 0) { + + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_Aggregate | ((*NameContext)(unsafe.Pointer(bp /* &sNC */)).FncFlags & NC_MinMaxAgg))) + } else { + *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) &= (libc.CplInt32(NC_AllowAgg)) + } + + // Add the output column list to the name-context before parsing the + // other expressions in the SELECT statement. This is so that + // expressions in the WHERE clause (etc.) can refer to expressions by + // aliases in the result set. + // + // Minor point: If this is the case, then the expression will be + // re-evaluated for each reference to it. + + *(*uintptr)(unsafe.Pointer(bp /* &sNC */ + 16 /* &.uNC */)) = (*Select)(unsafe.Pointer(p)).FpEList + *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_UEList) + if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { + if !(pGroupBy != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+6350 /* "a GROUP BY claus..." */, 0) + return WRC_Abort + } + if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { + return WRC_Abort + } + } + if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpWhere) != 0 { + return WRC_Abort + } + + // Resolve names in table-valued-function arguments + for i = 0; i < (*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpSrc)).FnSrc; i++ { + var pItem uintptr = (((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */) + uintptr(i)*112) + if ((uint32(int32(*(*uint16)(unsafe.Pointer((pItem + 60 /* &.fg */) + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0) && + (Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */))) != 0) { + return WRC_Abort + } + } + + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + var pWin uintptr + for pWin = (*Select)(unsafe.Pointer(p)).FpWinDefn; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + if (Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, (*Window)(unsafe.Pointer(pWin)).FpOrderBy) != 0) || + (Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, (*Window)(unsafe.Pointer(pWin)).FpPartition) != 0) { + return WRC_Abort + } + } + } + + // The ORDER BY and GROUP BY clauses may not refer to terms in + // outer queries + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpNext = uintptr(0) + *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_AllowAgg | NC_AllowWin) + + // If this is a converted compound query, move the ORDER BY clause from + // the sub-query back to the parent query. At this point each term + // within the ORDER BY clause has been transformed to an integer value. + // These integers will be replaced by copies of the corresponding result + // set expressions by the call to resolveOrderGroupBy() below. + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Converted)) != 0 { + var pSub uintptr = (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpSelect + (*Select)(unsafe.Pointer(p)).FpOrderBy = (*Select)(unsafe.Pointer(pSub)).FpOrderBy + (*Select)(unsafe.Pointer(pSub)).FpOrderBy = uintptr(0) + } + + // Process the ORDER BY clause for singleton SELECT statements. + // The ORDER BY clause for compounds SELECT statements is handled + // below, after all of the result-sets for all of the elements of + // the compound have been resolved. + // + // If there is an ORDER BY clause on a term of a compound-select other + // than the right-most term, then that is a syntax error. But the error + // is not detected until much later, and so we need to go ahead and + // resolve those symbols on the incorrect ORDER BY for consistency. + if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && + (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6252 /* "ORDER" */) != 0) { + return WRC_Abort + } + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return WRC_Abort + } + *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) &= (libc.CplInt32(NC_AllowWin)) + + // Resolve the GROUP BY clause. At the same time, make sure + // the GROUP BY clause does not contain aggregate functions. + if pGroupBy != 0 { + var pItem uintptr + + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6394 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return WRC_Abort + } + i = 0 + pItem = pGroupBy + 8 /* &.a */ + __1: + if !(i < (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + goto __3 + } + { + if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { + Xsqlite3ErrorMsg(tls, pParse, + ts+6400 /* "aggregate functi..." */, 0) + return WRC_Abort + } + + } + goto __2 + __2: + i++ + pItem += 32 + goto __1 + goto __3 + __3: + } + + // If this is part of a compound SELECT, check that it has the right + // number of expressions in the select list. + if ((*Select)(unsafe.Pointer(p)).FpNext != 0) && ((*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpNext)).FpEList)).FnExpr) { + Xsqlite3SelectWrongNumTermsError(tls, pParse, (*Select)(unsafe.Pointer(p)).FpNext) + return WRC_Abort + } + + // Advance to the next term of the compound + p = (*Select)(unsafe.Pointer(p)).FpPrior + nCompound++ + } + + // Resolve the ORDER BY on a compound SELECT after all terms of + // the compound have been resolved. + if (isCompound != 0) && (resolveCompoundOrderBy(tls, pParse, pLeftmost) != 0) { + return WRC_Abort + } + + return WRC_Prune +} + +// This routine walks an expression tree and resolves references to +// table columns and result-set columns. At the same time, do error +// checking on function usage and set a flag if any aggregate functions +// are seen. +// +// To resolve table columns references we look for nodes (or subtrees) of the +// form X.Y.Z or Y.Z or just Z where +// +// X: The name of a database. Ex: "main" or "temp" or +// the symbolic name assigned to an ATTACH-ed database. +// +// Y: The name of a table in a FROM clause. Or in a trigger +// one of the special names "old" or "new". +// +// Z: The name of a column in table Y. +// +// The node at the root of the subtree is modified as follows: +// +// Expr.op Changed to TK_COLUMN +// Expr.pTab Points to the Table object for X.Y +// Expr.iColumn The column index in X.Y. -1 for the rowid. +// Expr.iTable The VDBE cursor number for X.Y +// +// +// To resolve result-set references, look for expression nodes of the +// form Z (with no X and Y prefix) where the Z matches the right-hand +// size of an AS clause in the result-set of a SELECT. The Z expression +// is replaced by a copy of the left-hand side of the result-set expression. +// Table-name and function resolution occurs on the substituted expression +// tree. For example, in: +// +// SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x; +// +// The "x" term of the order by is replaced by "a+b" to render: +// +// SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b; +// +// Function calls are checked to make sure that the function is +// defined and that the correct number of arguments are specified. +// If the function is an aggregate function, then the NC_HasAgg flag is +// set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION. +// If an expression contains aggregate functions then the EP_Agg +// property on the expression is set. +// +// An error message is left in pParse if anything is amiss. The number +// if errors is returned. +func Xsqlite3ResolveExprNames(tls *libc.TLS, pNC uintptr, pExpr uintptr) int32 { /* sqlite3.c:101063:20: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var savedHasAgg int32 + // var w Walker at bp, 48 + + if pExpr == uintptr(0) { + return SQLITE_OK + } + savedHasAgg = ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & ((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin)) + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) &= (libc.CplInt32(((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = (*NameContext)(unsafe.Pointer(pNC)).FpParse + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveExprStep})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = func() uintptr { + if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_NoSelect) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveSelectStep})) + }() + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = pNC + *(*int32)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse + 284 /* &.nHeight */)) += ((*Expr)(unsafe.Pointer(pExpr)).FnHeight) + if Xsqlite3ExprCheckHeight(tls, (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse, (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse)).FnHeight) != 0 { + return SQLITE_ERROR + } + Xsqlite3WalkExpr(tls, bp /* &w */, pExpr) + *(*int32)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse + 284 /* &.nHeight */)) -= ((*Expr)(unsafe.Pointer(pExpr)).FnHeight) + + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32((*NameContext)(unsafe.Pointer(pNC)).FncFlags & (NC_HasAgg | NC_HasWin))) + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) |= (savedHasAgg) + return (libc.Bool32(((*NameContext)(unsafe.Pointer(pNC)).FnNcErr > 0) || ((*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse)).FnErr > 0))) +} + +// Resolve all names for all expression in an expression list. This is +// just like sqlite3ResolveExprNames() except that it works for an expression +// list rather than a single expression. +func Xsqlite3ResolveExprListNames(tls *libc.TLS, pNC uintptr, pList uintptr) int32 { /* sqlite3.c:101102:20: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var i int32 + var savedHasAgg int32 = 0 + // var w Walker at bp, 48 + + if pList == uintptr(0) { + return WRC_Continue + } + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = (*NameContext)(unsafe.Pointer(pNC)).FpParse + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveExprStep})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveSelectStep})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = pNC + savedHasAgg = ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & ((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin)) + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) &= (libc.CplInt32(((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin))) + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + var pExpr uintptr = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if pExpr == uintptr(0) { + continue + } + *(*int32)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse + 284 /* &.nHeight */)) += ((*Expr)(unsafe.Pointer(pExpr)).FnHeight) + if Xsqlite3ExprCheckHeight(tls, (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse, (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse)).FnHeight) != 0 { + return WRC_Abort + } + Xsqlite3WalkExpr(tls, bp /* &w */, pExpr) + *(*int32)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse + 284 /* &.nHeight */)) -= ((*Expr)(unsafe.Pointer(pExpr)).FnHeight) + + if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & ((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin)) != 0 { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32((*NameContext)(unsafe.Pointer(pNC)).FncFlags & (NC_HasAgg | NC_HasWin))) + savedHasAgg = savedHasAgg | ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & ((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin)) + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) &= (libc.CplInt32(((NC_HasAgg | NC_MinMaxAgg) | NC_HasWin))) + } + if (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(bp /* &w */)).FpParse)).FnErr > 0 { + return WRC_Abort + } + } + *(*int32)(unsafe.Pointer(pNC + 40 /* &.ncFlags */)) |= (savedHasAgg) + return WRC_Continue +} + +// Resolve all names in all expressions of a SELECT and in all +// decendents of the SELECT, including compounds off of p->pPrior, +// subqueries in expressions, and subqueries used as FROM clause +// terms. +// +// See sqlite3ResolveExprNames() for a description of the kinds of +// transformations that occur. +// +// All SELECT statements should have been expanded using +// sqlite3SelectExpand() prior to invoking this routine. +func Xsqlite3ResolveSelectNames(tls *libc.TLS, pParse uintptr, p uintptr, pOuterNC uintptr) { /* sqlite3.c:101157:21: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveExprStep})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{resolveSelectStep})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = uintptr(0) + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = pParse + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = pOuterNC + Xsqlite3WalkSelect(tls, bp /* &w */, p) +} + +// Resolve names in expressions that can only reference a single table +// or which cannot reference any tables at all. Examples: +// +// "type" flag +// ------------ +// (1) CHECK constraints NC_IsCheck +// (2) WHERE clauses on partial indices NC_PartIdx +// (3) Expressions in indexes on expressions NC_IdxExpr +// (4) Expression arguments to VACUUM INTO. 0 +// (5) GENERATED ALWAYS as expressions NC_GenCol +// +// In all cases except (4), the Expr.iTable value for Expr.op==TK_COLUMN +// nodes of the expression is set to -1 and the Expr.iColumn value is +// set to the column number. In case (4), TK_COLUMN nodes cause an error. +// +// Any errors cause an error message to be set in pParse. +func Xsqlite3ResolveSelfReference(tls *libc.TLS, pParse uintptr, pTab uintptr, type1 int32, pExpr uintptr, pList uintptr) int32 { /* sqlite3.c:101191:20: */ + bp := tls.Alloc(176) + defer tls.Free(176) + + // var sSrc SrcList at bp+56, 120 + // Fake SrcList for pParse->pNewTable + // var sNC NameContext at bp, 56 + // Name context for pParse->pNewTable + var rc int32 + + libc.Xmemset(tls, bp /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + libc.Xmemset(tls, bp+56 /* &sSrc */, 0, uint64(unsafe.Sizeof(SrcList{}))) + if pTab != 0 { + (*SrcList)(unsafe.Pointer(bp + 56 /* &sSrc */)).FnSrc = 1 + (*SrcItem)(unsafe.Pointer((bp + 56 /* &sSrc */ + 8 /* &.a */))).FzName = (*Table)(unsafe.Pointer(pTab)).FzName + (*SrcItem)(unsafe.Pointer((bp + 56 /* &sSrc */ + 8 /* &.a */))).FpTab = pTab + (*SrcItem)(unsafe.Pointer((bp + 56 /* &sSrc */ + 8 /* &.a */))).FiCursor = -1 + if (*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+1*32)).FpSchema { + // Cause EP_FromDDL to be set on TK_FUNCTION nodes of non-TEMP + // schema elements + type1 = type1 | (NC_FromDDL) + } + } + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = bp + 56 /* &sSrc */ + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FncFlags = (type1 | NC_IsDDL) + if (libc.AssignInt32(&rc, Xsqlite3ResolveExprNames(tls, bp /* &sNC */, pExpr))) != SQLITE_OK { + return rc + } + if pList != 0 { + rc = Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, pList) + } + return rc +} + +// Return the affinity character for a single column of a table. +func Xsqlite3TableColumnAffinity(tls *libc.TLS, pTab uintptr, iCol int32) int8 { /* sqlite3.c:101251:21: */ + + if iCol >= 0 { + return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).Faffinity + } + return int8(SQLITE_AFF_INTEGER) +} + +// Return the 'affinity' of the expression pExpr if any. +// +// If pExpr is a column, a reference to a column via an 'AS' alias, +// or a sub-select with a column as the return value, then the +// affinity of that column is returned. Otherwise, 0x00 is returned, +// indicating no affinity for the expression. +// +// i.e. the WHERE clause expressions in the following statements all +// have an affinity: +// +// CREATE TABLE t1(a); +// SELECT * FROM t1 WHERE a; +// SELECT a AS b FROM t1 WHERE b; +// SELECT * FROM t1 WHERE (select a from t1); +func Xsqlite3ExprAffinity(tls *libc.TLS, pExpr uintptr) int8 { /* sqlite3.c:101272:21: */ + var op int32 + for ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Skip | EP_IfNullRow))) != U32(0) { + + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + + } + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) + if op == TK_REGISTER { + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) + } + if ((op == TK_COLUMN) || (op == TK_AGG_COLUMN)) && (*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) != 0) { + return Xsqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)), int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) + } + if op == TK_SELECT { + + return Xsqlite3ExprAffinity(tls, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList + 8 /* &.a */))).FpExpr) + } + if op == TK_CAST { + + return Xsqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), uintptr(0)) + } + if op == TK_SELECT_COLUMN { + + return Xsqlite3ExprAffinity(tls, + (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft + 32 /* &.x */)))).FpEList+8 /* &.a */)+uintptr((*Expr)(unsafe.Pointer(pExpr)).FiColumn)*32)).FpExpr) + } + if op == TK_VECTOR { + return Xsqlite3ExprAffinity(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */))).FpExpr) + } + return (*Expr)(unsafe.Pointer(pExpr)).FaffExpr +} + +// Set the collating sequence for expression pExpr to be the collating +// sequence named by pToken. Return a pointer to a new Expr node that +// implements the COLLATE operator. +// +// If a memory allocation error occurs, that fact is recorded in pParse->db +// and the pExpr parameter is returned unchanged. +func Xsqlite3ExprAddCollateToken(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCollName uintptr, dequote int32) uintptr { /* sqlite3.c:101319:21: */ + if (*Token)(unsafe.Pointer(pCollName)).Fn > uint32(0) { + var pNew uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_COLLATE, pCollName, dequote) + if pNew != 0 { + (*Expr)(unsafe.Pointer(pNew)).FpLeft = pExpr + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_Collate | EP_Skip)) + pExpr = pNew + } + } + return pExpr +} + +func Xsqlite3ExprAddCollateString(tls *libc.TLS, pParse uintptr, pExpr uintptr, zC uintptr) uintptr { /* sqlite3.c:101335:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var s Token at bp, 16 + + Xsqlite3TokenInit(tls, bp /* &s */, zC) + return Xsqlite3ExprAddCollateToken(tls, pParse, pExpr, bp /* &s */, 0) +} + +// Skip over any TK_COLLATE operators. +func Xsqlite3ExprSkipCollate(tls *libc.TLS, pExpr uintptr) uintptr { /* sqlite3.c:101345:21: */ + for (pExpr != 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Skip))) != U32(0)) { + + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + } + return pExpr +} + +// Skip over any TK_COLLATE operators and/or any unlikely() +// or likelihood() or likely() functions at the root of an +// expression. +func Xsqlite3ExprSkipCollateAndLikely(tls *libc.TLS, pExpr uintptr) uintptr { /* sqlite3.c:101358:21: */ + for (pExpr != 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Skip | EP_Unlikely))) != U32(0)) { + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Unlikely))) != U32(0) { + + pExpr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */))).FpExpr + } else { + + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + } + } + return pExpr +} + +// Return the collation sequence for the expression pExpr. If +// there is no defined collating sequence, return NULL. +// +// See also: sqlite3ExprNNCollSeq() +// +// The sqlite3ExprNNCollSeq() works the same exact that it returns the +// default collation if pExpr has no defined collation. +// +// The collating sequence might be determined by a COLLATE operator +// or by the presence of a column with a defined collating sequence. +// COLLATE operators take first precedence. Left operands take +// precedence over right operands. +func Xsqlite3ExprCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) uintptr { /* sqlite3.c:101387:24: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pColl uintptr = uintptr(0) + var p uintptr = pExpr + for p != 0 { + var op int32 = int32((*Expr)(unsafe.Pointer(p)).Fop) + if op == TK_REGISTER { + op = int32((*Expr)(unsafe.Pointer(p)).Fop2) + } + if (((op == TK_AGG_COLUMN) || (op == TK_COLUMN)) || (op == TK_TRIGGER)) && + (*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)) != uintptr(0)) { + // op==TK_REGISTER && p->y.pTab!=0 happens when pExpr was originally + // a TK_COLUMN but was previously evaluated and cached in a register + var j int32 = int32((*Expr)(unsafe.Pointer(p)).FiColumn) + if j >= 0 { + var zColl uintptr = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FaCol + uintptr(j)*32)).FzColl + pColl = Xsqlite3FindCollSeq(tls, db, (*Sqlite3)(unsafe.Pointer(db)).Fenc, zColl, 0) + } + break + } + if (op == TK_CAST) || (op == TK_UPLUS) { + p = (*Expr)(unsafe.Pointer(p)).FpLeft + continue + } + if op == TK_VECTOR { + p = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) + 8 /* &.a */))).FpExpr + continue + } + if op == TK_COLLATE { + pColl = Xsqlite3GetCollSeq(tls, pParse, (*Sqlite3)(unsafe.Pointer(db)).Fenc, uintptr(0), *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))) + break + } + if ((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Collate)) != 0 { + if ((*Expr)(unsafe.Pointer(p)).FpLeft != 0) && (((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(p)).FpLeft)).Fflags & U32(EP_Collate)) != U32(0)) { + p = (*Expr)(unsafe.Pointer(p)).FpLeft + } else { + var pNext uintptr = (*Expr)(unsafe.Pointer(p)).FpRight + // The Expr.x union is never used at the same time as Expr.pRight + + if ((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) != uintptr(0)) && + !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0)) && + (!(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_xIsSelect))) != U32(0))) { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)))).FnExpr; i++ { + if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) + 8 /* &.a */) + uintptr(i)*32)).FpExpr))).Fflags & (U32(EP_Collate))) != U32(0) { + pNext = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) + 8 /* &.a */) + uintptr(i)*32)).FpExpr + break + } + } + } + p = pNext + } + } else { + break + } + } + if Xsqlite3CheckCollSeq(tls, pParse, pColl) != 0 { + pColl = uintptr(0) + } + return pColl +} + +// Return the collation sequence for the expression pExpr. If +// there is no defined collating sequence, return a pointer to the +// defautl collation sequence. +// +// See also: sqlite3ExprCollSeq() +// +// The sqlite3ExprCollSeq() routine works the same except that it +// returns NULL if there is no defined collation. +func Xsqlite3ExprNNCollSeq(tls *libc.TLS, pParse uintptr, pExpr uintptr) uintptr { /* sqlite3.c:101459:24: */ + var p uintptr = Xsqlite3ExprCollSeq(tls, pParse, pExpr) + if p == uintptr(0) { + p = (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl + } + + return p +} + +// Return TRUE if the two expressions have equivalent collating sequences. +func Xsqlite3ExprCollSeqMatch(tls *libc.TLS, pParse uintptr, pE1 uintptr, pE2 uintptr) int32 { /* sqlite3.c:101469:20: */ + var pColl1 uintptr = Xsqlite3ExprNNCollSeq(tls, pParse, pE1) + var pColl2 uintptr = Xsqlite3ExprNNCollSeq(tls, pParse, pE2) + return (libc.Bool32(Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pColl1)).FzName, (*CollSeq)(unsafe.Pointer(pColl2)).FzName) == 0)) +} + +// pExpr is an operand of a comparison operator. aff2 is the +// type affinity of the other operand. This routine returns the +// type affinity that should be used for the comparison operator. +func Xsqlite3CompareAffinity(tls *libc.TLS, pExpr uintptr, aff2 int8) int8 { /* sqlite3.c:101480:21: */ + var aff1 int8 = Xsqlite3ExprAffinity(tls, pExpr) + if (int32(aff1) > SQLITE_AFF_NONE) && (int32(aff2) > SQLITE_AFF_NONE) { + // Both sides of the comparison are columns. If one has numeric + // affinity, use that. Otherwise use no affinity. + if ((int32(aff1)) >= SQLITE_AFF_NUMERIC) || ((int32(aff2)) >= SQLITE_AFF_NUMERIC) { + return int8(SQLITE_AFF_NUMERIC) + } else { + return int8(SQLITE_AFF_BLOB) + } + } else { + // One side is a column, the other is not. Use the columns affinity. + + return (int8((func() int32 { + if int32(aff1) <= SQLITE_AFF_NONE { + return int32(aff2) + } + return int32(aff1) + }()) | SQLITE_AFF_NONE)) + } + return int8(0) +} + +// pExpr is a comparison operator. Return the type affinity that should +// be applied to both operands prior to doing the comparison. +func comparisonAffinity(tls *libc.TLS, pExpr uintptr) int8 { /* sqlite3.c:101502:13: */ + var aff int8 + + aff = Xsqlite3ExprAffinity(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + if (*Expr)(unsafe.Pointer(pExpr)).FpRight != 0 { + aff = Xsqlite3CompareAffinity(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight, aff) + } else if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + aff = Xsqlite3CompareAffinity(tls, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList + 8 /* &.a */))).FpExpr, aff) + } else if int32(aff) == 0 { + aff = int8(SQLITE_AFF_BLOB) + } + return aff +} + +// pExpr is a comparison expression, eg. '=', '<', IN(...) etc. +// idx_affinity is the affinity of an indexed column. Return true +// if the index with affinity idx_affinity may be used to implement +// the comparison in pExpr. +func Xsqlite3IndexAffinityOk(tls *libc.TLS, pExpr uintptr, idx_affinity int8) int32 { /* sqlite3.c:101525:20: */ + var aff int8 = comparisonAffinity(tls, pExpr) + if int32(aff) < SQLITE_AFF_TEXT { + return 1 + } + if int32(aff) == SQLITE_AFF_TEXT { + return (libc.Bool32(int32(idx_affinity) == SQLITE_AFF_TEXT)) + } + return (libc.Bool32((int32(idx_affinity)) >= SQLITE_AFF_NUMERIC)) +} + +// Return the P5 value that should be used for a binary comparison +// opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2. +func binaryCompareP5(tls *libc.TLS, pExpr1 uintptr, pExpr2 uintptr, jumpIfNull int32) U8 { /* sqlite3.c:101540:11: */ + var aff U8 = U8(Xsqlite3ExprAffinity(tls, pExpr2)) + aff = (U8(int32(U8(Xsqlite3CompareAffinity(tls, pExpr1, int8(aff)))) | int32(U8(jumpIfNull)))) + return aff +} + +// Return a pointer to the collation sequence that should be used by +// a binary comparison operator comparing pLeft and pRight. +// +// If the left hand expression has a collating sequence type, then it is +// used. Otherwise the collation sequence for the right hand expression +// is used, or the default (BINARY) if neither expression has a collating +// type. +// +// Argument pRight (but not pLeft) may be a null pointer. In this case, +// it is not considered. +func Xsqlite3BinaryCompareCollSeq(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:101562:24: */ + var pColl uintptr + + if ((*Expr)(unsafe.Pointer(pLeft)).Fflags & U32(EP_Collate)) != 0 { + pColl = Xsqlite3ExprCollSeq(tls, pParse, pLeft) + } else if (pRight != 0) && (((*Expr)(unsafe.Pointer(pRight)).Fflags & U32(EP_Collate)) != U32(0)) { + pColl = Xsqlite3ExprCollSeq(tls, pParse, pRight) + } else { + pColl = Xsqlite3ExprCollSeq(tls, pParse, pLeft) + if !(pColl != 0) { + pColl = Xsqlite3ExprCollSeq(tls, pParse, pRight) + } + } + return pColl +} + +// Expresssion p is a comparison operator. Return a collation sequence +// appropriate for the comparison operator. +// +// This is normally just a wrapper around sqlite3BinaryCompareCollSeq(). +// However, if the OP_Commuted flag is set, then the order of the operands +// is reversed in the sqlite3BinaryCompareCollSeq() call so that the +// correct collating sequence is found. +func Xsqlite3ExprCompareCollSeq(tls *libc.TLS, pParse uintptr, p uintptr) uintptr { /* sqlite3.c:101590:24: */ + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_Commuted))) != U32(0) { + return Xsqlite3BinaryCompareCollSeq(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpRight, (*Expr)(unsafe.Pointer(p)).FpLeft) + } else { + return Xsqlite3BinaryCompareCollSeq(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpLeft, (*Expr)(unsafe.Pointer(p)).FpRight) + } + return uintptr(0) +} + +// Generate code for a comparison operator. +func codeCompare(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr, opcode int32, in1 int32, in2 int32, dest int32, jumpIfNull int32, isCommuted int32) int32 { /* sqlite3.c:101601:12: */ + var p5 int32 + var addr int32 + var p4 uintptr + + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return 0 + } + if isCommuted != 0 { + p4 = Xsqlite3BinaryCompareCollSeq(tls, pParse, pRight, pLeft) + } else { + p4 = Xsqlite3BinaryCompareCollSeq(tls, pParse, pLeft, pRight) + } + p5 = int32(binaryCompareP5(tls, pLeft, pRight, jumpIfNull)) + addr = Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, opcode, in2, dest, in1, + p4, -2) + Xsqlite3VdbeChangeP5(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, uint16(U8(p5))) + return addr +} + +// Return true if expression pExpr is a vector, or false otherwise. +// +// A vector is defined as any expression that results in two or more +// columns of result. Every TK_VECTOR node is an vector because the +// parser will not generate a TK_VECTOR with fewer than two entries. +// But a TK_SELECT might be either a vector or a scalar. It is only +// considered a vector if it has two or more result columns. +func Xsqlite3ExprIsVector(tls *libc.TLS, pExpr uintptr) int32 { /* sqlite3.c:101637:20: */ + return (libc.Bool32(Xsqlite3ExprVectorSize(tls, pExpr) > 1)) +} + +// If the expression passed as the only argument is of type TK_VECTOR +// return the number of expressions in the vector. Or, if the expression +// is a sub-select, return the number of columns in the sub-select. For +// any other type of expression, return 1. +func Xsqlite3ExprVectorSize(tls *libc.TLS, pExpr uintptr) int32 { /* sqlite3.c:101647:20: */ + var op U8 = (*Expr)(unsafe.Pointer(pExpr)).Fop + if int32(op) == TK_REGISTER { + op = (*Expr)(unsafe.Pointer(pExpr)).Fop2 + } + if int32(op) == TK_VECTOR { + return (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FnExpr + } else if int32(op) == TK_SELECT { + return (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr + } else { + return 1 + } + return int32(0) +} + +// Return a pointer to a subexpression of pVector that is the i-th +// column of the vector (numbered starting with 0). The caller must +// ensure that i is within range. +// +// If pVector is really a scalar (and "scalar" here includes subqueries +// that return a single column!) then return pVector unmodified. +// +// pVector retains ownership of the returned subexpression. +// +// If the vector is a (SELECT ...) then the expression returned is +// just the expression for the i-th term of the result set, and may +// not be ready for evaluation because the table cursor has not yet +// been positioned. +func Xsqlite3VectorFieldSubexpr(tls *libc.TLS, pVector uintptr, i int32) uintptr { /* sqlite3.c:101674:21: */ + + if Xsqlite3ExprIsVector(tls, pVector) != 0 { + + if (int32((*Expr)(unsafe.Pointer(pVector)).Fop) == TK_SELECT) || (int32((*Expr)(unsafe.Pointer(pVector)).Fop2) == TK_SELECT) { + return (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32 /* &.x */)))).FpEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + } else { + return (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pVector + 32 /* &.x */)) + 8 /* &.a */) + uintptr(i)*32)).FpExpr + } + } + return pVector +} + +// Compute and return a new Expr object which when passed to +// sqlite3ExprCode() will generate all necessary code to compute +// the iField-th column of the vector expression pVector. +// +// It is ok for pVector to be a scalar (as long as iField==0). +// In that case, this routine works like sqlite3ExprDup(). +// +// The caller owns the returned Expr object and is responsible for +// ensuring that the returned value eventually gets freed. +// +// The caller retains ownership of pVector. If pVector is a TK_SELECT, +// then the returned object will reference pVector and so pVector must remain +// valid for the life of the returned object. If pVector is a TK_VECTOR +// or a scalar expression, then it can be deleted as soon as this routine +// returns. +// +// A trick to cause a TK_SELECT pVector to be deleted together with +// the returned Expr object is to attach the pVector to the pRight field +// of the returned TK_SELECT_COLUMN Expr object. +func Xsqlite3ExprForVectorField(tls *libc.TLS, pParse uintptr, pVector uintptr, iField int32) uintptr { /* sqlite3.c:101708:21: */ + var pRet uintptr + if int32((*Expr)(unsafe.Pointer(pVector)).Fop) == TK_SELECT { + + // The TK_SELECT_COLUMN Expr node: + // + // pLeft: pVector containing TK_SELECT. Not deleted. + // pRight: not used. But recursively deleted. + // iColumn: Index of a column in pVector + // iTable: 0 or the number of columns on the LHS of an assignment + // pLeft->iTable: First in an array of register holding result, or 0 + // if the result is not yet computed. + // + // sqlite3ExprDelete() specifically skips the recursive delete of + // pLeft on TK_SELECT_COLUMN nodes. But pRight is followed, so pVector + // can be attached to pRight to cause this node to take ownership of + // pVector. Typically there will be multiple TK_SELECT_COLUMN nodes + // with the same pLeft pointer to the pVector, but only one of them + // will own the pVector. + pRet = Xsqlite3PExpr(tls, pParse, TK_SELECT_COLUMN, uintptr(0), uintptr(0)) + if pRet != 0 { + (*Expr)(unsafe.Pointer(pRet)).FiColumn = YnVar(iField) + (*Expr)(unsafe.Pointer(pRet)).FpLeft = pVector + } + + } else { + if int32((*Expr)(unsafe.Pointer(pVector)).Fop) == TK_VECTOR { + pVector = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pVector + 32 /* &.x */)) + 8 /* &.a */) + uintptr(iField)*32)).FpExpr + } + pRet = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pVector, 0) + Xsqlite3RenameTokenRemap(tls, pParse, pRet, pVector) + } + return pRet +} + +// If expression pExpr is of type TK_SELECT, generate code to evaluate +// it. Return the register in which the result is stored (or, if the +// sub-select returns more than one column, the first in an array +// of registers in which the result is stored). +// +// If pExpr is not a TK_SELECT expression, return 0. +func exprCodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { /* sqlite3.c:101754:12: */ + var reg int32 = 0 + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { + reg = Xsqlite3CodeSubselect(tls, pParse, pExpr) + } + return reg +} + +// Argument pVector points to a vector expression - either a TK_VECTOR +// or TK_SELECT that returns more than one column. This function returns +// the register number of a register that contains the value of +// element iField of the vector. +// +// If pVector is a TK_SELECT expression, then code for it must have +// already been generated using the exprCodeSubselect() routine. In this +// case parameter regSelect should be the first in an array of registers +// containing the results of the sub-select. +// +// If pVector is of type TK_VECTOR, then code for the requested field +// is generated. In this case (*pRegFree) may be set to the number of +// a temporary register to be freed by the caller before returning. +// +// Before returning, output parameter (*ppExpr) is set to point to the +// Expr object corresponding to element iElem of the vector. +func exprVectorRegister(tls *libc.TLS, pParse uintptr, pVector uintptr, iField int32, regSelect int32, ppExpr uintptr, pRegFree uintptr) int32 { /* sqlite3.c:101782:12: */ + var op U8 = (*Expr)(unsafe.Pointer(pVector)).Fop + + if int32(op) == TK_REGISTER { + *(*uintptr)(unsafe.Pointer(ppExpr)) = Xsqlite3VectorFieldSubexpr(tls, pVector, iField) + return ((*Expr)(unsafe.Pointer(pVector)).FiTable + iField) + } + if int32(op) == TK_SELECT { + *(*uintptr)(unsafe.Pointer(ppExpr)) = (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pVector + 32 /* &.x */)))).FpEList + 8 /* &.a */) + uintptr(iField)*32)).FpExpr + return (regSelect + iField) + } + if int32(op) == TK_VECTOR { + *(*uintptr)(unsafe.Pointer(ppExpr)) = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pVector + 32 /* &.x */)) + 8 /* &.a */) + uintptr(iField)*32)).FpExpr + return Xsqlite3ExprCodeTemp(tls, pParse, *(*uintptr)(unsafe.Pointer(ppExpr)), pRegFree) + } + return 0 +} + +// Expression pExpr is a comparison between two vector values. Compute +// the result of the comparison (1, 0, or NULL) and write that +// result into register dest. +// +// The caller must satisfy the following preconditions: +// +// if pExpr->op==TK_IS: op==TK_EQ and p5==SQLITE_NULLEQ +// if pExpr->op==TK_ISNOT: op==TK_NE and p5==SQLITE_NULLEQ +// otherwise: op==pExpr->op and p5==0 +func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, op U8, p5 U8) { /* sqlite3.c:101818:13: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + var pRight uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpRight + var nLeft int32 = Xsqlite3ExprVectorSize(tls, pLeft) + var i int32 + var regLeft int32 = 0 + var regRight int32 = 0 + var opx U8 = op + var addrCmp int32 = 0 + var addrDone int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var isCommuted int32 = (libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Commuted))) != U32(0))) + + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { + Xsqlite3ErrorMsg(tls, pParse, ts+5549 /* "row value misuse..." */, 0) + return + } + + if int32(op) == TK_LE { + opx = U8(TK_LT) + } + if int32(op) == TK_GE { + opx = U8(TK_GT) + } + if int32(op) == TK_NE { + opx = U8(TK_EQ) + } + + regLeft = exprCodeSubselect(tls, pParse, pLeft) + regRight = exprCodeSubselect(tls, pParse, pRight) + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, dest) + for i = 0; 1 != 0; i++ { + *(*int32)(unsafe.Pointer(bp + 8 /* regFree1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 24 /* regFree2 */)) = 0 + *(*uintptr)(unsafe.Pointer(bp /* pL */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pR */)) = uintptr(0) + var r1 int32 + var r2 int32 + + if addrCmp != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrCmp) + } + r1 = exprVectorRegister(tls, pParse, pLeft, i, regLeft, bp /* &pL */, bp+8 /* ®Free1 */) + r2 = exprVectorRegister(tls, pParse, pRight, i, regRight, bp+16 /* &pR */, bp+24 /* ®Free2 */) + addrCmp = Xsqlite3VdbeCurrentAddr(tls, v) + codeCompare(tls, pParse, *(*uintptr)(unsafe.Pointer(bp /* pL */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* pR */)), int32(opx), r1, r2, addrDone, int32(p5), isCommuted) + + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 8 /* regFree1 */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 24 /* regFree2 */))) + if ((int32(opx) == TK_LT) || (int32(opx) == TK_GT)) && (i < (nLeft - 1)) { + addrCmp = Xsqlite3VdbeAddOp0(tls, v, OP_ElseEq) + + } + if int32(p5) == SQLITE_NULLEQ { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, dest) + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_ZeroOrNull, r1, dest, r2) + } + if i == (nLeft - 1) { + break + } + if int32(opx) == TK_EQ { + Xsqlite3VdbeAddOp2(tls, v, OP_NotNull, dest, addrDone) + } else { + + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrDone) + if i == (nLeft - 2) { + opx = op + } + } + } + Xsqlite3VdbeJumpHere(tls, v, addrCmp) + Xsqlite3VdbeResolveLabel(tls, v, addrDone) + if int32(op) == TK_NE { + Xsqlite3VdbeAddOp2(tls, v, OP_Not, dest, dest) + } +} + +// Check that argument nHeight is less than or equal to the maximum +// expression depth allowed. If it is not, leave an error message in +// pParse. +func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 { /* sqlite3.c:101913:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 3*4)) + if nHeight > mxHeight { + Xsqlite3ErrorMsg(tls, pParse, + ts+6459 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + rc = SQLITE_ERROR + } + return rc +} + +// The following three functions, heightOfExpr(), heightOfExprList() +// and heightOfSelect(), are used to determine the maximum height +// of any expression tree referenced by the structure passed as the +// first argument. +// +// If this maximum height is greater than the current value pointed +// to by pnHeight, the second parameter, then set *pnHeight to that +// value. +func heightOfExpr(tls *libc.TLS, p uintptr, pnHeight uintptr) { /* sqlite3.c:101934:13: */ + if p != 0 { + if (*Expr)(unsafe.Pointer(p)).FnHeight > *(*int32)(unsafe.Pointer(pnHeight)) { + *(*int32)(unsafe.Pointer(pnHeight)) = (*Expr)(unsafe.Pointer(p)).FnHeight + } + } +} + +func heightOfExprList(tls *libc.TLS, p uintptr, pnHeight uintptr) { /* sqlite3.c:101941:13: */ + if p != 0 { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(p)).FnExpr; i++ { + heightOfExpr(tls, (*ExprList_item)(unsafe.Pointer((p+8 /* &.a */)+uintptr(i)*32)).FpExpr, pnHeight) + } + } +} + +func heightOfSelect(tls *libc.TLS, pSelect uintptr, pnHeight uintptr) { /* sqlite3.c:101949:13: */ + var p uintptr + for p = pSelect; p != 0; p = (*Select)(unsafe.Pointer(p)).FpPrior { + heightOfExpr(tls, (*Select)(unsafe.Pointer(p)).FpWhere, pnHeight) + heightOfExpr(tls, (*Select)(unsafe.Pointer(p)).FpHaving, pnHeight) + heightOfExpr(tls, (*Select)(unsafe.Pointer(p)).FpLimit, pnHeight) + heightOfExprList(tls, (*Select)(unsafe.Pointer(p)).FpEList, pnHeight) + heightOfExprList(tls, (*Select)(unsafe.Pointer(p)).FpGroupBy, pnHeight) + heightOfExprList(tls, (*Select)(unsafe.Pointer(p)).FpOrderBy, pnHeight) + } +} + +// Set the Expr.nHeight variable in the structure passed as an +// argument. An expression with no children, Expr.pList or +// Expr.pSelect member has a height of 1. Any other expression +// has a height equal to the maximum height of any other +// referenced Expr plus one. +// +// Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags, +// if appropriate. +func exprSetHeight(tls *libc.TLS, p uintptr) { /* sqlite3.c:101971:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* nHeight */)) = 0 + heightOfExpr(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, bp /* &nHeight */) + heightOfExpr(tls, (*Expr)(unsafe.Pointer(p)).FpRight, bp /* &nHeight */) + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + heightOfSelect(tls, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)), bp /* &nHeight */) + } else if *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) != 0 { + heightOfExprList(tls, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)), bp /* &nHeight */) + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) |= ((U32((EP_Collate | EP_Subquery) | EP_HasFunc)) & Xsqlite3ExprListFlags(tls, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)))) + } + (*Expr)(unsafe.Pointer(p)).FnHeight = (*(*int32)(unsafe.Pointer(bp /* nHeight */)) + 1) +} + +// Set the Expr.nHeight variable using the exprSetHeight() function. If +// the height is greater than the maximum allowed expression depth, +// leave an error in pParse. +// +// Also propagate all EP_Propagate flags from the Expr.x.pList into +// Expr.flags. +func Xsqlite3ExprSetHeightAndFlags(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:101992:21: */ + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + exprSetHeight(tls, p) + Xsqlite3ExprCheckHeight(tls, pParse, (*Expr)(unsafe.Pointer(p)).FnHeight) +} + +// Return the maximum height of any expression tree referenced +// by the select statement passed as an argument. +func Xsqlite3SelectExprHeight(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:102002:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* nHeight */)) = 0 + heightOfSelect(tls, p, bp /* &nHeight */) + return *(*int32)(unsafe.Pointer(bp /* nHeight */)) +} + +// This routine is the core allocator for Expr nodes. +// +// Construct a new expression node and return a pointer to it. Memory +// for this node and for the pToken argument is a single allocation +// obtained from sqlite3DbMalloc(). The calling function +// is responsible for making sure the node eventually gets freed. +// +// If dequote is true, then the token (if it exists) is dequoted. +// If dequote is false, no dequoting is performed. The deQuote +// parameter is ignored if pToken is NULL or if the token does not +// appear to be quoted. If the quotes were of the form "..." (double-quotes) +// then the EP_DblQuoted flag is set on the expression node. +// +// Special case: If op==TK_INTEGER and pToken points to a string that +// can be translated into a 32-bit integer, then the token is not +// stored in u.zToken. Instead, the integer values is written +// into u.iValue and the EP_IntValue flag is set. No extra storage +// is allocated to hold the integer text and the dequote flag is ignored. +func Xsqlite3ExprAlloc(tls *libc.TLS, db uintptr, op int32, pToken uintptr, dequote int32) uintptr { /* sqlite3.c:102041:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pNew uintptr + var nExtra int32 = 0 + *(*int32)(unsafe.Pointer(bp /* iValue */)) = 0 + + if pToken != 0 { + if ((op != TK_INTEGER) || ((*Token)(unsafe.Pointer(pToken)).Fz == uintptr(0))) || + (Xsqlite3GetInt32(tls, (*Token)(unsafe.Pointer(pToken)).Fz, bp /* &iValue */) == 0) { + nExtra = (int32((*Token)(unsafe.Pointer(pToken)).Fn + uint32(1))) + + } + } + pNew = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(Expr{})) + uint64(nExtra)))) + if pNew != 0 { + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(pNew)).Fop = U8(op) + (*Expr)(unsafe.Pointer(pNew)).FiAgg = int16(-1) + if pToken != 0 { + if nExtra == 0 { + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32((EP_IntValue | EP_Leaf) | (func() int32 { + if *(*int32)(unsafe.Pointer(bp /* iValue */)) != 0 { + return EP_IsTrue + } + return EP_IsFalse + }()))) + *(*int32)(unsafe.Pointer(pNew + 8 /* &.u */)) = *(*int32)(unsafe.Pointer(bp /* iValue */)) + } else { + *(*uintptr)(unsafe.Pointer(pNew + 8 /* &.u */)) = (pNew + 1*72) + + if (*Token)(unsafe.Pointer(pToken)).Fn != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(pNew + 8 /* &.u */)), (*Token)(unsafe.Pointer(pToken)).Fz, uint64((*Token)(unsafe.Pointer(pToken)).Fn)) + } + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNew + 8 /* &.u */)) + uintptr((*Token)(unsafe.Pointer(pToken)).Fn))) = int8(0) + if (dequote != 0) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNew + 8 /* &.u */)))))]) & 0x80) != 0) { + Xsqlite3DequoteExpr(tls, pNew) + } + } + } + (*Expr)(unsafe.Pointer(pNew)).FnHeight = 1 + } + return pNew +} + +// Allocate a new expression node from a zero-terminated token that has +// already been dequoted. +func Xsqlite3Expr(tls *libc.TLS, db uintptr, op int32, zToken uintptr) uintptr { /* sqlite3.c:102089:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var x Token at bp, 16 + + (*Token)(unsafe.Pointer(bp /* &x */)).Fz = zToken + (*Token)(unsafe.Pointer(bp /* &x */)).Fn = uint32(Xsqlite3Strlen30(tls, zToken)) + return Xsqlite3ExprAlloc(tls, db, op, bp /* &x */, 0) +} + +// Attach subtrees pLeft and pRight to the Expr node pRoot. +// +// If pRoot==NULL that means that a memory allocation error has occurred. +// In that case, delete the subtrees pLeft and pRight. +func Xsqlite3ExprAttachSubtrees(tls *libc.TLS, db uintptr, pRoot uintptr, pLeft uintptr, pRight uintptr) { /* sqlite3.c:102106:21: */ + if pRoot == uintptr(0) { + + Xsqlite3ExprDelete(tls, db, pLeft) + Xsqlite3ExprDelete(tls, db, pRight) + } else { + if pRight != 0 { + (*Expr)(unsafe.Pointer(pRoot)).FpRight = pRight + *(*U32)(unsafe.Pointer(pRoot + 4 /* &.flags */)) |= ((U32((EP_Collate | EP_Subquery) | EP_HasFunc)) & (*Expr)(unsafe.Pointer(pRight)).Fflags) + } + if pLeft != 0 { + (*Expr)(unsafe.Pointer(pRoot)).FpLeft = pLeft + *(*U32)(unsafe.Pointer(pRoot + 4 /* &.flags */)) |= ((U32((EP_Collate | EP_Subquery) | EP_HasFunc)) & (*Expr)(unsafe.Pointer(pLeft)).Fflags) + } + exprSetHeight(tls, pRoot) + } +} + +// Allocate an Expr node which joins as many as two subtrees. +// +// One or both of the subtrees can be NULL. Return a pointer to the new +// Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed, +// free the subtrees and return NULL. +func Xsqlite3PExpr(tls *libc.TLS, pParse uintptr, op int32, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:102136:21: */ + var p uintptr + p = Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Expr{}))) + if p != 0 { + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(p)).Fop = (U8(op & 0xff)) + (*Expr)(unsafe.Pointer(p)).FiAgg = int16(-1) + Xsqlite3ExprAttachSubtrees(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, p, pLeft, pRight) + Xsqlite3ExprCheckHeight(tls, pParse, (*Expr)(unsafe.Pointer(p)).FnHeight) + } else { + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pLeft) + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pRight) + } + return p +} + +// Add pSelect to the Expr.x.pSelect field. Or, if pExpr is NULL (due +// do a memory allocation failure) then delete the pSelect object. +func Xsqlite3PExprAddSelect(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSelect uintptr) { /* sqlite3.c:102161:21: */ + if pExpr != 0 { + *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) = pSelect + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_xIsSelect | EP_Subquery)) + Xsqlite3ExprSetHeightAndFlags(tls, pParse, pExpr) + } else { + + Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pSelect) + } +} + +// Join two expressions using an AND operator. If either expression is +// NULL, then just return the other expression. +// +// If one side or the other of the AND is known to be false, then instead +// of returning an AND expression, just return a constant expression with +// a value of false. +func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:102181:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if pLeft == uintptr(0) { + return pRight + } else if pRight == uintptr(0) { + return pLeft + } else if ((((*Expr)(unsafe.Pointer((pLeft))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse)) || (((*Expr)(unsafe.Pointer((pRight))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) + Xsqlite3ExprDeferredDelete(tls, pParse, pRight) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6507 /* "0" */) + } else { + return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) + } + return uintptr(0) +} + +// Construct a new expression node for a function with multiple +// arguments. +func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken uintptr, eDistinct int32) uintptr { /* sqlite3.c:102202:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pNew uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + pNew = Xsqlite3ExprAlloc(tls, db, TK_FUNCTION, pToken, 1) + if pNew == uintptr(0) { + Xsqlite3ExprListDelete(tls, db, pList) // Avoid memory leak when malloc fails + return uintptr(0) + } + if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 6*4))) { + Xsqlite3ErrorMsg(tls, pParse, ts+6509 /* "too many argumen..." */, libc.VaList(bp, pToken)) + } + *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) + + Xsqlite3ExprSetHeightAndFlags(tls, pParse, pNew) + if eDistinct == SF_Distinct { + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_Distinct)) + } + return pNew +} + +// Check to see if a function is usable according to current access +// rules: +// +// SQLITE_FUNC_DIRECT - Only usable from top-level SQL +// +// SQLITE_FUNC_UNSAFE - Usable if TRUSTED_SCHEMA or from +// top-level SQL +// +// If the function is not usable, create an error. +func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pDef uintptr) { /* sqlite3.c:102238:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromDDL))) != U32(0) { + if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_DIRECT)) != U32(0)) || + (((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_TrustedSchema)) == uint64(0)) { + // Functions prohibited in triggers and views if: + // (1) tagged with SQLITE_DIRECTONLY + // (2) not tagged with SQLITE_INNOCUOUS (which means it + // is tagged with SQLITE_FUNC_UNSAFE) and + // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning + // that the schema is possibly tainted). + Xsqlite3ErrorMsg(tls, pParse, ts+6543 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + } + } +} + +// Assign a variable number to an expression that encodes a wildcard +// in the original SQL statement. +// +// Wildcards consisting of a single "?" are assigned the next sequential +// variable number. +// +// Wildcards of the form "?nnn" are assigned the number "nnn". We make +// sure "nnn" is not too big to avoid a denial of service attack when +// the SQL statement comes from an external source. +// +// Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number +// as the previous instance of the same wildcard. Or if this is the first +// instance of the wildcard, the next sequential variable number is +// assigned. +func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n U32) { /* sqlite3.c:102277:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var z uintptr + var x YnVar + + if pExpr == uintptr(0) { + return + } + + z = *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + + if int32(*(*int8)(unsafe.Pointer(z + 1))) == 0 { + // Wildcard of the form "?". Assign the next variable number + + x = libc.PreIncInt16(&(*Parse)(unsafe.Pointer(pParse)).FnVar, 1) + } else { + var doAdd int32 = 0 + if int32(*(*int8)(unsafe.Pointer(z))) == '?' { + // Wildcard of the form "?nnn". Convert "nnn" to an integer and + // use it as the variable number + // var i I64 at bp+8, 8 + + var bOk int32 + if n == U32(2) { //OPTIMIZATION-IF-TRUE + *(*I64)(unsafe.Pointer(bp + 8 /* i */)) = (I64(int32(*(*int8)(unsafe.Pointer(z + 1))) - '0')) // The common case of ?N for a single digit N + bOk = 1 + } else { + bOk = (libc.Bool32(0 == Xsqlite3Atoi64(tls, (z+1), bp+8 /* &i */, (int32(n-U32(1))), uint8(SQLITE_UTF8)))) + } + + if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { + Xsqlite3ErrorMsg(tls, pParse, ts+6562, /* "variable number ..." */ + libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) + return + } + x = YnVar(*(*I64)(unsafe.Pointer(bp + 8 /* i */))) + if int32(x) > int32((*Parse)(unsafe.Pointer(pParse)).FnVar) { + (*Parse)(unsafe.Pointer(pParse)).FnVar = YnVar(int32(x)) + doAdd = 1 + } else if Xsqlite3VListNumToName(tls, (*Parse)(unsafe.Pointer(pParse)).FpVList, int32(x)) == uintptr(0) { + doAdd = 1 + } + } else { + // Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable + // number as the prior appearance of the same name, or if the name + // has never appeared before, reuse the same variable number + x = YnVar(Xsqlite3VListNameToNum(tls, (*Parse)(unsafe.Pointer(pParse)).FpVList, z, int32(n))) + if int32(x) == 0 { + x = libc.PreIncInt16(&(*Parse)(unsafe.Pointer(pParse)).FnVar, 1) + doAdd = 1 + } + } + if doAdd != 0 { + (*Parse)(unsafe.Pointer(pParse)).FpVList = Xsqlite3VListAdd(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpVList, z, int32(n), int32(x)) + } + } + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x + if int32(x) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)) { + Xsqlite3ErrorMsg(tls, pParse, ts+6605 /* "too many SQL var..." */, 0) + } +} + +// Recursively delete an expression tree. +func sqlite3ExprDeleteNN(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:102345:29: */ + + // Sanity check: Assert that the IntValue is non-negative if it exists + + if !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_TokenOnly | EP_Leaf))) != U32(0)) { + // The Expr.x union is never used at the same time as Expr.pRight + + if ((*Expr)(unsafe.Pointer(p)).FpLeft != 0) && (int32((*Expr)(unsafe.Pointer(p)).Fop) != TK_SELECT_COLUMN) { + sqlite3ExprDeleteNN(tls, db, (*Expr)(unsafe.Pointer(p)).FpLeft) + } + if (*Expr)(unsafe.Pointer(p)).FpRight != 0 { + + sqlite3ExprDeleteNN(tls, db, (*Expr)(unsafe.Pointer(p)).FpRight) + } else if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + + Xsqlite3SelectDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */))) + } else { + Xsqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */))) + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_WinFunc))) != U32(0) { + Xsqlite3WindowDelete(tls, db, *(*uintptr)(unsafe.Pointer(p + 64 /* &.y */))) + } + } + } + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_MemToken))) != U32(0) { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))) + } + if !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_Static))) != U32(0)) { + Xsqlite3DbFreeNN(tls, db, p) + } +} + +func Xsqlite3ExprDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:102384:21: */ + if p != 0 { + sqlite3ExprDeleteNN(tls, db, p) + } +} + +// Arrange to cause pExpr to be deleted when the pParse is deleted. +// This is similar to sqlite3ExprDelete() except that the delete is +// deferred untilthe pParse is deleted. +// +// The pExpr might be deleted immediately on an OOM error. +// +// The deferred delete is (currently) implemented by adding the +// pExpr to the pParse->pConstExpr list with a register number of 0. +func Xsqlite3ExprDeferredDelete(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* sqlite3.c:102399:21: */ + (*Parse)(unsafe.Pointer(pParse)).FpConstExpr = Xsqlite3ExprListAppend(tls, pParse, (*Parse)(unsafe.Pointer(pParse)).FpConstExpr, pExpr) +} + +// Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the +// expression. +func Xsqlite3ExprUnmapAndDelete(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:102407:21: */ + if p != 0 { + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameExprUnmap(tls, pParse, p) + } + sqlite3ExprDeleteNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, p) + } +} + +// Return the number of bytes allocated for the expression structure +// passed as the first argument. This is always one of EXPR_FULLSIZE, +// EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. +func exprStructSize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:102421:12: */ + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_TokenOnly))) != U32(0) { + return int32((uintptr(0) + 16 /* &.pLeft */)) + } + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_Reduced))) != U32(0) { + return int32((uintptr(0) + 44 /* &.iTable */)) + } + return int32(unsafe.Sizeof(Expr{})) +} + +// The dupedExpr*Size() routines each return the number of bytes required +// to store a copy of an expression or expression tree. They differ in +// how much of the tree is measured. +// +// dupedExprStructSize() Size of only the Expr structure +// dupedExprNodeSize() Size of Expr + space for token +// dupedExprSize() Expr + token + subtree components +// +// +// +// The dupedExprStructSize() function returns two values OR-ed together: +// (1) the space required for a copy of the Expr structure only and +// (2) the EP_xxx flags that indicate what the structure size should be. +// The return values is always one of: +// +// EXPR_FULLSIZE +// EXPR_REDUCEDSIZE | EP_Reduced +// EXPR_TOKENONLYSIZE | EP_TokenOnly +// +// The size of the structure can be found by masking the return value +// of this routine with 0xfff. The flags can be found by masking the +// return value with EP_Reduced|EP_TokenOnly. +// +// Note that with flags==EXPRDUP_REDUCE, this routines works on full-size +// (unreduced) Expr objects as they or originally constructed by the parser. +// During expression analysis, extra information is computed and moved into +// later parts of the Expr object and that extra information might get chopped +// off if the expression is reduced. Note also that it does not work to +// make an EXPRDUP_REDUCE copy of a reduced expression. It is only legal +// to reduce a pristine expression tree from the parser. The implementation +// of dupedExprStructSize() contain multiple assert() statements that attempt +// to enforce this constraint. +func dupedExprStructSize(tls *libc.TLS, p uintptr, flags int32) int32 { /* sqlite3.c:102461:12: */ + var nSize int32 + // Only one flag value allowed + + if ((0 == flags) || (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_SELECT_COLUMN)) || + (((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + nSize = int32(unsafe.Sizeof(Expr{})) + } else { + + if ((*Expr)(unsafe.Pointer(p)).FpLeft != 0) || (*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) != 0) { + nSize = (int32((uint64((uintptr(0) + 44 /* &.iTable */))) | uint64(EP_Reduced))) + } else { + + nSize = (int32((uint64((uintptr(0) + 16 /* &.pLeft */))) | uint64(EP_TokenOnly))) + } + } + return nSize +} + +// This function returns the space in bytes required to store the copy +// of the Expr structure and a copy of the Expr.u.zToken string (if that +// string is defined.) +func dupedExprNodeSize(tls *libc.TLS, p uintptr, flags int32) int32 { /* sqlite3.c:102492:12: */ + var nByte int32 = (dupedExprStructSize(tls, p, flags) & 0xfff) + if !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_IntValue))) != U32(0)) && (*(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) != 0) { + nByte = int32(Size_t(nByte) + ((libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))) & uint64(0x3fffffff)) + uint64(1))) + } + return (((nByte) + 7) & libc.CplInt32(7)) +} + +// Return the number of bytes required to create a duplicate of the +// expression passed as the first argument. The second argument is a +// mask containing EXPRDUP_XXX flags. +// +// The value returned includes space to create a copy of the Expr struct +// itself and the buffer referred to by Expr.u.zToken, if any. +// +// If the EXPRDUP_REDUCE flag is set, then the return value includes +// space to duplicate all Expr nodes in the tree formed by Expr.pLeft +// and Expr.pRight variables (but not for any structures pointed to or +// descended from the Expr.x.pList or Expr.x.pSelect variables). +func dupedExprSize(tls *libc.TLS, p uintptr, flags int32) int32 { /* sqlite3.c:102513:12: */ + var nByte int32 = 0 + if p != 0 { + nByte = dupedExprNodeSize(tls, p, flags) + if (flags & EXPRDUP_REDUCE) != 0 { + nByte = nByte + (dupedExprSize(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, flags) + dupedExprSize(tls, (*Expr)(unsafe.Pointer(p)).FpRight, flags)) + } + } + return nByte +} + +// This function is similar to sqlite3ExprDup(), except that if pzBuffer +// is not NULL then *pzBuffer is assumed to point to a buffer large enough +// to store the copy of expression p, the copies of p->u.zToken +// (if applicable), and the copies of the p->pLeft and p->pRight expressions, +// if any. Before returning, *pzBuffer is set to the first byte past the +// portion of the buffer copied into by this function. +func exprDup(tls *libc.TLS, db uintptr, p uintptr, dupFlags int32, pzBuffer uintptr) uintptr { /* sqlite3.c:102532:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pNew uintptr // Value to return + // var zAlloc uintptr at bp, 8 + // Memory space from which to build Expr object + var staticFlag U32 // EP_Static if space not obtained from malloc + + // Figure out where to write the new Expr structure. + if pzBuffer != 0 { + *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) = *(*uintptr)(unsafe.Pointer(pzBuffer)) + staticFlag = U32(EP_Static) + + } else { + *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) = Xsqlite3DbMallocRawNN(tls, db, uint64(dupedExprSize(tls, p, dupFlags))) + staticFlag = U32(0) + } + pNew = *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) + + if pNew != 0 { + // Set nNewSize to the size allocated for the structure pointed to + // by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or + // EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed + // by the copy of the p->u.zToken string (if any). + var nStructSize uint32 = uint32(dupedExprStructSize(tls, p, dupFlags)) + var nNewSize int32 = (int32(nStructSize & uint32(0xfff))) + var nToken int32 + if !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_IntValue))) != U32(0)) && (*(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) != 0) { + nToken = (Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */))) + 1) + } else { + nToken = 0 + } + if dupFlags != 0 { + + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)), p, uint64(nNewSize)) + } else { + var nSize U32 = U32(exprStructSize(tls, p)) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)), p, uint64(nSize)) + if (uint64(nSize) < uint64(unsafe.Sizeof(Expr{}))) { + libc.Xmemset(tls, (*(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) + uintptr(nSize)), 0, (uint64(unsafe.Sizeof(Expr{})) - uint64(nSize))) + } + } + + // Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32((((EP_Reduced | EP_TokenOnly) | EP_Static) | EP_MemToken)))) + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (nStructSize & (uint32(EP_Reduced | EP_TokenOnly))) + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (staticFlag) + + if dupFlags != 0 { + + } + + // Copy the p->u.zToken string, if any. + if nToken != 0 { + var zToken uintptr = libc.AssignPtrUintptr(pNew+8 /* &.u */ /* &.zToken */, (*(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) + uintptr(nNewSize))) + libc.Xmemcpy(tls, zToken, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)), uint64(nToken)) + } + + if U32(0) == (((*Expr)(unsafe.Pointer(p)).Fflags | (*Expr)(unsafe.Pointer(pNew)).Fflags) & (U32(EP_TokenOnly | EP_Leaf))) { + // Fill in the pNew->x.pSelect or pNew->x.pList member. + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = Xsqlite3SelectDup(tls, db, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)), dupFlags) + } else { + *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = Xsqlite3ExprListDup(tls, db, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)), dupFlags) + } + } + + // Fill in pNew->pLeft and pNew->pRight. + if ((*Expr)(unsafe.Pointer((pNew))).Fflags & (U32((EP_Reduced | EP_TokenOnly) | EP_WinFunc))) != U32(0) { + *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) += uintptr(dupedExprNodeSize(tls, p, dupFlags)) + if !(((*Expr)(unsafe.Pointer((pNew))).Fflags & (U32(EP_TokenOnly | EP_Leaf))) != U32(0)) { + (*Expr)(unsafe.Pointer(pNew)).FpLeft = func() uintptr { + if (*Expr)(unsafe.Pointer(p)).FpLeft != 0 { + return exprDup(tls, db, (*Expr)(unsafe.Pointer(p)).FpLeft, EXPRDUP_REDUCE, bp /* &zAlloc */) + } + return uintptr(0) + }() + (*Expr)(unsafe.Pointer(pNew)).FpRight = func() uintptr { + if (*Expr)(unsafe.Pointer(p)).FpRight != 0 { + return exprDup(tls, db, (*Expr)(unsafe.Pointer(p)).FpRight, EXPRDUP_REDUCE, bp /* &zAlloc */) + } + return uintptr(0) + }() + } + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_WinFunc))) != U32(0) { + *(*uintptr)(unsafe.Pointer(pNew + 64 /* &.y */)) = Xsqlite3WindowDup(tls, db, pNew, *(*uintptr)(unsafe.Pointer(p + 64 /* &.y */))) + + } + if pzBuffer != 0 { + *(*uintptr)(unsafe.Pointer(pzBuffer)) = *(*uintptr)(unsafe.Pointer(bp /* zAlloc */)) + } + } else { + if !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_TokenOnly | EP_Leaf))) != U32(0)) { + if int32((*Expr)(unsafe.Pointer(pNew)).Fop) == TK_SELECT_COLUMN { + (*Expr)(unsafe.Pointer(pNew)).FpLeft = (*Expr)(unsafe.Pointer(p)).FpLeft + + } else { + (*Expr)(unsafe.Pointer(pNew)).FpLeft = Xsqlite3ExprDup(tls, db, (*Expr)(unsafe.Pointer(p)).FpLeft, 0) + } + (*Expr)(unsafe.Pointer(pNew)).FpRight = Xsqlite3ExprDup(tls, db, (*Expr)(unsafe.Pointer(p)).FpRight, 0) + } + } + } + return pNew +} + +// Create and return a deep copy of the object passed as the second +// argument. If an OOM condition is encountered, NULL is returned +// and the db->mallocFailed flag set. +func Xsqlite3WithDup(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:102643:21: */ + var pRet uintptr = uintptr(0) + if p != 0 { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(With{})) + (uint64(unsafe.Sizeof(Cte{})) * (uint64((*With)(unsafe.Pointer(p)).FnCte - 1))))) + pRet = Xsqlite3DbMallocZero(tls, db, uint64(nByte)) + if pRet != 0 { + var i int32 + (*With)(unsafe.Pointer(pRet)).FnCte = (*With)(unsafe.Pointer(p)).FnCte + for i = 0; i < (*With)(unsafe.Pointer(p)).FnCte; i++ { + (*Cte)(unsafe.Pointer((pRet + 16 /* &.a */) + uintptr(i)*48)).FpSelect = Xsqlite3SelectDup(tls, db, (*Cte)(unsafe.Pointer((p+16 /* &.a */)+uintptr(i)*48)).FpSelect, 0) + (*Cte)(unsafe.Pointer((pRet + 16 /* &.a */) + uintptr(i)*48)).FpCols = Xsqlite3ExprListDup(tls, db, (*Cte)(unsafe.Pointer((p+16 /* &.a */)+uintptr(i)*48)).FpCols, 0) + (*Cte)(unsafe.Pointer((pRet + 16 /* &.a */) + uintptr(i)*48)).FzName = Xsqlite3DbStrDup(tls, db, (*Cte)(unsafe.Pointer((p+16 /* &.a */)+uintptr(i)*48)).FzName) + } + } + } + return pRet +} + +// The gatherSelectWindows() procedure and its helper routine +// gatherSelectWindowsCallback() are used to scan all the expressions +// an a newly duplicated SELECT statement and gather all of the Window +// objects found there, assembling them onto the linked list at Select->pWin. +func gatherSelectWindowsCallback(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:102671:12: */ + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_FUNCTION) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var pWin uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + + Xsqlite3WindowLink(tls, pSelect, pWin) + } + return WRC_Continue +} + +func gatherSelectWindowsSelectCallback(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:102682:12: */ + if p == *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) { + return WRC_Continue + } + return WRC_Prune +} + +func gatherSelectWindows(tls *libc.TLS, p uintptr) { /* sqlite3.c:102685:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{gatherSelectWindowsCallback})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{gatherSelectWindowsSelectCallback})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = uintptr(0) + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = p + Xsqlite3WalkSelect(tls, bp /* &w */, p) +} + +// The following group of routines make deep copies of expressions, +// expression lists, ID lists, and select statements. The copies can +// be deleted (by being passed to their respective ...Delete() routines) +// without effecting the originals. +// +// The expression list, ID, and source lists return by sqlite3ExprListDup(), +// sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded +// by subsequent calls to sqlite*ListAppend() routines. +// +// Any tables that the SrcList might point to are not duplicated. +// +// The flags parameter contains a combination of the EXPRDUP_XXX flags. +// If the EXPRDUP_REDUCE flag is set, then the structure returned is a +// truncated version of the usual Expr structure that will be stored as +// part of the in-memory representation of the database schema. +func Xsqlite3ExprDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) uintptr { /* sqlite3.c:102714:21: */ + + if p != 0 { + return exprDup(tls, db, p, flags, uintptr(0)) + } + return uintptr(0) +} + +func Xsqlite3ExprListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) uintptr { /* sqlite3.c:102718:25: */ + var pNew uintptr + var pItem uintptr + var pOldItem uintptr + var i int32 + var pPriorSelectCol uintptr = uintptr(0) + + if p == uintptr(0) { + return uintptr(0) + } + pNew = Xsqlite3DbMallocRawNN(tls, db, uint64(Xsqlite3DbMallocSize(tls, db, p))) + if pNew == uintptr(0) { + return uintptr(0) + } + (*ExprList)(unsafe.Pointer(pNew)).FnExpr = (*ExprList)(unsafe.Pointer(p)).FnExpr + (*ExprList)(unsafe.Pointer(pNew)).FnAlloc = (*ExprList)(unsafe.Pointer(p)).FnAlloc + pItem = pNew + 8 /* &.a */ + pOldItem = p + 8 /* &.a */ + i = 0 +__1: + if !(i < (*ExprList)(unsafe.Pointer(p)).FnExpr) { + goto __3 + } + { + var pOldExpr uintptr = (*ExprList_item)(unsafe.Pointer(pOldItem)).FpExpr + var pNewExpr uintptr + (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr = Xsqlite3ExprDup(tls, db, pOldExpr, flags) + if ((pOldExpr != 0) && + (int32((*Expr)(unsafe.Pointer(pOldExpr)).Fop) == TK_SELECT_COLUMN)) && + ((libc.AssignUintptr(&pNewExpr, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr)) != uintptr(0)) { + + if int32((*Expr)(unsafe.Pointer(pNewExpr)).FiColumn) == 0 { + + pPriorSelectCol = libc.AssignPtrUintptr(pNewExpr+16 /* &.pLeft */, (*Expr)(unsafe.Pointer(pNewExpr)).FpRight) + } else { + + (*Expr)(unsafe.Pointer(pNewExpr)).FpLeft = pPriorSelectCol + } + } + (*ExprList_item)(unsafe.Pointer(pItem)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(pOldItem)).FzEName) + (*ExprList_item)(unsafe.Pointer(pItem)).FsortFlags = (*ExprList_item)(unsafe.Pointer(pOldItem)).FsortFlags + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.eEName */, (uint32(int32(*(*uint8)(unsafe.Pointer(pOldItem + 20 /* &.eEName */)) & 0x3 >> 0))), 0, 0x3) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.done */, uint32(0), 2, 0x4) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.bNulls */, (uint32(int32(*(*uint8)(unsafe.Pointer(pOldItem + 20 /* &.bNulls */)) & 0x20 >> 5))), 5, 0x20) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.bSorterRef */, (uint32(int32(*(*uint8)(unsafe.Pointer(pOldItem + 20 /* &.bSorterRef */)) & 0x10 >> 4))), 4, 0x10) + (*ExprList_item)(unsafe.Pointer(pItem)).Fu = (*ExprList_item)(unsafe.Pointer(pOldItem)).Fu + + } + goto __2 +__2: + i++ + pItem += 32 + pOldItem += 32 + goto __1 + goto __3 +__3: + ; + return pNew +} + +// If cursors, triggers, views and subqueries are all omitted from +// the build, then none of the following routines, except for +// sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes +// called with a NULL argument. +func Xsqlite3SrcListDup(tls *libc.TLS, db uintptr, p uintptr, flags int32) uintptr { /* sqlite3.c:102771:24: */ + var pNew uintptr + var i int32 + var nByte int32 + + if p == uintptr(0) { + return uintptr(0) + } + nByte = (int32(uint64(unsafe.Sizeof(SrcList{})) + (func() uint64 { + if (*SrcList)(unsafe.Pointer(p)).FnSrc > 0 { + return (uint64(unsafe.Sizeof(SrcItem{})) * (uint64((*SrcList)(unsafe.Pointer(p)).FnSrc - 1))) + } + return uint64(0) + }()))) + pNew = Xsqlite3DbMallocRawNN(tls, db, uint64(nByte)) + if pNew == uintptr(0) { + return uintptr(0) + } + (*SrcList)(unsafe.Pointer(pNew)).FnSrc = int32(libc.AssignPtrUint32(pNew+4 /* &.nAlloc */, U32((*SrcList)(unsafe.Pointer(p)).FnSrc))) + for i = 0; i < (*SrcList)(unsafe.Pointer(p)).FnSrc; i++ { + var pNewItem uintptr = ((pNew + 8 /* &.a */) + uintptr(i)*112) + var pOldItem uintptr = ((p + 8 /* &.a */) + uintptr(i)*112) + var pTab uintptr + (*SrcItem)(unsafe.Pointer(pNewItem)).FpSchema = (*SrcItem)(unsafe.Pointer(pOldItem)).FpSchema + (*SrcItem)(unsafe.Pointer(pNewItem)).FzDatabase = Xsqlite3DbStrDup(tls, db, (*SrcItem)(unsafe.Pointer(pOldItem)).FzDatabase) + (*SrcItem)(unsafe.Pointer(pNewItem)).FzName = Xsqlite3DbStrDup(tls, db, (*SrcItem)(unsafe.Pointer(pOldItem)).FzName) + (*SrcItem)(unsafe.Pointer(pNewItem)).FzAlias = Xsqlite3DbStrDup(tls, db, (*SrcItem)(unsafe.Pointer(pOldItem)).FzAlias) + (*SrcItem)(unsafe.Pointer(pNewItem)).Ffg = (*SrcItem)(unsafe.Pointer(pOldItem)).Ffg + (*SrcItem)(unsafe.Pointer(pNewItem)).FiCursor = (*SrcItem)(unsafe.Pointer(pOldItem)).FiCursor + (*SrcItem)(unsafe.Pointer(pNewItem)).FaddrFillSub = (*SrcItem)(unsafe.Pointer(pOldItem)).FaddrFillSub + (*SrcItem)(unsafe.Pointer(pNewItem)).FregReturn = (*SrcItem)(unsafe.Pointer(pOldItem)).FregReturn + if (uint32(int32(*(*uint16)(unsafe.Pointer(pNewItem + 60 /* &.fg */ + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0 { + *(*uintptr)(unsafe.Pointer(pNewItem + 96 /* &.u1 */)) = Xsqlite3DbStrDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 96 /* &.u1 */))) + } + (*SrcItem)(unsafe.Pointer(pNewItem)).Fu2 = (*SrcItem)(unsafe.Pointer(pOldItem)).Fu2 + if (uint32(int32(*(*uint16)(unsafe.Pointer(pNewItem + 60 /* &.fg */ + 4 /* &.isCte */)) & 0x80 >> 7))) != 0 { + (*CteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNewItem + 104 /* &.u2 */)))).FnUse++ + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pNewItem + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { + *(*uintptr)(unsafe.Pointer(pNewItem + 96 /* &.u1 */)) = Xsqlite3ExprListDup(tls, db, *(*uintptr)(unsafe.Pointer(pOldItem + 96 /* &.u1 */)), flags) + } + pTab = libc.AssignPtrUintptr(pNewItem+32 /* &.pTab */, (*SrcItem)(unsafe.Pointer(pOldItem)).FpTab) + if pTab != 0 { + (*Table)(unsafe.Pointer(pTab)).FnTabRef++ + } + (*SrcItem)(unsafe.Pointer(pNewItem)).FpSelect = Xsqlite3SelectDup(tls, db, (*SrcItem)(unsafe.Pointer(pOldItem)).FpSelect, flags) + (*SrcItem)(unsafe.Pointer(pNewItem)).FpOn = Xsqlite3ExprDup(tls, db, (*SrcItem)(unsafe.Pointer(pOldItem)).FpOn, flags) + (*SrcItem)(unsafe.Pointer(pNewItem)).FpUsing = Xsqlite3IdListDup(tls, db, (*SrcItem)(unsafe.Pointer(pOldItem)).FpUsing) + (*SrcItem)(unsafe.Pointer(pNewItem)).FcolUsed = (*SrcItem)(unsafe.Pointer(pOldItem)).FcolUsed + } + return pNew +} + +func Xsqlite3IdListDup(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:102815:23: */ + var pNew uintptr + var i int32 + + if p == uintptr(0) { + return uintptr(0) + } + pNew = Xsqlite3DbMallocRawNN(tls, db, uint64(unsafe.Sizeof(IdList{}))) + if pNew == uintptr(0) { + return uintptr(0) + } + (*IdList)(unsafe.Pointer(pNew)).FnId = (*IdList)(unsafe.Pointer(p)).FnId + (*IdList)(unsafe.Pointer(pNew)).Fa = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64((*IdList)(unsafe.Pointer(p)).FnId) * uint64(unsafe.Sizeof(IdList_item{}))))) + if (*IdList)(unsafe.Pointer(pNew)).Fa == uintptr(0) { + Xsqlite3DbFreeNN(tls, db, pNew) + return uintptr(0) + } + // Note that because the size of the allocation for p->a[] is not + // necessarily a power of two, sqlite3IdListAppend() may not be called + // on the duplicate created by this function. + for i = 0; i < (*IdList)(unsafe.Pointer(p)).FnId; i++ { + var pNewItem uintptr = ((*IdList)(unsafe.Pointer(pNew)).Fa + uintptr(i)*16) + var pOldItem uintptr = ((*IdList)(unsafe.Pointer(p)).Fa + uintptr(i)*16) + (*IdList_item)(unsafe.Pointer(pNewItem)).FzName = Xsqlite3DbStrDup(tls, db, (*IdList_item)(unsafe.Pointer(pOldItem)).FzName) + (*IdList_item)(unsafe.Pointer(pNewItem)).Fidx = (*IdList_item)(unsafe.Pointer(pOldItem)).Fidx + } + return pNew +} + +func Xsqlite3SelectDup(tls *libc.TLS, db uintptr, pDup uintptr, flags int32) uintptr { /* sqlite3.c:102839:23: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pRet */)) = uintptr(0) + var pNext uintptr = uintptr(0) + var pp uintptr = bp /* &pRet */ + var p uintptr + + for p = pDup; p != 0; p = (*Select)(unsafe.Pointer(p)).FpPrior { + var pNew uintptr = Xsqlite3DbMallocRawNN(tls, db, uint64(unsafe.Sizeof(Select{}))) + if pNew == uintptr(0) { + break + } + (*Select)(unsafe.Pointer(pNew)).FpEList = Xsqlite3ExprListDup(tls, db, (*Select)(unsafe.Pointer(p)).FpEList, flags) + (*Select)(unsafe.Pointer(pNew)).FpSrc = Xsqlite3SrcListDup(tls, db, (*Select)(unsafe.Pointer(p)).FpSrc, flags) + (*Select)(unsafe.Pointer(pNew)).FpWhere = Xsqlite3ExprDup(tls, db, (*Select)(unsafe.Pointer(p)).FpWhere, flags) + (*Select)(unsafe.Pointer(pNew)).FpGroupBy = Xsqlite3ExprListDup(tls, db, (*Select)(unsafe.Pointer(p)).FpGroupBy, flags) + (*Select)(unsafe.Pointer(pNew)).FpHaving = Xsqlite3ExprDup(tls, db, (*Select)(unsafe.Pointer(p)).FpHaving, flags) + (*Select)(unsafe.Pointer(pNew)).FpOrderBy = Xsqlite3ExprListDup(tls, db, (*Select)(unsafe.Pointer(p)).FpOrderBy, flags) + (*Select)(unsafe.Pointer(pNew)).Fop = (*Select)(unsafe.Pointer(p)).Fop + (*Select)(unsafe.Pointer(pNew)).FpNext = pNext + (*Select)(unsafe.Pointer(pNew)).FpPrior = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpLimit = Xsqlite3ExprDup(tls, db, (*Select)(unsafe.Pointer(p)).FpLimit, flags) + (*Select)(unsafe.Pointer(pNew)).FiLimit = 0 + (*Select)(unsafe.Pointer(pNew)).FiOffset = 0 + (*Select)(unsafe.Pointer(pNew)).FselFlags = ((*Select)(unsafe.Pointer(p)).FselFlags & libc.Uint32FromInt32(libc.CplInt32(SF_UsesEphemeral))) + *(*int32)(unsafe.Pointer((pNew + 20 /* &.addrOpenEphm */))) = -1 + *(*int32)(unsafe.Pointer((pNew + 20 /* &.addrOpenEphm */) + 1*4)) = -1 + (*Select)(unsafe.Pointer(pNew)).FnSelectRow = (*Select)(unsafe.Pointer(p)).FnSelectRow + (*Select)(unsafe.Pointer(pNew)).FpWith = Xsqlite3WithDup(tls, db, (*Select)(unsafe.Pointer(p)).FpWith) + (*Select)(unsafe.Pointer(pNew)).FpWin = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpWinDefn = Xsqlite3WindowListDup(tls, db, (*Select)(unsafe.Pointer(p)).FpWinDefn) + if ((*Select)(unsafe.Pointer(p)).FpWin != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) { + gatherSelectWindows(tls, pNew) + } + (*Select)(unsafe.Pointer(pNew)).FselId = (*Select)(unsafe.Pointer(p)).FselId + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + // Any prior OOM might have left the Select object incomplete. + // Delete the whole thing rather than allow an incomplete Select + // to be used by the code generator. + (*Select)(unsafe.Pointer(pNew)).FpNext = uintptr(0) + Xsqlite3SelectDelete(tls, db, pNew) + break + } + *(*uintptr)(unsafe.Pointer(pp)) = pNew + pp = (pNew + 80 /* &.pPrior */) + pNext = pNew + } + + return *(*uintptr)(unsafe.Pointer(bp /* pRet */)) +} + +// Add a new element to the end of an expression list. If pList is +// initially NULL, then create a new expression list. +// +// The pList argument must be either NULL or a pointer to an ExprList +// obtained from a prior call to sqlite3ExprListAppend(). This routine +// may not be used with an ExprList obtained from sqlite3ExprListDup(). +// Reason: This routine assumes that the number of slots in pList->a[] +// is a power of two. That is true for sqlite3ExprListAppend() returns +// but is not necessarily true from the return value of sqlite3ExprListDup(). +// +// If a memory allocation error occurs, the entire list is freed and +// NULL is returned. If non-NULL is returned, then it is guaranteed +// that the new entry was successfully appended. +var zeroItem = ExprList_item{} /* sqlite3.c:102910:35 */ + +func Xsqlite3ExprListAppendNew(tls *libc.TLS, db uintptr, pExpr uintptr) uintptr { /* sqlite3.c:102911:41: */ + var pItem uintptr + var pList uintptr + + pList = Xsqlite3DbMallocRawNN(tls, db, (uint64(unsafe.Sizeof(ExprList{})) + (uint64(unsafe.Sizeof(ExprList_item{})) * uint64(4)))) + if pList == uintptr(0) { + Xsqlite3ExprDelete(tls, db, pExpr) + return uintptr(0) + } + (*ExprList)(unsafe.Pointer(pList)).FnAlloc = 4 + (*ExprList)(unsafe.Pointer(pList)).FnExpr = 1 + pItem = (pList + 8 /* &.a */) + *(*ExprList_item)(unsafe.Pointer(pItem)) = zeroItem + (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr = pExpr + return pList +} + +func Xsqlite3ExprListAppendGrow(tls *libc.TLS, db uintptr, pList uintptr, pExpr uintptr) uintptr { /* sqlite3.c:102930:41: */ + var pItem uintptr + var pNew uintptr + *(*int32)(unsafe.Pointer(pList + 4 /* &.nAlloc */)) *= (2) + pNew = Xsqlite3DbRealloc(tls, db, pList, + (uint64(uint64(unsafe.Sizeof(ExprList{})) + ((uint64((*ExprList)(unsafe.Pointer(pList)).FnAlloc - 1)) * uint64(unsafe.Sizeof(ExprList_item{})))))) + if pNew == uintptr(0) { + Xsqlite3ExprListDelete(tls, db, pList) + Xsqlite3ExprDelete(tls, db, pExpr) + return uintptr(0) + } else { + pList = pNew + } + pItem = ((pList + 8 /* &.a */) + uintptr(libc.PostIncInt32(&(*ExprList)(unsafe.Pointer(pList)).FnExpr, 1))*32) + *(*ExprList_item)(unsafe.Pointer(pItem)) = zeroItem + (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr = pExpr + return pList +} + +func Xsqlite3ExprListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pExpr uintptr) uintptr { /* sqlite3.c:102952:25: */ + var pItem uintptr + if pList == uintptr(0) { + return Xsqlite3ExprListAppendNew(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) + } + if (*ExprList)(unsafe.Pointer(pList)).FnAlloc < ((*ExprList)(unsafe.Pointer(pList)).FnExpr + 1) { + return Xsqlite3ExprListAppendGrow(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pList, pExpr) + } + pItem = ((pList + 8 /* &.a */) + uintptr(libc.PostIncInt32(&(*ExprList)(unsafe.Pointer(pList)).FnExpr, 1))*32) + *(*ExprList_item)(unsafe.Pointer(pItem)) = zeroItem + (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr = pExpr + return pList +} + +// pColumns and pExpr form a vector assignment which is part of the SET +// clause of an UPDATE statement. Like this: +// +// (a,b,c) = (expr1,expr2,expr3) +// Or: (a,b,c) = (SELECT x,y,z FROM ....) +// +// For each term of the vector assignment, append new entries to the +// expression list pList. In the case of a subquery on the RHS, append +// TK_SELECT_COLUMN expressions. +func Xsqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, pColumns uintptr, pExpr uintptr) uintptr { /* sqlite3.c:102981:25: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var db uintptr + var n int32 + var i int32 + var iFirst int32 + var pSubExpr uintptr + var pFirst uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if pList != 0 { + iFirst = (*ExprList)(unsafe.Pointer(pList)).FnExpr + } else { + iFirst = 0 + } + // pColumns can only be NULL due to an OOM but an OOM will cause an + // exit prior to this routine being invoked + if !(pColumns == uintptr(0)) { + goto __1 + } + goto vector_append_error +__1: + ; + if !(pExpr == uintptr(0)) { + goto __2 + } + goto vector_append_error +__2: + ; + + // If the RHS is a vector, then we can immediately check to see that + // the size of the RHS and LHS match. But if the RHS is a SELECT, + // wildcards ("*") in the result set of the SELECT must be expanded before + // we can do the size check, so defer the size check until code generation. + if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { + goto __3 + } + Xsqlite3ErrorMsg(tls, pParse, ts+6628, /* "%d columns assig..." */ + libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) + goto vector_append_error +__3: + ; + + i = 0 +__4: + if !(i < (*IdList)(unsafe.Pointer(pColumns)).FnId) { + goto __6 + } + pSubExpr = Xsqlite3ExprForVectorField(tls, pParse, pExpr, i) + + if !(pSubExpr == uintptr(0)) { + goto __7 + } + goto __5 +__7: + ; + (*Expr)(unsafe.Pointer(pSubExpr)).FiTable = (*IdList)(unsafe.Pointer(pColumns)).FnId + pList = Xsqlite3ExprListAppend(tls, pParse, pList, pSubExpr) + if !(pList != 0) { + goto __8 + } + + (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pList)).FnExpr-1))*32)).FzEName = (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumns)).Fa + uintptr(i)*16)).FzName + (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumns)).Fa + uintptr(i)*16)).FzName = uintptr(0) +__8: + ; + goto __5 +__5: + i++ + goto __4 + goto __6 +__6: + ; + + if !((!(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) && (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT)) && (pList != uintptr(0))) { + goto __9 + } + pFirst = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(iFirst)*32)).FpExpr + + // Store the SELECT statement in pRight so it will be deleted when + // sqlite3ExprListDelete() is called + (*Expr)(unsafe.Pointer(pFirst)).FpRight = pExpr + pExpr = uintptr(0) + + // Remember the size of the LHS in iTable so that we can check that + // the RHS and LHS sizes match during code generation. + (*Expr)(unsafe.Pointer(pFirst)).FiTable = (*IdList)(unsafe.Pointer(pColumns)).FnId +__9: + ; + +vector_append_error: + Xsqlite3ExprUnmapAndDelete(tls, pParse, pExpr) + Xsqlite3IdListDelete(tls, db, pColumns) + return pList +} + +// Set the sort order for the last element on the given ExprList. +func Xsqlite3ExprListSetSortOrder(tls *libc.TLS, p uintptr, iSortOrder int32, eNulls int32) { /* sqlite3.c:103045:21: */ + var pItem uintptr + if p == uintptr(0) { + return + } + + pItem = ((p + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(p)).FnExpr-1))*32) + + if iSortOrder == -1 { + iSortOrder = SQLITE_SO_ASC + } + (*ExprList_item)(unsafe.Pointer(pItem)).FsortFlags = U8(iSortOrder) + + if eNulls != -1 { + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.bNulls */, uint32(1), 5, 0x20) + if iSortOrder != eNulls { + *(*U8)(unsafe.Pointer(pItem + 16 /* &.sortFlags */)) |= U8((KEYINFO_ORDER_BIGNULL)) + } + } +} + +// Set the ExprList.a[].zEName element of the most recently added item +// on the expression list. +// +// pList might be NULL following an OOM error. But pName should never be +// NULL. If a memory allocation fails, the pParse->db->mallocFailed flag +// is set. +func Xsqlite3ExprListSetName(tls *libc.TLS, pParse uintptr, pList uintptr, pName uintptr, dequote int32) { /* sqlite3.c:103083:21: */ + + if pList != 0 { + var pItem uintptr + + pItem = ((pList + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pList)).FnExpr-1))*32) + + (*ExprList_item)(unsafe.Pointer(pItem)).FzEName = Xsqlite3DbStrNDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Token)(unsafe.Pointer(pName)).Fz, uint64((*Token)(unsafe.Pointer(pName)).Fn)) + if dequote != 0 { + // If dequote==0, then pName->z does not point to part of a DDL + // statement handled by the parser. And so no token need be added + // to the token-map. + Xsqlite3Dequote(tls, (*ExprList_item)(unsafe.Pointer(pItem)).FzEName) + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenMap(tls, pParse, (*ExprList_item)(unsafe.Pointer(pItem)).FzEName, pName) + } + } + } +} + +// Set the ExprList.a[].zSpan element of the most recently added item +// on the expression list. +// +// pList might be NULL following an OOM error. But pSpan should never be +// NULL. If a memory allocation fails, the pParse->db->mallocFailed flag +// is set. +func Xsqlite3ExprListSetSpan(tls *libc.TLS, pParse uintptr, pList uintptr, zStart uintptr, zEnd uintptr) { /* sqlite3.c:103118:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if pList != 0 { + var pItem uintptr = ((pList + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pList)).FnExpr-1))*32) + + if (*ExprList_item)(unsafe.Pointer(pItem)).FzEName == uintptr(0) { + (*ExprList_item)(unsafe.Pointer(pItem)).FzEName = Xsqlite3DbSpanDup(tls, db, zStart, zEnd) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.eEName */, uint32(ENAME_SPAN), 0, 0x3) + } + } +} + +// If the expression list pEList contains more than iLimit elements, +// leave an error message in pParse. +func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, zObject uintptr) { /* sqlite3.c:103140:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 2*4)) + + if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { + Xsqlite3ErrorMsg(tls, pParse, ts+6658 /* "too many columns..." */, libc.VaList(bp, zObject)) + } +} + +// Delete an entire expression list. +func exprListDeleteNN(tls *libc.TLS, db uintptr, pList uintptr) { /* sqlite3.c:103156:29: */ + var i int32 = (*ExprList)(unsafe.Pointer(pList)).FnExpr + var pItem uintptr = pList + 8 /* &.a */ + + for ok := true; ok; ok = (libc.PreDecInt32(&i, 1) > 0) { + Xsqlite3ExprDelete(tls, db, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr) + Xsqlite3DbFree(tls, db, (*ExprList_item)(unsafe.Pointer(pItem)).FzEName) + pItem += 32 + } + Xsqlite3DbFreeNN(tls, db, pList) +} + +func Xsqlite3ExprListDelete(tls *libc.TLS, db uintptr, pList uintptr) { /* sqlite3.c:103167:21: */ + if pList != 0 { + exprListDeleteNN(tls, db, pList) + } +} + +// Return the bitwise-OR of all Expr.flags fields in the given +// ExprList. +func Xsqlite3ExprListFlags(tls *libc.TLS, pList uintptr) U32 { /* sqlite3.c:103175:20: */ + var i int32 + var m U32 = U32(0) + + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + var pExpr uintptr = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + + m = m | ((*Expr)(unsafe.Pointer(pExpr)).Fflags) + } + return m +} + +// This is a SELECT-node callback for the expression walker that +// always "fails". By "fail" in this case, we mean set +// pWalker->eCode to zero and abort. +// +// This callback is used by multiple expression walkers. +func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int32 { /* sqlite3.c:103194:20: */ + _ = NotUsed + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort +} + +// Check the input string to see if it is "true" or "false" (in any case). +// +// If the string is.... Return +// "true" EP_IsTrue +// "false" EP_IsFalse +// anything else 0 +func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ + if Xsqlite3StrICmp(tls, zIn, ts+5771 /* "true" */) == 0 { + return U32(EP_IsTrue) + } + if Xsqlite3StrICmp(tls, zIn, ts+5776 /* "false" */) == 0 { + return U32(EP_IsFalse) + } + return U32(0) +} + +// If the input expression is an ID with the name "true" or "false" +// then convert it into an TK_TRUEFALSE term. Return non-zero if +// the conversion happened, and zero if the expression is unaltered. +func Xsqlite3ExprIdToTrueFalse(tls *libc.TLS, pExpr uintptr) int32 { /* sqlite3.c:103220:20: */ + var v U32 + + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Quoted))) != U32(0)) && + ((libc.AssignUint32(&v, Xsqlite3IsTrueOrFalse(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */))))) != U32(0)) { + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (v) + return 1 + } + return 0 +} + +// The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE +// and 0 if it is FALSE. +func Xsqlite3ExprTruthValue(tls *libc.TLS, pExpr uintptr) int32 { /* sqlite3.c:103237:20: */ + pExpr = Xsqlite3ExprSkipCollate(tls, pExpr) + + return (libc.Bool32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 4))) == 0)) +} + +// If pExpr is an AND or OR expression, try to simplify it by eliminating +// terms that are always true or false. Return the simplified expression. +// Or return the original expression if no simplification is possible. +// +// Examples: +// +// (x<10) AND true => (x<10) +// (x<10) AND false => false +// (x<10) AND (y=22 OR false) => (x<10) AND (y=22) +// (x<10) AND (y=22 OR true) => (x<10) +// (y=22) OR true => true +func Xsqlite3ExprSimplifiedAndOr(tls *libc.TLS, pExpr uintptr) uintptr { /* sqlite3.c:103258:21: */ + + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AND) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_OR) { + var pRight uintptr = Xsqlite3ExprSimplifiedAndOr(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + var pLeft uintptr = Xsqlite3ExprSimplifiedAndOr(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + if (((*Expr)(unsafe.Pointer((pLeft))).Fflags & (U32(EP_FromJoin | EP_IsTrue))) == U32(EP_IsTrue)) || (((*Expr)(unsafe.Pointer((pRight))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse)) { + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AND { + pExpr = pRight + } else { + pExpr = pLeft + } + } else if (((*Expr)(unsafe.Pointer((pRight))).Fflags & (U32(EP_FromJoin | EP_IsTrue))) == U32(EP_IsTrue)) || (((*Expr)(unsafe.Pointer((pLeft))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse)) { + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AND { + pExpr = pLeft + } else { + pExpr = pRight + } + } + } + return pExpr +} + +// These routines are Walker callbacks used to check expressions to +// see if they are "constant" for some definition of constant. The +// Walker.eCode value determines the type of "constant" we are looking +// for. +// +// These callback routines are used to implement the following: +// +// sqlite3ExprIsConstant() pWalker->eCode==1 +// sqlite3ExprIsConstantNotJoin() pWalker->eCode==2 +// sqlite3ExprIsTableConstant() pWalker->eCode==3 +// sqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5 +// +// In all cases, the callbacks set Walker.eCode=0 and abort if the expression +// is found to not be a constant. +// +// The sqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT +// expressions in a CREATE TABLE statement. The Walker.eCode value is 5 +// when parsing an existing schema out of the sqlite_schema table and 4 +// when processing a new CREATE TABLE statement. A bound parameter raises +// an error for new statements, but is silently converted +// to NULL for existing schemas. This allows sqlite_schema tables that +// contain a bound parameter because they were generated by older versions +// of SQLite to be parsed by newer versions of SQLite without raising a +// malformed schema error. +func exprNodeIsConstant(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:103299:12: */ + + // If pWalker->eCode is 2 then any term of the expression that comes from + // the ON or USING clauses of a left join disqualifies the expression + // from being considered constant. + if (int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 2) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort + } + + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + // Consider functions to be constant if all their arguments are constant + // and either pWalker->eCode==4 or 5 or the function has the + // SQLITE_FUNC_CONST flag. + case TK_FUNCTION: + if ((int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) >= 4) || (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_ConstFunc))) != U32(0))) && + !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + if int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 5 { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_FromDDL)) + } + return WRC_Continue + } else { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort + } + fallthrough + case TK_ID: + // Convert "true" or "false" in a DEFAULT clause into the + // appropriate TK_TRUEFALSE operator + if Xsqlite3ExprIdToTrueFalse(tls, pExpr) != 0 { + return WRC_Prune + } + fallthrough + case TK_COLUMN: + fallthrough + case TK_AGG_FUNCTION: + fallthrough + case TK_AGG_COLUMN: + + if (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FixedCol))) != U32(0)) && (int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) != 2) { + return WRC_Continue + } + if (int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 3) && ((*Expr)(unsafe.Pointer(pExpr)).FiTable == *(*int32)(unsafe.Pointer(pWalker + 40 /* &.u */))) { + return WRC_Continue + } + fallthrough + case TK_IF_NULL_ROW: + fallthrough + case TK_REGISTER: + fallthrough + case TK_DOT: + + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort + case TK_VARIABLE: + if int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 5 { + // Silently convert bound parameters that appear inside of CREATE + // statements into a NULL when parsing the CREATE statement text out + // of the sqlite_schema table + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) + } else if int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 4 { + // A bound parameter in a CREATE statement that originates from + // sqlite3_prepare() causes an error + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort + } + fallthrough + default: + // sqlite3SelectWalkFail() disallows + // sqlite3SelectWalkFail() disallows + return WRC_Continue + } + return int32(0) +} + +func exprIsConst(tls *libc.TLS, p uintptr, initFlag int32, iCur int32) int32 { /* sqlite3.c:103371:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FeCode = U16(initFlag) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{exprNodeIsConstant})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkFail})) + *(*int32)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = iCur + Xsqlite3WalkExpr(tls, bp /* &w */, p) + return int32((*Walker)(unsafe.Pointer(bp /* &w */)).FeCode) +} + +// Walk an expression tree. Return non-zero if the expression is constant +// and 0 if it involves variables or function calls. +// +// For the purposes of this function, a double-quoted string (ex: "abc") +// is considered a variable but a single-quoted string (ex: 'abc') is +// a constant. +func Xsqlite3ExprIsConstant(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:103392:20: */ + return exprIsConst(tls, p, 1, 0) +} + +// Walk an expression tree. Return non-zero if +// +// (1) the expression is constant, and +// (2) the expression does originate in the ON or USING clause +// of a LEFT JOIN, and +// (3) the expression does not contain any EP_FixedCol TK_COLUMN +// operands created by the constant propagation optimization. +// +// When this routine returns true, it indicates that the expression +// can be added to the pParse->pConstExpr list and evaluated once when +// the prepared statement starts up. See sqlite3ExprCodeRunJustOnce(). +func Xsqlite3ExprIsConstantNotJoin(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:103409:20: */ + return exprIsConst(tls, p, 2, 0) +} + +// Walk an expression tree. Return non-zero if the expression is constant +// for any single row of the table with cursor iCur. In other words, the +// expression must not refer to any non-deterministic function nor any +// table other than iCur. +func Xsqlite3ExprIsTableConstant(tls *libc.TLS, p uintptr, iCur int32) int32 { /* sqlite3.c:103419:20: */ + return exprIsConst(tls, p, 3, iCur) +} + +// sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy(). +func exprNodeIsConstantOrGroupBy(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:103427:12: */ + var pGroupBy uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var i int32 + + // Check if pExpr is identical to any GROUP BY term. If so, consider + // it constant. + for i = 0; i < (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr; i++ { + var p uintptr = (*ExprList_item)(unsafe.Pointer((pGroupBy + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if Xsqlite3ExprCompare(tls, uintptr(0), pExpr, p, -1) < 2 { + var pColl uintptr = Xsqlite3ExprNNCollSeq(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, p) + if Xsqlite3IsBinary(tls, pColl) != 0 { + return WRC_Prune + } + } + } + + // Check if pExpr is a sub-select. If so, consider it variable. + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort + } + + return exprNodeIsConstant(tls, pWalker, pExpr) +} + +// Walk the expression tree passed as the first argument. Return non-zero +// if the expression consists entirely of constants or copies of terms +// in pGroupBy that sort with the BINARY collation sequence. +// +// This routine is used to determine if a term of the HAVING clause can +// be promoted into the WHERE clause. In order for such a promotion to work, +// the value of the HAVING clause term must be the same for all members of +// a "group". The requirement that the GROUP BY term must be BINARY +// assumes that no other collating sequence will have a finer-grained +// grouping than binary. In other words (A=B COLLATE binary) implies +// A=B in every other collating sequence. The requirement that the +// GROUP BY be BINARY is stricter than necessary. It would also work +// to promote HAVING clauses that use the same alternative collating +// sequence as the GROUP BY term, but that is much harder to check, +// alternative collating sequences are uncommon, and this is only an +// optimization, so we take the easy way out and simply require the +// GROUP BY to use the BINARY collating sequence. +func Xsqlite3ExprIsConstantOrGroupBy(tls *libc.TLS, pParse uintptr, p uintptr, pGroupBy uintptr) int32 { /* sqlite3.c:103471:20: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FeCode = U16(1) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{exprNodeIsConstantOrGroupBy})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = pGroupBy + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = pParse + Xsqlite3WalkExpr(tls, bp /* &w */, p) + return int32((*Walker)(unsafe.Pointer(bp /* &w */)).FeCode) +} + +// Walk an expression tree for the DEFAULT field of a column definition +// in a CREATE TABLE statement. Return non-zero if the expression is +// acceptable for use as a DEFAULT. That is to say, return non-zero if +// the expression is constant or a function call with constant arguments. +// Return and 0 if there are any variables. +// +// isInit is true when parsing from sqlite_schema. isInit is false when +// processing a new CREATE TABLE statement. When isInit is true, parameters +// (such as ? or $abc) in the expression are converted into NULL. When +// isInit is false, parameters raise an error. Parameters should not be +// allowed in a CREATE TABLE statement, but some legacy versions of SQLite +// allowed it, so we need to support it when reading sqlite_schema for +// backwards compatibility. +// +// If isInit is true, set EP_FromDDL on every TK_FUNCTION node. +// +// For the purposes of this function, a double-quoted string (ex: "abc") +// is considered a variable but a single-quoted string (ex: 'abc') is +// a constant. +func Xsqlite3ExprIsConstantOrFunction(tls *libc.TLS, p uintptr, isInit U8) int32 { /* sqlite3.c:103503:20: */ + + return exprIsConst(tls, p, (4 + int32(isInit)), 0) +} + +// If the expression p codes a constant integer that is small enough +// to fit in a 32-bit integer, return 1 and put the value of the integer +// in *pValue. If the expression is not an integer or if it is too big +// to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged. +func Xsqlite3ExprIsInteger(tls *libc.TLS, p uintptr, pValue uintptr) int32 { /* sqlite3.c:103532:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = 0 + if p == uintptr(0) { + return 0 + } // Used to only happen following on OOM + + // If an expression is an integer literal that fits in a signed 32-bit + // integer, then the EP_IntValue flag will have already been set + + if ((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_IntValue)) != 0 { + *(*int32)(unsafe.Pointer(pValue)) = *(*int32)(unsafe.Pointer(p + 8 /* &.u */)) + return 1 + } + switch int32((*Expr)(unsafe.Pointer(p)).Fop) { + case TK_UPLUS: + { + rc = Xsqlite3ExprIsInteger(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, pValue) + break + + } + case TK_UMINUS: + { + // var v int32 at bp, 4 + + if Xsqlite3ExprIsInteger(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, bp /* &v */) != 0 { + + *(*int32)(unsafe.Pointer(pValue)) = -*(*int32)(unsafe.Pointer(bp /* v */)) + rc = 1 + } + break + + } + default: + break + } + return rc +} + +// Return FALSE if there is no chance that the expression can be NULL. +// +// If the expression might be NULL or if the expression is too complex +// to tell return TRUE. +// +// This routine is used as an optimization, to skip OP_IsNull opcodes +// when we know that a value cannot be NULL. Hence, a false positive +// (returning TRUE when in fact the expression can never be NULL) might +// be a small performance hit but is otherwise harmless. On the other +// hand, a false negative (returning FALSE when the result could be NULL) +// will likely result in an incorrect answer. So when in doubt, return +// TRUE. +func Xsqlite3ExprCanBeNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:103578:20: */ + var op U8 + + for (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_UPLUS) || (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_UMINUS) { + p = (*Expr)(unsafe.Pointer(p)).FpLeft + + } + op = (*Expr)(unsafe.Pointer(p)).Fop + if int32(op) == TK_REGISTER { + op = (*Expr)(unsafe.Pointer(p)).Fop2 + } + switch int32(op) { + case TK_INTEGER: + fallthrough + case TK_STRING: + fallthrough + case TK_FLOAT: + fallthrough + case TK_BLOB: + return 0 + case TK_COLUMN: + return (libc.Bool32(((((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_CanBeNull))) != U32(0)) || (*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)) == uintptr(0))) || (((int32((*Expr)(unsafe.Pointer(p)).FiColumn) >= 0) && + ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FaCol != uintptr(0))) && // Defense against OOM problems + (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FaCol+uintptr((*Expr)(unsafe.Pointer(p)).FiColumn)*32)).FnotNull) == 0)))) + default: + return 1 + } + return int32(0) +} + +// Return TRUE if the given expression is a constant which would be +// unchanged by OP_Affinity with the affinity given in the second +// argument. +// +// This routine is used to determine if the OP_Affinity operation +// can be omitted. When in doubt return FALSE. A false negative +// is harmless. A false positive, however, can result in the wrong +// answer. +func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 { /* sqlite3.c:103614:20: */ + var op U8 + var unaryMinus int32 = 0 + if int32(aff) == SQLITE_AFF_BLOB { + return 1 + } + for (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_UPLUS) || (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_UMINUS) { + if int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_UMINUS { + unaryMinus = 1 + } + p = (*Expr)(unsafe.Pointer(p)).FpLeft + } + op = (*Expr)(unsafe.Pointer(p)).Fop + if int32(op) == TK_REGISTER { + op = (*Expr)(unsafe.Pointer(p)).Fop2 + } + switch int32(op) { + case TK_INTEGER: + { + return (libc.Bool32(int32(aff) >= SQLITE_AFF_NUMERIC)) + + } + case TK_FLOAT: + { + return (libc.Bool32(int32(aff) >= SQLITE_AFF_NUMERIC)) + + } + case TK_STRING: + { + return (libc.Bool32(!(unaryMinus != 0) && (int32(aff) == SQLITE_AFF_TEXT))) + + } + case TK_BLOB: + { + return libc.BoolInt32(!(unaryMinus != 0)) + + } + case TK_COLUMN: + { + // p cannot be part of a CHECK constraint + return (libc.Bool32((int32(aff) >= SQLITE_AFF_NUMERIC) && (int32((*Expr)(unsafe.Pointer(p)).FiColumn) < 0))) + + } + default: + { + return 0 + + } + } + return int32(0) +} + +// Return TRUE if the given string is a row-id column name. +func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ + if Xsqlite3StrICmp(tls, z, ts+6681 /* "_ROWID_" */) == 0 { + return 1 + } + if Xsqlite3StrICmp(tls, z, ts+6689 /* "ROWID" */) == 0 { + return 1 + } + if Xsqlite3StrICmp(tls, z, ts+6695 /* "OID" */) == 0 { + return 1 + } + return 0 +} + +// pX is the RHS of an IN operator. If pX is a SELECT statement +// that can be simplified to a direct table access, then return +// a pointer to the SELECT statement. If pX is not a SELECT statement, +// or if the SELECT statement needs to be manifested into a transient +// table, then return NULL. +func isCandidateForInOpt(tls *libc.TLS, pX uintptr) uintptr { /* sqlite3.c:103665:15: */ + var p uintptr + var pSrc uintptr + var pEList uintptr + var pTab uintptr + var i int32 + if !(((*Expr)(unsafe.Pointer((pX))).Fflags & (U32(EP_xIsSelect))) != U32(0)) { + return uintptr(0) + } // Not a subquery + if ((*Expr)(unsafe.Pointer((pX))).Fflags & (U32(EP_VarSelect))) != U32(0) { + return uintptr(0) + } // Correlated subq + p = *(*uintptr)(unsafe.Pointer(pX + 32 /* &.x */)) + if (*Select)(unsafe.Pointer(p)).FpPrior != 0 { + return uintptr(0) + } // Not a compound SELECT + if ((*Select)(unsafe.Pointer(p)).FselFlags & (U32(SF_Distinct | SF_Aggregate))) != 0 { + + return uintptr(0) // No DISTINCT keyword and no aggregate functions + } + // Has no GROUP BY clause + if (*Select)(unsafe.Pointer(p)).FpLimit != 0 { + return uintptr(0) + } // Has no LIMIT clause + if (*Select)(unsafe.Pointer(p)).FpWhere != 0 { + return uintptr(0) + } // Has no WHERE clause + pSrc = (*Select)(unsafe.Pointer(p)).FpSrc + + if (*SrcList)(unsafe.Pointer(pSrc)).FnSrc != 1 { + return uintptr(0) + } // Single term in FROM clause + if (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FpSelect != 0 { + return uintptr(0) + } // FROM is not a subquery or view + pTab = (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FpTab + + // FROM clause is not a view + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + return uintptr(0) + } // FROM clause not a virtual table + pEList = (*Select)(unsafe.Pointer(p)).FpEList + + // All SELECT results must be columns. + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + var pRes uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if int32((*Expr)(unsafe.Pointer(pRes)).Fop) != TK_COLUMN { + return uintptr(0) + } + // Not a correlated subquery + } + return p +} + +// Generate code that checks the left-most column of index table iCur to see if +// it contains any NULL entries. Cause the register at regHasNull to be set +// to a non-NULL value if iCur contains no NULLs. Cause register regHasNull +// to be set to NULL if iCur contains one or more NULL values. +func sqlite3SetHasNullFlag(tls *libc.TLS, v uintptr, iCur int32, regHasNull int32) { /* sqlite3.c:103710:13: */ + var addr1 int32 + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regHasNull) + addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, iCur) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iCur, 0, regHasNull) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_TYPEOFARG)) + + Xsqlite3VdbeJumpHere(tls, v, addr1) +} + +// The argument is an IN operator with a list (not a subquery) on the +// right-hand side. Return TRUE if that list is constant. +func sqlite3InRhsIsConstant(tls *libc.TLS, pIn uintptr) int32 { /* sqlite3.c:103727:12: */ + var pLHS uintptr + var res int32 + + pLHS = (*Expr)(unsafe.Pointer(pIn)).FpLeft + (*Expr)(unsafe.Pointer(pIn)).FpLeft = uintptr(0) + res = Xsqlite3ExprIsConstant(tls, pIn) + (*Expr)(unsafe.Pointer(pIn)).FpLeft = pLHS + return res +} + +// This function is used by the implementation of the IN (...) operator. +// The pX parameter is the expression on the RHS of the IN operator, which +// might be either a list of expressions or a subquery. +// +// The job of this routine is to find or create a b-tree object that can +// be used either to test for membership in the RHS set or to iterate through +// all members of the RHS set, skipping duplicates. +// +// A cursor is opened on the b-tree object that is the RHS of the IN operator +// and pX->iTable is set to the index of that cursor. +// +// The returned value of this function indicates the b-tree type, as follows: +// +// IN_INDEX_ROWID - The cursor was opened on a database table. +// IN_INDEX_INDEX_ASC - The cursor was opened on an ascending index. +// IN_INDEX_INDEX_DESC - The cursor was opened on a descending index. +// IN_INDEX_EPH - The cursor was opened on a specially created and +// populated epheremal table. +// IN_INDEX_NOOP - No cursor was allocated. The IN operator must be +// implemented as a sequence of comparisons. +// +// An existing b-tree might be used if the RHS expression pX is a simple +// subquery such as: +// +// SELECT , ... FROM +// +// If the RHS of the IN operator is a list or a more complex subquery, then +// an ephemeral table might need to be generated from the RHS and then +// pX->iTable made to point to the ephemeral table instead of an +// existing table. +// +// The inFlags parameter must contain, at a minimum, one of the bits +// IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP but not both. If inFlags contains +// IN_INDEX_MEMBERSHIP, then the generated table will be used for a fast +// membership test. When the IN_INDEX_LOOP bit is set, the IN index will +// be used to loop over all values of the RHS of the IN operator. +// +// When IN_INDEX_LOOP is used (and the b-tree will be used to iterate +// through the set members) then the b-tree must not contain duplicates. +// An epheremal table will be created unless the selected columns are guaranteed +// to be unique - either because it is an INTEGER PRIMARY KEY or due to +// a UNIQUE constraint or index. +// +// When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used +// for fast set membership tests) then an epheremal table must +// be used unless is a single INTEGER PRIMARY KEY column or an +// index can be found with the specified as its left-most. +// +// If the IN_INDEX_NOOP_OK and IN_INDEX_MEMBERSHIP are both set and +// if the RHS of the IN operator is a list (not a subquery) then this +// routine might decide that creating an ephemeral b-tree for membership +// testing is too expensive and return IN_INDEX_NOOP. In that case, the +// calling routine should implement the IN operator using a sequence +// of Eq or Ne comparison operations. +// +// When the b-tree is being used for membership tests, the calling function +// might need to know whether or not the RHS side of the IN operator +// contains a NULL. If prRhsHasNull is not a NULL pointer and +// if there is any chance that the (...) might contain a NULL value at +// runtime, then a register is allocated and the register number written +// to *prRhsHasNull. If there is no chance that the (...) contains a +// NULL value, then *prRhsHasNull is left unchanged. +// +// If a register is allocated and its location stored in *prRhsHasNull, then +// the value in that register will be NULL if the b-tree contains one or more +// NULL values, and it will be some non-NULL value if the b-tree contains no +// NULL values. +// +// If the aiMap parameter is not NULL, it must point to an array containing +// one element for each column returned by the SELECT statement on the RHS +// of the IN(...) operator. The i'th entry of the array is populated with the +// offset of the index column that matches the i'th column returned by the +// SELECT. For example, if the expression and selected index are: +// +// (?,?,?) IN (SELECT a, b, c FROM t1) +// CREATE INDEX i1 ON t1(b, c, a); +// +// then aiMap[] is populated with {2, 0, 1}. +func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, prRhsHasNull uintptr, aiMap uintptr, piTab uintptr) int32 { /* sqlite3.c:103820:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr // SELECT to the right of IN operator + var eType int32 = 0 // Type of RHS table. IN_INDEX_* + var iTab int32 = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) // Cursor of the RHS table + var mustBeUnique int32 // True if RHS must be unique + var v uintptr = Xsqlite3GetVdbe(tls, pParse) // Virtual machine being coded + + mustBeUnique = (libc.Bool32((inFlags & U32(IN_INDEX_LOOP)) != U32(0))) + + // If the RHS of this IN(...) operator is a SELECT, and if it matters + // whether or not the SELECT result contains NULL values, check whether + // or not NULL is actually possible (it may not be, for example, due + // to NOT NULL constraints in the schema). If no NULL values are possible, + // set prRhsHasNull to 0 before continuing. + if (prRhsHasNull != 0) && (((*Expr)(unsafe.Pointer(pX)).Fflags & U32(EP_xIsSelect)) != 0) { + var i int32 + var pEList uintptr = (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pX + 32 /* &.x */)))).FpEList + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FpExpr) != 0 { + break + } + } + if i == (*ExprList)(unsafe.Pointer(pEList)).FnExpr { + prRhsHasNull = uintptr(0) + } + } + + // Check to see if an existing table or index can be used to + // satisfy the query. This is preferable to generating a new + // ephemeral table. + if ((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((libc.AssignUintptr(&p, isCandidateForInOpt(tls, pX))) != uintptr(0)) { + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection + var pTab uintptr // Table
. + var iDb int32 // Database idx for pTab + var pEList uintptr = (*Select)(unsafe.Pointer(p)).FpEList + var nExpr int32 = (*ExprList)(unsafe.Pointer(pEList)).FnExpr + + // Because of isCandidateForInOpt(p) + // Because of isCandidateForInOpt(p) + // Because of isCandidateForInOpt(p) + pTab = (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpTab + + // Code an OP_Transaction and OP_TableLock for
. + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pTab)).FzName) + + // sqlite3GetVdbe() has always been previously called + if (nExpr == 1) && (int32((*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */))).FpExpr)).FiColumn) < 0) { + // The "x IN (SELECT rowid FROM table)" case + var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + + Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) + eType = IN_INDEX_ROWID + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6699 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeJumpHere(tls, v, iAddr) + } else { + var pIdx uintptr // Iterator variable + var affinity_ok int32 = 1 + var i int32 + + // Check that the affinity that will be used to perform each + // comparison is the same as the affinity of each column in table + // on the RHS of the IN operator. If it not, it is not possible to + // use any index of the RHS table. + for i = 0; (i < nExpr) && (affinity_ok != 0); i++ { + var pLhs uintptr = Xsqlite3VectorFieldSubexpr(tls, (*Expr)(unsafe.Pointer(pX)).FpLeft, i) + var iCol int32 = int32((*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr)).FiColumn) + var idxaff int8 = Xsqlite3TableColumnAffinity(tls, pTab, iCol) // RHS table + var cmpaff int8 = Xsqlite3CompareAffinity(tls, pLhs, idxaff) + + switch int32(cmpaff) { + case SQLITE_AFF_BLOB: + break + fallthrough + case SQLITE_AFF_TEXT: + // sqlite3CompareAffinity() only returns TEXT if one side or the + // other has no affinity and the other side is TEXT. Hence, + // the only way for cmpaff to be TEXT is for idxaff to be TEXT + // and for the term on the LHS of the IN to have no affinity. + + break + fallthrough + default: + affinity_ok = (libc.Bool32((int32(idxaff)) >= SQLITE_AFF_NUMERIC)) + } + } + + if affinity_ok != 0 { + // Search for an existing index that will work for this IN operator + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (eType == 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + var colUsed Bitmask // Columns of the index used + var mCol Bitmask // Mask for the current column + if int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) < nExpr { + continue + } + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) { + continue + } + // Maximum nColumn is BMS-2, not BMS-1, so that we can compute + // BITMASK(nExpr) without overflowing + + if int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) >= ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) { + continue + } + if mustBeUnique != 0 { + if (int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) > nExpr) || + ((int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) > nExpr) && !(int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None)) { + continue // This index is not unique over the IN RHS columns + } + } + + colUsed = uint64(0) // Columns of index used so far + for i = 0; i < nExpr; i++ { + var pLhs uintptr = Xsqlite3VectorFieldSubexpr(tls, (*Expr)(unsafe.Pointer(pX)).FpLeft, i) + var pRhs uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + var pReq uintptr = Xsqlite3BinaryCompareCollSeq(tls, pParse, pLhs, pRhs) + var j int32 + + for j = 0; j < nExpr; j++ { + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) != int32((*Expr)(unsafe.Pointer(pRhs)).FiColumn) { + continue + } + + if (pReq != uintptr(0)) && (Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pReq)).FzName, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8))) != 0) { + continue + } + break + } + if j == nExpr { + break + } + mCol = (Bitmask((uint64(1))) << (j)) + if (mCol & colUsed) != 0 { + break + } // Each column used only once + colUsed = colUsed | (mCol) + if aiMap != 0 { + *(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4)) = j + } + } + + if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { + // If we reach this point, that means the index pIdx is usable + var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6746 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + + eType = (IN_INDEX_INDEX_ASC + int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder)))) + + if prRhsHasNull != 0 { + *(*int32)(unsafe.Pointer(prRhsHasNull)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + if nExpr == 1 { + sqlite3SetHasNullFlag(tls, v, iTab, *(*int32)(unsafe.Pointer(prRhsHasNull))) + } + } + Xsqlite3VdbeJumpHere(tls, v, iAddr) + } + } // End loop over indexes + } // End if( affinity_ok ) + } // End if not an rowid index + } // End attempt to optimize using an index + + // If no preexisting index is available for the IN clause + // and IN_INDEX_NOOP is an allowed reply + // and the RHS of the IN operator is a list, not a subquery + // and the RHS is not constant or has two or fewer terms, + // then it is not worth creating an ephemeral table to evaluate + // the IN operator so return IN_INDEX_NOOP. + if (((eType == 0) && + ((inFlags & U32(IN_INDEX_NOOP_OK)) != 0)) && + !(((*Expr)(unsafe.Pointer((pX))).Fflags & (U32(EP_xIsSelect))) != U32(0))) && + (!(sqlite3InRhsIsConstant(tls, pX) != 0) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pX + 32 /* &.x */)))).FnExpr <= 2)) { + eType = IN_INDEX_NOOP + } + + if eType == 0 { + // Could not find an existing table or index to use as the RHS b-tree. + // We will have to generate an ephemeral table to do the job. + var savedNQueryLoop U32 = (*Parse)(unsafe.Pointer(pParse)).FnQueryLoop + var rMayHaveNull int32 = 0 + eType = IN_INDEX_EPH + if (inFlags & U32(IN_INDEX_LOOP)) != 0 { + (*Parse)(unsafe.Pointer(pParse)).FnQueryLoop = U32(0) + } else if prRhsHasNull != 0 { + *(*int32)(unsafe.Pointer(prRhsHasNull)) = libc.AssignInt32(&rMayHaveNull, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + } + + Xsqlite3CodeRhsOfIN(tls, pParse, pX, iTab) + if rMayHaveNull != 0 { + sqlite3SetHasNullFlag(tls, v, iTab, rMayHaveNull) + } + (*Parse)(unsafe.Pointer(pParse)).FnQueryLoop = savedNQueryLoop + } + + if ((aiMap != 0) && (eType != IN_INDEX_INDEX_ASC)) && (eType != IN_INDEX_INDEX_DESC) { + var i int32 + var n int32 + n = Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pX)).FpLeft) + for i = 0; i < n; i++ { + *(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4)) = i + } + } + *(*int32)(unsafe.Pointer(piTab)) = iTab + return eType +} + +// Argument pExpr is an (?, ?...) IN(...) expression. This +// function allocates and returns a nul-terminated string containing +// the affinities to be used for each column of the comparison. +// +// It is the responsibility of the caller to ensure that the returned +// string is eventually freed using sqlite3DbFree(). +func exprINAffinity(tls *libc.TLS, pParse uintptr, pExpr uintptr) uintptr { /* sqlite3.c:104043:13: */ + var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + var nVal int32 = Xsqlite3ExprVectorSize(tls, pLeft) + var pSelect uintptr + if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { + pSelect = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + } else { + pSelect = uintptr(0) + } + var zRet uintptr + + zRet = Xsqlite3DbMallocRaw(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64(nVal + 1))) + if zRet != 0 { + var i int32 + for i = 0; i < nVal; i++ { + var pA uintptr = Xsqlite3VectorFieldSubexpr(tls, pLeft, i) + var a int8 = Xsqlite3ExprAffinity(tls, pA) + if pSelect != 0 { + *(*int8)(unsafe.Pointer(zRet + uintptr(i))) = Xsqlite3CompareAffinity(tls, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSelect)).FpEList+8 /* &.a */)+uintptr(i)*32)).FpExpr, a) + } else { + *(*int8)(unsafe.Pointer(zRet + uintptr(i))) = a + } + } + *(*int8)(unsafe.Pointer(zRet + uintptr(nVal))) = int8(0) + } + return zRet +} + +// Load the Parse object passed as the first argument with an error +// message of the form: +// +// "sub-select returns N columns - expected M" +func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpect int32) { /* sqlite3.c:104075:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { + var zFmt uintptr = ts + 6777 /* "sub-select retur..." */ + Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) + } +} + +// Expression pExpr is a vector that has been used in a context where +// it is not permitted. If pExpr is a sub-select vector, this routine +// loads the Parse object with a message of the form: +// +// "sub-select returns N columns - expected 1" +// +// Or, if it is a regular scalar vector: +// +// "row value misused" +func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* sqlite3.c:104094:21: */ + if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { + Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr, 1) + } else { + Xsqlite3ErrorMsg(tls, pParse, ts+5549 /* "row value misuse..." */, 0) + } +} + +// Generate code that will construct an ephemeral table containing all terms +// in the RHS of an IN operator. The IN operator can be in either of two +// forms: +// +// x IN (4,5,11) -- IN operator with list on right-hand side +// x IN (SELECT a FROM b) -- IN operator with subquery on the right +// +// The pExpr parameter is the IN operator. The cursor number for the +// constructed ephermeral table is returned. The first time the ephemeral +// table is computed, the cursor number is also stored in pExpr->iTable, +// however the cursor number returned might not be the same, as it might +// have been duplicated using OP_OpenDup. +// +// If the LHS expression ("x" in the examples) is a column value, or +// the SELECT statement returns a column value, then the affinity of that +// column is used to build the index keys. If both 'x' and the +// SELECT... statement are columns, then numeric affinity is used +// if either column has NUMERIC or INTEGER affinity. If neither +// 'x' nor the SELECT... statement are columns, then numeric affinity +// is used. +func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int32) { /* sqlite3.c:104128:21: */ + bp := tls.Alloc(65) + defer tls.Free(65) + + var addrOnce int32 = 0 // Address of the OP_Once instruction at top + var addr int32 // Address of OP_OpenEphemeral instruction + var pLeft uintptr // the LHS of the IN operator + var pKeyInfo uintptr = uintptr(0) // Key information + var nVal int32 // Size of vector pLeft + var v uintptr // The prepared statement under construction + + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + // The evaluation of the IN must be repeated every time it + // is encountered if any of the following is true: + // + // * The right-hand side is a correlated subquery + // * The right-hand side is an expression list containing variables + // * We are inside a trigger + // + // If all of the above are false, then we can compute the RHS just once + // and reuse it many names. + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_VarSelect))) != U32(0)) && ((*Parse)(unsafe.Pointer(pParse)).FiSelfTab == 0) { + // Reuse of the RHS is allowed + // If this routine has already been coded, but the previous code + // might not have been invoked yet, so invoke it now as a subroutine. + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { + addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6821 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) + } + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), + *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, iTab, (*Expr)(unsafe.Pointer(pExpr)).FiTable) + Xsqlite3VdbeJumpHere(tls, v, addrOnce) + return + } + + // Begin coding the subroutine + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_Subrtn)) + + *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */)) = (Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */))) + 1) + + addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + } + + // Check to see if this is a vector IN operator + pLeft = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + nVal = Xsqlite3ExprVectorSize(tls, pLeft) + + // Construct the ephemeral table that will contain the content of + // RHS of the IN operator. + (*Expr)(unsafe.Pointer(pExpr)).FiTable = iTab + addr = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*Expr)(unsafe.Pointer(pExpr)).FiTable, nVal) + pKeyInfo = Xsqlite3KeyInfoAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, nVal, 1) + + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + // Case 1: expr IN (SELECT ...) + // + // Generate code to write the results of the select into the temporary + // table allocated and opened above. + var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList + + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6844 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + if addrOnce != 0 { + return ts + 756 /* "" */ + } + return ts + 6863 /* "CORRELATED " */ + }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) + // If the LHS and RHS of the IN operator do not match, that + // error will have been caught long before we reach this point. + if (*ExprList)(unsafe.Pointer(pEList)).FnExpr == nVal { + var pCopy uintptr + // var dest SelectDest at bp+24, 40 + + var i int32 + var rc int32 + Xsqlite3SelectDestInit(tls, bp+24 /* &dest */, SRT_Set, iTab) + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FzAffSdst = exprINAffinity(tls, pParse, pExpr) + (*Select)(unsafe.Pointer(pSelect)).FiLimit = 0 + + // Caused by OOM in sqlite3KeyInfoAlloc() + pCopy = Xsqlite3SelectDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pSelect, 0) + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + rc = 1 + } else { + rc = Xsqlite3Select(tls, pParse, pCopy, bp+24 /* &dest */) + } + Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pCopy) + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FzAffSdst) + if rc != 0 { + Xsqlite3KeyInfoUnref(tls, pKeyInfo) + return + } + // OOM will cause exit after sqlite3Select() + + for i = 0; i < nVal; i++ { + var p uintptr = Xsqlite3VectorFieldSubexpr(tls, pLeft, i) + *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(i)*8)) = Xsqlite3BinaryCompareCollSeq(tls, + pParse, p, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + } + } + } else if *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) != uintptr(0) { + // Case 2: expr IN (exprlist) + // + // For each expression, build an index key from the evaluation and + // store it in the temporary table. If is a column, then use + // that columns affinity when building index keys. If is not + // a column, use numeric affinity. + // var affinity int8 at bp+64, 1 + // Affinity of the LHS of the IN + var i int32 + var pList uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + var pItem uintptr + var r1 int32 + var r2 int32 + *(*int8)(unsafe.Pointer(bp + 64 /* affinity */)) = Xsqlite3ExprAffinity(tls, pLeft) + if int32(*(*int8)(unsafe.Pointer(bp + 64 /* affinity */))) <= SQLITE_AFF_NONE { + *(*int8)(unsafe.Pointer(bp + 64 /* affinity */)) = int8(SQLITE_AFF_BLOB) + } else if int32(*(*int8)(unsafe.Pointer(bp + 64 /* affinity */))) == SQLITE_AFF_REAL { + *(*int8)(unsafe.Pointer(bp + 64 /* affinity */)) = int8(SQLITE_AFF_NUMERIC) + } + if pKeyInfo != 0 { + + *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */))) = Xsqlite3ExprCollSeq(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + } + + // Loop through each expression in . + r1 = Xsqlite3GetTempReg(tls, pParse) + r2 = Xsqlite3GetTempReg(tls, pParse) + i = (*ExprList)(unsafe.Pointer(pList)).FnExpr + pItem = pList + 8 /* &.a */ + __1: + if !(i > 0) { + goto __3 + } + { + var pE2 uintptr = (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr + + // If the expression is not constant then we will need to + // disable the test that was generated above that makes sure + // this code only executes once. Because for a non-constant + // expression we need to rerun this code each time. + if (addrOnce != 0) && !(Xsqlite3ExprIsConstant(tls, pE2) != 0) { + Xsqlite3VdbeChangeToNoop(tls, v, addrOnce) + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Subrtn))) + addrOnce = 0 + } + + // Evaluate the expression and insert it into the temp table + Xsqlite3ExprCode(tls, pParse, pE2, r1) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, r1, 1, r2, bp+64 /* &affinity */, 1) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iTab, r2, r1, 1) + + } + goto __2 + __2: + i-- + pItem += 32 + goto __1 + goto __3 + __3: + ; + Xsqlite3ReleaseTempReg(tls, pParse, r1) + Xsqlite3ReleaseTempReg(tls, pParse, r2) + } + if pKeyInfo != 0 { + Xsqlite3VdbeChangeP4(tls, v, addr, pKeyInfo, -9) + } + if addrOnce != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrOnce) + // Subroutine return + Xsqlite3VdbeAddOp1(tls, v, OP_Return, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */))) + Xsqlite3VdbeChangeP1(tls, v, (*(*int32)(unsafe.Pointer((pExpr + 64 /* &.y */ /* &.sub */) /* &.iAddr */)) - 1), (Xsqlite3VdbeCurrentAddr(tls, v) - 1)) + Xsqlite3ClearTempRegCache(tls, pParse) + } +} + +// Generate code for scalar subqueries used as a subquery expression +// or EXISTS operator: +// +// (SELECT a FROM b) -- subquery +// EXISTS (SELECT a FROM b) -- EXISTS subquery +// +// The pExpr parameter is the SELECT or EXISTS operator to be coded. +// +// Return the register that holds the result. For a multi-column SELECT, +// the result is stored in a contiguous array of registers and the +// return value is the register of the left-most result column. +// Return 0 if an error occurs. +func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { /* sqlite3.c:104320:20: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var addrOnce int32 = 0 // Address of OP_Once at top of subroutine + var rReg int32 = 0 // Register storing resulting + var pSel uintptr // SELECT statement to encode + // var dest SelectDest at bp+24, 40 + // How to deal with SELECT result + var nReg int32 // Registers to allocate + var pLimit uintptr // New limit expression + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return 0 + } + + pSel = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + + // If this routine has already been coded, then invoke it as a + // subroutine. + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6875 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), + *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) + return (*Expr)(unsafe.Pointer(pExpr)).FiTable + } + + // Begin coding the subroutine + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_Subrtn)) + *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */)) = (Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */))) + 1) + + // The evaluation of the EXISTS/SELECT must be repeated every time it + // is encountered if any of the following is true: + // + // * The right-hand side is a correlated subquery + // * The right-hand side is an expression list containing variables + // * We are inside a trigger + // + // If all of the above are false, then we can run this code just once + // save the results, and reuse the same result on subsequent invocations. + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_VarSelect))) != U32(0)) { + addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + } + + // For a SELECT, generate code to put the values for all columns of + // the first row into an array of registers and return the index of + // the first register. + // + // If this is an EXISTS, write an integer 0 (not exists) or 1 (exists) + // into a register and return that register number. + // + // In both cases, the query is augmented with "LIMIT 1". Any + // preexisting limit is discarded in place of the new LIMIT 1. + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6893 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + if addrOnce != 0 { + return ts + 756 /* "" */ + } + return ts + 6863 /* "CORRELATED " */ + }(), (*Select)(unsafe.Pointer(pSel)).FselId)) + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { + nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr + } else { + nReg = 1 + } + Xsqlite3SelectDestInit(tls, bp+24 /* &dest */, 0, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1)) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nReg) + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FeDest = U8(SRT_Mem) + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FiSdst = (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FiSDParm + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FnSdst = nReg + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm, (((*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm + nReg) - 1)) + + } else { + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FeDest = U8(SRT_Exists) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm) + + } + if (*Select)(unsafe.Pointer(pSel)).FpLimit != 0 { + // The subquery already has a limit. If the pre-existing limit is X + // then make the new limit X<>0 so that the new limit is either 1 or 0 + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6507 /* "0" */) + if pLimit != 0 { + (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) + pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, + Xsqlite3ExprDup(tls, db, (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft, 0), pLimit) + } + Xsqlite3ExprDelete(tls, db, (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft) + (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit + } else { + // If there is no pre-existing limit add a limit of 1 + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6914 /* "1" */) + (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) + } + (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 + if Xsqlite3Select(tls, pParse, pSel, bp+24 /* &dest */) != 0 { + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + (*Expr)(unsafe.Pointer(pExpr)).Fop2 = (*Expr)(unsafe.Pointer(pExpr)).Fop + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_ERROR) + } + return 0 + } + (*Expr)(unsafe.Pointer(pExpr)).FiTable = libc.AssignInt32(&rReg, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm) + + if addrOnce != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrOnce) + } + + // Subroutine return + Xsqlite3VdbeAddOp1(tls, v, OP_Return, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */))) + Xsqlite3VdbeChangeP1(tls, v, (*(*int32)(unsafe.Pointer((pExpr + 64 /* &.y */ /* &.sub */) /* &.iAddr */)) - 1), (Xsqlite3VdbeCurrentAddr(tls, v) - 1)) + Xsqlite3ClearTempRegCache(tls, pParse) + return rReg +} + +// Expr pIn is an IN(...) expression. This function checks that the +// sub-select on the RHS of the IN() operator has the same number of +// columns as the vector on the LHS. Or, if the RHS of the IN() is not +// a sub-query, that the LHS is a vector of size 1. +func Xsqlite3ExprCheckIN(tls *libc.TLS, pParse uintptr, pIn uintptr) int32 { /* sqlite3.c:104440:20: */ + var nVector int32 = Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pIn)).FpLeft) + if (((*Expr)(unsafe.Pointer(pIn)).Fflags & U32(EP_xIsSelect)) != U32(0)) && !(int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed) != 0) { + if nVector != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pIn + 32 /* &.x */)))).FpEList)).FnExpr { + Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pIn + 32 /* &.x */)))).FpEList)).FnExpr, nVector) + return 1 + } + } else if nVector != 1 { + Xsqlite3VectorErrorMsg(tls, pParse, (*Expr)(unsafe.Pointer(pIn)).FpLeft) + return 1 + } + return 0 +} + +// Generate code for an IN expression. +// +// x IN (SELECT ...) +// x IN (value, value, ...) +// +// The left-hand side (LHS) is a scalar or vector expression. The +// right-hand side (RHS) is an array of zero or more scalar values, or a +// subquery. If the RHS is a subquery, the number of result columns must +// match the number of columns in the vector on the LHS. If the RHS is +// a list of values, the LHS must be a scalar. +// +// The IN operator is true if the LHS value is contained within the RHS. +// The result is false if the LHS is definitely not in the RHS. The +// result is NULL if the presence of the LHS in the RHS cannot be +// determined due to NULLs. +// +// This routine generates code that jumps to destIfFalse if the LHS is not +// contained within the RHS. If due to NULLs we cannot determine if the LHS +// is contained in the RHS then jump to destIfNull. If the LHS is contained +// within the RHS then fall through. +// +// See the separate in-operator.md documentation file in the canonical +// SQLite source tree for additional information. +func sqlite3ExprCodeIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, destIfFalse int32, destIfNull int32) { /* sqlite3.c:104481:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var rRhsHasNull int32 at bp, 4 + // Register that is true if RHS contains NULL values + var eType int32 // Type of the RHS + var rLhs int32 // Register(s) holding the LHS values + var rLhsOrig int32 // LHS values prior to reordering by aiMap[] + var v uintptr // Statement under construction + var aiMap uintptr // Map from vector field to index column + var zAff uintptr // Affinity string for comparisons + var nVector int32 // Size of vectors for this IN operator + // var iDummy int32 at bp+8, 4 + // Dummy parameter to exprCodeVector() + var pLeft uintptr // The LHS of the IN operator + var i int32 // loop counter + var destStep2 int32 // Where to jump when NULLs seen in step 2 + var destStep6 int32 // Start of code for Step 6 + var addrTruthOp int32 // Address of opcode that determines the IN is true + var destNotNull int32 // Jump here if a comparison is not true in step 6 + var addrTop int32 // Top of the step-6 loop + // var iTab int32 at bp+4, 4 + // Index to use + var okConstFactor U8 + var op int32 + var op1 int32 + var pList uintptr + var pColl uintptr + var labelOk int32 + var r2 int32 + // var regToFree int32 at bp+12, 4 + + var regCkNull int32 + var ii int32 + var p uintptr + var p1 uintptr + var pColl1 uintptr + var r3 int32 + *(*int32)(unsafe.Pointer(bp /* rRhsHasNull */)) = 0 + aiMap = uintptr(0) + zAff = uintptr(0) + destStep6 = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)) = 0 + okConstFactor = (*Parse)(unsafe.Pointer(pParse)).FokConstFactor + + pLeft = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + if !(Xsqlite3ExprCheckIN(tls, pParse, pExpr) != 0) { + goto __1 + } + return +__1: + ; + zAff = exprINAffinity(tls, pParse, pExpr) + nVector = Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + aiMap = Xsqlite3DbMallocZero(tls, + (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64((uint64(nVector) * (uint64(unsafe.Sizeof(int32(0))) + uint64(unsafe.Sizeof(int8(0))))) + uint64(1)))) + if !((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + goto __2 + } + goto sqlite3ExprCodeIN_oom_error +__2: + ; + + // Attempt to compute the RHS. After this step, if anything other than + // IN_INDEX_NOOP is returned, the table opened with cursor iTab + // contains the values that make up the RHS. If IN_INDEX_NOOP is returned, + // the RHS has not yet been coded. + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + // OOM detected prior to this routine + + eType = Xsqlite3FindInIndex(tls, pParse, pExpr, + (uint32(IN_INDEX_MEMBERSHIP | IN_INDEX_NOOP_OK)), + func() uintptr { + if destIfFalse == destIfNull { + return uintptr(0) + } + return bp /* &rRhsHasNull */ + }(), + aiMap, bp+4 /* &iTab */) + + // Code the LHS, the from " IN (...)". If the LHS is a + // vector, then it is stored in an array of nVector registers starting + // at r1. + // + // sqlite3FindInIndex() might have reordered the fields of the LHS vector + // so that the fields are in the same order as an existing index. The + // aiMap[] array contains a mapping from the original LHS field order to + // the field order that matches the RHS index. + // + // Avoid factoring the LHS of the IN(...) expression out of the loop, + // even if it is constant, as OP_Affinity may be used on the register + // by code generated below. + + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = U8(0) + rLhsOrig = exprCodeVector(tls, pParse, pLeft, bp+8 /* &iDummy */) + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = okConstFactor + i = 0 +__3: + if !((i < nVector) && (*(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4)) == i)) { + goto __5 + } + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; // Are LHS fields reordered? + if !(i == nVector) { + goto __6 + } + // LHS fields are not reordered + rLhs = rLhsOrig + goto __7 +__6: + // Need to reorder the LHS fields according to aiMap + rLhs = Xsqlite3GetTempRange(tls, pParse, nVector) + i = 0 +__8: + if !(i < nVector) { + goto __10 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, (rLhsOrig + i), (rLhs + *(*int32)(unsafe.Pointer(aiMap + uintptr(i)*4))), 0) + goto __9 +__9: + i++ + goto __8 + goto __10 +__10: + ; +__7: + ; + + // If sqlite3FindInIndex() did not find or create an index that is + // suitable for evaluating the IN operator, then evaluate using a + // sequence of comparisons. + // + // This is step (1) in the in-operator.md optimized algorithm. + if !(eType == IN_INDEX_NOOP) { + goto __11 + } + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + pColl = Xsqlite3ExprCollSeq(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + labelOk = Xsqlite3VdbeMakeLabel(tls, pParse) + regCkNull = 0 + + if !(destIfNull != destIfFalse) { + goto __12 + } + regCkNull = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_BitAnd, rLhs, rLhs, regCkNull) +__12: + ; + ii = 0 +__13: + if !(ii < (*ExprList)(unsafe.Pointer(pList)).FnExpr) { + goto __15 + } + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(ii)*32)).FpExpr, bp+12 /* ®ToFree */) + if !((regCkNull != 0) && (Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(ii)*32)).FpExpr) != 0)) { + goto __16 + } + Xsqlite3VdbeAddOp3(tls, v, OP_BitAnd, regCkNull, r2, regCkNull) +__16: + ; + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 12 /* regToFree */))) + if !((ii < ((*ExprList)(unsafe.Pointer(pList)).FnExpr - 1)) || (destIfNull != destIfFalse)) { + goto __17 + } + if rLhs != r2 { + op = OP_Eq + } else { + op = OP_NotNull + } + Xsqlite3VdbeAddOp4(tls, v, op, rLhs, labelOk, r2, + pColl, -2) + + Xsqlite3VdbeChangeP5(tls, v, uint16(*(*int8)(unsafe.Pointer(zAff)))) + goto __18 +__17: + if rLhs != r2 { + op1 = OP_Ne + } else { + op1 = OP_IsNull + } + + Xsqlite3VdbeAddOp4(tls, v, op1, rLhs, destIfFalse, r2, + pColl, -2) + + Xsqlite3VdbeChangeP5(tls, v, (uint16(int32(*(*int8)(unsafe.Pointer(zAff))) | SQLITE_JUMPIFNULL))) +__18: + ; + goto __14 +__14: + ii++ + goto __13 + goto __15 +__15: + ; + if !(regCkNull != 0) { + goto __19 + } + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, regCkNull, destIfNull) + Xsqlite3VdbeGoto(tls, v, destIfFalse) +__19: + ; + Xsqlite3VdbeResolveLabel(tls, v, labelOk) + Xsqlite3ReleaseTempReg(tls, pParse, regCkNull) + goto sqlite3ExprCodeIN_finished +__11: + ; + + // Step 2: Check to see if the LHS contains any NULL columns. If the + // LHS does contain NULLs then the result must be either FALSE or NULL. + // We will then skip the binary search of the RHS. + if !(destIfNull == destIfFalse) { + goto __20 + } + destStep2 = destIfFalse + goto __21 +__20: + destStep2 = libc.AssignInt32(&destStep6, Xsqlite3VdbeMakeLabel(tls, pParse)) +__21: + ; + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __22 + } + goto sqlite3ExprCodeIN_finished +__22: + ; + i = 0 +__23: + if !(i < nVector) { + goto __25 + } + p = Xsqlite3VectorFieldSubexpr(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, i) + if !((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + goto __26 + } + goto sqlite3ExprCodeIN_oom_error +__26: + ; + if !(Xsqlite3ExprCanBeNull(tls, p) != 0) { + goto __27 + } + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (rLhs + i), destStep2) + +__27: + ; + goto __24 +__24: + i++ + goto __23 + goto __25 +__25: + ; + + // Step 3. The LHS is now known to be non-NULL. Do the binary search + // of the RHS using the LHS as a probe. If found, the result is + // true. + if !(eType == IN_INDEX_ROWID) { + goto __28 + } + // In this case, the RHS is the ROWID of table b-tree and so we also + // know that the RHS is non-NULL. Hence, we combine steps 3 and 4 + // into a single opcode. + Xsqlite3VdbeAddOp3(tls, v, OP_SeekRowid, *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)), destIfFalse, rLhs) + + addrTruthOp = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) // Return True + goto __29 +__28: + Xsqlite3VdbeAddOp4(tls, v, OP_Affinity, rLhs, nVector, 0, zAff, nVector) + if !(destIfFalse == destIfNull) { + goto __30 + } + // Combine Step 3 and Step 5 into a single opcode + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)), destIfFalse, + rLhs, nVector) + goto sqlite3ExprCodeIN_finished +__30: + ; + // Ordinary Step 3, for the case where FALSE and NULL are distinct + addrTruthOp = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)), 0, + rLhs, nVector) +__29: + ; + + // Step 4. If the RHS is known to be non-NULL and we did not find + // an match on the search above, then the result must be FALSE. + if !((*(*int32)(unsafe.Pointer(bp /* rRhsHasNull */)) != 0) && (nVector == 1)) { + goto __31 + } + Xsqlite3VdbeAddOp2(tls, v, OP_NotNull, *(*int32)(unsafe.Pointer(bp /* rRhsHasNull */)), destIfFalse) + +__31: + ; + + // Step 5. If we do not care about the difference between NULL and + // FALSE, then just return false. + if !(destIfFalse == destIfNull) { + goto __32 + } + Xsqlite3VdbeGoto(tls, v, destIfFalse) +__32: + ; + + // Step 6: Loop through rows of the RHS. Compare each row to the LHS. + // If any comparison is NULL, then the result is NULL. If all + // comparisons are FALSE then the final result is FALSE. + // + // For a scalar LHS, it is sufficient to check just the first row + // of the RHS. + if !(destStep6 != 0) { + goto __33 + } + Xsqlite3VdbeResolveLabel(tls, v, destStep6) +__33: + ; + addrTop = Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)), destIfFalse) + + if !(nVector > 1) { + goto __34 + } + destNotNull = Xsqlite3VdbeMakeLabel(tls, pParse) + goto __35 +__34: + // For nVector==1, combine steps 6 and 7 by immediately returning + // FALSE if the first comparison is not NULL + destNotNull = destIfFalse +__35: + ; + i = 0 +__36: + if !(i < nVector) { + goto __38 + } + r3 = Xsqlite3GetTempReg(tls, pParse) + p1 = Xsqlite3VectorFieldSubexpr(tls, pLeft, i) + pColl1 = Xsqlite3ExprCollSeq(tls, pParse, p1) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)), i, r3) + Xsqlite3VdbeAddOp4(tls, v, OP_Ne, (rLhs + i), destNotNull, r3, + pColl1, -2) + + Xsqlite3ReleaseTempReg(tls, pParse, r3) + goto __37 +__37: + i++ + goto __36 + goto __38 +__38: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, destIfNull) + if !(nVector > 1) { + goto __39 + } + Xsqlite3VdbeResolveLabel(tls, v, destNotNull) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, *(*int32)(unsafe.Pointer(bp + 4 /* iTab */)), (addrTop + 1)) + + // Step 7: If we reach this point, we know that the result must + // be false. + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, destIfFalse) +__39: + ; + + // Jumps here in order to return true. + Xsqlite3VdbeJumpHere(tls, v, addrTruthOp) + +sqlite3ExprCodeIN_finished: + if !(rLhs != rLhsOrig) { + goto __40 + } + Xsqlite3ReleaseTempReg(tls, pParse, rLhs) +__40: + ; + +sqlite3ExprCodeIN_oom_error: + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiMap) + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, zAff) +} + +// Generate an instruction that will put the floating point +// value described by z[0..n-1] into register iMem. +// +// The z[] string will probably not be zero-terminated. But the +// z[n] character is guaranteed to be something that does not look +// like the continuation of the number. +func codeReal(tls *libc.TLS, v uintptr, z uintptr, negateFlag int32, iMem int32) { /* sqlite3.c:104738:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if z != uintptr(0) { + // var value float64 at bp, 8 + + Xsqlite3AtoF(tls, z, bp /* &value */, Xsqlite3Strlen30(tls, z), uint8(SQLITE_UTF8)) + // The new AtoF never returns NaN + if negateFlag != 0 { + *(*float64)(unsafe.Pointer(bp /* value */)) = -*(*float64)(unsafe.Pointer(bp /* value */)) + } + Xsqlite3VdbeAddOp4Dup8(tls, v, OP_Real, 0, iMem, 0, bp /* &value */, -13) + } +} + +// Generate an instruction that will put the integer describe by +// text z[0..n-1] into register iMem. +// +// Expr.u.zToken is always UTF8 and zero-terminated. +func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iMem int32) { /* sqlite3.c:104756:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_IntValue)) != 0 { + var i int32 = *(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */)) + + if negFlag != 0 { + i = -i + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, i, iMem) + } else { + var c int32 + // var value I64 at bp+16, 8 + + var z uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + + c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) + if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { + if Xsqlite3_strnicmp(tls, z, ts+6916 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6919 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if negFlag != 0 { + return ts + 4042 /* "-" */ + } + return ts + 756 /* "" */ + }(), z)) + } else { + codeReal(tls, v, z, negFlag, iMem) + } + } else { + if negFlag != 0 { + if c == 3 { + *(*I64)(unsafe.Pointer(bp + 16 /* value */)) = ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + } else { + *(*I64)(unsafe.Pointer(bp + 16 /* value */)) = -*(*I64)(unsafe.Pointer(bp + 16 /* value */)) + } + } + Xsqlite3VdbeAddOp4Dup8(tls, v, OP_Int64, 0, iMem, 0, bp+16 /* &value */, -14) + } + } +} + +// Generate code that will load into register regOut a value that is +// appropriate for the iIdxCol-th column of index pIdx. +func Xsqlite3ExprCodeLoadIndexColumn(tls *libc.TLS, pParse uintptr, pIdx uintptr, iTabCur int32, iIdxCol int32, regOut int32) { /* sqlite3.c:104793:21: */ + var iTabCol I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iIdxCol)*2)) + if int32(iTabCol) == (-2) { + + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = (iTabCur + 1) + Xsqlite3ExprCodeCopy(tls, pParse, (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr+8 /* &.a */)+uintptr(iIdxCol)*32)).FpExpr, regOut) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + } else { + Xsqlite3ExprCodeGetColumnOfTable(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, (*Index)(unsafe.Pointer(pIdx)).FpTable, iTabCur, + int32(iTabCol), regOut) + } +} + +// Generate code that will compute the value of generated column pCol +// and store the result in register regOut +func Xsqlite3ExprCodeGeneratedColumn(tls *libc.TLS, pParse uintptr, pCol uintptr, regOut int32) { /* sqlite3.c:104818:21: */ + var iAddr int32 + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + if (*Parse)(unsafe.Pointer(pParse)).FiSelfTab > 0 { + iAddr = Xsqlite3VdbeAddOp3(tls, v, OP_IfNullRow, ((*Parse)(unsafe.Pointer(pParse)).FiSelfTab - 1), 0, regOut) + } else { + iAddr = 0 + } + Xsqlite3ExprCodeCopy(tls, pParse, (*Column)(unsafe.Pointer(pCol)).FpDflt, regOut) + if int32((*Column)(unsafe.Pointer(pCol)).Faffinity) >= SQLITE_AFF_TEXT { + Xsqlite3VdbeAddOp4(tls, v, OP_Affinity, regOut, 1, 0, (pCol + 25 /* &.affinity */), 1) + } + if iAddr != 0 { + Xsqlite3VdbeJumpHere(tls, v, iAddr) + } +} + +// Generate code to extract the value of the iCol-th column of a table. +func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iTabCur int32, iCol int32, regOut int32) { /* sqlite3.c:104843:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pCol uintptr + + if pTab == uintptr(0) { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iTabCur, iCol, regOut) + return + } + if (iCol < 0) || (iCol == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iTabCur, regOut) + } else { + var op int32 + var x int32 + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + op = OP_VColumn + x = iCol + } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { + var pParse uintptr = Xsqlite3VdbeParser(tls, v) + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6945 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + } else { + var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = (iTabCur + 1) + Xsqlite3ExprCodeGeneratedColumn(tls, pParse, pCol, regOut) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = savedSelfTab + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(COLFLAG_BUSY))) + } + return + } else if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + + x = int32(Xsqlite3TableColumnToIndex(tls, Xsqlite3PrimaryKeyIndex(tls, pTab), int16(iCol))) + op = OP_Column + } else { + x = int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(iCol))) + + op = OP_Column + } + Xsqlite3VdbeAddOp3(tls, v, op, iTabCur, x, regOut) + Xsqlite3ColumnDefault(tls, v, pTab, iCol, regOut) + } +} + +// Generate code that will extract the iColumn-th column from +// table pTab and store the column value in register iReg. +// +// There must be an open cursor to pTab in iTable when this routine +// is called. If iColumn<0 then code is generated that extracts the rowid. +func Xsqlite3ExprCodeGetColumn(tls *libc.TLS, pParse uintptr, pTab uintptr, iColumn int32, iTable int32, iReg int32, p5 U8) int32 { /* sqlite3.c:104900:20: */ + + Xsqlite3ExprCodeGetColumnOfTable(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, pTab, iTable, iColumn, iReg) + if p5 != 0 { + var pOp uintptr = Xsqlite3VdbeGetOp(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, -1) + if int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Column { + (*VdbeOp)(unsafe.Pointer(pOp)).Fp5 = U16(p5) + } + } + return iReg +} + +// Generate code to move content from registers iFrom...iFrom+nReg-1 +// over to iTo..iTo+nReg-1. +func Xsqlite3ExprCodeMove(tls *libc.TLS, pParse uintptr, iFrom int32, iTo int32, nReg int32) { /* sqlite3.c:104921:21: */ + Xsqlite3VdbeAddOp3(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Move, iFrom, iTo, nReg) +} + +// Convert a scalar expression node to a TK_REGISTER referencing +// register iReg. The caller must ensure that iReg already contains +// the correct value for the expression. +func exprToRegister(tls *libc.TLS, pExpr uintptr, iReg int32) { /* sqlite3.c:104930:13: */ + var p uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, pExpr) + if p == uintptr(0) { + return + } + (*Expr)(unsafe.Pointer(p)).Fop2 = (*Expr)(unsafe.Pointer(p)).Fop + (*Expr)(unsafe.Pointer(p)).Fop = U8(TK_REGISTER) + (*Expr)(unsafe.Pointer(p)).FiTable = iReg + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Skip))) +} + +// Evaluate an expression (either a vector or a scalar expression) and store +// the result in continguous temporary registers. Return the index of +// the first register used to store the result. +// +// If the returned result register is a temporary scalar, then also write +// that register number into *piFreeable. If the returned result register +// is not a temporary or if the expression is a vector set *piFreeable +// to 0. +func exprCodeVector(tls *libc.TLS, pParse uintptr, p uintptr, piFreeable uintptr) int32 { /* sqlite3.c:104949:12: */ + var iResult int32 + var nResult int32 = Xsqlite3ExprVectorSize(tls, p) + if nResult == 1 { + iResult = Xsqlite3ExprCodeTemp(tls, pParse, p, piFreeable) + } else { + *(*int32)(unsafe.Pointer(piFreeable)) = 0 + if int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_SELECT { + iResult = Xsqlite3CodeSubselect(tls, pParse, p) + } else { + var i int32 + iResult = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nResult) + for i = 0; i < nResult; i++ { + Xsqlite3ExprCodeFactorable(tls, pParse, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */))+8 /* &.a */)+uintptr(i)*32)).FpExpr, (i + iResult)) + } + } + } + return iResult +} + +// If the last opcode is a OP_Copy, then set the do-not-merge flag (p5) +// so that a subsequent copy will not be merged into this one. +func setDoNotMergeFlagOnCopy(tls *libc.TLS, v uintptr) { /* sqlite3.c:104978:13: */ + if int32((*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, -1))).Fopcode) == OP_Copy { + Xsqlite3VdbeChangeP5(tls, v, uint16(1)) // Tag trailing OP_Copy as not mergable + } +} + +// Generate code to implement special SQL functions that are implemented +// in-line rather than by using the usual callbacks. +func exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFuncId int32, target int32) int32 { /* sqlite3.c:104988:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var nFarg int32 + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + nFarg = (*ExprList)(unsafe.Pointer(pFarg)).FnExpr + // All in-line functions have at least one argument + switch iFuncId { + case INLINEFUNC_coalesce: + { + // Attempt a direct implementation of the built-in COALESCE() and + // IFNULL() functions. This avoids unnecessary evaluation of + // arguments past the first non-NULL argument. + var endCoalesce int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var i int32 + + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */))).FpExpr, target) + for i = 1; i < nFarg; i++ { + Xsqlite3VdbeAddOp2(tls, v, OP_NotNull, target, endCoalesce) + + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */)+uintptr(i)*32)).FpExpr, target) + } + setDoNotMergeFlagOnCopy(tls, v) + Xsqlite3VdbeResolveLabel(tls, v, endCoalesce) + break + + } + case INLINEFUNC_iif: + { + // var caseExpr Expr at bp, 72 + + libc.Xmemset(tls, bp /* &caseExpr */, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(bp /* &caseExpr */)).Fop = U8(TK_CASE) + *(*uintptr)(unsafe.Pointer(bp /* &caseExpr */ + 32 /* &.x */)) = pFarg + return Xsqlite3ExprCodeTarget(tls, pParse, bp /* &caseExpr */, target) + + } + + default: + { + // The UNLIKELY() function is a no-op. The result is the value + // of the first argument. + + target = Xsqlite3ExprCodeTarget(tls, pParse, (*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */))).FpExpr, target) + break + + } + + // ********************************************************************** + // + // Test-only SQL functions that are only usable if enabled + // via SQLITE_TESTCTRL_INTERNAL_FUNCTIONS + case INLINEFUNC_expr_compare: + { + // Compare two expressions using sqlite3ExprCompare() + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, + Xsqlite3ExprCompare(tls, uintptr(0), (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */))).FpExpr, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */)+1*32)).FpExpr, -1), + target) + break + + } + + case INLINEFUNC_expr_implies_expr: + { + // Compare two expressions using sqlite3ExprImpliesExpr() + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, + Xsqlite3ExprImpliesExpr(tls, pParse, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */))).FpExpr, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */)+1*32)).FpExpr, -1), + target) + break + + } + + case INLINEFUNC_implies_nonnull_row: + { + // REsult of sqlite3ExprImpliesNonNullRow() + var pA1 uintptr + + pA1 = (*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */) + 1*32)).FpExpr + if int32((*Expr)(unsafe.Pointer(pA1)).Fop) == TK_COLUMN { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, + Xsqlite3ExprImpliesNonNullRow(tls, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */))).FpExpr, (*Expr)(unsafe.Pointer(pA1)).FiTable), + target) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, target) + } + break + + } + + } + return target +} + +// Generate code into the current Vdbe to evaluate the given +// expression. Attempt to store the results in register "target". +// Return the register where results are stored. +// +// With this routine, there is no guarantee that results will +// be stored in target. The result might be stored in some other +// register if it is convenient to do so. The calling function +// must check the return code and move the results to the desired +// register. +func Xsqlite3ExprCodeTarget(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) int32 { /* sqlite3.c:105104:20: */ + bp := tls.Alloc(192) + defer tls.Free(192) + + var v uintptr // The VM under construction + var op int32 // The opcode being coded + var inReg int32 // Results stored in register inReg + // var regFree1 int32 at bp+40, 4 + // If non-zero free this temporary register + // var regFree2 int32 at bp+44, 4 + // If non-zero free this temporary register + var r1 int32 + var r2 int32 // Various register numbers + // var tempX Expr at bp+48, 72 + // Temporary expression node + var p5 int32 + var pTab uintptr + var pAggInfo uintptr + var pCol uintptr + // This COLUMN expression is really a constant due to WHERE clause + // constraints, and that constant is coded by the pExpr->pLeft + // expresssion. However, make sure the constant has the correct + // datatype by applying the Affinity of the table column to the + // constant. + var aff int32 + // Other columns in the same row for CHECK constraints or + // generated columns or for inserting into partial index. + // The row is unpacked into registers beginning at + // 0-(pParse->iSelfTab). The rowid (if any) is in a register + // immediately prior to the first column. + var pCol1 uintptr + var pTab1 uintptr + var iSrc int32 + var iCol int32 + var iTab int32 + var iReg int32 + var n int32 + var z uintptr + var zBlob uintptr + var z1 uintptr + var pLeft uintptr + var pLeft1 uintptr + var isTrue int32 // IS TRUE or IS NOT TRUE + var bNormal int32 + var addr int32 + var pInfo uintptr + var exprOp U8 + var pArg uintptr + var pFarg uintptr // List of function arguments + var nFarg int32 // Number of function arguments + var pDef uintptr // The function definition object + var zId uintptr // The function name + var constMask U32 // Mask of function arguments that are constant + var i int32 // Loop counter + var db uintptr // The database connection + var enc U8 // The text encoding used by this database + var pColl uintptr + var nCol int32 + var n1 int32 + var destIfFalse int32 + var destIfNull int32 + // If the opcode is TK_TRIGGER, then the expression is a reference + // to a column in the new.* or old.* pseudo-tables available to + // trigger programs. In this case Expr.iTable is set to 1 for the + // new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn + // is set to the column of the pseudo-table to read, or to -1 to + // read the rowid field. + // + // The expression is implemented using an OP_Param opcode. The p1 + // parameter is set to 0 for an old.rowid reference, or to (i+1) + // to reference another column of the old.* pseudo-table, where + // i is the index of the column. For a new.rowid reference, p1 is + // set to (n+1), where n is the number of columns in each pseudo-table. + // For a reference to any other column in the new.* pseudo-table, p1 + // is set to (n+2+i), where n and i are as defined previously. For + // example, if the table on which triggers are being fired is + // declared as: + // + // CREATE TABLE t1(a, b); + // + // Then p1 is interpreted as follows: + // + // p1==0 -> old.rowid p1==3 -> new.rowid + // p1==1 -> old.a p1==4 -> new.a + // p1==2 -> old.b p1==5 -> new.b + var pTab2 uintptr + var iCol1 int32 + var p1 int32 + var addrINR int32 + var okConstFactor U8 + var endLabel int32 // GOTO label for end of CASE stmt + var nextCase int32 // GOTO label for next WHEN clause + var nExpr int32 // 2x number of WHEN terms + var i1 int32 // Loop counter + var pEList uintptr // List of WHEN terms + var aListelem uintptr // Array of WHEN terms + // var opCompare Expr at bp+120, 72 + // The X==Ei expression + var pX uintptr // The X expression + var pTest uintptr // X==Ei (form A) or just Ei (form B) + var pDel uintptr + var db1 uintptr + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + inReg = target + *(*int32)(unsafe.Pointer(bp + 40 /* regFree1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 44 /* regFree2 */)) = 0 + p5 = 0 + +expr_code_doover: + if !(pExpr == uintptr(0)) { + goto __1 + } + op = TK_NULL + goto __2 +__1: + ; + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) +__2: + ; + switch op { + case TK_AGG_COLUMN: + goto __4 + case TK_COLUMN: + goto __5 + case TK_INTEGER: + goto __6 + case TK_TRUEFALSE: + goto __7 + case TK_FLOAT: + goto __8 + case TK_STRING: + goto __9 + default: + goto __10 + case TK_BLOB: + goto __11 + case TK_VARIABLE: + goto __12 + case TK_REGISTER: + goto __13 + case TK_CAST: + goto __14 + case TK_IS: + goto __15 + case TK_ISNOT: + goto __16 + // fall-through + case TK_LT: + goto __17 + case TK_LE: + goto __18 + case TK_GT: + goto __19 + case TK_GE: + goto __20 + case TK_NE: + goto __21 + case TK_EQ: + goto __22 + case TK_AND: + goto __23 + case TK_OR: + goto __24 + case TK_PLUS: + goto __25 + case TK_STAR: + goto __26 + case TK_MINUS: + goto __27 + case TK_REM: + goto __28 + case TK_BITAND: + goto __29 + case TK_BITOR: + goto __30 + case TK_SLASH: + goto __31 + case TK_LSHIFT: + goto __32 + case TK_RSHIFT: + goto __33 + case TK_CONCAT: + goto __34 + case TK_UMINUS: + goto __35 + case TK_BITNOT: + goto __36 + case TK_NOT: + goto __37 + case TK_TRUTH: + goto __38 + case TK_ISNULL: + goto __39 + case TK_NOTNULL: + goto __40 + case TK_AGG_FUNCTION: + goto __41 + case TK_FUNCTION: + goto __42 + case TK_EXISTS: + goto __43 + case TK_SELECT: + goto __44 + case TK_SELECT_COLUMN: + goto __45 + case TK_IN: + goto __46 + + // x BETWEEN y AND z + // + // This is equivalent to + // + // x>=y AND x<=z + // + // X is stored in pExpr->pLeft. + // Y is stored in pExpr->pList->a[0].pExpr. + // Z is stored in pExpr->pList->a[1].pExpr. + case TK_BETWEEN: + goto __47 + case TK_SPAN: + goto __48 + case TK_COLLATE: + goto __49 + case TK_UPLUS: + goto __50 + + case TK_TRIGGER: + goto __51 + + case TK_VECTOR: + goto __52 + + // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions + // that derive from the right-hand table of a LEFT JOIN. The + // Expr.iTable value is the table number for the right-hand table. + // The expression is only evaluated if that table is not currently + // on a LEFT JOIN NULL row. + case TK_IF_NULL_ROW: + goto __53 + + // Form A: + // CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END + // + // Form B: + // CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END + // + // Form A is can be transformed into the equivalent form B as follows: + // CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ... + // WHEN x=eN THEN rN ELSE y END + // + // X (if it exists) is in pExpr->pLeft. + // Y is in the last element of pExpr->x.pList if pExpr->x.pList->nExpr is + // odd. The Y is also optional. If the number of elements in x.pList + // is even, then Y is omitted and the "otherwise" result is NULL. + // Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1]. + // + // The result of the expression is the Ri for the first matching Ei, + // or if there is no matching Ei, the ELSE term Y, or if there is + // no ELSE term, NULL. + case TK_CASE: + goto __54 + case TK_RAISE: + goto __55 + } + goto __3 +__4: + pAggInfo = (*Expr)(unsafe.Pointer(pExpr)).FpAggInfo + + pCol = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32) + if !(!(int32((*AggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode) != 0)) { + goto __56 + } + + return (*AggInfo_col)(unsafe.Pointer(pCol)).FiMem + goto __57 +__56: + if !((*AggInfo)(unsafe.Pointer(pAggInfo)).FuseSortingIdx != 0) { + goto __58 + } + pTab = (*AggInfo_col)(unsafe.Pointer(pCol)).FpTab + Xsqlite3VdbeAddOp3(tls, v, OP_Column, (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdxPTab, + int32((*AggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn), target) + if !(int32((*AggInfo_col)(unsafe.Pointer(pCol)).FiColumn) < 0) { + goto __59 + } + + goto __60 +__59: + ; + if !(int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*AggInfo_col)(unsafe.Pointer(pCol)).FiColumn)*32)).Faffinity) == SQLITE_AFF_REAL) { + goto __61 + } + Xsqlite3VdbeAddOp1(tls, v, OP_RealAffinity, target) +__61: + ; +__60: + ; + return target +__58: + ; +__57: + ; + +__5: + iTab = (*Expr)(unsafe.Pointer(pExpr)).FiTable + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FixedCol))) != U32(0)) { + goto __62 + } + iReg = Xsqlite3ExprCodeTarget(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, target) + if !(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) != 0) { + goto __63 + } + aff = int32(Xsqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)), int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn))) + goto __64 +__63: + aff = int32((*Expr)(unsafe.Pointer(pExpr)).FaffExpr) +__64: + ; + if !(aff > SQLITE_AFF_BLOB) { + goto __65 + } + + Xsqlite3VdbeAddOp4(tls, v, OP_Affinity, iReg, 1, 0, + (uintptr(unsafe.Pointer(&zAff)) + uintptr(((aff - 'B') * 2))), -1) +__65: + ; + return iReg +__62: + ; + if !(iTab < 0) { + goto __66 + } + if !((*Parse)(unsafe.Pointer(pParse)).FiSelfTab < 0) { + goto __67 + } + pTab1 = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + iCol = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + + if !(iCol < 0) { + goto __69 + } + return (-1 - (*Parse)(unsafe.Pointer(pParse)).FiSelfTab) +__69: + ; + pCol1 = ((*Table)(unsafe.Pointer(pTab1)).FaCol + uintptr(iCol)*32) + + iSrc = (int32(Xsqlite3TableColumnToStorage(tls, pTab1, int16(iCol))) - (*Parse)(unsafe.Pointer(pParse)).FiSelfTab) + if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_GENERATED) != 0) { + goto __70 + } + if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { + goto __72 + } + Xsqlite3ErrorMsg(tls, pParse, ts+6945, /* "generated column..." */ + libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) + return 0 +__72: + ; + *(*U16)(unsafe.Pointer(pCol1 + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) + if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_NOTAVAIL) != 0) { + goto __73 + } + Xsqlite3ExprCodeGeneratedColumn(tls, pParse, pCol1, iSrc) +__73: + ; + *(*U16)(unsafe.Pointer(pCol1 + 28 /* &.colFlags */)) &= libc.Uint16FromInt32((libc.CplInt32((COLFLAG_BUSY | COLFLAG_NOTAVAIL)))) + return iSrc + goto __71 +__70: + if !(int32((*Column)(unsafe.Pointer(pCol1)).Faffinity) == SQLITE_AFF_REAL) { + goto __74 + } + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, iSrc, target) + Xsqlite3VdbeAddOp1(tls, v, OP_RealAffinity, target) + return target + goto __75 +__74: + return iSrc +__75: + ; +__71: + ; + goto __68 +__67: + // Coding an expression that is part of an index where column names + // in the index refer to the table to which the index belongs + iTab = ((*Parse)(unsafe.Pointer(pParse)).FiSelfTab - 1) +__68: + ; +__66: + ; + iReg = Xsqlite3ExprCodeGetColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)), + int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn), iTab, target, + (*Expr)(unsafe.Pointer(pExpr)).Fop2) + if !((*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) == uintptr(0)) && (int32((*Expr)(unsafe.Pointer(pExpr)).FaffExpr) == SQLITE_AFF_REAL)) { + goto __76 + } + Xsqlite3VdbeAddOp1(tls, v, OP_RealAffinity, iReg) +__76: + ; + return iReg + +__6: + codeInteger(tls, pParse, pExpr, 0, target) + return target + +__7: + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, Xsqlite3ExprTruthValue(tls, pExpr), target) + return target + +__8: + ; + codeReal(tls, v, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), 0, target) + return target + +__9: + ; + Xsqlite3VdbeLoadString(tls, v, target, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */))) + return target + +__10: + // Make NULL the default case so that if a bug causes an illegal + // Expr node to be passed into this function, it will be handled + // sanely and not crash. But keep the assert() to bring the problem + // to the attention of the developers. + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, target) + return target + +__11: + ; + + z = (*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 2) + n = (Xsqlite3Strlen30(tls, z) - 1) + + zBlob = Xsqlite3HexToBlob(tls, Xsqlite3VdbeDb(tls, v), z, n) + Xsqlite3VdbeAddOp4(tls, v, OP_Blob, (n / 2), target, 0, zBlob, -7) + return target + +__12: + ; + + Xsqlite3VdbeAddOp2(tls, v, OP_Variable, int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn), target) + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 1))) != 0) { + goto __77 + } + z1 = Xsqlite3VListNumToName(tls, (*Parse)(unsafe.Pointer(pParse)).FpVList, int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) + + *(*VList)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).FpVList)) = 0 // Indicate VList may no longer be enlarged + Xsqlite3VdbeAppendP4(tls, v, z1, -1) +__77: + ; + return target + +__13: + return (*Expr)(unsafe.Pointer(pExpr)).FiTable + +__14: + // Expressions of the form: CAST(pLeft AS token) + inReg = Xsqlite3ExprCodeTarget(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, target) + if !(inReg != target) { + goto __78 + } + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, inReg, target) + inReg = target +__78: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Cast, target, + int32(Xsqlite3AffinityType(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), uintptr(0)))) + return inReg + +__15: +__16: + if op == TK_IS { + op = TK_EQ + } else { + op = TK_NE + } + p5 = SQLITE_NULLEQ + // fall-through +__17: +__18: +__19: +__20: +__21: +__22: + pLeft = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + if !(Xsqlite3ExprIsVector(tls, pLeft) != 0) { + goto __79 + } + codeVectorCompare(tls, pParse, pExpr, target, uint8(op), uint8(p5)) + goto __80 +__79: + r1 = Xsqlite3ExprCodeTemp(tls, pParse, pLeft, bp+40 /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+44 /* ®Free2 */) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, inReg) + codeCompare(tls, pParse, pLeft, (*Expr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, + (Xsqlite3VdbeCurrentAddr(tls, v) + 2), p5, + (libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Commuted))) != U32(0)))) + + if !(p5 == SQLITE_NULLEQ) { + goto __81 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, inReg) + goto __82 +__81: + Xsqlite3VdbeAddOp3(tls, v, OP_ZeroOrNull, r1, inReg, r2) +__82: + ; + +__80: + ; + goto __3 + +__23: +__24: +__25: +__26: +__27: +__28: +__29: +__30: +__31: +__32: +__33: +__34: + ; + + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+44 /* ®Free2 */) + Xsqlite3VdbeAddOp3(tls, v, op, r2, r1, target) + + goto __3 + +__35: + pLeft1 = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + + if !(int32((*Expr)(unsafe.Pointer(pLeft1)).Fop) == TK_INTEGER) { + goto __83 + } + codeInteger(tls, pParse, pLeft1, 1, target) + return target + goto __84 +__83: + if !(int32((*Expr)(unsafe.Pointer(pLeft1)).Fop) == TK_FLOAT) { + goto __85 + } + + codeReal(tls, v, *(*uintptr)(unsafe.Pointer(pLeft1 + 8 /* &.u */)), 1, target) + return target + goto __86 +__85: + (*Expr)(unsafe.Pointer(bp + 48 /* &tempX */)).Fop = U8(TK_INTEGER) + (*Expr)(unsafe.Pointer(bp + 48 /* &tempX */)).Fflags = (U32(EP_IntValue | EP_TokenOnly)) + *(*int32)(unsafe.Pointer(bp + 48 /* &tempX */ + 8 /* &.u */)) = 0 + + r1 = Xsqlite3ExprCodeTemp(tls, pParse, bp+48 /* &tempX */, bp+40 /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+44 /* ®Free2 */) + Xsqlite3VdbeAddOp3(tls, v, OP_Subtract, r2, r1, target) + +__86: + ; +__84: + ; + goto __3 + +__36: +__37: + ; + + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) + + Xsqlite3VdbeAddOp2(tls, v, op, r1, inReg) + goto __3 + +__38: // IS TRUE or IS FALSE + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) + + isTrue = Xsqlite3ExprTruthValue(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + bNormal = (libc.Bool32(int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) == TK_IS)) + + Xsqlite3VdbeAddOp4Int(tls, v, OP_IsTrue, r1, inReg, libc.BoolInt32(!(isTrue != 0)), (isTrue ^ bNormal)) + goto __3 + +__39: +__40: + ; + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, target) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) + + addr = Xsqlite3VdbeAddOp1(tls, v, op, r1) + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, target) + Xsqlite3VdbeJumpHere(tls, v, addr) + goto __3 + +__41: + pInfo = (*Expr)(unsafe.Pointer(pExpr)).FpAggInfo + if !(((pInfo == uintptr(0)) || + (int32((*Expr)(unsafe.Pointer(pExpr)).FiAgg) < 0)) || + (int32((*Expr)(unsafe.Pointer(pExpr)).FiAgg) >= (*AggInfo)(unsafe.Pointer(pInfo)).FnFunc)) { + goto __87 + } + + Xsqlite3ErrorMsg(tls, pParse, ts+6975 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + goto __88 +__87: + return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32)).FiMem +__88: + ; + goto __3 + +__42: // The function name + constMask = U32(0) // Loop counter + db = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + enc = (*Sqlite3)(unsafe.Pointer(db)).Fenc // The text encoding used by this database + pColl = uintptr(0) // A collating sequence + + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + goto __89 + } + return (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FregResult +__89: + ; + + if !(((*Parse)(unsafe.Pointer(pParse)).FokConstFactor != 0) && (Xsqlite3ExprIsConstantNotJoin(tls, pExpr) != 0)) { + goto __90 + } + // SQL functions can be expensive. So try to avoid running them + // multiple times if we know they always give the same result + return Xsqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, -1) +__90: + ; + + pFarg = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + if pFarg != 0 { + nFarg = (*ExprList)(unsafe.Pointer(pFarg)).FnExpr + } else { + nFarg = 0 + } + + zId = *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + pDef = Xsqlite3FindFunction(tls, db, zId, nFarg, enc, uint8(0)) + if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { + goto __91 + } + Xsqlite3ErrorMsg(tls, pParse, ts+7001 /* "unknown function..." */, libc.VaList(bp+16, zId)) + goto __3 +__91: + ; + if !(((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_INLINE)) != 0) { + goto __92 + } + + return exprCodeInlineFunction(tls, pParse, pFarg, + int32((*FuncDef)(unsafe.Pointer(pDef)).FpUserData), target) + goto __93 +__92: + if !(((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & (U32(SQLITE_FUNC_DIRECT | SQLITE_FUNC_UNSAFE))) != 0) { + goto __94 + } + Xsqlite3ExprFunctionUsable(tls, pParse, pExpr, pDef) +__94: + ; +__93: + ; + + i = 0 +__95: + if !(i < nFarg) { + goto __97 + } + if !((i < 32) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */)+uintptr(i)*32)).FpExpr) != 0)) { + goto __98 + } + + constMask = constMask | (uint32((uint32(1))) << (i)) +__98: + ; + if !((((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != U32(0)) && !(pColl != 0)) { + goto __99 + } + pColl = Xsqlite3ExprCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */)+uintptr(i)*32)).FpExpr) +__99: + ; + goto __96 +__96: + i++ + goto __95 + goto __97 +__97: + ; + if !(pFarg != 0) { + goto __100 + } + if !(constMask != 0) { + goto __102 + } + r1 = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nFarg) + goto __103 +__102: + r1 = Xsqlite3GetTempRange(tls, pParse, nFarg) +__103: + ; + + // For length() and typeof() functions with a column argument, + // set the P5 parameter to the OP_Column opcode to OPFLAG_LENGTHARG + // or OPFLAG_TYPEOFARG respectively, to avoid unnecessary data + // loading. + if !(((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & (U32(SQLITE_FUNC_LENGTH | SQLITE_FUNC_TYPEOF))) != U32(0)) { + goto __104 + } + + exprOp = (*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */))).FpExpr)).Fop + if !((int32(exprOp) == TK_COLUMN) || (int32(exprOp) == TK_AGG_COLUMN)) { + goto __105 + } + + (*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */))).FpExpr)).Fop2 = (U8((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & (U32(OPFLAG_LENGTHARG | OPFLAG_TYPEOFARG)))) +__105: + ; +__104: + ; + + Xsqlite3ExprCodeExprList(tls, pParse, pFarg, r1, 0, + (uint8(SQLITE_ECEL_DUP | SQLITE_ECEL_FACTOR))) + goto __101 +__100: + r1 = 0 +__101: + ; + // Possibly overload the function if the first argument is + // a virtual table column. + // + // For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the + // second argument, not the first, as the argument to test to + // see if it is a column in a virtual table. This is done because + // the left operand of infix functions (the operand we want to + // control overloading) ends up as the second argument to the + // function. The expression "A glob B" is equivalent to + // "glob(B,A). We want to use the A in "A glob B" to test + // for function overloading. But we use the B term in "glob(B,A)". + if !((nFarg >= 2) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_InfixFunc))) != U32(0))) { + goto __106 + } + pDef = Xsqlite3VtabOverloadFunction(tls, db, pDef, nFarg, (*ExprList_item)(unsafe.Pointer((pFarg+8 /* &.a */)+1*32)).FpExpr) + goto __107 +__106: + if !(nFarg > 0) { + goto __108 + } + pDef = Xsqlite3VtabOverloadFunction(tls, db, pDef, nFarg, (*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */))).FpExpr) +__108: + ; +__107: + ; + if !(((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != 0) { + goto __109 + } + if !(!(pColl != 0)) { + goto __110 + } + pColl = (*Sqlite3)(unsafe.Pointer(db)).FpDfltColl +__110: + ; + Xsqlite3VdbeAddOp4(tls, v, OP_CollSeq, 0, 0, 0, pColl, -2) +__109: + ; + if !(((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_OFFSET)) != 0) { + goto __111 + } + pArg = (*ExprList_item)(unsafe.Pointer((pFarg + 8 /* &.a */))).FpExpr + if !(int32((*Expr)(unsafe.Pointer(pArg)).Fop) == TK_COLUMN) { + goto __113 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Offset, (*Expr)(unsafe.Pointer(pArg)).FiTable, int32((*Expr)(unsafe.Pointer(pArg)).FiColumn), target) + goto __114 +__113: + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, target) +__114: + ; + goto __112 +__111: + + Xsqlite3VdbeAddFunctionCall(tls, pParse, int32(constMask), r1, target, nFarg, + pDef, int32((*Expr)(unsafe.Pointer(pExpr)).Fop2)) +__112: + ; + if !(nFarg != 0) { + goto __115 + } + if !(constMask == U32(0)) { + goto __116 + } + Xsqlite3ReleaseTempRange(tls, pParse, r1, nFarg) + goto __117 +__116: + ; +__117: + ; +__115: + ; + return target + +__43: +__44: + ; + + if !((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + goto __118 + } + return 0 + goto __119 +__118: + if !((op == TK_SELECT) && ((libc.AssignInt32(&nCol, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr)) != 1)) { + goto __120 + } + Xsqlite3SubselectError(tls, pParse, nCol, 1) + goto __121 +__120: + return Xsqlite3CodeSubselect(tls, pParse, pExpr) +__121: + ; +__119: + ; + goto __3 + +__45: + if !((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).FiTable == 0) { + goto __122 + } + (*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).FiTable = Xsqlite3CodeSubselect(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) +__122: + ; + + if !(((*Expr)(unsafe.Pointer(pExpr)).FiTable != 0) && + ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { + goto __123 + } + Xsqlite3ErrorMsg(tls, pParse, ts+6628, /* "%d columns assig..." */ + libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) +__123: + ; + return ((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).FiTable + int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) + +__46: + destIfFalse = Xsqlite3VdbeMakeLabel(tls, pParse) + destIfNull = Xsqlite3VdbeMakeLabel(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, target) + sqlite3ExprCodeIN(tls, pParse, pExpr, destIfFalse, destIfNull) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, target) + Xsqlite3VdbeResolveLabel(tls, v, destIfFalse) + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, target, 0) + Xsqlite3VdbeResolveLabel(tls, v, destIfNull) + return target + + // x BETWEEN y AND z + // + // This is equivalent to + // + // x>=y AND x<=z + // + // X is stored in pExpr->pLeft. + // Y is stored in pExpr->pList->a[0].pExpr. + // Z is stored in pExpr->pList->a[1].pExpr. +__47: + exprCodeBetween(tls, pParse, pExpr, target, uintptr(0), 0) + return target + +__48: +__49: +__50: + pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + goto expr_code_doover // 2018-04-28: Prevent deep recursion. OSSFuzz. + +__51: + // If the opcode is TK_TRIGGER, then the expression is a reference + // to a column in the new.* or old.* pseudo-tables available to + // trigger programs. In this case Expr.iTable is set to 1 for the + // new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn + // is set to the column of the pseudo-table to read, or to -1 to + // read the rowid field. + // + // The expression is implemented using an OP_Param opcode. The p1 + // parameter is set to 0 for an old.rowid reference, or to (i+1) + // to reference another column of the old.* pseudo-table, where + // i is the index of the column. For a new.rowid reference, p1 is + // set to (n+1), where n is the number of columns in each pseudo-table. + // For a reference to any other column in the new.* pseudo-table, p1 + // is set to (n+2+i), where n and i are as defined previously. For + // example, if the table on which triggers are being fired is + // declared as: + // + // CREATE TABLE t1(a, b); + // + // Then p1 is interpreted as follows: + // + // p1==0 -> old.rowid p1==3 -> new.rowid + // p1==1 -> old.a p1==4 -> new.a + // p1==2 -> old.b p1==5 -> new.b + pTab2 = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + iCol1 = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + p1 = ((((*Expr)(unsafe.Pointer(pExpr)).FiTable * (int32((*Table)(unsafe.Pointer(pTab2)).FnCol) + 1)) + 1) + + int32(Xsqlite3TableColumnToStorage(tls, pTab2, int16(iCol1)))) + + Xsqlite3VdbeAddOp2(tls, v, OP_Param, p1, target) + + // If the column has REAL affinity, it may currently be stored as an + // integer. Use OP_RealAffinity to make sure it is really real. + // + // EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to + // floating point when extracting it from the record. + if !((iCol1 >= 0) && (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab2)).FaCol+uintptr(iCol1)*32)).Faffinity) == SQLITE_AFF_REAL)) { + goto __124 + } + Xsqlite3VdbeAddOp1(tls, v, OP_RealAffinity, target) +__124: + ; + goto __3 + +__52: + Xsqlite3ErrorMsg(tls, pParse, ts+5549 /* "row value misuse..." */, 0) + goto __3 + + // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions + // that derive from the right-hand table of a LEFT JOIN. The + // Expr.iTable value is the table number for the right-hand table. + // The expression is only evaluated if that table is not currently + // on a LEFT JOIN NULL row. +__53: + okConstFactor = (*Parse)(unsafe.Pointer(pParse)).FokConstFactor + addrINR = Xsqlite3VdbeAddOp1(tls, v, OP_IfNullRow, (*Expr)(unsafe.Pointer(pExpr)).FiTable) + // Temporarily disable factoring of constant expressions, since + // even though expressions may appear to be constant, they are not + // really constant because they originate from the right-hand side + // of a LEFT JOIN. + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = U8(0) + inReg = Xsqlite3ExprCodeTarget(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, target) + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = okConstFactor + Xsqlite3VdbeJumpHere(tls, v, addrINR) + Xsqlite3VdbeChangeP3(tls, v, addrINR, inReg) + goto __3 + + // Form A: + // CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END + // + // Form B: + // CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END + // + // Form A is can be transformed into the equivalent form B as follows: + // CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ... + // WHEN x=eN THEN rN ELSE y END + // + // X (if it exists) is in pExpr->pLeft. + // Y is in the last element of pExpr->x.pList if pExpr->x.pList->nExpr is + // odd. The Y is also optional. If the number of elements in x.pList + // is even, then Y is omitted and the "otherwise" result is NULL. + // Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1]. + // + // The result of the expression is the Ri for the first matching Ei, + // or if there is no matching Ei, the ELSE term Y, or if there is + // no ELSE term, NULL. +__54: // The X expression + pTest = uintptr(0) // X==Ei (form A) or just Ei (form B) + pDel = uintptr(0) + db1 = (*Parse)(unsafe.Pointer(pParse)).Fdb + + pEList = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + aListelem = pEList + 8 /* &.a */ + nExpr = (*ExprList)(unsafe.Pointer(pEList)).FnExpr + endLabel = Xsqlite3VdbeMakeLabel(tls, pParse) + if !((libc.AssignUintptr(&pX, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) != uintptr(0)) { + goto __125 + } + pDel = Xsqlite3ExprDup(tls, db1, pX, 0) + if !((*Sqlite3)(unsafe.Pointer(db1)).FmallocFailed != 0) { + goto __126 + } + Xsqlite3ExprDelete(tls, db1, pDel) + goto __3 +__126: + ; + + exprToRegister(tls, pDel, exprCodeVector(tls, pParse, pDel, bp+40 /* ®Free1 */)) + + libc.Xmemset(tls, bp+120 /* &opCompare */, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(bp + 120 /* &opCompare */)).Fop = U8(TK_EQ) + (*Expr)(unsafe.Pointer(bp + 120 /* &opCompare */)).FpLeft = pDel + pTest = bp + 120 /* &opCompare */ + // Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: + // The value in regFree1 might get SCopy-ed into the file result. + // So make sure that the regFree1 register is not reused for other + // purposes and possibly overwritten. + *(*int32)(unsafe.Pointer(bp + 40 /* regFree1 */)) = 0 +__125: + ; + i1 = 0 +__127: + if !(i1 < (nExpr - 1)) { + goto __129 + } + if !(pX != 0) { + goto __130 + } + + (*Expr)(unsafe.Pointer(bp + 120 /* &opCompare */)).FpRight = (*ExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32)).FpExpr + goto __131 +__130: + pTest = (*ExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32)).FpExpr +__131: + ; + nextCase = Xsqlite3VdbeMakeLabel(tls, pParse) + + Xsqlite3ExprIfFalse(tls, pParse, pTest, nextCase, SQLITE_JUMPIFNULL) + + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer(aListelem+uintptr((i1+1))*32)).FpExpr, target) + Xsqlite3VdbeGoto(tls, v, endLabel) + Xsqlite3VdbeResolveLabel(tls, v, nextCase) + goto __128 +__128: + i1 = (i1 + 2) + goto __127 + goto __129 +__129: + ; + if !((nExpr & 1) != 0) { + goto __132 + } + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr((nExpr-1))*32)).FpExpr, target) + goto __133 +__132: + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, target) +__133: + ; + Xsqlite3ExprDelete(tls, db1, pDel) + setDoNotMergeFlagOnCopy(tls, v) + Xsqlite3VdbeResolveLabel(tls, v, endLabel) + goto __3 + +__55: + ; + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab) != 0) && !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0)) { + goto __134 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+7024 /* "RAISE() may only..." */, 0) + return 0 +__134: + ; + if !(int32((*Expr)(unsafe.Pointer(pExpr)).FaffExpr) == OE_Abort) { + goto __135 + } + Xsqlite3MayAbort(tls, pParse) +__135: + ; + + if !(int32((*Expr)(unsafe.Pointer(pExpr)).FaffExpr) == OE_Ignore) { + goto __136 + } + Xsqlite3VdbeAddOp4(tls, + v, OP_Halt, SQLITE_OK, OE_Ignore, 0, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), 0) + + goto __137 +__136: + Xsqlite3HaltConstraint(tls, pParse, + func() int32 { + if (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab != 0 { + return (SQLITE_CONSTRAINT | (int32(7) << 8)) + } + return SQLITE_ERROR + }(), + int32((*Expr)(unsafe.Pointer(pExpr)).FaffExpr), *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), int8(0), uint8(0)) +__137: + ; + + goto __3 + +__3: + ; + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 40 /* regFree1 */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 44 /* regFree2 */))) + return inReg +} + +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7074 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ + +// Generate code that will evaluate expression pExpr just one time +// per prepared statement execution. +// +// If the expression uses functions (that might throw an exception) then +// guard them with an OP_Once opcode to ensure that the code is only executed +// once. If no functions are involved, then factor the code out and put it at +// the end of the prepared statement in the initialization section. +// +// If regDest>=0 then the result is always stored in that register and the +// result is not reusable. If regDest<0 then this routine is free to +// store the value whereever it wants. The register where the expression +// is stored is returned. When regDest<0, two identical expressions might +// code to the same register, if they do not contain function calls and hence +// are factored out into the initialization section at the end of the +// prepared statement. +func Xsqlite3ExprCodeRunJustOnce(tls *libc.TLS, pParse uintptr, pExpr uintptr, regDest int32) int32 { /* sqlite3.c:105866:20: */ + var p uintptr + + p = (*Parse)(unsafe.Pointer(pParse)).FpConstExpr + if (regDest < 0) && (p != 0) { + var pItem uintptr + var i int32 + pItem = p + 8 /* &.a */ + i = (*ExprList)(unsafe.Pointer(p)).FnExpr + __1: + if !(i > 0) { + goto __3 + } + { + if ((uint32(int32(*(*uint8)(unsafe.Pointer(pItem + 20 /* &.reusable */)) & 0x8 >> 3))) != 0) && (Xsqlite3ExprCompare(tls, uintptr(0), (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr, pExpr, -1) == 0) { + return *(*int32)(unsafe.Pointer(pItem + 24 /* &.u */)) + } + + } + goto __2 + __2: + pItem += 32 + i-- + goto __1 + goto __3 + __3: + } + pExpr = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0) + if (pExpr != uintptr(0)) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_HasFunc))) != U32(0)) { + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var addr int32 + + addr = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = U8(0) + if !(int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed) != 0) { + if regDest < 0 { + regDest = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + Xsqlite3ExprCode(tls, pParse, pExpr, regDest) + } + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = U8(1) + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) + Xsqlite3VdbeJumpHere(tls, v, addr) + } else { + p = Xsqlite3ExprListAppend(tls, pParse, p, pExpr) + if p != 0 { + var pItem uintptr = ((p + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(p)).FnExpr-1))*32) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.reusable */, (uint32(libc.Bool32(regDest < 0))), 3, 0x8) + if regDest < 0 { + regDest = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + *(*int32)(unsafe.Pointer(pItem + 24 /* &.u */)) = regDest + } + (*Parse)(unsafe.Pointer(pParse)).FpConstExpr = p + } + return regDest +} + +// Generate code to evaluate an expression and store the results +// into a register. Return the register number where the results +// are stored. +// +// If the register is a temporary register that can be deallocated, +// then write its number into *pReg. If the result register is not +// a temporary, then set *pReg to zero. +// +// If pExpr is a constant, then this routine might generate this +// code to fill the register in the initialization section of the +// VDBE program, in order to factor it out of the evaluation loop. +func Xsqlite3ExprCodeTemp(tls *libc.TLS, pParse uintptr, pExpr uintptr, pReg uintptr) int32 { /* sqlite3.c:105923:20: */ + var r2 int32 + pExpr = Xsqlite3ExprSkipCollateAndLikely(tls, pExpr) + if ((((*Parse)(unsafe.Pointer(pParse)).FokConstFactor != 0) && + (pExpr != uintptr(0))) && + (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_REGISTER)) && + (Xsqlite3ExprIsConstantNotJoin(tls, pExpr) != 0) { + *(*int32)(unsafe.Pointer(pReg)) = 0 + r2 = Xsqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, -1) + } else { + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + r2 = Xsqlite3ExprCodeTarget(tls, pParse, pExpr, r1) + if r2 == r1 { + *(*int32)(unsafe.Pointer(pReg)) = r1 + } else { + Xsqlite3ReleaseTempReg(tls, pParse, r1) + *(*int32)(unsafe.Pointer(pReg)) = 0 + } + } + return r2 +} + +// Generate code that will evaluate expression pExpr and store the +// results in register target. The results are guaranteed to appear +// in register target. +func Xsqlite3ExprCode(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) { /* sqlite3.c:105951:21: */ + var inReg int32 + + if (*Parse)(unsafe.Pointer(pParse)).FpVdbe == uintptr(0) { + return + } + inReg = Xsqlite3ExprCodeTarget(tls, pParse, pExpr, target) + if inReg != target { + var op U8 + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subquery))) != U32(0) { + op = U8(OP_Copy) + } else { + op = U8(OP_SCopy) + } + Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, int32(op), inReg, target) + } +} + +// Make a transient copy of expression pExpr and then code it using +// sqlite3ExprCode(). This routine works just like sqlite3ExprCode() +// except that the input expression is guaranteed to be unchanged. +func Xsqlite3ExprCodeCopy(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) { /* sqlite3.c:105975:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + pExpr = Xsqlite3ExprDup(tls, db, pExpr, 0) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + Xsqlite3ExprCode(tls, pParse, pExpr, target) + } + Xsqlite3ExprDelete(tls, db, pExpr) +} + +// Generate code that will evaluate expression pExpr and store the +// results in register target. The results are guaranteed to appear +// in register target. If the expression is constant, then this routine +// might choose to code the expression at initialization time. +func Xsqlite3ExprCodeFactorable(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) { /* sqlite3.c:105988:21: */ + if ((*Parse)(unsafe.Pointer(pParse)).FokConstFactor != 0) && (Xsqlite3ExprIsConstantNotJoin(tls, pExpr) != 0) { + Xsqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, target) + } else { + Xsqlite3ExprCodeCopy(tls, pParse, pExpr, target) + } +} + +// Generate code that pushes the value of every element of the given +// expression list into a sequence of registers beginning at target. +// +// Return the number of elements evaluated. The number returned will +// usually be pList->nExpr but might be reduced if SQLITE_ECEL_OMITREF +// is defined. +// +// The SQLITE_ECEL_DUP flag prevents the arguments from being +// filled using OP_SCopy. OP_Copy must be used instead. +// +// The SQLITE_ECEL_FACTOR argument allows constant arguments to be +// factored out into initialization code. +// +// The SQLITE_ECEL_REF flag means that expressions in the list with +// ExprList.a[].u.x.iOrderByCol>0 have already been evaluated and stored +// in registers at srcReg, and so the value can be copied from there. +// If SQLITE_ECEL_OMITREF is also set, then the values with u.x.iOrderByCol>0 +// are simply omitted rather than being copied from srcReg. +func Xsqlite3ExprCodeExprList(tls *libc.TLS, pParse uintptr, pList uintptr, target int32, srcReg int32, flags U8) int32 { /* sqlite3.c:106016:20: */ + var pItem uintptr + var i int32 + var j int32 + var n int32 + var copyOp U8 + if (int32(flags) & SQLITE_ECEL_DUP) != 0 { + copyOp = uint8(OP_Copy) + } else { + copyOp = uint8(OP_SCopy) + } + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + // Never gets this far otherwise + n = (*ExprList)(unsafe.Pointer(pList)).FnExpr + if !(int32((*Parse)(unsafe.Pointer(pParse)).FokConstFactor) != 0) { + flags = libc.Uint8FromInt32(int32(flags) & (libc.CplInt32(SQLITE_ECEL_FACTOR))) + } + pItem = pList + 8 /* &.a */ + i = 0 +__1: + if !(i < n) { + goto __3 + } + { + var pExpr uintptr = (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr + if ((int32(flags) & SQLITE_ECEL_REF) != 0) && ((libc.AssignInt32(&j, int32(*(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */))))) > 0) { + if (int32(flags) & SQLITE_ECEL_OMITREF) != 0 { + i-- + n-- + } else { + Xsqlite3VdbeAddOp2(tls, v, int32(copyOp), ((j + srcReg) - 1), (target + i)) + } + } else if ((int32(flags) & SQLITE_ECEL_FACTOR) != 0) && + (Xsqlite3ExprIsConstantNotJoin(tls, pExpr) != 0) { + Xsqlite3ExprCodeRunJustOnce(tls, pParse, pExpr, (target + i)) + } else { + var inReg int32 = Xsqlite3ExprCodeTarget(tls, pParse, pExpr, (target + i)) + if inReg != (target + i) { + var pOp uintptr + if ((((int32(copyOp) == OP_Copy) && + (int32((*VdbeOp)(unsafe.Pointer((libc.AssignUintptr(&pOp, Xsqlite3VdbeGetOp(tls, v, -1))))).Fopcode) == OP_Copy)) && + ((((*VdbeOp)(unsafe.Pointer(pOp)).Fp1 + (*VdbeOp)(unsafe.Pointer(pOp)).Fp3) + 1) == inReg)) && + ((((*VdbeOp)(unsafe.Pointer(pOp)).Fp2 + (*VdbeOp)(unsafe.Pointer(pOp)).Fp3) + 1) == (target + i))) && + (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) == 0) { + (*VdbeOp)(unsafe.Pointer(pOp)).Fp3++ + } else { + Xsqlite3VdbeAddOp2(tls, v, int32(copyOp), inReg, (target + i)) + } + } + } + + } + goto __2 +__2: + i++ + pItem += 32 + goto __1 + goto __3 +__3: + ; + return n +} + +// Generate code for a BETWEEN operator. +// +// x BETWEEN y AND z +// +// The above is equivalent to +// +// x>=y AND x<=z +// +// Code it as such, taking care to do the common subexpression +// elimination of x. +// +// The xJumpIf parameter determines details: +// +// NULL: Store the boolean result in reg[dest] +// sqlite3ExprIfTrue: Jump to dest if true +// sqlite3ExprIfFalse: Jump to dest if false +// +// The jumpIfNull parameter is ignored if xJumpIf is NULL. +func exprCodeBetween(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, xJump uintptr, jumpIfNull int32) { /* sqlite3.c:106091:13: */ + bp := tls.Alloc(220) + defer tls.Free(220) + + // var exprAnd Expr at bp+144, 72 + // The AND operator in x>=y AND x<=z + // var compLeft Expr at bp, 72 + // The x>=y term + // var compRight Expr at bp+72, 72 + // The x<=z term + *(*int32)(unsafe.Pointer(bp + 216 /* regFree1 */)) = 0 // Temporary use register + var pDel uintptr = uintptr(0) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + libc.Xmemset(tls, bp /* &compLeft */, 0, uint64(unsafe.Sizeof(Expr{}))) + libc.Xmemset(tls, bp+72 /* &compRight */, 0, uint64(unsafe.Sizeof(Expr{}))) + libc.Xmemset(tls, bp+144 /* &exprAnd */, 0, uint64(unsafe.Sizeof(Expr{}))) + + pDel = Xsqlite3ExprDup(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, 0) + if int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + (*Expr)(unsafe.Pointer(bp + 144 /* &exprAnd */)).Fop = U8(TK_AND) + (*Expr)(unsafe.Pointer(bp + 144 /* &exprAnd */)).FpLeft = bp /* &compLeft */ + (*Expr)(unsafe.Pointer(bp + 144 /* &exprAnd */)).FpRight = bp + 72 /* &compRight */ + (*Expr)(unsafe.Pointer(bp /* &compLeft */)).Fop = U8(TK_GE) + (*Expr)(unsafe.Pointer(bp /* &compLeft */)).FpLeft = pDel + (*Expr)(unsafe.Pointer(bp /* &compLeft */)).FpRight = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */))).FpExpr + (*Expr)(unsafe.Pointer(bp + 72 /* &compRight */)).Fop = U8(TK_LE) + (*Expr)(unsafe.Pointer(bp + 72 /* &compRight */)).FpLeft = pDel + (*Expr)(unsafe.Pointer(bp + 72 /* &compRight */)).FpRight = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */) + 1*32)).FpExpr + exprToRegister(tls, pDel, exprCodeVector(tls, pParse, pDel, bp+216 /* ®Free1 */)) + if xJump != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, int32, int32))(unsafe.Pointer(&xJump)))(tls, pParse, bp+144 /* &exprAnd */, dest, jumpIfNull) + } else { + // Mark the expression is being from the ON or USING clause of a join + // so that the sqlite3ExprCodeTarget() routine will not attempt to move + // it into the Parse.pConstExpr list. We should use a new bit for this, + // for clarity, but we are out of bits in the Expr.flags field so we + // have to reuse the EP_FromJoin bit. Bummer. + *(*U32)(unsafe.Pointer(pDel + 4 /* &.flags */)) |= (U32(EP_FromJoin)) + Xsqlite3ExprCodeTarget(tls, pParse, bp+144 /* &exprAnd */, dest) + } + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 216 /* regFree1 */))) + } + Xsqlite3ExprDelete(tls, db, pDel) + + // Ensure adequate test coverage + +} + +// Generate code for a boolean expression such that a jump is made +// to the label "dest" if the expression is true but execution +// continues straight thru if the expression is false. +// +// If the expression evaluates to NULL (neither true nor false), then +// take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL. +// +// This code depends on the fact that certain token values (ex: TK_EQ) +// are the same as opcode values (ex: OP_Eq) that implement the corresponding +// operation. Special comments in vdbe.c and the mkopcodeh.awk script in +// the make process cause these values to align. Assert()s in the code +// below verify that the numbers are aligned correctly. +func Xsqlite3ExprIfTrue(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, jumpIfNull int32) { /* sqlite3.c:106163:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var v uintptr + var op int32 + // var regFree1 int32 at bp, 4 + + // var regFree2 int32 at bp+4, 4 + + var r1 int32 + var r2 int32 + var d2 int32 + var pAlt uintptr + var isNot int32 // IS NOT TRUE or IS NOT FALSE + var isTrue int32 + var destIfFalse int32 + var destIfNull int32 + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + op = 0 + *(*int32)(unsafe.Pointer(bp /* regFree1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* regFree2 */)) = 0 + + if !(v == uintptr(0)) { + goto __1 + } + return +__1: + ; // Existence of VDBE checked by caller + if !(pExpr == uintptr(0)) { + goto __2 + } + return +__2: + ; // No way this can happen + + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) + switch op { + case TK_AND: + goto __4 + case TK_OR: + goto __5 + case TK_NOT: + goto __6 + case TK_TRUTH: + goto __7 + case TK_IS: + goto __8 + case TK_ISNOT: + goto __9 + case TK_LT: + goto __10 + case TK_LE: + goto __11 + case TK_GT: + goto __12 + case TK_GE: + goto __13 + case TK_NE: + goto __14 + case TK_EQ: + goto __15 + case TK_ISNULL: + goto __16 + case TK_NOTNULL: + goto __17 + case TK_BETWEEN: + goto __18 + case TK_IN: + goto __19 + default: + goto __20 + } + goto __3 +__4: +__5: + pAlt = Xsqlite3ExprSimplifiedAndOr(tls, pExpr) + if !(pAlt != pExpr) { + goto __21 + } + Xsqlite3ExprIfTrue(tls, pParse, pAlt, dest, jumpIfNull) + goto __22 +__21: + if !(op == TK_AND) { + goto __23 + } + d2 = Xsqlite3VdbeMakeLabel(tls, pParse) + + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, d2, + (jumpIfNull ^ SQLITE_JUMPIFNULL)) + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + Xsqlite3VdbeResolveLabel(tls, v, d2) + goto __24 +__23: + ; + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) +__24: + ; +__22: + ; + goto __3 + +__6: + ; + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + goto __3 + +__7: // IS TRUE or IS NOT TRUE + ; + isNot = (libc.Bool32(int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) == TK_ISNOT)) + isTrue = Xsqlite3ExprTruthValue(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + + if !((isTrue ^ isNot) != 0) { + goto __25 + } + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, + func() int32 { + if isNot != 0 { + return SQLITE_JUMPIFNULL + } + return 0 + }()) + goto __26 +__25: + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, + func() int32 { + if isNot != 0 { + return SQLITE_JUMPIFNULL + } + return 0 + }()) +__26: + ; + goto __3 + +__8: +__9: + ; + + if op == TK_IS { + op = TK_EQ + } else { + op = TK_NE + } + jumpIfNull = SQLITE_NULLEQ +__10: +__11: +__12: +__13: +__14: +__15: + if !(Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) != 0) { + goto __27 + } + goto default_expr +__27: + ; + + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+4 /* ®Free2 */) + codeCompare(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, (*Expr)(unsafe.Pointer(pExpr)).FpRight, op, + r1, r2, dest, jumpIfNull, (libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Commuted))) != U32(0)))) + + goto __3 + +__16: +__17: + ; + + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp /* ®Free1 */) + Xsqlite3VdbeAddOp2(tls, v, op, r1, dest) + + goto __3 + +__18: + ; + exprCodeBetween(tls, pParse, pExpr, dest, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, int32) + }{Xsqlite3ExprIfTrue})), jumpIfNull) + goto __3 + +__19: + destIfFalse = Xsqlite3VdbeMakeLabel(tls, pParse) + if jumpIfNull != 0 { + destIfNull = dest + } else { + destIfNull = destIfFalse + } + sqlite3ExprCodeIN(tls, pParse, pExpr, destIfFalse, destIfNull) + Xsqlite3VdbeGoto(tls, v, dest) + Xsqlite3VdbeResolveLabel(tls, v, destIfFalse) + goto __3 + +__20: +default_expr: + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsTrue))) == U32(EP_IsTrue)) { + goto __28 + } + Xsqlite3VdbeGoto(tls, v, dest) + goto __29 +__28: + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse)) { + goto __30 + } + // No-op + goto __31 +__30: + r1 = Xsqlite3ExprCodeTemp(tls, pParse, pExpr, bp /* ®Free1 */) + Xsqlite3VdbeAddOp3(tls, v, OP_If, r1, dest, (libc.Bool32(jumpIfNull != 0))) + +__31: + ; +__29: + ; + goto __3 + +__3: + ; + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp /* regFree1 */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4 /* regFree2 */))) +} + +// Generate code for a boolean expression such that a jump is made +// to the label "dest" if the expression is false but execution +// continues straight thru if the expression is true. +// +// If the expression evaluates to NULL (neither true nor false) then +// jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull +// is 0. +func Xsqlite3ExprIfFalse(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, jumpIfNull int32) { /* sqlite3.c:106305:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var v uintptr + var op int32 + // var regFree1 int32 at bp, 4 + + // var regFree2 int32 at bp+4, 4 + + var r1 int32 + var r2 int32 + var d2 int32 + var pAlt uintptr + var isNot int32 // IS NOT TRUE or IS NOT FALSE + var isTrue int32 + var destIfNull int32 + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + op = 0 + *(*int32)(unsafe.Pointer(bp /* regFree1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* regFree2 */)) = 0 + + if !(v == uintptr(0)) { + goto __1 + } + return +__1: + ; // Existence of VDBE checked by caller + if !(pExpr == uintptr(0)) { + goto __2 + } + return +__2: + ; + + // The value of pExpr->op and op are related as follows: + // + // pExpr->op op + // --------- ---------- + // TK_ISNULL OP_NotNull + // TK_NOTNULL OP_IsNull + // TK_NE OP_Eq + // TK_EQ OP_Ne + // TK_GT OP_Le + // TK_LE OP_Gt + // TK_GE OP_Lt + // TK_LT OP_Ge + // + // For other values of pExpr->op, op is undefined and unused. + // The value of TK_ and OP_ constants are arranged such that we + // can compute the mapping above using the following expression. + // Assert()s verify that the computation is correct. + op = (((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) + (TK_ISNULL & 1)) ^ 1) - (TK_ISNULL & 1)) + + // Verify correct alignment of TK_ and OP_ constants + + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + case TK_AND: + goto __4 + case TK_OR: + goto __5 + case TK_NOT: + goto __6 + case TK_TRUTH: + goto __7 + case TK_IS: + goto __8 + case TK_ISNOT: + goto __9 + case TK_LT: + goto __10 + case TK_LE: + goto __11 + case TK_GT: + goto __12 + case TK_GE: + goto __13 + case TK_NE: + goto __14 + case TK_EQ: + goto __15 + case TK_ISNULL: + goto __16 + case TK_NOTNULL: + goto __17 + case TK_BETWEEN: + goto __18 + case TK_IN: + goto __19 + default: + goto __20 + } + goto __3 +__4: +__5: + pAlt = Xsqlite3ExprSimplifiedAndOr(tls, pExpr) + if !(pAlt != pExpr) { + goto __21 + } + Xsqlite3ExprIfFalse(tls, pParse, pAlt, dest, jumpIfNull) + goto __22 +__21: + if !(int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AND) { + goto __23 + } + + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + goto __24 +__23: + d2 = Xsqlite3VdbeMakeLabel(tls, pParse) + + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, d2, + (jumpIfNull ^ SQLITE_JUMPIFNULL)) + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, dest, jumpIfNull) + Xsqlite3VdbeResolveLabel(tls, v, d2) +__24: + ; +__22: + ; + goto __3 + +__6: + ; + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, jumpIfNull) + goto __3 + +__7: // IS TRUE or IS NOT TRUE + ; + isNot = (libc.Bool32(int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) == TK_ISNOT)) + isTrue = Xsqlite3ExprTruthValue(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + + if !((isTrue ^ isNot) != 0) { + goto __25 + } + // IS TRUE and IS NOT FALSE + Xsqlite3ExprIfFalse(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, + func() int32 { + if isNot != 0 { + return 0 + } + return SQLITE_JUMPIFNULL + }()) + + goto __26 +__25: + // IS FALSE and IS NOT TRUE + Xsqlite3ExprIfTrue(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, dest, + func() int32 { + if isNot != 0 { + return 0 + } + return SQLITE_JUMPIFNULL + }()) +__26: + ; + goto __3 + +__8: +__9: + ; + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_IS { + op = TK_NE + } else { + op = TK_EQ + } + jumpIfNull = SQLITE_NULLEQ +__10: +__11: +__12: +__13: +__14: +__15: + if !(Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) != 0) { + goto __27 + } + goto default_expr +__27: + ; + + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+4 /* ®Free2 */) + codeCompare(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, (*Expr)(unsafe.Pointer(pExpr)).FpRight, op, + r1, r2, dest, jumpIfNull, (libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Commuted))) != U32(0)))) + + goto __3 + +__16: +__17: + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp /* ®Free1 */) + Xsqlite3VdbeAddOp2(tls, v, op, r1, dest) + + goto __3 + +__18: + ; + exprCodeBetween(tls, pParse, pExpr, dest, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, int32) + }{Xsqlite3ExprIfFalse})), jumpIfNull) + goto __3 + +__19: + if !(jumpIfNull != 0) { + goto __28 + } + sqlite3ExprCodeIN(tls, pParse, pExpr, dest, dest) + goto __29 +__28: + destIfNull = Xsqlite3VdbeMakeLabel(tls, pParse) + sqlite3ExprCodeIN(tls, pParse, pExpr, dest, destIfNull) + Xsqlite3VdbeResolveLabel(tls, v, destIfNull) +__29: + ; + goto __3 + +__20: +default_expr: + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse)) { + goto __30 + } + Xsqlite3VdbeGoto(tls, v, dest) + goto __31 +__30: + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsTrue))) == U32(EP_IsTrue)) { + goto __32 + } + // no-op + goto __33 +__32: + r1 = Xsqlite3ExprCodeTemp(tls, pParse, pExpr, bp /* ®Free1 */) + Xsqlite3VdbeAddOp3(tls, v, OP_IfNot, r1, dest, (libc.Bool32(jumpIfNull != 0))) + +__33: + ; +__31: + ; + goto __3 + +__3: + ; + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp /* regFree1 */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 4 /* regFree2 */))) +} + +// Like sqlite3ExprIfFalse() except that a copy is made of pExpr before +// code generation, and that copy is deleted after code generation. This +// ensures that the original pExpr is unchanged. +func Xsqlite3ExprIfFalseDup(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, jumpIfNull int32) { /* sqlite3.c:106477:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pCopy uintptr = Xsqlite3ExprDup(tls, db, pExpr, 0) + if int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + Xsqlite3ExprIfFalse(tls, pParse, pCopy, dest, jumpIfNull) + } + Xsqlite3ExprDelete(tls, db, pCopy) +} + +// Expression pVar is guaranteed to be an SQL variable. pExpr may be any +// type of expression. +// +// If pExpr is a simple SQL value - an integer, real, string, blob +// or NULL value - then the VDBE currently being prepared is configured +// to re-prepare each time a new value is bound to variable pVar. +// +// Additionally, if pExpr is a simple SQL value and the value is the +// same as that currently bound to variable pVar, non-zero is returned. +// Otherwise, if the values are not the same or if pExpr is not a simple +// SQL value, zero is returned. +func exprCompareVariable(tls *libc.TLS, pParse uintptr, pVar uintptr, pExpr uintptr) int32 { /* sqlite3.c:106499:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var res int32 = 0 + var iVar int32 + var pL uintptr + *(*uintptr)(unsafe.Pointer(bp /* pR */)) = uintptr(0) + + Xsqlite3ValueFromExpr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp /* &pR */) + if *(*uintptr)(unsafe.Pointer(bp /* pR */)) != 0 { + iVar = int32((*Expr)(unsafe.Pointer(pVar)).FiColumn) + Xsqlite3VdbeSetVarmask(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, iVar) + pL = Xsqlite3VdbeGetBoundValue(tls, (*Parse)(unsafe.Pointer(pParse)).FpReprepare, iVar, uint8(SQLITE_AFF_BLOB)) + if pL != 0 { + if Xsqlite3_value_type(tls, pL) == SQLITE_TEXT { + Xsqlite3_value_text(tls, pL) // Make sure the encoding is UTF-8 + } + res = (libc.Bool32(0 == Xsqlite3MemCompare(tls, pL, *(*uintptr)(unsafe.Pointer(bp /* pR */)), uintptr(0)))) + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp /* pR */))) + Xsqlite3ValueFree(tls, pL) + } + + return res +} + +// Do a deep comparison of two expression trees. Return 0 if the two +// expressions are completely identical. Return 1 if they differ only +// by a COLLATE operator at the top level. Return 2 if there are differences +// other than the top-level COLLATE operator. +// +// If any subelement of pB has Expr.iTable==(-1) then it is allowed +// to compare equal to an equivalent element in pA with Expr.iTable==iTab. +// +// The pA side might be using TK_REGISTER. If that is the case and pB is +// not using TK_REGISTER but is otherwise equivalent, then still return 0. +// +// Sometimes this routine will return 2 even if the two expressions +// really are equivalent. If we cannot prove that the expressions are +// identical, we return 2 just to be safe. So if this routine +// returns 2, then you do not really know for certain if the two +// expressions are the same. But if you get a 0 or 1 return, then you +// can be sure the expressions are the same. In the places where +// this routine is used, it does not hurt to get an extra 2 - that +// just might result in some slightly slower code. But returning +// an incorrect 0 or 1 could lead to a malfunction. +// +// If pParse is not NULL then TK_VARIABLE terms in pA with bindings in +// pParse->pReprepare can be matched against literals in pB. The +// pParse->pVdbe->expmask bitmask is updated for each variable referenced. +// If pParse is NULL (the normal case) then any TK_VARIABLE term in +// Argument pParse should normally be NULL. If it is not NULL and pA or +// pB causes a return value of 2. +func Xsqlite3ExprCompare(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, iTab int32) int32 { /* sqlite3.c:106551:20: */ + var combinedFlags U32 + if (pA == uintptr(0)) || (pB == uintptr(0)) { + if pB == pA { + return 0 + } + return 2 + } + if ((pParse != 0) && (int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_VARIABLE)) && (exprCompareVariable(tls, pParse, pA, pB) != 0) { + return 0 + } + combinedFlags = ((*Expr)(unsafe.Pointer(pA)).Fflags | (*Expr)(unsafe.Pointer(pB)).Fflags) + if (combinedFlags & U32(EP_IntValue)) != 0 { + if ((((*Expr)(unsafe.Pointer(pA)).Fflags & (*Expr)(unsafe.Pointer(pB)).Fflags) & U32(EP_IntValue)) != U32(0)) && (*(*int32)(unsafe.Pointer(pA + 8 /* &.u */)) == *(*int32)(unsafe.Pointer(pB + 8 /* &.u */))) { + return 0 + } + return 2 + } + if (int32((*Expr)(unsafe.Pointer(pA)).Fop) != int32((*Expr)(unsafe.Pointer(pB)).Fop)) || (int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_RAISE) { + if (int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_COLLATE) && (Xsqlite3ExprCompare(tls, pParse, (*Expr)(unsafe.Pointer(pA)).FpLeft, pB, iTab) < 2) { + return 1 + } + if (int32((*Expr)(unsafe.Pointer(pB)).Fop) == TK_COLLATE) && (Xsqlite3ExprCompare(tls, pParse, pA, (*Expr)(unsafe.Pointer(pB)).FpLeft, iTab) < 2) { + return 1 + } + return 2 + } + if ((int32((*Expr)(unsafe.Pointer(pA)).Fop) != TK_COLUMN) && (int32((*Expr)(unsafe.Pointer(pA)).Fop) != TK_AGG_COLUMN)) && (*(*uintptr)(unsafe.Pointer(pA + 8 /* &.u */)) != 0) { + if (int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_FUNCTION) || (int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_AGG_FUNCTION) { + if Xsqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8 /* &.u */)), *(*uintptr)(unsafe.Pointer(pB + 8 /* &.u */))) != 0 { + return 2 + } + + if (libc.Bool32(((*Expr)(unsafe.Pointer((pA))).Fflags & (U32(EP_WinFunc))) != U32(0))) != (libc.Bool32(((*Expr)(unsafe.Pointer((pB))).Fflags & (U32(EP_WinFunc))) != U32(0))) { + return 2 + } + if ((*Expr)(unsafe.Pointer((pA))).Fflags & (U32(EP_WinFunc))) != U32(0) { + if Xsqlite3WindowCompare(tls, pParse, *(*uintptr)(unsafe.Pointer(pA + 64 /* &.y */)), *(*uintptr)(unsafe.Pointer(pB + 64 /* &.y */)), 1) != 0 { + return 2 + } + } + } else if int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_NULL { + return 0 + } else if int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_COLLATE { + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8 /* &.u */)), *(*uintptr)(unsafe.Pointer(pB + 8 /* &.u */))) != 0 { + return 2 + } + } else if (*(*uintptr)(unsafe.Pointer(pB + 8 /* &.u */)) != uintptr(0)) && (libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(pA + 8 /* &.u */)), *(*uintptr)(unsafe.Pointer(pB + 8 /* &.u */))) != 0) { + return 2 + } + } + if ((*Expr)(unsafe.Pointer(pA)).Fflags & (U32(EP_Distinct | EP_Commuted))) != + ((*Expr)(unsafe.Pointer(pB)).Fflags & (U32(EP_Distinct | EP_Commuted))) { + return 2 + } + if (combinedFlags & U32(EP_TokenOnly)) == U32(0) { + if (combinedFlags & U32(EP_xIsSelect)) != 0 { + return 2 + } + if ((combinedFlags & U32(EP_FixedCol)) == U32(0)) && + (Xsqlite3ExprCompare(tls, pParse, (*Expr)(unsafe.Pointer(pA)).FpLeft, (*Expr)(unsafe.Pointer(pB)).FpLeft, iTab) != 0) { + return 2 + } + if Xsqlite3ExprCompare(tls, pParse, (*Expr)(unsafe.Pointer(pA)).FpRight, (*Expr)(unsafe.Pointer(pB)).FpRight, iTab) != 0 { + return 2 + } + if Xsqlite3ExprListCompare(tls, *(*uintptr)(unsafe.Pointer(pA + 32 /* &.x */)), *(*uintptr)(unsafe.Pointer(pB + 32 /* &.x */)), iTab) != 0 { + return 2 + } + if ((int32((*Expr)(unsafe.Pointer(pA)).Fop) != TK_STRING) && + (int32((*Expr)(unsafe.Pointer(pA)).Fop) != TK_TRUEFALSE)) && + ((combinedFlags & U32(EP_Reduced)) == U32(0)) { + if int32((*Expr)(unsafe.Pointer(pA)).FiColumn) != int32((*Expr)(unsafe.Pointer(pB)).FiColumn) { + return 2 + } + if (int32((*Expr)(unsafe.Pointer(pA)).Fop2) != int32((*Expr)(unsafe.Pointer(pB)).Fop2)) && (int32((*Expr)(unsafe.Pointer(pA)).Fop) == TK_TRUTH) { + return 2 + } + if ((int32((*Expr)(unsafe.Pointer(pA)).Fop) != TK_IN) && ((*Expr)(unsafe.Pointer(pA)).FiTable != (*Expr)(unsafe.Pointer(pB)).FiTable)) && ((*Expr)(unsafe.Pointer(pA)).FiTable != iTab) { + return 2 + } + } + } + return 0 +} + +// Compare two ExprList objects. Return 0 if they are identical, 1 +// if they are certainly different, or 2 if it is not possible to +// determine if they are identical or not. +// +// If any subelement of pB has Expr.iTable==(-1) then it is allowed +// to compare equal to an equivalent element in pA with Expr.iTable==iTab. +// +// This routine might return non-zero for equivalent ExprLists. The +// only consequence will be disabled optimizations. But this routine +// must never return 0 if the two ExprList objects are different, or +// a malfunction will result. +// +// Two NULL pointers are considered to be the same. But a NULL pointer +// always differs from a non-NULL pointer. +func Xsqlite3ExprListCompare(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) int32 { /* sqlite3.c:106635:20: */ + var i int32 + if (pA == uintptr(0)) && (pB == uintptr(0)) { + return 0 + } + if (pA == uintptr(0)) || (pB == uintptr(0)) { + return 1 + } + if (*ExprList)(unsafe.Pointer(pA)).FnExpr != (*ExprList)(unsafe.Pointer(pB)).FnExpr { + return 1 + } + for i = 0; i < (*ExprList)(unsafe.Pointer(pA)).FnExpr; i++ { + var res int32 + var pExprA uintptr = (*ExprList_item)(unsafe.Pointer((pA + 8 /* &.a */) + uintptr(i)*32)).FpExpr + var pExprB uintptr = (*ExprList_item)(unsafe.Pointer((pB + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if int32((*ExprList_item)(unsafe.Pointer((pA+8 /* &.a */)+uintptr(i)*32)).FsortFlags) != int32((*ExprList_item)(unsafe.Pointer((pB+8 /* &.a */)+uintptr(i)*32)).FsortFlags) { + return 1 + } + if libc.AssignInt32(&res, Xsqlite3ExprCompare(tls, uintptr(0), pExprA, pExprB, iTab)) != 0 { + return res + } + } + return 0 +} + +// Like sqlite3ExprCompare() except COLLATE operators at the top-level +// are ignored. +func Xsqlite3ExprCompareSkip(tls *libc.TLS, pA uintptr, pB uintptr, iTab int32) int32 { /* sqlite3.c:106654:20: */ + return Xsqlite3ExprCompare(tls, uintptr(0), + Xsqlite3ExprSkipCollateAndLikely(tls, pA), + Xsqlite3ExprSkipCollateAndLikely(tls, pB), + iTab) +} + +// Return non-zero if Expr p can only be true if pNN is not NULL. +// +// Or if seenNot is true, return non-zero if Expr p can only be +// non-NULL if pNN is not NULL +func exprImpliesNotNull(tls *libc.TLS, pParse uintptr, p uintptr, pNN uintptr, iTab int32, seenNot int32) int32 { /* sqlite3.c:106667:12: */ + + if Xsqlite3ExprCompare(tls, pParse, p, pNN, iTab) == 0 { + return (libc.Bool32(int32((*Expr)(unsafe.Pointer(pNN)).Fop) != TK_NULL)) + } + switch int32((*Expr)(unsafe.Pointer(p)).Fop) { + case TK_IN: + { + if (seenNot != 0) && (((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_xIsSelect))) != U32(0)) { + return 0 + } + + return exprImpliesNotNull(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, 1) + + } + case TK_BETWEEN: + { + var pList uintptr = *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) + + if seenNot != 0 { + return 0 + } + if (exprImpliesNotNull(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */))).FpExpr, pNN, iTab, 1) != 0) || + (exprImpliesNotNull(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+1*32)).FpExpr, pNN, iTab, 1) != 0) { + return 1 + } + return exprImpliesNotNull(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, 1) + + } + case TK_EQ: + fallthrough + case TK_NE: + fallthrough + case TK_LT: + fallthrough + case TK_LE: + fallthrough + case TK_GT: + fallthrough + case TK_GE: + fallthrough + case TK_PLUS: + fallthrough + case TK_MINUS: + fallthrough + case TK_BITOR: + fallthrough + case TK_LSHIFT: + fallthrough + case TK_RSHIFT: + fallthrough + case TK_CONCAT: + seenNot = 1 + fallthrough + case TK_STAR: + fallthrough + case TK_REM: + fallthrough + case TK_BITAND: + fallthrough + case TK_SLASH: + { + if exprImpliesNotNull(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpRight, pNN, iTab, seenNot) != 0 { + return 1 + } + + } + fallthrough + case TK_SPAN: + fallthrough + case TK_COLLATE: + fallthrough + case TK_UPLUS: + fallthrough + case TK_UMINUS: + { + return exprImpliesNotNull(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, seenNot) + + } + case TK_TRUTH: + { + if seenNot != 0 { + return 0 + } + if int32((*Expr)(unsafe.Pointer(p)).Fop2) != TK_IS { + return 0 + } + return exprImpliesNotNull(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, 1) + + } + case TK_BITNOT: + fallthrough + case TK_NOT: + { + return exprImpliesNotNull(tls, pParse, (*Expr)(unsafe.Pointer(p)).FpLeft, pNN, iTab, 1) + + } + } + return 0 +} + +// Return true if we can prove the pE2 will always be true if pE1 is +// true. Return false if we cannot complete the proof or if pE2 might +// be false. Examples: +// +// pE1: x==5 pE2: x==5 Result: true +// pE1: x>0 pE2: x==5 Result: false +// pE1: x=21 pE2: x=21 OR y=43 Result: true +// pE1: x!=123 pE2: x IS NOT NULL Result: true +// pE1: x!=?1 pE2: x IS NOT NULL Result: true +// pE1: x IS NULL pE2: x IS NOT NULL Result: false +// pE1: x IS ?2 pE2: x IS NOT NULL Reuslt: false +// +// When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has +// Expr.iTable<0 then assume a table number given by iTab. +// +// If pParse is not NULL, then the values of bound variables in pE1 are +// compared against literal values in pE2 and pParse->pVdbe->expmask is +// modified to record which bound variables are referenced. If pParse +// is NULL, then false will be returned if pE1 contains any bound variables. +// +// When in doubt, return false. Returning true might give a performance +// improvement. Returning false might cause a performance reduction, but +// it will always give the correct answer and is hence always safe. +func Xsqlite3ExprImpliesExpr(tls *libc.TLS, pParse uintptr, pE1 uintptr, pE2 uintptr, iTab int32) int32 { /* sqlite3.c:106763:20: */ + if Xsqlite3ExprCompare(tls, pParse, pE1, pE2, iTab) == 0 { + return 1 + } + if (int32((*Expr)(unsafe.Pointer(pE2)).Fop) == TK_OR) && + ((Xsqlite3ExprImpliesExpr(tls, pParse, pE1, (*Expr)(unsafe.Pointer(pE2)).FpLeft, iTab) != 0) || + (Xsqlite3ExprImpliesExpr(tls, pParse, pE1, (*Expr)(unsafe.Pointer(pE2)).FpRight, iTab) != 0)) { + return 1 + } + if (int32((*Expr)(unsafe.Pointer(pE2)).Fop) == TK_NOTNULL) && + (exprImpliesNotNull(tls, pParse, pE1, (*Expr)(unsafe.Pointer(pE2)).FpLeft, iTab, 0) != 0) { + return 1 + } + return 0 +} + +// This is the Expr node callback for sqlite3ExprImpliesNonNullRow(). +// If the expression node requires that the table at pWalker->iCur +// have one or more non-NULL column, then set pWalker->eCode to 1 and abort. +// +// This routine controls an optimization. False positives (setting +// pWalker->eCode to 1 when it should not be) are deadly, but false-negatives +// (never setting pWalker->eCode) is a harmless missed optimization. +func impliesNotNullRow(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:106790:12: */ + + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0) { + return WRC_Prune + } + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + case TK_ISNOT: + fallthrough + case TK_ISNULL: + fallthrough + case TK_NOTNULL: + fallthrough + case TK_IS: + fallthrough + case TK_OR: + fallthrough + case TK_VECTOR: + fallthrough + case TK_CASE: + fallthrough + case TK_IN: + fallthrough + case TK_FUNCTION: + fallthrough + case TK_TRUTH: + + return WRC_Prune + case TK_COLUMN: + if *(*int32)(unsafe.Pointer(pWalker + 40 /* &.u */)) == (*Expr)(unsafe.Pointer(pExpr)).FiTable { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(1) + return WRC_Abort + } + return WRC_Prune + + case TK_AND: + if int32((*Walker)(unsafe.Pointer(pWalker)).FeCode) == 0 { + Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + if (*Walker)(unsafe.Pointer(pWalker)).FeCode != 0 { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + } + } + return WRC_Prune + + case TK_BETWEEN: + if Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) == WRC_Abort { + + return WRC_Abort + } + return WRC_Prune + + // Virtual tables are allowed to use constraints like x=NULL. So + // a term of the form x=y does not prove that y is not null if x + // is the column of a virtual table + case TK_EQ: + fallthrough + case TK_NE: + fallthrough + case TK_LT: + fallthrough + case TK_LE: + fallthrough + case TK_GT: + fallthrough + case TK_GE: + { + var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + var pRight uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpRight + + // The y.pTab=0 assignment in wherecode.c always happens after the + // impliesNotNullRow() test + if (((int32((*Expr)(unsafe.Pointer(pLeft)).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)) != uintptr(0))) && + ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)))).FnModuleArg != 0)) || + (((int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pRight + 64 /* &.y */)) != uintptr(0))) && + ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64 /* &.y */)))).FnModuleArg != 0)) { + return WRC_Prune + } + + } + fallthrough + default: + return WRC_Continue + } + return int32(0) +} + +// Return true (non-zero) if expression p can only be true if at least +// one column of table iTab is non-null. In other words, return true +// if expression p will always be NULL or false if every column of iTab +// is NULL. +// +// False negatives are acceptable. In other words, it is ok to return +// zero even if expression p will never be true of every column of iTab +// is NULL. A false negative is merely a missed optimization opportunity. +// +// False positives are not allowed, however. A false positive may result +// in an incorrect answer. +// +// Terms of p that are marked with EP_FromJoin (and hence that come from +// the ON or USING clauses of LEFT JOINS) are excluded from the analysis. +// +// This routine is used to check if a LEFT JOIN can be converted into +// an ordinary JOIN. The p argument is the WHERE clause. If the WHERE +// clause requires that some column of the right table of the LEFT JOIN +// be non-NULL, then the LEFT JOIN can be safely converted into an +// ordinary join. +func Xsqlite3ExprImpliesNonNullRow(tls *libc.TLS, p uintptr, iTab int32) int32 { /* sqlite3.c:106895:20: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + p = Xsqlite3ExprSkipCollateAndLikely(tls, p) + if p == uintptr(0) { + return 0 + } + if int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_NOTNULL { + p = (*Expr)(unsafe.Pointer(p)).FpLeft + } else { + for int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_AND { + if Xsqlite3ExprImpliesNonNullRow(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, iTab) != 0 { + return 1 + } + p = (*Expr)(unsafe.Pointer(p)).FpRight + } + } + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{impliesNotNullRow})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = uintptr(0) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = uintptr(0) + (*Walker)(unsafe.Pointer(bp /* &w */)).FeCode = U16(0) + *(*int32)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = iTab + Xsqlite3WalkExpr(tls, bp /* &w */, p) + return int32((*Walker)(unsafe.Pointer(bp /* &w */)).FeCode) +} + +// Check to see if there are references to columns in table +// pWalker->u.pIdxCover->iCur can be satisfied using the index +// pWalker->u.pIdxCover->pIdx. +func exprIdxCover(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:106933:12: */ + if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) && + ((*Expr)(unsafe.Pointer(pExpr)).FiTable == (*IdxCover)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)))).FiCur)) && + (int32(Xsqlite3TableColumnToIndex(tls, (*IdxCover)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)))).FpIdx, (*Expr)(unsafe.Pointer(pExpr)).FiColumn)) < 0) { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(1) + return WRC_Abort + } + return WRC_Continue +} + +// Determine if an index pIdx on table with cursor iCur contains will +// the expression pExpr. Return true if the index does cover the +// expression and false if the pExpr expression references table columns +// that are not found in the index pIdx. +// +// An index covering an expression means that the expression can be +// evaluated using only the index and without having to lookup the +// corresponding table entry. +func Xsqlite3ExprCoveredByIndex(tls *libc.TLS, pExpr uintptr, iCur int32, pIdx uintptr) int32 { /* sqlite3.c:106954:20: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + // var w Walker at bp, 48 + + // var xcov IdxCover at bp+48, 16 + + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*IdxCover)(unsafe.Pointer(bp + 48 /* &xcov */)).FiCur = iCur + (*IdxCover)(unsafe.Pointer(bp + 48 /* &xcov */)).FpIdx = pIdx + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{exprIdxCover})) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = bp + 48 /* &xcov */ + Xsqlite3WalkExpr(tls, bp /* &w */, pExpr) + return libc.BoolInt32(!((*Walker)(unsafe.Pointer(bp /* &w */)).FeCode != 0)) +} + +// xSelect callback for sqlite3FunctionUsesThisSrc(). If this is the first +// SELECT with a FROM clause encountered during this iteration, set +// SrcCount.iSrcInner to the cursor number of the leftmost object in +// the FROM cause. +func selectSrcCount(tls *libc.TLS, pWalker uintptr, pSel uintptr) int32 { /* sqlite3.c:106990:12: */ + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + if (((*SrcCount)(unsafe.Pointer(p)).FiSrcInner == 0x7FFFFFFF) && ((*Select)(unsafe.Pointer(pSel)).FpSrc != 0)) && ((*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpSrc)).FnSrc != 0) { + (*SrcCount)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)))).FiSrcInner = (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSel)).FpSrc + 8 /* &.a */))).FiCursor + } + return WRC_Continue +} + +// Count the number of references to columns. +func exprSrcCount(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:107001:12: */ + // There was once a NEVER() on the second term on the grounds that + // sqlite3FunctionUsesThisSrc() was always called before + // sqlite3ExprAnalyzeAggregates() and so the TK_COLUMNs have not yet + // been converted into TK_AGG_COLUMN. But this is no longer true due + // to window functions - sqlite3WindowRewrite() may now indirectly call + // FunctionUsesThisSrc() when creating a new sub-select. + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_COLUMN) { + var i int32 + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var pSrc uintptr = (*SrcCount)(unsafe.Pointer(p)).FpSrc + var nSrc int32 + if pSrc != 0 { + nSrc = (*SrcList)(unsafe.Pointer(pSrc)).FnSrc + } else { + nSrc = 0 + } + for i = 0; i < nSrc; i++ { + if (*Expr)(unsafe.Pointer(pExpr)).FiTable == (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FiCursor { + break + } + } + if i < nSrc { + (*SrcCount)(unsafe.Pointer(p)).FnThis++ + } else if (*Expr)(unsafe.Pointer(pExpr)).FiTable < (*SrcCount)(unsafe.Pointer(p)).FiSrcInner { + // In a well-formed parse tree (no name resolution errors), + // TK_COLUMN nodes with smaller Expr.iTable values are in an + // outer context. Those are the only ones to count as "other" + (*SrcCount)(unsafe.Pointer(p)).FnOther++ + } + } + return WRC_Continue +} + +// Determine if any of the arguments to the pExpr Function reference +// pSrcList. Return true if they do. Also return true if the function +// has no arguments or has only constant arguments. Return false if pExpr +// references columns but not columns of tables found in pSrcList. +func Xsqlite3FunctionUsesThisSrc(tls *libc.TLS, pExpr uintptr, pSrcList uintptr) int32 { /* sqlite3.c:107034:20: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var w Walker at bp, 48 + + // var cnt SrcCount at bp+48, 24 + + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{exprSrcCount})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{selectSrcCount})) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = bp + 48 /* &cnt */ + (*SrcCount)(unsafe.Pointer(bp + 48 /* &cnt */)).FpSrc = pSrcList + (*SrcCount)(unsafe.Pointer(bp + 48 /* &cnt */)).FiSrcInner = func() int32 { + if (pSrcList != 0) && ((*SrcList)(unsafe.Pointer(pSrcList)).FnSrc != 0) { + return (*SrcItem)(unsafe.Pointer((pSrcList + 8 /* &.a */))).FiCursor + } + return 0x7FFFFFFF + }() + (*SrcCount)(unsafe.Pointer(bp + 48 /* &cnt */)).FnThis = 0 + (*SrcCount)(unsafe.Pointer(bp + 48 /* &cnt */)).FnOther = 0 + Xsqlite3WalkExprList(tls, bp /* &w */, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + Xsqlite3WalkExpr(tls, bp /* &w */, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpFilter) + } + return (libc.Bool32(((*SrcCount)(unsafe.Pointer(bp+48 /* &cnt */)).FnThis > 0) || ((*SrcCount)(unsafe.Pointer(bp+48 /* &cnt */)).FnOther == 0))) +} + +// This is a Walker expression node callback. +// +// For Expr nodes that contain pAggInfo pointers, make sure the AggInfo +// object that is referenced does not refer directly to the Expr. If +// it does, make a copy. This is done because the pExpr argument is +// subject to change. +// +// The copy is stored on pParse->pConstExpr with a register number of 0. +// This will cause the expression to be deleted automatically when the +// Parse object is destroyed, but the zero register number means that it +// will not generate any code in the preamble. +func agginfoPersistExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:107068:12: */ + if (!(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_TokenOnly | EP_Reduced))) != U32(0))) && + ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo != uintptr(0)) { + var pAggInfo uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpAggInfo + var iAgg int32 = int32((*Expr)(unsafe.Pointer(pExpr)).FiAgg) + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_COLUMN { + + if (*AggInfo_col)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol+uintptr(iAgg)*32)).FpCExpr == pExpr { + pExpr = Xsqlite3ExprDup(tls, db, pExpr, 0) + if pExpr != 0 { + (*AggInfo_col)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(iAgg)*32)).FpCExpr = pExpr + Xsqlite3ExprDeferredDelete(tls, pParse, pExpr) + } + } + } else { + + if (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc+uintptr(iAgg)*32)).FpFExpr == pExpr { + pExpr = Xsqlite3ExprDup(tls, db, pExpr, 0) + if pExpr != 0 { + (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(iAgg)*32)).FpFExpr = pExpr + Xsqlite3ExprDeferredDelete(tls, pParse, pExpr) + } + } + } + } + return WRC_Continue +} + +// Initialize a Walker object so that will persist AggInfo entries referenced +// by the tree that is walked. +func Xsqlite3AggInfoPersistWalkerInit(tls *libc.TLS, pWalker uintptr, pParse uintptr) { /* sqlite3.c:107104:21: */ + libc.Xmemset(tls, pWalker, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(pWalker)).FpParse = pParse + (*Walker)(unsafe.Pointer(pWalker)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{agginfoPersistExprCb})) + (*Walker)(unsafe.Pointer(pWalker)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkNoop})) +} + +// Add a new element to the pAggInfo->aCol[] array. Return the index of +// the new element. Return a negative number if malloc fails. +func addAggInfoColumn(tls *libc.TLS, db uintptr, pInfo uintptr) int32 { /* sqlite3.c:107115:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var i int32 at bp, 4 + + (*AggInfo)(unsafe.Pointer(pInfo)).FaCol = Xsqlite3ArrayAllocate(tls, + db, + (*AggInfo)(unsafe.Pointer(pInfo)).FaCol, + int32(unsafe.Sizeof(AggInfo_col{})), + (pInfo + 40 /* &.nColumn */), + bp /* &i */) + return *(*int32)(unsafe.Pointer(bp /* i */)) +} + +// Add a new element to the pAggInfo->aFunc[] array. Return the index of +// the new element. Return a negative number if malloc fails. +func addAggInfoFunc(tls *libc.TLS, db uintptr, pInfo uintptr) int32 { /* sqlite3.c:107131:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var i int32 at bp, 4 + + (*AggInfo)(unsafe.Pointer(pInfo)).FaFunc = Xsqlite3ArrayAllocate(tls, + db, + (*AggInfo)(unsafe.Pointer(pInfo)).FaFunc, + int32(unsafe.Sizeof(AggInfo_func{})), + (pInfo + 56 /* &.nFunc */), + bp /* &i */) + return *(*int32)(unsafe.Pointer(bp /* i */)) +} + +// This is the xExprCallback for a tree walker. It is used to +// implement sqlite3ExprAnalyzeAggregates(). See sqlite3ExprAnalyzeAggregates +// for additional information. +func analyzeAggregate(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:107148:12: */ + var i int32 + var pNC uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var pParse uintptr = (*NameContext)(unsafe.Pointer(pNC)).FpParse + var pSrcList uintptr = (*NameContext)(unsafe.Pointer(pNC)).FpSrcList + var pAggInfo uintptr = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) + + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + case TK_AGG_COLUMN: + fallthrough + case TK_COLUMN: + { + + // Check to see if the column is in one of the tables in the FROM + // clause of the aggregate query + if pSrcList != uintptr(0) { + var pItem uintptr = pSrcList + 8 /* &.a */ + i = 0 + __1: + if !(i < (*SrcList)(unsafe.Pointer(pSrcList)).FnSrc) { + goto __3 + } + { + var pCol uintptr + + if (*Expr)(unsafe.Pointer(pExpr)).FiTable == (*SrcItem)(unsafe.Pointer(pItem)).FiCursor { + // If we reach this point, it means that pExpr refers to a table + // that is in the FROM clause of the aggregate query. + // + // Make an entry for the column in pAggInfo->aCol[] if there + // is not an entry there already. + var k int32 + pCol = (*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol + k = 0 + __4: + if !(k < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + goto __6 + } + { + if ((*AggInfo_col)(unsafe.Pointer(pCol)).FiTable == (*Expr)(unsafe.Pointer(pExpr)).FiTable) && (int32((*AggInfo_col)(unsafe.Pointer(pCol)).FiColumn) == int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) { + goto __6 + } + + } + goto __5 + __5: + k++ + pCol += 32 + goto __4 + goto __6 + __6: + ; + if (k >= (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) && + ((libc.AssignInt32(&k, addAggInfoColumn(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pAggInfo))) >= 0) { + pCol = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(k)*32) + (*AggInfo_col)(unsafe.Pointer(pCol)).FpTab = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + (*AggInfo_col)(unsafe.Pointer(pCol)).FiTable = (*Expr)(unsafe.Pointer(pExpr)).FiTable + (*AggInfo_col)(unsafe.Pointer(pCol)).FiColumn = (*Expr)(unsafe.Pointer(pExpr)).FiColumn + (*AggInfo_col)(unsafe.Pointer(pCol)).FiMem = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + (*AggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = int16(-1) + (*AggInfo_col)(unsafe.Pointer(pCol)).FpCExpr = pExpr + if (*AggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy != 0 { + var j int32 + var n int32 + var pGB uintptr = (*AggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy + var pTerm uintptr = pGB + 8 /* &.a */ + n = (*ExprList)(unsafe.Pointer(pGB)).FnExpr + j = 0 + __7: + if !(j < n) { + goto __9 + } + { + var pE uintptr = (*ExprList_item)(unsafe.Pointer(pTerm)).FpExpr + if ((int32((*Expr)(unsafe.Pointer(pE)).Fop) == TK_COLUMN) && ((*Expr)(unsafe.Pointer(pE)).FiTable == (*Expr)(unsafe.Pointer(pExpr)).FiTable)) && (int32((*Expr)(unsafe.Pointer(pE)).FiColumn) == int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) { + (*AggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = I16(j) + goto __9 + } + + } + goto __8 + __8: + j++ + pTerm += 32 + goto __7 + goto __9 + __9: + } + if int32((*AggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn) < 0 { + (*AggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn = I16(libc.PostIncInt32(&(*AggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn, 1)) + } + } + // There is now an entry for pExpr in pAggInfo->aCol[] (either + // because it was there before or because we just created it). + // Convert the pExpr to be a TK_AGG_COLUMN referring to that + // pAggInfo->aCol[] entry. + + (*Expr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_AGG_COLUMN) + (*Expr)(unsafe.Pointer(pExpr)).FiAgg = I16(k) + goto __3 + } // endif pExpr->iTable==pItem->iCursor + + } + goto __2 + __2: + i++ + pItem += 112 + goto __1 + goto __3 + __3: // end loop over pSrcList + } + return WRC_Prune + + } + case TK_AGG_FUNCTION: + { + if (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_InAggFunc) == 0) && + ((*Walker)(unsafe.Pointer(pWalker)).FwalkerDepth == int32((*Expr)(unsafe.Pointer(pExpr)).Fop2)) { + // Check to see if pExpr is a duplicate of another aggregate + // function that is already in the pAggInfo structure + var pItem uintptr = (*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + i = 0 + __10: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __12 + } + { + if (*AggInfo_func)(unsafe.Pointer(pItem)).FpFExpr == pExpr { + goto __12 + } + if Xsqlite3ExprCompare(tls, uintptr(0), (*AggInfo_func)(unsafe.Pointer(pItem)).FpFExpr, pExpr, -1) == 0 { + goto __12 + } + + } + goto __11 + __11: + i++ + pItem += 32 + goto __10 + goto __12 + __12: + ; + if i >= (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc { + // pExpr is original. Make a new entry in pAggInfo->aFunc[] + var enc U8 = (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fenc + i = addAggInfoFunc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pAggInfo) + if i >= 0 { + + pItem = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32) + (*AggInfo_func)(unsafe.Pointer(pItem)).FpFExpr = pExpr + (*AggInfo_func)(unsafe.Pointer(pItem)).FiMem = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + + (*AggInfo_func)(unsafe.Pointer(pItem)).FpFunc = Xsqlite3FindFunction(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), + func() int32 { + if *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) != 0 { + return (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FnExpr + } + return 0 + }(), enc, uint8(0)) + if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_Distinct)) != 0 { + (*AggInfo_func)(unsafe.Pointer(pItem)).FiDistinct = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + } else { + (*AggInfo_func)(unsafe.Pointer(pItem)).FiDistinct = -1 + } + } + } + // Make pExpr point to the appropriate pAggInfo->aFunc[] entry + + (*Expr)(unsafe.Pointer(pExpr)).FiAgg = I16(i) + (*Expr)(unsafe.Pointer(pExpr)).FpAggInfo = pAggInfo + return WRC_Prune + } else { + return WRC_Continue + } + + } + } + return WRC_Continue +} + +// Analyze the pExpr expression looking for aggregate functions and +// for variables that need to be added to AggInfo object that pNC->pAggInfo +// points to. Additional entries are made on the AggInfo object as +// necessary. +// +// This routine should only be called after the expression has been +// analyzed by sqlite3ResolveExprNames(). +func Xsqlite3ExprAnalyzeAggregates(tls *libc.TLS, pNC uintptr, pExpr uintptr) { /* sqlite3.c:107285:21: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{analyzeAggregate})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3WalkerDepthIncrease})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3WalkerDepthDecrease})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FwalkerDepth = 0 + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = pNC + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = uintptr(0) + + Xsqlite3WalkExpr(tls, bp /* &w */, pExpr) +} + +// Call sqlite3ExprAnalyzeAggregates() for every expression in an +// expression list. Return the number of errors. +// +// If an error is found, the analysis is cut short. +func Xsqlite3ExprAnalyzeAggList(tls *libc.TLS, pNC uintptr, pList uintptr) { /* sqlite3.c:107303:21: */ + var pItem uintptr + var i int32 + if pList != 0 { + pItem = pList + 8 /* &.a */ + i = 0 + __1: + if !(i < (*ExprList)(unsafe.Pointer(pList)).FnExpr) { + goto __3 + } + { + Xsqlite3ExprAnalyzeAggregates(tls, pNC, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr) + + } + goto __2 + __2: + i++ + pItem += 32 + goto __1 + goto __3 + __3: + } +} + +// Allocate a single new register for use to hold some intermediate result. +func Xsqlite3GetTempReg(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:107316:20: */ + if int32((*Parse)(unsafe.Pointer(pParse)).FnTempReg) == 0 { + return libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + return *(*int32)(unsafe.Pointer((pParse + 208 /* &.aTempReg */) + uintptr(libc.PreDecUint8(&(*Parse)(unsafe.Pointer(pParse)).FnTempReg, 1))*4)) +} + +// Deallocate a register, making available for reuse for some other +// purpose. +func Xsqlite3ReleaseTempReg(tls *libc.TLS, pParse uintptr, iReg int32) { /* sqlite3.c:107327:21: */ + if iReg != 0 { + + if int32((*Parse)(unsafe.Pointer(pParse)).FnTempReg) < (int32(uint64(unsafe.Sizeof([8]int32{})) / uint64(unsafe.Sizeof(int32(0))))) { + *(*int32)(unsafe.Pointer((pParse + 208 /* &.aTempReg */) + uintptr(libc.PostIncUint8(&(*Parse)(unsafe.Pointer(pParse)).FnTempReg, 1))*4)) = iReg + } + } +} + +// Allocate or deallocate a block of nReg consecutive registers. +func Xsqlite3GetTempRange(tls *libc.TLS, pParse uintptr, nReg int32) int32 { /* sqlite3.c:107339:20: */ + var i int32 + var n int32 + if nReg == 1 { + return Xsqlite3GetTempReg(tls, pParse) + } + i = (*Parse)(unsafe.Pointer(pParse)).FiRangeReg + n = (*Parse)(unsafe.Pointer(pParse)).FnRangeReg + if nReg <= n { + *(*int32)(unsafe.Pointer(pParse + 44 /* &.iRangeReg */)) += (nReg) + *(*int32)(unsafe.Pointer(pParse + 40 /* &.nRangeReg */)) -= (nReg) + } else { + i = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nReg) + } + return i +} + +func Xsqlite3ReleaseTempRange(tls *libc.TLS, pParse uintptr, iReg int32, nReg int32) { /* sqlite3.c:107353:21: */ + if nReg == 1 { + Xsqlite3ReleaseTempReg(tls, pParse, iReg) + return + } + + if nReg > (*Parse)(unsafe.Pointer(pParse)).FnRangeReg { + (*Parse)(unsafe.Pointer(pParse)).FnRangeReg = nReg + (*Parse)(unsafe.Pointer(pParse)).FiRangeReg = iReg + } +} + +// Mark all temporary registers as being unavailable for reuse. +// +// Always invoke this procedure after coding a subroutine or co-routine +// that might be invoked from other parts of the code, to ensure that +// the sub/co-routine does not use registers in common with the code that +// invokes the sub/co-routine. +func Xsqlite3ClearTempRegCache(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:107373:21: */ + (*Parse)(unsafe.Pointer(pParse)).FnTempReg = U8(0) + (*Parse)(unsafe.Pointer(pParse)).FnRangeReg = 0 +} + +// Validate that no temporary register falls within the range of +// iFirst..iLast, inclusive. This routine is only call from within assert() +// statements. + +//************* End of expr.c *********************************************** +//************* Begin file alter.c ****************************************** +// 2005 February 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains C code routines that used to generate VDBE code +// that implements the ALTER TABLE command. +// #include "sqliteInt.h" + +// The code in this file only exists if we are not omitting the +// ALTER TABLE logic from the build. + +// Parameter zName is the name of a table that is about to be altered +// (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). +// If the table is a system table, this function leaves an error message +// in pParse->zErr (system tables may not be altered) and returns non-zero. +// +// Or, if zName is not a system table, zero is returned. +func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sqlite3.c:107433:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7082 /* "sqlite_" */, 7)) || + (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || + ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && + (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { + Xsqlite3ErrorMsg(tls, pParse, ts+7090 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + return 1 + } + return 0 +} + +// Generate code to verify that the schemas of database zDb and, if +// bTemp is not true, database "temp", can still be parsed. This is +// called at the end of the generation of an ALTER TABLE ... RENAME ... +// statement to ensure that the operation has not rendered any schema +// objects unusable. +func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, zWhen uintptr, bNoDQS int32) { /* sqlite3.c:107455:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) + Xsqlite3NestedParse(tls, pParse, + + ts+7118, /* "SELECT 1 FROM \"%..." */ + libc.VaList(bp, zDb, + zDb, bTemp, zWhen, bNoDQS)) + + if bTemp == 0 { + Xsqlite3NestedParse(tls, pParse, + + ts+7293, /* "SELECT 1 FROM te..." */ + libc.VaList(bp+40, zDb, zWhen, bNoDQS)) + } +} + +// Generate VM code to replace any double-quoted strings (but not double-quoted +// identifiers) within the "sql" column of the sqlite_schema table in +// database zDb with their single-quoted equivalents. If argument bTemp is +// not true, similarly update all SQL statements in the sqlite_schema table +// of the temp db. +func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { /* sqlite3.c:107492:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + Xsqlite3NestedParse(tls, pParse, + + ts+7467 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + if bTemp == 0 { + Xsqlite3NestedParse(tls, pParse, + + ts+7614 /* "UPDATE temp.sqli..." */, 0) + } +} + +// Generate code to reload the schema for database iDb. And, if iDb!=1, for +// the temp database as well. +func renameReloadSchema(tls *libc.TLS, pParse uintptr, iDb int32, p5 U16) { /* sqlite3.c:107513:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + if v != 0 { + Xsqlite3ChangeCookie(tls, pParse, iDb) + Xsqlite3VdbeAddParseSchemaOp(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, iDb, uintptr(0), p5) + if iDb != 1 { + Xsqlite3VdbeAddParseSchemaOp(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, 1, uintptr(0), p5) + } + } +} + +// Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" +// command. +func Xsqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName uintptr) { /* sqlite3.c:107526:21: */ + bp := tls.Alloc(184) + defer tls.Free(184) + + var iDb int32 // Database that contains the table + var zDb uintptr // Name of database iDb + var pTab uintptr // Table being renamed + var zName uintptr // NULL-terminated version of pName + var db uintptr // Database connection + var nTabName int32 // Number of UTF-8 characters in zTabName + var zTabName uintptr // Original name of the table + var v uintptr + var pVTab uintptr // Non-zero if this is a v-tab with an xRename() + var savedDbFlags U32 + var i int32 + zName = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pVTab = uintptr(0) // Saved value of db->mDbFlags + + savedDbFlags = (*Sqlite3)(unsafe.Pointer(db)).FmDbFlags + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __1 + } + goto exit_rename_table +__1: + ; + + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), (pSrc + 8 /* &.a */)) + if !(!(pTab != 0)) { + goto __2 + } + goto exit_rename_table +__2: + ; + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_PreferBuiltin)) + + // Get a NULL terminated version of the new table name. + zName = Xsqlite3NameFromToken(tls, db, pName) + if !(!(zName != 0)) { + goto __3 + } + goto exit_rename_table +__3: + ; + + // Check that a table or index named 'zName' does not already exist + // in database iDb. If so, this is an error. + if !(((Xsqlite3FindTable(tls, db, zName, zDb) != 0) || + (Xsqlite3FindIndex(tls, db, zName, zDb) != 0)) || + (Xsqlite3IsShadowTableOf(tls, db, pTab, zName) != 0)) { + goto __4 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+7765 /* "there is already..." */, libc.VaList(bp, zName)) + goto exit_rename_table +__4: + ; + + // Make sure it is not a system table being altered, or a reserved name + // that the table is being renamed to. + if !(SQLITE_OK != isAlterableTable(tls, pParse, pTab)) { + goto __5 + } + goto exit_rename_table +__5: + ; + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7824 /* "table" */, zName)) { + goto __6 + } + goto exit_rename_table +__6: + ; + + if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { + goto __7 + } + Xsqlite3ErrorMsg(tls, pParse, ts+7830 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto exit_rename_table +__7: + ; + + // Invoke the authorization callback. + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_ALTER_TABLE, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0) { + goto __8 + } + goto exit_rename_table +__8: + ; + + if !(Xsqlite3ViewGetColumnNames(tls, pParse, pTab) != 0) { + goto __9 + } + goto exit_rename_table +__9: + ; + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __10 + } + pVTab = Xsqlite3GetVTable(tls, db, pTab) + if !((*Sqlite3_module)(unsafe.Pointer((*Sqlite3_vtab)(unsafe.Pointer((*VTable)(unsafe.Pointer(pVTab)).FpVtab)).FpModule)).FxRename == uintptr(0)) { + goto __11 + } + pVTab = uintptr(0) +__11: + ; +__10: + ; + + // Begin a transaction for database iDb. Then modify the schema cookie + // (since the ALTER TABLE modifies the schema). Call sqlite3MayAbort(), + // as the scalar functions (e.g. sqlite_rename_table()) invoked by the + // nested SQL may raise an exception. + v = Xsqlite3GetVdbe(tls, pParse) + if !(v == uintptr(0)) { + goto __12 + } + goto exit_rename_table +__12: + ; + Xsqlite3MayAbort(tls, pParse) + + // figure out how many UTF-8 characters are in zName + zTabName = (*Table)(unsafe.Pointer(pTab)).FzName + nTabName = Xsqlite3Utf8CharLen(tls, zTabName, -1) + + // Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in + // the schema to use the new table name. + Xsqlite3NestedParse(tls, pParse, + + ts+7857 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + + // Update the tbl_name and name columns of the sqlite_schema table + // as required. + Xsqlite3NestedParse(tls, pParse, + + ts+8041, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp+64, zDb, + zName, zName, zName, + nTabName, zTabName)) + + // If the sqlite_sequence table exists in this database, then update + // it with the new table name. + if !(Xsqlite3FindTable(tls, db, ts+8346 /* "sqlite_sequence" */, zDb) != 0) { + goto __13 + } + Xsqlite3NestedParse(tls, pParse, + ts+8362, /* "UPDATE \"%w\".sqli..." */ + libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) +__13: + ; + + // If the table being renamed is not itself part of the temp database, + // edit view and trigger definitions within the temp database + // as required. + if !(iDb != 1) { + goto __14 + } + Xsqlite3NestedParse(tls, pParse, + + ts+8420 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) +__14: + ; + + // If this is a virtual table, invoke the xRename() function if + // one is defined. The xRename() callback will modify the names + // of any resources used by the v-table implementation (including other + // SQLite tables) that are identified by the name of the virtual table. + if !(pVTab != 0) { + goto __15 + } + i = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeLoadString(tls, v, i, zName) + Xsqlite3VdbeAddOp4(tls, v, OP_VRename, i, 0, 0, pVTab, -12) +__15: + ; + + renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8685 /* "after rename" */, 0) + +exit_rename_table: + Xsqlite3SrcListDelete(tls, db, pSrc) + Xsqlite3DbFree(tls, db, zName) + (*Sqlite3)(unsafe.Pointer(db)).FmDbFlags = savedDbFlags +} + +// Write code that will raise an error if the table described by +// zDb and zTab is not empty. +func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { /* sqlite3.c:107699:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + Xsqlite3NestedParse(tls, pParse, + ts+8698, /* "SELECT raise(ABO..." */ + libc.VaList(bp, zErr, zDb, zTab)) +} + +// This function is called after an "ALTER TABLE ... ADD" statement +// has been parsed. Argument pColDef contains the text of the new +// column definition. +// +// The Table structure pParse->pNewTable was extended to include +// the new column during parsing. +func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr) { /* sqlite3.c:107719:21: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pNew uintptr // Copy of pParse->pNewTable + var pTab uintptr // Table being altered + var iDb int32 // Database number + var zDb uintptr // Database name + var zTab uintptr // Table name + var zCol uintptr // Null-terminated column definition + var pCol uintptr // The new column + var pDflt uintptr // Default value for the new column + var db uintptr // The database connection; + var v uintptr // The prepared statement under construction + var r1 int32 // Temporary registers + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return + } + pNew = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pNew)).FpSchema) + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + zTab = ((*Table)(unsafe.Pointer(pNew)).FzName + 16) // Skip the "sqlite_altertab_" prefix on the name + pCol = ((*Table)(unsafe.Pointer(pNew)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(pNew)).FnCol)-1))*32) + pDflt = (*Column)(unsafe.Pointer(pCol)).FpDflt + pTab = Xsqlite3FindTable(tls, db, zTab, zDb) + + // Invoke the authorization callback. + if Xsqlite3AuthCheck(tls, pParse, SQLITE_ALTER_TABLE, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0 { + return + } + + // Check that the new column is not specified as PRIMARY KEY or UNIQUE. + // If there is a NOT NULL constraint, then the default value for the + // column must not be NULL. + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+8736 /* "Cannot add a PRI..." */, 0) + return + } + if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { + Xsqlite3ErrorMsg(tls, pParse, + ts+8768 /* "Cannot add a UNI..." */, 0) + return + } + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { + // If the default value for the new column was specified with a + // literal NULL, then set pDflt to 0. This simplifies checking + // for an SQL NULL default below. + + if (pDflt != 0) && (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pDflt)).FpLeft)).Fop) == TK_NULL) { + pDflt = uintptr(0) + } + if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, + ts+8795 /* "Cannot add a REF..." */) + } + if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, + ts+8854 /* "Cannot add a NOT..." */) + } + + // Ensure the default expression is something that sqlite3ValueFromExpr() + // can handle (i.e. not CURRENT_TIME etc.) + if pDflt != 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) = uintptr(0) + var rc int32 + rc = Xsqlite3ValueFromExpr(tls, db, pDflt, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp+40 /* &pVal */) + + if rc != SQLITE_OK { + + return + } + if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, + ts+8907 /* "Cannot add a col..." */) + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) + } + } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8953 /* "cannot add a STO..." */) + } + + // Modify the CREATE TABLE statement. + zCol = Xsqlite3DbStrNDup(tls, db, (*Token)(unsafe.Pointer(pColDef)).Fz, uint64((*Token)(unsafe.Pointer(pColDef)).Fn)) + if zCol != 0 { + var zEnd uintptr = (zCol + uintptr(((*Token)(unsafe.Pointer(pColDef)).Fn - uint32(1)))) + var savedDbFlags U32 = (*Sqlite3)(unsafe.Pointer(db)).FmDbFlags + for (zEnd > zCol) && ((int32(*(*int8)(unsafe.Pointer(zEnd))) == ';') || ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd)))]) & 0x01) != 0)) { + *(*int8)(unsafe.Pointer(libc.PostDecUintptr(&zEnd, 1))) = int8(0) + } + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_PreferBuiltin)) + // substr() operations on characters, but addColOffset is in bytes. So we + // have to use printf() to translate between these units: + Xsqlite3NestedParse(tls, pParse, + + ts+8980, /* "UPDATE \"%w\".sqli..." */ + libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, + zTab)) + Xsqlite3DbFree(tls, db, zCol) + (*Sqlite3)(unsafe.Pointer(db)).FmDbFlags = savedDbFlags + } + + // Make sure the schema version is at least 3. But do not upgrade + // from less than 3 to 4, as that will corrupt any preexisting DESC + // index. + v = Xsqlite3GetVdbe(tls, pParse) + if v != 0 { + r1 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT) + Xsqlite3VdbeUsesBtree(tls, v, iDb) + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, r1, -2) + Xsqlite3VdbeAddOp2(tls, v, OP_IfPos, r1, (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + + Xsqlite3VdbeAddOp3(tls, v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + } + + // Reload the table definition + renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) +} + +// This function is called by the parser after the table-name in +// an "ALTER TABLE ADD" statement is parsed. Argument +// pSrc is the full-name of the table being altered. +// +// This routine makes a (partial) copy of the Table structure +// for the table being altered and sets Parse.pNewTable to point +// to it. Routines called by the parser as the column definition +// is parsed (i.e. sqlite3AddColumn()) add the new Column data to +// the copy. The copy of the Table structure is deleted by tokenize.c +// after parsing is finished. +// +// Routine sqlite3AlterFinishAddColumn() will be called to complete +// coding the "ALTER TABLE ... ADD" statement. +func Xsqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { /* sqlite3.c:107867:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pNew uintptr + var pTab uintptr + var iDb int32 + var i int32 + var nAlloc int32 + var db uintptr + var pCol uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + // Look up the table being altered. + + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __1 + } + goto exit_begin_add_column +__1: + ; + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), (pSrc + 8 /* &.a */)) + if !(!(pTab != 0)) { + goto __2 + } + goto exit_begin_add_column +__2: + ; + + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __3 + } + Xsqlite3ErrorMsg(tls, pParse, ts+9126 /* "virtual tables m..." */, 0) + goto exit_begin_add_column +__3: + ; + + // Make sure this is not an attempt to ALTER a view. + if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { + goto __4 + } + Xsqlite3ErrorMsg(tls, pParse, ts+9160 /* "Cannot add a col..." */, 0) + goto exit_begin_add_column +__4: + ; + if !(SQLITE_OK != isAlterableTable(tls, pParse, pTab)) { + goto __5 + } + goto exit_begin_add_column +__5: + ; + + Xsqlite3MayAbort(tls, pParse) + + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + // Put a copy of the Table struct in Parse.pNewTable for the + // sqlite3AddColumn() function and friends to modify. But modify + // the name by adding an "sqlite_altertab_" prefix. By adding this + // prefix, we insure that the name will not collide with an existing + // table because user table are not allowed to have the "sqlite_" + // prefix on their name. + pNew = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Table{}))) + if !(!(pNew != 0)) { + goto __6 + } + goto exit_begin_add_column +__6: + ; + (*Parse)(unsafe.Pointer(pParse)).FpNewTable = pNew + (*Table)(unsafe.Pointer(pNew)).FnTabRef = U32(1) + (*Table)(unsafe.Pointer(pNew)).FnCol = (*Table)(unsafe.Pointer(pTab)).FnCol + + nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) + + (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Column{})) * uint64(nAlloc)))) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9190 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { + goto __7 + } + + goto exit_begin_add_column +__7: + ; + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pNew)).FaCol, (*Table)(unsafe.Pointer(pTab)).FaCol, (uint64(unsafe.Sizeof(Column{})) * uint64((*Table)(unsafe.Pointer(pNew)).FnCol))) + i = 0 +__8: + if !(i < int32((*Table)(unsafe.Pointer(pNew)).FnCol)) { + goto __10 + } + pCol = ((*Table)(unsafe.Pointer(pNew)).FaCol + uintptr(i)*32) + (*Column)(unsafe.Pointer(pCol)).FzName = Xsqlite3DbStrDup(tls, db, (*Column)(unsafe.Pointer(pCol)).FzName) + (*Column)(unsafe.Pointer(pCol)).FhName = Xsqlite3StrIHash(tls, (*Column)(unsafe.Pointer(pCol)).FzName) + (*Column)(unsafe.Pointer(pCol)).FzColl = uintptr(0) + (*Column)(unsafe.Pointer(pCol)).FpDflt = uintptr(0) + goto __9 +__9: + i++ + goto __8 + goto __10 +__10: + ; + (*Table)(unsafe.Pointer(pNew)).FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + (*Table)(unsafe.Pointer(pNew)).FaddColOffset = (*Table)(unsafe.Pointer(pTab)).FaddColOffset + (*Table)(unsafe.Pointer(pNew)).FnTabRef = U32(1) + +exit_begin_add_column: + Xsqlite3SrcListDelete(tls, db, pSrc) + return +} + +// Parameter pTab is the subject of an ALTER TABLE ... RENAME COLUMN +// command. This function checks if the table is a view or virtual +// table (columns of views or virtual tables may not be renamed). If so, +// it loads an error message into pParse and returns non-zero. +// +// Or, if pTab is not a view or virtual table, zero is returned. +func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 { /* sqlite3.c:107949:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zType uintptr = uintptr(0) + if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { + zType = ts + 9209 /* "view" */ + } + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + zType = ts + 9214 /* "virtual table" */ + } + if zType != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+9228, /* "cannot %s %s \"%s..." */ + libc.VaList(bp, func() uintptr { + if bDrop != 0 { + return ts + 9246 /* "drop column from" */ + } + return ts + 9263 /* "rename columns o..." */ + }(), + zType, (*Table)(unsafe.Pointer(pTab)).FzName)) + return 1 + } + return 0 +} + +// Handles the following parser reduction: +// +// cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew +func Xsqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld uintptr, pNew uintptr) { /* sqlite3.c:107979:21: */ + bp := tls.Alloc(112) + defer tls.Free(112) + + var db uintptr // Database connection + var pTab uintptr // Table being updated + var iCol int32 // Index of column being renamed + var zOld uintptr // Old column name + var zNew uintptr // New column name + var zDb uintptr // Name of schema containing the table + var iSchema int32 // Index of the schema + var bQuote int32 + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + zOld = uintptr(0) + zNew = uintptr(0) // True to quote the new name + + // Locate the table to be altered + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), (pSrc + 8 /* &.a */)) + if !(!(pTab != 0)) { + goto __1 + } + goto exit_rename_column +__1: + ; + + // Cannot alter a system table + if !(SQLITE_OK != isAlterableTable(tls, pParse, pTab)) { + goto __2 + } + goto exit_rename_column +__2: + ; + if !(SQLITE_OK != isRealTable(tls, pParse, pTab, 0)) { + goto __3 + } + goto exit_rename_column +__3: + ; + + // Which schema holds the table to be altered + iSchema = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iSchema)*32)).FzDbSName + + // Invoke the authorization callback. + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_ALTER_TABLE, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0)) != 0) { + goto __4 + } + goto exit_rename_column +__4: + ; + + // Make sure the old name really is a column name in the table to be + // altered. Set iCol to be the index of the column being renamed + zOld = Xsqlite3NameFromToken(tls, db, pOld) + if !(!(zOld != 0)) { + goto __5 + } + goto exit_rename_column +__5: + ; + iCol = 0 +__6: + if !(iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __8 + } + if !(0 == Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName, zOld)) { + goto __9 + } + goto __8 +__9: + ; + goto __7 +__7: + iCol++ + goto __6 + goto __8 +__8: + ; + if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __10 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5384 /* "no such column: ..." */, libc.VaList(bp, zOld)) + goto exit_rename_column +__10: + ; + + // Ensure the schema contains no double-quoted strings + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+756 /* "" */, 0) + renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) + + // Do the rename operation using a recursive UPDATE statement that + // uses the sqlite_rename_column() SQL function to compute the new + // CREATE statement text for the sqlite_schema table. + Xsqlite3MayAbort(tls, pParse) + zNew = Xsqlite3NameFromToken(tls, db, pNew) + if !(!(zNew != 0)) { + goto __11 + } + goto exit_rename_column +__11: + ; + + bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) + Xsqlite3NestedParse(tls, pParse, + + ts+9281, /* "UPDATE \"%w\".sqli..." */ + libc.VaList(bp+8, zDb, + zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), + (*Table)(unsafe.Pointer(pTab)).FzName)) + + Xsqlite3NestedParse(tls, pParse, + + ts+9499, /* "UPDATE temp.sqli..." */ + libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + + // Drop and reload the database schema. + renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8685 /* "after rename" */, 1) + +exit_rename_column: + Xsqlite3SrcListDelete(tls, db, pSrc) + Xsqlite3DbFree(tls, db, zOld) + Xsqlite3DbFree(tls, db, zNew) + return +} + +// The context of an ALTER TABLE RENAME COLUMN operation that gets passed +// down into the Walker. +type RenameCtx = RenameCtx1 /* sqlite3.c:108095:26 */ + +// Remember that the parser tree element pPtr was created using +// the token pToken. +// +// In other words, construct a new RenameToken object and add it +// to the list of RenameToken objects currently being built up +// in pParse->pRename. +// +// The pPtr argument is returned so that this routine can be used +// with tail recursion in tokenExpr() routine, for a small performance +// improvement. +func Xsqlite3RenameTokenMap(tls *libc.TLS, pParse uintptr, pPtr uintptr, pToken uintptr) uintptr { /* sqlite3.c:108156:21: */ + var pNew uintptr + + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_UNMAP { + pNew = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(RenameToken{}))) + if pNew != 0 { + (*RenameToken)(unsafe.Pointer(pNew)).Fp = pPtr + (*RenameToken)(unsafe.Pointer(pNew)).Ft = *(*Token)(unsafe.Pointer(pToken)) + (*RenameToken)(unsafe.Pointer(pNew)).FpNext = (*Parse)(unsafe.Pointer(pParse)).FpRename + (*Parse)(unsafe.Pointer(pParse)).FpRename = pNew + } + } + + return pPtr +} + +// It is assumed that there is already a RenameToken object associated +// with parse tree element pFrom. This function remaps the associated token +// to parse tree element pTo. +func Xsqlite3RenameTokenRemap(tls *libc.TLS, pParse uintptr, pTo uintptr, pFrom uintptr) { /* sqlite3.c:108178:21: */ + var p uintptr + + for p = (*Parse)(unsafe.Pointer(pParse)).FpRename; p != 0; p = (*RenameToken)(unsafe.Pointer(p)).FpNext { + if (*RenameToken)(unsafe.Pointer(p)).Fp == pFrom { + (*RenameToken)(unsafe.Pointer(p)).Fp = pTo + break + } + } +} + +// Walker callback used by sqlite3RenameExprUnmap(). +func renameUnmapExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:108192:12: */ + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), pExpr) + return WRC_Continue +} + +// Iterate through the Select objects that are part of WITH clauses attached +// to select statement pSelect. +func renameWalkWith(tls *libc.TLS, pWalker uintptr, pSelect uintptr) { /* sqlite3.c:108202:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var pWith uintptr = (*Select)(unsafe.Pointer(pSelect)).FpWith + if pWith != 0 { + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + var i int32 + var pCopy uintptr = uintptr(0) + + if ((*Select)(unsafe.Pointer((*Cte)(unsafe.Pointer((pWith + 16 /* &.a */))).FpSelect)).FselFlags & U32(SF_Expanded)) == U32(0) { + // Push a copy of the With object onto the with-stack. We use a copy + // here as the original will be expanded and resolved (flags SF_Expanded + // and SF_Resolved) below. And the parser code that uses the with-stack + // fails if the Select objects on it have already been expanded and + // resolved. + pCopy = Xsqlite3WithDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWith) + pCopy = Xsqlite3WithPush(tls, pParse, pCopy, uint8(1)) + } + for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { + var p uintptr = (*Cte)(unsafe.Pointer((pWith + 16 /* &.a */) + uintptr(i)*48)).FpSelect + // var sNC NameContext at bp, 56 + + libc.Xmemset(tls, bp /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse = pParse + if pCopy != 0 { + Xsqlite3SelectPrep(tls, (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse, p, bp /* &sNC */) + } + Xsqlite3WalkSelect(tls, pWalker, p) + Xsqlite3RenameExprlistUnmap(tls, pParse, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FpCols) + } + if (pCopy != 0) && ((*Parse)(unsafe.Pointer(pParse)).FpWith == pCopy) { + (*Parse)(unsafe.Pointer(pParse)).FpWith = (*With)(unsafe.Pointer(pCopy)).FpOuter + } + } +} + +// Unmap all tokens in the IdList object passed as the second argument. +func unmapColumnIdlistNames(tls *libc.TLS, pParse uintptr, pIdList uintptr) { /* sqlite3.c:108236:13: */ + if pIdList != 0 { + var ii int32 + for ii = 0; ii < (*IdList)(unsafe.Pointer(pIdList)).FnId; ii++ { + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pIdList)).Fa+uintptr(ii)*16)).FzName) + } + } +} + +// Walker callback used by sqlite3RenameExprUnmap(). +func renameUnmapSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:108251:12: */ + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + var i int32 + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return WRC_Abort + } + if ((*Select)(unsafe.Pointer(p)).FselFlags & (U32(SF_View | SF_CopyCte))) != 0 { + + return WRC_Prune + } + if (*Select)(unsafe.Pointer(p)).FpEList != 0 { + var pList uintptr = (*Select)(unsafe.Pointer(p)).FpEList + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + if ((*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FzEName != 0) && ((int32(*(*uint8)(unsafe.Pointer(((pList + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME) { + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FzEName) + } + } + } + if (*Select)(unsafe.Pointer(p)).FpSrc != 0 { // Every Select as a SrcList, even if it is empty + var pSrc uintptr = (*Select)(unsafe.Pointer(p)).FpSrc + for i = 0; i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc; i++ { + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FzName) + if Xsqlite3WalkExpr(tls, pWalker, (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FpOn) != 0 { + return WRC_Abort + } + unmapColumnIdlistNames(tls, pParse, (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FpUsing) + } + } + + renameWalkWith(tls, pWalker, p) + return WRC_Continue +} + +// Remove all nodes that are part of expression pExpr from the rename list. +func Xsqlite3RenameExprUnmap(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* sqlite3.c:108284:21: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var eMode U8 = (*Parse)(unsafe.Pointer(pParse)).FeParseMode + // var sWalker Walker at bp, 48 + + libc.Xmemset(tls, bp /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FpParse = pParse + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameUnmapExprCb})) + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameUnmapSelectCb})) + (*Parse)(unsafe.Pointer(pParse)).FeParseMode = U8(PARSE_MODE_UNMAP) + Xsqlite3WalkExpr(tls, bp /* &sWalker */, pExpr) + (*Parse)(unsafe.Pointer(pParse)).FeParseMode = eMode +} + +// Remove all nodes that are part of expression-list pEList from the +// rename list. +func Xsqlite3RenameExprlistUnmap(tls *libc.TLS, pParse uintptr, pEList uintptr) { /* sqlite3.c:108300:21: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + if pEList != 0 { + var i int32 + // var sWalker Walker at bp, 48 + + libc.Xmemset(tls, bp /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FpParse = pParse + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameUnmapExprCb})) + Xsqlite3WalkExprList(tls, bp /* &sWalker */, pEList) + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + if (int32(*(*uint8)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME { + Xsqlite3RenameTokenRemap(tls, pParse, uintptr(0), (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FzEName) + } + } + } +} + +// Free the list of RenameToken objects given in the second argument +func renameTokenFree(tls *libc.TLS, db uintptr, pToken uintptr) { /* sqlite3.c:108319:13: */ + var pNext uintptr + var p uintptr + for p = pToken; p != 0; p = pNext { + pNext = (*RenameToken)(unsafe.Pointer(p)).FpNext + Xsqlite3DbFree(tls, db, p) + } +} + +// Search the Parse object passed as the first argument for a RenameToken +// object associated with parse tree element pPtr. If found, return a pointer +// to it. Otherwise, return NULL. +// +// If the second argument passed to this function is not NULL and a matching +// RenameToken object is found, remove it from the Parse object and add it to +// the list maintained by the RenameCtx object. +func renameTokenFind(tls *libc.TLS, pParse uintptr, pCtx uintptr, pPtr uintptr) uintptr { /* sqlite3.c:108337:20: */ + var pp uintptr + if pPtr == uintptr(0) { + return uintptr(0) + } + for pp = (pParse + 400 /* &.pRename */); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + if (*RenameToken)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fp == pPtr { + var pToken uintptr = *(*uintptr)(unsafe.Pointer(pp)) + if pCtx != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*RenameToken)(unsafe.Pointer(pToken)).FpNext + (*RenameToken)(unsafe.Pointer(pToken)).FpNext = (*RenameCtx1)(unsafe.Pointer(pCtx)).FpList + (*RenameCtx1)(unsafe.Pointer(pCtx)).FpList = pToken + (*RenameCtx1)(unsafe.Pointer(pCtx)).FnList++ + } + return pToken + } + } + return uintptr(0) +} + +// This is a Walker select callback. It does nothing. It is only required +// because without a dummy callback, sqlite3WalkExpr() and similar do not +// descend into sub-select statements. +func renameColumnSelectCb(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:108366:12: */ + if ((*Select)(unsafe.Pointer(p)).FselFlags & (U32(SF_View | SF_CopyCte))) != 0 { + + return WRC_Prune + } + renameWalkWith(tls, pWalker, p) + return WRC_Continue +} + +// This is a Walker expression callback. +// +// For every TK_COLUMN node in the expression tree, search to see +// if the column being references is the column being renamed by an +// ALTER TABLE statement. If it is, then attach its associated +// RenameToken object to the list of RenameToken objects being +// constructed in RenameCtx object at pWalker->u.pRename. +func renameColumnExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:108385:12: */ + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_TRIGGER) && + (int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) == (*RenameCtx)(unsafe.Pointer(p)).FiCol)) && + ((*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).FpTriggerTab == (*RenameCtx)(unsafe.Pointer(p)).FpTab) { + renameTokenFind(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, p, pExpr) + } else if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) && + (int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) == (*RenameCtx)(unsafe.Pointer(p)).FiCol)) && + ((*RenameCtx)(unsafe.Pointer(p)).FpTab == *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */))) { + renameTokenFind(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, p, pExpr) + } + return WRC_Continue +} + +// The RenameCtx contains a list of tokens that reference a column that +// is being renamed by an ALTER TABLE statement. Return the "last" +// RenameToken in the RenameCtx and remove that RenameToken from the +// RenameContext. "Last" means the last RenameToken encountered when +// the input SQL is parsed from left to right. Repeated calls to this routine +// return all column name tokens in the order that they are encountered +// in the SQL statement. +func renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) uintptr { /* sqlite3.c:108410:20: */ + var pBest uintptr = (*RenameCtx)(unsafe.Pointer(pCtx)).FpList + var pToken uintptr + var pp uintptr + + for pToken = (*RenameToken)(unsafe.Pointer(pBest)).FpNext; pToken != 0; pToken = (*RenameToken)(unsafe.Pointer(pToken)).FpNext { + if (*RenameToken)(unsafe.Pointer(pToken)).Ft.Fz > (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz { + pBest = pToken + } + } + for pp = (pCtx /* &.pList */); *(*uintptr)(unsafe.Pointer(pp)) != pBest; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = (*RenameToken)(unsafe.Pointer(pBest)).FpNext + + return pBest +} + +// An error occured while parsing or otherwise processing a database +// object (either pParse->pNewTable, pNewIndex or pNewTrigger) as part of an +// ALTER TABLE RENAME COLUMN program. The error message emitted by the +// sub-routine is currently stored in pParse->zErrMsg. This function +// adds context to the error message and then stores it in pCtx. +func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType uintptr, pObject uintptr, pParse uintptr) { /* sqlite3.c:108431:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zT uintptr = Xsqlite3_value_text(tls, pType) + var zN uintptr = Xsqlite3_value_text(tls, pObject) + var zErr uintptr + + zErr = Xsqlite3_mprintf(tls, ts+9630, /* "error in %s %s%s..." */ + libc.VaList(bp, zT, zN, func() uintptr { + if *(*int8)(unsafe.Pointer(zWhen)) != 0 { + return ts + 9653 /* " " */ + } + return ts + 756 /* "" */ + }(), zWhen, + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) + Xsqlite3_result_error(tls, pCtx, zErr, -1) + Xsqlite3_free(tls, zErr) +} + +// For each name in the the expression-list pEList (i.e. each +// pEList->a[i].zName) that matches the string in zOld, extract the +// corresponding rename-token from Parse object pParse and add it +// to the RenameCtx pCtx. +func renameColumnElistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pEList uintptr, zOld uintptr) { /* sqlite3.c:108456:13: */ + if pEList != 0 { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + var zName uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName + if (((int32(*(*uint8)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME) && + (zName != uintptr(0))) && + (0 == Xsqlite3_stricmp(tls, zName, zOld)) { + renameTokenFind(tls, pParse, pCtx, zName) + } + } + } +} + +// For each name in the the id-list pIdList (i.e. each pIdList->a[i].zName) +// that matches the string in zOld, extract the corresponding rename-token +// from Parse object pParse and add it to the RenameCtx pCtx. +func renameColumnIdlistNames(tls *libc.TLS, pParse uintptr, pCtx uintptr, pIdList uintptr, zOld uintptr) { /* sqlite3.c:108481:13: */ + if pIdList != 0 { + var i int32 + for i = 0; i < (*IdList)(unsafe.Pointer(pIdList)).FnId; i++ { + var zName uintptr = (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pIdList)).Fa + uintptr(i)*16)).FzName + if 0 == Xsqlite3_stricmp(tls, zName, zOld) { + renameTokenFind(tls, pParse, pCtx, zName) + } + } + } +} + +// Parse the SQL statement zSql using Parse object (*p). The Parse object +// is initialized by this function before it is used. +func renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uintptr, bTemp int32) int32 { /* sqlite3.c:108503:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + *(*uintptr)(unsafe.Pointer(bp /* zErr */)) = uintptr(0) + + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = func() uint8 { + if bTemp != 0 { + return uint8(1) + } + return uint8(Xsqlite3FindDbName(tls, db, zDb)) + }() + + // Parse the SQL statement passed as the first argument. If no error + // occurs and the parse does not result in a new table, index or + // trigger object, the database must be corrupt. + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Parse{}))) + (*Parse)(unsafe.Pointer(p)).FeParseMode = U8(PARSE_MODE_RENAME) + (*Parse)(unsafe.Pointer(p)).Fdb = db + (*Parse)(unsafe.Pointer(p)).FnQueryLoop = U32(1) + if zSql != 0 { + rc = Xsqlite3RunParser(tls, p, zSql, bp /* &zErr */) + } else { + rc = SQLITE_NOMEM + } + + (*Parse)(unsafe.Pointer(p)).FzErrMsg = *(*uintptr)(unsafe.Pointer(bp /* zErr */)) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = SQLITE_NOMEM + } + if (((rc == SQLITE_OK) && + ((*Parse)(unsafe.Pointer(p)).FpNewTable == uintptr(0))) && ((*Parse)(unsafe.Pointer(p)).FpNewIndex == uintptr(0))) && ((*Parse)(unsafe.Pointer(p)).FpNewTrigger == uintptr(0)) { + rc = Xsqlite3CorruptError(tls, 108530) + } + + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(0) + return rc +} + +// This function edits SQL statement zSql, replacing each token identified +// by the linked list pRename with the text of zNew. If argument bQuote is +// true, then zNew is always quoted first. If no error occurs, the result +// is loaded into context object pCtx as the result. +// +// Or, if an error occurs (i.e. an OOM condition), an error is left in +// pCtx and an SQLite error code returned. +func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, zNew uintptr, bQuote int32) int32 { /* sqlite3.c:108558:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var nNew I64 = I64(Xsqlite3Strlen30(tls, zNew)) + var nSql I64 = I64(Xsqlite3Strlen30(tls, zSql)) + var db uintptr = Xsqlite3_context_db_handle(tls, pCtx) + var rc int32 = SQLITE_OK + var zQuot uintptr = uintptr(0) + var zOut uintptr + var nQuot I64 = int64(0) + var zBuf1 uintptr = uintptr(0) + var zBuf2 uintptr = uintptr(0) + + if zNew != 0 { + // Set zQuot to point to a buffer containing a quoted copy of the + // identifier zNew. If the corresponding identifier in the original + // ALTER TABLE statement was quoted (bQuote==1), then set zNew to + // point to zQuot so that all substitutions are made using the + // quoted version of the new column name. + zQuot = Xsqlite3MPrintf(tls, db, ts+9655 /* "\"%w\" " */, libc.VaList(bp, zNew)) + if zQuot == uintptr(0) { + return SQLITE_NOMEM + } else { + nQuot = (I64(Xsqlite3Strlen30(tls, zQuot) - 1)) + } + + zOut = Xsqlite3DbMallocZero(tls, db, (uint64((nSql + (I64((*RenameCtx)(unsafe.Pointer(pRename)).FnList) * nQuot)) + int64(1)))) + } else { + zOut = Xsqlite3DbMallocZero(tls, db, (uint64(((nSql * int64(2)) + int64(1)) * int64(3)))) + if zOut != 0 { + zBuf1 = (zOut + uintptr(((nSql * int64(2)) + int64(1)))) + zBuf2 = (zOut + uintptr(((nSql * int64(4)) + int64(2)))) + } + } + + // At this point pRename->pList contains a list of RenameToken objects + // corresponding to all tokens in the input SQL that must be replaced + // with the new column name, or with single-quoted versions of themselves. + // All that remains is to construct and return the edited SQL string. + if zOut != 0 { + var nOut int32 = int32(nSql) + libc.Xmemcpy(tls, zOut, zSql, uint64(nSql)) + for (*RenameCtx)(unsafe.Pointer(pRename)).FpList != 0 { + var iOff int32 // Offset of token to replace in zOut + var nReplace U32 + var zReplace uintptr + var pBest uintptr = renameColumnTokenNext(tls, pRename) + + if zNew != 0 { + if (bQuote == 0) && (Xsqlite3IsIdChar(tls, uint8(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz)))) != 0) { + nReplace = U32(nNew) + zReplace = zNew + } else { + nReplace = U32(nQuot) + zReplace = zQuot + if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '"' { + nReplace++ + } + } + } else { + // Dequote the double-quoted token. Then requote it again, this time + // using single quotes. If the character immediately following the + // original token within the input SQL was a single quote ('), then + // add another space after the new, single-quoted version of the + // token. This is so that (SELECT "string"'alias') maps to + // (SELECT 'string' 'alias'), and not (SELECT 'string''alias'). + libc.Xmemcpy(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) + *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) + Xsqlite3Dequote(tls, zBuf1) + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9661 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + func() uintptr { + if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { + return ts + 9653 /* " " */ + } + return ts + 756 /* "" */ + }())) + zReplace = zBuf2 + nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) + } + + iOff = (int32((int64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz) - int64(zSql)) / 1)) + if (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn != nReplace { + libc.Xmemmove(tls, (zOut + uintptr((U32(iOff) + nReplace))), (zOut + uintptr((uint32(iOff) + (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))), + (uint64(uint32(nOut) - (uint32(iOff) + (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) + nOut = int32(U32(nOut) + (nReplace - (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) + *(*int8)(unsafe.Pointer(zOut + uintptr(nOut))) = int8(0) + } + libc.Xmemcpy(tls, (zOut + uintptr(iOff)), zReplace, uint64(nReplace)) + Xsqlite3DbFree(tls, db, pBest) + } + + Xsqlite3_result_text(tls, pCtx, zOut, -1, libc.UintptrFromInt32(-1)) + Xsqlite3DbFree(tls, db, zOut) + } else { + rc = SQLITE_NOMEM + } + + Xsqlite3_free(tls, zQuot) + return rc +} + +// Resolve all symbols in the trigger at pParse->pNewTrigger, assuming +// it was read from the schema of database zDb. Return SQLITE_OK if +// successful. Otherwise, return an SQLite error code and leave an error +// message in the Parse object. +func renameResolveTrigger(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:108665:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pNew uintptr = (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger + var pStep uintptr + // var sNC NameContext at bp, 56 + + var rc int32 = SQLITE_OK + + libc.Xmemset(tls, bp /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse = pParse + + (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab = Xsqlite3FindTable(tls, db, (*Trigger)(unsafe.Pointer(pNew)).Ftable, + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(Xsqlite3SchemaToIndex(tls, db, (*Trigger)(unsafe.Pointer(pNew)).FpTabSchema))*32)).FzDbSName) + (*Parse)(unsafe.Pointer(pParse)).FeTriggerOp = (*Trigger)(unsafe.Pointer(pNew)).Fop + // ALWAYS() because if the table of the trigger does not exist, the + // error would have been hit before this point + if (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab != 0 { + rc = Xsqlite3ViewGetColumnNames(tls, pParse, (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab) + } + + // Resolve symbols in WHEN clause + if (rc == SQLITE_OK) && ((*Trigger)(unsafe.Pointer(pNew)).FpWhen != 0) { + rc = Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Trigger)(unsafe.Pointer(pNew)).FpWhen) + } + + for pStep = (*Trigger)(unsafe.Pointer(pNew)).Fstep_list; (rc == SQLITE_OK) && (pStep != 0); pStep = (*TriggerStep)(unsafe.Pointer(pStep)).FpNext { + if (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect != 0 { + Xsqlite3SelectPrep(tls, pParse, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect, bp /* &sNC */) + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + rc = (*Parse)(unsafe.Pointer(pParse)).Frc + } + } + if (rc == SQLITE_OK) && ((*TriggerStep)(unsafe.Pointer(pStep)).FzTarget != 0) { + var pSrc uintptr = Xsqlite3TriggerStepSrc(tls, pParse, pStep) + if pSrc != 0 { + var i int32 + for i = 0; (i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc) && (rc == SQLITE_OK); i++ { + var p uintptr = ((pSrc + 8 /* &.a */) + uintptr(i)*112) + (*SrcItem)(unsafe.Pointer(p)).FiCursor = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + if (*SrcItem)(unsafe.Pointer(p)).FpSelect != 0 { + Xsqlite3SelectPrep(tls, pParse, (*SrcItem)(unsafe.Pointer(p)).FpSelect, uintptr(0)) + Xsqlite3ExpandSubquery(tls, pParse, p) + + Xsqlite3SelectPrep(tls, pParse, (*SrcItem)(unsafe.Pointer(((*TriggerStep)(unsafe.Pointer(pStep)).FpFrom+8 /* &.a */)+uintptr((i-1))*112)).FpSelect, uintptr(0)) + } else { + (*SrcItem)(unsafe.Pointer(p)).FpTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), p) + if (*SrcItem)(unsafe.Pointer(p)).FpTab == uintptr(0) { + rc = SQLITE_ERROR + } else { + (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(p)).FpTab)).FnTabRef++ + rc = Xsqlite3ViewGetColumnNames(tls, pParse, (*SrcItem)(unsafe.Pointer(p)).FpTab) + } + } + } + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = pSrc + if (rc == SQLITE_OK) && ((*TriggerStep)(unsafe.Pointer(pStep)).FpWhere != 0) { + rc = Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere) + } + if rc == SQLITE_OK { + rc = Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList) + } + + if ((*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0) && (rc == SQLITE_OK) { + var pUpsert uintptr = (*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert + (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc = pSrc + *(*uintptr)(unsafe.Pointer(bp /* &sNC */ + 16 /* &.uNC */)) = pUpsert + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FncFlags = NC_UUpsert + rc = Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + if rc == SQLITE_OK { + var pUpsertSet uintptr = (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSet + rc = Xsqlite3ResolveExprListNames(tls, bp /* &sNC */, pUpsertSet) + } + if rc == SQLITE_OK { + rc = Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere) + } + if rc == SQLITE_OK { + rc = Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + } + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FncFlags = 0 + } + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = uintptr(0) + Xsqlite3SrcListDelete(tls, db, pSrc) + } else { + rc = SQLITE_NOMEM + } + } + } + return rc +} + +// Invoke sqlite3WalkExpr() or sqlite3WalkSelect() on all Select or Expr +// objects that are part of the trigger passed as the second argument. +func renameWalkTrigger(tls *libc.TLS, pWalker uintptr, pTrigger uintptr) { /* sqlite3.c:108758:13: */ + var pStep uintptr + + // Find tokens to edit in WHEN clause + Xsqlite3WalkExpr(tls, pWalker, (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen) + + // Find tokens to edit in trigger steps + for pStep = (*Trigger)(unsafe.Pointer(pTrigger)).Fstep_list; pStep != 0; pStep = (*TriggerStep)(unsafe.Pointer(pStep)).FpNext { + Xsqlite3WalkSelect(tls, pWalker, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect) + Xsqlite3WalkExpr(tls, pWalker, (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere) + Xsqlite3WalkExprList(tls, pWalker, (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList) + if (*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0 { + var pUpsert uintptr = (*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert + Xsqlite3WalkExprList(tls, pWalker, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + Xsqlite3WalkExprList(tls, pWalker, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSet) + Xsqlite3WalkExpr(tls, pWalker, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere) + Xsqlite3WalkExpr(tls, pWalker, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + } + if (*TriggerStep)(unsafe.Pointer(pStep)).FpFrom != 0 { + var i int32 + for i = 0; i < (*SrcList)(unsafe.Pointer((*TriggerStep)(unsafe.Pointer(pStep)).FpFrom)).FnSrc; i++ { + Xsqlite3WalkSelect(tls, pWalker, (*SrcItem)(unsafe.Pointer(((*TriggerStep)(unsafe.Pointer(pStep)).FpFrom+8 /* &.a */)+uintptr(i)*112)).FpSelect) + } + } + } +} + +// Free the contents of Parse object (*pParse). Do not free the memory +// occupied by the Parse object itself. +func renameParseCleanup(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:108789:13: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pIdx uintptr + if (*Parse)(unsafe.Pointer(pParse)).FpVdbe != 0 { + Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe) + } + Xsqlite3DeleteTable(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpNewTable) + for (libc.AssignUintptr(&pIdx, (*Parse)(unsafe.Pointer(pParse)).FpNewIndex)) != uintptr(0) { + (*Parse)(unsafe.Pointer(pParse)).FpNewIndex = (*Index)(unsafe.Pointer(pIdx)).FpNext + Xsqlite3FreeIndex(tls, db, pIdx) + } + Xsqlite3DeleteTrigger(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger) + Xsqlite3DbFree(tls, db, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg) + renameTokenFree(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpRename) + Xsqlite3ParserReset(tls, pParse) +} + +// SQL function: +// +// sqlite_rename_column(zSql, iCol, bQuote, zNew, zTable, zOld) +// +// 0. zSql: SQL statement to rewrite +// 1. type: Type of object ("table", "view" etc.) +// 2. object: Name of object +// 3. Database: Database name (e.g. "main") +// 4. Table: Table name +// 5. iCol: Index of column to rename +// 6. zNew: New column name +// 7. bQuote: Non-zero if the new column name should be quoted. +// 8. bTemp: True if zSql comes from temp schema +// +// Do a column rename operation on the CREATE statement given in zSql. +// The iCol-th column (left-most is 0) of table zTable is renamed from zCol +// into zNew. The name should be quoted if bQuote is true. +// +// This function is used internally by the ALTER TABLE RENAME COLUMN command. +// It is only accessible to SQL created using sqlite3NestedParse(). It is +// not reachable from ordinary SQL passed into sqlite3_prepare(). +func renameColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:108829:13: */ + bp := tls.Alloc(488) + defer tls.Free(488) + + var db uintptr + // var sCtx RenameCtx at bp, 32 + + var zSql uintptr + var zDb uintptr + var zTable uintptr + var iCol int32 + var zNew uintptr + var bQuote int32 + var bTemp int32 + var zOld uintptr + var rc int32 + // var sParse Parse at bp+32, 408 + + // var sWalker Walker at bp+440, 48 + + var pIdx uintptr + var i int32 + var pTab uintptr + var xAuth Sqlite3_xauth + // A regular table + var bFKOnly int32 + var pFKey uintptr + var pSelect uintptr + var pUpsertSet uintptr + var pTarget uintptr + // A trigger + var pStep uintptr + db = Xsqlite3_context_db_handle(tls, context) + zSql = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zDb = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + zTable = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + zNew = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + bQuote = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 7*8))) + bTemp = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 8*8))) + xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + + _ = NotUsed + if !(zSql == uintptr(0)) { + goto __1 + } + return +__1: + ; + if !(zTable == uintptr(0)) { + goto __2 + } + return +__2: + ; + if !(zNew == uintptr(0)) { + goto __3 + } + return +__3: + ; + if !(iCol < 0) { + goto __4 + } + return +__4: + ; + Xsqlite3BtreeEnterAll(tls, db) + pTab = Xsqlite3FindTable(tls, db, zTable, zDb) + if !((pTab == uintptr(0)) || (iCol >= int32((*Table)(unsafe.Pointer(pTab)).FnCol))) { + goto __5 + } + Xsqlite3BtreeLeaveAll(tls, db) + return +__5: + ; + zOld = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName + libc.Xmemset(tls, bp /* &sCtx */, 0, uint64(unsafe.Sizeof(RenameCtx{}))) + (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FiCol = func() int32 { + if iCol == int32((*Table)(unsafe.Pointer(pTab)).FiPKey) { + return -1 + } + return iCol + }() + + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + rc = renameParseSql(tls, bp+32 /* &sParse */, zDb, db, zSql, bTemp) + + // Find tokens that need to be replaced. + libc.Xmemset(tls, bp+440 /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp + 440 /* &sWalker */)).FpParse = bp + 32 /* &sParse */ + (*Walker)(unsafe.Pointer(bp + 440 /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameColumnExprCb})) + (*Walker)(unsafe.Pointer(bp + 440 /* &sWalker */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameColumnSelectCb})) + *(*uintptr)(unsafe.Pointer(bp + 440 /* &sWalker */ + 40 /* &.u */)) = bp /* &sCtx */ + + (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpTab = pTab + if !(rc != SQLITE_OK) { + goto __6 + } + goto renameColumnFunc_done +__6: + ; + if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable != 0) { + goto __7 + } + pSelect = (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewTable)).FpSelect + if !(pSelect != 0) { + goto __9 + } + *(*U32)(unsafe.Pointer(pSelect + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_View))) + (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).Frc = SQLITE_OK + Xsqlite3SelectPrep(tls, bp+32 /* &sParse */, pSelect, uintptr(0)) + rc = func() int32 { + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return SQLITE_NOMEM + } + return (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).Frc + }() + if !(rc == SQLITE_OK) { + goto __11 + } + Xsqlite3WalkSelect(tls, bp+440 /* &sWalker */, pSelect) +__11: + ; + if !(rc != SQLITE_OK) { + goto __12 + } + goto renameColumnFunc_done +__12: + ; + goto __10 +__9: + // A regular table + bFKOnly = Xsqlite3_stricmp(tls, zTable, (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable)).FzName) + + (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpTab = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewTable + if !(bFKOnly == 0) { + goto __13 + } + if !(iCol < int32((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable)).FnCol)) { + goto __14 + } + renameTokenFind(tls, + bp+32 /* &sParse */, bp /* &sCtx */, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable)).FaCol+uintptr(iCol)*32)).FzName) +__14: + ; + if !((*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FiCol < 0) { + goto __15 + } + renameTokenFind(tls, bp+32 /* &sParse */, bp /* &sCtx */, ((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable + 68 /* &.iPKey */)) +__15: + ; + Xsqlite3WalkExprList(tls, bp+440 /* &sWalker */, (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable)).FpCheck) + pIdx = (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewTable)).FpIndex +__16: + if !(pIdx != 0) { + goto __18 + } + Xsqlite3WalkExprList(tls, bp+440 /* &sWalker */, (*Index)(unsafe.Pointer(pIdx)).FaColExpr) + goto __17 +__17: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __16 + goto __18 +__18: + ; + pIdx = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewIndex +__19: + if !(pIdx != 0) { + goto __21 + } + Xsqlite3WalkExprList(tls, bp+440 /* &sWalker */, (*Index)(unsafe.Pointer(pIdx)).FaColExpr) + goto __20 +__20: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __19 + goto __21 +__21: + ; + i = 0 +__22: + if !(i < int32((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable)).FnCol)) { + goto __24 + } + Xsqlite3WalkExpr(tls, bp+440 /* &sWalker */, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTable)).FaCol+uintptr(i)*32)).FpDflt) + goto __23 +__23: + i++ + goto __22 + goto __24 +__24: + ; +__13: + ; + + pFKey = (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewTable)).FpFKey +__25: + if !(pFKey != 0) { + goto __27 + } + i = 0 +__28: + if !(i < (*FKey)(unsafe.Pointer(pFKey)).FnCol) { + goto __30 + } + if !((bFKOnly == 0) && ((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(i)*16)).FiFrom == iCol)) { + goto __31 + } + renameTokenFind(tls, bp+32 /* &sParse */, bp /* &sCtx */, ((pFKey + 64 /* &.aCol */) + uintptr(i)*16)) +__31: + ; + if !((0 == Xsqlite3_stricmp(tls, (*FKey)(unsafe.Pointer(pFKey)).FzTo, zTable)) && + (0 == Xsqlite3_stricmp(tls, (*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(i)*16)).FzCol, zOld))) { + goto __32 + } + renameTokenFind(tls, bp+32 /* &sParse */, bp /* &sCtx */, (*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(i)*16)).FzCol) +__32: + ; + goto __29 +__29: + i++ + goto __28 + goto __30 +__30: + ; + goto __26 +__26: + pFKey = (*FKey)(unsafe.Pointer(pFKey)).FpNextFrom + goto __25 + goto __27 +__27: + ; +__10: + ; + goto __8 +__7: + if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewIndex != 0) { + goto __33 + } + Xsqlite3WalkExprList(tls, bp+440 /* &sWalker */, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewIndex)).FaColExpr) + Xsqlite3WalkExpr(tls, bp+440 /* &sWalker */, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewIndex)).FpPartIdxWhere) + goto __34 +__33: + rc = renameResolveTrigger(tls, bp+32 /* &sParse */) + if !(rc != SQLITE_OK) { + goto __35 + } + goto renameColumnFunc_done +__35: + ; + + pStep = (*Trigger)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewTrigger)).Fstep_list +__36: + if !(pStep != 0) { + goto __38 + } + if !((*TriggerStep)(unsafe.Pointer(pStep)).FzTarget != 0) { + goto __39 + } + pTarget = Xsqlite3LocateTable(tls, bp+32 /* &sParse */, uint32(0), (*TriggerStep)(unsafe.Pointer(pStep)).FzTarget, zDb) + if !(pTarget == pTab) { + goto __40 + } + if !((*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert != 0) { + goto __41 + } + pUpsertSet = (*Upsert)(unsafe.Pointer((*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert)).FpUpsertSet + renameColumnElistNames(tls, bp+32 /* &sParse */, bp /* &sCtx */, pUpsertSet, zOld) +__41: + ; + renameColumnIdlistNames(tls, bp+32 /* &sParse */, bp /* &sCtx */, (*TriggerStep)(unsafe.Pointer(pStep)).FpIdList, zOld) + renameColumnElistNames(tls, bp+32 /* &sParse */, bp /* &sCtx */, (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList, zOld) +__40: + ; +__39: + ; + goto __37 +__37: + pStep = (*TriggerStep)(unsafe.Pointer(pStep)).FpNext + goto __36 + goto __38 +__38: + ; + + // Find tokens to edit in UPDATE OF clause + if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpTriggerTab == pTab) { + goto __42 + } + renameColumnIdlistNames(tls, bp+32 /* &sParse */, bp /* &sCtx */, (*Trigger)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTrigger)).FpColumns, zOld) +__42: + ; + + // Find tokens to edit in various expressions and selects + renameWalkTrigger(tls, bp+440 /* &sWalker */, (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpNewTrigger) +__34: + ; +__8: + ; + + rc = renameEditSql(tls, context, bp /* &sCtx */, zSql, zNew, bQuote) + +renameColumnFunc_done: + if !(rc != SQLITE_OK) { + goto __43 + } + if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg != 0) { + goto __44 + } + renameColumnParseError(tls, context, ts+756 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) + goto __45 +__44: + Xsqlite3_result_error_code(tls, context, rc) +__45: + ; +__43: + ; + + renameParseCleanup(tls, bp+32 /* &sParse */) + renameTokenFree(tls, db, (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpList) + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + Xsqlite3BtreeLeaveAll(tls, db) +} + +// Walker expression callback used by "RENAME TABLE". +func renameTableExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:108992:12: */ + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) && ((*RenameCtx)(unsafe.Pointer(p)).FpTab == *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */))) { + renameTokenFind(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, p, (pExpr + 64 /* &.y */ /* &.pTab */)) + } + return WRC_Continue +} + +// Walker select callback used by "RENAME TABLE". +func renameTableSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) int32 { /* sqlite3.c:109003:12: */ + var i int32 + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var pSrc uintptr = (*Select)(unsafe.Pointer(pSelect)).FpSrc + if ((*Select)(unsafe.Pointer(pSelect)).FselFlags & (U32(SF_View | SF_CopyCte))) != 0 { + + return WRC_Prune + } + if pSrc == uintptr(0) { + + return WRC_Abort + } + for i = 0; i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc; i++ { + var pItem uintptr = ((pSrc + 8 /* &.a */) + uintptr(i)*112) + if (*SrcItem)(unsafe.Pointer(pItem)).FpTab == (*RenameCtx)(unsafe.Pointer(p)).FpTab { + renameTokenFind(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, p, (*SrcItem)(unsafe.Pointer(pItem)).FzName) + } + } + renameWalkWith(tls, pWalker, pSelect) + + return WRC_Continue +} + +// This C function implements an SQL user function that is used by SQL code +// generated by the ALTER TABLE ... RENAME command to modify the definition +// of any foreign key constraints that use the table being renamed as the +// parent table. It is passed three arguments: +// +// 0: The database containing the table being renamed. +// 1. type: Type of object ("table", "view" etc.) +// 2. object: Name of object +// 3: The complete text of the schema statement being modified, +// 4: The old name of the table being renamed, and +// 5: The new name of the table being renamed. +// 6: True if the schema statement comes from the temp db. +// +// It returns the new schema statement. For example: +// +// sqlite_rename_table('main', 'CREATE TABLE t1(a REFERENCES t2)','t2','t3',0) +// -> 'CREATE TABLE t1(a REFERENCES t3)' +func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:109047:13: */ + bp := tls.Alloc(544) + defer tls.Free(544) + + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var zDb uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var zInput uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + var zOld uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + var zNew uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + var bTemp int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + _ = NotUsed + + if ((zInput != 0) && (zOld != 0)) && (zNew != 0) { + // var sParse Parse at bp+80, 408 + + var rc int32 + var bQuote int32 = 1 + // var sCtx RenameCtx at bp, 32 + + // var sWalker Walker at bp+32, 48 + + var xAuth Sqlite3_xauth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + + Xsqlite3BtreeEnterAll(tls, db) + + libc.Xmemset(tls, bp /* &sCtx */, 0, uint64(unsafe.Sizeof(RenameCtx{}))) + (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpTab = Xsqlite3FindTable(tls, db, zOld, zDb) + libc.Xmemset(tls, bp+32 /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp + 32 /* &sWalker */)).FpParse = bp + 80 /* &sParse */ + (*Walker)(unsafe.Pointer(bp + 32 /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameTableExprCb})) + (*Walker)(unsafe.Pointer(bp + 32 /* &sWalker */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameTableSelectCb})) + *(*uintptr)(unsafe.Pointer(bp + 32 /* &sWalker */ + 40 /* &.u */)) = bp /* &sCtx */ + + rc = renameParseSql(tls, bp+80 /* &sParse */, zDb, db, zInput, bTemp) + + if rc == SQLITE_OK { + var isLegacy int32 = (int32((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LegacyAlter))) + if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FpNewTable != 0 { + var pTab uintptr = (*Parse)(unsafe.Pointer(bp + 80 /* &sParse */)).FpNewTable + + if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { + if isLegacy == 0 { + var pSelect uintptr = (*Table)(unsafe.Pointer(pTab)).FpSelect + // var sNC NameContext at bp+488, 56 + + libc.Xmemset(tls, bp+488 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 488 /* &sNC */)).FpParse = bp + 80 /* &sParse */ + + *(*U32)(unsafe.Pointer(pSelect + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_View))) + Xsqlite3SelectPrep(tls, bp+80 /* &sParse */, (*Table)(unsafe.Pointer(pTab)).FpSelect, bp+488 /* &sNC */) + if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FnErr != 0 { + rc = (*Parse)(unsafe.Pointer(bp + 80 /* &sParse */)).Frc + } else { + Xsqlite3WalkSelect(tls, bp+32 /* &sWalker */, (*Table)(unsafe.Pointer(pTab)).FpSelect) + } + } + } else { + // Modify any FK definitions to point to the new table. + if (isLegacy == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) { + var pFKey uintptr + for pFKey = (*Table)(unsafe.Pointer(pTab)).FpFKey; pFKey != 0; pFKey = (*FKey)(unsafe.Pointer(pFKey)).FpNextFrom { + if Xsqlite3_stricmp(tls, (*FKey)(unsafe.Pointer(pFKey)).FzTo, zOld) == 0 { + renameTokenFind(tls, bp+80 /* &sParse */, bp /* &sCtx */, (*FKey)(unsafe.Pointer(pFKey)).FzTo) + } + } + } + + // If this is the table being altered, fix any table refs in CHECK + // expressions. Also update the name that appears right after the + // "CREATE [VIRTUAL] TABLE" bit. + if Xsqlite3_stricmp(tls, zOld, (*Table)(unsafe.Pointer(pTab)).FzName) == 0 { + (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpTab = pTab + if isLegacy == 0 { + Xsqlite3WalkExprList(tls, bp+32 /* &sWalker */, (*Table)(unsafe.Pointer(pTab)).FpCheck) + } + renameTokenFind(tls, bp+80 /* &sParse */, bp /* &sCtx */, (*Table)(unsafe.Pointer(pTab)).FzName) + } + } + } else if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FpNewIndex != 0 { + renameTokenFind(tls, bp+80 /* &sParse */, bp /* &sCtx */, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FpNewIndex)).FzName) + if isLegacy == 0 { + Xsqlite3WalkExpr(tls, bp+32 /* &sWalker */, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FpNewIndex)).FpPartIdxWhere) + } + } else { + var pTrigger uintptr = (*Parse)(unsafe.Pointer(bp + 80 /* &sParse */)).FpNewTrigger + var pStep uintptr + if (0 == Xsqlite3_stricmp(tls, (*Trigger)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FpNewTrigger)).Ftable, zOld)) && + ((*Table)(unsafe.Pointer((*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpTab)).FpSchema == (*Trigger)(unsafe.Pointer(pTrigger)).FpTabSchema) { + renameTokenFind(tls, bp+80 /* &sParse */, bp /* &sCtx */, (*Trigger)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FpNewTrigger)).Ftable) + } + + if isLegacy == 0 { + rc = renameResolveTrigger(tls, bp+80 /* &sParse */) + if rc == SQLITE_OK { + renameWalkTrigger(tls, bp+32 /* &sWalker */, pTrigger) + for pStep = (*Trigger)(unsafe.Pointer(pTrigger)).Fstep_list; pStep != 0; pStep = (*TriggerStep)(unsafe.Pointer(pStep)).FpNext { + if ((*TriggerStep)(unsafe.Pointer(pStep)).FzTarget != 0) && (0 == Xsqlite3_stricmp(tls, (*TriggerStep)(unsafe.Pointer(pStep)).FzTarget, zOld)) { + renameTokenFind(tls, bp+80 /* &sParse */, bp /* &sCtx */, (*TriggerStep)(unsafe.Pointer(pStep)).FzTarget) + } + } + } + } + } + } + + if rc == SQLITE_OK { + rc = renameEditSql(tls, context, bp /* &sCtx */, zInput, zNew, bQuote) + } + if rc != SQLITE_OK { + if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FzErrMsg != 0 { + renameColumnParseError(tls, context, ts+756 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) + } else { + Xsqlite3_result_error_code(tls, context, rc) + } + } + + renameParseCleanup(tls, bp+80 /* &sParse */) + renameTokenFree(tls, db, (*RenameCtx)(unsafe.Pointer(bp /* &sCtx */)).FpList) + Xsqlite3BtreeLeaveAll(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + } + + return +} + +func renameQuotefixExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:109185:12: */ + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_STRING) && (((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_DblQuoted)) != 0) { + renameTokenFind(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)), pExpr) + } + return WRC_Continue +} + +// The implementation of an SQL scalar function that rewrites DDL statements +// so that any string literals that use double-quotes are modified so that +// they use single quotes. +// +// Two arguments must be passed: +// +// 0: Database name ("main", "temp" etc.). +// 1: SQL statement to edit. +// +// The returned value is the modified SQL statement. For example, given +// the database schema: +// +// CREATE TABLE t1(a, b, c); +// +// SELECT sqlite_rename_quotefix('main', +// 'CREATE VIEW v1 AS SELECT "a", "string" FROM t1' +// ); +// +// returns the string: +// +// CREATE VIEW v1 AS SELECT "a", 'string' FROM t1 +func renameQuotefixFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:109215:13: */ + bp := tls.Alloc(488) + defer tls.Free(488) + + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var zDb uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var zInput uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + + var xAuth Sqlite3_xauth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + + Xsqlite3BtreeEnterAll(tls, db) + + _ = NotUsed + if (zDb != 0) && (zInput != 0) { + var rc int32 + // var sParse Parse at bp, 408 + + rc = renameParseSql(tls, bp /* &sParse */, zDb, db, zInput, 0) + + if rc == SQLITE_OK { + // var sCtx RenameCtx at bp+408, 32 + + // var sWalker Walker at bp+440, 48 + + // Walker to find tokens that need to be replaced. + libc.Xmemset(tls, bp+408 /* &sCtx */, 0, uint64(unsafe.Sizeof(RenameCtx{}))) + libc.Xmemset(tls, bp+440 /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp + 440 /* &sWalker */)).FpParse = bp /* &sParse */ + (*Walker)(unsafe.Pointer(bp + 440 /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameQuotefixExprCb})) + (*Walker)(unsafe.Pointer(bp + 440 /* &sWalker */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renameColumnSelectCb})) + *(*uintptr)(unsafe.Pointer(bp + 440 /* &sWalker */ + 40 /* &.u */)) = bp + 408 /* &sCtx */ + + if (*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable != 0 { + var pSelect uintptr = (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable)).FpSelect + if pSelect != 0 { + *(*U32)(unsafe.Pointer(pSelect + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_View))) + (*Parse)(unsafe.Pointer(bp /* &sParse */)).Frc = SQLITE_OK + Xsqlite3SelectPrep(tls, bp /* &sParse */, pSelect, uintptr(0)) + rc = func() int32 { + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return SQLITE_NOMEM + } + return (*Parse)(unsafe.Pointer(bp /* &sParse */)).Frc + }() + if rc == SQLITE_OK { + Xsqlite3WalkSelect(tls, bp+440 /* &sWalker */, pSelect) + } + } else { + var i int32 + Xsqlite3WalkExprList(tls, bp+440 /* &sWalker */, (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable)).FpCheck) + for i = 0; i < int32((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable)).FnCol); i++ { + Xsqlite3WalkExpr(tls, bp+440 /* &sWalker */, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable)).FaCol+uintptr(i)*32)).FpDflt) + } + } + } else if (*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewIndex != 0 { + Xsqlite3WalkExprList(tls, bp+440 /* &sWalker */, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewIndex)).FaColExpr) + Xsqlite3WalkExpr(tls, bp+440 /* &sWalker */, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewIndex)).FpPartIdxWhere) + } else { + rc = renameResolveTrigger(tls, bp /* &sParse */) + if rc == SQLITE_OK { + renameWalkTrigger(tls, bp+440 /* &sWalker */, (*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTrigger) + } + } + + if rc == SQLITE_OK { + rc = renameEditSql(tls, context, bp+408 /* &sCtx */, zInput, uintptr(0), 0) + } + renameTokenFree(tls, db, (*RenameCtx)(unsafe.Pointer(bp+408 /* &sCtx */)).FpList) + } + if rc != SQLITE_OK { + Xsqlite3_result_error_code(tls, context, rc) + } + renameParseCleanup(tls, bp /* &sParse */) + } + + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + + Xsqlite3BtreeLeaveAll(tls, db) +} + +// An SQL user function that checks that there are no parse or symbol +// resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. +// After an ALTER TABLE .. RENAME operation is performed and the schema +// reloaded, this function is called on each SQL statement in the schema +// to ensure that it is still usable. +// +// 0: Database name ("main", "temp" etc.). +// 1: SQL statement. +// 2: Object type ("view", "table", "trigger" or "index"). +// 3: Object name. +// 4: True if object is from temp schema. +// 5: "when" part of error message. +// 6: True to disable the DQS quirk when parsing SQL. +// +// Unless it finds an error, this function normally returns NULL. However, it +// returns integer value 1 if: +// +// * the SQL argument creates a trigger, and +// * the table that the trigger is attached to is in database zDb. +func renameTableTest(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:109319:13: */ + bp := tls.Alloc(464) + defer tls.Free(464) + + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var zDb uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var zInput uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + var bTemp int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + var isLegacy int32 = (int32((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LegacyAlter))) + var zWhen uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + var bNoDQS int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + + var xAuth Sqlite3_xauth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + + _ = NotUsed + + if (zDb != 0) && (zInput != 0) { + var rc int32 + // var sParse Parse at bp, 408 + + var flags int32 = int32((*Sqlite3)(unsafe.Pointer(db)).Fflags) + if bNoDQS != 0 { + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.Uint64FromInt32(libc.CplInt32((SQLITE_DqsDML | SQLITE_DqsDDL)))) + } + rc = renameParseSql(tls, bp /* &sParse */, zDb, db, zInput, bTemp) + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (U64(flags & (SQLITE_DqsDML | SQLITE_DqsDDL))) + if rc == SQLITE_OK { + if ((isLegacy == 0) && ((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable != 0)) && ((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable)).FpSelect != 0) { + // var sNC NameContext at bp+408, 56 + + libc.Xmemset(tls, bp+408 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 408 /* &sNC */)).FpParse = bp /* &sParse */ + Xsqlite3SelectPrep(tls, bp /* &sParse */, (*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTable)).FpSelect, bp+408 /* &sNC */) + if (*Parse)(unsafe.Pointer(bp /* &sParse */)).FnErr != 0 { + rc = (*Parse)(unsafe.Pointer(bp /* &sParse */)).Frc + } + } else if (*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTrigger != 0 { + if isLegacy == 0 { + rc = renameResolveTrigger(tls, bp /* &sParse */) + } + if rc == SQLITE_OK { + var i1 int32 = Xsqlite3SchemaToIndex(tls, db, (*Trigger)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp /* &sParse */)).FpNewTrigger)).FpTabSchema) + var i2 int32 = Xsqlite3FindDbName(tls, db, zDb) + if i1 == i2 { + Xsqlite3_result_int(tls, context, 1) + } + } + } + } + + if (rc != SQLITE_OK) && (zWhen != 0) { + renameColumnParseError(tls, context, zWhen, *(*uintptr)(unsafe.Pointer(argv + 2*8)), *(*uintptr)(unsafe.Pointer(argv + 3*8)), bp /* &sParse */) + } + renameParseCleanup(tls, bp /* &sParse */) + } + + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth +} + +// The implementation of internal UDF sqlite_drop_column(). +// +// Arguments: +// +// argv[0]: An integer - the index of the schema containing the table +// argv[1]: CREATE TABLE statement to modify. +// argv[2]: An integer - the index of the column to remove. +// +// The value returned is a string containing the CREATE TABLE statement +// with column argv[2] removed. +func dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:109390:13: */ + bp := tls.Alloc(432) + defer tls.Free(432) + + var db uintptr + var iSchema int32 + var zSql uintptr + var iCol int32 + var zDb uintptr + var rc int32 + // var sParse Parse at bp+24, 408 + + var pCol uintptr + var pTab uintptr + var zEnd uintptr + var zNew uintptr + var xAuth Sqlite3_xauth + var pEnd uintptr + db = Xsqlite3_context_db_handle(tls, context) + iSchema = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) + zSql = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iSchema)*32)).FzDbSName + zNew = uintptr(0) + xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + + _ = NotUsed + rc = renameParseSql(tls, bp+24 /* &sParse */, zDb, db, zSql, (libc.Bool32(iSchema == 1))) + if !(rc != SQLITE_OK) { + goto __1 + } + goto drop_column_done +__1: + ; + pTab = (*Parse)(unsafe.Pointer(bp + 24 /* &sParse */)).FpNewTable + if !(((pTab == uintptr(0)) || (int32((*Table)(unsafe.Pointer(pTab)).FnCol) == 1)) || (iCol >= int32((*Table)(unsafe.Pointer(pTab)).FnCol))) { + goto __2 + } + // This can happen if the sqlite_schema table is corrupt + rc = Xsqlite3CorruptError(tls, 109418) + goto drop_column_done +__2: + ; + + pCol = renameTokenFind(tls, bp+24 /* &sParse */, uintptr(0), (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName) + if !(iCol < (int32((*Table)(unsafe.Pointer(pTab)).FnCol) - 1)) { + goto __3 + } + pEnd = renameTokenFind(tls, bp+24 /* &sParse */, uintptr(0), (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((iCol+1))*32)).FzName) + zEnd = (*RenameToken)(unsafe.Pointer(pEnd)).Ft.Fz + goto __4 +__3: + zEnd = (zSql + uintptr((*Table)(unsafe.Pointer(pTab)).FaddColOffset)) +__5: + if !((int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz))) != 0) && (int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz))) != ',')) { + goto __6 + } + (*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz-- + goto __5 +__6: + ; +__4: + ; + + zNew = Xsqlite3MPrintf(tls, db, ts+9666 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) + Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, zNew) + +drop_column_done: + renameParseCleanup(tls, bp+24 /* &sParse */) + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + if !(rc != SQLITE_OK) { + goto __7 + } + Xsqlite3_result_error_code(tls, context, rc) +__7: +} + +// This function is called by the parser upon parsing an +// +// ALTER TABLE pSrc DROP COLUMN pName +// +// statement. Argument pSrc contains the possibly qualified name of the +// table being edited, and token pName the name of the column to drop. +func Xsqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName uintptr) { /* sqlite3.c:109454:21: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var db uintptr // Database handle + var pTab uintptr // Table to modify + var iDb int32 // Index of db containing pTab in aDb[] + var zDb uintptr // Database containing pTab ("main" etc.) + var zCol uintptr // Name of column to drop + var iCol int32 + var iPos int32 + var iColPos int32 + var regOut int32 + var i int32 + var addr int32 + var reg int32 + var regRec int32 + var pPk uintptr + var nField int32 // Number of non-virtual columns after drop + var iCur int32 + var v uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + zCol = uintptr(0) // Index of column zCol in pTab->aCol[] + + // Look up the table being altered. + + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __1 + } + goto exit_drop_column +__1: + ; + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), (pSrc + 8 /* &.a */)) + if !(!(pTab != 0)) { + goto __2 + } + goto exit_drop_column +__2: + ; + + // Make sure this is not an attempt to ALTER a view, virtual table or + // system table. + if !(SQLITE_OK != isAlterableTable(tls, pParse, pTab)) { + goto __3 + } + goto exit_drop_column +__3: + ; + if !(SQLITE_OK != isRealTable(tls, pParse, pTab, 1)) { + goto __4 + } + goto exit_drop_column +__4: + ; + + // Find the index of the column being dropped. + zCol = Xsqlite3NameFromToken(tls, db, pName) + if !(zCol == uintptr(0)) { + goto __5 + } + + goto exit_drop_column +__5: + ; + iCol = Xsqlite3ColumnIndex(tls, pTab, zCol) + if !(iCol < 0) { + goto __6 + } + Xsqlite3ErrorMsg(tls, pParse, ts+5384 /* "no such column: ..." */, libc.VaList(bp, zCol)) + goto exit_drop_column +__6: + ; + + // Do not allow the user to drop a PRIMARY KEY column or a column + // constrained by a UNIQUE constraint. + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { + goto __7 + } + Xsqlite3ErrorMsg(tls, pParse, ts+9673, /* "cannot drop %s c..." */ + libc.VaList(bp+8, func() uintptr { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { + return ts + 9701 /* "PRIMARY KEY" */ + } + return ts + 5205 /* "UNIQUE" */ + }(), + zCol)) + goto exit_drop_column +__7: + ; + + // Do not allow the number of columns to go to zero + if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { + goto __8 + } + Xsqlite3ErrorMsg(tls, pParse, ts+9713 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + goto exit_drop_column +__8: + ; + + // Edit the sqlite_schema table + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+756 /* "" */, 0) + renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) + Xsqlite3NestedParse(tls, pParse, + + ts+9761 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + + // Drop and reload the database schema. + renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9882 /* "after drop colum..." */, 1) + + // Edit rows of table on disk + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { + goto __9 + } + pPk = uintptr(0) + nField = 0 + v = Xsqlite3GetVdbe(tls, pParse) + iCur = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + Xsqlite3OpenTable(tls, pParse, iCur, iDb, pTab, OP_OpenWrite) + addr = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, iCur) + reg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __10 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iCur, reg) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Table)(unsafe.Pointer(pTab)).FnCol)) + goto __11 +__10: + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Index)(unsafe.Pointer(pPk)).FnColumn)) + i = 0 +__12: + if !(i < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) { + goto __14 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iCur, i, ((reg + i) + 1)) + goto __13 +__13: + i++ + goto __12 + goto __14 +__14: + ; + nField = int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) +__11: + ; + regRec = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + i = 0 +__15: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __17 + } + if !((i != iCol) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { + goto __18 + } + if !(pPk != 0) { + goto __19 + } + iPos = int32(Xsqlite3TableColumnToIndex(tls, pPk, int16(i))) + iColPos = int32(Xsqlite3TableColumnToIndex(tls, pPk, int16(iCol))) + if !(iPos < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) { + goto __21 + } + goto __16 +__21: + ; + regOut = (((reg + 1) + iPos) - (libc.Bool32(iPos > iColPos))) + goto __20 +__19: + regOut = ((reg + 1) + nField) +__20: + ; + if !(i == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __22 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regOut) + goto __23 +__22: + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, i, regOut) +__23: + ; + nField++ +__18: + ; + goto __16 +__16: + i++ + goto __15 + goto __17 +__17: + ; + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (reg + 1), nField, regRec) + if !(pPk != 0) { + goto __24 + } + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iCur, regRec, (reg + 1), int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + goto __25 +__24: + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iCur, regRec, reg) +__25: + ; + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) + + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iCur, (addr + 1)) + Xsqlite3VdbeJumpHere(tls, v, addr) +__9: + ; + +exit_drop_column: + Xsqlite3DbFree(tls, db, zCol) + Xsqlite3SrcListDelete(tls, db, pSrc) +} + +// Register built-in functions used to help implement ALTER TABLE +func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ + Xsqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&aAlterTableFuncs)), (int32(uint64(unsafe.Sizeof(aAlterTableFuncs)) / uint64(unsafe.Sizeof(FuncDef{}))))) +} + +var aAlterTableFuncs = [5]FuncDef{ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9900 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9921 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9941 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9960 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9979 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + +//************* End of alter.c ********************************************** +//************* Begin file analyze.c **************************************** +// 2005-07-08 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code associated with the ANALYZE command. +// +// The ANALYZE command gather statistics about the content of tables +// and indices. These statistics are made available to the query planner +// to help it make better decisions about how to perform queries. +// +// The following system tables are or have been supported: +// +// CREATE TABLE sqlite_stat1(tbl, idx, stat); +// CREATE TABLE sqlite_stat2(tbl, idx, sampleno, sample); +// CREATE TABLE sqlite_stat3(tbl, idx, nEq, nLt, nDLt, sample); +// CREATE TABLE sqlite_stat4(tbl, idx, nEq, nLt, nDLt, sample); +// +// Additional tables might be added in future releases of SQLite. +// The sqlite_stat2 table is not created or used unless the SQLite version +// is between 3.6.18 and 3.7.8, inclusive, and unless SQLite is compiled +// with SQLITE_ENABLE_STAT2. The sqlite_stat2 table is deprecated. +// The sqlite_stat2 table is superseded by sqlite_stat3, which is only +// created and used by SQLite versions 3.7.9 through 3.29.0 when +// SQLITE_ENABLE_STAT3 defined. The functionality of sqlite_stat3 +// is a superset of sqlite_stat2 and is also now deprecated. The +// sqlite_stat4 is an enhanced version of sqlite_stat3 and is only +// available when compiled with SQLITE_ENABLE_STAT4 and in SQLite +// versions 3.8.1 and later. STAT4 is the only variant that is still +// supported. +// +// For most applications, sqlite_stat1 provides all the statistics required +// for the query planner to make good choices. +// +// Format of sqlite_stat1: +// +// There is normally one row per index, with the index identified by the +// name in the idx column. The tbl column is the name of the table to +// which the index belongs. In each such row, the stat column will be +// a string consisting of a list of integers. The first integer in this +// list is the number of rows in the index. (This is the same as the +// number of rows in the table, except for partial indices.) The second +// integer is the average number of rows in the index that have the same +// value in the first column of the index. The third integer is the average +// number of rows in the index that have the same value for the first two +// columns. The N-th integer (for N>1) is the average number of rows in +// the index which have the same value for the first N-1 columns. For +// a K-column index, there will be K+1 integers in the stat column. If +// the index is unique, then the last integer will be 1. +// +// The list of integers in the stat column can optionally be followed +// by the keyword "unordered". The "unordered" keyword, if it is present, +// must be separated from the last integer by a single space. If the +// "unordered" keyword is present, then the query planner assumes that +// the index is unordered and will not use the index for a range query. +// +// If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat +// column contains a single integer which is the (estimated) number of +// rows in the table identified by sqlite_stat1.tbl. +// +// Format of sqlite_stat2: +// +// The sqlite_stat2 is only created and is only used if SQLite is compiled +// with SQLITE_ENABLE_STAT2 and if the SQLite version number is between +// 3.6.18 and 3.7.8. The "stat2" table contains additional information +// about the distribution of keys within an index. The index is identified by +// the "idx" column and the "tbl" column is the name of the table to which +// the index belongs. There are usually 10 rows in the sqlite_stat2 +// table for each index. +// +// The sqlite_stat2 entries for an index that have sampleno between 0 and 9 +// inclusive are samples of the left-most key value in the index taken at +// evenly spaced points along the index. Let the number of samples be S +// (10 in the standard build) and let C be the number of rows in the index. +// Then the sampled rows are given by: +// +// rownumber = (i*C*2 + C)/(S*2) +// +// For i between 0 and S-1. Conceptually, the index space is divided into +// S uniform buckets and the samples are the middle row from each bucket. +// +// The format for sqlite_stat2 is recorded here for legacy reference. This +// version of SQLite does not support sqlite_stat2. It neither reads nor +// writes the sqlite_stat2 table. This version of SQLite only supports +// sqlite_stat3. +// +// Format for sqlite_stat3: +// +// The sqlite_stat3 format is a subset of sqlite_stat4. Hence, the +// sqlite_stat4 format will be described first. Further information +// about sqlite_stat3 follows the sqlite_stat4 description. +// +// Format for sqlite_stat4: +// +// As with sqlite_stat2, the sqlite_stat4 table contains histogram data +// to aid the query planner in choosing good indices based on the values +// that indexed columns are compared against in the WHERE clauses of +// queries. +// +// The sqlite_stat4 table contains multiple entries for each index. +// The idx column names the index and the tbl column is the table of the +// index. If the idx and tbl columns are the same, then the sample is +// of the INTEGER PRIMARY KEY. The sample column is a blob which is the +// binary encoding of a key from the index. The nEq column is a +// list of integers. The first integer is the approximate number +// of entries in the index whose left-most column exactly matches +// the left-most column of the sample. The second integer in nEq +// is the approximate number of entries in the index where the +// first two columns match the first two columns of the sample. +// And so forth. nLt is another list of integers that show the approximate +// number of entries that are strictly less than the sample. The first +// integer in nLt contains the number of entries in the index where the +// left-most column is less than the left-most column of the sample. +// The K-th integer in the nLt entry is the number of index entries +// where the first K columns are less than the first K columns of the +// sample. The nDLt column is like nLt except that it contains the +// number of distinct entries in the index that are less than the +// sample. +// +// There can be an arbitrary number of sqlite_stat4 entries per index. +// The ANALYZE command will typically generate sqlite_stat4 tables +// that contain between 10 and 40 samples which are distributed across +// the key space, though not uniformly, and which include samples with +// large nEq values. +// +// Format for sqlite_stat3 redux: +// +// The sqlite_stat3 table is like sqlite_stat4 except that it only +// looks at the left-most column of the index. The sqlite_stat3.sample +// column contains the actual value of the left-most column instead +// of a blob encoding of the complete index key as is found in +// sqlite_stat4.sample. The nEq, nLt, and nDLt entries of sqlite_stat3 +// all contain just a single integer which is the same as the first +// integer in the equivalent columns in sqlite_stat4. +// #include "sqliteInt.h" + +// This routine generates code that opens the sqlite_statN tables. +// The sqlite_stat1 table is always relevant. sqlite_stat2 is now +// obsolete. sqlite_stat3 and sqlite_stat4 are only opened when +// appropriate compile-time options are provided. +// +// If the sqlite_statN tables do not previously exist, it is created. +// +// Argument zWhere may be a pointer to a buffer containing a table name, +// or it may be a NULL pointer. If it is not NULL, then all entries in +// the sqlite_statN tables associated with the named table are deleted. +// If zWhere==0, then code is generated to delete all stat table entries. +func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWhere uintptr, zWhereType uintptr) { /* sqlite3.c:109763:13: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + var i int32 + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pDb uintptr + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + // var aRoot [3]U32 at bp+76, 12 + + // var aCreateTbl [3]U8 at bp+72, 3 + + var nToOpen int32 + if ((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0) { + nToOpen = 2 + } else { + nToOpen = 1 + } + + if v == uintptr(0) { + return + } + + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + + // Create new statistic tables if they do not exist, or clear them + // if they do already exist. + for i = 0; i < (int32(uint64(unsafe.Sizeof(aTable)) / uint64(unsafe.Sizeof(struct { + FzName uintptr + FzCols uintptr + }{})))); i++ { + var zTab uintptr = aTable[i].FzName + var pStat uintptr + *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(0) + if (libc.AssignUintptr(&pStat, Xsqlite3FindTable(tls, db, zTab, (*Db)(unsafe.Pointer(pDb)).FzDbSName))) == uintptr(0) { + if i < nToOpen { + // The sqlite_statN table does not exist. Create it. Note that a + // side-effect of the CREATE TABLE statement is to leave the rootpage + // of the new table in register pParse->regRoot. This is important + // because the OpenWrite opcode below will be needing it. + Xsqlite3NestedParse(tls, pParse, + ts+10002 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) + *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) + } + } else { + // The table already exists. If zWhere is not NULL, delete all entries + // associated with the table zWhere. If zWhere is NULL, delete the + // entire contents of the table. + *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = (*Table)(unsafe.Pointer(pStat)).Ftnum + Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) + if zWhere != 0 { + Xsqlite3NestedParse(tls, pParse, + ts+10025, /* "DELETE FROM %Q.%..." */ + libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { + Xsqlite3NestedParse(tls, pParse, ts+10055 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + } else { + // The sqlite_stat[134] table already exists. Delete all rows. + Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) + } + } + } + + // Open the sqlite_stat[134] tables for writing. + for i = 0; i < nToOpen; i++ { + + Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, (iStatCur + i), int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb, 3) + Xsqlite3VdbeChangeP5(tls, v, uint16(*(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))))) + + } +} + +var aTable = [3]struct { + FzName uintptr + FzCols uintptr +}{ + {FzName: ts + 10073 /* "sqlite_stat1" */, FzCols: ts + 10086 /* "tbl,idx,stat" */}, + {FzName: ts + 10099 /* "sqlite_stat4" */, FzCols: ts + 10112 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10140 /* "sqlite_stat3" */}, +} /* sqlite3.c:109773:5 */ + +// Recommended number of samples for sqlite_stat4 + +// Three SQL functions - stat_init(), stat_push(), and stat_get() - +// share an instance of the following structure to hold their state +// information. +type StatAccum1 = struct { + Fdb uintptr + FnEst TRowcnt + FnRow TRowcnt + FnLimit int32 + FnCol int32 + FnKeyCol int32 + FnSkipAhead U8 + _ [3]byte + Fcurrent StatSample + FnPSample TRowcnt + FmxSample int32 + FiPrn U32 + _ [4]byte + FaBest uintptr + FiMin int32 + FnSample int32 + FnMaxEqZero int32 + FiGet int32 + Fa uintptr +} /* sqlite3.c:109861:9 */ + +// Recommended number of samples for sqlite_stat4 + +// Three SQL functions - stat_init(), stat_push(), and stat_get() - +// share an instance of the following structure to hold their state +// information. +type StatAccum = StatAccum1 /* sqlite3.c:109861:26 */ +type StatSample1 = struct { + FanEq uintptr + FanDLt uintptr + FanLt uintptr + Fu struct{ FiRowid I64 } + FnRowid U32 + FisPSample U8 + _ [3]byte + FiCol int32 + FiHash U32 +} /* sqlite3.c:109861:9 */ + +type StatSample = StatSample1 /* sqlite3.c:109862:27 */ + +// Reclaim memory used by a StatSample +func sampleClear(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:109903:13: */ + + if (*StatSample)(unsafe.Pointer(p)).FnRowid != 0 { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */))) + (*StatSample)(unsafe.Pointer(p)).FnRowid = U32(0) + } +} + +// Initialize the BLOB value of a ROWID +func sampleSetRowid(tls *libc.TLS, db uintptr, p uintptr, n int32, pData uintptr) { /* sqlite3.c:109915:13: */ + + if (*StatSample)(unsafe.Pointer(p)).FnRowid != 0 { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */))) + } + *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */)) = Xsqlite3DbMallocRawNN(tls, db, uint64(n)) + if *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */)) != 0 { + (*StatSample)(unsafe.Pointer(p)).FnRowid = U32(n) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */)), pData, uint64(n)) + } else { + (*StatSample)(unsafe.Pointer(p)).FnRowid = U32(0) + } +} + +// Initialize the INTEGER value of a ROWID. +func sampleSetRowidInt64(tls *libc.TLS, db uintptr, p uintptr, iRowid I64) { /* sqlite3.c:109931:13: */ + + if (*StatSample)(unsafe.Pointer(p)).FnRowid != 0 { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */))) + } + (*StatSample)(unsafe.Pointer(p)).FnRowid = U32(0) + *(*I64)(unsafe.Pointer(p + 24 /* &.u */)) = iRowid +} + +// Copy the contents of object (*pFrom) into (*pTo). +func sampleCopy(tls *libc.TLS, p uintptr, pTo uintptr, pFrom uintptr) { /* sqlite3.c:109944:13: */ + (*StatSample)(unsafe.Pointer(pTo)).FisPSample = (*StatSample)(unsafe.Pointer(pFrom)).FisPSample + (*StatSample)(unsafe.Pointer(pTo)).FiCol = (*StatSample)(unsafe.Pointer(pFrom)).FiCol + (*StatSample)(unsafe.Pointer(pTo)).FiHash = (*StatSample)(unsafe.Pointer(pFrom)).FiHash + libc.Xmemcpy(tls, (*StatSample)(unsafe.Pointer(pTo)).FanEq, (*StatSample)(unsafe.Pointer(pFrom)).FanEq, (uint64(unsafe.Sizeof(TRowcnt(0))) * uint64((*StatAccum)(unsafe.Pointer(p)).FnCol))) + libc.Xmemcpy(tls, (*StatSample)(unsafe.Pointer(pTo)).FanLt, (*StatSample)(unsafe.Pointer(pFrom)).FanLt, (uint64(unsafe.Sizeof(TRowcnt(0))) * uint64((*StatAccum)(unsafe.Pointer(p)).FnCol))) + libc.Xmemcpy(tls, (*StatSample)(unsafe.Pointer(pTo)).FanDLt, (*StatSample)(unsafe.Pointer(pFrom)).FanDLt, (uint64(unsafe.Sizeof(TRowcnt(0))) * uint64((*StatAccum)(unsafe.Pointer(p)).FnCol))) + if (*StatSample)(unsafe.Pointer(pFrom)).FnRowid != 0 { + sampleSetRowid(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, pTo, int32((*StatSample)(unsafe.Pointer(pFrom)).FnRowid), *(*uintptr)(unsafe.Pointer(pFrom + 24 /* &.u */))) + } else { + sampleSetRowidInt64(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, pTo, *(*I64)(unsafe.Pointer(pFrom + 24 /* &.u */))) + } +} + +// Reclaim all memory of a StatAccum structure. +func statAccumDestructor(tls *libc.TLS, pOld uintptr) { /* sqlite3.c:109962:13: */ + var p uintptr = pOld + if (*StatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + var i int32 + for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { + sampleClear(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, ((*StatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48)) + } + for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FmxSample; i++ { + sampleClear(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48)) + } + sampleClear(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, (p + 32 /* &.current */)) + } + Xsqlite3DbFree(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, p) +} + +// Implementation of the stat_init(N,K,C,L) SQL function. The four parameters +// are: +// N: The number of columns in the index including the rowid/pk (note 1) +// K: The number of columns in the index excluding the rowid/pk. +// C: Estimated number of rows in the index +// L: A limit on the number of rows to scan, or 0 for no-limit +// +// Note 1: In the special case of the covering index that implements a +// WITHOUT ROWID table, N is the number of PRIMARY KEY columns, not the +// total number of columns in the table. +// +// For indexes on ordinary rowid tables, N==K+1. But for indexes on +// WITHOUT ROWID tables, N=K+P where P is the number of columns in the +// PRIMARY KEY of the table. The covering index that implements the +// original WITHOUT ROWID table as N==K as a special case. +// +// This routine allocates the StatAccum object in heap memory. The return +// value is a pointer to the StatAccum object. The datatype of the +// return value is BLOB, but it is really just a pointer to the StatAccum +// object. +func statInit(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:109997:13: */ + var p uintptr + var nCol int32 // Number of columns in index being sampled + var nKeyCol int32 // Number of key columns + var nColUp int32 // nCol rounded up for alignment + var n int32 // Bytes of space to allocate + var db uintptr = Xsqlite3_context_db_handle(tls, context) // Database connection + // Maximum number of samples. 0 if STAT4 data is not collected + var mxSample int32 + if ((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0) { + mxSample = SQLITE_STAT4_SAMPLES + } else { + mxSample = 0 + } + + // Decode the three function arguments + _ = argc + nCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) + + if uint64(unsafe.Sizeof(TRowcnt(0))) < uint64(8) { + nColUp = ((nCol + 1) & libc.CplInt32(1)) + } else { + nColUp = nCol + } + nKeyCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + + // Allocate the space required for the StatAccum object + n = (int32((uint64(unsafe.Sizeof(StatAccum{})) + + (uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nColUp))) + // StatAccum.anEq + (uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nColUp)))) // StatAccum.anDLt + if mxSample != 0 { + n = int32(uint64(n) + (((uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nColUp)) + // StatAccum.anLt + (uint64(unsafe.Sizeof(StatSample{})) * (uint64(nCol + mxSample)))) + // StatAccum.aBest[], a[] + (((uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(3)) * uint64(nColUp)) * (uint64(nCol + mxSample))))) + } + db = Xsqlite3_context_db_handle(tls, context) + p = Xsqlite3DbMallocZero(tls, db, uint64(n)) + if p == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + + (*StatAccum)(unsafe.Pointer(p)).Fdb = db + (*StatAccum)(unsafe.Pointer(p)).FnEst = TRowcnt(Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + (*StatAccum)(unsafe.Pointer(p)).FnRow = TRowcnt(0) + (*StatAccum)(unsafe.Pointer(p)).FnLimit = int32(Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + (*StatAccum)(unsafe.Pointer(p)).FnCol = nCol + (*StatAccum)(unsafe.Pointer(p)).FnKeyCol = nKeyCol + (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead = U8(0) + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt = (p + 1*128) + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq = ((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(nColUp)*4) + + (*StatAccum)(unsafe.Pointer(p)).FmxSample = func() int32 { + if (*StatAccum)(unsafe.Pointer(p)).FnLimit == 0 { + return mxSample + } + return 0 + }() + if mxSample != 0 { + var pSpace uintptr // Allocated space not yet assigned + var i int32 // Used to iterate through p->aSample[] + + (*StatAccum)(unsafe.Pointer(p)).FiGet = -1 + (*StatAccum)(unsafe.Pointer(p)).FnPSample = (((*StatAccum)(unsafe.Pointer(p)).FnEst / (TRowcnt((mxSample / 3) + 1))) + TRowcnt(1)) + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt = ((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(nColUp)*4) + (*StatAccum)(unsafe.Pointer(p)).FiPrn = ((U32(0x689e962d) * U32(nCol)) ^ (0xd0944565 * U32(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))))) + + // Set up the StatAccum.a[] and aBest[] arrays + (*StatAccum)(unsafe.Pointer(p)).Fa = ((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt + uintptr(nColUp)*4) + (*StatAccum)(unsafe.Pointer(p)).FaBest = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(mxSample)*48) + pSpace = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((mxSample+nCol))*48) + for i = 0; i < (mxSample + nCol); i++ { + (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48)).FanEq = pSpace + pSpace += (uintptr(uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nColUp))) + (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48)).FanLt = pSpace + pSpace += (uintptr(uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nColUp))) + (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48)).FanDLt = pSpace + pSpace += (uintptr(uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nColUp))) + } + + for i = 0; i < nCol; i++ { + (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48)).FiCol = i + } + } + + // Return a pointer to the allocated object to the caller. Note that + // only the pointer (the 2nd parameter) matters. The size of the object + // (given by the 3rd parameter) is never used and can be any positive + // value. + Xsqlite3_result_blob(tls, context, p, int32(unsafe.Sizeof(StatAccum{})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{statAccumDestructor}))) +} + +var statInitFuncdef = FuncDef{ + FnArg: int8(4), // nArg + FfuncFlags: U32(SQLITE_UTF8), // pNext + FxSFunc: 0, // xValue, xInverse + FzName: ts + 10153 /* "stat_init" */} /* sqlite3.c:110084:22 */ + +// pNew and pOld are both candidate non-periodic samples selected for +// the same column (pNew->iCol==pOld->iCol). Ignoring this column and +// considering only any trailing columns and the sample hash value, this +// function returns true if sample pNew is to be preferred over pOld. +// In other words, if we assume that the cardinalities of the selected +// column for pNew and pOld are equal, is pNew to be preferred over pOld. +// +// This function assumes that for each argument sample, the contents of +// the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid. +func sampleIsBetterPost(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintptr) int32 { /* sqlite3.c:110108:12: */ + var nCol int32 = (*StatAccum)(unsafe.Pointer(pAccum)).FnCol + var i int32 + + for i = ((*StatSample)(unsafe.Pointer(pNew)).FiCol + 1); i < nCol; i++ { + if *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pNew)).FanEq + uintptr(i)*4)) > *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pOld)).FanEq + uintptr(i)*4)) { + return 1 + } + if *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pNew)).FanEq + uintptr(i)*4)) < *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pOld)).FanEq + uintptr(i)*4)) { + return 0 + } + } + if (*StatSample)(unsafe.Pointer(pNew)).FiHash > (*StatSample)(unsafe.Pointer(pOld)).FiHash { + return 1 + } + return 0 +} + +// Return true if pNew is to be preferred over pOld. +// +// This function assumes that for each argument sample, the contents of +// the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid. +func sampleIsBetter(tls *libc.TLS, pAccum uintptr, pNew uintptr, pOld uintptr) int32 { /* sqlite3.c:110132:12: */ + var nEqNew TRowcnt = *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pNew)).FanEq + uintptr((*StatSample)(unsafe.Pointer(pNew)).FiCol)*4)) + var nEqOld TRowcnt = *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pOld)).FanEq + uintptr((*StatSample)(unsafe.Pointer(pOld)).FiCol)*4)) + + if nEqNew > nEqOld { + return 1 + } + if nEqNew == nEqOld { + if (*StatSample)(unsafe.Pointer(pNew)).FiCol < (*StatSample)(unsafe.Pointer(pOld)).FiCol { + return 1 + } + return (libc.Bool32(((*StatSample)(unsafe.Pointer(pNew)).FiCol == (*StatSample)(unsafe.Pointer(pOld)).FiCol) && (sampleIsBetterPost(tls, pAccum, pNew, pOld) != 0))) + } + return 0 +} + +// Copy the contents of sample *pNew into the p->a[] array. If necessary, +// remove the least desirable sample from p->a[] to make room. +func sampleInsert(tls *libc.TLS, p uintptr, pNew uintptr, nEqZero int32) { /* sqlite3.c:110155:13: */ + var pSample uintptr + var i int32 + var pOld uintptr + var pUpgrade uintptr + var pMin uintptr + var anEq uintptr + var anLt uintptr + var anDLt uintptr + var iMin int32 + pSample = uintptr(0) + + // StatAccum.nMaxEqZero is set to the maximum number of leading 0 + // values in the anEq[] array of any sample in StatAccum.a[]. In + // other words, if nMaxEqZero is n, then it is guaranteed that there + // are no samples with StatSample.anEq[m]==0 for (m>=n). + if !(nEqZero > (*StatAccum)(unsafe.Pointer(p)).FnMaxEqZero) { + goto __1 + } + (*StatAccum)(unsafe.Pointer(p)).FnMaxEqZero = nEqZero +__1: + ; + if !(int32((*StatSample)(unsafe.Pointer(pNew)).FisPSample) == 0) { + goto __2 + } + pUpgrade = uintptr(0) + + // This sample is being added because the prefix that ends in column + // iCol occurs many times in the table. However, if we have already + // added a sample that shares this prefix, there is no need to add + // this one. Instead, upgrade the priority of the highest priority + // existing sample that shares this prefix. + i = ((*StatAccum)(unsafe.Pointer(p)).FnSample - 1) +__3: + if !(i >= 0) { + goto __5 + } + pOld = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(i)*48) + if !(*(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pOld)).FanEq + uintptr((*StatSample)(unsafe.Pointer(pNew)).FiCol)*4)) == TRowcnt(0)) { + goto __6 + } + if !((*StatSample)(unsafe.Pointer(pOld)).FisPSample != 0) { + goto __7 + } + return +__7: + ; + + if !((pUpgrade == uintptr(0)) || (sampleIsBetter(tls, p, pOld, pUpgrade) != 0)) { + goto __8 + } + pUpgrade = pOld +__8: + ; +__6: + ; + goto __4 +__4: + i-- + goto __3 + goto __5 +__5: + ; + if !(pUpgrade != 0) { + goto __9 + } + (*StatSample)(unsafe.Pointer(pUpgrade)).FiCol = (*StatSample)(unsafe.Pointer(pNew)).FiCol + *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pUpgrade)).FanEq + uintptr((*StatSample)(unsafe.Pointer(pUpgrade)).FiCol)*4)) = *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pNew)).FanEq + uintptr((*StatSample)(unsafe.Pointer(pUpgrade)).FiCol)*4)) + goto find_new_min +__9: + ; +__2: + ; + + // If necessary, remove sample iMin to make room for the new sample. + if !((*StatAccum)(unsafe.Pointer(p)).FnSample >= (*StatAccum)(unsafe.Pointer(p)).FmxSample) { + goto __10 + } + pMin = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((*StatAccum)(unsafe.Pointer(p)).FiMin)*48) + anEq = (*StatSample)(unsafe.Pointer(pMin)).FanEq + anLt = (*StatSample)(unsafe.Pointer(pMin)).FanLt + anDLt = (*StatSample)(unsafe.Pointer(pMin)).FanDLt + sampleClear(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, pMin) + libc.Xmemmove(tls, pMin, (pMin + 1*48), (uint64(unsafe.Sizeof(StatSample{})) * (uint64(((*StatAccum)(unsafe.Pointer(p)).FnSample - (*StatAccum)(unsafe.Pointer(p)).FiMin) - 1)))) + pSample = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr(((*StatAccum)(unsafe.Pointer(p)).FnSample-1))*48) + (*StatSample)(unsafe.Pointer(pSample)).FnRowid = U32(0) + (*StatSample)(unsafe.Pointer(pSample)).FanEq = anEq + (*StatSample)(unsafe.Pointer(pSample)).FanDLt = anDLt + (*StatSample)(unsafe.Pointer(pSample)).FanLt = anLt + (*StatAccum)(unsafe.Pointer(p)).FnSample = ((*StatAccum)(unsafe.Pointer(p)).FmxSample - 1) +__10: + ; + + // The "rows less-than" for the rowid column must be greater than that + // for the last sample in the p->a[] array. Otherwise, the samples would + // be out of order. + + // Insert the new sample + pSample = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((*StatAccum)(unsafe.Pointer(p)).FnSample)*48) + sampleCopy(tls, p, pSample, pNew) + (*StatAccum)(unsafe.Pointer(p)).FnSample++ + + // Zero the first nEqZero entries in the anEq[] array. + libc.Xmemset(tls, (*StatSample)(unsafe.Pointer(pSample)).FanEq, 0, (uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nEqZero))) + +find_new_min: + if !((*StatAccum)(unsafe.Pointer(p)).FnSample >= (*StatAccum)(unsafe.Pointer(p)).FmxSample) { + goto __11 + } + iMin = -1 + i = 0 +__12: + if !(i < (*StatAccum)(unsafe.Pointer(p)).FmxSample) { + goto __14 + } + if !((*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48)).FisPSample != 0) { + goto __15 + } + goto __13 +__15: + ; + if !((iMin < 0) || (sampleIsBetter(tls, p, ((*StatAccum)(unsafe.Pointer(p)).Fa+uintptr(iMin)*48), ((*StatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48)) != 0)) { + goto __16 + } + iMin = i +__16: + ; + goto __13 +__13: + i++ + goto __12 + goto __14 +__14: + ; + + (*StatAccum)(unsafe.Pointer(p)).FiMin = iMin +__11: +} + +// Field iChng of the index being scanned has changed. So at this point +// p->current contains a sample that reflects the previous row of the +// index. The value of anEq[iChng] and subsequent anEq[] elements are +// correct at this point. +func samplePushPrevious(tls *libc.TLS, p uintptr, iChng int32) { /* sqlite3.c:110247:13: */ + var i int32 + + // Check if any samples from the aBest[] array should be pushed + // into IndexSample.a[] at this point. + for i = ((*StatAccum)(unsafe.Pointer(p)).FnCol - 2); i >= iChng; i-- { + var pBest uintptr = ((*StatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48) + *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer(pBest)).FanEq + uintptr(i)*4)) = *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*4)) + if ((*StatAccum)(unsafe.Pointer(p)).FnSample < (*StatAccum)(unsafe.Pointer(p)).FmxSample) || (sampleIsBetter(tls, p, pBest, ((*StatAccum)(unsafe.Pointer(p)).Fa+uintptr((*StatAccum)(unsafe.Pointer(p)).FiMin)*48)) != 0) { + sampleInsert(tls, p, pBest, i) + } + } + + // Check that no sample contains an anEq[] entry with an index of + // p->nMaxEqZero or greater set to zero. + for i = ((*StatAccum)(unsafe.Pointer(p)).FnSample - 1); i >= 0; i-- { + var j int32 + for j = (*StatAccum)(unsafe.Pointer(p)).FnMaxEqZero; j < (*StatAccum)(unsafe.Pointer(p)).FnCol; j++ { + } + } + + // Update the anEq[] fields of any samples already collected. + if iChng < (*StatAccum)(unsafe.Pointer(p)).FnMaxEqZero { + for i = ((*StatAccum)(unsafe.Pointer(p)).FnSample - 1); i >= 0; i-- { + var j int32 + for j = iChng; j < (*StatAccum)(unsafe.Pointer(p)).FnCol; j++ { + if *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48)).FanEq + uintptr(j)*4)) == TRowcnt(0) { + *(*TRowcnt)(unsafe.Pointer((*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa+uintptr(i)*48)).FanEq + uintptr(j)*4)) = *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(j)*4)) + } + } + } + (*StatAccum)(unsafe.Pointer(p)).FnMaxEqZero = iChng + } +} + +// Implementation of the stat_push SQL function: stat_push(P,C,R) +// Arguments: +// +// P Pointer to the StatAccum object created by stat_init() +// C Index of left-most column to differ from previous row +// R Rowid for the current row. Might be a key record for +// WITHOUT ROWID tables. +// +// The purpose of this routine is to collect statistical data and/or +// samples from the index being analyzed into the StatAccum object. +// The stat_get() SQL function will be used afterwards to +// retrieve the information gathered. +// +// This SQL function usually returns NULL, but might return an integer +// if it wants the byte-code to do special processing. +// +// The R parameter is only used for STAT4 +func statPush(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:110299:13: */ + var i int32 + + // The three function arguments + var p uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + var iChng int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + + _ = argc + _ = context + + if (*StatAccum)(unsafe.Pointer(p)).FnRow == TRowcnt(0) { + // This is the first call to this function. Do initialization. + for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { + *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*4)) = TRowcnt(1) + } + } else { + // Second and subsequent calls get processed here + if (*StatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + samplePushPrevious(tls, p, iChng) + } + + // Update anDLt[], anLt[] and anEq[] to reflect the values that apply + // to the current row of the index. + for i = 0; i < iChng; i++ { + *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*4))++ + } + for i = iChng; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { + *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4))++ + if (*StatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt + uintptr(i)*4)) += (*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*4))) + } + *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanEq + uintptr(i)*4)) = TRowcnt(1) + } + } + + (*StatAccum)(unsafe.Pointer(p)).FnRow++ + if (*StatAccum)(unsafe.Pointer(p)).FmxSample != 0 { + var nLt TRowcnt + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) == SQLITE_INTEGER { + sampleSetRowidInt64(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, (p + 32 /* &.current */), Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + } else { + sampleSetRowid(tls, (*StatAccum)(unsafe.Pointer(p)).Fdb, (p + 32 /* &.current */), Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))), + Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + } + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FiHash = libc.AssignPtrUint32(p+88 /* &.iPrn */, (((*StatAccum)(unsafe.Pointer(p)).FiPrn * U32(1103515245)) + U32(12345))) + + nLt = *(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanLt + uintptr(((*StatAccum)(unsafe.Pointer(p)).FnCol-1))*4)) + // Check if this is to be a periodic sample. If so, add it. + if (nLt / (*StatAccum)(unsafe.Pointer(p)).FnPSample) != ((nLt + TRowcnt(1)) / (*StatAccum)(unsafe.Pointer(p)).FnPSample) { + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FisPSample = U8(1) + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FiCol = 0 + sampleInsert(tls, p, (p + 32 /* &.current */), ((*StatAccum)(unsafe.Pointer(p)).FnCol - 1)) + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FisPSample = U8(0) + } + + // Update the aBest[] array. + for i = 0; i < ((*StatAccum)(unsafe.Pointer(p)).FnCol - 1); i++ { + (*StatAccum)(unsafe.Pointer(p)).Fcurrent.FiCol = i + if (i >= iChng) || (sampleIsBetterPost(tls, p, (p+32 /* &.current */), ((*StatAccum)(unsafe.Pointer(p)).FaBest+uintptr(i)*48)) != 0) { + sampleCopy(tls, p, ((*StatAccum)(unsafe.Pointer(p)).FaBest + uintptr(i)*48), (p + 32 /* &.current */)) + } + } + } else if ((*StatAccum)(unsafe.Pointer(p)).FnLimit != 0) && ((*StatAccum)(unsafe.Pointer(p)).FnRow > (TRowcnt((*StatAccum)(unsafe.Pointer(p)).FnLimit) * (TRowcnt(int32((*StatAccum)(unsafe.Pointer(p)).FnSkipAhead) + 1)))) { + (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead++ + Xsqlite3_result_int(tls, context, (libc.Bool32(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt)) > TRowcnt(0)))) + } +} + +var statPushFuncdef = FuncDef{ + FnArg: (int8(2 + IsStat4)), // nArg + FfuncFlags: U32(SQLITE_UTF8), // pNext + FxSFunc: 0, // xValue, xInverse + FzName: ts + 10163 /* "stat_push" */} /* sqlite3.c:110374:22 */ + +// Implementation of the stat_get(P,J) SQL function. This routine is +// used to query statistical information that has been gathered into +// the StatAccum object by prior calls to stat_push(). The P parameter +// has type BLOB but it is really just a pointer to the StatAccum object. +// The content to returned is determined by the parameter J +// which is one of the STAT_GET_xxxx values defined above. +// +// The stat_get(P,J) function is not available to generic SQL. It is +// inserted as part of a manually constructed bytecode program. (See +// the callStatGet() routine below.) It is guaranteed that the P +// parameter will always be a pointer to a StatAccum object, never a +// NULL. +// +// If STAT4 is not enabled, then J is always +// STAT_GET_STAT1 and is hence omitted and this routine becomes +// a one-parameter function, stat_get(P), that always returns the +// stat1 table entry information. +func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:110411:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var p uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + // STAT4 has a parameter on this routine. + var eCall int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + + if eCall == STAT_GET_STAT1 { + // Return the value to store in the "stat" column of the sqlite_stat1 + // table for this index. + // + // The value is a string composed of a list of integers describing + // the index. The first integer in the list is the total number of + // entries in the index. There is one additional integer in the list + // for each indexed column. This additional integer is an estimate of + // the number of rows matched by a equality query on the index using + // a key with the corresponding number of fields. In other words, + // if the index is on columns (a,b) and the sqlite_stat1 value is + // "100 10 2", then SQLite estimates that: + // + // * the index contains 100 rows, + // * "WHERE a=?" matches 10 rows, and + // * "WHERE a=? AND b=?" matches 2 rows. + // + // If D is the count of distinct values and K is the total number of + // rows, then each estimate is computed as: + // + // I = (K+D-1)/D + var z uintptr + var i int32 + + var zRet uintptr = Xsqlite3MallocZero(tls, (uint64(((*StatAccum)(unsafe.Pointer(p)).FnKeyCol + 1) * 25))) + if zRet == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + + Xsqlite3_snprintf(tls, 24, zRet, ts+10173, /* "%llu" */ + libc.VaList(bp, func() uint64 { + if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { + return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) + } + return U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + }())) + z = (zRet + uintptr(Xsqlite3Strlen30(tls, zRet))) + for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { + var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) + var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) + Xsqlite3_snprintf(tls, 24, z, ts+10178 /* " %llu" */, libc.VaList(bp+8, iVal)) + z += uintptr(Xsqlite3Strlen30(tls, z)) + + } + + Xsqlite3_result_text(tls, context, zRet, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } else if eCall == STAT_GET_ROWID { + if (*StatAccum)(unsafe.Pointer(p)).FiGet < 0 { + samplePushPrevious(tls, p, 0) + (*StatAccum)(unsafe.Pointer(p)).FiGet = 0 + } + if (*StatAccum)(unsafe.Pointer(p)).FiGet < (*StatAccum)(unsafe.Pointer(p)).FnSample { + var pS uintptr = ((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((*StatAccum)(unsafe.Pointer(p)).FiGet)*48) + if (*StatSample)(unsafe.Pointer(pS)).FnRowid == U32(0) { + Xsqlite3_result_int64(tls, context, *(*I64)(unsafe.Pointer(pS + 24 /* &.u */))) + } else { + Xsqlite3_result_blob(tls, context, *(*uintptr)(unsafe.Pointer(pS + 24 /* &.u */)), int32((*StatSample)(unsafe.Pointer(pS)).FnRowid), + libc.UintptrFromInt32(-1)) + } + } + } else { + var aCnt uintptr = uintptr(0) + + switch eCall { + case STAT_GET_NEQ: + aCnt = (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((*StatAccum)(unsafe.Pointer(p)).FiGet)*48)).FanEq + break + fallthrough + case STAT_GET_NLT: + aCnt = (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((*StatAccum)(unsafe.Pointer(p)).FiGet)*48)).FanLt + break + fallthrough + default: + { + aCnt = (*StatSample)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fa + uintptr((*StatAccum)(unsafe.Pointer(p)).FiGet)*48)).FanDLt + (*StatAccum)(unsafe.Pointer(p)).FiGet++ + break + + } + } + + { + var zRet uintptr = Xsqlite3MallocZero(tls, (uint64((*StatAccum)(unsafe.Pointer(p)).FnCol * 25))) + if zRet == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + } else { + var i int32 + var z uintptr = zRet + for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { + Xsqlite3_snprintf(tls, 24, z, ts+10184 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + z += uintptr(Xsqlite3Strlen30(tls, z)) + } + + *(*int8)(unsafe.Pointer(z + libc.UintptrFromInt32(-1))) = int8(0) + Xsqlite3_result_text(tls, context, zRet, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + + } + } + _ = argc +} + +var statGetFuncdef = FuncDef{ + FnArg: (int8(1 + IsStat4)), // nArg + FfuncFlags: U32(SQLITE_UTF8), // pNext + FxSFunc: 0, // xValue, xInverse + FzName: ts + 10190 /* "stat_get" */} /* sqlite3.c:110526:22 */ + +func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ + Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) + + Xsqlite3VdbeAddFunctionCall(tls, pParse, 0, regStat, regOut, (1 + IsStat4), + uintptr(unsafe.Pointer(&statGetFuncdef)), 0) +} + +// Generate code to do an analysis of all indices associated with +// a single table. +func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr, iStatCur int32, iMem int32, iTab int32) { /* sqlite3.c:110579:13: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var pIdx uintptr // An index to being analyzed + var iIdxCur int32 // Cursor open on index being analyzed + var iTabCur int32 // Table cursor + var v uintptr // The virtual machine being built up + var i int32 // Loop counter + var jZeroRows int32 = -1 // Jump from here if number of rows is zero + var iDb int32 // Index of database containing pTab + var needTableCnt U8 = U8(1) // True to count the table + var regNewRowid int32 = libc.PostIncInt32(&iMem, 1) // Rowid for the inserted record + var regStat int32 = libc.PostIncInt32(&iMem, 1) // Register to hold StatAccum object + var regChng int32 = libc.PostIncInt32(&iMem, 1) // Index of changed index field + var regRowid int32 = libc.PostIncInt32(&iMem, 1) // Rowid argument passed to stat_push() + var regTemp int32 = libc.PostIncInt32(&iMem, 1) // Temporary use register + var regTemp2 int32 = libc.PostIncInt32(&iMem, 1) // Second temporary use register + var regTabname int32 = libc.PostIncInt32(&iMem, 1) // Register containing table name + var regIdxname int32 = libc.PostIncInt32(&iMem, 1) // Register containing index name + var regStat1 int32 = libc.PostIncInt32(&iMem, 1) // Value for the stat column of sqlite_stat1 + var regPrev int32 = iMem // MUST BE LAST (see below) + var pStat1 uintptr = uintptr(0) + + (*Parse)(unsafe.Pointer(pParse)).FnMem = func() int32 { + if ((*Parse)(unsafe.Pointer(pParse)).FnMem) > (iMem) { + return (*Parse)(unsafe.Pointer(pParse)).FnMem + } + return iMem + }() + v = Xsqlite3GetVdbe(tls, pParse) + if (v == uintptr(0)) || (pTab == uintptr(0)) { + return + } + if (*Table)(unsafe.Pointer(pTab)).Ftnum == Pgno(0) { + // Do not gather statistics on views or virtual tables + return + } + if Xsqlite3_strlike(tls, ts+10199 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + // Do not gather statistics on system tables + return + } + + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + if Xsqlite3AuthCheck(tls, pParse, SQLITE_ANALYZE, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0), + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) != 0 { + return + } + + if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { + pStat1 = Xsqlite3DbMallocZero(tls, db, (uint64(unsafe.Sizeof(Table{})) + uint64(13))) + if pStat1 == uintptr(0) { + return + } + (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*120) + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10073 /* "sqlite_stat1" */, uint64(13)) + (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) + (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) + Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) + } + + // Establish a read-lock on the table at the shared-cache level. + // Open a read-only cursor on the table. Also allocate a cursor number + // to use for scanning indexes (iIdxCur). No index cursor is opened at + // this time though. + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pTab)).FzName) + iTabCur = libc.PostIncInt32(&iTab, 1) + iIdxCur = libc.PostIncInt32(&iTab, 1) + (*Parse)(unsafe.Pointer(pParse)).FnTab = func() int32 { + if ((*Parse)(unsafe.Pointer(pParse)).FnTab) > (iTab) { + return (*Parse)(unsafe.Pointer(pParse)).FnTab + } + return iTab + }() + Xsqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab, OP_OpenRead) + Xsqlite3VdbeLoadString(tls, v, regTabname, (*Table)(unsafe.Pointer(pTab)).FzName) + + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + var nCol int32 // Number of columns in pIdx. "N" + var addrRewind int32 // Address of "OP_Rewind iIdxCur" + var addrNextRow int32 // Address of "next_row:" + var zIdxName uintptr // Name of the index + var nColTest int32 // Number of columns to test for changes + + if (pOnlyIdx != 0) && (pOnlyIdx != pIdx) { + continue + } + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) { + needTableCnt = U8(0) + } + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { + nCol = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + zIdxName = (*Table)(unsafe.Pointer(pTab)).FzName + nColTest = (nCol - 1) + } else { + nCol = int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + zIdxName = (*Index)(unsafe.Pointer(pIdx)).FzName + if (uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0 { + nColTest = (int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) - 1) + } else { + nColTest = (nCol - 1) + } + } + + // Populate the register containing the index name. + Xsqlite3VdbeLoadString(tls, v, regIdxname, zIdxName) + + // Pseudo-code for loop that calls stat_push(): + // + // Rewind csr + // if eof(csr) goto end_of_scan; + // regChng = 0 + // goto chng_addr_0; + // + // next_row: + // regChng = 0 + // if( idx(0) != regPrev(0) ) goto chng_addr_0 + // regChng = 1 + // if( idx(1) != regPrev(1) ) goto chng_addr_1 + // ... + // regChng = N + // goto chng_addr_N + // + // chng_addr_0: + // regPrev(0) = idx(0) + // chng_addr_1: + // regPrev(1) = idx(1) + // ... + // + // endDistinctTest: + // regRowid = idx(rowid) + // stat_push(P, regChng, regRowid) + // Next csr + // if !eof(csr) goto next_row; + // + // end_of_scan: + + // Make sure there are enough memory cells allocated to accommodate + // the regPrev array and a trailing rowid (the rowid slot is required + // when building a record to insert into the sample column of + // the sqlite_stat4 table. + (*Parse)(unsafe.Pointer(pParse)).FnMem = func() int32 { + if ((*Parse)(unsafe.Pointer(pParse)).FnMem) > (regPrev + nColTest) { + return (*Parse)(unsafe.Pointer(pParse)).FnMem + } + return (regPrev + nColTest) + }() + + // Open a read-only cursor on the index being analyzed. + + Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iIdxCur, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + + // Invoke the stat_init() function. The arguments are: + // + // (1) the number of columns in the index including the rowid + // (or for a WITHOUT ROWID table, the number of PK columns), + // (2) the number of columns in the key without the rowid/pk + // (3) estimated number of rows in the index, + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, nCol, (regStat + 1)) + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol), regRowid) + if ((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0) { + Xsqlite3VdbeAddOp2(tls, v, OP_Count, iIdxCur, regTemp) + addrRewind = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, iIdxCur) + + } else { + addrRewind = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, iIdxCur) + + Xsqlite3VdbeAddOp3(tls, v, OP_Count, iIdxCur, regTemp, 1) + } + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, (*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit, regTemp2) + Xsqlite3VdbeAddFunctionCall(tls, pParse, 0, (regStat + 1), regStat, 4, + uintptr(unsafe.Pointer(&statInitFuncdef)), 0) + + // Implementation of the following: + // + // Rewind csr + // if eof(csr) goto end_of_scan; + // regChng = 0 + // goto next_push_0; + // + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regChng) + addrNextRow = Xsqlite3VdbeCurrentAddr(tls, v) + + if nColTest > 0 { + var endDistinctTest int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var aGotoChng uintptr // Array of jump instruction addresses + aGotoChng = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(int32(0))) * uint64(nColTest)))) + if aGotoChng == uintptr(0) { + continue + } + + // next_row: + // regChng = 0 + // if( idx(0) != regPrev(0) ) goto chng_addr_0 + // regChng = 1 + // if( idx(1) != regPrev(1) ) goto chng_addr_1 + // ... + // regChng = N + // goto endDistinctTest + Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + addrNextRow = Xsqlite3VdbeCurrentAddr(tls, v) + if ((nColTest == 1) && (int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) == 1)) && (int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None) { + // For a single-column UNIQUE index, once we have found a non-NULL + // row, we know that all the rest will be distinct, so skip + // subsequent distinctness tests. + Xsqlite3VdbeAddOp2(tls, v, OP_NotNull, regPrev, endDistinctTest) + + } + for i = 0; i < nColTest; i++ { + var pColl uintptr = Xsqlite3LocateCollSeq(tls, pParse, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8))) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, i, regChng) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iIdxCur, i, regTemp) + + *(*int32)(unsafe.Pointer(aGotoChng + uintptr(i)*4)) = Xsqlite3VdbeAddOp4(tls, v, OP_Ne, regTemp, 0, (regPrev + i), pColl, -2) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) + + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, nColTest, regChng) + Xsqlite3VdbeGoto(tls, v, endDistinctTest) + + // chng_addr_0: + // regPrev(0) = idx(0) + // chng_addr_1: + // regPrev(1) = idx(1) + // ... + Xsqlite3VdbeJumpHere(tls, v, (addrNextRow - 1)) + for i = 0; i < nColTest; i++ { + Xsqlite3VdbeJumpHere(tls, v, *(*int32)(unsafe.Pointer(aGotoChng + uintptr(i)*4))) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iIdxCur, i, (regPrev + i)) + + } + Xsqlite3VdbeResolveLabel(tls, v, endDistinctTest) + Xsqlite3DbFree(tls, db, aGotoChng) + } + + // chng_addr_N: + // regRowid = idx(rowid) // STAT4 only + // stat_push(P, regChng, regRowid) // 3rd parameter STAT4 only + // Next csr + // if !eof(csr) goto next_row; + if ((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0) { + + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + Xsqlite3VdbeAddOp2(tls, v, OP_IdxRowid, iIdxCur, regRowid) + } else { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, (*Index)(unsafe.Pointer(pIdx)).FpTable) + var j int32 + var k int32 + var regKey int32 + regKey = Xsqlite3GetTempRange(tls, pParse, int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + for j = 0; j < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol); j++ { + k = int32(Xsqlite3TableColumnToIndex(tls, pIdx, *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)))) + + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iIdxCur, k, (regKey + j)) + + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regKey, int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol), regRowid) + Xsqlite3ReleaseTempRange(tls, pParse, regKey, int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + } + } + + { + Xsqlite3VdbeAddFunctionCall(tls, pParse, 1, regStat, regTemp, (2 + IsStat4), + uintptr(unsafe.Pointer(&statPushFuncdef)), 0) + if (*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit != 0 { + var j1 int32 + var j2 int32 + var j3 int32 + j1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, regTemp) + j2 = Xsqlite3VdbeAddOp1(tls, v, OP_If, regTemp) + j3 = Xsqlite3VdbeAddOp4Int(tls, v, OP_SeekGT, iIdxCur, 0, regPrev, 1) + + Xsqlite3VdbeJumpHere(tls, v, j1) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iIdxCur, addrNextRow) + Xsqlite3VdbeJumpHere(tls, v, j2) + Xsqlite3VdbeJumpHere(tls, v, j3) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iIdxCur, addrNextRow) + } + + } + + // Add the entry to the stat1 table. + callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) + + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10209 /* "BBB" */, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) + Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + + // Add the entries to the stat4 table. + if (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0)) && ((*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit == 0) { + var regEq int32 = regStat1 + var regLt int32 = (regStat1 + 1) + var regDLt int32 = (regStat1 + 2) + var regSample int32 = (regStat1 + 3) + var regCol int32 = (regStat1 + 4) + var regSampleRowid int32 = (regCol + nCol) + var addrNext int32 + var addrIsNull int32 + var seekOp U8 + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + seekOp = uint8(OP_NotExists) + } else { + seekOp = uint8(OP_NotFound) + } + + (*Parse)(unsafe.Pointer(pParse)).FnMem = func() int32 { + if ((*Parse)(unsafe.Pointer(pParse)).FnMem) > (regCol + nCol) { + return (*Parse)(unsafe.Pointer(pParse)).FnMem + } + return (regCol + nCol) + }() + + addrNext = Xsqlite3VdbeCurrentAddr(tls, v) + callStatGet(tls, pParse, regStat, STAT_GET_ROWID, regSampleRowid) + addrIsNull = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, regSampleRowid) + + callStatGet(tls, pParse, regStat, STAT_GET_NEQ, regEq) + callStatGet(tls, pParse, regStat, STAT_GET_NLT, regLt) + callStatGet(tls, pParse, regStat, STAT_GET_NDLT, regDLt) + Xsqlite3VdbeAddOp4Int(tls, v, int32(seekOp), iTabCur, addrNext, regSampleRowid, 0) + + for i = 0; i < nCol; i++ { + Xsqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iTabCur, i, (regCol + i)) + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regCol, nCol, regSample) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regTabname, 6, regTemp) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, (iStatCur + 1), regNewRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, (iStatCur + 1), regTemp, regNewRowid) + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 1, addrNext) // P1==1 for end-of-loop + Xsqlite3VdbeJumpHere(tls, v, addrIsNull) + } + + // End of analysis + Xsqlite3VdbeJumpHere(tls, v, addrRewind) + } + + // Create a single sqlite_stat1 entry containing NULL as the index + // name and the row count as the content. + if (pOnlyIdx == uintptr(0)) && (needTableCnt != 0) { + + Xsqlite3VdbeAddOp2(tls, v, OP_Count, iTabCur, regStat1) + jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) + + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10209 /* "BBB" */, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) + Xsqlite3VdbeJumpHere(tls, v, jZeroRows) + } +} + +// Generate code that will cause the most recent index analysis to +// be loaded into internal hash tables where is can be used. +func loadAnalysis(tls *libc.TLS, pParse uintptr, iDb int32) { /* sqlite3.c:110941:13: */ + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + if v != 0 { + Xsqlite3VdbeAddOp1(tls, v, OP_LoadAnalysis, iDb) + } +} + +// Generate code that will do an analysis of an entire database +func analyzeDatabase(tls *libc.TLS, pParse uintptr, iDb int32) { /* sqlite3.c:110951:13: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pSchema uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema // Schema of database iDb + var k uintptr + var iStatCur int32 + var iMem int32 + var iTab int32 + + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab + *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) + openStatTable(tls, pParse, iDb, iStatCur, uintptr(0), uintptr(0)) + iMem = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + iTab = (*Parse)(unsafe.Pointer(pParse)).FnTab + + for k = (*Hash)(unsafe.Pointer((pSchema + 8 /* &.tblHash */))).Ffirst; k != 0; k = (*HashElem)(unsafe.Pointer(k)).Fnext { + var pTab uintptr = (*HashElem)(unsafe.Pointer(k)).Fdata + analyzeOneTable(tls, pParse, pTab, uintptr(0), iStatCur, iMem, iTab) + } + loadAnalysis(tls, pParse, iDb) +} + +// Generate code that will do an analysis of a single table in +// a database. If pOnlyIdx is not NULL then it is a single index +// in pTab that should be analyzed. +func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) { /* sqlite3.c:110978:13: */ + var iDb int32 + var iStatCur int32 + + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab + *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) + if pOnlyIdx != 0 { + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10213 /* "idx" */) + } else { + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10217 /* "tbl" */) + } + analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) + loadAnalysis(tls, pParse, iDb) +} + +// Generate code for the ANALYZE command. The parser calls this routine +// when it recognizes an ANALYZE command. +// +// ANALYZE -- 1 +// ANALYZE -- 2 +// ANALYZE ?.? -- 3 +// +// Form 1 causes all indices in all attached databases to be analyzed. +// Form 2 analyzes all indices the single database named. +// Form 3 analyzes all indices associated with the named table. +func Xsqlite3Analyze(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr) { /* sqlite3.c:111009:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var iDb int32 + var i int32 + var z uintptr + var zDb uintptr + var pTab uintptr + var pIdx uintptr + // var pTableName uintptr at bp, 8 + + var v uintptr + + // Read the database schema. If an error occurs, leave an error message + // and code in pParse and return NULL. + + if SQLITE_OK != Xsqlite3ReadSchema(tls, pParse) { + return + } + + if pName1 == uintptr(0) { + // Form 1: Analyze everything + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + if i == 1 { + continue + } // Do not analyze the TEMP database + analyzeDatabase(tls, pParse, i) + } + } else if ((*Token)(unsafe.Pointer(pName2)).Fn == uint32(0)) && ((libc.AssignInt32(&iDb, Xsqlite3FindDb(tls, db, pName1))) >= 0) { + // Analyze the schema named as the argument + analyzeDatabase(tls, pParse, iDb) + } else { + // Form 3: Analyze the table or index named as an argument + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pTableName */) + if iDb >= 0 { + if (*Token)(unsafe.Pointer(pName2)).Fn != 0 { + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + } else { + zDb = uintptr(0) + } + z = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pTableName */))) + if z != 0 { + if (libc.AssignUintptr(&pIdx, Xsqlite3FindIndex(tls, db, z, zDb))) != uintptr(0) { + analyzeTable(tls, pParse, (*Index)(unsafe.Pointer(pIdx)).FpTable, pIdx) + } else if (libc.AssignUintptr(&pTab, Xsqlite3LocateTable(tls, pParse, uint32(0), z, zDb))) != uintptr(0) { + analyzeTable(tls, pParse, pTab, uintptr(0)) + } + Xsqlite3DbFree(tls, db, z) + } + } + } + if (int32((*Sqlite3)(unsafe.Pointer(db)).FnSqlExec) == 0) && ((libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0)) { + Xsqlite3VdbeAddOp0(tls, v, OP_Expire) + } +} + +// Used to pass information from the analyzer reader through to the +// callback routine. +type analysisInfo = struct { + Fdb uintptr + FzDatabase uintptr +} /* sqlite3.c:111061:9 */ + +// Used to pass information from the analyzer reader through to the +// callback routine. +type AnalysisInfo = analysisInfo /* sqlite3.c:111061:29 */ + +// The first argument points to a nul-terminated string containing a +// list of space separated integers. Read the first nOut of these into +// the array aOut[]. +func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, aLog uintptr, pIndex uintptr) { /* sqlite3.c:111072:13: */ + var z uintptr = zIntArray + var c int32 + var i int32 + var v TRowcnt + + if z == uintptr(0) { + z = ts + 756 /* "" */ + } + for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { + v = TRowcnt(0) + for ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(z))))) >= '0') && (c <= '9') { + v = (((v * TRowcnt(10)) + TRowcnt(c)) - TRowcnt('0')) + z++ + } + if aOut != 0 { + *(*TRowcnt)(unsafe.Pointer(aOut + uintptr(i)*4)) = v + } + if aLog != 0 { + *(*LogEst)(unsafe.Pointer(aLog + uintptr(i)*2)) = Xsqlite3LogEst(tls, uint64(v)) + } + if int32(*(*int8)(unsafe.Pointer(z))) == ' ' { + z++ + } + } + if pIndex != 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(0), 6, 0x40) + for *(*int8)(unsafe.Pointer(z)) != 0 { + if Xsqlite3_strglob(tls, ts+10221 /* "unordered*" */, z) == 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(1), 2, 0x4) + } else if Xsqlite3_strglob(tls, ts+10232 /* "sz=[0-9]*" */, z) == 0 { + var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) + if sz < 2 { + sz = 2 + } + (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) + } else if Xsqlite3_strglob(tls, ts+10242 /* "noskipscan*" */, z) == 0 { + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(1), 6, 0x40) + } + for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { + z++ + } + for int32(*(*int8)(unsafe.Pointer(z))) == ' ' { + z++ + } + } + } +} + +// This callback is invoked once for each index when reading the +// sqlite_stat1 table. +// +// argv[0] = name of the table +// argv[1] = name of the index (might be NULL) +// argv[2] = results of analysis - on integer for each column +// +// Entries for which argv[1]==NULL simply record the number of rows in +// the table. +func analysisLoader(tls *libc.TLS, pData uintptr, argc int32, argv uintptr, NotUsed uintptr) int32 { /* sqlite3.c:111145:12: */ + bp := tls.Alloc(152) + defer tls.Free(152) + + var pInfo uintptr = pData + var pIndex uintptr + var pTable uintptr + var z uintptr + + _ = NotUsed + _ = argc + + if ((argv == uintptr(0)) || (*(*uintptr)(unsafe.Pointer(argv)) == uintptr(0))) || (*(*uintptr)(unsafe.Pointer(argv + 2*8)) == uintptr(0)) { + return 0 + } + pTable = Xsqlite3FindTable(tls, (*AnalysisInfo)(unsafe.Pointer(pInfo)).Fdb, *(*uintptr)(unsafe.Pointer(argv)), (*AnalysisInfo)(unsafe.Pointer(pInfo)).FzDatabase) + if pTable == uintptr(0) { + return 0 + } + if *(*uintptr)(unsafe.Pointer(argv + 1*8)) == uintptr(0) { + pIndex = uintptr(0) + } else if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv)), *(*uintptr)(unsafe.Pointer(argv + 1*8))) == 0 { + pIndex = Xsqlite3PrimaryKeyIndex(tls, pTable) + } else { + pIndex = Xsqlite3FindIndex(tls, (*AnalysisInfo)(unsafe.Pointer(pInfo)).Fdb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*AnalysisInfo)(unsafe.Pointer(pInfo)).FzDatabase) + } + z = *(*uintptr)(unsafe.Pointer(argv + 2*8)) + + if pIndex != 0 { + var aiRowEst uintptr = uintptr(0) + var nCol int32 = (int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol) + 1) + // Index.aiRowEst may already be set here if there are duplicate + // sqlite_stat1 entries for this index. In that case just clobber + // the old data with the new instead of allocating a new array. + if (*Index)(unsafe.Pointer(pIndex)).FaiRowEst == uintptr(0) { + (*Index)(unsafe.Pointer(pIndex)).FaiRowEst = Xsqlite3MallocZero(tls, (uint64(uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nCol)))) + if (*Index)(unsafe.Pointer(pIndex)).FaiRowEst == uintptr(0) { + Xsqlite3OomFault(tls, (*AnalysisInfo)(unsafe.Pointer(pInfo)).Fdb) + } + } + aiRowEst = (*Index)(unsafe.Pointer(pIndex)).FaiRowEst + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) + decodeIntArray(tls, z, nCol, aiRowEst, (*Index)(unsafe.Pointer(pIndex)).FaiRowLogEst, pIndex) + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.hasStat1 */, uint32(1), 7, 0x80) + if (*Index)(unsafe.Pointer(pIndex)).FpPartIdxWhere == uintptr(0) { + (*Table)(unsafe.Pointer(pTable)).FnRowLogEst = *(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiRowLogEst)) + *(*U32)(unsafe.Pointer(pTable + 64 /* &.tabFlags */)) |= (U32(TF_HasStat1)) + } + } else { + // var fakeIdx Index at bp, 152 + + (*Index)(unsafe.Pointer(bp /* &fakeIdx */)).FszIdxRow = (*Table)(unsafe.Pointer(pTable)).FszTabRow + decodeIntArray(tls, z, 1, uintptr(0), (pTable + 74 /* &.nRowLogEst */), bp /* &fakeIdx */) + (*Table)(unsafe.Pointer(pTable)).FszTabRow = (*Index)(unsafe.Pointer(bp /* &fakeIdx */)).FszIdxRow + *(*U32)(unsafe.Pointer(pTable + 64 /* &.tabFlags */)) |= (U32(TF_HasStat1)) + } + + return 0 +} + +// If the Index.aSample variable is not NULL, delete the aSample[] array +// and its contents. +func Xsqlite3DeleteIndexSamples(tls *libc.TLS, db uintptr, pIdx uintptr) { /* sqlite3.c:111208:21: */ + if (*Index)(unsafe.Pointer(pIdx)).FaSample != 0 { + var j int32 + for j = 0; j < (*Index)(unsafe.Pointer(pIdx)).FnSample; j++ { + var p uintptr = ((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr(j)*40) + Xsqlite3DbFree(tls, db, (*IndexSample)(unsafe.Pointer(p)).Fp) + } + Xsqlite3DbFree(tls, db, (*Index)(unsafe.Pointer(pIdx)).FaSample) + } + if (db != 0) && ((*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0)) { + (*Index)(unsafe.Pointer(pIdx)).FnSample = 0 + (*Index)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) + } +} + +// Populate the pIdx->aAvgEq[] array based on the samples currently +// stored in pIdx->aSample[]. +func initAvgEq(tls *libc.TLS, pIdx uintptr) { /* sqlite3.c:111233:13: */ + if pIdx != 0 { + var aSample uintptr = (*Index)(unsafe.Pointer(pIdx)).FaSample + var pFinal uintptr = (aSample + uintptr(((*Index)(unsafe.Pointer(pIdx)).FnSample-1))*40) + var iCol int32 + var nCol int32 = 1 + if (*Index)(unsafe.Pointer(pIdx)).FnSampleCol > 1 { + // If this is stat4 data, then calculate aAvgEq[] values for all + // sample columns except the last. The last is always set to 1, as + // once the trailing PK fields are considered all index keys are + // unique. + nCol = ((*Index)(unsafe.Pointer(pIdx)).FnSampleCol - 1) + *(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(nCol)*4)) = TRowcnt(1) + } + for iCol = 0; iCol < nCol; iCol++ { + var nSample int32 = (*Index)(unsafe.Pointer(pIdx)).FnSample + var i int32 // Used to iterate through samples + var sumEq TRowcnt = TRowcnt(0) // Sum of the nEq values + var avgEq TRowcnt = TRowcnt(0) + var nRow TRowcnt // Number of rows in index + var nSum100 I64 = int64(0) // Number of terms contributing to sumEq + var nDist100 I64 // Number of distinct values in index + + if (!(int32((*Index)(unsafe.Pointer(pIdx)).FaiRowEst) != 0) || (iCol >= int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))) || (*(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowEst + uintptr((iCol+1))*4)) == TRowcnt(0)) { + nRow = *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(pFinal)).FanLt + uintptr(iCol)*4)) + nDist100 = (int64(100) * I64(*(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(pFinal)).FanDLt + uintptr(iCol)*4)))) + nSample-- + } else { + nRow = *(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowEst)) + nDist100 = ((int64(100) * I64(*(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowEst)))) / I64(*(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowEst + uintptr((iCol+1))*4)))) + } + (*Index)(unsafe.Pointer(pIdx)).FnRowEst0 = nRow + + // Set nSum to the number of distinct (iCol+1) field prefixes that + // occur in the stat4 table for this index. Set sumEq to the sum of + // the nEq values for column iCol for the same set (adding the value + // only once where there exist duplicate prefixes). + for i = 0; i < nSample; i++ { + if (i == ((*Index)(unsafe.Pointer(pIdx)).FnSample - 1)) || + (*(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(i)*40)).FanDLt + uintptr(iCol)*4)) != *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr((i+1))*40)).FanDLt + uintptr(iCol)*4))) { + sumEq = sumEq + (*(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(i)*40)).FanEq + uintptr(iCol)*4))) + nSum100 = nSum100 + (int64(100)) + } + } + + if (nDist100 > nSum100) && (sumEq < nRow) { + avgEq = (TRowcnt((int64(100) * (I64(nRow - sumEq))) / (nDist100 - nSum100))) + } + if avgEq == TRowcnt(0) { + avgEq = TRowcnt(1) + } + *(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr(iCol)*4)) = avgEq + } + } +} + +// Look up an index by name. Or, if the name of a WITHOUT ROWID table +// is supplied instead, find the PRIMARY KEY index for that table. +func findIndexOrPrimaryKey(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) uintptr { /* sqlite3.c:111292:14: */ + var pIdx uintptr = Xsqlite3FindIndex(tls, db, zName, zDb) + if pIdx == uintptr(0) { + var pTab uintptr = Xsqlite3FindTable(tls, db, zName, zDb) + if (pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + pIdx = Xsqlite3PrimaryKeyIndex(tls, pTab) + } + } + return pIdx +} + +// Load the content from either the sqlite_stat4 +// into the relevant Index.aSample[] arrays. +// +// Arguments zSql1 and zSql2 must point to SQL statements that return +// data equivalent to the following: +// +// zSql1: SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx +// zSql2: SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4 +// +// where %Q is replaced with the database name before the SQL is executed. +func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb uintptr) int32 { /* sqlite3.c:111317:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 // Result codes from subroutines + *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0) // An SQL statement being run + var zSql uintptr // Text of the SQL statement + var pPrevIdx uintptr = uintptr(0) // Previous index in the loop + var pSample uintptr // A slot in pIdx->aSample[] + + zSql = Xsqlite3MPrintf(tls, db, zSql1, libc.VaList(bp, zDb)) + if !(zSql != 0) { + return SQLITE_NOMEM + } + rc = Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3DbFree(tls, db, zSql) + if rc != 0 { + return rc + } + + for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) == SQLITE_ROW { + var nIdxCol int32 = 1 // Number of columns in stat4 records + + var zIndex uintptr // Index name + var pIdx uintptr // Pointer to the index object + var nSample int32 // Number of samples + var nByte int32 // Bytes of space required + var i int32 // Bytes of space required + var pSpace uintptr + + zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) + if zIndex == uintptr(0) { + continue + } + nSample = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + pIdx = findIndexOrPrimaryKey(tls, db, zIndex, zDb) + + if pIdx == uintptr(0) { + continue + } + + if !(((*Table)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FpTable))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { + nIdxCol = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + nIdxCol = int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + } + (*Index)(unsafe.Pointer(pIdx)).FnSampleCol = nIdxCol + nByte = (int32(uint64(unsafe.Sizeof(IndexSample{})) * uint64(nSample))) + nByte = int32(uint64(nByte) + (((uint64(unsafe.Sizeof(TRowcnt(0))) * uint64(nIdxCol)) * uint64(3)) * uint64(nSample))) + nByte = int32(uint64(nByte) + (uint64(nIdxCol) * uint64(unsafe.Sizeof(TRowcnt(0))))) // Space for Index.aAvgEq[] + + (*Index)(unsafe.Pointer(pIdx)).FaSample = Xsqlite3DbMallocZero(tls, db, uint64(nByte)) + if (*Index)(unsafe.Pointer(pIdx)).FaSample == uintptr(0) { + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return SQLITE_NOMEM + } + pSpace = ((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr(nSample)*40) + (*Index)(unsafe.Pointer(pIdx)).FaAvgEq = pSpace + pSpace += 4 * (uintptr(nIdxCol)) + *(*U32)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable + 64 /* &.tabFlags */)) |= (U32(TF_HasStat4)) + for i = 0; i < nSample; i++ { + (*IndexSample)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr(i)*40)).FanEq = pSpace + pSpace += 4 * (uintptr(nIdxCol)) + (*IndexSample)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr(i)*40)).FanLt = pSpace + pSpace += 4 * (uintptr(nIdxCol)) + (*IndexSample)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr(i)*40)).FanDLt = pSpace + pSpace += 4 * (uintptr(nIdxCol)) + } + + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + if rc != 0 { + return rc + } + + zSql = Xsqlite3MPrintf(tls, db, zSql2, libc.VaList(bp+8, zDb)) + if !(zSql != 0) { + return SQLITE_NOMEM + } + rc = Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3DbFree(tls, db, zSql) + if rc != 0 { + return rc + } + + for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) == SQLITE_ROW { + var zIndex uintptr // Index name + var pIdx uintptr // Pointer to the index object + var nCol int32 = 1 // Number of columns in index + + zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) + if zIndex == uintptr(0) { + continue + } + pIdx = findIndexOrPrimaryKey(tls, db, zIndex, zDb) + if pIdx == uintptr(0) { + continue + } + // This next condition is true if data has already been loaded from + // the sqlite_stat4 table. + nCol = (*Index)(unsafe.Pointer(pIdx)).FnSampleCol + if pIdx != pPrevIdx { + initAvgEq(tls, pPrevIdx) + pPrevIdx = pIdx + } + pSample = ((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr((*Index)(unsafe.Pointer(pIdx)).FnSample)*40) + decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanEq, uintptr(0), uintptr(0)) + decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 2), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanLt, uintptr(0), uintptr(0)) + decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 3), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanDLt, uintptr(0), uintptr(0)) + + // Take a copy of the sample. Add two 0x00 bytes the end of the buffer. + // This is in case the sample record is corrupted. In that case, the + // sqlite3VdbeRecordCompare() may read up to two varints past the + // end of the allocated buffer before it realizes it is dealing with + // a corrupt record. Adding the two 0x00 bytes prevents this from causing + // a buffer overread. + (*IndexSample)(unsafe.Pointer(pSample)).Fn = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 4) + (*IndexSample)(unsafe.Pointer(pSample)).Fp = Xsqlite3DbMallocZero(tls, db, (uint64((*IndexSample)(unsafe.Pointer(pSample)).Fn + 2))) + if (*IndexSample)(unsafe.Pointer(pSample)).Fp == uintptr(0) { + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return SQLITE_NOMEM + } + if (*IndexSample)(unsafe.Pointer(pSample)).Fn != 0 { + libc.Xmemcpy(tls, (*IndexSample)(unsafe.Pointer(pSample)).Fp, Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 4), uint64((*IndexSample)(unsafe.Pointer(pSample)).Fn)) + } + (*Index)(unsafe.Pointer(pIdx)).FnSample++ + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + if rc == SQLITE_OK { + initAvgEq(tls, pPrevIdx) + } + return rc +} + +// Load content from the sqlite_stat4 table into +// the Index.aSample[] arrays of all indices. +func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ + var rc int32 = SQLITE_OK // Result codes from subroutines + + if Xsqlite3FindTable(tls, db, ts+10099 /* "sqlite_stat4" */, zDb) != 0 { + rc = loadStatTbl(tls, db, + ts+10254, /* "SELECT idx,count..." */ + ts+10308, /* "SELECT idx,neq,n..." */ + zDb) + } + return rc +} + +// Load the content of the sqlite_stat1 and sqlite_stat4 tables. The +// contents of sqlite_stat1 are used to populate the Index.aiRowEst[] +// arrays. The contents of sqlite_stat4 are used to populate the +// Index.aSample[] arrays. +// +// If the sqlite_stat1 table is not present in the database, SQLITE_ERROR +// is returned. In this case, even if SQLITE_ENABLE_STAT4 was defined +// during compilation and the sqlite_stat4 table is present, no data is +// read from it. +// +// If SQLITE_ENABLE_STAT4 was defined during compilation and the +// sqlite_stat4 table is not present in the database, SQLITE_ERROR is +// returned. However, in this case, data is read from the sqlite_stat1 +// table (if it is present) before returning. +// +// If an OOM error occurs, this function always sets db->mallocFailed. +// This means if the caller does not care about other errors, the return +// code may be ignored. +func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlite3.c:111473:20: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var sInfo AnalysisInfo at bp+8, 16 + + var i uintptr + var zSql uintptr + var rc int32 = SQLITE_OK + var pSchema uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + + // Clear any prior statistics + + for i = (*Hash)(unsafe.Pointer((pSchema + 8 /* &.tblHash */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pTab uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(TF_HasStat1))) + } + for i = (*Hash)(unsafe.Pointer((pSchema + 32 /* &.idxHash */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pIdx uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + libc.SetBitFieldPtr16Uint32(pIdx+100 /* &.hasStat1 */, uint32(0), 7, 0x80) + Xsqlite3DeleteIndexSamples(tls, db, pIdx) + (*Index)(unsafe.Pointer(pIdx)).FaSample = uintptr(0) + } + + // Load new statistics out of the sqlite_stat1 table + (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db + (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + if Xsqlite3FindTable(tls, db, ts+10073 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + zSql = Xsqlite3MPrintf(tls, db, + ts+10360 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 + }{analysisLoader})), bp+8 /* &sInfo */, uintptr(0)) + Xsqlite3DbFree(tls, db, zSql) + } + } + + // Set appropriate defaults on all indexes not in the sqlite_stat1 table + + for i = (*Hash)(unsafe.Pointer((pSchema + 32 /* &.idxHash */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pIdx uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + if !((int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.hasStat1 */)) & 0x80 >> 7)) != 0) { + Xsqlite3DefaultRowEst(tls, pIdx) + } + } + + // Load the statistics from the sqlite_stat4 table. + if rc == SQLITE_OK { + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) + rc = loadStat4(tls, db, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = func() uint16 { + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + return uint16(0) + } + return (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue + }() + } + for i = (*Hash)(unsafe.Pointer((pSchema + 32 /* &.idxHash */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pIdx uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + Xsqlite3_free(tls, (*Index)(unsafe.Pointer(pIdx)).FaiRowEst) + (*Index)(unsafe.Pointer(pIdx)).FaiRowEst = uintptr(0) + } + + if rc == SQLITE_NOMEM { + Xsqlite3OomFault(tls, db) + } + return rc +} + +//************* End of analyze.c ******************************************** +//************* Begin file attach.c ***************************************** +// 2003 April 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code used to implement the ATTACH and DETACH commands. +// #include "sqliteInt.h" + +// Resolve an expression that was part of an ATTACH or DETACH statement. This +// is slightly different from resolving a normal SQL expression, because simple +// identifiers are treated as strings, not possible column names or aliases. +// +// i.e. if the parser sees: +// +// ATTACH DATABASE abc AS def +// +// it treats the two expressions as literal strings 'abc' and 'def' instead of +// looking for columns of the same name. +// +// This only applies to the root node of pExpr, so the statement: +// +// ATTACH DATABASE abc||def AS 'db2' +// +// will fail because neither abc or def can be resolved. +func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* sqlite3.c:111578:12: */ + var rc int32 = SQLITE_OK + if pExpr != 0 { + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_ID { + rc = Xsqlite3ResolveExprNames(tls, pName, pExpr) + } else { + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) + } + } + return rc +} + +// Return true if zName points to a name that may be used to refer to +// database iDb attached to handle db. +func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ + return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName) == 0) || + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5459 /* "main" */, zName) == 0)))) +} + +// An SQL user-function registered to do the work of an ATTACH statement. The +// three arguments to the function come directly from an attach statement: +// +// ATTACH DATABASE x AS y KEY z +// +// SELECT sqlite_attach(x, y, z) +// +// If the optional "KEY z" syntax is omitted, an SQL NULL is passed as the +// third argument. +// +// If the db->init.reopenMemdb flags is set, then instead of attaching a +// new database, close the database on db->init.iDb and reopen it as an +// empty MemDB. +func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:111617:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var rc int32 + var db uintptr + var zName uintptr + var zFile uintptr + // var zPath uintptr at bp+40, 8 + + // var zErr uintptr at bp+48, 8 + + // var flags uint32 at bp+24, 4 + + var aNew uintptr // New array of Db pointers + var pNew uintptr // Db object for the newly attached database + // var zErrDyn uintptr at bp+56, 8 + + // var pVfs uintptr at bp+32, 8 + + var pPager uintptr + var iDb int32 + rc = 0 + db = Xsqlite3_context_db_handle(tls, context) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zPath */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = uintptr(0) + + _ = NotUsed + zFile = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zName = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if !(zFile == uintptr(0)) { + goto __1 + } + zFile = ts + 756 /* "" */ +__1: + ; + if !(zName == uintptr(0)) { + goto __2 + } + zName = ts + 756 /* "" */ +__2: + ; + + if !((uint32(int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.reopenMemdb */)) & 0x4 >> 2))) != 0) { + goto __3 + } + // This is not a real ATTACH. Instead, this routine is being called + // from sqlite3_deserialize() to close database db->init.iDb and + // reopen it as a MemDB + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2963 /* "memdb" */) + if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) == uintptr(0)) { + goto __5 + } + return +__5: + ; + pNew = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb)*32) + if !((*Db)(unsafe.Pointer(pNew)).FpBt != 0) { + goto __6 + } + Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer(pNew)).FpBt) +__6: + ; + (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) + (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10401 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + goto __4 +__3: + // This is a real ATTACH + // + // Check for the following errors: + // + // * Too many attached databases, + // * Transaction currently open + // * Specified database name already being used. + if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)) + 2)) { + goto __7 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10404, /* "too many attache..." */ + libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)))) + goto attach_error +__7: + ; + i = 0 +__8: + if !(i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __10 + } + + if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { + goto __11 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10441 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + goto attach_error +__11: + ; + goto __9 +__9: + i++ + goto __8 + goto __10 +__10: + ; + + // Allocate the new entry in the db->aDb[] array and initialize the schema + // hash tables. + if !((*Sqlite3)(unsafe.Pointer(db)).FaDb == db+656 /* &.aDbStatic */) { + goto __12 + } + aNew = Xsqlite3DbMallocRawNN(tls, db, (uint64(unsafe.Sizeof(Db{})) * uint64(3))) + if !(aNew == uintptr(0)) { + goto __14 + } + return +__14: + ; + libc.Xmemcpy(tls, aNew, (*Sqlite3)(unsafe.Pointer(db)).FaDb, (uint64(unsafe.Sizeof(Db{})) * uint64(2))) + goto __13 +__12: + aNew = Xsqlite3DbRealloc(tls, db, (*Sqlite3)(unsafe.Pointer(db)).FaDb, (uint64(uint64(unsafe.Sizeof(Db{})) * (uint64((*Sqlite3)(unsafe.Pointer(db)).FnDb + 1))))) + if !(aNew == uintptr(0)) { + goto __15 + } + return +__15: + ; +__13: + ; + (*Sqlite3)(unsafe.Pointer(db)).FaDb = aNew + pNew = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Sqlite3)(unsafe.Pointer(db)).FnDb)*32) + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Db{}))) + + // Open the database file. If the btree is successfully opened, use + // it to obtain the database schema. At this point the schema may + // or may not be initialized. + *(*uint32)(unsafe.Pointer(bp + 24 /* flags */)) = (*Sqlite3)(unsafe.Pointer(db)).FopenFlags + rc = Xsqlite3ParseUri(tls, (*Sqlite3_vfs)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpVfs)).FzName, zFile, bp+24 /* &flags */, bp+32 /* &pVfs */, bp+40 /* &zPath */, bp+48 /* &zErr */) + if !(rc != SQLITE_OK) { + goto __16 + } + if !(rc == SQLITE_NOMEM) { + goto __17 + } + Xsqlite3OomFault(tls, db) +__17: + ; + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)), -1) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */))) + return +__16: + ; + + *(*uint32)(unsafe.Pointer(bp + 24 /* flags */)) |= uint32(SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), *(*uintptr)(unsafe.Pointer(bp + 40 /* zPath */)), db, (pNew + 8 /* &.pBt */), 0, int32(*(*uint32)(unsafe.Pointer(bp + 24 /* flags */)))) + (*Sqlite3)(unsafe.Pointer(db)).FnDb++ + (*Db)(unsafe.Pointer(pNew)).FzDbSName = Xsqlite3DbStrDup(tls, db, zName) +__4: + ; + (*Sqlite3)(unsafe.Pointer(db)).FnoSharedCache = U8(0) + if !(rc == SQLITE_CONSTRAINT) { + goto __18 + } + rc = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10471 /* "database is alre..." */, 0) + goto __19 +__18: + if !(rc == SQLITE_OK) { + goto __20 + } + (*Db)(unsafe.Pointer(pNew)).FpSchema = Xsqlite3SchemaGet(tls, db, (*Db)(unsafe.Pointer(pNew)).FpBt) + if !(!(int32((*Db)(unsafe.Pointer(pNew)).FpSchema) != 0)) { + goto __21 + } + rc = SQLITE_NOMEM + goto __22 +__21: + if !(((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0) && (int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != (int32((*Sqlite3)(unsafe.Pointer(db)).Fenc)))) { + goto __23 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, + ts+10500 /* "attached databas..." */, 0) + rc = SQLITE_ERROR +__23: + ; +__22: + ; + Xsqlite3BtreeEnter(tls, (*Db)(unsafe.Pointer(pNew)).FpBt) + pPager = Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer(pNew)).FpBt) + Xsqlite3PagerLockingMode(tls, pPager, int32((*Sqlite3)(unsafe.Pointer(db)).FdfltLockMode)) + Xsqlite3BtreeSecureDelete(tls, (*Db)(unsafe.Pointer(pNew)).FpBt, + Xsqlite3BtreeSecureDelete(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt, -1)) + Xsqlite3BtreeSetPagerFlags(tls, (*Db)(unsafe.Pointer(pNew)).FpBt, + (uint32(uint64(PAGER_SYNCHRONOUS_FULL) | ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(PAGER_FLAGS_MASK))))) + Xsqlite3BtreeLeave(tls, (*Db)(unsafe.Pointer(pNew)).FpBt) +__20: + ; +__19: + ; + (*Db)(unsafe.Pointer(pNew)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) + if !((rc == SQLITE_OK) && ((*Db)(unsafe.Pointer(pNew)).FzDbSName == uintptr(0))) { + goto __24 + } + rc = SQLITE_NOMEM +__24: + ; + Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* zPath */))) + + // If the file was opened successfully, read the schema for the new database. + // If this fails, or if opening the file failed, then close the file and + // remove the entry from the db->aDb[] array. i.e. put everything back the + // way we found it. + if !(rc == SQLITE_OK) { + goto __25 + } + Xsqlite3BtreeEnterAll(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(0) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_SchemaKnownOk))) + if !(!((int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.reopenMemdb */)) & 0x4 >> 2)) != 0)) { + goto __26 + } + rc = Xsqlite3Init(tls, db, bp+56 /* &zErrDyn */) +__26: + ; + Xsqlite3BtreeLeaveAll(tls, db) + +__25: + ; + if !(rc != 0) { + goto __27 + } + if !(!((int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.reopenMemdb */)) & 0x4 >> 2)) != 0)) { + goto __28 + } + iDb = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) + + if !((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpBt != 0) { + goto __29 + } + Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpBt) + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt = uintptr(0) + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema = uintptr(0) +__29: + ; + Xsqlite3ResetAllSchemasOfConnection(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FnDb = iDb + if !((rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8)))) { + goto __30 + } + Xsqlite3OomFault(tls, db) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5182 /* "out of memory" */, 0) + goto __31 +__30: + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) == uintptr(0)) { + goto __32 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10568 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) +__32: + ; +__31: + ; +__28: + ; + goto attach_error +__27: + ; + + return + +attach_error: + // Return an error if we get here + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) != 0) { + goto __33 + } + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)), -1) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) +__33: + ; + if !(rc != 0) { + goto __34 + } + Xsqlite3_result_error_code(tls, context, rc) +__34: +} + +// An SQL user-function registered to do the work of an DETACH statement. The +// three arguments to the function come directly from a detach statement: +// +// DETACH DATABASE x +// +// SELECT sqlite_detach(x) +func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:111810:13: */ + bp := tls.Alloc(152) + defer tls.Free(152) + + var zName uintptr + var db uintptr + var i int32 + var pDb uintptr + var pEntry uintptr + // var zErr [128]int8 at bp+24, 128 + + var pTrig uintptr + zName = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + db = Xsqlite3_context_db_handle(tls, context) + pDb = uintptr(0) + + _ = NotUsed + + if !(zName == uintptr(0)) { + goto __1 + } + zName = ts + 756 /* "" */ +__1: + ; + i = 0 +__2: + if !(i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __4 + } + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32) + if !((*Db)(unsafe.Pointer(pDb)).FpBt == uintptr(0)) { + goto __5 + } + goto __3 +__5: + ; + if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { + goto __6 + } + goto __4 +__6: + ; + goto __3 +__3: + i++ + goto __2 + goto __4 +__4: + ; + + if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __7 + } + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10596 /* "no such database..." */, libc.VaList(bp, zName)) + goto detach_error +__7: + ; + if !(i < 2) { + goto __8 + } + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10617 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + goto detach_error +__8: + ; + if !((Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != SQLITE_TXN_NONE) || + (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { + goto __9 + } + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10643 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + goto detach_error +__9: + ; + + // If any TEMP triggers reference the schema being detached, move those + // triggers to reference the TEMP schema itself. + + pEntry = (*Hash)(unsafe.Pointer(((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */))).Ffirst +__10: + if !(pEntry != 0) { + goto __11 + } + pTrig = (*HashElem)(unsafe.Pointer(pEntry)).Fdata + if !((*Trigger)(unsafe.Pointer(pTrig)).FpTabSchema == (*Db)(unsafe.Pointer(pDb)).FpSchema) { + goto __12 + } + (*Trigger)(unsafe.Pointer(pTrig)).FpTabSchema = (*Trigger)(unsafe.Pointer(pTrig)).FpSchema +__12: + ; + pEntry = (*HashElem)(unsafe.Pointer(pEntry)).Fnext + goto __10 +__11: + ; + + Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + (*Db)(unsafe.Pointer(pDb)).FpBt = uintptr(0) + (*Db)(unsafe.Pointer(pDb)).FpSchema = uintptr(0) + Xsqlite3CollapseDatabaseArray(tls, db) + return + +detach_error: + Xsqlite3_result_error(tls, context, bp+24 /* &zErr[0] */, -1) +} + +// This procedure generates VDBE code for a single invocation of either the +// sqlite_detach() or sqlite_attach() SQL user functions. +func codeAttach(tls *libc.TLS, pParse uintptr, type1 int32, pFunc uintptr, pAuthArg uintptr, pFilename uintptr, pDbname uintptr, pKey uintptr) { /* sqlite3.c:111872:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 + // var sName NameContext at bp, 56 + + var v uintptr + var db uintptr + var regArgs int32 + var zAuthArg uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __1 + } + goto attach_end +__1: + ; + libc.Xmemset(tls, bp /* &sName */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &sName */)).FpParse = pParse + + if !(((SQLITE_OK != (libc.AssignInt32(&rc, resolveAttachExpr(tls, bp /* &sName */, pFilename)))) || (SQLITE_OK != (libc.AssignInt32(&rc, resolveAttachExpr(tls, bp /* &sName */, pDbname))))) || (SQLITE_OK != (libc.AssignInt32(&rc, resolveAttachExpr(tls, bp /* &sName */, pKey))))) { + goto __2 + } + goto attach_end +__2: + ; + + if !(pAuthArg != 0) { + goto __3 + } + if !(int32((*Expr)(unsafe.Pointer(pAuthArg)).Fop) == TK_STRING) { + goto __4 + } + zAuthArg = *(*uintptr)(unsafe.Pointer(pAuthArg + 8 /* &.u */)) + goto __5 +__4: + zAuthArg = uintptr(0) +__5: + ; + rc = Xsqlite3AuthCheck(tls, pParse, type1, zAuthArg, uintptr(0), uintptr(0)) + if !(rc != SQLITE_OK) { + goto __6 + } + goto attach_end +__6: + ; +__3: + ; + + v = Xsqlite3GetVdbe(tls, pParse) + regArgs = Xsqlite3GetTempRange(tls, pParse, 4) + Xsqlite3ExprCode(tls, pParse, pFilename, regArgs) + Xsqlite3ExprCode(tls, pParse, pDbname, (regArgs + 1)) + Xsqlite3ExprCode(tls, pParse, pKey, (regArgs + 2)) + + if !(v != 0) { + goto __7 + } + Xsqlite3VdbeAddFunctionCall(tls, pParse, 0, ((regArgs + 3) - int32((*FuncDef)(unsafe.Pointer(pFunc)).FnArg)), (regArgs + 3), + int32((*FuncDef)(unsafe.Pointer(pFunc)).FnArg), pFunc, 0) + // Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this + // statement only). For DETACH, set it to false (expire all existing + // statements). + Xsqlite3VdbeAddOp1(tls, v, OP_Expire, (libc.Bool32(type1 == SQLITE_ATTACH))) +__7: + ; + +attach_end: + Xsqlite3ExprDelete(tls, db, pFilename) + Xsqlite3ExprDelete(tls, db, pDbname) + Xsqlite3ExprDelete(tls, db, pKey) +} + +// Called by the parser to compile a DETACH statement. +// +// DETACH pDbname +func Xsqlite3Detach(tls *libc.TLS, pParse uintptr, pDbname uintptr) { /* sqlite3.c:111943:21: */ + codeAttach(tls, pParse, SQLITE_DETACH, uintptr(unsafe.Pointer(&detach_func)), pDbname, uintptr(0), uintptr(0), pDbname) +} + +var detach_func = FuncDef{ + FnArg: int8(1), // nArg + FfuncFlags: U32(SQLITE_UTF8), // pNext + FxSFunc: 0, // xValue, xInverse + FzName: ts + 10665 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + +// Called by the parser to compile an ATTACH statement. +// +// ATTACH p AS pDbname KEY pKey +func Xsqlite3Attach(tls *libc.TLS, pParse uintptr, p uintptr, pDbname uintptr, pKey uintptr) { /* sqlite3.c:111963:21: */ + codeAttach(tls, pParse, SQLITE_ATTACH, uintptr(unsafe.Pointer(&attach_func)), p, p, pDbname, pKey) +} + +var attach_func = FuncDef{ + FnArg: int8(3), // nArg + FfuncFlags: U32(SQLITE_UTF8), // pNext + FxSFunc: 0, // xValue, xInverse + FzName: ts + 10679 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + +// Expression callback used by sqlite3FixAAAA() routines. +func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pFix uintptr = *(*uintptr)(unsafe.Pointer(p + 40 /* &.u */)) + if !(int32((*DbFixer)(unsafe.Pointer(pFix)).FbTemp) != 0) { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_FromDDL)) + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_VARIABLE { + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) + } else { + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10693 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + return WRC_Abort + } + } + return WRC_Continue +} + +// Select callback used by sqlite3FixAAAA() routines. +func fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) int32 { /* sqlite3.c:111999:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pFix uintptr = *(*uintptr)(unsafe.Pointer(p + 40 /* &.u */)) + var i int32 + var pItem uintptr + var db uintptr = (*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb + var iDb int32 = Xsqlite3FindDbName(tls, db, (*DbFixer)(unsafe.Pointer(pFix)).FzDb) + var pList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpSrc + + if pList == uintptr(0) { + return WRC_Continue + } + i = 0 + pItem = pList + 8 /* &.a */ +__1: + if !(i < (*SrcList)(unsafe.Pointer(pList)).FnSrc) { + goto __3 + } + { + if int32((*DbFixer)(unsafe.Pointer(pFix)).FbTemp) == 0 { + if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { + if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, + ts+10717, /* "%s %T cannot ref..." */ + libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) + return WRC_Abort + } + Xsqlite3DbFree(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) + (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase = uintptr(0) + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.notCte */, uint32(1), 8, 0x100) + } + (*SrcItem)(unsafe.Pointer(pItem)).FpSchema = (*DbFixer)(unsafe.Pointer(pFix)).FpSchema + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.fromDDL */, uint32(1), 6, 0x40) + } + if Xsqlite3WalkExpr(tls, (pFix+8 /* &.w */), (*SrcItem)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*112)).FpOn) != 0 { + return WRC_Abort + } + + } + goto __2 +__2: + i++ + pItem += 112 + goto __1 + goto __3 +__3: + ; + if (*Select)(unsafe.Pointer(pSelect)).FpWith != 0 { + for i = 0; i < (*With)(unsafe.Pointer((*Select)(unsafe.Pointer(pSelect)).FpWith)).FnCte; i++ { + if Xsqlite3WalkSelect(tls, p, (*Cte)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSelect)).FpWith+16 /* &.a */)+uintptr(i)*48)).FpSelect) != 0 { + return WRC_Abort + } + } + } + return WRC_Continue +} + +// Initialize a DbFixer structure. This routine must be called prior +// to passing the structure to one of the sqliteFixAAAA() routines below. +func Xsqlite3FixInit(tls *libc.TLS, pFix uintptr, pParse uintptr, iDb int32, zType uintptr, pName uintptr) { /* sqlite3.c:112042:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + (*DbFixer)(unsafe.Pointer(pFix)).FpParse = pParse + (*DbFixer)(unsafe.Pointer(pFix)).FzDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + (*DbFixer)(unsafe.Pointer(pFix)).FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + (*DbFixer)(unsafe.Pointer(pFix)).FzType = zType + (*DbFixer)(unsafe.Pointer(pFix)).FpName = pName + (*DbFixer)(unsafe.Pointer(pFix)).FbTemp = (U8(libc.Bool32(iDb == 1))) + (*DbFixer)(unsafe.Pointer(pFix)).Fw.FpParse = pParse + (*DbFixer)(unsafe.Pointer(pFix)).Fw.FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{fixExprCb})) + (*DbFixer)(unsafe.Pointer(pFix)).Fw.FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{fixSelectCb})) + (*DbFixer)(unsafe.Pointer(pFix)).Fw.FxSelectCallback2 = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3WalkWinDefnDummyCallback})) + (*DbFixer)(unsafe.Pointer(pFix)).Fw.FwalkerDepth = 0 + (*DbFixer)(unsafe.Pointer(pFix)).Fw.FeCode = U16(0) + *(*uintptr)(unsafe.Pointer(pFix + 8 /* &.w */ + 40 /* &.u */)) = pFix +} + +// The following set of routines walk through the parse tree and assign +// a specific database to all table references where the database name +// was left unspecified in the original SQL statement. The pFix structure +// must have been initialized by a prior call to sqlite3FixInit(). +// +// These routines are used to make sure that an index, trigger, or +// view in one database does not refer to objects in a different database. +// (Exception: indices, triggers, and views in the TEMP database are +// allowed to refer to anything.) If a reference is explicitly made +// to an object in a different database, an error message is added to +// pParse->zErrMsg and these routines return non-zero. If everything +// checks out, these routines return 0. +func Xsqlite3FixSrcList(tls *libc.TLS, pFix uintptr, pList uintptr) int32 { /* sqlite3.c:112080:20: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + var res int32 = 0 + if pList != 0 { + // var s Select at bp, 128 + + libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Select{}))) + (*Select)(unsafe.Pointer(bp /* &s */)).FpSrc = pList + res = Xsqlite3WalkSelect(tls, (pFix + 8 /* &.w */), bp /* &s */) + } + return res +} + +func Xsqlite3FixSelect(tls *libc.TLS, pFix uintptr, pSelect uintptr) int32 { /* sqlite3.c:112094:20: */ + return Xsqlite3WalkSelect(tls, (pFix + 8 /* &.w */), pSelect) +} + +func Xsqlite3FixExpr(tls *libc.TLS, pFix uintptr, pExpr uintptr) int32 { /* sqlite3.c:112100:20: */ + return Xsqlite3WalkExpr(tls, (pFix + 8 /* &.w */), pExpr) +} + +func Xsqlite3FixTriggerStep(tls *libc.TLS, pFix uintptr, pStep uintptr) int32 { /* sqlite3.c:112109:20: */ + for pStep != 0 { + if (((Xsqlite3WalkSelect(tls, (pFix+8 /* &.w */), (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect) != 0) || + (Xsqlite3WalkExpr(tls, (pFix+8 /* &.w */), (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere) != 0)) || + (Xsqlite3WalkExprList(tls, (pFix+8 /* &.w */), (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList) != 0)) || + (Xsqlite3FixSrcList(tls, pFix, (*TriggerStep)(unsafe.Pointer(pStep)).FpFrom) != 0) { + return 1 + } + { + var pUp uintptr + for pUp = (*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert; pUp != 0; pUp = (*Upsert)(unsafe.Pointer(pUp)).FpNextUpsert { + if (((Xsqlite3WalkExprList(tls, (pFix+8 /* &.w */), (*Upsert)(unsafe.Pointer(pUp)).FpUpsertTarget) != 0) || + (Xsqlite3WalkExpr(tls, (pFix+8 /* &.w */), (*Upsert)(unsafe.Pointer(pUp)).FpUpsertTargetWhere) != 0)) || + (Xsqlite3WalkExprList(tls, (pFix+8 /* &.w */), (*Upsert)(unsafe.Pointer(pUp)).FpUpsertSet) != 0)) || + (Xsqlite3WalkExpr(tls, (pFix+8 /* &.w */), (*Upsert)(unsafe.Pointer(pUp)).FpUpsertWhere) != 0) { + return 1 + } + } + + } + pStep = (*TriggerStep)(unsafe.Pointer(pStep)).FpNext + } + + return 0 +} + +//************* End of attach.c ********************************************* +//************* Begin file auth.c ******************************************* +// 2003 January 11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code used to implement the sqlite3_set_authorizer() +// API. This facility is an optional feature of the library. Embedded +// systems that do not need this facility may omit it by recompiling +// the library with -DSQLITE_OMIT_AUTHORIZATION=1 +// #include "sqliteInt.h" + +// All of the code in this file may be omitted by defining a single +// macro. + +// Set or clear the access authorization function. +// +// The access authorization function is be called during the compilation +// phase to verify that the user has read and/or write access permission on +// various fields of the database. The first argument to the auth function +// is a copy of the 3rd argument to this routine. The second argument +// to the auth function is one of these constants: +// +// SQLITE_CREATE_INDEX +// SQLITE_CREATE_TABLE +// SQLITE_CREATE_TEMP_INDEX +// SQLITE_CREATE_TEMP_TABLE +// SQLITE_CREATE_TEMP_TRIGGER +// SQLITE_CREATE_TEMP_VIEW +// SQLITE_CREATE_TRIGGER +// SQLITE_CREATE_VIEW +// SQLITE_DELETE +// SQLITE_DROP_INDEX +// SQLITE_DROP_TABLE +// SQLITE_DROP_TEMP_INDEX +// SQLITE_DROP_TEMP_TABLE +// SQLITE_DROP_TEMP_TRIGGER +// SQLITE_DROP_TEMP_VIEW +// SQLITE_DROP_TRIGGER +// SQLITE_DROP_VIEW +// SQLITE_INSERT +// SQLITE_PRAGMA +// SQLITE_READ +// SQLITE_SELECT +// SQLITE_TRANSACTION +// SQLITE_UPDATE +// +// The third and fourth arguments to the auth function are the name of +// the table and the column that are being accessed. The auth function +// should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE. If +// SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY +// means that the SQL statement will never-run - the sqlite3_exec() call +// will return with an error. SQLITE_IGNORE means that the SQL statement +// should run but attempts to read the specified column will return NULL +// and attempts to write the column will be ignored. +// +// Setting the auth function to NULL disables this hook. The default +// setting of the auth function is NULL. +func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uintptr) int32 { /* sqlite3.c:112213:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg = pArg + if (*Sqlite3)(unsafe.Pointer(db)).FxAuth != 0 { + Xsqlite3ExpirePreparedStatements(tls, db, 1) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// Write an error message into pParse->zErrMsg that explains that the +// user-supplied authorization function returned an illegal value. +func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ + Xsqlite3ErrorMsg(tls, pParse, ts+10763 /* "authorizer malfu..." */, 0) + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR +} + +// Invoke the authorization callback for permission to read column zCol from +// table zTab in database zDb. This function assumes that an authorization +// callback has been registered (i.e. that sqlite3.xAuth is not NULL). +// +// If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed +// to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE +// is treated as SQLITE_DENY. In this case an error is left in pParse. +func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintptr, iDb int32) int32 { /* sqlite3.c:112247:20: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName // Schema name of attached database + var rc int32 // Auth callback return code + + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + return SQLITE_OK + } + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) + if rc == SQLITE_DENY { + var z uintptr = Xsqlite3_mprintf(tls, ts+10786 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { + z = Xsqlite3_mprintf(tls, ts+10792 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + } + Xsqlite3ErrorMsg(tls, pParse, ts+10798 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH + } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { + sqliteAuthBadReturnCode(tls, pParse) + } + return rc +} + +// The pExpr should be a TK_COLUMN expression. The table referred to +// is in pTabList or else it is the NEW or OLD table of a trigger. +// Check to see if it is OK to read this particular column. +// +// If the auth function returns SQLITE_IGNORE, change the TK_COLUMN +// instruction into a TK_NULL. If the auth function returns SQLITE_DENY, +// then generate an error. +func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uintptr, pTabList uintptr) { /* sqlite3.c:112283:21: */ + var pTab uintptr = uintptr(0) // The table being read + var zCol uintptr // Name of the column of the table + var iSrc int32 // Index in pTabList->a[] of table being read + var iDb int32 // The index of the database the expression refers to + var iCol int32 // Index of column in table + + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pSchema) + if iDb < 0 { + // An attempt to read a column out of a subquery or other + // temporary table. + return + } + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_TRIGGER { + pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab + } else { + + for iSrc = 0; iSrc < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc; iSrc++ { + if (*Expr)(unsafe.Pointer(pExpr)).FiTable == (*SrcItem)(unsafe.Pointer((pTabList+8 /* &.a */)+uintptr(iSrc)*112)).FiCursor { + pTab = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */) + uintptr(iSrc)*112)).FpTab + break + } + } + } + iCol = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + if pTab == uintptr(0) { + return + } + + if iCol >= 0 { + + zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName + } else if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { + + zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName + } else { + zCol = ts + 6689 /* "ROWID" */ + } + + if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) + } +} + +// Do an authorization check using the code and arguments given. Return +// either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY. If SQLITE_DENY +// is returned, then the error count and error message in pParse are +// modified appropriately. +func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, zArg2 uintptr, zArg3 uintptr) int32 { /* sqlite3.c:112340:20: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var rc int32 + + // Don't do any authorization checks if the database is initialising + // or if the parser is being invoked from within sqlite3_declare_vtab. + + if (((*Sqlite3)(unsafe.Pointer(db)).FxAuth == uintptr(0)) || ((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0)) || (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL) { + return SQLITE_OK + } + + // EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the + // callback are either NULL pointers or zero-terminated strings that + // contain additional details about the action to be authorized. + // + // The following testcase() macros show that any of the 3rd through 6th + // parameters can be either NULL or a string. + + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) + if rc == SQLITE_DENY { + Xsqlite3ErrorMsg(tls, pParse, ts+10825 /* "not authorized" */, 0) + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH + } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { + rc = SQLITE_DENY + sqliteAuthBadReturnCode(tls, pParse) + } + return rc +} + +// Push an authorization context. After this routine is called, the +// zArg3 argument to authorization callbacks will be zContext until +// popped. Or if pParse==0, this routine is a no-op. +func Xsqlite3AuthContextPush(tls *libc.TLS, pParse uintptr, pContext uintptr, zContext uintptr) { /* sqlite3.c:112389:21: */ + + (*AuthContext)(unsafe.Pointer(pContext)).FpParse = pParse + (*AuthContext)(unsafe.Pointer(pContext)).FzAuthContext = (*Parse)(unsafe.Pointer(pParse)).FzAuthContext + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = zContext +} + +// Pop an authorization context that was previously pushed +// by sqlite3AuthContextPush +func Xsqlite3AuthContextPop(tls *libc.TLS, pContext uintptr) { /* sqlite3.c:112404:21: */ + if (*AuthContext)(unsafe.Pointer(pContext)).FpParse != 0 { + (*Parse)(unsafe.Pointer((*AuthContext)(unsafe.Pointer(pContext)).FpParse)).FzAuthContext = (*AuthContext)(unsafe.Pointer(pContext)).FzAuthContext + (*AuthContext)(unsafe.Pointer(pContext)).FpParse = uintptr(0) + } +} + +// Record the fact that we want to lock a table at run-time. +// +// The table to be locked has root page iTab and is found in database iDb. +// A read or a write lock can be taken depending on isWritelock. +// +// This routine just records the fact that the lock is desired. The +// code to make the lock occur is generated by a later call to +// codeTableLocks() which occurs during sqlite3FinishCoding(). +func lockTable(tls *libc.TLS, pParse uintptr, iDb int32, iTab Pgno, isWriteLock U8, zName uintptr) { /* sqlite3.c:112463:29: */ + var pToplevel uintptr + var i int32 + var nBytes int32 + var p uintptr + + pToplevel = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + for i = 0; i < (*Parse)(unsafe.Pointer(pToplevel)).FnTableLock; i++ { + p = ((*Parse)(unsafe.Pointer(pToplevel)).FaTableLock + uintptr(i)*24) + if ((*TableLock)(unsafe.Pointer(p)).FiDb == iDb) && ((*TableLock)(unsafe.Pointer(p)).FiTab == iTab) { + (*TableLock)(unsafe.Pointer(p)).FisWriteLock = (U8(libc.Bool32(((*TableLock)(unsafe.Pointer(p)).FisWriteLock != 0) || (isWriteLock != 0)))) + return + } + } + + nBytes = (int32(uint64(unsafe.Sizeof(TableLock{})) * (uint64((*Parse)(unsafe.Pointer(pToplevel)).FnTableLock + 1)))) + (*Parse)(unsafe.Pointer(pToplevel)).FaTableLock = Xsqlite3DbReallocOrFree(tls, (*Parse)(unsafe.Pointer(pToplevel)).Fdb, (*Parse)(unsafe.Pointer(pToplevel)).FaTableLock, uint64(nBytes)) + if (*Parse)(unsafe.Pointer(pToplevel)).FaTableLock != 0 { + p = ((*Parse)(unsafe.Pointer(pToplevel)).FaTableLock + uintptr(libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pToplevel)).FnTableLock, 1))*24) + (*TableLock)(unsafe.Pointer(p)).FiDb = iDb + (*TableLock)(unsafe.Pointer(p)).FiTab = iTab + (*TableLock)(unsafe.Pointer(p)).FisWriteLock = isWriteLock + (*TableLock)(unsafe.Pointer(p)).FzLockName = zName + } else { + (*Parse)(unsafe.Pointer(pToplevel)).FnTableLock = 0 + Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pToplevel)).Fdb) + } +} + +func Xsqlite3TableLock(tls *libc.TLS, pParse uintptr, iDb int32, iTab Pgno, isWriteLock U8, zName uintptr) { /* sqlite3.c:112499:21: */ + if iDb == 1 { + return + } + if !(Xsqlite3BtreeSharable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FpBt) != 0) { + return + } + lockTable(tls, pParse, iDb, iTab, isWriteLock, zName) +} + +// Code an OP_TableLock instruction for each table locked by the +// statement (configured by calls to sqlite3TableLock()). +func codeTableLocks(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112515:13: */ + var i int32 + var pVdbe uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + for i = 0; i < (*Parse)(unsafe.Pointer(pParse)).FnTableLock; i++ { + var p uintptr = ((*Parse)(unsafe.Pointer(pParse)).FaTableLock + uintptr(i)*24) + var p1 int32 = (*TableLock)(unsafe.Pointer(p)).FiDb + Xsqlite3VdbeAddOp4(tls, pVdbe, OP_TableLock, p1, int32((*TableLock)(unsafe.Pointer(p)).FiTab), int32((*TableLock)(unsafe.Pointer(p)).FisWriteLock), + (*TableLock)(unsafe.Pointer(p)).FzLockName, -1) + } +} + +// Return TRUE if the given yDbMask object is empty - if it contains no +// 1 bits. This routine is used by the DbMaskAllZero() and DbMaskNotZero() +// macros when SQLITE_MAX_ATTACHED is greater than 30. + +// This routine is called after a single SQL statement has been +// parsed and a VDBE program to execute that statement has been +// prepared. This routine puts the finishing touches on the +// VDBE program and resets the pParse structure for the next +// parse. +// +// Note that if an error occurred, it might be the case that +// no VDBE code was generated. +func Xsqlite3FinishCoding(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112554:21: */ + var db uintptr + var v uintptr + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (*Parse)(unsafe.Pointer(pParse)).Fnested != 0 { + return + } + if ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) || ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + if (*Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + } + return + } + + // Begin by generating some termination code at the end of the + // vdbe program + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + if v == uintptr(0) { + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_DONE + return + } + v = Xsqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + } + } + + if v != 0 { + if (*Parse)(unsafe.Pointer(pParse)).FbReturning != 0 { + var pReturning uintptr = *(*uintptr)(unsafe.Pointer(pParse + 184 /* &.u1 */)) + var addrRewind int32 + var i int32 + var reg int32 + + addrRewind = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, (*Returning)(unsafe.Pointer(pReturning)).FiRetCur) + + reg = (*Returning)(unsafe.Pointer(pReturning)).FiRetReg + for i = 0; i < (*Returning)(unsafe.Pointer(pReturning)).FnRetCol; i++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, (*Returning)(unsafe.Pointer(pReturning)).FiRetCur, i, (reg + i)) + } + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, reg, i) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, (*Returning)(unsafe.Pointer(pReturning)).FiRetCur, (addrRewind + 1)) + + Xsqlite3VdbeJumpHere(tls, v, addrRewind) + } + Xsqlite3VdbeAddOp0(tls, v, OP_Halt) + + // The cookie mask contains one bit for each database file open. + // (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are + // set for each database that is used. Generate code to start a + // transaction on each used database and to verify the schema cookie + // on each used database. + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && + ((((*Parse)(unsafe.Pointer(pParse)).FcookieMask) != YDbMask(0)) || ((*Parse)(unsafe.Pointer(pParse)).FpConstExpr != 0)) { + var iDb int32 + var i int32 + + Xsqlite3VdbeJumpHere(tls, v, 0) + for iDb = 0; iDb < (*Sqlite3)(unsafe.Pointer(db)).FnDb; iDb++ { + var pSchema uintptr + if (libc.Bool32((((*Parse)(unsafe.Pointer(pParse)).FcookieMask) & (YDbMask((YDbMask(1))) << (iDb))) != YDbMask(0))) == 0 { + continue + } + Xsqlite3VdbeUsesBtree(tls, v, iDb) + pSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + Xsqlite3VdbeAddOp4Int(tls, v, + OP_Transaction, // Opcode + iDb, // P1 + (libc.Bool32((((*Parse)(unsafe.Pointer(pParse)).FwriteMask) & (YDbMask((YDbMask(1))) << (iDb))) != YDbMask(0))), // P2 + (*Schema)(unsafe.Pointer(pSchema)).Fschema_cookie, // P3 + (*Schema)(unsafe.Pointer(pSchema)).FiGeneration) + if int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0 { + Xsqlite3VdbeChangeP5(tls, v, uint16(1)) + } + + } + for i = 0; i < (*Parse)(unsafe.Pointer(pParse)).FnVtabLock; i++ { + var vtab uintptr = Xsqlite3GetVTable(tls, db, *(*uintptr)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).FapVtabLock + uintptr(i)*8))) + Xsqlite3VdbeAddOp4(tls, v, OP_VBegin, 0, 0, 0, vtab, -12) + } + (*Parse)(unsafe.Pointer(pParse)).FnVtabLock = 0 + + // Once all the cookies have been verified and transactions opened, + // obtain the required table-locks. This is a no-op unless the + // shared-cache feature is enabled. + codeTableLocks(tls, pParse) + + // Initialize any AUTOINCREMENT data structures required. + Xsqlite3AutoincrementBegin(tls, pParse) + + // Code constant expressions that where factored out of inner loops. + // + // The pConstExpr list might also contain expressions that we simply + // want to keep around until the Parse object is deleted. Such + // expressions have iConstExprReg==0. Do not generate code for + // those expressions, of course. + if (*Parse)(unsafe.Pointer(pParse)).FpConstExpr != 0 { + var pEL uintptr = (*Parse)(unsafe.Pointer(pParse)).FpConstExpr + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = U8(0) + for i = 0; i < (*ExprList)(unsafe.Pointer(pEL)).FnExpr; i++ { + var iReg int32 = *(*int32)(unsafe.Pointer((pEL + 8 /* &.a */) + uintptr(i)*32 + 24 /* &.u */)) + if iReg > 0 { + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pEL+8 /* &.a */)+uintptr(i)*32)).FpExpr, iReg) + } + } + } + + if (*Parse)(unsafe.Pointer(pParse)).FbReturning != 0 { + var pRet uintptr = *(*uintptr)(unsafe.Pointer(pParse + 184 /* &.u1 */)) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*Returning)(unsafe.Pointer(pRet)).FiRetCur, (*Returning)(unsafe.Pointer(pRet)).FnRetCol) + } + + // Finally, jump back to the beginning of the executable code. + Xsqlite3VdbeGoto(tls, v, 1) + } + } + + // Get the VDBE program ready for execution + if ((v != 0) && ((*Parse)(unsafe.Pointer(pParse)).FnErr == 0)) && !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + // A minimum of one cursor is required if autoincrement is used + // See ticket [a696379c1f08866] + + Xsqlite3VdbeMakeReady(tls, v, pParse) + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_DONE + } else { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + } +} + +// Run the parser and code generator recursively in order to generate +// code for the SQL statement given onto the end of the pParse context +// currently under construction. When the parser is run recursively +// this way, the final OP_Halt is not appended and other initialization +// and finalization steps are omitted because those are handling by the +// outermost parser. +// +// Not everything is nestable. This facility is designed to permit +// INSERT, UPDATE, and DELETE operations against the schema table. Use +// care if you decide to try to use this routine for some other purposes. +func Xsqlite3NestedParse(tls *libc.TLS, pParse uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:112711:21: */ + bp := tls.Alloc(160) + defer tls.Free(160) + + var ap Va_list + _ = ap + var zSql uintptr + *(*uintptr)(unsafe.Pointer(bp + 152 /* zErrMsg */)) = uintptr(0) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + // var saveBuf [152]int8 at bp, 152 + + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + // Nesting should only be of limited depth + ap = va + zSql = Xsqlite3VMPrintf(tls, db, zFormat, ap) + _ = ap + if zSql == uintptr(0) { + // This can result either from an OOM or because the formatted string + // exceeds SQLITE_LIMIT_LENGTH. In the latter case, we need to set + // an error + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_TOOBIG + } + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + return + } + (*Parse)(unsafe.Pointer(pParse)).Fnested++ + libc.Xmemcpy(tls, bp /* &saveBuf[0] */, ((pParse) + uintptr((uint64((uintptr(0) + 256 /* &.sLastToken */))))), (uint64(unsafe.Sizeof(Parse{})) - (uint64((uintptr(0) + 256 /* &.sLastToken */))))) + libc.Xmemset(tls, ((pParse) + uintptr((uint64((uintptr(0) + 256 /* &.sLastToken */))))), 0, (uint64(unsafe.Sizeof(Parse{})) - (uint64((uintptr(0) + 256 /* &.sLastToken */))))) + Xsqlite3RunParser(tls, pParse, zSql, bp+152 /* &zErrMsg */) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 152 /* zErrMsg */))) + Xsqlite3DbFree(tls, db, zSql) + libc.Xmemcpy(tls, ((pParse) + uintptr((uint64((uintptr(0) + 256 /* &.sLastToken */))))), bp /* &saveBuf[0] */, (uint64(unsafe.Sizeof(Parse{})) - (uint64((uintptr(0) + 256 /* &.sLastToken */))))) + (*Parse)(unsafe.Pointer(pParse)).Fnested-- +} + +// Locate the in-memory structure that describes a particular database +// table given the name of that table and (optionally) the name of the +// database containing the table. Return NULL if not found. +// +// If zDatabase is 0, all databases are searched for the table and the +// first matching table is returned. (No checking for duplicate table +// names is done.) The search order is TEMP first, then MAIN, then any +// auxiliary databases added using the ATTACH command. +// +// See also sqlite3LocateTable(). +func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintptr) uintptr { /* sqlite3.c:112763:22: */ + var p uintptr = uintptr(0) + var i int32 + + // All mutexes are required for schema access. Make sure we hold them. + + if zDatabase != 0 { + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + if Xsqlite3StrICmp(tls, zDatabase, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FzDbSName) == 0 { + break + } + } + if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { + // No match against the official names. But always match "main" + // to schema 0 as a legacy fallback. + if Xsqlite3StrICmp(tls, zDatabase, ts+5459 /* "main" */) == 0 { + i = 0 + } else { + return uintptr(0) + } + } + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7082 /* "sqlite_" */, 7) == 0) { + if i == 1 { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10840 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10859 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4957 /* "sqlite_master" */ +7)) == 0) { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), + ts+10873 /* "sqlite_temp_mast..." */) + } + } else { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10859 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), + ts+4957 /* "sqlite_master" */) + } + } + } + } else { + // Match against TEMP first + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), zName) + if p != 0 { + return p + } + // The main database is second + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), zName) + if p != 0 { + return p + } + // Attached databases are in order of attachment + for i = 2; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) + if p != 0 { + break + } + } + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7082 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10859 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4957 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10840 /* "sqlite_temp_sche..." */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), + ts+10873 /* "sqlite_temp_mast..." */) + } + } + } + return p +} + +// Locate the in-memory structure that describes a particular database +// table given the name of that table and (optionally) the name of the +// database containing the table. Return NULL if not found. Also leave an +// error message in pParse->zErrMsg. +// +// The difference between this routine and sqlite3FindTable() is that this +// routine leaves an error message in pParse->zErrMsg where +// sqlite3FindTable() does not. +func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr, zDbase uintptr) uintptr { /* sqlite3.c:112841:22: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var p uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + // Read the database schema. If an error occurs, leave an error message + // and code in pParse and return NULL. + if (((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_SchemaKnownOk)) == U32(0)) && + (SQLITE_OK != Xsqlite3ReadSchema(tls, pParse)) { + return uintptr(0) + } + + p = Xsqlite3FindTable(tls, db, zName, zDbase) + if p == uintptr(0) { + // If zName is the not the name of a table in the schema created using + // CREATE, then check to see if it is the name of an virtual table that + // can be an eponymous virtual table. + if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { + var pMod uintptr = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zName) + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10892 /* "pragma_" */, 7) == 0) { + pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) + } + if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { + return (*Module)(unsafe.Pointer(pMod)).FpEpoTab + } + } + if (flags & U32(LOCATE_NOERR)) != 0 { + return uintptr(0) + } + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + } else if ((*Table)(unsafe.Pointer(p)).FnModuleArg != 0) && ((*Parse)(unsafe.Pointer(pParse)).FdisableVtab != 0) { + p = uintptr(0) + } + + if p == uintptr(0) { + var zMsg uintptr + if (flags & U32(LOCATE_VIEW)) != 0 { + zMsg = ts + 10900 /* "no such view" */ + } else { + zMsg = ts + 10913 /* "no such table" */ + } + if zDbase != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+5652 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + } else { + Xsqlite3ErrorMsg(tls, pParse, ts+5662 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + } + } else { + + } + + return p +} + +// Locate the table identified by *p. +// +// This is a wrapper around sqlite3LocateTable(). The difference between +// sqlite3LocateTable() and this function is that this function restricts +// the search to schema (p->pSchema) if it is not NULL. p->pSchema may be +// non-NULL if it is part of a view or trigger program definition. See +// sqlite3FixSrcList() for details. +func Xsqlite3LocateTableItem(tls *libc.TLS, pParse uintptr, flags U32, p uintptr) uintptr { /* sqlite3.c:112903:22: */ + var zDb uintptr + + if (*SrcItem)(unsafe.Pointer(p)).FpSchema != 0 { + var iDb int32 = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(p)).FpSchema) + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32)).FzDbSName + } else { + zDb = (*SrcItem)(unsafe.Pointer(p)).FzDatabase + } + return Xsqlite3LocateTable(tls, pParse, flags, (*SrcItem)(unsafe.Pointer(p)).FzName, zDb) +} + +// Locate the in-memory structure that describes +// a particular index given the name of that index +// and the name of the database that contains the index. +// Return NULL if not found. +// +// If zDatabase is 0, all databases are searched for the +// table and the first matching index is returned. (No checking +// for duplicate index names is done.) The search order is +// TEMP first, then MAIN, then any auxiliary databases added +// using the ATTACH command. +func Xsqlite3FindIndex(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr) uintptr { /* sqlite3.c:112931:22: */ + var p uintptr = uintptr(0) + var i int32 + // All mutexes are required for schema access. Make sure we hold them. + + for i = OMIT_TEMPDB; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var j int32 + if i < 2 { + j = (i ^ 1) + } else { + j = i + } // Search TEMP before MAIN + var pSchema uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32)).FpSchema + + if (zDb != 0) && (Xsqlite3DbIsNamed(tls, db, j, zDb) == 0) { + continue + } + + p = Xsqlite3HashFind(tls, (pSchema + 32 /* &.idxHash */), zName) + if p != 0 { + break + } + } + return p +} + +// Reclaim the memory used by an index +func Xsqlite3FreeIndex(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:112951:21: */ + Xsqlite3DeleteIndexSamples(tls, db, p) + Xsqlite3ExprDelete(tls, db, (*Index)(unsafe.Pointer(p)).FpPartIdxWhere) + Xsqlite3ExprListDelete(tls, db, (*Index)(unsafe.Pointer(p)).FaColExpr) + Xsqlite3DbFree(tls, db, (*Index)(unsafe.Pointer(p)).FzColAff) + if (uint32(int32(*(*uint16)(unsafe.Pointer(p + 100 /* &.isResized */)) & 0x10 >> 4))) != 0 { + Xsqlite3DbFree(tls, db, (*Index)(unsafe.Pointer(p)).FazColl) + } + Xsqlite3_free(tls, (*Index)(unsafe.Pointer(p)).FaiRowEst) + Xsqlite3DbFree(tls, db, p) +} + +// For the index called zIdxName which is found in the database iDb, +// unlike that index from its Table then remove the index from +// the index hash table and free all memory structures associated +// with the index. +func Xsqlite3UnlinkAndDeleteIndex(tls *libc.TLS, db uintptr, iDb int32, zIdxName uintptr) { /* sqlite3.c:112971:21: */ + var pIndex uintptr + var pHash uintptr + + pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema + 32 /* &.idxHash */) + pIndex = Xsqlite3HashInsert(tls, pHash, zIdxName, uintptr(0)) + if pIndex != 0 { + if (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FpTable)).FpIndex == pIndex { + (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FpTable)).FpIndex = (*Index)(unsafe.Pointer(pIndex)).FpNext + } else { + var p uintptr + // Justification of ALWAYS(); The index must be on the list of + // indices. + p = (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FpTable)).FpIndex + for (p != 0) && ((*Index)(unsafe.Pointer(p)).FpNext != pIndex) { + p = (*Index)(unsafe.Pointer(p)).FpNext + } + if (p != 0) && ((*Index)(unsafe.Pointer(p)).FpNext == pIndex) { + (*Index)(unsafe.Pointer(p)).FpNext = (*Index)(unsafe.Pointer(pIndex)).FpNext + } + } + Xsqlite3FreeIndex(tls, db, pIndex) + } + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) +} + +// Look through the list of open database files in db->aDb[] and if +// any have been closed, remove them from the list. Reallocate the +// db->aDb[] structure to a smaller size, if possible. +// +// Entry 0 (the "main" database) and entry 1 (the "temp" database) +// are never candidates for being collapsed. +func Xsqlite3CollapseDatabaseArray(tls *libc.TLS, db uintptr) { /* sqlite3.c:113004:21: */ + var i int32 + var j int32 + for i = libc.AssignInt32(&j, 2); i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32) + if (*Db1)(unsafe.Pointer(pDb)).FpBt == uintptr(0) { + Xsqlite3DbFree(tls, db, (*Db1)(unsafe.Pointer(pDb)).FzDbSName) + (*Db1)(unsafe.Pointer(pDb)).FzDbSName = uintptr(0) + continue + } + if j < i { + *(*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32)) = *(*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)) + } + j++ + } + (*Sqlite3)(unsafe.Pointer(db)).FnDb = j + if ((*Sqlite3)(unsafe.Pointer(db)).FnDb <= 2) && ((*Sqlite3)(unsafe.Pointer(db)).FaDb != db+656 /* &.aDbStatic */) { + libc.Xmemcpy(tls, db+656 /* &.aDbStatic */, (*Sqlite3)(unsafe.Pointer(db)).FaDb, (uint64(2) * uint64(unsafe.Sizeof(Db{})))) + Xsqlite3DbFree(tls, db, (*Sqlite3)(unsafe.Pointer(db)).FaDb) + (*Sqlite3)(unsafe.Pointer(db)).FaDb = db + 656 /* &.aDbStatic */ + } +} + +// Reset the schema for the database at index iDb. Also reset the +// TEMP schema. The reset is deferred if db->nSchemaLock is not zero. +// Deferred resets may be run by calling with iDb<0. +func Xsqlite3ResetOneSchema(tls *libc.TLS, db uintptr, iDb int32) { /* sqlite3.c:113031:21: */ + var i int32 + + if iDb >= 0 { + + *(*U16)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(iDb)*32)).FpSchema + 114 /* &.schemaFlags */)) |= U16((DB_ResetWanted)) + *(*U16)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+1*32)).FpSchema + 114 /* &.schemaFlags */)) |= U16((DB_ResetWanted)) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_SchemaKnownOk))) + } + + if (*Sqlite3)(unsafe.Pointer(db)).FnSchemaLock == U32(0) { + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + if (int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(i)*32)).FpSchema)).FschemaFlags) & (DB_ResetWanted)) == (DB_ResetWanted) { + Xsqlite3SchemaClear(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema) + } + } + } +} + +// Erase all schema information from all attached databases (including +// "main" and "temp") for a single database connection. +func Xsqlite3ResetAllSchemasOfConnection(tls *libc.TLS, db uintptr) { /* sqlite3.c:113055:21: */ + var i int32 + Xsqlite3BtreeEnterAll(tls, db) + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32) + if (*Db)(unsafe.Pointer(pDb)).FpSchema != 0 { + if (*Sqlite3)(unsafe.Pointer(db)).FnSchemaLock == U32(0) { + Xsqlite3SchemaClear(tls, (*Db)(unsafe.Pointer(pDb)).FpSchema) + } else { + *(*U16)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(i)*32)).FpSchema + 114 /* &.schemaFlags */)) |= U16((DB_ResetWanted)) + } + } + } + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32((DBFLAG_SchemaChange | DBFLAG_SchemaKnownOk)))) + Xsqlite3VtabUnlockList(tls, db) + Xsqlite3BtreeLeaveAll(tls, db) + if (*Sqlite3)(unsafe.Pointer(db)).FnSchemaLock == U32(0) { + Xsqlite3CollapseDatabaseArray(tls, db) + } +} + +// This routine is called when a commit occurs. +func Xsqlite3CommitInternalChanges(tls *libc.TLS, db uintptr) { /* sqlite3.c:113079:21: */ + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_SchemaChange))) +} + +// Delete memory allocated for the column names of a table or view (the +// Table.aCol[] array). +func Xsqlite3DeleteColumnNames(tls *libc.TLS, db uintptr, pTable uintptr) { /* sqlite3.c:113087:21: */ + var i int32 + var pCol uintptr + + if (libc.AssignUintptr(&pCol, (*Table)(unsafe.Pointer(pTable)).FaCol)) != uintptr(0) { + i = 0 + __1: + if !(i < int32((*Table)(unsafe.Pointer(pTable)).FnCol)) { + goto __3 + } + { + + Xsqlite3DbFree(tls, db, (*Column)(unsafe.Pointer(pCol)).FzName) + Xsqlite3ExprDelete(tls, db, (*Column)(unsafe.Pointer(pCol)).FpDflt) + Xsqlite3DbFree(tls, db, (*Column)(unsafe.Pointer(pCol)).FzColl) + + } + goto __2 + __2: + i++ + pCol += 32 + goto __1 + goto __3 + __3: + ; + Xsqlite3DbFree(tls, db, (*Table)(unsafe.Pointer(pTable)).FaCol) + } +} + +// Remove the memory data structures associated with the given +// Table. No changes are made to disk by this routine. +// +// This routine just deletes the data structure. It does not unlink +// the table data structure from the hash table. But it does destroy +// memory structures of the indices and foreign keys associated with +// the table. +// +// The db parameter is optional. It is needed if the Table object +// contains lookaside memory. (Table objects in the schema do not use +// lookaside memory, but some ephemeral Table objects do.) Or the +// db parameter can be used with db->pnBytesFreed to measure the memory +// used by the Table object. +func deleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { /* sqlite3.c:113117:29: */ + var pIndex uintptr + var pNext uintptr + + // Delete all indices associated with this table. + for pIndex = (*Table)(unsafe.Pointer(pTable)).FpIndex; pIndex != 0; pIndex = pNext { + pNext = (*Index)(unsafe.Pointer(pIndex)).FpNext + + if ((db == uintptr(0)) || ((*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0))) && !((*Table)(unsafe.Pointer(pTable)).FnModuleArg != 0) { + var zName uintptr = (*Index)(unsafe.Pointer(pIndex)).FzName + Xsqlite3HashInsert(tls, + ((*Index)(unsafe.Pointer(pIndex)).FpSchema + 32 /* &.idxHash */), zName, uintptr(0)) + + } + Xsqlite3FreeIndex(tls, db, pIndex) + } + + // Delete any foreign keys attached to this table. + Xsqlite3FkDelete(tls, db, pTable) + + // Delete the Table structure itself. + Xsqlite3DeleteColumnNames(tls, db, pTable) + Xsqlite3DbFree(tls, db, (*Table)(unsafe.Pointer(pTable)).FzName) + Xsqlite3DbFree(tls, db, (*Table)(unsafe.Pointer(pTable)).FzColAff) + Xsqlite3SelectDelete(tls, db, (*Table)(unsafe.Pointer(pTable)).FpSelect) + Xsqlite3ExprListDelete(tls, db, (*Table)(unsafe.Pointer(pTable)).FpCheck) + Xsqlite3VtabClear(tls, db, pTable) + Xsqlite3DbFree(tls, db, pTable) + + // Verify that no lookaside memory was used by schema tables + +} + +func Xsqlite3DeleteTable(tls *libc.TLS, db uintptr, pTable uintptr) { /* sqlite3.c:113168:21: */ + // Do not delete the table until the reference count reaches zero. + if !(pTable != 0) { + return + } + if (!(db != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0))) && ((libc.PreDecUint32(&(*Table)(unsafe.Pointer(pTable)).FnTabRef, 1)) > U32(0)) { + return + } + deleteTable(tls, db, pTable) +} + +// Unlink the given table from the hash tables and the delete the +// table structure with all its indices and foreign keys. +func Xsqlite3UnlinkAndDeleteTable(tls *libc.TLS, db uintptr, iDb int32, zTabName uintptr) { /* sqlite3.c:113180:21: */ + var p uintptr + var pDb uintptr + + // Zero-length table names are allowed + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + p = Xsqlite3HashInsert(tls, ((*Db)(unsafe.Pointer(pDb)).FpSchema + 8 /* &.tblHash */), zTabName, uintptr(0)) + Xsqlite3DeleteTable(tls, db, p) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) +} + +// Given a token, return a string that consists of the text of that +// token. Space to hold the returned string +// is obtained from sqliteMalloc() and must be freed by the calling +// function. +// +// Any quotation marks (ex: "name", 'name', [name], or `name`) that +// surround the body of the token are removed. +// +// Tokens are often just pointers into the original SQL text and so +// are not \000 terminated and are not persistent. The returned string +// is \000 terminated and is persistent. +func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { /* sqlite3.c:113208:21: */ + var zName uintptr + if pName != 0 { + zName = Xsqlite3DbStrNDup(tls, db, (*Token)(unsafe.Pointer(pName)).Fz, uint64((*Token)(unsafe.Pointer(pName)).Fn)) + Xsqlite3Dequote(tls, zName) + } else { + zName = uintptr(0) + } + return zName +} + +// Open the sqlite_schema table stored in database number iDb for +// writing. The table is opened using cursor 0. +func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ + var v uintptr = Xsqlite3GetVdbe(tls, p) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4957 /* "sqlite_master" */) + Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) + if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { + (*Parse)(unsafe.Pointer(p)).FnTab = 1 + } +} + +// Parameter zName points to a nul-terminated buffer containing the name +// of a database ("main", "temp" or the name of an attached db). This +// function returns the index of the named database in db->aDb[], or +// -1 if the named db cannot be found. +func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sqlite3.c:113238:20: */ + var i int32 = -1 // Database number + if zName != 0 { + var pDb uintptr + i = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32) + __1: + if !(i >= 0) { + goto __3 + } + { + if 0 == Xsqlite3_stricmp(tls, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zName) { + goto __3 + } + // "main" is always an acceptable alias for the primary database + // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5459 /* "main" */, zName)) { + goto __3 + } + + } + goto __2 + __2: + i-- + pDb -= 32 + goto __1 + goto __3 + __3: + } + return i +} + +// The token *pName contains the name of a database (either "main" or +// "temp" or the name of an attached db). This routine returns the +// index of the named database in db->aDb[], or -1 if the named db +// does not exist. +func Xsqlite3FindDb(tls *libc.TLS, db uintptr, pName uintptr) int32 { /* sqlite3.c:113258:20: */ + var i int32 // Database number + var zName uintptr // Name we are searching for + zName = Xsqlite3NameFromToken(tls, db, pName) + i = Xsqlite3FindDbName(tls, db, zName) + Xsqlite3DbFree(tls, db, zName) + return i +} + +// The table or view or trigger name is passed to this routine via tokens +// pName1 and pName2. If the table name was fully qualified, for example: +// +// CREATE TABLE xxx.yyy (...); +// +// Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if +// the table name is not fully qualified, i.e.: +// +// CREATE TABLE yyy(...); +// +// Then pName1 is set to "yyy" and pName2 is "". +// +// This routine sets the *ppUnqual pointer to point at the token (pName1 or +// pName2) that stores the unqualified table name. The index of the +// database "xxx" is returned. +func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pUnqual uintptr) int32 { /* sqlite3.c:113283:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var iDb int32 // Database holding the object + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+10927 /* "corrupt database" */, 0) + return -1 + } + *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 + iDb = Xsqlite3FindDb(tls, db, pName1) + if iDb < 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+10944 /* "unknown database..." */, libc.VaList(bp, pName1)) + return -1 + } + } else { + + iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) + *(*uintptr)(unsafe.Pointer(pUnqual)) = pName1 + } + return iDb +} + +// True if PRAGMA writable_schema is ON +func Xsqlite3WritableSchema(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:113316:20: */ + + return (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & (uint64(SQLITE_WriteSchema | SQLITE_Defensive))) == uint64(SQLITE_WriteSchema))) +} + +// This routine is used to check if the UTF-8 string zName is a legal +// unqualified name for a new schema object (table, index, view or +// trigger). All names are legal except those that begin with the string +// "sqlite_" (in upper, lower or mixed case). This portion of the namespace +// is reserved for internal use. +// +// When parsing the sqlite_schema table, this routine also checks to +// make sure the "type", "name", and "tbl_name" columns are consistent +// with the SQL. +func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType uintptr, zTblName uintptr) int32 { /* sqlite3.c:113338:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if ((Xsqlite3WritableSchema(tls, db) != 0) || + ((uint32(int32(*(*uint8)(unsafe.Pointer((db + 184 /* &.init */) + 8 /* &.imposterTable */)) & 0x2 >> 1))) != 0)) || + !(int32(Xsqlite3Config.FbExtraSchemaChecks) != 0) { + // Skip these error checks for writable_schema=ON + return SQLITE_OK + } + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || + (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*8))) != 0)) || + (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*8))) != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+756 /* "" */, 0) // corruptSchema() will supply the error + return SQLITE_ERROR + } + } else { + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7082 /* "sqlite_" */, 7))) || + ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { + Xsqlite3ErrorMsg(tls, pParse, ts+10964, /* "object name rese..." */ + libc.VaList(bp, zName)) + return SQLITE_ERROR + } + + } + return SQLITE_OK +} + +// Return the PRIMARY KEY index of a table +func Xsqlite3PrimaryKeyIndex(tls *libc.TLS, pTab uintptr) uintptr { /* sqlite3.c:113376:22: */ + var p uintptr + for p = (*Table)(unsafe.Pointer(pTab)).FpIndex; (p != 0) && !((int32(*(*uint16)(unsafe.Pointer((p) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY); p = (*Index)(unsafe.Pointer(p)).FpNext { + } + return p +} + +// Convert an table column number into a index column number. That is, +// for the column iCol in the table (as defined by the CREATE TABLE statement) +// find the (first) offset of that column in index pIdx. Or return -1 +// if column iCol is not used in index pIdx. +func Xsqlite3TableColumnToIndex(tls *libc.TLS, pIdx uintptr, iCol I16) I16 { /* sqlite3.c:113388:20: */ + var i int32 + for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn); i++ { + if int32(iCol) == int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) { + return I16(i) + } + } + return int16(-1) +} + +// Convert a storage column number into a table column number. +// +// The storage column number (0,1,2,....) is the index of the value +// as it appears in the record on disk. The true column number +// is the index (0,1,2,...) of the column in the CREATE TABLE statement. +// +// The storage column number is less than the table column number if +// and only there are VIRTUAL columns to the left. +// +// If SQLITE_OMIT_GENERATED_COLUMNS, this routine is a no-op macro. +func Xsqlite3StorageColumnToTable(tls *libc.TLS, pTab uintptr, iCol I16) I16 { /* sqlite3.c:113408:20: */ + if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasVirtual)) != 0 { + var i int32 + for i = 0; i <= int32(iCol); i++ { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0 { + iCol++ + } + } + } + return iCol +} + +// Convert a table column number into a storage column number. +// +// The storage column number (0,1,2,....) is the index of the value +// as it appears in the record on disk. Or, if the input column is +// the N-th virtual column (zero-based) then the storage number is +// the number of non-virtual columns in the table plus N. +// +// The true column number is the index (0,1,2,...) of the column in +// the CREATE TABLE statement. +// +// If the input column is a VIRTUAL column, then it should not appear +// in storage. But the value sometimes is cached in registers that +// follow the range of registers used to construct storage. This +// avoids computing the same VIRTUAL column multiple times, and provides +// values for use by OP_Param opcodes in triggers. Hence, if the +// input column is a VIRTUAL table, put it after all the other columns. +// +// In the following, N means "normal column", S means STORED, and +// V means VIRTUAL. Suppose the CREATE TABLE has columns like this: +// +// CREATE TABLE ex(N,S,V,N,S,V,N,S,V); +// -- 0 1 2 3 4 5 6 7 8 +// +// Then the mapping from this function is as follows: +// +// INPUTS: 0 1 2 3 4 5 6 7 8 +// OUTPUTS: 0 1 6 2 3 7 4 5 8 +// +// So, in other words, this routine shifts all the virtual columns to +// the end. +// +// If SQLITE_OMIT_GENERATED_COLUMNS then there are no virtual columns and +// this routine is a no-op macro. If the pTab does not have any virtual +// columns, then this routine is no-op that always return iCol. If iCol +// is negative (indicating the ROWID column) then this routine return iCol. +func Xsqlite3TableColumnToStorage(tls *libc.TLS, pTab uintptr, iCol I16) I16 { /* sqlite3.c:113456:20: */ + var i int32 + var n I16 + + if (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasVirtual)) == U32(0)) || (int32(iCol) < 0) { + return iCol + } + i = 0 + n = int16(0) + for ; i < int32(iCol); i++ { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0 { + n++ + } + } + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0 { + // iCol is a virtual column itself + return (I16((int32((*Table)(unsafe.Pointer(pTab)).FnNVCol) + i) - int32(n))) + } else { + // iCol is a normal or stored column + return n + } + return I16(0) +} + +// Insert a single OP_JournalMode query opcode in order to force the +// prepared statement to return false for sqlite3_stmt_readonly(). This +// is used by CREATE TABLE IF NOT EXISTS and similar if the table already +// exists, so that the prepared statement for CREATE TABLE IF NOT EXISTS +// will return false for sqlite3_stmt_readonly() even if that statement +// is a read-only no-op. +func sqlite3ForceNotReadOnly(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:113482:13: */ + var iReg int32 = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + if v != 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_JournalMode, 0, iReg, -1) + Xsqlite3VdbeUsesBtree(tls, v, 0) + } +} + +// Begin constructing a new table representation in memory. This is +// the first of several action routines that get called in response +// to a CREATE TABLE statement. In particular, this routine is called +// after seeing tokens "CREATE" and "TABLE" and the table name. The isTemp +// flag is true if the table should be stored in the auxiliary database +// file instead of in the main database file. This is normally the case +// when the "TEMP" or "TEMPORARY" keyword occurs in between +// CREATE and TABLE. +// +// The new table record is initialized and put in pParse->pNewTable. +// As more of the CREATE TABLE statement is parsed, additional action +// routines will be called to add more information to this record. +// At the end of the CREATE TABLE statement, the sqlite3EndTable() routine +// is called to complete the construction of the new table record. +func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, isTemp int32, isView int32, isVirtual int32, noErr int32) { /* sqlite3.c:113507:21: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pTable uintptr + var zName uintptr // The name of the new table + var db uintptr + var v uintptr + var iDb int32 // Database number to create the table in + // var pName uintptr at bp+16, 8 + + var zDb uintptr + var zDb1 uintptr + var addr1 int32 + var fileFormat int32 + var reg1 int32 + var reg2 int32 + var reg3 int32 + zName = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb // Unqualified name of the table to create + + if !(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && ((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum == Pgno(1))) { + goto __1 + } + // Special case: Parsing the sqlite_schema or sqlite_temp_schema schema + iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) + zName = Xsqlite3DbStrDup(tls, db, func() uintptr { + if (!(0 != 0)) && (iDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }()) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 + goto __2 +__1: + // The common case + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+16 /* &pName */) + if !(iDb < 0) { + goto __3 + } + return +__3: + ; + if !(((!(0 != 0) && (isTemp != 0)) && ((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0))) && (iDb != 1)) { + goto __4 + } + // If creating a temp table, the name may not be qualified. Unless + // the database name is "temp" anyway. + Xsqlite3ErrorMsg(tls, pParse, ts+11006 /* "temporary table ..." */, 0) + return +__4: + ; + if !(!(0 != 0) && (isTemp != 0)) { + goto __5 + } + iDb = 1 +__5: + ; + zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */))) + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __6 + } + Xsqlite3RenameTokenMap(tls, pParse, zName, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */))) +__6: + ; +__2: + ; + (*Parse)(unsafe.Pointer(pParse)).FsNameToken = *(*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + if !(zName == uintptr(0)) { + goto __7 + } + return +__7: + ; + if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { + if isView != 0 { + return ts + 9209 /* "view" */ + } + return ts + 7824 /* "table" */ + }(), zName) != 0) { + goto __8 + } + goto begin_table_error +__8: + ; + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) == 1) { + goto __9 + } + isTemp = 1 +__9: + ; + + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { + if (!(0 != 0)) && (isTemp == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }(), uintptr(0), zDb) != 0) { + goto __10 + } + goto begin_table_error +__10: + ; + if !(!(isVirtual != 0) && (Xsqlite3AuthCheck(tls, pParse, int32(aCode[(isTemp+(2*isView))]), + zName, uintptr(0), zDb) != 0)) { + goto __11 + } + goto begin_table_error +__11: + ; + + // Make sure the new table name does not collide with an existing + // index or table name in the same database. Issue an error message if + // it does. The exception is if the statement being parsed was passed + // to an sqlite3_declare_vtab() call. In that case only the column names + // and types will be used, so there is no need to test for namespace + // collisions. + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL)) { + goto __12 + } + zDb1 = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + if !(SQLITE_OK != Xsqlite3ReadSchema(tls, pParse)) { + goto __13 + } + goto begin_table_error +__13: + ; + pTable = Xsqlite3FindTable(tls, db, zName, zDb1) + if !(pTable != 0) { + goto __14 + } + if !(!(noErr != 0)) { + goto __15 + } + Xsqlite3ErrorMsg(tls, pParse, ts+11047 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + goto __16 +__15: + ; + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + sqlite3ForceNotReadOnly(tls, pParse) +__16: + ; + goto begin_table_error +__14: + ; + if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { + goto __17 + } + Xsqlite3ErrorMsg(tls, pParse, ts+11071 /* "there is already..." */, libc.VaList(bp+8, zName)) + goto begin_table_error +__17: + ; +__12: + ; + + pTable = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Table{}))) + if !(pTable == uintptr(0)) { + goto __18 + } + + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + goto begin_table_error +__18: + ; + (*Table)(unsafe.Pointer(pTable)).FzName = zName + (*Table)(unsafe.Pointer(pTable)).FiPKey = int16(-1) + (*Table)(unsafe.Pointer(pTable)).FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + (*Table)(unsafe.Pointer(pTable)).FnTabRef = U32(1) + (*Table)(unsafe.Pointer(pTable)).FnRowLogEst = int16(200) + + (*Parse)(unsafe.Pointer(pParse)).FpNewTable = pTable + + // Begin generating the code that will insert the table record into + // the schema table. Note in particular that we must go ahead + // and allocate the record number for the table entry now. Before any + // PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will cause + // indices to be created and the table record must come before the + // indices. Hence, the record number for the table must be allocated + // now. + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0) && ((libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0))) { + goto __19 + } + Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) + + if !(isVirtual != 0) { + goto __20 + } + Xsqlite3VdbeAddOp0(tls, v, OP_VBegin) +__20: + ; + + // If the file format and encoding in the database have not been set, + // set them now. + reg1 = libc.AssignPtrInt32(pParse+120 /* &.regRowid */, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + reg2 = libc.AssignPtrInt32(pParse+124 /* &.regRoot */, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + reg3 = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp3(tls, v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT) + Xsqlite3VdbeUsesBtree(tls, v, iDb) + addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_If, reg3) + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LegacyFileFmt)) != uint64(0) { + fileFormat = 1 + } else { + fileFormat = SQLITE_MAX_FILE_FORMAT + } + Xsqlite3VdbeAddOp3(tls, v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, fileFormat) + Xsqlite3VdbeAddOp3(tls, v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, int32((*Sqlite3)(unsafe.Pointer(db)).Fenc)) + Xsqlite3VdbeJumpHere(tls, v, addr1) + + // This just creates a place-holder record in the sqlite_schema table. + // The record created does not contain anything yet. It will be replaced + // by the real entry in code generated at sqlite3EndTable(). + // + // The rowid for the new entry is left in register pParse->regRowid. + // The root page number of the new table is left in reg pParse->regRoot. + // The rowid and root page number values are needed by the code that + // sqlite3EndTable will generate. + if !((isView != 0) || (isVirtual != 0)) { + goto __21 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, reg2) + goto __22 +__21: + ; + *(*int32)(unsafe.Pointer(pParse + 184 /* &.u1 */)) = Xsqlite3VdbeAddOp3(tls, v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY) +__22: + ; + Xsqlite3OpenSchemaTable(tls, pParse, iDb) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, 0, reg1) + Xsqlite3VdbeAddOp4(tls, v, OP_Blob, 6, reg3, 0, uintptr(unsafe.Pointer(&nullRow)), -1) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, 0, reg3, reg1) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + Xsqlite3VdbeAddOp0(tls, v, OP_Close) +__19: + ; + + // Normal (non-error) return. + return + + // If an error occurs, we jump here +begin_table_error: + Xsqlite3DbFree(tls, db, zName) + return +} + +var aCode = [4]U8{ + U8(SQLITE_CREATE_TABLE), + U8(SQLITE_CREATE_TEMP_TABLE), + U8(SQLITE_CREATE_VIEW), + U8(SQLITE_CREATE_TEMP_VIEW), +} /* sqlite3.c:113554:21 */ +var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* sqlite3.c:113632:23 */ + +// Set properties of a table column based on the (magical) +// name of the column. + +// Name of the special TEMP trigger used to implement RETURNING. The +// name begins with "sqlite_" so that it is guaranteed not to collide +// with any application-generated triggers. + +// Clean up the data structures associated with the RETURNING clause. +func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ + var pHash uintptr + pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) + Xsqlite3HashInsert(tls, pHash, ts+11106 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) + Xsqlite3DbFree(tls, db, pRet) +} + +// Add the RETURNING clause to the parse currently underway. +// +// This routine creates a special TEMP trigger that will fire for each row +// of the DML statement. That TEMP trigger contains a single SELECT +// statement with a result set that is the argument of the RETURNING clause. +// The trigger has the Trigger.bReturning flag and an opcode of +// TK_RETURNING instead of TK_SELECT, so that the trigger code generator +// knows to handle it specially. The TEMP trigger is automatically +// removed at the end of the parse. +// +// When this routine is called, we do not yet know if the RETURNING clause +// is attached to a DELETE, INSERT, or UPDATE, so construct it as a +// RETURNING trigger instead. It will then be converted into the appropriate +// type on the first call to sqlite3TriggersExist(). +func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sqlite3.c:113740:21: */ + var pRet uintptr + var pHash uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+11123 /* "cannot use RETUR..." */, 0) + } else { + + } + (*Parse)(unsafe.Pointer(pParse)).FbReturning = U8(1) + pRet = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Returning{}))) + if pRet == uintptr(0) { + Xsqlite3ExprListDelete(tls, db, pList) + return + } + *(*uintptr)(unsafe.Pointer(pParse + 184 /* &.u1 */)) = pRet + (*Returning)(unsafe.Pointer(pRet)).FpParse = pParse + (*Returning)(unsafe.Pointer(pRet)).FpReturnEL = pList + Xsqlite3ParserAddCleanup(tls, pParse, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{sqlite3DeleteReturning})), pRet) + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11106 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) + (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FpSchema + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FpTabSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FpSchema + (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fstep_list = (pRet + 88 /* &.retTStep */) + (*Returning)(unsafe.Pointer(pRet)).FretTStep.Fop = U8(TK_RETURNING) + (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpTrig = (pRet + 16 /* &.retTrig */) + (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList + pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) + + if Xsqlite3HashInsert(tls, pHash, ts+11106 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == + (pRet + 16 /* &.retTrig */) { + Xsqlite3OomFault(tls, db) + } +} + +// Add a new column to the table currently being constructed. +// +// The parser calls this routine once for each column declaration +// in a CREATE TABLE statement. sqlite3StartTable() gets called +// first to get things going. Then this routine is called for each +// column. +func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintptr) { /* sqlite3.c:113788:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr + var i int32 + var z uintptr + var zType uintptr + var pCol uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var hName U8 + + if (libc.AssignUintptr(&p, (*Parse)(unsafe.Pointer(pParse)).FpNewTable)) == uintptr(0) { + return + } + if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { + Xsqlite3ErrorMsg(tls, pParse, ts+11157 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + return + } + z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) + if z == uintptr(0) { + return + } + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenMap(tls, pParse, z, pName) + } + libc.Xmemcpy(tls, z, (*Token)(unsafe.Pointer(pName)).Fz, uint64((*Token)(unsafe.Pointer(pName)).Fn)) + *(*int8)(unsafe.Pointer(z + uintptr((*Token)(unsafe.Pointer(pName)).Fn))) = int8(0) + Xsqlite3Dequote(tls, z) + hName = Xsqlite3StrIHash(tls, z) + for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzName) == 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+11180 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3DbFree(tls, db, z) + return + } + } + if (int32((*Table)(unsafe.Pointer(p)).FnCol) & 0x7) == 0 { + var aNew uintptr + aNew = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(p)).FaCol, (uint64((uint64(int32((*Table)(unsafe.Pointer(p)).FnCol) + 8)) * uint64(unsafe.Sizeof(Column{}))))) + if aNew == uintptr(0) { + Xsqlite3DbFree(tls, db, z) + return + } + (*Table)(unsafe.Pointer(p)).FaCol = aNew + } + pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((*Table)(unsafe.Pointer(p)).FnCol)*32) + libc.Xmemset(tls, pCol, 0, uint64(unsafe.Sizeof(Column{}))) + (*Column)(unsafe.Pointer(pCol)).FzName = z + (*Column)(unsafe.Pointer(pCol)).FhName = hName + + if (*Token)(unsafe.Pointer(pType)).Fn == uint32(0) { + // If there is no type specified, columns have the default affinity + // 'BLOB' with a default size of 4 bytes. + (*Column)(unsafe.Pointer(pCol)).Faffinity = int8(SQLITE_AFF_BLOB) + (*Column)(unsafe.Pointer(pCol)).FszEst = U8(1) + } else { + zType = ((z + uintptr(Xsqlite3Strlen30(tls, z))) + uintptr(1)) + libc.Xmemcpy(tls, zType, (*Token)(unsafe.Pointer(pType)).Fz, uint64((*Token)(unsafe.Pointer(pType)).Fn)) + *(*int8)(unsafe.Pointer(zType + uintptr((*Token)(unsafe.Pointer(pType)).Fn))) = int8(0) + Xsqlite3Dequote(tls, zType) + (*Column)(unsafe.Pointer(pCol)).Faffinity = Xsqlite3AffinityType(tls, zType, pCol) + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_HASTYPE)) + } + (*Table)(unsafe.Pointer(p)).FnCol++ + (*Table)(unsafe.Pointer(p)).FnNVCol++ + (*Parse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) +} + +// This routine is called by the parser while in the middle of +// parsing a CREATE TABLE statement. A "NOT NULL" constraint has +// been seen on a column. This routine sets the notNull flag on +// the column currently under construction. +func Xsqlite3AddNotNull(tls *libc.TLS, pParse uintptr, onError int32) { /* sqlite3.c:113860:21: */ + var p uintptr + var pCol uintptr + p = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if (p == uintptr(0)) || (int32((*Table)(unsafe.Pointer(p)).FnCol) < 1) { + return + } + pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) + (*Column)(unsafe.Pointer(pCol)).FnotNull = U8(onError) + *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_HasNotNull)) + + // Set the uniqNotNull flag on any UNIQUE or PK indexes already created + // on this column. + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_UNIQUE) != 0 { + var pIdx uintptr + for pIdx = (*Table)(unsafe.Pointer(p)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn))) == (int32((*Table)(unsafe.Pointer(p)).FnCol) - 1) { + libc.SetBitFieldPtr16Uint32(pIdx+100 /* &.uniqNotNull */, uint32(1), 3, 0x8) + } + } + } +} + +// Scan the column type name zType (length nType) and return the +// associated affinity type. +// +// This routine does a case-independent search of zType for the +// substrings in the following table. If one of the substrings is +// found, the corresponding affinity is returned. If zType contains +// more than one of the substrings, entries toward the top of +// the table take priority. For example, if zType is 'BLOBINT', +// SQLITE_AFF_INTEGER is returned. +// +// Substring | Affinity +// -------------------------------- +// 'INT' | SQLITE_AFF_INTEGER +// 'CHAR' | SQLITE_AFF_TEXT +// 'CLOB' | SQLITE_AFF_TEXT +// 'TEXT' | SQLITE_AFF_TEXT +// 'BLOB' | SQLITE_AFF_BLOB +// 'REAL' | SQLITE_AFF_REAL +// 'FLOA' | SQLITE_AFF_REAL +// 'DOUB' | SQLITE_AFF_REAL +// +// If none of the substrings in the above table are found, +// SQLITE_AFF_NUMERIC is returned. +func Xsqlite3AffinityType(tls *libc.TLS, zIn uintptr, pCol uintptr) int8 { /* sqlite3.c:113907:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h U32 = U32(0) + var aff int8 = int8(SQLITE_AFF_NUMERIC) + var zChar uintptr = uintptr(0) + + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + h = ((h << 8) + U32(Xsqlite3UpperToLower[((int32(*(*int8)(unsafe.Pointer(zIn))))&0xff)])) + zIn++ + if h == (U32((((int32('c') << 24) + (int32('h') << 16)) + (int32('a') << 8)) + 'r')) { // CHAR + aff = int8(SQLITE_AFF_TEXT) + zChar = zIn + } else if h == (U32((((int32('c') << 24) + (int32('l') << 16)) + (int32('o') << 8)) + 'b')) { // CLOB + aff = int8(SQLITE_AFF_TEXT) + } else if h == (U32((((int32('t') << 24) + (int32('e') << 16)) + (int32('x') << 8)) + 't')) { // TEXT + aff = int8(SQLITE_AFF_TEXT) + } else if (h == (U32((((int32('b') << 24) + (int32('l') << 16)) + (int32('o') << 8)) + 'b'))) && // BLOB + ((int32(aff) == SQLITE_AFF_NUMERIC) || (int32(aff) == SQLITE_AFF_REAL)) { + aff = int8(SQLITE_AFF_BLOB) + if int32(*(*int8)(unsafe.Pointer(zIn))) == '(' { + zChar = zIn + } + } else if (h == (U32((((int32('r') << 24) + (int32('e') << 16)) + (int32('a') << 8)) + 'l'))) && // REAL + (int32(aff) == SQLITE_AFF_NUMERIC) { + aff = int8(SQLITE_AFF_REAL) + } else if (h == (U32((((int32('f') << 24) + (int32('l') << 16)) + (int32('o') << 8)) + 'a'))) && // FLOA + (int32(aff) == SQLITE_AFF_NUMERIC) { + aff = int8(SQLITE_AFF_REAL) + } else if (h == (U32((((int32('d') << 24) + (int32('o') << 16)) + (int32('u') << 8)) + 'b'))) && // DOUB + (int32(aff) == SQLITE_AFF_NUMERIC) { + aff = int8(SQLITE_AFF_REAL) + } else if (h & U32(0x00FFFFFF)) == (U32(((int32('i') << 16) + (int32('n') << 8)) + 't')) { // INT + aff = int8(SQLITE_AFF_INTEGER) + break + } + } + + // If pCol is not NULL, store an estimate of the field size. The + // estimate is scaled so that the size of an integer is 1. + if pCol != 0 { + *(*int32)(unsafe.Pointer(bp /* v */)) = 0 // default size is approx 4 bytes + if int32(aff) < SQLITE_AFF_NUMERIC { + if zChar != 0 { + for *(*int8)(unsafe.Pointer(zChar)) != 0 { + if (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zChar)))]) & 0x04) != 0 { + // BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) + Xsqlite3GetInt32(tls, zChar, bp /* &v */) + break + } + zChar++ + } + } else { + *(*int32)(unsafe.Pointer(bp /* v */)) = 16 // BLOB, TEXT, CLOB -> r=5 (approx 20 bytes) + } + } + *(*int32)(unsafe.Pointer(bp /* v */)) = ((*(*int32)(unsafe.Pointer(bp /* v */)) / 4) + 1) + if *(*int32)(unsafe.Pointer(bp /* v */)) > 255 { + *(*int32)(unsafe.Pointer(bp /* v */)) = 255 + } + (*Column)(unsafe.Pointer(pCol)).FszEst = U8(*(*int32)(unsafe.Pointer(bp /* v */))) + } + return aff +} + +// The expression is the default value for the most recently added column +// of the table currently under construction. +// +// Default value expressions must be constant. Raise an exception if this +// is not the case. +// +// This routine is called by the parser while in the middle of +// parsing a CREATE TABLE statement. +func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStart uintptr, zEnd uintptr) { /* sqlite3.c:113984:21: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var p uintptr + var pCol uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + p = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if p != uintptr(0) { + var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) + pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) + if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+11206, /* "default value of..." */ + libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { + + Xsqlite3ErrorMsg(tls, pParse, ts+11251 /* "cannot use DEFAU..." */, 0) + } else { + // A copy of pExpr is used instead of the original, as pExpr contains + // tokens that point to volatile memory. + // var x Expr at bp+8, 72 + + Xsqlite3ExprDelete(tls, db, (*Column)(unsafe.Pointer(pCol)).FpDflt) + libc.Xmemset(tls, bp+8 /* &x */, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(bp + 8 /* &x */)).Fop = U8(TK_SPAN) + *(*uintptr)(unsafe.Pointer(bp + 8 /* &x */ + 8 /* &.u */)) = Xsqlite3DbSpanDup(tls, db, zStart, zEnd) + (*Expr)(unsafe.Pointer(bp + 8 /* &x */)).FpLeft = pExpr + (*Expr)(unsafe.Pointer(bp + 8 /* &x */)).Fflags = U32(EP_Skip) + (*Column)(unsafe.Pointer(pCol)).FpDflt = Xsqlite3ExprDup(tls, db, bp+8 /* &x */, EXPRDUP_REDUCE) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* &x */ + 8 /* &.u */))) + } + } + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameExprUnmap(tls, pParse, pExpr) + } + Xsqlite3ExprDelete(tls, db, pExpr) +} + +// Backwards Compatibility Hack: +// +// Historical versions of SQLite accepted strings as column names in +// indexes and PRIMARY KEY constraints and in UNIQUE constraints. Example: +// +// CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) +// CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); +// +// This is goofy. But to preserve backwards compatibility we continue to +// accept it. This routine does the necessary conversion. It converts +// the expression given in its argument from a TK_STRING into a TK_ID +// if the expression is just a TK_STRING with an optional COLLATE clause. +// If the expression is anything other than TK_STRING, the expression is +// unchanged. +func sqlite3StringToId(tls *libc.TLS, p uintptr) { /* sqlite3.c:114043:13: */ + if int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_STRING { + (*Expr)(unsafe.Pointer(p)).Fop = U8(TK_ID) + } else if (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_COLLATE) && (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(p)).FpLeft)).Fop) == TK_STRING) { + (*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(p)).FpLeft)).Fop = U8(TK_ID) + } +} + +// Tag the given column as being part of the PRIMARY KEY +func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { /* sqlite3.c:114054:13: */ + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_PRIMKEY)) + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { + + Xsqlite3ErrorMsg(tls, pParse, + ts+11292 /* "generated column..." */, 0) + } +} + +// Designate the PRIMARY KEY for the table. pList is a list of names +// of columns that form the primary key. If pList is NULL, then the +// most recently added column of the table is the primary key. +// +// A table can have at most one primary key. If the table already has +// a primary key (and this is the second primary key) then create an +// error. +// +// If the PRIMARY KEY is on a single column whose datatype is INTEGER, +// then we will try to use that column as the rowid. Set the Table.iPKey +// field of the table under construction to be the index of the +// INTEGER PRIMARY KEY column. Table.iPKey is set to -1 if there is +// no INTEGER PRIMARY KEY. +// +// If the key is not an INTEGER PRIMARY KEY, then create a unique +// index for the key. No index is created for INTEGER PRIMARY KEYs. +func Xsqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError int32, autoInc int32, sortOrder int32) { /* sqlite3.c:114084:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pTab uintptr + var pCol uintptr + var iCol int32 + var i int32 + var nTerm int32 + var zCName uintptr + var pCExpr uintptr + var pCExpr1 uintptr + pTab = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + pCol = uintptr(0) + iCol = -1 + if !(pTab == uintptr(0)) { + goto __1 + } + goto primary_key_exit +__1: + ; + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasPrimaryKey)) != 0) { + goto __2 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+11344 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto primary_key_exit +__2: + ; + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_HasPrimaryKey)) + if !(pList == uintptr(0)) { + goto __3 + } + iCol = (int32((*Table)(unsafe.Pointer(pTab)).FnCol) - 1) + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32) + makeColumnPartOfPrimaryKey(tls, pParse, pCol) + nTerm = 1 + goto __4 +__3: + nTerm = (*ExprList)(unsafe.Pointer(pList)).FnExpr + i = 0 +__5: + if !(i < nTerm) { + goto __7 + } + pCExpr = Xsqlite3ExprSkipCollate(tls, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + + sqlite3StringToId(tls, pCExpr) + if !(int32((*Expr)(unsafe.Pointer(pCExpr)).Fop) == TK_ID) { + goto __8 + } + zCName = *(*uintptr)(unsafe.Pointer(pCExpr + 8 /* &.u */)) + iCol = 0 +__9: + if !(iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __11 + } + if !(Xsqlite3StrICmp(tls, zCName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName) == 0) { + goto __12 + } + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32) + makeColumnPartOfPrimaryKey(tls, pParse, pCol) + goto __11 +__12: + ; + goto __10 +__10: + iCol++ + goto __9 + goto __11 +__11: + ; +__8: + ; + goto __6 +__6: + i++ + goto __5 + goto __7 +__7: + ; +__4: + ; + if !((((nTerm == 1) && + (pCol != 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+756 /* "" */), ts+11385 /* "INTEGER" */) == 0)) && + (sortOrder != SQLITE_SO_DESC)) { + goto __13 + } + if !((int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (pList != 0)) { + goto __15 + } + pCExpr1 = Xsqlite3ExprSkipCollate(tls, (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FpExpr) + Xsqlite3RenameTokenRemap(tls, pParse, (pTab + 68 /* &.iPKey */), pCExpr1) +__15: + ; + (*Table)(unsafe.Pointer(pTab)).FiPKey = I16(iCol) + (*Table)(unsafe.Pointer(pTab)).FkeyConf = U8(onError) + + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(autoInc * TF_Autoincrement)) + if !(pList != 0) { + goto __16 + } + (*Parse)(unsafe.Pointer(pParse)).FiPkSortOrder = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FsortFlags +__16: + ; + Xsqlite3HasExplicitNulls(tls, pParse, pList) + goto __14 +__13: + if !(autoInc != 0) { + goto __17 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+11393 /* "AUTOINCREMENT is..." */, 0) + goto __18 +__17: + Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), + uintptr(0), sortOrder, 0, uint8(SQLITE_IDXTYPE_PRIMARYKEY)) + pList = uintptr(0) +__18: + ; +__14: + ; + +primary_key_exit: + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pList) + return +} + +// Add a new CHECK constraint to the table currently under construction. +func Xsqlite3AddCheckConstraint(tls *libc.TLS, pParse uintptr, pCheckExpr uintptr, zStart uintptr, zEnd uintptr) { /* sqlite3.c:114159:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTab uintptr = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if ((pTab != 0) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB)) && + !(Xsqlite3BtreeIsReadonly(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb)*32)).FpBt) != 0) { + (*Table)(unsafe.Pointer(pTab)).FpCheck = Xsqlite3ExprListAppend(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FpCheck, pCheckExpr) + if (*Parse)(unsafe.Pointer(pParse)).FconstraintName.Fn != 0 { + Xsqlite3ExprListSetName(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FpCheck, (pParse + 96 /* &.constraintName */), 1) + } else { + // var t Token at bp, 16 + + for zStart++; (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zStart)))]) & 0x01) != 0; zStart++ { + } + for (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zEnd + libc.UintptrFromInt32(-1))))]) & 0x01) != 0 { + zEnd-- + } + (*Token)(unsafe.Pointer(bp /* &t */)).Fz = zStart + (*Token)(unsafe.Pointer(bp /* &t */)).Fn = uint32((int32((int64(zEnd) - int64((*Token)(unsafe.Pointer(bp /* &t */)).Fz)) / 1))) + Xsqlite3ExprListSetName(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FpCheck, bp /* &t */, 1) + } + } else { + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pCheckExpr) + } +} + +// Set the collation function of the most recently parsed table column +// to the CollSeq given. +func Xsqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { /* sqlite3.c:114193:21: */ + var p uintptr + var i int32 + var zColl uintptr // Dequoted name of collation sequence + var db uintptr + + if ((libc.AssignUintptr(&p, (*Parse)(unsafe.Pointer(pParse)).FpNewTable)) == uintptr(0)) || (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + return + } + i = (int32((*Table)(unsafe.Pointer(p)).FnCol) - 1) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + zColl = Xsqlite3NameFromToken(tls, db, pToken) + if !(zColl != 0) { + return + } + + if Xsqlite3LocateCollSeq(tls, pParse, zColl) != 0 { + var pIdx uintptr + Xsqlite3DbFree(tls, db, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzColl) + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol + uintptr(i)*32)).FzColl = zColl + + // If the column is declared as " PRIMARY KEY COLLATE ", + // then an index may have been created on this column before the + // collation type was added. Correct this if it is the case. + for pIdx = (*Table)(unsafe.Pointer(p)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn))) == i { + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol + uintptr(i)*32)).FzColl + } + } + } else { + Xsqlite3DbFree(tls, db, zColl) + } +} + +// Change the most recently parsed column to be a GENERATED ALWAYS AS +// column. +func Xsqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType uintptr) { /* sqlite3.c:114228:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var eType U8 + var pTab uintptr + var pCol uintptr + eType = U8(COLFLAG_VIRTUAL) + pTab = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if !(pTab == uintptr(0)) { + goto __1 + } + // generated column in an CREATE TABLE IF NOT EXISTS that already exists + goto generated_done +__1: + ; + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(pTab)).FnCol)-1))*32) + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { + goto __2 + } + Xsqlite3ErrorMsg(tls, pParse, ts+11449 /* "virtual tables c..." */, 0) + goto generated_done +__2: + ; + if !((*Column)(unsafe.Pointer(pCol)).FpDflt != 0) { + goto __3 + } + goto generated_error +__3: + ; + if !(pType != 0) { + goto __4 + } + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11492 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + goto __5 + } + // no-op + goto __6 +__5: + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11500 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + goto __7 + } + eType = U8(COLFLAG_STORED) + goto __8 +__7: + goto generated_error +__8: + ; +__6: + ; +__4: + ; + if !(int32(eType) == COLFLAG_VIRTUAL) { + goto __9 + } + (*Table)(unsafe.Pointer(pTab)).FnNVCol-- +__9: + ; + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((int32(eType))) + + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(eType)) + if !((int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0) { + goto __10 + } + makeColumnPartOfPrimaryKey(tls, pParse, pCol) // For the error message +__10: + ; + (*Column)(unsafe.Pointer(pCol)).FpDflt = pExpr + pExpr = uintptr(0) + goto generated_done + +generated_error: + Xsqlite3ErrorMsg(tls, pParse, ts+11507, /* "error in generat..." */ + libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) +generated_done: + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) +} + +// Generate code that will increment the schema cookie. +// +// The schema cookie is used to determine when the schema for the +// database changes. After each schema change, the cookie value +// changes. When a process first reads the schema it records the +// cookie. Thereafter, whenever it goes to access the database, +// it checks the cookie to make sure the schema has not changed +// since it was last read. +// +// This plan is not completely bullet-proof. It is possible for +// the schema to change multiple times and for the cookie to be +// set back to prior value. But schema changes are infrequent +// and the probability of hitting the same cookie value is only +// 1 chance in 2^32. So we're safe enough. +// +// IMPLEMENTATION-OF: R-34230-56049 SQLite automatically increments +// the schema-version whenever the schema changes. +func Xsqlite3ChangeCookie(tls *libc.TLS, pParse uintptr, iDb int32) { /* sqlite3.c:114296:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + Xsqlite3VdbeAddOp3(tls, v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, + (int32(uint32(1) + uint32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema)).Fschema_cookie)))) +} + +// Measure the number of characters needed to output the given +// identifier. The number returned includes any quotes used +// but does not include the null terminator. +// +// The estimate is conservative. It might be larger that what is +// really needed. +func identLength(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:114312:12: */ + var n int32 + n = 0 +__1: + if !(*(*int8)(unsafe.Pointer(z)) != 0) { + goto __3 + } + { + if int32(*(*int8)(unsafe.Pointer(z))) == '"' { + n++ + } + + } + goto __2 +__2: + n++ + z++ + goto __1 + goto __3 +__3: + ; + return (n + 2) +} + +// The first parameter is a pointer to an output buffer. The second +// parameter is a pointer to an integer that contains the offset at +// which to write into the output buffer. This function copies the +// nul-terminated string pointed to by the third parameter, zSignedIdent, +// to the specified offset in the buffer and updates *pIdx to refer +// to the first byte after the last byte written before returning. +// +// If the string zSignedIdent consists entirely of alpha-numeric +// characters, does not begin with a digit and is not an SQL keyword, +// then it is copied to the output buffer exactly as it is. Otherwise, +// it is quoted using double-quotes. +func identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { /* sqlite3.c:114333:13: */ + var zIdent uintptr = zSignedIdent + var i int32 + var j int32 + var needQuote int32 + i = *(*int32)(unsafe.Pointer(pIdx)) + + for j = 0; *(*uint8)(unsafe.Pointer(zIdent + uintptr(j))) != 0; j++ { + if !((int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))]) & 0x06) != 0) && (int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != '_') { + break + } + } + needQuote = (libc.Bool32(((((int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(zIdent))]) & 0x04) != 0) || + (Xsqlite3KeywordCode(tls, zIdent, j) != TK_ID)) || + (int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) != 0)) || + (j == 0))) + + if needQuote != 0 { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('"') + } + for j = 0; *(*uint8)(unsafe.Pointer(zIdent + uintptr(j))) != 0; j++ { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) + if int32(*(*uint8)(unsafe.Pointer(zIdent + uintptr(j)))) == '"' { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('"') + } + } + if needQuote != 0 { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('"') + } + *(*int8)(unsafe.Pointer(z + uintptr(i))) = int8(0) + *(*int32)(unsafe.Pointer(pIdx)) = i +} + +// Generate a CREATE TABLE statement appropriate for the given +// table. Memory to hold the text of the statement is obtained +// from sqliteMalloc() and must be freed by the calling function. +func createTableStmt(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:114361:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var i int32 + // var k int32 at bp+8, 4 + + var n int32 + var zStmt uintptr + var zSep uintptr + var zSep2 uintptr + var zEnd uintptr + var pCol uintptr + n = 0 + pCol = (*Table)(unsafe.Pointer(p)).FaCol + i = 0 +__1: + if !(i < int32((*Table)(unsafe.Pointer(p)).FnCol)) { + goto __3 + } + { + n = n + (identLength(tls, (*Column)(unsafe.Pointer(pCol)).FzName) + 5) + + } + goto __2 +__2: + i++ + pCol += 32 + goto __1 + goto __3 +__3: + ; + n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) + if n < 50 { + zSep = ts + 756 /* "" */ + zSep2 = ts + 11538 /* "," */ + zEnd = ts + 4067 /* ")" */ + } else { + zSep = ts + 11540 /* "\n " */ + zSep2 = ts + 11544 /* ",\n " */ + zEnd = ts + 11549 /* "\n)" */ + } + n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) + zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) + if zStmt == uintptr(0) { + Xsqlite3OomFault(tls, db) + return uintptr(0) + } + Xsqlite3_snprintf(tls, n, zStmt, ts+11552 /* "CREATE TABLE " */, 0) + *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) + identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) + *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') + pCol = (*Table)(unsafe.Pointer(p)).FaCol + i = 0 +__4: + if !(i < int32((*Table)(unsafe.Pointer(p)).FnCol)) { + goto __6 + } + { + var len int32 + var zType uintptr + + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), zSep, 0) + *(*int32)(unsafe.Pointer(bp + 8 /* k */)) += Xsqlite3Strlen30(tls, (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */))))) + zSep = zSep2 + identPut(tls, zStmt, bp+8 /* &k */, (*Column)(unsafe.Pointer(pCol)).FzName) + + zType = azType1[(int32((*Column)(unsafe.Pointer(pCol)).Faffinity) - SQLITE_AFF_BLOB)] + len = Xsqlite3Strlen30(tls, zType) + + libc.Xmemcpy(tls, (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), zType, uint64(len)) + *(*int32)(unsafe.Pointer(bp + 8 /* k */)) += len + + } + goto __5 +__5: + i++ + pCol += 32 + goto __4 + goto __6 +__6: + ; + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2791 /* "%s" */, libc.VaList(bp, zEnd)) + return zStmt +} + +var azType1 = [5]uintptr{ + /* SQLITE_AFF_BLOB */ ts + 756, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11566, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11572, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11577, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11582, /* " REAL" */ +} /* sqlite3.c:114391:23 */ + +// Resize an Index object to hold N columns total. Return SQLITE_OK +// on success and SQLITE_NOMEM on an OOM error. +func resizeIndexObject(tls *libc.TLS, db uintptr, pIdx uintptr, N int32) int32 { /* sqlite3.c:114429:12: */ + var zExtra uintptr + var nByte int32 + if int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) >= N { + return SQLITE_OK + } + + nByte = (int32((((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(LogEst(0)))) + uint64(unsafe.Sizeof(I16(0)))) + uint64(1)) * uint64(N))) + zExtra = Xsqlite3DbMallocZero(tls, db, uint64(nByte)) + if zExtra == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, zExtra, (*Index)(unsafe.Pointer(pIdx)).FazColl, (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Index)(unsafe.Pointer(pIdx)).FnColumn))) + (*Index)(unsafe.Pointer(pIdx)).FazColl = zExtra + zExtra += (uintptr(uint64(unsafe.Sizeof(uintptr(0))) * uint64(N))) + libc.Xmemcpy(tls, zExtra, (*Index)(unsafe.Pointer(pIdx)).FaiRowLogEst, (uint64(unsafe.Sizeof(LogEst(0))) * (uint64(int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + 1)))) + (*Index)(unsafe.Pointer(pIdx)).FaiRowLogEst = zExtra + zExtra += (uintptr(uint64(unsafe.Sizeof(LogEst(0))) * uint64(N))) + libc.Xmemcpy(tls, zExtra, (*Index)(unsafe.Pointer(pIdx)).FaiColumn, (uint64(unsafe.Sizeof(I16(0))) * uint64((*Index)(unsafe.Pointer(pIdx)).FnColumn))) + (*Index)(unsafe.Pointer(pIdx)).FaiColumn = zExtra + zExtra += (uintptr(uint64(unsafe.Sizeof(I16(0))) * uint64(N))) + libc.Xmemcpy(tls, zExtra, (*Index)(unsafe.Pointer(pIdx)).FaSortOrder, uint64((*Index)(unsafe.Pointer(pIdx)).FnColumn)) + (*Index)(unsafe.Pointer(pIdx)).FaSortOrder = zExtra + (*Index)(unsafe.Pointer(pIdx)).FnColumn = U16(N) + libc.SetBitFieldPtr16Uint32(pIdx+100 /* &.isResized */, uint32(1), 4, 0x10) + return SQLITE_OK +} + +// Estimate the total row width for a table. +func estimateTableWidth(tls *libc.TLS, pTab uintptr) { /* sqlite3.c:114456:13: */ + var wTable uint32 = uint32(0) + var pTabCol uintptr + var i int32 + i = int32((*Table)(unsafe.Pointer(pTab)).FnCol) + pTabCol = (*Table)(unsafe.Pointer(pTab)).FaCol +__1: + if !(i > 0) { + goto __3 + } + { + wTable = wTable + (uint32((*Column)(unsafe.Pointer(pTabCol)).FszEst)) + + } + goto __2 +__2: + i-- + pTabCol += 32 + goto __1 + goto __3 +__3: + ; + if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) < 0 { + wTable++ + } + (*Table)(unsafe.Pointer(pTab)).FszTabRow = Xsqlite3LogEst(tls, (uint64(wTable * uint32(4)))) +} + +// Estimate the average size of a row for an index. +func estimateIndexWidth(tls *libc.TLS, pIdx uintptr) { /* sqlite3.c:114470:13: */ + var wIndex uint32 = uint32(0) + var i int32 + var aCol uintptr = (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn); i++ { + var x I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) + + wIndex = wIndex + (func() uint32 { + if int32(x) < 0 { + return uint32(1) + } + return uint32((*Column)(unsafe.Pointer(aCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)))*32)).FszEst) + }()) + } + (*Index)(unsafe.Pointer(pIdx)).FszIdxRow = Xsqlite3LogEst(tls, (uint64(wIndex * uint32(4)))) +} + +// Return true if column number x is any of the first nCol entries of aiCol[]. +// This is used to determine if the column number x appears in any of the +// first nCol entries of an index. +func hasColumn(tls *libc.TLS, aiCol uintptr, nCol int32, x int32) int32 { /* sqlite3.c:114486:12: */ + for libc.PostDecInt32(&nCol, 1) > 0 { + + if x == int32(*(*I16)(unsafe.Pointer(libc.PostIncUintptr(&aiCol, 2)))) { + return 1 + } + } + return 0 +} + +// Return true if any of the first nKey entries of index pIdx exactly +// match the iCol-th entry of pPk. pPk is always a WITHOUT ROWID +// PRIMARY KEY index. pIdx is an index on the same table. pIdx may +// or may not be the same index as pPk. +// +// The first nKey entries of pIdx are guaranteed to be ordinary columns, +// not a rowid or expression. +// +// This routine differs from hasColumn() in that both the column and the +// collating sequence must match for this routine, but for hasColumn() only +// the column name must match. +func isDupColumn(tls *libc.TLS, pIdx uintptr, nKey int32, pPk uintptr, iCol int32) int32 { /* sqlite3.c:114509:12: */ + var i int32 + var j int32 + + j = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(iCol)*2))) + + for i = 0; i < nKey; i++ { + + if (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == j) && + (Xsqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(iCol)*8))) == 0) { + return 1 + } + } + return 0 +} + +// Recompute the colNotIdxed field of the Index. +// +// colNotIdxed is a bitmask that has a 0 bit representing each indexed +// columns that are within the first 63 columns of the table. The +// high-order bit of colNotIdxed is always 1. All unindexed columns +// of the table have a 1. +// +// 2019-10-24: For the purpose of this computation, virtual columns are +// not considered to be covered by the index, even if they are in the +// index, because we do not trust the logic in whereIndexExprTrans() to be +// able to find all instances of a reference to the indexed table column +// and convert them into references to the index. Hence we always want +// the actual table at hand in order to recompute the virtual column, if +// necessary. +// +// The colNotIdxed mask is AND-ed with the SrcList.a[].colUsed mask +// to determine if the index is covering index. +func recomputeColumnsNotIndexed(tls *libc.TLS, pIdx uintptr) { /* sqlite3.c:114548:13: */ + var m Bitmask = uint64(0) + var j int32 + var pTab uintptr = (*Index)(unsafe.Pointer(pIdx)).FpTable + for j = (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) - 1); j >= 0; j-- { + var x int32 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) + if (x >= 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(x)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0) { + + if x < ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) { + m = m | (Bitmask((uint64(1))) << (x)) + } + } + } + (*Index)(unsafe.Pointer(pIdx)).FcolNotIdxed = ^m + +} + +// This routine runs at the end of parsing a CREATE TABLE statement that +// has a WITHOUT ROWID clause. The job of this routine is to convert both +// internal schema data structures and the generated VDBE code so that they +// are appropriate for a WITHOUT ROWID table instead of a rowid table. +// Changes include: +// +// (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL. +// (2) Convert P3 parameter of the OP_CreateBtree from BTREE_INTKEY +// into BTREE_BLOBKEY. +// (3) Bypass the creation of the sqlite_schema table entry +// for the PRIMARY KEY as the primary key index is now +// identified by the sqlite_schema table entry of the table itself. +// (4) Set the Index.tnum of the PRIMARY KEY Index object in the +// schema to the rootpage from the main table. +// (5) Add all table columns to the PRIMARY KEY Index object +// so that the PRIMARY KEY is a covering index. The surplus +// columns are part of KeyInfo.nAllField and are not used for +// sorting or lookup or uniqueness checks. +// (6) Replace the rowid tail on all automatically generated UNIQUE +// indices with the PRIMARY KEY columns. +// +// For virtual tables, only (1) is performed. +func convertToWithoutRowidTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { /* sqlite3.c:114588:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pIdx uintptr + var pPk uintptr + var nPk int32 + var nExtra int32 + var i int32 + var j int32 + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + // Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) + if !((int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.imposterTable */)) & 0x2 >> 1)) != 0) { + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32)).FnotNull = U8(OE_Abort) + } + } + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_HasNotNull)) + } + + // Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY + // into BTREE_BLOBKEY. + + if *(*int32)(unsafe.Pointer(pParse + 184 /* &.u1 */)) != 0 { + + Xsqlite3VdbeChangeP3(tls, v, *(*int32)(unsafe.Pointer(pParse + 184 /* &.u1 */)), BTREE_BLOBKEY) + } + + // Locate the PRIMARY KEY index. Or, if this table was originally + // an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. + if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { + var pList uintptr + // var ipkToken Token at bp, 16 + + Xsqlite3TokenInit(tls, bp /* &ipkToken */, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName) + pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp /* &ipkToken */, 0)) + if pList == uintptr(0) { + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(TF_WithoutRowid))) + return + } + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenRemap(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FpExpr, (pTab + 68 /* &.iPKey */)) + } + (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FsortFlags = (*Parse)(unsafe.Pointer(pParse)).FiPkSortOrder + + (*Table)(unsafe.Pointer(pTab)).FiPKey = int16(-1) + Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, int32((*Table)(unsafe.Pointer(pTab)).FkeyConf), uintptr(0), uintptr(0), 0, 0, + uint8(SQLITE_IDXTYPE_PRIMARYKEY)) + if ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) || ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(TF_WithoutRowid))) + return + } + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + + } else { + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + + // Remove all redundant columns from the PRIMARY KEY. For example, change + // "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later + // code assumes the PRIMARY KEY contains no repeated columns. + for i = libc.AssignInt32(&j, 1); i < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol); i++ { + if isDupColumn(tls, pPk, j, pPk, i) != 0 { + (*Index)(unsafe.Pointer(pPk)).FnColumn-- + } else { + + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(i)*8)) + *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(j))) = *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(i))) + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(libc.PostIncInt32(&j, 1))*2)) = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)) + } + } + (*Index)(unsafe.Pointer(pPk)).FnKeyCol = U16(j) + } + + libc.SetBitFieldPtr16Uint32(pPk+100 /* &.isCovering */, uint32(1), 5, 0x20) + if !((int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.imposterTable */)) & 0x2 >> 1)) != 0) { + libc.SetBitFieldPtr16Uint32(pPk+100 /* &.uniqNotNull */, uint32(1), 3, 0x8) + } + nPk = int32(libc.AssignPtrUint16(pPk+96 /* &.nColumn */, (*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + + // Bypass the creation of the PRIMARY KEY btree and the sqlite_schema + // table entry. This is only required if currently generating VDBE + // code for a CREATE TABLE (not when parsing one as part of reading + // a database schema). + if (v != 0) && ((*Index)(unsafe.Pointer(pPk)).Ftnum > Pgno(0)) { + + Xsqlite3VdbeChangeOpcode(tls, v, int32((*Index)(unsafe.Pointer(pPk)).Ftnum), uint8(OP_Goto)) + } + + // The root page of the PRIMARY KEY is the table root page + (*Index)(unsafe.Pointer(pPk)).Ftnum = (*Table)(unsafe.Pointer(pTab)).Ftnum + + // Update the in-memory representation of all UNIQUE indices by converting + // the final rowid column into one or more columns of the PRIMARY KEY. + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + var n int32 + if (int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY { + continue + } + for i = libc.AssignInt32(&n, 0); i < nPk; i++ { + if !(isDupColumn(tls, pIdx, int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol), pPk, i) != 0) { + + n++ + } + } + if n == 0 { + // This index is a superset of the primary key + (*Index)(unsafe.Pointer(pIdx)).FnColumn = (*Index)(unsafe.Pointer(pIdx)).FnKeyCol + continue + } + if resizeIndexObject(tls, db, pIdx, (int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)+n)) != 0 { + return + } + i = 0 + j = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + for ; i < nPk; i++ { + if !(isDupColumn(tls, pIdx, int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol), pPk, i) != 0) { + + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)) = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(i)*8)) + if *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(i))) != 0 { + // See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf + libc.SetBitFieldPtr16Uint32(pIdx+100 /* &.bAscKeyBug */, uint32(1), 9, 0x200) + } + j++ + } + } + + } + + // Add all table columns to the PRIMARY KEY index + nExtra = 0 + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + if !(hasColumn(tls, (*Index)(unsafe.Pointer(pPk)).FaiColumn, nPk, i) != 0) && + ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0) { + nExtra++ + } + } + if resizeIndexObject(tls, db, pPk, (nPk+nExtra)) != 0 { + return + } + i = 0 + j = nPk + for ; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + if !(hasColumn(tls, (*Index)(unsafe.Pointer(pPk)).FaiColumn, j, i) != 0) && + ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0) { + + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)) = I16(i) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + j++ + } + } + + recomputeColumnsNotIndexed(tls, pPk) +} + +// Return true if pTab is a virtual table and zName is a shadow table name +// for that virtual table. +func Xsqlite3IsShadowTableOf(tls *libc.TLS, db uintptr, pTab uintptr, zName uintptr) int32 { /* sqlite3.c:114745:20: */ + var nName int32 // Length of zName + var pMod uintptr // Module for the virtual table + + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + return 0 + } + nName = Xsqlite3Strlen30(tls, (*Table)(unsafe.Pointer(pTab)).FzName) + if Xsqlite3_strnicmp(tls, zName, (*Table)(unsafe.Pointer(pTab)).FzName, nName) != 0 { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(zName + uintptr(nName)))) != '_' { + return 0 + } + pMod = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg))) + if pMod == uintptr(0) { + return 0 + } + if (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FiVersion < 3 { + return 0 + } + if (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxShadowName == uintptr(0) { + return 0 + } + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Module)(unsafe.Pointer(pMod)).FpModule + 184 /* &.xShadowName */))))(tls, ((zName + uintptr(nName)) + uintptr(1))) +} + +// Return true if zName is a shadow table name in the current database +// connection. +// +// zName is temporarily modified while this routine is running, but is +// restored to its original value prior to this routine returning. +func Xsqlite3ShadowTableName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sqlite3.c:114769:20: */ + var zTail uintptr // Pointer to the last "_" in zName + var pTab uintptr // Table that zName is a shadow of + zTail = libc.Xstrrchr(tls, zName, '_') + if zTail == uintptr(0) { + return 0 + } + *(*int8)(unsafe.Pointer(zTail)) = int8(0) + pTab = Xsqlite3FindTable(tls, db, zName, uintptr(0)) + *(*int8)(unsafe.Pointer(zTail)) = int8('_') + if pTab == uintptr(0) { + return 0 + } + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + return 0 + } + return Xsqlite3IsShadowTableOf(tls, db, pTab, zName) +} + +// This routine is called to report the final ")" that terminates +// a CREATE TABLE statement. +// +// The table structure that other action routines have been building +// is added to the internal hash tables, assuming no errors have +// occurred. +// +// An entry for the table is made in the schema table on disk, unless +// this is a temporary table or db->init.busy==1. When db->init.busy==1 +// it means we are reading the sqlite_schema table because we just +// connected to the database or because the sqlite_schema table has +// recently changed, so the entry for this table already exists in +// the sqlite_schema table. We do not want to create it again. +// +// If the pSelect argument is not NULL, it means that this routine +// was called to create a table generated from a +// "CREATE TABLE ... AS SELECT ..." statement. The column names of +// the new table will match the result set of the SELECT. +func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr, tabOpts U8, pSelect uintptr) { /* sqlite3.c:114830:21: */ + bp := tls.Alloc(144) + defer tls.Free(144) + + var p uintptr // The new table + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + var iDb int32 // Database in which the table lives + var pIdx uintptr // An implied index of the table + + if (pEnd == uintptr(0)) && (pSelect == uintptr(0)) { + return + } + p = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if p == uintptr(0) { + return + } + + if (pSelect == uintptr(0)) && (Xsqlite3ShadowTableName(tls, db, (*Table)(unsafe.Pointer(p)).FzName) != 0) { + *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_Shadow)) + } + + // If the db->init.busy is 1 it means we are reading the SQL off the + // "sqlite_schema" or "sqlite_temp_schema" table on the disk. + // So do not write to the disk again. Extract the root page number + // for the table from the db->init.newTnum field. (The page number + // should have been put there by the sqliteOpenCb routine.) + // + // If the root page number is 1, that means this is the sqlite_schema + // table itself. So mark it read-only. + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + if pSelect != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+756 /* "" */, 0) + return + } + (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum + if (*Table)(unsafe.Pointer(p)).Ftnum == Pgno(1) { + *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_Readonly)) + } + } + + // Special processing for WITHOUT ROWID Tables + if (int32(tabOpts) & TF_WithoutRowid) != 0 { + if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { + Xsqlite3ErrorMsg(tls, pParse, + ts+11588 /* "AUTOINCREMENT no..." */, 0) + return + } + if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { + Xsqlite3ErrorMsg(tls, pParse, ts+11638 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + return + } + *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) + convertToWithoutRowidTable(tls, pParse, p) + } + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) + + // Resolve names in all CHECK constraint expressions. + if (*Table)(unsafe.Pointer(p)).FpCheck != 0 { + Xsqlite3ResolveSelfReference(tls, pParse, p, NC_IsCheck, uintptr(0), (*Table)(unsafe.Pointer(p)).FpCheck) + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + // If errors are seen, delete the CHECK constraints now, else they might + // actually be used if PRAGMA writable_schema=ON is set. + Xsqlite3ExprListDelete(tls, db, (*Table)(unsafe.Pointer(p)).FpCheck) + (*Table)(unsafe.Pointer(p)).FpCheck = uintptr(0) + } else { + + } + } + if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasGenerated)) != 0 { + var ii int32 + var nNG int32 = 0 + + for ii = 0; ii < int32((*Table)(unsafe.Pointer(p)).FnCol); ii++ { + var colFlags U32 = U32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol + uintptr(ii)*32)).FcolFlags) + if (colFlags & U32(COLFLAG_GENERATED)) != U32(0) { + var pX uintptr = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol + uintptr(ii)*32)).FpDflt + + if Xsqlite3ResolveSelfReference(tls, pParse, p, NC_GenCol, pX, uintptr(0)) != 0 { + // If there are errors in resolving the expression, change the + // expression to a NULL. This prevents code generators that operate + // on the expression from inserting extra parts into the expression + // tree that have been allocated from lookaside memory, which is + // illegal in a schema and will lead to errors or heap corruption + // when the database connection closes. + Xsqlite3ExprDelete(tls, db, pX) + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol + uintptr(ii)*32)).FpDflt = Xsqlite3ExprAlloc(tls, db, TK_NULL, uintptr(0), 0) + } + } else { + nNG++ + } + } + if nNG == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+11670 /* "must have at lea..." */, 0) + return + } + } + + // Estimate the average row size for the table and for all implied indices + estimateTableWidth(tls, p) + for pIdx = (*Table)(unsafe.Pointer(p)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + estimateIndexWidth(tls, pIdx) + } + + // If not initializing, then create a record for the new table + // in the schema table of the database. + // + // If this is a TEMPORARY table, write the entry into the auxiliary + // file instead of into the main database file. + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0) { + var n int32 + var v uintptr + var zType uintptr // "view" or "table" + var zType2 uintptr // "VIEW" or "TABLE" + var zStmt uintptr // Text of the CREATE TABLE or CREATE VIEW statement + + v = Xsqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + return + } + + Xsqlite3VdbeAddOp1(tls, v, OP_Close, 0) + + // Initialize zType for the new view or table. + if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { + // A regular table + zType = ts + 7824 /* "table" */ + zType2 = ts + 11714 /* "TABLE" */ + } else { + // A view + zType = ts + 9209 /* "view" */ + zType2 = ts + 11720 /* "VIEW" */ + } + + // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT + // statement to populate the new table. The root-page number for the + // new table is in register pParse->regRoot. + // + // Once the SELECT has been coded by sqlite3Select(), it is in a + // suitable state to query for the column names and types to be used + // by the new table. + // + // A shared-cache write-lock is not required to write to the new table, + // as a schema-lock must have already been obtained to create it. Since + // a schema-lock excludes all other database users, the write-lock would + // be redundant. + if pSelect != 0 { + // var dest SelectDest at bp+104, 40 + // Where the SELECT should store results + var regYield int32 // Register holding co-routine entry-point + var addrTop int32 // Top of the co-routine + var regRec int32 // A record to be insert into the new table + var regRowid int32 // Rowid of the next row to insert + var addrInsLoop int32 // Top of the loop for inserting rows + var pSelTab uintptr // A table that describes the SELECT results + + regYield = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regRec = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + + Xsqlite3MayAbort(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_OpenWrite, 1, (*Parse)(unsafe.Pointer(pParse)).FregRoot, iDb) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_P2ISREG)) + (*Parse)(unsafe.Pointer(pParse)).FnTab = 2 + addrTop = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) + Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regYield, 0, addrTop) + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + pSelTab = Xsqlite3ResultSetOfSelect(tls, pParse, pSelect, int8(SQLITE_AFF_BLOB)) + if pSelTab == uintptr(0) { + return + } + + (*Table)(unsafe.Pointer(p)).FnCol = libc.AssignPtrInt16(p+72 /* &.nNVCol */, (*Table)(unsafe.Pointer(pSelTab)).FnCol) + (*Table)(unsafe.Pointer(p)).FaCol = (*Table)(unsafe.Pointer(pSelTab)).FaCol + (*Table)(unsafe.Pointer(pSelTab)).FnCol = int16(0) + (*Table)(unsafe.Pointer(pSelTab)).FaCol = uintptr(0) + Xsqlite3DeleteTable(tls, db, pSelTab) + Xsqlite3SelectDestInit(tls, bp+104 /* &dest */, SRT_Coroutine, regYield) + Xsqlite3Select(tls, pParse, pSelect, bp+104 /* &dest */) + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return + } + Xsqlite3VdbeEndCoroutine(tls, v, regYield) + Xsqlite3VdbeJumpHere(tls, v, (addrTop - 1)) + addrInsLoop = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+104 /* &dest */)).FiSDParm) + + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (*SelectDest)(unsafe.Pointer(bp+104 /* &dest */)).FiSdst, (*SelectDest)(unsafe.Pointer(bp+104 /* &dest */)).FnSdst, regRec) + Xsqlite3TableAffinity(tls, v, p, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, 1, regRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, 1, regRec, regRowid) + Xsqlite3VdbeGoto(tls, v, addrInsLoop) + Xsqlite3VdbeJumpHere(tls, v, addrInsLoop) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, 1) + } + + // Compute the complete text of the CREATE statement + if pSelect != 0 { + zStmt = createTableStmt(tls, db, p) + } else { + var pEnd2 uintptr + if tabOpts != 0 { + pEnd2 = (pParse + 256 /* &.sLastToken */) + } else { + pEnd2 = pEnd + } + n = (int32((int64((*Token)(unsafe.Pointer(pEnd2)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1)) + if int32(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pEnd2)).Fz))) != ';' { + n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) + } + zStmt = Xsqlite3MPrintf(tls, db, + ts+11725 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + } + + // A slot for the record has already been allocated in the + // schema table. We just need to update that slot with all + // the information we've collected. + Xsqlite3NestedParse(tls, pParse, + + ts+11740, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, + zType, + (*Table)(unsafe.Pointer(p)).FzName, + (*Table)(unsafe.Pointer(p)).FzName, + (*Parse)(unsafe.Pointer(pParse)).FregRoot, + zStmt, + (*Parse)(unsafe.Pointer(pParse)).FregRowid)) + Xsqlite3DbFree(tls, db, zStmt) + Xsqlite3ChangeCookie(tls, pParse, iDb) + + // Check to see if we need to create an sqlite_sequence table for + // keeping track of autoincrement keys. + if (((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != U32(0)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL) { + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + + if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { + Xsqlite3NestedParse(tls, pParse, + ts+11838, /* "CREATE TABLE %Q...." */ + libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) + } + } + + // Reparse everything to update our internal data structures + Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, + Xsqlite3MPrintf(tls, db, ts+11880 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + } + + // Add the table to the in-memory representation of the database. + if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { + var pOld uintptr + var pSchema uintptr = (*Table)(unsafe.Pointer(p)).FpSchema + + pOld = Xsqlite3HashInsert(tls, (pSchema + 8 /* &.tblHash */), (*Table)(unsafe.Pointer(p)).FzName, p) + if pOld != 0 { + // Malloc must have failed inside HashInsert() + Xsqlite3OomFault(tls, db) + return + } + (*Parse)(unsafe.Pointer(pParse)).FpNewTable = uintptr(0) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) + + // If this is the magic sqlite_sequence table used by autoincrement, + // then record a pointer to this table in the main database structure + // so that INSERT can find the table easily. + + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8346 /* "sqlite_sequence" */) == 0 { + + (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p + } + } + + if !(pSelect != 0) && !(int32((*Table)(unsafe.Pointer(p)).FpSelect) != 0) { + + if (*Token)(unsafe.Pointer(pCons)).Fz == uintptr(0) { + pCons = pEnd + } + (*Table)(unsafe.Pointer(p)).FaddColOffset = (13 + (int32((int64((*Token)(unsafe.Pointer(pCons)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + } +} + +// The parser calls this routine in order to create a new VIEW +func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 uintptr, pName2 uintptr, pCNames uintptr, pSelect uintptr, isTemp int32, noErr int32) { /* sqlite3.c:115129:21: */ + bp := tls.Alloc(120) + defer tls.Free(120) + + var p uintptr + var n int32 + var z uintptr + // var sEnd Token at bp+104, 16 + + // var sFix DbFixer at bp+8, 96 + + // var pName uintptr at bp, 8 + + var iDb int32 + var db uintptr + *(*uintptr)(unsafe.Pointer(bp /* pName */)) = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { + goto __1 + } + Xsqlite3ErrorMsg(tls, pParse, ts+11914 /* "parameters are n..." */, 0) + goto create_view_fail +__1: + ; + Xsqlite3StartTable(tls, pParse, pName1, pName2, isTemp, 1, 0, noErr) + p = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if !((p == uintptr(0)) || ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0)) { + goto __2 + } + goto create_view_fail +__2: + ; + + // Legacy versions of SQLite allowed the use of the magic "rowid" column + // on a view, even though views do not have rowids. The following flag + // setting fixes this problem. But the fix can be disabled by compiling + // with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that + // depend upon the old buggy behavior. + *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_NoVisibleRowid)) + + Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) + Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9209 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + if !(Xsqlite3FixSelect(tls, bp+8 /* &sFix */, pSelect) != 0) { + goto __3 + } + goto create_view_fail +__3: + ; + + // Make a copy of the entire SELECT statement that defines the view. + // This will force all the Expr.token.z values to be dynamically + // allocated rather than point to the input string - which means that + // they will persist after the current sqlite3_exec() call returns. + *(*U32)(unsafe.Pointer(pSelect + 4 /* &.selFlags */)) |= (U32(SF_View)) + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __4 + } + (*Table)(unsafe.Pointer(p)).FpSelect = pSelect + pSelect = uintptr(0) + goto __5 +__4: + (*Table)(unsafe.Pointer(p)).FpSelect = Xsqlite3SelectDup(tls, db, pSelect, EXPRDUP_REDUCE) +__5: + ; + (*Table)(unsafe.Pointer(p)).FpCheck = Xsqlite3ExprListDup(tls, db, pCNames, EXPRDUP_REDUCE) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __6 + } + goto create_view_fail +__6: + ; + + // Locate the end of the CREATE VIEW statement. Make sEnd point to + // the end. + *(*Token)(unsafe.Pointer(bp + 104 /* sEnd */)) = (*Parse)(unsafe.Pointer(pParse)).FsLastToken + + if !(int32(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 104 /* &sEnd */)).Fz))) != ';') { + goto __7 + } + *(*uintptr)(unsafe.Pointer(bp + 104 /* &sEnd */ /* &.z */)) += (uintptr((*Token)(unsafe.Pointer(bp + 104 /* &sEnd */)).Fn)) +__7: + ; + (*Token)(unsafe.Pointer(bp + 104 /* &sEnd */)).Fn = uint32(0) + n = (int32((int64((*Token)(unsafe.Pointer(bp+104 /* &sEnd */)).Fz) - int64((*Token)(unsafe.Pointer(pBegin)).Fz)) / 1)) + + z = (*Token)(unsafe.Pointer(pBegin)).Fz +__8: + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((n - 1)))))]) & 0x01) != 0) { + goto __9 + } + n-- + goto __8 +__9: + ; + (*Token)(unsafe.Pointer(bp + 104 /* &sEnd */)).Fz = (z + uintptr((n - 1))) + (*Token)(unsafe.Pointer(bp + 104 /* &sEnd */)).Fn = uint32(1) + + // Use sqlite3EndTable() to add the view to the schema table + Xsqlite3EndTable(tls, pParse, uintptr(0), bp+104 /* &sEnd */, uint8(0), uintptr(0)) + +create_view_fail: + Xsqlite3SelectDelete(tls, db, pSelect) + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __10 + } + Xsqlite3RenameExprlistUnmap(tls, pParse, pCNames) +__10: + ; + Xsqlite3ExprListDelete(tls, db, pCNames) + return +} + +// The Table structure pTable is really a VIEW. Fill in the names of +// the columns of the view in the pTable structure. Return the number +// of errors. If an error is seen leave an error message in pParse->zErrMsg. +func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) int32 { /* sqlite3.c:115220:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSelTab uintptr // A fake table from which we get the result set + var pSel uintptr // Copy of the SELECT that implements the view + var nErr int32 = 0 // Number of errors encountered + var n int32 // Temporarily holds the number of cursors assigned + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection for malloc errors + var rc int32 + var xAuth Sqlite3_xauth // Saved xAuth pointer + + (*Sqlite3)(unsafe.Pointer(db)).FnSchemaLock++ + rc = Xsqlite3VtabCallConnect(tls, pParse, pTable) + (*Sqlite3)(unsafe.Pointer(db)).FnSchemaLock-- + if rc != 0 { + return 1 + } + if (*Table)(unsafe.Pointer(pTable)).FnModuleArg != 0 { + return 0 + } + + // A positive nCol means the columns names for this view are + // already known. + if int32((*Table)(unsafe.Pointer(pTable)).FnCol) > 0 { + return 0 + } + + // A negative nCol is a special marker meaning that we are currently + // trying to compute the column names. If we enter this routine with + // a negative nCol, it means two or more views form a loop, like this: + // + // CREATE VIEW one AS SELECT * FROM two; + // CREATE VIEW two AS SELECT * FROM one; + // + // Actually, the error above is now caught prior to reaching this point. + // But the following test is still important as it does come up + // in the following: + // + // CREATE TABLE main.ex1(a); + // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; + // SELECT * FROM temp.ex1; + if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+11950 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + return 1 + } + + // If we get this far, it means we need to compute the table names. + // Note that the call to sqlite3ResultSetOfSelect() will expand any + // "*" elements in the results set of the view and will assign cursors + // to the elements of the FROM clause. But we do not want these changes + // to be permanent. So the computation is done on a copy of the SELECT + // statement that defines the view. + + pSel = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTable)).FpSelect, 0) + if pSel != 0 { + var eParseMode U8 = (*Parse)(unsafe.Pointer(pParse)).FeParseMode + (*Parse)(unsafe.Pointer(pParse)).FeParseMode = U8(PARSE_MODE_NORMAL) + n = (*Parse)(unsafe.Pointer(pParse)).FnTab + Xsqlite3SrcListAssignCursors(tls, pParse, (*Select)(unsafe.Pointer(pSel)).FpSrc) + (*Table)(unsafe.Pointer(pTable)).FnCol = int16(-1) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) + xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + pSelTab = Xsqlite3ResultSetOfSelect(tls, pParse, pSel, int8(SQLITE_AFF_NONE)) + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + (*Parse)(unsafe.Pointer(pParse)).FnTab = n + if pSelTab == uintptr(0) { + (*Table)(unsafe.Pointer(pTable)).FnCol = int16(0) + nErr++ + } else if (*Table)(unsafe.Pointer(pTable)).FpCheck != 0 { + // CREATE VIEW name(arglist) AS ... + // The names of the columns in the table are taken from + // arglist which is stored in pTable->pCheck. The pCheck field + // normally holds CHECK constraints on an ordinary table, but for + // a VIEW it holds the list of column names. + Xsqlite3ColumnsFromExprList(tls, pParse, (*Table)(unsafe.Pointer(pTable)).FpCheck, + (pTable + 70 /* &.nCol */), (pTable + 8 /* &.aCol */)) + if ((int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && + ((*Parse)(unsafe.Pointer(pParse)).FnErr == 0)) && + (int32((*Table)(unsafe.Pointer(pTable)).FnCol) == (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr) { + Xsqlite3SelectAddColumnTypeAndCollation(tls, pParse, pTable, pSel, + int8(SQLITE_AFF_NONE)) + } + } else { + // CREATE VIEW name AS... without an argument list. Construct + // the column names from the SELECT statement that defines the view. + + (*Table)(unsafe.Pointer(pTable)).FnCol = (*Table)(unsafe.Pointer(pSelTab)).FnCol + (*Table)(unsafe.Pointer(pTable)).FaCol = (*Table)(unsafe.Pointer(pSelTab)).FaCol + *(*U32)(unsafe.Pointer(pTable + 64 /* &.tabFlags */)) |= ((*Table)(unsafe.Pointer(pSelTab)).FtabFlags & U32(COLFLAG_NOINSERT)) + (*Table)(unsafe.Pointer(pSelTab)).FnCol = int16(0) + (*Table)(unsafe.Pointer(pSelTab)).FaCol = uintptr(0) + + } + (*Table)(unsafe.Pointer(pTable)).FnNVCol = (*Table)(unsafe.Pointer(pTable)).FnCol + Xsqlite3DeleteTable(tls, db, pSelTab) + Xsqlite3SelectDelete(tls, db, pSel) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = func() uint16 { + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + return uint16(0) + } + return (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue + }() + (*Parse)(unsafe.Pointer(pParse)).FeParseMode = eParseMode + } else { + nErr++ + } + *(*U16)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FpSchema + 114 /* &.schemaFlags */)) |= U16((DB_UnresetViews)) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3DeleteColumnNames(tls, db, pTable) + (*Table)(unsafe.Pointer(pTable)).FaCol = uintptr(0) + (*Table)(unsafe.Pointer(pTable)).FnCol = int16(0) + } + return nErr +} + +// Clear the column names from every VIEW in database idx. +func sqliteViewResetAll(tls *libc.TLS, db uintptr, idx int32) { /* sqlite3.c:115351:13: */ + var i uintptr + + if !((int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(idx)*32)).FpSchema)).FschemaFlags) & (DB_UnresetViews)) == (DB_UnresetViews)) { + return + } + for i = (*Hash)(unsafe.Pointer(((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(idx)*32)).FpSchema + 8 /* &.tblHash */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pTab uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { + Xsqlite3DeleteColumnNames(tls, db, pTab) + (*Table)(unsafe.Pointer(pTab)).FaCol = uintptr(0) + (*Table)(unsafe.Pointer(pTab)).FnCol = int16(0) + } + } + *(*U16)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(idx)*32)).FpSchema + 114 /* &.schemaFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(DB_UnresetViews))) +} + +// This function is called by the VDBE to adjust the internal schema +// used by SQLite when the btree layer moves a table root page. The +// root-page of a table or index in database iDb has changed from iFrom +// to iTo. +// +// Ticket #1728: The symbol table might still contain information +// on tables and/or indices that are the process of being deleted. +// If you are unlucky, one of those deleted indices or tables might +// have the same rootpage number as the real table or index that is +// being moved. So we cannot stop searching after the first match +// because the first match might be for one of the deleted indices +// or tables and not the table/index that is actually being moved. +// We must continue looping until all tables and indices with +// rootpage==iFrom have been converted to have a rootpage of iTo +// in order to be certain that we got the right one. +func Xsqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom Pgno, iTo Pgno) { /* sqlite3.c:115387:21: */ + var pElem uintptr + var pHash uintptr + var pDb uintptr + + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + pHash = ((*Db)(unsafe.Pointer(pDb)).FpSchema + 8 /* &.tblHash */) + for pElem = (*Hash)(unsafe.Pointer(pHash)).Ffirst; pElem != 0; pElem = (*HashElem)(unsafe.Pointer(pElem)).Fnext { + var pTab uintptr = (*HashElem)(unsafe.Pointer(pElem)).Fdata + if (*Table)(unsafe.Pointer(pTab)).Ftnum == iFrom { + (*Table)(unsafe.Pointer(pTab)).Ftnum = iTo + } + } + pHash = ((*Db)(unsafe.Pointer(pDb)).FpSchema + 32 /* &.idxHash */) + for pElem = (*Hash)(unsafe.Pointer(pHash)).Ffirst; pElem != 0; pElem = (*HashElem)(unsafe.Pointer(pElem)).Fnext { + var pIdx uintptr = (*HashElem)(unsafe.Pointer(pElem)).Fdata + if (*Index)(unsafe.Pointer(pIdx)).Ftnum == iFrom { + (*Index)(unsafe.Pointer(pIdx)).Ftnum = iTo + } + } +} + +// Write code to erase the table with root-page iTable from database iDb. +// Also write code to modify the sqlite_schema table and internal schema +// if a root-page of another table is moved by the btree-layer whilst +// erasing iTable (this can happen with an auto-vacuum database). +func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { /* sqlite3.c:115417:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + if iTable < 2 { + Xsqlite3ErrorMsg(tls, pParse, ts+11980 /* "corrupt schema" */, 0) + } + Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) + Xsqlite3MayAbort(tls, pParse) + // OP_Destroy stores an in integer r1. If this integer + // is non-zero, then it is the root page number of a table moved to + // location iTable. The following code modifies the sqlite_schema table to + // reflect this. + // + // The "#NNN" in the SQL is a special constant that means whatever value + // is in register NNN. See grammar rules associated with the TK_REGISTER + // token for additional information. + Xsqlite3NestedParse(tls, pParse, + + ts+11995, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName, iTable, r1, r1)) + Xsqlite3ReleaseTempReg(tls, pParse, r1) +} + +// Write VDBE code to erase table pTab and all associated indices on disk. +// Code to update the sqlite_schema tables and internal schema definitions +// in case a root-page belonging to another table is moved by the btree layer +// is also added (this can happen with an auto-vacuum database). +func destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { /* sqlite3.c:115447:13: */ + // If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM + // is not defined), then it is important to call OP_Destroy on the + // table and index root-pages in order, starting with the numerically + // largest root-page number. This guarantees that none of the root-pages + // to be destroyed is relocated by an earlier OP_Destroy. i.e. if the + // following were coded: + // + // OP_Destroy 4 0 + // ... + // OP_Destroy 5 0 + // + // and root page 5 happened to be the largest root-page number in the + // database, then root page 5 would be moved to page 4 by the + // "OP_Destroy 4 0" opcode. The subsequent "OP_Destroy 5 0" would hit + // a free-list page. + var iTab Pgno = (*Table)(unsafe.Pointer(pTab)).Ftnum + var iDestroyed Pgno = Pgno(0) + + for 1 != 0 { + var pIdx uintptr + var iLargest Pgno = Pgno(0) + + if (iDestroyed == Pgno(0)) || (iTab < iDestroyed) { + iLargest = iTab + } + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + var iIdx Pgno = (*Index)(unsafe.Pointer(pIdx)).Ftnum + + if ((iDestroyed == Pgno(0)) || (iIdx < iDestroyed)) && (iIdx > iLargest) { + iLargest = iIdx + } + } + if iLargest == Pgno(0) { + return + } else { + var iDb int32 = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + destroyRootPage(tls, pParse, int32(iLargest), iDb) + iDestroyed = iLargest + } + } +} + +// Remove entries from the sqlite_statN tables (for N in (1,2,3)) +// after a DROP INDEX or DROP TABLE command. +func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uintptr, zName uintptr) { /* sqlite3.c:115496:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zDbName uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32)).FzDbSName + for i = 1; i <= 4; i++ { + // var zTab [24]int8 at bp+40, 24 + + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12062 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { + Xsqlite3NestedParse(tls, pParse, + ts+10025, /* "DELETE FROM %Q.%..." */ + libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) + } + } +} + +// Generate code to drop a table. +func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int32, isView int32) { /* sqlite3.c:115519:21: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var v uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTrigger uintptr + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + + v = Xsqlite3GetVdbe(tls, pParse) + + Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) + + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + Xsqlite3VdbeAddOp0(tls, v, OP_VBegin) + } + + // Drop all triggers associated with the table being dropped. Code + // is generated to remove entries from sqlite_schema and/or + // sqlite_temp_schema if required. + pTrigger = Xsqlite3TriggerList(tls, pParse, pTab) + for pTrigger != 0 { + + Xsqlite3DropTriggerPtr(tls, pParse, pTrigger) + pTrigger = (*Trigger)(unsafe.Pointer(pTrigger)).FpNext + } + + // Remove any entries of the sqlite_sequence table associated with + // the table being dropped. This is done before the table is dropped + // at the btree level, in case the sqlite_sequence table needs to + // move as a result of the drop (can happen in auto-vacuum mode). + if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { + Xsqlite3NestedParse(tls, pParse, + ts+12076, /* "DELETE FROM %Q.s..." */ + libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) + } + + // Drop all entries in the schema table that refer to the + // table. The program name loops through the schema table and deletes + // every row that refers to a table of the same name as the one being + // dropped. Triggers are handled separately because a trigger can be + // created in the temp database that refers to a table in another + // database. + Xsqlite3NestedParse(tls, pParse, + + ts+12121, /* "DELETE FROM %Q.s..." */ + libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) + if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + destroyTable(tls, pParse, pTab) + } + + // Remove the table entry from SQLite's internal schema and modify + // the schema cookie. + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + Xsqlite3VdbeAddOp4(tls, v, OP_VDestroy, iDb, 0, 0, (*Table)(unsafe.Pointer(pTab)).FzName, 0) + Xsqlite3MayAbort(tls, pParse) + } + Xsqlite3VdbeAddOp4(tls, v, OP_DropTable, iDb, 0, 0, (*Table)(unsafe.Pointer(pTab)).FzName, 0) + Xsqlite3ChangeCookie(tls, pParse, iDb) + sqliteViewResetAll(tls, db, iDb) +} + +// Return TRUE if shadow tables should be read-only in the current +// context. +func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:115592:20: */ + if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_Defensive)) != uint64(0)) && + ((*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx == uintptr(0))) && + ((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec == 0) { + return 1 + } + return 0 +} + +// Return true if it is not allowed to drop the given table +func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7082 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2414 /* "stat" */, 4) == 0 { + return 0 + } + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6151 /* "parameters" */, 10) == 0 { + return 0 + } + return 1 + } + if (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, db) != 0) { + return 1 + } + return 0 +} + +// This routine is called to do the work of a DROP TABLE statement. +// pName is the name of the table to be dropped. +func Xsqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int32, noErr int32) { /* sqlite3.c:115623:21: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pTab uintptr + var v uintptr + var db uintptr + var iDb int32 + var code int32 + var zTab uintptr + var zDb uintptr + var zArg2 uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __1 + } + goto exit_drop_table +__1: + ; + + if !(Xsqlite3ReadSchema(tls, pParse) != 0) { + goto __2 + } + goto exit_drop_table +__2: + ; + if !(noErr != 0) { + goto __3 + } + (*Sqlite3)(unsafe.Pointer(db)).FsuppressErr++ +__3: + ; + + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(isView), (pName + 8 /* &.a */)) + if !(noErr != 0) { + goto __4 + } + (*Sqlite3)(unsafe.Pointer(db)).FsuppressErr-- +__4: + ; + + if !(pTab == uintptr(0)) { + goto __5 + } + if !(noErr != 0) { + goto __6 + } + Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) + sqlite3ForceNotReadOnly(tls, pParse) +__6: + ; + goto exit_drop_table +__5: + ; + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + // If pTab is a virtual table, call ViewGetColumnNames() to ensure + // it is initialized. + if !(((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) && (Xsqlite3ViewGetColumnNames(tls, pParse, pTab) != 0)) { + goto __7 + } + goto exit_drop_table +__7: + ; + + zTab = func() uintptr { + if (!(0 != 0)) && (iDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }() + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + zArg2 = uintptr(0) + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { + goto __8 + } + goto exit_drop_table +__8: + ; + if !(isView != 0) { + goto __9 + } + if !(!(0 != 0) && (iDb == 1)) { + goto __11 + } + code = SQLITE_DROP_TEMP_VIEW + goto __12 +__11: + code = SQLITE_DROP_VIEW +__12: + ; + goto __10 +__9: + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __13 + } + code = SQLITE_DROP_VTABLE + zArg2 = (*Module)(unsafe.Pointer((*VTable)(unsafe.Pointer(Xsqlite3GetVTable(tls, db, pTab))).FpMod)).FzName + goto __14 +__13: + if !(!(0 != 0) && (iDb == 1)) { + goto __15 + } + code = SQLITE_DROP_TEMP_TABLE + goto __16 +__15: + code = SQLITE_DROP_TABLE +__16: + ; +__14: + ; +__10: + ; + if !(Xsqlite3AuthCheck(tls, pParse, code, (*Table)(unsafe.Pointer(pTab)).FzName, zArg2, zDb) != 0) { + goto __17 + } + goto exit_drop_table +__17: + ; + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0), zDb) != 0) { + goto __18 + } + goto exit_drop_table +__18: + ; + + if !(tableMayNotBeDropped(tls, db, pTab) != 0) { + goto __19 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12188 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto exit_drop_table +__19: + ; + + // Ensure DROP TABLE is not used on a view, and DROP VIEW is not used + // on a table. + if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { + goto __20 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12216 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto exit_drop_table +__20: + ; + if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { + goto __21 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12250 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto exit_drop_table +__21: + ; + + // Generate code to remove the table from the schema table + // on disk. + v = Xsqlite3GetVdbe(tls, pParse) + if !(v != 0) { + goto __22 + } + Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) + if !(!(isView != 0)) { + goto __23 + } + sqlite3ClearStatTables(tls, pParse, iDb, ts+10217 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + Xsqlite3FkDropTable(tls, pParse, pName, pTab) +__23: + ; + Xsqlite3CodeDropTable(tls, pParse, pTab, iDb, isView) +__22: + ; + +exit_drop_table: + Xsqlite3SrcListDelete(tls, db, pName) +} + +// This routine is called to create a new foreign key on the table +// currently under construction. pFromCol determines which columns +// in the current table point to the foreign key. If pFromCol==0 then +// connect the key to the last column inserted. pTo is the name of +// the table referred to (a.k.a the "parent" table). pToCol is a list +// of tables in the parent pTo table. flags contains all +// information about the conflict resolution algorithms specified +// in the ON DELETE, ON UPDATE and ON INSERT clauses. +// +// An FKey structure is created and added to the table currently +// under construction in the pParse->pNewTable field. +// +// The foreign key is set for IMMEDIATE processing. A subsequent call +// to sqlite3DeferForeignKey() might change this to DEFERRED. +func Xsqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, pTo uintptr, pToCol uintptr, flags int32) { /* sqlite3.c:115743:21: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var db uintptr + var pFKey uintptr + var pNextTo uintptr + var p uintptr + var nByte int32 + var i int32 + var nCol int32 + var z uintptr + var iCol int32 + var j int32 + var n int32 + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pFKey = uintptr(0) + p = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + + if !((p == uintptr(0)) || (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB)) { + goto __1 + } + goto fk_end +__1: + ; + if !(pFromCol == uintptr(0)) { + goto __2 + } + iCol = (int32((*Table)(unsafe.Pointer(p)).FnCol) - 1) + if !(iCol < 0) { + goto __4 + } + goto fk_end +__4: + ; + if !((pToCol != 0) && ((*ExprList)(unsafe.Pointer(pToCol)).FnExpr != 1)) { + goto __5 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+12282, /* "foreign key on %..." */ + libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*32)).FzName, pTo)) + goto fk_end +__5: + ; + nCol = 1 + goto __3 +__2: + if !((pToCol != 0) && ((*ExprList)(unsafe.Pointer(pToCol)).FnExpr != (*ExprList)(unsafe.Pointer(pFromCol)).FnExpr)) { + goto __6 + } + Xsqlite3ErrorMsg(tls, pParse, + + ts+12345 /* "number of column..." */, 0) + goto fk_end + goto __7 +__6: + nCol = (*ExprList)(unsafe.Pointer(pFromCol)).FnExpr +__7: + ; +__3: + ; + nByte = (int32(((uint64(unsafe.Sizeof(FKey{})) + ((uint64(nCol - 1)) * uint64(unsafe.Sizeof(sColMap{})))) + uint64((*Token)(unsafe.Pointer(pTo)).Fn)) + uint64(1))) + if !(pToCol != 0) { + goto __8 + } + i = 0 +__9: + if !(i < (*ExprList)(unsafe.Pointer(pToCol)).FnExpr) { + goto __11 + } + nByte = nByte + (Xsqlite3Strlen30(tls, (*ExprList_item)(unsafe.Pointer((pToCol+8 /* &.a */)+uintptr(i)*32)).FzEName) + 1) + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; + pFKey = Xsqlite3DbMallocZero(tls, db, uint64(nByte)) + if !(pFKey == uintptr(0)) { + goto __12 + } + goto fk_end +__12: + ; + (*FKey)(unsafe.Pointer(pFKey)).FpFrom = p + (*FKey)(unsafe.Pointer(pFKey)).FpNextFrom = (*Table)(unsafe.Pointer(p)).FpFKey + z = ((pFKey + 64 /* &.aCol */) + uintptr(nCol)*16) + (*FKey)(unsafe.Pointer(pFKey)).FzTo = z + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __13 + } + Xsqlite3RenameTokenMap(tls, pParse, z, pTo) +__13: + ; + libc.Xmemcpy(tls, z, (*Token)(unsafe.Pointer(pTo)).Fz, uint64((*Token)(unsafe.Pointer(pTo)).Fn)) + *(*int8)(unsafe.Pointer(z + uintptr((*Token)(unsafe.Pointer(pTo)).Fn))) = int8(0) + Xsqlite3Dequote(tls, z) + z += (uintptr((*Token)(unsafe.Pointer(pTo)).Fn + uint32(1))) + (*FKey)(unsafe.Pointer(pFKey)).FnCol = nCol + if !(pFromCol == uintptr(0)) { + goto __14 + } + (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */))).FiFrom = (int32((*Table)(unsafe.Pointer(p)).FnCol) - 1) + goto __15 +__14: + i = 0 +__16: + if !(i < nCol) { + goto __18 + } + j = 0 +__19: + if !(j < int32((*Table)(unsafe.Pointer(p)).FnCol)) { + goto __21 + } + if !(Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(j)*32)).FzName, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName) == 0) { + goto __22 + } + (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */) + uintptr(i)*16)).FiFrom = j + goto __21 +__22: + ; + goto __20 +__20: + j++ + goto __19 + goto __21 +__21: + ; + if !(j >= int32((*Table)(unsafe.Pointer(p)).FnCol)) { + goto __23 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+12439, /* "unknown column \"..." */ + libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) + goto fk_end +__23: + ; + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __24 + } + Xsqlite3RenameTokenRemap(tls, pParse, ((pFKey + 64 /* &.aCol */) + uintptr(i)*16), (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName) +__24: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; +__15: + ; + if !(pToCol != 0) { + goto __25 + } + i = 0 +__26: + if !(i < nCol) { + goto __28 + } + n = Xsqlite3Strlen30(tls, (*ExprList_item)(unsafe.Pointer((pToCol+8 /* &.a */)+uintptr(i)*32)).FzEName) + (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */) + uintptr(i)*16)).FzCol = z + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __29 + } + Xsqlite3RenameTokenRemap(tls, pParse, z, (*ExprList_item)(unsafe.Pointer((pToCol+8 /* &.a */)+uintptr(i)*32)).FzEName) +__29: + ; + libc.Xmemcpy(tls, z, (*ExprList_item)(unsafe.Pointer((pToCol+8 /* &.a */)+uintptr(i)*32)).FzEName, uint64(n)) + *(*int8)(unsafe.Pointer(z + uintptr(n))) = int8(0) + z += (uintptr(n + 1)) + goto __27 +__27: + i++ + goto __26 + goto __28 +__28: + ; +__25: + ; + (*FKey)(unsafe.Pointer(pFKey)).FisDeferred = U8(0) + *(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */))) = (U8(flags & 0xff)) // ON DELETE action + *(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */) + 1)) = (U8((flags >> 8) & 0xff)) // ON UPDATE action + + pNextTo = Xsqlite3HashInsert(tls, ((*Table)(unsafe.Pointer(p)).FpSchema + 80 /* &.fkeyHash */), + (*FKey)(unsafe.Pointer(pFKey)).FzTo, pFKey) + if !(pNextTo == pFKey) { + goto __30 + } + Xsqlite3OomFault(tls, db) + goto fk_end +__30: + ; + if !(pNextTo != 0) { + goto __31 + } + + (*FKey)(unsafe.Pointer(pFKey)).FpNextTo = pNextTo + (*FKey)(unsafe.Pointer(pNextTo)).FpPrevTo = pFKey +__31: + ; + + // Link the foreign key to the table as the last step. + (*Table)(unsafe.Pointer(p)).FpFKey = pFKey + pFKey = uintptr(0) + +fk_end: + Xsqlite3DbFree(tls, db, pFKey) + Xsqlite3ExprListDelete(tls, db, pFromCol) + Xsqlite3ExprListDelete(tls, db, pToCol) +} + +// This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED +// clause is seen as part of a foreign key definition. The isDeferred +// parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE. +// The behavior of the most recently created foreign key is adjusted +// accordingly. +func Xsqlite3DeferForeignKey(tls *libc.TLS, pParse uintptr, isDeferred int32) { /* sqlite3.c:115873:21: */ + var pTab uintptr + var pFKey uintptr + if ((libc.AssignUintptr(&pTab, (*Parse)(unsafe.Pointer(pParse)).FpNewTable)) == uintptr(0)) || ((libc.AssignUintptr(&pFKey, (*Table)(unsafe.Pointer(pTab)).FpFKey)) == uintptr(0)) { + return + } + // EV: R-30323-21917 + (*FKey)(unsafe.Pointer(pFKey)).FisDeferred = U8(isDeferred) +} + +// Generate code that will erase and refill index *pIdx. This is +// used to initialize a newly created index or to recompute the +// content of an index in response to a REINDEX command. +// +// if memRootPage is not negative, it means that the index is newly +// created. The register specified by memRootPage contains the +// root page number of the index. If memRootPage is negative, then +// the index already exists and must be cleared before being refilled and +// the root page number of the index is taken from pIndex->tnum. +func sqlite3RefillIndex(tls *libc.TLS, pParse uintptr, pIndex uintptr, memRootPage int32) { /* sqlite3.c:115894:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pTab uintptr = (*Index)(unsafe.Pointer(pIndex)).FpTable // The table that is indexed + var iTab int32 = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) // Btree cursor used for pTab + var iIdx int32 = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) // Btree cursor used for pIndex + var iSorter int32 // Cursor opened by OpenSorter (if in use) + var addr1 int32 // Address of top of loop + var addr2 int32 // Address to jump to for next iteration + var tnum Pgno // Root page of index + // var iPartIdxLabel int32 at bp, 4 + // Jump to this label to skip a row + var v uintptr // Generate code into this virtual machine + var pKey uintptr // KeyInfo for index + var regRecord int32 // Register holding assembled index record + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + var iDb int32 = Xsqlite3SchemaToIndex(tls, db, (*Index)(unsafe.Pointer(pIndex)).FpSchema) + + if Xsqlite3AuthCheck(tls, pParse, SQLITE_REINDEX, (*Index)(unsafe.Pointer(pIndex)).FzName, uintptr(0), + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) != 0 { + return + } + + // Require a write-lock on the table to perform this operation + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, uint8(1), (*Table)(unsafe.Pointer(pTab)).FzName) + + v = Xsqlite3GetVdbe(tls, pParse) + if v == uintptr(0) { + return + } + if memRootPage >= 0 { + tnum = Pgno(memRootPage) + } else { + tnum = (*Index)(unsafe.Pointer(pIndex)).Ftnum + } + pKey = Xsqlite3KeyInfoOfIndex(tls, pParse, pIndex) + + // Open the sorter cursor if we are to use one. + iSorter = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + Xsqlite3VdbeAddOp4(tls, v, OP_SorterOpen, iSorter, 0, int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol), Xsqlite3KeyInfoRef(tls, pKey), -9) + + // Open the table. Loop through all rows of the table, inserting index + // records into the sorter. + Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iTab, 0) + regRecord = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3MultiWrite(tls, pParse) + + Xsqlite3GenerateIndexKey(tls, pParse, pIndex, iTab, regRecord, 0, bp /* &iPartIdxLabel */, uintptr(0), 0) + Xsqlite3VdbeAddOp2(tls, v, OP_SorterInsert, iSorter, regRecord) + Xsqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp /* iPartIdxLabel */))) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iTab, (addr1 + 1)) + Xsqlite3VdbeJumpHere(tls, v, addr1) + if memRootPage < 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(tnum), iDb) + } + Xsqlite3VdbeAddOp4(tls, v, OP_OpenWrite, iIdx, int32(tnum), iDb, + pKey, -9) + Xsqlite3VdbeChangeP5(tls, v, (uint16(OPFLAG_BULKCSR | (func() int32 { + if memRootPage >= 0 { + return OPFLAG_P2ISREG + } + return 0 + }())))) + + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_SorterSort, iSorter, 0) + if int32((*Index)(unsafe.Pointer((pIndex))).FonError) != OE_None { + var j2 int32 = Xsqlite3VdbeGoto(tls, v, 1) + addr2 = Xsqlite3VdbeCurrentAddr(tls, v) + + Xsqlite3VdbeAddOp4Int(tls, v, OP_SorterCompare, iSorter, j2, regRecord, + int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol)) + Xsqlite3UniqueConstraint(tls, pParse, OE_Abort, pIndex) + Xsqlite3VdbeJumpHere(tls, v, j2) + } else { + // Most CREATE INDEX and REINDEX statements that are not UNIQUE can not + // abort. The exception is if one of the indexed expressions contains a + // user function that throws an exception when it is evaluated. But the + // overhead of adding a statement journal to a CREATE INDEX statement is + // very small (since most of the pages written do not contain content that + // needs to be restored if the statement aborts), so we call + // sqlite3MayAbort() for all CREATE INDEX statements. + Xsqlite3MayAbort(tls, pParse) + addr2 = Xsqlite3VdbeCurrentAddr(tls, v) + } + Xsqlite3VdbeAddOp3(tls, v, OP_SorterData, iSorter, regRecord, iIdx) + if !((int32(*(*uint16)(unsafe.Pointer(pIndex + 100 /* &.bAscKeyBug */)) & 0x200 >> 9)) != 0) { + // This OP_SeekEnd opcode makes index insert for a REINDEX go much + // faster by avoiding unnecessary seeks. But the optimization does + // not work for UNIQUE constraint indexes on WITHOUT ROWID tables + // with DESC primary keys, since those indexes have there keys in + // a different order from the main table. + // See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf + Xsqlite3VdbeAddOp1(tls, v, OP_SeekEnd, iIdx) + } + Xsqlite3VdbeAddOp2(tls, v, OP_IdxInsert, iIdx, regRecord) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + Xsqlite3ReleaseTempReg(tls, pParse, regRecord) + Xsqlite3VdbeAddOp2(tls, v, OP_SorterNext, iSorter, addr2) + Xsqlite3VdbeJumpHere(tls, v, addr1) + + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iTab) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iIdx) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iSorter) +} + +// Allocate heap space to hold an Index object with nCol columns. +// +// Increase the allocation size to provide an extra nExtra bytes +// of 8-byte aligned space after the Index object and return a +// pointer to this extra space in *ppExtra. +func Xsqlite3AllocateIndexObject(tls *libc.TLS, db uintptr, nCol I16, nExtra int32, ppExtra uintptr) uintptr { /* sqlite3.c:116000:22: */ + var p uintptr // Allocated index object + var nByte int32 // Bytes of space for Index object + arrays + + nByte = (int32(((((uint64(unsafe.Sizeof(Index{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))) + (((uint64(unsafe.Sizeof(uintptr(0))) * uint64(nCol)) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) + (((((uint64(unsafe.Sizeof(LogEst(0))) * (uint64(int32(nCol) + 1))) + (uint64(unsafe.Sizeof(I16(0))) * uint64(nCol))) + (uint64(unsafe.Sizeof(U8(0))) * uint64(nCol))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))))) // Index.aSortOrder + p = Xsqlite3DbMallocZero(tls, db, (uint64(nByte + nExtra))) + if p != 0 { + var pExtra uintptr = ((p) + uintptr((((uint64(unsafe.Sizeof(Index{}))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7))))) + (*Index)(unsafe.Pointer(p)).FazColl = pExtra + pExtra += (uintptr(((uint64(unsafe.Sizeof(uintptr(0))) * uint64(nCol)) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) + (*Index)(unsafe.Pointer(p)).FaiRowLogEst = pExtra + pExtra += (uintptr(uint64(unsafe.Sizeof(LogEst(0))) * (uint64(int32(nCol) + 1)))) + (*Index)(unsafe.Pointer(p)).FaiColumn = pExtra + pExtra += (uintptr(uint64(unsafe.Sizeof(I16(0))) * uint64(nCol))) + (*Index)(unsafe.Pointer(p)).FaSortOrder = pExtra + (*Index)(unsafe.Pointer(p)).FnColumn = U16(nCol) + (*Index)(unsafe.Pointer(p)).FnKeyCol = (U16(int32(nCol) - 1)) + *(*uintptr)(unsafe.Pointer(ppExtra)) = ((p) + uintptr(nByte)) + } + return p +} + +// If expression list pList contains an expression that was parsed with +// an explicit "NULLS FIRST" or "NULLS LAST" clause, leave an error in +// pParse and return non-zero. Otherwise, return zero. +func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int32 { /* sqlite3.c:116033:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if pList != 0 { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.bNulls */)) & 0x20 >> 5))) != 0 { + var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FsortFlags + Xsqlite3ErrorMsg(tls, pParse, ts+12485, /* "unsupported use ..." */ + libc.VaList(bp, func() uintptr { + if (int32(sf) == 0) || (int32(sf) == 3) { + return ts + 12513 /* "FIRST" */ + } + return ts + 12519 /* "LAST" */ + }())) + return 1 + } + } + } + return 0 +} + +// Create a new index for an SQL table. pName1.pName2 is the name of the index +// and pTblList is the name of the table that is to be indexed. Both will +// be NULL for a primary key or an index that is created to satisfy a +// UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable +// as the table to be indexed. pParse->pNewTable is a table that is +// currently being constructed by a CREATE TABLE statement. +// +// pList is a list of columns to be indexed. pList will be NULL if this +// is a primary key or unique-constraint on the most recent column added +// to the table currently under construction. +func Xsqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pTblName uintptr, pList uintptr, onError int32, pStart uintptr, pPIWhere uintptr, sortOrder int32, ifNotExist int32, idxType U8) { /* sqlite3.c:116061:21: */ + bp := tls.Alloc(256) + defer tls.Free(256) + + var pTab uintptr // Table to be indexed + var pIndex uintptr // The index to be created + var zName uintptr // Name of the index + var nName int32 // Number of characters in zName + var i int32 + var j int32 + // var sFix DbFixer at bp+136, 96 + // For assigning database names to pTable + var sortOrderMask int32 // 1 to honor DESC in index. 0 to ignore. + var db uintptr + var pDb uintptr // The specific table containing the indexed database + var iDb int32 // Index of the database that is being written + // var pName uintptr at bp+128, 8 + // Unqualified name of the index to create + var pListItem uintptr // For looping over pList + var nExtra int32 // Space allocated for zExtra[] + var nExtraCol int32 // Number of extra columns needed + // var zExtra uintptr at bp+248, 8 + // Extra space after the Index object + var pPk uintptr + var n int32 + var pLoop uintptr + var zDb uintptr + // var prevCol Token at bp+232, 16 + + var pCol uintptr + var pExpr uintptr + var nColl int32 + var pCExpr uintptr // The i-th index expression + var requestedSortOrder int32 // ASC or DESC on the i-th expression + var zColl uintptr + var x int32 + var z1 uintptr + var z2 uintptr + var k int32 + // This routine has been called to create an automatic index as a + // result of a PRIMARY KEY or UNIQUE clause on a column definition, or + // a PRIMARY KEY or UNIQUE clause following the column definitions. + // i.e. one of: + // + // CREATE TABLE t(x PRIMARY KEY, y); + // CREATE TABLE t(x, y, UNIQUE(x, y)); + // + // Either way, check to see if the table already has such an index. If + // so, don't bother creating this one. This only applies to + // automatically created indices. Users can do as they wish with + // explicit indices. + // + // Two UNIQUE or PRIMARY KEY constraints are considered equivalent + // (and thus suppressing the second one) even if they have different + // sort orders. + // + // If there are different collating sequences or if the columns of + // the constraint occur in different orders, then the constraints are + // considered distinct and both result in separate indices. + var pIdx uintptr + var p uintptr + var n1 int32 + var v uintptr + var zStmt uintptr + var iMem int32 + var pNext uintptr + // Ensure all REPLACE indexes on pTab are at the end of the pIndex list. + // The list was already ordered when this routine was entered, so at this + // point at most a single index (the newly added index) will be out of + // order. So we have to reorder at most one index. + var ppFrom uintptr + var pThis uintptr + pTab = uintptr(0) + pIndex = uintptr(0) + zName = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)) = uintptr(0) + nExtra = 0 + *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) = uintptr(0) + pPk = uintptr(0) // PRIMARY KEY index for WITHOUT ROWID tables + + if !(((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) || ((*Parse)(unsafe.Pointer(pParse)).FnErr > 0)) { + goto __1 + } + goto exit_create_index +__1: + ; + if !((int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) && (int32(idxType) != SQLITE_IDXTYPE_PRIMARYKEY)) { + goto __2 + } + goto exit_create_index +__2: + ; + if !(SQLITE_OK != Xsqlite3ReadSchema(tls, pParse)) { + goto __3 + } + goto exit_create_index +__3: + ; + if !(Xsqlite3HasExplicitNulls(tls, pParse, pList) != 0) { + goto __4 + } + goto exit_create_index +__4: + ; + + // Find the table that is to be indexed. Return early if not found. + if !(pTblName != uintptr(0)) { + goto __5 + } + + // Use the two-part index name to determine the database + // to search for the table. 'Fix' the table name to this db + // before looking up the table. + + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+128 /* &pName */) + if !(iDb < 0) { + goto __7 + } + goto exit_create_index +__7: + ; + + // If the index name was unqualified, check if the table + // is a temp table. If so, set the database to 1. Do not do this + // if initialising a database schema. + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0)) { + goto __8 + } + pTab = Xsqlite3SrcListLookup(tls, pParse, pTblName) + if !((((*Token)(unsafe.Pointer(pName2)).Fn == uint32(0)) && (pTab != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpSchema == (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema)) { + goto __9 + } + iDb = 1 +__9: + ; +__8: + ; + + Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12524 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + if !(Xsqlite3FixSrcList(tls, bp+136 /* &sFix */, pTblName) != 0) { + goto __10 + } + // Because the parser constructs pTblName from a single identifier, + // sqlite3FixSrcList can never fail. + +__10: + ; + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), (pTblName + 8 /* &.a */)) + + if !(pTab == uintptr(0)) { + goto __11 + } + goto exit_create_index +__11: + ; + if !((iDb == 1) && ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema != (*Table)(unsafe.Pointer(pTab)).FpSchema)) { + goto __12 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+12530, /* "cannot create a ..." */ + libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto exit_create_index +__12: + ; + if !(!(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __13 + } + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) +__13: + ; + goto __6 +__5: + ; + + pTab = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if !(!(pTab != 0)) { + goto __14 + } + goto exit_create_index +__14: + ; + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) +__6: + ; + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7082 /* "sqlite_" */, 7) == 0) && + (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && + (pTblName != uintptr(0))) { + goto __15 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12580 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto exit_create_index +__15: + ; + if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { + goto __16 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12608 /* "views may not be..." */, 0) + goto exit_create_index +__16: + ; + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __17 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12633 /* "virtual tables m..." */, 0) + goto exit_create_index +__17: + ; + + // Find the name of the index. Make sure there is not already another + // index or table with the same name. + // + // Exception: If we are reading the names of permanent indices from the + // sqlite_schema table (because some other process changed the schema) and + // one of the index names collides with the name of a temporary table or + // index, then we will continue to process this index. + // + // If pName==0 it means that we are + // dealing with a primary key or UNIQUE constraint. We have to invent our + // own name. + if !(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)) != 0) { + goto __18 + } + zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + if !(zName == uintptr(0)) { + goto __20 + } + goto exit_create_index +__20: + ; + + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12524 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + goto __21 + } + goto exit_create_index +__21: + ; + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) { + goto __22 + } + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0)) { + goto __23 + } + if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { + goto __24 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12667 /* "there is already..." */, libc.VaList(bp+16, zName)) + goto exit_create_index +__24: + ; +__23: + ; + if !(Xsqlite3FindIndex(tls, db, zName, (*Db)(unsafe.Pointer(pDb)).FzDbSName) != uintptr(0)) { + goto __25 + } + if !(!(ifNotExist != 0)) { + goto __26 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12701 /* "index %s already..." */, libc.VaList(bp+24, zName)) + goto __27 +__26: + ; + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + sqlite3ForceNotReadOnly(tls, pParse) +__27: + ; + goto exit_create_index +__25: + ; +__22: + ; + goto __19 +__18: + pLoop = (*Table)(unsafe.Pointer(pTab)).FpIndex + n = 1 +__28: + if !(pLoop != 0) { + goto __30 + } + goto __29 +__29: + pLoop = (*Index)(unsafe.Pointer(pLoop)).FpNext + n++ + goto __28 + goto __30 +__30: + ; + zName = Xsqlite3MPrintf(tls, db, ts+12725 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + if !(zName == uintptr(0)) { + goto __31 + } + goto exit_create_index +__31: + ; + + // Automatic index names generated from within sqlite3_declare_vtab() + // must have names that are distinct from normal automatic index names. + // The following statement converts "sqlite3_autoindex..." into + // "sqlite3_butoindex..." in order to make the names distinct. + // The "vtab_err.test" test demonstrates the need of this statement. + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL) { + goto __32 + } + *(*int8)(unsafe.Pointer(zName + 7))++ +__32: + ; +__19: + ; + + // Check for authorization to create an index. + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) { + goto __33 + } + zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { + if (!(0 != 0)) && (iDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }(), uintptr(0), zDb) != 0) { + goto __34 + } + goto exit_create_index +__34: + ; + i = SQLITE_CREATE_INDEX + if !(!(0 != 0) && (iDb == 1)) { + goto __35 + } + i = SQLITE_CREATE_TEMP_INDEX +__35: + ; + if !(Xsqlite3AuthCheck(tls, pParse, i, zName, (*Table)(unsafe.Pointer(pTab)).FzName, zDb) != 0) { + goto __36 + } + goto exit_create_index +__36: + ; +__33: + ; + + // If pList==0, it means this routine was called to make a primary + // key out of the last column added to the table under construction. + // So create a fake list to simulate this. + if !(pList == uintptr(0)) { + goto __37 + } + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(pTab)).FnCol)-1))*32) + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_UNIQUE)) + Xsqlite3TokenInit(tls, bp+232 /* &prevCol */, (*Column)(unsafe.Pointer(pCol)).FzName) + pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+232 /* &prevCol */, 0)) + if !(pList == uintptr(0)) { + goto __39 + } + goto exit_create_index +__39: + ; + + Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) + goto __38 +__37: + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12524 /* "index" */) + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __40 + } + goto exit_create_index +__40: + ; +__38: + ; + + // Figure out how many bytes of space are required to store explicitly + // specified collation sequence names. + i = 0 +__41: + if !(i < (*ExprList)(unsafe.Pointer(pList)).FnExpr) { + goto __43 + } + pExpr = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + + if !(int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLLATE) { + goto __44 + } + nExtra = nExtra + (1 + Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) +__44: + ; + goto __42 +__42: + i++ + goto __41 + goto __43 +__43: + ; + + // Allocate the index structure. + nName = Xsqlite3Strlen30(tls, zName) + if pPk != 0 { + nExtraCol = int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + } else { + nExtraCol = 1 + } + + pIndex = Xsqlite3AllocateIndexObject(tls, db, (int16((*ExprList)(unsafe.Pointer(pList)).FnExpr + nExtraCol)), + ((nName + nExtra) + 1), bp+248 /* &zExtra */) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __45 + } + goto exit_create_index +__45: + ; + + (*Index)(unsafe.Pointer(pIndex)).FzName = *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) + *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) += (uintptr(nName + 1)) + libc.Xmemcpy(tls, (*Index)(unsafe.Pointer(pIndex)).FzName, zName, (uint64(nName + 1))) + (*Index)(unsafe.Pointer(pIndex)).FpTable = pTab + (*Index)(unsafe.Pointer(pIndex)).FonError = U8(onError) + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.uniqNotNull */, (uint32(libc.Bool32(onError != OE_None))), 3, 0x8) + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.idxType */, uint32(idxType), 0, 0x3) + (*Index)(unsafe.Pointer(pIndex)).FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + (*Index)(unsafe.Pointer(pIndex)).FnKeyCol = U16((*ExprList)(unsafe.Pointer(pList)).FnExpr) + if !(pPIWhere != 0) { + goto __46 + } + Xsqlite3ResolveSelfReference(tls, pParse, pTab, NC_PartIdx, pPIWhere, uintptr(0)) + (*Index)(unsafe.Pointer(pIndex)).FpPartIdxWhere = pPIWhere + pPIWhere = uintptr(0) +__46: + ; + + // Check to see if we should honor DESC requests on index columns + if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) >= 4) { + goto __47 + } + sortOrderMask = -1 // Honor DESC + goto __48 +__47: + sortOrderMask = 0 // Ignore DESC +__48: + ; + + // Analyze the list of expressions that form the terms of the index and + // report any errors. In the common case where the expression is exactly + // a table column, store that column in aiColumn[]. For general expressions, + // populate pIndex->aColExpr and store XN_EXPR (-2) in aiColumn[]. + // + // TODO: Issue a warning if two or more columns of the index are identical. + // TODO: Issue a warning if the table primary key is used as part of the + // index key. + pListItem = pList + 8 /* &.a */ + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __49 + } + (*Index)(unsafe.Pointer(pIndex)).FaColExpr = pList + pList = uintptr(0) +__49: + ; + i = 0 +__50: + if !(i < int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol)) { + goto __52 + } // Collation sequence name + + sqlite3StringToId(tls, (*ExprList_item)(unsafe.Pointer(pListItem)).FpExpr) + Xsqlite3ResolveSelfReference(tls, pParse, pTab, NC_IdxExpr, (*ExprList_item)(unsafe.Pointer(pListItem)).FpExpr, uintptr(0)) + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __53 + } + goto exit_create_index +__53: + ; + pCExpr = Xsqlite3ExprSkipCollate(tls, (*ExprList_item)(unsafe.Pointer(pListItem)).FpExpr) + if !(int32((*Expr)(unsafe.Pointer(pCExpr)).Fop) != TK_COLUMN) { + goto __54 + } + if !(pTab == (*Parse)(unsafe.Pointer(pParse)).FpNewTable) { + goto __56 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+12748 /* "expressions proh..." */, 0) + goto exit_create_index +__56: + ; + if !((*Index)(unsafe.Pointer(pIndex)).FaColExpr == uintptr(0)) { + goto __57 + } + (*Index)(unsafe.Pointer(pIndex)).FaColExpr = pList + pList = uintptr(0) +__57: + ; + j = -2 + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(-2) + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.uniqNotNull */, uint32(0), 3, 0x8) + goto __55 +__54: + j = int32((*Expr)(unsafe.Pointer(pCExpr)).FiColumn) + + if !(j < 0) { + goto __58 + } + j = int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + goto __59 +__58: + if !(int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FnotNull) == 0) { + goto __60 + } + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.uniqNotNull */, uint32(0), 3, 0x8) +__60: + ; + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0) { + goto __61 + } + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bHasVCol */, uint32(1), 10, 0x400) +__61: + ; +__59: + ; + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = I16(j) +__55: + ; + zColl = uintptr(0) + if !(int32((*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer(pListItem)).FpExpr)).Fop) == TK_COLLATE) { + goto __62 + } + zColl = *(*uintptr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer(pListItem)).FpExpr + 8 /* &.u */)) + nColl = (Xsqlite3Strlen30(tls, zColl) + 1) + + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)), zColl, uint64(nColl)) + zColl = *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) + *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) += uintptr(nColl) + nExtra = nExtra - (nColl) + goto __63 +__62: + if !(j >= 0) { + goto __64 + } + zColl = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzColl +__64: + ; +__63: + ; + if !(!(zColl != 0)) { + goto __65 + } + zColl = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) +__65: + ; + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0) && !(Xsqlite3LocateCollSeq(tls, pParse, zColl) != 0)) { + goto __66 + } + goto exit_create_index +__66: + ; + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = zColl + requestedSortOrder = (int32((*ExprList_item)(unsafe.Pointer(pListItem)).FsortFlags) & sortOrderMask) + *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = U8(requestedSortOrder) + goto __51 +__51: + i++ + pListItem += 32 + goto __50 + goto __52 +__52: + ; + + // Append the table key to the end of the index. For WITHOUT ROWID + // tables (when pPk!=0) this will be the declared PRIMARY KEY. For + // normal tables (when pPk==0) this will be the rowid. + if !(pPk != 0) { + goto __67 + } + j = 0 +__69: + if !(j < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) { + goto __71 + } + x = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2))) + + if !(isDupColumn(tls, pIndex, int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol), pPk, j) != 0) { + goto __72 + } + (*Index)(unsafe.Pointer(pIndex)).FnColumn-- + goto __73 +__72: + ; + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = I16(x) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(j)*8)) + *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(i))) = *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaSortOrder + uintptr(j))) + i++ +__73: + ; + goto __70 +__70: + j++ + goto __69 + goto __71 +__71: + ; + + goto __68 +__67: + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2)) = int16(-1) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) +__68: + ; + Xsqlite3DefaultRowEst(tls, pIndex) + if !((*Parse)(unsafe.Pointer(pParse)).FpNewTable == uintptr(0)) { + goto __74 + } + estimateIndexWidth(tls, pIndex) +__74: + ; + + // If this index contains every column of its table, then mark + // it as a covering index + + recomputeColumnsNotIndexed(tls, pIndex) + if !((pTblName != uintptr(0)) && (int32((*Index)(unsafe.Pointer(pIndex)).FnColumn) >= int32((*Table)(unsafe.Pointer(pTab)).FnCol))) { + goto __75 + } + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.isCovering */, uint32(1), 5, 0x20) + j = 0 +__76: + if !(j < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __78 + } + if !(j == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __79 + } + goto __77 +__79: + ; + if !(int32(Xsqlite3TableColumnToIndex(tls, pIndex, int16(j))) >= 0) { + goto __80 + } + goto __77 +__80: + ; + libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.isCovering */, uint32(0), 5, 0x20) + goto __78 + goto __77 +__77: + j++ + goto __76 + goto __78 +__78: + ; +__75: + ; + + if !(pTab == (*Parse)(unsafe.Pointer(pParse)).FpNewTable) { + goto __81 + } + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__82: + if !(pIdx != 0) { + goto __84 + } + + if !(int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) != int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol)) { + goto __85 + } + goto __83 +__85: + ; + k = 0 +__86: + if !(k < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)) { + goto __88 + } + + if !(int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(k)*2))) != int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(k)*2)))) { + goto __89 + } + goto __88 +__89: + ; + z1 = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(k)*8)) + z2 = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FazColl + uintptr(k)*8)) + if !(Xsqlite3StrICmp(tls, z1, z2) != 0) { + goto __90 + } + goto __88 +__90: + ; + goto __87 +__87: + k++ + goto __86 + goto __88 +__88: + ; + if !(k == int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)) { + goto __91 + } + if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) != int32((*Index)(unsafe.Pointer(pIndex)).FonError)) { + goto __92 + } + // This constraint creates the same index as a previous + // constraint specified somewhere in the CREATE TABLE statement. + // However the ON CONFLICT clauses are different. If both this + // constraint and the previous equivalent constraint have explicit + // ON CONFLICT clauses this is an error. Otherwise, use the + // explicitly specified behavior for the index. + if !(!((int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) || (int32((*Index)(unsafe.Pointer(pIndex)).FonError) == OE_Default))) { + goto __93 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+12809 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) +__93: + ; + if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { + goto __94 + } + (*Index)(unsafe.Pointer(pIdx)).FonError = (*Index)(unsafe.Pointer(pIndex)).FonError +__94: + ; +__92: + ; + if !(int32(idxType) == SQLITE_IDXTYPE_PRIMARYKEY) { + goto __95 + } + libc.SetBitFieldPtr16Uint32(pIdx+100 /* &.idxType */, uint32(idxType), 0, 0x3) +__95: + ; + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __96 + } + (*Index)(unsafe.Pointer(pIndex)).FpNext = (*Parse)(unsafe.Pointer(pParse)).FpNewIndex + (*Parse)(unsafe.Pointer(pParse)).FpNewIndex = pIndex + pIndex = uintptr(0) +__96: + ; + goto exit_create_index +__91: + ; + goto __83 +__83: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __82 + goto __84 +__84: + ; +__81: + ; + + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) { + goto __97 + } + + // Link the new Index structure to its table and to the other + // in-memory database structures. + + if !((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) { + goto __98 + } + + if !(pTblName != uintptr(0)) { + goto __100 + } + (*Index)(unsafe.Pointer(pIndex)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum + if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { + goto __101 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12851 /* "invalid rootpage" */, 0) + (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) + goto exit_create_index +__101: + ; +__100: + ; + p = Xsqlite3HashInsert(tls, ((*Index)(unsafe.Pointer(pIndex)).FpSchema + 32 /* &.idxHash */), + (*Index)(unsafe.Pointer(pIndex)).FzName, pIndex) + if !(p != 0) { + goto __102 + } + // Malloc must have failed + Xsqlite3OomFault(tls, db) + goto exit_create_index +__102: + ; + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) + goto __99 +__98: + if !((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || (pTblName != uintptr(0))) { + goto __103 + } + iMem = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + + v = Xsqlite3GetVdbe(tls, pParse) + if !(v == uintptr(0)) { + goto __104 + } + goto exit_create_index +__104: + ; + + Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) + + // Create the rootpage for the index using CreateIndex. But before + // doing so, code a Noop instruction and store its address in + // Index.tnum. This is required in case this index is actually a + // PRIMARY KEY and the table is actually a WITHOUT ROWID table. In + // that case the convertToWithoutRowidTable() routine will replace + // the Noop with a Goto to jump over the VDBE code generated below. + (*Index)(unsafe.Pointer(pIndex)).Ftnum = Pgno(Xsqlite3VdbeAddOp0(tls, v, OP_Noop)) + Xsqlite3VdbeAddOp3(tls, v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY) + + // Gather the complete text of the CREATE INDEX statement into + // the zStmt variable + + if !(pStart != 0) { + goto __105 + } + n1 = (int32(uint32((int32((int64((*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fz) - int64((*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) / 1))) + (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fn)) + if !(int32(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz + uintptr((n1 - 1))))) == ';') { + goto __107 + } + n1-- +__107: + ; + // A named index with an explicit CREATE INDEX statement + zStmt = Xsqlite3MPrintf(tls, db, ts+12868, /* "CREATE%s INDEX %..." */ + libc.VaList(bp+56, func() uintptr { + if onError == OE_None { + return ts + 756 /* "" */ + } + return ts + 12888 /* " UNIQUE" */ + }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) + goto __106 +__105: + // An automatic index created by a PRIMARY KEY or UNIQUE constraint + // zStmt = sqlite3MPrintf(""); + zStmt = uintptr(0) +__106: + ; + + // Add an entry in sqlite_schema for this index + Xsqlite3NestedParse(tls, pParse, + ts+12896, /* "INSERT INTO %Q.s..." */ + libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, + (*Index)(unsafe.Pointer(pIndex)).FzName, + (*Table)(unsafe.Pointer(pTab)).FzName, + iMem, + zStmt)) + Xsqlite3DbFree(tls, db, zStmt) + + // Fill the index with data and reparse the schema. Code an OP_Expire + // to invalidate all pre-compiled statements. + if !(pTblName != 0) { + goto __108 + } + sqlite3RefillIndex(tls, pParse, pIndex, iMem) + Xsqlite3ChangeCookie(tls, pParse, iDb) + Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, + Xsqlite3MPrintf(tls, db, ts+12955 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) +__108: + ; + + Xsqlite3VdbeJumpHere(tls, v, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum)) +__103: + ; +__99: + ; +__97: + ; + if !(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) || (pTblName == uintptr(0))) { + goto __109 + } + (*Index)(unsafe.Pointer(pIndex)).FpNext = (*Table)(unsafe.Pointer(pTab)).FpIndex + (*Table)(unsafe.Pointer(pTab)).FpIndex = pIndex + pIndex = uintptr(0) + goto __110 +__109: + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __111 + } + + (*Parse)(unsafe.Pointer(pParse)).FpNewIndex = pIndex + pIndex = uintptr(0) +__111: + ; +__110: + ; + + // Clean up before exiting +exit_create_index: + if !(pIndex != 0) { + goto __112 + } + Xsqlite3FreeIndex(tls, db, pIndex) +__112: + ; + if !(pTab != 0) { + goto __113 + } + // Ensure all REPLACE indexes on pTab are at the end of the pIndex list. + // The list was already ordered when this routine was entered, so at this + // point at most a single index (the newly added index) will be out of + // order. So we have to reorder at most one index. + ppFrom = (pTab + 16 /* &.pIndex */) + ppFrom = (pTab + 16 /* &.pIndex */) +__114: + if !((libc.AssignUintptr(&pThis, *(*uintptr)(unsafe.Pointer(ppFrom)))) != uintptr(0)) { + goto __116 + } + if !(int32((*Index)(unsafe.Pointer(pThis)).FonError) != OE_Replace) { + goto __117 + } + goto __115 +__117: + ; +__118: + if !(((libc.AssignUintptr(&pNext, (*Index)(unsafe.Pointer(pThis)).FpNext)) != uintptr(0)) && (int32((*Index)(unsafe.Pointer(pNext)).FonError) != OE_Replace)) { + goto __119 + } + *(*uintptr)(unsafe.Pointer(ppFrom)) = pNext + (*Index)(unsafe.Pointer(pThis)).FpNext = (*Index)(unsafe.Pointer(pNext)).FpNext + (*Index)(unsafe.Pointer(pNext)).FpNext = pThis + ppFrom = (pNext + 40 /* &.pNext */) + goto __118 +__119: + ; + goto __116 + goto __115 +__115: + ppFrom = (pThis + 40 /* &.pNext */) + goto __114 + goto __116 +__116: + ; +__113: + ; + Xsqlite3ExprDelete(tls, db, pPIWhere) + Xsqlite3ExprListDelete(tls, db, pList) + Xsqlite3SrcListDelete(tls, db, pTblName) + Xsqlite3DbFree(tls, db, zName) +} + +// Fill the Index.aiRowEst[] array with default information - information +// to be used when we have not run the ANALYZE command. +// +// aiRowEst[0] is supposed to contain the number of elements in the index. +// Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the +// number of rows in the table that match any particular value of the +// first column of the index. aiRowEst[2] is an estimate of the number +// of rows that match any particular combination of the first 2 columns +// of the index. And so forth. It must always be the case that +// +// aiRowEst[N]<=aiRowEst[N-1] +// aiRowEst[N]>=1 +// +// Apart from that, we have little to go on besides intuition as to +// how aiRowEst[] should be initialized. The numbers generated here +// are based on typical values found in actual indices. +func Xsqlite3DefaultRowEst(tls *libc.TLS, pIdx uintptr) { /* sqlite3.c:116669:21: */ + var a uintptr = (*Index)(unsafe.Pointer(pIdx)).FaiRowLogEst + var x LogEst + var nCopy int32 = func() int32 { + if (int32(uint64(unsafe.Sizeof(aVal)) / uint64(unsafe.Sizeof(LogEst(0))))) < (int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)) { + return (int32(uint64(unsafe.Sizeof(aVal)) / uint64(unsafe.Sizeof(LogEst(0))))) + } + return int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + }() + var i int32 + + // Indexes with default row estimates should not have stat1 data + + // Set the first entry (number of rows in the index) to the estimated + // number of rows in the table, or half the number of rows in the table + // for a partial index. + // + // 2020-05-27: If some of the stat data is coming from the sqlite_stat1 + // table but other parts we are having to guess at, then do not let the + // estimated number of rows in the table be less than 1000 (LogEst 99). + // Failure to do this can cause the indexes for which we do not have + // stat1 data to be ignored by the query planner. + x = (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FnRowLogEst + + if int32(x) < 99 { + (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FnRowLogEst = libc.AssignInt16(&x, int16(99)) + } + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0) { + x = int16(int32(x) - (10)) + } + *(*LogEst)(unsafe.Pointer(a)) = x + + // Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is + // 6 and each subsequent value (if any) is 5. + libc.Xmemcpy(tls, (a + 1*2), uintptr(unsafe.Pointer(&aVal)), (uint64(nCopy) * uint64(unsafe.Sizeof(LogEst(0))))) + for i = (nCopy + 1); i <= int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); i++ { + *(*LogEst)(unsafe.Pointer(a + uintptr(i)*2)) = int16(23) + } + + if int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None { + *(*LogEst)(unsafe.Pointer(a + uintptr((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)*2)) = int16(0) + } +} + +var aVal = [5]LogEst{int16(33), int16(32), int16(30), int16(28), int16(26)} /* sqlite3.c:116671:23 */ + +// This routine will drop an existing named index. This routine +// implements the DROP INDEX statement. +func Xsqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists int32) { /* sqlite3.c:116713:21: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pIndex uintptr + var v uintptr + var db uintptr + var iDb int32 + var code int32 + var pTab uintptr + var zDb uintptr + var zTab uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + // Never called with prior errors + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __1 + } + goto exit_drop_index +__1: + ; + + if !(SQLITE_OK != Xsqlite3ReadSchema(tls, pParse)) { + goto __2 + } + goto exit_drop_index +__2: + ; + pIndex = Xsqlite3FindIndex(tls, db, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzName, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) + if !(pIndex == uintptr(0)) { + goto __3 + } + if !(!(ifExists != 0)) { + goto __4 + } + Xsqlite3ErrorMsg(tls, pParse, ts+12982 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + goto __5 +__4: + Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) + sqlite3ForceNotReadOnly(tls, pParse) +__5: + ; + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + goto exit_drop_index +__3: + ; + if !((int32(*(*uint16)(unsafe.Pointer(pIndex + 100 /* &.idxType */)) & 0x3 >> 0)) != SQLITE_IDXTYPE_APPDEF) { + goto __6 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+13000 /* "index associated..." */, libc.VaList(bp+8, 0)) + goto exit_drop_index +__6: + ; + iDb = Xsqlite3SchemaToIndex(tls, db, (*Index)(unsafe.Pointer(pIndex)).FpSchema) + + code = SQLITE_DROP_INDEX + pTab = (*Index)(unsafe.Pointer(pIndex)).FpTable + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + zTab = func() uintptr { + if (!(0 != 0)) && (iDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }() + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { + goto __7 + } + goto exit_drop_index +__7: + ; + if !(!(0 != 0) && (iDb == 1)) { + goto __8 + } + code = SQLITE_DROP_TEMP_INDEX +__8: + ; + if !(Xsqlite3AuthCheck(tls, pParse, code, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, zDb) != 0) { + goto __9 + } + goto exit_drop_index +__9: + ; + + // Generate code to remove the index and from the schema table + v = Xsqlite3GetVdbe(tls, pParse) + if !(v != 0) { + goto __10 + } + Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) + Xsqlite3NestedParse(tls, pParse, + ts+13073, /* "DELETE FROM %Q.s..." */ + libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10213 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + Xsqlite3ChangeCookie(tls, pParse, iDb) + destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) + Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) +__10: + ; + +exit_drop_index: + Xsqlite3SrcListDelete(tls, db, pName) +} + +// pArray is a pointer to an array of objects. Each object in the +// array is szEntry bytes in size. This routine uses sqlite3DbRealloc() +// to extend the array so that there is space for a new object at the end. +// +// When this function is called, *pnEntry contains the current size of +// the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes +// in total). +// +// If the realloc() is successful (i.e. if no OOM condition occurs), the +// space allocated for the new object is zeroed, *pnEntry updated to +// reflect the new size of the array and a pointer to the new allocation +// returned. *pIdx is set to the index of the new array entry in this case. +// +// Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains +// unchanged and a copy of pArray returned. +func Xsqlite3ArrayAllocate(tls *libc.TLS, db uintptr, pArray uintptr, szEntry int32, pnEntry uintptr, pIdx uintptr) uintptr { /* sqlite3.c:116795:21: */ + var z uintptr + var n Sqlite3_int64 = Sqlite3_int64(libc.AssignPtrInt32(pIdx, *(*int32)(unsafe.Pointer(pnEntry)))) + if (n & (n - int64(1))) == int64(0) { + var sz Sqlite3_int64 + if n == int64(0) { + sz = int64(1) + } else { + sz = (int64(2) * n) + } + var pNew uintptr = Xsqlite3DbRealloc(tls, db, pArray, (uint64(sz * Sqlite3_int64(szEntry)))) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(pIdx)) = -1 + return pArray + } + pArray = pNew + } + z = pArray + libc.Xmemset(tls, (z + uintptr((n * Sqlite3_int64(szEntry)))), 0, uint64(szEntry)) + *(*int32)(unsafe.Pointer(pnEntry))++ + return pArray +} + +// Append a new element to the given IdList. Create a new IdList if +// need be. +// +// A new IdList is returned, or NULL if malloc() fails. +func Xsqlite3IdListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pToken uintptr) uintptr { /* sqlite3.c:116825:23: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + // var i int32 at bp, 4 + + if pList == uintptr(0) { + pList = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(IdList{}))) + if pList == uintptr(0) { + return uintptr(0) + } + } + (*IdList)(unsafe.Pointer(pList)).Fa = Xsqlite3ArrayAllocate(tls, + db, + (*IdList)(unsafe.Pointer(pList)).Fa, + int32(unsafe.Sizeof(IdList_item{})), + (pList + 8 /* &.nId */), + bp /* &i */) + if *(*int32)(unsafe.Pointer(bp /* i */)) < 0 { + Xsqlite3IdListDelete(tls, db, pList) + return uintptr(0) + } + (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp /* i */)))*16)).FzName = Xsqlite3NameFromToken(tls, db, pToken) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && ((*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa+uintptr(*(*int32)(unsafe.Pointer(bp /* i */)))*16)).FzName != 0) { + Xsqlite3RenameTokenMap(tls, pParse, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa+uintptr(*(*int32)(unsafe.Pointer(bp /* i */)))*16)).FzName, pToken) + } + return pList +} + +// Delete an IdList. +func Xsqlite3IdListDelete(tls *libc.TLS, db uintptr, pList uintptr) { /* sqlite3.c:116853:21: */ + var i int32 + if pList == uintptr(0) { + return + } + for i = 0; i < (*IdList)(unsafe.Pointer(pList)).FnId; i++ { + Xsqlite3DbFree(tls, db, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa+uintptr(i)*16)).FzName) + } + Xsqlite3DbFree(tls, db, (*IdList)(unsafe.Pointer(pList)).Fa) + Xsqlite3DbFreeNN(tls, db, pList) +} + +// Return the index in pList of the identifier named zId. Return -1 +// if not found. +func Xsqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) int32 { /* sqlite3.c:116867:20: */ + var i int32 + if pList == uintptr(0) { + return -1 + } + for i = 0; i < (*IdList)(unsafe.Pointer(pList)).FnId; i++ { + if Xsqlite3StrICmp(tls, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa+uintptr(i)*16)).FzName, zName) == 0 { + return i + } + } + return -1 +} + +// Maximum size of a SrcList object. +// The SrcList object is used to represent the FROM clause of a +// SELECT statement, and the query planner cannot deal with more +// than 64 tables in a join. So any value larger than 64 here +// is sufficient for most uses. Smaller values, like say 10, are +// appropriate for small and memory-limited applications. + +// Expand the space allocated for the given SrcList object by +// creating nExtra new slots beginning at iStart. iStart is zero based. +// New slots are zeroed. +// +// For example, suppose a SrcList initially contains two entries: A,B. +// To append 3 new entries onto the end, do this: +// +// sqlite3SrcListEnlarge(db, pSrclist, 3, 2); +// +// After the call above it would contain: A, B, nil, nil, nil. +// If the iStart argument had been 1 instead of 2, then the result +// would have been: A, nil, nil, nil, B. To prepend the new slots, +// the iStart value would be 0. The result then would +// be: nil, nil, nil, A, B. +// +// If a memory allocation fails or the SrcList becomes too large, leave +// the original SrcList unchanged, return NULL, and leave an error message +// in pParse. +func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra int32, iStart int32) uintptr { /* sqlite3.c:116908:24: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + + // Sanity checking on calling parameters + + // Allocate additional space if needed + if (U32((*SrcList)(unsafe.Pointer(pSrc)).FnSrc) + U32(nExtra)) > (*SrcList)(unsafe.Pointer(pSrc)).FnAlloc { + var pNew uintptr + var nAlloc Sqlite3_int64 = ((int64(2) * Sqlite3_int64((*SrcList)(unsafe.Pointer(pSrc)).FnSrc)) + Sqlite3_int64(nExtra)) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { + Xsqlite3ErrorMsg(tls, pParse, ts+13133, /* "too many FROM cl..." */ + libc.VaList(bp, SQLITE_MAX_SRCLIST)) + return uintptr(0) + } + if nAlloc > int64(SQLITE_MAX_SRCLIST) { + nAlloc = int64(SQLITE_MAX_SRCLIST) + } + pNew = Xsqlite3DbRealloc(tls, db, pSrc, + (uint64(unsafe.Sizeof(SrcList{})) + ((uint64(nAlloc - int64(1))) * uint64(unsafe.Sizeof(SrcItem{}))))) + if pNew == uintptr(0) { + + return uintptr(0) + } + pSrc = pNew + (*SrcList)(unsafe.Pointer(pSrc)).FnAlloc = U32(nAlloc) + } + + // Move existing slots that come after the newly inserted slots + // out of the way + for i = ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc - 1); i >= iStart; i-- { + *(*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr((i+nExtra))*112)) = *(*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(i)*112)) + } + *(*int32)(unsafe.Pointer(pSrc /* &.nSrc */)) += (nExtra) + + // Zero the newly allocated slots + libc.Xmemset(tls, ((pSrc + 8 /* &.a */) + uintptr(iStart)*112), 0, (uint64(unsafe.Sizeof(SrcItem{})) * uint64(nExtra))) + for i = iStart; i < (iStart + nExtra); i++ { + (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(i)*112)).FiCursor = -1 + } + + // Return a pointer to the enlarged SrcList + return pSrc +} + +// Append a new table name to the given SrcList. Create a new SrcList if +// need be. A new entry is created in the SrcList even if pTable is NULL. +// +// A SrcList is returned, or NULL if there is an OOM error or if the +// SrcList grows to large. The returned +// SrcList might be the same as the SrcList that was input or it might be +// a new one. If an OOM error does occurs, then the prior value of pList +// that is input to this routine is automatically freed. +// +// If pDatabase is not null, it means that the table has an optional +// database name prefix. Like this: "database.table". The pDatabase +// points to the table name and the pTable points to the database name. +// The SrcList.a[].zName field is filled with the table name which might +// come from pTable (if pDatabase is NULL) or from pDatabase. +// SrcList.a[].zDatabase is filled with the database name from pTable, +// or with NULL if no database is specified. +// +// In other words, if call like this: +// +// sqlite3SrcListAppend(D,A,B,0); +// +// Then B is a table name and the database name is unspecified. If called +// like this: +// +// sqlite3SrcListAppend(D,A,B,C); +// +// Then C is the table name and B is the database name. If C is defined +// then so is B. In other words, we never have a case where: +// +// sqlite3SrcListAppend(D,A,0,C); +// +// Both pTable and pDatabase are assumed to be quoted. They are dequoted +// before being added to the SrcList. +func Xsqlite3SrcListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pTable uintptr, pDatabase uintptr) uintptr { /* sqlite3.c:116997:24: */ + var pItem uintptr + var db uintptr + // Cannot have C without B + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if pList == uintptr(0) { + pList = Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(SrcList{}))) + if pList == uintptr(0) { + return uintptr(0) + } + (*SrcList)(unsafe.Pointer(pList)).FnAlloc = U32(1) + (*SrcList)(unsafe.Pointer(pList)).FnSrc = 1 + libc.Xmemset(tls, (pList + 8 /* &.a */), 0, uint64(unsafe.Sizeof(SrcItem{}))) + (*SrcItem)(unsafe.Pointer((pList + 8 /* &.a */))).FiCursor = -1 + } else { + var pNew uintptr = Xsqlite3SrcListEnlarge(tls, pParse, pList, 1, (*SrcList)(unsafe.Pointer(pList)).FnSrc) + if pNew == uintptr(0) { + Xsqlite3SrcListDelete(tls, db, pList) + return uintptr(0) + } else { + pList = pNew + } + } + pItem = ((pList + 8 /* &.a */) + uintptr(((*SrcList)(unsafe.Pointer(pList)).FnSrc-1))*112) + if (pDatabase != 0) && ((*Token)(unsafe.Pointer(pDatabase)).Fz == uintptr(0)) { + pDatabase = uintptr(0) + } + if pDatabase != 0 { + (*SrcItem)(unsafe.Pointer(pItem)).FzName = Xsqlite3NameFromToken(tls, db, pDatabase) + (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase = Xsqlite3NameFromToken(tls, db, pTable) + } else { + (*SrcItem)(unsafe.Pointer(pItem)).FzName = Xsqlite3NameFromToken(tls, db, pTable) + (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase = uintptr(0) + } + return pList +} + +// Assign VdbeCursor index numbers to all tables in a SrcList +func Xsqlite3SrcListAssignCursors(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sqlite3.c:117042:21: */ + var i int32 + var pItem uintptr + + if pList != 0 { + i = 0 + pItem = pList + 8 /* &.a */ + __1: + if !(i < (*SrcList)(unsafe.Pointer(pList)).FnSrc) { + goto __3 + } + { + if (*SrcItem)(unsafe.Pointer(pItem)).FiCursor >= 0 { + goto __2 + } + (*SrcItem)(unsafe.Pointer(pItem)).FiCursor = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + if (*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0 { + Xsqlite3SrcListAssignCursors(tls, pParse, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FpSrc) + } + + } + goto __2 + __2: + i++ + pItem += 112 + goto __1 + goto __3 + __3: + } +} + +// Delete an entire SrcList including all its substructure. +func Xsqlite3SrcListDelete(tls *libc.TLS, db uintptr, pList uintptr) { /* sqlite3.c:117060:21: */ + var i int32 + var pItem uintptr + if pList == uintptr(0) { + return + } + pItem = pList + 8 /* &.a */ + i = 0 +__1: + if !(i < (*SrcList)(unsafe.Pointer(pList)).FnSrc) { + goto __3 + } + { + if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { + Xsqlite3DbFreeNN(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) + } + Xsqlite3DbFree(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzName) + if (*SrcItem)(unsafe.Pointer(pItem)).FzAlias != 0 { + Xsqlite3DbFreeNN(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzAlias) + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pItem + 60 /* &.fg */ + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0 { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */))) + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pItem + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { + Xsqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */))) + } + Xsqlite3DeleteTable(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FpTab) + if (*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0 { + Xsqlite3SelectDelete(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FpSelect) + } + if (*SrcItem)(unsafe.Pointer(pItem)).FpOn != 0 { + Xsqlite3ExprDelete(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FpOn) + } + if (*SrcItem)(unsafe.Pointer(pItem)).FpUsing != 0 { + Xsqlite3IdListDelete(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FpUsing) + } + + } + goto __2 +__2: + i++ + pItem += 112 + goto __1 + goto __3 +__3: + ; + Xsqlite3DbFreeNN(tls, db, pList) +} + +// This routine is called by the parser to add a new term to the +// end of a growing FROM clause. The "p" parameter is the part of +// the FROM clause that has already been constructed. "p" is NULL +// if this is the first term of the FROM clause. pTable and pDatabase +// are the name of the table and database named in the FROM clause term. +// pDatabase is NULL if the database name qualifier is missing - the +// usual case. If the term has an alias, then pAlias points to the +// alias token. If the term is a subquery, then pSubquery is the +// SELECT statement that the subquery encodes. The pTable and +// pDatabase parameters are NULL for subqueries. The pOn and pUsing +// parameters are the content of the ON and USING clauses. +// +// Return a new SrcList which encodes is the FROM with the new +// term added. +func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTable uintptr, pDatabase uintptr, pAlias uintptr, pSubquery uintptr, pOn uintptr, pUsing uintptr) uintptr { /* sqlite3.c:117094:24: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pItem uintptr + var db uintptr + var pToken uintptr + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { + goto __1 + } + Xsqlite3ErrorMsg(tls, pParse, ts+13169, /* "a JOIN clause is..." */ + libc.VaList(bp, func() uintptr { + if pOn != 0 { + return ts + 13205 /* "ON" */ + } + return ts + 13208 /* "USING" */ + }())) + goto append_from_error +__1: + ; + p = Xsqlite3SrcListAppend(tls, pParse, p, pTable, pDatabase) + if !(p == uintptr(0)) { + goto __2 + } + goto append_from_error +__2: + ; + + pItem = ((p + 8 /* &.a */) + uintptr(((*SrcList)(unsafe.Pointer(p)).FnSrc-1))*112) + + if !((int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && ((*SrcItem)(unsafe.Pointer(pItem)).FzName != 0)) { + goto __3 + } + if (pDatabase != 0) && ((*Token)(unsafe.Pointer(pDatabase)).Fz != 0) { + pToken = pDatabase + } else { + pToken = pTable + } + Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer(pItem)).FzName, pToken) +__3: + ; + + if !((*Token)(unsafe.Pointer(pAlias)).Fn != 0) { + goto __4 + } + (*SrcItem)(unsafe.Pointer(pItem)).FzAlias = Xsqlite3NameFromToken(tls, db, pAlias) +__4: + ; + (*SrcItem)(unsafe.Pointer(pItem)).FpSelect = pSubquery + (*SrcItem)(unsafe.Pointer(pItem)).FpOn = pOn + (*SrcItem)(unsafe.Pointer(pItem)).FpUsing = pUsing + return p + +append_from_error: + ; + Xsqlite3ExprDelete(tls, db, pOn) + Xsqlite3IdListDelete(tls, db, pUsing) + Xsqlite3SelectDelete(tls, db, pSubquery) + return uintptr(0) +} + +// Add an INDEXED BY or NOT INDEXED clause to the most recently added +// element of the source-list passed as the second argument. +func Xsqlite3SrcListIndexedBy(tls *libc.TLS, pParse uintptr, p uintptr, pIndexedBy uintptr) { /* sqlite3.c:117145:21: */ + + if (p != 0) && ((*Token)(unsafe.Pointer(pIndexedBy)).Fn > uint32(0)) { + var pItem uintptr + + pItem = ((p + 8 /* &.a */) + uintptr(((*SrcList)(unsafe.Pointer(p)).FnSrc-1))*112) + + if ((*Token)(unsafe.Pointer(pIndexedBy)).Fn == uint32(1)) && !(int32((*Token)(unsafe.Pointer(pIndexedBy)).Fz) != 0) { + // A "NOT INDEXED" clause was supplied. See parse.y + // construct "indexed_opt" for details. + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.notIndexed */, uint32(1), 0, 0x1) + } else { + *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */)) = Xsqlite3NameFromToken(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pIndexedBy) + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isIndexedBy */, uint32(1), 1, 0x2) + } + } +} + +// Append the contents of SrcList p2 to SrcList p1 and return the resulting +// SrcList. Or, if an error occurs, return NULL. In all cases, p1 and p2 +// are deleted by this function. +func Xsqlite3SrcListAppendList(tls *libc.TLS, pParse uintptr, p1 uintptr, p2 uintptr) uintptr { /* sqlite3.c:117170:24: */ + + if p2 != 0 { + var pNew uintptr = Xsqlite3SrcListEnlarge(tls, pParse, p1, (*SrcList)(unsafe.Pointer(p2)).FnSrc, 1) + if pNew == uintptr(0) { + Xsqlite3SrcListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, p2) + } else { + p1 = pNew + libc.Xmemcpy(tls, ((p1 + 8 /* &.a */) + 1*112), p2+8 /* &.a */, (uint64((*SrcList)(unsafe.Pointer(p2)).FnSrc) * uint64(unsafe.Sizeof(SrcItem{})))) + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, p2) + } + } + return p1 +} + +// Add the list of function arguments to the SrcList entry for a +// table-valued-function. +func Xsqlite3SrcListFuncArgs(tls *libc.TLS, pParse uintptr, p uintptr, pList uintptr) { /* sqlite3.c:117189:21: */ + if p != 0 { + var pItem uintptr = ((p + 8 /* &.a */) + uintptr(((*SrcList)(unsafe.Pointer(p)).FnSrc-1))*112) + + *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */)) = pList + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isTabFunc */, uint32(1), 2, 0x4) + } else { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pList) + } +} + +// When building up a FROM clause in the parser, the join operator +// is initially attached to the left operand. But the code generator +// expects the join operator to be on the right operand. This routine +// Shifts all join operators from left to right for an entire FROM +// clause. +// +// Example: Suppose the join is like this: +// +// A natural cross join B +// +// The operator is "natural cross join". The A and B operands are stored +// in p->a[0] and p->a[1], respectively. The parser initially stores the +// operator with A. This routine shifts that operator over to B. +func Xsqlite3SrcListShiftJoinType(tls *libc.TLS, p uintptr) { /* sqlite3.c:117217:21: */ + if p != 0 { + var i int32 + for i = ((*SrcList)(unsafe.Pointer(p)).FnSrc - 1); i > 0; i-- { + (*SrcItem)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(i)*112)).Ffg.Fjointype = (*SrcItem)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((i-1))*112)).Ffg.Fjointype + } + (*SrcItem)(unsafe.Pointer((p + 8 /* &.a */))).Ffg.Fjointype = U8(0) + } +} + +// Generate VDBE code for a BEGIN statement. +func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* sqlite3.c:117230:21: */ + var db uintptr + var v uintptr + var i int32 + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13214 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + return + } + v = Xsqlite3GetVdbe(tls, pParse) + if !(v != 0) { + return + } + if type1 != TK_DEFERRED { + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var eTxnType int32 + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if (pBt != 0) && (Xsqlite3BtreeIsReadonly(tls, pBt) != 0) { + eTxnType = 0 // Read txn + } else if type1 == TK_EXCLUSIVE { + eTxnType = 2 // Exclusive txn + } else { + eTxnType = 1 // Write txn + } + Xsqlite3VdbeAddOp2(tls, v, OP_Transaction, i, eTxnType) + Xsqlite3VdbeUsesBtree(tls, v, i) + } + } + Xsqlite3VdbeAddOp0(tls, v, OP_AutoCommit) +} + +// Generate VDBE code for a COMMIT or ROLLBACK statement. +// Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise +// code is generated for a COMMIT. +func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sqlite3.c:117266:21: */ + var v uintptr + var isRollback int32 + + isRollback = (libc.Bool32(eType == TK_ROLLBACK)) + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, + func() uintptr { + if isRollback != 0 { + return ts + 13220 /* "ROLLBACK" */ + } + return ts + 13229 /* "COMMIT" */ + }(), uintptr(0), uintptr(0)) != 0 { + return + } + v = Xsqlite3GetVdbe(tls, pParse) + if v != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_AutoCommit, 1, isRollback) + } +} + +// This function is called by the parser when it parses a command to create, +// release or rollback an SQL savepoint. +func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { /* sqlite3.c:117288:21: */ + var zName uintptr = Xsqlite3NameFromToken(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pName) + if zName != 0 { + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + + if !(v != 0) || (Xsqlite3AuthCheck(tls, pParse, SQLITE_SAVEPOINT, az[op], zName, uintptr(0)) != 0) { + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, zName) + return + } + Xsqlite3VdbeAddOp4(tls, v, OP_Savepoint, op, 0, 0, zName, -7) + } +} + +var az = [3]uintptr{ts + 13214 /* "BEGIN" */, ts + 13236 /* "RELEASE" */, ts + 13220 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ + +// Make sure the TEMP database is open and available for use. Return +// the number of errors. Leave any error messages in the pParse structure. +func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:117308:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt == uintptr(0)) && !(int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) != 0) { + var rc int32 + // var pBt uintptr at bp, 8 + + rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) + if rc != SQLITE_OK { + Xsqlite3ErrorMsg(tls, pParse, + ts+13244 /* "unable to open a..." */, 0) + (*Parse)(unsafe.Pointer(pParse)).Frc = rc + return 1 + } + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FpBt = *(*uintptr)(unsafe.Pointer(bp /* pBt */)) + + if SQLITE_NOMEM == Xsqlite3BtreeSetPageSize(tls, *(*uintptr)(unsafe.Pointer(bp /* pBt */)), (*Sqlite3)(unsafe.Pointer(db)).FnextPagesize, 0, 0) { + Xsqlite3OomFault(tls, db) + return 1 + } + } + return 0 +} + +var flags int32 = ((((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) | SQLITE_OPEN_TEMP_DB) /* sqlite3.c:117313:22 */ + +// Record the fact that the schema cookie will need to be verified +// for database iDb. The code to actually verify the schema cookie +// will occur at the end of the top-level VDBE and will be generated +// later, by sqlite3FinishCoding(). +func sqlite3CodeVerifySchemaAtToplevel(tls *libc.TLS, pToplevel uintptr, iDb int32) { /* sqlite3.c:117343:13: */ + + if (libc.Bool32((((*Parse)(unsafe.Pointer(pToplevel)).FcookieMask) & (YDbMask((YDbMask(1))) << (iDb))) != YDbMask(0))) == 0 { + *(*YDbMask)(unsafe.Pointer(pToplevel + 116 /* &.cookieMask */)) |= (YDbMask((YDbMask(1))) << (iDb)) + if !(0 != 0) && (iDb == 1) { + Xsqlite3OpenTempDatabase(tls, pToplevel) + } + } +} + +func Xsqlite3CodeVerifySchema(tls *libc.TLS, pParse uintptr, iDb int32) { /* sqlite3.c:117355:21: */ + sqlite3CodeVerifySchemaAtToplevel(tls, func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }(), iDb) +} + +// If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each +// attached database. Otherwise, invoke it for the database named zDb only. +func Xsqlite3CodeVerifyNamedSchema(tls *libc.TLS, pParse uintptr, zDb uintptr) { /* sqlite3.c:117364:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var i int32 + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32) + if ((*Db)(unsafe.Pointer(pDb)).FpBt != 0) && (!(zDb != 0) || (0 == Xsqlite3StrICmp(tls, zDb, (*Db)(unsafe.Pointer(pDb)).FzDbSName))) { + Xsqlite3CodeVerifySchema(tls, pParse, i) + } + } +} + +// Generate VDBE code that prepares for doing an operation that +// might change the database. +// +// This routine starts a new transaction if we are not already within +// a transaction. If we are already within a transaction, then a checkpoint +// is set if the setStatement parameter is true. A checkpoint should +// be set for operations that might fail (due to a constraint) part of +// the way through and which will need to undo some writes without having to +// rollback the whole transaction. For operations where all constraints +// can be checked before any changes are made to the database, it is never +// necessary to undo a write and the checkpoint should not be set. +func Xsqlite3BeginWriteOperation(tls *libc.TLS, pParse uintptr, setStatement int32, iDb int32) { /* sqlite3.c:117388:21: */ + var pToplevel uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + sqlite3CodeVerifySchemaAtToplevel(tls, pToplevel, iDb) + *(*YDbMask)(unsafe.Pointer(pToplevel + 112 /* &.writeMask */)) |= (YDbMask((YDbMask(1))) << (iDb)) + *(*U8)(unsafe.Pointer(pToplevel + 32 /* &.isMultiWrite */)) |= U8((setStatement)) +} + +// Indicate that the statement currently under construction might write +// more than one entry (example: deleting one row then inserting another, +// inserting multiple rows in a table, or inserting a row and index entries.) +// If an abort occurs after some of these writes have completed, then it will +// be necessary to undo the completed writes. +func Xsqlite3MultiWrite(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:117402:21: */ + var pToplevel uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + (*Parse)(unsafe.Pointer(pToplevel)).FisMultiWrite = U8(1) +} + +// The code generator calls this routine if is discovers that it is +// possible to abort a statement prior to completion. In order to +// perform this abort without corrupting the database, we need to make +// sure that the statement is protected by a statement transaction. +// +// Technically, we only need to set the mayAbort flag if the +// isMultiWrite flag was previously set. There is a time dependency +// such that the abort must occur after the multiwrite. This makes +// some statements involving the REPLACE conflict resolution algorithm +// go a little faster. But taking advantage of this time dependency +// makes it more difficult to prove that the code is correct (in +// particular, it prevents us from writing an effective +// implementation of sqlite3AssertMayAbort()) and so we have chosen +// to take the safe route and skip the optimization. +func Xsqlite3MayAbort(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:117423:21: */ + var pToplevel uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + (*Parse)(unsafe.Pointer(pToplevel)).FmayAbort = U8(1) +} + +// Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT +// error. The onError parameter determines which (if any) of the statement +// and/or current transaction is rolled back. +func Xsqlite3HaltConstraint(tls *libc.TLS, pParse uintptr, errCode int32, onError int32, p4 uintptr, p4type I8, p5Errmsg U8) { /* sqlite3.c:117433:21: */ + var v uintptr + + v = Xsqlite3GetVdbe(tls, pParse) + + if onError == OE_Abort { + Xsqlite3MayAbort(tls, pParse) + } + Xsqlite3VdbeAddOp4(tls, v, OP_Halt, errCode, onError, 0, p4, int32(p4type)) + Xsqlite3VdbeChangeP5(tls, v, uint16(p5Errmsg)) +} + +// Code an OP_Halt due to UNIQUE or PRIMARY KEY constraint violation. +func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx uintptr) { /* sqlite3.c:117455:21: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zErr uintptr + var j int32 + // var errMsg StrAccum at bp+8, 32 + + var pTab uintptr = (*Index)(unsafe.Pointer(pIdx)).FpTable + + Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, + *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */)))) + if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13314 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + } else { + for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { + var zCol uintptr + + zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*32)).FzName + if j != 0 { + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13325 /* ", " */, 2) + } + Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+769 /* "." */, 1) + Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) + } + } + zErr = Xsqlite3StrAccumFinish(tls, bp+8 /* &errMsg */) + Xsqlite3HaltConstraint(tls, pParse, + func() int32 { + if (int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY { + return (SQLITE_CONSTRAINT | (int32(6) << 8)) + } + return (SQLITE_CONSTRAINT | (int32(8) << 8)) + }(), + onError, zErr, int8(-7), uint8(P5_ConstraintUnique)) +} + +// Code an OP_Halt due to non-unique rowid. +func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab uintptr) { /* sqlite3.c:117491:21: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zMsg uintptr + var rc int32 + if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10786 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName)) + rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) + } else { + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13328 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) + } + Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), + uint8(P5_ConstraintUnique)) +} + +// Check to see if pIndex uses the collating sequence pColl. Return +// true if it does and false if it does not. +func collationMatch(tls *libc.TLS, zColl uintptr, pIndex uintptr) int32 { /* sqlite3.c:117515:12: */ + var i int32 + + for i = 0; i < int32((*Index)(unsafe.Pointer(pIndex)).FnColumn); i++ { + var z uintptr = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FazColl + uintptr(i)*8)) + + if (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(i)*2))) >= 0) && (0 == Xsqlite3StrICmp(tls, z, zColl)) { + return 1 + } + } + return 0 +} + +// Recompute all indices of pTab that use the collating sequence pColl. +// If pColl==0 then recompute all indices of pTab. +func reindexTable(tls *libc.TLS, pParse uintptr, pTab uintptr, zColl uintptr) { /* sqlite3.c:117534:13: */ + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + var pIndex uintptr // An index associated with pTab + + for pIndex = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIndex != 0; pIndex = (*Index)(unsafe.Pointer(pIndex)).FpNext { + if (zColl == uintptr(0)) || (collationMatch(tls, zColl, pIndex) != 0) { + var iDb int32 = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + sqlite3RefillIndex(tls, pParse, pIndex, -1) + } + } + } +} + +// Recompute all indices of all tables in all databases where the +// indices use the collating sequence pColl. If pColl==0 then recompute +// all indices everywhere. +func reindexDatabases(tls *libc.TLS, pParse uintptr, zColl uintptr) { /* sqlite3.c:117555:13: */ + var pDb uintptr // A single database + var iDb int32 // The database index number + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + var k uintptr // For looping over tables in pDb + var pTab uintptr // A table in the database + + // Needed for schema access + iDb = 0 + pDb = (*Sqlite3)(unsafe.Pointer(db)).FaDb +__1: + if !(iDb < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __3 + } + { + + for k = (*Hash)(unsafe.Pointer(((*Db)(unsafe.Pointer(pDb)).FpSchema + 8 /* &.tblHash */))).Ffirst; k != 0; k = (*HashElem)(unsafe.Pointer(k)).Fnext { + pTab = (*HashElem)(unsafe.Pointer(k)).Fdata + reindexTable(tls, pParse, pTab, zColl) + } + + } + goto __2 +__2: + iDb++ + pDb += 32 + goto __1 + goto __3 +__3: +} + +// Generate code for the REINDEX command. +// +// REINDEX -- 1 +// REINDEX -- 2 +// REINDEX ?.? -- 3 +// REINDEX ?.? -- 4 +// +// Form 1 causes all indices in all attached databases to be rebuilt. +// Form 2 rebuilds all indices in all databases that use the named +// collating function. Forms 3 and 4 rebuild the named index or all +// indices associated with the named table. +func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr) { /* sqlite3.c:117587:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pColl uintptr // Collating sequence to be reindexed, or NULL + var z uintptr // Name of a table or index + var zDb uintptr // Name of the database + var pTab uintptr // A table in the database + var pIndex uintptr // An index associated with pTab + var iDb int32 // The database index number + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + // var pObjName uintptr at bp, 8 + // Name of the table or index to be reindexed + + // Read the database schema. If an error occurs, leave an error message + // and code in pParse and return NULL. + if SQLITE_OK != Xsqlite3ReadSchema(tls, pParse) { + return + } + + if pName1 == uintptr(0) { + reindexDatabases(tls, pParse, uintptr(0)) + return + } else if (pName2 == uintptr(0)) || ((*Token)(unsafe.Pointer(pName2)).Fz == uintptr(0)) { + var zColl uintptr + + zColl = Xsqlite3NameFromToken(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pName1) + if !(zColl != 0) { + return + } + pColl = Xsqlite3FindCollSeq(tls, db, (*Sqlite3)(unsafe.Pointer(db)).Fenc, zColl, 0) + if pColl != 0 { + reindexDatabases(tls, pParse, zColl) + Xsqlite3DbFree(tls, db, zColl) + return + } + Xsqlite3DbFree(tls, db, zColl) + } + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pObjName */) + if iDb < 0 { + return + } + z = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pObjName */))) + if z == uintptr(0) { + return + } + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + pTab = Xsqlite3FindTable(tls, db, z, zDb) + if pTab != 0 { + reindexTable(tls, pParse, pTab, uintptr(0)) + Xsqlite3DbFree(tls, db, z) + return + } + pIndex = Xsqlite3FindIndex(tls, db, z, zDb) + Xsqlite3DbFree(tls, db, z) + if pIndex != 0 { + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + sqlite3RefillIndex(tls, pParse, pIndex, -1) + return + } + Xsqlite3ErrorMsg(tls, pParse, ts+13337 /* "unable to identi..." */, 0) +} + +// Return a KeyInfo structure that is appropriate for the given Index. +// +// The caller should invoke sqlite3KeyInfoUnref() on the returned object +// when it has finished using it. +func Xsqlite3KeyInfoOfIndex(tls *libc.TLS, pParse uintptr, pIdx uintptr) uintptr { /* sqlite3.c:117647:24: */ + var i int32 + var nCol int32 = int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + var nKey int32 = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + var pKey uintptr + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return uintptr(0) + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0 { + pKey = Xsqlite3KeyInfoAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, nKey, (nCol - nKey)) + } else { + pKey = Xsqlite3KeyInfoAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, nCol, 0) + } + if pKey != 0 { + + for i = 0; i < nCol; i++ { + var zColl uintptr = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer((pKey + 32 /* &.aColl */) + uintptr(i)*8)) = func() uintptr { + if zColl == uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) { + return uintptr(0) + } + return Xsqlite3LocateCollSeq(tls, pParse, zColl) + }() + *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKey)).FaSortFlags + uintptr(i))) = *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i))) + + } + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + + if (int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.bNoQuery */)) & 0x100 >> 8)) == 0 { + // Deactivate the index because it contains an unknown collating + // sequence. The only way to reactive the index is to reload the + // schema. Adding the missing collating sequence later does not + // reactive the index. The application had the chance to register + // the missing index using the collation-needed callback. For + // simplicity, SQLite will not give the application a second chance. + libc.SetBitFieldPtr16Uint32(pIdx+100 /* &.bNoQuery */, uint32(1), 8, 0x100) + (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(2) << 8)) + } + Xsqlite3KeyInfoUnref(tls, pKey) + pKey = uintptr(0) + } + } + return pKey +} + +// Create a new CTE object +func Xsqlite3CteNew(tls *libc.TLS, pParse uintptr, pName uintptr, pArglist uintptr, pQuery uintptr, eM10d U8) uintptr { /* sqlite3.c:117691:20: */ + var pNew uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + pNew = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Cte{}))) + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3ExprListDelete(tls, db, pArglist) + Xsqlite3SelectDelete(tls, db, pQuery) + } else { + (*Cte)(unsafe.Pointer(pNew)).FpSelect = pQuery + (*Cte)(unsafe.Pointer(pNew)).FpCols = pArglist + (*Cte)(unsafe.Pointer(pNew)).FzName = Xsqlite3NameFromToken(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pName) + (*Cte)(unsafe.Pointer(pNew)).FeM10d = eM10d + } + return pNew +} + +// Clear information from a Cte object, but do not deallocate storage +// for the object itself. +func cteClear(tls *libc.TLS, db uintptr, pCte uintptr) { /* sqlite3.c:117720:13: */ + + Xsqlite3ExprListDelete(tls, db, (*Cte)(unsafe.Pointer(pCte)).FpCols) + Xsqlite3SelectDelete(tls, db, (*Cte)(unsafe.Pointer(pCte)).FpSelect) + Xsqlite3DbFree(tls, db, (*Cte)(unsafe.Pointer(pCte)).FzName) +} + +// Free the contents of the CTE object passed as the second argument. +func Xsqlite3CteDelete(tls *libc.TLS, db uintptr, pCte uintptr) { /* sqlite3.c:117730:21: */ + + cteClear(tls, db, pCte) + Xsqlite3DbFree(tls, db, pCte) +} + +// This routine is invoked once per CTE by the parser while parsing a +// WITH clause. The CTE described by teh third argument is added to +// the WITH clause of the second argument. If the second argument is +// NULL, then a new WITH argument is created. +func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) uintptr { /* sqlite3.c:117742:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pNew uintptr + var zName uintptr + + if pCte == uintptr(0) { + return pWith + } + + // Check that the CTE name is unique within this WITH clause. If + // not, store an error in the Parse structure. + zName = (*Cte)(unsafe.Pointer(pCte)).FzName + if (zName != 0) && (pWith != 0) { + var i int32 + for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { + if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+13383 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + } + } + } + + if pWith != 0 { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(With{})) + (uint64(unsafe.Sizeof(Cte{})) * uint64((*With)(unsafe.Pointer(pWith)).FnCte)))) + pNew = Xsqlite3DbRealloc(tls, db, pWith, uint64(nByte)) + } else { + pNew = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(With{}))) + } + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3CteDelete(tls, db, pCte) + pNew = pWith + } else { + *(*Cte)(unsafe.Pointer((pNew + 16 /* &.a */) + uintptr(libc.PostIncInt32(&(*With)(unsafe.Pointer(pNew)).FnCte, 1))*48)) = *(*Cte)(unsafe.Pointer(pCte)) + Xsqlite3DbFree(tls, db, pCte) + } + + return pNew +} + +// Free the contents of the With object passed as the second argument. +func Xsqlite3WithDelete(tls *libc.TLS, db uintptr, pWith uintptr) { /* sqlite3.c:117789:21: */ + if pWith != 0 { + var i int32 + for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { + cteClear(tls, db, ((pWith + 16 /* &.a */) + uintptr(i)*48)) + } + Xsqlite3DbFree(tls, db, pWith) + } +} + +//************* End of build.c ********************************************** +//************* Begin file callback.c *************************************** +// 2005 May 23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains functions used to access the internal hash tables +// of user defined functions and collation sequences. + +// #include "sqliteInt.h" + +// Invoke the 'collation needed' callback to request a collation sequence +// in the encoding enc of name zName, length nName. +func callCollNeeded(tls *libc.TLS, db uintptr, enc int32, zName uintptr) { /* sqlite3.c:117824:13: */ + + if (*Sqlite3)(unsafe.Pointer(db)).FxCollNeeded != 0 { + var zExternal uintptr = Xsqlite3DbStrDup(tls, db, zName) + if !(zExternal != 0) { + return + } + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer((db + 368 /* &.xCollNeeded */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpCollNeededArg, db, enc, zExternal) + Xsqlite3DbFree(tls, db, zExternal) + } + if (*Sqlite3)(unsafe.Pointer(db)).FxCollNeeded16 != 0 { + var zExternal uintptr + var pTmp uintptr = Xsqlite3ValueNew(tls, db) + Xsqlite3ValueSetStr(tls, pTmp, -1, zName, uint8(SQLITE_UTF8), uintptr(0)) + zExternal = Xsqlite3ValueText(tls, pTmp, uint8(SQLITE_UTF16LE)) + if zExternal != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer((db + 376 /* &.xCollNeeded16 */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpCollNeededArg, db, int32((*Sqlite3)(unsafe.Pointer(db)).Fenc), zExternal) + } + Xsqlite3ValueFree(tls, pTmp) + } +} + +// This routine is called if the collation factory fails to deliver a +// collation function in the best encoding but there may be other versions +// of this collation function (for other text encodings) available. Use one +// of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if +// possible. +func synthCollSeq(tls *libc.TLS, db uintptr, pColl uintptr) int32 { /* sqlite3.c:117853:12: */ + var pColl2 uintptr + var z uintptr = (*CollSeq)(unsafe.Pointer(pColl)).FzName + var i int32 + for i = 0; i < 3; i++ { + pColl2 = Xsqlite3FindCollSeq(tls, db, aEnc[i], z, 0) + if (*CollSeq)(unsafe.Pointer(pColl2)).FxCmp != uintptr(0) { + libc.Xmemcpy(tls, pColl, pColl2, uint64(unsafe.Sizeof(CollSeq{}))) + (*CollSeq)(unsafe.Pointer(pColl)).FxDel = uintptr(0) // Do not copy the destructor + return SQLITE_OK + } + } + return SQLITE_ERROR +} + +var aEnc = [3]U8{U8(SQLITE_UTF16BE), U8(SQLITE_UTF16LE), U8(SQLITE_UTF8)} /* sqlite3.c:117857:19 */ + +// This routine is called on a collation sequence before it is used to +// check that it is defined. An undefined collation sequence exists when +// a database is loaded that contains references to collation sequences +// that have not been defined by sqlite3_create_collation() etc. +// +// If required, this routine calls the 'collation needed' callback to +// request a definition of the collating sequence. If this doesn't work, +// an equivalent collating sequence that uses a text encoding different +// from the main database is substituted, if one is available. +func Xsqlite3CheckCollSeq(tls *libc.TLS, pParse uintptr, pColl uintptr) int32 { /* sqlite3.c:117880:20: */ + if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp == uintptr(0)) { + var zName uintptr = (*CollSeq)(unsafe.Pointer(pColl)).FzName + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var p uintptr = Xsqlite3GetCollSeq(tls, pParse, (*Sqlite3)(unsafe.Pointer(db)).Fenc, pColl, zName) + if !(p != 0) { + return SQLITE_ERROR + } + + } + return SQLITE_OK +} + +// Locate and return an entry from the db.aCollSeq hash table. If the entry +// specified by zName and nName is not found and parameter 'create' is +// true, then create a new entry. Otherwise return NULL. +// +// Each pointer stored in the sqlite3.aCollSeq hash table contains an +// array of three CollSeq structures. The first is the collation sequence +// preferred for UTF-8, the second UTF-16le, and the third UTF-16be. +// +// Stored immediately after the three collation sequences is a copy of +// the collation sequence name. A pointer to this string is stored in +// each collation sequence structure. +func findCollSeqEntry(tls *libc.TLS, db uintptr, zName uintptr, create int32) uintptr { /* sqlite3.c:117908:16: */ + var pColl uintptr + pColl = Xsqlite3HashFind(tls, (db + 608 /* &.aCollSeq */), zName) + + if (uintptr(0) == pColl) && (create != 0) { + var nName int32 = (Xsqlite3Strlen30(tls, zName) + 1) + pColl = Xsqlite3DbMallocZero(tls, db, (uint64((uint64(3) * uint64(unsafe.Sizeof(CollSeq{}))) + uint64(nName)))) + if pColl != 0 { + var pDel uintptr = uintptr(0) + (*CollSeq)(unsafe.Pointer(pColl)).FzName = (pColl + 3*40) + (*CollSeq)(unsafe.Pointer(pColl)).Fenc = U8(SQLITE_UTF8) + (*CollSeq)(unsafe.Pointer(pColl + 1*40)).FzName = (pColl + 3*40) + (*CollSeq)(unsafe.Pointer(pColl + 1*40)).Fenc = U8(SQLITE_UTF16LE) + (*CollSeq)(unsafe.Pointer(pColl + 2*40)).FzName = (pColl + 3*40) + (*CollSeq)(unsafe.Pointer(pColl + 2*40)).Fenc = U8(SQLITE_UTF16BE) + libc.Xmemcpy(tls, (*CollSeq)(unsafe.Pointer(pColl)).FzName, zName, uint64(nName)) + pDel = Xsqlite3HashInsert(tls, (db + 608 /* &.aCollSeq */), (*CollSeq)(unsafe.Pointer(pColl)).FzName, pColl) + + // If a malloc() failure occurred in sqlite3HashInsert(), it will + // return the pColl pointer to be deleted (because it wasn't added + // to the hash table). + + if pDel != uintptr(0) { + Xsqlite3OomFault(tls, db) + Xsqlite3DbFree(tls, db, pDel) + pColl = uintptr(0) + } + } + } + return pColl +} + +// Parameter zName points to a UTF-8 encoded string nName bytes long. +// Return the CollSeq* pointer for the collation sequence named zName +// for the encoding 'enc' from the database 'db'. +// +// If the entry specified is not found and 'create' is true, then create a +// new entry. Otherwise return NULL. +// +// A separate function sqlite3LocateCollSeq() is a wrapper around +// this routine. sqlite3LocateCollSeq() invokes the collation factory +// if necessary and generates an error message if the collating sequence +// cannot be found. +// +// See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq() +func Xsqlite3FindCollSeq(tls *libc.TLS, db uintptr, enc U8, zName uintptr, create int32) uintptr { /* sqlite3.c:117960:24: */ + var pColl uintptr + + if zName != 0 { + pColl = findCollSeqEntry(tls, db, zName, create) + if pColl != 0 { + pColl += 40 * (uintptr(int32(enc) - 1)) + } + } else { + pColl = (*Sqlite3)(unsafe.Pointer(db)).FpDfltColl + } + return pColl +} + +// Change the text encoding for a database connection. This means that +// the pDfltColl must change as well. +func Xsqlite3SetTextEncoding(tls *libc.TLS, db uintptr, enc U8) { /* sqlite3.c:117982:21: */ + + (*Sqlite3)(unsafe.Pointer(db)).Fenc = enc + // EVIDENCE-OF: R-08308-17224 The default collating function for all + // strings is BINARY. + (*Sqlite3)(unsafe.Pointer(db)).FpDfltColl = Xsqlite3FindCollSeq(tls, db, enc, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), 0) +} + +// This function is responsible for invoking the collation factory callback +// or substituting a collation sequence of a different encoding when the +// requested collation sequence is not available in the desired encoding. +// +// If it is not NULL, then pColl must point to the database native encoding +// collation sequence with name zName, length nName. +// +// The return value is either the collation sequence to be used in database +// db for collation type name zName, length nName, or NULL, if no collation +// sequence can be found. If no collation is found, leave an error message. +// +// See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() +func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zName uintptr) uintptr { /* sqlite3.c:118005:24: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + p = pColl + if !(p != 0) { + p = Xsqlite3FindCollSeq(tls, db, enc, zName, 0) + } + if !(p != 0) || !(int32((*CollSeq)(unsafe.Pointer(p)).FxCmp) != 0) { + // No collation sequence of this type for this encoding is registered. + // Call the collation factory to see if it can supply us with one. + callCollNeeded(tls, db, int32(enc), zName) + p = Xsqlite3FindCollSeq(tls, db, enc, zName, 0) + } + if ((p != 0) && !(int32((*CollSeq)(unsafe.Pointer(p)).FxCmp) != 0)) && (synthCollSeq(tls, db, p) != 0) { + p = uintptr(0) + } + + if p == uintptr(0) { + Xsqlite3ErrorMsg(tls, pParse, ts+13413 /* "no such collatio..." */, libc.VaList(bp, zName)) + (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) + } + return p +} + +// This function returns the collation sequence for database native text +// encoding identified by the string zName. +// +// If the requested collation sequence is not available, or not available +// in the database native encoding, the collation factory is invoked to +// request it. If the collation factory does not supply such a sequence, +// and the sequence is available in another text encoding, then that is +// returned instead. +// +// If no versions of the requested collations sequence are available, or +// another error occurs, NULL is returned and an error message written into +// pParse. +// +// This routine is a wrapper around sqlite3FindCollSeq(). This routine +// invokes the collation factory if the named collation cannot be found +// and generates an error message. +// +// See also: sqlite3FindCollSeq(), sqlite3GetCollSeq() +func Xsqlite3LocateCollSeq(tls *libc.TLS, pParse uintptr, zName uintptr) uintptr { /* sqlite3.c:118056:24: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc + var initbusy U8 = (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy + var pColl uintptr + + pColl = Xsqlite3FindCollSeq(tls, db, enc, zName, int32(initbusy)) + if !(initbusy != 0) && (!(pColl != 0) || !(int32((*CollSeq)(unsafe.Pointer(pColl)).FxCmp) != 0)) { + pColl = Xsqlite3GetCollSeq(tls, pParse, enc, pColl, zName) + } + + return pColl +} + +// During the search for the best function definition, this procedure +// is called to test how well the function passed as the first argument +// matches the request for a function with nArg arguments in a system +// that uses encoding enc. The value returned indicates how well the +// request is matched. A higher value indicates a better match. +// +// If nArg is -1 that means to only return a match (non-zero) if p->nArg +// is also -1. In other words, we are searching for a function that +// takes a variable number of arguments. +// +// If nArg is -2 that means that we are searching for any function +// regardless of the number of arguments it uses, so return a positive +// match score for any +// +// The returned value is always between 0 and 6, as follows: +// +// 0: Not a match. +// 1: UTF8/16 conversion required and function takes any number of arguments. +// 2: UTF16 byte order change required and function takes any number of args. +// 3: encoding matches and function takes any number of arguments +// 4: UTF8/16 conversion required - argument count matches exactly +// 5: UTF16 byte order conversion required - argument count matches exactly +// 6: Perfect match: encoding and argument count match exactly. +// +// If nArg==(-2) then any function with a non-null xSFunc is +// a perfect match and any function with xSFunc NULL is +// a non-match. +func matchQuality(tls *libc.TLS, p uintptr, nArg int32, enc U8) int32 { /* sqlite3.c:118099:12: */ + var match int32 + + // Wrong number of arguments means "no match" + if int32((*FuncDef)(unsafe.Pointer(p)).FnArg) != nArg { + if nArg == (-2) { + if (*FuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) { + return 0 + } + return FUNC_PERFECT_MATCH + } + if int32((*FuncDef)(unsafe.Pointer(p)).FnArg) >= 0 { + return 0 + } + } + + // Give a better score to a function with a specific number of arguments + // than to function that accepts any number of arguments. + if int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg { + match = 4 + } else { + match = 1 + } + + // Bonus points if the text encoding matches + if U32(enc) == ((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) { + match = match + (2) // Exact encoding match + } else if ((U32(enc) & (*FuncDef)(unsafe.Pointer(p)).FfuncFlags) & U32(2)) != U32(0) { + match = match + (1) // Both are UTF16, but with different byte orders + } + + return match +} + +// Search a FuncDefHash for a function with the given name. Return +// a pointer to the matching FuncDef if found, or 0 if there is no match. +func Xsqlite3FunctionSearch(tls *libc.TLS, h int32, zFunc uintptr) uintptr { /* sqlite3.c:118135:24: */ + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3BuiltinFunctions)) /* &.a */) + uintptr(h)*8)); p != 0; p = *(*uintptr)(unsafe.Pointer(p + 64 /* &.u */)) { + if Xsqlite3StrICmp(tls, (*FuncDef)(unsafe.Pointer(p)).FzName, zFunc) == 0 { + return p + } + } + return uintptr(0) +} + +// Insert a new FuncDef into a FuncDefHash hash table. +func Xsqlite3InsertBuiltinFuncs(tls *libc.TLS, aDef uintptr, nDef int32) { /* sqlite3.c:118151:21: */ + var i int32 + for i = 0; i < nDef; i++ { + var pOther uintptr + var zName uintptr = (*FuncDef)(unsafe.Pointer(aDef + uintptr(i)*72)).FzName + var nName int32 = Xsqlite3Strlen30(tls, zName) + var h int32 = (((int32(*(*int8)(unsafe.Pointer(zName)))) + (nName)) % SQLITE_FUNC_HASH_SZ) + + pOther = Xsqlite3FunctionSearch(tls, h, zName) + if pOther != 0 { + + (*FuncDef)(unsafe.Pointer(aDef + uintptr(i)*72)).FpNext = (*FuncDef)(unsafe.Pointer(pOther)).FpNext + (*FuncDef)(unsafe.Pointer(pOther)).FpNext = (aDef + uintptr(i)*72) + } else { + (*FuncDef)(unsafe.Pointer(aDef + uintptr(i)*72)).FpNext = uintptr(0) + *(*uintptr)(unsafe.Pointer(aDef + uintptr(i)*72 + 64 /* &.u */)) = *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3BuiltinFunctions)) /* &.a */) + uintptr(h)*8)) + *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3BuiltinFunctions)) /* &.a */) + uintptr(h)*8)) = (aDef + uintptr(i)*72) + } + } +} + +// Locate a user function given a name, a number of arguments and a flag +// indicating whether the function prefers UTF-16 over UTF-8. Return a +// pointer to the FuncDef structure that defines that function, or return +// NULL if the function does not exist. +// +// If the createFlag argument is true, then a new (blank) FuncDef +// structure is created and liked into the "db" structure if a +// no matching function previously existed. +// +// If nArg is -2, then the first valid function found is returned. A +// function is valid if xSFunc is non-zero. The nArg==(-2) +// case is used to see if zName is a valid function name for some number +// of arguments. If nArg is -2, then createFlag must be 0. +// +// If createFlag is false, then a function with the required name and +// number of arguments may be returned even if the eTextRep flag does not +// match that requested. +func Xsqlite3FindFunction(tls *libc.TLS, db uintptr, zName uintptr, nArg int32, enc U8, createFlag U8) uintptr { /* sqlite3.c:118196:24: */ + var p uintptr // Iterator variable + var pBest uintptr = uintptr(0) // Best match found so far + var bestScore int32 = 0 // Score of best match + var h int32 // Hash value + var nName int32 // Length of the name + + nName = Xsqlite3Strlen30(tls, zName) + + // First search for a match amongst the application-defined functions. + p = Xsqlite3HashFind(tls, (db + 584 /* &.aFunc */), zName) + for p != 0 { + var score int32 = matchQuality(tls, p, nArg, enc) + if score > bestScore { + pBest = p + bestScore = score + } + p = (*FuncDef)(unsafe.Pointer(p)).FpNext + } + + // If no match is found, search the built-in functions. + // + // If the DBFLAG_PreferBuiltin flag is set, then search the built-in + // functions even if a prior app-defined function was found. And give + // priority to built-in functions. + // + // Except, if createFlag is true, that means that we are trying to + // install a new function. Whatever FuncDef structure is returned it will + // have fields overwritten with new information appropriate for the + // new function. But the FuncDefs for built-in functions are read-only. + // So we must not search for built-ins when creating a new function. + if !(createFlag != 0) && ((pBest == uintptr(0)) || (((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_PreferBuiltin)) != U32(0))) { + bestScore = 0 + h = (((int32(Xsqlite3UpperToLower[U8(*(*int8)(unsafe.Pointer(zName)))])) + (nName)) % SQLITE_FUNC_HASH_SZ) + p = Xsqlite3FunctionSearch(tls, h, zName) + for p != 0 { + var score int32 = matchQuality(tls, p, nArg, enc) + if score > bestScore { + pBest = p + bestScore = score + } + p = (*FuncDef)(unsafe.Pointer(p)).FpNext + } + } + + // If the createFlag parameter is true and the search did not reveal an + // exact match for the name, number of arguments and encoding, then add a + // new entry to the hash table and return it. + if ((createFlag != 0) && (bestScore < FUNC_PERFECT_MATCH)) && ((libc.AssignUintptr(&pBest, Xsqlite3DbMallocZero(tls, db, (uint64((uint64(unsafe.Sizeof(FuncDef{}))+uint64(nName))+uint64(1)))))) != uintptr(0)) { + var pOther uintptr + var z uintptr + (*FuncDef)(unsafe.Pointer(pBest)).FzName = (pBest + 1*72) + (*FuncDef)(unsafe.Pointer(pBest)).FnArg = I8(U16(nArg)) + (*FuncDef)(unsafe.Pointer(pBest)).FfuncFlags = U32(enc) + libc.Xmemcpy(tls, (pBest + 1*72), zName, (uint64(nName + 1))) + for z = (*FuncDef)(unsafe.Pointer(pBest)).FzName; *(*U8)(unsafe.Pointer(z)) != 0; z++ { + *(*U8)(unsafe.Pointer(z)) = Xsqlite3UpperToLower[*(*U8)(unsafe.Pointer(z))] + } + pOther = Xsqlite3HashInsert(tls, (db + 584 /* &.aFunc */), (*FuncDef)(unsafe.Pointer(pBest)).FzName, pBest) + if pOther == pBest { + Xsqlite3DbFree(tls, db, pBest) + Xsqlite3OomFault(tls, db) + return uintptr(0) + } else { + (*FuncDef)(unsafe.Pointer(pBest)).FpNext = pOther + } + } + + if (pBest != 0) && (((*FuncDef)(unsafe.Pointer(pBest)).FxSFunc != 0) || (createFlag != 0)) { + return pBest + } + return uintptr(0) +} + +// Free all resources held by the schema structure. The void* argument points +// at a Schema struct. This function does not call sqlite3DbFree(db, ) on the +// pointer itself, it just cleans up subsidiary resources (i.e. the contents +// of the schema hash tables). +// +// The Schema.cache_size variable is not cleared. +func Xsqlite3SchemaClear(tls *libc.TLS, p uintptr) { /* sqlite3.c:118288:21: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var temp1 Hash at bp+24, 24 + + // var temp2 Hash at bp, 24 + + var pElem uintptr + var pSchema uintptr = p + + *(*Hash)(unsafe.Pointer(bp + 24 /* temp1 */)) = (*Schema)(unsafe.Pointer(pSchema)).FtblHash + *(*Hash)(unsafe.Pointer(bp /* temp2 */)) = (*Schema)(unsafe.Pointer(pSchema)).FtrigHash + Xsqlite3HashInit(tls, (pSchema + 56 /* &.trigHash */)) + Xsqlite3HashClear(tls, (pSchema + 32 /* &.idxHash */)) + for pElem = (*Hash)(unsafe.Pointer(bp /* &temp2 */)).Ffirst; pElem != 0; pElem = (*HashElem)(unsafe.Pointer(pElem)).Fnext { + Xsqlite3DeleteTrigger(tls, uintptr(0), (*HashElem)(unsafe.Pointer(pElem)).Fdata) + } + Xsqlite3HashClear(tls, bp /* &temp2 */) + Xsqlite3HashInit(tls, (pSchema + 8 /* &.tblHash */)) + for pElem = (*Hash)(unsafe.Pointer(bp + 24 /* &temp1 */)).Ffirst; pElem != 0; pElem = (*HashElem)(unsafe.Pointer(pElem)).Fnext { + var pTab uintptr = (*HashElem)(unsafe.Pointer(pElem)).Fdata + Xsqlite3DeleteTable(tls, uintptr(0), pTab) + } + Xsqlite3HashClear(tls, bp+24 /* &temp1 */) + Xsqlite3HashClear(tls, (pSchema + 80 /* &.fkeyHash */)) + (*Schema)(unsafe.Pointer(pSchema)).FpSeqTab = uintptr(0) + if (int32((*Schema)(unsafe.Pointer(pSchema)).FschemaFlags) & DB_SchemaLoaded) != 0 { + (*Schema)(unsafe.Pointer(pSchema)).FiGeneration++ + } + *(*U16)(unsafe.Pointer(pSchema + 114 /* &.schemaFlags */)) &= libc.Uint16FromInt32((libc.CplInt32((DB_SchemaLoaded | DB_ResetWanted)))) +} + +// Find and return the schema associated with a BTree. Create +// a new one if necessary. +func Xsqlite3SchemaGet(tls *libc.TLS, db uintptr, pBt uintptr) uintptr { /* sqlite3.c:118320:23: */ + var p uintptr + if pBt != 0 { + p = Xsqlite3BtreeSchema(tls, pBt, int32(unsafe.Sizeof(Schema{})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3SchemaClear}))) + } else { + p = Xsqlite3DbMallocZero(tls, uintptr(0), uint64(unsafe.Sizeof(Schema{}))) + } + if !(p != 0) { + Xsqlite3OomFault(tls, db) + } else if 0 == int32((*Schema)(unsafe.Pointer(p)).Ffile_format) { + Xsqlite3HashInit(tls, (p + 8 /* &.tblHash */)) + Xsqlite3HashInit(tls, (p + 32 /* &.idxHash */)) + Xsqlite3HashInit(tls, (p + 56 /* &.trigHash */)) + Xsqlite3HashInit(tls, (p + 80 /* &.fkeyHash */)) + (*Schema)(unsafe.Pointer(p)).Fenc = U8(SQLITE_UTF8) + } + return p +} + +//************* End of callback.c ******************************************* +//************* Begin file delete.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains C code routines that are called by the parser +// in order to generate code for DELETE FROM statements. +// #include "sqliteInt.h" + +// While a SrcList can in general represent multiple tables and subqueries +// (as in the FROM clause of a SELECT statement) in this case it contains +// the name of a single table, as one might find in an INSERT, DELETE, +// or UPDATE statement. Look up that table in the symbol table and +// return a pointer. Set an error message and return NULL if the table +// name is not found or if any other error occurs. +// +// The following fields are initialized appropriate in pSrc: +// +// pSrc->a[0].pTab Pointer to the Table object +// pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one +// +func Xsqlite3SrcListLookup(tls *libc.TLS, pParse uintptr, pSrc uintptr) uintptr { /* sqlite3.c:118371:22: */ + var pItem uintptr = pSrc + 8 /* &.a */ + var pTab uintptr + + pTab = Xsqlite3LocateTableItem(tls, pParse, uint32(0), pItem) + Xsqlite3DeleteTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pItem)).FpTab) + (*SrcItem)(unsafe.Pointer(pItem)).FpTab = pTab + if pTab != 0 { + (*Table)(unsafe.Pointer(pTab)).FnTabRef++ + if ((uint32(int32(*(*uint16)(unsafe.Pointer((pItem + 60 /* &.fg */) + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0) && (Xsqlite3IndexedByLookup(tls, pParse, pItem) != 0) { + pTab = uintptr(0) + } + } + return pTab +} + +// Return true if table pTab is read-only. +// +// A table is read-only if any of the following are true: +// +// 1) It is a virtual table and no implementation of the xUpdate method +// has been provided +// +// 2) It is a system table (i.e. sqlite_schema), this call is not +// part of a nested parse and writable_schema pragma has not +// been specified +// +// 3) The table is a shadow table, the database connection is in +// defensive mode, and the current sqlite3_prepare() +// is for a top-level SQL statement. +func tabIsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sqlite3.c:118402:12: */ + var db uintptr + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + return (libc.Bool32((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer((*VTable)(unsafe.Pointer(Xsqlite3GetVTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pTab))).FpMod)).FpModule)).FxUpdate == uintptr(0))) + } + if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & (U32(TF_Readonly | TF_Shadow))) == U32(0) { + return 0 + } + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Readonly)) != U32(0) { + return (libc.Bool32((Xsqlite3WritableSchema(tls, db) == 0) && (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0))) + } + + return Xsqlite3ReadOnlyShadowTables(tls, db) +} + +// Check to make sure the given table is writable. If it is not +// writable, generate an error message and return 1. If it is +// writable return 0; +func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int32) int32 { /* sqlite3.c:118421:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if tabIsReadOnly(tls, pParse, pTab) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+13444 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + return 1 + } + if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+13473 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + return 1 + } + return 0 +} + +// Evaluate a view and store its result in an ephemeral table. The +// pWhere argument is an optional WHERE clause that restricts the +// set of rows in the view that are to be added to the ephemeral table. +func Xsqlite3MaterializeView(tls *libc.TLS, pParse uintptr, pView uintptr, pWhere uintptr, pOrderBy uintptr, pLimit uintptr, iCur int32) { /* sqlite3.c:118442:21: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + // var dest SelectDest at bp, 40 + + var pSel uintptr + var pFrom uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var iDb int32 = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pView)).FpSchema) + pWhere = Xsqlite3ExprDup(tls, db, pWhere, 0) + pFrom = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if pFrom != 0 { + + (*SrcItem)(unsafe.Pointer((pFrom + 8 /* &.a */))).FzName = Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pView)).FzName) + (*SrcItem)(unsafe.Pointer((pFrom + 8 /* &.a */))).FzDatabase = Xsqlite3DbStrDup(tls, db, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) + + } + pSel = Xsqlite3SelectNew(tls, pParse, uintptr(0), pFrom, pWhere, uintptr(0), uintptr(0), pOrderBy, + uint32(SF_IncludeHidden), pLimit) + Xsqlite3SelectDestInit(tls, bp /* &dest */, SRT_EphemTab, iCur) + Xsqlite3Select(tls, pParse, pSel, bp /* &dest */) + Xsqlite3SelectDelete(tls, db, pSel) +} + +// && !defined(SQLITE_OMIT_SUBQUERY) + +// Generate code for a DELETE FROM statement. +// +// DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL; +// \________/ \________________/ +// pTabList pWhere +func Xsqlite3DeleteFrom(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pLimit uintptr) { /* sqlite3.c:118580:21: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + var v uintptr // The virtual database engine + var pTab uintptr // The table from which records will be deleted + var i int32 // Loop counter + var pWInfo uintptr // Information about the WHERE clause + var pIdx uintptr // For looping over indices of the table + var iTabCur int32 // Cursor number for the table + // var iDataCur int32 at bp+80, 4 + // VDBE cursor for the canonical data source + // var iIdxCur int32 at bp+84, 4 + // Cursor number of the first index + var nIdx int32 // Number of indices + var db uintptr // Main database structure + // var sContext AuthContext at bp, 16 + // Authorization context + // var sNC NameContext at bp+16, 56 + // Name context to resolve expressions in + var iDb int32 // Database number + var memCnt int32 // Memory cell used for change counting + var rcauth int32 // Value returned by authorization callback + var eOnePass int32 // ONEPASS_OFF or _SINGLE or _MULTI + // var aiCurOnePass [2]int32 at bp+72, 8 + // The write cursors opened by WHERE_ONEPASS + var aToOpen uintptr // Open cursor iTabCur+j if aToOpen[j] is true + var pPk uintptr // The PRIMARY KEY index on the table + var iPk int32 // First of nPk registers holding PRIMARY KEY value + var nPk I16 // Number of columns in the PRIMARY KEY + var iKey int32 // Memory cell holding key of row to be deleted + var nKey I16 // Number of memory cells in the row key + var iEphCur int32 // Ephemeral table holding all primary key values + var iRowSet int32 // Register for rowset of rows to delete + var addrBypass int32 // Address of jump over the delete logic + var addrLoop int32 // Top of the delete loop + var addrEphOpen int32 // Instruction to open the Ephemeral table + var bComplex int32 // True if there are triggers or FKs or + // subqueries in the WHERE clause + + var isView int32 // True if attempting to delete from a view + var pTrigger uintptr + var iAddrOnce int32 + var pVTab uintptr + var count int32 + var wcf U16 + *(*int32)(unsafe.Pointer(bp + 80 /* iDataCur */)) = 0 + *(*int32)(unsafe.Pointer(bp + 84 /* iIdxCur */)) = 0 + memCnt = 0 + aToOpen = uintptr(0) + iPk = 0 + nPk = int16(1) + iEphCur = 0 + iRowSet = 0 + addrBypass = 0 + addrLoop = 0 + addrEphOpen = 0 // List of table triggers, if required + + libc.Xmemset(tls, bp /* &sContext */, 0, uint64(unsafe.Sizeof(AuthContext{}))) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __1 + } + goto delete_from_cleanup +__1: + ; + + // Locate the table which we want to delete. This table has to be + // put in an SrcList structure because some of the subroutines we + // will be calling are designed to work with multiple tables and expect + // an SrcList* parameter instead of just a Table* parameter. + pTab = Xsqlite3SrcListLookup(tls, pParse, pTabList) + if !(pTab == uintptr(0)) { + goto __2 + } + goto delete_from_cleanup +__2: + ; + + // Figure out if we have any triggers and if the table being + // deleted from is a view + pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_DELETE, uintptr(0), uintptr(0)) + isView = (libc.Bool32((*Table)(unsafe.Pointer(pTab)).FpSelect != uintptr(0))) + bComplex = (libc.Bool32((pTrigger != 0) || (Xsqlite3FkRequired(tls, pParse, pTab, uintptr(0), 0) != 0))) + + // If pTab is really a view, make sure it has been initialized. + if !(Xsqlite3ViewGetColumnNames(tls, pParse, pTab) != 0) { + goto __3 + } + goto delete_from_cleanup +__3: + ; + + if !(Xsqlite3IsReadOnly(tls, pParse, pTab, func() int32 { + if pTrigger != 0 { + return 1 + } + return 0 + }()) != 0) { + goto __4 + } + goto delete_from_cleanup +__4: + ; + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + rcauth = Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0), + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) + + if !(rcauth == SQLITE_DENY) { + goto __5 + } + goto delete_from_cleanup +__5: + ; + + // Assign cursor numbers to the table and all its indices. + + iTabCur = libc.AssignPtrInt32((pTabList+8 /* &.a */)+68 /* &.iCursor */, libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1)) + nIdx = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__6: + if !(pIdx != 0) { + goto __8 + } + (*Parse)(unsafe.Pointer(pParse)).FnTab++ + goto __7 +__7: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + nIdx++ + goto __6 + goto __8 +__8: + ; + + // Start the view context + if !(isView != 0) { + goto __9 + } + Xsqlite3AuthContextPush(tls, pParse, bp /* &sContext */, (*Table)(unsafe.Pointer(pTab)).FzName) +__9: + ; + + // Begin generating code. + v = Xsqlite3GetVdbe(tls, pParse) + if !(v == uintptr(0)) { + goto __10 + } + goto delete_from_cleanup +__10: + ; + if !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) { + goto __11 + } + Xsqlite3VdbeCountChanges(tls, v) +__11: + ; + Xsqlite3BeginWriteOperation(tls, pParse, bComplex, iDb) + + // If we are trying to delete from a view, realize that view into + // an ephemeral table. + if !(isView != 0) { + goto __12 + } + Xsqlite3MaterializeView(tls, pParse, pTab, + pWhere, pOrderBy, pLimit, iTabCur) + *(*int32)(unsafe.Pointer(bp + 80 /* iDataCur */)) = libc.AssignPtrInt32(bp+84 /* iIdxCur */, iTabCur) + pOrderBy = uintptr(0) + pLimit = uintptr(0) +__12: + ; + + // Resolve the column names in the WHERE clause. + libc.Xmemset(tls, bp+16 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpSrcList = pTabList + if !(Xsqlite3ResolveExprNames(tls, bp+16 /* &sNC */, pWhere) != 0) { + goto __13 + } + goto delete_from_cleanup +__13: + ; + + // Initialize the counter of the number of rows deleted, if + // we are counting rows. + if !((((((*Sqlite3)(unsafe.Pointer(db)).Fflags & (U64((uint64(0x00001))) << 32)) != uint64(0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FbReturning) != 0)) { + goto __14 + } + memCnt = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, memCnt) +__14: + ; + + // Special case: A DELETE without a WHERE clause deletes everything. + // It is easier just to erase the whole table. Prior to version 3.6.5, + // this optimization caused the row change count (the value returned by + // API function sqlite3_count_changes) to be set incorrectly. + // + // The "rcauth==SQLITE_OK" terms is the + // IMPLEMENTATION-OF: R-17228-37124 If the action code is SQLITE_DELETE and + // the callback returns SQLITE_IGNORE then the DELETE operation proceeds but + // the truncate optimization is disabled and all rows are deleted + // individually. + if !(((((rcauth == SQLITE_OK) && + (pWhere == uintptr(0))) && + !(bComplex != 0)) && + !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) && + ((*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback == uintptr(0))) { + goto __15 + } + + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, uint8(1), (*Table)(unsafe.Pointer(pTab)).FzName) + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __17 + } + Xsqlite3VdbeAddOp4(tls, v, OP_Clear, int32((*Table)(unsafe.Pointer(pTab)).Ftnum), iDb, func() int32 { + if memCnt != 0 { + return memCnt + } + return -1 + }(), + (*Table)(unsafe.Pointer(pTab)).FzName, -1) +__17: + ; + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__18: + if !(pIdx != 0) { + goto __20 + } + + Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) + if !(((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __21 + } + Xsqlite3VdbeChangeP3(tls, v, -1, func() int32 { + if memCnt != 0 { + return memCnt + } + return -1 + }()) +__21: + ; + goto __19 +__19: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __18 + goto __20 +__20: + ; + goto __16 +__15: + + wcf = (U16(WHERE_ONEPASS_DESIRED | WHERE_DUPLICATES_OK)) + if !(((*NameContext)(unsafe.Pointer(bp+16 /* &sNC */)).FncFlags & NC_VarSelect) != 0) { + goto __22 + } + bComplex = 1 +__22: + ; + wcf = U16(int32(wcf) | (func() int32 { + if bComplex != 0 { + return 0 + } + return WHERE_ONEPASS_MULTIROW + }())) + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __23 + } + // For a rowid table, initialize the RowSet to an empty set + pPk = uintptr(0) + nPk = int16(1) + iRowSet = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, iRowSet) + goto __24 +__23: + // For a WITHOUT ROWID table, create an ephemeral table used to + // hold all primary keys for rows to be deleted. + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + + nPk = I16((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + iPk = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32(nPk)) + iEphCur = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + addrEphOpen = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, iEphCur, int32(nPk)) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) +__24: + ; + + // Construct a query to find the rowid or primary key for every row + // to be deleted, based on the WHERE clause. Set variable eOnePass + // to indicate the strategy used to implement this delete: + // + // ONEPASS_OFF: Two-pass approach - use a FIFO for rowids/PK values. + // ONEPASS_SINGLE: One-pass approach - at most one row deleted. + // ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, uintptr(0), uintptr(0), wcf, (iTabCur + 1)) + if !(pWInfo == uintptr(0)) { + goto __25 + } + goto delete_from_cleanup +__25: + ; + eOnePass = Xsqlite3WhereOkOnePass(tls, pWInfo, bp+72 /* &aiCurOnePass[0] */) + + if !(eOnePass != ONEPASS_SINGLE) { + goto __26 + } + Xsqlite3MultiWrite(tls, pParse) +__26: + ; + if !(Xsqlite3WhereUsesDeferredSeek(tls, pWInfo) != 0) { + goto __27 + } + Xsqlite3VdbeAddOp1(tls, v, OP_FinishSeek, iTabCur) +__27: + ; + + // Keep track of the number of rows to be deleted + if !(memCnt != 0) { + goto __28 + } + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, memCnt, 1) +__28: + ; + + // Extract the rowid or primary key for the current row + if !(pPk != 0) { + goto __29 + } + i = 0 +__31: + if !(i < int32(nPk)) { + goto __33 + } + + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, + int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), (iPk + i)) + goto __32 +__32: + i++ + goto __31 + goto __33 +__33: + ; + iKey = iPk + goto __30 +__29: + iKey = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iTabCur, -1, iKey) +__30: + ; + + if !(eOnePass != ONEPASS_OFF) { + goto __34 + } + // For ONEPASS, no need to store the rowid/primary-key. There is only + // one, so just keep it in its register(s) and fall through to the + // delete code. + nKey = nPk // OP_Found will use an unpacked key + aToOpen = Xsqlite3DbMallocRawNN(tls, db, (uint64(nIdx + 2))) + if !(aToOpen == uintptr(0)) { + goto __36 + } + Xsqlite3WhereEnd(tls, pWInfo) + goto delete_from_cleanup +__36: + ; + libc.Xmemset(tls, aToOpen, 1, (uint64(nIdx + 1))) + *(*U8)(unsafe.Pointer(aToOpen + uintptr((nIdx + 1)))) = U8(0) + if !(*(*int32)(unsafe.Pointer(bp + 72 /* &aiCurOnePass[0] */)) >= 0) { + goto __37 + } + *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 72 /* &aiCurOnePass[0] */)) - iTabCur)))) = U8(0) +__37: + ; + if !(*(*int32)(unsafe.Pointer(bp + 72 /* &aiCurOnePass[0] */ + 1*4)) >= 0) { + goto __38 + } + *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 72 /* &aiCurOnePass[0] */ + 1*4)) - iTabCur)))) = U8(0) +__38: + ; + if !(addrEphOpen != 0) { + goto __39 + } + Xsqlite3VdbeChangeToNoop(tls, v, addrEphOpen) +__39: + ; + addrBypass = Xsqlite3VdbeMakeLabel(tls, pParse) + goto __35 +__34: + if !(pPk != 0) { + goto __40 + } + // Add the PK key for this row to the temporary table + iKey = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + nKey = int16(0) // Zero tells OP_Found to use a composite key + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, iPk, int32(nPk), iKey, + Xsqlite3IndexAffinityStr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pPk), int32(nPk)) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iEphCur, iKey, iPk, int32(nPk)) + goto __41 +__40: + // Add the rowid of the row to be deleted to the RowSet + nKey = int16(1) // OP_DeferredSeek always uses a single rowid + Xsqlite3VdbeAddOp2(tls, v, OP_RowSetAdd, iRowSet, iKey) +__41: + ; + Xsqlite3WhereEnd(tls, pWInfo) +__35: + ; + + // Unless this is a view, open cursors for the table we are + // deleting from and all its indices. If this is a view, then the + // only effect this statement has is to fire the INSTEAD OF + // triggers. + if !(!(isView != 0)) { + goto __42 + } + iAddrOnce = 0 + if !(eOnePass == ONEPASS_MULTI) { + goto __43 + } + iAddrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) +__43: + ; + + Xsqlite3OpenTableAndIndices(tls, pParse, pTab, OP_OpenWrite, uint8(OPFLAG_FORDELETE), + iTabCur, aToOpen, bp+80 /* &iDataCur */, bp+84 /* &iIdxCur */) + + if !(eOnePass == ONEPASS_MULTI) { + goto __44 + } + Xsqlite3VdbeJumpHereOrPopInst(tls, v, iAddrOnce) +__44: + ; +__42: + ; + + // Set up a loop over the rowids/primary-keys that were found in the + // where-clause loop above. + if !(eOnePass != ONEPASS_OFF) { + goto __45 + } + // OP_Found will use an unpacked key + if !(!((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) && (*(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 80 /* iDataCur */)) - iTabCur)))) != 0)) { + goto __47 + } + + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, *(*int32)(unsafe.Pointer(bp + 80 /* iDataCur */)), addrBypass, iKey, int32(nKey)) + +__47: + ; + goto __46 +__45: + if !(pPk != 0) { + goto __48 + } + addrLoop = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, iEphCur) + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __50 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iEphCur, 0, iKey) + goto __51 +__50: + Xsqlite3VdbeAddOp2(tls, v, OP_RowData, iEphCur, iKey) +__51: + ; + // OP_Found will use a composite key + goto __49 +__48: + addrLoop = Xsqlite3VdbeAddOp3(tls, v, OP_RowSetRead, iRowSet, 0, iKey) + +__49: + ; +__46: + ; + + // Delete the row + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __52 + } + pVTab = Xsqlite3GetVTable(tls, db, pTab) + Xsqlite3VtabMakeWritable(tls, pParse, pTab) + + Xsqlite3MayAbort(tls, pParse) + if !(eOnePass == ONEPASS_SINGLE) { + goto __54 + } + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iTabCur) + if !((*Parse)(unsafe.Pointer((pParse))).FpToplevel == uintptr(0)) { + goto __55 + } + (*Parse)(unsafe.Pointer(pParse)).FisMultiWrite = U8(0) +__55: + ; +__54: + ; + Xsqlite3VdbeAddOp4(tls, v, OP_VUpdate, 0, 1, iKey, pVTab, -12) + Xsqlite3VdbeChangeP5(tls, v, uint16(OE_Abort)) + goto __53 +__52: + + count = (libc.Bool32(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0)) // True to count changes + Xsqlite3GenerateRowDelete(tls, pParse, pTab, pTrigger, *(*int32)(unsafe.Pointer(bp + 80 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 84 /* iIdxCur */)), + iKey, nKey, uint8(count), uint8(OE_Default), uint8(eOnePass), *(*int32)(unsafe.Pointer(bp + 72 /* &aiCurOnePass[0] */ + 1*4))) +__53: + ; + + // End of the loop over all rowids/primary-keys. + if !(eOnePass != ONEPASS_OFF) { + goto __56 + } + Xsqlite3VdbeResolveLabel(tls, v, addrBypass) + Xsqlite3WhereEnd(tls, pWInfo) + goto __57 +__56: + if !(pPk != 0) { + goto __58 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iEphCur, (addrLoop + 1)) + Xsqlite3VdbeJumpHere(tls, v, addrLoop) + goto __59 +__58: + Xsqlite3VdbeGoto(tls, v, addrLoop) + Xsqlite3VdbeJumpHere(tls, v, addrLoop) +__59: + ; +__57: + ; +__16: + ; // End non-truncate path + + // Update the sqlite_sequence table by storing the content of the + // maximum rowid counter values recorded while inserting into + // autoincrement tables. + if !((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && ((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab == uintptr(0))) { + goto __60 + } + Xsqlite3AutoincrementEnd(tls, pParse) +__60: + ; + + // Return the number of rows that were deleted. If this routine is + // generating code because of a call to sqlite3NestedParse(), do not + // invoke the callback function. + if !(memCnt != 0) { + goto __61 + } + Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) + Xsqlite3VdbeSetNumCols(tls, v, 1) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13511 /* "rows deleted" */, uintptr(0)) +__61: + ; + +delete_from_cleanup: + Xsqlite3AuthContextPop(tls, bp /* &sContext */) + Xsqlite3SrcListDelete(tls, db, pTabList) + Xsqlite3ExprDelete(tls, db, pWhere) + Xsqlite3DbFree(tls, db, aToOpen) + return +} + +// Make sure "isView" and other macros defined above are undefined. Otherwise +// they may interfere with compilation of other functions in this file +// (or in another file, if this file becomes part of the amalgamation). + +// This routine generates VDBE code that causes a single row of a +// single table to be deleted. Both the original table entry and +// all indices are removed. +// +// Preconditions: +// +// 1. iDataCur is an open cursor on the btree that is the canonical data +// store for the table. (This will be either the table itself, +// in the case of a rowid table, or the PRIMARY KEY index in the case +// of a WITHOUT ROWID table.) +// +// 2. Read/write cursors for all indices of pTab must be open as +// cursor number iIdxCur+i for the i-th index. +// +// 3. The primary key for the row to be deleted must be stored in a +// sequence of nPk memory cells starting at iPk. If nPk==0 that means +// that a search record formed from OP_MakeRecord is contained in the +// single memory location iPk. +// +// eMode: +// Parameter eMode may be passed either ONEPASS_OFF (0), ONEPASS_SINGLE, or +// ONEPASS_MULTI. If eMode is not ONEPASS_OFF, then the cursor +// iDataCur already points to the row to delete. If eMode is ONEPASS_OFF +// then this function must seek iDataCur to the entry identified by iPk +// and nPk before reading from it. +// +// If eMode is ONEPASS_MULTI, then this call is being made as part +// of a ONEPASS delete that affects multiple rows. In this case, if +// iIdxNoSeek is a valid cursor number (>=0) and is not the same as +// iDataCur, then its position should be preserved following the delete +// operation. Or, if iIdxNoSeek is not a valid cursor number, the +// position of iDataCur should be preserved instead. +// +// iIdxNoSeek: +// If iIdxNoSeek is a valid cursor number (>=0) not equal to iDataCur, +// then it identifies an index cursor (from within array of cursors +// starting at iIdxCur) that already points to the index entry to be deleted. +// Except, this optimization is disabled if there are BEFORE triggers since +// the trigger body might have moved the cursor. +func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTrigger uintptr, iDataCur int32, iIdxCur int32, iPk int32, nPk I16, count U8, onconf U8, eMode U8, iIdxNoSeek int32) { /* sqlite3.c:119028:21: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // Vdbe + var iOld int32 = 0 // First register in OLD.* array + var iLabel int32 // Label resolved to end of generated code + var opSeek U8 // Seek opcode + + // Vdbe is guaranteed to have been allocated by this stage. + + // Seek cursor iCur to the row to delete. If this row no longer exists + // (this can happen if a trigger program has already deleted it), do + // not attempt to delete it or fire any DELETE triggers. + iLabel = Xsqlite3VdbeMakeLabel(tls, pParse) + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + opSeek = uint8(OP_NotExists) + } else { + opSeek = uint8(OP_NotFound) + } + if int32(eMode) == ONEPASS_OFF { + Xsqlite3VdbeAddOp4Int(tls, v, int32(opSeek), iDataCur, iLabel, iPk, int32(nPk)) + + } + + // If there are any triggers to fire, allocate a range of registers to + // use for the old.* references in the triggers. + if (Xsqlite3FkRequired(tls, pParse, pTab, uintptr(0), 0) != 0) || (pTrigger != 0) { + var mask U32 // Mask of OLD.* columns in use + var iCol int32 // Iterator used while populating OLD.* + var addrStart int32 // Start of BEFORE trigger programs + + // TODO: Could use temporary registers here. Also could attempt to + // avoid copying the contents of the rowid register. + mask = Xsqlite3TriggerColmask(tls, + pParse, pTrigger, uintptr(0), 0, (TRIGGER_BEFORE | TRIGGER_AFTER), pTab, int32(onconf)) + mask = mask | (Xsqlite3FkOldmask(tls, pParse, pTab)) + iOld = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (1 + int32((*Table)(unsafe.Pointer(pTab)).FnCol)) + + // Populate the OLD.* pseudo-table register array. These values will be + // used by any BEFORE and AFTER triggers that exist. + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, iPk, iOld) + for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { + + if (mask == 0xffffffff) || ((iCol <= 31) && ((mask & (uint32((uint32(1))) << (iCol))) != U32(0))) { + var kk int32 = int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(iCol))) + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, iCol, ((iOld + kk) + 1)) + } + } + + // Invoke BEFORE DELETE trigger programs. + addrStart = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3CodeRowTrigger(tls, pParse, pTrigger, + TK_DELETE, uintptr(0), TRIGGER_BEFORE, pTab, iOld, int32(onconf), iLabel) + + // If any BEFORE triggers were coded, then seek the cursor to the + // row to be deleted again. It may be that the BEFORE triggers moved + // the cursor or already deleted the row that the cursor was + // pointing to. + // + // Also disable the iIdxNoSeek optimization since the BEFORE trigger + // may have moved that cursor. + if addrStart < Xsqlite3VdbeCurrentAddr(tls, v) { + Xsqlite3VdbeAddOp4Int(tls, v, int32(opSeek), iDataCur, iLabel, iPk, int32(nPk)) + + iIdxNoSeek = -1 + } + + // Do FK processing. This call checks that any FK constraints that + // refer to this table (i.e. constraints attached to other tables) + // are not violated by deleting this row. + Xsqlite3FkCheck(tls, pParse, pTab, iOld, 0, uintptr(0), 0) + } + + // Delete the index and table entries. Skip this step if pTab is really + // a view (in which case the only effect of the DELETE statement is to + // fire the INSTEAD OF triggers). + // + // If variable 'count' is non-zero, then this OP_Delete instruction should + // invoke the update-hook. The pre-update-hook, on the other hand should + // be invoked unless table pTab is a system table. The difference is that + // the update-hook is not invoked for rows removed by REPLACE, but the + // pre-update-hook is. + if (*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0) { + var p5 U8 = U8(0) + Xsqlite3GenerateRowIndexDelete(tls, pParse, pTab, iDataCur, iIdxCur, uintptr(0), iIdxNoSeek) + Xsqlite3VdbeAddOp2(tls, v, OP_Delete, iDataCur, func() int32 { + if count != 0 { + return OPFLAG_NCHANGE + } + return 0 + }()) + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10073 /* "sqlite_stat1" */)) { + Xsqlite3VdbeAppendP4(tls, v, pTab, -6) + } + if int32(eMode) != ONEPASS_OFF { + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_AUXDELETE)) + } + if (iIdxNoSeek >= 0) && (iIdxNoSeek != iDataCur) { + Xsqlite3VdbeAddOp1(tls, v, OP_Delete, iIdxNoSeek) + } + if int32(eMode) == ONEPASS_MULTI { + p5 = U8(int32(p5) | (OPFLAG_SAVEPOSITION)) + } + Xsqlite3VdbeChangeP5(tls, v, uint16(p5)) + } + + // Do any ON CASCADE, SET NULL or SET DEFAULT operations required to + // handle rows (possibly in other tables) that refer via a foreign key + // to the row just deleted. + Xsqlite3FkActions(tls, pParse, pTab, uintptr(0), iOld, uintptr(0), 0) + + // Invoke AFTER DELETE trigger programs. + Xsqlite3CodeRowTrigger(tls, pParse, pTrigger, + TK_DELETE, uintptr(0), TRIGGER_AFTER, pTab, iOld, int32(onconf), iLabel) + + // Jump here if the row had already been deleted before any BEFORE + // trigger programs were invoked. Or if a trigger program throws a + // RAISE(IGNORE) exception. + Xsqlite3VdbeResolveLabel(tls, v, iLabel) + +} + +// This routine generates VDBE code that causes the deletion of all +// index entries associated with a single row of a single table, pTab +// +// Preconditions: +// +// 1. A read/write cursor "iDataCur" must be open on the canonical storage +// btree for the table pTab. (This will be either the table itself +// for rowid tables or to the primary key index for WITHOUT ROWID +// tables.) +// +// 2. Read/write cursors for all indices of pTab must be open as +// cursor number iIdxCur+i for the i-th index. (The pTab->pIndex +// index is the 0-th index.) +// +// 3. The "iDataCur" cursor must be already be positioned on the row +// that is to be deleted. +func Xsqlite3GenerateRowIndexDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, iDataCur int32, iIdxCur int32, aRegIdx uintptr, iIdxNoSeek int32) { /* sqlite3.c:119180:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 // Index loop counter + var r1 int32 = -1 // Register holding an index key + // var iPartIdxLabel int32 at bp, 4 + // Jump destination for skipping partial index entries + var pIdx uintptr // Current index + var pPrior uintptr = uintptr(0) // Prior index + var v uintptr // The prepared statement under construction + var pPk uintptr // PRIMARY KEY index, or NULL for rowid tables + + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + pPk = uintptr(0) + } else { + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + } + i = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__1: + if !(pIdx != 0) { + goto __3 + } + { + + if (aRegIdx != uintptr(0)) && (*(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) == 0) { + goto __2 + } + if pIdx == pPk { + goto __2 + } + if (iIdxCur + i) == iIdxNoSeek { + goto __2 + } + + r1 = Xsqlite3GenerateIndexKey(tls, pParse, pIdx, iDataCur, 0, 1, + bp /* &iPartIdxLabel */, pPrior, r1) + Xsqlite3VdbeAddOp3(tls, v, OP_IdxDelete, (iIdxCur + i), r1, + func() int32 { + if (uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0 { + return int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + } + return int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + }()) + Xsqlite3VdbeChangeP5(tls, v, uint16(1)) // Cause IdxDelete to error if no entry found + Xsqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp /* iPartIdxLabel */))) + pPrior = pIdx + + } + goto __2 +__2: + i++ + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __1 + goto __3 +__3: +} + +// Generate code that will assemble an index key and stores it in register +// regOut. The key with be for index pIdx which is an index on pTab. +// iCur is the index of a cursor open on the pTab table and pointing to +// the entry that needs indexing. If pTab is a WITHOUT ROWID table, then +// iCur must be the cursor of the PRIMARY KEY index. +// +// Return a register number which is the first in a block of +// registers that holds the elements of the index key. The +// block of registers has already been deallocated by the time +// this routine returns. +// +// If *piPartIdxLabel is not NULL, fill it in with a label and jump +// to that label if pIdx is a partial index that should be skipped. +// The label should be resolved using sqlite3ResolvePartIdxLabel(). +// A partial index should be skipped if its WHERE clause evaluates +// to false or null. If pIdx is not a partial index, *piPartIdxLabel +// will be set to zero which is an empty label that is ignored by +// sqlite3ResolvePartIdxLabel(). +// +// The pPrior and regPrior parameters are used to implement a cache to +// avoid unnecessary register loads. If pPrior is not NULL, then it is +// a pointer to a different index for which an index key has just been +// computed into register regPrior. If the current pIdx index is generating +// its key into the same sequence of registers and if pPrior and pIdx share +// a column in common, then the register corresponding to that column already +// holds the correct value and the loading of that register is skipped. +// This optimization is helpful when doing a DELETE or an INTEGRITY_CHECK +// on a table with multiple indices, and especially with the ROWID or +// PRIMARY KEY columns of the index. +func Xsqlite3GenerateIndexKey(tls *libc.TLS, pParse uintptr, pIdx uintptr, iDataCur int32, regOut int32, prefixOnly int32, piPartIdxLabel uintptr, pPrior uintptr, regPrior int32) int32 { /* sqlite3.c:119245:20: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var j int32 + var regBase int32 + var nCol int32 + + if piPartIdxLabel != 0 { + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + *(*int32)(unsafe.Pointer(piPartIdxLabel)) = Xsqlite3VdbeMakeLabel(tls, pParse) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = (iDataCur + 1) + Xsqlite3ExprIfFalseDup(tls, pParse, (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere, *(*int32)(unsafe.Pointer(piPartIdxLabel)), + SQLITE_JUMPIFNULL) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + pPrior = uintptr(0) // Ticket a9efb42811fa41ee 2019-11-02; + // pPartIdxWhere may have corrupted regPrior registers + } else { + *(*int32)(unsafe.Pointer(piPartIdxLabel)) = 0 + } + } + if (prefixOnly != 0) && ((uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0) { + nCol = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + } else { + nCol = int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + } + regBase = Xsqlite3GetTempRange(tls, pParse, nCol) + if (pPrior != 0) && ((regBase != regPrior) || ((*Index)(unsafe.Pointer(pPrior)).FpPartIdxWhere != 0)) { + pPrior = uintptr(0) + } + for j = 0; j < nCol; j++ { + if ((pPrior != 0) && + (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPrior)).FaiColumn + uintptr(j)*2))) == int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))))) && + (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPrior)).FaiColumn + uintptr(j)*2))) != (-2)) { + // This column was already computed by the previous index + continue + } + Xsqlite3ExprCodeLoadIndexColumn(tls, pParse, pIdx, iDataCur, j, (regBase + j)) + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) >= 0 { + // If the column affinity is REAL but the number is an integer, then it + // might be stored in the table as an integer (using a compact + // representation) then converted to REAL by an OP_RealAffinity opcode. + // But we are getting ready to store this value back into an index, where + // it should be converted by to INTEGER again. So omit the + // OP_RealAffinity opcode if it is present + Xsqlite3VdbeDeletePriorOpcode(tls, v, uint8(OP_RealAffinity)) + } + } + if regOut != 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regBase, nCol, regOut) + } + Xsqlite3ReleaseTempRange(tls, pParse, regBase, nCol) + return regBase +} + +// If a prior call to sqlite3GenerateIndexKey() generated a jump-over label +// because it was a partial index, then this routine should be called to +// resolve that label. +func Xsqlite3ResolvePartIdxLabel(tls *libc.TLS, pParse uintptr, iLabel int32) { /* sqlite3.c:119307:21: */ + if iLabel != 0 { + Xsqlite3VdbeResolveLabel(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, iLabel) + } +} + +//************* End of delete.c ********************************************* +//************* Begin file func.c ******************************************* +// 2002 February 23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the C-language implementations for many of the SQL +// functions of SQLite. (Some function, and in particular the date and +// time functions, are implemented separately.) +// #include "sqliteInt.h" +// #include +// #include +// #include +// #include "vdbeInt.h" + +// Return the collating function associated with a function. +func sqlite3GetFuncCollSeq(tls *libc.TLS, context uintptr) uintptr { /* sqlite3.c:119341:16: */ + var pOp uintptr + + pOp = ((*Vdbe)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(context)).FpVdbe)).FaOp + uintptr(((*Sqlite3_context)(unsafe.Pointer(context)).FiOp-1))*24) + + return *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) +} + +// Indicate that the accumulator load should be skipped on this +// iteration of the aggregate loop. +func sqlite3SkipAccumulatorLoad(tls *libc.TLS, context uintptr) { /* sqlite3.c:119354:13: */ + + (*Sqlite3_context)(unsafe.Pointer(context)).FisError = -1 + (*Sqlite3_context)(unsafe.Pointer(context)).FskipFlag = U8(1) +} + +// Implementation of the non-aggregate min() and max() functions +func minmaxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119363:13: */ + var i int32 + var mask int32 // 0 for min() or 0xffffffff for max() + var iBest int32 + var pColl uintptr + + if Xsqlite3_user_data(tls, context) == uintptr(0) { + mask = 0 + } else { + mask = -1 + } + pColl = sqlite3GetFuncCollSeq(tls, context) + + iBest = 0 + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL { + return + } + for i = 1; i < argc; i++ { + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) == SQLITE_NULL { + return + } + if (Xsqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8)), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), pColl) ^ mask) >= 0 { + + iBest = i + } + } + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(iBest)*8))) +} + +// Return the type of the argument. +func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:119393:13: */ + var i int32 = (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) - 1) + _ = NotUsed + + // EVIDENCE-OF: R-01470-60482 The sqlite3_value_type(V) interface returns + // the datatype code for the initial datatype of the sqlite3_value object + // V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT, + // SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. + Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) +} + +var azType2 = [5]uintptr{ts + 5269 /* "integer" */, ts + 5264 /* "real" */, ts + 13524 /* "text" */, ts + 13529 /* "blob" */, ts + 5259 /* "null" */} /* sqlite3.c:119398:21 */ + +// Implementation of the length() function +func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ + + _ = argc + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case SQLITE_BLOB: + fallthrough + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + { + Xsqlite3_result_int(tls, context, Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + break + + } + case SQLITE_TEXT: + { + var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var z0 uintptr + var c uint8 + if z == uintptr(0) { + return + } + z0 = z + for (int32(libc.AssignUint8(&c, *(*uint8)(unsafe.Pointer(z))))) != 0 { + z++ + if int32(c) >= 0xc0 { + for (int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80 { + z++ + z0++ + } + } + } + Xsqlite3_result_int(tls, context, (int32((int64(z) - int64(z0)) / 1))) + break + + } + default: + { + Xsqlite3_result_null(tls, context) + break + + } + } +} + +// Implementation of the abs() function. +// +// IMP: R-23979-26855 The abs(X) function returns the absolute value of +// the numeric argument X. +func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119460:13: */ + + _ = argc + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case SQLITE_INTEGER: + { + var iVal I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + if iVal < int64(0) { + if iVal == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) { + // IMP: R-31676-45509 If X is the integer -9223372036854775808 + // then abs(X) throws an integer overflow error since there is no + // equivalent positive 64-bit two complement value. + Xsqlite3_result_error(tls, context, ts+13534 /* "integer overflow" */, -1) + return + } + iVal = -iVal + } + Xsqlite3_result_int64(tls, context, iVal) + break + + } + case SQLITE_NULL: + { + // IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. + Xsqlite3_result_null(tls, context) + break + + } + default: + { + // Because sqlite3_value_double() returns 0.0 if the argument is not + // something that can be converted into a number, we have: + // IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob + // that cannot be converted to a numeric value. + var rVal float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + if rVal < float64(0) { + rVal = -rVal + } + Xsqlite3_result_double(tls, context, rVal) + break + + } + } +} + +// Implementation of the instr() function. +// +// instr(haystack,needle) finds the first occurrence of needle +// in haystack and returns the number of previous characters plus 1, +// or 0 if needle does not occur within haystack. +// +// If both haystack and needle are BLOBs, then the result is one more than +// the number of bytes in haystack prior to the first occurrence of needle, +// or 0 if needle never occurs in haystack. +func instrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119509:13: */ + var zHaystack uintptr + var zNeedle uintptr + var nHaystack int32 + var nNeedle int32 + var typeHaystack int32 + var typeNeedle int32 + var N int32 + var isText int32 + var firstChar uint8 + var pC1 uintptr + var pC2 uintptr + N = 1 + pC1 = uintptr(0) + pC2 = uintptr(0) + + _ = argc + typeHaystack = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + typeNeedle = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if !((typeHaystack == SQLITE_NULL) || (typeNeedle == SQLITE_NULL)) { + goto __1 + } + return +__1: + ; + nHaystack = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + nNeedle = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if !(nNeedle > 0) { + goto __2 + } + if !((typeHaystack == SQLITE_BLOB) && (typeNeedle == SQLITE_BLOB)) { + goto __3 + } + zHaystack = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + zNeedle = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + isText = 0 + goto __4 +__3: + if !((typeHaystack != SQLITE_BLOB) && (typeNeedle != SQLITE_BLOB)) { + goto __5 + } + zHaystack = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zNeedle = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + isText = 1 + goto __6 +__5: + pC1 = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(argv))) + zHaystack = Xsqlite3_value_text(tls, pC1) + if !(zHaystack == uintptr(0)) { + goto __7 + } + goto endInstrOOM +__7: + ; + nHaystack = Xsqlite3_value_bytes(tls, pC1) + pC2 = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + zNeedle = Xsqlite3_value_text(tls, pC2) + if !(zNeedle == uintptr(0)) { + goto __8 + } + goto endInstrOOM +__8: + ; + nNeedle = Xsqlite3_value_bytes(tls, pC2) + isText = 1 +__6: + ; +__4: + ; + if !((zNeedle == uintptr(0)) || ((nHaystack != 0) && (zHaystack == uintptr(0)))) { + goto __9 + } + goto endInstrOOM +__9: + ; + firstChar = *(*uint8)(unsafe.Pointer(zNeedle)) +__10: + if !((nNeedle <= nHaystack) && + ((int32(*(*uint8)(unsafe.Pointer(zHaystack))) != int32(firstChar)) || (libc.Xmemcmp(tls, zHaystack, zNeedle, uint64(nNeedle)) != 0))) { + goto __11 + } + N++ +__12: + nHaystack-- + zHaystack++ + goto __13 +__13: + if (isText != 0) && ((int32(*(*uint8)(unsafe.Pointer(zHaystack))) & 0xc0) == 0x80) { + goto __12 + } + goto __14 +__14: + ; + goto __10 +__11: + ; + if !(nNeedle > nHaystack) { + goto __15 + } + N = 0 +__15: + ; +__2: + ; + Xsqlite3_result_int(tls, context, N) +endInstr: + Xsqlite3_value_free(tls, pC1) + Xsqlite3_value_free(tls, pC2) + return +endInstrOOM: + Xsqlite3_result_error_nomem(tls, context) + goto endInstr +} + +// Implementation of the printf() function. +func printfFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119577:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var x PrintfArguments at bp+40, 16 + + // var str StrAccum at bp+8, 32 + + var zFormat uintptr + var n int32 + var db uintptr = Xsqlite3_context_db_handle(tls, context) + + if (argc >= 1) && ((libc.AssignUintptr(&zFormat, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))))) != uintptr(0)) { + (*PrintfArguments)(unsafe.Pointer(bp + 40 /* &x */)).FnArg = (argc - 1) + (*PrintfArguments)(unsafe.Pointer(bp + 40 /* &x */)).FnUsed = 0 + (*PrintfArguments)(unsafe.Pointer(bp + 40 /* &x */)).FapArg = (argv + uintptr(1)*8) + Xsqlite3StrAccumInit(tls, bp+8 /* &str */, db, uintptr(0), 0, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) + (*StrAccum)(unsafe.Pointer(bp + 8 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_SQLFUNC) + Xsqlite3_str_appendf(tls, bp+8 /* &str */, zFormat, libc.VaList(bp, bp+40 /* &x */)) + n = int32((*StrAccum)(unsafe.Pointer(bp + 8 /* &str */)).FnChar) + Xsqlite3_result_text(tls, context, Xsqlite3StrAccumFinish(tls, bp+8 /* &str */), n, + *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) + } +} + +// Implementation of the substr() function. +// +// substr(x,p1,p2) returns p2 characters of x[] beginning with p1. +// p1 is 1-indexed. So substr(x,1,1) returns the first character +// of x. If x is text, then we actually count UTF-8 characters. +// If x is a blob, then we count bytes. +// +// If p1 is negative, then we begin abs(p1) from the end of x[]. +// +// If p2 is negative, return the p2 characters preceding p1. +func substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119613:13: */ + var z uintptr + var z2 uintptr + var len int32 + var p0type int32 + var p1 I64 + var p2 I64 + var negP2 int32 = 0 + + if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == SQLITE_NULL) || + ((argc == 3) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) == SQLITE_NULL)) { + return + } + p0type = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + p1 = I64(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + if p0type == SQLITE_BLOB { + len = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + if z == uintptr(0) { + return + } + + } else { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if z == uintptr(0) { + return + } + len = 0 + if p1 < int64(0) { + for z2 = z; *(*uint8)(unsafe.Pointer(z2)) != 0; len++ { + { + if (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z2, 1))))) >= 0xc0 { + for (int32(*(*uint8)(unsafe.Pointer(z2))) & 0xc0) == 0x80 { + z2++ + } + } + } + + } + } + } + if argc == 3 { + p2 = I64(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + if p2 < int64(0) { + p2 = -p2 + negP2 = 1 + } + } else { + p2 = I64(*(*int32)(unsafe.Pointer((Xsqlite3_context_db_handle(tls, context) + 128 /* &.aLimit */)))) + } + if p1 < int64(0) { + p1 = p1 + (I64(len)) + if p1 < int64(0) { + p2 = p2 + (p1) + if p2 < int64(0) { + p2 = int64(0) + } + p1 = int64(0) + } + } else if p1 > int64(0) { + p1-- + } else if p2 > int64(0) { + p2-- + } + if negP2 != 0 { + p1 = p1 - (p2) + if p1 < int64(0) { + p2 = p2 + (p1) + p1 = int64(0) + } + } + + if p0type != SQLITE_BLOB { + for (*(*uint8)(unsafe.Pointer(z)) != 0) && (p1 != 0) { + { + if (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0 { + for (int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80 { + z++ + } + } + } + + p1-- + } + for z2 = z; (*(*uint8)(unsafe.Pointer(z2)) != 0) && (p2 != 0); p2-- { + { + if (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z2, 1))))) >= 0xc0 { + for (int32(*(*uint8)(unsafe.Pointer(z2))) & 0xc0) == 0x80 { + z2++ + } + } + } + + } + Xsqlite3_result_text64(tls, context, z, (uint64((int64(z2) - int64(z)) / 1)), libc.UintptrFromInt32(-1), + uint8(SQLITE_UTF8)) + } else { + if (p1 + p2) > I64(len) { + p2 = (I64(len) - p1) + if p2 < int64(0) { + p2 = int64(0) + } + } + Xsqlite3_result_blob64(tls, context, (z + uintptr(p1)), U64(p2), libc.UintptrFromInt32(-1)) + } +} + +// Implementation of the round() function +func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119708:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var n int32 = 0 + // var r float64 at bp+16, 8 + + var zBuf uintptr + + if argc == 2 { + if SQLITE_NULL == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) { + return + } + n = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if n > 30 { + n = 30 + } + if n < 0 { + n = 0 + } + } + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL { + return + } + *(*float64)(unsafe.Pointer(bp + 16 /* r */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + // If Y==0 and X will fit in a 64-bit int, + // handle the rounding directly, + // otherwise use printf. + if (*(*float64)(unsafe.Pointer(bp + 16 /* r */)) < -4503599627370496.0) || (*(*float64)(unsafe.Pointer(bp + 16 /* r */)) > +4503599627370496.0) { + // The value has no fractional part so there is nothing to round + } else if n == 0 { + *(*float64)(unsafe.Pointer(bp + 16 /* r */)) = float64((Sqlite_int64(*(*float64)(unsafe.Pointer(bp + 16 /* r */)) + (func() float64 { + if *(*float64)(unsafe.Pointer(bp + 16 /* r */)) < float64(0) { + return -0.5 + } + return +0.5 + }())))) + } else { + zBuf = Xsqlite3_mprintf(tls, ts+13551 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + if zBuf == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + Xsqlite3AtoF(tls, zBuf, bp+16 /* &r */, Xsqlite3Strlen30(tls, zBuf), uint8(SQLITE_UTF8)) + Xsqlite3_free(tls, zBuf) + } + Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 16 /* r */))) +} + +// Allocate nByte bytes of space using sqlite3Malloc(). If the +// allocation fails, call sqlite3_result_error_nomem() to notify +// the database handle that malloc() has failed and return NULL. +// If nByte is larger than the maximum string or blob length, then +// raise an SQLITE_TOOBIG exception and return NULL. +func contextMalloc(tls *libc.TLS, context uintptr, nByte I64) uintptr { /* sqlite3.c:119749:13: */ + var z uintptr + var db uintptr = Xsqlite3_context_db_handle(tls, context) + + if nByte > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) { + Xsqlite3_result_error_toobig(tls, context) + z = uintptr(0) + } else { + z = Xsqlite3Malloc(tls, uint64(nByte)) + if !(z != 0) { + Xsqlite3_result_error_nomem(tls, context) + } + } + return z +} + +// Implementation of the upper() and lower() SQL functions. +func upperFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119770:13: */ + var z1 uintptr + var z2 uintptr + var i int32 + var n int32 + _ = argc + z2 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + // Verify that the call to _bytes() does not invalidate the _text() pointer + + if z2 != 0 { + z1 = contextMalloc(tls, context, ((I64(n)) + int64(1))) + if z1 != 0 { + for i = 0; i < n; i++ { + *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = (int8((int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))) & ^(int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) & 0x20))) + } + Xsqlite3_result_text(tls, context, z1, n, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + } +} + +func lowerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119789:13: */ + var z1 uintptr + var z2 uintptr + var i int32 + var n int32 + _ = argc + z2 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + // Verify that the call to _bytes() does not invalidate the _text() pointer + + if z2 != 0 { + z1 = contextMalloc(tls, context, ((I64(n)) + int64(1))) + if z1 != 0 { + for i = 0; i < n; i++ { + *(*int8)(unsafe.Pointer(z1 + uintptr(i))) = int8(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i))))]) + } + Xsqlite3_result_text(tls, context, z1, n, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + } +} + +// Some functions like COALESCE() and IFNULL() and UNLIKELY() are implemented +// as VDBE code so that unused argument values do not have to be computed. +// However, we still need some kind of function implementation for this +// routines in the function table. The noopFunc macro provides this. +// noopFunc will never be called so it doesn't matter what the implementation +// is. We might as well use the "version()" function as a substitute. + +// Implementation of random(). Return a random integer. +func randomFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:119822:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var r Sqlite_int64 at bp, 8 + + _ = NotUsed + _ = NotUsed2 + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(Sqlite_int64(0))), bp /* &r */) + if *(*Sqlite_int64)(unsafe.Pointer(bp /* r */)) < int64(0) { + // We need to prevent a random number of 0x8000000000000000 + // (or -9223372036854775808) since when you do abs() of that + // number of you get the same value back again. To do this + // in a way that is testable, mask the sign bit off of negative + // values, resulting in a positive value. Then take the + // 2s complement of that positive value. The end result can + // therefore be no less than -9223372036854775807. + *(*Sqlite_int64)(unsafe.Pointer(bp /* r */)) = -(*(*Sqlite_int64)(unsafe.Pointer(bp /* r */)) & (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + } + Xsqlite3_result_int64(tls, context, *(*Sqlite_int64)(unsafe.Pointer(bp /* r */))) +} + +// Implementation of randomblob(N). Return a random blob +// that is N bytes long. +func randomBlob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119848:13: */ + var n Sqlite3_int64 + var p uintptr + + _ = argc + n = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + if n < int64(1) { + n = int64(1) + } + p = contextMalloc(tls, context, n) + if p != 0 { + Xsqlite3_randomness(tls, int32(n), p) + Xsqlite3_result_blob(tls, context, p, int32(n), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } +} + +// Implementation of the last_insert_rowid() SQL function. The return +// value is the same as the sqlite3_last_insert_rowid() API function. +func last_insert_rowid(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:119872:13: */ + var db uintptr = Xsqlite3_context_db_handle(tls, context) + _ = NotUsed + _ = NotUsed2 + // IMP: R-51513-12026 The last_insert_rowid() SQL function is a + // wrapper around the sqlite3_last_insert_rowid() C/C++ interface + // function. + Xsqlite3_result_int64(tls, context, Xsqlite3_last_insert_rowid(tls, db)) +} + +// Implementation of the changes() SQL function. +// +// IMP: R-62073-11209 The changes() SQL function is a wrapper +// around the sqlite3_changes() C/C++ function and hence follows the same +// rules for counting changes. +func changes(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:119892:13: */ + var db uintptr = Xsqlite3_context_db_handle(tls, context) + _ = NotUsed + _ = NotUsed2 + Xsqlite3_result_int(tls, context, Xsqlite3_changes(tls, db)) +} + +// Implementation of the total_changes() SQL function. The return value is +// the same as the sqlite3_total_changes() API function. +func total_changes(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:119906:13: */ + var db uintptr = Xsqlite3_context_db_handle(tls, context) + _ = NotUsed + _ = NotUsed2 + // IMP: R-52756-41993 This function is a wrapper around the + // sqlite3_total_changes() C/C++ interface. + Xsqlite3_result_int(tls, context, Xsqlite3_total_changes(tls, db)) +} + +// A structure defining how to do GLOB-style comparisons. +type compareInfo = struct { + FmatchAll U8 + FmatchOne U8 + FmatchSet U8 + FnoCase U8 +} /* sqlite3.c:119921:1 */ + +// For LIKE and GLOB matching on EBCDIC machines, assume that every +// character is exactly one byte in size. Also, provde the Utf8Read() +// macro for fast reading of the next character in the common case where +// the next character is ASCII. + +var globInfo = compareInfo{FmatchAll: U8('*'), FmatchOne: U8('?'), FmatchSet: U8('[')} /* sqlite3.c:119941:33 */ +// The correct SQL-92 behavior is for the LIKE operator to ignore +// case. Thus 'a' LIKE 'A' would be true. +var likeInfoNorm = compareInfo{FmatchAll: U8('%'), FmatchOne: U8('_'), FnoCase: U8(1)} /* sqlite3.c:119944:33 */ +// If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator +// is case sensitive causing 'a' LIKE 'A' to be false +var likeInfoAlt = compareInfo{FmatchAll: U8('%'), FmatchOne: U8('_')} /* sqlite3.c:119947:33 */ + +// Possible error returns from patternMatch() + +// Compare two UTF-8 strings for equality where the first string is +// a GLOB or LIKE expression. Return values: +// +// SQLITE_MATCH: Match +// SQLITE_NOMATCH: No match +// SQLITE_NOWILDCARDMATCH: No match in spite of having * or % wildcards. +// +// Globbing rules: +// +// '*' Matches any sequence of zero or more characters. +// +// '?' Matches exactly one character. +// +// [...] Matches one character from the enclosed list of +// characters. +// +// [^...] Matches one character not in the enclosed list. +// +// With the [...] and [^...] matching, a ']' character can be included +// in the list by making it the first character after '[' or '^'. A +// range of characters can be specified using '-'. Example: +// "[a-z]" matches any single lower-case letter. To match a '-', make +// it the last character in the list. +// +// Like matching rules: +// +// '%' Matches any sequence of zero or more characters +// +// '_' Matches any one character +// +// Ec Where E is the "esc" character and c is any other +// character, including '%', '_', and esc, match exactly c. +// +// The comments within this routine usually assume glob matching. +// +// This routine is usually quick, but can be N**2 in the worst case. +func patternCompare(tls *libc.TLS, zPattern uintptr, zString uintptr, pInfo uintptr, matchOther U32) int32 { /* sqlite3.c:119994:12: */ + bp := tls.Alloc(19) + defer tls.Free(19) + *(*uintptr)(unsafe.Pointer(bp)) = zPattern + *(*uintptr)(unsafe.Pointer(bp + 8)) = zString + + var c U32 + var c2 U32 // Next pattern and input string chars + var matchOne U32 = U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchOne) // "?" or "_" + var matchAll U32 = U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchAll) // "*" or "%" + var noCase U8 = (*compareInfo)(unsafe.Pointer(pInfo)).FnoCase // True if uppercase==lowercase + var zEscaped uintptr = uintptr(0) // One past the last escaped input char + + for (libc.AssignUint32(&c, func() uint32 { + if int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zPattern */))))) < 0x80 { + return uint32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp /* zPattern */)), 1)))) + } + return Xsqlite3Utf8Read(tls, bp /* &zPattern */) + }())) != U32(0) { + if c == matchAll { // Match "*" + // Skip over multiple "*" characters in the pattern. If there + // are also "?" characters, skip those as well, but consume a + // single character of the input string for each "?" skipped + for ((libc.AssignUint32(&c, func() uint32 { + if int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zPattern */))))) < 0x80 { + return uint32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp /* zPattern */)), 1)))) + } + return Xsqlite3Utf8Read(tls, bp /* &zPattern */) + }())) == matchAll) || + ((c == matchOne) && (matchOne != U32(0))) { + if (c == matchOne) && (Xsqlite3Utf8Read(tls, bp+8 /* &zString */) == U32(0)) { + return SQLITE_NOWILDCARDMATCH + } + } + if c == U32(0) { + return SQLITE_MATCH // "*" at the end of the pattern matches + } else if c == matchOther { + if int32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchSet) == 0 { + c = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + if c == U32(0) { + return SQLITE_NOWILDCARDMATCH + } + } else { + // "[...]" immediately follows the "*". We have to do a slow + // recursive search in this case, but it is an unusual case. + // '[' is a single-byte character + for *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)))) != 0 { + var bMatch int32 = patternCompare(tls, (*(*uintptr)(unsafe.Pointer(bp /* zPattern */)) + libc.UintptrFromInt32(-1)), *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), pInfo, matchOther) + if bMatch != SQLITE_NOMATCH { + return bMatch + } + { + if (int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), 1))))) >= 0xc0 { + for (int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))))) & 0xc0) == 0x80 { + *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))++ + } + } + } + + } + return SQLITE_NOWILDCARDMATCH + } + } + + // At this point variable c contains the first character of the + // pattern string past the "*". Search in the input string for the + // first matching character and recursively continue the match from + // that point. + // + // For a case-insensitive search, set variable cx to be the same as + // c but in the other case and search the input string for either + // c or cx. + if c <= U32(0x80) { + // var zStop [3]int8 at bp+16, 3 + + var bMatch int32 + if noCase != 0 { + *(*int8)(unsafe.Pointer(bp + 16 /* &zStop[0] */)) = (int8((c) & U32(^(int32(Xsqlite3CtypeMap[uint8(c)]) & 0x20)))) + *(*int8)(unsafe.Pointer(bp + 16 /* &zStop[0] */ + 1)) = int8(Xsqlite3UpperToLower[uint8(c)]) + *(*int8)(unsafe.Pointer(bp + 16 /* &zStop[0] */ + 2)) = int8(0) + } else { + *(*int8)(unsafe.Pointer(bp + 16 /* &zStop[0] */)) = int8(c) + *(*int8)(unsafe.Pointer(bp + 16 /* &zStop[0] */ + 1)) = int8(0) + } + for 1 != 0 { + *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)) += uintptr(libc.Xstrcspn(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), bp+16 /* &zStop[0] */)) + if int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))))) == 0 { + break + } + *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))++ + bMatch = patternCompare(tls, *(*uintptr)(unsafe.Pointer(bp /* zPattern */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), pInfo, matchOther) + if bMatch != SQLITE_NOMATCH { + return bMatch + } + } + } else { + var bMatch int32 + for (libc.AssignUint32(&c2, func() uint32 { + if int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))))) < 0x80 { + return uint32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), 1)))) + } + return Xsqlite3Utf8Read(tls, bp+8 /* &zString */) + }())) != U32(0) { + if c2 != c { + continue + } + bMatch = patternCompare(tls, *(*uintptr)(unsafe.Pointer(bp /* zPattern */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), pInfo, matchOther) + if bMatch != SQLITE_NOMATCH { + return bMatch + } + } + } + return SQLITE_NOWILDCARDMATCH + } + if c == matchOther { + if int32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchSet) == 0 { + c = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + if c == U32(0) { + return SQLITE_NOMATCH + } + zEscaped = *(*uintptr)(unsafe.Pointer(bp /* zPattern */)) + } else { + var prior_c U32 = U32(0) + var seen int32 = 0 + var invert int32 = 0 + c = Xsqlite3Utf8Read(tls, bp+8 /* &zString */) + if c == U32(0) { + return SQLITE_NOMATCH + } + c2 = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + if c2 == U32('^') { + invert = 1 + c2 = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + } + if c2 == U32(']') { + if c == U32(']') { + seen = 1 + } + c2 = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + } + for (c2 != 0) && (c2 != U32(']')) { + if (((c2 == U32('-')) && (int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zPattern */))))) != ']')) && (int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zPattern */))))) != 0)) && (prior_c > U32(0)) { + c2 = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + if (c >= prior_c) && (c <= c2) { + seen = 1 + } + prior_c = U32(0) + } else { + if c == c2 { + seen = 1 + } + prior_c = c2 + } + c2 = Xsqlite3Utf8Read(tls, bp /* &zPattern */) + } + if (c2 == U32(0)) || ((seen ^ invert) == 0) { + return SQLITE_NOMATCH + } + continue + } + } + c2 = func() uint32 { + if int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))))) < 0x80 { + return uint32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */)), 1)))) + } + return Xsqlite3Utf8Read(tls, bp+8 /* &zString */) + }() + if c == c2 { + continue + } + if (((noCase != 0) && ((int32(Xsqlite3UpperToLower[uint8(c)])) == (int32(Xsqlite3UpperToLower[uint8(c2)])))) && (c < U32(0x80))) && (c2 < U32(0x80)) { + continue + } + if ((c == matchOne) && (*(*uintptr)(unsafe.Pointer(bp /* zPattern */)) != zEscaped)) && (c2 != U32(0)) { + continue + } + return SQLITE_NOMATCH + } + if int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zString */))))) == 0 { + return SQLITE_MATCH + } + return SQLITE_NOMATCH +} + +// The sqlite3_strglob() interface. Return 0 on a match (like strcmp()) and +// non-zero if there is no match. +func Xsqlite3_strglob(tls *libc.TLS, zGlobPattern uintptr, zString uintptr) int32 { /* sqlite3.c:120127:16: */ + return patternCompare(tls, zGlobPattern, zString, uintptr(unsafe.Pointer(&globInfo)), uint32('[')) +} + +// The sqlite3_strlike() interface. Return 0 on a match and non-zero for +// a miss - like strcmp(). +func Xsqlite3_strlike(tls *libc.TLS, zPattern uintptr, zStr uintptr, esc uint32) int32 { /* sqlite3.c:120135:16: */ + return patternCompare(tls, zPattern, zStr, uintptr(unsafe.Pointer(&likeInfoNorm)), esc) +} + +// Count the number of times that the LIKE operator (or GLOB which is +// just a variation of LIKE) gets called. This is used for testing +// only. + +// Implementation of the like() SQL function. This function implements +// the build-in LIKE operator. The first argument to the function is the +// pattern and the second argument is the string. So, the SQL statements: +// +// A LIKE B +// +// is implemented as like(B,A). +// +// This same function (with a different compareInfo structure) computes +// the GLOB operator. +func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120161:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var zA uintptr + var zB uintptr + var escape U32 + var nPat int32 + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var pInfo uintptr = Xsqlite3_user_data(tls, context) + // var backupInfo compareInfo at bp+8, 4 + + if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB) || + (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == SQLITE_BLOB) { + Xsqlite3_result_int(tls, context, 0) + return + } + + // Limit the length of the LIKE or GLOB pattern to avoid problems + // of deep recursion and N*N behavior in patternCompare(). + nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + + if nPat > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 8*4)) { + Xsqlite3_result_error(tls, context, ts+13556 /* "LIKE or GLOB pat..." */, -1) + return + } + if argc == 3 { + // The escape character string must consist of a single UTF-8 character. + // Otherwise, return an error. + *(*uintptr)(unsafe.Pointer(bp /* zEsc */)) = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + if *(*uintptr)(unsafe.Pointer(bp /* zEsc */)) == uintptr(0) { + return + } + if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { + Xsqlite3_result_error(tls, context, + ts+13589 /* "ESCAPE expressio..." */, -1) + return + } + escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) + if (escape == U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchAll)) || (escape == U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchOne)) { + libc.Xmemcpy(tls, bp+8 /* &backupInfo */, pInfo, uint64(unsafe.Sizeof(compareInfo{}))) + pInfo = bp + 8 /* &backupInfo */ + if escape == U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchAll) { + (*compareInfo)(unsafe.Pointer(pInfo)).FmatchAll = U8(0) + } + if escape == U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchOne) { + (*compareInfo)(unsafe.Pointer(pInfo)).FmatchOne = U8(0) + } + } + } else { + escape = U32((*compareInfo)(unsafe.Pointer(pInfo)).FmatchSet) + } + zB = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + zA = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if (zA != 0) && (zB != 0) { + Xsqlite3_result_int(tls, context, + (libc.Bool32(patternCompare(tls, zB, zA, pInfo, escape) == SQLITE_MATCH))) + } +} + +// Implementation of the NULLIF(x,y) function. The result is the first +// argument if the arguments are different. The result is NULL if the +// arguments are equal to each other. +func nullifFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:120232:13: */ + var pColl uintptr = sqlite3GetFuncCollSeq(tls, context) + _ = NotUsed + if Xsqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(argv)), *(*uintptr)(unsafe.Pointer(argv + 1*8)), pColl) != 0 { + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + } +} + +// Implementation of the sqlite_version() function. The result is the version +// of the SQLite library that is running. +func versionFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:120248:13: */ + _ = NotUsed + _ = NotUsed2 + // IMP: R-48699-48617 This function is an SQL wrapper around the + // sqlite3_libversion() C-interface. + Xsqlite3_result_text(tls, context, Xsqlite3_libversion(tls), -1, uintptr(0)) +} + +// Implementation of the sqlite_source_id() function. The result is a string +// that identifies the particular version of the source code used to build +// SQLite. +func sourceidFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:120264:13: */ + _ = NotUsed + _ = NotUsed2 + // IMP: R-24470-31136 This function is an SQL wrapper around the + // sqlite3_sourceid() C interface. + Xsqlite3_result_text(tls, context, Xsqlite3_sourceid(tls), -1, uintptr(0)) +} + +// Implementation of the sqlite_log() function. This is a wrapper around +// sqlite3_log(). The return value is NULL. The function exists purely for +// its side-effects. +func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120280:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + _ = argc + _ = context + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) +} + +// Implementation of the sqlite_compileoption_used() function. +// The result is an integer that identifies if the compiler option +// was used to build SQLite. +func compileoptionusedFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120296:13: */ + var zOptName uintptr + + _ = argc + // IMP: R-39564-36305 The sqlite_compileoption_used() SQL + // function is a wrapper around the sqlite3_compileoption_used() C/C++ + // function. + if (libc.AssignUintptr(&zOptName, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))))) != uintptr(0) { + Xsqlite3_result_int(tls, context, Xsqlite3_compileoption_used(tls, zOptName)) + } +} + +// Implementation of the sqlite_compileoption_get() function. +// The result is a string that identifies the compiler options +// used to build SQLite. +func compileoptiongetFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120320:13: */ + var n int32 + + _ = argc + // IMP: R-04922-24076 The sqlite_compileoption_get() SQL function + // is a wrapper around the sqlite3_compileoption_get() C/C++ function. + n = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_text(tls, context, Xsqlite3_compileoption_get(tls, n), -1, uintptr(0)) +} + +// Array for converting from half-bytes (nybbles) into ASCII hex +// digits. +var hexdigits = [16]int8{ + int8('0'), int8('1'), int8('2'), int8('3'), int8('4'), int8('5'), int8('6'), int8('7'), + int8('8'), int8('9'), int8('A'), int8('B'), int8('C'), int8('D'), int8('E'), int8('F'), +} /* sqlite3.c:120338:19 */ + +// Implementation of the QUOTE() function. This function takes a single +// argument. If the argument is numeric, the return value is the same as +// the argument. If the argument is NULL, the return value is the string +// "NULL". Otherwise, the argument is enclosed in single quotes with +// single-quote escapes. +func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120350:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + _ = argc + switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { + case SQLITE_FLOAT: + { + var r1 float64 + // var r2 float64 at bp+72, 8 + + // var zBuf [50]int8 at bp+16, 50 + + r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4035 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) + if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13634 /* "%!.20e" */, libc.VaList(bp+8, r1)) + } + Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + break + + } + case SQLITE_INTEGER: + { + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + break + + } + case SQLITE_BLOB: + { + var zText uintptr = uintptr(0) + var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + var nBlob int32 = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + // No encoding change + zText = contextMalloc(tls, context, ((int64(2) * I64(nBlob)) + int64(4))) + if zText != 0 { + var i int32 + for i = 0; i < nBlob; i++ { + *(*int8)(unsafe.Pointer(zText + uintptr(((i * 2) + 2)))) = hexdigits[((int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i)))) >> 4) & 0x0F)] + *(*int8)(unsafe.Pointer(zText + uintptr(((i * 2) + 3)))) = hexdigits[((int32(*(*int8)(unsafe.Pointer(zBlob + uintptr(i))))) & 0x0F)] + } + *(*int8)(unsafe.Pointer(zText + uintptr(((nBlob * 2) + 2)))) = int8('\'') + *(*int8)(unsafe.Pointer(zText + uintptr(((nBlob * 2) + 3)))) = int8(0) + *(*int8)(unsafe.Pointer(zText)) = int8('X') + *(*int8)(unsafe.Pointer(zText + 1)) = int8('\'') + Xsqlite3_result_text(tls, context, zText, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, zText) + } + break + + } + case SQLITE_TEXT: + { + var i int32 + var j int32 + var n U64 + var zArg uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var z uintptr + + if zArg == uintptr(0) { + return + } + i = 0 + n = uint64(0) + for ; *(*uint8)(unsafe.Pointer(zArg + uintptr(i))) != 0; i++ { + if int32(*(*uint8)(unsafe.Pointer(zArg + uintptr(i)))) == '\'' { + n++ + } + } + z = contextMalloc(tls, context, (((I64(i)) + (I64(n))) + int64(3))) + if z != 0 { + *(*int8)(unsafe.Pointer(z)) = int8('\'') + i = 0 + j = 1 + for ; *(*uint8)(unsafe.Pointer(zArg + uintptr(i))) != 0; i++ { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(*(*uint8)(unsafe.Pointer(zArg + uintptr(i)))) + if int32(*(*uint8)(unsafe.Pointer(zArg + uintptr(i)))) == '\'' { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8('\'') + } + } + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8('\'') + *(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0) + Xsqlite3_result_text(tls, context, z, j, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + break + + } + default: + { + + Xsqlite3_result_text(tls, context, ts+757 /* "NULL" */, 4, uintptr(0)) + break + + } + } +} + +// The unicode() function. Return the integer unicode code-point value +// for the first character of the input string. +func unicodeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120426:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* z */)) = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + _ = argc + if (*(*uintptr)(unsafe.Pointer(bp /* z */)) != 0) && (*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* z */)))) != 0) { + Xsqlite3_result_int(tls, context, int32(Xsqlite3Utf8Read(tls, bp /* &z */))) + } +} + +// The char() function takes zero or more arguments, each of which is +// an integer. It constructs a string where each character of the string +// is the unicode character for the corresponding integer argument. +func charFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120441:13: */ + var z uintptr + var zOut uintptr + var i int32 + zOut = libc.AssignUintptr(&z, Xsqlite3_malloc64(tls, (uint64((argc*4)+1)))) + if z == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + for i = 0; i < argc; i++ { + var x Sqlite3_int64 + var c uint32 + x = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if (x < int64(0)) || (x > int64(0x10ffff)) { + x = int64(0xfffd) + } + c = (uint32(x & int64(0x1fffff))) + if c < uint32(0x00080) { + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (U8(c & uint32(0xFF))) + } else if c < uint32(0x00800) { + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0xC0 + int32((U8((c >> 6) & uint32(0x1F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + } else if c < uint32(0x10000) { + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0xE0 + int32((U8((c >> 12) & uint32(0x0F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0x80 + int32((U8((c >> 6) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + } else { + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0xF0 + int32((U8((c >> 18) & uint32(0x07)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0x80 + int32((U8((c >> 12) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0x80 + int32((U8((c >> 6) & uint32(0x3F)))))) + *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (uint8(0x80 + int32((U8(c & uint32(0x3F)))))) + } + } + Xsqlite3_result_text64(tls, context, z, (uint64((int64(zOut) - int64(z)) / 1)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free})), uint8(SQLITE_UTF8)) +} + +// The hex() function. Interpret the argument as a blob. Return +// a hexadecimal rendering as text. +func hexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120482:13: */ + var i int32 + var n int32 + var pBlob uintptr + var zHex uintptr + var z uintptr + + _ = argc + pBlob = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + // No encoding change + z = libc.AssignUintptr(&zHex, contextMalloc(tls, context, (((I64(n))*int64(2))+int64(1)))) + if zHex != 0 { + i = 0 + __1: + if !(i < n) { + goto __3 + } + { + var c uint8 = *(*uint8)(unsafe.Pointer(pBlob)) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = hexdigits[((int32(c) >> 4) & 0xf)] + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))) = hexdigits[(int32(c) & 0xf)] + + } + goto __2 + __2: + i++ + pBlob++ + goto __1 + goto __3 + __3: + ; + *(*int8)(unsafe.Pointer(z)) = int8(0) + Xsqlite3_result_text(tls, context, zHex, (n * 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } +} + +// The zeroblob(N) function returns a zero-filled blob of size N bytes. +func zeroblobFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120510:13: */ + var n I64 + var rc int32 + + _ = argc + n = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + if n < int64(0) { + n = int64(0) + } + rc = Xsqlite3_result_zeroblob64(tls, context, uint64(n)) // IMP: R-00293-64994 + if rc != 0 { + Xsqlite3_result_error_code(tls, context, rc) + } +} + +// The replace() function. Three arguments are all strings: call +// them A, B, and C. The result is also a string which is derived +// from A by replacing every occurrence of B with C. The match +// must be exact. Collating sequences are not used. +func replaceFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120533:13: */ + var zStr uintptr // The input string A + var zPattern uintptr // The pattern string B + var zRep uintptr // The replacement string C + var zOut uintptr // The output + var nStr int32 // Size of zStr + var nPattern int32 // Size of zPattern + var nRep int32 // Size of zRep + var nOut I64 // Maximum size of zOut + var loopLimit int32 // Last zStr[] that might match zPattern[] + var i int32 + var j int32 // Loop counters + var cntExpand uint32 // Number zOut expansions + var db uintptr = Xsqlite3_context_db_handle(tls, context) + + _ = argc + zStr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zStr == uintptr(0) { + return + } + nStr = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + // No encoding change + zPattern = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zPattern == uintptr(0) { + + return + } + if int32(*(*uint8)(unsafe.Pointer(zPattern))) == 0 { + + Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv))) + return + } + nPattern = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + // No encoding change + zRep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + if zRep == uintptr(0) { + return + } + nRep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + + nOut = (I64(nStr + 1)) + + zOut = contextMalloc(tls, context, nOut) + if zOut == uintptr(0) { + return + } + loopLimit = (nStr - nPattern) + cntExpand = uint32(0) + for i = libc.AssignInt32(&j, 0); i <= loopLimit; i++ { + if (int32(*(*uint8)(unsafe.Pointer(zStr + uintptr(i)))) != int32(*(*uint8)(unsafe.Pointer(zPattern)))) || (libc.Xmemcmp(tls, (zStr+uintptr(i)), zPattern, uint64(nPattern)) != 0) { + *(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&j, 1)))) = *(*uint8)(unsafe.Pointer(zStr + uintptr(i))) + } else { + if nRep > nPattern { + nOut = nOut + (I64(nRep - nPattern)) + + if (nOut - int64(1)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) { + Xsqlite3_result_error_toobig(tls, context) + Xsqlite3_free(tls, zOut) + return + } + cntExpand++ + if (cntExpand & (cntExpand - uint32(1))) == uint32(0) { + // Grow the size of the output buffer only on substitutions + // whose index is a power of two: 1, 2, 4, 8, 16, 32, ... + var zOld uintptr + zOld = zOut + zOut = Xsqlite3Realloc(tls, zOut, (uint64(I64(int32(nOut)) + ((nOut - I64(nStr)) - int64(1))))) + if zOut == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + Xsqlite3_free(tls, zOld) + return + } + } + } + libc.Xmemcpy(tls, (zOut + uintptr(j)), zRep, uint64(nRep)) + j = j + (nRep) + i = i + (nPattern - 1) + } + } + + libc.Xmemcpy(tls, (zOut + uintptr(j)), (zStr + uintptr(i)), (uint64(nStr - i))) + j = j + (nStr - i) + + *(*uint8)(unsafe.Pointer(zOut + uintptr(j))) = uint8(0) + Xsqlite3_result_text(tls, context, zOut, j, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) +} + +// Implementation of the TRIM(), LTRIM(), and RTRIM() functions. +// The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both. +func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120626:13: */ + var zIn uintptr // Input string + var zCharSet uintptr // Set of characters to trim + var nIn uint32 // Number of bytes in input + var flags int32 // 1: trimleft 2: trimright 3: trim + var i int32 // Loop counter + var aLen uintptr = uintptr(0) // Length of each character in zCharSet + var azChar uintptr = uintptr(0) // Individual characters in zCharSet + var nChar int32 // Number of characters in zCharSet + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL { + return + } + zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zIn == uintptr(0) { + return + } + nIn = uint32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + + if argc == 1 { + nChar = 1 + aLen = uintptr(uintptr(unsafe.Pointer(&lenOne))) + azChar = uintptr(uintptr(unsafe.Pointer(&azOne))) + zCharSet = uintptr(0) + } else if (libc.AssignUintptr(&zCharSet, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) == uintptr(0) { + return + } else { + var z uintptr + z = zCharSet + nChar = 0 + for ; *(*uint8)(unsafe.Pointer(z)) != 0; nChar++ { + { + if (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0 { + for (int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80 { + z++ + } + } + } + + } + if nChar > 0 { + azChar = contextMalloc(tls, context, + (int64((uint64(I64(nChar))) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(uint32(0))))))) + if azChar == uintptr(0) { + return + } + aLen = (azChar + uintptr(nChar)*8) + z = zCharSet + nChar = 0 + for ; *(*uint8)(unsafe.Pointer(z)) != 0; nChar++ { + *(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)) = z + { + if (int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) >= 0xc0 { + for (int32(*(*uint8)(unsafe.Pointer(z))) & 0xc0) == 0x80 { + z++ + } + } + } + + *(*uint32)(unsafe.Pointer(aLen + uintptr(nChar)*4)) = (uint32((int64(z) - int64(*(*uintptr)(unsafe.Pointer(azChar + uintptr(nChar)*8)))) / 1)) + } + } + } + if nChar > 0 { + flags = int32(Xsqlite3_user_data(tls, context)) + if (flags & 1) != 0 { + for nIn > uint32(0) { + var len uint32 = uint32(0) + for i = 0; i < nChar; i++ { + len = *(*uint32)(unsafe.Pointer(aLen + uintptr(i)*4)) + if (len <= nIn) && (libc.Xmemcmp(tls, zIn, *(*uintptr)(unsafe.Pointer(azChar + uintptr(i)*8)), uint64(len)) == 0) { + break + } + } + if i >= nChar { + break + } + zIn += uintptr(len) + nIn = nIn - (len) + } + } + if (flags & 2) != 0 { + for nIn > uint32(0) { + var len uint32 = uint32(0) + for i = 0; i < nChar; i++ { + len = *(*uint32)(unsafe.Pointer(aLen + uintptr(i)*4)) + if (len <= nIn) && (libc.Xmemcmp(tls, (zIn+uintptr((nIn-len))), *(*uintptr)(unsafe.Pointer(azChar + uintptr(i)*8)), uint64(len)) == 0) { + break + } + } + if i >= nChar { + break + } + nIn = nIn - (len) + } + } + if zCharSet != 0 { + Xsqlite3_free(tls, azChar) + } + } + Xsqlite3_result_text(tls, context, zIn, int32(nIn), libc.UintptrFromInt32(-1)) +} + +var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ +var azOne = [1]uintptr{uintptr(ts + 9653 /* " " */)} /* sqlite3.c:120649:26 */ + +// IMP: R-25361-16150 This function is omitted from SQLite by default. It +// is only available if the SQLITE_SOUNDEX compile-time option is used +// when SQLite is built. +// Compute the soundex encoding of a word. +// +// IMP: R-59782-00072 The soundex(X) function returns a string that is the +// soundex encoding of the string X. +func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120739:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var zResult [8]int8 at bp, 8 + + var zIn uintptr + var i int32 + var j int32 + + zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zIn == uintptr(0) { + zIn = ts + 756 /* "" */ + } + for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { + } + if *(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0 { + var prevcode U8 = iCode[(int32(*(*U8)(unsafe.Pointer(zIn + uintptr(i)))) & 0x7f)] + *(*int8)(unsafe.Pointer(bp /* &zResult[0] */)) = (int8((int32(*(*U8)(unsafe.Pointer(zIn + uintptr(i))))) & ^(int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x20))) + for j = 1; (j < 4) && (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0); i++ { + var code int32 = int32(iCode[(int32(*(*U8)(unsafe.Pointer(zIn + uintptr(i)))) & 0x7f)]) + if code > 0 { + if code != int32(prevcode) { + prevcode = U8(code) + *(*int8)(unsafe.Pointer(bp /* &zResult[0] */ + uintptr(libc.PostIncInt32(&j, 1)))) = (int8(code + '0')) + } + } else { + prevcode = U8(0) + } + } + for j < 4 { + *(*int8)(unsafe.Pointer(bp /* &zResult[0] */ + uintptr(libc.PostIncInt32(&j, 1)))) = int8('0') + } + *(*int8)(unsafe.Pointer(bp /* &zResult[0] */ + uintptr(j))) = int8(0) + Xsqlite3_result_text(tls, context, bp /* &zResult[0] */, 4, libc.UintptrFromInt32(-1)) + } else { + // IMP: R-64894-50321 The string "?000" is returned if the argument + // is NULL or contains no ASCII alphabetic characters. + Xsqlite3_result_text(tls, context, ts+13641 /* "?000" */, 4, uintptr(0)) + } +} + +var iCode = [128]uint8{ + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(0), uint8(1), uint8(2), uint8(3), uint8(0), uint8(1), uint8(2), uint8(0), uint8(0), uint8(2), uint8(2), uint8(4), uint8(5), uint8(5), uint8(0), + uint8(1), uint8(2), uint8(6), uint8(2), uint8(3), uint8(0), uint8(1), uint8(0), uint8(2), uint8(0), uint8(2), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(0), uint8(1), uint8(2), uint8(3), uint8(0), uint8(1), uint8(2), uint8(0), uint8(0), uint8(2), uint8(2), uint8(4), uint8(5), uint8(5), uint8(0), + uint8(1), uint8(2), uint8(6), uint8(2), uint8(3), uint8(0), uint8(1), uint8(0), uint8(2), uint8(0), uint8(2), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), +} /* sqlite3.c:120747:30 */ + +// A function that loads a shared-library extension then returns NULL. +func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120792:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var zFile uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var zProc uintptr + var db uintptr = Xsqlite3_context_db_handle(tls, context) + *(*uintptr)(unsafe.Pointer(bp /* zErrMsg */)) = uintptr(0) + + // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc + // flag is set. See the sqlite3_enable_load_extension() API. + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { + Xsqlite3_result_error(tls, context, ts+10825 /* "not authorized" */, -1) + return + } + + if argc == 2 { + zProc = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } else { + zProc = uintptr(0) + } + if (zFile != 0) && (Xsqlite3_load_extension(tls, db, zFile, zProc, bp /* &zErrMsg */) != 0) { + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp /* zErrMsg */)), -1) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp /* zErrMsg */))) + } +} + +// An instance of the following structure holds the context of a +// sum() or avg() aggregate computation. +type SumCtx1 = struct { + FrSum float64 + FiSum I64 + Fcnt I64 + Foverflow U8 + Fapprox U8 + _ [6]byte +} /* sqlite3.c:120823:9 */ + +// An instance of the following structure holds the context of a +// sum() or avg() aggregate computation. +type SumCtx = SumCtx1 /* sqlite3.c:120823:23 */ + +// Routines used to compute the sum, average, and total. +// +// The SUM() function follows the (broken) SQL standard which means +// that it returns NULL if it sums over no inputs. TOTAL returns +// 0.0 in that case. In addition, TOTAL always returns a float where +// SUM might return an integer if it never encounters a floating point +// value. TOTAL never fails, but SUM might through an exception if +// it overflows an integer. +func sumStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120842:13: */ + var p uintptr + var type1 int32 + + _ = argc + p = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(SumCtx{}))) + type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if (p != 0) && (type1 != SQLITE_NULL) { + (*SumCtx)(unsafe.Pointer(p)).Fcnt++ + if type1 == SQLITE_INTEGER { + var v I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*float64)(unsafe.Pointer(p /* &.rSum */)) += (float64(v)) + if ((int32((*SumCtx)(unsafe.Pointer(p)).Fapprox) | int32((*SumCtx)(unsafe.Pointer(p)).Foverflow)) == 0) && (Xsqlite3AddInt64(tls, (p+8 /* &.iSum */), v) != 0) { + (*SumCtx)(unsafe.Pointer(p)).Fapprox = libc.AssignPtrUint8(p+24 /* &.overflow */, U8(1)) + } + } else { + *(*float64)(unsafe.Pointer(p /* &.rSum */)) += (Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))) + (*SumCtx)(unsafe.Pointer(p)).Fapprox = U8(1) + } + } +} + +func sumInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120864:13: */ + var p uintptr + var type1 int32 + + _ = argc + p = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(SumCtx{}))) + type1 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + // p is always non-NULL because sumStep() will have been called first + // to initialize it + if (p != 0) && (type1 != SQLITE_NULL) { + + (*SumCtx)(unsafe.Pointer(p)).Fcnt-- + + if (type1 == SQLITE_INTEGER) && (int32((*SumCtx)(unsafe.Pointer(p)).Fapprox) == 0) { + var v I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*float64)(unsafe.Pointer(p /* &.rSum */)) -= (float64(v)) + *(*I64)(unsafe.Pointer(p + 8 /* &.iSum */)) -= (v) + } else { + *(*float64)(unsafe.Pointer(p /* &.rSum */)) -= (Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))) + } + } +} + +func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, context, 0) + if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { + if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { + Xsqlite3_result_error(tls, context, ts+13534 /* "integer overflow" */, -1) + } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { + Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) + } else { + Xsqlite3_result_int64(tls, context, (*SumCtx)(unsafe.Pointer(p)).FiSum) + } + } +} + +func avgFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120902:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, context, 0) + if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { + Xsqlite3_result_double(tls, context, ((*SumCtx)(unsafe.Pointer(p)).FrSum / float64((*SumCtx)(unsafe.Pointer(p)).Fcnt))) + } +} + +func totalFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120909:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, context, 0) + // (double)0 In case of SQLITE_OMIT_FLOATING_POINT... + Xsqlite3_result_double(tls, context, func() float64 { + if p != 0 { + return (*SumCtx)(unsafe.Pointer(p)).FrSum + } + return float64(0) + }()) +} + +// The following structure keeps track of state information for the +// count() aggregate function. +type CountCtx1 = struct{ Fn I64 } /* sqlite3.c:120920:9 */ + +// The following structure keeps track of state information for the +// count() aggregate function. +type CountCtx = CountCtx1 /* sqlite3.c:120920:25 */ + +// Routines to implement the count() aggregate function. +func countStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120931:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(CountCtx{}))) + if ((argc == 0) || (SQLITE_NULL != Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))))) && (p != 0) { + (*CountCtx)(unsafe.Pointer(p)).Fn++ + } + + // The sqlite3_aggregate_count() function is deprecated. But just to make + // sure it still operates correctly, verify that its count agrees with our + // internal count when using count(*) and when the total count can be + // expressed as a 32-bit integer. + +} + +func countFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120947:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, context, 0) + Xsqlite3_result_int64(tls, context, func() int64 { + if p != 0 { + return (*CountCtx)(unsafe.Pointer(p)).Fn + } + return int64(0) + }()) +} + +func countInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:120953:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(CountCtx{}))) + // p is always non-NULL since countStep() will have been called first + if ((argc == 0) || (SQLITE_NULL != Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))))) && (p != 0) { + (*CountCtx)(unsafe.Pointer(p)).Fn-- + } +} + +// Routines to implement min() and max() aggregate functions. +func minmaxStep(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:120971:13: */ + var pArg uintptr = *(*uintptr)(unsafe.Pointer(argv)) + var pBest uintptr + _ = NotUsed + + pBest = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(Mem{}))) + if !(pBest != 0) { + return + } + + if Xsqlite3_value_type(tls, pArg) == SQLITE_NULL { + if (*Mem)(unsafe.Pointer(pBest)).Fflags != 0 { + sqlite3SkipAccumulatorLoad(tls, context) + } + } else if (*Mem)(unsafe.Pointer(pBest)).Fflags != 0 { + var max int32 + var cmp int32 + var pColl uintptr = sqlite3GetFuncCollSeq(tls, context) + // This step function is used for both the min() and max() aggregates, + // the only difference between the two being that the sense of the + // comparison is inverted. For the max() aggregate, the + // sqlite3_user_data() function returns (void *)-1. For min() it + // returns (void *)db, where db is the sqlite3* database pointer. + // Therefore the next statement sets variable 'max' to 1 for the max() + // aggregate, or 0 for min(). + max = (libc.Bool32(Xsqlite3_user_data(tls, context) != uintptr(0))) + cmp = Xsqlite3MemCompare(tls, pBest, pArg, pColl) + if ((max != 0) && (cmp < 0)) || (!(max != 0) && (cmp > 0)) { + Xsqlite3VdbeMemCopy(tls, pBest, pArg) + } else { + sqlite3SkipAccumulatorLoad(tls, context) + } + } else { + (*Mem)(unsafe.Pointer(pBest)).Fdb = Xsqlite3_context_db_handle(tls, context) + Xsqlite3VdbeMemCopy(tls, pBest, pArg) + } +} + +func minMaxValueFinalize(tls *libc.TLS, context uintptr, bValue int32) { /* sqlite3.c:121009:13: */ + var pRes uintptr + pRes = Xsqlite3_aggregate_context(tls, context, 0) + if pRes != 0 { + if (*Sqlite3_value)(unsafe.Pointer(pRes)).Fflags != 0 { + Xsqlite3_result_value(tls, context, pRes) + } + if bValue == 0 { + Xsqlite3VdbeMemRelease(tls, pRes) + } + } +} + +func minMaxValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121020:13: */ + minMaxValueFinalize(tls, context, 1) +} + +func minMaxFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:121026:13: */ + minMaxValueFinalize(tls, context, 0) +} + +// group_concat(EXPR, ?SEPARATOR?) +func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:121033:13: */ + var zVal uintptr + var pAccum uintptr + var zSep uintptr + var nVal int32 + var nSep int32 + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL { + return + } + pAccum = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(StrAccum{}))) + + if pAccum != 0 { + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var firstTerm int32 = (libc.Bool32((*StrAccum)(unsafe.Pointer(pAccum)).FmxAlloc == U32(0))) + (*StrAccum)(unsafe.Pointer(pAccum)).FmxAlloc = U32(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) + if !(firstTerm != 0) { + if argc == 2 { + zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } else { + zSep = ts + 11538 /* "," */ + nSep = 1 + } + if zSep != 0 { + Xsqlite3_str_append(tls, pAccum, zSep, nSep) + } + } + zVal = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + nVal = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zVal != 0 { + Xsqlite3_str_append(tls, pAccum, zVal, nVal) + } + } +} + +func groupConcatInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:121066:13: */ + var n int32 + var pAccum uintptr + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL { + return + } + pAccum = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(StrAccum{}))) + // pAccum is always non-NULL since groupConcatStep() will have always + // run frist to initialize it + if pAccum != 0 { + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + if argc == 2 { + n = n + (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + } else { + n++ + } + if n >= int32((*StrAccum)(unsafe.Pointer(pAccum)).FnChar) { + (*StrAccum)(unsafe.Pointer(pAccum)).FnChar = U32(0) + } else { + *(*U32)(unsafe.Pointer(pAccum + 24 /* &.nChar */)) -= (U32(n)) + libc.Xmemmove(tls, (*StrAccum)(unsafe.Pointer(pAccum)).FzText, ((*StrAccum)(unsafe.Pointer(pAccum)).FzText + uintptr(n)), uint64((*StrAccum)(unsafe.Pointer(pAccum)).FnChar)) + } + if (*StrAccum)(unsafe.Pointer(pAccum)).FnChar == U32(0) { + (*StrAccum)(unsafe.Pointer(pAccum)).FmxAlloc = U32(0) + } + } +} + +func groupConcatFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:121097:13: */ + var pAccum uintptr + pAccum = Xsqlite3_aggregate_context(tls, context, 0) + if pAccum != 0 { + if int32((*StrAccum)(unsafe.Pointer(pAccum)).FaccError) == SQLITE_TOOBIG { + Xsqlite3_result_error_toobig(tls, context) + } else if int32((*StrAccum)(unsafe.Pointer(pAccum)).FaccError) == SQLITE_NOMEM { + Xsqlite3_result_error_nomem(tls, context) + } else { + Xsqlite3_result_text(tls, context, Xsqlite3StrAccumFinish(tls, pAccum), -1, + *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + } +} + +func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: */ + var pAccum uintptr + pAccum = Xsqlite3_aggregate_context(tls, context, 0) + if pAccum != 0 { + if int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FaccError) == SQLITE_TOOBIG { + Xsqlite3_result_error_toobig(tls, context) + } else if int32((*Sqlite3_str)(unsafe.Pointer(pAccum)).FaccError) == SQLITE_NOMEM { + Xsqlite3_result_error_nomem(tls, context) + } else { + var zText uintptr = Xsqlite3_str_value(tls, pAccum) + Xsqlite3_result_text(tls, context, zText, -1, libc.UintptrFromInt32(-1)) + } + } +} + +// This routine does per-connection function registration. Most +// of the built-in functions above are part of the global function set. +// This routine only deals with those that are not global. +func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ + var rc int32 = Xsqlite3_overload_function(tls, db, ts+13646 /* "MATCH" */, 2) + + if rc == SQLITE_NOMEM { + Xsqlite3OomFault(tls, db) + } +} + +// Re-register the built-in LIKE functions. The caseSensitive +// parameter determines whether or not the LIKE operator is case +// sensitive. +func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int32) { /* sqlite3.c:121148:21: */ + var pInfo uintptr + var flags int32 + if caseSensitive != 0 { + pInfo = uintptr(unsafe.Pointer(&likeInfoAlt)) + flags = (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) + } else { + pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) + flags = SQLITE_FUNC_LIKE + } + Xsqlite3CreateFunc(tls, db, ts+13652 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3CreateFunc(tls, db, ts+13652 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13652 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13652 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) +} + +// pExpr points to an expression which implements a function. If +// it is appropriate to apply the LIKE optimization to that function +// then set aWc[0] through aWc[2] to the wildcard characters and the +// escape character and then return TRUE. If the function is not a +// LIKE-style function then return FALSE. +// +// The expression "a LIKE b ESCAPE c" is only considered a valid LIKE +// operator if c is a string literal that is exactly one byte in length. +// That one byte is stored in aWc[3]. aWc[3] is set to zero if there is +// no ESCAPE clause. +// +// *pIsNocase is set to true if uppercase and lowercase are equivalent for +// the function (default for LIKE). If the function makes the distinction +// between uppercase and lowercase (as does GLOB) then *pIsNocase is set to +// false. +func Xsqlite3IsLikeFunction(tls *libc.TLS, db uintptr, pExpr uintptr, pIsNocase uintptr, aWc uintptr) int32 { /* sqlite3.c:121181:20: */ + var pDef uintptr + var nExpr int32 + + if !(int32(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) != 0) { + return 0 + } + + nExpr = (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FnExpr + pDef = Xsqlite3FindFunction(tls, db, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), nExpr, uint8(SQLITE_UTF8), uint8(0)) + if (pDef == uintptr(0)) || (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_LIKE)) == U32(0)) { + return 0 + } + + // The memcpy() statement assumes that the wildcard characters are + // the first three statements in the compareInfo structure. The + // asserts() that follow verify that assumption + libc.Xmemcpy(tls, aWc, (*FuncDef)(unsafe.Pointer(pDef)).FpUserData, uint64(3)) + + if nExpr < 3 { + *(*int8)(unsafe.Pointer(aWc + 3)) = int8(0) + } else { + var pEscape uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */) + 2*32)).FpExpr + var zEscape uintptr + if int32((*Expr)(unsafe.Pointer(pEscape)).Fop) != TK_STRING { + return 0 + } + zEscape = *(*uintptr)(unsafe.Pointer(pEscape + 8 /* &.u */)) + if (int32(*(*int8)(unsafe.Pointer(zEscape))) == 0) || (int32(*(*int8)(unsafe.Pointer(zEscape + 1))) != 0) { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(zEscape))) == int32(*(*int8)(unsafe.Pointer(aWc))) { + return 0 + } + if int32(*(*int8)(unsafe.Pointer(zEscape))) == int32(*(*int8)(unsafe.Pointer(aWc + 1))) { + return 0 + } + *(*int8)(unsafe.Pointer(aWc + 3)) = *(*int8)(unsafe.Pointer(zEscape)) + } + + *(*int32)(unsafe.Pointer(pIsNocase)) = (libc.Bool32(((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_CASE)) == U32(0))) + return 1 +} + +// Mathematical Constants + +// Extra math functions that require linking with -lm + +// Implementation of sign(X) function. +func signFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:121405:13: */ + var type0 int32 + var x float64 + _ = argc + + type0 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if (type0 != SQLITE_INTEGER) && (type0 != SQLITE_FLOAT) { + return + } + x = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + Xsqlite3_result_int(tls, context, func() int32 { + if x < 0.0 { + return -1 + } + return func() int32 { + if x > 0.0 { + return +1 + } + return 0 + }() + }()) +} + +// All of the FuncDef structures in the aBuiltinFunc[] array above +// to the global function hash table. This occurs at start-time (as +// a consequence of calling sqlite3_initialize()). +// +// After this routine runs +func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: */ + Xsqlite3AlterFunctions(tls) + Xsqlite3WindowFunctions(tls) + Xsqlite3RegisterDateTimeFunctions(tls) + Xsqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&aBuiltinFunc)), (int32(uint64(unsafe.Sizeof(aBuiltinFunc)) / uint64(unsafe.Sizeof(FuncDef{}))))) + +} + +var aBuiltinFunc = [68]FuncDef{ + //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 13657 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 13677 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 13690 /* "expr_implies_exp..." */}, + //**** Regular functions **** + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13708 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13716 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13716 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13731 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13757 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13782 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13791 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13802 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13809 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13823 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13823 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13829 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13829 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13835 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13835 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13840 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13840 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13840 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13844 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 13844 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13844 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13848 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13855 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13862 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13868 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13875 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13883 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13888 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13892 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13892 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13898 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13904 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13910 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13914 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13921 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13928 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13939 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13946 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13961 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13978 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13989 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13995 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14013 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14021 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14035 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14052 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14052 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14059 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14059 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14069 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14079 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14083 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14083 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14089 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14089 /* "group_concat" */}, + + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14102 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13652 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13652 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14107 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14107 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14116 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14107 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14121 /* "iif" */}} /* sqlite3.c:121438:18 */ + +//************* End of func.c *********************************************** +//************* Begin file fkey.c ******************************************* +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code used by the compiler to add foreign key +// support to compiled SQL statements. +// #include "sqliteInt.h" + +// Deferred and Immediate FKs +// -------------------------- +// +// Foreign keys in SQLite come in two flavours: deferred and immediate. +// If an immediate foreign key constraint is violated, +// SQLITE_CONSTRAINT_FOREIGNKEY is returned and the current +// statement transaction rolled back. If a +// deferred foreign key constraint is violated, no action is taken +// immediately. However if the application attempts to commit the +// transaction before fixing the constraint violation, the attempt fails. +// +// Deferred constraints are implemented using a simple counter associated +// with the database handle. The counter is set to zero each time a +// database transaction is opened. Each time a statement is executed +// that causes a foreign key violation, the counter is incremented. Each +// time a statement is executed that removes an existing violation from +// the database, the counter is decremented. When the transaction is +// committed, the commit fails if the current value of the counter is +// greater than zero. This scheme has two big drawbacks: +// +// * When a commit fails due to a deferred foreign key constraint, +// there is no way to tell which foreign constraint is not satisfied, +// or which row it is not satisfied for. +// +// * If the database contains foreign key violations when the +// transaction is opened, this may cause the mechanism to malfunction. +// +// Despite these problems, this approach is adopted as it seems simpler +// than the alternatives. +// +// INSERT operations: +// +// I.1) For each FK for which the table is the child table, search +// the parent table for a match. If none is found increment the +// constraint counter. +// +// I.2) For each FK for which the table is the parent table, +// search the child table for rows that correspond to the new +// row in the parent table. Decrement the counter for each row +// found (as the constraint is now satisfied). +// +// DELETE operations: +// +// D.1) For each FK for which the table is the child table, +// search the parent table for a row that corresponds to the +// deleted row in the child table. If such a row is not found, +// decrement the counter. +// +// D.2) For each FK for which the table is the parent table, search +// the child table for rows that correspond to the deleted row +// in the parent table. For each found increment the counter. +// +// UPDATE operations: +// +// An UPDATE command requires that all 4 steps above are taken, but only +// for FK constraints for which the affected columns are actually +// modified (values must be compared at runtime). +// +// Note that I.1 and D.1 are very similar operations, as are I.2 and D.2. +// This simplifies the implementation a bit. +// +// For the purposes of immediate FK constraints, the OR REPLACE conflict +// resolution is considered to delete rows before the new row is inserted. +// If a delete caused by OR REPLACE violates an FK constraint, an exception +// is thrown, even if the FK constraint would be satisfied after the new +// row is inserted. +// +// Immediate constraints are usually handled similarly. The only difference +// is that the counter used is stored as part of each individual statement +// object (struct Vdbe). If, after the statement has run, its immediate +// constraint counter is greater than zero, +// it returns SQLITE_CONSTRAINT_FOREIGNKEY +// and the statement transaction is rolled back. An exception is an INSERT +// statement that inserts a single row only (no triggers). In this case, +// instead of using a counter, an exception is thrown immediately if the +// INSERT violates a foreign key constraint. This is necessary as such +// an INSERT does not open a statement transaction. +// +// TODO: How should dropping a table be handled? How should renaming a +// table be handled? +// +// +// Query API Notes +// --------------- +// +// Before coding an UPDATE or DELETE row operation, the code-generator +// for those two operations needs to know whether or not the operation +// requires any FK processing and, if so, which columns of the original +// row are required by the FK processing VDBE code (i.e. if FKs were +// implemented using triggers, which of the old.* columns would be +// accessed). No information is required by the code-generator before +// coding an INSERT operation. The functions used by the UPDATE/DELETE +// generation code to query for this information are: +// +// sqlite3FkRequired() - Test to see if FK processing is required. +// sqlite3FkOldmask() - Query for the set of required old.* columns. +// +// +// Externally accessible module functions +// -------------------------------------- +// +// sqlite3FkCheck() - Check for foreign key violations. +// sqlite3FkActions() - Code triggers for ON UPDATE/ON DELETE actions. +// sqlite3FkDelete() - Delete an FKey structure. + +// VDBE Calling Convention +// ----------------------- +// +// Example: +// +// For the following INSERT statement: +// +// CREATE TABLE t1(a, b INTEGER PRIMARY KEY, c); +// INSERT INTO t1 VALUES(1, 2, 3.1); +// +// Register (x): 2 (type integer) +// Register (x+1): 1 (type integer) +// Register (x+2): NULL (type NULL) +// Register (x+3): 3.1 (type real) + +// A foreign key constraint requires that the key columns in the parent +// table are collectively subject to a UNIQUE or PRIMARY KEY constraint. +// Given that pParent is the parent table for foreign key constraint pFKey, +// search the schema for a unique index on the parent key columns. +// +// If successful, zero is returned. If the parent key is an INTEGER PRIMARY +// KEY column, then output variable *ppIdx is set to NULL. Otherwise, *ppIdx +// is set to point to the unique index. +// +// If the parent key consists of a single column (the foreign key constraint +// is not a composite foreign key), output variable *paiCol is set to NULL. +// Otherwise, it is set to point to an allocated array of size N, where +// N is the number of columns in the parent key. The first element of the +// array is the index of the child table column that is mapped by the FK +// constraint to the parent table column stored in the left-most column +// of index *ppIdx. The second element of the array is the index of the +// child table column that corresponds to the second left-most column of +// *ppIdx, and so on. +// +// If the required index cannot be found, either because: +// +// 1) The named parent key columns do not exist, or +// +// 2) The named parent key columns do exist, but are not subject to a +// UNIQUE or PRIMARY KEY constraint, or +// +// 3) No parent key columns were provided explicitly as part of the +// foreign key definition, and the parent table does not have a +// PRIMARY KEY, or +// +// 4) No parent key columns were provided explicitly as part of the +// foreign key definition, and the PRIMARY KEY of the parent table +// consists of a different number of columns to the child key in +// the child table. +// +// then non-zero is returned, and a "foreign key mismatch" error loaded +// into pParse. If an OOM error occurs, non-zero is returned and the +// pParse->db->mallocFailed flag is set. +func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey uintptr, ppIdx uintptr, paiCol uintptr) int32 { /* sqlite3.c:121786:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pIdx uintptr = uintptr(0) // Value to return via *ppIdx + var aiCol uintptr = uintptr(0) // Value to return via *paiCol + var nCol int32 = (*FKey)(unsafe.Pointer(pFKey)).FnCol // Number of columns in parent key + var zKey uintptr = (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */))).FzCol // Name of left-most parent key column + + // The caller is responsible for zeroing output parameters. + + // If this is a non-composite (single column) foreign key, check if it + // maps to the INTEGER PRIMARY KEY of table pParent. If so, leave *ppIdx + // and *paiCol set to zero and return early. + // + // Otherwise, for a composite foreign key (more than one column), allocate + // space for the aiCol array (returned via output parameter *paiCol). + // Non-composite foreign keys do not require the aiCol array. + if nCol == 1 { + // The FK maps to the IPK if any of the following are true: + // + // 1) There is an INTEGER PRIMARY KEY column and the FK is implicitly + // mapped to the primary key of table pParent, or + // 2) The FK is explicitly mapped to a column declared as INTEGER + // PRIMARY KEY. + if int32((*Table)(unsafe.Pointer(pParent)).FiPKey) >= 0 { + if !(zKey != 0) { + return 0 + } + if !(Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pParent)).FaCol+uintptr((*Table)(unsafe.Pointer(pParent)).FiPKey)*32)).FzName, zKey) != 0) { + return 0 + } + } + } else if paiCol != 0 { + + aiCol = Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64(uint64(nCol) * uint64(unsafe.Sizeof(int32(0)))))) + if !(aiCol != 0) { + return 1 + } + *(*uintptr)(unsafe.Pointer(paiCol)) = aiCol + } + + for pIdx = (*Table)(unsafe.Pointer(pParent)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + if ((int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) == nCol) && (int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None)) && ((*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0)) { + // pIdx is a UNIQUE index (or a PRIMARY KEY) and has the right number + // of columns. If each indexed column corresponds to a foreign key + // column of pFKey, then this index is a winner. + + if zKey == uintptr(0) { + // If zKey is NULL, then this foreign key is implicitly mapped to + // the PRIMARY KEY of table pParent. The PRIMARY KEY index may be + // identified by the test. + if (int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY { + if aiCol != 0 { + var i int32 + for i = 0; i < nCol; i++ { + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */) + uintptr(i)*16)).FiFrom + } + } + break + } + } else { + // If zKey is non-NULL, then this foreign key was declared to + // map to an explicit list of columns in table pParent. Check if this + // index matches those columns. Also, check that the index uses + // the default collation sequences for each column. + var i int32 + var j int32 + for i = 0; i < nCol; i++ { + var iCol I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) // Index of column in parent tbl + var zDfltColl uintptr // Def. collation for column + var zIdxCol uintptr // Name of indexed column + + if int32(iCol) < 0 { + break + } // No foreign keys against expression indexes + + // If the index uses a collation sequence that is different from + // the default collation sequence for the column, this index is + // unusable. Bail out early in this case. + zDfltColl = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pParent)).FaCol + uintptr(iCol)*32)).FzColl + if !(zDfltColl != 0) { + zDfltColl = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + } + if Xsqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i)*8)), zDfltColl) != 0 { + break + } + + zIdxCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pParent)).FaCol + uintptr(iCol)*32)).FzName + for j = 0; j < nCol; j++ { + if Xsqlite3StrICmp(tls, (*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FzCol, zIdxCol) == 0 { + if aiCol != 0 { + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */) + uintptr(j)*16)).FiFrom + } + break + } + } + if j == nCol { + break + } + } + if i == nCol { + break + } // pIdx is usable + } + } + } + + if !(pIdx != 0) { + if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { + Xsqlite3ErrorMsg(tls, pParse, + ts+14125, /* "foreign key mism..." */ + libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) + } + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) + return 1 + } + + *(*uintptr)(unsafe.Pointer(ppIdx)) = pIdx + return 0 +} + +// This function is called when a row is inserted into or deleted from the +// child table of foreign key constraint pFKey. If an SQL UPDATE is executed +// on the child table of pFKey, this function is invoked twice for each row +// affected - once to "delete" the old row, and then again to "insert" the +// new row. +// +// Each time it is called, this function generates VDBE code to locate the +// row in the parent table that corresponds to the row being inserted into +// or deleted from the child table. If the parent row can be found, no +// special action is taken. Otherwise, if the parent row can *not* be +// found in the parent table: +// +// Operation | FK type | Action taken +// -------------------------------------------------------------------------- +// INSERT immediate Increment the "immediate constraint counter". +// +// DELETE immediate Decrement the "immediate constraint counter". +// +// INSERT deferred Increment the "deferred constraint counter". +// +// DELETE deferred Decrement the "deferred constraint counter". +// +// These operations are identified in the comment at the top of this file +// (fkey.c) as "I.1" and "D.1". +func fkLookupParent(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr, pIdx uintptr, pFKey uintptr, aiCol uintptr, regData int32, nIncr int32, isIgnore int32) { /* sqlite3.c:121921:13: */ + var i int32 // Iterator variable + var v uintptr = Xsqlite3GetVdbe(tls, pParse) // Vdbe to add code to + var iCur int32 = ((*Parse)(unsafe.Pointer(pParse)).FnTab - 1) // Cursor number to use + var iOk int32 = Xsqlite3VdbeMakeLabel(tls, pParse) // jump here if parent key found + + // If nIncr is less than zero, then check at runtime if there are any + // outstanding constraints to resolve. If there are not, there is no need + // to check if deleting this row resolves any outstanding violations. + // + // Check if any of the key columns in the child table row are NULL. If + // any are, then the constraint is considered satisfied. No need to + // search for a matching row in the parent table. + if nIncr < 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_FkIfZero, int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred), iOk) + + } + for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { + var iReg int32 = ((int32(Xsqlite3TableColumnToStorage(tls, (*FKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))))) + regData) + 1) + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, iReg, iOk) + } + + if isIgnore == 0 { + if pIdx == uintptr(0) { + // If pIdx is NULL, then the parent key is the INTEGER PRIMARY KEY + // column of the parent table (table pTab). + var iMustBeInt int32 // Address of MustBeInt instruction + var regTemp int32 = Xsqlite3GetTempReg(tls, pParse) + + // Invoke MustBeInt to coerce the child key value to an integer (i.e. + // apply the affinity of the parent key). If this fails, then there + // is no matching parent key. Before using MustBeInt, make a copy of + // the value. Otherwise, the value inserted into the child key column + // will have INTEGER affinity applied to it, which may not be correct. + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, + ((int32(Xsqlite3TableColumnToStorage(tls, (*FKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol))))) + 1) + regData), regTemp) + iMustBeInt = Xsqlite3VdbeAddOp2(tls, v, OP_MustBeInt, regTemp, 0) + + // If the parent table is the same as the child table, and we are about + // to increment the constraint-counter (i.e. this is an INSERT operation), + // then check if the row being inserted matches itself. If so, do not + // increment the constraint-counter. + if (pTab == (*FKey)(unsafe.Pointer(pFKey)).FpFrom) && (nIncr == 1) { + Xsqlite3VdbeAddOp3(tls, v, OP_Eq, regData, iOk, regTemp) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + } + + Xsqlite3OpenTable(tls, pParse, iCur, iDb, pTab, OP_OpenRead) + Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iCur, 0, regTemp) + Xsqlite3VdbeGoto(tls, v, iOk) + Xsqlite3VdbeJumpHere(tls, v, (Xsqlite3VdbeCurrentAddr(tls, v) - 2)) + Xsqlite3VdbeJumpHere(tls, v, iMustBeInt) + Xsqlite3ReleaseTempReg(tls, pParse, regTemp) + } else { + var nCol int32 = (*FKey)(unsafe.Pointer(pFKey)).FnCol + var regTemp int32 = Xsqlite3GetTempRange(tls, pParse, nCol) + var regRec int32 = Xsqlite3GetTempReg(tls, pParse) + + Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iCur, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + for i = 0; i < nCol; i++ { + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, + ((int32(Xsqlite3TableColumnToStorage(tls, (*FKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))))) + 1) + regData), + (regTemp + i)) + } + + // If the parent table is the same as the child table, and we are about + // to increment the constraint-counter (i.e. this is an INSERT operation), + // then check if the row being inserted matches itself. If so, do not + // increment the constraint-counter. + // + // If any of the parent-key values are NULL, then the row cannot match + // itself. So set JUMPIFNULL to make sure we do the OP_Found if any + // of the parent-key values are NULL (at this point it is known that + // none of the child key values are). + if (pTab == (*FKey)(unsafe.Pointer(pFKey)).FpFrom) && (nIncr == 1) { + var iJump int32 = ((Xsqlite3VdbeCurrentAddr(tls, v) + nCol) + 1) + for i = 0; i < nCol; i++ { + var iChild int32 = ((int32(Xsqlite3TableColumnToStorage(tls, (*FKey)(unsafe.Pointer(pFKey)).FpFrom, int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))))) + + 1) + regData) + var iParent int32 = (1 + regData) + iParent = iParent + (int32(Xsqlite3TableColumnToStorage(tls, (*Index)(unsafe.Pointer(pIdx)).FpTable, + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))))) + + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) == int32((*Table)(unsafe.Pointer(pTab)).FiPKey) { + // The parent key is a composite key that includes the IPK column + iParent = regData + } + Xsqlite3VdbeAddOp3(tls, v, OP_Ne, iChild, iJump, iParent) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_JUMPIFNULL)) + } + Xsqlite3VdbeGoto(tls, v, iOk) + } + + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTemp, nCol, regRec, + Xsqlite3IndexAffinityStr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pIdx), nCol) + Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iCur, iOk, regRec, 0) + + Xsqlite3ReleaseTempReg(tls, pParse, regRec) + Xsqlite3ReleaseTempRange(tls, pParse, regTemp, nCol) + } + } + + if ((!(int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred) != 0) && !(((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_DeferFKs)) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FpToplevel) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FisMultiWrite) != 0) { + // Special case: If this is an INSERT statement that will insert exactly + // one row into the table, raise a constraint immediately instead of + // incrementing a counter. This is necessary as the VM code is being + // generated for will not open a statement transaction. + + Xsqlite3HaltConstraint(tls, pParse, (SQLITE_CONSTRAINT | (int32(3) << 8)), + OE_Abort, uintptr(0), int8(-1), uint8(P5_ConstraintFK)) + } else { + if (nIncr > 0) && (int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred) == 0) { + Xsqlite3MayAbort(tls, pParse) + } + Xsqlite3VdbeAddOp2(tls, v, OP_FkCounter, int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred), nIncr) + } + + Xsqlite3VdbeResolveLabel(tls, v, iOk) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iCur) +} + +// Return an Expr object that refers to a memory register corresponding +// to column iCol of table pTab. +// +// regBase is the first of an array of register that contains the data +// for pTab. regBase itself holds the rowid. regBase+1 holds the first +// column. regBase+2 holds the second column, and so forth. +func exprTableRegister(tls *libc.TLS, pParse uintptr, pTab uintptr, regBase int32, iCol I16) uintptr { /* sqlite3.c:122074:13: */ + var pExpr uintptr + var pCol uintptr + var zColl uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + pExpr = Xsqlite3Expr(tls, db, TK_REGISTER, uintptr(0)) + if pExpr != 0 { + if (int32(iCol) >= 0) && (int32(iCol) != int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32) + (*Expr)(unsafe.Pointer(pExpr)).FiTable = ((regBase + int32(Xsqlite3TableColumnToStorage(tls, pTab, iCol))) + 1) + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = (*Column)(unsafe.Pointer(pCol)).Faffinity + zColl = (*Column)(unsafe.Pointer(pCol)).FzColl + if zColl == uintptr(0) { + zColl = (*CollSeq)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpDfltColl)).FzName + } + pExpr = Xsqlite3ExprAddCollateString(tls, pParse, pExpr, zColl) + } else { + (*Expr)(unsafe.Pointer(pExpr)).FiTable = regBase + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = int8(SQLITE_AFF_INTEGER) + } + } + return pExpr +} + +// Return an Expr object that refers to column iCol of table pTab which +// has cursor iCur. +func exprTableColumn(tls *libc.TLS, db uintptr, pTab uintptr, iCursor int32, iCol I16) uintptr { /* sqlite3.c:122106:13: */ + var pExpr uintptr = Xsqlite3Expr(tls, db, TK_COLUMN, uintptr(0)) + if pExpr != 0 { + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = pTab + (*Expr)(unsafe.Pointer(pExpr)).FiTable = iCursor + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = iCol + } + return pExpr +} + +// This function is called to generate code executed when a row is deleted +// from the parent table of foreign key constraint pFKey and, if pFKey is +// deferred, when a row is inserted into the same table. When generating +// code for an SQL UPDATE operation, this function may be called twice - +// once to "delete" the old row and once to "insert" the new row. +// +// Parameter nIncr is passed -1 when inserting a row (as this may decrease +// the number of FK violations in the db) or +1 when deleting one (as this +// may increase the number of FK constraint problems). +// +// The code generated by this function scans through the rows in the child +// table that correspond to the parent table row being deleted or inserted. +// For each child row found, one of the following actions is taken: +// +// Operation | FK type | Action taken +// -------------------------------------------------------------------------- +// DELETE immediate Increment the "immediate constraint counter". +// Or, if the ON (UPDATE|DELETE) action is RESTRICT, +// throw a "FOREIGN KEY constraint failed" exception. +// +// INSERT immediate Decrement the "immediate constraint counter". +// +// DELETE deferred Increment the "deferred constraint counter". +// Or, if the ON (UPDATE|DELETE) action is RESTRICT, +// throw a "FOREIGN KEY constraint failed" exception. +// +// INSERT deferred Decrement the "deferred constraint counter". +// +// These operations are identified in the comment at the top of this file +// (fkey.c) as "I.2" and "D.2". +func fkScanChildren(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pIdx uintptr, pFKey uintptr, aiCol uintptr, regData int32, nIncr int32) { /* sqlite3.c:122153:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var i int32 // Iterator variable + var pWhere uintptr = uintptr(0) // WHERE clause to scan with + // var sNameContext NameContext at bp, 56 + // Context used to resolve WHERE clause + var pWInfo uintptr // Context used by sqlite3WhereXXX() + var iFkIfZero int32 = 0 // Address of OP_FkIfZero + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + + if nIncr < 0 { + iFkIfZero = Xsqlite3VdbeAddOp2(tls, v, OP_FkIfZero, int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred), 0) + + } + + // Create an Expr object representing an SQL expression like: + // + // = AND = ... + // + // The collation sequence used for the comparison should be that of + // the parent key columns. The affinity of the parent key column should + // be applied to each child key value before the comparison takes place. + for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { + var pLeft uintptr // Value from parent table row + var pRight uintptr // Column ref to child table + var pEq uintptr // Expression (pLeft = pRight) + var iCol I16 // Index of column in child table + var zCol uintptr // Name of column in child table + + if pIdx != 0 { + iCol = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) + } else { + iCol = int16(-1) + } + pLeft = exprTableRegister(tls, pParse, pTab, regData, iCol) + if aiCol != 0 { + iCol = int16(*(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4))) + } else { + iCol = int16((*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */))).FiFrom) + } + + zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol + uintptr(iCol)*32)).FzName + pRight = Xsqlite3Expr(tls, db, TK_ID, zCol) + pEq = Xsqlite3PExpr(tls, pParse, TK_EQ, pLeft, pRight) + pWhere = Xsqlite3ExprAnd(tls, pParse, pWhere, pEq) + } + + // If the child table is the same as the parent table, then add terms + // to the WHERE clause that prevent this entry from being scanned. + // The added WHERE clause terms are like this: + // + // $current_rowid!=rowid + // NOT( $current_a==a AND $current_b==b AND ... ) + // + // The first form is used for rowid tables. The second form is used + // for WITHOUT ROWID tables. In the second form, the *parent* key is + // (a,b,...). Either the parent or primary key could be used to + // uniquely identify the current row, but the parent key is more convenient + // as the required values have already been loaded into registers + // by the caller. + if (pTab == (*FKey)(unsafe.Pointer(pFKey)).FpFrom) && (nIncr > 0) { + var pNe uintptr // Expression (pLeft != pRight) + var pLeft uintptr // Value from parent table row + var pRight uintptr // Column ref to child table + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + pLeft = exprTableRegister(tls, pParse, pTab, regData, int16(-1)) + pRight = exprTableColumn(tls, db, pTab, (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FiCursor, int16(-1)) + pNe = Xsqlite3PExpr(tls, pParse, TK_NE, pLeft, pRight) + } else { + var pEq uintptr + var pAll uintptr = uintptr(0) + + for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); i++ { + var iCol I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2)) + + pLeft = exprTableRegister(tls, pParse, pTab, regData, iCol) + pRight = Xsqlite3Expr(tls, db, TK_ID, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName) + pEq = Xsqlite3PExpr(tls, pParse, TK_IS, pLeft, pRight) + pAll = Xsqlite3ExprAnd(tls, pParse, pAll, pEq) + } + pNe = Xsqlite3PExpr(tls, pParse, TK_NOT, pAll, uintptr(0)) + } + pWhere = Xsqlite3ExprAnd(tls, pParse, pWhere, pNe) + } + + // Resolve the references in the WHERE clause. + libc.Xmemset(tls, bp /* &sNameContext */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &sNameContext */)).FpSrcList = pSrc + (*NameContext)(unsafe.Pointer(bp /* &sNameContext */)).FpParse = pParse + Xsqlite3ResolveExprNames(tls, bp /* &sNameContext */, pWhere) + + // Create VDBE to loop through the entries in pSrc that match the WHERE + // clause. For each row found, increment either the deferred or immediate + // foreign key constraint counter. + if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { + pWInfo = Xsqlite3WhereBegin(tls, pParse, pSrc, pWhere, uintptr(0), uintptr(0), uint16(0), 0) + Xsqlite3VdbeAddOp2(tls, v, OP_FkCounter, int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred), nIncr) + if pWInfo != 0 { + Xsqlite3WhereEnd(tls, pWInfo) + } + } + + // Clean up the WHERE clause constructed above. + Xsqlite3ExprDelete(tls, db, pWhere) + if iFkIfZero != 0 { + Xsqlite3VdbeJumpHereOrPopInst(tls, v, iFkIfZero) + } +} + +// This function returns a linked list of FKey objects (connected by +// FKey.pNextTo) holding all children of table pTab. For example, +// given the following schema: +// +// CREATE TABLE t1(a PRIMARY KEY); +// CREATE TABLE t2(b REFERENCES t1(a); +// +// Calling this function with table "t1" as an argument returns a pointer +// to the FKey structure representing the foreign key constraint on table +// "t2". Calling this function with "t2" as the argument would return a +// NULL pointer (as there are no FK constraints for which t2 is the parent +// table). +func Xsqlite3FkReferences(tls *libc.TLS, pTab uintptr) uintptr { /* sqlite3.c:122282:21: */ + return Xsqlite3HashFind(tls, ((*Table)(unsafe.Pointer(pTab)).FpSchema + 80 /* &.fkeyHash */), (*Table)(unsafe.Pointer(pTab)).FzName) +} + +// The second argument is a Trigger structure allocated by the +// fkActionTrigger() routine. This function deletes the Trigger structure +// and all of its sub-components. +// +// The Trigger structure or any of its sub-components may be allocated from +// the lookaside buffer belonging to database handle dbMem. +func fkTriggerDelete(tls *libc.TLS, dbMem uintptr, p uintptr) { /* sqlite3.c:122294:13: */ + if p != 0 { + var pStep uintptr = (*Trigger)(unsafe.Pointer(p)).Fstep_list + Xsqlite3ExprDelete(tls, dbMem, (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere) + Xsqlite3ExprListDelete(tls, dbMem, (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList) + Xsqlite3SelectDelete(tls, dbMem, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect) + Xsqlite3ExprDelete(tls, dbMem, (*Trigger)(unsafe.Pointer(p)).FpWhen) + Xsqlite3DbFree(tls, dbMem, p) + } +} + +// This function is called to generate code that runs when table pTab is +// being dropped from the database. The SrcList passed as the second argument +// to this function contains a single entry guaranteed to resolve to +// table pTab. +// +// Normally, no code is required. However, if either +// +// (a) The table is the parent table of a FK constraint, or +// (b) The table is the child table of a deferred FK constraint and it is +// determined at runtime that there are outstanding deferred FK +// constraint violations in the database, +// +// then the equivalent of "DELETE FROM " is executed before dropping +// the table from the database. Triggers are disabled while running this +// DELETE, but foreign key actions are not. +func Xsqlite3FkDropTable(tls *libc.TLS, pParse uintptr, pName uintptr, pTab uintptr) { /* sqlite3.c:122322:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + var iSkip int32 = 0 + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + + // VDBE has already been allocated + // Not a view + if Xsqlite3FkReferences(tls, pTab) == uintptr(0) { + // Search for a deferred foreign key constraint for which this table + // is the child table. If one cannot be found, return without + // generating any VDBE code. If one can be found, then jump over + // the entire DELETE if there are no outstanding deferred constraints + // when this statement is run. + var p uintptr + for p = (*Table)(unsafe.Pointer(pTab)).FpFKey; p != 0; p = (*FKey)(unsafe.Pointer(p)).FpNextFrom { + if ((*FKey)(unsafe.Pointer(p)).FisDeferred != 0) || (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DeferFKs)) != 0) { + break + } + } + if !(p != 0) { + return + } + iSkip = Xsqlite3VdbeMakeLabel(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_FkIfZero, 1, iSkip) + } + + (*Parse)(unsafe.Pointer(pParse)).FdisableTriggers = U8(1) + Xsqlite3DeleteFrom(tls, pParse, Xsqlite3SrcListDup(tls, db, pName, 0), uintptr(0), uintptr(0), uintptr(0)) + (*Parse)(unsafe.Pointer(pParse)).FdisableTriggers = U8(0) + + // If the DELETE has generated immediate foreign key constraint + // violations, halt the VDBE and return an error at this point, before + // any modifications to the schema are made. This is because statement + // transactions are not able to rollback schema changes. + // + // If the SQLITE_DeferFKs flag is set, then this is not required, as + // the statement transaction will not be rolled back even if FK + // constraints are violated. + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DeferFKs)) == uint64(0) { + + Xsqlite3VdbeAddOp2(tls, v, OP_FkIfZero, 0, (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + + Xsqlite3HaltConstraint(tls, pParse, (SQLITE_CONSTRAINT | (int32(3) << 8)), + OE_Abort, uintptr(0), int8(-1), uint8(P5_ConstraintFK)) + } + + if iSkip != 0 { + Xsqlite3VdbeResolveLabel(tls, v, iSkip) + } + } +} + +// The second argument points to an FKey object representing a foreign key +// for which pTab is the child table. An UPDATE statement against pTab +// is currently being processed. For each column of the table that is +// actually updated, the corresponding element in the aChange[] array +// is zero or greater (if a column is unmodified the corresponding element +// is set to -1). If the rowid column is modified by the UPDATE statement +// the bChngRowid argument is non-zero. +// +// This function returns true if any of the columns that are part of the +// child key for FK constraint *p are modified. +func fkChildIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, bChngRowid int32) int32 { /* sqlite3.c:122385:12: */ + var i int32 + for i = 0; i < (*FKey)(unsafe.Pointer(p)).FnCol; i++ { + var iChildKey int32 = (*sColMap)(unsafe.Pointer((p + 64 /* &.aCol */) + uintptr(i)*16)).FiFrom + if *(*int32)(unsafe.Pointer(aChange + uintptr(iChildKey)*4)) >= 0 { + return 1 + } + if (iChildKey == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) && (bChngRowid != 0) { + return 1 + } + } + return 0 +} + +// The second argument points to an FKey object representing a foreign key +// for which pTab is the parent table. An UPDATE statement against pTab +// is currently being processed. For each column of the table that is +// actually updated, the corresponding element in the aChange[] array +// is zero or greater (if a column is unmodified the corresponding element +// is set to -1). If the rowid column is modified by the UPDATE statement +// the bChngRowid argument is non-zero. +// +// This function returns true if any of the columns that are part of the +// parent key for FK constraint *p are modified. +func fkParentIsModified(tls *libc.TLS, pTab uintptr, p uintptr, aChange uintptr, bChngRowid int32) int32 { /* sqlite3.c:122412:12: */ + var i int32 + for i = 0; i < (*FKey)(unsafe.Pointer(p)).FnCol; i++ { + var zKey uintptr = (*sColMap)(unsafe.Pointer((p + 64 /* &.aCol */) + uintptr(i)*16)).FzCol + var iKey int32 + for iKey = 0; iKey < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iKey++ { + if (*(*int32)(unsafe.Pointer(aChange + uintptr(iKey)*4)) >= 0) || ((iKey == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) && (bChngRowid != 0)) { + var pCol uintptr = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iKey)*32) + if zKey != 0 { + if 0 == Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer(pCol)).FzName, zKey) { + return 1 + } + } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { + return 1 + } + } + } + } + return 0 +} + +// Return true if the parser passed as the first argument is being +// used to code a trigger that is really a "SET NULL" action belonging +// to trigger pFKey. +func isSetNullAction(tls *libc.TLS, pParse uintptr, pFKey uintptr) int32 { /* sqlite3.c:122441:12: */ + var pTop uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + if (*Parse)(unsafe.Pointer(pTop)).FpTriggerPrg != 0 { + var p uintptr = (*TriggerPrg)(unsafe.Pointer((*Parse)(unsafe.Pointer(pTop)).FpTriggerPrg)).FpTrigger + if ((p == *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */)))) && (int32(*(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */)))) == OE_SetNull)) || + ((p == *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */) + 1*8))) && (int32(*(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */) + 1))) == OE_SetNull)) { + return 1 + } + } + return 0 +} + +// This function is called when inserting, deleting or updating a row of +// table pTab to generate VDBE code to perform foreign key constraint +// processing for the operation. +// +// For a DELETE operation, parameter regOld is passed the index of the +// first register in an array of (pTab->nCol+1) registers containing the +// rowid of the row being deleted, followed by each of the column values +// of the row being deleted, from left to right. Parameter regNew is passed +// zero in this case. +// +// For an INSERT operation, regOld is passed zero and regNew is passed the +// first register of an array of (pTab->nCol+1) registers containing the new +// row data. +// +// For an UPDATE operation, this function is called twice. Once before +// the original record is deleted from the table using the calling convention +// described for DELETE. Then again after the original record is deleted +// but before the new record is inserted using the INSERT convention. +func Xsqlite3FkCheck(tls *libc.TLS, pParse uintptr, pTab uintptr, regOld int32, regNew int32, aChange uintptr, bChngRowid int32) { /* sqlite3.c:122474:21: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var pFKey uintptr // Used to iterate through FKs + var iDb int32 // Index of database containing pTab + var zDb uintptr // Name of database containing pTab + var isIgnoreErrors int32 = int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) + + // Exactly one of regOld and regNew should be non-zero. + + // If foreign-keys are disabled, this function is a no-op. + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) == uint64(0) { + return + } + + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + + // Loop through all the foreign key constraints for which pTab is the + // child table (the table that the foreign key definition is part of). + for pFKey = (*Table)(unsafe.Pointer(pTab)).FpFKey; pFKey != 0; pFKey = (*FKey)(unsafe.Pointer(pFKey)).FpNextFrom { + var pTo uintptr // Parent table of foreign key pFKey + *(*uintptr)(unsafe.Pointer(bp /* pIdx */)) = uintptr(0) // Index on key columns in pTo + *(*uintptr)(unsafe.Pointer(bp + 8 /* aiFree */)) = uintptr(0) + var aiCol uintptr + // var iCol int32 at bp+16, 4 + + var i int32 + var bIgnore int32 = 0 + + if ((aChange != 0) && + (Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo) != 0)) && + (fkChildIsModified(tls, pTab, pFKey, aChange, bChngRowid) == 0) { + continue + } + + // Find the parent table of this foreign key. Also find a unique index + // on the parent key columns in the parent table. If either of these + // schema items cannot be located, set an error in pParse and return + // early. + if (*Parse)(unsafe.Pointer(pParse)).FdisableTriggers != 0 { + pTo = Xsqlite3FindTable(tls, db, (*FKey)(unsafe.Pointer(pFKey)).FzTo, zDb) + } else { + pTo = Xsqlite3LocateTable(tls, pParse, uint32(0), (*FKey)(unsafe.Pointer(pFKey)).FzTo, zDb) + } + if !(pTo != 0) || (Xsqlite3FkLocateIndex(tls, pParse, pTo, pFKey, bp /* &pIdx */, bp+8 /* &aiFree */) != 0) { + + if !(isIgnoreErrors != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return + } + if pTo == uintptr(0) { + // If isIgnoreErrors is true, then a table is being dropped. In this + // case SQLite runs a "DELETE FROM xxx" on the table being dropped + // before actually dropping it in order to check FK constraints. + // If the parent table of an FK constraint on the current table is + // missing, behave as if it is empty. i.e. decrement the relevant + // FK counter for each row of the current table with non-NULL keys. + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var iJump int32 = ((Xsqlite3VdbeCurrentAddr(tls, v) + (*FKey)(unsafe.Pointer(pFKey)).FnCol) + 1) + for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { + var iFromCol int32 + var iReg int32 + iFromCol = (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */) + uintptr(i)*16)).FiFrom + iReg = ((int32(Xsqlite3TableColumnToStorage(tls, (*FKey)(unsafe.Pointer(pFKey)).FpFrom, int16(iFromCol))) + regOld) + 1) + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, iReg, iJump) + } + Xsqlite3VdbeAddOp2(tls, v, OP_FkCounter, int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred), -1) + } + continue + } + + if *(*uintptr)(unsafe.Pointer(bp + 8 /* aiFree */)) != 0 { + aiCol = *(*uintptr)(unsafe.Pointer(bp + 8 /* aiFree */)) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) = (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */))).FiFrom + aiCol = bp + 16 /* &iCol */ + } + for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { + if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) == int32((*Table)(unsafe.Pointer(pTab)).FiPKey) { + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = -1 + } + + // Request permission to read the parent key columns. If the + // authorization callback returns SQLITE_IGNORE, behave as if any + // values read from the parent table are NULL. + if (*Sqlite3)(unsafe.Pointer(db)).FxAuth != 0 { + var rcauth int32 + var zCol uintptr = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTo)).FaCol + uintptr(func() int32 { + if *(*uintptr)(unsafe.Pointer(bp /* pIdx */)) != 0 { + return int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIdx */)))).FaiColumn + uintptr(i)*2))) + } + return int32((*Table)(unsafe.Pointer(pTo)).FiPKey) + }())*32)).FzName + rcauth = Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTo)).FzName, zCol, iDb) + bIgnore = (libc.Bool32(rcauth == SQLITE_IGNORE)) + } + } + + // Take a shared-cache advisory read-lock on the parent table. Allocate + // a cursor to use to search the unique index on the parent key columns + // in the parent table. + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTo)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pTo)).FzName) + (*Parse)(unsafe.Pointer(pParse)).FnTab++ + + if regOld != 0 { + // A row is being removed from the child table. Search for the parent. + // If the parent does not exist, removing the child row resolves an + // outstanding foreign key constraint violation. + fkLookupParent(tls, pParse, iDb, pTo, *(*uintptr)(unsafe.Pointer(bp /* pIdx */)), pFKey, aiCol, regOld, -1, bIgnore) + } + if (regNew != 0) && !(isSetNullAction(tls, pParse, pFKey) != 0) { + // A row is being added to the child table. If a parent row cannot + // be found, adding the child row has violated the FK constraint. + // + // If this operation is being performed as part of a trigger program + // that is actually a "SET NULL" action belonging to this very + // foreign key, then omit this scan altogether. As all child key + // values are guaranteed to be NULL, it is not possible for adding + // this row to cause an FK violation. + fkLookupParent(tls, pParse, iDb, pTo, *(*uintptr)(unsafe.Pointer(bp /* pIdx */)), pFKey, aiCol, regNew, +1, bIgnore) + } + + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* aiFree */))) + } + + // Loop through all the foreign key constraints that refer to this table. + // (the "child" constraints) + for pFKey = Xsqlite3FkReferences(tls, pTab); pFKey != 0; pFKey = (*FKey)(unsafe.Pointer(pFKey)).FpNextTo { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pIdx */)) = uintptr(0) // Foreign key index for pFKey + var pSrc uintptr + *(*uintptr)(unsafe.Pointer(bp + 32 /* aiCol */)) = uintptr(0) + + if (aChange != 0) && (fkParentIsModified(tls, pTab, pFKey, aChange, bChngRowid) == 0) { + continue + } + + if ((!(int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred) != 0) && !(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DeferFKs)) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FpToplevel) != 0)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FisMultiWrite) != 0) { + + // Inserting a single row into a parent table cannot cause (or fix) + // an immediate foreign key violation. So do nothing in this case. + continue + } + + if Xsqlite3FkLocateIndex(tls, pParse, pTab, pFKey, bp+24 /* &pIdx */, bp+32 /* &aiCol */) != 0 { + if !(isIgnoreErrors != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return + } + continue + } + + // Create a SrcList structure containing the child table. We need the + // child table as a SrcList for sqlite3WhereBegin() + pSrc = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if pSrc != 0 { + var pItem uintptr = pSrc + 8 /* &.a */ + (*SrcItem)(unsafe.Pointer(pItem)).FpTab = (*FKey)(unsafe.Pointer(pFKey)).FpFrom + (*SrcItem)(unsafe.Pointer(pItem)).FzName = (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName + (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpTab)).FnTabRef++ + (*SrcItem)(unsafe.Pointer(pItem)).FiCursor = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + + if regNew != 0 { + fkScanChildren(tls, pParse, pSrc, pTab, *(*uintptr)(unsafe.Pointer(bp + 24 /* pIdx */)), pFKey, *(*uintptr)(unsafe.Pointer(bp + 32 /* aiCol */)), regNew, -1) + } + if regOld != 0 { + var eAction int32 = int32(*(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */) + uintptr((libc.Bool32(aChange != uintptr(0))))))) + fkScanChildren(tls, pParse, pSrc, pTab, *(*uintptr)(unsafe.Pointer(bp + 24 /* pIdx */)), pFKey, *(*uintptr)(unsafe.Pointer(bp + 32 /* aiCol */)), regOld, 1) + // If this is a deferred FK constraint, or a CASCADE or SET NULL + // action applies, then any foreign key violations caused by + // removing the parent key will be rectified by the action trigger. + // So do not set the "may-abort" flag in this case. + // + // Note 1: If the FK is declared "ON UPDATE CASCADE", then the + // may-abort flag will eventually be set on this statement anyway + // (when this function is called as part of processing the UPDATE + // within the action trigger). + // + // Note 2: At first glance it may seem like SQLite could simply omit + // all OP_FkCounter related scans when either CASCADE or SET NULL + // applies. The trouble starts if the CASCADE or SET NULL action + // trigger causes other triggers or action rules attached to the + // child table to fire. In these cases the fk constraint counters + // might be set incorrectly if any OP_FkCounter related scans are + // omitted. + if (!(int32((*FKey)(unsafe.Pointer(pFKey)).FisDeferred) != 0) && (eAction != OE_Cascade)) && (eAction != OE_SetNull) { + Xsqlite3MayAbort(tls, pParse) + } + } + (*SrcItem)(unsafe.Pointer(pItem)).FzName = uintptr(0) + Xsqlite3SrcListDelete(tls, db, pSrc) + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32 /* aiCol */))) + } +} + +// This function is called before generating code to update or delete a +// row contained in table pTab. +func Xsqlite3FkOldmask(tls *libc.TLS, pParse uintptr, pTab uintptr) U32 { /* sqlite3.c:122676:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var mask U32 = U32(0) + if ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_ForeignKeys)) != 0 { + var p uintptr + var i int32 + for p = (*Table)(unsafe.Pointer(pTab)).FpFKey; p != 0; p = (*FKey)(unsafe.Pointer(p)).FpNextFrom { + for i = 0; i < (*FKey)(unsafe.Pointer(p)).FnCol; i++ { + mask = mask | (func() uint32 { + if ((*sColMap)(unsafe.Pointer((p + 64 /* &.aCol */) + uintptr(i)*16)).FiFrom) > 31 { + return 0xffffffff + } + return (U32(U32(1)) << ((*sColMap)(unsafe.Pointer((p + 64 /* &.aCol */) + uintptr(i)*16)).FiFrom)) + }()) + } + } + for p = Xsqlite3FkReferences(tls, pTab); p != 0; p = (*FKey)(unsafe.Pointer(p)).FpNextTo { + *(*uintptr)(unsafe.Pointer(bp /* pIdx */)) = uintptr(0) + Xsqlite3FkLocateIndex(tls, pParse, pTab, p, bp /* &pIdx */, uintptr(0)) + if *(*uintptr)(unsafe.Pointer(bp /* pIdx */)) != 0 { + for i = 0; i < int32((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIdx */)))).FnKeyCol); i++ { + + mask = mask | (func() uint32 { + if (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIdx */)))).FaiColumn + uintptr(i)*2)))) > 31 { + return 0xffffffff + } + return (U32(U32(1)) << (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIdx */)))).FaiColumn + uintptr(i)*2))))) + }()) + } + } + } + } + return mask +} + +// This function is called before generating code to update or delete a +// row contained in table pTab. If the operation is a DELETE, then +// parameter aChange is passed a NULL value. For an UPDATE, aChange points +// to an array of size N, where N is the number of columns in table pTab. +// If the i'th column is not modified by the UPDATE, then the corresponding +// entry in the aChange[] array is set to -1. If the column is modified, +// the value is 0 or greater. Parameter chngRowid is set to true if the +// UPDATE statement modifies the rowid fields of the table. +// +// If any foreign key processing will be required, this function returns +// non-zero. If there is no foreign key related processing, this function +// returns zero. +// +// For an UPDATE, this function returns 2 if: +// +// * There are any FKs for which pTab is the child and the parent table +// and any FK processing at all is required (even of a different FK), or +// +// * the UPDATE modifies one or more parent keys for which the action is +// not "NO ACTION" (i.e. is CASCADE, SET DEFAULT or SET NULL). +// +// Or, assuming some other foreign key processing is required, 1. +func Xsqlite3FkRequired(tls *libc.TLS, pParse uintptr, pTab uintptr, aChange uintptr, chngRowid int32) int32 { /* sqlite3.c:122726:20: */ + var eRet int32 = 1 // Value to return if bHaveFK is true + var bHaveFK int32 = 0 // If FK processing is required + if ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_ForeignKeys)) != 0 { + if !(aChange != 0) { + // A DELETE operation. Foreign key processing is required if the + // table in question is either the child or parent table for any + // foreign key constraint. + bHaveFK = (libc.Bool32((Xsqlite3FkReferences(tls, pTab) != 0) || ((*Table)(unsafe.Pointer(pTab)).FpFKey != 0))) + } else { + // This is an UPDATE. Foreign key processing is only required if the + // operation modifies one or more child or parent key columns. + var p uintptr + + // Check if any child key columns are being modified. + for p = (*Table)(unsafe.Pointer(pTab)).FpFKey; p != 0; p = (*FKey)(unsafe.Pointer(p)).FpNextFrom { + if fkChildIsModified(tls, pTab, p, aChange, chngRowid) != 0 { + if 0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, (*FKey)(unsafe.Pointer(p)).FzTo) { + eRet = 2 + } + bHaveFK = 1 + } + } + + // Check if any parent key columns are being modified. + for p = Xsqlite3FkReferences(tls, pTab); p != 0; p = (*FKey)(unsafe.Pointer(p)).FpNextTo { + if fkParentIsModified(tls, pTab, p, aChange, chngRowid) != 0 { + if int32(*(*U8)(unsafe.Pointer((p + 45 /* &.aAction */) + 1))) != OE_None { + return 2 + } + bHaveFK = 1 + } + } + } + } + if bHaveFK != 0 { + return eRet + } + return 0 +} + +// This function is called when an UPDATE or DELETE operation is being +// compiled on table pTab, which is the parent table of foreign-key pFKey. +// If the current operation is an UPDATE, then the pChanges parameter is +// passed a pointer to the list of columns being modified. If it is a +// DELETE, pChanges is passed a NULL pointer. +// +// It returns a pointer to a Trigger structure containing a trigger +// equivalent to the ON UPDATE or ON DELETE action specified by pFKey. +// If the action is "NO ACTION" or "RESTRICT", then a NULL pointer is +// returned (these actions require no special handling by the triggers +// sub-system, code for them is created by fkScanChildren()). +// +// For example, if pFKey is the foreign key and pTab is table "p" in +// the following schema: +// +// CREATE TABLE p(pk PRIMARY KEY); +// CREATE TABLE c(ck REFERENCES p ON DELETE CASCADE); +// +// then the returned trigger structure is equivalent to: +// +// CREATE TRIGGER ... DELETE ON p BEGIN +// DELETE FROM c WHERE ck = old.pk; +// END; +// +// The returned pointer is cached as part of the foreign key object. It +// is eventually freed along with the rest of the foreign key object by +// sqlite3FkDelete(). +func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, pChanges uintptr) uintptr { /* sqlite3.c:122794:16: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var action int32 // One of OE_None, OE_Cascade etc. + var pTrigger uintptr // Trigger definition to return + var iAction int32 = (libc.Bool32(pChanges != uintptr(0))) // 1 for UPDATE, 0 for DELETE + + action = int32(*(*U8)(unsafe.Pointer((pFKey + 45 /* &.aAction */) + uintptr(iAction)))) + if (action == OE_Restrict) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_DeferFKs)) != 0) { + return uintptr(0) + } + pTrigger = *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */) + uintptr(iAction)*8)) + + if (action != OE_None) && !(pTrigger != 0) { + var zFrom uintptr // Name of child table + var nFrom int32 // Length in bytes of zFrom + *(*uintptr)(unsafe.Pointer(bp /* pIdx */)) = uintptr(0) // Parent key index for this FK + *(*uintptr)(unsafe.Pointer(bp + 8 /* aiCol */)) = uintptr(0) // child table cols -> parent key cols + var pStep uintptr = uintptr(0) // First (only) step of trigger program + var pWhere uintptr = uintptr(0) // WHERE clause of trigger step + var pList uintptr = uintptr(0) // Changes list if ON UPDATE CASCADE + var pSelect uintptr = uintptr(0) // If RESTRICT, "SELECT RAISE(...)" + var i int32 // Iterator variable + var pWhen uintptr = uintptr(0) // WHEN clause for the trigger + + if Xsqlite3FkLocateIndex(tls, pParse, pTab, pFKey, bp /* &pIdx */, bp+8 /* &aiCol */) != 0 { + return uintptr(0) + } + + for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { + *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5468 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5464 /* "new" */, Fn: uint32(3)} // Literal "new" token + // var tFromCol Token at bp+32, 16 + // Name of column in child table + // var tToCol Token at bp+16, 16 + // Name of column in parent table + var iFromCol int32 // Idx of column in child table + var pEq uintptr // tFromCol = OLD.tToCol + + if *(*uintptr)(unsafe.Pointer(bp + 8 /* aiCol */)) != 0 { + iFromCol = *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* aiCol */)) + uintptr(i)*4)) + } else { + iFromCol = (*sColMap)(unsafe.Pointer((pFKey + 64 /* &.aCol */))).FiFrom + } + + Xsqlite3TokenInit(tls, bp+16, /* &tToCol */ + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(func() int32 { + if *(*uintptr)(unsafe.Pointer(bp /* pIdx */)) != 0 { + return int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIdx */)))).FaiColumn + uintptr(i)*2))) + } + return int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + }())*32)).FzName) + Xsqlite3TokenInit(tls, bp+32 /* &tFromCol */, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol+uintptr(iFromCol)*32)).FzName) + + // Create the expression "OLD.zToCol = zFromCol". It is important + // that the "OLD.zToCol" term is on the LHS of the = operator, so + // that the affinity and collation sequence associated with the + // parent table are used for the comparison. + pEq = Xsqlite3PExpr(tls, pParse, TK_EQ, + Xsqlite3PExpr(tls, pParse, TK_DOT, + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+48 /* &tOld */, 0), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+16 /* &tToCol */, 0)), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+32 /* &tFromCol */, 0)) + pWhere = Xsqlite3ExprAnd(tls, pParse, pWhere, pEq) + + // For ON UPDATE, construct the next term of the WHEN clause. + // The final WHEN clause will be like this: + // + // WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN) + if pChanges != 0 { + pEq = Xsqlite3PExpr(tls, pParse, TK_IS, + Xsqlite3PExpr(tls, pParse, TK_DOT, + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+48 /* &tOld */, 0), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+16 /* &tToCol */, 0)), + Xsqlite3PExpr(tls, pParse, TK_DOT, + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+64 /* &tNew */, 0), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+16 /* &tToCol */, 0))) + pWhen = Xsqlite3ExprAnd(tls, pParse, pWhen, pEq) + } + + if (action != OE_Restrict) && ((action != OE_Cascade) || (pChanges != 0)) { + var pNew uintptr + if action == OE_Cascade { + pNew = Xsqlite3PExpr(tls, pParse, TK_DOT, + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+64 /* &tNew */, 0), + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+16 /* &tToCol */, 0)) + } else if action == OE_SetDflt { + var pCol uintptr = ((*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FaCol + uintptr(iFromCol)*32) + var pDflt uintptr + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { + + pDflt = uintptr(0) + } else { + pDflt = (*Column)(unsafe.Pointer(pCol)).FpDflt + } + if pDflt != 0 { + pNew = Xsqlite3ExprDup(tls, db, pDflt, 0) + } else { + pNew = Xsqlite3ExprAlloc(tls, db, TK_NULL, uintptr(0), 0) + } + } else { + pNew = Xsqlite3ExprAlloc(tls, db, TK_NULL, uintptr(0), 0) + } + pList = Xsqlite3ExprListAppend(tls, pParse, pList, pNew) + Xsqlite3ExprListSetName(tls, pParse, pList, bp+32 /* &tFromCol */, 0) + } + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* aiCol */))) + + zFrom = (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName + nFrom = Xsqlite3Strlen30(tls, zFrom) + + if action == OE_Restrict { + // var tFrom Token at bp+80, 16 + + var pRaise uintptr + + (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fz = zFrom + (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fn = uint32(nFrom) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4251 /* "FOREIGN KEY cons..." */) + if pRaise != 0 { + (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) + } + pSelect = Xsqlite3SelectNew(tls, pParse, + Xsqlite3ExprListAppend(tls, pParse, uintptr(0), pRaise), + Xsqlite3SrcListAppend(tls, pParse, uintptr(0), bp+80 /* &tFrom */, uintptr(0)), + pWhere, + uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + pWhere = uintptr(0) + } + + // Disable lookaside memory allocation + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) + + pTrigger = Xsqlite3DbMallocZero(tls, db, + (uint64(((uint64(unsafe.Sizeof(Trigger{})) + uint64(unsafe.Sizeof(TriggerStep{}))) + uint64(nFrom)) + uint64(1)))) + if pTrigger != 0 { + pStep = libc.AssignPtrUintptr(pTrigger+56 /* &.step_list */, (pTrigger + 1*72)) + (*TriggerStep)(unsafe.Pointer(pStep)).FzTarget = (pStep + 1*96) + libc.Xmemcpy(tls, (*TriggerStep)(unsafe.Pointer(pStep)).FzTarget, zFrom, uint64(nFrom)) + + (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere = Xsqlite3ExprDup(tls, db, pWhere, EXPRDUP_REDUCE) + (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList = Xsqlite3ExprListDup(tls, db, pList, EXPRDUP_REDUCE) + (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect = Xsqlite3SelectDup(tls, db, pSelect, EXPRDUP_REDUCE) + if pWhen != 0 { + pWhen = Xsqlite3PExpr(tls, pParse, TK_NOT, pWhen, uintptr(0)) + (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen = Xsqlite3ExprDup(tls, db, pWhen, EXPRDUP_REDUCE) + } + } + + // Re-enable the lookaside buffer, if it was disabled earlier. + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = func() uint16 { + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + return uint16(0) + } + return (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue + }() + + Xsqlite3ExprDelete(tls, db, pWhere) + Xsqlite3ExprDelete(tls, db, pWhen) + Xsqlite3ExprListDelete(tls, db, pList) + Xsqlite3SelectDelete(tls, db, pSelect) + if int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 1 { + fkTriggerDelete(tls, db, pTrigger) + return uintptr(0) + } + + switch action { + case OE_Restrict: + (*TriggerStep)(unsafe.Pointer(pStep)).Fop = U8(TK_SELECT) + break + fallthrough + case OE_Cascade: + if !(pChanges != 0) { + (*TriggerStep)(unsafe.Pointer(pStep)).Fop = U8(TK_DELETE) + break + } + fallthrough + default: + (*TriggerStep)(unsafe.Pointer(pStep)).Fop = U8(TK_UPDATE) + } + (*TriggerStep)(unsafe.Pointer(pStep)).FpTrig = pTrigger + (*Trigger)(unsafe.Pointer(pTrigger)).FpSchema = (*Table)(unsafe.Pointer(pTab)).FpSchema + (*Trigger)(unsafe.Pointer(pTrigger)).FpTabSchema = (*Table)(unsafe.Pointer(pTab)).FpSchema + *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */) + uintptr(iAction)*8)) = pTrigger + (*Trigger)(unsafe.Pointer(pTrigger)).Fop = func() uint8 { + if pChanges != 0 { + return uint8(TK_UPDATE) + } + return uint8(TK_DELETE) + }() + } + + return pTrigger +} + +// This function is called when deleting or updating a row to implement +// any required CASCADE, SET NULL or SET DEFAULT actions. +func Xsqlite3FkActions(tls *libc.TLS, pParse uintptr, pTab uintptr, pChanges uintptr, regOld int32, aChange uintptr, bChngRowid int32) { /* sqlite3.c:122986:21: */ + // If foreign-key support is enabled, iterate through all FKs that + // refer to table pTab. If there is an action associated with the FK + // for this operation (either update or delete), invoke the associated + // trigger sub-program. + if ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_ForeignKeys)) != 0 { + var pFKey uintptr // Iterator variable + for pFKey = Xsqlite3FkReferences(tls, pTab); pFKey != 0; pFKey = (*FKey)(unsafe.Pointer(pFKey)).FpNextTo { + if (aChange == uintptr(0)) || (fkParentIsModified(tls, pTab, pFKey, aChange, bChngRowid) != 0) { + var pAct uintptr = fkActionTrigger(tls, pParse, pTab, pFKey, pChanges) + if pAct != 0 { + Xsqlite3CodeRowTriggerDirect(tls, pParse, pAct, pTab, regOld, OE_Abort, 0) + } + } + } + } +} + +// Free all memory associated with foreign key definitions attached to +// table pTab. Remove the deleted foreign keys from the Schema.fkeyHash +// hash table. +func Xsqlite3FkDelete(tls *libc.TLS, db uintptr, pTab uintptr) { /* sqlite3.c:123018:21: */ + var pFKey uintptr // Iterator variable + var pNext uintptr // Copy of pFKey->pNextFrom + + for pFKey = (*Table)(unsafe.Pointer(pTab)).FpFKey; pFKey != 0; pFKey = pNext { + + // Remove the FK from the fkeyHash hash table. + if !(db != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0)) { + if (*FKey)(unsafe.Pointer(pFKey)).FpPrevTo != 0 { + (*FKey)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpPrevTo)).FpNextTo = (*FKey)(unsafe.Pointer(pFKey)).FpNextTo + } else { + var p uintptr = (*FKey)(unsafe.Pointer(pFKey)).FpNextTo + var z uintptr = func() uintptr { + if p != 0 { + return (*FKey)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpNextTo)).FzTo + } + return (*FKey)(unsafe.Pointer(pFKey)).FzTo + }() + Xsqlite3HashInsert(tls, ((*Table)(unsafe.Pointer(pTab)).FpSchema + 80 /* &.fkeyHash */), z, p) + } + if (*FKey)(unsafe.Pointer(pFKey)).FpNextTo != 0 { + (*FKey)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpNextTo)).FpPrevTo = (*FKey)(unsafe.Pointer(pFKey)).FpPrevTo + } + } + + // EV: R-30323-21917 Each foreign key constraint in SQLite is + // classified as either immediate or deferred. + + // Delete any triggers created to implement actions for this FK. + fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */)))) + fkTriggerDelete(tls, db, *(*uintptr)(unsafe.Pointer((pFKey + 48 /* &.apTrigger */) + 1*8))) + + pNext = (*FKey)(unsafe.Pointer(pFKey)).FpNextFrom + Xsqlite3DbFree(tls, db, pFKey) + } +} + +//************* End of fkey.c *********************************************** +//************* Begin file insert.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains C code routines that are called by the parser +// to handle INSERT statements in SQLite. +// #include "sqliteInt.h" + +// Generate code that will +// +// (1) acquire a lock for table pTab then +// (2) open pTab as cursor iCur. +// +// If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index +// for that table that is actually opened. +func Xsqlite3OpenTable(tls *libc.TLS, pParse uintptr, iCur int32, iDb int32, pTab uintptr, opcode int32) { /* sqlite3.c:123084:21: */ + var v uintptr + + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, + func() uint8 { + if opcode == OP_OpenWrite { + return uint8(1) + } + return uint8(0) + }(), (*Table)(unsafe.Pointer(pTab)).FzName) + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + Xsqlite3VdbeAddOp4Int(tls, v, opcode, iCur, int32((*Table)(unsafe.Pointer(pTab)).Ftnum), iDb, int32((*Table)(unsafe.Pointer(pTab)).FnNVCol)) + + } else { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, pTab) + + Xsqlite3VdbeAddOp3(tls, v, opcode, iCur, int32((*Index)(unsafe.Pointer(pPk)).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) + + } +} + +// Return a pointer to the column affinity string associated with index +// pIdx. A column affinity string has one character for each column in +// the table, according to the affinity of the column: +// +// Character Column affinity +// ------------------------------ +// 'A' BLOB +// 'B' TEXT +// 'C' NUMERIC +// 'D' INTEGER +// 'F' REAL +// +// An extra 'D' is appended to the end of the string to cover the +// rowid that appears as the last column in every index. +// +// Memory for the buffer containing the column index affinity string +// is managed along with the rest of the Index structure. It will be +// released when sqlite3DeleteIndex() is called. +func Xsqlite3IndexAffinityStr(tls *libc.TLS, db uintptr, pIdx uintptr) uintptr { /* sqlite3.c:123131:27: */ + if !(int32((*Index)(unsafe.Pointer(pIdx)).FzColAff) != 0) { + // The first time a column affinity string for a particular index is + // required, it is allocated and populated here. It is then stored as + // a member of the Index structure for subsequent use. + // + // The column affinity string will eventually be deleted by + // sqliteDeleteIndex() when the Index structure itself is cleaned + // up. + var n int32 + var pTab uintptr = (*Index)(unsafe.Pointer(pIdx)).FpTable + (*Index)(unsafe.Pointer(pIdx)).FzColAff = Xsqlite3DbMallocRaw(tls, uintptr(0), (uint64(int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + 1))) + if !(int32((*Index)(unsafe.Pointer(pIdx)).FzColAff) != 0) { + Xsqlite3OomFault(tls, db) + return uintptr(0) + } + for n = 0; n < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn); n++ { + var x I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) + var aff int8 + if int32(x) >= 0 { + aff = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(x)*32)).Faffinity + } else if int32(x) == (-1) { + aff = int8(SQLITE_AFF_INTEGER) + } else { + + aff = Xsqlite3ExprAffinity(tls, (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr+8 /* &.a */)+uintptr(n)*32)).FpExpr) + } + if int32(aff) < SQLITE_AFF_BLOB { + aff = int8(SQLITE_AFF_BLOB) + } + if int32(aff) > SQLITE_AFF_NUMERIC { + aff = int8(SQLITE_AFF_NUMERIC) + } + *(*int8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = aff + } + *(*int8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FzColAff + uintptr(n))) = int8(0) + } + + return (*Index)(unsafe.Pointer(pIdx)).FzColAff +} + +// Compute the affinity string for table pTab, if it has not already been +// computed. As an optimization, omit trailing SQLITE_AFF_BLOB affinities. +// +// If the affinity exists (if it is no entirely SQLITE_AFF_BLOB values) and +// if iReg>0 then code an OP_Affinity opcode that will set the affinities +// for register iReg and following. Or if affinities exists and iReg==0, +// then just set the P4 operand of the previous opcode (which should be +// an OP_MakeRecord) to the affinity string. +// +// A column affinity string has one character per column: +// +// Character Column affinity +// ------------------------------ +// 'A' BLOB +// 'B' TEXT +// 'C' NUMERIC +// 'D' INTEGER +// 'E' REAL +func Xsqlite3TableAffinity(tls *libc.TLS, v uintptr, pTab uintptr, iReg int32) { /* sqlite3.c:123190:21: */ + var i int32 + var j int32 + var zColAff uintptr = (*Table)(unsafe.Pointer(pTab)).FzColAff + if zColAff == uintptr(0) { + var db uintptr = Xsqlite3VdbeDb(tls, v) + zColAff = Xsqlite3DbMallocRaw(tls, uintptr(0), (uint64(int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1))) + if !(zColAff != 0) { + Xsqlite3OomFault(tls, db) + return + } + + for i = libc.AssignInt32(&j, 0); i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0 { + *(*int8)(unsafe.Pointer(zColAff + uintptr(libc.PostIncInt32(&j, 1)))) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32)).Faffinity + } + } + for ok := true; ok; ok = ((j >= 0) && (int32(*(*int8)(unsafe.Pointer(zColAff + uintptr(j)))) <= SQLITE_AFF_BLOB)) { + *(*int8)(unsafe.Pointer(zColAff + uintptr(libc.PostDecInt32(&j, 1)))) = int8(0) + } + (*Table)(unsafe.Pointer(pTab)).FzColAff = zColAff + } + + i = (int32(libc.Xstrlen(tls, zColAff) & uint64(0x3fffffff))) + if i != 0 { + if iReg != 0 { + Xsqlite3VdbeAddOp4(tls, v, OP_Affinity, iReg, i, 0, zColAff, i) + } else { + Xsqlite3VdbeChangeP4(tls, v, -1, zColAff, i) + } + } +} + +// Return non-zero if the table pTab in database iDb or any of its indices +// have been opened at any point in the VDBE program. This is used to see if +// a statement of the form "INSERT INTO SELECT ..." can +// run without using a temporary table for the results of the SELECT. +func readsTable(tls *libc.TLS, p uintptr, iDb int32, pTab uintptr) int32 { /* sqlite3.c:123229:12: */ + var v uintptr = Xsqlite3GetVdbe(tls, p) + var i int32 + var iEnd int32 = Xsqlite3VdbeCurrentAddr(tls, v) + var pVTab uintptr + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + pVTab = Xsqlite3GetVTable(tls, (*Parse)(unsafe.Pointer(p)).Fdb, pTab) + } else { + pVTab = uintptr(0) + } + + for i = 1; i < iEnd; i++ { + var pOp uintptr = Xsqlite3VdbeGetOp(tls, v, i) + + if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_OpenRead) && ((*VdbeOp)(unsafe.Pointer(pOp)).Fp3 == iDb) { + var pIndex uintptr + var tnum Pgno = Pgno((*VdbeOp)(unsafe.Pointer(pOp)).Fp2) + if tnum == (*Table)(unsafe.Pointer(pTab)).Ftnum { + return 1 + } + for pIndex = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIndex != 0; pIndex = (*Index)(unsafe.Pointer(pIndex)).FpNext { + if tnum == (*Index)(unsafe.Pointer(pIndex)).Ftnum { + return 1 + } + } + } + if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_VOpen) && (*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) == pVTab) { + + return 1 + } + } + return 0 +} + +// This walker callback will compute the union of colFlags flags for all +// referenced columns in a CHECK constraint or generated column expression. +func exprColumnFlagUnion(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:123266:12: */ + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) && (int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) >= 0) { + + *(*U16)(unsafe.Pointer(pWalker + 36 /* &.eCode */)) |= U16((int32((*Column)(unsafe.Pointer((*Table1)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)))).FaCol + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiColumn)*32)).FcolFlags))) + } + return WRC_Continue +} + +// All regular columns for table pTab have been puts into registers +// starting with iRegStore. The registers that correspond to STORED +// or VIRTUAL columns have not yet been initialized. This routine goes +// back and computes the values for those columns based on the previously +// computed normal columns. +func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore int32, pTab uintptr) { /* sqlite3.c:123282:21: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var i int32 + // var w Walker at bp+8, 48 + + var pRedo uintptr + var eProgress int32 + var pOp uintptr + + // Before computing generated columns, first go through and make sure + // that appropriate affinity has been applied to the regular columns + Xsqlite3TableAffinity(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, pTab, iRegStore) + if (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasStored)) != U32(0)) && + (int32((*VdbeOp)(unsafe.Pointer((libc.AssignUintptr(&pOp, Xsqlite3VdbeGetOp(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, -1))))).Fopcode) == OP_Affinity) { + // Change the OP_Affinity argument to '@' (NONE) for all stored + // columns. '@' is the no-op affinity and those columns have not + // yet been computed. + var ii int32 + var jj int32 + var zP4 uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + + for ii = libc.AssignInt32(&jj, 0); *(*int8)(unsafe.Pointer(zP4 + uintptr(jj))) != 0; ii++ { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(ii)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0 { + continue + } + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(ii)*32)).FcolFlags) & COLFLAG_STORED) != 0 { + *(*int8)(unsafe.Pointer(zP4 + uintptr(jj))) = int8(SQLITE_AFF_NONE) + } + jj++ + } + } + + // Because there can be multiple generated columns that refer to one another, + // this is a two-pass algorithm. On the first pass, mark all generated + // columns as "not available". + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_GENERATED) != 0 { + + *(*U16)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32 + 28 /* &.colFlags */)) |= U16((COLFLAG_NOTAVAIL)) + } + } + + *(*uintptr)(unsafe.Pointer(bp + 8 /* &w */ + 40 /* &.u */)) = pTab + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{exprColumnFlagUnion})) + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FxSelectCallback = uintptr(0) + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FxSelectCallback2 = uintptr(0) + + // On the second pass, compute the value of each NOT-AVAILABLE column. + // Companion code in the TK_COLUMN case of sqlite3ExprCodeTarget() will + // compute dependencies and mark remove the COLSPAN_NOTAVAIL mark, as + // they are needed. + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = -iRegStore + for ok := true; ok; ok = ((pRedo != 0) && (eProgress != 0)) { + eProgress = 0 + pRedo = uintptr(0) + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + var pCol uintptr = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32) + if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_NOTAVAIL) != 0 { + var x int32 + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FeCode = U16(0) + Xsqlite3WalkExpr(tls, bp+8 /* &w */, (*Column)(unsafe.Pointer(pCol)).FpDflt) + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(COLFLAG_BUSY))) + if (int32((*Walker)(unsafe.Pointer(bp+8 /* &w */)).FeCode) & COLFLAG_NOTAVAIL) != 0 { + pRedo = pCol + continue + } + eProgress = 1 + + x = (int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(i))) + iRegStore) + Xsqlite3ExprCodeGeneratedColumn(tls, pParse, pCol, x) + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(COLFLAG_NOTAVAIL))) + } + } + } + if pRedo != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6945 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + } + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 +} + +// Locate or create an AutoincInfo structure associated with table pTab +// which is in database iDb. Return the register number for the register +// that holds the maximum rowid. Return zero if pTab is not an AUTOINCREMENT +// table. (Also return zero when doing a VACUUM since we do not want to +// update the AUTOINCREMENT counters during a VACUUM.) +// +// There is at most one AutoincInfo structure per table even if the +// same table is autoincremented multiple times due to inserts within +// triggers. A new AutoincInfo structure is created if this is the +// first use of table pTab. On 2nd and subsequent uses, the original +// AutoincInfo structure is used. +// +// Four consecutive registers are allocated: +// +// (1) The name of the pTab table. +// (2) The maximum ROWID of pTab. +// (3) The rowid in sqlite_sequence of pTab +// (4) The original value of the max ROWID in pTab, or NULL if none +// +// The 2nd register is the one that is returned. That is all the +// insert routine needs to know about. +func autoIncBegin(tls *libc.TLS, pParse uintptr, iDb int32, pTab uintptr) int32 { /* sqlite3.c:123400:12: */ + var memId int32 = 0 // Register holding maximum rowid + + if (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)) && + (((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmDbFlags & U32(DBFLAG_Vacuum)) == U32(0)) { + var pToplevel uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + var pInfo uintptr + var pSeqTab uintptr = (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32)).FpSchema)).FpSeqTab + + // Verify that the sqlite_sequence table exists and is an ordinary + // rowid table with exactly two columns. + // Ticket d8dc2b3a58cd5dc2918a1d4acb 2018-05-23 + if (((pSeqTab == uintptr(0)) || + !(((*Table)(unsafe.Pointer((pSeqTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) || + ((*Table)(unsafe.Pointer(pSeqTab)).FnModuleArg != 0)) || + (int32((*Table)(unsafe.Pointer(pSeqTab)).FnCol) != 2) { + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_CORRUPT | (int32(2) << 8)) + return 0 + } + + pInfo = (*Parse)(unsafe.Pointer(pToplevel)).FpAinc + for (pInfo != 0) && ((*AutoincInfo)(unsafe.Pointer(pInfo)).FpTab != pTab) { + pInfo = (*AutoincInfo)(unsafe.Pointer(pInfo)).FpNext + } + if pInfo == uintptr(0) { + pInfo = Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(AutoincInfo{}))) + Xsqlite3ParserAddCleanup(tls, pToplevel, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3DbFree})), pInfo) + + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return 0 + } + (*AutoincInfo)(unsafe.Pointer(pInfo)).FpNext = (*Parse)(unsafe.Pointer(pToplevel)).FpAinc + (*Parse)(unsafe.Pointer(pToplevel)).FpAinc = pInfo + (*AutoincInfo)(unsafe.Pointer(pInfo)).FpTab = pTab + (*AutoincInfo)(unsafe.Pointer(pInfo)).FiDb = iDb + (*Parse)(unsafe.Pointer(pToplevel)).FnMem++ // Register to hold name of table + (*AutoincInfo)(unsafe.Pointer(pInfo)).FregCtr = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pToplevel)).FnMem, 1) // Max rowid register + *(*int32)(unsafe.Pointer(pToplevel + 56 /* &.nMem */)) += (2) // Rowid in sqlite_sequence + orig max val + } + memId = (*AutoincInfo)(unsafe.Pointer(pInfo)).FregCtr + } + return memId +} + +// This routine generates code that will initialize all of the +// register used by the autoincrement tracker. +func Xsqlite3AutoincrementBegin(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:123451:21: */ + var p uintptr // Information about an AUTOINCREMENT + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + var pDb uintptr // Database only autoinc table + var memId int32 // Register holding max rowid + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // VDBE under construction + + // This routine is never called during trigger-generation. It is + // only called from the top-level + + // We failed long ago if this is not so + for p = (*Parse)(unsafe.Pointer(pParse)).FpAinc; p != 0; p = (*AutoincInfo)(unsafe.Pointer(p)).FpNext { + var aOp uintptr + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*AutoincInfo)(unsafe.Pointer(p)).FiDb)*32) + memId = (*AutoincInfo)(unsafe.Pointer(p)).FregCtr + + Xsqlite3OpenTable(tls, pParse, 0, (*AutoincInfo)(unsafe.Pointer(p)).FiDb, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab, OP_OpenRead) + Xsqlite3VdbeLoadString(tls, v, (memId - 1), (*Table)(unsafe.Pointer((*AutoincInfo)(unsafe.Pointer(p)).FpTab)).FzName) + aOp = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(autoInc)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&autoInc)), iLn1) + if aOp == uintptr(0) { + break + } + (*VdbeOp)(unsafe.Pointer(aOp)).Fp2 = memId + (*VdbeOp)(unsafe.Pointer(aOp)).Fp3 = (memId + 2) + (*VdbeOp)(unsafe.Pointer(aOp + 2*24)).Fp3 = memId + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp1 = (memId - 1) + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp3 = memId + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp5 = U16(SQLITE_JUMPIFNULL) + (*VdbeOp)(unsafe.Pointer(aOp + 4*24)).Fp2 = (memId + 1) + (*VdbeOp)(unsafe.Pointer(aOp + 5*24)).Fp3 = memId + (*VdbeOp)(unsafe.Pointer(aOp + 6*24)).Fp1 = memId + (*VdbeOp)(unsafe.Pointer(aOp + 7*24)).Fp2 = (memId + 2) + (*VdbeOp)(unsafe.Pointer(aOp + 7*24)).Fp1 = memId + (*VdbeOp)(unsafe.Pointer(aOp + 10*24)).Fp2 = memId + if (*Parse)(unsafe.Pointer(pParse)).FnTab == 0 { + (*Parse)(unsafe.Pointer(pParse)).FnTab = 1 + } + } +} + +var iLn1 int32 = 0 /* sqlite3.c:123465:22 */ +var autoInc = [12]VdbeOpList{ + /* 0 */ {Fopcode: U8(OP_Null)}, + /* 1 */ {Fopcode: U8(OP_Rewind), Fp2: int8(10)}, + /* 2 */ {Fopcode: U8(OP_Column)}, + /* 3 */ {Fopcode: U8(OP_Ne), Fp2: int8(9)}, + /* 4 */ {Fopcode: U8(OP_Rowid)}, + /* 5 */ {Fopcode: U8(OP_Column), Fp2: int8(1)}, + /* 6 */ {Fopcode: U8(OP_AddImm)}, + /* 7 */ {Fopcode: U8(OP_Copy)}, + /* 8 */ {Fopcode: U8(OP_Goto), Fp2: int8(11)}, + /* 9 */ {Fopcode: U8(OP_Next), Fp2: int8(2)}, + /* 10 */ {Fopcode: U8(OP_Integer)}, + /* 11 */ {Fopcode: U8(OP_Close)}, +} /* sqlite3.c:123466:29 */ + +// Update the maximum rowid for an autoincrement calculation. +// +// This routine should be called when the regRowid register holds a +// new rowid that is about to be inserted. If that new rowid is +// larger than the maximum rowid in the memId memory cell, then the +// memory cell is updated. +func autoIncStep(tls *libc.TLS, pParse uintptr, memId int32, regRowid int32) { /* sqlite3.c:123512:13: */ + if memId > 0 { + Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_MemMax, memId, regRowid) + } +} + +// This routine generates the code needed to write autoincrement +// maximum rowid values back into the sqlite_sequence register. +// Every statement that might do an INSERT into an autoincrement +// table (either directly or through triggers) needs to call this +// routine just before the "exit" code. +func autoIncrementEnd(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:123525:29: */ + var p uintptr + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + for p = (*Parse)(unsafe.Pointer(pParse)).FpAinc; p != 0; p = (*AutoincInfo)(unsafe.Pointer(p)).FpNext { + var aOp uintptr + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*AutoincInfo)(unsafe.Pointer(p)).FiDb)*32) + var iRec int32 + var memId int32 = (*AutoincInfo)(unsafe.Pointer(p)).FregCtr + + iRec = Xsqlite3GetTempReg(tls, pParse) + + Xsqlite3VdbeAddOp3(tls, v, OP_Le, (memId + 2), (Xsqlite3VdbeCurrentAddr(tls, v) + 7), memId) + + Xsqlite3OpenTable(tls, pParse, 0, (*AutoincInfo)(unsafe.Pointer(p)).FiDb, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab, OP_OpenWrite) + aOp = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(autoIncEnd)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&autoIncEnd)), iLn2) + if aOp == uintptr(0) { + break + } + (*VdbeOp)(unsafe.Pointer(aOp)).Fp1 = (memId + 1) + (*VdbeOp)(unsafe.Pointer(aOp + 1*24)).Fp2 = (memId + 1) + (*VdbeOp)(unsafe.Pointer(aOp + 2*24)).Fp1 = (memId - 1) + (*VdbeOp)(unsafe.Pointer(aOp + 2*24)).Fp3 = iRec + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp2 = iRec + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp3 = (memId + 1) + (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp5 = U16(OPFLAG_APPEND) + Xsqlite3ReleaseTempReg(tls, pParse, iRec) + } +} + +var iLn2 int32 = 0 /* sqlite3.c:123532:22 */ +var autoIncEnd = [5]VdbeOpList{ + /* 0 */ {Fopcode: U8(OP_NotNull), Fp2: int8(2)}, + /* 1 */ {Fopcode: U8(OP_NewRowid)}, + /* 2 */ {Fopcode: U8(OP_MakeRecord), Fp2: int8(2)}, + /* 3 */ {Fopcode: U8(OP_Insert)}, + /* 4 */ {Fopcode: U8(OP_Close)}, +} /* sqlite3.c:123533:29 */ + +func Xsqlite3AutoincrementEnd(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:123562:21: */ + if (*Parse)(unsafe.Pointer(pParse)).FpAinc != 0 { + autoIncrementEnd(tls, pParse) + } +} + +// This routine is called to handle SQL of the following forms: +// +// insert into TABLE (IDLIST) values(EXPRLIST),(EXPRLIST),... +// insert into TABLE (IDLIST) select +// insert into TABLE (IDLIST) default values +// +// The IDLIST following the table name is always optional. If omitted, +// then a list of all (non-hidden) columns for the table is substituted. +// The IDLIST appears in the pColumn parameter. pColumn is NULL if IDLIST +// is omitted. +// +// For the pSelect parameter holds the values to be inserted for the +// first two forms shown above. A VALUES clause is really just short-hand +// for a SELECT statement that omits the FROM clause and everything else +// that follows. If the pSelect parameter is NULL, that means that the +// DEFAULT VALUES form of the INSERT statement is intended. +// +// The code generated follows one of four templates. For a simple +// insert with data coming from a single-row VALUES clause, the code executes +// once straight down through. Pseudo-code follows (we call this +// the "1st template"): +// +// open write cursor to
and its indices +// put VALUES clause expressions into registers +// write the resulting record into
+// cleanup +// +// The three remaining templates assume the statement is of the form +// +// INSERT INTO
SELECT ... +// +// If the SELECT clause is of the restricted form "SELECT * FROM " - +// in other words if the SELECT pulls all columns from a single table +// and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and +// if and are distinct tables but have identical +// schemas, including all the same indices, then a special optimization +// is invoked that copies raw records from over to . +// See the xferOptimization() function for the implementation of this +// template. This is the 2nd template. +// +// open a write cursor to
+// open read cursor on +// transfer all records in over to
+// close cursors +// foreach index on
+// open a write cursor on the
index +// open a read cursor on the corresponding index +// transfer all records from the read to the write cursors +// close cursors +// end foreach +// +// The 3rd template is for when the second template does not apply +// and the SELECT clause does not read from
at any time. +// The generated code follows this template: +// +// X <- A +// goto B +// A: setup for the SELECT +// loop over the rows in the SELECT +// load values into registers R..R+n +// yield X +// end loop +// cleanup after the SELECT +// end-coroutine X +// B: open write cursor to
and its indices +// C: yield X, at EOF goto D +// insert the select result into
from R..R+n +// goto C +// D: cleanup +// +// The 4th template is used if the insert statement takes its +// values from a SELECT but the data is being inserted into a table +// that is also read as part of the SELECT. In the third form, +// we have to use an intermediate table to store the results of +// the select. The template is like this: +// +// X <- A +// goto B +// A: setup for the SELECT +// loop over the tables in the SELECT +// load value into register R..R+n +// yield X +// end loop +// cleanup after the SELECT +// end co-routine R +// B: open temp table +// L: yield X, at EOF goto M +// insert row from R..R+n into temp table +// goto L +// M: open write cursor to
and its indices +// rewind temp table +// C: loop over rows of intermediate table +// transfer values form intermediate table into
+// end loop +// D: cleanup +func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uintptr, pColumn uintptr, onError int32, pUpsert uintptr) { /* sqlite3.c:123681:21: */ + bp := tls.Alloc(188) + defer tls.Free(188) + + var db uintptr // The main database structure + var pTab uintptr // The table to insert into. aka TABLE + var i int32 + var j int32 // Loop counters + var v uintptr // Generate code into this virtual machine + var pIdx uintptr // For looping over indices of the table + var nColumn int32 // Number of columns in the data + var nHidden int32 // Number of hidden columns if TABLE is virtual + // var iDataCur int32 at bp+176, 4 + // VDBE cursor that is the main data repository + // var iIdxCur int32 at bp+180, 4 + // First index cursor + var ipkColumn int32 // Column that is the INTEGER PRIMARY KEY + var endOfLoop int32 // Label for the end of the insertion loop + var srcTab int32 // Data comes from this temporary cursor if >=0 + var addrInsTop int32 // Jump to label "D" + var addrCont int32 // Top of insert loop. Label "C" in templates 3 and 4 + // var dest SelectDest at bp+80, 40 + // Destination for SELECT on rhs of INSERT + var iDb int32 // Index of database holding TABLE + var useTempTable U8 // Store SELECT results in intermediate table + var appendFlag U8 // True if the insert is likely to be an append + var withoutRowid U8 // 0 for normal table. 1 for WITHOUT ROWID table + var bIdListInOrder U8 // True if IDLIST is in table order + var pList uintptr // List of VALUES() to be inserted + var iRegStore int32 // Register in which to store next column + + // Register allocations + var regFromSelect int32 // Base register for data coming from SELECT + var regAutoinc int32 // Register holding the AUTOINCREMENT counter + var regRowCount int32 // Memory cell used for the row counter + var regIns int32 // Block of regs holding rowid+data being inserted + var regRowid int32 // registers holding insert rowid + var regData int32 // register holding first column to insert + var aRegIdx uintptr // One register allocated to each index + + var isView int32 // True if attempting to insert into a view + var pTrigger uintptr // List of triggers on pTab, if required + // var tmask int32 at bp+72, 4 + + // Invoke the coroutine to extract information from the SELECT + // and add it to a transient table srcTab. The code generated + // here is from the 4th template: + // + // B: open temp table + // L: yield X, goto M at EOF + // insert row from R..R+n into temp table + // goto L + // M: ... + var regRec int32 // Register to hold packed record + var regTempRowid int32 // Register to hold temp table ROWID + var addrL int32 + // Data is coming from a SELECT or from a multi-row VALUES clause. + // Generate a co-routine to run the SELECT. + var regYield int32 // Register holding co-routine entry-point + var addrTop int32 // Top of the co-routine + var rc int32 + // This is the case if the data for the INSERT is coming from a + // single-row VALUES clause + // var sNC NameContext at bp+120, 56 + + var nIdx int32 + var pNx uintptr + var k int32 + var colFlags U32 + var addr1 int32 + var regCols int32 + var pIpk uintptr + var addr11 int32 + var pVTab uintptr + // var isReplace int32 at bp+184, 4 + // Set to true if constraints may cause a replace + var bUseSeek int32 + nHidden = 0 + *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)) = 0 + *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)) = 0 + ipkColumn = -1 + srcTab = 0 + addrInsTop = 0 + addrCont = 0 + useTempTable = U8(0) + appendFlag = U8(0) + pList = uintptr(0) + regFromSelect = 0 + regAutoinc = 0 + regRowCount = 0 + aRegIdx = uintptr(0) // Mask of trigger times + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __1 + } + goto insert_cleanup +__1: + ; + (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FiSDParm = 0 // Suppress a harmless compiler warning + + // If the Select object is really just a simple VALUES() list with a + // single row (the common case) then keep that one row of values + // and discard the other (unused) parts of the pSelect object + if !(((pSelect != 0) && (((*Select)(unsafe.Pointer(pSelect)).FselFlags & U32(SF_Values)) != U32(0))) && ((*Select)(unsafe.Pointer(pSelect)).FpPrior == uintptr(0))) { + goto __2 + } + pList = (*Select)(unsafe.Pointer(pSelect)).FpEList + (*Select)(unsafe.Pointer(pSelect)).FpEList = uintptr(0) + Xsqlite3SelectDelete(tls, db, pSelect) + pSelect = uintptr(0) +__2: + ; + + // Locate the table into which we will be inserting new information. + + pTab = Xsqlite3SrcListLookup(tls, pParse, pTabList) + if !(pTab == uintptr(0)) { + goto __3 + } + goto insert_cleanup +__3: + ; + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, (*Table)(unsafe.Pointer(pTab)).FzName, uintptr(0), + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) != 0) { + goto __4 + } + goto insert_cleanup +__4: + ; + withoutRowid = libc.BoolUint8(!(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) + + // Figure out if we have any triggers and if the table being + // inserted into is a view + pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_INSERT, uintptr(0), bp+72 /* &tmask */) + isView = (libc.Bool32((*Table)(unsafe.Pointer(pTab)).FpSelect != uintptr(0))) + + // If pTab is really a view, make sure it has been initialized. + // ViewGetColumnNames() is a no-op if pTab is not a view. + if !(Xsqlite3ViewGetColumnNames(tls, pParse, pTab) != 0) { + goto __5 + } + goto insert_cleanup +__5: + ; + + // Cannot insert into a read-only table. + if !(Xsqlite3IsReadOnly(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 72 /* tmask */))) != 0) { + goto __6 + } + goto insert_cleanup +__6: + ; + + // Allocate a VDBE + v = Xsqlite3GetVdbe(tls, pParse) + if !(v == uintptr(0)) { + goto __7 + } + goto insert_cleanup +__7: + ; + if !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) { + goto __8 + } + Xsqlite3VdbeCountChanges(tls, v) +__8: + ; + Xsqlite3BeginWriteOperation(tls, pParse, (libc.Bool32((pSelect != 0) || (pTrigger != 0))), iDb) + + // If the statement is of the form + // + // INSERT INTO SELECT * FROM ; + // + // Then special optimizations can be applied that make the transfer + // very fast and which reduce fragmentation of indices. + // + // This is the 2nd template. + if !((pColumn == uintptr(0)) && (xferOptimization(tls, pParse, pTab, pSelect, onError, iDb) != 0)) { + goto __9 + } + + goto insert_end +__9: + ; + + // If this is an AUTOINCREMENT table, look up the sequence number in the + // sqlite_sequence table and store it in memory cell regAutoinc. + regAutoinc = autoIncBegin(tls, pParse, iDb, pTab) + + // Allocate a block registers to hold the rowid and the values + // for all columns of the new row. + regRowid = libc.AssignInt32(®Ins, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1)) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1) + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __10 + } + regRowid++ + (*Parse)(unsafe.Pointer(pParse)).FnMem++ +__10: + ; + regData = (regRowid + 1) + + // If the INSERT statement included an IDLIST term, then make sure + // all elements of the IDLIST really are columns of the table and + // remember the column indices. + // + // If the table has an INTEGER PRIMARY KEY column and that column + // is named in the IDLIST, then record in the ipkColumn variable + // the index into IDLIST of the primary key column. ipkColumn is + // the index of the primary key as it appears in IDLIST, not as + // is appears in the original table. (The index of the INTEGER + // PRIMARY KEY in the original table is pTab->iPKey.) After this + // loop, if ipkColumn==(-1), that means that integer primary key + // is unspecified, and hence the table is either WITHOUT ROWID or + // it will automatically generated an integer primary key. + // + // bIdListInOrder is true if the columns in IDLIST are in storage + // order. This enables an optimization that avoids shuffling the + // columns into storage order. False negatives are harmless, + // but false positives will cause database corruption. + bIdListInOrder = (U8(libc.Bool32(((*Table)(unsafe.Pointer(pTab)).FtabFlags & (U32(TF_OOOHidden | TF_HasStored))) == U32(0)))) + if !(pColumn != 0) { + goto __11 + } + i = 0 +__12: + if !(i < (*IdList)(unsafe.Pointer(pColumn)).FnId) { + goto __14 + } + (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa + uintptr(i)*16)).Fidx = -1 + goto __13 +__13: + i++ + goto __12 + goto __14 +__14: + ; + i = 0 +__15: + if !(i < (*IdList)(unsafe.Pointer(pColumn)).FnId) { + goto __17 + } + j = 0 +__18: + if !(j < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __20 + } + if !(Xsqlite3StrICmp(tls, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName) == 0) { + goto __21 + } + (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa + uintptr(i)*16)).Fidx = j + if !(i != j) { + goto __22 + } + bIdListInOrder = U8(0) +__22: + ; + if !(j == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __23 + } + ipkColumn = i +__23: + ; + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FcolFlags) & (COLFLAG_STORED | COLFLAG_VIRTUAL)) != 0) { + goto __24 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+14170, /* "cannot INSERT in..." */ + libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) + goto insert_cleanup +__24: + ; + goto __20 +__21: + ; + goto __19 +__19: + j++ + goto __18 + goto __20 +__20: + ; + if !(j >= int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __25 + } + if !((Xsqlite3IsRowid(tls, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName) != 0) && !(withoutRowid != 0)) { + goto __26 + } + ipkColumn = i + bIdListInOrder = U8(0) + goto __27 +__26: + Xsqlite3ErrorMsg(tls, pParse, ts+14211, /* "table %S has no ..." */ + libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + goto insert_cleanup +__27: + ; +__25: + ; + goto __16 +__16: + i++ + goto __15 + goto __17 +__17: + ; +__11: + ; + + // Figure out how many columns of data are supplied. If the data + // is coming from a SELECT statement, then generate a co-routine that + // produces a single row of the SELECT on each invocation. The + // co-routine is the common header to the 3rd and 4th templates. + if !(pSelect != 0) { + goto __28 + } // Result code + + regYield = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + addrTop = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) + Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regYield, 0, addrTop) + Xsqlite3SelectDestInit(tls, bp+80 /* &dest */, SRT_Coroutine, regYield) + (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FiSdst = func() int32 { + if bIdListInOrder != 0 { + return regData + } + return 0 + }() + (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FnSdst = int32((*Table)(unsafe.Pointer(pTab)).FnCol) + rc = Xsqlite3Select(tls, pParse, pSelect, bp+80 /* &dest */) + regFromSelect = (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FiSdst + if !(((rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) || ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0)) { + goto __30 + } + goto insert_cleanup +__30: + ; + Xsqlite3VdbeEndCoroutine(tls, v, regYield) + Xsqlite3VdbeJumpHere(tls, v, (addrTop - 1)) // label B: + + nColumn = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSelect)).FpEList)).FnExpr + + // Set useTempTable to TRUE if the result of the SELECT statement + // should be written into a temporary table (template 4). Set to + // FALSE if each output row of the SELECT can be written directly into + // the destination table (template 3). + // + // A temp table must be used if the table being updated is also one + // of the tables being read by the SELECT statement. Also use a + // temp table in the case of row triggers. + if !((pTrigger != 0) || (readsTable(tls, pParse, iDb, pTab) != 0)) { + goto __31 + } + useTempTable = U8(1) +__31: + ; + + if !(useTempTable != 0) { + goto __32 + } // Label "L" + + srcTab = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + regRec = Xsqlite3GetTempReg(tls, pParse) + regTempRowid = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, srcTab, nColumn) + addrL = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+80 /* &dest */)).FiSDParm) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regFromSelect, nColumn, regRec) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, srcTab, regTempRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, srcTab, regRec, regTempRowid) + Xsqlite3VdbeGoto(tls, v, addrL) + Xsqlite3VdbeJumpHere(tls, v, addrL) + Xsqlite3ReleaseTempReg(tls, pParse, regRec) + Xsqlite3ReleaseTempReg(tls, pParse, regTempRowid) +__32: + ; + goto __29 +__28: + libc.Xmemset(tls, bp+120 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 120 /* &sNC */)).FpParse = pParse + srcTab = -1 + + if !(pList != 0) { + goto __33 + } + nColumn = (*ExprList)(unsafe.Pointer(pList)).FnExpr + if !(Xsqlite3ResolveExprListNames(tls, bp+120 /* &sNC */, pList) != 0) { + goto __35 + } + goto insert_cleanup +__35: + ; + goto __34 +__33: + nColumn = 0 +__34: + ; +__29: + ; + + // If there is no IDLIST term but the table has an integer primary + // key, the set the ipkColumn variable to the integer primary key + // column index in the original table definition. + if !((pColumn == uintptr(0)) && (nColumn > 0)) { + goto __36 + } + ipkColumn = int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + if !((ipkColumn >= 0) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != U32(0))) { + goto __37 + } + + i = (ipkColumn - 1) +__38: + if !(i >= 0) { + goto __40 + } + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_GENERATED) != 0) { + goto __41 + } + + ipkColumn-- +__41: + ; + goto __39 +__39: + i-- + goto __38 + goto __40 +__40: + ; +__37: + ; + + // Make sure the number of columns in the source data matches the number + // of columns to be inserted into the table. + + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & (U32(TF_HasGenerated | TF_HasHidden))) != U32(0)) { + goto __42 + } + i = 0 +__43: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __45 + } + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_NOINSERT) != 0) { + goto __46 + } + nHidden++ +__46: + ; + goto __44 +__44: + i++ + goto __43 + goto __45 +__45: + ; +__42: + ; + if !(nColumn != (int32((*Table)(unsafe.Pointer(pTab)).FnCol) - nHidden)) { + goto __47 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+14243, /* "table %S has %d ..." */ + libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) + goto insert_cleanup +__47: + ; +__36: + ; + if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { + goto __48 + } + Xsqlite3ErrorMsg(tls, pParse, ts+14295 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + goto insert_cleanup +__48: + ; + + // Initialize the count of rows to be inserted + if !((((((*Sqlite3)(unsafe.Pointer(db)).Fflags & (U64((uint64(0x00001))) << 32)) != uint64(0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FbReturning) != 0)) { + goto __49 + } + regRowCount = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regRowCount) +__49: + ; + + // If this is not a view, open the table and and all indices + if !(!(isView != 0)) { + goto __50 + } + nIdx = Xsqlite3OpenTableAndIndices(tls, pParse, pTab, OP_OpenWrite, uint8(0), -1, uintptr(0), + bp+176 /* &iDataCur */, bp+180 /* &iIdxCur */) + aRegIdx = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(int32(0))) * (uint64(nIdx + 2))))) + if !(aRegIdx == uintptr(0)) { + goto __51 + } + goto insert_cleanup +__51: + ; + i = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__52: + if !(i < nIdx) { + goto __54 + } + + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn)) + goto __53 +__53: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + i++ + goto __52 + goto __54 +__54: + ; + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) // Register to store the table record +__50: + ; + if !(pUpsert != 0) { + goto __55 + } + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __56 + } + Xsqlite3ErrorMsg(tls, pParse, ts+14320, /* "UPSERT not imple..." */ + libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) + goto insert_cleanup +__56: + ; + if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { + goto __57 + } + Xsqlite3ErrorMsg(tls, pParse, ts+14366 /* "cannot UPSERT a ..." */, 0) + goto insert_cleanup +__57: + ; + if !(Xsqlite3HasExplicitNulls(tls, pParse, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) != 0) { + goto __58 + } + goto insert_cleanup +__58: + ; + (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor = *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)) + pNx = pUpsert +__59: + (*Upsert)(unsafe.Pointer(pNx)).FpUpsertSrc = pTabList + (*Upsert)(unsafe.Pointer(pNx)).FregData = regData + (*Upsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)) + (*Upsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)) + if !((*Upsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0) { + goto __62 + } + if !(Xsqlite3UpsertAnalyzeTarget(tls, pParse, pTabList, pNx) != 0) { + goto __63 + } + goto insert_cleanup +__63: + ; +__62: + ; + pNx = (*Upsert)(unsafe.Pointer(pNx)).FpNextUpsert + goto __60 +__60: + if pNx != uintptr(0) { + goto __59 + } + goto __61 +__61: + ; +__55: + ; + + // This is the top of the main insertion loop + if !(useTempTable != 0) { + goto __64 + } + // This block codes the top of loop only. The complete loop is the + // following pseudocode (template 4): + // + // rewind temp table, if empty goto D + // C: loop over rows of intermediate table + // transfer values form intermediate table into
+ // end loop + // D: ... + addrInsTop = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, srcTab) + addrCont = Xsqlite3VdbeCurrentAddr(tls, v) + goto __65 +__64: + if !(pSelect != 0) { + goto __66 + } + // This block codes the top of loop only. The complete loop is the + // following pseudocode (template 3): + // + // C: yield X, at EOF goto D + // insert the select result into
from R..R+n + // goto C + // D: ... + + addrInsTop = libc.AssignInt32(&addrCont, Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+80 /* &dest */)).FiSDParm)) + + if !(ipkColumn >= 0) { + goto __67 + } + // tag-20191021-001: If the INTEGER PRIMARY KEY is being generated by the + // SELECT, go ahead and copy the value into the rowid slot now, so that + // the value does not get overwritten by a NULL at tag-20191021-002. + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, (regFromSelect + ipkColumn), regRowid) +__67: + ; +__66: + ; +__65: + ; + + // Compute data for ordinary columns of the new entry. Values + // are written in storage order into registers starting with regData. + // Only ordinary columns are computed in this loop. The rowid + // (if there is one) is computed later and generated columns are + // computed after the rowid since they might depend on the value + // of the rowid. + nHidden = 0 + iRegStore = regData + i = 0 +__68: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __70 + } + + if !(i == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __71 + } + // tag-20191021-002: References to the INTEGER PRIMARY KEY are filled + // using the rowid. So put a NULL in the IPK slot of the record to avoid + // using excess space. The file format definition requires this extra + // NULL - we cannot optimize further by skipping the column completely + Xsqlite3VdbeAddOp1(tls, v, OP_SoftNull, iRegStore) + goto __69 +__71: + ; + if !(((libc.AssignUint32(&colFlags, U32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags))) & U32(COLFLAG_NOINSERT)) != U32(0)) { + goto __72 + } + nHidden++ + if !((colFlags & U32(COLFLAG_VIRTUAL)) != U32(0)) { + goto __73 + } + // Virtual columns do not participate in OP_MakeRecord. So back up + // iRegStore by one slot to compensate for the iRegStore++ in the + // outer for() loop + iRegStore-- + goto __69 + goto __74 +__73: + if !((colFlags & U32(COLFLAG_STORED)) != U32(0)) { + goto __75 + } + // Stored columns are computed later. But if there are BEFORE + // triggers, the slots used for stored columns will be OP_Copy-ed + // to a second block of registers, so the register needs to be + // initialized to NULL to avoid an uninitialized register read + if !((*(*int32)(unsafe.Pointer(bp + 72 /* tmask */)) & TRIGGER_BEFORE) != 0) { + goto __77 + } + Xsqlite3VdbeAddOp1(tls, v, OP_SoftNull, iRegStore) +__77: + ; + goto __69 + goto __76 +__75: + if !(pColumn == uintptr(0)) { + goto __78 + } + // Hidden columns that are not explicitly named in the INSERT + // get there default value + Xsqlite3ExprCodeFactorable(tls, pParse, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FpDflt, iRegStore) + goto __69 +__78: + ; +__76: + ; +__74: + ; +__72: + ; + if !(pColumn != 0) { + goto __79 + } + j = 0 +__81: + if !((j < (*IdList)(unsafe.Pointer(pColumn)).FnId) && ((*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(j)*16)).Fidx != i)) { + goto __83 + } + goto __82 +__82: + j++ + goto __81 + goto __83 +__83: + ; + if !(j >= (*IdList)(unsafe.Pointer(pColumn)).FnId) { + goto __84 + } + // A column not named in the insert column list gets its + // default value + Xsqlite3ExprCodeFactorable(tls, pParse, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FpDflt, iRegStore) + goto __69 +__84: + ; + k = j + goto __80 +__79: + if !(nColumn == 0) { + goto __85 + } + // This is INSERT INTO ... DEFAULT VALUES. Load the default value. + Xsqlite3ExprCodeFactorable(tls, pParse, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FpDflt, iRegStore) + goto __69 + goto __86 +__85: + k = (i - nHidden) +__86: + ; +__80: + ; + + if !(useTempTable != 0) { + goto __87 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, srcTab, k, iRegStore) + goto __88 +__87: + if !(pSelect != 0) { + goto __89 + } + if !(regFromSelect != regData) { + goto __91 + } + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, (regFromSelect + k), iRegStore) +__91: + ; + goto __90 +__89: + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(k)*32)).FpExpr, iRegStore) +__90: + ; +__88: + ; + goto __69 +__69: + i++ + iRegStore++ + goto __68 + goto __70 +__70: + ; + + // Run the BEFORE and INSTEAD OF triggers, if there are any + endOfLoop = Xsqlite3VdbeMakeLabel(tls, pParse) + if !((*(*int32)(unsafe.Pointer(bp + 72 /* tmask */)) & TRIGGER_BEFORE) != 0) { + goto __92 + } + regCols = Xsqlite3GetTempRange(tls, pParse, (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1)) + + // build the NEW.* reference row. Note that if there is an INTEGER + // PRIMARY KEY into which a NULL is being inserted, that NULL will be + // translated into a unique ID for the row. But on a BEFORE trigger, + // we do not know what the unique ID will be (because the insert has + // not happened yet) so we substitute a rowid of -1 + if !(ipkColumn < 0) { + goto __93 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, -1, regCols) + goto __94 +__93: + ; + if !(useTempTable != 0) { + goto __95 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, srcTab, ipkColumn, regCols) + goto __96 +__95: + ; // Otherwise useTempTable is true + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(ipkColumn)*32)).FpExpr, regCols) +__96: + ; + addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, regCols) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, -1, regCols) + Xsqlite3VdbeJumpHere(tls, v, addr1) + Xsqlite3VdbeAddOp1(tls, v, OP_MustBeInt, regCols) +__94: + ; + + // Copy the new data already generated. + + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, (regRowid + 1), (regCols + 1), (int32((*Table)(unsafe.Pointer(pTab)).FnNVCol) - 1)) + + // Compute the new value for generated columns after all other + // columns have already been computed. This must be done after + // computing the ROWID in case one of the generated columns + // refers to the ROWID. + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != 0) { + goto __97 + } + + Xsqlite3ComputeGeneratedColumns(tls, pParse, (regCols + 1), pTab) +__97: + ; + + // If this is an INSERT on a view with an INSTEAD OF INSERT trigger, + // do not attempt any conversions before assembling the record. + // If this is a real table, attempt conversions as required by the + // table column affinities. + if !(!(isView != 0)) { + goto __98 + } + Xsqlite3TableAffinity(tls, v, pTab, (regCols + 1)) +__98: + ; + + // Fire BEFORE or INSTEAD OF triggers + Xsqlite3CodeRowTrigger(tls, pParse, pTrigger, TK_INSERT, uintptr(0), TRIGGER_BEFORE, + pTab, ((regCols - int32((*Table)(unsafe.Pointer(pTab)).FnCol)) - 1), onError, endOfLoop) + + Xsqlite3ReleaseTempRange(tls, pParse, regCols, (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1)) +__92: + ; + + if !(!(isView != 0)) { + goto __99 + } + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __100 + } + // The row that the VUpdate opcode will delete: none + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIns) +__100: + ; + if !(ipkColumn >= 0) { + goto __101 + } + // Compute the new rowid + if !(useTempTable != 0) { + goto __103 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, srcTab, ipkColumn, regRowid) + goto __104 +__103: + if !(pSelect != 0) { + goto __105 + } + // Rowid already initialized at tag-20191021-001 + goto __106 +__105: + pIpk = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(ipkColumn)*32)).FpExpr + if !((int32((*Expr)(unsafe.Pointer(pIpk)).Fop) == TK_NULL) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) { + goto __107 + } + Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), regRowid, regAutoinc) + appendFlag = U8(1) + goto __108 +__107: + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(ipkColumn)*32)).FpExpr, regRowid) +__108: + ; +__106: + ; +__104: + ; + // If the PRIMARY KEY expression is NULL, then use OP_NewRowid + // to generate a unique primary key value. + if !(!(appendFlag != 0)) { + goto __109 + } + if !(!((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) { + goto __110 + } + addr11 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, regRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), regRowid, regAutoinc) + Xsqlite3VdbeJumpHere(tls, v, addr11) + goto __111 +__110: + addr11 = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, regRowid, (addr11 + 2)) +__111: + ; + Xsqlite3VdbeAddOp1(tls, v, OP_MustBeInt, regRowid) +__109: + ; + goto __102 +__101: + if !(((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) || (withoutRowid != 0)) { + goto __112 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regRowid) + goto __113 +__112: + Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), regRowid, regAutoinc) + appendFlag = U8(1) +__113: + ; +__102: + ; + autoIncStep(tls, pParse, regAutoinc, regRowid) + + // Compute the new value for generated columns after all other + // columns have already been computed. This must be done after + // computing the ROWID in case one of the generated columns + // is derived from the INTEGER PRIMARY KEY. + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != 0) { + goto __114 + } + Xsqlite3ComputeGeneratedColumns(tls, pParse, (regRowid + 1), pTab) +__114: + ; + + // Generate code to check constraints and generate index keys and + // do the insertion. + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __115 + } + pVTab = Xsqlite3GetVTable(tls, db, pTab) + Xsqlite3VtabMakeWritable(tls, pParse, pTab) + Xsqlite3VdbeAddOp4(tls, v, OP_VUpdate, 1, (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 2), regIns, pVTab, -12) + Xsqlite3VdbeChangeP5(tls, v, func() uint16 { + if onError == OE_Default { + return uint16(OE_Abort) + } + return uint16(onError) + }()) + Xsqlite3MayAbort(tls, pParse) + goto __116 +__115: + + *(*int32)(unsafe.Pointer(bp + 184 /* isReplace */)) = 0 // True to use OPFLAG_SEEKRESULT + Xsqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)), + regIns, 0, (uint8(libc.Bool32(ipkColumn >= 0))), uint8(onError), endOfLoop, bp+184 /* &isReplace */, uintptr(0), pUpsert) + Xsqlite3FkCheck(tls, pParse, pTab, 0, regIns, uintptr(0), 0) + + // Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE + // constraints or (b) there are no triggers and this table is not a + // parent table in a foreign key constraint. It is safe to set the + // flag in the second case as if any REPLACE constraint is hit, an + // OP_Delete or OP_IdxDelete instruction will be executed on each + // cursor that is disturbed. And these instructions both clear the + // VdbeCursor.seekResult variable, disabling the OPFLAG_USESEEKRESULT + // functionality. + bUseSeek = (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 184 /* isReplace */)) == 0) || !(Xsqlite3VdbeHasSubProgram(tls, v) != 0))) + Xsqlite3CompleteInsertion(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)), + regIns, aRegIdx, 0, int32(appendFlag), bUseSeek) +__116: + ; +__99: + ; + + // Update the count of rows that are inserted + if !(regRowCount != 0) { + goto __117 + } + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, regRowCount, 1) +__117: + ; + + if !(pTrigger != 0) { + goto __118 + } + // Code AFTER triggers + Xsqlite3CodeRowTrigger(tls, pParse, pTrigger, TK_INSERT, uintptr(0), TRIGGER_AFTER, + pTab, ((regData - 2) - int32((*Table)(unsafe.Pointer(pTab)).FnCol)), onError, endOfLoop) +__118: + ; + + // The bottom of the main insertion loop, if the data source + // is a SELECT statement. + Xsqlite3VdbeResolveLabel(tls, v, endOfLoop) + if !(useTempTable != 0) { + goto __119 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Next, srcTab, addrCont) + Xsqlite3VdbeJumpHere(tls, v, addrInsTop) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, srcTab) + goto __120 +__119: + if !(pSelect != 0) { + goto __121 + } + Xsqlite3VdbeGoto(tls, v, addrCont) + Xsqlite3VdbeJumpHere(tls, v, addrInsTop) +__121: + ; +__120: + ; + +insert_end: + // Update the sqlite_sequence table by storing the content of the + // maximum rowid counter values recorded while inserting into + // autoincrement tables. + if !((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && ((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab == uintptr(0))) { + goto __122 + } + Xsqlite3AutoincrementEnd(tls, pParse) +__122: + ; + + // Return the number of rows inserted. If this routine is + // generating code because of a call to sqlite3NestedParse(), do not + // invoke the callback function. + if !(regRowCount != 0) { + goto __123 + } + Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) + Xsqlite3VdbeSetNumCols(tls, v, 1) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14387 /* "rows inserted" */, uintptr(0)) +__123: + ; + +insert_cleanup: + Xsqlite3SrcListDelete(tls, db, pTabList) + Xsqlite3ExprListDelete(tls, db, pList) + Xsqlite3UpsertDelete(tls, db, pUpsert) + Xsqlite3SelectDelete(tls, db, pSelect) + Xsqlite3IdListDelete(tls, db, pColumn) + Xsqlite3DbFree(tls, db, aRegIdx) +} + +// Make sure "isView" and other macros defined above are undefined. Otherwise +// they may interfere with compilation of other functions in this file +// (or in another file, if this file becomes part of the amalgamation). + +// Meanings of bits in of pWalker->eCode for +// sqlite3ExprReferencesUpdatedColumn() + +// This is the Walker callback from sqlite3ExprReferencesUpdatedColumn(). +// Set bit 0x01 of pWalker->eCode if pWalker->eCode to 0 and if this +// expression node references any of the +// columns that are being modifed by an UPDATE statement. +func checkConstraintExprNode(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:124428:12: */ + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN { + + if int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) >= 0 { + if *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiColumn)*4)) >= 0 { + *(*U16)(unsafe.Pointer(pWalker + 36 /* &.eCode */)) |= U16((CKCNSTRNT_COLUMN)) + } + } else { + *(*U16)(unsafe.Pointer(pWalker + 36 /* &.eCode */)) |= U16((CKCNSTRNT_ROWID)) + } + } + return WRC_Continue +} + +// pExpr is a CHECK constraint on a row that is being UPDATE-ed. The +// only columns that are modified by the UPDATE are those for which +// aiChng[i]>=0, and also the ROWID is modified if chngRowid is true. +// +// Return true if CHECK constraint pExpr uses any of the +// changing columns (or the rowid if it is changing). In other words, +// return true if this CHECK constraint must be validated for +// the new row in the UPDATE statement. +// +// 2018-09-15: pExpr might also be an expression for an index-on-expressions. +// The operation of this routine is the same - return true if an only if +// the expression uses one or more of columns identified by the second and +// third arguments. +func Xsqlite3ExprReferencesUpdatedColumn(tls *libc.TLS, pExpr uintptr, aiChng uintptr, chngRowid int32) int32 { /* sqlite3.c:124457:20: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FeCode = U16(0) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{checkConstraintExprNode})) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = aiChng + Xsqlite3WalkExpr(tls, bp /* &w */, pExpr) + if !(chngRowid != 0) { + + *(*U16)(unsafe.Pointer(bp /* &w */ + 36 /* &.eCode */)) &= libc.Uint16FromInt32((libc.CplInt32(CKCNSTRNT_ROWID))) + } + + return (libc.Bool32(int32((*Walker)(unsafe.Pointer(bp /* &w */)).FeCode) != 0)) +} + +// The sqlite3GenerateConstraintChecks() routine usually wants to visit +// the indexes of a table in the order provided in the Table->pIndex list. +// However, sometimes (rarely - when there is an upsert) it wants to visit +// the indexes in a different order. The following data structures accomplish +// this. +// +// The IndexIterator object is used to walk through all of the indexes +// of a table in either Index.pNext order, or in some other order established +// by an array of IndexListTerm objects. +type IndexListTerm1 = struct { + Fp uintptr + Fix int32 + _ [4]byte +} /* sqlite3.c:124490:9 */ + +// The sqlite3GenerateConstraintChecks() routine usually wants to visit +// the indexes of a table in the order provided in the Table->pIndex list. +// However, sometimes (rarely - when there is an upsert) it wants to visit +// the indexes in a different order. The following data structures accomplish +// this. +// +// The IndexIterator object is used to walk through all of the indexes +// of a table in either Index.pNext order, or in some other order established +// by an array of IndexListTerm objects. +type IndexListTerm = IndexListTerm1 /* sqlite3.c:124490:30 */ +type IndexIterator1 = struct { + FeType int32 + Fi int32 + Fu struct { + Flx struct{ FpIdx uintptr } + _ [8]byte + } +} /* sqlite3.c:124491:9 */ + +type IndexIterator = IndexIterator1 /* sqlite3.c:124491:30 */ + +// Return the first index on the list +func indexIteratorFirst(tls *libc.TLS, pIter uintptr, pIx uintptr) uintptr { /* sqlite3.c:124515:14: */ + + if (*IndexIterator)(unsafe.Pointer(pIter)).FeType != 0 { + *(*int32)(unsafe.Pointer(pIx)) = (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pIter + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)))).Fix + return (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pIter + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)))).Fp + } else { + *(*int32)(unsafe.Pointer(pIx)) = 0 + return *(*uintptr)(unsafe.Pointer(pIter + 8 /* &.u */ /* &.lx */ /* &.pIdx */)) + } + return uintptr(0) +} + +// Return the next index from the list. Return NULL when out of indexes +func indexIteratorNext(tls *libc.TLS, pIter uintptr, pIx uintptr) uintptr { /* sqlite3.c:124527:14: */ + if (*IndexIterator)(unsafe.Pointer(pIter)).FeType != 0 { + var i int32 = libc.PreIncInt32(&(*IndexIterator)(unsafe.Pointer(pIter)).Fi, 1) + if i >= *(*int32)(unsafe.Pointer((pIter + 8 /* &.u */ /* &.ax */) /* &.nIdx */)) { + *(*int32)(unsafe.Pointer(pIx)) = i + return uintptr(0) + } + *(*int32)(unsafe.Pointer(pIx)) = (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pIter + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix + return (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pIter + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp + } else { + (*(*int32)(unsafe.Pointer(pIx)))++ + *(*uintptr)(unsafe.Pointer(pIter + 8 /* &.u */ /* &.lx */ /* &.pIdx */)) = (*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pIter + 8 /* &.u */ /* &.lx */ /* &.pIdx */)))).FpNext + return *(*uintptr)(unsafe.Pointer(pIter + 8 /* &.u */ /* &.lx */ /* &.pIdx */)) + } + return uintptr(0) +} + +// Generate code to do constraint checks prior to an INSERT or an UPDATE +// on table pTab. +// +// The regNewData parameter is the first register in a range that contains +// the data to be inserted or the data after the update. There will be +// pTab->nCol+1 registers in this range. The first register (the one +// that regNewData points to) will contain the new rowid, or NULL in the +// case of a WITHOUT ROWID table. The second register in the range will +// contain the content of the first table column. The third register will +// contain the content of the second table column. And so forth. +// +// The regOldData parameter is similar to regNewData except that it contains +// the data prior to an UPDATE rather than afterwards. regOldData is zero +// for an INSERT. This routine can distinguish between UPDATE and INSERT by +// checking regOldData for zero. +// +// For an UPDATE, the pkChng boolean is true if the true primary key (the +// rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table) +// might be modified by the UPDATE. If pkChng is false, then the key of +// the iDataCur content table is guaranteed to be unchanged by the UPDATE. +// +// For an INSERT, the pkChng boolean indicates whether or not the rowid +// was explicitly specified as part of the INSERT statement. If pkChng +// is zero, it means that the either rowid is computed automatically or +// that the table is a WITHOUT ROWID table and has no rowid. On an INSERT, +// pkChng will only be true if the INSERT statement provides an integer +// value for either the rowid column or its INTEGER PRIMARY KEY alias. +// +// The code generated by this routine will store new index entries into +// registers identified by aRegIdx[]. No index entry is created for +// indices where aRegIdx[i]==0. The order of indices in aRegIdx[] is +// the same as the order of indices on the linked list of indices +// at pTab->pIndex. +// +// (2019-05-07) The generated code also creates a new record for the +// main table, if pTab is a rowid table, and stores that record in the +// register identified by aRegIdx[nIdx] - in other words in the first +// entry of aRegIdx[] past the last index. It is important that the +// record be generated during constraint checks to avoid affinity changes +// to the register content that occur after constraint checks but before +// the new record is inserted. +// +// The caller must have already opened writeable cursors on the main +// table and all applicable indices (that is to say, all indices for which +// aRegIdx[] is not zero). iDataCur is the cursor for the main table when +// inserting or updating a rowid table, or the cursor for the PRIMARY KEY +// index when operating on a WITHOUT ROWID table. iIdxCur is the cursor +// for the first index in the pTab->pIndex list. Cursors for other indices +// are at iIdxCur+N for the N-th element of the pTab->pIndex list. +// +// This routine also generates code to check constraints. NOT NULL, +// CHECK, and UNIQUE constraints are all checked. If a constraint fails, +// then the appropriate action is performed. There are five possible +// actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE. +// +// Constraint type Action What Happens +// --------------- ---------- ---------------------------------------- +// any ROLLBACK The current transaction is rolled back and +// sqlite3_step() returns immediately with a +// return code of SQLITE_CONSTRAINT. +// +// any ABORT Back out changes from the current command +// only (do not do a complete rollback) then +// cause sqlite3_step() to return immediately +// with SQLITE_CONSTRAINT. +// +// any FAIL Sqlite3_step() returns immediately with a +// return code of SQLITE_CONSTRAINT. The +// transaction is not rolled back and any +// changes to prior rows are retained. +// +// any IGNORE The attempt in insert or update the current +// row is skipped, without throwing an error. +// Processing continues with the next row. +// (There is an immediate jump to ignoreDest.) +// +// NOT NULL REPLACE The NULL value is replace by the default +// value for that column. If the default value +// is NULL, the action is the same as ABORT. +// +// UNIQUE REPLACE The other row that conflicts with the row +// being inserted is removed. +// +// CHECK REPLACE Illegal. The results in an exception. +// +// Which action to take is determined by the overrideError parameter. +// Or if overrideError==OE_Default, then the pParse->onError parameter +// is used. Or if pParse->onError==OE_Default then the onError value +// for the constraint is used. +func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintptr, aRegIdx uintptr, iDataCur int32, iIdxCur int32, regNewData int32, regOldData int32, pkChng U8, overrideError U8, ignoreDest int32, pbMayReplace uintptr, aiChng uintptr, pUpsert uintptr) { /* sqlite3.c:124634:21: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var v uintptr // VDBE under constrution + var pIdx uintptr // Pointer to one of the indices + var pPk uintptr = uintptr(0) // The PRIMARY KEY index for WITHOUT ROWID tables + var db uintptr // Database connection + var i int32 // loop counter + // var ix int32 at bp+40, 4 + // Index loop counter + var nCol int32 // Number of columns + var onError int32 // Conflict resolution strategy + var seenReplace int32 = 0 // True if REPLACE is used to resolve INT PK conflict + var nPkField int32 // Number of fields in PRIMARY KEY. 1 for ROWID tables + var pUpsertClause uintptr = uintptr(0) // The specific ON CONFLICT clause for pIdx + var isUpdate U8 // True if this is an UPDATE operation + var bAffinityDone U8 = U8(0) // True if the OP_Affinity operation has been run + var upsertIpkReturn int32 = 0 // Address of Goto at end of IPK uniqueness check + var upsertIpkDelay int32 = 0 // Address of Goto to bypass initial IPK check + var ipkTop int32 = 0 // Top of the IPK uniqueness check + var ipkBottom int32 = 0 // OP_Goto at the end of the IPK uniqueness check + // Variables associated with retesting uniqueness constraints after + // replace triggers fire have run + var regTrigCnt int32 // Register used to count replace trigger invocations + var addrRecheck int32 = 0 // Jump here to recheck all uniqueness constraints + var lblRecheckOk int32 = 0 // Each recheck jumps to this label if it passes + var pTrigger uintptr // List of DELETE triggers on the table pTab + var nReplaceTrig int32 = 0 // Number of replace triggers coded + // var sIdxIter IndexIterator at bp+16, 24 + // Index iterator + + isUpdate = (U8(libc.Bool32(regOldData != 0))) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + // This table is not a VIEW + nCol = int32((*Table)(unsafe.Pointer(pTab)).FnCol) + + // pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for + // normal rowid tables. nPkField is the number of key fields in the + // pPk index or 1 for a rowid table. In other words, nPkField is the + // number of fields in the true primary key of the table. + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + pPk = uintptr(0) + nPkField = 1 + } else { + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + nPkField = int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + } + + // Record that this module has started + + // Test all NOT NULL constraints. + if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasNotNull)) != 0 { + var b2ndPass int32 = 0 // True if currently running 2nd pass + var nSeenReplace int32 = 0 // Number of ON CONFLICT REPLACE operations + var nGenerated int32 = 0 // Number of generated columns with NOT NULL + for 1 != 0 { // Make 2 passes over columns. Exit loop via "break" + for i = 0; i < nCol; i++ { + var iReg int32 // Register holding column value + var pCol uintptr = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32) // The column to check for NOT NULL + var isGenerated int32 // non-zero if column is generated + onError = int32((*Column)(unsafe.Pointer(pCol)).FnotNull) + if onError == OE_None { + continue + } // No NOT NULL on this column + if i == int32((*Table)(unsafe.Pointer(pTab)).FiPKey) { + continue // ROWID is never NULL + } + isGenerated = (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) + if (isGenerated != 0) && !(b2ndPass != 0) { + nGenerated++ + continue // Generated columns processed on 2nd pass + } + if ((aiChng != 0) && (*(*int32)(unsafe.Pointer(aiChng + uintptr(i)*4)) < 0)) && !(isGenerated != 0) { + // Do not check NOT NULL on columns that do not change + continue + } + if int32(overrideError) != OE_Default { + onError = int32(overrideError) + } else if onError == OE_Default { + onError = OE_Abort + } + if onError == OE_Replace { + if (b2ndPass != 0) || // REPLACE becomes ABORT on the 2nd pass + ((*Column)(unsafe.Pointer(pCol)).FpDflt == uintptr(0)) { + + onError = OE_Abort + } else { + + } + } else if (b2ndPass != 0) && !(isGenerated != 0) { + continue + } + + iReg = ((int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(i))) + regNewData) + 1) + switch onError { + case OE_Replace: + { + var addr1 int32 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, iReg) + + nSeenReplace++ + Xsqlite3ExprCodeCopy(tls, pParse, (*Column)(unsafe.Pointer(pCol)).FpDflt, iReg) + Xsqlite3VdbeJumpHere(tls, v, addr1) + break + + } + fallthrough + case OE_Abort: + Xsqlite3MayAbort(tls, pParse) + fallthrough + case OE_Rollback: + fallthrough + case OE_Fail: + { + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10786 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), + onError, iReg) + Xsqlite3VdbeAppendP4(tls, v, zMsg, -7) + Xsqlite3VdbeChangeP5(tls, v, uint16(P5_ConstraintNotNull)) + + break + + } + fallthrough + default: + { + + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, iReg, ignoreDest) + + break + + } + } // end switch(onError) + } // end loop i over columns + if (nGenerated == 0) && (nSeenReplace == 0) { + // If there are no generated columns with NOT NULL constraints + // and no NOT NULL ON CONFLICT REPLACE constraints, then a single + // pass is sufficient + break + } + if b2ndPass != 0 { + break + } // Never need more than 2 passes + b2ndPass = 1 + if (nSeenReplace > 0) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != U32(0)) { + // If any NOT NULL ON CONFLICT REPLACE constraints fired on the + // first pass, recomputed values for all generated columns, as + // those values might depend on columns affected by the REPLACE. + Xsqlite3ComputeGeneratedColumns(tls, pParse, (regNewData + 1), pTab) + } + } // end of 2-pass loop + } // end if( has-not-null-constraints ) + + // Test all CHECK constraints + if ((*Table)(unsafe.Pointer(pTab)).FpCheck != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_IgnoreChecks)) == uint64(0)) { + var pCheck uintptr = (*Table)(unsafe.Pointer(pTab)).FpCheck + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = -(regNewData + 1) + if int32(overrideError) != OE_Default { + onError = int32(overrideError) + } else { + onError = OE_Abort + } + for i = 0; i < (*ExprList)(unsafe.Pointer(pCheck)).FnExpr; i++ { + var allOk int32 + var pCopy uintptr + var pExpr uintptr = (*ExprList_item)(unsafe.Pointer((pCheck + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if (aiChng != 0) && + !(Xsqlite3ExprReferencesUpdatedColumn(tls, pExpr, aiChng, int32(pkChng)) != 0) { + // The check constraints do not reference any of the columns being + // updated so there is no point it verifying the check constraint + continue + } + if int32(bAffinityDone) == 0 { + Xsqlite3TableAffinity(tls, v, pTab, (regNewData + 1)) + bAffinityDone = U8(1) + } + allOk = Xsqlite3VdbeMakeLabel(tls, pParse) + + pCopy = Xsqlite3ExprDup(tls, db, pExpr, 0) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + Xsqlite3ExprIfTrue(tls, pParse, pCopy, allOk, SQLITE_JUMPIFNULL) + } + Xsqlite3ExprDelete(tls, db, pCopy) + if onError == OE_Ignore { + Xsqlite3VdbeGoto(tls, v, ignoreDest) + } else { + var zName uintptr = (*ExprList_item)(unsafe.Pointer((pCheck + 8 /* &.a */) + uintptr(i)*32)).FzEName + + if onError == OE_Replace { + onError = OE_Abort + } // IMP: R-26383-51744 + Xsqlite3HaltConstraint(tls, pParse, (SQLITE_CONSTRAINT | (int32(1) << 8)), + onError, zName, int8(P4_TRANSIENT), + uint8(P5_ConstraintCheck)) + } + Xsqlite3VdbeResolveLabel(tls, v, allOk) + } + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + } + + // UNIQUE and PRIMARY KEY constraints should be handled in the following + // order: + // + // (1) OE_Update + // (2) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore + // (3) OE_Replace + // + // OE_Fail and OE_Ignore must happen before any changes are made. + // OE_Update guarantees that only a single row will change, so it + // must happen before OE_Replace. Technically, OE_Abort and OE_Rollback + // could happen in any order, but they are grouped up front for + // convenience. + // + // 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43 + // The order of constraints used to have OE_Update as (2) and OE_Abort + // and so forth as (1). But apparently PostgreSQL checks the OE_Update + // constraint before any others, so it had to be moved. + // + // Constraint checking code is generated in this order: + // (A) The rowid constraint + // (B) Unique index constraints that do not have OE_Replace as their + // default conflict resolution strategy + // (C) Unique index that do use OE_Replace by default. + // + // The ordering of (2) and (3) is accomplished by making sure the linked + // list of indexes attached to a table puts all OE_Replace indexes last + // in the list. See sqlite3CreateIndex() for where that happens. + (*IndexIterator)(unsafe.Pointer(bp + 16 /* &sIdxIter */)).FeType = 0 + (*IndexIterator)(unsafe.Pointer(bp + 16 /* &sIdxIter */)).Fi = 0 + *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) = uintptr(0) // Silence harmless compiler warning + *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.lx */ /* &.pIdx */)) = (*Table)(unsafe.Pointer(pTab)).FpIndex + if pUpsert != 0 { + if (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget == uintptr(0) { + // There is just on ON CONFLICT clause and it has no constraint-target + + if int32((*Upsert)(unsafe.Pointer(pUpsert)).FisDoUpdate) == 0 { + // A single ON CONFLICT DO NOTHING clause, without a constraint-target. + // Make all unique constraint resolution be OE_Ignore + overrideError = U8(OE_Ignore) + pUpsert = uintptr(0) + } else { + // A single ON CONFLICT DO UPDATE. Make all resolutions OE_Update + overrideError = U8(OE_Update) + } + } else if (*Table)(unsafe.Pointer(pTab)).FpIndex != uintptr(0) { + // Otherwise, we'll need to run the IndexListTerm array version of the + // iterator to ensure that all of the ON CONFLICT conditions are + // checked first and in order. + var nIdx int32 + var jj int32 + var nByte U64 + var pTerm uintptr + var bUsed uintptr + nIdx = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex + __1: + if !(pIdx != 0) { + goto __3 + } + { + + } + goto __2 + __2: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + nIdx++ + goto __1 + goto __3 + __3: + ; + (*IndexIterator)(unsafe.Pointer(bp + 16 /* &sIdxIter */)).FeType = 1 + *(*int32)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ /* &.nIdx */)) = nIdx + nByte = (U64(((uint64(unsafe.Sizeof(IndexListTerm{})) + uint64(1)) * uint64(nIdx)) + uint64(nIdx))) + *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) = Xsqlite3DbMallocZero(tls, db, nByte) + if *(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) == uintptr(0) { + return + } // OOM + bUsed = (*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(nIdx)*16) + (*Upsert)(unsafe.Pointer(pUpsert)).FpToFree = *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) + i = 0 + pTerm = pUpsert + for ; pTerm != 0; pTerm = (*Upsert)(unsafe.Pointer(pTerm)).FpNextUpsert { + if (*Upsert)(unsafe.Pointer(pTerm)).FpUpsertTarget == uintptr(0) { + break + } + if (*Upsert)(unsafe.Pointer(pTerm)).FpUpsertIdx == uintptr(0) { + continue + } // Skip ON CONFLICT for the IPK + jj = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex + for (pIdx != uintptr(0)) && (pIdx != (*Upsert)(unsafe.Pointer(pTerm)).FpUpsertIdx) { + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + jj++ + } + if *(*U8)(unsafe.Pointer(bUsed + uintptr(jj))) != 0 { + continue + } // Duplicate ON CONFLICT clause ignored + *(*U8)(unsafe.Pointer(bUsed + uintptr(jj))) = U8(1) + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp = pIdx + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix = jj + i++ + } + jj = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex + __4: + if !(pIdx != 0) { + goto __6 + } + { + if *(*U8)(unsafe.Pointer(bUsed + uintptr(jj))) != 0 { + goto __5 + } + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp = pIdx + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix = jj + i++ + + } + goto __5 + __5: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + jj++ + goto __4 + goto __6 + __6: + } + } + + // Determine if it is possible that triggers (either explicitly coded + // triggers or FK resolution actions) might run as a result of deletes + // that happen when OE_Replace conflict resolution occurs. (Call these + // "replace triggers".) If any replace triggers run, we will need to + // recheck all of the uniqueness constraints after they have all run. + // But on the recheck, the resolution is OE_Abort instead of OE_Replace. + // + // If replace triggers are a possibility, then + // + // (1) Allocate register regTrigCnt and initialize it to zero. + // That register will count the number of replace triggers that + // fire. Constraint recheck only occurs if the number is positive. + // (2) Initialize pTrigger to the list of all DELETE triggers on pTab. + // (3) Initialize addrRecheck and lblRecheckOk + // + // The uniqueness rechecking code will create a series of tests to run + // in a second pass. The addrRecheck and lblRecheckOk variables are + // used to link together these tests which are separated from each other + // in the generate bytecode. + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & (uint64(SQLITE_RecTriggers | SQLITE_ForeignKeys))) == uint64(0) { + // There are not DELETE triggers nor FK constraints. No constraint + // rechecks are needed. + pTrigger = uintptr(0) + regTrigCnt = 0 + } else { + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_RecTriggers)) != 0 { + pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_DELETE, uintptr(0), uintptr(0)) + regTrigCnt = (libc.Bool32((pTrigger != uintptr(0)) || (Xsqlite3FkRequired(tls, pParse, pTab, uintptr(0), 0) != 0))) + } else { + pTrigger = uintptr(0) + regTrigCnt = Xsqlite3FkRequired(tls, pParse, pTab, uintptr(0), 0) + } + if regTrigCnt != 0 { + // Replace triggers might exist. Allocate the counter and + // initialize it to zero. + regTrigCnt = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regTrigCnt) + + lblRecheckOk = Xsqlite3VdbeMakeLabel(tls, pParse) + addrRecheck = lblRecheckOk + } + } + + // If rowid is changing, make sure the new rowid does not previously + // exist in the table. + if (pkChng != 0) && (pPk == uintptr(0)) { + var addrRowidOk int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + + // Figure out what action to take in case of a rowid collision + onError = int32((*Table)(unsafe.Pointer(pTab)).FkeyConf) + if int32(overrideError) != OE_Default { + onError = int32(overrideError) + } else if onError == OE_Default { + onError = OE_Abort + } + + // figure out whether or not upsert applies in this case + if pUpsert != 0 { + pUpsertClause = Xsqlite3UpsertOfIndex(tls, pUpsert, uintptr(0)) + if pUpsertClause != uintptr(0) { + if int32((*Upsert)(unsafe.Pointer(pUpsertClause)).FisDoUpdate) == 0 { + onError = OE_Ignore // DO NOTHING is the same as INSERT OR IGNORE + } else { + onError = OE_Update // DO UPDATE + } + } + if pUpsertClause != pUpsert { + // The first ON CONFLICT clause has a conflict target other than + // the IPK. We have to jump ahead to that first ON CONFLICT clause + // and then come back here and deal with the IPK afterwards + upsertIpkDelay = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + } + } + + // If the response to a rowid conflict is REPLACE but the response + // to some other UNIQUE constraint is FAIL or IGNORE, then we need + // to defer the running of the rowid conflict checking until after + // the UNIQUE constraints have run. + if ((onError == OE_Replace) && // IPK rule is REPLACE + (onError != int32(overrideError))) && // Rules for other constraints are different + ((*Table)(unsafe.Pointer(pTab)).FpIndex != 0) { + ipkTop = (Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + 1) + + } + + if isUpdate != 0 { + // pkChng!=0 does not mean that the rowid has changed, only that + // it might have changed. Skip the conflict logic below if the rowid + // is unchanged. + Xsqlite3VdbeAddOp3(tls, v, OP_Eq, regNewData, addrRowidOk, regOldData) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + + } + + // Check to see if the new rowid already exists in the table. Skip + // the following conflict logic if it does not. + + Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iDataCur, addrRowidOk, regNewData) + + switch onError { + default: + { + onError = OE_Abort + + } + fallthrough + case OE_Rollback: + fallthrough + case OE_Abort: + fallthrough + case OE_Fail: + { + + Xsqlite3RowidConstraint(tls, pParse, onError, pTab) + break + + } + fallthrough + case OE_Replace: + { + // If there are DELETE triggers on this table and the + // recursive-triggers flag is set, call GenerateRowDelete() to + // remove the conflicting row from the table. This will fire + // the triggers and remove both the table and index b-tree entries. + // + // Otherwise, if there are no triggers or the recursive-triggers + // flag is not set, but the table has one or more indexes, call + // GenerateRowIndexDelete(). This removes the index b-tree entries + // only. The table b-tree entry will be replaced by the new entry + // when it is inserted. + // + // If either GenerateRowDelete() or GenerateRowIndexDelete() is called, + // also invoke MultiWrite() to indicate that this VDBE may require + // statement rollback (if the statement is aborted after the delete + // takes place). Earlier versions called sqlite3MultiWrite() regardless, + // but being more selective here allows statements like: + // + // REPLACE INTO t(rowid) VALUES($newrowid) + // + // to run without a statement journal if there are no indexes on the + // table. + if regTrigCnt != 0 { + Xsqlite3MultiWrite(tls, pParse) + Xsqlite3GenerateRowDelete(tls, pParse, pTab, pTrigger, iDataCur, iIdxCur, + regNewData, int16(1), uint8(0), uint8(OE_Replace), uint8(1), -1) + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, regTrigCnt, 1) // incr trigger cnt + nReplaceTrig++ + } else { + + // This OP_Delete opcode fires the pre-update-hook only. It does + // not modify the b-tree. It is more efficient to let the coming + // OP_Insert replace the existing entry than it is to delete the + // existing entry and then insert a new one. + Xsqlite3VdbeAddOp2(tls, v, OP_Delete, iDataCur, OPFLAG_ISNOOP) + Xsqlite3VdbeAppendP4(tls, v, pTab, -6) + if (*Table)(unsafe.Pointer(pTab)).FpIndex != 0 { + Xsqlite3MultiWrite(tls, pParse) + Xsqlite3GenerateRowIndexDelete(tls, pParse, pTab, iDataCur, iIdxCur, uintptr(0), -1) + } + } + seenReplace = 1 + break + + } + fallthrough + case OE_Update: + { + Xsqlite3UpsertDoUpdate(tls, pParse, pUpsert, pTab, uintptr(0), iDataCur) + + } + fallthrough + case OE_Ignore: + { + + Xsqlite3VdbeGoto(tls, v, ignoreDest) + break + + } + } + Xsqlite3VdbeResolveLabel(tls, v, addrRowidOk) + if (pUpsert != 0) && (pUpsertClause != pUpsert) { + upsertIpkReturn = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + } else if ipkTop != 0 { + ipkBottom = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + Xsqlite3VdbeJumpHere(tls, v, (ipkTop - 1)) + } + } + + // Test all UNIQUE constraints by creating entries for each UNIQUE + // index and making sure that duplicate entries do not already exist. + // Compute the revised record entries for indices as we go. + // + // This loop also handles the case of the PRIMARY KEY index for a + // WITHOUT ROWID table. + for pIdx = indexIteratorFirst(tls, bp+16 /* &sIdxIter */, bp+40 /* &ix */); pIdx != 0; pIdx = indexIteratorNext(tls, bp+16 /* &sIdxIter */, bp+40 /* &ix */) { + var regIdx int32 // Range of registers hold conent for pIdx + var regR int32 // Range of registers holding conflicting PK + var iThisCur int32 // Cursor for this UNIQUE index + var addrUniqueOk int32 // Jump here if the UNIQUE constraint is satisfied + var addrConflictCk int32 // First opcode in the conflict check logic + + if *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4)) == 0 { + continue + } // Skip indices that do not change + if pUpsert != 0 { + pUpsertClause = Xsqlite3UpsertOfIndex(tls, pUpsert, pIdx) + if (upsertIpkDelay != 0) && (pUpsertClause == pUpsert) { + Xsqlite3VdbeJumpHere(tls, v, upsertIpkDelay) + } + } + addrUniqueOk = Xsqlite3VdbeMakeLabel(tls, pParse) + if int32(bAffinityDone) == 0 { + Xsqlite3TableAffinity(tls, v, pTab, (regNewData + 1)) + bAffinityDone = U8(1) + } + + iThisCur = (iIdxCur + *(*int32)(unsafe.Pointer(bp + 40 /* ix */))) + + // Skip partial indices for which the WHERE clause is not true + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4))) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = -(regNewData + 1) + Xsqlite3ExprIfFalseDup(tls, pParse, (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere, addrUniqueOk, + SQLITE_JUMPIFNULL) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + } + + // Create a record for this index entry as it should appear after + // the insert or update. Store that record in the aRegIdx[ix] register + regIdx = (*(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4)) + 1) + for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn); i++ { + var iField int32 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + var x int32 + if iField == (-2) { + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = -(regNewData + 1) + Xsqlite3ExprCodeCopy(tls, pParse, (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr+8 /* &.a */)+uintptr(i)*32)).FpExpr, (regIdx + i)) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + + } else if (iField == (-1)) || (iField == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + x = regNewData + Xsqlite3VdbeAddOp2(tls, v, OP_IntCopy, x, (regIdx + i)) + + } else { + + x = ((int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(iField))) + regNewData) + 1) + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, x, (regIdx + i)) + + } + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regIdx, int32((*Index)(unsafe.Pointer(pIdx)).FnColumn), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4))) + + // In an UPDATE operation, if this index is the PRIMARY KEY index + // of a WITHOUT ROWID table and there has been no change the + // primary key, then no collision is possible. The collision detection + // logic below can all be skipped. + if ((isUpdate != 0) && (pPk == pIdx)) && (int32(pkChng) == 0) { + Xsqlite3VdbeResolveLabel(tls, v, addrUniqueOk) + continue + } + + // Find out what action to take in case there is a uniqueness conflict + onError = int32((*Index)(unsafe.Pointer(pIdx)).FonError) + if onError == OE_None { + Xsqlite3VdbeResolveLabel(tls, v, addrUniqueOk) + continue // pIdx is not a UNIQUE index + } + if int32(overrideError) != OE_Default { + onError = int32(overrideError) + } else if onError == OE_Default { + onError = OE_Abort + } + + // Figure out if the upsert clause applies to this index + if pUpsertClause != 0 { + if int32((*Upsert)(unsafe.Pointer(pUpsertClause)).FisDoUpdate) == 0 { + onError = OE_Ignore // DO NOTHING is the same as INSERT OR IGNORE + } else { + onError = OE_Update // DO UPDATE + } + } + + // Collision detection may be omitted if all of the following are true: + // (1) The conflict resolution algorithm is REPLACE + // (2) The table is a WITHOUT ROWID table + // (3) There are no secondary indexes on the table + // (4) No delete triggers need to be fired if there is a conflict + // (5) No FK constraint counters need to be updated if a conflict occurs. + // + // This is not possible for ENABLE_PREUPDATE_HOOK builds, as the row + // must be explicitly deleted in order to ensure any pre-update hook + // is invoked. + + // Check to see if the new index entry will be unique + + addrConflictCk = Xsqlite3VdbeAddOp4Int(tls, v, OP_NoConflict, iThisCur, addrUniqueOk, + regIdx, int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)) + + // Generate code to handle collisions + if pIdx == pPk { + regR = regIdx + } else { + regR = Xsqlite3GetTempRange(tls, pParse, nPkField) + } + if (isUpdate != 0) || (onError == OE_Replace) { + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + Xsqlite3VdbeAddOp2(tls, v, OP_IdxRowid, iThisCur, regR) + // Conflict only if the rowid of the existing index entry + // is different from old-rowid + if isUpdate != 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_Eq, regR, addrUniqueOk, regOldData) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + + } + } else { + var x int32 + // Extract the PRIMARY KEY from the end of the index entry and + // store it in registers regR..regR+nPk-1 + if pIdx != pPk { + for i = 0; i < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol); i++ { + + x = int32(Xsqlite3TableColumnToIndex(tls, pIdx, *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)))) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iThisCur, x, (regR + i)) + + } + } + if isUpdate != 0 { + // If currently processing the PRIMARY KEY of a WITHOUT ROWID + // table, only conflict if the new PRIMARY KEY values are actually + // different from the old. + // + // For a UNIQUE index, only conflict if the PRIMARY KEY values + // of the matched index row are different from the original PRIMARY + // KEY values of this row before the update. + var addrJump int32 = (Xsqlite3VdbeCurrentAddr(tls, v) + int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + var op int32 = OP_Ne + var regCmp int32 = func() int32 { + if (int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY { + return regIdx + } + return regR + }() + + for i = 0; i < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol); i++ { + var p4 uintptr = Xsqlite3LocateCollSeq(tls, pParse, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FazColl + uintptr(i)*8))) + x = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))) + + if i == (int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) - 1) { + addrJump = addrUniqueOk + op = OP_Eq + } + x = int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(x))) + Xsqlite3VdbeAddOp4(tls, v, op, + ((regOldData + 1) + x), addrJump, (regCmp + i), p4, -2) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + + } + } + } + } + + // Generate code that executes if the new index entry is not unique + + switch onError { + case OE_Rollback: + fallthrough + case OE_Abort: + fallthrough + case OE_Fail: + { + + Xsqlite3UniqueConstraint(tls, pParse, onError, pIdx) + break + + } + case OE_Update: + { + Xsqlite3UpsertDoUpdate(tls, pParse, pUpsert, pTab, pIdx, (iIdxCur + *(*int32)(unsafe.Pointer(bp + 40 /* ix */)))) + + } + fallthrough + case OE_Ignore: + { + + Xsqlite3VdbeGoto(tls, v, ignoreDest) + break + + } + default: + { + var nConflictCk int32 // Number of opcodes in conflict check logic + + nConflictCk = (Xsqlite3VdbeCurrentAddr(tls, v) - addrConflictCk) + + if regTrigCnt != 0 { + Xsqlite3MultiWrite(tls, pParse) + nReplaceTrig++ + } + if (pTrigger != 0) && (isUpdate != 0) { + Xsqlite3VdbeAddOp1(tls, v, OP_CursorLock, iDataCur) + } + Xsqlite3GenerateRowDelete(tls, pParse, pTab, pTrigger, iDataCur, iIdxCur, + regR, int16(nPkField), uint8(0), uint8(OE_Replace), + func() uint8 { + if pIdx == pPk { + return uint8(ONEPASS_SINGLE) + } + return uint8(ONEPASS_OFF) + }(), iThisCur) + if (pTrigger != 0) && (isUpdate != 0) { + Xsqlite3VdbeAddOp1(tls, v, OP_CursorUnlock, iDataCur) + } + if regTrigCnt != 0 { + var addrBypass int32 // Jump destination to bypass recheck logic + + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, regTrigCnt, 1) // incr trigger cnt + addrBypass = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) // Bypass recheck + + // Here we insert code that will be invoked after all constraint + // checks have run, if and only if one or more replace triggers + // fired. + Xsqlite3VdbeResolveLabel(tls, v, lblRecheckOk) + lblRecheckOk = Xsqlite3VdbeMakeLabel(tls, pParse) + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + // Bypass the recheck if this partial index is not defined + // for the current row + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (regIdx - 1), lblRecheckOk) + + } + // Copy the constraint check code from above, except change + // the constraint-ok jump destination to be the address of + // the next retest block + for nConflictCk > 0 { + // var x VdbeOp at bp+48, 24 + // Conflict check opcode to copy + // The sqlite3VdbeAddOp4() call might reallocate the opcode array. + // Hence, make a complete copy of the opcode, rather than using + // a pointer to the opcode. + *(*VdbeOp)(unsafe.Pointer(bp + 48 /* x */)) = *(*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, addrConflictCk))) + if int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fopcode) != OP_IdxRowid { + var p2 int32 // New P2 value for copied conflict check opcode + var zP4 uintptr + if (int32(Xsqlite3OpcodeProperty[(*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fopcode]) & OPFLG_JUMP) != 0 { + p2 = lblRecheckOk + } else { + p2 = (*VdbeOp)(unsafe.Pointer(bp + 48 /* &x */)).Fp2 + } + if int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp4type) == (-3) { + zP4 = uintptr(int64(*(*int32)(unsafe.Pointer(bp + 48 /* &x */ + 16 /* &.p4 */)))) + } else { + zP4 = *(*uintptr)(unsafe.Pointer(bp + 48 /* &x */ + 16 /* &.p4 */)) + } + Xsqlite3VdbeAddOp4(tls, v, int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fopcode), (*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp1, p2, (*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp3, zP4, int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp4type)) + Xsqlite3VdbeChangeP5(tls, v, (*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp5) + + } + nConflictCk-- + addrConflictCk++ + } + // If the retest fails, issue an abort + Xsqlite3UniqueConstraint(tls, pParse, OE_Abort, pIdx) + + Xsqlite3VdbeJumpHere(tls, v, addrBypass) // Terminate the recheck bypass + } + seenReplace = 1 + break + + } + } + Xsqlite3VdbeResolveLabel(tls, v, addrUniqueOk) + if regR != regIdx { + Xsqlite3ReleaseTempRange(tls, pParse, regR, nPkField) + } + if ((pUpsertClause != 0) && + (upsertIpkReturn != 0)) && + (Xsqlite3UpsertNextIsIPK(tls, pUpsertClause) != 0) { + Xsqlite3VdbeGoto(tls, v, (upsertIpkDelay + 1)) + Xsqlite3VdbeJumpHere(tls, v, upsertIpkReturn) + upsertIpkReturn = 0 + } + } + + // If the IPK constraint is a REPLACE, run it last + if ipkTop != 0 { + Xsqlite3VdbeGoto(tls, v, ipkTop) + + Xsqlite3VdbeJumpHere(tls, v, ipkBottom) + } + + // Recheck all uniqueness constraints after replace triggers have run + + if nReplaceTrig != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_IfNot, regTrigCnt, lblRecheckOk) + + if !(pPk != 0) { + if isUpdate != 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_Eq, regNewData, addrRecheck, regOldData) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + + } + Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iDataCur, addrRecheck, regNewData) + + Xsqlite3RowidConstraint(tls, pParse, OE_Abort, pTab) + } else { + Xsqlite3VdbeGoto(tls, v, addrRecheck) + } + Xsqlite3VdbeResolveLabel(tls, v, lblRecheckOk) + } + + // Generate the table record + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + var regRec int32 = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4)) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (regNewData + 1), int32((*Table)(unsafe.Pointer(pTab)).FnNVCol), regRec) + + if !(bAffinityDone != 0) { + Xsqlite3TableAffinity(tls, v, pTab, 0) + } + } + + *(*int32)(unsafe.Pointer(pbMayReplace)) = seenReplace + +} + +// Table pTab is a WITHOUT ROWID table that is being written to. The cursor +// number is iCur, and register regData contains the new record for the +// PK index. This function adds code to invoke the pre-update hook, +// if one is registered. +func codeWithoutRowidPreupdate(tls *libc.TLS, pParse uintptr, pTab uintptr, iCur int32, regData int32) { /* sqlite3.c:125487:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var r int32 = Xsqlite3GetTempReg(tls, pParse) + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, r) + Xsqlite3VdbeAddOp4(tls, v, OP_Insert, iCur, regData, r, pTab, -6) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_ISNOOP)) + Xsqlite3ReleaseTempReg(tls, pParse, r) +} + +// This routine generates code to finish the INSERT or UPDATE operation +// that was started by a prior call to sqlite3GenerateConstraintChecks. +// A consecutive range of registers starting at regNewData contains the +// rowid and the content to be inserted. +// +// The arguments to this routine should be the same as the first six +// arguments to sqlite3GenerateConstraintChecks. +func Xsqlite3CompleteInsertion(tls *libc.TLS, pParse uintptr, pTab uintptr, iDataCur int32, iIdxCur int32, regNewData int32, aRegIdx uintptr, update_flags int32, appendBias int32, useSeekResult int32) { /* sqlite3.c:125515:21: */ + var v uintptr // Prepared statements under construction + var pIdx uintptr // An index being inserted or updated + var pik_flags U8 // flag values passed to the btree insert + var i int32 // Loop counter + + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + // This table is not a VIEW + i = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__1: + if !(pIdx != 0) { + goto __3 + } + { + // All REPLACE indexes are at the end of the list + + if *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) == 0 { + goto __2 + } + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)), (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + + } + pik_flags = func() uint8 { + if useSeekResult != 0 { + return uint8(OPFLAG_USESEEKRESULT) + } + return uint8(0) + }() + if ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + + pik_flags = U8(int32(pik_flags) | (OPFLAG_NCHANGE)) + pik_flags = U8(int32(pik_flags) | (update_flags & OPFLAG_SAVEPOSITION)) + if update_flags == 0 { + codeWithoutRowidPreupdate(tls, pParse, pTab, (iIdxCur + i), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4))) + } + } + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, (iIdxCur + i), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)), + (*(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)) + 1), + func() int32 { + if (uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0 { + return int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + } + return int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + }()) + Xsqlite3VdbeChangeP5(tls, v, uint16(pik_flags)) + + } + goto __2 +__2: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + i++ + goto __1 + goto __3 +__3: + ; + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + return + } + if (*Parse)(unsafe.Pointer(pParse)).Fnested != 0 { + pik_flags = U8(0) + } else { + pik_flags = U8(OPFLAG_NCHANGE) + pik_flags = U8(int32(pik_flags) | (func() int32 { + if update_flags != 0 { + return update_flags + } + return OPFLAG_LASTROWID + }())) + } + if appendBias != 0 { + pik_flags = U8(int32(pik_flags) | (OPFLAG_APPEND)) + } + if useSeekResult != 0 { + pik_flags = U8(int32(pik_flags) | (OPFLAG_USESEEKRESULT)) + } + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iDataCur, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(i)*4)), regNewData) + if !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0) { + Xsqlite3VdbeAppendP4(tls, v, pTab, -6) + } + Xsqlite3VdbeChangeP5(tls, v, uint16(pik_flags)) +} + +// Allocate cursors for the pTab table and all its indices and generate +// code to open and initialized those cursors. +// +// The cursor for the object that contains the complete data (normally +// the table itself, but the PRIMARY KEY index in the case of a WITHOUT +// ROWID table) is returned in *piDataCur. The first index cursor is +// returned in *piIdxCur. The number of indices is returned. +// +// Use iBase as the first cursor (either the *piDataCur for rowid tables +// or the first index for WITHOUT ROWID tables) if it is non-negative. +// If iBase is negative, then allocate the next available cursor. +// +// For a rowid table, *piDataCur will be exactly one less than *piIdxCur. +// For a WITHOUT ROWID table, *piDataCur will be somewhere in the range +// of *piIdxCurs, depending on where the PRIMARY KEY index appears on the +// pTab->pIndex list. +// +// If pTab is a virtual table, then this routine is a no-op and the +// *piDataCur and *piIdxCur values are left uninitialized. +func Xsqlite3OpenTableAndIndices(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, p5 U8, iBase int32, aToOpen uintptr, piDataCur uintptr, piIdxCur uintptr) int32 { /* sqlite3.c:125604:20: */ + var i int32 + var iDb int32 + var iDataCur int32 + var pIdx uintptr + var v uintptr + + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + // This routine is a no-op for virtual tables. Leave the output + // variables *piDataCur and *piIdxCur uninitialized so that valgrind + // can detect if they are used by mistake in the caller. + return 0 + } + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + if iBase < 0 { + iBase = (*Parse)(unsafe.Pointer(pParse)).FnTab + } + iDataCur = libc.PostIncInt32(&iBase, 1) + if piDataCur != 0 { + *(*int32)(unsafe.Pointer(piDataCur)) = iDataCur + } + if (((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((aToOpen == uintptr(0)) || (*(*U8)(unsafe.Pointer(aToOpen)) != 0)) { + Xsqlite3OpenTable(tls, pParse, iDataCur, iDb, pTab, op) + } else { + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, (uint8(libc.Bool32(op == OP_OpenWrite))), (*Table)(unsafe.Pointer(pTab)).FzName) + } + if piIdxCur != 0 { + *(*int32)(unsafe.Pointer(piIdxCur)) = iBase + } + i = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__1: + if !(pIdx != 0) { + goto __3 + } + { + var iIdxCur int32 = libc.PostIncInt32(&iBase, 1) + + if ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + if piDataCur != 0 { + *(*int32)(unsafe.Pointer(piDataCur)) = iIdxCur + } + p5 = U8(0) + } + if (aToOpen == uintptr(0)) || (*(*U8)(unsafe.Pointer(aToOpen + uintptr((i + 1)))) != 0) { + Xsqlite3VdbeAddOp3(tls, v, op, iIdxCur, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + Xsqlite3VdbeChangeP5(tls, v, uint16(p5)) + + } + + } + goto __2 +__2: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + i++ + goto __1 + goto __3 +__3: + ; + if iBase > (*Parse)(unsafe.Pointer(pParse)).FnTab { + (*Parse)(unsafe.Pointer(pParse)).FnTab = iBase + } + return i +} + +// Check to see if index pSrc is compatible as a source of data +// for index pDest in an insert transfer optimization. The rules +// for a compatible index: +// +// * The index is over the same set of columns +// * The same DESC and ASC markings occurs on all columns +// * The same onError processing (OE_Abort, OE_Ignore, etc) +// * The same collating sequence on each column +// * The index has the exact same WHERE clause +func xferCompatibleIndex(tls *libc.TLS, pDest uintptr, pSrc uintptr) int32 { /* sqlite3.c:125682:12: */ + var i int32 + + if (int32((*Index)(unsafe.Pointer(pDest)).FnKeyCol) != int32((*Index)(unsafe.Pointer(pSrc)).FnKeyCol)) || (int32((*Index)(unsafe.Pointer(pDest)).FnColumn) != int32((*Index)(unsafe.Pointer(pSrc)).FnColumn)) { + return 0 // Different number of columns + } + if int32((*Index)(unsafe.Pointer(pDest)).FonError) != int32((*Index)(unsafe.Pointer(pSrc)).FonError) { + return 0 // Different conflict resolution strategies + } + for i = 0; i < int32((*Index)(unsafe.Pointer(pSrc)).FnKeyCol); i++ { + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pSrc)).FaiColumn + uintptr(i)*2))) != int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pDest)).FaiColumn + uintptr(i)*2))) { + return 0 // Different columns indexed + } + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pSrc)).FaiColumn + uintptr(i)*2))) == (-2) { + + if Xsqlite3ExprCompare(tls, uintptr(0), (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pSrc)).FaColExpr+8 /* &.a */)+uintptr(i)*32)).FpExpr, + (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pDest)).FaColExpr+8 /* &.a */)+uintptr(i)*32)).FpExpr, -1) != 0 { + return 0 // Different expressions in the index + } + } + if int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pSrc)).FaSortOrder + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pDest)).FaSortOrder + uintptr(i)))) { + return 0 // Different sort orders + } + if Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pSrc)).FazColl + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pDest)).FazColl + uintptr(i)*8))) != 0 { + return 0 // Different collating sequences + } + } + if Xsqlite3ExprCompare(tls, uintptr(0), (*Index)(unsafe.Pointer(pSrc)).FpPartIdxWhere, (*Index)(unsafe.Pointer(pDest)).FpPartIdxWhere, -1) != 0 { + return 0 // Different WHERE clauses + } + + // If no test above fails then the indices must be compatible + return 1 +} + +// Attempt the transfer optimization on INSERTs of the form +// +// INSERT INTO tab1 SELECT * FROM tab2; +// +// The xfer optimization transfers raw records from tab2 over to tab1. +// Columns are not decoded and reassembled, which greatly improves +// performance. Raw index records are transferred in the same way. +// +// The xfer optimization is only attempted if tab1 and tab2 are compatible. +// There are lots of rules for determining compatibility - see comments +// embedded in the code for details. +// +// This routine returns TRUE if the optimization is guaranteed to be used. +// Sometimes the xfer optimization will only work if the destination table +// is empty - a factor that can only be determined at run-time. In that +// case, this routine generates code for the xfer optimization but also +// does a test to see if the destination table is empty and jumps over the +// xfer optimization code if the test fails. In that case, this routine +// returns FALSE so that the caller will know to go ahead and generate +// an unoptimized transfer. This routine also returns FALSE if there +// is no chance that the xfer optimization can be applied. +// +// This optimization is particularly useful at making VACUUM run faster. +func xferOptimization(tls *libc.TLS, pParse uintptr, pDest uintptr, pSelect uintptr, onError int32, iDbDest int32) int32 { /* sqlite3.c:125743:12: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pEList uintptr // The result set of the SELECT + var pSrc uintptr // The table in the FROM clause of SELECT + var pSrcIdx uintptr + var pDestIdx uintptr // Source and destination indices + var pItem uintptr // An element of pSelect->pSrc + var i int32 // Loop counter + var iDbSrc int32 // The database of pSrc + var iSrc int32 + var iDest int32 // Cursors from source and destination + var addr1 int32 + var addr2 int32 // Loop addresses + var emptyDestTest int32 = 0 // Address of test for empty pDest + var emptySrcTest int32 = 0 // Address of test for empty pSrc + var v uintptr // The VDBE we are building + var regAutoinc int32 // Memory register used by AUTOINC + var destHasUniqueIdx int32 = 0 // True if pDest has a UNIQUE index + var regData int32 + var regRowid int32 // Registers holding data and rowid + + if pSelect == uintptr(0) { + return 0 // Must be of the form INSERT INTO ... SELECT ... + } + if ((*Parse)(unsafe.Pointer(pParse)).FpWith != 0) || ((*Select)(unsafe.Pointer(pSelect)).FpWith != 0) { + // Do not attempt to process this query if there are an WITH clauses + // attached to it. Proceeding may generate a false "no such table: xxx" + // error if pSelect reads from a CTE named "xxx". + return 0 + } + if Xsqlite3TriggerList(tls, pParse, pDest) != 0 { + return 0 // tab1 must not have triggers + } + if (*Table)(unsafe.Pointer(pDest)).FnModuleArg != 0 { + return 0 // tab1 must not be a virtual table + } + if onError == OE_Default { + if int32((*Table)(unsafe.Pointer(pDest)).FiPKey) >= 0 { + onError = int32((*Table)(unsafe.Pointer(pDest)).FkeyConf) + } + if onError == OE_Default { + onError = OE_Abort + } + } + // allocated even if there is no FROM clause + if (*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSelect)).FpSrc)).FnSrc != 1 { + return 0 // FROM clause must have exactly one term + } + if (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSelect)).FpSrc + 8 /* &.a */))).FpSelect != 0 { + return 0 // FROM clause cannot contain a subquery + } + if (*Select)(unsafe.Pointer(pSelect)).FpWhere != 0 { + return 0 // SELECT may not have a WHERE clause + } + if (*Select)(unsafe.Pointer(pSelect)).FpOrderBy != 0 { + return 0 // SELECT may not have an ORDER BY clause + } + // Do not need to test for a HAVING clause. If HAVING is present but + // there is no ORDER BY, we will get an error. + if (*Select)(unsafe.Pointer(pSelect)).FpGroupBy != 0 { + return 0 // SELECT may not have a GROUP BY clause + } + if (*Select)(unsafe.Pointer(pSelect)).FpLimit != 0 { + return 0 // SELECT may not have a LIMIT clause + } + if (*Select)(unsafe.Pointer(pSelect)).FpPrior != 0 { + return 0 // SELECT may not be a compound query + } + if ((*Select)(unsafe.Pointer(pSelect)).FselFlags & U32(SF_Distinct)) != 0 { + return 0 // SELECT may not be DISTINCT + } + pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList + + if (*ExprList)(unsafe.Pointer(pEList)).FnExpr != 1 { + return 0 // The result set must have exactly one column + } + + if int32((*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */))).FpExpr)).Fop) != TK_ASTERISK { + return 0 // The result set must be the special operator "*" + } + + // At this point we have established that the statement is of the + // correct syntactic form to participate in this optimization. Now + // we have to check the semantics. + pItem = (*Select)(unsafe.Pointer(pSelect)).FpSrc + 8 /* &.a */ + pSrc = Xsqlite3LocateTableItem(tls, pParse, uint32(0), pItem) + if pSrc == uintptr(0) { + return 0 // FROM clause does not contain a real table + } + if ((*Table)(unsafe.Pointer(pSrc)).Ftnum == (*Table)(unsafe.Pointer(pDest)).Ftnum) && ((*Table)(unsafe.Pointer(pSrc)).FpSchema == (*Table)(unsafe.Pointer(pDest)).FpSchema) { + // Possible due to bad sqlite_schema.rootpage + return 0 // tab1 and tab2 may not be the same table + } + if (libc.Bool32(((*Table)(unsafe.Pointer((pDest))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) != (libc.Bool32(((*Table)(unsafe.Pointer((pSrc))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + return 0 // source and destination must both be WITHOUT ROWID or not + } + if (*Table)(unsafe.Pointer(pSrc)).FnModuleArg != 0 { + return 0 // tab2 must not be a virtual table + } + if (*Table)(unsafe.Pointer(pSrc)).FpSelect != 0 { + return 0 // tab2 may not be a view + } + if int32((*Table)(unsafe.Pointer(pDest)).FnCol) != int32((*Table)(unsafe.Pointer(pSrc)).FnCol) { + return 0 // Number of columns must be the same in tab1 and tab2 + } + if int32((*Table)(unsafe.Pointer(pDest)).FiPKey) != int32((*Table)(unsafe.Pointer(pSrc)).FiPKey) { + return 0 // Both tables must have the same INTEGER PRIMARY KEY + } + for i = 0; i < int32((*Table)(unsafe.Pointer(pDest)).FnCol); i++ { + var pDestCol uintptr = ((*Table)(unsafe.Pointer(pDest)).FaCol + uintptr(i)*32) + var pSrcCol uintptr = ((*Table)(unsafe.Pointer(pSrc)).FaCol + uintptr(i)*32) + // Even if tables t1 and t2 have identical schemas, if they contain + // generated columns, then this statement is semantically incorrect: + // + // INSERT INTO t2 SELECT * FROM t1; + // + // The reason is that generated column values are returned by the + // the SELECT statement on the right but the INSERT statement on the + // left wants them to be omitted. + // + // Nevertheless, this is a useful notational shorthand to tell SQLite + // to do a bulk transfer all of the content from t1 over to t2. + // + // We could, in theory, disable this (except for internal use by the + // VACUUM command where it is actually needed). But why do that? It + // seems harmless enough, and provides a useful service. + if (int32((*Column)(unsafe.Pointer(pDestCol)).FcolFlags) & COLFLAG_GENERATED) != (int32((*Column)(unsafe.Pointer(pSrcCol)).FcolFlags) & COLFLAG_GENERATED) { + return 0 // Both columns have the same generated-column type + } + // But the transfer is only allowed if both the source and destination + // tables have the exact same expressions for generated columns. + // This requirement could be relaxed for VIRTUAL columns, I suppose. + if (int32((*Column)(unsafe.Pointer(pDestCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { + if Xsqlite3ExprCompare(tls, uintptr(0), (*Column)(unsafe.Pointer(pSrcCol)).FpDflt, (*Column)(unsafe.Pointer(pDestCol)).FpDflt, -1) != 0 { + + return 0 // Different generator expressions + } + } + if int32((*Column)(unsafe.Pointer(pDestCol)).Faffinity) != int32((*Column)(unsafe.Pointer(pSrcCol)).Faffinity) { + return 0 // Affinity must be the same on all columns + } + if Xsqlite3_stricmp(tls, (*Column)(unsafe.Pointer(pDestCol)).FzColl, (*Column)(unsafe.Pointer(pSrcCol)).FzColl) != 0 { + return 0 // Collating sequence must be the same on all columns + } + if ((*Column)(unsafe.Pointer(pDestCol)).FnotNull != 0) && !(int32((*Column)(unsafe.Pointer(pSrcCol)).FnotNull) != 0) { + return 0 // tab2 must be NOT NULL if tab1 is + } + // Default values for second and subsequent columns need to match. + if ((int32((*Column)(unsafe.Pointer(pDestCol)).FcolFlags) & COLFLAG_GENERATED) == 0) && (i > 0) { + + if ((libc.Bool32((*Column)(unsafe.Pointer(pDestCol)).FpDflt == uintptr(0))) != (libc.Bool32((*Column)(unsafe.Pointer(pSrcCol)).FpDflt == uintptr(0)))) || + (((*Column)(unsafe.Pointer(pDestCol)).FpDflt != 0) && (libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer((*Column)(unsafe.Pointer(pDestCol)).FpDflt + 8 /* &.u */)), + *(*uintptr)(unsafe.Pointer((*Column)(unsafe.Pointer(pSrcCol)).FpDflt + 8 /* &.u */))) != 0)) { + return 0 // Default values must be the same for all columns + } + } + } + for pDestIdx = (*Table)(unsafe.Pointer(pDest)).FpIndex; pDestIdx != 0; pDestIdx = (*Index)(unsafe.Pointer(pDestIdx)).FpNext { + if int32((*Index)(unsafe.Pointer((pDestIdx))).FonError) != OE_None { + destHasUniqueIdx = 1 + } + for pSrcIdx = (*Table)(unsafe.Pointer(pSrc)).FpIndex; pSrcIdx != 0; pSrcIdx = (*Index)(unsafe.Pointer(pSrcIdx)).FpNext { + if xferCompatibleIndex(tls, pDestIdx, pSrcIdx) != 0 { + break + } + } + if pSrcIdx == uintptr(0) { + return 0 // pDestIdx has no corresponding index in pSrc + } + if (((*Index)(unsafe.Pointer(pSrcIdx)).Ftnum == (*Index)(unsafe.Pointer(pDestIdx)).Ftnum) && ((*Table)(unsafe.Pointer(pSrc)).FpSchema == (*Table)(unsafe.Pointer(pDest)).FpSchema)) && + (Xsqlite3FaultSim(tls, 411) == SQLITE_OK) { + // The sqlite3FaultSim() call allows this corruption test to be + // bypassed during testing, in order to exercise other corruption tests + // further downstream. + return 0 // Corrupt schema - two indexes on the same btree + } + } + if ((*Table)(unsafe.Pointer(pDest)).FpCheck != 0) && (Xsqlite3ExprListCompare(tls, (*Table)(unsafe.Pointer(pSrc)).FpCheck, (*Table)(unsafe.Pointer(pDest)).FpCheck, -1) != 0) { + return 0 // Tables have different CHECK constraints. Ticket #2252 + } + // Disallow the transfer optimization if the destination table constains + // any foreign key constraints. This is more restrictive than necessary. + // But the main beneficiary of the transfer optimization is the VACUUM + // command, and the VACUUM command disables foreign key constraints. So + // the extra complication to make this rule less restrictive is probably + // not worth the effort. Ticket [6284df89debdfa61db8073e062908af0c9b6118e] + if (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != uint64(0)) && ((*Table)(unsafe.Pointer(pDest)).FpFKey != uintptr(0)) { + return 0 + } + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & (U64((uint64(0x00001))) << 32)) != uint64(0) { + return 0 // xfer opt does not play well with PRAGMA count_changes + } + + // If we get this far, it means that the xfer optimization is at + // least a possibility, though it might only work if the destination + // table (tab1) is initially empty. + iDbSrc = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pSrc)).FpSchema) + v = Xsqlite3GetVdbe(tls, pParse) + Xsqlite3CodeVerifySchema(tls, pParse, iDbSrc) + iSrc = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + iDest = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + regAutoinc = autoIncBegin(tls, pParse, iDbDest, pDest) + regData = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regData) + regRowid = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3OpenTable(tls, pParse, iDest, iDbDest, pDest, OP_OpenWrite) + + if (((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) == U32(0)) && ((((int32((*Table)(unsafe.Pointer(pDest)).FiPKey) < 0) && ((*Table)(unsafe.Pointer(pDest)).FpIndex != uintptr(0))) || // (1) + (destHasUniqueIdx != 0)) || // (2) + ((onError != OE_Abort) && (onError != OE_Rollback))) { + // In some circumstances, we are able to run the xfer optimization + // only if the destination table is initially empty. Unless the + // DBFLAG_Vacuum flag is set, this block generates code to make + // that determination. If DBFLAG_Vacuum is set, then the destination + // table is always empty. + // + // Conditions under which the destination must be empty: + // + // (1) There is no INTEGER PRIMARY KEY but there are indices. + // (If the destination is not initially empty, the rowid fields + // of index entries might need to change.) + // + // (2) The destination has a unique index. (The xfer optimization + // is unable to test uniqueness.) + // + // (3) onError is something other than OE_Abort and OE_Rollback. + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iDest, 0) + emptyDestTest = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + Xsqlite3VdbeJumpHere(tls, v, addr1) + } + if ((*Table)(unsafe.Pointer((pSrc))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + var insFlags U8 + Xsqlite3OpenTable(tls, pParse, iSrc, iDbSrc, pSrc, OP_OpenRead) + emptySrcTest = Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iSrc, 0) + if int32((*Table)(unsafe.Pointer(pDest)).FiPKey) >= 0 { + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iSrc, regRowid) + if ((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) == U32(0) { + + addr2 = Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iDest, 0, regRowid) + + Xsqlite3RowidConstraint(tls, pParse, onError, pDest) + Xsqlite3VdbeJumpHere(tls, v, addr2) + } + autoIncStep(tls, pParse, regAutoinc, regRowid) + } else if ((*Table)(unsafe.Pointer(pDest)).FpIndex == uintptr(0)) && !(((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_VacuumInto)) != 0) { + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iDest, regRowid) + } else { + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iSrc, regRowid) + + } + + if ((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) != 0 { + Xsqlite3VdbeAddOp1(tls, v, OP_SeekEnd, iDest) + insFlags = (U8((OPFLAG_APPEND | OPFLAG_USESEEKRESULT) | OPFLAG_PREFORMAT)) + } else { + insFlags = (U8(((OPFLAG_NCHANGE | OPFLAG_LASTROWID) | OPFLAG_APPEND) | OPFLAG_PREFORMAT)) + } + if ((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) == U32(0) { + Xsqlite3VdbeAddOp3(tls, v, OP_RowData, iSrc, regData, 1) + insFlags = libc.Uint8FromInt32(int32(insFlags) & (libc.CplInt32(OPFLAG_PREFORMAT))) + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_RowCell, iDest, iSrc, regRowid) + } + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iDest, regData, regRowid) + if ((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) == U32(0) { + Xsqlite3VdbeChangeP4(tls, v, -1, pDest, -6) + } + Xsqlite3VdbeChangeP5(tls, v, uint16(insFlags)) + + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iSrc, addr1) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, iSrc, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, iDest, 0) + } else { + Xsqlite3TableLock(tls, pParse, iDbDest, (*Table)(unsafe.Pointer(pDest)).Ftnum, uint8(1), (*Table)(unsafe.Pointer(pDest)).FzName) + Xsqlite3TableLock(tls, pParse, iDbSrc, (*Table)(unsafe.Pointer(pSrc)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pSrc)).FzName) + } + for pDestIdx = (*Table)(unsafe.Pointer(pDest)).FpIndex; pDestIdx != 0; pDestIdx = (*Index)(unsafe.Pointer(pDestIdx)).FpNext { + var idxInsFlags U8 = U8(0) + for pSrcIdx = (*Table)(unsafe.Pointer(pSrc)).FpIndex; pSrcIdx != 0; pSrcIdx = (*Index)(unsafe.Pointer(pSrcIdx)).FpNext { + if xferCompatibleIndex(tls, pDestIdx, pSrcIdx) != 0 { + break + } + } + + Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iSrc, int32((*Index)(unsafe.Pointer(pSrcIdx)).Ftnum), iDbSrc) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pSrcIdx) + + Xsqlite3VdbeAddOp3(tls, v, OP_OpenWrite, iDest, int32((*Index)(unsafe.Pointer(pDestIdx)).Ftnum), iDbDest) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pDestIdx) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_BULKCSR)) + + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iSrc, 0) + if ((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) != 0 { + // This INSERT command is part of a VACUUM operation, which guarantees + // that the destination table is empty. If all indexed columns use + // collation sequence BINARY, then it can also be assumed that the + // index will be populated by inserting keys in strictly sorted + // order. In this case, instead of seeking within the b-tree as part + // of every OP_IdxInsert opcode, an OP_SeekEnd is added before the + // OP_IdxInsert to seek to the point within the b-tree where each key + // should be inserted. This is faster. + // + // If any of the indexed columns use a collation sequence other than + // BINARY, this optimization is disabled. This is because the user + // might change the definition of a collation sequence and then run + // a VACUUM command. In that case keys may not be written in strictly + // sorted order. + for i = 0; i < int32((*Index)(unsafe.Pointer(pSrcIdx)).FnColumn); i++ { + var zColl uintptr = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pSrcIdx)).FazColl + uintptr(i)*8)) + if Xsqlite3_stricmp(tls, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), zColl) != 0 { + break + } + } + if i == int32((*Index)(unsafe.Pointer(pSrcIdx)).FnColumn) { + idxInsFlags = (U8(OPFLAG_USESEEKRESULT | OPFLAG_PREFORMAT)) + Xsqlite3VdbeAddOp1(tls, v, OP_SeekEnd, iDest) + Xsqlite3VdbeAddOp2(tls, v, OP_RowCell, iDest, iSrc) + } + } else if !(((*Table)(unsafe.Pointer((pSrc))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer(pDestIdx + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { + idxInsFlags = U8(int32(idxInsFlags) | (OPFLAG_NCHANGE)) + } + if int32(idxInsFlags) != (OPFLAG_USESEEKRESULT | OPFLAG_PREFORMAT) { + Xsqlite3VdbeAddOp3(tls, v, OP_RowData, iSrc, regData, 1) + if ((((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_Vacuum)) == U32(0)) && + !(((*Table)(unsafe.Pointer((pDest))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) && + ((int32(*(*uint16)(unsafe.Pointer((pDestIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { + codeWithoutRowidPreupdate(tls, pParse, pDest, iDest, regData) + } + } + Xsqlite3VdbeAddOp2(tls, v, OP_IdxInsert, iDest, regData) + Xsqlite3VdbeChangeP5(tls, v, (uint16(int32(idxInsFlags) | OPFLAG_APPEND))) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iSrc, (addr1 + 1)) + Xsqlite3VdbeJumpHere(tls, v, addr1) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, iSrc, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, iDest, 0) + } + if emptySrcTest != 0 { + Xsqlite3VdbeJumpHere(tls, v, emptySrcTest) + } + Xsqlite3ReleaseTempReg(tls, pParse, regRowid) + Xsqlite3ReleaseTempReg(tls, pParse, regData) + if emptyDestTest != 0 { + Xsqlite3AutoincrementEnd(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_Halt, SQLITE_OK, 0) + Xsqlite3VdbeJumpHere(tls, v, emptyDestTest) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, iDest, 0) + return 0 + } else { + return 1 + } + return int32(0) +} + +//************* End of insert.c ********************************************* +//************* Begin file legacy.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Main file for the SQLite library. The routines in this file +// implement the programmer interface to the library. Routines in +// other files are for internal use by SQLite and should not be +// accessed by users of the library. + +// #include "sqliteInt.h" + +// Execute SQL code. Return one of the SQLITE_ success/failure +// codes. Also write an error message into memory obtained from +// malloc() and make *pzErrMsg point to that message. +// +// If the SQL is a query, then for each row in the query result +// the xCallback() function is called. pArg becomes the first +// argument to xCallback(). If xCallback=NULL then no callback +// is invoked, even for queries. +func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Sqlite3_callback, pArg uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:126153:16: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var zLeftover uintptr at bp+8, 8 + // Tail of unprocessed SQL + // var pStmt uintptr at bp, 8 + // The current SQL statement + var azCols uintptr // Names of result columns + var callbackIsInit int32 + var i int32 + var nCol int32 + var azVals uintptr + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + azCols = uintptr(0) // True if callback data is initialized + + if !(!(Xsqlite3SafetyCheckOk(tls, db) != 0)) { + goto __1 + } + return Xsqlite3MisuseError(tls, 126166) +__1: + ; + if !(zSql == uintptr(0)) { + goto __2 + } + zSql = ts + 756 /* "" */ +__2: + ; + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3Error(tls, db, SQLITE_OK) +__3: + if !((rc == SQLITE_OK) && (*(*int8)(unsafe.Pointer(zSql)) != 0)) { + goto __4 + } + nCol = 0 + azVals = uintptr(0) + + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp /* &pStmt */, bp+8 /* &zLeftover */) + + if !(rc != SQLITE_OK) { + goto __5 + } + goto __3 +__5: + ; + if !(!(*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) != 0)) { + goto __6 + } + // this happens for a comment or white-space + zSql = *(*uintptr)(unsafe.Pointer(bp + 8 /* zLeftover */)) + goto __3 +__6: + ; + callbackIsInit = 0 + +__7: + if !(1 != 0) { + goto __8 + } + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + + // Invoke the callback function if required + if !((xCallback != 0) && ((SQLITE_ROW == rc) || (((SQLITE_DONE == rc) && !(callbackIsInit != 0)) && + (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_NullCallback)) != 0)))) { + goto __9 + } + if !(!(callbackIsInit != 0)) { + goto __10 + } + nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + azCols = Xsqlite3DbMallocRaw(tls, db, (uint64((uint64((2 * nCol) + 1)) * uint64(unsafe.Sizeof(uintptr(0)))))) + if !(azCols == uintptr(0)) { + goto __11 + } + goto exec_out +__11: + ; + i = 0 +__12: + if !(i < nCol) { + goto __14 + } + *(*uintptr)(unsafe.Pointer(azCols + uintptr(i)*8)) = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i) + // sqlite3VdbeSetColName() installs column names as UTF8 + // strings so there is no way for sqlite3_column_name() to fail. + + goto __13 +__13: + i++ + goto __12 + goto __14 +__14: + ; + callbackIsInit = 1 +__10: + ; + if !(rc == SQLITE_ROW) { + goto __15 + } + azVals = (azCols + uintptr(nCol)*8) + i = 0 +__16: + if !(i < nCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8)) = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i) + if !(!(int32(*(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8))) != 0) && (Xsqlite3_column_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i) != SQLITE_NULL)) { + goto __19 + } + Xsqlite3OomFault(tls, db) + goto exec_out +__19: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + *(*uintptr)(unsafe.Pointer(azVals + uintptr(i)*8)) = uintptr(0) +__15: + ; + if !((*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(&xCallback)))(tls, pArg, nCol, azVals, azCols) != 0) { + goto __20 + } + // EVIDENCE-OF: R-38229-40159 If the callback function to + // sqlite3_exec() returns non-zero, then sqlite3_exec() will + // return SQLITE_ABORT. + rc = SQLITE_ABORT + Xsqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + Xsqlite3Error(tls, db, SQLITE_ABORT) + goto exec_out +__20: + ; +__9: + ; + + if !(rc != SQLITE_ROW) { + goto __21 + } + rc = Xsqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + zSql = *(*uintptr)(unsafe.Pointer(bp + 8 /* zLeftover */)) +__22: + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zSql)))]) & 0x01) != 0) { + goto __23 + } + zSql++ + goto __22 +__23: + ; + goto __8 +__21: + ; + goto __7 +__8: + ; + + Xsqlite3DbFree(tls, db, azCols) + azCols = uintptr(0) + goto __3 +__4: + ; + +exec_out: + if !(*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) != 0) { + goto __24 + } + Xsqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) +__24: + ; + Xsqlite3DbFree(tls, db, azCols) + + rc = Xsqlite3ApiExit(tls, db, rc) + if !((rc != SQLITE_OK) && (pzErrMsg != 0)) { + goto __25 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3DbStrDup(tls, uintptr(0), Xsqlite3_errmsg(tls, db)) + if !(*(*uintptr)(unsafe.Pointer(pzErrMsg)) == uintptr(0)) { + goto __27 + } + rc = SQLITE_NOMEM + Xsqlite3Error(tls, db, SQLITE_NOMEM) +__27: + ; + goto __26 +__25: + if !(pzErrMsg != 0) { + goto __28 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__28: + ; +__26: + ; + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// This is the function signature used for all extension entry points. It +// is also defined in the file "loadext.c". +type Sqlite3_loadext_entry = uintptr /* sqlite3.c:126633:13 */ + +// The following macros redefine the API routines so that they are +// redirected through the global sqlite3_api structure. +// +// This header file is also used by the loadext.c source file +// (part of the main SQLite library - not an extension) so that +// it can get access to the sqlite3_api_routines structure +// definition. But the main library does not want to redefine +// the API. So the redefinition macros are only valid if the +// SQLITE_CORE macros is undefined. + +// This case when the file is being statically linked into the +// application + +//************* End of sqlite3ext.h ***************************************** +//************* Continuing where we left off in loadext.c ******************* +// #include "sqliteInt.h" + +// Some API routines are omitted when various features are +// excluded from a build of SQLite. Substitute a NULL pointer +// for any missing APIs. + +// The following structure contains pointers to all SQLite API routines. +// A pointer to this structure is passed into extensions when they are +// loaded so that the extension can make calls back into the SQLite +// library. +// +// When adding new APIs, add them to the bottom of this structure +// in order to preserve backwards compatibility. +// +// Extensions that use newer APIs should first call the +// sqlite3_libversion_number() to make sure that the API they +// intend to use is supported by the library. Extensions should +// also check to make sure that the pointer to the function is +// not NULL before calling it. +var sqlite3Apis = Sqlite3_api_routines{ + Faggregate_context: 0, + Faggregate_count: 0, + Fbind_blob: 0, + Fbind_double: 0, + Fbind_int: 0, + Fbind_int64: 0, + Fbind_null: 0, + Fbind_parameter_count: 0, + Fbind_parameter_index: 0, + Fbind_parameter_name: 0, + Fbind_text: 0, + Fbind_text16: 0, + Fbind_value: 0, + Fbusy_handler: 0, + Fbusy_timeout: 0, + Fchanges: 0, + Fclose: 0, + Fcollation_needed: 0, + Fcollation_needed16: 0, + Fcolumn_blob: 0, + Fcolumn_bytes: 0, + Fcolumn_bytes16: 0, + Fcolumn_count: 0, + Fcolumn_database_name: 0, + Fcolumn_database_name16: 0, + Fcolumn_decltype: 0, + Fcolumn_decltype16: 0, + Fcolumn_double: 0, + Fcolumn_int: 0, + Fcolumn_int64: 0, + Fcolumn_name: 0, + Fcolumn_name16: 0, + Fcolumn_origin_name: 0, + Fcolumn_origin_name16: 0, + Fcolumn_table_name: 0, + Fcolumn_table_name16: 0, + Fcolumn_text: 0, + Fcolumn_text16: 0, + Fcolumn_type: 0, + Fcolumn_value: 0, + Fcommit_hook: 0, + Fcomplete: 0, + Fcomplete16: 0, + Fcreate_collation: 0, + Fcreate_collation16: 0, + Fcreate_function: 0, + Fcreate_function16: 0, + Fcreate_module: 0, + Fdata_count: 0, + Fdb_handle: 0, + Fdeclare_vtab: 0, + Fenable_shared_cache: 0, + Ferrcode: 0, + Ferrmsg: 0, + Ferrmsg16: 0, + Fexec: 0, + Fexpired: 0, + Ffinalize: 0, + Ffree: 0, + Ffree_table: 0, + Fget_autocommit: 0, + Fget_auxdata: 0, + Fget_table: 0, // Was sqlite3_global_recover(), but that function is deprecated + Finterruptx: 0, + Flast_insert_rowid: 0, + Flibversion: 0, + Flibversion_number: 0, + Fmalloc: 0, + Fmprintf: 0, + Fopen: 0, + Fopen16: 0, + Fprepare: 0, + Fprepare16: 0, + Fprofile: 0, + Fprogress_handler: 0, + Frealloc: 0, + Freset: 0, + Fresult_blob: 0, + Fresult_double: 0, + Fresult_error: 0, + Fresult_error16: 0, + Fresult_int: 0, + Fresult_int64: 0, + Fresult_null: 0, + Fresult_text: 0, + Fresult_text16: 0, + Fresult_text16be: 0, + Fresult_text16le: 0, + Fresult_value: 0, + Frollback_hook: 0, + Fset_authorizer: 0, + Fset_auxdata: 0, + Fxsnprintf: 0, + Fstep: 0, + Ftable_column_metadata: 0, + Fthread_cleanup: 0, + Ftotal_changes: 0, + Ftrace: 0, + Ftransfer_bindings: 0, + Fupdate_hook: 0, + Fuser_data: 0, + Fvalue_blob: 0, + Fvalue_bytes: 0, + Fvalue_bytes16: 0, + Fvalue_double: 0, + Fvalue_int: 0, + Fvalue_int64: 0, + Fvalue_numeric_type: 0, + Fvalue_text: 0, + Fvalue_text16: 0, + Fvalue_text16be: 0, + Fvalue_text16le: 0, + Fvalue_type: 0, + Fvmprintf: 0, + // The original API set ends here. All extensions can call any + // of the APIs above provided that the pointer is not NULL. But + // before calling APIs that follow, extension should check the + // sqlite3_libversion_number() to make sure they are dealing with + // a library that is new enough to support that API. + // + Foverload_function: 0, + + // Added after 3.3.13 + Fprepare_v2: 0, + Fprepare16_v2: 0, + Fclear_bindings: 0, + + // Added for 3.4.1 + Fcreate_module_v2: 0, + + // Added for 3.5.0 + Fbind_zeroblob: 0, + Fblob_bytes: 0, + Fblob_close: 0, + Fblob_open: 0, + Fblob_read: 0, + Fblob_write: 0, + Fcreate_collation_v2: 0, + Ffile_control: 0, + Fmemory_highwater: 0, + Fmemory_used: 0, + Fmutex_alloc: 0, + Fmutex_enter: 0, + Fmutex_free: 0, + Fmutex_leave: 0, + Fmutex_try: 0, + Fopen_v2: 0, + Frelease_memory: 0, + Fresult_error_nomem: 0, + Fresult_error_toobig: 0, + Fsleep: 0, + Fsoft_heap_limit: 0, + Fvfs_find: 0, + Fvfs_register: 0, + Fvfs_unregister: 0, + + // Added for 3.5.8 + Fxthreadsafe: 0, + Fresult_zeroblob: 0, + Fresult_error_code: 0, + Ftest_control: 0, + Frandomness: 0, + Fcontext_db_handle: 0, + + // Added for 3.6.0 + Fextended_result_codes: 0, + Flimit: 0, + Fnext_stmt: 0, + Fsql: 0, + Fstatus: 0, + + // Added for 3.7.4 + Fbackup_finish: 0, + Fbackup_init: 0, + Fbackup_pagecount: 0, + Fbackup_remaining: 0, + Fbackup_step: 0, + Fcompileoption_get: 0, + Fcompileoption_used: 0, + Fcreate_function_v2: 0, + Fdb_config: 0, + Fdb_mutex: 0, + Fdb_status: 0, + Fextended_errcode: 0, + Flog: 0, + Fsoft_heap_limit64: 0, + Fsourceid: 0, + Fstmt_status: 0, + Fstrnicmp: 0, + Funlock_notify: 0, + Fwal_autocheckpoint: 0, + Fwal_checkpoint: 0, + Fwal_hook: 0, + Fblob_reopen: 0, + Fvtab_config: 0, + Fvtab_on_conflict: 0, + Fclose_v2: 0, + Fdb_filename: 0, + Fdb_readonly: 0, + Fdb_release_memory: 0, + Ferrstr: 0, + Fstmt_busy: 0, + Fstmt_readonly: 0, + Fstricmp: 0, + Furi_boolean: 0, + Furi_int64: 0, + Furi_parameter: 0, + Fxvsnprintf: 0, + Fwal_checkpoint_v2: 0, + // Version 3.8.7 and later + Fauto_extension: 0, + Fbind_blob64: 0, + Fbind_text64: 0, + Fcancel_auto_extension: 0, + Fload_extension: 0, + Fmalloc64: 0, + Fmsize: 0, + Frealloc64: 0, + Freset_auto_extension: 0, + Fresult_blob64: 0, + Fresult_text64: 0, + Fstrglob: 0, + // Version 3.8.11 and later + Fvalue_dup: 0, + Fvalue_free: 0, + Fresult_zeroblob64: 0, + Fbind_zeroblob64: 0, + // Version 3.9.0 and later + Fvalue_subtype: 0, + Fresult_subtype: 0, + // Version 3.10.0 and later + Fstatus64: 0, + Fstrlike: 0, + Fdb_cacheflush: 0, + // Version 3.12.0 and later + Fsystem_errno: 0, + // Version 3.14.0 and later + Ftrace_v2: 0, + Fexpanded_sql: 0, + // Version 3.18.0 and later + Fset_last_insert_rowid: 0, + // Version 3.20.0 and later + Fprepare_v3: 0, + Fprepare16_v3: 0, + Fbind_pointer: 0, + Fresult_pointer: 0, + Fvalue_pointer: 0, + // Version 3.22.0 and later + Fvtab_nochange: 0, + Fvalue_nochange: 0, + Fvtab_collation: 0, + // Version 3.24.0 and later + Fkeyword_count: 0, + Fkeyword_name: 0, + Fkeyword_check: 0, + Fstr_new: 0, + Fstr_finish: 0, + Fstr_appendf: 0, + Fstr_vappendf: 0, + Fstr_append: 0, + Fstr_appendall: 0, + Fstr_appendchar: 0, + Fstr_reset: 0, + Fstr_errcode: 0, + Fstr_length: 0, + Fstr_value: 0, + // Version 3.25.0 and later + Fcreate_window_function: 0, + // Version 3.28.0 and later + Fstmt_isexplain: 0, + Fvalue_frombind: 0, + // Version 3.30.0 and later + Fdrop_modules: 0, + // Version 3.31.0 and later + Fhard_heap_limit64: 0, + Furi_key: 0, + Ffilename_database: 0, + Ffilename_journal: 0, + Ffilename_wal: 0, + // Version 3.32.0 and later + Fcreate_filename: 0, + Ffree_filename: 0, + Fdatabase_file_object: 0, + // Version 3.34.0 and later + Ftxn_state: 0, +} /* sqlite3.c:127067:35 */ + +// True if x is the directory separator character + +// Attempt to load an SQLite extension library contained in the file +// zFile. The entry point is zProc. zProc may be 0 in which case a +// default entry point name (sqlite3_extension_init) is used. Use +// of the default name is recommended. +// +// Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong. +// +// If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with +// error message text. The calling function should free this memory +// by calling sqlite3DbFree(db, ). +func sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127439:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var pVfs uintptr + var handle uintptr + var xInit Sqlite3_loadext_entry + // var zErrmsg uintptr at bp+56, 8 + + var zEntry uintptr + var zAltEntry uintptr + var aHandle uintptr + var nMsg U64 + var ii int32 + var rc int32 + var zAltFile uintptr + var iFile int32 + var iEntry int32 + var c int32 + var ncFile int32 + pVfs = (*Sqlite3)(unsafe.Pointer(db)).FpVfs + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)) = uintptr(0) + zAltEntry = uintptr(0) + nMsg = U64(libc.Xstrlen(tls, zFile)) + + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + + // Ticket #1863. To avoid a creating security problems for older + // applications that relink against newer versions of SQLite, the + // ability to run load_extension is turned off by default. One + // must call either sqlite3_enable_load_extension(db) or + // sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0) + // to turn on extension loading. + if !(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtension)) == uint64(0)) { + goto __2 + } + if !(pzErrMsg != 0) { + goto __3 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10825 /* "not authorized" */, 0) +__3: + ; + return SQLITE_ERROR +__2: + ; + + if zProc != 0 { + zEntry = zProc + } else { + zEntry = ts + 14401 /* "sqlite3_extensio..." */ + } + + // tag-20210611-1. Some dlopen() implementations will segfault if given + // an oversize filename. Most filesystems have a pathname limit of 4K, + // so limit the extension filename length to about twice that. + // https://sqlite.org/forum/forumpost/08a0d6d9bf + if !(nMsg > uint64(FILENAME_MAX)) { + goto __4 + } + goto extension_not_found +__4: + ; + + handle = Xsqlite3OsDlOpen(tls, pVfs, zFile) + ii = 0 +__5: + if !((ii < (int32(uint64(unsafe.Sizeof(azEndings)) / uint64(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { + goto __7 + } + zAltFile = Xsqlite3_mprintf(tls, ts+10786 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + if !(zAltFile == uintptr(0)) { + goto __8 + } + return SQLITE_NOMEM +__8: + ; + handle = Xsqlite3OsDlOpen(tls, pVfs, zAltFile) + Xsqlite3_free(tls, zAltFile) + goto __6 +__6: + ii++ + goto __5 + goto __7 +__7: + ; + if !(handle == uintptr(0)) { + goto __9 + } + goto extension_not_found +__9: + ; + xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) + + // If no entry point was specified and the default legacy + // entry point name "sqlite3_extension_init" was not found, then + // construct an entry point name "sqlite3_X_init" where the X is + // replaced by the lowercase value of every ASCII alphabetic + // character in the filename after the last "/" upto the first ".", + // and eliding the first three characters if they are "lib". + // Examples: + // + // /usr/local/lib/libExample5.4.3.so ==> sqlite3_example_init + // C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init + if !((xInit == uintptr(0)) && (zProc == uintptr(0))) { + goto __10 + } + ncFile = Xsqlite3Strlen30(tls, zFile) + zAltEntry = Xsqlite3_malloc64(tls, (uint64(ncFile + 30))) + if !(zAltEntry == uintptr(0)) { + goto __11 + } + Xsqlite3OsDlClose(tls, pVfs, handle) + return SQLITE_NOMEM +__11: + ; + libc.Xmemcpy(tls, zAltEntry, ts+14424 /* "sqlite3_" */, uint64(8)) + iFile = (ncFile - 1) +__12: + if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { + goto __14 + } + goto __13 +__13: + iFile-- + goto __12 + goto __14 +__14: + ; + iFile++ + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14433 /* "lib" */, 3) == 0) { + goto __15 + } + iFile = iFile + (3) +__15: + ; + iEntry = 8 +__16: + if !(((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile)))))) != 0) && (c != '.')) { + goto __18 + } + if !((int32(Xsqlite3CtypeMap[uint8(c)]) & 0x02) != 0) { + goto __19 + } + *(*int8)(unsafe.Pointer(zAltEntry + uintptr(libc.PostIncInt32(&iEntry, 1)))) = int8(Xsqlite3UpperToLower[uint32(c)]) +__19: + ; + goto __17 +__17: + iFile++ + goto __16 + goto __18 +__18: + ; + libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14437 /* "_init" */, uint64(6)) + zEntry = zAltEntry + xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) +__10: + ; + if !(xInit == uintptr(0)) { + goto __20 + } + if !(pzErrMsg != 0) { + goto __21 + } + nMsg = nMsg + (U64(libc.Xstrlen(tls, zEntry) + uint64(300))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = libc.AssignPtrUintptr(bp+56 /* zErrmsg */, Xsqlite3_malloc64(tls, nMsg)) + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)) != 0) { + goto __22 + } + // zErrmsg would be NULL if not so + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), + ts+14443 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) +__22: + ; +__21: + ; + Xsqlite3OsDlClose(tls, pVfs, handle) + Xsqlite3_free(tls, zAltEntry) + return SQLITE_ERROR +__20: + ; + Xsqlite3_free(tls, zAltEntry) + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+56 /* &zErrmsg */, uintptr(unsafe.Pointer(&sqlite3Apis))) + if !(rc != 0) { + goto __23 + } + if !(rc == (SQLITE_OK | (int32(1) << 8))) { + goto __24 + } + return SQLITE_OK +__24: + ; + if !(pzErrMsg != 0) { + goto __25 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14486 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) +__25: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) + Xsqlite3OsDlClose(tls, pVfs, handle) + return SQLITE_ERROR +__23: + ; + + // Append the new shared library handle to the db->aExtension array. + aHandle = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(handle)) * (uint64((*Sqlite3)(unsafe.Pointer(db)).FnExtension + 1))))) + if !(aHandle == uintptr(0)) { + goto __26 + } + return SQLITE_NOMEM +__26: + ; + if !((*Sqlite3)(unsafe.Pointer(db)).FnExtension > 0) { + goto __27 + } + libc.Xmemcpy(tls, aHandle, (*Sqlite3)(unsafe.Pointer(db)).FaExtension, (uint64(unsafe.Sizeof(handle)) * uint64((*Sqlite3)(unsafe.Pointer(db)).FnExtension))) +__27: + ; + Xsqlite3DbFree(tls, db, (*Sqlite3)(unsafe.Pointer(db)).FaExtension) + (*Sqlite3)(unsafe.Pointer(db)).FaExtension = aHandle + + *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(libc.PostIncInt32(&(*Sqlite3)(unsafe.Pointer(db)).FnExtension, 1))*8)) = handle + return SQLITE_OK + +extension_not_found: + if !(pzErrMsg != 0) { + goto __28 + } + nMsg = nMsg + (uint64(300)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = libc.AssignPtrUintptr(bp+56 /* zErrmsg */, Xsqlite3_malloc64(tls, nMsg)) + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)) != 0) { + goto __29 + } + // zErrmsg would be NULL if not so + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), + ts+14518 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) +__29: + ; +__28: + ; + return SQLITE_ERROR +} + +var azEndings = [1]uintptr{ + ts + 14555, /* "so" */ +} /* sqlite3.c:127457:21 */ + +func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ + var rc int32 + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + rc = sqlite3LoadExtension(tls, db, zFile, zProc, pzErrMsg) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Call this routine when the database connection is closing in order +// to clean up loaded extensions +func Xsqlite3CloseExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127608:21: */ + var i int32 + + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnExtension; i++ { + Xsqlite3OsDlClose(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaExtension + uintptr(i)*8))) + } + Xsqlite3DbFree(tls, db, (*Sqlite3)(unsafe.Pointer(db)).FaExtension) +} + +// Enable or disable extension loading. Extension loading is disabled by +// default so as not to open security holes in older applications. +func Xsqlite3_enable_load_extension(tls *libc.TLS, db uintptr, onoff int32) int32 { /* sqlite3.c:127621:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if onoff != 0 { + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(SQLITE_LoadExtension | SQLITE_LoadExtFunc)) + } else { + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64((uint64(SQLITE_LoadExtension | SQLITE_LoadExtFunc)))) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// The following object holds the list of automatically loaded +// extensions. +// +// This list is shared across threads. The SQLITE_MUTEX_STATIC_MAIN +// mutex must be held while accessing this list. +type sqlite3AutoExtList = struct { + FnExt U32 + _ [4]byte + FaExt uintptr +} /* sqlite3.c:127641:9 */ + +// The following object holds the list of automatically loaded +// extensions. +// +// This list is shared across threads. The SQLITE_MUTEX_STATIC_MAIN +// mutex must be held while accessing this list. +type Sqlite3AutoExtList = sqlite3AutoExtList /* sqlite3.c:127641:35 */ +var sqlite3Autoext = sqlite3AutoExtList{} /* sqlite3.c:127645:3 */ + +// The "wsdAutoext" macro will resolve to the autoextension +// state vector. If writable static data is unsupported on the target, +// we have to locate the state vector at run-time. In the more common +// case where writable static data is supported, wsdStat can refer directly +// to the "sqlite3Autoext" state vector declared above. + +// Register a statically linked extension that is automatically +// loaded by every new database connection. +func Xsqlite3_auto_extension(tls *libc.TLS, xInit uintptr) int32 { /* sqlite3.c:127667:16: */ + var rc int32 = SQLITE_OK + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } else { + var i U32 + var mutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + + Xsqlite3_mutex_enter(tls, mutex) + for i = U32(0); i < sqlite3Autoext.FnExt; i++ { + if *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(i)*8)) == xInit { + break + } + } + if i == sqlite3Autoext.FnExt { + var nByte U64 = (U64((uint64(sqlite3Autoext.FnExt + U32(1))) * uint64(unsafe.Sizeof(uintptr(0))))) + var aNew uintptr + aNew = Xsqlite3_realloc64(tls, sqlite3Autoext.FaExt, nByte) + if aNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + sqlite3Autoext.FaExt = aNew + *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(sqlite3Autoext.FnExt)*8)) = xInit + sqlite3Autoext.FnExt++ + } + } + Xsqlite3_mutex_leave(tls, mutex) + + return rc + } + return int32(0) +} + +// Cancel a prior call to sqlite3_auto_extension. Remove xInit from the +// set of routines that is invoked for each new database connection, if it +// is currently on the list. If xInit is not on the list, then this +// routine is a no-op. +// +// Return 1 if xInit was found on the list and removed. Return 0 if xInit +// was not on the list. +func Xsqlite3_cancel_auto_extension(tls *libc.TLS, xInit uintptr) int32 { /* sqlite3.c:127714:16: */ + var mutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + var i int32 + var n int32 = 0 + + Xsqlite3_mutex_enter(tls, mutex) + for i = (int32(sqlite3Autoext.FnExt) - 1); i >= 0; i-- { + if *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(i)*8)) == xInit { + sqlite3Autoext.FnExt-- + *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(sqlite3Autoext.FnExt)*8)) + n++ + break + } + } + Xsqlite3_mutex_leave(tls, mutex) + return n +} + +// Reset the automatic extension loading mechanism. +func Xsqlite3_reset_auto_extension(tls *libc.TLS) { /* sqlite3.c:127739:17: */ + if Xsqlite3_initialize(tls) == SQLITE_OK { + var mutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + + Xsqlite3_mutex_enter(tls, mutex) + Xsqlite3_free(tls, sqlite3Autoext.FaExt) + sqlite3Autoext.FaExt = uintptr(0) + sqlite3Autoext.FnExt = U32(0) + Xsqlite3_mutex_leave(tls, mutex) + } +} + +// Load all automatic extensions. +// +// If anything goes wrong, set an error in the database connection. +func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var i U32 + var go1 int32 = 1 + var rc int32 + var xInit Sqlite3_loadext_entry + + if sqlite3Autoext.FnExt == U32(0) { + // Common case: early out without every having to acquire a mutex + return + } + for i = U32(0); go1 != 0; i++ { + // var zErrmsg uintptr at bp+8, 8 + + var mutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + var pThunk uintptr = uintptr(unsafe.Pointer(&sqlite3Apis)) + Xsqlite3_mutex_enter(tls, mutex) + if i >= sqlite3Autoext.FnExt { + xInit = uintptr(0) + go1 = 0 + } else { + xInit = *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(i)*8)) + } + Xsqlite3_mutex_leave(tls, mutex) + *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) + if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { + Xsqlite3ErrorWithMsg(tls, db, rc, + ts+14558 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + go1 = 0 + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) + } +} + +//************* End of loadext.c ******************************************** +//************* Begin file pragma.c ***************************************** +// 2003 April 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code used to implement the PRAGMA command. +// #include "sqliteInt.h" + +// ************************************************************************** +// +// The "pragma.h" include file is an automatically generated file that +// that includes the PragType_XXXX macro definitions and the aPragmaName[] +// object. This ensures that the aPragmaName[] table is arranged in +// lexicographical order to facility a binary search of the pragma name. +// Do not edit pragma.h directly. Edit and rerun the script in at +// ../tool/mkpragmatab.tcl. +//************* Include pragma.h in the middle of pragma.c ****************** +//************* Begin file pragma.h ***************************************** +// DO NOT EDIT! +// This file is automatically generated by the script at +// ../tool/mkpragmatab.tcl. To update the set of pragmas, edit +// that script and rerun it. + +// The various pragma types + +// Property flags associated with various pragma. + +// Names of columns for pragmas that return multi-column result +// or that return single-column results where the name of the +// result column is different from the name of the pragma +var pragCName = [51]uintptr{ + /* 0 */ ts + 4172, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 14597, /* "seq" */ + /* 2 */ ts + 7824, /* "table" */ + /* 3 */ ts + 14601, /* "from" */ + /* 4 */ ts + 14606, /* "to" */ + /* 5 */ ts + 14609, /* "on_update" */ + /* 6 */ ts + 14619, /* "on_delete" */ + /* 7 */ ts + 14629, /* "match" */ + /* 8 */ ts + 14635, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 14639, /* "name" */ + /* 10 */ ts + 14644, /* "type" */ + /* 11 */ ts + 14649, /* "notnull" */ + /* 12 */ ts + 14657, /* "dflt_value" */ + /* 13 */ ts + 14668, /* "pk" */ + /* 14 */ ts + 14671, /* "hidden" */ + // table_info reuses 8 + /* 15 */ ts + 14678, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 14635, /* "cid" */ + /* 17 */ ts + 14639, /* "name" */ + /* 18 */ ts + 14684, /* "desc" */ + /* 19 */ ts + 14689, /* "coll" */ + /* 20 */ ts + 14694, /* "key" */ + /* 21 */ ts + 14639, /* "name" */ // Used by: function_list + /* 22 */ ts + 14698, /* "builtin" */ + /* 23 */ ts + 14644, /* "type" */ + /* 24 */ ts + 14706, /* "enc" */ + /* 25 */ ts + 14710, /* "narg" */ + /* 26 */ ts + 14715, /* "flags" */ + /* 27 */ ts + 10217, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10213, /* "idx" */ + /* 29 */ ts + 14721, /* "wdth" */ + /* 30 */ ts + 14726, /* "hght" */ + /* 31 */ ts + 14731, /* "flgs" */ + /* 32 */ ts + 14597, /* "seq" */ // Used by: index_list + /* 33 */ ts + 14639, /* "name" */ + /* 34 */ ts + 14736, /* "unique" */ + /* 35 */ ts + 14743, /* "origin" */ + /* 36 */ ts + 14750, /* "partial" */ + /* 37 */ ts + 7824, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 14758, /* "rowid" */ + /* 39 */ ts + 4175, /* "parent" */ + /* 40 */ ts + 14764, /* "fkid" */ + // index_info reuses 15 + /* 41 */ ts + 14597, /* "seq" */ // Used by: database_list + /* 42 */ ts + 14639, /* "name" */ + /* 43 */ ts + 14769, /* "file" */ + /* 44 */ ts + 14774, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 14779, /* "log" */ + /* 46 */ ts + 14783, /* "checkpointed" */ + // collation_list reuses 32 + /* 47 */ ts + 14796, /* "database" */ // Used by: lock_status + /* 48 */ ts + 14805, /* "status" */ + /* 49 */ ts + 14812, /* "cache_size" */ // Used by: default_cache_size + // module_list pragma_list reuses 9 + /* 50 */ ts + 14823, /* "timeout" */ // Used by: busy_timeout +} /* sqlite3.c:127901:19 */ + +// Definitions of all built-in pragmas +type PragmaName1 = struct { + FzName uintptr + FePragTyp U8 + FmPragFlg U8 + FiPragCName U8 + FnPragCName U8 + _ [4]byte + FiArg U64 +} /* sqlite3.c:127960:9 */ + +// Definitions of all built-in pragmas +type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ +var aPragmaName = [65]PragmaName{ + { /* zName: */ FzName: ts + 14831, /* "analysis_limit" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, + { /* zName: */ FzName: ts + 14846, /* "application_id" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), + /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, + { /* zName: */ FzName: ts + 14861, /* "auto_vacuum" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), + /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 14873, /* "automatic_index" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, + { /* zName: */ FzName: ts + 14889, /* "busy_timeout" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), + /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, + { /* zName: */ FzName: ts + 14812, /* "cache_size" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), + /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 14902, /* "cache_spill" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 14914, /* "case_sensitive_l..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, + { /* zName: */ FzName: ts + 14934, /* "cell_size_check" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, + { /* zName: */ FzName: ts + 14950, /* "checkpoint_fullf..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, + { /* zName: */ FzName: ts + 14971, /* "collation_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), + /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, + { /* zName: */ FzName: ts + 14986, /* "compile_options" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, + { /* zName: */ FzName: ts + 15002, /* "count_changes" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, + { /* zName: */ FzName: ts + 15016, /* "data_version" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), + /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, + { /* zName: */ FzName: ts + 15029, /* "database_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), + /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, + { /* zName: */ FzName: ts + 15043, /* "default_cache_si..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), + /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), + /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, + { /* zName: */ FzName: ts + 15062, /* "defer_foreign_ke..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, + { /* zName: */ FzName: ts + 15081, /* "empty_result_cal..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, + { /* zName: */ FzName: ts + 15104, /* "encoding" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 15113, /* "foreign_key_chec..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), + /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), + /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, + { /* zName: */ FzName: ts + 15131, /* "foreign_key_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, + { /* zName: */ FzName: ts + 15148, /* "foreign_keys" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, + { /* zName: */ FzName: ts + 15161, /* "freelist_count" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, + { /* zName: */ FzName: ts + 15176, /* "full_column_name..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, + { /* zName: */ FzName: ts + 15194, /* "fullfsync" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, + { /* zName: */ FzName: ts + 15204, /* "function_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), + /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, + { /* zName: */ FzName: ts + 15218, /* "hard_heap_limit" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, + { /* zName: */ FzName: ts + 15234, /* "ignore_check_con..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, + { /* zName: */ FzName: ts + 15259, /* "incremental_vacu..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, + { /* zName: */ FzName: ts + 15278, /* "index_info" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), + /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, + { /* zName: */ FzName: ts + 15289, /* "index_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), + /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, + { /* zName: */ FzName: ts + 15300, /* "index_xinfo" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), + /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), + /* iArg: */ FiArg: uint64(1)}, + { /* zName: */ FzName: ts + 15312, /* "integrity_check" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, + { /* zName: */ FzName: ts + 15328, /* "journal_mode" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, + { /* zName: */ FzName: ts + 15341, /* "journal_size_lim..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, + { /* zName: */ FzName: ts + 15360, /* "legacy_alter_tab..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, + { /* zName: */ FzName: ts + 15379, /* "locking_mode" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, + { /* zName: */ FzName: ts + 15392, /* "max_page_count" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, + { /* zName: */ FzName: ts + 15407, /* "mmap_size" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, + { /* zName: */ FzName: ts + 15417, /* "module_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), + /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, + { /* zName: */ FzName: ts + 15429, /* "optimize" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, + { /* zName: */ FzName: ts + 15438, /* "page_count" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, + { /* zName: */ FzName: ts + 15449, /* "page_size" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 15459, /* "pragma_list" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), + /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, + { /* zName: */ FzName: ts + 15471, /* "query_only" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, + { /* zName: */ FzName: ts + 15482, /* "quick_check" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, + { /* zName: */ FzName: ts + 15494, /* "read_uncommitted" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, + { /* zName: */ FzName: ts + 15511, /* "recursive_trigge..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, + { /* zName: */ FzName: ts + 15530, /* "reverse_unordere..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, + { /* zName: */ FzName: ts + 15556, /* "schema_version" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), + /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, + { /* zName: */ FzName: ts + 15571, /* "secure_delete" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, + { /* zName: */ FzName: ts + 15585, /* "short_column_nam..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, + { /* zName: */ FzName: ts + 15604, /* "shrink_memory" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, + { /* zName: */ FzName: ts + 15618, /* "soft_heap_limit" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, + { /* zName: */ FzName: ts + 15634, /* "synchronous" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), + /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 15646, /* "table_info" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), + /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, + { /* zName: */ FzName: ts + 15657, /* "table_xinfo" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), + /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), + /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), + /* iArg: */ FiArg: uint64(1)}, + { /* zName: */ FzName: ts + 15669, /* "temp_store" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, + { /* zName: */ FzName: ts + 15680, /* "temp_store_direc..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, + { /* zName: */ FzName: ts + 15701, /* "threads" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, + { /* zName: */ FzName: ts + 15709, /* "trusted_schema" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, + { /* zName: */ FzName: ts + 15724, /* "user_version" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), + /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, + { /* zName: */ FzName: ts + 15737, /* "wal_autocheckpoi..." */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, + { /* zName: */ FzName: ts + 15756, /* "wal_checkpoint" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), + /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), + /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, + { /* zName: */ FzName: ts + 15771, /* "writable_schema" */ + /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), + /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), + /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, +} /* sqlite3.c:127968:25 */ + +// Number of pragmas: 67 on by default, 77 total. + +//************* End of pragma.h ********************************************* +//************* Continuing where we left off in pragma.c ******************** + +// Interpret the given string as a safety level. Return 0 for OFF, +// 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or +// unrecognized string argument. The FULL and EXTRA option is disallowed +// if the omitFull parameter it 1. +// +// Note that the values returned are one less that the values that +// should be passed into sqlite3BtreeSetSafetyLevel(). The is done +// to support legacy SQL code. The safety level used to be boolean +// and older scripts may have used numbers 0 for OFF and 1 for ON. +func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* sqlite3.c:128497:11: */ + // on no off false yes true extra full + var i int32 + var n int32 + if (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0 { + return U8(Xsqlite3Atoi(tls, z)) + } + n = Xsqlite3Strlen30(tls, z) + for i = 0; i < (int32(uint64(unsafe.Sizeof(iLength)) / uint64(unsafe.Sizeof(U8(0))))); i++ { + if ((int32(iLength[i]) == n) && (Xsqlite3_strnicmp(tls, (uintptr(unsafe.Pointer(&zText))+uintptr(iOffset[i])), z, n) == 0)) && + (!(omitFull != 0) || (int32(iValue[i]) <= 1)) { + return iValue[i] + } + } + return dflt +} + +var zText = *(*[25]int8)(unsafe.Pointer(ts + 15787 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ +var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ +var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ + +// Interpret the given string as a boolean value. +func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128522:19: */ + return (U8(libc.Bool32(int32(getSafetyLevel(tls, z, 1, dflt)) != 0))) +} + +// The sqlite3GetBoolean() function is used by other modules but the +// remainder of this file is specific to PRAGMA processing. So omit +// the rest of the file if PRAGMAs are omitted from the build. + +// Interpret the given string as a locking mode value. +func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ + if z != 0 { + if 0 == Xsqlite3StrICmp(tls, z, ts+15812 /* "exclusive" */) { + return PAGER_LOCKINGMODE_EXCLUSIVE + } + if 0 == Xsqlite3StrICmp(tls, z, ts+15822 /* "normal" */) { + return PAGER_LOCKINGMODE_NORMAL + } + } + return -1 +} + +// Interpret the given string as an auto-vacuum mode value. +// +// The following strings, "none", "full" and "incremental" are +// acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. +func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ + var i int32 + if 0 == Xsqlite3StrICmp(tls, z, ts+15829 /* "none" */) { + return BTREE_AUTOVACUUM_NONE + } + if 0 == Xsqlite3StrICmp(tls, z, ts+15834 /* "full" */) { + return BTREE_AUTOVACUUM_FULL + } + if 0 == Xsqlite3StrICmp(tls, z, ts+15839 /* "incremental" */) { + return BTREE_AUTOVACUUM_INCR + } + i = Xsqlite3Atoi(tls, z) + return int32(func() uint8 { + if (i >= 0) && (i <= 2) { + return uint8(i) + } + return uint8(0) + }()) +} + +// Interpret the given string as a temp db location. Return 1 for file +// backed temporary databases, 2 for the Red-Black tree in memory database +// and 0 to use the compile-time default. +func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ + if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { + return (int32(*(*int8)(unsafe.Pointer(z))) - '0') + } else if Xsqlite3StrICmp(tls, z, ts+14769 /* "file" */) == 0 { + return 1 + } else if Xsqlite3StrICmp(tls, z, ts+15851 /* "memory" */) == 0 { + return 2 + } else { + return 0 + } + return int32(0) +} + +// Invalidate temp storage, either when the temp storage is changed +// from default, or when 'file' and the temp_store_directory has changed +func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:128584:12: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt != uintptr(0) { + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || + (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) != SQLITE_TXN_NONE) { + Xsqlite3ErrorMsg(tls, pParse, + ts+15858 /* "temporary storag..." */, 0) + return SQLITE_ERROR + } + Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FpBt = uintptr(0) + Xsqlite3ResetAllSchemasOfConnection(tls, db) + } + return SQLITE_OK +} + +// If the TEMP database is open, close it and mark the database schema +// as needing reloading. This must be done when using the SQLITE_TEMP_STORE +// or DEFAULT_TEMP_STORE pragmas. +func changeTempStorage(tls *libc.TLS, pParse uintptr, zStorageType uintptr) int32 { /* sqlite3.c:128608:12: */ + var ts int32 = getTempStore(tls, zStorageType) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if int32((*Sqlite3)(unsafe.Pointer(db)).Ftemp_store) == ts { + return SQLITE_OK + } + if invalidateTempStorage(tls, pParse) != SQLITE_OK { + return SQLITE_ERROR + } + (*Sqlite3)(unsafe.Pointer(db)).Ftemp_store = U8(ts) + return SQLITE_OK +} + +// Set result column names for a pragma. +func setPragmaResultColumnNames(tls *libc.TLS, v uintptr, pPragma uintptr) { /* sqlite3.c:128623:13: */ + var n U8 = (*PragmaName)(unsafe.Pointer(pPragma)).FnPragCName + Xsqlite3VdbeSetNumCols(tls, v, func() int32 { + if int32(n) == 0 { + return 1 + } + return int32(n) + }()) + if int32(n) == 0 { + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, (*PragmaName)(unsafe.Pointer(pPragma)).FzName, uintptr(0)) + } else { + var i int32 + var j int32 + i = 0 + j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) + __1: + if !(i < int32(n)) { + goto __3 + } + { + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, pragCName[j], uintptr(0)) + + } + goto __2 + __2: + i++ + j++ + goto __1 + goto __3 + __3: + } +} + +// Generate code to return a single integer value. +func returnSingleInt(tls *libc.TLS, v uintptr, value I64) { /* sqlite3.c:128642:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*I64)(unsafe.Pointer(bp)) = value + + Xsqlite3VdbeAddOp4Dup8(tls, v, OP_Int64, 0, 1, 0, bp /* &value */, -14) + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 1, 1) +} + +// Generate code to return a single text value. +func returnSingleText(tls *libc.TLS, v uintptr, zValue uintptr) { /* sqlite3.c:128650:13: */ + if zValue != 0 { + Xsqlite3VdbeLoadString(tls, v, 1, zValue) + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 1, 1) + } +} + +// Set the safety_level and pager flags for pager iDb. Or if iDb<0 +// set these values for all pagers. +func setAllPagerFlags(tls *libc.TLS, db uintptr) { /* sqlite3.c:128666:13: */ + if (*Sqlite3)(unsafe.Pointer(db)).FautoCommit != 0 { + var pDb uintptr = (*Sqlite3)(unsafe.Pointer(db)).FaDb + var n int32 = (*Sqlite3)(unsafe.Pointer(db)).FnDb + + for (libc.PostDecInt32(&n, 1)) > 0 { + if (*Db)(unsafe.Pointer(pDb)).FpBt != 0 { + Xsqlite3BtreeSetPagerFlags(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, + (uint32(U64((*Db)(unsafe.Pointer(pDb)).Fsafety_level) | ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(PAGER_FLAGS_MASK))))) + } + pDb += 32 + } + } +} + +// Return a human-readable name for a constraint resolution action. +func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ + var zName uintptr + switch int32(action) { + case OE_SetNull: + zName = ts + 15920 /* "SET NULL" */ + break + case OE_SetDflt: + zName = ts + 15929 /* "SET DEFAULT" */ + break + case OE_Cascade: + zName = ts + 15941 /* "CASCADE" */ + break + case OE_Restrict: + zName = ts + 15949 /* "RESTRICT" */ + break + default: + zName = ts + 15958 /* "NO ACTION" */ + break + } + return zName +} + +// Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants +// defined in pager.h. This function returns the associated lowercase +// journal-mode name. +func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c:128714:27: */ + + if eMode == (int32(uint64(unsafe.Sizeof(azModeName)) / uint64(unsafe.Sizeof(uintptr(0))))) { + return uintptr(0) + } + return azModeName[eMode] +} + +var azModeName = [6]uintptr{ + ts + 15968 /* "delete" */, ts + 15975 /* "persist" */, ts + 15983 /* "off" */, ts + 15987 /* "truncate" */, ts + 15851 /* "memory" */, ts + 15996, /* "wal" */ +} /* sqlite3.c:128715:15 */ + +// Locate a pragma in the aPragmaName[] array. +func pragmaLocate(tls *libc.TLS, zName uintptr) uintptr { /* sqlite3.c:128736:25: */ + var upr int32 + var lwr int32 + var mid int32 = 0 + var rc int32 + lwr = 0 + upr = ((int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{})))) - 1) + for lwr <= upr { + mid = ((lwr + upr) / 2) + rc = Xsqlite3_stricmp(tls, zName, aPragmaName[mid].FzName) + if rc == 0 { + break + } + if rc < 0 { + upr = (mid - 1) + } else { + lwr = (mid + 1) + } + } + if lwr > upr { + return uintptr(0) + } + return (uintptr(unsafe.Pointer(&aPragmaName)) + uintptr(mid)*24) +} + +// Create zero or more entries in the output for the SQL functions +// defined by FuncDef p. +func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, showInternFuncs int32) { /* sqlite3.c:128757:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + for ; p != 0; p = (*FuncDef)(unsafe.Pointer(p)).FpNext { + var zType uintptr + + if (*FuncDef)(unsafe.Pointer(p)).FxSFunc == uintptr(0) { + continue + } + if (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_INTERNAL)) != U32(0)) && + (showInternFuncs == 0) { + continue + } + if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { + zType = ts + 16000 /* "w" */ + } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { + zType = ts + 16002 /* "a" */ + } else { + zType = ts + 16004 /* "s" */ + } + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16006, /* "sissii" */ + libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, + zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], + int32((*FuncDef)(unsafe.Pointer(p)).FnArg), + (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&mask)^U32(SQLITE_INNOCUOUS)))) + } +} + +var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16013 /* "utf8" */, ts + 16018 /* "utf16le" */, ts + 16026 /* "utf16be" */} /* sqlite3.c:128772:23 */ + +// Helper subroutine for PRAGMA integrity_check: +// +// Generate code to output a single-column result row with a value of the +// string held in register 3. Decrement the result count in register 1 +// and halt if the maximum number of result rows have been issued. +func integrityCheckResultRow(tls *libc.TLS, v uintptr) int32 { /* sqlite3.c:128809:12: */ + var addr int32 + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 3, 1) + addr = Xsqlite3VdbeAddOp3(tls, v, OP_IfPos, 1, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), 1) + + Xsqlite3VdbeAddOp0(tls, v, OP_Halt) + return addr +} + +// Process a pragma statement. +// +// Pragmas are of this form: +// +// PRAGMA [schema.]id [= value] +// +// The identifier might also be a string. The value is a string, and +// identifier, or a number. If minusFlag is true, then the value is +// a number that was preceded by a minus sign. +// +// If the left side is "database.id" then pId1 is the database name +// and pId2 is the id. If the left side is just "id" then pId1 is the +// id and pId2 is any empty string. +func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { /* sqlite3.c:128833:21: */ + bp := tls.Alloc(528) + defer tls.Free(528) + + var zLeft uintptr // Nul-terminated UTF-8 string + var zRight uintptr // Nul-terminated UTF-8 string , or NULL + var zDb uintptr // The database name + // var pId uintptr at bp+360, 8 + // Pointer to token + // var aFcntl [4]uintptr at bp+368, 32 + // Argument to SQLITE_FCNTL_PRAGMA + var iDb int32 // Database index for + var rc int32 // return value form SQLITE_FCNTL_PRAGMA + var db uintptr // The database connection + var pDb uintptr // The specific database being pragmaed + var v uintptr // Prepared statement + var pPragma uintptr + var size int32 + var aOp uintptr + var size1 int32 + var pBt uintptr + var ii int32 + var pBt1 uintptr + var b int32 + var iReg int32 + // var x I64 at bp+400, 8 + + // This indicates that no database name was specified as part + // of the PRAGMA command. In this case the locking-mode must be + // set on all attached databases, as well as the main db file. + // + // Also, the sqlite3.dfltLockMode variable is set so that + // any subsequently attached databases also use the specified + // locking mode. + var ii1 int32 + var pPager uintptr + var zRet uintptr + var eMode int32 + var zMode uintptr + var n int32 + var eMode1 int32 // One of the PAGER_JOURNALMODE_XXX symbols + var ii2 int32 + var pPager1 uintptr + // var iLimit I64 at bp+408, 8 + + var aOp1 uintptr + var iAddr int32 + var eAuto int32 + var pBt2 uintptr + // var iLimit1 int32 at bp+416, 4 + + var addr int32 + var size2 int32 + // var size3 int32 at bp+420, 4 + + var ii3 int32 + // var sz Sqlite3_int64 at bp+424, 8 + + // var res int32 at bp+432, 4 + + var iLevel int32 + var mask U64 + var isHidden int32 + var i int32 + var k int32 + var nHidden int32 + var pCol uintptr + var pPk uintptr + var pTab uintptr + var cnum I16 + var iIdxDb int32 + var i1 int32 + var mx int32 + var pIdx uintptr + var pTab1 uintptr + // var azOrigin [3]uintptr at bp+440, 24 + + var iTabDb int32 + var pIdx1 uintptr + var pTab2 uintptr + var i2 int32 + var i3 int32 + var pColl uintptr + var i4 int32 + var p uintptr + var i5 int32 + var j uintptr + var p1 uintptr + var showInternFunc int32 + var pMod uintptr + var j1 uintptr + var i6 int32 + var j2 int32 + var iTabDb1 int32 + var i7 int32 + var pFK uintptr + var pTab3 uintptr + var iCol int32 + var jmp int32 + var pFK1 uintptr // A foreign key constraint + var pTab4 uintptr // Child table contain "REFERENCES" keyword + var pParent uintptr // Parent table that child points to + // var pIdx2 uintptr at bp+464, 8 + // Index in the parent table + var i8 int32 // Loop counter: Foreign key number for pTab + var j3 int32 // Loop counter: Field of the foreign key + var k1 uintptr // Loop counter: Next table in schema + var x1 int32 // result variable + var regResult int32 // 3 registers to hold a result row + var regKey int32 // Register to hold key for checking the FK + var regRow int32 // Registers to hold a row from pTab + var addrTop int32 // Top of a loop checking foreign keys + var addrOk int32 // Jump here if the key is OK + // var aiCols uintptr at bp+472, 8 + + var pTab5 uintptr // Current table + var pIdx3 uintptr // An index on pTab + var nIdx int32 + var pTab6 uintptr + var pIdx4 uintptr + var zErr uintptr + var jmp2 int32 + var addrCkFault int32 + var addrCkOk int32 + var zErr1 uintptr + var k2 int32 + var pCheck uintptr + var iCol1 int32 + var uniqOk int32 + var jmp6 int32 + var kk int32 + var jmp21 int32 + // var jmp3 int32 at bp+492, 4 + + var jmp4 int32 + var jmp5 int32 + var ckUniq int32 + var pTab7 uintptr + var pIdx5 uintptr + var pPk1 uintptr + var pPrior uintptr + var loopTop int32 + // var iDataCur int32 at bp+484, 4 + + // var iIdxCur int32 at bp+488, 4 + + var r1 int32 + var x2 uintptr // For looping over tables in the schema + var pTbls uintptr // Set of all tables in the schema + var aRoot uintptr // Array of root page numbers of all btrees + var cnt int32 // Number of entries in aRoot[] + var mxIdx int32 + var aOp2 uintptr + var i9 int32 + var j4 int32 + var addr1 int32 + // var mxErr int32 at bp+480, 4 + + var pObjTab uintptr // Check only this one table, if not NULL + + var isQuick int32 + var enc U8 + var pEnc uintptr + var aOp3 uintptr + var aOp4 uintptr + var iCookie int32 + var i10 int32 + var zOpt uintptr + var iBt int32 + var eMode2 int32 + var r11 int32 + var iDbLast int32 // Loop termination point for the schema loop + var iTabCur int32 // Cursor for a table whose size needs checking + var k3 uintptr // Loop over tables of a schema + var pSchema uintptr // The current schema + var pTab8 uintptr // A table in the schema + var pIdx6 uintptr // An index of the table + var szThreshold LogEst // Size threshold above which reanalysis is needd + var zSubSql uintptr // SQL statement for the OP_SqlExec opcode + var opMask U32 + // var N Sqlite3_int64 at bp+496, 8 + + var iPrior Sqlite3_int64 + // var N1 Sqlite3_int64 at bp+504, 8 + + // var N2 Sqlite3_int64 at bp+512, 8 + + // var N3 Sqlite3_int64 at bp+520, 8 + zLeft = uintptr(0) + zRight = uintptr(0) + zDb = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + v = Xsqlite3GetVdbe(tls, pParse) // The pragma + + if !(v == uintptr(0)) { + goto __1 + } + return +__1: + ; + Xsqlite3VdbeRunOnlyOnce(tls, v) + (*Parse)(unsafe.Pointer(pParse)).FnMem = 2 + + // Interpret the [schema.] part of the pragma statement. iDb is the + // index of the database this pragma is being applied to in db.aDb[]. + iDb = Xsqlite3TwoPartName(tls, pParse, pId1, pId2, bp+360 /* &pId */) + if !(iDb < 0) { + goto __2 + } + return +__2: + ; + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + + // If the temp database has been explicitly named as part of the + // pragma, make sure it is open. + if !((iDb == 1) && (Xsqlite3OpenTempDatabase(tls, pParse) != 0)) { + goto __3 + } + return +__3: + ; + + zLeft = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 360 /* pId */))) + if !(!(zLeft != 0)) { + goto __4 + } + return +__4: + ; + if !(minusFlag != 0) { + goto __5 + } + zRight = Xsqlite3MPrintf(tls, db, ts+16034 /* "-%T" */, libc.VaList(bp, pValue)) + goto __6 +__5: + zRight = Xsqlite3NameFromToken(tls, db, pValue) +__6: + ; + + if (*Token)(unsafe.Pointer(pId2)).Fn > uint32(0) { + zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName + } else { + zDb = uintptr(0) + } + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) != 0) { + goto __7 + } + goto pragma_out +__7: + ; + + // Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS + // connection. If it returns SQLITE_OK, then assume that the VFS + // handled the pragma and generate a no-op prepared statement. + // + // IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed, + // an SQLITE_FCNTL_PRAGMA file control is sent to the open sqlite3_file + // object corresponding to the database file to which the pragma + // statement refers. + // + // IMPLEMENTATION-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA + // file control is an array of pointers to strings (char**) in which the + // second element of the array is the name of the pragma and the third + // element is the argument to the pragma or NULL if the pragma has no + // argument. + *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */ + 1*8)) = zLeft + *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */ + 2*8)) = zRight + *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */ + 3*8)) = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + rc = Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_PRAGMA, bp+368 /* aFcntl */) + if !(rc == SQLITE_OK) { + goto __8 + } + Xsqlite3VdbeSetNumCols(tls, v, 1) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)), libc.UintptrFromInt32(-1)) + returnSingleText(tls, v, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) + goto pragma_out +__8: + ; + if !(rc != SQLITE_NOTFOUND) { + goto __9 + } + if !(*(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)) != 0) { + goto __10 + } + Xsqlite3ErrorMsg(tls, pParse, ts+2791 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) +__10: + ; + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + (*Parse)(unsafe.Pointer(pParse)).Frc = rc + goto pragma_out +__9: + ; + + // Locate the pragma in the lookup table + pPragma = pragmaLocate(tls, zLeft) + if !(pPragma == uintptr(0)) { + goto __11 + } + goto pragma_out +__11: + ; + + // Make sure the database schema is loaded if the pragma requires that + if !((int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_NeedSchema) != 0) { + goto __12 + } + if !(Xsqlite3ReadSchema(tls, pParse) != 0) { + goto __13 + } + goto pragma_out +__13: + ; +__12: + ; + + // Register the result column names for pragmas that return results + if !(((int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_NoColumns) == 0) && + (((int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_NoColumns1) == 0) || (zRight == uintptr(0)))) { + goto __14 + } + setPragmaResultColumnNames(tls, v, pPragma) +__14: + ; + + // Jump to the appropriate pragma handler + switch int32((*PragmaName)(unsafe.Pointer(pPragma)).FePragTyp) { + + // PRAGMA [schema.]default_cache_size + // PRAGMA [schema.]default_cache_size=N + // + // The first form reports the current persistent setting for the + // page cache size. The value returned is the maximum number of + // pages in the page cache. The second form sets both the current + // page cache size value and the persistent page cache size value + // stored in the database file. + // + // Older versions of SQLite would set the default cache size to a + // negative number to indicate synchronous=OFF. These days, synchronous + // is always on by default regardless of the sign of the default cache + // size. But continue to take the absolute value of the default cache + // size of historical compatibility. + case PragTyp_DEFAULT_CACHE_SIZE: + goto __16 + + // PRAGMA [schema.]page_size + // PRAGMA [schema.]page_size=N + // + // The first form reports the current setting for the + // database page size in bytes. The second form sets the + // database page size value. The value can only be set if + // the database has not yet been created. + case PragTyp_PAGE_SIZE: + goto __17 + + // PRAGMA [schema.]secure_delete + // PRAGMA [schema.]secure_delete=ON/OFF/FAST + // + // The first form reports the current setting for the + // secure_delete flag. The second form changes the secure_delete + // flag setting and reports the new value. + case PragTyp_SECURE_DELETE: + goto __18 + + // PRAGMA [schema.]max_page_count + // PRAGMA [schema.]max_page_count=N + // + // The first form reports the current setting for the + // maximum number of pages in the database file. The + // second form attempts to change this setting. Both + // forms return the current setting. + // + // The absolute value of N is used. This is undocumented and might + // change. The only purpose is to provide an easy way to test + // the sqlite3AbsInt32() function. + // + // PRAGMA [schema.]page_count + // + // Return the number of pages in the specified database. + case PragTyp_PAGE_COUNT: + goto __19 + + // PRAGMA [schema.]locking_mode + // PRAGMA [schema.]locking_mode = (normal|exclusive) + case PragTyp_LOCKING_MODE: + goto __20 + + // PRAGMA [schema.]journal_mode + // PRAGMA [schema.]journal_mode = + // (delete|persist|off|truncate|memory|wal|off) + case PragTyp_JOURNAL_MODE: + goto __21 + + // PRAGMA [schema.]journal_size_limit + // PRAGMA [schema.]journal_size_limit=N + // + // Get or set the size limit on rollback journal files. + case PragTyp_JOURNAL_SIZE_LIMIT: + goto __22 + + // PRAGMA [schema.]auto_vacuum + // PRAGMA [schema.]auto_vacuum=N + // + // Get or set the value of the database 'auto-vacuum' parameter. + // The value is one of: 0 NONE 1 FULL 2 INCREMENTAL + case PragTyp_AUTO_VACUUM: + goto __23 + + // PRAGMA [schema.]incremental_vacuum(N) + // + // Do N steps of incremental vacuuming on a database. + case PragTyp_INCREMENTAL_VACUUM: + goto __24 + + // PRAGMA [schema.]cache_size + // PRAGMA [schema.]cache_size=N + // + // The first form reports the current local setting for the + // page cache size. The second form sets the local + // page cache size value. If N is positive then that is the + // number of pages in the cache. If N is negative, then the + // number of pages is adjusted so that the cache uses -N kibibytes + // of memory. + case PragTyp_CACHE_SIZE: + goto __25 + + // PRAGMA [schema.]cache_spill + // PRAGMA cache_spill=BOOLEAN + // PRAGMA [schema.]cache_spill=N + // + // The first form reports the current local setting for the + // page cache spill size. The second form turns cache spill on + // or off. When turnning cache spill on, the size is set to the + // current cache_size. The third form sets a spill size that + // may be different form the cache size. + // If N is positive then that is the + // number of pages in the cache. If N is negative, then the + // number of pages is adjusted so that the cache uses -N kibibytes + // of memory. + // + // If the number of cache_spill pages is less then the number of + // cache_size pages, no spilling occurs until the page count exceeds + // the number of cache_size pages. + // + // The cache_spill=BOOLEAN setting applies to all attached schemas, + // not just the schema specified. + case PragTyp_CACHE_SPILL: + goto __26 + + // PRAGMA [schema.]mmap_size(N) + // + // Used to set mapping size limit. The mapping size limit is + // used to limit the aggregate size of all memory mapped regions of the + // database file. If this parameter is set to zero, then memory mapping + // is not used at all. If N is negative, then the default memory map + // limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set. + // The parameter N is measured in bytes. + // + // This value is advisory. The underlying VFS is free to memory map + // as little or as much as it wants. Except, if N is set to 0 then the + // upper layers will never invoke the xFetch interfaces to the VFS. + case PragTyp_MMAP_SIZE: + goto __27 + + // PRAGMA temp_store + // PRAGMA temp_store = "default"|"memory"|"file" + // + // Return or set the local value of the temp_store flag. Changing + // the local value does not make changes to the disk file and the default + // value will be restored the next time the database is opened. + // + // Note that it is possible for the library compile-time options to + // override this setting + case PragTyp_TEMP_STORE: + goto __28 + + // PRAGMA temp_store_directory + // PRAGMA temp_store_directory = ""|"directory_name" + // + // Return or set the local value of the temp_store_directory flag. Changing + // the value sets a specific directory to be used for temporary files. + // Setting to a null string reverts to the default temporary directory search. + // If temporary directory is changed, then invalidateTempStorage. + // + case PragTyp_TEMP_STORE_DIRECTORY: + goto __29 + + // PRAGMA [schema.]synchronous + // PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA + // + // Return or set the local value of the synchronous flag. Changing + // the local value does not make changes to the disk file and the + // default value will be restored the next time the database is + // opened. + case PragTyp_SYNCHRONOUS: + goto __30 + + case PragTyp_FLAG: + goto __31 + + // PRAGMA table_info(
) + // + // Return a single row for each column of the named table. The columns of + // the returned data set are: + // + // cid: Column id (numbered from left to right, starting at 0) + // name: Column name + // type: Column declaration type. + // notnull: True if 'NOT NULL' is part of column declaration + // dflt_value: The default value for the column, if any. + // pk: Non-zero for PK fields. + case PragTyp_TABLE_INFO: + goto __32 + + case PragTyp_INDEX_INFO: + goto __33 + + case PragTyp_INDEX_LIST: + goto __34 + + case PragTyp_DATABASE_LIST: + goto __35 + + case PragTyp_COLLATION_LIST: + goto __36 + + case PragTyp_FUNCTION_LIST: + goto __37 + + case PragTyp_MODULE_LIST: + goto __38 + + case PragTyp_PRAGMA_LIST: + goto __39 + + case PragTyp_FOREIGN_KEY_LIST: + goto __40 + + case PragTyp_FOREIGN_KEY_CHECK: + goto __41 + + // Reinstall the LIKE and GLOB functions. The variant of LIKE + // used will be case sensitive or not depending on the RHS. + case PragTyp_CASE_SENSITIVE_LIKE: + goto __42 + + // PRAGMA integrity_check + // PRAGMA integrity_check(N) + // PRAGMA quick_check + // PRAGMA quick_check(N) + // + // Verify the integrity of the database. + // + // The "quick_check" is reduced version of + // integrity_check designed to detect most database corruption + // without the overhead of cross-checking indexes. Quick_check + // is linear time wherease integrity_check is O(NlogN). + // + // The maximum nubmer of errors is 100 by default. A different default + // can be specified using a numeric parameter N. + // + // Or, the parameter N can be the name of a table. In that case, only + // the one table named is verified. The freelist is only verified if + // the named table is "sqlite_schema" (or one of its aliases). + // + // All schemas are checked by default. To check just a single + // schema, use the form: + // + // PRAGMA schema.integrity_check; + case PragTyp_INTEGRITY_CHECK: + goto __43 + + // PRAGMA encoding + // PRAGMA encoding = "utf-8"|"utf-16"|"utf-16le"|"utf-16be" + // + // In its first form, this pragma returns the encoding of the main + // database. If the database is not initialized, it is initialized now. + // + // The second form of this pragma is a no-op if the main database file + // has not already been initialized. In this case it sets the default + // encoding that will be used for the main database file if a new file + // is created. If an existing main database file is opened, then the + // default text encoding for the existing database is used. + // + // In all cases new databases created using the ATTACH command are + // created to use the same default text encoding as the main database. If + // the main database has not been initialized and/or created when ATTACH + // is executed, this is done before the ATTACH operation. + // + // In the second form this pragma sets the text encoding to be used in + // new database files created using this database handle. It is only + // useful if invoked immediately after the main database i + case PragTyp_ENCODING: + goto __44 + + // PRAGMA [schema.]schema_version + // PRAGMA [schema.]schema_version = + // + // PRAGMA [schema.]user_version + // PRAGMA [schema.]user_version = + // + // PRAGMA [schema.]freelist_count + // + // PRAGMA [schema.]data_version + // + // PRAGMA [schema.]application_id + // PRAGMA [schema.]application_id = + // + // The pragma's schema_version and user_version are used to set or get + // the value of the schema-version and user-version, respectively. Both + // the schema-version and the user-version are 32-bit signed integers + // stored in the database header. + // + // The schema-cookie is usually only manipulated internally by SQLite. It + // is incremented by SQLite whenever the database schema is modified (by + // creating or dropping a table or index). The schema version is used by + // SQLite each time a query is executed to ensure that the internal cache + // of the schema used when compiling the SQL query matches the schema of + // the database against which the compiled query is actually executed. + // Subverting this mechanism by using "PRAGMA schema_version" to modify + // the schema-version is potentially dangerous and may lead to program + // crashes or database corruption. Use with caution! + // + // The user-version is not used internally by SQLite. It may be used by + // applications for any purpose. + case PragTyp_HEADER_VALUE: + goto __45 + + // PRAGMA compile_options + // + // Return the names of all compile-time options used in this build, + // one option per row. + case PragTyp_COMPILE_OPTIONS: + goto __46 + + // PRAGMA [schema.]wal_checkpoint = passive|full|restart|truncate + // + // Checkpoint the database. + case PragTyp_WAL_CHECKPOINT: + goto __47 + + // PRAGMA wal_autocheckpoint + // PRAGMA wal_autocheckpoint = N + // + // Configure a database connection to automatically checkpoint a database + // after accumulating N frames in the log. Or query for the current value + // of N. + case PragTyp_WAL_AUTOCHECKPOINT: + goto __48 + + // PRAGMA shrink_memory + // + // IMPLEMENTATION-OF: R-23445-46109 This pragma causes the database + // connection on which it is invoked to free up as much memory as it + // can, by calling sqlite3_db_release_memory(). + case PragTyp_SHRINK_MEMORY: + goto __49 + + // PRAGMA optimize + // PRAGMA optimize(MASK) + // PRAGMA schema.optimize + // PRAGMA schema.optimize(MASK) + // + // Attempt to optimize the database. All schemas are optimized in the first + // two forms, and only the specified schema is optimized in the latter two. + // + // The details of optimizations performed by this pragma are expected + // to change and improve over time. Applications should anticipate that + // this pragma will perform new optimizations in future releases. + // + // The optional argument is a bitmask of optimizations to perform: + // + // 0x0001 Debugging mode. Do not actually perform any optimizations + // but instead return one line of text for each optimization + // that would have been done. Off by default. + // + // 0x0002 Run ANALYZE on tables that might benefit. On by default. + // See below for additional information. + // + // 0x0004 (Not yet implemented) Record usage and performance + // information from the current session in the + // database file so that it will be available to "optimize" + // pragmas run by future database connections. + // + // 0x0008 (Not yet implemented) Create indexes that might have + // been helpful to recent queries + // + // The default MASK is and always shall be 0xfffe. 0xfffe means perform all + // of the optimizations listed above except Debug Mode, including new + // optimizations that have not yet been invented. If new optimizations are + // ever added that should be off by default, those off-by-default + // optimizations will have bitmasks of 0x10000 or larger. + // + // DETERMINATION OF WHEN TO RUN ANALYZE + // + // In the current implementation, a table is analyzed if only if all of + // the following are true: + // + // (1) MASK bit 0x02 is set. + // + // (2) The query planner used sqlite_stat1-style statistics for one or + // more indexes of the table at some point during the lifetime of + // the current connection. + // + // (3) One or more indexes of the table are currently unanalyzed OR + // the number of rows in the table has increased by 25 times or more + // since the last time ANALYZE was run. + // + // The rules for when tables are analyzed are likely to change in + // future releases. + case PragTyp_OPTIMIZE: + goto __50 + + // PRAGMA busy_timeout + // PRAGMA busy_timeout = N + // + // Call sqlite3_busy_timeout(db, N). Return the current timeout value + // if one is set. If no busy handler or a different busy handler is set + // then 0 is returned. Setting the busy_timeout to 0 or negative + // disables the timeout. + /*case PragTyp_BUSY_TIMEOUT*/ + default: + goto __51 + + // PRAGMA soft_heap_limit + // PRAGMA soft_heap_limit = N + // + // IMPLEMENTATION-OF: R-26343-45930 This pragma invokes the + // sqlite3_soft_heap_limit64() interface with the argument N, if N is + // specified and is a non-negative integer. + // IMPLEMENTATION-OF: R-64451-07163 The soft_heap_limit pragma always + // returns the same integer that would be returned by the + // sqlite3_soft_heap_limit64(-1) C-language function. + case PragTyp_SOFT_HEAP_LIMIT: + goto __52 + + // PRAGMA hard_heap_limit + // PRAGMA hard_heap_limit = N + // + // Invoke sqlite3_hard_heap_limit64() to query or set the hard heap + // limit. The hard heap limit can be activated or lowered by this + // pragma, but not raised or deactivated. Only the + // sqlite3_hard_heap_limit64() C-language API can raise or deactivate + // the hard heap limit. This allows an application to set a heap limit + // constraint that cannot be relaxed by an untrusted SQL script. + case PragTyp_HARD_HEAP_LIMIT: + goto __53 + + // PRAGMA threads + // PRAGMA threads = N + // + // Configure the maximum number of worker threads. Return the new + // maximum, which might be less than requested. + case PragTyp_THREADS: + goto __54 + + // PRAGMA analysis_limit + // PRAGMA analysis_limit = N + // + // Configure the maximum number of rows that ANALYZE will examine + // in each index that it looks at. Return the new limit. + case PragTyp_ANALYSIS_LIMIT: + goto __55 + } + goto __15 + + // PRAGMA [schema.]default_cache_size + // PRAGMA [schema.]default_cache_size=N + // + // The first form reports the current persistent setting for the + // page cache size. The value returned is the maximum number of + // pages in the page cache. The second form sets both the current + // page cache size value and the persistent page cache size value + // stored in the database file. + // + // Older versions of SQLite would set the default cache size to a + // negative number to indicate synchronous=OFF. These days, synchronous + // is always on by default regardless of the sign of the default cache + // size. But continue to take the absolute value of the default cache + // size of historical compatibility. +__16: + Xsqlite3VdbeUsesBtree(tls, v, iDb) + if !(!(zRight != 0)) { + goto __56 + } + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (2) + + aOp = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(getCacheSize)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&getCacheSize)), iLn3) + if !(0 != 0) { + goto __58 + } + goto __15 +__58: + ; + (*VdbeOp)(unsafe.Pointer(aOp)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp + 1*24)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp + 6*24)).Fp1 = -2000 + goto __57 +__56: + size = Xsqlite3AbsInt32(tls, Xsqlite3Atoi(tls, zRight)) + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + Xsqlite3VdbeAddOp3(tls, v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, size) + + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size + Xsqlite3BtreeSetCacheSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) +__57: + ; + goto __15 + + // PRAGMA [schema.]page_size + // PRAGMA [schema.]page_size=N + // + // The first form reports the current setting for the + // database page size in bytes. The second form sets the + // database page size value. The value can only be set if + // the database has not yet been created. +__17: + pBt = (*Db)(unsafe.Pointer(pDb)).FpBt + + if !(!(zRight != 0)) { + goto __59 + } + if pBt != 0 { + size1 = Xsqlite3BtreeGetPageSize(tls, pBt) + } else { + size1 = 0 + } + returnSingleInt(tls, v, int64(size1)) + goto __60 +__59: + // Malloc may fail when setting the page-size, as there is an internal + // buffer that the pager module resizes using sqlite3_realloc(). + (*Sqlite3)(unsafe.Pointer(db)).FnextPagesize = Xsqlite3Atoi(tls, zRight) + if !(SQLITE_NOMEM == Xsqlite3BtreeSetPageSize(tls, pBt, (*Sqlite3)(unsafe.Pointer(db)).FnextPagesize, 0, 0)) { + goto __61 + } + Xsqlite3OomFault(tls, db) +__61: + ; +__60: + ; + goto __15 + + // PRAGMA [schema.]secure_delete + // PRAGMA [schema.]secure_delete=ON/OFF/FAST + // + // The first form reports the current setting for the + // secure_delete flag. The second form changes the secure_delete + // flag setting and reports the new value. +__18: + pBt1 = (*Db)(unsafe.Pointer(pDb)).FpBt + b = -1 + + if !(zRight != 0) { + goto __62 + } + if !(Xsqlite3_stricmp(tls, zRight, ts+16038 /* "fast" */) == 0) { + goto __63 + } + b = 2 + goto __64 +__63: + b = int32(Xsqlite3GetBoolean(tls, zRight, uint8(0))) +__64: + ; +__62: + ; + if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (b >= 0)) { + goto __65 + } + ii = 0 +__66: + if !(ii < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __68 + } + Xsqlite3BtreeSecureDelete(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii)*32)).FpBt, b) + goto __67 +__67: + ii++ + goto __66 + goto __68 +__68: + ; +__65: + ; + b = Xsqlite3BtreeSecureDelete(tls, pBt1, b) + returnSingleInt(tls, v, int64(b)) + goto __15 + + // PRAGMA [schema.]max_page_count + // PRAGMA [schema.]max_page_count=N + // + // The first form reports the current setting for the + // maximum number of pages in the database file. The + // second form attempts to change this setting. Both + // forms return the current setting. + // + // The absolute value of N is used. This is undocumented and might + // change. The only purpose is to provide an easy way to test + // the sqlite3AbsInt32() function. + // + // PRAGMA [schema.]page_count + // + // Return the number of pages in the specified database. +__19: + *(*I64)(unsafe.Pointer(bp + 400 /* x */)) = int64(0) + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + iReg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + if !((int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zLeft)))])) == 'p') { + goto __69 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Pagecount, iDb, iReg) + goto __70 +__69: + if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+400 /* &x */) == 0)) { + goto __71 + } + if !(*(*I64)(unsafe.Pointer(bp + 400 /* x */)) < int64(0)) { + goto __73 + } + *(*I64)(unsafe.Pointer(bp + 400 /* x */)) = int64(0) + goto __74 +__73: + if !(*(*I64)(unsafe.Pointer(bp + 400 /* x */)) > int64(0xfffffffe)) { + goto __75 + } + *(*I64)(unsafe.Pointer(bp + 400 /* x */)) = int64(0xfffffffe) +__75: + ; +__74: + ; + goto __72 +__71: + *(*I64)(unsafe.Pointer(bp + 400 /* x */)) = int64(0) +__72: + ; + Xsqlite3VdbeAddOp3(tls, v, OP_MaxPgcnt, iDb, iReg, int32(*(*I64)(unsafe.Pointer(bp + 400 /* x */)))) +__70: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, iReg, 1) + goto __15 + + // PRAGMA [schema.]locking_mode + // PRAGMA [schema.]locking_mode = (normal|exclusive) +__20: + zRet = ts + 15822 /* "normal" */ + eMode = getLockingMode(tls, zRight) + + if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { + goto __76 + } + // Simple "PRAGMA locking_mode;" statement. This is a query for + // the current default locking mode (which may be different to + // the locking-mode of the main database). + eMode = int32((*Sqlite3)(unsafe.Pointer(db)).FdfltLockMode) + goto __77 +__76: + if !((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) { + goto __78 + } + + ii1 = 2 +__79: + if !(ii1 < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __81 + } + pPager = Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii1)*32)).FpBt) + Xsqlite3PagerLockingMode(tls, pPager, eMode) + goto __80 +__80: + ii1++ + goto __79 + goto __81 +__81: + ; + (*Sqlite3)(unsafe.Pointer(db)).FdfltLockMode = U8(eMode) +__78: + ; + pPager = Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + eMode = Xsqlite3PagerLockingMode(tls, pPager, eMode) +__77: + ; + + if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { + goto __82 + } + zRet = ts + 15812 /* "exclusive" */ +__82: + ; + returnSingleText(tls, v, zRet) + goto __15 + + // PRAGMA [schema.]journal_mode + // PRAGMA [schema.]journal_mode = + // (delete|persist|off|truncate|memory|wal|off) +__21: // Loop counter + + if !(zRight == uintptr(0)) { + goto __83 + } + // If there is no "=MODE" part of the pragma, do a query for the + // current mode + eMode1 = -1 + goto __84 +__83: + n = Xsqlite3Strlen30(tls, zRight) + eMode1 = 0 +__85: + if !((libc.AssignUintptr(&zMode, Xsqlite3JournalModename(tls, eMode1))) != uintptr(0)) { + goto __87 + } + if !(Xsqlite3_strnicmp(tls, zRight, zMode, n) == 0) { + goto __88 + } + goto __87 +__88: + ; + goto __86 +__86: + eMode1++ + goto __85 + goto __87 +__87: + ; + if !(!(zMode != 0)) { + goto __89 + } + // If the "=MODE" part does not match any known journal mode, + // then do a query + eMode1 = -1 +__89: + ; + if !((eMode1 == PAGER_JOURNALMODE_OFF) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_Defensive)) != uint64(0))) { + goto __90 + } + // Do not allow journal-mode "OFF" in defensive since the database + // can become corrupted using ordinary SQL when the journal is off + eMode1 = -1 +__90: + ; +__84: + ; + if !((eMode1 == (-1)) && ((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0))) { + goto __91 + } + // Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" + iDb = 0 + (*Token)(unsafe.Pointer(pId2)).Fn = uint32(1) +__91: + ; + ii2 = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) +__92: + if !(ii2 >= 0) { + goto __94 + } + if !(((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii2)*32)).FpBt != 0) && ((ii2 == iDb) || ((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)))) { + goto __95 + } + Xsqlite3VdbeUsesBtree(tls, v, ii2) + Xsqlite3VdbeAddOp3(tls, v, OP_JournalMode, ii2, 1, eMode1) +__95: + ; + goto __93 +__93: + ii2-- + goto __92 + goto __94 +__94: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 1, 1) + goto __15 + + // PRAGMA [schema.]journal_size_limit + // PRAGMA [schema.]journal_size_limit=N + // + // Get or set the size limit on rollback journal files. +__22: + pPager1 = Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + *(*I64)(unsafe.Pointer(bp + 408 /* iLimit */)) = int64(-2) + if !(zRight != 0) { + goto __96 + } + Xsqlite3DecOrHexToI64(tls, zRight, bp+408 /* &iLimit */) + if !(*(*I64)(unsafe.Pointer(bp + 408 /* iLimit */)) < int64(-1)) { + goto __97 + } + *(*I64)(unsafe.Pointer(bp + 408 /* iLimit */)) = int64(-1) +__97: + ; +__96: + ; + *(*I64)(unsafe.Pointer(bp + 408 /* iLimit */)) = Xsqlite3PagerJournalSizeLimit(tls, pPager1, *(*I64)(unsafe.Pointer(bp + 408 /* iLimit */))) + returnSingleInt(tls, v, *(*I64)(unsafe.Pointer(bp + 408 /* iLimit */))) + goto __15 + + // PRAGMA [schema.]auto_vacuum + // PRAGMA [schema.]auto_vacuum=N + // + // Get or set the value of the database 'auto-vacuum' parameter. + // The value is one of: 0 NONE 1 FULL 2 INCREMENTAL +__23: + pBt2 = (*Db)(unsafe.Pointer(pDb)).FpBt + + if !(!(zRight != 0)) { + goto __98 + } + returnSingleInt(tls, v, int64(Xsqlite3BtreeGetAutoVacuum(tls, pBt2))) + goto __99 +__98: + eAuto = getAutoVacuum(tls, zRight) + + (*Sqlite3)(unsafe.Pointer(db)).FnextAutovac = int8(U8(eAuto)) + // Call SetAutoVacuum() to set initialize the internal auto and + // incr-vacuum flags. This is required in case this connection + // creates the database file. It is important that it is created + // as an auto-vacuum capable db. + rc = Xsqlite3BtreeSetAutoVacuum(tls, pBt2, eAuto) + if !((rc == SQLITE_OK) && ((eAuto == 1) || (eAuto == 2))) { + goto __100 + } + iAddr = Xsqlite3VdbeCurrentAddr(tls, v) + + aOp1 = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(setMeta6)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&setMeta6)), iLn4) + if !(0 != 0) { + goto __101 + } + goto __15 +__101: + ; + (*VdbeOp)(unsafe.Pointer(aOp1)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp1 + 1*24)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp1 + 2*24)).Fp2 = (iAddr + 4) + (*VdbeOp)(unsafe.Pointer(aOp1 + 4*24)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp1 + 4*24)).Fp3 = (eAuto - 1) + Xsqlite3VdbeUsesBtree(tls, v, iDb) +__100: + ; +__99: + ; + goto __15 + + // PRAGMA [schema.]incremental_vacuum(N) + // + // Do N steps of incremental vacuuming on a database. +__24: + if !(((zRight == uintptr(0)) || !(Xsqlite3GetInt32(tls, zRight, bp+416 /* &iLimit1 */) != 0)) || (*(*int32)(unsafe.Pointer(bp + 416 /* iLimit1 */)) <= 0)) { + goto __102 + } + *(*int32)(unsafe.Pointer(bp + 416 /* iLimit1 */)) = 0x7fffffff +__102: + ; + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, *(*int32)(unsafe.Pointer(bp + 416 /* iLimit1 */)), 1) + addr = Xsqlite3VdbeAddOp1(tls, v, OP_IncrVacuum, iDb) + Xsqlite3VdbeAddOp1(tls, v, OP_ResultRow, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, 1, -1) + Xsqlite3VdbeAddOp2(tls, v, OP_IfPos, 1, addr) + Xsqlite3VdbeJumpHere(tls, v, addr) + goto __15 + + // PRAGMA [schema.]cache_size + // PRAGMA [schema.]cache_size=N + // + // The first form reports the current local setting for the + // page cache size. The second form sets the local + // page cache size value. If N is positive then that is the + // number of pages in the cache. If N is negative, then the + // number of pages is adjusted so that the cache uses -N kibibytes + // of memory. +__25: + ; + if !(!(zRight != 0)) { + goto __103 + } + returnSingleInt(tls, v, int64((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size)) + goto __104 +__103: + size2 = Xsqlite3Atoi(tls, zRight) + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size2 + Xsqlite3BtreeSetCacheSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) +__104: + ; + goto __15 + + // PRAGMA [schema.]cache_spill + // PRAGMA cache_spill=BOOLEAN + // PRAGMA [schema.]cache_spill=N + // + // The first form reports the current local setting for the + // page cache spill size. The second form turns cache spill on + // or off. When turnning cache spill on, the size is set to the + // current cache_size. The third form sets a spill size that + // may be different form the cache size. + // If N is positive then that is the + // number of pages in the cache. If N is negative, then the + // number of pages is adjusted so that the cache uses -N kibibytes + // of memory. + // + // If the number of cache_spill pages is less then the number of + // cache_size pages, no spilling occurs until the page count exceeds + // the number of cache_size pages. + // + // The cache_spill=BOOLEAN setting applies to all attached schemas, + // not just the schema specified. +__26: + ; + if !(!(zRight != 0)) { + goto __105 + } + returnSingleInt(tls, v, + func() int64 { + if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_CacheSpill)) == uint64(0) { + return int64(0) + } + return int64(Xsqlite3BtreeSetSpillSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, 0)) + }()) + goto __106 +__105: + *(*int32)(unsafe.Pointer(bp + 420 /* size3 */)) = 1 + if !(Xsqlite3GetInt32(tls, zRight, bp+420 /* &size3 */) != 0) { + goto __107 + } + Xsqlite3BtreeSetSpillSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, *(*int32)(unsafe.Pointer(bp + 420 /* size3 */))) +__107: + ; + if !(Xsqlite3GetBoolean(tls, zRight, (uint8(libc.Bool32(*(*int32)(unsafe.Pointer(bp + 420 /* size3 */)) != 0)))) != 0) { + goto __108 + } + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(SQLITE_CacheSpill)) + goto __109 +__108: + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_CacheSpill))) +__109: + ; + setAllPagerFlags(tls, db) +__106: + ; + goto __15 + + // PRAGMA [schema.]mmap_size(N) + // + // Used to set mapping size limit. The mapping size limit is + // used to limit the aggregate size of all memory mapped regions of the + // database file. If this parameter is set to zero, then memory mapping + // is not used at all. If N is negative, then the default memory map + // limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set. + // The parameter N is measured in bytes. + // + // This value is advisory. The underlying VFS is free to memory map + // as little or as much as it wants. Except, if N is set to 0 then the + // upper layers will never invoke the xFetch interfaces to the VFS. +__27: + ; + if !(zRight != 0) { + goto __110 + } + Xsqlite3DecOrHexToI64(tls, zRight, bp+424 /* &sz */) + if !(*(*Sqlite3_int64)(unsafe.Pointer(bp + 424 /* sz */)) < int64(0)) { + goto __111 + } + *(*Sqlite3_int64)(unsafe.Pointer(bp + 424 /* sz */)) = Xsqlite3Config.FszMmap +__111: + ; + if !((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) { + goto __112 + } + (*Sqlite3)(unsafe.Pointer(db)).FszMmap = *(*Sqlite3_int64)(unsafe.Pointer(bp + 424 /* sz */)) +__112: + ; + ii3 = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) +__113: + if !(ii3 >= 0) { + goto __115 + } + if !(((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii3)*32)).FpBt != 0) && ((ii3 == iDb) || ((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)))) { + goto __116 + } + Xsqlite3BtreeSetMmapLimit(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii3)*32)).FpBt, *(*Sqlite3_int64)(unsafe.Pointer(bp + 424 /* sz */))) +__116: + ; + goto __114 +__114: + ii3-- + goto __113 + goto __115 +__115: + ; +__110: + ; + *(*Sqlite3_int64)(unsafe.Pointer(bp + 424 /* sz */)) = int64(-1) + rc = Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_MMAP_SIZE, bp+424 /* &sz */) + if !(rc == SQLITE_OK) { + goto __117 + } + returnSingleInt(tls, v, *(*Sqlite3_int64)(unsafe.Pointer(bp + 424 /* sz */))) + goto __118 +__117: + if !(rc != SQLITE_NOTFOUND) { + goto __119 + } + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + (*Parse)(unsafe.Pointer(pParse)).Frc = rc +__119: + ; +__118: + ; + goto __15 + + // PRAGMA temp_store + // PRAGMA temp_store = "default"|"memory"|"file" + // + // Return or set the local value of the temp_store flag. Changing + // the local value does not make changes to the disk file and the default + // value will be restored the next time the database is opened. + // + // Note that it is possible for the library compile-time options to + // override this setting +__28: + if !(!(zRight != 0)) { + goto __120 + } + returnSingleInt(tls, v, int64((*Sqlite3)(unsafe.Pointer(db)).Ftemp_store)) + goto __121 +__120: + changeTempStorage(tls, pParse, zRight) +__121: + ; + goto __15 + + // PRAGMA temp_store_directory + // PRAGMA temp_store_directory = ""|"directory_name" + // + // Return or set the local value of the temp_store_directory flag. Changing + // the value sets a specific directory to be used for temporary files. + // Setting to a null string reverts to the default temporary directory search. + // If temporary directory is changed, then invalidateTempStorage. + // +__29: + if !(!(zRight != 0)) { + goto __122 + } + returnSingleText(tls, v, Xsqlite3_temp_directory) + goto __123 +__122: + if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { + goto __124 + } + rc = Xsqlite3OsAccess(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, zRight, SQLITE_ACCESS_READWRITE, bp+432 /* &res */) + if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 432 /* res */)) == 0)) { + goto __125 + } + Xsqlite3ErrorMsg(tls, pParse, ts+16043 /* "not a writable d..." */, 0) + goto pragma_out +__125: + ; +__124: + ; + if !(((SQLITE_TEMP_STORE == 0) || + ((SQLITE_TEMP_STORE == 1) && (int32((*Sqlite3)(unsafe.Pointer(db)).Ftemp_store) <= 1))) || + ((SQLITE_TEMP_STORE == 2) && (int32((*Sqlite3)(unsafe.Pointer(db)).Ftemp_store) == 1))) { + goto __126 + } + invalidateTempStorage(tls, pParse) +__126: + ; + Xsqlite3_free(tls, Xsqlite3_temp_directory) + if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { + goto __127 + } + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+16, zRight)) + goto __128 +__127: + Xsqlite3_temp_directory = uintptr(0) +__128: + ; +__123: + ; + goto __15 + + // PRAGMA [schema.]synchronous + // PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA + // + // Return or set the local value of the synchronous flag. Changing + // the local value does not make changes to the disk file and the + // default value will be restored the next time the database is + // opened. +__30: + if !(!(zRight != 0)) { + goto __129 + } + returnSingleInt(tls, v, (int64(int32((*Db)(unsafe.Pointer(pDb)).Fsafety_level) - 1))) + goto __130 +__129: + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { + goto __131 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+16068 /* "Safety level may..." */, 0) + goto __132 +__131: + if !(iDb != 1) { + goto __133 + } + iLevel = ((int32(getSafetyLevel(tls, zRight, 0, uint8(1))) + 1) & PAGER_SYNCHRONOUS_MASK) + if !(iLevel == 0) { + goto __134 + } + iLevel = 1 +__134: + ; + (*Db)(unsafe.Pointer(pDb)).Fsafety_level = U8(iLevel) + (*Db)(unsafe.Pointer(pDb)).FbSyncSet = U8(1) + setAllPagerFlags(tls, db) +__133: + ; +__132: + ; +__130: + ; + goto __15 + +__31: + if !(zRight == uintptr(0)) { + goto __135 + } + setPragmaResultColumnNames(tls, v, pPragma) + returnSingleInt(tls, v, (int64(libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & (*PragmaName)(unsafe.Pointer(pPragma)).FiArg) != uint64(0))))) + goto __136 +__135: + mask = (*PragmaName)(unsafe.Pointer(pPragma)).FiArg // Mask of bits to set or clear. + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) == 0) { + goto __137 + } + // Foreign key support may not be enabled or disabled while not + // in auto-commit mode. + mask = mask & (libc.Uint64FromInt32(libc.CplInt32(SQLITE_ForeignKeys))) +__137: + ; + + if !(Xsqlite3GetBoolean(tls, zRight, uint8(0)) != 0) { + goto __138 + } + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (mask) + goto __139 +__138: + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (^mask) + if !(mask == uint64(SQLITE_DeferFKs)) { + goto __140 + } + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = int64(0) +__140: + ; +__139: + ; + + // Many of the flag-pragmas modify the code generated by the SQL + // compiler (eg. count_changes). So add an opcode to expire all + // compiled SQL statements after modifying a pragma value. + Xsqlite3VdbeAddOp0(tls, v, OP_Expire) + setAllPagerFlags(tls, db) +__136: + ; + goto __15 + + // PRAGMA table_info(
) + // + // Return a single row for each column of the named table. The columns of + // the returned data set are: + // + // cid: Column id (numbered from left to right, starting at 0) + // name: Column name + // type: Column declaration type. + // notnull: True if 'NOT NULL' is part of column declaration + // dflt_value: The default value for the column, if any. + // pk: Non-zero for PK fields. +__32: + if !(zRight != 0) { + goto __141 + } + Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) + pTab = Xsqlite3LocateTable(tls, pParse, uint32(LOCATE_NOERR), zRight, zDb) + if !(pTab != 0) { + goto __142 + } + nHidden = 0 + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + (*Parse)(unsafe.Pointer(pParse)).FnMem = 7 + Xsqlite3ViewGetColumnNames(tls, pParse, pTab) + i = 0 + pCol = (*Table)(unsafe.Pointer(pTab)).FaCol +__143: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __145 + } + isHidden = 0 + if !((int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_NOINSERT) != 0) { + goto __146 + } + if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg == uint64(0)) { + goto __147 + } + nHidden++ + goto __144 +__147: + ; + if !((int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_VIRTUAL) != 0) { + goto __148 + } + isHidden = 2 // GENERATED ALWAYS AS ... VIRTUAL + goto __149 +__148: + if !((int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0) { + goto __150 + } + isHidden = 3 // GENERATED ALWAYS AS ... STORED + goto __151 +__150: + ; + isHidden = 1 // HIDDEN +__151: + ; +__149: + ; +__146: + ; + if !((int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) == 0) { + goto __152 + } + k = 0 + goto __153 +__152: + if !(pPk == uintptr(0)) { + goto __154 + } + k = 1 + goto __155 +__154: + k = 1 +__156: + if !((k <= int32((*Table)(unsafe.Pointer(pTab)).FnCol)) && (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr((k-1))*2))) != i)) { + goto __158 + } + goto __157 +__157: + k++ + goto __156 + goto __158 +__158: + ; +__155: + ; +__153: + ; + + Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { + if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { + return ts + 16121 /* "issisii" */ + } + return ts + 16129 /* "issisi" */ + }(), + libc.VaList(bp+24, (i-nHidden), + (*Column)(unsafe.Pointer(pCol)).FzName, + Xsqlite3ColumnType(tls, pCol, ts+756 /* "" */), + func() int32 { + if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { + return 1 + } + return 0 + }(), + func() uintptr { + if ((*Column)(unsafe.Pointer(pCol)).FpDflt != 0) && (isHidden < 2) { + return *(*uintptr)(unsafe.Pointer((*Column)(unsafe.Pointer(pCol)).FpDflt + 8 /* &.u */)) + } + return uintptr(0) + }(), + k, + isHidden)) + goto __144 +__144: + i++ + pCol += 32 + goto __143 + goto __145 +__145: + ; +__142: + ; +__141: + ; + goto __15 + +__33: + if !(zRight != 0) { + goto __159 + } + pIdx = Xsqlite3FindIndex(tls, db, zRight, zDb) + if !(pIdx == uintptr(0)) { + goto __160 + } + // If there is no index named zRight, check to see if there is a + // WITHOUT ROWID table named zRight, and if there is, show the + // structure of the PRIMARY KEY index for that table. + pTab1 = Xsqlite3LocateTable(tls, pParse, uint32(LOCATE_NOERR), zRight, zDb) + if !((pTab1 != 0) && !(((*Table)(unsafe.Pointer((pTab1))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __161 + } + pIdx = Xsqlite3PrimaryKeyIndex(tls, pTab1) +__161: + ; +__160: + ; + if !(pIdx != 0) { + goto __162 + } + iIdxDb = Xsqlite3SchemaToIndex(tls, db, (*Index)(unsafe.Pointer(pIdx)).FpSchema) + if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { + goto __163 + } + // PRAGMA index_xinfo (newer version with more rows and columns) + mx = int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) + (*Parse)(unsafe.Pointer(pParse)).FnMem = 6 + goto __164 +__163: + // PRAGMA index_info (legacy version) + mx = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + (*Parse)(unsafe.Pointer(pParse)).FnMem = 3 +__164: + ; + pTab1 = (*Index)(unsafe.Pointer(pIdx)).FpTable + Xsqlite3CodeVerifySchema(tls, pParse, iIdxDb) + + i1 = 0 +__165: + if !(i1 < mx) { + goto __167 + } + cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16136 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + func() uintptr { + if int32(cnum) < 0 { + return uintptr(0) + } + return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab1)).FaCol + uintptr(cnum)*32)).FzName + }())) + if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { + goto __168 + } + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16141, /* "isiX" */ + libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), + (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) +__168: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 1, (*Parse)(unsafe.Pointer(pParse)).FnMem) + goto __166 +__166: + i1++ + goto __165 + goto __167 +__167: + ; +__162: + ; +__159: + ; + goto __15 + +__34: + if !(zRight != 0) { + goto __169 + } + pTab2 = Xsqlite3FindTable(tls, db, zRight, zDb) + if !(pTab2 != 0) { + goto __170 + } + iTabDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab2)).FpSchema) + (*Parse)(unsafe.Pointer(pParse)).FnMem = 5 + Xsqlite3CodeVerifySchema(tls, pParse, iTabDb) + pIdx1 = (*Table)(unsafe.Pointer(pTab2)).FpIndex + i2 = 0 +__171: + if !(pIdx1 != 0) { + goto __173 + } + *(*[3]uintptr)(unsafe.Pointer(bp + 440 /* azOrigin */)) = [3]uintptr{ts + 16146 /* "c" */, ts + 16148 /* "u" */, ts + 14668 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16150, /* "isisi" */ + libc.VaList(bp+128, i2, + (*Index)(unsafe.Pointer(pIdx1)).FzName, + (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), + *(*uintptr)(unsafe.Pointer(bp + 440 /* &azOrigin[0] */ + uintptr((uint32(int32(*(*uint16)(unsafe.Pointer(pIdx1 + 100 /* &.idxType */))&0x3>>0))))*8)), + (libc.Bool32((*Index)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0))))) + goto __172 +__172: + pIdx1 = (*Index)(unsafe.Pointer(pIdx1)).FpNext + i2++ + goto __171 + goto __173 +__173: + ; +__170: + ; +__169: + ; + goto __15 + +__35: + (*Parse)(unsafe.Pointer(pParse)).FnMem = 3 + i3 = 0 +__174: + if !(i3 < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __176 + } + if !((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt == uintptr(0)) { + goto __177 + } + goto __175 +__177: + ; + + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16156, /* "iss" */ + libc.VaList(bp+168, i3, + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FzDbSName, + Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt))) + goto __175 +__175: + i3++ + goto __174 + goto __176 +__176: + ; + + goto __15 + +__36: + i4 = 0 + (*Parse)(unsafe.Pointer(pParse)).FnMem = 2 + p = (*Hash)(unsafe.Pointer((db + 608 /* &.aCollSeq */))).Ffirst +__178: + if !(p != 0) { + goto __180 + } + pColl = (*HashElem)(unsafe.Pointer(p)).Fdata + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16160 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + goto __179 +__179: + p = (*HashElem)(unsafe.Pointer(p)).Fnext + goto __178 + goto __180 +__180: + ; + + goto __15 + +__37: + showInternFunc = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_InternalFunc)) != U32(0))) + (*Parse)(unsafe.Pointer(pParse)).FnMem = 6 + i5 = 0 +__181: + if !(i5 < SQLITE_FUNC_HASH_SZ) { + goto __183 + } + p1 = *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&Xsqlite3BuiltinFunctions)) /* &.a */) + uintptr(i5)*8)) +__184: + if !(p1 != 0) { + goto __186 + } + pragmaFunclistLine(tls, v, p1, 1, showInternFunc) + goto __185 +__185: + p1 = *(*uintptr)(unsafe.Pointer(p1 + 64 /* &.u */)) + goto __184 + goto __186 +__186: + ; + goto __182 +__182: + i5++ + goto __181 + goto __183 +__183: + ; + j = (*Hash)(unsafe.Pointer((db + 584 /* &.aFunc */))).Ffirst +__187: + if !(j != 0) { + goto __189 + } + p1 = (*HashElem)(unsafe.Pointer(j)).Fdata + pragmaFunclistLine(tls, v, p1, 0, showInternFunc) + goto __188 +__188: + j = (*HashElem)(unsafe.Pointer(j)).Fnext + goto __187 + goto __189 +__189: + ; + + goto __15 + +__38: + (*Parse)(unsafe.Pointer(pParse)).FnMem = 1 + j1 = (*Hash)(unsafe.Pointer((db + 536 /* &.aModule */))).Ffirst +__190: + if !(j1 != 0) { + goto __192 + } + pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16004 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + goto __191 +__191: + j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext + goto __190 + goto __192 +__192: + ; + + goto __15 + +__39: + i6 = 0 +__193: + if !(i6 < (int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{}))))) { + goto __195 + } + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16004 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + goto __194 +__194: + i6++ + goto __193 + goto __195 +__195: + ; + + goto __15 + +__40: + if !(zRight != 0) { + goto __196 + } + pTab3 = Xsqlite3FindTable(tls, db, zRight, zDb) + if !(pTab3 != 0) { + goto __197 + } + pFK = (*Table)(unsafe.Pointer(pTab3)).FpFKey + if !(pFK != 0) { + goto __198 + } + iTabDb1 = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab3)).FpSchema) + i7 = 0 + (*Parse)(unsafe.Pointer(pParse)).FnMem = 8 + Xsqlite3CodeVerifySchema(tls, pParse, iTabDb1) +__199: + if !(pFK != 0) { + goto __200 + } + j2 = 0 +__201: + if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { + goto __203 + } + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16163, /* "iissssss" */ + libc.VaList(bp+224, i7, + j2, + (*FKey)(unsafe.Pointer(pFK)).FzTo, + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab3)).FaCol+uintptr((*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FiFrom)*32)).FzName, + (*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FzCol, + actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */) + 1))), // ON UPDATE + actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */)))), // ON DELETE + ts+16172 /* "NONE" */)) + goto __202 +__202: + j2++ + goto __201 + goto __203 +__203: + ; + i7++ + pFK = (*FKey)(unsafe.Pointer(pFK)).FpNextFrom + goto __199 +__200: + ; +__198: + ; +__197: + ; +__196: + ; + goto __15 + +__41: // child to parent column mapping + + regResult = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (4) + regKey = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regRow = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + k1 = (*Hash)(unsafe.Pointer(((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema + 8 /* &.tblHash */))).Ffirst +__204: + if !(k1 != 0) { + goto __205 + } + if !(zRight != 0) { + goto __206 + } + pTab4 = Xsqlite3LocateTable(tls, pParse, uint32(0), zRight, zDb) + k1 = uintptr(0) + goto __207 +__206: + pTab4 = (*HashElem)(unsafe.Pointer(k1)).Fdata + k1 = (*HashElem)(unsafe.Pointer(k1)).Fnext +__207: + ; + if !((pTab4 == uintptr(0)) || ((*Table)(unsafe.Pointer(pTab4)).FpFKey == uintptr(0))) { + goto __208 + } + goto __204 +__208: + ; + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab4)).FpSchema) + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab4)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pTab4)).FzName) + if !((int32((*Table)(unsafe.Pointer(pTab4)).FnCol) + regRow) > (*Parse)(unsafe.Pointer(pParse)).FnMem) { + goto __209 + } + (*Parse)(unsafe.Pointer(pParse)).FnMem = (int32((*Table)(unsafe.Pointer(pTab4)).FnCol) + regRow) +__209: + ; + Xsqlite3OpenTable(tls, pParse, 0, iDb, pTab4, OP_OpenRead) + Xsqlite3VdbeLoadString(tls, v, regResult, (*Table)(unsafe.Pointer(pTab4)).FzName) + i8 = 1 + pFK1 = (*Table)(unsafe.Pointer(pTab4)).FpFKey +__210: + if !(pFK1 != 0) { + goto __212 + } + pParent = Xsqlite3FindTable(tls, db, (*FKey)(unsafe.Pointer(pFK1)).FzTo, zDb) + if !(pParent == uintptr(0)) { + goto __213 + } + goto __211 +__213: + ; + *(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */)) = uintptr(0) + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pParent)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pParent)).FzName) + x1 = Xsqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+464 /* &pIdx2 */, uintptr(0)) + if !(x1 == 0) { + goto __214 + } + if !(*(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */)) == uintptr(0)) { + goto __216 + } + Xsqlite3OpenTable(tls, pParse, i8, iDb, pParent, OP_OpenRead) + goto __217 +__216: + Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, i8, int32((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */)))).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */))) +__217: + ; + goto __215 +__214: + k1 = uintptr(0) + goto __212 +__215: + ; + goto __211 +__211: + i8++ + pFK1 = (*FKey)(unsafe.Pointer(pFK1)).FpNextFrom + goto __210 + goto __212 +__212: + ; + + if !(pFK1 != 0) { + goto __218 + } + goto __205 +__218: + ; + if !((*Parse)(unsafe.Pointer(pParse)).FnTab < i8) { + goto __219 + } + (*Parse)(unsafe.Pointer(pParse)).FnTab = i8 +__219: + ; + addrTop = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, 0) + i8 = 1 + pFK1 = (*Table)(unsafe.Pointer(pTab4)).FpFKey +__220: + if !(pFK1 != 0) { + goto __222 + } + pParent = Xsqlite3FindTable(tls, db, (*FKey)(unsafe.Pointer(pFK1)).FzTo, zDb) + *(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 472 /* aiCols */)) = uintptr(0) + if !(pParent != 0) { + goto __223 + } + x1 = Xsqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+464 /* &pIdx2 */, bp+472 /* &aiCols */) + +__223: + ; + addrOk = Xsqlite3VdbeMakeLabel(tls, pParse) + + // Generate code to read the child key values into registers + // regRow..regRow+n. If any of the child key values are NULL, this + // row cannot cause an FK violation. Jump directly to addrOk in + // this case. + j3 = 0 +__224: + if !(j3 < (*FKey)(unsafe.Pointer(pFK1)).FnCol) { + goto __226 + } + if *(*uintptr)(unsafe.Pointer(bp + 472 /* aiCols */)) != 0 { + iCol = *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 472 /* aiCols */)) + uintptr(j3)*4)) + } else { + iCol = (*sColMap)(unsafe.Pointer((pFK1 + 64 /* &.aCol */) + uintptr(j3)*16)).FiFrom + } + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab4, 0, iCol, (regRow + j3)) + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (regRow + j3), addrOk) + goto __225 +__225: + j3++ + goto __224 + goto __226 +__226: + ; + + // Generate code to query the parent index for a matching parent + // key. If a match is found, jump to addrOk. + if !(*(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */)) != 0) { + goto __227 + } + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regRow, (*FKey)(unsafe.Pointer(pFK1)).FnCol, regKey, + Xsqlite3IndexAffinityStr(tls, db, *(*uintptr)(unsafe.Pointer(bp + 464 /* pIdx2 */))), (*FKey)(unsafe.Pointer(pFK1)).FnCol) + Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, i8, addrOk, regKey, 0) + + goto __228 +__227: + if !(pParent != 0) { + goto __229 + } + jmp = (Xsqlite3VdbeCurrentAddr(tls, v) + 2) + Xsqlite3VdbeAddOp3(tls, v, OP_SeekRowid, i8, jmp, regRow) + Xsqlite3VdbeGoto(tls, v, addrOk) + +__229: + ; +__228: + ; + + // Generate code to report an FK violation to the caller. + if !(((*Table)(unsafe.Pointer((pTab4))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __230 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, 0, (regResult + 1)) + goto __231 +__230: + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) +__231: + ; + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16177 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) + Xsqlite3VdbeResolveLabel(tls, v, addrOk) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 472 /* aiCols */))) + goto __221 +__221: + i8++ + pFK1 = (*FKey)(unsafe.Pointer(pFK1)).FpNextFrom + goto __220 + goto __222 +__222: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Next, 0, (addrTop + 1)) + Xsqlite3VdbeJumpHere(tls, v, addrTop) + goto __204 +__205: + ; + + goto __15 + + // Reinstall the LIKE and GLOB functions. The variant of LIKE + // used will be case sensitive or not depending on the RHS. +__42: + if !(zRight != 0) { + goto __232 + } + Xsqlite3RegisterLikeFunctions(tls, db, int32(Xsqlite3GetBoolean(tls, zRight, uint8(0)))) +__232: + ; + + goto __15 + + // PRAGMA integrity_check + // PRAGMA integrity_check(N) + // PRAGMA quick_check + // PRAGMA quick_check(N) + // + // Verify the integrity of the database. + // + // The "quick_check" is reduced version of + // integrity_check designed to detect most database corruption + // without the overhead of cross-checking indexes. Quick_check + // is linear time wherease integrity_check is O(NlogN). + // + // The maximum nubmer of errors is 100 by default. A different default + // can be specified using a numeric parameter N. + // + // Or, the parameter N can be the name of a table. In that case, only + // the one table named is verified. The freelist is only verified if + // the named table is "sqlite_schema" (or one of its aliases). + // + // All schemas are checked by default. To check just a single + // schema, use the form: + // + // PRAGMA schema.integrity_check; +__43: + pObjTab = uintptr(0) // Check only this one table, if not NULL + + isQuick = (libc.Bool32((int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zLeft)))])) == 'q')) + + // If the PRAGMA command was of the form "PRAGMA .integrity_check", + // then iDb is set to the index of the database identified by . + // In this case, the integrity of database iDb only is verified by + // the VDBE created below. + // + // Otherwise, if the command was simply "PRAGMA integrity_check" (or + // "PRAGMA quick_check"), then iDb is set to 0. In this case, set iDb + // to -1 here, to indicate that the VDBE should verify the integrity + // of all attached databases. + + if !((*Token)(unsafe.Pointer(pId2)).Fz == uintptr(0)) { + goto __233 + } + iDb = -1 +__233: + ; + + // Initialize the VDBE program + (*Parse)(unsafe.Pointer(pParse)).FnMem = 6 + + // Set the maximum error count + *(*int32)(unsafe.Pointer(bp + 480 /* mxErr */)) = SQLITE_INTEGRITY_CHECK_ERROR_MAX + if !(zRight != 0) { + goto __234 + } + if !(Xsqlite3GetInt32(tls, zRight, bp+480 /* &mxErr */) != 0) { + goto __235 + } + if !(*(*int32)(unsafe.Pointer(bp + 480 /* mxErr */)) <= 0) { + goto __237 + } + *(*int32)(unsafe.Pointer(bp + 480 /* mxErr */)) = SQLITE_INTEGRITY_CHECK_ERROR_MAX +__237: + ; + goto __236 +__235: + pObjTab = Xsqlite3LocateTable(tls, pParse, uint32(0), zRight, + func() uintptr { + if iDb >= 0 { + return (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + } + return uintptr(0) + }()) +__236: + ; +__234: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, (*(*int32)(unsafe.Pointer(bp + 480 /* mxErr */)) - 1), 1) // reg[1] holds errors left + + // Do an integrity check on each database file + i9 = 0 +__238: + if !(i9 < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __240 + } // Array of root page numbers of all btrees + cnt = 0 // Number of entries in aRoot[] + mxIdx = 0 // Maximum number of indexes for any table + + if !((0 != 0) && (i9 == 1)) { + goto __241 + } + goto __239 +__241: + ; + if !((iDb >= 0) && (i9 != iDb)) { + goto __242 + } + goto __239 +__242: + ; + + Xsqlite3CodeVerifySchema(tls, pParse, i9) + + // Do an integrity check of the B-Tree + // + // Begin by finding the root pages numbers + // for all tables and indices in the database. + + pTbls = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FpSchema + 8 /* &.tblHash */) + cnt = 0 + x2 = (*Hash)(unsafe.Pointer(pTbls)).Ffirst +__243: + if !(x2 != 0) { + goto __245 + } + pTab5 = (*HashElem)(unsafe.Pointer(x2)).Fdata // Number of indexes on pTab + if !((pObjTab != 0) && (pObjTab != pTab5)) { + goto __246 + } + goto __244 +__246: + ; + if !(((*Table)(unsafe.Pointer((pTab5))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __247 + } + cnt++ +__247: + ; + nIdx = 0 + pIdx3 = (*Table)(unsafe.Pointer(pTab5)).FpIndex +__248: + if !(pIdx3 != 0) { + goto __250 + } + cnt++ + goto __249 +__249: + pIdx3 = (*Index)(unsafe.Pointer(pIdx3)).FpNext + nIdx++ + goto __248 + goto __250 +__250: + ; + if !(nIdx > mxIdx) { + goto __251 + } + mxIdx = nIdx +__251: + ; + goto __244 +__244: + x2 = (*HashElem)(unsafe.Pointer(x2)).Fnext + goto __243 + goto __245 +__245: + ; + if !(cnt == 0) { + goto __252 + } + goto __239 +__252: + ; + if !(pObjTab != 0) { + goto __253 + } + cnt++ +__253: + ; + aRoot = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(int32(0))) * (uint64(cnt + 1))))) + if !(aRoot == uintptr(0)) { + goto __254 + } + goto __240 +__254: + ; + cnt = 0 + if !(pObjTab != 0) { + goto __255 + } + *(*int32)(unsafe.Pointer(aRoot + uintptr(libc.PreIncInt32(&cnt, 1))*4)) = 0 +__255: + ; + x2 = (*Hash)(unsafe.Pointer(pTbls)).Ffirst +__256: + if !(x2 != 0) { + goto __258 + } + pTab6 = (*HashElem)(unsafe.Pointer(x2)).Fdata + if !((pObjTab != 0) && (pObjTab != pTab6)) { + goto __259 + } + goto __257 +__259: + ; + if !(((*Table)(unsafe.Pointer((pTab6))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __260 + } + *(*int32)(unsafe.Pointer(aRoot + uintptr(libc.PreIncInt32(&cnt, 1))*4)) = int32((*Table)(unsafe.Pointer(pTab6)).Ftnum) +__260: + ; + pIdx4 = (*Table)(unsafe.Pointer(pTab6)).FpIndex +__261: + if !(pIdx4 != 0) { + goto __263 + } + *(*int32)(unsafe.Pointer(aRoot + uintptr(libc.PreIncInt32(&cnt, 1))*4)) = int32((*Index)(unsafe.Pointer(pIdx4)).Ftnum) + goto __262 +__262: + pIdx4 = (*Index)(unsafe.Pointer(pIdx4)).FpNext + goto __261 + goto __263 +__263: + ; + goto __257 +__257: + x2 = (*HashElem)(unsafe.Pointer(x2)).Fnext + goto __256 + goto __258 +__258: + ; + *(*int32)(unsafe.Pointer(aRoot)) = cnt + + // Make sure sufficient number of registers have been allocated + (*Parse)(unsafe.Pointer(pParse)).FnMem = func() int32 { + if ((*Parse)(unsafe.Pointer(pParse)).FnMem) > (8 + mxIdx) { + return (*Parse)(unsafe.Pointer(pParse)).FnMem + } + return (8 + mxIdx) + }() + Xsqlite3ClearTempRegCache(tls, pParse) + + // Do the b-tree integrity checks + Xsqlite3VdbeAddOp4(tls, v, OP_IntegrityCk, 2, cnt, 1, aRoot, -15) + Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) + addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, + Xsqlite3MPrintf(tls, db, ts+16181 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), + -7) + Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) + integrityCheckResultRow(tls, v) + Xsqlite3VdbeJumpHere(tls, v, addr1) + + // Make sure all the indices are constructed correctly. + x2 = (*Hash)(unsafe.Pointer(pTbls)).Ffirst +__264: + if !(x2 != 0) { + goto __266 + } + pTab7 = (*HashElem)(unsafe.Pointer(x2)).Fdata + pPrior = uintptr(0) + r1 = -1 + + if !((*Table)(unsafe.Pointer(pTab7)).Ftnum < Pgno(1)) { + goto __267 + } + goto __265 +__267: + ; // Skip VIEWs or VIRTUAL TABLEs + if !((pObjTab != 0) && (pObjTab != pTab7)) { + goto __268 + } + goto __265 +__268: + ; + if ((*Table)(unsafe.Pointer((pTab7))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + pPk1 = uintptr(0) + } else { + pPk1 = Xsqlite3PrimaryKeyIndex(tls, pTab7) + } + Xsqlite3OpenTableAndIndices(tls, pParse, pTab7, OP_OpenRead, uint8(0), + 1, uintptr(0), bp+484 /* &iDataCur */, bp+488 /* &iIdxCur */) + // reg[7] counts the number of entries in the table. + // reg[8+i] counts the number of entries in the i-th index + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, 7) + j4 = 0 + pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex +__269: + if !(pIdx5 != 0) { + goto __271 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (8 + j4)) // index entries counter + goto __270 +__270: + pIdx5 = (*Index)(unsafe.Pointer(pIdx5)).FpNext + j4++ + goto __269 + goto __271 +__271: + ; + + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, *(*int32)(unsafe.Pointer(bp + 484 /* iDataCur */)), 0) + loopTop = Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, 7, 1) + if !(!(isQuick != 0)) { + goto __272 + } + // Sanity check on record header decoding + Xsqlite3VdbeAddOp3(tls, v, OP_Column, *(*int32)(unsafe.Pointer(bp + 484 /* iDataCur */)), (int32((*Table)(unsafe.Pointer(pTab7)).FnNVCol) - 1), 3) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_TYPEOFARG)) +__272: + ; + // Verify that all NOT NULL columns really are NOT NULL + j4 = 0 +__273: + if !(j4 < int32((*Table)(unsafe.Pointer(pTab7)).FnCol)) { + goto __275 + } + if !(j4 == int32((*Table)(unsafe.Pointer(pTab7)).FiPKey)) { + goto __276 + } + goto __274 +__276: + ; + if !(int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FnotNull) == 0) { + goto __277 + } + goto __274 +__277: + ; + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab7, *(*int32)(unsafe.Pointer(bp + 484 /* iDataCur */)), j4, 3) + if !(int32((*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, -1))).Fopcode) == OP_Column) { + goto __278 + } + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_TYPEOFARG)) +__278: + ; + jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) + zErr = Xsqlite3MPrintf(tls, db, ts+16205 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FzName)) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) + integrityCheckResultRow(tls, v) + Xsqlite3VdbeJumpHere(tls, v, jmp2) + goto __274 +__274: + j4++ + goto __273 + goto __275 +__275: + ; + // Verify CHECK constraints + if !(((*Table)(unsafe.Pointer(pTab7)).FpCheck != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_IgnoreChecks)) == uint64(0))) { + goto __279 + } + pCheck = Xsqlite3ExprListDup(tls, db, (*Table)(unsafe.Pointer(pTab7)).FpCheck, 0) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) { + goto __280 + } + addrCkFault = Xsqlite3VdbeMakeLabel(tls, pParse) + addrCkOk = Xsqlite3VdbeMakeLabel(tls, pParse) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = (*(*int32)(unsafe.Pointer(bp + 484 /* iDataCur */)) + 1) + k2 = ((*ExprList)(unsafe.Pointer(pCheck)).FnExpr - 1) +__281: + if !(k2 > 0) { + goto __283 + } + Xsqlite3ExprIfFalse(tls, pParse, (*ExprList_item)(unsafe.Pointer((pCheck+8 /* &.a */)+uintptr(k2)*32)).FpExpr, addrCkFault, 0) + goto __282 +__282: + k2-- + goto __281 + goto __283 +__283: + ; + Xsqlite3ExprIfTrue(tls, pParse, (*ExprList_item)(unsafe.Pointer((pCheck + 8 /* &.a */))).FpExpr, addrCkOk, + SQLITE_JUMPIFNULL) + Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 + zErr1 = Xsqlite3MPrintf(tls, db, ts+16225, /* "CHECK constraint..." */ + libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) + integrityCheckResultRow(tls, v) + Xsqlite3VdbeResolveLabel(tls, v, addrCkOk) +__280: + ; + Xsqlite3ExprListDelete(tls, db, pCheck) +__279: + ; + if !(!(isQuick != 0)) { + goto __284 + } // Omit the remaining tests for quick_check + // Validate index entries for the current row + j4 = 0 + pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex +__285: + if !(pIdx5 != 0) { + goto __287 + } + ckUniq = Xsqlite3VdbeMakeLabel(tls, pParse) + if !(pPk1 == pIdx5) { + goto __288 + } + goto __286 +__288: + ; + r1 = Xsqlite3GenerateIndexKey(tls, pParse, pIdx5, *(*int32)(unsafe.Pointer(bp + 484 /* iDataCur */)), 0, 0, bp+492, /* &jmp3 */ + pPrior, r1) + pPrior = pIdx5 + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, (8 + j4), 1) // increment entry count + // Verify that an index entry exists for the current table row + jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), ckUniq, r1, + int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16255 /* "row " */) + Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16260 /* " missing from in..." */) + Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) + jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) + Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) + jmp4 = integrityCheckResultRow(tls, v) + Xsqlite3VdbeJumpHere(tls, v, jmp21) + // For UNIQUE indexes, verify that only one entry exists with the + // current key. The entry is unique if (1) any column is NULL + // or (2) the next entry has a different key + if !(int32((*Index)(unsafe.Pointer((pIdx5))).FonError) != OE_None) { + goto __289 + } + uniqOk = Xsqlite3VdbeMakeLabel(tls, pParse) + kk = 0 +__290: + if !(kk < int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) { + goto __292 + } + iCol1 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx5)).FaiColumn + uintptr(kk)*2))) + + if !((iCol1 >= 0) && ((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(iCol1)*32)).FnotNull != 0)) { + goto __293 + } + goto __291 +__293: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (r1 + kk), uniqOk) + + goto __291 +__291: + kk++ + goto __290 + goto __292 +__292: + ; + jmp6 = Xsqlite3VdbeAddOp1(tls, v, OP_Next, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4)) + Xsqlite3VdbeGoto(tls, v, uniqOk) + Xsqlite3VdbeJumpHere(tls, v, jmp6) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), uniqOk, r1, + int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16281 /* "non-unique entry..." */) + Xsqlite3VdbeGoto(tls, v, jmp5) + Xsqlite3VdbeResolveLabel(tls, v, uniqOk) +__289: + ; + Xsqlite3VdbeJumpHere(tls, v, jmp4) + Xsqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 492 /* jmp3 */))) + goto __286 +__286: + pIdx5 = (*Index)(unsafe.Pointer(pIdx5)).FpNext + j4++ + goto __285 + goto __287 +__287: + ; +__284: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Next, *(*int32)(unsafe.Pointer(bp + 484 /* iDataCur */)), loopTop) + Xsqlite3VdbeJumpHere(tls, v, (loopTop - 1)) + if !(!(isQuick != 0)) { + goto __294 + } + Xsqlite3VdbeLoadString(tls, v, 2, ts+16308 /* "wrong # of entri..." */) + j4 = 0 + pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex +__295: + if !(pIdx5 != 0) { + goto __297 + } + if !(pPk1 == pIdx5) { + goto __298 + } + goto __296 +__298: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Count, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), 3) + addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_Eq, (8 + j4), 0, 3) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) + Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) + Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 2, 3) + integrityCheckResultRow(tls, v) + Xsqlite3VdbeJumpHere(tls, v, addr1) + goto __296 +__296: + pIdx5 = (*Index)(unsafe.Pointer(pIdx5)).FpNext + j4++ + goto __295 + goto __297 +__297: + ; +__294: + ; + goto __265 +__265: + x2 = (*HashElem)(unsafe.Pointer(x2)).Fnext + goto __264 + goto __266 +__266: + ; + goto __239 +__239: + i9++ + goto __238 + goto __240 +__240: + ; + + aOp2 = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(endCode)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&endCode)), iLn5) + if !(aOp2 != 0) { + goto __299 + } + (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 480 /* mxErr */))) + (*VdbeOp)(unsafe.Pointer(aOp2 + 2*24)).Fp4type = int8(-1) + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16337 /* "ok" */ + (*VdbeOp)(unsafe.Pointer(aOp2 + 5*24)).Fp4type = int8(-1) + *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) +__299: + ; + Xsqlite3VdbeChangeP3(tls, v, 0, (Xsqlite3VdbeCurrentAddr(tls, v) - 2)) + + goto __15 + + // PRAGMA encoding + // PRAGMA encoding = "utf-8"|"utf-16"|"utf-16le"|"utf-16be" + // + // In its first form, this pragma returns the encoding of the main + // database. If the database is not initialized, it is initialized now. + // + // The second form of this pragma is a no-op if the main database file + // has not already been initialized. In this case it sets the default + // encoding that will be used for the main database file if a new file + // is created. If an existing main database file is opened, then the + // default text encoding for the existing database is used. + // + // In all cases new databases created using the ATTACH command are + // created to use the same default text encoding as the main database. If + // the main database has not been initialized and/or created when ATTACH + // is executed, this is done before the ATTACH operation. + // + // In the second form this pragma sets the text encoding to be used in + // new database files created using this database handle. It is only + // useful if invoked immediately after the main database i +__44: + if !(!(zRight != 0)) { + goto __300 + } // "PRAGMA encoding" + if !(Xsqlite3ReadSchema(tls, pParse) != 0) { + goto __302 + } + goto pragma_out +__302: + ; + + returnSingleText(tls, v, encnames1[(*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fenc].FzName) + goto __301 +__300: // "PRAGMA encoding = XXX" + // Only change the value of sqlite.enc if the database handle is not + // initialized. If the main database exists, the new sqlite.enc value + // will be overwritten when the schema is next loaded. If it does not + // already exists, it will be created to use the new encoding value. + if !(((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_EncodingFixed)) == U32(0)) { + goto __303 + } + pEnc = (uintptr(unsafe.Pointer(&encnames1))) +__304: + if !((*EncName)(unsafe.Pointer(pEnc)).FzName != 0) { + goto __306 + } + if !(0 == Xsqlite3StrICmp(tls, zRight, (*EncName)(unsafe.Pointer(pEnc)).FzName)) { + goto __307 + } + if (*EncName)(unsafe.Pointer(pEnc)).Fenc != 0 { + enc = (*EncName)(unsafe.Pointer(pEnc)).Fenc + } else { + enc = uint8(SQLITE_UTF16LE) + } + ((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb)).FpSchema)).Fenc) = enc + Xsqlite3SetTextEncoding(tls, db, enc) + goto __306 +__307: + ; + goto __305 +__305: + pEnc += 16 + goto __304 + goto __306 +__306: + ; + if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { + goto __308 + } + Xsqlite3ErrorMsg(tls, pParse, ts+16340 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) +__308: + ; +__303: + ; +__301: + ; + + goto __15 + + // PRAGMA [schema.]schema_version + // PRAGMA [schema.]schema_version = + // + // PRAGMA [schema.]user_version + // PRAGMA [schema.]user_version = + // + // PRAGMA [schema.]freelist_count + // + // PRAGMA [schema.]data_version + // + // PRAGMA [schema.]application_id + // PRAGMA [schema.]application_id = + // + // The pragma's schema_version and user_version are used to set or get + // the value of the schema-version and user-version, respectively. Both + // the schema-version and the user-version are 32-bit signed integers + // stored in the database header. + // + // The schema-cookie is usually only manipulated internally by SQLite. It + // is incremented by SQLite whenever the database schema is modified (by + // creating or dropping a table or index). The schema version is used by + // SQLite each time a query is executed to ensure that the internal cache + // of the schema used when compiling the SQL query matches the schema of + // the database against which the compiled query is actually executed. + // Subverting this mechanism by using "PRAGMA schema_version" to modify + // the schema-version is potentially dangerous and may lead to program + // crashes or database corruption. Use with caution! + // + // The user-version is not used internally by SQLite. It may be used by + // applications for any purpose. +__45: + iCookie = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiArg) // Which cookie to read or write + Xsqlite3VdbeUsesBtree(tls, v, iDb) + if !((zRight != 0) && ((int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_ReadOnly) == 0)) { + goto __309 + } + + aOp3 = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(setCookie)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&setCookie)), 0) + if !(0 != 0) { + goto __311 + } + goto __15 +__311: + ; + (*VdbeOp)(unsafe.Pointer(aOp3)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp3 + 1*24)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp3 + 1*24)).Fp2 = iCookie + (*VdbeOp)(unsafe.Pointer(aOp3 + 1*24)).Fp3 = Xsqlite3Atoi(tls, zRight) + (*VdbeOp)(unsafe.Pointer(aOp3 + 1*24)).Fp5 = U16(1) + goto __310 +__309: + ; + aOp4 = Xsqlite3VdbeAddOpList(tls, v, (int32(uint64(unsafe.Sizeof(readCookie)) / uint64(unsafe.Sizeof(VdbeOpList{})))), uintptr(unsafe.Pointer(&readCookie)), 0) + if !(0 != 0) { + goto __312 + } + goto __15 +__312: + ; + (*VdbeOp)(unsafe.Pointer(aOp4)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp4 + 1*24)).Fp1 = iDb + (*VdbeOp)(unsafe.Pointer(aOp4 + 1*24)).Fp3 = iCookie + Xsqlite3VdbeReusable(tls, v) +__310: + ; + + goto __15 + + // PRAGMA compile_options + // + // Return the names of all compile-time options used in this build, + // one option per row. +__46: + i10 = 0 + (*Parse)(unsafe.Pointer(pParse)).FnMem = 1 +__313: + if !((libc.AssignUintptr(&zOpt, Xsqlite3_compileoption_get(tls, libc.PostIncInt32(&i10, 1)))) != uintptr(0)) { + goto __314 + } + Xsqlite3VdbeLoadString(tls, v, 1, zOpt) + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 1, 1) + goto __313 +__314: + ; + Xsqlite3VdbeReusable(tls, v) + + goto __15 + + // PRAGMA [schema.]wal_checkpoint = passive|full|restart|truncate + // + // Checkpoint the database. +__47: + iBt = func() int32 { + if (*Token)(unsafe.Pointer(pId2)).Fz != 0 { + return iDb + } + return (SQLITE_MAX_ATTACHED + 2) + }() + eMode2 = SQLITE_CHECKPOINT_PASSIVE + if !(zRight != 0) { + goto __315 + } + if !(Xsqlite3StrICmp(tls, zRight, ts+15834 /* "full" */) == 0) { + goto __316 + } + eMode2 = SQLITE_CHECKPOINT_FULL + goto __317 +__316: + if !(Xsqlite3StrICmp(tls, zRight, ts+16365 /* "restart" */) == 0) { + goto __318 + } + eMode2 = SQLITE_CHECKPOINT_RESTART + goto __319 +__318: + if !(Xsqlite3StrICmp(tls, zRight, ts+15987 /* "truncate" */) == 0) { + goto __320 + } + eMode2 = SQLITE_CHECKPOINT_TRUNCATE +__320: + ; +__319: + ; +__317: + ; +__315: + ; + (*Parse)(unsafe.Pointer(pParse)).FnMem = 3 + Xsqlite3VdbeAddOp3(tls, v, OP_Checkpoint, iBt, eMode2, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, 1, 3) + + goto __15 + + // PRAGMA wal_autocheckpoint + // PRAGMA wal_autocheckpoint = N + // + // Configure a database connection to automatically checkpoint a database + // after accumulating N frames in the log. Or query for the current value + // of N. +__48: + if !(zRight != 0) { + goto __321 + } + Xsqlite3_wal_autocheckpoint(tls, db, Xsqlite3Atoi(tls, zRight)) +__321: + ; + returnSingleInt(tls, v, + func() int64 { + if (*Sqlite3)(unsafe.Pointer(db)).FxWalCallback == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32) int32 + }{Xsqlite3WalDefaultHook})) { + return int64(int32((*Sqlite3)(unsafe.Pointer(db)).FpWalArg)) + } + return int64(0) + }()) + + goto __15 + + // PRAGMA shrink_memory + // + // IMPLEMENTATION-OF: R-23445-46109 This pragma causes the database + // connection on which it is invoked to free up as much memory as it + // can, by calling sqlite3_db_release_memory(). +__49: + Xsqlite3_db_release_memory(tls, db) + goto __15 + + // PRAGMA optimize + // PRAGMA optimize(MASK) + // PRAGMA schema.optimize + // PRAGMA schema.optimize(MASK) + // + // Attempt to optimize the database. All schemas are optimized in the first + // two forms, and only the specified schema is optimized in the latter two. + // + // The details of optimizations performed by this pragma are expected + // to change and improve over time. Applications should anticipate that + // this pragma will perform new optimizations in future releases. + // + // The optional argument is a bitmask of optimizations to perform: + // + // 0x0001 Debugging mode. Do not actually perform any optimizations + // but instead return one line of text for each optimization + // that would have been done. Off by default. + // + // 0x0002 Run ANALYZE on tables that might benefit. On by default. + // See below for additional information. + // + // 0x0004 (Not yet implemented) Record usage and performance + // information from the current session in the + // database file so that it will be available to "optimize" + // pragmas run by future database connections. + // + // 0x0008 (Not yet implemented) Create indexes that might have + // been helpful to recent queries + // + // The default MASK is and always shall be 0xfffe. 0xfffe means perform all + // of the optimizations listed above except Debug Mode, including new + // optimizations that have not yet been invented. If new optimizations are + // ever added that should be off by default, those off-by-default + // optimizations will have bitmasks of 0x10000 or larger. + // + // DETERMINATION OF WHEN TO RUN ANALYZE + // + // In the current implementation, a table is analyzed if only if all of + // the following are true: + // + // (1) MASK bit 0x02 is set. + // + // (2) The query planner used sqlite_stat1-style statistics for one or + // more indexes of the table at some point during the lifetime of + // the current connection. + // + // (3) One or more indexes of the table are currently unanalyzed OR + // the number of rows in the table has increased by 25 times or more + // since the last time ANALYZE was run. + // + // The rules for when tables are analyzed are likely to change in + // future releases. +__50: // Mask of operations to perform + + if !(zRight != 0) { + goto __322 + } + opMask = U32(Xsqlite3Atoi(tls, zRight)) + if !((opMask & U32(0x02)) == U32(0)) { + goto __324 + } + goto __15 +__324: + ; + goto __323 +__322: + opMask = U32(0xfffe) +__323: + ; + iTabCur = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + iDbLast = func() int32 { + if zDb != 0 { + return iDb + } + return ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) + }() +__325: + if !(iDb <= iDbLast) { + goto __327 + } + if !(iDb == 1) { + goto __328 + } + goto __326 +__328: + ; + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + pSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + k3 = (*Hash)(unsafe.Pointer((pSchema + 8 /* &.tblHash */))).Ffirst +__329: + if !(k3 != 0) { + goto __331 + } + pTab8 = (*HashElem)(unsafe.Pointer(k3)).Fdata + + // If table pTab has not been used in a way that would benefit from + // having analysis statistics during the current session, then skip it. + // This also has the effect of skipping virtual tables and views + if !(((*Table)(unsafe.Pointer(pTab8)).FtabFlags & U32(TF_StatsUsed)) == U32(0)) { + goto __332 + } + goto __330 +__332: + ; + + // Reanalyze if the table is 25 times larger than the last analysis + szThreshold = (LogEst(int32((*Table)(unsafe.Pointer(pTab8)).FnRowLogEst) + 46)) + pIdx6 = (*Table)(unsafe.Pointer(pTab8)).FpIndex +__333: + if !(pIdx6 != 0) { + goto __335 + } + if !(!((int32(*(*uint16)(unsafe.Pointer(pIdx6 + 100 /* &.hasStat1 */)) & 0x80 >> 7)) != 0)) { + goto __336 + } + szThreshold = int16(0) // Always analyze if any index lacks statistics + goto __335 +__336: + ; + goto __334 +__334: + pIdx6 = (*Index)(unsafe.Pointer(pIdx6)).FpNext + goto __333 + goto __335 +__335: + ; + if !(szThreshold != 0) { + goto __337 + } + Xsqlite3OpenTable(tls, pParse, iTabCur, iDb, pTab8, OP_OpenRead) + Xsqlite3VdbeAddOp3(tls, v, OP_IfSmaller, iTabCur, + (int32((U32(Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + (opMask & U32(1)))), int32(szThreshold)) + +__337: + ; + zSubSql = Xsqlite3MPrintf(tls, db, ts+16373, /* "ANALYZE \"%w\".\"%w..." */ + libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) + if !((opMask & U32(0x01)) != 0) { + goto __338 + } + r11 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, r11, 0, zSubSql, -7) + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, r11, 1) + goto __339 +__338: + Xsqlite3VdbeAddOp4(tls, v, OP_SqlExec, 0, 0, 0, zSubSql, -7) +__339: + ; + goto __330 +__330: + k3 = (*HashElem)(unsafe.Pointer(k3)).Fnext + goto __329 + goto __331 +__331: + ; + goto __326 +__326: + iDb++ + goto __325 + goto __327 +__327: + ; + Xsqlite3VdbeAddOp0(tls, v, OP_Expire) + goto __15 + + // PRAGMA busy_timeout + // PRAGMA busy_timeout = N + // + // Call sqlite3_busy_timeout(db, N). Return the current timeout value + // if one is set. If no busy handler or a different busy handler is set + // then 0 is returned. Setting the busy_timeout to 0 or negative + // disables the timeout. + /*case PragTyp_BUSY_TIMEOUT*/ +__51: + ; + if !(zRight != 0) { + goto __340 + } + Xsqlite3_busy_timeout(tls, db, Xsqlite3Atoi(tls, zRight)) +__340: + ; + returnSingleInt(tls, v, int64((*Sqlite3)(unsafe.Pointer(db)).FbusyTimeout)) + goto __15 + + // PRAGMA soft_heap_limit + // PRAGMA soft_heap_limit = N + // + // IMPLEMENTATION-OF: R-26343-45930 This pragma invokes the + // sqlite3_soft_heap_limit64() interface with the argument N, if N is + // specified and is a non-negative integer. + // IMPLEMENTATION-OF: R-64451-07163 The soft_heap_limit pragma always + // returns the same integer that would be returned by the + // sqlite3_soft_heap_limit64(-1) C-language function. +__52: + if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+496 /* &N */) == SQLITE_OK)) { + goto __341 + } + Xsqlite3_soft_heap_limit64(tls, *(*Sqlite3_int64)(unsafe.Pointer(bp + 496 /* N */))) +__341: + ; + returnSingleInt(tls, v, Xsqlite3_soft_heap_limit64(tls, int64(-1))) + goto __15 + + // PRAGMA hard_heap_limit + // PRAGMA hard_heap_limit = N + // + // Invoke sqlite3_hard_heap_limit64() to query or set the hard heap + // limit. The hard heap limit can be activated or lowered by this + // pragma, but not raised or deactivated. Only the + // sqlite3_hard_heap_limit64() C-language API can raise or deactivate + // the hard heap limit. This allows an application to set a heap limit + // constraint that cannot be relaxed by an untrusted SQL script. +__53: + if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+504 /* &N1 */) == SQLITE_OK)) { + goto __342 + } + iPrior = Xsqlite3_hard_heap_limit64(tls, int64(-1)) + if !((*(*Sqlite3_int64)(unsafe.Pointer(bp + 504 /* N1 */)) > int64(0)) && ((iPrior == int64(0)) || (iPrior > *(*Sqlite3_int64)(unsafe.Pointer(bp + 504 /* N1 */))))) { + goto __343 + } + Xsqlite3_hard_heap_limit64(tls, *(*Sqlite3_int64)(unsafe.Pointer(bp + 504 /* N1 */))) +__343: + ; +__342: + ; + returnSingleInt(tls, v, Xsqlite3_hard_heap_limit64(tls, int64(-1))) + goto __15 + + // PRAGMA threads + // PRAGMA threads = N + // + // Configure the maximum number of worker threads. Return the new + // maximum, which might be less than requested. +__54: + if !(((zRight != 0) && + (Xsqlite3DecOrHexToI64(tls, zRight, bp+512 /* &N2 */) == SQLITE_OK)) && + (*(*Sqlite3_int64)(unsafe.Pointer(bp + 512 /* N2 */)) >= int64(0))) { + goto __344 + } + Xsqlite3_limit(tls, db, SQLITE_LIMIT_WORKER_THREADS, (int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 512 /* N2 */)) & int64(0x7fffffff)))) +__344: + ; + returnSingleInt(tls, v, int64(Xsqlite3_limit(tls, db, SQLITE_LIMIT_WORKER_THREADS, -1))) + goto __15 + + // PRAGMA analysis_limit + // PRAGMA analysis_limit = N + // + // Configure the maximum number of rows that ANALYZE will examine + // in each index that it looks at. Return the new limit. +__55: + if !(((zRight != 0) && + (Xsqlite3DecOrHexToI64(tls, zRight, bp+520 /* &N3 */) == SQLITE_OK)) && + (*(*Sqlite3_int64)(unsafe.Pointer(bp + 520 /* N3 */)) >= int64(0))) { + goto __345 + } + (*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit = (int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 520 /* N3 */)) & int64(0x7fffffff))) +__345: + ; + returnSingleInt(tls, v, int64((*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit)) + goto __15 + +__15: + ; // End of the PRAGMA switch + + // The following block is a no-op unless SQLITE_DEBUG is defined. Its only + // purpose is to execute assert() statements to verify that if the + // PragFlg_NoColumns1 flag is set and the caller specified an argument + // to the PRAGMA, the implementation has not added any OP_ResultRow + // instructions to the VM. + if !(((int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_NoColumns1) != 0) && (zRight != 0)) { + goto __346 + } + +__346: + ; + +pragma_out: + Xsqlite3DbFree(tls, db, zLeft) + Xsqlite3DbFree(tls, db, zRight) +} + +type EncName = struct { + FzName uintptr + Fenc U8 + _ [7]byte +} /* sqlite3.c:130282:18 */ + +var iLn3 int32 = 0 /* sqlite3.c:128958:22 */ +var getCacheSize = [9]VdbeOpList{ + {Fopcode: U8(OP_Transaction)}, // 0 + {Fopcode: U8(OP_ReadCookie), Fp2: int8(1), Fp3: int8(BTREE_DEFAULT_CACHE_SIZE)}, // 1 + {Fopcode: U8(OP_IfPos), Fp1: int8(1), Fp2: int8(8)}, + {Fopcode: U8(OP_Integer), Fp2: int8(2)}, + {Fopcode: U8(OP_Subtract), Fp1: int8(1), Fp2: int8(2), Fp3: int8(1)}, + {Fopcode: U8(OP_IfPos), Fp1: int8(1), Fp2: int8(8)}, + {Fopcode: U8(OP_Integer), Fp2: int8(1)}, // 6 + {Fopcode: U8(OP_Noop)}, + {Fopcode: U8(OP_ResultRow), Fp1: int8(1), Fp2: int8(1)}, +} /* sqlite3.c:128959:29 */ +var iLn4 int32 = 0 /* sqlite3.c:129227:26 */ +var setMeta6 = [5]VdbeOpList{ + {Fopcode: U8(OP_Transaction), Fp2: int8(1)}, // 0 + {Fopcode: U8(OP_ReadCookie), Fp2: int8(1), Fp3: int8(BTREE_LARGEST_ROOT_PAGE)}, + {Fopcode: U8(OP_If), Fp1: int8(1)}, // 2 + {Fopcode: U8(OP_Halt), Fp2: int8(OE_Abort)}, // 3 + {Fopcode: U8(OP_SetCookie), Fp2: int8(BTREE_INCR_VACUUM)}, // 4 +} /* sqlite3.c:129228:33 */ +var iLn5 int32 = 0 /* sqlite3.c:130232:24 */ +var endCode = [7]VdbeOpList{ + {Fopcode: U8(OP_AddImm), Fp1: int8(1)}, // 0 + {Fopcode: U8(OP_IfNotZero), Fp1: int8(1), Fp2: int8(4)}, // 1 + {Fopcode: U8(OP_String8), Fp2: int8(3)}, // 2 + {Fopcode: U8(OP_ResultRow), Fp1: int8(3), Fp2: int8(1)}, // 3 + {Fopcode: U8(OP_Halt)}, // 4 + {Fopcode: U8(OP_String8), Fp2: int8(3)}, // 5 + {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 +} /* sqlite3.c:130233:31 */ +var encnames1 = [9]EncName{ + {FzName: ts + 16391 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16396 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16402 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16411 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16420 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16428 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16436 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16443 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {}, +} /* sqlite3.c:130285:7 */ +var setCookie = [2]VdbeOpList{ + {Fopcode: U8(OP_Transaction), Fp2: int8(1)}, // 0 + {Fopcode: U8(OP_SetCookie)}, // 1 +} /* sqlite3.c:130365:31 */ +var readCookie = [3]VdbeOpList{ + {Fopcode: U8(OP_Transaction)}, // 0 + {Fopcode: U8(OP_ReadCookie), Fp2: int8(1)}, // 1 + {Fopcode: U8(OP_ResultRow), Fp1: int8(1), Fp2: int8(1)}, +} /* sqlite3.c:130380:31 */ +// **************************************************************************** +// +// Implementation of an eponymous virtual table that runs a pragma. +// +type PragmaVtab1 = struct { + Fbase Sqlite3_vtab + Fdb uintptr + FpName uintptr + FnHidden U8 + FiHidden U8 + _ [6]byte +} /* sqlite3.c:130740:9 */ + +// **************************************************************************** +// +// Implementation of an eponymous virtual table that runs a pragma. +// +type PragmaVtab = PragmaVtab1 /* sqlite3.c:130740:27 */ +type PragmaVtabCursor1 = struct { + Fbase Sqlite3_vtab_cursor + FpPragma uintptr + FiRowid Sqlite_int64 + FazArg [2]uintptr +} /* sqlite3.c:130741:9 */ + +type PragmaVtabCursor = PragmaVtabCursor1 /* sqlite3.c:130741:33 */ + +// Pragma virtual table module xConnect method. +func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:130759:12: */ + bp := tls.Alloc(264) + defer tls.Free(264) + + var pPragma uintptr = pAux + var pTab uintptr = uintptr(0) + var rc int32 + var i int32 + var j int32 + var cSep int8 = int8('(') + // var acc StrAccum at bp+32, 32 + + // var zBuf [200]int8 at bp+64, 200 + + _ = argc + _ = argv + Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+64 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16449 /* "CREATE TABLE x" */) + i = 0 + j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) +__1: + if !(i < int32((*PragmaName)(unsafe.Pointer(pPragma)).FnPragCName)) { + goto __3 + } + { + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16464 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + cSep = int8(',') + + } + goto __2 +__2: + i++ + j++ + goto __1 + goto __3 +__3: + ; + if i == 0 { + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16471 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + i++ + } + j = 0 + if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16477 /* ",arg HIDDEN" */) + j++ + } + if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16489 /* ",schema HIDDEN" */) + j++ + } + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4067 /* ")" */, 1) + Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) + + rc = Xsqlite3_declare_vtab(tls, db, bp+64 /* &zBuf[0] */) + if rc == SQLITE_OK { + pTab = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(PragmaVtab{}))) + if pTab == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(PragmaVtab{}))) + (*PragmaVtab)(unsafe.Pointer(pTab)).FpName = pPragma + (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb = db + (*PragmaVtab)(unsafe.Pointer(pTab)).FiHidden = U8(i) + (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) + } + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + } + + *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab + return rc +} + +// Pragma virtual table module xDisconnect method. +func pragmaVtabDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:130821:12: */ + var pTab uintptr = pVtab + Xsqlite3_free(tls, pTab) + return SQLITE_OK +} + +// Figure out the best index to use to search a pragma virtual table. +// +// There are not really any index choices. But we want to encourage the +// query planner to give == constraints on as many hidden parameters as +// possible, and especially on the first hidden parameter. So return a +// high cost if hidden parameters are unconstrained. +func pragmaVtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sqlite3.c:130834:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pTab uintptr = tab + var pConstraint uintptr + var i int32 + var j int32 + // var seen [2]int32 at bp, 8 + + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1) + if int32((*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden) == 0 { + return SQLITE_OK + } + pConstraint = (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + *(*int32)(unsafe.Pointer(bp /* &seen[0] */)) = 0 + *(*int32)(unsafe.Pointer(bp /* &seen[0] */ + 1*4)) = 0 + i = 0 +__1: + if !(i < (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + goto __3 + } + { + if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 { + goto __2 + } + if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ { + goto __2 + } + if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < int32((*PragmaVtab)(unsafe.Pointer(pTab)).FiHidden) { + goto __2 + } + j = ((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - int32((*PragmaVtab)(unsafe.Pointer(pTab)).FiHidden)) + + *(*int32)(unsafe.Pointer(bp /* &seen[0] */ + uintptr(j)*4)) = (i + 1) + + } + goto __2 +__2: + i++ + pConstraint += 12 + goto __1 + goto __3 +__3: + ; + if *(*int32)(unsafe.Pointer(bp /* &seen[0] */)) == 0 { + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(2147483647) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(2147483647) + return SQLITE_OK + } + j = (*(*int32)(unsafe.Pointer(bp /* &seen[0] */)) - 1) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).FargvIndex = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).Fomit = uint8(1) + if *(*int32)(unsafe.Pointer(bp /* &seen[0] */ + 1*4)) == 0 { + return SQLITE_OK + } + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(20) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(20) + j = (*(*int32)(unsafe.Pointer(bp /* &seen[0] */ + 1*4)) - 1) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).FargvIndex = 2 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).Fomit = uint8(1) + return SQLITE_OK +} + +// Create a new cursor for the pragma virtual table +func pragmaVtabOpen(tls *libc.TLS, pVtab uintptr, ppCursor uintptr) int32 { /* sqlite3.c:130871:12: */ + var pCsr uintptr + pCsr = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(PragmaVtabCursor{}))) + if pCsr == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pCsr, 0, uint64(unsafe.Sizeof(PragmaVtabCursor{}))) + (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab = pVtab + *(*uintptr)(unsafe.Pointer(ppCursor)) = (pCsr /* &.base */) + return SQLITE_OK +} + +// Clear all content from pragma virtual table cursor. +func pragmaVtabCursorClear(tls *libc.TLS, pCsr uintptr) { /* sqlite3.c:130882:13: */ + var i int32 + Xsqlite3_finalize(tls, (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) + (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma = uintptr(0) + for i = 0; i < (int32(uint64(unsafe.Sizeof([2]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))); i++ { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(i)*8)) = uintptr(0) + } +} + +// Close a pragma virtual table cursor +func pragmaVtabClose(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:130893:12: */ + var pCsr uintptr = cur + pragmaVtabCursorClear(tls, pCsr) + Xsqlite3_free(tls, pCsr) + return SQLITE_OK +} + +// Advance the pragma virtual table cursor to the next row +func pragmaVtabNext(tls *libc.TLS, pVtabCursor uintptr) int32 { /* sqlite3.c:130901:12: */ + var pCsr uintptr = pVtabCursor + var rc int32 = SQLITE_OK + + // Increment the xRowid value + (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FiRowid++ + + if SQLITE_ROW != Xsqlite3_step(tls, (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) { + rc = Xsqlite3_finalize(tls, (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma) + (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma = uintptr(0) + pragmaVtabCursorClear(tls, pCsr) + } + return rc +} + +// Pragma virtual table module xFilter method. +func pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3.c:130919:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var pCsr uintptr = pVtabCursor + var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + var rc int32 + var i int32 + var j int32 + // var acc StrAccum at bp+32, 32 + + var zSql uintptr + + _ = idxNum + _ = idxStr + pragmaVtabCursorClear(tls, pCsr) + if (int32((*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FmPragFlg) & PragFlg_Result1) != 0 { + j = 0 + } else { + j = 1 + } + i = 0 +__1: + if !(i < argc) { + goto __3 + } + { + var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + + if zText != 0 { + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, zText)) + if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) == uintptr(0) { + return SQLITE_NOMEM + } + } + + } + goto __2 +__2: + i++ + j++ + goto __1 + goto __3 +__3: + ; + Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16504 /* "PRAGMA " */) + if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)) != 0 { + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16512 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) + } + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) + if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))) != 0 { + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16516 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) + } + zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) + if zSql == uintptr(0) { + return SQLITE_NOMEM + } + rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pPragma */), uintptr(0)) + Xsqlite3_free(tls, zSql) + if rc != SQLITE_OK { + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + return rc + } + return pragmaVtabNext(tls, pVtabCursor) +} + +// Pragma virtual table module xEof method. +func pragmaVtabEof(tls *libc.TLS, pVtabCursor uintptr) int32 { /* sqlite3.c:130969:12: */ + var pCsr uintptr = pVtabCursor + return (libc.Bool32((*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma == uintptr(0))) +} + +// The xColumn method simply returns the corresponding column from +// the PRAGMA. +func pragmaVtabColumn(tls *libc.TLS, pVtabCursor uintptr, ctx uintptr, i int32) int32 { /* sqlite3.c:130977:12: */ + var pCsr uintptr = pVtabCursor + var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + if i < int32((*PragmaVtab)(unsafe.Pointer(pTab)).FiHidden) { + Xsqlite3_result_value(tls, ctx, Xsqlite3_column_value(tls, (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FpPragma, i)) + } else { + Xsqlite3_result_text(tls, ctx, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr((i-int32((*PragmaVtab)(unsafe.Pointer(pTab)).FiHidden)))*8)), -1, libc.UintptrFromInt32(-1)) + } + return SQLITE_OK +} + +// Pragma virtual table module xRowid method. +func pragmaVtabRowid(tls *libc.TLS, pVtabCursor uintptr, p uintptr) int32 { /* sqlite3.c:130995:12: */ + var pCsr uintptr = pVtabCursor + *(*Sqlite_int64)(unsafe.Pointer(p)) = (*PragmaVtabCursor)(unsafe.Pointer(pCsr)).FiRowid + return SQLITE_OK +} + +// The pragma virtual table object +var pragmaVtabModule = Sqlite3_module{ // xCreate - create a table + FxConnect: 0, // xConnect - connect to an existing table + FxBestIndex: 0, // xBestIndex - Determine search strategy + FxDisconnect: 0, // xDestroy - Drop a table + FxOpen: 0, // xOpen - open a cursor + FxClose: 0, // xClose - close a cursor + FxFilter: 0, // xFilter - configure scan constraints + FxNext: 0, // xNext - advance a cursor + FxEof: 0, // xEof + FxColumn: 0, // xColumn - read data + FxRowid: 0, // xShadowName +} /* sqlite3.c:131002:29 */ + +// Check to see if zTabName is really the name of a pragma. If it is, +// then register an eponymous virtual table for that pragma and return +// a pointer to the Module object for the new virtual table. +func Xsqlite3PragmaVtabRegister(tls *libc.TLS, db uintptr, zName uintptr) uintptr { /* sqlite3.c:131034:23: */ + var pName uintptr + + pName = pragmaLocate(tls, (zName + uintptr(7))) + if pName == uintptr(0) { + return uintptr(0) + } + if (int32((*PragmaName)(unsafe.Pointer(pName)).FmPragFlg) & (PragFlg_Result0 | PragFlg_Result1)) == 0 { + return uintptr(0) + } + + return Xsqlite3VtabCreateModule(tls, db, zName, uintptr(unsafe.Pointer(&pragmaVtabModule)), pName, uintptr(0)) +} + +//************* End of pragma.c ********************************************* +//************* Begin file prepare.c **************************************** +// 2005 May 25 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the implementation of the sqlite3_prepare() +// interface, and routines that contribute to loading the database schema +// from disk. +// #include "sqliteInt.h" + +// Fill the InitData structure with an error message that indicates +// that the database is corrupt. +func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) { /* sqlite3.c:131071:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*InitData)(unsafe.Pointer(pData)).Fdb + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_NOMEM + } else if *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) != uintptr(0) { + // A error message has already been generated. Do not overwrite it + } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { + *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, + ts+16520 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), + func() uintptr { + if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { + return ts + 16548 /* "rename" */ + } + return ts + 16555 /* "drop column" */ + }(), + zExtra)) + (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR + } else if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_WriteSchema)) != 0 { + (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131089) + } else { + var z uintptr + var zObj uintptr + if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { + zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) + } else { + zObj = ts + 4123 /* "?" */ + } + z = Xsqlite3MPrintf(tls, db, ts+16567 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { + z = Xsqlite3MPrintf(tls, db, ts+16598 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + } + *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z + (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) + } +} + +// Check to see if any sibling index (another index on the same table) +// of pIndex has the same root page number, and if it does, return true. +// This would indicate a corrupt schema. +func Xsqlite3IndexHasDuplicateRootPage(tls *libc.TLS, pIndex uintptr) int32 { /* sqlite3.c:131105:20: */ + var p uintptr + for p = (*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FpTable)).FpIndex; p != 0; p = (*Index)(unsafe.Pointer(p)).FpNext { + if ((*Index)(unsafe.Pointer(p)).Ftnum == (*Index)(unsafe.Pointer(pIndex)).Ftnum) && (p != pIndex) { + return 1 + } + } + return 0 +} + +// This is the callback routine for the code that initializes the +// database. See sqlite3Init() below for additional information. +// This routine is also called from the OP_ParseSchema opcode of the VDBE. +// +// Each callback contains the following information: +// +// argv[0] = type of object: "table", "index", "trigger", or "view". +// argv[1] = name of thing being created +// argv[2] = associated table if an index or trigger +// argv[3] = root page number for table or index. 0 for trigger or view. +// argv[4] = SQL text for the CREATE statement. +// +func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr, NotUsed uintptr) int32 { /* sqlite3.c:131139:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pData uintptr = pInit + var db uintptr = (*InitData)(unsafe.Pointer(pData)).Fdb + var iDb int32 = (*InitData)(unsafe.Pointer(pData)).FiDb + + _ = NotUsed + _ = argc + + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_EncodingFixed)) + if argv == uintptr(0) { + return 0 + } // Might happen if EMPTY_RESULT_CALLBACKS are on + (*InitData)(unsafe.Pointer(pData)).FnInitRow++ + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + corruptSchema(tls, pData, argv, uintptr(0)) + return 1 + } + + if *(*uintptr)(unsafe.Pointer(argv + 3*8)) == uintptr(0) { + corruptSchema(tls, pData, argv, uintptr(0)) + } else if ((*(*uintptr)(unsafe.Pointer(argv + 4*8)) != 0) && + ('c' == int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8)))))]))) && + ('r' == int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8)) + 1)))])) { + // Call the parser to process a CREATE TABLE, INDEX or VIEW. + // But because db->init.busy is set to 1, no VDBE code is generated + // or executed. All the parser does is build the internal data + // structures that describe the table, index, or view. + // + // No other valid SQL statement, other than the variable CREATE statements, + // can begin with the letters "C" and "R". Thus, it is not possible run + // any other kind of statement while parsing the schema, even a corrupt + // schema. + var rc int32 + var saved_iDb U8 = (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb + // var pStmt uintptr at bp, 8 + + // Return code from sqlite3_prepare() + + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(iDb) + if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (db+184 /* &.init */ /* &.newTnum */)) == 0) || + (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { + if Xsqlite3Config.FbExtraSchemaChecks != 0 { + corruptSchema(tls, pData, argv, ts+12851 /* "invalid rootpage" */) + } + } + libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) + (*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit = argv + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + sqlite3Prepare(tls, db, *(*uintptr)(unsafe.Pointer(argv + 4*8)), -1, uint32(0), uintptr(0), bp /* &pStmt */, uintptr(0)) + rc = (*Sqlite3)(unsafe.Pointer(db)).FerrCode + + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = saved_iDb + // assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); + if SQLITE_OK != rc { + if (uint32(int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.orphanTrigger */)) & 0x1 >> 0))) != 0 { + + } else { + if rc > (*InitData)(unsafe.Pointer(pData)).Frc { + (*InitData)(unsafe.Pointer(pData)).Frc = rc + } + if rc == SQLITE_NOMEM { + Xsqlite3OomFault(tls, db) + } else if (rc != SQLITE_INTERRUPT) && ((rc & 0xFF) != SQLITE_LOCKED) { + corruptSchema(tls, pData, argv, Xsqlite3_errmsg(tls, db)) + } + } + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } else if (*(*uintptr)(unsafe.Pointer(argv + 1*8)) == uintptr(0)) || ((*(*uintptr)(unsafe.Pointer(argv + 4*8)) != uintptr(0)) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 4*8))))) != 0)) { + corruptSchema(tls, pData, argv, uintptr(0)) + } else { + // If the SQL column is blank it means this is an index that + // was created to be the PRIMARY KEY or to fulfill a UNIQUE + // constraint for a CREATE TABLE. The index should have already + // been created when we processed the CREATE TABLE. All we have + // to do here is record the root page number for that index. + var pIndex uintptr + pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) + if pIndex == uintptr(0) { + corruptSchema(tls, pData, argv, ts+16606 /* "orphan index" */) + } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (pIndex+88 /* &.tnum */)) == 0) || + ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || + ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || + (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { + if Xsqlite3Config.FbExtraSchemaChecks != 0 { + corruptSchema(tls, pData, argv, ts+12851 /* "invalid rootpage" */) + } + } + } + return 0 +} + +// Attempt to read the database schema and initialize internal +// data structures for a single database file. The index of the +// database file is given by iDb. iDb==0 is used for the main +// database. iDb==1 should never be used. iDb>=2 is used for +// auxiliary databases. Return one of the SQLITE_ error codes to +// indicate success or failure. +func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFlags U32) int32 { /* sqlite3.c:131241:20: */ + bp := tls.Alloc(124) + defer tls.Free(124) + + var rc int32 + var i int32 + var size int32 + var pDb uintptr + // var azArg [6]uintptr at bp+16, 48 + + // var meta [5]int32 at bp+104, 20 + + // var initData InitData at bp+64, 40 + + var zSchemaTabName uintptr + var openedTransaction int32 + var mask int32 + var encoding U8 + var xAuth Sqlite3_xauth + var zSql uintptr + openedTransaction = 0 + mask = (int32(((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_EncodingFixed)) | libc.Uint32FromInt32(libc.CplInt32(DBFLAG_EncodingFixed)))) + + (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy = U8(1) + + // Construct the in-memory representation schema tables (sqlite_schema or + // sqlite_temp_schema) by invoking the parser directly. The appropriate + // table name will be inserted automatically by the parser so we can just + // use the abbreviation "x" here. The parser will also automatically tag + // the schema table as read-only. + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7824 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { + if (!(0 != 0)) && (iDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }()) + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 6914 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 16619 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*8)) = uintptr(0) + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Fdb = db + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FiDb = iDb + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Frc = SQLITE_OK + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FpzErrMsg = pzErrMsg + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmInitFlags = mFlags + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FnInitRow = U32(0) + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Pgno(0) + Xsqlite3InitCallback(tls, bp+64 /* &initData */, 5, bp+16 /* azArg */, uintptr(0)) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (U32(mask)) + if !((*InitData)(unsafe.Pointer(bp+64 /* &initData */)).Frc != 0) { + goto __1 + } + rc = (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Frc + goto error_out +__1: + ; + + // Create a cursor to hold the database open + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + if !((*Db)(unsafe.Pointer(pDb)).FpBt == uintptr(0)) { + goto __2 + } + + *(*U16)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+1*32)).FpSchema + 114 /* &.schemaFlags */)) |= U16((DB_SchemaLoaded)) + rc = SQLITE_OK + goto error_out +__2: + ; + + // If there is not already a read-only (or read-write) transaction opened + // on the b-tree database, open one now. If a transaction is opened, it + // will be closed before this function returns. + Xsqlite3BtreeEnter(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + if !(Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) == SQLITE_TXN_NONE) { + goto __3 + } + rc = Xsqlite3BtreeBeginTrans(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, 0, uintptr(0)) + if !(rc != SQLITE_OK) { + goto __4 + } + Xsqlite3SetString(tls, pzErrMsg, db, Xsqlite3ErrStr(tls, rc)) + goto initone_error_out +__4: + ; + openedTransaction = 1 +__3: + ; + + // Get the database meta information. + // + // Meta values are as follows: + // meta[0] Schema cookie. Changes with each schema change. + // meta[1] File format of schema layer. + // meta[2] Size of the page cache. + // meta[3] Largest rootpage (auto/incr_vacuum mode) + // meta[4] Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE + // meta[5] User version + // meta[6] Incremental vacuum mode + // meta[7] unused + // meta[8] unused + // meta[9] unused + // + // Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to + // the possible values of meta[4]. + i = 0 +__5: + if !(i < (int32(uint64(unsafe.Sizeof([5]int32{})) / uint64(unsafe.Sizeof(int32(0)))))) { + goto __7 + } + Xsqlite3BtreeGetMeta(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (i + 1), (bp + 104 /* &meta */ + uintptr(i)*4)) + goto __6 +__6: + i++ + goto __5 + goto __7 +__7: + ; + if !(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ResetDatabase)) != uint64(0)) { + goto __8 + } + libc.Xmemset(tls, bp+104 /* &meta[0] */, 0, uint64(unsafe.Sizeof([5]int32{}))) +__8: + ; + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fschema_cookie = *(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */)) + + // If opening a non-empty database, check the text encoding. For the + // main database, set sqlite3.enc to the encoding of the main database. + // For an attached db, it is an error if the encoding is not the same + // as sqlite3.enc. + if !(*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 4*4)) != 0) { + goto __9 + } // text encoding + if !((iDb == 0) && (((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_EncodingFixed)) == U32(0))) { + goto __10 + } + // If opening the main database, set ENC(db). + encoding = (U8(int32(U8(*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 4*4)))) & 3)) + if !(int32(encoding) == 0) { + goto __12 + } + encoding = U8(SQLITE_UTF8) +__12: + ; + Xsqlite3SetTextEncoding(tls, db, encoding) + goto __11 +__10: + // If opening an attached database, the encoding much match ENC(db) + if !((*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 4*4)) & 3) != (int32((*Sqlite3)(unsafe.Pointer(db)).Fenc))) { + goto __13 + } + Xsqlite3SetString(tls, pzErrMsg, db, + ts+10500 /* "attached databas..." */) + rc = SQLITE_ERROR + goto initone_error_out +__13: + ; +__11: + ; +__9: + ; + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fenc = (*Sqlite3)(unsafe.Pointer(db)).Fenc + + if !((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size == 0) { + goto __14 + } + size = Xsqlite3AbsInt32(tls, *(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 2*4))) + if !(size == 0) { + goto __15 + } + size = -2000 +__15: + ; + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size = size + Xsqlite3BtreeSetCacheSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size) +__14: + ; + + // file_format==1 Version 3.0.0. + // file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN + // file_format==3 Version 3.1.4. // ditto but with non-NULL defaults + // file_format==4 Version 3.3.0. // DESC indices. Boolean constants + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = U8(*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 1*4))) + if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) == 0) { + goto __16 + } + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = U8(1) +__16: + ; + if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { + goto __17 + } + Xsqlite3SetString(tls, pzErrMsg, db, ts+16691 /* "unsupported file..." */) + rc = SQLITE_ERROR + goto initone_error_out +__17: + ; + + // Ticket #2804: When we open a database in the newer file format, + // clear the legacy_file_format pragma flag so that a VACUUM will + // not downgrade the database and thus invalidate any descending + // indices that the user might have created. + if !((iDb == 0) && (*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 1*4)) >= 4)) { + goto __18 + } + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_LegacyFileFmt))) +__18: + ; + + // Read the schema information out of the schema tables + + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + + zSql = Xsqlite3MPrintf(tls, db, + ts+16715, /* "SELECT*FROM\"%w\"...." */ + libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zSchemaTabName)) + + xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) + rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 + }{Xsqlite3InitCallback})), bp+64 /* &initData */, uintptr(0)) + (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth + + if !(rc == SQLITE_OK) { + goto __19 + } + rc = (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Frc +__19: + ; + Xsqlite3DbFree(tls, db, zSql) + if !(rc == SQLITE_OK) { + goto __20 + } + Xsqlite3AnalysisLoad(tls, db, iDb) +__20: + ; + + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __21 + } + rc = SQLITE_NOMEM + Xsqlite3ResetAllSchemasOfConnection(tls, db) + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) + goto __22 +__21: + if !((rc == SQLITE_OK) || (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_NoSchemaError)) != 0)) { + goto __23 + } + // Hack: If the SQLITE_NoSchemaError flag is set, then consider + // the schema loaded, even if errors (other than OOM) occurred. In + // this situation the current sqlite3_prepare() operation will fail, + // but the following one will attempt to compile the supplied statement + // against whatever subset of the schema was loaded before the error + // occurred. + // + // The primary purpose of this is to allow access to the sqlite_schema + // table even when its contents have been corrupted. + *(*U16)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(iDb)*32)).FpSchema + 114 /* &.schemaFlags */)) |= U16((DB_SchemaLoaded)) + rc = SQLITE_OK +__23: + ; +__22: + ; + + // Jump here for an error that occurs after successfully allocating + // curMain and calling sqlite3BtreeEnter(). For an error that occurs + // before that point, jump to error_out. +initone_error_out: + if !(openedTransaction != 0) { + goto __24 + } + Xsqlite3BtreeCommit(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) +__24: + ; + Xsqlite3BtreeLeave(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + +error_out: + if !(rc != 0) { + goto __25 + } + if !((rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8)))) { + goto __26 + } + Xsqlite3OomFault(tls, db) +__26: + ; + Xsqlite3ResetOneSchema(tls, db, iDb) +__25: + ; + (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy = U8(0) + return rc +} + +// Initialize all database files - the main database file, the file +// used to store temporary tables, and any additional database files +// created using ATTACH statements. Return a success code. If an +// error occurs, write an error message into *pzErrMsg. +// +// After a database is initialized, the DB_SchemaLoaded bit is set +// bit is set in the flags field of the Db structure. +func Xsqlite3Init(tls *libc.TLS, db uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:131480:20: */ + var i int32 + var rc int32 + var commit_internal int32 = libc.BoolInt32(!(((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_SchemaChange)) != 0)) + + ((*Sqlite3)(unsafe.Pointer(db)).Fenc) = (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb)).FpSchema)).Fenc + + // Do the main schema first + if !((int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb)).FpSchema)).FschemaFlags) & (DB_SchemaLoaded)) == (DB_SchemaLoaded)) { + rc = Xsqlite3InitOne(tls, db, 0, pzErrMsg, uint32(0)) + if rc != 0 { + return rc + } + } + // All other schemas after the main schema. The "temp" schema must be last + for i = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1); i > 0; i-- { + + if !((int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb+uintptr(i)*32)).FpSchema)).FschemaFlags) & (DB_SchemaLoaded)) == (DB_SchemaLoaded)) { + rc = Xsqlite3InitOne(tls, db, i, pzErrMsg, uint32(0)) + if rc != 0 { + return rc + } + } + } + if commit_internal != 0 { + Xsqlite3CommitInternalChanges(tls, db) + } + return SQLITE_OK +} + +// This routine is a no-op if the database schema is already initialized. +// Otherwise, the schema is loaded. An error code is returned. +func Xsqlite3ReadSchema(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:131512:20: */ + var rc int32 = SQLITE_OK + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0) { + rc = Xsqlite3Init(tls, db, (pParse + 8 /* &.zErrMsg */)) + if rc != SQLITE_OK { + (*Parse)(unsafe.Pointer(pParse)).Frc = rc + (*Parse)(unsafe.Pointer(pParse)).FnErr++ + } else if (*Sqlite3)(unsafe.Pointer(db)).FnoSharedCache != 0 { + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaKnownOk)) + } + } + return rc +} + +// Check schema cookies in all databases. If any cookie is out +// of date set pParse->rc to SQLITE_SCHEMA. If all schema cookies +// make no changes to pParse->rc. +func schemaIsValid(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:131534:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var iDb int32 + var rc int32 + // var cookie int32 at bp, 4 + + for iDb = 0; iDb < (*Sqlite3)(unsafe.Pointer(db)).FnDb; iDb++ { + var openedTransaction int32 = 0 // True if a transaction is opened + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt // Btree database to read cookie from + if pBt == uintptr(0) { + continue + } + + // If there is not already a read-only (or read-write) transaction opened + // on the b-tree database, open one now. If a transaction is opened, it + // will be closed immediately after reading the meta-value. + if Xsqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_NONE { + rc = Xsqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { + Xsqlite3OomFault(tls, db) + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + } + if rc != SQLITE_OK { + return + } + openedTransaction = 1 + } + + // Read the schema cookie from the database. If it does not match the + // value stored as part of the in-memory schema representation, + // set Parse.rc to SQLITE_SCHEMA. + Xsqlite3BtreeGetMeta(tls, pBt, BTREE_SCHEMA_VERSION, bp /* &cookie */) + + if *(*int32)(unsafe.Pointer(bp /* cookie */)) != (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema)).Fschema_cookie { + Xsqlite3ResetOneSchema(tls, db, iDb) + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_SCHEMA + } + + // Close the transaction, if one was opened. + if openedTransaction != 0 { + Xsqlite3BtreeCommit(tls, pBt) + } + } +} + +// Convert a schema pointer into the iDb index that indicates +// which database file in db->aDb[] the schema refers to. +// +// If the same database is attached more than once, the first +// attached database is returned. +func Xsqlite3SchemaToIndex(tls *libc.TLS, db uintptr, pSchema uintptr) int32 { /* sqlite3.c:131584:20: */ + var i int32 = -32768 + + // If pSchema is NULL, then return -32768. This happens when code in + // expr.c is trying to resolve a reference to a transient table (i.e. one + // created by a sub-select). In this case the return value of this + // function should never be used. + // + // We return -32768 instead of the more usual -1 simply because using + // -32768 as the incorrect index into db->aDb[] is much + // more likely to cause a segfault than -1 (of course there are assert() + // statements too, but it never hurts to play the odds) and + // -32768 will still fit into a 16-bit signed integer. + + if pSchema != 0 { + for i = 0; 1 != 0; i++ { + + if (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema == pSchema { + break + } + } + + } + return i +} + +// Free all memory allocations in the pParse object +func Xsqlite3ParserReset(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:131614:21: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + for (*Parse)(unsafe.Pointer(pParse)).FpCleanup != 0 { + var pCleanup uintptr = (*Parse)(unsafe.Pointer(pParse)).FpCleanup + (*Parse)(unsafe.Pointer(pParse)).FpCleanup = (*ParseCleanup)(unsafe.Pointer(pCleanup)).FpNext + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pCleanup + 16 /* &.xCleanup */))))(tls, db, (*ParseCleanup)(unsafe.Pointer(pCleanup)).FpPtr) + Xsqlite3DbFreeNN(tls, db, pCleanup) + } + Xsqlite3DbFree(tls, db, (*Parse)(unsafe.Pointer(pParse)).FaLabel) + if (*Parse)(unsafe.Pointer(pParse)).FpConstExpr != 0 { + Xsqlite3ExprListDelete(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpConstExpr) + } + if db != 0 { + + *(*U32)(unsafe.Pointer(db + 408 /* &.lookaside */ /* &.bDisable */)) -= (U32((*Parse)(unsafe.Pointer(pParse)).FdisableLookaside)) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = func() uint16 { + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { + return uint16(0) + } + return (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue + }() + } + (*Parse)(unsafe.Pointer(pParse)).FdisableLookaside = U8(0) +} + +// Add a new cleanup operation to a Parser. The cleanup should happen when +// the parser object is destroyed. But, beware: the cleanup might happen +// immediately. +// +// Use this mechanism for uncommon cleanups. There is a higher setup +// cost for this mechansim (an extra malloc), so it should not be used +// for common cleanups that happen on most calls. But for less +// common cleanups, we save a single NULL-pointer comparison in +// sqlite3ParserReset(), which reduces the total CPU cycle count. +// +// If a memory allocation error occurs, then the cleanup happens immediately. +// When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the +// pParse->earlyCleanup flag is set in that case. Calling code show verify +// that test cases exist for which this happens, to guard against possible +// use-after-free errors following an OOM. The preferred way to do this is +// to immediately follow the call to this routine with: +// +// testcase( pParse->earlyCleanup ); +// +// This routine returns a copy of its pPtr input (the third parameter) +// except if an early cleanup occurs, in which case it returns NULL. So +// another way to check for early cleanup is to check the return value. +// Or, stop using the pPtr parameter with this call and use only its +// return value thereafter. Something like this: +// +// pObj = sqlite3ParserAddCleanup(pParse, destructor, pObj); +func Xsqlite3ParserAddCleanup(tls *libc.TLS, pParse uintptr, xCleanup uintptr, pPtr uintptr) uintptr { /* sqlite3.c:131662:21: */ + var pCleanup uintptr = Xsqlite3DbMallocRaw(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(ParseCleanup{}))) + if pCleanup != 0 { + (*ParseCleanup)(unsafe.Pointer(pCleanup)).FpNext = (*Parse)(unsafe.Pointer(pParse)).FpCleanup + (*Parse)(unsafe.Pointer(pParse)).FpCleanup = pCleanup + (*ParseCleanup)(unsafe.Pointer(pCleanup)).FpPtr = pPtr + (*ParseCleanup)(unsafe.Pointer(pCleanup)).FxCleanup = xCleanup + } else { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&xCleanup)))(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pPtr) + pPtr = uintptr(0) + } + return pPtr +} + +// Compile the UTF-8 encoded SQL statement zSql into a statement handle. +func sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags U32, pReprepare uintptr, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131686:12: */ + bp := tls.Alloc(432) + defer tls.Free(432) + + // var zErrMsg uintptr at bp+424, 8 + // Error message + var rc int32 // Result code + var i int32 // Loop counter + // var sParse Parse at bp+16, 408 + + var zDb uintptr + var pBt uintptr + var zSqlCopy uintptr + var mxLen int32 + var pT uintptr + *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) = uintptr(0) + rc = SQLITE_OK // Parsing context + + libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64((uintptr(0) + 208 /* &.aTempReg */))) + libc.Xmemset(tls, ((bp + 16 /* &sParse */) + uintptr((uint64((uintptr(0) + 256 /* &.sLastToken */))))), 0, (uint64(unsafe.Sizeof(Parse{})) - (uint64((uintptr(0) + 256 /* &.sLastToken */))))) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpReprepare = pReprepare + + // assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA + + // For a long-term use prepared statement avoid the use of + // lookaside memory. + if !((prepFlags & U32(SQLITE_PREPARE_PERSISTENT)) != 0) { + goto __1 + } + (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FdisableLookaside++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) +__1: + ; + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FdisableVtab = (U8(libc.Bool32((prepFlags & U32(SQLITE_PREPARE_NO_VTAB)) != U32(0)))) + + // Check to verify that it is possible to get a read lock on all + // database schemas. The inability to get a read lock indicates that + // some other database connection is holding a write-lock, which in + // turn means that the other connection has made uncommitted changes + // to the schema. + // + // Were we to proceed and prepare the statement against the uncommitted + // schema changes and if those schema changes are subsequently rolled + // back and different changes are made in their place, then when this + // prepared statement goes to run the schema cookie would fail to detect + // the schema change. Disaster would follow. + // + // This thread is currently holding mutexes on all Btrees (because + // of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it + // is not possible for another thread to start a new schema change + // while this routine is running. Hence, we do not need to hold + // locks on the schema, we just need to make sure nobody else is + // holding them. + // + // Note that setting READ_UNCOMMITTED overrides most lock detection, + // but it does *not* override schema lock detection, so this all still + // works even if READ_UNCOMMITTED is set. + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FnoSharedCache) != 0)) { + goto __2 + } + i = 0 +__3: + if !(i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __5 + } + pBt = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if !(pBt != 0) { + goto __6 + } + + rc = Xsqlite3BtreeSchemaLocked(tls, pBt) + if !(rc != 0) { + goto __7 + } + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FzDbSName + Xsqlite3ErrorWithMsg(tls, db, rc, ts+16749 /* "database schema ..." */, libc.VaList(bp, zDb)) + + goto end_prepare +__7: + ; +__6: + ; + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; +__2: + ; + + Xsqlite3VtabUnlockList(tls, db) + + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = db + if !((nBytes >= 0) && ((nBytes == 0) || (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((nBytes - 1))))) != 0))) { + goto __8 + } + mxLen = *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 1*4)) + + if !(nBytes > mxLen) { + goto __10 + } + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16779 /* "statement too lo..." */, 0) + rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) + goto end_prepare +__10: + ; + zSqlCopy = Xsqlite3DbStrNDup(tls, db, zSql, uint64(nBytes)) + if !(zSqlCopy != 0) { + goto __11 + } + Xsqlite3RunParser(tls, bp+16 /* &sParse */, zSqlCopy, bp+424 /* &zErrMsg */) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FzTail = (zSql + uintptr(((int64((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzTail) - int64(zSqlCopy)) / 1))) + Xsqlite3DbFree(tls, db, zSqlCopy) + goto __12 +__11: + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FzTail = (zSql + uintptr(nBytes)) +__12: + ; + goto __9 +__8: + Xsqlite3RunParser(tls, bp+16 /* &sParse */, zSql, bp+424 /* &zErrMsg */) +__9: + ; + + if !(pzTail != 0) { + goto __13 + } + *(*uintptr)(unsafe.Pointer(pzTail)) = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FzTail +__13: + ; + + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { + goto __14 + } + Xsqlite3VdbeSetSql(tls, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe, zSql, (int32((int64((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzTail) - int64(zSql)) / 1)), uint8(prepFlags)) +__14: + ; + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __15 + } + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Frc = SQLITE_NOMEM + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FcheckSchema = U8(0) +__15: + ; + if !(((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc != SQLITE_DONE)) { + goto __16 + } + if !((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FcheckSchema != 0) { + goto __18 + } + schemaIsValid(tls, bp+16 /* &sParse */) +__18: + ; + if !((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe != 0) { + goto __19 + } + Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe) +__19: + ; + + rc = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Frc + if !(*(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) != 0) { + goto __20 + } + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2791 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */))) + goto __21 +__20: + Xsqlite3Error(tls, db, rc) +__21: + ; + goto __17 +__16: + ; + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpVdbe + rc = SQLITE_OK + Xsqlite3ErrorClear(tls, db) +__17: + ; + + // Delete any TriggerPrg structures allocated while parsing this statement. +__22: + if !((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpTriggerPrg != 0) { + goto __23 + } + pT = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpTriggerPrg + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpTriggerPrg = (*TriggerPrg)(unsafe.Pointer(pT)).FpNext + Xsqlite3DbFree(tls, db, pT) + goto __22 +__23: + ; + +end_prepare: + + Xsqlite3ParserReset(tls, bp+16 /* &sParse */) + return rc +} + +func sqlite3LockAndPrepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags U32, pOld uintptr, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131827:12: */ + var rc int32 + var cnt int32 = 0 + + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + if !(Xsqlite3SafetyCheckOk(tls, db) != 0) || (zSql == uintptr(0)) { + return Xsqlite3MisuseError(tls, 131844) + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3BtreeEnterAll(tls, db) + for ok := true; ok; ok = ((rc == (SQLITE_ERROR | (int32(2) << 8))) || + ((rc == SQLITE_SCHEMA) && ((func() int32 { Xsqlite3ResetOneSchema(tls, db, -1); return libc.PostIncInt32(&cnt, 1) }()) == 0))) { + // Make multiple attempts to compile the SQL, until it either succeeds + // or encounters a permanent error. A schema problem after one schema + // reset is considered a permanent error. + rc = sqlite3Prepare(tls, db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail) + + } + Xsqlite3BtreeLeaveAll(tls, db) + rc = Xsqlite3ApiExit(tls, db, rc) + + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Rerun the compilation of a statement after a schema change. +// +// If the statement is successfully recompiled, return SQLITE_OK. Otherwise, +// if the statement cannot be recompiled because another connection has +// locked the sqlite3_schema table, return SQLITE_LOCKED. If any other error +// occurs, return SQLITE_SCHEMA. +func Xsqlite3Reprepare(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:131873:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + // var pNew uintptr at bp, 8 + + var zSql uintptr + var db uintptr + var prepFlags U8 + + zSql = Xsqlite3_sql(tls, p) + // Reprepare only called for prepare_v2() statements + db = Xsqlite3VdbeDb(tls, p) + + prepFlags = Xsqlite3VdbePrepareFlags(tls, p) + rc = sqlite3LockAndPrepare(tls, db, zSql, -1, uint32(prepFlags), p, bp /* &pNew */, uintptr(0)) + if rc != 0 { + if rc == SQLITE_NOMEM { + Xsqlite3OomFault(tls, db) + } + + return rc + } else { + + } + Xsqlite3VdbeSwap(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */)), p) + Xsqlite3TransferBindings(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */)), p) + Xsqlite3VdbeResetStepResult(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + Xsqlite3VdbeFinalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + return SQLITE_OK +} + +// Two versions of the official API. Legacy and new use. In the legacy +// version, the original SQL text is not saved in the prepared statement +// and so if a schema change occurs, SQLITE_SCHEMA is returned by +// sqlite3_step(). In the new version, the original SQL text is retained +// and the statement is automatically recompiled if an schema change +// occurs. +func Xsqlite3_prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131912:16: */ + var rc int32 + rc = sqlite3LockAndPrepare(tls, db, zSql, nBytes, uint32(0), uintptr(0), ppStmt, pzTail) + // VERIFY: F13021 + return rc +} + +func Xsqlite3_prepare_v2(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131924:16: */ + var rc int32 + // EVIDENCE-OF: R-37923-12173 The sqlite3_prepare_v2() interface works + // exactly the same as sqlite3_prepare_v3() with a zero prepFlags + // parameter. + // + // Proof in that the 5th parameter to sqlite3LockAndPrepare is 0 + rc = sqlite3LockAndPrepare(tls, db, zSql, nBytes, uint32(SQLITE_PREPARE_SAVESQL), uintptr(0), + ppStmt, pzTail) + + return rc +} + +func Xsqlite3_prepare_v3(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags uint32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131942:16: */ + var rc int32 + // EVIDENCE-OF: R-56861-42673 sqlite3_prepare_v3() differs from + // sqlite3_prepare_v2() only in having the extra prepFlags parameter, + // which is a bit array consisting of zero or more of the + // SQLITE_PREPARE_* flags. + // + // Proof by comparison to the implementation of sqlite3_prepare_v2() + // directly above. + rc = sqlite3LockAndPrepare(tls, db, zSql, nBytes, + (uint32(SQLITE_PREPARE_SAVESQL) | (prepFlags & uint32(SQLITE_PREPARE_MASK))), + uintptr(0), ppStmt, pzTail) + + return rc +} + +// Compile the UTF-16 encoded SQL statement zSql into a statement handle. +func sqlite3Prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags U32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131970:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // This function currently works by first transforming the UTF-16 + // encoded string to UTF-8, then invoking sqlite3_prepare(). The + // tricky bit is figuring out the pointer to return in *pzTail. + var zSql8 uintptr + *(*uintptr)(unsafe.Pointer(bp /* zTail8 */)) = uintptr(0) + var rc int32 = SQLITE_OK + + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + if !(Xsqlite3SafetyCheckOk(tls, db) != 0) || (zSql == uintptr(0)) { + return Xsqlite3MisuseError(tls, 131991) + } + if nBytes >= 0 { + var sz int32 + var z uintptr = zSql + for sz = 0; (sz < nBytes) && ((int32(*(*int8)(unsafe.Pointer(z + uintptr(sz)))) != 0) || (int32(*(*int8)(unsafe.Pointer(z + uintptr((sz + 1))))) != 0)); sz = sz + (2) { + } + nBytes = sz + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + zSql8 = Xsqlite3Utf16to8(tls, db, zSql, nBytes, uint8(SQLITE_UTF16LE)) + if zSql8 != 0 { + rc = sqlite3LockAndPrepare(tls, db, zSql8, -1, prepFlags, uintptr(0), ppStmt, bp /* &zTail8 */) + } + + if (*(*uintptr)(unsafe.Pointer(bp /* zTail8 */)) != 0) && (pzTail != 0) { + // If sqlite3_prepare returns a tail pointer, we calculate the + // equivalent pointer into the UTF-16 string by counting the unicode + // characters between zSql8 and zTail8, and then returning a pointer + // the same number of characters into the UTF-16 string. + var chars_parsed int32 = Xsqlite3Utf8CharLen(tls, zSql8, (int32((int64(*(*uintptr)(unsafe.Pointer(bp /* zTail8 */))) - int64(zSql8)) / 1))) + *(*uintptr)(unsafe.Pointer(pzTail)) = (zSql + uintptr(Xsqlite3Utf16ByteLen(tls, zSql, chars_parsed))) + } + Xsqlite3DbFree(tls, db, zSql8) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Two versions of the official API. Legacy and new use. In the legacy +// version, the original SQL text is not saved in the prepared statement +// and so if a schema change occurs, SQLITE_SCHEMA is returned by +// sqlite3_step(). In the new version, the original SQL text is retained +// and the statement is automatically recompiled if an schema change +// occurs. +func Xsqlite3_prepare16(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:132028:16: */ + var rc int32 + rc = sqlite3Prepare16(tls, db, zSql, nBytes, uint32(0), ppStmt, pzTail) + // VERIFY: F13021 + return rc +} + +func Xsqlite3_prepare16_v2(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:132040:16: */ + var rc int32 + rc = sqlite3Prepare16(tls, db, zSql, nBytes, uint32(SQLITE_PREPARE_SAVESQL), ppStmt, pzTail) + // VERIFY: F13021 + return rc +} + +func Xsqlite3_prepare16_v3(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags uint32, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:132052:16: */ + var rc int32 + rc = sqlite3Prepare16(tls, db, zSql, nBytes, + (uint32(SQLITE_PREPARE_SAVESQL) | (prepFlags & uint32(SQLITE_PREPARE_MASK))), + ppStmt, pzTail) + // VERIFY: F13021 + return rc +} + +//************* End of prepare.c ******************************************** +//************* Begin file select.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains C code routines that are called by the parser +// to handle SELECT statements in SQLite. +// #include "sqliteInt.h" + +// An instance of the following object is used to record information about +// how to process the DISTINCT keyword, to simplify passing that information +// into the selectInnerLoop() routine. +type DistinctCtx1 = struct { + FisTnct U8 + FeTnctType U8 + _ [2]byte + FtabTnct int32 + FaddrTnct int32 +} /* sqlite3.c:132093:9 */ + +//************* End of prepare.c ******************************************** +//************* Begin file select.c ***************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains C code routines that are called by the parser +// to handle SELECT statements in SQLite. +// #include "sqliteInt.h" + +// An instance of the following object is used to record information about +// how to process the DISTINCT keyword, to simplify passing that information +// into the selectInnerLoop() routine. +type DistinctCtx = DistinctCtx1 /* sqlite3.c:132093:28 */ + +// An instance of the following object is used to record information about +// the ORDER BY (or GROUP BY) clause of query is being coded. +// +// The aDefer[] array is used by the sorter-references optimization. For +// example, assuming there is no index that can be used for the ORDER BY, +// for the query: +// +// SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10; +// +// it may be more efficient to add just the "a" values to the sorter, and +// retrieve the associated "bigblob" values directly from table t1 as the +// 10 smallest "a" values are extracted from the sorter. +// +// When the sorter-reference optimization is used, there is one entry in the +// aDefer[] array for each database table that may be read as values are +// extracted from the sorter. +type SortCtx1 = struct { + FpOrderBy uintptr + FnOBSat int32 + FiECursor int32 + FregReturn int32 + FlabelBkOut int32 + FaddrSortIndex int32 + FlabelDone int32 + FlabelOBLopt int32 + FsortFlags U8 + _ [3]byte + FpDeferredRowLoad uintptr +} /* sqlite3.c:132119:9 */ + +// An instance of the following object is used to record information about +// the ORDER BY (or GROUP BY) clause of query is being coded. +// +// The aDefer[] array is used by the sorter-references optimization. For +// example, assuming there is no index that can be used for the ORDER BY, +// for the query: +// +// SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10; +// +// it may be more efficient to add just the "a" values to the sorter, and +// retrieve the associated "bigblob" values directly from table t1 as the +// 10 smallest "a" values are extracted from the sorter. +// +// When the sorter-reference optimization is used, there is one entry in the +// aDefer[] array for each database table that may be read as values are +// extracted from the sorter. +type SortCtx = SortCtx1 /* sqlite3.c:132119:24 */ +type RowLoadInfo1 = struct { + FregResult int32 + FecelFlags U8 + _ [3]byte +} /* sqlite3.c:132119:9 */ + +// Delete all the content of a Select structure. Deallocate the structure +// itself depending on the value of bFree +// +// If bFree==1, call sqlite3DbFree() on the p object. +// If bFree==0, Leave the first Select object unfreed +func clearSelect(tls *libc.TLS, db uintptr, p uintptr, bFree int32) { /* sqlite3.c:132149:13: */ + for p != 0 { + var pPrior uintptr = (*Select)(unsafe.Pointer(p)).FpPrior + Xsqlite3ExprListDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpEList) + Xsqlite3SrcListDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpSrc) + Xsqlite3ExprDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpWhere) + Xsqlite3ExprListDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpGroupBy) + Xsqlite3ExprDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpHaving) + Xsqlite3ExprListDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpOrderBy) + Xsqlite3ExprDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpLimit) + if (*Select)(unsafe.Pointer(p)).FpWith != 0 { + Xsqlite3WithDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpWith) + } + if (*Select)(unsafe.Pointer(p)).FpWinDefn != 0 { + Xsqlite3WindowListDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpWinDefn) + } + for (*Select)(unsafe.Pointer(p)).FpWin != 0 { + + Xsqlite3WindowUnlinkFromSelect(tls, (*Select)(unsafe.Pointer(p)).FpWin) + } + if bFree != 0 { + Xsqlite3DbFreeNN(tls, db, p) + } + p = pPrior + bFree = 1 + } +} + +// Initialize a SelectDest structure. +func Xsqlite3SelectDestInit(tls *libc.TLS, pDest uintptr, eDest int32, iParm int32) { /* sqlite3.c:132178:21: */ + (*SelectDest)(unsafe.Pointer(pDest)).FeDest = U8(eDest) + (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm = iParm + (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm2 = 0 + (*SelectDest)(unsafe.Pointer(pDest)).FzAffSdst = uintptr(0) + (*SelectDest)(unsafe.Pointer(pDest)).FiSdst = 0 + (*SelectDest)(unsafe.Pointer(pDest)).FnSdst = 0 +} + +// Allocate a new Select structure and return a pointer to that +// structure. +func Xsqlite3SelectNew(tls *libc.TLS, pParse uintptr, pEList uintptr, pSrc uintptr, pWhere uintptr, pGroupBy uintptr, pHaving uintptr, pOrderBy uintptr, selFlags U32, pLimit uintptr) uintptr { /* sqlite3.c:132192:23: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + var pNew uintptr + var pAllocated uintptr + // var standin Select at bp, 128 + + pAllocated = libc.AssignUintptr(&pNew, Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Select{})))) + if pNew == uintptr(0) { + + pNew = bp /* &standin */ + } + if pEList == uintptr(0) { + pEList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), + Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ASTERISK, uintptr(0))) + } + (*Select)(unsafe.Pointer(pNew)).FpEList = pEList + (*Select)(unsafe.Pointer(pNew)).Fop = U8(TK_SELECT) + (*Select)(unsafe.Pointer(pNew)).FselFlags = selFlags + (*Select)(unsafe.Pointer(pNew)).FiLimit = 0 + (*Select)(unsafe.Pointer(pNew)).FiOffset = 0 + (*Select)(unsafe.Pointer(pNew)).FselId = U32(libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnSelect, 1)) + *(*int32)(unsafe.Pointer((pNew + 20 /* &.addrOpenEphm */))) = -1 + *(*int32)(unsafe.Pointer((pNew + 20 /* &.addrOpenEphm */) + 1*4)) = -1 + (*Select)(unsafe.Pointer(pNew)).FnSelectRow = int16(0) + if pSrc == uintptr(0) { + pSrc = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(SrcList{}))) + } + (*Select)(unsafe.Pointer(pNew)).FpSrc = pSrc + (*Select)(unsafe.Pointer(pNew)).FpWhere = pWhere + (*Select)(unsafe.Pointer(pNew)).FpGroupBy = pGroupBy + (*Select)(unsafe.Pointer(pNew)).FpHaving = pHaving + (*Select)(unsafe.Pointer(pNew)).FpOrderBy = pOrderBy + (*Select)(unsafe.Pointer(pNew)).FpPrior = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpNext = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpLimit = pLimit + (*Select)(unsafe.Pointer(pNew)).FpWith = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpWin = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpWinDefn = uintptr(0) + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + clearSelect(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pNew, (libc.Bool32(pNew != bp /* &standin */))) + pAllocated = uintptr(0) + } else { + + } + return pAllocated +} + +// Delete the given Select structure and all of its substructures. +func Xsqlite3SelectDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:132250:21: */ + if p != 0 { + clearSelect(tls, db, p, 1) + } +} + +// Return a pointer to the right-most SELECT statement in a compound. +func findRightmost(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:132257:15: */ + for (*Select)(unsafe.Pointer(p)).FpNext != 0 { + p = (*Select)(unsafe.Pointer(p)).FpNext + } + return p +} + +// Given 1 to 3 identifiers preceding the JOIN keyword, determine the +// type of join. Return an integer constant that expresses that type +// in terms of the following bit values: +// +// JT_INNER +// JT_CROSS +// JT_OUTER +// JT_NATURAL +// JT_LEFT +// JT_RIGHT +// +// A full outer join is the combination of JT_LEFT and JT_RIGHT. +// +// If an illegal or unsupported join type is seen, then still return +// a join type, but put an error in the pParse structure. +func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC uintptr) int32 { /* sqlite3.c:132279:20: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var jointype int32 = 0 + // var apAll [3]uintptr at bp+32, 24 + + var p uintptr + var i int32 + var j int32 + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */)) = pA + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + 1*8)) = pB + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + 2*8)) = pC + for i = 0; (i < 3) && (*(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + uintptr(i)*8)) != 0); i++ { + p = *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + uintptr(i)*8)) + for j = 0; j < (int32(uint64(unsafe.Sizeof(aKeyword)) / uint64(unsafe.Sizeof(struct { + Fi U8 + FnChar U8 + Fcode U8 + }{})))); j++ { + if ((*Token)(unsafe.Pointer(p)).Fn == uint32(aKeyword[j].FnChar)) && + (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(p)).Fz, (uintptr(unsafe.Pointer(&zKeyText))+uintptr(aKeyword[j].Fi)), int32((*Token)(unsafe.Pointer(p)).Fn)) == 0) { + jointype = jointype | (int32(aKeyword[j].Fcode)) + break + } + } + + if j >= (int32(uint64(unsafe.Sizeof(aKeyword)) / uint64(unsafe.Sizeof(struct { + Fi U8 + FnChar U8 + Fcode U8 + }{})))) { + jointype = jointype | (JT_ERROR) + break + } + } + if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { + var zSp uintptr = ts + 9653 /* " " */ + + if pC == uintptr(0) { + zSp++ + } + Xsqlite3ErrorMsg(tls, pParse, + ts+16798 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + jointype = JT_INNER + } else if ((jointype & JT_OUTER) != 0) && + ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { + Xsqlite3ErrorMsg(tls, pParse, + ts+16842 /* "RIGHT and FULL O..." */, 0) + jointype = JT_INNER + } + return jointype +} + +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16897 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var aKeyword = [7]struct { + Fi U8 + FnChar U8 + Fcode U8 +}{ + /* natural */ {FnChar: U8(7), Fcode: U8(JT_NATURAL)}, + /* left */ {Fi: U8(6), FnChar: U8(4), Fcode: (U8(JT_LEFT | JT_OUTER))}, + /* outer */ {Fi: U8(10), FnChar: U8(5), Fcode: U8(JT_OUTER)}, + /* right */ {Fi: U8(14), FnChar: U8(5), Fcode: (U8(JT_RIGHT | JT_OUTER))}, + /* full */ {Fi: U8(19), FnChar: U8(4), Fcode: (U8((JT_LEFT | JT_RIGHT) | JT_OUTER))}, + /* inner */ {Fi: U8(23), FnChar: U8(5), Fcode: U8(JT_INNER)}, + /* cross */ {Fi: U8(28), FnChar: U8(5), Fcode: (U8(JT_INNER | JT_CROSS))}, +} /* sqlite3.c:132289:5 */ + +// Return the index of a column in a table. Return -1 if the column +// is not contained in the table. +func Xsqlite3ColumnIndex(tls *libc.TLS, pTab uintptr, zCol uintptr) int32 { /* sqlite3.c:132340:20: */ + var i int32 + var h U8 = Xsqlite3StrIHash(tls, zCol) + var pCol uintptr + pCol = (*Table)(unsafe.Pointer(pTab)).FaCol + i = 0 +__1: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __3 + } + { + if (int32((*Column)(unsafe.Pointer(pCol)).FhName) == int32(h)) && (Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer(pCol)).FzName, zCol) == 0) { + return i + } + + } + goto __2 +__2: + pCol += 32 + i++ + goto __1 + goto __3 +__3: + ; + return -1 +} + +// Search the first N tables in pSrc, from left to right, looking for a +// table that has a column named zCol. +// +// When found, set *piTab and *piCol to the table index and column index +// of the matching column and return TRUE. +// +// If not found, return FALSE. +func tableAndColumnIndex(tls *libc.TLS, pSrc uintptr, N int32, zCol uintptr, piTab uintptr, piCol uintptr, bIgnoreHidden int32) int32 { /* sqlite3.c:132359:12: */ + var i int32 // For looping over tables in pSrc + var iCol int32 // Index of column matching zCol + + // Both or neither are NULL + for i = 0; i < N; i++ { + iCol = Xsqlite3ColumnIndex(tls, (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FpTab, zCol) + if (iCol >= 0) && + ((bIgnoreHidden == 0) || ((libc.Bool32((int32((*Column)(unsafe.Pointer(((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FpTab)).FaCol + uintptr(iCol)*32))).FcolFlags) & COLFLAG_HIDDEN) != 0)) == 0)) { + if piTab != 0 { + *(*int32)(unsafe.Pointer(piTab)) = i + *(*int32)(unsafe.Pointer(piCol)) = iCol + } + return 1 + } + } + return 0 +} + +// This function is used to add terms implied by JOIN syntax to the +// WHERE clause expression of a SELECT statement. The new term, which +// is ANDed with the existing WHERE clause, is of the form: +// +// (tab1.col1 = tab2.col2) +// +// where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the +// (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is +// column iColRight of tab2. +func addWhereTerm(tls *libc.TLS, pParse uintptr, pSrc uintptr, iLeft int32, iColLeft int32, iRight int32, iColRight int32, isOuterJoin int32, ppWhere uintptr) { /* sqlite3.c:132397:13: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pE1 uintptr + var pE2 uintptr + var pEq uintptr + + pE1 = Xsqlite3CreateColumnExpr(tls, db, pSrc, iLeft, iColLeft) + pE2 = Xsqlite3CreateColumnExpr(tls, db, pSrc, iRight, iColRight) + + pEq = Xsqlite3PExpr(tls, pParse, TK_EQ, pE1, pE2) + if (pEq != 0) && (isOuterJoin != 0) { + *(*U32)(unsafe.Pointer(pEq + 4 /* &.flags */)) |= (U32(EP_FromJoin)) + + (*Expr)(unsafe.Pointer(pEq)).FiRightJoinTable = (*Expr)(unsafe.Pointer(pE2)).FiTable + } + *(*uintptr)(unsafe.Pointer(ppWhere)) = Xsqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(ppWhere)), pEq) +} + +// Set the EP_FromJoin property on all terms of the given expression. +// And set the Expr.iRightJoinTable to iTable for every term in the +// expression. +// +// The EP_FromJoin property is used on terms of an expression to tell +// the LEFT OUTER JOIN processing logic that this term is part of the +// join restriction specified in the ON or USING clause and not a part +// of the more general WHERE clause. These terms are moved over to the +// WHERE clause during join processing but we need to remember that they +// originated in the ON or USING clause. +// +// The Expr.iRightJoinTable tells the WHERE clause processing that the +// expression depends on table iRightJoinTable even if that table is not +// explicitly mentioned in the expression. That information is needed +// for cases like this: +// +// SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5 +// +// The where clause needs to defer the handling of the t1.x=5 +// term until after the t2 loop of the join. In that way, a +// NULL t2 row will be inserted whenever t1.x!=5. If we do not +// defer the handling of t1.x=5, it will be processed immediately +// after the t1 loop and rows with t1.x!=5 will never appear in +// the output, which is incorrect. +func Xsqlite3SetJoinExpr(tls *libc.TLS, p uintptr, iTable int32) { /* sqlite3.c:132456:21: */ + for p != 0 { + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) |= (U32(EP_FromJoin)) + + (*Expr)(unsafe.Pointer(p)).FiRightJoinTable = iTable + if (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_FUNCTION) && (*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) != 0) { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)))).FnExpr; i++ { + Xsqlite3SetJoinExpr(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */))+8 /* &.a */)+uintptr(i)*32)).FpExpr, iTable) + } + } + Xsqlite3SetJoinExpr(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, iTable) + p = (*Expr)(unsafe.Pointer(p)).FpRight + } +} + +// Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every +// term that is marked with EP_FromJoin and iRightJoinTable==iTable into +// an ordinary term that omits the EP_FromJoin mark. +// +// This happens when a LEFT JOIN is simplified into an ordinary JOIN. +func unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32) { /* sqlite3.c:132479:13: */ + for p != 0 { + if (((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_FromJoin))) != U32(0)) && + ((iTable < 0) || ((*Expr)(unsafe.Pointer(p)).FiRightJoinTable == iTable)) { + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_FromJoin))) + } + if (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_COLUMN) && ((*Expr)(unsafe.Pointer(p)).FiTable == iTable) { + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_CanBeNull))) + } + if (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_FUNCTION) && (*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) != 0) { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)))).FnExpr; i++ { + unsetJoinExpr(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(p + 32 /* &.x */))+8 /* &.a */)+uintptr(i)*32)).FpExpr, iTable) + } + } + unsetJoinExpr(tls, (*Expr)(unsafe.Pointer(p)).FpLeft, iTable) + p = (*Expr)(unsafe.Pointer(p)).FpRight + } +} + +// This routine processes the join information for a SELECT statement. +// ON and USING clauses are converted into extra terms of the WHERE clause. +// NATURAL joins also create extra WHERE clause terms. +// +// The terms of a FROM clause are contained in the Select.pSrc structure. +// The left most table is the first entry in Select.pSrc. The right-most +// table is the last entry. The join operator is held in the entry to +// the left. Thus entry 0 contains the join operator for the join between +// entries 0 and 1. Any ON or USING clauses associated with the join are +// also attached to the left entry. +// +// This routine returns the number of errors encountered. +func sqliteProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* sqlite3.c:132513:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pSrc uintptr // All tables in the FROM clause + var i int32 + var j int32 // Loop counters + var pLeft uintptr // Left table being joined + var pRight uintptr // Right table being joined + + pSrc = (*Select)(unsafe.Pointer(p)).FpSrc + pLeft = (pSrc + 8 /* &.a */) + pRight = (pLeft + 1*112) + i = 0 +__1: + if !(i < ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc - 1)) { + goto __3 + } + { + var pRightTab uintptr = (*SrcItem)(unsafe.Pointer(pRight)).FpTab + var isOuter int32 + + if ((*SrcItem)(unsafe.Pointer(pLeft)).FpTab == uintptr(0)) || (pRightTab == uintptr(0)) { + goto __2 + } + isOuter = (libc.Bool32((int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_OUTER) != 0)) + + // When the NATURAL keyword is present, add WHERE clause terms for + // every column that the two tables have in common. + if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { + if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { + Xsqlite3ErrorMsg(tls, pParse, + ts+16931 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + return 1 + } + for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { + var zName uintptr // Name of column in the right table + // var iLeft int32 at bp+16, 4 + // Matching left table + // var iLeftCol int32 at bp+20, 4 + // Matching column in the left table + + if (int32((*Column)(unsafe.Pointer(((*Table)(unsafe.Pointer(pRightTab)).FaCol + uintptr(j)*32))).FcolFlags) & COLFLAG_HIDDEN) != 0 { + continue + } + zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pRightTab)).FaCol + uintptr(j)*32)).FzName + if tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+16 /* &iLeft */, bp+20 /* &iLeftCol */, 1) != 0 { + addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 16 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 20 /* iLeftCol */)), (i + 1), j, + isOuter, (p + 48 /* &.pWhere */)) + } + } + } + + // Disallow both ON and USING clauses in the same join + if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { + Xsqlite3ErrorMsg(tls, pParse, + ts+16981 /* "cannot have both..." */, 0) + return 1 + } + + // Add the ON clause to the end of the WHERE clause, connected by + // an AND operator. + if (*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0 { + if isOuter != 0 { + Xsqlite3SetJoinExpr(tls, (*SrcItem)(unsafe.Pointer(pRight)).FpOn, (*SrcItem)(unsafe.Pointer(pRight)).FiCursor) + } + (*Select)(unsafe.Pointer(p)).FpWhere = Xsqlite3ExprAnd(tls, pParse, (*Select)(unsafe.Pointer(p)).FpWhere, (*SrcItem)(unsafe.Pointer(pRight)).FpOn) + (*SrcItem)(unsafe.Pointer(pRight)).FpOn = uintptr(0) + } + + // Create extra terms on the WHERE clause for each column named + // in the USING clause. Example: If the two tables to be joined are + // A and B and the USING clause names X, Y, and Z, then add this + // to the WHERE clause: A.X=B.X AND A.Y=B.Y AND A.Z=B.Z + // Report an error if any column mentioned in the USING clause is + // not contained in both tables to be joined. + if (*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0 { + var pList uintptr = (*SrcItem)(unsafe.Pointer(pRight)).FpUsing + for j = 0; j < (*IdList)(unsafe.Pointer(pList)).FnId; j++ { + var zName uintptr // Name of the term in the USING clause + // var iLeft int32 at bp+24, 4 + // Table on the left with matching column name + // var iLeftCol int32 at bp+28, 4 + // Column number of matching column on the left + var iRightCol int32 // Column number of matching column on the right + + zName = (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa + uintptr(j)*16)).FzName + iRightCol = Xsqlite3ColumnIndex(tls, pRightTab, zName) + if (iRightCol < 0) || + !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { + Xsqlite3ErrorMsg(tls, pParse, + ts+17036 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + return 1 + } + addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, + isOuter, (p + 48 /* &.pWhere */)) + } + } + + } + goto __2 +__2: + i++ + pRight += 112 + pLeft += 112 + goto __1 + goto __3 +__3: + ; + return 0 +} + +// An instance of this object holds information (beyond pParse and pSelect) +// needed to load the next result row that is to be added to the sorter. +type RowLoadInfo = RowLoadInfo1 /* sqlite3.c:132605:28 */ + +// This routine does the work of loading query data into an array of +// registers so that it can be added to the sorter. +func innerLoopLoadRow(tls *libc.TLS, pParse uintptr, pSelect uintptr, pInfo uintptr) { /* sqlite3.c:132619:13: */ + Xsqlite3ExprCodeExprList(tls, pParse, (*Select)(unsafe.Pointer(pSelect)).FpEList, (*RowLoadInfo)(unsafe.Pointer(pInfo)).FregResult, + 0, (*RowLoadInfo)(unsafe.Pointer(pInfo)).FecelFlags) +} + +// Code the OP_MakeRecord instruction that generates the entry to be +// added into the sorter. +// +// Return the register in which the result is stored. +func makeSorterRecord(tls *libc.TLS, pParse uintptr, pSort uintptr, pSelect uintptr, regBase int32, nBase int32) int32 { /* sqlite3.c:132640:12: */ + var nOBSat int32 = (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var regOut int32 = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + if (*SortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad != 0 { + innerLoopLoadRow(tls, pParse, pSelect, (*SortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad) + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (regBase + nOBSat), (nBase - nOBSat), regOut) + return regOut +} + +// Generate code that will push the record in registers regData +// through regData+nData-1 onto the sorter. +func pushOntoSorter(tls *libc.TLS, pParse uintptr, pSort uintptr, pSelect uintptr, regData int32, regOrigData int32, nData int32, nPrefixReg int32) { /* sqlite3.c:132661:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // Stmt under construction + var bSeq int32 = (libc.Bool32((int32((*SortCtx)(unsafe.Pointer(pSort)).FsortFlags) & SORTFLAG_UseSorter) == 0)) + var nExpr int32 = (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy)).FnExpr // No. of ORDER BY terms + var nBase int32 = ((nExpr + bSeq) + nData) // Fields in sorter record + var regBase int32 // Regs for sorter record + var regRecord int32 = 0 // Assembled sorter record + var nOBSat int32 = (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat // ORDER BY terms to skip + var op int32 // Opcode to add sorter record to sorter + var iLimit int32 // LIMIT counter + var iSkip int32 = 0 // End of the sorter insert loop + + // Three cases: + // (1) The data to be sorted has already been packed into a Record + // by a prior OP_MakeRecord. In this case nData==1 and regData + // will be completely unrelated to regOrigData. + // (2) All output columns are included in the sort record. In that + // case regData==regOrigData. + // (3) Some output columns are omitted from the sort record due to + // the SQLITE_ENABLE_SORTER_REFERENCE optimization, or due to the + // SQLITE_ECEL_OMITREF optimization, or due to the + // SortCtx.pDeferredRowLoad optimiation. In any of these cases + // regOrigData is 0 to prevent this routine from trying to copy + // values that might not yet exist. + + if nPrefixReg != 0 { + + regBase = (regData - nPrefixReg) + } else { + regBase = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nBase) + } + + if (*Select)(unsafe.Pointer(pSelect)).FiOffset != 0 { + iLimit = ((*Select)(unsafe.Pointer(pSelect)).FiOffset + 1) + } else { + iLimit = (*Select)(unsafe.Pointer(pSelect)).FiLimit + } + (*SortCtx)(unsafe.Pointer(pSort)).FlabelDone = Xsqlite3VdbeMakeLabel(tls, pParse) + Xsqlite3ExprCodeExprList(tls, pParse, (*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy, regBase, regOrigData, + (uint8(SQLITE_ECEL_DUP | (func() int32 { + if regOrigData != 0 { + return SQLITE_ECEL_REF + } + return 0 + }())))) + if bSeq != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Sequence, (*SortCtx)(unsafe.Pointer(pSort)).FiECursor, (regBase + nExpr)) + } + if (nPrefixReg == 0) && (nData > 0) { + Xsqlite3ExprCodeMove(tls, pParse, regData, ((regBase + nExpr) + bSeq), nData) + } + if nOBSat > 0 { + var regPrevKey int32 // The first nOBSat columns of the previous row + var addrFirst int32 // Address of the OP_IfNot opcode + var addrJmp int32 // Address of the OP_Jump opcode + var pOp uintptr // Opcode that opens the sorter + var nKey int32 // Number of sorting key columns, including OP_Sequence + var pKI uintptr // Original KeyInfo on the sorter table + + regRecord = makeSorterRecord(tls, pParse, pSort, pSelect, regBase, nBase) + regPrevKey = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += ((*SortCtx)(unsafe.Pointer(pSort)).FnOBSat) + nKey = ((nExpr - (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat) + bSeq) + if bSeq != 0 { + addrFirst = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, (regBase + nExpr)) + } else { + addrFirst = Xsqlite3VdbeAddOp1(tls, v, OP_SequenceTest, (*SortCtx)(unsafe.Pointer(pSort)).FiECursor) + } + + Xsqlite3VdbeAddOp3(tls, v, OP_Compare, regPrevKey, regBase, (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat) + pOp = Xsqlite3VdbeGetOp(tls, v, (*SortCtx)(unsafe.Pointer(pSort)).FaddrSortIndex) + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return + } + (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 = (nKey + nData) + pKI = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) + libc.Xmemset(tls, (*KeyInfo)(unsafe.Pointer(pKI)).FaSortFlags, 0, uint64((*KeyInfo)(unsafe.Pointer(pKI)).FnKeyField)) // Makes OP_Jump testable + Xsqlite3VdbeChangeP4(tls, v, -1, pKI, -9) + + *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) = Xsqlite3KeyInfoFromExprList(tls, pParse, (*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy, nOBSat, + ((int32((*KeyInfo)(unsafe.Pointer(pKI)).FnAllField) - int32((*KeyInfo)(unsafe.Pointer(pKI)).FnKeyField)) - 1)) + pOp = uintptr(0) // Ensure pOp not used after sqltie3VdbeAddOp3() + addrJmp = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, (addrJmp + 1), 0, (addrJmp + 1)) + (*SortCtx)(unsafe.Pointer(pSort)).FlabelBkOut = Xsqlite3VdbeMakeLabel(tls, pParse) + (*SortCtx)(unsafe.Pointer(pSort)).FregReturn = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, (*SortCtx)(unsafe.Pointer(pSort)).FregReturn, (*SortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) + Xsqlite3VdbeAddOp1(tls, v, OP_ResetSorter, (*SortCtx)(unsafe.Pointer(pSort)).FiECursor) + if iLimit != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_IfNot, iLimit, (*SortCtx)(unsafe.Pointer(pSort)).FlabelDone) + + } + Xsqlite3VdbeJumpHere(tls, v, addrFirst) + Xsqlite3ExprCodeMove(tls, pParse, regBase, regPrevKey, (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat) + Xsqlite3VdbeJumpHere(tls, v, addrJmp) + } + if iLimit != 0 { + // At this point the values for the new sorter entry are stored + // in an array of registers. They need to be composed into a record + // and inserted into the sorter if either (a) there are currently + // less than LIMIT+OFFSET items or (b) the new record is smaller than + // the largest record currently in the sorter. If (b) is true and there + // are already LIMIT+OFFSET items in the sorter, delete the largest + // entry before inserting the new one. This way there are never more + // than LIMIT+OFFSET items in the sorter. + // + // If the new record does not need to be inserted into the sorter, + // jump to the next iteration of the loop. If the pSort->labelOBLopt + // value is not zero, then it is a label of where to jump. Otherwise, + // just bypass the row insert logic. See the header comment on the + // sqlite3WhereOrderByLimitOptLabel() function for additional info. + var iCsr int32 = (*SortCtx)(unsafe.Pointer(pSort)).FiECursor + Xsqlite3VdbeAddOp2(tls, v, OP_IfNotZero, iLimit, (Xsqlite3VdbeCurrentAddr(tls, v) + 4)) + + Xsqlite3VdbeAddOp2(tls, v, OP_Last, iCsr, 0) + iSkip = Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxLE, + iCsr, 0, (regBase + nOBSat), (nExpr - nOBSat)) + + Xsqlite3VdbeAddOp1(tls, v, OP_Delete, iCsr) + } + if regRecord == 0 { + regRecord = makeSorterRecord(tls, pParse, pSort, pSelect, regBase, nBase) + } + if (int32((*SortCtx)(unsafe.Pointer(pSort)).FsortFlags) & SORTFLAG_UseSorter) != 0 { + op = OP_SorterInsert + } else { + op = OP_IdxInsert + } + Xsqlite3VdbeAddOp4Int(tls, v, op, (*SortCtx)(unsafe.Pointer(pSort)).FiECursor, regRecord, + (regBase + nOBSat), (nBase - nOBSat)) + if iSkip != 0 { + Xsqlite3VdbeChangeP2(tls, v, iSkip, + func() int32 { + if (*SortCtx)(unsafe.Pointer(pSort)).FlabelOBLopt != 0 { + return (*SortCtx)(unsafe.Pointer(pSort)).FlabelOBLopt + } + return Xsqlite3VdbeCurrentAddr(tls, v) + }()) + } +} + +// Add code to implement the OFFSET +func codeOffset(tls *libc.TLS, v uintptr, iOffset int32, iContinue int32) { /* sqlite3.c:132803:13: */ + if iOffset > 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_IfPos, iOffset, iContinue, 1) + + } +} + +// Add code that will check to make sure the array of registers starting at +// iMem form a distinct entry. This is used by both "SELECT DISTINCT ..." and +// distinct aggregates ("SELECT count(DISTINCT ) ..."). Three strategies +// are available. Which is used depends on the value of parameter eTnctType, +// as follows: +// +// WHERE_DISTINCT_UNORDERED/WHERE_DISTINCT_NOOP: +// Build an ephemeral table that contains all entries seen before and +// skip entries which have been seen before. +// +// Parameter iTab is the cursor number of an ephemeral table that must +// be opened before the VM code generated by this routine is executed. +// The ephemeral cursor table is queried for a record identical to the +// record formed by the current array of registers. If one is found, +// jump to VM address addrRepeat. Otherwise, insert a new record into +// the ephemeral cursor and proceed. +// +// The returned value in this case is a copy of parameter iTab. +// +// WHERE_DISTINCT_ORDERED: +// In this case rows are being delivered sorted order. The ephermal +// table is not required. Instead, the current set of values +// is compared against previous row. If they match, the new row +// is not distinct and control jumps to VM address addrRepeat. Otherwise, +// the VM program proceeds with processing the new row. +// +// The returned value in this case is the register number of the first +// in an array of registers used to store the previous result row so that +// it can be compared to the next. The caller must ensure that this +// register is initialized to NULL. (The fixDistinctOpenEph() routine +// will take care of this initialization.) +// +// WHERE_DISTINCT_UNIQUE: +// In this case it has already been determined that the rows are distinct. +// No special action is required. The return value is zero. +// +// Parameter pEList is the list of expressions used to generated the +// contents of each row. It is used by this routine to determine (a) +// how many elements there are in the array of registers and (b) the +// collation sequences that should be used for the comparisons if +// eTnctType is WHERE_DISTINCT_ORDERED. +func codeDistinct(tls *libc.TLS, pParse uintptr, eTnctType int32, iTab int32, addrRepeat int32, pEList uintptr, regElem int32) int32 { /* sqlite3.c:132857:12: */ + var iRet int32 = 0 + var nResultCol int32 = (*ExprList)(unsafe.Pointer(pEList)).FnExpr + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + switch eTnctType { + case WHERE_DISTINCT_ORDERED: + { + var i int32 + var iJump int32 // Jump destination + var regPrev int32 // Previous row content + + // Allocate space for the previous row + iRet = libc.AssignInt32(®Prev, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1)) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nResultCol) + + iJump = (Xsqlite3VdbeCurrentAddr(tls, v) + nResultCol) + for i = 0; i < nResultCol; i++ { + var pColl uintptr = Xsqlite3ExprCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + if i < (nResultCol - 1) { + Xsqlite3VdbeAddOp3(tls, v, OP_Ne, (regElem + i), iJump, (regPrev + i)) + + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_Eq, (regElem + i), addrRepeat, (regPrev + i)) + + } + Xsqlite3VdbeChangeP4(tls, v, -1, pColl, -2) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) + } + + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regElem, regPrev, (nResultCol - 1)) + break + + } + + case WHERE_DISTINCT_UNIQUE: + { + // nothing to do + break + + } + + default: + { + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iTab, addrRepeat, regElem, nResultCol) + + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regElem, nResultCol, r1) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iTab, r1, regElem, nResultCol) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + iRet = iTab + break + + } + } + + return iRet +} + +// This routine runs after codeDistinct(). It makes necessary +// adjustments to the OP_OpenEphemeral opcode that the codeDistinct() +// routine made use of. This processing must be done separately since +// sometimes codeDistinct is called before the OP_OpenEphemeral is actually +// laid down. +// +// WHERE_DISTINCT_NOOP: +// WHERE_DISTINCT_UNORDERED: +// +// No adjustments necessary. This function is a no-op. +// +// WHERE_DISTINCT_UNIQUE: +// +// The ephemeral table is not needed. So change the +// OP_OpenEphemeral opcode into an OP_Noop. +// +// WHERE_DISTINCT_ORDERED: +// +// The ephemeral table is not needed. But we do need register +// iVal to be initialized to NULL. So change the OP_OpenEphemeral +// into an OP_Null on the iVal register. +func fixDistinctOpenEph(tls *libc.TLS, pParse uintptr, eTnctType int32, iVal int32, iOpenEphAddr int32) { /* sqlite3.c:132941:13: */ + if (eTnctType == WHERE_DISTINCT_UNIQUE) || (eTnctType == WHERE_DISTINCT_ORDERED) { + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + Xsqlite3VdbeChangeToNoop(tls, v, iOpenEphAddr) + if int32((*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, (iOpenEphAddr+1)))).Fopcode) == OP_Explain { + Xsqlite3VdbeChangeToNoop(tls, v, (iOpenEphAddr + 1)) + } + if eTnctType == WHERE_DISTINCT_ORDERED { + // Change the OP_OpenEphemeral to an OP_Null that sets the MEM_Cleared + // bit on the first register of the previous value. This will cause the + // OP_Ne added in codeDistinct() to always fail on the first iteration of + // the loop even if the first row is all NULLs. + var pOp uintptr = Xsqlite3VdbeGetOp(tls, v, iOpenEphAddr) + (*VdbeOp)(unsafe.Pointer(pOp)).Fopcode = U8(OP_Null) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = 1 + (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 = iVal + } + } +} + +// This routine generates the code for the inside of the inner loop +// of a SELECT. +// +// If srcTab is negative, then the p->pEList expressions +// are evaluated in order to get the data for this row. If srcTab is +// zero or more, then data is pulled from srcTab and p->pEList is used only +// to get the number of columns and the collation sequence for each column. +func selectInnerLoop(tls *libc.TLS, pParse uintptr, p uintptr, srcTab int32, pSort uintptr, pDistinct uintptr, pDest uintptr, iContinue int32, iBreak int32) { /* sqlite3.c:133056:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + var hasDistinct int32 // True if the DISTINCT keyword is present + var eDest int32 = int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest) // How to dispose of results + var iParm int32 = (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm // First argument to disposal method + var nResultCol int32 // Number of result columns + var nPrefixReg int32 = 0 // Number of extra registers before regResult + // var sRowLoadInfo RowLoadInfo at bp, 8 + // Info for deferred row loading + + // Usually, regResult is the first cell in an array of memory cells + // containing the current result row. In this case regOrig is set to the + // same value. However, if the results are being sent to the sorter, the + // values for any expressions that are also part of the sort-key are omitted + // from this array. In this case regOrig is set to zero. + var regResult int32 // Start of memory holding current results + var regOrig int32 // Start of memory holding full result (or 0) + + if pDistinct != 0 { + hasDistinct = int32((*DistinctCtx)(unsafe.Pointer(pDistinct)).FeTnctType) + } else { + hasDistinct = WHERE_DISTINCT_NOOP + } + if (pSort != 0) && ((*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy == uintptr(0)) { + pSort = uintptr(0) + } + if (pSort == uintptr(0)) && !(hasDistinct != 0) { + + codeOffset(tls, v, (*Select)(unsafe.Pointer(p)).FiOffset, iContinue) + } + + // Pull the requested columns. + nResultCol = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr + + if (*SelectDest)(unsafe.Pointer(pDest)).FiSdst == 0 { + if pSort != 0 { + nPrefixReg = (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy)).FnExpr + if !((int32((*SortCtx)(unsafe.Pointer(pSort)).FsortFlags) & SORTFLAG_UseSorter) != 0) { + nPrefixReg++ + } + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nPrefixReg) + } + (*SelectDest)(unsafe.Pointer(pDest)).FiSdst = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nResultCol) + } else if ((*SelectDest)(unsafe.Pointer(pDest)).FiSdst + nResultCol) > (*Parse)(unsafe.Pointer(pParse)).FnMem { + // This is an error condition that can result, for example, when a SELECT + // on the right-hand side of an INSERT contains more result columns than + // there are columns in the table on the left. The error will be caught + // and reported later. But we need to make sure enough memory is allocated + // to avoid other spurious errors in the meantime. + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nResultCol) + } + (*SelectDest)(unsafe.Pointer(pDest)).FnSdst = nResultCol + regOrig = libc.AssignInt32(®Result, (*SelectDest)(unsafe.Pointer(pDest)).FiSdst) + if srcTab >= 0 { + for i = 0; i < nResultCol; i++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, srcTab, i, (regResult + i)) + + } + } else if eDest != SRT_Exists { + // If the destination is an EXISTS(...) expression, the actual + // values returned by the SELECT are not required. + var ecelFlags U8 // "ecel" is an abbreviation of "ExprCodeExprList" + var pEList uintptr + if ((eDest == SRT_Mem) || (eDest == SRT_Output)) || (eDest == SRT_Coroutine) { + ecelFlags = U8(SQLITE_ECEL_DUP) + } else { + ecelFlags = U8(0) + } + if (((pSort != 0) && (hasDistinct == 0)) && (eDest != SRT_EphemTab)) && (eDest != SRT_Table) { + // For each expression in p->pEList that is a copy of an expression in + // the ORDER BY clause (pSort->pOrderBy), set the associated + // iOrderByCol value to one more than the index of the ORDER BY + // expression within the sort-key that pushOntoSorter() will generate. + // This allows the p->pEList field to be omitted from the sorted record, + // saving space and CPU cycles. + ecelFlags = U8(int32(ecelFlags) | (SQLITE_ECEL_OMITREF | SQLITE_ECEL_REF)) + + for i = (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat; i < (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy)).FnExpr; i++ { + var j int32 + if (libc.AssignInt32(&j, int32(*(*U16)(unsafe.Pointer(((*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy + 8 /* &.a */) + uintptr(i)*32 + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */))))) > 0 { + *(*U16)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpEList + 8 /* &.a */) + uintptr((j-1))*32 + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = (U16((i + 1) - (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat)) + } + } + + // Adjust nResultCol to account for columns that are omitted + // from the sorter by the optimizations in this branch + pEList = (*Select)(unsafe.Pointer(p)).FpEList + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + if int32(*(*U16)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(i)*32 + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) > 0 { + nResultCol-- + regOrig = 0 + } + } + + } + (*RowLoadInfo)(unsafe.Pointer(bp /* &sRowLoadInfo */)).FregResult = regResult + (*RowLoadInfo)(unsafe.Pointer(bp /* &sRowLoadInfo */)).FecelFlags = ecelFlags + if (((*Select)(unsafe.Pointer(p)).FiLimit != 0) && + ((int32(ecelFlags) & SQLITE_ECEL_OMITREF) != 0)) && + (nPrefixReg > 0) { + + (*SortCtx)(unsafe.Pointer(pSort)).FpDeferredRowLoad = bp /* &sRowLoadInfo */ + regOrig = 0 + } else { + innerLoopLoadRow(tls, pParse, p, bp /* &sRowLoadInfo */) + } + } + + // If the DISTINCT keyword was present on the SELECT statement + // and this row has been seen before, then do not make this row + // part of the result. + if hasDistinct != 0 { + var eType int32 = int32((*DistinctCtx)(unsafe.Pointer(pDistinct)).FeTnctType) + var iTab int32 = (*DistinctCtx)(unsafe.Pointer(pDistinct)).FtabTnct + + iTab = codeDistinct(tls, pParse, eType, iTab, iContinue, (*Select)(unsafe.Pointer(p)).FpEList, regResult) + fixDistinctOpenEph(tls, pParse, eType, iTab, (*DistinctCtx)(unsafe.Pointer(pDistinct)).FaddrTnct) + if pSort == uintptr(0) { + codeOffset(tls, v, (*Select)(unsafe.Pointer(p)).FiOffset, iContinue) + } + } + + switch eDest { + // In this mode, write each query result to the key of the temporary + // table iParm. + case SRT_Union: + { + var r1 int32 + r1 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regResult, nResultCol, r1) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iParm, r1, regResult, nResultCol) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + break + + } + + // Construct a record from the query result, but instead of + // saving that record, use it as a key to delete elements from + // the temporary table iParm. + case SRT_Except: + { + Xsqlite3VdbeAddOp3(tls, v, OP_IdxDelete, iParm, regResult, nResultCol) + break + + } + + // Store the result as data using a unique key. + case SRT_Fifo: + fallthrough + case SRT_DistFifo: + fallthrough + case SRT_Table: + fallthrough + case SRT_EphemTab: + { + var r1 int32 = Xsqlite3GetTempRange(tls, pParse, (nPrefixReg + 1)) + + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regResult, nResultCol, (r1 + nPrefixReg)) + if eDest == SRT_DistFifo { + // If the destination is DistFifo, then cursor (iParm+1) is open + // on an ephemeral index. If the current row is already present + // in the index, do not write it to the output. If not, add the + // current row to the index and proceed with writing it to the + // output table as well. + var addr int32 = (Xsqlite3VdbeCurrentAddr(tls, v) + 4) + Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (iParm + 1), addr, r1, 0) + + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, (iParm + 1), r1, regResult, nResultCol) + + } + if pSort != 0 { + + pushOntoSorter(tls, pParse, pSort, p, (r1 + nPrefixReg), regOrig, 1, nPrefixReg) + } else { + var r2 int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iParm, r2) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iParm, r1, r2) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + Xsqlite3ReleaseTempReg(tls, pParse, r2) + } + Xsqlite3ReleaseTempRange(tls, pParse, r1, (nPrefixReg + 1)) + break + + } + + case SRT_Upfrom: + { + if pSort != 0 { + pushOntoSorter(tls, + pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + var i2 int32 = (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm2 + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + + // If the UPDATE FROM join is an aggregate that matches no rows, it + // might still be trying to return one row, because that is what + // aggregates do. Don't record that empty row in the output table. + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, regResult, iBreak) + + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, + (regResult + (libc.Bool32(i2 < 0))), (nResultCol - (libc.Bool32(i2 < 0))), r1) + if i2 < 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iParm, r1, regResult) + } else { + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iParm, r1, regResult, i2) + } + } + break + + } + + // If we are creating a set for an "expr IN (SELECT ...)" construct, + // then there should be a single item on the stack. Write this + // item into the set table with bogus data. + case SRT_Set: + { + if pSort != 0 { + // At first glance you would think we could optimize out the + // ORDER BY in this case since the order of entries in the set + // does not matter. But there might be a LIMIT clause, in which + // case the order does matter + pushOntoSorter(tls, + pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regResult, nResultCol, + r1, (*SelectDest)(unsafe.Pointer(pDest)).FzAffSdst, nResultCol) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iParm, r1, regResult, nResultCol) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + } + break + + } + + // If any row exist in the result set, record that fact and abort. + case SRT_Exists: + { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, iParm) + // The LIMIT clause will terminate the loop for us + break + + } + + // If this is a scalar select that is part of an expression, then + // store the results in the appropriate memory cell or array of + // memory cells and break out of the scan loop. + case SRT_Mem: + { + if pSort != 0 { + + pushOntoSorter(tls, + pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg) + } else { + + // The LIMIT clause will jump out of the loop for us + } + break + + } + + case SRT_Coroutine: + fallthrough // Send data to a co-routine + case SRT_Output: + { // Return the results + + if pSort != 0 { + pushOntoSorter(tls, pParse, pSort, p, regResult, regOrig, nResultCol, + nPrefixReg) + } else if eDest == SRT_Coroutine { + Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, nResultCol) + } + break + + } + + // Write the results into a priority queue that is order according to + // pDest->pOrderBy (in pSO). pDest->iSDParm (in iParm) is the cursor for an + // index with pSO->nExpr+2 columns. Build a key using pSO for the first + // pSO->nExpr columns, then make sure all keys are unique by adding a + // final OP_Sequence column. The last column is the record as a blob. + case SRT_DistQueue: + fallthrough + case SRT_Queue: + { + var nKey int32 + var r1 int32 + var r2 int32 + var r3 int32 + var addrTest int32 = 0 + var pSO uintptr + pSO = (*SelectDest)(unsafe.Pointer(pDest)).FpOrderBy + + nKey = (*ExprList)(unsafe.Pointer(pSO)).FnExpr + r1 = Xsqlite3GetTempReg(tls, pParse) + r2 = Xsqlite3GetTempRange(tls, pParse, (nKey + 2)) + r3 = ((r2 + nKey) + 1) + if eDest == SRT_DistQueue { + // If the destination is DistQueue, then cursor (iParm+1) is open + // on a second ephemeral index that holds all values every previously + // added to the queue. + addrTest = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (iParm + 1), 0, + regResult, nResultCol) + + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regResult, nResultCol, r3) + if eDest == SRT_DistQueue { + Xsqlite3VdbeAddOp2(tls, v, OP_IdxInsert, (iParm + 1), r3) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + } + for i = 0; i < nKey; i++ { + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, + ((regResult + int32(*(*U16)(unsafe.Pointer(((pSO + 8 /* &.a */) + uintptr(i)*32 + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */)))) - 1), + (r2 + i)) + } + Xsqlite3VdbeAddOp2(tls, v, OP_Sequence, iParm, (r2 + nKey)) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, r2, (nKey + 2), r1) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iParm, r1, r2, (nKey + 2)) + if addrTest != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrTest) + } + Xsqlite3ReleaseTempReg(tls, pParse, r1) + Xsqlite3ReleaseTempRange(tls, pParse, r2, (nKey + 2)) + break + + } + + // Discard the results. This is used for SELECT statements inside + // the body of a TRIGGER. The purpose of such selects is to call + // user-defined functions that have side effects. We do not care + // about the actual results of the select. + default: + { + + break + + } + } + + // Jump to the end of the loop if the LIMIT is reached. Except, if + // there is a sorter, in which case the sorter has already limited + // the output for us. + if (pSort == uintptr(0)) && ((*Select)(unsafe.Pointer(p)).FiLimit != 0) { + Xsqlite3VdbeAddOp2(tls, v, OP_DecrJumpZero, (*Select)(unsafe.Pointer(p)).FiLimit, iBreak) + } +} + +// Allocate a KeyInfo object sufficient for an index of N key columns and +// X extra columns. +func Xsqlite3KeyInfoAlloc(tls *libc.TLS, db uintptr, N int32, X int32) uintptr { /* sqlite3.c:133450:24: */ + var nExtra int32 = (int32(((uint64(N + X)) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64(1))) - uint64(unsafe.Sizeof(uintptr(0))))) + var p uintptr = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(KeyInfo{})) + uint64(nExtra)))) + if p != 0 { + (*KeyInfo)(unsafe.Pointer(p)).FaSortFlags = ((p + 32 /* &.aColl */) + uintptr((N+X))*8) + (*KeyInfo)(unsafe.Pointer(p)).FnKeyField = U16(N) + (*KeyInfo)(unsafe.Pointer(p)).FnAllField = (U16(N + X)) + (*KeyInfo)(unsafe.Pointer(p)).Fenc = (*Sqlite3)(unsafe.Pointer(db)).Fenc + (*KeyInfo)(unsafe.Pointer(p)).Fdb = db + (*KeyInfo)(unsafe.Pointer(p)).FnRef = U32(1) + libc.Xmemset(tls, (p + 1*40), 0, uint64(nExtra)) + } else { + Xsqlite3OomFault(tls, db) + } + return p +} + +// Deallocate a KeyInfo object +func Xsqlite3KeyInfoUnref(tls *libc.TLS, p uintptr) { /* sqlite3.c:133470:21: */ + if p != 0 { + + (*KeyInfo)(unsafe.Pointer(p)).FnRef-- + if (*KeyInfo)(unsafe.Pointer(p)).FnRef == U32(0) { + Xsqlite3DbFreeNN(tls, (*KeyInfo)(unsafe.Pointer(p)).Fdb, p) + } + } +} + +// Make a new pointer to a KeyInfo object +func Xsqlite3KeyInfoRef(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:133481:24: */ + if p != 0 { + + (*KeyInfo)(unsafe.Pointer(p)).FnRef++ + } + return p +} + +// Given an expression list, generate a KeyInfo structure that records +// the collating sequence for each expression in that expression list. +// +// If the ExprList is an ORDER BY or GROUP BY clause then the resulting +// KeyInfo structure is appropriate for initializing a virtual index to +// implement that clause. If the ExprList is the result set of a SELECT +// then the KeyInfo structure is appropriate for initializing a virtual +// index to implement a DISTINCT test. +// +// Space to hold the KeyInfo structure is obtained from malloc. The calling +// function is responsible for seeing that this structure is eventually +// freed. +func Xsqlite3KeyInfoFromExprList(tls *libc.TLS, pParse uintptr, pList uintptr, iStart int32, nExtra int32) uintptr { /* sqlite3.c:133513:24: */ + var nExpr int32 + var pInfo uintptr + var pItem uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var i int32 + + nExpr = (*ExprList)(unsafe.Pointer(pList)).FnExpr + pInfo = Xsqlite3KeyInfoAlloc(tls, db, (nExpr - iStart), (nExtra + 1)) + if pInfo != 0 { + + i = iStart + pItem = ((pList + 8 /* &.a */) + uintptr(iStart)*32) + __1: + if !(i < nExpr) { + goto __3 + } + { + *(*uintptr)(unsafe.Pointer((pInfo + 32 /* &.aColl */) + uintptr((i-iStart))*8)) = Xsqlite3ExprNNCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr) + *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pInfo)).FaSortFlags + uintptr((i - iStart)))) = (*ExprList_item)(unsafe.Pointer(pItem)).FsortFlags + + } + goto __2 + __2: + i++ + pItem += 32 + goto __1 + goto __3 + __3: + } + return pInfo +} + +// Name of the connection operator, used for error messages. +func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540:27: */ + var z uintptr + switch id { + case TK_ALL: + z = ts + 17100 /* "UNION ALL" */ + break + case TK_INTERSECT: + z = ts + 17110 /* "INTERSECT" */ + break + case TK_EXCEPT: + z = ts + 17120 /* "EXCEPT" */ + break + default: + z = ts + 17127 /* "UNION" */ + break + } + return z +} + +// Unless an "EXPLAIN QUERY PLAN" command is being processed, this function +// is a no-op. Otherwise, it adds a single row of output to the EQP result, +// where the caption is of the form: +// +// "USE TEMP B-TREE FOR xxx" +// +// where xxx is one of "DISTINCT", "ORDER BY" or "GROUP BY". Exactly which +// is determined by the zUsage argument. +func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite3.c:133562:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17133 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) +} + +// Assign expression b to lvalue a. A second, no-op, version of this macro +// is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code +// in sqlite3Select() to assign values to structure member variables that +// only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the +// code with #ifndef directives. + +// If the inner loop was generated using a non-null pOrderBy argument, +// then the results were placed in a sorter. After the loop is terminated +// we need to run the sorter and output the results. The following +// routine generates the code needed to do that. +func generateSortTail(tls *libc.TLS, pParse uintptr, p uintptr, pSort uintptr, nColumn int32, pDest uintptr) { /* sqlite3.c:133588:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // The prepared statement + var addrBreak int32 = (*SortCtx)(unsafe.Pointer(pSort)).FlabelDone // Jump here to exit loop + var addrContinue int32 = Xsqlite3VdbeMakeLabel(tls, pParse) // Jump here for next cycle + var addr int32 // Top of output loop. Jump for Next. + var addrOnce int32 = 0 + var iTab int32 + var pOrderBy uintptr = (*SortCtx)(unsafe.Pointer(pSort)).FpOrderBy + var eDest int32 = int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest) + var iParm int32 = (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm + var regRow int32 + var regRowid int32 + var iCol int32 + var nKey int32 // Number of key columns in sorter record + var iSortTab int32 // Sorter cursor to read from + var i int32 + var bSeq int32 // True if sorter record includes seq. no. + var nRefKey int32 = 0 + var aOutEx uintptr = (*Select)(unsafe.Pointer(p)).FpEList + 8 /* &.a */ + + if (*SortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, (*SortCtx)(unsafe.Pointer(pSort)).FregReturn, (*SortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) + Xsqlite3VdbeGoto(tls, v, addrBreak) + Xsqlite3VdbeResolveLabel(tls, v, (*SortCtx)(unsafe.Pointer(pSort)).FlabelBkOut) + } + + iTab = (*SortCtx)(unsafe.Pointer(pSort)).FiECursor + if ((eDest == SRT_Output) || (eDest == SRT_Coroutine)) || (eDest == SRT_Mem) { + regRowid = 0 + regRow = (*SelectDest)(unsafe.Pointer(pDest)).FiSdst + } else { + regRowid = Xsqlite3GetTempReg(tls, pParse) + if (eDest == SRT_EphemTab) || (eDest == SRT_Table) { + regRow = Xsqlite3GetTempReg(tls, pParse) + nColumn = 0 + } else { + regRow = Xsqlite3GetTempRange(tls, pParse, nColumn) + } + } + nKey = ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr - (*SortCtx)(unsafe.Pointer(pSort)).FnOBSat) + if (int32((*SortCtx)(unsafe.Pointer(pSort)).FsortFlags) & SORTFLAG_UseSorter) != 0 { + var regSortOut int32 = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + iSortTab = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + if (*SortCtx)(unsafe.Pointer(pSort)).FlabelBkOut != 0 { + addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + } + Xsqlite3VdbeAddOp3(tls, v, OP_OpenPseudo, iSortTab, regSortOut, + (((nKey + 1) + nColumn) + nRefKey)) + if addrOnce != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrOnce) + } + addr = (1 + Xsqlite3VdbeAddOp2(tls, v, OP_SorterSort, iTab, addrBreak)) + + codeOffset(tls, v, (*Select)(unsafe.Pointer(p)).FiOffset, addrContinue) + Xsqlite3VdbeAddOp3(tls, v, OP_SorterData, iTab, regSortOut, iSortTab) + bSeq = 0 + } else { + addr = (1 + Xsqlite3VdbeAddOp2(tls, v, OP_Sort, iTab, addrBreak)) + codeOffset(tls, v, (*Select)(unsafe.Pointer(p)).FiOffset, addrContinue) + iSortTab = iTab + bSeq = 1 + } + i = 0 + iCol = ((nKey + bSeq) - 1) + for ; i < nColumn; i++ { + if int32(*(*U16)(unsafe.Pointer((aOutEx + uintptr(i)*32 + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) == 0 { + iCol++ + } + } + for i = (nColumn - 1); i >= 0; i-- { + { + var iRead int32 + if *(*U16)(unsafe.Pointer(aOutEx + uintptr(i)*32 + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) != 0 { + iRead = (int32(*(*U16)(unsafe.Pointer((aOutEx + uintptr(i)*32 + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) - 1) + } else { + iRead = libc.PostDecInt32(&iCol, 1) + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iSortTab, iRead, (regRow + i)) + + } + } + switch eDest { + case SRT_Table: + fallthrough + case SRT_EphemTab: + { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iSortTab, (nKey + bSeq), regRow) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iParm, regRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iParm, regRow, regRowid) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + break + + } + case SRT_Set: + { + + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regRow, nColumn, regRowid, + (*SelectDest)(unsafe.Pointer(pDest)).FzAffSdst, nColumn) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iParm, regRowid, regRow, nColumn) + break + + } + case SRT_Mem: + { + // The LIMIT clause will terminate the loop for us + break + + } + case SRT_Upfrom: + { + var i2 int32 = (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm2 + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (regRow + (libc.Bool32(i2 < 0))), (nColumn - (libc.Bool32(i2 < 0))), r1) + if i2 < 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iParm, r1, regRow) + } else { + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iParm, r1, regRow, i2) + } + break + + } + default: + { + + if eDest == SRT_Output { + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, (*SelectDest)(unsafe.Pointer(pDest)).FiSdst, nColumn) + } else { + Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm) + } + break + + } + } + if regRowid != 0 { + if eDest == SRT_Set { + Xsqlite3ReleaseTempRange(tls, pParse, regRow, nColumn) + } else { + Xsqlite3ReleaseTempReg(tls, pParse, regRow) + } + Xsqlite3ReleaseTempReg(tls, pParse, regRowid) + } + // The bottom of the loop + Xsqlite3VdbeResolveLabel(tls, v, addrContinue) + if (int32((*SortCtx)(unsafe.Pointer(pSort)).FsortFlags) & SORTFLAG_UseSorter) != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_SorterNext, iTab, addr) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iTab, addr) + } + if (*SortCtx)(unsafe.Pointer(pSort)).FregReturn != 0 { + Xsqlite3VdbeAddOp1(tls, v, OP_Return, (*SortCtx)(unsafe.Pointer(pSort)).FregReturn) + } + Xsqlite3VdbeResolveLabel(tls, v, addrBreak) +} + +// Return a pointer to a string containing the 'declaration type' of the +// expression pExpr. The string may be treated as static by the caller. +// +// Also try to estimate the size of the returned value and return that +// result in *pEstWidth. +// +// The declaration type is the exact datatype definition extracted from the +// original CREATE TABLE statement if the expression is a column. The +// declaration type for a ROWID field is INTEGER. Exactly when an expression +// is considered a column can be complex in the presence of subqueries. The +// result-set expression in all of the following SELECT statements is +// considered a column by this function. +// +// SELECT col FROM tbl; +// SELECT (SELECT col FROM tbl; +// SELECT (SELECT col FROM tbl); +// SELECT abc FROM (SELECT col AS abc FROM tbl); +// +// The declaration type for any expression other than a column is NULL. +// +// This routine has either 3 or 6 parameters depending on whether or not +// the SQLITE_ENABLE_COLUMN_METADATA compile-time option is used. +func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, pzOrigTab uintptr, pzOrigCol uintptr) uintptr { /* sqlite3.c:133813:19: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var zType uintptr = uintptr(0) + var j int32 + *(*uintptr)(unsafe.Pointer(bp + 56 /* zOrigDb */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* zOrigTab */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = uintptr(0) + + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + case TK_COLUMN: + { + // The expression is a column. Locate the table the column is being + // extracted from in NameContext.pSrcList. This table may be real + // database table or a subquery. + var pTab uintptr = uintptr(0) // Table structure column is extracted from + var pS uintptr = uintptr(0) // Select the column is extracted from + var iCol int32 = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) // Index of column in pTab + for (pNC != 0) && !(pTab != 0) { + var pTabList uintptr = (*NameContext)(unsafe.Pointer(pNC)).FpSrcList + for j = 0; (j < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc) && ((*SrcItem)(unsafe.Pointer((pTabList+8 /* &.a */)+uintptr(j)*112)).FiCursor != (*Expr)(unsafe.Pointer(pExpr)).FiTable); j++ { + } + if j < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc { + pTab = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */) + uintptr(j)*112)).FpTab + pS = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */) + uintptr(j)*112)).FpSelect + } else { + pNC = (*NameContext)(unsafe.Pointer(pNC)).FpNext + } + } + + if pTab == uintptr(0) { + // At one time, code such as "SELECT new.x" within a trigger would + // cause this condition to run. Since then, we have restructured how + // trigger code is generated and so this condition is no longer + // possible. However, it can still be true for statements like + // the following: + // + // CREATE TABLE t1(col INTEGER); + // SELECT (SELECT t1.col) FROM FROM t1; + // + // when columnType() is called on the expression "t1.col" in the + // sub-select. In this case, set the column type to NULL, even + // though it should really be "INTEGER". + // + // This is not a problem, as the column type of "t1.col" is never + // used. When columnType() is called on the expression + // "(SELECT t1.col)", the correct type is returned (see the TK_SELECT + // branch below. + break + } + + if pS != 0 { + // The "table" is actually a sub-select or a view in the FROM clause + // of the SELECT statement. Return the declaration type and origin + // data for the result-set column of the sub-select. + if (iCol < (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pS)).FpEList)).FnExpr) && + (iCol >= 0) { + // If iCol is less than zero, then the expression requests the + // rowid of the sub-select or view. This expression is legal (see + // test case misc2.2.2) - it always evaluates to NULL. + // var sNC NameContext at bp, 56 + + var p uintptr = (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pS)).FpEList + 8 /* &.a */) + uintptr(iCol)*32)).FpExpr + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = (*Select)(unsafe.Pointer(pS)).FpSrc + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpNext = pNC + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse = (*NameContext)(unsafe.Pointer(pNC)).FpParse + zType = columnTypeImpl(tls, bp /* &sNC */, p, bp+56 /* &zOrigDb */, bp+64 /* &zOrigTab */, bp+72 /* &zOrigCol */) + } + } else { + // A real table or a CTE table + + if iCol < 0 { + iCol = int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + } + + if iCol < 0 { + zType = ts + 11385 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 14758 /* "rowid" */ + } else { + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName + zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), uintptr(0)) + } + *(*uintptr)(unsafe.Pointer(bp + 64 /* zOrigTab */)) = (*Table)(unsafe.Pointer(pTab)).FzName + if ((*NameContext)(unsafe.Pointer(pNC)).FpParse != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != 0) { + var iDb int32 = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer((*NameContext)(unsafe.Pointer(pNC)).FpParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zOrigDb */)) = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*NameContext)(unsafe.Pointer(pNC)).FpParse)).Fdb)).FaDb + uintptr(iDb)*32)).FzDbSName + } + } + break + + } + case TK_SELECT: + { + // The expression is a sub-select. Return the declaration type and + // origin info for the single column in the result set of the SELECT + // statement. + // var sNC NameContext at bp+80, 56 + + var pS uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + var p uintptr = (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pS)).FpEList + 8 /* &.a */))).FpExpr + + (*NameContext)(unsafe.Pointer(bp + 80 /* &sNC */)).FpSrcList = (*Select)(unsafe.Pointer(pS)).FpSrc + (*NameContext)(unsafe.Pointer(bp + 80 /* &sNC */)).FpNext = pNC + (*NameContext)(unsafe.Pointer(bp + 80 /* &sNC */)).FpParse = (*NameContext)(unsafe.Pointer(pNC)).FpParse + zType = columnTypeImpl(tls, bp+80 /* &sNC */, p, bp+56 /* &zOrigDb */, bp+64 /* &zOrigTab */, bp+72 /* &zOrigCol */) + break + + } + } + + if pzOrigDb != 0 { + + *(*uintptr)(unsafe.Pointer(pzOrigDb)) = *(*uintptr)(unsafe.Pointer(bp + 56 /* zOrigDb */)) + *(*uintptr)(unsafe.Pointer(pzOrigTab)) = *(*uintptr)(unsafe.Pointer(bp + 64 /* zOrigTab */)) + *(*uintptr)(unsafe.Pointer(pzOrigCol)) = *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) + } + return zType +} + +// Generate code that will tell the VDBE the declaration types of columns +// in the result set. +func generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pEList uintptr) { /* sqlite3.c:133962:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + // var sNC NameContext at bp, 56 + + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = pTabList + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpNext = uintptr(0) + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + var p uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + var zType uintptr + *(*uintptr)(unsafe.Pointer(bp + 56 /* zOrigDb */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* zOrigTab */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = uintptr(0) + zType = columnTypeImpl(tls, bp /* &sNC */, p, bp+56 /* &zOrigDb */, bp+64 /* &zOrigTab */, bp+72 /* &zOrigCol */) + + // The vdbe must make its own copy of the column-type and other + // column specific strings, in case the schema is reset before this + // virtual machine is deleted. + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_DATABASE, *(*uintptr)(unsafe.Pointer(bp + 56 /* zOrigDb */)), libc.UintptrFromInt32(-1)) + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_TABLE, *(*uintptr)(unsafe.Pointer(bp + 64 /* zOrigTab */)), libc.UintptrFromInt32(-1)) + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_COLUMN, *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)), libc.UintptrFromInt32(-1)) + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_DECLTYPE, zType, libc.UintptrFromInt32(-1)) + } +} + +// Compute the column names for a SELECT statement. +// +// The only guarantee that SQLite makes about column names is that if the +// column has an AS clause assigning it a name, that will be the name used. +// That is the only documented guarantee. However, countless applications +// developed over the years have made baseless assumptions about column names +// and will break if those assumptions changes. Hence, use extreme caution +// when modifying this routine to avoid breaking legacy. +// +// See Also: sqlite3ColumnsFromExprList() +// +// The PRAGMA short_column_names and PRAGMA full_column_names settings are +// deprecated. The default setting is short=ON, full=OFF. 99.9% of all +// applications should operate this way. Nevertheless, we need to support the +// other modes for legacy: +// +// short=OFF, full=OFF: Column name is the text of the expression has it +// originally appears in the SELECT statement. In +// other words, the zSpan of the result expression. +// +// short=ON, full=OFF: (This is the default setting). If the result +// refers directly to a table column, then the +// result column name is just the table column +// name: COLUMN. Otherwise use zSpan. +// +// full=ON, short=ANY: If the result refers directly to a table column, +// then the result column name with the table name +// prefix, ex: TABLE.COLUMN. Otherwise use zSpan. +func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) { /* sqlite3.c:134029:21: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + var pTab uintptr + var pTabList uintptr + var pEList uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var fullName int32 // TABLE.COLUMN if no AS clause and is a direct table ref + var srcName int32 // COLUMN or TABLE.COLUMN if no AS clause and is direct + + // If this is an EXPLAIN, skip this step + if (*Parse)(unsafe.Pointer(pParse)).Fexplain != 0 { + return + } + + if (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet != 0 { + return + } + // Column names are determined by the left-most term of a compound select + for (*Select)(unsafe.Pointer(pSelect)).FpPrior != 0 { + pSelect = (*Select)(unsafe.Pointer(pSelect)).FpPrior + } + + pTabList = (*Select)(unsafe.Pointer(pSelect)).FpSrc + pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList + + (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) + fullName = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_FullColNames)) != uint64(0))) + srcName = (libc.Bool32((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ShortColNames)) != uint64(0)) || (fullName != 0))) + Xsqlite3VdbeSetNumCols(tls, v, (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + for i = 0; i < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; i++ { + var p uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + + // Agg processing has not run yet + // Covering idx not yet coded + if ((*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FzEName != 0) && ((int32(*(*uint8)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME) { + // An AS clause always takes first priority + var zName uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, libc.UintptrFromInt32(-1)) + } else if (srcName != 0) && (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_COLUMN) { + var zCol uintptr + var iCol int32 = int32((*Expr)(unsafe.Pointer(p)).FiColumn) + pTab = *(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)) + + if iCol < 0 { + iCol = int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + } + + if iCol < 0 { + zCol = ts + 14758 /* "rowid" */ + } else { + zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName + } + if fullName != 0 { + var zName uintptr = uintptr(0) + zName = Xsqlite3MPrintf(tls, db, ts+10786 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) + } else { + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) + } + } else { + var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName + if z == uintptr(0) { + z = Xsqlite3MPrintf(tls, db, ts+17156 /* "column%d" */, libc.VaList(bp+16, (i+1))) + } else { + z = Xsqlite3DbStrDup(tls, db, z) + } + Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, z, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) + } + } + generateColumnTypes(tls, pParse, pTabList, pEList) +} + +// Given an expression list (which is really the list of expressions +// that form the result set of a SELECT statement) compute appropriate +// column names for a table that would hold the expression list. +// +// All column names will be unique. +// +// Only the column names are computed. Column.zType, Column.zColl, +// and other fields of Column are zeroed. +// +// Return SQLITE_OK on success. If a memory allocation error occurs, +// store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. +// +// The only guarantee that SQLite makes about column names is that if the +// column has an AS clause assigning it a name, that will be the name used. +// That is the only documented guarantee. However, countless applications +// developed over the years have made baseless assumptions about column names +// and will break if those assumptions changes. Hence, use extreme caution +// when modifying this routine to avoid breaking legacy. +// +// See Also: sqlite3GenerateColumnNames() +func Xsqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, pnCol uintptr, paCol uintptr) int32 { /* sqlite3.c:134121:20: */ + bp := tls.Alloc(60) + defer tls.Free(60) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection + var i int32 + var j int32 // Loop counters + // var cnt U32 at bp+56, 4 + // Index added to make the name unique + var aCol uintptr + var pCol uintptr // For looping over result columns + var nCol int32 // Number of columns in the result set + var zName uintptr // Column name + var nName int32 // Size of name in zName[] + // var ht Hash at bp+32, 24 + // Hash table of column names + var pTab uintptr + + Xsqlite3HashInit(tls, bp+32 /* &ht */) + if pEList != 0 { + nCol = (*ExprList)(unsafe.Pointer(pEList)).FnExpr + aCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Column{})) * uint64(nCol)))) + + if nCol > 32767 { + nCol = 32767 + } + } else { + nCol = 0 + aCol = uintptr(0) + } + + *(*I16)(unsafe.Pointer(pnCol)) = I16(nCol) + *(*uintptr)(unsafe.Pointer(paCol)) = aCol + + i = 0 + pCol = aCol +__1: + if !((i < nCol) && !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0)) { + goto __3 + } + { + // Get an appropriate name for the column + if ((libc.AssignUintptr(&zName, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FzEName)) != uintptr(0)) && ((int32(*(*uint8)(unsafe.Pointer(((pEList + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.eEName */)) & 0x3 >> 0)) == ENAME_NAME) { + // If the column contains an "AS " phrase, use as the name + } else { + var pColExpr uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + for (pColExpr != uintptr(0)) && (int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_DOT) { + pColExpr = (*Expr)(unsafe.Pointer(pColExpr)).FpRight + + } + if (int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_COLUMN) && ((libc.AssignUintptr(&pTab, *(*uintptr)(unsafe.Pointer(pColExpr + 64 /* &.y */)))) != uintptr(0)) { + // For columns use the column name name + var iCol int32 = int32((*Expr)(unsafe.Pointer(pColExpr)).FiColumn) + if iCol < 0 { + iCol = int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + } + if iCol >= 0 { + zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName + } else { + zName = ts + 14758 /* "rowid" */ + } + } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { + + zName = *(*uintptr)(unsafe.Pointer(pColExpr + 8 /* &.u */)) + } else { + // Use the original text of the column expression as its name + zName = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName + } + } + if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { + zName = Xsqlite3DbStrDup(tls, db, zName) + } else { + zName = Xsqlite3MPrintf(tls, db, ts+17156 /* "column%d" */, libc.VaList(bp, (i+1))) + } + + // Make sure the column name is unique. If the name is not unique, + // append an integer to the name so that it becomes unique. + *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) = U32(0) + for (zName != 0) && (Xsqlite3HashFind(tls, bp+32 /* &ht */, zName) != uintptr(0)) { + nName = Xsqlite3Strlen30(tls, zName) + if nName > 0 { + for j = (nName - 1); (j > 0) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zName + uintptr(j))))]) & 0x04) != 0); j-- { + } + if int32(*(*int8)(unsafe.Pointer(zName + uintptr(j)))) == ':' { + nName = j + } + } + zName = Xsqlite3MPrintf(tls, db, ts+17165 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) + if *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) > U32(3) { + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &cnt */) + } + } + (*Column)(unsafe.Pointer(pCol)).FzName = zName + (*Column)(unsafe.Pointer(pCol)).FhName = Xsqlite3StrIHash(tls, zName) + + if (zName != 0) && (Xsqlite3HashInsert(tls, bp+32 /* &ht */, zName, pCol) == pCol) { + Xsqlite3OomFault(tls, db) + } + + } + goto __2 +__2: + i++ + pCol += 32 + goto __1 + goto __3 +__3: + ; + Xsqlite3HashClear(tls, bp+32 /* &ht */) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + for j = 0; j < i; j++ { + Xsqlite3DbFree(tls, db, (*Column)(unsafe.Pointer(aCol+uintptr(j)*32)).FzName) + } + Xsqlite3DbFree(tls, db, aCol) + *(*uintptr)(unsafe.Pointer(paCol)) = uintptr(0) + *(*I16)(unsafe.Pointer(pnCol)) = int16(0) + return SQLITE_NOMEM + } + return SQLITE_OK +} + +// Add type and collation information to a column list based on +// a SELECT statement. +// +// The column list presumably came from selectColumnNamesFromExprList(). +// The column list has only names, not types or collations. This +// routine goes through and adds the types and collations. +// +// This routine requires that all identifiers in the SELECT +// statement be resolved. +func Xsqlite3SelectAddColumnTypeAndCollation(tls *libc.TLS, pParse uintptr, pTab uintptr, pSelect uintptr, aff int8) { /* sqlite3.c:134225:21: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + // var sNC NameContext at bp, 56 + + var pCol uintptr + var pColl uintptr + var i int32 + var p uintptr + var a uintptr + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + libc.Xmemset(tls, bp /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp /* &sNC */)).FpSrcList = (*Select)(unsafe.Pointer(pSelect)).FpSrc + a = (*Select)(unsafe.Pointer(pSelect)).FpEList + 8 /* &.a */ + i = 0 + pCol = (*Table)(unsafe.Pointer(pTab)).FaCol +__1: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __3 + } + { + var zType uintptr + var n int32 + var m int32 + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_NOINSERT)) + p = (*ExprList_item)(unsafe.Pointer(a + uintptr(i)*32)).FpExpr + zType = columnTypeImpl(tls, bp /* &sNC */, p, uintptr(0), uintptr(0), uintptr(0)) + // pCol->szEst = ... // Column size est for SELECT tables never used + (*Column)(unsafe.Pointer(pCol)).Faffinity = Xsqlite3ExprAffinity(tls, p) + if zType != 0 { + m = Xsqlite3Strlen30(tls, zType) + n = Xsqlite3Strlen30(tls, (*Column)(unsafe.Pointer(pCol)).FzName) + (*Column)(unsafe.Pointer(pCol)).FzName = Xsqlite3DbReallocOrFree(tls, db, (*Column)(unsafe.Pointer(pCol)).FzName, (uint64((n + m) + 2))) + if (*Column)(unsafe.Pointer(pCol)).FzName != 0 { + libc.Xmemcpy(tls, ((*Column)(unsafe.Pointer(pCol)).FzName + uintptr((n + 1))), zType, (uint64(m + 1))) + *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_HASTYPE)) + } + } + if int32((*Column)(unsafe.Pointer(pCol)).Faffinity) <= SQLITE_AFF_NONE { + (*Column)(unsafe.Pointer(pCol)).Faffinity = aff + } + pColl = Xsqlite3ExprCollSeq(tls, pParse, p) + if (pColl != 0) && ((*Column)(unsafe.Pointer(pCol)).FzColl == uintptr(0)) { + (*Column)(unsafe.Pointer(pCol)).FzColl = Xsqlite3DbStrDup(tls, db, (*CollSeq)(unsafe.Pointer(pColl)).FzName) + } + + } + goto __2 +__2: + i++ + pCol += 32 + goto __1 + goto __3 +__3: + ; + (*Table)(unsafe.Pointer(pTab)).FszTabRow = int16(1) // Any non-zero value works +} + +// Given a SELECT statement, generate a Table structure that describes +// the result set of that SELECT. +func Xsqlite3ResultSetOfSelect(tls *libc.TLS, pParse uintptr, pSelect uintptr, aff int8) uintptr { /* sqlite3.c:134276:22: */ + var pTab uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var savedFlags U64 + + savedFlags = (*Sqlite3)(unsafe.Pointer(db)).Fflags + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_FullColNames))) + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(SQLITE_ShortColNames)) + Xsqlite3SelectPrep(tls, pParse, pSelect, uintptr(0)) + (*Sqlite3)(unsafe.Pointer(db)).Fflags = savedFlags + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return uintptr(0) + } + for (*Select)(unsafe.Pointer(pSelect)).FpPrior != 0 { + pSelect = (*Select)(unsafe.Pointer(pSelect)).FpPrior + } + pTab = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Table{}))) + if pTab == uintptr(0) { + return uintptr(0) + } + (*Table)(unsafe.Pointer(pTab)).FnTabRef = U32(1) + (*Table)(unsafe.Pointer(pTab)).FzName = uintptr(0) + (*Table)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) + Xsqlite3ColumnsFromExprList(tls, pParse, (*Select)(unsafe.Pointer(pSelect)).FpEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) + Xsqlite3SelectAddColumnTypeAndCollation(tls, pParse, pTab, pSelect, aff) + (*Table)(unsafe.Pointer(pTab)).FiPKey = int16(-1) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3DeleteTable(tls, db, pTab) + return uintptr(0) + } + return pTab +} + +// Get a VDBE for the given parser context. Create a new one if necessary. +// If an error occurs, return NULL and leave a message in pParse. +func Xsqlite3GetVdbe(tls *libc.TLS, pParse uintptr) uintptr { /* sqlite3.c:134309:21: */ + if (*Parse)(unsafe.Pointer(pParse)).FpVdbe != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpVdbe + } + if ((*Parse)(unsafe.Pointer(pParse)).FpToplevel == uintptr(0)) && + (((*Sqlite3)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb))).FdbOptFlags & (U32(SQLITE_FactorOutConst))) == U32(0)) { + (*Parse)(unsafe.Pointer(pParse)).FokConstFactor = U8(1) + } + return Xsqlite3VdbeCreate(tls, pParse) +} + +// Compute the iLimit and iOffset fields of the SELECT based on the +// pLimit expressions. pLimit->pLeft and pLimit->pRight hold the expressions +// that appear in the original SQL statement after the LIMIT and OFFSET +// keywords. Or NULL if those keywords are omitted. iLimit and iOffset +// are the integer memory register numbers for counters used to compute +// the limit and offset. If there is no limit and/or offset, then +// iLimit and iOffset are negative. +// +// This routine changes the values of iLimit and iOffset only if +// a limit or offset is defined by pLimit->pLeft and pLimit->pRight. iLimit +// and iOffset should have been preset to appropriate default values (zero) +// prior to calling this routine. +// +// The iOffset register (if it exists) is initialized to the value +// of the OFFSET. The iLimit register is initialized to LIMIT. Register +// iOffset+1 is initialized to LIMIT+OFFSET. +// +// Only if pLimit->pLeft!=0 do the limit registers get +// redefined. The UNION ALL operator uses this property to force +// the reuse of the same limit and offset registers across multiple +// SELECT statements. +func computeLimitRegisters(tls *libc.TLS, pParse uintptr, p uintptr, iBreak int32) { /* sqlite3.c:134345:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var v uintptr = uintptr(0) + var iLimit int32 = 0 + var iOffset int32 + // var n int32 at bp, 4 + + var pLimit uintptr = (*Select)(unsafe.Pointer(p)).FpLimit + + if (*Select)(unsafe.Pointer(p)).FiLimit != 0 { + return + } + + // "LIMIT -1" always shows all rows. There is some + // controversy about what the correct behavior should be. + // The current implementation interprets "LIMIT 0" to mean + // no rows. + if pLimit != 0 { + + (*Select)(unsafe.Pointer(p)).FiLimit = libc.AssignInt32(&iLimit, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + v = Xsqlite3GetVdbe(tls, pParse) + + if Xsqlite3ExprIsInteger(tls, (*Expr)(unsafe.Pointer(pLimit)).FpLeft, bp /* &n */) != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, *(*int32)(unsafe.Pointer(bp /* n */)), iLimit) + + if *(*int32)(unsafe.Pointer(bp /* n */)) == 0 { + Xsqlite3VdbeGoto(tls, v, iBreak) + } else if (*(*int32)(unsafe.Pointer(bp /* n */)) >= 0) && (int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > int32(Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp /* n */)))))) { + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp /* n */)))) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_FixedLimit)) + } + } else { + Xsqlite3ExprCode(tls, pParse, (*Expr)(unsafe.Pointer(pLimit)).FpLeft, iLimit) + Xsqlite3VdbeAddOp1(tls, v, OP_MustBeInt, iLimit) + + Xsqlite3VdbeAddOp2(tls, v, OP_IfNot, iLimit, iBreak) + } + if (*Expr)(unsafe.Pointer(pLimit)).FpRight != 0 { + (*Select)(unsafe.Pointer(p)).FiOffset = libc.AssignInt32(&iOffset, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + (*Parse)(unsafe.Pointer(pParse)).FnMem++ // Allocate an extra register for limit+offset + Xsqlite3ExprCode(tls, pParse, (*Expr)(unsafe.Pointer(pLimit)).FpRight, iOffset) + Xsqlite3VdbeAddOp1(tls, v, OP_MustBeInt, iOffset) + + Xsqlite3VdbeAddOp3(tls, v, OP_OffsetLimit, iLimit, (iOffset + 1), iOffset) + + } + } +} + +// Return the appropriate collating sequence for the iCol-th column of +// the result set for the compound-select statement "p". Return NULL if +// the column has no default collating sequence. +// +// The collating sequence for the compound select is taken from the +// left-most term of the select that has a collating sequence. +func multiSelectCollSeq(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) uintptr { /* sqlite3.c:134402:16: */ + var pRet uintptr + if (*Select)(unsafe.Pointer(p)).FpPrior != 0 { + pRet = multiSelectCollSeq(tls, pParse, (*Select)(unsafe.Pointer(p)).FpPrior, iCol) + } else { + pRet = uintptr(0) + } + + // iCol must be less than p->pEList->nExpr. Otherwise an error would + // have been thrown during name resolution and we would not have gotten + // this far + if (pRet == uintptr(0)) && (iCol < (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr) { + pRet = Xsqlite3ExprCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpEList+8 /* &.a */)+uintptr(iCol)*32)).FpExpr) + } + return pRet +} + +// The select statement passed as the second parameter is a compound SELECT +// with an ORDER BY clause. This function allocates and returns a KeyInfo +// structure suitable for implementing the ORDER BY. +// +// Space to hold the KeyInfo structure is obtained from malloc. The calling +// function is responsible for ensuring that this structure is eventually +// freed. +func multiSelectOrderByKeyInfo(tls *libc.TLS, pParse uintptr, p uintptr, nExtra int32) uintptr { /* sqlite3.c:134428:16: */ + var pOrderBy uintptr = (*Select)(unsafe.Pointer(p)).FpOrderBy + var nOrderBy int32 = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpOrderBy)).FnExpr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pRet uintptr = Xsqlite3KeyInfoAlloc(tls, db, (nOrderBy + nExtra), 1) + if pRet != 0 { + var i int32 + for i = 0; i < nOrderBy; i++ { + var pItem uintptr = ((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + var pTerm uintptr = (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr + var pColl uintptr + + if ((*Expr)(unsafe.Pointer(pTerm)).Fflags & U32(EP_Collate)) != 0 { + pColl = Xsqlite3ExprCollSeq(tls, pParse, pTerm) + } else { + pColl = multiSelectCollSeq(tls, pParse, p, (int32(*(*U16)(unsafe.Pointer((pItem + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) - 1)) + if pColl == uintptr(0) { + pColl = (*Sqlite3)(unsafe.Pointer(db)).FpDfltColl + } + (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32)).FpExpr = Xsqlite3ExprAddCollateString(tls, pParse, pTerm, (*CollSeq)(unsafe.Pointer(pColl)).FzName) + } + + *(*uintptr)(unsafe.Pointer((pRet + 32 /* &.aColl */) + uintptr(i)*8)) = pColl + *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pRet)).FaSortFlags + uintptr(i))) = (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32)).FsortFlags + } + } + + return pRet +} + +// This routine generates VDBE code to compute the content of a WITH RECURSIVE +// query of the form: +// +// AS ( UNION [ALL] ) +// \___________/ \_______________/ +// p->pPrior p +// +// +// There is exactly one reference to the recursive-table in the FROM clause +// of recursive-query, marked with the SrcList->a[].fg.isRecursive flag. +// +// The setup-query runs once to generate an initial set of rows that go +// into a Queue table. Rows are extracted from the Queue table one by +// one. Each row extracted from Queue is output to pDest. Then the single +// extracted row (now in the iCurrent table) becomes the content of the +// recursive-table for a recursive-query run. The output of the recursive-query +// is added back into the Queue table. Then another row is extracted from Queue +// and the iteration continues until the Queue table is empty. +// +// If the compound query operator is UNION then no duplicate rows are ever +// inserted into the Queue table. The iDistinct table keeps a copy of all rows +// that have ever been inserted into Queue and causes duplicates to be +// discarded. If the operator is UNION ALL, then duplicates are allowed. +// +// If the query has an ORDER BY, then entries in the Queue table are kept in +// ORDER BY order and the first entry is extracted for each cycle. Without +// an ORDER BY, the Queue table is just a FIFO. +// +// If a LIMIT clause is provided, then the iteration stops after LIMIT rows +// have been output to pDest. A LIMIT of zero means to output no rows and a +// negative LIMIT means to output all rows. If there is also an OFFSET clause +// with a positive value, then the first OFFSET outputs are discarded rather +// than being sent to pDest. The LIMIT count does not begin until after OFFSET +// rows have been skipped. +func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) { /* sqlite3.c:134494:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var pSrc uintptr // The FROM clause of the recursive query + var nCol int32 // Number of columns in the recursive table + var v uintptr // The prepared statement under construction + var pSetup uintptr // The setup query + var pFirstRec uintptr // Left-most recursive term + var addrTop int32 // Top of the loop + var addrCont int32 + var addrBreak int32 // CONTINUE and BREAK addresses + var iCurrent int32 // The Current table + var regCurrent int32 // Register holding Current table + var iQueue int32 // The Queue table + var iDistinct int32 // To ensure unique results if UNION + var eDest int32 // How to write to Queue + // var destQueue SelectDest at bp, 40 + // SelectDest targetting the Queue table + var i int32 // Loop counter + var rc int32 // Result code + var pOrderBy uintptr // The ORDER BY clause + var pLimit uintptr // Saved LIMIT and OFFSET + var regLimit int32 + var regOffset int32 + var pKeyInfo uintptr + pSrc = (*Select)(unsafe.Pointer(p)).FpSrc + nCol = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + pSetup = (*Select)(unsafe.Pointer(p)).FpPrior + iCurrent = 0 + iDistinct = 0 + eDest = SRT_Fifo // Registers used by LIMIT and OFFSET + + if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { + goto __1 + } + Xsqlite3ErrorMsg(tls, pParse, ts+17173 /* "cannot use windo..." */, 0) + return +__1: + ; + + // Obtain authorization to do a recursive query + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_RECURSIVE, uintptr(0), uintptr(0), uintptr(0)) != 0) { + goto __2 + } + return +__2: + ; + + // Process the LIMIT and OFFSET clauses, if they exist + addrBreak = Xsqlite3VdbeMakeLabel(tls, pParse) + (*Select)(unsafe.Pointer(p)).FnSelectRow = int16(320) // 4 billion rows + computeLimitRegisters(tls, pParse, p, addrBreak) + pLimit = (*Select)(unsafe.Pointer(p)).FpLimit + regLimit = (*Select)(unsafe.Pointer(p)).FiLimit + regOffset = (*Select)(unsafe.Pointer(p)).FiOffset + (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) + (*Select)(unsafe.Pointer(p)).FiLimit = libc.AssignPtrInt32(p+12 /* &.iOffset */, 0) + pOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy + + // Locate the cursor number of the Current table + i = 0 +__3: + if !(i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc) { + goto __5 + } + if !((uint32(int32(*(*uint16)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(i)*112 + 60 /* &.fg */ + 4 /* &.isRecursive */)) & 0x20 >> 5))) != 0) { + goto __6 + } + iCurrent = (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(i)*112)).FiCursor + goto __5 +__6: + ; + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; + + // Allocate cursors numbers for Queue and Distinct. The cursor number for + // the Distinct table must be exactly one greater than Queue in order + // for the SRT_DistFifo and SRT_DistQueue destinations to work. + iQueue = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + if !(int32((*Select)(unsafe.Pointer(p)).Fop) == TK_UNION) { + goto __7 + } + if pOrderBy != 0 { + eDest = SRT_DistQueue + } else { + eDest = SRT_DistFifo + } + iDistinct = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + goto __8 +__7: + if pOrderBy != 0 { + eDest = SRT_Queue + } else { + eDest = SRT_Fifo + } +__8: + ; + Xsqlite3SelectDestInit(tls, bp /* &destQueue */, eDest, iQueue) + + // Allocate cursors for Current, Queue, and Distinct. + regCurrent = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp3(tls, v, OP_OpenPseudo, iCurrent, regCurrent, nCol) + if !(pOrderBy != 0) { + goto __9 + } + pKeyInfo = multiSelectOrderByKeyInfo(tls, pParse, p, 1) + Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, iQueue, ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr + 2), 0, + pKeyInfo, -9) + (*SelectDest)(unsafe.Pointer(bp /* &destQueue */)).FpOrderBy = pOrderBy + goto __10 +__9: + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, iQueue, nCol) +__10: + ; + + if !(iDistinct != 0) { + goto __11 + } + *(*int32)(unsafe.Pointer((p + 20 /* &.addrOpenEphm */))) = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, iDistinct, 0) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_UsesEphemeral)) +__11: + ; + + // Detach the ORDER BY clause from the compound SELECT + (*Select)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + + // Figure out how many elements of the compound SELECT are part of the + // recursive query. Make sure no recursive elements use aggregate + // functions. Mark the recursive elements as UNION ALL even if they + // are really UNION because the distinctness will be enforced by the + // iDistinct table. pFirstRec is left pointing to the left-most + // recursive term of the CTE. + pFirstRec = p + pFirstRec = p +__12: + if !(pFirstRec != uintptr(0)) { + goto __14 + } + if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { + goto __15 + } + Xsqlite3ErrorMsg(tls, pParse, ts+17222 /* "recursive aggreg..." */, 0) + goto end_of_recursive_query +__15: + ; + (*Select)(unsafe.Pointer(pFirstRec)).Fop = U8(TK_ALL) + if !(((*Select)(unsafe.Pointer((*Select)(unsafe.Pointer(pFirstRec)).FpPrior)).FselFlags & U32(SF_Recursive)) == U32(0)) { + goto __16 + } + goto __14 +__16: + ; + goto __13 +__13: + pFirstRec = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior + goto __12 + goto __14 +__14: + ; + + // Store the results of the setup-query in Queue. + pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior + (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17264 /* "SETUP" */, 0) + rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) + (*Select)(unsafe.Pointer(pSetup)).FpNext = p + if !(rc != 0) { + goto __17 + } + goto end_of_recursive_query +__17: + ; + + // Find the next row in the Queue and output that row + addrTop = Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iQueue, addrBreak) + + // Transfer the next row in Queue over to Current + Xsqlite3VdbeAddOp1(tls, v, OP_NullRow, iCurrent) // To reset column cache + if !(pOrderBy != 0) { + goto __18 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iQueue, ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr + 1), regCurrent) + goto __19 +__18: + Xsqlite3VdbeAddOp2(tls, v, OP_RowData, iQueue, regCurrent) +__19: + ; + Xsqlite3VdbeAddOp1(tls, v, OP_Delete, iQueue) + + // Output the single row in Current + addrCont = Xsqlite3VdbeMakeLabel(tls, pParse) + codeOffset(tls, v, regOffset, addrCont) + selectInnerLoop(tls, pParse, p, iCurrent, + uintptr(0), uintptr(0), pDest, addrCont, addrBreak) + if !(regLimit != 0) { + goto __20 + } + Xsqlite3VdbeAddOp2(tls, v, OP_DecrJumpZero, regLimit, addrBreak) + +__20: + ; + Xsqlite3VdbeResolveLabel(tls, v, addrCont) + + // Execute the recursive SELECT taking the single row in Current as + // the value for the recursive-table. Store the results in the Queue. + (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17270 /* "RECURSIVE STEP" */, 0) + Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) + + (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup + + // Keep running the loop until the Queue is empty + Xsqlite3VdbeGoto(tls, v, addrTop) + Xsqlite3VdbeResolveLabel(tls, v, addrBreak) + +end_of_recursive_query: + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Select)(unsafe.Pointer(p)).FpOrderBy) + (*Select)(unsafe.Pointer(p)).FpOrderBy = pOrderBy + (*Select)(unsafe.Pointer(p)).FpLimit = pLimit + return +} + +// Handle the special case of a compound-select that originates from a +// VALUES clause. By handling this as a special case, we avoid deep +// recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT +// on a VALUES clause. +// +// Because the Select object originates from a VALUES clause: +// (1) There is no LIMIT or OFFSET or else there is a LIMIT of exactly 1 +// (2) All terms are UNION ALL +// (3) There is no ORDER BY clause +// +// The "LIMIT of exactly 1" case of condition (1) comes about when a VALUES +// clause occurs within scalar expression (ex: "SELECT (VALUES(1),(2),(3))"). +// The sqlite3CodeSubselect will have added the LIMIT 1 clause in tht case. +// Since the limit is exactly 1, we only need to evalutes the left-most VALUES. +func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:134671:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nRow int32 = 1 + var rc int32 = 0 + var bShowAll int32 = (libc.Bool32((*Select)(unsafe.Pointer(p)).FpLimit == uintptr(0))) + + for ok := true; ok; ok = 1 != 0 { + + if (*Select)(unsafe.Pointer(p)).FpWin != 0 { + return -1 + } + if (*Select)(unsafe.Pointer(p)).FpPrior == uintptr(0) { + break + } + + p = (*Select)(unsafe.Pointer(p)).FpPrior + nRow = nRow + (bShowAll) + } + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17285 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + if nRow == 1 { + return ts + 756 /* "" */ + } + return ts + 17308 /* "S" */ + }())) + for p != 0 { + selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) + if !(bShowAll != 0) { + break + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = LogEst(nRow) + p = (*Select)(unsafe.Pointer(p)).FpNext + } + return rc +} + +// Return true if the SELECT statement which is known to be the recursive +// part of a recursive CTE still has its anchor terms attached. If the +// anchor terms have already been removed, then return false. +func hasAnchor(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:134708:12: */ + for (p != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Recursive)) != U32(0)) { + p = (*Select)(unsafe.Pointer(p)).FpPrior + } + return (libc.Bool32(p != uintptr(0))) +} + +// This routine is called to process a compound query form from +// two or more separate queries using UNION, UNION ALL, EXCEPT, or +// INTERSECT +// +// "p" points to the right-most of the two queries. the query on the +// left is p->pPrior. The left query could also be a compound query +// in which case this routine will be called recursively. +// +// The results of the total query are to be written into a destination +// of type eDest with parameter iParm. +// +// Example 1: Consider a three-way compound SQL statement. +// +// SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3 +// +// This statement is parsed up as follows: +// +// SELECT c FROM t3 +// | +// `-----> SELECT b FROM t2 +// | +// `------> SELECT a FROM t1 +// +// The arrows in the diagram above represent the Select.pPrior pointer. +// So if this routine is called with p equal to the t3 query, then +// pPrior will be the t2 query. p->op will be TK_UNION in this case. +// +// Notice that because of the way SQLite parses compound SELECTs, the +// individual selects always group from left to right. +func multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:134744:12: */ + bp := tls.Alloc(144) + defer tls.Free(144) + + var rc int32 // Success code from a subroutine + var pPrior uintptr // Another SELECT immediately to our left + var v uintptr // Generate code to this VDBE + // var dest SelectDest at bp+16, 40 + // Alternative data destination + var pDelete uintptr // Chain of simple selects to delete + var db uintptr + var addr int32 + // var nLimit int32 at bp+56, 4 + + var iCont int32 + var iBreak int32 + var iStart int32 + var unionTab int32 // Cursor number of the temp table holding result + var op U8 // One of the SRT_ operations to apply to self + var priorOp int32 // The SRT_ operation to apply to prior selects + var pLimit uintptr // Saved values of p->nLimit + var addr1 int32 + // var uniondest SelectDest at bp+64, 40 + + var tab1 int32 + var tab2 int32 + var iCont1 int32 + var iBreak1 int32 + var iStart1 int32 + var pLimit1 uintptr + var addr2 int32 + // var intersectdest SelectDest at bp+104, 40 + + var r1 int32 + var addr3 int32 + var i int32 // Loop counter + var pKeyInfo uintptr // Collating sequence for the result set + var pLoop uintptr // For looping through SELECT statements + var apColl uintptr // For looping through pKeyInfo->aColl[] + var nCol int32 + rc = SQLITE_OK + pDelete = uintptr(0) // Database connection + + // Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only + // the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. + // Calling function guarantees this much + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pPrior = (*Select)(unsafe.Pointer(p)).FpPrior + *(*SelectDest)(unsafe.Pointer(bp + 16 /* dest */)) = *(*SelectDest)(unsafe.Pointer(pDest)) + + v = Xsqlite3GetVdbe(tls, pParse) + // The VDBE already created by calling function + + // Create the destination temporary table if necessary + if !(int32((*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FeDest) == SRT_EphemTab) { + goto __1 + } + + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FiSDParm, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr) + (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FeDest = U8(SRT_Table) +__1: + ; + + // Special handling for a compound-select that originates as a VALUES clause. + if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) != 0) { + goto __2 + } + rc = multiSelectValues(tls, pParse, p, bp+16 /* &dest */) + if !(rc >= 0) { + goto __3 + } + goto multi_select_end +__3: + ; + rc = SQLITE_OK +__2: + ; + + // Make sure all SELECTs in the statement have the same number of elements + // in their result sets. + + if !((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Recursive)) != U32(0)) && (hasAnchor(tls, p) != 0)) { + goto __4 + } + generateWithRecursiveQuery(tls, pParse, p, bp+16 /* &dest */) + goto __5 +__4: + + // Compound SELECTs that have an ORDER BY clause are handled separately. + if !((*Select)(unsafe.Pointer(p)).FpOrderBy != 0) { + goto __6 + } + return multiSelectOrderBy(tls, pParse, p, pDest) + goto __7 +__6: + + if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { + goto __8 + } + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17310 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17325 /* "LEFT-MOST SUBQUE..." */, 0) +__8: + ; + + // Generate code for the left and right SELECT statements. + switch int32((*Select)(unsafe.Pointer(p)).Fop) { + case TK_ALL: + goto __10 + case TK_EXCEPT: + goto __11 + case TK_UNION: + goto __12 + default: + goto __13 + } + goto __9 +__10: + addr = 0 + *(*int32)(unsafe.Pointer(bp + 56 /* nLimit */)) = 0 // Initialize to suppress harmless compiler warning + + (*Select)(unsafe.Pointer(pPrior)).FiLimit = (*Select)(unsafe.Pointer(p)).FiLimit + (*Select)(unsafe.Pointer(pPrior)).FiOffset = (*Select)(unsafe.Pointer(p)).FiOffset + (*Select)(unsafe.Pointer(pPrior)).FpLimit = (*Select)(unsafe.Pointer(p)).FpLimit + + rc = Xsqlite3Select(tls, pParse, pPrior, bp+16 /* &dest */) + (*Select)(unsafe.Pointer(pPrior)).FpLimit = uintptr(0) + if !(rc != 0) { + goto __14 + } + goto multi_select_end +__14: + ; + (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*Select)(unsafe.Pointer(p)).FiLimit = (*Select)(unsafe.Pointer(pPrior)).FiLimit + (*Select)(unsafe.Pointer(p)).FiOffset = (*Select)(unsafe.Pointer(pPrior)).FiOffset + if !((*Select)(unsafe.Pointer(p)).FiLimit != 0) { + goto __15 + } + addr = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, (*Select)(unsafe.Pointer(p)).FiLimit) + + if !((*Select)(unsafe.Pointer(p)).FiOffset != 0) { + goto __16 + } + Xsqlite3VdbeAddOp3(tls, v, OP_OffsetLimit, + (*Select)(unsafe.Pointer(p)).FiLimit, ((*Select)(unsafe.Pointer(p)).FiOffset + 1), (*Select)(unsafe.Pointer(p)).FiOffset) +__16: + ; +__15: + ; + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17100 /* "UNION ALL" */, 0) + + rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) + + pDelete = (*Select)(unsafe.Pointer(p)).FpPrior + (*Select)(unsafe.Pointer(p)).FpPrior = pPrior + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEstAdd(tls, (*Select)(unsafe.Pointer(p)).FnSelectRow, (*Select)(unsafe.Pointer(pPrior)).FnSelectRow) + if !(((((*Select)(unsafe.Pointer(p)).FpLimit != 0) && + (Xsqlite3ExprIsInteger(tls, (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpLimit)).FpLeft, bp+56 /* &nLimit */) != 0)) && + (*(*int32)(unsafe.Pointer(bp + 56 /* nLimit */)) > 0)) && (int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > int32(Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp + 56 /* nLimit */))))))) { + goto __17 + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp + 56 /* nLimit */)))) +__17: + ; + if !(addr != 0) { + goto __18 + } + Xsqlite3VdbeJumpHere(tls, v, addr) +__18: + ; + goto __9 + +__11: +__12: // Cursor number of the temp table holding result + op = U8(0) + + priorOp = SRT_Union + if !(int32((*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FeDest) == priorOp) { + goto __19 + } + // We can reuse a temporary table generated by a SELECT to our + // right. + // Not allowed on leftward elements + unionTab = (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FiSDParm + goto __20 +__19: + // We will need to create our own temporary table to hold the + // intermediate results. + unionTab = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + + addr1 = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, unionTab, 0) + + *(*int32)(unsafe.Pointer((p + 20 /* &.addrOpenEphm */))) = addr1 + *(*U32)(unsafe.Pointer(findRightmost(tls, p) + 4 /* &.selFlags */)) |= (U32(SF_UsesEphemeral)) + +__20: + ; + + // Code the SELECT statements to our left + + Xsqlite3SelectDestInit(tls, bp+64 /* &uniondest */, priorOp, unionTab) + + rc = Xsqlite3Select(tls, pParse, pPrior, bp+64 /* &uniondest */) + if !(rc != 0) { + goto __21 + } + goto multi_select_end +__21: + ; + + // Code the current SELECT statement + if !(int32((*Select)(unsafe.Pointer(p)).Fop) == TK_EXCEPT) { + goto __22 + } + op = U8(SRT_Except) + goto __23 +__22: + ; + op = U8(SRT_Union) +__23: + ; + (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) + pLimit = (*Select)(unsafe.Pointer(p)).FpLimit + (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) + (*SelectDest)(unsafe.Pointer(bp + 64 /* &uniondest */)).FeDest = op + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17344 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + + rc = Xsqlite3Select(tls, pParse, p, bp+64 /* &uniondest */) + + pDelete = (*Select)(unsafe.Pointer(p)).FpPrior + (*Select)(unsafe.Pointer(p)).FpPrior = pPrior + (*Select)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + if !(int32((*Select)(unsafe.Pointer(p)).Fop) == TK_UNION) { + goto __24 + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEstAdd(tls, (*Select)(unsafe.Pointer(p)).FnSelectRow, (*Select)(unsafe.Pointer(pPrior)).FnSelectRow) +__24: + ; + Xsqlite3ExprDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpLimit) + (*Select)(unsafe.Pointer(p)).FpLimit = pLimit + (*Select)(unsafe.Pointer(p)).FiLimit = 0 + (*Select)(unsafe.Pointer(p)).FiOffset = 0 + + // Convert the data in the temporary table into whatever form + // it is that we currently need. + + if !((int32((*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FeDest) != priorOp) && (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0)) { + goto __25 + } + iBreak = Xsqlite3VdbeMakeLabel(tls, pParse) + iCont = Xsqlite3VdbeMakeLabel(tls, pParse) + computeLimitRegisters(tls, pParse, p, iBreak) + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, unionTab, iBreak) + iStart = Xsqlite3VdbeCurrentAddr(tls, v) + selectInnerLoop(tls, pParse, p, unionTab, + uintptr(0), uintptr(0), bp+16 /* &dest */, iCont, iBreak) + Xsqlite3VdbeResolveLabel(tls, v, iCont) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, unionTab, iStart) + Xsqlite3VdbeResolveLabel(tls, v, iBreak) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, unionTab, 0) +__25: + ; + goto __9 + +__13: + ; + + // INTERSECT is different from the others since it requires + // two temporary tables. Hence it has its own case. Begin + // by allocating the tables we will need. + tab1 = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + tab2 = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + + addr2 = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, tab1, 0) + + *(*int32)(unsafe.Pointer((p + 20 /* &.addrOpenEphm */))) = addr2 + *(*U32)(unsafe.Pointer(findRightmost(tls, p) + 4 /* &.selFlags */)) |= (U32(SF_UsesEphemeral)) + + // Code the SELECTs to our left into temporary table "tab1". + Xsqlite3SelectDestInit(tls, bp+104 /* &intersectdest */, SRT_Union, tab1) + + rc = Xsqlite3Select(tls, pParse, pPrior, bp+104 /* &intersectdest */) + if !(rc != 0) { + goto __26 + } + goto multi_select_end +__26: + ; + + // Code the current SELECT into temporary table "tab2" + addr2 = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, tab2, 0) + + *(*int32)(unsafe.Pointer((p + 20 /* &.addrOpenEphm */) + 1*4)) = addr2 + (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) + pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit + (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) + (*SelectDest)(unsafe.Pointer(bp + 104 /* &intersectdest */)).FiSDParm = tab2 + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17344 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + + rc = Xsqlite3Select(tls, pParse, p, bp+104 /* &intersectdest */) + + pDelete = (*Select)(unsafe.Pointer(p)).FpPrior + (*Select)(unsafe.Pointer(p)).FpPrior = pPrior + if !(int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > int32((*Select)(unsafe.Pointer(pPrior)).FnSelectRow)) { + goto __27 + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = (*Select)(unsafe.Pointer(pPrior)).FnSelectRow +__27: + ; + Xsqlite3ExprDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpLimit) + (*Select)(unsafe.Pointer(p)).FpLimit = pLimit1 + + // Generate code to take the intersection of the two temporary + // tables. + if !(rc != 0) { + goto __28 + } + goto __9 +__28: + ; + + iBreak1 = Xsqlite3VdbeMakeLabel(tls, pParse) + iCont1 = Xsqlite3VdbeMakeLabel(tls, pParse) + computeLimitRegisters(tls, pParse, p, iBreak1) + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, tab1, iBreak1) + r1 = Xsqlite3GetTempReg(tls, pParse) + iStart1 = Xsqlite3VdbeAddOp2(tls, v, OP_RowData, tab1, r1) + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, tab2, iCont1, r1, 0) + + Xsqlite3ReleaseTempReg(tls, pParse, r1) + selectInnerLoop(tls, pParse, p, tab1, + uintptr(0), uintptr(0), bp+16 /* &dest */, iCont1, iBreak1) + Xsqlite3VdbeResolveLabel(tls, v, iCont1) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, tab1, iStart1) + Xsqlite3VdbeResolveLabel(tls, v, iBreak1) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, tab2, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, tab1, 0) + goto __9 + +__9: + ; + + if !((*Select)(unsafe.Pointer(p)).FpNext == uintptr(0)) { + goto __29 + } + Xsqlite3VdbeExplainPop(tls, pParse) +__29: + ; +__7: + ; +__5: + ; + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __30 + } + goto multi_select_end +__30: + ; + + // Compute collating sequences used by + // temporary tables needed to implement the compound select. + // Attach the KeyInfo structure to all temporary tables. + // + // This section is run by the right-most SELECT statement only. + // SELECT statements to the left always skip this part. The right-most + // SELECT might also skip this part if it has no ORDER BY clause and + // no temp tables are required. + if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_UsesEphemeral)) != 0) { + goto __31 + } // Number of columns in result set + + nCol = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr + pKeyInfo = Xsqlite3KeyInfoAlloc(tls, db, nCol, 1) + if !(!(pKeyInfo != 0)) { + goto __32 + } + rc = SQLITE_NOMEM + goto multi_select_end +__32: + ; + i = 0 + apColl = pKeyInfo + 32 /* &.aColl */ +__33: + if !(i < nCol) { + goto __35 + } + *(*uintptr)(unsafe.Pointer(apColl)) = multiSelectCollSeq(tls, pParse, p, i) + if !(uintptr(0) == *(*uintptr)(unsafe.Pointer(apColl))) { + goto __36 + } + *(*uintptr)(unsafe.Pointer(apColl)) = (*Sqlite3)(unsafe.Pointer(db)).FpDfltColl +__36: + ; + goto __34 +__34: + i++ + apColl += 8 + goto __33 + goto __35 +__35: + ; + + pLoop = p +__37: + if !(pLoop != 0) { + goto __39 + } + i = 0 +__40: + if !(i < 2) { + goto __42 + } + addr3 = *(*int32)(unsafe.Pointer((pLoop + 20 /* &.addrOpenEphm */) + uintptr(i)*4)) + if !(addr3 < 0) { + goto __43 + } + // If [0] is unused then [1] is also unused. So we can + // always safely abort as soon as the first unused slot is found + + goto __42 +__43: + ; + Xsqlite3VdbeChangeP2(tls, v, addr3, nCol) + Xsqlite3VdbeChangeP4(tls, v, addr3, Xsqlite3KeyInfoRef(tls, pKeyInfo), + -9) + *(*int32)(unsafe.Pointer((pLoop + 20 /* &.addrOpenEphm */) + uintptr(i)*4)) = -1 + goto __41 +__41: + i++ + goto __40 + goto __42 +__42: + ; + goto __38 +__38: + pLoop = (*Select)(unsafe.Pointer(pLoop)).FpPrior + goto __37 + goto __39 +__39: + ; + Xsqlite3KeyInfoUnref(tls, pKeyInfo) +__31: + ; + +multi_select_end: + (*SelectDest)(unsafe.Pointer(pDest)).FiSdst = (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FiSdst + (*SelectDest)(unsafe.Pointer(pDest)).FnSdst = (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FnSdst + Xsqlite3SelectDelete(tls, db, pDelete) + return rc +} + +// Error message for when two or more terms of a compound select have different +// size result sets. +func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:135095:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+17365 /* "all VALUES must ..." */, 0) + } else { + Xsqlite3ErrorMsg(tls, pParse, + ts+17411, /* "SELECTs to the l..." */ + libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + } +} + +// Code an output subroutine for a coroutine implementation of a +// SELECT statment. +// +// The data to be output is contained in pIn->iSdst. There are +// pIn->nSdst columns to be output. pDest is where the output should +// be sent. +// +// regReturn is the number of the register holding the subroutine +// return address. +// +// If regPrev>0 then it is the first register in a vector that +// records the previous output. mem[regPrev] is a flag that is false +// if there has been no previous output. If regPrev>0 then code is +// generated to suppress duplicates. pKeyInfo is used for comparing +// keys. +// +// If the LIMIT found in p->iLimit is reached, jump immediately to +// iBreak. +func generateOutputSubroutine(tls *libc.TLS, pParse uintptr, p uintptr, pIn uintptr, pDest uintptr, regReturn int32, regPrev int32, pKeyInfo uintptr, iBreak int32) int32 { /* sqlite3.c:135125:12: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var iContinue int32 + var addr int32 + + addr = Xsqlite3VdbeCurrentAddr(tls, v) + iContinue = Xsqlite3VdbeMakeLabel(tls, pParse) + + // Suppress duplicates for UNION, EXCEPT, and INTERSECT + if regPrev != 0 { + var addr1 int32 + var addr2 int32 + addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regPrev) + addr2 = Xsqlite3VdbeAddOp4(tls, v, OP_Compare, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (regPrev + 1), (*SelectDest)(unsafe.Pointer(pIn)).FnSdst, + Xsqlite3KeyInfoRef(tls, pKeyInfo), -9) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, (addr2 + 2), iContinue, (addr2 + 2)) + Xsqlite3VdbeJumpHere(tls, v, addr1) + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (regPrev + 1), ((*SelectDest)(unsafe.Pointer(pIn)).FnSdst - 1)) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, regPrev) + } + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return 0 + } + + // Suppress the first OFFSET entries if there is an OFFSET clause + codeOffset(tls, v, (*Select)(unsafe.Pointer(p)).FiOffset, iContinue) + + switch int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest) { + // Store the result as data using a unique key. + case SRT_EphemTab: + { + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + var r2 int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst, r1) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm, r2) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm, r1, r2) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) + Xsqlite3ReleaseTempReg(tls, pParse, r2) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + break + + } + + // If we are creating a set for an "expr IN (SELECT ...)". + case SRT_Set: + { + var r1 int32 + + r1 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst, + r1, (*SelectDest)(unsafe.Pointer(pDest)).FzAffSdst, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm, r1, + (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + break + + } + + // If this is a scalar select that is part of an expression, then + // store the results in the appropriate memory cell and break out + // of the scan loop. Note that the select might return multiple columns + // if it is the RHS of a row-value IN operator. + case SRT_Mem: + { + + Xsqlite3ExprCodeMove(tls, pParse, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst) + // The LIMIT clause will jump out of the loop for us + break + + } + + // The results are stored in a sequence of registers + // starting at pDest->iSdst. Then the co-routine yields. + case SRT_Coroutine: + { + if (*SelectDest)(unsafe.Pointer(pDest)).FiSdst == 0 { + (*SelectDest)(unsafe.Pointer(pDest)).FiSdst = Xsqlite3GetTempRange(tls, pParse, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst) + (*SelectDest)(unsafe.Pointer(pDest)).FnSdst = (*SelectDest)(unsafe.Pointer(pIn)).FnSdst + } + Xsqlite3ExprCodeMove(tls, pParse, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (*SelectDest)(unsafe.Pointer(pDest)).FiSdst, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst) + Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm) + break + + } + + // If none of the above, then the result destination must be + // SRT_Output. This routine is never called with any other + // destination other than the ones handled above or SRT_Output. + // + // For SRT_Output, results are stored in a sequence of registers. + // Then the OP_ResultRow opcode is used to cause sqlite3_step() to + // return the next row of result. + default: + { + + Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, (*SelectDest)(unsafe.Pointer(pIn)).FiSdst, (*SelectDest)(unsafe.Pointer(pIn)).FnSdst) + break + + } + } + + // Jump to the end of the loop if the LIMIT is reached. + if (*Select)(unsafe.Pointer(p)).FiLimit != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_DecrJumpZero, (*Select)(unsafe.Pointer(p)).FiLimit, iBreak) + } + + // Generate the subroutine return + Xsqlite3VdbeResolveLabel(tls, v, iContinue) + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regReturn) + + return addr +} + +// Alternative compound select code generator for cases when there +// is an ORDER BY clause. +// +// We assume a query of the following form: +// +// ORDER BY +// +// is one of UNION ALL, UNION, EXCEPT, or INTERSECT. The idea +// is to code both and with the ORDER BY clause as +// co-routines. Then run the co-routines in parallel and merge the results +// into the output. In addition to the two coroutines (called selectA and +// selectB) there are 7 subroutines: +// +// outA: Move the output of the selectA coroutine into the output +// of the compound query. +// +// outB: Move the output of the selectB coroutine into the output +// of the compound query. (Only generated for UNION and +// UNION ALL. EXCEPT and INSERTSECT never output a row that +// appears only in B.) +// +// AltB: Called when there is data from both coroutines and AB. +// +// EofA: Called when data is exhausted from selectA. +// +// EofB: Called when data is exhausted from selectB. +// +// The implementation of the latter five subroutines depend on which +// is used: +// +// +// UNION ALL UNION EXCEPT INTERSECT +// ------------- ----------------- -------------- ----------------- +// AltB: outA, nextA outA, nextA outA, nextA nextA +// +// AeqB: outA, nextA nextA nextA outA, nextA +// +// AgtB: outB, nextB outB, nextB nextB nextB +// +// EofA: outB, nextB outB, nextB halt halt +// +// EofB: outA, nextA outA, nextA outA, nextA halt +// +// In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA +// causes an immediate jump to EofA and an EOF on B following nextB causes +// an immediate jump to EofB. Within EofA and EofB, and EOF on entry or +// following nextX causes a jump to the end of the select processing. +// +// Duplicate removal in the UNION, EXCEPT, and INTERSECT cases is handled +// within the output subroutine. The regPrev register set holds the previously +// output value. A comparison is made against this value and the output +// is skipped if the next results would be the same as the previous. +// +// The implementation plan is to implement the two coroutines and seven +// subroutines first, then put the control logic at the bottom. Like this: +// +// goto Init +// coA: coroutine for left query (A) +// coB: coroutine for right query (B) +// outA: output one row of A +// outB: output one row of B (UNION and UNION ALL only) +// EofA: ... +// EofB: ... +// AltB: ... +// AeqB: ... +// AgtB: ... +// Init: initialize coroutine registers +// yield coA +// if eof(A) goto EofA +// yield coB +// if eof(B) goto EofB +// Cmpr: Compare A, B +// Jump AltB, AeqB, AgtB +// End: ... +// +// We call AltB, AeqB, AgtB, EofA, and EofB "subroutines" but they are not +// actually called using Gosub and they do not Return. EofA and EofB loop +// until all data is exhausted then jump to the "end" labe. AltB, AeqB, +// and AgtB jump to either L2 or to one of EofA or EofB. +func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:135333:12: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + var i int32 + var j int32 // Loop counters + var pPrior uintptr // Another SELECT immediately to our left + var v uintptr // Generate code to this VDBE + // var destA SelectDest at bp+8, 40 + // Destination for coroutine A + // var destB SelectDest at bp+48, 40 + // Destination for coroutine B + var regAddrA int32 // Address register for select-A coroutine + var regAddrB int32 // Address register for select-B coroutine + var addrSelectA int32 // Address of the select-A coroutine + var addrSelectB int32 // Address of the select-B coroutine + var regOutA int32 // Address register for the output-A subroutine + var regOutB int32 // Address register for the output-B subroutine + var addrOutA int32 // Address of the output-A subroutine + var addrOutB int32 = 0 // Address of the output-B subroutine + var addrEofA int32 // Address of the select-A-exhausted subroutine + var addrEofA_noB int32 // Alternate addrEofA if B is uninitialized + var addrEofB int32 // Address of the select-B-exhausted subroutine + var addrAltB int32 // Address of the AB subroutine + var regLimitA int32 // Limit register for select-A + var regLimitB int32 // Limit register for select-A + var regPrev int32 // A range of registers to hold previous output + var savedLimit int32 // Saved value of p->iLimit + var savedOffset int32 // Saved value of p->iOffset + var labelCmpr int32 // Label for the start of the merge algorithm + var labelEnd int32 // Label for the end of the overall SELECT stmt + var addr1 int32 // Jump instructions that get retargetted + var op int32 // One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT + var pKeyDup uintptr = uintptr(0) // Comparison information for duplicate removal + var pKeyMerge uintptr // Comparison information for merging rows + var db uintptr // Database connection + var pOrderBy uintptr // The ORDER BY clause + var nOrderBy int32 // Number of terms in the ORDER BY clause + var aPermute uintptr // Mapping from ORDER BY terms to result set columns + + // "Managed" code needs this. Ticket #3382. + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + // Already thrown the error if VDBE alloc failed + labelEnd = Xsqlite3VdbeMakeLabel(tls, pParse) + labelCmpr = Xsqlite3VdbeMakeLabel(tls, pParse) + + // Patch up the ORDER BY clause + op = int32((*Select)(unsafe.Pointer(p)).Fop) + pPrior = (*Select)(unsafe.Pointer(p)).FpPrior + + pOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy + + nOrderBy = (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr + + // For operators other than UNION ALL we have to make sure that + // the ORDER BY clause covers every term of the result set. Add + // terms to the ORDER BY clause as necessary. + if op != TK_ALL { + for i = 1; (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && (i <= (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr); i++ { + var pItem uintptr + j = 0 + pItem = pOrderBy + 8 /* &.a */ + __1: + if !(j < nOrderBy) { + goto __3 + } + { + + if int32(*(*U16)(unsafe.Pointer((pItem + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) == i { + goto __3 + } + + } + goto __2 + __2: + j++ + pItem += 32 + goto __1 + goto __3 + __3: + ; + if j == nOrderBy { + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, uintptr(0)) + if pNew == uintptr(0) { + return SQLITE_NOMEM + } + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_IntValue)) + *(*int32)(unsafe.Pointer(pNew + 8 /* &.u */)) = i + (*Select)(unsafe.Pointer(p)).FpOrderBy = libc.AssignUintptr(&pOrderBy, Xsqlite3ExprListAppend(tls, pParse, pOrderBy, pNew)) + if pOrderBy != 0 { + *(*U16)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(libc.PostIncInt32(&nOrderBy, 1))*32 + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(i) + } + } + } + } + + // Compute the comparison permutation and keyinfo that is used with + // the permutation used to determine if the next + // row of results comes from selectA or selectB. Also add explicit + // collations to the ORDER BY clause terms so that when the subqueries + // to the right and the left are evaluated, they use the correct + // collation. + aPermute = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(U32(0))) * (uint64(nOrderBy + 1))))) + if aPermute != 0 { + var pItem uintptr + *(*U32)(unsafe.Pointer(aPermute)) = U32(nOrderBy) + i = 1 + pItem = pOrderBy + 8 /* &.a */ + __4: + if !(i <= nOrderBy) { + goto __6 + } + { + + *(*U32)(unsafe.Pointer(aPermute + uintptr(i)*4)) = (U32(int32(*(*U16)(unsafe.Pointer((pItem + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) - 1)) + + } + goto __5 + __5: + i++ + pItem += 32 + goto __4 + goto __6 + __6: + ; + pKeyMerge = multiSelectOrderByKeyInfo(tls, pParse, p, 1) + } else { + pKeyMerge = uintptr(0) + } + + // Reattach the ORDER BY clause to the query. + (*Select)(unsafe.Pointer(p)).FpOrderBy = pOrderBy + (*Select)(unsafe.Pointer(pPrior)).FpOrderBy = Xsqlite3ExprListDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pOrderBy, 0) + + // Allocate a range of temporary registers and the KeyInfo needed + // for the logic that removes duplicate result rows when the + // operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL). + if op == TK_ALL { + regPrev = 0 + } else { + var nExpr int32 = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr + + regPrev = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nExpr + 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regPrev) + pKeyDup = Xsqlite3KeyInfoAlloc(tls, db, nExpr, 1) + if pKeyDup != 0 { + + for i = 0; i < nExpr; i++ { + *(*uintptr)(unsafe.Pointer((pKeyDup + 32 /* &.aColl */) + uintptr(i)*8)) = multiSelectCollSeq(tls, pParse, p, i) + *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyDup)).FaSortFlags + uintptr(i))) = U8(0) + } + } + } + + // Separate the left and the right query from one another + (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6252 /* "ORDER" */) + if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6252 /* "ORDER" */) + } + + // Compute the limit registers + computeLimitRegisters(tls, pParse, p, labelEnd) + if ((*Select)(unsafe.Pointer(p)).FiLimit != 0) && (op == TK_ALL) { + regLimitA = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regLimitB = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, func() int32 { + if (*Select)(unsafe.Pointer(p)).FiOffset != 0 { + return ((*Select)(unsafe.Pointer(p)).FiOffset + 1) + } + return (*Select)(unsafe.Pointer(p)).FiLimit + }(), + regLimitA) + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, regLimitA, regLimitB) + } else { + regLimitA = libc.AssignInt32(®LimitB, 0) + } + Xsqlite3ExprDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpLimit) + (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) + + regAddrA = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regAddrB = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regOutA = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regOutB = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) + Xsqlite3SelectDestInit(tls, bp+48 /* &destB */, SRT_Coroutine, regAddrB) + + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17493 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + + // Generate a coroutine to evaluate the SELECT statement to the + // left of the compound operator - the "A" select. + addrSelectA = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) + addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) + + (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17504 /* "LEFT" */, 0) + Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) + Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) + Xsqlite3VdbeJumpHere(tls, v, addr1) + + // Generate a coroutine to evaluate the SELECT statement on + // the right - the "B" select + addrSelectB = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) + addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrB, 0, addrSelectB) + + savedLimit = (*Select)(unsafe.Pointer(p)).FiLimit + savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset + (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB + (*Select)(unsafe.Pointer(p)).FiOffset = 0 + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17509 /* "RIGHT" */, 0) + Xsqlite3Select(tls, pParse, p, bp+48 /* &destB */) + (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit + (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset + Xsqlite3VdbeEndCoroutine(tls, v, regAddrB) + + // Generate a subroutine that outputs the current row of the A + // select as the next output row of the compound select. + + addrOutA = generateOutputSubroutine(tls, pParse, + p, bp+8 /* &destA */, pDest, regOutA, + regPrev, pKeyDup, labelEnd) + + // Generate a subroutine that outputs the current row of the B + // select as the next output row of the compound select. + if (op == TK_ALL) || (op == TK_UNION) { + + addrOutB = generateOutputSubroutine(tls, pParse, + p, bp+48 /* &destB */, pDest, regOutB, + regPrev, pKeyDup, labelEnd) + } + Xsqlite3KeyInfoUnref(tls, pKeyDup) + + // Generate a subroutine to run when the results from select A + // are exhausted and only data in select B remains. + if (op == TK_EXCEPT) || (op == TK_INTERSECT) { + addrEofA_noB = libc.AssignInt32(&addrEofA, labelEnd) + } else { + + addrEofA = Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regOutB, addrOutB) + addrEofA_noB = Xsqlite3VdbeAddOp2(tls, v, OP_Yield, regAddrB, labelEnd) + + Xsqlite3VdbeGoto(tls, v, addrEofA) + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEstAdd(tls, (*Select)(unsafe.Pointer(p)).FnSelectRow, (*Select)(unsafe.Pointer(pPrior)).FnSelectRow) + } + + // Generate a subroutine to run when the results from select B + // are exhausted and only data in select A remains. + if op == TK_INTERSECT { + addrEofB = addrEofA + if int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > int32((*Select)(unsafe.Pointer(pPrior)).FnSelectRow) { + (*Select)(unsafe.Pointer(p)).FnSelectRow = (*Select)(unsafe.Pointer(pPrior)).FnSelectRow + } + } else { + + addrEofB = Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regOutA, addrOutA) + Xsqlite3VdbeAddOp2(tls, v, OP_Yield, regAddrA, labelEnd) + Xsqlite3VdbeGoto(tls, v, addrEofB) + } + + // Generate code to handle the case of AB + + addrAgtB = Xsqlite3VdbeCurrentAddr(tls, v) + if (op == TK_ALL) || (op == TK_UNION) { + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regOutB, addrOutB) + } + Xsqlite3VdbeAddOp2(tls, v, OP_Yield, regAddrB, addrEofB) + Xsqlite3VdbeGoto(tls, v, labelCmpr) + + // This code runs once to initialize everything. + Xsqlite3VdbeJumpHere(tls, v, addr1) + Xsqlite3VdbeAddOp2(tls, v, OP_Yield, regAddrA, addrEofA_noB) + Xsqlite3VdbeAddOp2(tls, v, OP_Yield, regAddrB, addrEofB) + + // Implement the main merge loop + Xsqlite3VdbeResolveLabel(tls, v, labelCmpr) + Xsqlite3VdbeAddOp4(tls, v, OP_Permutation, 0, 0, 0, aPermute, -15) + Xsqlite3VdbeAddOp4(tls, v, OP_Compare, (*SelectDest)(unsafe.Pointer(bp+8 /* &destA */)).FiSdst, (*SelectDest)(unsafe.Pointer(bp+48 /* &destB */)).FiSdst, nOrderBy, + pKeyMerge, -9) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_PERMUTE)) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, addrAltB, addrAeqB, addrAgtB) + + // Jump to the this point in order to terminate the query. + Xsqlite3VdbeResolveLabel(tls, v, labelEnd) + + // Reassembly the compound query so that it will be freed correctly + // by the calling function + if (*Select)(unsafe.Pointer(p)).FpPrior != 0 { + Xsqlite3SelectDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpPrior) + } + (*Select)(unsafe.Pointer(p)).FpPrior = pPrior + (*Select)(unsafe.Pointer(pPrior)).FpNext = p + + Xsqlite3ExprListDelete(tls, db, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy) + (*Select)(unsafe.Pointer(pPrior)).FpOrderBy = uintptr(0) + + // ** TBD: Insert subroutine calls to close cursors on incomplete + // subqueries *** + Xsqlite3VdbeExplainPop(tls, pParse) + return (libc.Bool32((*Parse)(unsafe.Pointer(pParse)).FnErr != 0)) +} + +// An instance of the SubstContext object describes an substitution edit +// to be performed on a parse tree. +// +// All references to columns in table iTable are to be replaced by corresponding +// expressions in pEList. +type SubstContext1 = struct { + FpParse uintptr + FiTable int32 + FiNewTable int32 + FisLeftJoin int32 + _ [4]byte + FpEList uintptr +} /* sqlite3.c:135643:9 */ + +// An instance of the SubstContext object describes an substitution edit +// to be performed on a parse tree. +// +// All references to columns in table iTable are to be replaced by corresponding +// expressions in pEList. +type SubstContext = SubstContext1 /* sqlite3.c:135649:3 */ + +// Scan through the expression pExpr. Replace every reference to +// a column in table number iTable with a copy of the iColumn-th +// entry in pEList. (But leave references to the ROWID column +// unchanged.) +// +// This routine is part of the flattening procedure. A subquery +// whose result set is defined by pEList appears as entry in the +// FROM clause of a SELECT such that the VDBE cursor assigned to that +// FORM clause entry is iTable. This routine makes the necessary +// changes to pExpr so that it refers directly to the source table +// of the subquery rather the result set of the subquery. +func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite3.c:135668:13: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + if pExpr == uintptr(0) { + return uintptr(0) + } + if (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) && + ((*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable == (*SubstContext)(unsafe.Pointer(pSubst)).FiTable) { + (*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable = (*SubstContext)(unsafe.Pointer(pSubst)).FiNewTable + } + if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) && + ((*Expr)(unsafe.Pointer(pExpr)).FiTable == (*SubstContext)(unsafe.Pointer(pSubst)).FiTable)) && + !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FixedCol))) != U32(0)) { + { + var pNew uintptr + var pCopy uintptr = (*ExprList_item)(unsafe.Pointer(((*SubstContext)(unsafe.Pointer(pSubst)).FpEList + 8 /* &.a */) + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiColumn)*32)).FpExpr + // var ifNullRow Expr at bp, 72 + + if Xsqlite3ExprIsVector(tls, pCopy) != 0 { + Xsqlite3VectorErrorMsg(tls, (*SubstContext)(unsafe.Pointer(pSubst)).FpParse, pCopy) + } else { + var db uintptr = (*Parse)(unsafe.Pointer((*SubstContext)(unsafe.Pointer(pSubst)).FpParse)).Fdb + if ((*SubstContext)(unsafe.Pointer(pSubst)).FisLeftJoin != 0) && (int32((*Expr)(unsafe.Pointer(pCopy)).Fop) != TK_COLUMN) { + libc.Xmemset(tls, bp /* &ifNullRow */, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(bp /* &ifNullRow */)).Fop = U8(TK_IF_NULL_ROW) + (*Expr)(unsafe.Pointer(bp /* &ifNullRow */)).FpLeft = pCopy + (*Expr)(unsafe.Pointer(bp /* &ifNullRow */)).FiTable = (*SubstContext)(unsafe.Pointer(pSubst)).FiNewTable + (*Expr)(unsafe.Pointer(bp /* &ifNullRow */)).Fflags = U32(EP_IfNullRow) + pCopy = bp /* &ifNullRow */ + } + + pNew = Xsqlite3ExprDup(tls, db, pCopy, 0) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3ExprDelete(tls, db, pNew) + return pExpr + } + if (*SubstContext)(unsafe.Pointer(pSubst)).FisLeftJoin != 0 { + *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_CanBeNull)) + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0) { + Xsqlite3SetJoinExpr(tls, pNew, (*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable) + } + Xsqlite3ExprDelete(tls, db, pExpr) + pExpr = pNew + + // Ensure that the expression now has an implicit collation sequence, + // just as it did when it was a column of a view or sub-query. + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLUMN) && (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLLATE) { + var pColl uintptr = Xsqlite3ExprCollSeq(tls, (*SubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr) + pExpr = Xsqlite3ExprAddCollateString(tls, (*SubstContext)(unsafe.Pointer(pSubst)).FpParse, pExpr, + func() uintptr { + if pColl != 0 { + return (*CollSeq)(unsafe.Pointer(pColl)).FzName + } + return ts + 319 /* "BINARY" */ + }()) + } + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) + } + + } + } else { + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_IF_NULL_ROW) && ((*Expr)(unsafe.Pointer(pExpr)).FiTable == (*SubstContext)(unsafe.Pointer(pSubst)).FiTable) { + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (*SubstContext)(unsafe.Pointer(pSubst)).FiNewTable + } + (*Expr)(unsafe.Pointer(pExpr)).FpLeft = substExpr(tls, pSubst, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + (*Expr)(unsafe.Pointer(pExpr)).FpRight = substExpr(tls, pSubst, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + substSelect(tls, pSubst, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)), 1) + } else { + substExprList(tls, pSubst, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + var pWin uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + (*Window)(unsafe.Pointer(pWin)).FpFilter = substExpr(tls, pSubst, (*Window)(unsafe.Pointer(pWin)).FpFilter) + substExprList(tls, pSubst, (*Window)(unsafe.Pointer(pWin)).FpPartition) + substExprList(tls, pSubst, (*Window)(unsafe.Pointer(pWin)).FpOrderBy) + } + } + return pExpr +} + +func substExprList(tls *libc.TLS, pSubst uintptr, pList uintptr) { /* sqlite3.c:135753:13: */ + var i int32 + if pList == uintptr(0) { + return + } + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FpExpr = substExpr(tls, pSubst, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + } +} + +func substSelect(tls *libc.TLS, pSubst uintptr, p uintptr, doPrior int32) { /* sqlite3.c:135763:13: */ + var pSrc uintptr + var pItem uintptr + var i int32 + if !(p != 0) { + return + } + for ok := true; ok; ok = ((doPrior != 0) && ((libc.AssignUintptr(&p, (*Select)(unsafe.Pointer(p)).FpPrior)) != uintptr(0))) { + substExprList(tls, pSubst, (*Select)(unsafe.Pointer(p)).FpEList) + substExprList(tls, pSubst, (*Select)(unsafe.Pointer(p)).FpGroupBy) + substExprList(tls, pSubst, (*Select)(unsafe.Pointer(p)).FpOrderBy) + (*Select)(unsafe.Pointer(p)).FpHaving = substExpr(tls, pSubst, (*Select)(unsafe.Pointer(p)).FpHaving) + (*Select)(unsafe.Pointer(p)).FpWhere = substExpr(tls, pSubst, (*Select)(unsafe.Pointer(p)).FpWhere) + pSrc = (*Select)(unsafe.Pointer(p)).FpSrc + + i = (*SrcList)(unsafe.Pointer(pSrc)).FnSrc + pItem = pSrc + 8 /* &.a */ + __1: + if !(i > 0) { + goto __3 + } + { + substSelect(tls, pSubst, (*SrcItem)(unsafe.Pointer(pItem)).FpSelect, 1) + if (uint32(int32(*(*uint16)(unsafe.Pointer(pItem + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { + substExprList(tls, pSubst, *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */))) + } + + } + goto __2 + __2: + i-- + pItem += 112 + goto __1 + goto __3 + __3: + } +} + +// pSelect is a SELECT statement and pSrcItem is one item in the FROM +// clause of that SELECT. +// +// This routine scans the entire SELECT statement and recomputes the +// pSrcItem->colUsed mask. +func recomputeColumnsUsedExpr(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:135798:12: */ + var pItem uintptr + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLUMN { + return WRC_Continue + } + pItem = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + if (*SrcItem)(unsafe.Pointer(pItem)).FiCursor != (*Expr)(unsafe.Pointer(pExpr)).FiTable { + return WRC_Continue + } + if int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) < 0 { + return WRC_Continue + } + *(*Bitmask)(unsafe.Pointer(pItem + 88 /* &.colUsed */)) |= (Xsqlite3ExprColUsed(tls, pExpr)) + return WRC_Continue +} + +func recomputeColumnsUsed(tls *libc.TLS, pSelect uintptr, pSrcItem uintptr) { /* sqlite3.c:135807:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + if (*SrcItem)(unsafe.Pointer(pSrcItem)).FpTab == uintptr(0) { + return + } + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{recomputeColumnsUsedExpr})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkNoop})) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = pSrcItem + (*SrcItem)(unsafe.Pointer(pSrcItem)).FcolUsed = uint64(0) + Xsqlite3WalkSelect(tls, bp /* &w */, pSelect) +} + +// Assign new cursor numbers to each of the items in pSrc. For each +// new cursor number assigned, set an entry in the aCsrMap[] array +// to map the old cursor number to the new: +// +// aCsrMap[iOld] = iNew; +// +// The array is guaranteed by the caller to be large enough for all +// existing cursor numbers in pSrc. +// +// If pSrc contains any sub-selects, call this routine recursively +// on the FROM clause of each such sub-select, with iExcept set to -1. +func srclistRenumberCursors(tls *libc.TLS, pParse uintptr, aCsrMap uintptr, pSrc uintptr, iExcept int32) { /* sqlite3.c:135836:13: */ + var i int32 + var pItem uintptr + i = 0 + pItem = pSrc + 8 /* &.a */ +__1: + if !(i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc) { + goto __3 + } + { + if i != iExcept { + var p uintptr + if !((int32(*(*uint16)(unsafe.Pointer(pItem + 60 /* &.fg */ + 4 /* &.isRecursive */)) & 0x20 >> 5)) != 0) || (*(*int32)(unsafe.Pointer(aCsrMap + uintptr((*SrcItem)(unsafe.Pointer(pItem)).FiCursor)*4)) == 0) { + *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*SrcItem)(unsafe.Pointer(pItem)).FiCursor)*4)) = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + } + (*SrcItem)(unsafe.Pointer(pItem)).FiCursor = *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*SrcItem)(unsafe.Pointer(pItem)).FiCursor)*4)) + for p = (*SrcItem)(unsafe.Pointer(pItem)).FpSelect; p != 0; p = (*Select)(unsafe.Pointer(p)).FpPrior { + srclistRenumberCursors(tls, pParse, aCsrMap, (*Select)(unsafe.Pointer(p)).FpSrc, -1) + } + } + + } + goto __2 +__2: + i++ + pItem += 112 + goto __1 + goto __3 +__3: +} + +// Expression walker callback used by renumberCursors() to update +// Expr objects to match newly assigned cursor numbers. +func renumberCursorsCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:135862:12: */ + var aCsrMap uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var op int32 = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) + if ((op == TK_COLUMN) || (op == TK_IF_NULL_ROW)) && (*(*int32)(unsafe.Pointer(aCsrMap + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiTable)*4)) != 0) { + (*Expr)(unsafe.Pointer(pExpr)).FiTable = *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiTable)*4)) + } + if (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) && (*(*int32)(unsafe.Pointer(aCsrMap + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable)*4)) != 0) { + (*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable = *(*int32)(unsafe.Pointer(aCsrMap + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable)*4)) + } + return WRC_Continue +} + +// Assign a new cursor number to each cursor in the FROM clause (Select.pSrc) +// of the SELECT statement passed as the second argument, and to each +// cursor in the FROM clause of any FROM clause sub-selects, recursively. +// Except, do not assign a new cursor number to the iExcept'th element in +// the FROM clause of (*p). Update all expressions and other references +// to refer to the new cursor numbers. +// +// Argument aCsrMap is an array that may be used for temporary working +// space. Two guarantees are made by the caller: +// +// * the array is larger than the largest cursor number used within the +// select statement passed as an argument, and +// +// * the array entries for all cursor numbers that do *not* appear in +// FROM clauses of the select statement as described above are +// initialized to zero. +func renumberCursors(tls *libc.TLS, pParse uintptr, p uintptr, iExcept int32, aCsrMap uintptr) { /* sqlite3.c:135892:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + srclistRenumberCursors(tls, pParse, aCsrMap, (*Select)(unsafe.Pointer(p)).FpSrc, iExcept) + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = aCsrMap + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{renumberCursorsCb})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkNoop})) + Xsqlite3WalkSelect(tls, bp /* &w */, p) +} + +// This routine attempts to flatten subqueries as a performance optimization. +// This routine returns 1 if it makes changes and 0 if no flattening occurs. +// +// To understand the concept of flattening, consider the following +// query: +// +// SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5 +// +// The default way of implementing this query is to execute the +// subquery first and store the results in a temporary table, then +// run the outer query on that temporary table. This requires two +// passes over the data. Furthermore, because the temporary table +// has no indices, the WHERE clause on the outer query cannot be +// optimized. +// +// This routine attempts to rewrite queries such as the above into +// a single flat select, like this: +// +// SELECT x+y AS a FROM t1 WHERE z<100 AND a>5 +// +// The code generated for this simplification gives the same result +// but only has to scan the data once. And because indices might +// exist on the table t1, a complete scan of the data might be +// avoided. +// +// Flattening is subject to the following constraints: +// +// (**) We no longer attempt to flatten aggregate subqueries. Was: +// The subquery and the outer query cannot both be aggregates. +// +// (**) We no longer attempt to flatten aggregate subqueries. Was: +// (2) If the subquery is an aggregate then +// (2a) the outer query must not be a join and +// (2b) the outer query must not use subqueries +// other than the one FROM-clause subquery that is a candidate +// for flattening. (This is due to ticket [2f7170d73bf9abf80] +// from 2015-02-09.) +// +// (3) If the subquery is the right operand of a LEFT JOIN then +// (3a) the subquery may not be a join and +// (3b) the FROM clause of the subquery may not contain a virtual +// table and +// (3c) the outer query may not be an aggregate. +// (3d) the outer query may not be DISTINCT. +// +// (4) The subquery can not be DISTINCT. +// +// (**) At one point restrictions (4) and (5) defined a subset of DISTINCT +// sub-queries that were excluded from this optimization. Restriction +// (4) has since been expanded to exclude all DISTINCT subqueries. +// +// (**) We no longer attempt to flatten aggregate subqueries. Was: +// If the subquery is aggregate, the outer query may not be DISTINCT. +// +// (7) The subquery must have a FROM clause. TODO: For subqueries without +// A FROM clause, consider adding a FROM clause with the special +// table sqlite_once that consists of a single row containing a +// single NULL. +// +// (8) If the subquery uses LIMIT then the outer query may not be a join. +// +// (9) If the subquery uses LIMIT then the outer query may not be aggregate. +// +// (**) Restriction (10) was removed from the code on 2005-02-05 but we +// accidently carried the comment forward until 2014-09-15. Original +// constraint: "If the subquery is aggregate then the outer query +// may not use LIMIT." +// +// (11) The subquery and the outer query may not both have ORDER BY clauses. +// +// (**) Not implemented. Subsumed into restriction (3). Was previously +// a separate restriction deriving from ticket #350. +// +// (13) The subquery and outer query may not both use LIMIT. +// +// (14) The subquery may not use OFFSET. +// +// (15) If the outer query is part of a compound select, then the +// subquery may not use LIMIT. +// (See ticket #2339 and ticket [02a8e81d44]). +// +// (16) If the outer query is aggregate, then the subquery may not +// use ORDER BY. (Ticket #2942) This used to not matter +// until we introduced the group_concat() function. +// +// (17) If the subquery is a compound select, then +// (17a) all compound operators must be a UNION ALL, and +// (17b) no terms within the subquery compound may be aggregate +// or DISTINCT, and +// (17c) every term within the subquery compound must have a FROM clause +// (17d) the outer query may not be +// (17d1) aggregate, or +// (17d2) DISTINCT +// (17e) the subquery may not contain window functions, and +// (17f) the subquery must not be the RHS of a LEFT JOIN. +// +// The parent and sub-query may contain WHERE clauses. Subject to +// rules (11), (13) and (14), they may also contain ORDER BY, +// LIMIT and OFFSET clauses. The subquery cannot use any compound +// operator other than UNION ALL because all the other compound +// operators have an implied DISTINCT which is disallowed by +// restriction (4). +// +// Also, each component of the sub-query must return the same number +// of result columns. This is actually a requirement for any compound +// SELECT statement, but all the code here does is make sure that no +// such (illegal) sub-query is flattened. The caller will detect the +// syntax error and return a detailed message. +// +// (18) If the sub-query is a compound select, then all terms of the +// ORDER BY clause of the parent must be copies of a term returned +// by the parent query. +// +// (19) If the subquery uses LIMIT then the outer query may not +// have a WHERE clause. +// +// (20) If the sub-query is a compound select, then it must not use +// an ORDER BY clause. Ticket #3773. We could relax this constraint +// somewhat by saying that the terms of the ORDER BY clause must +// appear as unmodified result columns in the outer query. But we +// have other optimizations in mind to deal with that case. +// +// (21) If the subquery uses LIMIT then the outer query may not be +// DISTINCT. (See ticket [752e1646fc]). +// +// (22) The subquery may not be a recursive CTE. +// +// (23) If the outer query is a recursive CTE, then the sub-query may not be +// a compound query. This restriction is because transforming the +// parent to a compound query confuses the code that handles +// recursive queries in multiSelect(). +// +// (**) We no longer attempt to flatten aggregate subqueries. Was: +// The subquery may not be an aggregate that uses the built-in min() or +// or max() functions. (Without this restriction, a query like: +// "SELECT x FROM (SELECT max(y), x FROM t1)" would not necessarily +// return the value X for which Y was maximal.) +// +// (25) If either the subquery or the parent query contains a window +// function in the select list or ORDER BY clause, flattening +// is not attempted. +// +// +// In this routine, the "p" parameter is a pointer to the outer query. +// The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query +// uses aggregates. +// +// If flattening is not attempted, this routine is a no-op and returns 0. +// If flattening is attempted this routine returns 1. +// +// All of the expression analysis must occur on both the outer query and +// the subquery before this routine runs. +func flattenSubquery(tls *libc.TLS, pParse uintptr, p uintptr, iFrom int32, isAgg int32) int32 { /* sqlite3.c:136063:12: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var zSavedAuthContext uintptr = (*Parse)(unsafe.Pointer(pParse)).FzAuthContext + var pParent uintptr // Current UNION ALL term of the other query + var pSub uintptr // The inner query or "subquery" + var pSub1 uintptr // Pointer to the rightmost select in sub-query + var pSrc uintptr // The FROM clause of the outer query + var pSubSrc uintptr // The FROM clause of the subquery + var iParent int32 // VDBE cursor number of the pSub result set temp table + var iNewParent int32 = -1 // Replacement table for iParent + var isLeftJoin int32 = 0 // True if pSub is the right side of a LEFT JOIN + var i int32 // Loop counter + var pWhere uintptr // The WHERE clause + var pSubitem uintptr // The subquery + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + // var w Walker at bp+32, 48 + // Walker to persist agginfo data + var aCsrMap uintptr = uintptr(0) + + // Check to see if flattening is permitted. Return 0 if not. + + if ((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_QueryFlattener))) != U32(0) { + return 0 + } + pSrc = (*Select)(unsafe.Pointer(p)).FpSrc + + pSubitem = ((pSrc + 8 /* &.a */) + uintptr(iFrom)*112) + iParent = (*SrcItem)(unsafe.Pointer(pSubitem)).FiCursor + pSub = (*SrcItem)(unsafe.Pointer(pSubitem)).FpSelect + + if ((*Select)(unsafe.Pointer(p)).FpWin != 0) || ((*Select)(unsafe.Pointer(pSub)).FpWin != 0) { + return 0 + } // Restriction (25) + + pSubSrc = (*Select)(unsafe.Pointer(pSub)).FpSrc + + // Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, + // not arbitrary expressions, we allowed some combining of LIMIT and OFFSET + // because they could be computed at compile-time. But when LIMIT and OFFSET + // became arbitrary expressions, we were forced to add restrictions (13) + // and (14). + if ((*Select)(unsafe.Pointer(pSub)).FpLimit != 0) && ((*Select)(unsafe.Pointer(p)).FpLimit != 0) { + return 0 + } // Restriction (13) + if ((*Select)(unsafe.Pointer(pSub)).FpLimit != 0) && ((*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpLimit)).FpRight != 0) { + return 0 + } // Restriction (14) + if (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Compound)) != U32(0)) && ((*Select)(unsafe.Pointer(pSub)).FpLimit != 0) { + return 0 // Restriction (15) + } + if (*SrcList)(unsafe.Pointer(pSubSrc)).FnSrc == 0 { + return 0 + } // Restriction (7) + if ((*Select)(unsafe.Pointer(pSub)).FselFlags & U32(SF_Distinct)) != 0 { + return 0 + } // Restriction (4) + if ((*Select)(unsafe.Pointer(pSub)).FpLimit != 0) && (((*SrcList)(unsafe.Pointer(pSrc)).FnSrc > 1) || (isAgg != 0)) { + return 0 // Restrictions (8)(9) + } + if ((*Select)(unsafe.Pointer(p)).FpOrderBy != 0) && ((*Select)(unsafe.Pointer(pSub)).FpOrderBy != 0) { + return 0 // Restriction (11) + } + if (isAgg != 0) && ((*Select)(unsafe.Pointer(pSub)).FpOrderBy != 0) { + return 0 + } // Restriction (16) + if ((*Select)(unsafe.Pointer(pSub)).FpLimit != 0) && ((*Select)(unsafe.Pointer(p)).FpWhere != 0) { + return 0 + } // Restriction (19) + if ((*Select)(unsafe.Pointer(pSub)).FpLimit != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != U32(0)) { + return 0 // Restriction (21) + } + if ((*Select)(unsafe.Pointer(pSub)).FselFlags & (U32(SF_Recursive))) != 0 { + return 0 // Restrictions (22) + } + + // If the subquery is the right operand of a LEFT JOIN, then the + // subquery may not be a join itself (3a). Example of why this is not + // allowed: + // + // t1 LEFT OUTER JOIN (t2 JOIN t3) + // + // If we flatten the above, we would get + // + // (t1 LEFT OUTER JOIN t2) JOIN t3 + // + // which is not at all the same thing. + // + // If the subquery is the right operand of a LEFT JOIN, then the outer + // query cannot be an aggregate. (3c) This is an artifact of the way + // aggregates are processed - there is no mechanism to determine if + // the LEFT JOIN table should be all-NULL. + // + // See also tickets #306, #350, and #3300. + if (int32((*SrcItem)(unsafe.Pointer(pSubitem)).Ffg.Fjointype) & JT_OUTER) != 0 { + isLeftJoin = 1 + if ((((*SrcList)(unsafe.Pointer(pSubSrc)).FnSrc > 1) || // (3a) + (isAgg != 0)) || // (3b) + ((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer((pSubSrc + 8 /* &.a */))).FpTab)).FnModuleArg != 0)) || // (3c) + (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != U32(0)) { + return 0 + } + } + + // Restriction (17): If the sub-query is a compound SELECT, then it must + // use only the UNION ALL operator. And none of the simple select queries + // that make up the compound SELECT are allowed to be aggregate or distinct + // queries. + if (*Select)(unsafe.Pointer(pSub)).FpPrior != 0 { + if (*Select)(unsafe.Pointer(pSub)).FpOrderBy != 0 { + return 0 // Restriction (20) + } + if ((isAgg != 0) || (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != U32(0))) || (isLeftJoin > 0) { + return 0 // (17d1), (17d2), or (17f) + } + for pSub1 = pSub; pSub1 != 0; pSub1 = (*Select)(unsafe.Pointer(pSub1)).FpPrior { + + if (((((*Select)(unsafe.Pointer(pSub1)).FselFlags & (U32(SF_Distinct | SF_Aggregate))) != U32(0)) || // (17b) + (((*Select)(unsafe.Pointer(pSub1)).FpPrior != 0) && (int32((*Select)(unsafe.Pointer(pSub1)).Fop) != TK_ALL))) || // (17a) + ((*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub1)).FpSrc)).FnSrc < 1)) || // (17c) + ((*Select)(unsafe.Pointer(pSub1)).FpWin != 0) { + return 0 + } + + } + + // Restriction (18). + if (*Select)(unsafe.Pointer(p)).FpOrderBy != 0 { + var ii int32 + for ii = 0; ii < (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpOrderBy)).FnExpr; ii++ { + if int32(*(*U16)(unsafe.Pointer((((*Select)(unsafe.Pointer(p)).FpOrderBy + 8 /* &.a */) + uintptr(ii)*32 + 24 /* &.u */ /* &.x */) /* &.iOrderByCol */))) == 0 { + return 0 + } + } + } + + // Restriction (23) + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Recursive)) != 0 { + return 0 + } + + if (*SrcList)(unsafe.Pointer(pSrc)).FnSrc > 1 { + if (*Parse)(unsafe.Pointer(pParse)).FnSelect > 500 { + return 0 + } + aCsrMap = Xsqlite3DbMallocZero(tls, db, (uint64(uint64((*Parse)(unsafe.Pointer(pParse)).FnTab) * uint64(unsafe.Sizeof(int32(0)))))) + } + } + + //**** If we reach this point, flattening is permitted. **** + + // Authorize the subquery + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = (*SrcItem)(unsafe.Pointer(pSubitem)).FzName + Xsqlite3AuthCheck(tls, pParse, SQLITE_SELECT, uintptr(0), uintptr(0), uintptr(0)) + + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext + + // Delete the transient structures associated with thesubquery + pSub1 = (*SrcItem)(unsafe.Pointer(pSubitem)).FpSelect + Xsqlite3DbFree(tls, db, (*SrcItem)(unsafe.Pointer(pSubitem)).FzDatabase) + Xsqlite3DbFree(tls, db, (*SrcItem)(unsafe.Pointer(pSubitem)).FzName) + Xsqlite3DbFree(tls, db, (*SrcItem)(unsafe.Pointer(pSubitem)).FzAlias) + (*SrcItem)(unsafe.Pointer(pSubitem)).FzDatabase = uintptr(0) + (*SrcItem)(unsafe.Pointer(pSubitem)).FzName = uintptr(0) + (*SrcItem)(unsafe.Pointer(pSubitem)).FzAlias = uintptr(0) + (*SrcItem)(unsafe.Pointer(pSubitem)).FpSelect = uintptr(0) + + // If the sub-query is a compound SELECT statement, then (by restrictions + // 17 and 18 above) it must be a UNION ALL and the parent query must + // be of the form: + // + // SELECT FROM () + // + // followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block + // creates N-1 copies of the parent query without any ORDER BY, LIMIT or + // OFFSET clauses and joins them to the left-hand-side of the original + // using UNION ALL operators. In this case N is the number of simple + // select statements in the compound sub-query. + // + // Example: + // + // SELECT a+1 FROM ( + // SELECT x FROM tab + // UNION ALL + // SELECT y FROM tab + // UNION ALL + // SELECT abs(z*2) FROM tab2 + // ) WHERE a!=5 ORDER BY 1 + // + // Transformed into: + // + // SELECT x+1 FROM tab WHERE x+1!=5 + // UNION ALL + // SELECT y+1 FROM tab WHERE y+1!=5 + // UNION ALL + // SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5 + // ORDER BY 1 + // + // We call this the "compound-subquery flattening". + for pSub = (*Select)(unsafe.Pointer(pSub)).FpPrior; pSub != 0; pSub = (*Select)(unsafe.Pointer(pSub)).FpPrior { + var pNew uintptr + var pOrderBy uintptr = (*Select)(unsafe.Pointer(p)).FpOrderBy + var pLimit uintptr = (*Select)(unsafe.Pointer(p)).FpLimit + var pPrior uintptr = (*Select)(unsafe.Pointer(p)).FpPrior + var pItemTab uintptr = (*SrcItem)(unsafe.Pointer(pSubitem)).FpTab + (*SrcItem)(unsafe.Pointer(pSubitem)).FpTab = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) + pNew = Xsqlite3SelectDup(tls, db, p, 0) + (*Select)(unsafe.Pointer(p)).FpLimit = pLimit + (*Select)(unsafe.Pointer(p)).FpOrderBy = pOrderBy + (*Select)(unsafe.Pointer(p)).Fop = U8(TK_ALL) + (*SrcItem)(unsafe.Pointer(pSubitem)).FpTab = pItemTab + if pNew == uintptr(0) { + (*Select)(unsafe.Pointer(p)).FpPrior = pPrior + } else { + (*Select)(unsafe.Pointer(pNew)).FselId = U32(libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnSelect, 1)) + if (aCsrMap != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) { + renumberCursors(tls, pParse, pNew, iFrom, aCsrMap) + } + (*Select)(unsafe.Pointer(pNew)).FpPrior = pPrior + if pPrior != 0 { + (*Select)(unsafe.Pointer(pPrior)).FpNext = pNew + } + (*Select)(unsafe.Pointer(pNew)).FpNext = p + (*Select)(unsafe.Pointer(p)).FpPrior = pNew + + } + + } + Xsqlite3DbFree(tls, db, aCsrMap) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*SrcItem)(unsafe.Pointer(pSubitem)).FpSelect = pSub1 + return 1 + } + + // Defer deleting the Table object associated with the + // subquery until code generation is + // complete, since there may still exist Expr.pTab entries that + // refer to the subquery even after flattening. Ticket #3346. + // + // pSubitem->pTab is always non-NULL by test restrictions and tests above. + if (*SrcItem)(unsafe.Pointer(pSubitem)).FpTab != uintptr(0) { + var pTabToDel uintptr = (*SrcItem)(unsafe.Pointer(pSubitem)).FpTab + if (*Table)(unsafe.Pointer(pTabToDel)).FnTabRef == U32(1) { + var pToplevel uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + Xsqlite3ParserAddCleanup(tls, pToplevel, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3DeleteTable})), + pTabToDel) + + } else { + (*Table)(unsafe.Pointer(pTabToDel)).FnTabRef-- + } + (*SrcItem)(unsafe.Pointer(pSubitem)).FpTab = uintptr(0) + } + + // The following loop runs once for each term in a compound-subquery + // flattening (as described above). If we are doing a different kind + // of flattening - a flattening other than a compound-subquery flattening - + // then this loop only runs once. + // + // This loop moves all of the FROM elements of the subquery into the + // the FROM clause of the outer query. Before doing this, remember + // the cursor number for the original outer query FROM element in + // iParent. The iParent cursor will never be used. Subsequent code + // will scan expressions looking for iParent references and replace + // those references with expressions that resolve to the subquery FROM + // elements we are now copying in. + pSub = pSub1 + pParent = p +__1: + if !(pParent != 0) { + goto __3 + } + { + var nSubSrc int32 + var jointype U8 = U8(0) + + pSubSrc = (*Select)(unsafe.Pointer(pSub)).FpSrc // FROM clause of subquery + nSubSrc = (*SrcList)(unsafe.Pointer(pSubSrc)).FnSrc // Number of terms in subquery FROM clause + pSrc = (*Select)(unsafe.Pointer(pParent)).FpSrc // FROM clause of the outer query + + if pParent == p { + jointype = (*SrcItem)(unsafe.Pointer(pSubitem)).Ffg.Fjointype // First time through the loop + } + + // The subquery uses a single slot of the FROM clause of the outer + // query. If the subquery has more than one element in its FROM clause, + // then expand the outer query to make space for it to hold all elements + // of the subquery. + // + // Example: + // + // SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB; + // + // The outer query has 3 slots in its FROM clause. One slot of the + // outer query (the middle slot) is used by the subquery. The next + // block of code will expand the outer query FROM clause to 4 slots. + // The middle slot is expanded to two slots in order to make space + // for the two elements in the FROM clause of the subquery. + if nSubSrc > 1 { + pSrc = Xsqlite3SrcListEnlarge(tls, pParse, pSrc, (nSubSrc - 1), (iFrom + 1)) + if pSrc == uintptr(0) { + goto __3 + } + (*Select)(unsafe.Pointer(pParent)).FpSrc = pSrc + } + + // Transfer the FROM clause terms from the subquery into the + // outer query. + for i = 0; i < nSubSrc; i++ { + Xsqlite3IdListDelete(tls, db, (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr((i+iFrom))*112)).FpUsing) + + *(*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr((i+iFrom))*112)) = *(*SrcItem)(unsafe.Pointer((pSubSrc + 8 /* &.a */) + uintptr(i)*112)) + iNewParent = (*SrcItem)(unsafe.Pointer((pSubSrc + 8 /* &.a */) + uintptr(i)*112)).FiCursor + libc.Xmemset(tls, ((pSubSrc + 8 /* &.a */) + uintptr(i)*112), 0, uint64(unsafe.Sizeof(SrcItem{}))) + } + (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(iFrom)*112)).Ffg.Fjointype = jointype + + // Now begin substituting subquery result set expressions for + // references to the iParent in the outer query. + // + // Example: + // + // SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b; + // \ \_____________ subquery __________/ / + // \_____________________ outer query ______________________________/ + // + // We look at every expression in the outer query and every place we see + // "a" we substitute "x*3" and every place we see "b" we substitute "y+10". + if ((*Select)(unsafe.Pointer(pSub)).FpOrderBy != 0) && (((*Select)(unsafe.Pointer(pParent)).FselFlags & U32(SF_NoopOrderBy)) == U32(0)) { + // At this point, any non-zero iOrderByCol values indicate that the + // ORDER BY column expression is identical to the iOrderByCol'th + // expression returned by SELECT statement pSub. Since these values + // do not necessarily correspond to columns in SELECT statement pParent, + // zero them before transfering the ORDER BY clause. + // + // Not doing this may cause an error if a subsequent call to this + // function attempts to flatten a compound sub-query into pParent + // (the only way this can happen is if the compound sub-query is + // currently part of pSub->pSrc). See ticket [d11a6e908f]. + var pOrderBy uintptr = (*Select)(unsafe.Pointer(pSub)).FpOrderBy + for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { + *(*U16)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32 + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(0) + } + + (*Select)(unsafe.Pointer(pParent)).FpOrderBy = pOrderBy + (*Select)(unsafe.Pointer(pSub)).FpOrderBy = uintptr(0) + } + pWhere = (*Select)(unsafe.Pointer(pSub)).FpWhere + (*Select)(unsafe.Pointer(pSub)).FpWhere = uintptr(0) + if isLeftJoin > 0 { + Xsqlite3SetJoinExpr(tls, pWhere, iNewParent) + } + if pWhere != 0 { + if (*Select)(unsafe.Pointer(pParent)).FpWhere != 0 { + (*Select)(unsafe.Pointer(pParent)).FpWhere = Xsqlite3PExpr(tls, pParse, TK_AND, pWhere, (*Select)(unsafe.Pointer(pParent)).FpWhere) + } else { + (*Select)(unsafe.Pointer(pParent)).FpWhere = pWhere + } + } + if int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + // var x SubstContext at bp, 32 + + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FpParse = pParse + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FiTable = iParent + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FiNewTable = iNewParent + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FisLeftJoin = isLeftJoin + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FpEList = (*Select)(unsafe.Pointer(pSub)).FpEList + substSelect(tls, bp /* &x */, pParent, 0) + } + + // The flattened query is a compound if either the inner or the + // outer query is a compound. + *(*U32)(unsafe.Pointer(pParent + 4 /* &.selFlags */)) |= ((*Select)(unsafe.Pointer(pSub)).FselFlags & U32(SF_Compound)) + // restriction (17b) + + // SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; + // + // One is tempted to try to add a and b to combine the limits. But this + // does not work if either limit is negative. + if (*Select)(unsafe.Pointer(pSub)).FpLimit != 0 { + (*Select)(unsafe.Pointer(pParent)).FpLimit = (*Select)(unsafe.Pointer(pSub)).FpLimit + (*Select)(unsafe.Pointer(pSub)).FpLimit = uintptr(0) + } + + // Recompute the SrcList_item.colUsed masks for the flattened + // tables. + for i = 0; i < nSubSrc; i++ { + recomputeColumnsUsed(tls, pParent, ((pSrc + 8 /* &.a */) + uintptr((i+iFrom))*112)) + } + + } + goto __2 +__2: + pParent = (*Select)(unsafe.Pointer(pParent)).FpPrior + pSub = (*Select)(unsafe.Pointer(pSub)).FpPrior + goto __1 + goto __3 +__3: + ; + + // Finially, delete what is left of the subquery and return + // success. + Xsqlite3AggInfoPersistWalkerInit(tls, bp+32 /* &w */, pParse) + Xsqlite3WalkSelect(tls, bp+32 /* &w */, pSub1) + Xsqlite3SelectDelete(tls, db, pSub1) + + return 1 +} + +// A structure to keep track of all of the column values that are fixed to +// a known value due to WHERE clause constraints of the form COLUMN=VALUE. +type WhereConst = WhereConst1 /* sqlite3.c:136486:27 */ + +// Add a new entry to the pConst object. Except, do not add duplicate +// pColumn entires. Also, do not add if doing so would not be appropriate. +// +// The caller guarantees the pColumn is a column and pValue is a constant. +// This routine has to do some additional checks before completing the +// insert. +func constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr, pExpr uintptr) { /* sqlite3.c:136504:13: */ + var i int32 + + if ((*Expr)(unsafe.Pointer((pColumn))).Fflags & (U32(EP_FixedCol))) != U32(0) { + return + } + if int32(Xsqlite3ExprAffinity(tls, pValue)) != 0 { + return + } + if !(Xsqlite3IsBinary(tls, Xsqlite3ExprCompareCollSeq(tls, (*WhereConst)(unsafe.Pointer(pConst)).FpParse, pExpr)) != 0) { + return + } + + // 2018-10-25 ticket [cf5ed20f] + // Make sure the same pColumn is not inserted more than once + for i = 0; i < (*WhereConst)(unsafe.Pointer(pConst)).FnConst; i++ { + var pE2 uintptr = *(*uintptr)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr((i*2))*8)) + + if ((*Expr)(unsafe.Pointer(pE2)).FiTable == (*Expr)(unsafe.Pointer(pColumn)).FiTable) && + (int32((*Expr)(unsafe.Pointer(pE2)).FiColumn) == int32((*Expr)(unsafe.Pointer(pColumn)).FiColumn)) { + return // Already present. Return without doing anything. + } + } + if int32(Xsqlite3ExprAffinity(tls, pColumn)) == SQLITE_AFF_BLOB { + (*WhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob = 1 + } + + (*WhereConst)(unsafe.Pointer(pConst)).FnConst++ + (*WhereConst)(unsafe.Pointer(pConst)).FapExpr = Xsqlite3DbReallocOrFree(tls, (*Parse)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, (*WhereConst)(unsafe.Pointer(pConst)).FapExpr, + (uint64((uint64((*WhereConst)(unsafe.Pointer(pConst)).FnConst * 2)) * uint64(unsafe.Sizeof(uintptr(0)))))) + if (*WhereConst)(unsafe.Pointer(pConst)).FapExpr == uintptr(0) { + (*WhereConst)(unsafe.Pointer(pConst)).FnConst = 0 + } else { + *(*uintptr)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr((((*WhereConst)(unsafe.Pointer(pConst)).FnConst*2)-2))*8)) = pColumn + *(*uintptr)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr((((*WhereConst)(unsafe.Pointer(pConst)).FnConst*2)-1))*8)) = pValue + } +} + +// Find all terms of COLUMN=VALUE or VALUE=COLUMN in pExpr where VALUE +// is a constant expression and where the term must be true because it +// is part of the AND-connected terms of the expression. For each term +// found, add it to the pConst structure. +func findConstInWhere(tls *libc.TLS, pConst uintptr, pExpr uintptr) { /* sqlite3.c:136552:13: */ + var pRight uintptr + var pLeft uintptr + if pExpr == uintptr(0) { + return + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0) { + return + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AND { + findConstInWhere(tls, pConst, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + findConstInWhere(tls, pConst, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + return + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_EQ { + return + } + pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight + pLeft = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + + if (int32((*Expr)(unsafe.Pointer(pRight)).Fop) == TK_COLUMN) && (Xsqlite3ExprIsConstant(tls, pLeft) != 0) { + constInsert(tls, pConst, pRight, pLeft, pExpr) + } + if (int32((*Expr)(unsafe.Pointer(pLeft)).Fop) == TK_COLUMN) && (Xsqlite3ExprIsConstant(tls, pRight) != 0) { + constInsert(tls, pConst, pLeft, pRight, pExpr) + } +} + +// This is a helper function for Walker callback propagateConstantExprRewrite(). +// +// Argument pExpr is a candidate expression to be replaced by a value. If +// pExpr is equivalent to one of the columns named in pWalker->u.pConst, +// then overwrite it with the corresponding value. Except, do not do so +// if argument bIgnoreAffBlob is non-zero and the affinity of pExpr +// is SQLITE_AFF_BLOB. +func propagateConstantExprRewriteOne(tls *libc.TLS, pConst uintptr, pExpr uintptr, bIgnoreAffBlob int32) int32 { /* sqlite3.c:136583:12: */ + var i int32 + if *(*U8)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FpOomFault)) != 0 { + return WRC_Prune + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLUMN { + return WRC_Continue + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FixedCol | EP_FromJoin))) != U32(0) { + + return WRC_Continue + } + for i = 0; i < (*WhereConst)(unsafe.Pointer(pConst)).FnConst; i++ { + var pColumn uintptr = *(*uintptr)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr((i*2))*8)) + if pColumn == pExpr { + continue + } + if (*Expr)(unsafe.Pointer(pColumn)).FiTable != (*Expr)(unsafe.Pointer(pExpr)).FiTable { + continue + } + if int32((*Expr)(unsafe.Pointer(pColumn)).FiColumn) != int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) { + continue + } + if (bIgnoreAffBlob != 0) && (int32(Xsqlite3ExprAffinity(tls, pColumn)) == SQLITE_AFF_BLOB) { + break + } + // A match is found. Add the EP_FixedCol property + (*WhereConst)(unsafe.Pointer(pConst)).FnChng++ + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Leaf))) + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_FixedCol)) + + (*Expr)(unsafe.Pointer(pExpr)).FpLeft = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, *(*uintptr)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FapExpr + uintptr(((i*2)+1))*8)), 0) + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb)).FmallocFailed != 0 { + return WRC_Prune + } + break + } + return WRC_Prune +} + +// This is a Walker expression callback. pExpr is a node from the WHERE +// clause of a SELECT statement. This function examines pExpr to see if +// any substitutions based on the contents of pWalker->u.pConst should +// be made to pExpr or its immediate children. +// +// A substitution is made if: +// +// + pExpr is a column with an affinity other than BLOB that matches +// one of the columns in pWalker->u.pConst, or +// +// + pExpr is a binary comparison operator (=, <=, >=, <, >) that +// uses an affinity other than TEXT and one of its immediate +// children is a column that matches one of the columns in +// pWalker->u.pConst. +func propagateConstantExprRewrite(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:136632:12: */ + var pConst uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + + if (*WhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob != 0 { + if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) >= TK_EQ) && (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) <= TK_GE)) || + (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_IS) { + propagateConstantExprRewriteOne(tls, pConst, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, 0) + if *(*U8)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(pConst)).FpOomFault)) != 0 { + return WRC_Prune + } + if int32(Xsqlite3ExprAffinity(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) != SQLITE_AFF_TEXT { + propagateConstantExprRewriteOne(tls, pConst, (*Expr)(unsafe.Pointer(pExpr)).FpRight, 0) + } + } + } + return propagateConstantExprRewriteOne(tls, pConst, pExpr, (*WhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob) +} + +// The WHERE-clause constant propagation optimization. +// +// If the WHERE clause contains terms of the form COLUMN=CONSTANT or +// CONSTANT=COLUMN that are top-level AND-connected terms that are not +// part of a ON clause from a LEFT JOIN, then throughout the query +// replace all other occurrences of COLUMN with CONSTANT. +// +// For example, the query: +// +// SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=t1.a AND t3.c=t2.b +// +// Is transformed into +// +// SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=39 AND t3.c=39 +// +// Return true if any transformations where made and false if not. +// +// Implementation note: Constant propagation is tricky due to affinity +// and collating sequence interactions. Consider this example: +// +// CREATE TABLE t1(a INT,b TEXT); +// INSERT INTO t1 VALUES(123,'0123'); +// SELECT * FROM t1 WHERE a=123 AND b=a; +// SELECT * FROM t1 WHERE a=123 AND b=123; +// +// The two SELECT statements above should return different answers. b=a +// is alway true because the comparison uses numeric affinity, but b=123 +// is false because it uses text affinity and '0123' is not the same as '123'. +// To work around this, the expression tree is not actually changed from +// "b=a" to "b=123" but rather the "a" in "b=a" is tagged with EP_FixedCol +// and the "123" value is hung off of the pLeft pointer. Code generator +// routines know to generate the constant "123" instead of looking up the +// column value. Also, to avoid collation problems, this optimization is +// only attempted if the "a=123" term uses the default BINARY collation. +// +// 2021-05-25 forum post 6a06202608: Another troublesome case is... +// +// CREATE TABLE t1(x); +// INSERT INTO t1 VALUES(10.0); +// SELECT 1 FROM t1 WHERE x=10 AND x LIKE 10; +// +// The query should return no rows, because the t1.x value is '10.0' not '10' +// and '10.0' is not LIKE '10'. But if we are not careful, the first WHERE +// term "x=10" will cause the second WHERE term to become "10 LIKE 10", +// resulting in a false positive. To avoid this, constant propagation for +// columns with BLOB affinity is only allowed if the constant is used with +// operators ==, <=, <, >=, >, or IS in a way that will cause the correct +// type conversions to occur. See logic associated with the bHasAffBlob flag +// for details. +func propagateConstants(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* sqlite3.c:136703:12: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + // var x WhereConst at bp, 40 + + // var w Walker at bp+40, 48 + + var nChng int32 = 0 + (*WhereConst)(unsafe.Pointer(bp /* &x */)).FpParse = pParse + (*WhereConst)(unsafe.Pointer(bp /* &x */)).FpOomFault = ((*Parse)(unsafe.Pointer(pParse)).Fdb + 99 /* &.mallocFailed */) + for ok := true; ok; ok = (*WhereConst)(unsafe.Pointer(bp /* &x */)).FnChng != 0 { + (*WhereConst)(unsafe.Pointer(bp /* &x */)).FnConst = 0 + (*WhereConst)(unsafe.Pointer(bp /* &x */)).FnChng = 0 + (*WhereConst)(unsafe.Pointer(bp /* &x */)).FapExpr = uintptr(0) + (*WhereConst)(unsafe.Pointer(bp /* &x */)).FbHasAffBlob = 0 + findConstInWhere(tls, bp /* &x */, (*Select)(unsafe.Pointer(p)).FpWhere) + if (*WhereConst)(unsafe.Pointer(bp /* &x */)).FnConst != 0 { + libc.Xmemset(tls, bp+40 /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp + 40 /* &w */)).FpParse = pParse + (*Walker)(unsafe.Pointer(bp + 40 /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{propagateConstantExprRewrite})) + (*Walker)(unsafe.Pointer(bp + 40 /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkNoop})) + (*Walker)(unsafe.Pointer(bp + 40 /* &w */)).FxSelectCallback2 = uintptr(0) + (*Walker)(unsafe.Pointer(bp + 40 /* &w */)).FwalkerDepth = 0 + *(*uintptr)(unsafe.Pointer(bp + 40 /* &w */ + 40 /* &.u */)) = bp /* &x */ + Xsqlite3WalkExpr(tls, bp+40 /* &w */, (*Select)(unsafe.Pointer(p)).FpWhere) + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer((*WhereConst)(unsafe.Pointer(bp /* &x */)).FpParse)).Fdb, (*WhereConst)(unsafe.Pointer(bp /* &x */)).FapExpr) + nChng = nChng + ((*WhereConst)(unsafe.Pointer(bp /* &x */)).FnChng) + } + } + return nChng +} + +// This function is called to determine whether or not it is safe to +// push WHERE clause expression pExpr down to FROM clause sub-query +// pSubq, which contains at least one window function. Return 1 +// if it is safe and the expression should be pushed down, or 0 +// otherwise. +// +// It is only safe to push the expression down if it consists only +// of constants and copies of expressions that appear in the PARTITION +// BY clause of all window function used by the sub-query. It is safe +// to filter out entire partitions, but not rows within partitions, as +// this may change the results of the window functions. +// +// At the time this function is called it is guaranteed that +// +// * the sub-query uses only one distinct window frame, and +// * that the window frame has a PARTITION BY clase. +func pushDownWindowCheck(tls *libc.TLS, pParse uintptr, pSubq uintptr, pExpr uintptr) int32 { /* sqlite3.c:136754:12: */ + + return Xsqlite3ExprIsConstantOrGroupBy(tls, pParse, pExpr, (*Window)(unsafe.Pointer((*Select)(unsafe.Pointer(pSubq)).FpWin)).FpPartition) +} + +// Make copies of relevant WHERE clause terms of the outer query into +// the WHERE clause of subquery. Example: +// +// SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10; +// +// Transformed into: +// +// SELECT * FROM (SELECT a AS x, c-d AS y FROM t1 WHERE a=5 AND c-d=10) +// WHERE x=5 AND y=10; +// +// The hope is that the terms added to the inner query will make it more +// efficient. +// +// Do not attempt this optimization if: +// +// (1) (** This restriction was removed on 2017-09-29. We used to +// disallow this optimization for aggregate subqueries, but now +// it is allowed by putting the extra terms on the HAVING clause. +// The added HAVING clause is pointless if the subquery lacks +// a GROUP BY clause. But such a HAVING clause is also harmless +// so there does not appear to be any reason to add extra logic +// to suppress it. **) +// +// (2) The inner query is the recursive part of a common table expression. +// +// (3) The inner query has a LIMIT clause (since the changes to the WHERE +// clause would change the meaning of the LIMIT). +// +// (4) The inner query is the right operand of a LEFT JOIN and the +// expression to be pushed down does not come from the ON clause +// on that LEFT JOIN. +// +// (5) The WHERE clause expression originates in the ON or USING clause +// of a LEFT JOIN where iCursor is not the right-hand table of that +// left join. An example: +// +// SELECT * +// FROM (SELECT 1 AS a1 UNION ALL SELECT 2) AS aa +// JOIN (SELECT 1 AS b2 UNION ALL SELECT 2) AS bb ON (a1=b2) +// LEFT JOIN (SELECT 8 AS c3 UNION ALL SELECT 9) AS cc ON (b2=2); +// +// The correct answer is three rows: (1,1,NULL),(2,2,8),(2,2,9). +// But if the (b2=2) term were to be pushed down into the bb subquery, +// then the (1,1,NULL) row would be suppressed. +// +// (6) Window functions make things tricky as changes to the WHERE clause +// of the inner query could change the window over which window +// functions are calculated. Therefore, do not attempt the optimization +// if: +// +// (6a) The inner query uses multiple incompatible window partitions. +// +// (6b) The inner query is a compound and uses window-functions. +// +// (6c) The WHERE clause does not consist entirely of constants and +// copies of expressions found in the PARTITION BY clause of +// all window-functions used by the sub-query. It is safe to +// filter out entire partitions, as this does not change the +// window over which any window-function is calculated. +// +// (7) The inner query is a Common Table Expression (CTE) that should +// be materialized. (This restriction is implemented in the calling +// routine.) +// +// Return 0 if no changes are made and non-zero if one or more WHERE clause +// terms are duplicated into the subquery. +func pushDownWhereTerms(tls *libc.TLS, pParse uintptr, pSubq uintptr, pWhere uintptr, iCursor int32, isLeftJoin int32) int32 { /* sqlite3.c:136832:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr + var nChng int32 = 0 + if pWhere == uintptr(0) { + return 0 + } + if ((*Select)(unsafe.Pointer(pSubq)).FselFlags & (U32(SF_Recursive | SF_MultiPart))) != 0 { + return 0 + } + + if (*Select)(unsafe.Pointer(pSubq)).FpPrior != 0 { + var pSel uintptr + for pSel = pSubq; pSel != 0; pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior { + if (*Select)(unsafe.Pointer(pSel)).FpWin != 0 { + return 0 + } // restriction (6b) + } + } else { + if ((*Select)(unsafe.Pointer(pSubq)).FpWin != 0) && ((*Window)(unsafe.Pointer((*Select)(unsafe.Pointer(pSubq)).FpWin)).FpPartition == uintptr(0)) { + return 0 + } + } + + if (*Select)(unsafe.Pointer(pSubq)).FpLimit != uintptr(0) { + return 0 // restriction (3) + } + for int32((*Expr)(unsafe.Pointer(pWhere)).Fop) == TK_AND { + nChng = nChng + (pushDownWhereTerms(tls, pParse, pSubq, (*Expr)(unsafe.Pointer(pWhere)).FpRight, + iCursor, isLeftJoin)) + pWhere = (*Expr)(unsafe.Pointer(pWhere)).FpLeft + } + if (isLeftJoin != 0) && + (((libc.Bool32(((*Expr)(unsafe.Pointer((pWhere))).Fflags & (U32(EP_FromJoin))) != U32(0))) == 0) || + ((*Expr)(unsafe.Pointer(pWhere)).FiRightJoinTable != iCursor)) { + return 0 // restriction (4) + } + if (((*Expr)(unsafe.Pointer((pWhere))).Fflags & (U32(EP_FromJoin))) != U32(0)) && ((*Expr)(unsafe.Pointer(pWhere)).FiRightJoinTable != iCursor) { + return 0 // restriction (5) + } + if Xsqlite3ExprIsTableConstant(tls, pWhere, iCursor) != 0 { + nChng++ + *(*U32)(unsafe.Pointer(pSubq + 4 /* &.selFlags */)) |= (U32(SF_PushDown)) + for pSubq != 0 { + // var x SubstContext at bp, 32 + + pNew = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWhere, 0) + unsetJoinExpr(tls, pNew, -1) + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FpParse = pParse + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FiTable = iCursor + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FiNewTable = iCursor + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FisLeftJoin = 0 + (*SubstContext)(unsafe.Pointer(bp /* &x */)).FpEList = (*Select)(unsafe.Pointer(pSubq)).FpEList + pNew = substExpr(tls, bp /* &x */, pNew) + if ((*Select)(unsafe.Pointer(pSubq)).FpWin != 0) && (0 == pushDownWindowCheck(tls, pParse, pSubq, pNew)) { + // Restriction 6c has prevented push-down in this case + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pNew) + nChng-- + break + } + if ((*Select)(unsafe.Pointer(pSubq)).FselFlags & U32(SF_Aggregate)) != 0 { + (*Select)(unsafe.Pointer(pSubq)).FpHaving = Xsqlite3ExprAnd(tls, pParse, (*Select)(unsafe.Pointer(pSubq)).FpHaving, pNew) + } else { + (*Select)(unsafe.Pointer(pSubq)).FpWhere = Xsqlite3ExprAnd(tls, pParse, (*Select)(unsafe.Pointer(pSubq)).FpWhere, pNew) + } + pSubq = (*Select)(unsafe.Pointer(pSubq)).FpPrior + } + } + return nChng +} + +// The pFunc is the only aggregate function in the query. Check to see +// if the query is a candidate for the min/max optimization. +// +// If the query is a candidate for the min/max optimization, then set +// *ppMinMax to be an ORDER BY clause to be used for the optimization +// and return either WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX depending on +// whether pFunc is a min() or max() function. +// +// If the query is not a candidate for the min/max optimization, return +// WHERE_ORDERBY_NORMAL (which must be zero). +// +// This routine must be called after aggregate functions have been +// located but before their arguments have been subjected to aggregate +// analysis. +func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 { /* sqlite3.c:136934:11: */ + var eRet int32 = WHERE_ORDERBY_NORMAL // Return value + var pEList uintptr = *(*uintptr)(unsafe.Pointer(pFunc + 32 /* &.x */)) // Arguments to agg function + var zFunc uintptr // Name of aggregate function pFunc + var pOrderBy uintptr + var sortFlags U8 = U8(0) + + if (((pEList == uintptr(0)) || + ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != 1)) || + (((*Expr)(unsafe.Pointer((pFunc))).Fflags & (U32(EP_WinFunc))) != U32(0))) || + (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_MinMaxOpt))) != U32(0)) { + return U8(eRet) + } + zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) + if Xsqlite3StrICmp(tls, zFunc, ts+13840 /* "min" */) == 0 { + eRet = WHERE_ORDERBY_MIN + if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { + sortFlags = U8(KEYINFO_ORDER_BIGNULL) + } + } else if Xsqlite3StrICmp(tls, zFunc, ts+13844 /* "max" */) == 0 { + eRet = WHERE_ORDERBY_MAX + sortFlags = U8(KEYINFO_ORDER_DESC) + } else { + return U8(eRet) + } + *(*uintptr)(unsafe.Pointer(ppMinMax)) = libc.AssignUintptr(&pOrderBy, Xsqlite3ExprListDup(tls, db, pEList, 0)) + + if pOrderBy != 0 { + (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */))).FsortFlags = sortFlags + } + return U8(eRet) +} + +// The select statement passed as the first argument is an aggregate query. +// The second argument is the associated aggregate-info object. This +// function tests if the SELECT is of the form: +// +// SELECT count(*) FROM +// +// where table is a database table, not a sub-select or view. If the query +// does match this pattern, then a pointer to the Table object representing +// is returned. Otherwise, 0 is returned. +func isSimpleCount(tls *libc.TLS, p uintptr, pAggInfo uintptr) uintptr { /* sqlite3.c:136980:14: */ + var pTab uintptr + var pExpr uintptr + + if ((((*Select)(unsafe.Pointer(p)).FpWhere != 0) || ((*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr != 1)) || + ((*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpSrc)).FnSrc != 1)) || ((*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpSelect != 0) { + return uintptr(0) + } + pTab = (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpTab + pExpr = (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpEList + 8 /* &.a */))).FpExpr + + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + return uintptr(0) + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_AGG_FUNCTION { + return uintptr(0) + } + if (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == 0 { + return uintptr(0) + } + if ((*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFunc)).FfuncFlags & U32(SQLITE_FUNC_COUNT)) == U32(0) { + return uintptr(0) + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Distinct | EP_WinFunc))) != U32(0) { + return uintptr(0) + } + + return pTab +} + +// If the source-list item passed as an argument was augmented with an +// INDEXED BY clause, then try to locate the specified index. If there +// was such a clause and the named index cannot be found, return +// SQLITE_ERROR and leave an error in pParse. Otherwise, populate +// pFrom->pIndex and return SQLITE_OK. +func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* sqlite3.c:137011:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTab uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpTab + var zIndexedBy uintptr = *(*uintptr)(unsafe.Pointer(pFrom + 96 /* &.u1 */)) + var pIdx uintptr + + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + } + if !(pIdx != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+17515 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + return SQLITE_ERROR + } + *(*uintptr)(unsafe.Pointer(pFrom + 104 /* &.u2 */)) = pIdx + return SQLITE_OK +} + +// Detect compound SELECT statements that use an ORDER BY clause with +// an alternative collating sequence. +// +// SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ... +// +// These are rewritten as a subquery: +// +// SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2) +// ORDER BY ... COLLATE ... +// +// This transformation is necessary because the multiSelectOrderBy() routine +// above that generates the code for a compound SELECT with an ORDER BY clause +// uses a merge algorithm that requires the same collating sequence on the +// result columns as on the ORDER BY clause. See ticket +// http://www.sqlite.org/src/info/6709574d2a +// +// This transformation is only needed for EXCEPT, INTERSECT, and UNION. +// The UNION ALL operator works fine with multiSelectOrderBy() even when +// there are COLLATE terms in the ORDER BY. +func convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:137052:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var i int32 + var pNew uintptr + var pX uintptr + var db uintptr + var a uintptr + var pNewSrc uintptr + var pParse uintptr + // var dummy Token at bp, 16 + + if (*Select)(unsafe.Pointer(p)).FpPrior == uintptr(0) { + return WRC_Continue + } + if (*Select)(unsafe.Pointer(p)).FpOrderBy == uintptr(0) { + return WRC_Continue + } + for pX = p; (pX != 0) && ((int32((*Select)(unsafe.Pointer(pX)).Fop) == TK_ALL) || (int32((*Select)(unsafe.Pointer(pX)).Fop) == TK_SELECT)); pX = (*Select)(unsafe.Pointer(pX)).FpPrior { + } + if pX == uintptr(0) { + return WRC_Continue + } + a = (*Select)(unsafe.Pointer(p)).FpOrderBy + 8 /* &.a */ + // If iOrderByCol is already non-zero, then it has already been matched + // to a result column of the SELECT statement. This occurs when the + // SELECT is rewritten for window-functions processing and then passed + // to sqlite3SelectPrep() and similar a second time. The rewriting done + // by this function is not required in this case. + if *(*U16)(unsafe.Pointer(a + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) != 0 { + return WRC_Continue + } + for i = ((*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpOrderBy)).FnExpr - 1); i >= 0; i-- { + if ((*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer(a+uintptr(i)*32)).FpExpr)).Fflags & U32(EP_Collate)) != 0 { + break + } + } + if i < 0 { + return WRC_Continue + } + + // If we reach this point, that means the transformation is required. + + pParse = (*Walker)(unsafe.Pointer(pWalker)).FpParse + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pNew = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Select{}))) + if pNew == uintptr(0) { + return WRC_Abort + } + libc.Xmemset(tls, bp /* &dummy */, 0, uint64(unsafe.Sizeof(Token{}))) + pNewSrc = Xsqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp /* &dummy */, pNew, uintptr(0), uintptr(0)) + if pNewSrc == uintptr(0) { + return WRC_Abort + } + *(*Select)(unsafe.Pointer(pNew)) = *(*Select)(unsafe.Pointer(p)) + (*Select)(unsafe.Pointer(p)).FpSrc = pNewSrc + (*Select)(unsafe.Pointer(p)).FpEList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), Xsqlite3Expr(tls, db, TK_ASTERISK, uintptr(0))) + (*Select)(unsafe.Pointer(p)).Fop = U8(TK_SELECT) + (*Select)(unsafe.Pointer(p)).FpWhere = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpGroupBy = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpHaving = uintptr(0) + (*Select)(unsafe.Pointer(pNew)).FpOrderBy = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpNext = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpWith = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpWinDefn = uintptr(0) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_Compound))) + + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_Converted)) + + (*Select)(unsafe.Pointer((*Select)(unsafe.Pointer(pNew)).FpPrior)).FpNext = pNew + (*Select)(unsafe.Pointer(pNew)).FpLimit = uintptr(0) + return WRC_Continue +} + +// Check to see if the FROM clause term pFrom has table-valued function +// arguments. If it does, leave an error message in pParse and return +// non-zero, since pFrom is not allowed to be a table-valued function. +func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* sqlite3.c:137117:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+17533 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + return 1 + } + return 0 +} + +// Argument pWith (which may be NULL) points to a linked list of nested +// WITH contexts, from inner to outermost. If the table identified by +// FROM clause element pItem is really a common-table-expression (CTE) +// then return a pointer to the CTE definition for that table. Otherwise +// return NULL. +// +// If a non-NULL value is returned, set *ppContext to point to the With +// object that the returned CTE belongs to. +func searchWith(tls *libc.TLS, pWith uintptr, pItem uintptr, ppContext uintptr) uintptr { /* sqlite3.c:137136:19: */ + var zName uintptr = (*SrcItem)(unsafe.Pointer(pItem)).FzName + var p uintptr + + for p = pWith; p != 0; p = (*With)(unsafe.Pointer(p)).FpOuter { + var i int32 + for i = 0; i < (*With)(unsafe.Pointer(p)).FnCte; i++ { + if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((p+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { + *(*uintptr)(unsafe.Pointer(ppContext)) = p + return ((p + 16 /* &.a */) + uintptr(i)*48) + } + } + if (*With)(unsafe.Pointer(p)).FbView != 0 { + break + } + } + return uintptr(0) +} + +// The code generator maintains a stack of active WITH clauses +// with the inner-most WITH clause being at the top of the stack. +// +// This routine pushes the WITH clause passed as the second argument +// onto the top of the stack. If argument bFree is true, then this +// WITH clause will never be popped from the stack but should instead +// be freed along with the Parse object. In other cases, when +// bFree==0, the With object will be freed along with the SELECT +// statement with which it is associated. +// +// This routine returns a copy of pWith. Or, if bFree is true and +// the pWith object is destroyed immediately due to an OOM condition, +// then this routine return NULL. +// +// If bFree is true, do not continue to use the pWith pointer after +// calling this routine, Instead, use only the return value. +func Xsqlite3WithPush(tls *libc.TLS, pParse uintptr, pWith uintptr, bFree U8) uintptr { /* sqlite3.c:137175:21: */ + if pWith != 0 { + if bFree != 0 { + pWith = Xsqlite3ParserAddCleanup(tls, pParse, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3WithDelete})), + pWith) + if pWith == uintptr(0) { + return uintptr(0) + } + } + if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { + + (*With)(unsafe.Pointer(pWith)).FpOuter = (*Parse)(unsafe.Pointer(pParse)).FpWith + (*Parse)(unsafe.Pointer(pParse)).FpWith = pWith + } + } + return pWith +} + +// This function checks if argument pFrom refers to a CTE declared by +// a WITH clause on the stack currently maintained by the parser (on the +// pParse->pWith linked list). And if currently processing a CTE +// CTE expression, through routine checks to see if the reference is +// a recursive reference to the CTE. +// +// If pFrom matches a CTE according to either of these two above, pFrom->pTab +// and other fields are populated accordingly. +// +// Return 0 if no match is found. +// Return 1 if a match is found. +// Return 2 if an error condition is detected. +func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom uintptr) int32 { /* sqlite3.c:137206:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pCte uintptr // Matched CTE (or NULL if no match) + // var pWith uintptr at bp+40, 8 + // The matching WITH + + if (*Parse)(unsafe.Pointer(pParse)).FpWith == uintptr(0) { + // There are no WITH clauses in the stack. No match is possible + return 0 + } + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + // Prior errors might have left pParse->pWith in a goofy state, so + // go no further. + return 0 + } + if (*SrcItem)(unsafe.Pointer(pFrom)).FzDatabase != uintptr(0) { + // The FROM term contains a schema qualifier (ex: main.t1) and so + // it cannot possibly be a CTE reference. + return 0 + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.notCte */)) & 0x100 >> 8))) != 0 { + // The FROM term is specifically excluded from matching a CTE. + // (1) It is part of a trigger that used to have zDatabase but had + // zDatabase removed by sqlite3FixTriggerStep(). + // (2) This is the first term in the FROM clause of an UPDATE. + return 0 + } + pCte = searchWith(tls, (*Parse)(unsafe.Pointer(pParse)).FpWith, pFrom, bp+40 /* &pWith */) + if pCte != 0 { + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTab uintptr + var pEList uintptr + var pSel uintptr + var pLeft uintptr // Left-most SELECT statement + var pRecTerm uintptr // Left-most recursive term + var bMayRecursive int32 // True if compound joined by UNION [ALL] + var pSavedWith uintptr // Initial value of pParse->pWith + var iRecTab int32 = -1 // Cursor for recursive table + var pCteUse uintptr + + // If pCte->zCteErr is non-NULL at this point, then this is an illegal + // recursive reference to CTE pCte. Leave an error in pParse and return + // early. If pCte->zCteErr is NULL, then this is not a recursive reference. + // In this case, proceed. + if (*Cte)(unsafe.Pointer(pCte)).FzCteErr != 0 { + Xsqlite3ErrorMsg(tls, pParse, (*Cte)(unsafe.Pointer(pCte)).FzCteErr, libc.VaList(bp, (*Cte)(unsafe.Pointer(pCte)).FzName)) + return 2 + } + if cannotBeFunction(tls, pParse, pFrom) != 0 { + return 2 + } + + pTab = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Table{}))) + if pTab == uintptr(0) { + return 2 + } + pCteUse = (*Cte)(unsafe.Pointer(pCte)).FpUse + if pCteUse == uintptr(0) { + (*Cte)(unsafe.Pointer(pCte)).FpUse = libc.AssignUintptr(&pCteUse, Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(CteUse{})))) + if (pCteUse == uintptr(0)) || + (Xsqlite3ParserAddCleanup(tls, pParse, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3DbFree})), pCteUse) == uintptr(0)) { + Xsqlite3DbFree(tls, db, pTab) + return 2 + } + (*CteUse)(unsafe.Pointer(pCteUse)).FeM10d = (*Cte)(unsafe.Pointer(pCte)).FeM10d + } + (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = pTab + (*Table)(unsafe.Pointer(pTab)).FnTabRef = U32(1) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, db, (*Cte)(unsafe.Pointer(pCte)).FzName) + (*Table)(unsafe.Pointer(pTab)).FiPKey = int16(-1) + (*Table)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_Ephemeral | TF_NoVisibleRowid)) + (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Cte)(unsafe.Pointer(pCte)).FpSelect, 0) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return 2 + } + *(*U32)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pFrom)).FpSelect + 4 /* &.selFlags */)) |= (U32(SF_CopyCte)) + + libc.SetBitFieldPtr16Uint32(pFrom+60 /* &.fg */ +4 /* &.isCte */, uint32(1), 7, 0x80) + *(*uintptr)(unsafe.Pointer(pFrom + 104 /* &.u2 */)) = pCteUse + (*CteUse)(unsafe.Pointer(pCteUse)).FnUse++ + if ((*CteUse)(unsafe.Pointer(pCteUse)).FnUse >= 2) && (int32((*CteUse)(unsafe.Pointer(pCteUse)).FeM10d) == M10d_Any) { + (*CteUse)(unsafe.Pointer(pCteUse)).FeM10d = U8(M10d_Yes) + } + + // Check if this is a recursive CTE. + pRecTerm = libc.AssignUintptr(&pSel, (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect) + bMayRecursive = (libc.Bool32((int32((*Select)(unsafe.Pointer(pSel)).Fop) == TK_ALL) || (int32((*Select)(unsafe.Pointer(pSel)).Fop) == TK_UNION))) + for (bMayRecursive != 0) && (int32((*Select)(unsafe.Pointer(pRecTerm)).Fop) == int32((*Select)(unsafe.Pointer(pSel)).Fop)) { + var i int32 + var pSrc uintptr = (*Select)(unsafe.Pointer(pRecTerm)).FpSrc + + for i = 0; i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc; i++ { + var pItem uintptr = ((pSrc + 8 /* &.a */) + uintptr(i)*112) + if (((*SrcItem)(unsafe.Pointer(pItem)).FzDatabase == uintptr(0)) && + ((*SrcItem)(unsafe.Pointer(pItem)).FzName != uintptr(0))) && + (0 == Xsqlite3StrICmp(tls, (*SrcItem)(unsafe.Pointer(pItem)).FzName, (*Cte)(unsafe.Pointer(pCte)).FzName)) { + (*SrcItem)(unsafe.Pointer(pItem)).FpTab = pTab + (*Table)(unsafe.Pointer(pTab)).FnTabRef++ + libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) + if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { + Xsqlite3ErrorMsg(tls, pParse, + ts+17556 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + return 2 + } + *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) + if iRecTab < 0 { + iRecTab = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + } + (*SrcItem)(unsafe.Pointer(pItem)).FiCursor = iRecTab + } + } + if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) == U32(0) { + break + } + pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior + } + + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17599 /* "circular referen..." */ + pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith + (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) + if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { + var rc int32 + + (*Select)(unsafe.Pointer(pRecTerm)).FpWith = (*Select)(unsafe.Pointer(pSel)).FpWith + rc = Xsqlite3WalkSelect(tls, pWalker, pRecTerm) + (*Select)(unsafe.Pointer(pRecTerm)).FpWith = uintptr(0) + if rc != 0 { + (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return 2 + } + } else { + if Xsqlite3WalkSelect(tls, pWalker, pSel) != 0 { + (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return 2 + } + } + (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) + + for pLeft = pSel; (*Select)(unsafe.Pointer(pLeft)).FpPrior != 0; pLeft = (*Select)(unsafe.Pointer(pLeft)).FpPrior { + } + pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList + if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { + if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { + Xsqlite3ErrorMsg(tls, pParse, ts+17622, /* "table %s has %d ..." */ + libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return 2 + } + pEList = (*Cte)(unsafe.Pointer(pCte)).FpCols + } + + Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) + if bMayRecursive != 0 { + if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17660 /* "multiple recursi..." */ + } else { + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17694 /* "recursive refere..." */ + } + Xsqlite3WalkSelect(tls, pWalker, pSel) + } + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = uintptr(0) + (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith + return 1 // Success + } + return 0 // No match +} + +// If the SELECT passed as the second argument has an associated WITH +// clause, pop it from the stack stored as part of the Parse object. +// +// This function is used as the xSelectCallback2() callback by +// sqlite3SelectExpand() when walking a SELECT tree to resolve table +// names and other FROM clause elements. +func Xsqlite3SelectPopWith(tls *libc.TLS, pWalker uintptr, p uintptr) { /* sqlite3.c:137386:21: */ + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + if ((*Parse)(unsafe.Pointer(pParse)).FpWith != 0) && ((*Select)(unsafe.Pointer(p)).FpPrior == uintptr(0)) { + var pWith uintptr = (*Select)(unsafe.Pointer(findRightmost(tls, p))).FpWith + if pWith != uintptr(0) { + + (*Parse)(unsafe.Pointer(pParse)).FpWith = (*With)(unsafe.Pointer(pWith)).FpOuter + } + } +} + +// The SrcList_item structure passed as the second argument represents a +// sub-query in the FROM clause of a SELECT statement. This function +// allocates and populates the SrcList_item.pTab object. If successful, +// SQLITE_OK is returned. Otherwise, if an OOM error is encountered, +// SQLITE_NOMEM. +func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* sqlite3.c:137405:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSel uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect + var pTab uintptr + + (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = libc.AssignUintptr(&pTab, Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Table{})))) + if pTab == uintptr(0) { + return SQLITE_NOMEM + } + (*Table)(unsafe.Pointer(pTab)).FnTabRef = U32(1) + if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) + } else { + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17732 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + } + for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { + pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior + } + Xsqlite3ColumnsFromExprList(tls, pParse, (*Select)(unsafe.Pointer(pSel)).FpEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) + (*Table)(unsafe.Pointer(pTab)).FiPKey = int16(-1) + (*Table)(unsafe.Pointer(pTab)).FnRowLogEst = int16(200) + // The usual case - do not allow ROWID on a subquery + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_Ephemeral | TF_NoVisibleRowid)) + + if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { + return SQLITE_ERROR + } + return SQLITE_OK +} + +// This routine is a Walker callback for "expanding" a SELECT statement. +// "Expanding" means to do the following: +// +// (1) Make sure VDBE cursor numbers have been assigned to every +// element of the FROM clause. +// +// (2) Fill in the pTabList->a[].pTab fields in the SrcList that +// defines FROM clause. When views appear in the FROM clause, +// fill pTabList->a[].pSelect with a copy of the SELECT statement +// that implements the view. A copy is made of the view's SELECT +// statement so that we can freely modify or delete that statement +// without worrying about messing up the persistent representation +// of the view. +// +// (3) Add terms to the WHERE clause to accommodate the NATURAL keyword +// on joins and the ON and USING clause of joins. +// +// (4) Scan the list of columns in the result set (pEList) looking +// for instances of the "*" operator or the TABLE.* operator. +// If found, expand each "*" to be every column in every table +// and TABLE.* to be every column in TABLE. +// +func selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:137457:12: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + var i int32 + var j int32 + var k int32 + var rc int32 + var pTabList uintptr + var pEList uintptr + var pFrom uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pE uintptr + var pRight uintptr + var pExpr uintptr + var selFlags U16 = U16((*Select)(unsafe.Pointer(p)).FselFlags) + var elistFlags U32 = U32(0) + + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_Expanded)) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return WRC_Abort + } + + if (int32(selFlags) & SF_Expanded) != 0 { + return WRC_Prune + } + if (*Walker)(unsafe.Pointer(pWalker)).FeCode != 0 { + // Renumber selId because it has been copied from a view + (*Select)(unsafe.Pointer(p)).FselId = U32(libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnSelect, 1)) + } + pTabList = (*Select)(unsafe.Pointer(p)).FpSrc + pEList = (*Select)(unsafe.Pointer(p)).FpEList + if ((*Parse)(unsafe.Pointer(pParse)).FpWith != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_View)) != 0) { + if (*Select)(unsafe.Pointer(p)).FpWith == uintptr(0) { + (*Select)(unsafe.Pointer(p)).FpWith = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(With{}))) + if (*Select)(unsafe.Pointer(p)).FpWith == uintptr(0) { + return WRC_Abort + } + } + (*With)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpWith)).FbView = 1 + } + Xsqlite3WithPush(tls, pParse, (*Select)(unsafe.Pointer(p)).FpWith, uint8(0)) + + // Make sure cursor numbers have been assigned to all entries in + // the FROM clause of the SELECT statement. + Xsqlite3SrcListAssignCursors(tls, pParse, pTabList) + + // Look up every table named in the FROM clause of the select. If + // an entry of the FROM clause is a subquery instead of a table or view, + // then create a transient table structure to describe the subquery. + i = 0 + pFrom = pTabList + 8 /* &.a */ +__1: + if !(i < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc) { + goto __3 + } + { + var pTab uintptr + + if (*SrcItem)(unsafe.Pointer(pFrom)).FpTab != 0 { + goto __2 + } + + if (*SrcItem)(unsafe.Pointer(pFrom)).FzName == uintptr(0) { + var pSel uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect + // A sub-query in the FROM clause of a SELECT + + if Xsqlite3WalkSelect(tls, pWalker, pSel) != 0 { + return WRC_Abort + } + if Xsqlite3ExpandSubquery(tls, pParse, pFrom) != 0 { + return WRC_Abort + } + } else if (libc.AssignInt32(&rc, resolveFromTermToCte(tls, pParse, pWalker, pFrom))) != 0 { + if rc > 1 { + return WRC_Abort + } + pTab = (*SrcItem)(unsafe.Pointer(pFrom)).FpTab + + } else { + // An ordinary table or view name in the FROM clause + + (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = libc.AssignUintptr(&pTab, Xsqlite3LocateTableItem(tls, pParse, uint32(0), pFrom)) + if pTab == uintptr(0) { + return WRC_Abort + } + if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { + Xsqlite3ErrorMsg(tls, pParse, ts+17744, /* "too many referen..." */ + libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) + return WRC_Abort + } + (*Table)(unsafe.Pointer(pTab)).FnTabRef++ + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) && (cannotBeFunction(tls, pParse, pFrom) != 0) { + return WRC_Abort + } + if ((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) || ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { + var nCol I16 + var eCodeOrig U8 = U8((*Walker)(unsafe.Pointer(pWalker)).FeCode) + if Xsqlite3ViewGetColumnNames(tls, pParse, pTab) != 0 { + return WRC_Abort + } + + if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && + (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && + ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) { + Xsqlite3ErrorMsg(tls, pParse, ts+17783, /* "access to view \"..." */ + libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + } + + if ((((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) && + ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && + ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && + (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { + Xsqlite3ErrorMsg(tls, pParse, ts+17814, /* "unsafe use of vi..." */ + libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + } + (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) + nCol = (*Table)(unsafe.Pointer(pTab)).FnCol + (*Table)(unsafe.Pointer(pTab)).FnCol = int16(-1) + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(1) // Turn on Select.selId renumbering + Xsqlite3WalkSelect(tls, pWalker, (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect) + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(eCodeOrig) + (*Table)(unsafe.Pointer(pTab)).FnCol = nCol + } + } + + // Locate the index named by the INDEXED BY clause, if any. + if ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0) && (Xsqlite3IndexedByLookup(tls, pParse, pFrom) != 0) { + return WRC_Abort + } + + } + goto __2 +__2: + i++ + pFrom += 112 + goto __1 + goto __3 +__3: + ; + + // Process NATURAL keywords, and ON and USING clauses of joins. + if (((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) || (sqliteProcessJoin(tls, pParse, p) != 0) { + return WRC_Abort + } + + // For every "*" that occurs in the column list, insert the names of + // all columns in all tables. And for every TABLE.* insert the names + // of all columns in TABLE. The parser inserted a special expression + // with the TK_ASTERISK operator for each "*" that it found in the column + // list. The following code just has to locate the TK_ASTERISK + // expressions and expand each one to the list of all columns in + // all tables. + // + // The first loop just checks to see if there are any "*" operators + // that need expanding. + for k = 0; k < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; k++ { + pE = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(k)*32)).FpExpr + if int32((*Expr)(unsafe.Pointer(pE)).Fop) == TK_ASTERISK { + break + } + + if (int32((*Expr)(unsafe.Pointer(pE)).Fop) == TK_DOT) && (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pE)).FpRight)).Fop) == TK_ASTERISK) { + break + } + elistFlags = elistFlags | ((*Expr)(unsafe.Pointer(pE)).Fflags) + } + if k < (*ExprList)(unsafe.Pointer(pEList)).FnExpr { + // If we get here it means the result set contains one or more "*" + // operators that need to be expanded. Loop through each expression + // in the result set and expand them one by one. + var a uintptr = pEList + 8 /* &.a */ + var pNew uintptr = uintptr(0) + var flags int32 = int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags) + var longNames int32 = (libc.Bool32(((flags & SQLITE_FullColNames) != 0) && + ((flags & SQLITE_ShortColNames) == 0))) + + for k = 0; k < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; k++ { + pE = (*ExprList_item)(unsafe.Pointer(a + uintptr(k)*32)).FpExpr + elistFlags = elistFlags | ((*Expr)(unsafe.Pointer(pE)).Fflags) + pRight = (*Expr)(unsafe.Pointer(pE)).FpRight + + if (int32((*Expr)(unsafe.Pointer(pE)).Fop) != TK_ASTERISK) && + ((int32((*Expr)(unsafe.Pointer(pE)).Fop) != TK_DOT) || (int32((*Expr)(unsafe.Pointer(pRight)).Fop) != TK_ASTERISK)) { + // This particular expression does not need to be expanded. + pNew = Xsqlite3ExprListAppend(tls, pParse, pNew, (*ExprList_item)(unsafe.Pointer(a+uintptr(k)*32)).FpExpr) + if pNew != 0 { + (*ExprList_item)(unsafe.Pointer((pNew + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pNew)).FnExpr-1))*32)).FzEName = (*ExprList_item)(unsafe.Pointer(a + uintptr(k)*32)).FzEName + libc.SetBitFieldPtr8Uint32((pNew+8 /* &.a */)+uintptr(((*ExprList)(unsafe.Pointer(pNew)).FnExpr-1))*32+20 /* &.eEName */, (uint32(int32(*(*uint8)(unsafe.Pointer(a + uintptr(k)*32 + 20 /* &.eEName */)) & 0x3 >> 0))), 0, 0x3) + (*ExprList_item)(unsafe.Pointer(a + uintptr(k)*32)).FzEName = uintptr(0) + } + (*ExprList_item)(unsafe.Pointer(a + uintptr(k)*32)).FpExpr = uintptr(0) + } else { + // This expression is a "*" or a "TABLE.*" and needs to be + // expanded. + var tableSeen int32 = 0 // Set to 1 when TABLE matches + var zTName uintptr = uintptr(0) // text of name of TABLE + if int32((*Expr)(unsafe.Pointer(pE)).Fop) == TK_DOT { + + zTName = *(*uintptr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pE)).FpLeft + 8 /* &.u */)) + } + i = 0 + pFrom = pTabList + 8 /* &.a */ + __4: + if !(i < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc) { + goto __6 + } + { + var pTab uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpTab + var pSub uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect + var zTabName uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias + var zSchemaName uintptr = uintptr(0) + var iDb int32 + if zTabName == uintptr(0) { + zTabName = (*Table)(unsafe.Pointer(pTab)).FzName + } + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + goto __6 + } + if (pSub == uintptr(0)) || (((*Select)(unsafe.Pointer(pSub)).FselFlags & U32(SF_NestedFrom)) == U32(0)) { + pSub = uintptr(0) + if (zTName != 0) && (Xsqlite3StrICmp(tls, zTName, zTabName) != 0) { + goto __5 + } + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + if iDb >= 0 { + zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + } else { + zSchemaName = ts + 17847 /* "*" */ + } + } + for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { + var zName uintptr = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName + var zColname uintptr // The computed column name + var zToFree uintptr // Malloced string that needs to be freed + // var sColname Token at bp+72, 16 + // Computed column name as a token + + if ((zTName != 0) && (pSub != 0)) && + (Xsqlite3MatchEName(tls, (((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32), uintptr(0), zTName, uintptr(0)) == 0) { + continue + } + + // If a column is marked as 'hidden', omit it from the expanded + // result-set list unless the SELECT has the SF_IncludeHidden + // bit set. + if (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_IncludeHidden)) == U32(0)) && + ((int32((*Column)(unsafe.Pointer(((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32))).FcolFlags) & COLFLAG_HIDDEN) != 0) { + continue + } + tableSeen = 1 + + if (i > 0) && (zTName == uintptr(0)) { + if ((int32((*SrcItem)(unsafe.Pointer(pFrom)).Ffg.Fjointype) & JT_NATURAL) != 0) && + (tableAndColumnIndex(tls, pTabList, i, zName, uintptr(0), uintptr(0), 1) != 0) { + // In a NATURAL join, omit the join columns from the + // table to the right of the join + continue + } + if Xsqlite3IdListIndex(tls, (*SrcItem)(unsafe.Pointer(pFrom)).FpUsing, zName) >= 0 { + // In a join with a USING clause, omit columns in the + // using clause from the table on the right. + continue + } + } + pRight = Xsqlite3Expr(tls, db, TK_ID, zName) + zColname = zName + zToFree = uintptr(0) + if (longNames != 0) || ((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > 1) { + var pLeft uintptr + pLeft = Xsqlite3Expr(tls, db, TK_ID, zTabName) + pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pRight) + if zSchemaName != 0 { + pLeft = Xsqlite3Expr(tls, db, TK_ID, zSchemaName) + pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) + } + if longNames != 0 { + zColname = Xsqlite3MPrintf(tls, db, ts+10786 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zToFree = zColname + } + } else { + pExpr = pRight + } + pNew = Xsqlite3ExprListAppend(tls, pParse, pNew, pExpr) + Xsqlite3TokenInit(tls, bp+72 /* &sColname */, zColname) + Xsqlite3ExprListSetName(tls, pParse, pNew, bp+72 /* &sColname */, 0) + if ((pNew != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_NestedFrom)) != U32(0))) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + var pX uintptr = ((pNew + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pNew)).FnExpr-1))*32) + Xsqlite3DbFree(tls, db, (*ExprList_item)(unsafe.Pointer(pX)).FzEName) + if pSub != 0 { + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32)).FzEName) + + } else { + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17849, /* "%s.%s.%s" */ + libc.VaList(bp+40, zSchemaName, zTabName, zColname)) + + } + libc.SetBitFieldPtr8Uint32(pX+20 /* &.eEName */, uint32(ENAME_TAB), 0, 0x3) + } + Xsqlite3DbFree(tls, db, zToFree) + } + + } + goto __5 + __5: + i++ + pFrom += 112 + goto __4 + goto __6 + __6: + ; + if !(tableSeen != 0) { + if zTName != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+17858 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + } else { + Xsqlite3ErrorMsg(tls, pParse, ts+17876 /* "no tables specif..." */, 0) + } + } + } + } + Xsqlite3ExprListDelete(tls, db, pEList) + (*Select)(unsafe.Pointer(p)).FpEList = pNew + } + if (*Select)(unsafe.Pointer(p)).FpEList != 0 { + if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { + Xsqlite3ErrorMsg(tls, pParse, ts+17896 /* "too many columns..." */, 0) + return WRC_Abort + } + if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_ComplexResult)) + } + } + return WRC_Continue +} + +// This routine "expands" a SELECT statement and all of its subqueries. +// For additional information on what it means to "expand" a SELECT +// statement, see the comment on the selectExpand worker callback above. +// +// Expanding a SELECT statement is the first step in processing a +// SELECT statement. The SELECT statement must be expanded before +// name resolution is performed. +// +// If anything goes wrong, an error message is written into pParse. +// The calling function can detect the problem by looking at pParse->nErr +// and/or pParse->db->mallocFailed. +func sqlite3SelectExpand(tls *libc.TLS, pParse uintptr, pSelect uintptr) { /* sqlite3.c:137782:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3ExprWalkNoop})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = pParse + if (*Parse)(unsafe.Pointer(pParse)).FhasCompound != 0 { + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{convertCompoundSelectToSubquery})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = uintptr(0) + Xsqlite3WalkSelect(tls, bp /* &w */, pSelect) + } + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{selectExpander})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3SelectPopWith})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FeCode = U16(0) + Xsqlite3WalkSelect(tls, bp /* &w */, pSelect) +} + +// This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo() +// interface. +// +// For each FROM-clause subquery, add Column.zType and Column.zColl +// information to the Table structure that represents the result set +// of that subquery. +// +// The Table structure that represents the result set was constructed +// by selectExpander() but the type and collation information was omitted +// at that point because identifiers had not yet been resolved. This +// routine is called after identifier resolution. +func selectAddSubqueryTypeInfo(tls *libc.TLS, pWalker uintptr, p uintptr) { /* sqlite3.c:137812:13: */ + var pParse uintptr + var i int32 + var pTabList uintptr + var pFrom uintptr + + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_HasTypeInfo)) != 0 { + return + } + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_HasTypeInfo)) + pParse = (*Walker)(unsafe.Pointer(pWalker)).FpParse + pTabList = (*Select)(unsafe.Pointer(p)).FpSrc + i = 0 + pFrom = pTabList + 8 /* &.a */ +__1: + if !(i < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc) { + goto __3 + } + { + var pTab uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpTab + + if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Ephemeral)) != U32(0) { + // A sub-query in the FROM clause of a SELECT + var pSel uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect + if pSel != 0 { + for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { + pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior + } + Xsqlite3SelectAddColumnTypeAndCollation(tls, pParse, pTab, pSel, + int8(SQLITE_AFF_NONE)) + } + } + + } + goto __2 +__2: + i++ + pFrom += 112 + goto __1 + goto __3 +__3: +} + +// This routine adds datatype and collating sequence information to +// the Table structures of all FROM-clause subqueries in a +// SELECT statement. +// +// Use this routine after name resolution. +func sqlite3SelectAddTypeInfo(tls *libc.TLS, pParse uintptr, pSelect uintptr) { /* sqlite3.c:137847:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkNoop})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{selectAddSubqueryTypeInfo})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3ExprWalkNoop})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FpParse = pParse + Xsqlite3WalkSelect(tls, bp /* &w */, pSelect) +} + +// This routine sets up a SELECT statement for processing. The +// following is accomplished: +// +// * VDBE Cursor numbers are assigned to all FROM-clause terms. +// * Ephemeral Table objects are created for all FROM-clause subqueries. +// * ON and USING clauses are shifted into WHERE statements +// * Wildcards "*" and "TABLE.*" in result sets are expanded. +// * Identifiers in expression are matched to tables. +// +// This routine acts recursively on all subqueries within the SELECT. +func Xsqlite3SelectPrep(tls *libc.TLS, pParse uintptr, p uintptr, pOuterNC uintptr) { /* sqlite3.c:137871:21: */ + + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return + } + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_HasTypeInfo)) != 0 { + return + } + sqlite3SelectExpand(tls, pParse, p) + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + return + } + Xsqlite3ResolveSelectNames(tls, pParse, p, pOuterNC) + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + return + } + sqlite3SelectAddTypeInfo(tls, pParse, p) +} + +// Reset the aggregate accumulator. +// +// The aggregate accumulator is a set of memory cells that hold +// intermediate results while calculating an aggregate. This +// routine generates code that stores NULLs in all of those memory +// cells. +func resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { /* sqlite3.c:137894:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + var pFunc uintptr + var nReg int32 = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc + (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) + if nReg == 0 { + return + } + if ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0) { + return + } + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, (*AggInfo)(unsafe.Pointer(pAggInfo)).FmnReg, (*AggInfo)(unsafe.Pointer(pAggInfo)).FmxReg) + pFunc = (*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + i = 0 +__1: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __3 + } + { + if (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct >= 0 { + var pE uintptr = (*AggInfo_func)(unsafe.Pointer(pFunc)).FpFExpr + + if (*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)))).FnExpr != 1) { + Xsqlite3ErrorMsg(tls, pParse, + ts+17927 /* "DISTINCT aggrega..." */, 0) + (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 + } else { + var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)), 0, 0) + (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, + (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17978 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + } + } + + } + goto __2 +__2: + i++ + pFunc += 32 + goto __1 + goto __3 +__3: +} + +// Invoke the OP_AggFinalize opcode for every aggregate function +// in the AggInfo structure. +func finalizeAggFunctions(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { /* sqlite3.c:137938:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + var pF uintptr + i = 0 + pF = (*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc +__1: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __3 + } + { + var pList uintptr = *(*uintptr)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 32 /* &.x */)) + + Xsqlite3VdbeAddOp2(tls, v, OP_AggFinal, (*AggInfo_func)(unsafe.Pointer(pF)).FiMem, func() int32 { + if pList != 0 { + return (*ExprList)(unsafe.Pointer(pList)).FnExpr + } + return 0 + }()) + Xsqlite3VdbeAppendP4(tls, v, (*AggInfo_func)(unsafe.Pointer(pF)).FpFunc, -8) + + } + goto __2 +__2: + i++ + pF += 32 + goto __1 + goto __3 +__3: +} + +// Update the accumulator memory cells for an aggregate based on +// the current cursor position. +// +// If regAcc is non-zero and there are no min() or max() aggregates +// in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator +// registers if register regAcc contains 0. The caller will take care +// of setting and clearing regAcc. +func updateAccumulator(tls *libc.TLS, pParse uintptr, regAcc int32, pAggInfo uintptr, eDistinctType int32) { /* sqlite3.c:137960:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + var regHit int32 = 0 + var addrHitTest int32 = 0 + var pF uintptr + var pC uintptr + + (*AggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = U8(1) + i = 0 + pF = (*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc +__1: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __3 + } + { + var nArg int32 + var addrNext int32 = 0 + var regAgg int32 + var pList uintptr = *(*uintptr)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 32 /* &.x */)) + + if ((*Expr)(unsafe.Pointer(((*AggInfo_func)(unsafe.Pointer(pF)).FpFExpr))).Fflags & (U32(EP_WinFunc))) != U32(0) { + var pFilter uintptr = (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pF)).FpFExpr + 64 /* &.y */)))).FpFilter + if (((*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0) && + (((*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pF)).FpFunc)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != 0)) && + (regAcc != 0) { + // If regAcc==0, there there exists some min() or max() function + // without a FILTER clause that will ensure the magnet registers + // are populated. + if regHit == 0 { + regHit = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + // If this is the first row of the group (regAcc contains 0), clear the + // "magnet" register regHit so that the accumulator registers + // are populated if the FILTER clause jumps over the the + // invocation of min() or max() altogether. Or, if this is not + // the first row (regAcc contains 1), set the magnet register so that + // the accumulators are not populated unless the min()/max() is invoked + // and indicates that they should be. + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, regAcc, regHit) + } + addrNext = Xsqlite3VdbeMakeLabel(tls, pParse) + Xsqlite3ExprIfFalse(tls, pParse, pFilter, addrNext, SQLITE_JUMPIFNULL) + } + if pList != 0 { + nArg = (*ExprList)(unsafe.Pointer(pList)).FnExpr + regAgg = Xsqlite3GetTempRange(tls, pParse, nArg) + Xsqlite3ExprCodeExprList(tls, pParse, pList, regAgg, 0, uint8(SQLITE_ECEL_DUP)) + } else { + nArg = 0 + regAgg = 0 + } + if ((*AggInfo_func)(unsafe.Pointer(pF)).FiDistinct >= 0) && (pList != 0) { + if addrNext == 0 { + addrNext = Xsqlite3VdbeMakeLabel(tls, pParse) + } + (*AggInfo_func)(unsafe.Pointer(pF)).FiDistinct = codeDistinct(tls, pParse, eDistinctType, + (*AggInfo_func)(unsafe.Pointer(pF)).FiDistinct, addrNext, pList, regAgg) + } + if ((*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pF)).FpFunc)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != 0 { + var pColl uintptr = uintptr(0) + var pItem uintptr + var j int32 + // pList!=0 if pF->pFunc has NEEDCOLL + j = 0 + pItem = pList + 8 /* &.a */ + __4: + if !(!(pColl != 0) && (j < nArg)) { + goto __6 + } + { + pColl = Xsqlite3ExprCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr) + + } + goto __5 + __5: + j++ + pItem += 32 + goto __4 + goto __6 + __6: + ; + if !(pColl != 0) { + pColl = (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl + } + if (regHit == 0) && ((*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0) { + regHit = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + Xsqlite3VdbeAddOp4(tls, v, OP_CollSeq, regHit, 0, 0, pColl, -2) + } + Xsqlite3VdbeAddOp3(tls, v, OP_AggStep, 0, regAgg, (*AggInfo_func)(unsafe.Pointer(pF)).FiMem) + Xsqlite3VdbeAppendP4(tls, v, (*AggInfo_func)(unsafe.Pointer(pF)).FpFunc, -8) + Xsqlite3VdbeChangeP5(tls, v, uint16(U8(nArg))) + Xsqlite3ReleaseTempRange(tls, pParse, regAgg, nArg) + if addrNext != 0 { + Xsqlite3VdbeResolveLabel(tls, v, addrNext) + } + + } + goto __2 +__2: + i++ + pF += 32 + goto __1 + goto __3 +__3: + ; + if (regHit == 0) && ((*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0) { + regHit = regAcc + } + if regHit != 0 { + addrHitTest = Xsqlite3VdbeAddOp1(tls, v, OP_If, regHit) + } + i = 0 + pC = (*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol +__7: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator) { + goto __9 + } + { + Xsqlite3ExprCode(tls, pParse, (*AggInfo_col)(unsafe.Pointer(pC)).FpCExpr, (*AggInfo_col)(unsafe.Pointer(pC)).FiMem) + + } + goto __8 +__8: + i++ + pC += 32 + goto __7 + goto __9 +__9: + ; + + (*AggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = U8(0) + if addrHitTest != 0 { + Xsqlite3VdbeJumpHereOrPopInst(tls, v, addrHitTest) + } +} + +// Add a single OP_Explain instruction to the VDBE to explain a simple +// count(*) query ("SELECT count(*) FROM pTab"). +func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintptr) { /* sqlite3.c:138061:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { + var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18011, /* "SCAN %s%s%s" */ + libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + func() uintptr { + if bCover != 0 { + return ts + 18023 /* " USING COVERING ..." */ + } + return ts + 756 /* "" */ + }(), + func() uintptr { + if bCover != 0 { + return (*Index)(unsafe.Pointer(pIdx)).FzName + } + return ts + 756 /* "" */ + }())) + } +} + +// sqlite3WalkExpr() callback used by havingToWhere(). +// +// If the node passed to the callback is a TK_AND node, return +// WRC_Continue to tell sqlite3WalkExpr() to iterate through child nodes. +// +// Otherwise, return WRC_Prune. In this case, also check if the +// sub-expression matches the criteria for being moved to the WHERE +// clause. If so, add it to the WHERE clause and replace the sub-expression +// within the HAVING expression with a constant "1". +func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:138090:12: */ + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_AND { + var pS uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && + ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { + var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6914 /* "1" */) + if pNew != 0 { + var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere + { + var t = *(*Expr)(unsafe.Pointer(pNew)) + *(*Expr)(unsafe.Pointer(pNew)) = *(*Expr)(unsafe.Pointer(pExpr)) + *(*Expr)(unsafe.Pointer(pExpr)) = t + } + + pNew = Xsqlite3ExprAnd(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pWhere, pNew) + (*Select)(unsafe.Pointer(pS)).FpWhere = pNew + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(1) + } + } + return WRC_Prune + } + return WRC_Continue +} + +// Transfer eligible terms from the HAVING clause of a query, which is +// processed after grouping, to the WHERE clause, which is processed before +// grouping. For example, the query: +// +// SELECT * FROM WHERE a=? GROUP BY b HAVING b=? AND c=? +// +// can be rewritten as: +// +// SELECT * FROM WHERE a=? AND b=? GROUP BY b HAVING c=? +// +// A term of the HAVING expression is eligible for transfer if it consists +// entirely of constants and expressions that are also GROUP BY terms that +// use the "BINARY" collation sequence. +func havingToWhere(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:138126:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var sWalker Walker at bp, 48 + + libc.Xmemset(tls, bp /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FpParse = pParse + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{havingToWhereExprCb})) + *(*uintptr)(unsafe.Pointer(bp /* &sWalker */ + 40 /* &.u */)) = p + Xsqlite3WalkExpr(tls, bp /* &sWalker */, (*Select)(unsafe.Pointer(p)).FpHaving) +} + +// Check to see if the pThis entry of pTabList is a self-join of a prior view. +// If it is, then return the SrcList_item for the prior view. If it is not, +// then return 0. +func isSelfJoinView(tls *libc.TLS, pTabList uintptr, pThis uintptr) uintptr { /* sqlite3.c:138146:16: */ + var pItem uintptr + + if ((*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pThis)).FpSelect)).FselFlags & U32(SF_PushDown)) != 0 { + return uintptr(0) + } + for pItem = pTabList + 8; /* &.a */ pItem < pThis; pItem += 112 { + var pS1 uintptr + if (*SrcItem)(unsafe.Pointer(pItem)).FpSelect == uintptr(0) { + continue + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pItem + 60 /* &.fg */ + 4 /* &.viaCoroutine */)) & 0x10 >> 4))) != 0 { + continue + } + if (*SrcItem)(unsafe.Pointer(pItem)).FzName == uintptr(0) { + continue + } + + if (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpTab)).FpSchema != (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pThis)).FpTab)).FpSchema { + continue + } + if Xsqlite3_stricmp(tls, (*SrcItem)(unsafe.Pointer(pItem)).FzName, (*SrcItem)(unsafe.Pointer(pThis)).FzName) != 0 { + continue + } + pS1 = (*SrcItem)(unsafe.Pointer(pItem)).FpSelect + if ((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpTab)).FpSchema == uintptr(0)) && ((*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pThis)).FpSelect)).FselId != (*Select)(unsafe.Pointer(pS1)).FselId) { + // The query flattener left two different CTE tables with identical + // names in the same FROM clause. + continue + } + if ((*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselFlags & U32(SF_PushDown)) != 0 { + // The view was modified by some other optimization such as + // pushDownWhereTerms() + continue + } + return pItem + } + return uintptr(0) +} + +// Deallocate a single AggInfo object +func agginfoFree(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:138181:13: */ + Xsqlite3DbFree(tls, db, (*AggInfo)(unsafe.Pointer(p)).FaCol) + Xsqlite3DbFree(tls, db, (*AggInfo)(unsafe.Pointer(p)).FaFunc) + Xsqlite3DbFreeNN(tls, db, p) +} + +// Generate code for the SELECT statement given in the p argument. +// +// The results are returned according to the SelectDest structure. +// See comments in sqliteInt.h for further information. +// +// This routine returns the number of errors. If any errors are +// encountered, then an appropriate error message is left in +// pParse->zErrMsg. +// +// This routine does NOT free the Select structure passed in. The +// calling function needs to do that. +func Xsqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:138287:20: */ + bp := tls.Alloc(216) + defer tls.Free(216) + + var i int32 + var j int32 // Loop counters + var pWInfo uintptr // Return from sqlite3WhereBegin() + var v uintptr // The virtual machine under construction + var isAgg int32 // True for select lists like "count(*)" + var pEList uintptr // List of columns to extract. + var pTabList uintptr // List of tables to select from + var pWhere uintptr // The WHERE clause. May be NULL + var pGroupBy uintptr // The GROUP BY clause. May be NULL + var pHaving uintptr // The HAVING clause. May be NULL + var pAggInfo uintptr // Aggregate information + var rc int32 // Value to return from this function + // var sDistinct DistinctCtx at bp+136, 12 + // Info on how to code the DISTINCT keyword + // var sSort SortCtx at bp+48, 48 + // Info on how to code the ORDER BY clause + var iEnd int32 // Address of the end of the query + var db uintptr // The database connection + // var pMinMaxOrderBy uintptr at bp+208, 8 + // Added ORDER BY for min/max queries + var minMaxFlag U8 + var p1 uintptr + var p0 uintptr + var pItem uintptr + var pSub uintptr + var pTab uintptr + // Implement a co-routine that will return a single row of the result + // set on each invocation. + var addrTop int32 + // This is a CTE for which materialization code has already been + // generated. Invoke the subroutine to compute the materialization, + // the make the pItem->iCursor be a copy of the ephemerial table that + // holds the result of the materialization. + var pCteUse uintptr + var pCteUse1 uintptr + // Materialize the view. If the view is not correlated, generate a + // subroutine to do the materialization so that subsequent uses of + // the same view can reuse the materialization. + var topAddr int32 + var onceAddr int32 + var retAddr int32 + var pItem1 uintptr + var pPrior uintptr + // var dest SelectDest at bp+96, 40 + + var pSub1 uintptr + var zSavedAuthContext uintptr + var pKeyInfo uintptr + var addrGosub int32 + var iCont int32 + var iBreak int32 + var regGosub int32 + // No aggregate functions and no GROUP BY clause + var wctrlFlags U16 + var pWin uintptr + var sortFlags U8 + var ii int32 + var k int32 // Loop counter + var pItem2 uintptr + var pExpr uintptr + var pExpr1 uintptr + var r1 int32 + var pCol uintptr + // Rows are coming out in undetermined order. We have to push + // each row into a sorting index, terminate the first loop, + // then loop over the sorting index in order to get the output + // in sorted order + var regBase int32 + var regRecord int32 + var nCol int32 + var nGroupBy int32 + var pF uintptr + var pKeyInfo1 uintptr // Keying information for the group by clause + var addr1 int32 // A-vs-B comparision jump + var addrOutputRow int32 // Start of subroutine that outputs a result row + var regOutputRow int32 // Return address register for output subroutine + var addrSetAbort int32 // Set the abort flag and return + var addrTopOfLoop int32 // Top of the input loop + var addrSortingIdx int32 // The OP_OpenEphemeral for the sorting index + var addrReset int32 // Subroutine for resetting the accumulator + var regReset int32 // Return address register for reset subroutine + var pDistinct uintptr + var distFlag U16 + var eDist int32 + // If isSimpleCount() returns a pointer to a Table structure, then + // the SQL statement is of the form: + // + // SELECT count(*) FROM + // + // where the Table structure returned represents table . + // + // This statement is so common that it is optimized specially. The + // OP_Count instruction is executed either on the intkey table that + // contains the data for table or on one of its indexes. It + // is better to execute the op on an index, as indexes are almost + // always spread across less pages than their corresponding tables. + var iDb int32 + var iCsr int32 // Cursor to scan b-tree + var pIdx uintptr // Iterator variable + var pKeyInfo2 uintptr // Keyinfo for scanned index + var pBest uintptr // Best index found so far + var iRoot Pgno + var pF1 uintptr + var regAcc int32 // "populate accumulators" flag + var pDistinct1 uintptr + var distFlag1 U16 + var eDist1 int32 + var pTab1 uintptr + // This case when there exist aggregate functions or a GROUP BY clause + // or both + // var sNC NameContext at bp+152, 56 + // Name context for processing aggregate information + var iAMem int32 // First Mem address for storing current GROUP BY + var iBMem int32 // First Mem address for previous GROUP BY + var iUseFlag int32 // Mem address holding flag indicating that at least + // one row of the input to the aggregator has been + // processed + var iAbortFlag int32 // Mem address which causes query abort if positive + var groupBySort int32 // Rows come from source in GROUP BY order + var addrEnd int32 // End of processing for this SELECT + var sortPTab int32 // Pseudotable used to decode sorting results + var sortOut int32 // Output register from the sorter + var orderByGrp int32 + pEList = uintptr(0) + pAggInfo = uintptr(0) + rc = 1 + *(*uintptr)(unsafe.Pointer(bp + 208 /* pMinMaxOrderBy */)) = uintptr(0) // Flag for min/max queries + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + v = Xsqlite3GetVdbe(tls, pParse) + if !(((p == uintptr(0)) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) || ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0)) { + goto __1 + } + return 1 +__1: + ; + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_SELECT, uintptr(0), uintptr(0), uintptr(0)) != 0) { + goto __2 + } + return 1 +__2: + ; + + if !((int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest)) <= SRT_DistQueue) { + goto __3 + } + + // All of these destinations are also able to ignore the ORDER BY clause + if !((*Select)(unsafe.Pointer(p)).FpOrderBy != 0) { + goto __4 + } + Xsqlite3ParserAddCleanup(tls, pParse, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3ExprListDelete})), + (*Select)(unsafe.Pointer(p)).FpOrderBy) + + (*Select)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) +__4: + ; + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_Distinct))) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_NoopOrderBy)) +__3: + ; + Xsqlite3SelectPrep(tls, pParse, p, uintptr(0)) + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __5 + } + goto select_end +__5: + ; + + // If the SF_UpdateFrom flag is set, then this function is being called + // as part of populating the temp table for an UPDATE...FROM statement. + // In this case, it is an error if the target object (pSrc->a[0]) name + // or alias is duplicated within FROM clause (pSrc->a[1..n]). + if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_UpdateFrom)) != 0) { + goto __6 + } + p0 = ((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */) + i = 1 +__7: + if !(i < (*SrcList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpSrc)).FnSrc) { + goto __9 + } + p1 = (((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */) + uintptr(i)*112) + if !(((*SrcItem)(unsafe.Pointer(p0)).FpTab == (*SrcItem)(unsafe.Pointer(p1)).FpTab) && (0 == Xsqlite3_stricmp(tls, (*SrcItem)(unsafe.Pointer(p0)).FzAlias, (*SrcItem)(unsafe.Pointer(p1)).FzAlias))) { + goto __10 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+18046, /* "target object/al..." */ + libc.VaList(bp, func() uintptr { + if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { + return (*SrcItem)(unsafe.Pointer(p0)).FzAlias + } + return (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(p0)).FpTab)).FzName + }())) + goto select_end +__10: + ; + goto __8 +__8: + i++ + goto __7 + goto __9 +__9: + ; +__6: + ; + + if !(int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest) == SRT_Output) { + goto __11 + } + Xsqlite3GenerateColumnNames(tls, pParse, p) +__11: + ; + + if !(Xsqlite3WindowRewrite(tls, pParse, p) != 0) { + goto __12 + } + + goto select_end +__12: + ; + pTabList = (*Select)(unsafe.Pointer(p)).FpSrc + isAgg = (libc.Bool32(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Aggregate)) != U32(0))) + libc.Xmemset(tls, bp+48 /* &sSort */, 0, uint64(unsafe.Sizeof(SortCtx{}))) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy + + // Try to do various optimizations (flattening subqueries, and strength + // reduction of join operators) in the FROM clause up into the main query + i = 0 +__13: + if !(!(int32((*Select)(unsafe.Pointer(p)).FpPrior) != 0) && (i < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc)) { + goto __15 + } + pItem = ((pTabList + 8 /* &.a */) + uintptr(i)*112) + pSub = (*SrcItem)(unsafe.Pointer(pItem)).FpSelect + pTab = (*SrcItem)(unsafe.Pointer(pItem)).FpTab + + // The expander should have already created transient Table objects + // even for FROM clause elements such as subqueries that do not correspond + // to a real table + + // Convert LEFT JOIN into JOIN if there are terms of the right table + // of the LEFT JOIN used in the WHERE clause. + if !((((int32((*SrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype) & JT_LEFT) != 0) && + (Xsqlite3ExprImpliesNonNullRow(tls, (*Select)(unsafe.Pointer(p)).FpWhere, (*SrcItem)(unsafe.Pointer(pItem)).FiCursor) != 0)) && + (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_SimplifyJoin))) == U32(0))) { + goto __16 + } + + *(*U8)(unsafe.Pointer(pItem + 60 /* &.fg */ /* &.jointype */)) &= libc.Uint8FromInt32((libc.CplInt32((JT_LEFT | JT_OUTER)))) + unsetJoinExpr(tls, (*Select)(unsafe.Pointer(p)).FpWhere, (*SrcItem)(unsafe.Pointer(pItem)).FiCursor) +__16: + ; + + // No futher action if this term of the FROM clause is no a subquery + if !(pSub == uintptr(0)) { + goto __17 + } + goto __14 +__17: + ; + + // Catch mismatch in the declared columns of a view and the number of + // columns in the SELECT on the RHS + if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { + goto __18 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18100, /* "expected %d colu..." */ + libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + goto select_end +__18: + ; + + // Do not try to flatten an aggregate subquery. + // + // Flattening an aggregate subquery is only possible if the outer query + // is not a join. But if the outer query is not a join, then the subquery + // will be implemented as a co-routine and there is no advantage to + // flattening in that case. + if !(((*Select)(unsafe.Pointer(pSub)).FselFlags & U32(SF_Aggregate)) != U32(0)) { + goto __19 + } + goto __14 +__19: + ; + + // If the outer query contains a "complex" result set (that is, + // if the result set of the outer query uses functions or subqueries) + // and if the subquery contains an ORDER BY clause and if + // it will be implemented as a co-routine, then do not flatten. This + // restriction allows SQL constructs like this: + // + // SELECT expensive_function(x) + // FROM (SELECT x FROM tab ORDER BY y LIMIT 10); + // + // The expensive_function() is only computed on the 10 rows that + // are output, rather than every row of the table. + // + // The requirement that the outer query have a complex result set + // means that flattening does occur on simpler SQL constraints without + // the expensive_function() like: + // + // SELECT x FROM (SELECT x FROM tab ORDER BY y LIMIT 10); + if !(((((*Select)(unsafe.Pointer(pSub)).FpOrderBy != uintptr(0)) && + (i == 0)) && + (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_ComplexResult)) != U32(0))) && + (((*SrcList)(unsafe.Pointer(pTabList)).FnSrc == 1) || + ((int32((*SrcItem)(unsafe.Pointer((pTabList+8 /* &.a */)+1*112)).Ffg.Fjointype) & (JT_LEFT | JT_CROSS)) != 0))) { + goto __20 + } + goto __14 +__20: + ; + + if !(flattenSubquery(tls, pParse, p, i, isAgg) != 0) { + goto __21 + } + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __22 + } + goto select_end +__22: + ; + // This subquery can be absorbed into its parent. + i = -1 +__21: + ; + pTabList = (*Select)(unsafe.Pointer(p)).FpSrc + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __23 + } + goto select_end +__23: + ; + if !(!((int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest)) <= SRT_Fifo)) { + goto __24 + } + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy +__24: + ; + goto __14 +__14: + i++ + goto __13 + goto __15 +__15: + ; + + // Handle compound SELECT statements using the separate multiSelect() + // procedure. + if !((*Select)(unsafe.Pointer(p)).FpPrior != 0) { + goto __25 + } + rc = multiSelect(tls, pParse, p, pDest) + if !((*Select)(unsafe.Pointer(p)).FpNext == uintptr(0)) { + goto __26 + } + Xsqlite3VdbeExplainPop(tls, pParse) +__26: + ; + return rc +__25: + ; + + // Do the WHERE-clause constant propagation optimization if this is + // a join. No need to speed time on this operation for non-join queries + // as the equivalent optimization will be handled by query planner in + // sqlite3WhereBegin(). + if !(((((*Select)(unsafe.Pointer(p)).FpWhere != uintptr(0)) && + (int32((*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpWhere)).Fop) == TK_AND)) && + (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_PropagateConst))) == U32(0))) && + (propagateConstants(tls, pParse, p) != 0)) { + goto __27 + } + goto __28 +__27: + ; +__28: + ; + + // For each term in the FROM clause, do two things: + // (1) Authorized unreferenced tables + // (2) Generate code for all sub-queries + i = 0 +__29: + if !(i < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc) { + goto __31 + } + pItem1 = ((pTabList + 8 /* &.a */) + uintptr(i)*112) + + // Issue SQLITE_READ authorizations with a fake column name for any + // tables that are referenced but from which no values are extracted. + // Examples of where these kinds of null SQLITE_READ authorizations + // would occur: + // + // SELECT count(*) FROM t1; -- SQLITE_READ t1."" + // SELECT t1.* FROM t1, t2; -- SQLITE_READ t2."" + // + // The fake column name is an empty string. It is possible for a table to + // have a column named by the empty string, in which case there is no way to + // distinguish between an unreferenced table and an actual reference to the + // "" column. The original design was for the fake column name to be a NULL, + // which would be unambiguous. But legacy authorization callbacks might + // assume the column name is non-NULL and segfault. The use of an empty + // string for the fake column name seems safer. + if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { + goto __32 + } + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+756 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) +__32: + ; + + // Generate code for all sub-queries in the FROM clause + pSub1 = (*SrcItem)(unsafe.Pointer(pItem1)).FpSelect + if !(pSub1 == uintptr(0)) { + goto __33 + } + goto __30 +__33: + ; + + // The code for a subquery should only be generated once. + + // Increment Parse.nHeight by the height of the largest expression + // tree referred to by this, the parent select. The child select + // may contain expression trees of at most + // (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit + // more conservative than necessary, but much easier than enforcing + // an exact limit. + *(*int32)(unsafe.Pointer(pParse + 284 /* &.nHeight */)) += (Xsqlite3SelectExprHeight(tls, p)) + + // Make copies of constant WHERE-clause terms in the outer query down + // inside the subquery. This can help the subquery to run more efficiently. + if !(((((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_PushDown))) == U32(0)) && + (((int32(*(*uint16)(unsafe.Pointer((pItem1 + 60 /* &.fg */) + 4 /* &.isCte */)) & 0x80 >> 7)) == 0) || (int32((*CteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 104 /* &.u2 */)))).FeM10d) != M10d_Yes))) && + (pushDownWhereTerms(tls, pParse, pSub1, (*Select)(unsafe.Pointer(p)).FpWhere, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor, + (libc.Bool32((int32((*SrcItem)(unsafe.Pointer(pItem1)).Ffg.Fjointype)&JT_OUTER) != 0))) != 0)) { + goto __34 + } + + goto __35 +__34: + ; +__35: + ; + + zSavedAuthContext = (*Parse)(unsafe.Pointer(pParse)).FzAuthContext + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = (*SrcItem)(unsafe.Pointer(pItem1)).FzName + + // Generate code to implement the subquery + // + // The subquery is implemented as a co-routine if: + // (1) the subquery is guaranteed to be the outer loop (so that + // it does not need to be computed more than once), and + // (2) the subquery is not a CTE that should be materialized + // + // TODO: Are there other reasons beside (1) and (2) to use a co-routine + // implementation? + if !(((i == 0) && + (((*SrcList)(unsafe.Pointer(pTabList)).FnSrc == 1) || + ((int32((*SrcItem)(unsafe.Pointer((pTabList+8 /* &.a */)+1*112)).Ffg.Fjointype) & (JT_LEFT | JT_CROSS)) != 0))) && // (1) + (((int32(*(*uint16)(unsafe.Pointer((pItem1 + 60 /* &.fg */) + 4 /* &.isCte */)) & 0x80 >> 7)) == 0) || (int32((*CteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 104 /* &.u2 */)))).FeM10d) != M10d_Yes))) { + goto __36 + } + // Implement a co-routine that will return a single row of the result + // set on each invocation. + addrTop = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) + + (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) + + (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop + Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18140 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) + (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow + libc.SetBitFieldPtr16Uint32(pItem1+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) + (*SrcItem)(unsafe.Pointer(pItem1)).FregResult = (*SelectDest)(unsafe.Pointer(bp + 96 /* &dest */)).FiSdst + Xsqlite3VdbeEndCoroutine(tls, v, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) + Xsqlite3VdbeJumpHere(tls, v, (addrTop - 1)) + Xsqlite3ClearTempRegCache(tls, pParse) + goto __37 +__36: + if !(((uint32(int32(*(*uint16)(unsafe.Pointer((pItem1 + 60 /* &.fg */) + 4 /* &.isCte */)) & 0x80 >> 7))) != 0) && ((*CteUse)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pItem1 + 104 /* &.u2 */)))).FaddrM9e > 0)) { + goto __38 + } + // This is a CTE for which materialization code has already been + // generated. Invoke the subroutine to compute the materialization, + // the make the pItem->iCursor be a copy of the ephemerial table that + // holds the result of the materialization. + pCteUse = *(*uintptr)(unsafe.Pointer(pItem1 + 104 /* &.u2 */)) + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, (*CteUse)(unsafe.Pointer(pCteUse)).FregRtn, (*CteUse)(unsafe.Pointer(pCteUse)).FaddrM9e) + if !((*SrcItem)(unsafe.Pointer(pItem1)).FiCursor != (*CteUse)(unsafe.Pointer(pCteUse)).FiCur) { + goto __40 + } + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor, (*CteUse)(unsafe.Pointer(pCteUse)).FiCur) +__40: + ; + (*Select)(unsafe.Pointer(pSub1)).FnSelectRow = (*CteUse)(unsafe.Pointer(pCteUse)).FnRowEst + goto __39 +__38: + if !((libc.AssignUintptr(&pPrior, isSelfJoinView(tls, pTabList, pItem1))) != uintptr(0)) { + goto __41 + } + // This view has already been materialized by a prior entry in + // this same FROM clause. Reuse it. + if !((*SrcItem)(unsafe.Pointer(pPrior)).FaddrFillSub != 0) { + goto __43 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, (*SrcItem)(unsafe.Pointer(pPrior)).FregReturn, (*SrcItem)(unsafe.Pointer(pPrior)).FaddrFillSub) +__43: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor, (*SrcItem)(unsafe.Pointer(pPrior)).FiCursor) + (*Select)(unsafe.Pointer(pSub1)).FnSelectRow = (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pPrior)).FpSelect)).FnSelectRow + goto __42 +__41: + onceAddr = 0 + + (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + topAddr = Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) + (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = (topAddr + 1) + if !((int32(*(*uint16)(unsafe.Pointer((pItem1 + 60 /* &.fg */) + 4 /* &.isCorrelated */)) & 0x8 >> 3)) == 0) { + goto __44 + } + // If the subquery is not correlated and if we are not inside of + // a trigger, then we only need to compute the value of the subquery + // once. + onceAddr = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + + goto __45 +__44: + ; +__45: + ; + Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18155 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) + (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow + if !(onceAddr != 0) { + goto __46 + } + Xsqlite3VdbeJumpHere(tls, v, onceAddr) +__46: + ; + retAddr = Xsqlite3VdbeAddOp1(tls, v, OP_Return, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) + + Xsqlite3VdbeChangeP1(tls, v, topAddr, retAddr) + Xsqlite3ClearTempRegCache(tls, pParse) + if !(((uint32(int32(*(*uint16)(unsafe.Pointer((pItem1 + 60 /* &.fg */) + 4 /* &.isCte */)) & 0x80 >> 7))) != 0) && ((int32(*(*uint16)(unsafe.Pointer((pItem1 + 60 /* &.fg */) + 4 /* &.isCorrelated */)) & 0x8 >> 3)) == 0)) { + goto __47 + } + pCteUse1 = *(*uintptr)(unsafe.Pointer(pItem1 + 104 /* &.u2 */)) + (*CteUse)(unsafe.Pointer(pCteUse1)).FaddrM9e = (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub + (*CteUse)(unsafe.Pointer(pCteUse1)).FregRtn = (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn + (*CteUse)(unsafe.Pointer(pCteUse1)).FiCur = (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor + (*CteUse)(unsafe.Pointer(pCteUse1)).FnRowEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow +__47: + ; +__42: + ; +__39: + ; +__37: + ; + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __48 + } + goto select_end +__48: + ; + *(*int32)(unsafe.Pointer(pParse + 284 /* &.nHeight */)) -= (Xsqlite3SelectExprHeight(tls, p)) + (*Parse)(unsafe.Pointer(pParse)).FzAuthContext = zSavedAuthContext + goto __30 +__30: + i++ + goto __29 + goto __31 +__31: + ; + + // Various elements of the SELECT copied into local variables for + // convenience + pEList = (*Select)(unsafe.Pointer(p)).FpEList + pWhere = (*Select)(unsafe.Pointer(p)).FpWhere + pGroupBy = (*Select)(unsafe.Pointer(p)).FpGroupBy + pHaving = (*Select)(unsafe.Pointer(p)).FpHaving + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FisTnct = (U8(libc.Bool32(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != U32(0)))) + + // If the query is DISTINCT with an ORDER BY but is not an aggregate, and + // if the select-list is the same as the ORDER BY list, then this query + // can be rewritten as a GROUP BY. In other words, this: + // + // SELECT DISTINCT xyz FROM ... ORDER BY xyz + // + // is transformed to: + // + // SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz + // + // The second form is preferred as a single index (or temp-table) may be + // used for both the ORDER BY and DISTINCT processing. As originally + // written the query must use a temp-table for at least one of the ORDER + // BY and DISTINCT, and an index or separate temp-table for the other. + if !(((((*Select)(unsafe.Pointer(p)).FselFlags & (U32(SF_Distinct | SF_Aggregate))) == U32(SF_Distinct)) && + (Xsqlite3ExprListCompare(tls, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, pEList, -1) == 0)) && + ((*Select)(unsafe.Pointer(p)).FpWin == uintptr(0))) { + goto __49 + } + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_Distinct))) + pGroupBy = libc.AssignPtrUintptr(p+56 /* &.pGroupBy */, Xsqlite3ExprListDup(tls, db, pEList, 0)) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_Aggregate)) + // Notice that even thought SF_Distinct has been cleared from p->selFlags, + // the sDistinct.isTnct is still set. Hence, isTnct represents the + // original setting of the SF_Distinct flag, not the current setting + +__49: + ; + + // If there is an ORDER BY clause, then create an ephemeral index to + // do the sorting. But this sorting ephemeral index might end up + // being unused if the data can be extracted in pre-sorted order. + // If that is the case, then the OP_OpenEphemeral instruction will be + // changed to an OP_Noop once we figure out that the sorting index is + // not needed. The sSort.addrSortIndex variable is used to facilitate + // that change. + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) { + goto __50 + } + pKeyInfo = Xsqlite3KeyInfoFromExprList(tls, + pParse, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, 0, (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FiECursor = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FaddrSortIndex = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, + (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FiECursor, (((*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy)).FnExpr + 1) + (*ExprList)(unsafe.Pointer(pEList)).FnExpr), 0, + pKeyInfo, -9) + goto __51 +__50: + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FaddrSortIndex = -1 +__51: + ; + + // If the output is destined for a temporary table, open that table. + if !(int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest) == SRT_EphemTab) { + goto __52 + } + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*SelectDest)(unsafe.Pointer(pDest)).FiSDParm, (*ExprList)(unsafe.Pointer(pEList)).FnExpr) +__52: + ; + + // Set the limiter. + iEnd = Xsqlite3VdbeMakeLabel(tls, pParse) + if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_FixedLimit)) == U32(0)) { + goto __53 + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = int16(320) // 4 billion rows +__53: + ; + computeLimitRegisters(tls, pParse, p, iEnd) + if !(((*Select)(unsafe.Pointer(p)).FiLimit == 0) && ((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex >= 0)) { + goto __54 + } + Xsqlite3VdbeChangeOpcode(tls, v, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex, uint8(OP_SorterOpen)) + *(*U8)(unsafe.Pointer(bp + 48 /* &sSort */ + 36 /* &.sortFlags */)) |= U8((SORTFLAG_UseSorter)) +__54: + ; + + // Open an ephemeral index to use for the distinct set. + if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != 0) { + goto __55 + } + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FtabTnct = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FaddrTnct = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, + (*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FtabTnct, 0, 0, + Xsqlite3KeyInfoFromExprList(tls, pParse, (*Select)(unsafe.Pointer(p)).FpEList, 0, 0), + -9) + Xsqlite3VdbeChangeP5(tls, v, uint16(BTREE_UNORDERED)) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FeTnctType = U8(WHERE_DISTINCT_UNORDERED) + goto __56 +__55: + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FeTnctType = U8(WHERE_DISTINCT_NOOP) +__56: + ; + + if !(!(isAgg != 0) && (pGroupBy == uintptr(0))) { + goto __57 + } + // No aggregate functions and no GROUP BY clause + wctrlFlags = (U16((func() uint32 { + if (*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0 { + return uint32(WHERE_WANT_DISTINCT) + } + return uint32(0) + }()) | + ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_FixedLimit)))) + pWin = (*Select)(unsafe.Pointer(p)).FpWin // Main window object (or NULL) + if !(pWin != 0) { + goto __59 + } + Xsqlite3WindowCodeInit(tls, pParse, p) +__59: + ; + + // Begin the database scan. + + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, + (*Select)(unsafe.Pointer(p)).FpEList, wctrlFlags, int32((*Select)(unsafe.Pointer(p)).FnSelectRow)) + if !(pWInfo == uintptr(0)) { + goto __60 + } + goto select_end +__60: + ; + if !(int32(Xsqlite3WhereOutputRowCount(tls, pWInfo)) < int32((*Select)(unsafe.Pointer(p)).FnSelectRow)) { + goto __61 + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3WhereOutputRowCount(tls, pWInfo) +__61: + ; + if !(((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (Xsqlite3WhereIsDistinct(tls, pWInfo) != 0)) { + goto __62 + } + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FeTnctType = U8(Xsqlite3WhereIsDistinct(tls, pWInfo)) +__62: + ; + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) { + goto __63 + } + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FnOBSat = Xsqlite3WhereIsOrdered(tls, pWInfo) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FlabelOBLopt = Xsqlite3WhereOrderByLimitOptLabel(tls, pWInfo) + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat == (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy)).FnExpr) { + goto __64 + } + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = uintptr(0) +__64: + ; +__63: + ; + + // If sorting index that was created by a prior OP_OpenEphemeral + // instruction ended up not being needed, then change the OP_OpenEphemeral + // into an OP_Noop. + if !(((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex >= 0) && ((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy == uintptr(0))) { + goto __65 + } + Xsqlite3VdbeChangeToNoop(tls, v, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex) +__65: + ; + + if !(pWin != 0) { + goto __66 + } + addrGosub = Xsqlite3VdbeMakeLabel(tls, pParse) + iCont = Xsqlite3VdbeMakeLabel(tls, pParse) + iBreak = Xsqlite3VdbeMakeLabel(tls, pParse) + regGosub = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + + Xsqlite3WindowCodeStep(tls, pParse, p, pWInfo, regGosub, addrGosub) + + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, iBreak) + Xsqlite3VdbeResolveLabel(tls, v, addrGosub) + + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FlabelOBLopt = 0 + selectInnerLoop(tls, pParse, p, -1, bp+48 /* &sSort */, bp+136 /* &sDistinct */, pDest, iCont, iBreak) + Xsqlite3VdbeResolveLabel(tls, v, iCont) + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regGosub) + + Xsqlite3VdbeResolveLabel(tls, v, iBreak) + goto __67 +__66: + + // Use the standard inner loop. + selectInnerLoop(tls, pParse, p, -1, bp+48 /* &sSort */, bp+136 /* &sDistinct */, pDest, + Xsqlite3WhereContinueLabel(tls, pWInfo), + Xsqlite3WhereBreakLabel(tls, pWInfo)) + + // End the database scan loop. + + Xsqlite3WhereEnd(tls, pWInfo) +__67: + ; + goto __58 +__57: // End of processing for this SELECT + sortPTab = 0 // Pseudotable used to decode sorting results + sortOut = 0 // Output register from the sorter + orderByGrp = 0 // True if the GROUP BY and ORDER BY are the same + + // Remove any and all aliases between the result set and the + // GROUP BY clause. + if !(pGroupBy != 0) { + goto __68 + } // For looping over expression in a list + + k = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr + pItem2 = (*Select)(unsafe.Pointer(p)).FpEList + 8 /* &.a */ +__70: + if !(k > 0) { + goto __72 + } + *(*U16)(unsafe.Pointer(pItem2 + 24 /* &.u */ /* &.x */ + 2 /* &.iAlias */)) = U16(0) + goto __71 +__71: + k-- + pItem2 += 32 + goto __70 + goto __72 +__72: + ; + k = (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr + pItem2 = pGroupBy + 8 /* &.a */ +__73: + if !(k > 0) { + goto __75 + } + *(*U16)(unsafe.Pointer(pItem2 + 24 /* &.u */ /* &.x */ + 2 /* &.iAlias */)) = U16(0) + goto __74 +__74: + k-- + pItem2 += 32 + goto __73 + goto __75 +__75: + ; + + if !(int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > 66) { + goto __76 + } + (*Select)(unsafe.Pointer(p)).FnSelectRow = int16(66) +__76: + ; + + // If there is both a GROUP BY and an ORDER BY clause and they are + // identical, then it may be possible to disable the ORDER BY clause + // on the grounds that the GROUP BY will cause elements to come out + // in the correct order. It also may not - the GROUP BY might use a + // database index that causes rows to be grouped together as required + // but not actually sorted. Either way, record the fact that the + // ORDER BY and GROUP BY clauses are the same by setting the orderByGrp + // variable. + if !(((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) && ((*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr == (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy)).FnExpr)) { + goto __77 + } + // The GROUP BY processing doesn't care whether rows are delivered in + // ASC or DESC order - only that each group is returned contiguously. + // So set the ASC/DESC flags in the GROUP BY to match those in the + // ORDER BY to maximize the chances of rows being delivered in an + // order that makes the ORDER BY redundant. + ii = 0 +__78: + if !(ii < (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + goto __80 + } + sortFlags = (U8(int32((*ExprList_item)(unsafe.Pointer(((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy+8 /* &.a */)+uintptr(ii)*32)).FsortFlags) & KEYINFO_ORDER_DESC)) + (*ExprList_item)(unsafe.Pointer((pGroupBy + 8 /* &.a */) + uintptr(ii)*32)).FsortFlags = sortFlags + goto __79 +__79: + ii++ + goto __78 + goto __80 +__80: + ; + if !(Xsqlite3ExprListCompare(tls, pGroupBy, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, -1) == 0) { + goto __81 + } + orderByGrp = 1 +__81: + ; +__77: + ; + goto __69 +__68: + ; + (*Select)(unsafe.Pointer(p)).FnSelectRow = int16(0) +__69: + ; + + // Create a label to jump to when we want to abort the query + addrEnd = Xsqlite3VdbeMakeLabel(tls, pParse) + + // Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in + // sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the + // SELECT statement. + pAggInfo = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(AggInfo{}))) + if !(pAggInfo != 0) { + goto __82 + } + Xsqlite3ParserAddCleanup(tls, pParse, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{agginfoFree})), pAggInfo) + +__82: + ; + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __83 + } + goto select_end +__83: + ; + (*AggInfo)(unsafe.Pointer(pAggInfo)).FselId = (*Select)(unsafe.Pointer(p)).FselId + libc.Xmemset(tls, bp+152 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 152 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 152 /* &sNC */)).FpSrcList = pTabList + *(*uintptr)(unsafe.Pointer(bp + 152 /* &sNC */ + 16 /* &.uNC */)) = pAggInfo + + (*AggInfo)(unsafe.Pointer(pAggInfo)).FmnReg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + (*AggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = func() int32 { + if pGroupBy != 0 { + return (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr + } + return 0 + }() + (*AggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy = pGroupBy + Xsqlite3ExprAnalyzeAggList(tls, bp+152 /* &sNC */, pEList) + Xsqlite3ExprAnalyzeAggList(tls, bp+152 /* &sNC */, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy) + if !(pHaving != 0) { + goto __84 + } + if !(pGroupBy != 0) { + goto __85 + } + + havingToWhere(tls, pParse, p) + pWhere = (*Select)(unsafe.Pointer(p)).FpWhere +__85: + ; + Xsqlite3ExprAnalyzeAggregates(tls, bp+152 /* &sNC */, pHaving) +__84: + ; + (*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator = (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn + if !((((*Select)(unsafe.Pointer(p)).FpGroupBy == uintptr(0)) && ((*Select)(unsafe.Pointer(p)).FpHaving == uintptr(0))) && ((*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == 1)) { + goto __86 + } + minMaxFlag = minMaxQuery(tls, db, (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFExpr, bp+208 /* &pMinMaxOrderBy */) + goto __87 +__86: + minMaxFlag = U8(WHERE_ORDERBY_NORMAL) +__87: + ; + i = 0 +__88: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __90 + } + pExpr = (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32)).FpFExpr + + *(*int32)(unsafe.Pointer(bp + 152 /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_InAggFunc) + Xsqlite3ExprAnalyzeAggList(tls, bp+152 /* &sNC */, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + goto __91 + } + Xsqlite3ExprAnalyzeAggregates(tls, bp+152 /* &sNC */, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpFilter) +__91: + ; + *(*int32)(unsafe.Pointer(bp + 152 /* &sNC */ + 40 /* &.ncFlags */)) &= (libc.CplInt32(NC_InAggFunc)) + goto __89 +__89: + i++ + goto __88 + goto __90 +__90: + ; + (*AggInfo)(unsafe.Pointer(pAggInfo)).FmxReg = (*Parse)(unsafe.Pointer(pParse)).FnMem + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __92 + } + goto select_end +__92: + ; + + // Processing for aggregates with GROUP BY is very different and + // much more complex than aggregates without a GROUP BY. + if !(pGroupBy != 0) { + goto __93 + } // Return address register for reset subroutine + pDistinct = uintptr(0) + distFlag = U16(0) + eDist = WHERE_DISTINCT_NOOP + + if !((((*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == 1) && + ((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FiDistinct >= 0)) && + (*(*uintptr)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFExpr + 32 /* &.x */)) != 0)) { + goto __95 + } + pExpr1 = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFExpr + 32 /* &.x */)) + 8 /* &.a */))).FpExpr + pExpr1 = Xsqlite3ExprDup(tls, db, pExpr1, 0) + pDistinct = Xsqlite3ExprListDup(tls, db, pGroupBy, 0) + pDistinct = Xsqlite3ExprListAppend(tls, pParse, pDistinct, pExpr1) + if pDistinct != 0 { + distFlag = (uint16(WHERE_WANT_DISTINCT | WHERE_AGG_DISTINCT)) + } else { + distFlag = uint16(0) + } +__95: + ; + + // If there is a GROUP BY clause we might need a sorting index to + // implement it. Allocate that sorting index now. If it turns out + // that we do not need it after all, the OP_SorterOpen instruction + // will be converted into a Noop. + (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + pKeyInfo1 = Xsqlite3KeyInfoFromExprList(tls, pParse, pGroupBy, + 0, (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) + addrSortingIdx = Xsqlite3VdbeAddOp4(tls, v, OP_SorterOpen, + (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, (*AggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn, + 0, pKeyInfo1, -9) + + // Initialize memory locations used by GROUP BY aggregate processing + iUseFlag = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + iAbortFlag = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regOutputRow = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + addrOutputRow = Xsqlite3VdbeMakeLabel(tls, pParse) + regReset = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + addrReset = Xsqlite3VdbeMakeLabel(tls, pParse) + iAMem = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += ((*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) + iBMem = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += ((*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, iAbortFlag) + + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, iAMem, ((iAMem + (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) - 1)) + + // Begin a loop that will extract all source rows in GROUP BY order. + // This might involve two separate loops with an OP_Sort in between, or + // it might be a single loop that uses an index to extract information + // in the right order to begin with. + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regReset, addrReset) + + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, pGroupBy, pDistinct, + (uint16((WHERE_GROUPBY | (func() int32 { + if orderByGrp != 0 { + return WHERE_SORTBYGROUP + } + return 0 + }())) | int32(distFlag))), 0) + if !(pWInfo == uintptr(0)) { + goto __96 + } + Xsqlite3ExprListDelete(tls, db, pDistinct) + goto select_end +__96: + ; + eDist = Xsqlite3WhereIsDistinct(tls, pWInfo) + + if !(Xsqlite3WhereIsOrdered(tls, pWInfo) == (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + goto __97 + } + // The optimizer is able to deliver rows in group by order so + // we do not have to sort. The OP_OpenEphemeral table will be + // cancelled later because we still need to use the pKeyInfo + groupBySort = 0 + goto __98 +__97: + + explainTempTable(tls, pParse, + func() uintptr { + if ((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { + return ts + 18171 /* "DISTINCT" */ + } + return ts + 18180 /* "GROUP BY" */ + }()) + + groupBySort = 1 + nGroupBy = (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr + nCol = nGroupBy + j = nGroupBy + i = 0 +__99: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + goto __101 + } + if !(int32((*AggInfo_col)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol+uintptr(i)*32)).FiSorterColumn) >= j) { + goto __102 + } + nCol++ + j++ +__102: + ; + goto __100 +__100: + i++ + goto __99 + goto __101 +__101: + ; + regBase = Xsqlite3GetTempRange(tls, pParse, nCol) + Xsqlite3ExprCodeExprList(tls, pParse, pGroupBy, regBase, 0, uint8(0)) + j = nGroupBy + i = 0 +__103: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn) { + goto __105 + } + pCol = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FaCol + uintptr(i)*32) + if !(int32((*AggInfo_col)(unsafe.Pointer(pCol)).FiSorterColumn) >= j) { + goto __106 + } + r1 = (j + regBase) + Xsqlite3ExprCodeGetColumnOfTable(tls, v, + (*AggInfo_col)(unsafe.Pointer(pCol)).FpTab, (*AggInfo_col)(unsafe.Pointer(pCol)).FiTable, int32((*AggInfo_col)(unsafe.Pointer(pCol)).FiColumn), r1) + j++ +__106: + ; + goto __104 +__104: + i++ + goto __103 + goto __105 +__105: + ; + regRecord = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regBase, nCol, regRecord) + Xsqlite3VdbeAddOp2(tls, v, OP_SorterInsert, (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, regRecord) + Xsqlite3ReleaseTempReg(tls, pParse, regRecord) + Xsqlite3ReleaseTempRange(tls, pParse, regBase, nCol) + + Xsqlite3WhereEnd(tls, pWInfo) + (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdxPTab = libc.AssignInt32(&sortPTab, libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1)) + sortOut = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_OpenPseudo, sortPTab, sortOut, nCol) + Xsqlite3VdbeAddOp2(tls, v, OP_SorterSort, (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, addrEnd) + + (*AggInfo)(unsafe.Pointer(pAggInfo)).FuseSortingIdx = U8(1) +__98: + ; + + // If the index or temporary table used by the GROUP BY sort + // will naturally deliver rows in the order required by the ORDER BY + // clause, cancel the ephemeral table open coded earlier. + // + // This is an optimization - the correct answer should result regardless. + // Use the SQLITE_GroupByOrder flag with SQLITE_TESTCTRL_OPTIMIZER to + // disable this optimization for testing purposes. + if !(((orderByGrp != 0) && (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_GroupByOrder))) == U32(0))) && + ((groupBySort != 0) || (Xsqlite3WhereIsSorted(tls, pWInfo) != 0))) { + goto __107 + } + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = uintptr(0) + Xsqlite3VdbeChangeToNoop(tls, v, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex) +__107: + ; + + // Evaluate the current GROUP BY terms and store in b0, b1, b2... + // (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth) + // Then compare the current GROUP BY terms against the GROUP BY terms + // from the previous row currently stored in a0, a1, a2... + addrTopOfLoop = Xsqlite3VdbeCurrentAddr(tls, v) + if !(groupBySort != 0) { + goto __108 + } + Xsqlite3VdbeAddOp3(tls, v, OP_SorterData, (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, + sortOut, sortPTab) +__108: + ; + j = 0 +__109: + if !(j < (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { + goto __111 + } + if !(groupBySort != 0) { + goto __112 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, sortPTab, j, (iBMem + j)) + goto __113 +__112: + (*AggInfo)(unsafe.Pointer(pAggInfo)).FdirectMode = U8(1) + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pGroupBy+8 /* &.a */)+uintptr(j)*32)).FpExpr, (iBMem + j)) +__113: + ; + goto __110 +__110: + j++ + goto __109 + goto __111 +__111: + ; + Xsqlite3VdbeAddOp4(tls, v, OP_Compare, iAMem, iBMem, (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr, + Xsqlite3KeyInfoRef(tls, pKeyInfo1), -9) + addr1 = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, (addr1 + 1), 0, (addr1 + 1)) + + // Generate code that runs whenever the GROUP BY changes. + // Changes in the GROUP BY are detected by the previous code + // block. If there were no changes, this block is skipped. + // + // This code copies current group by terms in b0,b1,b2,... + // over to a0,a1,a2. It then calls the output subroutine + // and resets the aggregate accumulator registers in preparation + // for the next GROUP BY batch. + Xsqlite3ExprCodeMove(tls, pParse, iBMem, iAMem, (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regOutputRow, addrOutputRow) + + Xsqlite3VdbeAddOp2(tls, v, OP_IfPos, iAbortFlag, addrEnd) + + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regReset, addrReset) + + // Update the aggregate accumulators based on the content of + // the current row + Xsqlite3VdbeJumpHere(tls, v, addr1) + updateAccumulator(tls, pParse, iUseFlag, pAggInfo, eDist) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, iUseFlag) + + // End of the loop + if !(groupBySort != 0) { + goto __114 + } + Xsqlite3VdbeAddOp2(tls, v, OP_SorterNext, (*AggInfo)(unsafe.Pointer(pAggInfo)).FsortingIdx, addrTopOfLoop) + + goto __115 +__114: + ; + Xsqlite3WhereEnd(tls, pWInfo) + Xsqlite3VdbeChangeToNoop(tls, v, addrSortingIdx) +__115: + ; + Xsqlite3ExprListDelete(tls, db, pDistinct) + + // Output the final row of result + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regOutputRow, addrOutputRow) + + // Jump over the subroutines + Xsqlite3VdbeGoto(tls, v, addrEnd) + + // Generate a subroutine that outputs a single row of the result + // set. This subroutine first looks at the iUseFlag. If iUseFlag + // is less than or equal to zero, the subroutine is a no-op. If + // the processing calls for the query to abort, this subroutine + // increments the iAbortFlag memory location before returning in + // order to signal the caller to abort. + addrSetAbort = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, iAbortFlag) + + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regOutputRow) + Xsqlite3VdbeResolveLabel(tls, v, addrOutputRow) + addrOutputRow = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp2(tls, v, OP_IfPos, iUseFlag, (addrOutputRow + 2)) + + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regOutputRow) + finalizeAggFunctions(tls, pParse, pAggInfo) + Xsqlite3ExprIfFalse(tls, pParse, pHaving, (addrOutputRow + 1), SQLITE_JUMPIFNULL) + selectInnerLoop(tls, pParse, p, -1, bp+48, /* &sSort */ + bp+136 /* &sDistinct */, pDest, + (addrOutputRow + 1), addrSetAbort) + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regOutputRow) + + // Generate a subroutine that will reset the group-by accumulator + Xsqlite3VdbeResolveLabel(tls, v, addrReset) + resetAccumulator(tls, pParse, pAggInfo) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, iUseFlag) + + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regReset) + + if !(eDist != WHERE_DISTINCT_NOOP) { + goto __116 + } + pF = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc) + fixDistinctOpenEph(tls, pParse, eDist, (*AggInfo_func)(unsafe.Pointer(pF)).FiDistinct, (*AggInfo_func)(unsafe.Pointer(pF)).FiDistAddr) +__116: + ; + goto __94 +__93: + if !((libc.AssignUintptr(&pTab1, isSimpleCount(tls, p, pAggInfo))) != uintptr(0)) { + goto __117 + } + // If isSimpleCount() returns a pointer to a Table structure, then + // the SQL statement is of the form: + // + // SELECT count(*) FROM + // + // where the Table structure returned represents table . + // + // This statement is so common that it is optimized specially. The + // OP_Count instruction is executed either on the intkey table that + // contains the data for table or on one of its indexes. It + // is better to execute the op on an index, as indexes are almost + // always spread across less pages than their corresponding tables. + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab1)).FpSchema) + iCsr = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) // Iterator variable + pKeyInfo2 = uintptr(0) // Keyinfo for scanned index + pBest = uintptr(0) // Best index found so far + iRoot = (*Table)(unsafe.Pointer(pTab1)).Ftnum // Root page of scanned b-tree + + Xsqlite3CodeVerifySchema(tls, pParse, iDb) + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab1)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pTab1)).FzName) + + // Search for the index that has the lowest scan cost. + // + // (2011-04-15) Do not do a full scan of an unordered index. + // + // (2013-10-03) Do not count the entries in a partial index. + // + // In practice the KeyInfo structure will not be used. It is only + // passed to keep OP_OpenRead happy. + if !(!(((*Table)(unsafe.Pointer((pTab1))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __119 + } + pBest = Xsqlite3PrimaryKeyIndex(tls, pTab1) +__119: + ; + if !(!((int32(*(*uint16)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */) + 60 /* &.fg */ + 4 /* &.notIndexed */)) & 0x1 >> 0)) != 0)) { + goto __120 + } + pIdx = (*Table)(unsafe.Pointer(pTab1)).FpIndex +__121: + if !(pIdx != 0) { + goto __123 + } + if !(((((int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.bUnordered */)) & 0x4 >> 2)) == 0) && + (int32((*Index)(unsafe.Pointer(pIdx)).FszIdxRow) < int32((*Table)(unsafe.Pointer(pTab1)).FszTabRow))) && + ((*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0))) && + (!(pBest != 0) || (int32((*Index)(unsafe.Pointer(pIdx)).FszIdxRow) < int32((*Index)(unsafe.Pointer(pBest)).FszIdxRow)))) { + goto __124 + } + pBest = pIdx +__124: + ; + goto __122 +__122: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + goto __121 + goto __123 +__123: + ; +__120: + ; + if !(pBest != 0) { + goto __125 + } + iRoot = (*Index)(unsafe.Pointer(pBest)).Ftnum + pKeyInfo2 = Xsqlite3KeyInfoOfIndex(tls, pParse, pBest) +__125: + ; + + // Open a read-only cursor, execute the OP_Count, close the cursor. + Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenRead, iCsr, int32(iRoot), iDb, 1) + if !(pKeyInfo2 != 0) { + goto __126 + } + Xsqlite3VdbeChangeP4(tls, v, -1, pKeyInfo2, -9) +__126: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Count, iCsr, (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FiMem) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iCsr) + explainSimpleCount(tls, pParse, pTab1, pBest) + goto __118 +__117: + regAcc = 0 // "populate accumulators" flag + pDistinct1 = uintptr(0) + distFlag1 = U16(0) + + // If there are accumulator registers but no min() or max() functions + // without FILTER clauses, allocate register regAcc. Register regAcc + // will contain 0 the first time the inner loop runs, and 1 thereafter. + // The code generated by updateAccumulator() uses this to ensure + // that the accumulator registers are (a) updated only once if + // there are no min() or max functions or (b) always updated for the + // first row visited by the aggregate, so that they are updated at + // least once even if the FILTER clause means the min() or max() + // function visits zero rows. + if !((*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator != 0) { + goto __127 + } + i = 0 +__129: + if !(i < (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __131 + } + if !(((*Expr)(unsafe.Pointer(((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32)).FpFExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + goto __132 + } + goto __130 +__132: + ; + if !(((*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc+uintptr(i)*32)).FpFunc)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != 0) { + goto __133 + } + goto __131 +__133: + ; + goto __130 +__130: + i++ + goto __129 + goto __131 +__131: + ; + if !(i == (*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc) { + goto __134 + } + regAcc = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regAcc) +__134: + ; + goto __128 +__127: + if !(((*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == 1) && ((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FiDistinct >= 0)) { + goto __135 + } + pDistinct1 = *(*uintptr)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFExpr + 32 /* &.x */)) + if pDistinct1 != 0 { + distFlag1 = (uint16(WHERE_WANT_DISTINCT | WHERE_AGG_DISTINCT)) + } else { + distFlag1 = uint16(0) + } +__135: + ; +__128: + ; + + // This case runs if the aggregate has no GROUP BY clause. The + // processing is much simpler since there is only a single row + // of output. + + resetAccumulator(tls, pParse, pAggInfo) + + // If this query is a candidate for the min/max optimization, then + // minMaxFlag will have been previously set to either + // WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX and pMinMaxOrderBy will + // be an appropriate ORDER BY expression for the optimization. + + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, *(*uintptr)(unsafe.Pointer(bp + 208 /* pMinMaxOrderBy */)), + pDistinct1, (uint16(int32(minMaxFlag) | int32(distFlag1))), 0) + if !(pWInfo == uintptr(0)) { + goto __136 + } + goto select_end +__136: + ; + + eDist1 = Xsqlite3WhereIsDistinct(tls, pWInfo) + updateAccumulator(tls, pParse, regAcc, pAggInfo, eDist1) + if !(eDist1 != WHERE_DISTINCT_NOOP) { + goto __137 + } + pF1 = ((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc) + fixDistinctOpenEph(tls, pParse, eDist1, (*AggInfo_func)(unsafe.Pointer(pF1)).FiDistinct, (*AggInfo_func)(unsafe.Pointer(pF1)).FiDistAddr) +__137: + ; + + if !(regAcc != 0) { + goto __138 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, regAcc) +__138: + ; + if !(minMaxFlag != 0) { + goto __139 + } + Xsqlite3WhereMinMaxOptEarlyOut(tls, v, pWInfo) +__139: + ; + + Xsqlite3WhereEnd(tls, pWInfo) + finalizeAggFunctions(tls, pParse, pAggInfo) +__118: + ; + + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = uintptr(0) + Xsqlite3ExprIfFalse(tls, pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL) + selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), + pDest, addrEnd, addrEnd) +__94: + ; + Xsqlite3VdbeResolveLabel(tls, v, addrEnd) + +__58: + ; // endif aggregate query + + if !(int32((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { + goto __140 + } + explainTempTable(tls, pParse, ts+18171 /* "DISTINCT" */) +__140: + ; + + // If there is an ORDER BY clause, then we need to sort the results + // and send them to the callback one by one. + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) { + goto __141 + } + explainTempTable(tls, pParse, + func() uintptr { + if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { + return ts + 18189 /* "RIGHT PART OF OR..." */ + } + return ts + 18212 /* "ORDER BY" */ + }()) + + generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) +__141: + ; + + // Jump here to skip this query + Xsqlite3VdbeResolveLabel(tls, v, iEnd) + + // The SELECT has been coded. If there is an error in the Parse structure, + // set the return code to 1. Otherwise 0. + rc = (libc.Bool32((*Parse)(unsafe.Pointer(pParse)).FnErr > 0)) + + // Control jumps to here if an error is encountered above, or upon + // successful coding of the SELECT. +select_end: + ; + *(*int32)(unsafe.Pointer(pParse + 48 /* &.nErr */)) += (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed)) + Xsqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 208 /* pMinMaxOrderBy */))) + + Xsqlite3VdbeExplainPop(tls, pParse) + return rc +} + +//************* End of select.c ********************************************* +//************* Begin file table.c ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the sqlite3_get_table() and sqlite3_free_table() +// interface routines. These are just wrappers around the main +// interface routine of sqlite3_exec(). +// +// These routines are in a separate files so that they will not be linked +// if they are not used. +// #include "sqliteInt.h" + +// This structure is used to pass data from sqlite3_get_table() through +// to the callback function is uses to build the result. +type TabResult1 = struct { + FazResult uintptr + FzErrMsg uintptr + FnAlloc U32 + FnRow U32 + FnColumn U32 + FnData U32 + Frc int32 + _ [4]byte +} /* sqlite3.c:139498:9 */ + +//************* End of select.c ********************************************* +//************* Begin file table.c ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the sqlite3_get_table() and sqlite3_free_table() +// interface routines. These are just wrappers around the main +// interface routine of sqlite3_exec(). +// +// These routines are in a separate files so that they will not be linked +// if they are not used. +// #include "sqliteInt.h" + +// This structure is used to pass data from sqlite3_get_table() through +// to the callback function is uses to build the result. +type TabResult = TabResult1 /* sqlite3.c:139506:3 */ + +// This routine is called once for each row in the result table. Its job +// is to fill in the TabResult structure appropriately, allocating new +// memory as necessary. +func sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr, colv uintptr) int32 { /* sqlite3.c:139513:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr // Result accumulator + var need int32 // Slots needed in p->azResult[] + var i int32 // Loop counter + var z uintptr + var azNew uintptr + var n int32 + p = pArg // A single column of result + + // Make sure there is enough space in p->azResult to hold everything + // we need to remember from this invocation of the callback. + if !(((*TabResult)(unsafe.Pointer(p)).FnRow == U32(0)) && (argv != uintptr(0))) { + goto __1 + } + need = (nCol * 2) + goto __2 +__1: + need = nCol +__2: + ; + if !(((*TabResult)(unsafe.Pointer(p)).FnData + U32(need)) > (*TabResult)(unsafe.Pointer(p)).FnAlloc) { + goto __3 + } + (*TabResult)(unsafe.Pointer(p)).FnAlloc = (((*TabResult)(unsafe.Pointer(p)).FnAlloc * U32(2)) + U32(need)) + azNew = Xsqlite3Realloc(tls, (*TabResult)(unsafe.Pointer(p)).FazResult, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(p)).FnAlloc)))) + if !(azNew == uintptr(0)) { + goto __4 + } + goto malloc_failed +__4: + ; + (*TabResult)(unsafe.Pointer(p)).FazResult = azNew +__3: + ; + + // If this is the first row, then generate an extra row containing + // the names of all columns. + if !((*TabResult)(unsafe.Pointer(p)).FnRow == U32(0)) { + goto __5 + } + (*TabResult)(unsafe.Pointer(p)).FnColumn = U32(nCol) + i = 0 +__7: + if !(i < nCol) { + goto __9 + } + z = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + if !(z == uintptr(0)) { + goto __10 + } + goto malloc_failed +__10: + ; + *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(p)).FazResult + uintptr(libc.PostIncUint32(&(*TabResult)(unsafe.Pointer(p)).FnData, 1))*8)) = z + goto __8 +__8: + i++ + goto __7 + goto __9 +__9: + ; + goto __6 +__5: + if !(int32((*TabResult)(unsafe.Pointer(p)).FnColumn) != nCol) { + goto __11 + } + Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) + (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, + ts+18221 /* "sqlite3_get_tabl..." */, 0) + (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + return 1 +__11: + ; +__6: + ; + + // Copy over the row data + if !(argv != uintptr(0)) { + goto __12 + } + i = 0 +__13: + if !(i < nCol) { + goto __15 + } + if !(*(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == uintptr(0)) { + goto __16 + } + z = uintptr(0) + goto __17 +__16: + n = (Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + 1) + z = Xsqlite3_malloc64(tls, uint64(n)) + if !(z == uintptr(0)) { + goto __18 + } + goto malloc_failed +__18: + ; + libc.Xmemcpy(tls, z, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), uint64(n)) +__17: + ; + *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(p)).FazResult + uintptr(libc.PostIncUint32(&(*TabResult)(unsafe.Pointer(p)).FnData, 1))*8)) = z + goto __14 +__14: + i++ + goto __13 + goto __15 +__15: + ; + (*TabResult)(unsafe.Pointer(p)).FnRow++ +__12: + ; + return 0 + +malloc_failed: + (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + return 1 +} + +// Query the database. But instead of invoking a callback for each row, +// malloc() for space to hold the result and return the entire results +// at the conclusion of the call. +// +// The result that is written to ***pazResult is held in memory obtained +// from malloc(). But the caller cannot free this memory directly. +// Instead, the entire table should be passed to sqlite3_free_table() when +// the calling procedure is finished using it. +func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintptr, pnRow uintptr, pnColumn uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:139587:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var rc int32 + // var res TabResult at bp+8, 40 + + *(*uintptr)(unsafe.Pointer(pazResult)) = uintptr(0) + if pnColumn != 0 { + *(*int32)(unsafe.Pointer(pnColumn)) = 0 + } + if pnRow != 0 { + *(*int32)(unsafe.Pointer(pnRow)) = 0 + } + if pzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) + } + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FzErrMsg = uintptr(0) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnRow = U32(0) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnColumn = U32(0) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnData = U32(1) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnAlloc = U32(20) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).Frc = SQLITE_OK + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnAlloc)))) + if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult == uintptr(0) { + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_NOMEM + return SQLITE_NOMEM + } + *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult)) = uintptr(0) + rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 + }{sqlite3_get_table_cb})), bp+8 /* &res */, pzErrMsg) + + *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult)) = uintptr(int64((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnData)) + if (rc & 0xff) == SQLITE_ABORT { + Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8)) + if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { + if pzErrMsg != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + } + Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) + } + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).Frc // Assume 32-bit assignment is atomic + return (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).Frc + } + Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) + if rc != SQLITE_OK { + Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8)) + return rc + } + if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnAlloc > (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnData { + var azNew uintptr + azNew = Xsqlite3Realloc(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnData)))) + if azNew == uintptr(0) { + Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8)) + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_NOMEM + return SQLITE_NOMEM + } + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult = azNew + } + *(*uintptr)(unsafe.Pointer(pazResult)) = ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8) + if pnColumn != 0 { + *(*int32)(unsafe.Pointer(pnColumn)) = int32((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnColumn) + } + if pnRow != 0 { + *(*int32)(unsafe.Pointer(pnRow)) = int32((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnRow) + } + return rc +} + +// This routine frees the space the sqlite3_get_table() malloced. +func Xsqlite3_free_table(tls *libc.TLS, azResult uintptr) { /* sqlite3.c:139656:17: */ + if azResult != 0 { + var i int32 + var n int32 + azResult -= 8 + + n = int32(*(*uintptr)(unsafe.Pointer(azResult))) + for i = 1; i < n; i++ { + if *(*uintptr)(unsafe.Pointer(azResult + uintptr(i)*8)) != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(azResult + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, azResult) + } +} + +//************* End of table.c ********************************************** +//************* Begin file trigger.c **************************************** +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains the implementation for TRIGGERs +// #include "sqliteInt.h" + +// Delete a linked list of TriggerStep structures. +func Xsqlite3DeleteTriggerStep(tls *libc.TLS, db uintptr, pTriggerStep uintptr) { /* sqlite3.c:139691:21: */ + for pTriggerStep != 0 { + var pTmp uintptr = pTriggerStep + pTriggerStep = (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpNext + + Xsqlite3ExprDelete(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FpWhere) + Xsqlite3ExprListDelete(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FpExprList) + Xsqlite3SelectDelete(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FpSelect) + Xsqlite3IdListDelete(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FpIdList) + Xsqlite3UpsertDelete(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FpUpsert) + Xsqlite3SrcListDelete(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FpFrom) + Xsqlite3DbFree(tls, db, (*TriggerStep)(unsafe.Pointer(pTmp)).FzSpan) + + Xsqlite3DbFree(tls, db, pTmp) + } +} + +// Given table pTab, return a list of all the triggers attached to +// the table. The list is connected by Trigger.pNext pointers. +// +// All of the triggers on pTab that are in the same database as pTab +// are already attached to pTab->pTrigger. But there might be additional +// triggers on pTab in the TEMP schema. This routine prepends all +// TEMP triggers on pTab to the beginning of the pTab->pTrigger list +// and returns the combined list. +// +// To state it another way: This routine returns a list of all triggers +// that fire off of pTab. The list will include any TEMP triggers on +// pTab as well as the triggers lised in pTab->pTrigger. +func Xsqlite3TriggerList(tls *libc.TLS, pParse uintptr, pTab uintptr) uintptr { /* sqlite3.c:139722:24: */ + var pTmpSchema uintptr // Schema of the pTab table + var pList uintptr // List of triggers to return + var p uintptr // Loop variable for TEMP triggers + + if (*Parse)(unsafe.Pointer(pParse)).FdisableTriggers != 0 { + return uintptr(0) + } + pTmpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb + 1*32)).FpSchema + p = (*Hash)(unsafe.Pointer((pTmpSchema + 56 /* &.trigHash */))).Ffirst + pList = (*Table)(unsafe.Pointer(pTab)).FpTrigger + for p != 0 { + var pTrig uintptr = (*HashElem)(unsafe.Pointer(p)).Fdata + if ((((*Trigger)(unsafe.Pointer(pTrig)).FpTabSchema == (*Table)(unsafe.Pointer(pTab)).FpSchema) && + ((*Trigger)(unsafe.Pointer(pTrig)).Ftable != 0)) && + (0 == Xsqlite3StrICmp(tls, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, (*Table)(unsafe.Pointer(pTab)).FzName))) && + ((*Trigger)(unsafe.Pointer(pTrig)).FpTabSchema != pTmpSchema) { + (*Trigger)(unsafe.Pointer(pTrig)).FpNext = pList + pList = pTrig + } else if (int32((*Trigger)(unsafe.Pointer(pTrig)).Fop) == TK_RETURNING) && + ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FpVtabCtx == uintptr(0)) { + + (*Trigger)(unsafe.Pointer(pTrig)).Ftable = (*Table)(unsafe.Pointer(pTab)).FzName + (*Trigger)(unsafe.Pointer(pTrig)).FpTabSchema = (*Table)(unsafe.Pointer(pTab)).FpSchema + (*Trigger)(unsafe.Pointer(pTrig)).FpNext = pList + pList = pTrig + } + p = (*HashElem)(unsafe.Pointer(p)).Fnext + } + return pList +} + +// This is called by the parser when it sees a CREATE TRIGGER statement +// up to the point of the BEGIN before the trigger actions. A Trigger +// structure is generated based on the information available and stored +// in pParse->pNewTrigger. After the trigger actions have been parsed, the +// sqlite3FinishTrigger() function is called to complete the trigger +// construction process. +func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, tr_tm int32, op int32, pColumns uintptr, pTableName uintptr, pWhen uintptr, isTemp int32, noErr int32) { /* sqlite3.c:139778:21: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var pTrigger uintptr // The new trigger + var pTab uintptr // Table that the trigger fires off of + var zName uintptr // Name of the trigger + var db uintptr // The database connection + var iDb int32 // The database to store the trigger in + // var pName uintptr at bp+32, 8 + // The unqualified db name + // var sFix DbFixer at bp+40, 96 + + var iTabDb int32 + var code int32 + var zDb uintptr + var zDbTrig uintptr + pTrigger = uintptr(0) + zName = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb // State vector for the DB fixer + + // pName1->z might be NULL, but not pName1 itself + + if !(isTemp != 0) { + goto __1 + } + // If TEMP was specified, then the trigger name may not be qualified. + if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { + goto __3 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18286 /* "temporary trigge..." */, 0) + goto trigger_cleanup +__3: + ; + iDb = 1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)) = pName1 + goto __2 +__1: + // Figure out the db that the trigger will be created in + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+32 /* &pName */) + if !(iDb < 0) { + goto __4 + } + goto trigger_cleanup +__4: + ; +__2: + ; + if !(!(pTableName != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __5 + } + goto trigger_cleanup +__5: + ; + + // A long-standing parser bug is that this syntax was allowed: + // + // CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab .... + // ^^^^^^^^ + // + // To maintain backwards compatibility, ignore the database + // name on pTableName if we are reparsing out of the schema table + if !(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (iDb != 1)) { + goto __6 + } + Xsqlite3DbFree(tls, db, (*SrcItem)(unsafe.Pointer((pTableName + 8 /* &.a */))).FzDatabase) + (*SrcItem)(unsafe.Pointer((pTableName + 8 /* &.a */))).FzDatabase = uintptr(0) +__6: + ; + + // If the trigger name was unqualified, and the table is a temp table, + // then set iDb to 1 to create the trigger in the temporary database. + // If sqlite3SrcListLookup() returns 0, indicating the table does not + // exist, the error is caught by the block below. + pTab = Xsqlite3SrcListLookup(tls, pParse, pTableName) + if !((((int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) && ((*Token)(unsafe.Pointer(pName2)).Fn == uint32(0))) && (pTab != 0)) && + ((*Table)(unsafe.Pointer(pTab)).FpSchema == (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema)) { + goto __7 + } + iDb = 1 +__7: + ; + + // Ensure the table name matches database name and that the table exists + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __8 + } + goto trigger_cleanup +__8: + ; + + Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18332 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + if !(Xsqlite3FixSrcList(tls, bp+40 /* &sFix */, pTableName) != 0) { + goto __9 + } + goto trigger_cleanup +__9: + ; + pTab = Xsqlite3SrcListLookup(tls, pParse, pTableName) + if !(!(pTab != 0)) { + goto __10 + } + // The table does not exist. + goto trigger_orphan_error +__10: + ; + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __11 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18340 /* "cannot create tr..." */, 0) + goto trigger_orphan_error +__11: + ; + + // Check that the trigger name is not reserved and that no trigger of the + // specified name exists + zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + if !(zName == uintptr(0)) { + goto __12 + } + + goto trigger_cleanup +__12: + ; + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18332 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + goto __13 + } + goto trigger_cleanup +__13: + ; + + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) { + goto __14 + } + if !(Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema+56 /* &.trigHash */), zName) != 0) { + goto __15 + } + if !(!(noErr != 0)) { + goto __16 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18381 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + goto __17 +__16: + ; + Xsqlite3CodeVerifySchema(tls, pParse, iDb) +__17: + ; + goto trigger_cleanup +__15: + ; +__14: + ; + + // Do not create a trigger on a system table + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7082 /* "sqlite_" */, 7) == 0) { + goto __18 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18407 /* "cannot create tr..." */, 0) + goto trigger_cleanup +__18: + ; + + // INSTEAD of triggers are only for views and views only support INSTEAD + // of triggers. + if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { + goto __19 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18445, /* "cannot create %s..." */ + libc.VaList(bp+8, func() uintptr { + if tr_tm == TK_BEFORE { + return ts + 18482 /* "BEFORE" */ + } + return ts + 18489 /* "AFTER" */ + }(), pTableName+8 /* &.a */)) + goto trigger_orphan_error +__19: + ; + if !(!(int32((*Table)(unsafe.Pointer(pTab)).FpSelect) != 0) && (tr_tm == TK_INSTEAD)) { + goto __20 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+18495 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + goto trigger_orphan_error +__20: + ; + + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME)) { + goto __21 + } + iTabDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + code = SQLITE_CREATE_TRIGGER + zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iTabDb)*32)).FzDbSName + if isTemp != 0 { + zDbTrig = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName + } else { + zDbTrig = zDb + } + if !((iTabDb == 1) || (isTemp != 0)) { + goto __22 + } + code = SQLITE_CREATE_TEMP_TRIGGER +__22: + ; + if !(Xsqlite3AuthCheck(tls, pParse, code, zName, (*Table)(unsafe.Pointer(pTab)).FzName, zDbTrig) != 0) { + goto __23 + } + goto trigger_cleanup +__23: + ; + if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { + if (!(0 != 0)) && (iTabDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }(), uintptr(0), zDb) != 0) { + goto __24 + } + goto trigger_cleanup +__24: + ; +__21: + ; + + // INSTEAD OF triggers can only appear on views and BEFORE triggers + // cannot appear on views. So we might as well translate every + // INSTEAD OF trigger into a BEFORE trigger. It simplifies code + // elsewhere. + if !(tr_tm == TK_INSTEAD) { + goto __25 + } + tr_tm = TK_BEFORE +__25: + ; + + // Build the Trigger object + pTrigger = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Trigger{}))) + if !(pTrigger == uintptr(0)) { + goto __26 + } + goto trigger_cleanup +__26: + ; + (*Trigger)(unsafe.Pointer(pTrigger)).FzName = zName + zName = uintptr(0) + (*Trigger)(unsafe.Pointer(pTrigger)).Ftable = Xsqlite3DbStrDup(tls, db, (*SrcItem)(unsafe.Pointer((pTableName + 8 /* &.a */))).FzName) + (*Trigger)(unsafe.Pointer(pTrigger)).FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpSchema + (*Trigger)(unsafe.Pointer(pTrigger)).FpTabSchema = (*Table)(unsafe.Pointer(pTab)).FpSchema + (*Trigger)(unsafe.Pointer(pTrigger)).Fop = U8(op) + (*Trigger)(unsafe.Pointer(pTrigger)).Ftr_tm = func() uint8 { + if tr_tm == TK_BEFORE { + return uint8(TRIGGER_BEFORE) + } + return uint8(TRIGGER_AFTER) + }() + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __27 + } + Xsqlite3RenameTokenRemap(tls, pParse, (*Trigger)(unsafe.Pointer(pTrigger)).Ftable, (*SrcItem)(unsafe.Pointer((pTableName + 8 /* &.a */))).FzName) + (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen = pWhen + pWhen = uintptr(0) + goto __28 +__27: + (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen = Xsqlite3ExprDup(tls, db, pWhen, EXPRDUP_REDUCE) +__28: + ; + (*Trigger)(unsafe.Pointer(pTrigger)).FpColumns = pColumns + pColumns = uintptr(0) + + (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrigger + +trigger_cleanup: + Xsqlite3DbFree(tls, db, zName) + Xsqlite3SrcListDelete(tls, db, pTableName) + Xsqlite3IdListDelete(tls, db, pColumns) + Xsqlite3ExprDelete(tls, db, pWhen) + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).FpNewTrigger) != 0)) { + goto __29 + } + Xsqlite3DeleteTrigger(tls, db, pTrigger) + goto __30 +__29: + ; +__30: + ; + return + +trigger_orphan_error: + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) == 1) { + goto __31 + } + // Ticket #3810. + // Normally, whenever a table is dropped, all associated triggers are + // dropped too. But if a TEMP trigger is created on a non-TEMP table + // and the table is dropped by a different database connection, the + // trigger is not visible to the database connection that does the + // drop so the trigger cannot be dropped. This results in an + // "orphaned trigger" - a trigger whose associated table is missing. + // + // 2020-11-05 see also https://sqlite.org/forum/forumpost/157dc791df + libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(1), 0, 0x1) +__31: + ; + goto trigger_cleanup +} + +// This routine is called after all of the trigger actions have been parsed +// in order to complete the process of building the trigger. +func Xsqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAll uintptr) { /* sqlite3.c:139985:21: */ + bp := tls.Alloc(152) + defer tls.Free(152) + + var pTrig uintptr // Trigger being finished + var zName uintptr // Name of trigger + var db uintptr // The database + // var sFix DbFixer at bp+56, 96 + // Fixer object + var iDb int32 // Database containing the trigger + // var nameToken Token at bp+40, 16 + + var v uintptr + var z uintptr + var pTab uintptr + var pLink uintptr + var pHash uintptr + pTrig = (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger + db = (*Parse)(unsafe.Pointer(pParse)).Fdb // Trigger name for error reporting + + (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger = uintptr(0) + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || !(pTrig != 0)) { + goto __1 + } + goto triggerfinish_cleanup +__1: + ; + zName = (*Trigger)(unsafe.Pointer(pTrig)).FzName + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Trigger)(unsafe.Pointer(pTrig)).FpSchema) + (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list = pStepList +__2: + if !(pStepList != 0) { + goto __3 + } + (*TriggerStep)(unsafe.Pointer(pStepList)).FpTrig = pTrig + pStepList = (*TriggerStep)(unsafe.Pointer(pStepList)).FpNext + goto __2 +__3: + ; + Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) + Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18332 /* "trigger" */, bp+40 /* &nameToken */) + if !((Xsqlite3FixTriggerStep(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || + (Xsqlite3FixExpr(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { + goto __4 + } + goto triggerfinish_cleanup +__4: + ; + + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + goto __5 + } + + (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger = pTrig + pTrig = uintptr(0) + goto __6 +__5: + + // if we are not initializing, + // build the sqlite_schema entry + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0)) { + goto __7 + } + + // Make an entry in the sqlite_schema table + v = Xsqlite3GetVdbe(tls, pParse) + if !(v == uintptr(0)) { + goto __8 + } + goto triggerfinish_cleanup +__8: + ; + Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) + z = Xsqlite3DbStrNDup(tls, db, (*Token)(unsafe.Pointer(pAll)).Fz, uint64((*Token)(unsafe.Pointer(pAll)).Fn)) + + Xsqlite3NestedParse(tls, pParse, + + ts+18541, /* "INSERT INTO %Q.s..." */ + libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName, + (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) + Xsqlite3DbFree(tls, db, z) + Xsqlite3ChangeCookie(tls, pParse, iDb) + Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, + Xsqlite3MPrintf(tls, db, ts+18616 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) +__7: + ; +__6: + ; + + if !((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) { + goto __9 + } + pLink = pTrig + pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema + 56 /* &.trigHash */) + + pTrig = Xsqlite3HashInsert(tls, pHash, zName, pTrig) + if !(pTrig != 0) { + goto __10 + } + Xsqlite3OomFault(tls, db) + goto __11 +__10: + if !((*Trigger)(unsafe.Pointer(pLink)).FpSchema == (*Trigger)(unsafe.Pointer(pLink)).FpTabSchema) { + goto __12 + } + pTab = Xsqlite3HashFind(tls, ((*Trigger)(unsafe.Pointer(pLink)).FpTabSchema + 8 /* &.tblHash */), (*Trigger)(unsafe.Pointer(pLink)).Ftable) + + (*Trigger)(unsafe.Pointer(pLink)).FpNext = (*Table)(unsafe.Pointer(pTab)).FpTrigger + (*Table)(unsafe.Pointer(pTab)).FpTrigger = pLink +__12: + ; +__11: + ; +__9: + ; + +triggerfinish_cleanup: + Xsqlite3DeleteTrigger(tls, db, pTrig) + + Xsqlite3DeleteTriggerStep(tls, db, pStepList) +} + +// Duplicate a range of text from an SQL statement, then convert all +// whitespace characters into ordinary space characters. +func triggerSpanDup(tls *libc.TLS, db uintptr, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:140073:13: */ + var z uintptr = Xsqlite3DbSpanDup(tls, db, zStart, zEnd) + var i int32 + if z != 0 { + for i = 0; *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0; i++ { + if (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))]) & 0x01) != 0 { + *(*int8)(unsafe.Pointer(z + uintptr(i))) = int8(' ') + } + } + } + return z +} + +// Turn a SELECT statement (that the pSelect parameter points to) into +// a trigger step. Return a pointer to a TriggerStep structure. +// +// The parser calls this routine when it finds a SELECT statement in +// body of a TRIGGER. +func Xsqlite3TriggerSelectStep(tls *libc.TLS, db uintptr, pSelect uintptr, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:140087:28: */ + var pTriggerStep uintptr = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(TriggerStep{}))) + if pTriggerStep == uintptr(0) { + Xsqlite3SelectDelete(tls, db, pSelect) + return uintptr(0) + } + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).Fop = U8(TK_SELECT) + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpSelect = pSelect + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = U8(OE_Default) + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FzSpan = triggerSpanDup(tls, db, zStart, zEnd) + return pTriggerStep +} + +// Allocate space to hold a new trigger step. The allocated space +// holds both the TriggerStep object and the TriggerStep.target.z string. +// +// If an OOM error occurs, NULL is returned and db->mallocFailed is set. +func triggerStepAllocate(tls *libc.TLS, pParse uintptr, op U8, pName uintptr, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:140111:20: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTriggerStep uintptr + + pTriggerStep = Xsqlite3DbMallocZero(tls, db, (uint64((uint64(unsafe.Sizeof(TriggerStep{})) + uint64((*Token)(unsafe.Pointer(pName)).Fn)) + uint64(1)))) + if pTriggerStep != 0 { + var z uintptr = (pTriggerStep + 1*96) + libc.Xmemcpy(tls, z, (*Token)(unsafe.Pointer(pName)).Fz, uint64((*Token)(unsafe.Pointer(pName)).Fn)) + Xsqlite3Dequote(tls, z) + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FzTarget = z + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).Fop = op + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FzSpan = triggerSpanDup(tls, db, zStart, zEnd) + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenMap(tls, pParse, (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FzTarget, pName) + } + } + return pTriggerStep +} + +// Build a trigger step out of an INSERT statement. Return a pointer +// to the new trigger step. +// +// The parser calls this routine when it sees an INSERT inside the +// body of a trigger. +func Xsqlite3TriggerInsertStep(tls *libc.TLS, pParse uintptr, pTableName uintptr, pColumn uintptr, pSelect uintptr, orconf U8, pUpsert uintptr, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:140143:28: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTriggerStep uintptr + + pTriggerStep = triggerStepAllocate(tls, pParse, uint8(TK_INSERT), pTableName, zStart, zEnd) + if pTriggerStep != 0 { + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpSelect = pSelect + pSelect = uintptr(0) + } else { + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpSelect = Xsqlite3SelectDup(tls, db, pSelect, EXPRDUP_REDUCE) + } + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpIdList = pColumn + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpUpsert = pUpsert + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = orconf + if pUpsert != 0 { + Xsqlite3HasExplicitNulls(tls, pParse, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + } + } else { + + Xsqlite3IdListDelete(tls, db, pColumn) + + Xsqlite3UpsertDelete(tls, db, pUpsert) + } + Xsqlite3SelectDelete(tls, db, pSelect) + + return pTriggerStep +} + +// Construct a trigger step that implements an UPDATE statement and return +// a pointer to that trigger step. The parser calls this routine when it +// sees an UPDATE statement inside the body of a CREATE TRIGGER. +func Xsqlite3TriggerUpdateStep(tls *libc.TLS, pParse uintptr, pTableName uintptr, pFrom uintptr, pEList uintptr, pWhere uintptr, orconf U8, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:140188:28: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTriggerStep uintptr + + pTriggerStep = triggerStepAllocate(tls, pParse, uint8(TK_UPDATE), pTableName, zStart, zEnd) + if pTriggerStep != 0 { + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpExprList = pEList + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = pWhere + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpFrom = pFrom + pEList = uintptr(0) + pWhere = uintptr(0) + pFrom = uintptr(0) + } else { + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpExprList = Xsqlite3ExprListDup(tls, db, pEList, EXPRDUP_REDUCE) + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = Xsqlite3ExprDup(tls, db, pWhere, EXPRDUP_REDUCE) + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpFrom = Xsqlite3SrcListDup(tls, db, pFrom, EXPRDUP_REDUCE) + } + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = orconf + } + Xsqlite3ExprListDelete(tls, db, pEList) + Xsqlite3ExprDelete(tls, db, pWhere) + Xsqlite3SrcListDelete(tls, db, pFrom) + return pTriggerStep +} + +// Construct a trigger step that implements a DELETE statement and return +// a pointer to that trigger step. The parser calls this routine when it +// sees a DELETE statement inside the body of a CREATE TRIGGER. +func Xsqlite3TriggerDeleteStep(tls *libc.TLS, pParse uintptr, pTableName uintptr, pWhere uintptr, zStart uintptr, zEnd uintptr) uintptr { /* sqlite3.c:140228:28: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTriggerStep uintptr + + pTriggerStep = triggerStepAllocate(tls, pParse, uint8(TK_DELETE), pTableName, zStart, zEnd) + if pTriggerStep != 0 { + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = pWhere + pWhere = uintptr(0) + } else { + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).FpWhere = Xsqlite3ExprDup(tls, db, pWhere, EXPRDUP_REDUCE) + } + (*TriggerStep)(unsafe.Pointer(pTriggerStep)).Forconf = U8(OE_Default) + } + Xsqlite3ExprDelete(tls, db, pWhere) + return pTriggerStep +} + +// Recursively delete a Trigger structure +func Xsqlite3DeleteTrigger(tls *libc.TLS, db uintptr, pTrigger uintptr) { /* sqlite3.c:140255:21: */ + if (pTrigger == uintptr(0)) || ((*Trigger)(unsafe.Pointer(pTrigger)).FbReturning != 0) { + return + } + Xsqlite3DeleteTriggerStep(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).Fstep_list) + Xsqlite3DbFree(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).FzName) + Xsqlite3DbFree(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).Ftable) + Xsqlite3ExprDelete(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen) + Xsqlite3IdListDelete(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).FpColumns) + Xsqlite3DbFree(tls, db, pTrigger) +} + +// +// This function is called to drop a trigger from the database schema. +// +// This may be called directly from the parser and therefore identifies +// the trigger by name. The sqlite3DropTriggerPtr() routine does the +// same job as this routine except it takes a pointer to the trigger +// instead of the trigger name. +// +func Xsqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int32) { /* sqlite3.c:140273:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pTrigger uintptr + var i int32 + var zDb uintptr + var zName uintptr + var db uintptr + var j int32 + pTrigger = uintptr(0) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __1 + } + goto drop_trigger_cleanup +__1: + ; + if !(SQLITE_OK != Xsqlite3ReadSchema(tls, pParse)) { + goto __2 + } + goto drop_trigger_cleanup +__2: + ; + + zDb = (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase + zName = (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzName + + i = OMIT_TEMPDB +__3: + if !(i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) { + goto __5 + } + if i < 2 { + j = (i ^ 1) + } else { + j = i + } // Search TEMP before MAIN + if !((zDb != 0) && (Xsqlite3DbIsNamed(tls, db, j, zDb) == 0)) { + goto __6 + } + goto __4 +__6: + ; + + pTrigger = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(j)*32)).FpSchema + 56 /* &.trigHash */), zName) + if !(pTrigger != 0) { + goto __7 + } + goto __5 +__7: + ; + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; + if !(!(pTrigger != 0)) { + goto __8 + } + if !(!(noErr != 0)) { + goto __9 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18645 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + goto __10 +__9: + Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) +__10: + ; + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + goto drop_trigger_cleanup +__8: + ; + Xsqlite3DropTriggerPtr(tls, pParse, pTrigger) + +drop_trigger_cleanup: + Xsqlite3SrcListDelete(tls, db, pName) +} + +// Return a pointer to the Table structure for the table that a trigger +// is set on. +func tableOfTrigger(tls *libc.TLS, pTrigger uintptr) uintptr { /* sqlite3.c:140315:14: */ + return Xsqlite3HashFind(tls, ((*Trigger)(unsafe.Pointer(pTrigger)).FpTabSchema + 8 /* &.tblHash */), (*Trigger)(unsafe.Pointer(pTrigger)).Ftable) +} + +// Drop a trigger given a pointer to that trigger. +func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { /* sqlite3.c:140323:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTable uintptr + var v uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var iDb int32 + + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Trigger)(unsafe.Pointer(pTrigger)).FpSchema) + + pTable = tableOfTrigger(tls, pTrigger) + + if pTable != 0 { + var code int32 = SQLITE_DROP_TRIGGER + var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + var zTab uintptr = func() uintptr { + if (!(0 != 0)) && (iDb == 1) { + return ts + 10873 /* "sqlite_temp_mast..." */ + } + return ts + 4957 /* "sqlite_master" */ + }() + if iDb == 1 { + code = SQLITE_DROP_TEMP_TRIGGER + } + if (Xsqlite3AuthCheck(tls, pParse, code, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, (*Table)(unsafe.Pointer(pTable)).FzName, zDb) != 0) || (Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { + return + } + } + + // Generate code to destroy the database record of the trigger. + if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { + Xsqlite3NestedParse(tls, pParse, + ts+18665, /* "DELETE FROM %Q.s..." */ + libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) + Xsqlite3ChangeCookie(tls, pParse, iDb) + Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) + } +} + +// Remove a trigger from the hash tables of the sqlite* pointer. +func Xsqlite3UnlinkAndDeleteTrigger(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) { /* sqlite3.c:140361:21: */ + var pTrigger uintptr + var pHash uintptr + + pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema + 56 /* &.trigHash */) + pTrigger = Xsqlite3HashInsert(tls, pHash, zName, uintptr(0)) + if pTrigger != 0 { + if (*Trigger)(unsafe.Pointer(pTrigger)).FpSchema == (*Trigger)(unsafe.Pointer(pTrigger)).FpTabSchema { + var pTab uintptr = tableOfTrigger(tls, pTrigger) + if pTab != 0 { + var pp uintptr + for pp = (pTab + 104 /* &.pTrigger */); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 64 /* &.pNext */) { + if *(*uintptr)(unsafe.Pointer(pp)) == pTrigger { + *(*uintptr)(unsafe.Pointer(pp)) = (*Trigger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + break + } + } + } + } + Xsqlite3DeleteTrigger(tls, db, pTrigger) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_SchemaChange)) + } +} + +// pEList is the SET clause of an UPDATE statement. Each entry +// in pEList is of the format =. If any of the entries +// in pEList have an which matches an identifier in pIdList, +// then return TRUE. If pIdList==NULL, then it is considered a +// wildcard that matches anything. Likewise if pEList==NULL then +// it matches anything so always return true. Return false only +// if there is no match. +func checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) int32 { /* sqlite3.c:140395:12: */ + var e int32 + if (pIdList == uintptr(0)) || (pEList == uintptr(0)) { + return 1 + } + for e = 0; e < (*ExprList)(unsafe.Pointer(pEList)).FnExpr; e++ { + if Xsqlite3IdListIndex(tls, pIdList, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */)+uintptr(e)*32)).FzEName) >= 0 { + return 1 + } + } + return 0 +} + +// Return a list of all triggers on table pTab if there exists at least +// one trigger that must be fired when an operation of type 'op' is +// performed on the table, and, if that operation is an UPDATE, if at +// least one of the columns in pChanges is being modified. +func Xsqlite3TriggersExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) uintptr { /* sqlite3.c:140410:24: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var mask int32 + var pList uintptr + var p uintptr + mask = 0 + pList = uintptr(0) + + pList = Xsqlite3TriggerList(tls, pParse, pTab) + + if !(pList != uintptr(0)) { + goto __1 + } + p = pList + if !((((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_EnableTrigger)) == uint64(0)) && + ((*Table)(unsafe.Pointer(pTab)).FpTrigger != uintptr(0))) { + goto __2 + } + // The SQLITE_DBCONFIG_ENABLE_TRIGGER setting is off. That means that + // only TEMP triggers are allowed. Truncate the pList so that it + // includes only TEMP triggers + if !(pList == (*Table)(unsafe.Pointer(pTab)).FpTrigger) { + goto __3 + } + pList = uintptr(0) + goto exit_triggers_exist +__3: + ; +__4: + if !(((*Trigger)(unsafe.Pointer(p)).FpNext != 0) && ((*Trigger)(unsafe.Pointer(p)).FpNext != (*Table)(unsafe.Pointer(pTab)).FpTrigger)) { + goto __5 + } + p = (*Trigger)(unsafe.Pointer(p)).FpNext + goto __4 +__5: + ; + (*Trigger)(unsafe.Pointer(p)).FpNext = uintptr(0) + p = pList +__2: + ; +__6: + if !((int32((*Trigger)(unsafe.Pointer(p)).Fop) == op) && (checkColumnOverlap(tls, (*Trigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0)) { + goto __9 + } + mask = mask | (int32((*Trigger)(unsafe.Pointer(p)).Ftr_tm)) + goto __10 +__9: + if !(int32((*Trigger)(unsafe.Pointer(p)).Fop) == TK_RETURNING) { + goto __11 + } + // The first time a RETURNING trigger is seen, the "op" value tells + // us what time of trigger it should be. + + (*Trigger)(unsafe.Pointer(p)).Fop = U8(op) + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __13 + } + if !(op != TK_INSERT) { + goto __15 + } + Xsqlite3ErrorMsg(tls, pParse, + ts+18727, /* "%s RETURNING is ..." */ + libc.VaList(bp, func() uintptr { + if op == TK_DELETE { + return ts + 18775 /* "DELETE" */ + } + return ts + 18782 /* "UPDATE" */ + }())) +__15: + ; + (*Trigger)(unsafe.Pointer(p)).Ftr_tm = U8(TRIGGER_BEFORE) + goto __14 +__13: + (*Trigger)(unsafe.Pointer(p)).Ftr_tm = U8(TRIGGER_AFTER) +__14: + ; + mask = mask | (int32((*Trigger)(unsafe.Pointer(p)).Ftr_tm)) + goto __12 +__11: + if !(((((*Trigger)(unsafe.Pointer(p)).FbReturning != 0) && (int32((*Trigger)(unsafe.Pointer(p)).Fop) == TK_INSERT)) && (op == TK_UPDATE)) && + ((*Parse)(unsafe.Pointer((pParse))).FpToplevel == uintptr(0))) { + goto __16 + } + // Also fire a RETURNING trigger for an UPSERT + mask = mask | (int32((*Trigger)(unsafe.Pointer(p)).Ftr_tm)) +__16: + ; +__12: + ; +__10: + ; + p = (*Trigger)(unsafe.Pointer(p)).FpNext + goto __7 +__7: + if p != 0 { + goto __6 + } + goto __8 +__8: + ; +__1: + ; +exit_triggers_exist: + if !(pMask != 0) { + goto __17 + } + *(*int32)(unsafe.Pointer(pMask)) = mask +__17: + ; + return func() uintptr { + if mask != 0 { + return pList + } + return uintptr(0) + }() +} + +// Convert the pStep->zTarget string into a SrcList and return a pointer +// to that SrcList. +// +// This routine adds a specific database name, if needed, to the target when +// forming the SrcList. This prevents a trigger in one database from +// referring to a target in another database. An exception is when the +// trigger is in TEMP in which case it can refer to any other database it +// wants. +func Xsqlite3TriggerStepSrc(tls *libc.TLS, pParse uintptr, pStep uintptr) uintptr { /* sqlite3.c:140484:24: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pSrc uintptr // SrcList to be returned + var zName uintptr = Xsqlite3DbStrDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FzTarget) + pSrc = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + + if pSrc != 0 { + var pSchema uintptr = (*Trigger)(unsafe.Pointer((*TriggerStep)(unsafe.Pointer(pStep)).FpTrig)).FpSchema + (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FzName = zName + if pSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema { + (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FpSchema = pSchema + } + if (*TriggerStep)(unsafe.Pointer(pStep)).FpFrom != 0 { + var pDup uintptr = Xsqlite3SrcListDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpFrom, 0) + pSrc = Xsqlite3SrcListAppendList(tls, pParse, pSrc, pDup) + } + } else { + Xsqlite3DbFree(tls, db, zName) + } + return pSrc +} + +// Return true if the pExpr term from the RETURNING clause argument +// list is of the form "*". Raise an error if the terms if of the +// form "table.*". +func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sqlite3.c:140515:12: */ + + if int32((*Expr)(unsafe.Pointer(pTerm)).Fop) == TK_ASTERISK { + return 1 + } + if int32((*Expr)(unsafe.Pointer(pTerm)).Fop) != TK_DOT { + return 0 + } + + if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { + return 0 + } + Xsqlite3ErrorMsg(tls, pParse, ts+18789 /* "RETURNING may no..." */, 0) + return 1 +} + +// The input list pList is the list of result set terms from a RETURNING +// clause. The table that we are returning from is pTab. +// +// This routine makes a copy of the pList, and at the same time expands +// any "*" wildcards to be the complete set of columns from pTab. +func sqlite3ExpandReturning(tls *libc.TLS, pParse uintptr, pList uintptr, pTab uintptr) uintptr { /* sqlite3.c:140535:17: */ + var pNew uintptr = uintptr(0) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var i int32 + + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + var pOldExpr uintptr = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if pOldExpr == uintptr(0) { + continue + } + if isAsteriskTerm(tls, pParse, pOldExpr) != 0 { + var jj int32 + for jj = 0; jj < int32((*Table)(unsafe.Pointer(pTab)).FnCol); jj++ { + var pNewExpr uintptr + if (int32((*Column)(unsafe.Pointer(((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(jj)*32))).FcolFlags) & COLFLAG_HIDDEN) != 0 { + continue + } + pNewExpr = Xsqlite3Expr(tls, db, TK_ID, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(jj)*32)).FzName) + pNew = Xsqlite3ExprListAppend(tls, pParse, pNew, pNewExpr) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + var pItem uintptr = ((pNew + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pNew)).FnExpr-1))*32) + (*ExprList_item)(unsafe.Pointer(pItem)).FzEName = Xsqlite3DbStrDup(tls, db, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(jj)*32)).FzName) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.eEName */, uint32(ENAME_NAME), 0, 0x3) + } + } + } else { + var pNewExpr uintptr = Xsqlite3ExprDup(tls, db, pOldExpr, 0) + pNew = Xsqlite3ExprListAppend(tls, pParse, pNew, pNewExpr) + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) && ((*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FzEName != uintptr(0)) { + var pItem uintptr = ((pNew + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pNew)).FnExpr-1))*32) + (*ExprList_item)(unsafe.Pointer(pItem)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FzEName) + libc.SetBitFieldPtr8Uint32(pItem+20 /* &.eEName */, (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.eEName */)) & 0x3 >> 0))), 0, 0x3) + } + } + } + return pNew +} + +// Generate code for the RETURNING trigger. Unlike other triggers +// that invoke a subprogram in the bytecode, the code for RETURNING +// is generated in-line. +func codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, regIn int32) { /* sqlite3.c:140578:13: */ + bp := tls.Alloc(304) + defer tls.Free(304) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pNew uintptr + var pReturning uintptr + // var sSelect Select at bp, 128 + + // var sFrom SrcList at bp+128, 120 + + pReturning = *(*uintptr)(unsafe.Pointer(pParse + 184 /* &.u1 */)) + + libc.Xmemset(tls, bp /* &sSelect */, 0, uint64(unsafe.Sizeof(Select{}))) + libc.Xmemset(tls, bp+128 /* &sFrom */, 0, uint64(unsafe.Sizeof(SrcList{}))) + (*Select)(unsafe.Pointer(bp /* &sSelect */)).FpEList = Xsqlite3ExprListDup(tls, db, (*Returning)(unsafe.Pointer(pReturning)).FpReturnEL, 0) + (*Select)(unsafe.Pointer(bp /* &sSelect */)).FpSrc = bp + 128 /* &sFrom */ + (*SrcList)(unsafe.Pointer(bp + 128 /* &sFrom */)).FnSrc = 1 + (*SrcItem)(unsafe.Pointer((bp + 128 /* &sFrom */ + 8 /* &.a */))).FpTab = pTab + Xsqlite3SelectPrep(tls, pParse, bp /* &sSelect */, uintptr(0)) + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && ((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) { + Xsqlite3GenerateColumnNames(tls, pParse, bp /* &sSelect */) + } + Xsqlite3ExprListDelete(tls, db, (*Select)(unsafe.Pointer(bp /* &sSelect */)).FpEList) + pNew = sqlite3ExpandReturning(tls, pParse, (*Returning)(unsafe.Pointer(pReturning)).FpReturnEL, pTab) + if pNew != 0 { + // var sNC NameContext at bp+248, 56 + + libc.Xmemset(tls, bp+248 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + if (*Returning)(unsafe.Pointer(pReturning)).FnRetCol == 0 { + (*Returning)(unsafe.Pointer(pReturning)).FnRetCol = (*ExprList)(unsafe.Pointer(pNew)).FnExpr + (*Returning)(unsafe.Pointer(pReturning)).FiRetCur = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + } + (*NameContext)(unsafe.Pointer(bp + 248 /* &sNC */)).FpParse = pParse + *(*int32)(unsafe.Pointer(bp + 248 /* &sNC */ + 16 /* &.uNC */)) = regIn + (*NameContext)(unsafe.Pointer(bp + 248 /* &sNC */)).FncFlags = NC_UBaseReg + (*Parse)(unsafe.Pointer(pParse)).FeTriggerOp = (*Trigger)(unsafe.Pointer(pTrigger)).Fop + (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab = pTab + if Xsqlite3ResolveExprListNames(tls, bp+248 /* &sNC */, pNew) == SQLITE_OK { + var i int32 + var nCol int32 = (*ExprList)(unsafe.Pointer(pNew)).FnExpr + var reg int32 = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nCol + 2) + (*Returning)(unsafe.Pointer(pReturning)).FiRetReg = reg + for i = 0; i < nCol; i++ { + var pCol uintptr = (*ExprList_item)(unsafe.Pointer((pNew + 8 /* &.a */) + uintptr(i)*32)).FpExpr + Xsqlite3ExprCodeFactorable(tls, pParse, pCol, (reg + i)) + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, reg, i, (reg + i)) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, (*Returning)(unsafe.Pointer(pReturning)).FiRetCur, ((reg + i) + 1)) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, (*Returning)(unsafe.Pointer(pReturning)).FiRetCur, (reg + i), ((reg + i) + 1)) + } + Xsqlite3ExprListDelete(tls, db, pNew) + (*Parse)(unsafe.Pointer(pParse)).FeTriggerOp = U8(0) + (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab = uintptr(0) + } +} + +// Generate VDBE code for the statements inside the body of a single +// trigger. +func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf int32) int32 { /* sqlite3.c:140645:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pStep uintptr + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + + for pStep = pStepList; pStep != 0; pStep = (*TriggerStep)(unsafe.Pointer(pStep)).FpNext { + // Figure out the ON CONFLICT policy that will be used for this step + // of the trigger program. If the statement that caused this trigger + // to fire had an explicit ON CONFLICT, then use it. Otherwise, use + // the ON CONFLICT policy that was specified as part of the trigger + // step statement. Example: + // + // CREATE TRIGGER AFTER INSERT ON t1 BEGIN; + // INSERT OR REPLACE INTO t2 VALUES(new.a, new.b); + // END; + // + // INSERT INTO t1 ... ; -- insert into t2 uses REPLACE policy + // INSERT OR IGNORE INTO t1 ... ; -- insert into t2 uses IGNORE policy + (*Parse)(unsafe.Pointer(pParse)).FeOrconf = func() uint8 { + if orconf == OE_Default { + return (*TriggerStep)(unsafe.Pointer(pStep)).Forconf + } + return U8(orconf) + }() + + if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { + Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, + Xsqlite3MPrintf(tls, db, ts+5144 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + -7) + } + + switch int32((*TriggerStep)(unsafe.Pointer(pStep)).Fop) { + case TK_UPDATE: + { + Xsqlite3Update(tls, pParse, + Xsqlite3TriggerStepSrc(tls, pParse, pStep), + Xsqlite3ExprListDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpExprList, 0), + Xsqlite3ExprDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere, 0), + int32((*Parse)(unsafe.Pointer(pParse)).FeOrconf), uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3VdbeAddOp0(tls, v, OP_ResetCount) + break + + } + case TK_INSERT: + { + Xsqlite3Insert(tls, pParse, + Xsqlite3TriggerStepSrc(tls, pParse, pStep), + Xsqlite3SelectDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect, 0), + Xsqlite3IdListDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpIdList), + int32((*Parse)(unsafe.Pointer(pParse)).FeOrconf), + Xsqlite3UpsertDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpUpsert)) + Xsqlite3VdbeAddOp0(tls, v, OP_ResetCount) + break + + } + case TK_DELETE: + { + Xsqlite3DeleteFrom(tls, pParse, + Xsqlite3TriggerStepSrc(tls, pParse, pStep), + Xsqlite3ExprDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpWhere, 0), uintptr(0), uintptr(0)) + Xsqlite3VdbeAddOp0(tls, v, OP_ResetCount) + break + + } + default: + { + // var sDest SelectDest at bp+8, 40 + + var pSelect uintptr = Xsqlite3SelectDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect, 0) + Xsqlite3SelectDestInit(tls, bp+8 /* &sDest */, SRT_Discard, 0) + Xsqlite3Select(tls, pParse, pSelect, bp+8 /* &sDest */) + Xsqlite3SelectDelete(tls, db, pSelect) + break + + } + } + } + + return 0 +} + +// Parse context structure pFrom has just been used to create a sub-vdbe +// (trigger program). If an error has occurred, transfer error information +// from pFrom to pTo. +func transferParseError(tls *libc.TLS, pTo uintptr, pFrom uintptr) { /* sqlite3.c:140749:13: */ + + if (*Parse)(unsafe.Pointer(pTo)).FnErr == 0 { + (*Parse)(unsafe.Pointer(pTo)).FzErrMsg = (*Parse)(unsafe.Pointer(pFrom)).FzErrMsg + (*Parse)(unsafe.Pointer(pTo)).FnErr = (*Parse)(unsafe.Pointer(pFrom)).FnErr + (*Parse)(unsafe.Pointer(pTo)).Frc = (*Parse)(unsafe.Pointer(pFrom)).Frc + } else { + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pFrom)).Fdb, (*Parse)(unsafe.Pointer(pFrom)).FzErrMsg) + } +} + +// Create and populate a new TriggerPrg object with a sub-program +// implementing trigger pTrigger with ON CONFLICT policy orconf. +func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, orconf int32) uintptr { /* sqlite3.c:140765:19: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var pTop uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var pPrg uintptr // Value to return + var pWhen uintptr = uintptr(0) // Duplicate of trigger WHEN expression + var v uintptr // Temporary VM + // var sNC NameContext at bp+8, 56 + // Name context for sub-vdbe + var pProgram uintptr = uintptr(0) // Sub-vdbe for trigger program + var pSubParse uintptr // Parse context for sub-vdbe + var iEndTrigger int32 = 0 // Label to jump to if WHEN is false + + // Allocate the TriggerPrg and SubProgram objects. To ensure that they + // are freed if an error occurs, link them into the Parse.pTriggerPrg + // list of the top-level Parse object sooner rather than later. + pPrg = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(TriggerPrg{}))) + if !(pPrg != 0) { + return uintptr(0) + } + (*TriggerPrg)(unsafe.Pointer(pPrg)).FpNext = (*Parse)(unsafe.Pointer(pTop)).FpTriggerPrg + (*Parse)(unsafe.Pointer(pTop)).FpTriggerPrg = pPrg + (*TriggerPrg)(unsafe.Pointer(pPrg)).FpProgram = libc.AssignUintptr(&pProgram, Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(SubProgram{})))) + if !(pProgram != 0) { + return uintptr(0) + } + Xsqlite3VdbeLinkSubProgram(tls, (*Parse)(unsafe.Pointer(pTop)).FpVdbe, pProgram) + (*TriggerPrg)(unsafe.Pointer(pPrg)).FpTrigger = pTrigger + (*TriggerPrg)(unsafe.Pointer(pPrg)).Forconf = orconf + *(*U32)(unsafe.Pointer((pPrg + 28 /* &.aColmask */))) = 0xffffffff + *(*U32)(unsafe.Pointer((pPrg + 28 /* &.aColmask */) + 1*4)) = 0xffffffff + + // Allocate and populate a new Parse context to use for coding the + // trigger sub-program. + pSubParse = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Parse{}))) + if !(pSubParse != 0) { + return uintptr(0) + } + libc.Xmemset(tls, bp+8 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 8 /* &sNC */)).FpParse = pSubParse + (*Parse)(unsafe.Pointer(pSubParse)).Fdb = db + (*Parse)(unsafe.Pointer(pSubParse)).FpTriggerTab = pTab + (*Parse)(unsafe.Pointer(pSubParse)).FpToplevel = pTop + (*Parse)(unsafe.Pointer(pSubParse)).FzAuthContext = (*Trigger)(unsafe.Pointer(pTrigger)).FzName + (*Parse)(unsafe.Pointer(pSubParse)).FeTriggerOp = (*Trigger)(unsafe.Pointer(pTrigger)).Fop + (*Parse)(unsafe.Pointer(pSubParse)).FnQueryLoop = (*Parse)(unsafe.Pointer(pParse)).FnQueryLoop + (*Parse)(unsafe.Pointer(pSubParse)).FdisableVtab = (*Parse)(unsafe.Pointer(pParse)).FdisableVtab + + v = Xsqlite3GetVdbe(tls, pSubParse) + if v != 0 { + + if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { + Xsqlite3VdbeChangeP4(tls, v, -1, + Xsqlite3MPrintf(tls, db, ts+18831 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + } + + // If one was specified, code the WHEN clause. If it evaluates to false + // (or NULL) the sub-vdbe is immediately halted by jumping to the + // OP_Halt inserted at the end of the program. + if (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen != 0 { + pWhen = Xsqlite3ExprDup(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen, 0) + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && + (SQLITE_OK == Xsqlite3ResolveExprNames(tls, bp+8 /* &sNC */, pWhen)) { + iEndTrigger = Xsqlite3VdbeMakeLabel(tls, pSubParse) + Xsqlite3ExprIfFalse(tls, pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL) + } + Xsqlite3ExprDelete(tls, db, pWhen) + } + + // Code the trigger program into the sub-vdbe. + codeTriggerProgram(tls, pSubParse, (*Trigger)(unsafe.Pointer(pTrigger)).Fstep_list, orconf) + + // Insert an OP_Halt at the end of the sub-program. + if iEndTrigger != 0 { + Xsqlite3VdbeResolveLabel(tls, v, iEndTrigger) + } + Xsqlite3VdbeAddOp0(tls, v, OP_Halt) + + transferParseError(tls, pParse, pSubParse) + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && ((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) { + (*SubProgram)(unsafe.Pointer(pProgram)).FaOp = Xsqlite3VdbeTakeOpArray(tls, v, (pProgram + 8 /* &.nOp */), (pTop + 128 /* &.nMaxArg */)) + } + (*SubProgram)(unsafe.Pointer(pProgram)).FnMem = (*Parse)(unsafe.Pointer(pSubParse)).FnMem + (*SubProgram)(unsafe.Pointer(pProgram)).FnCsr = (*Parse)(unsafe.Pointer(pSubParse)).FnTab + (*SubProgram)(unsafe.Pointer(pProgram)).Ftoken = pTrigger + *(*U32)(unsafe.Pointer((pPrg + 28 /* &.aColmask */))) = (*Parse)(unsafe.Pointer(pSubParse)).Foldmask + *(*U32)(unsafe.Pointer((pPrg + 28 /* &.aColmask */) + 1*4)) = (*Parse)(unsafe.Pointer(pSubParse)).Fnewmask + Xsqlite3VdbeDelete(tls, v) + } + + Xsqlite3ParserReset(tls, pSubParse) + Xsqlite3DbFree(tls, db, pSubParse) + + return pPrg +} + +// Return a pointer to a TriggerPrg object containing the sub-program for +// trigger pTrigger with default ON CONFLICT algorithm orconf. If no such +// TriggerPrg object exists, a new object is allocated and populated before +// being returned. +func getRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, orconf int32) uintptr { /* sqlite3.c:140880:19: */ + var pRoot uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + var pPrg uintptr + + // It may be that this trigger has already been coded (or is in the + // process of being coded). If this is the case, then an entry with + // a matching TriggerPrg.pTrigger field will be present somewhere + // in the Parse.pTriggerPrg list. Search for such an entry. + for pPrg = (*Parse)(unsafe.Pointer(pRoot)).FpTriggerPrg; (pPrg != 0) && (((*TriggerPrg)(unsafe.Pointer(pPrg)).FpTrigger != pTrigger) || ((*TriggerPrg)(unsafe.Pointer(pPrg)).Forconf != orconf)); pPrg = (*TriggerPrg)(unsafe.Pointer(pPrg)).FpNext { + } + + // If an existing TriggerPrg could not be located, create a new one. + if !(pPrg != 0) { + pPrg = codeRowTrigger(tls, pParse, pTrigger, pTab, orconf) + } + + return pPrg +} + +// Generate code for the trigger program associated with trigger p on +// table pTab. The reg, orconf and ignoreJump parameters passed to this +// function are the same as those described in the header function for +// sqlite3CodeRowTrigger() +func Xsqlite3CodeRowTriggerDirect(tls *libc.TLS, pParse uintptr, p uintptr, pTab uintptr, reg int32, orconf int32, ignoreJump int32) { /* sqlite3.c:140914:21: */ + var v uintptr = Xsqlite3GetVdbe(tls, pParse) // Main VM + var pPrg uintptr + pPrg = getRowTrigger(tls, pParse, p, pTab, orconf) + + // Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program + // is a pointer to the sub-vdbe containing the trigger program. + if pPrg != 0 { + var bRecursive int32 = (libc.Bool32(((*Trigger)(unsafe.Pointer(p)).FzName != 0) && (uint64(0) == ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_RecTriggers))))) + + Xsqlite3VdbeAddOp4(tls, v, OP_Program, reg, ignoreJump, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1), + (*TriggerPrg)(unsafe.Pointer(pPrg)).FpProgram, -4) + + // Set the P5 operand of the OP_Program instruction to non-zero if + // recursive invocation of this trigger program is disallowed. Recursive + // invocation is disallowed if (a) the sub-program is really a trigger, + // not a foreign key action, and (b) the flag to enable recursive triggers + // is clear. + Xsqlite3VdbeChangeP5(tls, v, uint16(U8(bRecursive))) + } +} + +// This is called to code the required FOR EACH ROW triggers for an operation +// on table pTab. The operation to code triggers for (INSERT, UPDATE or DELETE) +// is given by the op parameter. The tr_tm parameter determines whether the +// BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then +// parameter pChanges is passed the list of columns being modified. +// +// If there are no triggers that fire at the specified time for the specified +// operation on pTab, this function is a no-op. +// +// The reg argument is the address of the first in an array of registers +// that contain the values substituted for the new.* and old.* references +// in the trigger program. If N is the number of columns in table pTab +// (a copy of pTab->nCol), then registers are populated as follows: +// +// Register Contains +// ------------------------------------------------------ +// reg+0 OLD.rowid +// reg+1 OLD.* value of left-most column of pTab +// ... ... +// reg+N OLD.* value of right-most column of pTab +// reg+N+1 NEW.rowid +// reg+N+2 NEW.* value of left-most column of pTab +// ... ... +// reg+N+N+1 NEW.* value of right-most column of pTab +// +// For ON DELETE triggers, the registers containing the NEW.* values will +// never be accessed by the trigger program, so they are not allocated or +// populated by the caller (there is no data to populate them with anyway). +// Similarly, for ON INSERT triggers the values stored in the OLD.* registers +// are never accessed, and so are not allocated by the caller. So, for an +// ON INSERT trigger, the value passed to this function as parameter reg +// is not a readable register, although registers (reg+N) through +// (reg+N+N+1) are. +// +// Parameter orconf is the default conflict resolution algorithm for the +// trigger program to use (REPLACE, IGNORE etc.). Parameter ignoreJump +// is the instruction that control should jump to if a trigger program +// raises an IGNORE exception. +func Xsqlite3CodeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, op int32, pChanges uintptr, tr_tm int32, pTab uintptr, reg int32, orconf int32, ignoreJump int32) { /* sqlite3.c:140986:21: */ + var p uintptr // Used to iterate through pTrigger list + + for p = pTrigger; p != 0; p = (*Trigger)(unsafe.Pointer(p)).FpNext { + + // Sanity checking: The schema for the trigger and for the table are + // always defined. The trigger must be in the same schema as the table + // or else it must be a TEMP trigger. + + // Determine whether we should code this trigger. One of two choices: + // 1. The trigger is an exact match to the current DML statement + // 2. This is a RETURNING trigger for INSERT but we are currently + // doing the UPDATE part of an UPSERT. + if (((int32((*Trigger)(unsafe.Pointer(p)).Fop) == op) || ((((*Trigger)(unsafe.Pointer(p)).FbReturning != 0) && (int32((*Trigger)(unsafe.Pointer(p)).Fop) == TK_INSERT)) && (op == TK_UPDATE))) && + (int32((*Trigger)(unsafe.Pointer(p)).Ftr_tm) == tr_tm)) && + (checkColumnOverlap(tls, (*Trigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0) { + if !(int32((*Trigger)(unsafe.Pointer(p)).FbReturning) != 0) { + Xsqlite3CodeRowTriggerDirect(tls, pParse, p, pTab, reg, orconf, ignoreJump) + } else if (*Parse)(unsafe.Pointer((pParse))).FpToplevel == uintptr(0) { + codeReturningTrigger(tls, pParse, p, pTab, reg) + } + } + } +} + +// Triggers may access values stored in the old.* or new.* pseudo-table. +// This function returns a 32-bit bitmask indicating which columns of the +// old.* or new.* tables actually are used by triggers. This information +// may be used by the caller, for example, to avoid having to load the entire +// old.* record into memory when executing an UPDATE or DELETE command. +// +// Bit 0 of the returned mask is set if the left-most column of the +// table may be accessed using an [old|new].reference. Bit 1 is set if +// the second leftmost column value is required, and so on. If there +// are more than 32 columns in the table, and at least one of the columns +// with an index greater than 32 may be accessed, 0xffffffff is returned. +// +// It is not possible to determine if the old.rowid or new.rowid column is +// accessed by triggers. The caller must always assume that it is. +// +// Parameter isNew must be either 1 or 0. If it is 0, then the mask returned +// applies to the old.* table. If 1, the new.* table. +// +// Parameter tr_tm must be a mask with one or both of the TRIGGER_BEFORE +// and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only +// included in the returned mask if the TRIGGER_BEFORE bit is set in the +// tr_tm parameter. Similarly, values accessed by AFTER triggers are only +// included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm. +func Xsqlite3TriggerColmask(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pChanges uintptr, isNew int32, tr_tm int32, pTab uintptr, orconf int32) U32 { /* sqlite3.c:141056:20: */ + var op int32 + if pChanges != 0 { + op = TK_UPDATE + } else { + op = TK_DELETE + } + var mask U32 = U32(0) + var p uintptr + + for p = pTrigger; p != 0; p = (*Trigger)(unsafe.Pointer(p)).FpNext { + if ((int32((*Trigger)(unsafe.Pointer(p)).Fop) == op) && + ((tr_tm & int32((*Trigger)(unsafe.Pointer(p)).Ftr_tm)) != 0)) && + (checkColumnOverlap(tls, (*Trigger)(unsafe.Pointer(p)).FpColumns, pChanges) != 0) { + if (*Trigger)(unsafe.Pointer(p)).FbReturning != 0 { + mask = 0xffffffff + } else { + var pPrg uintptr + pPrg = getRowTrigger(tls, pParse, p, pTab, orconf) + if pPrg != 0 { + mask = mask | (*(*U32)(unsafe.Pointer((pPrg + 28 /* &.aColmask */) + uintptr(isNew)*4))) + } + } + } + } + + return mask +} + +// The most recently coded instruction was an OP_Column to retrieve the +// i-th column of table pTab. This routine sets the P4 parameter of the +// OP_Column to the default value, if any. +// +// The default value of a column is specified by a DEFAULT clause in the +// column definition. This was either supplied by the user when the table +// was created, or added later to the table definition by an ALTER TABLE +// command. If the latter, then the row-records in the table btree on disk +// may not contain a value for the column and the default value, taken +// from the P4 parameter of the OP_Column instruction, is returned instead. +// If the former, then all row-records are guaranteed to include a value +// for the column and the P4 value is not required. +// +// Column definitions created by an ALTER TABLE command may only have +// literal default values specified: a number, null or a string. (If a more +// complicated default expression value was provided, it is evaluated +// when the ALTER TABLE is executed and one of the literal values written +// into the sqlite_schema table.) +// +// Therefore, the P4 parameter is only required if the default value for +// the column is a literal number, string or null. The sqlite3ValueFromExpr() +// function is capable of transforming these types of expressions into +// sqlite3_value objects. +// +// If column as REAL affinity and the table is an ordinary b-tree table +// (not a virtual table) then the value might have been stored as an +// integer. In that case, add an OP_RealAffinity opcode to make sure +// it has been converted into REAL. +func Xsqlite3ColumnDefault(tls *libc.TLS, v uintptr, pTab uintptr, i int32, iReg int32) { /* sqlite3.c:141154:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if !(int32((*Table)(unsafe.Pointer(pTab)).FpSelect) != 0) { + *(*uintptr)(unsafe.Pointer(bp /* pValue */)) = uintptr(0) + var enc U8 = (*Sqlite3)(unsafe.Pointer(Xsqlite3VdbeDb(tls, v))).Fenc + var pCol uintptr = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32) + + Xsqlite3ValueFromExpr(tls, Xsqlite3VdbeDb(tls, v), (*Column)(unsafe.Pointer(pCol)).FpDflt, enc, + uint8((*Column)(unsafe.Pointer(pCol)).Faffinity), bp /* &pValue */) + if *(*uintptr)(unsafe.Pointer(bp /* pValue */)) != 0 { + Xsqlite3VdbeAppendP4(tls, v, *(*uintptr)(unsafe.Pointer(bp /* pValue */)), -11) + } + } + if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).Faffinity) == SQLITE_AFF_REAL) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + Xsqlite3VdbeAddOp1(tls, v, OP_RealAffinity, iReg) + } +} + +// Check to see if column iCol of index pIdx references any of the +// columns defined by aXRef and chngRowid. Return true if it does +// and false if not. This is an optimization. False-positives are a +// performance degradation, but false-negatives can result in a corrupt +// index and incorrect answers. +// +// aXRef[j] will be non-negative if column j of the original table is +// being updated. chngRowid will be true if the rowid of the table is +// being updated. +func indexColumnIsBeingUpdated(tls *libc.TLS, pIdx uintptr, iCol int32, aXRef uintptr, chngRowid int32) int32 { /* sqlite3.c:141186:12: */ + var iIdxCol I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2)) + // Cannot index rowid + if int32(iIdxCol) >= 0 { + return (libc.Bool32(*(*int32)(unsafe.Pointer(aXRef + uintptr(iIdxCol)*4)) >= 0)) + } + + return Xsqlite3ExprReferencesUpdatedColumn(tls, (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr+8 /* &.a */)+uintptr(iCol)*32)).FpExpr, + aXRef, chngRowid) +} + +// Check to see if index pIdx is a partial index whose conditional +// expression might change values due to an UPDATE. Return true if +// the index is subject to change and false if the index is guaranteed +// to be unchanged. This is an optimization. False-positives are a +// performance degradation, but false-negatives can result in a corrupt +// index and incorrect answers. +// +// aXRef[j] will be non-negative if column j of the original table is +// being updated. chngRowid will be true if the rowid of the table is +// being updated. +func indexWhereClauseMightChange(tls *libc.TLS, pIdx uintptr, aXRef uintptr, chngRowid int32) int32 { /* sqlite3.c:141216:12: */ + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere == uintptr(0) { + return 0 + } + return Xsqlite3ExprReferencesUpdatedColumn(tls, (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere, + aXRef, chngRowid) +} + +// Allocate and return a pointer to an expression of type TK_ROW with +// Expr.iColumn set to value (iCol+1). The resolver will modify the +// expression to be a TK_COLUMN reading column iCol of the first +// table in the source-list (pSrc->a[0]). +func exprRowColumn(tls *libc.TLS, pParse uintptr, iCol int32) uintptr { /* sqlite3.c:141232:13: */ + var pRet uintptr = Xsqlite3PExpr(tls, pParse, TK_ROW, uintptr(0), uintptr(0)) + if pRet != 0 { + (*Expr)(unsafe.Pointer(pRet)).FiColumn = (YnVar(iCol + 1)) + } + return pRet +} + +// Assuming both the pLimit and pOrderBy parameters are NULL, this function +// generates VM code to run the query: +// +// SELECT , pChanges FROM pTabList WHERE pWhere +// +// and write the results to the ephemeral table already opened as cursor +// iEph. None of pChanges, pTabList or pWhere are modified or consumed by +// this function, they must be deleted by the caller. +// +// Or, if pLimit and pOrderBy are not NULL, and pTab is not a view: +// +// SELECT , pChanges FROM pTabList +// WHERE pWhere +// GROUP BY +// ORDER BY pOrderBy LIMIT pLimit +// +// If pTab is a view, the GROUP BY clause is omitted. +// +// Exactly how results are written to table iEph, and exactly what +// the in the query above are is determined by the type +// of table pTabList->a[0].pTab. +// +// If the table is a WITHOUT ROWID table, then argument pPk must be its +// PRIMARY KEY. In this case are the primary key columns +// of the table, in order. The results of the query are written to ephemeral +// table iEph as index keys, using OP_IdxInsert. +// +// If the table is actually a view, then are all columns of +// the view. The results are written to the ephemeral table iEph as records +// with automatically assigned integer keys. +// +// If the table is a virtual or ordinary intkey table, then +// is its rowid. For a virtual table, the results are written to iEph as +// records with automatically assigned integer keys For intkey tables, the +// rowid value in is used as the integer key, and the +// remaining fields make up the table record. +func updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, pChanges uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pLimit uintptr) { /* sqlite3.c:141276:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var i int32 + // var dest SelectDest at bp, 40 + + var pSelect uintptr = uintptr(0) + var pList uintptr = uintptr(0) + var pGrp uintptr = uintptr(0) + var pLimit2 uintptr = uintptr(0) + var pOrderBy2 uintptr = uintptr(0) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pTab uintptr = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FpTab + var pSrc uintptr + var pWhere2 uintptr + var eDest int32 + + _ = pOrderBy + _ = pLimit + + pSrc = Xsqlite3SrcListDup(tls, db, pTabList, 0) + pWhere2 = Xsqlite3ExprDup(tls, db, pWhere, 0) + + if pSrc != 0 { + libc.SetBitFieldPtr16Uint32((pSrc+8 /* &.a */)+60 /* &.fg */ +4 /* &.notCte */, uint32(1), 8, 0x100) + (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FiCursor = -1 + (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FpTab)).FnTabRef-- + (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FpTab = uintptr(0) + } + if pPk != 0 { + for i = 0; i < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol); i++ { + var pNew uintptr = exprRowColumn(tls, pParse, int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)))) + pList = Xsqlite3ExprListAppend(tls, pParse, pList, pNew) + } + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + eDest = SRT_Table + } else { + eDest = SRT_Upfrom + } + } else if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + pList = Xsqlite3ExprListAppend(tls, pParse, pList, exprRowColumn(tls, pParse, i)) + } + eDest = SRT_Table + } else { + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + eDest = SRT_Table + } else { + eDest = SRT_Upfrom + } + pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), Xsqlite3PExpr(tls, pParse, TK_ROW, uintptr(0), uintptr(0))) + } + + if pChanges != 0 { + for i = 0; i < (*ExprList)(unsafe.Pointer(pChanges)).FnExpr; i++ { + pList = Xsqlite3ExprListAppend(tls, pParse, pList, + Xsqlite3ExprDup(tls, db, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FpExpr, 0)) + } + } + pSelect = Xsqlite3SelectNew(tls, pParse, pList, + pSrc, pWhere2, pGrp, uintptr(0), pOrderBy2, (uint32(SF_UpdateFrom | SF_IncludeHidden)), pLimit2) + Xsqlite3SelectDestInit(tls, bp /* &dest */, eDest, iEph) + (*SelectDest)(unsafe.Pointer(bp /* &dest */)).FiSDParm2 = func() int32 { + if pPk != 0 { + return int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + } + return -1 + }() + Xsqlite3Select(tls, pParse, pSelect, bp /* &dest */) + Xsqlite3SelectDelete(tls, db, pSelect) +} + +// Process an UPDATE statement. +// +// UPDATE OR IGNORE tbl SET a=b, c=d FROM tbl2... WHERE e<5 AND f NOT NULL; +// \_______/ \_/ \______/ \_____/ \________________/ +// onError | pChanges | pWhere +// \_______________________/ +// pTabList +func Xsqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges uintptr, pWhere uintptr, onError int32, pOrderBy uintptr, pLimit uintptr, pUpsert uintptr) { /* sqlite3.c:141372:21: */ + bp := tls.Alloc(108) + defer tls.Free(108) + + var i int32 + var j int32 + var k int32 // Loop counters + var pTab uintptr // The table to be updated + var addrTop int32 // VDBE instruction address of the start of the loop + var pWInfo uintptr // Information about the WHERE clause + var v uintptr // The virtual database engine + var pIdx uintptr // For looping over indices + var pPk uintptr // The PRIMARY KEY index for WITHOUT ROWID tables + var nIdx int32 // Number of indices that need updating + var nAllIdx int32 // Total number of indexes + var iBaseCur int32 // Base cursor number + var iDataCur int32 // Cursor for the canonical data btree + var iIdxCur int32 // Cursor for the first index + var db uintptr // The database structure + var aRegIdx uintptr // Registers for to each index and the main table + var aXRef uintptr // aXRef[i] is the index in pChanges->a[] of the + // an expression for the i-th column of the table. + // aXRef[i]==-1 if the i-th column is not changed. + var aToOpen uintptr // 1 for tables and indices to be opened + var chngPk U8 // PRIMARY KEY changed in a WITHOUT ROWID table + var chngRowid U8 // Rowid changed in a normal table + var chngKey U8 // Either chngPk or chngRowid + var pRowidExpr uintptr // Expression defining the new record number + var iRowidExpr int32 // Index of "rowid=" (or IPK) assignment in pChanges + // var sContext AuthContext at bp+16, 16 + // The authorization context + // var sNC NameContext at bp+40, 56 + // The name-context to resolve expressions in + var iDb int32 // Database containing the table being updated + var eOnePass int32 // ONEPASS_XXX value from where.c + var hasFK int32 // True if foreign key processing is required + var labelBreak int32 // Jump here to break out of UPDATE loop + var labelContinue int32 // Jump here to continue next step of UPDATE loop + var flags int32 // Flags for sqlite3WhereBegin() + + var isView int32 // True when updating a view (INSTEAD OF trigger) + var pTrigger uintptr // List of triggers on pTab, if required + // var tmask int32 at bp+32, 4 + // Mask of TRIGGER_BEFORE|TRIGGER_AFTER + var newmask int32 // Mask of NEW.* columns accessed by BEFORE triggers + var iEph int32 // Ephemeral table holding all primary key values + var nKey int32 // Number of elements in regKey for WITHOUT ROWID + // var aiCurOnePass [2]int32 at bp+96, 8 + // The write cursors opened by WHERE_ONEPASS + var addrOpen int32 // Address of OP_OpenEphemeral + var iPk int32 // First of nPk cells holding PRIMARY KEY value + var nPk I16 // Number of components of the PRIMARY KEY + // var bReplace int32 at bp+104, 4 + // True if REPLACE conflict resolution might happen + var bFinishSeek int32 // The OP_FinishSeek opcode is needed + var nChangeFrom int32 // If there is a FROM, pChanges->nExpr, else 0 + + // Register Allocations + var regRowCount int32 // A count of rows changed + var regOldRowid int32 // The old rowid + var regNewRowid int32 // The new rowid + var regNew int32 // Content of the NEW.* table in triggers + var regOld int32 // Content of OLD.* table in triggers + var regRowSet int32 // Rowset of rows to be updated + var regKey int32 + var rc int32 + var bProgress int32 + var reg int32 + var pKeyInfo uintptr + var nEphCol int32 + var iCur int32 + var addrOnce int32 + var colFlags U32 + var oldmask U32 + var nOff int32 + addrTop = 0 + pWInfo = uintptr(0) + aRegIdx = uintptr(0) + aXRef = uintptr(0) + pRowidExpr = uintptr(0) + iRowidExpr = -1 + iEph = 0 + nKey = 0 + addrOpen = 0 + iPk = 0 + nPk = int16(0) + *(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) = 0 + bFinishSeek = 1 + nChangeFrom = 0 + regRowCount = 0 + regOldRowid = 0 + regNewRowid = 0 + regNew = 0 + regOld = 0 + regRowSet = 0 + regKey = 0 // composite PRIMARY KEY value + + libc.Xmemset(tls, bp+16 /* &sContext */, 0, uint64(unsafe.Sizeof(AuthContext{}))) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __1 + } + goto update_cleanup +__1: + ; + + // Locate the table which we want to update. + pTab = Xsqlite3SrcListLookup(tls, pParse, pTabList) + if !(pTab == uintptr(0)) { + goto __2 + } + goto update_cleanup +__2: + ; + iDb = Xsqlite3SchemaToIndex(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Table)(unsafe.Pointer(pTab)).FpSchema) + + // Figure out if we have any triggers and if the table being + // updated is a view. + pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_UPDATE, pChanges, bp+32 /* &tmask */) + isView = (libc.Bool32((*Table)(unsafe.Pointer(pTab)).FpSelect != uintptr(0))) + + // If there was a FROM clause, set nChangeFrom to the number of expressions + // in the change-list. Otherwise, set it to 0. There cannot be a FROM + // clause if this function is being called to generate code for part of + // an UPSERT statement. + if (*SrcList)(unsafe.Pointer(pTabList)).FnSrc > 1 { + nChangeFrom = (*ExprList)(unsafe.Pointer(pChanges)).FnExpr + } else { + nChangeFrom = 0 + } + + if !(Xsqlite3ViewGetColumnNames(tls, pParse, pTab) != 0) { + goto __3 + } + goto update_cleanup +__3: + ; + if !(Xsqlite3IsReadOnly(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 32 /* tmask */))) != 0) { + goto __4 + } + goto update_cleanup +__4: + ; + + // Allocate a cursors for the main database table and for all indices. + // The index cursors might not be used, but if they are used they + // need to occur right after the database cursor. So go ahead and + // allocate enough space, just in case. + iBaseCur = libc.AssignInt32(&iDataCur, libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1)) + iIdxCur = (iDataCur + 1) + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + pPk = uintptr(0) + } else { + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + } + + nIdx = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__5: + if !(pIdx != 0) { + goto __7 + } + if !(pPk == pIdx) { + goto __8 + } + iDataCur = (*Parse)(unsafe.Pointer(pParse)).FnTab +__8: + ; + (*Parse)(unsafe.Pointer(pParse)).FnTab++ + goto __6 +__6: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + nIdx++ + goto __5 + goto __7 +__7: + ; + if !(pUpsert != 0) { + goto __9 + } + // On an UPSERT, reuse the same cursors already opened by INSERT + iDataCur = (*Upsert)(unsafe.Pointer(pUpsert)).FiDataCur + iIdxCur = (*Upsert)(unsafe.Pointer(pUpsert)).FiIdxCur + (*Parse)(unsafe.Pointer(pParse)).FnTab = iBaseCur +__9: + ; + (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor = iDataCur + + // Allocate space for aXRef[], aRegIdx[], and aToOpen[]. + // Initialize aXRef[] and aToOpen[] to their default values. + aXRef = Xsqlite3DbMallocRawNN(tls, db, (uint64(((uint64(unsafe.Sizeof(int32(0))) * (uint64((int32((*Table)(unsafe.Pointer(pTab)).FnCol) + nIdx) + 1))) + uint64(nIdx)) + uint64(2)))) + if !(aXRef == uintptr(0)) { + goto __10 + } + goto update_cleanup +__10: + ; + aRegIdx = (aXRef + uintptr((*Table)(unsafe.Pointer(pTab)).FnCol)*4) + aToOpen = ((aRegIdx + uintptr(nIdx)*4) + uintptr(1)*4) + libc.Xmemset(tls, aToOpen, 1, (uint64(nIdx + 1))) + *(*U8)(unsafe.Pointer(aToOpen + uintptr((nIdx + 1)))) = U8(0) + i = 0 +__11: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __13 + } + *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = -1 + goto __12 +__12: + i++ + goto __11 + goto __13 +__13: + ; + + // Initialize the name-context + libc.Xmemset(tls, bp+40 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 40 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 40 /* &sNC */)).FpSrcList = pTabList + *(*uintptr)(unsafe.Pointer(bp + 40 /* &sNC */ + 16 /* &.uNC */)) = pUpsert + (*NameContext)(unsafe.Pointer(bp + 40 /* &sNC */)).FncFlags = NC_UUpsert + + // Begin generating code. + v = Xsqlite3GetVdbe(tls, pParse) + if !(v == uintptr(0)) { + goto __14 + } + goto update_cleanup +__14: + ; + + // Resolve the column names in all the expressions of the + // of the UPDATE statement. Also find the column index + // for each column to be updated in the pChanges array. For each + // column to be updated, make sure we have authorization to change + // that column. + chngRowid = libc.AssignUint8(&chngPk, U8(0)) + i = 0 +__15: + if !(i < (*ExprList)(unsafe.Pointer(pChanges)).FnExpr) { + goto __17 + } + // If this is an UPDATE with a FROM clause, do not resolve expressions + // here. The call to sqlite3Select() below will do that. + if !((nChangeFrom == 0) && (Xsqlite3ResolveExprNames(tls, bp+40 /* &sNC */, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FpExpr) != 0)) { + goto __18 + } + goto update_cleanup +__18: + ; + j = 0 +__19: + if !(j < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __21 + } + if !(Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName) == 0) { + goto __22 + } + if !(j == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __23 + } + chngRowid = U8(1) + pRowidExpr = (*ExprList_item)(unsafe.Pointer((pChanges + 8 /* &.a */) + uintptr(i)*32)).FpExpr + iRowidExpr = i + goto __24 +__23: + if !((pPk != 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0)) { + goto __25 + } + chngPk = U8(1) + goto __26 +__25: + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FcolFlags) & COLFLAG_GENERATED) != 0) { + goto __27 + } + + Xsqlite3ErrorMsg(tls, pParse, + ts+18845, /* "cannot UPDATE ge..." */ + libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) + goto update_cleanup +__27: + ; +__26: + ; +__24: + ; + *(*int32)(unsafe.Pointer(aXRef + uintptr(j)*4)) = i + goto __21 +__22: + ; + goto __20 +__20: + j++ + goto __19 + goto __21 +__21: + ; + if !(j >= int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __28 + } + if !((pPk == uintptr(0)) && (Xsqlite3IsRowid(tls, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName) != 0)) { + goto __29 + } + j = -1 + chngRowid = U8(1) + pRowidExpr = (*ExprList_item)(unsafe.Pointer((pChanges + 8 /* &.a */) + uintptr(i)*32)).FpExpr + iRowidExpr = i + goto __30 +__29: + Xsqlite3ErrorMsg(tls, pParse, ts+18881 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) + (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) + goto update_cleanup +__30: + ; +__28: + ; + + rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, + func() uintptr { + if j < 0 { + return ts + 6689 /* "ROWID" */ + } + return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName + }(), + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) + if !(rc == SQLITE_DENY) { + goto __31 + } + goto update_cleanup + goto __32 +__31: + if !(rc == SQLITE_IGNORE) { + goto __33 + } + *(*int32)(unsafe.Pointer(aXRef + uintptr(j)*4)) = -1 +__33: + ; +__32: + ; + + goto __16 +__16: + i++ + goto __15 + goto __17 +__17: + ; + + chngKey = (U8(int32(chngRowid) + int32(chngPk))) + + // Mark generated columns as changing if their generator expressions + // reference any changing column. The actual aXRef[] value for + // generated expressions is not used, other than to check to see that it + // is non-negative, so the value of aXRef[] for generated columns can be + // set to any non-negative number. We use 99999 so that the value is + // obvious when looking at aXRef[] in a symbolic debugger. + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != 0) { + goto __34 + } + +__35: + bProgress = 0 + i = 0 +__38: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __40 + } + if !(*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0) { + goto __41 + } + goto __39 +__41: + ; + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_GENERATED) == 0) { + goto __42 + } + goto __39 +__42: + ; + if !(Xsqlite3ExprReferencesUpdatedColumn(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FpDflt, + aXRef, int32(chngRowid)) != 0) { + goto __43 + } + *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) = 99999 + bProgress = 1 +__43: + ; + goto __39 +__39: + i++ + goto __38 + goto __40 +__40: + ; + goto __36 +__36: + if bProgress != 0 { + goto __35 + } + goto __37 +__37: + ; +__34: + ; + + // The SET expressions are not actually used inside the WHERE loop. + // So reset the colUsed mask. Unless this is a virtual table. In that + // case, set all bits of the colUsed mask (to ensure that the virtual + // table implementation makes all columns available). + (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FcolUsed = func() uint64 { + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + return libc.Uint64(libc.Uint64FromInt32(-1)) + } + return uint64(0) + }() + + hasFK = Xsqlite3FkRequired(tls, pParse, pTab, aXRef, int32(chngKey)) + + // There is one entry in the aRegIdx[] array for each index on the table + // being updated. Fill in aRegIdx[] with a register number that will hold + // the key for accessing each index. + if !(onError == OE_Replace) { + goto __44 + } + *(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) = 1 +__44: + ; + nAllIdx = 0 + pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex +__45: + if !(pIdx != 0) { + goto __47 + } + if !((((chngKey != 0) || (hasFK > 1)) || (pIdx == pPk)) || + (indexWhereClauseMightChange(tls, pIdx, aXRef, int32(chngRowid)) != 0)) { + goto __48 + } + reg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn)) + goto __49 +__48: + reg = 0 + i = 0 +__50: + if !(i < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol)) { + goto __52 + } + if !(indexColumnIsBeingUpdated(tls, pIdx, i, aXRef, int32(chngRowid)) != 0) { + goto __53 + } + reg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn)) + if !((onError == OE_Default) && (int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Replace)) { + goto __54 + } + *(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) = 1 +__54: + ; + goto __52 +__53: + ; + goto __51 +__51: + i++ + goto __50 + goto __52 +__52: + ; +__49: + ; + if !(reg == 0) { + goto __55 + } + *(*U8)(unsafe.Pointer(aToOpen + uintptr((nAllIdx + 1)))) = U8(0) +__55: + ; + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = reg + goto __46 +__46: + pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext + nAllIdx++ + goto __45 + goto __47 +__47: + ; + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) // Register storing the table record + if !(*(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) != 0) { + goto __56 + } + // If REPLACE conflict resolution might be invoked, open cursors on all + // indexes in case they are needed to delete records. + libc.Xmemset(tls, aToOpen, 1, (uint64(nIdx + 1))) +__56: + ; + + if !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) { + goto __57 + } + Xsqlite3VdbeCountChanges(tls, v) +__57: + ; + Xsqlite3BeginWriteOperation(tls, pParse, (libc.Bool32((pTrigger != 0) || (hasFK != 0))), iDb) + + // Allocate required registers. + if !(!((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) { + goto __58 + } + // For now, regRowSet and aRegIdx[nAllIdx] share the same register. + // If regRowSet turns out to be needed, then aRegIdx[nAllIdx] will be + // reallocated. aRegIdx[nAllIdx] is the register in which the main + // table record is written. regRowSet holds the RowSet for the + // two-pass update algorithm. + + regRowSet = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) + regOldRowid = libc.AssignInt32(®NewRowid, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + if !(((chngPk != 0) || (pTrigger != 0)) || (hasFK != 0)) { + goto __59 + } + regOld = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Table)(unsafe.Pointer(pTab)).FnCol)) +__59: + ; + if !(((chngKey != 0) || (pTrigger != 0)) || (hasFK != 0)) { + goto __60 + } + regNewRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) +__60: + ; + regNew = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32((*Table)(unsafe.Pointer(pTab)).FnCol)) +__58: + ; + + // Start the view context. + if !(isView != 0) { + goto __61 + } + Xsqlite3AuthContextPush(tls, pParse, bp+16 /* &sContext */, (*Table)(unsafe.Pointer(pTab)).FzName) +__61: + ; + + // If we are trying to update a view, realize that view into + // an ephemeral table. + if !((nChangeFrom == 0) && (isView != 0)) { + goto __62 + } + Xsqlite3MaterializeView(tls, pParse, pTab, + pWhere, pOrderBy, pLimit, iDataCur) + pOrderBy = uintptr(0) + pLimit = uintptr(0) +__62: + ; + + // Resolve the column names in all the expressions in the + // WHERE clause. + if !((nChangeFrom == 0) && (Xsqlite3ResolveExprNames(tls, bp+40 /* &sNC */, pWhere) != 0)) { + goto __63 + } + goto update_cleanup +__63: + ; + + // Virtual tables must be handled separately + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __64 + } + updateVirtualTable(tls, pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef, + pWhere, onError) + goto update_cleanup +__64: + ; + + // Jump to labelBreak to abandon further processing of this UPDATE + labelContinue = libc.AssignInt32(&labelBreak, Xsqlite3VdbeMakeLabel(tls, pParse)) + + // Not an UPSERT. Normal processing. Begin by + // initialize the count of updated rows + if !(((((((*Sqlite3)(unsafe.Pointer(db)).Fflags & (U64((uint64(0x00001))) << 32)) != uint64(0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0)) && + !(int32((*Parse)(unsafe.Pointer(pParse)).FbReturning) != 0)) && + (pUpsert == uintptr(0))) { + goto __65 + } + regRowCount = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regRowCount) +__65: + ; + + if !((nChangeFrom == 0) && (((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { + goto __66 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, regRowSet, regOldRowid) + iEph = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + addrOpen = Xsqlite3VdbeAddOp3(tls, v, OP_OpenEphemeral, iEph, 0, regRowSet) + goto __67 +__66: + ; + if pPk != 0 { + nPk = int16((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + } else { + nPk = int16(0) + } + iPk = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (int32(nPk)) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nChangeFrom) + regKey = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + if !(pUpsert == uintptr(0)) { + goto __68 + } + nEphCol = ((int32(nPk) + nChangeFrom) + (func() int32 { + if isView != 0 { + return int32((*Table)(unsafe.Pointer(pTab)).FnCol) + } + return 0 + }())) + iEph = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + if !(pPk != 0) { + goto __69 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, iPk, ((iPk + int32(nPk)) - 1)) +__69: + ; + addrOpen = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, iEph, nEphCol) + if !(pPk != 0) { + goto __70 + } + pKeyInfo = Xsqlite3KeyInfoOfIndex(tls, pParse, pPk) + if !(pKeyInfo != 0) { + goto __71 + } + (*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnAllField = U16(nEphCol) + Xsqlite3VdbeAppendP4(tls, v, pKeyInfo, -9) +__71: + ; +__70: + ; + if !(nChangeFrom != 0) { + goto __72 + } + updateFromSelect(tls, + pParse, iEph, pPk, pChanges, pTabList, pWhere, pOrderBy, pLimit) + if !(isView != 0) { + goto __73 + } + iDataCur = iEph +__73: + ; +__72: + ; +__68: + ; +__67: + ; + + if !(nChangeFrom != 0) { + goto __74 + } + Xsqlite3MultiWrite(tls, pParse) + eOnePass = ONEPASS_OFF + nKey = int32(nPk) + regKey = iPk + goto __75 +__74: + if !(pUpsert != 0) { + goto __76 + } + // If this is an UPSERT, then all cursors have already been opened by + // the outer INSERT and the data cursor should be pointing at the row + // that is to be updated. So bypass the code that searches for the + // row(s) to be updated. + pWInfo = uintptr(0) + eOnePass = ONEPASS_SINGLE + Xsqlite3ExprIfFalse(tls, pParse, pWhere, labelBreak, SQLITE_JUMPIFNULL) + bFinishSeek = 0 + goto __77 +__76: + // Begin the database scan. + // + // Do not consider a single-pass strategy for a multi-row update if + // there are any triggers or foreign keys to process, or rows may + // be deleted as a result of REPLACE conflict handling. Any of these + // things might disturb a cursor being used to scan through the table + // or index, causing a single-pass approach to malfunction. + flags = WHERE_ONEPASS_DESIRED + if !((((!(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0) && !(pTrigger != 0)) && !(hasFK != 0)) && !(chngKey != 0)) && !(*(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) != 0)) { + goto __78 + } + flags = flags | (WHERE_ONEPASS_MULTIROW) +__78: + ; + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, uintptr(0), uintptr(0), uint16(flags), iIdxCur) + if !(pWInfo == uintptr(0)) { + goto __79 + } + goto update_cleanup +__79: + ; + + // A one-pass strategy that might update more than one row may not + // be used if any column of the index used for the scan is being + // updated. Otherwise, if there is an index on "b", statements like + // the following could create an infinite loop: + // + // UPDATE t1 SET b=b+1 WHERE b>? + // + // Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI + // strategy that uses an index for which one or more columns are being + // updated. + eOnePass = Xsqlite3WhereOkOnePass(tls, pWInfo, bp+96 /* &aiCurOnePass[0] */) + bFinishSeek = Xsqlite3WhereUsesDeferredSeek(tls, pWInfo) + if !(eOnePass != ONEPASS_SINGLE) { + goto __80 + } + Xsqlite3MultiWrite(tls, pParse) + if !(eOnePass == ONEPASS_MULTI) { + goto __81 + } + iCur = *(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) + if !(((iCur >= 0) && (iCur != iDataCur)) && (*(*U8)(unsafe.Pointer(aToOpen + uintptr((iCur - iBaseCur)))) != 0)) { + goto __82 + } + eOnePass = ONEPASS_OFF +__82: + ; + +__81: + ; +__80: + ; +__77: + ; + + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + goto __83 + } + // Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF + // mode, write the rowid into the FIFO. In either of the one-pass modes, + // leave it in register regOldRowid. + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iDataCur, regOldRowid) + if !(eOnePass == ONEPASS_OFF) { + goto __85 + } + *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iEph, regRowSet, regOldRowid) + goto __86 +__85: + if !(addrOpen != 0) { + goto __87 + } + Xsqlite3VdbeChangeToNoop(tls, v, addrOpen) +__87: + ; +__86: + ; + goto __84 +__83: + // Read the PK of the current row into an array of registers. In + // ONEPASS_OFF mode, serialize the array into a record and store it in + // the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change + // the OP_OpenEphemeral instruction to a Noop (the ephemeral table + // is not required) and leave the PK fields in the array of registers. + i = 0 +__88: + if !(i < int32(nPk)) { + goto __90 + } + + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, + int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2))), (iPk + i)) + goto __89 +__89: + i++ + goto __88 + goto __90 +__90: + ; + if !(eOnePass != 0) { + goto __91 + } + if !(addrOpen != 0) { + goto __93 + } + Xsqlite3VdbeChangeToNoop(tls, v, addrOpen) +__93: + ; + nKey = int32(nPk) + regKey = iPk + goto __92 +__91: + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, iPk, int32(nPk), regKey, + Xsqlite3IndexAffinityStr(tls, db, pPk), int32(nPk)) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iEph, regKey, iPk, int32(nPk)) +__92: + ; +__84: + ; +__75: + ; + + if !(pUpsert == uintptr(0)) { + goto __94 + } + if !((nChangeFrom == 0) && (eOnePass != ONEPASS_MULTI)) { + goto __95 + } + Xsqlite3WhereEnd(tls, pWInfo) +__95: + ; + + if !(!(isView != 0)) { + goto __96 + } + addrOnce = 0 + + // Open every index that needs updating. + if !(eOnePass != ONEPASS_OFF) { + goto __97 + } + if !(*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */)) >= 0) { + goto __98 + } + *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */)) - iBaseCur)))) = U8(0) +__98: + ; + if !(*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) >= 0) { + goto __99 + } + *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) - iBaseCur)))) = U8(0) +__99: + ; +__97: + ; + + if !((eOnePass == ONEPASS_MULTI) && ((nIdx - (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) >= 0))) > 0)) { + goto __100 + } + addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) +__100: + ; + Xsqlite3OpenTableAndIndices(tls, pParse, pTab, OP_OpenWrite, uint8(0), iBaseCur, + aToOpen, uintptr(0), uintptr(0)) + if !(addrOnce != 0) { + goto __101 + } + Xsqlite3VdbeJumpHereOrPopInst(tls, v, addrOnce) +__101: + ; +__96: + ; + + // Top of the update loop + if !(eOnePass != ONEPASS_OFF) { + goto __102 + } + if !((*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */)) != iDataCur) && + (*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) != iDataCur)) { + goto __104 + } + + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, iDataCur, labelBreak, regKey, nKey) + +__104: + ; + if !(eOnePass != ONEPASS_SINGLE) { + goto __105 + } + labelContinue = Xsqlite3VdbeMakeLabel(tls, pParse) +__105: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, func() int32 { + if pPk != 0 { + return regKey + } + return regOldRowid + }(), labelBreak) + + goto __103 +__102: + if !((pPk != 0) || (nChangeFrom != 0)) { + goto __106 + } + labelContinue = Xsqlite3VdbeMakeLabel(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iEph, labelBreak) + addrTop = Xsqlite3VdbeCurrentAddr(tls, v) + if !(nChangeFrom != 0) { + goto __108 + } + if !(!(isView != 0)) { + goto __110 + } + if !(pPk != 0) { + goto __111 + } + i = 0 +__113: + if !(i < int32(nPk)) { + goto __115 + } + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iEph, i, (iPk + i)) + goto __114 +__114: + i++ + goto __113 + goto __115 +__115: + ; + Xsqlite3VdbeAddOp4Int(tls, + v, OP_NotFound, iDataCur, labelContinue, iPk, int32(nPk)) + goto __112 +__111: + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iEph, regOldRowid) + Xsqlite3VdbeAddOp3(tls, + v, OP_NotExists, iDataCur, labelContinue, regOldRowid) +__112: + ; +__110: + ; + goto __109 +__108: + Xsqlite3VdbeAddOp2(tls, v, OP_RowData, iEph, regKey) + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, iDataCur, labelContinue, regKey, 0) + +__109: + ; + goto __107 +__106: + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, iEph, labelBreak) + labelContinue = Xsqlite3VdbeMakeLabel(tls, pParse) + addrTop = Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iEph, regOldRowid) + + Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iDataCur, labelContinue, regOldRowid) + +__107: + ; +__103: + ; +__94: + ; + + // If the rowid value will change, set register regNewRowid to + // contain the new value. If the rowid is not being modified, + // then regNewRowid is the same register as regOldRowid, which is + // already populated. + + if !(chngRowid != 0) { + goto __116 + } + + if !(nChangeFrom == 0) { + goto __117 + } + Xsqlite3ExprCode(tls, pParse, pRowidExpr, regNewRowid) + goto __118 +__117: + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iEph, iRowidExpr, regNewRowid) +__118: + ; + Xsqlite3VdbeAddOp1(tls, v, OP_MustBeInt, regNewRowid) +__116: + ; + + // Compute the old pre-UPDATE content of the row being changed, if that + // information is needed + if !(((chngPk != 0) || (hasFK != 0)) || (pTrigger != 0)) { + goto __119 + } + oldmask = func() uint32 { + if hasFK != 0 { + return Xsqlite3FkOldmask(tls, pParse, pTab) + } + return uint32(0) + }() + oldmask = oldmask | (Xsqlite3TriggerColmask(tls, pParse, + pTrigger, pChanges, 0, (TRIGGER_BEFORE | TRIGGER_AFTER), pTab, onError)) + i = 0 +__120: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __122 + } + colFlags = U32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*32)).FcolFlags) + k = (int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(i))) + regOld) + if !(((oldmask == 0xffffffff) || + ((i < 32) && ((oldmask & (uint32((uint32(1))) << (i))) != U32(0)))) || + ((colFlags & U32(COLFLAG_PRIMKEY)) != U32(0))) { + goto __123 + } + + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, i, k) + goto __124 +__123: + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, k) +__124: + ; + goto __121 +__121: + i++ + goto __120 + goto __122 +__122: + ; + if !((int32(chngRowid) == 0) && (pPk == uintptr(0))) { + goto __125 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, regOldRowid, regNewRowid) +__125: + ; +__119: + ; + + // Populate the array of registers beginning at regNew with the new + // row data. This array is used to check constants, create the new + // table and index records, and as the values for any new.* references + // made by triggers. + // + // If there are one or more BEFORE triggers, then do not populate the + // registers associated with columns that are (a) not modified by + // this UPDATE statement and (b) not accessed by new.* references. The + // values for registers not modified by the UPDATE must be reloaded from + // the database after the BEFORE triggers are fired anyway (as the trigger + // may have modified them). So not loading those that are not going to + // be used eliminates some redundant opcodes. + newmask = int32(Xsqlite3TriggerColmask(tls, + pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError)) + i = 0 + k = regNew +__126: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __128 + } + if !(i == int32((*Table)(unsafe.Pointer(pTab)).FiPKey)) { + goto __129 + } + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, k) + goto __130 +__129: + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_GENERATED) != 0) { + goto __131 + } + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0) { + goto __133 + } + k-- +__133: + ; + goto __132 +__131: + j = *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) + if !(j >= 0) { + goto __134 + } + if !(nChangeFrom != 0) { + goto __136 + } + nOff = func() int32 { + if isView != 0 { + return int32((*Table)(unsafe.Pointer(pTab)).FnCol) + } + return int32(nPk) + }() + + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iEph, (nOff + j), k) + goto __137 +__136: + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(j)*32)).FpExpr, k) +__137: + ; + goto __135 +__134: + if !(((0 == (*(*int32)(unsafe.Pointer(bp + 32 /* tmask */)) & TRIGGER_BEFORE)) || (i > 31)) || ((uint32(newmask) & (uint32((uint32(1))) << (i))) != 0)) { + goto __138 + } + // This branch loads the value of a column that will not be changed + // into a register. This is done if there are no BEFORE triggers, or + // if there are one or more BEFORE triggers that use this value via + // a new.* reference in a trigger program. + + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, i, k) + bFinishSeek = 0 + goto __139 +__138: + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, k) +__139: + ; +__135: + ; +__132: + ; +__130: + ; + goto __127 +__127: + i++ + k++ + goto __126 + goto __128 +__128: + ; + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != 0) { + goto __140 + } + + Xsqlite3ComputeGeneratedColumns(tls, pParse, regNew, pTab) +__140: + ; + + // Fire any BEFORE UPDATE triggers. This happens before constraints are + // verified. One could argue that this is wrong. + if !((*(*int32)(unsafe.Pointer(bp + 32 /* tmask */)) & TRIGGER_BEFORE) != 0) { + goto __141 + } + Xsqlite3TableAffinity(tls, v, pTab, regNew) + Xsqlite3CodeRowTrigger(tls, pParse, pTrigger, TK_UPDATE, pChanges, + TRIGGER_BEFORE, pTab, regOldRowid, onError, labelContinue) + + if !(!(isView != 0)) { + goto __142 + } + // The row-trigger may have deleted the row being updated. In this + // case, jump to the next row. No updates or AFTER triggers are + // required. This behavior - what happens when the row being updated + // is deleted or renamed by a BEFORE trigger - is left undefined in the + // documentation. + if !(pPk != 0) { + goto __143 + } + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, iDataCur, labelContinue, regKey, nKey) + + goto __144 +__143: + Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iDataCur, labelContinue, regOldRowid) + +__144: + ; + + // After-BEFORE-trigger-reload-loop: + // If it did not delete it, the BEFORE trigger may still have modified + // some of the columns of the row being updated. Load the values for + // all columns not modified by the update statement into their registers + // in case this has happened. Only unmodified columns are reloaded. + // The values computed for modified columns use the values before the + // BEFORE trigger runs. See test case trigger1-18.0 (added 2018-04-26) + // for an example. + i = 0 + k = regNew +__145: + if !(i < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __147 + } + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_GENERATED) != 0) { + goto __148 + } + if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0) { + goto __150 + } + k-- +__150: + ; + goto __149 +__148: + if !((*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) < 0) && (i != int32((*Table)(unsafe.Pointer(pTab)).FiPKey))) { + goto __151 + } + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iDataCur, i, k) +__151: + ; +__149: + ; + goto __146 +__146: + i++ + k++ + goto __145 + goto __147 +__147: + ; + if !(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasGenerated)) != 0) { + goto __152 + } + + Xsqlite3ComputeGeneratedColumns(tls, pParse, regNew, pTab) +__152: + ; +__142: + ; +__141: + ; + + if !(!(isView != 0)) { + goto __153 + } + // Do constraint checks. + + Xsqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, iDataCur, iIdxCur, + regNewRowid, regOldRowid, chngKey, uint8(onError), labelContinue, bp+104, /* &bReplace */ + aXRef, uintptr(0)) + + // If REPLACE conflict handling may have been used, or if the PK of the + // row is changing, then the GenerateConstraintChecks() above may have + // moved cursor iDataCur. Reseek it. + if !((*(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) != 0) || (chngKey != 0)) { + goto __154 + } + if !(pPk != 0) { + goto __155 + } + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, iDataCur, labelContinue, regKey, nKey) + goto __156 +__155: + Xsqlite3VdbeAddOp3(tls, v, OP_NotExists, iDataCur, labelContinue, regOldRowid) +__156: + ; + +__154: + ; + + // Do FK constraint checks. + if !(hasFK != 0) { + goto __157 + } + Xsqlite3FkCheck(tls, pParse, pTab, regOldRowid, 0, aXRef, int32(chngKey)) +__157: + ; + + // Delete the index entries associated with the current record. + Xsqlite3GenerateRowIndexDelete(tls, pParse, pTab, iDataCur, iIdxCur, aRegIdx, -1) + + // We must run the OP_FinishSeek opcode to resolve a prior + // OP_DeferredSeek if there is any possibility that there have been + // no OP_Column opcodes since the OP_DeferredSeek was issued. But + // we want to avoid the OP_FinishSeek if possible, as running it + // costs CPU cycles. + if !(bFinishSeek != 0) { + goto __158 + } + Xsqlite3VdbeAddOp1(tls, v, OP_FinishSeek, iDataCur) +__158: + ; + + // If changing the rowid value, or if there are foreign key constraints + // to process, delete the old record. Otherwise, add a noop OP_Delete + // to invoke the pre-update hook. + // + // That (regNew==regnewRowid+1) is true is also important for the + // pre-update hook. If the caller invokes preupdate_new(), the returned + // value is copied from memory cell (regNewRowid+1+iCol), where iCol + // is the column index supplied by the user. + + Xsqlite3VdbeAddOp3(tls, v, OP_Delete, iDataCur, + (OPFLAG_ISUPDATE | (func() int32 { + if (hasFK > 1) || (chngKey != 0) { + return 0 + } + return OPFLAG_ISNOOP + }())), + regNewRowid) + if !(eOnePass == ONEPASS_MULTI) { + goto __159 + } + + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) +__159: + ; + if !(!(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0)) { + goto __160 + } + Xsqlite3VdbeAppendP4(tls, v, pTab, -6) +__160: + ; + + if !(hasFK != 0) { + goto __161 + } + Xsqlite3FkCheck(tls, pParse, pTab, 0, regNewRowid, aXRef, int32(chngKey)) +__161: + ; + + // Insert the new index entries and the new record. + Xsqlite3CompleteInsertion(tls, + pParse, pTab, iDataCur, iIdxCur, regNewRowid, aRegIdx, + (OPFLAG_ISUPDATE | (func() int32 { + if eOnePass == ONEPASS_MULTI { + return OPFLAG_SAVEPOSITION + } + return 0 + }())), + 0, 0) + + // Do any ON CASCADE, SET NULL or SET DEFAULT operations required to + // handle rows (possibly in other tables) that refer via a foreign key + // to the row just updated. + if !(hasFK != 0) { + goto __162 + } + Xsqlite3FkActions(tls, pParse, pTab, pChanges, regOldRowid, aXRef, int32(chngKey)) +__162: + ; +__153: + ; + + // Increment the row counter + if !(regRowCount != 0) { + goto __163 + } + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, regRowCount, 1) +__163: + ; + + Xsqlite3CodeRowTrigger(tls, pParse, pTrigger, TK_UPDATE, pChanges, + TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue) + + // Repeat the above with the next record to be updated, until + // all record selected by the WHERE clause have been updated. + if !(eOnePass == ONEPASS_SINGLE) { + goto __164 + } + // Nothing to do at end-of-loop for a single-pass + goto __165 +__164: + if !(eOnePass == ONEPASS_MULTI) { + goto __166 + } + Xsqlite3VdbeResolveLabel(tls, v, labelContinue) + Xsqlite3WhereEnd(tls, pWInfo) + goto __167 +__166: + Xsqlite3VdbeResolveLabel(tls, v, labelContinue) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, iEph, addrTop) +__167: + ; +__165: + ; + Xsqlite3VdbeResolveLabel(tls, v, labelBreak) + + // Update the sqlite_sequence table by storing the content of the + // maximum rowid counter values recorded while inserting into + // autoincrement tables. + if !(((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && ((*Parse)(unsafe.Pointer(pParse)).FpTriggerTab == uintptr(0))) && (pUpsert == uintptr(0))) { + goto __168 + } + Xsqlite3AutoincrementEnd(tls, pParse) +__168: + ; + + // Return the number of rows that were changed, if we are tracking + // that information. + if !(regRowCount != 0) { + goto __169 + } + Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) + Xsqlite3VdbeSetNumCols(tls, v, 1) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18900 /* "rows updated" */, uintptr(0)) +__169: + ; + +update_cleanup: + Xsqlite3AuthContextPop(tls, bp+16 /* &sContext */) + Xsqlite3DbFree(tls, db, aXRef) // Also frees aRegIdx[] and aToOpen[] + Xsqlite3SrcListDelete(tls, db, pTabList) + Xsqlite3ExprListDelete(tls, db, pChanges) + Xsqlite3ExprDelete(tls, db, pWhere) + return +} + +// Make sure "isView" and other macros defined above are undefined. Otherwise +// they may interfere with compilation of other functions in this file +// (or in another file, if this file becomes part of the amalgamation). + +// Generate code for an UPDATE of a virtual table. +// +// There are two possible strategies - the default and the special +// "onepass" strategy. Onepass is only used if the virtual table +// implementation indicates that pWhere may match at most one row. +// +// The default strategy is to create an ephemeral table that contains +// for each row to be changed: +// +// (A) The original rowid of that row. +// (B) The revised rowid for the row. +// (C) The content of every column in the row. +// +// Then loop through the contents of this ephemeral table executing a +// VUpdate for each row. When finished, drop the ephemeral table. +// +// The "onepass" strategy does not use an ephemeral table. Instead, it +// stores the same values (A, B and C above) in a register array and +// makes a single invocation of VUpdate. +func updateVirtualTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pTab uintptr, pChanges uintptr, pRowid uintptr, aXRef uintptr, pWhere uintptr, onError int32) { /* sqlite3.c:142259:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // Virtual machine under construction + var ephemTab int32 // Table holding the result of the SELECT + var i int32 // Loop counter + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection + var pVTab uintptr = Xsqlite3GetVTable(tls, db, pTab) + var pWInfo uintptr = uintptr(0) + var nArg int32 = (2 + int32((*Table)(unsafe.Pointer(pTab)).FnCol)) // Number of arguments to VUpdate + var regArg int32 // First register in VUpdate arg array + var regRec int32 // Register in which to assemble record + var regRowid int32 // Register for ephem table rowid + var iCsr int32 = (*SrcItem)(unsafe.Pointer((pSrc + 8 /* &.a */))).FiCursor // Cursor used for virtual table scan + // var aDummy [2]int32 at bp, 8 + // Unused arg for sqlite3WhereOkOnePass() + var eOnePass int32 // True to use onepass strategy + var addr int32 // Address of OP_OpenEphemeral + + // Allocate nArg registers in which to gather the arguments for VUpdate. Then + // create and open the ephemeral table in which the records created from + // these arguments will be temporarily stored. + + ephemTab = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + addr = Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, ephemTab, nArg) + regArg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nArg) + if (*SrcList)(unsafe.Pointer(pSrc)).FnSrc > 1 { + var pPk uintptr = uintptr(0) + var pRow uintptr + var pList uintptr + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + if pRowid != 0 { + pRow = Xsqlite3ExprDup(tls, db, pRowid, 0) + } else { + pRow = Xsqlite3PExpr(tls, pParse, TK_ROW, uintptr(0), uintptr(0)) + } + } else { + var iPk I16 // PRIMARY KEY column + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + + iPk = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn)) + if *(*int32)(unsafe.Pointer(aXRef + uintptr(iPk)*4)) >= 0 { + pRow = Xsqlite3ExprDup(tls, db, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(iPk)*4)))*32)).FpExpr, 0) + } else { + pRow = exprRowColumn(tls, pParse, int32(iPk)) + } + } + pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), pRow) + + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + if *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0 { + pList = Xsqlite3ExprListAppend(tls, pParse, pList, + Xsqlite3ExprDup(tls, db, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)))*32)).FpExpr, 0)) + } else { + pList = Xsqlite3ExprListAppend(tls, pParse, pList, exprRowColumn(tls, pParse, i)) + } + } + + updateFromSelect(tls, pParse, ephemTab, pPk, pList, pSrc, pWhere, uintptr(0), uintptr(0)) + Xsqlite3ExprListDelete(tls, db, pList) + eOnePass = ONEPASS_OFF + } else { + regRec = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + regRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + + // Start scanning the virtual table + pWInfo = Xsqlite3WhereBegin(tls, pParse, pSrc, pWhere, uintptr(0), uintptr(0), uint16(WHERE_ONEPASS_DESIRED), 0) + if pWInfo == uintptr(0) { + return + } + + // Populate the argument registers. + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + + if *(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)) >= 0 { + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(*(*int32)(unsafe.Pointer(aXRef + uintptr(i)*4)))*32)).FpExpr, ((regArg + 2) + i)) + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_VColumn, iCsr, i, ((regArg + 2) + i)) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_NOCHNG)) // For sqlite3_vtab_nochange() + } + } + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iCsr, regArg) + if pRowid != 0 { + Xsqlite3ExprCode(tls, pParse, pRowid, (regArg + 1)) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iCsr, (regArg + 1)) + } + } else { + var pPk uintptr // PRIMARY KEY index + var iPk I16 // PRIMARY KEY column + pPk = Xsqlite3PrimaryKeyIndex(tls, pTab) + + iPk = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn)) + Xsqlite3VdbeAddOp3(tls, v, OP_VColumn, iCsr, int32(iPk), regArg) + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, ((regArg + 2) + int32(iPk)), (regArg + 1)) + } + + eOnePass = Xsqlite3WhereOkOnePass(tls, pWInfo, bp /* &aDummy[0] */) + + // There is no ONEPASS_MULTI on virtual tables + + if eOnePass != 0 { + // If using the onepass strategy, no-op out the OP_OpenEphemeral coded + // above. + Xsqlite3VdbeChangeToNoop(tls, v, addr) + Xsqlite3VdbeAddOp1(tls, v, OP_Close, iCsr) + } else { + // Create a record from the argument register contents and insert it into + // the ephemeral table. + Xsqlite3MultiWrite(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regArg, nArg, regRec) + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, ephemTab, regRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, ephemTab, regRec, regRowid) + } + } + + if eOnePass == ONEPASS_OFF { + // End the virtual table scan + if (*SrcList)(unsafe.Pointer(pSrc)).FnSrc == 1 { + Xsqlite3WhereEnd(tls, pWInfo) + } + + // Begin scannning through the ephemeral table. + addr = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, ephemTab) + + // Extract arguments from the current row of the ephemeral table and + // invoke the VUpdate method. + for i = 0; i < nArg; i++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, ephemTab, i, (regArg + i)) + } + } + Xsqlite3VtabMakeWritable(tls, pParse, pTab) + Xsqlite3VdbeAddOp4(tls, v, OP_VUpdate, 0, nArg, regArg, pVTab, -12) + Xsqlite3VdbeChangeP5(tls, v, func() uint16 { + if onError == OE_Default { + return uint16(OE_Abort) + } + return uint16(onError) + }()) + Xsqlite3MayAbort(tls, pParse) + + // End of the ephemeral table scan. Or, if using the onepass strategy, + // jump to here if the scan visited zero rows. + if eOnePass == ONEPASS_OFF { + Xsqlite3VdbeAddOp2(tls, v, OP_Next, ephemTab, (addr + 1)) + Xsqlite3VdbeJumpHere(tls, v, addr) + Xsqlite3VdbeAddOp2(tls, v, OP_Close, ephemTab, 0) + } else { + Xsqlite3WhereEnd(tls, pWInfo) + } +} + +//************* End of update.c ********************************************* +//************* Begin file upsert.c ***************************************** +// 2018-04-12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code to implement various aspects of UPSERT +// processing and handling of the Upsert object. +// #include "sqliteInt.h" + +// Free a list of Upsert objects +func upsertDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:142445:29: */ + for ok := true; ok; ok = p != 0 { + var pNext uintptr = (*Upsert)(unsafe.Pointer(p)).FpNextUpsert + Xsqlite3ExprListDelete(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertTarget) + Xsqlite3ExprDelete(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertTargetWhere) + Xsqlite3ExprListDelete(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertSet) + Xsqlite3ExprDelete(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertWhere) + Xsqlite3DbFree(tls, db, (*Upsert)(unsafe.Pointer(p)).FpToFree) + Xsqlite3DbFree(tls, db, p) + p = pNext + } +} + +func Xsqlite3UpsertDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:142457:21: */ + if p != 0 { + upsertDelete(tls, db, p) + } +} + +// Duplicate an Upsert object. +func Xsqlite3UpsertDup(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:142465:23: */ + if p == uintptr(0) { + return uintptr(0) + } + return Xsqlite3UpsertNew(tls, db, + Xsqlite3ExprListDup(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertTarget, 0), + Xsqlite3ExprDup(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertTargetWhere, 0), + Xsqlite3ExprListDup(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertSet, 0), + Xsqlite3ExprDup(tls, db, (*Upsert)(unsafe.Pointer(p)).FpUpsertWhere, 0), + Xsqlite3UpsertDup(tls, db, (*Upsert)(unsafe.Pointer(p)).FpNextUpsert)) +} + +// Create a new Upsert object. +func Xsqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere uintptr, pSet uintptr, pWhere uintptr, pNext uintptr) uintptr { /* sqlite3.c:142479:23: */ + var pNew uintptr + pNew = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Upsert{}))) + if pNew == uintptr(0) { + Xsqlite3ExprListDelete(tls, db, pTarget) + Xsqlite3ExprDelete(tls, db, pTargetWhere) + Xsqlite3ExprListDelete(tls, db, pSet) + Xsqlite3ExprDelete(tls, db, pWhere) + Xsqlite3UpsertDelete(tls, db, pNext) + return uintptr(0) + } else { + (*Upsert)(unsafe.Pointer(pNew)).FpUpsertTarget = pTarget + (*Upsert)(unsafe.Pointer(pNew)).FpUpsertTargetWhere = pTargetWhere + (*Upsert)(unsafe.Pointer(pNew)).FpUpsertSet = pSet + (*Upsert)(unsafe.Pointer(pNew)).FpUpsertWhere = pWhere + (*Upsert)(unsafe.Pointer(pNew)).FisDoUpdate = (U8(libc.Bool32(pSet != uintptr(0)))) + (*Upsert)(unsafe.Pointer(pNew)).FpNextUpsert = pNext + } + return pNew +} + +// Analyze the ON CONFLICT clause described by pUpsert. Resolve all +// symbols in the conflict-target. +// +// Return SQLITE_OK if everything works, or an error code is something +// is wrong. +func Xsqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) int32 { /* sqlite3.c:142514:20: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + var pTab uintptr // That table into which we are inserting + var rc int32 // Result code + var iCursor int32 // Cursor used by pTab + var pIdx uintptr // One of the indexes of pTab + var pTarget uintptr // The conflict-target clause + var pTerm uintptr // One term of the conflict-target clause + // var sNC NameContext at bp+16, 56 + // Context for resolving symbolic names + // var sCol [2]Expr at bp+72, 144 + // Index column converted into an Expr + var nClause int32 = 0 // Counter of ON CONFLICT clauses + + // Resolve all symbolic names in the conflict-target clause, which + // includes both the list of columns and the optional partial-index + // WHERE clause. + libc.Xmemset(tls, bp+16 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpSrcList = pTabList +__1: + if !((pUpsert != 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget != 0)) { + goto __3 + } + { + rc = Xsqlite3ResolveExprListNames(tls, bp+16 /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + if rc != 0 { + return rc + } + rc = Xsqlite3ResolveExprNames(tls, bp+16 /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + if rc != 0 { + return rc + } + + // Check to see if the conflict target matches the rowid. + pTab = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FpTab + pTarget = (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget + iCursor = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor + if (((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && + ((*ExprList)(unsafe.Pointer(pTarget)).FnExpr == 1)) && + (int32((*Expr)(unsafe.Pointer((libc.AssignUintptr(&pTerm, (*ExprList_item)(unsafe.Pointer((pTarget + 8 /* &.a */))).FpExpr)))).Fop) == TK_COLUMN)) && + (int32((*Expr)(unsafe.Pointer(pTerm)).FiColumn) == (-1)) { + // The conflict-target is the rowid of the primary table + + goto __2 + } + + // Initialize sCol[0..1] to be an expression parse tree for a + // single column of an index. The sCol[0] node will be the TK_COLLATE + // operator and sCol[1] will be the TK_COLUMN operator. Code below + // will populate the specific collation and column number values + // prior to comparing against the conflict-target expression. + libc.Xmemset(tls, bp+72 /* &sCol[0] */, 0, uint64(unsafe.Sizeof([2]Expr{}))) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).Fop = U8(TK_COLLATE) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).FpLeft = (bp + 72 /* &sCol */ + 1*72) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */ + 1*72)).Fop = U8(TK_COLUMN) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */ + 1*72)).FiTable = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor + + // Check for matches against other indexes + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + var ii int32 + var jj int32 + var nn int32 + if !(int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None) { + continue + } + if (*ExprList)(unsafe.Pointer(pTarget)).FnExpr != int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) { + continue + } + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + if (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere == uintptr(0) { + continue + } + if Xsqlite3ExprCompare(tls, pParse, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere, + (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere, iCursor) != 0 { + continue + } + } + nn = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) + for ii = 0; ii < nn; ii++ { + var pExpr uintptr + *(*uintptr)(unsafe.Pointer(bp + 72 /* &sCol */ + 8 /* &.u */)) = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(ii)*8)) + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2))) == (-2) { + + pExpr = (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr + 8 /* &.a */) + uintptr(ii)*32)).FpExpr + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLLATE { + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).FpLeft = pExpr + pExpr = (bp + 72 /* &sCol */) + } + } else { + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).FpLeft = (bp + 72 /* &sCol */ + 1*72) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */ + 1*72)).FiColumn = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2)) + pExpr = (bp + 72 /* &sCol */) + } + for jj = 0; jj < nn; jj++ { + if Xsqlite3ExprCompare(tls, pParse, (*ExprList_item)(unsafe.Pointer((pTarget+8 /* &.a */)+uintptr(jj)*32)).FpExpr, pExpr, iCursor) < 2 { + break // Column ii of the index matches column jj of target + } + } + if jj >= nn { + // The target contains no match for column jj of the index + break + } + } + if ii < nn { + // Column ii of the index did not match any term of the conflict target. + // Continue the search with the next index. + continue + } + (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx = pIdx + break + } + if (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { + // var zWhich [16]int8 at bp+216, 16 + + if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { + *(*int8)(unsafe.Pointer(bp + 216 /* &zWhich[0] */)) = int8(0) + } else { + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+18913 /* "%r " */, libc.VaList(bp, (nClause+1))) + } + Xsqlite3ErrorMsg(tls, pParse, + ts+18917 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) + return SQLITE_ERROR + } + + } + goto __2 +__2: + pUpsert = (*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert + nClause++ + goto __1 + goto __3 +__3: + ; + return SQLITE_OK +} + +// Return true if pUpsert is the last ON CONFLICT clause with a +// conflict target, or if pUpsert is followed by another ON CONFLICT +// clause that targets the INTEGER PRIMARY KEY. +func Xsqlite3UpsertNextIsIPK(tls *libc.TLS, pUpsert uintptr) int32 { /* sqlite3.c:142641:20: */ + var pNext uintptr + if pUpsert == uintptr(0) { + return 0 + } + pNext = (*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert + if pNext == uintptr(0) { + return 1 + } + if (*Upsert)(unsafe.Pointer(pNext)).FpUpsertTarget == uintptr(0) { + return 1 + } + if (*Upsert)(unsafe.Pointer(pNext)).FpUpsertIdx == uintptr(0) { + return 1 + } + return 0 +} + +// Given the list of ON CONFLICT clauses described by pUpsert, and +// a particular index pIdx, return a pointer to the particular ON CONFLICT +// clause that applies to the index. Or, if the index is not subject to +// any ON CONFLICT clause, return NULL. +func Xsqlite3UpsertOfIndex(tls *libc.TLS, pUpsert uintptr, pIdx uintptr) uintptr { /* sqlite3.c:142657:23: */ + for ((pUpsert != 0) && + ((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget != uintptr(0))) && + ((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx != pIdx) { + pUpsert = (*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert + } + return pUpsert +} + +// Generate bytecode that does an UPDATE as part of an upsert. +// +// If pIdx is NULL, then the UNIQUE constraint that failed was the IPK. +// In this case parameter iCur is a cursor open on the table b-tree that +// currently points to the conflicting table row. Otherwise, if pIdx +// is not NULL, then pIdx is the constraint that failed and iCur is a +// cursor points to the conflicting row. +func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab uintptr, pIdx uintptr, iCur int32) { /* sqlite3.c:142677:21: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pSrc uintptr // FROM clause for the UPDATE + var iDataCur int32 + var i int32 + var pTop uintptr = pUpsert + + iDataCur = (*Upsert)(unsafe.Pointer(pUpsert)).FiDataCur + pUpsert = Xsqlite3UpsertOfIndex(tls, pTop, pIdx) + + if (pIdx != 0) && (iCur != iDataCur) { + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + var regRowid int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_IdxRowid, iCur, regRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_SeekRowid, iDataCur, 0, regRowid) + + Xsqlite3ReleaseTempReg(tls, pParse, regRowid) + } else { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, pTab) + var nPk int32 = int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + var iPk int32 = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nPk) + for i = 0; i < nPk; i++ { + var k int32 + + k = int32(Xsqlite3TableColumnToIndex(tls, pIdx, *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(i)*2)))) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iCur, k, (iPk + i)) + + } + + i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) + + Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, + ts+10927 /* "corrupt database" */, -1) + Xsqlite3MayAbort(tls, pParse) + Xsqlite3VdbeJumpHere(tls, v, i) + } + } + // pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does. + // So we have to make a copy before passing it down into sqlite3Update() + pSrc = Xsqlite3SrcListDup(tls, db, (*Upsert)(unsafe.Pointer(pTop)).FpUpsertSrc, 0) + // excluded.* columns of type REAL need to be converted to a hard real + for i = 0; i < int32((*Table)(unsafe.Pointer(pTab)).FnCol); i++ { + if int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*32)).Faffinity) == SQLITE_AFF_REAL { + Xsqlite3VdbeAddOp1(tls, v, OP_RealAffinity, ((*Upsert)(unsafe.Pointer(pTop)).FregData + i)) + } + } + Xsqlite3Update(tls, pParse, pSrc, Xsqlite3ExprListDup(tls, db, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSet, 0), + Xsqlite3ExprDup(tls, db, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertWhere, 0), OE_Abort, uintptr(0), uintptr(0), pUpsert) + +} + +//************* End of upsert.c ********************************************* +//************* Begin file vacuum.c ***************************************** +// 2003 April 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains code used to implement the VACUUM command. +// +// Most of the code in this file may be omitted by defining the +// SQLITE_OMIT_VACUUM macro. +// #include "sqliteInt.h" +// #include "vdbeInt.h" + +// Execute zSql on database db. +// +// If zSql returns rows, then each row will have exactly one +// column. (This will only happen if zSql begins with "SELECT".) +// Take each row of result and call execSql() again recursively. +// +// The execSqlF() routine does the same thing, except it accepts +// a format string as its third argument +func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { /* sqlite3.c:142774:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pStmt uintptr at bp, 8 + + var rc int32 + + // printf("SQL: [%s]\n", zSql); fflush(stdout); + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp /* &pStmt */, uintptr(0)) + if rc != SQLITE_OK { + return rc + } + for SQLITE_ROW == (libc.AssignInt32(&rc, Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))))) { + var zSubSql uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) + + // The secondary SQL must be one of CREATE TABLE, CREATE INDEX, + // or INSERT. Historically there have been attacks that first + // corrupt the sqlite_schema.sql field with other kinds of statements + // then run VACUUM to get those statements to execute at inappropriate + // times. + if (zSubSql != 0) && + ((libc.Xstrncmp(tls, zSubSql, ts+18990 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18994 /* "INS" */, uint64(3)) == 0)) { + rc = execSql(tls, db, pzErrMsg, zSubSql) + if rc != SQLITE_OK { + break + } + } + } + + if rc == SQLITE_DONE { + rc = SQLITE_OK + } + if rc != 0 { + Xsqlite3SetString(tls, pzErrMsg, db, Xsqlite3_errmsg(tls, db)) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + return rc +} + +func execSqlF(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr, va uintptr) int32 { /* sqlite3.c:142804:12: */ + var z uintptr + var ap Va_list + _ = ap + var rc int32 + ap = va + z = Xsqlite3VMPrintf(tls, db, zSql, ap) + _ = ap + if z == uintptr(0) { + return SQLITE_NOMEM + } + rc = execSql(tls, db, pzErrMsg, z) + Xsqlite3DbFree(tls, db, z) + return rc +} + +// The VACUUM command is used to clean up the database, +// collapse free space, etc. It is modelled after the VACUUM command +// in PostgreSQL. The VACUUM command works as follows: +// +// (1) Create a new transient database file +// (2) Copy all content from the database being vacuumed into +// the new transient database file +// (3) Copy content from the transient database back into the +// original database. +// +// The transient database requires temporary disk space approximately +// equal to the size of the original database. The copy operation of +// step (3) requires additional temporary disk space approximately equal +// to the size of the original database for the rollback journal. +// Hence, temporary disk space that is approximately 2x the size of the +// original database is required. Every page of the database is written +// approximately 3 times: Once for step (2) and twice for step (3). +// Two writes per page are required in step (3) because the original +// database content must be written into the rollback journal prior to +// overwriting the database with the vacuumed content. +// +// Only 1x temporary space and only 1x writes would be required if +// the copy of step (3) were replaced by deleting the original database +// and renaming the transient database as the original. But that will +// not work if other processes are attached to the original database. +// And a power loss in between deleting the original and renaming the +// transient would cause the database file to appear to be deleted +// following reboot. +func Xsqlite3Vacuum(tls *libc.TLS, pParse uintptr, pNm uintptr, pInto uintptr) { /* sqlite3.c:142847:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = pNm + + var v uintptr + var iDb int32 + var iIntoReg int32 + v = Xsqlite3GetVdbe(tls, pParse) + iDb = 0 + if !(v == uintptr(0)) { + goto __1 + } + goto build_vacuum_end +__1: + ; + if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { + goto __2 + } + goto build_vacuum_end +__2: + ; + if !(*(*uintptr)(unsafe.Pointer(bp /* pNm */)) != 0) { + goto __3 + } + // Default behavior: Report an error if the argument to VACUUM is + // not recognized + iDb = Xsqlite3TwoPartName(tls, pParse, *(*uintptr)(unsafe.Pointer(bp /* pNm */)), *(*uintptr)(unsafe.Pointer(bp /* pNm */)), bp /* &pNm */) + if !(iDb < 0) { + goto __4 + } + goto build_vacuum_end +__4: + ; +__3: + ; + if !(iDb != 1) { + goto __5 + } + iIntoReg = 0 + if !((pInto != 0) && (Xsqlite3ResolveSelfReference(tls, pParse, uintptr(0), 0, pInto, uintptr(0)) == 0)) { + goto __6 + } + iIntoReg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3ExprCode(tls, pParse, pInto, iIntoReg) +__6: + ; + Xsqlite3VdbeAddOp2(tls, v, OP_Vacuum, iDb, iIntoReg) + Xsqlite3VdbeUsesBtree(tls, v, iDb) +__5: + ; +build_vacuum_end: + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pInto) + return +} + +// This routine implements the OP_Vacuum opcode of the VDBE. +func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, pOut uintptr) int32 { /* sqlite3.c:142885:36: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var rc int32 // Return code from service routines + var pMain uintptr // The database being vacuumed + var pTemp uintptr // The temporary database we vacuum into + var saved_mDbFlags U32 // Saved value of db->mDbFlags + var saved_flags U64 // Saved value of db->flags + var saved_nChange int32 // Saved value of db->nChange + var saved_nTotalChange int32 // Saved value of db->nTotalChange + var saved_openFlags U32 // Saved value of db->openFlags + var saved_mTrace U8 // Saved trace settings + var pDb uintptr // Database to detach at end of vacuum + var isMemDb int32 // True if vacuuming a :memory: database + var nRes int32 // Bytes of reserved space at the end of each page + var nDb int32 // Number of attached databases + var zDbMain uintptr // Schema name of database to vacuum + var zOut uintptr + var id uintptr + // var sz I64 at bp+40, 8 + + // var meta U32 at bp+48, 4 + + var i int32 + rc = SQLITE_OK + pDb = uintptr(0) // Name of output file + + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { + goto __1 + } + Xsqlite3SetString(tls, pzErrMsg, db, ts+18998 /* "cannot VACUUM fr..." */) + return SQLITE_ERROR // IMP: R-12218-18073 +__1: + ; + if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { + goto __2 + } + Xsqlite3SetString(tls, pzErrMsg, db, ts+19038 /* "cannot VACUUM - ..." */) + return SQLITE_ERROR // IMP: R-15610-35227 +__2: + ; + saved_openFlags = (*Sqlite3)(unsafe.Pointer(db)).FopenFlags + if !(pOut != 0) { + goto __3 + } + if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { + goto __5 + } + Xsqlite3SetString(tls, pzErrMsg, db, ts+19081 /* "non-text filenam..." */) + return SQLITE_ERROR +__5: + ; + zOut = Xsqlite3_value_text(tls, pOut) + *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SQLITE_OPEN_READONLY))) + *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) + goto __4 +__3: + zOut = ts + 756 /* "" */ +__4: + ; + + // Save the current value of the database flags so that it can be + // restored before returning. Then set the writable-schema flag, and + // disable CHECK and foreign key constraints. + saved_flags = (*Sqlite3)(unsafe.Pointer(db)).Fflags + saved_mDbFlags = (*Sqlite3)(unsafe.Pointer(db)).FmDbFlags + saved_nChange = (*Sqlite3)(unsafe.Pointer(db)).FnChange + saved_nTotalChange = (*Sqlite3)(unsafe.Pointer(db)).FnTotalChange + saved_mTrace = (*Sqlite3)(unsafe.Pointer(db)).FmTrace + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(SQLITE_WriteSchema | SQLITE_IgnoreChecks)) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_PreferBuiltin | DBFLAG_Vacuum)) + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(((uint64((SQLITE_ForeignKeys | SQLITE_ReverseOrder) | + SQLITE_Defensive)) | (U64((uint64(0x00001))) << 32)))) + (*Sqlite3)(unsafe.Pointer(db)).FmTrace = U8(0) + + zDbMain = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + pMain = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + isMemDb = Xsqlite3PagerIsMemdb(tls, Xsqlite3BtreePager(tls, pMain)) + + // Attach the temporary database as 'vacuum_db'. The synchronous pragma + // can be set to 'off' for this file, as it is not recovered if a crash + // occurs anyway. The integrity of the database is maintained by a + // (possibly synchronous) transaction opened on the main database before + // sqlite3BtreeCopyFile() is called. + // + // An optimisation would be to use a non-journaled pager. + // (Later:) I tried setting "PRAGMA vacuum_db.journal_mode=OFF" but + // that actually made the VACUUM run slower. Very little journalling + // actually occurs when doing a vacuum since the vacuum_db is initially + // empty. Only the journal header is written. Apparently it takes more + // time to parse and run the PRAGMA to turn journalling off than it does + // to write the journal header file. + nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb + rc = execSqlF(tls, db, pzErrMsg, ts+19099 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags + if !(rc != SQLITE_OK) { + goto __6 + } + goto end_of_vacuum +__6: + ; + + pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(nDb)*32) + + pTemp = (*Db)(unsafe.Pointer(pDb)).FpBt + if !(pOut != 0) { + goto __7 + } + id = Xsqlite3PagerFile(tls, Xsqlite3BtreePager(tls, pTemp)) + *(*I64)(unsafe.Pointer(bp + 40 /* sz */)) = int64(0) + if !(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0)) && ((Xsqlite3OsFileSize(tls, id, bp+40 /* &sz */) != SQLITE_OK) || (*(*I64)(unsafe.Pointer(bp + 40 /* sz */)) > int64(0)))) { + goto __8 + } + rc = SQLITE_ERROR + Xsqlite3SetString(tls, pzErrMsg, db, ts+19122 /* "output file alre..." */) + goto end_of_vacuum +__8: + ; + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) |= (U32(DBFLAG_VacuumInto)) +__7: + ; + nRes = Xsqlite3BtreeGetRequestedReserve(tls, pMain) + + Xsqlite3BtreeSetCacheSize(tls, pTemp, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpSchema)).Fcache_size) + Xsqlite3BtreeSetSpillSize(tls, pTemp, Xsqlite3BtreeSetSpillSize(tls, pMain, 0)) + Xsqlite3BtreeSetPagerFlags(tls, pTemp, (uint32(PAGER_SYNCHRONOUS_OFF | PAGER_CACHESPILL))) + + // Begin a transaction and take an exclusive lock on the main database + // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, + // to ensure that we do not try to change the page-size on a WAL database. + rc = execSql(tls, db, pzErrMsg, ts+13214 /* "BEGIN" */) + if !(rc != SQLITE_OK) { + goto __9 + } + goto end_of_vacuum +__9: + ; + rc = Xsqlite3BtreeBeginTrans(tls, pMain, func() int32 { + if pOut == uintptr(0) { + return 2 + } + return 0 + }(), uintptr(0)) + if !(rc != SQLITE_OK) { + goto __10 + } + goto end_of_vacuum +__10: + ; + + // Do not attempt to change the page size for a WAL database + if !(Xsqlite3PagerGetJournalMode(tls, Xsqlite3BtreePager(tls, pMain)) == + PAGER_JOURNALMODE_WAL) { + goto __11 + } + (*Sqlite3)(unsafe.Pointer(db)).FnextPagesize = 0 +__11: + ; + + if !(((Xsqlite3BtreeSetPageSize(tls, pTemp, Xsqlite3BtreeGetPageSize(tls, pMain), nRes, 0) != 0) || + (!(isMemDb != 0) && (Xsqlite3BtreeSetPageSize(tls, pTemp, (*Sqlite3)(unsafe.Pointer(db)).FnextPagesize, nRes, 0) != 0))) || + ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __12 + } + rc = SQLITE_NOMEM + goto end_of_vacuum +__12: + ; + + Xsqlite3BtreeSetAutoVacuum(tls, pTemp, func() int32 { + if int32((*Sqlite3)(unsafe.Pointer(db)).FnextAutovac) >= 0 { + return int32((*Sqlite3)(unsafe.Pointer(db)).FnextAutovac) + } + return Xsqlite3BtreeGetAutoVacuum(tls, pMain) + }()) + + // Query the schema of the main database. Create a mirror schema + // in the temporary database. + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db + rc = execSqlF(tls, db, pzErrMsg, + + ts+19149, /* "SELECT sql FROM ..." */ + libc.VaList(bp+8, zDbMain)) + if !(rc != SQLITE_OK) { + goto __13 + } + goto end_of_vacuum +__13: + ; + rc = execSqlF(tls, db, pzErrMsg, + + ts+19257, /* "SELECT sql FROM ..." */ + libc.VaList(bp+16, zDbMain)) + if !(rc != SQLITE_OK) { + goto __14 + } + goto end_of_vacuum +__14: + ; + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(0) + + // Loop through the tables in the main database. For each, do + // an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy + // the contents to the temporary database. + rc = execSqlF(tls, db, pzErrMsg, + + ts+19311, /* "SELECT'INSERT IN..." */ + libc.VaList(bp+24, zDbMain)) + + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) + if !(rc != SQLITE_OK) { + goto __15 + } + goto end_of_vacuum +__15: + ; + + // Copy the triggers, views, and virtual tables from the main database + // over to the temporary database. None of these objects has any + // associated storage, so all we have to do is copy their entries + // from the schema table. + rc = execSqlF(tls, db, pzErrMsg, + + ts+19462, /* "INSERT INTO vacu..." */ + libc.VaList(bp+32, zDbMain)) + if !(rc != 0) { + goto __16 + } + goto end_of_vacuum +__16: + ; + + /* At this point, there is a write transaction open on both the + ** vacuum database and the main database. Assuming no error occurs, + ** both transactions are closed by this block - the main database + ** transaction by sqlite3BtreeCopyFile() and the other by an explicit + ** call to sqlite3BtreeCommit(). + */ + + // Copy Btree meta values + i = 0 +__17: + if !(i < (int32(uint64(unsafe.Sizeof(aCopy)) / uint64(unsafe.Sizeof(uint8(0)))))) { + goto __19 + } + // GetMeta() and UpdateMeta() cannot fail in this context because + // we already have page 1 loaded into cache and marked dirty. + Xsqlite3BtreeGetMeta(tls, pMain, int32(aCopy[i]), bp+48 /* &meta */) + rc = Xsqlite3BtreeUpdateMeta(tls, pTemp, int32(aCopy[i]), (*(*U32)(unsafe.Pointer(bp + 48 /* meta */)) + U32(aCopy[(i+1)]))) + if !(rc != SQLITE_OK) { + goto __20 + } + goto end_of_vacuum +__20: + ; + goto __18 +__18: + i = i + (2) + goto __17 + goto __19 +__19: + ; + + if !(pOut == uintptr(0)) { + goto __21 + } + rc = Xsqlite3BtreeCopyFile(tls, pMain, pTemp) +__21: + ; + if !(rc != SQLITE_OK) { + goto __22 + } + goto end_of_vacuum +__22: + ; + rc = Xsqlite3BtreeCommit(tls, pTemp) + if !(rc != SQLITE_OK) { + goto __23 + } + goto end_of_vacuum +__23: + ; + if !(pOut == uintptr(0)) { + goto __24 + } + Xsqlite3BtreeSetAutoVacuum(tls, pMain, Xsqlite3BtreeGetAutoVacuum(tls, pTemp)) +__24: + ; + + if !(pOut == uintptr(0)) { + goto __25 + } + rc = Xsqlite3BtreeSetPageSize(tls, pMain, Xsqlite3BtreeGetPageSize(tls, pTemp), nRes, 1) +__25: + ; + +end_of_vacuum: + // Restore the original value of db->flags + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(0) + (*Sqlite3)(unsafe.Pointer(db)).FmDbFlags = saved_mDbFlags + (*Sqlite3)(unsafe.Pointer(db)).Fflags = saved_flags + (*Sqlite3)(unsafe.Pointer(db)).FnChange = saved_nChange + (*Sqlite3)(unsafe.Pointer(db)).FnTotalChange = saved_nTotalChange + (*Sqlite3)(unsafe.Pointer(db)).FmTrace = saved_mTrace + Xsqlite3BtreeSetPageSize(tls, pMain, -1, 0, 1) + + // Currently there is an SQL level transaction open on the vacuum + // database. No locks are held on any other files (since the main file + // was committed at the btree level). So it safe to end the transaction + // by manually setting the autoCommit flag to true and detaching the + // vacuum database. The vacuum_db journal file is deleted when the pager + // is closed by the DETACH. + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + + if !(pDb != 0) { + goto __26 + } + Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + (*Db)(unsafe.Pointer(pDb)).FpBt = uintptr(0) + (*Db)(unsafe.Pointer(pDb)).FpSchema = uintptr(0) +__26: + ; + + // This both clears the schemas and reduces the size of the db->aDb[] + // array. + Xsqlite3ResetAllSchemasOfConnection(tls, db) + + return rc +} + +var aCopy = [10]uint8{ + uint8(BTREE_SCHEMA_VERSION), uint8(1), // Add one to the old schema cookie + uint8(BTREE_DEFAULT_CACHE_SIZE), uint8(0), // Preserve the default page cache size + uint8(BTREE_TEXT_ENCODING), uint8(0), // Preserve the text encoding + uint8(BTREE_USER_VERSION), uint8(0), // Preserve the user version + uint8(BTREE_APPLICATION_ID), uint8(0), // Preserve the application id +} /* sqlite3.c:143076:32 */ + +// Construct and install a Module object for a virtual table. When this +// routine is called, it is guaranteed that all appropriate locks are held +// and the module is not already part of the connection. +// +// If there already exists a module with zName, replace it with the new one. +// If pModule==0, then delete the module zName if it exists. +func Xsqlite3VtabCreateModule(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr, xDestroy uintptr) uintptr { /* sqlite3.c:143188:23: */ + var pMod uintptr + var pDel uintptr + var zCopy uintptr + if pModule == uintptr(0) { + zCopy = zName + pMod = uintptr(0) + } else { + var nName int32 = Xsqlite3Strlen30(tls, zName) + pMod = Xsqlite3Malloc(tls, (uint64((uint64(unsafe.Sizeof(Module{})) + uint64(nName)) + uint64(1)))) + if pMod == uintptr(0) { + Xsqlite3OomFault(tls, db) + return uintptr(0) + } + zCopy = (pMod + 1*48) + libc.Xmemcpy(tls, zCopy, zName, (uint64(nName + 1))) + (*Module)(unsafe.Pointer(pMod)).FzName = zCopy + (*Module)(unsafe.Pointer(pMod)).FpModule = pModule + (*Module)(unsafe.Pointer(pMod)).FpAux = pAux + (*Module)(unsafe.Pointer(pMod)).FxDestroy = xDestroy + (*Module)(unsafe.Pointer(pMod)).FpEpoTab = uintptr(0) + (*Module)(unsafe.Pointer(pMod)).FnRefModule = 1 + } + pDel = Xsqlite3HashInsert(tls, (db + 536 /* &.aModule */), zCopy, pMod) + if pDel != 0 { + if pDel == pMod { + Xsqlite3OomFault(tls, db) + Xsqlite3DbFree(tls, db, pDel) + pMod = uintptr(0) + } else { + Xsqlite3VtabEponymousTableClear(tls, db, pDel) + Xsqlite3VtabModuleUnref(tls, db, pDel) + } + } + return pMod +} + +// The actual function that does the work of creating a new module. +// This function implements the sqlite3_create_module() and +// sqlite3_create_module_v2() interfaces. +func createModule(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr, xDestroy uintptr) int32 { /* sqlite3.c:143236:12: */ + var rc int32 = SQLITE_OK + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3VtabCreateModule(tls, db, zName, pModule, pAux, xDestroy) + rc = Xsqlite3ApiExit(tls, db, rc) + if (rc != SQLITE_OK) && (xDestroy != 0) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, pAux) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// External API function used to create a new virtual-table module. +func Xsqlite3_create_module(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr) int32 { /* sqlite3.c:143257:16: */ + return createModule(tls, db, zName, pModule, pAux, uintptr(0)) +} + +// External API function used to create a new virtual-table module. +func Xsqlite3_create_module_v2(tls *libc.TLS, db uintptr, zName uintptr, pModule uintptr, pAux uintptr, xDestroy uintptr) int32 { /* sqlite3.c:143272:16: */ + return createModule(tls, db, zName, pModule, pAux, xDestroy) +} + +// External API to drop all virtual-table modules, except those named +// on the azNames list. +func Xsqlite3_drop_modules(tls *libc.TLS, db uintptr, azNames uintptr) int32 { /* sqlite3.c:143289:16: */ + var pThis uintptr + var pNext uintptr + for pThis = (*Hash)(unsafe.Pointer((db + 536 /* &.aModule */))).Ffirst; pThis != 0; pThis = pNext { + var pMod uintptr = (*HashElem)(unsafe.Pointer(pThis)).Fdata + pNext = (*HashElem)(unsafe.Pointer(pThis)).Fnext + if azNames != 0 { + var ii int32 + for ii = 0; (*(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0)) && (libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)), (*Module)(unsafe.Pointer(pMod)).FzName) != 0); ii++ { + } + if *(*uintptr)(unsafe.Pointer(azNames + uintptr(ii)*8)) != uintptr(0) { + continue + } + } + createModule(tls, db, (*Module)(unsafe.Pointer(pMod)).FzName, uintptr(0), uintptr(0), uintptr(0)) + } + return SQLITE_OK +} + +// Decrement the reference count on a Module object. Destroy the +// module when the reference count reaches zero. +func Xsqlite3VtabModuleUnref(tls *libc.TLS, db uintptr, pMod uintptr) { /* sqlite3.c:143311:21: */ + + (*Module)(unsafe.Pointer(pMod)).FnRefModule-- + if (*Module)(unsafe.Pointer(pMod)).FnRefModule == 0 { + if (*Module)(unsafe.Pointer(pMod)).FxDestroy != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pMod + 32 /* &.xDestroy */))))(tls, (*Module)(unsafe.Pointer(pMod)).FpAux) + } + + Xsqlite3DbFree(tls, db, pMod) + } +} + +// Lock the virtual table so that it cannot be disconnected. +// Locks nest. Every lock should have a corresponding unlock. +// If an unlock is omitted, resources leaks will occur. +// +// If a disconnect is attempted while a virtual table is locked, +// the disconnect is deferred until all locks have been removed. +func Xsqlite3VtabLock(tls *libc.TLS, pVTab uintptr) { /* sqlite3.c:143331:21: */ + (*VTable)(unsafe.Pointer(pVTab)).FnRef++ +} + +// pTab is a pointer to a Table structure representing a virtual-table. +// Return a pointer to the VTable object used by connection db to access +// this virtual-table, if one has been created, or NULL otherwise. +func Xsqlite3GetVTable(tls *libc.TLS, db uintptr, pTab uintptr) uintptr { /* sqlite3.c:143341:23: */ + var pVtab uintptr + + for pVtab = (*Table)(unsafe.Pointer(pTab)).FpVTable; (pVtab != 0) && ((*VTable)(unsafe.Pointer(pVtab)).Fdb != db); pVtab = (*VTable)(unsafe.Pointer(pVtab)).FpNext { + } + return pVtab +} + +// Decrement the ref-count on a virtual table object. When the ref-count +// reaches zero, call the xDisconnect() method to delete the object. +func Xsqlite3VtabUnlock(tls *libc.TLS, pVTab uintptr) { /* sqlite3.c:143352:21: */ + var db uintptr = (*VTable)(unsafe.Pointer(pVTab)).Fdb + + (*VTable)(unsafe.Pointer(pVTab)).FnRef-- + if (*VTable)(unsafe.Pointer(pVTab)).FnRef == 0 { + var p uintptr = (*VTable)(unsafe.Pointer(pVTab)).FpVtab + Xsqlite3VtabModuleUnref(tls, (*VTable)(unsafe.Pointer(pVTab)).Fdb, (*VTable)(unsafe.Pointer(pVTab)).FpMod) + if p != 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vtab)(unsafe.Pointer(p)).FpModule + 32 /* &.xDisconnect */))))(tls, p) + } + Xsqlite3DbFree(tls, db, pVTab) + } +} + +// Table p is a virtual table. This function moves all elements in the +// p->pVTable list to the sqlite3.pDisconnect lists of their associated +// database connections to be disconnected at the next opportunity. +// Except, if argument db is not NULL, then the entry associated with +// connection db is left in the p->pVTable list. +func vtabDisconnectAll(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:143377:15: */ + var pRet uintptr = uintptr(0) + var pVTable uintptr = (*Table)(unsafe.Pointer(p)).FpVTable + (*Table)(unsafe.Pointer(p)).FpVTable = uintptr(0) + + // Assert that the mutex (if any) associated with the BtShared database + // that contains table p is held by the caller. See header comments + // above function sqlite3VtabUnlockList() for an explanation of why + // this makes it safe to access the sqlite3.pDisconnect list of any + // database connection that may have an entry in the p->pVTable list. + + for pVTable != 0 { + var db2 uintptr = (*VTable)(unsafe.Pointer(pVTable)).Fdb + var pNext uintptr = (*VTable)(unsafe.Pointer(pVTable)).FpNext + + if db2 == db { + pRet = pVTable + (*Table)(unsafe.Pointer(p)).FpVTable = pRet + (*VTable)(unsafe.Pointer(pRet)).FpNext = uintptr(0) + } else { + (*VTable)(unsafe.Pointer(pVTable)).FpNext = (*Sqlite3)(unsafe.Pointer(db2)).FpDisconnect + (*Sqlite3)(unsafe.Pointer(db2)).FpDisconnect = pVTable + } + pVTable = pNext + } + + return pRet +} + +// Table *p is a virtual table. This function removes the VTable object +// for table *p associated with database connection db from the linked +// list in p->pVTab. It also decrements the VTable ref count. This is +// used when closing database connection db to free all of its VTable +// objects without disturbing the rest of the Schema object (which may +// be being used by other shared-cache connections). +func Xsqlite3VtabDisconnect(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:143417:21: */ + var ppVTab uintptr + + for ppVTab = (p + 96 /* &.pVTable */); *(*uintptr)(unsafe.Pointer(ppVTab)) != 0; ppVTab = (*(*uintptr)(unsafe.Pointer(ppVTab)) + 40 /* &.pNext */) { + if (*VTable)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(ppVTab))))).Fdb == db { + var pVTab uintptr = *(*uintptr)(unsafe.Pointer(ppVTab)) + *(*uintptr)(unsafe.Pointer(ppVTab)) = (*VTable)(unsafe.Pointer(pVTab)).FpNext + Xsqlite3VtabUnlock(tls, pVTab) + break + } + } +} + +// Disconnect all the virtual table objects in the sqlite3.pDisconnect list. +// +// This function may only be called when the mutexes associated with all +// shared b-tree databases opened using connection db are held by the +// caller. This is done to protect the sqlite3.pDisconnect list. The +// sqlite3.pDisconnect list is accessed only as follows: +// +// 1) By this function. In this case, all BtShared mutexes and the mutex +// associated with the database handle itself must be held. +// +// 2) By function vtabDisconnectAll(), when it adds a VTable entry to +// the sqlite3.pDisconnect list. In this case either the BtShared mutex +// associated with the database the virtual table is stored in is held +// or, if the virtual table is stored in a non-sharable database, then +// the database handle mutex is held. +// +// As a result, a sqlite3.pDisconnect cannot be accessed simultaneously +// by multiple threads. It is thread-safe. +func Xsqlite3VtabUnlockList(tls *libc.TLS, db uintptr) { /* sqlite3.c:143455:21: */ + var p uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpDisconnect + + if p != 0 { + (*Sqlite3)(unsafe.Pointer(db)).FpDisconnect = uintptr(0) + Xsqlite3ExpirePreparedStatements(tls, db, 0) + for ok := true; ok; ok = p != 0 { + var pNext uintptr = (*VTable)(unsafe.Pointer(p)).FpNext + Xsqlite3VtabUnlock(tls, p) + p = pNext + } + } +} + +// Clear any and all virtual-table information from the Table record. +// This routine is called, for example, just before deleting the Table +// record. +// +// Since it is a virtual-table, the Table structure contains a pointer +// to the head of a linked list of VTable structures. Each VTable +// structure is associated with a single sqlite3* user of the schema. +// The reference count of the VTable structure associated with database +// connection db is decremented immediately (which may lead to the +// structure being xDisconnected and free). Any other VTable structures +// in the list are moved to the sqlite3.pDisconnect list of the associated +// database connection. +func Xsqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:143486:21: */ + if !(db != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FpnBytesFreed == uintptr(0)) { + vtabDisconnectAll(tls, uintptr(0), p) + } + if (*Table)(unsafe.Pointer(p)).FazModuleArg != 0 { + var i int32 + for i = 0; i < (*Table)(unsafe.Pointer(p)).FnModuleArg; i++ { + if i != 1 { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FazModuleArg + uintptr(i)*8))) + } + } + Xsqlite3DbFree(tls, db, (*Table)(unsafe.Pointer(p)).FazModuleArg) + } +} + +// Add a new module argument to pTable->azModuleArg[]. +// The string is not copied - the pointer is stored. The +// string will be freed automatically when the table is +// deleted. +func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintptr) { /* sqlite3.c:143503:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var nBytes Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(2 + (*Table)(unsafe.Pointer(pTable)).FnModuleArg)))) + var azModuleArg uintptr + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { + Xsqlite3ErrorMsg(tls, pParse, ts+11157 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + } + azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) + if azModuleArg == uintptr(0) { + Xsqlite3DbFree(tls, db, zArg) + } else { + var i int32 = libc.PostIncInt32(&(*Table)(unsafe.Pointer(pTable)).FnModuleArg, 1) + *(*uintptr)(unsafe.Pointer(azModuleArg + uintptr(i)*8)) = zArg + *(*uintptr)(unsafe.Pointer(azModuleArg + uintptr((i+1))*8)) = uintptr(0) + (*Table)(unsafe.Pointer(pTable)).FazModuleArg = azModuleArg + } +} + +// The parser calls this routine when it first sees a CREATE VIRTUAL TABLE +// statement. The module name has been parsed, but the optional list +// of parameters that follow the module name are still pending. +func Xsqlite3VtabBeginParse(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pModuleName uintptr, ifNotExists int32) { /* sqlite3.c:143526:21: */ + var pTable uintptr // The new virtual table + var db uintptr // Database connection + + Xsqlite3StartTable(tls, pParse, pName1, pName2, 0, 0, 1, ifNotExists) + pTable = (*Parse)(unsafe.Pointer(pParse)).FpNewTable + if pTable == uintptr(0) { + return + } + + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + + addModuleArgument(tls, pParse, pTable, Xsqlite3NameFromToken(tls, db, pModuleName)) + addModuleArgument(tls, pParse, pTable, uintptr(0)) + addModuleArgument(tls, pParse, pTable, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTable)).FzName)) + + (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = uint32((int32((int64(((*Token)(unsafe.Pointer(pModuleName)).Fz + uintptr((*Token)(unsafe.Pointer(pModuleName)).Fn))) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + + // Creating a virtual table invokes the authorization callback twice. + // The first invocation, to obtain permission to INSERT a row into the + // sqlite_schema table, has already been made by sqlite3StartTable(). + // The second call, to obtain permission to create the table, is made now. + if (*Table)(unsafe.Pointer(pTable)).FazModuleArg != 0 { + var iDb int32 = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTable)).FpSchema) + // The database the table is being created in + Xsqlite3AuthCheck(tls, pParse, SQLITE_CREATE_VTABLE, (*Table)(unsafe.Pointer(pTable)).FzName, + *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FazModuleArg)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName) + } +} + +// This routine takes the module argument that has been accumulating +// in pParse->zArg[] and appends it to the list of arguments on the +// virtual table currently under construction in pParse->pTable. +func addArgumentToVtab(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:143574:13: */ + if ((*Parse)(unsafe.Pointer(pParse)).FsArg.Fz != 0) && ((*Parse)(unsafe.Pointer(pParse)).FpNewTable != 0) { + var z uintptr = (*Parse)(unsafe.Pointer(pParse)).FsArg.Fz + var n int32 = int32((*Parse)(unsafe.Pointer(pParse)).FsArg.Fn) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + addModuleArgument(tls, pParse, (*Parse)(unsafe.Pointer(pParse)).FpNewTable, Xsqlite3DbStrNDup(tls, db, z, uint64(n))) + } +} + +// The parser calls this routine after the CREATE VIRTUAL TABLE statement +// has been completely parsed. +func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* sqlite3.c:143587:21: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var pTab uintptr = (*Parse)(unsafe.Pointer(pParse)).FpNewTable // The table being constructed + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + + if pTab == uintptr(0) { + return + } + addArgumentToVtab(tls, pParse) + (*Parse)(unsafe.Pointer(pParse)).FsArg.Fz = uintptr(0) + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg < 1 { + return + } + + // If the CREATE VIRTUAL TABLE statement is being entered for the + // first time (in other words if the virtual table is actually being + // created now instead of just being read out of sqlite_schema) then + // do additional initialization work and store the statement text + // in the sqlite_schema table. + if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) != 0) { + var zStmt uintptr + var zWhere uintptr + var iDb int32 + var iReg int32 + var v uintptr + + Xsqlite3MayAbort(tls, pParse) + + // Compute the complete text of the CREATE VIRTUAL TABLE statement + if pEnd != 0 { + (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(pEnd)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + (*Token)(unsafe.Pointer(pEnd)).Fn) + } + zStmt = Xsqlite3MPrintf(tls, db, ts+19592 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) + + // A slot for the record has already been allocated in the + // schema table. We just need to update that slot with all + // the information we've collected. + // + // The VM register number pParse->regRowid holds the rowid of an + // entry in the sqlite_schema table tht was created for this vtab + // by sqlite3StartTable(). + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + Xsqlite3NestedParse(tls, pParse, + + ts+19616, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, + (*Table)(unsafe.Pointer(pTab)).FzName, + (*Table)(unsafe.Pointer(pTab)).FzName, + zStmt, + (*Parse)(unsafe.Pointer(pParse)).FregRowid)) + v = Xsqlite3GetVdbe(tls, pParse) + Xsqlite3ChangeCookie(tls, pParse, iDb) + + Xsqlite3VdbeAddOp0(tls, v, OP_Expire) + zWhere = Xsqlite3MPrintf(tls, db, ts+19715 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) + Xsqlite3DbFree(tls, db, zStmt) + + iReg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeLoadString(tls, v, iReg, (*Table)(unsafe.Pointer(pTab)).FzName) + Xsqlite3VdbeAddOp2(tls, v, OP_VCreate, iDb, iReg) + } else { + var pOld uintptr + var pSchema uintptr = (*Table)(unsafe.Pointer(pTab)).FpSchema + var zName uintptr = (*Table)(unsafe.Pointer(pTab)).FzName + + pOld = Xsqlite3HashInsert(tls, (pSchema + 8 /* &.tblHash */), zName, pTab) + if pOld != 0 { + Xsqlite3OomFault(tls, db) + // Malloc must have failed inside HashInsert() + return + } + (*Parse)(unsafe.Pointer(pParse)).FpNewTable = uintptr(0) + } +} + +// The parser calls this routine when it sees the first token +// of an argument to the module name in a CREATE VIRTUAL TABLE statement. +func Xsqlite3VtabArgInit(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:143673:21: */ + addArgumentToVtab(tls, pParse) + (*Parse)(unsafe.Pointer(pParse)).FsArg.Fz = uintptr(0) + (*Parse)(unsafe.Pointer(pParse)).FsArg.Fn = uint32(0) +} + +// The parser calls this routine for each token after the first token +// in an argument to the module name in a CREATE VIRTUAL TABLE statement. +func Xsqlite3VtabArgExtend(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:143683:21: */ + var pArg uintptr = (pParse + 352 /* &.sArg */) + if (*Token)(unsafe.Pointer(pArg)).Fz == uintptr(0) { + (*Token)(unsafe.Pointer(pArg)).Fz = (*Token)(unsafe.Pointer(p)).Fz + (*Token)(unsafe.Pointer(pArg)).Fn = (*Token)(unsafe.Pointer(p)).Fn + } else { + + (*Token)(unsafe.Pointer(pArg)).Fn = uint32((int32((int64(((*Token)(unsafe.Pointer(p)).Fz + uintptr((*Token)(unsafe.Pointer(p)).Fn))) - int64((*Token)(unsafe.Pointer(pArg)).Fz)) / 1))) + } +} + +// Invoke a virtual table constructor (either xCreate or xConnect). The +// pointer to the function to invoke is passed as the fourth parameter +// to this procedure. +func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, xConstruct uintptr, pzErr uintptr) int32 { /* sqlite3.c:143699:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sCtx VtabCtx at bp+32, 32 + + var pVTable uintptr + var rc int32 + var azArg uintptr = (*Table)(unsafe.Pointer(pTab)).FazModuleArg + var nArg int32 = (*Table)(unsafe.Pointer(pTab)).FnModuleArg + *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) + var zModuleName uintptr + var iDb int32 + var pCtx uintptr + + // Check that the virtual-table is not already being initialized + for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { + if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, + ts+19734 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + return SQLITE_LOCKED + } + } + + zModuleName = Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName) + if !(zModuleName != 0) { + return SQLITE_NOMEM + } + + pVTable = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(VTable{}))) + if !(pVTable != 0) { + Xsqlite3OomFault(tls, db) + Xsqlite3DbFree(tls, db, zModuleName) + return SQLITE_NOMEM + } + (*VTable)(unsafe.Pointer(pVTable)).Fdb = db + (*VTable)(unsafe.Pointer(pVTable)).FpMod = pMod + (*VTable)(unsafe.Pointer(pVTable)).FeVtabRisk = U8(SQLITE_VTABRISK_Normal) + + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg + 1*8)) = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + + // Invoke the virtual table constructor + + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpTab = pTab + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpVTable = pVTable + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpPrior = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FbDeclared = 0 + (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx = bp + 32 /* &sCtx */ + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xConstruct)))(tls, db, (*Module)(unsafe.Pointer(pMod)).FpAux, nArg, azArg, (pVTable + 16 /* &.pVtab */), bp+64 /* &zErr */) + (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx = (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpPrior + if rc == SQLITE_NOMEM { + Xsqlite3OomFault(tls, db) + } + + if SQLITE_OK != rc { + if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19776 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2791 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) + } + Xsqlite3DbFree(tls, db, pVTable) + } else if (*VTable)(unsafe.Pointer(pVTable)).FpVtab != 0 { + // Justification of ALWAYS(): A correct vtab constructor must allocate + // the sqlite3_vtab object if successful. + libc.Xmemset(tls, (*VTable)(unsafe.Pointer(pVTable)).FpVtab, 0, uint64(unsafe.Sizeof(Sqlite3_vtab{}))) + (*Sqlite3_vtab)(unsafe.Pointer((*VTable)(unsafe.Pointer(pVTable)).FpVtab)).FpModule = (*Module)(unsafe.Pointer(pMod)).FpModule + (*Module)(unsafe.Pointer(pMod)).FnRefModule++ + (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 + if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { + var zFormat uintptr = ts + 19806 /* "vtable construct..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VtabUnlock(tls, pVTable) + rc = SQLITE_ERROR + } else { + var iCol int32 + var oooHidden U16 = U16(0) + // If everything went according to plan, link the new VTable structure + // into the linked list headed by pTab->pVTable. Then loop through the + // columns of the table to see if any of them contain the token "hidden". + // If so, set the Column COLFLAG_HIDDEN flag and remove the token from + // the type string. + (*VTable)(unsafe.Pointer(pVTable)).FpNext = (*Table)(unsafe.Pointer(pTab)).FpVTable + (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable + + for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+756 /* "" */) + var nType int32 + var i int32 = 0 + nType = Xsqlite3Strlen30(tls, zType) + for i = 0; i < nType; i++ { + if ((0 == Xsqlite3_strnicmp(tls, ts+14671 /* "hidden" */, (zType+uintptr(i)), 6)) && + ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && + ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { + break + } + } + if i < nType { + var j int32 + var nDel int32 = (6 + (func() int32 { + if *(*int8)(unsafe.Pointer(zType + uintptr((i + 6)))) != 0 { + return 1 + } + return 0 + }())) + for j = i; (j + nDel) <= nType; j++ { + *(*int8)(unsafe.Pointer(zType + uintptr(j))) = *(*int8)(unsafe.Pointer(zType + uintptr((j + nDel)))) + } + if (int32(*(*int8)(unsafe.Pointer(zType + uintptr(i)))) == 0) && (i > 0) { + + *(*int8)(unsafe.Pointer(zType + uintptr((i - 1)))) = int8(0) + } + *(*U16)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32 + 28 /* &.colFlags */)) |= U16((COLFLAG_HIDDEN)) + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_HasHidden)) + oooHidden = U16(TF_OOOHidden) + } else { + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(oooHidden)) + } + } + } + } + + Xsqlite3DbFree(tls, db, zModuleName) + return rc +} + +// This function is invoked by the parser to call the xConnect() method +// of the virtual table pTab. If an error occurs, an error code is returned +// and an error left in pParse. +// +// This call is a no-op if table pTab is not a virtual table. +func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sqlite3.c:143832:20: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var zMod uintptr + var pMod uintptr + var rc int32 + + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) || (Xsqlite3GetVTable(tls, db, pTab) != 0) { + return SQLITE_OK + } + + // Locate the required virtual table module + zMod = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) + pMod = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zMod) + + if !(pMod != 0) { + var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) + Xsqlite3ErrorMsg(tls, pParse, ts+19852 /* "no such module: ..." */, libc.VaList(bp, zModule)) + rc = SQLITE_ERROR + } else { + *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) + rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) + if rc != SQLITE_OK { + Xsqlite3ErrorMsg(tls, pParse, ts+2791 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + (*Parse)(unsafe.Pointer(pParse)).Frc = rc + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) + } + + return rc +} + +// Grow the db->aVTrans[] array so that there is room for at least one +// more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise. +func growVTrans(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:143867:12: */ + var ARRAY_INCR int32 = 5 + + // Grow the sqlite3.aVTrans array if required + if ((*Sqlite3)(unsafe.Pointer(db)).FnVTrans % ARRAY_INCR) == 0 { + var aVTrans uintptr + var nBytes Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(Sqlite3_int64((*Sqlite3)(unsafe.Pointer(db)).FnVTrans) + Sqlite3_int64(ARRAY_INCR))))) + aVTrans = Xsqlite3DbRealloc(tls, db, (*Sqlite3)(unsafe.Pointer(db)).FaVTrans, uint64(nBytes)) + if !(aVTrans != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, (aVTrans + uintptr((*Sqlite3)(unsafe.Pointer(db)).FnVTrans)*8), 0, (uint64(unsafe.Sizeof(uintptr(0))) * uint64(ARRAY_INCR))) + (*Sqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans + } + + return SQLITE_OK +} + +// Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should +// have already been reserved using growVTrans(). +func addToVTrans(tls *libc.TLS, db uintptr, pVTab uintptr) { /* sqlite3.c:143890:13: */ + // Add pVtab to the end of sqlite3.aVTrans + *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaVTrans + uintptr(libc.PostIncInt32(&(*Sqlite3)(unsafe.Pointer(db)).FnVTrans, 1))*8)) = pVTab + Xsqlite3VtabLock(tls, pVTab) +} + +// This function is invoked by the vdbe to call the xCreate method +// of the virtual table named zTab in database iDb. +// +// If an error occurs, *pzErr is set to point to an English language +// description of the error and an SQLITE_XXX error code is returned. +// In this case the caller must call sqlite3DbFree(db, ) on *pzErr. +func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, pzErr uintptr) int32 { /* sqlite3.c:143904:20: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var pTab uintptr + var pMod uintptr + var zMod uintptr + + pTab = Xsqlite3FindTable(tls, db, zTab, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) + + // Locate the required virtual table module + zMod = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) + pMod = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zMod) + + // If the module has been registered and includes a Create method, + // invoke it now. If the module has not been registered, return an + // error. Otherwise, do nothing. + if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19852 /* "no such module: ..." */, libc.VaList(bp, zMod)) + rc = SQLITE_ERROR + } else { + rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) + } + + // Justification of ALWAYS(): The xConstructor method is required to + // create a valid sqlite3_vtab if it returns SQLITE_OK. + if (rc == SQLITE_OK) && (Xsqlite3GetVTable(tls, db, pTab) != 0) { + rc = growVTrans(tls, db) + if rc == SQLITE_OK { + addToVTrans(tls, db, Xsqlite3GetVTable(tls, db, pTab)) + } + } + + return rc +} + +// This function is used to set the schema of a virtual table. It is only +// valid to call this function from within the xCreate() or xConnect() of a +// virtual table module. +func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int32 { /* sqlite3.c:143945:16: */ + bp := tls.Alloc(424) + defer tls.Free(424) + + var pCtx uintptr + var rc int32 = SQLITE_OK + var pTab uintptr + *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) = uintptr(0) + // var sParse Parse at bp+8, 408 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx + if !(pCtx != 0) || ((*VtabCtx)(unsafe.Pointer(pCtx)).FbDeclared != 0) { + Xsqlite3Error(tls, db, SQLITE_MISUSE) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return Xsqlite3MisuseError(tls, 143962) + } + pTab = (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab + + libc.Xmemset(tls, bp+8 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FeParseMode = U8(PARSE_MODE_DECLARE_VTAB) + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).Fdb = db + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FnQueryLoop = U32(1) + if ((((SQLITE_OK == Xsqlite3RunParser(tls, bp+8 /* &sParse */, zCreateTable, bp+416 /* &zErr */)) && + ((*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable != 0)) && + !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0)) && + !(int32((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable)).FpSelect) != 0)) && + !((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable)).FnModuleArg != 0) { + if !(int32((*Table)(unsafe.Pointer(pTab)).FaCol) != 0) { + var pNew uintptr = (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FpNewTable + var pIdx uintptr + (*Table)(unsafe.Pointer(pTab)).FaCol = (*Table)(unsafe.Pointer(pNew)).FaCol + (*Table)(unsafe.Pointer(pTab)).FnNVCol = libc.AssignPtrInt16(pTab+70 /* &.nCol */, (*Table)(unsafe.Pointer(pNew)).FnCol) + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= ((*Table)(unsafe.Pointer(pNew)).FtabFlags & (U32(TF_WithoutRowid | TF_NoVisibleRowid))) + (*Table)(unsafe.Pointer(pNew)).FnCol = int16(0) + (*Table)(unsafe.Pointer(pNew)).FaCol = uintptr(0) + + if (!(((*Table)(unsafe.Pointer((pNew))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && + ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer((*VTable)(unsafe.Pointer((*VtabCtx)(unsafe.Pointer(pCtx)).FpVTable)).FpMod)).FpModule)).FxUpdate != uintptr(0))) && + (int32((*Index)(unsafe.Pointer(Xsqlite3PrimaryKeyIndex(tls, pNew))).FnKeyCol) != 1) { + // WITHOUT ROWID virtual tables must either be read-only (xUpdate==0) + // or else must have a single-column PRIMARY KEY + rc = SQLITE_ERROR + } + pIdx = (*Table)(unsafe.Pointer(pNew)).FpIndex + if pIdx != 0 { + + (*Table)(unsafe.Pointer(pTab)).FpIndex = pIdx + (*Table)(unsafe.Pointer(pNew)).FpIndex = uintptr(0) + (*Index)(unsafe.Pointer(pIdx)).FpTable = pTab + } + } + (*VtabCtx)(unsafe.Pointer(pCtx)).FbDeclared = 1 + } else { + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) != 0 { + return ts + 2791 /* "%s" */ + } + return uintptr(0) + }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */))) + rc = SQLITE_ERROR + } + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FeParseMode = U8(PARSE_MODE_NORMAL) + + if (*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpVdbe != 0 { + Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpVdbe) + } + Xsqlite3DeleteTable(tls, db, (*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable) + Xsqlite3ParserReset(tls, bp+8 /* &sParse */) + + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// This function is invoked by the vdbe to call the xDestroy method +// of the virtual table named zTab in database iDb. This occurs +// when a DROP TABLE is mentioned. +// +// This call is a no-op if zTab is not a virtual table. +func Xsqlite3VtabCallDestroy(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr) int32 { /* sqlite3.c:144030:20: */ + var rc int32 = SQLITE_OK + var pTab uintptr + + pTab = Xsqlite3FindTable(tls, db, zTab, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) + if (pTab != uintptr(0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0)) { + var p uintptr + var xDestroy uintptr + for p = (*Table)(unsafe.Pointer(pTab)).FpVTable; p != 0; p = (*VTable)(unsafe.Pointer(p)).FpNext { + + if (*Sqlite3_vtab)(unsafe.Pointer((*VTable)(unsafe.Pointer(p)).FpVtab)).FnRef > 0 { + return SQLITE_LOCKED + } + } + p = vtabDisconnectAll(tls, db, pTab) + xDestroy = (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer((*VTable)(unsafe.Pointer(p)).FpMod)).FpModule)).FxDestroy + if xDestroy == uintptr(0) { + xDestroy = (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer((*VTable)(unsafe.Pointer(p)).FpMod)).FpModule)).FxDisconnect + } + + (*Table)(unsafe.Pointer(pTab)).FnTabRef++ + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&xDestroy)))(tls, (*VTable)(unsafe.Pointer(p)).FpVtab) + // Remove the sqlite3_vtab* from the aVTrans[] array, if applicable + if rc == SQLITE_OK { + + (*VTable)(unsafe.Pointer(p)).FpVtab = uintptr(0) + (*Table)(unsafe.Pointer(pTab)).FpVTable = uintptr(0) + Xsqlite3VtabUnlock(tls, p) + } + Xsqlite3DeleteTable(tls, db, pTab) + } + + return rc +} + +// This function invokes either the xRollback or xCommit method +// of each of the virtual tables in the sqlite3.aVTrans array. The method +// called is identified by the second argument, "offset", which is +// the offset of the method to call in the sqlite3_module structure. +// +// The array is cleared after invoking the callbacks. +func callFinaliser(tls *libc.TLS, db uintptr, offset int32) { /* sqlite3.c:144071:13: */ + var i int32 + if (*Sqlite3)(unsafe.Pointer(db)).FaVTrans != 0 { + var aVTrans uintptr = (*Sqlite3)(unsafe.Pointer(db)).FaVTrans + (*Sqlite3)(unsafe.Pointer(db)).FaVTrans = uintptr(0) + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnVTrans; i++ { + var pVTab uintptr = *(*uintptr)(unsafe.Pointer(aVTrans + uintptr(i)*8)) + var p uintptr = (*VTable)(unsafe.Pointer(pVTab)).FpVtab + if p != 0 { + var x uintptr + x = *(*uintptr)(unsafe.Pointer(((*Sqlite3_vtab)(unsafe.Pointer(p)).FpModule + uintptr(offset)))) + if x != 0 { + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&x)))(tls, p) + } + } + (*VTable)(unsafe.Pointer(pVTab)).FiSavepoint = 0 + Xsqlite3VtabUnlock(tls, pVTab) + } + Xsqlite3DbFree(tls, db, aVTrans) + (*Sqlite3)(unsafe.Pointer(db)).FnVTrans = 0 + } +} + +// Invoke the xSync method of all virtual tables in the sqlite3.aVTrans +// array. Return the error code for the first error that occurs, or +// SQLITE_OK if all xSync operations are successful. +// +// If an error message is available, leave it in p->zErrMsg. +func Xsqlite3VtabSync(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:144099:20: */ + var i int32 + var rc int32 = SQLITE_OK + var aVTrans uintptr = (*Sqlite3)(unsafe.Pointer(db)).FaVTrans + + (*Sqlite3)(unsafe.Pointer(db)).FaVTrans = uintptr(0) + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnVTrans); i++ { + var x uintptr + var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aVTrans + uintptr(i)*8)))).FpVtab + if (pVtab != 0) && ((libc.AssignUintptr(&x, (*Sqlite3_module)(unsafe.Pointer((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule)).FxSync)) != uintptr(0)) { + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&x)))(tls, pVtab) + Xsqlite3VtabImportErrmsg(tls, p, pVtab) + } + } + (*Sqlite3)(unsafe.Pointer(db)).FaVTrans = aVTrans + return rc +} + +// Invoke the xRollback method of all virtual tables in the +// sqlite3.aVTrans array. Then clear the array itself. +func Xsqlite3VtabRollback(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:144121:20: */ + callFinaliser(tls, db, int32((uintptr(0) + 136 /* &.xRollback */))) + return SQLITE_OK +} + +// Invoke the xCommit method of all virtual tables in the +// sqlite3.aVTrans array. Then clear the array itself. +func Xsqlite3VtabCommit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:144130:20: */ + callFinaliser(tls, db, int32((uintptr(0) + 128 /* &.xCommit */))) + return SQLITE_OK +} + +// If the virtual table pVtab supports the transaction interface +// (xBegin/xRollback/xCommit and optionally xSync) and a transaction is +// not currently open, invoke the xBegin method now. +// +// If the xBegin call is successful, place the sqlite3_vtab pointer +// in the sqlite3.aVTrans array. +func Xsqlite3VtabBegin(tls *libc.TLS, db uintptr, pVTab uintptr) int32 { /* sqlite3.c:144143:20: */ + var rc int32 = SQLITE_OK + var pModule uintptr + + // Special case: If db->aVTrans is NULL and db->nVTrans is greater + // than zero, then this function is being called from within a + // virtual module xSync() callback. It is illegal to write to + // virtual module tables in this case, so return SQLITE_LOCKED. + if ((*Sqlite3)(unsafe.Pointer((db))).FnVTrans > 0) && ((*Sqlite3)(unsafe.Pointer((db))).FaVTrans == uintptr(0)) { + return SQLITE_LOCKED + } + if !(pVTab != 0) { + return SQLITE_OK + } + pModule = (*Sqlite3_vtab)(unsafe.Pointer((*VTable)(unsafe.Pointer(pVTab)).FpVtab)).FpModule + + if (*Sqlite3_module)(unsafe.Pointer(pModule)).FxBegin != 0 { + var i int32 + + // If pVtab is already in the aVTrans array, return early + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnVTrans; i++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaVTrans + uintptr(i)*8)) == pVTab { + return SQLITE_OK + } + } + + // Invoke the xBegin method. If successful, add the vtab to the + // sqlite3.aVTrans[] array. + rc = growVTrans(tls, db) + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule + 112 /* &.xBegin */))))(tls, (*VTable)(unsafe.Pointer(pVTab)).FpVtab) + if rc == SQLITE_OK { + var iSvpt int32 = ((*Sqlite3)(unsafe.Pointer(db)).FnStatement + (*Sqlite3)(unsafe.Pointer(db)).FnSavepoint) + addToVTrans(tls, db, pVTab) + if (iSvpt != 0) && ((*Sqlite3_module)(unsafe.Pointer(pModule)).FxSavepoint != 0) { + (*VTable)(unsafe.Pointer(pVTab)).FiSavepoint = iSvpt + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pModule + 160 /* &.xSavepoint */))))(tls, (*VTable)(unsafe.Pointer(pVTab)).FpVtab, (iSvpt - 1)) + } + } + } + } + return rc +} + +// Invoke either the xSavepoint, xRollbackTo or xRelease method of all +// virtual tables that currently have an open transaction. Pass iSavepoint +// as the second argument to the virtual table method invoked. +// +// If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is +// SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is +// SAVEPOINT_RELEASE, then the xRelease method of each virtual table with +// an open transaction is invoked. +// +// If any virtual table method returns an error code other than SQLITE_OK, +// processing is abandoned and the error returned to the caller of this +// function immediately. If all calls to virtual table methods are successful, +// SQLITE_OK is returned. +func Xsqlite3VtabSavepoint(tls *libc.TLS, db uintptr, op int32, iSavepoint int32) int32 { /* sqlite3.c:144203:20: */ + var rc int32 = SQLITE_OK + + if (*Sqlite3)(unsafe.Pointer(db)).FaVTrans != 0 { + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnVTrans); i++ { + var pVTab uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaVTrans + uintptr(i)*8)) + var pMod uintptr = (*Module)(unsafe.Pointer((*VTable)(unsafe.Pointer(pVTab)).FpMod)).FpModule + if ((*VTable)(unsafe.Pointer(pVTab)).FpVtab != 0) && ((*Sqlite3_module)(unsafe.Pointer(pMod)).FiVersion >= 2) { + var xMethod uintptr + Xsqlite3VtabLock(tls, pVTab) + switch op { + case SAVEPOINT_BEGIN: + xMethod = (*Sqlite3_module)(unsafe.Pointer(pMod)).FxSavepoint + (*VTable)(unsafe.Pointer(pVTab)).FiSavepoint = (iSavepoint + 1) + break + fallthrough + case SAVEPOINT_ROLLBACK: + xMethod = (*Sqlite3_module)(unsafe.Pointer(pMod)).FxRollbackTo + break + fallthrough + default: + xMethod = (*Sqlite3_module)(unsafe.Pointer(pMod)).FxRelease + break + } + if (xMethod != 0) && ((*VTable)(unsafe.Pointer(pVTab)).FiSavepoint > iSavepoint) { + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&xMethod)))(tls, (*VTable)(unsafe.Pointer(pVTab)).FpVtab, iSavepoint) + } + Xsqlite3VtabUnlock(tls, pVTab) + } + } + } + return rc +} + +// The first parameter (pDef) is a function implementation. The +// second parameter (pExpr) is the first argument to this function. +// If pExpr is a column in a virtual table, then let the virtual +// table implementation have an opportunity to overload the function. +// +// This routine is used to allow virtual table implementations to +// overload MATCH, LIKE, GLOB, and REGEXP operators. +// +// Return either the pDef argument (indicating no change) or a +// new FuncDef structure that is marked as ephemeral using the +// SQLITE_FUNC_EPHEM flag. +func Xsqlite3VtabOverloadFunction(tls *libc.TLS, db uintptr, pDef uintptr, nArg int32, pExpr uintptr) uintptr { /* sqlite3.c:144251:24: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTab uintptr + var pVtab uintptr + var pMod uintptr + *(*uintptr)(unsafe.Pointer(bp /* xSFunc */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pArg */)) = uintptr(0) + var pNew uintptr + var rc int32 = 0 + + // Check to see the left operand is a column in a virtual table + if pExpr == uintptr(0) { + return pDef + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLUMN { + return pDef + } + pTab = *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) + if pTab == uintptr(0) { + return pDef + } + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + return pDef + } + pVtab = (*VTable)(unsafe.Pointer(Xsqlite3GetVTable(tls, db, pTab))).FpVtab + + pMod = (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + if (*Sqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction == uintptr(0) { + return pDef + } + + // Call the xFindFunction method on the virtual table implementation + // to see if the implementation wants to overload this function. + // + // Though undocumented, we have historically always invoked xFindFunction + // with an all lower-case function name. Continue in this tradition to + // avoid any chance of an incompatibility. + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pMod + 144 /* &.xFindFunction */))))(tls, pVtab, nArg, (*FuncDef)(unsafe.Pointer(pDef)).FzName, bp /* &xSFunc */, bp+8 /* &pArg */) + if rc == 0 { + return pDef + } + + // Create a new ephemeral function definition for the overloaded + // function + pNew = Xsqlite3DbMallocZero(tls, db, (uint64((uint64(unsafe.Sizeof(FuncDef{})) + + uint64(Xsqlite3Strlen30(tls, (*FuncDef)(unsafe.Pointer(pDef)).FzName))) + uint64(1)))) + if pNew == uintptr(0) { + return pDef + } + *(*FuncDef)(unsafe.Pointer(pNew)) = *(*FuncDef)(unsafe.Pointer(pDef)) + (*FuncDef)(unsafe.Pointer(pNew)).FzName = (pNew + 1*72) + libc.Xmemcpy(tls, (pNew + 1*72), (*FuncDef)(unsafe.Pointer(pDef)).FzName, (uint64(Xsqlite3Strlen30(tls, (*FuncDef)(unsafe.Pointer(pDef)).FzName) + 1))) + (*FuncDef)(unsafe.Pointer(pNew)).FxSFunc = *(*uintptr)(unsafe.Pointer(bp /* xSFunc */)) + (*FuncDef)(unsafe.Pointer(pNew)).FpUserData = *(*uintptr)(unsafe.Pointer(bp + 8 /* pArg */)) + *(*U32)(unsafe.Pointer(pNew + 4 /* &.funcFlags */)) |= (U32(SQLITE_FUNC_EPHEM)) + return pNew +} + +// Make sure virtual table pTab is contained in the pParse->apVirtualLock[] +// array so that an OP_VBegin will get generated for it. Add pTab to the +// array if it is missing. If pTab is already in the array, this routine +// is a no-op. +func Xsqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { /* sqlite3.c:144320:21: */ + var pToplevel uintptr = func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }() + var i int32 + var n int32 + var apVtabLock uintptr + + for i = 0; i < (*Parse)(unsafe.Pointer(pToplevel)).FnVtabLock; i++ { + if pTab == *(*uintptr)(unsafe.Pointer((*Parse)(unsafe.Pointer(pToplevel)).FapVtabLock + uintptr(i)*8)) { + return + } + } + n = (int32((uint64((*Parse)(unsafe.Pointer(pToplevel)).FnVtabLock + 1)) * uint64(unsafe.Sizeof(uintptr(0))))) + apVtabLock = Xsqlite3Realloc(tls, (*Parse)(unsafe.Pointer(pToplevel)).FapVtabLock, uint64(n)) + if apVtabLock != 0 { + (*Parse)(unsafe.Pointer(pToplevel)).FapVtabLock = apVtabLock + *(*uintptr)(unsafe.Pointer((*Parse)(unsafe.Pointer(pToplevel)).FapVtabLock + uintptr(libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pToplevel)).FnVtabLock, 1))*8)) = pTab + } else { + Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pToplevel)).Fdb) + } +} + +// Check to see if virtual table module pMod can be have an eponymous +// virtual table instance. If it can, create one if one does not already +// exist. Return non-zero if the eponymous virtual table instance exists +// when this routine returns, and return zero if it does not exist. +// +// An eponymous virtual table instance is one that is named after its +// module, and more importantly, does not require a CREATE VIRTUAL TABLE +// statement in order to come into existance. Eponymous virtual table +// instances always exist. They cannot be DROP-ed. +// +// Any virtual table module for which xConnect and xCreate are the same +// method can have an eponymous virtual table instance. +func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) int32 { /* sqlite3.c:144353:20: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pModule uintptr = (*Module)(unsafe.Pointer(pMod)).FpModule + var pTab uintptr + *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) = uintptr(0) + var rc int32 + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (*Module)(unsafe.Pointer(pMod)).FpEpoTab != 0 { + return 1 + } + if ((*Sqlite3_module)(unsafe.Pointer(pModule)).FxCreate != uintptr(0)) && ((*Sqlite3_module)(unsafe.Pointer(pModule)).FxCreate != (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect) { + return 0 + } + pTab = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Table{}))) + if pTab == uintptr(0) { + return 0 + } + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, db, (*Module)(unsafe.Pointer(pMod)).FzName) + if (*Table)(unsafe.Pointer(pTab)).FzName == uintptr(0) { + Xsqlite3DbFree(tls, db, pTab) + return 0 + } + (*Module)(unsafe.Pointer(pMod)).FpEpoTab = pTab + (*Table)(unsafe.Pointer(pTab)).FnTabRef = U32(1) + (*Table)(unsafe.Pointer(pTab)).FpSchema = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + + (*Table)(unsafe.Pointer(pTab)).FiPKey = int16(-1) + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_Eponymous)) + addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) + addModuleArgument(tls, pParse, pTab, uintptr(0)) + addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) + rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) + if rc != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+2791 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) + Xsqlite3VtabEponymousTableClear(tls, db, pMod) + return 0 + } + return 1 +} + +// Erase the eponymous virtual table instance associated with +// virtual table module pMod, if it exists. +func Xsqlite3VtabEponymousTableClear(tls *libc.TLS, db uintptr, pMod uintptr) { /* sqlite3.c:144391:21: */ + var pTab uintptr = (*Module)(unsafe.Pointer(pMod)).FpEpoTab + if pTab != uintptr(0) { + // Mark the table as Ephemeral prior to deleting it, so that the + // sqlite3DeleteTable() routine will know that it is not stored in + // the schema. + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_Ephemeral)) + Xsqlite3DeleteTable(tls, db, pTab) + (*Module)(unsafe.Pointer(pMod)).FpEpoTab = uintptr(0) + } +} + +// Return the ON CONFLICT resolution mode in effect for the virtual +// table update operation currently in progress. +// +// The results of this routine are undefined unless it is called from +// within an xUpdate method. +func Xsqlite3_vtab_on_conflict(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:144410:16: */ + + return int32(aMap[(int32((*Sqlite3)(unsafe.Pointer(db)).FvtabOnConflict) - 1)]) +} + +var aMap = [5]uint8{ + uint8(SQLITE_ROLLBACK), uint8(SQLITE_ABORT), uint8(SQLITE_FAIL), uint8(SQLITE_IGNORE), uint8(SQLITE_REPLACE), +} /* sqlite3.c:144411:30 */ + +// Call from within the xCreate() or xConnect() methods to provide +// the SQLite core with additional information about the behavior +// of the virtual table being implemented. +func Xsqlite3_vtab_config(tls *libc.TLS, db uintptr, op int32, va uintptr) int32 { /* sqlite3.c:144428:16: */ + var ap Va_list + _ = ap + var rc int32 = SQLITE_OK + var p uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + p = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx + if !(p != 0) { + rc = Xsqlite3MisuseError(tls, 144439) + } else { + + ap = va + switch op { + case SQLITE_VTAB_CONSTRAINT_SUPPORT: + { + (*VTable)(unsafe.Pointer((*VtabCtx)(unsafe.Pointer(p)).FpVTable)).FbConstraint = U8(libc.VaInt32(&ap)) + break + + } + fallthrough + case SQLITE_VTAB_INNOCUOUS: + { + (*VTable)(unsafe.Pointer((*VtabCtx)(unsafe.Pointer(p)).FpVTable)).FeVtabRisk = U8(SQLITE_VTABRISK_Low) + break + + } + fallthrough + case SQLITE_VTAB_DIRECTONLY: + { + (*VTable)(unsafe.Pointer((*VtabCtx)(unsafe.Pointer(p)).FpVTable)).FeVtabRisk = U8(SQLITE_VTABRISK_High) + break + + } + fallthrough + default: + { + rc = Xsqlite3MisuseError(tls, 144457) + break + + } + } + _ = ap + } + + if rc != SQLITE_OK { + Xsqlite3Error(tls, db, rc) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +//************* End of vtab.c *********************************************** +//************* Begin file wherecode.c ************************************** +// 2015-06-06 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This module contains C code that generates VDBE code used to process +// the WHERE clause of SQL statements. +// +// This file was split off from where.c on 2015-06-06 in order to reduce the +// size of where.c and make it easier to edit. This file contains the routines +// that actually generate the bulk of the WHERE loop code. The original where.c +// file retains the code that does query planning and analysis. +// #include "sqliteInt.h" +//************* Include whereInt.h in the middle of wherecode.c ************* +//************* Begin file whereInt.h *************************************** +// 2013-11-12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains structure and macro definitions for the query +// planner logic in "where.c". These definitions are broken out into +// a separate source file for easier editing. + +// Forward references +type WhereClause1 = struct { + FpWInfo uintptr + FpOuter uintptr + Fop U8 + FhasOr U8 + _ [2]byte + FnTerm int32 + FnSlot int32 + _ [4]byte + Fa uintptr + FaStatic [8]WhereTerm +} /* sqlite3.c:14936:9 */ + +//************* End of vtab.c *********************************************** +//************* Begin file wherecode.c ************************************** +// 2015-06-06 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This module contains C code that generates VDBE code used to process +// the WHERE clause of SQL statements. +// +// This file was split off from where.c on 2015-06-06 in order to reduce the +// size of where.c and make it easier to edit. This file contains the routines +// that actually generate the bulk of the WHERE loop code. The original where.c +// file retains the code that does query planning and analysis. +// #include "sqliteInt.h" +//************* Include whereInt.h in the middle of wherecode.c ************* +//************* Begin file whereInt.h *************************************** +// 2013-11-12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains structure and macro definitions for the query +// planner logic in "where.c". These definitions are broken out into +// a separate source file for easier editing. + +// Forward references +type WhereClause = WhereClause1 /* sqlite3.c:144517:28 */ +type WhereMaskSet1 = struct { + FbVarSelect int32 + Fn int32 + Fix [64]int32 +} /* sqlite3.c:14936:9 */ + +type WhereMaskSet = WhereMaskSet1 /* sqlite3.c:144518:29 */ +type WhereOrInfo1 = struct { + Fwc WhereClause + Findexable Bitmask +} /* sqlite3.c:144519:9 */ + +type WhereOrInfo = WhereOrInfo1 /* sqlite3.c:144519:28 */ +type WhereAndInfo1 = struct{ Fwc WhereClause } /* sqlite3.c:144520:9 */ + +type WhereAndInfo = WhereAndInfo1 /* sqlite3.c:144520:29 */ +type WhereLevel1 = struct { + FiLeftJoin int32 + FiTabCur int32 + FiIdxCur int32 + FaddrBrk int32 + FaddrNxt int32 + FaddrSkip int32 + FaddrCont int32 + FaddrFirst int32 + FaddrBody int32 + FregBignull int32 + FaddrBignull int32 + FiFrom U8 + Fop U8 + Fp3 U8 + Fp5 U8 + Fp1 int32 + Fp2 int32 + Fu struct { + Fin struct { + FnIn int32 + _ [4]byte + FaInLoop uintptr + } + } + FpWLoop uintptr + FnotReady Bitmask +} /* sqlite3.c:14936:9 */ + +type WhereLevel = WhereLevel1 /* sqlite3.c:144521:27 */ +type WhereLoop1 = struct { + Fprereq Bitmask + FmaskSelf Bitmask + FiTab U8 + FiSortIdx U8 + FrSetup LogEst + FrRun LogEst + FnOut LogEst + Fu struct { + Fbtree struct { + FnEq U16 + FnBtm U16 + FnTop U16 + FnDistinctCol U16 + FpIndex uintptr + } + } + FwsFlags U32 + FnLTerm U16 + FnSkip U16 + FnLSlot U16 + _ [6]byte + FaLTerm uintptr + FpNextLoop uintptr + FaLTermSpace [3]uintptr +} /* sqlite3.c:14936:9 */ + +type WhereLoop = WhereLoop1 /* sqlite3.c:144522:26 */ +type WherePath1 = struct { + FmaskLoop Bitmask + FrevLoop Bitmask + FnRow LogEst + FrCost LogEst + FrUnsorted LogEst + FisOrdered I8 + _ [1]byte + FaLoop uintptr +} /* sqlite3.c:144523:9 */ + +type WherePath = WherePath1 /* sqlite3.c:144523:26 */ +type WhereTerm1 = struct { + FpExpr uintptr + FpWC uintptr + FtruthProb LogEst + FwtFlags U16 + FeOperator U16 + FnChild U8 + FeMatchOp U8 + FiParent int32 + FleftCursor int32 + Fu struct { + _ [0]uint64 + Fx struct { + FleftColumn int32 + FiField int32 + } + } + FprereqRight Bitmask + FprereqAll Bitmask +} /* sqlite3.c:14936:9 */ + +type WhereTerm = WhereTerm1 /* sqlite3.c:144524:26 */ +type WhereLoopBuilder1 = struct { + FpWInfo uintptr + FpWC uintptr + FpOrderBy uintptr + FpNew uintptr + FpOrSet uintptr + FpRec uintptr + FnRecValid int32 + FbldFlags1 uint8 + FbldFlags2 uint8 + _ [2]byte + FiPlanLimit uint32 + _ [4]byte +} /* sqlite3.c:144525:9 */ + +type WhereLoopBuilder = WhereLoopBuilder1 /* sqlite3.c:144525:33 */ +type WhereScan1 = struct { + FpOrigWC uintptr + FpWC uintptr + FzCollName uintptr + FpIdxExpr uintptr + Fidxaff int8 + FnEquiv uint8 + FiEquiv uint8 + _ [1]byte + FopMask U32 + Fk int32 + FaiCur [11]int32 + FaiColumn [11]I16 + _ [2]byte +} /* sqlite3.c:144526:9 */ + +type WhereScan = WhereScan1 /* sqlite3.c:144526:26 */ +type WhereOrCost1 = struct { + Fprereq Bitmask + FrRun LogEst + FnOut LogEst + _ [4]byte +} /* sqlite3.c:144525:9 */ + +type WhereOrCost = WhereOrCost1 /* sqlite3.c:144527:28 */ +type WhereOrSet1 = struct { + Fn U16 + _ [6]byte + Fa [3]WhereOrCost +} /* sqlite3.c:144525:9 */ + +type WhereOrSet = WhereOrSet1 /* sqlite3.c:144528:27 */ + +// This object contains information needed to implement a single nested +// loop in WHERE clause. +// +// Contrast this object with WhereLoop. This object describes the +// implementation of the loop. WhereLoop describes the algorithm. +// This object contains a pointer to the WhereLoop algorithm as one of +// its elements. +// +// The WhereInfo object contains a single instance of this object for +// each term in the FROM clause (which is to say, for each of the +// nested loops as implemented). The order of WhereLevel objects determines +// the loop nested order, with WhereInfo.a[0] being the outer loop and +// WhereInfo.a[WhereInfo.nLevel-1] being the inner loop. +type InLoop = struct { + FiCur int32 + FaddrInTop int32 + FiBase int32 + FnPrefix int32 + FeEndLoopOp U8 + _ [3]byte +} /* sqlite3.c:144567:7 */ + +// Allowed values for WhereLoopBuider.bldFlags + +// The WhereLoopBuilder.iPlanLimit is used to limit the number of +// index+constraint combinations the query planner will consider for a +// particular query. If this parameter is unlimited, then certain +// pathological queries can spend excess time in the sqlite3WhereBegin() +// routine. The limit is high enough that is should not impact real-world +// queries. +// +// SQLITE_QUERY_PLANNER_LIMIT is the baseline limit. The limit is +// increased by SQLITE_QUERY_PLANNER_LIMIT_INCR before each term of the FROM +// clause is processed, so that every table in a join is guaranteed to be +// able to propose a some index+constraint combinations even if the initial +// baseline limit was exhausted by prior tables of the join. + +// Each instance of this object records a change to a single node +// in an expression tree to cause that node to point to a column +// of an index rather than an expression or a virtual column. All +// such transformations need to be undone at the end of WHERE clause +// processing. +type WhereExprMod1 = struct { + FpNext uintptr + FpExpr uintptr + Forig Expr +} /* sqlite3.c:14936:9 */ + +// Allowed values for WhereLoopBuider.bldFlags + +// The WhereLoopBuilder.iPlanLimit is used to limit the number of +// index+constraint combinations the query planner will consider for a +// particular query. If this parameter is unlimited, then certain +// pathological queries can spend excess time in the sqlite3WhereBegin() +// routine. The limit is high enough that is should not impact real-world +// queries. +// +// SQLITE_QUERY_PLANNER_LIMIT is the baseline limit. The limit is +// increased by SQLITE_QUERY_PLANNER_LIMIT_INCR before each term of the FROM +// clause is processed, so that every table in a join is guaranteed to be +// able to propose a some index+constraint combinations even if the initial +// baseline limit was exhausted by prior tables of the join. + +// Each instance of this object records a change to a single node +// in an expression tree to cause that node to point to a column +// of an index rather than an expression or a virtual column. All +// such transformations need to be undone at the end of WHERE clause +// processing. +type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ + +// Bitmasks for the operators on WhereTerm objects. These are all +// operators that are of interest to the query planner. An +// OR-ed combination of these values can be used when searching for +// particular WhereTerms within a WhereClause. +// +// Value constraints: +// WO_EQ == SQLITE_INDEX_CONSTRAINT_EQ +// WO_LT == SQLITE_INDEX_CONSTRAINT_LT +// WO_LE == SQLITE_INDEX_CONSTRAINT_LE +// WO_GT == SQLITE_INDEX_CONSTRAINT_GT +// WO_GE == SQLITE_INDEX_CONSTRAINT_GE + +// These are definitions of bits in the WhereLoop.wsFlags field. +// The particular combination of bits in each WhereLoop help to +// determine the algorithm that WhereLoop represents. + +//************* End of whereInt.h ******************************************* +//************* Continuing where we left off in wherecode.c ***************** + +// Return the name of the i-th column of the pIdx index. +func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ + i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + if i == (-2) { + return ts + 19871 /* "" */ + } + if i == (-1) { + return ts + 14758 /* "rowid" */ + } + return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*32)).FzName +} + +// This routine is a helper for explainIndexRange() below +// +// pStr holds the text of an expression that we are building up one term +// at a time. This routine adds a new term to the end of the expression. +// Terms are separated by AND so add the "AND" text for second and subsequent +// terms only. +func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, iTerm int32, bAnd int32, zOp uintptr) { /* sqlite3.c:145127:13: */ + var i int32 + + if bAnd != 0 { + Xsqlite3_str_append(tls, pStr, ts+19878 /* " AND " */, 5) + } + + if nTerm > 1 { + Xsqlite3_str_append(tls, pStr, ts+19884 /* "(" */, 1) + } + for i = 0; i < nTerm; i++ { + if i != 0 { + Xsqlite3_str_append(tls, pStr, ts+11538 /* "," */, 1) + } + Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) + } + if nTerm > 1 { + Xsqlite3_str_append(tls, pStr, ts+4067 /* ")" */, 1) + } + + Xsqlite3_str_append(tls, pStr, zOp, 1) + + if nTerm > 1 { + Xsqlite3_str_append(tls, pStr, ts+19884 /* "(" */, 1) + } + for i = 0; i < nTerm; i++ { + if i != 0 { + Xsqlite3_str_append(tls, pStr, ts+11538 /* "," */, 1) + } + Xsqlite3_str_append(tls, pStr, ts+4123 /* "?" */, 1) + } + if nTerm > 1 { + Xsqlite3_str_append(tls, pStr, ts+4067 /* ")" */, 1) + } +} + +// Argument pLevel describes a strategy for scanning table pTab. This +// function appends text to pStr that describes the subset of table +// rows scanned by the strategy in the form of an SQL expression. +// +// For example, if the query: +// +// SELECT * FROM t1 WHERE a=1 AND b>2; +// +// is run and there is an index on (a, b), then this function returns a +// string similar to: +// +// "a=? AND b>?" +func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3.c:145171:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pIndex uintptr = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + var nEq U16 = *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) + var nSkip U16 = (*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip + var i int32 + var j int32 + + if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { + return + } + Xsqlite3_str_append(tls, pStr, ts+19886 /* " (" */, 2) + for i = 0; i < int32(nEq); i++ { + var z uintptr = explainIndexColumnName(tls, pIndex, i) + if i != 0 { + Xsqlite3_str_append(tls, pStr, ts+19878 /* " AND " */, 5) + } + Xsqlite3_str_appendf(tls, pStr, func() uintptr { + if i >= int32(nSkip) { + return ts + 19889 /* "%s=?" */ + } + return ts + 19894 /* "ANY(%s)" */ + }(), libc.VaList(bp, z)) + } + + j = i + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19902 /* ">" */) + i = 1 + } + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19904 /* "<" */) + } + Xsqlite3_str_append(tls, pStr, ts+4067 /* ")" */, 1) +} + +// This function is a no-op unless currently processing an EXPLAIN QUERY PLAN +// command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was +// defined at compile-time. If it is not a no-op, a single OP_Explain opcode +// is added to the output to describe the table scan strategy in pLevel. +// +// If an OP_Explain opcode is added to the VM, its address is returned. +// Otherwise, if no OP_Explain is coded, zero is returned. +func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr, pLevel uintptr, wctrlFlags U16) int32 { /* sqlite3.c:145205:20: */ + bp := tls.Alloc(180) + defer tls.Free(180) + + var ret int32 = 0 + if int32((*Parse)(unsafe.Pointer((func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }()))).Fexplain) == 2 { + var pItem uintptr = ((pTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112) + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // VM being constructed + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle + var isSearch int32 // True for a SEARCH. False for SCAN. + var pLoop uintptr // The controlling WhereLoop object + var flags U32 // Flags that describe this loop + var zMsg uintptr // Text to add to EQP output + // var str StrAccum at bp+48, 32 + // EQP output string + // var zBuf [100]int8 at bp+80, 100 + // Initial space for EQP output string + + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + flags = (*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags + if ((flags & U32(WHERE_MULTI_OR)) != 0) || ((int32(wctrlFlags) & WHERE_OR_SUBCLAUSE) != 0) { + return 0 + } + + isSearch = (libc.Bool32((((flags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) != U32(0)) || + (((flags & U32(WHERE_VIRTUALTABLE)) == U32(0)) && (int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */))) > 0))) || + ((int32(wctrlFlags) & (WHERE_ORDERBY_MIN | WHERE_ORDERBY_MAX)) != 0))) + + Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+80 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) + (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19906 /* "%s %S" */, libc.VaList(bp, func() uintptr { + if isSearch != 0 { + return ts + 19912 /* "SEARCH" */ + } + return ts + 19919 /* "SCAN" */ + }(), pItem)) + if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { + var zFmt uintptr = uintptr(0) + var pIdx uintptr + + pIdx = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + + if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { + if isSearch != 0 { + zFmt = ts + 9701 /* "PRIMARY KEY" */ + } + } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { + zFmt = ts + 19924 /* "AUTOMATIC PARTIA..." */ + } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { + zFmt = ts + 19957 /* "AUTOMATIC COVERI..." */ + } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { + zFmt = ts + 19982 /* "COVERING INDEX %..." */ + } else { + zFmt = ts + 20000 /* "INDEX %s" */ + } + if zFmt != 0 { + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20009 /* " USING " */, 7) + Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) + explainIndexRange(tls, bp+48 /* &str */, pLoop) + } + } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { + var zRangeOp uintptr + if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { + zRangeOp = ts + 20017 /* "=" */ + } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { + zRangeOp = ts + 20019 /* ">? AND rowid<" */ + } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { + zRangeOp = ts + 19902 /* ">" */ + } else { + + zRangeOp = ts + 19904 /* "<" */ + } + Xsqlite3_str_appendf(tls, bp+48, /* &str */ + ts+20033 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20071, /* " VIRTUAL TABLE I..." */ + libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) + } + zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) + + ret = Xsqlite3VdbeAddOp4(tls, v, OP_Explain, Xsqlite3VdbeCurrentAddr(tls, v), + (*Parse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -7) + } + return ret +} + +// Disable a term in the WHERE clause. Except, do not disable the term +// if it controls a LEFT OUTER JOIN and it did not originate in the ON +// or USING clause of that join. +// +// Consider the term t2.z='ok' in the following queries: +// +// (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok' +// (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok' +// (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok' +// +// The t2.z='ok' is disabled in the in (2) because it originates +// in the ON clause. The term is disabled in (3) because it is not part +// of a LEFT OUTER JOIN. In (1), the term is not disabled. +// +// Disabling a term causes that term to not be tested in the inner loop +// of the join. Disabling is an optimization. When terms are satisfied +// by indices, we disable them to prevent redundant tests in the inner +// loop. We would get the correct results if nothing were ever disabled, +// but joins might run a little slower. The trick is to disable as much +// as we can without disabling too much. If we disabled in (1), we'd get +// the wrong answer. See ticket #813. +// +// If all the children of a term are disabled, then that term is also +// automatically disabled. In this way, terms get disabled if derived +// virtual terms are tested first. For example: +// +// x GLOB 'abc*' AND x>='abc' AND x<'acd' +// \___________/ \______/ \_____/ +// parent child1 child2 +// +// Only the parent term was in the original WHERE clause. The child1 +// and child2 terms were added by the LIKE optimization. If both of +// the virtual child terms are valid, then testing of the parent can be +// skipped. +// +// Usually the parent term is marked as TERM_CODED. But if the parent +// term was originally TERM_LIKE, then the parent gets TERM_LIKECOND instead. +// The TERM_LIKECOND marking indicates that the term should be coded inside +// a conditional such that is only evaluated on the second pass of a +// LIKE-optimization loop, when scanning BLOBs instead of strings. +func disableTerm(tls *libc.TLS, pLevel uintptr, pTerm uintptr) { /* sqlite3.c:145372:13: */ + var nLoop int32 = 0 + + for (((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_CODED) == 0) && + (((*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin == 0) || (((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)))) && + (((*WhereLevel)(unsafe.Pointer(pLevel)).FnotReady & (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll) == uint64(0)) { + if (nLoop != 0) && ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_LIKE) != 0) { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_LIKECOND)) + } else { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) + } + if (*WhereTerm)(unsafe.Pointer(pTerm)).FiParent < 0 { + break + } + pTerm = ((*WhereClause)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpWC)).Fa + uintptr((*WhereTerm)(unsafe.Pointer(pTerm)).FiParent)*56) + + (*WhereTerm)(unsafe.Pointer(pTerm)).FnChild-- + if int32((*WhereTerm)(unsafe.Pointer(pTerm)).FnChild) != 0 { + break + } + nLoop++ + } +} + +// Code an OP_Affinity opcode to apply the column affinity string zAff +// to the n registers starting at base. +// +// As an optimization, SQLITE_AFF_BLOB and SQLITE_AFF_NONE entries (which +// are no-ops) at the beginning and end of zAff are ignored. If all entries +// in zAff are SQLITE_AFF_BLOB or SQLITE_AFF_NONE, then no code gets generated. +// +// This routine makes its own copy of zAff so that the caller is free +// to modify zAff after this routine returns. +func codeApplyAffinity(tls *libc.TLS, pParse uintptr, base int32, n int32, zAff uintptr) { /* sqlite3.c:145410:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + if zAff == uintptr(0) { + + return + } + + // Adjust base and n to skip over SQLITE_AFF_BLOB and SQLITE_AFF_NONE + // entries at the beginning and end of the affinity string. + + for (n > 0) && (int32(*(*int8)(unsafe.Pointer(zAff))) <= SQLITE_AFF_BLOB) { + n-- + base++ + zAff++ + } + for (n > 1) && (int32(*(*int8)(unsafe.Pointer(zAff + uintptr((n - 1))))) <= SQLITE_AFF_BLOB) { + n-- + } + + // Code the OP_Affinity opcode if there is anything left to do. + if n > 0 { + Xsqlite3VdbeAddOp4(tls, v, OP_Affinity, base, n, 0, zAff, n) + } +} + +// Expression pRight, which is the RHS of a comparison operation, is +// either a vector of n elements or, if n==1, a scalar expression. +// Before the comparison operation, affinity zAff is to be applied +// to the pRight values. This function modifies characters within the +// affinity string to SQLITE_AFF_BLOB if either: +// +// * the comparison will be performed with no affinity, or +// * the affinity change in zAff is guaranteed not to change the value. +func updateRangeAffinityStr(tls *libc.TLS, pRight uintptr, n int32, zAff uintptr) { /* sqlite3.c:145447:13: */ + var i int32 + for i = 0; i < n; i++ { + var p uintptr = Xsqlite3VectorFieldSubexpr(tls, pRight, i) + if (int32(Xsqlite3CompareAffinity(tls, p, *(*int8)(unsafe.Pointer(zAff + uintptr(i))))) == SQLITE_AFF_BLOB) || + (Xsqlite3ExprNeedsNoAffinityChange(tls, p, *(*int8)(unsafe.Pointer(zAff + uintptr(i)))) != 0) { + *(*int8)(unsafe.Pointer(zAff + uintptr(i))) = int8(SQLITE_AFF_BLOB) + } + } +} + +// pX is an expression of the form: (vector) IN (SELECT ...) +// In other words, it is a vector IN operator with a SELECT clause on the +// LHS. But not all terms in the vector are indexable and the terms might +// not be in the correct order for indexing. +// +// This routine makes a copy of the input pX expression and then adjusts +// the vector on the LHS with corresponding changes to the SELECT so that +// the vector contains only index terms and those terms are in the correct +// order. The modified IN expression is returned. The caller is responsible +// for deleting the returned expression. +// +// Example: +// +// CREATE TABLE t1(a,b,c,d,e,f); +// CREATE INDEX t1x1 ON t1(e,c); +// SELECT * FROM t1 WHERE (a,b,c,d,e) IN (SELECT v,w,x,y,z FROM t2) +// \_______________________________________/ +// The pX expression +// +// Since only columns e and c can be used with the index, in that order, +// the modified IN expression that is returned will be: +// +// (e,c) IN (SELECT z,x FROM t2) +// +// The reduced pX is different from the original (obviously) and thus is +// only used for indexing, to improve performance. The original unaltered +// IN expression must also be run on each output row for correctness. +func removeUnindexableInClauseTerms(tls *libc.TLS, pParse uintptr, iEq int32, pLoop uintptr, pX uintptr) uintptr { /* sqlite3.c:145493:13: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pNew uintptr + pNew = Xsqlite3ExprDup(tls, db, pX, 0) + if int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0 { + var pOrigRhs uintptr = (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)))).FpEList // Original unmodified RHS + var pOrigLhs uintptr = *(*uintptr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pNew)).FpLeft + 32 /* &.x */)) // Original unmodified LHS + var pRhs uintptr = uintptr(0) // New RHS after modifications + var pLhs uintptr = uintptr(0) // New LHS after mods + var i int32 // Loop counter + var pSelect uintptr // Pointer to the SELECT on the RHS + + for i = iEq; i < int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm); i++ { + if (*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + var iField int32 = (*(*int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)) + 32 /* &.u */ /* &.x */) + 4 /* &.iField */)) - 1) + if (*ExprList_item)(unsafe.Pointer((pOrigRhs+8 /* &.a */)+uintptr(iField)*32)).FpExpr == uintptr(0) { + continue + } // Duplicate PK column + pRhs = Xsqlite3ExprListAppend(tls, pParse, pRhs, (*ExprList_item)(unsafe.Pointer((pOrigRhs+8 /* &.a */)+uintptr(iField)*32)).FpExpr) + (*ExprList_item)(unsafe.Pointer((pOrigRhs + 8 /* &.a */) + uintptr(iField)*32)).FpExpr = uintptr(0) + + pLhs = Xsqlite3ExprListAppend(tls, pParse, pLhs, (*ExprList_item)(unsafe.Pointer((pOrigLhs+8 /* &.a */)+uintptr(iField)*32)).FpExpr) + (*ExprList_item)(unsafe.Pointer((pOrigLhs + 8 /* &.a */) + uintptr(iField)*32)).FpExpr = uintptr(0) + } + } + Xsqlite3ExprListDelete(tls, db, pOrigRhs) + Xsqlite3ExprListDelete(tls, db, pOrigLhs) + *(*uintptr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pNew)).FpLeft + 32 /* &.x */)) = pLhs + (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)))).FpEList = pRhs + if (pLhs != 0) && ((*ExprList)(unsafe.Pointer(pLhs)).FnExpr == 1) { + // Take care here not to generate a TK_VECTOR containing only a + // single value. Since the parser never creates such a vector, some + // of the subroutines do not handle this case. + var p uintptr = (*ExprList_item)(unsafe.Pointer((pLhs + 8 /* &.a */))).FpExpr + (*ExprList_item)(unsafe.Pointer((pLhs + 8 /* &.a */))).FpExpr = uintptr(0) + Xsqlite3ExprDelete(tls, db, (*Expr)(unsafe.Pointer(pNew)).FpLeft) + (*Expr)(unsafe.Pointer(pNew)).FpLeft = p + } + pSelect = *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) + if (*Select)(unsafe.Pointer(pSelect)).FpOrderBy != 0 { + // If the SELECT statement has an ORDER BY clause, zero the + // iOrderByCol variables. These are set to non-zero when an + // ORDER BY term exactly matches one of the terms of the + // result-set. Since the result-set of the SELECT statement may + // have been modified or reordered, these variables are no longer + // set correctly. Since setting them is just an optimization, + // it's easiest just to zero them here. + var pOrderBy uintptr = (*Select)(unsafe.Pointer(pSelect)).FpOrderBy + for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { + *(*U16)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32 + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(0) + } + } + + } + return pNew +} + +// Generate code for a single equality term of the WHERE clause. An equality +// term can be either X=expr or X IN (...). pTerm is the term to be +// coded. +// +// The current value for the constraint is left in a register, the index +// of which is returned. An attempt is made store the result in iTarget but +// this is only guaranteed for TK_ISNULL and TK_IN constraints. If the +// constraint is a TK_EQ or TK_IS, then the current value might be left in +// some other register and it is the caller's responsibility to compensate. +// +// For a constraint of the form X=expr, the expression is evaluated in +// straight-line code. For constraints of the form X IN (...) +// this routine sets up a loop that will iterate over all values of X. +func codeEqualityTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uintptr, iEq int32, bRev int32, iTarget int32) int32 { /* sqlite3.c:145575:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pX uintptr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var iReg int32 // Register holding results + + if (int32((*Expr)(unsafe.Pointer(pX)).Fop) == TK_EQ) || (int32((*Expr)(unsafe.Pointer(pX)).Fop) == TK_IS) { + iReg = Xsqlite3ExprCodeTarget(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, iTarget) + } else if int32((*Expr)(unsafe.Pointer(pX)).Fop) == TK_ISNULL { + iReg = iTarget + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, iReg) + } else { + var eType int32 = IN_INDEX_NOOP + // var iTab int32 at bp, 4 + + var pIn uintptr + var pLoop uintptr = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + var i int32 + var nEq int32 = 0 + var aiMap uintptr = uintptr(0) + + if ((((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_VIRTUALTABLE)) == U32(0)) && + (*(*uintptr)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) + 8 /* &.pIndex */)) != uintptr(0))) && + (*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) + 8 /* &.pIndex */)))).FaSortOrder + uintptr(iEq))) != 0) { + + bRev = libc.BoolInt32(!(bRev != 0)) + } + + iReg = iTarget + + for i = 0; i < iEq; i++ { + if (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)) != 0) && ((*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX) { + disableTerm(tls, pLevel, pTerm) + return iTarget + } + } + for i = iEq; i < int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm); i++ { + + if (*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + nEq++ + } + } + + *(*int32)(unsafe.Pointer(bp /* iTab */)) = 0 + if (((*Expr)(unsafe.Pointer(pX)).Fflags & U32(EP_xIsSelect)) == U32(0)) || ((*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pX + 32 /* &.x */)))).FpEList)).FnExpr == 1) { + eType = Xsqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), uintptr(0), bp /* &iTab */) + } else { + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + pX = removeUnindexableInClauseTerms(tls, pParse, iEq, pLoop, pX) + + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + aiMap = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64(uint64(unsafe.Sizeof(int32(0))) * uint64(nEq)))) + eType = Xsqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), aiMap, bp /* &iTab */) + (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FiTable = *(*int32)(unsafe.Pointer(bp /* iTab */)) + } + Xsqlite3ExprDelete(tls, db, pX) + pX = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + } + + if eType == IN_INDEX_INDEX_DESC { + + bRev = libc.BoolInt32(!(bRev != 0)) + } + Xsqlite3VdbeAddOp2(tls, v, func() int32 { + if bRev != 0 { + return OP_Last + } + return OP_Rewind + }(), *(*int32)(unsafe.Pointer(bp /* iTab */)), 0) + + *(*U32)(unsafe.Pointer(pLoop + 40 /* &.wsFlags */)) |= (U32(WHERE_IN_ABLE)) + if *(*int32)(unsafe.Pointer((pLevel + 56 /* &.u */ /* &.in */) /* &.nIn */)) == 0 { + (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt = Xsqlite3VdbeMakeLabel(tls, pParse) + } + if (iEq > 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_SEEKSCAN)) == U32(0)) { + *(*U32)(unsafe.Pointer(pLoop + 40 /* &.wsFlags */)) |= (U32(WHERE_IN_EARLYOUT)) + } + + i = *(*int32)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ /* &.nIn */)) + *(*int32)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ /* &.nIn */)) += (nEq) + *(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ + 8 /* &.aInLoop */)) = Xsqlite3DbReallocOrFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ + 8 /* &.aInLoop */)), + (uint64(uint64(unsafe.Sizeof(InLoop{})) * uint64(*(*int32)(unsafe.Pointer((pLevel + 56 /* &.u */ /* &.in */) /* &.nIn */)))))) + pIn = *(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ + 8 /* &.aInLoop */)) + if pIn != 0 { + var iMap int32 = 0 // Index in aiMap[] + pIn += 20 * (uintptr(i)) + for i = iEq; i < int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm); i++ { + if (*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + var iOut int32 = ((iReg + i) - iEq) + if eType == IN_INDEX_ROWID { + *(*int32)(unsafe.Pointer(pIn + 4 /* &.addrInTop */)) = Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, *(*int32)(unsafe.Pointer(bp /* iTab */)), iOut) + } else { + var iCol int32 + if aiMap != 0 { + iCol = *(*int32)(unsafe.Pointer(aiMap + uintptr(libc.PostIncInt32(&iMap, 1))*4)) + } else { + iCol = 0 + } + *(*int32)(unsafe.Pointer(pIn + 4 /* &.addrInTop */)) = Xsqlite3VdbeAddOp3(tls, v, OP_Column, *(*int32)(unsafe.Pointer(bp /* iTab */)), iCol, iOut) + } + Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, iOut) + if i == iEq { + *(*int32)(unsafe.Pointer(pIn /* &.iCur */)) = *(*int32)(unsafe.Pointer(bp /* iTab */)) + *(*U8)(unsafe.Pointer(pIn + 16 /* &.eEndLoopOp */)) = func() uint8 { + if bRev != 0 { + return uint8(OP_Prev) + } + return uint8(OP_Next) + }() + if iEq > 0 { + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iBase */)) = (iReg - i) + *(*int32)(unsafe.Pointer(pIn + 12 /* &.nPrefix */)) = i + } else { + *(*int32)(unsafe.Pointer(pIn + 12 /* &.nPrefix */)) = 0 + } + } else { + *(*U8)(unsafe.Pointer(pIn + 16 /* &.eEndLoopOp */)) = U8(OP_Noop) + } + pIn += 20 + } + } + + if (iEq > 0) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_IN_SEEKSCAN | WHERE_VIRTUALTABLE))) == U32(0)) { + Xsqlite3VdbeAddOp3(tls, v, OP_SeekHit, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, 0, iEq) + } + } else { + *(*int32)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ /* &.nIn */)) = 0 + } + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiMap) + } + + // As an optimization, try to disable the WHERE clause term that is + // driving the index as it will always be true. The correct answer is + // obtained regardless, but we might get the answer with fewer CPU cycles + // by omitting the term. + // + // But do not disable the term unless we are certain that the term is + // not a transitive constraint. For an example of where that does not + // work, see https://sqlite.org/forum/forumpost/eb8613976a (2021-05-04) + if (((*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FwsFlags & U32(WHERE_TRANSCONS)) == U32(0)) || + ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_EQUIV) == 0) { + disableTerm(tls, pLevel, pTerm) + } + + return iReg +} + +// Generate code that will evaluate all == and IN constraints for an +// index scan. +// +// For example, consider table t1(a,b,c,d,e,f) with index i1(a,b,c). +// Suppose the WHERE clause is this: a==5 AND b IN (1,2,3) AND c>5 AND c<10 +// The index has as many as three equality constraints, but in this +// example, the third "c" value is an inequality. So only two +// constraints are coded. This routine will generate code to evaluate +// a==5 and b IN (1,2,3). The current values for a and b will be stored +// in consecutive registers and the index of the first register is returned. +// +// In the example above nEq==2. But this subroutine works for any value +// of nEq including 0. If nEq==0, this routine is nearly a no-op. +// The only thing it does is allocate the pLevel->iMem memory cell and +// compute the affinity string. +// +// The nExtraReg parameter is 0 or 1. It is 0 if all WHERE clause constraints +// are == or IN and are covered by the nEq. nExtraReg is 1 if there is +// an inequality constraint (such as the "c>=5 AND c<10" in the example) that +// occurs after the nEq quality constraints. +// +// This routine allocates a range of nEq+nExtraReg memory cells and returns +// the index of the first memory cell in that range. The code that +// calls this routine will use that memory range to store keys for +// start and termination conditions of the loop. +// key value of the loop. If one or more IN operators appear, then +// this routine allocates an additional nEq memory cells for internal +// use. +// +// Before returning, *pzAff is set to point to a buffer containing a +// copy of the column affinity string of the index allocated using +// sqlite3DbMalloc(). Except, entries in the copy of the string associated +// with equality constraints that use BLOB or NONE affinity are set to +// SQLITE_AFF_BLOB. This is to deal with SQL such as the following: +// +// CREATE TABLE t1(a TEXT PRIMARY KEY, b); +// SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b; +// +// In the example above, the index on t1(a) has TEXT affinity. But since +// the right hand side of the equality constraint (t2.b) has BLOB/NONE affinity, +// no conversion should be attempted before using a t2.b value as part of +// a key to search the index. Hence the first byte in the returned affinity +// string in this example would be set to SQLITE_AFF_BLOB. +func codeAllEqualityTerms(tls *libc.TLS, pParse uintptr, pLevel uintptr, bRev int32, nExtraReg int32, pzAff uintptr) int32 { /* sqlite3.c:145771:12: */ + var nEq U16 // The number of == or IN constraints to code + var nSkip U16 // Number of left-most columns to skip + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // The vm under construction + var pIdx uintptr // The index being used for this loop + var pTerm uintptr // A single constraint term + var pLoop uintptr // The WhereLoop object + var j int32 // Loop counter + var regBase int32 // Base register + var nReg int32 // Number of registers to allocate + var zAff uintptr // Affinity string to return + + // This module is only called on query plans that use an index. + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + + nEq = *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) + nSkip = (*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip + pIdx = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + + // Figure out how many memory cells we will need then allocate them. + regBase = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + nReg = (int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */))) + nExtraReg) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nReg) + + zAff = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, Xsqlite3IndexAffinityStr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pIdx)) + + if nSkip != 0 { + var iIdxCur int32 = (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, regBase, ((regBase + int32(nSkip)) - 1)) + Xsqlite3VdbeAddOp1(tls, v, func() int32 { + if bRev != 0 { + return OP_Last + } + return OP_Rewind + }(), iIdxCur) + + j = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip = Xsqlite3VdbeAddOp4Int(tls, v, func() int32 { + if bRev != 0 { + return OP_SeekLT + } + return OP_SeekGT + }(), + iIdxCur, 0, regBase, int32(nSkip)) + + Xsqlite3VdbeJumpHere(tls, v, j) + for j = 0; j < int32(nSkip); j++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iIdxCur, j, (regBase + j)) + + } + } + + // Evaluate the equality constraints + + for j = int32(nSkip); j < int32(nEq); j++ { + var r1 int32 + pTerm = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + + // The following testcase is true for indices with redundant columns. + // Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; + + r1 = codeEqualityTerm(tls, pParse, pTerm, pLevel, j, bRev, (regBase + j)) + if r1 != (regBase + j) { + if nReg == 1 { + Xsqlite3ReleaseTempReg(tls, pParse, regBase) + regBase = r1 + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, r1, (regBase + j)) + } + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_IN) != 0 { + if ((*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).Fflags & U32(EP_xIsSelect)) != 0 { + // No affinity ever needs to be (or should be) applied to a value + // from the RHS of an "? IN (SELECT ...)" expression. The + // sqlite3FindInIndex() routine has already ensured that the + // affinity of the comparison has been applied to the value. + if zAff != 0 { + *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) + } + } + } else if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_ISNULL) == 0 { + var pRight uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + if ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_IS) == 0) && (Xsqlite3ExprCanBeNull(tls, pRight) != 0) { + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (regBase + j), (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) + + } + if (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed) == 0) && ((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) { + if int32(Xsqlite3CompareAffinity(tls, pRight, *(*int8)(unsafe.Pointer(zAff + uintptr(j))))) == SQLITE_AFF_BLOB { + *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) + } + if Xsqlite3ExprNeedsNoAffinityChange(tls, pRight, *(*int8)(unsafe.Pointer(zAff + uintptr(j)))) != 0 { + *(*int8)(unsafe.Pointer(zAff + uintptr(j))) = int8(SQLITE_AFF_BLOB) + } + } + } + } + *(*uintptr)(unsafe.Pointer(pzAff)) = zAff + return regBase +} + +// Cursor iCur is open on an intkey b-tree (a table). Register iRowid contains +// a rowid value just read from cursor iIdxCur, open on index pIdx. This +// function generates code to do a deferred seek of cursor iCur to the +// rowid stored in register iRowid. +// +// Normally, this is just: +// +// OP_DeferredSeek $iCur $iRowid +// +// However, if the scan currently being coded is a branch of an OR-loop and +// the statement currently being coded is a SELECT, then P3 of OP_DeferredSeek +// is set to iIdxCur and P4 is set to point to an array of integers +// containing one entry for each column of the table cursor iCur is open +// on. For each table column, if the column is the i'th column of the +// index, then the corresponding array entry is set to (i+1). If the column +// does not appear in the index at all, the array entry is set to 0. +func codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, iIdxCur int32) { /* sqlite3.c:146144:13: */ + var pParse uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse // Parse context + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe // Vdbe to generate code within + + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.bDeferredSeek */, uint32(1), 0, 0x1) + Xsqlite3VdbeAddOp3(tls, v, OP_DeferredSeek, iIdxCur, 0, iCur) + if ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_OR_SUBCLAUSE) != 0) && + (((*Parse)(unsafe.Pointer(func() uintptr { + if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { + return (*Parse)(unsafe.Pointer(pParse)).FpToplevel + } + return pParse + }())).FwriteMask) == YDbMask(0)) { + var i int32 + var pTab uintptr = (*Index)(unsafe.Pointer(pIdx)).FpTable + var ai uintptr = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64(uint64(unsafe.Sizeof(U32(0))) * (uint64(int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1))))) + if ai != 0 { + *(*U32)(unsafe.Pointer(ai)) = U32((*Table)(unsafe.Pointer(pTab)).FnCol) + for i = 0; i < (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) - 1); i++ { + var x1 int32 + var x2 int32 + + x1 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) + x2 = int32(Xsqlite3TableColumnToStorage(tls, pTab, int16(x1))) + + if x1 >= 0 { + *(*U32)(unsafe.Pointer(ai + uintptr((x2+1))*4)) = (U32(i + 1)) + } + } + Xsqlite3VdbeChangeP4(tls, v, -1, ai, -15) + } + } +} + +// If the expression passed as the second argument is a vector, generate +// code to write the first nReg elements of the vector into an array +// of registers starting with iReg. +// +// If the expression is not a vector, then nReg must be passed 1. In +// this case, generate code to evaluate the expression and leave the +// result in register iReg. +func codeExprOrVector(tls *libc.TLS, pParse uintptr, p uintptr, iReg int32, nReg int32) { /* sqlite3.c:146188:13: */ + + if (p != 0) && (Xsqlite3ExprIsVector(tls, p) != 0) { + if ((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_xIsSelect)) != 0 { + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var iSelect int32 + + iSelect = Xsqlite3CodeSubselect(tls, pParse, p) + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, iSelect, iReg, (nReg - 1)) + } else { + var i int32 + var pList uintptr = *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) + + for i = 0; i < nReg; i++ { + Xsqlite3ExprCode(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr, (iReg + i)) + } + } + } else { + + Xsqlite3ExprCode(tls, pParse, p, iReg) + } +} + +// An instance of the IdxExprTrans object carries information about a +// mapping from an expression on table columns into a column in an index +// down through the Walker. +type IdxExprTrans = IdxExprTrans1 /* sqlite3.c:146226:3 */ + +// Preserve pExpr on the WhereETrans list of the WhereInfo. +func preserveExpr(tls *libc.TLS, pTrans uintptr, pExpr uintptr) { /* sqlite3.c:146231:13: */ + var pNew uintptr + pNew = Xsqlite3DbMallocRaw(tls, (*IdxExprTrans)(unsafe.Pointer(pTrans)).Fdb, uint64(unsafe.Sizeof(WhereExprMod{}))) + if pNew == uintptr(0) { + return + } + (*WhereExprMod)(unsafe.Pointer(pNew)).FpNext = (*WhereInfo)(unsafe.Pointer((*IdxExprTrans)(unsafe.Pointer(pTrans)).FpWInfo)).FpExprMods + (*WhereInfo)(unsafe.Pointer((*IdxExprTrans)(unsafe.Pointer(pTrans)).FpWInfo)).FpExprMods = pNew + (*WhereExprMod)(unsafe.Pointer(pNew)).FpExpr = pExpr + libc.Xmemcpy(tls, (pNew + 16 /* &.orig */), pExpr, uint64(unsafe.Sizeof(Expr{}))) +} + +// The walker node callback used to transform matching expressions into +// a reference to an index column for an index on an expression. +// +// If pExpr matches, then transform it into a reference to the index column +// that contains the value of pExpr. +func whereIndexExprTransNode(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:146247:12: */ + var pX uintptr = *(*uintptr)(unsafe.Pointer(p + 40 /* &.u */)) + if Xsqlite3ExprCompare(tls, uintptr(0), pExpr, (*IdxExprTrans)(unsafe.Pointer(pX)).FpIdxExpr, (*IdxExprTrans)(unsafe.Pointer(pX)).FiTabCur) == 0 { + preserveExpr(tls, pX, pExpr) + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = Xsqlite3ExprAffinity(tls, pExpr) + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_COLUMN) + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (*IdxExprTrans)(unsafe.Pointer(pX)).FiIdxCur + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = YnVar((*IdxExprTrans)(unsafe.Pointer(pX)).FiIdxCol) + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) + + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32((EP_Skip | EP_Unlikely)))) + return WRC_Prune + } else { + return WRC_Continue + } + return int32(0) +} + +// A walker node callback that translates a column reference to a table +// into a corresponding column reference of an index. +func whereIndexExprTransColumn(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:146269:12: */ + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN { + var pX uintptr = *(*uintptr)(unsafe.Pointer(p + 40 /* &.u */)) + if ((*Expr)(unsafe.Pointer(pExpr)).FiTable == (*IdxExprTrans)(unsafe.Pointer(pX)).FiTabCur) && (int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) == (*IdxExprTrans)(unsafe.Pointer(pX)).FiTabCol) { + + preserveExpr(tls, pX, pExpr) + (*Expr)(unsafe.Pointer(pExpr)).FaffExpr = Xsqlite3TableColumnAffinity(tls, *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)), int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (*IdxExprTrans)(unsafe.Pointer(pX)).FiIdxCur + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = YnVar((*IdxExprTrans)(unsafe.Pointer(pX)).FiIdxCol) + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) + } + } + return WRC_Continue +} + +// For an indexes on expression X, locate every instance of expression X +// in pExpr and change that subexpression into a reference to the appropriate +// column of the index. +// +// 2019-10-24: Updated to also translate references to a VIRTUAL column in +// the table into references to the corresponding (stored) column of the +// index. +func whereIndexExprTrans(tls *libc.TLS, pIdx uintptr, iTabCur int32, iIdxCur int32, pWInfo uintptr) { /* sqlite3.c:146294:13: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + var iIdxCol int32 // Column number of the index + var aColExpr uintptr // Expressions that are indexed + var pTab uintptr + // var w Walker at bp, 48 + + // var x IdxExprTrans at bp+48, 40 + + aColExpr = (*Index)(unsafe.Pointer(pIdx)).FaColExpr + if (aColExpr == uintptr(0)) && !((int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.bHasVCol */)) & 0x400 >> 10)) != 0) { + // The index does not reference any expressions or virtual columns + // so no translations are needed. + return + } + pTab = (*Index)(unsafe.Pointer(pIdx)).FpTable + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + *(*uintptr)(unsafe.Pointer(bp /* &w */ + 40 /* &.u */)) = bp + 48 /* &x */ + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).FiTabCur = iTabCur + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).FiIdxCur = iIdxCur + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).FpWInfo = pWInfo + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).Fdb = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb + for iIdxCol = 0; iIdxCol < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn); iIdxCol++ { + var iRef I16 = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iIdxCol)*2)) + if int32(iRef) == (-2) { + + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).FpIdxExpr = (*ExprList_item)(unsafe.Pointer((aColExpr + 8 /* &.a */) + uintptr(iIdxCol)*32)).FpExpr + if Xsqlite3ExprIsConstant(tls, (*IdxExprTrans)(unsafe.Pointer(bp+48 /* &x */)).FpIdxExpr) != 0 { + continue + } + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{whereIndexExprTransNode})) + } else if ((int32(iRef) >= 0) && + ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iRef)*32)).FcolFlags) & COLFLAG_VIRTUAL) != 0)) && + (((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iRef)*32)).FzColl == uintptr(0)) || + (Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iRef)*32)).FzColl, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY))) == 0)) { + // Check to see if there are direct references to generated columns + // that are contained in the index. Pulling the generated column + // out of the index is an optimization only - the main table is always + // available if the index cannot be used. To avoid unnecessary + // complication, omit this optimization if the collating sequence for + // the column is non-standard + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).FiTabCol = int32(iRef) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{whereIndexExprTransColumn})) + } else { + continue + } + (*IdxExprTrans)(unsafe.Pointer(bp + 48 /* &x */)).FiIdxCol = iIdxCol + Xsqlite3WalkExpr(tls, bp /* &w */, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpWhere) + Xsqlite3WalkExprList(tls, bp /* &w */, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy) + Xsqlite3WalkExprList(tls, bp /* &w */, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet) + } +} + +// The pTruth expression is always true because it is the WHERE clause +// a partial index that is driving a query loop. Look through all of the +// WHERE clause terms on the query, and if any of those terms must be +// true because pTruth is true, then mark those WHERE clause terms as +// coded. +func whereApplyPartialIndexConstraints(tls *libc.TLS, pTruth uintptr, iTabCur int32, pWC uintptr) { /* sqlite3.c:146357:13: */ + var i int32 + var pTerm uintptr + for int32((*Expr)(unsafe.Pointer(pTruth)).Fop) == TK_AND { + whereApplyPartialIndexConstraints(tls, (*Expr)(unsafe.Pointer(pTruth)).FpLeft, iTabCur, pWC) + pTruth = (*Expr)(unsafe.Pointer(pTruth)).FpRight + } + i = 0 + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__1: + if !(i < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm) { + goto __3 + } + { + var pExpr uintptr + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_CODED) != 0 { + goto __2 + } + pExpr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if Xsqlite3ExprCompare(tls, uintptr(0), pExpr, pTruth, iTabCur) == 0 { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) + } + + } + goto __2 +__2: + i++ + pTerm += 56 + goto __1 + goto __3 +__3: +} + +// Generate code for the start of the iLevel-th loop in the WHERE clause +// implementation described by pWInfo. +func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWInfo uintptr, iLevel int32, pLevel uintptr, notReady Bitmask) Bitmask { /* sqlite3.c:146382:24: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + var j int32 + var k int32 // Loop counters + var iCur int32 // The VDBE cursor for the table + var addrNxt int32 // Where to jump to continue with the next IN case + var bRev int32 // True if we need to scan in reverse order + var pLoop uintptr // The WhereLoop object being coded + var pWC uintptr // Decomposition of the entire WHERE clause + var pTerm uintptr // A WHERE clause term + var db uintptr // Database connection + var pTabItem uintptr // FROM clause term being coded + var addrBrk int32 // Jump here to break out of the loop + var addrHalt int32 // addrBrk for the outermost loop + var addrCont int32 // Jump here to continue with next cycle + var iRowidReg int32 = 0 // Rowid is stored in this register, if not zero + var iReleaseReg int32 = 0 // Temp register to free before returning + var pIdx uintptr = uintptr(0) // Index used by loop (if any) + var iLoop int32 // Iteration of constraint generator loop + + pWC = (pWInfo + 104 /* &.sWC */) + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + pTabItem = (((*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112) + iCur = (*SrcItem)(unsafe.Pointer(pTabItem)).FiCursor + (*WhereLevel)(unsafe.Pointer(pLevel)).FnotReady = (notReady & ^Xsqlite3WhereGetMask(tls, (pWInfo+592 /* &.sMaskSet */), iCur)) + bRev = (int32(((*WhereInfo)(unsafe.Pointer(pWInfo)).FrevMask >> iLevel) & uint64(1))) + + // Create labels for the "break" and "continue" instructions + // for the current loop. Jump to addrBrk to break out of a loop. + // Jump to cont to go immediately to the next iteration of the + // loop. + // + // When there is an IN operator, we also have a "addrNxt" label that + // means to continue with the next IN value combination. When + // there are no IN operators in the constraints, the "addrNxt" label + // is the same as "addrBrk". + addrBrk = libc.AssignPtrInt32(pLevel+12 /* &.addrBrk */, libc.AssignPtrInt32(pLevel+16 /* &.addrNxt */, Xsqlite3VdbeMakeLabel(tls, pParse))) + addrCont = libc.AssignPtrInt32(pLevel+24 /* &.addrCont */, Xsqlite3VdbeMakeLabel(tls, pParse)) + + // If this is the right table of a LEFT OUTER JOIN, allocate and + // initialize a memory cell that records if this table matches any + // row of the left table of the join. + + if (int32((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom) > 0) && ((int32((*SrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype) & JT_LEFT) != 0) { + (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) + + } + + // Compute a safe address to jump to if we discover that the table for + // this loop is empty and can never contribute content. + for j = iLevel; (j > 0) && ((*WhereLevel)(unsafe.Pointer((pWInfo+856 /* &.a */)+uintptr(j)*88)).FiLeftJoin == 0); j-- { + } + addrHalt = (*WhereLevel)(unsafe.Pointer((pWInfo + 856 /* &.a */) + uintptr(j)*88)).FaddrBrk + + // Special case of a FROM clause subquery implemented as a co-routine + if (uint32(int32(*(*uint16)(unsafe.Pointer(pTabItem + 60 /* &.fg */ + 4 /* &.viaCoroutine */)) & 0x10 >> 4))) != 0 { + var regYield int32 = (*SrcItem)(unsafe.Pointer(pTabItem)).FregReturn + Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regYield, 0, (*SrcItem)(unsafe.Pointer(pTabItem)).FaddrFillSub) + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2 = Xsqlite3VdbeAddOp2(tls, v, OP_Yield, regYield, addrBrk) + + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Goto) + } else if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_VIRTUALTABLE)) != U32(0) { + // Case 1: The table is a virtual-table. Use the VFilter and VNext + // to access the data. + var iReg int32 // P3 Value for OP_VFilter + var addrNotFound int32 + var nConstraint int32 = int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) + var iIn int32 // Counter for IN constraints + + iReg = Xsqlite3GetTempRange(tls, pParse, (nConstraint + 2)) + addrNotFound = (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk + for j = 0; j < nConstraint; j++ { + var iTarget int32 = ((iReg + j) + 2) + pTerm = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + if pTerm == uintptr(0) { + continue + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_IN) != 0 { + codeEqualityTerm(tls, pParse, pTerm, pLevel, j, bRev, iTarget) + addrNotFound = (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt + } else { + var pRight uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + codeExprOrVector(tls, pParse, pRight, iTarget, 1) + } + } + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), iReg) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, nConstraint, (iReg + 1)) + Xsqlite3VdbeAddOp4(tls, v, OP_VFilter, iCur, addrNotFound, iReg, + *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)), + func() int32 { + if *(*U8)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) != 0 { + return -7 + } + return -1 + }()) + + *(*U8)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) = U8(0) + // An OOM inside of AddOp4(OP_VFilter) instruction above might have freed + // the u.vtab.idxStr. NULL it out to prevent a use-after-free + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)) = uintptr(0) + } + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = func() uint8 { + if (*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass != 0 { + return uint8(OP_Noop) + } + return uint8(OP_VNext) + }() + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2 = Xsqlite3VdbeCurrentAddr(tls, v) + iIn = *(*int32)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ /* &.nIn */)) + for j = (nConstraint - 1); j >= 0; j-- { + pTerm = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_IN) != 0 { + iIn-- + } + if (j < 16) && (((int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.vtab */) + 6 /* &.omitMask */))) >> j) & 1) != 0) { + disableTerm(tls, pLevel, pTerm) + } else if ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_IN) != 0) && + (Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft) == 1) { + var pCompare uintptr // The comparison operator + var pRight uintptr // RHS of the comparison + var pOp uintptr // Opcode to access the value of the IN constraint + + // Reload the constraint value into reg[iReg+j+2]. The same value + // was loaded into the same register prior to the OP_VFilter, but + // the xFilter implementation might have changed the datatype or + // encoding of the value in the register, so it *must* be reloaded. + + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + + pOp = Xsqlite3VdbeGetOp(tls, v, *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pLevel + 56 /* &.u */ /* &.in */) + 8 /* &.aInLoop */)) + uintptr(iIn)*20 + 4 /* &.addrInTop */))) + + Xsqlite3VdbeAddOp3(tls, v, int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode), (*VdbeOp)(unsafe.Pointer(pOp)).Fp1, (*VdbeOp)(unsafe.Pointer(pOp)).Fp2, (*VdbeOp)(unsafe.Pointer(pOp)).Fp3) + } + + // Generate code that will continue to the next row if + // the IN constraint is not satisfied + pCompare = Xsqlite3PExpr(tls, pParse, TK_EQ, uintptr(0), uintptr(0)) + + if pCompare != 0 { + (*Expr)(unsafe.Pointer(pCompare)).FpLeft = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft + (*Expr)(unsafe.Pointer(pCompare)).FpRight = libc.AssignUintptr(&pRight, Xsqlite3Expr(tls, db, TK_REGISTER, uintptr(0))) + if pRight != 0 { + (*Expr)(unsafe.Pointer(pRight)).FiTable = ((iReg + j) + 2) + Xsqlite3ExprIfFalse(tls, + pParse, pCompare, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrCont, SQLITE_JUMPIFNULL) + } + (*Expr)(unsafe.Pointer(pCompare)).FpLeft = uintptr(0) + Xsqlite3ExprDelete(tls, db, pCompare) + } + } + } + + // These registers need to be preserved in case there is an IN operator + // loop. So we could deallocate the registers here (and potentially + // reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems + // simpler and safer to simply not reuse the registers. + // + // sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); + } else if (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IPK)) != U32(0)) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_COLUMN_IN | WHERE_COLUMN_EQ))) != U32(0)) { + // Case 2: We can directly reference a single row using an + // equality comparison against the ROWID field. Or + // we reference multiple rows using a "rowid IN (...)" + // construct. + + pTerm = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) + + iReleaseReg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + iRowidReg = codeEqualityTerm(tls, pParse, pTerm, pLevel, 0, bRev, iReleaseReg) + if iRowidReg != iReleaseReg { + Xsqlite3ReleaseTempReg(tls, pParse, iReleaseReg) + } + addrNxt = (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt + Xsqlite3VdbeAddOp3(tls, v, OP_SeekRowid, iCur, addrNxt, iRowidReg) + + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Noop) + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & (*WhereLevel)(unsafe.Pointer(pLevel)).FnotReady) == uint64(0) { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) + } + } else if (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IPK)) != U32(0)) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_COLUMN_RANGE)) != U32(0)) { + // Case 3: We have an inequality comparison against the ROWID field. + var testOp int32 = OP_Noop + var start int32 + var memEndValue int32 = 0 + var pStart uintptr + var pEnd uintptr + + j = 0 + pStart = libc.AssignUintptr(&pEnd, uintptr(0)) + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { + pStart = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(libc.PostIncInt32(&j, 1))*8)) + } + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { + pEnd = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(libc.PostIncInt32(&j, 1))*8)) + } + + if bRev != 0 { + pTerm = pStart + pStart = pEnd + pEnd = pTerm + } + + if pStart != 0 { + var pX uintptr // The expression that defines the start bound + var r1 int32 + // var rTemp int32 at bp+12, 4 + // Registers for holding the start boundary + var op int32 // Cursor seek operation + + // The following constant maps TK_xx codes into corresponding + // seek opcodes. It depends on a particular ordering of TK_xx + *(*[4]U8)(unsafe.Pointer(bp + 8 /* aMoveOp */)) = [4]U8{ + /* TK_GT */ U8(OP_SeekGT), + /* TK_LE */ U8(OP_SeekLE), + /* TK_LT */ U8(OP_SeekLT), + /* TK_GE */ U8(OP_SeekGE), + } + // Make sure the ordering.. + // ... of the TK_xx values... + // ... is correcct. + + pX = (*WhereTerm)(unsafe.Pointer(pStart)).FpExpr + + // transitive constraints + if Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer(pX)).FpRight) != 0 { + r1 = libc.AssignPtrInt32(bp+12 /* rTemp */, Xsqlite3GetTempReg(tls, pParse)) + codeExprOrVector(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, r1, 1) + + op = int32(*(*U8)(unsafe.Pointer(bp + 8 /* &aMoveOp[0] */ + uintptr(((((int32((*Expr)(unsafe.Pointer(pX)).Fop) - TK_GT) - 1) & 0x3) | 0x1))))) + + } else { + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, bp+12 /* &rTemp */) + disableTerm(tls, pLevel, pStart) + op = int32(*(*U8)(unsafe.Pointer(bp + 8 /* &aMoveOp[0] */ + uintptr((int32((*Expr)(unsafe.Pointer(pX)).Fop) - TK_GT))))) + } + Xsqlite3VdbeAddOp3(tls, v, op, iCur, addrBrk, r1) + + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 12 /* rTemp */))) + } else { + Xsqlite3VdbeAddOp2(tls, v, func() int32 { + if bRev != 0 { + return OP_Last + } + return OP_Rewind + }(), iCur, addrHalt) + + } + if pEnd != 0 { + var pX uintptr + pX = (*WhereTerm)(unsafe.Pointer(pEnd)).FpExpr + + // Transitive constraints + + memEndValue = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + codeExprOrVector(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, memEndValue, 1) + if (0 == Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer(pX)).FpRight)) && + ((int32((*Expr)(unsafe.Pointer(pX)).Fop) == TK_LT) || (int32((*Expr)(unsafe.Pointer(pX)).Fop) == TK_GT)) { + if bRev != 0 { + testOp = OP_Le + } else { + testOp = OP_Ge + } + } else { + if bRev != 0 { + testOp = OP_Lt + } else { + testOp = OP_Gt + } + } + if 0 == Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer(pX)).FpRight) { + disableTerm(tls, pLevel, pEnd) + } + } + start = Xsqlite3VdbeCurrentAddr(tls, v) + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = func() uint8 { + if bRev != 0 { + return uint8(OP_Prev) + } + return uint8(OP_Next) + }() + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2 = start + + if testOp != OP_Noop { + iRowidReg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iCur, iRowidReg) + Xsqlite3VdbeAddOp3(tls, v, testOp, memEndValue, addrBrk, iRowidReg) + + Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) + } + } else if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_INDEXED)) != 0 { + var nEq U16 = *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) // Number of == or IN terms + var nBtm U16 = *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)) // Length of BTM vector + var nTop U16 = *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) // Length of TOP vector + var regBase int32 // Base register holding constraint values + var pRangeStart uintptr = uintptr(0) // Inequality constraint at range start + var pRangeEnd uintptr = uintptr(0) // Inequality constraint at range end + var startEq int32 // True if range start uses ==, >= or <= + var endEq int32 // True if range end uses ==, >= or <= + var start_constraints int32 // Start of range is constrained + var nConstraint int32 // Number of constraint terms + var iIdxCur int32 // The VDBE cursor for the index + var nExtraReg int32 = 0 // Number of extra registers needed + var op int32 // Instruction opcode + // var zStartAff uintptr at bp+16, 8 + // Affinity for start of range constraint + var zEndAff uintptr = uintptr(0) // Affinity for end of range constraint + var bSeekPastNull U8 = U8(0) // True to seek past initial nulls + var bStopAtNull U8 = U8(0) // Add condition to terminate at NULLs + var omitTable int32 // True if we use the index only + var regBignull int32 = 0 // big-null flag register + var addrSeekScan int32 = 0 // Opcode of the OP_SeekScan, if any + + pIdx = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + iIdxCur = (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + + // Find any inequality constraint terms for the start and end + // of the range. + j = int32(nEq) + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { + pRangeStart = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(libc.PostIncInt32(&j, 1))*8)) + nExtraReg = func() int32 { + if (nExtraReg) > (int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)))) { + return nExtraReg + } + return int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))) + }() + // Like optimization range constraints always occur in pairs + + } + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { + pRangeEnd = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(libc.PostIncInt32(&j, 1))*8)) + nExtraReg = func() int32 { + if (nExtraReg) > (int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)))) { + return nExtraReg + } + return int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))) + }() + if pRangeStart == uintptr(0) { + j = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(nEq)*2))) + if ((j >= 0) && (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol+uintptr(j)*32)).FnotNull) == 0)) || (j == (-2)) { + bSeekPastNull = U8(1) + } + } + } + + // If the WHERE_BIGNULL_SORT flag is set, then index column nEq uses + // a non-default "big-null" sort (either ASC NULLS LAST or DESC NULLS + // FIRST). In both cases separate ordered scans are made of those + // index entries for which the column is null and for those for which + // it is not. For an ASC sort, the non-NULL entries are scanned first. + // For DESC, NULL entries are scanned first. + if (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_TOP_LIMIT | WHERE_BTM_LIMIT))) == U32(0)) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BIGNULL_SORT)) != U32(0)) { + + nExtraReg = 1 + bSeekPastNull = U8(1) + (*WhereLevel)(unsafe.Pointer(pLevel)).FregBignull = libc.AssignInt32(®Bignull, libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1)) + if (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regBignull) + } + (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBignull = Xsqlite3VdbeMakeLabel(tls, pParse) + } + + // If we are doing a reverse order scan on an ascending index, or + // a forward order scan on a descending index, interchange the + // start and end terms (pRangeStart and pRangeEnd). + if (int32(nEq) < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn)) && (bRev == (libc.Bool32(int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(nEq)))) == SQLITE_SO_ASC))) { + { + var t uintptr = pRangeEnd + pRangeEnd = pRangeStart + pRangeStart = t + } + + { + var t U8 = bSeekPastNull + bSeekPastNull = bStopAtNull + bStopAtNull = t + } + + { + var t U8 = U8(nBtm) + nBtm = nTop + nTop = U16(t) + } + + } + + if (iLevel > 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_SEEKSCAN)) != U32(0)) { + // In case OP_SeekScan is used, ensure that the index cursor does not + // point to a valid row for the first iteration of this loop. + Xsqlite3VdbeAddOp1(tls, v, OP_NullRow, iIdxCur) + } + + // Generate code to evaluate all constraint terms using == or IN + // and store the values of those terms in an array of registers + // starting at regBase. + + regBase = codeAllEqualityTerms(tls, pParse, pLevel, bRev, nExtraReg, bp+16 /* &zStartAff */) + + if (*(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) != 0) && (nTop != 0) { + zEndAff = Xsqlite3DbStrDup(tls, db, (*(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) + uintptr(nEq))) + } + addrNxt = func() int32 { + if regBignull != 0 { + return (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBignull + } + return (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt + }() + + startEq = (libc.Bool32(!(pRangeStart != 0) || ((int32((*WhereTerm)(unsafe.Pointer(pRangeStart)).FeOperator) & ((int32(WO_EQ) << (TK_LE - TK_EQ)) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) != 0))) + endEq = (libc.Bool32(!(pRangeEnd != 0) || ((int32((*WhereTerm)(unsafe.Pointer(pRangeEnd)).FeOperator) & ((int32(WO_EQ) << (TK_LE - TK_EQ)) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) != 0))) + start_constraints = (libc.Bool32((pRangeStart != 0) || (int32(nEq) > 0))) + + // Seek the index cursor to the start of the range. + nConstraint = int32(nEq) + if pRangeStart != 0 { + var pRight uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pRangeStart)).FpExpr)).FpRight + codeExprOrVector(tls, pParse, pRight, (regBase + int32(nEq)), int32(nBtm)) + + if ((int32((*WhereTerm)(unsafe.Pointer(pRangeStart)).FwtFlags) & TERM_VNULL) == 0) && + (Xsqlite3ExprCanBeNull(tls, pRight) != 0) { + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (regBase + int32(nEq)), addrNxt) + + } + if *(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) != 0 { + updateRangeAffinityStr(tls, pRight, int32(nBtm), (*(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) + uintptr(nEq))) + } + nConstraint = nConstraint + (int32(nBtm)) + + if Xsqlite3ExprIsVector(tls, pRight) == 0 { + disableTerm(tls, pLevel, pRangeStart) + } else { + startEq = 1 + } + bSeekPastNull = U8(0) + } else if bSeekPastNull != 0 { + startEq = 0 + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regBase + int32(nEq))) + start_constraints = 1 + nConstraint++ + } else if regBignull != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regBase + int32(nEq))) + start_constraints = 1 + nConstraint++ + } + codeApplyAffinity(tls, pParse, regBase, (nConstraint - int32(bSeekPastNull)), *(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */))) + if (int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip) > 0) && (nConstraint == int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip)) { + // The skip-scan logic inside the call to codeAllEqualityConstraints() + // above has already left the cursor sitting on the correct row, + // so no further seeking is needed + } else { + if regBignull != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, regBignull) + + } + + op = int32(aStartOp[(((start_constraints << 2) + (startEq << 1)) + bRev)]) + + if (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_SEEKSCAN)) != U32(0)) && (op == OP_SeekGE) { + + // TUNING: The OP_SeekScan opcode seeks to reduce the number + // of expensive seek operations by replacing a single seek with + // 1 or more step operations. The question is, how many steps + // should we try before giving up and going with a seek. The cost + // of a seek is proportional to the logarithm of the of the number + // of entries in the tree, so basing the number of steps to try + // on the estimated number of rows in the btree seems like a good + // guess. + addrSeekScan = Xsqlite3VdbeAddOp1(tls, v, OP_SeekScan, + ((int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowLogEst))) + 9) / 10)) + + } + Xsqlite3VdbeAddOp4Int(tls, v, op, iIdxCur, addrNxt, regBase, nConstraint) + + if regBignull != 0 { + + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + op = int32(aStartOp[((((libc.Bool32(nConstraint > 1)) * 4) + 2) + bRev)]) + Xsqlite3VdbeAddOp4Int(tls, v, op, iIdxCur, addrNxt, regBase, + (nConstraint - startEq)) + + } + } + + // Load the value for the inequality constraint at the end of the + // range (if any). + nConstraint = int32(nEq) + if pRangeEnd != 0 { + var pRight uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pRangeEnd)).FpExpr)).FpRight + codeExprOrVector(tls, pParse, pRight, (regBase + int32(nEq)), int32(nTop)) + + if ((int32((*WhereTerm)(unsafe.Pointer(pRangeEnd)).FwtFlags) & TERM_VNULL) == 0) && + (Xsqlite3ExprCanBeNull(tls, pRight) != 0) { + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (regBase + int32(nEq)), addrNxt) + + } + if zEndAff != 0 { + updateRangeAffinityStr(tls, pRight, int32(nTop), zEndAff) + codeApplyAffinity(tls, pParse, (regBase + int32(nEq)), int32(nTop), zEndAff) + } else { + + } + nConstraint = nConstraint + (int32(nTop)) + + if Xsqlite3ExprIsVector(tls, pRight) == 0 { + disableTerm(tls, pLevel, pRangeEnd) + } else { + endEq = 1 + } + } else if bStopAtNull != 0 { + if regBignull == 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regBase + int32(nEq))) + endEq = 0 + } + nConstraint++ + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */))) + Xsqlite3DbFree(tls, db, zEndAff) + + // Top of the loop body + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2 = Xsqlite3VdbeCurrentAddr(tls, v) + + // Check if the index cursor is past the end of the range. + if nConstraint != 0 { + if regBignull != 0 { + // Except, skip the end-of-range check while doing the NULL-scan + Xsqlite3VdbeAddOp2(tls, v, OP_IfNot, regBignull, (Xsqlite3VdbeCurrentAddr(tls, v) + 3)) + + } + op = int32(aEndOp[((bRev * 2) + endEq)]) + Xsqlite3VdbeAddOp4Int(tls, v, op, iIdxCur, addrNxt, regBase, nConstraint) + + if addrSeekScan != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrSeekScan) + } + } + if regBignull != 0 { + // During a NULL-scan, check to see if we have reached the end of + // the NULLs + + Xsqlite3VdbeAddOp2(tls, v, OP_If, regBignull, (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + + op = int32(aEndOp[((bRev * 2) + int32(bSeekPastNull))]) + Xsqlite3VdbeAddOp4Int(tls, v, op, iIdxCur, addrNxt, regBase, + (nConstraint + int32(bSeekPastNull))) + + } + + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_EARLYOUT)) != U32(0) { + Xsqlite3VdbeAddOp3(tls, v, OP_SeekHit, iIdxCur, int32(nEq), int32(nEq)) + } + + // Seek the table cursor, if required + omitTable = (libc.Bool32((((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IDX_ONLY)) != U32(0)) && + ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_OR_SUBCLAUSE) == 0))) + if omitTable != 0 { + // pIdx is a covering index. No need to access the main table. + } else if ((*Table)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FpTable))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + codeDeferredSeek(tls, pWInfo, pIdx, iCur, iIdxCur) + } else if iCur != iIdxCur { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, (*Index)(unsafe.Pointer(pIdx)).FpTable) + iRowidReg = Xsqlite3GetTempRange(tls, pParse, int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + for j = 0; j < int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol); j++ { + k = int32(Xsqlite3TableColumnToIndex(tls, pIdx, *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(j)*2)))) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iIdxCur, k, (iRowidReg + j)) + } + Xsqlite3VdbeAddOp4Int(tls, v, OP_NotFound, iCur, addrCont, + iRowidReg, int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + } + + if (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin == 0 { + // If pIdx is an index on one or more expressions, then look through + // all the expressions in pWInfo and try to transform matching expressions + // into reference to index columns. Also attempt to translate references + // to virtual columns in the table into references to (stored) columns + // of the index. + // + // Do not do this for the RHS of a LEFT JOIN. This is because the + // expression may be evaluated after OP_NullRow has been executed on + // the cursor. In this case it is important to do the full evaluation, + // as the result of the expression may not be NULL, even if all table + // column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a + // + // Also, do not do this when processing one index an a multi-index + // OR clause, since the transformation will become invalid once we + // move forward to the next index. + // https://sqlite.org/src/info/4e8e4857d32d401f + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_OR_SUBCLAUSE) == 0 { + whereIndexExprTrans(tls, pIdx, iCur, iIdxCur, pWInfo) + } + + // If a partial index is driving the loop, try to eliminate WHERE clause + // terms from the query that must be true due to the WHERE clause of + // the partial index. + // + // 2019-11-02 ticket 623eff57e76d45f6: This optimization does not work + // for a LEFT JOIN. + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + whereApplyPartialIndexConstraints(tls, (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere, iCur, pWC) + } + } else { + + // The following assert() is not a requirement, merely an observation: + // The OR-optimization doesn't work for the right hand table of + // a LEFT JOIN: + + } + + // Record the instruction used to terminate the loop. + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_ONEROW)) != 0 { + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Noop) + } else if bRev != 0 { + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Prev) + } else { + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Next) + } + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iIdxCur + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp3 = func() uint8 { + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_UNQ_WANTED)) != U32(0) { + return uint8(1) + } + return uint8(0) + }() + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_CONSTRAINT)) == U32(0) { + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp5 = U8(SQLITE_STMTSTATUS_FULLSCAN_STEP) + } else { + + } + if omitTable != 0 { + pIdx = uintptr(0) + } + } else if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_MULTI_OR)) != 0 { + // Case 5: Two or more separately indexed terms connected by OR + // + // Example: + // + // CREATE TABLE t1(a,b,c,d); + // CREATE INDEX i1 ON t1(a); + // CREATE INDEX i2 ON t1(b); + // CREATE INDEX i3 ON t1(c); + // + // SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13) + // + // In the example, there are three indexed terms connected by OR. + // The top of the loop looks like this: + // + // Null 1 # Zero the rowset in reg 1 + // + // Then, for each indexed term, the following. The arguments to + // RowSetTest are such that the rowid of the current row is inserted + // into the RowSet. If it is already present, control skips the + // Gosub opcode and jumps straight to the code generated by WhereEnd(). + // + // sqlite3WhereBegin() + // RowSetTest # Insert rowid into rowset + // Gosub 2 A + // sqlite3WhereEnd() + // + // Following the above, code to terminate the loop. Label A, the target + // of the Gosub above, jumps to the instruction right after the Goto. + // + // Null 1 # Zero the rowset in reg 1 + // Goto B # The loop is finished. + // + // A: # Return data, whatever. + // + // Return 2 # Jump back to the Gosub + // + // B: + // + // Added 2014-05-26: If the table is a WITHOUT ROWID table, then + // use an ephemeral index instead of a RowSet to record the primary + // keys of the rows we have already seen. + // + var pOrWc uintptr // The OR-clause broken out into subterms + var pOrTab uintptr // Shortened table list or OR-clause generation + var pCov uintptr = uintptr(0) // Potential covering index (or NULL) + var iCovCur int32 = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) // Cursor used for index scans (if any) + + var regReturn int32 = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) // Register used with OP_Gosub + var regRowset int32 = 0 // Register for RowSet object + var regRowid int32 = 0 // Register holding rowid + var iLoopBody int32 = Xsqlite3VdbeMakeLabel(tls, pParse) // Start of loop body + var iRetInit int32 // Address of regReturn init + var untestedTerms int32 = 0 // Some terms not completely tested + var ii int32 // Loop counter + var pAndExpr uintptr = uintptr(0) // An ".. AND (...)" expression + var pTab uintptr = (*SrcItem)(unsafe.Pointer(pTabItem)).FpTab + + pTerm = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) + + pOrWc = (*(*uintptr)(unsafe.Pointer(pTerm + 32 /* &.u */)) /* &.wc */) + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Return) + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1 = regReturn + + // Set up a new SrcList in pOrTab containing the table being scanned + // by this loop in the a[0] slot and all notReady tables in a[1..] slots. + // This becomes the SrcList in the recursive call to sqlite3WhereBegin(). + if int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) > 1 { + var nNotReady int32 // The number of notReady tables + var origSrc uintptr // Original list of tables + nNotReady = ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - iLevel) - 1) + pOrTab = Xsqlite3DbMallocRaw(tls, db, (uint64(uint64(unsafe.Sizeof(SrcList{})) + (uint64(nNotReady) * uint64(unsafe.Sizeof(SrcItem{})))))) + if pOrTab == uintptr(0) { + return notReady + } + (*SrcList)(unsafe.Pointer(pOrTab)).FnAlloc = U32((U8(nNotReady + 1))) + (*SrcList)(unsafe.Pointer(pOrTab)).FnSrc = int32((*SrcList)(unsafe.Pointer(pOrTab)).FnAlloc) + libc.Xmemcpy(tls, pOrTab+8 /* &.a */, pTabItem, uint64(unsafe.Sizeof(SrcItem{}))) + origSrc = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */ + for k = 1; k <= nNotReady; k++ { + libc.Xmemcpy(tls, ((pOrTab + 8 /* &.a */) + uintptr(k)*112), (origSrc + uintptr((*WhereLevel)(unsafe.Pointer(pLevel+uintptr(k)*88)).FiFrom)*112), uint64(unsafe.Sizeof(SrcItem{}))) + } + } else { + pOrTab = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + } + + // Initialize the rowset register to contain NULL. An SQL NULL is + // equivalent to an empty rowset. Or, create an ephemeral index + // capable of holding primary keys in the case of a WITHOUT ROWID. + // + // Also initialize regReturn to contain the address of the instruction + // immediately following the OP_Return at the bottom of the loop. This + // is required in a few obscure LEFT JOIN cases where control jumps + // over the top of the loop into the body of it. In this case the + // correct response for the end-of-loop code (the OP_Return) is to + // fall through to the next instruction, just as an OP_Next does if + // called on an uninitialized cursor. + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_DUPLICATES_OK) == 0 { + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + regRowset = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regRowset) + } else { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, pTab) + regRowset = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, regRowset, int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol)) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pPk) + } + regRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + iRetInit = Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regReturn) + + // If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y + // Then for every term xN, evaluate as the subexpression: xN AND z + // That way, terms in y that are factored into the disjunction will + // be picked up by the recursive calls to sqlite3WhereBegin() below. + // + // Actually, each subexpression is converted to "xN AND w" where w is + // the "interesting" terms of z - terms that did not originate in the + // ON or USING clause of a LEFT JOIN, and terms that are usable as + // indices. + // + // This optimization also only applies if the (x1 OR x2 OR ...) term + // is not contained in the ON clause of a LEFT JOIN. + // See ticket http://www.sqlite.org/src/info/f2369304e4 + if (*WhereClause)(unsafe.Pointer(pWC)).FnTerm > 1 { + var iTerm int32 + for iTerm = 0; iTerm < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm; iTerm++ { + var pExpr uintptr = (*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iTerm)*56)).FpExpr + if ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iTerm)*56) == pTerm { + continue + } + + if (int32((*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa+uintptr(iTerm)*56)).FwtFlags) & (TERM_VIRTUAL | TERM_CODED)) != 0 { + continue + } + if (int32((*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa+uintptr(iTerm)*56)).FeOperator) & WO_ALL) == 0 { + continue + } + + pExpr = Xsqlite3ExprDup(tls, db, pExpr, 0) + pAndExpr = Xsqlite3ExprAnd(tls, pParse, pAndExpr, pExpr) + } + if pAndExpr != 0 { + // The extra 0x10000 bit on the opcode is masked off and does not + // become part of the new Expr.op. However, it does make the + // op==TK_AND comparison inside of sqlite3PExpr() false, and this + // prevents sqlite3PExpr() from applying the AND short-circuit + // optimization, which we do not want here. + pAndExpr = Xsqlite3PExpr(tls, pParse, (TK_AND | 0x10000), uintptr(0), pAndExpr) + } + } + + // Run a separate WHERE clause for each term of the OR clause. After + // eliminating duplicates from other WHERE clauses, the action for each + // sub-WHERE clause is to to invoke the main loop body as a subroutine. + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20098 /* "MULTI-INDEX OR" */, 0) + for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { + var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56) + if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { + var pSubWInfo uintptr // Info for single OR-term scan + var pOrExpr uintptr = (*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr // Current OR clause term + var pDelete uintptr // Local copy of OR clause term + var jmp1 int32 = 0 // Address of jump operation + // See TH3 vtab25.400 and ticket 614b25314c766238 + pDelete = libc.AssignUintptr(&pOrExpr, Xsqlite3ExprDup(tls, db, pOrExpr, 0)) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3ExprDelete(tls, db, pDelete) + continue + } + if pAndExpr != 0 { + (*Expr)(unsafe.Pointer(pAndExpr)).FpLeft = pOrExpr + pOrExpr = pAndExpr + } + // Loop through table entries that match term pOrTerm. + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20113 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + + pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), + uint16(WHERE_OR_SUBCLAUSE), iCovCur) + + if pSubWInfo != 0 { + var pSubLoop uintptr + var addrExplain int32 = Xsqlite3WhereExplainOneScan(tls, + pParse, pOrTab, (pSubWInfo + 856 /* &.a */), uint16(0)) + _ = addrExplain + _ = addrExplain + + // This is the sub-WHERE clause body. First skip over + // duplicate rows from prior sub-WHERE clauses, and record the + // rowid (or PRIMARY KEY) for the current row so that the same + // row will be skipped in subsequent sub-WHERE clauses. + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_DUPLICATES_OK) == 0 { + var iSet int32 = func() int32 { + if ii == ((*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm - 1) { + return -1 + } + return ii + }() + if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, -1, regRowid) + jmp1 = Xsqlite3VdbeAddOp4Int(tls, v, OP_RowSetTest, regRowset, 0, + regRowid, iSet) + + } else { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, pTab) + var nPk int32 = int32((*Index)(unsafe.Pointer(pPk)).FnKeyCol) + var iPk int32 + var r int32 + + // Read the PK into an array of temp registers. + r = Xsqlite3GetTempRange(tls, pParse, nPk) + for iPk = 0; iPk < nPk; iPk++ { + var iCol int32 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(iPk)*2))) + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab, iCur, iCol, (r + iPk)) + } + + // Check if the temp table already contains this key. If so, + // the row has already been included in the result set and + // can be ignored (by jumping past the Gosub below). Otherwise, + // insert the key into the temp table and proceed with processing + // the row. + // + // Use some of the same optimizations as OP_RowSetTest: If iSet + // is zero, assume that the key cannot already be present in + // the temp table. And if iSet is -1, assume that there is no + // need to insert the key into the temp table, as it will never + // be tested for. + if iSet != 0 { + jmp1 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, regRowset, 0, r, nPk) + + } + if iSet >= 0 { + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, r, nPk, regRowid) + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, regRowset, regRowid, + r, nPk) + if iSet != 0 { + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + } + } + + // Release the array of temp registers + Xsqlite3ReleaseTempRange(tls, pParse, r, nPk) + } + } + + // Invoke the main loop body as a subroutine + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, regReturn, iLoopBody) + + // Jump here (skipping the main loop body subroutine) if the + // current sub-WHERE row is a duplicate from prior sub-WHEREs. + if jmp1 != 0 { + Xsqlite3VdbeJumpHere(tls, v, jmp1) + } + + // The pSubWInfo->untestedTerms flag means that this OR term + // contained one or more AND term from a notReady table. The + // terms from the notReady table could not be tested and will + // need to be tested later. + if (uint32(int32(*(*uint8)(unsafe.Pointer(pSubWInfo + 68 /* &.untestedTerms */)) & 0x2 >> 1))) != 0 { + untestedTerms = 1 + } + + // If all of the OR-connected terms are optimized using the same + // index, and the index is opened using the same cursor number + // by each call to sqlite3WhereBegin() made by this loop, it may + // be possible to use that index as a covering index. + // + // If the call to sqlite3WhereBegin() above resulted in a scan that + // uses an index, and this is either the first OR-connected term + // processed or the index is the same as that used by all previous + // terms, set pCov to the candidate covering index. Otherwise, set + // pCov to NULL to indicate that no candidate covering index will + // be available. + pSubLoop = (*WhereLevel)(unsafe.Pointer((pSubWInfo + 856 /* &.a */))).FpWLoop + + if ((((*WhereLoop)(unsafe.Pointer(pSubLoop)).FwsFlags & U32(WHERE_INDEXED)) != U32(0)) && + ((ii == 0) || (*(*uintptr)(unsafe.Pointer((pSubLoop + 24 /* &.u */ /* &.btree */) + 8 /* &.pIndex */)) == pCov))) && + ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pSubLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */))) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)) { + + pCov = *(*uintptr)(unsafe.Pointer(pSubLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + } else { + pCov = uintptr(0) + } + if Xsqlite3WhereUsesDeferredSeek(tls, pSubWInfo) != 0 { + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.bDeferredSeek */, uint32(1), 0, 0x1) + } + + // Finish the loop through table entries that match term pOrTerm. + Xsqlite3WhereEnd(tls, pSubWInfo) + Xsqlite3VdbeExplainPop(tls, pParse) + } + Xsqlite3ExprDelete(tls, db, pDelete) + } + } + Xsqlite3VdbeExplainPop(tls, pParse) + *(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */)) = pCov + if pCov != 0 { + (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = iCovCur + } + if pAndExpr != 0 { + (*Expr)(unsafe.Pointer(pAndExpr)).FpLeft = uintptr(0) + Xsqlite3ExprDelete(tls, db, pAndExpr) + } + Xsqlite3VdbeChangeP1(tls, v, iRetInit, Xsqlite3VdbeCurrentAddr(tls, v)) + Xsqlite3VdbeGoto(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) + Xsqlite3VdbeResolveLabel(tls, v, iLoopBody) + + if int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) > 1 { + Xsqlite3DbFree(tls, db, pOrTab) + } + if !(untestedTerms != 0) { + disableTerm(tls, pLevel, pTerm) + } + } else { + + if (uint32(int32(*(*uint16)(unsafe.Pointer(pTabItem + 60 /* &.fg */ + 4 /* &.isRecursive */)) & 0x20 >> 5))) != 0 { + // Tables marked isRecursive have only a single row that is stored in + // a pseudo-cursor. No need to Rewind or Next such cursors. + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = U8(OP_Noop) + } else { + + (*WhereLevel)(unsafe.Pointer(pLevel)).Fop = aStep[bRev] + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1 = iCur + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2 = (1 + Xsqlite3VdbeAddOp2(tls, v, int32(aStart[bRev]), iCur, addrHalt)) + + (*WhereLevel)(unsafe.Pointer(pLevel)).Fp5 = U8(SQLITE_STMTSTATUS_FULLSCAN_STEP) + } + } + + // Insert code to test every subexpression that can be completely + // computed using the current set of tables. + // + // This loop may run between one and three times, depending on the + // constraints to be generated. The value of stack variable iLoop + // determines the constraints coded by each iteration, as follows: + // + // iLoop==1: Code only expressions that are entirely covered by pIdx. + // iLoop==2: Code remaining expressions that do not contain correlated + // sub-queries. + // iLoop==3: Code all remaining expressions. + // + // An effort is made to skip unnecessary iterations of the loop. + iLoop = func() int32 { + if pIdx != 0 { + return 1 + } + return 2 + }() + for ok := true; ok; ok = (iLoop > 0) { + var iNext int32 = 0 // Next value for iLoop + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa + j = (*WhereClause)(unsafe.Pointer(pWC)).FnTerm + __1: + if !(j > 0) { + goto __3 + } + { + var pE uintptr + var skipLikeAddr int32 = 0 + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & (TERM_VIRTUAL | TERM_CODED)) != 0 { + goto __2 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & (*WhereLevel)(unsafe.Pointer(pLevel)).FnotReady) != uint64(0) { + + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.untestedTerms */, uint32(1), 1, 0x2) + goto __2 + } + pE = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + + if ((int32((*SrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype) & JT_LEFT) != 0) && !(((*Expr)(unsafe.Pointer((pE))).Fflags & (U32(EP_FromJoin))) != U32(0)) { + goto __2 + } + + if (iLoop == 1) && !(Xsqlite3ExprCoveredByIndex(tls, pE, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, pIdx) != 0) { + iNext = 2 + goto __2 + } + if (iLoop < 3) && ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VARSELECT) != 0) { + if iNext == 0 { + iNext = 3 + } + goto __2 + } + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_LIKECOND) != 0 { + // If the TERM_LIKECOND flag is set, that means that the range search + // is sufficient to guarantee that the LIKE operator is true, so we + // can skip the call to the like(A,B) function. But this only works + // for strings. So do not skip the call to the function on the pass + // that compares BLOBs. + goto __2 + } + Xsqlite3ExprIfFalse(tls, pParse, pE, addrCont, SQLITE_JUMPIFNULL) + if skipLikeAddr != 0 { + Xsqlite3VdbeJumpHere(tls, v, skipLikeAddr) + } + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) + + } + goto __2 + __2: + j-- + pTerm += 56 + goto __1 + goto __3 + __3: + ; + iLoop = iNext + } + + // Insert code to test for implied constraints based on transitivity + // of the "==" operator. + // + // Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123" + // and we are coding the t1 loop and the t2 loop has not yet coded, + // then we cannot use the "t1.a=t2.b" constraint, but we can code + // the implied "t1.a=123" constraint. + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa + j = (*WhereClause)(unsafe.Pointer(pWC)).FnTerm +__4: + if !(j > 0) { + goto __6 + } + { + var pE uintptr + // var sEAlt Expr at bp+24, 72 + + var pAlt uintptr + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & (TERM_VIRTUAL | TERM_CODED)) != 0 { + goto __5 + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (WO_EQ | WO_IS)) == 0 { + goto __5 + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_EQUIV) == 0 { + goto __5 + } + if (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != iCur { + goto __5 + } + if (int32((*SrcItem)(unsafe.Pointer(pTabItem)).Ffg.Fjointype) & JT_LEFT) != 0 { + goto __5 + } + pE = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + + pAlt = Xsqlite3WhereFindTerm(tls, pWC, iCur, *(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)), notReady, + (uint32((WO_EQ | WO_IN) | WO_IS)), uintptr(0)) + if pAlt == uintptr(0) { + goto __5 + } + if (int32((*WhereTerm)(unsafe.Pointer(pAlt)).FwtFlags) & (TERM_CODED)) != 0 { + goto __5 + } + if (((int32((*WhereTerm)(unsafe.Pointer(pAlt)).FeOperator) & WO_IN) != 0) && + (((*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pAlt)).FpExpr)).Fflags & U32(EP_xIsSelect)) != 0)) && + ((*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pAlt)).FpExpr + 32 /* &.x */)))).FpEList)).FnExpr > 1) { + goto __5 + } + + *(*Expr)(unsafe.Pointer(bp + 24 /* sEAlt */)) = *(*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pAlt)).FpExpr)) + (*Expr)(unsafe.Pointer(bp + 24 /* &sEAlt */)).FpLeft = (*Expr)(unsafe.Pointer(pE)).FpLeft + Xsqlite3ExprIfFalse(tls, pParse, bp+24 /* &sEAlt */, addrCont, SQLITE_JUMPIFNULL) + *(*U16)(unsafe.Pointer(pAlt + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) + + } + goto __5 +__5: + j-- + pTerm += 56 + goto __4 + goto __6 +__6: + ; + + // For a LEFT OUTER JOIN, generate code that will record the fact that + // at least one row of the right table has matched the left table. + if (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrFirst = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) + + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa + j = 0 + __7: + if !(j < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm) { + goto __9 + } + { + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & (TERM_VIRTUAL | TERM_CODED)) != 0 { + goto __8 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & (*WhereLevel)(unsafe.Pointer(pLevel)).FnotReady) != uint64(0) { + + goto __8 + } + + Xsqlite3ExprIfFalse(tls, pParse, (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr, addrCont, SQLITE_JUMPIFNULL) + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) + + } + goto __8 + __8: + j++ + pTerm += 56 + goto __7 + goto __9 + __9: + } + + return (*WhereLevel)(unsafe.Pointer(pLevel)).FnotReady +} + +var aStartOp = [8]U8{ + U8(0), + U8(0), + U8(OP_Rewind), // 2: (!start_constraints && startEq && !bRev) + U8(OP_Last), // 3: (!start_constraints && startEq && bRev) + U8(OP_SeekGT), // 4: (start_constraints && !startEq && !bRev) + U8(OP_SeekLT), // 5: (start_constraints && !startEq && bRev) + U8(OP_SeekGE), // 6: (start_constraints && startEq && !bRev) + U8(OP_SeekLE), // 7: (start_constraints && startEq && bRev) +} /* sqlite3.c:146729:21 */ +var aEndOp = [4]U8{ + U8(OP_IdxGE), // 0: (end_constraints && !bRev && !endEq) + U8(OP_IdxGT), // 1: (end_constraints && !bRev && endEq) + U8(OP_IdxLE), // 2: (end_constraints && bRev && !endEq) + U8(OP_IdxLT), // 3: (end_constraints && bRev && endEq) +} /* sqlite3.c:146739:21 */ +var aStep = [2]U8{U8(OP_Next), U8(OP_Prev)} /* sqlite3.c:147420:21 */ +var aStart = [2]U8{U8(OP_Rewind), U8(OP_Last)} /* sqlite3.c:147421:21 */ + +// Deallocate all memory associated with a WhereOrInfo object. +func whereOrInfoDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:147629:13: */ + Xsqlite3WhereClauseClear(tls, (p /* &.wc */)) + Xsqlite3DbFree(tls, db, p) +} + +// Deallocate all memory associated with a WhereAndInfo object. +func whereAndInfoDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:147637:13: */ + Xsqlite3WhereClauseClear(tls, (p /* &.wc */)) + Xsqlite3DbFree(tls, db, p) +} + +// Add a single new WhereTerm entry to the WhereClause object pWC. +// The new WhereTerm object is constructed from Expr p and with wtFlags. +// The index in pWC->a[] of the new WhereTerm is returned on success. +// 0 is returned if the new WhereTerm could not be added due to a memory +// allocation error. The memory allocation failure will be recorded in +// the db->mallocFailed flag so that higher-level functions can detect it. +// +// This routine will increase the size of the pWC->a[] array as necessary. +// +// If the wtFlags argument includes TERM_DYNAMIC, then responsibility +// for freeing the expression p is assumed by the WhereClause object pWC. +// This is true even if this routine fails to allocate a new WhereTerm. +// +// WARNING: This routine might reallocate the space used to store +// WhereTerms. All pointers to WhereTerms should be invalidated after +// calling this routine. Such pointers may be reinitialized by referencing +// the pWC->a[] array. +func whereClauseInsert(tls *libc.TLS, pWC uintptr, p uintptr, wtFlags U16) int32 { /* sqlite3.c:147661:12: */ + var pTerm uintptr + var idx int32 + + if (*WhereClause)(unsafe.Pointer(pWC)).FnTerm >= (*WhereClause)(unsafe.Pointer(pWC)).FnSlot { + var pOld uintptr = (*WhereClause)(unsafe.Pointer(pWC)).Fa + var db uintptr = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb + (*WhereClause)(unsafe.Pointer(pWC)).Fa = Xsqlite3DbMallocRawNN(tls, db, (uint64((uint64(unsafe.Sizeof(WhereTerm{})) * uint64((*WhereClause)(unsafe.Pointer(pWC)).FnSlot)) * uint64(2)))) + if (*WhereClause)(unsafe.Pointer(pWC)).Fa == uintptr(0) { + if (int32(wtFlags) & TERM_DYNAMIC) != 0 { + Xsqlite3ExprDelete(tls, db, p) + } + (*WhereClause)(unsafe.Pointer(pWC)).Fa = pOld + return 0 + } + libc.Xmemcpy(tls, (*WhereClause)(unsafe.Pointer(pWC)).Fa, pOld, (uint64(unsafe.Sizeof(WhereTerm{})) * uint64((*WhereClause)(unsafe.Pointer(pWC)).FnTerm))) + if pOld != pWC+40 /* &.aStatic */ { + Xsqlite3DbFree(tls, db, pOld) + } + (*WhereClause)(unsafe.Pointer(pWC)).FnSlot = (int32(uint64(Xsqlite3DbMallocSize(tls, db, (*WhereClause)(unsafe.Pointer(pWC)).Fa)) / uint64(unsafe.Sizeof(WhereTerm{})))) + } + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(libc.AssignInt32(&idx, libc.PostIncInt32(&(*WhereClause)(unsafe.Pointer(pWC)).FnTerm, 1)))*56) + if (p != 0) && (((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_Unlikely))) != U32(0)) { + (*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb = (LogEst(int32(Xsqlite3LogEst(tls, uint64((*Expr)(unsafe.Pointer(p)).FiTable))) - 270)) + } else { + (*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb = int16(1) + } + (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr = Xsqlite3ExprSkipCollateAndLikely(tls, p) + (*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags = wtFlags + (*WhereTerm)(unsafe.Pointer(pTerm)).FpWC = pWC + (*WhereTerm)(unsafe.Pointer(pTerm)).FiParent = -1 + libc.Xmemset(tls, (pTerm + 20 /* &.eOperator */), 0, + (uint64(unsafe.Sizeof(WhereTerm{})) - (uint64((uintptr(0) + 20 /* &.eOperator */))))) + return idx +} + +// Return TRUE if the given operator is one of the operators that is +// allowed for an indexable WHERE clause term. The allowed operators are +// "=", "<", ">", "<=", ">=", "IN", "IS", and "IS NULL" +func allowedOp(tls *libc.TLS, op int32) int32 { /* sqlite3.c:147702:12: */ + + return (libc.Bool32((((op == TK_IN) || ((op >= TK_EQ) && (op <= TK_GE))) || (op == TK_ISNULL)) || (op == TK_IS))) +} + +// Commute a comparison operator. Expressions of the form "X op Y" +// are converted into "Y op X". +func exprCommute(tls *libc.TLS, pParse uintptr, pExpr uintptr) U16 { /* sqlite3.c:147714:12: */ + if ((int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == TK_VECTOR) || + (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpRight)).Fop) == TK_VECTOR)) || + (Xsqlite3BinaryCompareCollSeq(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, (*Expr)(unsafe.Pointer(pExpr)).FpRight) != Xsqlite3BinaryCompareCollSeq(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) { + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) ^= (U32(EP_Commuted)) + } + { + var t uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpRight + (*Expr)(unsafe.Pointer(pExpr)).FpRight = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + (*Expr)(unsafe.Pointer(pExpr)).FpLeft = t + } + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) >= TK_GT { + + (*Expr)(unsafe.Pointer(pExpr)).Fop = (U8(((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) - TK_GT) ^ 2) + TK_GT)) + } + return U16(0) +} + +// Translate from TK_xx operator to WO_xx bitmask. +func operatorMask(tls *libc.TLS, op int32) U16 { /* sqlite3.c:147737:12: */ + var c U16 + + if op == TK_IN { + c = U16(WO_IN) + } else if op == TK_ISNULL { + c = U16(WO_ISNULL) + } else if op == TK_IS { + c = U16(WO_IS) + } else { + + c = (U16(int32(WO_EQ) << (op - TK_EQ))) + } + + return c +} + +// Check to see if the given expression is a LIKE or GLOB operator that +// can be optimized using inequality constraints. Return TRUE if it is +// so and false if not. +// +// In order for the operator to be optimizible, the RHS must be a string +// literal that does not begin with a wildcard. The LHS must be a column +// that may only be NULL, a string, or a BLOB, never a number. (This means +// that virtual tables cannot participate in the LIKE optimization.) The +// collating sequence for the column on the LHS must be appropriate for +// the operator. +func isLikeOrGlob(tls *libc.TLS, pParse uintptr, pExpr uintptr, ppPrefix uintptr, pisComplete uintptr, pnoCase uintptr) int32 { /* sqlite3.c:147775:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var z uintptr = uintptr(0) // String on RHS of LIKE operator + var pRight uintptr + var pLeft uintptr // Right and left size of LIKE operator + var pList uintptr // List of operands to the LIKE operator + var c U8 // One character in z[] + var cnt int32 // Number of non-wildcard prefix characters + // var wc [4]U8 at bp, 4 + // Wildcard characters + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection + var pVal uintptr = uintptr(0) + var op int32 // Opcode of pRight + var rc int32 // Result code to return + + if !(Xsqlite3IsLikeFunction(tls, db, pExpr, pnoCase, bp /* wc */) != 0) { + return 0 + } + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + pLeft = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + 1*32)).FpExpr + + pRight = Xsqlite3ExprSkipCollate(tls, (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FpExpr) + op = int32((*Expr)(unsafe.Pointer(pRight)).Fop) + if (op == TK_VARIABLE) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableQPSG)) == uint64(0)) { + var pReprepare uintptr = (*Parse)(unsafe.Pointer(pParse)).FpReprepare + var iCol int32 = int32((*Expr)(unsafe.Pointer(pRight)).FiColumn) + pVal = Xsqlite3VdbeGetBoundValue(tls, pReprepare, iCol, uint8(SQLITE_AFF_BLOB)) + if (pVal != 0) && (Xsqlite3_value_type(tls, pVal) == SQLITE_TEXT) { + z = Xsqlite3_value_text(tls, pVal) + } + Xsqlite3VdbeSetVarmask(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, iCol) + + } else if op == TK_STRING { + z = *(*uintptr)(unsafe.Pointer(pRight + 8 /* &.u */)) + } + if z != 0 { + + // Count the number of prefix characters prior to the first wildcard + cnt = 0 + for ((((int32(libc.AssignUint8(&c, *(*U8)(unsafe.Pointer(z + uintptr(cnt)))))) != 0) && (int32(c) != int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */))))) && (int32(c) != int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */ + 1))))) && (int32(c) != int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */ + 2)))) { + cnt++ + if (int32(c) == int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */ + 3)))) && (int32(*(*U8)(unsafe.Pointer(z + uintptr(cnt)))) != 0) { + cnt++ + } + } + + // The optimization is possible only if (1) the pattern does not begin + // with a wildcard and if (2) the non-wildcard prefix does not end with + // an (illegal 0xff) character, or (3) the pattern does not consist of + // a single escape character. The second condition is necessary so + // that we can increment the prefix key to find an upper bound for the + // range search. The third is because the caller assumes that the pattern + // consists of at least one character after all escapes have been + // removed. + if ((cnt != 0) && (255 != int32(*(*U8)(unsafe.Pointer(z + uintptr((cnt - 1))))))) && ((cnt > 1) || (int32(*(*U8)(unsafe.Pointer(z))) != int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */ + 3))))) { + var pPrefix uintptr + + // A "complete" match if the pattern ends with "*" or "%" + *(*int32)(unsafe.Pointer(pisComplete)) = (libc.Bool32((int32(c) == int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */)))) && (int32(*(*U8)(unsafe.Pointer(z + uintptr((cnt + 1))))) == 0))) + + // Get the pattern prefix. Remove all escapes from the prefix. + pPrefix = Xsqlite3Expr(tls, db, TK_STRING, z) + if pPrefix != 0 { + var iFrom int32 + var iTo int32 + var zNew uintptr = *(*uintptr)(unsafe.Pointer(pPrefix + 8 /* &.u */)) + *(*int8)(unsafe.Pointer(zNew + uintptr(cnt))) = int8(0) + for iFrom = libc.AssignInt32(&iTo, 0); iFrom < cnt; iFrom++ { + if int32(*(*int8)(unsafe.Pointer(zNew + uintptr(iFrom)))) == int32(*(*U8)(unsafe.Pointer(bp /* &wc[0] */ + 3))) { + iFrom++ + } + *(*int8)(unsafe.Pointer(zNew + uintptr(libc.PostIncInt32(&iTo, 1)))) = *(*int8)(unsafe.Pointer(zNew + uintptr(iFrom))) + } + *(*int8)(unsafe.Pointer(zNew + uintptr(iTo))) = int8(0) + + // If the LHS is not an ordinary column with TEXT affinity, then the + // pattern prefix boundaries (both the start and end boundaries) must + // not look like a number. Otherwise the pattern might be treated as + // a number, which will invalidate the LIKE optimization. + // + // Getting this right has been a persistent source of bugs in the + // LIKE optimization. See, for example: + // 2018-09-10 https://sqlite.org/src/info/c94369cae9b561b1 + // 2019-05-02 https://sqlite.org/src/info/b043a54c3de54b28 + // 2019-06-10 https://sqlite.org/src/info/fd76310a5e843e07 + // 2019-06-14 https://sqlite.org/src/info/ce8717f0885af975 + // 2019-09-03 https://sqlite.org/src/info/0f0428096f17252a + if ((int32((*Expr)(unsafe.Pointer(pLeft)).Fop) != TK_COLUMN) || + (int32(Xsqlite3ExprAffinity(tls, pLeft)) != SQLITE_AFF_TEXT)) || + ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)))).FnModuleArg != 0) { + var isNum int32 + // var rDummy float64 at bp+8, 8 + + isNum = Xsqlite3AtoF(tls, zNew, bp+8 /* &rDummy */, iTo, uint8(SQLITE_UTF8)) + if isNum <= 0 { + if (iTo == 1) && (int32(*(*int8)(unsafe.Pointer(zNew))) == '-') { + isNum = +1 + } else { + *(*int8)(unsafe.Pointer(zNew + uintptr((iTo - 1))))++ + isNum = Xsqlite3AtoF(tls, zNew, bp+8 /* &rDummy */, iTo, uint8(SQLITE_UTF8)) + *(*int8)(unsafe.Pointer(zNew + uintptr((iTo - 1))))-- + } + } + if isNum > 0 { + Xsqlite3ExprDelete(tls, db, pPrefix) + Xsqlite3ValueFree(tls, pVal) + return 0 + } + } + } + *(*uintptr)(unsafe.Pointer(ppPrefix)) = pPrefix + + // If the RHS pattern is a bound parameter, make arrangements to + // reprepare the statement when that parameter is rebound + if op == TK_VARIABLE { + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + Xsqlite3VdbeSetVarmask(tls, v, int32((*Expr)(unsafe.Pointer(pRight)).FiColumn)) + if (*(*int32)(unsafe.Pointer(pisComplete)) != 0) && (*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 8 /* &.u */)) + 1)) != 0) { + // If the rhs of the LIKE expression is a variable, and the current + // value of the variable means there is no need to invoke the LIKE + // function, then no OP_Variable will be added to the program. + // This causes problems for the sqlite3_bind_parameter_name() + // API. To work around them, add a dummy OP_Variable here. + var r1 int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3ExprCodeTarget(tls, pParse, pRight, r1) + Xsqlite3VdbeChangeP3(tls, v, (Xsqlite3VdbeCurrentAddr(tls, v) - 1), 0) + Xsqlite3ReleaseTempReg(tls, pParse, r1) + } + } + } else { + z = uintptr(0) + } + } + + rc = (libc.Bool32(z != uintptr(0))) + Xsqlite3ValueFree(tls, pVal) + return rc +} + +// Check to see if the pExpr expression is a form that needs to be passed +// to the xBestIndex method of virtual tables. Forms of interest include: +// +// Expression Virtual Table Operator +// ----------------------- --------------------------------- +// 1. column MATCH expr SQLITE_INDEX_CONSTRAINT_MATCH +// 2. column GLOB expr SQLITE_INDEX_CONSTRAINT_GLOB +// 3. column LIKE expr SQLITE_INDEX_CONSTRAINT_LIKE +// 4. column REGEXP expr SQLITE_INDEX_CONSTRAINT_REGEXP +// 5. column != expr SQLITE_INDEX_CONSTRAINT_NE +// 6. expr != column SQLITE_INDEX_CONSTRAINT_NE +// 7. column IS NOT expr SQLITE_INDEX_CONSTRAINT_ISNOT +// 8. expr IS NOT column SQLITE_INDEX_CONSTRAINT_ISNOT +// 9. column IS NOT NULL SQLITE_INDEX_CONSTRAINT_ISNOTNULL +// +// In every case, "column" must be a column of a virtual table. If there +// is a match, set *ppLeft to the "column" expression, set *ppRight to the +// "expr" expression (even though in forms (6) and (8) the column is on the +// right and the expression is on the left). Also set *peOp2 to the +// appropriate virtual table operator. The return value is 1 or 2 if there +// is a match. The usual return is 1, but if the RHS is also a column +// of virtual table in forms (5) or (7) then return 2. +// +// If the expression matches none of the patterns above, return 0. +func isAuxiliaryVtabOperator(tls *libc.TLS, db uintptr, pExpr uintptr, peOp2 uintptr, ppLeft uintptr, ppRight uintptr) int32 { /* sqlite3.c:147947:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_FUNCTION { + var pList uintptr + var pCol uintptr // Column reference + var i int32 + + pList = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + if (pList == uintptr(0)) || ((*ExprList)(unsafe.Pointer(pList)).FnExpr != 2) { + return 0 + } + + // Built-in operators MATCH, GLOB, LIKE, and REGEXP attach to a + // virtual table on their second argument, which is the same as + // the left-hand side operand in their in-fix form. + // + // vtab_column MATCH expression + // MATCH(expression,vtab_column) + pCol = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + 1*32)).FpExpr + + if ((int32((*Expr)(unsafe.Pointer((pCol))).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pCol + 64 /* &.y */)) != uintptr(0))) && ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCol + 64 /* &.y */)))).FnModuleArg != 0) { + for i = 0; i < (int32(uint64(unsafe.Sizeof(aOp)) / uint64(unsafe.Sizeof(Op2{})))); i++ { + if Xsqlite3StrICmp(tls, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), aOp[i].FzOp) == 0 { + *(*uint8)(unsafe.Pointer(peOp2)) = aOp[i].FeOp2 + *(*uintptr)(unsafe.Pointer(ppRight)) = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FpExpr + *(*uintptr)(unsafe.Pointer(ppLeft)) = pCol + return 1 + } + } + } + + // We can also match against the first column of overloaded + // functions where xFindFunction returns a value of at least + // SQLITE_INDEX_CONSTRAINT_FUNCTION. + // + // OVERLOADED(vtab_column,expression) + // + // Historically, xFindFunction expected to see lower-case function + // names. But for this use case, xFindFunction is expected to deal + // with function names in an arbitrary case. + pCol = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FpExpr + + if ((int32((*Expr)(unsafe.Pointer((pCol))).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pCol + 64 /* &.y */)) != uintptr(0))) && ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCol + 64 /* &.y */)))).FnModuleArg != 0) { + var pVtab uintptr + var pMod uintptr + // var xNotUsed uintptr at bp, 8 + + // var pNotUsed uintptr at bp+8, 8 + + pVtab = (*VTable)(unsafe.Pointer(Xsqlite3GetVTable(tls, db, *(*uintptr)(unsafe.Pointer(pCol + 64 /* &.y */))))).FpVtab + + pMod = (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + if (*Sqlite3_module)(unsafe.Pointer(pMod)).FxFindFunction != uintptr(0) { + i = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pMod + 144 /* &.xFindFunction */))))(tls, pVtab, 2, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)), bp /* &xNotUsed */, bp+8 /* &pNotUsed */) + if i >= SQLITE_INDEX_CONSTRAINT_FUNCTION { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(i) + *(*uintptr)(unsafe.Pointer(ppRight)) = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + 1*32)).FpExpr + *(*uintptr)(unsafe.Pointer(ppLeft)) = pCol + return 1 + } + } + } + } else if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NE) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_ISNOT)) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL) { + var res int32 = 0 + var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + var pRight uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpRight + + if ((int32((*Expr)(unsafe.Pointer((pLeft))).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)) != uintptr(0))) && ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pLeft + 64 /* &.y */)))).FnModuleArg != 0) { + res++ + } + + if (pRight != 0) && (((int32((*Expr)(unsafe.Pointer((pRight))).Fop) == TK_COLUMN) && (*(*uintptr)(unsafe.Pointer(pRight + 64 /* &.y */)) != uintptr(0))) && ((*Table)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRight + 64 /* &.y */)))).FnModuleArg != 0)) { + res++ + { + var t uintptr = pLeft + pLeft = pRight + pRight = t + } + + } + *(*uintptr)(unsafe.Pointer(ppLeft)) = pLeft + *(*uintptr)(unsafe.Pointer(ppRight)) = pRight + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NE { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(SQLITE_INDEX_CONSTRAINT_NE) + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_ISNOT { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(SQLITE_INDEX_CONSTRAINT_ISNOT) + } + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { + *(*uint8)(unsafe.Pointer(peOp2)) = uint8(SQLITE_INDEX_CONSTRAINT_ISNOTNULL) + } + return res + } + return 0 +} + +type Op2 = struct { + FzOp uintptr + FeOp2 uint8 + _ [7]byte +} /* sqlite3.c:147955:18 */ + +var aOp = [4]Op2{ + {FzOp: ts + 14629 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14102 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 13652 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20122 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, +} /* sqlite3.c:147958:7 */ + +// If the pBase expression originated in the ON or USING clause of +// a join, then transfer the appropriate markings over to derived. +func transferJoinMarkings(tls *libc.TLS, pDerived uintptr, pBase uintptr) { /* sqlite3.c:148052:13: */ + if pDerived != 0 { + *(*U32)(unsafe.Pointer(pDerived + 4 /* &.flags */)) |= ((*Expr)(unsafe.Pointer(pBase)).Fflags & U32(EP_FromJoin)) + (*Expr)(unsafe.Pointer(pDerived)).FiRightJoinTable = (*Expr)(unsafe.Pointer(pBase)).FiRightJoinTable + } +} + +// Mark term iChild as being a child of term iParent +func markTermAsChild(tls *libc.TLS, pWC uintptr, iChild int32, iParent int32) { /* sqlite3.c:148062:13: */ + (*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iChild)*56)).FiParent = iParent + (*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iChild)*56)).FtruthProb = (*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(iParent)*56)).FtruthProb + (*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa+uintptr(iParent)*56)).FnChild++ +} + +// Return the N-th AND-connected subterm of pTerm. Or if pTerm is not +// a conjunction, then return just pTerm when N==0. If N is exceeds +// the number of available subterms, return NULL. +func whereNthSubterm(tls *libc.TLS, pTerm uintptr, N int32) uintptr { /* sqlite3.c:148073:18: */ + if int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) != WO_AND { + if N == 0 { + return pTerm + } + return uintptr(0) + } + if N < (*WhereAndInfo)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTerm + 32 /* &.u */)))).Fwc.FnTerm { + return ((*WhereAndInfo)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTerm + 32 /* &.u */)))).Fwc.Fa + uintptr(N)*56) + } + return uintptr(0) +} + +// Subterms pOne and pTwo are contained within WHERE clause pWC. The +// two subterms are in disjunction - they are OR-ed together. +// +// If these two terms are both of the form: "A op B" with the same +// A and B values but different operators and if the operators are +// compatible (if one is = and the other is <, for example) then +// add a new virtual AND term to pWC that is the combination of the +// two. +// +// Some examples: +// +// x x<=y +// x=y OR x=y --> x=y +// x<=y OR x x<=y +// +// The following is NOT generated: +// +// xy --> x!=y +func whereCombineDisjuncts(tls *libc.TLS, pSrc uintptr, pWC uintptr, pOne uintptr, pTwo uintptr) { /* sqlite3.c:148103:13: */ + var eOp U16 = (U16(int32((*WhereTerm)(unsafe.Pointer(pOne)).FeOperator) | int32((*WhereTerm)(unsafe.Pointer(pTwo)).FeOperator))) + var db uintptr // Database connection (for malloc) + var pNew uintptr // New virtual expression + var op int32 // Operator for the combined expression + var idxNew int32 // Index in pWC of the next virtual term + + if ((int32((*WhereTerm)(unsafe.Pointer(pOne)).FwtFlags) | int32((*WhereTerm)(unsafe.Pointer(pTwo)).FwtFlags)) & TERM_VNULL) != 0 { + return + } + if (int32((*WhereTerm)(unsafe.Pointer(pOne)).FeOperator) & ((((WO_EQ | (int32(WO_EQ) << (TK_LT - TK_EQ))) | (int32(WO_EQ) << (TK_LE - TK_EQ))) | (int32(WO_EQ) << (TK_GT - TK_EQ))) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) == 0 { + return + } + if (int32((*WhereTerm)(unsafe.Pointer(pTwo)).FeOperator) & ((((WO_EQ | (int32(WO_EQ) << (TK_LT - TK_EQ))) | (int32(WO_EQ) << (TK_LE - TK_EQ))) | (int32(WO_EQ) << (TK_GT - TK_EQ))) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) == 0 { + return + } + if ((int32(eOp) & ((WO_EQ | (int32(WO_EQ) << (TK_LT - TK_EQ))) | (int32(WO_EQ) << (TK_LE - TK_EQ)))) != int32(eOp)) && + ((int32(eOp) & ((WO_EQ | (int32(WO_EQ) << (TK_GT - TK_EQ))) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) != int32(eOp)) { + return + } + + if Xsqlite3ExprCompare(tls, uintptr(0), (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOne)).FpExpr)).FpLeft, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTwo)).FpExpr)).FpLeft, -1) != 0 { + return + } + if Xsqlite3ExprCompare(tls, uintptr(0), (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOne)).FpExpr)).FpRight, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTwo)).FpExpr)).FpRight, -1) != 0 { + return + } + // If we reach this point, it means the two subterms can be combined + if (int32(eOp) & (int32(eOp) - 1)) != 0 { + if (int32(eOp) & ((int32(WO_EQ) << (TK_LT - TK_EQ)) | (int32(WO_EQ) << (TK_LE - TK_EQ)))) != 0 { + eOp = (U16(int32(WO_EQ) << (TK_LE - TK_EQ))) + } else { + + eOp = (U16(int32(WO_EQ) << (TK_GE - TK_EQ))) + } + } + db = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb + pNew = Xsqlite3ExprDup(tls, db, (*WhereTerm)(unsafe.Pointer(pOne)).FpExpr, 0) + if pNew == uintptr(0) { + return + } + for op = TK_EQ; int32(eOp) != (int32(WO_EQ) << (op - TK_EQ)); op++ { + } + (*Expr)(unsafe.Pointer(pNew)).Fop = U8(op) + idxNew = whereClauseInsert(tls, pWC, pNew, (uint16(TERM_VIRTUAL | TERM_DYNAMIC))) + exprAnalyze(tls, pSrc, pWC, idxNew) +} + +// Analyze a term that consists of two or more OR-connected +// subterms. So in: +// +// ... WHERE (a=5) AND (b=7 OR c=9 OR d=13) AND (d=13) +// ^^^^^^^^^^^^^^^^^^^^ +// +// This routine analyzes terms such as the middle term in the above example. +// A WhereOrTerm object is computed and attached to the term under +// analysis, regardless of the outcome of the analysis. Hence: +// +// WhereTerm.wtFlags |= TERM_ORINFO +// WhereTerm.u.pOrInfo = a dynamically allocated WhereOrTerm object +// +// The term being analyzed must have two or more of OR-connected subterms. +// A single subterm might be a set of AND-connected sub-subterms. +// Examples of terms under analysis: +// +// (A) t1.x=t2.y OR t1.x=t2.z OR t1.y=15 OR t1.z=t3.a+5 +// (B) x=expr1 OR expr2=x OR x=expr3 +// (C) t1.x=t2.y OR (t1.x=t2.z AND t1.y=15) +// (D) x=expr1 OR (y>11 AND y<22 AND z LIKE '*hello*') +// (E) (p.a=1 AND q.b=2 AND r.c=3) OR (p.x=4 AND q.y=5 AND r.z=6) +// (F) x>A OR (x=A AND y>=B) +// +// CASE 1: +// +// If all subterms are of the form T.C=expr for some single column of C and +// a single table T (as shown in example B above) then create a new virtual +// term that is an equivalent IN expression. In other words, if the term +// being analyzed is: +// +// x = expr1 OR expr2 = x OR x = expr3 +// +// then create a new virtual term like this: +// +// x IN (expr1,expr2,expr3) +// +// CASE 2: +// +// If there are exactly two disjuncts and one side has x>A and the other side +// has x=A (for the same x and A) then add a new virtual conjunct term to the +// WHERE clause of the form "x>=A". Example: +// +// x>A OR (x=A AND y>B) adds: x>=A +// +// The added conjunct can sometimes be helpful in query planning. +// +// CASE 3: +// +// If all subterms are indexable by a single table T, then set +// +// WhereTerm.eOperator = WO_OR +// WhereTerm.u.pOrInfo->indexable |= the cursor number for table T +// +// A subterm is "indexable" if it is of the form +// "T.C " where C is any column of table T and +// is one of "=", "<", "<=", ">", ">=", "IS NULL", or "IN". +// A subterm is also indexable if it is an AND of two or more +// subsubterms at least one of which is indexable. Indexable AND +// subterms have their eOperator set to WO_AND and they have +// u.pAndInfo set to a dynamically allocated WhereAndTerm object. +// +// From another point of view, "indexable" means that the subterm could +// potentially be used with an index if an appropriate index exists. +// This analysis does not consider whether or not the index exists; that +// is decided elsewhere. This analysis only looks at whether subterms +// appropriate for indexing exist. +// +// All examples A through E above satisfy case 3. But if a term +// also satisfies case 1 (such as B) we know that the optimizer will +// always prefer case 1, so in that case we pretend that case 3 is not +// satisfied. +// +// It might be the case that multiple tables are indexable. For example, +// (E) above is indexable on tables P, Q, and R. +// +// Terms that satisfy case 3 are candidates for lookup by using +// separate indices to find rowids for each subterm and composing +// the union of all rowids using a RowSet object. This is similar +// to "bitmap indices" in other database engines. +// +// OTHERWISE: +// +// If none of cases 1, 2, or 3 apply, then leave the eOperator set to +// zero. This term is not useful for search. +func exprAnalyzeOrTerm(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* sqlite3.c:148230:13: */ + var pWInfo uintptr = (*WhereClause)(unsafe.Pointer(pWC)).FpWInfo // WHERE clause processing context + var pParse uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse // Parser context + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection + var pTerm uintptr = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) // The term to be analyzed + var pExpr uintptr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr // The expression of the term + var i int32 // Loop counters + var pOrWc uintptr // Breakup of pTerm into subterms + var pOrTerm uintptr // A Sub-term within the pOrWc + var pOrInfo uintptr // Additional information associated with pTerm + var chngToIN Bitmask // Tables that might satisfy case 1 + var indexable Bitmask // Tables that are indexable, satisfying case 2 + + // Break the OR clause into its separate subterms. The subterms are + // stored in a WhereClause structure containing within the WhereOrInfo + // object that is attached to the original OR clause term. + + *(*uintptr)(unsafe.Pointer(pTerm + 32 /* &.u */)) = libc.AssignUintptr(&pOrInfo, Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(WhereOrInfo{})))) + if pOrInfo == uintptr(0) { + return + } + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_ORINFO)) + pOrWc = (pOrInfo /* &.wc */) + libc.Xmemset(tls, pOrWc+40 /* &.aStatic */, 0, uint64(unsafe.Sizeof([8]WhereTerm{}))) + Xsqlite3WhereClauseInit(tls, pOrWc, pWInfo) + Xsqlite3WhereSplit(tls, pOrWc, pExpr, uint8(TK_OR)) + Xsqlite3WhereExprAnalyze(tls, pSrc, pOrWc) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + + // Compute the set of tables that might satisfy cases 1 or 3. + indexable = libc.CplUint64(uint64(0)) + chngToIN = libc.CplUint64(uint64(0)) + i = ((*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm - 1) + pOrTerm = (*WhereClause)(unsafe.Pointer(pOrWc)).Fa +__1: + if !((i >= 0) && (indexable != 0)) { + goto __3 + } + { + if (int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_SINGLE) == 0 { + var pAndInfo uintptr + + chngToIN = uint64(0) + pAndInfo = Xsqlite3DbMallocRawNN(tls, db, uint64(unsafe.Sizeof(WhereAndInfo{}))) + if pAndInfo != 0 { + var pAndWC uintptr + var pAndTerm uintptr + var j int32 + var b Bitmask = uint64(0) + *(*uintptr)(unsafe.Pointer(pOrTerm + 32 /* &.u */)) = pAndInfo + *(*U16)(unsafe.Pointer(pOrTerm + 18 /* &.wtFlags */)) |= U16((TERM_ANDINFO)) + (*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator = U16(WO_AND) + pAndWC = (pAndInfo /* &.wc */) + libc.Xmemset(tls, pAndWC+40 /* &.aStatic */, 0, uint64(unsafe.Sizeof([8]WhereTerm{}))) + Xsqlite3WhereClauseInit(tls, pAndWC, (*WhereClause)(unsafe.Pointer(pWC)).FpWInfo) + Xsqlite3WhereSplit(tls, pAndWC, (*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr, uint8(TK_AND)) + Xsqlite3WhereExprAnalyze(tls, pSrc, pAndWC) + (*WhereClause)(unsafe.Pointer(pAndWC)).FpOuter = pWC + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + j = 0 + pAndTerm = (*WhereClause)(unsafe.Pointer(pAndWC)).Fa + __4: + if !(j < (*WhereClause)(unsafe.Pointer(pAndWC)).FnTerm) { + goto __6 + } + { + + if (allowedOp(tls, int32((*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pAndTerm)).FpExpr)).Fop)) != 0) || + (int32((*WhereTerm)(unsafe.Pointer(pAndTerm)).FeOperator) == WO_AUX) { + b = b | (Xsqlite3WhereGetMask(tls, (pWInfo + 592 /* &.sMaskSet */), (*WhereTerm)(unsafe.Pointer(pAndTerm)).FleftCursor)) + } + + } + goto __5 + __5: + j++ + pAndTerm += 56 + goto __4 + goto __6 + __6: + } + indexable = indexable & (b) + } + } else if (int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags) & TERM_COPIED) != 0 { + // Skip this term for now. We revisit it when we process the + // corresponding TERM_VIRTUAL term + } else { + var b Bitmask + b = Xsqlite3WhereGetMask(tls, (pWInfo + 592 /* &.sMaskSet */), (*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor) + if (int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags) & TERM_VIRTUAL) != 0 { + var pOther uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr((*WhereTerm)(unsafe.Pointer(pOrTerm)).FiParent)*56) + b = b | (Xsqlite3WhereGetMask(tls, (pWInfo + 592 /* &.sMaskSet */), (*WhereTerm)(unsafe.Pointer(pOther)).FleftCursor)) + } + indexable = indexable & (b) + if (int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_EQ) == 0 { + chngToIN = uint64(0) + } else { + chngToIN = chngToIN & (b) + } + } + + } + goto __2 +__2: + i-- + pOrTerm += 56 + goto __1 + goto __3 +__3: + ; + + // Record the set of tables that satisfy case 3. The set might be + // empty. + (*WhereOrInfo)(unsafe.Pointer(pOrInfo)).Findexable = indexable + if indexable != 0 { + (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(WO_OR) + (*WhereClause)(unsafe.Pointer(pWC)).FhasOr = U8(1) + } else { + (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(WO_OR) + } + + // For a two-way OR, attempt to implementation case 2. + if (indexable != 0) && ((*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm == 2) { + var iOne int32 = 0 + var pOne uintptr + for (libc.AssignUintptr(&pOne, whereNthSubterm(tls, ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa), libc.PostIncInt32(&iOne, 1)))) != uintptr(0) { + var iTwo int32 = 0 + var pTwo uintptr + for (libc.AssignUintptr(&pTwo, whereNthSubterm(tls, ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa+1*56), libc.PostIncInt32(&iTwo, 1)))) != uintptr(0) { + whereCombineDisjuncts(tls, pSrc, pWC, pOne, pTwo) + } + } + } + + // chngToIN holds a set of tables that *might* satisfy case 1. But + // we have to do some additional checking to see if case 1 really + // is satisfied. + // + // chngToIN will hold either 0, 1, or 2 bits. The 0-bit case means + // that there is no possibility of transforming the OR clause into an + // IN operator because one or more terms in the OR clause contain + // something other than == on a column in the single table. The 1-bit + // case means that every term of the OR clause is of the form + // "table.column=expr" for some single table. The one bit that is set + // will correspond to the common table. We still need to check to make + // sure the same column is used on all terms. The 2-bit case is when + // the all terms are of the form "table1.column=table2.column". It + // might be possible to form an IN operator with either table1.column + // or table2.column as the LHS if either is common to every term of + // the OR clause. + // + // Note that terms of the form "table.column1=table.column2" (the + // same table on both sizes of the ==) cannot be optimized. + if chngToIN != 0 { + var okToChngToIN int32 = 0 // True if the conversion to IN is valid + var iColumn int32 = -1 // Column index on lhs of IN operator + var iCursor int32 = -1 // Table cursor common to all terms + var j int32 = 0 // Loop counter + + // Search for a table and column that appears on one side or the + // other of the == operator in every subterm. That table and column + // will be recorded in iCursor and iColumn. There might not be any + // such table and column. Set okToChngToIN if an appropriate table + // and column is found but leave okToChngToIN false if not found. + for j = 0; (j < 2) && !(okToChngToIN != 0); j++ { + var pLeft uintptr = uintptr(0) + pOrTerm = (*WhereClause)(unsafe.Pointer(pOrWc)).Fa + i = ((*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm - 1) + __7: + if !(i >= 0) { + goto __9 + } + { + + *(*U16)(unsafe.Pointer(pOrTerm + 18 /* &.wtFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(TERM_OR_OK))) + if (*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCursor { + // This is the 2-bit case and we are on the second iteration and + // current term is from the first iteration. So skip this term. + + goto __8 + } + if (chngToIN & Xsqlite3WhereGetMask(tls, (pWInfo+592 /* &.sMaskSet */), + (*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor)) == uint64(0) { + // This term must be of the form t1.a==t2.b where t2 is in the + // chngToIN set but t1 is not. This term will be either preceded + // or follwed by an inverted copy (t2.b==t1.a). Skip this term + // and use its inversion. + + goto __8 + } + iColumn = *(*int32)(unsafe.Pointer(pOrTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) + iCursor = (*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor + pLeft = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft + goto __9 + + } + goto __8 + __8: + i-- + pOrTerm += 56 + goto __7 + goto __9 + __9: + ; + if i < 0 { + // No candidate table+column was found. This can only occur + // on the second iteration + + break + } + + // We have found a candidate table and column. Check to see if that + // table and column is common to every term in the OR clause + okToChngToIN = 1 + __10: + if !((i >= 0) && (okToChngToIN != 0)) { + goto __12 + } + { + + if (*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor != iCursor { + *(*U16)(unsafe.Pointer(pOrTerm + 18 /* &.wtFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(TERM_OR_OK))) + } else if (*(*int32)(unsafe.Pointer((pOrTerm + 32 /* &.u */ /* &.x */) /* &.leftColumn */)) != iColumn) || ((iColumn == (-2)) && + (Xsqlite3ExprCompare(tls, pParse, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft, pLeft, -1) != 0)) { + okToChngToIN = 0 + } else { + var affLeft int32 + var affRight int32 + // If the right-hand side is also a column, then the affinities + // of both right and left sides must be such that no type + // conversions are required on the right. (Ticket #2249) + affRight = int32(Xsqlite3ExprAffinity(tls, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpRight)) + affLeft = int32(Xsqlite3ExprAffinity(tls, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft)) + if (affRight != 0) && (affRight != affLeft) { + okToChngToIN = 0 + } else { + *(*U16)(unsafe.Pointer(pOrTerm + 18 /* &.wtFlags */)) |= U16((TERM_OR_OK)) + } + } + + } + goto __11 + __11: + i-- + pOrTerm += 56 + goto __10 + goto __12 + __12: + } + + // At this point, okToChngToIN is true if original pTerm satisfies + // case 1. In that case, construct a new virtual term that is + // pTerm converted into an IN operator. + if okToChngToIN != 0 { + var pDup uintptr // A transient duplicate expression + var pList uintptr = uintptr(0) // The RHS of the IN operator + var pLeft uintptr = uintptr(0) // The LHS of the IN operator + var pNew uintptr // The complete IN operator + + i = ((*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm - 1) + pOrTerm = (*WhereClause)(unsafe.Pointer(pOrWc)).Fa + __13: + if !(i >= 0) { + goto __15 + } + { + if (int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FwtFlags) & TERM_OR_OK) == 0 { + goto __14 + } + + pDup = Xsqlite3ExprDup(tls, db, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpRight, 0) + pList = Xsqlite3ExprListAppend(tls, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse, pList, pDup) + pLeft = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pOrTerm)).FpExpr)).FpLeft + + } + goto __14 + __14: + i-- + pOrTerm += 56 + goto __13 + goto __15 + __15: + ; + + pDup = Xsqlite3ExprDup(tls, db, pLeft, 0) + pNew = Xsqlite3PExpr(tls, pParse, TK_IN, pDup, uintptr(0)) + if pNew != 0 { + var idxNew int32 + transferJoinMarkings(tls, pNew, pExpr) + + *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList + idxNew = whereClauseInsert(tls, pWC, pNew, (uint16(TERM_VIRTUAL | TERM_DYNAMIC))) + + exprAnalyze(tls, pSrc, pWC, idxNew) + // pTerm = &pWC->a[idxTerm]; // would be needed if pTerm where reused + markTermAsChild(tls, pWC, idxNew, idxTerm) + } else { + Xsqlite3ExprListDelete(tls, db, pList) + } + } + } +} + +// We already know that pExpr is a binary operator where both operands are +// column references. This routine checks to see if pExpr is an equivalence +// relation: +// 1. The SQLITE_Transitive optimization must be enabled +// 2. Must be either an == or an IS operator +// 3. Not originating in the ON clause of an OUTER JOIN +// 4. The affinities of A and B must be compatible +// 5a. Both operands use the same collating sequence OR +// 5b. The overall collating sequence is BINARY +// If this routine returns TRUE, that means that the RHS can be substituted +// for the LHS anyplace else in the WHERE clause where the LHS column occurs. +// This is an optimization. No harm comes from returning 0. But if 1 is +// returned when it should not be, then incorrect answers might result. +func termIsEquivalence(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { /* sqlite3.c:148501:12: */ + var aff1 int8 + var aff2 int8 + var pColl uintptr + if !(((*Sqlite3)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb))).FdbOptFlags & (U32(SQLITE_Transitive))) == U32(0)) { + return 0 + } + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_EQ) && (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_IS) { + return 0 + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0) { + return 0 + } + aff1 = Xsqlite3ExprAffinity(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + aff2 = Xsqlite3ExprAffinity(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + if (int32(aff1) != int32(aff2)) && + (!((int32(aff1)) >= SQLITE_AFF_NUMERIC) || !((int32(aff2)) >= SQLITE_AFF_NUMERIC)) { + return 0 + } + pColl = Xsqlite3ExprCompareCollSeq(tls, pParse, pExpr) + if Xsqlite3IsBinary(tls, pColl) != 0 { + return 1 + } + return Xsqlite3ExprCollSeqMatch(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, (*Expr)(unsafe.Pointer(pExpr)).FpRight) +} + +// Recursively walk the expressions of a SELECT statement and generate +// a bitmask indicating which tables are used in that expression +// tree. +func exprSelectUsage(tls *libc.TLS, pMaskSet uintptr, pS uintptr) Bitmask { /* sqlite3.c:148524:16: */ + var mask Bitmask = uint64(0) + for pS != 0 { + var pSrc uintptr = (*Select)(unsafe.Pointer(pS)).FpSrc + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*Select)(unsafe.Pointer(pS)).FpEList)) + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*Select)(unsafe.Pointer(pS)).FpGroupBy)) + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*Select)(unsafe.Pointer(pS)).FpOrderBy)) + mask = mask | (Xsqlite3WhereExprUsage(tls, pMaskSet, (*Select)(unsafe.Pointer(pS)).FpWhere)) + mask = mask | (Xsqlite3WhereExprUsage(tls, pMaskSet, (*Select)(unsafe.Pointer(pS)).FpHaving)) + if pSrc != uintptr(0) { + var i int32 + for i = 0; i < (*SrcList)(unsafe.Pointer(pSrc)).FnSrc; i++ { + mask = mask | (exprSelectUsage(tls, pMaskSet, (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FpSelect)) + mask = mask | (Xsqlite3WhereExprUsage(tls, pMaskSet, (*SrcItem)(unsafe.Pointer((pSrc+8 /* &.a */)+uintptr(i)*112)).FpOn)) + if (uint32(int32(*(*uint16)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(i)*112 + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer((pSrc + 8 /* &.a */) + uintptr(i)*112 + 96 /* &.u1 */)))) + } + } + } + pS = (*Select)(unsafe.Pointer(pS)).FpPrior + } + return mask +} + +// Expression pExpr is one operand of a comparison operator that might +// be useful for indexing. This routine checks to see if pExpr appears +// in any index. Return TRUE (1) if pExpr is an indexed term and return +// FALSE (0) if not. If TRUE is returned, also set aiCurCol[0] to the cursor +// number of the table that is indexed and aiCurCol[1] to the column number +// of the column that is indexed, or XN_EXPR (-2) if an expression is being +// indexed. +// +// If pExpr is a TK_COLUMN column reference, then this routine always returns +// true even if that particular column is not indexed, because the column +// might be added to an automatic index later. +func exprMightBeIndexed2(tls *libc.TLS, pFrom uintptr, mPrereq Bitmask, aiCurCol uintptr, pExpr uintptr) int32 { /* sqlite3.c:148561:28: */ + var pIdx uintptr + var i int32 + var iCur int32 + i = 0 +__1: + if !(mPrereq > uint64(1)) { + goto __3 + } + { + } + goto __2 +__2: + i++ + mPrereq >>= 1 + goto __1 + goto __3 +__3: + ; + iCur = (*SrcItem)(unsafe.Pointer((pFrom + 8 /* &.a */) + uintptr(i)*112)).FiCursor + for pIdx = (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer((pFrom + 8 /* &.a */) + uintptr(i)*112)).FpTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + if (*Index)(unsafe.Pointer(pIdx)).FaColExpr == uintptr(0) { + continue + } + for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); i++ { + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) != (-2) { + continue + } + if Xsqlite3ExprCompareSkip(tls, pExpr, (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr+8 /* &.a */)+uintptr(i)*32)).FpExpr, iCur) == 0 { + *(*int32)(unsafe.Pointer(aiCurCol)) = iCur + *(*int32)(unsafe.Pointer(aiCurCol + 1*4)) = -2 + return 1 + } + } + } + return 0 +} + +func exprMightBeIndexed(tls *libc.TLS, pFrom uintptr, mPrereq Bitmask, aiCurCol uintptr, pExpr uintptr, op int32) int32 { /* sqlite3.c:148585:12: */ + // If this expression is a vector to the left or right of a + // inequality constraint (>, <, >= or <=), perform the processing + // on the first element of the vector. + + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_VECTOR) && ((op >= TK_GT) && (op <= TK_GE)) { + pExpr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */))).FpExpr + + } + + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN { + *(*int32)(unsafe.Pointer(aiCurCol)) = (*Expr)(unsafe.Pointer(pExpr)).FiTable + *(*int32)(unsafe.Pointer(aiCurCol + 1*4)) = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + return 1 + } + if mPrereq == uint64(0) { + return 0 + } // No table references + if (mPrereq & (mPrereq - uint64(1))) != uint64(0) { + return 0 + } // Refs more than one table + return exprMightBeIndexed2(tls, pFrom, mPrereq, aiCurCol, pExpr) +} + +// The input to this routine is an WhereTerm structure with only the +// "pExpr" field filled in. The job of this routine is to analyze the +// subexpression and populate all the other fields of the WhereTerm +// structure. +// +// If the expression is of the form " X" it gets commuted +// to the standard form of "X ". +// +// If the expression is of the form "X Y" where both X and Y are +// columns, then the original expression is unchanged and a new virtual +// term of the form "Y X" is added to the WHERE clause and +// analyzed separately. The original term is marked with TERM_COPIED +// and the new term is marked with TERM_DYNAMIC (because it's pExpr +// needs to be freed with the WhereClause) and TERM_VIRTUAL (because it +// is a commuted copy of a prior term.) The original term has nChild=1 +// and the copy has idxParent set to the index of the original term. +func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* sqlite3.c:148632:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pWInfo uintptr = (*WhereClause)(unsafe.Pointer(pWC)).FpWInfo // WHERE clause processing context + var pTerm uintptr // The term to be analyzed + var pMaskSet uintptr // Set of table index masks + var pExpr uintptr // The expression to be analyzed + var prereqLeft Bitmask // Prerequesites of the pExpr->pLeft + var prereqAll Bitmask // Prerequesites of pExpr + var extraRight Bitmask = uint64(0) // Extra dependencies on LEFT JOIN + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStr1 */)) = uintptr(0) // RHS of LIKE/GLOB operator + *(*int32)(unsafe.Pointer(bp + 16 /* isComplete */)) = 0 // RHS of LIKE/GLOB ends with wildcard + *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) = 0 // uppercase equivalent to lowercase + var op int32 // Top-level operator. pExpr->op + var pParse uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse // Parsing context + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection + *(*uint8)(unsafe.Pointer(bp + 24 /* eOp2 */)) = uint8(0) // op2 value for LIKE/REGEXP/GLOB + var nLeft int32 // Number of elements on left side vector + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return + } + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + pMaskSet = (pWInfo + 592 /* &.sMaskSet */) + pExpr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + + prereqLeft = Xsqlite3WhereExprUsage(tls, pMaskSet, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) + if op == TK_IN { + + if Xsqlite3ExprCheckIN(tls, pParse, pExpr) != 0 { + return + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = exprSelectUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + } else { + (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = Xsqlite3WhereExprListUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + } + } else if op == TK_ISNULL { + (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = uint64(0) + } else { + (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight = Xsqlite3WhereExprUsage(tls, pMaskSet, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + } + (*WhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect = 0 + prereqAll = Xsqlite3WhereExprUsageNN(tls, pMaskSet, pExpr) + if (*WhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect != 0 { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_VARSELECT)) + } + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0) { + var x Bitmask = Xsqlite3WhereGetMask(tls, pMaskSet, (*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable) + prereqAll = prereqAll | (x) + extraRight = (x - uint64(1)) // ON clause terms may not be used with an index + // on left table of a LEFT JOIN. Ticket #3015 + if (prereqAll >> 1) >= x { + Xsqlite3ErrorMsg(tls, pParse, ts+20129 /* "ON clause refere..." */, 0) + return + } + } + (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = prereqAll + (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = -1 + (*WhereTerm)(unsafe.Pointer(pTerm)).FiParent = -1 + (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) + if allowedOp(tls, op) != 0 { + // var aiCurCol [2]int32 at bp, 8 + + var pLeft uintptr = Xsqlite3ExprSkipCollate(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) + var pRight uintptr = Xsqlite3ExprSkipCollate(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) + var opMask U16 + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & prereqLeft) == uint64(0) { + opMask = uint16(WO_ALL) + } else { + opMask = uint16(WO_EQUIV) + } + + if *(*int32)(unsafe.Pointer((pTerm + 32 /* &.u */ /* &.x */) + 4 /* &.iField */)) > 0 { + + pLeft = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pLeft + 32 /* &.x */)) + 8 /* &.a */) + uintptr((*(*int32)(unsafe.Pointer((pTerm + 32 /* &.u */ /* &.x */) + 4 /* &.iField */))-1))*32)).FpExpr + } + + if exprMightBeIndexed(tls, pSrc, prereqLeft, bp /* &aiCurCol[0] */, pLeft, op) != 0 { + (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor = *(*int32)(unsafe.Pointer(bp /* &aiCurCol[0] */)) + *(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) = *(*int32)(unsafe.Pointer(bp /* &aiCurCol[0] */ + 1*4)) + (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = (U16(int32(operatorMask(tls, op)) & int32(opMask))) + } + if op == TK_IS { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_IS)) + } + if ((pRight != 0) && + (exprMightBeIndexed(tls, pSrc, (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight, bp /* &aiCurCol[0] */, pRight, op) != 0)) && + !(((*Expr)(unsafe.Pointer((pRight))).Fflags & (U32(EP_FixedCol))) != U32(0)) { + var pNew uintptr + var pDup uintptr + var eExtraOp U16 = U16(0) // Extra bits for pNew->eOperator + + if (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor >= 0 { + var idxNew int32 + pDup = Xsqlite3ExprDup(tls, db, pExpr, 0) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3ExprDelete(tls, db, pDup) + return + } + idxNew = whereClauseInsert(tls, pWC, pDup, (uint16(TERM_VIRTUAL | TERM_DYNAMIC))) + if idxNew == 0 { + return + } + pNew = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew)*56) + markTermAsChild(tls, pWC, idxNew, idxTerm) + if op == TK_IS { + *(*U16)(unsafe.Pointer(pNew + 18 /* &.wtFlags */)) |= U16((TERM_IS)) + } + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_COPIED)) + + if termIsEquivalence(tls, pParse, pDup) != 0 { + *(*U16)(unsafe.Pointer(pTerm + 20 /* &.eOperator */)) |= U16((WO_EQUIV)) + eExtraOp = U16(WO_EQUIV) + } + } else { + pDup = pExpr + pNew = pTerm + } + *(*U16)(unsafe.Pointer(pNew + 18 /* &.wtFlags */)) |= U16((int32(exprCommute(tls, pParse, pDup)))) + (*WhereTerm)(unsafe.Pointer(pNew)).FleftCursor = *(*int32)(unsafe.Pointer(bp /* &aiCurCol[0] */)) + *(*int32)(unsafe.Pointer(pNew + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) = *(*int32)(unsafe.Pointer(bp /* &aiCurCol[0] */ + 1*4)) + + (*WhereTerm)(unsafe.Pointer(pNew)).FprereqRight = (prereqLeft | extraRight) + (*WhereTerm)(unsafe.Pointer(pNew)).FprereqAll = prereqAll + (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) + } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5776 /* "false" */ + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) + (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) + (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) + } + } else if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_BETWEEN) && (int32((*WhereClause)(unsafe.Pointer(pWC)).Fop) == TK_AND) { + var pList uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + var i int32 + + for i = 0; i < 2; i++ { + var pNewExpr uintptr + var idxNew int32 + pNewExpr = Xsqlite3PExpr(tls, pParse, int32(ops[i]), + Xsqlite3ExprDup(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, 0), + Xsqlite3ExprDup(tls, db, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr, 0)) + transferJoinMarkings(tls, pNewExpr, pExpr) + idxNew = whereClauseInsert(tls, pWC, pNewExpr, (uint16(TERM_VIRTUAL | TERM_DYNAMIC))) + + exprAnalyze(tls, pSrc, pWC, idxNew) + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + markTermAsChild(tls, pWC, idxNew, idxTerm) + } + } else if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_OR { + + exprAnalyzeOrTerm(tls, pSrc, pWC, idxTerm) + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + } else if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { + if ((int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == TK_COLUMN) && + (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).FiColumn) >= 0)) && + !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) { + var pNewExpr uintptr + var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft + var idxNew int32 + var pNewTerm uintptr + + pNewExpr = Xsqlite3PExpr(tls, pParse, TK_GT, + Xsqlite3ExprDup(tls, db, pLeft, 0), + Xsqlite3ExprAlloc(tls, db, TK_NULL, uintptr(0), 0)) + + idxNew = whereClauseInsert(tls, pWC, pNewExpr, + (uint16((TERM_VIRTUAL | TERM_DYNAMIC) | TERM_VNULL))) + if idxNew != 0 { + pNewTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew)*56) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FprereqRight = uint64(0) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FleftCursor = (*Expr)(unsafe.Pointer(pLeft)).FiTable + *(*int32)(unsafe.Pointer(pNewTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) = int32((*Expr)(unsafe.Pointer(pLeft)).FiColumn) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FeOperator = (U16(int32(WO_EQ) << (TK_GT - TK_EQ))) + markTermAsChild(tls, pWC, idxNew, idxTerm) + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_COPIED)) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FprereqAll = (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll + } + } + } else if ((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_FUNCTION) && + (int32((*WhereClause)(unsafe.Pointer(pWC)).Fop) == TK_AND)) && + (isLikeOrGlob(tls, pParse, pExpr, bp+8 /* &pStr1 */, bp+16 /* &isComplete */, bp+20 /* &noCase */) != 0) { + var pLeft uintptr // LHS of LIKE/GLOB operator + var pStr2 uintptr // Copy of pStr1 - RHS of LIKE/GLOB operator + var pNewExpr1 uintptr + var pNewExpr2 uintptr + var idxNew1 int32 + var idxNew2 int32 + var zCollSeqName uintptr // Name of collating sequence + var wtFlags U16 = (U16((TERM_LIKEOPT | TERM_VIRTUAL) | TERM_DYNAMIC)) + + pLeft = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) + 8 /* &.a */) + 1*32)).FpExpr + pStr2 = Xsqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStr1 */)), 0) + + // Convert the lower bound to upper-case and the upper bound to + // lower-case (upper-case is less than lower-case in ASCII) so that + // the range constraints also work for BLOBs + if (*(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0) && !(int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed) != 0) { + var i int32 + var c int8 + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_LIKE)) + for i = 0; (int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pStr1 */)) + 8 /* &.u */)) + uintptr(i)))))) != 0; i++ { + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pStr1 */)) + 8 /* &.u */)) + uintptr(i))) = (int8((int32(c)) & ^(int32(Xsqlite3CtypeMap[uint8(c)]) & 0x20))) + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pStr2 + 8 /* &.u */)) + uintptr(i))) = int8(Xsqlite3UpperToLower[uint8(c)]) + } + } + + if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + var c U8 + var pC uintptr // Last character before the first wildcard + pC = (*(*uintptr)(unsafe.Pointer(pStr2 + 8 /* &.u */)) + uintptr((Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(pStr2 + 8 /* &.u */))) - 1))) + c = *(*U8)(unsafe.Pointer(pC)) + if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { + // The point is to increment the last character before the first + // wildcard. But if we increment '@', that will push it into the + // alphabetic range where case conversions will mess up the + // inequality. To avoid this, make sure to also run the full + // LIKE on all candidate expressions by clearing the isComplete flag + if int32(c) == ('A' - 1) { + *(*int32)(unsafe.Pointer(bp + 16 /* isComplete */)) = 0 + } + c = Xsqlite3UpperToLower[c] + } + *(*U8)(unsafe.Pointer(pC)) = (U8(int32(c) + 1)) + } + zCollSeqName = func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { + return ts + 20170 /* "NOCASE" */ + } + return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + }() + pNewExpr1 = Xsqlite3ExprDup(tls, db, pLeft, 0) + pNewExpr1 = Xsqlite3PExpr(tls, pParse, TK_GE, + Xsqlite3ExprAddCollateString(tls, pParse, pNewExpr1, zCollSeqName), + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStr1 */))) + transferJoinMarkings(tls, pNewExpr1, pExpr) + idxNew1 = whereClauseInsert(tls, pWC, pNewExpr1, wtFlags) + + exprAnalyze(tls, pSrc, pWC, idxNew1) + pNewExpr2 = Xsqlite3ExprDup(tls, db, pLeft, 0) + pNewExpr2 = Xsqlite3PExpr(tls, pParse, TK_LT, + Xsqlite3ExprAddCollateString(tls, pParse, pNewExpr2, zCollSeqName), + pStr2) + transferJoinMarkings(tls, pNewExpr2, pExpr) + idxNew2 = whereClauseInsert(tls, pWC, pNewExpr2, wtFlags) + + exprAnalyze(tls, pSrc, pWC, idxNew2) + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + if *(*int32)(unsafe.Pointer(bp + 16 /* isComplete */)) != 0 { + markTermAsChild(tls, pWC, idxNew1, idxTerm) + markTermAsChild(tls, pWC, idxNew2, idxTerm) + } + } + + // If there is a vector == or IS term - e.g. "(a, b) == (?, ?)" - create + // new terms for each component comparison - "a = ?" and "b = ?". The + // new terms completely replace the original vector comparison, which is + // no longer used. + // + // This is only required if at least one side of the comparison operation + // is not a sub-select. + if (((((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_EQ) || (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_IS)) && + ((libc.AssignInt32(&nLeft, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))) > 1)) && + (Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) == nLeft)) && + ((((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).Fflags & U32(EP_xIsSelect)) == U32(0)) || + (((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpRight)).Fflags & U32(EP_xIsSelect)) == U32(0)))) && + (int32((*WhereClause)(unsafe.Pointer(pWC)).Fop) == TK_AND) { + var i int32 + for i = 0; i < nLeft; i++ { + var idxNew int32 + var pNew uintptr + var pLeft uintptr = Xsqlite3ExprForVectorField(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, i) + var pRight uintptr = Xsqlite3ExprForVectorField(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, i) + + pNew = Xsqlite3PExpr(tls, pParse, int32((*Expr)(unsafe.Pointer(pExpr)).Fop), pLeft, pRight) + transferJoinMarkings(tls, pNew, pExpr) + idxNew = whereClauseInsert(tls, pWC, pNew, uint16(TERM_DYNAMIC)) + exprAnalyze(tls, pSrc, pWC, idxNew) + } + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED | TERM_VIRTUAL)) // Disable the original + (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) + } else if (((((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_IN) && + (*(*int32)(unsafe.Pointer((pTerm + 32 /* &.u */ /* &.x */) + 4 /* &.iField */)) == 0)) && + (int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).Fop) == TK_VECTOR)) && + ((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpPrior == uintptr(0))) && + ((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpWin == uintptr(0))) && + (int32((*WhereClause)(unsafe.Pointer(pWC)).Fop) == TK_AND) { + var i int32 + for i = 0; i < Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft); i++ { + var idxNew int32 + idxNew = whereClauseInsert(tls, pWC, pExpr, uint16(TERM_VIRTUAL)) + *(*int32)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew)*56 + 32 /* &.u */ /* &.x */ + 4 /* &.iField */)) = (i + 1) + exprAnalyze(tls, pSrc, pWC, idxNew) + markTermAsChild(tls, pWC, idxNew, idxTerm) + } + } else if int32((*WhereClause)(unsafe.Pointer(pWC)).Fop) == TK_AND { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pRight */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 32 /* pLeft */)) = uintptr(0) + var res int32 = isAuxiliaryVtabOperator(tls, db, pExpr, bp+24 /* &eOp2 */, bp+32 /* &pLeft */, bp+40 /* &pRight */) + for libc.PostDecInt32(&res, 1) > 0 { + var idxNew int32 + var pNewTerm uintptr + var prereqColumn Bitmask + var prereqExpr Bitmask + + prereqExpr = Xsqlite3WhereExprUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(bp + 40 /* pRight */))) + prereqColumn = Xsqlite3WhereExprUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(bp + 32 /* pLeft */))) + if (prereqExpr & prereqColumn) == uint64(0) { + var pNewExpr uintptr + pNewExpr = Xsqlite3PExpr(tls, pParse, TK_MATCH, + uintptr(0), Xsqlite3ExprDup(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40 /* pRight */)), 0)) + if (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) && (pNewExpr != 0) { + *(*U32)(unsafe.Pointer(pNewExpr + 4 /* &.flags */)) |= (U32(EP_FromJoin)) + (*Expr)(unsafe.Pointer(pNewExpr)).FiRightJoinTable = (*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable + } + idxNew = whereClauseInsert(tls, pWC, pNewExpr, (uint16(TERM_VIRTUAL | TERM_DYNAMIC))) + + pNewTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxNew)*56) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FprereqRight = prereqExpr + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FleftCursor = (*Expr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* pLeft */)))).FiTable + *(*int32)(unsafe.Pointer(pNewTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) = int32((*Expr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* pLeft */)))).FiColumn) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FeOperator = U16(WO_AUX) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FeMatchOp = *(*uint8)(unsafe.Pointer(bp + 24 /* eOp2 */)) + markTermAsChild(tls, pWC, idxNew, idxTerm) + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_COPIED)) + (*WhereTerm)(unsafe.Pointer(pNewTerm)).FprereqAll = (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll + } + { + var t uintptr = *(*uintptr)(unsafe.Pointer(bp + 32 /* pLeft */)) + *(*uintptr)(unsafe.Pointer(bp + 32 /* pLeft */)) = *(*uintptr)(unsafe.Pointer(bp + 40 /* pRight */)) + *(*uintptr)(unsafe.Pointer(bp + 40 /* pRight */)) = t + } + + } + } + + // Prevent ON clause terms of a LEFT JOIN from being used to drive + // an index for tables to the left of the join. + + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(idxTerm)*56) + *(*Bitmask)(unsafe.Pointer(pTerm + 40 /* &.prereqRight */)) |= (extraRight) +} + +var ops = [2]U8{U8(TK_GE), U8(TK_LE)} /* sqlite3.c:148776:21 */ + +// ************************************************************************** +// +// Routines with file scope above. Interface to the rest of the where.c +// subsystem follows. +// + +// This routine identifies subexpressions in the WHERE clause where +// each subexpression is separated by the AND operator or some other +// operator specified in the op parameter. The WhereClause structure +// is filled with pointers to subexpressions. For example: +// +// WHERE a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22) +// \________/ \_______________/ \________________/ +// slot[0] slot[1] slot[2] +// +// The original WHERE clause in pExpr is unaltered. All this routine +// does is make slot[] entries point to substructure within pExpr. +// +// In the previous sentence and in the diagram, "slot[]" refers to +// the WhereClause.a[] array. The slot[] array grows as needed to contain +// all terms of the WHERE clause. +func Xsqlite3WhereSplit(tls *libc.TLS, pWC uintptr, pExpr uintptr, op U8) { /* sqlite3.c:149062:21: */ + var pE2 uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, pExpr) + (*WhereClause)(unsafe.Pointer(pWC)).Fop = op + + if pE2 == uintptr(0) { + return + } + if int32((*Expr)(unsafe.Pointer(pE2)).Fop) != int32(op) { + whereClauseInsert(tls, pWC, pExpr, uint16(0)) + } else { + Xsqlite3WhereSplit(tls, pWC, (*Expr)(unsafe.Pointer(pE2)).FpLeft, op) + Xsqlite3WhereSplit(tls, pWC, (*Expr)(unsafe.Pointer(pE2)).FpRight, op) + } +} + +// Initialize a preallocated WhereClause structure. +func Xsqlite3WhereClauseInit(tls *libc.TLS, pWC uintptr, pWInfo uintptr) { /* sqlite3.c:149078:21: */ + (*WhereClause)(unsafe.Pointer(pWC)).FpWInfo = pWInfo + (*WhereClause)(unsafe.Pointer(pWC)).FhasOr = U8(0) + (*WhereClause)(unsafe.Pointer(pWC)).FpOuter = uintptr(0) + (*WhereClause)(unsafe.Pointer(pWC)).FnTerm = 0 + (*WhereClause)(unsafe.Pointer(pWC)).FnSlot = (int32(uint64(unsafe.Sizeof([8]WhereTerm{})) / uint64(unsafe.Sizeof(WhereTerm{})))) + (*WhereClause)(unsafe.Pointer(pWC)).Fa = pWC + 40 /* &.aStatic */ +} + +// Deallocate a WhereClause structure. The WhereClause structure +// itself is not freed. This routine is the inverse of +// sqlite3WhereClauseInit(). +func Xsqlite3WhereClauseClear(tls *libc.TLS, pWC uintptr) { /* sqlite3.c:149095:21: */ + var i int32 + var a uintptr + var db uintptr = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb + i = ((*WhereClause)(unsafe.Pointer(pWC)).FnTerm - 1) + a = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__1: + if !(i >= 0) { + goto __3 + } + { + if (int32((*WhereTerm)(unsafe.Pointer(a)).FwtFlags) & TERM_DYNAMIC) != 0 { + Xsqlite3ExprDelete(tls, db, (*WhereTerm)(unsafe.Pointer(a)).FpExpr) + } + if (int32((*WhereTerm)(unsafe.Pointer(a)).FwtFlags) & TERM_ORINFO) != 0 { + whereOrInfoDelete(tls, db, *(*uintptr)(unsafe.Pointer(a + 32 /* &.u */))) + } else if (int32((*WhereTerm)(unsafe.Pointer(a)).FwtFlags) & TERM_ANDINFO) != 0 { + whereAndInfoDelete(tls, db, *(*uintptr)(unsafe.Pointer(a + 32 /* &.u */))) + } + + } + goto __2 +__2: + i-- + a += 56 + goto __1 + goto __3 +__3: + ; + if (*WhereClause)(unsafe.Pointer(pWC)).Fa != pWC+40 /* &.aStatic */ { + Xsqlite3DbFree(tls, db, (*WhereClause)(unsafe.Pointer(pWC)).Fa) + } +} + +// These routines walk (recursively) an expression tree and generate +// a bitmask indicating which tables are used in that expression +// tree. +func Xsqlite3WhereExprUsageNN(tls *libc.TLS, pMaskSet uintptr, p uintptr) Bitmask { /* sqlite3.c:149120:24: */ + var mask Bitmask + if (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_COLUMN) && !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_FixedCol))) != U32(0)) { + return Xsqlite3WhereGetMask(tls, pMaskSet, (*Expr)(unsafe.Pointer(p)).FiTable) + } else if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_TokenOnly | EP_Leaf))) != U32(0) { + + return uint64(0) + } + if int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_IF_NULL_ROW { + mask = Xsqlite3WhereGetMask(tls, pMaskSet, (*Expr)(unsafe.Pointer(p)).FiTable) + } else { + mask = uint64(0) + } + if (*Expr)(unsafe.Pointer(p)).FpLeft != 0 { + mask = mask | (Xsqlite3WhereExprUsageNN(tls, pMaskSet, (*Expr)(unsafe.Pointer(p)).FpLeft)) + } + if (*Expr)(unsafe.Pointer(p)).FpRight != 0 { + mask = mask | (Xsqlite3WhereExprUsageNN(tls, pMaskSet, (*Expr)(unsafe.Pointer(p)).FpRight)) + + } else if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + if ((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_VarSelect))) != U32(0) { + (*WhereMaskSet)(unsafe.Pointer(pMaskSet)).FbVarSelect = 1 + } + mask = mask | (exprSelectUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)))) + } else if *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) != 0 { + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)))) + } + if ((int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_FUNCTION) || (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_AGG_FUNCTION)) && (*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)) != 0) { + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FpPartition)) + mask = mask | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FpOrderBy)) + mask = mask | (Xsqlite3WhereExprUsage(tls, pMaskSet, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)))).FpFilter)) + } + return mask +} + +func Xsqlite3WhereExprUsage(tls *libc.TLS, pMaskSet uintptr, p uintptr) Bitmask { /* sqlite3.c:149148:24: */ + if p != 0 { + return Xsqlite3WhereExprUsageNN(tls, pMaskSet, p) + } + return uint64(0) +} + +func Xsqlite3WhereExprListUsage(tls *libc.TLS, pMaskSet uintptr, pList uintptr) Bitmask { /* sqlite3.c:149151:24: */ + var i int32 + var mask Bitmask = uint64(0) + if pList != 0 { + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + mask = mask | (Xsqlite3WhereExprUsage(tls, pMaskSet, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr)) + } + } + return mask +} + +// Call exprAnalyze on all terms in a WHERE clause. +// +// Note that exprAnalyze() might add new virtual terms onto the +// end of the WHERE clause. We do not want to analyze these new +// virtual terms, so start analyzing at the end and work forward +// so that the added virtual terms are never processed. +func Xsqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { /* sqlite3.c:149171:21: */ + var i int32 + for i = ((*WhereClause)(unsafe.Pointer(pWC)).FnTerm - 1); i >= 0; i-- { + exprAnalyze(tls, pTabList, pWC, i) + } +} + +// For table-valued-functions, transform the function arguments into +// new WHERE clause terms. +// +// Each function argument translates into an equality constraint against +// a HIDDEN column in the table. +func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC uintptr) { /* sqlite3.c:149188:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTab uintptr + var j int32 + var k int32 + var pArgs uintptr + var pColRef uintptr + var pTerm uintptr + if (int32(*(*uint16)(unsafe.Pointer((pItem + 60 /* &.fg */) + 4 /* &.isTabFunc */)) & 0x4 >> 2)) == 0 { + return + } + pTab = (*SrcItem)(unsafe.Pointer(pItem)).FpTab + + pArgs = *(*uintptr)(unsafe.Pointer(pItem + 96 /* &.u1 */)) + if pArgs == uintptr(0) { + return + } + for j = libc.AssignInt32(&k, 0); j < (*ExprList)(unsafe.Pointer(pArgs)).FnExpr; j++ { + var pRhs uintptr + for (k < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(k)*32)).FcolFlags) & COLFLAG_HIDDEN) == 0) { + k++ + } + if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { + Xsqlite3ErrorMsg(tls, pParse, ts+20177, /* "too many argumen..." */ + libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) + return + } + pColRef = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_COLUMN, uintptr(0), 0) + if pColRef == uintptr(0) { + return + } + (*Expr)(unsafe.Pointer(pColRef)).FiTable = (*SrcItem)(unsafe.Pointer(pItem)).FiCursor + (*Expr)(unsafe.Pointer(pColRef)).FiColumn = YnVar(libc.PostIncInt32(&k, 1)) + *(*uintptr)(unsafe.Pointer(pColRef + 64 /* &.y */)) = pTab + pRhs = Xsqlite3PExpr(tls, pParse, TK_UPLUS, + Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*ExprList_item)(unsafe.Pointer((pArgs+8 /* &.a */)+uintptr(j)*32)).FpExpr, 0), uintptr(0)) + pTerm = Xsqlite3PExpr(tls, pParse, TK_EQ, pColRef, pRhs) + if (int32((*SrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype) & JT_LEFT) != 0 { + Xsqlite3SetJoinExpr(tls, pTerm, (*SrcItem)(unsafe.Pointer(pItem)).FiCursor) + } + whereClauseInsert(tls, pWC, pTerm, uint16(TERM_DYNAMIC)) + } +} + +//************* End of whereexpr.c ****************************************** +//************* Begin file where.c ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This module contains C code that generates VDBE code used to process +// the WHERE clause of SQL statements. This module is responsible for +// generating the code that loops through a table looking for applicable +// rows. Indices are selected and used to speed the search when doing +// so is applicable. Because this module is responsible for selecting +// indices, you might also think of this module as the "query optimizer". +// #include "sqliteInt.h" +// #include "whereInt.h" + +// Extra information appended to the end of sqlite3_index_info but not +// visible to the xBestIndex function, at least not directly. The +// sqlite3_vtab_collation() interface knows how to reach it, however. +// +// This object is not an API and can be changed from one release to the +// next. As long as allocateIndexInfo() and sqlite3_vtab_collation() +// agree on the structure, all will be well. +type HiddenIndexInfo1 = struct { + FpWC uintptr + FpParse uintptr +} /* sqlite3.c:149258:9 */ + +//************* End of whereexpr.c ****************************************** +//************* Begin file where.c ****************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This module contains C code that generates VDBE code used to process +// the WHERE clause of SQL statements. This module is responsible for +// generating the code that loops through a table looking for applicable +// rows. Indices are selected and used to speed the search when doing +// so is applicable. Because this module is responsible for selecting +// indices, you might also think of this module as the "query optimizer". +// #include "sqliteInt.h" +// #include "whereInt.h" + +// Extra information appended to the end of sqlite3_index_info but not +// visible to the xBestIndex function, at least not directly. The +// sqlite3_vtab_collation() interface knows how to reach it, however. +// +// This object is not an API and can be changed from one release to the +// next. As long as allocateIndexInfo() and sqlite3_vtab_collation() +// agree on the structure, all will be well. +type HiddenIndexInfo = HiddenIndexInfo1 /* sqlite3.c:149258:32 */ + +// Return the estimated number of output rows from a WHERE clause +func Xsqlite3WhereOutputRowCount(tls *libc.TLS, pWInfo uintptr) LogEst { /* sqlite3.c:149270:23: */ + return (*WhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut +} + +// Return one of the WHERE_DISTINCT_xxxxx values to indicate how this +// WHERE clause returns outputs for DISTINCT processing. +func Xsqlite3WhereIsDistinct(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:149278:20: */ + return int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) +} + +// Return the number of ORDER BY terms that are satisfied by the +// WHERE clause. A return of 0 means that the output must be +// completely sorted. A return equal to the number of ORDER BY +// terms means that no sorting is needed at all. A return that +// is positive but less than the number of ORDER BY terms means that +// block sorting is required. +func Xsqlite3WhereIsOrdered(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:149290:20: */ + return int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) +} + +// In the ORDER BY LIMIT optimization, if the inner-most loop is known +// to emit rows in increasing order, and if the last row emitted by the +// inner-most loop did not fit within the sorter, then we can skip all +// subsequent rows for the current iteration of the inner loop (because they +// will not fit in the sorter either) and continue with the second inner +// loop - the loop immediately outside the inner-most. +// +// When a row does not fit in the sorter (because the sorter already +// holds LIMIT+OFFSET rows that are smaller), then a jump is made to the +// label returned by this function. +// +// If the ORDER BY LIMIT optimization applies, the jump destination should +// be the continuation for the second-inner-most loop. If the ORDER BY +// LIMIT optimization does not apply, then the jump destination should +// be the continuation for the inner-most loop. +// +// It is always safe for this routine to return the continuation of the +// inner-most loop, in the sense that a correct answer will result. +// Returning the continuation the second inner loop is an optimization +// that might make the code run a little faster, but should not change +// the final answer. +func Xsqlite3WhereOrderByLimitOptLabel(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:149317:20: */ + var pInner uintptr + if !((int32(*(*uint8)(unsafe.Pointer(pWInfo + 68 /* &.bOrderedInnerLoop */)) & 0x4 >> 2)) != 0) { + // The ORDER BY LIMIT optimization does not apply. Jump to the + // continuation of the inner-most loop. + return (*WhereInfo)(unsafe.Pointer(pWInfo)).FiContinue + } + pInner = ((pWInfo + 856 /* &.a */) + uintptr((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)-1))*88) + + return (*WhereLevel)(unsafe.Pointer(pInner)).FaddrNxt +} + +// While generating code for the min/max optimization, after handling +// the aggregate-step call to min() or max(), check to see if any +// additional looping is required. If the output order is such that +// we are certain that the correct answer has already been found, then +// code an OP_Goto to by pass subsequent processing. +// +// Any extra OP_Goto that is coded here is an optimization. The +// correct answer should be obtained regardless. This OP_Goto just +// makes the answer appear faster. +func Xsqlite3WhereMinMaxOptEarlyOut(tls *libc.TLS, v uintptr, pWInfo uintptr) { /* sqlite3.c:149340:21: */ + var pInner uintptr + var i int32 + if !((int32(*(*uint8)(unsafe.Pointer(pWInfo + 68 /* &.bOrderedInnerLoop */)) & 0x4 >> 2)) != 0) { + return + } + if int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == 0 { + return + } + for i = (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1); i >= 0; i-- { + pInner = ((pWInfo + 856 /* &.a */) + uintptr(i)*88) + if ((*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer(pInner)).FpWLoop)).FwsFlags & U32(WHERE_COLUMN_IN)) != U32(0) { + Xsqlite3VdbeGoto(tls, v, (*WhereLevel)(unsafe.Pointer(pInner)).FaddrNxt) + return + } + } + Xsqlite3VdbeGoto(tls, v, (*WhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) +} + +// Return the VDBE address or label to jump to in order to continue +// immediately with the next row of a WHERE clause. +func Xsqlite3WhereContinueLabel(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:149359:20: */ + + return (*WhereInfo)(unsafe.Pointer(pWInfo)).FiContinue +} + +// Return the VDBE address or label to jump to in order to break +// out of a WHERE loop. +func Xsqlite3WhereBreakLabel(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:149368:20: */ + return (*WhereInfo)(unsafe.Pointer(pWInfo)).FiBreak +} + +// Return ONEPASS_OFF (0) if an UPDATE or DELETE statement is unable to +// operate directly on the rowids returned by a WHERE clause. Return +// ONEPASS_SINGLE (1) if the statement can operation directly because only +// a single row is to be changed. Return ONEPASS_MULTI (2) if the one-pass +// optimization can be used on multiple +// +// If the ONEPASS optimization is used (if this routine returns true) +// then also write the indices of open cursors used by ONEPASS +// into aiCur[0] and aiCur[1]. iaCur[0] gets the cursor of the data +// table and iaCur[1] gets the cursor used by an auxiliary index. +// Either value may be -1, indicating that cursor is not used. +// Any cursors returned will have been opened for writing. +// +// aiCur[0] and aiCur[1] both get -1 if the where-clause logic is +// unable to use the ONEPASS optimization. +func Xsqlite3WhereOkOnePass(tls *libc.TLS, pWInfo uintptr, aiCur uintptr) int32 { /* sqlite3.c:149389:20: */ + libc.Xmemcpy(tls, aiCur, pWInfo+40 /* &.aiCurOnePass */, (uint64(unsafe.Sizeof(int32(0))) * uint64(2))) + return int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) +} + +// Return TRUE if the WHERE loop uses the OP_DeferredSeek opcode to move +// the data cursor to the row selected by the index cursor. +func Xsqlite3WhereUsesDeferredSeek(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:149405:20: */ + return (int32(*(*uint8)(unsafe.Pointer(pWInfo + 68 /* &.bDeferredSeek */)) & 0x1 >> 0)) +} + +// Move the content of pSrc into pDest +func whereOrMove(tls *libc.TLS, pDest uintptr, pSrc uintptr) { /* sqlite3.c:149412:13: */ + (*WhereOrSet)(unsafe.Pointer(pDest)).Fn = (*WhereOrSet)(unsafe.Pointer(pSrc)).Fn + libc.Xmemcpy(tls, pDest+8 /* &.a */, pSrc+8 /* &.a */, (uint64((*WhereOrSet)(unsafe.Pointer(pDest)).Fn) * uint64(unsafe.Sizeof(WhereOrCost{})))) +} + +// Try to insert a new prerequisite/cost entry into the WhereOrSet pSet. +// +// The new entry might overwrite an existing entry, or it might be +// appended, or it might be discarded. Do whatever is the right thing +// so that pSet keeps the N_OR_COST best entries seen so far. +func whereOrInsert(tls *libc.TLS, pSet uintptr, prereq Bitmask, rRun LogEst, nOut LogEst) int32 { /* sqlite3.c:149424:12: */ + var i U16 + var p uintptr + i = (*WhereOrSet)(unsafe.Pointer(pSet)).Fn + p = pSet + 8 /* &.a */ +__1: + if !(int32(i) > 0) { + goto __3 + } + if !((int32(rRun) <= int32((*WhereOrCost)(unsafe.Pointer(p)).FrRun)) && ((prereq & (*WhereOrCost)(unsafe.Pointer(p)).Fprereq) == prereq)) { + goto __4 + } + goto whereOrInsert_done +__4: + ; + if !((int32((*WhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun)) && (((*WhereOrCost)(unsafe.Pointer(p)).Fprereq & prereq) == (*WhereOrCost)(unsafe.Pointer(p)).Fprereq)) { + goto __5 + } + return 0 +__5: + ; + goto __2 +__2: + i-- + p += 16 + goto __1 + goto __3 +__3: + ; + if !(int32((*WhereOrSet)(unsafe.Pointer(pSet)).Fn) < N_OR_COST) { + goto __6 + } + p = ((pSet + 8 /* &.a */) + uintptr(libc.PostIncUint16(&(*WhereOrSet)(unsafe.Pointer(pSet)).Fn, 1))*16) + (*WhereOrCost)(unsafe.Pointer(p)).FnOut = nOut + goto __7 +__6: + p = pSet + 8 /* &.a */ + i = U16(1) +__8: + if !(int32(i) < int32((*WhereOrSet)(unsafe.Pointer(pSet)).Fn)) { + goto __10 + } + if !(int32((*WhereOrCost)(unsafe.Pointer(p)).FrRun) > int32((*WhereOrCost)(unsafe.Pointer((pSet+8 /* &.a */)+uintptr(i)*16)).FrRun)) { + goto __11 + } + p = ((pSet + 8 /* &.a */) + uintptr(i)*16) +__11: + ; + goto __9 +__9: + i++ + goto __8 + goto __10 +__10: + ; + if !(int32((*WhereOrCost)(unsafe.Pointer(p)).FrRun) <= int32(rRun)) { + goto __12 + } + return 0 +__12: + ; +__7: + ; +whereOrInsert_done: + (*WhereOrCost)(unsafe.Pointer(p)).Fprereq = prereq + (*WhereOrCost)(unsafe.Pointer(p)).FrRun = rRun + if !(int32((*WhereOrCost)(unsafe.Pointer(p)).FnOut) > int32(nOut)) { + goto __13 + } + (*WhereOrCost)(unsafe.Pointer(p)).FnOut = nOut +__13: + ; + return 1 +} + +// Return the bitmask for the given cursor number. Return 0 if +// iCursor is not in the set. +func Xsqlite3WhereGetMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) Bitmask { /* sqlite3.c:149461:24: */ + var i int32 + + for i = 0; i < (*WhereMaskSet)(unsafe.Pointer(pMaskSet)).Fn; i++ { + if *(*int32)(unsafe.Pointer((pMaskSet + 8 /* &.ix */) + uintptr(i)*4)) == iCursor { + return (Bitmask((uint64(1))) << (i)) + } + } + return uint64(0) +} + +// Create a new mask for cursor iCursor. +// +// There is one cursor per table in the FROM clause. The number of +// tables in the FROM clause is limited by a test early in the +// sqlite3WhereBegin() routine. So we know that the pMaskSet->ix[] +// array will never overflow. +func createMask(tls *libc.TLS, pMaskSet uintptr, iCursor int32) { /* sqlite3.c:149480:13: */ + + *(*int32)(unsafe.Pointer((pMaskSet + 8 /* &.ix */) + uintptr(libc.PostIncInt32(&(*WhereMaskSet)(unsafe.Pointer(pMaskSet)).Fn, 1))*4)) = iCursor +} + +// If the right-hand branch of the expression is a TK_COLUMN, then return +// a pointer to the right-hand branch. Otherwise, return NULL. +func whereRightSubexprIsColumn(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:149489:13: */ + p = Xsqlite3ExprSkipCollateAndLikely(tls, (*Expr)(unsafe.Pointer(p)).FpRight) + if ((p != uintptr(0)) && (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_COLUMN)) && !(((*Expr)(unsafe.Pointer((p))).Fflags & (U32(EP_FixedCol))) != U32(0)) { + return p + } + return uintptr(0) +} + +// Advance to the next WhereTerm that matches according to the criteria +// established when the pScan object was initialized by whereScanInit(). +// Return NULL if there are no more matching WhereTerms. +func whereScanNext(tls *libc.TLS, pScan uintptr) uintptr { /* sqlite3.c:149502:18: */ + var iCur int32 // The cursor on the LHS of the term + var iColumn I16 // The column on the LHS of the term. -1 for IPK + var pX uintptr // An expression being tested + var pWC uintptr // Shorthand for pScan->pWC + var pTerm uintptr // The term being tested + var k int32 = (*WhereScan)(unsafe.Pointer(pScan)).Fk // Where to start scanning + + pWC = (*WhereScan)(unsafe.Pointer(pScan)).FpWC + for 1 != 0 { + iColumn = *(*I16)(unsafe.Pointer((pScan + 88 /* &.aiColumn */) + uintptr((int32((*WhereScan)(unsafe.Pointer(pScan)).FiEquiv)-1))*2)) + iCur = *(*int32)(unsafe.Pointer((pScan + 44 /* &.aiCur */) + uintptr((int32((*WhereScan)(unsafe.Pointer(pScan)).FiEquiv)-1))*4)) + + for ok := true; ok; ok = (pWC != uintptr(0)) { + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(k)*56) + __1: + if !(k < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm) { + goto __3 + } + { + if ((((*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor == iCur) && + (*(*int32)(unsafe.Pointer((pTerm + 32 /* &.u */ /* &.x */) /* &.leftColumn */)) == int32(iColumn))) && + ((int32(iColumn) != (-2)) || + (Xsqlite3ExprCompareSkip(tls, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft, + (*WhereScan)(unsafe.Pointer(pScan)).FpIdxExpr, iCur) == 0))) && + ((int32((*WhereScan)(unsafe.Pointer(pScan)).FiEquiv) <= 1) || !(((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_FromJoin))) != U32(0))) { + if (((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_EQUIV) != 0) && + (int32((*WhereScan)(unsafe.Pointer(pScan)).FnEquiv) < (int32(uint64(unsafe.Sizeof([11]int32{})) / uint64(unsafe.Sizeof(int32(0))))))) && + ((libc.AssignUintptr(&pX, whereRightSubexprIsColumn(tls, (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))) != uintptr(0)) { + var j int32 + for j = 0; j < int32((*WhereScan)(unsafe.Pointer(pScan)).FnEquiv); j++ { + if (*(*int32)(unsafe.Pointer((pScan + 44 /* &.aiCur */) + uintptr(j)*4)) == (*Expr)(unsafe.Pointer(pX)).FiTable) && + (int32(*(*I16)(unsafe.Pointer((pScan + 88 /* &.aiColumn */) + uintptr(j)*2))) == int32((*Expr)(unsafe.Pointer(pX)).FiColumn)) { + break + } + } + if j == int32((*WhereScan)(unsafe.Pointer(pScan)).FnEquiv) { + *(*int32)(unsafe.Pointer((pScan + 44 /* &.aiCur */) + uintptr(j)*4)) = (*Expr)(unsafe.Pointer(pX)).FiTable + *(*I16)(unsafe.Pointer((pScan + 88 /* &.aiColumn */) + uintptr(j)*2)) = (*Expr)(unsafe.Pointer(pX)).FiColumn + (*WhereScan)(unsafe.Pointer(pScan)).FnEquiv++ + } + } + if (U32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (*WhereScan)(unsafe.Pointer(pScan)).FopMask) != U32(0) { + // Verify the affinity and collating sequence match + if ((*WhereScan)(unsafe.Pointer(pScan)).FzCollName != 0) && ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_ISNULL) == 0) { + var pColl uintptr + var pParse uintptr = (*WhereInfo)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse + pX = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if !(Xsqlite3IndexAffinityOk(tls, pX, (*WhereScan)(unsafe.Pointer(pScan)).Fidxaff) != 0) { + goto __2 + } + + pColl = Xsqlite3ExprCompareCollSeq(tls, pParse, pX) + if pColl == uintptr(0) { + pColl = (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FpDfltColl + } + if Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pColl)).FzName, (*WhereScan)(unsafe.Pointer(pScan)).FzCollName) != 0 { + goto __2 + } + } + if ((((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (WO_EQ | WO_IS)) != 0) && + (int32((*Expr)(unsafe.Pointer((libc.AssignUintptr(&pX, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight)))).Fop) == TK_COLUMN)) && + ((*Expr)(unsafe.Pointer(pX)).FiTable == *(*int32)(unsafe.Pointer((pScan + 44 /* &.aiCur */))))) && + (int32((*Expr)(unsafe.Pointer(pX)).FiColumn) == int32(*(*I16)(unsafe.Pointer((pScan + 88 /* &.aiColumn */))))) { + + goto __2 + } + (*WhereScan)(unsafe.Pointer(pScan)).FpWC = pWC + (*WhereScan)(unsafe.Pointer(pScan)).Fk = (k + 1) + return pTerm + } + } + + } + goto __2 + __2: + k++ + pTerm += 56 + goto __1 + goto __3 + __3: + ; + pWC = (*WhereClause)(unsafe.Pointer(pWC)).FpOuter + k = 0 + } + if int32((*WhereScan)(unsafe.Pointer(pScan)).FiEquiv) >= int32((*WhereScan)(unsafe.Pointer(pScan)).FnEquiv) { + break + } + pWC = (*WhereScan)(unsafe.Pointer(pScan)).FpOrigWC + k = 0 + (*WhereScan)(unsafe.Pointer(pScan)).FiEquiv++ + } + return uintptr(0) +} + +// This is whereScanInit() for the case of an index on an expression. +// It is factored out into a separate tail-recursion subroutine so that +// the normal whereScanInit() routine, which is a high-runner, does not +// need to push registers onto the stack as part of its prologue. +func whereScanInitIndexExpr(tls *libc.TLS, pScan uintptr) uintptr { /* sqlite3.c:149601:34: */ + (*WhereScan)(unsafe.Pointer(pScan)).Fidxaff = Xsqlite3ExprAffinity(tls, (*WhereScan)(unsafe.Pointer(pScan)).FpIdxExpr) + return whereScanNext(tls, pScan) +} + +// Initialize a WHERE clause scanner object. Return a pointer to the +// first match. Return NULL if there are no matches. +// +// The scanner will be searching the WHERE clause pWC. It will look +// for terms of the form "X " where X is column iColumn of table +// iCur. Or if pIdx!=0 then X is column iColumn of index pIdx. pIdx +// must be one of the indexes of table iCur. +// +// The must be one of the operators described by opMask. +// +// If the search is for X and the WHERE clause contains terms of the +// form X=Y then this routine might also return terms of the form +// "Y ". The number of levels of transitivity is limited, +// but is enough to handle most commonly occurring SQL statements. +// +// If X is not the INTEGER PRIMARY KEY then X must be compatible with +// index pIdx. +func whereScanInit(tls *libc.TLS, pScan uintptr, pWC uintptr, iCur int32, iColumn int32, opMask U32, pIdx uintptr) uintptr { /* sqlite3.c:149625:18: */ + (*WhereScan)(unsafe.Pointer(pScan)).FpOrigWC = pWC + (*WhereScan)(unsafe.Pointer(pScan)).FpWC = pWC + (*WhereScan)(unsafe.Pointer(pScan)).FpIdxExpr = uintptr(0) + (*WhereScan)(unsafe.Pointer(pScan)).Fidxaff = int8(0) + (*WhereScan)(unsafe.Pointer(pScan)).FzCollName = uintptr(0) + (*WhereScan)(unsafe.Pointer(pScan)).FopMask = opMask + (*WhereScan)(unsafe.Pointer(pScan)).Fk = 0 + *(*int32)(unsafe.Pointer((pScan + 44 /* &.aiCur */))) = iCur + (*WhereScan)(unsafe.Pointer(pScan)).FnEquiv = uint8(1) + (*WhereScan)(unsafe.Pointer(pScan)).FiEquiv = uint8(1) + if pIdx != 0 { + var j int32 = iColumn + iColumn = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2))) + if iColumn == (-2) { + (*WhereScan)(unsafe.Pointer(pScan)).FpIdxExpr = (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr + 8 /* &.a */) + uintptr(j)*32)).FpExpr + (*WhereScan)(unsafe.Pointer(pScan)).FzCollName = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8)) + *(*I16)(unsafe.Pointer((pScan + 88 /* &.aiColumn */))) = int16(-2) + return whereScanInitIndexExpr(tls, pScan) + } else if iColumn == int32((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FiPKey) { + iColumn = -1 + } else if iColumn >= 0 { + (*WhereScan)(unsafe.Pointer(pScan)).Fidxaff = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(iColumn)*32)).Faffinity + (*WhereScan)(unsafe.Pointer(pScan)).FzCollName = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(j)*8)) + } + } else if iColumn == (-2) { + return uintptr(0) + } + *(*I16)(unsafe.Pointer((pScan + 88 /* &.aiColumn */))) = I16(iColumn) + return whereScanNext(tls, pScan) +} + +// Search for a term in the WHERE clause that is of the form "X " +// where X is a reference to the iColumn of table iCur or of index pIdx +// if pIdx!=0 and is one of the WO_xx operator codes specified by +// the op parameter. Return a pointer to the term. Return 0 if not found. +// +// If pIdx!=0 then it must be one of the indexes of table iCur. +// Search for terms matching the iColumn-th column of pIdx +// rather than the iColumn-th column of table iCur. +// +// The term returned might by Y= if there is another constraint in +// the WHERE clause that specifies that X=Y. Any such constraints will be +// identified by the WO_EQUIV bit in the pTerm->eOperator field. The +// aiCur[]/iaColumn[] arrays hold X and all its equivalents. There are 11 +// slots in aiCur[]/aiColumn[] so that means we can look for X plus up to 10 +// other equivalent values. Hence a search for X will return if X=A1 +// and A1=A2 and A2=A3 and ... and A9=A10 and A10=. +// +// If there are multiple terms in the WHERE clause of the form "X " +// then try for the one with no dependencies on - in other words where +// is a constant expression of some kind. Only return entries of +// the form "X Y" where Y is a column in another table if no terms of +// the form "X " exist. If no terms with a constant RHS +// exist, try to return a term that does not use WO_EQUIV. +func Xsqlite3WhereFindTerm(tls *libc.TLS, pWC uintptr, iCur int32, iColumn int32, notReady Bitmask, op U32, pIdx uintptr) uintptr { /* sqlite3.c:149689:26: */ + bp := tls.Alloc(112) + defer tls.Free(112) + + var pResult uintptr = uintptr(0) + var p uintptr + // var scan WhereScan at bp, 112 + + p = whereScanInit(tls, bp /* &scan */, pWC, iCur, iColumn, op, pIdx) + op = op & (U32(WO_EQ | WO_IS)) + for p != 0 { + if ((*WhereTerm)(unsafe.Pointer(p)).FprereqRight & notReady) == uint64(0) { + if ((*WhereTerm)(unsafe.Pointer(p)).FprereqRight == uint64(0)) && ((U32((*WhereTerm)(unsafe.Pointer(p)).FeOperator) & op) != U32(0)) { + + return p + } + if pResult == uintptr(0) { + pResult = p + } + } + p = whereScanNext(tls, bp /* &scan */) + } + return pResult +} + +// This function searches pList for an entry that matches the iCol-th column +// of index pIdx. +// +// If such an expression is found, its index in pList->a[] is returned. If +// no expression is found, -1 is returned. +func findIndexCol(tls *libc.TLS, pParse uintptr, pList uintptr, iBase int32, pIdx uintptr, iCol int32) int32 { /* sqlite3.c:149723:12: */ + var i int32 + var zColl uintptr = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(iCol)*8)) + + for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { + var p uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + if (((p != uintptr(0)) && + ((int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_COLUMN) || (int32((*Expr)(unsafe.Pointer(p)).Fop) == TK_AGG_COLUMN))) && + (int32((*Expr)(unsafe.Pointer(p)).FiColumn) == int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2))))) && + ((*Expr)(unsafe.Pointer(p)).FiTable == iBase) { + var pColl uintptr = Xsqlite3ExprNNCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr) + if 0 == Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pColl)).FzName, zColl) { + return i + } + } + } + + return -1 +} + +// Return TRUE if the iCol-th column of index pIdx is NOT NULL +func indexColumnNotNull(tls *libc.TLS, pIdx uintptr, iCol int32) int32 { /* sqlite3.c:149753:12: */ + var j int32 + + j = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(iCol)*2))) + if j >= 0 { + return int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(j)*32)).FnotNull) + } else if j == (-1) { + return 1 + } else { + + return 0 // Assume an indexed expression can always yield a NULL + + } + return int32(0) +} + +// Return true if the DISTINCT expression-list passed as the third argument +// is redundant. +// +// A DISTINCT list is redundant if any subset of the columns in the +// DISTINCT list are collectively unique and individually non-null. +func isDistinctRedundant(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWC uintptr, pDistinct uintptr) int32 { /* sqlite3.c:149776:12: */ + var pTab uintptr + var pIdx uintptr + var i int32 + var iBase int32 + + // If there is more than one table or sub-select in the FROM clause of + // this query, then it will not be possible to show that the DISTINCT + // clause is redundant. + if (*SrcList)(unsafe.Pointer(pTabList)).FnSrc != 1 { + return 0 + } + iBase = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor + pTab = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FpTab + + // If any of the expressions is an IPK column on table iBase, then return + // true. Note: The (p->iTable==iBase) part of this test may be false if the + // current SELECT is a correlated sub-query. + for i = 0; i < (*ExprList)(unsafe.Pointer(pDistinct)).FnExpr; i++ { + var p uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer((pDistinct+8 /* &.a */)+uintptr(i)*32)).FpExpr) + if p == uintptr(0) { + continue + } + if (int32((*Expr)(unsafe.Pointer(p)).Fop) != TK_COLUMN) && (int32((*Expr)(unsafe.Pointer(p)).Fop) != TK_AGG_COLUMN) { + continue + } + if ((*Expr)(unsafe.Pointer(p)).FiTable == iBase) && (int32((*Expr)(unsafe.Pointer(p)).FiColumn) < 0) { + return 1 + } + } + + // Loop through all indices on the table, checking each to see if it makes + // the DISTINCT qualifier redundant. It does so if: + // + // 1. The index is itself UNIQUE, and + // + // 2. All of the columns in the index are either part of the pDistinct + // list, or else the WHERE clause contains a term of the form "col=X", + // where X is a constant value. The collation sequences of the + // comparison and select-list expressions must match those of the index. + // + // 3. All of those index columns for which the WHERE clause does not + // contain a "col=X" term are subject to a NOT NULL constraint. + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + if !(int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None) { + continue + } + if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { + continue + } + for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); i++ { + if uintptr(0) == Xsqlite3WhereFindTerm(tls, pWC, iBase, i, libc.CplUint64(uint64(0)), uint32(WO_EQ), pIdx) { + if findIndexCol(tls, pParse, pDistinct, iBase, pIdx, i) < 0 { + break + } + if indexColumnNotNull(tls, pIdx, i) == 0 { + break + } + } + } + if i == int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) { + // This index implies that the DISTINCT qualifier is redundant. + return 1 + } + } + + return 0 +} + +// Estimate the logarithm of the input value to base 2. +func estLog(tls *libc.TLS, N LogEst) LogEst { /* sqlite3.c:149840:15: */ + if int32(N) <= 10 { + return int16(0) + } + return (int16(int32(Xsqlite3LogEst(tls, uint64(N))) - 33)) +} + +// Convert OP_Column opcodes to OP_Copy in previously generated code. +// +// This routine runs over generated VDBE code and translates OP_Column +// opcodes into OP_Copy when the table is being accessed via co-routine +// instead of via table lookup. +// +// If the iAutoidxCur is not zero, then any OP_Rowid instructions on +// cursor iTabCur are transformed into OP_Sequence opcode for the +// iAutoidxCur cursor, in order to generate unique rowids for the +// automatic index being generated. +func translateColumnToCopy(tls *libc.TLS, pParse uintptr, iStart int32, iTabCur int32, iRegister int32, iAutoidxCur int32) { /* sqlite3.c:149856:13: */ + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var pOp uintptr = Xsqlite3VdbeGetOp(tls, v, iStart) + var iEnd int32 = Xsqlite3VdbeCurrentAddr(tls, v) + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return + } +__1: + if !(iStart < iEnd) { + goto __3 + } + { + if (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 != iTabCur { + goto __2 + } + if int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Column { + (*VdbeOp)(unsafe.Pointer(pOp)).Fopcode = U8(OP_Copy) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = ((*VdbeOp)(unsafe.Pointer(pOp)).Fp2 + iRegister) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 = (*VdbeOp)(unsafe.Pointer(pOp)).Fp3 + (*VdbeOp)(unsafe.Pointer(pOp)).Fp3 = 0 + } else if int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Rowid { + (*VdbeOp)(unsafe.Pointer(pOp)).Fopcode = U8(OP_Sequence) + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = iAutoidxCur + } + + } + goto __2 +__2: + iStart++ + pOp += 24 + goto __1 + goto __3 +__3: +} + +// Two routines for printing the content of an sqlite3_index_info +// structure. Used for testing and debugging only. If neither +// SQLITE_TEST or SQLITE_DEBUG are defined, then these routines +// are no-ops. + +// Return TRUE if the WHERE clause term pTerm is of a form where it +// could be used with an index to access pSrc, assuming an appropriate +// index existed. +func termCanDriveIndex(tls *libc.TLS, pTerm uintptr, pSrc uintptr, notReady Bitmask) int32 { /* sqlite3.c:149938:12: */ + var aff int8 + if (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor { + return 0 + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (WO_EQ | WO_IS)) == 0 { + return 0 + } + if (((int32((*SrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype) & JT_LEFT) != 0) && + !(((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_FromJoin))) != U32(0))) && + ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_IS) != 0) { + // Cannot use an IS term from the WHERE clause as an index driver for + // the RHS of a LEFT JOIN. Such a term can only be used if it is from + // the ON clause. + return 0 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & notReady) != uint64(0) { + return 0 + } + if *(*int32)(unsafe.Pointer((pTerm + 32 /* &.u */ /* &.x */) /* &.leftColumn */)) < 0 { + return 0 + } + aff = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FaCol + uintptr(*(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)))*32)).Faffinity + if !(Xsqlite3IndexAffinityOk(tls, (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr, aff) != 0) { + return 0 + } + + return 1 +} + +// Generate code to construct the Index object for an automatic index +// and to set up the WhereLevel object pLevel so that the code generator +// makes use of the automatic index. +func constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, pSrc uintptr, notReady Bitmask, pLevel uintptr) { /* sqlite3.c:149971:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var nKeyCol int32 // Number of columns in the constructed index + var pTerm uintptr // A single term of the WHERE clause + var pWCEnd uintptr // End of pWC->a[] + var pIdx uintptr // Object describing the transient index + var v uintptr // Prepared statement under construction + var addrInit int32 // Address of the initialization bypass jump + var pTable uintptr // The table being indexed + var addrTop int32 // Top of the index fill loop + var regRecord int32 // Register holding an index record + var n int32 // Column counter + var i int32 // Loop counter + var mxBitCol int32 // Maximum column in pSrc->colUsed + var pColl uintptr // Collating sequence to on a column + var pLoop uintptr // The Loop object + // var zNotUsed uintptr at bp+16, 8 + // Extra space on the end of pIdx + var idxCols Bitmask // Bitmap of columns used for indexing + var extraCols Bitmask // Bitmap of additional columns + var sentWarning U8 // True if a warnning has been issued + var pPartial uintptr // Partial Index Expression + var iContinue int32 // Jump here to skip excluded rows + var pTabItem uintptr // FROM clause term being indexed + var addrCounter int32 // Address where integer counter is initialized + var regBase int32 + var iCol int32 + var cMask Bitmask + var pExpr uintptr + var pX uintptr + var iCol1 int32 + var cMask1 Bitmask + var regYield int32 + sentWarning = U8(0) + pPartial = uintptr(0) + iContinue = 0 + addrCounter = 0 // Array of registers where record is assembled + + // Generate code to skip over the creation and initialization of the + // transient index on 2nd and subsequent iterations of the loop. + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + + addrInit = Xsqlite3VdbeAddOp0(tls, v, OP_Once) + + // Count the number of columns that will be added to the index + // and used to match WHERE clause constraints + nKeyCol = 0 + pTable = (*SrcItem)(unsafe.Pointer(pSrc)).FpTab + pWCEnd = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer(pWC)).FnTerm)*56) + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + idxCols = uint64(0) + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__1: + if !(pTerm < pWCEnd) { + goto __3 + } + pExpr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + // table of a LEFT JOIN + if !(((((*WhereLoop)(unsafe.Pointer(pLoop)).Fprereq == uint64(0)) && + ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VIRTUAL) == 0)) && + !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0))) && + (Xsqlite3ExprIsTableConstant(tls, pExpr, (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor) != 0)) { + goto __4 + } + pPartial = Xsqlite3ExprAnd(tls, pParse, pPartial, + Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0)) +__4: + ; + if !(termCanDriveIndex(tls, pTerm, pSrc, notReady) != 0) { + goto __5 + } + iCol = *(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) + if iCol >= (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) { + cMask = (Bitmask((uint64(1))) << ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1)) + } else { + cMask = (Bitmask((uint64(1))) << (iCol)) + } + + if !(!(sentWarning != 0)) { + goto __6 + } + Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), + ts+20213 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*32)).FzName)) + sentWarning = U8(1) +__6: + ; + if !((idxCols & cMask) == uint64(0)) { + goto __7 + } + if !(whereLoopResize(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pLoop, (nKeyCol+1)) != 0) { + goto __8 + } + goto end_auto_index_create +__8: + ; + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(libc.PostIncInt32(&nKeyCol, 1))*8)) = pTerm + idxCols = idxCols | (cMask) +__7: + ; +__5: + ; + goto __2 +__2: + pTerm += 56 + goto __1 + goto __3 +__3: + ; + + *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = libc.AssignPtrUint16(pLoop+44 /* &.nLTerm */, U16(nKeyCol)) + (*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = (U32(((WHERE_COLUMN_EQ | WHERE_IDX_ONLY) | WHERE_INDEXED) | + WHERE_AUTO_INDEX)) + + // Count the number of additional columns needed to create a + // covering index. A "covering index" is an index that contains all + // columns that are needed by the query. With a covering index, the + // original table never needs to be accessed. Automatic indices must + // be a covering index because the index will not be updated if the + // original table changes and the index and table cannot both be used + // if they go out of sync. + extraCols = ((*SrcItem)(unsafe.Pointer(pSrc)).FcolUsed & (^idxCols | (Bitmask((uint64(1))) << ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1)))) + mxBitCol = func() int32 { + if ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) < (int32((*Table)(unsafe.Pointer(pTable)).FnCol)) { + return ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) + } + return int32((*Table)(unsafe.Pointer(pTable)).FnCol) + }() + + i = 0 +__9: + if !(i < mxBitCol) { + goto __11 + } + if !((extraCols & (Bitmask((uint64(1))) << (i))) != 0) { + goto __12 + } + nKeyCol++ +__12: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; + if !(((*SrcItem)(unsafe.Pointer(pSrc)).FcolUsed & (Bitmask((uint64(1))) << ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1))) != 0) { + goto __13 + } + nKeyCol = nKeyCol + ((int32((*Table)(unsafe.Pointer(pTable)).FnCol) - (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) + 1) +__13: + ; + + // Construct the Index object to describe this index + pIdx = Xsqlite3AllocateIndexObject(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (int16(nKeyCol + 1)), 0, bp+16 /* &zNotUsed */) + if !(pIdx == uintptr(0)) { + goto __14 + } + goto end_auto_index_create +__14: + ; + *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20239 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable + n = 0 + idxCols = uint64(0) + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__15: + if !(pTerm < pWCEnd) { + goto __17 + } + if !(termCanDriveIndex(tls, pTerm, pSrc, notReady) != 0) { + goto __18 + } + iCol1 = *(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) + if iCol1 >= (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) { + cMask1 = (Bitmask((uint64(1))) << ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1)) + } else { + cMask1 = (Bitmask((uint64(1))) << (iCol1)) + } + + if !((idxCols & cMask1) == uint64(0)) { + goto __19 + } + pX = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + idxCols = idxCols | (cMask1) + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) = I16(*(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */))) + pColl = Xsqlite3ExprCompareCollSeq(tls, pParse, pX) + // TH3 collate01.800 + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(n)*8)) = func() uintptr { + if pColl != 0 { + return (*CollSeq)(unsafe.Pointer(pColl)).FzName + } + return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + }() + n++ +__19: + ; +__18: + ; + goto __16 +__16: + pTerm += 56 + goto __15 + goto __17 +__17: + ; + + // Add additional columns needed to make the automatic index into + // a covering index + i = 0 +__20: + if !(i < mxBitCol) { + goto __22 + } + if !((extraCols & (Bitmask((uint64(1))) << (i))) != 0) { + goto __23 + } + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) = I16(i) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(n)*8)) = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + n++ +__23: + ; + goto __21 +__21: + i++ + goto __20 + goto __22 +__22: + ; + if !(((*SrcItem)(unsafe.Pointer(pSrc)).FcolUsed & (Bitmask((uint64(1))) << ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1))) != 0) { + goto __24 + } + i = ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) +__25: + if !(i < int32((*Table)(unsafe.Pointer(pTable)).FnCol)) { + goto __27 + } + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) = I16(i) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(n)*8)) = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + n++ + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; +__24: + ; + + *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(n)*2)) = int16(-1) + *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(n)*8)) = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + + // Create the automatic index + + (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenAutoindex, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, (nKeyCol + 1)) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) + + // Fill the automatic index with content + pTabItem = (((*WhereInfo)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112) + if !((uint32(int32(*(*uint16)(unsafe.Pointer(pTabItem + 60 /* &.fg */ + 4 /* &.viaCoroutine */)) & 0x10 >> 4))) != 0) { + goto __28 + } + regYield = (*SrcItem)(unsafe.Pointer(pTabItem)).FregReturn + addrCounter = Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, 0) + Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regYield, 0, (*SrcItem)(unsafe.Pointer(pTabItem)).FaddrFillSub) + addrTop = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, regYield) + + goto __29 +__28: + addrTop = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur) +__29: + ; + if !(pPartial != 0) { + goto __30 + } + iContinue = Xsqlite3VdbeMakeLabel(tls, pParse) + Xsqlite3ExprIfFalse(tls, pParse, pPartial, iContinue, SQLITE_JUMPIFNULL) + *(*U32)(unsafe.Pointer(pLoop + 40 /* &.wsFlags */)) |= (U32(WHERE_PARTIALIDX)) +__30: + ; + regRecord = Xsqlite3GetTempReg(tls, pParse) + regBase = Xsqlite3GenerateIndexKey(tls, + pParse, pIdx, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, regRecord, 0, uintptr(0), uintptr(0), 0) + Xsqlite3VdbeAddOp2(tls, v, OP_IdxInsert, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, regRecord) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_USESEEKRESULT)) + if !(pPartial != 0) { + goto __31 + } + Xsqlite3VdbeResolveLabel(tls, v, iContinue) +__31: + ; + if !((uint32(int32(*(*uint16)(unsafe.Pointer(pTabItem + 60 /* &.fg */ + 4 /* &.viaCoroutine */)) & 0x10 >> 4))) != 0) { + goto __32 + } + Xsqlite3VdbeChangeP2(tls, v, addrCounter, (regBase + n)) + + translateColumnToCopy(tls, pParse, addrTop, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, + (*SrcItem)(unsafe.Pointer(pTabItem)).FregResult, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur) + Xsqlite3VdbeGoto(tls, v, addrTop) + libc.SetBitFieldPtr16Uint32(pTabItem+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(0), 4, 0x10) + goto __33 +__32: + Xsqlite3VdbeAddOp2(tls, v, OP_Next, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, (addrTop + 1)) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_STMTSTATUS_AUTOINDEX)) +__33: + ; + Xsqlite3VdbeJumpHere(tls, v, addrTop) + Xsqlite3ReleaseTempReg(tls, pParse, regRecord) + + // Jump here when skipping the initialization + Xsqlite3VdbeJumpHere(tls, v, addrInit) + +end_auto_index_create: + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pPartial) +} + +// Allocate and populate an sqlite3_index_info structure. It is the +// responsibility of the caller to eventually release the structure +// by passing the pointer returned by this function to sqlite3_free(). +func allocateIndexInfo(tls *libc.TLS, pParse uintptr, pWC uintptr, mUnusable Bitmask, pSrc uintptr, pOrderBy uintptr, pmNoOmit uintptr) uintptr { /* sqlite3.c:150178:27: */ + var i int32 + var j int32 + var nTerm int32 + var pIdxCons uintptr + var pIdxOrderBy uintptr + var pUsage uintptr + var pHidden uintptr + var pTerm uintptr + var nOrderBy int32 + var pIdxInfo uintptr + var mNoOmit U16 = U16(0) + + // Count the number of possible WHERE clause constraints referring + // to this virtual table + i = libc.AssignInt32(&nTerm, 0) + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__1: + if !(i < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm) { + goto __3 + } + { + if (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor { + goto __2 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & mUnusable) != 0 { + goto __2 + } + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & libc.CplInt32(WO_EQUIV)) == 0 { + goto __2 + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VNULL) != 0 { + goto __2 + } + + nTerm++ + + } + goto __2 +__2: + i++ + pTerm += 56 + goto __1 + goto __3 +__3: + ; + + // If the ORDER BY clause contains only columns in the current + // virtual table then allocate space for the aOrderBy part of + // the sqlite3_index_info structure. + nOrderBy = 0 + if pOrderBy != 0 { + var n int32 = (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr + for i = 0; i < n; i++ { + var pExpr uintptr = (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32)).FpExpr + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLUMN) || ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor) { + break + } + if (int32((*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FsortFlags) & KEYINFO_ORDER_BIGNULL) != 0 { + break + } + } + if i == n { + nOrderBy = n + } + } + + // Allocate the sqlite3_index_info structure + pIdxInfo = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64(((uint64(unsafe.Sizeof(Sqlite3_index_info{})) + + ((uint64(unsafe.Sizeof(sqlite3_index_constraint{})) + uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint64(nTerm))) + + (uint64(unsafe.Sizeof(sqlite3_index_orderby{})) * uint64(nOrderBy))) + uint64(unsafe.Sizeof(HiddenIndexInfo1{}))))) + if pIdxInfo == uintptr(0) { + Xsqlite3ErrorMsg(tls, pParse, ts+5182 /* "out of memory" */, 0) + return uintptr(0) + } + pHidden = (pIdxInfo + 1*96) + pIdxCons = (pHidden + 1*16) + pIdxOrderBy = (pIdxCons + uintptr(nTerm)*12) + pUsage = (pIdxOrderBy + uintptr(nOrderBy)*8) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy = nOrderBy + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint = pIdxCons + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy = pIdxOrderBy + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage = pUsage + (*HiddenIndexInfo1)(unsafe.Pointer(pHidden)).FpWC = pWC + (*HiddenIndexInfo1)(unsafe.Pointer(pHidden)).FpParse = pParse + i = libc.AssignInt32(&j, 0) + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__4: + if !(i < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm) { + goto __6 + } + { + var op U16 + if (*WhereTerm)(unsafe.Pointer(pTerm)).FleftCursor != (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor { + goto __5 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & mUnusable) != 0 { + goto __5 + } + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & libc.CplInt32(WO_EQUIV)) == 0 { + goto __5 + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VNULL) != 0 { + goto __5 + } + + // tag-20191211-002: WHERE-clause constraints are not useful to the + // right-hand table of a LEFT JOIN. See tag-20191211-001 for the + // equivalent restriction for ordinary tables. + if ((int32((*SrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype) & JT_LEFT) != 0) && + !(((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) { + goto __5 + } + + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).FiColumn = *(*int32)(unsafe.Pointer(pTerm + 32 /* &.u */ /* &.x */ /* &.leftColumn */)) + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).FiTermOffset = i + op = (U16(int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_ALL)) + if int32(op) == WO_IN { + op = U16(WO_EQ) + } + if int32(op) == WO_AUX { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).Fop = (*WhereTerm)(unsafe.Pointer(pTerm)).FeMatchOp + } else if (int32(op) & (WO_ISNULL | WO_IS)) != 0 { + if int32(op) == WO_ISNULL { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).Fop = uint8(SQLITE_INDEX_CONSTRAINT_ISNULL) + } else { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).Fop = uint8(SQLITE_INDEX_CONSTRAINT_IS) + } + } else { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).Fop = U8(op) + // The direct assignment in the previous line is possible only because + // the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The + // following asserts verify this fact. + + if ((int32(op) & ((((int32(WO_EQ) << (TK_LT - TK_EQ)) | (int32(WO_EQ) << (TK_LE - TK_EQ))) | (int32(WO_EQ) << (TK_GT - TK_EQ))) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) != 0) && + (Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight) != 0) { + + if j < 16 { + mNoOmit = U16(int32(mNoOmit) | (int32(1) << j)) + } + if int32(op) == (int32(WO_EQ) << (TK_LT - TK_EQ)) { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).Fop = (uint8(int32(WO_EQ) << (TK_LE - TK_EQ))) + } + if int32(op) == (int32(WO_EQ) << (TK_GT - TK_EQ)) { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons + uintptr(j)*12)).Fop = (uint8(int32(WO_EQ) << (TK_GE - TK_EQ))) + } + } + } + + j++ + + } + goto __5 +__5: + i++ + pTerm += 56 + goto __4 + goto __6 +__6: + ; + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint = j + for i = 0; i < nOrderBy; i++ { + var pExpr uintptr = (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32)).FpExpr + (*sqlite3_index_orderby)(unsafe.Pointer(pIdxOrderBy + uintptr(i)*8)).FiColumn = int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) + (*sqlite3_index_orderby)(unsafe.Pointer(pIdxOrderBy + uintptr(i)*8)).Fdesc = (uint8(int32((*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FsortFlags) & KEYINFO_ORDER_DESC)) + } + + *(*U16)(unsafe.Pointer(pmNoOmit)) = mNoOmit + return pIdxInfo +} + +// The table object reference passed as the second argument to this function +// must represent a virtual table. This function invokes the xBestIndex() +// method of the virtual table with the sqlite3_index_info object that +// comes in as the 3rd argument to this function. +// +// If an error occurs, pParse is populated with an error message and an +// appropriate error code is returned. A return of SQLITE_CONSTRAINT from +// xBestIndex is not considered an error. SQLITE_CONSTRAINT indicates that +// the current configuration of "unusable" flags in sqlite3_index_info can +// not result in a valid plan. +// +// Whether or not an error is returned, it is the responsibility of the +// caller to eventually free p->idxStr if p->needToFreeIdxStr indicates +// that this is required. +func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 { /* sqlite3.c:150333:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pVtab uintptr = (*VTable)(unsafe.Pointer(Xsqlite3GetVTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pTab))).FpVtab + var rc int32 + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule + 24 /* &.xBestIndex */))))(tls, pVtab, p) + + if (rc != SQLITE_OK) && (rc != SQLITE_CONSTRAINT) { + if rc == SQLITE_NOMEM { + Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) + } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + } else { + Xsqlite3ErrorMsg(tls, pParse, ts+2791 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + } + } + Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = uintptr(0) + return rc +} + +// Estimate the location of a particular key among all keys in an +// index. Store the results in aStat as follows: +// +// aStat[0] Est. number of rows less than pRec +// aStat[1] Est. number of rows equal to pRec +// +// Return the index of the sample that is the smallest sample that +// is greater than or equal to pRec. Note that this index is not an index +// into the aSample[] array - it is an index into a virtual set of samples +// based on the contents of aSample[] and the number of fields in record +// pRec. +func whereKeyStats(tls *libc.TLS, pParse uintptr, pIdx uintptr, pRec uintptr, roundUp int32, aStat uintptr) int32 { /* sqlite3.c:150370:12: */ + var aSample uintptr = (*Index)(unsafe.Pointer(pIdx)).FaSample + var iCol int32 // Index of required stats in anEq[] etc. + var i int32 // Index of first sample >= pRec + var iSample int32 // Smallest sample larger than or equal to pRec + var iMin int32 = 0 // Smallest sample not yet tested + var iTest int32 // Next sample to test + var res int32 // Result of comparison operation + var nField int32 // Number of fields in pRec + var iLower TRowcnt = TRowcnt(0) // anLt[] + anEq[] of largest sample pRec is > + + _ = pParse + + // Do a binary search to find the first sample greater than or equal + // to pRec. If pRec contains a single field, the set of samples to search + // is simply the aSample[] array. If the samples in aSample[] contain more + // than one fields, all fields following the first are ignored. + // + // If pRec contains N fields, where N is more than one, then as well as the + // samples in aSample[] (truncated to N fields), the search also has to + // consider prefixes of those samples. For example, if the set of samples + // in aSample is: + // + // aSample[0] = (a, 5) + // aSample[1] = (a, 10) + // aSample[2] = (b, 5) + // aSample[3] = (c, 100) + // aSample[4] = (c, 105) + // + // Then the search space should ideally be the samples above and the + // unique prefixes [a], [b] and [c]. But since that is hard to organize, + // the code actually searches this set: + // + // 0: (a) + // 1: (a, 5) + // 2: (a, 10) + // 3: (a, 10) + // 4: (b) + // 5: (b, 5) + // 6: (c) + // 7: (c, 100) + // 8: (c, 105) + // 9: (c, 105) + // + // For each sample in the aSample[] array, N samples are present in the + // effective sample array. In the above, samples 0 and 1 are based on + // sample aSample[0]. Samples 2 and 3 on aSample[1] etc. + // + // Often, sample i of each block of N effective samples has (i+1) fields. + // Except, each sample may be extended to ensure that it is greater than or + // equal to the previous sample in the array. For example, in the above, + // sample 2 is the first sample of a block of N samples, so at first it + // appears that it should be 1 field in size. However, that would make it + // smaller than sample 1, so the binary search would not work. As a result, + // it is extended to two fields. The duplicates that this creates do not + // cause any problems. + nField = int32((*UnpackedRecord)(unsafe.Pointer(pRec)).FnField) + iCol = 0 + iSample = ((*Index)(unsafe.Pointer(pIdx)).FnSample * nField) + for ok := true; ok; ok = ((res != 0) && (iMin < iSample)) { + var iSamp int32 // Index in aSample[] of test sample + var n int32 // Number of fields in test sample + + iTest = ((iMin + iSample) / 2) + iSamp = (iTest / nField) + if iSamp > 0 { + // The proposed effective sample is a prefix of sample aSample[iSamp]. + // Specifically, the shortest prefix of at least (1 + iTest%nField) + // fields that is greater than the previous effective sample. + for n = ((iTest % nField) + 1); n < nField; n++ { + if *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr((iSamp-1))*40)).FanLt + uintptr((n-1))*4)) != *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(iSamp)*40)).FanLt + uintptr((n-1))*4)) { + break + } + } + } else { + n = (iTest + 1) + } + + (*UnpackedRecord)(unsafe.Pointer(pRec)).FnField = U16(n) + res = Xsqlite3VdbeRecordCompare(tls, (*IndexSample)(unsafe.Pointer(aSample+uintptr(iSamp)*40)).Fn, (*IndexSample)(unsafe.Pointer(aSample+uintptr(iSamp)*40)).Fp, pRec) + if res < 0 { + iLower = (*(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(iSamp)*40)).FanLt + uintptr((n-1))*4)) + *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(iSamp)*40)).FanEq + uintptr((n-1))*4))) + iMin = (iTest + 1) + } else if (res == 0) && (n < nField) { + iLower = *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(iSamp)*40)).FanLt + uintptr((n-1))*4)) + iMin = (iTest + 1) + res = -1 + } else { + iSample = iTest + iCol = (n - 1) + } + } + i = (iSample / nField) + + if res == 0 { + // Record pRec is equal to sample i + + *(*TRowcnt)(unsafe.Pointer(aStat)) = *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(i)*40)).FanLt + uintptr(iCol)*4)) + *(*TRowcnt)(unsafe.Pointer(aStat + 1*4)) = *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(i)*40)).FanEq + uintptr(iCol)*4)) + } else { + // At this point, the (iCol+1) field prefix of aSample[i] is the first + // sample that is greater than pRec. Or, if i==pIdx->nSample then pRec + // is larger than all samples in the array. + var iUpper TRowcnt + var iGap TRowcnt + if i >= (*Index)(unsafe.Pointer(pIdx)).FnSample { + iUpper = TRowcnt(Xsqlite3LogEstToInt(tls, *(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowLogEst)))) + } else { + iUpper = *(*TRowcnt)(unsafe.Pointer((*IndexSample)(unsafe.Pointer(aSample+uintptr(i)*40)).FanLt + uintptr(iCol)*4)) + } + + if iLower >= iUpper { + iGap = TRowcnt(0) + } else { + iGap = (iUpper - iLower) + } + if roundUp != 0 { + iGap = ((iGap * TRowcnt(2)) / TRowcnt(3)) + } else { + iGap = (iGap / TRowcnt(3)) + } + *(*TRowcnt)(unsafe.Pointer(aStat)) = (iLower + iGap) + *(*TRowcnt)(unsafe.Pointer(aStat + 1*4)) = *(*TRowcnt)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaAvgEq + uintptr((nField-1))*4)) + } + + // Restore the pRec->nField value before returning. + (*UnpackedRecord)(unsafe.Pointer(pRec)).FnField = U16(nField) + return i +} + +// If it is not NULL, pTerm is a term that provides an upper or lower +// bound on a range scan. Without considering pTerm, it is estimated +// that the scan will visit nNew rows. This function returns the number +// estimated to be visited after taking pTerm into account. +// +// If the user explicitly specified a likelihood() value for this term, +// then the return value is the likelihood multiplied by the number of +// input rows. Otherwise, this function assumes that an "IS NOT NULL" term +// has a likelihood of 0.50, and any other term a likelihood of 0.25. +func whereRangeAdjust(tls *libc.TLS, pTerm uintptr, nNew LogEst) LogEst { /* sqlite3.c:150562:15: */ + var nRet LogEst = nNew + if pTerm != 0 { + if int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 { + nRet = LogEst(int32(nRet) + (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb))) + } else if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VNULL) == 0 { + nRet = int16(int32(nRet) - (20)) + } + } + return nRet +} + +// Return the affinity for a single column of an index. +func Xsqlite3IndexColumnAffinity(tls *libc.TLS, db uintptr, pIdx uintptr, iCol int32) int8 { /* sqlite3.c:150579:21: */ + + if !(int32((*Index)(unsafe.Pointer(pIdx)).FzColAff) != 0) { + if Xsqlite3IndexAffinityStr(tls, db, pIdx) == uintptr(0) { + return int8(SQLITE_AFF_BLOB) + } + } + + return *(*int8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FzColAff + uintptr(iCol))) +} + +// This function is called to estimate the number of rows visited by a +// range-scan on a skip-scan index. For example: +// +// CREATE INDEX i1 ON t1(a, b, c); +// SELECT * FROM t1 WHERE a=? AND c BETWEEN ? AND ?; +// +// Value pLoop->nOut is currently set to the estimated number of rows +// visited for scanning (a=? AND b=?). This function reduces that estimate +// by some factor to account for the (c BETWEEN ? AND ?) expression based +// on the stat4 data for the index. this scan will be peformed multiple +// times (once for each (a,b) combination that matches a=?) is dealt with +// by the caller. +// +// It does this by scanning through all stat4 samples, comparing values +// extracted from pLower and pUpper with the corresponding column in each +// sample. If L and U are the number of samples found to be less than or +// equal to the values extracted from pLower and pUpper respectively, and +// N is the total number of samples, the pLoop->nOut value is adjusted +// as follows: +// +// nOut = nOut * ( min(U - L, 1) / N ) +// +// If pLower is NULL, or a value cannot be extracted from the term, L is +// set to zero. If pUpper is NULL, or a value cannot be extracted from it, +// U is set to N. +// +// Normally, this function sets *pbDone to 1 before returning. However, +// if no value can be extracted from either pLower or pUpper (and so the +// estimate of the number of rows delivered remains unchanged), *pbDone +// is left as is. +// +// If an error occurs, an SQLite error code is returned. Otherwise, +// SQLITE_OK. +func whereRangeSkipScanEst(tls *libc.TLS, pParse uintptr, pLower uintptr, pUpper uintptr, pLoop uintptr, pbDone uintptr) int32 { /* sqlite3.c:150626:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var p uintptr = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + var nEq int32 = int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */))) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var nLower int32 = -1 + var nUpper int32 = ((*Index)(unsafe.Pointer(p)).FnSample + 1) + var rc int32 = SQLITE_OK + var aff U8 = U8(Xsqlite3IndexColumnAffinity(tls, db, p, nEq)) + var pColl uintptr + + *(*uintptr)(unsafe.Pointer(bp /* p1 */)) = uintptr(0) // Value extracted from pLower + *(*uintptr)(unsafe.Pointer(bp + 8 /* p2 */)) = uintptr(0) // Value extracted from pUpper + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) // Value extracted from record + + pColl = Xsqlite3LocateCollSeq(tls, pParse, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(p)).FazColl + uintptr(nEq)*8))) + if pLower != 0 { + rc = Xsqlite3Stat4ValueFromExpr(tls, pParse, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pLower)).FpExpr)).FpRight, aff, bp /* &p1 */) + nLower = 0 + } + if (pUpper != 0) && (rc == SQLITE_OK) { + rc = Xsqlite3Stat4ValueFromExpr(tls, pParse, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pUpper)).FpExpr)).FpRight, aff, bp+8 /* &p2 */) + if *(*uintptr)(unsafe.Pointer(bp + 8 /* p2 */)) != 0 { + nUpper = 0 + } else { + nUpper = (*Index)(unsafe.Pointer(p)).FnSample + } + } + + if (*(*uintptr)(unsafe.Pointer(bp /* p1 */)) != 0) || (*(*uintptr)(unsafe.Pointer(bp + 8 /* p2 */)) != 0) { + var i int32 + var nDiff int32 + for i = 0; (rc == SQLITE_OK) && (i < (*Index)(unsafe.Pointer(p)).FnSample); i++ { + rc = Xsqlite3Stat4Column(tls, db, (*IndexSample)(unsafe.Pointer((*Index)(unsafe.Pointer(p)).FaSample+uintptr(i)*40)).Fp, (*IndexSample)(unsafe.Pointer((*Index)(unsafe.Pointer(p)).FaSample+uintptr(i)*40)).Fn, nEq, bp+16 /* &pVal */) + if (rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp /* p1 */)) != 0) { + var res int32 = Xsqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(bp /* p1 */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), pColl) + if res >= 0 { + nLower++ + } + } + if (rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 8 /* p2 */)) != 0) { + var res int32 = Xsqlite3MemCompare(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p2 */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), pColl) + if res >= 0 { + nUpper++ + } + } + } + nDiff = (nUpper - nLower) + if nDiff <= 0 { + nDiff = 1 + } + + // If there is both an upper and lower bound specified, and the + // comparisons indicate that they are close together, use the fallback + // method (assume that the scan visits 1/64 of the rows) for estimating + // the number of rows visited. Otherwise, estimate the number of rows + // using the method described in the header comment for this function. + if ((nDiff != 1) || (pUpper == uintptr(0))) || (pLower == uintptr(0)) { + var nAdjust int32 = (int32(Xsqlite3LogEst(tls, uint64((*Index)(unsafe.Pointer(p)).FnSample))) - int32(Xsqlite3LogEst(tls, uint64(nDiff)))) + *(*LogEst)(unsafe.Pointer(pLoop + 22 /* &.nOut */)) -= LogEst((nAdjust)) + *(*int32)(unsafe.Pointer(pbDone)) = 1 + + } + + } else { + + } + + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp /* p1 */))) + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p2 */))) + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) + + return rc +} + +// This function is used to estimate the number of rows that will be visited +// by scanning an index for a range of values. The range may have an upper +// bound, a lower bound, or both. The WHERE clause terms that set the upper +// and lower bounds are represented by pLower and pUpper respectively. For +// example, assuming that index p is on t1(a): +// +// ... FROM t1 WHERE a > ? AND a < ? ... +// |_____| |_____| +// | | +// pLower pUpper +// +// If either of the upper or lower bound is not present, then NULL is passed in +// place of the corresponding WhereTerm. +// +// The value in (pBuilder->pNew->u.btree.nEq) is the number of the index +// column subject to the range constraint. Or, equivalently, the number of +// equality constraints optimized by the proposed index scan. For example, +// assuming index p is on t1(a, b), and the SQL query is: +// +// ... FROM t1 WHERE a = ? AND b > ? AND b < ? ... +// +// then nEq is set to 1 (as the range restricted column, b, is the second +// left-most column of the index). Or, if the query is: +// +// ... FROM t1 WHERE a > ? AND a < ? ... +// +// then nEq is set to 0. +// +// When this function is called, *pnOut is set to the sqlite3LogEst() of the +// number of rows that the index scan is expected to visit without +// considering the range constraints. If nEq is 0, then *pnOut is the number of +// rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced) +// to account for the range constraints pLower and pUpper. +// +// In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be +// used, a single range inequality reduces the search space by a factor of 4. +// and a pair of constraints (x>? AND x 0) && (nEq < (*Index)(unsafe.Pointer(p)).FnSampleCol)) && + (((*Sqlite3)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0)) { + if nEq == (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)) = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec + // var a [2]TRowcnt at bp, 8 + + var nBtm int32 = int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))) + var nTop int32 = int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))) + + // Variable iLower will be set to the estimate of the number of rows in + // the index that are less than the lower bound of the range query. The + // lower bound being the concatenation of $P and $L, where $P is the + // key-prefix formed by the nEq values matched against the nEq left-most + // columns of the index, and $L is the value in pLower. + // + // Or, if pLower is NULL or $L cannot be extracted from it (because it + // is not a simple variable or literal value), the lower bound of the + // range is $P. Due to a quirk in the way whereKeyStats() works, even + // if $L is available, whereKeyStats() is called for both ($P) and + // ($P:$L) and the larger of the two returned values is used. + // + // Similarly, iUpper is to be set to the estimate of the number of rows + // less than the upper bound of the range query. Where the upper bound + // is either ($P) or ($P:$U). Again, even if $U is available, both values + // of iUpper are requested of whereKeyStats() and the smaller used. + // + // The number of rows between the two bounds is then just iUpper-iLower. + var iLower TRowcnt // Rows less than the lower bound + var iUpper TRowcnt // Rows less than the upper bound + var iLwrIdx int32 = -2 // aSample[] for the lower bound + var iUprIdx int32 = -1 // aSample[] for the upper bound + + if *(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)) != 0 { + + (*UnpackedRecord)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)))).FnField = U16((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid) + } + // Determine iLower and iUpper using ($P) only. + if nEq == 0 { + iLower = TRowcnt(0) + iUpper = (*Index)(unsafe.Pointer(p)).FnRowEst0 + } else { + // Note: this call could be optimized away - since the same values must + // have been requested when testing key $P in whereEqualScanEst(). + whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)), 0, bp /* &a[0] */) + iLower = *(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */)) + iUpper = (*(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */)) + *(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */ + 1*4))) + } + + if *(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(p)).FaSortOrder + uintptr(nEq))) != 0 { + /* The roles of pLower and pUpper are swapped for a DESC index */ + { + var t uintptr = pLower + pLower = pUpper + pUpper = t + } + + { + var t int32 = nBtm + nBtm = nTop + nTop = t + } + + } + + // If possible, improve on the iLower estimate using ($P:$L). + if pLower != 0 { + // var n int32 at bp+16, 4 + // Values extracted from pExpr + var pExpr uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pLower)).FpExpr)).FpRight + rc = Xsqlite3Stat4ProbeSetValue(tls, pParse, p, bp+8 /* &pRec */, pExpr, nBtm, nEq, bp+16 /* &n */) + if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 16 /* n */)) != 0) { + var iNew TRowcnt + var mask U16 = (U16((int32(WO_EQ) << (TK_GT - TK_EQ)) | (int32(WO_EQ) << (TK_LE - TK_EQ)))) + if Xsqlite3ExprVectorSize(tls, pExpr) > *(*int32)(unsafe.Pointer(bp + 16 /* n */)) { + mask = (U16((int32(WO_EQ) << (TK_LE - TK_EQ)) | (int32(WO_EQ) << (TK_LT - TK_EQ)))) + } + iLwrIdx = whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)), 0, bp /* &a[0] */) + iNew = (*(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */)) + (func() uint32 { + if (int32((*WhereTerm)(unsafe.Pointer(pLower)).FeOperator) & int32(mask)) != 0 { + return *(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) + } + return uint32(0) + }())) + if iNew > iLower { + iLower = iNew + } + nOut-- + pLower = uintptr(0) + } + } + + // If possible, improve on the iUpper estimate using ($P:$U). + if pUpper != 0 { + // var n int32 at bp+20, 4 + // Values extracted from pExpr + var pExpr uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pUpper)).FpExpr)).FpRight + rc = Xsqlite3Stat4ProbeSetValue(tls, pParse, p, bp+8 /* &pRec */, pExpr, nTop, nEq, bp+20 /* &n */) + if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 20 /* n */)) != 0) { + var iNew TRowcnt + var mask U16 = (U16((int32(WO_EQ) << (TK_GT - TK_EQ)) | (int32(WO_EQ) << (TK_LE - TK_EQ)))) + if Xsqlite3ExprVectorSize(tls, pExpr) > *(*int32)(unsafe.Pointer(bp + 20 /* n */)) { + mask = (U16((int32(WO_EQ) << (TK_LE - TK_EQ)) | (int32(WO_EQ) << (TK_LT - TK_EQ)))) + } + iUprIdx = whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)), 1, bp /* &a[0] */) + iNew = (*(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */)) + (func() uint32 { + if (int32((*WhereTerm)(unsafe.Pointer(pUpper)).FeOperator) & int32(mask)) != 0 { + return *(*TRowcnt)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) + } + return uint32(0) + }())) + if iNew < iUpper { + iUpper = iNew + } + nOut-- + pUpper = uintptr(0) + } + } + + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = *(*uintptr)(unsafe.Pointer(bp + 8 /* pRec */)) + if rc == SQLITE_OK { + if iUpper > iLower { + nNew = Xsqlite3LogEst(tls, (uint64(iUpper - iLower))) + // TUNING: If both iUpper and iLower are derived from the same + // sample, then assume they are 4x more selective. This brings + // the estimated selectivity more in line with what it would be + // if estimated without the use of STAT4 tables. + if iLwrIdx == iUprIdx { + nNew = int16(int32(nNew) - (20)) + } + } else { + nNew = int16(10) + } + if int32(nNew) < nOut { + nOut = int32(nNew) + } + + } + } else { + *(*int32)(unsafe.Pointer(bp + 24 /* bDone */)) = 0 + rc = whereRangeSkipScanEst(tls, pParse, pLower, pUpper, pLoop, bp+24 /* &bDone */) + if *(*int32)(unsafe.Pointer(bp + 24 /* bDone */)) != 0 { + return rc + } + } + } + + nNew = whereRangeAdjust(tls, pLower, int16(nOut)) + nNew = whereRangeAdjust(tls, pUpper, nNew) + + // TUNING: If there is both an upper and lower limit and neither limit + // has an application-defined likelihood(), assume the range is + // reduced by an additional 75%. This means that, by default, an open-ended + // range query (e.g. col > ?) is assumed to match 1/4 of the rows in the + // index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to + // match 1/64 of the index. + if (((pLower != 0) && (int32((*WhereTerm)(unsafe.Pointer(pLower)).FtruthProb) > 0)) && (pUpper != 0)) && (int32((*WhereTerm)(unsafe.Pointer(pUpper)).FtruthProb) > 0) { + nNew = int16(int32(nNew) - (20)) + } + + nOut = nOut - ((libc.Bool32(pLower != uintptr(0))) + (libc.Bool32(pUpper != uintptr(0)))) + if int32(nNew) < 10 { + nNew = int16(10) + } + if int32(nNew) < nOut { + nOut = int32(nNew) + } + (*WhereLoop)(unsafe.Pointer(pLoop)).FnOut = LogEst(nOut) + return rc +} + +// Estimate the number of rows that will be returned based on +// an equality constraint x=VALUE and where that VALUE occurs in +// the histogram data. This only works when x is the left-most +// column of an index and sqlite_stat4 histogram data is available +// for that index. When pExpr==NULL that means the constraint is +// "x IS NULL" instead of "x=VALUE". +// +// Write the estimated row count into *pnRow and return SQLITE_OK. +// If unable to make an estimate, leave *pnRow unchanged and return +// non-zero. +// +// This routine can fail if it is unable to load a collating sequence +// required for string comparison, or if unable to allocate memory +// for a UTF conversion required for comparison. The error is stored +// in the pParse structure. +func whereEqualScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pExpr uintptr, pnRow uintptr) int32 { /* sqlite3.c:150919:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var p uintptr = *(*uintptr)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + var nEq int32 = int32(*(*U16)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + 24 /* &.u */ /* &.btree */ /* &.nEq */))) + *(*uintptr)(unsafe.Pointer(bp /* pRec */)) = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec + var rc int32 // Subfunction return code + // var a [2]TRowcnt at bp+12, 8 + // Statistics + // var bOk int32 at bp+8, 4 + + // If values are not available for all fields of the index to the left + // of this one, no estimate can be made. Return SQLITE_NOTFOUND. + if (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid < (nEq - 1) { + return SQLITE_NOTFOUND + } + + // This is an optimization only. The call to sqlite3Stat4ProbeSetValue() + // below would return the same value. + if nEq >= int32((*Index)(unsafe.Pointer(p)).FnColumn) { + *(*TRowcnt)(unsafe.Pointer(pnRow)) = TRowcnt(1) + return SQLITE_OK + } + + rc = Xsqlite3Stat4ProbeSetValue(tls, pParse, p, bp /* &pRec */, pExpr, 1, (nEq - 1), bp+8 /* &bOk */) + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = *(*uintptr)(unsafe.Pointer(bp /* pRec */)) + if rc != SQLITE_OK { + return rc + } + if *(*int32)(unsafe.Pointer(bp + 8 /* bOk */)) == 0 { + return SQLITE_NOTFOUND + } + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nEq + + whereKeyStats(tls, pParse, p, *(*uintptr)(unsafe.Pointer(bp /* pRec */)), 0, bp+12 /* &a[0] */) + + *(*TRowcnt)(unsafe.Pointer(pnRow)) = *(*TRowcnt)(unsafe.Pointer(bp + 12 /* &a[0] */ + 1*4)) + + return rc +} + +// Estimate the number of rows that will be returned based on +// an IN constraint where the right-hand side of the IN operator +// is a list of values. Example: +// +// WHERE x IN (1,2,3,4) +// +// Write the estimated row count into *pnRow and return SQLITE_OK. +// If unable to make an estimate, leave *pnRow unchanged and return +// non-zero. +// +// This routine can fail if it is unable to load a collating sequence +// required for string comparison, or if unable to allocate memory +// for a UTF conversion required for comparison. The error is stored +// in the pParse structure. +func whereInScanEst(tls *libc.TLS, pParse uintptr, pBuilder uintptr, pList uintptr, pnRow uintptr) int32 { /* sqlite3.c:150983:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = *(*uintptr)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + var nRow0 I64 = I64(Xsqlite3LogEstToInt(tls, *(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(p)).FaiRowLogEst)))) + var nRecValid int32 = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid + var rc int32 = SQLITE_OK // Subfunction return code + // var nEst TRowcnt at bp, 4 + // Number of rows for a single term + var nRowEst TRowcnt = TRowcnt(0) // New estimate of the number of rows + var i int32 // Loop counter + + for i = 0; (rc == SQLITE_OK) && (i < (*ExprList)(unsafe.Pointer(pList)).FnExpr); i++ { + *(*TRowcnt)(unsafe.Pointer(bp /* nEst */)) = TRowcnt(nRow0) + rc = whereEqualScanEst(tls, pParse, pBuilder, (*ExprList_item)(unsafe.Pointer((pList+8 /* &.a */)+uintptr(i)*32)).FpExpr, bp /* &nEst */) + nRowEst = nRowEst + (*(*TRowcnt)(unsafe.Pointer(bp /* nEst */))) + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nRecValid + } + + if rc == SQLITE_OK { + if I64(nRowEst) > nRow0 { + nRowEst = TRowcnt(nRow0) + } + *(*TRowcnt)(unsafe.Pointer(pnRow)) = nRowEst + + } + + return rc +} + +// Convert bulk memory into a valid WhereLoop that can be passed +// to whereLoopClear harmlessly. +func whereLoopInit(tls *libc.TLS, p uintptr) { /* sqlite3.c:151129:13: */ + (*WhereLoop)(unsafe.Pointer(p)).FaLTerm = p + 72 /* &.aLTermSpace */ + (*WhereLoop)(unsafe.Pointer(p)).FnLTerm = U16(0) + (*WhereLoop)(unsafe.Pointer(p)).FnLSlot = U16((int32(uint64(unsafe.Sizeof([3]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))))) + (*WhereLoop)(unsafe.Pointer(p)).FwsFlags = U32(0) +} + +// Clear the WhereLoop.u union. Leave WhereLoop.pLTerm intact. +func whereLoopClearUnion(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:151139:13: */ + if ((*WhereLoop)(unsafe.Pointer(p)).FwsFlags & (U32(WHERE_VIRTUALTABLE | WHERE_AUTO_INDEX))) != 0 { + if (((*WhereLoop)(unsafe.Pointer(p)).FwsFlags & U32(WHERE_VIRTUALTABLE)) != U32(0)) && (*(*U8)(unsafe.Pointer((p + 24 /* &.u */ /* &.vtab */) + 4 /* &.needFree */)) != 0) { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */))) + *(*U8)(unsafe.Pointer(p + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) = U8(0) + *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)) = uintptr(0) + } else if (((*WhereLoop)(unsafe.Pointer(p)).FwsFlags & U32(WHERE_AUTO_INDEX)) != U32(0)) && (*(*uintptr)(unsafe.Pointer((p + 24 /* &.u */ /* &.btree */) + 8 /* &.pIndex */)) != uintptr(0)) { + Xsqlite3DbFree(tls, db, (*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)))).FzColAff) + Xsqlite3DbFreeNN(tls, db, *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */))) + *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = uintptr(0) + } + } +} + +// Deallocate internal memory used by a WhereLoop object +func whereLoopClear(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:151156:13: */ + if (*WhereLoop)(unsafe.Pointer(p)).FaLTerm != p+72 /* &.aLTermSpace */ { + Xsqlite3DbFreeNN(tls, db, (*WhereLoop)(unsafe.Pointer(p)).FaLTerm) + } + whereLoopClearUnion(tls, db, p) + whereLoopInit(tls, p) +} + +// Increase the memory allocation for pLoop->aLTerm[] to be at least n. +func whereLoopResize(tls *libc.TLS, db uintptr, p uintptr, n int32) int32 { /* sqlite3.c:151165:12: */ + var paNew uintptr + if int32((*WhereLoop)(unsafe.Pointer(p)).FnLSlot) >= n { + return SQLITE_OK + } + n = ((n + 7) & libc.CplInt32(7)) + paNew = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(n)))) + if paNew == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, paNew, (*WhereLoop)(unsafe.Pointer(p)).FaLTerm, (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*WhereLoop)(unsafe.Pointer(p)).FnLSlot))) + if (*WhereLoop)(unsafe.Pointer(p)).FaLTerm != p+72 /* &.aLTermSpace */ { + Xsqlite3DbFreeNN(tls, db, (*WhereLoop)(unsafe.Pointer(p)).FaLTerm) + } + (*WhereLoop)(unsafe.Pointer(p)).FaLTerm = paNew + (*WhereLoop)(unsafe.Pointer(p)).FnLSlot = U16(n) + return SQLITE_OK +} + +// Transfer content from the second pLoop into the first. +func whereLoopXfer(tls *libc.TLS, db uintptr, pTo uintptr, pFrom uintptr) int32 { /* sqlite3.c:151181:12: */ + whereLoopClearUnion(tls, db, pTo) + if whereLoopResize(tls, db, pTo, int32((*WhereLoop)(unsafe.Pointer(pFrom)).FnLTerm)) != 0 { + libc.Xmemset(tls, pTo, 0, uint64((uintptr(0) + 48 /* &.nLSlot */))) + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, pTo, pFrom, uint64((uintptr(0) + 48 /* &.nLSlot */))) + libc.Xmemcpy(tls, (*WhereLoop)(unsafe.Pointer(pTo)).FaLTerm, (*WhereLoop)(unsafe.Pointer(pFrom)).FaLTerm, (uint64((*WhereLoop)(unsafe.Pointer(pTo)).FnLTerm) * uint64(unsafe.Sizeof(uintptr(0))))) + if ((*WhereLoop)(unsafe.Pointer(pFrom)).FwsFlags & U32(WHERE_VIRTUALTABLE)) != 0 { + *(*U8)(unsafe.Pointer(pFrom + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) = U8(0) + } else if ((*WhereLoop)(unsafe.Pointer(pFrom)).FwsFlags & U32(WHERE_AUTO_INDEX)) != U32(0) { + *(*uintptr)(unsafe.Pointer(pFrom + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = uintptr(0) + } + return SQLITE_OK +} + +// Delete a WhereLoop object +func whereLoopDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:151200:13: */ + whereLoopClear(tls, db, p) + Xsqlite3DbFreeNN(tls, db, p) +} + +// Free a WhereInfo structure +func whereInfoFree(tls *libc.TLS, db uintptr, pWInfo uintptr) { /* sqlite3.c:151208:13: */ + var i int32 + + for i = 0; i < int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel); i++ { + var pLevel uintptr = ((pWInfo + 856 /* &.a */) + uintptr(i)*88) + if ((*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop != 0) && (((*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FwsFlags & U32(WHERE_IN_ABLE)) != 0) { + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ + 8 /* &.aInLoop */))) + } + } + Xsqlite3WhereClauseClear(tls, (pWInfo + 104 /* &.sWC */)) + for (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops != 0 { + var p uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops = (*WhereLoop)(unsafe.Pointer(p)).FpNextLoop + whereLoopDelete(tls, db, p) + } + + Xsqlite3DbFreeNN(tls, db, pWInfo) +} + +// Undo all Expr node modifications +func whereUndoExprMods(tls *libc.TLS, pWInfo uintptr) { /* sqlite3.c:151229:13: */ + for (*WhereInfo)(unsafe.Pointer(pWInfo)).FpExprMods != 0 { + var p uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpExprMods + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpExprMods = (*WhereExprMod)(unsafe.Pointer(p)).FpNext + libc.Xmemcpy(tls, (*WhereExprMod)(unsafe.Pointer(p)).FpExpr, (p + 16 /* &.orig */), uint64(unsafe.Sizeof(Expr{}))) + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb, p) + } +} + +// Return TRUE if all of the following are true: +// +// (1) X has the same or lower cost that Y +// (2) X uses fewer WHERE clause terms than Y +// (3) Every WHERE clause term used by X is also used by Y +// (4) X skips at least as many columns as Y +// (5) If X is a covering index, than Y is too +// +// Conditions (2) and (3) mean that X is a "proper subset" of Y. +// If X is a proper subset of Y then Y is a better choice and ought +// to have a lower cost. This routine returns TRUE when that cost +// relationship is inverted and needs to be adjusted. Constraint (4) +// was added because if X uses skip-scan less than Y it still might +// deserve a lower cost even if it is a proper subset of Y. Constraint (5) +// was added because a covering index probably deserves to have a lower cost +// than a non-covering index even if it is a proper subset. +func whereLoopCheaperProperSubset(tls *libc.TLS, pX uintptr, pY uintptr) int32 { /* sqlite3.c:151256:12: */ + var i int32 + var j int32 + if (int32((*WhereLoop)(unsafe.Pointer(pX)).FnLTerm) - int32((*WhereLoop)(unsafe.Pointer(pX)).FnSkip)) >= (int32((*WhereLoop)(unsafe.Pointer(pY)).FnLTerm) - int32((*WhereLoop)(unsafe.Pointer(pY)).FnSkip)) { + return 0 // X is not a subset of Y + } + if int32((*WhereLoop)(unsafe.Pointer(pY)).FnSkip) > int32((*WhereLoop)(unsafe.Pointer(pX)).FnSkip) { + return 0 + } + if int32((*WhereLoop)(unsafe.Pointer(pX)).FrRun) >= int32((*WhereLoop)(unsafe.Pointer(pY)).FrRun) { + if int32((*WhereLoop)(unsafe.Pointer(pX)).FrRun) > int32((*WhereLoop)(unsafe.Pointer(pY)).FrRun) { + return 0 + } // X costs more than Y + if int32((*WhereLoop)(unsafe.Pointer(pX)).FnOut) > int32((*WhereLoop)(unsafe.Pointer(pY)).FnOut) { + return 0 + } // X costs more than Y + } + for i = (int32((*WhereLoop)(unsafe.Pointer(pX)).FnLTerm) - 1); i >= 0; i-- { + if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pX)).FaLTerm + uintptr(i)*8)) == uintptr(0) { + continue + } + for j = (int32((*WhereLoop)(unsafe.Pointer(pY)).FnLTerm) - 1); j >= 0; j-- { + if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pY)).FaLTerm + uintptr(j)*8)) == *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pX)).FaLTerm + uintptr(i)*8)) { + break + } + } + if j < 0 { + return 0 + } // X not a subset of Y since term X[i] not used by Y + } + if (((*WhereLoop)(unsafe.Pointer(pX)).FwsFlags & U32(WHERE_IDX_ONLY)) != U32(0)) && + (((*WhereLoop)(unsafe.Pointer(pY)).FwsFlags & U32(WHERE_IDX_ONLY)) == U32(0)) { + return 0 // Constraint (5) + } + return 1 // All conditions meet +} + +// Try to adjust the cost of WhereLoop pTemplate upwards or downwards so +// that: +// +// (1) pTemplate costs less than any other WhereLoops that are a proper +// subset of pTemplate +// +// (2) pTemplate costs more than any other WhereLoops for which pTemplate +// is a proper subset. +// +// To say "WhereLoop X is a proper subset of Y" means that X uses fewer +// WHERE clause terms than Y and that every WHERE clause term used by X is +// also used by Y. +func whereLoopAdjustCost(tls *libc.TLS, p uintptr, pTemplate uintptr) { /* sqlite3.c:151297:13: */ + if ((*WhereLoop)(unsafe.Pointer(pTemplate)).FwsFlags & U32(WHERE_INDEXED)) == U32(0) { + return + } + for ; p != 0; p = (*WhereLoop)(unsafe.Pointer(p)).FpNextLoop { + if int32((*WhereLoop)(unsafe.Pointer(p)).FiTab) != int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FiTab) { + continue + } + if ((*WhereLoop)(unsafe.Pointer(p)).FwsFlags & U32(WHERE_INDEXED)) == U32(0) { + continue + } + if whereLoopCheaperProperSubset(tls, p, pTemplate) != 0 { + // Adjust pTemplate cost downward so that it is cheaper than its + // subset p. + + (*WhereLoop)(unsafe.Pointer(pTemplate)).FrRun = (*WhereLoop)(unsafe.Pointer(p)).FrRun + (*WhereLoop)(unsafe.Pointer(pTemplate)).FnOut = (LogEst(int32((*WhereLoop)(unsafe.Pointer(p)).FnOut) - 1)) + } else if whereLoopCheaperProperSubset(tls, pTemplate, p) != 0 { + // Adjust pTemplate cost upward so that it is costlier than p since + // pTemplate is a proper subset of p + + (*WhereLoop)(unsafe.Pointer(pTemplate)).FrRun = (*WhereLoop)(unsafe.Pointer(p)).FrRun + (*WhereLoop)(unsafe.Pointer(pTemplate)).FnOut = (LogEst(int32((*WhereLoop)(unsafe.Pointer(p)).FnOut) + 1)) + } + } +} + +// Search the list of WhereLoops in *ppPrev looking for one that can be +// replaced by pTemplate. +// +// Return NULL if pTemplate does not belong on the WhereLoop list. +// In other words if pTemplate ought to be dropped from further consideration. +// +// If pX is a WhereLoop that pTemplate can replace, then return the +// link that points to pX. +// +// If pTemplate cannot replace any existing element of the list but needs +// to be added to the list as a new entry, then return a pointer to the +// tail of the list. +func whereLoopFindLesser(tls *libc.TLS, ppPrev uintptr, pTemplate uintptr) uintptr { /* sqlite3.c:151334:18: */ + var p uintptr + p = *(*uintptr)(unsafe.Pointer(ppPrev)) +__1: + if !(p != 0) { + goto __3 + } + { + if (int32((*WhereLoop)(unsafe.Pointer(p)).FiTab) != int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FiTab)) || (int32((*WhereLoop)(unsafe.Pointer(p)).FiSortIdx) != int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FiSortIdx)) { + // If either the iTab or iSortIdx values for two WhereLoop are different + // then those WhereLoops need to be considered separately. Neither is + // a candidate to replace the other. + goto __2 + } + // In the current implementation, the rSetup value is either zero + // or the cost of building an automatic index (NlogN) and the NlogN + // is the same for compatible WhereLoops. + + // whereLoopAddBtree() always generates and inserts the automatic index + // case first. Hence compatible candidate WhereLoops never have a larger + // rSetup. Call this SETUP-INVARIANT + + // Any loop using an appliation-defined index (or PRIMARY KEY or + // UNIQUE constraint) with one or more == constraints is better + // than an automatic index. Unless it is a skip-scan. + if ((((((*WhereLoop)(unsafe.Pointer(p)).FwsFlags & U32(WHERE_AUTO_INDEX)) != U32(0)) && + ((int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FnSkip)) == 0)) && + (((*WhereLoop)(unsafe.Pointer(pTemplate)).FwsFlags & U32(WHERE_INDEXED)) != U32(0))) && + (((*WhereLoop)(unsafe.Pointer(pTemplate)).FwsFlags & U32(WHERE_COLUMN_EQ)) != U32(0))) && + (((*WhereLoop)(unsafe.Pointer(p)).Fprereq & (*WhereLoop)(unsafe.Pointer(pTemplate)).Fprereq) == (*WhereLoop)(unsafe.Pointer(pTemplate)).Fprereq) { + goto __3 + } + + // If existing WhereLoop p is better than pTemplate, pTemplate can be + // discarded. WhereLoop p is better if: + // (1) p has no more dependencies than pTemplate, and + // (2) p has an equal or lower cost than pTemplate + if (((((*WhereLoop)(unsafe.Pointer(p)).Fprereq & (*WhereLoop)(unsafe.Pointer(pTemplate)).Fprereq) == (*WhereLoop)(unsafe.Pointer(p)).Fprereq) && // (1) + (int32((*WhereLoop)(unsafe.Pointer(p)).FrSetup) <= int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FrSetup))) && // (2a) + (int32((*WhereLoop)(unsafe.Pointer(p)).FrRun) <= int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FrRun))) && // (2b) + (int32((*WhereLoop)(unsafe.Pointer(p)).FnOut) <= int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FnOut)) { + return uintptr(0) // Discard pTemplate + } + + // If pTemplate is always better than p, then cause p to be overwritten + // with pTemplate. pTemplate is better than p if: + // (1) pTemplate has no more dependences than p, and + // (2) pTemplate has an equal or lower cost than p. + if ((((*WhereLoop)(unsafe.Pointer(p)).Fprereq & (*WhereLoop)(unsafe.Pointer(pTemplate)).Fprereq) == (*WhereLoop)(unsafe.Pointer(pTemplate)).Fprereq) && // (1) + (int32((*WhereLoop)(unsafe.Pointer(p)).FrRun) >= int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FrRun))) && // (2a) + (int32((*WhereLoop)(unsafe.Pointer(p)).FnOut) >= int32((*WhereLoop)(unsafe.Pointer(pTemplate)).FnOut)) { + // SETUP-INVARIANT above + goto __3 // Cause p to be overwritten by pTemplate + } + + } + goto __2 +__2: + ppPrev = (p + 64 /* &.pNextLoop */) + p = *(*uintptr)(unsafe.Pointer(ppPrev)) + goto __1 + goto __3 +__3: + ; + return ppPrev +} + +// Insert or replace a WhereLoop entry using the template supplied. +// +// An existing WhereLoop entry might be overwritten if the new template +// is better and has fewer dependencies. Or the template will be ignored +// and no insert will occur if an existing WhereLoop is faster and has +// fewer dependencies than the template. Otherwise a new WhereLoop is +// added based on the template. +// +// If pBuilder->pOrSet is not NULL then we care about only the +// prerequisites and rRun and nOut costs of the N best loops. That +// information is gathered in the pBuilder->pOrSet object. This special +// processing mode is used only for OR clause processing. +// +// When accumulating multiple loops (when pBuilder->pOrSet is NULL) we +// still might overwrite similar loops with the new template if the +// new template is better. Loops may be overwritten if the following +// conditions are met: +// +// (1) They have the same iTab. +// (2) They have the same iSortIdx. +// (3) The template has same or fewer dependencies than the current loop +// (4) The template has the same or lower cost than the current loop +func whereLoopInsert(tls *libc.TLS, pBuilder uintptr, pTemplate uintptr) int32 { /* sqlite3.c:151422:12: */ + var ppPrev uintptr + var p uintptr + var pWInfo uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + var db uintptr = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb + var rc int32 + + // Stop the search once we hit the query planner search limit + if (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit == uint32(0) { + + if (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet != 0 { + (*WhereOrSet)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet)).Fn = U16(0) + } + return SQLITE_DONE + } + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit-- + + whereLoopAdjustCost(tls, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops, pTemplate) + + // If pBuilder->pOrSet is defined, then only keep track of the costs + // and prereqs. + if (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet != uintptr(0) { + if (*WhereLoop)(unsafe.Pointer(pTemplate)).FnLTerm != 0 { + whereOrInsert(tls, (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet, (*WhereLoop)(unsafe.Pointer(pTemplate)).Fprereq, (*WhereLoop)(unsafe.Pointer(pTemplate)).FrRun, + (*WhereLoop)(unsafe.Pointer(pTemplate)).FnOut) + } + return SQLITE_OK + } + + // Look for an existing WhereLoop to replace with pTemplate + ppPrev = whereLoopFindLesser(tls, (pWInfo + 80 /* &.pLoops */), pTemplate) + + if ppPrev == uintptr(0) { + // There already exists a WhereLoop on the list that is better + // than pTemplate, so just ignore pTemplate + return SQLITE_OK + } else { + p = *(*uintptr)(unsafe.Pointer(ppPrev)) + } + + // If we reach this point it means that either p[] should be overwritten + // with pTemplate[] if p[] exists, or if p==NULL then allocate a new + // WhereLoop and insert it. + if p == uintptr(0) { + // Allocate a new WhereLoop to add to the end of the list + *(*uintptr)(unsafe.Pointer(ppPrev)) = libc.AssignUintptr(&p, Xsqlite3DbMallocRawNN(tls, db, uint64(unsafe.Sizeof(WhereLoop{})))) + if p == uintptr(0) { + return SQLITE_NOMEM + } + whereLoopInit(tls, p) + (*WhereLoop)(unsafe.Pointer(p)).FpNextLoop = uintptr(0) + } else { + // We will be overwriting WhereLoop p[]. But before we do, first + // go through the rest of the list and delete any other entries besides + // p[] that are also supplated by pTemplate + var ppTail uintptr = (p + 64 /* &.pNextLoop */) + var pToDel uintptr + for *(*uintptr)(unsafe.Pointer(ppTail)) != 0 { + ppTail = whereLoopFindLesser(tls, ppTail, pTemplate) + if ppTail == uintptr(0) { + break + } + pToDel = *(*uintptr)(unsafe.Pointer(ppTail)) + if pToDel == uintptr(0) { + break + } + *(*uintptr)(unsafe.Pointer(ppTail)) = (*WhereLoop)(unsafe.Pointer(pToDel)).FpNextLoop + whereLoopDelete(tls, db, pToDel) + } + } + rc = whereLoopXfer(tls, db, p, pTemplate) + if ((*WhereLoop)(unsafe.Pointer(p)).FwsFlags & U32(WHERE_VIRTUALTABLE)) == U32(0) { + var pIndex uintptr = *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + if (pIndex != 0) && ((int32(*(*uint16)(unsafe.Pointer(pIndex + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_IPK) { + *(*uintptr)(unsafe.Pointer(p + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = uintptr(0) + } + } + return rc +} + +// Adjust the WhereLoop.nOut value downward to account for terms of the +// WHERE clause that reference the loop but which are not used by an +// index. +// +// For every WHERE clause term that is not used by the index +// and which has a truth probability assigned by one of the likelihood(), +// likely(), or unlikely() SQL functions, reduce the estimated number +// of output rows by the probability specified. +// +// TUNING: For every WHERE clause term that is not used by the index +// and which does not have an assigned truth probability, heuristics +// described below are used to try to estimate the truth probability. +// TODO --> Perhaps this is something that could be improved by better +// table statistics. +// +// Heuristic 1: Estimate the truth probability as 93.75%. The 93.75% +// value corresponds to -1 in LogEst notation, so this means decrement +// the WhereLoop.nOut field for every such WHERE clause term. +// +// Heuristic 2: If there exists one or more WHERE clause terms of the +// form "x==EXPR" and EXPR is not a constant 0 or 1, then make sure the +// final output row estimate is no greater than 1/4 of the total number +// of rows in the table. In other words, assume that x==EXPR will filter +// out at least 3 out of 4 rows. If EXPR is -1 or 0 or 1, then maybe the +// "x" column is boolean or else -1 or 0 or 1 is a common default value +// on the "x" column and so in that case only cap the output row estimate +// at 1/2 instead of 1/4. +func whereLoopOutputAdjust(tls *libc.TLS, pWC uintptr, pLoop uintptr, nRow LogEst) { /* sqlite3.c:151559:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pTerm uintptr + var pX uintptr + var notAllowed Bitmask = ^((*WhereLoop)(unsafe.Pointer(pLoop)).Fprereq | (*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) + var i int32 + var j int32 + var iReduce LogEst = int16(0) // pLoop->nOut should not exceed nRow-iReduce + + i = (*WhereClause)(unsafe.Pointer(pWC)).FnTerm + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__1: + if !(i > 0) { + goto __3 + } + { + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VIRTUAL) != 0 { + goto __3 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & (*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) == uint64(0) { + goto __2 + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & notAllowed) != uint64(0) { + goto __2 + } + for j = (int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) - 1); j >= 0; j-- { + pX = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) + if pX == uintptr(0) { + continue + } + if pX == pTerm { + break + } + if ((*WhereTerm)(unsafe.Pointer(pX)).FiParent >= 0) && (((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*WhereTerm)(unsafe.Pointer(pX)).FiParent)*56) == pTerm) { + break + } + } + if j < 0 { + if int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 { + // If a truth probability is specified using the likelihood() hints, + // then use the probability provided by the application. + *(*LogEst)(unsafe.Pointer(pLoop + 22 /* &.nOut */)) += LogEst((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb))) + } else { + // In the absence of explicit truth probabilities, use heuristics to + // guess a reasonable truth probability. + (*WhereLoop)(unsafe.Pointer(pLoop)).FnOut-- + if ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (WO_EQ | WO_IS)) != 0) && + ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_HIGHTRUTH) == 0) { + var pRight uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + *(*int32)(unsafe.Pointer(bp /* k */)) = 0 + + if ((Xsqlite3ExprIsInteger(tls, pRight, bp /* &k */) != 0) && (*(*int32)(unsafe.Pointer(bp /* k */)) >= (-1))) && (*(*int32)(unsafe.Pointer(bp /* k */)) <= 1) { + *(*int32)(unsafe.Pointer(bp /* k */)) = 10 + } else { + *(*int32)(unsafe.Pointer(bp /* k */)) = 20 + } + if int32(iReduce) < *(*int32)(unsafe.Pointer(bp /* k */)) { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_HEURTRUTH)) + iReduce = LogEst(*(*int32)(unsafe.Pointer(bp /* k */))) + } + } + } + } + + } + goto __2 +__2: + i-- + pTerm += 56 + goto __1 + goto __3 +__3: + ; + if int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnOut) > (int32(nRow) - int32(iReduce)) { + (*WhereLoop)(unsafe.Pointer(pLoop)).FnOut = (LogEst(int32(nRow) - int32(iReduce))) + } +} + +// Term pTerm is a vector range comparison operation. The first comparison +// in the vector can be optimized using column nEq of the index. This +// function returns the total number of vector elements that can be used +// as part of the range comparison. +// +// For example, if the query is: +// +// WHERE a = ? AND (b, c, d) > (?, ?, ?) +// +// and the index: +// +// CREATE INDEX ... ON (a, b, c, d, e) +// +// then this function would be invoked with nEq=1. The value returned in +// this case is 3. +func whereRangeVectorLen(tls *libc.TLS, pParse uintptr, iCur int32, pIdx uintptr, nEq int32, pTerm uintptr) int32 { /* sqlite3.c:151629:12: */ + var nCmp int32 = Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft) + var i int32 + + nCmp = func() int32 { + if (nCmp) < (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) - nEq) { + return nCmp + } + return (int32((*Index)(unsafe.Pointer(pIdx)).FnColumn) - nEq) + }() + for i = 1; i < nCmp; i++ { + // Test if comparison i of pTerm is compatible with column (i+nEq) + // of the index. If not, exit the loop. + var aff int8 // Comparison affinity + var idxaff int8 = int8(0) // Indexed columns affinity + var pColl uintptr // Comparison collation sequence + var pLhs uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpLeft + 32 /* &.x */)) + 8 /* &.a */) + uintptr(i)*32)).FpExpr + var pRhs uintptr = (*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FpRight + if ((*Expr)(unsafe.Pointer(pRhs)).Fflags & U32(EP_xIsSelect)) != 0 { + pRhs = (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pRhs + 32 /* &.x */)))).FpEList + 8 /* &.a */) + uintptr(i)*32)).FpExpr + } else { + pRhs = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pRhs + 32 /* &.x */)) + 8 /* &.a */) + uintptr(i)*32)).FpExpr + } + + // Check that the LHS of the comparison is a column reference to + // the right column of the right source table. And that the sort + // order of the index column is the same as the sort order of the + // leftmost index column. + if (((int32((*Expr)(unsafe.Pointer(pLhs)).Fop) != TK_COLUMN) || + ((*Expr)(unsafe.Pointer(pLhs)).FiTable != iCur)) || + (int32((*Expr)(unsafe.Pointer(pLhs)).FiColumn) != int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr((i+nEq))*2))))) || + (int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr((i + nEq))))) != int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(nEq))))) { + break + } + + aff = Xsqlite3CompareAffinity(tls, pRhs, Xsqlite3ExprAffinity(tls, pLhs)) + idxaff = Xsqlite3TableColumnAffinity(tls, (*Index)(unsafe.Pointer(pIdx)).FpTable, int32((*Expr)(unsafe.Pointer(pLhs)).FiColumn)) + if int32(aff) != int32(idxaff) { + break + } + + pColl = Xsqlite3BinaryCompareCollSeq(tls, pParse, pLhs, pRhs) + if pColl == uintptr(0) { + break + } + if Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pColl)).FzName, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr((i+nEq))*8))) != 0 { + break + } + } + return i +} + +// Adjust the cost C by the costMult facter T. This only occurs if +// compiled with -DSQLITE_ENABLE_COSTMULT + +// We have so far matched pBuilder->pNew->u.btree.nEq terms of the +// index pIndex. Try to match one more. +// +// When this function is called, pBuilder->pNew->nOut contains the +// number of rows expected to be visited by filtering using the nEq +// terms only. If it is modified, this value is restored before this +// function returns. +// +// If pProbe->idxType==SQLITE_IDXTYPE_IPK, that means pIndex is +// a fake index used for the INTEGER PRIMARY KEY. +func whereLoopAddBtreeIndex(tls *libc.TLS, pBuilder uintptr, pSrc uintptr, pProbe uintptr, nInMul LogEst) int32 { /* sqlite3.c:151700:12: */ + bp := tls.Alloc(116) + defer tls.Free(116) + + var pWInfo uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo // WHERE analyse context + var pParse uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse // Parsing context + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection malloc context + var pNew uintptr // Template WhereLoop under construction + var pTerm uintptr // A WhereTerm under consideration + var opMask int32 // Valid operators for constraints + // var scan WhereScan at bp, 112 + // Iterator for WHERE terms + var saved_prereq Bitmask // Original value of pNew->prereq + var saved_nLTerm U16 // Original value of pNew->nLTerm + var saved_nEq U16 // Original value of pNew->u.btree.nEq + var saved_nBtm U16 // Original value of pNew->u.btree.nBtm + var saved_nTop U16 // Original value of pNew->u.btree.nTop + var saved_nSkip U16 // Original value of pNew->nSkip + var saved_wsFlags U32 // Original value of pNew->wsFlags + var saved_nOut LogEst // Original value of pNew->nOut + var rc int32 = SQLITE_OK // Return code + var rSize LogEst // Number of rows in the table + var rLogSize LogEst // Logarithm of table size + var pTop uintptr = uintptr(0) + var pBtm uintptr = uintptr(0) // Top and bottom range constraints + + pNew = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + return SQLITE_NOMEM + } + + if ((*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { + opMask = ((int32(WO_EQ) << (TK_LT - TK_EQ)) | (int32(WO_EQ) << (TK_LE - TK_EQ))) + } else { + + opMask = (((((((WO_EQ | WO_IN) | (int32(WO_EQ) << (TK_GT - TK_EQ))) | (int32(WO_EQ) << (TK_GE - TK_EQ))) | (int32(WO_EQ) << (TK_LT - TK_EQ))) | (int32(WO_EQ) << (TK_LE - TK_EQ))) | WO_ISNULL) | WO_IS) + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.bUnordered */)) & 0x4 >> 2))) != 0 { + opMask = opMask & (libc.CplInt32(((((int32(WO_EQ) << (TK_GT - TK_EQ)) | (int32(WO_EQ) << (TK_GE - TK_EQ))) | (int32(WO_EQ) << (TK_LT - TK_EQ))) | (int32(WO_EQ) << (TK_LE - TK_EQ))))) + } + + saved_nEq = *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)) + saved_nBtm = *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)) + saved_nTop = *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) + saved_nSkip = (*WhereLoop)(unsafe.Pointer(pNew)).FnSkip + saved_nLTerm = (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm + saved_wsFlags = (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags + saved_prereq = (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq + saved_nOut = (*WhereLoop)(unsafe.Pointer(pNew)).FnOut + pTerm = whereScanInit(tls, bp /* &scan */, (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC, (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor, int32(saved_nEq), + uint32(opMask), pProbe) + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(0) + rSize = *(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst)) + rLogSize = estLog(tls, rSize) + for ; (rc == SQLITE_OK) && (pTerm != uintptr(0)); pTerm = whereScanNext(tls, bp /* &scan */) { + var eOp U16 = (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator // Shorthand for pTerm->eOperator + var rCostIdx LogEst + var nOutUnadjusted LogEst // nOut before IN() and WHERE adjustments + var nIn int32 = 0 + var nRecValid int32 = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid + if ((int32(eOp) == WO_ISNULL) || ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VNULL) != 0)) && + (indexColumnNotNull(tls, pProbe, int32(saved_nEq)) != 0) { + continue // ignore IS [NOT] NULL constraints on NOT NULL columns + } + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & (*WhereLoop)(unsafe.Pointer(pNew)).FmaskSelf) != 0 { + continue + } + + // Do not allow the upper bound of a LIKE optimization range constraint + // to mix with a lower range bound from some other source + if ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_LIKEOPT) != 0) && (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) == (int32(WO_EQ) << (TK_LT - TK_EQ))) { + continue + } + + // tag-20191211-001: Do not allow constraints from the WHERE clause to + // be used by the right table of a LEFT JOIN. Only constraints in the + // ON clause are allowed. See tag-20191211-002 for the vtab equivalent. + if ((int32((*SrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype) & JT_LEFT) != 0) && + !(((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) { + continue + } + + if (int32((*Index)(unsafe.Pointer((pProbe))).FonError) != OE_None) && (int32(saved_nEq) == (int32((*Index)(unsafe.Pointer(pProbe)).FnKeyCol) - 1)) { + *(*uint8)(unsafe.Pointer(pBuilder + 52 /* &.bldFlags1 */)) |= uint8((SQLITE_BLDF1_UNIQUE)) + } else { + *(*uint8)(unsafe.Pointer(pBuilder + 52 /* &.bldFlags1 */)) |= uint8((SQLITE_BLDF1_INDEXED)) + } + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = saved_wsFlags + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = saved_nEq + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)) = saved_nBtm + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) = saved_nTop + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = saved_nLTerm + if whereLoopResize(tls, db, pNew, (int32((*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+1)) != 0 { + break + } // OOM + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(libc.PostIncUint16(&(*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm, 1))*8)) = pTerm + (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq = ((saved_prereq | (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight) & ^(*WhereLoop)(unsafe.Pointer(pNew)).FmaskSelf) + + if (int32(eOp) & WO_IN) != 0 { + var pExpr uintptr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { + // "x IN (SELECT ...)": TUNING: the SELECT returns 25 rows + var i int32 + nIn = 46 + + // The expression may actually be of the form (x, y) IN (SELECT...). + // In this case there is a separate term for each of (x) and (y). + // However, the nIn multiplier should only be applied once, not once + // for each such term. The following loop checks that pTerm is the + // first such term in use, and sets nIn back to 0 if it is not. + for i = 0; i < (int32((*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm) - 1); i++ { + if (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) != 0) && ((*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)))).FpExpr == pExpr) { + nIn = 0 + } + } + } else if (*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) != 0) && ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FnExpr != 0) { + // "x IN (value, value, ...)" + nIn = int32(Xsqlite3LogEst(tls, uint64((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FnExpr))) + } + if ((uint32(int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.hasStat1 */)) & 0x80 >> 7))) != 0) && (int32(rLogSize) >= 10) { + var M LogEst + var logK LogEst + var x LogEst + // Let: + // N = the total number of rows in the table + // K = the number of entries on the RHS of the IN operator + // M = the number of rows in the table that match terms to the + // to the left in the same index. If the IN operator is on + // the left-most index column, M==N. + // + // Given the definitions above, it is better to omit the IN operator + // from the index lookup and instead do a scan of the M elements, + // testing each scanned row against the IN operator separately, if: + // + // M*log(K) < K*log(N) + // + // Our estimates for M, K, and N might be inaccurate, so we build in + // a safety margin of 2 (LogEst: 10) that favors using the IN operator + // with the index, as using an index has better worst-case behavior. + // If we do not have real sqlite_stat1 data, always prefer to use + // the index. Do not bother with this optimization on very small + // tables (less than 2 rows) as it is pointless in that case. + M = *(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(saved_nEq)*2)) + logK = estLog(tls, int16(nIn)) + // TUNING v----- 10 to bias toward indexed IN + x = (LogEst(((int32(M) + int32(logK)) + 10) - (nIn + int32(rLogSize)))) + if int32(x) >= 0 { + + } else if (int32(nInMul) < 2) && (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_SeekScan))) == U32(0)) { + + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_IN_SEEKSCAN)) + } else { + + continue + } + } + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_COLUMN_IN)) + } else if (int32(eOp) & (WO_EQ | WO_IS)) != 0 { + var iCol int32 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiColumn + uintptr(saved_nEq)*2))) + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_COLUMN_EQ)) + + if (iCol == (-1)) || + (((iCol >= 0) && (int32(nInMul) == 0)) && (int32(saved_nEq) == (int32((*Index)(unsafe.Pointer(pProbe)).FnKeyCol) - 1))) { + if ((iCol == (-1)) || ((uint32(int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0)) || + (((int32((*Index)(unsafe.Pointer(pProbe)).FnKeyCol) == 1) && ((*Index)(unsafe.Pointer(pProbe)).FonError != 0)) && (int32(eOp) == WO_EQ)) { + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_ONEROW)) + } else { + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_UNQ_WANTED)) + } + } + if int32((*WhereScan)(unsafe.Pointer(bp /* &scan */)).FiEquiv) > 1 { + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_TRANSCONS)) + } + } else if (int32(eOp) & WO_ISNULL) != 0 { + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_COLUMN_NULL)) + } else if (int32(eOp) & ((int32(WO_EQ) << (TK_GT - TK_EQ)) | (int32(WO_EQ) << (TK_GE - TK_EQ)))) != 0 { + + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_COLUMN_RANGE | WHERE_BTM_LIMIT)) + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)) = U16(whereRangeVectorLen(tls, + pParse, (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor, pProbe, int32(saved_nEq), pTerm)) + pBtm = pTerm + pTop = uintptr(0) + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_LIKEOPT) != 0 { + // Range constraints that come from the LIKE optimization are + // always used in pairs. + pTop = (pTerm + 1*56) + + if whereLoopResize(tls, db, pNew, (int32((*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+1)) != 0 { + break + } // OOM + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(libc.PostIncUint16(&(*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm, 1))*8)) = pTop + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_TOP_LIMIT)) + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) = U16(1) + } + } else { + + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_COLUMN_RANGE | WHERE_TOP_LIMIT)) + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) = U16(whereRangeVectorLen(tls, + pParse, (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor, pProbe, int32(saved_nEq), pTerm)) + pTop = pTerm + if ((*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags & U32(WHERE_BTM_LIMIT)) != U32(0) { + pBtm = *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr((int32((*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm)-2))*8)) + } else { + pBtm = uintptr(0) + } + } + + // At this point pNew->nOut is set to the number of rows expected to + // be visited by the index scan before considering term pTerm, or the + // values of nIn and nInMul. In other words, assuming that all + // "x IN(...)" terms are replaced with "x = ?". This block updates + // the value of pNew->nOut to account for pTerm (but not nIn/nInMul). + + if ((*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags & U32(WHERE_COLUMN_RANGE)) != 0 { + // Adjust nOut using stat4 data. Or, if there is no stat4 + // data, using some other estimate. + whereRangeScanEst(tls, pParse, pBuilder, pBtm, pTop, pNew) + } else { + var nEq int32 = int32(libc.PreIncUint16(&*(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)), 1)) + + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0) && (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiColumn + uintptr(saved_nEq)*2))) >= 0) { + + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) += LogEst((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb))) + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) -= LogEst((nIn)) + } else { + *(*TRowcnt)(unsafe.Pointer(bp + 112 /* nOut */)) = TRowcnt(0) + if ((((int32(nInMul) == 0) && + ((*Index)(unsafe.Pointer(pProbe)).FnSample != 0)) && + (int32(*(*U16)(unsafe.Pointer((pNew + 24 /* &.u */ /* &.btree */) /* &.nEq */))) <= (*Index)(unsafe.Pointer(pProbe)).FnSampleCol)) && + (((int32(eOp) & WO_IN) == 0) || !(((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0)))) && + (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0)) { + var pExpr uintptr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if (int32(eOp) & ((WO_EQ | WO_ISNULL) | WO_IS)) != 0 { + + rc = whereEqualScanEst(tls, pParse, pBuilder, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+112 /* &nOut */) + } else { + rc = whereInScanEst(tls, pParse, pBuilder, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)), bp+112 /* &nOut */) + } + if rc == SQLITE_NOTFOUND { + rc = SQLITE_OK + } + if rc != SQLITE_OK { + break + } // Jump out of the pTerm loop + if *(*TRowcnt)(unsafe.Pointer(bp + 112 /* nOut */)) != 0 { + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = Xsqlite3LogEst(tls, uint64(*(*TRowcnt)(unsafe.Pointer(bp + 112 /* nOut */)))) + if (nEq == 1) && + // TUNING: Mark terms as "low selectivity" if they seem likely + // to be true for half or more of the rows in the table. + // See tag-202002240-1 + ((int32((*WhereLoop)(unsafe.Pointer(pNew)).FnOut) + 10) > int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst)))) { + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_HIGHTRUTH)) + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_HEURTRUTH) != 0 { + // If the term has previously been used with an assumption of + // higher selectivity, then set the flag to rerun the + // loop computations. + *(*uint8)(unsafe.Pointer(pBuilder + 53 /* &.bldFlags2 */)) |= uint8((SQLITE_BLDF2_2NDPASS)) + } + } + if int32((*WhereLoop)(unsafe.Pointer(pNew)).FnOut) > int32(saved_nOut) { + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + } + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) -= LogEst((nIn)) + } + } + if *(*TRowcnt)(unsafe.Pointer(bp + 112 /* nOut */)) == TRowcnt(0) { + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) += LogEst((int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(nEq)*2))) - int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr((nEq-1))*2))))) + if (int32(eOp) & WO_ISNULL) != 0 { + // TUNING: If there is no likelihood() value, assume that a + // "col IS NULL" expression matches twice as many rows + // as (col=?). + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) += int16((10)) + } + } + } + } + + // Set rCostIdx to the cost of visiting selected rows in index. Add + // it to pNew->rRun, which is currently set to the cost of the index + // seek only. Then, if this is a non-covering index, add the cost of + // visiting the rows in the main table. + + rCostIdx = (LogEst((int32((*WhereLoop)(unsafe.Pointer(pNew)).FnOut) + 1) + ((15 * int32((*Index)(unsafe.Pointer(pProbe)).FszIdxRow)) / int32((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FszTabRow)))) + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = Xsqlite3LogEstAdd(tls, rLogSize, rCostIdx) + if ((*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags & (U32(WHERE_IDX_ONLY | WHERE_IPK))) == U32(0) { + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = Xsqlite3LogEstAdd(tls, (*WhereLoop)(unsafe.Pointer(pNew)).FrRun, (int16(int32((*WhereLoop)(unsafe.Pointer(pNew)).FnOut) + 16))) + } + + nOutUnadjusted = (*WhereLoop)(unsafe.Pointer(pNew)).FnOut + *(*LogEst)(unsafe.Pointer(pNew + 20 /* &.rRun */)) += LogEst((int32(nInMul) + nIn)) + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) += LogEst((int32(nInMul) + nIn)) + whereLoopOutputAdjust(tls, (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC, pNew, rSize) + rc = whereLoopInsert(tls, pBuilder, pNew) + + if ((*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags & U32(WHERE_COLUMN_RANGE)) != 0 { + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + } else { + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = nOutUnadjusted + } + + if ((((*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags & U32(WHERE_TOP_LIMIT)) == U32(0)) && + (int32(*(*U16)(unsafe.Pointer((pNew + 24 /* &.u */ /* &.btree */) /* &.nEq */))) < int32((*Index)(unsafe.Pointer(pProbe)).FnColumn))) && + ((int32(*(*U16)(unsafe.Pointer((pNew + 24 /* &.u */ /* &.btree */) /* &.nEq */))) < int32((*Index)(unsafe.Pointer(pProbe)).FnKeyCol)) || ((int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.idxType */)) & 0x3 >> 0)) != SQLITE_IDXTYPE_PRIMARYKEY)) { + whereLoopAddBtreeIndex(tls, pBuilder, pSrc, pProbe, (int16(int32(nInMul) + nIn))) + } + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = nRecValid + } + (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq = saved_prereq + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = saved_nEq + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)) = saved_nBtm + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) = saved_nTop + (*WhereLoop)(unsafe.Pointer(pNew)).FnSkip = saved_nSkip + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = saved_wsFlags + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = saved_nLTerm + + // Consider using a skip-scan if there are no WHERE clause constraints + // available for the left-most terms of the index, and if the average + // number of repeats in the left-most terms is at least 18. + // + // The magic number 18 is selected on the basis that scanning 17 rows + // is almost always quicker than an index seek (even though if the index + // contains fewer than 2^17 rows we assume otherwise in other parts of + // the code). And, even if it is not, it should not be too much slower. + // On the other hand, the extra seeks could end up being significantly + // more expensive. + + if (((((((int32(saved_nEq) == int32(saved_nSkip)) && + ((int32(saved_nEq) + 1) < int32((*Index)(unsafe.Pointer(pProbe)).FnKeyCol))) && + (int32(saved_nEq) == int32((*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm))) && + ((int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.noSkipScan */)) & 0x40 >> 6)) == 0)) && + ((int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.hasStat1 */)) & 0x80 >> 7)) != 0)) && + (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_SkipScan))) == U32(0))) && + (int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr((int32(saved_nEq)+1))*2))) >= 42)) && // TUNING: Minimum for skip-scan + ((libc.AssignInt32(&rc, whereLoopResize(tls, db, pNew, (int32((*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm)+1)))) == SQLITE_OK) { + var nIter LogEst + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */))++ + (*WhereLoop)(unsafe.Pointer(pNew)).FnSkip++ + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(libc.PostIncUint16(&(*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm, 1))*8)) = uintptr(0) + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_SKIPSCAN)) + nIter = (LogEst(int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr(saved_nEq)*2))) - int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst + uintptr((int32(saved_nEq)+1))*2))))) + *(*LogEst)(unsafe.Pointer(pNew + 22 /* &.nOut */)) -= LogEst((int32(nIter))) + // TUNING: Because uncertainties in the estimates for skip-scan queries, + // add a 1.375 fudge factor to make skip-scan slightly less likely. + nIter = int16(int32(nIter) + (5)) + whereLoopAddBtreeIndex(tls, pBuilder, pSrc, pProbe, (int16(int32(nIter) + int32(nInMul)))) + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = saved_nOut + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = saved_nEq + (*WhereLoop)(unsafe.Pointer(pNew)).FnSkip = saved_nSkip + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = saved_wsFlags + } + + return rc +} + +// Return True if it is possible that pIndex might be useful in +// implementing the ORDER BY clause in pBuilder. +// +// Return False if pBuilder does not contain an ORDER BY clause or +// if there is no way for pIndex to be useful in implementing that +// ORDER BY clause. +func indexMightHelpWithOrderBy(tls *libc.TLS, pBuilder uintptr, pIndex uintptr, iCursor int32) int32 { /* sqlite3.c:152100:12: */ + var pOB uintptr + var aColExpr uintptr + var ii int32 + var jj int32 + + if (uint32(int32(*(*uint16)(unsafe.Pointer(pIndex + 100 /* &.bUnordered */)) & 0x4 >> 2))) != 0 { + return 0 + } + if (libc.AssignUintptr(&pOB, (*WhereInfo)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpOrderBy)) == uintptr(0) { + return 0 + } + for ii = 0; ii < (*ExprList)(unsafe.Pointer(pOB)).FnExpr; ii++ { + var pExpr uintptr = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer((pOB+8 /* &.a */)+uintptr(ii)*32)).FpExpr) + if pExpr == uintptr(0) { + continue + } + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_COLUMN) && ((*Expr)(unsafe.Pointer(pExpr)).FiTable == iCursor) { + if int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) < 0 { + return 1 + } + for jj = 0; jj < int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol); jj++ { + if int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn) == int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(jj)*2))) { + return 1 + } + } + } else if (libc.AssignUintptr(&aColExpr, (*Index)(unsafe.Pointer(pIndex)).FaColExpr)) != uintptr(0) { + for jj = 0; jj < int32((*Index)(unsafe.Pointer(pIndex)).FnKeyCol); jj++ { + if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(jj)*2))) != (-2) { + continue + } + if Xsqlite3ExprCompareSkip(tls, pExpr, (*ExprList_item)(unsafe.Pointer((aColExpr+8 /* &.a */)+uintptr(jj)*32)).FpExpr, iCursor) == 0 { + return 1 + } + } + } + } + return 0 +} + +// Check to see if a partial index with pPartIndexWhere can be used +// in the current query. Return true if it can be and false if not. +func whereUsablePartialIndex(tls *libc.TLS, iTab int32, isLeft int32, pWC uintptr, pWhere uintptr) int32 { /* sqlite3.c:152134:12: */ + var i int32 + var pTerm uintptr + var pParse uintptr = (*WhereInfo)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse + for int32((*Expr)(unsafe.Pointer(pWhere)).Fop) == TK_AND { + if !(whereUsablePartialIndex(tls, iTab, isLeft, pWC, (*Expr)(unsafe.Pointer(pWhere)).FpLeft) != 0) { + return 0 + } + pWhere = (*Expr)(unsafe.Pointer(pWhere)).FpRight + } + if ((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Fflags & uint64(SQLITE_EnableQPSG)) != 0 { + pParse = uintptr(0) + } + i = 0 + pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa +__1: + if !(i < (*WhereClause)(unsafe.Pointer(pWC)).FnTerm) { + goto __3 + } + { + var pExpr uintptr + pExpr = (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr + if (((!(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) || ((*Expr)(unsafe.Pointer(pExpr)).FiRightJoinTable == iTab)) && + ((isLeft == 0) || (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)))) && + (Xsqlite3ExprImpliesExpr(tls, pParse, pExpr, pWhere, iTab) != 0)) && + ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & TERM_VNULL) == 0) { + return 1 + } + + } + goto __2 +__2: + i++ + pTerm += 56 + goto __1 + goto __3 +__3: + ; + return 0 +} + +// Add all WhereLoop objects for a single table of the join where the table +// is identified by pBuilder->pNew->iTab. That table is guaranteed to be +// a b-tree table, not a virtual table. +// +// The costs (WhereLoop.rRun) of the b-tree loops added by this function +// are calculated as follows: +// +// For a full scan, assuming the table (or index) contains nRow rows: +// +// cost = nRow * 3.0 // full-table scan +// cost = nRow * K // scan of covering index +// cost = nRow * (K+3.0) // scan of non-covering index +// +// where K is a value between 1.1 and 3.0 set based on the relative +// estimated average size of the index and table records. +// +// For an index scan, where nVisit is the number of index rows visited +// by the scan, and nSeek is the number of seek operations required on +// the index b-tree: +// +// cost = nSeek * (log(nRow) + K * nVisit) // covering index +// cost = nSeek * (log(nRow) + (K+3.0) * nVisit) // non-covering index +// +// Normally, nSeek is 1. nSeek values greater than 1 come about if the +// WHERE clause includes "x IN (....)" terms used in place of "x=?". Or when +// implicit "x IN (SELECT x FROM tbl)" terms are added for skip-scans. +// +// The estimated values (nRow, nVisit, nSeek) often contain a large amount +// of uncertainty. For this reason, scoring is designed to pick plans that +// "do the least harm" if the estimates are inaccurate. For example, a +// log(nRow) factor is omitted from a non-covering index scan in order to +// bias the scoring in favor of using an index, since the worst-case +// performance of using an index is far better than the worst-case performance +// of a full table scan. +func whereLoopAddBtree(tls *libc.TLS, pBuilder uintptr, mPrereq Bitmask) int32 { /* sqlite3.c:152198:12: */ + bp := tls.Alloc(158) + defer tls.Free(158) + + var pWInfo uintptr // WHERE analysis context + var pProbe uintptr // An index we are evaluating + // var sPk Index at bp, 152 + // A fake index object for the primary key + // var aiRowEstPk [2]LogEst at bp+154, 4 + // The aiRowLogEst[] value for the sPk index + *(*I16)(unsafe.Pointer(bp + 152 /* aiColumnPk */)) = int16(-1) // The aColumn[] value for the sPk index + var pTabList uintptr // The FROM clause + var pSrc uintptr // The FROM clause btree term to add + var pNew uintptr // Template WhereLoop object + var rc int32 = SQLITE_OK // Return code + var iSortIdx int32 = 1 // Index number + var b int32 // A boolean value + var rSize LogEst // number of rows in the table + var rLogSize LogEst // Logarithm of the number of rows in the table + var pWC uintptr // The parsed WHERE clause + var pTab uintptr // Table being queried + + pNew = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + pWInfo = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + pTabList = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + pSrc = ((pTabList + 8 /* &.a */) + uintptr((*WhereLoop)(unsafe.Pointer(pNew)).FiTab)*112) + pTab = (*SrcItem)(unsafe.Pointer(pSrc)).FpTab + pWC = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + + if (uint32(int32(*(*uint16)(unsafe.Pointer(pSrc + 60 /* &.fg */ + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0 { + // An INDEXED BY clause specifies a particular index to use + pProbe = *(*uintptr)(unsafe.Pointer(pSrc + 104 /* &.u2 */)) + } else if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + pProbe = (*Table)(unsafe.Pointer(pTab)).FpIndex + } else { + // There is no INDEXED BY clause. Create a fake Index object in local + // variable sPk to represent the rowid primary key index. Make this + // fake index the first in a chain of Index objects with all of the real + // indices to follow + var pFirst uintptr // First of real indices on the table + libc.Xmemset(tls, bp /* &sPk */, 0, uint64(unsafe.Sizeof(Index{}))) + (*Index)(unsafe.Pointer(bp /* &sPk */)).FnKeyCol = U16(1) + (*Index)(unsafe.Pointer(bp /* &sPk */)).FnColumn = U16(1) + (*Index)(unsafe.Pointer(bp /* &sPk */)).FaiColumn = bp + 152 /* &aiColumnPk */ + (*Index)(unsafe.Pointer(bp /* &sPk */)).FaiRowLogEst = bp + 154 /* &aiRowEstPk[0] */ + (*Index)(unsafe.Pointer(bp /* &sPk */)).FonError = U8(OE_Replace) + (*Index)(unsafe.Pointer(bp /* &sPk */)).FpTable = pTab + (*Index)(unsafe.Pointer(bp /* &sPk */)).FszIdxRow = (*Table)(unsafe.Pointer(pTab)).FszTabRow + libc.SetBitFieldPtr16Uint32(bp /* &sPk */ +100 /* &.idxType */, uint32(SQLITE_IDXTYPE_IPK), 0, 0x3) + *(*LogEst)(unsafe.Pointer(bp + 154 /* &aiRowEstPk[0] */)) = (*Table)(unsafe.Pointer(pTab)).FnRowLogEst + *(*LogEst)(unsafe.Pointer(bp + 154 /* &aiRowEstPk[0] */ + 1*2)) = int16(0) + pFirst = (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FpIndex + if (int32(*(*uint16)(unsafe.Pointer((pSrc + 60 /* &.fg */) + 4 /* &.notIndexed */)) & 0x1 >> 0)) == 0 { + // The real indices of the table are only considered if the + // NOT INDEXED qualifier is omitted from the FROM clause + (*Index)(unsafe.Pointer(bp /* &sPk */)).FpNext = pFirst + } + pProbe = bp /* &sPk */ + } + rSize = (*Table)(unsafe.Pointer(pTab)).FnRowLogEst + rLogSize = estLog(tls, rSize) + + // Automatic indexes + if ((((((!(int32((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrSet) != 0) && // Not part of an OR optimization + ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_OR_SUBCLAUSE) == 0)) && + (((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb)).Fflags & uint64(SQLITE_AutoIndex)) != uint64(0))) && + !((int32(*(*uint16)(unsafe.Pointer(pSrc + 60 /* &.fg */ + 4 /* &.isIndexedBy */)) & 0x2 >> 1)) != 0)) && // Has no INDEXED BY clause + !((int32(*(*uint16)(unsafe.Pointer(pSrc + 60 /* &.fg */ + 4 /* &.notIndexed */)) & 0x1 >> 0)) != 0)) && // Has no NOT INDEXED clause + (((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) && // Not WITHOUT ROWID table. (FIXME: Why not?) + !((int32(*(*uint16)(unsafe.Pointer(pSrc + 60 /* &.fg */ + 4 /* &.isCorrelated */)) & 0x8 >> 3)) != 0)) && // Not a correlated subquery + !((int32(*(*uint16)(unsafe.Pointer(pSrc + 60 /* &.fg */ + 4 /* &.isRecursive */)) & 0x20 >> 5)) != 0) { + // Generate auto-index WhereLoops + var pTerm uintptr + var pWCEnd uintptr = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer(pWC)).FnTerm)*56) + for pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa; (rc == SQLITE_OK) && (pTerm < pWCEnd); pTerm += 56 { + if ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & (*WhereLoop)(unsafe.Pointer(pNew)).FmaskSelf) != 0 { + continue + } + if termCanDriveIndex(tls, pTerm, pSrc, uint64(0)) != 0 { + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = U16(1) + (*WhereLoop)(unsafe.Pointer(pNew)).FnSkip = U16(0) + *(*uintptr)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = uintptr(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = U16(1) + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm)) = pTerm + // TUNING: One-time cost for computing the automatic index is + // estimated to be X*N*log2(N) where N is the number of rows in + // the table being indexed and where X is 7 (LogEst=28) for normal + // tables or 0.5 (LogEst=-10) for views and subqueries. The value + // of X is smaller for views and subqueries so that the query planner + // will be more aggressive about generating automatic indexes for + // those objects, since there is no opportunity to add schema + // indexes on subqueries and views. + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = (LogEst(int32(rLogSize) + int32(rSize))) + if ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0)) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Ephemeral)) == U32(0)) { + *(*LogEst)(unsafe.Pointer(pNew + 18 /* &.rSetup */)) += int16((28)) + } else { + *(*LogEst)(unsafe.Pointer(pNew + 18 /* &.rSetup */)) -= int16((10)) + } + + if int32((*WhereLoop)(unsafe.Pointer(pNew)).FrSetup) < 0 { + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(0) + } + // TUNING: Each index lookup yields 20 rows in the table. This + // is more than the usual guess of 10 rows, since we have no way + // of knowing how selective the index will ultimately be. It would + // not be unreasonable to make this value much larger. + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = int16(43) + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = Xsqlite3LogEstAdd(tls, rLogSize, (*WhereLoop)(unsafe.Pointer(pNew)).FnOut) + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = U32(WHERE_AUTO_INDEX) + (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq = (mPrereq | (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight) + rc = whereLoopInsert(tls, pBuilder, pNew) + } + } + } + + // Loop over all indices. If there was an INDEXED BY clause, then only + // consider index pProbe. +__1: + if !((rc == SQLITE_OK) && (pProbe != 0)) { + goto __3 + } + { + var isLeft int32 = (libc.Bool32((int32((*SrcItem)(unsafe.Pointer(pSrc)).Ffg.Fjointype) & JT_OUTER) != 0)) + if ((*Index)(unsafe.Pointer(pProbe)).FpPartIdxWhere != uintptr(0)) && + !(whereUsablePartialIndex(tls, (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor, isLeft, pWC, + (*Index)(unsafe.Pointer(pProbe)).FpPartIdxWhere) != 0) { + // See ticket [98d973b8f5] + goto __2 // Partial index inappropriate for this query + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.bNoQuery */)) & 0x100 >> 8))) != 0 { + goto __2 + } + rSize = *(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pProbe)).FaiRowLogEst)) + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = U16(0) + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */)) = U16(0) + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */)) = U16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FnSkip = U16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = U16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = U8(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = rSize + *(*uintptr)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pProbe + b = indexMightHelpWithOrderBy(tls, pBuilder, pProbe, (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor) + + // The ONEPASS_DESIRED flags never occurs together with ORDER BY + + if (int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_IPK { + // Integer primary key index + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = U32(WHERE_IPK) + + // Full table scan + (*WhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = func() uint8 { + if b != 0 { + return uint8(iSortIdx) + } + return uint8(0) + }() + // TUNING: Cost of full table scan is 3.0*N. The 3.0 factor is an + // extra cost designed to discourage the use of full table scans, + // since index lookups have better worst-case performance if our + // stat guesses are wrong. Reduce the 3.0 penalty slightly + // (to 2.75) if we have valid STAT4 information for the table. + // At 2.75, a full table scan is preferred over using an index on + // a column with just two distinct values where each value has about + // an equal number of appearances. Without STAT4 data, we still want + // to use an index in that case, since the constraint might be for + // the scarcer of the two values, and in that case an index lookup is + // better. + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = (LogEst((int32(rSize) + 16) - (2 * (libc.Bool32(((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_HasStat4)) != U32(0)))))) + + whereLoopOutputAdjust(tls, pWC, pNew, rSize) + rc = whereLoopInsert(tls, pBuilder, pNew) + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = rSize + if rc != 0 { + goto __3 + } + } else { + var m Bitmask + if (uint32(int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.isCovering */)) & 0x20 >> 5))) != 0 { + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = (U32(WHERE_IDX_ONLY | WHERE_INDEXED)) + m = uint64(0) + } else { + m = ((*SrcItem)(unsafe.Pointer(pSrc)).FcolUsed & (*Index)(unsafe.Pointer(pProbe)).FcolNotIdxed) + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = func() uint32 { + if m == uint64(0) { + return (uint32(WHERE_IDX_ONLY | WHERE_INDEXED)) + } + return uint32(WHERE_INDEXED) + }() + } + + // Full scan via index + if ((((b != 0) || + !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) || + ((*Index)(unsafe.Pointer(pProbe)).FpPartIdxWhere != uintptr(0))) || + ((uint32(int32(*(*uint16)(unsafe.Pointer((pSrc + 60 /* &.fg */) + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0)) || + ((((((m == uint64(0)) && + ((int32(*(*uint16)(unsafe.Pointer(pProbe + 100 /* &.bUnordered */)) & 0x4 >> 2)) == 0)) && + (int32((*Index)(unsafe.Pointer(pProbe)).FszIdxRow) < int32((*Table)(unsafe.Pointer(pTab)).FszTabRow))) && + ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_ONEPASS_DESIRED) == 0)) && + (Xsqlite3Config.FbUseCis != 0)) && + (((*Sqlite3)(unsafe.Pointer(((*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb))).FdbOptFlags & (U32(SQLITE_CoverIdxScan))) == U32(0))) { + (*WhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = func() uint8 { + if b != 0 { + return uint8(iSortIdx) + } + return uint8(0) + }() + + // The cost of visiting the index rows is N*K, where K is + // between 1.1 and 3.0, depending on the relative sizes of the + // index and table rows. + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = (LogEst((int32(rSize) + 1) + ((15 * int32((*Index)(unsafe.Pointer(pProbe)).FszIdxRow)) / int32((*Table)(unsafe.Pointer(pTab)).FszTabRow)))) + if m != uint64(0) { + // If this is a non-covering index scan, add in the cost of + // doing table lookups. The cost will be 3x the number of + // lookups. Take into account WHERE clause terms that can be + // satisfied using just the index, and that do not require a + // table lookup. + var nLookup LogEst = (LogEst(int32(rSize) + 16)) // Base cost: N*3 + var ii int32 + var iCur int32 = (*SrcItem)(unsafe.Pointer(pSrc)).FiCursor + var pWC2 uintptr = (pWInfo + 104 /* &.sWC */) + for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pWC2)).FnTerm; ii++ { + var pTerm uintptr = ((*WhereClause)(unsafe.Pointer(pWC2)).Fa + uintptr(ii)*56) + if !(Xsqlite3ExprCoveredByIndex(tls, (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr, iCur, pProbe) != 0) { + break + } + // pTerm can be evaluated using just the index. So reduce + // the expected number of table lookups accordingly + if int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb) <= 0 { + nLookup = LogEst(int32(nLookup) + (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FtruthProb))) + } else { + nLookup-- + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (WO_EQ | WO_IS)) != 0 { + nLookup = int16(int32(nLookup) - (19)) + } + } + } + + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = Xsqlite3LogEstAdd(tls, (*WhereLoop)(unsafe.Pointer(pNew)).FrRun, nLookup) + } + + whereLoopOutputAdjust(tls, pWC, pNew, rSize) + rc = whereLoopInsert(tls, pBuilder, pNew) + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = rSize + if rc != 0 { + goto __3 + } + } + } + + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FbldFlags1 = uint8(0) + rc = whereLoopAddBtreeIndex(tls, pBuilder, pSrc, pProbe, int16(0)) + if int32((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FbldFlags1) == SQLITE_BLDF1_INDEXED { + // If a non-unique index is used, or if a prefix of the key for + // unique index is used (making the index functionally non-unique) + // then the sqlite_stat1 data becomes important for scoring the + // plan + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_StatsUsed)) + } + Xsqlite3Stat4ProbeFree(tls, (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec) + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FnRecValid = 0 + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpRec = uintptr(0) + + } + goto __2 +__2: + pProbe = func() uintptr { + if (uint32(int32(*(*uint16)(unsafe.Pointer(pSrc + 60 /* &.fg */ + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0 { + return uintptr(0) + } + return (*Index)(unsafe.Pointer(pProbe)).FpNext + }() + iSortIdx++ + goto __1 + goto __3 +__3: + ; + return rc +} + +// Argument pIdxInfo is already populated with all constraints that may +// be used by the virtual table identified by pBuilder->pNew->iTab. This +// function marks a subset of those constraints usable, invokes the +// xBestIndex method and adds the returned plan to pBuilder. +// +// A constraint is marked usable if: +// +// * Argument mUsable indicates that its prerequisites are available, and +// +// * It is not one of the operators specified in the mExclude mask passed +// as the fourth argument (which in practice is either WO_IN or 0). +// +// Argument mPrereq is a mask of tables that must be scanned before the +// virtual table in question. These are added to the plans prerequisites +// before it is added to pBuilder. +// +// Output parameter *pbIn is set to true if the plan added to pBuilder +// uses one or more WO_IN terms, or false otherwise. +func whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq Bitmask, mUsable Bitmask, mExclude U16, pIdxInfo uintptr, mNoOmit U16, pbIn uintptr) int32 { /* sqlite3.c:152472:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pWC uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + var pIdxCons uintptr + var pUsage uintptr = (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + var i int32 + var mxTerm int32 + var rc int32 = SQLITE_OK + var pNew uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + var pParse uintptr = (*WhereInfo)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpParse + var pSrc uintptr = (((*WhereInfo)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLoop)(unsafe.Pointer(pNew)).FiTab)*112) + var nConstraint int32 = (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint + + *(*int32)(unsafe.Pointer(pbIn)) = 0 + (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq = mPrereq + + // Set the usable flag on the subset of constraints identified by + // arguments mUsable and mExclude. + pIdxCons = *(*uintptr)(unsafe.Pointer((pIdxInfo + 8 /* &.aConstraint */))) + i = 0 +__1: + if !(i < nConstraint) { + goto __3 + } + { + var pTerm uintptr = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset)*56) + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable = uint8(0) + if (((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight & mUsable) == (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight) && + ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & int32(mExclude)) == 0) { + (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable = uint8(1) + } + + } + goto __2 +__2: + i++ + pIdxCons += 12 + goto __1 + goto __3 +__3: + ; + + // Initialize the output fields of the sqlite3_index_info structure + libc.Xmemset(tls, pUsage, 0, (uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{})) * uint64(nConstraint))) + + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = uintptr(0) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (float64((1e99)) / float64(2)) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(25) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = 0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed = Sqlite3_uint64(Sqlite3_int64((*SrcItem)(unsafe.Pointer(pSrc)).FcolUsed)) + + // Invoke the virtual table xBestIndex() method + rc = vtabBestIndex(tls, pParse, (*SrcItem)(unsafe.Pointer(pSrc)).FpTab, pIdxInfo) + if rc != 0 { + if rc == SQLITE_CONSTRAINT { + // If the xBestIndex method returns SQLITE_CONSTRAINT, that means + // that the particular combination of parameters provided is unusable. + // Make no entries in the loop table. + + return SQLITE_OK + } + return rc + } + + mxTerm = -1 + + for i = 0; i < nConstraint; i++ { + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) = uintptr(0) + } + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 6 /* &.omitMask */)) = U16(0) + pIdxCons = *(*uintptr)(unsafe.Pointer((pIdxInfo + 8 /* &.aConstraint */))) + i = 0 +__4: + if !(i < nConstraint) { + goto __6 + } + { + var iTerm int32 + if (libc.AssignInt32(&iTerm, ((*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage+uintptr(i)*8)).FargvIndex - 1))) >= 0 { + var pTerm uintptr + var j int32 = (*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).FiTermOffset + if ((((iTerm >= nConstraint) || + (j < 0)) || + (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || + (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0))) || + (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+20250 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + + return SQLITE_ERROR + } + + pTerm = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr(j)*56) + *(*Bitmask)(unsafe.Pointer(pNew /* &.prereq */)) |= ((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqRight) + + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) = pTerm + if iTerm > mxTerm { + mxTerm = iTerm + } + + if (*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage+uintptr(i)*8)).Fomit != 0 { + if (i < 16) && (((int32(1) << i) & int32(mNoOmit)) == 0) { + + *(*U16)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 6 /* &.omitMask */)) |= U16((int32(1) << iTerm)) + } else { + + } + } + if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_IN) != 0 { + // A virtual table that is constrained by an IN clause may not + // consume the ORDER BY clause because (1) the order of IN terms + // is not necessarily related to the order of output terms and + // (2) Multiple outputs from a single IN value will not merge + // together. + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 0 + *(*int32)(unsafe.Pointer(pIdxInfo + 80 /* &.idxFlags */)) &= (libc.CplInt32(SQLITE_INDEX_SCAN_UNIQUE)) + *(*int32)(unsafe.Pointer(pbIn)) = 1 + } + } + + } + goto __5 +__5: + i++ + pIdxCons += 12 + goto __4 + goto __6 +__6: + ; + + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = (U16(mxTerm + 1)) + for i = 0; i <= mxTerm; i++ { + if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { + // The non-zero argvIdx values must be contiguous. Raise an + // error if they are not + Xsqlite3ErrorMsg(tls, pParse, ts+20250 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + + return SQLITE_ERROR + } + } + + *(*int32)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)) = (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum + *(*U8)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) = U8((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 0 + *(*uintptr)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)) = (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr + *(*I8)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 5 /* &.isOrdered */)) = func() int8 { + if (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed != 0 { + return int8((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy) + } + return int8(0) + }() + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = Xsqlite3LogEstFromDouble(tls, (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost) + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = Xsqlite3LogEst(tls, uint64((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows)) + + // Set the WHERE_ONEROW flag if the xBestIndex() method indicated + // that the scan will visit at most one row. Clear it otherwise. + if ((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags & SQLITE_INDEX_SCAN_UNIQUE) != 0 { + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) |= (U32(WHERE_ONEROW)) + } else { + *(*U32)(unsafe.Pointer(pNew + 40 /* &.wsFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(WHERE_ONEROW))) + } + rc = whereLoopInsert(tls, pBuilder, pNew) + if *(*U8)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) != 0 { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */))) + *(*U8)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) = U8(0) + } + + return rc +} + +// If this function is invoked from within an xBestIndex() callback, it +// returns a pointer to a buffer containing the name of the collation +// sequence associated with element iCons of the sqlite3_index_info.aConstraint +// array. Or, if iCons is out of range or there is no active xBestIndex +// call, return NULL. +func Xsqlite3_vtab_collation(tls *libc.TLS, pIdxInfo uintptr, iCons int32) uintptr { /* sqlite3.c:152632:23: */ + var pHidden uintptr = (pIdxInfo + 1*96) + var zRet uintptr = uintptr(0) + if (iCons >= 0) && (iCons < (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + var pC uintptr = uintptr(0) + var iTerm int32 = (*sqlite3_index_constraint)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iCons)*12)).FiTermOffset + var pX uintptr = (*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer((*HiddenIndexInfo)(unsafe.Pointer(pHidden)).FpWC)).Fa + uintptr(iTerm)*56)).FpExpr + if (*Expr)(unsafe.Pointer(pX)).FpLeft != 0 { + pC = Xsqlite3ExprCompareCollSeq(tls, (*HiddenIndexInfo)(unsafe.Pointer(pHidden)).FpParse, pX) + } + zRet = func() uintptr { + if pC != 0 { + return (*CollSeq)(unsafe.Pointer(pC)).FzName + } + return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) + }() + } + return zRet +} + +// Add all WhereLoop objects for a table of the join identified by +// pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. +// +// If there are no LEFT or CROSS JOIN joins in the query, both mPrereq and +// mUnusable are set to 0. Otherwise, mPrereq is a mask of all FROM clause +// entries that occur before the virtual table in the FROM clause and are +// separated from it by at least one LEFT or CROSS JOIN. Similarly, the +// mUnusable mask contains all FROM clause entries that occur after the +// virtual table and are separated from it by at least one LEFT or +// CROSS JOIN. +// +// For example, if the query were: +// +// ... FROM t1, t2 LEFT JOIN t3, t4, vt CROSS JOIN t5, t6; +// +// then mPrereq corresponds to (t1, t2) and mUnusable to (t5, t6). +// +// All the tables in mPrereq must be scanned before the current virtual +// table. So any terms for which all prerequisites are satisfied by +// mPrereq may be specified as "usable" in all calls to xBestIndex. +// Conversely, all tables in mUnusable must be scanned after the current +// virtual table, so any terms for which the prerequisites overlap with +// mUnusable should always be configured as "not-usable" for xBestIndex. +func whereLoopAddVirtual(tls *libc.TLS, pBuilder uintptr, mPrereq Bitmask, mUnusable Bitmask) int32 { /* sqlite3.c:152672:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK // Return code + var pWInfo uintptr // WHERE analysis context + var pParse uintptr // The parsing context + var pWC uintptr // The WHERE clause + var pSrc uintptr // The FROM clause term to search + var p uintptr // Object to pass to xBestIndex() + var nConstraint int32 // Number of constraints in p + // var bIn int32 at bp+4, 4 + // True if plan uses IN(...) operator + var pNew uintptr + var mBest Bitmask // Tables used by best possible plan + // var mNoOmit U16 at bp, 2 + + pWInfo = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + pParse = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse + pWC = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + pNew = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + pSrc = (((*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLoop)(unsafe.Pointer(pNew)).FiTab)*112) + + p = allocateIndexInfo(tls, pParse, pWC, mUnusable, pSrc, (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpOrderBy, + bp /* &mNoOmit */) + if p == uintptr(0) { + return SQLITE_NOMEM + } + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = U32(WHERE_VIRTUALTABLE) + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = U16(0) + *(*U8)(unsafe.Pointer(pNew + 24 /* &.u */ /* &.vtab */ + 4 /* &.needFree */)) = U8(0) + nConstraint = (*Sqlite3_index_info)(unsafe.Pointer(p)).FnConstraint + if whereLoopResize(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pNew, nConstraint) != 0 { + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, p) + return SQLITE_NOMEM + } + + // First call xBestIndex() with all constraints usable. + + rc = whereLoopAddVirtualOne(tls, pBuilder, mPrereq, libc.Uint64(libc.Uint64FromInt32(-1)), uint16(0), p, *(*U16)(unsafe.Pointer(bp /* mNoOmit */)), bp+4 /* &bIn */) + + // If the call to xBestIndex() with all terms enabled produced a plan + // that does not require any source tables (IOW: a plan with mBest==0) + // and does not use an IN(...) operator, then there is no point in making + // any further calls to xBestIndex() since they will all return the same + // result (if the xBestIndex() implementation is sane). + if (rc == SQLITE_OK) && (((libc.AssignUint64(&mBest, ((*WhereLoop)(unsafe.Pointer(pNew)).Fprereq & ^mPrereq))) != uint64(0)) || (*(*int32)(unsafe.Pointer(bp + 4 /* bIn */)) != 0)) { + var seenZero int32 = 0 // True if a plan with no prereqs seen + var seenZeroNoIN int32 = 0 // Plan with no prereqs and no IN(...) seen + var mPrev Bitmask = uint64(0) + var mBestNoIn Bitmask = uint64(0) + + // If the plan produced by the earlier call uses an IN(...) term, call + // xBestIndex again, this time with IN(...) terms disabled. + if *(*int32)(unsafe.Pointer(bp + 4 /* bIn */)) != 0 { + + rc = whereLoopAddVirtualOne(tls, + pBuilder, mPrereq, libc.Uint64(libc.Uint64FromInt32(-1)), uint16(WO_IN), p, *(*U16)(unsafe.Pointer(bp /* mNoOmit */)), bp+4 /* &bIn */) + + mBestNoIn = ((*WhereLoop)(unsafe.Pointer(pNew)).Fprereq & ^mPrereq) + if mBestNoIn == uint64(0) { + seenZero = 1 + seenZeroNoIN = 1 + } + } + + // Call xBestIndex once for each distinct value of (prereqRight & ~mPrereq) + // in the set of terms that apply to the current virtual table. + for rc == SQLITE_OK { + var i int32 + var mNext Bitmask = libc.Uint64(libc.Uint64FromInt32(-1)) + + for i = 0; i < nConstraint; i++ { + var mThis Bitmask = ((*WhereTerm)(unsafe.Pointer((*WhereClause)(unsafe.Pointer(pWC)).Fa+uintptr((*sqlite3_index_constraint)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(p)).FaConstraint+uintptr(i)*12)).FiTermOffset)*56)).FprereqRight & ^mPrereq) + if (mThis > mPrev) && (mThis < mNext) { + mNext = mThis + } + } + mPrev = mNext + if mNext == (libc.Uint64(libc.Uint64FromInt32(-1))) { + break + } + if (mNext == mBest) || (mNext == mBestNoIn) { + continue + } + + rc = whereLoopAddVirtualOne(tls, + pBuilder, mPrereq, (mNext | mPrereq), uint16(0), p, *(*U16)(unsafe.Pointer(bp /* mNoOmit */)), bp+4 /* &bIn */) + if (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq == mPrereq { + seenZero = 1 + if *(*int32)(unsafe.Pointer(bp + 4 /* bIn */)) == 0 { + seenZeroNoIN = 1 + } + } + } + + // If the calls to xBestIndex() in the above loop did not find a plan + // that requires no source tables at all (i.e. one guaranteed to be + // usable), make a call here with all source tables disabled + if (rc == SQLITE_OK) && (seenZero == 0) { + + rc = whereLoopAddVirtualOne(tls, + pBuilder, mPrereq, mPrereq, uint16(0), p, *(*U16)(unsafe.Pointer(bp /* mNoOmit */)), bp+4 /* &bIn */) + if *(*int32)(unsafe.Pointer(bp + 4 /* bIn */)) == 0 { + seenZeroNoIN = 1 + } + } + + // If the calls to xBestIndex() have so far failed to find a plan + // that requires no source tables at all and does not use an IN(...) + // operator, make a final call to obtain one here. + if (rc == SQLITE_OK) && (seenZeroNoIN == 0) { + + rc = whereLoopAddVirtualOne(tls, + pBuilder, mPrereq, mPrereq, uint16(WO_IN), p, *(*U16)(unsafe.Pointer(bp /* mNoOmit */)), bp+4 /* &bIn */) + } + } + + if (*Sqlite3_index_info)(unsafe.Pointer(p)).FneedToFreeIdxStr != 0 { + Xsqlite3_free(tls, (*Sqlite3_index_info)(unsafe.Pointer(p)).FidxStr) + } + Xsqlite3DbFreeNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, p) + + return rc +} + +// Add WhereLoop entries to handle OR terms. This works for either +// btrees or virtual tables. +func whereLoopAddOr(tls *libc.TLS, pBuilder uintptr, mPrereq Bitmask, mUnusable Bitmask) int32 { /* sqlite3.c:152795:12: */ + bp := tls.Alloc(720) + defer tls.Free(720) + + var pWInfo uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + var pWC uintptr + var pNew uintptr + var pTerm uintptr + var pWCEnd uintptr + var rc int32 = SQLITE_OK + var iCur int32 + // var tempWC WhereClause at bp+112, 488 + + // var sSubBuild WhereLoopBuilder at bp+600, 64 + + // var sSum WhereOrSet at bp, 56 + + // var sCur WhereOrSet at bp+56, 56 + + var pItem uintptr + + pWC = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC + pWCEnd = ((*WhereClause)(unsafe.Pointer(pWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer(pWC)).FnTerm)*56) + pNew = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + libc.Xmemset(tls, bp /* &sSum */, 0, uint64(unsafe.Sizeof(WhereOrSet{}))) + pItem = (((*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLoop)(unsafe.Pointer(pNew)).FiTab)*112) + iCur = (*SrcItem)(unsafe.Pointer(pItem)).FiCursor + + for pTerm = (*WhereClause)(unsafe.Pointer(pWC)).Fa; (pTerm < pWCEnd) && (rc == SQLITE_OK); pTerm += 56 { + if ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & WO_OR) != 0) && + (((*WhereOrInfo)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pTerm + 32 /* &.u */)))).Findexable & (*WhereLoop)(unsafe.Pointer(pNew)).FmaskSelf) != uint64(0)) { + var pOrWC uintptr = (*(*uintptr)(unsafe.Pointer(pTerm + 32 /* &.u */)) /* &.wc */) + var pOrWCEnd uintptr = ((*WhereClause)(unsafe.Pointer(pOrWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer(pOrWC)).FnTerm)*56) + var pOrTerm uintptr + var once int32 = 1 + var i int32 + var j int32 + + *(*WhereLoopBuilder)(unsafe.Pointer(bp + 600 /* sSubBuild */)) = *(*WhereLoopBuilder)(unsafe.Pointer(pBuilder)) + (*WhereLoopBuilder)(unsafe.Pointer(bp + 600 /* &sSubBuild */)).FpOrderBy = uintptr(0) + (*WhereLoopBuilder)(unsafe.Pointer(bp + 600 /* &sSubBuild */)).FpOrSet = bp + 56 /* &sCur */ + + for pOrTerm = (*WhereClause)(unsafe.Pointer(pOrWC)).Fa; pOrTerm < pOrWCEnd; pOrTerm += 56 { + if (int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0 { + (*WhereLoopBuilder)(unsafe.Pointer(bp + 600 /* &sSubBuild */)).FpWC = (*(*uintptr)(unsafe.Pointer(pOrTerm + 32 /* &.u */)) /* &.wc */) + } else if (*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur { + (*WhereClause)(unsafe.Pointer(bp + 112 /* &tempWC */)).FpWInfo = (*WhereClause)(unsafe.Pointer(pWC)).FpWInfo + (*WhereClause)(unsafe.Pointer(bp + 112 /* &tempWC */)).FpOuter = pWC + (*WhereClause)(unsafe.Pointer(bp + 112 /* &tempWC */)).Fop = U8(TK_AND) + (*WhereClause)(unsafe.Pointer(bp + 112 /* &tempWC */)).FnTerm = 1 + (*WhereClause)(unsafe.Pointer(bp + 112 /* &tempWC */)).Fa = pOrTerm + (*WhereLoopBuilder)(unsafe.Pointer(bp + 600 /* &sSubBuild */)).FpWC = bp + 112 /* &tempWC */ + } else { + continue + } + (*WhereOrSet)(unsafe.Pointer(bp + 56 /* &sCur */)).Fn = U16(0) + if (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpTab)).FnModuleArg != 0 { + rc = whereLoopAddVirtual(tls, bp+600 /* &sSubBuild */, mPrereq, mUnusable) + } else { + rc = whereLoopAddBtree(tls, bp+600 /* &sSubBuild */, mPrereq) + } + if rc == SQLITE_OK { + rc = whereLoopAddOr(tls, bp+600 /* &sSubBuild */, mPrereq, mUnusable) + } + + if int32((*WhereOrSet)(unsafe.Pointer(bp+56 /* &sCur */)).Fn) == 0 { + (*WhereOrSet)(unsafe.Pointer(bp /* &sSum */)).Fn = U16(0) + break + } else if once != 0 { + whereOrMove(tls, bp /* &sSum */, bp+56 /* &sCur */) + once = 0 + } else { + // var sPrev WhereOrSet at bp+664, 56 + + whereOrMove(tls, bp+664 /* &sPrev */, bp /* &sSum */) + (*WhereOrSet)(unsafe.Pointer(bp /* &sSum */)).Fn = U16(0) + for i = 0; i < int32((*WhereOrSet)(unsafe.Pointer(bp+664 /* &sPrev */)).Fn); i++ { + for j = 0; j < int32((*WhereOrSet)(unsafe.Pointer(bp+56 /* &sCur */)).Fn); j++ { + whereOrInsert(tls, bp /* &sSum */, ((*WhereOrCost)(unsafe.Pointer((bp+664 /* &sPrev */ +8 /* &.a */)+uintptr(i)*16)).Fprereq | (*WhereOrCost)(unsafe.Pointer((bp+56 /* &sCur */ +8 /* &.a */)+uintptr(j)*16)).Fprereq), + Xsqlite3LogEstAdd(tls, (*WhereOrCost)(unsafe.Pointer((bp+664 /* &sPrev */ +8 /* &.a */)+uintptr(i)*16)).FrRun, (*WhereOrCost)(unsafe.Pointer((bp+56 /* &sCur */ +8 /* &.a */)+uintptr(j)*16)).FrRun), + Xsqlite3LogEstAdd(tls, (*WhereOrCost)(unsafe.Pointer((bp+664 /* &sPrev */ +8 /* &.a */)+uintptr(i)*16)).FnOut, (*WhereOrCost)(unsafe.Pointer((bp+56 /* &sCur */ +8 /* &.a */)+uintptr(j)*16)).FnOut)) + } + } + } + } + (*WhereLoop)(unsafe.Pointer(pNew)).FnLTerm = U16(1) + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm)) = pTerm + (*WhereLoop)(unsafe.Pointer(pNew)).FwsFlags = U32(WHERE_MULTI_OR) + (*WhereLoop)(unsafe.Pointer(pNew)).FrSetup = int16(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FiSortIdx = U8(0) + libc.Xmemset(tls, (pNew + 24 /* &.u */), 0, uint64(unsafe.Sizeof(struct { + Fbtree struct { + FnEq U16 + FnBtm U16 + FnTop U16 + FnDistinctCol U16 + FpIndex uintptr + } + }{}))) + for i = 0; (rc == SQLITE_OK) && (i < int32((*WhereOrSet)(unsafe.Pointer(bp /* &sSum */)).Fn)); i++ { + // TUNING: Currently sSum.a[i].rRun is set to the sum of the costs + // of all sub-scans required by the OR-scan. However, due to rounding + // errors, it may be that the cost of the OR-scan is equal to its + // most expensive sub-scan. Add the smallest possible penalty + // (equivalent to multiplying the cost by 1.07) to ensure that + // this does not happen. Otherwise, for WHERE clauses such as the + // following where there is an index on "y": + // + // WHERE likelihood(x=?, 0.99) OR y=? + // + // the planner may elect to "OR" together a full-table scan and an + // index lookup. And other similarly odd results. + (*WhereLoop)(unsafe.Pointer(pNew)).FrRun = (LogEst(int32((*WhereOrCost)(unsafe.Pointer((bp /* &sSum */ +8 /* &.a */)+uintptr(i)*16)).FrRun) + 1)) + (*WhereLoop)(unsafe.Pointer(pNew)).FnOut = (*WhereOrCost)(unsafe.Pointer((bp /* &sSum */ + 8 /* &.a */) + uintptr(i)*16)).FnOut + (*WhereLoop)(unsafe.Pointer(pNew)).Fprereq = (*WhereOrCost)(unsafe.Pointer((bp /* &sSum */ + 8 /* &.a */) + uintptr(i)*16)).Fprereq + rc = whereLoopInsert(tls, pBuilder, pNew) + } + + } + } + return rc +} + +// Add all WhereLoop objects for all tables +func whereLoopAddAll(tls *libc.TLS, pBuilder uintptr) int32 { /* sqlite3.c:152921:12: */ + var pWInfo uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + var mPrereq Bitmask = uint64(0) + var mPrior Bitmask = uint64(0) + var iTab int32 + var pTabList uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + var pItem uintptr + var pEnd uintptr = ((pTabList + 8 /* &.a */) + uintptr((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)*112) + var db uintptr = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb + var rc int32 = SQLITE_OK + var pNew uintptr + + // Loop over the tables in the join, from left to right + pNew = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + whereLoopInit(tls, pNew) + (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FiPlanLimit = uint32(SQLITE_QUERY_PLANNER_LIMIT) + iTab = 0 + pItem = pTabList + 8 /* &.a */ +__1: + if !(pItem < pEnd) { + goto __3 + } + { + var mUnusable Bitmask = uint64(0) + (*WhereLoop)(unsafe.Pointer(pNew)).FiTab = U8(iTab) + *(*uint32)(unsafe.Pointer(pBuilder + 56 /* &.iPlanLimit */)) += (uint32(SQLITE_QUERY_PLANNER_LIMIT_INCR)) + (*WhereLoop)(unsafe.Pointer(pNew)).FmaskSelf = Xsqlite3WhereGetMask(tls, (pWInfo + 592 /* &.sMaskSet */), (*SrcItem)(unsafe.Pointer(pItem)).FiCursor) + if (int32((*SrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype) & (JT_LEFT | JT_CROSS)) != 0 { + // This condition is true when pItem is the FROM clause term on the + // right-hand-side of a LEFT or CROSS JOIN. + mPrereq = mPrior + } else { + mPrereq = uint64(0) + } + if (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpTab)).FnModuleArg != 0 { + var p uintptr + for p = (pItem + 1*112); p < pEnd; p += 112 { + if (mUnusable != 0) || ((int32((*SrcItem)(unsafe.Pointer(p)).Ffg.Fjointype) & (JT_LEFT | JT_CROSS)) != 0) { + mUnusable = mUnusable | (Xsqlite3WhereGetMask(tls, (pWInfo + 592 /* &.sMaskSet */), (*SrcItem)(unsafe.Pointer(p)).FiCursor)) + } + } + rc = whereLoopAddVirtual(tls, pBuilder, mPrereq, mUnusable) + } else { + rc = whereLoopAddBtree(tls, pBuilder, mPrereq) + } + if (rc == SQLITE_OK) && ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC)).FhasOr != 0) { + rc = whereLoopAddOr(tls, pBuilder, mPrereq, mUnusable) + } + mPrior = mPrior | ((*WhereLoop)(unsafe.Pointer(pNew)).FmaskSelf) + if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if rc == SQLITE_DONE { + // We hit the query planner search limit set by iPlanLimit + Xsqlite3_log(tls, SQLITE_WARNING, ts+20276 /* "abbreviated quer..." */, 0) + rc = SQLITE_OK + } else { + goto __3 + } + } + + } + goto __2 +__2: + iTab++ + pItem += 112 + goto __1 + goto __3 +__3: + ; + + whereLoopClear(tls, db, pNew) + return rc +} + +// Examine a WherePath (with the addition of the extra WhereLoop of the 6th +// parameters) to see if it outputs rows in the requested ORDER BY +// (or GROUP BY) without requiring a separate sort operation. Return N: +// +// N>0: N terms of the ORDER BY clause are satisfied +// N==0: No terms of the ORDER BY clause are satisfied +// N<0: Unknown yet how many terms of ORDER BY might be satisfied. +// +// Note that processing for WHERE_GROUPBY and WHERE_DISTINCTBY is not as +// strict. With GROUP BY and DISTINCT the only requirement is that +// equivalent rows appear immediately adjacent to one another. GROUP BY +// and DISTINCT do not require rows to appear in any particular order as long +// as equivalent rows are grouped together. Thus for GROUP BY and DISTINCT +// the pOrderBy terms can be matched in any order. With ORDER BY, the +// pOrderBy terms must be matched in strict left-to-right order. +func wherePathSatisfiesOrderBy(tls *libc.TLS, pWInfo uintptr, pOrderBy uintptr, pPath uintptr, wctrlFlags U16, nLoop U16, pLast uintptr, pRevMask uintptr) I8 { /* sqlite3.c:152999:11: */ + var revSet U8 // True if rev is known + var rev U8 // Composite sort order + var revIdx U8 // Index sort order + var isOrderDistinct U8 // All prior WhereLoops are order-distinct + var distinctColumns U8 // True if the loop has UNIQUE NOT NULL columns + var isMatch U8 // iColumn matches a term of the ORDER BY clause + var eqOpMask U16 // Allowed equality operators + var nKeyCol U16 // Number of key columns in pIndex + var nColumn U16 // Total number of ordered columns in the index + var nOrderBy U16 // Number terms in the ORDER BY clause + var iLoop int32 // Index of WhereLoop in pPath being processed + var i int32 + var j int32 // Loop counters + var iCur int32 // Cursor number for current WhereLoop + var iColumn int32 // A column number within table iCur + var pLoop uintptr = uintptr(0) // Current WhereLoop being processed. + var pTerm uintptr // A single term of the WHERE clause + var pOBExpr uintptr // An expression from the ORDER BY clause + var pColl uintptr // COLLATE function from an ORDER BY clause term + var pIndex uintptr // The index associated with pLoop + var db uintptr = (*Parse)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse)).Fdb // Database connection + var obSat Bitmask = uint64(0) // Mask of ORDER BY terms satisfied so far + var obDone Bitmask // Mask of all ORDER BY terms + var orderDistinctMask Bitmask // Mask of all well-ordered loops + var ready Bitmask // Mask of inner loops + + // We say the WhereLoop is "one-row" if it generates no more than one + // row of output. A WhereLoop is one-row if all of the following are true: + // (a) All index columns match with WHERE_COLUMN_EQ. + // (b) The index is unique + // Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row. + // Every one-row WhereLoop will have the WHERE_ONEROW bit set in wsFlags. + // + // We say the WhereLoop is "order-distinct" if the set of columns from + // that WhereLoop that are in the ORDER BY clause are different for every + // row of the WhereLoop. Every one-row WhereLoop is automatically + // order-distinct. A WhereLoop that has no columns in the ORDER BY clause + // is not order-distinct. To be order-distinct is not quite the same as being + // UNIQUE since a UNIQUE column or index can have multiple rows that + // are NULL and NULL values are equivalent for the purpose of order-distinct. + // To be order-distinct, the columns must be UNIQUE and NOT NULL. + // + // The rowid for a table is always UNIQUE and NOT NULL so whenever the + // rowid appears in the ORDER BY clause, the corresponding WhereLoop is + // automatically order-distinct. + + if (nLoop != 0) && (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_OrderByIdxJoin))) != U32(0)) { + return int8(0) + } + + nOrderBy = U16((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr) + + if int32(nOrderBy) > ((int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) - 1) { + return int8(0) + } // Cannot optimize overly large ORDER BYs + isOrderDistinct = U8(1) + obDone = ((Bitmask((uint64(1))) << (int32(nOrderBy))) - uint64(1)) + orderDistinctMask = uint64(0) + ready = uint64(0) + eqOpMask = (U16((WO_EQ | WO_IS) | WO_ISNULL)) + if (int32(wctrlFlags) & ((WHERE_ORDERBY_LIMIT | WHERE_ORDERBY_MAX) | WHERE_ORDERBY_MIN)) != 0 { + eqOpMask = U16(int32(eqOpMask) | (WO_IN)) + } + for iLoop = 0; ((isOrderDistinct != 0) && (obSat < obDone)) && (iLoop <= int32(nLoop)); iLoop++ { + if iLoop > 0 { + ready = ready | ((*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) + } + if iLoop < int32(nLoop) { + pLoop = *(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pPath)).FaLoop + uintptr(iLoop)*8)) + if (int32(wctrlFlags) & WHERE_ORDERBY_LIMIT) != 0 { + continue + } + } else { + pLoop = pLast + } + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_VIRTUALTABLE)) != 0 { + if (*(*I8)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.vtab */) + 5 /* &.isOrdered */)) != 0) && ((int32(wctrlFlags) & WHERE_DISTINCTBY) == 0) { + obSat = obDone + } + break + } else if (int32(wctrlFlags) & WHERE_DISTINCTBY) != 0 { + *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 6 /* &.nDistinctCol */)) = U16(0) + } + iCur = (*SrcItem)(unsafe.Pointer(((*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLoop)(unsafe.Pointer(pLoop)).FiTab)*112)).FiCursor + + // Mark off any ORDER BY term X that is a column in the table of + // the current loop for which there is term in the WHERE + // clause of the form X IS NULL or X=? that reference only outer + // loops. + for i = 0; i < int32(nOrderBy); i++ { + if ((Bitmask((uint64(1))) << (i)) & obSat) != 0 { + continue + } + pOBExpr = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FpExpr) + if pOBExpr == uintptr(0) { + continue + } + if (int32((*Expr)(unsafe.Pointer(pOBExpr)).Fop) != TK_COLUMN) && (int32((*Expr)(unsafe.Pointer(pOBExpr)).Fop) != TK_AGG_COLUMN) { + continue + } + if (*Expr)(unsafe.Pointer(pOBExpr)).FiTable != iCur { + continue + } + pTerm = Xsqlite3WhereFindTerm(tls, (pWInfo + 104 /* &.sWC */), iCur, int32((*Expr)(unsafe.Pointer(pOBExpr)).FiColumn), + ^ready, uint32(eqOpMask), uintptr(0)) + if pTerm == uintptr(0) { + continue + } + if int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) == WO_IN { + // IN terms are only valid for sorting in the ORDER BY LIMIT + // optimization, and then only if they are actually used + // by the query plan + + for j = 0; (j < int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm)) && (pTerm != *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8))); j++ { + } + if j >= int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm) { + continue + } + } + if ((int32((*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator) & (WO_EQ | WO_IS)) != 0) && (int32((*Expr)(unsafe.Pointer(pOBExpr)).FiColumn) >= 0) { + var pParse uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse + var pColl1 uintptr = Xsqlite3ExprNNCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FpExpr) + var pColl2 uintptr = Xsqlite3ExprCompareCollSeq(tls, pParse, (*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr) + + if (pColl2 == uintptr(0)) || (Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pColl1)).FzName, (*CollSeq)(unsafe.Pointer(pColl2)).FzName) != 0) { + continue + } + + } + obSat = obSat | (Bitmask((uint64(1))) << (i)) + } + + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_ONEROW)) == U32(0) { + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IPK)) != 0 { + pIndex = uintptr(0) + nKeyCol = U16(0) + nColumn = U16(1) + } else if ((libc.AssignUintptr(&pIndex, *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)))) == uintptr(0)) || ((uint32(int32(*(*uint16)(unsafe.Pointer(pIndex + 100 /* &.bUnordered */)) & 0x4 >> 2))) != 0) { + return int8(0) + } else { + nKeyCol = (*Index)(unsafe.Pointer(pIndex)).FnKeyCol + nColumn = (*Index)(unsafe.Pointer(pIndex)).FnColumn + + // All relevant terms of the index must also be non-NULL in order + // for isOrderDistinct to be true. So the isOrderDistint value + // computed here might be a false positive. Corrections will be + // made at tag-20210426-1 below + isOrderDistinct = (U8(libc.Bool32((int32((*Index)(unsafe.Pointer((pIndex))).FonError) != OE_None) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_SKIPSCAN)) == U32(0))))) + } + + // Loop through all columns of the index and deal with the ones + // that are not constrained by == or IN. + rev = libc.AssignUint8(&revSet, U8(0)) + distinctColumns = U8(0) + for j = 0; j < int32(nColumn); j++ { + var bOnce U8 = U8(1) // True to run the ORDER BY search loop + + if (j < int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */)))) && (j >= int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip)) { + var eOp U16 = (*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)))).FeOperator + + // Skip over == and IS and ISNULL terms. (Also skip IN terms when + // doing WHERE_ORDERBY_LIMIT processing). Except, IS and ISNULL + // terms imply that the index is not UNIQUE NOT NULL in which case + // the loop need to be marked as not order-distinct because it can + // have repeated NULL rows. + // + // If the current term is a column of an ((?,?) IN (SELECT...)) + // expression for which the SELECT returns more than one column, + // check that it is the only column used by this loop. Otherwise, + // if it is one of two or more, none of the columns can be + // considered to match an ORDER BY term. + if (int32(eOp) & int32(eqOpMask)) != 0 { + if (int32(eOp) & (WO_ISNULL | WO_IS)) != 0 { + + isOrderDistinct = U8(0) + } + continue + } else if (int32(eOp) & WO_IN) != 0 { + // ALWAYS() justification: eOp is an equality operator due to the + // ju.btree.nEq constraint above. Any equality other + // than WO_IN is captured by the previous "if". So this one + // always has to be WO_IN. + var pX uintptr = (*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)))).FpExpr + for i = (j + 1); i < int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */))); i++ { + if (*WhereTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(i)*8)))).FpExpr == pX { + + bOnce = U8(0) + break + } + } + } + } + + // Get the column number in the table (iColumn) and sort order + // (revIdx) for the j-th column of the index. + if pIndex != 0 { + iColumn = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaiColumn + uintptr(j)*2))) + revIdx = (U8(int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FaSortOrder + uintptr(j)))) & KEYINFO_ORDER_DESC)) + if iColumn == int32((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FpTable)).FiPKey) { + iColumn = -1 + } + } else { + iColumn = -1 + revIdx = U8(0) + } + + // An unconstrained column that might be NULL means that this + // WhereLoop is not well-ordered. tag-20210426-1 + if isOrderDistinct != 0 { + if ((iColumn >= 0) && + (j >= int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */))))) && + (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FpTable)).FaCol+uintptr(iColumn)*32)).FnotNull) == 0) { + isOrderDistinct = U8(0) + } + if iColumn == (-2) { + isOrderDistinct = U8(0) + } + } + + // Find the ORDER BY term that corresponds to the j-th column + // of the index and mark that ORDER BY term off + isMatch = U8(0) + for i = 0; (bOnce != 0) && (i < int32(nOrderBy)); i++ { + if ((Bitmask((uint64(1))) << (i)) & obSat) != 0 { + continue + } + pOBExpr = Xsqlite3ExprSkipCollateAndLikely(tls, (*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FpExpr) + + if pOBExpr == uintptr(0) { + continue + } + if (int32(wctrlFlags) & (WHERE_GROUPBY | WHERE_DISTINCTBY)) == 0 { + bOnce = U8(0) + } + if iColumn >= (-1) { + if (int32((*Expr)(unsafe.Pointer(pOBExpr)).Fop) != TK_COLUMN) && (int32((*Expr)(unsafe.Pointer(pOBExpr)).Fop) != TK_AGG_COLUMN) { + continue + } + if (*Expr)(unsafe.Pointer(pOBExpr)).FiTable != iCur { + continue + } + if int32((*Expr)(unsafe.Pointer(pOBExpr)).FiColumn) != iColumn { + continue + } + } else { + var pIdxExpr uintptr = (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIndex)).FaColExpr + 8 /* &.a */) + uintptr(j)*32)).FpExpr + if Xsqlite3ExprCompareSkip(tls, pOBExpr, pIdxExpr, iCur) != 0 { + continue + } + } + if iColumn != (-1) { + pColl = Xsqlite3ExprNNCollSeq(tls, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse, (*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FpExpr) + if Xsqlite3StrICmp(tls, (*CollSeq)(unsafe.Pointer(pColl)).FzName, *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIndex)).FazColl + uintptr(j)*8))) != 0 { + continue + } + } + if (int32(wctrlFlags) & WHERE_DISTINCTBY) != 0 { + *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 6 /* &.nDistinctCol */)) = (U16(j + 1)) + } + isMatch = U8(1) + break + } + if (isMatch != 0) && ((int32(wctrlFlags) & WHERE_GROUPBY) == 0) { + // Make sure the sort order is compatible in an ORDER BY clause. + // Sort order is irrelevant for a GROUP BY clause. + if revSet != 0 { + if (int32(rev) ^ int32(revIdx)) != (int32((*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FsortFlags) & KEYINFO_ORDER_DESC) { + isMatch = U8(0) + } + } else { + rev = (U8(int32(revIdx) ^ (int32((*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FsortFlags) & KEYINFO_ORDER_DESC))) + if rev != 0 { + *(*Bitmask)(unsafe.Pointer(pRevMask)) |= (Bitmask((uint64(1))) << (iLoop)) + } + revSet = U8(1) + } + } + if (isMatch != 0) && ((int32((*ExprList_item)(unsafe.Pointer((pOrderBy+8 /* &.a */)+uintptr(i)*32)).FsortFlags) & KEYINFO_ORDER_BIGNULL) != 0) { + if j == int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */))) { + *(*U32)(unsafe.Pointer(pLoop + 40 /* &.wsFlags */)) |= (U32(WHERE_BIGNULL_SORT)) + } else { + isMatch = U8(0) + } + } + if isMatch != 0 { + if iColumn == (-1) { + + distinctColumns = U8(1) + } + obSat = obSat | (Bitmask((uint64(1))) << (i)) + } else { + // No match found + if (j == 0) || (j < int32(nKeyCol)) { + + isOrderDistinct = U8(0) + } + break + } + } // end Loop over all index columns + if distinctColumns != 0 { + + isOrderDistinct = U8(1) + } + } // end-if not one-row + + // Mark off any other ORDER BY terms that reference pLoop + if isOrderDistinct != 0 { + orderDistinctMask = orderDistinctMask | ((*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) + for i = 0; i < int32(nOrderBy); i++ { + var p uintptr + var mTerm Bitmask + if ((Bitmask((uint64(1))) << (i)) & obSat) != 0 { + continue + } + p = (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */) + uintptr(i)*32)).FpExpr + mTerm = Xsqlite3WhereExprUsage(tls, (pWInfo + 592 /* &.sMaskSet */), p) + if (mTerm == uint64(0)) && !(Xsqlite3ExprIsConstant(tls, p) != 0) { + continue + } + if (mTerm & ^orderDistinctMask) == uint64(0) { + obSat = obSat | (Bitmask((uint64(1))) << (i)) + } + } + } + } // End the loop over all WhereLoops from outer-most down to inner-most + if obSat == obDone { + return I8(nOrderBy) + } + if !(isOrderDistinct != 0) { + for i = (int32(nOrderBy) - 1); i > 0; i-- { + var m Bitmask = ((Bitmask((uint64(1))) << (i)) - uint64(1)) + if (obSat & m) == m { + return I8(i) + } + } + return int8(0) + } + return int8(-1) +} + +// If the WHERE_GROUPBY flag is set in the mask passed to sqlite3WhereBegin(), +// the planner assumes that the specified pOrderBy list is actually a GROUP +// BY clause - and so any order that groups rows as required satisfies the +// request. +// +// Normally, in this case it is not possible for the caller to determine +// whether or not the rows are really being delivered in sorted order, or +// just in some other order that provides the required grouping. However, +// if the WHERE_SORTBYGROUP flag is also passed to sqlite3WhereBegin(), then +// this function may be called on the returned WhereInfo object. It returns +// true if the rows really will be sorted in the specified order, or false +// otherwise. +// +// For example, assuming: +// +// CREATE INDEX i1 ON t1(x, Y); +// +// then +// +// SELECT * FROM t1 GROUP BY x,y ORDER BY x,y; -- IsSorted()==1 +// SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0 +func Xsqlite3WhereIsSorted(tls *libc.TLS, pWInfo uintptr) int32 { /* sqlite3.c:153344:20: */ + + return (int32(*(*uint8)(unsafe.Pointer(pWInfo + 68 /* &.sorted */)) & 0x8 >> 3)) +} + +// Return the cost of sorting nRow rows, assuming that the keys have +// nOrderby columns and that the first nSorted columns are already in +// order. +func whereSortingCost(tls *libc.TLS, pWInfo uintptr, nRow LogEst, nOrderBy int32, nSorted int32) LogEst { /* sqlite3.c:153367:15: */ + // TUNING: Estimated cost of a full external sort, where N is + // the number of rows to sort is: + // + // cost = (3.0 * N * log(N)). + // + // Or, if the order-by clause has X terms but only the last Y + // terms are out of order, then block-sorting will reduce the + // sorting cost to: + // + // cost = (3.0 * N * log(N)) * (Y/X) + // + // The (Y/X) term is implemented using stack variable rScale + // below. + var rScale LogEst + var rSortCost LogEst + + rScale = (LogEst(int32(Xsqlite3LogEst(tls, (uint64(((nOrderBy-nSorted)*100)/nOrderBy)))) - 66)) + rSortCost = (LogEst((int32(nRow) + int32(rScale)) + 16)) + + // Multiple by log(M) where M is the number of output rows. + // Use the LIMIT for M if it is smaller. Or if this sort is for + // a DISTINCT operator, M will be the number of distinct output + // rows, so fudge it downwards a bit. + if ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_USE_LIMIT) != 0) && (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FiLimit) < int32(nRow)) { + nRow = (*WhereInfo)(unsafe.Pointer(pWInfo)).FiLimit + } else if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_WANT_DISTINCT) != 0 { + // TUNING: In the sort for a DISTINCT operator, assume that the DISTINCT + // reduces the number of output rows by a factor of 2 + if int32(nRow) > 10 { + nRow = int16(int32(nRow) - (10)) + } + } + rSortCost = LogEst(int32(rSortCost) + (int32(estLog(tls, nRow)))) + return rSortCost +} + +// Given the list of WhereLoop objects at pWInfo->pLoops, this routine +// attempts to find the lowest cost path that visits each WhereLoop +// once. This path is then loaded into the pWInfo->a[].pWLoop fields. +// +// Assume that the total number of output rows that will need to be sorted +// will be nRowEst (in the 10*log2 representation). Or, ignore sorting +// costs if nRowEst==0. +// +// Return SQLITE_OK on success or SQLITE_NOMEM of a memory allocation +// error occurs. +func wherePathSolver(tls *libc.TLS, pWInfo uintptr, nRowEst LogEst) int32 { /* sqlite3.c:153420:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var mxChoice int32 // Maximum number of simultaneous paths tracked + var nLoop int32 // Number of terms in the join + var pParse uintptr // Parsing context + var db uintptr // The database connection + var iLoop int32 // Loop counter over the terms of the join + var ii int32 + var jj int32 // Loop counters + var mxI int32 = 0 // Index of next entry to replace + var nOrderBy int32 // Number of ORDER BY clause terms + var mxCost LogEst = int16(0) // Maximum cost of a set of paths + var mxUnsorted LogEst = int16(0) // Maximum unsorted cost of a set of path + var nTo int32 + var nFrom int32 // Number of valid entries in aTo[] and aFrom[] + var aFrom uintptr // All nFrom paths at the previous level + var aTo uintptr // The nTo best paths at the current level + var pFrom uintptr // An element of aFrom[] that we are working on + var pTo uintptr // An element of aTo[] that we are working on + var pWLoop uintptr // One of the WhereLoop objects + var pX uintptr // Used to divy up the pSpace memory + var aSortCost uintptr = uintptr(0) // Sorting and partial sorting costs + var pSpace uintptr // Temporary memory used by this routine + var nSpace int32 // Bytes of space allocated at pSpace + + pParse = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + nLoop = int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) + // TUNING: For simple queries, only the best path is tracked. + // For 2-way joins, the 5 best paths are followed. + // For joins of 3 or more tables, track the 10 best paths + if nLoop <= 1 { + mxChoice = 1 + } else { + mxChoice = func() int32 { + if nLoop == 2 { + return 5 + } + return 10 + }() + } + + // If nRowEst is zero and there is an ORDER BY clause, ignore it. In this + // case the purpose of this call is to estimate the number of rows returned + // by the overall query. Once this estimate has been obtained, the caller + // will invoke this function a second time, passing the estimate as the + // nRowEst parameter. + if ((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy == uintptr(0)) || (int32(nRowEst) == 0) { + nOrderBy = 0 + } else { + nOrderBy = (*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr + } + + // Allocate and initialize space for aTo, aFrom and aSortCost[] + nSpace = (int32(((uint64(unsafe.Sizeof(WherePath{})) + (uint64(unsafe.Sizeof(uintptr(0))) * uint64(nLoop))) * uint64(mxChoice)) * uint64(2))) + nSpace = int32(uint64(nSpace) + (uint64(unsafe.Sizeof(LogEst(0))) * uint64(nOrderBy))) + pSpace = Xsqlite3DbMallocRawNN(tls, db, uint64(nSpace)) + if pSpace == uintptr(0) { + return SQLITE_NOMEM + } + aTo = pSpace + aFrom = (aTo + uintptr(mxChoice)*32) + libc.Xmemset(tls, aFrom, 0, uint64(unsafe.Sizeof(WherePath{}))) + pX = (aFrom + uintptr(mxChoice)*32) + ii = (mxChoice * 2) + pFrom = aTo +__1: + if !(ii > 0) { + goto __3 + } + { + (*WherePath)(unsafe.Pointer(pFrom)).FaLoop = pX + + } + goto __2 +__2: + ii-- + pFrom += 32 + pX += 8 * (uintptr(nLoop)) + goto __1 + goto __3 +__3: + ; + if nOrderBy != 0 { + // If there is an ORDER BY clause and it is not being ignored, set up + // space for the aSortCost[] array. Each element of the aSortCost array + // is either zero - meaning it has not yet been initialized - or the + // cost of sorting nRowEst rows of data where the first X terms of + // the ORDER BY clause are already in order, where X is the array + // index. + aSortCost = pX + libc.Xmemset(tls, aSortCost, 0, (uint64(unsafe.Sizeof(LogEst(0))) * uint64(nOrderBy))) + } + + // Seed the search with a single WherePath containing zero WhereLoops. + // + // TUNING: Do not let the number of iterations go above 28. If the cost + // of computing an automatic index is not paid back within the first 28 + // rows, then do not use the automatic index. + (*WherePath)(unsafe.Pointer(aFrom)).FnRow = func() int16 { + if ((*Parse)(unsafe.Pointer(pParse)).FnQueryLoop) < (U32(48)) { + return int16((*Parse)(unsafe.Pointer(pParse)).FnQueryLoop) + } + return int16(48) + }() + nFrom = 1 + + if nOrderBy != 0 { + // If nLoop is zero, then there are no FROM terms in the query. Since + // in this case the query may return a maximum of one row, the results + // are already in the requested order. Set isOrdered to nOrderBy to + // indicate this. Or, if nLoop is greater than zero, set isOrdered to + // -1, indicating that the result set may or may not be ordered, + // depending on the loops added to the current plan. + (*WherePath)(unsafe.Pointer(aFrom)).FisOrdered = func() int8 { + if nLoop > 0 { + return int8(-1) + } + return int8(nOrderBy) + }() + } + + // Compute successively longer WherePaths using the previous generation + // of WherePaths as the basis for the next. Keep track of the mxChoice + // best paths at each generation + for iLoop = 0; iLoop < nLoop; iLoop++ { + nTo = 0 + ii = 0 + pFrom = aFrom + __4: + if !(ii < nFrom) { + goto __6 + } + { + for pWLoop = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops; pWLoop != 0; pWLoop = (*WhereLoop)(unsafe.Pointer(pWLoop)).FpNextLoop { + var nOut LogEst // Rows visited by (pFrom+pWLoop) + var rCost LogEst // Cost of path (pFrom+pWLoop) + var rUnsorted LogEst // Unsorted cost of (pFrom+pWLoop) + var isOrdered I8 = (*WherePath)(unsafe.Pointer(pFrom)).FisOrdered // isOrdered for (pFrom+pWLoop) + var maskNew Bitmask // Mask of src visited by (..) + *(*Bitmask)(unsafe.Pointer(bp /* revMask */)) = uint64(0) // Mask of rev-order loops for (..) + + if ((*WhereLoop)(unsafe.Pointer(pWLoop)).Fprereq & ^(*WherePath)(unsafe.Pointer(pFrom)).FmaskLoop) != uint64(0) { + continue + } + if ((*WhereLoop)(unsafe.Pointer(pWLoop)).FmaskSelf & (*WherePath)(unsafe.Pointer(pFrom)).FmaskLoop) != uint64(0) { + continue + } + if (((*WhereLoop)(unsafe.Pointer(pWLoop)).FwsFlags & U32(WHERE_AUTO_INDEX)) != U32(0)) && (int32((*WherePath)(unsafe.Pointer(pFrom)).FnRow) < 3) { + // Do not use an automatic index if the this loop is expected + // to run less than 1.25 times. It is tempting to also exclude + // automatic index usage on an outer loop, but sometimes an automatic + // index is useful in the outer loop of a correlated subquery. + + continue + } + + // At this point, pWLoop is a candidate to be the next loop. + // Compute its cost + rUnsorted = Xsqlite3LogEstAdd(tls, (*WhereLoop)(unsafe.Pointer(pWLoop)).FrSetup, (int16(int32((*WhereLoop)(unsafe.Pointer(pWLoop)).FrRun) + int32((*WherePath)(unsafe.Pointer(pFrom)).FnRow)))) + rUnsorted = Xsqlite3LogEstAdd(tls, rUnsorted, (*WherePath)(unsafe.Pointer(pFrom)).FrUnsorted) + nOut = (LogEst(int32((*WherePath)(unsafe.Pointer(pFrom)).FnRow) + int32((*WhereLoop)(unsafe.Pointer(pWLoop)).FnOut))) + maskNew = ((*WherePath)(unsafe.Pointer(pFrom)).FmaskLoop | (*WhereLoop)(unsafe.Pointer(pWLoop)).FmaskSelf) + if int32(isOrdered) < 0 { + isOrdered = wherePathSatisfiesOrderBy(tls, pWInfo, + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, pFrom, (*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags, + uint16(iLoop), pWLoop, bp /* &revMask */) + } else { + *(*Bitmask)(unsafe.Pointer(bp /* revMask */)) = (*WherePath)(unsafe.Pointer(pFrom)).FrevLoop + } + if (int32(isOrdered) >= 0) && (int32(isOrdered) < nOrderBy) { + if int32(*(*LogEst)(unsafe.Pointer(aSortCost + uintptr(isOrdered)*2))) == 0 { + *(*LogEst)(unsafe.Pointer(aSortCost + uintptr(isOrdered)*2)) = whereSortingCost(tls, + pWInfo, nRowEst, nOrderBy, int32(isOrdered)) + } + // TUNING: Add a small extra penalty (5) to sorting as an + // extra encouragment to the query planner to select a plan + // where the rows emerge in the correct order without any sorting + // required. + rCost = (LogEst(int32(Xsqlite3LogEstAdd(tls, rUnsorted, *(*LogEst)(unsafe.Pointer(aSortCost + uintptr(isOrdered)*2)))) + 5)) + + } else { + rCost = rUnsorted + rUnsorted = int16(int32(rUnsorted) - (2)) // TUNING: Slight bias in favor of no-sort plans + } + + // Check to see if pWLoop should be added to the set of + // mxChoice best-so-far paths. + // + // First look for an existing path among best-so-far paths + // that covers the same set of loops and has the same isOrdered + // setting as the current path candidate. + // + // The term "((pTo->isOrdered^isOrdered)&0x80)==0" is equivalent + // to (pTo->isOrdered==(-1))==(isOrdered==(-1))" for the range + // of legal values for isOrdered, -1..64. + jj = 0 + pTo = aTo + __7: + if !(jj < nTo) { + goto __9 + } + { + if ((*WherePath)(unsafe.Pointer(pTo)).FmaskLoop == maskNew) && + (((int32((*WherePath)(unsafe.Pointer(pTo)).FisOrdered) ^ int32(isOrdered)) & 0x80) == 0) { + + goto __9 + } + + } + goto __8 + __8: + jj++ + pTo += 32 + goto __7 + goto __9 + __9: + ; + if jj >= nTo { + // None of the existing best-so-far paths match the candidate. + if (nTo >= mxChoice) && + ((int32(rCost) > int32(mxCost)) || ((int32(rCost) == int32(mxCost)) && (int32(rUnsorted) >= int32(mxUnsorted)))) { + // The current candidate is no better than any of the mxChoice + // paths currently in the best-so-far buffer. So discard + // this candidate as not viable. + continue + } + // If we reach this points it means that the new candidate path + // needs to be added to the set of best-so-far paths. + if nTo < mxChoice { + // Increase the size of the aTo set by one + jj = libc.PostIncInt32(&nTo, 1) + } else { + // New path replaces the prior worst to keep count below mxChoice + jj = mxI + } + pTo = (aTo + uintptr(jj)*32) + } else { + // Control reaches here if best-so-far path pTo=aTo[jj] covers the + // same set of loops and has the same isOrdered setting as the + // candidate path. Check to see if the candidate should replace + // pTo or if the candidate should be skipped. + // + // The conditional is an expanded vector comparison equivalent to: + // (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted) + if (int32((*WherePath)(unsafe.Pointer(pTo)).FrCost) < int32(rCost)) || + ((int32((*WherePath)(unsafe.Pointer(pTo)).FrCost) == int32(rCost)) && + ((int32((*WherePath)(unsafe.Pointer(pTo)).FnRow) < int32(nOut)) || + ((int32((*WherePath)(unsafe.Pointer(pTo)).FnRow) == int32(nOut)) && (int32((*WherePath)(unsafe.Pointer(pTo)).FrUnsorted) <= int32(rUnsorted))))) { + // Discard the candidate path from further consideration + + continue + } + + // Control reaches here if the candidate path is better than the + // pTo path. Replace pTo with the candidate. + } + // pWLoop is a winner. Add it to the set of best so far + (*WherePath)(unsafe.Pointer(pTo)).FmaskLoop = ((*WherePath)(unsafe.Pointer(pFrom)).FmaskLoop | (*WhereLoop)(unsafe.Pointer(pWLoop)).FmaskSelf) + (*WherePath)(unsafe.Pointer(pTo)).FrevLoop = *(*Bitmask)(unsafe.Pointer(bp /* revMask */)) + (*WherePath)(unsafe.Pointer(pTo)).FnRow = nOut + (*WherePath)(unsafe.Pointer(pTo)).FrCost = rCost + (*WherePath)(unsafe.Pointer(pTo)).FrUnsorted = rUnsorted + (*WherePath)(unsafe.Pointer(pTo)).FisOrdered = isOrdered + libc.Xmemcpy(tls, (*WherePath)(unsafe.Pointer(pTo)).FaLoop, (*WherePath)(unsafe.Pointer(pFrom)).FaLoop, (uint64(unsafe.Sizeof(uintptr(0))) * uint64(iLoop))) + *(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pTo)).FaLoop + uintptr(iLoop)*8)) = pWLoop + if nTo >= mxChoice { + mxI = 0 + mxCost = (*WherePath)(unsafe.Pointer(aTo)).FrCost + mxUnsorted = (*WherePath)(unsafe.Pointer(aTo)).FnRow + jj = 1 + pTo = (aTo + 1*32) + __10: + if !(jj < mxChoice) { + goto __12 + } + { + if (int32((*WherePath)(unsafe.Pointer(pTo)).FrCost) > int32(mxCost)) || + ((int32((*WherePath)(unsafe.Pointer(pTo)).FrCost) == int32(mxCost)) && (int32((*WherePath)(unsafe.Pointer(pTo)).FrUnsorted) > int32(mxUnsorted))) { + mxCost = (*WherePath)(unsafe.Pointer(pTo)).FrCost + mxUnsorted = (*WherePath)(unsafe.Pointer(pTo)).FrUnsorted + mxI = jj + } + + } + goto __11 + __11: + jj++ + pTo += 32 + goto __10 + goto __12 + __12: + } + } + + } + goto __5 + __5: + ii++ + pFrom += 32 + goto __4 + goto __6 + __6: + ; + + // Swap the roles of aFrom and aTo for the next generation + pFrom = aTo + aTo = aFrom + aFrom = pFrom + nFrom = nTo + } + + if nFrom == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+20311 /* "no query solutio..." */, 0) + Xsqlite3DbFreeNN(tls, db, pSpace) + return SQLITE_ERROR + } + + // Find the lowest cost path. pFrom will be left pointing to that path + pFrom = aFrom + for ii = 1; ii < nFrom; ii++ { + if int32((*WherePath)(unsafe.Pointer(pFrom)).FrCost) > int32((*WherePath)(unsafe.Pointer(aFrom+uintptr(ii)*32)).FrCost) { + pFrom = (aFrom + uintptr(ii)*32) + } + } + + // Load the lowest cost path into pWInfo + for iLoop = 0; iLoop < nLoop; iLoop++ { + var pLevel uintptr = ((pWInfo + 856 /* &.a */) + uintptr(iLoop)*88) + (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop = libc.AssignUintptr(&pWLoop, *(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr(iLoop)*8))) + (*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom = (*WhereLoop)(unsafe.Pointer(pWLoop)).FiTab + (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur = (*SrcItem)(unsafe.Pointer(((*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112)).FiCursor + } + if ((((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_WANT_DISTINCT) != 0) && + ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_DISTINCTBY) == 0)) && + (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_NOOP)) && + (nRowEst != 0) { + // var notUsed Bitmask at bp+8, 8 + + var rc int32 = int32(wherePathSatisfiesOrderBy(tls, pWInfo, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet, pFrom, + uint16(WHERE_DISTINCTBY), (uint16(nLoop - 1)), *(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr((nLoop-1))*8)), bp+8 /* ¬Used */)) + if rc == (*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet)).FnExpr { + (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_ORDERED) + } + } + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.bOrderedInnerLoop */, uint32(0), 2, 0x4) + if (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_DISTINCTBY) != 0 { + if int32((*WherePath)(unsafe.Pointer(pFrom)).FisOrdered) == (*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { + (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_ORDERED) + } + } else { + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = (*WherePath)(unsafe.Pointer(pFrom)).FisOrdered + (*WhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = (*WherePath)(unsafe.Pointer(pFrom)).FrevLoop + if int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) <= 0 { + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = int8(0) + if nLoop > 0 { + var wsFlags U32 = (*WhereLoop)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr((nLoop-1))*8)))).FwsFlags + if ((wsFlags & U32(WHERE_ONEROW)) == U32(0)) && + ((wsFlags & (U32(WHERE_IPK | WHERE_COLUMN_IN))) != (U32(WHERE_IPK | WHERE_COLUMN_IN))) { + *(*Bitmask)(unsafe.Pointer(bp + 16 /* m */)) = uint64(0) + var rc int32 = int32(wherePathSatisfiesOrderBy(tls, pWInfo, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, pFrom, + uint16(WHERE_ORDERBY_LIMIT), (uint16(nLoop - 1)), *(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr((nLoop-1))*8)), bp+16 /* &m */)) + + if rc == (*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.bOrderedInnerLoop */, uint32(1), 2, 0x4) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = *(*Bitmask)(unsafe.Pointer(bp + 16 /* m */)) + } + } + } + } else if ((nLoop != 0) && + (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == 1)) && + ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & (WHERE_ORDERBY_MIN | WHERE_ORDERBY_MAX)) != 0) { + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.bOrderedInnerLoop */, uint32(1), 2, 0x4) + } + } + if (((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_SORTBYGROUP) != 0) && + (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat) == (*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr)) && (nLoop > 0) { + *(*Bitmask)(unsafe.Pointer(bp + 24 /* revMask */)) = uint64(0) + var nOrder int32 = int32(wherePathSatisfiesOrderBy(tls, pWInfo, (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy, + pFrom, uint16(0), (uint16(nLoop - 1)), *(*uintptr)(unsafe.Pointer((*WherePath)(unsafe.Pointer(pFrom)).FaLoop + uintptr((nLoop-1))*8)), bp+24 /* &revMask */)) + + if nOrder == (*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr { + libc.SetBitFieldPtr8Uint32(pWInfo+68 /* &.sorted */, uint32(1), 3, 0x8) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = *(*Bitmask)(unsafe.Pointer(bp + 24 /* revMask */)) + } + } + } + + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut = (*WherePath)(unsafe.Pointer(pFrom)).FnRow + + // Free temporary memory and return success + Xsqlite3DbFreeNN(tls, db, pSpace) + return SQLITE_OK +} + +// Most queries use only a single table (they are not joins) and have +// simple == constraints against indexed fields. This routine attempts +// to plan those simple cases using much less ceremony than the +// general-purpose query planner, and thereby yield faster sqlite3_prepare() +// times for the common case. +// +// Return non-zero on success, if this query can be handled by this +// no-frills query planner. Return zero if this query needs the +// general-purpose query planner. +func whereShortCut(tls *libc.TLS, pBuilder uintptr) int32 { /* sqlite3.c:153812:12: */ + var pWInfo uintptr + var pItem uintptr + var pWC uintptr + var pTerm uintptr + var pLoop uintptr + var iCur int32 + var j int32 + var pTab uintptr + var pIdx uintptr + + pWInfo = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWInfo + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_OR_SUBCLAUSE) != 0 { + return 0 + } + + pItem = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */ + pTab = (*SrcItem)(unsafe.Pointer(pItem)).FpTab + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + return 0 + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pItem + 60 /* &.fg */ + 4 /* &.isIndexedBy */)) & 0x2 >> 1))) != 0 { + return 0 + } + iCur = (*SrcItem)(unsafe.Pointer(pItem)).FiCursor + pWC = (pWInfo + 104 /* &.sWC */) + pLoop = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpNew + (*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = U32(0) + (*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip = U16(0) + pTerm = Xsqlite3WhereFindTerm(tls, pWC, iCur, -1, uint64(0), (uint32(WO_EQ | WO_IS)), uintptr(0)) + if pTerm != 0 { + + (*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = (U32((WHERE_COLUMN_EQ | WHERE_IPK) | WHERE_ONEROW)) + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm)) = pTerm + (*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm = U16(1) + *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = U16(1) + // TUNING: Cost of a rowid lookup is 10 + (*WhereLoop)(unsafe.Pointer(pLoop)).FrRun = int16(33) // 33==sqlite3LogEst(10) + } else { + for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { + var opMask int32 + + if (!(int32((*Index)(unsafe.Pointer((pIdx))).FonError) != OE_None) || + ((*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != uintptr(0))) || + (int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) > (int32(uint64(unsafe.Sizeof([3]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))))) { + continue + } + if (uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.uniqNotNull */)) & 0x8 >> 3))) != 0 { + opMask = (WO_EQ | WO_IS) + } else { + opMask = WO_EQ + } + for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { + pTerm = Xsqlite3WhereFindTerm(tls, pWC, iCur, j, uint64(0), uint32(opMask), pIdx) + if pTerm == uintptr(0) { + break + } + + *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pLoop)).FaLTerm + uintptr(j)*8)) = pTerm + } + if j != int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) { + continue + } + (*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags = (U32((WHERE_COLUMN_EQ | WHERE_ONEROW) | WHERE_INDEXED)) + if ((uint32(int32(*(*uint16)(unsafe.Pointer(pIdx + 100 /* &.isCovering */)) & 0x20 >> 5))) != 0) || (((*SrcItem)(unsafe.Pointer(pItem)).FcolUsed & (*Index)(unsafe.Pointer(pIdx)).FcolNotIdxed) == uint64(0)) { + *(*U32)(unsafe.Pointer(pLoop + 40 /* &.wsFlags */)) |= (U32(WHERE_IDX_ONLY)) + } + (*WhereLoop)(unsafe.Pointer(pLoop)).FnLTerm = U16(j) + *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) = U16(j) + *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx + // TUNING: Cost of a unique index lookup is 15 + (*WhereLoop)(unsafe.Pointer(pLoop)).FrRun = int16(39) // 39==sqlite3LogEst(15) + break + } + } + if (*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags != 0 { + (*WhereLoop)(unsafe.Pointer(pLoop)).FnOut = int16(1) + (*WhereLevel)(unsafe.Pointer((pWInfo + 856 /* &.a */))).FpWLoop = pLoop + + (*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf = uint64(1) // sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); + (*WhereLevel)(unsafe.Pointer((pWInfo + 856 /* &.a */))).FiTabCur = iCur + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut = int16(1) + if (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0 { + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = I8((*ExprList)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy)).FnExpr) + } + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_WANT_DISTINCT) != 0 { + (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) + } + return 1 + } + return 0 +} + +// Helper function for exprIsDeterministic(). +func exprNodeIsDeterministic(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:153894:12: */ + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_FUNCTION) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_ConstFunc))) != U32(0))) == 0) { + (*Walker)(unsafe.Pointer(pWalker)).FeCode = U16(0) + return WRC_Abort + } + return WRC_Continue +} + +// Return true if the expression contains no non-deterministic SQL +// functions. Do not consider non-deterministic SQL functions that are +// part of sub-select statements. +func exprIsDeterministic(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:153907:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var w Walker at bp, 48 + + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FeCode = U16(1) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{exprNodeIsDeterministic})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3SelectWalkFail})) + Xsqlite3WalkExpr(tls, bp /* &w */, p) + return int32((*Walker)(unsafe.Pointer(bp /* &w */)).FeCode) +} + +// Generate the beginning of the loop used for WHERE clause processing. +// The return value is a pointer to an opaque structure that contains +// information needed to terminate the loop. Later, the calling routine +// should invoke sqlite3WhereEnd() with the return value of this function +// in order to complete the WHERE clause processing. +// +// If an error occurs, this routine returns NULL. +// +// The basic idea is to do a nested loop, one loop for each table in +// the FROM clause of a select. (INSERT and UPDATE statements are the +// same as a SELECT with only a single table in the FROM clause.) For +// example, if the SQL is this: +// +// SELECT * FROM t1, t2, t3 WHERE ...; +// +// Then the code generated is conceptually like the following: +// +// foreach row1 in t1 do \ Code generated +// foreach row2 in t2 do |-- by sqlite3WhereBegin() +// foreach row3 in t3 do / +// ... +// end \ Code generated +// end |-- by sqlite3WhereEnd() +// end / +// +// Note that the loops might not be nested in the order in which they +// appear in the FROM clause if a different order is better able to make +// use of indices. Note also that when the IN operator appears in +// the WHERE clause, it might result in additional nested loops for +// scanning through all values on the right-hand side of the IN. +// +// There are Btree cursors associated with each table. t1 uses cursor +// number pTabList->a[0].iCursor. t2 uses the cursor pTabList->a[1].iCursor. +// And so forth. This routine generates code to open those VDBE cursors +// and sqlite3WhereEnd() generates the code to close them. +// +// The code that sqlite3WhereBegin() generates leaves the cursors named +// in pTabList pointing at their appropriate entries. The [...] code +// can use OP_Column and OP_Rowid opcodes on these cursors to extract +// data from the various tables of the loop. +// +// If the WHERE clause is empty, the foreach loops must each scan their +// entire tables. Thus a three-way join is an O(N^3) operation. But if +// the tables have indices and there are terms in the WHERE clause that +// refer to those indices, a complete table scan can be avoided and the +// code will run much faster. Most of the work of this routine is checking +// to see if there are indices that can be used to speed up the loop. +// +// Terms of the WHERE clause are also used to limit which rows actually +// make it to the "..." in the middle of the loop. After each "foreach", +// terms of the WHERE clause that use only terms in that loop and outer +// loops are evaluated and if false a jump is made around all subsequent +// inner loops (or around the "..." if the test occurs within the inner- +// most loop) +// +// OUTER JOINS +// +// An outer join of tables t1 and t2 is conceptally coded as follows: +// +// foreach row1 in t1 do +// flag = 0 +// foreach row2 in t2 do +// start: +// ... +// flag = 1 +// end +// if flag==0 then +// move the row2 cursor to a null row +// goto start +// fi +// end +// +// ORDER BY CLAUSE PROCESSING +// +// pOrderBy is a pointer to the ORDER BY clause (or the GROUP BY clause +// if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement +// if there is one. If there is no ORDER BY clause or if this routine +// is called from an UPDATE or DELETE statement, then pOrderBy is NULL. +// +// The iIdxCur parameter is the cursor number of an index. If +// WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index +// to use for OR clause processing. The WHERE clause should use this +// specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is +// the first cursor in an array of cursors for all indices. iIdxCur should +// be used to compute the appropriate cursor depending on which index is +// used. +func Xsqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pResultSet uintptr, wctrlFlags U16, iAuxArg int32) uintptr { /* sqlite3.c:154027:26: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var nByteWInfo int32 // Num. bytes allocated for WhereInfo struct + var nTabList int32 // Number of elements in pTabList + var pWInfo uintptr // Will become the return value of this function + var v uintptr // The virtual database engine + var notReady Bitmask // Cursors that are not yet positioned + // var sWLB WhereLoopBuilder at bp+8, 64 + // The WhereLoop builder + var pMaskSet uintptr // The expression mask set + var pLevel uintptr // A single level in pWInfo->a[] + var pLoop uintptr // Pointer to a single WhereLoop object + var ii int32 // Loop counter + var db uintptr // Database connection + var rc int32 // Return code + var bFordelete U8 + var pT uintptr + var p uintptr + var nByte int32 + var pTerm uintptr + var pEnd uintptr + var pItem uintptr + var i int32 + var tabUsed Bitmask + var wsFlags int32 + var bOnerow int32 + var pVTab uintptr + var iCur int32 + // If we know that only a prefix of the record will be used, + // it is advantageous to reduce the "column count" field in + // the P4 operand of the OP_OpenRead/Write opcode. + var b Bitmask + var n int32 + var op int32 + var pJ uintptr + var pIx uintptr + var iIndexCur int32 + var op1 int32 + var pTab uintptr // Table to open + var iDb int32 // Index of database containing table/index + var pTabItem uintptr + var addrExplain int32 + _ = addrExplain + var wsFlags1 int32 + v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + bFordelete = U8(0) // OPFLAG_FORDELETE or zero, as appropriate + + // Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT + + // Variable initialization + db = (*Parse)(unsafe.Pointer(pParse)).Fdb + libc.Xmemset(tls, bp+8 /* &sWLB */, 0, uint64(unsafe.Sizeof(WhereLoopBuilder{}))) + + // An ORDER/GROUP BY clause of more than 63 terms cannot be optimized + + if !((pOrderBy != 0) && ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr >= (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))))) { + goto __1 + } + pOrderBy = uintptr(0) +__1: + ; + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpOrderBy = pOrderBy + + // Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via + // sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) + if !(((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_DistinctOpt))) != U32(0)) { + goto __2 + } + wctrlFlags = libc.Uint16FromInt32(int32(wctrlFlags) & (libc.CplInt32(WHERE_WANT_DISTINCT))) +__2: + ; + + // The number of tables in the FROM clause is limited by the number of + // bits in a Bitmask + + if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) { + goto __3 + } + Xsqlite3ErrorMsg(tls, pParse, ts+20329 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) + return uintptr(0) +__3: + ; + + // This function normally generates a nested loop for all tables in + // pTabList. But if the WHERE_OR_SUBCLAUSE flag is set, then we should + // only generate code for the first table in pTabList and assume that + // any cursors associated with subsequent tables are uninitialized. + if (int32(wctrlFlags) & WHERE_OR_SUBCLAUSE) != 0 { + nTabList = 1 + } else { + nTabList = (*SrcList)(unsafe.Pointer(pTabList)).FnSrc + } + + // Allocate and initialize the WhereInfo structure that will become the + // return value. A single allocation is used to store the WhereInfo + // struct, the contents of WhereInfo.a[], the WhereClause structure + // and the WhereMaskSet structure. Since WhereClause contains an 8-byte + // field (type Bitmask) it must be aligned on an 8-byte boundary on + // some architectures. Hence the ROUND8() below. + nByteWInfo = (int32(((uint64(unsafe.Sizeof(WhereInfo{})) + ((uint64(nTabList - 1)) * uint64(unsafe.Sizeof(WhereLevel{})))) + uint64(7)) & libc.Uint64FromInt32(libc.CplInt32(7)))) + pWInfo = Xsqlite3DbMallocRawNN(tls, db, (uint64(uint64(nByteWInfo) + uint64(unsafe.Sizeof(WhereLoop{}))))) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __4 + } + Xsqlite3DbFree(tls, db, pWInfo) + pWInfo = uintptr(0) + goto whereBeginError +__4: + ; + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse = pParse + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList = pTabList + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy = pOrderBy + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpWhere = pWhere + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpResultSet = pResultSet + *(*int32)(unsafe.Pointer((pWInfo + 40 /* &.aiCurOnePass */))) = libc.AssignPtrInt32((pWInfo+40 /* &.aiCurOnePass */)+1*4, -1) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel = U8(nTabList) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FiBreak = libc.AssignPtrInt32(pWInfo+48 /* &.iContinue */, Xsqlite3VdbeMakeLabel(tls, pParse)) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags = wctrlFlags + (*WhereInfo)(unsafe.Pointer(pWInfo)).FiLimit = LogEst(iAuxArg) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop = int32((*Parse)(unsafe.Pointer(pParse)).FnQueryLoop) + libc.Xmemset(tls, (pWInfo + 65 /* &.nOBSat */), 0, + ((uint64((uintptr(0) + 104 /* &.sWC */))) - (uint64((uintptr(0) + 65 /* &.nOBSat */))))) + libc.Xmemset(tls, (pWInfo + 856 /* &.a */), 0, (uint64(unsafe.Sizeof(WhereLoop{})) + (uint64(nTabList) * uint64(unsafe.Sizeof(WhereLevel{}))))) + // ONEPASS defaults to OFF + pMaskSet = (pWInfo + 592 /* &.sMaskSet */) + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWInfo = pWInfo + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWC = (pWInfo + 104 /* &.sWC */) + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpNew = ((pWInfo) + uintptr(nByteWInfo)) + + whereLoopInit(tls, (*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpNew) + + // Split the WHERE clause into separate subexpressions where each + // subexpression is separated by an AND operator. + (*WhereMaskSet)(unsafe.Pointer(pMaskSet)).Fn = 0 + Xsqlite3WhereClauseInit(tls, (pWInfo + 104 /* &.sWC */), pWInfo) + Xsqlite3WhereSplit(tls, (pWInfo + 104 /* &.sWC */), pWhere, uint8(TK_AND)) + + // Special case: No FROM clause + if !(nTabList == 0) { + goto __5 + } + if !(pOrderBy != 0) { + goto __7 + } + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnOBSat = I8((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr) +__7: + ; + if !((int32(wctrlFlags) & WHERE_WANT_DISTINCT) != 0) { + goto __8 + } + (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) +__8: + ; + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20357 /* "SCAN CONSTANT RO..." */, 0) + goto __6 +__5: + // Assign a bit from the bitmask to every term in the FROM clause. + // + // The N-th term of the FROM clause is assigned a bitmask of 1<nSrc tables in + // pTabList, not just the first nTabList tables. nTabList is normally + // equal to pTabList->nSrc but might be shortened to 1 if the + // WHERE_OR_SUBCLAUSE flag is set. + ii = 0 +__9: + createMask(tls, pMaskSet, (*SrcItem)(unsafe.Pointer((pTabList+8 /* &.a */)+uintptr(ii)*112)).FiCursor) + Xsqlite3WhereTabFuncArgs(tls, pParse, ((pTabList + 8 /* &.a */) + uintptr(ii)*112), (pWInfo + 104 /* &.sWC */)) + goto __10 +__10: + if (libc.PreIncInt32(&ii, 1)) < (*SrcList)(unsafe.Pointer(pTabList)).FnSrc { + goto __9 + } + goto __11 +__11: + ; +__6: + ; + + // Analyze all of the subexpressions. + Xsqlite3WhereExprAnalyze(tls, pTabList, (pWInfo + 104 /* &.sWC */)) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __12 + } + goto whereBeginError +__12: + ; + + // Special case: WHERE terms that do not refer to any tables in the join + // (constant expressions). Evaluate each such term, and jump over all the + // generated code if the result is not true. + // + // Do not do this if the expression contains non-deterministic functions + // that are not within a sub-select. This is not strictly required, but + // preserves SQLite's legacy behaviour in the following two cases: + // + // FROM ... WHERE random()>0; -- eval random() once per row + // FROM ... WHERE (SELECT random())>0; -- eval random() once overall + ii = 0 +__13: + if !(ii < (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).FnTerm) { + goto __15 + } + pT = ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).Fa + uintptr(ii)*56) + if !((int32((*WhereTerm)(unsafe.Pointer(pT)).FwtFlags) & TERM_VIRTUAL) != 0) { + goto __16 + } + goto __14 +__16: + ; + if !(((*WhereTerm)(unsafe.Pointer(pT)).FprereqAll == uint64(0)) && ((nTabList == 0) || (exprIsDeterministic(tls, (*WhereTerm)(unsafe.Pointer(pT)).FpExpr) != 0))) { + goto __17 + } + Xsqlite3ExprIfFalse(tls, pParse, (*WhereTerm)(unsafe.Pointer(pT)).FpExpr, (*WhereInfo)(unsafe.Pointer(pWInfo)).FiBreak, SQLITE_JUMPIFNULL) + *(*U16)(unsafe.Pointer(pT + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) +__17: + ; + goto __14 +__14: + ii++ + goto __13 + goto __15 +__15: + ; + + if !((int32(wctrlFlags) & WHERE_WANT_DISTINCT) != 0) { + goto __18 + } + if !(isDistinctRedundant(tls, pParse, pTabList, (pWInfo+104 /* &.sWC */), pResultSet) != 0) { + goto __19 + } + // The DISTINCT marking is pointless. Ignore it. + (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) + goto __20 +__19: + if !(pOrderBy == uintptr(0)) { + goto __21 + } + // Try to ORDER BY the result set to make distinct processing easier + *(*U16)(unsafe.Pointer(pWInfo + 60 /* &.wctrlFlags */)) |= U16((WHERE_DISTINCTBY)) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy = pResultSet +__21: + ; +__20: + ; +__18: + ; + + // Construct the WhereLoop objects + + if !((nTabList != 1) || (whereShortCut(tls, bp+8 /* &sWLB */) == 0)) { + goto __22 + } + rc = whereLoopAddAll(tls, bp+8 /* &sWLB */) + if !(rc != 0) { + goto __23 + } + goto whereBeginError +__23: + ; + + // If one or more WhereTerm.truthProb values were used in estimating + // loop parameters, but then those truthProb values were subsequently + // changed based on STAT4 information while computing subsequent loops, + // then we need to rerun the whole loop building process so that all + // loops will be built using the revised truthProb values. + if !((int32((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FbldFlags2) & SQLITE_BLDF2_2NDPASS) != 0) { + goto __24 + } + +__25: + if !((*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops != 0) { + goto __26 + } + p = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops + (*WhereInfo)(unsafe.Pointer(pWInfo)).FpLoops = (*WhereLoop)(unsafe.Pointer(p)).FpNextLoop + whereLoopDelete(tls, db, p) + goto __25 +__26: + ; + rc = whereLoopAddAll(tls, bp+8 /* &sWLB */) + if !(rc != 0) { + goto __27 + } + goto whereBeginError +__27: + ; +__24: + ; + + wherePathSolver(tls, pWInfo, int16(0)) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __28 + } + goto whereBeginError +__28: + ; + if !((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy != 0) { + goto __29 + } + wherePathSolver(tls, pWInfo, (int16(int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut) + 1))) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __30 + } + goto whereBeginError +__30: + ; +__29: + ; +__22: + ; + if !(((*WhereInfo)(unsafe.Pointer(pWInfo)).FpOrderBy == uintptr(0)) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ReverseOrder)) != uint64(0))) { + goto __31 + } + (*WhereInfo)(unsafe.Pointer(pWInfo)).FrevMask = libc.Uint64(libc.Uint64FromInt32(-1)) +__31: + ; + if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { + goto __32 + } + goto whereBeginError +__32: + ; + + // Attempt to omit tables from the join that do not affect the result. + // For a table to not affect the result, the following must be true: + // + // 1) The query must not be an aggregate. + // 2) The table must be the RHS of a LEFT JOIN. + // 3) Either the query must be DISTINCT, or else the ON or USING clause + // must contain a constraint that limits the scan of the table to + // at most a single row. + // 4) The table must not be referenced by any part of the query apart + // from its own USING or ON clause. + // + // For example, given: + // + // CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); + // CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); + // CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); + // + // then table t2 can be omitted from the following: + // + // SELECT v1, v3 FROM t1 + // LEFT JOIN t2 ON (t1.ipk=t2.ipk) + // LEFT JOIN t3 ON (t1.ipk=t3.ipk) + // + // or from: + // + // SELECT DISTINCT v1, v3 FROM t1 + // LEFT JOIN t2 + // LEFT JOIN t3 ON (t1.ipk=t3.ipk) + notReady = libc.CplUint64(uint64(0)) + if !((((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) >= 2) && + (pResultSet != uintptr(0))) && // these two combine to guarantee + (0 == (int32(wctrlFlags) & WHERE_AGG_DISTINCT))) && // condition (1) above + (((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_OmitNoopJoin))) == U32(0))) { + goto __33 + } + tabUsed = Xsqlite3WhereExprListUsage(tls, pMaskSet, pResultSet) + if !((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpOrderBy != 0) { + goto __34 + } + tabUsed = tabUsed | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpOrderBy)) +__34: + ; + i = (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1) +__35: + if !(i >= 1) { + goto __37 + } + pLoop = (*WhereLevel)(unsafe.Pointer((pWInfo + 856 /* &.a */) + uintptr(i)*88)).FpWLoop + pItem = (((*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + 8 /* &.a */) + uintptr((*WhereLoop)(unsafe.Pointer(pLoop)).FiTab)*112) + if !((int32((*SrcItem)(unsafe.Pointer(pItem)).Ffg.Fjointype) & JT_LEFT) == 0) { + goto __38 + } + goto __36 +__38: + ; + if !(((int32(wctrlFlags) & WHERE_WANT_DISTINCT) == 0) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_ONEROW)) == U32(0))) { + goto __39 + } + goto __36 +__39: + ; + if !((tabUsed & (*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) != uint64(0)) { + goto __40 + } + goto __36 +__40: + ; + pEnd = ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).FnTerm)*56) + pTerm = (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWC)).Fa +__41: + if !(pTerm < pEnd) { + goto __43 + } + if !(((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & (*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) != uint64(0)) { + goto __44 + } + if !(!(((*Expr)(unsafe.Pointer(((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr))).Fflags & (U32(EP_FromJoin))) != U32(0)) || + ((*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pTerm)).FpExpr)).FiRightJoinTable != (*SrcItem)(unsafe.Pointer(pItem)).FiCursor)) { + goto __45 + } + goto __43 +__45: + ; +__44: + ; + goto __42 +__42: + pTerm += 56 + goto __41 + goto __43 +__43: + ; + if !(pTerm < pEnd) { + goto __46 + } + goto __36 +__46: + ; + + notReady = notReady & (^(*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) + pTerm = (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWC)).Fa +__47: + if !(pTerm < pEnd) { + goto __49 + } + if !(((*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll & (*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) != uint64(0)) { + goto __50 + } + *(*U16)(unsafe.Pointer(pTerm + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) +__50: + ; + goto __48 +__48: + pTerm += 56 + goto __47 + goto __49 +__49: + ; + if !(i != (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1)) { + goto __51 + } + nByte = (int32((uint64((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1) - i)) * uint64(unsafe.Sizeof(WhereLevel{})))) + libc.Xmemmove(tls, ((pWInfo + 856 /* &.a */) + uintptr(i)*88), ((pWInfo + 856 /* &.a */) + uintptr((i+1))*88), uint64(nByte)) +__51: + ; + (*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel-- + nTabList-- + goto __36 +__36: + i-- + goto __35 + goto __37 +__37: + ; +__33: + ; + *(*U32)(unsafe.Pointer((*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse + 192 /* &.nQueryLoop */)) += (U32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnRowOut)) + + // If the caller is an UPDATE or DELETE statement that is requesting + // to use a one-pass algorithm, determine if this is appropriate. + // + // A one-pass approach can be used if the caller has requested one + // and either (a) the scan visits at most one row or (b) each + // of the following are true: + // + // * the caller has indicated that a one-pass approach can be used + // with multiple rows (by setting WHERE_ONEPASS_MULTIROW), and + // * the table is not a virtual table, and + // * either the scan does not use the OR optimization or the caller + // is a DELETE operation (WHERE_DUPLICATES_OK is only specified + // for DELETE). + // + // The last qualification is because an UPDATE statement uses + // WhereInfo.aiCurOnePass[1] to determine whether or not it really can + // use a one-pass approach, and this is not set accurately for scans + // that use the OR optimization. + + if !((int32(wctrlFlags) & WHERE_ONEPASS_DESIRED) != 0) { + goto __52 + } + wsFlags = int32((*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer((pWInfo + 856 /* &.a */))).FpWLoop)).FwsFlags) + bOnerow = (libc.Bool32((wsFlags & WHERE_ONEROW) != 0)) + + if !((bOnerow != 0) || (((0 != (int32(wctrlFlags) & WHERE_ONEPASS_MULTIROW)) && + !((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FpTab)).FnModuleArg != 0)) && + ((0 == (wsFlags & WHERE_MULTI_OR)) || ((int32(wctrlFlags) & WHERE_DUPLICATES_OK) != 0)))) { + goto __53 + } + (*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass = func() uint8 { + if bOnerow != 0 { + return uint8(ONEPASS_SINGLE) + } + return uint8(ONEPASS_MULTI) + }() + if !((((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((wsFlags & WHERE_IDX_ONLY) != 0)) { + goto __54 + } + if !((int32(wctrlFlags) & WHERE_ONEPASS_MULTIROW) != 0) { + goto __55 + } + bFordelete = U8(OPFLAG_FORDELETE) +__55: + ; + (*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer((pWInfo + 856 /* &.a */))).FpWLoop)).FwsFlags = (U32(wsFlags & libc.CplInt32(WHERE_IDX_ONLY))) +__54: + ; +__53: + ; +__52: + ; + + // Open all tables in the pTabList and any indices selected for + // searching those tables. + ii = 0 + pLevel = pWInfo + 856 /* &.a */ +__56: + if !(ii < nTabList) { + goto __58 + } + + pTabItem = ((pTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112) + pTab = (*SrcItem)(unsafe.Pointer(pTabItem)).FpTab + iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if !((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Ephemeral)) != U32(0)) || ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { + goto __59 + } + // Do nothing + goto __60 +__59: + if !(((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_VIRTUALTABLE)) != U32(0)) { + goto __61 + } + pVTab = Xsqlite3GetVTable(tls, db, pTab) + iCur = (*SrcItem)(unsafe.Pointer(pTabItem)).FiCursor + Xsqlite3VdbeAddOp4(tls, v, OP_VOpen, iCur, 0, 0, pVTab, -12) + goto __62 +__61: + if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { + goto __63 + } + // noop + goto __64 +__63: + if !((((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IDX_ONLY)) == U32(0)) && + ((int32(wctrlFlags) & WHERE_OR_SUBCLAUSE) == 0)) { + goto __65 + } + op = OP_OpenRead + if !(int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) != ONEPASS_OFF) { + goto __67 + } + op = OP_OpenWrite + *(*int32)(unsafe.Pointer((pWInfo + 40 /* &.aiCurOnePass */))) = (*SrcItem)(unsafe.Pointer(pTabItem)).FiCursor +__67: + ; + + Xsqlite3OpenTable(tls, pParse, (*SrcItem)(unsafe.Pointer(pTabItem)).FiCursor, iDb, pTab, op) + + if !(((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) == ONEPASS_OFF) && + (int32((*Table)(unsafe.Pointer(pTab)).FnCol) < (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))))) && + (((*Table)(unsafe.Pointer(pTab)).FtabFlags & (U32(TF_HasGenerated | TF_WithoutRowid))) == U32(0))) { + goto __68 + } + // If we know that only a prefix of the record will be used, + // it is advantageous to reduce the "column count" field in + // the P4 operand of the OP_OpenRead/Write opcode. + b = (*SrcItem)(unsafe.Pointer(pTabItem)).FcolUsed + n = 0 +__69: + if !(b != 0) { + goto __71 + } + goto __70 +__70: + b = (b >> 1) + n++ + goto __69 + goto __71 +__71: + ; + Xsqlite3VdbeChangeP4(tls, v, -1, uintptr(int64(n)), -3) + +__68: + ; + + Xsqlite3VdbeChangeP5(tls, v, uint16(bFordelete)) + + goto __66 +__65: + Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pTab)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pTab)).FzName) +__66: + ; +__64: + ; +__62: + ; +__60: + ; + if !(((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_INDEXED)) != 0) { + goto __72 + } + pIx = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + op1 = OP_OpenRead + // iAuxArg is always set to a positive value if ONEPASS is possible + + if !((!(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)) && + ((int32(wctrlFlags) & WHERE_OR_SUBCLAUSE) != 0)) { + goto __73 + } + // This is one term of an OR-optimization using the PRIMARY KEY of a + // WITHOUT ROWID table. No need for a separate index + iIndexCur = (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur + op1 = 0 + goto __74 +__73: + if !(int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) != ONEPASS_OFF) { + goto __75 + } + pJ = (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pTabItem)).FpTab)).FpIndex + iIndexCur = iAuxArg + +__77: + if !((pJ != 0) && (pJ != pIx)) { + goto __78 + } + iIndexCur++ + pJ = (*Index)(unsafe.Pointer(pJ)).FpNext + goto __77 +__78: + ; + op1 = OP_OpenWrite + *(*int32)(unsafe.Pointer((pWInfo + 40 /* &.aiCurOnePass */) + 1*4)) = iIndexCur + goto __76 +__75: + if !((iAuxArg != 0) && ((int32(wctrlFlags) & WHERE_OR_SUBCLAUSE) != 0)) { + goto __79 + } + iIndexCur = iAuxArg + op1 = OP_ReopenIdx + goto __80 +__79: + iIndexCur = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) +__80: + ; +__76: + ; +__74: + ; + (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur = iIndexCur + + if !(op1 != 0) { + goto __81 + } + Xsqlite3VdbeAddOp3(tls, v, op1, iIndexCur, int32((*Index)(unsafe.Pointer(pIx)).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIx) + if !((((((((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_CONSTRAINT)) != U32(0)) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_COLUMN_RANGE | WHERE_SKIPSCAN))) == U32(0))) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BIGNULL_SORT)) == U32(0))) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_SEEKSCAN)) == U32(0))) && + ((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FwctrlFlags) & WHERE_ORDERBY_MIN) == 0)) && + (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) != WHERE_DISTINCT_ORDERED)) { + goto __82 + } + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SEEKEQ)) +__82: + ; + +__81: + ; +__72: + ; + if !(iDb >= 0) { + goto __83 + } + Xsqlite3CodeVerifySchema(tls, pParse, iDb) +__83: + ; + goto __57 +__57: + ii++ + pLevel += 88 + goto __56 + goto __58 +__58: + ; + (*WhereInfo)(unsafe.Pointer(pWInfo)).FiTop = Xsqlite3VdbeCurrentAddr(tls, v) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __84 + } + goto whereBeginError +__84: + ; + + // Generate the code to do the search. Each iteration of the for + // loop below generates code for a single nested loop of the VM + // program. + ii = 0 +__85: + if !(ii < nTabList) { + goto __87 + } + pLevel = ((pWInfo + 856 /* &.a */) + uintptr(ii)*88) + wsFlags1 = int32((*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FwsFlags) + if !(((*WhereLoop1)(unsafe.Pointer((*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop)).FwsFlags & U32(WHERE_AUTO_INDEX)) != U32(0)) { + goto __88 + } + constructAutomaticIndex(tls, pParse, (pWInfo + 104 /* &.sWC */), + ((pTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112), notReady, pLevel) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __89 + } + goto whereBeginError +__89: + ; +__88: + ; + addrExplain = Xsqlite3WhereExplainOneScan(tls, + pParse, pTabList, pLevel, wctrlFlags) + (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBody = Xsqlite3VdbeCurrentAddr(tls, v) + notReady = Xsqlite3WhereCodeOneLoopStart(tls, pParse, v, pWInfo, ii, pLevel, notReady) + (*WhereInfo)(unsafe.Pointer(pWInfo)).FiContinue = (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrCont + if !(((wsFlags1 & WHERE_MULTI_OR) == 0) && ((int32(wctrlFlags) & WHERE_OR_SUBCLAUSE) == 0)) { + goto __90 + } + _ = addrExplain +__90: + ; + goto __86 +__86: + ii++ + goto __85 + goto __87 +__87: + ; + + // Done. + + (*WhereInfo)(unsafe.Pointer(pWInfo)).FiEndWhere = Xsqlite3VdbeCurrentAddr(tls, v) + return pWInfo + + // Jump here if malloc fails +whereBeginError: + if !(pWInfo != 0) { + goto __91 + } + + whereUndoExprMods(tls, pWInfo) + (*Parse)(unsafe.Pointer(pParse)).FnQueryLoop = U32((*WhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) + whereInfoFree(tls, db, pWInfo) +__91: + ; + return uintptr(0) +} + +// Part of sqlite3WhereEnd() will rewrite opcodes to reference the +// index rather than the main table. In SQLITE_DEBUG mode, we want +// to trace those changes if PRAGMA vdbe_addoptrace=on. This routine +// does that. + +// Generate the end of the WHERE loop. See comments on +// sqlite3WhereBegin() for additional information. +func Xsqlite3WhereEnd(tls *libc.TLS, pWInfo uintptr) { /* sqlite3.c:154626:21: */ + var pParse uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpParse + var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe + var i int32 + var pLevel uintptr + var pLoop uintptr + var pTabList uintptr = (*WhereInfo)(unsafe.Pointer(pWInfo)).FpTabList + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var iEnd int32 = Xsqlite3VdbeCurrentAddr(tls, v) + + // Generate loop termination code. + + for i = (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1); i >= 0; i-- { + var addr int32 + pLevel = ((pWInfo + 856 /* &.a */) + uintptr(i)*88) + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + if int32((*WhereLevel)(unsafe.Pointer(pLevel)).Fop) != OP_Noop { + var addrSeek int32 = 0 + var pIdx uintptr + var n int32 + if (((((int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct) == WHERE_DISTINCT_ORDERED) && + (i == (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1))) && // Ticket [ef9318757b152e3] 2017-10-21 + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_INDEXED)) != U32(0))) && + ((uint32(int32(*(*uint16)(unsafe.Pointer((libc.AssignUintptr(&pIdx, *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)))) + 100 /* &.hasStat1 */)) & 0x80 >> 7))) != 0)) && + ((libc.AssignInt32(&n, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 6 /* &.nDistinctCol */))))) > 0)) && + (int32(*(*LogEst)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiRowLogEst + uintptr(n)*2))) >= 36) { + var r1 int32 = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + var j int32 + var op int32 + for j = 0; j < n; j++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, j, (r1 + j)) + } + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (n + 1) + if int32((*WhereLevel)(unsafe.Pointer(pLevel)).Fop) == OP_Prev { + op = OP_SeekLT + } else { + op = OP_SeekGT + } + addrSeek = Xsqlite3VdbeAddOp4Int(tls, v, op, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, 0, r1, n) + + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 1, (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2) + } + // The common case: Advance to the next row + Xsqlite3VdbeResolveLabel(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrCont) + Xsqlite3VdbeAddOp3(tls, v, int32((*WhereLevel)(unsafe.Pointer(pLevel)).Fop), (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1, (*WhereLevel)(unsafe.Pointer(pLevel)).Fp2, int32((*WhereLevel)(unsafe.Pointer(pLevel)).Fp3)) + Xsqlite3VdbeChangeP5(tls, v, uint16((*WhereLevel)(unsafe.Pointer(pLevel)).Fp5)) + + if (*WhereLevel)(unsafe.Pointer(pLevel)).FregBignull != 0 { + Xsqlite3VdbeResolveLabel(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBignull) + Xsqlite3VdbeAddOp2(tls, v, OP_DecrJumpZero, (*WhereLevel)(unsafe.Pointer(pLevel)).FregBignull, ((*WhereLevel)(unsafe.Pointer(pLevel)).Fp2 - 1)) + + } + if addrSeek != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrSeek) + } + } else { + Xsqlite3VdbeResolveLabel(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrCont) + } + if (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_ABLE)) != 0) && (*(*int32)(unsafe.Pointer((pLevel + 56 /* &.u */ /* &.in */) /* &.nIn */)) > 0) { + var pIn uintptr + var j int32 + Xsqlite3VdbeResolveLabel(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrNxt) + j = *(*int32)(unsafe.Pointer(pLevel + 56 /* &.u */ /* &.in */ /* &.nIn */)) + pIn = (*(*uintptr)(unsafe.Pointer((pLevel + 56 /* &.u */ /* &.in */) + 8 /* &.aInLoop */)) + uintptr((j-1))*20) + __1: + if !(j > 0) { + goto __3 + } + { + + Xsqlite3VdbeJumpHere(tls, v, ((*InLoop)(unsafe.Pointer(pIn)).FaddrInTop + 1)) + if int32((*InLoop)(unsafe.Pointer(pIn)).FeEndLoopOp) != OP_Noop { + if (*InLoop)(unsafe.Pointer(pIn)).FnPrefix != 0 { + var bEarlyOut int32 = (libc.Bool32((((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_VIRTUALTABLE)) == U32(0)) && + (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_IN_EARLYOUT)) != U32(0)))) + if (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + // For LEFT JOIN queries, cursor pIn->iCur may not have been + // opened yet. This occurs for WHERE clauses such as + // "a = ? AND b IN (...)", where the index is on (a, b). If + // the RHS of the (a=?) is NULL, then the "b IN (...)" may + // never have been coded, but the body of the loop run to + // return the null-row. So, if the cursor is not open yet, + // jump over the OP_Next or OP_Prev instruction about to + // be coded. + Xsqlite3VdbeAddOp2(tls, v, OP_IfNotOpen, (*InLoop)(unsafe.Pointer(pIn)).FiCur, + ((Xsqlite3VdbeCurrentAddr(tls, v) + 2) + bEarlyOut)) + + } + if bEarlyOut != 0 { + Xsqlite3VdbeAddOp4Int(tls, v, OP_IfNoHope, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur, + (Xsqlite3VdbeCurrentAddr(tls, v) + 2), + (*InLoop)(unsafe.Pointer(pIn)).FiBase, (*InLoop)(unsafe.Pointer(pIn)).FnPrefix) + + // Retarget the OP_IsNull against the left operand of IN so + // it jumps past the OP_IfNoHope. This is because the + // OP_IsNull also bypasses the OP_Affinity opcode that is + // required by OP_IfNoHope. + Xsqlite3VdbeJumpHere(tls, v, ((*InLoop)(unsafe.Pointer(pIn)).FaddrInTop + 1)) + } + } + Xsqlite3VdbeAddOp2(tls, v, int32((*InLoop)(unsafe.Pointer(pIn)).FeEndLoopOp), (*InLoop)(unsafe.Pointer(pIn)).FiCur, (*InLoop)(unsafe.Pointer(pIn)).FaddrInTop) + + } + Xsqlite3VdbeJumpHere(tls, v, ((*InLoop)(unsafe.Pointer(pIn)).FaddrInTop - 1)) + + } + goto __2 + __2: + j-- + pIn -= 20 + goto __1 + goto __3 + __3: + } + Xsqlite3VdbeResolveLabel(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBrk) + if (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip != 0 { + Xsqlite3VdbeGoto(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip) + + Xsqlite3VdbeJumpHere(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip) + Xsqlite3VdbeJumpHere(tls, v, ((*WhereLevel)(unsafe.Pointer(pLevel)).FaddrSkip - 2)) + } + if (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin != 0 { + var ws int32 = int32((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags) + addr = Xsqlite3VdbeAddOp1(tls, v, OP_IfPos, (*WhereLevel)(unsafe.Pointer(pLevel)).FiLeftJoin) + + if (ws & WHERE_IDX_ONLY) == 0 { + + Xsqlite3VdbeAddOp1(tls, v, OP_NullRow, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur) + } + if ((ws & WHERE_INDEXED) != 0) || + (((ws & WHERE_MULTI_OR) != 0) && (*(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */)) != 0)) { + Xsqlite3VdbeAddOp1(tls, v, OP_NullRow, (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur) + } + if int32((*WhereLevel)(unsafe.Pointer(pLevel)).Fop) == OP_Return { + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, (*WhereLevel)(unsafe.Pointer(pLevel)).Fp1, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrFirst) + } else { + Xsqlite3VdbeGoto(tls, v, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrFirst) + } + Xsqlite3VdbeJumpHere(tls, v, addr) + } + + } + + // The "break" point is here, just past the end of the outer loop. + // Set it. + Xsqlite3VdbeResolveLabel(tls, v, (*WhereInfo)(unsafe.Pointer(pWInfo)).FiBreak) + + i = 0 + pLevel = pWInfo + 856 /* &.a */ +__4: + if !(i < int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel)) { + goto __6 + } + { + var k int32 + var last int32 + var pOp uintptr + var pLastOp uintptr + var pIdx uintptr = uintptr(0) + var pTabItem uintptr = ((pTabList + 8 /* &.a */) + uintptr((*WhereLevel)(unsafe.Pointer(pLevel)).FiFrom)*112) + var pTab uintptr = (*SrcItem)(unsafe.Pointer(pTabItem)).FpTab + + pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop + + // For a co-routine, change all OP_Column references to the table of + // the co-routine into OP_Copy of result contained in a register. + // OP_Rowid becomes OP_Null. + if (uint32(int32(*(*uint16)(unsafe.Pointer(pTabItem + 60 /* &.fg */ + 4 /* &.viaCoroutine */)) & 0x10 >> 4))) != 0 { + + translateColumnToCopy(tls, pParse, (*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBody, (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur, + (*SrcItem)(unsafe.Pointer(pTabItem)).FregResult, 0) + goto __5 + } + + // If this scan uses an index, make VDBE code substitutions to read data + // from the index instead of from the table where possible. In some cases + // this optimization prevents the table from ever being read, which can + // yield a significant performance boost. + // + // Calls to the code generator in between sqlite3WhereBegin and + // sqlite3WhereEnd will have created code that references the table + // directly. This loop scans all that code looking for opcodes + // that reference the table and converts them into opcodes that + // reference the index. + if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_INDEXED | WHERE_IDX_ONLY))) != 0 { + pIdx = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) + } else if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_MULTI_OR)) != 0 { + pIdx = *(*uintptr)(unsafe.Pointer(pLevel + 56 /* &.u */)) + } + if (pIdx != 0) && + !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { + if (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FeOnePass) == ONEPASS_OFF) || !(((*Table)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FpTable))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + last = iEnd + } else { + last = (*WhereInfo)(unsafe.Pointer(pWInfo)).FiEndWhere + } + k = ((*WhereLevel)(unsafe.Pointer(pLevel)).FaddrBody + 1) + pOp = Xsqlite3VdbeGetOp(tls, v, k) + pLastOp = (pOp + uintptr((last-k))*24) + + for ok := true; ok; ok = ((libc.PreIncUintptr(&pOp, 24)) < pLastOp) { + if (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 != (*WhereLevel)(unsafe.Pointer(pLevel)).FiTabCur { + // no-op + } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Column) || + (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Offset) { + var x int32 = (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 + + if !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) { + var pPk uintptr = Xsqlite3PrimaryKeyIndex(tls, pTab) + x = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pPk)).FaiColumn + uintptr(x)*2))) + + } else { + + x = int32(Xsqlite3StorageColumnToTable(tls, pTab, int16(x))) + } + x = int32(Xsqlite3TableColumnToIndex(tls, pIdx, int16(x))) + if x >= 0 { + (*VdbeOp)(unsafe.Pointer(pOp)).Fp2 = x + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + + } + + } else if int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Rowid { + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + (*VdbeOp)(unsafe.Pointer(pOp)).Fopcode = U8(OP_IdxRowid) + + } else if int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_IfNullRow { + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = (*WhereLevel)(unsafe.Pointer(pLevel)).FiIdxCur + + } + } + } + + } + goto __5 +__5: + i++ + pLevel += 88 + goto __4 + goto __6 +__6: + ; + + // Final cleanup + if (*WhereInfo)(unsafe.Pointer(pWInfo)).FpExprMods != 0 { + whereUndoExprMods(tls, pWInfo) + } + (*Parse)(unsafe.Pointer(pParse)).FnQueryLoop = U32((*WhereInfo)(unsafe.Pointer(pWInfo)).FsavedNQueryLoop) + whereInfoFree(tls, db, pWInfo) + return +} + +//************* End of where.c ********************************************** +//************* Begin file window.c ***************************************** +// 2018 May 08 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// #include "sqliteInt.h" + +// SELECT REWRITING +// +// Any SELECT statement that contains one or more window functions in +// either the select list or ORDER BY clause (the only two places window +// functions may be used) is transformed by function sqlite3WindowRewrite() +// in order to support window function processing. For example, with the +// schema: +// +// CREATE TABLE t1(a, b, c, d, e, f, g); +// +// the statement: +// +// SELECT a+1, max(b) OVER (PARTITION BY c ORDER BY d) FROM t1 ORDER BY e; +// +// is transformed to: +// +// SELECT a+1, max(b) OVER (PARTITION BY c ORDER BY d) FROM ( +// SELECT a, e, c, d, b FROM t1 ORDER BY c, d +// ) ORDER BY e; +// +// The flattening optimization is disabled when processing this transformed +// SELECT statement. This allows the implementation of the window function +// (in this case max()) to process rows sorted in order of (c, d), which +// makes things easier for obvious reasons. More generally: +// +// * FROM, WHERE, GROUP BY and HAVING clauses are all moved to +// the sub-query. +// +// * ORDER BY, LIMIT and OFFSET remain part of the parent query. +// +// * Terminals from each of the expression trees that make up the +// select-list and ORDER BY expressions in the parent query are +// selected by the sub-query. For the purposes of the transformation, +// terminals are column references and aggregate functions. +// +// If there is more than one window function in the SELECT that uses +// the same window declaration (the OVER bit), then a single scan may +// be used to process more than one window function. For example: +// +// SELECT max(b) OVER (PARTITION BY c ORDER BY d), +// min(e) OVER (PARTITION BY c ORDER BY d) +// FROM t1; +// +// is transformed in the same way as the example above. However: +// +// SELECT max(b) OVER (PARTITION BY c ORDER BY d), +// min(e) OVER (PARTITION BY a ORDER BY b) +// FROM t1; +// +// Must be transformed to: +// +// SELECT max(b) OVER (PARTITION BY c ORDER BY d) FROM ( +// SELECT e, min(e) OVER (PARTITION BY a ORDER BY b), c, d, b FROM +// SELECT a, e, c, d, b FROM t1 ORDER BY a, b +// ) ORDER BY c, d +// ) ORDER BY e; +// +// so that both min() and max() may process rows in the order defined by +// their respective window declarations. +// +// INTERFACE WITH SELECT.C +// +// When processing the rewritten SELECT statement, code in select.c calls +// sqlite3WhereBegin() to begin iterating through the results of the +// sub-query, which is always implemented as a co-routine. It then calls +// sqlite3WindowCodeStep() to process rows and finish the scan by calling +// sqlite3WhereEnd(). +// +// sqlite3WindowCodeStep() generates VM code so that, for each row returned +// by the sub-query a sub-routine (OP_Gosub) coded by select.c is invoked. +// When the sub-routine is invoked: +// +// * The results of all window-functions for the row are stored +// in the associated Window.regResult registers. +// +// * The required terminal values are stored in the current row of +// temp table Window.iEphCsr. +// +// In some cases, depending on the window frame and the specific window +// functions invoked, sqlite3WindowCodeStep() caches each entire partition +// in a temp table before returning any rows. In other cases it does not. +// This detail is encapsulated within this file, the code generated by +// select.c is the same in either case. +// +// BUILT-IN WINDOW FUNCTIONS +// +// This implementation features the following built-in window functions: +// +// row_number() +// rank() +// dense_rank() +// percent_rank() +// cume_dist() +// ntile(N) +// lead(expr [, offset [, default]]) +// lag(expr [, offset [, default]]) +// first_value(expr) +// last_value(expr) +// nth_value(expr, N) +// +// These are the same built-in window functions supported by Postgres. +// Although the behaviour of aggregate window functions (functions that +// can be used as either aggregates or window funtions) allows them to +// be implemented using an API, built-in window functions are much more +// esoteric. Additionally, some window functions (e.g. nth_value()) +// may only be implemented by caching the entire partition in memory. +// As such, some built-in window functions use the same API as aggregate +// window functions and some are implemented directly using VDBE +// instructions. Additionally, for those functions that use the API, the +// window frame is sometimes modified before the SELECT statement is +// rewritten. For example, regardless of the specified window frame, the +// row_number() function always uses: +// +// ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +// +// See sqlite3WindowUpdate() for details. +// +// As well as some of the built-in window functions, aggregate window +// functions min() and max() are implemented using VDBE instructions if +// the start of the window frame is declared as anything other than +// UNBOUNDED PRECEDING. + +// Implementation of built-in window function row_number(). Assumes that the +// window frame has been coerced to: +// +// ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +func row_numberStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155058:13: */ + var p uintptr = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(I64(0)))) + if p != 0 { + (*(*I64)(unsafe.Pointer(p)))++ + } + _ = nArg + _ = apArg +} + +func row_numberValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155068:13: */ + var p uintptr = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(I64(0)))) + Xsqlite3_result_int64(tls, pCtx, func() int64 { + if p != 0 { + return *(*I64)(unsafe.Pointer(p)) + } + return int64(0) + }()) +} + +// Context object type used by rank(), dense_rank(), percent_rank() and +// cume_dist(). +type CallCount = struct { + FnValue I64 + FnStep I64 + FnTotal I64 +} /* sqlite3.c:155077:1 */ + +// Implementation of built-in window function dense_rank(). Assumes that +// the window frame has been set to: +// +// RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +func dense_rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155089:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + (*CallCount)(unsafe.Pointer(p)).FnStep = int64(1) + } + _ = nArg + _ = apArg +} + +func dense_rankValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155100:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + if (*CallCount)(unsafe.Pointer(p)).FnStep != 0 { + (*CallCount)(unsafe.Pointer(p)).FnValue++ + (*CallCount)(unsafe.Pointer(p)).FnStep = int64(0) + } + Xsqlite3_result_int64(tls, pCtx, (*CallCount)(unsafe.Pointer(p)).FnValue) + } +} + +// Implementation of built-in window function nth_value(). This +// implementation is used in "slow mode" only - when the EXCLUDE clause +// is not set to the default value "NO OTHERS". +type NthValueCtx = struct { + FnStep I64 + FpValue uintptr +} /* sqlite3.c:155117:1 */ + +func nth_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155121:13: */ + var p uintptr + var fVal float64 + var iVal I64 + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(NthValueCtx{}))) + if !(p != 0) { + goto __1 + } + switch Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) { + case SQLITE_INTEGER: + goto __3 + case SQLITE_FLOAT: + goto __4 + default: + goto __5 + } + goto __2 +__3: + iVal = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + goto __2 +__4: + fVal = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + if !((float64(I64(fVal))) != fVal) { + goto __6 + } + goto error_out +__6: + ; + iVal = I64(fVal) + goto __2 + +__5: + goto error_out +__2: + ; + if !(iVal <= int64(0)) { + goto __7 + } + goto error_out +__7: + ; + + (*NthValueCtx)(unsafe.Pointer(p)).FnStep++ + if !(iVal == (*NthValueCtx)(unsafe.Pointer(p)).FnStep) { + goto __8 + } + (*NthValueCtx)(unsafe.Pointer(p)).FpValue = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if !(!(int32((*NthValueCtx)(unsafe.Pointer(p)).FpValue) != 0)) { + goto __9 + } + Xsqlite3_result_error_nomem(tls, pCtx) +__9: + ; +__8: + ; +__1: + ; + _ = nArg + _ = apArg + return + +error_out: + Xsqlite3_result_error(tls, + pCtx, ts+20375 /* "second argument ..." */, -1) +} + +func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, 0) + if (p != 0) && ((*NthValueCtx)(unsafe.Pointer(p)).FpValue != 0) { + Xsqlite3_result_value(tls, pCtx, (*NthValueCtx)(unsafe.Pointer(p)).FpValue) + Xsqlite3_value_free(tls, (*NthValueCtx)(unsafe.Pointer(p)).FpValue) + (*NthValueCtx)(unsafe.Pointer(p)).FpValue = uintptr(0) + } +} + +func first_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155174:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(NthValueCtx{}))) + if (p != 0) && ((*NthValueCtx)(unsafe.Pointer(p)).FpValue == uintptr(0)) { + (*NthValueCtx)(unsafe.Pointer(p)).FpValue = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if !(int32((*NthValueCtx)(unsafe.Pointer(p)).FpValue) != 0) { + Xsqlite3_result_error_nomem(tls, pCtx) + } + } + _ = nArg + _ = apArg +} + +func first_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155190:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(NthValueCtx{}))) + if (p != 0) && ((*NthValueCtx)(unsafe.Pointer(p)).FpValue != 0) { + Xsqlite3_result_value(tls, pCtx, (*NthValueCtx)(unsafe.Pointer(p)).FpValue) + Xsqlite3_value_free(tls, (*NthValueCtx)(unsafe.Pointer(p)).FpValue) + (*NthValueCtx)(unsafe.Pointer(p)).FpValue = uintptr(0) + } +} + +// Implementation of built-in window function rank(). Assumes that +// the window frame has been set to: +// +// RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW +func rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155208:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + (*CallCount)(unsafe.Pointer(p)).FnStep++ + if (*CallCount)(unsafe.Pointer(p)).FnValue == int64(0) { + (*CallCount)(unsafe.Pointer(p)).FnValue = (*CallCount)(unsafe.Pointer(p)).FnStep + } + } + _ = nArg + _ = apArg +} + +func rankValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155224:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + Xsqlite3_result_int64(tls, pCtx, (*CallCount)(unsafe.Pointer(p)).FnValue) + (*CallCount)(unsafe.Pointer(p)).FnValue = int64(0) + } +} + +// Implementation of built-in window function percent_rank(). Assumes that +// the window frame has been set to: +// +// GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING +func percent_rankStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155239:13: */ + var p uintptr + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + (*CallCount)(unsafe.Pointer(p)).FnTotal++ + } +} + +func percent_rankInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155252:13: */ + var p uintptr + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + (*CallCount)(unsafe.Pointer(p)).FnStep++ +} + +func percent_rankValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155263:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + (*CallCount)(unsafe.Pointer(p)).FnValue = (*CallCount)(unsafe.Pointer(p)).FnStep + if (*CallCount)(unsafe.Pointer(p)).FnTotal > int64(1) { + var r float64 = (float64((*CallCount)(unsafe.Pointer(p)).FnValue) / (float64((*CallCount)(unsafe.Pointer(p)).FnTotal - int64(1)))) + Xsqlite3_result_double(tls, pCtx, r) + } else { + Xsqlite3_result_double(tls, pCtx, 0.0) + } + } +} + +// Implementation of built-in window function cume_dist(). Assumes that +// the window frame has been set to: +// +// GROUPS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING +func cume_distStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155284:13: */ + var p uintptr + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + if p != 0 { + (*CallCount)(unsafe.Pointer(p)).FnTotal++ + } +} + +func cume_distInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155297:13: */ + var p uintptr + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(CallCount{}))) + (*CallCount)(unsafe.Pointer(p)).FnStep++ +} + +func cume_distValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155308:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, 0) + if p != 0 { + var r float64 = ((float64((*CallCount)(unsafe.Pointer(p)).FnStep)) / (float64((*CallCount)(unsafe.Pointer(p)).FnTotal))) + Xsqlite3_result_double(tls, pCtx, r) + } +} + +// Context object for ntile() window function. +type NtileCtx = struct { + FnTotal I64 + FnParam I64 + FiRow I64 +} /* sqlite3.c:155321:1 */ + +// Implementation of ntile(). This assumes that the window frame has +// been coerced to: +// +// ROWS CURRENT ROW AND UNBOUNDED FOLLOWING +func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155333:13: */ + var p uintptr + _ = nArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(NtileCtx{}))) + if p != 0 { + if (*NtileCtx)(unsafe.Pointer(p)).FnTotal == int64(0) { + (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { + Xsqlite3_result_error(tls, + pCtx, ts+20431 /* "argument of ntil..." */, -1) + } + } + (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ + } +} + +func ntileInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155353:13: */ + var p uintptr + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(NtileCtx{}))) + (*NtileCtx)(unsafe.Pointer(p)).FiRow++ +} + +func ntileValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155364:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(NtileCtx{}))) + if (p != 0) && ((*NtileCtx)(unsafe.Pointer(p)).FnParam > int64(0)) { + var nSize int32 = (int32((*NtileCtx)(unsafe.Pointer(p)).FnTotal / (*NtileCtx)(unsafe.Pointer(p)).FnParam)) + if nSize == 0 { + Xsqlite3_result_int64(tls, pCtx, ((*NtileCtx)(unsafe.Pointer(p)).FiRow + int64(1))) + } else { + var nLarge I64 = ((*NtileCtx)(unsafe.Pointer(p)).FnTotal - ((*NtileCtx)(unsafe.Pointer(p)).FnParam * I64(nSize))) + var iSmall I64 = (nLarge * (I64(nSize + 1))) + var iRow I64 = (*NtileCtx)(unsafe.Pointer(p)).FiRow + + if iRow < iSmall { + Xsqlite3_result_int64(tls, pCtx, (int64(1) + (iRow / (I64(nSize + 1))))) + } else { + Xsqlite3_result_int64(tls, pCtx, ((int64(1) + nLarge) + ((iRow - iSmall) / I64(nSize)))) + } + } + } +} + +// Context object for last_value() window function. +type LastValueCtx = struct { + FpVal uintptr + FnVal int32 + _ [4]byte +} /* sqlite3.c:155391:1 */ + +// Implementation of last_value(). +func last_valueStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155399:13: */ + var p uintptr + _ = nArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(LastValueCtx{}))) + if p != 0 { + Xsqlite3_value_free(tls, (*LastValueCtx)(unsafe.Pointer(p)).FpVal) + (*LastValueCtx)(unsafe.Pointer(p)).FpVal = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if (*LastValueCtx)(unsafe.Pointer(p)).FpVal == uintptr(0) { + Xsqlite3_result_error_nomem(tls, pCtx) + } else { + (*LastValueCtx)(unsafe.Pointer(p)).FnVal++ + } + } +} + +func last_valueInvFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:155417:13: */ + var p uintptr + _ = nArg + _ = apArg + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(LastValueCtx{}))) + if p != 0 { + (*LastValueCtx)(unsafe.Pointer(p)).FnVal-- + if (*LastValueCtx)(unsafe.Pointer(p)).FnVal == 0 { + Xsqlite3_value_free(tls, (*LastValueCtx)(unsafe.Pointer(p)).FpVal) + (*LastValueCtx)(unsafe.Pointer(p)).FpVal = uintptr(0) + } + } +} + +func last_valueValueFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155434:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, 0) + if (p != 0) && ((*LastValueCtx)(unsafe.Pointer(p)).FpVal != 0) { + Xsqlite3_result_value(tls, pCtx, (*LastValueCtx)(unsafe.Pointer(p)).FpVal) + } +} + +func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:13: */ + var p uintptr + p = Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(LastValueCtx{}))) + if (p != 0) && ((*LastValueCtx)(unsafe.Pointer(p)).FpVal != 0) { + Xsqlite3_result_value(tls, pCtx, (*LastValueCtx)(unsafe.Pointer(p)).FpVal) + Xsqlite3_value_free(tls, (*LastValueCtx)(unsafe.Pointer(p)).FpVal) + (*LastValueCtx)(unsafe.Pointer(p)).FpVal = uintptr(0) + } +} + +// Static names for the built-in window function names. These static +// names are used, rather than string literals, so that FuncDef objects +// can be associated with a particular window function by direct +// comparison of the zName pointer. Example: +// +// if( pFuncDef->zName==row_valueName ){ ... } +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20476 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20487 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20498 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20503 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20516 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20526 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20532 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20543 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20553 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20565 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20570 /* "lag" */)) /* sqlite3.c:155469:19 */ + +// No-op implementations of xStep() and xFinalize(). Used as place-holders +// for built-in window functions that never call those interfaces. +// +// The noopValueFunc() is called but is expected to do nothing. The +// noopStepFunc() is never called, and so it is marked with NO_TEST to +// let the test coverage routine know not to expect this function to be +// invoked. +func noopStepFunc(tls *libc.TLS, p uintptr, n int32, a uintptr) { /* sqlite3.c:155480:13: */ //NO_TEST + _ = p //NO_TEST + _ = n //NO_TEST + _ = a //NO_TEST + //NO_TEST +} + +//NO_TEST +func noopValueFunc(tls *libc.TLS, p uintptr) { /* sqlite3.c:155490:13: */ + _ = p /*no-op*/ +} + +// Window functions that use all window interfaces: xStep, xFinal, +// xValue, and xInverse + +// Window functions that are implemented using bytecode and thus have +// no-op routines for their methods + +// Window functions that use all window interfaces: xStep, the +// same routine for xFinalize and xValue and which never call +// xInverse. + +// Register those built-in window functions that are not also aggregates. +func Xsqlite3WindowFunctions(tls *libc.TLS) { /* sqlite3.c:155521:21: */ + Xsqlite3InsertBuiltinFuncs(tls, uintptr(unsafe.Pointer(&aWindowFuncs)), (int32(uint64(unsafe.Sizeof(aWindowFuncs)) / uint64(unsafe.Sizeof(FuncDef{}))))) +} + +var aWindowFuncs = [15]FuncDef{ + {FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}} /* sqlite3.c:155522:18 */ + +func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uintptr { /* sqlite3.c:155542:15: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr + for p = pList; p != 0; p = (*Window)(unsafe.Pointer(p)).FpNextWin { + if Xsqlite3StrICmp(tls, (*Window)(unsafe.Pointer(p)).FzName, zName) == 0 { + break + } + } + if p == uintptr(0) { + Xsqlite3ErrorMsg(tls, pParse, ts+20574 /* "no such window: ..." */, libc.VaList(bp, zName)) + } + return p +} + +// This function is called immediately after resolving the function name +// for a window function within a SELECT statement. Argument pList is a +// linked list of WINDOW definitions for the current SELECT statement. +// Argument pFunc is the function definition just resolved and pWin +// is the Window object representing the associated OVER clause. This +// function updates the contents of pWin as follows: +// +// * If the OVER clause refered to a named window (as in "max(x) OVER win"), +// search list pList for a matching WINDOW definition, and update pWin +// accordingly. If no such WINDOW clause can be found, leave an error +// in pParse. +// +// * If the function is a built-in window function that requires the +// window to be coerced (see "BUILT-IN WINDOW FUNCTIONS" at the top +// of this file), pWin is updated here. +func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uintptr, pFunc uintptr) { /* sqlite3.c:155570:21: */ + bp := tls.Alloc(192) + defer tls.Free(192) + + if ((*Window)(unsafe.Pointer(pWin)).FzName != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) == 0) { + var p uintptr = windowFind(tls, pParse, pList, (*Window)(unsafe.Pointer(pWin)).FzName) + if p == uintptr(0) { + return + } + (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Window)(unsafe.Pointer(p)).FpPartition, 0) + (*Window)(unsafe.Pointer(pWin)).FpOrderBy = Xsqlite3ExprListDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Window)(unsafe.Pointer(p)).FpOrderBy, 0) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Window)(unsafe.Pointer(p)).FpStart, 0) + (*Window)(unsafe.Pointer(pWin)).FpEnd = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Window)(unsafe.Pointer(p)).FpEnd, 0) + (*Window)(unsafe.Pointer(pWin)).FeStart = (*Window)(unsafe.Pointer(p)).FeStart + (*Window)(unsafe.Pointer(pWin)).FeEnd = (*Window)(unsafe.Pointer(p)).FeEnd + (*Window)(unsafe.Pointer(pWin)).FeFrmType = (*Window)(unsafe.Pointer(p)).FeFrmType + (*Window)(unsafe.Pointer(pWin)).FeExclude = (*Window)(unsafe.Pointer(p)).FeExclude + } else { + Xsqlite3WindowChain(tls, pParse, pWin, pList) + } + if ((int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) == TK_RANGE) && + (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && + (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { + Xsqlite3ErrorMsg(tls, pParse, + ts+20593 /* "RANGE with offse..." */, 0) + } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { + Xsqlite3ErrorMsg(tls, pParse, + ts+20664 /* "FILTER clause ma..." */, 0) + } else { + *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ + {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, + {FzFunc: uintptr(unsafe.Pointer(&dense_rankName)), FeFrmType: TK_RANGE, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, + {FzFunc: uintptr(unsafe.Pointer(&rankName)), FeFrmType: TK_RANGE, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, + {FzFunc: uintptr(unsafe.Pointer(&percent_rankName)), FeFrmType: TK_GROUPS, FeStart: TK_CURRENT, FeEnd: TK_UNBOUNDED}, + {FzFunc: uintptr(unsafe.Pointer(&cume_distName)), FeFrmType: TK_GROUPS, FeStart: TK_FOLLOWING, FeEnd: TK_UNBOUNDED}, + {FzFunc: uintptr(unsafe.Pointer(&ntileName)), FeFrmType: TK_ROWS, FeStart: TK_CURRENT, FeEnd: TK_UNBOUNDED}, + {FzFunc: uintptr(unsafe.Pointer(&leadName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_UNBOUNDED}, + {FzFunc: uintptr(unsafe.Pointer(&lagName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, + } + var i int32 + for i = 0; i < (int32(uint64(unsafe.Sizeof([8]WindowUpdate{})) / uint64(unsafe.Sizeof(WindowUpdate{})))); i++ { + if (*FuncDef)(unsafe.Pointer(pFunc)).FzName == (*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ +uintptr(i)*24)).FzFunc { + Xsqlite3ExprDelete(tls, db, (*Window)(unsafe.Pointer(pWin)).FpStart) + Xsqlite3ExprDelete(tls, db, (*Window)(unsafe.Pointer(pWin)).FpEnd) + (*Window)(unsafe.Pointer(pWin)).FpEnd = libc.AssignPtrUintptr(pWin+40 /* &.pStart */, uintptr(0)) + (*Window)(unsafe.Pointer(pWin)).FeFrmType = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeFrmType) + (*Window)(unsafe.Pointer(pWin)).FeStart = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeStart) + (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeEnd) + (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) + if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6914 /* "1" */) + } + break + } + } + } + } + (*Window)(unsafe.Pointer(pWin)).FpFunc = pFunc +} + +type WindowUpdate = struct { + FzFunc uintptr + FeFrmType int32 + FeStart int32 + FeEnd int32 + _ [4]byte +} /* sqlite3.c:155605:7 */ + +// Context object passed through sqlite3WalkExprList() to +// selectWindowRewriteExprCb() by selectWindowRewriteEList(). +type WindowRewrite = WindowRewrite1 /* sqlite3.c:155645:30 */ + +// Callback function used by selectWindowRewriteEList(). If necessary, +// this function appends to the output expression-list and updates +// expression (*ppExpr) in place. +func selectWindowRewriteExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:155659:12: */ + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse + + // If this function is being called from within a scalar sub-select + // that used by the SELECT statement being processed, only process + // TK_COLUMN expressions that refer to it (the outer SELECT). Do + // not process aggregates or window functions at all, as they belong + // to the scalar sub-select. + if (*WindowRewrite1)(unsafe.Pointer(p)).FpSubSelect != 0 { + if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLUMN { + return WRC_Continue + } else { + var nSrc int32 = (*SrcList)(unsafe.Pointer((*WindowRewrite1)(unsafe.Pointer(p)).FpSrc)).FnSrc + var i int32 + for i = 0; i < nSrc; i++ { + if (*Expr)(unsafe.Pointer(pExpr)).FiTable == (*SrcItem)(unsafe.Pointer(((*WindowRewrite1)(unsafe.Pointer(p)).FpSrc+8 /* &.a */)+uintptr(i)*112)).FiCursor { + break + } + } + if i == nSrc { + return WRC_Continue + } + } + } + + switch int32((*Expr)(unsafe.Pointer(pExpr)).Fop) { + + case TK_FUNCTION: + if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { + break + } else { + var pWin uintptr + for pWin = (*WindowRewrite1)(unsafe.Pointer(p)).FpWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + if *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) == pWin { + + return WRC_Prune + } + } + } + fallthrough + + case TK_AGG_FUNCTION: + fallthrough + case TK_COLUMN: + { + var iCol int32 = -1 + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return WRC_Abort + } + if (*WindowRewrite1)(unsafe.Pointer(p)).FpSub != 0 { + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer((*WindowRewrite1)(unsafe.Pointer(p)).FpSub)).FnExpr; i++ { + if 0 == Xsqlite3ExprCompare(tls, uintptr(0), (*ExprList_item)(unsafe.Pointer(((*WindowRewrite1)(unsafe.Pointer(p)).FpSub+8 /* &.a */)+uintptr(i)*32)).FpExpr, pExpr, -1) { + iCol = i + break + } + } + } + if iCol < 0 { + var pDup uintptr = Xsqlite3ExprDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr, 0) + if (pDup != 0) && (int32((*Expr)(unsafe.Pointer(pDup)).Fop) == TK_AGG_FUNCTION) { + (*Expr)(unsafe.Pointer(pDup)).Fop = U8(TK_FUNCTION) + } + (*WindowRewrite1)(unsafe.Pointer(p)).FpSub = Xsqlite3ExprListAppend(tls, pParse, (*WindowRewrite1)(unsafe.Pointer(p)).FpSub, pDup) + } + if (*WindowRewrite1)(unsafe.Pointer(p)).FpSub != 0 { + var f int32 = (int32((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_Collate))) + + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_Static)) + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) + *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Static))) + libc.Xmemset(tls, pExpr, 0, uint64(unsafe.Sizeof(Expr{}))) + + (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_COLUMN) + (*Expr)(unsafe.Pointer(pExpr)).FiColumn = func() int16 { + if iCol < 0 { + return (int16((*ExprList)(unsafe.Pointer((*WindowRewrite1)(unsafe.Pointer(p)).FpSub)).FnExpr - 1)) + } + return int16(iCol) + }() + (*Expr)(unsafe.Pointer(pExpr)).FiTable = (*Window)(unsafe.Pointer((*WindowRewrite1)(unsafe.Pointer(p)).FpWin)).FiEphCsr + *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = (*WindowRewrite1)(unsafe.Pointer(p)).FpTab + (*Expr)(unsafe.Pointer(pExpr)).Fflags = U32(f) + } + if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { + return WRC_Abort + } + break + + } + + default: // no-op + break + } + + return WRC_Continue +} + +func selectWindowRewriteSelectCb(tls *libc.TLS, pWalker uintptr, pSelect uintptr) int32 { /* sqlite3.c:155741:12: */ + var p uintptr = *(*uintptr)(unsafe.Pointer(pWalker + 40 /* &.u */)) + var pSave uintptr = (*WindowRewrite1)(unsafe.Pointer(p)).FpSubSelect + if pSave == pSelect { + return WRC_Continue + } else { + (*WindowRewrite1)(unsafe.Pointer(p)).FpSubSelect = pSelect + Xsqlite3WalkSelect(tls, pWalker, pSelect) + (*WindowRewrite1)(unsafe.Pointer(p)).FpSubSelect = pSave + } + return WRC_Prune +} + +// Iterate through each expression in expression-list pEList. For each: +// +// * TK_COLUMN, +// * aggregate function, or +// * window function with a Window object that is not a member of the +// Window list passed as the second argument (pWin). +// +// Append the node to output expression-list (*ppSub). And replace it +// with a TK_COLUMN that reads the (N-1)th element of table +// pWin->iEphCsr, where N is the number of elements in (*ppSub) after +// appending the new one. +func selectWindowRewriteEList(tls *libc.TLS, pParse uintptr, pWin uintptr, pSrc uintptr, pEList uintptr, pTab uintptr, ppSub uintptr) { /* sqlite3.c:155768:13: */ + bp := tls.Alloc(88) + defer tls.Free(88) + + // var sWalker Walker at bp, 48 + + // var sRewrite WindowRewrite at bp+48, 40 + + libc.Xmemset(tls, bp /* &sWalker */, 0, uint64(unsafe.Sizeof(Walker{}))) + libc.Xmemset(tls, bp+48 /* &sRewrite */, 0, uint64(unsafe.Sizeof(WindowRewrite{}))) + + (*WindowRewrite)(unsafe.Pointer(bp + 48 /* &sRewrite */)).FpSub = *(*uintptr)(unsafe.Pointer(ppSub)) + (*WindowRewrite)(unsafe.Pointer(bp + 48 /* &sRewrite */)).FpWin = pWin + (*WindowRewrite)(unsafe.Pointer(bp + 48 /* &sRewrite */)).FpSrc = pSrc + (*WindowRewrite)(unsafe.Pointer(bp + 48 /* &sRewrite */)).FpTab = pTab + + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FpParse = pParse + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{selectWindowRewriteExprCb})) + (*Walker)(unsafe.Pointer(bp /* &sWalker */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{selectWindowRewriteSelectCb})) + *(*uintptr)(unsafe.Pointer(bp /* &sWalker */ + 40 /* &.u */)) = bp + 48 /* &sRewrite */ + + Xsqlite3WalkExprList(tls, bp /* &sWalker */, pEList) + + *(*uintptr)(unsafe.Pointer(ppSub)) = (*WindowRewrite)(unsafe.Pointer(bp + 48 /* &sRewrite */)).FpSub +} + +// Append a copy of each expression in expression-list pAppend to +// expression list pList. Return a pointer to the result list. +func exprListAppendList(tls *libc.TLS, pParse uintptr, pList uintptr, pAppend uintptr, bIntToNull int32) uintptr { /* sqlite3.c:155802:17: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + if pAppend != 0 { + var i int32 + var nInit int32 + if pList != 0 { + nInit = (*ExprList)(unsafe.Pointer(pList)).FnExpr + } else { + nInit = 0 + } + for i = 0; i < (*ExprList)(unsafe.Pointer(pAppend)).FnExpr; i++ { + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pDup uintptr = Xsqlite3ExprDup(tls, db, (*ExprList_item)(unsafe.Pointer((pAppend+8 /* &.a */)+uintptr(i)*32)).FpExpr, 0) + + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + Xsqlite3ExprDelete(tls, db, pDup) + break + } + if bIntToNull != 0 { + // var iDummy int32 at bp, 4 + + var pSub uintptr + for pSub = pDup; ((*Expr)(unsafe.Pointer((pSub))).Fflags & (U32(EP_Skip))) != U32(0); pSub = (*Expr)(unsafe.Pointer(pSub)).FpLeft { + + } + if Xsqlite3ExprIsInteger(tls, pSub, bp /* &iDummy */) != 0 { + (*Expr)(unsafe.Pointer(pSub)).Fop = U8(TK_NULL) + *(*U32)(unsafe.Pointer(pSub + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(((EP_IntValue | EP_IsTrue) | EP_IsFalse)))) + *(*uintptr)(unsafe.Pointer(pSub + 8 /* &.u */)) = uintptr(0) + } + } + pList = Xsqlite3ExprListAppend(tls, pParse, pList, pDup) + if pList != 0 { + (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr((nInit+i))*32)).FsortFlags = (*ExprList_item)(unsafe.Pointer((pAppend + 8 /* &.a */) + uintptr(i)*32)).FsortFlags + } + } + } + return pList +} + +// When rewriting a query, if the new subquery in the FROM clause +// contains TK_AGG_FUNCTION nodes that refer to an outer query, +// then we have to increase the Expr->op2 values of those nodes +// due to the extra subquery layer that was added. +// +// See also the incrAggDepth() routine in resolve.c +func sqlite3WindowExtraAggFuncDepth(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:155846:12: */ + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && + (int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) >= (*Walker)(unsafe.Pointer(pWalker)).FwalkerDepth) { + (*Expr)(unsafe.Pointer(pExpr)).Fop2++ + } + return WRC_Continue +} + +func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:155855:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { + Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, + ts+6975 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + } + return WRC_Continue +} + +// If the SELECT statement passed as the second argument does not invoke +// any SQL window functions, this function is a no-op. Otherwise, it +// rewrites the SELECT statement so that window function xStep functions +// are invoked in the correct order as described under "SELECT REWRITING" +// at the top of this file. +func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* sqlite3.c:155870:20: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + if (((*Select)(unsafe.Pointer(p)).FpWin != 0) && ((*Select)(unsafe.Pointer(p)).FpPrior == uintptr(0))) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_WinRewrite)) == U32(0)) { + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pSub uintptr = uintptr(0) // The subquery + var pSrc uintptr = (*Select)(unsafe.Pointer(p)).FpSrc + var pWhere uintptr = (*Select)(unsafe.Pointer(p)).FpWhere + var pGroupBy uintptr = (*Select)(unsafe.Pointer(p)).FpGroupBy + var pHaving uintptr = (*Select)(unsafe.Pointer(p)).FpHaving + var pSort uintptr = uintptr(0) + + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = uintptr(0) // Expression list for sub-query + var pMWin uintptr = (*Select)(unsafe.Pointer(p)).FpWin // Main window object + var pWin uintptr // Window object iterator + var pTab uintptr + // var w Walker at bp, 48 + + var selFlags U32 = (*Select)(unsafe.Pointer(p)).FselFlags + + pTab = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Table{}))) + if pTab == uintptr(0) { + return Xsqlite3ErrorToParser(tls, db, SQLITE_NOMEM) + } + Xsqlite3AggInfoPersistWalkerInit(tls, bp /* &w */, pParse) + Xsqlite3WalkSelect(tls, bp /* &w */, p) + if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Aggregate)) == U32(0) { + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{disallowAggregatesInOrderByCb})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = uintptr(0) + Xsqlite3WalkExprList(tls, bp /* &w */, (*Select)(unsafe.Pointer(p)).FpOrderBy) + } + + (*Select)(unsafe.Pointer(p)).FpSrc = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpWhere = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpGroupBy = uintptr(0) + (*Select)(unsafe.Pointer(p)).FpHaving = uintptr(0) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_Aggregate))) + *(*U32)(unsafe.Pointer(p + 4 /* &.selFlags */)) |= (U32(SF_WinRewrite)) + + // Create the ORDER BY clause for the sub-select. This is the concatenation + // of the window PARTITION and ORDER BY clauses. Then, if this makes it + // redundant, remove the ORDER BY from the parent SELECT. + pSort = exprListAppendList(tls, pParse, uintptr(0), (*Window)(unsafe.Pointer(pMWin)).FpPartition, 1) + pSort = exprListAppendList(tls, pParse, pSort, (*Window)(unsafe.Pointer(pMWin)).FpOrderBy, 1) + if ((pSort != 0) && ((*Select)(unsafe.Pointer(p)).FpOrderBy != 0)) && ((*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpOrderBy)).FnExpr <= (*ExprList)(unsafe.Pointer(pSort)).FnExpr) { + var nSave int32 = (*ExprList)(unsafe.Pointer(pSort)).FnExpr + (*ExprList)(unsafe.Pointer(pSort)).FnExpr = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpOrderBy)).FnExpr + if Xsqlite3ExprListCompare(tls, pSort, (*Select)(unsafe.Pointer(p)).FpOrderBy, -1) == 0 { + Xsqlite3ExprListDelete(tls, db, (*Select)(unsafe.Pointer(p)).FpOrderBy) + (*Select)(unsafe.Pointer(p)).FpOrderBy = uintptr(0) + } + (*ExprList)(unsafe.Pointer(pSort)).FnExpr = nSave + } + + // Assign a cursor number for the ephemeral table used to buffer rows. + // The OpenEphemeral instruction is coded later, after it is known how + // many columns the table will have. + (*Window)(unsafe.Pointer(pMWin)).FiEphCsr = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) + + selectWindowRewriteEList(tls, pParse, pMWin, pSrc, (*Select)(unsafe.Pointer(p)).FpEList, pTab, bp+48 /* &pSublist */) + selectWindowRewriteEList(tls, pParse, pMWin, pSrc, (*Select)(unsafe.Pointer(p)).FpOrderBy, pTab, bp+48 /* &pSublist */) + (*Window)(unsafe.Pointer(pMWin)).FnBufferCol = func() int32 { + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) != 0 { + return (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)))).FnExpr + } + return 0 + }() + + // Append the PARTITION BY and ORDER BY expressions to the to the + // sub-select expression list. They are required to figure out where + // boundaries for partitions and sets of peer rows lie. + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = exprListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)), (*Window)(unsafe.Pointer(pMWin)).FpPartition, 0) + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = exprListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)), (*Window)(unsafe.Pointer(pMWin)).FpOrderBy, 0) + + // Append the arguments passed to each window function to the + // sub-select expression list. Also allocate two registers for each + // window function - one for the accumulator, another for interim + // results. + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var pArgs uintptr = *(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)) + if ((*FuncDef)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpFunc)).FfuncFlags & U32(SQLITE_FUNC_SUBTYPE)) != 0 { + selectWindowRewriteEList(tls, pParse, pMWin, pSrc, pArgs, pTab, bp+48 /* &pSublist */) + (*Window)(unsafe.Pointer(pWin)).FiArgCol = func() int32 { + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) != 0 { + return (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)))).FnExpr + } + return 0 + }() + (*Window)(unsafe.Pointer(pWin)).FbExprArgs = U8(1) + } else { + (*Window)(unsafe.Pointer(pWin)).FiArgCol = func() int32 { + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) != 0 { + return (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)))).FnExpr + } + return 0 + }() + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = exprListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)), pArgs, 0) + } + if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { + var pFilter uintptr = Xsqlite3ExprDup(tls, db, (*Window)(unsafe.Pointer(pWin)).FpFilter, 0) + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)), pFilter) + } + (*Window)(unsafe.Pointer(pWin)).FregAccum = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + (*Window)(unsafe.Pointer(pWin)).FregResult = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregAccum) + } + + // If there is no ORDER BY or PARTITION BY clause, and the window + // function accepts zero arguments, and there are no other columns + // selected (e.g. "SELECT row_number() OVER () FROM t1"), it is possible + // that pSublist is still NULL here. Add a constant expression here to + // keep everything legal in this case. + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6507 /* "0" */)) + } + + pSub = Xsqlite3SelectNew(tls, + pParse, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)), pSrc, pWhere, pGroupBy, pHaving, pSort, uint32(0), uintptr(0)) + + (*Select)(unsafe.Pointer(p)).FpSrc = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), uintptr(0), uintptr(0)) + if (*Select)(unsafe.Pointer(p)).FpSrc != 0 { + var pTab2 uintptr + (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpSelect = pSub + Xsqlite3SrcListAssignCursors(tls, pParse, (*Select)(unsafe.Pointer(p)).FpSrc) + *(*U32)(unsafe.Pointer(pSub + 4 /* &.selFlags */)) |= (U32(SF_Expanded)) + pTab2 = Xsqlite3ResultSetOfSelect(tls, pParse, pSub, int8(SQLITE_AFF_NONE)) + *(*U32)(unsafe.Pointer(pSub + 4 /* &.selFlags */)) |= (selFlags & U32(SF_Aggregate)) + if pTab2 == uintptr(0) { + // Might actually be some other kind of error, but in that case + // pParse->nErr will be set, so if SQLITE_NOMEM is set, we will get + // the correct error message regardless. + rc = SQLITE_NOMEM + } else { + libc.Xmemcpy(tls, pTab, pTab2, uint64(unsafe.Sizeof(Table{}))) + *(*U32)(unsafe.Pointer(pTab + 64 /* &.tabFlags */)) |= (U32(TF_Ephemeral)) + (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpTab = pTab + pTab = pTab2 + libc.Xmemset(tls, bp /* &w */, 0, uint64(unsafe.Sizeof(Walker{}))) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{sqlite3WindowExtraAggFuncDepth})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{Xsqlite3WalkerDepthIncrease})) + (*Walker)(unsafe.Pointer(bp /* &w */)).FxSelectCallback2 = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{Xsqlite3WalkerDepthDecrease})) + Xsqlite3WalkSelect(tls, bp /* &w */, pSub) + } + } else { + Xsqlite3SelectDelete(tls, db, pSub) + } + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + rc = SQLITE_NOMEM + } + Xsqlite3DbFree(tls, db, pTab) + } + + if rc != 0 { + if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { + + Xsqlite3ErrorToParser(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, SQLITE_NOMEM) + } + } + return rc +} + +// Unlink the Window object from the Select to which it is attached, +// if it is attached. +func Xsqlite3WindowUnlinkFromSelect(tls *libc.TLS, p uintptr) { /* sqlite3.c:156025:21: */ + if (*Window)(unsafe.Pointer(p)).FppThis != 0 { + *(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(p)).FppThis)) = (*Window)(unsafe.Pointer(p)).FpNextWin + if (*Window)(unsafe.Pointer(p)).FpNextWin != 0 { + (*Window)(unsafe.Pointer((*Window)(unsafe.Pointer(p)).FpNextWin)).FppThis = (*Window)(unsafe.Pointer(p)).FppThis + } + (*Window)(unsafe.Pointer(p)).FppThis = uintptr(0) + } +} + +// Free the Window object passed as the second argument. +func Xsqlite3WindowDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:156036:21: */ + if p != 0 { + Xsqlite3WindowUnlinkFromSelect(tls, p) + Xsqlite3ExprDelete(tls, db, (*Window)(unsafe.Pointer(p)).FpFilter) + Xsqlite3ExprListDelete(tls, db, (*Window)(unsafe.Pointer(p)).FpPartition) + Xsqlite3ExprListDelete(tls, db, (*Window)(unsafe.Pointer(p)).FpOrderBy) + Xsqlite3ExprDelete(tls, db, (*Window)(unsafe.Pointer(p)).FpEnd) + Xsqlite3ExprDelete(tls, db, (*Window)(unsafe.Pointer(p)).FpStart) + Xsqlite3DbFree(tls, db, (*Window)(unsafe.Pointer(p)).FzName) + Xsqlite3DbFree(tls, db, (*Window)(unsafe.Pointer(p)).FzBase) + Xsqlite3DbFree(tls, db, p) + } +} + +// Free the linked list of Window objects starting at the second argument. +func Xsqlite3WindowListDelete(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:156053:21: */ + for p != 0 { + var pNext uintptr = (*Window)(unsafe.Pointer(p)).FpNextWin + Xsqlite3WindowDelete(tls, db, p) + p = pNext + } +} + +// The argument expression is an PRECEDING or FOLLOWING offset. The +// value should be a non-negative integer. If the value is not a +// constant, change it to NULL. The fact that it is then a non-negative +// integer will be caught later. But it is important not to leave +// variable values in the expression tree. +func sqlite3WindowOffsetExpr(tls *libc.TLS, pParse uintptr, pExpr uintptr) uintptr { /* sqlite3.c:156068:13: */ + if 0 == Xsqlite3ExprIsConstant(tls, pExpr) { + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameExprUnmap(tls, pParse, pExpr) + } + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) + pExpr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_NULL, uintptr(0), 0) + } + return pExpr +} + +// Allocate and return a new Window object describing a Window Definition. +func Xsqlite3WindowAlloc(tls *libc.TLS, pParse uintptr, eType int32, eStart int32, pStart uintptr, eEnd int32, pEnd uintptr, eExclude U8) uintptr { /* sqlite3.c:156080:23: */ + var pWin uintptr + var bImplicitFrame int32 + pWin = uintptr(0) + bImplicitFrame = 0 + + // Parser assures the following: + + if !(eType == 0) { + goto __1 + } + bImplicitFrame = 1 + eType = TK_RANGE +__1: + ; + + // Additionally, the + // starting boundary type may not occur earlier in the following list than + // the ending boundary type: + // + // UNBOUNDED PRECEDING + // PRECEDING + // CURRENT ROW + // FOLLOWING + // UNBOUNDED FOLLOWING + // + // The parser ensures that "UNBOUNDED PRECEDING" cannot be used as an ending + // boundary, and than "UNBOUNDED FOLLOWING" cannot be used as a starting + // frame boundary. + if !(((eStart == TK_CURRENT) && (eEnd == TK_PRECEDING)) || + ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { + goto __2 + } + Xsqlite3ErrorMsg(tls, pParse, ts+20727 /* "unsupported fram..." */, 0) + goto windowAllocErr +__2: + ; + + pWin = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Window{}))) + if !(pWin == uintptr(0)) { + goto __3 + } + goto windowAllocErr +__3: + ; + (*Window)(unsafe.Pointer(pWin)).FeFrmType = U8(eType) + (*Window)(unsafe.Pointer(pWin)).FeStart = U8(eStart) + (*Window)(unsafe.Pointer(pWin)).FeEnd = U8(eEnd) + if !((int32(eExclude) == 0) && (((*Sqlite3)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb))).FdbOptFlags & (U32(SQLITE_WindowFunc))) != U32(0))) { + goto __4 + } + eExclude = U8(TK_NO) +__4: + ; + (*Window)(unsafe.Pointer(pWin)).FeExclude = eExclude + (*Window)(unsafe.Pointer(pWin)).FbImplicitFrame = U8(bImplicitFrame) + (*Window)(unsafe.Pointer(pWin)).FpEnd = sqlite3WindowOffsetExpr(tls, pParse, pEnd) + (*Window)(unsafe.Pointer(pWin)).FpStart = sqlite3WindowOffsetExpr(tls, pParse, pStart) + return pWin + +windowAllocErr: + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pEnd) + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pStart) + return uintptr(0) +} + +// Attach PARTITION and ORDER BY clauses pPartition and pOrderBy to window +// pWin. Also, if parameter pBase is not NULL, set pWin->zBase to the +// equivalent nul-terminated string. +func Xsqlite3WindowAssemble(tls *libc.TLS, pParse uintptr, pWin uintptr, pPartition uintptr, pOrderBy uintptr, pBase uintptr) uintptr { /* sqlite3.c:156152:23: */ + if pWin != 0 { + (*Window)(unsafe.Pointer(pWin)).FpPartition = pPartition + (*Window)(unsafe.Pointer(pWin)).FpOrderBy = pOrderBy + if pBase != 0 { + (*Window)(unsafe.Pointer(pWin)).FzBase = Xsqlite3DbStrNDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Token)(unsafe.Pointer(pBase)).Fz, uint64((*Token)(unsafe.Pointer(pBase)).Fn)) + } + } else { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pPartition) + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pOrderBy) + } + return pWin +} + +// Window *pWin has just been created from a WINDOW clause. Tokne pBase +// is the base window. Earlier windows from the same WINDOW clause are +// stored in the linked list starting at pWin->pNextWin. This function +// either updates *pWin according to the base specification, or else +// leaves an error in pParse. +func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uintptr) { /* sqlite3.c:156179:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Window)(unsafe.Pointer(pWin)).FzBase != 0 { + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + var pExist uintptr = windowFind(tls, pParse, pList, (*Window)(unsafe.Pointer(pWin)).FzBase) + if pExist != 0 { + var zErr uintptr = uintptr(0) + // Check for errors + if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { + zErr = ts + 20759 /* "PARTITION clause" */ + } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { + zErr = ts + 20776 /* "ORDER BY clause" */ + } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { + zErr = ts + 20792 /* "frame specificat..." */ + } + if zErr != 0 { + Xsqlite3ErrorMsg(tls, pParse, + ts+20812 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + } else { + (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) + if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { + + (*Window)(unsafe.Pointer(pWin)).FpOrderBy = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpOrderBy, 0) + } + Xsqlite3DbFree(tls, db, (*Window)(unsafe.Pointer(pWin)).FzBase) + (*Window)(unsafe.Pointer(pWin)).FzBase = uintptr(0) + } + } + } +} + +// Attach window object pWin to expression p. +func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr) { /* sqlite3.c:156213:21: */ + if p != 0 { + + *(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)) = pWin + *(*U32)(unsafe.Pointer(p + 4 /* &.flags */)) |= (U32(EP_WinFunc)) + (*Window)(unsafe.Pointer(pWin)).FpOwner = p + if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { + Xsqlite3ErrorMsg(tls, pParse, + ts+20845 /* "DISTINCT is not ..." */, 0) + } + } else { + Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) + } +} + +// Possibly link window pWin into the list at pSel->pWin (window functions +// to be processed as part of SELECT statement pSel). The window is linked +// in if either (a) there are no other windows already linked to this +// SELECT, or (b) the windows already linked use a compatible window frame. +func Xsqlite3WindowLink(tls *libc.TLS, pSel uintptr, pWin uintptr) { /* sqlite3.c:156236:21: */ + if pSel != 0 { + if (uintptr(0) == (*Select)(unsafe.Pointer(pSel)).FpWin) || (0 == Xsqlite3WindowCompare(tls, uintptr(0), (*Select)(unsafe.Pointer(pSel)).FpWin, pWin, 0)) { + (*Window)(unsafe.Pointer(pWin)).FpNextWin = (*Select)(unsafe.Pointer(pSel)).FpWin + if (*Select)(unsafe.Pointer(pSel)).FpWin != 0 { + (*Window)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpWin)).FppThis = (pWin + 64 /* &.pNextWin */) + } + (*Select)(unsafe.Pointer(pSel)).FpWin = pWin + (*Window)(unsafe.Pointer(pWin)).FppThis = (pSel + 112 /* &.pWin */) + } else { + if Xsqlite3ExprListCompare(tls, (*Window)(unsafe.Pointer(pWin)).FpPartition, (*Window)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpWin)).FpPartition, -1) != 0 { + *(*U32)(unsafe.Pointer(pSel + 4 /* &.selFlags */)) |= (U32(SF_MultiPart)) + } + } + } +} + +// Return 0 if the two window objects are identical, 1 if they are +// different, or 2 if it cannot be determined if the objects are identical +// or not. Identical window objects can be processed in a single scan. +func Xsqlite3WindowCompare(tls *libc.TLS, pParse uintptr, p1 uintptr, p2 uintptr, bFilter int32) int32 { /* sqlite3.c:156258:20: */ + var res int32 + if (p1 == uintptr(0)) || (p2 == uintptr(0)) { + return 1 + } + if int32((*Window)(unsafe.Pointer(p1)).FeFrmType) != int32((*Window)(unsafe.Pointer(p2)).FeFrmType) { + return 1 + } + if int32((*Window)(unsafe.Pointer(p1)).FeStart) != int32((*Window)(unsafe.Pointer(p2)).FeStart) { + return 1 + } + if int32((*Window)(unsafe.Pointer(p1)).FeEnd) != int32((*Window)(unsafe.Pointer(p2)).FeEnd) { + return 1 + } + if int32((*Window)(unsafe.Pointer(p1)).FeExclude) != int32((*Window)(unsafe.Pointer(p2)).FeExclude) { + return 1 + } + if Xsqlite3ExprCompare(tls, pParse, (*Window)(unsafe.Pointer(p1)).FpStart, (*Window)(unsafe.Pointer(p2)).FpStart, -1) != 0 { + return 1 + } + if Xsqlite3ExprCompare(tls, pParse, (*Window)(unsafe.Pointer(p1)).FpEnd, (*Window)(unsafe.Pointer(p2)).FpEnd, -1) != 0 { + return 1 + } + if libc.AssignInt32(&res, Xsqlite3ExprListCompare(tls, (*Window)(unsafe.Pointer(p1)).FpPartition, (*Window)(unsafe.Pointer(p2)).FpPartition, -1)) != 0 { + return res + } + if libc.AssignInt32(&res, Xsqlite3ExprListCompare(tls, (*Window)(unsafe.Pointer(p1)).FpOrderBy, (*Window)(unsafe.Pointer(p2)).FpOrderBy, -1)) != 0 { + return res + } + if bFilter != 0 { + if libc.AssignInt32(&res, Xsqlite3ExprCompare(tls, pParse, (*Window)(unsafe.Pointer(p1)).FpFilter, (*Window)(unsafe.Pointer(p2)).FpFilter, -1)) != 0 { + return res + } + } + return 0 +} + +// This is called by code in select.c before it calls sqlite3WhereBegin() +// to begin iterating through the sub-query results. It is used to allocate +// and initialize registers and cursors used by sqlite3WindowCodeStep(). +func Xsqlite3WindowCodeInit(tls *libc.TLS, pParse uintptr, pSelect uintptr) { /* sqlite3.c:156287:21: */ + var nEphExpr int32 = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSelect)).FpSrc + 8 /* &.a */))).FpSelect)).FpEList)).FnExpr + var pMWin uintptr = (*Select)(unsafe.Pointer(pSelect)).FpWin + var pWin uintptr + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr, nEphExpr) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, ((*Window)(unsafe.Pointer(pMWin)).FiEphCsr + 1), (*Window)(unsafe.Pointer(pMWin)).FiEphCsr) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, ((*Window)(unsafe.Pointer(pMWin)).FiEphCsr + 2), (*Window)(unsafe.Pointer(pMWin)).FiEphCsr) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, ((*Window)(unsafe.Pointer(pMWin)).FiEphCsr + 3), (*Window)(unsafe.Pointer(pMWin)).FiEphCsr) + + // Allocate registers to use for PARTITION BY values, if any. Initialize + // said registers to NULL. + if (*Window)(unsafe.Pointer(pMWin)).FpPartition != 0 { + var nExpr int32 = (*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pMWin)).FpPartition)).FnExpr + (*Window)(unsafe.Pointer(pMWin)).FregPart = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nExpr) + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pMWin)).FregPart, (((*Window)(unsafe.Pointer(pMWin)).FregPart + nExpr) - 1)) + } + + (*Window)(unsafe.Pointer(pMWin)).FregOne = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, (*Window)(unsafe.Pointer(pMWin)).FregOne) + + if (*Window)(unsafe.Pointer(pMWin)).FeExclude != 0 { + (*Window)(unsafe.Pointer(pMWin)).FregStartRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + (*Window)(unsafe.Pointer(pMWin)).FregEndRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + (*Window)(unsafe.Pointer(pMWin)).FcsrApp = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, (*Window)(unsafe.Pointer(pMWin)).FregStartRowid) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*Window)(unsafe.Pointer(pMWin)).FregEndRowid) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, (*Window)(unsafe.Pointer(pMWin)).FcsrApp, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr) + return + } + + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var p uintptr = (*Window)(unsafe.Pointer(pWin)).FpFunc + if (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_MINMAX)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeStart) != TK_UNBOUNDED) { + // The inline versions of min() and max() require a single ephemeral + // table and 3 registers. The registers are used as follows: + // + // regApp+0: slot to copy min()/max() argument to for MakeRecord + // regApp+1: integer value used to ensure keys are unique + // regApp+2: output of MakeRecord + var pList uintptr = *(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)) + var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, pList, 0, 0) + (*Window)(unsafe.Pointer(pWin)).FcsrApp = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + (*Window)(unsafe.Pointer(pWin)).FregApp = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (3) + if (pKeyInfo != 0) && (int32(*(*int8)(unsafe.Pointer((*FuncDef)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpFunc)).FzName + 1))) == 'i') { + + *(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags)) = U8(KEYINFO_ORDER_DESC) + } + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*Window)(unsafe.Pointer(pWin)).FcsrApp, 2) + Xsqlite3VdbeAppendP4(tls, v, pKeyInfo, -9) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, ((*Window)(unsafe.Pointer(pWin)).FregApp + 1)) + } else if ((*FuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&nth_valueName))) || ((*FuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&first_valueName))) { + // Allocate two registers at pWin->regApp. These will be used to + // store the start and end index of the current frame. + (*Window)(unsafe.Pointer(pWin)).FregApp = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + (*Window)(unsafe.Pointer(pWin)).FcsrApp = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (2) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, (*Window)(unsafe.Pointer(pWin)).FcsrApp, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr) + } else if ((*FuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&leadName))) || ((*FuncDef)(unsafe.Pointer(p)).FzName == uintptr(unsafe.Pointer(&lagName))) { + (*Window)(unsafe.Pointer(pWin)).FcsrApp = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenDup, (*Window)(unsafe.Pointer(pWin)).FcsrApp, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr) + } + } +} + +// A "PRECEDING " (eCond==0) or "FOLLOWING " (eCond==1) or the +// value of the second argument to nth_value() (eCond==2) has just been +// evaluated and the result left in register reg. This function generates VM +// code to check that the value is a non-negative integer and throws an +// exception if it is not. +func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { /* sqlite3.c:156371:13: */ + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var regZero int32 = Xsqlite3GetTempReg(tls, pParse) + + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) + if eCond >= WINDOW_STARTING_NUM { + var regString int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+756 /* "" */, -1) + Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) + Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) + + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_MustBeInt, reg, (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + + } + Xsqlite3VdbeAddOp3(tls, v, aOp1[eCond], regZero, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_AFF_NUMERIC)) + // NULL case captured by + // the OP_MustBeInt + + // NULL case caught by + // the OP_Ge + Xsqlite3MayAbort(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_Halt, SQLITE_ERROR, OE_Abort) + Xsqlite3VdbeAppendP4(tls, v, azErr[eCond], -1) + Xsqlite3ReleaseTempReg(tls, pParse, regZero) +} + +var azErr = [5]uintptr{ + ts + 20892, /* "frame starting o..." */ + ts + 20945, /* "frame ending off..." */ + ts + 20375, /* "second argument ..." */ + ts + 20996, /* "frame starting o..." */ + ts + 21048, /* "frame ending off..." */ +} /* sqlite3.c:156372:21 */ +var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ + +// Return the number of arguments passed to the window-function associated +// with the object passed as the only argument to this function. +func windowArgCount(tls *libc.TLS, pWin uintptr) int32 { /* sqlite3.c:156418:12: */ + var pList uintptr = *(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)) + return func() int32 { + if pList != 0 { + return (*ExprList)(unsafe.Pointer(pList)).FnExpr + } + return 0 + }() +} + +type WindowCodeArg1 = struct { + FpParse uintptr + FpMWin uintptr + FpVdbe uintptr + FaddrGosub int32 + FregGosub int32 + FregArg int32 + FeDelete int32 + FregRowid int32 + Fstart WindowCsrAndReg + Fcurrent WindowCsrAndReg + Fend WindowCsrAndReg + _ [4]byte +} /* sqlite3.c:156423:9 */ + +type WindowCodeArg = WindowCodeArg1 /* sqlite3.c:156423:30 */ +type WindowCsrAndReg1 = struct { + Fcsr int32 + Freg int32 +} /* sqlite3.c:156423:9 */ + +type WindowCsrAndReg = WindowCsrAndReg1 /* sqlite3.c:156424:32 */ + +// Generate VM code to read the window frames peer values from cursor csr into +// an array of registers starting at reg. +func windowReadPeerValues(tls *libc.TLS, p uintptr, csr int32, reg int32) { /* sqlite3.c:156508:13: */ + var pMWin uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpMWin + var pOrderBy uintptr = (*Window)(unsafe.Pointer(pMWin)).FpOrderBy + if pOrderBy != 0 { + var v uintptr = Xsqlite3GetVdbe(tls, (*WindowCodeArg)(unsafe.Pointer(p)).FpParse) + var pPart uintptr = (*Window)(unsafe.Pointer(pMWin)).FpPartition + var iColOff int32 = ((*Window)(unsafe.Pointer(pMWin)).FnBufferCol + (func() int32 { + if pPart != 0 { + return (*ExprList)(unsafe.Pointer(pPart)).FnExpr + } + return 0 + }())) + var i int32 + for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, csr, (iColOff + i), (reg + i)) + } + } +} + +// Generate VM code to invoke either xStep() (if bInverse is 0) or +// xInverse (if bInverse is non-zero) for each window function in the +// linked list starting at pMWin. Or, for built-in window functions +// that do not use the standard function API, generate the required +// inline VM code. +// +// If argument csr is greater than or equal to 0, then argument reg is +// the first register in an array of registers guaranteed to be large +// enough to hold the array of arguments for each function. In this case +// the arguments are extracted from the current row of csr into the +// array of registers before invoking OP_AggStep or OP_AggInverse +// +// Or, if csr is less than zero, then the array of registers at reg is +// already populated with all columns from the current row of the sub-query. +// +// If argument regPartSize is non-zero, then it is a register containing the +// number of rows in the current partition. +func windowAggStep(tls *libc.TLS, p uintptr, pMWin uintptr, csr int32, bInverse int32, reg int32) { /* sqlite3.c:156545:13: */ + var pParse uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpParse + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var pWin uintptr + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var pFunc uintptr = (*Window)(unsafe.Pointer(pWin)).FpFunc + var regArg int32 + var nArg int32 + if (*Window)(unsafe.Pointer(pWin)).FbExprArgs != 0 { + nArg = 0 + } else { + nArg = windowArgCount(tls, pWin) + } + var i int32 + + // All OVER clauses in the same window function aggregate step must + // be the same. + + for i = 0; i < nArg; i++ { + if (i != 1) || ((*FuncDef)(unsafe.Pointer(pFunc)).FzName != uintptr(unsafe.Pointer(&nth_valueName))) { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, csr, ((*Window)(unsafe.Pointer(pWin)).FiArgCol + i), (reg + i)) + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr, ((*Window)(unsafe.Pointer(pWin)).FiArgCol + i), (reg + i)) + } + } + regArg = reg + + if (((*Window)(unsafe.Pointer(pMWin)).FregStartRowid == 0) && + (((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_MINMAX)) != 0)) && + (int32((*Window)(unsafe.Pointer(pWin)).FeStart) != TK_UNBOUNDED) { + var addrIsNull int32 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, regArg) + + if bInverse == 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, ((*Window)(unsafe.Pointer(pWin)).FregApp + 1), 1) + Xsqlite3VdbeAddOp2(tls, v, OP_SCopy, regArg, (*Window)(unsafe.Pointer(pWin)).FregApp) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (*Window)(unsafe.Pointer(pWin)).FregApp, 2, ((*Window)(unsafe.Pointer(pWin)).FregApp + 2)) + Xsqlite3VdbeAddOp2(tls, v, OP_IdxInsert, (*Window)(unsafe.Pointer(pWin)).FcsrApp, ((*Window)(unsafe.Pointer(pWin)).FregApp + 2)) + } else { + Xsqlite3VdbeAddOp4Int(tls, v, OP_SeekGE, (*Window)(unsafe.Pointer(pWin)).FcsrApp, 0, regArg, 1) + + Xsqlite3VdbeAddOp1(tls, v, OP_Delete, (*Window)(unsafe.Pointer(pWin)).FcsrApp) + Xsqlite3VdbeJumpHere(tls, v, (Xsqlite3VdbeCurrentAddr(tls, v) - 2)) + } + Xsqlite3VdbeJumpHere(tls, v, addrIsNull) + } else if (*Window)(unsafe.Pointer(pWin)).FregApp != 0 { + + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, (((*Window)(unsafe.Pointer(pWin)).FregApp + 1) - bInverse), 1) + } else if (*FuncDef)(unsafe.Pointer(pFunc)).FxSFunc != *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{noopStepFunc})) { + var addrIf int32 = 0 + if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { + var regTmp int32 + + regTmp = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, csr, ((*Window)(unsafe.Pointer(pWin)).FiArgCol + nArg), regTmp) + addrIf = Xsqlite3VdbeAddOp3(tls, v, OP_IfNot, regTmp, 0, 1) + + Xsqlite3ReleaseTempReg(tls, pParse, regTmp) + } + + if (*Window)(unsafe.Pointer(pWin)).FbExprArgs != 0 { + var iOp int32 = Xsqlite3VdbeCurrentAddr(tls, v) + var iEnd int32 + + nArg = (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)))).FnExpr + regArg = Xsqlite3GetTempRange(tls, pParse, nArg) + Xsqlite3ExprCodeExprList(tls, pParse, *(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)), regArg, 0, uint8(0)) + + for iEnd = Xsqlite3VdbeCurrentAddr(tls, v); iOp < iEnd; iOp++ { + var pOp uintptr = Xsqlite3VdbeGetOp(tls, v, iOp) + if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fopcode) == OP_Column) && ((*VdbeOp)(unsafe.Pointer(pOp)).Fp1 == (*Window)(unsafe.Pointer(pWin)).FiEphCsr) { + (*VdbeOp)(unsafe.Pointer(pOp)).Fp1 = csr + } + } + } + if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_NEEDCOLL)) != 0 { + var pColl uintptr + + pColl = Xsqlite3ExprNNCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)) + 8 /* &.a */))).FpExpr) + Xsqlite3VdbeAddOp4(tls, v, OP_CollSeq, 0, 0, 0, pColl, -2) + } + Xsqlite3VdbeAddOp3(tls, v, func() int32 { + if bInverse != 0 { + return OP_AggInverse + } + return OP_AggStep + }(), + bInverse, regArg, (*Window)(unsafe.Pointer(pWin)).FregAccum) + Xsqlite3VdbeAppendP4(tls, v, pFunc, -8) + Xsqlite3VdbeChangeP5(tls, v, uint16(U8(nArg))) + if (*Window)(unsafe.Pointer(pWin)).FbExprArgs != 0 { + Xsqlite3ReleaseTempRange(tls, pParse, regArg, nArg) + } + if addrIf != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrIf) + } + } + } +} + +// Values that may be passed as the second argument to windowCodeOp(). + +// Generate VM code to invoke either xValue() (bFin==0) or xFinalize() +// (bFin==1) for each window function in the linked list starting at +// pMWin. Or, for built-in window-functions that do not use the standard +// API, generate the equivalent VM code. +func windowAggFinal(tls *libc.TLS, p uintptr, bFin int32) { /* sqlite3.c:156659:13: */ + var pParse uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpParse + var pMWin uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpMWin + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var pWin uintptr + + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + if (((*Window)(unsafe.Pointer(pMWin)).FregStartRowid == 0) && + (((*FuncDef)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpFunc)).FfuncFlags & U32(SQLITE_FUNC_MINMAX)) != 0)) && + (int32((*Window)(unsafe.Pointer(pWin)).FeStart) != TK_UNBOUNDED) { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregResult) + Xsqlite3VdbeAddOp1(tls, v, OP_Last, (*Window)(unsafe.Pointer(pWin)).FcsrApp) + + Xsqlite3VdbeAddOp3(tls, v, OP_Column, (*Window)(unsafe.Pointer(pWin)).FcsrApp, 0, (*Window)(unsafe.Pointer(pWin)).FregResult) + Xsqlite3VdbeJumpHere(tls, v, (Xsqlite3VdbeCurrentAddr(tls, v) - 2)) + } else if (*Window)(unsafe.Pointer(pWin)).FregApp != 0 { + + } else { + var nArg int32 = windowArgCount(tls, pWin) + if bFin != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_AggFinal, (*Window)(unsafe.Pointer(pWin)).FregAccum, nArg) + Xsqlite3VdbeAppendP4(tls, v, (*Window)(unsafe.Pointer(pWin)).FpFunc, -8) + Xsqlite3VdbeAddOp2(tls, v, OP_Copy, (*Window)(unsafe.Pointer(pWin)).FregAccum, (*Window)(unsafe.Pointer(pWin)).FregResult) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregAccum) + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_AggValue, (*Window)(unsafe.Pointer(pWin)).FregAccum, nArg, (*Window)(unsafe.Pointer(pWin)).FregResult) + Xsqlite3VdbeAppendP4(tls, v, (*Window)(unsafe.Pointer(pWin)).FpFunc, -8) + } + } + } +} + +// Generate code to calculate the current values of all window functions in the +// p->pMWin list by doing a full scan of the current window frame. Store the +// results in the Window.regResult registers, ready to return the upper +// layer. +func windowFullScan(tls *libc.TLS, p uintptr) { /* sqlite3.c:156698:13: */ + var pWin uintptr + var pParse uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpParse + var pMWin uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpMWin + var v uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpVdbe + + var regCRowid int32 = 0 // Current rowid value + var regCPeer int32 = 0 // Current peer values + var regRowid int32 = 0 // AggStep rowid value + var regPeer int32 = 0 // AggStep peer values + + var nPeer int32 + var lblNext int32 + var lblBrk int32 + var addrNext int32 + var csr int32 + + csr = (*Window)(unsafe.Pointer(pMWin)).FcsrApp + nPeer = func() int32 { + if (*Window)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { + return (*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pMWin)).FpOrderBy)).FnExpr + } + return 0 + }() + + lblNext = Xsqlite3VdbeMakeLabel(tls, pParse) + lblBrk = Xsqlite3VdbeMakeLabel(tls, pParse) + + regCRowid = Xsqlite3GetTempReg(tls, pParse) + regRowid = Xsqlite3GetTempReg(tls, pParse) + if nPeer != 0 { + regCPeer = Xsqlite3GetTempRange(tls, pParse, nPeer) + regPeer = Xsqlite3GetTempRange(tls, pParse, nPeer) + } + + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr, regCRowid) + windowReadPeerValues(tls, p, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr, regCPeer) + + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregAccum) + } + + Xsqlite3VdbeAddOp3(tls, v, OP_SeekGE, csr, lblBrk, (*Window)(unsafe.Pointer(pMWin)).FregStartRowid) + + addrNext = Xsqlite3VdbeCurrentAddr(tls, v) + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, csr, regRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Gt, (*Window)(unsafe.Pointer(pMWin)).FregEndRowid, lblBrk, regRowid) + + if int32((*Window)(unsafe.Pointer(pMWin)).FeExclude) == TK_CURRENT { + Xsqlite3VdbeAddOp3(tls, v, OP_Eq, regCRowid, lblNext, regRowid) + + } else if int32((*Window)(unsafe.Pointer(pMWin)).FeExclude) != TK_NO { + var addr int32 + var addrEq int32 = 0 + var pKeyInfo uintptr = uintptr(0) + + if (*Window)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { + pKeyInfo = Xsqlite3KeyInfoFromExprList(tls, pParse, (*Window)(unsafe.Pointer(pMWin)).FpOrderBy, 0, 0) + } + if int32((*Window)(unsafe.Pointer(pMWin)).FeExclude) == TK_TIES { + addrEq = Xsqlite3VdbeAddOp3(tls, v, OP_Eq, regCRowid, 0, regRowid) + + } + if pKeyInfo != 0 { + windowReadPeerValues(tls, p, csr, regPeer) + Xsqlite3VdbeAddOp3(tls, v, OP_Compare, regPeer, regCPeer, nPeer) + Xsqlite3VdbeAppendP4(tls, v, pKeyInfo, -9) + addr = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, addr, lblNext, addr) + + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, lblNext) + } + if addrEq != 0 { + Xsqlite3VdbeJumpHere(tls, v, addrEq) + } + } + + windowAggStep(tls, p, pMWin, csr, 0, (*WindowCodeArg)(unsafe.Pointer(p)).FregArg) + + Xsqlite3VdbeResolveLabel(tls, v, lblNext) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, csr, addrNext) + + Xsqlite3VdbeJumpHere(tls, v, (addrNext - 1)) + Xsqlite3VdbeJumpHere(tls, v, (addrNext + 1)) + Xsqlite3ReleaseTempReg(tls, pParse, regRowid) + Xsqlite3ReleaseTempReg(tls, pParse, regCRowid) + if nPeer != 0 { + Xsqlite3ReleaseTempRange(tls, pParse, regPeer, nPeer) + Xsqlite3ReleaseTempRange(tls, pParse, regCPeer, nPeer) + } + + windowAggFinal(tls, p, 1) + +} + +// Invoke the sub-routine at regGosub (generated by code in select.c) to +// return the current row of Window.iEphCsr. If all window functions are +// aggregate window functions that use the standard API, a single +// OP_Gosub instruction is all that this routine generates. Extra VM code +// for per-row processing is only generated for the following built-in window +// functions: +// +// nth_value() +// first_value() +// lag() +// lead() +func windowReturnOneRow(tls *libc.TLS, p uintptr) { /* sqlite3.c:156804:13: */ + var pMWin uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpMWin + var v uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpVdbe + + if (*Window)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + windowFullScan(tls, p) + } else { + var pParse uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpParse + var pWin uintptr + + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var pFunc uintptr = (*Window)(unsafe.Pointer(pWin)).FpFunc + if ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&nth_valueName))) || + ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&first_valueName))) { + var csr int32 = (*Window)(unsafe.Pointer(pWin)).FcsrApp + var lbl int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var tmpReg int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregResult) + + if (*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&nth_valueName)) { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, (*Window)(unsafe.Pointer(pMWin)).FiEphCsr, ((*Window)(unsafe.Pointer(pWin)).FiArgCol + 1), tmpReg) + windowCheckValue(tls, pParse, tmpReg, 2) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, tmpReg) + } + Xsqlite3VdbeAddOp3(tls, v, OP_Add, tmpReg, (*Window)(unsafe.Pointer(pWin)).FregApp, tmpReg) + Xsqlite3VdbeAddOp3(tls, v, OP_Gt, ((*Window)(unsafe.Pointer(pWin)).FregApp + 1), lbl, tmpReg) + + Xsqlite3VdbeAddOp3(tls, v, OP_SeekRowid, csr, 0, tmpReg) + + Xsqlite3VdbeAddOp3(tls, v, OP_Column, csr, (*Window)(unsafe.Pointer(pWin)).FiArgCol, (*Window)(unsafe.Pointer(pWin)).FregResult) + Xsqlite3VdbeResolveLabel(tls, v, lbl) + Xsqlite3ReleaseTempReg(tls, pParse, tmpReg) + } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&leadName))) || ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&lagName))) { + var nArg int32 = (*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOwner + 32 /* &.x */)))).FnExpr + var csr int32 = (*Window)(unsafe.Pointer(pWin)).FcsrApp + var lbl int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var tmpReg int32 = Xsqlite3GetTempReg(tls, pParse) + var iEph int32 = (*Window)(unsafe.Pointer(pMWin)).FiEphCsr + + if nArg < 3 { + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregResult) + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iEph, ((*Window)(unsafe.Pointer(pWin)).FiArgCol + 2), (*Window)(unsafe.Pointer(pWin)).FregResult) + } + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, iEph, tmpReg) + if nArg < 2 { + var val int32 = func() int32 { + if (*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&leadName)) { + return 1 + } + return -1 + }() + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, tmpReg, val) + } else { + var op int32 = func() int32 { + if (*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&leadName)) { + return OP_Add + } + return OP_Subtract + }() + var tmpReg2 int32 = Xsqlite3GetTempReg(tls, pParse) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, iEph, ((*Window)(unsafe.Pointer(pWin)).FiArgCol + 1), tmpReg2) + Xsqlite3VdbeAddOp3(tls, v, op, tmpReg2, tmpReg, tmpReg) + Xsqlite3ReleaseTempReg(tls, pParse, tmpReg2) + } + + Xsqlite3VdbeAddOp3(tls, v, OP_SeekRowid, csr, lbl, tmpReg) + + Xsqlite3VdbeAddOp3(tls, v, OP_Column, csr, (*Window)(unsafe.Pointer(pWin)).FiArgCol, (*Window)(unsafe.Pointer(pWin)).FregResult) + Xsqlite3VdbeResolveLabel(tls, v, lbl) + Xsqlite3ReleaseTempReg(tls, pParse, tmpReg) + } + } + } + Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, (*WindowCodeArg)(unsafe.Pointer(p)).FregGosub, (*WindowCodeArg)(unsafe.Pointer(p)).FaddrGosub) +} + +// Generate code to set the accumulator register for each window function +// in the linked list passed as the second argument to NULL. And perform +// any equivalent initialization required by any built-in window functions +// in the list. +func windowInitAccum(tls *libc.TLS, pParse uintptr, pMWin uintptr) int32 { /* sqlite3.c:156880:12: */ + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var regArg int32 + var nArg int32 = 0 + var pWin uintptr + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var pFunc uintptr = (*Window)(unsafe.Pointer(pWin)).FpFunc + + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (*Window)(unsafe.Pointer(pWin)).FregAccum) + nArg = func() int32 { + if (nArg) > (windowArgCount(tls, pWin)) { + return nArg + } + return windowArgCount(tls, pWin) + }() + if (*Window)(unsafe.Pointer(pMWin)).FregStartRowid == 0 { + if ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&nth_valueName))) || ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&first_valueName))) { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*Window)(unsafe.Pointer(pWin)).FregApp) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, ((*Window)(unsafe.Pointer(pWin)).FregApp + 1)) + } + + if (((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_MINMAX)) != 0) && ((*Window)(unsafe.Pointer(pWin)).FcsrApp != 0) { + + Xsqlite3VdbeAddOp1(tls, v, OP_ResetSorter, (*Window)(unsafe.Pointer(pWin)).FcsrApp) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, ((*Window)(unsafe.Pointer(pWin)).FregApp + 1)) + } + } + } + regArg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nArg) + return regArg +} + +// Return true if the current frame should be cached in the ephemeral table, +// even if there are no xInverse() calls required. +func windowCacheFrame(tls *libc.TLS, pMWin uintptr) int32 { /* sqlite3.c:156912:12: */ + var pWin uintptr + if (*Window)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + return 1 + } + for pWin = pMWin; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + var pFunc uintptr = (*Window)(unsafe.Pointer(pWin)).FpFunc + if ((((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&nth_valueName))) || + ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&first_valueName)))) || + ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&leadName)))) || + ((*FuncDef)(unsafe.Pointer(pFunc)).FzName == uintptr(unsafe.Pointer(&lagName))) { + return 1 + } + } + return 0 +} + +// regOld and regNew are each the first register in an array of size +// pOrderBy->nExpr. This function generates code to compare the two +// arrays of registers using the collation sequences and other comparison +// parameters specified by pOrderBy. +// +// If the two arrays are not equal, the contents of regNew is copied to +// regOld and control falls through. Otherwise, if the contents of the arrays +// are equal, an OP_Goto is executed. The address of the OP_Goto is returned. +func windowIfNewPeer(tls *libc.TLS, pParse uintptr, pOrderBy uintptr, regNew int32, regOld int32, addr int32) { /* sqlite3.c:156938:13: */ + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + if pOrderBy != 0 { + var nVal int32 = (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr + var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, pOrderBy, 0, 0) + Xsqlite3VdbeAddOp3(tls, v, OP_Compare, regOld, regNew, nVal) + Xsqlite3VdbeAppendP4(tls, v, pKeyInfo, -9) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, + (Xsqlite3VdbeCurrentAddr(tls, v) + 1), addr, (Xsqlite3VdbeCurrentAddr(tls, v) + 1)) + + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regNew, regOld, (nVal - 1)) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addr) + } +} + +// This function is called as part of generating VM programs for RANGE +// offset PRECEDING/FOLLOWING frame boundaries. Assuming "ASC" order for +// the ORDER BY term in the window, and that argument op is OP_Ge, it generates +// code equivalent to: +// +// if( csr1.peerVal + regVal >= csr2.peerVal ) goto lbl; +// +// The value of parameter op may also be OP_Gt or OP_Le. In these cases the +// operator in the above pseudo-code is replaced with ">" or "<=", respectively. +// +// If the sort-order for the ORDER BY term in the window is DESC, then the +// comparison is reversed. Instead of adding regVal to csr1.peerVal, it is +// subtracted. And the comparison operator is inverted to - ">=" becomes "<=", +// ">" becomes "<", and so on. So, with DESC sort order, if the argument op +// is OP_Ge, the generated code is equivalent to: +// +// if( csr1.peerVal - regVal <= csr2.peerVal ) goto lbl; +// +// A special type of arithmetic is used such that if csr1.peerVal is not +// a numeric type (real or integer), then the result of the addition +// or subtraction is a a copy of csr1.peerVal. +func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal int32, csr2 int32, lbl int32) { /* sqlite3.c:156984:13: */ + var pParse uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpParse + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var pOrderBy uintptr = (*Window)(unsafe.Pointer((*WindowCodeArg)(unsafe.Pointer(p)).FpMWin)).FpOrderBy // ORDER BY clause for window + var reg1 int32 = Xsqlite3GetTempReg(tls, pParse) // Reg. for csr1.peerVal+regVal + var reg2 int32 = Xsqlite3GetTempReg(tls, pParse) // Reg. for csr2.peerVal + var regString int32 = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) // Reg. for constant value '' + var arith int32 = OP_Add // OP_Add or OP_Subtract + var addrGe int32 // Jump destination + var addrDone int32 = Xsqlite3VdbeMakeLabel(tls, pParse) // Address past OP_Ge + var pColl uintptr + + // Read the peer-value from each cursor into a register + windowReadPeerValues(tls, p, csr1, reg1) + windowReadPeerValues(tls, p, csr2, reg2) + + if (int32((*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */))).FsortFlags) & KEYINFO_ORDER_DESC) != 0 { + switch op { + case OP_Ge: + op = OP_Le + break + fallthrough + case OP_Gt: + op = OP_Lt + break + fallthrough + default: + op = OP_Ge + break + } + arith = OP_Subtract + } + + // If the BIGNULL flag is set for the ORDER BY, then it is required to + // consider NULL values to be larger than all other values, instead of + // the usual smaller. The VDBE opcodes OP_Ge and so on do not handle this + // (and adding that capability causes a performance regression), so + // instead if the BIGNULL flag is set then cases where either reg1 or + // reg2 are NULL are handled separately in the following block. The code + // generated is equivalent to: + // + // if( reg1 IS NULL ){ + // if( op==OP_Ge ) goto lbl; + // if( op==OP_Gt && reg2 IS NOT NULL ) goto lbl; + // if( op==OP_Le && reg2 IS NULL ) goto lbl; + // }else if( reg2 IS NULL ){ + // if( op==OP_Le ) goto lbl; + // } + // + // Additionally, if either reg1 or reg2 are NULL but the jump to lbl is + // not taken, control jumps over the comparison operator coded below this + // block. + if (int32((*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */))).FsortFlags) & KEYINFO_ORDER_BIGNULL) != 0 { + // This block runs if reg1 contains a NULL. + var addr int32 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, reg1) + switch op { + case OP_Ge: + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, lbl) + break + fallthrough + case OP_Gt: + Xsqlite3VdbeAddOp2(tls, v, OP_NotNull, reg2, lbl) + + break + fallthrough + case OP_Le: + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, reg2, lbl) + + break + fallthrough + default: /* no-op */ + break + } + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrDone) + + // This block runs if reg1 is not NULL, but reg2 is. + Xsqlite3VdbeJumpHere(tls, v, addr) + Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, reg2, lbl) + if (op == OP_Gt) || (op == OP_Ge) { + Xsqlite3VdbeChangeP2(tls, v, -1, addrDone) + } + } + + // Register reg1 currently contains csr1.peerVal (the peer-value from csr1). + // This block adds (or subtracts for DESC) the numeric value in regVal + // from it. Or, if reg1 is not numeric (it is a NULL, a text value or a blob), + // then leave reg1 as it is. In pseudo-code, this is implemented as: + // + // if( reg1>='' ) goto addrGe; + // reg1 = reg1 +/- regVal + // addrGe: + // + // Since all strings and blobs are greater-than-or-equal-to an empty string, + // the add/subtract is skipped for these, as required. If reg1 is a NULL, + // then the arithmetic is performed, but since adding or subtracting from + // NULL is always NULL anyway, this case is handled as required too. + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+756 /* "" */, -1) + addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) + + if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { + Xsqlite3VdbeAddOp3(tls, v, op, reg2, lbl, reg1) + } + Xsqlite3VdbeAddOp3(tls, v, arith, regVal, reg1, reg1) + Xsqlite3VdbeJumpHere(tls, v, addrGe) + + // Compare registers reg2 and reg1, taking the jump if required. Note that + // control skips over this test if the BIGNULL flag is set and either + // reg1 or reg2 contain a NULL value. + Xsqlite3VdbeAddOp3(tls, v, op, reg2, lbl, reg1) + pColl = Xsqlite3ExprNNCollSeq(tls, pParse, (*ExprList_item)(unsafe.Pointer((pOrderBy + 8 /* &.a */))).FpExpr) + Xsqlite3VdbeAppendP4(tls, v, pColl, -2) + Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NULLEQ)) + Xsqlite3VdbeResolveLabel(tls, v, addrDone) + + Xsqlite3ReleaseTempReg(tls, pParse, reg1) + Xsqlite3ReleaseTempReg(tls, pParse, reg2) + +} + +// Helper function for sqlite3WindowCodeStep(). Each call to this function +// generates VM code for a single RETURN_ROW, AGGSTEP or AGGINVERSE +// operation. Refer to the header comment for sqlite3WindowCodeStep() for +// details. +func windowCodeOp(tls *libc.TLS, p uintptr, op int32, regCountdown int32, jumpOnEof int32) int32 { /* sqlite3.c:157117:12: */ + var csr int32 + var reg int32 + var pParse uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpParse + var pMWin uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpMWin + var ret int32 = 0 + var v uintptr = (*WindowCodeArg)(unsafe.Pointer(p)).FpVdbe + var addrContinue int32 = 0 + var bPeer int32 = (libc.Bool32(int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) != TK_ROWS)) + + var lblDone int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var addrNextRange int32 = 0 + + // Special case - WINDOW_AGGINVERSE is always a no-op if the frame + // starts with UNBOUNDED PRECEDING. + if (op == WINDOW_AGGINVERSE) && (int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_UNBOUNDED) { + + return 0 + } + + if regCountdown > 0 { + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE { + addrNextRange = Xsqlite3VdbeCurrentAddr(tls, v) + + if op == WINDOW_AGGINVERSE { + if int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_FOLLOWING { + windowCodeRangeTest(tls, + p, OP_Le, (*WindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, regCountdown, (*WindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, lblDone) + } else { + windowCodeRangeTest(tls, + p, OP_Ge, (*WindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, regCountdown, (*WindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, lblDone) + } + } else { + windowCodeRangeTest(tls, + p, OP_Gt, (*WindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr, regCountdown, (*WindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr, lblDone) + } + } else { + Xsqlite3VdbeAddOp3(tls, v, OP_IfPos, regCountdown, lblDone, 1) + + } + } + + if (op == WINDOW_RETURN_ROW) && ((*Window)(unsafe.Pointer(pMWin)).FregStartRowid == 0) { + windowAggFinal(tls, p, 0) + } + addrContinue = Xsqlite3VdbeCurrentAddr(tls, v) + + // If this is a (RANGE BETWEEN a FOLLOWING AND b FOLLOWING) or + // (RANGE BETWEEN b PRECEDING AND a PRECEDING) frame, ensure the + // start cursor does not advance past the end cursor within the + // temporary table. It otherwise might, if (a>b). Also ensure that, + // if the input cursor is still finding new rows, that the end + // cursor does not go past it to EOF. + if ((int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == int32((*Window)(unsafe.Pointer(pMWin)).FeEnd)) && (regCountdown != 0)) && + (int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE) { + var regRowid1 int32 = Xsqlite3GetTempReg(tls, pParse) + var regRowid2 int32 = Xsqlite3GetTempReg(tls, pParse) + if op == WINDOW_AGGINVERSE { + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, (*WindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr, regRowid1) + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, (*WindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr, regRowid2) + Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regRowid2, lblDone, regRowid1) + + } else if (*WindowCodeArg)(unsafe.Pointer(p)).FregRowid != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Rowid, (*WindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr, regRowid1) + Xsqlite3VdbeAddOp3(tls, v, OP_Ge, (*WindowCodeArg)(unsafe.Pointer(p)).FregRowid, lblDone, regRowid1) + + } + Xsqlite3ReleaseTempReg(tls, pParse, regRowid1) + Xsqlite3ReleaseTempReg(tls, pParse, regRowid2) + + } + + switch op { + case WINDOW_RETURN_ROW: + csr = (*WindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Fcsr + reg = (*WindowCodeArg)(unsafe.Pointer(p)).Fcurrent.Freg + windowReturnOneRow(tls, p) + break + + case WINDOW_AGGINVERSE: + csr = (*WindowCodeArg)(unsafe.Pointer(p)).Fstart.Fcsr + reg = (*WindowCodeArg)(unsafe.Pointer(p)).Fstart.Freg + if (*Window)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, (*Window)(unsafe.Pointer(pMWin)).FregStartRowid, 1) + } else { + windowAggStep(tls, p, pMWin, csr, 1, (*WindowCodeArg)(unsafe.Pointer(p)).FregArg) + } + break + + default: + + csr = (*WindowCodeArg)(unsafe.Pointer(p)).Fend.Fcsr + reg = (*WindowCodeArg)(unsafe.Pointer(p)).Fend.Freg + if (*Window)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + + Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, (*Window)(unsafe.Pointer(pMWin)).FregEndRowid, 1) + } else { + windowAggStep(tls, p, pMWin, csr, 0, (*WindowCodeArg)(unsafe.Pointer(p)).FregArg) + } + break + } + + if op == (*WindowCodeArg)(unsafe.Pointer(p)).FeDelete { + Xsqlite3VdbeAddOp1(tls, v, OP_Delete, csr) + Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_SAVEPOSITION)) + } + + if jumpOnEof != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Next, csr, (Xsqlite3VdbeCurrentAddr(tls, v) + 2)) + + ret = Xsqlite3VdbeAddOp0(tls, v, OP_Goto) + } else { + Xsqlite3VdbeAddOp2(tls, v, OP_Next, csr, ((Xsqlite3VdbeCurrentAddr(tls, v) + 1) + bPeer)) + + if bPeer != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, lblDone) + } + } + + if bPeer != 0 { + var nReg int32 = func() int32 { + if (*Window)(unsafe.Pointer(pMWin)).FpOrderBy != 0 { + return (*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pMWin)).FpOrderBy)).FnExpr + } + return 0 + }() + var regTmp int32 = func() int32 { + if nReg != 0 { + return Xsqlite3GetTempRange(tls, pParse, nReg) + } + return 0 + }() + windowReadPeerValues(tls, p, csr, regTmp) + windowIfNewPeer(tls, pParse, (*Window)(unsafe.Pointer(pMWin)).FpOrderBy, regTmp, reg, addrContinue) + Xsqlite3ReleaseTempRange(tls, pParse, regTmp, nReg) + } + + if addrNextRange != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrNextRange) + } + Xsqlite3VdbeResolveLabel(tls, v, lblDone) + return ret +} + +// Allocate and return a duplicate of the Window object indicated by the +// third argument. Set the Window.pOwner field of the new object to +// pOwner. +func Xsqlite3WindowDup(tls *libc.TLS, db uintptr, pOwner uintptr, p uintptr) uintptr { /* sqlite3.c:157266:23: */ + var pNew uintptr = uintptr(0) + if p != 0 { + pNew = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Window{}))) + if pNew != 0 { + (*Window)(unsafe.Pointer(pNew)).FzName = Xsqlite3DbStrDup(tls, db, (*Window)(unsafe.Pointer(p)).FzName) + (*Window)(unsafe.Pointer(pNew)).FzBase = Xsqlite3DbStrDup(tls, db, (*Window)(unsafe.Pointer(p)).FzBase) + (*Window)(unsafe.Pointer(pNew)).FpFilter = Xsqlite3ExprDup(tls, db, (*Window)(unsafe.Pointer(p)).FpFilter, 0) + (*Window)(unsafe.Pointer(pNew)).FpFunc = (*Window)(unsafe.Pointer(p)).FpFunc + (*Window)(unsafe.Pointer(pNew)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(p)).FpPartition, 0) + (*Window)(unsafe.Pointer(pNew)).FpOrderBy = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(p)).FpOrderBy, 0) + (*Window)(unsafe.Pointer(pNew)).FeFrmType = (*Window)(unsafe.Pointer(p)).FeFrmType + (*Window)(unsafe.Pointer(pNew)).FeEnd = (*Window)(unsafe.Pointer(p)).FeEnd + (*Window)(unsafe.Pointer(pNew)).FeStart = (*Window)(unsafe.Pointer(p)).FeStart + (*Window)(unsafe.Pointer(pNew)).FeExclude = (*Window)(unsafe.Pointer(p)).FeExclude + (*Window)(unsafe.Pointer(pNew)).FregResult = (*Window)(unsafe.Pointer(p)).FregResult + (*Window)(unsafe.Pointer(pNew)).FregAccum = (*Window)(unsafe.Pointer(p)).FregAccum + (*Window)(unsafe.Pointer(pNew)).FiArgCol = (*Window)(unsafe.Pointer(p)).FiArgCol + (*Window)(unsafe.Pointer(pNew)).FiEphCsr = (*Window)(unsafe.Pointer(p)).FiEphCsr + (*Window)(unsafe.Pointer(pNew)).FbExprArgs = (*Window)(unsafe.Pointer(p)).FbExprArgs + (*Window)(unsafe.Pointer(pNew)).FpStart = Xsqlite3ExprDup(tls, db, (*Window)(unsafe.Pointer(p)).FpStart, 0) + (*Window)(unsafe.Pointer(pNew)).FpEnd = Xsqlite3ExprDup(tls, db, (*Window)(unsafe.Pointer(p)).FpEnd, 0) + (*Window)(unsafe.Pointer(pNew)).FpOwner = pOwner + (*Window)(unsafe.Pointer(pNew)).FbImplicitFrame = (*Window)(unsafe.Pointer(p)).FbImplicitFrame + } + } + return pNew +} + +// Return a copy of the linked list of Window objects passed as the +// second argument. +func Xsqlite3WindowListDup(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:157299:23: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pWin uintptr + *(*uintptr)(unsafe.Pointer(bp /* pRet */)) = uintptr(0) + var pp uintptr = bp /* &pRet */ + + for pWin = p; pWin != 0; pWin = (*Window)(unsafe.Pointer(pWin)).FpNextWin { + *(*uintptr)(unsafe.Pointer(pp)) = Xsqlite3WindowDup(tls, db, uintptr(0), pWin) + if *(*uintptr)(unsafe.Pointer(pp)) == uintptr(0) { + break + } + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 64 /* &.pNextWin */) + } + + return *(*uintptr)(unsafe.Pointer(bp /* pRet */)) +} + +// Return true if it can be determined at compile time that expression +// pExpr evaluates to a value that, when cast to an integer, is greater +// than zero. False otherwise. +// +// If an OOM error occurs, this function sets the Parse.db.mallocFailed +// flag and returns zero. +func windowExprGtZero(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { /* sqlite3.c:157321:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var ret int32 = 0 + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + Xsqlite3ValueFromExpr(tls, db, pExpr, (*Sqlite3)(unsafe.Pointer(db)).Fenc, uint8(SQLITE_AFF_NUMERIC), bp /* &pVal */) + if (*(*uintptr)(unsafe.Pointer(bp /* pVal */)) != 0) && (Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) > 0) { + ret = 1 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + return ret +} + +// sqlite3WhereBegin() has already been called for the SELECT statement +// passed as the second argument when this function is invoked. It generates +// code to populate the Window.regResult register for each window function +// and invoke the sub-routine at instruction addrGosub once for each row. +// sqlite3WhereEnd() is always called before returning. +// +// This function handles several different types of window frames, which +// require slightly different processing. The following pseudo code is +// used to implement window frames of the form: +// +// ROWS BETWEEN PRECEDING AND FOLLOWING +// +// Other window frame types use variants of the following: +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// +// if( first row of partition ){ +// // Rewind three cursors, all open on the eph table. +// Rewind(csrEnd); +// Rewind(csrStart); +// Rewind(csrCurrent); +// +// regEnd = // FOLLOWING expression +// regStart = // PRECEDING expression +// }else{ +// // First time this branch is taken, the eph table contains two +// // rows. The first row in the partition, which all three cursors +// // currently point to, and the following row. +// AGGSTEP +// if( (regEnd--)<=0 ){ +// RETURN_ROW +// if( (regStart--)<=0 ){ +// AGGINVERSE +// } +// } +// } +// } +// flush: +// AGGSTEP +// while( 1 ){ +// RETURN ROW +// if( csrCurrent is EOF ) break; +// if( (regStart--)<=0 ){ +// AggInverse(csrStart) +// Next(csrStart) +// } +// } +// +// The pseudo-code above uses the following shorthand: +// +// AGGSTEP: invoke the aggregate xStep() function for each window function +// with arguments read from the current row of cursor csrEnd, then +// step cursor csrEnd forward one row (i.e. sqlite3BtreeNext()). +// +// RETURN_ROW: return a row to the caller based on the contents of the +// current row of csrCurrent and the current state of all +// aggregates. Then step cursor csrCurrent forward one row. +// +// AGGINVERSE: invoke the aggregate xInverse() function for each window +// functions with arguments read from the current row of cursor +// csrStart. Then step csrStart forward one row. +// +// There are two other ROWS window frames that are handled significantly +// differently from the above - "BETWEEN PRECEDING AND PRECEDING" +// and "BETWEEN FOLLOWING AND FOLLOWING". These are special +// cases because they change the order in which the three cursors (csrStart, +// csrCurrent and csrEnd) iterate through the ephemeral table. Cases that +// use UNBOUNDED or CURRENT ROW are much simpler variations on one of these +// three. +// +// ROWS BETWEEN PRECEDING AND PRECEDING +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = +// }else{ +// if( (regEnd--)<=0 ){ +// AGGSTEP +// } +// RETURN_ROW +// if( (regStart--)<=0 ){ +// AGGINVERSE +// } +// } +// } +// flush: +// if( (regEnd--)<=0 ){ +// AGGSTEP +// } +// RETURN_ROW +// +// +// ROWS BETWEEN FOLLOWING AND FOLLOWING +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = regEnd - +// }else{ +// AGGSTEP +// if( (regEnd--)<=0 ){ +// RETURN_ROW +// } +// if( (regStart--)<=0 ){ +// AGGINVERSE +// } +// } +// } +// flush: +// AGGSTEP +// while( 1 ){ +// if( (regEnd--)<=0 ){ +// RETURN_ROW +// if( eof ) break; +// } +// if( (regStart--)<=0 ){ +// AGGINVERSE +// if( eof ) break +// } +// } +// while( !eof csrCurrent ){ +// RETURN_ROW +// } +// +// For the most part, the patterns above are adapted to support UNBOUNDED by +// assuming that it is equivalent to "infinity PRECEDING/FOLLOWING" and +// CURRENT ROW by assuming that it is equivilent to "0 PRECEDING/FOLLOWING". +// This is optimized of course - branches that will never be taken and +// conditions that are always true are omitted from the VM code. The only +// exceptional case is: +// +// ROWS BETWEEN FOLLOWING AND UNBOUNDED FOLLOWING +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regStart = +// }else{ +// AGGSTEP +// } +// } +// flush: +// AGGSTEP +// while( 1 ){ +// if( (regStart--)<=0 ){ +// AGGINVERSE +// if( eof ) break +// } +// RETURN_ROW +// } +// while( !eof csrCurrent ){ +// RETURN_ROW +// } +// +// Also requiring special handling are the cases: +// +// ROWS BETWEEN PRECEDING AND PRECEDING +// ROWS BETWEEN FOLLOWING AND FOLLOWING +// +// when (expr1 < expr2). This is detected at runtime, not by this function. +// To handle this case, the pseudo-code programs depicted above are modified +// slightly to be: +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = +// if( regEnd < regStart ){ +// RETURN_ROW +// delete eph table contents +// continue +// } +// ... +// +// The new "continue" statement in the above jumps to the next iteration +// of the outer loop - the one started by sqlite3WhereBegin(). +// +// The various GROUPS cases are implemented using the same patterns as +// ROWS. The VM code is modified slightly so that: +// +// 1. The else branch in the main loop is only taken if the row just +// added to the ephemeral table is the start of a new group. In +// other words, it becomes: +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = +// }else if( new group ){ +// ... +// } +// } +// +// 2. Instead of processing a single row, each RETURN_ROW, AGGSTEP or +// AGGINVERSE step processes the current row of the relevant cursor and +// all subsequent rows belonging to the same group. +// +// RANGE window frames are a little different again. As for GROUPS, the +// main loop runs once per group only. And RETURN_ROW, AGGSTEP and AGGINVERSE +// deal in groups instead of rows. As for ROWS and GROUPS, there are three +// basic cases: +// +// RANGE BETWEEN PRECEDING AND FOLLOWING +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = +// }else{ +// AGGSTEP +// while( (csrCurrent.key + regEnd) < csrEnd.key ){ +// RETURN_ROW +// while( csrStart.key + regStart) < csrCurrent.key ){ +// AGGINVERSE +// } +// } +// } +// } +// flush: +// AGGSTEP +// while( 1 ){ +// RETURN ROW +// if( csrCurrent is EOF ) break; +// while( csrStart.key + regStart) < csrCurrent.key ){ +// AGGINVERSE +// } +// } +// } +// +// In the above notation, "csr.key" means the current value of the ORDER BY +// expression (there is only ever 1 for a RANGE that uses an FOLLOWING +// or PRECEDING AND PRECEDING +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = +// }else{ +// while( (csrEnd.key + regEnd) <= csrCurrent.key ){ +// AGGSTEP +// } +// while( (csrStart.key + regStart) < csrCurrent.key ){ +// AGGINVERSE +// } +// RETURN_ROW +// } +// } +// flush: +// while( (csrEnd.key + regEnd) <= csrCurrent.key ){ +// AGGSTEP +// } +// while( (csrStart.key + regStart) < csrCurrent.key ){ +// AGGINVERSE +// } +// RETURN_ROW +// +// RANGE BETWEEN FOLLOWING AND FOLLOWING +// +// ... loop started by sqlite3WhereBegin() ... +// if( new partition ){ +// Gosub flush +// } +// Insert new row into eph table. +// if( first row of partition ){ +// Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) +// regEnd = +// regStart = +// }else{ +// AGGSTEP +// while( (csrCurrent.key + regEnd) < csrEnd.key ){ +// while( (csrCurrent.key + regStart) > csrStart.key ){ +// AGGINVERSE +// } +// RETURN_ROW +// } +// } +// } +// flush: +// AGGSTEP +// while( 1 ){ +// while( (csrCurrent.key + regStart) > csrStart.key ){ +// AGGINVERSE +// if( eof ) break "while( 1 )" loop. +// } +// RETURN_ROW +// } +// while( !eof csrCurrent ){ +// RETURN_ROW +// } +// +// The text above leaves out many details. Refer to the code and comments +// below for a more complete picture. +func Xsqlite3WindowCodeStep(tls *libc.TLS, pParse uintptr, p uintptr, pWInfo uintptr, regGosub int32, addrGosub int32) { /* sqlite3.c:157668:21: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var pMWin uintptr = (*Select)(unsafe.Pointer(p)).FpWin + var pOrderBy uintptr = (*Window)(unsafe.Pointer(pMWin)).FpOrderBy + var v uintptr = Xsqlite3GetVdbe(tls, pParse) + var csrWrite int32 // Cursor used to write to eph. table + var csrInput int32 = (*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FiCursor // Cursor of sub-select + var nInput int32 = int32((*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(((*Select)(unsafe.Pointer(p)).FpSrc + 8 /* &.a */))).FpTab)).FnCol) // Number of cols returned by sub + var iInput int32 // To iterate through sub cols + var addrNe int32 // Address of OP_Ne + var addrGosubFlush int32 = 0 // Address of OP_Gosub to flush: + var addrInteger int32 = 0 // Address of OP_Integer + var addrEmpty int32 // Address of OP_Rewind in flush: + var regNew int32 // Array of registers holding new input row + var regRecord int32 // regNew array in record form + var regNewPeer int32 = 0 // Peer values for new row (part of regNew) + var regPeer int32 = 0 // Peer values for current row + var regFlushPart int32 = 0 // Register for "Gosub flush_partition" + // var s WindowCodeArg at bp, 72 + // Context object for sub-routines + var lblWhereEnd int32 // Label just before sqlite3WhereEnd() code + var regStart int32 = 0 // Value of PRECEDING + var regEnd int32 = 0 // Value of FOLLOWING + + lblWhereEnd = Xsqlite3VdbeMakeLabel(tls, pParse) + + // Fill in the context object + libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(WindowCodeArg{}))) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FpParse = pParse + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FpMWin = pMWin + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FpVdbe = v + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregGosub = regGosub + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FaddrGosub = addrGosub + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr = (*Window)(unsafe.Pointer(pMWin)).FiEphCsr + csrWrite = ((*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr + 1) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fstart.Fcsr = ((*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr + 2) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fend.Fcsr = ((*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr + 3) + + // Figure out when rows may be deleted from the ephemeral table. There + // are four options - they may never be deleted (eDelete==0), they may + // be deleted as soon as they are no longer part of the window frame + // (eDelete==WINDOW_AGGINVERSE), they may be deleted as after the row + // has been returned to the caller (WINDOW_RETURN_ROW), or they may + // be deleted after they enter the frame (WINDOW_AGGSTEP). + switch int32((*Window)(unsafe.Pointer(pMWin)).FeStart) { + case TK_FOLLOWING: + if (int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) != TK_RANGE) && + (windowExprGtZero(tls, pParse, (*Window)(unsafe.Pointer(pMWin)).FpStart) != 0) { + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FeDelete = WINDOW_RETURN_ROW + } + break + case TK_UNBOUNDED: + if windowCacheFrame(tls, pMWin) == 0 { + if int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) == TK_PRECEDING { + if (int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) != TK_RANGE) && + (windowExprGtZero(tls, pParse, (*Window)(unsafe.Pointer(pMWin)).FpEnd) != 0) { + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FeDelete = WINDOW_AGGSTEP + } + } else { + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FeDelete = WINDOW_RETURN_ROW + } + } + break + default: + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FeDelete = WINDOW_AGGINVERSE + break + } + + // Allocate registers for the array of values from the sub-query, the + // samve values in record form, and the rowid used to insert said record + // into the ephemeral table. + regNew = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nInput) + regRecord = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregRowid = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + + // If the window frame contains an " PRECEDING" or " FOLLOWING" + // clause, allocate registers to store the results of evaluating each + // . + if (int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_PRECEDING) || (int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_FOLLOWING) { + regStart = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + if (int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) == TK_PRECEDING) || (int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) == TK_FOLLOWING) { + regEnd = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + } + + // If this is not a "ROWS BETWEEN ..." frame, then allocate arrays of + // registers to store copies of the ORDER BY expressions (peer values) + // for the main loop, and for each cursor (start, current and end). + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) != TK_ROWS { + var nPeer int32 = func() int32 { + if pOrderBy != 0 { + return (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr + } + return 0 + }() + regNewPeer = (regNew + (*Window)(unsafe.Pointer(pMWin)).FnBufferCol) + if (*Window)(unsafe.Pointer(pMWin)).FpPartition != 0 { + regNewPeer = regNewPeer + ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pMWin)).FpPartition)).FnExpr) + } + regPeer = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nPeer) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fstart.Freg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nPeer) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Freg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nPeer) + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fend.Freg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) + *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nPeer) + } + + // Load the column values for the row returned by the sub-select + // into an array of registers starting at regNew. Assemble them into + // a record in register regRecord. + for iInput = 0; iInput < nInput; iInput++ { + Xsqlite3VdbeAddOp3(tls, v, OP_Column, csrInput, iInput, (regNew + iInput)) + } + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regNew, nInput, regRecord) + + // An input row has just been read into an array of registers starting + // at regNew. If the window has a PARTITION clause, this block generates + // VM code to check if the input row is the start of a new partition. + // If so, it does an OP_Gosub to an address to be filled in later. The + // address of the OP_Gosub is stored in local variable addrGosubFlush. + if (*Window)(unsafe.Pointer(pMWin)).FpPartition != 0 { + var addr int32 + var pPart uintptr = (*Window)(unsafe.Pointer(pMWin)).FpPartition + var nPart int32 = (*ExprList)(unsafe.Pointer(pPart)).FnExpr + var regNewPart int32 = (regNew + (*Window)(unsafe.Pointer(pMWin)).FnBufferCol) + var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, pPart, 0, 0) + + regFlushPart = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) + addr = Xsqlite3VdbeAddOp3(tls, v, OP_Compare, regNewPart, (*Window)(unsafe.Pointer(pMWin)).FregPart, nPart) + Xsqlite3VdbeAppendP4(tls, v, pKeyInfo, -9) + Xsqlite3VdbeAddOp3(tls, v, OP_Jump, (addr + 2), (addr + 4), (addr + 2)) + + addrGosubFlush = Xsqlite3VdbeAddOp1(tls, v, OP_Gosub, regFlushPart) + + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regNewPart, (*Window)(unsafe.Pointer(pMWin)).FregPart, (nPart - 1)) + } + + // Insert the new row into the ephemeral table + Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, csrWrite, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregRowid) + Xsqlite3VdbeAddOp3(tls, v, OP_Insert, csrWrite, regRecord, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregRowid) + addrNe = Xsqlite3VdbeAddOp3(tls, v, OP_Ne, (*Window)(unsafe.Pointer(pMWin)).FregOne, 0, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregRowid) + + // This block is run for the first row of each partition + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregArg = windowInitAccum(tls, pParse, pMWin) + + if regStart != 0 { + Xsqlite3ExprCode(tls, pParse, (*Window)(unsafe.Pointer(pMWin)).FpStart, regStart) + windowCheckValue(tls, pParse, regStart, (0 + (func() int32 { + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE { + return 3 + } + return 0 + }()))) + } + if regEnd != 0 { + Xsqlite3ExprCode(tls, pParse, (*Window)(unsafe.Pointer(pMWin)).FpEnd, regEnd) + windowCheckValue(tls, pParse, regEnd, (1 + (func() int32 { + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE { + return 3 + } + return 0 + }()))) + } + + if ((int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) != TK_RANGE) && (int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == int32((*Window)(unsafe.Pointer(pMWin)).FeEnd))) && (regStart != 0) { + var op int32 = func() int32 { + if int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_FOLLOWING { + return OP_Ge + } + return OP_Le + }() + var addrGe int32 = Xsqlite3VdbeAddOp3(tls, v, op, regStart, 0, regEnd) + // NeverNull because bound + // values previously checked + windowAggFinal(tls, bp /* &s */, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr, 1) + + windowReturnOneRow(tls, bp /* &s */) + Xsqlite3VdbeAddOp1(tls, v, OP_ResetSorter, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr) + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, lblWhereEnd) + Xsqlite3VdbeJumpHere(tls, v, addrGe) + } + if ((int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_FOLLOWING) && (int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) != TK_RANGE)) && (regEnd != 0) { + + Xsqlite3VdbeAddOp3(tls, v, OP_Subtract, regStart, regEnd, regStart) + } + + if int32((*Window)(unsafe.Pointer(pMWin)).FeStart) != TK_UNBOUNDED { + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fstart.Fcsr, 1) + + } + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr, 1) + + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fend.Fcsr, 1) + + if (regPeer != 0) && (pOrderBy != 0) { + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regNewPeer, regPeer, ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr - 1)) + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regPeer, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fstart.Freg, ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr - 1)) + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regPeer, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Freg, ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr - 1)) + Xsqlite3VdbeAddOp3(tls, v, OP_Copy, regPeer, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fend.Freg, ((*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr - 1)) + } + + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, lblWhereEnd) + + Xsqlite3VdbeJumpHere(tls, v, addrNe) + + // Beginning of the block executed for the second and subsequent rows. + if regPeer != 0 { + windowIfNewPeer(tls, pParse, pOrderBy, regNewPeer, regPeer, lblWhereEnd) + } + if int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_FOLLOWING { + windowCodeOp(tls, bp /* &s */, WINDOW_AGGSTEP, 0, 0) + if int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) != TK_UNBOUNDED { + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE { + var lbl int32 = Xsqlite3VdbeMakeLabel(tls, pParse) + var addrNext int32 = Xsqlite3VdbeCurrentAddr(tls, v) + windowCodeRangeTest(tls, bp /* &s */, OP_Ge, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr, regEnd, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fend.Fcsr, lbl) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrNext) + Xsqlite3VdbeResolveLabel(tls, v, lbl) + } else { + windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, regEnd, 0) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + } + } + } else if int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) == TK_PRECEDING { + var bRPS int32 = (libc.Bool32((int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_PRECEDING) && (int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE))) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGSTEP, regEnd, 0) + if bRPS != 0 { + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + } + windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 0) + if !(bRPS != 0) { + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + } + } else { + var addr int32 = 0 + windowCodeOp(tls, bp /* &s */, WINDOW_AGGSTEP, 0, 0) + if int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) != TK_UNBOUNDED { + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE { + var lbl int32 = 0 + addr = Xsqlite3VdbeCurrentAddr(tls, v) + if regEnd != 0 { + lbl = Xsqlite3VdbeMakeLabel(tls, pParse) + windowCodeRangeTest(tls, bp /* &s */, OP_Ge, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr, regEnd, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fend.Fcsr, lbl) + } + windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 0) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + if regEnd != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addr) + Xsqlite3VdbeResolveLabel(tls, v, lbl) + } + } else { + if regEnd != 0 { + addr = Xsqlite3VdbeAddOp3(tls, v, OP_IfPos, regEnd, 0, 1) + + } + windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 0) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + if regEnd != 0 { + Xsqlite3VdbeJumpHere(tls, v, addr) + } + } + } + } + + // End of the main input loop + Xsqlite3VdbeResolveLabel(tls, v, lblWhereEnd) + Xsqlite3WhereEnd(tls, pWInfo) + + // Fall through + if (*Window)(unsafe.Pointer(pMWin)).FpPartition != 0 { + addrInteger = Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regFlushPart) + Xsqlite3VdbeJumpHere(tls, v, addrGosubFlush) + } + + (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).FregRowid = 0 + addrEmpty = Xsqlite3VdbeAddOp1(tls, v, OP_Rewind, csrWrite) + + if int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) == TK_PRECEDING { + var bRPS int32 = (libc.Bool32((int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_PRECEDING) && (int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE))) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGSTEP, regEnd, 0) + if bRPS != 0 { + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + } + windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 0) + } else if int32((*Window)(unsafe.Pointer(pMWin)).FeStart) == TK_FOLLOWING { + var addrStart int32 + var addrBreak1 int32 + var addrBreak2 int32 + var addrBreak3 int32 + windowCodeOp(tls, bp /* &s */, WINDOW_AGGSTEP, 0, 0) + if int32((*Window)(unsafe.Pointer(pMWin)).FeFrmType) == TK_RANGE { + addrStart = Xsqlite3VdbeCurrentAddr(tls, v) + addrBreak2 = windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 1) + addrBreak1 = windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 1) + } else if int32((*Window)(unsafe.Pointer(pMWin)).FeEnd) == TK_UNBOUNDED { + addrStart = Xsqlite3VdbeCurrentAddr(tls, v) + addrBreak1 = windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, regStart, 1) + addrBreak2 = windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, 0, 1) + } else { + + addrStart = Xsqlite3VdbeCurrentAddr(tls, v) + addrBreak1 = windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, regEnd, 1) + addrBreak2 = windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 1) + } + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrStart) + Xsqlite3VdbeJumpHere(tls, v, addrBreak2) + addrStart = Xsqlite3VdbeCurrentAddr(tls, v) + addrBreak3 = windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrStart) + Xsqlite3VdbeJumpHere(tls, v, addrBreak1) + Xsqlite3VdbeJumpHere(tls, v, addrBreak3) + } else { + var addrBreak int32 + var addrStart int32 + windowCodeOp(tls, bp /* &s */, WINDOW_AGGSTEP, 0, 0) + addrStart = Xsqlite3VdbeCurrentAddr(tls, v) + addrBreak = windowCodeOp(tls, bp /* &s */, WINDOW_RETURN_ROW, 0, 1) + windowCodeOp(tls, bp /* &s */, WINDOW_AGGINVERSE, regStart, 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, addrStart) + Xsqlite3VdbeJumpHere(tls, v, addrBreak) + } + Xsqlite3VdbeJumpHere(tls, v, addrEmpty) + + Xsqlite3VdbeAddOp1(tls, v, OP_ResetSorter, (*WindowCodeArg)(unsafe.Pointer(bp /* &s */)).Fcurrent.Fcsr) + if (*Window)(unsafe.Pointer(pMWin)).FpPartition != 0 { + if (*Window)(unsafe.Pointer(pMWin)).FregStartRowid != 0 { + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, (*Window)(unsafe.Pointer(pMWin)).FregStartRowid) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*Window)(unsafe.Pointer(pMWin)).FregEndRowid) + } + Xsqlite3VdbeChangeP1(tls, v, addrInteger, Xsqlite3VdbeCurrentAddr(tls, v)) + Xsqlite3VdbeAddOp1(tls, v, OP_Return, regFlushPart) + } +} + +//************* End of window.c ********************************************* +//************* Begin file parse.c ****************************************** +// This file is automatically generated by Lemon from input grammar +// source file "parse.y". +// 2001-09-15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file contains SQLite's SQL parser. +// +// The canonical source code to this file ("parse.y") is a Lemon grammar +// file that specifies the input grammar and actions to take while parsing. +// That input file is processed by Lemon to generate a C-language +// implementation of a parser for the given grammer. You might be reading +// this comment as part of the translated C-code. Edits should be made +// to the original parse.y sources. + +// #include "sqliteInt.h" + +// Disable all error recovery processing in the parser push-down +// automaton. + +// Make yytestcase() the same as testcase() + +// Indicate that sqlite3ParserFree() will never be called with a null +// pointer. + +// In the amalgamation, the parse.c file generated by lemon and the +// tokenize.c file are concatenated. In that case, sqlite3RunParser() +// has access to the the size of the yyParser object and so the parser +// engine can be allocated from stack. In that case, only the +// sqlite3ParserInit() and sqlite3ParserFinalize() routines are invoked +// and the sqlite3ParserAlloc() and sqlite3ParserFree() routines can be +// omitted. + +// Alternative datatype for the argument to the malloc() routine passed +// into sqlite3ParserAlloc(). The default is size_t. + +// An instance of the following structure describes the event of a +// TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, +// TK_DELETE, or TK_INSTEAD. If the event is of the form +// +// UPDATE ON (a,b,c) +// +// Then the "b" IdList records the list "a,b,c". +type TrigEvent = struct { + Fa int32 + _ [4]byte + Fb uintptr +} /* sqlite3.c:158068:1 */ + +type FrameBound = struct { + FeType int32 + _ [4]byte + FpExpr uintptr +} /* sqlite3.c:158070:1 */ + +// Disable lookaside memory allocation for objects that might be +// shared across database connections. +func disableLookaside(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:158076:13: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + (*Parse)(unsafe.Pointer(pParse)).FdisableLookaside++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) +} + +// For a compound SELECT statement, make sure p->pPrior->pNext==p for +// all elements in the list. And make sure list length does not exceed +// SQLITE_LIMIT_COMPOUND_SELECT. +func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:158109:15: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Select)(unsafe.Pointer(p)).FpPrior != 0 { + var pNext uintptr = uintptr(0) + var pLoop uintptr = p + var mxSelect int32 + var cnt int32 = 1 + for 1 != 0 { + (*Select)(unsafe.Pointer(pLoop)).FpNext = pNext + *(*U32)(unsafe.Pointer(pLoop + 4 /* &.selFlags */)) |= (U32(SF_Compound)) + pNext = pLoop + pLoop = (*Select)(unsafe.Pointer(pLoop)).FpPrior + if pLoop == uintptr(0) { + break + } + cnt++ + if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+21098, /* "%s clause should..." */ + libc.VaList(bp, func() uintptr { + if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { + return ts + 18212 /* "ORDER BY" */ + } + return ts + 21140 /* "LIMIT" */ + }(), + Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) + break + } + } + if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { + Xsqlite3ErrorMsg(tls, pParse, ts+21146 /* "too many terms i..." */, 0) + } + } + +} + +// Attach a With object describing the WITH clause to a Select +// object describing the query for which the WITH clause is a prefix. +func attachWithToSelect(tls *libc.TLS, pParse uintptr, pSelect uintptr, pWith uintptr) uintptr { /* sqlite3.c:158140:17: */ + if pSelect != 0 { + (*Select)(unsafe.Pointer(pSelect)).FpWith = pWith + parserDoubleLinkSelect(tls, pParse, pSelect) + } else { + Xsqlite3WithDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWith) + } + return pSelect + +} + +// Construct a new Expr object from a single identifier. Use the +// new Expr to populate pOut. Set the span of pOut to be the identifier +// that created the expression. +func tokenExpr(tls *libc.TLS, pParse uintptr, op int32, t Token) uintptr { /* sqlite3.c:158155:15: */ + bp := tls.Alloc(16) + defer tls.Free(16) + *(*Token)(unsafe.Pointer(bp)) = t + + var p uintptr = Xsqlite3DbMallocRawNN(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (uint64((uint64(unsafe.Sizeof(Expr{})) + uint64((*Token)(unsafe.Pointer(bp /* &t */)).Fn)) + uint64(1)))) + if p != 0 { + // memset(p, 0, sizeof(Expr)); + (*Expr)(unsafe.Pointer(p)).Fop = U8(op) + (*Expr)(unsafe.Pointer(p)).FaffExpr = int8(0) + (*Expr)(unsafe.Pointer(p)).Fflags = U32(EP_Leaf) + + (*Expr)(unsafe.Pointer(p)).FiAgg = int16(-1) + (*Expr)(unsafe.Pointer(p)).FpLeft = libc.AssignPtrUintptr(p+24 /* &.pRight */, uintptr(0)) + *(*uintptr)(unsafe.Pointer(p + 32 /* &.x */)) = uintptr(0) + (*Expr)(unsafe.Pointer(p)).FpAggInfo = uintptr(0) + *(*uintptr)(unsafe.Pointer(p + 64 /* &.y */)) = uintptr(0) + (*Expr)(unsafe.Pointer(p)).Fop2 = U8(0) + (*Expr)(unsafe.Pointer(p)).FiTable = 0 + (*Expr)(unsafe.Pointer(p)).FiColumn = int16(0) + *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) = (p + 1*72) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)), (*Token)(unsafe.Pointer(bp /* &t */)).Fz, uint64((*Token)(unsafe.Pointer(bp /* &t */)).Fn)) + *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) + uintptr((*Token)(unsafe.Pointer(bp /* &t */)).Fn))) = int8(0) + if (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)))))]) & 0x80) != 0 { + Xsqlite3DequoteExpr(tls, p) + } + (*Expr)(unsafe.Pointer(p)).FnHeight = 1 + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + return Xsqlite3RenameTokenMap(tls, pParse, p, bp /* &t */) + } + } + return p + +} + +// A routine to convert a binary TK_IS or TK_ISNOT expression into a +// unary TK_ISNULL or TK_NOTNULL expression. +func binaryToUnaryIfNull(tls *libc.TLS, pParse uintptr, pY uintptr, pA uintptr, op int32) { /* sqlite3.c:158190:15: */ + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb + if (((pA != 0) && (pY != 0)) && (int32((*Expr)(unsafe.Pointer(pY)).Fop) == TK_NULL)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + (*Expr)(unsafe.Pointer(pA)).Fop = U8(op) + Xsqlite3ExprDelete(tls, db, (*Expr)(unsafe.Pointer(pA)).FpRight) + (*Expr)(unsafe.Pointer(pA)).FpRight = uintptr(0) + } + +} + +// Add a single new term to an ExprList that is used to store a +// list of identifiers. Report an error if the ID list contains +// a COLLATE clause or an ASC or DESC keyword, except ignore the +// error while parsing a legacy schema. +func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdToken uintptr, hasCollate int32, sortOrder int32) uintptr { /* sqlite3.c:158204:19: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) + if ((hasCollate != 0) || (sortOrder != -1)) && + (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { + Xsqlite3ErrorMsg(tls, pParse, ts+21180, /* "syntax error aft..." */ + libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) + } + Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) + return p + +} + +//*************** End of %include directives ********************************* +// These constants specify the various numeric values for terminal symbols. +// Begin token definitions ************************************ +//*************** End token definitions ************************************** + +// The next sections is a series of control #defines. +// various aspects of the generated parser. +// YYCODETYPE is the data type used to store the integer codes +// that represent terminal and non-terminal symbols. +// "unsigned char" is used if there are fewer than +// 256 symbols. Larger types otherwise. +// YYNOCODE is a number of type YYCODETYPE that is not used for +// any terminal or nonterminal symbol. +// YYFALLBACK If defined, this indicates that one or more tokens +// (also known as: "terminal symbols") have fall-back +// values which should be used if the original symbol +// would not parse. This permits keywords to sometimes +// be used as identifiers, for example. +// YYACTIONTYPE is the data type used for "action codes" - numbers +// that indicate what to do in response to the next +// token. +// sqlite3ParserTOKENTYPE is the data type used for minor type for terminal +// symbols. Background: A "minor type" is a semantic +// value associated with a terminal or non-terminal +// symbols. For example, for an "ID" terminal symbol, +// the minor type might be the name of the identifier. +// Each non-terminal can have a different minor type. +// Terminal symbols all have the same minor type, though. +// This macros defines the minor type for terminal +// symbols. +// YYMINORTYPE is the data type used for all minor types. +// This is typically a union of many types, one of +// which is sqlite3ParserTOKENTYPE. The entry in the union +// for terminal symbols is called "yy0". +// YYSTACKDEPTH is the maximum depth of the parser's stack. If +// zero the stack is dynamically sized using realloc() +// sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument +// sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument +// sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter +// sqlite3ParserARG_STORE Code to store %extra_argument into yypParser +// sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser +// sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context +// YYERRORSYMBOL is the code number of the error symbol. If not +// defined, then do no error processing. +// YYNSTATE the combined number of states. +// YYNRULE the number of rules in the grammar +// YYNTOKEN Number of terminal symbols +// YY_MAX_SHIFT Maximum value for shift actions +// YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +// YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +// YY_ERROR_ACTION The yy_action[] code for syntax error +// YY_ACCEPT_ACTION The yy_action[] code for accept +// YY_NO_ACTION The yy_action[] code for no-op +// YY_MIN_REDUCE Minimum value for reduce actions +// YY_MAX_REDUCE Maximum value for reduce actions +//************ Begin control #defines **************************************** +type YYMINORTYPE = struct { + _ [0]uint64 + Fyyinit int32 + _ [12]byte +} /* sqlite3.c:158494:3 */ +//************ End control #defines ****************************************** + +// Define the yytestcase() macro to be a no-op if is not already defined +// otherwise. +// +// Applications can choose to define yytestcase() in the %include section +// to a macro that can assist in verifying code coverage. For production +// code the yytestcase() macro should be turned off. But it is useful +// for testing. + +// Next are the tables used to determine what action to take based on the +// current state and lookahead token. These tables are used to implement +// functions that take a state number and lookahead value and return an +// action integer. +// +// Suppose the action integer is N. Then the action is determined as +// follows +// +// 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +// token onto the stack and goto state N. +// +// N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +// and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +// +// N == YY_ERROR_ACTION A syntax error has occurred. +// +// N == YY_ACCEPT_ACTION The parser accepts its input. +// +// N == YY_NO_ACTION No such action. Denotes unused +// slots in the yy_action[] table. +// +// N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +// and YY_MAX_REDUCE +// +// The action table is constructed as a single large table named yy_action[]. +// Given state S and lookahead X, the action is computed as either: +// +// (A) N = yy_action[ yy_shift_ofst[S] + X ] +// (B) N = yy_default[S] +// +// The (A) formula is preferred. The B formula is used instead if +// yy_lookahead[yy_shift_ofst[S]+X] is not equal to X. +// +// The formulas above are for computing the action when the lookahead is +// a terminal symbol. If the lookahead is a non-terminal (as occurs after +// a reduce action) then the yy_reduce_ofst[] array is used in place of +// the yy_shift_ofst[] array. +// +// The following are the tables generated in this section: +// +// yy_action[] A single table containing all actions. +// yy_lookahead[] A table containing the lookahead for each entry in +// yy_action. Used to detect hash collisions. +// yy_shift_ofst[] For each state, the offset into yy_action for +// shifting terminals. +// yy_reduce_ofst[] For each state, the offset into yy_action for +// shifting non-terminals after a reduce. +// yy_default[] Default action for each state. +// +// Begin parsing tables ********************************************* +var yy_action = [2023]uint16{ + /* 0 */ uint16(563), uint16(1295), uint16(563), uint16(1274), uint16(168), uint16(1257), uint16(115), uint16(112), uint16(218), uint16(373), + /* 10 */ uint16(563), uint16(1295), uint16(374), uint16(563), uint16(488), uint16(563), uint16(115), uint16(112), uint16(218), uint16(406), + /* 20 */ uint16(1300), uint16(1300), uint16(41), uint16(41), uint16(41), uint16(41), uint16(514), uint16(1504), uint16(520), uint16(1298), + /* 30 */ uint16(1298), uint16(959), uint16(41), uint16(41), uint16(1260), uint16(71), uint16(71), uint16(51), uint16(51), uint16(960), + /* 40 */ uint16(557), uint16(557), uint16(557), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), + /* 50 */ uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(414), uint16(406), + /* 60 */ uint16(273), uint16(273), uint16(273), uint16(273), uint16(115), uint16(112), uint16(218), uint16(115), uint16(112), uint16(218), + /* 70 */ uint16(197), uint16(268), uint16(545), uint16(560), uint16(515), uint16(560), uint16(211), uint16(563), uint16(385), uint16(248), + /* 80 */ uint16(215), uint16(521), uint16(399), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), + /* 90 */ uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(540), uint16(13), + /* 100 */ uint16(13), uint16(1259), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), + /* 110 */ uint16(117), uint16(116), uint16(441), uint16(1176), uint16(419), uint16(197), uint16(446), uint16(320), uint16(512), uint16(1539), + /* 120 */ uint16(1545), uint16(372), uint16(1547), uint16(6), uint16(371), uint16(1176), uint16(1148), uint16(394), uint16(1148), uint16(406), + /* 130 */ uint16(1545), uint16(534), uint16(115), uint16(112), uint16(218), uint16(1415), uint16(99), uint16(30), uint16(121), uint16(121), + /* 140 */ uint16(121), uint16(121), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), + /* 150 */ uint16(117), uint16(116), uint16(441), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), + /* 160 */ uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(31), uint16(1176), + /* 170 */ uint16(1177), uint16(1178), uint16(241), uint16(357), uint16(1558), uint16(501), uint16(498), uint16(497), uint16(317), uint16(124), + /* 180 */ uint16(319), uint16(1176), uint16(1177), uint16(1178), uint16(1176), uint16(496), uint16(119), uint16(119), uint16(119), uint16(119), + /* 190 */ uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(139), uint16(96), uint16(406), + /* 200 */ uint16(121), uint16(121), uint16(121), uint16(121), uint16(114), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), + /* 210 */ uint16(541), uint16(1532), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), + /* 220 */ uint16(117), uint16(116), uint16(441), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), + /* 230 */ uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(406), uint16(441), + /* 240 */ uint16(1176), uint16(1177), uint16(1178), uint16(81), uint16(439), uint16(439), uint16(439), uint16(80), uint16(119), uint16(119), + /* 250 */ uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(488), + /* 260 */ uint16(1176), uint16(318), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), + /* 270 */ uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(493), uint16(1025), uint16(1025), + /* 280 */ uint16(1036), uint16(1039), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), + /* 290 */ uint16(117), uint16(116), uint16(441), uint16(1584), uint16(995), uint16(1224), uint16(1), uint16(1), uint16(569), uint16(2), + /* 300 */ uint16(1228), uint16(1267), uint16(137), uint16(1503), uint16(245), uint16(305), uint16(473), uint16(140), uint16(406), uint16(860), + /* 310 */ uint16(561), uint16(1176), uint16(914), uint16(914), uint16(1308), uint16(359), uint16(1176), uint16(1177), uint16(1178), uint16(462), + /* 320 */ uint16(330), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), + /* 330 */ uint16(116), uint16(441), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), + /* 340 */ uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(328), uint16(273), uint16(273), + /* 350 */ uint16(1015), uint16(83), uint16(1029), uint16(425), uint16(1564), uint16(569), uint16(2), uint16(1228), uint16(304), uint16(554), + /* 360 */ uint16(925), uint16(560), uint16(305), uint16(944), uint16(140), uint16(860), uint16(1006), uint16(1176), uint16(1177), uint16(1178), + /* 370 */ uint16(1005), uint16(1308), uint16(411), uint16(213), uint16(511), uint16(229), uint16(119), uint16(119), uint16(119), uint16(119), + /* 380 */ uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(519), uint16(347), uint16(116), + /* 390 */ uint16(441), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), + /* 400 */ uint16(116), uint16(441), uint16(1005), uint16(1005), uint16(1007), uint16(273), uint16(273), uint16(445), uint16(563), uint16(16), + /* 410 */ uint16(16), uint16(1590), uint16(563), uint16(1540), uint16(563), uint16(406), uint16(1176), uint16(6), uint16(560), uint16(344), + /* 420 */ uint16(182), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(416), uint16(142), + /* 430 */ uint16(71), uint16(71), uint16(229), uint16(563), uint16(71), uint16(71), uint16(55), uint16(55), uint16(203), uint16(122), + /* 440 */ uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), uint16(120), + /* 450 */ uint16(121), uint16(121), uint16(121), uint16(121), uint16(217), uint16(13), uint16(13), uint16(1176), uint16(406), uint16(568), + /* 460 */ uint16(1400), uint16(1228), uint16(502), uint16(137), uint16(445), uint16(168), uint16(305), uint16(545), uint16(140), uint16(1180), + /* 470 */ uint16(424), uint16(545), uint16(1176), uint16(1177), uint16(1178), uint16(1308), uint16(544), uint16(438), uint16(437), uint16(944), + /* 480 */ uint16(513), uint16(452), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), + /* 490 */ uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(315), uint16(119), uint16(119), + /* 500 */ uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(273), + /* 510 */ uint16(273), uint16(1143), uint16(416), uint16(1176), uint16(1177), uint16(1178), uint16(543), uint16(563), uint16(1143), uint16(304), + /* 520 */ uint16(554), uint16(1561), uint16(560), uint16(1207), uint16(1143), uint16(1207), uint16(1180), uint16(1143), uint16(406), uint16(530), + /* 530 */ uint16(421), uint16(1143), uint16(864), uint16(183), uint16(1143), uint16(143), uint16(229), uint16(562), uint16(32), uint16(71), + /* 540 */ uint16(71), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), + /* 550 */ uint16(116), uint16(441), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), + /* 560 */ uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(406), uint16(445), uint16(241), + /* 570 */ uint16(1176), uint16(857), uint16(501), uint16(498), uint16(497), uint16(1176), uint16(526), uint16(189), uint16(245), uint16(538), + /* 580 */ uint16(1539), uint16(282), uint16(496), uint16(370), uint16(6), uint16(563), uint16(529), uint16(477), uint16(5), uint16(279), + /* 590 */ uint16(1015), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), + /* 600 */ uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(1006), uint16(13), uint16(13), uint16(1414), + /* 610 */ uint16(1005), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), + /* 620 */ uint16(116), uint16(441), uint16(426), uint16(273), uint16(273), uint16(1176), uint16(1176), uint16(1177), uint16(1178), uint16(1619), + /* 630 */ uint16(392), uint16(1176), uint16(1177), uint16(1178), uint16(1176), uint16(342), uint16(560), uint16(406), uint16(525), uint16(361), + /* 640 */ uint16(430), uint16(1161), uint16(1005), uint16(1005), uint16(1007), uint16(348), uint16(411), uint16(357), uint16(1558), uint16(488), + /* 650 */ uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), + /* 660 */ uint16(441), uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), + /* 670 */ uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(406), uint16(830), uint16(831), uint16(832), + /* 680 */ uint16(1016), uint16(1176), uint16(1177), uint16(1178), uint16(396), uint16(285), uint16(148), uint16(1312), uint16(304), uint16(554), + /* 690 */ uint16(1176), uint16(1177), uint16(1178), uint16(1467), uint16(216), uint16(3), uint16(337), uint16(137), uint16(340), uint16(560), + /* 700 */ uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), + /* 710 */ uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(563), uint16(504), uint16(946), uint16(273), uint16(273), + /* 720 */ uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), + /* 730 */ uint16(441), uint16(560), uint16(1176), uint16(427), uint16(563), uint16(451), uint16(98), uint16(13), uint16(13), uint16(259), + /* 740 */ uint16(276), uint16(356), uint16(507), uint16(351), uint16(506), uint16(246), uint16(406), uint16(361), uint16(469), uint16(1530), + /* 750 */ uint16(1000), uint16(347), uint16(293), uint16(304), uint16(554), uint16(1589), uint16(71), uint16(71), uint16(889), uint16(119), + /* 760 */ uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), + /* 770 */ uint16(122), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), + /* 780 */ uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(406), uint16(1143), uint16(1078), uint16(1176), uint16(1177), + /* 790 */ uint16(1178), uint16(416), uint16(1080), uint16(300), uint16(150), uint16(995), uint16(1080), uint16(361), uint16(361), uint16(1143), + /* 800 */ uint16(361), uint16(378), uint16(1143), uint16(477), uint16(563), uint16(244), uint16(243), uint16(242), uint16(1278), uint16(122), + /* 810 */ uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), uint16(120), + /* 820 */ uint16(121), uint16(121), uint16(121), uint16(121), uint16(563), uint16(880), uint16(13), uint16(13), uint16(483), uint16(119), + /* 830 */ uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), + /* 840 */ uint16(1176), uint16(191), uint16(540), uint16(563), uint16(147), uint16(149), uint16(13), uint16(13), uint16(328), uint16(457), + /* 850 */ uint16(316), uint16(1083), uint16(1083), uint16(485), uint16(1537), uint16(406), uint16(505), uint16(1530), uint16(6), uint16(1514), + /* 860 */ uint16(284), uint16(192), uint16(1277), uint16(145), uint16(881), uint16(71), uint16(71), uint16(488), uint16(119), uint16(119), + /* 870 */ uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(122), + /* 880 */ uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), uint16(120), + /* 890 */ uint16(121), uint16(121), uint16(121), uint16(121), uint16(563), uint16(471), uint16(1176), uint16(1177), uint16(1178), uint16(406), + /* 900 */ uint16(852), uint16(327), uint16(301), uint16(462), uint16(330), uint16(1516), uint16(270), uint16(1530), uint16(1530), uint16(944), + /* 910 */ uint16(1531), uint16(1307), uint16(313), uint16(9), uint16(842), uint16(251), uint16(71), uint16(71), uint16(477), uint16(428), + /* 920 */ uint16(146), uint16(488), uint16(38), uint16(945), uint16(101), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), + /* 930 */ uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(119), uint16(119), + /* 940 */ uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(563), + /* 950 */ uint16(1197), uint16(1099), uint16(563), uint16(436), uint16(563), uint16(1533), uint16(563), uint16(852), uint16(1122), uint16(1617), + /* 960 */ uint16(454), uint16(290), uint16(1617), uint16(546), uint16(251), uint16(1303), uint16(1100), uint16(267), uint16(267), uint16(281), + /* 970 */ uint16(404), uint16(70), uint16(70), uint16(460), uint16(71), uint16(71), uint16(71), uint16(71), uint16(13), uint16(13), + /* 980 */ uint16(560), uint16(1101), uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), + /* 990 */ uint16(117), uint16(116), uint16(441), uint16(542), uint16(104), uint16(273), uint16(273), uint16(273), uint16(273), uint16(1197), + /* 1000 */ uint16(217), uint16(1468), uint16(900), uint16(471), uint16(450), uint16(563), uint16(1473), uint16(1197), uint16(560), uint16(447), + /* 1010 */ uint16(560), uint16(545), uint16(901), uint16(440), uint16(406), uint16(1058), uint16(292), uint16(274), uint16(274), uint16(198), + /* 1020 */ uint16(547), uint16(450), uint16(449), uint16(1473), uint16(1475), uint16(944), uint16(455), uint16(56), uint16(56), uint16(410), + /* 1030 */ uint16(560), uint16(1122), uint16(1618), uint16(379), uint16(406), uint16(1618), uint16(404), uint16(1120), uint16(122), uint16(123), + /* 1040 */ uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), + /* 1050 */ uint16(121), uint16(121), uint16(121), uint16(1460), uint16(406), uint16(12), uint16(1197), uint16(1512), uint16(122), uint16(123), + /* 1060 */ uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), + /* 1070 */ uint16(121), uint16(121), uint16(121), uint16(308), uint16(471), uint16(126), uint16(359), uint16(286), uint16(122), uint16(111), + /* 1080 */ uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), uint16(120), uint16(120), uint16(121), + /* 1090 */ uint16(121), uint16(121), uint16(121), uint16(309), uint16(450), uint16(471), uint16(1473), uint16(119), uint16(119), uint16(119), + /* 1100 */ uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(1176), uint16(563), + /* 1110 */ uint16(1120), uint16(482), uint16(563), uint16(312), uint16(433), uint16(479), uint16(197), uint16(119), uint16(119), uint16(119), + /* 1120 */ uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(405), uint16(12), + /* 1130 */ uint16(536), uint16(15), uint16(15), uint16(478), uint16(43), uint16(43), uint16(509), uint16(119), uint16(119), uint16(119), + /* 1140 */ uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), uint16(441), uint16(289), uint16(535), + /* 1150 */ uint16(294), uint16(563), uint16(294), uint16(391), uint16(1220), uint16(438), uint16(437), uint16(406), uint16(1154), uint16(403), + /* 1160 */ uint16(402), uint16(1400), uint16(920), uint16(1204), uint16(1176), uint16(1177), uint16(1178), uint16(919), uint16(1206), uint16(291), + /* 1170 */ uint16(1306), uint16(1249), uint16(412), uint16(57), uint16(57), uint16(488), uint16(1205), uint16(563), uint16(556), uint16(412), + /* 1180 */ uint16(1176), uint16(1344), uint16(123), uint16(113), uint16(1200), uint16(1200), uint16(1035), uint16(1038), uint16(1028), uint16(1028), + /* 1190 */ uint16(120), uint16(120), uint16(121), uint16(121), uint16(121), uint16(121), uint16(1400), uint16(1143), uint16(563), uint16(44), + /* 1200 */ uint16(44), uint16(1207), uint16(194), uint16(1207), uint16(273), uint16(273), uint16(1400), uint16(461), uint16(537), uint16(1154), + /* 1210 */ uint16(1143), uint16(108), uint16(555), uint16(1143), uint16(4), uint16(391), uint16(1121), uint16(560), uint16(1538), uint16(335), + /* 1220 */ uint16(58), uint16(58), uint16(6), uint16(1246), uint16(1099), uint16(380), uint16(1400), uint16(376), uint16(558), uint16(1536), + /* 1230 */ uint16(563), uint16(422), uint16(1221), uint16(6), uint16(304), uint16(554), uint16(1176), uint16(1177), uint16(1178), uint16(1100), + /* 1240 */ uint16(119), uint16(119), uint16(119), uint16(119), uint16(118), uint16(118), uint16(117), uint16(117), uint16(117), uint16(116), + /* 1250 */ uint16(441), uint16(442), uint16(59), uint16(59), uint16(1101), uint16(516), uint16(1535), uint16(273), uint16(273), uint16(563), + /* 1260 */ uint16(6), uint16(563), uint16(110), uint16(552), uint16(563), uint16(528), uint16(423), uint16(413), uint16(169), uint16(548), + /* 1270 */ uint16(560), uint16(108), uint16(555), uint16(137), uint16(4), uint16(551), uint16(484), uint16(272), uint16(215), uint16(222), + /* 1280 */ uint16(211), uint16(60), uint16(60), uint16(61), uint16(61), uint16(98), uint16(62), uint16(62), uint16(558), uint16(273), + /* 1290 */ uint16(273), uint16(563), uint16(1015), uint16(467), uint16(1221), uint16(563), uint16(434), uint16(563), uint16(106), uint16(106), + /* 1300 */ uint16(8), uint16(920), uint16(560), uint16(273), uint16(273), uint16(107), uint16(919), uint16(442), uint16(565), uint16(564), + /* 1310 */ uint16(563), uint16(442), uint16(1005), uint16(45), uint16(45), uint16(464), uint16(560), uint16(46), uint16(46), uint16(47), + /* 1320 */ uint16(47), uint16(84), uint16(202), uint16(552), uint16(1215), uint16(404), uint16(468), uint16(563), uint16(205), uint16(304), + /* 1330 */ uint16(554), uint16(563), uint16(49), uint16(49), uint16(563), uint16(522), uint16(404), uint16(532), uint16(563), uint16(867), + /* 1340 */ uint16(563), uint16(105), uint16(531), uint16(103), uint16(1005), uint16(1005), uint16(1007), uint16(1008), uint16(27), uint16(50), + /* 1350 */ uint16(50), uint16(563), uint16(1015), uint16(63), uint16(63), uint16(475), uint16(64), uint16(64), uint16(106), uint16(106), + /* 1360 */ uint16(65), uint16(65), uint16(14), uint16(14), uint16(17), uint16(107), uint16(563), uint16(442), uint16(565), uint16(564), + /* 1370 */ uint16(563), uint16(303), uint16(1005), uint16(66), uint16(66), uint16(563), uint16(226), uint16(563), uint16(959), uint16(563), + /* 1380 */ uint16(543), uint16(404), uint16(1196), uint16(1343), uint16(871), uint16(278), uint16(960), uint16(456), uint16(128), uint16(128), + /* 1390 */ uint16(563), uint16(1065), uint16(67), uint16(67), uint16(563), uint16(206), uint16(867), uint16(52), uint16(52), uint16(68), + /* 1400 */ uint16(68), uint16(69), uint16(69), uint16(417), uint16(1005), uint16(1005), uint16(1007), uint16(1008), uint16(27), uint16(1563), + /* 1410 */ uint16(1165), uint16(444), uint16(53), uint16(53), uint16(277), uint16(1519), uint16(156), uint16(156), uint16(307), uint16(389), + /* 1420 */ uint16(389), uint16(388), uint16(262), uint16(386), uint16(1165), uint16(444), uint16(839), uint16(321), uint16(277), uint16(108), + /* 1430 */ uint16(555), uint16(523), uint16(4), uint16(389), uint16(389), uint16(388), uint16(262), uint16(386), uint16(563), uint16(223), + /* 1440 */ uint16(839), uint16(311), uint16(326), uint16(1492), uint16(1117), uint16(98), uint16(558), uint16(393), uint16(1065), uint16(310), + /* 1450 */ uint16(563), uint16(476), uint16(563), uint16(223), uint16(563), uint16(311), uint16(879), uint16(878), uint16(1009), uint16(277), + /* 1460 */ uint16(157), uint16(157), uint16(463), uint16(310), uint16(389), uint16(389), uint16(388), uint16(262), uint16(386), uint16(442), + /* 1470 */ uint16(518), uint16(839), uint16(76), uint16(76), uint16(54), uint16(54), uint16(72), uint16(72), uint16(355), uint16(225), + /* 1480 */ uint16(563), uint16(552), uint16(275), uint16(563), uint16(223), uint16(325), uint16(311), uint16(161), uint16(354), uint16(465), + /* 1490 */ uint16(135), uint16(563), uint16(228), uint16(225), uint16(310), uint16(532), uint16(563), uint16(206), uint16(886), uint16(887), + /* 1500 */ uint16(533), uint16(161), uint16(129), uint16(129), uint16(135), uint16(73), uint16(73), uint16(224), uint16(962), uint16(963), + /* 1510 */ uint16(1015), uint16(563), uint16(287), uint16(130), uint16(130), uint16(1009), uint16(106), uint16(106), uint16(131), uint16(131), + /* 1520 */ uint16(563), uint16(224), uint16(563), uint16(107), uint16(225), uint16(442), uint16(565), uint16(564), uint16(997), uint16(1276), + /* 1530 */ uint16(1005), uint16(250), uint16(161), uint16(127), uint16(127), uint16(135), uint16(108), uint16(555), uint16(1077), uint16(4), + /* 1540 */ uint16(1077), uint16(407), uint16(155), uint16(155), uint16(154), uint16(154), uint16(304), uint16(554), uint16(1126), uint16(563), + /* 1550 */ uint16(1331), uint16(563), uint16(224), uint16(558), uint16(470), uint16(407), uint16(563), uint16(250), uint16(563), uint16(1491), + /* 1560 */ uint16(304), uint16(554), uint16(1005), uint16(1005), uint16(1007), uint16(1008), uint16(27), uint16(563), uint16(480), uint16(332), + /* 1570 */ uint16(448), uint16(136), uint16(136), uint16(134), uint16(134), uint16(1340), uint16(442), uint16(336), uint16(132), uint16(132), + /* 1580 */ uint16(133), uint16(133), uint16(563), uint16(1076), uint16(448), uint16(1076), uint16(407), uint16(563), uint16(552), uint16(75), + /* 1590 */ uint16(75), uint16(304), uint16(554), uint16(339), uint16(341), uint16(343), uint16(108), uint16(555), uint16(563), uint16(4), + /* 1600 */ uint16(1577), uint16(299), uint16(532), uint16(563), uint16(77), uint16(77), uint16(1291), uint16(531), uint16(472), uint16(74), + /* 1610 */ uint16(74), uint16(250), uint16(1275), uint16(558), uint16(350), uint16(448), uint16(331), uint16(1015), uint16(360), uint16(98), + /* 1620 */ uint16(42), uint16(42), uint16(1352), uint16(106), uint16(106), uint16(48), uint16(48), uint16(1399), uint16(494), uint16(1327), + /* 1630 */ uint16(107), uint16(247), uint16(442), uint16(565), uint16(564), uint16(345), uint16(442), uint16(1005), uint16(98), uint16(1061), + /* 1640 */ uint16(953), uint16(917), uint16(247), uint16(250), uint16(110), uint16(1552), uint16(550), uint16(850), uint16(552), uint16(918), + /* 1650 */ uint16(144), uint16(1338), uint16(110), uint16(549), uint16(1405), uint16(1256), uint16(1248), uint16(1237), uint16(1236), uint16(1238), + /* 1660 */ uint16(1571), uint16(1324), uint16(208), uint16(390), uint16(489), uint16(265), uint16(363), uint16(200), uint16(365), uint16(1005), + /* 1670 */ uint16(1005), uint16(1007), uint16(1008), uint16(27), uint16(11), uint16(280), uint16(221), uint16(1015), uint16(323), uint16(474), + /* 1680 */ uint16(1274), uint16(367), uint16(212), uint16(106), uint16(106), uint16(924), uint16(1386), uint16(324), uint16(288), uint16(1381), + /* 1690 */ uint16(107), uint16(453), uint16(442), uint16(565), uint16(564), uint16(283), uint16(329), uint16(1005), uint16(1391), uint16(499), + /* 1700 */ uint16(353), uint16(1374), uint16(1464), uint16(108), uint16(555), uint16(1463), uint16(4), uint16(1574), uint16(1390), uint16(397), + /* 1710 */ uint16(1215), uint16(171), uint16(254), uint16(369), uint16(383), uint16(207), uint16(195), uint16(196), uint16(1511), uint16(553), + /* 1720 */ uint16(558), uint16(1509), uint16(415), uint16(1212), uint16(100), uint16(555), uint16(83), uint16(4), uint16(204), uint16(1005), + /* 1730 */ uint16(1005), uint16(1007), uint16(1008), uint16(27), uint16(180), uint16(166), uint16(173), uint16(219), uint16(79), uint16(82), + /* 1740 */ uint16(458), uint16(558), uint16(175), uint16(442), uint16(35), uint16(1387), uint16(176), uint16(459), uint16(177), uint16(178), + /* 1750 */ uint16(492), uint16(231), uint16(96), uint16(1469), uint16(395), uint16(552), uint16(1393), uint16(1392), uint16(36), uint16(466), + /* 1760 */ uint16(1395), uint16(184), uint16(398), uint16(481), uint16(442), uint16(1458), uint16(235), uint16(89), uint16(1480), uint16(487), + /* 1770 */ uint16(266), uint16(334), uint16(237), uint16(188), uint16(490), uint16(400), uint16(552), uint16(338), uint16(238), uint16(508), + /* 1780 */ uint16(1239), uint16(239), uint16(1294), uint16(1293), uint16(1015), uint16(1292), uint16(1285), uint16(429), uint16(91), uint16(871), + /* 1790 */ uint16(106), uint16(106), uint16(1588), uint16(213), uint16(401), uint16(1587), uint16(431), uint16(107), uint16(1264), uint16(442), + /* 1800 */ uint16(565), uint16(564), uint16(1263), uint16(352), uint16(1005), uint16(1015), uint16(1262), uint16(1586), uint16(1557), uint16(517), + /* 1810 */ uint16(432), uint16(106), uint16(106), uint16(1284), uint16(297), uint16(298), uint16(358), uint16(524), uint16(107), uint16(1335), + /* 1820 */ uint16(442), uint16(565), uint16(564), uint16(95), uint16(1336), uint16(1005), uint16(252), uint16(253), uint16(435), uint16(125), + /* 1830 */ uint16(543), uint16(1543), uint16(10), uint16(1444), uint16(377), uint16(1542), uint16(1005), uint16(1005), uint16(1007), uint16(1008), + /* 1840 */ uint16(27), uint16(97), uint16(527), uint16(375), uint16(362), uint16(102), uint16(260), uint16(364), uint16(381), uint16(1317), + /* 1850 */ uint16(382), uint16(1334), uint16(366), uint16(1245), uint16(1333), uint16(1316), uint16(368), uint16(1005), uint16(1005), uint16(1007), + /* 1860 */ uint16(1008), uint16(27), uint16(1359), uint16(1358), uint16(34), uint16(199), uint16(1171), uint16(566), uint16(261), uint16(263), + /* 1870 */ uint16(264), uint16(567), uint16(1234), uint16(158), uint16(1229), uint16(141), uint16(295), uint16(159), uint16(1496), uint16(302), + /* 1880 */ uint16(1497), uint16(1495), uint16(1494), uint16(160), uint16(826), uint16(209), uint16(443), uint16(201), uint16(306), uint16(210), + /* 1890 */ uint16(78), uint16(220), uint16(1075), uint16(138), uint16(1073), uint16(314), uint16(162), uint16(172), uint16(1196), uint16(227), + /* 1900 */ uint16(174), uint16(903), uint16(322), uint16(230), uint16(1089), uint16(179), uint16(163), uint16(164), uint16(418), uint16(408), + /* 1910 */ uint16(409), uint16(170), uint16(181), uint16(85), uint16(86), uint16(420), uint16(87), uint16(165), uint16(1092), uint16(88), + /* 1920 */ uint16(233), uint16(232), uint16(1088), uint16(151), uint16(18), uint16(234), uint16(1081), uint16(250), uint16(333), uint16(1209), + /* 1930 */ uint16(185), uint16(486), uint16(236), uint16(186), uint16(37), uint16(841), uint16(491), uint16(354), uint16(240), uint16(346), + /* 1940 */ uint16(495), uint16(187), uint16(90), uint16(869), uint16(19), uint16(20), uint16(500), uint16(503), uint16(349), uint16(92), + /* 1950 */ uint16(167), uint16(152), uint16(296), uint16(882), uint16(93), uint16(510), uint16(94), uint16(1159), uint16(153), uint16(1041), + /* 1960 */ uint16(1128), uint16(39), uint16(214), uint16(269), uint16(1127), uint16(271), uint16(249), uint16(952), uint16(190), uint16(947), + /* 1970 */ uint16(110), uint16(1149), uint16(21), uint16(7), uint16(1153), uint16(22), uint16(1145), uint16(23), uint16(1147), uint16(24), + /* 1980 */ uint16(1133), uint16(25), uint16(1152), uint16(33), uint16(539), uint16(193), uint16(26), uint16(1056), uint16(98), uint16(1042), + /* 1990 */ uint16(1040), uint16(1044), uint16(1098), uint16(1045), uint16(1097), uint16(256), uint16(255), uint16(28), uint16(40), uint16(257), + /* 2000 */ uint16(1010), uint16(851), uint16(109), uint16(29), uint16(913), uint16(559), uint16(384), uint16(387), uint16(258), uint16(1167), + /* 2010 */ uint16(1166), uint16(1225), uint16(1225), uint16(1225), uint16(1579), uint16(1225), uint16(1225), uint16(1225), uint16(1225), uint16(1225), + /* 2020 */ uint16(1225), uint16(1225), uint16(1578), +} /* sqlite3.c:158588:27 */ +var yy_lookahead = [2207]uint16{ + /* 0 */ uint16(192), uint16(221), uint16(192), uint16(223), uint16(192), uint16(214), uint16(272), uint16(273), uint16(274), uint16(217), + /* 10 */ uint16(192), uint16(231), uint16(217), uint16(192), uint16(192), uint16(192), uint16(272), uint16(273), uint16(274), uint16(19), + /* 20 */ uint16(233), uint16(234), uint16(214), uint16(215), uint16(214), uint16(215), uint16(203), uint16(293), uint16(203), uint16(233), + /* 30 */ uint16(234), uint16(31), uint16(214), uint16(215), uint16(214), uint16(214), uint16(215), uint16(214), uint16(215), uint16(39), + /* 40 */ uint16(208), uint16(209), uint16(210), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), + /* 50 */ uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(236), uint16(19), + /* 60 */ uint16(237), uint16(238), uint16(237), uint16(238), uint16(272), uint16(273), uint16(274), uint16(272), uint16(273), uint16(274), + /* 70 */ uint16(192), uint16(211), uint16(251), uint16(250), uint16(251), uint16(250), uint16(26), uint16(192), uint16(200), uint16(254), + /* 80 */ uint16(255), uint16(260), uint16(204), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), + /* 90 */ uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(192), uint16(214), + /* 100 */ uint16(215), uint16(214), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), + /* 110 */ uint16(110), uint16(111), uint16(112), uint16(59), uint16(229), uint16(192), uint16(294), uint16(16), uint16(306), uint16(307), + /* 120 */ uint16(312), uint16(313), uint16(312), uint16(311), uint16(314), uint16(59), uint16(86), uint16(204), uint16(88), uint16(19), + /* 130 */ uint16(312), uint16(313), uint16(272), uint16(273), uint16(274), uint16(271), uint16(26), uint16(22), uint16(54), uint16(55), + /* 140 */ uint16(56), uint16(57), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), + /* 150 */ uint16(110), uint16(111), uint16(112), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), + /* 160 */ uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(53), uint16(115), + /* 170 */ uint16(116), uint16(117), uint16(118), uint16(309), uint16(310), uint16(121), uint16(122), uint16(123), uint16(77), uint16(69), + /* 180 */ uint16(79), uint16(115), uint16(116), uint16(117), uint16(59), uint16(131), uint16(102), uint16(103), uint16(104), uint16(105), + /* 190 */ uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(72), uint16(148), uint16(19), + /* 200 */ uint16(54), uint16(55), uint16(56), uint16(57), uint16(58), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), + /* 210 */ uint16(304), uint16(305), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), + /* 220 */ uint16(110), uint16(111), uint16(112), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), + /* 230 */ uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(19), uint16(112), + /* 240 */ uint16(115), uint16(116), uint16(117), uint16(24), uint16(208), uint16(209), uint16(210), uint16(67), uint16(102), uint16(103), + /* 250 */ uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(192), + /* 260 */ uint16(59), uint16(160), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), + /* 270 */ uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(19), uint16(46), uint16(47), + /* 280 */ uint16(48), uint16(49), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), + /* 290 */ uint16(110), uint16(111), uint16(112), uint16(213), uint16(73), uint16(184), uint16(185), uint16(186), uint16(187), uint16(188), + /* 300 */ uint16(189), uint16(221), uint16(81), uint16(236), uint16(46), uint16(194), uint16(192), uint16(196), uint16(19), uint16(59), + /* 310 */ uint16(133), uint16(59), uint16(135), uint16(136), uint16(203), uint16(192), uint16(115), uint16(116), uint16(117), uint16(127), + /* 320 */ uint16(128), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), + /* 330 */ uint16(111), uint16(112), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), + /* 340 */ uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(126), uint16(237), uint16(238), + /* 350 */ uint16(100), uint16(150), uint16(120), uint16(230), uint16(186), uint16(187), uint16(188), uint16(189), uint16(137), uint16(138), + /* 360 */ uint16(108), uint16(250), uint16(194), uint16(26), uint16(196), uint16(115), uint16(116), uint16(115), uint16(116), uint16(117), + /* 370 */ uint16(120), uint16(203), uint16(114), uint16(164), uint16(165), uint16(264), uint16(102), uint16(103), uint16(104), uint16(105), + /* 380 */ uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(192), uint16(130), uint16(111), + /* 390 */ uint16(112), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), + /* 400 */ uint16(111), uint16(112), uint16(152), uint16(153), uint16(154), uint16(237), uint16(238), uint16(296), uint16(192), uint16(214), + /* 410 */ uint16(215), uint16(228), uint16(192), uint16(307), uint16(192), uint16(19), uint16(59), uint16(311), uint16(250), uint16(23), + /* 420 */ uint16(22), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(192), uint16(72), + /* 430 */ uint16(214), uint16(215), uint16(264), uint16(192), uint16(214), uint16(215), uint16(214), uint16(215), uint16(149), uint16(43), + /* 440 */ uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), uint16(53), + /* 450 */ uint16(54), uint16(55), uint16(56), uint16(57), uint16(117), uint16(214), uint16(215), uint16(59), uint16(19), uint16(187), + /* 460 */ uint16(192), uint16(189), uint16(23), uint16(81), uint16(296), uint16(192), uint16(194), uint16(251), uint16(196), uint16(59), + /* 470 */ uint16(229), uint16(251), uint16(115), uint16(116), uint16(117), uint16(203), uint16(260), uint16(106), uint16(107), uint16(142), + /* 480 */ uint16(260), uint16(267), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), + /* 490 */ uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(261), uint16(102), uint16(103), + /* 500 */ uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(237), + /* 510 */ uint16(238), uint16(76), uint16(192), uint16(115), uint16(116), uint16(117), uint16(144), uint16(192), uint16(76), uint16(137), + /* 520 */ uint16(138), uint16(192), uint16(250), uint16(152), uint16(89), uint16(154), uint16(116), uint16(92), uint16(19), uint16(87), + /* 530 */ uint16(262), uint16(89), uint16(23), uint16(22), uint16(92), uint16(163), uint16(264), uint16(192), uint16(22), uint16(214), + /* 540 */ uint16(215), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), + /* 550 */ uint16(111), uint16(112), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), + /* 560 */ uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(19), uint16(296), uint16(118), + /* 570 */ uint16(59), uint16(23), uint16(121), uint16(122), uint16(123), uint16(59), uint16(251), uint16(26), uint16(46), uint16(306), + /* 580 */ uint16(307), uint16(261), uint16(131), uint16(192), uint16(311), uint16(192), uint16(144), uint16(192), uint16(22), uint16(203), + /* 590 */ uint16(100), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), + /* 600 */ uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(116), uint16(214), uint16(215), uint16(271), + /* 610 */ uint16(120), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), + /* 620 */ uint16(111), uint16(112), uint16(229), uint16(237), uint16(238), uint16(59), uint16(115), uint16(116), uint16(117), uint16(299), + /* 630 */ uint16(300), uint16(115), uint16(116), uint16(117), uint16(59), uint16(16), uint16(250), uint16(19), uint16(192), uint16(192), + /* 640 */ uint16(19), uint16(23), uint16(152), uint16(153), uint16(154), uint16(24), uint16(114), uint16(309), uint16(310), uint16(192), + /* 650 */ uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), + /* 660 */ uint16(112), uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), + /* 670 */ uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(19), uint16(7), uint16(8), uint16(9), + /* 680 */ uint16(23), uint16(115), uint16(116), uint16(117), uint16(203), uint16(290), uint16(239), uint16(238), uint16(137), uint16(138), + /* 690 */ uint16(115), uint16(116), uint16(117), uint16(236), uint16(192), uint16(22), uint16(77), uint16(81), uint16(79), uint16(250), + /* 700 */ uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), + /* 710 */ uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(192), uint16(95), uint16(142), uint16(237), uint16(238), + /* 720 */ uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), + /* 730 */ uint16(112), uint16(250), uint16(59), uint16(112), uint16(192), uint16(119), uint16(26), uint16(214), uint16(215), uint16(118), + /* 740 */ uint16(119), uint16(120), uint16(121), uint16(122), uint16(123), uint16(124), uint16(19), uint16(192), uint16(267), uint16(302), + /* 750 */ uint16(23), uint16(130), uint16(229), uint16(137), uint16(138), uint16(23), uint16(214), uint16(215), uint16(26), uint16(102), + /* 760 */ uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), + /* 770 */ uint16(43), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), + /* 780 */ uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(19), uint16(76), uint16(11), uint16(115), uint16(116), + /* 790 */ uint16(117), uint16(192), uint16(29), uint16(251), uint16(239), uint16(73), uint16(33), uint16(192), uint16(192), uint16(89), + /* 800 */ uint16(192), uint16(192), uint16(92), uint16(192), uint16(192), uint16(126), uint16(127), uint16(128), uint16(224), uint16(43), + /* 810 */ uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), uint16(53), + /* 820 */ uint16(54), uint16(55), uint16(56), uint16(57), uint16(192), uint16(35), uint16(214), uint16(215), uint16(65), uint16(102), + /* 830 */ uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), + /* 840 */ uint16(59), uint16(229), uint16(192), uint16(192), uint16(239), uint16(239), uint16(214), uint16(215), uint16(126), uint16(127), + /* 850 */ uint16(128), uint16(126), uint16(127), uint16(128), uint16(307), uint16(19), uint16(66), uint16(302), uint16(311), uint16(192), + /* 860 */ uint16(261), uint16(229), uint16(224), uint16(22), uint16(74), uint16(214), uint16(215), uint16(192), uint16(102), uint16(103), + /* 870 */ uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(43), + /* 880 */ uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), uint16(53), + /* 890 */ uint16(54), uint16(55), uint16(56), uint16(57), uint16(192), uint16(192), uint16(115), uint16(116), uint16(117), uint16(19), + /* 900 */ uint16(59), uint16(290), uint16(251), uint16(127), uint16(128), uint16(192), uint16(23), uint16(302), uint16(302), uint16(26), + /* 910 */ uint16(302), uint16(236), uint16(192), uint16(22), uint16(21), uint16(24), uint16(214), uint16(215), uint16(192), uint16(129), + /* 920 */ uint16(22), uint16(192), uint16(24), uint16(142), uint16(158), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), + /* 930 */ uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(102), uint16(103), + /* 940 */ uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(192), + /* 950 */ uint16(59), uint16(12), uint16(192), uint16(251), uint16(192), uint16(305), uint16(192), uint16(116), uint16(22), uint16(23), + /* 960 */ uint16(242), uint16(203), uint16(26), uint16(203), uint16(24), uint16(236), uint16(27), uint16(237), uint16(238), uint16(266), + /* 970 */ uint16(252), uint16(214), uint16(215), uint16(80), uint16(214), uint16(215), uint16(214), uint16(215), uint16(214), uint16(215), + /* 980 */ uint16(250), uint16(42), uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), + /* 990 */ uint16(110), uint16(111), uint16(112), uint16(229), uint16(158), uint16(237), uint16(238), uint16(237), uint16(238), uint16(59), + /* 1000 */ uint16(117), uint16(281), uint16(63), uint16(192), uint16(192), uint16(192), uint16(192), uint16(116), uint16(250), uint16(192), + /* 1010 */ uint16(250), uint16(251), uint16(73), uint16(251), uint16(19), uint16(122), uint16(290), uint16(237), uint16(238), uint16(24), + /* 1020 */ uint16(260), uint16(209), uint16(210), uint16(209), uint16(210), uint16(142), uint16(242), uint16(214), uint16(215), uint16(197), + /* 1030 */ uint16(250), uint16(22), uint16(23), uint16(276), uint16(19), uint16(26), uint16(252), uint16(101), uint16(43), uint16(44), + /* 1040 */ uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), + /* 1050 */ uint16(55), uint16(56), uint16(57), uint16(160), uint16(19), uint16(211), uint16(116), uint16(192), uint16(43), uint16(44), + /* 1060 */ uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), + /* 1070 */ uint16(55), uint16(56), uint16(57), uint16(192), uint16(192), uint16(22), uint16(192), uint16(266), uint16(43), uint16(44), + /* 1080 */ uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), uint16(52), uint16(53), uint16(54), + /* 1090 */ uint16(55), uint16(56), uint16(57), uint16(192), uint16(282), uint16(192), uint16(282), uint16(102), uint16(103), uint16(104), + /* 1100 */ uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(59), uint16(192), + /* 1110 */ uint16(101), uint16(279), uint16(192), uint16(192), uint16(230), uint16(283), uint16(192), uint16(102), uint16(103), uint16(104), + /* 1120 */ uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(204), uint16(211), + /* 1130 */ uint16(66), uint16(214), uint16(215), uint16(289), uint16(214), uint16(215), uint16(108), uint16(102), uint16(103), uint16(104), + /* 1140 */ uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), uint16(112), uint16(266), uint16(85), + /* 1150 */ uint16(226), uint16(192), uint16(228), uint16(22), uint16(23), uint16(106), uint16(107), uint16(19), uint16(94), uint16(106), + /* 1160 */ uint16(107), uint16(192), uint16(134), uint16(114), uint16(115), uint16(116), uint16(117), uint16(139), uint16(119), uint16(266), + /* 1170 */ uint16(203), uint16(206), uint16(207), uint16(214), uint16(215), uint16(192), uint16(127), uint16(192), uint16(206), uint16(207), + /* 1180 */ uint16(59), uint16(192), uint16(44), uint16(45), uint16(46), uint16(47), uint16(48), uint16(49), uint16(50), uint16(51), + /* 1190 */ uint16(52), uint16(53), uint16(54), uint16(55), uint16(56), uint16(57), uint16(192), uint16(76), uint16(192), uint16(214), + /* 1200 */ uint16(215), uint16(152), uint16(284), uint16(154), uint16(237), uint16(238), uint16(192), uint16(289), uint16(87), uint16(145), + /* 1210 */ uint16(89), uint16(19), uint16(20), uint16(92), uint16(22), uint16(22), uint16(23), uint16(250), uint16(307), uint16(236), + /* 1220 */ uint16(214), uint16(215), uint16(311), uint16(203), uint16(12), uint16(247), uint16(192), uint16(249), uint16(36), uint16(307), + /* 1230 */ uint16(192), uint16(262), uint16(101), uint16(311), uint16(137), uint16(138), uint16(115), uint16(116), uint16(117), uint16(27), + /* 1240 */ uint16(102), uint16(103), uint16(104), uint16(105), uint16(106), uint16(107), uint16(108), uint16(109), uint16(110), uint16(111), + /* 1250 */ uint16(112), uint16(59), uint16(214), uint16(215), uint16(42), uint16(203), uint16(307), uint16(237), uint16(238), uint16(192), + /* 1260 */ uint16(311), uint16(192), uint16(26), uint16(71), uint16(192), uint16(144), uint16(262), uint16(297), uint16(298), uint16(203), + /* 1270 */ uint16(250), uint16(19), uint16(20), uint16(81), uint16(22), uint16(63), uint16(262), uint16(254), uint16(255), uint16(15), + /* 1280 */ uint16(26), uint16(214), uint16(215), uint16(214), uint16(215), uint16(26), uint16(214), uint16(215), uint16(36), uint16(237), + /* 1290 */ uint16(238), uint16(192), uint16(100), uint16(114), uint16(101), uint16(192), uint16(262), uint16(192), uint16(106), uint16(107), + /* 1300 */ uint16(48), uint16(134), uint16(250), uint16(237), uint16(238), uint16(113), uint16(139), uint16(115), uint16(116), uint16(117), + /* 1310 */ uint16(192), uint16(59), uint16(120), uint16(214), uint16(215), uint16(242), uint16(250), uint16(214), uint16(215), uint16(214), + /* 1320 */ uint16(215), uint16(148), uint16(149), uint16(71), uint16(60), uint16(252), uint16(242), uint16(192), uint16(149), uint16(137), + /* 1330 */ uint16(138), uint16(192), uint16(214), uint16(215), uint16(192), uint16(19), uint16(252), uint16(85), uint16(192), uint16(59), + /* 1340 */ uint16(192), uint16(157), uint16(90), uint16(159), uint16(152), uint16(153), uint16(154), uint16(155), uint16(156), uint16(214), + /* 1350 */ uint16(215), uint16(192), uint16(100), uint16(214), uint16(215), uint16(19), uint16(214), uint16(215), uint16(106), uint16(107), + /* 1360 */ uint16(214), uint16(215), uint16(214), uint16(215), uint16(22), uint16(113), uint16(192), uint16(115), uint16(116), uint16(117), + /* 1370 */ uint16(192), uint16(242), uint16(120), uint16(214), uint16(215), uint16(192), uint16(24), uint16(192), uint16(31), uint16(192), + /* 1380 */ uint16(144), uint16(252), uint16(26), uint16(192), uint16(125), uint16(99), uint16(39), uint16(192), uint16(214), uint16(215), + /* 1390 */ uint16(192), uint16(59), uint16(214), uint16(215), uint16(192), uint16(141), uint16(116), uint16(214), uint16(215), uint16(214), + /* 1400 */ uint16(215), uint16(214), uint16(215), uint16(61), uint16(152), uint16(153), uint16(154), uint16(155), uint16(156), uint16(0), + /* 1410 */ uint16(1), uint16(2), uint16(214), uint16(215), uint16(5), uint16(192), uint16(214), uint16(215), uint16(132), uint16(10), + /* 1420 */ uint16(11), uint16(12), uint16(13), uint16(14), uint16(1), uint16(2), uint16(17), uint16(192), uint16(5), uint16(19), + /* 1430 */ uint16(20), uint16(115), uint16(22), uint16(10), uint16(11), uint16(12), uint16(13), uint16(14), uint16(192), uint16(30), + /* 1440 */ uint16(17), uint16(32), uint16(23), uint16(192), uint16(23), uint16(26), uint16(36), uint16(26), uint16(116), uint16(40), + /* 1450 */ uint16(192), uint16(115), uint16(192), uint16(30), uint16(192), uint16(32), uint16(119), uint16(120), uint16(59), uint16(5), + /* 1460 */ uint16(214), uint16(215), uint16(128), uint16(40), uint16(10), uint16(11), uint16(12), uint16(13), uint16(14), uint16(59), + /* 1470 */ uint16(19), uint16(17), uint16(214), uint16(215), uint16(214), uint16(215), uint16(214), uint16(215), uint16(120), uint16(70), + /* 1480 */ uint16(192), uint16(71), uint16(22), uint16(192), uint16(30), uint16(151), uint16(32), uint16(78), uint16(130), uint16(128), + /* 1490 */ uint16(81), uint16(192), uint16(140), uint16(70), uint16(40), uint16(85), uint16(192), uint16(141), uint16(7), uint16(8), + /* 1500 */ uint16(90), uint16(78), uint16(214), uint16(215), uint16(81), uint16(214), uint16(215), uint16(98), uint16(83), uint16(84), + /* 1510 */ uint16(100), uint16(192), uint16(151), uint16(214), uint16(215), uint16(116), uint16(106), uint16(107), uint16(214), uint16(215), + /* 1520 */ uint16(192), uint16(98), uint16(192), uint16(113), uint16(70), uint16(115), uint16(116), uint16(117), uint16(23), uint16(224), + /* 1530 */ uint16(120), uint16(26), uint16(78), uint16(214), uint16(215), uint16(81), uint16(19), uint16(20), uint16(152), uint16(22), + /* 1540 */ uint16(154), uint16(132), uint16(214), uint16(215), uint16(214), uint16(215), uint16(137), uint16(138), uint16(97), uint16(192), + /* 1550 */ uint16(256), uint16(192), uint16(98), uint16(36), uint16(23), uint16(132), uint16(192), uint16(26), uint16(192), uint16(192), + /* 1560 */ uint16(137), uint16(138), uint16(152), uint16(153), uint16(154), uint16(155), uint16(156), uint16(192), uint16(192), uint16(192), + /* 1570 */ uint16(161), uint16(214), uint16(215), uint16(214), uint16(215), uint16(192), uint16(59), uint16(192), uint16(214), uint16(215), + /* 1580 */ uint16(214), uint16(215), uint16(192), uint16(152), uint16(161), uint16(154), uint16(132), uint16(192), uint16(71), uint16(214), + /* 1590 */ uint16(215), uint16(137), uint16(138), uint16(192), uint16(192), uint16(192), uint16(19), uint16(20), uint16(192), uint16(22), + /* 1600 */ uint16(140), uint16(253), uint16(85), uint16(192), uint16(214), uint16(215), uint16(192), uint16(90), uint16(23), uint16(214), + /* 1610 */ uint16(215), uint16(26), uint16(192), uint16(36), uint16(192), uint16(161), uint16(23), uint16(100), uint16(192), uint16(26), + /* 1620 */ uint16(214), uint16(215), uint16(192), uint16(106), uint16(107), uint16(214), uint16(215), uint16(192), uint16(23), uint16(192), + /* 1630 */ uint16(113), uint16(26), uint16(115), uint16(116), uint16(117), uint16(23), uint16(59), uint16(120), uint16(26), uint16(23), + /* 1640 */ uint16(23), uint16(23), uint16(26), uint16(26), uint16(26), uint16(316), uint16(234), uint16(23), uint16(71), uint16(23), + /* 1650 */ uint16(26), uint16(192), uint16(26), uint16(192), uint16(192), uint16(192), uint16(192), uint16(192), uint16(192), uint16(192), + /* 1660 */ uint16(192), uint16(253), uint16(212), uint16(190), uint16(286), uint16(285), uint16(253), uint16(240), uint16(253), uint16(152), + /* 1670 */ uint16(153), uint16(154), uint16(155), uint16(156), uint16(241), uint16(243), uint16(295), uint16(100), uint16(291), uint16(291), + /* 1680 */ uint16(223), uint16(253), uint16(227), uint16(106), uint16(107), uint16(108), uint16(269), uint16(244), uint16(244), uint16(265), + /* 1690 */ uint16(113), uint16(257), uint16(115), uint16(116), uint16(117), uint16(257), uint16(243), uint16(120), uint16(269), uint16(218), + /* 1700 */ uint16(217), uint16(265), uint16(217), uint16(19), uint16(20), uint16(217), uint16(22), uint16(195), uint16(269), uint16(269), + /* 1710 */ uint16(60), uint16(295), uint16(140), uint16(257), uint16(243), uint16(241), uint16(247), uint16(247), uint16(199), uint16(278), + /* 1720 */ uint16(36), uint16(199), uint16(199), uint16(38), uint16(19), uint16(20), uint16(150), uint16(22), uint16(149), uint16(152), + /* 1730 */ uint16(153), uint16(154), uint16(155), uint16(156), uint16(22), uint16(43), uint16(232), uint16(295), uint16(292), uint16(292), + /* 1740 */ uint16(18), uint16(36), uint16(235), uint16(59), uint16(268), uint16(270), uint16(235), uint16(199), uint16(235), uint16(235), + /* 1750 */ uint16(18), uint16(198), uint16(148), uint16(281), uint16(244), uint16(71), uint16(270), uint16(270), uint16(268), uint16(244), + /* 1760 */ uint16(232), uint16(232), uint16(244), uint16(199), uint16(59), uint16(244), uint16(198), uint16(157), uint16(288), uint16(62), + /* 1770 */ uint16(199), uint16(287), uint16(198), uint16(22), uint16(219), uint16(219), uint16(71), uint16(199), uint16(198), uint16(114), + /* 1780 */ uint16(199), uint16(198), uint16(216), uint16(216), uint16(100), uint16(216), uint16(225), uint16(64), uint16(22), uint16(125), + /* 1790 */ uint16(106), uint16(107), uint16(222), uint16(164), uint16(219), uint16(222), uint16(24), uint16(113), uint16(216), uint16(115), + /* 1800 */ uint16(116), uint16(117), uint16(218), uint16(216), uint16(120), uint16(100), uint16(216), uint16(216), uint16(310), uint16(303), + /* 1810 */ uint16(112), uint16(106), uint16(107), uint16(225), uint16(280), uint16(280), uint16(219), uint16(143), uint16(113), uint16(259), + /* 1820 */ uint16(115), uint16(116), uint16(117), uint16(114), uint16(259), uint16(120), uint16(199), uint16(91), uint16(82), uint16(147), + /* 1830 */ uint16(144), uint16(315), uint16(22), uint16(275), uint16(199), uint16(315), uint16(152), uint16(153), uint16(154), uint16(155), + /* 1840 */ uint16(156), uint16(146), uint16(145), uint16(247), uint16(258), uint16(157), uint16(25), uint16(258), uint16(245), uint16(248), + /* 1850 */ uint16(244), uint16(259), uint16(258), uint16(202), uint16(259), uint16(248), uint16(258), uint16(152), uint16(153), uint16(154), + /* 1860 */ uint16(155), uint16(156), uint16(263), uint16(263), uint16(26), uint16(246), uint16(13), uint16(201), uint16(193), uint16(193), + /* 1870 */ uint16(6), uint16(191), uint16(191), uint16(205), uint16(191), uint16(220), uint16(220), uint16(205), uint16(211), uint16(277), + /* 1880 */ uint16(211), uint16(211), uint16(211), uint16(205), uint16(4), uint16(212), uint16(3), uint16(22), uint16(162), uint16(212), + /* 1890 */ uint16(211), uint16(15), uint16(23), uint16(16), uint16(23), uint16(138), uint16(129), uint16(150), uint16(26), uint16(24), + /* 1900 */ uint16(141), uint16(20), uint16(16), uint16(143), uint16(1), uint16(141), uint16(129), uint16(129), uint16(61), uint16(301), + /* 1910 */ uint16(301), uint16(298), uint16(150), uint16(53), uint16(53), uint16(37), uint16(53), uint16(129), uint16(115), uint16(53), + /* 1920 */ uint16(140), uint16(34), uint16(1), uint16(5), uint16(22), uint16(114), uint16(68), uint16(26), uint16(160), uint16(75), + /* 1930 */ uint16(68), uint16(41), uint16(140), uint16(114), uint16(24), uint16(20), uint16(19), uint16(130), uint16(124), uint16(23), + /* 1940 */ uint16(67), uint16(22), uint16(22), uint16(59), uint16(22), uint16(22), uint16(67), uint16(96), uint16(24), uint16(22), + /* 1950 */ uint16(37), uint16(23), uint16(67), uint16(28), uint16(148), uint16(22), uint16(26), uint16(23), uint16(23), uint16(23), + /* 1960 */ uint16(23), uint16(22), uint16(140), uint16(23), uint16(97), uint16(23), uint16(34), uint16(115), uint16(22), uint16(142), + /* 1970 */ uint16(26), uint16(75), uint16(34), uint16(44), uint16(75), uint16(34), uint16(88), uint16(34), uint16(86), uint16(34), + /* 1980 */ uint16(23), uint16(34), uint16(93), uint16(22), uint16(24), uint16(26), uint16(34), uint16(23), uint16(26), uint16(23), + /* 1990 */ uint16(23), uint16(23), uint16(23), uint16(11), uint16(23), uint16(22), uint16(26), uint16(22), uint16(22), uint16(140), + /* 2000 */ uint16(23), uint16(23), uint16(22), uint16(22), uint16(134), uint16(26), uint16(23), uint16(15), uint16(140), uint16(1), + /* 2010 */ uint16(1), uint16(317), uint16(317), uint16(317), uint16(140), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2020 */ uint16(317), uint16(317), uint16(140), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2030 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2040 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2050 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2060 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2070 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2080 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2090 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2100 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2110 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2120 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2130 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2140 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2150 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2160 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2170 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2180 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2190 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), + /* 2200 */ uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), uint16(317), +} /* sqlite3.c:158793:25 */ +var yy_shift_ofst = [570]uint16{ + /* 0 */ uint16(1423), uint16(1409), uint16(1454), uint16(1192), uint16(1192), uint16(382), uint16(1252), uint16(1410), uint16(1517), uint16(1684), + /* 10 */ uint16(1684), uint16(1684), uint16(221), uint16(0), uint16(0), uint16(180), uint16(1015), uint16(1684), uint16(1684), uint16(1684), + /* 20 */ uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), + /* 30 */ uint16(1049), uint16(1049), uint16(1121), uint16(1121), uint16(54), uint16(616), uint16(382), uint16(382), uint16(382), uint16(382), + /* 40 */ uint16(382), uint16(40), uint16(110), uint16(219), uint16(289), uint16(396), uint16(439), uint16(509), uint16(548), uint16(618), + /* 50 */ uint16(657), uint16(727), uint16(766), uint16(836), uint16(995), uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), + /* 60 */ uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), uint16(1015), + /* 70 */ uint16(1015), uint16(1015), uint16(1015), uint16(1035), uint16(1015), uint16(1138), uint16(880), uint16(880), uint16(1577), uint16(1684), + /* 80 */ uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), + /* 90 */ uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), + /* 100 */ uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), + /* 110 */ uint16(1684), uint16(1684), uint16(1684), uint16(1705), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), + /* 120 */ uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(1684), uint16(146), uint16(84), uint16(84), + /* 130 */ uint16(84), uint16(84), uint16(84), uint16(274), uint16(315), uint16(125), uint16(97), uint16(357), uint16(66), uint16(66), + /* 140 */ uint16(893), uint16(258), uint16(66), uint16(66), uint16(371), uint16(371), uint16(66), uint16(551), uint16(551), uint16(551), + /* 150 */ uint16(551), uint16(192), uint16(209), uint16(209), uint16(278), uint16(127), uint16(2023), uint16(2023), uint16(621), uint16(621), + /* 160 */ uint16(621), uint16(201), uint16(398), uint16(398), uint16(398), uint16(398), uint16(939), uint16(939), uint16(442), uint16(936), + /* 170 */ uint16(1009), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), + /* 180 */ uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), + /* 190 */ uint16(66), uint16(710), uint16(710), uint16(66), uint16(776), uint16(435), uint16(435), uint16(410), uint16(410), uint16(372), + /* 200 */ uint16(1097), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(250), uint16(490), + /* 210 */ uint16(490), uint16(511), uint16(451), uint16(516), uint16(252), uint16(566), uint16(575), uint16(781), uint16(673), uint16(66), + /* 220 */ uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(722), + /* 230 */ uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), + /* 240 */ uint16(66), uint16(66), uint16(790), uint16(790), uint16(790), uint16(66), uint16(66), uint16(66), uint16(883), uint16(66), + /* 250 */ uint16(66), uint16(66), uint16(891), uint16(1064), uint16(66), uint16(66), uint16(1212), uint16(66), uint16(66), uint16(66), + /* 260 */ uint16(66), uint16(66), uint16(66), uint16(66), uint16(66), uint16(725), uint16(763), uint16(177), uint16(940), uint16(940), + /* 270 */ uint16(940), uint16(940), uint16(337), uint16(177), uint16(177), uint16(1028), uint16(1053), uint16(670), uint16(1264), uint16(1179), + /* 280 */ uint16(1173), uint16(1254), uint16(1316), uint16(1173), uint16(1316), uint16(1336), uint16(50), uint16(1179), uint16(1179), uint16(50), + /* 290 */ uint16(1179), uint16(1254), uint16(1336), uint16(1259), uint16(732), uint16(532), uint16(1347), uint16(1347), uint16(1347), uint16(1316), + /* 300 */ uint16(1236), uint16(1236), uint16(1184), uint16(1356), uint16(1167), uint16(898), uint16(1650), uint16(1650), uint16(1572), uint16(1572), + /* 310 */ uint16(1685), uint16(1685), uint16(1572), uint16(1576), uint16(1579), uint16(1712), uint16(1692), uint16(1722), uint16(1722), uint16(1722), + /* 320 */ uint16(1722), uint16(1572), uint16(1732), uint16(1604), uint16(1579), uint16(1579), uint16(1604), uint16(1712), uint16(1692), uint16(1604), + /* 330 */ uint16(1692), uint16(1604), uint16(1572), uint16(1732), uint16(1610), uint16(1707), uint16(1572), uint16(1732), uint16(1751), uint16(1572), + /* 340 */ uint16(1732), uint16(1572), uint16(1732), uint16(1751), uint16(1665), uint16(1665), uint16(1665), uint16(1723), uint16(1766), uint16(1766), + /* 350 */ uint16(1751), uint16(1665), uint16(1664), uint16(1665), uint16(1723), uint16(1665), uint16(1665), uint16(1629), uint16(1772), uint16(1698), + /* 360 */ uint16(1698), uint16(1751), uint16(1674), uint16(1709), uint16(1674), uint16(1709), uint16(1674), uint16(1709), uint16(1674), uint16(1709), + /* 370 */ uint16(1572), uint16(1736), uint16(1736), uint16(1746), uint16(1746), uint16(1682), uint16(1686), uint16(1810), uint16(1572), uint16(1688), + /* 380 */ uint16(1682), uint16(1695), uint16(1697), uint16(1604), uint16(1821), uint16(1838), uint16(1853), uint16(1853), uint16(1864), uint16(1864), + /* 390 */ uint16(1864), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), + /* 400 */ uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(2023), uint16(232), uint16(101), uint16(1131), uint16(1193), + /* 410 */ uint16(619), uint16(679), uint16(841), uint16(1421), uint16(1286), uint16(115), uint16(1352), uint16(1334), uint16(1361), uint16(1419), + /* 420 */ uint16(1342), uint16(1505), uint16(1531), uint16(1585), uint16(1593), uint16(1605), uint16(1612), uint16(1280), uint16(1337), uint16(1491), + /* 430 */ uint16(1358), uint16(1451), uint16(1332), uint16(1616), uint16(1617), uint16(1425), uint16(1618), uint16(1386), uint16(1431), uint16(1624), + /* 440 */ uint16(1626), uint16(1399), uint16(1460), uint16(1880), uint16(1883), uint16(1865), uint16(1726), uint16(1876), uint16(1877), uint16(1869), + /* 450 */ uint16(1871), uint16(1757), uint16(1747), uint16(1767), uint16(1872), uint16(1872), uint16(1875), uint16(1759), uint16(1881), uint16(1760), + /* 460 */ uint16(1886), uint16(1903), uint16(1764), uint16(1777), uint16(1872), uint16(1778), uint16(1847), uint16(1878), uint16(1872), uint16(1762), + /* 470 */ uint16(1860), uint16(1861), uint16(1863), uint16(1866), uint16(1788), uint16(1803), uint16(1887), uint16(1780), uint16(1921), uint16(1918), + /* 480 */ uint16(1902), uint16(1811), uint16(1768), uint16(1858), uint16(1901), uint16(1862), uint16(1854), uint16(1890), uint16(1792), uint16(1819), + /* 490 */ uint16(1910), uint16(1915), uint16(1917), uint16(1807), uint16(1814), uint16(1919), uint16(1873), uint16(1920), uint16(1922), uint16(1916), + /* 500 */ uint16(1923), uint16(1879), uint16(1884), uint16(1924), uint16(1851), uint16(1925), uint16(1927), uint16(1885), uint16(1913), uint16(1928), + /* 510 */ uint16(1806), uint16(1933), uint16(1934), uint16(1935), uint16(1936), uint16(1930), uint16(1937), uint16(1939), uint16(1867), uint16(1822), + /* 520 */ uint16(1940), uint16(1942), uint16(1852), uint16(1932), uint16(1946), uint16(1827), uint16(1944), uint16(1938), uint16(1941), uint16(1943), + /* 530 */ uint16(1945), uint16(1888), uint16(1896), uint16(1892), uint16(1929), uint16(1899), uint16(1889), uint16(1947), uint16(1957), uint16(1961), + /* 540 */ uint16(1960), uint16(1959), uint16(1962), uint16(1952), uint16(1964), uint16(1944), uint16(1966), uint16(1967), uint16(1968), uint16(1969), + /* 550 */ uint16(1970), uint16(1971), uint16(1973), uint16(1982), uint16(1975), uint16(1976), uint16(1977), uint16(1978), uint16(1980), uint16(1981), + /* 560 */ uint16(1979), uint16(1870), uint16(1859), uint16(1868), uint16(1874), uint16(1882), uint16(1983), uint16(1992), uint16(2008), uint16(2009), +} /* sqlite3.c:159019:33 */ +var yy_reduce_ofst = [406]int16{ + /* 0 */ int16(111), int16(168), int16(272), int16(760), int16(-177), int16(-175), int16(-192), int16(-190), int16(-182), int16(-179), + /* 10 */ int16(216), int16(220), int16(481), int16(-208), int16(-205), int16(-266), int16(-140), int16(-115), int16(241), int16(393), + /* 20 */ int16(523), int16(325), int16(612), int16(632), int16(542), int16(651), int16(764), int16(757), int16(702), int16(762), + /* 30 */ int16(812), int16(814), int16(-188), int16(273), int16(924), int16(386), int16(758), int16(967), int16(1020), int16(1052), + /* 40 */ int16(1066), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), + /* 50 */ int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), + /* 60 */ int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), + /* 70 */ int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(195), int16(222), + /* 80 */ int16(813), int16(917), int16(920), int16(959), int16(985), int16(1006), int16(1038), int16(1067), int16(1069), int16(1072), + /* 90 */ int16(1099), int16(1103), int16(1105), int16(1118), int16(1135), int16(1139), int16(1142), int16(1146), int16(1148), int16(1159), + /* 100 */ int16(1174), int16(1178), int16(1183), int16(1185), int16(1187), int16(1198), int16(1202), int16(1246), int16(1258), int16(1260), + /* 110 */ int16(1262), int16(1288), int16(1291), int16(1299), int16(1304), int16(1319), int16(1328), int16(1330), int16(1357), int16(1359), + /* 120 */ int16(1364), int16(1366), int16(1375), int16(1390), int16(1395), int16(1406), int16(1411), int16(-256), int16(-256), int16(-256), + /* 130 */ int16(-256), int16(-256), int16(-256), int16(-256), int16(-256), int16(447), int16(-256), int16(555), int16(-178), int16(605), + /* 140 */ int16(832), int16(-220), int16(606), int16(-94), int16(-168), int16(36), int16(-122), int16(730), int16(780), int16(730), + /* 150 */ int16(780), int16(918), int16(-136), int16(338), int16(-256), int16(-256), int16(-256), int16(-256), int16(80), int16(80), + /* 160 */ int16(80), int16(720), int16(703), int16(811), int16(882), int16(903), int16(-213), int16(-204), int16(106), int16(330), + /* 170 */ int16(330), int16(-77), int16(236), int16(320), int16(599), int16(67), int16(457), int16(675), int16(729), int16(395), + /* 180 */ int16(268), int16(611), int16(969), int16(1004), int16(726), int16(1014), int16(983), int16(123), int16(884), int16(608), + /* 190 */ int16(1034), int16(547), int16(911), int16(650), int16(844), int16(922), int16(949), int16(965), int16(972), int16(978), + /* 200 */ int16(449), int16(970), int16(718), int16(784), int16(1073), int16(1084), int16(1023), int16(1129), int16(-209), int16(-180), + /* 210 */ int16(-113), int16(114), int16(183), int16(329), int16(345), int16(391), int16(446), int16(502), int16(609), int16(667), + /* 220 */ int16(713), int16(817), int16(865), int16(881), int16(901), int16(921), int16(989), int16(1191), int16(1195), int16(214), + /* 230 */ int16(1223), int16(1235), int16(1251), int16(1367), int16(1376), int16(1377), int16(1383), int16(1385), int16(1401), int16(1402), + /* 240 */ int16(1403), int16(1414), int16(584), int16(638), int16(1305), int16(1420), int16(1422), int16(1426), int16(1294), int16(1430), + /* 250 */ int16(1435), int16(1437), int16(1348), int16(1329), int16(1459), int16(1461), int16(1412), int16(1462), int16(345), int16(1463), + /* 260 */ int16(1464), int16(1465), int16(1466), int16(1467), int16(1468), int16(1378), int16(1380), int16(1427), int16(1408), int16(1413), + /* 270 */ int16(1415), int16(1428), int16(1294), int16(1427), int16(1427), int16(1433), int16(1450), int16(1473), int16(1381), int16(1417), + /* 280 */ int16(1424), int16(1432), int16(1434), int16(1436), int16(1438), int16(1387), int16(1443), int16(1429), int16(1439), int16(1444), + /* 290 */ int16(1440), int16(1453), int16(1388), int16(1481), int16(1455), int16(1457), int16(1483), int16(1485), int16(1488), int16(1456), + /* 300 */ int16(1469), int16(1470), int16(1441), int16(1471), int16(1474), int16(1512), int16(1416), int16(1442), int16(1519), int16(1522), + /* 310 */ int16(1446), int16(1447), int16(1523), int16(1472), int16(1475), int16(1476), int16(1504), int16(1507), int16(1511), int16(1513), + /* 320 */ int16(1514), int16(1548), int16(1553), int16(1510), int16(1486), int16(1487), int16(1515), int16(1490), int16(1528), int16(1518), + /* 330 */ int16(1529), int16(1521), int16(1564), int16(1568), int16(1480), int16(1484), int16(1571), int16(1574), int16(1555), int16(1578), + /* 340 */ int16(1580), int16(1581), int16(1583), int16(1556), int16(1566), int16(1567), int16(1569), int16(1561), int16(1570), int16(1573), + /* 350 */ int16(1575), int16(1582), int16(1584), int16(1587), int16(1588), int16(1590), int16(1591), int16(1498), int16(1506), int16(1534), + /* 360 */ int16(1535), int16(1597), int16(1560), int16(1586), int16(1565), int16(1589), int16(1592), int16(1594), int16(1595), int16(1598), + /* 370 */ int16(1627), int16(1516), int16(1520), int16(1599), int16(1600), int16(1601), int16(1596), int16(1558), int16(1635), int16(1602), + /* 380 */ int16(1607), int16(1619), int16(1603), int16(1606), int16(1651), int16(1666), int16(1675), int16(1676), int16(1680), int16(1681), + /* 390 */ int16(1683), int16(1608), int16(1609), int16(1613), int16(1668), int16(1667), int16(1669), int16(1670), int16(1671), int16(1672), + /* 400 */ int16(1655), int16(1656), int16(1673), int16(1677), int16(1679), int16(1678), +} /* sqlite3.c:159081:20 */ +var yy_default = [570]uint16{ + /* 0 */ uint16(1623), uint16(1623), uint16(1623), uint16(1453), uint16(1223), uint16(1332), uint16(1223), uint16(1223), uint16(1223), uint16(1453), + /* 10 */ uint16(1453), uint16(1453), uint16(1223), uint16(1362), uint16(1362), uint16(1506), uint16(1254), uint16(1223), uint16(1223), uint16(1223), + /* 20 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1452), uint16(1223), uint16(1223), + /* 30 */ uint16(1223), uint16(1223), uint16(1541), uint16(1541), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 40 */ uint16(1223), uint16(1223), uint16(1371), uint16(1223), uint16(1378), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 50 */ uint16(1454), uint16(1455), uint16(1223), uint16(1223), uint16(1223), uint16(1505), uint16(1507), uint16(1470), uint16(1385), uint16(1384), + /* 60 */ uint16(1383), uint16(1382), uint16(1488), uint16(1349), uint16(1376), uint16(1369), uint16(1373), uint16(1448), uint16(1449), uint16(1447), + /* 70 */ uint16(1451), uint16(1455), uint16(1454), uint16(1223), uint16(1372), uint16(1419), uint16(1433), uint16(1418), uint16(1223), uint16(1223), + /* 80 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 90 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 100 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 110 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 120 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1427), uint16(1432), uint16(1438), + /* 130 */ uint16(1431), uint16(1428), uint16(1421), uint16(1420), uint16(1422), uint16(1223), uint16(1423), uint16(1223), uint16(1223), uint16(1223), + /* 140 */ uint16(1244), uint16(1296), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1525), uint16(1524), uint16(1223), + /* 150 */ uint16(1223), uint16(1254), uint16(1413), uint16(1412), uint16(1424), uint16(1425), uint16(1435), uint16(1434), uint16(1513), uint16(1576), + /* 160 */ uint16(1575), uint16(1471), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1541), uint16(1223), + /* 170 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 180 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 190 */ uint16(1223), uint16(1541), uint16(1541), uint16(1223), uint16(1254), uint16(1541), uint16(1541), uint16(1250), uint16(1250), uint16(1356), + /* 200 */ uint16(1223), uint16(1520), uint16(1323), uint16(1323), uint16(1323), uint16(1323), uint16(1332), uint16(1323), uint16(1223), uint16(1223), + /* 210 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 220 */ uint16(1223), uint16(1223), uint16(1223), uint16(1510), uint16(1508), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 230 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 240 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 250 */ uint16(1223), uint16(1223), uint16(1328), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 260 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1570), uint16(1223), uint16(1483), uint16(1310), uint16(1328), uint16(1328), + /* 270 */ uint16(1328), uint16(1328), uint16(1330), uint16(1311), uint16(1309), uint16(1322), uint16(1255), uint16(1230), uint16(1615), uint16(1388), + /* 280 */ uint16(1377), uint16(1329), uint16(1351), uint16(1377), uint16(1351), uint16(1612), uint16(1375), uint16(1388), uint16(1388), uint16(1375), + /* 290 */ uint16(1388), uint16(1329), uint16(1612), uint16(1271), uint16(1592), uint16(1266), uint16(1362), uint16(1362), uint16(1362), uint16(1351), + /* 300 */ uint16(1356), uint16(1356), uint16(1450), uint16(1329), uint16(1322), uint16(1223), uint16(1615), uint16(1615), uint16(1337), uint16(1337), + /* 310 */ uint16(1614), uint16(1614), uint16(1337), uint16(1471), uint16(1599), uint16(1397), uint16(1299), uint16(1305), uint16(1305), uint16(1305), + /* 320 */ uint16(1305), uint16(1337), uint16(1241), uint16(1375), uint16(1599), uint16(1599), uint16(1375), uint16(1397), uint16(1299), uint16(1375), + /* 330 */ uint16(1299), uint16(1375), uint16(1337), uint16(1241), uint16(1487), uint16(1609), uint16(1337), uint16(1241), uint16(1461), uint16(1337), + /* 340 */ uint16(1241), uint16(1337), uint16(1241), uint16(1461), uint16(1297), uint16(1297), uint16(1297), uint16(1286), uint16(1223), uint16(1223), + /* 350 */ uint16(1461), uint16(1297), uint16(1271), uint16(1297), uint16(1286), uint16(1297), uint16(1297), uint16(1559), uint16(1223), uint16(1465), + /* 360 */ uint16(1465), uint16(1461), uint16(1355), uint16(1350), uint16(1355), uint16(1350), uint16(1355), uint16(1350), uint16(1355), uint16(1350), + /* 370 */ uint16(1337), uint16(1551), uint16(1551), uint16(1365), uint16(1365), uint16(1370), uint16(1356), uint16(1456), uint16(1337), uint16(1223), + /* 380 */ uint16(1370), uint16(1368), uint16(1366), uint16(1375), uint16(1247), uint16(1289), uint16(1573), uint16(1573), uint16(1569), uint16(1569), + /* 390 */ uint16(1569), uint16(1620), uint16(1620), uint16(1520), uint16(1585), uint16(1254), uint16(1254), uint16(1254), uint16(1254), uint16(1585), + /* 400 */ uint16(1273), uint16(1273), uint16(1255), uint16(1255), uint16(1254), uint16(1585), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 410 */ uint16(1223), uint16(1223), uint16(1580), uint16(1223), uint16(1515), uint16(1472), uint16(1341), uint16(1223), uint16(1223), uint16(1223), + /* 420 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 430 */ uint16(1223), uint16(1526), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 440 */ uint16(1223), uint16(1223), uint16(1402), uint16(1223), uint16(1226), uint16(1517), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 450 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1379), uint16(1380), uint16(1342), uint16(1223), uint16(1223), uint16(1223), + /* 460 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1394), uint16(1223), uint16(1223), uint16(1223), uint16(1389), uint16(1223), + /* 470 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1611), uint16(1223), uint16(1223), + /* 480 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1486), uint16(1485), uint16(1223), uint16(1223), uint16(1339), uint16(1223), + /* 490 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 500 */ uint16(1223), uint16(1223), uint16(1269), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 510 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 520 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1367), uint16(1223), uint16(1223), uint16(1223), + /* 530 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 540 */ uint16(1223), uint16(1556), uint16(1357), uint16(1223), uint16(1223), uint16(1602), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 550 */ uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), uint16(1223), + /* 560 */ uint16(1596), uint16(1313), uint16(1404), uint16(1223), uint16(1403), uint16(1407), uint16(1223), uint16(1235), uint16(1223), uint16(1223), +} /* sqlite3.c:159124:27 */ +//********* End of lemon-generated parsing tables **************************** + +// The next table maps tokens (terminal symbols) into fallback tokens. +// If a construct like the following: +// +// %fallback ID X Y Z. +// +// appears in the grammar, then ID becomes a fallback token for X, Y, +// and Z. Whenever one of the tokens X, Y, or Z is input to the parser +// but it does not parse, the type of the token is changed to ID and +// the parse is retried before an error is thrown. +// +// This feature can be used, for example, to cause some keywords in a language +// to revert to identifiers if they keyword does not apply in the context where +// it appears. +var yyFallback = [184]uint16{ + uint16(0), // $ => nothing + uint16(0), // SEMI => nothing + uint16(59), // EXPLAIN => ID + uint16(59), // QUERY => ID + uint16(59), // PLAN => ID + uint16(59), // BEGIN => ID + uint16(0), // TRANSACTION => nothing + uint16(59), // DEFERRED => ID + uint16(59), // IMMEDIATE => ID + uint16(59), // EXCLUSIVE => ID + uint16(0), // COMMIT => nothing + uint16(59), // END => ID + uint16(59), // ROLLBACK => ID + uint16(59), // SAVEPOINT => ID + uint16(59), // RELEASE => ID + uint16(0), // TO => nothing + uint16(0), // TABLE => nothing + uint16(0), // CREATE => nothing + uint16(59), // IF => ID + uint16(0), // NOT => nothing + uint16(0), // EXISTS => nothing + uint16(59), // TEMP => ID + uint16(0), // LP => nothing + uint16(0), // RP => nothing + uint16(0), // AS => nothing + uint16(59), // WITHOUT => ID + uint16(0), // COMMA => nothing + uint16(59), // ABORT => ID + uint16(59), // ACTION => ID + uint16(59), // AFTER => ID + uint16(59), // ANALYZE => ID + uint16(59), // ASC => ID + uint16(59), // ATTACH => ID + uint16(59), // BEFORE => ID + uint16(59), // BY => ID + uint16(59), // CASCADE => ID + uint16(59), // CAST => ID + uint16(59), // CONFLICT => ID + uint16(59), // DATABASE => ID + uint16(59), // DESC => ID + uint16(59), // DETACH => ID + uint16(59), // EACH => ID + uint16(59), // FAIL => ID + uint16(0), // OR => nothing + uint16(0), // AND => nothing + uint16(0), // IS => nothing + uint16(59), // MATCH => ID + uint16(59), // LIKE_KW => ID + uint16(0), // BETWEEN => nothing + uint16(0), // IN => nothing + uint16(0), // ISNULL => nothing + uint16(0), // NOTNULL => nothing + uint16(0), // NE => nothing + uint16(0), // EQ => nothing + uint16(0), // GT => nothing + uint16(0), // LE => nothing + uint16(0), // LT => nothing + uint16(0), // GE => nothing + uint16(0), // ESCAPE => nothing + uint16(0), // ID => nothing + uint16(59), // COLUMNKW => ID + uint16(59), // DO => ID + uint16(59), // FOR => ID + uint16(59), // IGNORE => ID + uint16(59), // INITIALLY => ID + uint16(59), // INSTEAD => ID + uint16(59), // NO => ID + uint16(59), // KEY => ID + uint16(59), // OF => ID + uint16(59), // OFFSET => ID + uint16(59), // PRAGMA => ID + uint16(59), // RAISE => ID + uint16(59), // RECURSIVE => ID + uint16(59), // REPLACE => ID + uint16(59), // RESTRICT => ID + uint16(59), // ROW => ID + uint16(59), // ROWS => ID + uint16(59), // TRIGGER => ID + uint16(59), // VACUUM => ID + uint16(59), // VIEW => ID + uint16(59), // VIRTUAL => ID + uint16(59), // WITH => ID + uint16(59), // NULLS => ID + uint16(59), // FIRST => ID + uint16(59), // LAST => ID + uint16(59), // CURRENT => ID + uint16(59), // FOLLOWING => ID + uint16(59), // PARTITION => ID + uint16(59), // PRECEDING => ID + uint16(59), // RANGE => ID + uint16(59), // UNBOUNDED => ID + uint16(59), // EXCLUDE => ID + uint16(59), // GROUPS => ID + uint16(59), // OTHERS => ID + uint16(59), // TIES => ID + uint16(59), // GENERATED => ID + uint16(59), // ALWAYS => ID + uint16(59), // MATERIALIZED => ID + uint16(59), // REINDEX => ID + uint16(59), // RENAME => ID + uint16(59), // CTIME_KW => ID + uint16(0), // ANY => nothing + uint16(0), // BITAND => nothing + uint16(0), // BITOR => nothing + uint16(0), // LSHIFT => nothing + uint16(0), // RSHIFT => nothing + uint16(0), // PLUS => nothing + uint16(0), // MINUS => nothing + uint16(0), // STAR => nothing + uint16(0), // SLASH => nothing + uint16(0), // REM => nothing + uint16(0), // CONCAT => nothing + uint16(0), // COLLATE => nothing + uint16(0), // BITNOT => nothing + uint16(0), // ON => nothing + uint16(0), // INDEXED => nothing + uint16(0), // STRING => nothing + uint16(0), // JOIN_KW => nothing + uint16(0), // CONSTRAINT => nothing + uint16(0), // DEFAULT => nothing + uint16(0), // NULL => nothing + uint16(0), // PRIMARY => nothing + uint16(0), // UNIQUE => nothing + uint16(0), // CHECK => nothing + uint16(0), // REFERENCES => nothing + uint16(0), // AUTOINCR => nothing + uint16(0), // INSERT => nothing + uint16(0), // DELETE => nothing + uint16(0), // UPDATE => nothing + uint16(0), // SET => nothing + uint16(0), // DEFERRABLE => nothing + uint16(0), // FOREIGN => nothing + uint16(0), // DROP => nothing + uint16(0), // UNION => nothing + uint16(0), // ALL => nothing + uint16(0), // EXCEPT => nothing + uint16(0), // INTERSECT => nothing + uint16(0), // SELECT => nothing + uint16(0), // VALUES => nothing + uint16(0), // DISTINCT => nothing + uint16(0), // DOT => nothing + uint16(0), // FROM => nothing + uint16(0), // JOIN => nothing + uint16(0), // USING => nothing + uint16(0), // ORDER => nothing + uint16(0), // GROUP => nothing + uint16(0), // HAVING => nothing + uint16(0), // LIMIT => nothing + uint16(0), // WHERE => nothing + uint16(0), // RETURNING => nothing + uint16(0), // INTO => nothing + uint16(0), // NOTHING => nothing + uint16(0), // FLOAT => nothing + uint16(0), // BLOB => nothing + uint16(0), // INTEGER => nothing + uint16(0), // VARIABLE => nothing + uint16(0), // CASE => nothing + uint16(0), // WHEN => nothing + uint16(0), // THEN => nothing + uint16(0), // ELSE => nothing + uint16(0), // INDEX => nothing + uint16(0), // ALTER => nothing + uint16(0), // ADD => nothing + uint16(0), // WINDOW => nothing + uint16(0), // OVER => nothing + uint16(0), // FILTER => nothing + uint16(0), // COLUMN => nothing + uint16(0), // AGG_FUNCTION => nothing + uint16(0), // AGG_COLUMN => nothing + uint16(0), // TRUEFALSE => nothing + uint16(0), // ISNOT => nothing + uint16(0), // FUNCTION => nothing + uint16(0), // UMINUS => nothing + uint16(0), // UPLUS => nothing + uint16(0), // TRUTH => nothing + uint16(0), // REGISTER => nothing + uint16(0), // VECTOR => nothing + uint16(0), // SELECT_COLUMN => nothing + uint16(0), // IF_NULL_ROW => nothing + uint16(0), // ASTERISK => nothing + uint16(0), // SPAN => nothing + uint16(0), // ERROR => nothing + uint16(0), // SPACE => nothing + uint16(0), // ILLEGAL => nothing +} /* sqlite3.c:159200:25 */ + +// The following structure represents a single element of the +// parser's stack. Information stored includes: +// +// + The state number for the parser at this level of the stack. +// +// + The value of the token stored at this level of the stack. +// (In other words, the "major" token.) +// +// + The semantic value stored at this level of the stack. This is +// the information used by the action routines in the grammar. +// It is sometimes called the "minor" token. +// +// After the "shift" half of a SHIFTREDUCE action, the stateno field +// actually contains the reduce action for the second half of the +// SHIFTREDUCE. +type yyStackEntry = struct { + Fstateno uint16 + Fmajor uint16 + _ [4]byte + Fminor YYMINORTYPE +} /* sqlite3.c:159404:1 */ + +type YyStackEntry = yyStackEntry /* sqlite3.c:159411:29 */ + +// The state of the parser is completely contained in an instance of +// the following structure +type yyParser = struct { + Fyytos uintptr + FpParse uintptr + Fyystack [100]YyStackEntry + FyystackEnd uintptr +} /* sqlite3.c:159415:1 */ + +type YyParser = yyParser /* sqlite3.c:159434:25 */ + +// Datatype of the argument to the memory allocated passed as the +// second argument to sqlite3ParserAlloc() below. This can be changed by +// putting an appropriate #define in the %include section of the input +// grammar. + +// Initialize a new parser that has already been allocated. +func Xsqlite3ParserInit(tls *libc.TLS, yypRawParser uintptr, pParse uintptr) { /* sqlite3.c:160243:21: */ + var yypParser uintptr = yypRawParser + (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse + (*YyParser)(unsafe.Pointer(yypParser)).Fyytos = yypParser + 16 /* &.yystack */ + (*YyStackEntry)(unsafe.Pointer((yypParser + 16 /* &.yystack */))).Fstateno = uint16(0) + (*YyStackEntry)(unsafe.Pointer((yypParser + 16 /* &.yystack */))).Fmajor = uint16(0) + (*YyParser)(unsafe.Pointer(yypParser)).FyystackEnd = ((yypParser + 16 /* &.yystack */) + 99*24) +} + +// The following function deletes the "minor type" or semantic value +// associated with a symbol. The symbol can be either a terminal +// or nonterminal. "yymajor" is the symbol code, and "yypminor" is +// a pointer to the value to be deleted. The code used to do the +// deletions is derived from the %destructor and/or %token_destructor +// directives of the input grammar. +func yy_destructor(tls *libc.TLS, yypParser uintptr, yymajor uint16, yypminor uintptr) { /* sqlite3.c:160301:13: */ + + var pParse uintptr = (*YyParser)(unsafe.Pointer(yypParser)).FpParse + switch int32(yymajor) { + // Here is inserted the actions which take place when a + // terminal or non-terminal is destroyed. This can happen + // when the symbol is popped from the stack during a + // reduce or during error processing or when a parser is + // being destroyed before it is finished parsing. + // + // Note: during a reduce, the only symbols destroyed are those + // which appear on the RHS of the rule, but which are *not* used + // inside the C code. + //******** Begin destructor definitions ************************************** + case 203: + fallthrough // select + case 237: + fallthrough // selectnowith + case 238: + fallthrough // oneselect + case 250: /* values */ + { + Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy81 */))) + } + break + case 214: + fallthrough // term + case 215: + fallthrough // expr + case 244: + fallthrough // where_opt + case 246: + fallthrough // having_opt + case 258: + fallthrough // on_opt + case 265: + fallthrough // where_opt_ret + case 276: + fallthrough // case_operand + case 278: + fallthrough // case_else + case 281: + fallthrough // vinto + case 288: + fallthrough // when_clause + case 293: + fallthrough // key_opt + case 309: /* filter_clause */ + { + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy404 */))) + } + break + case 219: + fallthrough // eidlist_opt + case 229: + fallthrough // sortlist + case 230: + fallthrough // eidlist + case 242: + fallthrough // selcollist + case 245: + fallthrough // groupby_opt + case 247: + fallthrough // orderby_opt + case 251: + fallthrough // nexprlist + case 252: + fallthrough // sclp + case 260: + fallthrough // exprlist + case 266: + fallthrough // setlist + case 275: + fallthrough // paren_exprlist + case 277: + fallthrough // case_exprlist + case 308: /* part_opt */ + { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy70 */))) + } + break + case 236: + fallthrough // fullname + case 243: + fallthrough // from + case 254: + fallthrough // seltablist + case 255: + fallthrough // stl_prefix + case 261: /* xfullname */ + { + Xsqlite3SrcListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy153 */))) + } + break + case 239: /* wqlist */ + { + Xsqlite3WithDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy103 */))) + } + break + case 249: + fallthrough // window_clause + case 304: /* windowdefn_list */ + { + Xsqlite3WindowListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy49 */))) + } + break + case 259: + fallthrough // using_opt + case 262: + fallthrough // idlist + case 268: /* idlist_opt */ + { + Xsqlite3IdListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy436 */))) + } + break + case 271: + fallthrough // filter_over + case 305: + fallthrough // windowdefn + case 306: + fallthrough // window + case 307: + fallthrough // frame_opt + case 310: /* over_clause */ + { + Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy49 */))) + } + break + case 284: + fallthrough // trigger_cmd_list + case 289: /* trigger_cmd */ + { + Xsqlite3DeleteTriggerStep(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yypminor /* .Fyy157 */))) + } + break + case 286: /* trigger_event */ + { + Xsqlite3IdListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*TrigEvent)(unsafe.Pointer(yypminor)).Fb) + } + break + case 312: + fallthrough // frame_bound + case 313: + fallthrough // frame_bound_s + case 314: /* frame_bound_e */ + { + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*FrameBound)(unsafe.Pointer(yypminor)).FpExpr) + } + break + //******** End destructor definitions **************************************** + default: + break // If no destructor action specified: do nothing + } +} + +// Pop the parser's stack once. +// +// If there is a destructor routine associated with the token which +// is popped from the stack, then call it. +func yy_pop_parser_stack(tls *libc.TLS, pParser uintptr) { /* sqlite3.c:160426:13: */ + var yytos uintptr + + yytos = libc.PostDecUintptr(&(*YyParser)(unsafe.Pointer(pParser)).Fyytos, 24) + yy_destructor(tls, pParser, (*YyStackEntry)(unsafe.Pointer(yytos)).Fmajor, (yytos + 8 /* &.minor */)) +} + +// Clear all secondary memory allocations from the parser +func Xsqlite3ParserFinalize(tls *libc.TLS, p uintptr) { /* sqlite3.c:160444:21: */ + var pParser uintptr = p + for (*YyParser)(unsafe.Pointer(pParser)).Fyytos > pParser+16 /* &.yystack */ { + yy_pop_parser_stack(tls, pParser) + } +} + +// Return the peak depth of the stack for a parser. + +// This array of booleans keeps track of the parser statement +// coverage. The element yycoverage[X][Y] is set when the parser +// is in state X and has a lookahead token Y. In a well-tested +// systems, every element of this matrix should end up being set. + +// Write into out a description of every state/lookahead combination that +// +// (1) has not been used by the parser, and +// (2) is not a syntax error. +// +// Return the number of missed state/lookahead combinations. + +// Find the appropriate action for a parser given the terminal +// look-ahead token iLookAhead. +func yy_find_shift_action(tls *libc.TLS, iLookAhead uint16, stateno uint16) uint16 { /* sqlite3.c:160524:21: */ + var i int32 + + if int32(stateno) > YY_MAX_SHIFT { + return stateno + } + + for ok := true; ok; ok = 1 != 0 { + i = int32(yy_shift_ofst[stateno]) + + i = i + (int32(iLookAhead)) + + if int32(yy_lookahead[i]) != int32(iLookAhead) { + var iFallback uint16 // Fallback token + + iFallback = yyFallback[iLookAhead] + if int32(iFallback) != 0 { + // Fallback loop must terminate + iLookAhead = iFallback + continue + } + { + var j int32 = ((i - int32(iLookAhead)) + YYWILDCARD) + + if (int32(yy_lookahead[j]) == YYWILDCARD) && (int32(iLookAhead) > 0) { + return yy_action[j] + } + + } + return yy_default[stateno] + } else { + + return yy_action[i] + } + } + return uint16(0) +} + +// Find the appropriate action for a parser given the non-terminal +// look-ahead token iLookAhead. +func yy_find_reduce_action(tls *libc.TLS, stateno uint16, iLookAhead uint16) uint16 { /* sqlite3.c:160589:21: */ + var i int32 + + i = int32(yy_reduce_ofst[stateno]) + + i = i + (int32(iLookAhead)) + + return yy_action[i] +} + +// The following routine is called if the stack overflows. +func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: */ + + var pParse uintptr = (*YyParser)(unsafe.Pointer(yypParser)).FpParse + for (*YyParser)(unsafe.Pointer(yypParser)).Fyytos > yypParser+16 /* &.yystack */ { + yy_pop_parser_stack(tls, yypParser) + } + // Here code is inserted which will execute if the parser + // stack every overflows + //******* Begin %stack_overflow code ***************************************** + + Xsqlite3ErrorMsg(tls, pParse, ts+21218 /* "parser stack ove..." */, 0) + //******* End %stack_overflow code ******************************************* + + (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse +} + +// Print tracing information for a SHIFT action + +// Perform a shift action. +func yy_shift(tls *libc.TLS, yypParser uintptr, yyNewState uint16, yyMajor uint16, yyMinor Token) { /* sqlite3.c:160661:13: */ + var yytos uintptr + (*YyParser)(unsafe.Pointer(yypParser)).Fyytos += 24 + if (*YyParser)(unsafe.Pointer(yypParser)).Fyytos > (*YyParser)(unsafe.Pointer(yypParser)).FyystackEnd { + (*YyParser)(unsafe.Pointer(yypParser)).Fyytos -= 24 + yyStackOverflow(tls, yypParser) + return + } + if int32(yyNewState) > YY_MAX_SHIFT { + yyNewState = uint16(int32(yyNewState) + (YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE)) + } + yytos = (*YyParser)(unsafe.Pointer(yypParser)).Fyytos + (*YyStackEntry)(unsafe.Pointer(yytos)).Fstateno = yyNewState + (*YyStackEntry)(unsafe.Pointer(yytos)).Fmajor = yyMajor + *(*Token)(unsafe.Pointer(yytos + 8 /* &.minor */)) = yyMinor + +} + +// For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +// of that rule +var yyRuleInfoLhs = [398]uint16{ + uint16(188), // (0) explain ::= EXPLAIN + uint16(188), // (1) explain ::= EXPLAIN QUERY PLAN + uint16(187), // (2) cmdx ::= cmd + uint16(189), // (3) cmd ::= BEGIN transtype trans_opt + uint16(190), // (4) transtype ::= + uint16(190), // (5) transtype ::= DEFERRED + uint16(190), // (6) transtype ::= IMMEDIATE + uint16(190), // (7) transtype ::= EXCLUSIVE + uint16(189), // (8) cmd ::= COMMIT|END trans_opt + uint16(189), // (9) cmd ::= ROLLBACK trans_opt + uint16(189), // (10) cmd ::= SAVEPOINT nm + uint16(189), // (11) cmd ::= RELEASE savepoint_opt nm + uint16(189), // (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm + uint16(194), // (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm + uint16(196), // (14) createkw ::= CREATE + uint16(198), // (15) ifnotexists ::= + uint16(198), // (16) ifnotexists ::= IF NOT EXISTS + uint16(197), // (17) temp ::= TEMP + uint16(197), // (18) temp ::= + uint16(195), // (19) create_table_args ::= LP columnlist conslist_opt RP table_options + uint16(195), // (20) create_table_args ::= AS select + uint16(202), // (21) table_options ::= + uint16(202), // (22) table_options ::= WITHOUT nm + uint16(204), // (23) columnname ::= nm typetoken + uint16(206), // (24) typetoken ::= + uint16(206), // (25) typetoken ::= typename LP signed RP + uint16(206), // (26) typetoken ::= typename LP signed COMMA signed RP + uint16(207), // (27) typename ::= typename ID|STRING + uint16(211), // (28) scanpt ::= + uint16(212), // (29) scantok ::= + uint16(213), // (30) ccons ::= CONSTRAINT nm + uint16(213), // (31) ccons ::= DEFAULT scantok term + uint16(213), // (32) ccons ::= DEFAULT LP expr RP + uint16(213), // (33) ccons ::= DEFAULT PLUS scantok term + uint16(213), // (34) ccons ::= DEFAULT MINUS scantok term + uint16(213), // (35) ccons ::= DEFAULT scantok ID|INDEXED + uint16(213), // (36) ccons ::= NOT NULL onconf + uint16(213), // (37) ccons ::= PRIMARY KEY sortorder onconf autoinc + uint16(213), // (38) ccons ::= UNIQUE onconf + uint16(213), // (39) ccons ::= CHECK LP expr RP + uint16(213), // (40) ccons ::= REFERENCES nm eidlist_opt refargs + uint16(213), // (41) ccons ::= defer_subclause + uint16(213), // (42) ccons ::= COLLATE ID|STRING + uint16(222), // (43) generated ::= LP expr RP + uint16(222), // (44) generated ::= LP expr RP ID + uint16(218), // (45) autoinc ::= + uint16(218), // (46) autoinc ::= AUTOINCR + uint16(220), // (47) refargs ::= + uint16(220), // (48) refargs ::= refargs refarg + uint16(223), // (49) refarg ::= MATCH nm + uint16(223), // (50) refarg ::= ON INSERT refact + uint16(223), // (51) refarg ::= ON DELETE refact + uint16(223), // (52) refarg ::= ON UPDATE refact + uint16(224), // (53) refact ::= SET NULL + uint16(224), // (54) refact ::= SET DEFAULT + uint16(224), // (55) refact ::= CASCADE + uint16(224), // (56) refact ::= RESTRICT + uint16(224), // (57) refact ::= NO ACTION + uint16(221), // (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt + uint16(221), // (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt + uint16(225), // (60) init_deferred_pred_opt ::= + uint16(225), // (61) init_deferred_pred_opt ::= INITIALLY DEFERRED + uint16(225), // (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE + uint16(201), // (63) conslist_opt ::= + uint16(227), // (64) tconscomma ::= COMMA + uint16(228), // (65) tcons ::= CONSTRAINT nm + uint16(228), // (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf + uint16(228), // (67) tcons ::= UNIQUE LP sortlist RP onconf + uint16(228), // (68) tcons ::= CHECK LP expr RP onconf + uint16(228), // (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt + uint16(231), // (70) defer_subclause_opt ::= + uint16(216), // (71) onconf ::= + uint16(216), // (72) onconf ::= ON CONFLICT resolvetype + uint16(232), // (73) orconf ::= + uint16(232), // (74) orconf ::= OR resolvetype + uint16(233), // (75) resolvetype ::= IGNORE + uint16(233), // (76) resolvetype ::= REPLACE + uint16(189), // (77) cmd ::= DROP TABLE ifexists fullname + uint16(235), // (78) ifexists ::= IF EXISTS + uint16(235), // (79) ifexists ::= + uint16(189), // (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select + uint16(189), // (81) cmd ::= DROP VIEW ifexists fullname + uint16(189), // (82) cmd ::= select + uint16(203), // (83) select ::= WITH wqlist selectnowith + uint16(203), // (84) select ::= WITH RECURSIVE wqlist selectnowith + uint16(203), // (85) select ::= selectnowith + uint16(237), // (86) selectnowith ::= selectnowith multiselect_op oneselect + uint16(240), // (87) multiselect_op ::= UNION + uint16(240), // (88) multiselect_op ::= UNION ALL + uint16(240), // (89) multiselect_op ::= EXCEPT|INTERSECT + uint16(238), // (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt + uint16(238), // (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt + uint16(250), // (92) values ::= VALUES LP nexprlist RP + uint16(250), // (93) values ::= values COMMA LP nexprlist RP + uint16(241), // (94) distinct ::= DISTINCT + uint16(241), // (95) distinct ::= ALL + uint16(241), // (96) distinct ::= + uint16(252), // (97) sclp ::= + uint16(242), // (98) selcollist ::= sclp scanpt expr scanpt as + uint16(242), // (99) selcollist ::= sclp scanpt STAR + uint16(242), // (100) selcollist ::= sclp scanpt nm DOT STAR + uint16(253), // (101) as ::= AS nm + uint16(253), // (102) as ::= + uint16(243), // (103) from ::= + uint16(243), // (104) from ::= FROM seltablist + uint16(255), // (105) stl_prefix ::= seltablist joinop + uint16(255), // (106) stl_prefix ::= + uint16(254), // (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt + uint16(254), // (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt + uint16(254), // (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt + uint16(254), // (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt + uint16(199), // (111) dbnm ::= + uint16(199), // (112) dbnm ::= DOT nm + uint16(236), // (113) fullname ::= nm + uint16(236), // (114) fullname ::= nm DOT nm + uint16(261), // (115) xfullname ::= nm + uint16(261), // (116) xfullname ::= nm DOT nm + uint16(261), // (117) xfullname ::= nm DOT nm AS nm + uint16(261), // (118) xfullname ::= nm AS nm + uint16(256), // (119) joinop ::= COMMA|JOIN + uint16(256), // (120) joinop ::= JOIN_KW JOIN + uint16(256), // (121) joinop ::= JOIN_KW nm JOIN + uint16(256), // (122) joinop ::= JOIN_KW nm nm JOIN + uint16(258), // (123) on_opt ::= ON expr + uint16(258), // (124) on_opt ::= + uint16(257), // (125) indexed_opt ::= + uint16(257), // (126) indexed_opt ::= INDEXED BY nm + uint16(257), // (127) indexed_opt ::= NOT INDEXED + uint16(259), // (128) using_opt ::= USING LP idlist RP + uint16(259), // (129) using_opt ::= + uint16(247), // (130) orderby_opt ::= + uint16(247), // (131) orderby_opt ::= ORDER BY sortlist + uint16(229), // (132) sortlist ::= sortlist COMMA expr sortorder nulls + uint16(229), // (133) sortlist ::= expr sortorder nulls + uint16(217), // (134) sortorder ::= ASC + uint16(217), // (135) sortorder ::= DESC + uint16(217), // (136) sortorder ::= + uint16(263), // (137) nulls ::= NULLS FIRST + uint16(263), // (138) nulls ::= NULLS LAST + uint16(263), // (139) nulls ::= + uint16(245), // (140) groupby_opt ::= + uint16(245), // (141) groupby_opt ::= GROUP BY nexprlist + uint16(246), // (142) having_opt ::= + uint16(246), // (143) having_opt ::= HAVING expr + uint16(248), // (144) limit_opt ::= + uint16(248), // (145) limit_opt ::= LIMIT expr + uint16(248), // (146) limit_opt ::= LIMIT expr OFFSET expr + uint16(248), // (147) limit_opt ::= LIMIT expr COMMA expr + uint16(189), // (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret + uint16(244), // (149) where_opt ::= + uint16(244), // (150) where_opt ::= WHERE expr + uint16(265), // (151) where_opt_ret ::= + uint16(265), // (152) where_opt_ret ::= WHERE expr + uint16(265), // (153) where_opt_ret ::= RETURNING selcollist + uint16(265), // (154) where_opt_ret ::= WHERE expr RETURNING selcollist + uint16(189), // (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret + uint16(266), // (156) setlist ::= setlist COMMA nm EQ expr + uint16(266), // (157) setlist ::= setlist COMMA LP idlist RP EQ expr + uint16(266), // (158) setlist ::= nm EQ expr + uint16(266), // (159) setlist ::= LP idlist RP EQ expr + uint16(189), // (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert + uint16(189), // (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning + uint16(269), // (162) upsert ::= + uint16(269), // (163) upsert ::= RETURNING selcollist + uint16(269), // (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert + uint16(269), // (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert + uint16(269), // (166) upsert ::= ON CONFLICT DO NOTHING returning + uint16(269), // (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning + uint16(270), // (168) returning ::= RETURNING selcollist + uint16(267), // (169) insert_cmd ::= INSERT orconf + uint16(267), // (170) insert_cmd ::= REPLACE + uint16(268), // (171) idlist_opt ::= + uint16(268), // (172) idlist_opt ::= LP idlist RP + uint16(262), // (173) idlist ::= idlist COMMA nm + uint16(262), // (174) idlist ::= nm + uint16(215), // (175) expr ::= LP expr RP + uint16(215), // (176) expr ::= ID|INDEXED + uint16(215), // (177) expr ::= JOIN_KW + uint16(215), // (178) expr ::= nm DOT nm + uint16(215), // (179) expr ::= nm DOT nm DOT nm + uint16(214), // (180) term ::= NULL|FLOAT|BLOB + uint16(214), // (181) term ::= STRING + uint16(214), // (182) term ::= INTEGER + uint16(215), // (183) expr ::= VARIABLE + uint16(215), // (184) expr ::= expr COLLATE ID|STRING + uint16(215), // (185) expr ::= CAST LP expr AS typetoken RP + uint16(215), // (186) expr ::= ID|INDEXED LP distinct exprlist RP + uint16(215), // (187) expr ::= ID|INDEXED LP STAR RP + uint16(215), // (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over + uint16(215), // (189) expr ::= ID|INDEXED LP STAR RP filter_over + uint16(214), // (190) term ::= CTIME_KW + uint16(215), // (191) expr ::= LP nexprlist COMMA expr RP + uint16(215), // (192) expr ::= expr AND expr + uint16(215), // (193) expr ::= expr OR expr + uint16(215), // (194) expr ::= expr LT|GT|GE|LE expr + uint16(215), // (195) expr ::= expr EQ|NE expr + uint16(215), // (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr + uint16(215), // (197) expr ::= expr PLUS|MINUS expr + uint16(215), // (198) expr ::= expr STAR|SLASH|REM expr + uint16(215), // (199) expr ::= expr CONCAT expr + uint16(272), // (200) likeop ::= NOT LIKE_KW|MATCH + uint16(215), // (201) expr ::= expr likeop expr + uint16(215), // (202) expr ::= expr likeop expr ESCAPE expr + uint16(215), // (203) expr ::= expr ISNULL|NOTNULL + uint16(215), // (204) expr ::= expr NOT NULL + uint16(215), // (205) expr ::= expr IS expr + uint16(215), // (206) expr ::= expr IS NOT expr + uint16(215), // (207) expr ::= NOT expr + uint16(215), // (208) expr ::= BITNOT expr + uint16(215), // (209) expr ::= PLUS|MINUS expr + uint16(273), // (210) between_op ::= BETWEEN + uint16(273), // (211) between_op ::= NOT BETWEEN + uint16(215), // (212) expr ::= expr between_op expr AND expr + uint16(274), // (213) in_op ::= IN + uint16(274), // (214) in_op ::= NOT IN + uint16(215), // (215) expr ::= expr in_op LP exprlist RP + uint16(215), // (216) expr ::= LP select RP + uint16(215), // (217) expr ::= expr in_op LP select RP + uint16(215), // (218) expr ::= expr in_op nm dbnm paren_exprlist + uint16(215), // (219) expr ::= EXISTS LP select RP + uint16(215), // (220) expr ::= CASE case_operand case_exprlist case_else END + uint16(277), // (221) case_exprlist ::= case_exprlist WHEN expr THEN expr + uint16(277), // (222) case_exprlist ::= WHEN expr THEN expr + uint16(278), // (223) case_else ::= ELSE expr + uint16(278), // (224) case_else ::= + uint16(276), // (225) case_operand ::= expr + uint16(276), // (226) case_operand ::= + uint16(260), // (227) exprlist ::= + uint16(251), // (228) nexprlist ::= nexprlist COMMA expr + uint16(251), // (229) nexprlist ::= expr + uint16(275), // (230) paren_exprlist ::= + uint16(275), // (231) paren_exprlist ::= LP exprlist RP + uint16(189), // (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt + uint16(279), // (233) uniqueflag ::= UNIQUE + uint16(279), // (234) uniqueflag ::= + uint16(219), // (235) eidlist_opt ::= + uint16(219), // (236) eidlist_opt ::= LP eidlist RP + uint16(230), // (237) eidlist ::= eidlist COMMA nm collate sortorder + uint16(230), // (238) eidlist ::= nm collate sortorder + uint16(280), // (239) collate ::= + uint16(280), // (240) collate ::= COLLATE ID|STRING + uint16(189), // (241) cmd ::= DROP INDEX ifexists fullname + uint16(189), // (242) cmd ::= VACUUM vinto + uint16(189), // (243) cmd ::= VACUUM nm vinto + uint16(281), // (244) vinto ::= INTO expr + uint16(281), // (245) vinto ::= + uint16(189), // (246) cmd ::= PRAGMA nm dbnm + uint16(189), // (247) cmd ::= PRAGMA nm dbnm EQ nmnum + uint16(189), // (248) cmd ::= PRAGMA nm dbnm LP nmnum RP + uint16(189), // (249) cmd ::= PRAGMA nm dbnm EQ minus_num + uint16(189), // (250) cmd ::= PRAGMA nm dbnm LP minus_num RP + uint16(209), // (251) plus_num ::= PLUS INTEGER|FLOAT + uint16(210), // (252) minus_num ::= MINUS INTEGER|FLOAT + uint16(189), // (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END + uint16(283), // (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause + uint16(285), // (255) trigger_time ::= BEFORE|AFTER + uint16(285), // (256) trigger_time ::= INSTEAD OF + uint16(285), // (257) trigger_time ::= + uint16(286), // (258) trigger_event ::= DELETE|INSERT + uint16(286), // (259) trigger_event ::= UPDATE + uint16(286), // (260) trigger_event ::= UPDATE OF idlist + uint16(288), // (261) when_clause ::= + uint16(288), // (262) when_clause ::= WHEN expr + uint16(284), // (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI + uint16(284), // (264) trigger_cmd_list ::= trigger_cmd SEMI + uint16(290), // (265) trnm ::= nm DOT nm + uint16(291), // (266) tridxby ::= INDEXED BY nm + uint16(291), // (267) tridxby ::= NOT INDEXED + uint16(289), // (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt + uint16(289), // (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt + uint16(289), // (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt + uint16(289), // (271) trigger_cmd ::= scanpt select scanpt + uint16(215), // (272) expr ::= RAISE LP IGNORE RP + uint16(215), // (273) expr ::= RAISE LP raisetype COMMA nm RP + uint16(234), // (274) raisetype ::= ROLLBACK + uint16(234), // (275) raisetype ::= ABORT + uint16(234), // (276) raisetype ::= FAIL + uint16(189), // (277) cmd ::= DROP TRIGGER ifexists fullname + uint16(189), // (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt + uint16(189), // (279) cmd ::= DETACH database_kw_opt expr + uint16(293), // (280) key_opt ::= + uint16(293), // (281) key_opt ::= KEY expr + uint16(189), // (282) cmd ::= REINDEX + uint16(189), // (283) cmd ::= REINDEX nm dbnm + uint16(189), // (284) cmd ::= ANALYZE + uint16(189), // (285) cmd ::= ANALYZE nm dbnm + uint16(189), // (286) cmd ::= ALTER TABLE fullname RENAME TO nm + uint16(189), // (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist + uint16(189), // (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm + uint16(294), // (289) add_column_fullname ::= fullname + uint16(189), // (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm + uint16(189), // (291) cmd ::= create_vtab + uint16(189), // (292) cmd ::= create_vtab LP vtabarglist RP + uint16(296), // (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm + uint16(298), // (294) vtabarg ::= + uint16(299), // (295) vtabargtoken ::= ANY + uint16(299), // (296) vtabargtoken ::= lp anylist RP + uint16(300), // (297) lp ::= LP + uint16(264), // (298) with ::= WITH wqlist + uint16(264), // (299) with ::= WITH RECURSIVE wqlist + uint16(303), // (300) wqas ::= AS + uint16(303), // (301) wqas ::= AS MATERIALIZED + uint16(303), // (302) wqas ::= AS NOT MATERIALIZED + uint16(302), // (303) wqitem ::= nm eidlist_opt wqas LP select RP + uint16(239), // (304) wqlist ::= wqitem + uint16(239), // (305) wqlist ::= wqlist COMMA wqitem + uint16(304), // (306) windowdefn_list ::= windowdefn + uint16(304), // (307) windowdefn_list ::= windowdefn_list COMMA windowdefn + uint16(305), // (308) windowdefn ::= nm AS LP window RP + uint16(306), // (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt + uint16(306), // (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt + uint16(306), // (311) window ::= ORDER BY sortlist frame_opt + uint16(306), // (312) window ::= nm ORDER BY sortlist frame_opt + uint16(306), // (313) window ::= frame_opt + uint16(306), // (314) window ::= nm frame_opt + uint16(307), // (315) frame_opt ::= + uint16(307), // (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt + uint16(307), // (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt + uint16(311), // (318) range_or_rows ::= RANGE|ROWS|GROUPS + uint16(313), // (319) frame_bound_s ::= frame_bound + uint16(313), // (320) frame_bound_s ::= UNBOUNDED PRECEDING + uint16(314), // (321) frame_bound_e ::= frame_bound + uint16(314), // (322) frame_bound_e ::= UNBOUNDED FOLLOWING + uint16(312), // (323) frame_bound ::= expr PRECEDING|FOLLOWING + uint16(312), // (324) frame_bound ::= CURRENT ROW + uint16(315), // (325) frame_exclude_opt ::= + uint16(315), // (326) frame_exclude_opt ::= EXCLUDE frame_exclude + uint16(316), // (327) frame_exclude ::= NO OTHERS + uint16(316), // (328) frame_exclude ::= CURRENT ROW + uint16(316), // (329) frame_exclude ::= GROUP|TIES + uint16(249), // (330) window_clause ::= WINDOW windowdefn_list + uint16(271), // (331) filter_over ::= filter_clause over_clause + uint16(271), // (332) filter_over ::= over_clause + uint16(271), // (333) filter_over ::= filter_clause + uint16(310), // (334) over_clause ::= OVER LP window RP + uint16(310), // (335) over_clause ::= OVER nm + uint16(309), // (336) filter_clause ::= FILTER LP WHERE expr RP + uint16(184), // (337) input ::= cmdlist + uint16(185), // (338) cmdlist ::= cmdlist ecmd + uint16(185), // (339) cmdlist ::= ecmd + uint16(186), // (340) ecmd ::= SEMI + uint16(186), // (341) ecmd ::= cmdx SEMI + uint16(186), // (342) ecmd ::= explain cmdx SEMI + uint16(191), // (343) trans_opt ::= + uint16(191), // (344) trans_opt ::= TRANSACTION + uint16(191), // (345) trans_opt ::= TRANSACTION nm + uint16(193), // (346) savepoint_opt ::= SAVEPOINT + uint16(193), // (347) savepoint_opt ::= + uint16(189), // (348) cmd ::= create_table create_table_args + uint16(200), // (349) columnlist ::= columnlist COMMA columnname carglist + uint16(200), // (350) columnlist ::= columnname carglist + uint16(192), // (351) nm ::= ID|INDEXED + uint16(192), // (352) nm ::= STRING + uint16(192), // (353) nm ::= JOIN_KW + uint16(206), // (354) typetoken ::= typename + uint16(207), // (355) typename ::= ID|STRING + uint16(208), // (356) signed ::= plus_num + uint16(208), // (357) signed ::= minus_num + uint16(205), // (358) carglist ::= carglist ccons + uint16(205), // (359) carglist ::= + uint16(213), // (360) ccons ::= NULL onconf + uint16(213), // (361) ccons ::= GENERATED ALWAYS AS generated + uint16(213), // (362) ccons ::= AS generated + uint16(201), // (363) conslist_opt ::= COMMA conslist + uint16(226), // (364) conslist ::= conslist tconscomma tcons + uint16(226), // (365) conslist ::= tcons + uint16(227), // (366) tconscomma ::= + uint16(231), // (367) defer_subclause_opt ::= defer_subclause + uint16(233), // (368) resolvetype ::= raisetype + uint16(237), // (369) selectnowith ::= oneselect + uint16(238), // (370) oneselect ::= values + uint16(252), // (371) sclp ::= selcollist COMMA + uint16(253), // (372) as ::= ID|STRING + uint16(270), // (373) returning ::= + uint16(215), // (374) expr ::= term + uint16(272), // (375) likeop ::= LIKE_KW|MATCH + uint16(260), // (376) exprlist ::= nexprlist + uint16(282), // (377) nmnum ::= plus_num + uint16(282), // (378) nmnum ::= nm + uint16(282), // (379) nmnum ::= ON + uint16(282), // (380) nmnum ::= DELETE + uint16(282), // (381) nmnum ::= DEFAULT + uint16(209), // (382) plus_num ::= INTEGER|FLOAT + uint16(287), // (383) foreach_clause ::= + uint16(287), // (384) foreach_clause ::= FOR EACH ROW + uint16(290), // (385) trnm ::= nm + uint16(291), // (386) tridxby ::= + uint16(292), // (387) database_kw_opt ::= DATABASE + uint16(292), // (388) database_kw_opt ::= + uint16(295), // (389) kwcolumn_opt ::= + uint16(295), // (390) kwcolumn_opt ::= COLUMNKW + uint16(297), // (391) vtabarglist ::= vtabarg + uint16(297), // (392) vtabarglist ::= vtabarglist COMMA vtabarg + uint16(298), // (393) vtabarg ::= vtabarg vtabargtoken + uint16(301), // (394) anylist ::= + uint16(301), // (395) anylist ::= anylist LP anylist RP + uint16(301), // (396) anylist ::= anylist ANY + uint16(264), // (397) with ::= +} /* sqlite3.c:160702:25 */ + +// For rule J, yyRuleInfoNRhs[J] contains the negative of the number +// of symbols on the right-hand side of that rule. +var yyRuleInfoNRhs = [398]int8{ + int8(-1), // (0) explain ::= EXPLAIN + int8(-3), // (1) explain ::= EXPLAIN QUERY PLAN + int8(-1), // (2) cmdx ::= cmd + int8(-3), // (3) cmd ::= BEGIN transtype trans_opt + int8(0), // (4) transtype ::= + int8(-1), // (5) transtype ::= DEFERRED + int8(-1), // (6) transtype ::= IMMEDIATE + int8(-1), // (7) transtype ::= EXCLUSIVE + int8(-2), // (8) cmd ::= COMMIT|END trans_opt + int8(-2), // (9) cmd ::= ROLLBACK trans_opt + int8(-2), // (10) cmd ::= SAVEPOINT nm + int8(-3), // (11) cmd ::= RELEASE savepoint_opt nm + int8(-5), // (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm + int8(-6), // (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm + int8(-1), // (14) createkw ::= CREATE + int8(0), // (15) ifnotexists ::= + int8(-3), // (16) ifnotexists ::= IF NOT EXISTS + int8(-1), // (17) temp ::= TEMP + int8(0), // (18) temp ::= + int8(-5), // (19) create_table_args ::= LP columnlist conslist_opt RP table_options + int8(-2), // (20) create_table_args ::= AS select + int8(0), // (21) table_options ::= + int8(-2), // (22) table_options ::= WITHOUT nm + int8(-2), // (23) columnname ::= nm typetoken + int8(0), // (24) typetoken ::= + int8(-4), // (25) typetoken ::= typename LP signed RP + int8(-6), // (26) typetoken ::= typename LP signed COMMA signed RP + int8(-2), // (27) typename ::= typename ID|STRING + int8(0), // (28) scanpt ::= + int8(0), // (29) scantok ::= + int8(-2), // (30) ccons ::= CONSTRAINT nm + int8(-3), // (31) ccons ::= DEFAULT scantok term + int8(-4), // (32) ccons ::= DEFAULT LP expr RP + int8(-4), // (33) ccons ::= DEFAULT PLUS scantok term + int8(-4), // (34) ccons ::= DEFAULT MINUS scantok term + int8(-3), // (35) ccons ::= DEFAULT scantok ID|INDEXED + int8(-3), // (36) ccons ::= NOT NULL onconf + int8(-5), // (37) ccons ::= PRIMARY KEY sortorder onconf autoinc + int8(-2), // (38) ccons ::= UNIQUE onconf + int8(-4), // (39) ccons ::= CHECK LP expr RP + int8(-4), // (40) ccons ::= REFERENCES nm eidlist_opt refargs + int8(-1), // (41) ccons ::= defer_subclause + int8(-2), // (42) ccons ::= COLLATE ID|STRING + int8(-3), // (43) generated ::= LP expr RP + int8(-4), // (44) generated ::= LP expr RP ID + int8(0), // (45) autoinc ::= + int8(-1), // (46) autoinc ::= AUTOINCR + int8(0), // (47) refargs ::= + int8(-2), // (48) refargs ::= refargs refarg + int8(-2), // (49) refarg ::= MATCH nm + int8(-3), // (50) refarg ::= ON INSERT refact + int8(-3), // (51) refarg ::= ON DELETE refact + int8(-3), // (52) refarg ::= ON UPDATE refact + int8(-2), // (53) refact ::= SET NULL + int8(-2), // (54) refact ::= SET DEFAULT + int8(-1), // (55) refact ::= CASCADE + int8(-1), // (56) refact ::= RESTRICT + int8(-2), // (57) refact ::= NO ACTION + int8(-3), // (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt + int8(-2), // (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt + int8(0), // (60) init_deferred_pred_opt ::= + int8(-2), // (61) init_deferred_pred_opt ::= INITIALLY DEFERRED + int8(-2), // (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE + int8(0), // (63) conslist_opt ::= + int8(-1), // (64) tconscomma ::= COMMA + int8(-2), // (65) tcons ::= CONSTRAINT nm + int8(-7), // (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf + int8(-5), // (67) tcons ::= UNIQUE LP sortlist RP onconf + int8(-5), // (68) tcons ::= CHECK LP expr RP onconf + int8(-10), // (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt + int8(0), // (70) defer_subclause_opt ::= + int8(0), // (71) onconf ::= + int8(-3), // (72) onconf ::= ON CONFLICT resolvetype + int8(0), // (73) orconf ::= + int8(-2), // (74) orconf ::= OR resolvetype + int8(-1), // (75) resolvetype ::= IGNORE + int8(-1), // (76) resolvetype ::= REPLACE + int8(-4), // (77) cmd ::= DROP TABLE ifexists fullname + int8(-2), // (78) ifexists ::= IF EXISTS + int8(0), // (79) ifexists ::= + int8(-9), // (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select + int8(-4), // (81) cmd ::= DROP VIEW ifexists fullname + int8(-1), // (82) cmd ::= select + int8(-3), // (83) select ::= WITH wqlist selectnowith + int8(-4), // (84) select ::= WITH RECURSIVE wqlist selectnowith + int8(-1), // (85) select ::= selectnowith + int8(-3), // (86) selectnowith ::= selectnowith multiselect_op oneselect + int8(-1), // (87) multiselect_op ::= UNION + int8(-2), // (88) multiselect_op ::= UNION ALL + int8(-1), // (89) multiselect_op ::= EXCEPT|INTERSECT + int8(-9), // (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt + int8(-10), // (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt + int8(-4), // (92) values ::= VALUES LP nexprlist RP + int8(-5), // (93) values ::= values COMMA LP nexprlist RP + int8(-1), // (94) distinct ::= DISTINCT + int8(-1), // (95) distinct ::= ALL + int8(0), // (96) distinct ::= + int8(0), // (97) sclp ::= + int8(-5), // (98) selcollist ::= sclp scanpt expr scanpt as + int8(-3), // (99) selcollist ::= sclp scanpt STAR + int8(-5), // (100) selcollist ::= sclp scanpt nm DOT STAR + int8(-2), // (101) as ::= AS nm + int8(0), // (102) as ::= + int8(0), // (103) from ::= + int8(-2), // (104) from ::= FROM seltablist + int8(-2), // (105) stl_prefix ::= seltablist joinop + int8(0), // (106) stl_prefix ::= + int8(-7), // (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt + int8(-9), // (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt + int8(-7), // (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt + int8(-7), // (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt + int8(0), // (111) dbnm ::= + int8(-2), // (112) dbnm ::= DOT nm + int8(-1), // (113) fullname ::= nm + int8(-3), // (114) fullname ::= nm DOT nm + int8(-1), // (115) xfullname ::= nm + int8(-3), // (116) xfullname ::= nm DOT nm + int8(-5), // (117) xfullname ::= nm DOT nm AS nm + int8(-3), // (118) xfullname ::= nm AS nm + int8(-1), // (119) joinop ::= COMMA|JOIN + int8(-2), // (120) joinop ::= JOIN_KW JOIN + int8(-3), // (121) joinop ::= JOIN_KW nm JOIN + int8(-4), // (122) joinop ::= JOIN_KW nm nm JOIN + int8(-2), // (123) on_opt ::= ON expr + int8(0), // (124) on_opt ::= + int8(0), // (125) indexed_opt ::= + int8(-3), // (126) indexed_opt ::= INDEXED BY nm + int8(-2), // (127) indexed_opt ::= NOT INDEXED + int8(-4), // (128) using_opt ::= USING LP idlist RP + int8(0), // (129) using_opt ::= + int8(0), // (130) orderby_opt ::= + int8(-3), // (131) orderby_opt ::= ORDER BY sortlist + int8(-5), // (132) sortlist ::= sortlist COMMA expr sortorder nulls + int8(-3), // (133) sortlist ::= expr sortorder nulls + int8(-1), // (134) sortorder ::= ASC + int8(-1), // (135) sortorder ::= DESC + int8(0), // (136) sortorder ::= + int8(-2), // (137) nulls ::= NULLS FIRST + int8(-2), // (138) nulls ::= NULLS LAST + int8(0), // (139) nulls ::= + int8(0), // (140) groupby_opt ::= + int8(-3), // (141) groupby_opt ::= GROUP BY nexprlist + int8(0), // (142) having_opt ::= + int8(-2), // (143) having_opt ::= HAVING expr + int8(0), // (144) limit_opt ::= + int8(-2), // (145) limit_opt ::= LIMIT expr + int8(-4), // (146) limit_opt ::= LIMIT expr OFFSET expr + int8(-4), // (147) limit_opt ::= LIMIT expr COMMA expr + int8(-6), // (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret + int8(0), // (149) where_opt ::= + int8(-2), // (150) where_opt ::= WHERE expr + int8(0), // (151) where_opt_ret ::= + int8(-2), // (152) where_opt_ret ::= WHERE expr + int8(-2), // (153) where_opt_ret ::= RETURNING selcollist + int8(-4), // (154) where_opt_ret ::= WHERE expr RETURNING selcollist + int8(-9), // (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret + int8(-5), // (156) setlist ::= setlist COMMA nm EQ expr + int8(-7), // (157) setlist ::= setlist COMMA LP idlist RP EQ expr + int8(-3), // (158) setlist ::= nm EQ expr + int8(-5), // (159) setlist ::= LP idlist RP EQ expr + int8(-7), // (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert + int8(-8), // (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning + int8(0), // (162) upsert ::= + int8(-2), // (163) upsert ::= RETURNING selcollist + int8(-12), // (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert + int8(-9), // (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert + int8(-5), // (166) upsert ::= ON CONFLICT DO NOTHING returning + int8(-8), // (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning + int8(-2), // (168) returning ::= RETURNING selcollist + int8(-2), // (169) insert_cmd ::= INSERT orconf + int8(-1), // (170) insert_cmd ::= REPLACE + int8(0), // (171) idlist_opt ::= + int8(-3), // (172) idlist_opt ::= LP idlist RP + int8(-3), // (173) idlist ::= idlist COMMA nm + int8(-1), // (174) idlist ::= nm + int8(-3), // (175) expr ::= LP expr RP + int8(-1), // (176) expr ::= ID|INDEXED + int8(-1), // (177) expr ::= JOIN_KW + int8(-3), // (178) expr ::= nm DOT nm + int8(-5), // (179) expr ::= nm DOT nm DOT nm + int8(-1), // (180) term ::= NULL|FLOAT|BLOB + int8(-1), // (181) term ::= STRING + int8(-1), // (182) term ::= INTEGER + int8(-1), // (183) expr ::= VARIABLE + int8(-3), // (184) expr ::= expr COLLATE ID|STRING + int8(-6), // (185) expr ::= CAST LP expr AS typetoken RP + int8(-5), // (186) expr ::= ID|INDEXED LP distinct exprlist RP + int8(-4), // (187) expr ::= ID|INDEXED LP STAR RP + int8(-6), // (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over + int8(-5), // (189) expr ::= ID|INDEXED LP STAR RP filter_over + int8(-1), // (190) term ::= CTIME_KW + int8(-5), // (191) expr ::= LP nexprlist COMMA expr RP + int8(-3), // (192) expr ::= expr AND expr + int8(-3), // (193) expr ::= expr OR expr + int8(-3), // (194) expr ::= expr LT|GT|GE|LE expr + int8(-3), // (195) expr ::= expr EQ|NE expr + int8(-3), // (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr + int8(-3), // (197) expr ::= expr PLUS|MINUS expr + int8(-3), // (198) expr ::= expr STAR|SLASH|REM expr + int8(-3), // (199) expr ::= expr CONCAT expr + int8(-2), // (200) likeop ::= NOT LIKE_KW|MATCH + int8(-3), // (201) expr ::= expr likeop expr + int8(-5), // (202) expr ::= expr likeop expr ESCAPE expr + int8(-2), // (203) expr ::= expr ISNULL|NOTNULL + int8(-3), // (204) expr ::= expr NOT NULL + int8(-3), // (205) expr ::= expr IS expr + int8(-4), // (206) expr ::= expr IS NOT expr + int8(-2), // (207) expr ::= NOT expr + int8(-2), // (208) expr ::= BITNOT expr + int8(-2), // (209) expr ::= PLUS|MINUS expr + int8(-1), // (210) between_op ::= BETWEEN + int8(-2), // (211) between_op ::= NOT BETWEEN + int8(-5), // (212) expr ::= expr between_op expr AND expr + int8(-1), // (213) in_op ::= IN + int8(-2), // (214) in_op ::= NOT IN + int8(-5), // (215) expr ::= expr in_op LP exprlist RP + int8(-3), // (216) expr ::= LP select RP + int8(-5), // (217) expr ::= expr in_op LP select RP + int8(-5), // (218) expr ::= expr in_op nm dbnm paren_exprlist + int8(-4), // (219) expr ::= EXISTS LP select RP + int8(-5), // (220) expr ::= CASE case_operand case_exprlist case_else END + int8(-5), // (221) case_exprlist ::= case_exprlist WHEN expr THEN expr + int8(-4), // (222) case_exprlist ::= WHEN expr THEN expr + int8(-2), // (223) case_else ::= ELSE expr + int8(0), // (224) case_else ::= + int8(-1), // (225) case_operand ::= expr + int8(0), // (226) case_operand ::= + int8(0), // (227) exprlist ::= + int8(-3), // (228) nexprlist ::= nexprlist COMMA expr + int8(-1), // (229) nexprlist ::= expr + int8(0), // (230) paren_exprlist ::= + int8(-3), // (231) paren_exprlist ::= LP exprlist RP + int8(-12), // (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt + int8(-1), // (233) uniqueflag ::= UNIQUE + int8(0), // (234) uniqueflag ::= + int8(0), // (235) eidlist_opt ::= + int8(-3), // (236) eidlist_opt ::= LP eidlist RP + int8(-5), // (237) eidlist ::= eidlist COMMA nm collate sortorder + int8(-3), // (238) eidlist ::= nm collate sortorder + int8(0), // (239) collate ::= + int8(-2), // (240) collate ::= COLLATE ID|STRING + int8(-4), // (241) cmd ::= DROP INDEX ifexists fullname + int8(-2), // (242) cmd ::= VACUUM vinto + int8(-3), // (243) cmd ::= VACUUM nm vinto + int8(-2), // (244) vinto ::= INTO expr + int8(0), // (245) vinto ::= + int8(-3), // (246) cmd ::= PRAGMA nm dbnm + int8(-5), // (247) cmd ::= PRAGMA nm dbnm EQ nmnum + int8(-6), // (248) cmd ::= PRAGMA nm dbnm LP nmnum RP + int8(-5), // (249) cmd ::= PRAGMA nm dbnm EQ minus_num + int8(-6), // (250) cmd ::= PRAGMA nm dbnm LP minus_num RP + int8(-2), // (251) plus_num ::= PLUS INTEGER|FLOAT + int8(-2), // (252) minus_num ::= MINUS INTEGER|FLOAT + int8(-5), // (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END + int8(-11), // (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause + int8(-1), // (255) trigger_time ::= BEFORE|AFTER + int8(-2), // (256) trigger_time ::= INSTEAD OF + int8(0), // (257) trigger_time ::= + int8(-1), // (258) trigger_event ::= DELETE|INSERT + int8(-1), // (259) trigger_event ::= UPDATE + int8(-3), // (260) trigger_event ::= UPDATE OF idlist + int8(0), // (261) when_clause ::= + int8(-2), // (262) when_clause ::= WHEN expr + int8(-3), // (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI + int8(-2), // (264) trigger_cmd_list ::= trigger_cmd SEMI + int8(-3), // (265) trnm ::= nm DOT nm + int8(-3), // (266) tridxby ::= INDEXED BY nm + int8(-2), // (267) tridxby ::= NOT INDEXED + int8(-9), // (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt + int8(-8), // (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt + int8(-6), // (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt + int8(-3), // (271) trigger_cmd ::= scanpt select scanpt + int8(-4), // (272) expr ::= RAISE LP IGNORE RP + int8(-6), // (273) expr ::= RAISE LP raisetype COMMA nm RP + int8(-1), // (274) raisetype ::= ROLLBACK + int8(-1), // (275) raisetype ::= ABORT + int8(-1), // (276) raisetype ::= FAIL + int8(-4), // (277) cmd ::= DROP TRIGGER ifexists fullname + int8(-6), // (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt + int8(-3), // (279) cmd ::= DETACH database_kw_opt expr + int8(0), // (280) key_opt ::= + int8(-2), // (281) key_opt ::= KEY expr + int8(-1), // (282) cmd ::= REINDEX + int8(-3), // (283) cmd ::= REINDEX nm dbnm + int8(-1), // (284) cmd ::= ANALYZE + int8(-3), // (285) cmd ::= ANALYZE nm dbnm + int8(-6), // (286) cmd ::= ALTER TABLE fullname RENAME TO nm + int8(-7), // (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist + int8(-6), // (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm + int8(-1), // (289) add_column_fullname ::= fullname + int8(-8), // (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm + int8(-1), // (291) cmd ::= create_vtab + int8(-4), // (292) cmd ::= create_vtab LP vtabarglist RP + int8(-8), // (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm + int8(0), // (294) vtabarg ::= + int8(-1), // (295) vtabargtoken ::= ANY + int8(-3), // (296) vtabargtoken ::= lp anylist RP + int8(-1), // (297) lp ::= LP + int8(-2), // (298) with ::= WITH wqlist + int8(-3), // (299) with ::= WITH RECURSIVE wqlist + int8(-1), // (300) wqas ::= AS + int8(-2), // (301) wqas ::= AS MATERIALIZED + int8(-3), // (302) wqas ::= AS NOT MATERIALIZED + int8(-6), // (303) wqitem ::= nm eidlist_opt wqas LP select RP + int8(-1), // (304) wqlist ::= wqitem + int8(-3), // (305) wqlist ::= wqlist COMMA wqitem + int8(-1), // (306) windowdefn_list ::= windowdefn + int8(-3), // (307) windowdefn_list ::= windowdefn_list COMMA windowdefn + int8(-5), // (308) windowdefn ::= nm AS LP window RP + int8(-5), // (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt + int8(-6), // (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt + int8(-4), // (311) window ::= ORDER BY sortlist frame_opt + int8(-5), // (312) window ::= nm ORDER BY sortlist frame_opt + int8(-1), // (313) window ::= frame_opt + int8(-2), // (314) window ::= nm frame_opt + int8(0), // (315) frame_opt ::= + int8(-3), // (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt + int8(-6), // (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt + int8(-1), // (318) range_or_rows ::= RANGE|ROWS|GROUPS + int8(-1), // (319) frame_bound_s ::= frame_bound + int8(-2), // (320) frame_bound_s ::= UNBOUNDED PRECEDING + int8(-1), // (321) frame_bound_e ::= frame_bound + int8(-2), // (322) frame_bound_e ::= UNBOUNDED FOLLOWING + int8(-2), // (323) frame_bound ::= expr PRECEDING|FOLLOWING + int8(-2), // (324) frame_bound ::= CURRENT ROW + int8(0), // (325) frame_exclude_opt ::= + int8(-2), // (326) frame_exclude_opt ::= EXCLUDE frame_exclude + int8(-2), // (327) frame_exclude ::= NO OTHERS + int8(-2), // (328) frame_exclude ::= CURRENT ROW + int8(-1), // (329) frame_exclude ::= GROUP|TIES + int8(-2), // (330) window_clause ::= WINDOW windowdefn_list + int8(-2), // (331) filter_over ::= filter_clause over_clause + int8(-1), // (332) filter_over ::= over_clause + int8(-1), // (333) filter_over ::= filter_clause + int8(-4), // (334) over_clause ::= OVER LP window RP + int8(-2), // (335) over_clause ::= OVER nm + int8(-5), // (336) filter_clause ::= FILTER LP WHERE expr RP + int8(-1), // (337) input ::= cmdlist + int8(-2), // (338) cmdlist ::= cmdlist ecmd + int8(-1), // (339) cmdlist ::= ecmd + int8(-1), // (340) ecmd ::= SEMI + int8(-2), // (341) ecmd ::= cmdx SEMI + int8(-3), // (342) ecmd ::= explain cmdx SEMI + int8(0), // (343) trans_opt ::= + int8(-1), // (344) trans_opt ::= TRANSACTION + int8(-2), // (345) trans_opt ::= TRANSACTION nm + int8(-1), // (346) savepoint_opt ::= SAVEPOINT + int8(0), // (347) savepoint_opt ::= + int8(-2), // (348) cmd ::= create_table create_table_args + int8(-4), // (349) columnlist ::= columnlist COMMA columnname carglist + int8(-2), // (350) columnlist ::= columnname carglist + int8(-1), // (351) nm ::= ID|INDEXED + int8(-1), // (352) nm ::= STRING + int8(-1), // (353) nm ::= JOIN_KW + int8(-1), // (354) typetoken ::= typename + int8(-1), // (355) typename ::= ID|STRING + int8(-1), // (356) signed ::= plus_num + int8(-1), // (357) signed ::= minus_num + int8(-2), // (358) carglist ::= carglist ccons + int8(0), // (359) carglist ::= + int8(-2), // (360) ccons ::= NULL onconf + int8(-4), // (361) ccons ::= GENERATED ALWAYS AS generated + int8(-2), // (362) ccons ::= AS generated + int8(-2), // (363) conslist_opt ::= COMMA conslist + int8(-3), // (364) conslist ::= conslist tconscomma tcons + int8(-1), // (365) conslist ::= tcons + int8(0), // (366) tconscomma ::= + int8(-1), // (367) defer_subclause_opt ::= defer_subclause + int8(-1), // (368) resolvetype ::= raisetype + int8(-1), // (369) selectnowith ::= oneselect + int8(-1), // (370) oneselect ::= values + int8(-2), // (371) sclp ::= selcollist COMMA + int8(-1), // (372) as ::= ID|STRING + int8(0), // (373) returning ::= + int8(-1), // (374) expr ::= term + int8(-1), // (375) likeop ::= LIKE_KW|MATCH + int8(-1), // (376) exprlist ::= nexprlist + int8(-1), // (377) nmnum ::= plus_num + int8(-1), // (378) nmnum ::= nm + int8(-1), // (379) nmnum ::= ON + int8(-1), // (380) nmnum ::= DELETE + int8(-1), // (381) nmnum ::= DEFAULT + int8(-1), // (382) plus_num ::= INTEGER|FLOAT + int8(0), // (383) foreach_clause ::= + int8(-3), // (384) foreach_clause ::= FOR EACH ROW + int8(-1), // (385) trnm ::= nm + int8(0), // (386) tridxby ::= + int8(-1), // (387) database_kw_opt ::= DATABASE + int8(0), // (388) database_kw_opt ::= + int8(0), // (389) kwcolumn_opt ::= + int8(-1), // (390) kwcolumn_opt ::= COLUMNKW + int8(-1), // (391) vtabarglist ::= vtabarg + int8(-3), // (392) vtabarglist ::= vtabarglist COMMA vtabarg + int8(-2), // (393) vtabarg ::= vtabarg vtabargtoken + int8(0), // (394) anylist ::= + int8(-4), // (395) anylist ::= anylist LP anylist RP + int8(-2), // (396) anylist ::= anylist ANY + int8(0), // (397) with ::= +} /* sqlite3.c:161105:26 */ + +// Forward Declaration + +// Perform a reduce action and the shift that must immediately +// follow the reduce. +// +// The yyLookahead and yyLookaheadToken parameters provide reduce actions +// access to the lookahead token (if any). The yyLookahead will be YYNOCODE +// if the lookahead token has already been consumed. As this procedure is +// only called from one place, optimizing compilers will in-line it, which +// means that the extra parameters have no performance impact. +func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead int32, yyLookaheadToken Token, pParse uintptr) uint16 { /* sqlite3.c:161518:21: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + var yygoto int32 // The next state + var yyact uint16 // The next action + var yymsp uintptr // The top of the parser's stack + var yysize int32 // Amount to pop the stack + + _ = yyLookahead + _ = yyLookaheadToken + yymsp = (*YyParser)(unsafe.Pointer(yypParser)).Fyytos + + switch yyruleno { + // Beginning here are the reduction cases. A typical example + // follows: + // case 0: + // #line + // { ... } // User supplied code + // #line + // break; + //********* Begin reduce actions ********************************************* + // var yylhsminor YYMINORTYPE at bp+80, 16 + + case uint32(0): /* explain ::= EXPLAIN */ + { + (*Parse)(unsafe.Pointer(pParse)).Fexplain = U8(1) + } + break + case uint32(1): /* explain ::= EXPLAIN QUERY PLAN */ + { + (*Parse)(unsafe.Pointer(pParse)).Fexplain = U8(2) + } + break + case uint32(2): /* cmdx ::= cmd */ + { + Xsqlite3FinishCoding(tls, pParse) + } + break + case uint32(3): /* cmd ::= BEGIN transtype trans_opt */ + { + Xsqlite3BeginTransaction(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(4): /* transtype ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = TK_DEFERRED + } + break + case uint32(5): + fallthrough // transtype ::= DEFERRED + case uint32(6): /* transtype ::= IMMEDIATE */ + fallthrough + case uint32(7): /* transtype ::= EXCLUSIVE */ + fallthrough + case uint32(318): /* range_or_rows ::= RANGE|ROWS|GROUPS */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) /*A-overwrites-X*/ + } + break + case uint32(8): + fallthrough // cmd ::= COMMIT|END trans_opt + case uint32(9): /* cmd ::= ROLLBACK trans_opt */ + { + Xsqlite3EndTransaction(tls, pParse, int32((*YyStackEntry)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24)).Fmajor)) + } + break + case uint32(10): /* cmd ::= SAVEPOINT nm */ + { + Xsqlite3Savepoint(tls, pParse, SAVEPOINT_BEGIN, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(11): /* cmd ::= RELEASE savepoint_opt nm */ + { + Xsqlite3Savepoint(tls, pParse, SAVEPOINT_RELEASE, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(12): /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ + { + Xsqlite3Savepoint(tls, pParse, SAVEPOINT_ROLLBACK, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(13): /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ + { + Xsqlite3StartTable(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), 0, 0, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + } + break + case uint32(14): /* createkw ::= CREATE */ + { + disableLookaside(tls, pParse) + } + break + case uint32(15): + fallthrough // ifnotexists ::= + case uint32(18): /* temp ::= */ + fallthrough + case uint32(21): /* table_options ::= */ + fallthrough + case uint32(45): /* autoinc ::= */ + fallthrough + case uint32(60): /* init_deferred_pred_opt ::= */ + fallthrough + case uint32(70): /* defer_subclause_opt ::= */ + fallthrough + case uint32(79): /* ifexists ::= */ + fallthrough + case uint32(96): /* distinct ::= */ + fallthrough + case uint32(239): /* collate ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = 0 + } + break + case uint32(16): /* ifnotexists ::= IF NOT EXISTS */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = 1 + } + break + case uint32(17): /* temp ::= TEMP */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = (libc.Bool32(int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0)) + } + break + case uint32(19): /* create_table_args ::= LP columnlist conslist_opt RP table_options */ + { + Xsqlite3EndTable(tls, pParse, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), uint8(*(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))), uintptr(0)) + } + break + case uint32(20): /* create_table_args ::= AS select */ + { + Xsqlite3EndTable(tls, pParse, uintptr(0), uintptr(0), uint8(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(22): /* table_options ::= WITHOUT nm */ + { + if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+14758 /* "rowid" */, 5) == 0) { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) + } else { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 + Xsqlite3ErrorMsg(tls, pParse, ts+21240 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) + } + } + break + case uint32(23): /* columnname ::= nm typetoken */ + { + Xsqlite3AddColumn(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(24): + fallthrough // typetoken ::= + case uint32(63): /* conslist_opt ::= */ + fallthrough + case uint32(102): /* as ::= */ + { + (*Token)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)).Fn = uint32(0) + (*Token)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)).Fz = uintptr(0) + } + break + case uint32(25): /* typetoken ::= typename LP signed RP */ + { + (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)).Fn = uint32((int32((int64(((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz + uintptr((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn))) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).Fz)) / 1))) + } + break + case uint32(26): /* typetoken ::= typename LP signed COMMA signed RP */ + { + (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)).Fn = uint32((int32((int64(((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz + uintptr((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn))) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-5)*24+8 /* &.minor */)).Fz)) / 1))) + } + break + case uint32(27): /* typename ::= typename ID|STRING */ + { + (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)).Fn = ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn + uint32((int32((int64((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz)) / 1)))) + } + break + case uint32(28): /* scanpt ::= */ + { + + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = yyLookaheadToken.Fz + } + break + case uint32(29): /* scantok ::= */ + { + + *(*Token)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = yyLookaheadToken + } + break + case uint32(30): + fallthrough // ccons ::= CONSTRAINT nm + case uint32(65): /* tcons ::= CONSTRAINT nm */ + { + (*Parse)(unsafe.Pointer(pParse)).FconstraintName = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(31): /* ccons ::= DEFAULT scantok term */ + { + Xsqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz, ((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz + uintptr((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fn))) + } + break + case uint32(32): /* ccons ::= DEFAULT LP expr RP */ + { + Xsqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), ((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-2)*24+8 /* &.minor */)).Fz + uintptr(1)), (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz) + } + break + case uint32(33): /* ccons ::= DEFAULT PLUS scantok term */ + { + Xsqlite3AddDefaultValue(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-2)*24+8 /* &.minor */)).Fz, ((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz + uintptr((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fn))) + } + break + case uint32(34): /* ccons ::= DEFAULT MINUS scantok term */ + { + var p uintptr = Xsqlite3PExpr(tls, pParse, TK_UMINUS, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0)) + Xsqlite3AddDefaultValue(tls, pParse, p, (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-2)*24+8 /* &.minor */)).Fz, ((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz + uintptr((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fn))) + } + break + case uint32(35): /* ccons ::= DEFAULT scantok ID|INDEXED */ + { + var p uintptr = tokenExpr(tls, pParse, TK_STRING, *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + if p != 0 { + Xsqlite3ExprIdToTrueFalse(tls, p) + + } + Xsqlite3AddDefaultValue(tls, pParse, p, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz + uintptr((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn))) + } + break + case uint32(36): /* ccons ::= NOT NULL onconf */ + { + Xsqlite3AddNotNull(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(37): /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ + { + Xsqlite3AddPrimaryKey(tls, pParse, uintptr(0), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + } + break + case uint32(38): /* ccons ::= UNIQUE onconf */ + { + Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), uintptr(0), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), uintptr(0), 0, 0, + uint8(SQLITE_IDXTYPE_UNIQUE)) + } + break + case uint32(39): /* ccons ::= CHECK LP expr RP */ + { + Xsqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-2)*24+8 /* &.minor */)).Fz, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz) + } + break + case uint32(40): /* ccons ::= REFERENCES nm eidlist_opt refargs */ + { + Xsqlite3CreateForeignKey(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(41): /* ccons ::= defer_subclause */ + { + Xsqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(42): /* ccons ::= COLLATE ID|STRING */ + { + Xsqlite3AddCollateType(tls, pParse, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(43): /* generated ::= LP expr RP */ + { + Xsqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(44): /* generated ::= LP expr RP ID */ + { + Xsqlite3AddGenerated(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(46): /* autoinc ::= AUTOINCR */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = 1 + } + break + case uint32(47): /* refargs ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = (OE_None * 0x0101) /* EV: R-19803-45884 */ + } + break + case uint32(48): /* refargs ::= refargs refarg */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = ((*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) & ^*(*int32)(unsafe.Pointer((yymsp + 8 /* &.minor */ /* &.yy139 */) + 4 /* &.mask */))) | *(*int32)(unsafe.Pointer((yymsp + 8 /* &.minor */ /* &.yy139 */) /* &.value */))) + } + break + case uint32(49): /* refarg ::= MATCH nm */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy139 */ /* &.value */)) = 0 + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy139 */ + 4 /* &.mask */)) = 0x000000 + } + break + case uint32(50): /* refarg ::= ON INSERT refact */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy139 */ /* &.value */)) = 0 + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy139 */ + 4 /* &.mask */)) = 0x000000 + } + break + case uint32(51): /* refarg ::= ON DELETE refact */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy139 */ /* &.value */)) = *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy139 */ + 4 /* &.mask */)) = 0x0000ff + } + break + case uint32(52): /* refarg ::= ON UPDATE refact */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy139 */ /* &.value */)) = (*(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) << 8) + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy139 */ + 4 /* &.mask */)) = 0x00ff00 + } + break + case uint32(53): /* refact ::= SET NULL */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = OE_SetNull /* EV: R-33326-45252 */ + } + break + case uint32(54): /* refact ::= SET DEFAULT */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = OE_SetDflt /* EV: R-33326-45252 */ + } + break + case uint32(55): /* refact ::= CASCADE */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Cascade /* EV: R-33326-45252 */ + } + break + case uint32(56): /* refact ::= RESTRICT */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Restrict /* EV: R-33326-45252 */ + } + break + case uint32(57): /* refact ::= NO ACTION */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = OE_None /* EV: R-33326-45252 */ + } + break + case uint32(58): /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = 0 + } + break + case uint32(59): + fallthrough // defer_subclause ::= DEFERRABLE init_deferred_pred_opt + case uint32(74): /* orconf ::= OR resolvetype */ + fallthrough + case uint32(169): /* insert_cmd ::= INSERT orconf */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(61): + fallthrough // init_deferred_pred_opt ::= INITIALLY DEFERRED + case uint32(78): /* ifexists ::= IF EXISTS */ + fallthrough + case uint32(211): /* between_op ::= NOT BETWEEN */ + fallthrough + case uint32(214): /* in_op ::= NOT IN */ + fallthrough + case uint32(240): /* collate ::= COLLATE ID|STRING */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 1 + } + break + case uint32(62): /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 + } + break + case uint32(64): /* tconscomma ::= COMMA */ + { + (*Parse)(unsafe.Pointer(pParse)).FconstraintName.Fn = uint32(0) + } + break + case uint32(66): /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ + { + Xsqlite3AddPrimaryKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), 0) + } + break + case uint32(67): /* tcons ::= UNIQUE LP sortlist RP onconf */ + { + Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), uintptr(0), 0, 0, + uint8(SQLITE_IDXTYPE_UNIQUE)) + } + break + case uint32(68): /* tcons ::= CHECK LP expr RP onconf */ + { + Xsqlite3AddCheckConstraint(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).Fz, (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz) + } + break + case uint32(69): /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + { + Xsqlite3CreateForeignKey(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + Xsqlite3DeferForeignKey(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(71): + fallthrough // onconf ::= + case uint32(73): /* orconf ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = OE_Default + } + break + case uint32(72): /* onconf ::= ON CONFLICT resolvetype */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(75): /* resolvetype ::= IGNORE */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Ignore + } + break + case uint32(76): + fallthrough // resolvetype ::= REPLACE + case uint32(170): /* insert_cmd ::= REPLACE */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Replace + } + break + case uint32(77): /* cmd ::= DROP TABLE ifexists fullname */ + { + Xsqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), 0, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(80): /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + { + Xsqlite3CreateView(tls, pParse, (yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */))) + } + break + case uint32(81): /* cmd ::= DROP VIEW ifexists fullname */ + { + Xsqlite3DropTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), 1, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(82): /* cmd ::= select */ + { + *(*SelectDest)(unsafe.Pointer(bp + 24 /* dest */)) = SelectDest{FeDest: U8(SRT_Output)} + Xsqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), bp+24 /* &dest */) + Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(83): /* select ::= WITH wqlist selectnowith */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(84): /* select ::= WITH RECURSIVE wqlist selectnowith */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = attachWithToSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(85): /* select ::= selectnowith */ + { + var p uintptr = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + if p != 0 { + parserDoubleLinkSelect(tls, pParse, p) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = p //A-overwrites-X + } + break + case uint32(86): /* selectnowith ::= selectnowith multiselect_op oneselect */ + { + var pRhs uintptr = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + var pLhs uintptr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + if (pRhs != 0) && ((*Select)(unsafe.Pointer(pRhs)).FpPrior != 0) { + var pFrom uintptr + // var x Token at bp+64, 16 + + (*Token)(unsafe.Pointer(bp + 64 /* &x */)).Fn = uint32(0) + parserDoubleLinkSelect(tls, pParse, pRhs) + pFrom = Xsqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp+64 /* &x */, pRhs, uintptr(0), uintptr(0)) + pRhs = Xsqlite3SelectNew(tls, pParse, uintptr(0), pFrom, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + } + if pRhs != 0 { + (*Select)(unsafe.Pointer(pRhs)).Fop = U8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + (*Select)(unsafe.Pointer(pRhs)).FpPrior = pLhs + if pLhs != 0 { + *(*U32)(unsafe.Pointer(pLhs + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_MultiValue))) + } + *(*U32)(unsafe.Pointer(pRhs + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_MultiValue))) + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) != TK_ALL { + (*Parse)(unsafe.Pointer(pParse)).FhasCompound = U8(1) + } + } else { + Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pLhs) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = pRhs + } + break + case uint32(87): + fallthrough // multiselect_op ::= UNION + case uint32(89): /* multiselect_op ::= EXCEPT|INTERSECT */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) /*A-overwrites-OP*/ + } + break + case uint32(88): /* multiselect_op ::= UNION ALL */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = TK_ALL + } + break + case uint32(90): /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)) = Xsqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uint32(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */))), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(91): /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-9)*24 + 8 /* &.minor */)) = Xsqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uint32(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */))), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-9)*24 + 8 /* &.minor */)) != 0 { + (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-9)*24 + 8 /* &.minor */)))).FpWinDefn = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + } else { + Xsqlite3WindowListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + } + } + break + case uint32(92): /* values ::= VALUES LP nexprlist RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_Values), uintptr(0)) + } + break + case uint32(93): /* values ::= values COMMA LP nexprlist RP */ + { + var pRight uintptr + var pLeft uintptr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + pRight = Xsqlite3SelectNew(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), (uint32(SF_Values | SF_MultiValue)), uintptr(0)) + if pLeft != 0 { + *(*U32)(unsafe.Pointer(pLeft + 4 /* &.selFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(SF_MultiValue))) + } + if pRight != 0 { + (*Select)(unsafe.Pointer(pRight)).Fop = U8(TK_ALL) + (*Select)(unsafe.Pointer(pRight)).FpPrior = pLeft + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = pRight + } else { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = pLeft + } + } + break + case uint32(94): /* distinct ::= DISTINCT */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = SF_Distinct + } + break + case uint32(95): /* distinct ::= ALL */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = SF_All + } + break + case uint32(97): + fallthrough // sclp ::= + case uint32(130): /* orderby_opt ::= */ + fallthrough + case uint32(140): /* groupby_opt ::= */ + fallthrough + case uint32(227): /* exprlist ::= */ + fallthrough + case uint32(230): /* paren_exprlist ::= */ + fallthrough + case uint32(235): /* eidlist_opt ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(98): /* selcollist ::= sclp scanpt expr scanpt as */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + if (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn > uint32(0) { + Xsqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + } + Xsqlite3ExprListSetSpan(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(99): /* selcollist ::= sclp scanpt STAR */ + { + var p uintptr = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ASTERISK, uintptr(0)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), p) + } + break + case uint32(100): /* selcollist ::= sclp scanpt nm DOT STAR */ + { + var pRight uintptr = Xsqlite3PExpr(tls, pParse, TK_ASTERISK, uintptr(0), uintptr(0)) + var pLeft uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ID, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + var pDot uintptr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pRight) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), pDot) + } + break + case uint32(101): + fallthrough // as ::= AS nm + case uint32(112): /* dbnm ::= DOT nm */ + fallthrough + case uint32(251): /* plus_num ::= PLUS INTEGER|FLOAT */ + fallthrough + case uint32(252): /* minus_num ::= MINUS INTEGER|FLOAT */ + { + *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(103): + fallthrough // from ::= + case uint32(106): /* stl_prefix ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(104): /* from ::= FROM seltablist */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + Xsqlite3SrcListShiftJoinType(tls, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(105): /* stl_prefix ::= seltablist joinop */ + { + if (*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) != 0) && ((*SrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnSrc > 0) { + (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */) + uintptr(((*SrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnSrc-1))*112)).Ffg.Fjointype = U8(*(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + } + break + case uint32(107): /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(108): /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3SrcListFuncArgs(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + } + break + case uint32(109): /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + + } + break + case uint32(110): /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ + { + if (((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) == uintptr(0)) && ((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-2)*24+8 /* &.minor */)).Fn == uint32(0))) && (*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) == uintptr(0))) && (*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) == uintptr(0)) { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + } else if (*SrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)))).FnSrc == 1 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) != 0 { + var pNew uintptr = ((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) + 8 /* &.a */) + uintptr(((*SrcList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)))).FnSrc-1))*112) + var pOld uintptr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 8 /* &.a */ + (*SrcItem)(unsafe.Pointer(pNew)).FzName = (*SrcItem)(unsafe.Pointer(pOld)).FzName + (*SrcItem)(unsafe.Pointer(pNew)).FzDatabase = (*SrcItem)(unsafe.Pointer(pOld)).FzDatabase + (*SrcItem)(unsafe.Pointer(pNew)).FpSelect = (*SrcItem)(unsafe.Pointer(pOld)).FpSelect + if (uint32(int32(*(*uint16)(unsafe.Pointer(pOld + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { + *(*uintptr)(unsafe.Pointer(pNew + 96 /* &.u1 */)) = *(*uintptr)(unsafe.Pointer(pOld + 96 /* &.u1 */)) + *(*uintptr)(unsafe.Pointer(pOld + 96 /* &.u1 */)) = uintptr(0) + libc.SetBitFieldPtr16Uint32(pOld+60 /* &.fg */ +4 /* &.isTabFunc */, uint32(0), 2, 0x4) + libc.SetBitFieldPtr16Uint32(pNew+60 /* &.fg */ +4 /* &.isTabFunc */, uint32(1), 2, 0x4) + } + (*SrcItem)(unsafe.Pointer(pOld)).FzName = libc.AssignPtrUintptr(pOld+8 /* &.zDatabase */, uintptr(0)) + (*SrcItem)(unsafe.Pointer(pOld)).FpSelect = uintptr(0) + } + Xsqlite3SrcListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + } else { + var pSubquery uintptr + Xsqlite3SrcListShiftJoinType(tls, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + pSubquery = Xsqlite3SelectNew(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(SF_NestedFrom), uintptr(0)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendFromTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), pSubquery, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + + } + break + case uint32(111): + fallthrough // dbnm ::= + case uint32(125): /* indexed_opt ::= */ + { + (*Token)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)).Fz = uintptr(0) + (*Token)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)).Fn = uint32(0) + } + break + case uint32(113): /* fullname ::= nm */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), uintptr(0)) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) != 0) { + Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + 8 /* &.a */))).FzName, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(114): /* fullname ::= nm DOT nm */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) != 0) { + Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + 8 /* &.a */))).FzName, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(115): /* xfullname ::= nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), uintptr(0)) /*A-overwrites-X*/ + } + break + case uint32(116): /* xfullname ::= nm DOT nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) /*A-overwrites-X*/ + } + break + case uint32(117): /* xfullname ::= nm DOT nm AS nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */)) //A-overwrites-X + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) != 0 { + (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FzAlias = Xsqlite3NameFromToken(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + } + break + case uint32(118): /* xfullname ::= nm AS nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), uintptr(0)) //A-overwrites-X + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) != 0 { + (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FzAlias = Xsqlite3NameFromToken(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + } + break + case uint32(119): /* joinop ::= COMMA|JOIN */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = JT_INNER + } + break + case uint32(120): /* joinop ::= JOIN_KW JOIN */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = Xsqlite3JoinType(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), uintptr(0), uintptr(0)) /*X-overwrites-A*/ + } + break + case uint32(121): /* joinop ::= JOIN_KW nm JOIN */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3JoinType(tls, pParse, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), uintptr(0)) /*X-overwrites-A*/ + } + break + case uint32(122): /* joinop ::= JOIN_KW nm nm JOIN */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3JoinType(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) /*X-overwrites-A*/ + } + break + case uint32(123): + fallthrough // on_opt ::= ON expr + case uint32(143): /* having_opt ::= HAVING expr */ + fallthrough + case uint32(150): /* where_opt ::= WHERE expr */ + fallthrough + case uint32(152): /* where_opt_ret ::= WHERE expr */ + fallthrough + case uint32(223): /* case_else ::= ELSE expr */ + fallthrough + case uint32(244): /* vinto ::= INTO expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(124): + fallthrough // on_opt ::= + case uint32(142): /* having_opt ::= */ + fallthrough + case uint32(144): /* limit_opt ::= */ + fallthrough + case uint32(149): /* where_opt ::= */ + fallthrough + case uint32(151): /* where_opt_ret ::= */ + fallthrough + case uint32(224): /* case_else ::= */ + fallthrough + case uint32(226): /* case_operand ::= */ + fallthrough + case uint32(245): /* vinto ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(126): /* indexed_opt ::= INDEXED BY nm */ + { + *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(127): /* indexed_opt ::= NOT INDEXED */ + { + (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)).Fz = uintptr(0) + (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)).Fn = uint32(1) + } + break + case uint32(128): /* using_opt ::= USING LP idlist RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(129): + fallthrough // using_opt ::= + case uint32(171): /* idlist_opt ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(131): + fallthrough // orderby_opt ::= ORDER BY sortlist + case uint32(141): /* groupby_opt ::= GROUP BY nexprlist */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(132): /* sortlist ::= sortlist COMMA expr sortorder nulls */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + Xsqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(133): /* sortlist ::= expr sortorder nulls */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) //A-overwrites-Y + Xsqlite3ExprListSetSortOrder(tls, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(134): /* sortorder ::= ASC */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = SQLITE_SO_ASC + } + break + case uint32(135): /* sortorder ::= DESC */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = SQLITE_SO_DESC + } + break + case uint32(136): + fallthrough // sortorder ::= + case uint32(139): /* nulls ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = -1 + } + break + case uint32(137): /* nulls ::= NULLS FIRST */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = SQLITE_SO_ASC + } + break + case uint32(138): /* nulls ::= NULLS LAST */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = SQLITE_SO_DESC + } + break + case uint32(145): /* limit_opt ::= LIMIT expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_LIMIT, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(146): /* limit_opt ::= LIMIT expr OFFSET expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_LIMIT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(147): /* limit_opt ::= LIMIT expr COMMA expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_LIMIT, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + } + break + case uint32(148): /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + { + Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) + Xsqlite3DeleteFrom(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), uintptr(0)) + } + break + case uint32(153): /* where_opt_ret ::= RETURNING selcollist */ + { + Xsqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(154): /* where_opt_ret ::= WHERE expr RETURNING selcollist */ + { + Xsqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + } + break + case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + { + Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21267 /* "set list" */) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) + } + break + case uint32(156): /* setlist ::= setlist COMMA nm EQ expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + } + break + case uint32(157): /* setlist ::= setlist COMMA LP idlist RP EQ expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppendVector(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(158): /* setlist ::= nm EQ expr */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(159): /* setlist ::= LP idlist RP EQ expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppendVector(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(160): /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + { + Xsqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(161): /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + { + Xsqlite3Insert(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(162): /* upsert ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(163): /* upsert ::= RETURNING selcollist */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = uintptr(0) + Xsqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(164): /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-11)*24 + 8 /* &.minor */)) = Xsqlite3UpsertNew(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(165): /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)) = Xsqlite3UpsertNew(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(166): /* upsert ::= ON CONFLICT DO NOTHING returning */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3UpsertNew(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + } + break + case uint32(167): /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)) = Xsqlite3UpsertNew(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(168): /* returning ::= RETURNING selcollist */ + { + Xsqlite3AddReturning(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(172): /* idlist_opt ::= LP idlist RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(173): /* idlist ::= idlist COMMA nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3IdListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(174): /* idlist ::= nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3IdListAppend(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */)) /*A-overwrites-Y*/ + } + break + case uint32(175): /* expr ::= LP expr RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(176): + fallthrough // expr ::= ID|INDEXED + case uint32(177): /* expr ::= JOIN_KW */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = tokenExpr(tls, pParse, TK_ID, *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */))) /*A-overwrites-X*/ + } + break + case uint32(178): /* expr ::= nm DOT nm */ + { + var temp1 uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ID, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + var temp2 uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ID, (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenMap(tls, pParse, temp2, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + Xsqlite3RenameTokenMap(tls, pParse, temp1, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3PExpr(tls, pParse, TK_DOT, temp1, temp2) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(179): /* expr ::= nm DOT nm DOT nm */ + { + var temp1 uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ID, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + var temp2 uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ID, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + var temp3 uintptr = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_ID, (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + var temp4 uintptr = Xsqlite3PExpr(tls, pParse, TK_DOT, temp2, temp3) + if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { + Xsqlite3RenameTokenMap(tls, pParse, temp3, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + Xsqlite3RenameTokenMap(tls, pParse, temp2, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3PExpr(tls, pParse, TK_DOT, temp1, temp4) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(180): + fallthrough // term ::= NULL|FLOAT|BLOB + case uint32(181): /* term ::= STRING */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = tokenExpr(tls, pParse, int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor), *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */))) /*A-overwrites-X*/ + } + break + case uint32(182): /* term ::= INTEGER */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(183): /* expr ::= VARIABLE */ + { + if !((int32(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)).Fz))) == '#') && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz + 1)))]) & 0x04) != 0)) { + var n U32 = (*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)).Fn + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = tokenExpr(tls, pParse, TK_VARIABLE, *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3ExprAssignVarNumber(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), n) + } else { + // When doing a nested parse, one can include terms in an expression + // that look like this: #1 #2 ... These terms refer to registers + // in the virtual machine. #N is the N-th register. + *(*Token)(unsafe.Pointer(bp + 96 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X + + if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+21276 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = uintptr(0) + } else { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) != 0 { + Xsqlite3GetInt32(tls, ((*Token)(unsafe.Pointer(bp+96 /* &t */)).Fz + 1), (*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + 44 /* &.iTable */)) + } + } + } + } + break + case uint32(184): /* expr ::= expr COLLATE ID|STRING */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3ExprAddCollateToken(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + } + break + case uint32(185): /* expr ::= CAST LP expr AS typetoken RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_CAST, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + Xsqlite3ExprAttachSubtrees(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(186): /* expr ::= ID|INDEXED LP distinct exprlist RP */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(187): /* expr ::= ID|INDEXED LP STAR RP */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(188): /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */))) + Xsqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(189): /* expr ::= ID|INDEXED LP STAR RP filter_over */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + Xsqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(190): /* term ::= CTIME_KW */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), 0) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(191): /* expr ::= LP nexprlist COMMA expr RP */ + { + var pList uintptr = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_VECTOR, uintptr(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 32 /* &.x */)) = pList + if (*ExprList)(unsafe.Pointer(pList)).FnExpr != 0 { + *(*U32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 4 /* &.flags */)) |= ((*Expr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */))).FpExpr)).Fflags & (U32((EP_Collate | EP_Subquery) | EP_HasFunc))) + } + } else { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pList) + } + } + break + case uint32(192): /* expr ::= expr AND expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3ExprAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(193): + fallthrough // expr ::= expr OR expr + case uint32(194): /* expr ::= expr LT|GT|GE|LE expr */ + fallthrough + case uint32(195): /* expr ::= expr EQ|NE expr */ + fallthrough + case uint32(196): /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + fallthrough + case uint32(197): /* expr ::= expr PLUS|MINUS expr */ + fallthrough + case uint32(198): /* expr ::= expr STAR|SLASH|REM expr */ + fallthrough + case uint32(199): /* expr ::= expr CONCAT expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, int32((*YyStackEntry)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24)).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(200): /* likeop ::= NOT LIKE_KW|MATCH */ + { + *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*uint32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */ + 8 /* &.n */)) |= (0x80000000) /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/ + } + break + case uint32(201): /* expr ::= expr likeop expr */ + { + var pList uintptr + var bNot int32 = (int32((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fn & 0x80000000)) + *(*uint32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */ + 8 /* &.n */)) &= (uint32(0x7fffffff)) + pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + pList = Xsqlite3ExprListAppend(tls, pParse, pList, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3ExprFunction(tls, pParse, pList, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + if bNot != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), uintptr(0)) + } + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) != 0 { + *(*U32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + 4 /* &.flags */)) |= (U32(EP_InfixFunc)) + } + } + break + case uint32(202): /* expr ::= expr likeop expr ESCAPE expr */ + { + var pList uintptr + var bNot int32 = (int32((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).Fn & 0x80000000)) + *(*uint32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */ + 8 /* &.n */)) &= (uint32(0x7fffffff)) + pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + pList = Xsqlite3ExprListAppend(tls, pParse, pList, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + pList = Xsqlite3ExprListAppend(tls, pParse, pList, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprFunction(tls, pParse, pList, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + if bNot != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + } + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) != 0 { + *(*U32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 4 /* &.flags */)) |= (U32(EP_InfixFunc)) + } + } + break + case uint32(203): /* expr ::= expr ISNULL|NOTNULL */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(204): /* expr ::= expr NOT NULL */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOTNULL, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(205): /* expr ::= expr IS expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_IS, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), TK_ISNULL) + } + break + case uint32(206): /* expr ::= expr IS NOT expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_ISNOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + binaryToUnaryIfNull(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), TK_NOTNULL) + } + break + case uint32(207): + fallthrough // expr ::= NOT expr + case uint32(208): /* expr ::= BITNOT expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, int32((*YyStackEntry)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24)).Fmajor), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0)) /*A-overwrites-B*/ + } + break + case uint32(209): /* expr ::= PLUS|MINUS expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, func() int32 { + if int32((*YyStackEntry)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24)).Fmajor) == TK_PLUS { + return TK_UPLUS + } + return TK_UMINUS + }(), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0)) + //A-overwrites-B + } + break + case uint32(210): + fallthrough // between_op ::= BETWEEN + case uint32(213): /* in_op ::= IN */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = 0 + } + break + case uint32(212): /* expr ::= expr between_op expr AND expr */ + { + var pList uintptr = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + pList = Xsqlite3ExprListAppend(tls, pParse, pList, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_BETWEEN, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 32 /* &.x */)) = pList + } else { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pList) + } + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + } + } + break + case uint32(215): /* expr ::= expr in_op LP exprlist RP */ + { + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) == uintptr(0) { + // Expressions of the form + // + // expr1 IN () + // expr1 NOT IN () + // + // simplify to constants 0 (false) and 1 (true), respectively, + // regardless of the value of expr1. + Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + return ts + 6914 /* "1" */ + } + return ts + 6507 /* "0" */ + }()) + } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { + var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr + (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr = uintptr(0) + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + pRHS = Xsqlite3PExpr(tls, pParse, TK_UPLUS, pRHS, uintptr(0)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_EQ, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), pRHS) + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + } + } else { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_IN, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 32 /* &.x */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + Xsqlite3ExprSetHeightAndFlags(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + } else { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + } + } + + } + break + case uint32(216): /* expr ::= LP select RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_SELECT, uintptr(0), uintptr(0)) + Xsqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + + } + break + case uint32(217): /* expr ::= expr in_op LP select RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_IN, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + Xsqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + } + + } + break + case uint32(218): /* expr ::= expr in_op nm dbnm paren_exprlist */ + { + var pSrc uintptr = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) + var pSelect uintptr = Xsqlite3SelectNew(tls, pParse, uintptr(0), pSrc, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) != 0 { + Xsqlite3SrcListFuncArgs(tls, pParse, func() uintptr { + if pSelect != 0 { + return pSrc + } + return uintptr(0) + }(), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_IN, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + Xsqlite3PExprAddSelect(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), pSelect) + if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_NOT, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), uintptr(0)) + } + + } + break + case uint32(219): /* expr ::= EXISTS LP select RP */ + { + var p uintptr + p = libc.AssignPtrUintptr(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */ /* &.yy404 */, Xsqlite3PExpr(tls, pParse, TK_EXISTS, uintptr(0), uintptr(0))) + Xsqlite3PExprAddSelect(tls, pParse, p, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + + } + break + case uint32(220): /* expr ::= CASE case_operand case_exprlist case_else END */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_CASE, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) != 0 { + *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) + 32 /* &.x */)) = func() uintptr { + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) != 0 { + return Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + return *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + }() + Xsqlite3ExprSetHeightAndFlags(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + } else { + Xsqlite3ExprListDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + } + break + case uint32(221): /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(222): /* case_exprlist ::= WHEN expr THEN expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(225): /* case_operand ::= expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) /*A-overwrites-X*/ + } + break + case uint32(228): /* nexprlist ::= nexprlist COMMA expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(229): /* nexprlist ::= expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) /*A-overwrites-Y*/ + } + break + case uint32(231): + fallthrough // paren_exprlist ::= LP exprlist RP + case uint32(236): /* eidlist_opt ::= LP eidlist RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(232): /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + { + Xsqlite3CreateIndex(tls, pParse, (yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */ /* &.yy0 */), + Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */ /* &.yy0 */), uintptr(0)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-10)*24 + 8 /* &.minor */)), + (yymsp + libc.UintptrFromInt32(-11)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), SQLITE_SO_ASC, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)), uint8(SQLITE_IDXTYPE_APPDEF)) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && ((*Parse)(unsafe.Pointer(pParse)).FpNewIndex != 0) { + Xsqlite3RenameTokenMap(tls, pParse, (*Index)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).FpNewIndex)).FzName, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + } + break + case uint32(233): + fallthrough // uniqueflag ::= UNIQUE + case uint32(275): /* raisetype ::= ABORT */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Abort + } + break + case uint32(234): /* uniqueflag ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = OE_None + } + break + case uint32(237): /* eidlist ::= eidlist COMMA nm collate sortorder */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = parserAddExprIdListTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(238): /* eidlist ::= nm collate sortorder */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = parserAddExprIdListTerm(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */))) //A-overwrites-Y + } + break + case uint32(241): /* cmd ::= DROP INDEX ifexists fullname */ + { + Xsqlite3DropIndex(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(242): /* cmd ::= VACUUM vinto */ + { + Xsqlite3Vacuum(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(243): /* cmd ::= VACUUM nm vinto */ + { + Xsqlite3Vacuum(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(246): /* cmd ::= PRAGMA nm dbnm */ + { + Xsqlite3Pragma(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */), uintptr(0), 0) + } + break + case uint32(247): /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + { + Xsqlite3Pragma(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */), 0) + } + break + case uint32(248): /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + { + Xsqlite3Pragma(tls, pParse, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + } + break + case uint32(249): /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + { + Xsqlite3Pragma(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + } + break + case uint32(250): /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + { + Xsqlite3Pragma(tls, pParse, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + } + break + case uint32(253): /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + { + // var all Token at bp+112, 16 + + (*Token)(unsafe.Pointer(bp + 112 /* &all */)).Fz = (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)).Fz + (*Token)(unsafe.Pointer(bp + 112 /* &all */)).Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).Fz)) / 1))) + (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn) + Xsqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), bp+112 /* &all */) + } + break + case uint32(254): /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + { + Xsqlite3BeginTrigger(tls, pParse, (yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (*TrigEvent)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */)).Fa, (*TrigEvent)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */)).Fb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-10)*24 + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */))) + *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-10)*24 + 8 /* &.minor */)) = func() Token1 { + if (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-6)*24+8 /* &.minor */)).Fn == uint32(0) { + return *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)) + } + return *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)) + }() //A-overwrites-T + } + break + case uint32(255): /* trigger_time ::= BEFORE|AFTER */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) /*A-overwrites-X*/ + } + break + case uint32(256): /* trigger_time ::= INSTEAD OF */ + { + *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = TK_INSTEAD + } + break + case uint32(257): /* trigger_time ::= */ + { + *(*int32)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = TK_BEFORE + } + break + case uint32(258): + fallthrough // trigger_event ::= DELETE|INSERT + case uint32(259): /* trigger_event ::= UPDATE */ + { + (*TrigEvent)(unsafe.Pointer(yymsp + 8 /* &.minor */)).Fa = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) /*A-overwrites-X*/ + (*TrigEvent)(unsafe.Pointer(yymsp + 8 /* &.minor */)).Fb = uintptr(0) + } + break + case uint32(260): /* trigger_event ::= UPDATE OF idlist */ + { + (*TrigEvent)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)).Fa = TK_UPDATE + (*TrigEvent)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)).Fb = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(261): + fallthrough // when_clause ::= + case uint32(280): /* key_opt ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = uintptr(0) + } + break + case uint32(262): + fallthrough // when_clause ::= WHEN expr + case uint32(281): /* key_opt ::= KEY expr */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(263): /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + { + + (*TriggerStep)(unsafe.Pointer((*TriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)))).FpLast)).FpNext = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + (*TriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(264): /* trigger_cmd_list ::= trigger_cmd SEMI */ + { + + (*TriggerStep)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FpLast = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(265): /* trnm ::= nm DOT nm */ + { + *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + Xsqlite3ErrorMsg(tls, pParse, + + ts+21300 /* "qualified table ..." */, 0) + } + break + case uint32(266): /* tridxby ::= INDEXED BY nm */ + { + Xsqlite3ErrorMsg(tls, pParse, + + ts+21395 /* "the INDEXED BY c..." */, 0) + } + break + case uint32(267): /* tridxby ::= NOT INDEXED */ + { + Xsqlite3ErrorMsg(tls, pParse, + + ts+21479 /* "the NOT INDEXED ..." */, 0) + } + break + case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerUpdateStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uint8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */))), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-8)*24+8 /* &.minor */)).Fz, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(269): /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerInsertStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), uint8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */))), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) //yylhsminor.yy157-overwrites-yymsp[-6].minor.yy376 + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(270): /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerDeleteStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-5)*24+8 /* &.minor */)).Fz, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(271): /* trigger_cmd ::= scanpt select scanpt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerSelectStep(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) /*yylhsminor.yy157-overwrites-yymsp[-1].minor.yy81*/ + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(272): /* expr ::= RAISE LP IGNORE RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_RAISE, uintptr(0), uintptr(0)) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { + (*Expr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)))).FaffExpr = int8(OE_Ignore) + } + } + break + case uint32(273): /* expr ::= RAISE LP raisetype COMMA nm RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_RAISE, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) != 0 { + (*Expr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)))).FaffExpr = int8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */))) + } + } + break + case uint32(274): /* raisetype ::= ROLLBACK */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Rollback + } + break + case uint32(276): /* raisetype ::= FAIL */ + { + *(*int32)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = OE_Fail + } + break + case uint32(277): /* cmd ::= DROP TRIGGER ifexists fullname */ + { + Xsqlite3DropTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(278): /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + { + Xsqlite3Attach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(279): /* cmd ::= DETACH database_kw_opt expr */ + { + Xsqlite3Detach(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(282): /* cmd ::= REINDEX */ + { + Xsqlite3Reindex(tls, pParse, uintptr(0), uintptr(0)) + } + break + case uint32(283): /* cmd ::= REINDEX nm dbnm */ + { + Xsqlite3Reindex(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(284): /* cmd ::= ANALYZE */ + { + Xsqlite3Analyze(tls, pParse, uintptr(0), uintptr(0)) + } + break + case uint32(285): /* cmd ::= ANALYZE nm dbnm */ + { + Xsqlite3Analyze(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(286): /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + { + Xsqlite3AlterRenameTable(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(287): /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + { + (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)).Fn = (uint32((int32((int64((*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fz) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).Fz)) / 1))) + (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fn) + Xsqlite3AlterFinishAddColumn(tls, pParse, (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(288): /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + { + Xsqlite3AlterDropColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(289): /* add_column_fullname ::= fullname */ + { + disableLookaside(tls, pParse) + Xsqlite3AlterBeginAddColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(290): /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + { + Xsqlite3AlterRenameColumn(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(291): /* cmd ::= create_vtab */ + { + Xsqlite3VtabFinishParse(tls, pParse, uintptr(0)) + } + break + case uint32(292): /* cmd ::= create_vtab LP vtabarglist RP */ + { + Xsqlite3VtabFinishParse(tls, pParse, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(293): /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + { + Xsqlite3VtabBeginParse(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + } + break + case uint32(294): /* vtabarg ::= */ + { + Xsqlite3VtabArgInit(tls, pParse) + } + break + case uint32(295): + fallthrough // vtabargtoken ::= ANY + case uint32(296): /* vtabargtoken ::= lp anylist RP */ + fallthrough + case uint32(297): /* lp ::= LP */ + { + Xsqlite3VtabArgExtend(tls, pParse, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + } + break + case uint32(298): + fallthrough // with ::= WITH wqlist + case uint32(299): /* with ::= WITH RECURSIVE wqlist */ + { + Xsqlite3WithPush(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uint8(1)) + } + break + case uint32(300): /* wqas ::= AS */ + { + *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = U8(M10d_Any) + } + break + case uint32(301): /* wqas ::= AS MATERIALIZED */ + { + *(*U8)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = U8(M10d_Yes) + } + break + case uint32(302): /* wqas ::= AS NOT MATERIALIZED */ + { + *(*U8)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = U8(M10d_No) + } + break + case uint32(303): /* wqitem ::= nm eidlist_opt wqas LP select RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3CteNew(tls, pParse, (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*U8)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */))) //A-overwrites-X + } + break + case uint32(304): /* wqlist ::= wqitem */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3WithAdd(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) //A-overwrites-X + } + break + case uint32(305): /* wqlist ::= wqlist COMMA wqitem */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = Xsqlite3WithAdd(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + break + case uint32(306): /* windowdefn_list ::= windowdefn */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(307): /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ + { + + Xsqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(308): /* windowdefn ::= nm AS LP window RP */ + { + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) != 0 { + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FzName = Xsqlite3DbStrNDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */)).Fz, uint64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */)).Fn)) + } + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(309): /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(310): /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(311): /* window ::= ORDER BY sortlist frame_opt */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uintptr(0)) + } + break + case uint32(312): /* window ::= nm ORDER BY sortlist frame_opt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(313): + fallthrough // window ::= frame_opt + case uint32(332): /* filter_over ::= over_clause */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(314): /* window ::= nm frame_opt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), uintptr(0), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(315): /* frame_opt ::= */ + { + *(*uintptr)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = Xsqlite3WindowAlloc(tls, pParse, 0, TK_UNBOUNDED, uintptr(0), TK_CURRENT, uintptr(0), uint8(0)) + } + break + case uint32(316): /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FpExpr, TK_CURRENT, uintptr(0), *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(317): /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).FpExpr, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FpExpr, *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(319): + fallthrough // frame_bound_s ::= frame_bound + case uint32(321): /* frame_bound_e ::= frame_bound */ + { + *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*FrameBound)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + *(*FrameBound)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(320): + fallthrough // frame_bound_s ::= UNBOUNDED PRECEDING + case uint32(322): /* frame_bound_e ::= UNBOUNDED FOLLOWING */ + fallthrough + case uint32(324): /* frame_bound ::= CURRENT ROW */ + { + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FeType = int32((*YyStackEntry)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24)).Fmajor) + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FpExpr = uintptr(0) + } + *(*FrameBound)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(323): /* frame_bound ::= expr PRECEDING|FOLLOWING */ + { + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FeType = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + *(*FrameBound)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(325): /* frame_exclude_opt ::= */ + { + *(*U8)(unsafe.Pointer(yymsp + 1*24 + 8 /* &.minor */)) = U8(0) + } + break + case uint32(326): /* frame_exclude_opt ::= EXCLUDE frame_exclude */ + { + *(*U8)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(327): + fallthrough // frame_exclude ::= NO OTHERS + case uint32(328): /* frame_exclude ::= CURRENT ROW */ + { + *(*U8)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = U8((*YyStackEntry)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24)).Fmajor) /*A-overwrites-X*/ + } + break + case uint32(329): /* frame_exclude ::= GROUP|TIES */ + { + *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = U8((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) /*A-overwrites-X*/ + } + break + case uint32(330): /* window_clause ::= WINDOW windowdefn_list */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + break + case uint32(331): /* filter_over ::= filter_clause over_clause */ + { + if *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) != 0 { + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } else { + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(333): /* filter_over ::= filter_clause */ + { + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Window{}))) + if *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) != 0 { + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)))).FeFrmType = U8(TK_FILTER) + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + } else { + Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + } + } + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + break + case uint32(334): /* over_clause ::= OVER LP window RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + + } + break + case uint32(335): /* over_clause ::= OVER nm */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Window{}))) + if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) != 0 { + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FzName = Xsqlite3DbStrNDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, uint64((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn)) + } + } + break + case uint32(336): /* filter_clause ::= FILTER LP WHERE expr RP */ + { + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + default: + /* (337) input ::= cmdlist */ + /* (338) cmdlist ::= cmdlist ecmd */ + /* (339) cmdlist ::= ecmd (OPTIMIZED OUT) */ + /* (340) ecmd ::= SEMI */ + /* (341) ecmd ::= cmdx SEMI */ + /* (342) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ + /* (343) trans_opt ::= */ + /* (344) trans_opt ::= TRANSACTION */ + /* (345) trans_opt ::= TRANSACTION nm */ + /* (346) savepoint_opt ::= SAVEPOINT */ + /* (347) savepoint_opt ::= */ + /* (348) cmd ::= create_table create_table_args */ + /* (349) columnlist ::= columnlist COMMA columnname carglist */ + /* (350) columnlist ::= columnname carglist */ + /* (351) nm ::= ID|INDEXED */ + /* (352) nm ::= STRING */ + /* (353) nm ::= JOIN_KW */ + /* (354) typetoken ::= typename */ + /* (355) typename ::= ID|STRING */ + /* (356) signed ::= plus_num (OPTIMIZED OUT) */ + /* (357) signed ::= minus_num (OPTIMIZED OUT) */ + /* (358) carglist ::= carglist ccons */ + /* (359) carglist ::= */ + /* (360) ccons ::= NULL onconf */ + /* (361) ccons ::= GENERATED ALWAYS AS generated */ + /* (362) ccons ::= AS generated */ + /* (363) conslist_opt ::= COMMA conslist */ + /* (364) conslist ::= conslist tconscomma tcons */ + /* (365) conslist ::= tcons (OPTIMIZED OUT) */ + /* (366) tconscomma ::= */ + /* (367) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ + /* (368) resolvetype ::= raisetype (OPTIMIZED OUT) */ + /* (369) selectnowith ::= oneselect (OPTIMIZED OUT) */ + /* (370) oneselect ::= values */ + /* (371) sclp ::= selcollist COMMA */ + /* (372) as ::= ID|STRING */ + /* (373) returning ::= */ + /* (374) expr ::= term (OPTIMIZED OUT) */ + /* (375) likeop ::= LIKE_KW|MATCH */ + /* (376) exprlist ::= nexprlist */ + /* (377) nmnum ::= plus_num (OPTIMIZED OUT) */ + /* (378) nmnum ::= nm (OPTIMIZED OUT) */ + /* (379) nmnum ::= ON */ + /* (380) nmnum ::= DELETE */ + /* (381) nmnum ::= DEFAULT */ + /* (382) plus_num ::= INTEGER|FLOAT */ + /* (383) foreach_clause ::= */ + /* (384) foreach_clause ::= FOR EACH ROW */ + /* (385) trnm ::= nm */ + /* (386) tridxby ::= */ + /* (387) database_kw_opt ::= DATABASE */ + /* (388) database_kw_opt ::= */ + /* (389) kwcolumn_opt ::= */ + /* (390) kwcolumn_opt ::= COLUMNKW */ + /* (391) vtabarglist ::= vtabarg */ + /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */ + /* (393) vtabarg ::= vtabarg vtabargtoken */ + /* (394) anylist ::= */ + /* (395) anylist ::= anylist LP anylist RP */ + /* (396) anylist ::= anylist ANY */ + /* (397) with ::= */ + break + //********* End reduce actions *********************************************** + } + + yygoto = int32(yyRuleInfoLhs[yyruleno]) + yysize = int32(yyRuleInfoNRhs[yyruleno]) + yyact = yy_find_reduce_action(tls, (*YyStackEntry)(unsafe.Pointer(yymsp+uintptr(yysize)*24)).Fstateno, uint16(yygoto)) + + // There are no SHIFTREDUCE actions on nonterminals because the table + // generator has simplified them to pure REDUCE actions. + + // It is not possible for a REDUCE to be followed by an error + + yymsp += 24 * (uintptr(yysize + 1)) + (*YyParser)(unsafe.Pointer(yypParser)).Fyytos = yymsp + (*YyStackEntry)(unsafe.Pointer(yymsp)).Fstateno = yyact + (*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor = uint16(yygoto) + + return yyact +} + +// The following code executes when the parse fails + +// The following code executes when a syntax error first occurs. +func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor Token) { /* sqlite3.c:163044:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + *(*Token)(unsafe.Pointer(bp + 8)) = yyminor + + var pParse uintptr = (*YyParser)(unsafe.Pointer(yypParser)).FpParse + //*********** Begin %syntax_error code *************************************** + + _ = yymajor // Silence some compiler warnings + if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+21276 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + } else { + Xsqlite3ErrorMsg(tls, pParse, ts+21564 /* "incomplete input" */, 0) + } + //*********** End %syntax_error code ***************************************** + + (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse +} + +// The following is executed when the parser accepts +func yy_accept(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:163068:13: */ + + var pParse uintptr = (*YyParser)(unsafe.Pointer(yypParser)).FpParse + + // Here code is inserted which will be executed whenever the + // parser accepts + //********** Begin %parse_accept code **************************************** + //********** End %parse_accept code ****************************************** + + (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse +} + +// The main parser program. +// The first argument is a pointer to a structure obtained from +// "sqlite3ParserAlloc" which describes the current state of the parser. +// The second argument is the major token number. The third is +// the minor token. The fourth optional argument is whatever the +// user wants (and specified in the grammar) and is available for +// use by the action routines. +// +// Inputs: +//
    +//
  • A pointer to the parser (an opaque structure.) +//
  • The major token number. +//
  • The minor token number. +//
  • An option argument of a grammar-specified type. +//
+// +// Outputs: +// None. +func Xsqlite3Parser(tls *libc.TLS, yyp uintptr, yymajor int32, yyminor Token) { /* sqlite3.c:163109:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var yyminorunion YYMINORTYPE at bp, 16 + + var yyact uint16 // The parser action. + var yypParser uintptr = yyp // The parser + var pParse uintptr = (*YyParser)(unsafe.Pointer(yypParser)).FpParse + + yyact = (*YyStackEntry)(unsafe.Pointer((*YyParser)(unsafe.Pointer(yypParser)).Fyytos)).Fstateno + + for 1 != 0 { // Exit by "break" + + yyact = yy_find_shift_action(tls, uint16(yymajor), yyact) + if int32(yyact) >= YY_MIN_REDUCE { + var yyruleno uint32 = (uint32(int32(yyact) - YY_MIN_REDUCE)) // Reduce by this rule + + // Check that the stack is large enough to grow by a single entry + // if the RHS of the rule is empty. This ensures that there is room + // enough on the stack to push the LHS value + if int32(yyRuleInfoNRhs[yyruleno]) == 0 { + if (*YyParser)(unsafe.Pointer(yypParser)).Fyytos >= (*YyParser)(unsafe.Pointer(yypParser)).FyystackEnd { + yyStackOverflow(tls, yypParser) + break + } + } + yyact = yy_reduce(tls, yypParser, yyruleno, yymajor, yyminor, pParse) + } else if int32(yyact) <= YY_MAX_SHIFTREDUCE { + yy_shift(tls, yypParser, yyact, uint16(yymajor), yyminor) + break + } else if int32(yyact) == YY_ACCEPT_ACTION { + (*YyParser)(unsafe.Pointer(yypParser)).Fyytos -= 24 + yy_accept(tls, yypParser) + return + } else { + + *(*Token)(unsafe.Pointer(bp /* &yyminorunion */)) = yyminor + // If the YYNOERRORRECOVERY macro is defined, then do not attempt to + // do any kind of error recovery. Instead, simply invoke the syntax + // error routine and continue going as if nothing had happened. + // + // Applications can set this macro (for example inside %include) if + // they intend to abandon the parse upon the first syntax error seen. + yy_syntax_error(tls, yypParser, yymajor, yyminor) + yy_destructor(tls, yypParser, uint16(yymajor), bp /* &yyminorunion */) + break + } + } + return +} + +// Return the fallback token corresponding to canonical token iToken, or +// 0 if iToken has no fallback. +func Xsqlite3ParserFallback(tls *libc.TLS, iToken int32) int32 { /* sqlite3.c:163327:20: */ + + return int32(yyFallback[iToken]) +} + +//************* End of parse.c ********************************************** +//************* Begin file tokenize.c *************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// An tokenizer for SQL +// +// This file contains C code that splits an SQL input string up into +// individual tokens and sends those tokens one-by-one over to the +// parser for analysis. +// #include "sqliteInt.h" +// #include + +// Character classes for tokenizing +// +// In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented +// using a lookup table, whereas a switch() directly on c uses a binary search. +// The lookup table is much faster. To maximize speed, and to ensure that +// a lookup table is used, all of the classes need to be small integers and +// all of them need to be used within the switch. + +var aiClass = [256]uint8{ + // x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf + /* 0x */ uint8(29), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(7), uint8(7), uint8(28), uint8(7), uint8(7), uint8(28), uint8(28), + /* 1x */ uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), uint8(28), + /* 2x */ uint8(7), uint8(15), uint8(8), uint8(5), uint8(4), uint8(22), uint8(24), uint8(8), uint8(17), uint8(18), uint8(21), uint8(20), uint8(23), uint8(11), uint8(26), uint8(16), + /* 3x */ uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(5), uint8(19), uint8(12), uint8(14), uint8(13), uint8(6), + /* 4x */ uint8(5), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), + /* 5x */ uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(2), uint8(2), uint8(9), uint8(28), uint8(28), uint8(28), uint8(2), + /* 6x */ uint8(8), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), + /* 7x */ uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(2), uint8(2), uint8(28), uint8(10), uint8(28), uint8(25), uint8(28), + /* 8x */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* 9x */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* Ax */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* Bx */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* Cx */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* Dx */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* Ex */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(30), + /* Fx */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), +} /* sqlite3.c:163399:28 */ + +// The charMap() macro maps alphabetic characters (only) into their +// lower-case ASCII equivalent. On ASCII machines, this is just +// an upper-to-lower case map. On EBCDIC machines we also need +// to adjust the encoding. The mapping is only valid for alphabetics +// which are the only characters for which this feature is used. +// +// Used by keywordhash.h + +// The sqlite3KeywordCode function looks up an identifier to determine if +// it is a keyword. If it is a keyword, the token code of that keyword is +// returned. If the input is not a keyword, TK_ID is returned. +// +// The implementation of this routine was generated by a program, +// mkkeywordhash.c, located in the tool subdirectory of the distribution. +// The output of the mkkeywordhash.c program is written into a file +// named keywordhash.h and then included into this source file by +// the #include below. +//************* Include keywordhash.h in the middle of tokenize.c *********** +//************* Begin file keywordhash.h ************************************ +// **** This file contains automatically generated code ****** +// +// +// The code in this file has been automatically generated by +// +// sqlite/tool/mkkeywordhash.c +// +// The code in this file implements a function that determines whether +// or not a given identifier is really an SQL keyword. The same thing +// might be implemented more directly using a hand-written hash table. +// But by using this automatically generated code, the size of the code +// is substantially reduced. This is important for embedded applications +// on platforms with limited memory. +// Hash score: 231 +// zKWText[] encodes 1007 bytes of keyword text in 667 bytes +// REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT +// ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT +// IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS +// CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES +// UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT +// CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE +// PRAGMATERIALIZEDEFERREDISTINCTUPDATEVALUESVIRTUALWAYSWHENWHERE +// CURSIVEABORTAFTERENAMEANDROPARTITIONAUTOINCREMENTCASTCOLUMN +// COMMITCONFLICTCROSSCURRENT_TIMESTAMPRECEDINGFAILASTFILTER +// EPLACEFIRSTFOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVER +// ETURNINGRIGHTROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBY +// INITIALLYPRIMARY +var zKWText = [666]int8{ + int8('R'), int8('E'), int8('I'), int8('N'), int8('D'), int8('E'), int8('X'), int8('E'), int8('D'), int8('E'), int8('S'), int8('C'), int8('A'), int8('P'), int8('E'), int8('A'), int8('C'), int8('H'), + int8('E'), int8('C'), int8('K'), int8('E'), int8('Y'), int8('B'), int8('E'), int8('F'), int8('O'), int8('R'), int8('E'), int8('I'), int8('G'), int8('N'), int8('O'), int8('R'), int8('E'), int8('G'), + int8('E'), int8('X'), int8('P'), int8('L'), int8('A'), int8('I'), int8('N'), int8('S'), int8('T'), int8('E'), int8('A'), int8('D'), int8('D'), int8('A'), int8('T'), int8('A'), int8('B'), int8('A'), + int8('S'), int8('E'), int8('L'), int8('E'), int8('C'), int8('T'), int8('A'), int8('B'), int8('L'), int8('E'), int8('F'), int8('T'), int8('H'), int8('E'), int8('N'), int8('D'), int8('E'), int8('F'), + int8('E'), int8('R'), int8('R'), int8('A'), int8('B'), int8('L'), int8('E'), int8('L'), int8('S'), int8('E'), int8('X'), int8('C'), int8('L'), int8('U'), int8('D'), int8('E'), int8('L'), int8('E'), + int8('T'), int8('E'), int8('M'), int8('P'), int8('O'), int8('R'), int8('A'), int8('R'), int8('Y'), int8('I'), int8('S'), int8('N'), int8('U'), int8('L'), int8('L'), int8('S'), int8('A'), int8('V'), + int8('E'), int8('P'), int8('O'), int8('I'), int8('N'), int8('T'), int8('E'), int8('R'), int8('S'), int8('E'), int8('C'), int8('T'), int8('I'), int8('E'), int8('S'), int8('N'), int8('O'), int8('T'), + int8('N'), int8('U'), int8('L'), int8('L'), int8('I'), int8('K'), int8('E'), int8('X'), int8('C'), int8('E'), int8('P'), int8('T'), int8('R'), int8('A'), int8('N'), int8('S'), int8('A'), int8('C'), + int8('T'), int8('I'), int8('O'), int8('N'), int8('A'), int8('T'), int8('U'), int8('R'), int8('A'), int8('L'), int8('T'), int8('E'), int8('R'), int8('A'), int8('I'), int8('S'), int8('E'), int8('X'), + int8('C'), int8('L'), int8('U'), int8('S'), int8('I'), int8('V'), int8('E'), int8('X'), int8('I'), int8('S'), int8('T'), int8('S'), int8('C'), int8('O'), int8('N'), int8('S'), int8('T'), int8('R'), + int8('A'), int8('I'), int8('N'), int8('T'), int8('O'), int8('F'), int8('F'), int8('S'), int8('E'), int8('T'), int8('R'), int8('I'), int8('G'), int8('G'), int8('E'), int8('R'), int8('A'), int8('N'), + int8('G'), int8('E'), int8('N'), int8('E'), int8('R'), int8('A'), int8('T'), int8('E'), int8('D'), int8('E'), int8('T'), int8('A'), int8('C'), int8('H'), int8('A'), int8('V'), int8('I'), int8('N'), + int8('G'), int8('L'), int8('O'), int8('B'), int8('E'), int8('G'), int8('I'), int8('N'), int8('N'), int8('E'), int8('R'), int8('E'), int8('F'), int8('E'), int8('R'), int8('E'), int8('N'), int8('C'), + int8('E'), int8('S'), int8('U'), int8('N'), int8('I'), int8('Q'), int8('U'), int8('E'), int8('R'), int8('Y'), int8('W'), int8('I'), int8('T'), int8('H'), int8('O'), int8('U'), int8('T'), int8('E'), + int8('R'), int8('E'), int8('L'), int8('E'), int8('A'), int8('S'), int8('E'), int8('A'), int8('T'), int8('T'), int8('A'), int8('C'), int8('H'), int8('B'), int8('E'), int8('T'), int8('W'), int8('E'), + int8('E'), int8('N'), int8('O'), int8('T'), int8('H'), int8('I'), int8('N'), int8('G'), int8('R'), int8('O'), int8('U'), int8('P'), int8('S'), int8('C'), int8('A'), int8('S'), int8('C'), int8('A'), + int8('D'), int8('E'), int8('F'), int8('A'), int8('U'), int8('L'), int8('T'), int8('C'), int8('A'), int8('S'), int8('E'), int8('C'), int8('O'), int8('L'), int8('L'), int8('A'), int8('T'), int8('E'), + int8('C'), int8('R'), int8('E'), int8('A'), int8('T'), int8('E'), int8('C'), int8('U'), int8('R'), int8('R'), int8('E'), int8('N'), int8('T'), int8('_'), int8('D'), int8('A'), int8('T'), int8('E'), + int8('I'), int8('M'), int8('M'), int8('E'), int8('D'), int8('I'), int8('A'), int8('T'), int8('E'), int8('J'), int8('O'), int8('I'), int8('N'), int8('S'), int8('E'), int8('R'), int8('T'), int8('M'), + int8('A'), int8('T'), int8('C'), int8('H'), int8('P'), int8('L'), int8('A'), int8('N'), int8('A'), int8('L'), int8('Y'), int8('Z'), int8('E'), int8('P'), int8('R'), int8('A'), int8('G'), int8('M'), + int8('A'), int8('T'), int8('E'), int8('R'), int8('I'), int8('A'), int8('L'), int8('I'), int8('Z'), int8('E'), int8('D'), int8('E'), int8('F'), int8('E'), int8('R'), int8('R'), int8('E'), int8('D'), + int8('I'), int8('S'), int8('T'), int8('I'), int8('N'), int8('C'), int8('T'), int8('U'), int8('P'), int8('D'), int8('A'), int8('T'), int8('E'), int8('V'), int8('A'), int8('L'), int8('U'), int8('E'), + int8('S'), int8('V'), int8('I'), int8('R'), int8('T'), int8('U'), int8('A'), int8('L'), int8('W'), int8('A'), int8('Y'), int8('S'), int8('W'), int8('H'), int8('E'), int8('N'), int8('W'), int8('H'), + int8('E'), int8('R'), int8('E'), int8('C'), int8('U'), int8('R'), int8('S'), int8('I'), int8('V'), int8('E'), int8('A'), int8('B'), int8('O'), int8('R'), int8('T'), int8('A'), int8('F'), int8('T'), + int8('E'), int8('R'), int8('E'), int8('N'), int8('A'), int8('M'), int8('E'), int8('A'), int8('N'), int8('D'), int8('R'), int8('O'), int8('P'), int8('A'), int8('R'), int8('T'), int8('I'), int8('T'), + int8('I'), int8('O'), int8('N'), int8('A'), int8('U'), int8('T'), int8('O'), int8('I'), int8('N'), int8('C'), int8('R'), int8('E'), int8('M'), int8('E'), int8('N'), int8('T'), int8('C'), int8('A'), + int8('S'), int8('T'), int8('C'), int8('O'), int8('L'), int8('U'), int8('M'), int8('N'), int8('C'), int8('O'), int8('M'), int8('M'), int8('I'), int8('T'), int8('C'), int8('O'), int8('N'), int8('F'), + int8('L'), int8('I'), int8('C'), int8('T'), int8('C'), int8('R'), int8('O'), int8('S'), int8('S'), int8('C'), int8('U'), int8('R'), int8('R'), int8('E'), int8('N'), int8('T'), int8('_'), int8('T'), + int8('I'), int8('M'), int8('E'), int8('S'), int8('T'), int8('A'), int8('M'), int8('P'), int8('R'), int8('E'), int8('C'), int8('E'), int8('D'), int8('I'), int8('N'), int8('G'), int8('F'), int8('A'), + int8('I'), int8('L'), int8('A'), int8('S'), int8('T'), int8('F'), int8('I'), int8('L'), int8('T'), int8('E'), int8('R'), int8('E'), int8('P'), int8('L'), int8('A'), int8('C'), int8('E'), int8('F'), + int8('I'), int8('R'), int8('S'), int8('T'), int8('F'), int8('O'), int8('L'), int8('L'), int8('O'), int8('W'), int8('I'), int8('N'), int8('G'), int8('F'), int8('R'), int8('O'), int8('M'), int8('F'), + int8('U'), int8('L'), int8('L'), int8('I'), int8('M'), int8('I'), int8('T'), int8('I'), int8('F'), int8('O'), int8('R'), int8('D'), int8('E'), int8('R'), int8('E'), int8('S'), int8('T'), int8('R'), + int8('I'), int8('C'), int8('T'), int8('O'), int8('T'), int8('H'), int8('E'), int8('R'), int8('S'), int8('O'), int8('V'), int8('E'), int8('R'), int8('E'), int8('T'), int8('U'), int8('R'), int8('N'), + int8('I'), int8('N'), int8('G'), int8('R'), int8('I'), int8('G'), int8('H'), int8('T'), int8('R'), int8('O'), int8('L'), int8('L'), int8('B'), int8('A'), int8('C'), int8('K'), int8('R'), int8('O'), + int8('W'), int8('S'), int8('U'), int8('N'), int8('B'), int8('O'), int8('U'), int8('N'), int8('D'), int8('E'), int8('D'), int8('U'), int8('N'), int8('I'), int8('O'), int8('N'), int8('U'), int8('S'), + int8('I'), int8('N'), int8('G'), int8('V'), int8('A'), int8('C'), int8('U'), int8('U'), int8('M'), int8('V'), int8('I'), int8('E'), int8('W'), int8('I'), int8('N'), int8('D'), int8('O'), int8('W'), + int8('B'), int8('Y'), int8('I'), int8('N'), int8('I'), int8('T'), int8('I'), int8('A'), int8('L'), int8('L'), int8('Y'), int8('P'), int8('R'), int8('I'), int8('M'), int8('A'), int8('R'), int8('Y'), +} /* sqlite3.c:163515:19 */ +// aKWHash[i] is the hash value for the i-th keyword +var aKWHash = [127]uint8{ + uint8(84), uint8(92), uint8(134), uint8(82), uint8(105), uint8(29), uint8(0), uint8(0), uint8(94), uint8(0), uint8(85), uint8(72), uint8(0), + uint8(53), uint8(35), uint8(86), uint8(15), uint8(0), uint8(42), uint8(97), uint8(54), uint8(89), uint8(135), uint8(19), uint8(0), uint8(0), + uint8(140), uint8(0), uint8(40), uint8(129), uint8(0), uint8(22), uint8(107), uint8(0), uint8(9), uint8(0), uint8(0), uint8(123), uint8(80), + uint8(0), uint8(78), uint8(6), uint8(0), uint8(65), uint8(103), uint8(147), uint8(0), uint8(136), uint8(115), uint8(0), uint8(0), uint8(48), + uint8(0), uint8(90), uint8(24), uint8(0), uint8(17), uint8(0), uint8(27), uint8(70), uint8(23), uint8(26), uint8(5), uint8(60), uint8(142), + uint8(110), uint8(122), uint8(0), uint8(73), uint8(91), uint8(71), uint8(145), uint8(61), uint8(120), uint8(74), uint8(0), uint8(49), uint8(0), + uint8(11), uint8(41), uint8(0), uint8(113), uint8(0), uint8(0), uint8(0), uint8(109), uint8(10), uint8(111), uint8(116), uint8(125), uint8(14), + uint8(50), uint8(124), uint8(0), uint8(100), uint8(0), uint8(18), uint8(121), uint8(144), uint8(56), uint8(130), uint8(139), uint8(88), uint8(83), + uint8(37), uint8(30), uint8(126), uint8(0), uint8(0), uint8(108), uint8(51), uint8(131), uint8(128), uint8(0), uint8(34), uint8(0), uint8(0), + uint8(132), uint8(0), uint8(98), uint8(38), uint8(39), uint8(0), uint8(20), uint8(45), uint8(117), uint8(93), +} /* sqlite3.c:163555:28 */ +// aKWNext[] forms the hash collision chain. If aKWHash[i]==0 +// then the i-th keyword has no more hash collisions. Otherwise, +// the next keyword with the same hash is aKWHash[i]-1. +var aKWNext = [147]uint8{ + uint8(0), uint8(0), uint8(0), uint8(0), uint8(4), uint8(0), uint8(43), uint8(0), uint8(0), uint8(106), uint8(114), uint8(0), uint8(0), + uint8(0), uint8(2), uint8(0), uint8(0), uint8(143), uint8(0), uint8(0), uint8(0), uint8(13), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(141), uint8(0), uint8(0), uint8(119), uint8(52), uint8(0), uint8(0), uint8(137), uint8(12), uint8(0), uint8(0), uint8(62), uint8(0), + uint8(138), uint8(0), uint8(133), uint8(0), uint8(0), uint8(36), uint8(0), uint8(0), uint8(28), uint8(77), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(59), uint8(0), uint8(47), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(69), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(146), uint8(3), uint8(0), uint8(58), uint8(0), uint8(1), + uint8(75), uint8(0), uint8(0), uint8(0), uint8(31), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(127), uint8(0), uint8(104), + uint8(0), uint8(64), uint8(66), uint8(63), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(46), uint8(0), uint8(16), uint8(8), + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(81), uint8(101), uint8(0), + uint8(112), uint8(21), uint8(7), uint8(67), uint8(0), uint8(79), uint8(96), uint8(118), uint8(0), uint8(0), uint8(68), uint8(0), uint8(0), + uint8(99), uint8(44), uint8(0), uint8(55), uint8(0), uint8(76), uint8(0), uint8(95), uint8(32), uint8(33), uint8(57), uint8(25), uint8(0), + uint8(102), uint8(0), uint8(0), uint8(87), +} /* sqlite3.c:163570:28 */ +// aKWLen[i] is the length (in bytes) of the i-th keyword +var aKWLen = [147]uint8{ + uint8(7), uint8(7), uint8(5), uint8(4), uint8(6), uint8(4), uint8(5), uint8(3), uint8(6), uint8(7), uint8(3), uint8(6), uint8(6), + uint8(7), uint8(7), uint8(3), uint8(8), uint8(2), uint8(6), uint8(5), uint8(4), uint8(4), uint8(3), uint8(10), uint8(4), uint8(7), + uint8(6), uint8(9), uint8(4), uint8(2), uint8(6), uint8(5), uint8(9), uint8(9), uint8(4), uint8(7), uint8(3), uint8(2), uint8(4), + uint8(4), uint8(6), uint8(11), uint8(6), uint8(2), uint8(7), uint8(5), uint8(5), uint8(9), uint8(6), uint8(10), uint8(4), uint8(6), + uint8(2), uint8(3), uint8(7), uint8(5), uint8(9), uint8(6), uint8(6), uint8(4), uint8(5), uint8(5), uint8(10), uint8(6), uint8(5), + uint8(7), uint8(4), uint8(5), uint8(7), uint8(6), uint8(7), uint8(7), uint8(6), uint8(5), uint8(7), uint8(3), uint8(7), uint8(4), + uint8(7), uint8(6), uint8(12), uint8(9), uint8(4), uint8(6), uint8(5), uint8(4), uint8(7), uint8(6), uint8(12), uint8(8), uint8(8), + uint8(2), uint8(6), uint8(6), uint8(7), uint8(6), uint8(4), uint8(5), uint8(9), uint8(5), uint8(5), uint8(6), uint8(3), uint8(4), + uint8(9), uint8(13), uint8(2), uint8(2), uint8(4), uint8(6), uint8(6), uint8(8), uint8(5), uint8(17), uint8(12), uint8(7), uint8(9), + uint8(4), uint8(4), uint8(6), uint8(7), uint8(5), uint8(9), uint8(4), uint8(4), uint8(5), uint8(2), uint8(5), uint8(8), uint8(6), + uint8(4), uint8(9), uint8(5), uint8(8), uint8(4), uint8(3), uint8(9), uint8(5), uint8(5), uint8(6), uint8(4), uint8(6), uint8(2), + uint8(2), uint8(9), uint8(3), uint8(7), +} /* sqlite3.c:163585:28 */ +// aKWOffset[i] is the index into zKWText[] of the start of +// the text for the i-th keyword. +var aKWOffset = [147]uint16{ + uint16(0), uint16(2), uint16(2), uint16(8), uint16(9), uint16(14), uint16(16), uint16(20), uint16(23), uint16(25), uint16(25), uint16(29), uint16(33), + uint16(36), uint16(41), uint16(46), uint16(48), uint16(53), uint16(54), uint16(59), uint16(62), uint16(65), uint16(67), uint16(69), uint16(78), uint16(81), + uint16(86), uint16(90), uint16(90), uint16(94), uint16(99), uint16(101), uint16(105), uint16(111), uint16(119), uint16(123), uint16(123), uint16(123), uint16(126), + uint16(129), uint16(132), uint16(137), uint16(142), uint16(146), uint16(147), uint16(152), uint16(156), uint16(160), uint16(168), uint16(174), uint16(181), uint16(184), + uint16(184), uint16(187), uint16(189), uint16(195), uint16(198), uint16(206), uint16(211), uint16(216), uint16(219), uint16(222), uint16(226), uint16(236), uint16(239), + uint16(244), uint16(244), uint16(248), uint16(252), uint16(259), uint16(265), uint16(271), uint16(277), uint16(277), uint16(283), uint16(284), uint16(288), uint16(295), + uint16(299), uint16(306), uint16(312), uint16(324), uint16(333), uint16(335), uint16(341), uint16(346), uint16(348), uint16(355), uint16(359), uint16(370), uint16(377), + uint16(378), uint16(385), uint16(391), uint16(397), uint16(402), uint16(408), uint16(412), uint16(415), uint16(424), uint16(429), uint16(433), uint16(439), uint16(441), + uint16(444), uint16(453), uint16(455), uint16(457), uint16(466), uint16(470), uint16(476), uint16(482), uint16(490), uint16(495), uint16(495), uint16(495), uint16(511), + uint16(520), uint16(523), uint16(527), uint16(532), uint16(539), uint16(544), uint16(553), uint16(557), uint16(560), uint16(565), uint16(567), uint16(571), uint16(579), + uint16(585), uint16(588), uint16(597), uint16(602), uint16(610), uint16(610), uint16(614), uint16(623), uint16(628), uint16(633), uint16(639), uint16(642), uint16(645), + uint16(648), uint16(650), uint16(655), uint16(659), +} /* sqlite3.c:163601:33 */ +// aKWCode[i] is the parser symbol code for the i-th keyword +var aKWCode = [147]uint8{ + uint8(TK_REINDEX), uint8(TK_INDEXED), uint8(TK_INDEX), uint8(TK_DESC), uint8(TK_ESCAPE), + uint8(TK_EACH), uint8(TK_CHECK), uint8(TK_KEY), uint8(TK_BEFORE), uint8(TK_FOREIGN), + uint8(TK_FOR), uint8(TK_IGNORE), uint8(TK_LIKE_KW), uint8(TK_EXPLAIN), uint8(TK_INSTEAD), + uint8(TK_ADD), uint8(TK_DATABASE), uint8(TK_AS), uint8(TK_SELECT), uint8(TK_TABLE), + uint8(TK_JOIN_KW), uint8(TK_THEN), uint8(TK_END), uint8(TK_DEFERRABLE), uint8(TK_ELSE), + uint8(TK_EXCLUDE), uint8(TK_DELETE), uint8(TK_TEMP), uint8(TK_TEMP), uint8(TK_OR), + uint8(TK_ISNULL), uint8(TK_NULLS), uint8(TK_SAVEPOINT), uint8(TK_INTERSECT), uint8(TK_TIES), + uint8(TK_NOTNULL), uint8(TK_NOT), uint8(TK_NO), uint8(TK_NULL), uint8(TK_LIKE_KW), + uint8(TK_EXCEPT), uint8(TK_TRANSACTION), uint8(TK_ACTION), uint8(TK_ON), uint8(TK_JOIN_KW), + uint8(TK_ALTER), uint8(TK_RAISE), uint8(TK_EXCLUSIVE), uint8(TK_EXISTS), uint8(TK_CONSTRAINT), + uint8(TK_INTO), uint8(TK_OFFSET), uint8(TK_OF), uint8(TK_SET), uint8(TK_TRIGGER), + uint8(TK_RANGE), uint8(TK_GENERATED), uint8(TK_DETACH), uint8(TK_HAVING), uint8(TK_LIKE_KW), + uint8(TK_BEGIN), uint8(TK_JOIN_KW), uint8(TK_REFERENCES), uint8(TK_UNIQUE), uint8(TK_QUERY), + uint8(TK_WITHOUT), uint8(TK_WITH), uint8(TK_JOIN_KW), uint8(TK_RELEASE), uint8(TK_ATTACH), + uint8(TK_BETWEEN), uint8(TK_NOTHING), uint8(TK_GROUPS), uint8(TK_GROUP), uint8(TK_CASCADE), + uint8(TK_ASC), uint8(TK_DEFAULT), uint8(TK_CASE), uint8(TK_COLLATE), uint8(TK_CREATE), + uint8(TK_CTIME_KW), uint8(TK_IMMEDIATE), uint8(TK_JOIN), uint8(TK_INSERT), uint8(TK_MATCH), + uint8(TK_PLAN), uint8(TK_ANALYZE), uint8(TK_PRAGMA), uint8(TK_MATERIALIZED), uint8(TK_DEFERRED), + uint8(TK_DISTINCT), uint8(TK_IS), uint8(TK_UPDATE), uint8(TK_VALUES), uint8(TK_VIRTUAL), + uint8(TK_ALWAYS), uint8(TK_WHEN), uint8(TK_WHERE), uint8(TK_RECURSIVE), uint8(TK_ABORT), + uint8(TK_AFTER), uint8(TK_RENAME), uint8(TK_AND), uint8(TK_DROP), uint8(TK_PARTITION), + uint8(TK_AUTOINCR), uint8(TK_TO), uint8(TK_IN), uint8(TK_CAST), uint8(TK_COLUMNKW), + uint8(TK_COMMIT), uint8(TK_CONFLICT), uint8(TK_JOIN_KW), uint8(TK_CTIME_KW), uint8(TK_CTIME_KW), + uint8(TK_CURRENT), uint8(TK_PRECEDING), uint8(TK_FAIL), uint8(TK_LAST), uint8(TK_FILTER), + uint8(TK_REPLACE), uint8(TK_FIRST), uint8(TK_FOLLOWING), uint8(TK_FROM), uint8(TK_JOIN_KW), + uint8(TK_LIMIT), uint8(TK_IF), uint8(TK_ORDER), uint8(TK_RESTRICT), uint8(TK_OTHERS), + uint8(TK_OVER), uint8(TK_RETURNING), uint8(TK_JOIN_KW), uint8(TK_ROLLBACK), uint8(TK_ROWS), + uint8(TK_ROW), uint8(TK_UNBOUNDED), uint8(TK_UNION), uint8(TK_USING), uint8(TK_VACUUM), + uint8(TK_VIEW), uint8(TK_WINDOW), uint8(TK_DO), uint8(TK_BY), uint8(TK_INITIALLY), + uint8(TK_ALL), uint8(TK_PRIMARY), +} /* sqlite3.c:163616:28 */ + +// Hash table decoded: +// 0: INSERT +// 1: IS +// 2: ROLLBACK TRIGGER +// 3: IMMEDIATE +// 4: PARTITION +// 5: TEMP +// 6: +// 7: +// 8: VALUES WITHOUT +// 9: +// 10: MATCH +// 11: NOTHING +// 12: +// 13: OF +// 14: TIES IGNORE +// 15: PLAN +// 16: INSTEAD INDEXED +// 17: +// 18: TRANSACTION RIGHT +// 19: WHEN +// 20: SET HAVING +// 21: MATERIALIZED IF +// 22: ROWS +// 23: SELECT +// 24: +// 25: +// 26: VACUUM SAVEPOINT +// 27: +// 28: LIKE UNION VIRTUAL REFERENCES +// 29: RESTRICT +// 30: +// 31: THEN REGEXP +// 32: TO +// 33: +// 34: BEFORE +// 35: +// 36: +// 37: FOLLOWING COLLATE CASCADE +// 38: CREATE +// 39: +// 40: CASE REINDEX +// 41: EACH +// 42: +// 43: QUERY +// 44: AND ADD +// 45: PRIMARY ANALYZE +// 46: +// 47: ROW ASC DETACH +// 48: CURRENT_TIME CURRENT_DATE +// 49: +// 50: +// 51: EXCLUSIVE TEMPORARY +// 52: +// 53: DEFERRED +// 54: DEFERRABLE +// 55: +// 56: DATABASE +// 57: +// 58: DELETE VIEW GENERATED +// 59: ATTACH +// 60: END +// 61: EXCLUDE +// 62: ESCAPE DESC +// 63: GLOB +// 64: WINDOW ELSE +// 65: COLUMN +// 66: FIRST +// 67: +// 68: GROUPS ALL +// 69: DISTINCT DROP KEY +// 70: BETWEEN +// 71: INITIALLY +// 72: BEGIN +// 73: FILTER CHECK ACTION +// 74: GROUP INDEX +// 75: +// 76: EXISTS DEFAULT +// 77: +// 78: FOR CURRENT_TIMESTAMP +// 79: EXCEPT +// 80: +// 81: CROSS +// 82: +// 83: +// 84: +// 85: CAST +// 86: FOREIGN AUTOINCREMENT +// 87: COMMIT +// 88: CURRENT AFTER ALTER +// 89: FULL FAIL CONFLICT +// 90: EXPLAIN +// 91: CONSTRAINT +// 92: FROM ALWAYS +// 93: +// 94: ABORT +// 95: +// 96: AS DO +// 97: REPLACE WITH RELEASE +// 98: BY RENAME +// 99: RANGE RAISE +// 100: OTHERS +// 101: USING NULLS +// 102: PRAGMA +// 103: JOIN ISNULL OFFSET +// 104: NOT +// 105: OR LAST LEFT +// 106: LIMIT +// 107: +// 108: +// 109: IN +// 110: INTO +// 111: OVER RECURSIVE +// 112: ORDER OUTER +// 113: +// 114: INTERSECT UNBOUNDED +// 115: +// 116: +// 117: RETURNING ON +// 118: +// 119: WHERE +// 120: NO INNER +// 121: NULL +// 122: +// 123: TABLE +// 124: NATURAL NOTNULL +// 125: PRECEDING +// 126: UPDATE UNIQUE +// Check to see if z[0..n-1] is a keyword. If it is, write the +// parser symbol code for that keyword into *pType. Always +// return the integer n (the length of the token). +func keywordCode(tls *libc.TLS, z uintptr, n int32, pType uintptr) int32 { /* sqlite3.c:163780:12: */ + var i int32 + var j int32 + var zKW uintptr + if n >= 2 { + i = ((((int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z)))]) * 4) ^ (int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(z + uintptr((n - 1)))))]) * 3)) ^ (n * 1)) % 127) + for i = ((int32(aKWHash[i])) - 1); i >= 0; i = ((int32(aKWNext[i])) - 1) { + if int32(aKWLen[i]) != n { + continue + } + zKW = (uintptr(unsafe.Pointer(&zKWText)) + uintptr(aKWOffset[i])) + if (int32(*(*int8)(unsafe.Pointer(z))) & libc.CplInt32(0x20)) != int32(*(*int8)(unsafe.Pointer(zKW))) { + continue + } + if (int32(*(*int8)(unsafe.Pointer(z + 1))) & libc.CplInt32(0x20)) != int32(*(*int8)(unsafe.Pointer(zKW + 1))) { + continue + } + j = 2 + for (j < n) && ((int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) & libc.CplInt32(0x20)) == int32(*(*int8)(unsafe.Pointer(zKW + uintptr(j))))) { + j++ + } + if j < n { + continue + } + // REINDEX + // INDEXED + // INDEX + // DESC + // ESCAPE + // EACH + // CHECK + // KEY + // BEFORE + // FOREIGN + // FOR + // IGNORE + // REGEXP + // EXPLAIN + // INSTEAD + // ADD + // DATABASE + // AS + // SELECT + // TABLE + // LEFT + // THEN + // END + // DEFERRABLE + // ELSE + // EXCLUDE + // DELETE + // TEMPORARY + // TEMP + // OR + // ISNULL + // NULLS + // SAVEPOINT + // INTERSECT + // TIES + // NOTNULL + // NOT + // NO + // NULL + // LIKE + // EXCEPT + // TRANSACTION + // ACTION + // ON + // NATURAL + // ALTER + // RAISE + // EXCLUSIVE + // EXISTS + // CONSTRAINT + // INTO + // OFFSET + // OF + // SET + // TRIGGER + // RANGE + // GENERATED + // DETACH + // HAVING + // GLOB + // BEGIN + // INNER + // REFERENCES + // UNIQUE + // QUERY + // WITHOUT + // WITH + // OUTER + // RELEASE + // ATTACH + // BETWEEN + // NOTHING + // GROUPS + // GROUP + // CASCADE + // ASC + // DEFAULT + // CASE + // COLLATE + // CREATE + // CURRENT_DATE + // IMMEDIATE + // JOIN + // INSERT + // MATCH + // PLAN + // ANALYZE + // PRAGMA + // MATERIALIZED + // DEFERRED + // DISTINCT + // IS + // UPDATE + // VALUES + // VIRTUAL + // ALWAYS + // WHEN + // WHERE + // RECURSIVE + // ABORT + // AFTER + // RENAME + // AND + // DROP + // PARTITION + // AUTOINCREMENT + // TO + // IN + // CAST + // COLUMN + // COMMIT + // CONFLICT + // CROSS + // CURRENT_TIMESTAMP + // CURRENT_TIME + // CURRENT + // PRECEDING + // FAIL + // LAST + // FILTER + // REPLACE + // FIRST + // FOLLOWING + // FROM + // FULL + // LIMIT + // IF + // ORDER + // RESTRICT + // OTHERS + // OVER + // RETURNING + // RIGHT + // ROLLBACK + // ROWS + // ROW + // UNBOUNDED + // UNION + // USING + // VACUUM + // VIEW + // WINDOW + // DO + // BY + // INITIALLY + // ALL + // PRIMARY + *(*int32)(unsafe.Pointer(pType)) = int32(aKWCode[i]) + break + } + } + return n +} + +func Xsqlite3KeywordCode(tls *libc.TLS, z uintptr, n int32) int32 { /* sqlite3.c:163954:20: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* id */)) = TK_ID + keywordCode(tls, z, n, bp /* &id */) + return *(*int32)(unsafe.Pointer(bp /* id */)) +} + +func Xsqlite3_keyword_name(tls *libc.TLS, i int32, pzName uintptr, pnName uintptr) int32 { /* sqlite3.c:163960:16: */ + if (i < 0) || (i >= SQLITE_N_KEYWORD) { + return SQLITE_ERROR + } + *(*uintptr)(unsafe.Pointer(pzName)) = (uintptr(unsafe.Pointer(&zKWText)) + uintptr(aKWOffset[i])) + *(*int32)(unsafe.Pointer(pnName)) = int32(aKWLen[i]) + return SQLITE_OK +} + +func Xsqlite3_keyword_count(tls *libc.TLS) int32 { /* sqlite3.c:163966:16: */ + return SQLITE_N_KEYWORD +} + +func Xsqlite3_keyword_check(tls *libc.TLS, zName uintptr, nName int32) int32 { /* sqlite3.c:163967:16: */ + return (libc.Bool32(TK_ID != Xsqlite3KeywordCode(tls, zName, nName))) +} + +//************* End of keywordhash.h **************************************** +//************* Continuing where we left off in tokenize.c ****************** + +// If X is a character that can be used in an identifier then +// IdChar(X) will be true. Otherwise it is false. +// +// For ASCII, any character with the high-order bit set is +// allowed in an identifier. For 7-bit characters, +// sqlite3IsIdChar[X] must be 1. +// +// For EBCDIC, the rules are more complex but have the same +// end result. +// +// Ticket #1066. the SQL standard does not allow '$' in the +// middle of identifiers. But many SQL implementations do. +// SQLite will allow '$' in identifiers for compatibility. +// But the feature is undocumented. + +// Make the IdChar function accessible from ctime.c and alter.c +func Xsqlite3IsIdChar(tls *libc.TLS, c U8) int32 { /* sqlite3.c:164014:20: */ + return (libc.Bool32((int32(Xsqlite3CtypeMap[c]) & 0x46) != 0)) +} + +// Return the id of the next token in string (*pz). Before returning, set +// (*pz) to point to the byte following the parsed token. +func getToken(tls *libc.TLS, pz uintptr) int32 { /* sqlite3.c:164021:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var z uintptr = *(*uintptr)(unsafe.Pointer(pz)) + // var t int32 at bp, 4 + // Token type to return + for ok := true; ok; ok = (*(*int32)(unsafe.Pointer(bp /* t */)) == TK_SPACE) { + z += uintptr(Xsqlite3GetToken(tls, z, bp /* &t */)) + } + if (((((*(*int32)(unsafe.Pointer(bp /* t */)) == TK_ID) || + (*(*int32)(unsafe.Pointer(bp /* t */)) == TK_STRING)) || + (*(*int32)(unsafe.Pointer(bp /* t */)) == TK_JOIN_KW)) || + (*(*int32)(unsafe.Pointer(bp /* t */)) == TK_WINDOW)) || + (*(*int32)(unsafe.Pointer(bp /* t */)) == TK_OVER)) || + (Xsqlite3ParserFallback(tls, *(*int32)(unsafe.Pointer(bp /* t */))) == TK_ID) { + *(*int32)(unsafe.Pointer(bp /* t */)) = TK_ID + } + *(*uintptr)(unsafe.Pointer(pz)) = z + return *(*int32)(unsafe.Pointer(bp /* t */)) +} + +// The following three functions are called immediately after the tokenizer +// reads the keywords WINDOW, OVER and FILTER, respectively, to determine +// whether the token should be treated as a keyword or an SQL identifier. +// This cannot be handled by the usual lemon %fallback method, due to +// the ambiguity in some constructions. e.g. +// +// SELECT sum(x) OVER ... +// +// In the above, "OVER" might be a keyword, or it might be an alias for the +// sum(x) expression. If a "%fallback ID OVER" directive were added to +// grammar, then SQLite would always treat "OVER" as an alias, making it +// impossible to call a window-function without a FILTER clause. +// +// WINDOW is treated as a keyword if: +// +// * the following token is an identifier, or a keyword that can fallback +// to being an identifier, and +// * the token after than one is TK_AS. +// +// OVER is a keyword if: +// +// * the previous token was TK_RP, and +// * the next token is either TK_LP or an identifier. +// +// FILTER is a keyword if: +// +// * the previous token was TK_RP, and +// * the next token is TK_LP. +func analyzeWindowKeyword(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:164070:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = z + + var t int32 + t = getToken(tls, bp /* &z */) + if t != TK_ID { + return TK_ID + } + t = getToken(tls, bp /* &z */) + if t != TK_AS { + return TK_ID + } + return TK_WINDOW +} + +func analyzeOverKeyword(tls *libc.TLS, z uintptr, lastToken int32) int32 { /* sqlite3.c:164078:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = z + + if lastToken == TK_RP { + var t int32 = getToken(tls, bp /* &z */) + if (t == TK_LP) || (t == TK_ID) { + return TK_OVER + } + } + return TK_ID +} + +func analyzeFilterKeyword(tls *libc.TLS, z uintptr, lastToken int32) int32 { /* sqlite3.c:164085:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = z + + if (lastToken == TK_RP) && (getToken(tls, bp /* &z */) == TK_LP) { + return TK_FILTER + } + return TK_ID +} + +// Return the length (in bytes) of the token that begins at z[0]. +// Store the token type in *tokenType before returning. +func Xsqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) int32 { /* sqlite3.c:164097:20: */ + var i int32 + var c int32 + switch int32(aiClass[*(*uint8)(unsafe.Pointer(z))]) { // Switch on the character-class of the first byte + // of the token. See the comment on the CC_ defines + // above. + case CC_SPACE: + { + + for i = 1; (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x01) != 0; i++ { + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE + return i + + } + case CC_MINUS: + { + if int32(*(*uint8)(unsafe.Pointer(z + 1))) == '-' { + for i = 2; ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0) && (c != '\n'); i++ { + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE // IMP: R-22934-25134 + return i + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_MINUS + return 1 + + } + case CC_LP: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_LP + return 1 + + } + case CC_RP: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_RP + return 1 + + } + case CC_SEMI: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_SEMI + return 1 + + } + case CC_PLUS: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_PLUS + return 1 + + } + case CC_STAR: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_STAR + return 1 + + } + case CC_SLASH: + { + if (int32(*(*uint8)(unsafe.Pointer(z + 1))) != '*') || (int32(*(*uint8)(unsafe.Pointer(z + 2))) == 0) { + *(*int32)(unsafe.Pointer(tokenType)) = TK_SLASH + return 1 + } + i = 3 + c = int32(*(*uint8)(unsafe.Pointer(z + 2))) + for ; ((c != '*') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '/')) && ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0); i++ { + } + if c != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE // IMP: R-22934-25134 + return i + + } + case CC_PERCENT: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_REM + return 1 + + } + case CC_EQ: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_EQ + return (1 + (libc.Bool32(int32(*(*uint8)(unsafe.Pointer(z + 1))) == '='))) + + } + case CC_LT: + { + if (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + 1))))) == '=' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_LE + return 2 + } else if c == '>' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_NE + return 2 + } else if c == '<' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_LSHIFT + return 2 + } else { + *(*int32)(unsafe.Pointer(tokenType)) = TK_LT + return 1 + } + + } + fallthrough + case CC_GT: + { + if (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + 1))))) == '=' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_GE + return 2 + } else if c == '>' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_RSHIFT + return 2 + } else { + *(*int32)(unsafe.Pointer(tokenType)) = TK_GT + return 1 + } + + } + fallthrough + case CC_BANG: + { + if int32(*(*uint8)(unsafe.Pointer(z + 1))) != '=' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + return 1 + } else { + *(*int32)(unsafe.Pointer(tokenType)) = TK_NE + return 2 + } + + } + fallthrough + case CC_PIPE: + { + if int32(*(*uint8)(unsafe.Pointer(z + 1))) != '|' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_BITOR + return 1 + } else { + *(*int32)(unsafe.Pointer(tokenType)) = TK_CONCAT + return 2 + } + + } + fallthrough + case CC_COMMA: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_COMMA + return 1 + + } + case CC_AND: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_BITAND + return 1 + + } + case CC_TILDA: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_BITNOT + return 1 + + } + case CC_QUOTE: + { + var delim int32 = int32(*(*uint8)(unsafe.Pointer(z))) + + for i = 1; (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0; i++ { + if c == delim { + if int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == delim { + i++ + } else { + break + } + } + } + if c == '\'' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_STRING + return (i + 1) + } else if c != 0 { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ID + return (i + 1) + } else { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + return i + } + + } + fallthrough + case CC_DOT: + { + if !((int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 1))]) & 0x04) != 0) { + *(*int32)(unsafe.Pointer(tokenType)) = TK_DOT + return 1 + } + + } + fallthrough + case CC_DIGIT: + { + + *(*int32)(unsafe.Pointer(tokenType)) = TK_INTEGER + if ((int32(*(*uint8)(unsafe.Pointer(z))) == '0') && ((int32(*(*uint8)(unsafe.Pointer(z + 1))) == 'x') || (int32(*(*uint8)(unsafe.Pointer(z + 1))) == 'X'))) && ((int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 2))]) & 0x08) != 0) { + for i = 3; (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x08) != 0; i++ { + } + return i + } + for i = 0; (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0; i++ { + } + if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == '.' { + i++ + for (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_FLOAT + } + if ((int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == 'e') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == 'E')) && (((int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))]) & 0x04) != 0) || + (((int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == '+') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == '-')) && ((int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr((i + 2))))]) & 0x04) != 0))) { + i = i + (2) + for (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_FLOAT + } + for (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + i++ + } + return i + + } + case CC_QUOTE2: + { + i = 1 + c = int32(*(*uint8)(unsafe.Pointer(z))) + for ; (c != ']') && ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0); i++ { + } + *(*int32)(unsafe.Pointer(tokenType)) = func() int32 { + if c == ']' { + return TK_ID + } + return TK_ILLEGAL + }() + return i + + } + case CC_VARNUM: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_VARIABLE + for i = 1; (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0; i++ { + } + return i + + } + case CC_DOLLAR: + fallthrough + case CC_VARALPHA: + { + var n int32 = 0 + + *(*int32)(unsafe.Pointer(tokenType)) = TK_VARIABLE + for i = 1; (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0; i++ { + if (int32(Xsqlite3CtypeMap[uint8(c)]) & 0x46) != 0 { + n++ + } else if (c == '(') && (n > 0) { + for ok := true; ok; ok = ((((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0) && !((int32(Xsqlite3CtypeMap[uint8(c)]) & 0x01) != 0)) && (c != ')')) { + i++ + } + if c == ')' { + i++ + } else { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + } + break + } else if (c == ':') && (int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == ':') { + i++ + } else { + break + } + } + if n == 0 { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + } + return i + + } + case CC_KYWD0: + { + for i = 1; int32(aiClass[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) <= CC_KYWD; i++ { + } + if (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 { + // This token started out using characters that can appear in keywords, + // but z[i] is a character not allowed within keywords, so this must + // be an identifier instead + i++ + break + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_ID + return keywordCode(tls, z, i, tokenType) + + } + case CC_X: + { + + if int32(*(*uint8)(unsafe.Pointer(z + 1))) == '\'' { + *(*int32)(unsafe.Pointer(tokenType)) = TK_BLOB + for i = 2; (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x08) != 0; i++ { + } + if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '\'') || ((i % 2) != 0) { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + for (*(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0) && (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '\'') { + i++ + } + } + if *(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0 { + i++ + } + return i + } + + } + fallthrough + case CC_KYWD: + fallthrough + case CC_ID: + { + i = 1 + break + + } + case CC_BOM: + { + if (int32(*(*uint8)(unsafe.Pointer(z + 1))) == 0xbb) && (int32(*(*uint8)(unsafe.Pointer(z + 2))) == 0xbf) { + *(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE + return 3 + } + i = 1 + break + + } + case CC_NUL: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + return 0 + + } + default: + { + *(*int32)(unsafe.Pointer(tokenType)) = TK_ILLEGAL + return 1 + + } + } + for (int32(Xsqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 { + i++ + } + *(*int32)(unsafe.Pointer(tokenType)) = TK_ID + return i +} + +// Run the parser on the given SQL string. The parser structure is +// passed in. An SQLITE_ status code is returned. If an error occurs +// then an and attempt is made to write an error message into +// memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that +// error message. +func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:164392:20: */ + bp := tls.Alloc(2468) + defer tls.Free(2468) + + var nErr int32 = 0 // Number of errors encountered + var pEngine uintptr // The LEMON-generated LALR(1) parser + var n int32 = 0 // Length of the next token token + // var tokenType int32 at bp+2464, 4 + // type of the next token + var lastTokenParsed int32 = -1 // type of the previous token + var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection + var mxSqlLen int32 // Max length of an SQL string + // var sEngine YyParser at bp+40, 2424 + // Space to hold the Lemon-generated Parser object + + mxSqlLen = *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 1*4)) + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + libc.AtomicStoreNInt32((db + 400 /* &.u1 */ /* &.isInterrupted */), int32(0), 0) + } + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_OK + (*Parse)(unsafe.Pointer(pParse)).FzTail = zSql + + pEngine = bp + 40 /* &sEngine */ + Xsqlite3ParserInit(tls, pEngine, pParse) + + (*Parse)(unsafe.Pointer(pParse)).FpParentParse = (*Sqlite3)(unsafe.Pointer(db)).FpParse + (*Sqlite3)(unsafe.Pointer(db)).FpParse = pParse + for 1 != 0 { + n = Xsqlite3GetToken(tls, zSql, bp+2464 /* &tokenType */) + mxSqlLen = mxSqlLen - (n) + if mxSqlLen < 0 { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_TOOBIG + break + } + if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) >= TK_WINDOW { + + if libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_INTERRUPT + break + } + if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_SPACE { + zSql += uintptr(n) + continue + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + // Upon reaching the end of input, call the parser two more times + // with tokens TK_SEMI and 0, in that order. + if lastTokenParsed == TK_SEMI { + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = 0 + } else if lastTokenParsed == 0 { + break + } else { + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = TK_SEMI + } + n = 0 + } else if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_WINDOW { + + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeWindowKeyword(tls, (zSql + 6)) + } else if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_OVER { + + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeOverKeyword(tls, (zSql + 4), lastTokenParsed) + } else if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_FILTER { + + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) + } else { + Xsqlite3ErrorMsg(tls, pParse, ts+21581 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + break + } + } + (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fz = zSql + (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fn = uint32(n) + Xsqlite3Parser(tls, pEngine, *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)), (*Parse)(unsafe.Pointer(pParse)).FsLastToken) + lastTokenParsed = *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) + zSql += uintptr(n) + + if (*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK { + break + } + } + + Xsqlite3ParserFinalize(tls, pEngine) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + } + if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2791 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + } + + if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21608, /* "%s in \"%s\"" */ + libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) + nErr++ + } + (*Parse)(unsafe.Pointer(pParse)).FzTail = zSql + if (((*Parse)(unsafe.Pointer(pParse)).FpVdbe != 0) && ((*Parse)(unsafe.Pointer(pParse)).FnErr > 0)) && (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) { + Xsqlite3VdbeDelete(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe) + (*Parse)(unsafe.Pointer(pParse)).FpVdbe = uintptr(0) + } + if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { + Xsqlite3DbFree(tls, db, (*Parse)(unsafe.Pointer(pParse)).FaTableLock) + (*Parse)(unsafe.Pointer(pParse)).FaTableLock = uintptr(0) + (*Parse)(unsafe.Pointer(pParse)).FnTableLock = 0 + } + Xsqlite3_free(tls, (*Parse)(unsafe.Pointer(pParse)).FapVtabLock) + + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) != PARSE_MODE_NORMAL) { + // If the pParse->declareVtab flag is set, do not delete any table + // structure built up in pParse->pNewTable. The calling code (see vtab.c) + // will take responsibility for freeing the Table structure. + Xsqlite3DeleteTable(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpNewTable) + } + if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { + Xsqlite3DeleteTrigger(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger) + } + Xsqlite3DbFree(tls, db, (*Parse)(unsafe.Pointer(pParse)).FpVList) + (*Sqlite3)(unsafe.Pointer(db)).FpParse = (*Parse)(unsafe.Pointer(pParse)).FpParentParse + (*Parse)(unsafe.Pointer(pParse)).FpParentParse = uintptr(0) + + return nErr +} + +//************* End of tokenize.c ******************************************* +//************* Begin file complete.c *************************************** +// 2001 September 15 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// An tokenizer for SQL +// +// This file contains C code that implements the sqlite3_complete() API. +// This code used to be part of the tokenizer.c source file. But by +// separating it out, the code will be automatically omitted from +// static links that do not use it. +// #include "sqliteInt.h" + +// This is defined in tokenize.c. We just have to import the definition. + +// Token types used by the sqlite3_complete() routine. See the header +// comments on that procedure for additional information. + +// Return TRUE if the given SQL string ends in a semicolon. +// +// Special handling is require for CREATE TRIGGER statements. +// Whenever the CREATE TRIGGER keywords are seen, the statement +// must end with ";END;". +// +// This implementation uses a state machine with 8 states: +// +// (0) INVALID We have not yet seen a non-whitespace character. +// +// (1) START At the beginning or end of an SQL statement. This routine +// returns 1 if it ends in the START state and 0 if it ends +// in any other state. +// +// (2) NORMAL We are in the middle of statement which ends with a single +// semicolon. +// +// (3) EXPLAIN The keyword EXPLAIN has been seen at the beginning of +// a statement. +// +// (4) CREATE The keyword CREATE has been seen at the beginning of a +// statement, possibly preceded by EXPLAIN and/or followed by +// TEMP or TEMPORARY +// +// (5) TRIGGER We are in the middle of a trigger definition that must be +// ended by a semicolon, the keyword END, and another semicolon. +// +// (6) SEMI We've seen the first semicolon in the ";END;" that occurs at +// the end of a trigger definition. +// +// (7) END We've seen the ";END" of the ";END;" that occurs at the end +// of a trigger definition. +// +// Transitions between states above are determined by tokens extracted +// from the input. The following tokens are significant: +// +// (0) tkSEMI A semicolon. +// (1) tkWS Whitespace. +// (2) tkOTHER Any other SQL token. +// (3) tkEXPLAIN The "explain" keyword. +// (4) tkCREATE The "create" keyword. +// (5) tkTEMP The "temp" or "temporary" keyword. +// (6) tkTRIGGER The "trigger" keyword. +// (7) tkEND The "end" keyword. +// +// Whitespace never causes a state transition and is always ignored. +// This means that a SQL string of all whitespace is invalid. +// +// If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed +// to recognize the end of a trigger can be omitted. All we have to do +// is look for a semicolon that is not part of an string or comment. +func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796:16: */ + var state U8 = U8(0) // Current state, using numbers defined in header comment + var token U8 + + for *(*int8)(unsafe.Pointer(zSql)) != 0 { + switch int32(*(*int8)(unsafe.Pointer(zSql))) { + case ';': + { // A semicolon + token = U8(TkSEMI) + break + + } + case ' ': + fallthrough + case '\r': + fallthrough + case '\t': + fallthrough + case '\n': + fallthrough + case '\f': + { // White space is ignored + token = U8(TkWS) + break + + } + case '/': + { // C-style comments + if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != '*' { + token = U8(TkOTHER) + break + } + zSql += uintptr(2) + for (*(*int8)(unsafe.Pointer(zSql)) != 0) && ((int32(*(*int8)(unsafe.Pointer(zSql))) != '*') || (int32(*(*int8)(unsafe.Pointer(zSql + 1))) != '/')) { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return 0 + } + zSql++ + token = U8(TkWS) + break + + } + case '-': + { // SQL-style comments from "--" to end of line + if int32(*(*int8)(unsafe.Pointer(zSql + 1))) != '-' { + token = U8(TkOTHER) + break + } + for (*(*int8)(unsafe.Pointer(zSql)) != 0) && (int32(*(*int8)(unsafe.Pointer(zSql))) != '\n') { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return (libc.Bool32(int32(state) == 1)) + } + token = U8(TkWS) + break + + } + case '[': + { // Microsoft-style identifiers in [...] + zSql++ + for (*(*int8)(unsafe.Pointer(zSql)) != 0) && (int32(*(*int8)(unsafe.Pointer(zSql))) != ']') { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return 0 + } + token = U8(TkOTHER) + break + + } + case '`': + fallthrough // Grave-accent quoted symbols used by MySQL + case '"': + fallthrough // single- and double-quoted strings + case '\'': + { + var c int32 = int32(*(*int8)(unsafe.Pointer(zSql))) + zSql++ + for (*(*int8)(unsafe.Pointer(zSql)) != 0) && (int32(*(*int8)(unsafe.Pointer(zSql))) != c) { + zSql++ + } + if int32(*(*int8)(unsafe.Pointer(zSql))) == 0 { + return 0 + } + token = U8(TkOTHER) + break + + } + default: + { + if (int32(Xsqlite3CtypeMap[U8(*(*int8)(unsafe.Pointer(zSql)))]) & 0x46) != 0 { + // Keywords and unquoted identifiers + var nId int32 + for nId = 1; (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zSql + uintptr(nId))))]) & 0x46) != 0; nId++ { + } + switch int32(*(*int8)(unsafe.Pointer(zSql))) { + case 'c': + fallthrough + case 'C': + { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21619 /* "create" */, 6) == 0) { + token = U8(TkCREATE) + } else { + token = U8(TkOTHER) + } + break + + } + fallthrough + case 't': + fallthrough + case 'T': + { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18332 /* "trigger" */, 7) == 0) { + token = U8(TkTRIGGER) + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21626 /* "temp" */, 4) == 0) { + token = U8(TkTEMP) + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21631 /* "temporary" */, 9) == 0) { + token = U8(TkTEMP) + } else { + token = U8(TkOTHER) + } + break + + } + fallthrough + case 'e': + fallthrough + case 'E': + { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21641 /* "end" */, 3) == 0) { + token = U8(TkEND) + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21645 /* "explain" */, 7) == 0) { + token = U8(TkEXPLAIN) + } else { + token = U8(TkOTHER) + } + break + + } + fallthrough + default: + { + token = U8(TkOTHER) + break + + } + } + zSql += (uintptr(nId - 1)) + } else { + // Operators and special symbols + token = U8(TkOTHER) + } + break + + } + } + state = *(*U8)(unsafe.Pointer((uintptr(unsafe.Pointer(&trans)) + uintptr(state)*8) + uintptr(token))) + zSql++ + } + return (libc.Bool32(int32(state) == 1)) +} + +var trans = [8][8]U8{ + // Token: + // State: ** SEMI WS OTHER EXPLAIN CREATE TEMP TRIGGER END + /* 0 INVALID: */ {U8(1), U8(0), U8(2), U8(3), U8(4), U8(2), U8(2), U8(2)}, + /* 1 START: */ {U8(1), U8(1), U8(2), U8(3), U8(4), U8(2), U8(2), U8(2)}, + /* 2 NORMAL: */ {U8(1), U8(2), U8(2), U8(2), U8(2), U8(2), U8(2), U8(2)}, + /* 3 EXPLAIN: */ {U8(1), U8(3), U8(3), U8(2), U8(4), U8(2), U8(2), U8(2)}, + /* 4 CREATE: */ {U8(1), U8(4), U8(2), U8(2), U8(2), U8(4), U8(5), U8(2)}, + /* 5 TRIGGER: */ {U8(6), U8(5), U8(5), U8(5), U8(5), U8(5), U8(5), U8(5)}, + /* 6 SEMI: */ {U8(6), U8(6), U8(5), U8(5), U8(5), U8(5), U8(5), U8(7)}, + /* 7 END: */ {U8(1), U8(7), U8(5), U8(5), U8(5), U8(5), U8(5), U8(5)}, +} /* sqlite3.c:164804:19 */ + +// This routine is the same as the sqlite3_complete() routine described +// above, except that the parameter is required to be UTF-16 encoded, not +// UTF-8. +func Xsqlite3_complete16(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164961:16: */ + var pVal uintptr + var zSql8 uintptr + var rc int32 + + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + pVal = Xsqlite3ValueNew(tls, uintptr(0)) + Xsqlite3ValueSetStr(tls, pVal, -1, zSql, uint8(SQLITE_UTF16LE), uintptr(0)) + zSql8 = Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8)) + if zSql8 != 0 { + rc = Xsqlite3_complete(tls, zSql8) + } else { + rc = SQLITE_NOMEM + } + Xsqlite3ValueFree(tls, pVal) + return (rc & 0xff) +} + +//************* End of rtree.h ********************************************** +//************* Continuing where we left off in main.c ********************** + +// This is an extension initializer that is a no-op and always +// succeeds, except that it fails if the fault-simulation is set +// to 500. +func sqlite3TestExtInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:165113:12: */ + _ = db + return Xsqlite3FaultSim(tls, 500) +} + +// An array of pointers to extension initializer functions for +// built-in extensions. +var sqlite3BuiltinExtensions = [4]uintptr{ + 0, + 0, + 0, + 0, +} /* sqlite3.c:165143:12 */ + +// IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns +// a pointer to the to the sqlite3_version[] string constant. +func Xsqlite3_libversion(tls *libc.TLS) uintptr { /* sqlite3.c:165190:23: */ + return uintptr(unsafe.Pointer(&Xsqlite3_version)) +} + +// IMPLEMENTATION-OF: R-25063-23286 The sqlite3_sourceid() function returns a +// pointer to a string constant whose value is the same as the +// SQLITE_SOURCE_ID C preprocessor macro. Except if SQLite is built using +// an edited copy of the amalgamation, then the last four characters of +// the hash might be different from SQLITE_SOURCE_ID. +// SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } + +// IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function +// returns an integer equal to SQLITE_VERSION_NUMBER. +func Xsqlite3_libversion_number(tls *libc.TLS) int32 { /* sqlite3.c:165203:16: */ + return SQLITE_VERSION_NUMBER +} + +// IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns +// zero if and only if SQLite was compiled with mutexing code omitted due to +// the SQLITE_THREADSAFE compile-time option being set to 0. +func Xsqlite3_threadsafe(tls *libc.TLS) int32 { /* sqlite3.c:165209:16: */ + return SQLITE_THREADSAFE +} + +// When compiling the test fixture or with debugging enabled (on Win32), +// this variable being set to non-zero will cause OSTRACE macros to emit +// extra diagnostic information. + +// If the following global variable points to a string which is the +// name of a directory, then that directory will be used to store +// temporary files. +// +// See also the "PRAGMA temp_store_directory" SQL command. +var Xsqlite3_temp_directory uintptr = uintptr(0) /* sqlite3.c:165240:17 */ + +// If the following global variable points to a string which is the +// name of a directory, then that directory will be used to store +// all database files specified with a relative pathname. +// +// See also the "PRAGMA data_store_directory" SQL command. +var Xsqlite3_data_directory uintptr = uintptr(0) /* sqlite3.c:165249:17 */ + +// Initialize SQLite. +// +// This routine must be called to initialize the memory allocation, +// VFS, and mutex subsystems prior to doing any serious work with +// SQLite. But as long as you do not compile with SQLITE_OMIT_AUTOINIT +// this routine will be called automatically by key routines such as +// sqlite3_open(). +// +// This routine is a no-op except on its very first call for the process, +// or for the first call after a call to sqlite3_shutdown. +// +// The first thread to call this routine runs the initialization to +// completion. If subsequent threads call this routine before the first +// thread has finished the initialization process, then the subsequent +// threads must block until the first thread finishes with the initialization. +// +// The first thread might call this routine recursively. Recursive +// calls to this routine should not block, of course. Otherwise the +// initialization process would never complete. +// +// Let X be the first thread to enter this routine. Let Y be some other +// thread. Then while the initial invocation of this routine by X is +// incomplete, it is required that: +// +// * Calls to this routine from Y must block until the outer-most +// call by X completes. +// +// * Recursive calls to this routine from thread X return immediately +// without blocking. +func Xsqlite3_initialize(tls *libc.TLS) int32 { /* sqlite3.c:165282:16: */ + var pMainMtx uintptr // The main static mutex + var rc int32 // Result code + + // If the following assert() fails on some obscure processor/compiler + // combination, the work-around is to set the correct pointer + // size at compile-time using -DSQLITE_PTRSIZE=n compile-time option + + // If SQLite is already completely initialized, then this call + // to sqlite3_initialize() should be a no-op. But the initialization + // must be complete. So isInit must not be set until the very end + // of this routine. + if Xsqlite3Config.FisInit != 0 { + + return SQLITE_OK + } + + // Make sure the mutex subsystem is initialized. If unable to + // initialize the mutex subsystem, return early with the error. + // If the system is so sick that we are unable to allocate a mutex, + // there is not much SQLite is going to be able to do. + // + // The mutex subsystem must take care of serializing its own + // initialization. + rc = Xsqlite3MutexInit(tls) + if rc != 0 { + return rc + } + + // Initialize the malloc() system and the recursive pInitMutex mutex. + // This operation is protected by the STATIC_MAIN mutex. Note that + // MutexAlloc() is called for a static mutex prior to initializing the + // malloc subsystem - this implies that the allocation of a static + // mutex must not require support from the malloc subsystem. + pMainMtx = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) + Xsqlite3_mutex_enter(tls, pMainMtx) + Xsqlite3Config.FisMutexInit = 1 + if !(Xsqlite3Config.FisMallocInit != 0) { + rc = Xsqlite3MallocInit(tls) + } + if rc == SQLITE_OK { + Xsqlite3Config.FisMallocInit = 1 + if !(int32(Xsqlite3Config.FpInitMutex) != 0) { + Xsqlite3Config.FpInitMutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_RECURSIVE) + if (Xsqlite3Config.FbCoreMutex != 0) && !(int32(Xsqlite3Config.FpInitMutex) != 0) { + rc = SQLITE_NOMEM + } + } + } + if rc == SQLITE_OK { + Xsqlite3Config.FnRefInitMutex++ + } + Xsqlite3_mutex_leave(tls, pMainMtx) + + // If rc is not SQLITE_OK at this point, then either the malloc + // subsystem could not be initialized or the system failed to allocate + // the pInitMutex mutex. Return an error in either case. + if rc != SQLITE_OK { + return rc + } + + // Do the rest of the initialization under the recursive mutex so + // that we will be able to handle recursive calls into + // sqlite3_initialize(). The recursive calls normally come through + // sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other + // recursive calls might also be possible. + // + // IMPLEMENTATION-OF: R-00140-37445 SQLite automatically serializes calls + // to the xInit method, so the xInit method need not be threadsafe. + // + // The following mutex is what serializes access to the appdef pcache xInit + // methods. The sqlite3_pcache_methods.xInit() all is embedded in the + // call to sqlite3PcacheInitialize(). + Xsqlite3_mutex_enter(tls, Xsqlite3Config.FpInitMutex) + if (Xsqlite3Config.FisInit == 0) && (Xsqlite3Config.FinProgress == 0) { + Xsqlite3Config.FinProgress = 1 + libc.Xmemset(tls, uintptr(unsafe.Pointer(&Xsqlite3BuiltinFunctions)), 0, uint64(unsafe.Sizeof(Xsqlite3BuiltinFunctions))) + Xsqlite3RegisterBuiltinFunctions(tls) + if Xsqlite3Config.FisPCacheInit == 0 { + rc = Xsqlite3PcacheInitialize(tls) + } + if rc == SQLITE_OK { + Xsqlite3Config.FisPCacheInit = 1 + rc = Xsqlite3OsInit(tls) + } + if rc == SQLITE_OK { + rc = Xsqlite3MemdbInit(tls) + } + if rc == SQLITE_OK { + Xsqlite3PCacheBufferSetup(tls, Xsqlite3Config.FpPage, + Xsqlite3Config.FszPage, Xsqlite3Config.FnPage) + + Xsqlite3Config.FisInit = 1 + } + Xsqlite3Config.FinProgress = 0 + } + Xsqlite3_mutex_leave(tls, Xsqlite3Config.FpInitMutex) + + // Go back under the static mutex and clean up the recursive + // mutex to prevent a resource leak. + Xsqlite3_mutex_enter(tls, pMainMtx) + Xsqlite3Config.FnRefInitMutex-- + if Xsqlite3Config.FnRefInitMutex <= 0 { + + Xsqlite3_mutex_free(tls, Xsqlite3Config.FpInitMutex) + Xsqlite3Config.FpInitMutex = uintptr(0) + } + Xsqlite3_mutex_leave(tls, pMainMtx) + + // The following is just a sanity check to make sure SQLite has + // been compiled correctly. It is important to run this code, but + // we don't want to run it too often and soak up CPU cycles for no + // reason. So we run it once during initialization. + + // Do extra initialization steps requested by the SQLITE_EXTRA_INIT + // compile-time option. + + return rc +} + +// Undo the effects of sqlite3_initialize(). Must not be called while +// there are outstanding database connections or memory allocations or +// while any part of SQLite is otherwise in use in any thread. This +// routine is not threadsafe. But it is safe to invoke this routine +// on when SQLite is already shut down. If SQLite is already shut down +// when this routine is invoked, then this routine is a harmless no-op. +func Xsqlite3_shutdown(tls *libc.TLS) int32 { /* sqlite3.c:165457:16: */ + + if Xsqlite3Config.FisInit != 0 { + Xsqlite3_os_end(tls) + Xsqlite3_reset_auto_extension(tls) + Xsqlite3Config.FisInit = 0 + } + if Xsqlite3Config.FisPCacheInit != 0 { + Xsqlite3PcacheShutdown(tls) + Xsqlite3Config.FisPCacheInit = 0 + } + if Xsqlite3Config.FisMallocInit != 0 { + Xsqlite3MallocEnd(tls) + Xsqlite3Config.FisMallocInit = 0 + + // The heap subsystem has now been shutdown and these values are supposed + // to be NULL or point to memory that was obtained from sqlite3_malloc(), + // which would rely on that heap subsystem; therefore, make sure these + // values cannot refer to heap memory that was just invalidated when the + // heap subsystem was shutdown. This is only done if the current call to + // this function resulted in the heap subsystem actually being shutdown. + Xsqlite3_data_directory = uintptr(0) + Xsqlite3_temp_directory = uintptr(0) + } + if Xsqlite3Config.FisMutexInit != 0 { + Xsqlite3MutexEnd(tls) + Xsqlite3Config.FisMutexInit = 0 + } + + return SQLITE_OK +} + +// This API allows applications to modify the global configuration of +// the SQLite library at run-time. +// +// This routine should only be called when there are no outstanding +// database connections or memory allocations. This routine is not +// threadsafe. Failure to heed these warnings can lead to unpredictable +// behavior. +func Xsqlite3_config(tls *libc.TLS, op int32, va uintptr) int32 { /* sqlite3.c:165511:16: */ + var ap Va_list + _ = ap + var rc int32 = SQLITE_OK + + // sqlite3_config() shall return SQLITE_MISUSE if it is invoked while + // the SQLite library is in use. + if Xsqlite3Config.FisInit != 0 { + return Xsqlite3MisuseError(tls, 165517) + } + + ap = va + switch op { + + // Mutex configuration options are only available in a threadsafe + // compile. + case SQLITE_CONFIG_SINGLETHREAD: + { + // EVIDENCE-OF: R-02748-19096 This option sets the threading mode to + // Single-thread. + Xsqlite3Config.FbCoreMutex = U8(0) // Disable mutex on core + Xsqlite3Config.FbFullMutex = U8(0) // Disable mutex on connections + break + + } + case SQLITE_CONFIG_MULTITHREAD: + { + // EVIDENCE-OF: R-14374-42468 This option sets the threading mode to + // Multi-thread. + Xsqlite3Config.FbCoreMutex = U8(1) // Enable mutex on core + Xsqlite3Config.FbFullMutex = U8(0) // Disable mutex on connections + break + + } + case SQLITE_CONFIG_SERIALIZED: + { + // EVIDENCE-OF: R-41220-51800 This option sets the threading mode to + // Serialized. + Xsqlite3Config.FbCoreMutex = U8(1) // Enable mutex on core + Xsqlite3Config.FbFullMutex = U8(1) // Enable mutex on connections + break + + } + case SQLITE_CONFIG_MUTEX: + { + // Specify an alternative mutex implementation + Xsqlite3Config.Fmutex = *(*Sqlite3_mutex_methods)(unsafe.Pointer(libc.VaUintptr(&ap))) + break + + } + case SQLITE_CONFIG_GETMUTEX: + { + // Retrieve the current mutex implementation + *(*Sqlite3_mutex_methods)(unsafe.Pointer(libc.VaUintptr(&ap))) = Xsqlite3Config.Fmutex + break + + } + + case SQLITE_CONFIG_MALLOC: + { + // EVIDENCE-OF: R-55594-21030 The SQLITE_CONFIG_MALLOC option takes a + // single argument which is a pointer to an instance of the + // sqlite3_mem_methods structure. The argument specifies alternative + // low-level memory allocation routines to be used in place of the memory + // allocation routines built into SQLite. + Xsqlite3Config.Fm = *(*Sqlite3_mem_methods)(unsafe.Pointer(libc.VaUintptr(&ap))) + break + + } + case SQLITE_CONFIG_GETMALLOC: + { + // EVIDENCE-OF: R-51213-46414 The SQLITE_CONFIG_GETMALLOC option takes a + // single argument which is a pointer to an instance of the + // sqlite3_mem_methods structure. The sqlite3_mem_methods structure is + // filled with the currently defined memory allocation routines. + if Xsqlite3Config.Fm.FxMalloc == uintptr(0) { + Xsqlite3MemSetDefault(tls) + } + *(*Sqlite3_mem_methods)(unsafe.Pointer(libc.VaUintptr(&ap))) = Xsqlite3Config.Fm + break + + } + case SQLITE_CONFIG_MEMSTATUS: + { + // EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes + // single argument of type int, interpreted as a boolean, which enables + // or disables the collection of memory allocation statistics. + Xsqlite3Config.FbMemstat = int32(libc.VaInt32(&ap)) + break + + } + case SQLITE_CONFIG_SMALL_MALLOC: + { + Xsqlite3Config.FbSmallMalloc = U8(libc.VaInt32(&ap)) + break + + } + case SQLITE_CONFIG_PAGECACHE: + { + // EVIDENCE-OF: R-18761-36601 There are three arguments to + // SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory (pMem), + // the size of each page cache line (sz), and the number of cache lines + // (N). + Xsqlite3Config.FpPage = libc.VaUintptr(&ap) + Xsqlite3Config.FszPage = int32(libc.VaInt32(&ap)) + Xsqlite3Config.FnPage = int32(libc.VaInt32(&ap)) + break + + } + case SQLITE_CONFIG_PCACHE_HDRSZ: + { + // EVIDENCE-OF: R-39100-27317 The SQLITE_CONFIG_PCACHE_HDRSZ option takes + // a single parameter which is a pointer to an integer and writes into + // that integer the number of extra bytes per page required for each page + // in SQLITE_CONFIG_PAGECACHE. + *(*int32)(unsafe.Pointer(libc.VaUintptr(&ap))) = ((Xsqlite3HeaderSizeBtree(tls) + Xsqlite3HeaderSizePcache(tls)) + Xsqlite3HeaderSizePcache1(tls)) + break + + } + + case SQLITE_CONFIG_PCACHE: + { + // no-op + break + + } + case SQLITE_CONFIG_GETPCACHE: + { + // now an error + rc = SQLITE_ERROR + break + + } + + case SQLITE_CONFIG_PCACHE2: + { + // EVIDENCE-OF: R-63325-48378 The SQLITE_CONFIG_PCACHE2 option takes a + // single argument which is a pointer to an sqlite3_pcache_methods2 + // object. This object specifies the interface to a custom page cache + // implementation. + Xsqlite3Config.Fpcache2 = *(*Sqlite3_pcache_methods2)(unsafe.Pointer(libc.VaUintptr(&ap))) + break + + } + case SQLITE_CONFIG_GETPCACHE2: + { + // EVIDENCE-OF: R-22035-46182 The SQLITE_CONFIG_GETPCACHE2 option takes a + // single argument which is a pointer to an sqlite3_pcache_methods2 + // object. SQLite copies of the current page cache implementation into + // that object. + if Xsqlite3Config.Fpcache2.FxInit == uintptr(0) { + Xsqlite3PCacheSetDefault(tls) + } + *(*Sqlite3_pcache_methods2)(unsafe.Pointer(libc.VaUintptr(&ap))) = Xsqlite3Config.Fpcache2 + break + + } + + // EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only + // available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or + // SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. + + case SQLITE_CONFIG_LOOKASIDE: + { + Xsqlite3Config.FszLookaside = int32(libc.VaInt32(&ap)) + Xsqlite3Config.FnLookaside = int32(libc.VaInt32(&ap)) + break + + } + + // Record a pointer to the logger function and its first argument. + // The default is NULL. Logging is disabled if the function pointer is + // NULL. + case SQLITE_CONFIG_LOG: + { + Xsqlite3Config.FxLog = libc.VaUintptr(&ap) + Xsqlite3Config.FpLogArg = libc.VaUintptr(&ap) + break + + } + + // EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames + // can be changed at start-time using the + // sqlite3_config(SQLITE_CONFIG_URI,1) or + // sqlite3_config(SQLITE_CONFIG_URI,0) configuration calls. + case SQLITE_CONFIG_URI: + { + // EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single + // argument of type int. If non-zero, then URI handling is globally + // enabled. If the parameter is zero, then URI handling is globally + // disabled. + Xsqlite3Config.FbOpenUri = U8(libc.VaInt32(&ap)) + break + + } + + case SQLITE_CONFIG_COVERING_INDEX_SCAN: + { + // EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN + // option takes a single integer argument which is interpreted as a + // boolean in order to enable or disable the use of covering indices for + // full table scans in the query optimizer. + Xsqlite3Config.FbUseCis = U8(libc.VaInt32(&ap)) + break + + } + + case SQLITE_CONFIG_MMAP_SIZE: + { + // EVIDENCE-OF: R-58063-38258 SQLITE_CONFIG_MMAP_SIZE takes two 64-bit + // integer (sqlite3_int64) values that are the default mmap size limit + // (the default setting for PRAGMA mmap_size) and the maximum allowed + // mmap size limit. + var szMmap Sqlite3_int64 = Sqlite3_int64(libc.VaInt64(&ap)) + var mxMmap Sqlite3_int64 = Sqlite3_int64(libc.VaInt64(&ap)) + // EVIDENCE-OF: R-53367-43190 If either argument to this option is + // negative, then that argument is changed to its compile-time default. + // + // EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be + // silently truncated if necessary so that it does not exceed the + // compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE + // compile-time option. + if (mxMmap < int64(0)) || (mxMmap > int64(SQLITE_MAX_MMAP_SIZE)) { + mxMmap = int64(SQLITE_MAX_MMAP_SIZE) + } + if szMmap < int64(0) { + szMmap = int64(SQLITE_DEFAULT_MMAP_SIZE) + } + if szMmap > mxMmap { + szMmap = mxMmap + } + Xsqlite3Config.FmxMmap = mxMmap + Xsqlite3Config.FszMmap = szMmap + break + + } + + case SQLITE_CONFIG_PMASZ: + { + Xsqlite3Config.FszPma = U32(libc.VaUint32(&ap)) + break + + } + + case SQLITE_CONFIG_STMTJRNL_SPILL: + { + Xsqlite3Config.FnStmtSpill = int32(libc.VaInt32(&ap)) + break + + } + + case SQLITE_CONFIG_MEMDB_MAXSIZE: + { + Xsqlite3Config.FmxMemdbSize = Sqlite3_int64(libc.VaInt64(&ap)) + break + + } + + default: + { + rc = SQLITE_ERROR + break + + } + } + _ = ap + return rc +} + +// Set up the lookaside buffers for a database connection. +// Return SQLITE_OK on success. +// If lookaside is already active, return SQLITE_BUSY. +// +// The sz parameter is the number of bytes in each lookaside slot. +// The cnt parameter is the number of slots. If pStart is NULL the +// space for the lookaside memory is obtained from sqlite3_malloc(). +// If pStart is not NULL then it is sz*cnt bytes of memory to use for +// the lookaside memory. +func setupLookaside(tls *libc.TLS, db uintptr, pBuf uintptr, sz int32, cnt int32) int32 { /* sqlite3.c:165829:12: */ + var pStart uintptr + var szAlloc Sqlite3_int64 = (Sqlite3_int64(sz) * Sqlite3_int64(cnt)) + var nBig int32 // Number of full-size slots + var nSm int32 // Number smaller LOOKASIDE_SMALL-byte slots + + if Xsqlite3LookasideUsed(tls, db, uintptr(0)) > 0 { + return SQLITE_BUSY + } + // Free any existing lookaside buffer for this handle before + // allocating a new one so we don't have to have space for + // both at the same time. + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced != 0 { + Xsqlite3_free(tls, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) + } + // The size of a lookaside slot after ROUNDDOWN8 needs to be larger + // than a pointer to be useful. + sz = ((sz) & libc.CplInt32(7)) // IMP: R-33038-09382 + if sz <= int32(unsafe.Sizeof(uintptr(0))) { + sz = 0 + } + if cnt < 0 { + cnt = 0 + } + if (sz == 0) || (cnt == 0) { + sz = 0 + pStart = uintptr(0) + } else if pBuf == uintptr(0) { + Xsqlite3BeginBenignMalloc(tls) + pStart = Xsqlite3Malloc(tls, uint64(szAlloc)) // IMP: R-61949-35727 + Xsqlite3EndBenignMalloc(tls) + if pStart != 0 { + szAlloc = Sqlite3_int64(Xsqlite3MallocSize(tls, pStart)) + } + } else { + pStart = pBuf + } + if sz >= (LOOKASIDE_SMALL * 3) { + nBig = (int32(szAlloc / (Sqlite3_int64((3 * LOOKASIDE_SMALL) + sz)))) + nSm = (int32((szAlloc - (Sqlite3_int64(sz * nBig))) / int64(LOOKASIDE_SMALL))) + } else if sz >= (LOOKASIDE_SMALL * 2) { + nBig = (int32(szAlloc / (Sqlite3_int64(LOOKASIDE_SMALL + sz)))) + nSm = (int32((szAlloc - (Sqlite3_int64(sz * nBig))) / int64(LOOKASIDE_SMALL))) + } else if sz > 0 { + nBig = (int32(szAlloc / Sqlite3_int64(sz))) + nSm = 0 + } else { + nBig = libc.AssignInt32(&nSm, 0) + } + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart = pStart + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpFree = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(sz) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FszTrue = U16(sz) + if pStart != 0 { + var i int32 + var p uintptr + + p = pStart + for i = 0; i < nBig; i++ { + (*LookasideSlot)(unsafe.Pointer(p)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpInit = p + p = ((p) + uintptr(sz)) + } + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle = p + for i = 0; i < nSm; i++ { + (*LookasideSlot)(unsafe.Pointer(p)).FpNext = (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = p + p = ((p) + 128) + } + + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = p + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = U32(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced = func() uint8 { + if pBuf == uintptr(0) { + return uint8(1) + } + return uint8(0) + }() + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot = (U32(nBig + nSm)) + } else { + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart = db + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallInit = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpSmallFree = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpMiddle = db + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpEnd = db + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = U32(1) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced = U8(0) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FnSlot = U32(0) + } + + return SQLITE_OK +} + +// Return the mutex associated with a database connection. +func Xsqlite3_db_mutex(tls *libc.TLS, db uintptr) uintptr { /* sqlite3.c:165929:26: */ + return (*Sqlite3)(unsafe.Pointer(db)).Fmutex +} + +// Free up as much memory as we can from the given database +// connection. +func Xsqlite3_db_release_memory(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:165943:16: */ + var i int32 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3BtreeEnterAll(tls, db) + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if pBt != 0 { + var pPager uintptr = Xsqlite3BtreePager(tls, pBt) + Xsqlite3PagerShrink(tls, pPager) + } + } + Xsqlite3BtreeLeaveAll(tls, db) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// Flush any dirty pages in the pager-cache for any attached database +// to disk. +func Xsqlite3_db_cacheflush(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:165967:16: */ + var i int32 + var rc int32 = SQLITE_OK + var bSeenBusy int32 = 0 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3BtreeEnterAll(tls, db) + for i = 0; (rc == SQLITE_OK) && (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb); i++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if (pBt != 0) && (Xsqlite3BtreeTxnState(tls, pBt) == SQLITE_TXN_WRITE) { + var pPager uintptr = Xsqlite3BtreePager(tls, pBt) + rc = Xsqlite3PagerFlush(tls, pPager) + if rc == SQLITE_BUSY { + bSeenBusy = 1 + rc = SQLITE_OK + } + } + } + Xsqlite3BtreeLeaveAll(tls, db) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return func() int32 { + if (rc == SQLITE_OK) && (bSeenBusy != 0) { + return SQLITE_BUSY + } + return rc + }() +} + +// Configuration settings for an individual database connection +func Xsqlite3_db_config(tls *libc.TLS, db uintptr, op int32, va uintptr) int32 { /* sqlite3.c:165996:16: */ + var ap Va_list + _ = ap + var rc int32 + ap = va + switch op { + case SQLITE_DBCONFIG_MAINDBNAME: + { + // IMP: R-06824-28531 + // IMP: R-36257-52125 + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = libc.VaUintptr(&ap) + rc = SQLITE_OK + break + + } + case SQLITE_DBCONFIG_LOOKASIDE: + { + var pBuf uintptr = libc.VaUintptr(&ap) // IMP: R-26835-10964 + var sz int32 = int32(libc.VaInt32(&ap)) // IMP: R-47871-25994 + var cnt int32 = int32(libc.VaInt32(&ap)) // IMP: R-04460-53386 + rc = setupLookaside(tls, db, pBuf, sz, cnt) + break + + } + default: + { + var i uint32 + rc = SQLITE_ERROR // IMP: R-42790-23372 + for i = uint32(0); i < (uint32((int32(uint64(unsafe.Sizeof(aFlagOp)) / uint64(unsafe.Sizeof(struct { + Fop int32 + Fmask U32 + }{})))))); i++ { + if aFlagOp[i].Fop == op { + var onoff int32 = int32(libc.VaInt32(&ap)) + var pRes uintptr = libc.VaUintptr(&ap) + var oldFlags U64 = (*Sqlite3)(unsafe.Pointer(db)).Fflags + if onoff > 0 { + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (U64(aFlagOp[i].Fmask)) + } else if onoff == 0 { + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (^U64(aFlagOp[i].Fmask)) + } + if oldFlags != (*Sqlite3)(unsafe.Pointer(db)).Fflags { + Xsqlite3ExpirePreparedStatements(tls, db, 0) + } + if pRes != 0 { + *(*int32)(unsafe.Pointer(pRes)) = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & U64(aFlagOp[i].Fmask)) != uint64(0))) + } + rc = SQLITE_OK + break + } + } + break + + } + } + _ = ap + return rc +} + +var aFlagOp = [16]struct { + Fop int32 + Fmask U32 +}{ + {Fop: SQLITE_DBCONFIG_ENABLE_FKEY, Fmask: U32(SQLITE_ForeignKeys)}, + {Fop: SQLITE_DBCONFIG_ENABLE_TRIGGER, Fmask: U32(SQLITE_EnableTrigger)}, + {Fop: SQLITE_DBCONFIG_ENABLE_VIEW, Fmask: SQLITE_EnableView}, + {Fop: SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, Fmask: U32(SQLITE_Fts3Tokenizer)}, + {Fop: SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, Fmask: U32(SQLITE_LoadExtension)}, + {Fop: SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, Fmask: U32(SQLITE_NoCkptOnClose)}, + {Fop: SQLITE_DBCONFIG_ENABLE_QPSG, Fmask: U32(SQLITE_EnableQPSG)}, + {Fop: SQLITE_DBCONFIG_TRIGGER_EQP, Fmask: U32(SQLITE_TriggerEQP)}, + {Fop: SQLITE_DBCONFIG_RESET_DATABASE, Fmask: U32(SQLITE_ResetDatabase)}, + {Fop: SQLITE_DBCONFIG_DEFENSIVE, Fmask: U32(SQLITE_Defensive)}, + {Fop: SQLITE_DBCONFIG_WRITABLE_SCHEMA, Fmask: (U32(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, + {Fop: SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, Fmask: U32(SQLITE_LegacyAlter)}, + {Fop: SQLITE_DBCONFIG_DQS_DDL, Fmask: U32(SQLITE_DqsDDL)}, + {Fop: SQLITE_DBCONFIG_DQS_DML, Fmask: U32(SQLITE_DqsDML)}, + {Fop: SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, Fmask: U32(SQLITE_LegacyFileFmt)}, + {Fop: SQLITE_DBCONFIG_TRUSTED_SCHEMA, Fmask: U32(SQLITE_TrustedSchema)}, +} /* sqlite3.c:166019:9 */ + +// This is the default collating function named "BINARY" which is always +// available. +func binCollFunc(tls *libc.TLS, NotUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* sqlite3.c:166071:12: */ + var rc int32 + var n int32 + _ = NotUsed + if nKey1 < nKey2 { + n = nKey1 + } else { + n = nKey2 + } + // EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares + // strings byte by byte using the memcmp() function from the standard C + // library. + + rc = libc.Xmemcmp(tls, pKey1, pKey2, uint64(n)) + if rc == 0 { + rc = (nKey1 - nKey2) + } + return rc +} + +// This is the collating function named "RTRIM" which is always +// available. Ignore trailing spaces. +func rtrimCollFunc(tls *libc.TLS, pUser uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* sqlite3.c:166094:12: */ + var pK1 uintptr = pKey1 + var pK2 uintptr = pKey2 + for (nKey1 != 0) && (int32(*(*U8)(unsafe.Pointer(pK1 + uintptr((nKey1 - 1))))) == ' ') { + nKey1-- + } + for (nKey2 != 0) && (int32(*(*U8)(unsafe.Pointer(pK2 + uintptr((nKey2 - 1))))) == ' ') { + nKey2-- + } + return binCollFunc(tls, pUser, nKey1, pKey1, nKey2, pKey2) +} + +// Return true if CollSeq is the default built-in BINARY. +func Xsqlite3IsBinary(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:166109:20: */ + + return (libc.Bool32((p == uintptr(0)) || ((*CollSeq)(unsafe.Pointer(p)).FxCmp == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 + }{binCollFunc}))))) +} + +// Another built-in collating sequence: NOCASE. +// +// This collating sequence is intended to be used for "case independent +// comparison". SQLite's knowledge of upper and lower case equivalents +// extends only to the 26 characters used in the English language. +// +// At the moment there is only a UTF-8 implementation. +func nocaseCollatingFunc(tls *libc.TLS, NotUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* sqlite3.c:166123:12: */ + var r int32 = Xsqlite3_strnicmp(tls, + pKey1, pKey2, func() int32 { + if nKey1 < nKey2 { + return nKey1 + } + return nKey2 + }()) + _ = NotUsed + if 0 == r { + r = (nKey1 - nKey2) + } + return r +} + +// Return the ROWID of the most recent insert +func Xsqlite3_last_insert_rowid(tls *libc.TLS, db uintptr) Sqlite_int64 { /* sqlite3.c:166140:25: */ + return (*Sqlite3)(unsafe.Pointer(db)).FlastRowid +} + +// Set the value returned by the sqlite3_last_insert_rowid() API function. +func Xsqlite3_set_last_insert_rowid(tls *libc.TLS, db uintptr, iRowid Sqlite3_int64) { /* sqlite3.c:166153:17: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = iRowid + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) +} + +// Return the number of changes in the most recent call to sqlite3_exec(). +func Xsqlite3_changes(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:166168:16: */ + return (*Sqlite3)(unsafe.Pointer(db)).FnChange +} + +// Return the number of changes since the database handle was opened. +func Xsqlite3_total_changes(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:166181:16: */ + return (*Sqlite3)(unsafe.Pointer(db)).FnTotalChange +} + +// Close all open savepoints. This function only manipulates fields of the +// database handle object, it does not close any savepoints that may be open +// at the b-tree/pager level. +func Xsqlite3CloseSavepoints(tls *libc.TLS, db uintptr) { /* sqlite3.c:166196:21: */ + for (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint != 0 { + var pTmp uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint + (*Sqlite3)(unsafe.Pointer(db)).FpSavepoint = (*Savepoint)(unsafe.Pointer(pTmp)).FpNext + Xsqlite3DbFree(tls, db, pTmp) + } + (*Sqlite3)(unsafe.Pointer(db)).FnSavepoint = 0 + (*Sqlite3)(unsafe.Pointer(db)).FnStatement = 0 + (*Sqlite3)(unsafe.Pointer(db)).FisTransactionSavepoint = U8(0) +} + +// Invoke the destructor function associated with FuncDef p, if any. Except, +// if this is not the last copy of the function, do not invoke it. Multiple +// copies of a single function are created when create_function() is called +// with SQLITE_ANY as the encoding. +func functionDestroy(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:166213:13: */ + var pDestructor uintptr = *(*uintptr)(unsafe.Pointer(p + 64 /* &.u */)) + if pDestructor != 0 { + (*FuncDestructor)(unsafe.Pointer(pDestructor)).FnRef-- + if (*FuncDestructor)(unsafe.Pointer(pDestructor)).FnRef == 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pDestructor + 8 /* &.xDestroy */))))(tls, (*FuncDestructor)(unsafe.Pointer(pDestructor)).FpUserData) + Xsqlite3DbFree(tls, db, pDestructor) + } + } +} + +// Disconnect all sqlite3_vtab objects that belong to database connection +// db. This is called when db is being closed. +func disconnectAllVtab(tls *libc.TLS, db uintptr) { /* sqlite3.c:166228:13: */ + var i int32 + var p uintptr + Xsqlite3BtreeEnterAll(tls, db) + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var pSchema uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpSchema + if pSchema != 0 { + for p = (*Hash)(unsafe.Pointer((pSchema + 8 /* &.tblHash */))).Ffirst; p != 0; p = (*HashElem)(unsafe.Pointer(p)).Fnext { + var pTab uintptr = (*HashElem)(unsafe.Pointer(p)).Fdata + if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { + Xsqlite3VtabDisconnect(tls, db, pTab) + } + } + } + } + for p = (*Hash)(unsafe.Pointer((db + 536 /* &.aModule */))).Ffirst; p != 0; p = (*HashElem)(unsafe.Pointer(p)).Fnext { + var pMod uintptr = (*HashElem)(unsafe.Pointer(p)).Fdata + if (*Module)(unsafe.Pointer(pMod)).FpEpoTab != 0 { + Xsqlite3VtabDisconnect(tls, db, (*Module)(unsafe.Pointer(pMod)).FpEpoTab) + } + } + Xsqlite3VtabUnlockList(tls, db) + Xsqlite3BtreeLeaveAll(tls, db) +} + +// Return TRUE if database connection db has unfinalized prepared +// statements or unfinished sqlite3_backup objects. +func connectionIsBusy(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:166259:12: */ + var j int32 + + if (*Sqlite3)(unsafe.Pointer(db)).FpVdbe != 0 { + return 1 + } + for j = 0; j < (*Sqlite3)(unsafe.Pointer(db)).FnDb; j++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32)).FpBt + if (pBt != 0) && (Xsqlite3BtreeIsInBackup(tls, pBt) != 0) { + return 1 + } + } + return 0 +} + +// Close an existing SQLite database +func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlite3.c:166273:12: */ + if !(db != 0) { + // EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or + // sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. + return SQLITE_OK + } + if !(Xsqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return Xsqlite3MisuseError(tls, 166280) + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if (int32((*Sqlite3)(unsafe.Pointer(db)).FmTrace) & SQLITE_TRACE_CLOSE) != 0 { + (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_CLOSE), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, db, uintptr(0)) + } + + // Force xDisconnect calls on all virtual tables + disconnectAllVtab(tls, db) + + // If a transaction is open, the disconnectAllVtab() call above + // will not have called the xDisconnect() method on any virtual + // tables in the db->aVTrans[] array. The following sqlite3VtabRollback() + // call will do so. We need to do this before the check for active + // SQL statements below, as the v-table implementation may be storing + // some prepared statements internally. + Xsqlite3VtabRollback(tls, db) + + // Legacy behavior (sqlite3_close() behavior) is to return + // SQLITE_BUSY if the connection can not be closed immediately. + if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { + Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, + ts+21653 /* "unable to close ..." */, 0) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_BUSY + } + + // Convert the connection into a zombie and then close it. + (*Sqlite3)(unsafe.Pointer(db)).Fmagic = U32(SQLITE_MAGIC_ZOMBIE) + Xsqlite3LeaveMutexAndCloseZombie(tls, db) + return SQLITE_OK +} + +// Return the transaction state for a single databse, or the maximum +// transaction state over all attached databases if zSchema is null. +func Xsqlite3_txn_state(tls *libc.TLS, db uintptr, zSchema uintptr) int32 { /* sqlite3.c:166327:16: */ + var iDb int32 + var nDb int32 + var iTxn int32 = -1 + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if zSchema != 0 { + nDb = libc.AssignInt32(&iDb, Xsqlite3FindDbName(tls, db, zSchema)) + if iDb < 0 { + nDb-- + } + } else { + iDb = 0 + nDb = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) + } + for ; iDb <= nDb; iDb++ { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + var x int32 + if pBt != uintptr(0) { + x = Xsqlite3BtreeTxnState(tls, pBt) + } else { + x = SQLITE_TXN_NONE + } + if x > iTxn { + iTxn = x + } + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return iTxn +} + +// Two variations on the public interface for closing a database +// connection. The sqlite3_close() version returns SQLITE_BUSY and +// leaves the connection open if there are unfinalized prepared +// statements or unfinished sqlite3_backups. The sqlite3_close_v2() +// version forces the connection to become a zombie if there are +// unclosed resources, and arranges for deallocation when the last +// prepare statement or sqlite3_backup closes. +func Xsqlite3_close(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:166362:16: */ + return sqlite3Close(tls, db, 0) +} + +func Xsqlite3_close_v2(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:166363:16: */ + return sqlite3Close(tls, db, 1) +} + +// Close the mutex on database connection db. +// +// Furthermore, if database connection db is a zombie (meaning that there +// has been a prior call to sqlite3_close(db) or sqlite3_close_v2(db)) and +// every sqlite3_stmt has now been finalized and every sqlite3_backup has +// finished, then free all resources. +func Xsqlite3LeaveMutexAndCloseZombie(tls *libc.TLS, db uintptr) { /* sqlite3.c:166374:21: */ + var i uintptr // Hash table iterator + var j int32 + + // If there are outstanding sqlite3_stmt or sqlite3_backup objects + // or if the connection has not yet been closed by sqlite3_close_v2(), + // then just leave the mutex and return. + if ((*Sqlite3)(unsafe.Pointer(db)).Fmagic != U32(SQLITE_MAGIC_ZOMBIE)) || (connectionIsBusy(tls, db) != 0) { + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return + } + + // If we reach this point, it means that the database connection has + // closed all sqlite3_stmt and sqlite3_backup objects and has been + // passed to sqlite3_close (meaning that it is a zombie). Therefore, + // go ahead and free all resources. + + // If a transaction is open, roll it back. This also ensures that if + // any database schemas have been modified by an uncommitted transaction + // they are reset. And that the required b-tree mutex is held to make + // the pager rollback and schema reset an atomic operation. + Xsqlite3RollbackAll(tls, db, SQLITE_OK) + + // Free any outstanding Savepoint structures. + Xsqlite3CloseSavepoints(tls, db) + + // Close all database connections + for j = 0; j < (*Sqlite3)(unsafe.Pointer(db)).FnDb; j++ { + var pDb uintptr = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(j)*32) + if (*Db1)(unsafe.Pointer(pDb)).FpBt != 0 { + Xsqlite3BtreeClose(tls, (*Db1)(unsafe.Pointer(pDb)).FpBt) + (*Db1)(unsafe.Pointer(pDb)).FpBt = uintptr(0) + if j != 1 { + (*Db1)(unsafe.Pointer(pDb)).FpSchema = uintptr(0) + } + } + } + // Clear the TEMP schema separately and last + if (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema != 0 { + Xsqlite3SchemaClear(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) + } + Xsqlite3VtabUnlockList(tls, db) + + // Free up the array of auxiliary databases + Xsqlite3CollapseDatabaseArray(tls, db) + + // Tell the code in notify.c that the connection no longer holds any + // locks and does not require any further unlock-notify callbacks. + Xsqlite3ConnectionClosed(tls, db) + + for i = (*Hash)(unsafe.Pointer((db + 584 /* &.aFunc */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pNext uintptr + var p uintptr + p = (*HashElem)(unsafe.Pointer(i)).Fdata + for ok := true; ok; ok = p != 0 { + functionDestroy(tls, db, p) + pNext = (*FuncDef)(unsafe.Pointer(p)).FpNext + Xsqlite3DbFree(tls, db, p) + p = pNext + } + } + Xsqlite3HashClear(tls, (db + 584 /* &.aFunc */)) + for i = (*Hash)(unsafe.Pointer((db + 608 /* &.aCollSeq */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pColl uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + // Invoke any destructors registered for collation sequence user data. + for j = 0; j < 3; j++ { + if (*CollSeq)(unsafe.Pointer(pColl+uintptr(j)*40)).FxDel != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pColl + uintptr(j)*40 + 32 /* &.xDel */))))(tls, (*CollSeq)(unsafe.Pointer(pColl+uintptr(j)*40)).FpUser) + } + } + Xsqlite3DbFree(tls, db, pColl) + } + Xsqlite3HashClear(tls, (db + 608 /* &.aCollSeq */)) + for i = (*Hash)(unsafe.Pointer((db + 536 /* &.aModule */))).Ffirst; i != 0; i = (*HashElem)(unsafe.Pointer(i)).Fnext { + var pMod uintptr = (*HashElem)(unsafe.Pointer(i)).Fdata + Xsqlite3VtabEponymousTableClear(tls, db, pMod) + Xsqlite3VtabModuleUnref(tls, db, pMod) + } + Xsqlite3HashClear(tls, (db + 536 /* &.aModule */)) + + Xsqlite3Error(tls, db, SQLITE_OK) // Deallocates any cached error strings. + Xsqlite3ValueFree(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + Xsqlite3CloseExtensions(tls, db) + + (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_ERROR + + // The temp-database schema is allocated differently from the other schema + // objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()). + // So it needs to be freed here. Todo: Why not roll the temp schema into + // the same sqliteMalloc() as the one that allocates the database + // structure? + Xsqlite3DbFree(tls, db, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_CLOSED + Xsqlite3_mutex_free(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbMalloced != 0 { + Xsqlite3_free(tls, (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FpStart) + } + Xsqlite3_free(tls, db) +} + +// Rollback all database files. If tripCode is not SQLITE_OK, then +// any write cursors are invalidated ("tripped" - as in "tripping a circuit +// breaker") and made to return tripCode if there are any further +// attempts to use that cursor. Read cursors remain open and valid +// but are "saved" in case the table pages are moved around. +func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3.c:166494:21: */ + var i int32 + var inTrans int32 = 0 + var schemaChange int32 + + Xsqlite3BeginBenignMalloc(tls) + + // Obtain all b-tree mutexes before making any calls to BtreeRollback(). + // This is important in case the transaction being rolled back has + // modified the database schema. If the b-tree mutexes are not taken + // here, then another shared-cache connection might sneak in between + // the database rollback and schema reset, which can cause false + // corruption reports in some cases. + Xsqlite3BtreeEnterAll(tls, db) + schemaChange = (libc.Bool32((((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_SchemaChange)) != U32(0)) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0))) + + for i = 0; i < (*Sqlite3)(unsafe.Pointer(db)).FnDb; i++ { + var p uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FpBt + if p != 0 { + if Xsqlite3BtreeTxnState(tls, p) == SQLITE_TXN_WRITE { + inTrans = 1 + } + Xsqlite3BtreeRollback(tls, p, tripCode, libc.BoolInt32(!(schemaChange != 0))) + } + } + Xsqlite3VtabRollback(tls, db) + Xsqlite3EndBenignMalloc(tls) + + if schemaChange != 0 { + Xsqlite3ExpirePreparedStatements(tls, db, 0) + Xsqlite3ResetAllSchemasOfConnection(tls, db) + } + Xsqlite3BtreeLeaveAll(tls, db) + + // Any deferred constraint violations have now been resolved. + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredCons = int64(0) + (*Sqlite3)(unsafe.Pointer(db)).FnDeferredImmCons = int64(0) + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_DeferFKs))) + + // If one has been configured, invoke the rollback-hook callback + if ((*Sqlite3)(unsafe.Pointer(db)).FxRollbackCallback != 0) && ((inTrans != 0) || !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((db + 296 /* &.xRollbackCallback */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpRollbackArg) + } +} + +// Return a static string containing the name corresponding to the error code +// specified in the argument. + +// Return a static string that describes the kind of error specified in the +// argument. +func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ + var zErr uintptr = ts + 21721 /* "unknown error" */ + switch rc { + case (SQLITE_ABORT | (int32(2) << 8)): + { + zErr = ts + 21735 /* "abort due to ROL..." */ + break + + } + case SQLITE_ROW: + { + zErr = ts + 21757 /* "another row avai..." */ + break + + } + case SQLITE_DONE: + { + zErr = ts + 21779 /* "no more rows ava..." */ + break + + } + default: + { + rc = rc & (0xff) + if ((rc >= 0) && (rc < (int32(uint64(unsafe.Sizeof(aMsg)) / uint64(unsafe.Sizeof(uintptr(0))))))) && (aMsg[rc] != uintptr(0)) { + zErr = aMsg[rc] + } + break + + } + } + return zErr +} + +var aMsg = [29]uintptr{ + /* SQLITE_OK */ ts + 21802, /* "not an error" */ + /* SQLITE_ERROR */ ts + 21815, /* "SQL logic error" */ + /* SQLITE_INTERNAL */ uintptr(0), + /* SQLITE_PERM */ ts + 21831, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 21856, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 21870, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 21889, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5182, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 21914, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 21951, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 21963, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 21978, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 22011, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22029, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22054, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22083, /* "locking protocol" */ + /* SQLITE_EMPTY */ uintptr(0), + /* SQLITE_SCHEMA */ ts + 4912, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4449, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22100, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22118, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22136, /* "bad parameter or..." */ + /* SQLITE_NOLFS */ uintptr(0), + /* SQLITE_AUTH */ ts + 22170, /* "authorization de..." */ + /* SQLITE_FORMAT */ uintptr(0), + /* SQLITE_RANGE */ ts + 22191, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22217, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22240, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22261, /* "warning message" */ +} /* sqlite3.c:166656:20 */ + +// This routine implements a busy callback that sleeps and tries +// again until a timeout value is reached. The timeout value is +// an integer number of milliseconds passed in as the first +// argument. +// +// Return non-zero to retry the lock. Return zero to stop trying +// and cause SQLite to return SQLITE_BUSY. +func sqliteDefaultBusyCallback(tls *libc.TLS, ptr uintptr, count int32) int32 { /* sqlite3.c:166725:12: */ + var db uintptr = ptr + var tmout int32 = (*Sqlite3)(unsafe.Pointer(db)).FbusyTimeout + var delay int32 + var prior int32 + + if count < (int32(uint64(unsafe.Sizeof(delays)) / uint64(unsafe.Sizeof(U8(0))))) { + delay = int32(delays[count]) + prior = int32(totals[count]) + } else { + delay = int32(delays[((int32(uint64(unsafe.Sizeof(delays)) / uint64(unsafe.Sizeof(U8(0))))) - 1)]) + prior = (int32(totals[((int32(uint64(unsafe.Sizeof(delays))/uint64(unsafe.Sizeof(U8(0)))))-1)]) + (delay * (count - ((int32(uint64(unsafe.Sizeof(delays)) / uint64(unsafe.Sizeof(U8(0))))) - 1)))) + } + if (prior + delay) > tmout { + delay = (tmout - prior) + if delay <= 0 { + return 0 + } + } + Xsqlite3OsSleep(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, (delay * 1000)) + return 1 +} + +var delays = [12]U8{U8(1), U8(2), U8(5), U8(10), U8(15), U8(20), U8(25), U8(25), U8(25), U8(50), U8(50), U8(100)} /* sqlite3.c:166732:19 */ +var totals = [12]U8{U8(0), U8(1), U8(3), U8(8), U8(18), U8(33), U8(53), U8(78), U8(103), U8(128), U8(178), U8(228)} /* sqlite3.c:166734:19 */ + +// Invoke the given busy handler. +// +// This routine is called when an operation failed to acquire a +// lock on VFS file pFile. +// +// If this routine returns non-zero, the lock is retried. If it +// returns 0, the operation aborts with an SQLITE_BUSY error. +func Xsqlite3InvokeBusyHandler(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:166777:20: */ + var rc int32 + if ((*BusyHandler)(unsafe.Pointer(p)).FxBusyHandler == uintptr(0)) || ((*BusyHandler)(unsafe.Pointer(p)).FnBusy < 0) { + return 0 + } + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((p /* &.xBusyHandler */))))(tls, (*BusyHandler)(unsafe.Pointer(p)).FpBusyArg, (*BusyHandler)(unsafe.Pointer(p)).FnBusy) + if rc == 0 { + (*BusyHandler)(unsafe.Pointer(p)).FnBusy = -1 + } else { + (*BusyHandler)(unsafe.Pointer(p)).FnBusy++ + } + return rc +} + +// This routine sets the busy callback for an Sqlite database to the +// given callback function with the given argument. +func Xsqlite3_busy_handler(tls *libc.TLS, db uintptr, xBusy uintptr, pArg uintptr) int32 { /* sqlite3.c:166793:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FxBusyHandler = xBusy + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FpBusyArg = pArg + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + (*Sqlite3)(unsafe.Pointer(db)).FbusyTimeout = 0 + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// This routine sets the progress callback for an Sqlite database to the +// given callback function with the given argument. The progress callback will +// be invoked every nOps opcodes. +func Xsqlite3_progress_handler(tls *libc.TLS, db uintptr, nOps int32, xProgress uintptr, pArg uintptr) { /* sqlite3.c:166816:17: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if nOps > 0 { + (*Sqlite3)(unsafe.Pointer(db)).FxProgress = xProgress + (*Sqlite3)(unsafe.Pointer(db)).FnProgressOps = uint32(nOps) + (*Sqlite3)(unsafe.Pointer(db)).FpProgressArg = pArg + } else { + (*Sqlite3)(unsafe.Pointer(db)).FxProgress = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FnProgressOps = uint32(0) + (*Sqlite3)(unsafe.Pointer(db)).FpProgressArg = uintptr(0) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) +} + +// This routine installs a default busy handler that waits for the +// specified number of milliseconds before returning 0. +func Xsqlite3_busy_timeout(tls *libc.TLS, db uintptr, ms int32) int32 { /* sqlite3.c:166847:16: */ + if ms > 0 { + Xsqlite3_busy_handler(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32) int32 + }{sqliteDefaultBusyCallback})), + db) + (*Sqlite3)(unsafe.Pointer(db)).FbusyTimeout = ms + } else { + Xsqlite3_busy_handler(tls, db, uintptr(0), uintptr(0)) + } + return SQLITE_OK +} + +// Cause any pending operation to stop at its earliest opportunity. +func Xsqlite3_interrupt(tls *libc.TLS, db uintptr) { /* sqlite3.c:166864:17: */ + libc.AtomicStoreNInt32((db + 400 /* &.u1 */ /* &.isInterrupted */), int32(1), 0) +} + +// This function is exactly the same as sqlite3_create_function(), except +// that it is designed to be called by internal code. The difference is +// that if a malloc() fails in sqlite3_create_function(), an error code +// is returned and the mallocFailed flag cleared. +func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg int32, enc int32, pUserData uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, pDestructor uintptr) int32 { /* sqlite3.c:166881:20: */ + var p uintptr + var nName int32 + _ = nName + var extraFlags int32 + + if (((((zFunctionName == uintptr(0)) || // Must have a valid name + ((xSFunc != uintptr(0)) && (xFinal != uintptr(0)))) || // Not both xSFunc and xFinal + ((libc.Bool32(xFinal == uintptr(0))) != (libc.Bool32(xStep == uintptr(0))))) || // Both or neither of xFinal and xStep + ((libc.Bool32(xValue == uintptr(0))) != (libc.Bool32(xInverse == uintptr(0))))) || // Both or neither of xValue, xInverse + ((nArg < -1) || (nArg > SQLITE_MAX_FUNCTION_ARG))) || + (255 < (libc.AssignInt32(&nName, Xsqlite3Strlen30(tls, zFunctionName)))) { + return Xsqlite3MisuseError(tls, 166907) + } + + extraFlags = (enc & (((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS)) + enc = enc & (SQLITE_FUNC_ENCMASK | SQLITE_ANY) + + // The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But + // the meaning is inverted. So flip the bit. + + extraFlags = extraFlags ^ (SQLITE_FUNC_UNSAFE) + + // If SQLITE_UTF16 is specified as the encoding type, transform this + // to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the + // SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. + // + // If SQLITE_ANY is specified, add three versions of the function + // to the hash table. + if enc == SQLITE_UTF16 { + enc = SQLITE_UTF16LE + } else if enc == SQLITE_ANY { + var rc int32 + rc = Xsqlite3CreateFunc(tls, db, zFunctionName, nArg, + ((SQLITE_UTF8 | extraFlags) ^ SQLITE_FUNC_UNSAFE), + pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor) + if rc == SQLITE_OK { + rc = Xsqlite3CreateFunc(tls, db, zFunctionName, nArg, + ((SQLITE_UTF16LE | extraFlags) ^ SQLITE_FUNC_UNSAFE), + pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor) + } + if rc != SQLITE_OK { + return rc + } + enc = SQLITE_UTF16BE + } + + // Check if an existing function is being overridden or deleted. If so, + // and there are active VMs, then return SQLITE_BUSY. If a function + // is being overridden/deleted but there are no active VMs, allow the + // operation to continue but invalidate all precompiled statements. + p = Xsqlite3FindFunction(tls, db, zFunctionName, nArg, U8(enc), uint8(0)) + if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { + Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, + ts+22277 /* "unable to delete..." */, 0) + + return SQLITE_BUSY + } else { + Xsqlite3ExpirePreparedStatements(tls, db, 0) + } + } else if (xSFunc == uintptr(0)) && (xFinal == uintptr(0)) { + // Trying to delete a function that does not exist. This is a no-op. + // https://sqlite.org/forum/forumpost/726219164b + return SQLITE_OK + } + + p = Xsqlite3FindFunction(tls, db, zFunctionName, nArg, U8(enc), uint8(1)) + + if !(p != 0) { + return SQLITE_NOMEM + } + + // If an older version of the function with a configured destructor is + // being replaced invoke the destructor function here. + functionDestroy(tls, db, p) + + if pDestructor != 0 { + (*FuncDestructor)(unsafe.Pointer(pDestructor)).FnRef++ + } + *(*uintptr)(unsafe.Pointer(p + 64 /* &.u */)) = pDestructor + (*FuncDef)(unsafe.Pointer(p)).FfuncFlags = (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) | U32(extraFlags)) + + (*FuncDef)(unsafe.Pointer(p)).FxSFunc = func() uintptr { + if xSFunc != 0 { + return xSFunc + } + return xStep + }() + (*FuncDef)(unsafe.Pointer(p)).FxFinalize = xFinal + (*FuncDef)(unsafe.Pointer(p)).FxValue = xValue + (*FuncDef)(unsafe.Pointer(p)).FxInverse = xInverse + (*FuncDef)(unsafe.Pointer(p)).FpUserData = pUserData + (*FuncDef)(unsafe.Pointer(p)).FnArg = I8(U16(nArg)) + return SQLITE_OK +} + +// Worker function used by utf-8 APIs that create new functions: +// +// sqlite3_create_function() +// sqlite3_create_function_v2() +// sqlite3_create_window_function() +func createFunctionApi(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, xDestroy uintptr) int32 { /* sqlite3.c:167005:12: */ + var rc int32 + var pArg uintptr + rc = SQLITE_ERROR + pArg = uintptr(0) + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if !(xDestroy != 0) { + goto __1 + } + pArg = Xsqlite3Malloc(tls, uint64(unsafe.Sizeof(FuncDestructor{}))) + if !(!(pArg != 0)) { + goto __2 + } + Xsqlite3OomFault(tls, db) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, p) + goto out +__2: + ; + (*FuncDestructor)(unsafe.Pointer(pArg)).FnRef = 0 + (*FuncDestructor)(unsafe.Pointer(pArg)).FxDestroy = xDestroy + (*FuncDestructor)(unsafe.Pointer(pArg)).FpUserData = p +__1: + ; + rc = Xsqlite3CreateFunc(tls, db, zFunc, nArg, enc, p, + xSFunc, xStep, xFinal, xValue, xInverse, pArg) + if !((pArg != 0) && ((*FuncDestructor)(unsafe.Pointer(pArg)).FnRef == 0)) { + goto __3 + } + + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, p) + Xsqlite3_free(tls, pArg) +__3: + ; + +out: + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Create new user functions. +func Xsqlite3_create_function(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr) int32 { /* sqlite3.c:167056:16: */ + return createFunctionApi(tls, db, zFunc, nArg, enc, p, xSFunc, xStep, + xFinal, uintptr(0), uintptr(0), uintptr(0)) +} + +func Xsqlite3_create_function_v2(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr, xDestroy uintptr) int32 { /* sqlite3.c:167069:16: */ + return createFunctionApi(tls, db, zFunc, nArg, enc, p, xSFunc, xStep, + xFinal, uintptr(0), uintptr(0), xDestroy) +} + +func Xsqlite3_create_window_function(tls *libc.TLS, db uintptr, zFunc uintptr, nArg int32, enc int32, p uintptr, xStep uintptr, xFinal uintptr, xValue uintptr, xInverse uintptr, xDestroy uintptr) int32 { /* sqlite3.c:167083:16: */ + return createFunctionApi(tls, db, zFunc, nArg, enc, p, uintptr(0), xStep, + xFinal, xValue, xInverse, xDestroy) +} + +func Xsqlite3_create_function16(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg int32, eTextRep int32, p uintptr, xSFunc uintptr, xStep uintptr, xFinal uintptr) int32 { /* sqlite3.c:167100:16: */ + var rc int32 + var zFunc8 uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + zFunc8 = Xsqlite3Utf16to8(tls, db, zFunctionName, -1, uint8(SQLITE_UTF16LE)) + rc = Xsqlite3CreateFunc(tls, db, zFunc8, nArg, eTextRep, p, xSFunc, xStep, xFinal, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3DbFree(tls, db, zFunc8) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// The following is the implementation of an SQL function that always +// fails with an error message stating that the function is used in the +// wrong context. The sqlite3_overload_function() API might construct +// SQL function that use this routine so that the functions will exist +// for name resolution but are actually overloaded by the xFindFunction +// method of virtual tables. +func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:167136:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var zName uintptr = Xsqlite3_user_data(tls, context) + var zErr uintptr + _ = NotUsed + _ = NotUsed2 + zErr = Xsqlite3_mprintf(tls, + ts+22340 /* "unable to use fu..." */, libc.VaList(bp, zName)) + Xsqlite3_result_error(tls, context, zErr, -1) + Xsqlite3_free(tls, zErr) +} + +// Declare that a function has been overloaded by a virtual table. +// +// If the function already exists as a regular global function, then +// this routine is a no-op. If the function does not exist, then create +// a new one that always throws a run-time error. +// +// When virtual tables intend to provide an overloaded function, they +// should call this routine to make sure the global function exists. +// A global function must exist in order for name resolution to work +// properly. +func Xsqlite3_overload_function(tls *libc.TLS, db uintptr, zName uintptr, nArg int32) int32 { /* sqlite3.c:167162:16: */ + var rc int32 + var zCopy uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + rc = (libc.Bool32(Xsqlite3FindFunction(tls, db, zName, nArg, uint8(SQLITE_UTF8), uint8(0)) != uintptr(0))) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if rc != 0 { + return SQLITE_OK + } + zCopy = Xsqlite3_mprintf(tls, zName, 0) + if zCopy == uintptr(0) { + return SQLITE_NOMEM + } + return Xsqlite3_create_function_v2(tls, db, zName, nArg, SQLITE_UTF8, + zCopy, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{sqlite3InvalidFunction})), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) +} + +// Register a trace function. The pArg from the previously registered trace +// is returned. +// +// A NULL trace function means that no tracing is executes. A non-NULL +// trace is a pointer to a function that is invoked at the start of each +// SQL statement. +func Xsqlite3_trace(tls *libc.TLS, db uintptr, xTrace uintptr, pArg uintptr) uintptr { /* sqlite3.c:167195:17: */ + var pOld uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pOld = (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg + (*Sqlite3)(unsafe.Pointer(db)).FmTrace = func() uint8 { + if xTrace != 0 { + return uint8(SQLITE_TRACE_LEGACY) + } + return uint8(0) + }() + *(*uintptr)(unsafe.Pointer(db + 240 /* &.trace */)) = xTrace + (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pOld +} + +// Register a trace callback using the version-2 interface. +func Xsqlite3_trace_v2(tls *libc.TLS, db uintptr, mTrace uint32, xTrace uintptr, pArg uintptr) int32 { /* sqlite3.c:167216:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if mTrace == uint32(0) { + xTrace = uintptr(0) + } + if xTrace == uintptr(0) { + mTrace = uint32(0) + } + (*Sqlite3)(unsafe.Pointer(db)).FmTrace = U8(mTrace) + *(*uintptr)(unsafe.Pointer(db + 240 /* &.trace */)) = xTrace + (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// Register a profile function. The pArg from the previously registered +// profile function is returned. +// +// A NULL profile function means that no profiling is executes. A non-NULL +// profile is a pointer to a function that is invoked at the conclusion of +// each SQL statement that is run. +func Xsqlite3_profile(tls *libc.TLS, db uintptr, xProfile uintptr, pArg uintptr) uintptr { /* sqlite3.c:167246:17: */ + var pOld uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pOld = (*Sqlite3)(unsafe.Pointer(db)).FpProfileArg + (*Sqlite3)(unsafe.Pointer(db)).FxProfile = xProfile + (*Sqlite3)(unsafe.Pointer(db)).FpProfileArg = pArg + *(*U8)(unsafe.Pointer(db + 106 /* &.mTrace */)) &= U8((SQLITE_TRACE_NONLEGACY_MASK)) + if (*Sqlite3)(unsafe.Pointer(db)).FxProfile != 0 { + *(*U8)(unsafe.Pointer(db + 106 /* &.mTrace */)) |= U8((SQLITE_TRACE_XPROFILE)) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pOld +} + +// Register a function to be invoked when a transaction commits. +// If the invoked function returns non-zero, then the commit becomes a +// rollback. +func Xsqlite3_commit_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) uintptr { /* sqlite3.c:167276:17: */ + var pOld uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pOld = (*Sqlite3)(unsafe.Pointer(db)).FpCommitArg + (*Sqlite3)(unsafe.Pointer(db)).FxCommitCallback = xCallback + (*Sqlite3)(unsafe.Pointer(db)).FpCommitArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pOld +} + +// Register a callback to be invoked each time a row is updated, +// inserted or deleted using this database connection. +func Xsqlite3_update_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) uintptr { /* sqlite3.c:167301:17: */ + var pRet uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Sqlite3)(unsafe.Pointer(db)).FpUpdateArg + (*Sqlite3)(unsafe.Pointer(db)).FxUpdateCallback = xCallback + (*Sqlite3)(unsafe.Pointer(db)).FpUpdateArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// Register a callback to be invoked each time a transaction is rolled +// back by this database connection. +func Xsqlite3_rollback_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) uintptr { /* sqlite3.c:167326:17: */ + var pRet uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Sqlite3)(unsafe.Pointer(db)).FpRollbackArg + (*Sqlite3)(unsafe.Pointer(db)).FxRollbackCallback = xCallback + (*Sqlite3)(unsafe.Pointer(db)).FpRollbackArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// Register a callback to be invoked each time a row is updated, +// inserted or deleted using this database connection. +func Xsqlite3_preupdate_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) uintptr { /* sqlite3.c:167352:17: */ + var pRet uintptr + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdateArg + (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback = xCallback + (*Sqlite3)(unsafe.Pointer(db)).FpPreUpdateArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint(). +// Invoke sqlite3_wal_checkpoint if the number of frames in the log file +// is greater than sqlite3.pWalArg cast to an integer (the value configured by +// wal_autocheckpoint()). +func Xsqlite3WalDefaultHook(tls *libc.TLS, pClientData uintptr, db uintptr, zDb uintptr, nFrame int32) int32 { /* sqlite3.c:167375:20: */ + if nFrame >= (int32(pClientData)) { + Xsqlite3BeginBenignMalloc(tls) + Xsqlite3_wal_checkpoint(tls, db, zDb) + Xsqlite3EndBenignMalloc(tls) + } + return SQLITE_OK +} + +// Configure an sqlite3_wal_hook() callback to automatically checkpoint +// a database after committing a transaction if there are nFrame or +// more frames in the log file. Passing zero or a negative value as the +// nFrame parameter disables automatic checkpoints entirely. +// +// The callback registered by this function replaces any existing callback +// registered using sqlite3_wal_hook(). Likewise, registering a callback +// using sqlite3_wal_hook() disables the automatic checkpoint mechanism +// configured by this function. +func Xsqlite3_wal_autocheckpoint(tls *libc.TLS, db uintptr, nFrame int32) int32 { /* sqlite3.c:167401:16: */ + if nFrame > 0 { + Xsqlite3_wal_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32) int32 + }{Xsqlite3WalDefaultHook})), uintptr(int64(nFrame))) + } else { + Xsqlite3_wal_hook(tls, db, uintptr(0), uintptr(0)) + } + return SQLITE_OK +} + +// Register a callback to be invoked each time a transaction is written +// into the write-ahead-log by this database connection. +func Xsqlite3_wal_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintptr) uintptr { /* sqlite3.c:167422:17: */ + var pRet uintptr + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pRet = (*Sqlite3)(unsafe.Pointer(db)).FpWalArg + (*Sqlite3)(unsafe.Pointer(db)).FxWalCallback = xCallback + (*Sqlite3)(unsafe.Pointer(db)).FpWalArg = pArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return pRet +} + +// Checkpoint database zDb. +func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) int32 { /* sqlite3.c:167449:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 // Return code + var iDb int32 // Schema to checkpoint + + // Initialize the output variables to -1 in case an error occurs. + if pnLog != 0 { + *(*int32)(unsafe.Pointer(pnLog)) = -1 + } + if pnCkpt != 0 { + *(*int32)(unsafe.Pointer(pnCkpt)) = -1 + } + + if (eMode < SQLITE_CHECKPOINT_PASSIVE) || (eMode > SQLITE_CHECKPOINT_TRUNCATE) { + // EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint + // mode: + return SQLITE_MISUSE + } + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if (zDb != 0) && (*(*int8)(unsafe.Pointer(zDb)) != 0) { + iDb = Xsqlite3FindDbName(tls, db, zDb) + } else { + iDb = (SQLITE_MAX_ATTACHED + 2) // This means process all schemas + } + if iDb < 0 { + rc = SQLITE_ERROR + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22391 /* "unknown database..." */, libc.VaList(bp, zDb)) + } else { + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 + rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) + Xsqlite3Error(tls, db, rc) + } + rc = Xsqlite3ApiExit(tls, db, rc) + + // If there are no active statements, clear the interrupt flag at this + // point. + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + libc.AtomicStoreNInt32((db + 400 /* &.u1 */ /* &.isInterrupted */), int32(0), 0) + } + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points +// to contains a zero-length string, all attached databases are +// checkpointed. +func Xsqlite3_wal_checkpoint(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:167513:16: */ + // EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to + // sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). + return Xsqlite3_wal_checkpoint_v2(tls, db, zDb, SQLITE_CHECKPOINT_PASSIVE, uintptr(0), uintptr(0)) +} + +// Run a checkpoint on database iDb. This is a no-op if database iDb is +// not currently open in WAL mode. +// +// If a transaction is open on the database being checkpointed, this +// function returns SQLITE_LOCKED and a checkpoint is not attempted. If +// an error occurs while running the checkpoint, an SQLite error code is +// returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK. +// +// The mutex on database handle db should be held by the caller. The mutex +// associated with the specific b-tree being checkpointed is taken by +// this function while the checkpoint is running. +// +// If iDb is passed SQLITE_MAX_DB then all attached databases are +// checkpointed. If an error is encountered it is returned immediately - +// no attempt is made to checkpoint any remaining databases. +// +// Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL, RESTART +// or TRUNCATE. +func Xsqlite3Checkpoint(tls *libc.TLS, db uintptr, iDb int32, eMode int32, pnLog uintptr, pnCkpt uintptr) int32 { /* sqlite3.c:167540:20: */ + var rc int32 = SQLITE_OK // Return code + var i int32 // Used to iterate through attached dbs + var bBusy int32 = 0 // True if SQLITE_BUSY has been encountered + + // See forum post a006d86f72 + + for i = 0; (i < (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (rc == SQLITE_OK); i++ { + if (i == iDb) || (iDb == (SQLITE_MAX_ATTACHED + 2)) { + rc = Xsqlite3BtreeCheckpoint(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpBt, eMode, pnLog, pnCkpt) + pnLog = uintptr(0) + pnCkpt = uintptr(0) + if rc == SQLITE_BUSY { + bBusy = 1 + rc = SQLITE_OK + } + } + } + + if (rc == SQLITE_OK) && (bBusy != 0) { + return SQLITE_BUSY + } + return rc +} + +// This function returns true if main-memory should be used instead of +// a temporary file for transient pager files and statement journals. +// The value returned depends on the value of db->temp_store (runtime +// parameter) and the compile time value of SQLITE_TEMP_STORE. The +// following table describes the relationship between these two values +// and this functions return value. +// +// SQLITE_TEMP_STORE db->temp_store Location of temporary database +// ----------------- -------------- ------------------------------ +// 0 any file (return 0) +// 1 1 file (return 0) +// 1 2 memory (return 1) +// 1 0 file (return 0) +// 2 1 file (return 0) +// 2 2 memory (return 1) +// 2 0 memory (return 1) +// 3 any memory (return 1) +func Xsqlite3TempInMemory(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:167586:20: */ + return (libc.Bool32(int32((*Sqlite3)(unsafe.Pointer(db)).Ftemp_store) == 2)) +} + +// Return UTF-8 encoded English language explanation of the most recent +// error. +func Xsqlite3_errmsg(tls *libc.TLS, db uintptr) uintptr { /* sqlite3.c:167607:23: */ + var z uintptr + if !(db != 0) { + return Xsqlite3ErrStr(tls, SQLITE_NOMEM) + } + if !(Xsqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return Xsqlite3ErrStr(tls, Xsqlite3MisuseError(tls, 167613)) + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + z = Xsqlite3ErrStr(tls, SQLITE_NOMEM) + } else { + + if (*Sqlite3)(unsafe.Pointer(db)).FerrCode != 0 { + z = Xsqlite3_value_text(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + } else { + z = uintptr(0) + } + + if z == uintptr(0) { + z = Xsqlite3ErrStr(tls, (*Sqlite3)(unsafe.Pointer(db)).FerrCode) + } + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return z +} + +// Return UTF-16 encoded English language explanation of the most recent +// error. +func Xsqlite3_errmsg16(tls *libc.TLS, db uintptr) uintptr { /* sqlite3.c:167635:23: */ + var z uintptr + if !(db != 0) { + return uintptr(uintptr(unsafe.Pointer(&outOfMem))) + } + if !(Xsqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return uintptr(uintptr(unsafe.Pointer(&misuse))) + } + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { + z = uintptr(uintptr(unsafe.Pointer(&outOfMem))) + } else { + z = Xsqlite3_value_text16(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + if z == uintptr(0) { + Xsqlite3ErrorWithMsg(tls, db, (*Sqlite3)(unsafe.Pointer(db)).FerrCode, Xsqlite3ErrStr(tls, (*Sqlite3)(unsafe.Pointer(db)).FerrCode), 0) + z = Xsqlite3_value_text16(tls, (*Sqlite3)(unsafe.Pointer(db)).FpErr) + } + // A malloc() may have failed within the call to sqlite3_value_text16() + // above. If this is the case, then the db->mallocFailed flag needs to + // be cleared before returning. Do this directly, instead of via + // sqlite3ApiExit(), to avoid setting the database handle error message. + Xsqlite3OomClear(tls, db) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return z +} + +var outOfMem = [14]U16{ + U16('o'), U16('u'), U16('t'), U16(' '), U16('o'), U16('f'), U16(' '), U16('m'), U16('e'), U16('m'), U16('o'), U16('r'), U16('y'), U16(0), +} /* sqlite3.c:167636:20 */ +var misuse = [34]U16{ + U16('b'), U16('a'), U16('d'), U16(' '), U16('p'), U16('a'), U16('r'), U16('a'), U16('m'), U16('e'), U16('t'), U16('e'), U16('r'), U16(' '), + U16('o'), U16('r'), U16(' '), U16('o'), U16('t'), U16('h'), U16('e'), U16('r'), U16(' '), U16('A'), U16('P'), U16('I'), U16(' '), + U16('m'), U16('i'), U16('s'), U16('u'), U16('s'), U16('e'), U16(0), +} /* sqlite3.c:167639:20 */ + +// Return the most recent error code generated by an SQLite routine. If NULL is +// passed to this function, we assume a malloc() failed during sqlite3_open(). +func Xsqlite3_errcode(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:167677:16: */ + if (db != 0) && !(Xsqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return Xsqlite3MisuseError(tls, 167679) + } + if !(db != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return SQLITE_NOMEM + } + return ((*Sqlite3)(unsafe.Pointer(db)).FerrCode & (*Sqlite3)(unsafe.Pointer(db)).FerrMask) +} + +func Xsqlite3_extended_errcode(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:167686:16: */ + if (db != 0) && !(Xsqlite3SafetyCheckSickOrOk(tls, db) != 0) { + return Xsqlite3MisuseError(tls, 167688) + } + if !(db != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + return SQLITE_NOMEM + } + return (*Sqlite3)(unsafe.Pointer(db)).FerrCode +} + +func Xsqlite3_system_errno(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:167695:16: */ + if db != 0 { + return (*Sqlite3)(unsafe.Pointer(db)).FiSysErrno + } + return 0 +} + +// Return a string that describes the kind of error specified in the +// argument. For now, this simply calls the internal sqlite3ErrStr() +// function. +func Xsqlite3_errstr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:167704:23: */ + return Xsqlite3ErrStr(tls, rc) +} + +// Create a new collating function for database "db". The name is zName +// and the encoding is enc. +func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uintptr, xCompare uintptr, xDel uintptr) int32 { /* sqlite3.c:167712:12: */ + var pColl uintptr + var enc2 int32 + + // If SQLITE_UTF16 is specified as the encoding type, transform this + // to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the + // SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. + enc2 = int32(enc) + + if (enc2 == SQLITE_UTF16) || (enc2 == SQLITE_UTF16_ALIGNED) { + enc2 = SQLITE_UTF16LE + } + if (enc2 < SQLITE_UTF8) || (enc2 > SQLITE_UTF16BE) { + return Xsqlite3MisuseError(tls, 167736) + } + + // Check if this call is removing or replacing an existing collation + // sequence. If so, and there are active VMs, return busy. If there + // are no active VMs, invalidate any pre-compiled statements. + pColl = Xsqlite3FindCollSeq(tls, db, U8(enc2), zName, 0) + if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { + Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, + ts+22412 /* "unable to delete..." */, 0) + return SQLITE_BUSY + } + Xsqlite3ExpirePreparedStatements(tls, db, 0) + + // If collation sequence pColl was created directly by a call to + // sqlite3_create_collation, and not generated by synthCollSeq(), + // then any copies made by synthCollSeq() need to be invalidated. + // Also, collation destructor - CollSeq.xDel() - function may need + // to be called. + if (int32((*CollSeq)(unsafe.Pointer(pColl)).Fenc) & libc.CplInt32(SQLITE_UTF16_ALIGNED)) == enc2 { + var aColl uintptr = Xsqlite3HashFind(tls, (db + 608 /* &.aCollSeq */), zName) + var j int32 + for j = 0; j < 3; j++ { + var p uintptr = (aColl + uintptr(j)*40) + if int32((*CollSeq)(unsafe.Pointer(p)).Fenc) == int32((*CollSeq)(unsafe.Pointer(pColl)).Fenc) { + if (*CollSeq)(unsafe.Pointer(p)).FxDel != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 32 /* &.xDel */))))(tls, (*CollSeq)(unsafe.Pointer(p)).FpUser) + } + (*CollSeq)(unsafe.Pointer(p)).FxCmp = uintptr(0) + } + } + } + } + + pColl = Xsqlite3FindCollSeq(tls, db, U8(enc2), zName, 1) + if pColl == uintptr(0) { + return SQLITE_NOMEM + } + (*CollSeq)(unsafe.Pointer(pColl)).FxCmp = xCompare + (*CollSeq)(unsafe.Pointer(pColl)).FpUser = pCtx + (*CollSeq)(unsafe.Pointer(pColl)).FxDel = xDel + (*CollSeq)(unsafe.Pointer(pColl)).Fenc = (U8(enc2 | (int32(enc) & SQLITE_UTF16_ALIGNED))) + Xsqlite3Error(tls, db, SQLITE_OK) + return SQLITE_OK +} + +// This array defines hard upper bounds on limit values. The +// initializer must be kept in sync with the SQLITE_LIMIT_* +// #defines in sqlite3.h. +var aHardLimit = [12]int32{ + SQLITE_MAX_LENGTH, + SQLITE_MAX_SQL_LENGTH, + SQLITE_MAX_COLUMN, + SQLITE_MAX_EXPR_DEPTH, + SQLITE_MAX_COMPOUND_SELECT, + SQLITE_MAX_VDBE_OP, + SQLITE_MAX_FUNCTION_ARG, + SQLITE_MAX_ATTACHED, + SQLITE_MAX_LIKE_PATTERN_LENGTH, + SQLITE_MAX_VARIABLE_NUMBER, // IMP: R-38091-32352 + SQLITE_MAX_TRIGGER_DEPTH, + SQLITE_MAX_WORKER_THREADS, +} /* sqlite3.c:167789:18 */ + +// Make sure the hard limits are set to reasonable values + +// Change the value of a limit. Report the old value. +// If an invalid limit index is supplied, report -1. +// Make no changes but still report the old value if the +// new limit is negative. +// +// A new lower limit does not shrink existing constructs. +// It merely prevents new constructs that exceed the limit +// from forming. +func Xsqlite3_limit(tls *libc.TLS, db uintptr, limitId int32, newLimit int32) int32 { /* sqlite3.c:167852:16: */ + var oldLimit int32 + + // EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME + // there is a hard upper bound set at compile-time by a C preprocessor + // macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to + // "_MAX_".) + + if (limitId < 0) || (limitId >= (SQLITE_LIMIT_WORKER_THREADS + 1)) { + return -1 + } + oldLimit = *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + uintptr(limitId)*4)) + if newLimit >= 0 { // IMP: R-52476-28732 + if newLimit > aHardLimit[limitId] { + newLimit = aHardLimit[limitId] // IMP: R-51463-25634 + } + *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + uintptr(limitId)*4)) = newLimit + } + return oldLimit // IMP: R-53341-35419 +} + +// This function is used to parse both URIs and non-URI filenames passed by the +// user to API functions sqlite3_open() or sqlite3_open_v2(), and for database +// URIs specified as part of ATTACH statements. +// +// The first argument to this function is the name of the VFS to use (or +// a NULL to signify the default VFS) if the URI does not contain a "vfs=xxx" +// query parameter. The second argument contains the URI (or non-URI filename) +// itself. When this function is called the *pFlags variable should contain +// the default flags to open the database handle with. The value stored in +// *pFlags may be updated before returning if the URI filename contains +// "cache=xxx" or "mode=xxx" query parameters. +// +// If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to +// the VFS that should be used to open the database file. *pzFile is set to +// point to a buffer containing the name of the file to open. The value +// stored in *pzFile is a database name acceptable to sqlite3_uri_parameter() +// and is in the same format as names created using sqlite3_create_filename(). +// The caller must invoke sqlite3_free_filename() (not sqlite3_free()!) on +// the value returned in *pzFile to avoid a memory leak. +// +// If an error occurs, then an SQLite error code is returned and *pzErrMsg +// may be set to point to a buffer containing an English language error +// message. It is the responsibility of the caller to eventually release +// this buffer by calling sqlite3_free(). +func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags uintptr, ppVfs uintptr, pzFile uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:167922:20: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 + var flags uint32 + var zVfs uintptr + var zFile uintptr + var c int8 + var nUri int32 + var octet int32 + var z uintptr + var i int32 + var mode int32 + var aMode uintptr + var zModeType uintptr + var mask int32 + var limit int32 + var nOpt int32 + var zVal uintptr + var nVal int32 + var zOpt uintptr + var eState int32 // Parser state when parsing URI + var iIn int32 // Input character index + var iOut int32 // Output character index + var nByte U64 + rc = SQLITE_OK + flags = *(*uint32)(unsafe.Pointer(pFlags)) + zVfs = zDefaultVfs + nUri = Xsqlite3Strlen30(tls, zUri) + + if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 + (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22480 /* "file:" */, uint64(5)) == 0)) { + goto __1 + } // Input character index + iOut = 0 // Output character index + nByte = (U64(nUri + 8)) // Bytes of space to allocate + + // Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen + // method that there may be extra parameters following the file-name. + flags = flags | (uint32(SQLITE_OPEN_URI)) + + iIn = 0 +__3: + if !(iIn < nUri) { + goto __5 + } + nByte = nByte + (U64(libc.Bool32(int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) == '&'))) + goto __4 +__4: + iIn++ + goto __3 + goto __5 +__5: + ; + zFile = Xsqlite3_malloc64(tls, nByte) + if !(!(zFile != 0)) { + goto __6 + } + return SQLITE_NOMEM +__6: + ; + + libc.Xmemset(tls, zFile, 0, uint64(4)) // 4-byte of 0x00 is the start of DB name marker + zFile += uintptr(4) + + iIn = 5 + // Discard the scheme and authority segments of the URI. + if !((int32(*(*int8)(unsafe.Pointer(zUri + 5))) == '/') && (int32(*(*int8)(unsafe.Pointer(zUri + 6))) == '/')) { + goto __7 + } + iIn = 7 +__8: + if !((*(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0) && (int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != '/')) { + goto __9 + } + iIn++ + goto __8 +__9: + ; + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22486 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { + goto __10 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22496, /* "invalid uri auth..." */ + libc.VaList(bp, (iIn-7), (zUri+7))) + rc = SQLITE_ERROR + goto parse_uri_out +__10: + ; +__7: + ; + + // Copy the filename and any query parameters into the zFile buffer. + // Decode %HH escape codes along the way. + // + // Within this loop, variable eState may be set to 0, 1 or 2, depending + // on the parsing context. As follows: + // + // 0: Parsing file-name. + // 1: Parsing name section of a name=value query parameter. + // 2: Parsing value section of a name=value query parameter. + eState = 0 +__11: + if !(((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))))) != 0) && (int32(c) != '#')) { + goto __12 + } + iIn++ + if !(((int32(c) == '%') && + ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn))))]) & 0x08) != 0)) && + ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zUri + uintptr((iIn + 1)))))]) & 0x08) != 0)) { + goto __13 + } + octet = (int32(Xsqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zUri + uintptr(libc.PostIncInt32(&iIn, 1))))))) << 4) + octet = octet + (int32(Xsqlite3HexToInt(tls, int32(*(*int8)(unsafe.Pointer(zUri + uintptr(libc.PostIncInt32(&iIn, 1)))))))) + + if !(octet == 0) { + goto __15 + } + // This branch is taken when "%00" appears within the URI. In this + // case we ignore all text in the remainder of the path, name or + // value currently being parsed. So ignore the current character + // and skip to the next "?", "=" or "&", as appropriate. +__16: + if !((((((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))))) != 0) && (int32(c) != '#')) && + ((eState != 0) || (int32(c) != '?'))) && + ((eState != 1) || ((int32(c) != '=') && (int32(c) != '&')))) && + ((eState != 2) || (int32(c) != '&'))) { + goto __17 + } + iIn++ + goto __16 +__17: + ; + goto __11 +__15: + ; + c = int8(octet) + goto __14 +__13: + if !((eState == 1) && ((int32(c) == '&') || (int32(c) == '='))) { + goto __18 + } + if !(int32(*(*int8)(unsafe.Pointer(zFile + uintptr((iOut - 1))))) == 0) { + goto __20 + } + // An empty option name. Ignore this option altogether. +__21: + if !(((*(*int8)(unsafe.Pointer(zUri + uintptr(iIn))) != 0) && (int32(*(*int8)(unsafe.Pointer(zUri + uintptr(iIn)))) != '#')) && (int32(*(*int8)(unsafe.Pointer(zUri + uintptr((iIn - 1))))) != '&')) { + goto __22 + } + iIn++ + goto __21 +__22: + ; + goto __11 +__20: + ; + if !(int32(c) == '&') { + goto __23 + } + *(*int8)(unsafe.Pointer(zFile + uintptr(libc.PostIncInt32(&iOut, 1)))) = int8(0) + goto __24 +__23: + eState = 2 +__24: + ; + c = int8(0) + goto __19 +__18: + if !(((eState == 0) && (int32(c) == '?')) || ((eState == 2) && (int32(c) == '&'))) { + goto __25 + } + c = int8(0) + eState = 1 +__25: + ; +__19: + ; +__14: + ; + *(*int8)(unsafe.Pointer(zFile + uintptr(libc.PostIncInt32(&iOut, 1)))) = c + goto __11 +__12: + ; + if !(eState == 1) { + goto __26 + } + *(*int8)(unsafe.Pointer(zFile + uintptr(libc.PostIncInt32(&iOut, 1)))) = int8(0) +__26: + ; + libc.Xmemset(tls, (zFile + uintptr(iOut)), 0, uint64(4)) // end-of-options + empty journal filenames + + // Check if there were any options specified that should be interpreted + // here. Options that are interpreted here include "vfs" and those that + // correspond to flags that may be passed to the sqlite3_open_v2() + // method. + zOpt = (zFile + uintptr((Xsqlite3Strlen30(tls, zFile) + 1))) +__27: + if !(*(*int8)(unsafe.Pointer(zOpt)) != 0) { + goto __28 + } + nOpt = Xsqlite3Strlen30(tls, zOpt) + zVal = (zOpt + uintptr((nOpt + 1))) + nVal = Xsqlite3Strlen30(tls, zVal) + + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22524 /* "vfs" */, zOpt, uint64(3)) == 0)) { + goto __29 + } + zVfs = zVal + goto __30 +__29: + aMode = uintptr(0) + zModeType = uintptr(0) + mask = 0 + limit = 0 + + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22528 /* "cache" */, zOpt, uint64(5)) == 0)) { + goto __31 + } + + mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) + aMode = uintptr(unsafe.Pointer(&aCacheMode)) + limit = mask + zModeType = ts + 22528 /* "cache" */ +__31: + ; + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22534 /* "mode" */, zOpt, uint64(4)) == 0)) { + goto __32 + } + + mask = (((SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE) | + SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) + aMode = uintptr(unsafe.Pointer(&aOpenMode)) + limit = (int32(uint32(mask) & flags)) + zModeType = ts + 2400 /* "access" */ +__32: + ; + + if !(aMode != 0) { + goto __33 + } + mode = 0 + i = 0 +__34: + if !((*OpenMode)(unsafe.Pointer(aMode+uintptr(i)*16)).Fz != 0) { + goto __36 + } + z = (*OpenMode)(unsafe.Pointer(aMode + uintptr(i)*16)).Fz + if !((nVal == Xsqlite3Strlen30(tls, z)) && (0 == libc.Xmemcmp(tls, zVal, z, uint64(nVal)))) { + goto __37 + } + mode = (*OpenMode)(unsafe.Pointer(aMode + uintptr(i)*16)).Fmode + goto __36 +__37: + ; + goto __35 +__35: + i++ + goto __34 + goto __36 +__36: + ; + if !(mode == 0) { + goto __38 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22539 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + rc = SQLITE_ERROR + goto parse_uri_out +__38: + ; + if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { + goto __39 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22559, /* "%s mode not allo..." */ + libc.VaList(bp+32, zModeType, zVal)) + rc = SQLITE_PERM + goto parse_uri_out +__39: + ; + flags = ((flags & uint32(^mask)) | uint32(mode)) +__33: + ; +__30: + ; + + zOpt = (zVal + uintptr((nVal + 1))) + goto __27 +__28: + ; + + goto __2 +__1: + zFile = Xsqlite3_malloc64(tls, (uint64(nUri + 8))) + if !(!(zFile != 0)) { + goto __40 + } + return SQLITE_NOMEM +__40: + ; + libc.Xmemset(tls, zFile, 0, uint64(4)) + zFile += uintptr(4) + if !(nUri != 0) { + goto __41 + } + libc.Xmemcpy(tls, zFile, zUri, uint64(nUri)) +__41: + ; + libc.Xmemset(tls, (zFile + uintptr(nUri)), 0, uint64(4)) + flags = flags & (libc.Uint32FromInt32(libc.CplInt32(SQLITE_OPEN_URI))) +__2: + ; + + *(*uintptr)(unsafe.Pointer(ppVfs)) = Xsqlite3_vfs_find(tls, zVfs) + if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { + goto __42 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22583 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + rc = SQLITE_ERROR +__42: + ; +parse_uri_out: + if !(rc != SQLITE_OK) { + goto __43 + } + Xsqlite3_free_filename(tls, zFile) + zFile = uintptr(0) +__43: + ; + *(*uint32)(unsafe.Pointer(pFlags)) = flags + *(*uintptr)(unsafe.Pointer(pzFile)) = zFile + return rc +} + +type OpenMode = struct { + Fz uintptr + Fmode int32 + _ [4]byte +} /* sqlite3.c:168064:9 */ + +var aCacheMode = [3]OpenMode{ + {Fz: ts + 22599 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 22606 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {}, +} /* sqlite3.c:168073:34 */ +var aOpenMode = [5]OpenMode{ + {Fz: ts + 22614 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 22617 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 22620 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 15851 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {}, +} /* sqlite3.c:168085:34 */ + +// This routine does the core work of extracting URI parameters from a +// database filename for the sqlite3_uri_parameter() interface. +func uriParameter(tls *libc.TLS, zFilename uintptr, zParam uintptr) uintptr { /* sqlite3.c:168159:19: */ + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + for *(*int8)(unsafe.Pointer(zFilename)) != 0 { + var x int32 = libc.Xstrcmp(tls, zFilename, zParam) + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + if x == 0 { + return zFilename + } + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + } + return uintptr(0) +} + +// This routine does the work of opening a database on behalf of +// sqlite3_open() and sqlite3_open16(). The database filename "zFilename" +// is UTF-8 encoded. +func openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, flags uint32, zVfs uintptr) int32 { /* sqlite3.c:168177:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + *(*uint32)(unsafe.Pointer(bp + 8)) = flags + + var db uintptr // Store allocated handle here + var rc int32 // Return code + var isThreadsafe int32 // True for threadsafe connections + // var zOpen uintptr at bp+16, 8 + // Filename argument to pass to BtreeOpen() + // var zErrMsg uintptr at bp+24, 8 + // Error message from sqlite3ParseUri() + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* zOpen */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = uintptr(0) // Loop counter + + *(*uintptr)(unsafe.Pointer(ppDb)) = uintptr(0) + rc = Xsqlite3_initialize(tls) + if !(rc != 0) { + goto __1 + } + return rc +__1: + ; + + if !(int32(Xsqlite3Config.FbCoreMutex) == 0) { + goto __2 + } + isThreadsafe = 0 + goto __3 +__2: + if !((*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(SQLITE_OPEN_NOMUTEX)) != 0) { + goto __4 + } + isThreadsafe = 0 + goto __5 +__4: + if !((*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(SQLITE_OPEN_FULLMUTEX)) != 0) { + goto __6 + } + isThreadsafe = 1 + goto __7 +__6: + isThreadsafe = int32(Xsqlite3Config.FbFullMutex) +__7: + ; +__5: + ; +__3: + ; + + if !((*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(SQLITE_OPEN_PRIVATECACHE)) != 0) { + goto __8 + } + *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) &= libc.Uint32FromInt32(libc.CplInt32(SQLITE_OPEN_SHAREDCACHE)) + goto __9 +__8: + if !(Xsqlite3Config.FsharedCacheEnabled != 0) { + goto __10 + } + *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) |= uint32(SQLITE_OPEN_SHAREDCACHE) +__10: + ; +__9: + ; + + // Remove harmful bits from the flags parameter + // + // The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were + // dealt with in the previous code block. Besides these, the only + // valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY, + // SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE, + // SQLITE_OPEN_PRIVATECACHE, and some reserved bits. Silently mask + // off all other flags. + *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) &= libc.Uint32FromInt32(libc.CplInt32((((((((((((SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB) | SQLITE_OPEN_TRANSIENT_DB) | SQLITE_OPEN_MAIN_JOURNAL) | SQLITE_OPEN_TEMP_JOURNAL) | SQLITE_OPEN_SUBJOURNAL) | SQLITE_OPEN_SUPER_JOURNAL) | SQLITE_OPEN_NOMUTEX) | SQLITE_OPEN_FULLMUTEX) | SQLITE_OPEN_WAL))) + + // Allocate the sqlite data structure + db = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(Sqlite3{}))) + if !(db == uintptr(0)) { + goto __11 + } + goto opendb_out +__11: + ; + if !(isThreadsafe != 0) { + goto __12 + } + (*Sqlite3)(unsafe.Pointer(db)).Fmutex = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_RECURSIVE) + if !((*Sqlite3)(unsafe.Pointer(db)).Fmutex == uintptr(0)) { + goto __13 + } + Xsqlite3_free(tls, db) + db = uintptr(0) + goto opendb_out +__13: + ; + if !(isThreadsafe == 0) { + goto __14 + } + +__14: + ; +__12: + ; + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FerrMask = 0xff + (*Sqlite3)(unsafe.Pointer(db)).FnDb = 2 + (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_BUSY + (*Sqlite3)(unsafe.Pointer(db)).FaDb = db + 656 /* &.aDbStatic */ + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable = U32(1) + (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) + + libc.Xmemcpy(tls, db+128 /* &.aLimit */, uintptr(unsafe.Pointer(&aHardLimit)), uint64(unsafe.Sizeof([12]int32{}))) + *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 11*4)) = SQLITE_DEFAULT_WORKER_THREADS + (*Sqlite3)(unsafe.Pointer(db)).FautoCommit = U8(1) + (*Sqlite3)(unsafe.Pointer(db)).FnextAutovac = int8(-1) + (*Sqlite3)(unsafe.Pointer(db)).FszMmap = Xsqlite3Config.FszMmap + (*Sqlite3)(unsafe.Pointer(db)).FnextPagesize = 0 + (*Sqlite3)(unsafe.Pointer(db)).FnMaxSorterMmap = 0x7FFFFFFF + *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(((((((uint32(SQLITE_ShortColNames | + SQLITE_EnableTrigger)) | + SQLITE_EnableView) | + uint32(SQLITE_CacheSpill)) | + uint32(SQLITE_TrustedSchema)) | + // The SQLITE_DQS compile-time option determines the default settings + // for SQLITE_DBCONFIG_DQS_DDL and SQLITE_DBCONFIG_DQS_DML. + // + // SQLITE_DQS SQLITE_DBCONFIG_DQS_DDL SQLITE_DBCONFIG_DQS_DML + // ---------- ----------------------- ----------------------- + // undefined on on + // 3 on on + // 2 on off + // 1 off on + // 0 off off + // + // Legacy behavior is 3 (double-quoted string literals are allowed anywhere) + // and so that is the default. But developers are encouranged to use + // -DSQLITE_DQS=0 (best) or -DSQLITE_DQS=1 (second choice) if possible. + uint32(SQLITE_DqsDML)) | + uint32(SQLITE_DqsDDL)) | + + uint32(SQLITE_AutoIndex))) + Xsqlite3HashInit(tls, (db + 608 /* &.aCollSeq */)) + Xsqlite3HashInit(tls, (db + 536 /* &.aModule */)) + + // Add the default collation sequence BINARY. BINARY works for both UTF-8 + // and UTF-16, so add a version for each to avoid any unnecessary + // conversions. The only error that can occur here is a malloc() failure. + // + // EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating + // functions: + createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 + }{binCollFunc})), uintptr(0)) + createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16BE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 + }{binCollFunc})), uintptr(0)) + createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 + }{binCollFunc})), uintptr(0)) + createCollation(tls, db, ts+20170 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 + }{nocaseCollatingFunc})), uintptr(0)) + createCollation(tls, db, ts+22624 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 + }{rtrimCollFunc})), uintptr(0)) + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __15 + } + goto opendb_out +__15: + ; + + // Parse the filename/URI argument + // + // Only allow sensible combinations of bits in the flags argument. + // Throw an error if any non-sense combination is used. If we + // do not block illegal combinations here, it could trigger + // assert() statements in deeper layers. Sensible combinations + // are: + // + // 1: SQLITE_OPEN_READONLY + // 2: SQLITE_OPEN_READWRITE + // 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE + (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) + + // READONLY + // READWRITE + // READWRITE | CREATE + if !(((int32(1) << (*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(7))) & 0x46) == 0) { + goto __16 + } + rc = Xsqlite3MisuseError(tls, 168382) // IMP: R-18321-05872 + goto __17 +__16: + rc = Xsqlite3ParseUri(tls, zVfs, zFilename, bp+8 /* &flags */, (db /* &.pVfs */), bp+16 /* &zOpen */, bp+24 /* &zErrMsg */) +__17: + ; + if !(rc != SQLITE_OK) { + goto __18 + } + if !(rc == SQLITE_NOMEM) { + goto __19 + } + Xsqlite3OomFault(tls, db) +__19: + ; + Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { + return ts + 2791 /* "%s" */ + } + return uintptr(0) + }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) + goto opendb_out +__18: + ; + + // Open the backend database driver + rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer(bp + 16 /* zOpen */)), db, ((*Sqlite3)(unsafe.Pointer(db)).FaDb + 8 /* &.pBt */), 0, + (int32(*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) | uint32(SQLITE_OPEN_MAIN_DB)))) + if !(rc != SQLITE_OK) { + goto __20 + } + if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { + goto __21 + } + rc = SQLITE_NOMEM +__21: + ; + Xsqlite3Error(tls, db, rc) + goto opendb_out +__20: + ; + Xsqlite3BtreeEnter(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt) + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema = Xsqlite3SchemaGet(tls, db, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt) + if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0)) { + goto __22 + } + Xsqlite3SetTextEncoding(tls, db, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((db))).FaDb)).FpSchema)).Fenc) +__22: + ; + Xsqlite3BtreeLeave(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt) + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FpSchema = Xsqlite3SchemaGet(tls, db, uintptr(0)) + + // The default safety_level for the main database is FULL; for the temp + // database it is OFF. This matches the pager layer defaults. + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5459 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 21626 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) + + (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN + if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + goto __23 + } + goto opendb_out +__23: + ; + + // Register all built-in functions, but do not attempt to read the + // database schema yet. This is delayed until the first time the database + // is accessed. + Xsqlite3Error(tls, db, SQLITE_OK) + Xsqlite3RegisterPerConnectionBuiltinFunctions(tls, db) + rc = Xsqlite3_errcode(tls, db) + + // Load compiled-in extensions + i = 0 +__24: + if !((rc == SQLITE_OK) && (i < (int32(uint64(unsafe.Sizeof(sqlite3BuiltinExtensions)) / uint64(unsafe.Sizeof(uintptr(0))))))) { + goto __26 + } + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&sqlite3BuiltinExtensions)) + uintptr(i)*8))))(tls, db) + goto __25 +__25: + i++ + goto __24 + goto __26 +__26: + ; + + // Load automatic extensions - extensions that have been registered + // using the sqlite3_automatic_extension() API. + if !(rc == SQLITE_OK) { + goto __27 + } + Xsqlite3AutoLoadExtensions(tls, db) + rc = Xsqlite3_errcode(tls, db) + if !(rc != SQLITE_OK) { + goto __28 + } + goto opendb_out +__28: + ; +__27: + ; + + // -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking + // mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking + // mode. Doing nothing at all also makes NORMAL the default. + + if !(rc != 0) { + goto __29 + } + Xsqlite3Error(tls, db, rc) +__29: + ; + + // Enable the lookaside-malloc subsystem + setupLookaside(tls, db, uintptr(0), Xsqlite3Config.FszLookaside, + Xsqlite3Config.FnLookaside) + + Xsqlite3_wal_autocheckpoint(tls, db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT) + +opendb_out: + if !(db != 0) { + goto __30 + } + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) +__30: + ; + rc = Xsqlite3_errcode(tls, db) + + if !(rc == SQLITE_NOMEM) { + goto __31 + } + Xsqlite3_close(tls, db) + db = uintptr(0) + goto __32 +__31: + if !(rc != SQLITE_OK) { + goto __33 + } + (*Sqlite3)(unsafe.Pointer(db)).Fmagic = U32(SQLITE_MAGIC_SICK) +__33: + ; +__32: + ; + *(*uintptr)(unsafe.Pointer(ppDb)) = db + Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zOpen */))) + return (rc & 0xff) +} + +// Open a new database handle. +func Xsqlite3_open(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* sqlite3.c:168504:16: */ + return openDatabase(tls, zFilename, ppDb, + (uint32(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)), uintptr(0)) +} + +func Xsqlite3_open_v2(tls *libc.TLS, filename uintptr, ppDb uintptr, flags int32, zVfs uintptr) int32 { /* sqlite3.c:168511:16: */ + return openDatabase(tls, filename, ppDb, uint32(flags), zVfs) +} + +// Open a new database handle. +func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* sqlite3.c:168524:16: */ + var zFilename8 uintptr // zFilename encoded in UTF-8 instead of UTF-16 + var pVal uintptr + var rc int32 + + *(*uintptr)(unsafe.Pointer(ppDb)) = uintptr(0) + rc = Xsqlite3_initialize(tls) + if rc != 0 { + return rc + } + if zFilename == uintptr(0) { + zFilename = ts + 22630 /* "\x00\x00" */ + } + pVal = Xsqlite3ValueNew(tls, uintptr(0)) + Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) + zFilename8 = Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF8)) + if zFilename8 != 0 { + rc = openDatabase(tls, zFilename8, ppDb, + (uint32(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)), uintptr(0)) + + if (rc == SQLITE_OK) && !((int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(ppDb))))).FaDb)).FpSchema)).FschemaFlags) & (DB_SchemaLoaded)) == (DB_SchemaLoaded)) { + ((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(ppDb))))).FaDb)).FpSchema)).Fenc) = libc.AssignPtrUint8(*(*uintptr)(unsafe.Pointer(ppDb))+96 /* &.enc */, U8(SQLITE_UTF16LE)) + } + } else { + rc = SQLITE_NOMEM + } + Xsqlite3ValueFree(tls, pVal) + + return (rc & 0xff) +} + +// Register a new collation sequence with the database handle db. +func Xsqlite3_create_collation(tls *libc.TLS, db uintptr, zName uintptr, enc int32, pCtx uintptr, xCompare uintptr) int32 { /* sqlite3.c:168563:16: */ + return Xsqlite3_create_collation_v2(tls, db, zName, enc, pCtx, xCompare, uintptr(0)) +} + +// Register a new collation sequence with the database handle db. +func Xsqlite3_create_collation_v2(tls *libc.TLS, db uintptr, zName uintptr, enc int32, pCtx uintptr, xCompare uintptr, xDel uintptr) int32 { /* sqlite3.c:168576:16: */ + var rc int32 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + rc = createCollation(tls, db, zName, U8(enc), pCtx, xCompare, xDel) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Register a new collation sequence with the database handle db. +func Xsqlite3_create_collation16(tls *libc.TLS, db uintptr, zName uintptr, enc int32, pCtx uintptr, xCompare uintptr) int32 { /* sqlite3.c:168601:16: */ + var rc int32 = SQLITE_OK + var zName8 uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + zName8 = Xsqlite3Utf16to8(tls, db, zName, -1, uint8(SQLITE_UTF16LE)) + if zName8 != 0 { + rc = createCollation(tls, db, zName8, U8(enc), pCtx, xCompare, uintptr(0)) + Xsqlite3DbFree(tls, db, zName8) + } + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Register a collation sequence factory callback with the database handle +// db. Replace any previously installed collation sequence factory. +func Xsqlite3_collation_needed(tls *libc.TLS, db uintptr, pCollNeededArg uintptr, xCollNeeded uintptr) int32 { /* sqlite3.c:168631:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FxCollNeeded = xCollNeeded + (*Sqlite3)(unsafe.Pointer(db)).FxCollNeeded16 = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FpCollNeededArg = pCollNeededArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// Register a collation sequence factory callback with the database handle +// db. Replace any previously installed collation sequence factory. +func Xsqlite3_collation_needed16(tls *libc.TLS, db uintptr, pCollNeededArg uintptr, xCollNeeded16 uintptr) int32 { /* sqlite3.c:168652:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FxCollNeeded = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FxCollNeeded16 = xCollNeeded16 + (*Sqlite3)(unsafe.Pointer(db)).FpCollNeededArg = pCollNeededArg + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// This function is now an anachronism. It used to be used to recover from a +// malloc() failure, but SQLite now does this automatically. +func Xsqlite3_global_recover(tls *libc.TLS) int32 { /* sqlite3.c:168674:16: */ + return SQLITE_OK +} + +// Test to see whether or not the database connection is in autocommit +// mode. Return TRUE if it is and FALSE if not. Autocommit mode is on +// by default. Autocommit is disabled by a BEGIN statement and reenabled +// by the next COMMIT or ROLLBACK. +func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:168685:16: */ + return int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) +} + +// The following routines are substitutes for constants SQLITE_CORRUPT, +// SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_NOMEM and possibly other error +// constants. They serve two purposes: +// +// 1. Serve as a convenient place to set a breakpoint in a debugger +// to detect when version error conditions occurs. +// +// 2. Invoke sqlite3_log() to provide the source code location where +// a low-level error is first detected. +func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) int32 { /* sqlite3.c:168706:20: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + Xsqlite3_log(tls, iErr, ts+22633, /* "%s at line %d of..." */ + libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) + return iErr +} + +func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ + + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22658 /* "database corrupt..." */) +} + +func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ + + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22678 /* "misuse" */) +} + +func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ + + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22685 /* "cannot open file" */) +} + +// This is a convenience routine that makes sure that all thread-specific +// data for this thread has been deallocated. +// +// SQLite no longer uses thread-specific data so this routine is now a +// no-op. It is retained for historical compatibility. +func Xsqlite3_thread_cleanup(tls *libc.TLS) { /* sqlite3.c:168750:17: */ +} + +// Return meta information about a specific column of a database table. +// See comment in sqlite3.h (sqlite.h.in) for details. +func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zTableName uintptr, zColumnName uintptr, pzDataType uintptr, pzCollSeq uintptr, pNotNull uintptr, pPrimaryKey uintptr, pAutoinc uintptr) int32 { /* sqlite3.c:168758:16: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var rc int32 + // var zErrMsg uintptr at bp+24, 8 + + var pTab uintptr + var pCol uintptr + var iCol int32 + var zDataType uintptr + var zCollSeq uintptr + var notnull int32 + var primarykey int32 + var autoinc int32 + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = uintptr(0) + pTab = uintptr(0) + pCol = uintptr(0) + iCol = 0 + zDataType = uintptr(0) + zCollSeq = uintptr(0) + notnull = 0 + primarykey = 0 + autoinc = 0 + + // Ensure the database schema has been loaded + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + Xsqlite3BtreeEnterAll(tls, db) + rc = Xsqlite3Init(tls, db, bp+24 /* &zErrMsg */) + if !(SQLITE_OK != rc) { + goto __1 + } + goto error_out +__1: + ; + + // Locate the table in question + pTab = Xsqlite3FindTable(tls, db, zTableName, zDbName) + if !(!(pTab != 0) || ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { + goto __2 + } + pTab = uintptr(0) + goto error_out +__2: + ; + + // Find the column for which info is requested + if !(zColumnName == uintptr(0)) { + goto __3 + } + // Query for existance of table only + goto __4 +__3: + iCol = 0 +__5: + if !(iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __7 + } + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32) + if !(0 == Xsqlite3StrICmp(tls, (*Column)(unsafe.Pointer(pCol)).FzName, zColumnName)) { + goto __8 + } + goto __7 +__8: + ; + goto __6 +__6: + iCol++ + goto __5 + goto __7 +__7: + ; + if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { + goto __9 + } + if !((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && (Xsqlite3IsRowid(tls, zColumnName) != 0)) { + goto __10 + } + iCol = int32((*Table)(unsafe.Pointer(pTab)).FiPKey) + if iCol >= 0 { + pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32) + } else { + pCol = uintptr(0) + } + goto __11 +__10: + pTab = uintptr(0) + goto error_out +__11: + ; +__9: + ; +__4: + ; + + // The following block stores the meta information that will be returned + // to the caller in local variables zDataType, zCollSeq, notnull, primarykey + // and autoinc. At this point there are two possibilities: + // + // 1. The specified column name was rowid", "oid" or "_rowid_" + // and there is no explicitly declared IPK column. + // + // 2. The table is not a view and the column name identified an + // explicitly declared column. Copy meta information from *pCol. + if !(pCol != 0) { + goto __12 + } + zDataType = Xsqlite3ColumnType(tls, pCol, uintptr(0)) + zCollSeq = (*Column)(unsafe.Pointer(pCol)).FzColl + notnull = (libc.Bool32(int32((*Column)(unsafe.Pointer(pCol)).FnotNull) != 0)) + primarykey = (libc.Bool32((int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0)) + autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) + goto __13 +__12: + zDataType = ts + 11385 /* "INTEGER" */ + primarykey = 1 +__13: + ; + if !(!(zCollSeq != 0)) { + goto __14 + } + zCollSeq = uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) +__14: + ; + +error_out: + Xsqlite3BtreeLeaveAll(tls, db) + + // Whether the function call succeeded or failed, set the output parameters + // to whatever their local counterparts contain. If an error did occur, + // this has the effect of zeroing all output parameters. + if !(pzDataType != 0) { + goto __15 + } + *(*uintptr)(unsafe.Pointer(pzDataType)) = zDataType +__15: + ; + if !(pzCollSeq != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzCollSeq)) = zCollSeq +__16: + ; + if !(pNotNull != 0) { + goto __17 + } + *(*int32)(unsafe.Pointer(pNotNull)) = notnull +__17: + ; + if !(pPrimaryKey != 0) { + goto __18 + } + *(*int32)(unsafe.Pointer(pPrimaryKey)) = primarykey +__18: + ; + if !(pAutoinc != 0) { + goto __19 + } + *(*int32)(unsafe.Pointer(pAutoinc)) = autoinc +__19: + ; + + if !((SQLITE_OK == rc) && !(pTab != 0)) { + goto __20 + } + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22702 /* "no such table co..." */, libc.VaList(bp, zTableName, + zColumnName)) + rc = SQLITE_ERROR +__20: + ; + Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { + return ts + 2791 /* "%s" */ + } + return uintptr(0) + }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) + rc = Xsqlite3ApiExit(tls, db, rc) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Sleep for a little while. Return the amount of time slept. +func Xsqlite3_sleep(tls *libc.TLS, ms int32) int32 { /* sqlite3.c:168876:16: */ + var pVfs uintptr + var rc int32 + pVfs = Xsqlite3_vfs_find(tls, uintptr(0)) + if pVfs == uintptr(0) { + return 0 + } + + // This function works in milliseconds, but the underlying OsSleep() + // API uses microseconds. Hence the 1000's. + rc = (Xsqlite3OsSleep(tls, pVfs, (1000*ms)) / 1000) + return rc +} + +// Enable or disable the extended result codes. +func Xsqlite3_extended_result_codes(tls *libc.TLS, db uintptr, onoff int32) int32 { /* sqlite3.c:168892:16: */ + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).FerrMask = func() int32 { + if onoff != 0 { + return libc.Int32FromUint32(0xffffffff) + } + return 0xff + }() + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return SQLITE_OK +} + +// Invoke the xFileControl method on a particular database. +func Xsqlite3_file_control(tls *libc.TLS, db uintptr, zDbName uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:168905:16: */ + var rc int32 = SQLITE_ERROR + var pBtree uintptr + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + pBtree = Xsqlite3DbNameToBtree(tls, db, zDbName) + if pBtree != 0 { + var pPager uintptr + var fd uintptr + Xsqlite3BtreeEnter(tls, pBtree) + pPager = Xsqlite3BtreePager(tls, pBtree) + + fd = Xsqlite3PagerFile(tls, pPager) + + if op == SQLITE_FCNTL_FILE_POINTER { + *(*uintptr)(unsafe.Pointer(pArg)) = fd + rc = SQLITE_OK + } else if op == SQLITE_FCNTL_VFS_POINTER { + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3PagerVfs(tls, pPager) + rc = SQLITE_OK + } else if op == SQLITE_FCNTL_JOURNAL_POINTER { + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3PagerJrnlFile(tls, pPager) + rc = SQLITE_OK + } else if op == SQLITE_FCNTL_DATA_VERSION { + *(*uint32)(unsafe.Pointer(pArg)) = Xsqlite3PagerDataVersion(tls, pPager) + rc = SQLITE_OK + } else if op == SQLITE_FCNTL_RESERVE_BYTES { + var iNew int32 = *(*int32)(unsafe.Pointer(pArg)) + *(*int32)(unsafe.Pointer(pArg)) = Xsqlite3BtreeGetRequestedReserve(tls, pBtree) + if (iNew >= 0) && (iNew <= 255) { + Xsqlite3BtreeSetPageSize(tls, pBtree, 0, iNew, 0) + } + rc = SQLITE_OK + } else { + var nSave int32 = (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy + rc = Xsqlite3OsFileControl(tls, fd, op, pArg) + (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = nSave + } + Xsqlite3BtreeLeave(tls, pBtree) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Interface to the testing logic. +func Xsqlite3_test_control(tls *libc.TLS, op int32, va uintptr) int32 { /* sqlite3.c:168955:16: */ + var rc int32 = 0 + var ap Va_list + _ = ap + ap = va + switch op { + + // Save the current state of the PRNG. + case SQLITE_TESTCTRL_PRNG_SAVE: + { + Xsqlite3PrngSaveState(tls) + break + + } + + // Restore the state of the PRNG to the last state saved using + // PRNG_SAVE. If PRNG_SAVE has never before been called, then + // this verb acts like PRNG_RESET. + case SQLITE_TESTCTRL_PRNG_RESTORE: + { + Xsqlite3PrngRestoreState(tls) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_PRNG_SEED, int x, sqlite3 *db); + // + // Control the seed for the pseudo-random number generator (PRNG) that + // is built into SQLite. Cases: + // + // x!=0 && db!=0 Seed the PRNG to the current value of the + // schema cookie in the main database for db, or + // x if the schema cookie is zero. This case + // is convenient to use with database fuzzers + // as it allows the fuzzer some control over the + // the PRNG seed. + // + // x!=0 && db==0 Seed the PRNG to the value of x. + // + // x==0 && db==0 Revert to default behavior of using the + // xRandomness method on the primary VFS. + // + // This test-control also resets the PRNG so that the new seed will + // be used for the next call to sqlite3_randomness(). + case SQLITE_TESTCTRL_PRNG_SEED: + { + var x int32 = int32(libc.VaInt32(&ap)) + var y int32 + var db uintptr = libc.VaUintptr(&ap) + + if (db != 0) && ((libc.AssignInt32(&y, (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema)).Fschema_cookie)) != 0) { + x = y + } + Xsqlite3Config.FiPrngSeed = uint32(x) + Xsqlite3_randomness(tls, 0, uintptr(0)) + break + + } + + // sqlite3_test_control(BITVEC_TEST, size, program) + // + // Run a test against a Bitvec object of size. The program argument + // is an array of integers that defines the test. Return -1 on a + // memory allocation error, 0 on success, or non-zero for an error. + // See the sqlite3BitvecBuiltinTest() for additional information. + case SQLITE_TESTCTRL_BITVEC_TEST: + { + var sz int32 = int32(libc.VaInt32(&ap)) + var aProg uintptr = libc.VaUintptr(&ap) + rc = Xsqlite3BitvecBuiltinTest(tls, sz, aProg) + break + + } + + // sqlite3_test_control(FAULT_INSTALL, xCallback) + // + // Arrange to invoke xCallback() whenever sqlite3FaultSim() is called, + // if xCallback is not NULL. + // + // As a test of the fault simulator mechanism itself, sqlite3FaultSim(0) + // is called immediately after installing the new callback and the return + // value from sqlite3FaultSim(0) becomes the return from + // sqlite3_test_control(). + case SQLITE_TESTCTRL_FAULT_INSTALL: + { + Xsqlite3Config.FxTestCallback = libc.VaUintptr(&ap) + rc = Xsqlite3FaultSim(tls, 0) + break + + } + + // sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd) + // + // Register hooks to call to indicate which malloc() failures + // are benign. + case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: + { + var xBenignBegin uintptr + var xBenignEnd uintptr + xBenignBegin = libc.VaUintptr(&ap) + xBenignEnd = libc.VaUintptr(&ap) + Xsqlite3BenignMallocHooks(tls, xBenignBegin, xBenignEnd) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X) + // + // Set the PENDING byte to the value in the argument, if X>0. + // Make no changes if X==0. Return the value of the pending byte + // as it existing before this routine was called. + // + // IMPORTANT: Changing the PENDING byte from 0x40000000 results in + // an incompatible database file format. Changing the PENDING byte + // while any database connection is open results in undefined and + // deleterious behavior. + case SQLITE_TESTCTRL_PENDING_BYTE: + { + rc = Xsqlite3PendingByte + { + var newVal uint32 = uint32(libc.VaUint32(&ap)) + if newVal != 0 { + Xsqlite3PendingByte = int32(newVal) + } + + } + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X) + // + // This action provides a run-time test to see whether or not + // assert() was enabled at compile-time. If X is true and assert() + // is enabled, then the return value is true. If X is true and + // assert() is disabled, then the return value is zero. If X is + // false and assert() is enabled, then the assertion fires and the + // process aborts. If X is false and assert() is disabled, then the + // return value is zero. + case SQLITE_TESTCTRL_ASSERT: + { + var x int32 = 0 + + rc = libc.AtomicLoadInt32(&x) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X) + // + // This action provides a run-time test to see how the ALWAYS and + // NEVER macros were defined at compile-time. + // + // The return value is ALWAYS(X) if X is true, or 0 if X is false. + // + // The recommended test is X==2. If the return value is 2, that means + // ALWAYS() and NEVER() are both no-op pass-through macros, which is the + // default setting. If the return value is 1, then ALWAYS() is either + // hard-coded to true or else it asserts if its argument is false. + // The first behavior (hard-coded to true) is the case if + // SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second + // behavior (assert if the argument to ALWAYS() is false) is the case if + // SQLITE_TESTCTRL_ASSERT shows that assert() is enabled. + // + // The run-time test procedure might look something like this: + // + // if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){ + // // ALWAYS() and NEVER() are no-op pass-through macros + // }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){ + // // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false. + // }else{ + // // ALWAYS(x) is a constant 1. NEVER(x) is a constant 0. + // } + case SQLITE_TESTCTRL_ALWAYS: + { + var x int32 = int32(libc.VaInt32(&ap)) + if x != 0 { + rc = x + } else { + rc = 0 + } + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_BYTEORDER); + // + // The integer returned reveals the byte-order of the computer on which + // SQLite is running: + // + // 1 big-endian, determined at run-time + // 10 little-endian, determined at run-time + // 432101 big-endian, determined at compile-time + // 123410 little-endian, determined at compile-time + case SQLITE_TESTCTRL_BYTEORDER: + { + rc = (((SQLITE_BYTEORDER * 100) + (SQLITE_LITTLEENDIAN * 10)) + SQLITE_BIGENDIAN) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N) + // + // Enable or disable various optimizations for testing purposes. The + // argument N is a bitmask of optimizations to be disabled. For normal + // operation N should be 0. The idea is that a test program (like the + // SQL Logic Test or SLT test module) can run the same SQL multiple times + // with various optimizations disabled to verify that the same answer + // is obtained in every case. + case SQLITE_TESTCTRL_OPTIMIZATIONS: + { + var db uintptr = libc.VaUintptr(&ap) + (*Sqlite3)(unsafe.Pointer(db)).FdbOptFlags = U32(libc.VaUint32(&ap)) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff); + // + // If parameter onoff is non-zero, subsequent calls to localtime() + // and its variants fail. If onoff is zero, undo this setting. + case SQLITE_TESTCTRL_LOCALTIME_FAULT: + { + Xsqlite3Config.FbLocaltimeFault = int32(libc.VaInt32(&ap)) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, sqlite3*); + // + // Toggle the ability to use internal functions on or off for + // the database connection given in the argument. + case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS: + { + var db uintptr = libc.VaUintptr(&ap) + *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) ^= (U32(DBFLAG_InternalFunc)) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int); + // + // Set or clear a flag that indicates that the database file is always well- + // formed and never corrupt. This flag is clear by default, indicating that + // database files might have arbitrary corruption. Setting the flag during + // testing causes certain assert() statements in the code to be activated + // that demonstrat invariants on well-formed database files. + case SQLITE_TESTCTRL_NEVER_CORRUPT: + { + Xsqlite3Config.FneverCorrupt = int32(libc.VaInt32(&ap)) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, int); + // + // Set or clear a flag that causes SQLite to verify that type, name, + // and tbl_name fields of the sqlite_schema table. This is normally + // on, but it is sometimes useful to turn it off for testing. + // + // 2020-07-22: Disabling EXTRA_SCHEMA_CHECKS also disables the + // verification of rootpage numbers when parsing the schema. This + // is useful to make it easier to reach strange internal error states + // during testing. The EXTRA_SCHEMA_CHECKS setting is always enabled + // in production. + case SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS: + { + Xsqlite3Config.FbExtraSchemaChecks = U8(libc.VaInt32(&ap)) + break + + } + + // Set the threshold at which OP_Once counters reset back to zero. + // By default this is 0x7ffffffe (over 2 billion), but that value is + // too big to test in a reasonable amount of time, so this control is + // provided to set a small and easily reachable reset value. + case SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD: + { + Xsqlite3Config.FiOnceResetThreshold = int32(libc.VaInt32(&ap)) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr); + // + // Set the VDBE coverage callback function to xCallback with context + // pointer ptr. + case SQLITE_TESTCTRL_VDBE_COVERAGE: + { + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_SORTER_MMAP, db, nMax); + case SQLITE_TESTCTRL_SORTER_MMAP: + { + var db uintptr = libc.VaUintptr(&ap) + (*Sqlite3)(unsafe.Pointer(db)).FnMaxSorterMmap = int32(libc.VaInt32(&ap)) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_ISINIT); + // + // Return SQLITE_OK if SQLite has been initialized and SQLITE_ERROR if + // not. + case SQLITE_TESTCTRL_ISINIT: + { + if Xsqlite3Config.FisInit == 0 { + rc = SQLITE_ERROR + } + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum); + // + // This test control is used to create imposter tables. "db" is a pointer + // to the database connection. dbName is the database name (ex: "main" or + // "temp") which will receive the imposter. "onOff" turns imposter mode on + // or off. "tnum" is the root page of the b-tree to which the imposter + // table should connect. + // + // Enable imposter mode only when the schema has already been parsed. Then + // run a single CREATE TABLE statement to construct the imposter table in + // the parsed schema. Then turn imposter mode back off again. + // + // If onOff==0 and tnum>0 then reset the schema for all databases, causing + // the schema to be reparsed the next time it is needed. This has the + // effect of erasing all imposter tables. + case SQLITE_TESTCTRL_IMPOSTER: + { + var db uintptr = libc.VaUintptr(&ap) + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(Xsqlite3FindDbName(tls, db, libc.VaUintptr(&ap))) + (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy = U8(libc.AssignBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.imposterTable */, uint32(libc.VaInt32(&ap)), 1, 1, 0x2)) + (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum = Pgno(libc.VaInt32(&ap)) + if (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) && ((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > Pgno(0)) { + Xsqlite3ResetAllSchemasOfConnection(tls, db) + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_RESULT_INTREAL, sqlite3_context*); + // + // This test-control causes the most recent sqlite3_result_int64() value + // to be interpreted as a MEM_IntReal instead of as an MEM_Int. Normally, + // MEM_IntReal values only arise during an INSERT operation of integer + // values into a REAL column, so they can be challenging to test. This + // test-control enables us to write an intreal() SQL function that can + // inject an intreal() value at arbitrary places in an SQL statement, + // for testing purposes. + case SQLITE_TESTCTRL_RESULT_INTREAL: + { + var pCtx uintptr = libc.VaUintptr(&ap) + Xsqlite3ResultIntReal(tls, pCtx) + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_SEEK_COUNT, + // sqlite3 *db, // Database connection + // u64 *pnSeek // Write seek count here + // ); + // + // This test-control queries the seek-counter on the "main" database + // file. The seek-counter is written into *pnSeek and is then reset. + // The seek-count is only available if compiled with SQLITE_DEBUG. + case SQLITE_TESTCTRL_SEEK_COUNT: + { + var db uintptr = libc.VaUintptr(&ap) + _ = db + var pn uintptr = libc.VaUintptr(&ap) + *(*U64)(unsafe.Pointer(pn)) = uint64(0) + _ = db // Silence harmless unused variable warning + break + + } + + // sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr) + // + // "ptr" is a pointer to a u32. + // + // op==0 Store the current sqlite3SelectTrace in *ptr + // op==1 Set sqlite3SelectTrace to the value *ptr + // op==3 Store the current sqlite3WhereTrace in *ptr + // op==3 Set sqlite3WhereTrace to the value *ptr + case SQLITE_TESTCTRL_TRACEFLAGS: + { + var opTrace int32 = int32(libc.VaInt32(&ap)) + var ptr uintptr = libc.VaUintptr(&ap) + switch opTrace { + case 0: + *(*U32)(unsafe.Pointer(ptr)) = Xsqlite3SelectTrace + break + case 1: + Xsqlite3SelectTrace = *(*U32)(unsafe.Pointer(ptr)) + break + case 2: + *(*U32)(unsafe.Pointer(ptr)) = Xsqlite3WhereTrace + break + case 3: + Xsqlite3WhereTrace = *(*U32)(unsafe.Pointer(ptr)) + break + } + break + + } + + } + _ = ap + return rc +} + +// The Pager stores the Database filename, Journal filename, and WAL filename +// consecutively in memory, in that order. The database filename is prefixed +// by four zero bytes. Locate the start of the database filename by searching +// backwards for the first byte following four consecutive zero bytes. +// +// This only works if the filename passed in was obtained from the Pager. +func databaseName(tls *libc.TLS, zName uintptr) uintptr { /* sqlite3.c:169409:19: */ + for (((int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-1)))) != 0) || (int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-2)))) != 0)) || (int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-3)))) != 0)) || (int32(*(*int8)(unsafe.Pointer(zName + libc.UintptrFromInt32(-4)))) != 0) { + zName-- + } + return zName +} + +// Append text z[] to the end of p[]. Return a pointer to the first +// character after then zero terminator on the new text in p[]. +func appendText(tls *libc.TLS, p uintptr, z uintptr) uintptr { /* sqlite3.c:169420:13: */ + var n Size_t = libc.Xstrlen(tls, z) + libc.Xmemcpy(tls, p, z, (n + uint64(1))) + return ((p + uintptr(n)) + uintptr(1)) +} + +// Allocate memory to hold names for a database, journal file, WAL file, +// and query parameters. The pointer returned is valid for use by +// sqlite3_filename_database() and sqlite3_uri_parameter() and related +// functions. +// +// Memory layout must be compatible with that generated by the pager +// and expected by sqlite3_uri_parameter() and databaseName(). +func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr, zWal uintptr, nParam int32, azParam uintptr) uintptr { /* sqlite3.c:169435:17: */ + var nByte Sqlite3_int64 + var i int32 + var pResult uintptr + var p uintptr + nByte = (Sqlite3_int64(((libc.Xstrlen(tls, zDatabase) + libc.Xstrlen(tls, zJournal)) + libc.Xstrlen(tls, zWal)) + uint64(10))) + for i = 0; i < (nParam * 2); i++ { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + uint64(1)))) + } + pResult = libc.AssignUintptr(&p, Xsqlite3_malloc64(tls, uint64(nByte))) + if p == uintptr(0) { + return uintptr(0) + } + libc.Xmemset(tls, p, 0, uint64(4)) + p += uintptr(4) + p = appendText(tls, p, zDatabase) + for i = 0; i < (nParam * 2); i++ { + p = appendText(tls, p, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1))) = int8(0) + p = appendText(tls, p, zJournal) + p = appendText(tls, p, zWal) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1))) = int8(0) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1))) = int8(0) + + return (pResult + uintptr(4)) +} + +// Free memory obtained from sqlite3_create_filename(). It is a severe +// error to call this routine with any parameter other than a pointer +// previously obtained from sqlite3_create_filename() or a NULL pointer. +func Xsqlite3_free_filename(tls *libc.TLS, p uintptr) { /* sqlite3.c:169471:17: */ + if p == uintptr(0) { + return + } + p = databaseName(tls, p) + Xsqlite3_free(tls, (p - uintptr(4))) +} + +// This is a utility routine, useful to VFS implementations, that checks +// to see if a database file was a URI that contained a specific query +// parameter, and if so obtains the value of the query parameter. +// +// The zFilename argument is the filename pointer passed into the xOpen() +// method of a VFS implementation. The zParam argument is the name of the +// query parameter we seek. This routine returns the value of the zParam +// parameter if it exists. If the parameter does not exist, this routine +// returns a NULL pointer. +func Xsqlite3_uri_parameter(tls *libc.TLS, zFilename uintptr, zParam uintptr) uintptr { /* sqlite3.c:169489:23: */ + if (zFilename == uintptr(0)) || (zParam == uintptr(0)) { + return uintptr(0) + } + zFilename = databaseName(tls, zFilename) + return uriParameter(tls, zFilename, zParam) +} + +// Return a pointer to the name of Nth query parameter of the filename. +func Xsqlite3_uri_key(tls *libc.TLS, zFilename uintptr, N int32) uintptr { /* sqlite3.c:169498:23: */ + if (zFilename == uintptr(0)) || (N < 0) { + return uintptr(0) + } + zFilename = databaseName(tls, zFilename) + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + for (*(*int8)(unsafe.Pointer(zFilename)) != 0) && ((libc.PostDecInt32(&N, 1)) > 0) { + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + } + if *(*int8)(unsafe.Pointer(zFilename)) != 0 { + return zFilename + } + return uintptr(0) +} + +// Return a boolean value for a query parameter. +func Xsqlite3_uri_boolean(tls *libc.TLS, zFilename uintptr, zParam uintptr, bDflt int32) int32 { /* sqlite3.c:169512:16: */ + var z uintptr = Xsqlite3_uri_parameter(tls, zFilename, zParam) + bDflt = (libc.Bool32(bDflt != 0)) + if z != 0 { + return int32(Xsqlite3GetBoolean(tls, z, uint8(bDflt))) + } + return bDflt +} + +// Return a 64-bit integer value for a query parameter. +func Xsqlite3_uri_int64(tls *libc.TLS, zFilename uintptr, zParam uintptr, bDflt Sqlite3_int64) Sqlite3_int64 { /* sqlite3.c:169521:26: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var z uintptr = Xsqlite3_uri_parameter(tls, zFilename, zParam) + // var v Sqlite3_int64 at bp, 8 + + if (z != 0) && (Xsqlite3DecOrHexToI64(tls, z, bp /* &v */) == 0) { + bDflt = *(*Sqlite3_int64)(unsafe.Pointer(bp /* v */)) + } + return bDflt +} + +// Translate a filename that was handed to a VFS routine into the corresponding +// database, journal, or WAL file. +// +// It is an error to pass this routine a filename string that was not +// passed into the VFS from the SQLite core. Doing so is similar to +// passing free() a pointer that was not obtained from malloc() - it is +// an error that we cannot easily detect but that will likely cause memory +// corruption. +func Xsqlite3_filename_database(tls *libc.TLS, zFilename uintptr) uintptr { /* sqlite3.c:169544:23: */ + return databaseName(tls, zFilename) +} + +func Xsqlite3_filename_journal(tls *libc.TLS, zFilename uintptr) uintptr { /* sqlite3.c:169547:23: */ + zFilename = databaseName(tls, zFilename) + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + for *(*int8)(unsafe.Pointer(zFilename)) != 0 { + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + } + return (zFilename + uintptr(1)) +} + +func Xsqlite3_filename_wal(tls *libc.TLS, zFilename uintptr) uintptr { /* sqlite3.c:169556:23: */ + zFilename = Xsqlite3_filename_journal(tls, zFilename) + zFilename += (uintptr(Xsqlite3Strlen30(tls, zFilename) + 1)) + return zFilename +} + +// Return the Btree pointer identified by zDbName. Return NULL if not found. +func Xsqlite3DbNameToBtree(tls *libc.TLS, db uintptr, zDbName uintptr) uintptr { /* sqlite3.c:169569:22: */ + var iDb int32 + if zDbName != 0 { + iDb = Xsqlite3FindDbName(tls, db, zDbName) + } else { + iDb = 0 + } + if iDb < 0 { + return uintptr(0) + } + return (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt +} + +// Return the filename of the database associated with a database +// connection. +func Xsqlite3_db_filename(tls *libc.TLS, db uintptr, zDbName uintptr) uintptr { /* sqlite3.c:169578:23: */ + var pBt uintptr + pBt = Xsqlite3DbNameToBtree(tls, db, zDbName) + if pBt != 0 { + return Xsqlite3BtreeGetFilename(tls, pBt) + } + return uintptr(0) +} + +// Return 1 if database is read-only or 0 if read/write. Return -1 if +// no such database exists. +func Xsqlite3_db_readonly(tls *libc.TLS, db uintptr, zDbName uintptr) int32 { /* sqlite3.c:169594:16: */ + var pBt uintptr + pBt = Xsqlite3DbNameToBtree(tls, db, zDbName) + if pBt != 0 { + return Xsqlite3BtreeIsReadonly(tls, pBt) + } + return -1 +} + +// Obtain a snapshot handle for the snapshot of database zDb currently +// being read by handle db. +func Xsqlite3_snapshot_get(tls *libc.TLS, db uintptr, zDb uintptr, ppSnapshot uintptr) int32 { /* sqlite3.c:169611:16: */ + var rc int32 = SQLITE_ERROR + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + + if int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 { + var iDb int32 = Xsqlite3FindDbName(tls, db, zDb) + if (iDb == 0) || (iDb > 1) { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + if SQLITE_TXN_WRITE != Xsqlite3BtreeTxnState(tls, pBt) { + rc = Xsqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + if rc == SQLITE_OK { + rc = Xsqlite3PagerSnapshotGet(tls, Xsqlite3BtreePager(tls, pBt), ppSnapshot) + } + } + } + } + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Open a read-transaction on the snapshot idendified by pSnapshot. +func Xsqlite3_snapshot_open(tls *libc.TLS, db uintptr, zDb uintptr, pSnapshot uintptr) int32 { /* sqlite3.c:169647:16: */ + var rc int32 = SQLITE_ERROR + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + if int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) == 0 { + var iDb int32 + iDb = Xsqlite3FindDbName(tls, db, zDb) + if (iDb == 0) || (iDb > 1) { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + if Xsqlite3BtreeTxnState(tls, pBt) != SQLITE_TXN_WRITE { + var pPager uintptr = Xsqlite3BtreePager(tls, pBt) + var bUnlock int32 = 0 + if Xsqlite3BtreeTxnState(tls, pBt) != SQLITE_TXN_NONE { + if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive == 0 { + rc = Xsqlite3PagerSnapshotCheck(tls, pPager, pSnapshot) + if rc == SQLITE_OK { + bUnlock = 1 + rc = Xsqlite3BtreeCommit(tls, pBt) + } + } + } else { + rc = SQLITE_OK + } + if rc == SQLITE_OK { + rc = Xsqlite3PagerSnapshotOpen(tls, pPager, pSnapshot) + } + if rc == SQLITE_OK { + rc = Xsqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + Xsqlite3PagerSnapshotOpen(tls, pPager, uintptr(0)) + } + if bUnlock != 0 { + Xsqlite3PagerSnapshotUnlock(tls, pPager) + } + } + } + } + + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Recover as many snapshots as possible from the wal file associated with +// schema zDb of database db. +func Xsqlite3_snapshot_recover(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:169703:16: */ + var rc int32 = SQLITE_ERROR + var iDb int32 + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + iDb = Xsqlite3FindDbName(tls, db, zDb) + if (iDb == 0) || (iDb > 1) { + var pBt uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt + if SQLITE_TXN_NONE == Xsqlite3BtreeTxnState(tls, pBt) { + rc = Xsqlite3BtreeBeginTrans(tls, pBt, 0, uintptr(0)) + if rc == SQLITE_OK { + rc = Xsqlite3PagerSnapshotRecover(tls, Xsqlite3BtreePager(tls, pBt)) + Xsqlite3BtreeCommit(tls, pBt) + } + } + } + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// Free a snapshot handle obtained from sqlite3_snapshot_get(). +func Xsqlite3_snapshot_free(tls *libc.TLS, pSnapshot uintptr) { /* sqlite3.c:169734:17: */ + Xsqlite3_free(tls, pSnapshot) +} + +// Given the name of a compile-time option, return true if that option +// was used and false if not. +// +// The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix +// is not required for a match. +func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sqlite3.c:169747:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 + var n int32 + // var nOpt int32 at bp, 4 + + var azCompileOpt uintptr + + azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) + + if Xsqlite3_strnicmp(tls, zOptName, ts+22730 /* "SQLITE_" */, 7) == 0 { + zOptName += uintptr(7) + } + n = Xsqlite3Strlen30(tls, zOptName) + + // Since nOpt is normally in single digits, a linear search is + // adequate. No need for a binary search. + for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nOpt */)); i++ { + if (Xsqlite3_strnicmp(tls, zOptName, *(*uintptr)(unsafe.Pointer(azCompileOpt + uintptr(i)*8)), n) == 0) && + (Xsqlite3IsIdChar(tls, uint8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(azCompileOpt + uintptr(i)*8)) + uintptr(n))))) == 0) { + return 1 + } + } + return 0 +} + +// Return the N-th compile-time option string. If N is out of range, +// return a NULL pointer. +func Xsqlite3_compileoption_get(tls *libc.TLS, N int32) uintptr { /* sqlite3.c:169780:23: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var nOpt int32 at bp, 4 + + var azCompileOpt uintptr + azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) + if (N >= 0) && (N < *(*int32)(unsafe.Pointer(bp /* nOpt */))) { + return *(*uintptr)(unsafe.Pointer(azCompileOpt + uintptr(N)*8)) + } + return uintptr(0) +} + +//************* End of main.c *********************************************** +//************* Begin file notify.c ***************************************** +// 2009 March 3 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains the implementation of the sqlite3_unlock_notify() +// API method and its associated functionality. +// #include "sqliteInt.h" +// #include "btreeInt.h" + +// Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. + +// Public interfaces: +// +// sqlite3ConnectionBlocked() +// sqlite3ConnectionUnlocked() +// sqlite3ConnectionClosed() +// sqlite3_unlock_notify() + +// Head of a linked list of all sqlite3 objects created by this process +// for which either sqlite3.pBlockingConnection or sqlite3.pUnlockConnection +// is not NULL. This variable may only accessed while the STATIC_MAIN +// mutex is held. +var sqlite3BlockedList uintptr = uintptr(0) /* sqlite3.c:169832:16 */ + +// Remove connection db from the blocked connections list. If connection +// db is not currently a part of the list, this function is a no-op. +func removeFromBlockedList(tls *libc.TLS, db uintptr) { /* sqlite3.c:169875:13: */ + var pp uintptr + + for pp = uintptr(unsafe.Pointer(&sqlite3BlockedList)); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 800 /* &.pNextBlocked */) { + if *(*uintptr)(unsafe.Pointer(pp)) == db { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNextBlocked + break + } + } +} + +// Add connection db to the blocked connections list. It is assumed +// that it is not already a part of the list. +func addToBlockedList(tls *libc.TLS, db uintptr) { /* sqlite3.c:169890:13: */ + var pp uintptr + + for pp = uintptr(unsafe.Pointer(&sqlite3BlockedList)); (*(*uintptr)(unsafe.Pointer(pp)) != 0) && ((*Sqlite3)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).FxUnlockNotify != (*Sqlite3)(unsafe.Pointer(db)).FxUnlockNotify); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 800 /* &.pNextBlocked */) { + } + (*Sqlite3)(unsafe.Pointer(db)).FpNextBlocked = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = db +} + +// Obtain the STATIC_MAIN mutex. +func enterMutex(tls *libc.TLS) { /* sqlite3.c:169905:13: */ + Xsqlite3_mutex_enter(tls, Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN)) + +} + +// Release the STATIC_MAIN mutex. +func leaveMutex(tls *libc.TLS) { /* sqlite3.c:169913:13: */ + + Xsqlite3_mutex_leave(tls, Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN)) +} + +// Register an unlock-notify callback. +// +// This is called after connection "db" has attempted some operation +// but has received an SQLITE_LOCKED error because another connection +// (call it pOther) in the same process was busy using the same shared +// cache. pOther is found by looking at db->pBlockingConnection. +// +// If there is no blocking connection, the callback is invoked immediately, +// before this routine returns. +// +// If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate +// a deadlock. +// +// Otherwise, make arrangements to invoke xNotify when pOther drops +// its locks. +// +// Each call to this routine overrides any prior callbacks registered +// on the same "db". If xNotify==0 then any prior callbacks are immediately +// cancelled. +func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uintptr) int32 { /* sqlite3.c:169940:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*uintptr)(unsafe.Pointer(bp)) = pArg + + var rc int32 = SQLITE_OK + + Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + enterMutex(tls) + + if xNotify == uintptr(0) { + removeFromBlockedList(tls, db) + (*Sqlite3)(unsafe.Pointer(db)).FpBlockingConnection = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FpUnlockConnection = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FxUnlockNotify = uintptr(0) + (*Sqlite3)(unsafe.Pointer(db)).FpUnlockArg = uintptr(0) + } else if uintptr(0) == (*Sqlite3)(unsafe.Pointer(db)).FpBlockingConnection { + // The blocking transaction has been concluded. Or there never was a + // blocking transaction. In either case, invoke the notify callback + // immediately. + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&xNotify)))(tls, bp /* &pArg */, 1) + } else { + var p uintptr + + for p = (*Sqlite3)(unsafe.Pointer(db)).FpBlockingConnection; (p != 0) && (p != db); p = (*Sqlite3)(unsafe.Pointer(p)).FpUnlockConnection { + } + if p != 0 { + rc = SQLITE_LOCKED // Deadlock detected. + } else { + (*Sqlite3)(unsafe.Pointer(db)).FpUnlockConnection = (*Sqlite3)(unsafe.Pointer(db)).FpBlockingConnection + (*Sqlite3)(unsafe.Pointer(db)).FxUnlockNotify = xNotify + (*Sqlite3)(unsafe.Pointer(db)).FpUnlockArg = *(*uintptr)(unsafe.Pointer(bp /* pArg */)) + removeFromBlockedList(tls, db) + addToBlockedList(tls, db) + } + } + + leaveMutex(tls) + + Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { + if rc != 0 { + return ts + 22738 /* "database is dead..." */ + } + return uintptr(0) + }(), 0) + Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) + return rc +} + +// This function is called while stepping or preparing a statement +// associated with connection db. The operation will return SQLITE_LOCKED +// to the user because it requires a lock that will not be available +// until connection pBlocker concludes its current transaction. +func Xsqlite3ConnectionBlocked(tls *libc.TLS, db uintptr, pBlocker uintptr) { /* sqlite3.c:169990:21: */ + enterMutex(tls) + if ((*Sqlite3)(unsafe.Pointer(db)).FpBlockingConnection == uintptr(0)) && ((*Sqlite3)(unsafe.Pointer(db)).FpUnlockConnection == uintptr(0)) { + addToBlockedList(tls, db) + } + (*Sqlite3)(unsafe.Pointer(db)).FpBlockingConnection = pBlocker + leaveMutex(tls) +} + +// This function is called when +// the transaction opened by database db has just finished. Locks held +// by database connection db have been released. +// +// This function loops through each entry in the blocked connections +// list and does the following: +// +// 1) If the sqlite3.pBlockingConnection member of a list entry is +// set to db, then set pBlockingConnection=0. +// +// 2) If the sqlite3.pUnlockConnection member of a list entry is +// set to db, then invoke the configured unlock-notify callback and +// set pUnlockConnection=0. +// +// 3) If the two steps above mean that pBlockingConnection==0 and +// pUnlockConnection==0, remove the entry from the blocked connections +// list. +func Xsqlite3ConnectionUnlocked(tls *libc.TLS, db uintptr) { /* sqlite3.c:170018:21: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + var xUnlockNotify uintptr = uintptr(0) // Unlock-notify cb to invoke + var nArg int32 = 0 // Number of entries in aArg[] + var pp uintptr // Iterator variable + var aArg uintptr // Arguments to the unlock callback + var aDyn uintptr = uintptr(0) // Dynamically allocated space for aArg[] + // var aStatic [16]uintptr at bp, 128 + // Starter space for aArg[]. No malloc required + + aArg = bp /* &aStatic[0] */ + enterMutex(tls) // Enter STATIC_MAIN mutex + + // This loop runs once for each entry in the blocked-connections list. + for pp = uintptr(unsafe.Pointer(&sqlite3BlockedList)); *(*uintptr)(unsafe.Pointer(pp)) != 0; { + var p uintptr = *(*uintptr)(unsafe.Pointer(pp)) + + // Step 1. + if (*Sqlite3)(unsafe.Pointer(p)).FpBlockingConnection == db { + (*Sqlite3)(unsafe.Pointer(p)).FpBlockingConnection = uintptr(0) + } + + // Step 2. + if (*Sqlite3)(unsafe.Pointer(p)).FpUnlockConnection == db { + + if ((*Sqlite3)(unsafe.Pointer(p)).FxUnlockNotify != xUnlockNotify) && (nArg != 0) { + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&xUnlockNotify)))(tls, aArg, nArg) + nArg = 0 + } + + Xsqlite3BeginBenignMalloc(tls) + + if (!(aDyn != 0) && (nArg == (int32(uint64(unsafe.Sizeof([16]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))))) || + ((aDyn != 0) && (nArg == (int32(uint64(Xsqlite3MallocSize(tls, aDyn)) / uint64(unsafe.Sizeof(uintptr(0))))))) { + // The aArg[] array needs to grow. + var pNew uintptr = Xsqlite3Malloc(tls, (uint64((uint64(nArg) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)))) + if pNew != 0 { + libc.Xmemcpy(tls, pNew, aArg, (uint64(nArg) * uint64(unsafe.Sizeof(uintptr(0))))) + Xsqlite3_free(tls, aDyn) + aDyn = libc.AssignUintptr(&aArg, pNew) + } else { + // This occurs when the array of context pointers that need to + // be passed to the unlock-notify callback is larger than the + // aStatic[] array allocated on the stack and the attempt to + // allocate a larger array from the heap has failed. + // + // This is a difficult situation to handle. Returning an error + // code to the caller is insufficient, as even if an error code + // is returned the transaction on connection db will still be + // closed and the unlock-notify callbacks on blocked connections + // will go unissued. This might cause the application to wait + // indefinitely for an unlock-notify callback that will never + // arrive. + // + // Instead, invoke the unlock-notify callback with the context + // array already accumulated. We can then clear the array and + // begin accumulating any further context pointers without + // requiring any dynamic allocation. This is sub-optimal because + // it means that instead of one callback with a large array of + // context pointers the application will receive two or more + // callbacks with smaller arrays of context pointers, which will + // reduce the applications ability to prioritize multiple + // connections. But it is the best that can be done under the + // circumstances. + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&xUnlockNotify)))(tls, aArg, nArg) + nArg = 0 + } + } + Xsqlite3EndBenignMalloc(tls) + + *(*uintptr)(unsafe.Pointer(aArg + uintptr(libc.PostIncInt32(&nArg, 1))*8)) = (*Sqlite3)(unsafe.Pointer(p)).FpUnlockArg + xUnlockNotify = (*Sqlite3)(unsafe.Pointer(p)).FxUnlockNotify + (*Sqlite3)(unsafe.Pointer(p)).FpUnlockConnection = uintptr(0) + (*Sqlite3)(unsafe.Pointer(p)).FxUnlockNotify = uintptr(0) + (*Sqlite3)(unsafe.Pointer(p)).FpUnlockArg = uintptr(0) + } + + // Step 3. + if ((*Sqlite3)(unsafe.Pointer(p)).FpBlockingConnection == uintptr(0)) && ((*Sqlite3)(unsafe.Pointer(p)).FpUnlockConnection == uintptr(0)) { + // Remove connection p from the blocked connections list. + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3)(unsafe.Pointer(p)).FpNextBlocked + (*Sqlite3)(unsafe.Pointer(p)).FpNextBlocked = uintptr(0) + } else { + pp = (p + 800 /* &.pNextBlocked */) + } + } + + if nArg != 0 { + (*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(&xUnlockNotify)))(tls, aArg, nArg) + } + Xsqlite3_free(tls, aDyn) + leaveMutex(tls) // Leave STATIC_MAIN mutex +} + +// This is called when the database connection passed as an argument is +// being closed. The connection is removed from the blocked list. +func Xsqlite3ConnectionClosed(tls *libc.TLS, db uintptr) { /* sqlite3.c:170117:21: */ + Xsqlite3ConnectionUnlocked(tls, db) + enterMutex(tls) + removeFromBlockedList(tls, db) + + leaveMutex(tls) +} + +//************* End of notify.c ********************************************* +//************* Begin file fts3.c ******************************************* +// 2006 Oct 10 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is an SQLite module implementing full-text search. + +// The code in this file is only compiled if: +// +// * The FTS3 module is being built as an extension +// (in which case SQLITE_CORE is not defined), or +// +// * The FTS3 module is being built into the core of +// SQLite (in which case SQLITE_ENABLE_FTS3 is defined). + +// The full-text index is stored in a series of b+tree (-like) +// structures called segments which map terms to doclists. The +// structures are like b+trees in layout, but are constructed from the +// bottom up in optimal fashion and are not updatable. Since trees +// are built from the bottom up, things will be described from the +// bottom up. +// +// +// Varints **** +// The basic unit of encoding is a variable-length integer called a +// varint. We encode variable-length integers in little-endian order +// using seven bits * per byte as follows: +// +// KEY: +// A = 0xxxxxxx 7 bits of data and one flag bit +// B = 1xxxxxxx 7 bits of data and one flag bit +// +// 7 bits - A +// 14 bits - BA +// 21 bits - BBA +// and so on. +// +// This is similar in concept to how sqlite encodes "varints" but +// the encoding is not the same. SQLite varints are big-endian +// are are limited to 9 bytes in length whereas FTS3 varints are +// little-endian and can be up to 10 bytes in length (in theory). +// +// Example encodings: +// +// 1: 0x01 +// 127: 0x7f +// 128: 0x81 0x00 +// +// +// Document lists **** +// A doclist (document list) holds a docid-sorted list of hits for a +// given term. Doclists hold docids and associated token positions. +// A docid is the unique integer identifier for a single document. +// A position is the index of a word within the document. The first +// word of the document has a position of 0. +// +// FTS3 used to optionally store character offsets using a compile-time +// option. But that functionality is no longer supported. +// +// A doclist is stored like this: +// +// array { +// varint docid; (delta from previous doclist) +// array { (position list for column 0) +// varint position; (2 more than the delta from previous position) +// } +// array { +// varint POS_COLUMN; (marks start of position list for new column) +// varint column; (index of new column) +// array { +// varint position; (2 more than the delta from previous position) +// } +// } +// varint POS_END; (marks end of positions for this document. +// } +// +// Here, array { X } means zero or more occurrences of X, adjacent in +// memory. A "position" is an index of a token in the token stream +// generated by the tokenizer. Note that POS_END and POS_COLUMN occur +// in the same logical place as the position element, and act as sentinals +// ending a position list array. POS_END is 0. POS_COLUMN is 1. +// The positions numbers are not stored literally but rather as two more +// than the difference from the prior position, or the just the position plus +// 2 for the first position. Example: +// +// label: A B C D E F G H I J K +// value: 123 5 9 1 1 14 35 0 234 72 0 +// +// The 123 value is the first docid. For column zero in this document +// there are two matches at positions 3 and 10 (5-2 and 9-2+3). The 1 +// at D signals the start of a new column; the 1 at E indicates that the +// new column is column number 1. There are two positions at 12 and 45 +// (14-2 and 35-2+12). The 0 at H indicate the end-of-document. The +// 234 at I is the delta to next docid (357). It has one position 70 +// (72-2) and then terminates with the 0 at K. +// +// A "position-list" is the list of positions for multiple columns for +// a single docid. A "column-list" is the set of positions for a single +// column. Hence, a position-list consists of one or more column-lists, +// a document record consists of a docid followed by a position-list and +// a doclist consists of one or more document records. +// +// A bare doclist omits the position information, becoming an +// array of varint-encoded docids. +// +// Segment leaf nodes **** +// Segment leaf nodes store terms and doclists, ordered by term. Leaf +// nodes are written using LeafWriter, and read using LeafReader (to +// iterate through a single leaf node's data) and LeavesReader (to +// iterate through a segment's entire leaf layer). Leaf nodes have +// the format: +// +// varint iHeight; (height from leaf level, always 0) +// varint nTerm; (length of first term) +// char pTerm[nTerm]; (content of first term) +// varint nDoclist; (length of term's associated doclist) +// char pDoclist[nDoclist]; (content of doclist) +// array { +// (further terms are delta-encoded) +// varint nPrefix; (length of prefix shared with previous term) +// varint nSuffix; (length of unshared suffix) +// char pTermSuffix[nSuffix];(unshared suffix of next term) +// varint nDoclist; (length of term's associated doclist) +// char pDoclist[nDoclist]; (content of doclist) +// } +// +// Here, array { X } means zero or more occurrences of X, adjacent in +// memory. +// +// Leaf nodes are broken into blocks which are stored contiguously in +// the %_segments table in sorted order. This means that when the end +// of a node is reached, the next term is in the node with the next +// greater node id. +// +// New data is spilled to a new leaf node when the current node +// exceeds LEAF_MAX bytes (default 2048). New data which itself is +// larger than STANDALONE_MIN (default 1024) is placed in a standalone +// node (a leaf node with a single term and doclist). The goal of +// these settings is to pack together groups of small doclists while +// making it efficient to directly access large doclists. The +// assumption is that large doclists represent terms which are more +// likely to be query targets. +// +// TODO(shess) It may be useful for blocking decisions to be more +// dynamic. For instance, it may make more sense to have a 2.5k leaf +// node rather than splitting into 2k and .5k nodes. My intuition is +// that this might extend through 2x or 4x the pagesize. +// +// +// Segment interior nodes **** +// Segment interior nodes store blockids for subtree nodes and terms +// to describe what data is stored by the each subtree. Interior +// nodes are written using InteriorWriter, and read using +// InteriorReader. InteriorWriters are created as needed when +// SegmentWriter creates new leaf nodes, or when an interior node +// itself grows too big and must be split. The format of interior +// nodes: +// +// varint iHeight; (height from leaf level, always >0) +// varint iBlockid; (block id of node's leftmost subtree) +// optional { +// varint nTerm; (length of first term) +// char pTerm[nTerm]; (content of first term) +// array { +// (further terms are delta-encoded) +// varint nPrefix; (length of shared prefix with previous term) +// varint nSuffix; (length of unshared suffix) +// char pTermSuffix[nSuffix]; (unshared suffix of next term) +// } +// } +// +// Here, optional { X } means an optional element, while array { X } +// means zero or more occurrences of X, adjacent in memory. +// +// An interior node encodes n terms separating n+1 subtrees. The +// subtree blocks are contiguous, so only the first subtree's blockid +// is encoded. The subtree at iBlockid will contain all terms less +// than the first term encoded (or all terms if no term is encoded). +// Otherwise, for terms greater than or equal to pTerm[i] but less +// than pTerm[i+1], the subtree for that term will be rooted at +// iBlockid+i. Interior nodes only store enough term data to +// distinguish adjacent children (if the rightmost term of the left +// child is "something", and the leftmost term of the right child is +// "wicked", only "w" is stored). +// +// New data is spilled to a new interior node at the same height when +// the current node exceeds INTERIOR_MAX bytes (default 2048). +// INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing +// interior nodes and making the tree too skinny. The interior nodes +// at a given height are naturally tracked by interior nodes at +// height+1, and so on. +// +// +// Segment directory **** +// The segment directory in table %_segdir stores meta-information for +// merging and deleting segments, and also the root node of the +// segment's tree. +// +// The root node is the top node of the segment's tree after encoding +// the entire segment, restricted to ROOT_MAX bytes (default 1024). +// This could be either a leaf node or an interior node. If the top +// node requires more than ROOT_MAX bytes, it is flushed to %_segments +// and a new root interior node is generated (which should always fit +// within ROOT_MAX because it only needs space for 2 varints, the +// height and the blockid of the previous root). +// +// The meta-information in the segment directory is: +// level - segment level (see below) +// idx - index within level +// - (level,idx uniquely identify a segment) +// start_block - first leaf node +// leaves_end_block - last leaf node +// end_block - last block (including interior nodes) +// root - contents of root node +// +// If the root node is a leaf node, then start_block, +// leaves_end_block, and end_block are all 0. +// +// +// Segment merging **** +// To amortize update costs, segments are grouped into levels and +// merged in batches. Each increase in level represents exponentially +// more documents. +// +// New documents (actually, document updates) are tokenized and +// written individually (using LeafWriter) to a level 0 segment, with +// incrementing idx. When idx reaches MERGE_COUNT (default 16), all +// level 0 segments are merged into a single level 1 segment. Level 1 +// is populated like level 0, and eventually MERGE_COUNT level 1 +// segments are merged to a single level 2 segment (representing +// MERGE_COUNT^2 updates), and so on. +// +// A segment merge traverses all segments at a given level in +// parallel, performing a straightforward sorted merge. Since segment +// leaf nodes are written in to the %_segments table in order, this +// merge traverses the underlying sqlite disk structures efficiently. +// After the merge, all segment blocks from the merged level are +// deleted. +// +// MERGE_COUNT controls how often we merge segments. 16 seems to be +// somewhat of a sweet spot for insertion performance. 32 and 64 show +// very similar performance numbers to 16 on insertion, though they're +// a tiny bit slower (perhaps due to more overhead in merge-time +// sorting). 8 is about 20% slower than 16, 4 about 50% slower than +// 16, 2 about 66% slower than 16. +// +// At query time, high MERGE_COUNT increases the number of segments +// which need to be scanned and merged. For instance, with 100k docs +// inserted: +// +// MERGE_COUNT segments +// 16 25 +// 8 12 +// 4 10 +// 2 6 +// +// This appears to have only a moderate impact on queries for very +// frequent terms (which are somewhat dominated by segment merge +// costs), and infrequent and non-existent terms still seem to be fast +// even with many segments. +// +// TODO(shess) That said, it would be nice to have a better query-side +// argument for MERGE_COUNT of 16. Also, it is possible/likely that +// optimizations to things like doclist merging will swing the sweet +// spot around. +// +// +// +// Handling of deletions and updates **** +// Since we're using a segmented structure, with no docid-oriented +// index into the term index, we clearly cannot simply update the term +// index when a document is deleted or updated. For deletions, we +// write an empty doclist (varint(docid) varint(POS_END)), for updates +// we simply write the new doclist. Segment merges overwrite older +// data for a particular docid with newer data, so deletes or updates +// will eventually overtake the earlier data and knock it out. The +// query logic likewise merges doclists so that newer data knocks out +// older data. + +//************* Include fts3Int.h in the middle of fts3.c ******************* +//************* Begin file fts3Int.h **************************************** +// 2009 Nov 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// FTS3/FTS4 require virtual tables + +// FTS4 is really an extension for FTS3. It is enabled using the +// SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all +// the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3. + +//************* End of fts3Int.h ******************************************** +//************* Continuing where we left off in fts3.c ********************** + +//************* End of fts3.c *********************************************** +//************* Begin file fts3_aux.c *************************************** +// 2011 Jan 27 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// #include "fts3Int.h" + +//************* End of fts3_aux.c ******************************************* +//************* Begin file fts3_expr.c ************************************** +// 2008 Nov 28 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This module contains code that implements a parser for fts3 query strings +// (the right-hand argument to the MATCH operator). Because the supported +// syntax is relatively simple, the whole tokenizer/parser system is +// hand-coded. +// #include "fts3Int.h" + +//************* End of fts3_expr.c ****************************************** +//************* Begin file fts3_hash.c ************************************** +// 2001 September 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This is the implementation of generic hash-tables used in SQLite. +// We've modified it slightly to serve as a standalone hash table +// implementation for the full-text indexing module. + +// The code in this file is only compiled if: +// +// * The FTS3 module is being built as an extension +// (in which case SQLITE_CORE is not defined), or +// +// * The FTS3 module is being built into the core of +// SQLite (in which case SQLITE_ENABLE_FTS3 is defined). +// #include "fts3Int.h" + +//************* End of fts3_hash.c ****************************************** +//************* Begin file fts3_porter.c ************************************ +// 2006 September 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Implementation of the full-text-search tokenizer that implements +// a Porter stemmer. + +// The code in this file is only compiled if: +// +// * The FTS3 module is being built as an extension +// (in which case SQLITE_CORE is not defined), or +// +// * The FTS3 module is being built into the core of +// SQLite (in which case SQLITE_ENABLE_FTS3 is defined). +// #include "fts3Int.h" + +//************* End of fts3_porter.c **************************************** +//************* Begin file fts3_tokenizer.c ********************************* +// 2007 June 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is part of an SQLite module implementing full-text search. +// This particular file implements the generic tokenizer interface. + +// The code in this file is only compiled if: +// +// * The FTS3 module is being built as an extension +// (in which case SQLITE_CORE is not defined), or +// +// * The FTS3 module is being built into the core of +// SQLite (in which case SQLITE_ENABLE_FTS3 is defined). +// #include "fts3Int.h" + +//************* End of fts3_tokenizer.c ************************************* +//************* Begin file fts3_tokenizer1.c ******************************** +// 2006 Oct 10 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Implementation of the "simple" full-text-search tokenizer. + +// The code in this file is only compiled if: +// +// * The FTS3 module is being built as an extension +// (in which case SQLITE_CORE is not defined), or +// +// * The FTS3 module is being built into the core of +// SQLite (in which case SQLITE_ENABLE_FTS3 is defined). +// #include "fts3Int.h" + +//************* End of fts3_tokenizer1.c ************************************ +//************* Begin file fts3_tokenize_vtab.c ***************************** +// 2013 Apr 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains code for the "fts3tokenize" virtual table module. +// An fts3tokenize virtual table is created as follows: +// +// CREATE VIRTUAL TABLE USING fts3tokenize( +// , , ... +// ); +// +// The table created has the following schema: +// +// CREATE TABLE (input, token, start, end, position) +// +// When queried, the query must include a WHERE clause of type: +// +// input = +// +// The virtual table module tokenizes this , using the FTS3 +// tokenizer specified by the arguments to the CREATE VIRTUAL TABLE +// statement and returns one row for each token in the result. With +// fields set as follows: +// +// input: Always set to a copy of +// token: A token from the input. +// start: Byte offset of the token within the input . +// end: Byte offset of the byte immediately following the end of the +// token within the input string. +// pos: Token offset of token within input. +// +// #include "fts3Int.h" + +//************* End of fts3_tokenize_vtab.c ********************************* +//************* Begin file fts3_write.c ************************************* +// 2009 Oct 23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file is part of the SQLite FTS3 extension module. Specifically, +// this file contains code to insert, update and delete rows from FTS3 +// tables. It also contains code to merge FTS3 b-tree segments. Some +// of the sub-routines used to merge segments are also used by the query +// code in fts3.c. + +// #include "fts3Int.h" + +//************* End of fts3_write.c ***************************************** +//************* Begin file fts3_snippet.c *********************************** +// 2009 Oct 23 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// #include "fts3Int.h" + +//************* End of fts3_snippet.c *************************************** +//************* Begin file fts3_unicode.c *********************************** +// 2012 May 24 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Implementation of the "unicode" full-text-search tokenizer. + +// #include "fts3Int.h" + +//************* End of fts3_unicode.c *************************************** +//************* Begin file fts3_unicode2.c ********************************** +// 2012-05-25 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// DO NOT EDIT THIS MACHINE GENERATED FILE. + +//************* End of fts3_unicode2.c ************************************** +//************* Begin file json1.c ****************************************** +// 2015-08-12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This SQLite extension implements JSON functions. The interface is +// modeled after MySQL JSON functions: +// +// https://dev.mysql.com/doc/refman/5.7/en/json.html +// +// For the time being, all JSON is stored as pure text. (We might add +// a JSONB type in the future which stores a binary encoding of JSON in +// a BLOB, but there is no support for JSONB in the current implementation. +// This implementation parses JSON text at 250 MB/s, so it is hard to see +// how JSONB might improve on that.) + +// #include +// #include +// #include +// #include + +// Mark a function parameter as unused, to suppress nuisance compiler +// warnings. + +// Versions of isspace(), isalnum() and isdigit() to which it is safe +// to pass signed char values. +// Use the SQLite core versions if this routine is part of the +// SQLite amalgamation + +// Growing our own isspace() routine this way is twice as fast as +// the library isspace() function, resulting in a 7% overall performance +// increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os). +var jsonIsSpace = [256]int8{ + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(1), int8(1), int8(0), int8(0), int8(1), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(1), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), +} /* sqlite3.c:189706:19 */ + +// Objects +type JsonString1 = struct { + FpCtx uintptr + FzBuf uintptr + FnAlloc U64 + FnUsed U64 + FbStatic U8 + FbErr U8 + FzSpace [100]int8 + _ [2]byte +} /* sqlite3.c:189736:9 */ + +// Objects +type JsonString = JsonString1 /* sqlite3.c:189736:27 */ +type JsonNode1 = struct { + FeType U8 + FjnFlags U8 + _ [2]byte + Fn U32 + Fu struct{ FzJContent uintptr } +} /* sqlite3.c:189737:9 */ + +type JsonNode = JsonNode1 /* sqlite3.c:189737:25 */ +type JsonParse1 = struct { + FnNode U32 + FnAlloc U32 + FaNode uintptr + FzJson uintptr + FaUp uintptr + Foom U8 + FnErr U8 + FiDepth U16 + FnJson int32 + FiHold U32 + _ [4]byte +} /* sqlite3.c:189738:9 */ + +type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ + +// JSON type values + +// The "subtype" set for JSON values + +// Names of the various JSON types: +var jsonType = [8]uintptr{ + ts + 5259 /* "null" */, ts + 5771 /* "true" */, ts + 5776 /* "false" */, ts + 5269 /* "integer" */, ts + 5264 /* "real" */, ts + 13524 /* "text" */, ts + 22761 /* "array" */, ts + 22767, /* "object" */ +} /* sqlite3.c:189771:19 */ + +// Maximum nesting depth of JSON for this implementation. +// +// This limit is needed to avoid a stack overflow in the recursive +// descent parser. A depth of 2000 is far deeper than any sane JSON +// should go. + +// ************************************************************************* +// +// Utility routines for dealing with JsonString objects +// + +// Set the JsonString object to an empty string +func jsonZero(tls *libc.TLS, p uintptr) { /* sqlite3.c:189831:13: */ + (*JsonString)(unsafe.Pointer(p)).FzBuf = p + 34 /* &.zSpace */ + (*JsonString)(unsafe.Pointer(p)).FnAlloc = U64(unsafe.Sizeof([100]int8{})) + (*JsonString)(unsafe.Pointer(p)).FnUsed = uint64(0) + (*JsonString)(unsafe.Pointer(p)).FbStatic = U8(1) +} + +// Initialize the JsonString object +func jsonInit(tls *libc.TLS, p uintptr, pCtx uintptr) { /* sqlite3.c:189840:13: */ + (*JsonString)(unsafe.Pointer(p)).FpCtx = pCtx + (*JsonString)(unsafe.Pointer(p)).FbErr = U8(0) + jsonZero(tls, p) +} + +// Free all allocated memory and reset the JsonString object back to its +// initial state. +func jsonReset(tls *libc.TLS, p uintptr) { /* sqlite3.c:189850:13: */ + if !(int32((*JsonString)(unsafe.Pointer(p)).FbStatic) != 0) { + Xsqlite3_free(tls, (*JsonString)(unsafe.Pointer(p)).FzBuf) + } + jsonZero(tls, p) +} + +// Report an out-of-memory (OOM) condition +func jsonOom(tls *libc.TLS, p uintptr) { /* sqlite3.c:189858:13: */ + (*JsonString)(unsafe.Pointer(p)).FbErr = U8(1) + Xsqlite3_result_error_nomem(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx) + jsonReset(tls, p) +} + +// Enlarge pJson->zBuf so that it can hold at least N more bytes. +// Return zero on success. Return non-zero on an OOM error +func jsonGrow(tls *libc.TLS, p uintptr, N U32) int32 { /* sqlite3.c:189867:12: */ + var nTotal U64 + if U64(N) < (*JsonString)(unsafe.Pointer(p)).FnAlloc { + nTotal = ((*JsonString)(unsafe.Pointer(p)).FnAlloc * uint64(2)) + } else { + nTotal = (((*JsonString)(unsafe.Pointer(p)).FnAlloc + U64(N)) + uint64(10)) + } + var zNew uintptr + if (*JsonString)(unsafe.Pointer(p)).FbStatic != 0 { + if (*JsonString)(unsafe.Pointer(p)).FbErr != 0 { + return 1 + } + zNew = Xsqlite3_malloc64(tls, nTotal) + if zNew == uintptr(0) { + jsonOom(tls, p) + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, zNew, (*JsonString)(unsafe.Pointer(p)).FzBuf, Size_t((*JsonString)(unsafe.Pointer(p)).FnUsed)) + (*JsonString)(unsafe.Pointer(p)).FzBuf = zNew + (*JsonString)(unsafe.Pointer(p)).FbStatic = U8(0) + } else { + zNew = Xsqlite3_realloc64(tls, (*JsonString)(unsafe.Pointer(p)).FzBuf, nTotal) + if zNew == uintptr(0) { + jsonOom(tls, p) + return SQLITE_NOMEM + } + (*JsonString)(unsafe.Pointer(p)).FzBuf = zNew + } + (*JsonString)(unsafe.Pointer(p)).FnAlloc = nTotal + return SQLITE_OK +} + +// Append N bytes from zIn onto the end of the JsonString string. +func jsonAppendRaw(tls *libc.TLS, p uintptr, zIn uintptr, N U32) { /* sqlite3.c:189894:13: */ + if N == U32(0) { + return + } + if ((U64(N) + (*JsonString)(unsafe.Pointer(p)).FnUsed) >= (*JsonString)(unsafe.Pointer(p)).FnAlloc) && (jsonGrow(tls, p, N) != 0) { + return + } + libc.Xmemcpy(tls, ((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr((*JsonString)(unsafe.Pointer(p)).FnUsed)), zIn, uint64(N)) + *(*U64)(unsafe.Pointer(p + 24 /* &.nUsed */)) += (U64(N)) +} + +// Append formatted text (not to exceed N bytes) to the JsonString. +func jsonPrintf(tls *libc.TLS, N int32, p uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:189903:13: */ + var ap Va_list + _ = ap + if (((*JsonString)(unsafe.Pointer(p)).FnUsed + U64(N)) >= (*JsonString)(unsafe.Pointer(p)).FnAlloc) && (jsonGrow(tls, p, uint32(N)) != 0) { + return + } + ap = va + Xsqlite3_vsnprintf(tls, N, ((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr((*JsonString)(unsafe.Pointer(p)).FnUsed)), zFormat, ap) + _ = ap + *(*U64)(unsafe.Pointer(p + 24 /* &.nUsed */)) += (U64(int32(libc.Xstrlen(tls, ((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr((*JsonString)(unsafe.Pointer(p)).FnUsed)))))) +} + +// Append a single character +func jsonAppendChar(tls *libc.TLS, p uintptr, c int8) { /* sqlite3.c:189914:13: */ + if ((*JsonString)(unsafe.Pointer(p)).FnUsed >= (*JsonString)(unsafe.Pointer(p)).FnAlloc) && (jsonGrow(tls, p, uint32(1)) != 0) { + return + } + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = c +} + +// Append a comma separator to the output buffer, if the previous +// character is not '[' or '{'. +func jsonAppendSeparator(tls *libc.TLS, p uintptr) { /* sqlite3.c:189922:13: */ + var c int8 + if (*JsonString)(unsafe.Pointer(p)).FnUsed == uint64(0) { + return + } + c = *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(((*JsonString)(unsafe.Pointer(p)).FnUsed - uint64(1))))) + if (int32(c) != '[') && (int32(c) != '{') { + jsonAppendChar(tls, p, int8(',')) + } +} + +// Append the N-byte string in zIn to the end of the JsonString string +// under construction. Enclose the string in "..." and escape +// any double-quotes or backslash characters contained within the +// string. +func jsonAppendString(tls *libc.TLS, p uintptr, zIn uintptr, N U32) { /* sqlite3.c:189934:13: */ + var i U32 + var c uint8 + if !((zIn == uintptr(0)) || ((((U64(N) + (*JsonString)(unsafe.Pointer(p)).FnUsed) + uint64(2)) >= (*JsonString)(unsafe.Pointer(p)).FnAlloc) && (jsonGrow(tls, p, (N+U32(2))) != 0))) { + goto __1 + } + return +__1: + ; + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('"') + i = U32(0) +__2: + if !(i < N) { + goto __4 + } + c = *(*uint8)(unsafe.Pointer((zIn) + uintptr(i))) + if !((int32(c) == '"') || (int32(c) == '\\')) { + goto __5 + } +json_simple_escape: + if !((((((*JsonString)(unsafe.Pointer(p)).FnUsed + U64(N)) + uint64(3)) - U64(i)) > (*JsonString)(unsafe.Pointer(p)).FnAlloc) && (jsonGrow(tls, p, ((N+U32(3))-i)) != 0)) { + goto __7 + } + return +__7: + ; + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('\\') + goto __6 +__5: + if !(int32(c) <= 0x1f) { + goto __8 + } + + if !(aSpecial[c] != 0) { + goto __9 + } + c = uint8(aSpecial[c]) + goto json_simple_escape +__9: + ; + if !((((((*JsonString)(unsafe.Pointer(p)).FnUsed + U64(N)) + uint64(7)) + U64(i)) > (*JsonString)(unsafe.Pointer(p)).FnAlloc) && (jsonGrow(tls, p, ((N+U32(7))-i)) != 0)) { + goto __10 + } + return +__10: + ; + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('\\') + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('u') + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 22774 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) +__8: + ; +__6: + ; + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8(c) + goto __3 +__3: + i++ + goto __2 + goto __4 +__4: + ; + *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('"') + +} + +var aSpecial = [32]int8{ + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8('b'), int8('t'), int8('n'), int8(0), int8('f'), int8('r'), int8(0), int8(0), + int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), +} /* sqlite3.c:189945:25 */ + +// Append a function parameter value to the JSON string under +// construction. +func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:189977:13: */ + switch Xsqlite3_value_type(tls, pValue) { + case SQLITE_NULL: + { + jsonAppendRaw(tls, p, ts+5259 /* "null" */, uint32(4)) + break + + } + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + { + var z uintptr = Xsqlite3_value_text(tls, pValue) + var n U32 = U32(Xsqlite3_value_bytes(tls, pValue)) + jsonAppendRaw(tls, p, z, n) + break + + } + case SQLITE_TEXT: + { + var z uintptr = Xsqlite3_value_text(tls, pValue) + var n U32 = U32(Xsqlite3_value_bytes(tls, pValue)) + if Xsqlite3_value_subtype(tls, pValue) == uint32(JSON_SUBTYPE) { + jsonAppendRaw(tls, p, z, n) + } else { + jsonAppendString(tls, p, z, n) + } + break + + } + default: + { + if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22791 /* "JSON cannot hold..." */, -1) + (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) + jsonReset(tls, p) + } + break + + } + } +} + +// Make the JSON in p the result of the SQL function. +func jsonResult(tls *libc.TLS, p uintptr) { /* sqlite3.c:190017:13: */ + if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { + Xsqlite3_result_text64(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, (*JsonString)(unsafe.Pointer(p)).FzBuf, (*JsonString)(unsafe.Pointer(p)).FnUsed, + func() uintptr { + if (*JsonString)(unsafe.Pointer(p)).FbStatic != 0 { + return libc.UintptrFromInt32(-1) + } + return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free})) + }(), + uint8(SQLITE_UTF8)) + jsonZero(tls, p) + } + +} + +// ************************************************************************* +// +// Utility routines for dealing with JsonNode and JsonParse objects +// + +// Return the number of consecutive JsonNode slots need to represent +// the parsed JSON at pNode. The minimum answer is 1. For ARRAY and +// OBJECT types, the number might be larger. +// +// Appended elements are not counted. The value returned is the number +// by which the JsonNode counter should increment in order to go to the +// next peer value. +func jsonNodeSize(tls *libc.TLS, pNode uintptr) U32 { /* sqlite3.c:190040:12: */ + if int32((*JsonNode)(unsafe.Pointer(pNode)).FeType) >= JSON_ARRAY { + return ((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1)) + } + return uint32(1) +} + +// Reclaim all memory allocated by a JsonParse object. But do not +// delete the JsonParse object itself. +func jsonParseReset(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:190048:13: */ + Xsqlite3_free(tls, (*JsonParse)(unsafe.Pointer(pParse)).FaNode) + (*JsonParse)(unsafe.Pointer(pParse)).FaNode = uintptr(0) + (*JsonParse)(unsafe.Pointer(pParse)).FnNode = U32(0) + (*JsonParse)(unsafe.Pointer(pParse)).FnAlloc = U32(0) + Xsqlite3_free(tls, (*JsonParse)(unsafe.Pointer(pParse)).FaUp) + (*JsonParse)(unsafe.Pointer(pParse)).FaUp = uintptr(0) +} + +// Free a JsonParse object that was obtained from sqlite3_malloc(). +func jsonParseFree(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:190060:13: */ + jsonParseReset(tls, pParse) + Xsqlite3_free(tls, pParse) +} + +// Convert the JsonNode pNode into a pure JSON string and +// append to pOut. Subsubstructure is also included. Return +// the number of JsonNode objects that are encoded. +func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr) { /* sqlite3.c:190070:13: */ + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & (JNODE_REPLACE | JNODE_PATCH)) != 0 { + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_REPLACE) != 0 { + jsonAppendValue(tls, pOut, *(*uintptr)(unsafe.Pointer(aReplace + uintptr(*(*U32)(unsafe.Pointer(pNode + 8 /* &.u */)))*8))) + return + } + pNode = *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)) + } + switch int32((*JsonNode)(unsafe.Pointer(pNode)).FeType) { + default: + { + + jsonAppendRaw(tls, pOut, ts+5259 /* "null" */, uint32(4)) + break + + } + case JSON_TRUE: + { + jsonAppendRaw(tls, pOut, ts+5771 /* "true" */, uint32(4)) + break + + } + case JSON_FALSE: + { + jsonAppendRaw(tls, pOut, ts+5776 /* "false" */, uint32(5)) + break + + } + case JSON_STRING: + { + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_RAW) != 0 { + jsonAppendString(tls, pOut, *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)), (*JsonNode)(unsafe.Pointer(pNode)).Fn) + break + } + + } + fallthrough + case JSON_REAL: + fallthrough + case JSON_INT: + { + jsonAppendRaw(tls, pOut, *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)), (*JsonNode)(unsafe.Pointer(pNode)).Fn) + break + + } + case JSON_ARRAY: + { + var j U32 = U32(1) + jsonAppendChar(tls, pOut, int8('[')) + for { + for j <= (*JsonNode)(unsafe.Pointer(pNode)).Fn { + if (int32((*JsonNode)(unsafe.Pointer(pNode+uintptr(j)*16)).FjnFlags) & JNODE_REMOVE) == 0 { + jsonAppendSeparator(tls, pOut) + jsonRenderNode(tls, (pNode + uintptr(j)*16), pOut, aReplace) + } + j = j + (jsonNodeSize(tls, (pNode + uintptr(j)*16))) + } + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_APPEND) == 0 { + break + } + pNode = (pNode + uintptr(*(*U32)(unsafe.Pointer(pNode + 8 /* &.u */)))*16) + j = U32(1) + } + jsonAppendChar(tls, pOut, int8(']')) + break + + } + case JSON_OBJECT: + { + var j U32 = U32(1) + jsonAppendChar(tls, pOut, int8('{')) + for { + for j <= (*JsonNode)(unsafe.Pointer(pNode)).Fn { + if (int32((*JsonNode)(unsafe.Pointer(pNode+uintptr((j+U32(1)))*16)).FjnFlags) & JNODE_REMOVE) == 0 { + jsonAppendSeparator(tls, pOut) + jsonRenderNode(tls, (pNode + uintptr(j)*16), pOut, aReplace) + jsonAppendChar(tls, pOut, int8(':')) + jsonRenderNode(tls, (pNode + uintptr((j+U32(1)))*16), pOut, aReplace) + } + j = j + (U32(1) + jsonNodeSize(tls, (pNode+uintptr((j+U32(1)))*16))) + } + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_APPEND) == 0 { + break + } + pNode = (pNode + uintptr(*(*U32)(unsafe.Pointer(pNode + 8 /* &.u */)))*16) + j = U32(1) + } + jsonAppendChar(tls, pOut, int8('}')) + break + + } + } +} + +// Return a JsonNode and all its descendents as a JSON string. +func jsonReturnJson(tls *libc.TLS, pNode uintptr, pCtx uintptr, aReplace uintptr) { /* sqlite3.c:190152:13: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + // var s JsonString at bp, 136 + + jsonInit(tls, bp /* &s */, pCtx) + jsonRenderNode(tls, pNode, bp /* &s */, aReplace) + jsonResult(tls, bp /* &s */) + Xsqlite3_result_subtype(tls, pCtx, uint32(JSON_SUBTYPE)) +} + +// Translate a single byte of Hex into an integer. +// This routine only works if h really is a valid hexadecimal +// character: 0..9a..fA..F +func jsonHexToInt(tls *libc.TLS, h int32) U8 { /* sqlite3.c:190169:11: */ + + h = h + (9 * (1 & (h >> 6))) + return (U8(h & 0xf)) +} + +// Convert a 4-byte hex string into an integer +func jsonHexToInt4(tls *libc.TLS, z uintptr) U32 { /* sqlite3.c:190182:12: */ + var v U32 + + v = (U32((((int32(jsonHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z))))) << 12) + + (int32(jsonHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + 1))))) << 8)) + + (int32(jsonHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + 2))))) << 4)) + + int32(jsonHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z + 3))))))) + return v +} + +// Make the JsonNode the return value of the function. +func jsonReturn(tls *libc.TLS, pNode uintptr, pCtx uintptr, aReplace uintptr) { /* sqlite3.c:190198:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var v uint32 + var i Sqlite3_int64 + var z uintptr + // var r float64 at bp, 8 + + var z1 uintptr + var vlo U32 + var v1 U32 + var c int8 + // Translate JSON formatted string into raw text + var i1 U32 + var n U32 + var z2 uintptr + var zOut uintptr + var j U32 + switch int32((*JsonNode)(unsafe.Pointer(pNode)).FeType) { + default: + goto __2 + case JSON_TRUE: + goto __3 + case JSON_FALSE: + goto __4 + case JSON_INT: + goto __5 + case JSON_REAL: + goto __6 + case JSON_STRING: + goto __7 + case JSON_ARRAY: + goto __8 + case JSON_OBJECT: + goto __9 + } + goto __1 +__2: + ; + Xsqlite3_result_null(tls, pCtx) + goto __1 + +__3: + Xsqlite3_result_int(tls, pCtx, 1) + goto __1 + +__4: + Xsqlite3_result_int(tls, pCtx, 0) + goto __1 + +__5: + i = int64(0) + z = *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)) + if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') { + goto __10 + } + z++ +__10: + ; +__11: + if !((int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '9')) { + goto __12 + } + v = (uint32(int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))) - '0')) + if !(i >= ((int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) / int64(10))) { + goto __13 + } + if !(i > ((int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) / int64(10))) { + goto __14 + } + goto int_as_real +__14: + ; + if !((int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '9')) { + goto __15 + } + goto int_as_real +__15: + ; + if !(v == uint32(9)) { + goto __16 + } + goto int_as_real +__16: + ; + if !(v == uint32(8)) { + goto __17 + } + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))))) == '-') { + goto __18 + } + Xsqlite3_result_int64(tls, pCtx, ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) + goto int_done + goto __19 +__18: + goto int_as_real +__19: + ; +__17: + ; +__13: + ; + i = ((i * int64(10)) + Sqlite3_int64(v)) + goto __11 +__12: + ; + if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))))) == '-') { + goto __20 + } + i = -i +__20: + ; + Xsqlite3_result_int64(tls, pCtx, i) +int_done: + goto __1 +int_as_real: + i = int64(0) + +__6: + z1 = *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)) + Xsqlite3AtoF(tls, z1, bp /* &r */, Xsqlite3Strlen30(tls, z1), uint8(SQLITE_UTF8)) + Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp /* r */))) + goto __1 + +__7: + ; + if !((int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_ESCAPE) == 0) { + goto __21 + } + // JSON formatted without any backslash-escapes + Xsqlite3_result_text(tls, pCtx, (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)) + uintptr(1)), (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn - U32(2))), + libc.UintptrFromInt32(-1)) + goto __22 +__21: + n = (*JsonNode)(unsafe.Pointer(pNode)).Fn + z2 = *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)) + zOut = Xsqlite3_malloc(tls, (int32(n + U32(1)))) + if !(zOut == uintptr(0)) { + goto __23 + } + Xsqlite3_result_error_nomem(tls, pCtx) + goto __1 +__23: + ; + i1 = U32(1) + j = U32(0) +__24: + if !(i1 < (n - U32(1))) { + goto __26 + } + c = *(*int8)(unsafe.Pointer(z2 + uintptr(i1))) + if !(int32(c) != '\\') { + goto __27 + } + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = c + goto __28 +__27: + c = *(*int8)(unsafe.Pointer(z2 + uintptr(libc.PreIncUint32(&i1, 1)))) + if !(int32(c) == 'u') { + goto __29 + } + v1 = jsonHexToInt4(tls, ((z2 + uintptr(i1)) + uintptr(1))) + i1 = i1 + (U32(4)) + if !(v1 == U32(0)) { + goto __31 + } + goto __26 +__31: + ; + if !(v1 <= U32(0x7f)) { + goto __32 + } + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = int8(v1) + goto __33 +__32: + if !(v1 <= U32(0x7ff)) { + goto __34 + } + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0xc0) | (v1 >> 6))) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0x80) | (v1 & U32(0x3f)))) + goto __35 +__34: + if !((((((v1 & U32(0xfc00)) == U32(0xd800)) && + (i1 < (n - U32(6)))) && + (int32(*(*int8)(unsafe.Pointer(z2 + uintptr((i1 + U32(1)))))) == '\\')) && + (int32(*(*int8)(unsafe.Pointer(z2 + uintptr((i1 + U32(2)))))) == 'u')) && + (((libc.AssignUint32(&vlo, jsonHexToInt4(tls, ((z2+uintptr(i1))+uintptr(3))))) & U32(0xfc00)) == U32(0xdc00))) { + goto __36 + } + // We have a surrogate pair + v1 = ((((v1 & U32(0x3ff)) << 10) + (vlo & U32(0x3ff))) + U32(0x10000)) + i1 = i1 + (U32(6)) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0xf0) | (v1 >> 18))) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0x80) | ((v1 >> 12) & U32(0x3f)))) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0x80) | ((v1 >> 6) & U32(0x3f)))) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0x80) | (v1 & U32(0x3f)))) + goto __37 +__36: + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0xe0) | (v1 >> 12))) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0x80) | ((v1 >> 6) & U32(0x3f)))) + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = (int8(U32(0x80) | (v1 & U32(0x3f)))) +__37: + ; +__35: + ; +__33: + ; + goto __30 +__29: + if !(int32(c) == 'b') { + goto __38 + } + c = int8('\b') + goto __39 +__38: + if !(int32(c) == 'f') { + goto __40 + } + c = int8('\f') + goto __41 +__40: + if !(int32(c) == 'n') { + goto __42 + } + c = int8('\n') + goto __43 +__42: + if !(int32(c) == 'r') { + goto __44 + } + c = int8('\r') + goto __45 +__44: + if !(int32(c) == 't') { + goto __46 + } + c = int8('\t') +__46: + ; +__45: + ; +__43: + ; +__41: + ; +__39: + ; + *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncUint32(&j, 1)))) = c +__30: + ; +__28: + ; + goto __25 +__25: + i1++ + goto __24 + goto __26 +__26: + ; + *(*int8)(unsafe.Pointer(zOut + uintptr(j))) = int8(0) + Xsqlite3_result_text(tls, pCtx, zOut, int32(j), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) +__22: + ; + goto __1 + +__8: +__9: + jsonReturnJson(tls, pNode, pCtx, aReplace) + goto __1 + +__1: +} + +// A macro to hint to the compiler that a function should not be +// inlined. + +func jsonParseAddNodeExpand(tls *libc.TLS, pParse uintptr, eType U32, n U32, zContent uintptr) int32 { /* sqlite3.c:190362:26: */ + var nNew U32 + var pNew uintptr + + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return -1 + } + nNew = (((*JsonParse)(unsafe.Pointer(pParse)).FnAlloc * U32(2)) + U32(10)) + pNew = Xsqlite3_realloc64(tls, (*JsonParse)(unsafe.Pointer(pParse)).FaNode, (uint64(uint64(unsafe.Sizeof(JsonNode{})) * uint64(nNew)))) + if pNew == uintptr(0) { + (*JsonParse)(unsafe.Pointer(pParse)).Foom = U8(1) + return -1 + } + (*JsonParse)(unsafe.Pointer(pParse)).FnAlloc = nNew + (*JsonParse)(unsafe.Pointer(pParse)).FaNode = pNew + + return jsonParseAddNode(tls, pParse, eType, n, zContent) +} + +// Create a new JsonNode instance based on the arguments and append that +// instance to the JsonParse. Return the index in pParse->aNode[] of the +// new node, or -1 if a memory allocation fails. +func jsonParseAddNode(tls *libc.TLS, pParse uintptr, eType U32, n U32, zContent uintptr) int32 { /* sqlite3.c:190389:12: */ + var p uintptr + if (*JsonParse)(unsafe.Pointer(pParse)).FnNode >= (*JsonParse)(unsafe.Pointer(pParse)).FnAlloc { + return jsonParseAddNodeExpand(tls, pParse, eType, n, zContent) + } + p = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr((*JsonParse)(unsafe.Pointer(pParse)).FnNode)*16) + (*JsonNode)(unsafe.Pointer(p)).FeType = U8(eType) + (*JsonNode)(unsafe.Pointer(p)).FjnFlags = U8(0) + (*JsonNode)(unsafe.Pointer(p)).Fn = n + *(*uintptr)(unsafe.Pointer(p + 8 /* &.u */)) = zContent + return int32(libc.PostIncUint32(&(*JsonParse)(unsafe.Pointer(pParse)).FnNode, 1)) +} + +// Return true if z[] begins with 4 (or more) hexadecimal digits +func jsonIs4Hex(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:190410:12: */ + var i int32 + for i = 0; i < 4; i++ { + if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))]) & 0x08) != 0) { + return 0 + } + } + return 1 +} + +// Parse a single JSON value which begins at pParse->zJson[i]. Return the +// index of the first character past the end of the value parsed. +// +// Return negative for a syntax error. Special cases: return -2 if the +// first non-whitespace character is '}' and return -3 if the first +// non-whitespace character is ']'. +func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:190424:12: */ + var c int8 + var j U32 + var iThis int32 + var x int32 + var pNode uintptr + var z uintptr = (*JsonParse)(unsafe.Pointer(pParse)).FzJson + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(i))))] != 0 { + i++ + } + if (int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(z + uintptr(i)))))) == '{' { + // Parse object + iThis = jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) + if iThis < 0 { + return -1 + } + for j = (i + U32(1)); ; j++ { + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j++ + } + if int32(libc.PreIncUint16(&(*JsonParse)(unsafe.Pointer(pParse)).FiDepth, 1)) > JSON_MAX_DEPTH { + return -1 + } + x = jsonParseValue(tls, pParse, j) + if x < 0 { + (*JsonParse)(unsafe.Pointer(pParse)).FiDepth-- + if (x == (-2)) && ((*JsonParse)(unsafe.Pointer(pParse)).FnNode == (U32(iThis) + U32(1))) { + return (int32(j + U32(1))) + } + return -1 + } + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return -1 + } + pNode = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(((*JsonParse)(unsafe.Pointer(pParse)).FnNode-U32(1)))*16) + if int32((*JsonNode)(unsafe.Pointer(pNode)).FeType) != JSON_STRING { + return -1 + } + *(*U8)(unsafe.Pointer(pNode + 1 /* &.jnFlags */)) |= U8((JNODE_LABEL)) + j = U32(x) + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j++ + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) != ':' { + return -1 + } + j++ + x = jsonParseValue(tls, pParse, j) + (*JsonParse)(unsafe.Pointer(pParse)).FiDepth-- + if x < 0 { + return -1 + } + j = U32(x) + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j++ + } + c = *(*int8)(unsafe.Pointer(z + uintptr(j))) + if int32(c) == ',' { + continue + } + if int32(c) != '}' { + return -1 + } + break + } + (*JsonNode)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iThis)*16)).Fn = (((*JsonParse)(unsafe.Pointer(pParse)).FnNode - U32(iThis)) - U32(1)) + return (int32(j + U32(1))) + } else if int32(c) == '[' { + // Parse array + iThis = jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) + if iThis < 0 { + return -1 + } + for j = (i + U32(1)); ; j++ { + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j++ + } + if int32(libc.PreIncUint16(&(*JsonParse)(unsafe.Pointer(pParse)).FiDepth, 1)) > JSON_MAX_DEPTH { + return -1 + } + x = jsonParseValue(tls, pParse, j) + (*JsonParse)(unsafe.Pointer(pParse)).FiDepth-- + if x < 0 { + if (x == (-3)) && ((*JsonParse)(unsafe.Pointer(pParse)).FnNode == (U32(iThis) + U32(1))) { + return (int32(j + U32(1))) + } + return -1 + } + j = U32(x) + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(z + uintptr(j))))] != 0 { + j++ + } + c = *(*int8)(unsafe.Pointer(z + uintptr(j))) + if int32(c) == ',' { + continue + } + if int32(c) != ']' { + return -1 + } + break + } + (*JsonNode)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iThis)*16)).Fn = (((*JsonParse)(unsafe.Pointer(pParse)).FnNode - U32(iThis)) - U32(1)) + return (int32(j + U32(1))) + } else if int32(c) == '"' { + // Parse string + var jnFlags U8 = U8(0) + j = (i + U32(1)) + for { + c = *(*int8)(unsafe.Pointer(z + uintptr(j))) + if (int32(c) & libc.CplInt32(0x1f)) == 0 { + // Control characters are not allowed in strings + return -1 + } + if int32(c) == '\\' { + c = *(*int8)(unsafe.Pointer(z + uintptr(libc.PreIncUint32(&j, 1)))) + if ((((((((int32(c) == '"') || (int32(c) == '\\')) || (int32(c) == '/')) || (int32(c) == 'b')) || (int32(c) == 'f')) || + (int32(c) == 'n')) || (int32(c) == 'r')) || (int32(c) == 't')) || + ((int32(c) == 'u') && (jsonIs4Hex(tls, ((z+uintptr(j))+uintptr(1))) != 0)) { + jnFlags = U8(JNODE_ESCAPE) + } else { + return -1 + } + } else if int32(c) == '"' { + break + } + j++ + } + jsonParseAddNode(tls, pParse, uint32(JSON_STRING), ((j + U32(1)) - i), (z + uintptr(i))) + if !(int32((*JsonParse)(unsafe.Pointer(pParse)).Foom) != 0) { + (*JsonNode)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(((*JsonParse)(unsafe.Pointer(pParse)).FnNode-U32(1)))*16)).FjnFlags = jnFlags + } + return (int32(j + U32(1))) + } else if ((int32(c) == 'n') && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5259 /* "null" */, uint64(4)) == 0)) && + !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { + jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) + return (int32(i + U32(4))) + } else if ((int32(c) == 't') && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5771 /* "true" */, uint64(4)) == 0)) && + !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { + jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) + return (int32(i + U32(4))) + } else if ((int32(c) == 'f') && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5776 /* "false" */, uint64(5)) == 0)) && + !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { + jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) + return (int32(i + U32(5))) + } else if (int32(c) == '-') || ((int32(c) >= '0') && (int32(c) <= '9')) { + // Parse number + var seenDP U8 = U8(0) + var seenE U8 = U8(0) + + if int32(c) <= '0' { + if int32(c) == '-' { + j = (i + U32(1)) + } else { + j = i + } + if ((int32(*(*int8)(unsafe.Pointer(z + uintptr(j)))) == '0') && (int32(*(*int8)(unsafe.Pointer(z + uintptr((j + U32(1)))))) >= '0')) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((j + U32(1)))))) <= '9') { + return -1 + } + } + j = (i + U32(1)) + for ; ; j++ { + c = *(*int8)(unsafe.Pointer(z + uintptr(j))) + if (int32(c) >= '0') && (int32(c) <= '9') { + continue + } + if int32(c) == '.' { + if int32(*(*int8)(unsafe.Pointer(z + uintptr((j - U32(1)))))) == '-' { + return -1 + } + if seenDP != 0 { + return -1 + } + seenDP = U8(1) + continue + } + if (int32(c) == 'e') || (int32(c) == 'E') { + if int32(*(*int8)(unsafe.Pointer(z + uintptr((j - U32(1)))))) < '0' { + return -1 + } + if seenE != 0 { + return -1 + } + seenDP = libc.AssignUint8(&seenE, U8(1)) + c = *(*int8)(unsafe.Pointer(z + uintptr((j + U32(1))))) + if (int32(c) == '+') || (int32(c) == '-') { + j++ + c = *(*int8)(unsafe.Pointer(z + uintptr((j + U32(1))))) + } + if (int32(c) < '0') || (int32(c) > '9') { + return -1 + } + continue + } + break + } + if int32(*(*int8)(unsafe.Pointer(z + uintptr((j - U32(1)))))) < '0' { + return -1 + } + jsonParseAddNode(tls, pParse, func() uint32 { + if seenDP != 0 { + return uint32(JSON_REAL) + } + return uint32(JSON_INT) + }(), + (j - i), (z + uintptr(i))) + return int32(j) + } else if int32(c) == '}' { + return -2 // End of {...} + } else if int32(c) == ']' { + return -3 // End of [...] + } else if int32(c) == 0 { + return 0 // End of file + } else { + return -1 // Syntax error + } + return int32(0) +} + +// Parse a complete JSON string. Return 0 on success or non-zero if there +// are any errors. If an error occurs, free all memory associated with +// pParse. +// +// pParse is uninitialized when this routine is called. +func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 { /* sqlite3.c:190584:12: */ + var i int32 + libc.Xmemset(tls, pParse, 0, uint64(unsafe.Sizeof(JsonParse{}))) + if zJson == uintptr(0) { + return 1 + } + (*JsonParse)(unsafe.Pointer(pParse)).FzJson = zJson + i = jsonParseValue(tls, pParse, uint32(0)) + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + i = -1 + } + if i > 0 { + + for jsonIsSpace[uint8(*(*int8)(unsafe.Pointer(zJson + uintptr(i))))] != 0 { + i++ + } + if *(*int8)(unsafe.Pointer(zJson + uintptr(i))) != 0 { + i = -1 + } + } + if i <= 0 { + if pCtx != uintptr(0) { + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + Xsqlite3_result_error_nomem(tls, pCtx) + } else { + Xsqlite3_result_error(tls, pCtx, ts+22820 /* "malformed JSON" */, -1) + } + } + jsonParseReset(tls, pParse) + return 1 + } + return 0 +} + +// Mark node i of pParse as being a child of iParent. Call recursively +// to fill in all the descendants of node i. +func jsonParseFillInParentage(tls *libc.TLS, pParse uintptr, i U32, iParent U32) { /* sqlite3.c:190617:13: */ + var pNode uintptr = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(i)*16) + var j U32 + *(*U32)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaUp + uintptr(i)*4)) = iParent + switch int32((*JsonNode)(unsafe.Pointer(pNode)).FeType) { + case JSON_ARRAY: + { + for j = U32(1); j <= (*JsonNode)(unsafe.Pointer(pNode)).Fn; j = j + (jsonNodeSize(tls, (pNode + uintptr(j)*16))) { + jsonParseFillInParentage(tls, pParse, (i + j), i) + } + break + + } + case JSON_OBJECT: + { + for j = U32(1); j <= (*JsonNode)(unsafe.Pointer(pNode)).Fn; j = j + (jsonNodeSize(tls, ((pNode+uintptr(j)*16)+uintptr(1)*16)) + U32(1)) { + *(*U32)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaUp + uintptr((i+j))*4)) = i + jsonParseFillInParentage(tls, pParse, ((i + j) + U32(1)), i) + } + break + + } + default: + { + break + + } + } +} + +// Compute the parentage of all nodes in a completed parse. +func jsonParseFindParents(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:190644:12: */ + var aUp uintptr + + aUp = libc.AssignPtrUintptr(pParse+24 /* &.aUp */, Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(U32(0)))*uint64((*JsonParse)(unsafe.Pointer(pParse)).FnNode))))) + if aUp == uintptr(0) { + (*JsonParse)(unsafe.Pointer(pParse)).Foom = U8(1) + return SQLITE_NOMEM + } + jsonParseFillInParentage(tls, pParse, uint32(0), uint32(0)) + return SQLITE_OK +} + +// Magic number used for the JSON parse cache in sqlite3_get_auxdata() + +// Obtain a complete parse of the JSON found in the first argument +// of the argv array. Use the sqlite3_get_auxdata() cache for this +// parse if it is available. If the cache is not available or if it +// is no longer valid, parse the JSON again and return the new parse, +// and also register the new parse so that it will be available for +// future sqlite3_get_auxdata() calls. +func jsonParseCached(tls *libc.TLS, pCtx uintptr, argv uintptr, pErrCtx uintptr) uintptr { /* sqlite3.c:190670:18: */ + var zJson uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + var nJson int32 = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + var p uintptr + var pMatch uintptr = uintptr(0) + var iKey int32 + var iMinKey int32 = 0 + var iMinHold U32 = 0xffffffff + var iMaxHold U32 = U32(0) + if zJson == uintptr(0) { + return uintptr(0) + } + for iKey = 0; iKey < JSON_CACHE_SZ; iKey++ { + p = Xsqlite3_get_auxdata(tls, pCtx, ((-429938) + iKey)) + if p == uintptr(0) { + iMinKey = iKey + break + } + if ((pMatch == uintptr(0)) && + ((*JsonParse)(unsafe.Pointer(p)).FnJson == nJson)) && + (libc.Xmemcmp(tls, (*JsonParse)(unsafe.Pointer(p)).FzJson, zJson, uint64(nJson)) == 0) { + (*JsonParse)(unsafe.Pointer(p)).FnErr = U8(0) + pMatch = p + } else if (*JsonParse)(unsafe.Pointer(p)).FiHold < iMinHold { + iMinHold = (*JsonParse)(unsafe.Pointer(p)).FiHold + iMinKey = iKey + } + if (*JsonParse)(unsafe.Pointer(p)).FiHold > iMaxHold { + iMaxHold = (*JsonParse)(unsafe.Pointer(p)).FiHold + } + } + if pMatch != 0 { + (*JsonParse)(unsafe.Pointer(pMatch)).FnErr = U8(0) + (*JsonParse)(unsafe.Pointer(pMatch)).FiHold = (iMaxHold + U32(1)) + return pMatch + } + p = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(JsonParse{})) + uint64(nJson)) + uint64(1)))) + if p == uintptr(0) { + Xsqlite3_result_error_nomem(tls, pCtx) + return uintptr(0) + } + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(JsonParse{}))) + (*JsonParse)(unsafe.Pointer(p)).FzJson = (p + 1*48) + libc.Xmemcpy(tls, (*JsonParse)(unsafe.Pointer(p)).FzJson, zJson, (uint64(nJson + 1))) + if jsonParse(tls, p, pErrCtx, (*JsonParse)(unsafe.Pointer(p)).FzJson) != 0 { + Xsqlite3_free(tls, p) + return uintptr(0) + } + (*JsonParse)(unsafe.Pointer(p)).FnJson = nJson + (*JsonParse)(unsafe.Pointer(p)).FiHold = (iMaxHold + U32(1)) + Xsqlite3_set_auxdata(tls, pCtx, ((-429938) + iMinKey), p, + *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{jsonParseFree}))) + return Xsqlite3_get_auxdata(tls, pCtx, ((-429938) + iMinKey)) +} + +// Compare the OBJECT label at pNode against zKey,nKey. Return true on +// a match. +func jsonLabelCompare(tls *libc.TLS, pNode uintptr, zKey uintptr, nKey U32) int32 { /* sqlite3.c:190732:12: */ + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_RAW) != 0 { + if (*JsonNode)(unsafe.Pointer(pNode)).Fn != nKey { + return 0 + } + return (libc.Bool32(libc.Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */)), zKey, uint64(nKey)) == 0)) + } else { + if (*JsonNode)(unsafe.Pointer(pNode)).Fn != (nKey + U32(2)) { + return 0 + } + return (libc.Bool32(libc.Xstrncmp(tls, (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)), zKey, uint64(nKey)) == 0)) + } + return int32(0) +} + +// Search along zPath to find the node specified. Return a pointer +// to that node, or NULL if zPath is malformed or if there is no such +// node. +// +// If pApnd!=0, then try to append new nodes to complete zPath if it is +// possible to do so and if no existing node corresponds to zPath. If +// new nodes are appended *pApnd is set to 1. +func jsonLookupStep(tls *libc.TLS, pParse uintptr, iRoot U32, zPath uintptr, pApnd uintptr, pzErr uintptr) uintptr { /* sqlite3.c:190754:17: */ + var i U32 + var j U32 + var nKey U32 + var zKey uintptr + var pRoot uintptr = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16) + if int32(*(*int8)(unsafe.Pointer(zPath))) == 0 { + return pRoot + } + if (int32((*JsonNode)(unsafe.Pointer(pRoot)).FjnFlags) & JNODE_REPLACE) != 0 { + return uintptr(0) + } + if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { + if int32((*JsonNode)(unsafe.Pointer(pRoot)).FeType) != JSON_OBJECT { + return uintptr(0) + } + zPath++ + if int32(*(*int8)(unsafe.Pointer(zPath))) == '"' { + zKey = (zPath + uintptr(1)) + for i = U32(1); (*(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != '"'); i++ { + } + nKey = (i - U32(1)) + if *(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0 { + i++ + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = zPath + return uintptr(0) + } + } else { + zKey = zPath + for i = U32(0); ((*(*int8)(unsafe.Pointer(zPath + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != '.')) && (int32(*(*int8)(unsafe.Pointer(zPath + uintptr(i)))) != '['); i++ { + } + nKey = i + } + if nKey == U32(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = zPath + return uintptr(0) + } + j = U32(1) + for { + for j <= (*JsonNode)(unsafe.Pointer(pRoot)).Fn { + if jsonLabelCompare(tls, (pRoot+uintptr(j)*16), zKey, nKey) != 0 { + return jsonLookupStep(tls, pParse, ((iRoot + j) + U32(1)), (zPath + uintptr(i)), pApnd, pzErr) + } + j++ + j = j + (jsonNodeSize(tls, (pRoot + uintptr(j)*16))) + } + if (int32((*JsonNode)(unsafe.Pointer(pRoot)).FjnFlags) & JNODE_APPEND) == 0 { + break + } + iRoot = iRoot + (*(*U32)(unsafe.Pointer(pRoot + 8 /* &.u */))) + pRoot = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16) + j = U32(1) + } + if pApnd != 0 { + var iStart U32 + var iLabel U32 + var pNode uintptr + iStart = U32(jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(2), uintptr(0))) + iLabel = U32(jsonParseAddNode(tls, pParse, uint32(JSON_STRING), nKey, zKey)) + zPath += uintptr(i) + pNode = jsonLookupAppend(tls, pParse, zPath, pApnd, pzErr) + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return uintptr(0) + } + if pNode != 0 { + pRoot = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16) + *(*U32)(unsafe.Pointer(pRoot + 8 /* &.u */)) = (iStart - iRoot) + *(*U8)(unsafe.Pointer(pRoot + 1 /* &.jnFlags */)) |= U8((JNODE_APPEND)) + *(*U8)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iLabel)*16 + 1 /* &.jnFlags */)) |= U8((JNODE_RAW)) + } + return pNode + } + } else if int32(*(*int8)(unsafe.Pointer(zPath))) == '[' { + i = U32(0) + j = U32(1) + for (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zPath + uintptr(j))))]) & 0x04) != 0 { + i = (((i * U32(10)) + U32(*(*int8)(unsafe.Pointer(zPath + uintptr(j))))) - U32('0')) + j++ + } + if (j < U32(2)) || (int32(*(*int8)(unsafe.Pointer(zPath + uintptr(j)))) != ']') { + if int32(*(*int8)(unsafe.Pointer(zPath + 1))) == '#' { + var pBase uintptr = pRoot + var iBase int32 = int32(iRoot) + if int32((*JsonNode)(unsafe.Pointer(pRoot)).FeType) != JSON_ARRAY { + return uintptr(0) + } + for { + for j <= (*JsonNode)(unsafe.Pointer(pBase)).Fn { + if (int32((*JsonNode)(unsafe.Pointer(pBase+uintptr(j)*16)).FjnFlags) & JNODE_REMOVE) == 0 { + i++ + } + j = j + (jsonNodeSize(tls, (pBase + uintptr(j)*16))) + } + if (int32((*JsonNode)(unsafe.Pointer(pBase)).FjnFlags) & JNODE_APPEND) == 0 { + break + } + iBase = int32(U32(iBase) + (*(*U32)(unsafe.Pointer(pBase + 8 /* &.u */)))) + pBase = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iBase)*16) + j = U32(1) + } + j = U32(2) + if (int32(*(*int8)(unsafe.Pointer(zPath + 2))) == '-') && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zPath + 3)))]) & 0x04) != 0) { + var x uint32 = uint32(0) + j = U32(3) + for ok := true; ok; ok = ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zPath + uintptr(j))))]) & 0x04) != 0) { + x = (((x * uint32(10)) + uint32(*(*int8)(unsafe.Pointer(zPath + uintptr(j))))) - uint32('0')) + j++ + } + if x > i { + return uintptr(0) + } + i = i - (x) + } + if int32(*(*int8)(unsafe.Pointer(zPath + uintptr(j)))) != ']' { + *(*uintptr)(unsafe.Pointer(pzErr)) = zPath + return uintptr(0) + } + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = zPath + return uintptr(0) + } + } + if int32((*JsonNode)(unsafe.Pointer(pRoot)).FeType) != JSON_ARRAY { + return uintptr(0) + } + zPath += (uintptr(j + U32(1))) + j = U32(1) + for { + for (j <= (*JsonNode)(unsafe.Pointer(pRoot)).Fn) && ((i > U32(0)) || ((int32((*JsonNode)(unsafe.Pointer(pRoot+uintptr(j)*16)).FjnFlags) & JNODE_REMOVE) != 0)) { + if (int32((*JsonNode)(unsafe.Pointer(pRoot+uintptr(j)*16)).FjnFlags) & JNODE_REMOVE) == 0 { + i-- + } + j = j + (jsonNodeSize(tls, (pRoot + uintptr(j)*16))) + } + if (int32((*JsonNode)(unsafe.Pointer(pRoot)).FjnFlags) & JNODE_APPEND) == 0 { + break + } + iRoot = iRoot + (*(*U32)(unsafe.Pointer(pRoot + 8 /* &.u */))) + pRoot = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16) + j = U32(1) + } + if j <= (*JsonNode)(unsafe.Pointer(pRoot)).Fn { + return jsonLookupStep(tls, pParse, (iRoot + j), zPath, pApnd, pzErr) + } + if (i == U32(0)) && (pApnd != 0) { + var iStart U32 + var pNode uintptr + iStart = U32(jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(1), uintptr(0))) + pNode = jsonLookupAppend(tls, pParse, zPath, pApnd, pzErr) + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return uintptr(0) + } + if pNode != 0 { + pRoot = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16) + *(*U32)(unsafe.Pointer(pRoot + 8 /* &.u */)) = (iStart - iRoot) + *(*U8)(unsafe.Pointer(pRoot + 1 /* &.jnFlags */)) |= U8((JNODE_APPEND)) + } + return pNode + } + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = zPath + } + return uintptr(0) +} + +// Append content to pParse that will complete zPath. Return a pointer +// to the inserted node, or return NULL if the append fails. +func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintptr, pzErr uintptr) uintptr { /* sqlite3.c:190899:17: */ + *(*int32)(unsafe.Pointer(pApnd)) = 1 + if int32(*(*int8)(unsafe.Pointer(zPath))) == 0 { + jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return uintptr(0) + } + return ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(((*JsonParse)(unsafe.Pointer(pParse)).FnNode-U32(1)))*16) + } + if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { + jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) + } else if libc.Xstrncmp(tls, zPath, ts+22835 /* "[0]" */, uint64(3)) == 0 { + jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) + } else { + return uintptr(0) + } + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return uintptr(0) + } + return jsonLookupStep(tls, pParse, ((*JsonParse)(unsafe.Pointer(pParse)).FnNode - U32(1)), zPath, pApnd, pzErr) +} + +// Return the text of a syntax error message on a JSON path. Space is +// obtained from sqlite3_malloc(). +func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190925:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + return Xsqlite3_mprintf(tls, ts+22839 /* "JSON path error ..." */, libc.VaList(bp, zErr)) +} + +// Do a node lookup using zPath. Return a pointer to the node on success. +// Return NULL if not found or if there is an error. +// +// On an error, write an error message into pCtx and increment the +// pParse->nErr counter. +// +// If pApnd!=NULL then try to append missing nodes and set *pApnd = 1 if +// nodes are appended. +func jsonLookup(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintptr, pCtx uintptr) uintptr { /* sqlite3.c:190939:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var zErr uintptr at bp, 8 + + var pNode uintptr + var zMsg uintptr + *(*uintptr)(unsafe.Pointer(bp /* zErr */)) = uintptr(0) + pNode = uintptr(0) + + if !(zPath == uintptr(0)) { + goto __1 + } + return uintptr(0) +__1: + ; + if !(int32(*(*int8)(unsafe.Pointer(zPath))) != '$') { + goto __2 + } + *(*uintptr)(unsafe.Pointer(bp /* zErr */)) = zPath + goto lookup_err +__2: + ; + zPath++ + pNode = jsonLookupStep(tls, pParse, uint32(0), zPath, pApnd, bp /* &zErr */) + if !(*(*uintptr)(unsafe.Pointer(bp /* zErr */)) == uintptr(0)) { + goto __3 + } + return pNode +__3: + ; + +lookup_err: + (*JsonParse)(unsafe.Pointer(pParse)).FnErr++ + + zMsg = jsonPathSyntaxError(tls, *(*uintptr)(unsafe.Pointer(bp /* zErr */))) + if !(zMsg != 0) { + goto __4 + } + Xsqlite3_result_error(tls, pCtx, zMsg, -1) + Xsqlite3_free(tls, zMsg) + goto __5 +__4: + Xsqlite3_result_error_nomem(tls, pCtx) +__5: + ; + return uintptr(0) +} + +// Report the wrong number of arguments for json_insert(), json_replace() +// or json_set(). +func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlite3.c:190976:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22865, /* "json_%s() needs ..." */ + libc.VaList(bp, zFuncName)) + Xsqlite3_result_error(tls, pCtx, zMsg, -1) + Xsqlite3_free(tls, zMsg) +} + +// Mark all NULL entries in the Object passed in as JNODE_REMOVE. +func jsonRemoveAllNulls(tls *libc.TLS, pNode uintptr) { /* sqlite3.c:190989:13: */ + var i int32 + var n int32 + + n = int32((*JsonNode)(unsafe.Pointer(pNode)).Fn) + for i = 2; i <= n; i = int32(U32(i) + (jsonNodeSize(tls, (pNode+uintptr(i)*16)) + U32(1))) { + switch int32((*JsonNode)(unsafe.Pointer(pNode + uintptr(i)*16)).FeType) { + case JSON_NULL: + *(*U8)(unsafe.Pointer(pNode + uintptr(i)*16 + 1 /* &.jnFlags */)) |= U8((JNODE_REMOVE)) + break + case JSON_OBJECT: + jsonRemoveAllNulls(tls, (pNode + uintptr(i)*16)) + break + } + } +} + +// *************************************************************************** +// +// SQL functions used for testing and debugging +// + +// *************************************************************************** +// +// Scalar SQL function implementations +// + +// Implementation of the json_QUOTE(VALUE) function. Return a JSON value +// corresponding to the SQL value input. Mostly this means putting +// double-quotes around strings and returning the unquoted string "null" +// when given a NULL input. +func jsonQuoteFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191074:13: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + // var jx JsonString at bp, 136 + + _ = argc + + jsonInit(tls, bp /* &jx */, ctx) + jsonAppendValue(tls, bp /* &jx */, *(*uintptr)(unsafe.Pointer(argv))) + jsonResult(tls, bp /* &jx */) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +// Implementation of the json_array(VALUE,...) function. Return a JSON +// array that contains all values given in arguments. Or if any argument +// is a BLOB, throw an error. +func jsonArrayFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191093:13: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var i int32 + // var jx JsonString at bp, 136 + + jsonInit(tls, bp /* &jx */, ctx) + jsonAppendChar(tls, bp /* &jx */, int8('[')) + for i = 0; i < argc; i++ { + jsonAppendSeparator(tls, bp /* &jx */) + jsonAppendValue(tls, bp /* &jx */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + } + jsonAppendChar(tls, bp /* &jx */, int8(']')) + jsonResult(tls, bp /* &jx */) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +// json_array_length(JSON) +// json_array_length(JSON, PATH) +// +// Return the number of elements in the top-level JSON array. +// Return 0 if the input is not a well-formed JSON array. +func jsonArrayLengthFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191120:13: */ + var p uintptr // The parse + var n Sqlite3_int64 = int64(0) + var i U32 + var pNode uintptr + + p = jsonParseCached(tls, ctx, argv, ctx) + if p == uintptr(0) { + return + } + + if argc == 2 { + var zPath uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + pNode = jsonLookup(tls, p, zPath, uintptr(0), ctx) + } else { + pNode = (*JsonParse)(unsafe.Pointer(p)).FaNode + } + if pNode == uintptr(0) { + return + } + if int32((*JsonNode)(unsafe.Pointer(pNode)).FeType) == JSON_ARRAY { + + for i = U32(1); i <= (*JsonNode)(unsafe.Pointer(pNode)).Fn; n++ { + i = i + (jsonNodeSize(tls, (pNode + uintptr(i)*16))) + } + } + Xsqlite3_result_int64(tls, ctx, n) +} + +// json_extract(JSON, PATH, ...) +// +// Return the element described by PATH. Return NULL if there is no +// PATH element. If there are multiple PATHs, then return a JSON array +// with the result from each path. Throw an error if the JSON or any PATH +// is malformed. +func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191159:13: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var p uintptr // The parse + var pNode uintptr + var zPath uintptr + // var jx JsonString at bp, 136 + + var i int32 + + if argc < 2 { + return + } + p = jsonParseCached(tls, ctx, argv, ctx) + if p == uintptr(0) { + return + } + jsonInit(tls, bp /* &jx */, ctx) + jsonAppendChar(tls, bp /* &jx */, int8('[')) + for i = 1; i < argc; i++ { + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + pNode = jsonLookup(tls, p, zPath, uintptr(0), ctx) + if (*JsonParse)(unsafe.Pointer(p)).FnErr != 0 { + break + } + if argc > 2 { + jsonAppendSeparator(tls, bp /* &jx */) + if pNode != 0 { + jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) + } else { + jsonAppendRaw(tls, bp /* &jx */, ts+5259 /* "null" */, uint32(4)) + } + } else if pNode != 0 { + jsonReturn(tls, pNode, ctx, uintptr(0)) + } + } + if (argc > 2) && (i == argc) { + jsonAppendChar(tls, bp /* &jx */, int8(']')) + jsonResult(tls, bp /* &jx */) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) + } + jsonReset(tls, bp /* &jx */) +} + +// This is the RFC 7396 MergePatch algorithm. +func jsonMergePatch(tls *libc.TLS, pParse uintptr, iTarget U32, pPatch uintptr) uintptr { /* sqlite3.c:191200:17: */ + var i U32 + var j U32 + var iRoot U32 + var pTarget uintptr + if int32((*JsonNode)(unsafe.Pointer(pPatch)).FeType) != JSON_OBJECT { + return pPatch + } + + pTarget = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iTarget)*16) + + if int32((*JsonNode)(unsafe.Pointer(pTarget)).FeType) != JSON_OBJECT { + jsonRemoveAllNulls(tls, pPatch) + return pPatch + } + iRoot = iTarget + for i = U32(1); i < (*JsonNode)(unsafe.Pointer(pPatch)).Fn; i = i + (jsonNodeSize(tls, (pPatch+uintptr((i+U32(1)))*16)) + U32(1)) { + var nKey U32 + var zKey uintptr + + nKey = (*JsonNode)(unsafe.Pointer(pPatch + uintptr(i)*16)).Fn + zKey = *(*uintptr)(unsafe.Pointer(pPatch + uintptr(i)*16 + 8 /* &.u */)) + + for j = U32(1); j < (*JsonNode)(unsafe.Pointer(pTarget)).Fn; j = j + (jsonNodeSize(tls, (pTarget+uintptr((j+U32(1)))*16)) + U32(1)) { + + if ((*JsonNode)(unsafe.Pointer(pTarget+uintptr(j)*16)).Fn == nKey) && (libc.Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(pTarget + uintptr(j)*16 + 8 /* &.u */)), zKey, uint64(nKey)) == 0) { + if (int32((*JsonNode)(unsafe.Pointer(pTarget+uintptr((j+U32(1)))*16)).FjnFlags) & (JNODE_REMOVE | JNODE_PATCH)) != 0 { + break + } + if int32((*JsonNode)(unsafe.Pointer(pPatch+uintptr((i+U32(1)))*16)).FeType) == JSON_NULL { + *(*U8)(unsafe.Pointer(pTarget + uintptr((j+U32(1)))*16 + 1 /* &.jnFlags */)) |= U8((JNODE_REMOVE)) + } else { + var pNew uintptr = jsonMergePatch(tls, pParse, ((iTarget + j) + U32(1)), (pPatch + uintptr((i+U32(1)))*16)) + if pNew == uintptr(0) { + return uintptr(0) + } + pTarget = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iTarget)*16) + if pNew != (pTarget + uintptr((j+U32(1)))*16) { + *(*uintptr)(unsafe.Pointer(pTarget + uintptr((j+U32(1)))*16 + 8 /* &.u */)) = pNew + *(*U8)(unsafe.Pointer(pTarget + uintptr((j+U32(1)))*16 + 1 /* &.jnFlags */)) |= U8((JNODE_PATCH)) + } + } + break + } + } + if (j >= (*JsonNode)(unsafe.Pointer(pTarget)).Fn) && (int32((*JsonNode)(unsafe.Pointer(pPatch+uintptr((i+U32(1)))*16)).FeType) != JSON_NULL) { + var iStart int32 + var iPatch int32 + iStart = jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(2), uintptr(0)) + jsonParseAddNode(tls, pParse, uint32(JSON_STRING), nKey, zKey) + iPatch = jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) + if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { + return uintptr(0) + } + jsonRemoveAllNulls(tls, pPatch) + pTarget = ((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iTarget)*16) + *(*U8)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16 + 1 /* &.jnFlags */)) |= U8((JNODE_APPEND)) + *(*U32)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iRoot)*16 + 8 /* &.u */)) = (U32(iStart) - iRoot) + iRoot = U32(iStart) + *(*U8)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iPatch)*16 + 1 /* &.jnFlags */)) |= U8((JNODE_PATCH)) + *(*uintptr)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(pParse)).FaNode + uintptr(iPatch)*16 + 8 /* &.u */)) = (pPatch + uintptr((i+U32(1)))*16) + } + } + return pTarget +} + +// Implementation of the json_mergepatch(JSON1,JSON2) function. Return a JSON +// object that is the result of running the RFC 7396 MergePatch() algorithm +// on the two arguments. +func jsonPatchFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191270:13: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + // var x JsonParse at bp, 48 + // The JSON that is being patched + // var y JsonParse at bp+48, 48 + // The patch + var pResult uintptr // The result of the merge + + _ = argc + if jsonParse(tls, bp /* &x */, ctx, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))) != 0 { + return + } + if jsonParse(tls, bp+48 /* &y */, ctx, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) != 0 { + jsonParseReset(tls, bp /* &x */) + return + } + pResult = jsonMergePatch(tls, bp /* &x */, uint32(0), (*JsonParse)(unsafe.Pointer(bp+48 /* &y */)).FaNode) + + if pResult != 0 { + jsonReturnJson(tls, pResult, ctx, uintptr(0)) + } else { + Xsqlite3_result_error_nomem(tls, ctx) + } + jsonParseReset(tls, bp /* &x */) + jsonParseReset(tls, bp+48 /* &y */) +} + +// Implementation of the json_object(NAME,VALUE,...) function. Return a JSON +// object that contains all name/value given in arguments. Or if any name +// is not a string or if any value is a BLOB, throw an error. +func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191302:13: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var i int32 + // var jx JsonString at bp, 136 + + var z uintptr + var n U32 + + if (argc & 1) != 0 { + Xsqlite3_result_error(tls, ctx, + ts+22908 /* "json_object() re..." */, -1) + return + } + jsonInit(tls, bp /* &jx */, ctx) + jsonAppendChar(tls, bp /* &jx */, int8('{')) + for i = 0; i < argc; i = i + (2) { + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != SQLITE_TEXT { + Xsqlite3_result_error(tls, ctx, ts+22959 /* "json_object() la..." */, -1) + jsonReset(tls, bp /* &jx */) + return + } + jsonAppendSeparator(tls, bp /* &jx */) + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + n = U32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))) + jsonAppendString(tls, bp /* &jx */, z, n) + jsonAppendChar(tls, bp /* &jx */, int8(':')) + jsonAppendValue(tls, bp /* &jx */, *(*uintptr)(unsafe.Pointer(argv + uintptr((i+1))*8))) + } + jsonAppendChar(tls, bp /* &jx */, int8('}')) + jsonResult(tls, bp /* &jx */) + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +// json_remove(JSON, PATH, ...) +// +// Remove the named elements from JSON and return the result. malformed +// JSON or PATH arguments result in an error. +func jsonRemoveFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191344:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var x JsonParse at bp, 48 + // The parse + var pNode uintptr + var zPath uintptr + var i U32 + + if !(argc < 1) { + goto __1 + } + return +__1: + ; + if !(jsonParse(tls, bp /* &x */, ctx, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))) != 0) { + goto __2 + } + return +__2: + ; + + i = U32(1) +__3: + if !(i < U32(argc)) { + goto __5 + } + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + if !(zPath == uintptr(0)) { + goto __6 + } + goto remove_done +__6: + ; + pNode = jsonLookup(tls, bp /* &x */, zPath, uintptr(0), ctx) + if !((*JsonParse)(unsafe.Pointer(bp /* &x */)).FnErr != 0) { + goto __7 + } + goto remove_done +__7: + ; + if !(pNode != 0) { + goto __8 + } + *(*U8)(unsafe.Pointer(pNode + 1 /* &.jnFlags */)) |= U8((JNODE_REMOVE)) +__8: + ; + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; + if !((int32((*JsonNode)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode)).FjnFlags) & JNODE_REMOVE) == 0) { + goto __9 + } + jsonReturnJson(tls, (*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode, ctx, uintptr(0)) +__9: + ; +remove_done: + jsonParseReset(tls, bp /* &x */) +} + +// json_replace(JSON, PATH, VALUE, ...) +// +// Replace the value at PATH with VALUE. If PATH does not already exist, +// this routine is a no-op. If JSON or PATH is malformed, throw an error. +func jsonReplaceFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191377:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var x JsonParse at bp, 48 + // The parse + var pNode uintptr + var zPath uintptr + var i U32 + + if !(argc < 1) { + goto __1 + } + return +__1: + ; + if !((argc & 1) == 0) { + goto __2 + } + jsonWrongNumArgs(tls, ctx, ts+14035 /* "replace" */) + return +__2: + ; + if !(jsonParse(tls, bp /* &x */, ctx, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))) != 0) { + goto __3 + } + return +__3: + ; + + i = U32(1) +__4: + if !(i < U32(argc)) { + goto __6 + } + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + pNode = jsonLookup(tls, bp /* &x */, zPath, uintptr(0), ctx) + if !((*JsonParse)(unsafe.Pointer(bp /* &x */)).FnErr != 0) { + goto __7 + } + goto replace_err +__7: + ; + if !(pNode != 0) { + goto __8 + } + *(*U8)(unsafe.Pointer(pNode + 1 /* &.jnFlags */)) |= U8((int32(U8(JNODE_REPLACE)))) + *(*U32)(unsafe.Pointer(pNode + 8 /* &.u */)) = (i + U32(1)) +__8: + ; + goto __5 +__5: + i = i + (U32(2)) + goto __4 + goto __6 +__6: + ; + if !((int32((*JsonNode)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode)).FjnFlags) & JNODE_REPLACE) != 0) { + goto __9 + } + Xsqlite3_result_value(tls, ctx, *(*uintptr)(unsafe.Pointer(argv + uintptr(*(*U32)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode + 8 /* &.u */)))*8))) + goto __10 +__9: + jsonReturnJson(tls, (*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode, ctx, argv) +__10: + ; +replace_err: + jsonParseReset(tls, bp /* &x */) +} + +// json_set(JSON, PATH, VALUE, ...) +// +// Set the value at PATH to VALUE. Create the PATH if it does not already +// exist. Overwrite existing values that do exist. +// If JSON or PATH is malformed, throw an error. +// +// json_insert(JSON, PATH, VALUE, ...) +// +// Create PATH and initialize it to VALUE. If PATH already exists, this +// routine is a no-op. If JSON or PATH is malformed, throw an error. +func jsonSetFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191424:13: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + // var x JsonParse at bp, 48 + // The parse + var pNode uintptr + var zPath uintptr + var i U32 + // var bApnd int32 at bp+48, 4 + + var bIsSet int32 + bIsSet = *(*int32)(unsafe.Pointer(Xsqlite3_user_data(tls, ctx))) + + if !(argc < 1) { + goto __1 + } + return +__1: + ; + if !((argc & 1) == 0) { + goto __2 + } + jsonWrongNumArgs(tls, ctx, func() uintptr { + if bIsSet != 0 { + return ts + 22993 /* "set" */ + } + return ts + 22997 /* "insert" */ + }()) + return +__2: + ; + if !(jsonParse(tls, bp /* &x */, ctx, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))) != 0) { + goto __3 + } + return +__3: + ; + + i = U32(1) +__4: + if !(i < U32(argc)) { + goto __6 + } + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + *(*int32)(unsafe.Pointer(bp + 48 /* bApnd */)) = 0 + pNode = jsonLookup(tls, bp /* &x */, zPath, bp+48 /* &bApnd */, ctx) + if !((*JsonParse)(unsafe.Pointer(bp /* &x */)).Foom != 0) { + goto __7 + } + Xsqlite3_result_error_nomem(tls, ctx) + goto jsonSetDone + goto __8 +__7: + if !((*JsonParse)(unsafe.Pointer(bp /* &x */)).FnErr != 0) { + goto __9 + } + goto jsonSetDone + goto __10 +__9: + if !((pNode != 0) && ((*(*int32)(unsafe.Pointer(bp + 48 /* bApnd */)) != 0) || (bIsSet != 0))) { + goto __11 + } + *(*U8)(unsafe.Pointer(pNode + 1 /* &.jnFlags */)) |= U8((int32(U8(JNODE_REPLACE)))) + *(*U32)(unsafe.Pointer(pNode + 8 /* &.u */)) = (i + U32(1)) +__11: + ; +__10: + ; +__8: + ; + goto __5 +__5: + i = i + (U32(2)) + goto __4 + goto __6 +__6: + ; + if !((int32((*JsonNode)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode)).FjnFlags) & JNODE_REPLACE) != 0) { + goto __12 + } + Xsqlite3_result_value(tls, ctx, *(*uintptr)(unsafe.Pointer(argv + uintptr(*(*U32)(unsafe.Pointer((*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode + 8 /* &.u */)))*8))) + goto __13 +__12: + jsonReturnJson(tls, (*JsonParse)(unsafe.Pointer(bp /* &x */)).FaNode, ctx, argv) +__13: + ; +jsonSetDone: + jsonParseReset(tls, bp /* &x */) +} + +// json_type(JSON) +// json_type(JSON, PATH) +// +// Return the top-level "type" of a JSON string. Throw an error if +// either the JSON or PATH inputs are not well-formed. +func jsonTypeFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191473:13: */ + var p uintptr // The parse + var zPath uintptr + var pNode uintptr + + p = jsonParseCached(tls, ctx, argv, ctx) + if p == uintptr(0) { + return + } + if argc == 2 { + zPath = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + pNode = jsonLookup(tls, p, zPath, uintptr(0), ctx) + } else { + pNode = (*JsonParse)(unsafe.Pointer(p)).FaNode + } + if pNode != 0 { + Xsqlite3_result_text(tls, ctx, jsonType[(*JsonNode)(unsafe.Pointer(pNode)).FeType], -1, uintptr(0)) + } +} + +// json_valid(JSON) +// +// Return 1 if JSON is a well-formed JSON string according to RFC-7159. +// Return 0 otherwise. +func jsonValidFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191501:13: */ + var p uintptr // The parse + _ = argc + p = jsonParseCached(tls, ctx, argv, uintptr(0)) + Xsqlite3_result_int(tls, ctx, (libc.Bool32(p != uintptr(0)))) +} + +// *************************************************************************** +// +// Aggregate SQL function implementations +// +// json_group_array(VALUE) +// +// Return a JSON array composed of all values in the aggregate. +func jsonArrayStep(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191521:13: */ + var pStr uintptr + _ = argc + pStr = Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(JsonString{}))) + if pStr != 0 { + if (*JsonString)(unsafe.Pointer(pStr)).FzBuf == uintptr(0) { + jsonInit(tls, pStr, ctx) + jsonAppendChar(tls, pStr, int8('[')) + } else if (*JsonString)(unsafe.Pointer(pStr)).FnUsed > uint64(1) { + jsonAppendChar(tls, pStr, int8(',')) + } + (*JsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + jsonAppendValue(tls, pStr, *(*uintptr)(unsafe.Pointer(argv))) + } +} + +func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c:191540:13: */ + var pStr uintptr + pStr = Xsqlite3_aggregate_context(tls, ctx, 0) + if pStr != 0 { + (*JsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + jsonAppendChar(tls, pStr, int8(']')) + if (*JsonString)(unsafe.Pointer(pStr)).FbErr != 0 { + if int32((*JsonString)(unsafe.Pointer(pStr)).FbErr) == 1 { + Xsqlite3_result_error_nomem(tls, ctx) + } + + } else if isFinal != 0 { + Xsqlite3_result_text(tls, ctx, (*JsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*JsonString)(unsafe.Pointer(pStr)).FnUsed), + func() uintptr { + if (*JsonString)(unsafe.Pointer(pStr)).FbStatic != 0 { + return libc.UintptrFromInt32(-1) + } + return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free})) + }()) + (*JsonString)(unsafe.Pointer(pStr)).FbStatic = U8(1) + } else { + Xsqlite3_result_text(tls, ctx, (*JsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*JsonString)(unsafe.Pointer(pStr)).FnUsed), libc.UintptrFromInt32(-1)) + (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- + } + } else { + Xsqlite3_result_text(tls, ctx, ts+23004 /* "[]" */, 2, uintptr(0)) + } + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +func jsonArrayValue(tls *libc.TLS, ctx uintptr) { /* sqlite3.c:191562:13: */ + jsonArrayCompute(tls, ctx, 0) +} + +func jsonArrayFinal(tls *libc.TLS, ctx uintptr) { /* sqlite3.c:191565:13: */ + jsonArrayCompute(tls, ctx, 1) +} + +// This method works for both json_group_array() and json_group_object(). +// It works by removing the first element of the group by searching forward +// to the first comma (",") that is not within a string and deleting all +// text through that comma. +func jsonGroupInverse(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191576:13: */ + var i uint32 + var inStr int32 = 0 + var nNest int32 = 0 + var z uintptr + var c int8 + var pStr uintptr + _ = argc + _ = argv + pStr = Xsqlite3_aggregate_context(tls, ctx, 0) + // pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will + // always have been called to initalize it + if !(pStr != 0) { + return + } + z = (*JsonString)(unsafe.Pointer(pStr)).FzBuf + for i = uint32(1); (U64(i) < (*JsonString)(unsafe.Pointer(pStr)).FnUsed) && ((((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(z + uintptr(i)))))) != ',') || (inStr != 0)) || (nNest != 0)); i++ { + if int32(c) == '"' { + inStr = libc.BoolInt32(!(inStr != 0)) + } else if int32(c) == '\\' { + i++ + } else if !(inStr != 0) { + if (int32(c) == '{') || (int32(c) == '[') { + nNest++ + } + if (int32(c) == '}') || (int32(c) == ']') { + nNest-- + } + } + } + if U64(i) < (*JsonString)(unsafe.Pointer(pStr)).FnUsed { + *(*U64)(unsafe.Pointer(pStr + 24 /* &.nUsed */)) -= (U64(i)) + libc.Xmemmove(tls, (z + 1), (z + uintptr((i + uint32(1)))), (Size_t((*JsonString)(unsafe.Pointer(pStr)).FnUsed) - uint64(1))) + *(*int8)(unsafe.Pointer(z + uintptr((*JsonString)(unsafe.Pointer(pStr)).FnUsed))) = int8(0) + } else { + (*JsonString)(unsafe.Pointer(pStr)).FnUsed = uint64(1) + } +} + +// json_group_obj(NAME,VALUE) +// +// Return a JSON object composed of all names and values in the aggregate. +func jsonObjectStep(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* sqlite3.c:191624:13: */ + var pStr uintptr + var z uintptr + var n U32 + _ = argc + pStr = Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(JsonString{}))) + if pStr != 0 { + if (*JsonString)(unsafe.Pointer(pStr)).FzBuf == uintptr(0) { + jsonInit(tls, pStr, ctx) + jsonAppendChar(tls, pStr, int8('{')) + } else if (*JsonString)(unsafe.Pointer(pStr)).FnUsed > uint64(1) { + jsonAppendChar(tls, pStr, int8(',')) + } + (*JsonString)(unsafe.Pointer(pStr)).FpCtx = ctx + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + n = U32(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + jsonAppendString(tls, pStr, z, n) + jsonAppendChar(tls, pStr, int8(':')) + jsonAppendValue(tls, pStr, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + } +} + +func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c:191649:13: */ + var pStr uintptr + pStr = Xsqlite3_aggregate_context(tls, ctx, 0) + if pStr != 0 { + jsonAppendChar(tls, pStr, int8('}')) + if (*JsonString)(unsafe.Pointer(pStr)).FbErr != 0 { + if int32((*JsonString)(unsafe.Pointer(pStr)).FbErr) == 1 { + Xsqlite3_result_error_nomem(tls, ctx) + } + + } else if isFinal != 0 { + Xsqlite3_result_text(tls, ctx, (*JsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*JsonString)(unsafe.Pointer(pStr)).FnUsed), + func() uintptr { + if (*JsonString)(unsafe.Pointer(pStr)).FbStatic != 0 { + return libc.UintptrFromInt32(-1) + } + return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free})) + }()) + (*JsonString)(unsafe.Pointer(pStr)).FbStatic = U8(1) + } else { + Xsqlite3_result_text(tls, ctx, (*JsonString)(unsafe.Pointer(pStr)).FzBuf, int32((*JsonString)(unsafe.Pointer(pStr)).FnUsed), libc.UintptrFromInt32(-1)) + (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- + } + } else { + Xsqlite3_result_text(tls, ctx, ts+23007 /* "{}" */, 2, uintptr(0)) + } + Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) +} + +func jsonObjectValue(tls *libc.TLS, ctx uintptr) { /* sqlite3.c:191670:13: */ + jsonObjectCompute(tls, ctx, 0) +} + +func jsonObjectFinal(tls *libc.TLS, ctx uintptr) { /* sqlite3.c:191673:13: */ + jsonObjectCompute(tls, ctx, 1) +} + +// *************************************************************************** +// +// The json_each virtual table +// +type JsonEachCursor1 = struct { + Fbase Sqlite3_vtab_cursor + FiRowid U32 + FiBegin U32 + Fi U32 + FiEnd U32 + FeType U8 + FbRecursive U8 + _ [6]byte + FzJson uintptr + FzRoot uintptr + FsParse JsonParse +} /* sqlite3.c:191683:9 */ + +// *************************************************************************** +// +// The json_each virtual table +// +type JsonEachCursor = JsonEachCursor1 /* sqlite3.c:191683:31 */ + +// Constructor for the json_each virtual table +func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:191698:12: */ + var pNew uintptr + var rc int32 + + // Column numbers + // The xBestIndex method assumes that the JSON and ROOT columns are + // the last two columns in the table. Should this ever changes, be + // sure to update the xBestIndex method. + + _ = pzErr + _ = argv + _ = argc + _ = pAux + rc = Xsqlite3_declare_vtab(tls, db, + + ts+23010 /* "CREATE TABLE x(k..." */) + if rc == SQLITE_OK { + pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) + if pNew == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_vtab{}))) + Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0) + } + return rc +} + +// destructor for json_each virtual table +func jsonEachDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:191740:12: */ + Xsqlite3_free(tls, pVtab) + return SQLITE_OK +} + +// constructor for a JsonEachCursor object for json_each(). +func jsonEachOpenEach(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* sqlite3.c:191746:12: */ + var pCur uintptr + + _ = p + pCur = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(JsonEachCursor{}))) + if pCur == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(JsonEachCursor{}))) + *(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */) + return SQLITE_OK +} + +// constructor for a JsonEachCursor object for json_tree(). +func jsonEachOpenTree(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* sqlite3.c:191758:12: */ + var rc int32 = jsonEachOpenEach(tls, p, ppCursor) + if rc == SQLITE_OK { + var pCur uintptr = *(*uintptr)(unsafe.Pointer(ppCursor)) + (*JsonEachCursor)(unsafe.Pointer(pCur)).FbRecursive = U8(1) + } + return rc +} + +// Reset a JsonEachCursor back to its original state. Free any memory +// held. +func jsonEachCursorReset(tls *libc.TLS, p uintptr) { /* sqlite3.c:191769:13: */ + Xsqlite3_free(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzJson) + Xsqlite3_free(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot) + jsonParseReset(tls, (p + 48 /* &.sParse */)) + (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid = U32(0) + (*JsonEachCursor)(unsafe.Pointer(p)).Fi = U32(0) + (*JsonEachCursor)(unsafe.Pointer(p)).FiEnd = U32(0) + (*JsonEachCursor)(unsafe.Pointer(p)).FeType = U8(0) + (*JsonEachCursor)(unsafe.Pointer(p)).FzJson = uintptr(0) + (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot = uintptr(0) +} + +// Destructor for a jsonEachCursor object +func jsonEachClose(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:191782:12: */ + var p uintptr = cur + jsonEachCursorReset(tls, p) + Xsqlite3_free(tls, cur) + return SQLITE_OK +} + +// Return TRUE if the jsonEachCursor object has been advanced off the end +// of the JSON object +func jsonEachEof(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:191791:12: */ + var p uintptr = cur + return (libc.Bool32((*JsonEachCursor)(unsafe.Pointer(p)).Fi >= (*JsonEachCursor)(unsafe.Pointer(p)).FiEnd)) +} + +// Advance the cursor to the next element for json_tree() +func jsonEachNext(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:191797:12: */ + var p uintptr = cur + if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + if (int32((*JsonNode)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode+uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*16)).FjnFlags) & JNODE_LABEL) != 0 { + (*JsonEachCursor)(unsafe.Pointer(p)).Fi++ + } + (*JsonEachCursor)(unsafe.Pointer(p)).Fi++ + (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid++ + if (*JsonEachCursor)(unsafe.Pointer(p)).Fi < (*JsonEachCursor)(unsafe.Pointer(p)).FiEnd { + var iUp U32 = *(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4)) + var pUp uintptr = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) + (*JsonEachCursor)(unsafe.Pointer(p)).FeType = (*JsonNode)(unsafe.Pointer(pUp)).FeType + if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { + if iUp == ((*JsonEachCursor)(unsafe.Pointer(p)).Fi - U32(1)) { + *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)) = U32(0) + } else { + *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */))++ + } + } + } + } else { + switch int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) { + case JSON_ARRAY: + { + *(*U32)(unsafe.Pointer(p + 16 /* &.i */)) += (jsonNodeSize(tls, ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*16))) + (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid++ + break + + } + fallthrough + case JSON_OBJECT: + { + *(*U32)(unsafe.Pointer(p + 16 /* &.i */)) += (U32(1) + jsonNodeSize(tls, ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode+uintptr(((*JsonEachCursor)(unsafe.Pointer(p)).Fi+U32(1)))*16))) + (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid++ + break + + } + fallthrough + default: + { + (*JsonEachCursor)(unsafe.Pointer(p)).Fi = (*JsonEachCursor)(unsafe.Pointer(p)).FiEnd + break + + } + } + } + return SQLITE_OK +} + +// Append the name of the path for element i to pStr +func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sqlite3.c:191838:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pNode uintptr + var pUp uintptr + var iUp U32 + if i == U32(0) { + jsonAppendChar(tls, pStr, int8('$')) + return + } + iUp = *(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr(i)*4)) + jsonEachComputePath(tls, p, pStr, iUp) + pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*16) + pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) + if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { + jsonPrintf(tls, 30, pStr, ts+23093 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + } else { + + if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { + pNode -= 16 + } + + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23098 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + } +} + +// Return the value of a column +func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* sqlite3.c:191865:12: */ + bp := tls.Alloc(296) + defer tls.Free(296) + + var p uintptr = cur + var pThis uintptr = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*16) + switch i { + case JEACH_KEY: + { + if (*JsonEachCursor)(unsafe.Pointer(p)).Fi == U32(0) { + break + } + if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { + jsonReturn(tls, pThis, ctx, uintptr(0)) + } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { + var iKey U32 + if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + if (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid == U32(0) { + break + } + iKey = *(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(*(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4)))*16 + 8 /* &.u */)) + } else { + iKey = (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid + } + Xsqlite3_result_int64(tls, ctx, Sqlite3_int64(iKey)) + } + break + + } + case JEACH_VALUE: + { + if (int32((*JsonNode)(unsafe.Pointer(pThis)).FjnFlags) & JNODE_LABEL) != 0 { + pThis += 16 + } + jsonReturn(tls, pThis, ctx, uintptr(0)) + break + + } + case JEACH_TYPE: + { + if (int32((*JsonNode)(unsafe.Pointer(pThis)).FjnFlags) & JNODE_LABEL) != 0 { + pThis += 16 + } + Xsqlite3_result_text(tls, ctx, jsonType[(*JsonNode)(unsafe.Pointer(pThis)).FeType], -1, uintptr(0)) + break + + } + case JEACH_ATOM: + { + if (int32((*JsonNode)(unsafe.Pointer(pThis)).FjnFlags) & JNODE_LABEL) != 0 { + pThis += 16 + } + if int32((*JsonNode)(unsafe.Pointer(pThis)).FeType) >= JSON_ARRAY { + break + } + jsonReturn(tls, pThis, ctx, uintptr(0)) + break + + } + case JEACH_ID: + { + Xsqlite3_result_int64(tls, ctx, + (Sqlite3_int64((*JsonEachCursor)(unsafe.Pointer(p)).Fi) + (Sqlite3_int64(libc.Bool32((int32((*JsonNode)(unsafe.Pointer(pThis)).FjnFlags) & JNODE_LABEL) != 0))))) + break + + } + case JEACH_PARENT: + { + if ((*JsonEachCursor)(unsafe.Pointer(p)).Fi > (*JsonEachCursor)(unsafe.Pointer(p)).FiBegin) && ((*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0) { + Xsqlite3_result_int64(tls, ctx, Sqlite3_int64(*(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4)))) + } + break + + } + case JEACH_FULLKEY: + { + // var x JsonString at bp+24, 136 + + jsonInit(tls, bp+24 /* &x */, ctx) + if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + jsonEachComputePath(tls, p, bp+24 /* &x */, (*JsonEachCursor)(unsafe.Pointer(p)).Fi) + } else { + if (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot != 0 { + jsonAppendRaw(tls, bp+24 /* &x */, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot, uint32(int32(libc.Xstrlen(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot)))) + } else { + jsonAppendChar(tls, bp+24 /* &x */, int8('$')) + } + if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23093 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23098 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + } + } + jsonResult(tls, bp+24 /* &x */) + break + + } + case JEACH_PATH: + { + if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + // var x JsonString at bp+160, 136 + + jsonInit(tls, bp+160 /* &x */, ctx) + jsonEachComputePath(tls, p, bp+160 /* &x */, *(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4))) + jsonResult(tls, bp+160 /* &x */) + break + } + + } + fallthrough + default: + { + var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot + if zRoot == uintptr(0) { + zRoot = ts + 23104 /* "$" */ + } + Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) + break + + } + case JEACH_JSON: + { + + Xsqlite3_result_text(tls, ctx, (*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FzJson, -1, uintptr(0)) + break + + } + } + return SQLITE_OK +} + +// Return the current rowid value +func jsonEachRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* sqlite3.c:191964:12: */ + var p uintptr = cur + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = Sqlite_int64((*JsonEachCursor)(unsafe.Pointer(p)).FiRowid) + return SQLITE_OK +} + +// The query strategy is to look for an equality constraint on the json +// column. Without such a constraint, the table cannot operate. idxNum is +// 1 if the constraint is found, 3 if the constraint and zRoot are found, +// and 0 otherwise. +func jsonEachBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sqlite3.c:191975:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 // Loop counter or computed array index + // var aIdx [2]int32 at bp, 8 + // Index of constraints for JSON and ROOT + var unusableMask int32 = 0 // Mask of unusable JSON and ROOT constraints + var idxMask int32 = 0 // Mask of usable == constraints JSON and ROOT + var pConstraint uintptr + + // This implementation assumes that JSON and ROOT are the last two + // columns in the table + + _ = tab + *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */)) = libc.AssignPtrInt32(bp /* &aIdx */ +1*4, -1) + pConstraint = (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + i = 0 +__1: + if !(i < (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) { + goto __3 + } + { + var iCol int32 + var iMask int32 + if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < JEACH_JSON { + goto __2 + } + iCol = ((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - JEACH_JSON) + + iMask = (int32(1) << iCol) + if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 { + unusableMask = unusableMask | (iMask) + } else if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ { + *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + uintptr(iCol)*4)) = i + idxMask = idxMask | (iMask) + } + + } + goto __2 +__2: + i++ + pConstraint += 12 + goto __1 + goto __3 +__3: + ; + if (unusableMask & ^idxMask) != 0 { + // If there are any unusable constraints on JSON or ROOT, then reject + // this entire plan + return SQLITE_CONSTRAINT + } + if *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */)) < 0 { + // No JSON input. Leave estimatedCost at the huge value that it was + // initialized to to discourage the query planner from selecting this + // plan. + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0 + } else { + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1.0 + i = *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */)) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1) + if *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + 1*4)) < 0 { + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 // Only JSON supplied. Plan 1 + } else { + i = *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + 1*4)) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 2 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 3 // Both JSON and ROOT are supplied. Plan 3 + } + } + return SQLITE_OK +} + +// Start a search on a new JSON string +func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3.c:192033:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = cur + var z uintptr + var zRoot uintptr = uintptr(0) + var n Sqlite3_int64 + + _ = idxStr + _ = argc + jsonEachCursorReset(tls, p) + if idxNum == 0 { + return SQLITE_OK + } + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if z == uintptr(0) { + return SQLITE_OK + } + n = Sqlite3_int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) + (*JsonEachCursor)(unsafe.Pointer(p)).FzJson = Xsqlite3_malloc64(tls, (uint64(n + int64(1)))) + if (*JsonEachCursor)(unsafe.Pointer(p)).FzJson == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzJson, z, (Size_t(n) + uint64(1))) + if jsonParse(tls, (p+48 /* &.sParse */), uintptr(0), (*JsonEachCursor)(unsafe.Pointer(p)).FzJson) != 0 { + var rc int32 = SQLITE_NOMEM + if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { + Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22820 /* "malformed JSON" */, 0) + if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { + rc = SQLITE_ERROR + } + } + jsonEachCursorReset(tls, p) + return rc + } else if ((*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0) && (jsonParseFindParents(tls, (p+48 /* &.sParse */)) != 0) { + jsonEachCursorReset(tls, p) + return SQLITE_NOMEM + } else { + var pNode uintptr = uintptr(0) + if idxNum == 3 { + *(*uintptr)(unsafe.Pointer(bp /* zErr */)) = uintptr(0) + zRoot = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + if zRoot == uintptr(0) { + return SQLITE_OK + } + n = Sqlite3_int64(Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot = Xsqlite3_malloc64(tls, (uint64(n + int64(1)))) + if (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot, zRoot, (Size_t(n) + uint64(1))) + if int32(*(*int8)(unsafe.Pointer(zRoot))) != '$' { + *(*uintptr)(unsafe.Pointer(bp /* zErr */)) = zRoot + } else { + pNode = jsonLookupStep(tls, (p + 48 /* &.sParse */), uint32(0), ((*JsonEachCursor)(unsafe.Pointer(p)).FzRoot + uintptr(1)), uintptr(0), bp /* &zErr */) + } + if *(*uintptr)(unsafe.Pointer(bp /* zErr */)) != 0 { + Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = jsonPathSyntaxError(tls, *(*uintptr)(unsafe.Pointer(bp /* zErr */))) + jsonEachCursorReset(tls, p) + if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { + return SQLITE_ERROR + } + return SQLITE_NOMEM + } else if pNode == uintptr(0) { + return SQLITE_OK + } + } else { + pNode = (*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + } + (*JsonEachCursor)(unsafe.Pointer(p)).FiBegin = libc.AssignPtrUint32(p+16 /* &.i */, U32((int32((int64(pNode) - int64((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode)) / 16)))) + (*JsonEachCursor)(unsafe.Pointer(p)).FeType = (*JsonNode)(unsafe.Pointer(pNode)).FeType + if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) >= JSON_ARRAY { + *(*U32)(unsafe.Pointer(pNode + 8 /* &.u */)) = U32(0) + (*JsonEachCursor)(unsafe.Pointer(p)).FiEnd = (((*JsonEachCursor)(unsafe.Pointer(p)).Fi + (*JsonNode)(unsafe.Pointer(pNode)).Fn) + U32(1)) + if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { + (*JsonEachCursor)(unsafe.Pointer(p)).FeType = (*JsonNode)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(*(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4)))*16)).FeType + if ((*JsonEachCursor)(unsafe.Pointer(p)).Fi > U32(0)) && ((int32((*JsonNode)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode+uintptr(((*JsonEachCursor)(unsafe.Pointer(p)).Fi-U32(1)))*16)).FjnFlags) & JNODE_LABEL) != 0) { + (*JsonEachCursor)(unsafe.Pointer(p)).Fi-- + } + } else { + (*JsonEachCursor)(unsafe.Pointer(p)).Fi++ + } + } else { + (*JsonEachCursor)(unsafe.Pointer(p)).FiEnd = ((*JsonEachCursor)(unsafe.Pointer(p)).Fi + U32(1)) + } + } + return SQLITE_OK +} + +// The methods of the json_each virtual table +var jsonEachModule = Sqlite3_module{ // xCreate + FxConnect: 0, // xConnect + FxBestIndex: 0, // xBestIndex + FxDisconnect: 0, // xDestroy + FxOpen: 0, // xOpen - open a cursor + FxClose: 0, // xClose - close a cursor + FxFilter: 0, // xFilter - configure scan constraints + FxNext: 0, // xNext - advance a cursor + FxEof: 0, // xEof - check for end of scan + FxColumn: 0, // xColumn - read data + FxRowid: 0, // xShadowName +} /* sqlite3.c:192112:23 */ + +// The methods of the json_tree virtual table. +var jsonTreeModule = Sqlite3_module{ // xCreate + FxConnect: 0, // xConnect + FxBestIndex: 0, // xBestIndex + FxDisconnect: 0, // xDestroy + FxOpen: 0, // xOpen - open a cursor + FxClose: 0, // xClose - close a cursor + FxFilter: 0, // xFilter - configure scan constraints + FxNext: 0, // xNext - advance a cursor + FxEof: 0, // xEof - check for end of scan + FxColumn: 0, // xColumn - read data + FxRowid: 0, // xShadowName +} /* sqlite3.c:192140:23 */ + +// *************************************************************************** +// +// The following routines are the only publically visible identifiers in this +// file. Call the following routines in order to register the various SQL +// functions and the virtual table implemented by this file. +// + +func Xsqlite3Json1Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:192174:20: */ + var rc int32 = SQLITE_OK + var i uint32 + for i = uint32(0); (uint64(i) < (uint64(unsafe.Sizeof(aFunc)) / uint64(unsafe.Sizeof(struct { + FzName uintptr + FnArg int32 + Fflag int32 + FxFunc uintptr + }{})))) && (rc == SQLITE_OK); i++ { + rc = Xsqlite3_create_function(tls, db, aFunc[i].FzName, aFunc[i].FnArg, enc, + (uintptr(unsafe.Pointer(&aFunc)) + uintptr(i)*24 + 12 /* &.flag */), + aFunc[i].FxFunc, uintptr(0), uintptr(0)) + } + for i = uint32(0); (uint64(i) < (uint64(unsafe.Sizeof(aAgg)) / uint64(unsafe.Sizeof(struct { + FzName uintptr + FnArg int32 + _ [4]byte + FxStep uintptr + FxFinal uintptr + FxValue uintptr + }{})))) && (rc == SQLITE_OK); i++ { + rc = Xsqlite3_create_window_function(tls, db, aAgg[i].FzName, aAgg[i].FnArg, + (SQLITE_SUBTYPE | enc), uintptr(0), + aAgg[i].FxStep, aAgg[i].FxFinal, + aAgg[i].FxValue, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{jsonGroupInverse})), uintptr(0)) + } + for i = uint32(0); (uint64(i) < (uint64(unsafe.Sizeof(aMod)) / uint64(unsafe.Sizeof(struct { + FzName uintptr + FpModule uintptr + }{})))) && (rc == SQLITE_OK); i++ { + rc = Xsqlite3_create_module(tls, db, aMod[i].FzName, aMod[i].FpModule, uintptr(0)) + } + return rc +} + +var aFunc = [15]struct { + FzName uintptr + FnArg int32 + Fflag int32 + FxFunc uintptr +}{ + {FzName: ts + 23106 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23111 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23122 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23122 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23140 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23153 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23165 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23177 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23188 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23199 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23211 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23224 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23233 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23233 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23243 /* "json_valid" */, FnArg: 1, FxFunc: 0}, +} /* sqlite3.c:192182:5 */ +var aAgg = [2]struct { + FzName uintptr + FnArg int32 + _ [4]byte + FxStep uintptr + FxFinal uintptr + FxValue uintptr +}{ + {FzName: ts + 23254 /* "json_group_array" */, FnArg: 1, + FxStep: 0, FxFinal: 0, FxValue: 0}, + {FzName: ts + 23271 /* "json_group_objec..." */, FnArg: 2, + FxStep: 0, FxFinal: 0, FxValue: 0}, +} /* sqlite3.c:192211:5 */ +var aMod = [2]struct { + FzName uintptr + FpModule uintptr +}{ + {FzName: ts + 23289 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23299 /* "json_tree" */, FpModule: 0}, +} /* sqlite3.c:192221:5 */ +var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core + +// #include +// #include +// #include +// #include + +// The following macro is used to suppress compiler warnings. + +type Rtree1 = struct { + Fbase Sqlite3_vtab + Fdb uintptr + FiNodeSize int32 + FnDim U8 + FnDim2 U8 + FeCoordType U8 + FnBytesPerCell U8 + FinWrTrans U8 + FnAux U8 + FnAuxNotNull U8 + _ [1]byte + FiDepth int32 + FzDb uintptr + FzName uintptr + FnBusy U32 + _ [4]byte + FnRowEst I64 + FnCursor U32 + FnNodeRef U32 + FzReadAuxSql uintptr + FpDeleted uintptr + FiReinsertHeight int32 + _ [4]byte + FpNodeBlob uintptr + FpWriteNode uintptr + FpDeleteNode uintptr + FpReadRowid uintptr + FpWriteRowid uintptr + FpDeleteRowid uintptr + FpReadParent uintptr + FpWriteParent uintptr + FpDeleteParent uintptr + FpWriteAux uintptr + FaHash [97]uintptr +} /* sqlite3.c:192362:9 */ + +// In the SQLite core + +// #include +// #include +// #include +// #include + +// The following macro is used to suppress compiler warnings. + +type Rtree = Rtree1 /* sqlite3.c:192362:22 */ +type RtreeCursor1 = struct { + Fbase Sqlite3_vtab_cursor + FatEOF U8 + FbPoint U8 + FbAuxValid U8 + _ [1]byte + FiStrategy int32 + FnConstraint int32 + _ [4]byte + FaConstraint uintptr + FnPointAlloc int32 + FnPoint int32 + FmxLevel int32 + _ [4]byte + FaPoint uintptr + FpReadAux uintptr + FsPoint RtreeSearchPoint + FaNode [5]uintptr + FanQueue [41]U32 + _ [4]byte +} /* sqlite3.c:192363:9 */ + +type RtreeCursor = RtreeCursor1 /* sqlite3.c:192363:28 */ +type RtreeNode1 = struct { + FpParent uintptr + FiNode I64 + FnRef int32 + FisDirty int32 + FzData uintptr + FpNext uintptr +} /* sqlite3.c:192362:9 */ + +type RtreeNode = RtreeNode1 /* sqlite3.c:192364:26 */ +type RtreeCell1 = struct { + FiRowid I64 + FaCoord [10]RtreeCoord +} /* sqlite3.c:192365:9 */ + +type RtreeCell = RtreeCell1 /* sqlite3.c:192365:26 */ +type RtreeConstraint1 = struct { + FiCoord int32 + Fop int32 + Fu struct{ FrValue RtreeDValue } + FpInfo uintptr +} /* sqlite3.c:192363:9 */ + +type RtreeConstraint = RtreeConstraint1 /* sqlite3.c:192366:32 */ +type RtreeMatchArg1 = struct { + FiSize U32 + _ [4]byte + Fcb RtreeGeomCallback + FnParam int32 + _ [4]byte + FapSqlParam uintptr + FaParam [1]RtreeDValue +} /* sqlite3.c:192367:9 */ + +type RtreeMatchArg = RtreeMatchArg1 /* sqlite3.c:192367:30 */ +type RtreeGeomCallback1 = struct { + FxGeom uintptr + FxQueryFunc uintptr + FxDestructor uintptr + FpContext uintptr +} /* sqlite3.c:192367:9 */ + +type RtreeGeomCallback = RtreeGeomCallback1 /* sqlite3.c:192368:34 */ +type RtreeCoord1 = struct{ Ff RtreeValue } /* sqlite3.c:192365:9 */ + +type RtreeCoord = RtreeCoord1 /* sqlite3.c:192369:26 */ +type RtreeSearchPoint1 = struct { + FrScore RtreeDValue + Fid Sqlite3_int64 + FiLevel U8 + FeWithin U8 + FiCell U8 + _ [5]byte +} /* sqlite3.c:192363:9 */ + +type RtreeSearchPoint = RtreeSearchPoint1 /* sqlite3.c:192370:33 */ + +// Possible values for Rtree.eCoordType: + +// If SQLITE_RTREE_INT_ONLY is defined, then this virtual table will +// only deal with integer coordinates. No floating point operations +// will be done. +type RtreeDValue = float64 /* sqlite3.c:192465:18 */ // High accuracy coordinate +type RtreeValue = float32 /* sqlite3.c:192466:17 */ + +// What version of GCC is being used. 0 means GCC is not being used . +// Note that the GCC_VERSION macro will also be set correctly when using +// clang, since clang works hard to be gcc compatible. So the gcc +// optimizations will also work when compiling with clang. + +// The testcase() macro should already be defined in the amalgamation. If +// it is not, make it a no-op. + +// Make sure that the compiler intrinsics we desire are enabled when +// compiling with an appropriate version of MSVC unless prevented by +// the SQLITE_DISABLE_INTRINSIC define. + +// Macros to determine whether the machine is big or little endian, +// and whether or not that determination is run-time or compile-time. +// +// For best performance, an attempt is made to guess at the byte-order +// using C-preprocessor macros. If that is unsuccessful, or if +// -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined +// at run-time. + +// What version of MSVC is being used. 0 means MSVC is not being used + +// Functions to deserialize a 16 bit integer, 32 bit real number and +// 64 bit integer. The deserialized value is returned. +func readInt16(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:192745:12: */ + return ((int32(*(*U8)(unsafe.Pointer(p))) << 8) + int32(*(*U8)(unsafe.Pointer(p + 1)))) +} + +func readCoord(tls *libc.TLS, p uintptr, pCoord uintptr) { /* sqlite3.c:192748:13: */ + // p is always 4-byte aligned + (*(*U32)(unsafe.Pointer(pCoord /* .Fu */))) = libc.X__builtin_bswap32(tls, *(*U32)(unsafe.Pointer(p))) +} + +func readInt64(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:192765:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var x U64 at bp, 8 + + libc.Xmemcpy(tls, bp /* &x */, p, uint64(8)) + return I64(libc.X__builtin_bswap64(tls, uint64(*(*U64)(unsafe.Pointer(bp /* x */))))) +} + +// Functions to serialize a 16 bit integer, 32 bit real number and +// 64 bit integer. The value returned is the number of bytes written +// to the argument buffer (always 2, 4 and 8 respectively). +func writeInt16(tls *libc.TLS, p uintptr, i int32) { /* sqlite3.c:192797:13: */ + *(*U8)(unsafe.Pointer(p)) = (U8((i >> 8) & 0xFF)) + *(*U8)(unsafe.Pointer(p + 1)) = (U8((i >> 0) & 0xFF)) +} + +func writeCoord(tls *libc.TLS, p uintptr, pCoord uintptr) int32 { /* sqlite3.c:192801:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var i U32 at bp, 4 + + // p is always 4-byte aligned + + *(*U32)(unsafe.Pointer(bp /* i */)) = libc.X__builtin_bswap32(tls, *(*U32)(unsafe.Pointer(pCoord /* .Fu */))) + libc.Xmemcpy(tls, p, bp /* &i */, uint64(4)) + return 4 +} + +func writeInt64(tls *libc.TLS, p uintptr, i I64) int32 { /* sqlite3.c:192824:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + *(*I64)(unsafe.Pointer(bp)) = i + + *(*I64)(unsafe.Pointer(bp /* i */)) = I64(libc.X__builtin_bswap64(tls, uint64(U64(*(*I64)(unsafe.Pointer(bp /* i */)))))) + libc.Xmemcpy(tls, p, bp /* &i */, uint64(8)) + return 8 +} + +// Increment the reference count of node p. +func nodeReference(tls *libc.TLS, p uintptr) { /* sqlite3.c:192849:13: */ + if p != 0 { + + (*RtreeNode)(unsafe.Pointer(p)).FnRef++ + } +} + +// Clear the content of node p (set all bytes to 0x00). +func nodeZero(tls *libc.TLS, pRtree uintptr, p uintptr) { /* sqlite3.c:192859:13: */ + libc.Xmemset(tls, ((*RtreeNode)(unsafe.Pointer(p)).FzData + 2), 0, (uint64((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize - 2))) + (*RtreeNode)(unsafe.Pointer(p)).FisDirty = 1 +} + +// Given a node number iNode, return the corresponding key to use +// in the Rtree.aHash table. +func nodeHash(tls *libc.TLS, iNode I64) uint32 { /* sqlite3.c:192868:21: */ + return ((uint32(iNode)) % uint32(HASHSIZE)) +} + +// Search the node hash table for node iNode. If found, return a pointer +// to it. Otherwise, return 0. +func nodeHashLookup(tls *libc.TLS, pRtree uintptr, iNode I64) uintptr { /* sqlite3.c:192876:18: */ + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((pRtree + 192 /* &.aHash */) + uintptr(nodeHash(tls, iNode))*8)); (p != 0) && ((*RtreeNode)(unsafe.Pointer(p)).FiNode != iNode); p = (*RtreeNode)(unsafe.Pointer(p)).FpNext { + } + return p +} + +// Add node pNode to the node hash table. +func nodeHashInsert(tls *libc.TLS, pRtree uintptr, pNode uintptr) { /* sqlite3.c:192885:13: */ + var iHash int32 + + iHash = int32(nodeHash(tls, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode)) + (*RtreeNode)(unsafe.Pointer(pNode)).FpNext = *(*uintptr)(unsafe.Pointer((pRtree + 192 /* &.aHash */) + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((pRtree + 192 /* &.aHash */) + uintptr(iHash)*8)) = pNode +} + +// Remove node pNode from the node hash table. +func nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { /* sqlite3.c:192896:13: */ + var pp uintptr + if (*RtreeNode)(unsafe.Pointer(pNode)).FiNode != int64(0) { + pp = ((pRtree + 192 /* &.aHash */) + uintptr(nodeHash(tls, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode))*8) + for ; (*(*uintptr)(unsafe.Pointer(pp))) != pNode; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 32 /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = (*RtreeNode)(unsafe.Pointer(pNode)).FpNext + (*RtreeNode)(unsafe.Pointer(pNode)).FpNext = uintptr(0) + } +} + +// Allocate and return new r-tree node. Initially, (RtreeNode.iNode==0), +// indicating that node has not yet been assigned a node number. It is +// assigned a node number when nodeWrite() is called to write the +// node contents out to the database. +func nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) uintptr { /* sqlite3.c:192912:18: */ + var pNode uintptr + pNode = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(RtreeNode{})) + uint64((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)))) + if pNode != 0 { + libc.Xmemset(tls, pNode, 0, (uint64(unsafe.Sizeof(RtreeNode{})) + uint64((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize))) + (*RtreeNode)(unsafe.Pointer(pNode)).FzData = (pNode + 1*40) + (*RtreeNode)(unsafe.Pointer(pNode)).FnRef = 1 + (*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef++ + (*RtreeNode)(unsafe.Pointer(pNode)).FpParent = pParent + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 1 + nodeReference(tls, pParent) + } + return pNode +} + +// Clear the Rtree.pNodeBlob object +func nodeBlobReset(tls *libc.TLS, pRtree uintptr) { /* sqlite3.c:192930:13: */ + if (((*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0) && (int32((*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans) == 0)) && ((*Rtree)(unsafe.Pointer(pRtree)).FnCursor == U32(0)) { + var pBlob uintptr = (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + Xsqlite3_blob_close(tls, pBlob) + } +} + +// Check to see if pNode is the same as pParent or any of the parents +// of pParent. +func nodeInParentChain(tls *libc.TLS, pNode uintptr, pParent uintptr) int32 { /* sqlite3.c:192942:12: */ + for ok := true; ok; ok = pParent != 0 { + if pNode == pParent { + return 1 + } + pParent = (*RtreeNode)(unsafe.Pointer(pParent)).FpParent + } + return 0 +} + +// Obtain a reference to an r-tree node. +func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNode uintptr) int32 { /* sqlite3.c:192953:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var pNode uintptr = uintptr(0) + + // Check if the requested node is already in the hash table. If so, + // increase its reference count and return it. + if (libc.AssignUintptr(&pNode, nodeHashLookup(tls, pRtree, iNode))) != uintptr(0) { + if (pParent != 0) && !(int32((*RtreeNode)(unsafe.Pointer(pNode)).FpParent) != 0) { + if nodeInParentChain(tls, pNode, pParent) != 0 { + + return (SQLITE_CORRUPT | (int32(1) << 8)) + } + (*RtreeNode)(unsafe.Pointer(pParent)).FnRef++ + (*RtreeNode)(unsafe.Pointer(pNode)).FpParent = pParent + } else if ((pParent != 0) && ((*RtreeNode)(unsafe.Pointer(pNode)).FpParent != 0)) && (pParent != (*RtreeNode)(unsafe.Pointer(pNode)).FpParent) { + + return (SQLITE_CORRUPT | (int32(1) << 8)) + } + (*RtreeNode)(unsafe.Pointer(pNode)).FnRef++ + *(*uintptr)(unsafe.Pointer(ppNode)) = pNode + return SQLITE_OK + } + + if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob != 0 { + var pBlob uintptr = (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob + (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob = uintptr(0) + rc = Xsqlite3_blob_reopen(tls, pBlob, iNode) + (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob = pBlob + if rc != 0 { + nodeBlobReset(tls, pRtree) + if rc == SQLITE_NOMEM { + return SQLITE_NOMEM + } + } + } + if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23309 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + if zTab == uintptr(0) { + return SQLITE_NOMEM + } + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23317 /* "data" */, iNode, 0, + (pRtree + 112 /* &.pNodeBlob */)) + Xsqlite3_free(tls, zTab) + } + if rc != 0 { + nodeBlobReset(tls, pRtree) + *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) + // If unable to open an sqlite3_blob on the desired row, that can only + // be because the shadow tables hold erroneous data. + if rc == SQLITE_ERROR { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + + } + } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize == Xsqlite3_blob_bytes(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob) { + pNode = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(RtreeNode{})) + uint64((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)))) + if !(pNode != 0) { + rc = SQLITE_NOMEM + } else { + (*RtreeNode)(unsafe.Pointer(pNode)).FpParent = pParent + (*RtreeNode)(unsafe.Pointer(pNode)).FzData = (pNode + 1*40) + (*RtreeNode)(unsafe.Pointer(pNode)).FnRef = 1 + (*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef++ + (*RtreeNode)(unsafe.Pointer(pNode)).FiNode = iNode + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 0 + (*RtreeNode)(unsafe.Pointer(pNode)).FpNext = uintptr(0) + rc = Xsqlite3_blob_read(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob, (*RtreeNode)(unsafe.Pointer(pNode)).FzData, + (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize, 0) + } + } + + // If the root node was just loaded, set pRtree->iDepth to the height + // of the r-tree structure. A height of zero means all data is stored on + // the root node. A height of one means the children of the root node + // are the leaves, and so on. If the depth as specified on the root node + // is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt. + if ((pNode != 0) && (rc == SQLITE_OK)) && (iNode == int64(1)) { + (*Rtree)(unsafe.Pointer(pRtree)).FiDepth = readInt16(tls, (*RtreeNode)(unsafe.Pointer(pNode)).FzData) + if (*Rtree)(unsafe.Pointer(pRtree)).FiDepth > RTREE_MAX_DEPTH { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + + } + } + + // If no error has occurred so far, check if the "number of entries" + // field on the node is too large. If so, set the return code to + // SQLITE_CORRUPT_VTAB. + if (pNode != 0) && (rc == SQLITE_OK) { + if readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData+2)) > (((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + + } + } + + if rc == SQLITE_OK { + if pNode != uintptr(0) { + nodeReference(tls, pParent) + nodeHashInsert(tls, pRtree, pNode) + } else { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + + } + *(*uintptr)(unsafe.Pointer(ppNode)) = pNode + } else { + if pNode != 0 { + (*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef-- + Xsqlite3_free(tls, pNode) + } + *(*uintptr)(unsafe.Pointer(ppNode)) = uintptr(0) + } + + return rc +} + +// Overwrite cell iCell of node pNode with the contents of pCell. +func nodeOverwriteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iCell int32) { /* sqlite3.c:193073:13: */ + var ii int32 + var p uintptr = ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr((4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * iCell)))) + p += uintptr(writeInt64(tls, p, (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid)) + for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2); ii++ { + p += uintptr(writeCoord(tls, p, ((pCell + 8 /* &.aCoord */) + uintptr(ii)*4))) + } + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 1 +} + +// Remove the cell with index iCell from node pNode. +func nodeDeleteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32) { /* sqlite3.c:193091:13: */ + var pDst uintptr = ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr((4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * iCell)))) + var pSrc uintptr = (pDst + uintptr((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)) + var nByte int32 = (((readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData+2)) - iCell) - 1) * int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)) + libc.Xmemmove(tls, pDst, pSrc, uint64(nByte)) + writeInt16(tls, ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + 2), (readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData+2)) - 1)) + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 1 +} + +// Insert the contents of cell pCell into node pNode. If the insert +// is successful, return SQLITE_OK. +// +// If there is not enough free space in pNode, return SQLITE_FULL. +func nodeInsertCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr) int32 { /* sqlite3.c:193106:12: */ + var nCell int32 // Current number of cells in pNode + var nMaxCell int32 // Maximum number of cells for pNode + + nMaxCell = (((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell)) + nCell = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData + 2)) + + if nCell < nMaxCell { + nodeOverwriteCell(tls, pRtree, pNode, pCell, nCell) + writeInt16(tls, ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + 2), (nCell + 1)) + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 1 + } + + return (libc.Bool32(nCell == nMaxCell)) +} + +// If the node is dirty, write it out to the database. +func nodeWrite(tls *libc.TLS, pRtree uintptr, pNode uintptr) int32 { /* sqlite3.c:193130:12: */ + var rc int32 = SQLITE_OK + if (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty != 0 { + var p uintptr = (*Rtree)(unsafe.Pointer(pRtree)).FpWriteNode + if (*RtreeNode)(unsafe.Pointer(pNode)).FiNode != 0 { + Xsqlite3_bind_int64(tls, p, 1, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + } else { + Xsqlite3_bind_null(tls, p, 1) + } + Xsqlite3_bind_blob(tls, p, 2, (*RtreeNode)(unsafe.Pointer(pNode)).FzData, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize, uintptr(0)) + Xsqlite3_step(tls, p) + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 0 + rc = Xsqlite3_reset(tls, p) + Xsqlite3_bind_null(tls, p, 2) + if ((*RtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(0)) && (rc == SQLITE_OK) { + (*RtreeNode)(unsafe.Pointer(pNode)).FiNode = Xsqlite3_last_insert_rowid(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb) + nodeHashInsert(tls, pRtree, pNode) + } + } + return rc +} + +// Release a reference to a node. If the node is dirty and the reference +// count drops to zero, the node data is written to the database. +func nodeRelease(tls *libc.TLS, pRtree uintptr, pNode uintptr) int32 { /* sqlite3.c:193156:12: */ + var rc int32 = SQLITE_OK + if pNode != 0 { + + (*RtreeNode)(unsafe.Pointer(pNode)).FnRef-- + if (*RtreeNode)(unsafe.Pointer(pNode)).FnRef == 0 { + (*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef-- + if (*RtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1) { + (*Rtree)(unsafe.Pointer(pRtree)).FiDepth = -1 + } + if (*RtreeNode)(unsafe.Pointer(pNode)).FpParent != 0 { + rc = nodeRelease(tls, pRtree, (*RtreeNode)(unsafe.Pointer(pNode)).FpParent) + } + if rc == SQLITE_OK { + rc = nodeWrite(tls, pRtree, pNode) + } + nodeHashDelete(tls, pRtree, pNode) + Xsqlite3_free(tls, pNode) + } + } + return rc +} + +// Return the 64-bit integer value associated with cell iCell of +// node pNode. If pNode is a leaf node, this is a rowid. If it is +// an internal node, then the 64-bit integer is a child page number. +func nodeGetRowid(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32) I64 { /* sqlite3.c:193185:12: */ + + return readInt64(tls, ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr((4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * iCell))))) +} + +// Return coordinate iCoord from cell iCell in node pNode. +func nodeGetCoord(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, iCoord int32, pCoord uintptr) { /* sqlite3.c:193197:13: */ + readCoord(tls, ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr(((12 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * iCell)) + (4 * iCoord)))), pCoord) +} + +// Deserialize cell iCell of node pNode. Populate the structure pointed +// to by pCell with the results. +func nodeGetCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, pCell uintptr) { /* sqlite3.c:193211:13: */ + var pData uintptr + var pCoord uintptr + var ii int32 = 0 + (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid = nodeGetRowid(tls, pRtree, pNode, iCell) + pData = ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr((12 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * iCell)))) + pCoord = pCell + 8 /* &.aCoord */ + for ok := true; ok; ok = (ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2)) { + readCoord(tls, pData, (pCoord + uintptr(ii)*4)) + readCoord(tls, (pData + uintptr(4)), (pCoord + uintptr((ii+1))*4)) + pData += uintptr(8) + ii = ii + (2) + } +} + +// Rtree virtual table module xCreate method. +func rtreeCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:193242:12: */ + return rtreeInit(tls, db, pAux, argc, argv, ppVtab, pzErr, 1) +} + +// Rtree virtual table module xConnect method. +func rtreeConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:193255:12: */ + return rtreeInit(tls, db, pAux, argc, argv, ppVtab, pzErr, 0) +} + +// Increment the r-tree reference count. +func rtreeReference(tls *libc.TLS, pRtree uintptr) { /* sqlite3.c:193268:13: */ + (*Rtree)(unsafe.Pointer(pRtree)).FnBusy++ +} + +// Decrement the r-tree reference count. When the reference count reaches +// zero the structure is deleted. +func rtreeRelease(tls *libc.TLS, pRtree uintptr) { /* sqlite3.c:193276:13: */ + (*Rtree)(unsafe.Pointer(pRtree)).FnBusy-- + if (*Rtree)(unsafe.Pointer(pRtree)).FnBusy == U32(0) { + (*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans = U8(0) + + nodeBlobReset(tls, pRtree) + + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteNode) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteNode) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteRowid) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadParent) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteParent) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteParent) + Xsqlite3_finalize(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteAux) + Xsqlite3_free(tls, (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql) + Xsqlite3_free(tls, pRtree) + } +} + +// Rtree virtual table module xDisconnect method. +func rtreeDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193300:12: */ + rtreeRelease(tls, pVtab) + return SQLITE_OK +} + +// Rtree virtual table module xDestroy method. +func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pRtree uintptr = pVtab + var rc int32 + var zCreate uintptr = Xsqlite3_mprintf(tls, + + ts+23322, /* "DROP TABLE '%q'...." */ + libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, + (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, + (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + if !(zCreate != 0) { + rc = SQLITE_NOMEM + } else { + nodeBlobReset(tls, pRtree) + rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zCreate, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_free(tls, zCreate) + } + if rc == SQLITE_OK { + rtreeRelease(tls, pRtree) + } + + return rc +} + +// Rtree virtual table module xOpen method. +func rtreeOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* sqlite3.c:193336:12: */ + var rc int32 = SQLITE_NOMEM + var pRtree uintptr = pVTab + var pCsr uintptr + + pCsr = Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(RtreeCursor{}))) + if pCsr != 0 { + libc.Xmemset(tls, pCsr, 0, uint64(unsafe.Sizeof(RtreeCursor{}))) + (*RtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab = pVTab + rc = SQLITE_OK + (*Rtree)(unsafe.Pointer(pRtree)).FnCursor++ + } + *(*uintptr)(unsafe.Pointer(ppCursor)) = pCsr + + return rc +} + +// Reset a cursor back to its initial state. +func resetCursor(tls *libc.TLS, pCsr uintptr) { /* sqlite3.c:193357:13: */ + var pRtree uintptr = (*RtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var ii int32 + var pStmt uintptr + if (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint != 0 { + var i int32 // Used to iterate through constraint array + for i = 0; i < (*RtreeCursor)(unsafe.Pointer(pCsr)).FnConstraint; i++ { + var pInfo uintptr = (*RtreeConstraint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint + uintptr(i)*24)).FpInfo + if pInfo != 0 { + if (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FxDelUser != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pInfo + 32 /* &.xDelUser */))))(tls, (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FpUser) + } + Xsqlite3_free(tls, pInfo) + } + } + Xsqlite3_free(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) + (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = uintptr(0) + } + for ii = 0; ii < RTREE_CACHE_SZ; ii++ { + nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer((pCsr + 88 /* &.aNode */) + uintptr(ii)*8))) + } + Xsqlite3_free(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FaPoint) + pStmt = (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux + libc.Xmemset(tls, pCsr, 0, uint64(unsafe.Sizeof(RtreeCursor{}))) + (*RtreeCursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab = pRtree + (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux = pStmt + +} + +// Rtree virtual table module xClose method. +func rtreeClose(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:193385:12: */ + var pRtree uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab + var pCsr uintptr = cur + + resetCursor(tls, pCsr) + Xsqlite3_finalize(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + Xsqlite3_free(tls, pCsr) + (*Rtree)(unsafe.Pointer(pRtree)).FnCursor-- + nodeBlobReset(tls, pRtree) + return SQLITE_OK +} + +// Rtree virtual table module xEof method. +// +// Return non-zero if the cursor does not currently point to a valid +// record (i.e if the scan has finished), or zero otherwise. +func rtreeEof(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:193403:12: */ + var pCsr uintptr = cur + return int32((*RtreeCursor)(unsafe.Pointer(pCsr)).FatEOF) +} + +// Convert raw bits from the on-disk RTree record into a coordinate value. +// The on-disk format is big-endian and needs to be converted for little- +// endian platforms. The on-disk record stores integer coordinates if +// eInt is true and it stores 32-bit floating point records if eInt is +// false. a[] is the four bytes of the on-disk record to be decoded. +// Store the results in "r". +// +// There are five versions of this macro. The last one is generic. The +// other four are various architectures-specific optimizations. + +// Check the RTree node or entry given by pCellData and p against the MATCH +// constraint pConstraint. +func rtreeCallbackConstraint(tls *libc.TLS, pConstraint uintptr, eInt int32, pCellData uintptr, pSearch uintptr, prScore uintptr, peWithin uintptr) int32 { /* sqlite3.c:193458:12: */ + bp := tls.Alloc(92) + defer tls.Free(92) + + var pInfo uintptr = (*RtreeConstraint)(unsafe.Pointer(pConstraint)).FpInfo // Callback info + var nCoord int32 = (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FnCoord // No. of coordinates + var rc int32 // Callback return code + // var c RtreeCoord at bp, 4 + // Translator union + // var aCoord [10]Sqlite3_rtree_dbl at bp+8, 80 + // Decoded coordinates + + if ((*RtreeConstraint)(unsafe.Pointer(pConstraint)).Fop == RTREE_QUERY) && (int32((*RtreeSearchPoint)(unsafe.Pointer(pSearch)).FiLevel) == 1) { + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FiRowid = readInt64(tls, pCellData) + } + pCellData += uintptr(8) + if eInt == 0 { + switch nCoord { + case 10: + readCoord(tls, (pCellData + uintptr(36)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 9*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(32)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 8*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + fallthrough + case 8: + readCoord(tls, (pCellData + uintptr(28)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 7*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(24)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 6*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + fallthrough + case 6: + readCoord(tls, (pCellData + uintptr(20)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 5*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(16)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 4*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + fallthrough + case 4: + readCoord(tls, (pCellData + uintptr(12)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 3*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(8)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 2*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + fallthrough + default: + readCoord(tls, (pCellData + uintptr(4)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 1*8)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, pCellData, bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */)) = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + } + } else { + switch nCoord { + case 10: + readCoord(tls, (pCellData + uintptr(36)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 9*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(32)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 8*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + fallthrough + case 8: + readCoord(tls, (pCellData + uintptr(28)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 7*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(24)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 6*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + fallthrough + case 6: + readCoord(tls, (pCellData + uintptr(20)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 5*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(16)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 4*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + fallthrough + case 4: + readCoord(tls, (pCellData + uintptr(12)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 3*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, (pCellData + uintptr(8)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 2*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + fallthrough + default: + readCoord(tls, (pCellData + uintptr(4)), bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */ + 1*8)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + readCoord(tls, pCellData, bp /* &c */) + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* &aCoord[0] */)) = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + } + } + if (*RtreeConstraint)(unsafe.Pointer(pConstraint)).Fop == RTREE_MATCH { + *(*int32)(unsafe.Pointer(bp + 88 /* eWithin */)) = 0 + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pConstraint + 8 /* &.u */ /* &.xGeom */))))(tls, pInfo, + nCoord, bp+8 /* &aCoord[0] */, bp+88 /* &eWithin */) + if *(*int32)(unsafe.Pointer(bp + 88 /* eWithin */)) == 0 { + *(*int32)(unsafe.Pointer(peWithin)) = NOT_WITHIN + } + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(prScore)) = 0.0 + } else { + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FaCoord = bp + 8 /* &aCoord[0] */ + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FiLevel = (int32((*RtreeSearchPoint)(unsafe.Pointer(pSearch)).FiLevel) - 1) + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FrScore = libc.AssignPtrFloat64(pInfo+80 /* &.rParentScore */, (*RtreeSearchPoint)(unsafe.Pointer(pSearch)).FrScore) + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FeWithin = libc.AssignPtrInt32(pInfo+88 /* &.eParentWithin */, int32((*RtreeSearchPoint)(unsafe.Pointer(pSearch)).FeWithin)) + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pConstraint + 8 /* &.u */ /* &.xQueryFunc */))))(tls, pInfo) + if (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FeWithin < *(*int32)(unsafe.Pointer(peWithin)) { + *(*int32)(unsafe.Pointer(peWithin)) = (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FeWithin + } + if ((*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FrScore < *(*Sqlite3_rtree_dbl)(unsafe.Pointer(prScore))) || (*(*Sqlite3_rtree_dbl)(unsafe.Pointer(prScore)) < 0.0) { + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(prScore)) = (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FrScore + } + } + return rc +} + +// Check the internal RTree node given by pCellData against constraint p. +// If this constraint cannot be satisfied by any child within the node, +// set *peWithin to NOT_WITHIN. +func rtreeNonleafConstraint(tls *libc.TLS, p uintptr, eInt int32, pCellData uintptr, peWithin uintptr) { /* sqlite3.c:193534:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var val Sqlite3_rtree_dbl // Coordinate value convert to a double + + // p->iCoord might point to either a lower or upper bound coordinate + // in a coordinate pair. But make pCellData point to the lower bound. + pCellData += (uintptr(8 + (4 * ((*RtreeConstraint)(unsafe.Pointer(p)).FiCoord & 0xfe)))) + + // 4-byte aligned + switch (*RtreeConstraint)(unsafe.Pointer(p)).Fop { + case RTREE_TRUE: + return // Always satisfied + case RTREE_FALSE: + break // Never satisfied + case RTREE_LE: + fallthrough + case RTREE_LT: + fallthrough + case RTREE_EQ: + { + // var c RtreeCoord at bp, 4 + /* Coordinate decoded */ + *(*U32)(unsafe.Pointer(bp /* &c */)) = libc.X__builtin_bswap32(tls, *(*U32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + val = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + } else { + val = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + } + } + + // val now holds the lower bound of the coordinate pair + if *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) >= val { + return + } + if (*RtreeConstraint)(unsafe.Pointer(p)).Fop != RTREE_EQ { + break + } + fallthrough // RTREE_LE and RTREE_LT end here + // Fall through for the RTREE_EQ case + + default: // RTREE_GT or RTREE_GE, or fallthrough of RTREE_EQ + pCellData += uintptr(4) + { + // var c RtreeCoord at bp+4, 4 + /* Coordinate decoded */ + *(*U32)(unsafe.Pointer(bp + 4 /* &c */)) = libc.X__builtin_bswap32(tls, *(*U32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + val = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp + 4 /* &c */))) + } else { + val = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp + 4 /* &c */))) + } + } + + // val now holds the upper bound of the coordinate pair + if *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) <= val { + return + } + } + *(*int32)(unsafe.Pointer(peWithin)) = NOT_WITHIN +} + +// Check the leaf RTree cell given by pCellData against constraint p. +// If this constraint is not satisfied, set *peWithin to NOT_WITHIN. +// If the constraint is satisfied, leave *peWithin unchanged. +// +// The constraint is of the form: xN op $val +// +// The op is given by p->op. The xN is p->iCoord-th coordinate in +// pCellData. $val is given by p->u.rValue. +func rtreeLeafConstraint(tls *libc.TLS, p uintptr, eInt int32, pCellData uintptr, peWithin uintptr) { /* sqlite3.c:193582:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var xN RtreeDValue // Coordinate value converted to a double + + pCellData += (uintptr(8 + ((*RtreeConstraint)(unsafe.Pointer(p)).FiCoord * 4))) + /* 4-byte aligned */ + { + // var c RtreeCoord at bp, 4 + /* Coordinate decoded */ + *(*U32)(unsafe.Pointer(bp /* &c */)) = libc.X__builtin_bswap32(tls, *(*U32)(unsafe.Pointer(pCellData))) + if eInt != 0 { + xN = Sqlite3_rtree_dbl(*(*int32)(unsafe.Pointer(bp /* &c */))) + } else { + xN = Sqlite3_rtree_dbl(*(*RtreeValue)(unsafe.Pointer(bp /* &c */))) + } + } + + switch (*RtreeConstraint)(unsafe.Pointer(p)).Fop { + case RTREE_TRUE: + return // Always satisfied + case RTREE_FALSE: + break // Never satisfied + case RTREE_LE: + if xN <= *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) { + return + } + break + case RTREE_LT: + if xN < *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) { + return + } + break + case RTREE_GE: + if xN >= *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) { + return + } + break + case RTREE_GT: + if xN > *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) { + return + } + break + default: + if xN == *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) { + return + } + break + } + *(*int32)(unsafe.Pointer(peWithin)) = NOT_WITHIN +} + +// One of the cells in node pNode is guaranteed to have a 64-bit +// integer value equal to iRowid. Return the index of this cell. +func nodeRowidIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, iRowid I64, piIndex uintptr) int32 { /* sqlite3.c:193612:12: */ + var ii int32 + var nCell int32 = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData + 2)) + + for ii = 0; ii < nCell; ii++ { + if nodeGetRowid(tls, pRtree, pNode, ii) == iRowid { + *(*int32)(unsafe.Pointer(piIndex)) = ii + return SQLITE_OK + } + } + + return (SQLITE_CORRUPT | (int32(1) << 8)) +} + +// Return the index of the cell containing a pointer to node pNode +// in its parent. If pNode is the root node, return -1. +func nodeParentIndex(tls *libc.TLS, pRtree uintptr, pNode uintptr, piIndex uintptr) int32 { /* sqlite3.c:193635:12: */ + var pParent uintptr = (*RtreeNode)(unsafe.Pointer(pNode)).FpParent + if pParent != 0 { + return nodeRowidIndex(tls, pRtree, pParent, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode, piIndex) + } + *(*int32)(unsafe.Pointer(piIndex)) = -1 + return SQLITE_OK +} + +// Compare two search points. Return negative, zero, or positive if the first +// is less than, equal to, or greater than the second. +// +// The rScore is the primary key. Smaller rScore values come first. +// If the rScore is a tie, then use iLevel as the tie breaker with smaller +// iLevel values coming first. In this way, if rScore is the same for all +// SearchPoints, then iLevel becomes the deciding factor and the result +// is a depth-first search, which is the desired default behavior. +func rtreeSearchPointCompare(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* sqlite3.c:193654:12: */ + if (*RtreeSearchPoint)(unsafe.Pointer(pA)).FrScore < (*RtreeSearchPoint)(unsafe.Pointer(pB)).FrScore { + return -1 + } + if (*RtreeSearchPoint)(unsafe.Pointer(pA)).FrScore > (*RtreeSearchPoint)(unsafe.Pointer(pB)).FrScore { + return +1 + } + if int32((*RtreeSearchPoint)(unsafe.Pointer(pA)).FiLevel) < int32((*RtreeSearchPoint)(unsafe.Pointer(pB)).FiLevel) { + return -1 + } + if int32((*RtreeSearchPoint)(unsafe.Pointer(pA)).FiLevel) > int32((*RtreeSearchPoint)(unsafe.Pointer(pB)).FiLevel) { + return +1 + } + return 0 +} + +// Interchange two search points in a cursor. +func rtreeSearchPointSwap(tls *libc.TLS, p uintptr, i int32, j int32) { /* sqlite3.c:193668:13: */ + var t = *(*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(i)*24)) + + *(*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(i)*24)) = *(*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(j)*24)) + *(*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(j)*24)) = t + i++ + j++ + if i < RTREE_CACHE_SZ { + if j >= RTREE_CACHE_SZ { + nodeRelease(tls, (*RtreeCursor)(unsafe.Pointer((p))).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8)) = uintptr(0) + } else { + var pTemp uintptr = *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(j)*8)) + *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(j)*8)) = pTemp + } + } +} + +// Return the search point with the lowest current score. +func rtreeSearchPointFirst(tls *libc.TLS, pCur uintptr) uintptr { /* sqlite3.c:193689:25: */ + if (*RtreeCursor)(unsafe.Pointer(pCur)).FbPoint != 0 { + return (pCur + 64 /* &.sPoint */) + } + if (*RtreeCursor)(unsafe.Pointer(pCur)).FnPoint != 0 { + return (*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint + } + return uintptr(0) +} + +// Get the RtreeNode for the search point with the lowest score. +func rtreeNodeOfFirstSearchPoint(tls *libc.TLS, pCur uintptr, pRC uintptr) uintptr { /* sqlite3.c:193696:18: */ + var id Sqlite3_int64 + var ii int32 = (1 - int32((*RtreeCursor)(unsafe.Pointer(pCur)).FbPoint)) + + if *(*uintptr)(unsafe.Pointer((pCur + 88 /* &.aNode */) + uintptr(ii)*8)) == uintptr(0) { + + if ii != 0 { + id = (*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint)).Fid + } else { + id = (*RtreeCursor)(unsafe.Pointer(pCur)).FsPoint.Fid + } + *(*int32)(unsafe.Pointer(pRC)) = nodeAcquire(tls, (*RtreeCursor)(unsafe.Pointer((pCur))).Fbase.FpVtab, id, uintptr(0), ((pCur + 88 /* &.aNode */) + uintptr(ii)*8)) + } + return *(*uintptr)(unsafe.Pointer((pCur + 88 /* &.aNode */) + uintptr(ii)*8)) +} + +// Push a new element onto the priority queue +func rtreeEnqueue(tls *libc.TLS, pCur uintptr, rScore RtreeDValue, iLevel U8) uintptr { /* sqlite3.c:193712:25: */ + var i int32 + var j int32 + var pNew uintptr + if (*RtreeCursor)(unsafe.Pointer(pCur)).FnPoint >= (*RtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc { + var nNew int32 = (((*RtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc * 2) + 8) + pNew = Xsqlite3_realloc64(tls, (*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(RtreeSearchPoint{}))))) + if pNew == uintptr(0) { + return uintptr(0) + } + (*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint = pNew + (*RtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc = nNew + } + i = libc.PostIncInt32(&(*RtreeCursor)(unsafe.Pointer(pCur)).FnPoint, 1) + pNew = ((*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint + uintptr(i)*24) + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).FrScore = rScore + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).FiLevel = iLevel + + for i > 0 { + var pParent uintptr + j = ((i - 1) / 2) + pParent = ((*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint + uintptr(j)*24) + if rtreeSearchPointCompare(tls, pNew, pParent) >= 0 { + break + } + rtreeSearchPointSwap(tls, pCur, j, i) + i = j + pNew = pParent + } + return pNew +} + +// Allocate a new RtreeSearchPoint and return a pointer to it. Return +// NULL if malloc fails. +func rtreeSearchPointNew(tls *libc.TLS, pCur uintptr, rScore RtreeDValue, iLevel U8) uintptr { /* sqlite3.c:193747:25: */ + var pNew uintptr + var pFirst uintptr + pFirst = rtreeSearchPointFirst(tls, pCur) + *(*U32)(unsafe.Pointer((pCur + 128 /* &.anQueue */) + uintptr(iLevel)*4))++ + if ((pFirst == uintptr(0)) || + ((*RtreeSearchPoint)(unsafe.Pointer(pFirst)).FrScore > rScore)) || + (((*RtreeSearchPoint)(unsafe.Pointer(pFirst)).FrScore == rScore) && (int32((*RtreeSearchPoint)(unsafe.Pointer(pFirst)).FiLevel) > int32(iLevel))) { + if (*RtreeCursor)(unsafe.Pointer(pCur)).FbPoint != 0 { + var ii int32 + pNew = rtreeEnqueue(tls, pCur, rScore, iLevel) + if pNew == uintptr(0) { + return uintptr(0) + } + ii = ((int32((int64(pNew) - int64((*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint)) / 24)) + 1) + if ii < RTREE_CACHE_SZ { + + *(*uintptr)(unsafe.Pointer((pCur + 88 /* &.aNode */) + uintptr(ii)*8)) = *(*uintptr)(unsafe.Pointer((pCur + 88 /* &.aNode */))) + } else { + nodeRelease(tls, (*RtreeCursor)(unsafe.Pointer((pCur))).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer((pCur + 88 /* &.aNode */)))) + } + *(*uintptr)(unsafe.Pointer((pCur + 88 /* &.aNode */))) = uintptr(0) + *(*RtreeSearchPoint)(unsafe.Pointer(pNew)) = (*RtreeCursor)(unsafe.Pointer(pCur)).FsPoint + } + (*RtreeCursor)(unsafe.Pointer(pCur)).FsPoint.FrScore = rScore + (*RtreeCursor)(unsafe.Pointer(pCur)).FsPoint.FiLevel = iLevel + (*RtreeCursor)(unsafe.Pointer(pCur)).FbPoint = U8(1) + return (pCur + 64 /* &.sPoint */) + } else { + return rtreeEnqueue(tls, pCur, rScore, iLevel) + } + return uintptr(0) +} + +// Remove the search point with the lowest current score. +func rtreeSearchPointPop(tls *libc.TLS, p uintptr) { /* sqlite3.c:193814:13: */ + var i int32 + var j int32 + var k int32 + var n int32 + i = (1 - int32((*RtreeCursor)(unsafe.Pointer(p)).FbPoint)) + + if *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8)) != 0 { + nodeRelease(tls, (*RtreeCursor)(unsafe.Pointer((p))).Fbase.FpVtab, *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr(i)*8)) = uintptr(0) + } + if (*RtreeCursor)(unsafe.Pointer(p)).FbPoint != 0 { + *(*U32)(unsafe.Pointer((p + 128 /* &.anQueue */) + uintptr((*RtreeCursor)(unsafe.Pointer(p)).FsPoint.FiLevel)*4))-- + (*RtreeCursor)(unsafe.Pointer(p)).FbPoint = U8(0) + } else if (*RtreeCursor)(unsafe.Pointer(p)).FnPoint != 0 { + *(*U32)(unsafe.Pointer((p + 128 /* &.anQueue */) + uintptr((*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint)).FiLevel)*4))-- + n = libc.PreDecInt32(&(*RtreeCursor)(unsafe.Pointer(p)).FnPoint, 1) + *(*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint)) = *(*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(p)).FaPoint + uintptr(n)*24)) + if n < (RTREE_CACHE_SZ - 1) { + *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + 1*8)) = *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr((n+1))*8)) + *(*uintptr)(unsafe.Pointer((p + 88 /* &.aNode */) + uintptr((n+1))*8)) = uintptr(0) + } + i = 0 + for (libc.AssignInt32(&j, ((i * 2) + 1))) < n { + k = (j + 1) + if (k < n) && (rtreeSearchPointCompare(tls, ((*RtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(k)*24), ((*RtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(j)*24)) < 0) { + if rtreeSearchPointCompare(tls, ((*RtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(k)*24), ((*RtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(i)*24)) < 0 { + rtreeSearchPointSwap(tls, p, i, k) + i = k + } else { + break + } + } else { + if rtreeSearchPointCompare(tls, ((*RtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(j)*24), ((*RtreeCursor)(unsafe.Pointer(p)).FaPoint+uintptr(i)*24)) < 0 { + rtreeSearchPointSwap(tls, p, i, j) + i = j + } else { + break + } + } + } + } +} + +// Continue the search on cursor pCur until the front of the queue +// contains an entry suitable for returning as a result-set row, +// or until the RtreeSearchPoint queue is empty, indicating that the +// query has completed. +func rtreeStepToLeaf(tls *libc.TLS, pCur uintptr) int32 { /* sqlite3.c:193862:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var p uintptr + var pRtree uintptr = (*RtreeCursor)(unsafe.Pointer((pCur))).Fbase.FpVtab + var pNode uintptr + // var eWithin int32 at bp+16, 4 + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var nCell int32 + var nConstraint int32 = (*RtreeCursor)(unsafe.Pointer(pCur)).FnConstraint + var ii int32 + var eInt int32 + var x RtreeSearchPoint + + eInt = (libc.Bool32(int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_INT32)) + for ((libc.AssignUintptr(&p, rtreeSearchPointFirst(tls, pCur))) != uintptr(0)) && (int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiLevel) > 0) { + var pCellData uintptr + pNode = rtreeNodeOfFirstSearchPoint(tls, pCur, bp /* &rc */) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + nCell = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData + 2)) + + pCellData = ((*RtreeNode)(unsafe.Pointer(pNode)).FzData + uintptr((4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell))))) + for int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell) < nCell { + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* rScore */)) = Sqlite3_rtree_dbl(-1) + *(*int32)(unsafe.Pointer(bp + 16 /* eWithin */)) = FULLY_WITHIN + for ii = 0; ii < nConstraint; ii++ { + var pConstraint uintptr = ((*RtreeCursor)(unsafe.Pointer(pCur)).FaConstraint + uintptr(ii)*24) + if (*RtreeConstraint)(unsafe.Pointer(pConstraint)).Fop >= RTREE_MATCH { + *(*int32)(unsafe.Pointer(bp /* rc */)) = rtreeCallbackConstraint(tls, pConstraint, eInt, pCellData, p, + bp+8 /* &rScore */, bp+16 /* &eWithin */) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } else if int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiLevel) == 1 { + rtreeLeafConstraint(tls, pConstraint, eInt, pCellData, bp+16 /* &eWithin */) + } else { + rtreeNonleafConstraint(tls, pConstraint, eInt, pCellData, bp+16 /* &eWithin */) + } + if *(*int32)(unsafe.Pointer(bp + 16 /* eWithin */)) == NOT_WITHIN { + (*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell++ + pCellData += uintptr((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) + break + } + } + if *(*int32)(unsafe.Pointer(bp + 16 /* eWithin */)) == NOT_WITHIN { + continue + } + (*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell++ + x.FiLevel = (U8(int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiLevel) - 1)) + if x.FiLevel != 0 { + x.Fid = readInt64(tls, pCellData) + for ii = 0; ii < (*RtreeCursor)(unsafe.Pointer(pCur)).FnPoint; ii++ { + if (*RtreeSearchPoint)(unsafe.Pointer((*RtreeCursor)(unsafe.Pointer(pCur)).FaPoint+uintptr(ii)*24)).Fid == x.Fid { + + return (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + x.FiCell = U8(0) + } else { + x.Fid = (*RtreeSearchPoint)(unsafe.Pointer(p)).Fid + x.FiCell = (U8(int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell) - 1)) + } + if int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= nCell { + + rtreeSearchPointPop(tls, pCur) + } + if *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* rScore */)) < 0.0 { + *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* rScore */)) = 0.0 + } + p = rtreeSearchPointNew(tls, pCur, *(*Sqlite3_rtree_dbl)(unsafe.Pointer(bp + 8 /* rScore */)), x.FiLevel) + if p == uintptr(0) { + return SQLITE_NOMEM + } + (*RtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = U8(*(*int32)(unsafe.Pointer(bp + 16 /* eWithin */))) + (*RtreeSearchPoint)(unsafe.Pointer(p)).Fid = x.Fid + (*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell = x.FiCell + + break + } + if int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell) >= nCell { + + rtreeSearchPointPop(tls, pCur) + } + } + (*RtreeCursor)(unsafe.Pointer(pCur)).FatEOF = (U8(libc.Bool32(p == uintptr(0)))) + return SQLITE_OK +} + +// Rtree virtual table module xNext method. +func rtreeNext(tls *libc.TLS, pVtabCursor uintptr) int32 { /* sqlite3.c:193943:12: */ + var pCsr uintptr = pVtabCursor + var rc int32 = SQLITE_OK + + // Move to the next entry that matches the configured constraints. + + if (*RtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid != 0 { + (*RtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = U8(0) + Xsqlite3_reset(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + } + rtreeSearchPointPop(tls, pCsr) + rc = rtreeStepToLeaf(tls, pCsr) + return rc +} + +// Rtree virtual table module xRowid method. +func rtreeRowid(tls *libc.TLS, pVtabCursor uintptr, pRowid uintptr) int32 { /* sqlite3.c:193961:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pCsr uintptr = pVtabCursor + var p uintptr = rtreeSearchPointFirst(tls, pCsr) + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var pNode uintptr = rtreeNodeOfFirstSearchPoint(tls, pCsr, bp /* &rc */) + if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (p != 0) { + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = nodeGetRowid(tls, (*RtreeCursor)(unsafe.Pointer((pCsr))).Fbase.FpVtab, pNode, int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell)) + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Rtree virtual table module xColumn method. +func rtreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* sqlite3.c:193975:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pRtree uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab + var pCsr uintptr = cur + var p uintptr = rtreeSearchPointFirst(tls, pCsr) + // var c RtreeCoord at bp+4, 4 + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var pNode uintptr = rtreeNodeOfFirstSearchPoint(tls, pCsr, bp /* &rc */) + + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + if p == uintptr(0) { + return SQLITE_OK + } + if i == 0 { + Xsqlite3_result_int64(tls, ctx, nodeGetRowid(tls, pRtree, pNode, int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) + } else if i <= int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) { + nodeGetCoord(tls, pRtree, pNode, int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell), (i - 1), bp+4 /* &c */) + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + Xsqlite3_result_double(tls, ctx, float64(*(*RtreeValue)(unsafe.Pointer(bp + 4 /* &c */)))) + } else { + + Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(bp + 4 /* &c */))) + } + } else { + if !(int32((*RtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid) != 0) { + if (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux == uintptr(0) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3_prepare_v3(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql, -1, uint32(0), + (pCsr + 56 /* &.pReadAux */), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } + Xsqlite3_bind_int64(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, 1, + nodeGetRowid(tls, pRtree, pNode, int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3_step(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_ROW { + (*RtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = U8(1) + } else { + Xsqlite3_reset(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_DONE { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } + Xsqlite3_result_value(tls, ctx, + Xsqlite3_column_value(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, ((i-int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2))+1))) + } + return SQLITE_OK +} + +// Use nodeAcquire() to obtain the leaf node containing the record with +// rowid iRowid. If successful, set *ppLeaf to point to the node and +// return SQLITE_OK. If there is no such record in the table, set +// *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf +// to zero and return an SQLite error code. +func findLeafNode(tls *libc.TLS, pRtree uintptr, iRowid I64, ppLeaf uintptr, piNode uintptr) int32 { /* sqlite3.c:194029:12: */ + var rc int32 + *(*uintptr)(unsafe.Pointer(ppLeaf)) = uintptr(0) + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid, 1, iRowid) + if Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) == SQLITE_ROW { + var iNode I64 = Xsqlite3_column_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid, 0) + if piNode != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(piNode)) = iNode + } + rc = nodeAcquire(tls, pRtree, iNode, uintptr(0), ppLeaf) + Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + } else { + rc = Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + } + return rc +} + +// This function is called to configure the RtreeConstraint object passed +// as the second argument for a MATCH constraint. The value passed as the +// first argument to this function is the right-hand operand to the MATCH +// operator. +func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { /* sqlite3.c:194055:12: */ + var pBlob uintptr + var pSrc uintptr // BLOB returned by geometry function + var pInfo uintptr // Callback information + + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23404 /* "RtreeMatchArg" */) + if pSrc == uintptr(0) { + return SQLITE_ERROR + } + pInfo = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(Sqlite3_rtree_query_info{})) + uint64((*RtreeMatchArg)(unsafe.Pointer(pSrc)).FiSize)))) + if !(pInfo != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pInfo, 0, uint64(unsafe.Sizeof(Sqlite3_rtree_query_info{}))) + pBlob = (pInfo + 1*112) + libc.Xmemcpy(tls, pBlob, pSrc, uint64((*RtreeMatchArg)(unsafe.Pointer(pSrc)).FiSize)) + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FpContext = (*RtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FpContext + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FnParam = (*RtreeMatchArg)(unsafe.Pointer(pBlob)).FnParam + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FaParam = pBlob + 56 /* &.aParam */ + (*Sqlite3_rtree_query_info)(unsafe.Pointer(pInfo)).FapSqlParam = (*RtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam + + if (*RtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FxGeom != 0 { + *(*uintptr)(unsafe.Pointer(pCons + 8 /* &.u */)) = (*RtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FxGeom + } else { + (*RtreeConstraint)(unsafe.Pointer(pCons)).Fop = RTREE_QUERY + *(*uintptr)(unsafe.Pointer(pCons + 8 /* &.u */)) = (*RtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb.FxQueryFunc + } + (*RtreeConstraint)(unsafe.Pointer(pCons)).FpInfo = pInfo + return SQLITE_OK +} + +// Rtree virtual table module xFilter method. +func rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3.c:194085:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pRtree uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + var pCsr uintptr = pVtabCursor + *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) = uintptr(0) + var ii int32 + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 16 /* iCell */)) = 0 + + rtreeReference(tls, pRtree) + + // Reset the cursor to the same state as rtreeOpen() leaves it in. + resetCursor(tls, pCsr) + + (*RtreeCursor)(unsafe.Pointer(pCsr)).FiStrategy = idxNum + if idxNum == 1 { + // Special case - lookup by rowid. + // var pLeaf uintptr at bp, 8 + // Leaf on which the required cell resides + var p uintptr // Search point for the leaf + var iRowid I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*I64)(unsafe.Pointer(bp + 8 /* iNode */)) = int64(0) + var eType int32 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv))) + if (eType == SQLITE_INTEGER) || + ((eType == SQLITE_FLOAT) && (Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) == float64(iRowid))) { + rc = findLeafNode(tls, pRtree, iRowid, bp /* &pLeaf */, bp+8 /* &iNode */) + } else { + rc = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* pLeaf */)) = uintptr(0) + } + if (rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp /* pLeaf */)) != uintptr(0)) { + p = rtreeSearchPointNew(tls, pCsr, 0.0, uint8(0)) + // Always returns pCsr->sPoint + *(*uintptr)(unsafe.Pointer((pCsr + 88 /* &.aNode */))) = *(*uintptr)(unsafe.Pointer(bp /* pLeaf */)) + (*RtreeSearchPoint)(unsafe.Pointer(p)).Fid = *(*I64)(unsafe.Pointer(bp + 8 /* iNode */)) + (*RtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = U8(PARTLY_WITHIN) + rc = nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pLeaf */)), iRowid, bp+16 /* &iCell */) + (*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell = U8(*(*int32)(unsafe.Pointer(bp + 16 /* iCell */))) + + } else { + (*RtreeCursor)(unsafe.Pointer(pCsr)).FatEOF = U8(1) + } + } else { + // Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array + // with the configured constraints. + rc = nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp+24 /* &pRoot */) + if (rc == SQLITE_OK) && (argc > 0) { + (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(RtreeConstraint{})) * uint64(argc)))) + (*RtreeCursor)(unsafe.Pointer(pCsr)).FnConstraint = argc + if !(int32((*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint) != 0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint, 0, (uint64(unsafe.Sizeof(RtreeConstraint{})) * uint64(argc))) + libc.Xmemset(tls, pCsr+128 /* &.anQueue */, 0, (uint64(unsafe.Sizeof(U32(0))) * (uint64((*Rtree)(unsafe.Pointer(pRtree)).FiDepth + 1)))) + + for ii = 0; ii < argc; ii++ { + var p uintptr = ((*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint + uintptr(ii)*24) + var eType int32 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8))) + (*RtreeConstraint)(unsafe.Pointer(p)).Fop = int32(*(*int8)(unsafe.Pointer(idxStr + uintptr((ii * 2))))) + (*RtreeConstraint)(unsafe.Pointer(p)).FiCoord = (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(((ii * 2) + 1))))) - '0') + if (*RtreeConstraint)(unsafe.Pointer(p)).Fop >= RTREE_MATCH { + // A MATCH operator. The right-hand-side must be a blob that + // can be cast into an RtreeMatchArg object. One created using + // an sqlite3_rtree_geometry_callback() SQL user function. + rc = deserializeGeometry(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)), p) + if rc != SQLITE_OK { + break + } + (*Sqlite3_rtree_query_info)(unsafe.Pointer((*RtreeConstraint)(unsafe.Pointer(p)).FpInfo)).FnCoord = int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) + (*Sqlite3_rtree_query_info)(unsafe.Pointer((*RtreeConstraint)(unsafe.Pointer(p)).FpInfo)).FanQueue = pCsr + 128 /* &.anQueue */ + (*Sqlite3_rtree_query_info)(unsafe.Pointer((*RtreeConstraint)(unsafe.Pointer(p)).FpInfo)).FmxLevel = ((*Rtree)(unsafe.Pointer(pRtree)).FiDepth + 1) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8))) + } else { + *(*RtreeDValue)(unsafe.Pointer(p + 8 /* &.u */)) = 0.0 + if eType == SQLITE_NULL { + (*RtreeConstraint)(unsafe.Pointer(p)).Fop = RTREE_FALSE + } else if ((*RtreeConstraint)(unsafe.Pointer(p)).Fop == RTREE_LT) || ((*RtreeConstraint)(unsafe.Pointer(p)).Fop == RTREE_LE) { + (*RtreeConstraint)(unsafe.Pointer(p)).Fop = RTREE_TRUE + } else { + (*RtreeConstraint)(unsafe.Pointer(p)).Fop = RTREE_FALSE + } + } + } + } + } + if rc == SQLITE_OK { + var pNew uintptr + pNew = rtreeSearchPointNew(tls, pCsr, 0.0, (U8((*Rtree)(unsafe.Pointer(pRtree)).FiDepth + 1))) + if pNew == uintptr(0) { + return SQLITE_NOMEM + } + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).Fid = int64(1) + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).FiCell = U8(0) + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).FeWithin = U8(PARTLY_WITHIN) + + *(*uintptr)(unsafe.Pointer((pCsr + 88 /* &.aNode */))) = *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) = uintptr(0) + + rc = rtreeStepToLeaf(tls, pCsr) + } + } + + nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + rtreeRelease(tls, pRtree) + return rc +} + +// Rtree virtual table module xBestIndex method. There are three +// table scan strategies to choose from (in order from most to +// least desirable): +// +// idxNum idxStr Strategy +// ------------------------------------------------ +// 1 Unused Direct lookup by rowid. +// 2 See below R-tree query or full-table scan. +// ------------------------------------------------ +// +// If strategy 1 is used, then idxStr is not meaningful. If strategy +// 2 is used, idxStr is formatted to contain 2 bytes for each +// constraint used. The first two bytes of idxStr correspond to +// the constraint in sqlite3_index_info.aConstraintUsage[] with +// (argvIndex==1) etc. +// +// The first of each pair of bytes in idxStr identifies the constraint +// operator as follows: +// +// Operator Byte Value +// ---------------------- +// = 0x41 ('A') +// <= 0x42 ('B') +// < 0x43 ('C') +// >= 0x44 ('D') +// > 0x45 ('E') +// MATCH 0x46 ('F') +// ---------------------- +// +// The second of each pair of bytes identifies the coordinate column +// to which the constraint applies. The leftmost coordinate column +// is 'a', the second from the left 'b' etc. +func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sqlite3.c:194235:12: */ + bp := tls.Alloc(49) + defer tls.Free(49) + + var pRtree uintptr = tab + var rc int32 = SQLITE_OK + var ii int32 + var bMatch int32 = 0 // True if there exists a MATCH constraint + var nRow I64 // Estimated rows returned by this scan + + var iIdx int32 = 0 + // var zIdxStr [41]int8 at bp+8, 41 + + libc.Xmemset(tls, bp+8 /* &zIdxStr[0] */, 0, uint64(unsafe.Sizeof([41]int8{}))) + + // Check if there exists a MATCH constraint - even an unusable one. If there + // is, do not consider the lookup-by-rowid plan as using such a plan would + // require the VDBE to evaluate the MATCH constraint, which is not currently + // possible. + for ii = 0; ii < (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ { + if int32((*sqlite3_index_constraint)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint+uintptr(ii)*12)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH { + bMatch = 1 + } + } + + for ii = 0; (ii < (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) && (iIdx < (int32(uint64(unsafe.Sizeof([41]int8{})) - uint64(1)))); ii++ { + var p uintptr = ((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12) + + if (((bMatch == 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0)) && + ((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0)) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) { + // We have an equality constraint on the rowid. Use strategy 1. + var jj int32 + for jj = 0; jj < ii; jj++ { + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8)).FargvIndex = 0 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8)).Fomit = uint8(0) + } + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)).FargvIndex = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(jj)*8)).Fomit = uint8(1) + + // This strategy involves a two rowid lookups on an B-Tree structures + // and then a linear search of an R-Tree node. This should be + // considered almost as quick as a direct rowid lookup (for which + // sqlite uses an internal cost of 0.0). It is expected to return + // a single row. + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = SQLITE_INDEX_SCAN_UNIQUE + return SQLITE_OK + } + + if ((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0) && + ((((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn > 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn <= int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2))) || + (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH)) { + var op U8 + switch int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) { + case SQLITE_INDEX_CONSTRAINT_EQ: + op = U8(RTREE_EQ) + break + fallthrough + case SQLITE_INDEX_CONSTRAINT_GT: + op = U8(RTREE_GT) + break + fallthrough + case SQLITE_INDEX_CONSTRAINT_LE: + op = U8(RTREE_LE) + break + fallthrough + case SQLITE_INDEX_CONSTRAINT_LT: + op = U8(RTREE_LT) + break + fallthrough + case SQLITE_INDEX_CONSTRAINT_GE: + op = U8(RTREE_GE) + break + fallthrough + case SQLITE_INDEX_CONSTRAINT_MATCH: + op = U8(RTREE_MATCH) + break + fallthrough + default: + op = U8(0) + break + } + if op != 0 { + *(*int8)(unsafe.Pointer(bp + 8 /* &zIdxStr[0] */ + uintptr(libc.PostIncInt32(&iIdx, 1)))) = int8(op) + *(*int8)(unsafe.Pointer(bp + 8 /* &zIdxStr[0] */ + uintptr(libc.PostIncInt32(&iIdx, 1)))) = (int8(((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn - 1) + '0')) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)).FargvIndex = (iIdx / 2) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)).Fomit = uint8(1) + } + } + } + + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + return SQLITE_NOMEM + } + + nRow = ((*Rtree)(unsafe.Pointer(pRtree)).FnRowEst >> (iIdx / 2)) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (6.0 * float64(nRow)) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = nRow + + return rc +} + +// Return the N-dimensional volumn of the cell stored in *p. +func cellArea(tls *libc.TLS, pRtree uintptr, p uintptr) RtreeDValue { /* sqlite3.c:194324:20: */ + var area RtreeDValue = RtreeDValue(1) + + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + switch int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim) { + case 5: + area = (RtreeDValue(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 9*4)) - *(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 8*4)))) + fallthrough + case 4: + area = area * (float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 7*4)) - *(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 6*4)))) + fallthrough + case 3: + area = area * (float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 5*4)) - *(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 4*4)))) + fallthrough + case 2: + area = area * (float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 3*4)) - *(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 2*4)))) + fallthrough + default: + area = area * (float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + 1*4)) - *(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */))))) + } + } else { + switch int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim) { + case 5: + area = (RtreeDValue(I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 9*4))) - I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 8*4))))) + fallthrough + case 4: + area = area * (float64(I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 7*4))) - I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 6*4))))) + fallthrough + case 3: + area = area * (float64(I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 5*4))) - I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 4*4))))) + fallthrough + case 2: + area = area * (float64(I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 3*4))) - I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 2*4))))) + fallthrough + default: + area = area * (float64(I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + 1*4))) - I64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */)))))) + } + } + return area +} + +// Return the margin length of cell p. The margin length is the sum +// of the objects size in each dimension. +func cellMargin(tls *libc.TLS, pRtree uintptr, p uintptr) RtreeDValue { /* sqlite3.c:194354:20: */ + var margin RtreeDValue = RtreeDValue(0) + var ii int32 = (int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) - 2) + for ok := true; ok; ok = (ii >= 0) { + margin = margin + ((func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr((ii+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr((ii+1))*4))) + }()) - (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr(ii)*4))) + } + return float64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr(ii)*4))) + }())) + ii = ii - (2) + } + return margin +} + +// Store the union of cells p1 and p2 in p1. +func cellUnion(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) { /* sqlite3.c:194367:13: */ + var ii int32 = 0 + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + for ok := true; ok; ok = (ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2)) { + *(*RtreeValue)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr(ii)*4)) = func() float32 { + if (*(*RtreeValue)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr(ii)*4))) < (*(*RtreeValue)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr(ii)*4))) { + return *(*RtreeValue)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr(ii)*4)) + } + return *(*RtreeValue)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr(ii)*4)) + }() + *(*RtreeValue)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr((ii+1))*4)) = func() float32 { + if (*(*RtreeValue)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr((ii+1))*4))) > (*(*RtreeValue)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr((ii+1))*4))) { + return *(*RtreeValue)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr((ii+1))*4)) + } + return *(*RtreeValue)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr((ii+1))*4)) + }() + ii = ii + (2) + } + } else { + for ok1 := true; ok1; ok1 = (ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2)) { + *(*int32)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr(ii)*4)) = func() int32 { + if (*(*int32)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr(ii)*4))) < (*(*int32)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr(ii)*4))) { + return *(*int32)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr(ii)*4)) + } + return *(*int32)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr(ii)*4)) + }() + *(*int32)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr((ii+1))*4)) = func() int32 { + if (*(*int32)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr((ii+1))*4))) > (*(*int32)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr((ii+1))*4))) { + return *(*int32)(unsafe.Pointer((p1 + 8 /* &.aCoord */) + uintptr((ii+1))*4)) + } + return *(*int32)(unsafe.Pointer((p2 + 8 /* &.aCoord */) + uintptr((ii+1))*4)) + }() + ii = ii + (2) + } + } +} + +// Return true if the area covered by p2 is a subset of the area covered +// by p1. False otherwise. +func cellContains(tls *libc.TLS, pRtree uintptr, p1 uintptr, p2 uintptr) int32 { /* sqlite3.c:194388:12: */ + var ii int32 + var isInt int32 = (libc.Bool32(int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_INT32)) + for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2); ii = ii + (2) { + var a1 uintptr = ((p1 + 8 /* &.aCoord */) + uintptr(ii)*4) + var a2 uintptr = ((p2 + 8 /* &.aCoord */) + uintptr(ii)*4) + if (!(isInt != 0) && ((*(*RtreeValue)(unsafe.Pointer(a2)) < *(*RtreeValue)(unsafe.Pointer(a1))) || (*(*RtreeValue)(unsafe.Pointer(a2 + 1*4)) > *(*RtreeValue)(unsafe.Pointer(a1 + 1*4))))) || + ((isInt != 0) && ((*(*int32)(unsafe.Pointer(a2)) < *(*int32)(unsafe.Pointer(a1))) || (*(*int32)(unsafe.Pointer(a2 + 1*4)) > *(*int32)(unsafe.Pointer(a1 + 1*4))))) { + return 0 + } + } + return 1 +} + +// Return the amount cell p would grow by if it were unioned with pCell. +func cellGrowth(tls *libc.TLS, pRtree uintptr, p uintptr, pCell uintptr) RtreeDValue { /* sqlite3.c:194406:20: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var area RtreeDValue + // var cell RtreeCell at bp, 48 + + libc.Xmemcpy(tls, bp /* &cell */, p, uint64(unsafe.Sizeof(RtreeCell{}))) + area = cellArea(tls, pRtree, bp /* &cell */) + cellUnion(tls, pRtree, bp /* &cell */, pCell) + return (cellArea(tls, pRtree, bp /* &cell */) - area) +} + +func cellOverlap(tls *libc.TLS, pRtree uintptr, p uintptr, aCell uintptr, nCell int32) RtreeDValue { /* sqlite3.c:194415:20: */ + var ii int32 + var overlap RtreeDValue = 0.0 + for ii = 0; ii < nCell; ii++ { + var jj int32 + var o RtreeDValue = RtreeDValue(1) + for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2); jj = jj + (2) { + var x1 RtreeDValue + var x2 RtreeDValue + x1 = func() float64 { + if (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr(jj)*4))) + } + return float64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr(jj)*4))) + }()) > (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(jj)*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(jj)*4))) + }()) { + return func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr(jj)*4))) + } + return float64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr(jj)*4))) + }() + } + return func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(jj)*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(jj)*4))) + }() + }() + x2 = func() float64 { + if (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + }()) < (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + }()) { + return func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((p + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + }() + } + return func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((jj+1))*4))) + }() + }() + if x2 < x1 { + o = RtreeDValue(0) + break + } else { + o = (o * (x2 - x1)) + } + } + overlap = overlap + (o) + } + return overlap +} + +// This function implements the ChooseLeaf algorithm from Gutman[84]. +// ChooseSubTree in r*tree terminology. +func sChooseLeaf(tls *libc.TLS, pRtree uintptr, pCell uintptr, iHeight int32, ppLeaf uintptr) int32 { /* sqlite3.c:194447:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var rc int32 + var ii int32 + *(*uintptr)(unsafe.Pointer(bp /* pNode */)) = uintptr(0) + rc = nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp /* &pNode */) + + for ii = 0; (rc == SQLITE_OK) && (ii < ((*Rtree)(unsafe.Pointer(pRtree)).FiDepth - iHeight)); ii++ { + var iCell int32 + var iBest Sqlite3_int64 = int64(0) + + var fMinGrowth RtreeDValue = 0.0 + var fMinArea RtreeDValue = 0.0 + + var nCell int32 = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pNode */))))).FzData + 2)) + // var cell RtreeCell at bp+8, 48 + + // var pChild uintptr at bp+56, 8 + + var aCell uintptr = uintptr(0) + + // Select the child node which will be enlarged the least if pCell + // is inserted into it. Resolve ties by choosing the entry with + // the smallest area. + for iCell = 0; iCell < nCell; iCell++ { + var bBest int32 = 0 + var growth RtreeDValue + var area RtreeDValue + nodeGetCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pNode */)), iCell, bp+8 /* &cell */) + growth = cellGrowth(tls, pRtree, bp+8 /* &cell */, pCell) + area = cellArea(tls, pRtree, bp+8 /* &cell */) + if ((iCell == 0) || (growth < fMinGrowth)) || ((growth == fMinGrowth) && (area < fMinArea)) { + bBest = 1 + } + if bBest != 0 { + fMinGrowth = growth + fMinArea = area + iBest = (*RtreeCell)(unsafe.Pointer(bp + 8 /* &cell */)).FiRowid + } + } + + Xsqlite3_free(tls, aCell) + rc = nodeAcquire(tls, pRtree, iBest, *(*uintptr)(unsafe.Pointer(bp /* pNode */)), bp+56 /* &pChild */) + nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pNode */))) + *(*uintptr)(unsafe.Pointer(bp /* pNode */)) = *(*uintptr)(unsafe.Pointer(bp + 56 /* pChild */)) + } + + *(*uintptr)(unsafe.Pointer(ppLeaf)) = *(*uintptr)(unsafe.Pointer(bp /* pNode */)) + return rc +} + +// A cell with the same content as pCell has just been inserted into +// the node pNode. This function updates the bounding box cells in +// all ancestor elements. +func sAdjustTree(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr) int32 { /* sqlite3.c:194507:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var p uintptr = pNode + var cnt int32 = 0 + for (*RtreeNode)(unsafe.Pointer(p)).FpParent != 0 { + var pParent uintptr = (*RtreeNode)(unsafe.Pointer(p)).FpParent + // var cell RtreeCell at bp+8, 48 + + // var iCell int32 at bp, 4 + + if ((libc.PreIncInt32(&cnt, 1)) > 1000) || (nodeParentIndex(tls, pRtree, p, bp /* &iCell */) != 0) { + + return (SQLITE_CORRUPT | (int32(1) << 8)) + } + + nodeGetCell(tls, pRtree, pParent, *(*int32)(unsafe.Pointer(bp /* iCell */)), bp+8 /* &cell */) + if !(cellContains(tls, pRtree, bp+8 /* &cell */, pCell) != 0) { + cellUnion(tls, pRtree, bp+8 /* &cell */, pCell) + nodeOverwriteCell(tls, pRtree, pParent, bp+8 /* &cell */, *(*int32)(unsafe.Pointer(bp /* iCell */))) + } + + p = pParent + } + return SQLITE_OK +} + +// Write mapping (iRowid->iNode) to the _rowid table. +func rowidWrite(tls *libc.TLS, pRtree uintptr, iRowid Sqlite3_int64, iNode Sqlite3_int64) int32 { /* sqlite3.c:194538:12: */ + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid, 1, iRowid) + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid, 2, iNode) + Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + return Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid) +} + +// Write mapping (iNode->iPar) to the _parent table. +func parentWrite(tls *libc.TLS, pRtree uintptr, iNode Sqlite3_int64, iPar Sqlite3_int64) int32 { /* sqlite3.c:194548:12: */ + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteParent, 1, iNode) + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteParent, 2, iPar) + Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteParent) + return Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteParent) +} + +// Arguments aIdx, aDistance and aSpare all point to arrays of size +// nIdx. The aIdx array contains the set of integers from 0 to +// (nIdx-1) in no particular order. This function sorts the values +// in aIdx according to the indexed values in aDistance. For +// example, assuming the inputs: +// +// aIdx = { 0, 1, 2, 3 } +// aDistance = { 5.0, 2.0, 7.0, 6.0 } +// +// this function sets the aIdx array to contain: +// +// aIdx = { 0, 1, 2, 3 } +// +// The aSpare array is used as temporary working space by the +// sorting algorithm. +func sSortByDistance(tls *libc.TLS, aIdx uintptr, nIdx int32, aDistance uintptr, aSpare uintptr) { /* sqlite3.c:194575:13: */ + if nIdx > 1 { + var iLeft int32 = 0 + var iRight int32 = 0 + + var nLeft int32 = (nIdx / 2) + var nRight int32 = (nIdx - nLeft) + var aLeft uintptr = aIdx + var aRight uintptr = (aIdx + uintptr(nLeft)*4) + + sSortByDistance(tls, aLeft, nLeft, aDistance, aSpare) + sSortByDistance(tls, aRight, nRight, aDistance, aSpare) + + libc.Xmemcpy(tls, aSpare, aLeft, (uint64(unsafe.Sizeof(int32(0))) * uint64(nLeft))) + aLeft = aSpare + + for (iLeft < nLeft) || (iRight < nRight) { + if iLeft == nLeft { + *(*int32)(unsafe.Pointer(aIdx + uintptr((iLeft+iRight))*4)) = *(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)) + iRight++ + } else if iRight == nRight { + *(*int32)(unsafe.Pointer(aIdx + uintptr((iLeft+iRight))*4)) = *(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)) + iLeft++ + } else { + var fLeft RtreeDValue = *(*RtreeDValue)(unsafe.Pointer(aDistance + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*8)) + var fRight RtreeDValue = *(*RtreeDValue)(unsafe.Pointer(aDistance + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*8)) + if fLeft < fRight { + *(*int32)(unsafe.Pointer(aIdx + uintptr((iLeft+iRight))*4)) = *(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)) + iLeft++ + } else { + *(*int32)(unsafe.Pointer(aIdx + uintptr((iLeft+iRight))*4)) = *(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)) + iRight++ + } + } + } + + } +} + +// Arguments aIdx, aCell and aSpare all point to arrays of size +// nIdx. The aIdx array contains the set of integers from 0 to +// (nIdx-1) in no particular order. This function sorts the values +// in aIdx according to dimension iDim of the cells in aCell. The +// minimum value of dimension iDim is considered first, the +// maximum used to break ties. +// +// The aSpare array is used as temporary working space by the +// sorting algorithm. +func sSortByDimension(tls *libc.TLS, pRtree uintptr, aIdx uintptr, nIdx int32, iDim int32, aCell uintptr, aSpare uintptr) { /* sqlite3.c:194641:13: */ + if nIdx > 1 { + + var iLeft int32 = 0 + var iRight int32 = 0 + + var nLeft int32 = (nIdx / 2) + var nRight int32 = (nIdx - nLeft) + var aLeft uintptr = aIdx + var aRight uintptr = (aIdx + uintptr(nLeft)*4) + + sSortByDimension(tls, pRtree, aLeft, nLeft, iDim, aCell, aSpare) + sSortByDimension(tls, pRtree, aRight, nRight, iDim, aCell, aSpare) + + libc.Xmemcpy(tls, aSpare, aLeft, (uint64(unsafe.Sizeof(int32(0))) * uint64(nLeft))) + aLeft = aSpare + for (iLeft < nLeft) || (iRight < nRight) { + var xleft1 RtreeDValue = func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + }() + var xleft2 RtreeDValue = func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)))*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + }() + var xright1 RtreeDValue = func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + }() + var xright2 RtreeDValue = func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(*(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)))*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + }() + if (iLeft != nLeft) && (((iRight == nRight) || + (xleft1 < xright1)) || + ((xleft1 == xright1) && (xleft2 < xright2))) { + *(*int32)(unsafe.Pointer(aIdx + uintptr((iLeft+iRight))*4)) = *(*int32)(unsafe.Pointer(aLeft + uintptr(iLeft)*4)) + iLeft++ + } else { + *(*int32)(unsafe.Pointer(aIdx + uintptr((iLeft+iRight))*4)) = *(*int32)(unsafe.Pointer(aRight + uintptr(iRight)*4)) + iRight++ + } + } + + } +} + +// Implementation of the R*-tree variant of SplitNode from Beckman[1990]. +func splitNodeStartree(tls *libc.TLS, pRtree uintptr, aCell uintptr, nCell int32, pLeft uintptr, pRight uintptr, pBboxLeft uintptr, pBboxRight uintptr) int32 { /* sqlite3.c:194700:12: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + var aaSorted uintptr + var aSpare uintptr + var ii int32 + + var iBestDim int32 = 0 + var iBestSplit int32 = 0 + var fBestMargin RtreeDValue = 0.0 + + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim) + 1)) * (uint64(unsafe.Sizeof(uintptr(0))) + (uint64(nCell) * uint64(unsafe.Sizeof(int32(0))))))) + + aaSorted = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(aaSorted != 0) { + return SQLITE_NOMEM + } + + aSpare = ((aaSorted + uintptr((*Rtree)(unsafe.Pointer(pRtree)).FnDim)*8) + uintptr((int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim)*nCell))*4) + libc.Xmemset(tls, aaSorted, 0, uint64(nByte)) + for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim); ii++ { + var jj int32 + *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) = ((aaSorted + uintptr((*Rtree)(unsafe.Pointer(pRtree)).FnDim)*8) + uintptr((ii*nCell))*4) + for jj = 0; jj < nCell; jj++ { + *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(jj)*4)) = jj + } + sSortByDimension(tls, pRtree, *(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)), nCell, ii, aCell, aSpare) + } + + for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim); ii++ { + var margin RtreeDValue = 0.0 + var fBestOverlap RtreeDValue = 0.0 + var fBestArea RtreeDValue = 0.0 + var iBestLeft int32 = 0 + var nLeft int32 + + for nLeft = ((((*Rtree)(unsafe.Pointer((pRtree))).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer((pRtree))).FnBytesPerCell)) / 3); nLeft <= (nCell - ((((*Rtree)(unsafe.Pointer((pRtree))).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer((pRtree))).FnBytesPerCell)) / 3)); nLeft++ { + // var left RtreeCell at bp, 48 + + // var right RtreeCell at bp+48, 48 + + var kk int32 + var overlap RtreeDValue + var area RtreeDValue + + libc.Xmemcpy(tls, bp /* &left */, (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)))))*48), uint64(unsafe.Sizeof(RtreeCell{}))) + libc.Xmemcpy(tls, bp+48 /* &right */, (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr((nCell-1))*4)))*48), uint64(unsafe.Sizeof(RtreeCell{}))) + for kk = 1; kk < (nCell - 1); kk++ { + if kk < nLeft { + cellUnion(tls, pRtree, bp /* &left */, (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(kk)*4)))*48)) + } else { + cellUnion(tls, pRtree, bp+48 /* &right */, (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(ii)*8)) + uintptr(kk)*4)))*48)) + } + } + margin = margin + (cellMargin(tls, pRtree, bp /* &left */)) + margin = margin + (cellMargin(tls, pRtree, bp+48 /* &right */)) + overlap = cellOverlap(tls, pRtree, bp /* &left */, bp+48 /* &right */, 1) + area = (cellArea(tls, pRtree, bp /* &left */) + cellArea(tls, pRtree, bp+48 /* &right */)) + if ((nLeft == ((((*Rtree)(unsafe.Pointer((pRtree))).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer((pRtree))).FnBytesPerCell)) / 3)) || + (overlap < fBestOverlap)) || + ((overlap == fBestOverlap) && (area < fBestArea)) { + iBestLeft = nLeft + fBestOverlap = overlap + fBestArea = area + } + } + + if (ii == 0) || (margin < fBestMargin) { + iBestDim = ii + fBestMargin = margin + iBestSplit = iBestLeft + } + } + + libc.Xmemcpy(tls, pBboxLeft, (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)))))*48), uint64(unsafe.Sizeof(RtreeCell{}))) + libc.Xmemcpy(tls, pBboxRight, (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)) + uintptr(iBestSplit)*4)))*48), uint64(unsafe.Sizeof(RtreeCell{}))) + for ii = 0; ii < nCell; ii++ { + var pTarget uintptr + if ii < iBestSplit { + pTarget = pLeft + } else { + pTarget = pRight + } + var pBbox uintptr + if ii < iBestSplit { + pBbox = pBboxLeft + } else { + pBbox = pBboxRight + } + var pCell uintptr = (aCell + uintptr(*(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aaSorted + uintptr(iBestDim)*8)) + uintptr(ii)*4)))*48) + nodeInsertCell(tls, pRtree, pTarget, pCell) + cellUnion(tls, pRtree, pBbox, pCell) + } + + Xsqlite3_free(tls, aaSorted) + return SQLITE_OK +} + +func updateMapping(tls *libc.TLS, pRtree uintptr, iRowid I64, pNode uintptr, iHeight int32) int32 { /* sqlite3.c:194798:12: */ + var xSetMapping uintptr + xSetMapping = func() uintptr { + if iHeight == 0 { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Sqlite3_int64, Sqlite3_int64) int32 + }{rowidWrite})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Sqlite3_int64, Sqlite3_int64) int32 + }{parentWrite})) + }() + if iHeight > 0 { + var pChild uintptr = nodeHashLookup(tls, pRtree, iRowid) + if pChild != 0 { + nodeRelease(tls, pRtree, (*RtreeNode)(unsafe.Pointer(pChild)).FpParent) + nodeReference(tls, pNode) + (*RtreeNode)(unsafe.Pointer(pChild)).FpParent = pNode + } + } + return (*(*func(*libc.TLS, uintptr, Sqlite3_int64, Sqlite3_int64) int32)(unsafe.Pointer(&xSetMapping)))(tls, pRtree, iRowid, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) +} + +func sSplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHeight int32) int32 { /* sqlite3.c:194817:12: */ + bp := tls.Alloc(100) + defer tls.Free(100) + + var i int32 + var newCellIsRight int32 + var rc int32 + var nCell int32 + var aCell uintptr + var aiUsed uintptr + var pLeft uintptr + var pRight uintptr + // var leftbbox RtreeCell at bp, 48 + + // var rightbbox RtreeCell at bp+48, 48 + + var pParent uintptr + // var iCell int32 at bp+96, 4 + + var iRowid I64 + var iRowid1 I64 + newCellIsRight = 0 + rc = SQLITE_OK + nCell = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData + 2)) + pLeft = uintptr(0) + pRight = uintptr(0) + + // Allocate an array and populate it with a copy of pCell and + // all cells from node pLeft. Then zero the original node. + aCell = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(RtreeCell{})) + uint64(unsafe.Sizeof(int32(0)))) * (uint64(nCell + 1))))) + if !(!(aCell != 0)) { + goto __1 + } + rc = SQLITE_NOMEM + goto splitnode_out +__1: + ; + aiUsed = (aCell + uintptr((nCell+1))*48) + libc.Xmemset(tls, aiUsed, 0, (uint64(unsafe.Sizeof(int32(0))) * (uint64(nCell + 1)))) + i = 0 +__2: + if !(i < nCell) { + goto __4 + } + nodeGetCell(tls, pRtree, pNode, i, (aCell + uintptr(i)*48)) + goto __3 +__3: + i++ + goto __2 + goto __4 +__4: + ; + nodeZero(tls, pRtree, pNode) + libc.Xmemcpy(tls, (aCell + uintptr(nCell)*48), pCell, uint64(unsafe.Sizeof(RtreeCell{}))) + nCell++ + + if !((*RtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1)) { + goto __5 + } + pRight = nodeNew(tls, pRtree, pNode) + pLeft = nodeNew(tls, pRtree, pNode) + (*Rtree)(unsafe.Pointer(pRtree)).FiDepth++ + (*RtreeNode)(unsafe.Pointer(pNode)).FisDirty = 1 + writeInt16(tls, (*RtreeNode)(unsafe.Pointer(pNode)).FzData, (*Rtree)(unsafe.Pointer(pRtree)).FiDepth) + goto __6 +__5: + pLeft = pNode + pRight = nodeNew(tls, pRtree, (*RtreeNode)(unsafe.Pointer(pLeft)).FpParent) + (*RtreeNode)(unsafe.Pointer(pLeft)).FnRef++ +__6: + ; + + if !(!(pLeft != 0) || !(pRight != 0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto splitnode_out +__7: + ; + + libc.Xmemset(tls, (*RtreeNode)(unsafe.Pointer(pLeft)).FzData, 0, uint64((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + libc.Xmemset(tls, (*RtreeNode)(unsafe.Pointer(pRight)).FzData, 0, uint64((*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + + rc = splitNodeStartree(tls, pRtree, aCell, nCell, pLeft, pRight, + bp /* &leftbbox */, bp+48 /* &rightbbox */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto splitnode_out +__8: + ; + + // Ensure both child nodes have node numbers assigned to them by calling + // nodeWrite(). Node pRight always needs a node number, as it was created + // by nodeNew() above. But node pLeft sometimes already has a node number. + // In this case avoid the all to nodeWrite(). + if !((SQLITE_OK != (libc.AssignInt32(&rc, nodeWrite(tls, pRtree, pRight)))) || + ((int64(0) == (*RtreeNode)(unsafe.Pointer(pLeft)).FiNode) && (SQLITE_OK != (libc.AssignInt32(&rc, nodeWrite(tls, pRtree, pLeft)))))) { + goto __9 + } + goto splitnode_out +__9: + ; + + (*RtreeCell)(unsafe.Pointer(bp + 48 /* &rightbbox */)).FiRowid = (*RtreeNode)(unsafe.Pointer(pRight)).FiNode + (*RtreeCell)(unsafe.Pointer(bp /* &leftbbox */)).FiRowid = (*RtreeNode)(unsafe.Pointer(pLeft)).FiNode + + if !((*RtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1)) { + goto __10 + } + rc = rtreeInsertCell(tls, pRtree, (*RtreeNode)(unsafe.Pointer(pLeft)).FpParent, bp /* &leftbbox */, (iHeight + 1)) + if !(rc != SQLITE_OK) { + goto __12 + } + goto splitnode_out +__12: + ; + goto __11 +__10: + pParent = (*RtreeNode)(unsafe.Pointer(pLeft)).FpParent + rc = nodeParentIndex(tls, pRtree, pLeft, bp+96 /* &iCell */) + if !(rc == SQLITE_OK) { + goto __13 + } + nodeOverwriteCell(tls, pRtree, pParent, bp /* &leftbbox */, *(*int32)(unsafe.Pointer(bp + 96 /* iCell */))) + rc = sAdjustTree(tls, pRtree, pParent, bp /* &leftbbox */) +__13: + ; + if !(rc != SQLITE_OK) { + goto __14 + } + goto splitnode_out +__14: + ; +__11: + ; + if !(libc.AssignInt32(&rc, rtreeInsertCell(tls, pRtree, (*RtreeNode)(unsafe.Pointer(pRight)).FpParent, bp+48 /* &rightbbox */, (iHeight+1))) != 0) { + goto __15 + } + goto splitnode_out +__15: + ; + + i = 0 +__16: + if !(i < readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pRight))).FzData+2))) { + goto __18 + } + iRowid = nodeGetRowid(tls, pRtree, pRight, i) + rc = updateMapping(tls, pRtree, iRowid, pRight, iHeight) + if !(iRowid == (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid) { + goto __19 + } + newCellIsRight = 1 +__19: + ; + if !(rc != SQLITE_OK) { + goto __20 + } + goto splitnode_out +__20: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + if !((*RtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1)) { + goto __21 + } + i = 0 +__23: + if !(i < readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pLeft))).FzData+2))) { + goto __25 + } + iRowid1 = nodeGetRowid(tls, pRtree, pLeft, i) + rc = updateMapping(tls, pRtree, iRowid1, pLeft, iHeight) + if !(rc != SQLITE_OK) { + goto __26 + } + goto splitnode_out +__26: + ; + goto __24 +__24: + i++ + goto __23 + goto __25 +__25: + ; + goto __22 +__21: + if !(newCellIsRight == 0) { + goto __27 + } + rc = updateMapping(tls, pRtree, (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid, pLeft, iHeight) +__27: + ; +__22: + ; + + if !(rc == SQLITE_OK) { + goto __28 + } + rc = nodeRelease(tls, pRtree, pRight) + pRight = uintptr(0) +__28: + ; + if !(rc == SQLITE_OK) { + goto __29 + } + rc = nodeRelease(tls, pRtree, pLeft) + pLeft = uintptr(0) +__29: + ; + +splitnode_out: + nodeRelease(tls, pRtree, pRight) + nodeRelease(tls, pRtree, pLeft) + Xsqlite3_free(tls, aCell) + return rc +} + +// If node pLeaf is not the root of the r-tree and its pParent pointer is +// still NULL, load all ancestor nodes of pLeaf into memory and populate +// the pLeaf->pParent chain all the way up to the root node. +// +// This operation is required when a row is deleted (or updated - an update +// is implemented as a delete followed by an insert). SQLite provides the +// rowid of the row to delete, which can be used to find the leaf on which +// the entry resides (argument pLeaf). Once the leaf is located, this +// function is called to determine its ancestry. +func fixLeafParent(tls *libc.TLS, pRtree uintptr, pLeaf uintptr) int32 { /* sqlite3.c:194964:12: */ + var rc int32 = SQLITE_OK + var pChild uintptr = pLeaf + for ((rc == SQLITE_OK) && ((*RtreeNode)(unsafe.Pointer(pChild)).FiNode != int64(1))) && ((*RtreeNode)(unsafe.Pointer(pChild)).FpParent == uintptr(0)) { + var rc2 int32 = SQLITE_OK // sqlite3_reset() return code + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadParent, 1, (*RtreeNode)(unsafe.Pointer(pChild)).FiNode) + rc = Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadParent) + if rc == SQLITE_ROW { + var pTest uintptr // Used to test for reference loops + var iNode I64 // Node number of parent node + + // Before setting pChild->pParent, test that we are not creating a + // loop of references (as we would if, say, pChild==pParent). We don't + // want to do this as it leads to a memory leak when trying to delete + // the referenced counted node structures. + iNode = Xsqlite3_column_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadParent, 0) + for pTest = pLeaf; (pTest != 0) && ((*RtreeNode)(unsafe.Pointer(pTest)).FiNode != iNode); pTest = (*RtreeNode)(unsafe.Pointer(pTest)).FpParent { + } + if !(pTest != 0) { + rc2 = nodeAcquire(tls, pRtree, iNode, uintptr(0), (pChild /* &.pParent */)) + } + } + rc = Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadParent) + if rc == SQLITE_OK { + rc = rc2 + } + if (rc == SQLITE_OK) && !(int32((*RtreeNode)(unsafe.Pointer(pChild)).FpParent) != 0) { + + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + pChild = (*RtreeNode)(unsafe.Pointer(pChild)).FpParent + } + return rc +} + +func removeNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, iHeight int32) int32 { /* sqlite3.c:194999:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 + var rc2 int32 + var pParent uintptr = uintptr(0) + // var iCell int32 at bp, 4 + + // Remove the entry in the parent cell. + rc = nodeParentIndex(tls, pRtree, pNode, bp /* &iCell */) + if rc == SQLITE_OK { + pParent = (*RtreeNode)(unsafe.Pointer(pNode)).FpParent + (*RtreeNode)(unsafe.Pointer(pNode)).FpParent = uintptr(0) + rc = deleteCell(tls, pRtree, pParent, *(*int32)(unsafe.Pointer(bp /* iCell */)), (iHeight + 1)) + } + rc2 = nodeRelease(tls, pRtree, pParent) + if rc == SQLITE_OK { + rc = rc2 + } + if rc != SQLITE_OK { + return rc + } + + // Remove the xxx_node entry. + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteNode, 1, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteNode) + if SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteNode))) { + return rc + } + + // Remove the xxx_parent entry. + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteParent, 1, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteParent) + if SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteParent))) { + return rc + } + + // Remove the node from the in-memory hash table and link it into + // the Rtree.pDeleted list. Its contents will be re-inserted later on. + nodeHashDelete(tls, pRtree, pNode) + (*RtreeNode)(unsafe.Pointer(pNode)).FiNode = I64(iHeight) + (*RtreeNode)(unsafe.Pointer(pNode)).FpNext = (*Rtree)(unsafe.Pointer(pRtree)).FpDeleted + (*RtreeNode)(unsafe.Pointer(pNode)).FnRef++ + (*Rtree)(unsafe.Pointer(pRtree)).FpDeleted = pNode + + return SQLITE_OK +} + +func fixBoundingBox(tls *libc.TLS, pRtree uintptr, pNode uintptr) int32 { /* sqlite3.c:195048:12: */ + bp := tls.Alloc(100) + defer tls.Free(100) + + var pParent uintptr = (*RtreeNode)(unsafe.Pointer(pNode)).FpParent + var rc int32 = SQLITE_OK + if pParent != 0 { + // var ii int32 at bp+96, 4 + + var nCell int32 = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData + 2)) + // var box RtreeCell at bp, 48 + // Bounding box for pNode + nodeGetCell(tls, pRtree, pNode, 0, bp /* &box */) + for *(*int32)(unsafe.Pointer(bp + 96 /* ii */)) = 1; *(*int32)(unsafe.Pointer(bp + 96 /* ii */)) < nCell; *(*int32)(unsafe.Pointer(bp + 96 /* ii */))++ { + // var cell RtreeCell at bp+48, 48 + + nodeGetCell(tls, pRtree, pNode, *(*int32)(unsafe.Pointer(bp + 96 /* ii */)), bp+48 /* &cell */) + cellUnion(tls, pRtree, bp /* &box */, bp+48 /* &cell */) + } + (*RtreeCell)(unsafe.Pointer(bp /* &box */)).FiRowid = (*RtreeNode)(unsafe.Pointer(pNode)).FiNode + rc = nodeParentIndex(tls, pRtree, pNode, bp+96 /* &ii */) + if rc == SQLITE_OK { + nodeOverwriteCell(tls, pRtree, pParent, bp /* &box */, *(*int32)(unsafe.Pointer(bp + 96 /* ii */))) + rc = fixBoundingBox(tls, pRtree, pParent) + } + } + return rc +} + +// Delete the cell at index iCell of node pNode. After removing the +// cell, adjust the r-tree data structure if required. +func deleteCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, iCell int32, iHeight int32) int32 { /* sqlite3.c:195075:12: */ + var pParent uintptr + var rc int32 + + if SQLITE_OK != (libc.AssignInt32(&rc, fixLeafParent(tls, pRtree, pNode))) { + return rc + } + + // Remove the cell from the node. This call just moves bytes around + // the in-memory node image, so it cannot fail. + nodeDeleteCell(tls, pRtree, pNode, iCell) + + // If the node is not the tree root and now has less than the minimum + // number of cells, remove it from the tree. Otherwise, update the + // cell in the parent node so that it tightly contains the updated + // node. + pParent = (*RtreeNode)(unsafe.Pointer(pNode)).FpParent + + if pParent != 0 { + if readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData+2)) < ((((*Rtree)(unsafe.Pointer((pRtree))).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer((pRtree))).FnBytesPerCell)) / 3) { + rc = removeNode(tls, pRtree, pNode, iHeight) + } else { + rc = fixBoundingBox(tls, pRtree, pNode) + } + } + + return rc +} + +func sReinsert(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHeight int32) int32 { /* sqlite3.c:195106:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var aOrder uintptr + var aSpare uintptr + var aCell uintptr + var aDistance uintptr + var nCell int32 + // var aCenterCoord [5]RtreeDValue at bp, 40 + + var iDim int32 + var ii int32 + var rc int32 = SQLITE_OK + var n int32 + + libc.Xmemset(tls, bp /* &aCenterCoord[0] */, 0, (uint64(unsafe.Sizeof(RtreeDValue(0))) * uint64(RTREE_MAX_DIMENSIONS))) + + nCell = (readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData+2)) + 1) + n = ((nCell + 1) & (libc.CplInt32(1))) + + // Allocate the buffers used by this operation. The allocation is + // relinquished before this function returns. + aCell = Xsqlite3_malloc64(tls, (uint64(uint64(n) * (((uint64(unsafe.Sizeof(RtreeCell{})) + uint64(unsafe.Sizeof(int32(0)))) + uint64(unsafe.Sizeof(int32(0)))) + uint64(unsafe.Sizeof(RtreeDValue(0))))))) + if !(aCell != 0) { + return SQLITE_NOMEM + } + aOrder = (aCell + uintptr(n)*48) + aSpare = (aOrder + uintptr(n)*4) + aDistance = (aSpare + uintptr(n)*4) + + for ii = 0; ii < nCell; ii++ { + if ii == (nCell - 1) { + libc.Xmemcpy(tls, (aCell + uintptr(ii)*48), pCell, uint64(unsafe.Sizeof(RtreeCell{}))) + } else { + nodeGetCell(tls, pRtree, pNode, ii, (aCell + uintptr(ii)*48)) + } + *(*int32)(unsafe.Pointer(aOrder + uintptr(ii)*4)) = ii + for iDim = 0; iDim < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim); iDim++ { + *(*RtreeDValue)(unsafe.Pointer(bp /* &aCenterCoord */ + uintptr(iDim)*8)) += (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + }()) + *(*RtreeDValue)(unsafe.Pointer(bp /* &aCenterCoord */ + uintptr(iDim)*8)) += (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + }()) + } + } + for iDim = 0; iDim < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim); iDim++ { + *(*RtreeDValue)(unsafe.Pointer(bp /* &aCenterCoord[0] */ + uintptr(iDim)*8)) = (*(*RtreeDValue)(unsafe.Pointer(bp /* &aCenterCoord[0] */ + uintptr(iDim)*8)) / (float64(nCell) * RtreeDValue(2))) + } + + for ii = 0; ii < nCell; ii++ { + *(*RtreeDValue)(unsafe.Pointer(aDistance + uintptr(ii)*8)) = 0.0 + for iDim = 0; iDim < int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim); iDim++ { + var coord RtreeDValue = ((func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr(((iDim*2)+1))*4))) + }()) - (func() float64 { + if int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 { + return float64(*(*RtreeValue)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + } + return float64(*(*int32)(unsafe.Pointer((aCell + uintptr(ii)*48 + 8 /* &.aCoord */) + uintptr((iDim*2))*4))) + }())) + *(*RtreeDValue)(unsafe.Pointer(aDistance + uintptr(ii)*8)) += ((coord - *(*RtreeDValue)(unsafe.Pointer(bp /* &aCenterCoord[0] */ + uintptr(iDim)*8))) * (coord - *(*RtreeDValue)(unsafe.Pointer(bp /* &aCenterCoord[0] */ + uintptr(iDim)*8)))) + } + } + + sSortByDistance(tls, aOrder, nCell, aDistance, aSpare) + nodeZero(tls, pRtree, pNode) + + for ii = 0; (rc == SQLITE_OK) && (ii < (nCell - (((((*Rtree)(unsafe.Pointer((pRtree))).FiNodeSize - 4) / int32((*Rtree)(unsafe.Pointer((pRtree))).FnBytesPerCell)) / 3) + 1))); ii++ { + var p uintptr = (aCell + uintptr(*(*int32)(unsafe.Pointer(aOrder + uintptr(ii)*4)))*48) + nodeInsertCell(tls, pRtree, pNode, p) + if (*RtreeCell)(unsafe.Pointer(p)).FiRowid == (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid { + if iHeight == 0 { + rc = rowidWrite(tls, pRtree, (*RtreeCell)(unsafe.Pointer(p)).FiRowid, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + } else { + rc = parentWrite(tls, pRtree, (*RtreeCell)(unsafe.Pointer(p)).FiRowid, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + } + } + } + if rc == SQLITE_OK { + rc = fixBoundingBox(tls, pRtree, pNode) + } + for ; (rc == SQLITE_OK) && (ii < nCell); ii++ { + // Find a node to store this cell in. pNode->iNode currently contains + // the height of the sub-tree headed by the cell. + // var pInsert uintptr at bp+40, 8 + + var p uintptr = (aCell + uintptr(*(*int32)(unsafe.Pointer(aOrder + uintptr(ii)*4)))*48) + rc = sChooseLeaf(tls, pRtree, p, iHeight, bp+40 /* &pInsert */) + if rc == SQLITE_OK { + var rc2 int32 + rc = rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 40 /* pInsert */)), p, iHeight) + rc2 = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 40 /* pInsert */))) + if rc == SQLITE_OK { + rc = rc2 + } + } + } + + Xsqlite3_free(tls, aCell) + return rc +} + +// Insert cell pCell into node pNode. Node pNode is the head of a +// subtree iHeight high (leaf nodes have iHeight==0). +func rtreeInsertCell(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHeight int32) int32 { /* sqlite3.c:195211:12: */ + var rc int32 = SQLITE_OK + if iHeight > 0 { + var pChild uintptr = nodeHashLookup(tls, pRtree, (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid) + if pChild != 0 { + nodeRelease(tls, pRtree, (*RtreeNode)(unsafe.Pointer(pChild)).FpParent) + nodeReference(tls, pNode) + (*RtreeNode)(unsafe.Pointer(pChild)).FpParent = pNode + } + } + if nodeInsertCell(tls, pRtree, pNode, pCell) != 0 { + if (iHeight <= (*Rtree)(unsafe.Pointer(pRtree)).FiReinsertHeight) || ((*RtreeNode)(unsafe.Pointer(pNode)).FiNode == int64(1)) { + rc = sSplitNode(tls, pRtree, pNode, pCell, iHeight) + } else { + (*Rtree)(unsafe.Pointer(pRtree)).FiReinsertHeight = iHeight + rc = sReinsert(tls, pRtree, pNode, pCell, iHeight) + } + } else { + rc = sAdjustTree(tls, pRtree, pNode, pCell) + if rc == SQLITE_OK { + if iHeight == 0 { + rc = rowidWrite(tls, pRtree, (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + } else { + rc = parentWrite(tls, pRtree, (*RtreeCell)(unsafe.Pointer(pCell)).FiRowid, (*RtreeNode)(unsafe.Pointer(pNode)).FiNode) + } + } + } + return rc +} + +func reinsertNodeContent(tls *libc.TLS, pRtree uintptr, pNode uintptr) int32 { /* sqlite3.c:195246:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var ii int32 + var rc int32 = SQLITE_OK + var nCell int32 = readInt16(tls, ((*RtreeNode)(unsafe.Pointer((pNode))).FzData + 2)) + + for ii = 0; (rc == SQLITE_OK) && (ii < nCell); ii++ { + // var pInsert uintptr at bp+48, 8 + + // var cell RtreeCell at bp, 48 + + nodeGetCell(tls, pRtree, pNode, ii, bp /* &cell */) + + // Find a node to store this cell in. pNode->iNode currently contains + // the height of the sub-tree headed by the cell. + rc = sChooseLeaf(tls, pRtree, bp /* &cell */, int32((*RtreeNode)(unsafe.Pointer(pNode)).FiNode), bp+48 /* &pInsert */) + if rc == SQLITE_OK { + var rc2 int32 + rc = rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48 /* pInsert */)), bp /* &cell */, int32((*RtreeNode)(unsafe.Pointer(pNode)).FiNode)) + rc2 = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48 /* pInsert */))) + if rc == SQLITE_OK { + rc = rc2 + } + } + } + return rc +} + +// Select a currently unused rowid for a new r-tree record. +func rtreeNewRowid(tls *libc.TLS, pRtree uintptr, piRowid uintptr) int32 { /* sqlite3.c:195275:12: */ + var rc int32 + Xsqlite3_bind_null(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid, 1) + Xsqlite3_bind_null(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid, 2) + Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + rc = Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpWriteRowid) + *(*I64)(unsafe.Pointer(piRowid)) = Xsqlite3_last_insert_rowid(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb) + return rc +} + +// Remove the entry with rowid=iDelete from the r-tree structure. +func rtreeDeleteRowid(tls *libc.TLS, pRtree uintptr, iDelete Sqlite3_int64) int32 { /* sqlite3.c:195288:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var rc int32 // Return code + *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)) = uintptr(0) // Leaf node containing record iDelete + // var iCell int32 at bp+16, 4 + // Index of iDelete cell in pLeaf + *(*uintptr)(unsafe.Pointer(bp /* pRoot */)) = uintptr(0) // Root node of rtree structure + + // Obtain a reference to the root node to initialize Rtree.iDepth + rc = nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp /* &pRoot */) + + // Obtain a reference to the leaf node that contains the entry + // about to be deleted. + if rc == SQLITE_OK { + rc = findLeafNode(tls, pRtree, iDelete, bp+8 /* &pLeaf */, uintptr(0)) + } + + // Delete the cell in question from the leaf node. + if (rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)) != 0) { + var rc2 int32 + rc = nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)), iDelete, bp+16 /* &iCell */) + if rc == SQLITE_OK { + rc = deleteCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)), *(*int32)(unsafe.Pointer(bp + 16 /* iCell */)), 0) + } + rc2 = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */))) + if rc == SQLITE_OK { + rc = rc2 + } + } + + // Delete the corresponding entry in the _rowid table. + if rc == SQLITE_OK { + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteRowid, 1, iDelete) + Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteRowid) + rc = Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpDeleteRowid) + } + + // Check if the root node now has exactly one child. If so, remove + // it, schedule the contents of the child for reinsertion and + // reduce the tree height by one. + // + // This is equivalent to copying the contents of the child into + // the root node (the operation that Gutman's paper says to perform + // in this scenario). + if ((rc == SQLITE_OK) && ((*Rtree)(unsafe.Pointer(pRtree)).FiDepth > 0)) && (readInt16(tls, ((*RtreeNode)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pRoot */))))).FzData+2)) == 1) { + var rc2 int32 + *(*uintptr)(unsafe.Pointer(bp + 24 /* pChild */)) = uintptr(0) + var iChild I64 = nodeGetRowid(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pRoot */)), 0) + rc = nodeAcquire(tls, pRtree, iChild, *(*uintptr)(unsafe.Pointer(bp /* pRoot */)), bp+24 /* &pChild */) + if rc == SQLITE_OK { + rc = removeNode(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 24 /* pChild */)), ((*Rtree)(unsafe.Pointer(pRtree)).FiDepth - 1)) + } + rc2 = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 24 /* pChild */))) + if rc == SQLITE_OK { + rc = rc2 + } + if rc == SQLITE_OK { + (*Rtree)(unsafe.Pointer(pRtree)).FiDepth-- + writeInt16(tls, (*RtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pRoot */)))).FzData, (*Rtree)(unsafe.Pointer(pRtree)).FiDepth) + (*RtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pRoot */)))).FisDirty = 1 + } + } + + // Re-insert the contents of any underfull nodes removed from the tree. + for *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)) = (*Rtree)(unsafe.Pointer(pRtree)).FpDeleted; *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)) != 0; *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)) = (*Rtree)(unsafe.Pointer(pRtree)).FpDeleted { + if rc == SQLITE_OK { + rc = reinsertNodeContent(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */))) + } + (*Rtree)(unsafe.Pointer(pRtree)).FpDeleted = (*RtreeNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */)))).FpNext + (*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef-- + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pLeaf */))) + } + + // Release the reference to the root node. + if rc == SQLITE_OK { + rc = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pRoot */))) + } else { + nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pRoot */))) + } + + return rc +} + +// Rounding constants for float->double conversion. + +// Convert an sqlite3_value into an RtreeValue (presumably a float) +// while taking care to round toward negative or positive, respectively. +func rtreeValueDown(tls *libc.TLS, v uintptr) RtreeValue { /* sqlite3.c:195385:19: */ + var d float64 = Xsqlite3_value_double(tls, v) + var f float32 = float32(d) + if float64(f) > d { + f = (float32(d * (func() float64 { + if d < float64(0) { + return (float64(1.0) + (float64(1.0) / 8388608.0)) + } + return (float64(1.0) - (float64(1.0) / 8388608.0)) + }()))) + } + return f +} + +func rtreeValueUp(tls *libc.TLS, v uintptr) RtreeValue { /* sqlite3.c:195393:19: */ + var d float64 = Xsqlite3_value_double(tls, v) + var f float32 = float32(d) + if float64(f) < d { + f = (float32(d * (func() float64 { + if d < float64(0) { + return (float64(1.0) - (float64(1.0) / 8388608.0)) + } + return (float64(1.0) + (float64(1.0) / 8388608.0)) + }()))) + } + return f +} + +// A constraint has failed while inserting a row into an rtree table. +// Assuming no OOM error occurs, this function sets the error message +// (at pRtree->base.zErrMsg) to an appropriate value and returns +// SQLITE_CONSTRAINT. +// +// Parameter iCol is the index of the leftmost column involved in the +// constraint failure. If it is 0, then the constraint that failed is +// the unique constraint on the id column. Otherwise, it is the rtree +// (c1<=c2) constraint on columns iCol and iCol+1 that has failed. +// +// If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. +func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* sqlite3.c:195416:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0) + var zSql uintptr + var rc int32 + + zSql = Xsqlite3_mprintf(tls, ts+23418 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + if zSql != 0 { + rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) + } else { + rc = SQLITE_NOMEM + } + Xsqlite3_free(tls, zSql) + + if rc == SQLITE_OK { + if iCol == 0 { + var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) + (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, + ts+23438 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + } else { + var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) + var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) + (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, + ts+23470 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) + return func() int32 { + if rc == SQLITE_OK { + return SQLITE_CONSTRAINT + } + return rc + }() +} + +// The xUpdate method for rtree module virtual tables. +func rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) int32 { /* sqlite3.c:195454:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var pRtree uintptr + var rc int32 + // var cell RtreeCell at bp, 48 + // New cell to insert if nData>1 + var bHaveRowid int32 + var steprc int32 + var ii int32 + var nn int32 + var rc2 int32 + var pUp uintptr + var jj int32 + // Insert the new record into the r-tree + // var pLeaf uintptr at bp+48, 8 + pRtree = pVtab + rc = SQLITE_OK + bHaveRowid = 0 // Set to 1 after new rowid is determined + + if !((*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0) { + goto __1 + } + // Unable to write to the btree while another cursor is reading from it, + // since the write might do a rebalance which would disrupt the read + // cursor. + return (SQLITE_LOCKED | (int32(2) << 8)) +__1: + ; + rtreeReference(tls, pRtree) + + (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid = int64(0) // Used only to suppress a compiler warning + + // Constraint handling. A write operation on an r-tree table may return + // SQLITE_CONSTRAINT for two reasons: + // + // 1. A duplicate rowid value, or + // 2. The supplied data violates the "x2>=x1" constraint. + // + // In the first case, if the conflict-handling mode is REPLACE, then + // the conflicting row can be removed before proceeding. In the second + // case, SQLITE_CONSTRAINT must be returned regardless of the + // conflict-handling mode specified by the user. + if !(nData > 1) { + goto __2 + } + nn = (nData - 4) + + if !(nn > int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2)) { + goto __3 + } + nn = int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) +__3: + ; + // Populate the cell.aCoord[] array. The first coordinate is aData[3]. + // + // NB: nData can only be less than nDim*2+3 if the rtree is mis-declared + // with "column" that are interpreted as table constraints. + // Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5)); + // This problem was discovered after years of use, so we silently ignore + // these kinds of misdeclared tables to avoid breaking any legacy. + + if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32) { + goto __4 + } + ii = 0 +__6: + if !(ii < nn) { + goto __8 + } + *(*RtreeValue)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr(ii)*4)) = rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr((ii+3))*8))) + *(*RtreeValue)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr((ii+1))*4)) = rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr((ii+4))*8))) + if !(*(*RtreeValue)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr(ii)*4)) > *(*RtreeValue)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr((ii+1))*4))) { + goto __9 + } + rc = rtreeConstraintError(tls, pRtree, (ii + 1)) + goto constraint +__9: + ; + goto __7 +__7: + ii = ii + (2) + goto __6 + goto __8 +__8: + ; + goto __5 +__4: + + ii = 0 +__10: + if !(ii < nn) { + goto __12 + } + *(*int32)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr((ii+3))*8))) + *(*int32)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr((ii+1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr((ii+4))*8))) + if !(*(*int32)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer((bp /* &cell */ + 8 /* &.aCoord */) + uintptr((ii+1))*4))) { + goto __13 + } + rc = rtreeConstraintError(tls, pRtree, (ii + 1)) + goto constraint +__13: + ; + goto __11 +__11: + ii = ii + (2) + goto __10 + goto __12 +__12: + ; +__5: + ; + + // If a rowid value was supplied, check if it is already present in + // the table. If so, the constraint has failed. + if !(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != SQLITE_NULL) { + goto __14 + } + (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) + if !((Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == SQLITE_NULL) || + (Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid)) { + goto __15 + } + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid, 1, (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid) + steprc = Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + rc = Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + if !(SQLITE_ROW == steprc) { + goto __16 + } + if !(Xsqlite3_vtab_on_conflict(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb) == SQLITE_REPLACE) { + goto __17 + } + rc = rtreeDeleteRowid(tls, pRtree, (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid) + goto __18 +__17: + rc = rtreeConstraintError(tls, pRtree, 0) + goto constraint +__18: + ; +__16: + ; +__15: + ; + bHaveRowid = 1 +__14: + ; +__2: + ; + + // If aData[0] is not an SQL NULL value, it is the rowid of a + // record to delete from the r-tree table. The following block does + // just that. + if !(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != SQLITE_NULL) { + goto __19 + } + rc = rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData)))) +__19: + ; + + // If the aData[] array contains more than one element, elements + // (aData[2]..aData[argc-1]) contain a new record to insert into + // the r-tree structure. + if !((rc == SQLITE_OK) && (nData > 1)) { + goto __20 + } + // Insert the new record into the r-tree + *(*uintptr)(unsafe.Pointer(bp + 48 /* pLeaf */)) = uintptr(0) + + // Figure out the rowid of the new row. + if !(bHaveRowid == 0) { + goto __21 + } + rc = rtreeNewRowid(tls, pRtree, (bp /* &cell */ /* &.iRowid */)) +__21: + ; + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid + + if !(rc == SQLITE_OK) { + goto __22 + } + rc = sChooseLeaf(tls, pRtree, bp /* &cell */, 0, bp+48 /* &pLeaf */) +__22: + ; + if !(rc == SQLITE_OK) { + goto __23 + } + (*Rtree)(unsafe.Pointer(pRtree)).FiReinsertHeight = -1 + rc = rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48 /* pLeaf */)), bp /* &cell */, 0) + rc2 = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48 /* pLeaf */))) + if !(rc == SQLITE_OK) { + goto __24 + } + rc = rc2 +__24: + ; +__23: + ; + if !((rc == SQLITE_OK) && ((*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0)) { + goto __25 + } + pUp = (*Rtree)(unsafe.Pointer(pRtree)).FpWriteAux + Xsqlite3_bind_int64(tls, pUp, 1, *(*Sqlite_int64)(unsafe.Pointer(pRowid))) + jj = 0 +__26: + if !(jj < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux)) { + goto __28 + } + Xsqlite3_bind_value(tls, pUp, (jj + 2), *(*uintptr)(unsafe.Pointer(aData + uintptr(((int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2)+3)+jj))*8))) + goto __27 +__27: + jj++ + goto __26 + goto __28 +__28: + ; + Xsqlite3_step(tls, pUp) + rc = Xsqlite3_reset(tls, pUp) +__25: + ; +__20: + ; + +constraint: + rtreeRelease(tls, pRtree) + return rc +} + +// Called when a transaction starts. +func rtreeBeginTransaction(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:195602:12: */ + var pRtree uintptr = pVtab + + (*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans++ + return SQLITE_OK +} + +// Called when a transaction completes (either by COMMIT or ROLLBACK). +// The sqlite3_blob object should be released at this point. +func rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:195613:12: */ + var pRtree uintptr = pVtab + (*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans = U8(0) + nodeBlobReset(tls, pRtree) + return SQLITE_OK +} + +// The xRename method for rtree module virtual tables. +func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqlite3.c:195623:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var pRtree uintptr = pVtab + var rc int32 = SQLITE_NOMEM + var zSql uintptr = Xsqlite3_mprintf(tls, + + ts+23507 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + if zSql != 0 { + nodeBlobReset(tls, pRtree) + rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_free(tls, zSql) + } + return rc +} + +// The xSavepoint method. +// +// This module does not need to do anything to support savepoints. However, +// it uses this hook to close any open blob handle. This is done because a +// DROP TABLE command - which fortunately always opens a savepoint - cannot +// succeed if there are any open blob handles. i.e. if the blob handle were +// not closed here, the following would fail: +// +// BEGIN; +// INSERT INTO rtree... +// DROP TABLE ; -- Would fail with SQLITE_LOCKED +// COMMIT; +func rtreeSavepoint(tls *libc.TLS, pVtab uintptr, iSavepoint int32) int32 { /* sqlite3.c:195656:12: */ + var pRtree uintptr = pVtab + var iwt U8 = (*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans + _ = iSavepoint + (*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans = U8(0) + nodeBlobReset(tls, pRtree) + (*Rtree)(unsafe.Pointer(pRtree)).FinWrTrans = iwt + return SQLITE_OK +} + +// This function populates the pRtree->nRowEst variable with an estimate +// of the number of rows in the virtual table. If possible, this is based +// on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. +func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlite3.c:195671:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zFmt uintptr = ts + 23652 /* "SELECT stat FROM..." */ + var zSql uintptr + // var p uintptr at bp+16, 8 + + var rc int32 + var nRow I64 = int64(0) + + rc = Xsqlite3_table_column_metadata(tls, + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10073 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc != SQLITE_OK { + (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) + if rc == SQLITE_ERROR { + return SQLITE_OK + } + return rc + } + zSql = Xsqlite3_mprintf(tls, zFmt, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+16 /* &p */, uintptr(0)) + if rc == SQLITE_OK { + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) == SQLITE_ROW { + nRow = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) + } else if rc != SQLITE_NOMEM { + rc = SQLITE_OK + } + + if rc == SQLITE_OK { + if nRow == int64(0) { + (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) + } else { + (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = func() int64 { + if (nRow) > (int64(RTREE_MIN_ROWEST)) { + return nRow + } + return int64(RTREE_MIN_ROWEST) + }() + } + } + Xsqlite3_free(tls, zSql) + } + + return rc +} + +// Return true if zName is the extension on one of the shadow tables used +// by this module. +func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:12: */ + var i uint32 + for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof(azName1)) / uint64(unsafe.Sizeof(uintptr(0)))); i++ { + if Xsqlite3_stricmp(tls, zName, azName1[i]) == 0 { + return 1 + } + } + return 0 +} + +var azName1 = [3]uintptr{ + ts + 23708 /* "node" */, ts + 4175 /* "parent" */, ts + 14758, /* "rowid" */ +} /* sqlite3.c:195716:21 */ + +var rtreeModule = Sqlite3_module{ + FiVersion: 3, // iVersion + FxCreate: 0, // xCreate - create a table + FxConnect: 0, // xConnect - connect to an existing table + FxBestIndex: 0, // xBestIndex - Determine search strategy + FxDisconnect: 0, // xDisconnect - Disconnect from a table + FxDestroy: 0, // xDestroy - Drop a table + FxOpen: 0, // xOpen - open a cursor + FxClose: 0, // xClose - close a cursor + FxFilter: 0, // xFilter - configure scan constraints + FxNext: 0, // xNext - advance a cursor + FxEof: 0, // xEof + FxColumn: 0, // xColumn - read data + FxRowid: 0, // xRowid - read data + FxUpdate: 0, // xUpdate - write data + FxBegin: 0, // xBegin - begin transaction + FxSync: 0, // xSync - sync transaction + FxCommit: 0, // xCommit - commit transaction + FxRollback: 0, // xFindFunction - function overloading + FxRename: 0, // xRename - rename the table + FxSavepoint: 0, // xRollbackTo + FxShadowName: 0, // xShadowName +} /* sqlite3.c:195726:23 */ + +func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefix uintptr, isCreate int32) int32 { /* sqlite3.c:195753:12: */ + bp := tls.Alloc(232) + defer tls.Free(232) + + var rc int32 = SQLITE_OK + // var appStmt [8]uintptr at bp+168, 64 + + var i int32 + var f int32 = (SQLITE_PREPARE_PERSISTENT | SQLITE_PREPARE_NO_VTAB) + + (*Rtree)(unsafe.Pointer(pRtree)).Fdb = db + + if isCreate != 0 { + var zCreate uintptr + var p uintptr = Xsqlite3_str_new(tls, db) + var ii int32 + Xsqlite3_str_appendf(tls, p, + ts+23713, /* "CREATE TABLE \"%w..." */ + libc.VaList(bp, zDb, zPrefix)) + for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { + Xsqlite3_str_appendf(tls, p, ts+23775 /* ",a%d" */, libc.VaList(bp+16, ii)) + } + Xsqlite3_str_appendf(tls, p, + ts+23780, /* ");CREATE TABLE \"..." */ + libc.VaList(bp+24, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, + ts+23844, /* "CREATE TABLE \"%w..." */ + libc.VaList(bp+40, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, + ts+23914, /* "INSERT INTO \"%w\"..." */ + libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + zCreate = Xsqlite3_str_finish(tls, p) + if !(zCreate != 0) { + return SQLITE_NOMEM + } + rc = Xsqlite3_exec(tls, db, zCreate, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_free(tls, zCreate) + if rc != SQLITE_OK { + return rc + } + } + + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */)) = (pRtree + 120 /* &.pWriteNode */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 1*8)) = (pRtree + 128 /* &.pDeleteNode */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 2*8)) = (pRtree + 136 /* &.pReadRowid */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 3*8)) = (pRtree + 144 /* &.pWriteRowid */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 4*8)) = (pRtree + 152 /* &.pDeleteRowid */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 5*8)) = (pRtree + 160 /* &.pReadParent */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 6*8)) = (pRtree + 168 /* &.pWriteParent */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 7*8)) = (pRtree + 176 /* &.pDeleteParent */) + + rc = rtreeQueryStat1(tls, db, pRtree) + for i = 0; (i < N_STATEMENT) && (rc == SQLITE_OK); i++ { + var zSql uintptr + var zFormat uintptr + if (i != 3) || (int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) == 0) { + zFormat = azSql[i] + } else { + // An UPSERT is very slightly slower than REPLACE, but it is needed + // if there are auxiliary columns + zFormat = ts + 23963 /* "INSERT INTO\"%w\"...." */ + } + zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) + if zSql != 0 { + rc = Xsqlite3_prepare_v3(tls, db, zSql, -1, uint32(f), *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + uintptr(i)*8)), uintptr(0)) + } else { + rc = SQLITE_NOMEM + } + Xsqlite3_free(tls, zSql) + } + if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { + (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, + ts+24071, /* "SELECT * FROM \"%..." */ + libc.VaList(bp+96, zDb, zPrefix)) + if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var p uintptr = Xsqlite3_str_new(tls, db) + var ii int32 + var zSql uintptr + Xsqlite3_str_appendf(tls, p, ts+24116 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { + if ii != 0 { + Xsqlite3_str_append(tls, p, ts+11538 /* "," */, 1) + } + if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { + Xsqlite3_str_appendf(tls, p, ts+24143 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + } else { + Xsqlite3_str_appendf(tls, p, ts+24165 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + } + } + Xsqlite3_str_appendf(tls, p, ts+24173 /* " WHERE rowid=?1" */, 0) + zSql = Xsqlite3_str_finish(tls, p) + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = Xsqlite3_prepare_v3(tls, db, zSql, -1, uint32(f), (pRtree + 184 /* &.pWriteAux */), uintptr(0)) + Xsqlite3_free(tls, zSql) + } + } + } + + return rc +} + +var azSql = [8]uintptr{ + // Write the xxx_node table + ts + 24189, /* "INSERT OR REPLAC..." */ + ts + 24242, /* "DELETE FROM '%q'..." */ + + // Read and write the xxx_rowid table + ts + 24287, /* "SELECT nodeno FR..." */ + ts + 24339, /* "INSERT OR REPLAC..." */ + ts + 24393, /* "DELETE FROM '%q'..." */ + + // Read and write the xxx_parent table + ts + 24438, /* "SELECT parentnod..." */ + ts + 24496, /* "INSERT OR REPLAC..." */ + ts + 24551, /* "DELETE FROM '%q'..." */ +} /* sqlite3.c:195763:21 */ + +// The second argument to this function contains the text of an SQL statement +// that returns a single integer value. The statement is compiled and executed +// using database connection db. If successful, the integer value returned +// is written to *piVal and SQLITE_OK returned. Otherwise, an SQLite error +// code is returned and the value of *piVal after returning is not defined. +func getIntFromStmt(tls *libc.TLS, db uintptr, zSql uintptr, piVal uintptr) int32 { /* sqlite3.c:195883:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_NOMEM + if zSql != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + *(*int32)(unsafe.Pointer(piVal)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + } + return rc +} + +// This function is called from within the xConnect() or xCreate() method to +// determine the node-size used by the rtree table being created or connected +// to. If successful, pRtree->iNodeSize is populated and SQLITE_OK returned. +// Otherwise, an SQLite error code is returned. +// +// If this function is being called as part of an xConnect(), then the rtree +// table already exists. In this case the node-size is determined by inspecting +// the root node of the tree. +// +// Otherwise, for an xCreate(), use 64 bytes less than the database page-size. +// This ensures that each node is stored on a single database page. If the +// database page-size is so large that more than RTREE_MAXCELLS entries +// would fit in a single node, use a smaller node-size. +func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzErr uintptr) int32 { /* sqlite3.c:195913:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var rc int32 + var zSql uintptr + if isCreate != 0 { + *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 + zSql = Xsqlite3_mprintf(tls, ts+24598 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) + if rc == SQLITE_OK { + (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) + if (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) < (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize { + (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) + } + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + } + } else { + zSql = Xsqlite3_mprintf(tls, + ts+24618, /* "SELECT length(da..." */ + libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + rc = getIntFromStmt(tls, db, zSql, (pRtree + 32 /* &.iNodeSize */)) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24675, /* "undersize RTree ..." */ + libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + } + } + + Xsqlite3_free(tls, zSql) + return rc +} + +// Return the length of a token +func rtreeTokenLength(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:195956:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* dummy */)) = 0 + return Xsqlite3GetToken(tls, z, bp /* &dummy */) +} + +// This function is the implementation of both the xConnect and xCreate +// methods of the r-tree virtual table. +// +// argv[0] -> module name +// argv[1] -> database name +// argv[2] -> table name +// argv[...] -> column names... +func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr, isCreate int32) int32 { /* sqlite3.c:195970:12: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + var rc int32 + var pRtree uintptr + var nDb int32 // Length of string argv[1] + var nName int32 // Length of string argv[2] + var eCoordType int32 + var pSql uintptr + var zSql uintptr + var ii int32 + var iErr int32 + // var aErrMsg [5]uintptr at bp+96, 40 + + var zArg uintptr + rc = SQLITE_OK + eCoordType = func() int32 { + if pAux != 0 { + return RTREE_COORD_INT32 + } + return RTREE_COORD_REAL32 + }() + ii = 4 + *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ + uintptr(0), // 0 + ts + 24710, /* "Wrong number of ..." */ // 1 + ts + 24753, /* "Too few columns ..." */ // 2 + ts + 24788, /* "Too many columns..." */ // 3 + ts + 24824, /* "Auxiliary rtree ..." */ // 4 + } + + // Aux columns counted by a u8 + if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) + return SQLITE_ERROR +__1: + ; + + Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_CONSTRAINT_SUPPORT, libc.VaList(bp+8, 1)) + + // Allocate the sqlite3_vtab structure + nDb = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + nName = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + pRtree = Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(Rtree{})) + uint64(nDb)) + uint64(nName)) + uint64(2)))) + if !(!(pRtree != 0)) { + goto __2 + } + return SQLITE_NOMEM +__2: + ; + libc.Xmemset(tls, pRtree, 0, (((uint64(unsafe.Sizeof(Rtree{})) + uint64(nDb)) + uint64(nName)) + uint64(2))) + (*Rtree)(unsafe.Pointer(pRtree)).FnBusy = U32(1) + (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FpModule = uintptr(unsafe.Pointer(&rtreeModule)) + (*Rtree)(unsafe.Pointer(pRtree)).FzDb = (pRtree + 1*968) + (*Rtree)(unsafe.Pointer(pRtree)).FzName = ((*Rtree)(unsafe.Pointer(pRtree)).FzDb + uintptr((nDb + 1))) + (*Rtree)(unsafe.Pointer(pRtree)).FeCoordType = U8(eCoordType) + libc.Xmemcpy(tls, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) + libc.Xmemcpy(tls, (*Rtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) + + // Create/Connect to the underlying relational database schema. If + // that is successful, call sqlite3_declare_vtab() to configure + // the r-tree table schema. + pSql = Xsqlite3_str_new(tls, db) + Xsqlite3_str_appendf(tls, pSql, ts+24861, /* "CREATE TABLE x(%..." */ + libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + ii = 4 +__3: + if !(ii < argc) { + goto __5 + } + zArg = *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)) + if !(int32(*(*int8)(unsafe.Pointer(zArg))) == '+') { + goto __6 + } + (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ + Xsqlite3_str_appendf(tls, pSql, ts+24885 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + goto __7 +__6: + if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { + goto __8 + } + goto __5 + goto __9 +__8: + (*Rtree)(unsafe.Pointer(pRtree)).FnDim2++ + Xsqlite3_str_appendf(tls, pSql, azFormat[eCoordType], + libc.VaList(bp+48, rtreeTokenLength(tls, zArg), zArg)) +__9: + ; +__7: + ; + goto __4 +__4: + ii++ + goto __3 + goto __5 +__5: + ; + Xsqlite3_str_appendf(tls, pSql, ts+24891 /* ");" */, 0) + zSql = Xsqlite3_str_finish(tls, pSql) + if !(!(zSql != 0)) { + goto __10 + } + rc = SQLITE_NOMEM + goto __11 +__10: + if !(ii < argc) { + goto __12 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) + rc = SQLITE_ERROR + goto __13 +__12: + if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { + goto __14 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) +__14: + ; +__13: + ; +__11: + ; + Xsqlite3_free(tls, zSql) + if !(rc != 0) { + goto __15 + } + goto rtreeInit_fail +__15: + ; + (*Rtree)(unsafe.Pointer(pRtree)).FnDim = (U8(int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) / 2)) + if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim) < 1) { + goto __16 + } + iErr = 2 + goto __17 +__16: + if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) > (RTREE_MAX_DIMENSIONS * 2)) { + goto __18 + } + iErr = 3 + goto __19 +__18: + if !((int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) % 2) != 0) { + goto __20 + } + iErr = 1 + goto __21 +__20: + iErr = 0 +__21: + ; +__19: + ; +__17: + ; + if !(iErr != 0) { + goto __22 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) + goto rtreeInit_fail +__22: + ; + (*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell = (U8(8 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) * 4))) + + // Figure out the node size to use. + rc = getNodeSize(tls, db, pRtree, isCreate, pzErr) + if !(rc != 0) { + goto __23 + } + goto rtreeInit_fail +__23: + ; + rc = rtreeSqlInit(tls, pRtree, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), isCreate) + if !(rc != 0) { + goto __24 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + goto rtreeInit_fail +__24: + ; + + *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree + return SQLITE_OK + +rtreeInit_fail: + if !(rc == SQLITE_OK) { + goto __25 + } + rc = SQLITE_ERROR +__25: + ; + + rtreeRelease(tls, pRtree) + return rc +} + +var azFormat = [2]uintptr{ts + 24894 /* ",%.*s REAL" */, ts + 24905 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ + +// Implementation of a scalar function that decodes r-tree nodes to +// human readable strings. This can be used for debugging and analysis. +// +// The scalar function takes two arguments: (1) the number of dimensions +// to the rtree (between 1 and 5, inclusive) and (2) a blob of data containing +// an r-tree node. For a two-dimensional r-tree structure called "rt", to +// deserialize all nodes, a statement like: +// +// SELECT rtreenode(2, data) FROM rt_node; +// +// The human readable string takes the form of a Tcl list with one +// entry for each cell in the r-tree node. Each entry is itself a +// list, containing the 8-byte rowid/pageno followed by the +// *2 coordinates. +func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:196107:13: */ + bp := tls.Alloc(1072) + defer tls.Free(1072) + + // var node RtreeNode at bp+16, 40 + + // var tree Rtree at bp+56, 968 + + var ii int32 + var nData int32 + var errCode int32 + var pOut uintptr + + _ = nArg + libc.Xmemset(tls, bp+16 /* &node */, 0, uint64(unsafe.Sizeof(RtreeNode{}))) + libc.Xmemset(tls, bp+56 /* &tree */, 0, uint64(unsafe.Sizeof(Rtree{}))) + (*Rtree)(unsafe.Pointer(bp + 56 /* &tree */)).FnDim = U8(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apArg)))) + if (int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim) < 1) || (int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim) > 5) { + return + } + (*Rtree)(unsafe.Pointer(bp + 56 /* &tree */)).FnDim2 = (U8(int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim) * 2)) + (*Rtree)(unsafe.Pointer(bp + 56 /* &tree */)).FnBytesPerCell = (U8(8 + (8 * int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim)))) + (*RtreeNode)(unsafe.Pointer(bp + 16 /* &node */)).FzData = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + nData = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + if nData < 4 { + return + } + if nData < (readInt16(tls, ((*RtreeNode)(unsafe.Pointer((bp+16 /* &node */))).FzData+2)) * int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnBytesPerCell)) { + return + } + + pOut = Xsqlite3_str_new(tls, uintptr(0)) + for ii = 0; ii < readInt16(tls, ((*RtreeNode)(unsafe.Pointer((bp+16 /* &node */))).FzData+2)); ii++ { + // var cell RtreeCell at bp+1024, 48 + + var jj int32 + + nodeGetCell(tls, bp+56 /* &tree */, bp+16 /* &node */, ii, bp+1024 /* &cell */) + if ii > 0 { + Xsqlite3_str_append(tls, pOut, ts+9653 /* " " */, 1) + } + Xsqlite3_str_appendf(tls, pOut, ts+24915 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) + for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim2); jj++ { + Xsqlite3_str_appendf(tls, pOut, ts+24921 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + } + Xsqlite3_str_append(tls, pOut, ts+24925 /* "}" */, 1) + } + errCode = Xsqlite3_str_errcode(tls, pOut) + Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + Xsqlite3_result_error_code(tls, ctx, errCode) +} + +// This routine implements an SQL function that returns the "depth" parameter +// from the front of a blob that is an r-tree node. For example: +// +// SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1; +// +// The depth value is 0 for all nodes other than the root node, and the root +// node always has nodeno=1, so the example above is the primary use for this +// routine. This routine is intended for testing and analysis only. +func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:196158:13: */ + _ = nArg + if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || + (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { + Xsqlite3_result_error(tls, ctx, ts+24927 /* "Invalid argument..." */, -1) + } else { + var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) + if zBlob != 0 { + Xsqlite3_result_int(tls, ctx, readInt16(tls, zBlob)) + } else { + Xsqlite3_result_error_nomem(tls, ctx) + } + } +} + +// Context object passed between the various routines that make up the +// implementation of integrity-check function rtreecheck(). +type RtreeCheck1 = struct { + Fdb uintptr + FzDb uintptr + FzTab uintptr + FbInt int32 + FnDim int32 + FpGetNode uintptr + FaCheckMapping [2]uintptr + FnLeaf int32 + FnNonLeaf int32 + Frc int32 + _ [4]byte + FzReport uintptr + FnErr int32 + _ [4]byte +} /* sqlite3.c:196179:9 */ + +// Context object passed between the various routines that make up the +// implementation of integrity-check function rtreecheck(). +type RtreeCheck = RtreeCheck1 /* sqlite3.c:196179:27 */ + +// Reset SQL statement pStmt. If the sqlite3_reset() call returns an error, +// and RtreeCheck.rc==SQLITE_OK, set RtreeCheck.rc to the error code. +func rtreeCheckReset(tls *libc.TLS, pCheck uintptr, pStmt uintptr) { /* sqlite3.c:196201:13: */ + var rc int32 = Xsqlite3_reset(tls, pStmt) + if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = rc + } +} + +// The second and subsequent arguments to this function are a format string +// and printf style arguments. This function formats the string and attempts +// to compile it as an SQL statement. +// +// If successful, a pointer to the new SQL statement is returned. Otherwise, +// NULL is returned and an error code left in RtreeCheck.rc. +func rtreeCheckPrepare(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) uintptr { /* sqlite3.c:196214:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var ap Va_list + _ = ap + var z uintptr + *(*uintptr)(unsafe.Pointer(bp /* pRet */)) = uintptr(0) + + ap = va + z = Xsqlite3_vmprintf(tls, zFmt, ap) + + if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + if z == uintptr(0) { + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM + } else { + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_prepare_v2(tls, (*RtreeCheck)(unsafe.Pointer(pCheck)).Fdb, z, -1, bp /* &pRet */, uintptr(0)) + } + } + + Xsqlite3_free(tls, z) + _ = ap + return *(*uintptr)(unsafe.Pointer(bp /* pRet */)) +} + +// The second and subsequent arguments to this function are a printf() +// style format string and arguments. This function formats the string and +// appends it to the report being accumuated in pCheck. +func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) { /* sqlite3.c:196243:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var ap Va_list + _ = ap + ap = va + if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FnErr < RTREE_CHECK_MAX_ERROR) { + var z uintptr = Xsqlite3_vmprintf(tls, zFmt, ap) + if z == uintptr(0) { + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM + } else { + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24960, /* "%z%s%z" */ + libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { + if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { + return ts + 3172 /* "\n" */ + } + return ts + 756 /* "" */ + }(), z)) + if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM + } + } + (*RtreeCheck)(unsafe.Pointer(pCheck)).FnErr++ + } + _ = ap +} + +// This function is a no-op if there is already an error code stored +// in the RtreeCheck object indicated by the first argument. NULL is +// returned in this case. +// +// Otherwise, the contents of rtree table node iNode are loaded from +// the database and copied into a buffer obtained from sqlite3_malloc(). +// If no error occurs, a pointer to the buffer is returned and (*pnNode) +// is set to the size of the buffer in bytes. +// +// Or, if an error does occur, NULL is returned and an error code left +// in the RtreeCheck object. The final value of *pnNode is undefined in +// this case. +func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) uintptr { /* sqlite3.c:196277:11: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pRet uintptr = uintptr(0) // Return value + + if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { + (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, + ts+24967, /* "SELECT data FROM..." */ + libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + } + + if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + Xsqlite3_bind_int64(tls, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, 1, iNode) + if Xsqlite3_step(tls, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) == SQLITE_ROW { + var nNode int32 = Xsqlite3_column_bytes(tls, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, 0) + var pNode uintptr = Xsqlite3_column_blob(tls, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode, 0) + pRet = Xsqlite3_malloc64(tls, uint64(nNode)) + if pRet == uintptr(0) { + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM + } else { + libc.Xmemcpy(tls, pRet, pNode, uint64(nNode)) + *(*int32)(unsafe.Pointer(pnNode)) = nNode + } + } + rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) + if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { + rtreeCheckAppendMsg(tls, pCheck, ts+25012 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + } + } + + return pRet +} + +// This function is used to check that the %_parent (if bLeaf==0) or %_rowid +// (if bLeaf==1) table contains a specified entry. The schemas of the +// two tables are: +// +// CREATE TABLE %_parent(nodeno INTEGER PRIMARY KEY, parentnode INTEGER) +// CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER, ...) +// +// In both cases, this function checks that there exists an entry with +// IPK value iKey and the second column set to iVal. +// +func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVal I64) { /* sqlite3.c:196321:13: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + var rc int32 + var pStmt uintptr + *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ + ts + 25044, /* "SELECT parentnod..." */ + ts + 25098, /* "SELECT nodeno FR..." */ + } + + if *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) = rtreeCheckPrepare(tls, pCheck, + *(*uintptr)(unsafe.Pointer(bp + 80 /* &azSql[0] */ + uintptr(bLeaf)*8)), libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + } + if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc != SQLITE_OK { + return + } + + pStmt = *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) + Xsqlite3_bind_int64(tls, pStmt, 1, iKey) + rc = Xsqlite3_step(tls, pStmt) + if rc == SQLITE_DONE { + rtreeCheckAppendMsg(tls, pCheck, ts+25146, /* "Mapping (%lld ->..." */ + libc.VaList(bp+16, iKey, iVal, func() uintptr { + if bLeaf != 0 { + return ts + 25191 /* "%_rowid" */ + } + return ts + 25199 /* "%_parent" */ + }())) + } else if rc == SQLITE_ROW { + var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) + if ii != iVal { + rtreeCheckAppendMsg(tls, pCheck, + ts+25208, /* "Found (%lld -> %..." */ + libc.VaList(bp+40, iKey, ii, func() uintptr { + if bLeaf != 0 { + return ts + 25191 /* "%_rowid" */ + } + return ts + 25199 /* "%_parent" */ + }(), iKey, iVal)) + } + } + rtreeCheckReset(tls, pCheck, pStmt) +} + +// Argument pCell points to an array of coordinates stored on an rtree page. +// This function checks that the coordinates are internally consistent (no +// x1>x2 conditions) and adds an error message to the RtreeCheck object +// if they are not. +// +// Additionally, if pParent is not NULL, then it is assumed to point to +// the array of coordinates on the parent page that bound the page +// containing pCell. In this case it is also verified that the two +// sets of coordinates are mutually consistent and an error message added +// to the RtreeCheck object if they are not. +func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, pCell uintptr, pParent uintptr) { /* sqlite3.c:196373:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + // var c1 RtreeCoord at bp+48, 4 + + // var c2 RtreeCoord at bp+52, 4 + + // var p1 RtreeCoord at bp+56, 4 + + // var p2 RtreeCoord at bp+60, 4 + + var i int32 + + for i = 0; i < (*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim; i++ { + readCoord(tls, (pCell + uintptr(((4 * 2) * i))), bp+48 /* &c1 */) + readCoord(tls, (pCell + uintptr((4 * ((2 * i) + 1)))), bp+52 /* &c2 */) + + // printf("%e, %e\n", c1.u.f, c2.u.f); + if func() int32 { + if (*RtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { + return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*int32)(unsafe.Pointer(bp + 52 /* &c2 */)))) + } + return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) + }() != 0 { + rtreeCheckAppendMsg(tls, pCheck, + ts+25266 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + } + + if pParent != 0 { + readCoord(tls, (pParent + uintptr(((4 * 2) * i))), bp+56 /* &p1 */) + readCoord(tls, (pParent + uintptr((4 * ((2 * i) + 1)))), bp+60 /* &p2 */) + + if (func() int32 { + if (*RtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { + return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 48 /* &c1 */)) < *(*int32)(unsafe.Pointer(bp + 56 /* &p1 */)))) + } + return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) < *(*RtreeValue)(unsafe.Pointer(bp + 56 /* &p1 */)))) + }() != 0) || + (func() int32 { + if (*RtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { + return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*int32)(unsafe.Pointer(bp + 60 /* &p2 */)))) + } + return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) + }() != 0) { + rtreeCheckAppendMsg(tls, pCheck, + ts+25314 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + } + } + } +} + +// Run rtreecheck() checks on node iNode, which is at depth iDepth within +// the r-tree structure. Argument aParent points to the array of coordinates +// that bound node iNode on the parent node. +// +// If any problems are discovered, an error message is appended to the +// report accumulated in the RtreeCheck object. +func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr, iNode I64) { /* sqlite3.c:196419:13: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var aNode uintptr = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) = 0 + + aNode = rtreeCheckGetNode(tls, pCheck, iNode, bp+48 /* &nNode */) + if aNode != 0 { + if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { + rtreeCheckAppendMsg(tls, pCheck, + ts+25381 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + } else { + var nCell int32 // Number of cells on page + var i int32 // Used to iterate through cells + if aParent == uintptr(0) { + iDepth = readInt16(tls, aNode) + if iDepth > RTREE_MAX_DEPTH { + rtreeCheckAppendMsg(tls, pCheck, ts+25415 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + Xsqlite3_free(tls, aNode) + return + } + } + nCell = readInt16(tls, (aNode + 2)) + if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { + rtreeCheckAppendMsg(tls, pCheck, + ts+25445, /* "Node %lld is too..." */ + libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + } else { + for i = 0; i < nCell; i++ { + var pCell uintptr = (aNode + uintptr((4 + (i * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))))) + var iVal I64 = readInt64(tls, pCell) + rtreeCheckCellCoord(tls, pCheck, iNode, i, (pCell + 8), aParent) + + if iDepth > 0 { + rtreeCheckMapping(tls, pCheck, 0, iVal, iNode) + rtreeCheckNode(tls, pCheck, (iDepth - 1), (pCell + 8), iVal) + (*RtreeCheck)(unsafe.Pointer(pCheck)).FnNonLeaf++ + } else { + rtreeCheckMapping(tls, pCheck, 1, iVal, iNode) + (*RtreeCheck)(unsafe.Pointer(pCheck)).FnLeaf++ + } + } + } + } + Xsqlite3_free(tls, aNode) + } +} + +// The second argument to this function must be either "_rowid" or +// "_parent". This function checks that the number of entries in the +// %_rowid or %_parent table is exactly nExpect. If not, it adds +// an error message to the report in the RtreeCheck object indicated +// by the first argument. +func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { /* sqlite3.c:196482:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { + var pCount uintptr + pCount = rtreeCheckPrepare(tls, pCheck, ts+25500, /* "SELECT count(*) ..." */ + libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) + if pCount != 0 { + if Xsqlite3_step(tls, pCount) == SQLITE_ROW { + var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) + if nActual != nExpect { + rtreeCheckAppendMsg(tls, pCheck, + ts+25531 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + } + } + (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) + } + } +} + +// This function does the bulk of the work for the rtree integrity-check. +// It is called by rtreecheck(), which is the SQL function implementation. +func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzReport uintptr) int32 { /* sqlite3.c:196506:12: */ + bp := tls.Alloc(120) + defer tls.Free(120) + + // var check RtreeCheck at bp+32, 88 + // Common context for various routines + var pStmt uintptr = uintptr(0) // Used to find column count of rtree table + var bEnd int32 = 0 // True if transaction should be closed + var nAux int32 = 0 // Number of extra columns. + + // Initialize the context object + libc.Xmemset(tls, bp+32 /* &check */, 0, uint64(unsafe.Sizeof(RtreeCheck{}))) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Fdb = db + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FzDb = zDb + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FzTab = zTab + + // If there is not already an open transaction, open one now. This is + // to ensure that the queries run as part of this integrity-check operate + // on a consistent snapshot. + if Xsqlite3_get_autocommit(tls, db) != 0 { + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13214 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + bEnd = 1 + } + + // Find the number of auxiliary columns + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25598 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + if pStmt != 0 { + nAux = (Xsqlite3_column_count(tls, pStmt) - 2) + Xsqlite3_finalize(tls, pStmt) + } + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = SQLITE_OK + } + + // Find number of dimensions in the rtree table. + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23418 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + if pStmt != 0 { + var rc int32 + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25626 /* "Schema corrupt o..." */, 0) + } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) + } + rc = Xsqlite3_finalize(tls, pStmt) + if rc != SQLITE_CORRUPT { + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc + } + } + + // Do the actual integrity-check + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim >= 1 { + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { + rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) + } + rtreeCheckCount(tls, bp+32 /* &check */, ts+25657 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25664 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + } + + // Finalize SQL statements used by the integrity-check + Xsqlite3_finalize(tls, (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FpGetNode) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((bp + 32 /* &check */ + 40 /* &.aCheckMapping */)))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((bp + 32 /* &check */ + 40 /* &.aCheckMapping */) + 1*8))) + + // If one was opened, close the transaction + if bEnd != 0 { + var rc int32 = Xsqlite3_exec(tls, db, ts+25672 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc + } + } + *(*uintptr)(unsafe.Pointer(pzReport)) = (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FzReport + return (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc +} + +// Usage: +// +// rtreecheck(); +// rtreecheck(, ); +// +// Invoking this SQL function runs an integrity-check on the named rtree +// table. The integrity-check verifies the following: +// +// 1. For each cell in the r-tree structure (%_node table), that: +// +// a) for each dimension, (coord1 <= coord2). +// +// b) unless the cell is on the root node, that the cell is bounded +// by the parent cell on the parent node. +// +// c) for leaf nodes, that there is an entry in the %_rowid +// table corresponding to the cell's rowid value that +// points to the correct node. +// +// d) for cells on non-leaf nodes, that there is an entry in the +// %_parent table mapping from the cell's child node to the +// node that it resides on. +// +// 2. That there are the same number of entries in the %_rowid table +// as there are leaf cells in the r-tree structure, and that there +// is a leaf cell that corresponds to each entry in the %_rowid table. +// +// 3. That there are the same number of entries in the %_parent table +// as there are non-leaf cells in the r-tree structure, and that +// there is a non-leaf cell that corresponds to each entry in the +// %_parent table. +func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:196611:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (nArg != 1) && (nArg != 2) { + Xsqlite3_result_error(tls, ctx, + ts+25676 /* "wrong number of ..." */, -1) + } else { + var rc int32 + *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) + var zDb uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg))) + var zTab uintptr + if nArg == 1 { + zTab = zDb + zDb = ts + 5459 /* "main" */ + } else { + zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + } + rc = rtreeCheckTable(tls, Xsqlite3_context_db_handle(tls, ctx), zDb, zTab, bp /* &zReport */) + if rc == SQLITE_OK { + Xsqlite3_result_text(tls, ctx, func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { + return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) + } + return ts + 16337 /* "ok" */ + }(), -1, libc.UintptrFromInt32(-1)) + } else { + Xsqlite3_result_error_code(tls, ctx, rc) + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp /* zReport */))) + } +} + +// Conditionally include the geopoly code +//************* Include geopoly.c in the middle of rtree.c ****************** +//************* Begin file geopoly.c **************************************** +// 2018-05-25 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file implements an alternative R-Tree virtual table that +// uses polygons to express the boundaries of 2-dimensional objects. +// +// This file is #include-ed onto the end of "rtree.c" so that it has +// access to all of the R-Tree internals. +// #include + +// Enable -DGEOPOLY_ENABLE_DEBUG for debugging facilities + +// Compiler and version + +// Datatype for coordinates +type GeoCoord = float32 /* sqlite3.c:196735:15 */ + +// Internal representation of a polygon. +// +// The polygon consists of a sequence of vertexes. There is a line +// segment between each pair of vertexes, and one final segment from +// the last vertex back to the first. (This differs from the GeoJSON +// standard in which the final vertex is a repeat of the first.) +// +// The polygon follows the right-hand rule. The area to the right of +// each segment is "outside" and the area to the left is "inside". +// +// The on-disk representation consists of a 4-byte header followed by +// the values. The 4-byte header is: +// +// encoding (1 byte) 0=big-endian, 1=little-endian +// nvertex (3 bytes) Number of vertexes as a big-endian integer +// +// Enough space is allocated for 4 coordinates, to work around over-zealous +// warnings coming from some compiler (notably, clang). In reality, the size +// of each GeoPoly memory allocate is adjusted as necessary so that the +// GeoPoly.a[] array at the end is the appropriate size. +type GeoPoly1 = struct { + FnVertex int32 + Fhdr [4]uint8 + Fa [8]GeoCoord +} /* sqlite3.c:196759:9 */ + +// Internal representation of a polygon. +// +// The polygon consists of a sequence of vertexes. There is a line +// segment between each pair of vertexes, and one final segment from +// the last vertex back to the first. (This differs from the GeoJSON +// standard in which the final vertex is a repeat of the first.) +// +// The polygon follows the right-hand rule. The area to the right of +// each segment is "outside" and the area to the left is "inside". +// +// The on-disk representation consists of a 4-byte header followed by +// the values. The 4-byte header is: +// +// encoding (1 byte) 0=big-endian, 1=little-endian +// nvertex (3 bytes) Number of vertexes as a big-endian integer +// +// Enough space is allocated for 4 coordinates, to work around over-zealous +// warnings coming from some compiler (notably, clang). In reality, the size +// of each GeoPoly memory allocate is adjusted as necessary so that the +// GeoPoly.a[] array at the end is the appropriate size. +type GeoPoly = GeoPoly1 /* sqlite3.c:196759:24 */ + +// The size of a memory allocation needed for a GeoPoly object sufficient +// to hold N coordinate pairs. + +// Macros to access coordinates of a GeoPoly. +// We have to use these macros, rather than just say p->a[i] in order +// to silence (incorrect) UBSAN warnings if the array index is too large. + +// State of a parse of a GeoJSON input. +type GeoParse1 = struct { + Fz uintptr + FnVertex int32 + FnAlloc int32 + FnErr int32 + _ [4]byte + Fa uintptr +} /* sqlite3.c:196782:9 */ + +// The size of a memory allocation needed for a GeoPoly object sufficient +// to hold N coordinate pairs. + +// Macros to access coordinates of a GeoPoly. +// We have to use these macros, rather than just say p->a[i] in order +// to silence (incorrect) UBSAN warnings if the array index is too large. + +// State of a parse of a GeoJSON input. +type GeoParse = GeoParse1 /* sqlite3.c:196782:25 */ + +// Do a 4-byte byte swap +func geopolySwab32(tls *libc.TLS, a uintptr) { /* sqlite3.c:196792:13: */ + var t uint8 = *(*uint8)(unsafe.Pointer(a)) + *(*uint8)(unsafe.Pointer(a)) = *(*uint8)(unsafe.Pointer(a + 3)) + *(*uint8)(unsafe.Pointer(a + 3)) = t + t = *(*uint8)(unsafe.Pointer(a + 1)) + *(*uint8)(unsafe.Pointer(a + 1)) = *(*uint8)(unsafe.Pointer(a + 2)) + *(*uint8)(unsafe.Pointer(a + 2)) = t +} + +// Skip whitespace. Return the next non-whitespace character. +func geopolySkipSpace(tls *libc.TLS, p uintptr) int8 { /* sqlite3.c:196802:13: */ + for jsonIsSpace[*(*uint8)(unsafe.Pointer((*GeoParse)(unsafe.Pointer(p)).Fz))] != 0 { + (*GeoParse)(unsafe.Pointer(p)).Fz++ + } + return int8(*(*uint8)(unsafe.Pointer((*GeoParse)(unsafe.Pointer(p)).Fz))) +} + +// Parse out a number. Write the value into *pVal if pVal!=0. +// return non-zero on success and zero if the next token is not a number. +func geopolyParseNumber(tls *libc.TLS, p uintptr, pVal uintptr) int32 { /* sqlite3.c:196810:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var c int8 = geopolySkipSpace(tls, p) + var z uintptr = (*GeoParse)(unsafe.Pointer(p)).Fz + var j int32 = 0 + var seenDP int32 = 0 + var seenE int32 = 0 + if int32(c) == '-' { + j = 1 + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr(j)))) + } + if ((int32(c) == '0') && (int32(*(*uint8)(unsafe.Pointer(z + uintptr((j + 1))))) >= '0')) && (int32(*(*uint8)(unsafe.Pointer(z + uintptr((j + 1))))) <= '9') { + return 0 + } + for ; ; j++ { + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr(j)))) + if (int32(Xsqlite3CtypeMap[uint8(c)]) & 0x04) != 0 { + continue + } + if int32(c) == '.' { + if int32(*(*uint8)(unsafe.Pointer(z + uintptr((j - 1))))) == '-' { + return 0 + } + if seenDP != 0 { + return 0 + } + seenDP = 1 + continue + } + if (int32(c) == 'e') || (int32(c) == 'E') { + if int32(*(*uint8)(unsafe.Pointer(z + uintptr((j - 1))))) < '0' { + return 0 + } + if seenE != 0 { + return -1 + } + seenDP = libc.AssignInt32(&seenE, 1) + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr((j + 1))))) + if (int32(c) == '+') || (int32(c) == '-') { + j++ + c = int8(*(*uint8)(unsafe.Pointer(z + uintptr((j + 1))))) + } + if (int32(c) < '0') || (int32(c) > '9') { + return 0 + } + continue + } + break + } + if int32(*(*uint8)(unsafe.Pointer(z + uintptr((j - 1))))) < '0' { + return 0 + } + if pVal != 0 { + // The sqlite3AtoF() routine is much much faster than atof(), if it + // is available + // var r float64 at bp, 8 + + Xsqlite3AtoF(tls, (*GeoParse)(unsafe.Pointer(p)).Fz, bp /* &r */, j, uint8(SQLITE_UTF8)) + *(*GeoCoord)(unsafe.Pointer(pVal)) = GeoCoord(*(*float64)(unsafe.Pointer(bp /* r */))) + } + *(*uintptr)(unsafe.Pointer(p /* &.z */)) += (uintptr(j)) + return 1 +} + +// If the input is a well-formed JSON array of coordinates with at least +// four coordinates and where each coordinate is itself a two-value array, +// then convert the JSON into a GeoPoly object and return a pointer to +// that object. +// +// If any error occurs, return NULL. +func geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) uintptr { /* sqlite3.c:196868:16: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + // var s GeoParse at bp, 32 + + var rc int32 + var aNew uintptr + var ii int32 + var c int8 + var pOut uintptr + // var x int32 at bp+32, 4 + rc = SQLITE_OK + libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(GeoParse{}))) + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fz = z + if !(int32(geopolySkipSpace(tls, bp /* &s */)) == '[') { + goto __1 + } + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fz++ +__2: + if !(int32(geopolySkipSpace(tls, bp /* &s */)) == '[') { + goto __3 + } + ii = 0 + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fz++ + if !((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex >= (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnAlloc) { + goto __4 + } + (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnAlloc = (((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnAlloc * 2) + 16) + aNew = Xsqlite3_realloc64(tls, (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa, (uint64((uint64((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnAlloc) * uint64(unsafe.Sizeof(GeoCoord(0)))) * uint64(2)))) + if !(aNew == uintptr(0)) { + goto __5 + } + rc = SQLITE_NOMEM + (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnErr++ + goto __3 +__5: + ; + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa = aNew +__4: + ; +__6: + if !(geopolyParseNumber(tls, bp /* &s */, func() uintptr { + if ii <= 1 { + return ((*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa + uintptr((((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex*2)+ii))*4) + } + return uintptr(0) + }()) != 0) { + goto __7 + } + ii++ + if !(ii == 2) { + goto __8 + } + (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex++ +__8: + ; + c = geopolySkipSpace(tls, bp /* &s */) + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fz++ + if !(int32(c) == ',') { + goto __9 + } + goto __6 +__9: + ; + if !((int32(c) == ']') && (ii >= 2)) { + goto __10 + } + goto __7 +__10: + ; + (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnErr++ + rc = SQLITE_ERROR + goto parse_json_err + goto __6 +__7: + ; + if !(int32(geopolySkipSpace(tls, bp /* &s */)) == ',') { + goto __11 + } + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fz++ + goto __2 +__11: + ; + goto __3 + goto __2 +__3: + ; + if !(((((int32(geopolySkipSpace(tls, bp /* &s */)) == ']') && + ((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex >= 4)) && + (*(*GeoCoord)(unsafe.Pointer((*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa)) == *(*GeoCoord)(unsafe.Pointer((*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa + uintptr((((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex*2)-2))*4)))) && + (*(*GeoCoord)(unsafe.Pointer((*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa + 1*4)) == *(*GeoCoord)(unsafe.Pointer((*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa + uintptr((((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex*2)-1))*4)))) && + (func() bool { + (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fz++ + return (int32(geopolySkipSpace(tls, bp /* &s */)) == 0) + }())) { + goto __12 + } + *(*int32)(unsafe.Pointer(bp + 32 /* x */)) = 1 + (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex-- // Remove the redundant vertex at the end + pOut = Xsqlite3_malloc64(tls, (uint64(unsafe.Sizeof(GeoPoly{})) + ((uint64(unsafe.Sizeof(GeoCoord(0))) * uint64(2)) * (uint64((Sqlite3_int64((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex)) - int64(4)))))) + *(*int32)(unsafe.Pointer(bp + 32 /* x */)) = 1 + if !(pOut == uintptr(0)) { + goto __14 + } + goto parse_json_err +__14: + ; + (*GeoPoly)(unsafe.Pointer(pOut)).FnVertex = (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex + libc.Xmemcpy(tls, pOut+8 /* &.a */, (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa, ((uint64((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex * 2)) * uint64(unsafe.Sizeof(GeoCoord(0))))) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */))) = *(*uint8)(unsafe.Pointer(bp + 32 /* &x */)) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */) + 1)) = (uint8(((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex >> 16) & 0xff)) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */) + 2)) = (uint8(((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex >> 8) & 0xff)) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */) + 3)) = (uint8((*GeoParse)(unsafe.Pointer(bp /* &s */)).FnVertex & 0xff)) + Xsqlite3_free(tls, (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa) + if !(pRc != 0) { + goto __15 + } + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK +__15: + ; + return pOut + goto __13 +__12: + (*GeoParse)(unsafe.Pointer(bp /* &s */)).FnErr++ + rc = SQLITE_ERROR +__13: + ; +__1: + ; +parse_json_err: + if !(pRc != 0) { + goto __16 + } + *(*int32)(unsafe.Pointer(pRc)) = rc +__16: + ; + Xsqlite3_free(tls, (*GeoParse)(unsafe.Pointer(bp /* &s */)).Fa) + return uintptr(0) +} + +// Given a function parameter, try to interpret it as a polygon, either +// in the binary format or JSON text. Compute a GeoPoly object and +// return a pointer to that object. Or if the input is not a well-formed +// polygon, put an error message in sqlite3_context and return NULL. +func geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) uintptr { /* sqlite3.c:196945:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = uintptr(0) + var nByte int32 + if (Xsqlite3_value_type(tls, pVal) == SQLITE_BLOB) && + ((uint64(libc.AssignInt32(&nByte, Xsqlite3_value_bytes(tls, pVal)))) >= (uint64(4) + (uint64(6) * uint64(unsafe.Sizeof(GeoCoord(0)))))) { + var a uintptr = Xsqlite3_value_blob(tls, pVal) + var nVertex int32 + if a == uintptr(0) { + Xsqlite3_result_error_nomem(tls, pCtx) + return uintptr(0) + } + nVertex = (((int32(*(*uint8)(unsafe.Pointer(a + 1))) << 16) + (int32(*(*uint8)(unsafe.Pointer(a + 2))) << 8)) + int32(*(*uint8)(unsafe.Pointer(a + 3)))) + if ((int32(*(*uint8)(unsafe.Pointer(a))) == 0) || (int32(*(*uint8)(unsafe.Pointer(a))) == 1)) && + ((((uint64(nVertex * 2)) * uint64(unsafe.Sizeof(GeoCoord(0)))) + uint64(4)) == uint64(uint32(nByte))) { + p = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(GeoPoly{})) + ((uint64((nVertex - 1) * 2)) * uint64(unsafe.Sizeof(GeoCoord(0))))))) + if p == uintptr(0) { + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + if pCtx != 0 { + Xsqlite3_result_error_nomem(tls, pCtx) + } + } else { + *(*int32)(unsafe.Pointer(bp /* x */)) = 1 + (*GeoPoly)(unsafe.Pointer(p)).FnVertex = nVertex + libc.Xmemcpy(tls, p+4 /* &.hdr */, a, uint64(nByte)) + if int32(*(*uint8)(unsafe.Pointer(a))) != int32(*(*uint8)(unsafe.Pointer(bp /* &x */))) { + var ii int32 + for ii = 0; ii < nVertex; ii++ { + geopolySwab32(tls, ((p + 8 /* &.a */) + uintptr(((ii)*2))*4)) + geopolySwab32(tls, ((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4)) + } + *(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */))) ^= uint8((1)) + } + } + } + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK + } + return p + } else if Xsqlite3_value_type(tls, pVal) == SQLITE_TEXT { + var zJson uintptr = Xsqlite3_value_text(tls, pVal) + if zJson == uintptr(0) { + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + return uintptr(0) + } + return geopolyParseJson(tls, zJson, pRc) + } else { + if pRc != 0 { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR + } + return uintptr(0) + } + return uintptr(0) +} + +// Implementation of the geopoly_blob(X) function. +// +// If the input is a well-formed Geopoly BLOB or JSON string +// then return the BLOB representation of the polygon. Otherwise +// return NULL. +func geopolyBlobFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197005:13: */ + var p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + if p != 0 { + Xsqlite3_result_blob(tls, context, p+4, /* &.hdr */ + (4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, p) + } +} + +// SQL function: geopoly_json(X) +// +// Interpret X as a polygon and render it as a JSON array +// of coordinates. Or, if X is not a valid polygon, return NULL. +func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197024:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + if p != 0 { + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var x uintptr = Xsqlite3_str_new(tls, db) + var i int32 + Xsqlite3_str_append(tls, x, ts+25727 /* "[" */, 1) + for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { + Xsqlite3_str_appendf(tls, x, ts+25729 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + } + Xsqlite3_str_appendf(tls, x, ts+25740 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + Xsqlite3_free(tls, p) + } +} + +// SQL function: geopoly_svg(X, ....) +// +// Interpret X as a polygon and render it as a SVG . +// Additional arguments are added as attributes to the . +func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197050:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var p uintptr + if argc < 1 { + return + } + p = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + if p != 0 { + var db uintptr = Xsqlite3_context_db_handle(tls, context) + var x uintptr = Xsqlite3_str_new(tls, db) + var i int32 + var cSep int8 = int8('\'') + Xsqlite3_str_appendf(tls, x, ts+25751 /* "" */, 0) + Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + Xsqlite3_free(tls, p) + } +} + +// SQL Function: geopoly_xform(poly, A, B, C, D, E, F) +// +// Transform and/or translate a polygon as follows: +// +// x1 = A*x0 + B*y0 + E +// y1 = C*x0 + D*y0 + F +// +// For a translation: +// +// geopoly_xform(poly, 1, 0, 0, 1, x-offset, y-offset) +// +// Rotate by R around the point (0,0): +// +// geopoly_xform(poly, cos(R), sin(R), -sin(R), cos(R), 0, 0) +func geopolyXformFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197097:13: */ + var p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + var A float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + var B float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + var C float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + var D float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) + var E float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) + var F float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 6*8))) + var x1 GeoCoord + var y1 GeoCoord + var x0 GeoCoord + var y0 GeoCoord + var ii int32 + if p != 0 { + for ii = 0; ii < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; ii++ { + x0 = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4)) + y0 = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4)) + x1 = (GeoCoord(((A * float64(x0)) + (B * float64(y0))) + E)) + y1 = (GeoCoord(((C * float64(x0)) + (D * float64(y0))) + F)) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) = x1 + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) = y1 + } + Xsqlite3_result_blob(tls, context, p+4, /* &.hdr */ + (4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, p) + } +} + +// Compute the area enclosed by the polygon. +// +// This routine can also be used to detect polygons that rotate in +// the wrong direction. Polygons are suppose to be counter-clockwise (CCW). +// This routine returns a negative value for clockwise (CW) polygons. +func geopolyArea(tls *libc.TLS, p uintptr) float64 { /* sqlite3.c:197133:15: */ + var rArea float64 = 0.0 + var ii int32 + for ii = 0; ii < ((*GeoPoly)(unsafe.Pointer(p)).FnVertex - 1); ii++ { + rArea = rArea + ((float64(((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) - (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii+1)*2))*4)))) * // (x0 - x1) + ((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii+1)*2)+1))*4)))))) * // (y0 + y1) + 0.5) + } + rArea = rArea + ((float64(((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) - (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */))))) * // (xN - x0) + ((*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4)))))) * // (yN + y0) + 0.5) + return rArea +} + +// Implementation of the geopoly_area(X) function. +// +// If the input is a well-formed Geopoly BLOB then return the area +// enclosed by the polygon. If the polygon circulates clockwise instead +// of counterclockwise (as it should) then return the negative of the +// enclosed area. Otherwise return NULL. +func geopolyAreaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197155:13: */ + var p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + if p != 0 { + Xsqlite3_result_double(tls, context, geopolyArea(tls, p)) + Xsqlite3_free(tls, p) + } +} + +// Implementation of the geopoly_ccw(X) function. +// +// If the rotation of polygon X is clockwise (incorrect) instead of +// counter-clockwise (the correct winding order according to RFC7946) +// then reverse the order of the vertexes in polygon X. +// +// In other words, this routine returns a CCW polygon regardless of the +// winding order of its input. +// +// Use this routine to sanitize historical inputs that that sometimes +// contain polygons that wind in the wrong direction. +func geopolyCcwFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197180:13: */ + var p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + if p != 0 { + if geopolyArea(tls, p) < 0.0 { + var ii int32 + var jj int32 + ii = 1 + jj = ((*GeoPoly)(unsafe.Pointer(p)).FnVertex - 1) + __1: + if !(ii < jj) { + goto __3 + } + { + var t GeoCoord = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4)) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((ii)*2))*4))) = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((jj)*2))*4)) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((jj)*2))*4))) = t + t = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4)) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))) = *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((jj)*2)+1))*4)) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((jj)*2)+1))*4))) = t + + } + goto __2 + __2: + ii++ + jj-- + goto __1 + goto __3 + __3: + } + Xsqlite3_result_blob(tls, context, p+4, /* &.hdr */ + (4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, p) + } +} + +// Fast approximation for sine(X) for X between -0.5*pi and 2*pi +func geopolySine(tls *libc.TLS, r float64) float64 { /* sqlite3.c:197208:15: */ + + if r >= (float64(1.5) * 3.1415926535897932385) { + r = r - (float64(2.0) * 3.1415926535897932385) + } + if r >= (float64(0.5) * 3.1415926535897932385) { + return -geopolySine(tls, (r - 3.1415926535897932385)) + } else { + var r2 float64 = (r * r) + var r3 float64 = (r2 * r) + var r5 float64 = (r3 * r2) + return (((0.9996949 * r) - (0.1656700 * r3)) + (0.0075134 * r5)) + } + return float64(0) +} + +// Function: geopoly_regular(X,Y,R,N) +// +// Construct a simple, convex, regular polygon centered at X, Y +// with circumradius R and with N sides. +func geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197229:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var x float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + var y float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + var r float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + var n int32 = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + // var i int32 at bp, 4 + + var p uintptr + + if (n < 3) || (r <= 0.0) { + return + } + if n > 1000 { + n = 1000 + } + p = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(GeoPoly{})) + ((uint64((n - 1) * 2)) * uint64(unsafe.Sizeof(GeoCoord(0))))))) + if p == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + return + } + *(*int32)(unsafe.Pointer(bp /* i */)) = 1 + *(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */))) = *(*uint8)(unsafe.Pointer(bp /* &i */)) + *(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */) + 1)) = uint8(0) + *(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */) + 2)) = (uint8((n >> 8) & 0xff)) + *(*uint8)(unsafe.Pointer((p + 4 /* &.hdr */) + 3)) = (uint8(n & 0xff)) + for *(*int32)(unsafe.Pointer(bp /* i */)) = 0; *(*int32)(unsafe.Pointer(bp /* i */)) < n; *(*int32)(unsafe.Pointer(bp /* i */))++ { + var rAngle float64 = (((float64(2.0) * 3.1415926535897932385) * float64(*(*int32)(unsafe.Pointer(bp /* i */)))) / float64(n)) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((*(*int32)(unsafe.Pointer(bp /* i */)))*2))*4))) = (GeoCoord(x - (r * geopolySine(tls, (rAngle-(float64(0.5)*3.1415926535897932385)))))) + (*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((*(*int32)(unsafe.Pointer(bp /* i */)))*2)+1))*4))) = (GeoCoord(y + (r * geopolySine(tls, rAngle)))) + } + Xsqlite3_result_blob(tls, context, p+4 /* &.hdr */, (4 + (8 * n)), libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, p) +} + +// If pPoly is a polygon, compute its bounding box. Then: +// +// (1) if aCoord!=0 store the bounding box in aCoord, returning NULL +// (2) otherwise, compute a GeoPoly for the bounding box and return the +// new GeoPoly +// +// If pPoly is NULL but aCoord is not NULL, then compute a new GeoPoly from +// the bounding box in aCoord and return a pointer to that GeoPoly. +func geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, pRc uintptr) uintptr { /* sqlite3.c:197272:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pOut uintptr + var p uintptr + var mnX float32 + var mxX float32 + var mnY float32 + var mxY float32 + var r float64 + // var ii int32 at bp, 4 + pOut = uintptr(0) + if !((pPoly == uintptr(0)) && (aCoord != uintptr(0))) { + goto __1 + } + p = uintptr(0) + mnX = *(*RtreeValue)(unsafe.Pointer(aCoord)) + mxX = *(*RtreeValue)(unsafe.Pointer(aCoord + 1*4)) + mnY = *(*RtreeValue)(unsafe.Pointer(aCoord + 2*4)) + mxY = *(*RtreeValue)(unsafe.Pointer(aCoord + 3*4)) + goto geopolyBboxFill + goto __2 +__1: + p = geopolyFuncParam(tls, context, pPoly, pRc) +__2: + ; + if !(p != 0) { + goto __3 + } + mnX = libc.AssignFloat32(&mxX, *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))) + mnY = libc.AssignFloat32(&mxY, *(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))) + *(*int32)(unsafe.Pointer(bp /* ii */)) = 1 +__5: + if !(*(*int32)(unsafe.Pointer(bp /* ii */)) < (*GeoPoly)(unsafe.Pointer(p)).FnVertex) { + goto __7 + } + r = float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((*(*int32)(unsafe.Pointer(bp /* ii */)))*2))*4))) + if !(r < float64(mnX)) { + goto __8 + } + mnX = float32(r) + goto __9 +__8: + if !(r > float64(mxX)) { + goto __10 + } + mxX = float32(r) +__10: + ; +__9: + ; + r = float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((*(*int32)(unsafe.Pointer(bp /* ii */)))*2)+1))*4))) + if !(r < float64(mnY)) { + goto __11 + } + mnY = float32(r) + goto __12 +__11: + if !(r > float64(mxY)) { + goto __13 + } + mxY = float32(r) +__13: + ; +__12: + ; + goto __6 +__6: + *(*int32)(unsafe.Pointer(bp /* ii */))++ + goto __5 + goto __7 +__7: + ; + if !(pRc != 0) { + goto __14 + } + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_OK +__14: + ; + if !(aCoord == uintptr(0)) { + goto __15 + } +geopolyBboxFill: + pOut = Xsqlite3_realloc64(tls, p, (uint64(unsafe.Sizeof(GeoPoly{})) + ((uint64(unsafe.Sizeof(GeoCoord(0))) * uint64(2)) * (uint64((4) - 4))))) + if !(pOut == uintptr(0)) { + goto __17 + } + Xsqlite3_free(tls, p) + if !(context != 0) { + goto __18 + } + Xsqlite3_result_error_nomem(tls, context) +__18: + ; + if !(pRc != 0) { + goto __19 + } + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM +__19: + ; + return uintptr(0) +__17: + ; + (*GeoPoly)(unsafe.Pointer(pOut)).FnVertex = 4 + *(*int32)(unsafe.Pointer(bp /* ii */)) = 1 + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */))) = *(*uint8)(unsafe.Pointer(bp /* &ii */)) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */) + 1)) = uint8(0) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */) + 2)) = uint8(0) + *(*uint8)(unsafe.Pointer((pOut + 4 /* &.hdr */) + 3)) = uint8(4) + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */)))) = mnX + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 1*4))) = mnY + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 2*4))) = mxX + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 3*4))) = mnY + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 4*4))) = mxX + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 5*4))) = mxY + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 6*4))) = mnX + (*(*GeoCoord)(unsafe.Pointer((pOut + 8 /* &.a */) + 7*4))) = mxY + goto __16 +__15: + Xsqlite3_free(tls, p) + *(*RtreeValue)(unsafe.Pointer(aCoord)) = mnX + *(*RtreeValue)(unsafe.Pointer(aCoord + 1*4)) = mxX + *(*RtreeValue)(unsafe.Pointer(aCoord + 2*4)) = mnY + *(*RtreeValue)(unsafe.Pointer(aCoord + 3*4)) = mxY +__16: + ; + goto __4 +__3: + if !(aCoord != 0) { + goto __20 + } + libc.Xmemset(tls, aCoord, 0, (uint64(unsafe.Sizeof(RtreeCoord{})) * uint64(4))) +__20: + ; +__4: + ; + return pOut +} + +// Implementation of the geopoly_bbox(X) SQL function. +func geopolyBBoxFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197343:13: */ + var p uintptr = geopolyBBox(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0), uintptr(0)) + if p != 0 { + Xsqlite3_result_blob(tls, context, p+4, /* &.hdr */ + (4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, p) + } +} + +// State vector for the geopoly_group_bbox() aggregate function. +type GeoBBox1 = struct { + FisInit int32 + Fa [4]RtreeCoord +} /* sqlite3.c:197359:9 */ + +// State vector for the geopoly_group_bbox() aggregate function. +type GeoBBox = GeoBBox1 /* sqlite3.c:197359:24 */ + +// Implementation of the geopoly_group_bbox(X) aggregate SQL function. +func geopolyBBoxStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197369:13: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + // var a [4]RtreeCoord at bp, 16 + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + geopolyBBox(tls, context, *(*uintptr)(unsafe.Pointer(argv)), bp /* &a[0] */, bp+16 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var pBBox uintptr + pBBox = Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(GeoBBox{}))) + if pBBox == uintptr(0) { + return + } + if (*GeoBBox)(unsafe.Pointer(pBBox)).FisInit == 0 { + (*GeoBBox)(unsafe.Pointer(pBBox)).FisInit = 1 + libc.Xmemcpy(tls, pBBox+4 /* &.a */, bp /* &a[0] */, (uint64(unsafe.Sizeof(RtreeCoord{})) * uint64(4))) + } else { + if *(*RtreeValue)(unsafe.Pointer(bp /* &a */)) < *(*RtreeValue)(unsafe.Pointer((pBBox + 4 /* &.a */))) { + *(*RtreeCoord)(unsafe.Pointer((pBBox + 4 /* &.a */))) = *(*RtreeCoord)(unsafe.Pointer(bp /* &a[0] */)) + } + if *(*RtreeValue)(unsafe.Pointer(bp /* &a */ + 1*4)) > *(*RtreeValue)(unsafe.Pointer((pBBox + 4 /* &.a */) + 1*4)) { + *(*RtreeCoord)(unsafe.Pointer((pBBox + 4 /* &.a */) + 1*4)) = *(*RtreeCoord)(unsafe.Pointer(bp /* &a[0] */ + 1*4)) + } + if *(*RtreeValue)(unsafe.Pointer(bp /* &a */ + 2*4)) < *(*RtreeValue)(unsafe.Pointer((pBBox + 4 /* &.a */) + 2*4)) { + *(*RtreeCoord)(unsafe.Pointer((pBBox + 4 /* &.a */) + 2*4)) = *(*RtreeCoord)(unsafe.Pointer(bp /* &a[0] */ + 2*4)) + } + if *(*RtreeValue)(unsafe.Pointer(bp /* &a */ + 3*4)) > *(*RtreeValue)(unsafe.Pointer((pBBox + 4 /* &.a */) + 3*4)) { + *(*RtreeCoord)(unsafe.Pointer((pBBox + 4 /* &.a */) + 3*4)) = *(*RtreeCoord)(unsafe.Pointer(bp /* &a[0] */ + 3*4)) + } + } + } +} + +func geopolyBBoxFinal(tls *libc.TLS, context uintptr) { /* sqlite3.c:197392:13: */ + var p uintptr + var pBBox uintptr + pBBox = Xsqlite3_aggregate_context(tls, context, 0) + if pBBox == uintptr(0) { + return + } + p = geopolyBBox(tls, context, uintptr(0), pBBox+4 /* &.a */, uintptr(0)) + if p != 0 { + Xsqlite3_result_blob(tls, context, p+4, /* &.hdr */ + (4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1)) + Xsqlite3_free(tls, p) + } +} + +// Determine if point (x0,y0) is beneath line segment (x1,y1)->(x2,y2). +// Returns: +// +// +2 x0,y0 is on the line segement +// +// +1 x0,y0 is beneath line segment +// +// 0 x0,y0 is not on or beneath the line segment or the line segment +// is vertical and x0,y0 is not on the line segment +// +// The left-most coordinate min(x1,x2) is not considered to be part of +// the line segment for the purposes of this analysis. +func pointBeneathLine(tls *libc.TLS, x0 float64, y0 float64, x1 float64, y1 float64, x2 float64, y2 float64) int32 { /* sqlite3.c:197422:12: */ + var y float64 + if (x0 == x1) && (y0 == y1) { + return 2 + } + if x1 < x2 { + if (x0 <= x1) || (x0 > x2) { + return 0 + } + } else if x1 > x2 { + if (x0 <= x2) || (x0 > x1) { + return 0 + } + } else { + // Vertical line segment + if x0 != x1 { + return 0 + } + if (y0 < y1) && (y0 < y2) { + return 0 + } + if (y0 > y1) && (y0 > y2) { + return 0 + } + return 2 + } + y = (y1 + (((y2 - y1) * (x0 - x1)) / (x2 - x1))) + if y0 == y { + return 2 + } + if y0 < y { + return 1 + } + return 0 +} + +// SQL function: geopoly_contains_point(P,X,Y) +// +// Return +2 if point X,Y is within polygon P. +// Return +1 if point X,Y is on the polygon boundary. +// Return 0 if point X,Y is outside the polygon +func geopolyContainsPointFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197453:13: */ + var p1 uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + var x0 float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + var y0 float64 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) + var v int32 = 0 + var cnt int32 = 0 + var ii int32 + if p1 == uintptr(0) { + return + } + for ii = 0; ii < ((*GeoPoly)(unsafe.Pointer(p1)).FnVertex - 1); ii++ { + v = pointBeneathLine(tls, x0, y0, float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr(((ii)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))), + float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr(((ii+1)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr((((ii+1)*2)+1))*4)))) + if v == 2 { + break + } + cnt = cnt + (v) + } + if v != 2 { + v = pointBeneathLine(tls, x0, y0, float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr(((ii)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + uintptr((((ii)*2)+1))*4))), + float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p1 + 8 /* &.a */) + 1*4)))) + } + if v == 2 { + Xsqlite3_result_int(tls, context, 1) + } else if ((v + cnt) & 1) == 0 { + Xsqlite3_result_int(tls, context, 0) + } else { + Xsqlite3_result_int(tls, context, 2) + } + Xsqlite3_free(tls, p1) +} + +// SQL function: geopoly_within(P1,P2) +// +// Return +2 if P1 and P2 are the same polygon +// Return +1 if P2 is contained within P1 +// Return 0 if any part of P2 is on the outside of P1 +// +func geopolyWithinFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197496:13: */ + var p1 uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + var p2 uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uintptr(0)) + if (p1 != 0) && (p2 != 0) { + var x int32 = geopolyOverlap(tls, p1, p2) + if x < 0 { + Xsqlite3_result_error_nomem(tls, context) + } else { + Xsqlite3_result_int(tls, context, func() int32 { + if x == 2 { + return 1 + } + return func() int32 { + if x == 4 { + return 2 + } + return 0 + }() + }()) + } + } + Xsqlite3_free(tls, p1) + Xsqlite3_free(tls, p2) +} + +// Objects used by the overlap algorihm. +type GeoEvent1 = struct { + Fx float64 + FeType int32 + _ [4]byte + FpSeg uintptr + FpNext uintptr +} /* sqlite3.c:197516:9 */ + +// Objects used by the overlap algorihm. +type GeoEvent = GeoEvent1 /* sqlite3.c:197516:25 */ +type GeoSegment1 = struct { + FC float64 + FB float64 + Fy float64 + Fy0 float32 + Fside uint8 + _ [3]byte + Fidx uint32 + _ [4]byte + FpNext uintptr +} /* sqlite3.c:197516:9 */ + +type GeoSegment = GeoSegment1 /* sqlite3.c:197517:27 */ +type GeoOverlap1 = struct { + FaEvent uintptr + FaSegment uintptr + FnEvent int32 + FnSegment int32 +} /* sqlite3.c:197518:9 */ + +type GeoOverlap = GeoOverlap1 /* sqlite3.c:197518:27 */ + +// Add a single segment and its associated events. +func geopolyAddOneSegment(tls *libc.TLS, p uintptr, x0 GeoCoord, y0 GeoCoord, x1 GeoCoord, y1 GeoCoord, side uint8, idx uint32) { /* sqlite3.c:197543:13: */ + var pSeg uintptr + var pEvent uintptr + if x0 == x1 { + return + } // Ignore vertical segments + if x0 > x1 { + var t GeoCoord = x0 + x0 = x1 + x1 = t + t = y0 + y0 = y1 + y1 = t + } + pSeg = ((*GeoOverlap)(unsafe.Pointer(p)).FaSegment + uintptr((*GeoOverlap)(unsafe.Pointer(p)).FnSegment)*48) + (*GeoOverlap)(unsafe.Pointer(p)).FnSegment++ + (*GeoSegment)(unsafe.Pointer(pSeg)).FC = (float64((y1 - y0) / (x1 - x0))) + (*GeoSegment)(unsafe.Pointer(pSeg)).FB = (float64(y1) - (float64(x1) * (*GeoSegment)(unsafe.Pointer(pSeg)).FC)) + (*GeoSegment)(unsafe.Pointer(pSeg)).Fy0 = y0 + (*GeoSegment)(unsafe.Pointer(pSeg)).Fside = side + (*GeoSegment)(unsafe.Pointer(pSeg)).Fidx = idx + pEvent = ((*GeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((*GeoOverlap)(unsafe.Pointer(p)).FnEvent)*32) + (*GeoOverlap)(unsafe.Pointer(p)).FnEvent++ + (*GeoEvent)(unsafe.Pointer(pEvent)).Fx = float64(x0) + (*GeoEvent)(unsafe.Pointer(pEvent)).FeType = 0 + (*GeoEvent)(unsafe.Pointer(pEvent)).FpSeg = pSeg + pEvent = ((*GeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((*GeoOverlap)(unsafe.Pointer(p)).FnEvent)*32) + (*GeoOverlap)(unsafe.Pointer(p)).FnEvent++ + (*GeoEvent)(unsafe.Pointer(pEvent)).Fx = float64(x1) + (*GeoEvent)(unsafe.Pointer(pEvent)).FeType = 1 + (*GeoEvent)(unsafe.Pointer(pEvent)).FpSeg = pSeg +} + +// Insert all segments and events for polygon pPoly. +func geopolyAddSegments(tls *libc.TLS, p uintptr, pPoly uintptr, side uint8) { /* sqlite3.c:197587:13: */ + var i uint32 + var x uintptr + for i = uint32(0); i < (uint32((*GeoPoly)(unsafe.Pointer(pPoly)).FnVertex) - uint32(1)); i++ { + x = ((pPoly + 8 /* &.a */) + uintptr(((i)*uint32(2)))*4) + geopolyAddOneSegment(tls, p, *(*GeoCoord)(unsafe.Pointer(x)), *(*GeoCoord)(unsafe.Pointer(x + 1*4)), *(*GeoCoord)(unsafe.Pointer(x + 2*4)), *(*GeoCoord)(unsafe.Pointer(x + 3*4)), side, i) + } + x = ((pPoly + 8 /* &.a */) + uintptr(((i)*uint32(2)))*4) + geopolyAddOneSegment(tls, p, *(*GeoCoord)(unsafe.Pointer(x)), *(*GeoCoord)(unsafe.Pointer(x + 1*4)), *(*GeoCoord)(unsafe.Pointer((pPoly + 8 /* &.a */))), *(*GeoCoord)(unsafe.Pointer((pPoly + 8 /* &.a */) + 1*4)), side, i) +} + +// Merge two lists of sorted events by X coordinate +func geopolyEventMerge(tls *libc.TLS, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:197605:17: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var head GeoEvent at bp, 32 + + var pLast uintptr + (*GeoEvent)(unsafe.Pointer(bp /* &head */)).FpNext = uintptr(0) + pLast = bp /* &head */ + for (pRight != 0) && (pLeft != 0) { + if (*GeoEvent)(unsafe.Pointer(pRight)).Fx <= (*GeoEvent)(unsafe.Pointer(pLeft)).Fx { + (*GeoEvent)(unsafe.Pointer(pLast)).FpNext = pRight + pLast = pRight + pRight = (*GeoEvent)(unsafe.Pointer(pRight)).FpNext + } else { + (*GeoEvent)(unsafe.Pointer(pLast)).FpNext = pLeft + pLast = pLeft + pLeft = (*GeoEvent)(unsafe.Pointer(pLeft)).FpNext + } + } + (*GeoEvent)(unsafe.Pointer(pLast)).FpNext = func() uintptr { + if pRight != 0 { + return pRight + } + return pLeft + }() + return (*GeoEvent)(unsafe.Pointer(bp /* &head */)).FpNext +} + +// Sort an array of nEvent event objects into a list. +func geopolySortEventsByX(tls *libc.TLS, aEvent uintptr, nEvent int32) uintptr { /* sqlite3.c:197627:17: */ + bp := tls.Alloc(400) + defer tls.Free(400) + + var mx int32 = 0 + var i int32 + var j int32 + var p uintptr + // var a [50]uintptr at bp, 400 + + for i = 0; i < nEvent; i++ { + p = (aEvent + uintptr(i)*32) + (*GeoEvent)(unsafe.Pointer(p)).FpNext = uintptr(0) + for j = 0; (j < mx) && (*(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(j)*8)) != 0); j++ { + p = geopolyEventMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(j)*8)), p) + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(j)*8)) = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(j)*8)) = p + if j >= mx { + mx = (j + 1) + } + } + p = uintptr(0) + for i = 0; i < mx; i++ { + p = geopolyEventMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)), p) + } + return p +} + +// Merge two lists of sorted segments by Y, and then by C. +func geopolySegmentMerge(tls *libc.TLS, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:197652:19: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var head GeoSegment at bp, 48 + + var pLast uintptr + (*GeoSegment)(unsafe.Pointer(bp /* &head */)).FpNext = uintptr(0) + pLast = bp /* &head */ + for (pRight != 0) && (pLeft != 0) { + var r float64 = ((*GeoSegment)(unsafe.Pointer(pRight)).Fy - (*GeoSegment)(unsafe.Pointer(pLeft)).Fy) + if r == 0.0 { + r = ((*GeoSegment)(unsafe.Pointer(pRight)).FC - (*GeoSegment)(unsafe.Pointer(pLeft)).FC) + } + if r < 0.0 { + (*GeoSegment)(unsafe.Pointer(pLast)).FpNext = pRight + pLast = pRight + pRight = (*GeoSegment)(unsafe.Pointer(pRight)).FpNext + } else { + (*GeoSegment)(unsafe.Pointer(pLast)).FpNext = pLeft + pLast = pLeft + pLeft = (*GeoSegment)(unsafe.Pointer(pLeft)).FpNext + } + } + (*GeoSegment)(unsafe.Pointer(pLast)).FpNext = func() uintptr { + if pRight != 0 { + return pRight + } + return pLeft + }() + return (*GeoSegment)(unsafe.Pointer(bp /* &head */)).FpNext +} + +// Sort a list of GeoSegments in order of increasing Y and in the event of +// a tie, increasing C (slope). +func geopolySortSegmentsByYAndC(tls *libc.TLS, pList uintptr) uintptr { /* sqlite3.c:197677:19: */ + bp := tls.Alloc(400) + defer tls.Free(400) + + var mx int32 = 0 + var i int32 + var p uintptr + // var a [50]uintptr at bp, 400 + + for pList != 0 { + p = pList + pList = (*GeoSegment)(unsafe.Pointer(pList)).FpNext + (*GeoSegment)(unsafe.Pointer(p)).FpNext = uintptr(0) + for i = 0; (i < mx) && (*(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) != 0); i++ { + p = geopolySegmentMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)), p) + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)) = p + if i >= mx { + mx = (i + 1) + } + } + p = uintptr(0) + for i = 0; i < mx; i++ { + p = geopolySegmentMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &a[0] */ + uintptr(i)*8)), p) + } + return p +} + +// Determine the overlap between two polygons +func geopolyOverlap(tls *libc.TLS, p1 uintptr, p2 uintptr) int32 { /* sqlite3.c:197703:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var nVertex Sqlite3_int64 + var p uintptr + var nByte Sqlite3_int64 + var pThisEvent uintptr + var rX float64 + var rc int32 + var needSort int32 + var pActive uintptr + var pSeg uintptr + // var aOverlap [4]uint8 at bp, 4 + + var y float64 + var pPrev uintptr + var iMask int32 + nVertex = (Sqlite3_int64(((*GeoPoly)(unsafe.Pointer(p1)).FnVertex + (*GeoPoly)(unsafe.Pointer(p2)).FnVertex) + 2)) + rc = 0 + needSort = 0 + pActive = uintptr(0) + + nByte = (Sqlite3_int64((((uint64(unsafe.Sizeof(GeoEvent{})) * uint64(nVertex)) * uint64(2)) + + (uint64(unsafe.Sizeof(GeoSegment{})) * uint64(nVertex))) + + uint64(unsafe.Sizeof(GeoOverlap{})))) + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(p == uintptr(0)) { + goto __1 + } + return -1 +__1: + ; + (*GeoOverlap)(unsafe.Pointer(p)).FaEvent = (p + 1*24) + (*GeoOverlap)(unsafe.Pointer(p)).FaSegment = ((*GeoOverlap)(unsafe.Pointer(p)).FaEvent + uintptr((nVertex*int64(2)))*32) + (*GeoOverlap)(unsafe.Pointer(p)).FnEvent = libc.AssignPtrInt32(p+20 /* &.nSegment */, 0) + geopolyAddSegments(tls, p, p1, uint8(1)) + geopolyAddSegments(tls, p, p2, uint8(2)) + pThisEvent = geopolySortEventsByX(tls, (*GeoOverlap)(unsafe.Pointer(p)).FaEvent, (*GeoOverlap)(unsafe.Pointer(p)).FnEvent) + if (pThisEvent != 0) && ((*GeoEvent)(unsafe.Pointer(pThisEvent)).Fx == 0.0) { + rX = -1.0 + } else { + rX = 0.0 + } + libc.Xmemset(tls, bp /* &aOverlap[0] */, 0, uint64(unsafe.Sizeof([4]uint8{}))) +__2: + if !(pThisEvent != 0) { + goto __3 + } + if !((*GeoEvent)(unsafe.Pointer(pThisEvent)).Fx != rX) { + goto __4 + } + pPrev = uintptr(0) + iMask = 0 + + rX = (*GeoEvent)(unsafe.Pointer(pThisEvent)).Fx + if !(needSort != 0) { + goto __5 + } + + pActive = geopolySortSegmentsByYAndC(tls, pActive) + needSort = 0 +__5: + ; + pSeg = pActive +__6: + if !(pSeg != 0) { + goto __8 + } + if !(pPrev != 0) { + goto __9 + } + if !((*GeoSegment)(unsafe.Pointer(pPrev)).Fy != (*GeoSegment)(unsafe.Pointer(pSeg)).Fy) { + goto __10 + } + + *(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + uintptr(iMask))) = uint8(1) +__10: + ; +__9: + ; + iMask = iMask ^ (int32((*GeoSegment)(unsafe.Pointer(pSeg)).Fside)) + pPrev = pSeg + goto __7 +__7: + pSeg = (*GeoSegment)(unsafe.Pointer(pSeg)).FpNext + goto __6 + goto __8 +__8: + ; + pPrev = uintptr(0) + pSeg = pActive +__11: + if !(pSeg != 0) { + goto __13 + } + y = (((*GeoSegment)(unsafe.Pointer(pSeg)).FC * rX) + (*GeoSegment)(unsafe.Pointer(pSeg)).FB) + + (*GeoSegment)(unsafe.Pointer(pSeg)).Fy = y + if !(pPrev != 0) { + goto __14 + } + if !(((*GeoSegment)(unsafe.Pointer(pPrev)).Fy > (*GeoSegment)(unsafe.Pointer(pSeg)).Fy) && (int32((*GeoSegment)(unsafe.Pointer(pPrev)).Fside) != int32((*GeoSegment)(unsafe.Pointer(pSeg)).Fside))) { + goto __15 + } + rc = 1 + + goto geopolyOverlapDone + goto __16 +__15: + if !((*GeoSegment)(unsafe.Pointer(pPrev)).Fy != (*GeoSegment)(unsafe.Pointer(pSeg)).Fy) { + goto __17 + } + + *(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + uintptr(iMask))) = uint8(1) +__17: + ; +__16: + ; +__14: + ; + iMask = iMask ^ (int32((*GeoSegment)(unsafe.Pointer(pSeg)).Fside)) + pPrev = pSeg + goto __12 +__12: + pSeg = (*GeoSegment)(unsafe.Pointer(pSeg)).FpNext + goto __11 + goto __13 +__13: + ; +__4: + ; + + if !((*GeoEvent)(unsafe.Pointer(pThisEvent)).FeType == 0) { + goto __18 + } + // Add a segment + pSeg = (*GeoEvent)(unsafe.Pointer(pThisEvent)).FpSeg + (*GeoSegment)(unsafe.Pointer(pSeg)).Fy = float64((*GeoSegment)(unsafe.Pointer(pSeg)).Fy0) + (*GeoSegment)(unsafe.Pointer(pSeg)).FpNext = pActive + pActive = pSeg + needSort = 1 + goto __19 +__18: + // Remove a segment + if !(pActive == (*GeoEvent)(unsafe.Pointer(pThisEvent)).FpSeg) { + goto __20 + } + pActive = (*GeoSegment)(unsafe.Pointer(pActive)).FpNext + goto __21 +__20: + pSeg = pActive +__22: + if !(pSeg != 0) { + goto __24 + } + if !((*GeoSegment)(unsafe.Pointer(pSeg)).FpNext == (*GeoEvent)(unsafe.Pointer(pThisEvent)).FpSeg) { + goto __25 + } + (*GeoSegment)(unsafe.Pointer(pSeg)).FpNext = (*GeoSegment)(unsafe.Pointer((*GeoSegment)(unsafe.Pointer(pSeg)).FpNext)).FpNext + goto __24 +__25: + ; + goto __23 +__23: + pSeg = (*GeoSegment)(unsafe.Pointer(pSeg)).FpNext + goto __22 + goto __24 +__24: + ; +__21: + ; +__19: + ; + pThisEvent = (*GeoEvent)(unsafe.Pointer(pThisEvent)).FpNext + goto __2 +__3: + ; + if !(int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 3))) == 0) { + goto __26 + } + rc = 0 + goto __27 +__26: + if !((int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 1))) != 0) && (int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 2))) == 0)) { + goto __28 + } + rc = 3 + goto __29 +__28: + if !((int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 1))) == 0) && (int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 2))) != 0)) { + goto __30 + } + rc = 2 + goto __31 +__30: + if !((int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 1))) == 0) && (int32(*(*uint8)(unsafe.Pointer(bp /* &aOverlap[0] */ + 2))) == 0)) { + goto __32 + } + rc = 4 + goto __33 +__32: + rc = 1 +__33: + ; +__31: + ; +__29: + ; +__27: + ; + +geopolyOverlapDone: + Xsqlite3_free(tls, p) + return rc +} + +// SQL function: geopoly_overlap(P1,P2) +// +// Determine whether or not P1 and P2 overlap. Return value: +// +// 0 The two polygons are disjoint +// 1 They overlap +// 2 P1 is completely contained within P2 +// 3 P2 is completely contained within P1 +// 4 P1 and P2 are the same polygon +// NULL Either P1 or P2 or both are not valid polygons +func geopolyOverlapFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197826:13: */ + var p1 uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) + var p2 uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uintptr(0)) + if (p1 != 0) && (p2 != 0) { + var x int32 = geopolyOverlap(tls, p1, p2) + if x < 0 { + Xsqlite3_result_error_nomem(tls, context) + } else { + Xsqlite3_result_int(tls, context, x) + } + } + Xsqlite3_free(tls, p1) + Xsqlite3_free(tls, p2) +} + +// Enable or disable debugging output +func geopolyDebugFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197848:13: */ +} + +// This function is the implementation of both the xConnect and xCreate +// methods of the geopoly virtual table. +// +// argv[0] -> module name +// argv[1] -> database name +// argv[2] -> table name +// argv[...] -> column names... +func geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr, isCreate int32) int32 { /* sqlite3.c:197867:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var rc int32 + var pRtree uintptr + var nDb Sqlite3_int64 // Length of string argv[1] + var nName Sqlite3_int64 // Length of string argv[2] + var pSql uintptr + var zSql uintptr + var ii int32 + rc = SQLITE_OK + + Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_CONSTRAINT_SUPPORT, libc.VaList(bp, 1)) + + // Allocate the sqlite3_vtab structure + nDb = Sqlite3_int64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) + nName = Sqlite3_int64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) + pRtree = Xsqlite3_malloc64(tls, (((uint64(unsafe.Sizeof(Rtree{})) + uint64(nDb)) + uint64(nName)) + uint64(2))) + if !(!(pRtree != 0)) { + goto __1 + } + return SQLITE_NOMEM +__1: + ; + libc.Xmemset(tls, pRtree, 0, (uint64(((uint64(unsafe.Sizeof(Rtree{})) + uint64(nDb)) + uint64(nName)) + uint64(2)))) + (*Rtree)(unsafe.Pointer(pRtree)).FnBusy = U32(1) + (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FpModule = uintptr(unsafe.Pointer(&rtreeModule)) + (*Rtree)(unsafe.Pointer(pRtree)).FzDb = (pRtree + 1*968) + (*Rtree)(unsafe.Pointer(pRtree)).FzName = ((*Rtree)(unsafe.Pointer(pRtree)).FzDb + uintptr((nDb + int64(1)))) + (*Rtree)(unsafe.Pointer(pRtree)).FeCoordType = U8(RTREE_COORD_REAL32) + (*Rtree)(unsafe.Pointer(pRtree)).FnDim = U8(2) + (*Rtree)(unsafe.Pointer(pRtree)).FnDim2 = U8(4) + libc.Xmemcpy(tls, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(nDb)) + libc.Xmemcpy(tls, (*Rtree)(unsafe.Pointer(pRtree)).FzName, *(*uintptr)(unsafe.Pointer(argv + 2*8)), uint64(nName)) + + // Create/Connect to the underlying relational database schema. If + // that is successful, call sqlite3_declare_vtab() to configure + // the r-tree table schema. + pSql = Xsqlite3_str_new(tls, db) + Xsqlite3_str_appendf(tls, pSql, ts+25802 /* "CREATE TABLE x(_..." */, 0) + (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape + (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null + ii = 3 +__2: + if !(ii < argc) { + goto __4 + } + (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ + Xsqlite3_str_appendf(tls, pSql, ts+25824 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + goto __3 +__3: + ii++ + goto __2 + goto __4 +__4: + ; + Xsqlite3_str_appendf(tls, pSql, ts+24891 /* ");" */, 0) + zSql = Xsqlite3_str_finish(tls, pSql) + if !(!(zSql != 0)) { + goto __5 + } + rc = SQLITE_NOMEM + goto __6 +__5: + if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { + goto __7 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) +__7: + ; +__6: + ; + Xsqlite3_free(tls, zSql) + if !(rc != 0) { + goto __8 + } + goto geopolyInit_fail +__8: + ; + (*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell = (U8(8 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnDim2) * 4))) + + // Figure out the node size to use. + rc = getNodeSize(tls, db, pRtree, isCreate, pzErr) + if !(rc != 0) { + goto __9 + } + goto geopolyInit_fail +__9: + ; + rc = rtreeSqlInit(tls, pRtree, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), isCreate) + if !(rc != 0) { + goto __10 + } + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + goto geopolyInit_fail +__10: + ; + + *(*uintptr)(unsafe.Pointer(ppVtab)) = pRtree + return SQLITE_OK + +geopolyInit_fail: + if !(rc == SQLITE_OK) { + goto __11 + } + rc = SQLITE_ERROR +__11: + ; + + rtreeRelease(tls, pRtree) + return rc +} + +// GEOPOLY virtual table module xCreate method. +func geopolyCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:197951:12: */ + return geopolyInit(tls, db, pAux, argc, argv, ppVtab, pzErr, 1) +} + +// GEOPOLY virtual table module xConnect method. +func geopolyConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:197964:12: */ + return geopolyInit(tls, db, pAux, argc, argv, ppVtab, pzErr, 0) +} + +// GEOPOLY virtual table module xFilter method. +// +// Query plans: +// +// 1 rowid lookup +// 2 search for objects overlapping the same bounding box +// that contains polygon argv[0] +// 3 search for objects overlapping the same bounding box +// that contains polygon argv[0] +// 4 full table scan +func geopolyFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3.c:197987:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var pRtree uintptr + var pCsr uintptr + // var pRoot uintptr at bp+24, 8 + + // var rc int32 at bp+48, 4 + + // var iCell int32 at bp+16, 4 + + // Special case - lookup by rowid. + // var pLeaf uintptr at bp, 8 + // Leaf on which the required cell resides + var p uintptr // Search point for the leaf + var iRowid I64 + // var iNode I64 at bp+8, 8 + + // var bbox [4]RtreeCoord at bp+32, 16 + + var p1 uintptr + var pNew uintptr + pRtree = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab + pCsr = pVtabCursor + *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 16 /* iCell */)) = 0 + + rtreeReference(tls, pRtree) + + // Reset the cursor to the same state as rtreeOpen() leaves it in. + resetCursor(tls, pCsr) + + (*RtreeCursor)(unsafe.Pointer(pCsr)).FiStrategy = idxNum + if !(idxNum == 1) { + goto __1 + } // Search point for the leaf + iRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*I64)(unsafe.Pointer(bp + 8 /* iNode */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = findLeafNode(tls, pRtree, iRowid, bp /* &pLeaf */, bp+8 /* &iNode */) + if !((*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp /* pLeaf */)) != uintptr(0))) { + goto __3 + } + p = rtreeSearchPointNew(tls, pCsr, 0.0, uint8(0)) + // Always returns pCsr->sPoint + *(*uintptr)(unsafe.Pointer((pCsr + 88 /* &.aNode */))) = *(*uintptr)(unsafe.Pointer(bp /* pLeaf */)) + (*RtreeSearchPoint)(unsafe.Pointer(p)).Fid = *(*I64)(unsafe.Pointer(bp + 8 /* iNode */)) + (*RtreeSearchPoint)(unsafe.Pointer(p)).FeWithin = U8(PARTLY_WITHIN) + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = nodeRowidIndex(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp /* pLeaf */)), iRowid, bp+16 /* &iCell */) + (*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell = U8(*(*int32)(unsafe.Pointer(bp + 16 /* iCell */))) + + goto __4 +__3: + (*RtreeCursor)(unsafe.Pointer(pCsr)).FatEOF = U8(1) +__4: + ; + goto __2 +__1: + // Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array + // with the configured constraints. + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp+24 /* &pRoot */) + if !((*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && (idxNum <= 3)) { + goto __5 + } + + geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(argv)), bp+32 /* &bbox[0] */, bp+48 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) != 0) { + goto __6 + } + goto geopoly_filter_end +__6: + ; + (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = libc.AssignUintptr(&p1, Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(RtreeConstraint{}))*uint64(4))))) + (*RtreeCursor)(unsafe.Pointer(pCsr)).FnConstraint = 4 + if !(p1 == uintptr(0)) { + goto __7 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_NOMEM + goto __8 +__7: + libc.Xmemset(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint, 0, (uint64(unsafe.Sizeof(RtreeConstraint{})) * uint64(4))) + libc.Xmemset(tls, pCsr+128 /* &.anQueue */, 0, (uint64(unsafe.Sizeof(U32(0))) * (uint64((*Rtree)(unsafe.Pointer(pRtree)).FiDepth + 1)))) + if !(idxNum == 2) { + goto __9 + } + // Overlap query + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'B' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 0 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */ + 1*4))) + p1 += 24 + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'D' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 1 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */))) + p1 += 24 + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'B' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 2 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */ + 3*4))) + p1 += 24 + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'D' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 3 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */ + 2*4))) + goto __10 +__9: + // Within query + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'D' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 0 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */))) + p1 += 24 + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'B' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 1 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */ + 1*4))) + p1 += 24 + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'D' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 2 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */ + 2*4))) + p1 += 24 + (*RtreeConstraint)(unsafe.Pointer(p1)).Fop = 'B' + (*RtreeConstraint)(unsafe.Pointer(p1)).FiCoord = 3 + *(*RtreeDValue)(unsafe.Pointer(p1 + 8 /* &.u */)) = RtreeDValue(*(*RtreeValue)(unsafe.Pointer(bp + 32 /* &bbox */ + 3*4))) +__10: + ; +__8: + ; +__5: + ; + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) { + goto __11 + } + pNew = rtreeSearchPointNew(tls, pCsr, 0.0, (U8((*Rtree)(unsafe.Pointer(pRtree)).FiDepth + 1))) + if !(pNew == uintptr(0)) { + goto __12 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_NOMEM + goto geopoly_filter_end +__12: + ; + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).Fid = int64(1) + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).FiCell = U8(0) + (*RtreeSearchPoint)(unsafe.Pointer(pNew)).FeWithin = U8(PARTLY_WITHIN) + + *(*uintptr)(unsafe.Pointer((pCsr + 88 /* &.aNode */))) = *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */)) = uintptr(0) + + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rtreeStepToLeaf(tls, pCsr) +__11: + ; +__2: + ; + +geopoly_filter_end: + nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 24 /* pRoot */))) + rtreeRelease(tls, pRtree) + return *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) +} + +// Rtree virtual table module xBestIndex method. There are three +// table scan strategies to choose from (in order from most to +// least desirable): +// +// idxNum idxStr Strategy +// ------------------------------------------------ +// 1 "rowid" Direct lookup by rowid. +// 2 "rtree" R-tree overlap query using geopoly_overlap() +// 3 "rtree" R-tree within query using geopoly_within() +// 4 "fullscan" full-table scan. +// ------------------------------------------------ +func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sqlite3.c:198118:12: */ + var ii int32 + var iRowidTerm int32 = -1 + var iFuncTerm int32 = -1 + var idxNum int32 = 0 + + for ii = 0; ii < (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ { + var p uintptr = ((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12) + if !(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) != 0) { + continue + } + if ((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn < 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) { + iRowidTerm = ii + break + } + if ((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) >= SQLITE_INDEX_CONSTRAINT_FUNCTION) { + // p->op==SQLITE_INDEX_CONSTRAINT_FUNCTION for geopoly_overlap() + // p->op==(SQLITE_INDEX_CONTRAINT_FUNCTION+1) for geopoly_within(). + // See geopolyFindFunction() + iFuncTerm = ii + idxNum = ((int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) - SQLITE_INDEX_CONSTRAINT_FUNCTION) + 2) + } + } + + if iRowidTerm >= 0 { + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14758 /* "rowid" */ + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = SQLITE_INDEX_SCAN_UNIQUE + return SQLITE_OK + } + if iFuncTerm >= 0 { + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25828 /* "rtree" */ + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(10) + return SQLITE_OK + } + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25834 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) + return SQLITE_OK +} + +// GEOPOLY virtual table module xColumn method. +func geopolyColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* sqlite3.c:198170:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pRtree uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab + var pCsr uintptr = cur + var p uintptr = rtreeSearchPointFirst(tls, pCsr) + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var pNode uintptr = rtreeNodeOfFirstSearchPoint(tls, pCsr, bp /* &rc */) + + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + if p == uintptr(0) { + return SQLITE_OK + } + if (i == 0) && (Xsqlite3_vtab_nochange(tls, ctx) != 0) { + return SQLITE_OK + } + if i <= int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) { + if !(int32((*RtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid) != 0) { + if (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux == uintptr(0) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3_prepare_v3(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql, -1, uint32(0), + (pCsr + 56 /* &.pReadAux */), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } + Xsqlite3_bind_int64(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, 1, + nodeGetRowid(tls, pRtree, pNode, int32((*RtreeSearchPoint)(unsafe.Pointer(p)).FiCell))) + *(*int32)(unsafe.Pointer(bp /* rc */)) = Xsqlite3_step(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_ROW { + (*RtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = U8(1) + } else { + Xsqlite3_reset(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_DONE { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + } + Xsqlite3_result_value(tls, ctx, Xsqlite3_column_value(tls, (*RtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux, (i+2))) + } + return SQLITE_OK +} + +// The xUpdate method for GEOPOLY module virtual tables. +// +// For DELETE: +// +// argv[0] = the rowid to be deleted +// +// For INSERT: +// +// argv[0] = SQL NULL +// argv[1] = rowid to insert, or an SQL NULL to select automatically +// argv[2] = _shape column +// argv[3] = first application-defined column.... +// +// For UPDATE: +// +// argv[0] = rowid to modify. Never NULL +// argv[1] = rowid after the change. Never NULL +// argv[2] = new value for _shape +// argv[3] = new value for first application-defined column.... +func geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) int32 { /* sqlite3.c:198225:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var pRtree uintptr + // var rc int32 at bp+48, 4 + + // var cell RtreeCell at bp, 48 + // New cell to insert if nData>1 + var oldRowid I64 // The old rowid + var oldRowidValid int32 // True if oldRowid is valid + var newRowid I64 // The new rowid + var newRowidValid int32 // True if newRowid is valid + var coordChange int32 + var steprc int32 + var rc2 int32 + // Insert the new record into the r-tree + // var pLeaf uintptr at bp+56, 8 + + var p uintptr + var pUp uintptr + var jj int32 + var nChange int32 + pRtree = pVtab + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK + coordChange = 0 // Change in coordinates + + if !((*Rtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0) { + goto __1 + } + // Unable to write to the btree while another cursor is reading from it, + // since the write might do a rebalance which would disrupt the read + // cursor. + return (SQLITE_LOCKED | (int32(2) << 8)) +__1: + ; + rtreeReference(tls, pRtree) + + oldRowidValid = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != SQLITE_NULL)) + + if oldRowidValid != 0 { + oldRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) + } else { + oldRowid = int64(0) + } + newRowidValid = (libc.Bool32((nData > 1) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 1*8))) != SQLITE_NULL))) + if newRowidValid != 0 { + newRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 1*8))) + } else { + newRowid = int64(0) + } + (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid = newRowid + + if !((nData > 1) && // not a DELETE + ((!(oldRowidValid != 0) || // INSERT + !(Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0)) || // UPDATE _shape + (oldRowid != newRowid))) { + goto __2 + } + geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp /* &cell */ +8 /* &.aCoord */, bp+48 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) != 0) { + goto __3 + } + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { + goto __4 + } + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25843 /* "_shape does not ..." */, 0) +__4: + ; + goto geopoly_update_end +__3: + ; + coordChange = 1 + + // If a rowid value was supplied, check if it is already present in + // the table. If so, the constraint has failed. + if !((newRowidValid != 0) && (!(oldRowidValid != 0) || (oldRowid != newRowid))) { + goto __5 + } + Xsqlite3_bind_int64(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid, 1, (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid) + steprc = Xsqlite3_step(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_reset(tls, (*Rtree)(unsafe.Pointer(pRtree)).FpReadRowid) + if !(SQLITE_ROW == steprc) { + goto __6 + } + if !(Xsqlite3_vtab_on_conflict(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb) == SQLITE_REPLACE) { + goto __7 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rtreeDeleteRowid(tls, pRtree, (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid) + goto __8 +__7: + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rtreeConstraintError(tls, pRtree, 0) +__8: + ; +__6: + ; +__5: + ; +__2: + ; + + // If aData[0] is not an SQL NULL value, it is the rowid of a + // record to delete from the r-tree table. The following block does + // just that. + if !((*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && ((nData == 1) || ((coordChange != 0) && (oldRowidValid != 0)))) { + goto __9 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rtreeDeleteRowid(tls, pRtree, oldRowid) +__9: + ; + + // If the aData[] array contains more than one element, elements + // (aData[2]..aData[argc-1]) contain a new record to insert into + // the r-tree structure. + if !(((*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && (nData > 1)) && (coordChange != 0)) { + goto __10 + } + // Insert the new record into the r-tree + *(*uintptr)(unsafe.Pointer(bp + 56 /* pLeaf */)) = uintptr(0) + if !(!(newRowidValid != 0)) { + goto __11 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rtreeNewRowid(tls, pRtree, (bp /* &cell */ /* &.iRowid */)) +__11: + ; + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) { + goto __12 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = sChooseLeaf(tls, pRtree, bp /* &cell */, 0, bp+56 /* &pLeaf */) +__12: + ; + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) { + goto __13 + } + (*Rtree)(unsafe.Pointer(pRtree)).FiReinsertHeight = -1 + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 56 /* pLeaf */)), bp /* &cell */, 0) + rc2 = nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 56 /* pLeaf */))) + if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) { + goto __14 + } + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = rc2 +__14: + ; +__13: + ; +__10: + ; + + // Change the data + if !((*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && (nData > 1)) { + goto __15 + } + pUp = (*Rtree)(unsafe.Pointer(pRtree)).FpWriteAux + nChange = 0 + Xsqlite3_bind_int64(tls, pUp, 1, (*RtreeCell)(unsafe.Pointer(bp /* &cell */)).FiRowid) + + if !(Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0) { + goto __16 + } + Xsqlite3_bind_null(tls, pUp, 2) + goto __17 +__16: + p = uintptr(0) + if !(((Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) == SQLITE_TEXT) && + ((libc.AssignUintptr(&p, geopolyFuncParam(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+48 /* &rc */))) != uintptr(0))) && + (*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK)) { + goto __18 + } + Xsqlite3_bind_blob(tls, pUp, 2, p+4 /* &.hdr */, (4 + (8 * (*GeoPoly)(unsafe.Pointer(p)).FnVertex)), libc.UintptrFromInt32(-1)) + goto __19 +__18: + Xsqlite3_bind_value(tls, pUp, 2, *(*uintptr)(unsafe.Pointer(aData + 2*8))) +__19: + ; + Xsqlite3_free(tls, p) + nChange = 1 +__17: + ; + jj = 1 +__20: + if !(jj < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux)) { + goto __22 + } + nChange++ + Xsqlite3_bind_value(tls, pUp, (jj + 2), *(*uintptr)(unsafe.Pointer(aData + uintptr((jj+2))*8))) + goto __21 +__21: + jj++ + goto __20 + goto __22 +__22: + ; + if !(nChange != 0) { + goto __23 + } + Xsqlite3_step(tls, pUp) + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_reset(tls, pUp) +__23: + ; +__15: + ; + +geopoly_update_end: + rtreeRelease(tls, pRtree) + return *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) +} + +// Report that geopoly_overlap() is an overloaded function suitable +// for use in xBestIndex. +func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ + if Xsqlite3_stricmp(tls, zName, ts+25883 /* "geopoly_overlap" */) == 0 { + *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{geopolyOverlapFunc})) + *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) + return SQLITE_INDEX_CONSTRAINT_FUNCTION + } + if Xsqlite3_stricmp(tls, zName, ts+25899 /* "geopoly_within" */) == 0 { + *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{geopolyWithinFunc})) + *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) + return (SQLITE_INDEX_CONSTRAINT_FUNCTION + 1) + } + return 0 +} + +var geopolyModule = Sqlite3_module{ + FiVersion: 3, // iVersion + FxCreate: 0, // xCreate - create a table + FxConnect: 0, // xConnect - connect to an existing table + FxBestIndex: 0, // xBestIndex - Determine search strategy + FxDisconnect: 0, // xDisconnect - Disconnect from a table + FxDestroy: 0, // xDestroy - Drop a table + FxOpen: 0, // xOpen - open a cursor + FxClose: 0, // xClose - close a cursor + FxFilter: 0, // xFilter - configure scan constraints + FxNext: 0, // xNext - advance a cursor + FxEof: 0, // xEof + FxColumn: 0, // xColumn - read data + FxRowid: 0, // xRowid - read data + FxUpdate: 0, // xUpdate - write data + FxBegin: 0, // xBegin - begin transaction + FxSync: 0, // xSync - sync transaction + FxCommit: 0, // xCommit - commit transaction + FxRollback: 0, // xRollback - rollback transaction + FxFindFunction: 0, // xFindFunction - function overloading + FxRename: 0, // xRename - rename the table + FxSavepoint: 0, // xRollbackTo + FxShadowName: 0, // xShadowName +} /* sqlite3.c:198382:23 */ + +func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409:12: */ + var rc int32 = SQLITE_OK + var i int32 + for i = 0; (uint64(i) < (uint64(unsafe.Sizeof(aFunc1)) / uint64(unsafe.Sizeof(struct { + FxFunc uintptr + FnArg int8 + FbPure uint8 + _ [6]byte + FzName uintptr + }{})))) && (rc == SQLITE_OK); i++ { + var enc int32 + if aFunc1[i].FbPure != 0 { + enc = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) + } else { + enc = (SQLITE_UTF8 | SQLITE_DIRECTONLY) + } + rc = Xsqlite3_create_function(tls, db, aFunc1[i].FzName, int32(aFunc1[i].FnArg), + enc, uintptr(0), + aFunc1[i].FxFunc, uintptr(0), uintptr(0)) + } + for i = 0; (uint64(i) < (uint64(unsafe.Sizeof(aAgg1)) / uint64(unsafe.Sizeof(struct { + FxStep uintptr + FxFinal uintptr + FzName uintptr + }{})))) && (rc == SQLITE_OK); i++ { + rc = Xsqlite3_create_function(tls, db, aAgg1[i].FzName, 1, + ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS), uintptr(0), + uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) + } + if rc == SQLITE_OK { + rc = Xsqlite3_create_module_v2(tls, db, ts+25914 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + } + return rc +} + +var aFunc1 = [12]struct { + FxFunc uintptr + FnArg int8 + FbPure uint8 + _ [6]byte + FzName uintptr +}{ + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25922 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25935 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25948 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25961 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25899 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25973 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25883 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 25996 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26010 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26023 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26037 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26053 /* "geopoly_ccw" */}, +} /* sqlite3.c:198416:5 */ +var aAgg1 = [1]struct { + FxStep uintptr + FxFinal uintptr + FzName uintptr +}{ + {FxStep: 0, FxFinal: 0, FzName: ts + 26065 /* "geopoly_group_bb..." */}, +} /* sqlite3.c:198434:5 */ + +//************* End of geopoly.c ******************************************** +//************* Continuing where we left off in rtree.c ********************* + +// Register the r-tree module with database handle db. This creates the +// virtual table module "rtree" and the debugging/analysis scalar +// function "rtreenode". +func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20: */ + var utf8 int32 = SQLITE_UTF8 + var rc int32 + + rc = Xsqlite3_create_function(tls, db, ts+26084 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rtreenode})), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = Xsqlite3_create_function(tls, db, ts+26094 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rtreedepth})), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_create_function(tls, db, ts+26105 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rtreecheck})), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + var c uintptr = uintptr(RTREE_COORD_REAL32) + rc = Xsqlite3_create_module_v2(tls, db, ts+25828 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + } + if rc == SQLITE_OK { + var c uintptr = uintptr(RTREE_COORD_INT32) + rc = Xsqlite3_create_module_v2(tls, db, ts+26116 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + } + if rc == SQLITE_OK { + rc = sqlite3_geopoly_init(tls, db) + } + + return rc +} + +// This routine deletes the RtreeGeomCallback object that was attached +// one of the SQL functions create by sqlite3_rtree_geometry_callback() +// or sqlite3_rtree_query_callback(). In other words, this routine is the +// destructor for an RtreeGeomCallback objecct. This routine is called when +// the corresponding SQL function is deleted. +func rtreeFreeCallback(tls *libc.TLS, p uintptr) { /* sqlite3.c:198508:13: */ + var pInfo uintptr = p + if (*RtreeGeomCallback)(unsafe.Pointer(pInfo)).FxDestructor != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pInfo + 16 /* &.xDestructor */))))(tls, (*RtreeGeomCallback)(unsafe.Pointer(pInfo)).FpContext) + } + Xsqlite3_free(tls, p) +} + +// This routine frees the BLOB that is returned by geomCallback(). +func rtreeMatchArgFree(tls *libc.TLS, pArg uintptr) { /* sqlite3.c:198517:13: */ + var i int32 + var p uintptr = pArg + for i = 0; i < (*RtreeMatchArg)(unsafe.Pointer(p)).FnParam; i++ { + Xsqlite3_value_free(tls, *(*uintptr)(unsafe.Pointer((*RtreeMatchArg)(unsafe.Pointer(p)).FapSqlParam + uintptr(i)*8))) + } + Xsqlite3_free(tls, p) +} + +// Each call to sqlite3_rtree_geometry_callback() or +// sqlite3_rtree_query_callback() creates an ordinary SQLite +// scalar function that is implemented by this routine. +// +// All this function does is construct an RtreeMatchArg object that +// contains the geometry-checking callback routines and a list of +// parameters to this function, then return that RtreeMatchArg object +// as a BLOB. +// +// The R-Tree MATCH operator will read the returned BLOB, deserialize +// the RtreeMatchArg object, and use the RtreeMatchArg object to figure +// out which elements of the R-Tree should be returned by the query. +func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sqlite3.c:198540:13: */ + var pGeomCtx uintptr = Xsqlite3_user_data(tls, ctx) + var pBlob uintptr + var nBlob Sqlite3_int64 + var memErr int32 = 0 + + nBlob = (Sqlite3_int64((uint64(unsafe.Sizeof(RtreeMatchArg{})) + ((uint64(nArg - 1)) * uint64(unsafe.Sizeof(RtreeDValue(0))))) + + (uint64(nArg) * uint64(unsafe.Sizeof(uintptr(0)))))) + pBlob = Xsqlite3_malloc64(tls, uint64(nBlob)) + if !(pBlob != 0) { + Xsqlite3_result_error_nomem(tls, ctx) + } else { + var i int32 + (*RtreeMatchArg)(unsafe.Pointer(pBlob)).FiSize = U32(nBlob) + (*RtreeMatchArg)(unsafe.Pointer(pBlob)).Fcb = *(*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)) + (*RtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam = ((pBlob + 56 /* &.aParam */) + uintptr(nArg)*8) + (*RtreeMatchArg)(unsafe.Pointer(pBlob)).FnParam = nArg + for i = 0; i < nArg; i++ { + *(*uintptr)(unsafe.Pointer((*RtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam + uintptr(i)*8)) = Xsqlite3_value_dup(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) + if *(*uintptr)(unsafe.Pointer((*RtreeMatchArg)(unsafe.Pointer(pBlob)).FapSqlParam + uintptr(i)*8)) == uintptr(0) { + memErr = 1 + } + *(*RtreeDValue)(unsafe.Pointer((pBlob + 56 /* &.aParam */) + uintptr(i)*8)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(i)*8))) + } + if memErr != 0 { + Xsqlite3_result_error_nomem(tls, ctx) + rtreeMatchArgFree(tls, pBlob) + } else { + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23404 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + } + } +} + +// Register a new geometry function for use with the r-tree MATCH operator. +func Xsqlite3_rtree_geometry_callback(tls *libc.TLS, db uintptr, zGeom uintptr, xGeom uintptr, pContext uintptr) int32 { /* sqlite3.c:198578:16: */ + var pGeomCtx uintptr // Context object for new user-function + + // Allocate and populate the context object. + pGeomCtx = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(RtreeGeomCallback{}))) + if !(pGeomCtx != 0) { + return SQLITE_NOMEM + } + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxGeom = xGeom + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxQueryFunc = uintptr(0) + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxDestructor = uintptr(0) + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FpContext = pContext + return Xsqlite3_create_function_v2(tls, db, zGeom, -1, SQLITE_ANY, + pGeomCtx, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{geomCallback})), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeFreeCallback}))) +} + +// Register a new 2nd-generation geometry function for use with the +// r-tree MATCH operator. +func Xsqlite3_rtree_query_callback(tls *libc.TLS, db uintptr, zQueryFunc uintptr, xQueryFunc uintptr, pContext uintptr, xDestructor uintptr) int32 { /* sqlite3.c:198602:16: */ + var pGeomCtx uintptr // Context object for new user-function + + // Allocate and populate the context object. + pGeomCtx = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(RtreeGeomCallback{}))) + if !(pGeomCtx != 0) { + return SQLITE_NOMEM + } + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxGeom = uintptr(0) + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxQueryFunc = xQueryFunc + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FxDestructor = xDestructor + (*RtreeGeomCallback)(unsafe.Pointer(pGeomCtx)).FpContext = pContext + return Xsqlite3_create_function_v2(tls, db, zQueryFunc, -1, SQLITE_ANY, + pGeomCtx, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{geomCallback})), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeFreeCallback}))) +} + +//************* End of rtree.c ********************************************** +//************* Begin file icu.c ******************************************** +// 2007 May 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// $Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp $ +// +// This file implements an integration between the ICU library +// ("International Components for Unicode", an open-source library +// for handling unicode data) and SQLite. The integration uses +// ICU to provide the following to SQLite: +// +// * An implementation of the SQL regexp() function (and hence REGEXP +// operator) using the ICU uregex_XX() APIs. +// +// * Implementations of the SQL scalar upper() and lower() functions +// for case mapping. +// +// * Integration of ICU and SQLite collation sequences. +// +// * An implementation of the LIKE operator that uses ICU to +// provide case-independent matching. + +//************* End of icu.c ************************************************ +//************* Begin file fts3_icu.c *************************************** +// 2007 June 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file implements a tokenizer for fts3 based on the ICU library. +// #include "fts3Int.h" + +//************* End of fts3_icu.c ******************************************* +//************* Begin file sqlite3rbu.c ************************************* +// 2014 August 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// +// OVERVIEW +// +// The RBU extension requires that the RBU update be packaged as an +// SQLite database. The tables it expects to find are described in +// sqlite3rbu.h. Essentially, for each table xyz in the target database +// that the user wishes to write to, a corresponding data_xyz table is +// created in the RBU database and populated with one row for each row to +// update, insert or delete from the target table. +// +// The update proceeds in three stages: +// +// 1) The database is updated. The modified database pages are written +// to a *-oal file. A *-oal file is just like a *-wal file, except +// that it is named "-oal" instead of "-wal". +// Because regular SQLite clients do not look for file named +// "-oal", they go on using the original database in +// rollback mode while the *-oal file is being generated. +// +// During this stage RBU does not update the database by writing +// directly to the target tables. Instead it creates "imposter" +// tables using the SQLITE_TESTCTRL_IMPOSTER interface that it uses +// to update each b-tree individually. All updates required by each +// b-tree are completed before moving on to the next, and all +// updates are done in sorted key order. +// +// 2) The "-oal" file is moved to the equivalent "-wal" +// location using a call to rename(2). Before doing this the RBU +// module takes an EXCLUSIVE lock on the database file, ensuring +// that there are no other active readers. +// +// Once the EXCLUSIVE lock is released, any other database readers +// detect the new *-wal file and read the database in wal mode. At +// this point they see the new version of the database - including +// the updates made as part of the RBU update. +// +// 3) The new *-wal file is checkpointed. This proceeds in the same way +// as a regular database checkpoint, except that a single frame is +// checkpointed each time sqlite3rbu_step() is called. If the RBU +// handle is closed before the entire *-wal file is checkpointed, +// the checkpoint progress is saved in the RBU database and the +// checkpoint can be resumed by another RBU client at some point in +// the future. +// +// POTENTIAL PROBLEMS +// +// The rename() call might not be portable. And RBU is not currently +// syncing the directory after renaming the file. +// +// When state is saved, any commit to the *-oal file and the commit to +// the RBU update database are not atomic. So if the power fails at the +// wrong moment they might get out of sync. As the main database will be +// committed before the RBU update database this will likely either just +// pass unnoticed, or result in SQLITE_CONSTRAINT errors (due to UNIQUE +// constraint violations). +// +// If some client does modify the target database mid RBU update, or some +// other error occurs, the RBU extension will keep throwing errors. It's +// not really clear how to get out of this state. The system could just +// by delete the RBU update database and *-oal file and have the device +// download the update again and start over. +// +// At present, for an UPDATE, both the new.* and old.* records are +// collected in the rbu_xyz table. And for both UPDATEs and DELETEs all +// fields are collected. This means we're probably writing a lot more +// data to disk when saving the state of an ongoing update to the RBU +// update database than is strictly necessary. +// + +// #include +// #include +// #include + +// #include "sqlite3.h" + +//************* Include sqlite3rbu.h in the middle of sqlite3rbu.c ********** +//************* Begin file sqlite3rbu.h ************************************* +// 2014 August 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains the public interface for the RBU extension. + +// SUMMARY +// +// Writing a transaction containing a large number of operations on +// b-tree indexes that are collectively larger than the available cache +// memory can be very inefficient. +// +// The problem is that in order to update a b-tree, the leaf page (at least) +// containing the entry being inserted or deleted must be modified. If the +// working set of leaves is larger than the available cache memory, then a +// single leaf that is modified more than once as part of the transaction +// may be loaded from or written to the persistent media multiple times. +// Additionally, because the index updates are likely to be applied in +// random order, access to pages within the database is also likely to be in +// random order, which is itself quite inefficient. +// +// One way to improve the situation is to sort the operations on each index +// by index key before applying them to the b-tree. This leads to an IO +// pattern that resembles a single linear scan through the index b-tree, +// and all but guarantees each modified leaf page is loaded and stored +// exactly once. SQLite uses this trick to improve the performance of +// CREATE INDEX commands. This extension allows it to be used to improve +// the performance of large transactions on existing databases. +// +// Additionally, this extension allows the work involved in writing the +// large transaction to be broken down into sub-transactions performed +// sequentially by separate processes. This is useful if the system cannot +// guarantee that a single update process will run for long enough to apply +// the entire update, for example because the update is being applied on a +// mobile device that is frequently rebooted. Even after the writer process +// has committed one or more sub-transactions, other database clients continue +// to read from the original database snapshot. In other words, partially +// applied transactions are not visible to other clients. +// +// "RBU" stands for "Resumable Bulk Update". As in a large database update +// transmitted via a wireless network to a mobile device. A transaction +// applied using this extension is hence refered to as an "RBU update". +// +// +// LIMITATIONS +// +// An "RBU update" transaction is subject to the following limitations: +// +// * The transaction must consist of INSERT, UPDATE and DELETE operations +// only. +// +// * INSERT statements may not use any default values. +// +// * UPDATE and DELETE statements must identify their target rows by +// non-NULL PRIMARY KEY values. Rows with NULL values stored in PRIMARY +// KEY fields may not be updated or deleted. If the table being written +// has no PRIMARY KEY, affected rows must be identified by rowid. +// +// * UPDATE statements may not modify PRIMARY KEY columns. +// +// * No triggers will be fired. +// +// * No foreign key violations are detected or reported. +// +// * CHECK constraints are not enforced. +// +// * No constraint handling mode except for "OR ROLLBACK" is supported. +// +// +// PREPARATION +// +// An "RBU update" is stored as a separate SQLite database. A database +// containing an RBU update is an "RBU database". For each table in the +// target database to be updated, the RBU database should contain a table +// named "data_" containing the same set of columns as the +// target table, and one more - "rbu_control". The data_% table should +// have no PRIMARY KEY or UNIQUE constraints, but each column should have +// the same type as the corresponding column in the target database. +// The "rbu_control" column should have no type at all. For example, if +// the target database contains: +// +// CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c UNIQUE); +// +// Then the RBU database should contain: +// +// CREATE TABLE data_t1(a INTEGER, b TEXT, c, rbu_control); +// +// The order of the columns in the data_% table does not matter. +// +// Instead of a regular table, the RBU database may also contain virtual +// tables or view named using the data_ naming scheme. +// +// Instead of the plain data_ naming scheme, RBU database tables +// may also be named data_, where is any sequence +// of zero or more numeric characters (0-9). This can be significant because +// tables within the RBU database are always processed in order sorted by +// name. By judicious selection of the portion of the names +// of the RBU tables the user can therefore control the order in which they +// are processed. This can be useful, for example, to ensure that "external +// content" FTS4 tables are updated before their underlying content tables. +// +// If the target database table is a virtual table or a table that has no +// PRIMARY KEY declaration, the data_% table must also contain a column +// named "rbu_rowid". This column is mapped to the tables implicit primary +// key column - "rowid". Virtual tables for which the "rowid" column does +// not function like a primary key value cannot be updated using RBU. For +// example, if the target db contains either of the following: +// +// CREATE VIRTUAL TABLE x1 USING fts3(a, b); +// CREATE TABLE x1(a, b) +// +// then the RBU database should contain: +// +// CREATE TABLE data_x1(a, b, rbu_rowid, rbu_control); +// +// All non-hidden columns (i.e. all columns matched by "SELECT *") of the +// target table must be present in the input table. For virtual tables, +// hidden columns are optional - they are updated by RBU if present in +// the input table, or not otherwise. For example, to write to an fts4 +// table with a hidden languageid column such as: +// +// CREATE VIRTUAL TABLE ft1 USING fts4(a, b, languageid='langid'); +// +// Either of the following input table schemas may be used: +// +// CREATE TABLE data_ft1(a, b, langid, rbu_rowid, rbu_control); +// CREATE TABLE data_ft1(a, b, rbu_rowid, rbu_control); +// +// For each row to INSERT into the target database as part of the RBU +// update, the corresponding data_% table should contain a single record +// with the "rbu_control" column set to contain integer value 0. The +// other columns should be set to the values that make up the new record +// to insert. +// +// If the target database table has an INTEGER PRIMARY KEY, it is not +// possible to insert a NULL value into the IPK column. Attempting to +// do so results in an SQLITE_MISMATCH error. +// +// For each row to DELETE from the target database as part of the RBU +// update, the corresponding data_% table should contain a single record +// with the "rbu_control" column set to contain integer value 1. The +// real primary key values of the row to delete should be stored in the +// corresponding columns of the data_% table. The values stored in the +// other columns are not used. +// +// For each row to UPDATE from the target database as part of the RBU +// update, the corresponding data_% table should contain a single record +// with the "rbu_control" column set to contain a value of type text. +// The real primary key values identifying the row to update should be +// stored in the corresponding columns of the data_% table row, as should +// the new values of all columns being update. The text value in the +// "rbu_control" column must contain the same number of characters as +// there are columns in the target database table, and must consist entirely +// of 'x' and '.' characters (or in some special cases 'd' - see below). For +// each column that is being updated, the corresponding character is set to +// 'x'. For those that remain as they are, the corresponding character of the +// rbu_control value should be set to '.'. For example, given the tables +// above, the update statement: +// +// UPDATE t1 SET c = 'usa' WHERE a = 4; +// +// is represented by the data_t1 row created by: +// +// INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..x'); +// +// Instead of an 'x' character, characters of the rbu_control value specified +// for UPDATEs may also be set to 'd'. In this case, instead of updating the +// target table with the value stored in the corresponding data_% column, the +// user-defined SQL function "rbu_delta()" is invoked and the result stored in +// the target table column. rbu_delta() is invoked with two arguments - the +// original value currently stored in the target table column and the +// value specified in the data_xxx table. +// +// For example, this row: +// +// INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..d'); +// +// is similar to an UPDATE statement such as: +// +// UPDATE t1 SET c = rbu_delta(c, 'usa') WHERE a = 4; +// +// Finally, if an 'f' character appears in place of a 'd' or 's' in an +// ota_control string, the contents of the data_xxx table column is assumed +// to be a "fossil delta" - a patch to be applied to a blob value in the +// format used by the fossil source-code management system. In this case +// the existing value within the target database table must be of type BLOB. +// It is replaced by the result of applying the specified fossil delta to +// itself. +// +// If the target database table is a virtual table or a table with no PRIMARY +// KEY, the rbu_control value should not include a character corresponding +// to the rbu_rowid value. For example, this: +// +// INSERT INTO data_ft1(a, b, rbu_rowid, rbu_control) +// VALUES(NULL, 'usa', 12, '.x'); +// +// causes a result similar to: +// +// UPDATE ft1 SET b = 'usa' WHERE rowid = 12; +// +// The data_xxx tables themselves should have no PRIMARY KEY declarations. +// However, RBU is more efficient if reading the rows in from each data_xxx +// table in "rowid" order is roughly the same as reading them sorted by +// the PRIMARY KEY of the corresponding target database table. In other +// words, rows should be sorted using the destination table PRIMARY KEY +// fields before they are inserted into the data_xxx tables. +// +// USAGE +// +// The API declared below allows an application to apply an RBU update +// stored on disk to an existing target database. Essentially, the +// application: +// +// 1) Opens an RBU handle using the sqlite3rbu_open() function. +// +// 2) Registers any required virtual table modules with the database +// handle returned by sqlite3rbu_db(). Also, if required, register +// the rbu_delta() implementation. +// +// 3) Calls the sqlite3rbu_step() function one or more times on +// the new handle. Each call to sqlite3rbu_step() performs a single +// b-tree operation, so thousands of calls may be required to apply +// a complete update. +// +// 4) Calls sqlite3rbu_close() to close the RBU update handle. If +// sqlite3rbu_step() has been called enough times to completely +// apply the update to the target database, then the RBU database +// is marked as fully applied. Otherwise, the state of the RBU +// update application is saved in the RBU database for later +// resumption. +// +// See comments below for more detail on APIs. +// +// If an update is only partially applied to the target database by the +// time sqlite3rbu_close() is called, various state information is saved +// within the RBU database. This allows subsequent processes to automatically +// resume the RBU update from where it left off. +// +// To remove all RBU extension state information, returning an RBU database +// to its original contents, it is sufficient to drop all tables that begin +// with the prefix "rbu_" +// +// DATABASE LOCKING +// +// An RBU update may not be applied to a database in WAL mode. Attempting +// to do so is an error (SQLITE_ERROR). +// +// While an RBU handle is open, a SHARED lock may be held on the target +// database file. This means it is possible for other clients to read the +// database, but not to write it. +// +// If an RBU update is started and then suspended before it is completed, +// then an external client writes to the database, then attempting to resume +// the suspended RBU update is also an error (SQLITE_BUSY). + +// #include "sqlite3.h" ** Required for error code definitions ** + +type sqlite3rbu = struct { + FeStage int32 + _ [4]byte + FdbMain uintptr + FdbRbu uintptr + FzTarget uintptr + FzRbu uintptr + FzState uintptr + FzStateDb [5]int8 + _ [3]byte + Frc int32 + _ [4]byte + FzErrmsg uintptr + FnStep int32 + FnProgress int32 + Fobjiter RbuObjIter + FzVfsName uintptr + FpTargetFd uintptr + FnPagePerSector int32 + _ [4]byte + FiOalSz I64 + FnPhaseOneStep I64 + FiMaxFrame U32 + FmLock U32 + FnFrame int32 + FnFrameAlloc int32 + FaFrame uintptr + Fpgsz int32 + _ [4]byte + FaBuf uintptr + FiWalCksum I64 + FszTemp I64 + FszTempLimit I64 + FnRbu int32 + _ [4]byte + FpRbuFd uintptr +} /* sqlite3.c:199829:9 */ + +//************* End of rtree.c ********************************************** +//************* Begin file icu.c ******************************************** +// 2007 May 6 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// $Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp $ +// +// This file implements an integration between the ICU library +// ("International Components for Unicode", an open-source library +// for handling unicode data) and SQLite. The integration uses +// ICU to provide the following to SQLite: +// +// * An implementation of the SQL regexp() function (and hence REGEXP +// operator) using the ICU uregex_XX() APIs. +// +// * Implementations of the SQL scalar upper() and lower() functions +// for case mapping. +// +// * Integration of ICU and SQLite collation sequences. +// +// * An implementation of the LIKE operator that uses ICU to +// provide case-independent matching. + +//************* End of icu.c ************************************************ +//************* Begin file fts3_icu.c *************************************** +// 2007 June 22 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// This file implements a tokenizer for fts3 based on the ICU library. +// #include "fts3Int.h" + +//************* End of fts3_icu.c ******************************************* +//************* Begin file sqlite3rbu.c ************************************* +// 2014 August 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// +// OVERVIEW +// +// The RBU extension requires that the RBU update be packaged as an +// SQLite database. The tables it expects to find are described in +// sqlite3rbu.h. Essentially, for each table xyz in the target database +// that the user wishes to write to, a corresponding data_xyz table is +// created in the RBU database and populated with one row for each row to +// update, insert or delete from the target table. +// +// The update proceeds in three stages: +// +// 1) The database is updated. The modified database pages are written +// to a *-oal file. A *-oal file is just like a *-wal file, except +// that it is named "-oal" instead of "-wal". +// Because regular SQLite clients do not look for file named +// "-oal", they go on using the original database in +// rollback mode while the *-oal file is being generated. +// +// During this stage RBU does not update the database by writing +// directly to the target tables. Instead it creates "imposter" +// tables using the SQLITE_TESTCTRL_IMPOSTER interface that it uses +// to update each b-tree individually. All updates required by each +// b-tree are completed before moving on to the next, and all +// updates are done in sorted key order. +// +// 2) The "-oal" file is moved to the equivalent "-wal" +// location using a call to rename(2). Before doing this the RBU +// module takes an EXCLUSIVE lock on the database file, ensuring +// that there are no other active readers. +// +// Once the EXCLUSIVE lock is released, any other database readers +// detect the new *-wal file and read the database in wal mode. At +// this point they see the new version of the database - including +// the updates made as part of the RBU update. +// +// 3) The new *-wal file is checkpointed. This proceeds in the same way +// as a regular database checkpoint, except that a single frame is +// checkpointed each time sqlite3rbu_step() is called. If the RBU +// handle is closed before the entire *-wal file is checkpointed, +// the checkpoint progress is saved in the RBU database and the +// checkpoint can be resumed by another RBU client at some point in +// the future. +// +// POTENTIAL PROBLEMS +// +// The rename() call might not be portable. And RBU is not currently +// syncing the directory after renaming the file. +// +// When state is saved, any commit to the *-oal file and the commit to +// the RBU update database are not atomic. So if the power fails at the +// wrong moment they might get out of sync. As the main database will be +// committed before the RBU update database this will likely either just +// pass unnoticed, or result in SQLITE_CONSTRAINT errors (due to UNIQUE +// constraint violations). +// +// If some client does modify the target database mid RBU update, or some +// other error occurs, the RBU extension will keep throwing errors. It's +// not really clear how to get out of this state. The system could just +// by delete the RBU update database and *-oal file and have the device +// download the update again and start over. +// +// At present, for an UPDATE, both the new.* and old.* records are +// collected in the rbu_xyz table. And for both UPDATEs and DELETEs all +// fields are collected. This means we're probably writing a lot more +// data to disk when saving the state of an ongoing update to the RBU +// update database than is strictly necessary. +// + +// #include +// #include +// #include + +// #include "sqlite3.h" + +//************* Include sqlite3rbu.h in the middle of sqlite3rbu.c ********** +//************* Begin file sqlite3rbu.h ************************************* +// 2014 August 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains the public interface for the RBU extension. + +// SUMMARY +// +// Writing a transaction containing a large number of operations on +// b-tree indexes that are collectively larger than the available cache +// memory can be very inefficient. +// +// The problem is that in order to update a b-tree, the leaf page (at least) +// containing the entry being inserted or deleted must be modified. If the +// working set of leaves is larger than the available cache memory, then a +// single leaf that is modified more than once as part of the transaction +// may be loaded from or written to the persistent media multiple times. +// Additionally, because the index updates are likely to be applied in +// random order, access to pages within the database is also likely to be in +// random order, which is itself quite inefficient. +// +// One way to improve the situation is to sort the operations on each index +// by index key before applying them to the b-tree. This leads to an IO +// pattern that resembles a single linear scan through the index b-tree, +// and all but guarantees each modified leaf page is loaded and stored +// exactly once. SQLite uses this trick to improve the performance of +// CREATE INDEX commands. This extension allows it to be used to improve +// the performance of large transactions on existing databases. +// +// Additionally, this extension allows the work involved in writing the +// large transaction to be broken down into sub-transactions performed +// sequentially by separate processes. This is useful if the system cannot +// guarantee that a single update process will run for long enough to apply +// the entire update, for example because the update is being applied on a +// mobile device that is frequently rebooted. Even after the writer process +// has committed one or more sub-transactions, other database clients continue +// to read from the original database snapshot. In other words, partially +// applied transactions are not visible to other clients. +// +// "RBU" stands for "Resumable Bulk Update". As in a large database update +// transmitted via a wireless network to a mobile device. A transaction +// applied using this extension is hence refered to as an "RBU update". +// +// +// LIMITATIONS +// +// An "RBU update" transaction is subject to the following limitations: +// +// * The transaction must consist of INSERT, UPDATE and DELETE operations +// only. +// +// * INSERT statements may not use any default values. +// +// * UPDATE and DELETE statements must identify their target rows by +// non-NULL PRIMARY KEY values. Rows with NULL values stored in PRIMARY +// KEY fields may not be updated or deleted. If the table being written +// has no PRIMARY KEY, affected rows must be identified by rowid. +// +// * UPDATE statements may not modify PRIMARY KEY columns. +// +// * No triggers will be fired. +// +// * No foreign key violations are detected or reported. +// +// * CHECK constraints are not enforced. +// +// * No constraint handling mode except for "OR ROLLBACK" is supported. +// +// +// PREPARATION +// +// An "RBU update" is stored as a separate SQLite database. A database +// containing an RBU update is an "RBU database". For each table in the +// target database to be updated, the RBU database should contain a table +// named "data_" containing the same set of columns as the +// target table, and one more - "rbu_control". The data_% table should +// have no PRIMARY KEY or UNIQUE constraints, but each column should have +// the same type as the corresponding column in the target database. +// The "rbu_control" column should have no type at all. For example, if +// the target database contains: +// +// CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c UNIQUE); +// +// Then the RBU database should contain: +// +// CREATE TABLE data_t1(a INTEGER, b TEXT, c, rbu_control); +// +// The order of the columns in the data_% table does not matter. +// +// Instead of a regular table, the RBU database may also contain virtual +// tables or view named using the data_ naming scheme. +// +// Instead of the plain data_ naming scheme, RBU database tables +// may also be named data_, where is any sequence +// of zero or more numeric characters (0-9). This can be significant because +// tables within the RBU database are always processed in order sorted by +// name. By judicious selection of the portion of the names +// of the RBU tables the user can therefore control the order in which they +// are processed. This can be useful, for example, to ensure that "external +// content" FTS4 tables are updated before their underlying content tables. +// +// If the target database table is a virtual table or a table that has no +// PRIMARY KEY declaration, the data_% table must also contain a column +// named "rbu_rowid". This column is mapped to the tables implicit primary +// key column - "rowid". Virtual tables for which the "rowid" column does +// not function like a primary key value cannot be updated using RBU. For +// example, if the target db contains either of the following: +// +// CREATE VIRTUAL TABLE x1 USING fts3(a, b); +// CREATE TABLE x1(a, b) +// +// then the RBU database should contain: +// +// CREATE TABLE data_x1(a, b, rbu_rowid, rbu_control); +// +// All non-hidden columns (i.e. all columns matched by "SELECT *") of the +// target table must be present in the input table. For virtual tables, +// hidden columns are optional - they are updated by RBU if present in +// the input table, or not otherwise. For example, to write to an fts4 +// table with a hidden languageid column such as: +// +// CREATE VIRTUAL TABLE ft1 USING fts4(a, b, languageid='langid'); +// +// Either of the following input table schemas may be used: +// +// CREATE TABLE data_ft1(a, b, langid, rbu_rowid, rbu_control); +// CREATE TABLE data_ft1(a, b, rbu_rowid, rbu_control); +// +// For each row to INSERT into the target database as part of the RBU +// update, the corresponding data_% table should contain a single record +// with the "rbu_control" column set to contain integer value 0. The +// other columns should be set to the values that make up the new record +// to insert. +// +// If the target database table has an INTEGER PRIMARY KEY, it is not +// possible to insert a NULL value into the IPK column. Attempting to +// do so results in an SQLITE_MISMATCH error. +// +// For each row to DELETE from the target database as part of the RBU +// update, the corresponding data_% table should contain a single record +// with the "rbu_control" column set to contain integer value 1. The +// real primary key values of the row to delete should be stored in the +// corresponding columns of the data_% table. The values stored in the +// other columns are not used. +// +// For each row to UPDATE from the target database as part of the RBU +// update, the corresponding data_% table should contain a single record +// with the "rbu_control" column set to contain a value of type text. +// The real primary key values identifying the row to update should be +// stored in the corresponding columns of the data_% table row, as should +// the new values of all columns being update. The text value in the +// "rbu_control" column must contain the same number of characters as +// there are columns in the target database table, and must consist entirely +// of 'x' and '.' characters (or in some special cases 'd' - see below). For +// each column that is being updated, the corresponding character is set to +// 'x'. For those that remain as they are, the corresponding character of the +// rbu_control value should be set to '.'. For example, given the tables +// above, the update statement: +// +// UPDATE t1 SET c = 'usa' WHERE a = 4; +// +// is represented by the data_t1 row created by: +// +// INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..x'); +// +// Instead of an 'x' character, characters of the rbu_control value specified +// for UPDATEs may also be set to 'd'. In this case, instead of updating the +// target table with the value stored in the corresponding data_% column, the +// user-defined SQL function "rbu_delta()" is invoked and the result stored in +// the target table column. rbu_delta() is invoked with two arguments - the +// original value currently stored in the target table column and the +// value specified in the data_xxx table. +// +// For example, this row: +// +// INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..d'); +// +// is similar to an UPDATE statement such as: +// +// UPDATE t1 SET c = rbu_delta(c, 'usa') WHERE a = 4; +// +// Finally, if an 'f' character appears in place of a 'd' or 's' in an +// ota_control string, the contents of the data_xxx table column is assumed +// to be a "fossil delta" - a patch to be applied to a blob value in the +// format used by the fossil source-code management system. In this case +// the existing value within the target database table must be of type BLOB. +// It is replaced by the result of applying the specified fossil delta to +// itself. +// +// If the target database table is a virtual table or a table with no PRIMARY +// KEY, the rbu_control value should not include a character corresponding +// to the rbu_rowid value. For example, this: +// +// INSERT INTO data_ft1(a, b, rbu_rowid, rbu_control) +// VALUES(NULL, 'usa', 12, '.x'); +// +// causes a result similar to: +// +// UPDATE ft1 SET b = 'usa' WHERE rowid = 12; +// +// The data_xxx tables themselves should have no PRIMARY KEY declarations. +// However, RBU is more efficient if reading the rows in from each data_xxx +// table in "rowid" order is roughly the same as reading them sorted by +// the PRIMARY KEY of the corresponding target database table. In other +// words, rows should be sorted using the destination table PRIMARY KEY +// fields before they are inserted into the data_xxx tables. +// +// USAGE +// +// The API declared below allows an application to apply an RBU update +// stored on disk to an existing target database. Essentially, the +// application: +// +// 1) Opens an RBU handle using the sqlite3rbu_open() function. +// +// 2) Registers any required virtual table modules with the database +// handle returned by sqlite3rbu_db(). Also, if required, register +// the rbu_delta() implementation. +// +// 3) Calls the sqlite3rbu_step() function one or more times on +// the new handle. Each call to sqlite3rbu_step() performs a single +// b-tree operation, so thousands of calls may be required to apply +// a complete update. +// +// 4) Calls sqlite3rbu_close() to close the RBU update handle. If +// sqlite3rbu_step() has been called enough times to completely +// apply the update to the target database, then the RBU database +// is marked as fully applied. Otherwise, the state of the RBU +// update application is saved in the RBU database for later +// resumption. +// +// See comments below for more detail on APIs. +// +// If an update is only partially applied to the target database by the +// time sqlite3rbu_close() is called, various state information is saved +// within the RBU database. This allows subsequent processes to automatically +// resume the RBU update from where it left off. +// +// To remove all RBU extension state information, returning an RBU database +// to its original contents, it is sufficient to drop all tables that begin +// with the prefix "rbu_" +// +// DATABASE LOCKING +// +// An RBU update may not be applied to a database in WAL mode. Attempting +// to do so is an error (SQLITE_ERROR). +// +// While an RBU handle is open, a SHARED lock may be held on the target +// database file. This means it is possible for other clients to read the +// database, but not to write it. +// +// If an RBU update is started and then suspended before it is completed, +// then an external client writes to the database, then attempting to resume +// the suspended RBU update is also an error (SQLITE_BUSY). + +// #include "sqlite3.h" ** Required for error code definitions ** + +type Sqlite3rbu = sqlite3rbu /* sqlite3.c:199829:27 */ + +//************* End of sqlite3rbu.h ***************************************** +//************* Continuing where we left off in sqlite3rbu.c **************** + +// Maximum number of prepared UPDATE statements held by this module + +// Delta checksums disabled by default. Compile with -DRBU_ENABLE_DELTA_CKSUM +// to enable checksum verification. + +// Swap two objects of type TYPE. + +// The rbu_state table is used to save the state of a partially applied +// update so that it can be resumed later. The table consists of integer +// keys mapped to values as follows: +// +// RBU_STATE_STAGE: +// May be set to integer values 1, 2, 4 or 5. As follows: +// 1: the *-rbu file is currently under construction. +// 2: the *-rbu file has been constructed, but not yet moved +// to the *-wal path. +// 4: the checkpoint is underway. +// 5: the rbu update has been checkpointed. +// +// RBU_STATE_TBL: +// Only valid if STAGE==1. The target database name of the table +// currently being written. +// +// RBU_STATE_IDX: +// Only valid if STAGE==1. The target database name of the index +// currently being written, or NULL if the main table is currently being +// updated. +// +// RBU_STATE_ROW: +// Only valid if STAGE==1. Number of rows already processed for the current +// table/index. +// +// RBU_STATE_PROGRESS: +// Trbul number of sqlite3rbu_step() calls made so far as part of this +// rbu update. +// +// RBU_STATE_CKPT: +// Valid if STAGE==4. The 64-bit checksum associated with the wal-index +// header created by recovering the *-wal file. This is used to detect +// cases when another client appends frames to the *-wal file in the +// middle of an incremental checkpoint (an incremental checkpoint cannot +// be continued if this happens). +// +// RBU_STATE_COOKIE: +// Valid if STAGE==1. The current change-counter cookie value in the +// target db file. +// +// RBU_STATE_OALSZ: +// Valid if STAGE==1. The size in bytes of the *-oal file. +// +// RBU_STATE_DATATBL: +// Only valid if STAGE==1. The RBU database name of the table +// currently being read. + +type RbuFrame1 = struct { + FiDbPage U32 + FiWalFrame U32 +} /* sqlite3.c:199829:9 */ + +//************* End of sqlite3rbu.h ***************************************** +//************* Continuing where we left off in sqlite3rbu.c **************** + +// Maximum number of prepared UPDATE statements held by this module + +// Delta checksums disabled by default. Compile with -DRBU_ENABLE_DELTA_CKSUM +// to enable checksum verification. + +// Swap two objects of type TYPE. + +// The rbu_state table is used to save the state of a partially applied +// update so that it can be resumed later. The table consists of integer +// keys mapped to values as follows: +// +// RBU_STATE_STAGE: +// May be set to integer values 1, 2, 4 or 5. As follows: +// 1: the *-rbu file is currently under construction. +// 2: the *-rbu file has been constructed, but not yet moved +// to the *-wal path. +// 4: the checkpoint is underway. +// 5: the rbu update has been checkpointed. +// +// RBU_STATE_TBL: +// Only valid if STAGE==1. The target database name of the table +// currently being written. +// +// RBU_STATE_IDX: +// Only valid if STAGE==1. The target database name of the index +// currently being written, or NULL if the main table is currently being +// updated. +// +// RBU_STATE_ROW: +// Only valid if STAGE==1. Number of rows already processed for the current +// table/index. +// +// RBU_STATE_PROGRESS: +// Trbul number of sqlite3rbu_step() calls made so far as part of this +// rbu update. +// +// RBU_STATE_CKPT: +// Valid if STAGE==4. The 64-bit checksum associated with the wal-index +// header created by recovering the *-wal file. This is used to detect +// cases when another client appends frames to the *-wal file in the +// middle of an incremental checkpoint (an incremental checkpoint cannot +// be continued if this happens). +// +// RBU_STATE_COOKIE: +// Valid if STAGE==1. The current change-counter cookie value in the +// target db file. +// +// RBU_STATE_OALSZ: +// Valid if STAGE==1. The size in bytes of the *-oal file. +// +// RBU_STATE_DATATBL: +// Only valid if STAGE==1. The RBU database name of the table +// currently being read. + +type RbuFrame = RbuFrame1 /* sqlite3.c:200253:25 */ +type RbuObjIter1 = struct { + FpTblIter uintptr + FpIdxIter uintptr + FnTblCol int32 + _ [4]byte + FazTblCol uintptr + FazTblType uintptr + FaiSrcOrder uintptr + FabTblPk uintptr + FabNotNull uintptr + FabIndexed uintptr + FeType int32 + FbCleanup int32 + FzTbl uintptr + FzDataTbl uintptr + FzIdx uintptr + FiTnum int32 + FiPkTnum int32 + FbUnique int32 + FnIndex int32 + FnCol int32 + _ [4]byte + FpSelect uintptr + FpInsert uintptr + FpDelete uintptr + FpTmpInsert uintptr + FnIdxCol int32 + _ [4]byte + FaIdxCol uintptr + FzIdxSql uintptr + FpRbuUpdate uintptr +} /* sqlite3.c:199829:9 */ + +type RbuObjIter = RbuObjIter1 /* sqlite3.c:200254:27 */ +type RbuState1 = struct { + FeStage int32 + _ [4]byte + FzTbl uintptr + FzDataTbl uintptr + FzIdx uintptr + FiWalCksum I64 + FnRow int32 + _ [4]byte + FnProgress I64 + FiCookie U32 + _ [4]byte + FiOalSz I64 + FnPhaseOneStep I64 +} /* sqlite3.c:200255:9 */ + +type RbuState = RbuState1 /* sqlite3.c:200255:25 */ +type RbuSpan1 = struct { + FzSpan uintptr + FnSpan int32 + _ [4]byte +} /* sqlite3.c:199829:9 */ + +type RbuSpan = RbuSpan1 /* sqlite3.c:200256:24 */ +type rbu_vfs = struct { + Fbase Sqlite3_vfs + FpRealVfs uintptr + Fmutex uintptr + FpRbu uintptr + FpMain uintptr + FpMainRbu uintptr +} /* sqlite3.c:199829:9 */ + +type Rbu_vfs = rbu_vfs /* sqlite3.c:200257:24 */ +type rbu_file = struct { + Fbase Sqlite3_file + FpReal uintptr + FpRbuVfs uintptr + FpRbu uintptr + Fsz I64 + FopenFlags int32 + FiCookie U32 + FiWriteVer U8 + FbNolock U8 + _ [2]byte + FnShm int32 + FapShm uintptr + FzDel uintptr + FzWal uintptr + FpWalFd uintptr + FpMainNext uintptr + FpMainRbuNext uintptr +} /* sqlite3.c:199829:9 */ + +type Rbu_file = rbu_file /* sqlite3.c:200258:25 */ +type RbuUpdateStmt1 = struct { + FzMask uintptr + FpUpdate uintptr + FpNext uintptr +} /* sqlite3.c:199829:9 */ + +type RbuUpdateStmt = RbuUpdateStmt1 /* sqlite3.c:200259:30 */ + +// True for an RBU vacuum handle, or false otherwise. + +// ************************************************************************ +// +// The following three functions, found below: +// +// rbuDeltaGetInt() +// rbuDeltaChecksum() +// rbuDeltaApply() +// +// are lifted from the fossil source code (http://fossil-scm.org). They +// are used to implement the scalar SQL function rbu_fossil_delta(). + +// Read bytes from *pz and convert them into a positive integer. When +// finished, leave *pz pointing to the first character past the end of +// the integer. The *pLen parameter holds the length of the string +// in *pz and is decremented once for each character in the integer. +func rbuDeltaGetInt(tls *libc.TLS, pz uintptr, pLen uintptr) uint32 { /* sqlite3.c:200549:21: */ + var v uint32 = uint32(0) + var c int32 + var z uintptr = *(*uintptr)(unsafe.Pointer(pz)) + var zStart uintptr = z + for (libc.AssignInt32(&c, int32(zValue[(0x7f&int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))]))) >= 0 { + v = ((v << 6) + uint32(c)) + } + z-- + *(*int32)(unsafe.Pointer(pLen)) -= int32(((int64(z) - int64(zStart)) / 1)) + *(*uintptr)(unsafe.Pointer(pz)) = z + return v +} + +var zValue = [128]int8{ + int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), + int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), + int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), + int8(0), int8(1), int8(2), int8(3), int8(4), int8(5), int8(6), int8(7), int8(8), int8(9), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), int8(-1), + int8(-1), int8(10), int8(11), int8(12), int8(13), int8(14), int8(15), int8(16), int8(17), int8(18), int8(19), int8(20), int8(21), int8(22), int8(23), int8(24), + int8(25), int8(26), int8(27), int8(28), int8(29), int8(30), int8(31), int8(32), int8(33), int8(34), int8(35), int8(-1), int8(-1), int8(-1), int8(-1), int8(36), + int8(-1), int8(37), int8(38), int8(39), int8(40), int8(41), int8(42), int8(43), int8(44), int8(45), int8(46), int8(47), int8(48), int8(49), int8(50), int8(51), + int8(52), int8(53), int8(54), int8(55), int8(56), int8(57), int8(58), int8(59), int8(60), int8(61), int8(62), int8(-1), int8(-1), int8(-1), int8(63), int8(-1), +} /* sqlite3.c:200550:28 */ + +// Apply a delta. +// +// The output buffer should be big enough to hold the whole output +// file and a NUL terminator at the end. The delta_output_size() +// routine will determine this size for you. +// +// The delta string should be null-terminated. But the delta string +// may contain embedded NUL characters (if the input and output are +// binary files) so we also have to pass in the length of the delta in +// the lenDelta parameter. +// +// This function returns the size of the output file in bytes (excluding +// the final NUL terminator character). Except, if the delta string is +// malformed or intended for use with a source file other than zSrc, +// then this routine returns -1. +// +// Refer to the delta_create() documentation above for a description +// of the delta file format. +func rbuDeltaApply(tls *libc.TLS, zSrc uintptr, lenSrc int32, zDelta uintptr, lenDelta int32, zOut uintptr) int32 { /* sqlite3.c:200630:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + *(*uintptr)(unsafe.Pointer(bp)) = zDelta + *(*int32)(unsafe.Pointer(bp + 8)) = lenDelta + + var limit uint32 + var total uint32 = uint32(0) + + limit = rbuDeltaGetInt(tls, bp /* &zDelta */, bp+8 /* &lenDelta */) + if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zDelta */))))) != '\n' { + // ERROR: size integer not terminated by "\n" + return -1 + } + *(*uintptr)(unsafe.Pointer(bp /* zDelta */))++ + *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */))-- + for (*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zDelta */)))) != 0) && (*(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */)) > 0) { + var cnt uint32 + var ofst uint32 + cnt = rbuDeltaGetInt(tls, bp /* &zDelta */, bp+8 /* &lenDelta */) + switch int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zDelta */))))) { + case '@': + { + *(*uintptr)(unsafe.Pointer(bp /* zDelta */))++ + *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */))-- + ofst = rbuDeltaGetInt(tls, bp /* &zDelta */, bp+8 /* &lenDelta */) + if (*(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */)) > 0) && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zDelta */))))) != ',') { + // ERROR: copy command not terminated by ',' + return -1 + } + *(*uintptr)(unsafe.Pointer(bp /* zDelta */))++ + *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */))-- + total = total + (cnt) + if total > limit { + // ERROR: copy exceeds output file size + return -1 + } + if (int32(ofst + cnt)) > lenSrc { + // ERROR: copy extends past end of input + return -1 + } + libc.Xmemcpy(tls, zOut, (zSrc + uintptr(ofst)), uint64(cnt)) + zOut += uintptr(cnt) + break + + } + case ':': + { + *(*uintptr)(unsafe.Pointer(bp /* zDelta */))++ + *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */))-- + total = total + (cnt) + if total > limit { + // ERROR: insert command gives an output larger than predicted + return -1 + } + if int32(cnt) > *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */)) { + // ERROR: insert count exceeds size of delta + return -1 + } + libc.Xmemcpy(tls, zOut, *(*uintptr)(unsafe.Pointer(bp /* zDelta */)), uint64(cnt)) + zOut += uintptr(cnt) + *(*uintptr)(unsafe.Pointer(bp /* zDelta */)) += uintptr(cnt) + *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */)) -= int32(cnt) + break + + } + case ';': + { + *(*uintptr)(unsafe.Pointer(bp /* zDelta */))++ + *(*int32)(unsafe.Pointer(bp + 8 /* lenDelta */))-- + *(*int8)(unsafe.Pointer(zOut)) = int8(0) + if total != limit { + // ERROR: generated size does not match predicted size + return -1 + } + return int32(total) + + } + default: + { + // ERROR: unknown delta operator + return -1 + + } + } + } + // ERROR: unterminated delta + return -1 +} + +func rbuDeltaOutputSize(tls *libc.TLS, zDelta uintptr, lenDelta int32) int32 { /* sqlite3.c:200716:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + *(*uintptr)(unsafe.Pointer(bp)) = zDelta + *(*int32)(unsafe.Pointer(bp + 8)) = lenDelta + + var size int32 + size = int32(rbuDeltaGetInt(tls, bp /* &zDelta */, bp+8 /* &lenDelta */)) + if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zDelta */))))) != '\n' { + // ERROR: size integer not terminated by "\n" + return -1 + } + return size +} + +// +// End of code taken from fossil. +// + +// Implementation of SQL scalar function rbu_fossil_delta(). +// +// This function applies a fossil delta patch to a blob. Exactly two +// arguments must be passed to this function. The first is the blob to +// patch and the second the patch to apply. If no error occurs, this +// function returns the patched blob. +func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:200738:13: */ + var aDelta uintptr + var nDelta int32 + var aOrig uintptr + var nOrig int32 + var nOut int32 + var nOut2 int32 + var aOut uintptr + + nOrig = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) + aOrig = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) + nDelta = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + aDelta = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) + + // Figure out the size of the output + nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) + if nOut < 0 { + Xsqlite3_result_error(tls, context, ts+26126 /* "corrupt fossil d..." */, -1) + return + } + + aOut = Xsqlite3_malloc(tls, (nOut + 1)) + if aOut == uintptr(0) { + Xsqlite3_result_error_nomem(tls, context) + } else { + nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) + if nOut2 != nOut { + Xsqlite3_free(tls, aOut) + Xsqlite3_result_error(tls, context, ts+26126 /* "corrupt fossil d..." */, -1) + } else { + Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + } +} + +// Prepare the SQL statement in buffer zSql against database handle db. +// If successful, set *ppStmt to point to the new statement and return +// SQLITE_OK. +// +// Otherwise, if an error does occur, set *ppStmt to NULL and return +// an SQLite error code. Additionally, set output variable *pzErrmsg to +// point to a buffer containing an error message. It is the responsibility +// of the caller to (eventually) free this buffer using sqlite3_free(). +func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) int32 { /* sqlite3.c:200791:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return rc +} + +// Reset the SQL statement passed as the first argument. Return a copy +// of the value returned by sqlite3_reset(). +// +// If an error has occurred, then set *pzErrmsg to point to a buffer +// containing an error message. It is the responsibility of the caller +// to eventually free this buffer using sqlite3_free(). +func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 { /* sqlite3.c:200813:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = Xsqlite3_reset(tls, pStmt) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + } + return rc +} + +// Unless it is NULL, argument zSql points to a buffer allocated using +// sqlite3_malloc containing an SQL statement. This function prepares the SQL +// statement against database db and frees the buffer. If statement +// compilation is successful, *ppStmt is set to point to the new statement +// handle and SQLITE_OK is returned. +// +// Otherwise, if an error occurs, *ppStmt is set to NULL and an error code +// returned. In this case, *pzErrmsg may also be set to point to an error +// message. It is the responsibility of the caller to free this error message +// buffer using sqlite3_free(). +// +// If argument zSql is NULL, this function assumes that an OOM has occurred. +// In this case SQLITE_NOMEM is returned and *ppStmt set to NULL. +func prepareFreeAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) int32 { /* sqlite3.c:200836:12: */ + var rc int32 + + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } else { + rc = prepareAndCollectError(tls, db, ppStmt, pzErrmsg, zSql) + Xsqlite3_free(tls, zSql) + } + return rc +} + +// Free the RbuObjIter.azTblCol[] and RbuObjIter.abTblPk[] arrays allocated +// by an earlier call to rbuObjIterCacheTableInfo(). +func rbuObjIterFreeCols(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:200858:13: */ + var i int32 + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(i)*8))) + } + Xsqlite3_free(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol) + (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol = 0 + (*RbuObjIter)(unsafe.Pointer(pIter)).FeType = 0 // Invalid value +} + +// Finalize all statements and free all allocations that are specific to +// the current object (table/index pair). +func rbuObjIterClearStatements(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:200878:13: */ + var pUp uintptr + + Xsqlite3_finalize(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect) + Xsqlite3_finalize(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpInsert) + Xsqlite3_finalize(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpDelete) + Xsqlite3_finalize(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpTmpInsert) + pUp = (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate + for pUp != 0 { + var pTmp uintptr = (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate) + Xsqlite3_free(tls, pUp) + pUp = pTmp + } + Xsqlite3_free(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol) + Xsqlite3_free(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdxSql) + + (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FpInsert = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FpDelete = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FpTmpInsert = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = 0 + (*RbuObjIter)(unsafe.Pointer(pIter)).FnIdxCol = 0 + (*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol = uintptr(0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdxSql = uintptr(0) +} + +// Clean up any resources allocated as part of the iterator object passed +// as the only argument. +func rbuObjIterFinalize(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:200910:13: */ + rbuObjIterClearStatements(tls, pIter) + Xsqlite3_finalize(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpTblIter) + Xsqlite3_finalize(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter) + rbuObjIterFreeCols(tls, pIter) + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(RbuObjIter{}))) +} + +// Advance the iterator to the next position. +// +// If no error occurs, SQLITE_OK is returned and the iterator is left +// pointing to the next entry. Otherwise, an error code and message is +// left in the RBU handle passed as the first argument. A copy of the +// error code is returned. +func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:200926:12: */ + var rc int32 = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + if rc == SQLITE_OK { + + // Free any SQLite statements used while processing the previous object + rbuObjIterClearStatements(tls, pIter) + if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + + ts+26147 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + + if rc == SQLITE_OK { + if (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { + rbuObjIterFreeCols(tls, pIter) + (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 0 + rc = Xsqlite3_step(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpTblIter) + if rc != SQLITE_ROW { + rc = resetAndCollectError(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpTblIter, (p + 64 /* &.zErrmsg */)) + (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl = uintptr(0) + } else { + (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl = Xsqlite3_column_text(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpTblIter, 0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl = Xsqlite3_column_text(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpTblIter, 1) + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl != 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { + rc = SQLITE_OK + } else { + rc = SQLITE_NOMEM + } + } + } else { + if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + var pIdx uintptr = (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter + rc = Xsqlite3_bind_text(tls, pIdx, 1, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, -1, uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter) + if rc != SQLITE_ROW { + rc = resetAndCollectError(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, (p + 64 /* &.zErrmsg */)) + (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 + (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx = uintptr(0) + } else { + (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx = Xsqlite3_column_text(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, 0) + (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum = Xsqlite3_column_int(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, 1) + (*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique = Xsqlite3_column_int(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpIdxIter, 2) + if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx != 0 { + rc = SQLITE_OK + } else { + rc = SQLITE_NOMEM + } + } + } + } + } + } + + if rc != SQLITE_OK { + rbuObjIterFinalize(tls, pIter) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + return rc +} + +// The implementation of the rbu_target_name() SQL function. This function +// accepts one or two arguments. The first argument is the name of a table - +// the name of a table in the RBU database. The second, if it is present, is 1 +// for a view or 0 for a table. +// +// For a non-vacuum RBU handle, if the table name matches the pattern: +// +// data[0-9]_ +// +// where is any sequence of 1 or more characters, is returned. +// Otherwise, if the only argument does not match the above pattern, an SQL +// NULL is returned. +// +// "data_t1" -> "t1" +// "data0123_t2" -> "t2" +// "dataAB_t3" -> NULL +// +// For an rbu vacuum handle, a copy of the first argument is returned if +// the second argument is either missing or 0 (not a view). +func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* sqlite3.c:201006:13: */ + var p uintptr = Xsqlite3_user_data(tls, pCtx) + var zIn uintptr + + zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) + if zIn != 0 { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + + if (argc == 1) || (0 == Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) { + Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) + } + } else { + if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23317 /* "data" */, zIn, uint64(4)) == 0) { + var i int32 + for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { + } + if (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == '_') && (*(*int8)(unsafe.Pointer(zIn + uintptr((i + 1)))) != 0) { + Xsqlite3_result_text(tls, pCtx, (zIn + uintptr((i + 1))), -1, uintptr(0)) + } + } + } + } +} + +// Initialize the iterator structure passed as the second argument. +// +// If no error occurs, SQLITE_OK is returned and the iterator is left +// pointing to the first entry. Otherwise, an error code and message is +// left in the RBU handle passed as the first argument. A copy of the +// error code is returned. +func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:201042:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(RbuObjIter{}))) + + rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, + + ts+26318 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return ts + 26468 /* "AND rootpage!=0 ..." */ + } + return ts + 756 /* "" */ + }()))) + + if rc == SQLITE_OK { + rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 8 /* &.pIdxIter */), (p + 64 /* &.zErrmsg */), + + ts+26509 /* "SELECT name, roo..." */) + } + + (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + return rbuObjIterNext(tls, p, pIter) +} + +// This is a wrapper around "sqlite3_mprintf(zFmt, ...)". If an OOM occurs, +// an error code is stored in the RBU handle passed as the first argument. +// +// If an error has already occurred (p->rc is already set to something other +// than SQLITE_OK), then this function returns NULL without modifying the +// stored error code. In this case it still calls sqlite3_free() on any +// printf() parameters associated with %z conversions. +func rbuMPrintf(tls *libc.TLS, p uintptr, zFmt uintptr, va uintptr) uintptr { /* sqlite3.c:201077:13: */ + var zSql uintptr = uintptr(0) + var ap Va_list + _ = ap + ap = va + zSql = Xsqlite3_vmprintf(tls, zFmt, ap) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if zSql == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } + } else { + Xsqlite3_free(tls, zSql) + zSql = uintptr(0) + } + _ = ap + return zSql +} + +// Argument zFmt is a sqlite3_mprintf() style format string. The trailing +// arguments are the usual subsitution values. This function performs +// the printf() style substitutions and executes the result as an SQL +// statement on the RBU handles database. +// +// If an error occurs, an error code and error message is stored in the +// RBU handle. If an error has already occurred when this function is +// called, it is a no-op. +func rbuMPrintfExec(tls *libc.TLS, p uintptr, db uintptr, zFmt uintptr, va uintptr) int32 { /* sqlite3.c:201102:12: */ + var ap Va_list + _ = ap + var zSql uintptr + ap = va + zSql = Xsqlite3_vmprintf(tls, zFmt, ap) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if zSql == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } else { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + } + Xsqlite3_free(tls, zSql) + _ = ap + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// Attempt to allocate and return a pointer to a zeroed block of nByte +// bytes. +// +// If an error (i.e. an OOM condition) occurs, return NULL and leave an +// error code in the rbu handle passed as the first argument. Or, if an +// error has already occurred when this function is called, return NULL +// immediately without attempting the allocation or modifying the stored +// error code. +func rbuMalloc(tls *libc.TLS, p uintptr, nByte Sqlite3_int64) uintptr { /* sqlite3.c:201129:13: */ + var pRet uintptr = uintptr(0) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pRet == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pRet, 0, uint64(nByte)) + } + } + return pRet +} + +// Allocate and zero the pIter->azTblCol[] and abTblPk[] arrays so that +// there is room for at least nCol elements. If an OOM occurs, store an +// error code in the RBU handle passed as the first argument. +func rbuAllocateIterArrays(tls *libc.TLS, p uintptr, pIter uintptr, nCol int32) { /* sqlite3.c:201149:13: */ + var nByte Sqlite3_int64 = (Sqlite3_int64((((uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) + uint64(unsafe.Sizeof(int32(0)))) + (uint64(3) * uint64(unsafe.Sizeof(U8(0))))) * uint64(nCol))) + var azNew uintptr + + azNew = rbuMalloc(tls, p, nByte) + if azNew != 0 { + (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol = azNew + (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType = (azNew + uintptr(nCol)*8) + (*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder = ((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(nCol)*8) + (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk = ((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(nCol)*4) + (*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull = ((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(nCol)) + (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed = ((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(nCol)) + } +} + +// The first argument must be a nul-terminated string. This function +// returns a copy of the string in memory obtained from sqlite3_malloc(). +// It is the responsibility of the caller to eventually free this memory +// using sqlite3_free(). +// +// If an OOM condition is encountered when attempting to allocate memory, +// output variable (*pRc) is set to SQLITE_NOMEM before returning. Otherwise, +// if the allocation succeeds, (*pRc) is left unchanged. +func rbuStrndup(tls *libc.TLS, zStr uintptr, pRc uintptr) uintptr { /* sqlite3.c:201174:13: */ + var zRet uintptr = uintptr(0) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + if zStr != 0 { + var nCopy Size_t = (libc.Xstrlen(tls, zStr) + uint64(1)) + zRet = Xsqlite3_malloc64(tls, uint64(nCopy)) + if zRet != 0 { + libc.Xmemcpy(tls, zRet, zStr, nCopy) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } + + return zRet +} + +// Finalize the statement passed as the second argument. +// +// If the sqlite3_finalize() call indicates that an error occurs, and the +// rbu handle error code is not already set, set the error code and error +// message accordingly. +func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = Xsqlite3_db_handle(tls, pStmt) + var rc int32 = Xsqlite3_finalize(tls, pStmt) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + } +} + +// Determine the type of a table. +// +// peType is of type (int*), a pointer to an output parameter of type +// (int). This call sets the output parameter as follows, depending +// on the type of the table specified by parameters dbName and zTbl. +// +// RBU_PK_NOTABLE: No such table. +// RBU_PK_NONE: Table has an implicit rowid. +// RBU_PK_IPK: Table has an explicit IPK column. +// RBU_PK_EXTERNAL: Table has an external PK index. +// RBU_PK_WITHOUT_ROWID: Table is WITHOUT ROWID. +// RBU_PK_VTAB: Table is a virtual table. +// +// Argument *piPk is also of type (int*), and also points to an output +// parameter. Unless the table has an external primary key index +// (i.e. unless *peType is set to 3), then *piPk is set to zero. Or, +// if the table does have an external primary key index, then *piPk +// is set to the root page number of the primary key index before +// returning. +// +// ALGORITHM: +// +// if( no entry exists in sqlite_schema ){ +// return RBU_PK_NOTABLE +// }else if( sql for the entry starts with "CREATE VIRTUAL" ){ +// return RBU_PK_VTAB +// }else if( "PRAGMA index_list()" for the table contains a "pk" index ){ +// if( the index that is the pk exists in sqlite_schema ){ +// *piPK = rootpage of that index. +// return RBU_PK_EXTERNAL +// }else{ +// return RBU_PK_WITHOUT_ROWID +// } +// }else if( "PRAGMA table_info()" lists one or more "pk" columns ){ +// return RBU_PK_IPK +// }else{ +// return RBU_PK_NONE +// } +func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum uintptr, piPk uintptr) { /* sqlite3.c:201247:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + // 0) SELECT count(*) FROM sqlite_schema where name=%Q AND IsVirtual(%Q) + // 1) PRAGMA index_list = ? + // 2) SELECT count(*) FROM sqlite_schema where name=%Q + // 3) PRAGMA table_info = ? + // var aStmt [4]uintptr at bp+32, 32 + + var zOrig uintptr + var zIdx uintptr + var i uint32 + *(*[4]uintptr)(unsafe.Pointer(bp + 32 /* aStmt */)) = [4]uintptr{uintptr(0), uintptr(0), uintptr(0), uintptr(0)} + + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE + *(*int32)(unsafe.Pointer(piPk)) = 0 + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, + + ts+26634 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { + goto __1 + } + // Either an error, or no such table. + goto rbuTableType_end +__1: + ; + if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 0) != 0) { + goto __2 + } + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_VTAB // virtual table + goto rbuTableType_end +__2: + ; + *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26715 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { + goto __3 + } + goto rbuTableType_end +__3: + ; +__4: + if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 1*8))) == SQLITE_ROW) { + goto __5 + } + zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 1*8)), 3) + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 1*8)), 1) + if !(((zOrig != 0) && (zIdx != 0)) && (int32(*(*U8)(unsafe.Pointer(zOrig))) == 'p')) { + goto __6 + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, + ts+26736 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + goto __7 + } + if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 2*8))) == SQLITE_ROW) { + goto __8 + } + *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 2*8)), 0) + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_EXTERNAL + goto __9 +__8: + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_WITHOUT_ROWID +__9: + ; +__7: + ; + goto rbuTableType_end +__6: + ; + goto __4 +__5: + ; + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26787 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + goto __10 + } +__11: + if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 3*8))) == SQLITE_ROW) { + goto __12 + } + if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 3*8)), 5) > 0) { + goto __13 + } + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_IPK // explicit IPK column + goto rbuTableType_end +__13: + ; + goto __11 +__12: + ; + *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NONE +__10: + ; + +rbuTableType_end: + i = uint32(0) +__14: + if !(uint64(i) < (uint64(unsafe.Sizeof([4]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))) { + goto __16 + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + uintptr(i)*8))) + goto __15 +__15: + i++ + goto __14 + goto __16 +__16: +} + +// This is a helper function for rbuObjIterCacheTableInfo(). It populates +// the pIter->abIndexed[] array. +func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:201331:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)) = uintptr(0) + var bIndex int32 = 0 + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + libc.Xmemcpy(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26808 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + } + + (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)))) { + var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)), 1) + var bPartial int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)), 4) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)) = uintptr(0) + if zIdx == uintptr(0) { + break + } + if bPartial != 0 { + libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+24 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26836 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)))) { + var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)), 1) + if iCid >= 0 { + *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(iCid))) = U8(1) + } + if iCid == -2 { + libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) + } + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */))) + bIndex = 1 + (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex++ + } + + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { + // "PRAGMA index_list" includes the main PK b-tree + (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex-- + } + + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */))) + if bIndex == 0 { + (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed = uintptr(0) + } +} + +// If they are not already populated, populate the pIter->azTblCol[], +// pIter->abTblPk[], pIter->nTblCol and pIter->bRowid variables according to +// the table (not index) that the iterator currently points to. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. If +// an error does occur, an error code and error message are also left in +// the RBU handle. +func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:201385:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + if (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) = uintptr(0) + var nCol int32 = 0 + var i int32 // for() loop iterator variable + var bRbuRowid int32 = 0 // If input table has column "rbu_rowid" + var iOrder int32 = 0 + *(*int32)(unsafe.Pointer(bp + 56 /* iTnum */)) = 0 + + // Figure out the type of table this step will deal with. + + rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+56 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17858 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + } + if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum = *(*int32)(unsafe.Pointer(bp + 56 /* iTnum */)) + } + + // Populate the azTblCol[] and nTblCol variables based on the columns + // of the input table. Ignore any input table columns that begin with + // "rbu_". + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26865 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) + rbuAllocateIterArrays(tls, p, pIter, nCol) + } + for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { + var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), i) + if Xsqlite3_strnicmp(tls, ts+26884 /* "rbu_" */, zName, 4) != 0 { + var zCopy uintptr = rbuStrndup(tls, zName, (p + 56 /* &.rc */)) + *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*8)) = zCopy + } else if 0 == Xsqlite3_stricmp(tls, ts+26889 /* "rbu_rowid" */, zName) { + bRbuRowid = 1 + } + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) = uintptr(0) + + if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && + ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0)) && + (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, + ts+26899 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + func() uintptr { + if bRbuRowid != 0 { + return ts + 26928 /* "may not have" */ + } + return ts + 26941 /* "requires" */ + }())) + } + + // Check that all non-HIDDEN columns in the destination table are also + // present in the input table. Populate the abTblPk[], azTblType[] and + // aiTblOrder[] arrays at the same time. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26950 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + } + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) { + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } // An OOM - finalize() below returns S_NOMEM + for i = iOrder; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + if 0 == libc.Xstrcmp(tls, zName, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8))) { + break + } + } + if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26972, /* "column missing f..." */ + libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) + } else { + var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 5) + var bNotNull int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 3) + var zType uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 2) + + if i != iOrder { + { + var t int32 = *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4)) + *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4)) = *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(iOrder)*4)) + *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(iOrder)*4)) = t + } + + { + var t uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iOrder)*8)) + *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iOrder)*8)) = t + } + + } + + *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iOrder)*8)) = rbuStrndup(tls, zType, (p + 56 /* &.rc */)) + + *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iOrder))) = U8(iPk) + *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iOrder))) = (U8(libc.Bool32((U8(bNotNull) != 0) || (iPk != 0)))) + iOrder++ + } + } + + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) + rbuObjIterCacheIndexedCols(tls, p, pIter) + + } + + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// This function constructs and returns a pointer to a nul-terminated +// string containing some SQL clause or list based on one or more of the +// column names currently stored in the pIter->azTblCol[] array. +func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:201495:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zList uintptr = uintptr(0) + var zSep uintptr = ts + 756 /* "" */ + var i int32 + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zList = rbuMPrintf(tls, p, ts+26999 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13325 /* ", " */ + } + return zList +} + +// Return a comma separated list of the quoted PRIMARY KEY column names, +// in order, for the current table. Before each column name, add the text +// zPre. After each column name, add the zPost text. Use zSeparator as +// the separator text (usually ", "). +func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, zSeparator uintptr, zPost uintptr) uintptr { /* sqlite3.c:201516:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var iPk int32 = 1 + var zRet uintptr = uintptr(0) + var zSep uintptr = ts + 756 /* "" */ + for 1 != 0 { + var i int32 + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { + var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zRet = rbuMPrintf(tls, p, ts+27008 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zSep = zSeparator + break + } + } + if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { + break + } + iPk++ + } + return zRet +} + +// This function is called as part of restarting an RBU vacuum within +// stage 1 of the process (while the *-oal file is being built) while +// updating a table (not an index). The table may be a rowid table or +// a WITHOUT ROWID table. It queries the target database to find the +// largest key that has already been written to the target table and +// constructs a WHERE clause that can be used to extract the remaining +// rows from the source table. For a rowid table, the WHERE clause +// is of the form: +// +// "WHERE _rowid_ > ?" +// +// and for WITHOUT ROWID tables: +// +// "WHERE (key1, key2) > (?, ?)" +// +// Instead of "?" placeholders, the actual WHERE clauses created by +// this function contain literal SQL values. +func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, zWrite uintptr) uintptr { /* sqlite3.c:201561:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)) = uintptr(0) + var zRet uintptr = uintptr(0) + if bRowid != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, + ts+27021 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { + var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) + zRet = rbuMPrintf(tls, p, ts+27053 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) + } else { + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13325 /* ", " */, ts+27076 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27082 /* "quote(" */, ts+27089 /* "||','||" */, ts+4067 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13325 /* ", " */, ts+756 /* "" */) + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, + ts+27097, /* "SELECT %s FROM \"..." */ + libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { + var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) + zRet = rbuMPrintf(tls, p, ts+27139 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) + } + + Xsqlite3_free(tls, zOrder) + Xsqlite3_free(tls, zSelect) + Xsqlite3_free(tls, zList) + } + return zRet +} + +// This function is called as part of restating an RBU vacuum when the +// current operation is writing content to an index. If possible, it +// queries the target index b-tree for the largest key already written to +// it, then composes and returns an expression that can be used in a WHERE +// clause to select the remaining required rows from the source table. +// It is only possible to return such an expression if: +// +// * The index contains no DESC columns, and +// * The last key written to the index before the operation was +// suspended does not contain any NULL values. +// +// The expression is of the form: +// +// (index-field1, index-field2, ...) > (?, ?, ...) +// +// except that the "?" placeholders are replaced with literal values. +// +// If the expression cannot be created, NULL is returned. In this case, +// the caller has to use an OFFSET clause to extract only the required +// rows from the sourct table, just as it does for an RBU update operation. +func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:201628:6: */ + bp := tls.Alloc(192) + defer tls.Free(192) + + var zOrder uintptr + var zLhs uintptr + var zSelect uintptr + var zVector uintptr + var zRet uintptr + var bFailed int32 + var zSep uintptr + var iCol int32 + // var pXInfo uintptr at bp+176, 8 + + var i int32 + var iCid int32 + var zCollate uintptr + var zCol uintptr + var zQuoted uintptr + // var pSel uintptr at bp+184, 8 + zOrder = uintptr(0) + zLhs = uintptr(0) + zSelect = uintptr(0) + zVector = uintptr(0) + zRet = uintptr(0) + bFailed = 0 + zSep = ts + 756 /* "" */ + iCol = 0 + *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26836 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) +__1: + if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { + goto __2 + } + iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) + zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) + if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) != 0) { + goto __3 + } + bFailed = 1 + goto __2 +__3: + ; + + if !(iCid < 0) { + goto __4 + } + if !((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) { + goto __6 + } + i = 0 +__8: + if !(int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0) { + goto __10 + } + goto __9 +__9: + i++ + goto __8 + goto __10 +__10: + ; + + zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + goto __7 +__6: + zCol = ts + 27159 /* "_rowid_" */ +__7: + ; + goto __5 +__4: + zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) +__5: + ; + + zLhs = rbuMPrintf(tls, p, ts+27167, /* "%z%s \"%w\" COLLAT..." */ + libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) + zOrder = rbuMPrintf(tls, p, ts+27188, /* "%z%s \"rbu_imp_%d..." */ + libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = rbuMPrintf(tls, p, ts+27224, /* "%z%s quote(\"rbu_..." */ + libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) + zSep = ts + 13325 /* ", " */ + iCol++ + goto __1 +__2: + ; + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) + if !(bFailed != 0) { + goto __11 + } + goto index_start_out +__11: + ; + + if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + goto __12 + } + *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)) = uintptr(0) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+184 /* &pSel */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+27251, /* "SELECT %s FROM \"..." */ + libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))))) { + goto __13 + } + zSep = ts + 756 /* "" */ + iCol = 0 +__14: + if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { + goto __16 + } + zQuoted = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)), iCol) + if !(zQuoted == uintptr(0)) { + goto __17 + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + goto __18 +__17: + if !(int32(*(*int8)(unsafe.Pointer(zQuoted))) == 'N') { + goto __19 + } + bFailed = 1 + goto __16 +__19: + ; +__18: + ; + zVector = rbuMPrintf(tls, p, ts+27299 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13325 /* ", " */ + goto __15 +__15: + iCol++ + goto __14 + goto __16 +__16: + ; + + if !(!(bFailed != 0)) { + goto __20 + } + zRet = rbuMPrintf(tls, p, ts+27306 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) +__20: + ; +__13: + ; + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))) +__12: + ; + +index_start_out: + Xsqlite3_free(tls, zOrder) + Xsqlite3_free(tls, zSelect) + Xsqlite3_free(tls, zVector) + Xsqlite3_free(tls, zLhs) + return zRet +} + +// This function is used to create a SELECT list (the list of SQL +// expressions that follows a SELECT keyword) for a SELECT statement +// used to read from an data_xxx or rbu_tmp_xxx table while updating the +// index object currently indicated by the iterator object passed as the +// second argument. A "PRAGMA index_xinfo = " statement is used +// to obtain the required information. +// +// If the index is of the following form: +// +// CREATE INDEX i1 ON t1(c, b COLLATE nocase); +// +// and "t1" is a table with an explicit INTEGER PRIMARY KEY column +// "ipk", the returned string is: +// +// "`c` COLLATE 'BINARY', `b` COLLATE 'NOCASE', `ipk` COLLATE 'BINARY'" +// +// As well as the returned string, three other malloc'd strings are +// returned via output parameters. As follows: +// +// pzImposterCols: ... +// pzImposterPk: ... +// pzWhere: ... +func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterCols uintptr, pzImposterPk uintptr, pzWhere uintptr, pnBind uintptr) uintptr { /* sqlite3.c:201743:13: */ + bp := tls.Alloc(208) + defer tls.Free(208) + + var rc int32 = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc // Error code + var rc2 int32 // sqlite3_finalize() return code + var zRet uintptr = uintptr(0) // String to return + var zImpCols uintptr = uintptr(0) // String to return via *pzImposterCols + var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK + var zWhere uintptr = uintptr(0) // String to return via *pzWhere + var nBind int32 = 0 // Value to return via *pnBind + var zCom uintptr = ts + 756 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 756 /* "" */ // Set to " AND " later on + *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? + + if rc == SQLITE_OK { + + rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26836 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + } + + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { + var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 1) + var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 3) + var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 4) + var zCol uintptr = uintptr(0) + var zType uintptr + + if iCid == -2 { + var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) + zRet = Xsqlite3_mprintf(tls, ts+27318 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FzSpan, zCollate)) + zType = ts + 756 /* "" */ + } else { + if iCid < 0 { + // An integer primary key. If the table has an explicit IPK, use + // its name. Otherwise, use "rbu_rowid". + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK { + var i int32 + for i = 0; int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0; i++ { + } + + zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + zCol = ts + 27159 /* "_rowid_" */ + } else { + zCol = ts + 26889 /* "rbu_rowid" */ + } + zType = ts + 11385 /* "INTEGER" */ + } else { + zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) + zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) + } + zRet = Xsqlite3_mprintf(tls, ts+27340 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + } + + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { + var zOrder uintptr = func() uintptr { + if bDesc != 0 { + return ts + 27076 /* " DESC" */ + } + return ts + 756 /* "" */ + }() + zImpPK = Xsqlite3_mprintf(tls, ts+27360, /* "%z%s\"rbu_imp_%d%..." */ + libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) + } + zImpCols = Xsqlite3_mprintf(tls, ts+27381, /* "%z%s\"rbu_imp_%d%..." */ + libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zWhere = Xsqlite3_mprintf(tls, + ts+27414 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { + rc = SQLITE_NOMEM + } + zCom = ts + 13325 /* ", " */ + zAnd = ts + 19878 /* " AND " */ + nBind++ + } + + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */))) + if rc == SQLITE_OK { + rc = rc2 + } + + if rc != SQLITE_OK { + Xsqlite3_free(tls, zRet) + Xsqlite3_free(tls, zImpCols) + Xsqlite3_free(tls, zImpPK) + Xsqlite3_free(tls, zWhere) + zRet = uintptr(0) + zImpCols = uintptr(0) + zImpPK = uintptr(0) + zWhere = uintptr(0) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + + *(*uintptr)(unsafe.Pointer(pzImposterCols)) = zImpCols + *(*uintptr)(unsafe.Pointer(pzImposterPk)) = zImpPK + *(*uintptr)(unsafe.Pointer(pzWhere)) = zWhere + *(*int32)(unsafe.Pointer(pnBind)) = nBind + return zRet +} + +// Assuming the current table columns are "a", "b" and "c", and the zObj +// paramter is passed "old", return a string of the form: +// +// "old.a, old.b, old.b" +// +// With the column names escaped. +// +// For tables with implicit rowids - RBU_PK_EXTERNAL and RBU_PK_NONE, append +// the text ", old._rowid_" to the returned value. +func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) uintptr { /* sqlite3.c:201855:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var zList uintptr = uintptr(0) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { + var zS uintptr = ts + 756 /* "" */ + var i int32 + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { + var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zList = Xsqlite3_mprintf(tls, ts+27438 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + } else { + zList = Xsqlite3_mprintf(tls, ts+27450 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + } + zS = ts + 13325 /* ", " */ + if zList == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + break + } + } + + // For a table with implicit rowids, append "old._rowid_" to the list. + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { + zList = rbuMPrintf(tls, p, ts+27459 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + } + } + return zList +} + +// Return an expression that can be used in a WHERE clause to match the +// primary key of the current table. For example, if the table is: +// +// CREATE TABLE t1(a, b, c, PRIMARY KEY(b, c)); +// +// Return the string: +// +// "b = ?1 AND c = ?2" +func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:201896:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var zList uintptr = uintptr(0) + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { + zList = rbuMPrintf(tls, p, ts+27474 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { + var zSep uintptr = ts + 756 /* "" */ + var i int32 + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { + zList = rbuMPrintf(tls, p, ts+27488 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 19878 /* " AND " */ + } + } + zList = rbuMPrintf(tls, p, + ts+27500 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + + } else { + var zSep uintptr = ts + 756 /* "" */ + var i int32 + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { + var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) + zList = rbuMPrintf(tls, p, ts+27550 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 19878 /* " AND " */ + } + } + } + return zList +} + +// The SELECT statement iterating through the keys for the current object +// (p->objiter.pSelect) currently points to a valid row. However, there +// is something wrong with the rbu_control value in the rbu_control value +// stored in the (p->nCol+1)'th column. Set the error code and error message +// of the RBU handle to something reflecting this. +func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27563 /* "invalid rbu_cont..." */, 0) +} + +// Return a nul-terminated string containing the comma separated list of +// assignments that should be included following the "SET" keyword of +// an UPDATE statement used to update the table object that the iterator +// passed as the second argument currently points to if the rbu_control +// column of the data_xxx table entry is set to zMask. +// +// The memory for the returned string is obtained from sqlite3_malloc(). +// It is the responsibility of the caller to eventually free it using +// sqlite3_free(). +// +// If an OOM error is encountered when allocating space for the new +// string, an error code is left in the rbu handle passed as the first +// argument and NULL is returned. Or, if an error has already occurred +// when this function is called, NULL is returned immediately, without +// attempting the allocation or modifying the stored error code. +func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr) uintptr { /* sqlite3.c:201960:13: */ + bp := tls.Alloc(112) + defer tls.Free(112) + + var zList uintptr = uintptr(0) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var i int32 + + if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { + rbuBadControlError(tls, p) + } else { + var zSep uintptr = ts + 756 /* "" */ + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { + var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) + if int32(c) == 'x' { + zList = rbuMPrintf(tls, p, ts+27550, /* "%z%s\"%w\"=?%d" */ + libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) + zSep = ts + 13325 /* ", " */ + } else if int32(c) == 'd' { + zList = rbuMPrintf(tls, p, ts+27589, /* "%z%s\"%w\"=rbu_del..." */ + libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) + zSep = ts + 13325 /* ", " */ + } else if int32(c) == 'f' { + zList = rbuMPrintf(tls, p, ts+27619, /* "%z%s\"%w\"=rbu_fos..." */ + libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) + zSep = ts + 13325 /* ", " */ + } + } + } + } + return zList +} + +// Return a nul-terminated string consisting of nByte comma separated +// "?" expressions. For example, if nByte is 3, return a pointer to +// a buffer containing the string "?,?,?". +// +// The memory for the returned string is obtained from sqlite3_malloc(). +// It is the responsibility of the caller to eventually free it using +// sqlite3_free(). +// +// If an OOM error is encountered when allocating space for the new +// string, an error code is left in the rbu handle passed as the first +// argument and NULL is returned. Or, if an error has already occurred +// when this function is called, NULL is returned immediately, without +// attempting the allocation or modifying the stored error code. +func rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) uintptr { /* sqlite3.c:202014:13: */ + var zRet uintptr = uintptr(0) + var nByte Sqlite3_int64 = ((int64(2) * Sqlite3_int64(nBind)) + int64(1)) + + zRet = rbuMalloc(tls, p, nByte) + if zRet != 0 { + var i int32 + for i = 0; i < nBind; i++ { + *(*int8)(unsafe.Pointer(zRet + uintptr((i * 2)))) = int8('?') + *(*int8)(unsafe.Pointer(zRet + uintptr(((i * 2) + 1)))) = func() int8 { + if (i + 1) == nBind { + return int8(0) + } + return int8(',') + }() + } + } + return zRet +} + +// The iterator currently points to a table (not index) of type +// RBU_PK_WITHOUT_ROWID. This function creates the PRIMARY KEY +// declaration for the corresponding imposter table. For example, +// if the iterator points to a table created as: +// +// CREATE TABLE t1(a, b, c, PRIMARY KEY(b, a DESC)) WITHOUT ROWID +// +// this function returns: +// +// PRIMARY KEY("b", "a" DESC) +func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:202041:13: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var z uintptr = uintptr(0) + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var zSep uintptr = ts + 27656 /* "PRIMARY KEY(" */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26808 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { + var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14668 /* "pk" */) == 0) { + var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) + if zIdx != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26836 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + } + break + } + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */))) + + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)))) { + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 5) != 0 { + // int iCid = sqlite3_column_int(pXInfo, 0); + var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 2) + var zDesc uintptr + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 3) != 0 { + zDesc = ts + 27076 /* " DESC" */ + } else { + zDesc = ts + 756 /* "" */ + } + z = rbuMPrintf(tls, p, ts+27669 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13325 /* ", " */ + } + } + z = rbuMPrintf(tls, p, ts+27680 /* "%z)" */, libc.VaList(bp+48, z)) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */))) + } + return z +} + +// This function creates the second imposter table used when writing to +// a table b-tree where the table has an external primary key. If the +// iterator passed as the second argument does not currently point to +// a table (not index) with an external primary key, this function is a +// no-op. +// +// Assuming the iterator does point to a table with an external PK, this +// function creates a WITHOUT ROWID imposter table named "rbu_imposter2" +// used to access that PK index. For example, if the target table is +// declared as follows: +// +// CREATE TABLE t1(a, b TEXT, c REAL, PRIMARY KEY(b, c)); +// +// then the imposter table schema is: +// +// CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID; +// +func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:202100:13: */ + bp := tls.Alloc(184) + defer tls.Free(184) + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) { + var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiPkTnum // Root page of PK index + *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum + var zIdx uintptr = uintptr(0) // Name of PK index + *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx + var zComma uintptr = ts + 756 /* "" */ + var zCols uintptr = uintptr(0) // Used to build up list of table cols + var zPk uintptr = uintptr(0) // Used to build up table PK declaration + + // Figure out the name of the primary key index for the current table. + // This is needed for the argument to "PRAGMA index_xinfo". Set + // zIdx to point to a nul-terminated string containing this name. + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 64 /* &.zErrmsg */), + ts+27684 /* "SELECT name FROM..." */) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 0) + } + } + if zIdx != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+26836 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) + + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)))) { + var bKey int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 5) + if bKey != 0 { + var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) + var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) + var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) + zCols = rbuMPrintf(tls, p, ts+27734 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) + zPk = rbuMPrintf(tls, p, ts+27756 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + if bDesc != 0 { + return ts + 27076 /* " DESC" */ + } + return ts + 756 /* "" */ + }())) + zComma = ts + 13325 /* ", " */ + } + } + zCols = rbuMPrintf(tls, p, ts+27766 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) + + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + ts+27781, /* "CREATE TABLE rbu..." */ + libc.VaList(bp+120, zCols, zPk)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 0, 0)) + } +} + +// If an error has already occurred when this function is called, it +// immediately returns zero (without doing any work). Or, if an error +// occurs during the execution of this function, it sets the error code +// in the sqlite3rbu object indicated by the first argument and returns +// zero. +// +// The iterator passed as the second argument is guaranteed to point to +// a table (not an index) when this function is called. This function +// attempts to create any imposter table required to write to the main +// table b-tree of the table before returning. Non-zero is returned if +// an imposter table are created, or zero otherwise. +// +// An imposter table is required in all cases except RBU_PK_VTAB. Only +// virtual tables are written to directly. The imposter table has the +// same schema as the actual target table (less any UNIQUE constraints). +// More precisely, the "same schema" means the same columns, types, +// collation sequences. For tables that do not have an external PRIMARY +// KEY, it also means the same PRIMARY KEY declaration. +func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:202174:13: */ + bp := tls.Alloc(200) + defer tls.Free(200) + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { + var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum + var zComma uintptr = ts + 756 /* "" */ + var zSql uintptr = uintptr(0) + var iCol int32 + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 0, 1)) + + for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { + var zPk uintptr = ts + 756 /* "" */ + var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) + *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { + // If the target table column is an "INTEGER PRIMARY KEY", add + // "PRIMARY KEY" to the imposter table column declaration. + zPk = ts + 27843 /* "PRIMARY KEY " */ + } + zSql = rbuMPrintf(tls, p, ts+27856, /* "%z%s\"%w\" %s %sCO..." */ + libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), + func() uintptr { + if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { + return ts + 27883 /* " NOT NULL" */ + } + return ts + 756 /* "" */ + }())) + zComma = ts + 13325 /* ", " */ + } + + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { + var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) + if zPk != 0 { + zSql = rbuMPrintf(tls, p, ts+27893 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + } + } + + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27900, /* "CREATE TABLE \"rb..." */ + libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, + func() uintptr { + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { + return ts + 27932 /* " WITHOUT ROWID" */ + } + return ts + 756 /* "" */ + }())) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 0, 0)) + } +} + +// Prepare a statement used to insert rows into the "rbu_tmp_xxx" table. +// Specifically a statement of the form: +// +// INSERT INTO rbu_tmp_xxx VALUES(?, ?, ? ...); +// +// The number of bound variables is equal to the number of columns in +// the target table, plus one (for the rbu_control column), plus one more +// (for the rbu_rowid column) if the target table is an implicit IPK or +// virtual table. +func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollist uintptr, zRbuRowid uintptr) { /* sqlite3.c:202230:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var bRbuRowid int32 = (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE))) + var zBind uintptr = rbuObjIterGetBindlist(tls, p, (((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + 1) + bRbuRowid)) + if zBind != 0 { + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 152 /* &.pTmpInsert */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, + ts+27947, /* "INSERT INTO %s.'..." */ + libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) + } +} + +func rbuTmpInsertFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* sqlite3.c:202248:13: */ + var p uintptr = Xsqlite3_user_data(tls, pCtx) + var rc int32 = SQLITE_OK + var i int32 + + if Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) != 0 { + *(*I64)(unsafe.Pointer(p + 304 /* &.nPhaseOneStep */)) += (I64((*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex)) + } + + for i = 0; (rc == SQLITE_OK) && (i < nVal); i++ { + rc = Xsqlite3_bind_value(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert, (i + 1), *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert) + rc = Xsqlite3_reset(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpTmpInsert) + } + + if rc != SQLITE_OK { + Xsqlite3_result_error_code(tls, pCtx, rc) + } +} + +func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:202278:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + var zRet uintptr = uintptr(0) + + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), + ts+28004 /* "SELECT trim(sql)..." */) + } + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var rc2 int32 + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 1, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx, -1, uintptr(0)) + if (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))) { + var zSql uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) + if zSql != 0 { + (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdxSql = libc.AssignUintptr(&zSql, rbuStrndup(tls, zSql, bp+8 /* &rc */)) + } + if zSql != 0 { + var nParen int32 = 0 // Number of open parenthesis + var i int32 + var iIdxCol int32 = 0 + var nIdxAlloc int32 = 0 + for i = 0; *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0; i++ { + var c int8 = *(*int8)(unsafe.Pointer(zSql + uintptr(i))) + + // If necessary, grow the pIter->aIdxCol[] array + if iIdxCol == nIdxAlloc { + var aIdxCol uintptr = Xsqlite3_realloc(tls, + (*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol, (int32((uint64(nIdxAlloc + 16)) * uint64(unsafe.Sizeof(RbuSpan{}))))) + if aIdxCol == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_NOMEM + break + } + (*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol = aIdxCol + nIdxAlloc = nIdxAlloc + (16) + } + + if int32(c) == '(' { + if nParen == 0 { + + (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol)).FzSpan = (zSql + uintptr((i + 1))) + } + nParen++ + } else if int32(c) == ')' { + nParen-- + if nParen == 0 { + var nSpan int32 = (int32((int64((zSql + uintptr(i))) - int64((*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iIdxCol)*16)).FzSpan)) / 1)) + (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(libc.PostIncInt32(&iIdxCol, 1))*16)).FnSpan = nSpan + i++ + break + } + } else if (int32(c) == ',') && (nParen == 1) { + var nSpan int32 = (int32((int64((zSql + uintptr(i))) - int64((*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iIdxCol)*16)).FzSpan)) / 1)) + (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(libc.PostIncInt32(&iIdxCol, 1))*16)).FnSpan = nSpan + (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol + uintptr(iIdxCol)*16)).FzSpan = (zSql + uintptr((i + 1))) + } else if ((int32(c) == '"') || (int32(c) == '\'')) || (int32(c) == '`') { + for i++; 1 != 0; i++ { + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == int32(c) { + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr((i + 1))))) != int32(c) { + break + } + i++ + } + } + } else if int32(c) == '[' { + for i++; 1 != 0; i++ { + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == ']' { + break + } + } + } else if (int32(c) == '-') && (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((i + 1))))) == '-') { + for i = (i + 2); (*(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) != '\n'); i++ { + } + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == 0 { + break + } + } else if (int32(c) == '/') && (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((i + 1))))) == '*') { + for i = (i + 2); (*(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0) && ((int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) != '*') || (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((i + 1))))) != '/')); i++ { + } + if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == 0 { + break + } + i++ + } + } + if *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0 { + zRet = rbuStrndup(tls, (zSql + uintptr(i)), bp+8 /* &rc */) + } + (*RbuObjIter)(unsafe.Pointer(pIter)).FnIdxCol = iIdxCol + } + } + + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + return zRet +} + +// Ensure that the SQLite statement handles required to update the +// target database object currently indicated by the iterator passed +// as the second argument are available. +func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32) int32 { /* sqlite3.c:202378:12: */ + bp := tls.Alloc(628) + defer tls.Free(628) + + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect == uintptr(0)) && (rbuObjIterCacheTableInfo(tls, p, pIter) == SQLITE_OK) { + var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum + var zCollist uintptr = uintptr(0) // List of indexed columns + var pz uintptr = (p + 64 /* &.zErrmsg */) + var zIdx uintptr = (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx + var zLimit uintptr = uintptr(0) + + if nOffset != 0 { + zLimit = Xsqlite3_mprintf(tls, ts+28070 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + if !(zLimit != 0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } + } + + if zIdx != 0 { + var zTbl uintptr = (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl + *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)) = uintptr(0) // Columns for imposter table + *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)) = uintptr(0) // Primary key declaration for imposter + *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */)) = uintptr(0) // WHERE clause on PK columns + var zBind uintptr = uintptr(0) + var zPart uintptr = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) = 0 + + zPart = rbuObjIterGetIndexWhere(tls, p, pIter) + zCollist = rbuObjIterGetIndexCols(tls, + p, pIter, bp+600 /* &zImposterCols */, bp+608 /* &zImposterPK */, bp+616 /* &zWhere */, bp+624 /* &nBind */) + zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 624 /* nBind */))) + + // Create the imposter table used to write to this index. + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + ts+28090, /* "CREATE TABLE \"rb..." */ + libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)))) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, 0, 0)) + + // Create the statement to insert index entries + (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28155 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + } + + // And to delete index entries + if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28191 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) + } + + // Create the SELECT statement to read keys in sorted order + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var zSql uintptr + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + var zStart uintptr = uintptr(0) + if nOffset != 0 { + zStart = XrbuVacuumIndexStart(tls, p, pIter) + if zStart != 0 { + Xsqlite3_free(tls, zLimit) + zLimit = uintptr(0) + } + } + + zSql = Xsqlite3_mprintf(tls, + ts+28225, /* "SELECT %s, 0 AS ..." */ + libc.VaList(bp+160, zCollist, + (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + zPart, + func() uintptr { + if zStart != 0 { + return func() uintptr { + if zPart != 0 { + return ts + 28286 /* "AND" */ + } + return ts + 28290 /* "WHERE" */ + }() + } + return ts + 756 /* "" */ + }(), zStart, + zCollist, zLimit)) + Xsqlite3_free(tls, zStart) + } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { + zSql = Xsqlite3_mprintf(tls, + ts+28296, /* "SELECT %s, rbu_c..." */ + libc.VaList(bp+216, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + zPart, zCollist, zLimit)) + } else { + zSql = Xsqlite3_mprintf(tls, + + ts+28357, /* "SELECT %s, rbu_c..." */ + libc.VaList(bp+264, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, + zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + zPart, + func() uintptr { + if zPart != 0 { + return ts + 28286 /* "AND" */ + } + return ts + 28290 /* "WHERE" */ + }(), + zCollist, zLimit)) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, zSql) + } else { + Xsqlite3_free(tls, zSql) + } + } + + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))) + Xsqlite3_free(tls, zBind) + Xsqlite3_free(tls, zPart) + } else { + var bRbuRowid int32 = (libc.Bool32((((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || + ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)) || + (((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))))) + var zTbl uintptr = (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl // Table this step applies to + var zWrite uintptr // Imposter table name + + var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) + var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5468 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5464 /* "new" */) + + zCollist = rbuObjIterGetCollist(tls, p, pIter) + (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + + // Create the imposter table or tables (if required). + rbuCreateImposterTable(tls, p, pIter) + rbuCreateImposterTable2(tls, p, pIter) + zWrite = func() uintptr { + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { + return ts + 756 /* "" */ + } + return ts + 28516 /* "rbu_imp_" */ + }() + + // Create the INSERT statement to write to the target PK b-tree + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), pz, + Xsqlite3_mprintf(tls, + ts+28525, /* "INSERT INTO \"%s%..." */ + libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { + if bRbuRowid != 0 { + return ts + 28561 /* ", _rowid_" */ + } + return ts + 756 /* "" */ + }(), zBindings))) + } + + // Create the DELETE statement to write to the target PK b-tree. + // Because it only performs INSERT operations, this is not required for + // an rbu vacuum handle. + if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), pz, + Xsqlite3_mprintf(tls, + ts+28571 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + } + + if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { + var zRbuRowid uintptr = ts + 756 /* "" */ + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { + zRbuRowid = ts + 28599 /* ", rbu_rowid" */ + } + + // Create the rbu_tmp_xxx table and the triggers to populate it. + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, + + ts+28611 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { + return ts + 28687 /* ", 0 AS rbu_rowid" */ + } + return ts + 756 /* "" */ + }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + + ts+28704, /* "CREATE TEMP TRIG..." */ + libc.VaList(bp+440, zWrite, zTbl, zOldlist, + zWrite, zTbl, zOldlist, + zWrite, zTbl, zNewlist)) + + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + + ts+29003, /* "CREATE TEMP TRIG..." */ + libc.VaList(bp+512, zWrite, zTbl, zNewlist)) + } + + rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) + } + + // Create the SELECT statement to read keys from data_xxx + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var zRbuRowid uintptr = ts + 756 /* "" */ + var zStart uintptr = uintptr(0) + var zOrder uintptr = uintptr(0) + if bRbuRowid != 0 { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + zRbuRowid = ts + 29102 /* ",_rowid_ " */ + } else { + zRbuRowid = ts + 29112 /* ",rbu_rowid" */ + } + } + + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + if nOffset != 0 { + zStart = rbuVacuumTableStart(tls, p, pIter, bRbuRowid, zWrite) + if zStart != 0 { + Xsqlite3_free(tls, zLimit) + zLimit = uintptr(0) + } + } + if bRbuRowid != 0 { + zOrder = rbuMPrintf(tls, p, ts+27159 /* "_rowid_" */, 0) + } else { + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+756 /* "" */, ts+13325 /* ", " */, ts+756 /* "" */) + } + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, + Xsqlite3_mprintf(tls, + ts+29123, /* "SELECT %s,%s rbu..." */ + libc.VaList(bp+536, zCollist, + func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return ts + 29171 /* "0 AS " */ + } + return ts + 756 /* "" */ + }(), + zRbuRowid, + (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + if zStart != 0 { + return zStart + } + return ts + 756 /* "" */ + }(), + func() uintptr { + if zOrder != 0 { + return ts + 18212 /* "ORDER BY" */ + } + return ts + 756 /* "" */ + }(), zOrder, + zLimit))) + } + Xsqlite3_free(tls, zStart) + Xsqlite3_free(tls, zOrder) + } + + Xsqlite3_free(tls, zWhere) + Xsqlite3_free(tls, zOldlist) + Xsqlite3_free(tls, zNewlist) + Xsqlite3_free(tls, zBindings) + } + Xsqlite3_free(tls, zCollist) + Xsqlite3_free(tls, zLimit) + } + + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// Set output variable *ppStmt to point to an UPDATE statement that may +// be used to update the imposter table for the main table b-tree of the +// table object that pIter currently points to, assuming that the +// rbu_control column of the data_xyz table contains zMask. +// +// If the zMask string does not specify any columns to update, then this +// is not an error. Output variable *ppStmt is set to NULL in this case. +func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, ppStmt uintptr) int32 { /* sqlite3.c:202645:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pp uintptr + var pUp uintptr = uintptr(0) + var nUp int32 = 0 + + // In case an error occurs + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + + // Search for an existing statement. If one is found, shift it to the front + // of the LRU queue and return immediately. Otherwise, leave nUp pointing + // to the number of statements currently in the cache and pUp to the + // last object in the list. + for pp = (pIter + 184 /* &.pRbuUpdate */); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + if libc.Xstrcmp(tls, (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FzMask, zMask) == 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext + (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext = (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate + (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate + return SQLITE_OK + } + nUp++ + } + + if nUp >= SQLITE_RBU_UPDATE_CACHESIZE { + for pp = (pIter + 184 /* &.pRbuUpdate */); *(*uintptr)(unsafe.Pointer(pp)) != pUp; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + Xsqlite3_finalize(tls, (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate) + (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate = uintptr(0) + } else { + pUp = rbuMalloc(tls, p, (int64((uint64(unsafe.Sizeof(RbuUpdateStmt{})) + uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) + uint64(1)))) + } + + if pUp != 0 { + var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) + var zSet uintptr = rbuObjIterGetSetlist(tls, p, pIter, zMask) + var zUpdate uintptr = uintptr(0) + + (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FzMask = (pUp + 1*24) + libc.Xmemcpy(tls, (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FzMask, zMask, uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)) + (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpNext = (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate + (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp + + if zSet != 0 { + var zPrefix uintptr = ts + 756 /* "" */ + + if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { + zPrefix = ts + 28516 /* "rbu_imp_" */ + } + zUpdate = Xsqlite3_mprintf(tls, ts+29177, /* "UPDATE \"%s%w\" SE..." */ + libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 8 /* &.pUpdate */), (p + 64 /* &.zErrmsg */), zUpdate) + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*RbuUpdateStmt)(unsafe.Pointer(pUp)).FpUpdate + } + Xsqlite3_free(tls, zWhere) + Xsqlite3_free(tls, zSet) + } + + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc +} + +func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uintptr { /* sqlite3.c:202713:16: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var flags int32 = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_URI) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_open_v2(tls, zName, bp+8 /* &db */, flags, func() uintptr { + if bUseVfs != 0 { + return (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName + } + return uintptr(0) + }()) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) + } + } + return *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) +} + +// Free an RbuState object allocated by rbuLoadState(). +func rbuFreeState(tls *libc.TLS, p uintptr) { /* sqlite3.c:202734:13: */ + if p != 0 { + Xsqlite3_free(tls, (*RbuState)(unsafe.Pointer(p)).FzTbl) + Xsqlite3_free(tls, (*RbuState)(unsafe.Pointer(p)).FzDataTbl) + Xsqlite3_free(tls, (*RbuState)(unsafe.Pointer(p)).FzIdx) + Xsqlite3_free(tls, p) + } +} + +// Allocate an RbuState object and load the contents of the rbu_state +// table into it. Return a pointer to the new object. It is the +// responsibility of the caller to eventually free the object using +// sqlite3_free(). +// +// If an error occurs, leave an error code and message in the rbu handle +// and return NULL. +func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var pRet uintptr = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) + // var rc int32 at bp+16, 4 + + var rc2 int32 + + pRet = rbuMalloc(tls, p, int64(unsafe.Sizeof(RbuState{}))) + if pRet == uintptr(0) { + return uintptr(0) + } + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+29207 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) + for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { + switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { + case RBU_STATE_STAGE: + (*RbuState)(unsafe.Pointer(pRet)).FeStage = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) + if (((*RbuState)(unsafe.Pointer(pRet)).FeStage != RBU_STAGE_OAL) && + ((*RbuState)(unsafe.Pointer(pRet)).FeStage != RBU_STAGE_MOVE)) && + ((*RbuState)(unsafe.Pointer(pRet)).FeStage != RBU_STAGE_CKPT) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_CORRUPT + } + break + + case RBU_STATE_TBL: + (*RbuState)(unsafe.Pointer(pRet)).FzTbl = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1), bp+16 /* &rc */) + break + + case RBU_STATE_IDX: + (*RbuState)(unsafe.Pointer(pRet)).FzIdx = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1), bp+16 /* &rc */) + break + + case RBU_STATE_ROW: + (*RbuState)(unsafe.Pointer(pRet)).FnRow = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) + break + + case RBU_STATE_PROGRESS: + (*RbuState)(unsafe.Pointer(pRet)).FnProgress = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) + break + + case RBU_STATE_CKPT: + (*RbuState)(unsafe.Pointer(pRet)).FiWalCksum = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) + break + + case RBU_STATE_COOKIE: + (*RbuState)(unsafe.Pointer(pRet)).FiCookie = U32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1)) + break + + case RBU_STATE_OALSZ: + (*RbuState)(unsafe.Pointer(pRet)).FiOalSz = I64(U32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1))) + break + + case RBU_STATE_PHASEONESTEP: + (*RbuState)(unsafe.Pointer(pRet)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) + break + + case RBU_STATE_DATATBL: + (*RbuState)(unsafe.Pointer(pRet)).FzDataTbl = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1), bp+16 /* &rc */) + break + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + break + } + } + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = rc2 + } + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) + return pRet +} + +// Open the database handle and attach the RBU database as "rbu". If an +// error occurs, leave an error code and message in the RBU handle. +func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:202829:13: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // Open the RBU database + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5459 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5459 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29237 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + } + } + + // If using separate RBU and state databases, attach the state database to + // the RBU db handle now. + if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29264 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+2414 /* "stat" */, uint64(4)) + } else { + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+5459 /* "main" */, uint64(4)) + } + + // If it has not already been created, create the rbu_state table + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29282 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { + var bOpen int32 = 0 + var rc int32 + (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 + (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5459 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + if rc != SQLITE_NOTFOUND { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage >= RBU_STAGE_MOVE { + bOpen = 1 + } else { + var pState uintptr = rbuLoadState(tls, p) + if pState != 0 { + bOpen = (libc.Bool32((*RbuState)(unsafe.Pointer(pState)).FeStage >= RBU_STAGE_MOVE)) + rbuFreeState(tls, pState) + } + } + if bOpen != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, (libc.Bool32((*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu <= 1))) + } + } + + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain == uintptr(0)) { + if !((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget, 1) + } else if (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd)).FpWalFd != 0 { + if pbRetry != 0 { + (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd)).FbNolock = U8(0) + Xsqlite3_close(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu) + Xsqlite3_close(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain = uintptr(0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = uintptr(0) + *(*int32)(unsafe.Pointer(pbRetry)) = 1 + return + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29348 /* "cannot vacuum wa..." */, 0) + } else { + var zTarget uintptr + var zExtra uintptr = uintptr(0) + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22480 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { + zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) + for *(*int8)(unsafe.Pointer(zExtra)) != 0 { + if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { + break + } + } + if int32(*(*int8)(unsafe.Pointer(zExtra))) == 0 { + zExtra = uintptr(0) + } + } + + zTarget = Xsqlite3_mprintf(tls, ts+29380, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5459 /* "main" */), + func() uintptr { + if zExtra == uintptr(0) { + return ts + 756 /* "" */ + } + return ts + 29412 /* "&" */ + }(), func() uintptr { + if zExtra == uintptr(0) { + return ts + 756 /* "" */ + } + return zExtra + }())) + + if zTarget == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + return + } + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain = rbuOpenDbhandle(tls, p, zTarget, (libc.Bool32((*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu <= 1))) + Xsqlite3_free(tls, zTarget) + } + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + ts+29414 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, + ts+29429 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, + ts+29446 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, SQLITE_FCNTL_RBU, p) + } + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29462 /* "SELECT * FROM sq..." */, 0) + + // Mark the database file just opened as an RBU target database. If + // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. + // This is an error. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */, SQLITE_FCNTL_RBU, p) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29490 /* "rbu vfs not foun..." */, 0) + } +} + +// This routine is a copy of the sqlite3FileSuffix3() routine from the core. +// It is a no-op unless SQLITE_ENABLE_8_3_NAMES is defined. +// +// If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database +// filename in zBaseFilename is a URI with the "8_3_names=1" parameter and +// if filename in z[] has a suffix (a.k.a. "extension") that is longer than +// three characters, then shorten the suffix on z[] to be the last three +// characters of the original suffix. +// +// If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always +// do the suffix shortening regardless of URI parameter. +// +// Examples: +// +// test.db-journal => test.nal +// test.db-wal => test.wal +// test.db-shm => test.shm +// test.db-mj7f3319fa => test.9fa +func rbuFileSuffix3(tls *libc.TLS, zBase uintptr, z uintptr) { /* sqlite3.c:203008:13: */ +} + +// Return the current wal-index header checksum for the target database +// as a 64-bit integer. +// +// The checksum is store in the first page of xShmMap memory as an 8-byte +// blob starting at byte offset 40. +func rbuShmChecksum(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:203029:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var iRet I64 = int64(0) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var pDb uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + // var ptr uintptr at bp, 8 + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 104 /* &.xShmMap */))))(tls, pDb, 0, (32 * 1024), 0, bp /* &ptr */) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + iRet = ((I64(*(*U32)(unsafe.Pointer(libc.AtomicLoadPUintptr(bp /* ptr */) + 10*4))) << 32) + I64(*(*U32)(unsafe.Pointer(libc.AtomicLoadPUintptr(bp /* ptr */) + 11*4)))) + } + } + return iRet +} + +// This function is called as part of initializing or reinitializing an +// incremental checkpoint. +// +// It populates the sqlite3rbu.aFrame[] array with the set of +// (wal frame -> db page) copy operations required to checkpoint the +// current wal file, and obtains the set of shm locks required to safely +// perform the copy operations directly on the file-system. +// +// If argument pState is not NULL, then the incremental checkpoint is +// being resumed. In this case, if the checksum of the wal-index-header +// following recovery is not the same as the checksum saved in the RbuState +// object, then the rbu handle is set to DONE state. This occurs if some +// other client appends a transaction to the wal file in the middle of +// an incremental checkpoint. +func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203058:13: */ + + // If pState is NULL, then the wal file may not have been opened and + // recovered. Running a read-statement here to ensure that doing so + // does not interfere with the "capture" process below. + if pState == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29462 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + // Assuming no error has occurred, run a "restart" checkpoint with the + // sqlite3rbu.eStage variable set to CAPTURE. This turns on the following + // special behaviour in the rbu VFS: + // + // * If the exclusive shm WRITER or READ0 lock cannot be obtained, + // the checkpoint fails with SQLITE_BUSY (normally SQLite would + // proceed with running a passive checkpoint instead of failing). + // + // * Attempts to read from the *-wal file or write to the database file + // do not perform any IO. Instead, the frame/page combinations that + // would be read/written are recorded in the sqlite3rbu.aFrame[] + // array. + // + // * Calls to xShmLock(UNLOCK) to release the exclusive shm WRITER, + // READ0 and CHECKPOINT locks taken as part of the checkpoint are + // no-ops. These locks will not be released until the connection + // is closed. + // + // * Attempting to xSync() the database file causes an SQLITE_INTERNAL + // error. + // + // As a result, unless an error (i.e. OOM or SQLITE_BUSY) occurs, the + // checkpoint below fails with SQLITE_INTERNAL, and leaves the aFrame[] + // array populated with a set of (frame -> page) mappings. Because the + // WRITER, CHECKPOINT and READ0 locks are still held, it is safe to copy + // data from the wal file into the database file according to the + // contents of aFrame[]. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var rc2 int32 + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29508 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc2 != SQLITE_INTERNAL { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 + } + } + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnFrame > 0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT + (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = func() int32 { + if pState != 0 { + return (*RbuState)(unsafe.Pointer(pState)).FnRow + } + return 0 + }() + (*Sqlite3rbu)(unsafe.Pointer(p)).FaBuf = rbuMalloc(tls, p, int64((*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FiWalCksum = rbuShmChecksum(tls, p) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if ((*Sqlite3rbu)(unsafe.Pointer(p)).FnFrame == 0) || ((pState != 0) && ((*RbuState)(unsafe.Pointer(pState)).FiWalCksum != (*Sqlite3rbu)(unsafe.Pointer(p)).FiWalCksum)) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_DONE + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE + } else { + var nSectorSize int32 + var pDb uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + var pWal uintptr = (*Rbu_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal + + nSectorSize = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 88 /* &.xSectorSize */))))(tls, pDb) + if nSectorSize > (*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz { + (*Sqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = (nSectorSize / (*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz) + } else { + (*Sqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector = 1 + } + + // Call xSync() on the wal file. This causes SQLite to sync the + // directory in which the target database and the wal file reside, in + // case it has not been synced since the rename() call in + // rbuMoveOalFile(). + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pWal)).FpMethods + 40 /* &.xSync */))))(tls, pWal, SQLITE_SYNC_NORMAL) + } + } +} + +// Called when iAmt bytes are read from offset iOff of the wal file while +// the rbu object is in capture mode. Record the frame number of the frame +// being read in the aFrame[] array. +func rbuCaptureWalRead(tls *libc.TLS, pRbu uintptr, iOff I64, iAmt int32) int32 { /* sqlite3.c:203142:12: */ + var mReq U32 = (U32(((int32(1) << WAL_LOCK_WRITE) | (int32(1) << WAL_LOCK_CKPT)) | (int32(1) << WAL_LOCK_READ0))) + var iFrame U32 + + if (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FmLock != mReq { + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).Frc = SQLITE_BUSY + return SQLITE_INTERNAL + } + + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).Fpgsz = iAmt + if (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrame == (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrameAlloc { + var nNew int32 = ((func() int32 { + if (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrameAlloc != 0 { + return (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrameAlloc + } + return 64 + }()) * 2) + var aNew uintptr + aNew = Xsqlite3_realloc64(tls, (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(RbuFrame{}))))) + if aNew == uintptr(0) { + return SQLITE_NOMEM + } + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame = aNew + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrameAlloc = nNew + } + + iFrame = ((U32((iOff - int64(32)) / (I64(iAmt + 24)))) + U32(1)) + if (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FiMaxFrame < iFrame { + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FiMaxFrame = iFrame + } + (*RbuFrame)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame + uintptr((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrame)*8)).FiWalFrame = iFrame + (*RbuFrame)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame + uintptr((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrame)*8)).FiDbPage = U32(0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrame++ + return SQLITE_OK +} + +// Called when a page of data is written to offset iOff of the database +// file while the rbu handle is in capture mode. Record the page number +// of the page being written in the aFrame[] array. +func rbuCaptureDbWrite(tls *libc.TLS, pRbu uintptr, iOff I64) int32 { /* sqlite3.c:203174:12: */ + (*RbuFrame)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame + uintptr(((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnFrame-1))*8)).FiDbPage = ((U32(iOff / I64((*Sqlite3rbu)(unsafe.Pointer(pRbu)).Fpgsz))) + U32(1)) + return SQLITE_OK +} + +// This is called as part of an incremental checkpoint operation. Copy +// a single frame of data from the wal file into the database file, as +// indicated by the RbuFrame object. +func rbuCheckpointFrame(tls *libc.TLS, p uintptr, pFrame uintptr) { /* sqlite3.c:203184:13: */ + var pWal uintptr = (*Rbu_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd)).FpReal + var pDb uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + var iOff I64 + + iOff = ((((I64((*RbuFrame)(unsafe.Pointer(pFrame)).FiWalFrame - U32(1))) * (I64((*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz + 24))) + int64(32)) + int64(24)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pWal)).FpMethods + 16 /* &.xRead */))))(tls, pWal, (*Sqlite3rbu)(unsafe.Pointer(p)).FaBuf, (*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz, iOff) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + return + } + + iOff = ((I64((*RbuFrame)(unsafe.Pointer(pFrame)).FiDbPage - U32(1))) * I64((*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 24 /* &.xWrite */))))(tls, pDb, (*Sqlite3rbu)(unsafe.Pointer(p)).FaBuf, (*Sqlite3rbu)(unsafe.Pointer(p)).Fpgsz, iOff) +} + +// Take an EXCLUSIVE lock on the database file. +func rbuLockDatabase(tls *libc.TLS, p uintptr) { /* sqlite3.c:203202:13: */ + var pReal uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 56 /* &.xLock */))))(tls, pReal, SQLITE_LOCK_SHARED) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 56 /* &.xLock */))))(tls, pReal, SQLITE_LOCK_EXCLUSIVE) + } +} + +// The RBU handle is currently in RBU_STAGE_OAL state, with a SHARED lock +// on the database file. This proc moves the *-oal file to the *-wal path, +// then reopens the database file (this time in vanilla, non-oal, WAL mode). +// If an error occurs, leave an error code and error message in the rbu +// handle. +func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5459 /* "main" */) + var zMove uintptr = zBase + var zOal uintptr + var zWal uintptr + + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5459 /* "main" */) + } + zOal = Xsqlite3_mprintf(tls, ts+29543 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+29550 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + + if (zWal == uintptr(0)) || (zOal == uintptr(0)) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } else { + // Move the *-oal file to *-wal. At this point connection p->db is + // holding a SHARED lock on the target database file (because it is + // in WAL mode). So no other connection may be writing the db. + // + // In order to ensure that there are no database readers, an EXCLUSIVE + // lock is obtained here before the *-oal is moved to *-wal. + rbuLockDatabase(tls, p) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rbuFileSuffix3(tls, zBase, zWal) + rbuFileSuffix3(tls, zBase, zOal) + + // Re-open the databases. + rbuObjIterFinalize(tls, (p + 80 /* &.objiter */)) + Xsqlite3_close(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu) + Xsqlite3_close(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain = uintptr(0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = uintptr(0) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = func() int32 { + if libc.Xrename(tls, zOal, zWal) != 0 { + return SQLITE_IOERR + } + return SQLITE_OK + }() + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rbuOpenDatabase(tls, p, uintptr(0)) + rbuSetupCheckpoint(tls, p, uintptr(0)) + } + } + } + + Xsqlite3_free(tls, zWal) + Xsqlite3_free(tls, zOal) +} + +// The SELECT statement iterating through the keys for the current object +// (p->objiter.pSelect) currently points to a valid row. This function +// determines the type of operation requested by this row and returns +// one of the following values to indicate the result: +// +// * RBU_INSERT +// * RBU_DELETE +// * RBU_IDX_DELETE +// * RBU_UPDATE +// +// If RBU_UPDATE is returned, then output variable *pzMask is set to +// point to the text value indicating the columns to update. +// +// If the rbu_control field contains an invalid value, an error code and +// message are left in the RBU handle and zero returned. +func rbuStepType(tls *libc.TLS, p uintptr, pzMask uintptr) int32 { /* sqlite3.c:203333:12: */ + var iCol int32 = (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnCol // Index of rbu_control column + var res int32 = 0 // Return value + + switch Xsqlite3_column_type(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpSelect, iCol) { + case SQLITE_INTEGER: + { + var iVal int32 = Xsqlite3_column_int(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpSelect, iCol) + switch iVal { + case 0: + res = RBU_INSERT + break + case 1: + res = RBU_DELETE + break + case 2: + res = RBU_REPLACE + break + case 3: + res = RBU_IDX_DELETE + break + case 4: + res = RBU_IDX_INSERT + break + } + break + + } + + case SQLITE_TEXT: + { + var z uintptr = Xsqlite3_column_text(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FpSelect, iCol) + if z == uintptr(0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } else { + *(*uintptr)(unsafe.Pointer(pzMask)) = z + } + res = RBU_UPDATE + + break + + } + + default: + break + } + + if res == 0 { + rbuBadControlError(tls, p) + } + return res +} + +// Argument eType must be one of RBU_INSERT, RBU_DELETE, RBU_IDX_INSERT or +// RBU_IDX_DELETE. This function performs the work of a single +// sqlite3rbu_step() call for the type of operation specified by eType. +func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:13: */ + var pIter uintptr = (p + 80 /* &.objiter */) + var pVal uintptr + var pWriter uintptr + var i int32 + + // If this is a delete, decrement nPhaseOneStep by nIndex. If the DELETE + // statement below does actually delete a row, nPhaseOneStep will be + // incremented by the same amount when SQL function rbu_tmp_insert() + // is invoked by the trigger. + if eType == RBU_DELETE { + *(*I64)(unsafe.Pointer(p + 304 /* &.nPhaseOneStep */)) -= (I64((*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex)) + } + + if (eType == RBU_IDX_DELETE) || (eType == RBU_DELETE) { + pWriter = (*RbuObjIter)(unsafe.Pointer(pIter)).FpDelete + } else { + pWriter = (*RbuObjIter)(unsafe.Pointer(pIter)).FpInsert + } + + for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol; i++ { + // If this is an INSERT into a table b-tree and the table has an + // explicit INTEGER PRIMARY KEY, check that this is not an attempt + // to write a NULL into the IPK column. That is not permitted. + if ((((eType == RBU_INSERT) && + ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && + (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22118 /* "datatype mismatc..." */, 0) + return + } + + if (eType == RBU_DELETE) && (int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == 0) { + continue + } + + pVal = Xsqlite3_column_value(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, pWriter, (i + 1), pVal) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { + return + } + } + if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + if (((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || + ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)) || + (((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) { + // For a virtual table, or a table with no primary key, the + // SELECT statement is: + // + // SELECT , rbu_control, rbu_rowid FROM .... + // + // Hence column_value(pIter->nCol+1). + + pVal = Xsqlite3_column_value(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnCol + 1)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, pWriter, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnCol + 1), pVal) + } + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_step(tls, pWriter) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = resetAndCollectError(tls, pWriter, (p + 64 /* &.zErrmsg */)) + } +} + +// This function does the work for an sqlite3rbu_step() call. +// +// The object-iterator (p->objiter) currently points to a valid object, +// and the input cursor (p->objiter.pSelect) currently points to a valid +// input row. Perform whatever processing is required and return. +// +// If no error occurs, SQLITE_OK is returned. Otherwise, an error code +// and message is left in the RBU handle and a copy of the error code +// returned. +func rbuStep(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203472:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pIter uintptr = (p + 80 /* &.objiter */) + *(*uintptr)(unsafe.Pointer(bp /* zMask */)) = uintptr(0) + var eType int32 = rbuStepType(tls, p, bp /* &zMask */) + + if eType != 0 { + + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0)) && ((eType == RBU_IDX_DELETE) || (eType == RBU_IDX_INSERT)) { + rbuBadControlError(tls, p) + } else if eType == RBU_REPLACE { + if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { + *(*I64)(unsafe.Pointer(p + 304 /* &.nPhaseOneStep */)) += (I64((*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex)) + rbuStepOneOp(tls, p, RBU_DELETE) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rbuStepOneOp(tls, p, RBU_INSERT) + } + } else if eType != RBU_UPDATE { + rbuStepOneOp(tls, p, eType) + } else { + var pVal uintptr + *(*uintptr)(unsafe.Pointer(bp + 8 /* pUpdate */)) = uintptr(0) + + *(*I64)(unsafe.Pointer(p + 304 /* &.nPhaseOneStep */)) -= (I64((*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FnIndex)) + rbuGetUpdateStmt(tls, p, pIter, *(*uintptr)(unsafe.Pointer(bp /* zMask */)), bp+8 /* &pUpdate */) + if *(*uintptr)(unsafe.Pointer(bp + 8 /* pUpdate */)) != 0 { + var i int32 + for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol); i++ { + var c int8 = *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* zMask */)) + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) + pVal = Xsqlite3_column_value(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) + if (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0) || (int32(c) != '.') { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pUpdate */)), (i + 1), pVal) + } + } + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && + (((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)) { + // Bind the rbu_rowid value to column _rowid_ + + pVal = Xsqlite3_column_value(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnCol + 1)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pUpdate */)), ((*RbuObjIter)(unsafe.Pointer(pIter)).FnCol + 1), pVal) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pUpdate */))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = resetAndCollectError(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pUpdate */)), (p + 64 /* &.zErrmsg */)) + } + } + } + } + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc +} + +// Increment the schema cookie of the main database opened by p->dbMain. +// +// Or, if this is an RBU vacuum, set the schema cookie of the main db +// opened by p->dbMain to one more than the schema cookie of the main +// db opened by p->dbRbu. +func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var dbread uintptr = func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu + } + return (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain + }() + var iCookie int32 = 1000000 + // var pStmt uintptr at bp+8, 8 + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), + ts+29557 /* "PRAGMA schema_ve..." */) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + // Coverage: it may be that this sqlite3_step() cannot fail. There + // is already a transaction open, so the prepared statement cannot + // throw an SQLITE_SCHEMA exception. The only database page the + // statement reads is page 1, which is guaranteed to be in the cache. + // And no memory allocations are required. + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) { + iCookie = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29579 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + } + } +} + +// Update the contents of the rbu_state table within the rbu database. The +// value stored in the RBU_STATE_STAGE column is eStage. All other values +// are determined by inspecting the rbu handle passed as the first argument. +func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568:13: */ + bp := tls.Alloc(176) + defer tls.Free(176) + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) || ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) { + *(*uintptr)(unsafe.Pointer(bp + 168 /* pInsert */)) = uintptr(0) + var pFd uintptr = func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd + } + return (*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd + }() + var rc int32 + + rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, + + ts+29606, /* "INSERT OR REPLAC..." */ + libc.VaList(bp, p+48, /* &.zStateDb */ + RBU_STATE_STAGE, eStage, + RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, + RBU_STATE_IDX, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzIdx, + RBU_STATE_ROW, (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep, + RBU_STATE_PROGRESS, (*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress, + RBU_STATE_CKPT, (*Sqlite3rbu)(unsafe.Pointer(p)).FiWalCksum, + RBU_STATE_COOKIE, I64((*Rbu_file)(unsafe.Pointer(pFd)).FiCookie), + RBU_STATE_OALSZ, (*Sqlite3rbu)(unsafe.Pointer(p)).FiOalSz, + RBU_STATE_PHASEONESTEP, (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep, + RBU_STATE_DATATBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) + + if rc == SQLITE_OK { + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pInsert */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pInsert */))) + } + if rc != SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } + } +} + +// The second argument passed to this function is the name of a PRAGMA +// setting - "page_size", "auto_vacuum", "user_version" or "application_id". +// This function executes the following on sqlite3rbu.dbRbu: +// +// "PRAGMA main.$zPragma" +// +// where $zPragma is the string passed as the second argument, then +// on sqlite3rbu.dbMain: +// +// "PRAGMA main.$zPragma = $val" +// +// where $val is the value returned by the first PRAGMA invocation. +// +// In short, it copies the value of the specified PRAGMA setting from +// dbRbu to dbMain. +func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203629:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+29764 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29779, /* "PRAGMA main.%s =..." */ + libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) + } +} + +// The RBU handle passed as the only argument has just been opened and +// the state database is empty. If this RBU handle was opened for an +// RBU vacuum operation, create the schema in the target db. +func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)) = uintptr(0) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29799 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), + + ts+29824 /* "SELECT sql FROM ..." */) + } + + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { + var zSql uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */)), 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, zSql, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), + ts+29932 /* "SELECT * FROM sq..." */) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8 /* &pInsert */, (p + 64 /* &.zErrmsg */), + ts+29997 /* "INSERT INTO sqli..." */) + } + + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { + var i int32 + for i = 0; i < 5; i++ { + Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)), (i + 1), Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */)), i)) + } + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30041 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) +} + +// Step the RBU object. +func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if p != 0 { + switch (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage { + case RBU_STAGE_OAL: + { + var pIter uintptr = (p + 80 /* &.objiter */) + + // If this is an RBU vacuum operation and the state table was empty + // when this handle was opened, create the target database schema. + if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + rbuCreateTargetSchema(tls, p) + rbuCopyPragma(tls, p, ts+15724 /* "user_version" */) + rbuCopyPragma(tls, p, ts+14846 /* "application_id" */) + } + + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { + + if (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0 { + // Clean up the rbu_tmp_xxx table for the previous table. It + // cannot be dropped as there are currently active SQL statements. + // But the contents can be deleted. + if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, + ts+30066 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + } + } else { + rbuObjIterPrepareAll(tls, p, pIter, 0) + + // Advance to the next row to process. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var rc int32 = Xsqlite3_step(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect) + if rc == SQLITE_ROW { + (*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress++ + (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep++ + return rbuStep(tls, p) + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect) + (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 + } + } + + rbuObjIterNext(tls, p, pIter) + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + + rbuSaveState(tls, p, RBU_STAGE_MOVE) + rbuIncrSchemaCookie(tls, p) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13229 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13229 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE + } + break + + } + fallthrough + + case RBU_STAGE_MOVE: + { + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rbuMoveOalFile(tls, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress++ + } + break + + } + fallthrough + + case RBU_STAGE_CKPT: + { + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep >= (*Sqlite3rbu)(unsafe.Pointer(p)).FnFrame { + var pDb uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + + // Sync the db file + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 40 /* &.xSync */))))(tls, pDb, SQLITE_SYNC_NORMAL) + + // Update nBackfill + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + // var ptr uintptr at bp+16, 8 + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 104 /* &.xShmMap */))))(tls, pDb, 0, (32 * 1024), 0, bp+16 /* &ptr */) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*U32)(unsafe.Pointer((libc.AtomicLoadPUintptr(bp + 16 /* ptr */)) + 24*4)) = (*Sqlite3rbu)(unsafe.Pointer(p)).FiMaxFrame + } + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_DONE + } + } else { + // At one point the following block copied a single frame from the + // wal file to the database file. So that one call to sqlite3rbu_step() + // checkpointed a single frame. + // + // However, if the sector-size is larger than the page-size, and the + // application calls sqlite3rbu_savestate() or close() immediately + // after this step, then rbu_step() again, then a power failure occurs, + // then the database page written here may be damaged. Work around + // this by checkpointing frames until the next page in the aFrame[] + // lies on a different disk sector to the current one. + var iSector U32 + for ok := true; ok; ok = ((((*Sqlite3rbu)(unsafe.Pointer(p)).FnStep < (*Sqlite3rbu)(unsafe.Pointer(p)).FnFrame) && + (iSector == (((*RbuFrame)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FaFrame+uintptr((*Sqlite3rbu)(unsafe.Pointer(p)).FnStep)*8)).FiDbPage - U32(1)) / U32((*Sqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector)))) && + ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK)) { + var pFrame uintptr = ((*Sqlite3rbu)(unsafe.Pointer(p)).FaFrame + uintptr((*Sqlite3rbu)(unsafe.Pointer(p)).FnStep)*8) + iSector = (((*RbuFrame)(unsafe.Pointer(pFrame)).FiDbPage - U32(1)) / U32((*Sqlite3rbu)(unsafe.Pointer(p)).FnPagePerSector)) + rbuCheckpointFrame(tls, p, pFrame) + (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep++ + } + } + (*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress++ + } + break + + } + fallthrough + + default: + break + } + return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + } else { + return SQLITE_NOMEM + } + return int32(0) +} + +// Compare strings z1 and z2, returning 0 if they are identical, or non-zero +// otherwise. Either or both argument may be NULL. Two NULL values are +// considered equal, and NULL is considered distinct from all other values. +func rbuStrCompare(tls *libc.TLS, z1 uintptr, z2 uintptr) int32 { /* sqlite3.c:203830:12: */ + if (z1 == uintptr(0)) && (z2 == uintptr(0)) { + return 0 + } + if (z1 == uintptr(0)) || (z2 == uintptr(0)) { + return 1 + } + return (libc.Bool32(Xsqlite3_stricmp(tls, z1, z2) != 0)) +} + +// This function is called as part of sqlite3rbu_open() when initializing +// an rbu handle in OAL stage. If the rbu update has not started (i.e. +// the rbu_state table was empty) it is a no-op. Otherwise, it arranges +// things so that the next call to sqlite3rbu_step() continues on from +// where the previous rbu handle left off. +// +// If an error occurs, an error code and error message are left in the +// rbu handle passed as the first argument. +func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846:13: */ + + if (*RbuState)(unsafe.Pointer(pState)).FzTbl != 0 { + var pIter uintptr = (p + 80 /* &.objiter */) + var rc int32 = SQLITE_OK + + for ((rc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0)) && (((((*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup != 0) || + (rbuStrCompare(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx, (*RbuState)(unsafe.Pointer(pState)).FzIdx) != 0)) || + (((*RbuState)(unsafe.Pointer(pState)).FzDataTbl == uintptr(0)) && (rbuStrCompare(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (*RbuState)(unsafe.Pointer(pState)).FzTbl) != 0))) || + (((*RbuState)(unsafe.Pointer(pState)).FzDataTbl != 0) && (rbuStrCompare(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, (*RbuState)(unsafe.Pointer(pState)).FzDataTbl) != 0))) { + rc = rbuObjIterNext(tls, p, pIter) + } + + if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { + rc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30094 /* "rbu_state mismat..." */, 0) + } + + if rc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = (*RbuState)(unsafe.Pointer(pState)).FnRow + rc = rbuObjIterPrepareAll(tls, p, (p + 80 /* &.objiter */), (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep) + } + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + } +} + +// If there is a "*-oal" file in the file-system corresponding to the +// target database in the file-system, delete it. If an error occurs, +// leave an error code and error message in the rbu handle. +func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var zOal uintptr = rbuMPrintf(tls, p, ts+29543 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + if zOal != 0 { + var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) + + (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pVfs + 48 /* &.xDelete */))))(tls, pVfs, zOal, 0) + Xsqlite3_free(tls, zOal) + } +} + +// Allocate a private rbu VFS for the rbu handle passed as the only +// argument. This VFS will be used unless the call to sqlite3rbu_open() +// specified a URI with a vfs=? option in place of a target database +// file name. +func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ + bp := tls.Alloc(76) + defer tls.Free(76) + + // var rnd int32 at bp+8, 4 + + // var zRnd [64]int8 at bp+12, 64 + + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30119 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) + + (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName = (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName + (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRbu = p + } +} + +// Destroy the private VFS created for the rbu handle passed as the only +// argument by an earlier call to rbuCreateVfs(). +func rbuDeleteVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203915:13: */ + if (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName != 0 { + Xsqlite3rbu_destroy_vfs(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName = uintptr(0) + } +} + +// This user-defined SQL function is invoked with a single argument - the +// name of a table expected to appear in the target database. It returns +// the number of auxilliary indexes on the table. +func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* sqlite3.c:203927:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var p uintptr = Xsqlite3_user_data(tls, pCtx) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)) = uintptr(0) + var rc int32 + var db uintptr = func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu + } + return (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain + }() + + rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+16, /* &zErrmsg */ + Xsqlite3_mprintf(tls, + ts+30130 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + if rc != SQLITE_OK { + Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)), -1) + } else { + var nIndex int32 = 0 + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) { + nIndex = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + if rc == SQLITE_OK { + Xsqlite3_result_int(tls, pCtx, nIndex) + } else { + Xsqlite3_result_error(tls, pCtx, Xsqlite3_errmsg(tls, db), -1) + } + } + + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */))) +} + +// If the RBU database contains the rbu_count table, use it to initialize +// the sqlite3rbu.nPhaseOneStep variable. The schema of the rbu_count table +// is assumed to contain the same columns as: +// +// CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID; +// +// There should be one row in the table for each data_xxx table in the +// database. The 'tbl' column should contain the name of a data_xxx table, +// and the cnt column the number of rows it contains. +// +// sqlite3rbu.nPhaseOneStep is initialized to the sum of (1 + nIndex) * cnt +// for all rows in the rbu_count table, where nIndex is the number of +// indexes on the corresponding target database table. +func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) + var bExists int32 = 0 // True if rbu_count exists + + (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, + ts+30202 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) + + // Check for the rbu_count table. If it does not exist, or if an error + // occurs, nPhaseOneStep will be left set to -1. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), + ts+30216 /* "SELECT 1 FROM sq..." */) + } + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + bExists = 1 + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), + + ts+30273 /* "SELECT sum(cnt *..." */) + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) + } + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + } + } +} + +func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) uintptr { /* sqlite3.c:204018:19: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var p uintptr + var nTarget Size_t + if zTarget != 0 { + nTarget = libc.Xstrlen(tls, zTarget) + } else { + nTarget = uint64(0) + } + var nRbu Size_t = libc.Xstrlen(tls, zRbu) + var nByte Size_t = ((((uint64(unsafe.Sizeof(Sqlite3rbu{})) + nTarget) + uint64(1)) + nRbu) + uint64(1)) + + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if p != 0 { + var pState uintptr = uintptr(0) + + // Create the custom VFS. + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3rbu{}))) + rbuCreateVfs(tls, p) + + // Open the target, RBU and state databases + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var pCsr uintptr = (p + 1*392) + *(*int32)(unsafe.Pointer(bp + 16 /* bRetry */)) = 0 + if zTarget != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget = pCsr + libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget, zTarget, (nTarget + uint64(1))) + pCsr += (uintptr(nTarget + uint64(1))) + } + (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu = pCsr + libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + uint64(1))) + pCsr += (uintptr(nRbu + uint64(1))) + if zState != 0 { + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2791 /* "%s" */, libc.VaList(bp, zState)) + } + + // If the first attempt to open the database file fails and the bRetry + // flag it set, this means that the db was not opened because it seemed + // to be a wal-mode db. But, this may have happened due to an earlier + // RBU vacuum operation leaving an old wal file in the directory. + // If this is the case, it will have been checkpointed and deleted + // when the handle was closed and a second attempt to open the + // database may succeed. + rbuOpenDatabase(tls, p, bp+16 /* &bRetry */) + if *(*int32)(unsafe.Pointer(bp + 16 /* bRetry */)) != 0 { + rbuOpenDatabase(tls, p, uintptr(0)) + } + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pState = rbuLoadState(tls, p) + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + + if (*RbuState)(unsafe.Pointer(pState)).FeStage == 0 { + rbuDeleteOalFile(tls, p) + rbuInitPhaseOneSteps(tls, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_OAL + } else { + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = (*RbuState)(unsafe.Pointer(pState)).FeStage + (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = (*RbuState)(unsafe.Pointer(pState)).FnPhaseOneStep + } + (*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress = int32((*RbuState)(unsafe.Pointer(pState)).FnProgress) + (*Sqlite3rbu)(unsafe.Pointer(p)).FiOalSz = (*RbuState)(unsafe.Pointer(pState)).FiOalSz + } + } + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { + if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30347 /* "cannot update wa..." */, 0) + } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT + (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 + } + } + + if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && + (((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) || ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE))) && + ((*RbuState)(unsafe.Pointer(pState)).FeStage != 0) { + var pFd uintptr = func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd + } + return (*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd + }() + if (*Rbu_file)(unsafe.Pointer(pFd)).FiCookie != (*RbuState)(unsafe.Pointer(pState)).FiCookie { + // At this point (pTargetFd->iCookie) contains the value of the + // change-counter cookie (the thing that gets incremented when a + // transaction is committed in rollback mode) currently stored on + // page 1 of the database file. + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30379, /* "database modifie..." */ + libc.VaList(bp+8, func() uintptr { + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + return ts + 30411 /* "vacuum" */ + } + return ts + 30418 /* "update" */ + }())) + } + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { + var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13214 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + + // Point the object iterator at the first object + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuObjIterFirst(tls, p, (p + 80 /* &.objiter */)) + } + + // If the RBU database contains no data_xxx tables, declare the RBU + // update finished. + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl == uintptr(0)) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_DONE + (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE + } else { + if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { + rbuCopyPragma(tls, p, ts+15449 /* "page_size" */) + rbuCopyPragma(tls, p, ts+14861 /* "auto_vacuum" */) + } + + // Open transactions both databases. The *-oal file is opened or + // created at this point. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30425 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + + // Check if the main database is a zipvfs db. If it is, set the upper + // level pager to use "journal_mode=off". This prevents it from + // generating a large journal using a temp file. + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var frc int32 = Xsqlite3_file_control(tls, db, ts+5459 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + if frc == SQLITE_OK { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, + db, ts+30441 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { + rbuSetupOal(tls, p, pState) + } + } + } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { + // no-op + } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_CKPT { + rbuSetupCheckpoint(tls, p, pState) + } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_DONE { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_DONE + } else { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_CORRUPT + } + } + + rbuFreeState(tls, pState) + } + + return p +} + +// Allocate and return an RBU handle with all fields zeroed except for the +// error code, which is set to SQLITE_MISUSE. +func rbuMisuseError(tls *libc.TLS) uintptr { /* sqlite3.c:204174:19: */ + var pRet uintptr + pRet = Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(Sqlite3rbu{}))) + if pRet != 0 { + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3rbu{}))) + (*Sqlite3rbu)(unsafe.Pointer(pRet)).Frc = SQLITE_MISUSE + } + return pRet +} + +// Open and return a new RBU handle. +func Xsqlite3rbu_open(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) uintptr { /* sqlite3.c:204187:23: */ + if (zTarget == uintptr(0)) || (zRbu == uintptr(0)) { + return rbuMisuseError(tls) + } + // TODO: Check that zTarget and zRbu are non-NULL + return openRbuHandle(tls, zTarget, zRbu, zState) +} + +// Open a handle to begin or resume an RBU VACUUM operation. +func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr { /* sqlite3.c:204200:23: */ + if zTarget == uintptr(0) { + return rbuMisuseError(tls) + } + if zState != 0 { + var n int32 = int32(libc.Xstrlen(tls, zState)) + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30465 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { + return rbuMisuseError(tls) + } + } + // TODO: Check that both arguments are non-NULL + return openRbuHandle(tls, uintptr(0), zTarget, zState) +} + +// Return the database handle used by pRbu. +func Xsqlite3rbu_db(tls *libc.TLS, pRbu uintptr, bRbu int32) uintptr { /* sqlite3.c:204218:20: */ + var db uintptr = uintptr(0) + if pRbu != 0 { + db = func() uintptr { + if bRbu != 0 { + return (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FdbRbu + } + return (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FdbMain + }() + } + return db +} + +// If the error code currently stored in the RBU handle is SQLITE_CONSTRAINT, +// then edit any error message string so as to remove all occurrences of +// the pattern "rbu_imp_[0-9]*". +func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_CONSTRAINT) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg != 0) { + var i uint32 + var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) + for i = uint32(0); Size_t(i) < (nErrmsg - uint64(8)); i++ { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28516 /* "rbu_imp_" */, uint64(8)) == 0 { + var nDel int32 = 8 + for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { + nDel++ + } + libc.Xmemmove(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr(i)), ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))), (((nErrmsg + uint64(1)) - Size_t(i)) - Size_t(nDel))) + nErrmsg = nErrmsg - (Size_t(nDel)) + } + } + } +} + +// Close the RBU handle. +func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sqlite3.c:204250:16: */ + var rc int32 + if p != 0 { + + // Commit the transaction to the *-oal file. + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13229 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + + // Sync the db file if currently doing an incremental checkpoint + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_CKPT) { + var pDb uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 40 /* &.xSync */))))(tls, pDb, SQLITE_SYNC_NORMAL) + } + + rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13229 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + } + + // Close any open statement handles. + rbuObjIterFinalize(tls, (p + 80 /* &.objiter */)) + + // If this is an RBU vacuum handle and the vacuum has either finished + // successfully or encountered an error, delete the contents of the + // state table. This causes the next call to sqlite3rbu_vacuum() + // specifying the current target and state databases to start a new + // vacuum from scratch. + if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30473 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 + } + } + + // Close the open database handle and VFS object. + Xsqlite3_close(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu) + Xsqlite3_close(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain) + + rbuDeleteVfs(tls, p) + Xsqlite3_free(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FaBuf) + Xsqlite3_free(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FaFrame) + + rbuEditErrmsg(tls, p) + rc = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + if pzErrmsg != 0 { + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + } else { + Xsqlite3_free(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) + } + Xsqlite3_free(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState) + Xsqlite3_free(tls, p) + } else { + rc = SQLITE_NOMEM + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = uintptr(0) + } + return rc +} + +// Return the total number of key-value operations (inserts, deletes or +// updates) that have been performed on the target database since the +// current RBU update was started. +func Xsqlite3rbu_progress(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlite3.c:204313:26: */ + return Sqlite3_int64((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnProgress) +} + +// Return permyriadage progress indications for the two main stages of +// an RBU update. +func Xsqlite3rbu_bp_progress(tls *libc.TLS, p uintptr, pnOne uintptr, pnTwo uintptr) { /* sqlite3.c:204321:17: */ + var MAX_PROGRESS int32 = 10000 + switch (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage { + case RBU_STAGE_OAL: + if (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep > int64(0) { + *(*int32)(unsafe.Pointer(pnOne)) = (int32((I64(MAX_PROGRESS) * I64((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress)) / (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep)) + } else { + *(*int32)(unsafe.Pointer(pnOne)) = -1 + } + *(*int32)(unsafe.Pointer(pnTwo)) = 0 + break + + case RBU_STAGE_MOVE: + *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS + *(*int32)(unsafe.Pointer(pnTwo)) = 0 + break + + case RBU_STAGE_CKPT: + *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS + *(*int32)(unsafe.Pointer(pnTwo)) = (int32((I64(MAX_PROGRESS) * I64((*Sqlite3rbu)(unsafe.Pointer(p)).FnStep)) / I64((*Sqlite3rbu)(unsafe.Pointer(p)).FnFrame))) + break + + case RBU_STAGE_DONE: + *(*int32)(unsafe.Pointer(pnOne)) = MAX_PROGRESS + *(*int32)(unsafe.Pointer(pnTwo)) = MAX_PROGRESS + break + + default: + + } +} + +// Return the current state of the RBU vacuum or update operation. +func Xsqlite3rbu_state(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204356:16: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + *(*[6]int32)(unsafe.Pointer(bp /* aRes */)) = [6]int32{ + 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE, + 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE, + } + + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_DONE) { + return SQLITE_RBU_STATE_ERROR + } else { + + return *(*int32)(unsafe.Pointer(bp /* &aRes[0] */ + uintptr((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage)*4)) + } + return int32(0) +} + +func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384:16: */ + var rc int32 = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + if rc == SQLITE_DONE { + return SQLITE_OK + } + + if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { + + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13229 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + // Sync the db file + if (rc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_CKPT) { + var pDb uintptr = (*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpReal + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 40 /* &.xSync */))))(tls, pDb, SQLITE_SYNC_NORMAL) + } + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) + rc = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc + + if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { + + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13229 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + var zBegin uintptr + if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { + zBegin = ts + 13214 /* "BEGIN" */ + } else { + zBegin = ts + 30425 /* "BEGIN IMMEDIATE" */ + } + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30425 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc + return rc +} + +// ************************************************************************* +// +// Beginning of RBU VFS shim methods. The VFS shim modifies the behaviour +// of a standard VFS in the following ways: +// +// 1. Whenever the first page of a main database file is read or +// written, the value of the change-counter cookie is stored in +// rbu_file.iCookie. Similarly, the value of the "write-version" +// database header field is stored in rbu_file.iWriteVer. This ensures +// that the values are always trustworthy within an open transaction. +// +// 2. Whenever an SQLITE_OPEN_WAL file is opened, the (rbu_file.pWalFd) +// member variable of the associated database file descriptor is set +// to point to the new file. A mutex protected linked list of all main +// db fds opened using a particular RBU VFS is maintained at +// rbu_vfs.pMain to facilitate this. +// +// 3. Using a new file-control "SQLITE_FCNTL_RBU", a main db rbu_file +// object can be marked as the target database of an RBU update. This +// turns on the following extra special behaviour: +// +// 3a. If xAccess() is called to check if there exists a *-wal file +// associated with an RBU target database currently in RBU_STAGE_OAL +// stage (preparing the *-oal file), the following special handling +// applies: +// +// * if the *-wal file does exist, return SQLITE_CANTOPEN. An RBU +// target database may not be in wal mode already. +// +// * if the *-wal file does not exist, set the output parameter to +// non-zero (to tell SQLite that it does exist) anyway. +// +// Then, when xOpen() is called to open the *-wal file associated with +// the RBU target in RBU_STAGE_OAL stage, instead of opening the *-wal +// file, the rbu vfs opens the corresponding *-oal file instead. +// +// 3b. The *-shm pages returned by xShmMap() for a target db file in +// RBU_STAGE_OAL mode are actually stored in heap memory. This is to +// avoid creating a *-shm file on disk. Additionally, xShmLock() calls +// are no-ops on target database files in RBU_STAGE_OAL mode. This is +// because assert() statements in some VFS implementations fail if +// xShmLock() is called before xShmMap(). +// +// 3c. If an EXCLUSIVE lock is attempted on a target database file in any +// mode except RBU_STAGE_DONE (all work completed and checkpointed), it +// fails with an SQLITE_BUSY error. This is to stop RBU connections +// from automatically checkpointing a *-wal (or *-oal) file from within +// sqlite3_close(). +// +// 3d. In RBU_STAGE_CAPTURE mode, all xRead() calls on the wal file, and +// all xWrite() calls on the target database file perform no IO. +// Instead the frame and page numbers that would be read and written +// are recorded. Additionally, successful attempts to obtain exclusive +// xShmLock() WRITER, CHECKPOINTER and READ0 locks on the target +// database file are recorded. xShmLock() calls to unlock the same +// locks are no-ops (so that once obtained, these locks are never +// relinquished). Finally, calls to xSync() on the target database +// file fail with SQLITE_INTERNAL errors. + +func rbuUnlockShm(tls *libc.TLS, p uintptr) { /* sqlite3.c:204477:13: */ + + if (*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0 { + var xShmLock uintptr = (*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxShmLock + var i int32 + for i = 0; i < SQLITE_SHM_NLOCK; i++ { + if ((U32(int32(1) << i)) & (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock) != 0 { + (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&xShmLock)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, i, 1, (SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE)) + } + } + (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbu)).FmLock = U32(0) + } +} + +// +func rbuUpdateTempSize(tls *libc.TLS, pFd uintptr, nNew Sqlite3_int64) int32 { /* sqlite3.c:204493:12: */ + var pRbu uintptr = (*Rbu_file)(unsafe.Pointer(pFd)).FpRbu + var nDiff I64 = (nNew - (*Rbu_file)(unsafe.Pointer(pFd)).Fsz) + *(*I64)(unsafe.Pointer(pRbu + 360 /* &.szTemp */)) += (nDiff) + (*Rbu_file)(unsafe.Pointer(pFd)).Fsz = nNew + + if ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit != 0) && ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FszTemp > (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit) { + return SQLITE_FULL + } + return SQLITE_OK +} + +// Add an item to the main-db lists, if it is not already present. +// +// There are two main-db lists. One for all file descriptors, and one +// for all file descriptors with rbu_file.pDb!=0. If the argument has +// rbu_file.pDb!=0, then it is assumed to already be present on the +// main list and is only added to the pDb!=0 list. +func rbuMainlistAdd(tls *libc.TLS, p uintptr) { /* sqlite3.c:204511:13: */ + var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs + var pIter uintptr + + Xsqlite3_mutex_enter(tls, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) + if (*Rbu_file)(unsafe.Pointer(p)).FpRbu == uintptr(0) { + for pIter = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain; pIter != 0; pIter = (*Rbu_file)(unsafe.Pointer(pIter)).FpMainNext { + } + (*Rbu_file)(unsafe.Pointer(p)).FpMainNext = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain + (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain = p + } else { + for pIter = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu; (pIter != 0) && (pIter != p); pIter = (*Rbu_file)(unsafe.Pointer(pIter)).FpMainRbuNext { + } + if pIter == uintptr(0) { + (*Rbu_file)(unsafe.Pointer(p)).FpMainRbuNext = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu + (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu = p + } + } + Xsqlite3_mutex_leave(tls, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) +} + +// Remove an item from the main-db lists. +func rbuMainlistRemove(tls *libc.TLS, p uintptr) { /* sqlite3.c:204533:13: */ + var pp uintptr + Xsqlite3_mutex_enter(tls, (*Rbu_vfs)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs)).Fmutex) + for pp = ((*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs + 192 /* &.pMain */); (*(*uintptr)(unsafe.Pointer(pp)) != 0) && (*(*uintptr)(unsafe.Pointer(pp)) != p); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 88 /* &.pMainNext */) { + } + if *(*uintptr)(unsafe.Pointer(pp)) != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*Rbu_file)(unsafe.Pointer(p)).FpMainNext + } + (*Rbu_file)(unsafe.Pointer(p)).FpMainNext = uintptr(0) + for pp = ((*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs + 200 /* &.pMainRbu */); (*(*uintptr)(unsafe.Pointer(pp)) != 0) && (*(*uintptr)(unsafe.Pointer(pp)) != p); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 96 /* &.pMainRbuNext */) { + } + if *(*uintptr)(unsafe.Pointer(pp)) != 0 { + *(*uintptr)(unsafe.Pointer(pp)) = (*Rbu_file)(unsafe.Pointer(p)).FpMainRbuNext + } + (*Rbu_file)(unsafe.Pointer(p)).FpMainRbuNext = uintptr(0) + Xsqlite3_mutex_leave(tls, (*Rbu_vfs)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs)).Fmutex) +} + +// Given that zWal points to a buffer containing a wal file name passed to +// either the xOpen() or xAccess() VFS method, search the main-db list for +// a file-handle opened by the same database connection on the corresponding +// database file. +// +// If parameter bRbu is true, only search for file-descriptors with +// rbu_file.pDb!=0. +func rbuFindMaindb(tls *libc.TLS, pRbuVfs uintptr, zWal uintptr, bRbu int32) uintptr { /* sqlite3.c:204554:17: */ + var pDb uintptr + Xsqlite3_mutex_enter(tls, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) + if bRbu != 0 { + for pDb = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMainRbu; (pDb != 0) && ((*Rbu_file)(unsafe.Pointer(pDb)).FzWal != zWal); pDb = (*Rbu_file)(unsafe.Pointer(pDb)).FpMainRbuNext { + } + } else { + for pDb = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpMain; (pDb != 0) && ((*Rbu_file)(unsafe.Pointer(pDb)).FzWal != zWal); pDb = (*Rbu_file)(unsafe.Pointer(pDb)).FpMainNext { + } + } + Xsqlite3_mutex_leave(tls, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fmutex) + return pDb +} + +// Close an rbu file. +func rbuVfsClose(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:204569:12: */ + var p uintptr = pFile + var rc int32 + var i int32 + + // Free the contents of the apShm[] array. And the array itself. + for i = 0; i < (*Rbu_file)(unsafe.Pointer(p)).FnShm; i++ { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FapShm + uintptr(i)*8))) + } + Xsqlite3_free(tls, (*Rbu_file)(unsafe.Pointer(p)).FapShm) + (*Rbu_file)(unsafe.Pointer(p)).FapShm = uintptr(0) + Xsqlite3_free(tls, (*Rbu_file)(unsafe.Pointer(p)).FzDel) + + if ((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_MAIN_DB) != 0 { + rbuMainlistRemove(tls, p) + rbuUnlockShm(tls, p) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 128 /* &.xShmUnmap */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, 0) + } else if (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_DELETEONCLOSE) != 0) && ((*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0) { + rbuUpdateTempSize(tls, p, int64(0)) + } + + // Close the underlying file handle + rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 8 /* &.xClose */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal) + return rc +} + +// Read and return an unsigned 32-bit big-endian integer from the buffer +// passed as the only argument. +func rbuGetU32(tls *libc.TLS, aBuf uintptr) U32 { /* sqlite3.c:204602:12: */ + return ((((U32(*(*U8)(unsafe.Pointer(aBuf))) << 24) + + (U32(*(*U8)(unsafe.Pointer(aBuf + 1))) << 16)) + + (U32(*(*U8)(unsafe.Pointer(aBuf + 2))) << 8)) + + (U32(*(*U8)(unsafe.Pointer(aBuf + 3))))) +} + +// Write an unsigned 32-bit value in big-endian format to the supplied +// buffer. +func rbuPutU32(tls *libc.TLS, aBuf uintptr, iVal U32) { /* sqlite3.c:204613:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((iVal >> 24) & U32(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((iVal >> 16) & U32(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((iVal >> 8) & U32(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((iVal >> 0) & U32(0xFF))) +} + +func rbuPutU16(tls *libc.TLS, aBuf uintptr, iVal U16) { /* sqlite3.c:204620:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((int32(iVal) >> 8) & 0xFF)) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((int32(iVal) >> 0) & 0xFF)) +} + +// Read data from an rbuVfs-file. +func rbuVfsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst Sqlite_int64) int32 { /* sqlite3.c:204628:12: */ + var p uintptr = pFile + var pRbu uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbu + var rc int32 + + if (pRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_CAPTURE) { + + rc = rbuCaptureWalRead(tls, (*Rbu_file)(unsafe.Pointer(p)).FpRbu, iOfst, iAmt) + } else { + if (((pRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_OAL)) && + (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_WAL) != 0)) && + (iOfst >= (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz) { + rc = SQLITE_OK + libc.Xmemset(tls, zBuf, 0, uint64(iAmt)) + } else { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 16 /* &.xRead */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst) + // If this is being called to read the first page of the target + // database as part of an rbu vacuum operation, synthesize the + // contents of the first page if it does not yet exist. Otherwise, + // SQLite will not check for a *-wal file. + if (((((pRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer((pRbu))).FzTarget == uintptr(0))) && + (rc == (SQLITE_IOERR | (int32(2) << 8)))) && (iOfst == int64(0))) && + (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_MAIN_DB) != 0)) && + ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).Frc == SQLITE_OK) { + var pFd uintptr = (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpRbuFd + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pFd)).FpMethods + 16 /* &.xRead */))))(tls, pFd, zBuf, iAmt, iOfst) + if rc == SQLITE_OK { + var aBuf uintptr = zBuf + var iRoot U32 + if rbuGetU32(tls, (aBuf+52)) != 0 { + iRoot = uint32(1) + } else { + iRoot = uint32(0) + } + rbuPutU32(tls, (aBuf + 52), iRoot) // largest root page number + rbuPutU32(tls, (aBuf + 36), uint32(0)) // number of free pages + rbuPutU32(tls, (aBuf + 32), uint32(0)) // first page on free list trunk + rbuPutU32(tls, (aBuf + 28), uint32(1)) // size of db file in pages + rbuPutU32(tls, (aBuf + 24), ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpRbuFd)).FiCookie + U32(1))) // Change counter + + if iAmt > 100 { + libc.Xmemset(tls, (aBuf + 100), 0, (uint64(iAmt - 100))) + rbuPutU16(tls, (aBuf + 105), (uint16(iAmt & 0xFFFF))) + *(*U8)(unsafe.Pointer(aBuf + 100)) = U8(0x0D) + } + } + } + } + if ((rc == SQLITE_OK) && (iOfst == int64(0))) && (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_MAIN_DB) != 0) { + // These look like magic numbers. But they are stable, as they are part + // of the definition of the SQLite file format, which may not change. + var pBuf uintptr = zBuf + (*Rbu_file)(unsafe.Pointer(p)).FiCookie = rbuGetU32(tls, (pBuf + 24)) + (*Rbu_file)(unsafe.Pointer(p)).FiWriteVer = *(*U8)(unsafe.Pointer(pBuf + 19)) + } + } + return rc +} + +// Write data to an rbuVfs-file. +func rbuVfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst Sqlite_int64) int32 { /* sqlite3.c:204694:12: */ + var p uintptr = pFile + var pRbu uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbu + var rc int32 + + if (pRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_CAPTURE) { + + rc = rbuCaptureDbWrite(tls, (*Rbu_file)(unsafe.Pointer(p)).FpRbu, iOfst) + } else { + if pRbu != 0 { + if (((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_OAL) && + (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_WAL) != 0)) && + (iOfst >= (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz) { + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FiOalSz = (Sqlite_int64(iAmt) + iOfst) + } else if ((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_DELETEONCLOSE) != 0 { + var szNew I64 = (Sqlite_int64(iAmt) + iOfst) + if szNew > (*Rbu_file)(unsafe.Pointer(p)).Fsz { + rc = rbuUpdateTempSize(tls, p, szNew) + if rc != SQLITE_OK { + return rc + } + } + } + } + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 24 /* &.xWrite */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst) + if ((rc == SQLITE_OK) && (iOfst == int64(0))) && (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_MAIN_DB) != 0) { + // These look like magic numbers. But they are stable, as they are part + // of the definition of the SQLite file format, which may not change. + var pBuf uintptr = zBuf + (*Rbu_file)(unsafe.Pointer(p)).FiCookie = rbuGetU32(tls, (pBuf + 24)) + (*Rbu_file)(unsafe.Pointer(p)).FiWriteVer = *(*U8)(unsafe.Pointer(pBuf + 19)) + } + } + return rc +} + +// Truncate an rbuVfs-file. +func rbuVfsTruncate(tls *libc.TLS, pFile uintptr, size Sqlite_int64) int32 { /* sqlite3.c:204737:12: */ + var p uintptr = pFile + if (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_DELETEONCLOSE) != 0) && ((*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0) { + var rc int32 = rbuUpdateTempSize(tls, p, size) + if rc != SQLITE_OK { + return rc + } + } + return (*(*func(*libc.TLS, uintptr, Sqlite3_int64) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 32 /* &.xTruncate */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, size) +} + +// Sync an rbuVfs-file. +func rbuVfsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* sqlite3.c:204749:12: */ + var p uintptr = pFile + if ((*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbu)).FeStage == RBU_STAGE_CAPTURE) { + if ((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_MAIN_DB) != 0 { + return SQLITE_INTERNAL + } + return SQLITE_OK + } + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 40 /* &.xSync */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, flags) +} + +// Return the current file-size of an rbuVfs-file. +func rbuVfsFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* sqlite3.c:204763:12: */ + var p uintptr = pFile + var rc int32 + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 48 /* &.xFileSize */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, pSize) + + // If this is an RBU vacuum operation and this is the target database, + // pretend that it has at least one page. Otherwise, SQLite will not + // check for the existance of a *-wal file. rbuVfsRead() contains + // similar logic. + if ((((rc == SQLITE_OK) && (*(*Sqlite_int64)(unsafe.Pointer(pSize)) == int64(0))) && + ((*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0)) && ((*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(p)).FpRbu))).FzTarget == uintptr(0))) && + (((*Rbu_file)(unsafe.Pointer(p)).FopenFlags & SQLITE_OPEN_MAIN_DB) != 0) { + *(*Sqlite_int64)(unsafe.Pointer(pSize)) = int64(1024) + } + return rc +} + +// Lock an rbuVfs-file. +func rbuVfsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* sqlite3.c:204784:12: */ + var p uintptr = pFile + var pRbu uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbu + var rc int32 = SQLITE_OK + + if (eLock == SQLITE_LOCK_EXCLUSIVE) && + (((*Rbu_file)(unsafe.Pointer(p)).FbNolock != 0) || ((pRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage != RBU_STAGE_DONE))) { + // Do not allow EXCLUSIVE locks. Preventing SQLite from taking this + // prevents it from checkpointing the database from sqlite3_close(). + rc = SQLITE_BUSY + } else { + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 56 /* &.xLock */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, eLock) + } + + return rc +} + +// Unlock an rbuVfs-file. +func rbuVfsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* sqlite3.c:204806:12: */ + var p uintptr = pFile + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 64 /* &.xUnlock */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, eLock) +} + +// Check if another file-handle holds a RESERVED lock on an rbuVfs-file. +func rbuVfsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* sqlite3.c:204814:12: */ + var p uintptr = pFile + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, pResOut) +} + +// File control method. For custom operations on an rbuVfs-file. +func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:204822:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var p uintptr = pFile + var xControl uintptr = (*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxFileControl + var rc int32 + + if op == SQLITE_FCNTL_RBU { + var pRbu uintptr = pArg + + // First try to find another RBU vfs lower down in the vfs stack. If + // one is found, this vfs will operate in pass-through mode. The lower + // level vfs will do the special RBU handling. + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, op, pArg) + + if rc == SQLITE_NOTFOUND { + // Now search for a zipvfs instance lower down in the VFS stack. If + // one is found, this is an error. + *(*uintptr)(unsafe.Pointer(bp + 16 /* dummy */)) = uintptr(0) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) + if rc == SQLITE_OK { + rc = SQLITE_ERROR + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30500 /* "rbu/zipvfs setup..." */, 0) + } else if rc == SQLITE_NOTFOUND { + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p + (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu + rbuMainlistAdd(tls, p) + if (*Rbu_file)(unsafe.Pointer(p)).FpWalFd != 0 { + (*Rbu_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpWalFd)).FpRbu = pRbu + } + rc = SQLITE_OK + } + } + return rc + } else if op == SQLITE_FCNTL_RBUCNT { + var pRbu uintptr = pArg + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FnRbu++ + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpRbuFd = p + (*Rbu_file)(unsafe.Pointer(p)).FbNolock = U8(1) + } + + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, op, pArg) + if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { + var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs + var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30523 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + *(*uintptr)(unsafe.Pointer(pArg)) = zOut + if zOut == uintptr(0) { + rc = SQLITE_NOMEM + } + } + + return rc +} + +// Return the sector-size in bytes for an rbuVfs-file. +func rbuVfsSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:204878:12: */ + var p uintptr = pFile + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 88 /* &.xSectorSize */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal) +} + +// Return the device characteristic flags supported by an rbuVfs-file. +func rbuVfsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:204886:12: */ + var p uintptr = pFile + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal) +} + +// Take or release a shared-memory lock. +func rbuVfsShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* sqlite3.c:204894:12: */ + var p uintptr = pFile + var pRbu uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbu + var rc int32 = SQLITE_OK + + if (pRbu != 0) && ((((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_OAL) || + ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_MOVE)) || + ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_DONE)) { + // Prevent SQLite from taking a shm-lock on the target file when it + // is supplying heap memory to the upper layer in place of *-shm + // segments. + if (ofst == WAL_LOCK_CKPT) && (n == 1) { + rc = SQLITE_BUSY + } + } else { + var bCapture int32 = 0 + if (pRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer(pRbu)).FeStage == RBU_STAGE_CAPTURE) { + bCapture = 1 + } + if (bCapture == 0) || (0 == (flags & SQLITE_SHM_UNLOCK)) { + rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 112 /* &.xShmLock */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, ofst, n, flags) + if (bCapture != 0) && (rc == SQLITE_OK) { + *(*U32)(unsafe.Pointer(pRbu + 316 /* &.mLock */)) |= (U32(((int32(1) << n) - 1) << ofst)) + } + } + } + + return rc +} + +// Obtain a pointer to a mapping of a single 32KiB page of the *-shm file. +func rbuVfsShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, isWrite int32, pp uintptr) int32 { /* sqlite3.c:204932:12: */ + var p uintptr = pFile + var rc int32 = SQLITE_OK + var eStage int32 = func() int32 { + if (*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0 { + return (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbu)).FeStage + } + return 0 + }() + + // If not in RBU_STAGE_OAL, allow this call to pass through. Or, if this + // rbu is in the RBU_STAGE_OAL state, use heap memory for *-shm space + // instead of a file on disk. + + if eStage == RBU_STAGE_OAL { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(iRegion + 1)) * uint64(unsafe.Sizeof(uintptr(0))))) + var apNew uintptr = Xsqlite3_realloc64(tls, (*Rbu_file)(unsafe.Pointer(p)).FapShm, uint64(nByte)) + + // This is an RBU connection that uses its own heap memory for the + // pages of the *-shm file. Since no other process can have run + // recovery, the connection must request *-shm pages in order + // from start to finish. + + if apNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, (apNew + uintptr((*Rbu_file)(unsafe.Pointer(p)).FnShm)*8), 0, (uint64(unsafe.Sizeof(uintptr(0))) * (uint64((1 + iRegion) - (*Rbu_file)(unsafe.Pointer(p)).FnShm)))) + (*Rbu_file)(unsafe.Pointer(p)).FapShm = apNew + (*Rbu_file)(unsafe.Pointer(p)).FnShm = (iRegion + 1) + } + + if rc == SQLITE_OK { + var pNew uintptr = Xsqlite3_malloc64(tls, uint64(szRegion)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint64(szRegion)) + *(*uintptr)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FapShm + uintptr(iRegion)*8)) = pNew + } + } + + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&pp))) = *(*uintptr)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FapShm + uintptr(iRegion)*8)) + } else { + *(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&pp))) = uintptr(0) + } + } else { + + rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 104 /* &.xShmMap */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, iRegion, szRegion, isWrite, libc.AtomicLoadUintptr(&pp)) + } + + return rc +} + +// Memory barrier. +func rbuVfsShmBarrier(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:204990:13: */ + var p uintptr = pFile + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 120 /* &.xShmBarrier */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal) +} + +// The xShmUnmap method. +func rbuVfsShmUnmap(tls *libc.TLS, pFile uintptr, delFlag int32) int32 { /* sqlite3.c:204998:12: */ + var p uintptr = pFile + var rc int32 = SQLITE_OK + var eStage int32 = func() int32 { + if (*Rbu_file)(unsafe.Pointer(p)).FpRbu != 0 { + return (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpRbu)).FeStage + } + return 0 + }() + + if (eStage == RBU_STAGE_OAL) || (eStage == RBU_STAGE_MOVE) { + // no-op + } else { + // Release the checkpointer and writer locks + rbuUnlockShm(tls, p) + rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 128 /* &.xShmUnmap */))))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, delFlag) + } + return rc +} + +// Open an rbu file handle. +func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* sqlite3.c:205017:12: */ + var pRbuVfs uintptr = pVfs + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRealVfs + var pFd uintptr = pFile + var rc int32 = SQLITE_OK + var zOpen uintptr = zName + var oflags int32 = flags + + libc.Xmemset(tls, pFd, 0, uint64(unsafe.Sizeof(Rbu_file{}))) + (*Rbu_file)(unsafe.Pointer(pFd)).FpReal = (pFd + 1*104) + (*Rbu_file)(unsafe.Pointer(pFd)).FpRbuVfs = pRbuVfs + (*Rbu_file)(unsafe.Pointer(pFd)).FopenFlags = flags + if zName != 0 { + if (flags & SQLITE_OPEN_MAIN_DB) != 0 { + // A main database has just been opened. The following block sets + // (pFd->zWal) to point to a buffer owned by SQLite that contains + // the name of the *-wal file this db connection will use. SQLite + // happens to pass a pointer to this buffer when using xAccess() + // or xOpen() to operate on the *-wal file. + (*Rbu_file)(unsafe.Pointer(pFd)).FzWal = Xsqlite3_filename_wal(tls, zName) + } else if (flags & SQLITE_OPEN_WAL) != 0 { + var pDb uintptr = rbuFindMaindb(tls, pRbuVfs, zName, 0) + if pDb != 0 { + if ((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu != 0) && ((*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == RBU_STAGE_OAL) { + // This call is to open a *-wal file. Intead, open the *-oal. + var nOpen Size_t + if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5459 /* "main" */) + zOpen = Xsqlite3_filename_wal(tls, zOpen) + } + nOpen = libc.Xstrlen(tls, zOpen) + *(*int8)(unsafe.Pointer((zOpen) + uintptr((nOpen - uint64(3))))) = int8('o') + (*Rbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Rbu_file)(unsafe.Pointer(pDb)).FpRbu + } + (*Rbu_file)(unsafe.Pointer(pDb)).FpWalFd = pFd + } + } + } else { + (*Rbu_file)(unsafe.Pointer(pFd)).FpRbu = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRbu + } + + if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && + (Xsqlite3_uri_boolean(tls, zName, ts+30534 /* "rbu_memory" */, 0) != 0) { + + oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) + zOpen = uintptr(0) + } + + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pRealVfs + 40 /* &.xOpen */))))(tls, pRealVfs, zOpen, (*Rbu_file)(unsafe.Pointer(pFd)).FpReal, oflags, pOutFlags) + } + if (*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pFd)).FpReal)).FpMethods != 0 { + // The xOpen() operation has succeeded. Set the sqlite3_file.pMethods + // pointer and, if the file is a main database file, link it into the + // mutex protected linked list of all such files. + (*Sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + if (flags & SQLITE_OPEN_MAIN_DB) != 0 { + rbuMainlistAdd(tls, pFd) + } + } else { + Xsqlite3_free(tls, (*Rbu_file)(unsafe.Pointer(pFd)).FzDel) + } + + return rc +} + +var rbuvfs_io_methods = Sqlite3_io_methods{ + FiVersion: 2, // iVersion + FxClose: 0, // xClose + FxRead: 0, // xRead + FxWrite: 0, // xWrite + FxTruncate: 0, // xTruncate + FxSync: 0, // xSync + FxFileSize: 0, // xFileSize + FxLock: 0, // xLock + FxUnlock: 0, // xUnlock + FxCheckReservedLock: 0, // xCheckReservedLock + FxFileControl: 0, // xFileControl + FxSectorSize: 0, // xSectorSize + FxDeviceCharacteristics: 0, // xDeviceCharacteristics + FxShmMap: 0, // xShmMap + FxShmLock: 0, // xShmLock + FxShmBarrier: 0, // xShmBarrier + FxShmUnmap: 0, // xFetch, xUnfetch +} /* sqlite3.c:205024:29 */ + +// Delete the file located at zPath. +func rbuVfsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* sqlite3.c:205115:12: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pRealVfs + 48 /* &.xDelete */))))(tls, pRealVfs, zPath, dirSync) +} + +// Test for access permissions. Return true if the requested permission +// is available, or false otherwise. +func rbuVfsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* sqlite3.c:205124:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pRbuVfs uintptr = pVfs + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).FpRealVfs + var rc int32 + + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pRealVfs + 56 /* &.xAccess */))))(tls, pRealVfs, zPath, flags, pResOut) + + // If this call is to check if a *-wal file associated with an RBU target + // database connection exists, and the RBU update is in RBU_STAGE_OAL, + // the following special handling is activated: + // + // a) if the *-wal file does exist, return SQLITE_CANTOPEN. This + // ensures that the RBU extension never tries to update a database + // in wal mode, even if the first page of the database file has + // been damaged. + // + // b) if the *-wal file does not exist, claim that it does anyway, + // causing SQLite to call xOpen() to open it. This call will also + // be intercepted (see the rbuVfsOpen() function) and the *-oal + // file opened instead. + if (rc == SQLITE_OK) && (flags == SQLITE_ACCESS_EXISTS) { + var pDb uintptr = rbuFindMaindb(tls, pRbuVfs, zPath, 1) + if (pDb != 0) && ((*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FeStage == RBU_STAGE_OAL) { + + if *(*int32)(unsafe.Pointer(pResOut)) != 0 { + rc = SQLITE_CANTOPEN + } else { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* sz */)) = int64(0) + rc = rbuVfsFileSize(tls, (pDb /* &.base */), bp /* &sz */) + *(*int32)(unsafe.Pointer(pResOut)) = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp /* sz */)) > int64(0))) + } + } + } + + return rc +} + +// Populate buffer zOut with the full canonical pathname corresponding +// to the pathname in zPath. zOut is guaranteed to point to a buffer +// of at least (DEVSYM_MAX_PATHNAME+1) bytes. +func rbuVfsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* sqlite3.c:205172:12: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pRealVfs + 64 /* &.xFullPathname */))))(tls, pRealVfs, zPath, nOut, zOut) +} + +// Open the dynamic library located at zPath and return a handle. +func rbuVfsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* sqlite3.c:205186:13: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pRealVfs + 72 /* &.xDlOpen */))))(tls, pRealVfs, zPath) +} + +// Populate the buffer zErrMsg (size nByte bytes) with a human readable +// utf-8 string describing the most recent error encountered associated +// with dynamic libraries. +func rbuVfsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* sqlite3.c:205196:13: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pRealVfs + 80 /* &.xDlError */))))(tls, pRealVfs, nByte, zErrMsg) +} + +// Return a pointer to the symbol zSymbol in the dynamic library pHandle. +func rbuVfsDlSym(tls *libc.TLS, pVfs uintptr, pArg uintptr, zSym uintptr) uintptr { /* sqlite3.c:205204:13: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((pRealVfs + 88 /* &.xDlSym */))))(tls, pRealVfs, pArg, zSym) +} + +// Close the dynamic library handle pHandle. +func rbuVfsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* sqlite3.c:205216:13: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pRealVfs + 96 /* &.xDlClose */))))(tls, pRealVfs, pHandle) +} + +// Populate the buffer pointed to by zBufOut with nByte bytes of +// random data. +func rbuVfsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* sqlite3.c:205226:12: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pRealVfs + 104 /* &.xRandomness */))))(tls, pRealVfs, nByte, zBufOut) +} + +// Sleep for nMicro microseconds. Return the number of microseconds +// actually slept. +func rbuVfsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* sqlite3.c:205235:12: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pRealVfs + 112 /* &.xSleep */))))(tls, pRealVfs, nMicro) +} + +// Return the current time as a Julian Day number in *pTimeOut. +func rbuVfsCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* sqlite3.c:205243:12: */ + var pRealVfs uintptr = (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRealVfs + return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pRealVfs + 120 /* &.xCurrentTime */))))(tls, pRealVfs, pTimeOut) +} + +// No-op. +func rbuVfsGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* sqlite3.c:205251:12: */ + return 0 +} + +// Deregister and destroy an RBU vfs created by an earlier call to +// sqlite3rbu_create_vfs(). +func Xsqlite3rbu_destroy_vfs(tls *libc.TLS, zName uintptr) { /* sqlite3.c:205259:17: */ + var pVfs uintptr = Xsqlite3_vfs_find(tls, zName) + if (pVfs != 0) && ((*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32 + }{rbuVfsOpen}))) { + Xsqlite3_mutex_free(tls, (*Rbu_vfs)(unsafe.Pointer(pVfs)).Fmutex) + Xsqlite3_vfs_unregister(tls, pVfs) + Xsqlite3_free(tls, pVfs) + } +} + +// Create an RBU VFS named zName that accesses the underlying file-system +// via existing VFS zParent. The new object is registered as a non-default +// VFS with SQLite before returning. +func Xsqlite3rbu_create_vfs(tls *libc.TLS, zName uintptr, zParent uintptr) int32 { /* sqlite3.c:205273:16: */ + + var pNew uintptr = uintptr(0) // Newly allocated VFS + var rc int32 = SQLITE_OK + var nName Size_t + var nByte Size_t + + nName = libc.Xstrlen(tls, zName) + nByte = ((uint64(unsafe.Sizeof(Rbu_vfs{})) + nName) + uint64(1)) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var pParent uintptr // Parent VFS + libc.Xmemset(tls, pNew, 0, nByte) + pParent = Xsqlite3_vfs_find(tls, zParent) + if pParent == uintptr(0) { + rc = SQLITE_NOTFOUND + } else { + var zSpace uintptr + libc.Xmemcpy(tls, (pNew /* &.base */), uintptr(unsafe.Pointer(&vfs_template)), uint64(unsafe.Sizeof(Sqlite3_vfs{}))) + (*Rbu_vfs)(unsafe.Pointer(pNew)).Fbase.FmxPathname = (*Sqlite3_vfs)(unsafe.Pointer(pParent)).FmxPathname + (*Rbu_vfs)(unsafe.Pointer(pNew)).Fbase.FszOsFile = (int32(uint64(unsafe.Sizeof(Rbu_file{})) + uint64((*Sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile))) + (*Rbu_vfs)(unsafe.Pointer(pNew)).FpRealVfs = pParent + (*Rbu_vfs)(unsafe.Pointer(pNew)).Fbase.FzName = libc.AssignUintptr(&zSpace, (pNew + 1*208)) + libc.Xmemcpy(tls, zSpace, zName, nName) + + // Allocate the mutex and register the new VFS (not as the default) + (*Rbu_vfs)(unsafe.Pointer(pNew)).Fmutex = Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_RECURSIVE) + if (*Rbu_vfs)(unsafe.Pointer(pNew)).Fmutex == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = Xsqlite3_vfs_register(tls, (pNew /* &.base */), 0) + } + } + + if rc != SQLITE_OK { + Xsqlite3_mutex_free(tls, (*Rbu_vfs)(unsafe.Pointer(pNew)).Fmutex) + Xsqlite3_free(tls, pNew) + } + } + + return rc +} + +var vfs_template = Sqlite3_vfs{ + FiVersion: 1, // pAppData + FxOpen: 0, // xOpen + FxDelete: 0, // xDelete + FxAccess: 0, // xAccess + FxFullPathname: 0, // xFullPathname + + FxDlOpen: 0, // xDlOpen + FxDlError: 0, // xDlError + FxDlSym: 0, // xDlSym + FxDlClose: 0, // xDlClose + + FxRandomness: 0, // xRandomness + FxSleep: 0, // xSleep + FxCurrentTime: 0, // xCurrentTime + FxGetLastError: 0, // Unimplemented version 3 methods +} /* sqlite3.c:205276:22 */ + +// Configure the aggregate temp file size limit for this RBU handle. +func Xsqlite3rbu_temp_size_limit(tls *libc.TLS, pRbu uintptr, n Sqlite3_int64) Sqlite3_int64 { /* sqlite3.c:205351:26: */ + if n >= int64(0) { + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit = n + } + return (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FszTempLimit +} + +func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlite3.c:205358:26: */ + return (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FszTemp +} + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + _ [4]byte + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + _ [4]byte + FaData uintptr + FnData int32 + _ [4]byte + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 + _ [4]byte +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nVarint + 1))), z, uint64(n)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 8 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.Xmemcpy(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint64(8)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint64(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint64(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+16, 4 + + var aOld uintptr + // var nNew int32 at bp+40, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+16 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+40 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.Xmemcpy(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+44, 4 + + var aOld uintptr + // var nNew int32 at bp+48, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+44 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+48 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 44 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.Xmemcpy(tls, aOut, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 8 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint64(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 8 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10073 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+30545 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+756 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+30666 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(uint64(nDbCol) * ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))) + uint64(1))))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*8) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, (uint64(nThis + 1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, (uint64(nName + 1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 8 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 16 /* &.nCol */), uintptr(0), (pTab + 24 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10073 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += I64((uint64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + uint64(1)))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 24 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 32 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.Xmemcpy(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint64(8)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + // var iHash int32 at bp+48, 4 + + // var bNull int32 at bp+52, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 48 + + var p uintptr + // var p1 uintptr at bp+56, 8 + + // var p2 uintptr at bp+72, 8 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+64, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 24 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+756 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+48 /* &iHash */, bp+52 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)), bp+64 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.Xmemset(tls, pC, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*32) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)), bp+64 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 48 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 8 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 + _ [4]byte +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+30695, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 19878 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+30729, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 30770 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6507 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+30775, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+30853, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 16 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+24, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+40, 8 + + // var azCol uintptr at bp+32, 8 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+16, 8 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.Xmemset(tls, bp /* &d */, 0, uint64(unsafe.Sizeof(SessionDiffCtx{}))) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+16 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24 /* &nCol */, uintptr(0), bp+32 /* &azCol */, bp+40 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol + uintptr(i)*8))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+30906 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(Sqlite3_session{})) + uint64(nDb)) + uint64(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_session{}))) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*136) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.Xmemcpy(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint64(nDb + 1))) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 8 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 80 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionTable{})) + uint64(nName)) + uint64(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint64(nName + 1))) + for ppTab = (pSession + 88 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint64(nBlob)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint64(nStr)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([24]int8{})) - uint64(1))), bp+8 /* &aBuf[0] */, ts+4090 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = (int32((int64(zOut) - int64((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint64(8)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+32 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+32 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, (int32((int64(a) - int64(pStart)) / 1)), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10073 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+30933 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 756 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31043 /* "SELECT * FROM " */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+769 /* "." */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31058 /* " WHERE " */, bp+24 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31066 /* " IS ?" */, bp+24 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+24 /* &rc */) + zSep = ts + 19878 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp /* &rVal */, bp+8 /* &iVal */, uint64(8)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+40, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31072 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+16, 8 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+8 /* &azCol */, bp+16 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+24 /* &buf */, bPatchset, pTab, bp+40 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), bp+48 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+24 /* &buf */, uint8(SQLITE_INSERT), bp+40 /* &rc */) + sessionAppendByte(tls, bp+24 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+40 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+24 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), iCol, bp+40 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendUpdate(tls, bp+24 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendDelete(tls, bp+24 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31092 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.Xmemmove(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint64(nMove)) + } + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+32 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 48 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, aCopy, aData, uint64(nData)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &d */, bp+16 /* &v */, uint64(8)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 120 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)) + uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 72 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)) + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */)))) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*8) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+100 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2))) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+100 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*8)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var rc int32 at bp+40, 4 + // Return value + // var sOut SessionBuffer at bp, 16 + // Output buffer + // var nCol int32 at bp+20, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+24, 16 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+16, 4 + + var nVar int32 + // var nByte1 int32 at bp+44, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.Xmemset(tls, bp /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+16 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+20 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+24 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 16 /* nByte */)), bp+40 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 16 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+44 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */)), bp+40 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+40 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))*8), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) + }())))*8)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+40 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+40 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + var rc int32 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + _ [4]byte + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [6]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 64 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint64(nU32)*uint64(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionUpdate{})) * uint64(nU32)) * uint64(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10073 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 756 /* "" */ + // var buf SessionBuffer at bp, 16 + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*24) + libc.Xmemcpy(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + + sessionAppendStr(tls, bp /* &buf */, ts+31110 /* "UPDATE main." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31123 /* " SET " */, bp+16 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31129 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+16 /* &rc */) + zSep = ts + 13325 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 756 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31058 /* " WHERE " */, bp+16 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*8)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31134 /* "idx IS CASE WHEN..." */, bp+16 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31066 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+16 /* &rc */) + } + zSep = ts + 19878 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + var zSep uintptr = ts + 756 /* "" */ + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31209 /* "DELETE FROM main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31058 /* " WHERE " */, bp+16 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31129 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 19878 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31227 /* " AND (?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+30770 /* " OR " */, bp+16 /* &rc */) + + zSep = ts + 756 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31066 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 31235 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4067 /* ")" */, bp+16 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5459 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 24 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31240 /* "INSERT INTO main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+19884 /* "(" */, bp+16 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13325 /* ", " */, bp+16 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31258 /* ") VALUES(?" */, bp+16 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31269 /* ", ?" */, bp+16 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4067 /* ")" */, bp+16 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 16 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10073 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 16 /* &.pInsert */), + + ts+31273 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pDelete */), + + ts+31386 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 8 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var nCol int32 at bp+8, 4 + // Number of columns in table + // var op int32 at bp+12, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 8 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 104 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 104 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 104 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+8 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8 /* &pVal */) + } + sessionAppendValue(tls, (p + 104 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+16, 4 + + // var nCol int32 at bp+8, 4 + + // var op int32 at bp+12, 4 + + // var zDummy uintptr at bp, 8 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 88 /* &.constraints */), aBlob, nBlob, bp+16 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var zDummy uintptr at bp, 8 + + // var op int32 at bp+12, 4 + + // var nCol int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 8 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+16 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*8)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*8)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31530 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31551 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, (pApply + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint64(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint64(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 72 /* &.tblhdr */), int64(nByte), bp+8 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte) + } + + for (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(368) + defer tls.Free(368) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 128 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.Xmemset(tls, bp+48 /* &sApply */, 0, uint64(unsafe.Sizeof(SessionApplyCtx{}))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+31570 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31596 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+184, 4 + + // var op int32 at bp+188, 4 + + // var zNew uintptr at bp+176, 8 + + Xsqlite3changeset_op(tls, pIter, bp+176 /* &zNew */, bp+184 /* &nCol */, bp+188 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+192, 8 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.Xmemset(tls, (bp + 48 /* &sApply */ + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+192 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5459 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), (bp + 48 /* &sApply */ + 32 /* &.nCol */), bp+200 /* &zTab */, (bp + 48 /* &sApply */ + 40 /* &.azCol */), (bp + 48 /* &sApply */ + 48 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31626 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+31670, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 192 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31741 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), ts+10073 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+208, 4 + + // var notUsed int32 at bp+212, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+208 /* &nFk */, bp+212 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+216, 152 + + libc.Xmemset(tls, bp+216 /* &sIter */, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 216 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+216 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+31801 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31831 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+31855 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+31831 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(SessionChange{})) + uint64(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*32) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint64(nIn)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.Xmemset(tls, pNew, 0, uint64(nByte)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+8, 8 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(SessionChange{})) + uint64((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+16 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+24 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */))) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var aRec uintptr at bp, 8 + + // var nRec int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+16, 8 + + // var nCol int32 at bp+24, 4 + + // var op int32 at bp+28, 4 + + var iHash int32 + // var bIndirect int32 at bp+32, 4 + + // var pChange uintptr at bp+48, 8 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+16 /* &zNew */, bp+24 /* &nCol */, bp+28 /* &op */, bp+32 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)))) + // var abPK uintptr at bp+40, 8 + + Xsqlite3changeset_pk(tls, pIter, bp+40 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(SessionTable{})) + uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + uint64(nNew)) + uint64(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 24 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (uint64(nNew + 1))) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28 /* op */)), *(*int32)(unsafe.Pointer(bp + 32 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+48 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+16 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+16 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+16 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3_changegroup{}))) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint64(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint64(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 16 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, bp+12 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+16 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+32 /* &rc */) + sessionAppendVarint(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+32 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_UPDATE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+40 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_INSERT), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)), (int32(int64(*(*int32)(unsafe.Pointer(bp + 8 /* nRec */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */))) - int64(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1))), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+16 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_DELETE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + libc.Xmemset(tls, bp+16 /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_rebaser{}))) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + +//************* End of sqlite3session.c ************************************* +//************* Begin file fts5.c ******************************************* + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Interfaces to extend FTS5. Using the interfaces defined in this file, +// FTS5 may be extended with: +// +// * custom tokenizers, and +// * custom auxiliary functions. + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// #include "fts5.h" +// #include "sqlite3ext.h" + +// #include +// #include + +// Truncate very long tokens to this many bytes. Hard limit is +// (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset +// field that occurs at the start of each leaf page (see fts5_index.c). + +// Maximum number of prefix indexes on single FTS5 table. This must be +// less than 32. If it is set to anything large than that, an #error +// directive in fts5_index.c will cause the build to fail. + +// Maximum segments permitted in a single index + +// Name of rank and rowid columns + +// The assert_nc() macro is similar to the assert() macro, except that it +// is used for assert() conditions that are true only if it can be +// guranteed that the database is not corrupt. + +// A version of memcmp() that does not cause asan errors if one of the pointer +// parameters is NULL and the number of bytes to compare is zero. + +// Mark a function parameter as unused, to suppress nuisance compiler +// warnings. + +type Fts5Global1 = struct { + Fapi Fts5_api + Fdb uintptr + FiNextId I64 + FpAux uintptr + FpTok uintptr + FpDfltTok uintptr + FpCsr uintptr +} /* sqlite3.c:213118:9 */ + +//************* End of sqlite3session.c ************************************* +//************* Begin file fts5.c ******************************************* + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Interfaces to extend FTS5. Using the interfaces defined in this file, +// FTS5 may be extended with: +// +// * custom tokenizers, and +// * custom auxiliary functions. + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// #include "fts5.h" +// #include "sqlite3ext.h" + +// #include +// #include + +// Truncate very long tokens to this many bytes. Hard limit is +// (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset +// field that occurs at the start of each leaf page (see fts5_index.c). + +// Maximum number of prefix indexes on single FTS5 table. This must be +// less than 32. If it is set to anything large than that, an #error +// directive in fts5_index.c will cause the build to fail. + +// Maximum segments permitted in a single index + +// Name of rank and rowid columns + +// The assert_nc() macro is similar to the assert() macro, except that it +// is used for assert() conditions that are true only if it can be +// guranteed that the database is not corrupt. + +// A version of memcmp() that does not cause asan errors if one of the pointer +// parameters is NULL and the number of bytes to compare is zero. + +// Mark a function parameter as unused, to suppress nuisance compiler +// warnings. + +type Fts5Global = Fts5Global1 /* sqlite3.c:213118:27 */ +type Fts5Colset1 = struct { + FnCol int32 + FaiCol [1]int32 +} /* sqlite3.c:213118:9 */ + +type Fts5Colset = Fts5Colset1 /* sqlite3.c:213119:27 */ + +// ************************************************************************* +// +// Interface to code in fts5_config.c. fts5_config.c contains contains code +// to parse the arguments passed to the CREATE VIRTUAL TABLE statement. + +type Fts5Config1 = struct { + Fdb uintptr + FzDb uintptr + FzName uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabUnindexed uintptr + FnPrefix int32 + _ [4]byte + FaPrefix uintptr + FeContent int32 + _ [4]byte + FzContent uintptr + FzContentRowid uintptr + FbColumnsize int32 + FeDetail int32 + FzContentExprlist uintptr + FpTok uintptr + FpTokApi uintptr + FbLock int32 + FePattern int32 + FiCookie int32 + Fpgsz int32 + FnAutomerge int32 + FnCrisisMerge int32 + FnUsermerge int32 + FnHashSize int32 + FzRank uintptr + FzRankArgs uintptr + FpzErrmsg uintptr +} /* sqlite3.c:213118:9 */ + +// ************************************************************************* +// +// Interface to code in fts5_config.c. fts5_config.c contains contains code +// to parse the arguments passed to the CREATE VIRTUAL TABLE statement. + +type Fts5Config = Fts5Config1 /* sqlite3.c:213139:27 */ + +// +// End of interface to code in fts5_config.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_buffer.c. + +// Buffer object for the incremental building of string data. +type Fts5Buffer1 = struct { + Fp uintptr + Fn int32 + FnSpace int32 +} /* sqlite3.c:213118:9 */ + +// +// End of interface to code in fts5_config.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_buffer.c. + +// Buffer object for the incremental building of string data. +type Fts5Buffer = Fts5Buffer1 /* sqlite3.c:213265:27 */ + +type Fts5PoslistReader1 = struct { + Fa uintptr + Fn int32 + Fi int32 + FbFlag U8 + FbEof U8 + _ [6]byte + FiPos I64 +} /* sqlite3.c:213118:9 */ + +type Fts5PoslistReader = Fts5PoslistReader1 /* sqlite3.c:213301:34 */ + +type Fts5PoslistWriter1 = struct{ FiPrev I64 } /* sqlite3.c:213320:9 */ + +type Fts5PoslistWriter = Fts5PoslistWriter1 /* sqlite3.c:213320:34 */ + +// Bucket of terms object used by the integrity-check in offsets=0 mode. +type Fts5Termset1 = struct{ FapHash [512]uintptr } /* sqlite3.c:213342:9 */ + +// Bucket of terms object used by the integrity-check in offsets=0 mode. +type Fts5Termset = Fts5Termset1 /* sqlite3.c:213342:28 */ + +// +// End of interface to code in fts5_buffer.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_index.c. fts5_index.c contains contains code +// to access the data stored in the %_data table. + +type Fts5Index1 = struct { + FpConfig uintptr + FzDataTbl uintptr + FnWorkUnit int32 + _ [4]byte + FpHash uintptr + FnPendingData int32 + _ [4]byte + FiWriteRowid I64 + FbDelete int32 + Frc int32 + FpReader uintptr + FpWriter uintptr + FpDeleter uintptr + FpIdxWriter uintptr + FpIdxDeleter uintptr + FpIdxSelect uintptr + FnRead int32 + _ [4]byte + FpDataVersion uintptr + FiStructVersion I64 + FpStruct uintptr +} /* sqlite3.c:213118:9 */ + +// +// End of interface to code in fts5_buffer.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_index.c. fts5_index.c contains contains code +// to access the data stored in the %_data table. + +type Fts5Index = Fts5Index1 /* sqlite3.c:213356:26 */ +type Fts5IndexIter1 = struct { + FiRowid I64 + FpData uintptr + FnData int32 + FbEof U8 + _ [3]byte +} /* sqlite3.c:213118:9 */ + +type Fts5IndexIter = Fts5IndexIter1 /* sqlite3.c:213357:30 */ + +// +// End of interface to code in fts5_varint.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_main.c. + +// Virtual-table object. +type Fts5Table1 = struct { + Fbase Sqlite3_vtab + FpConfig uintptr + FpIndex uintptr +} /* sqlite3.c:213556:9 */ + +// +// End of interface to code in fts5_varint.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_main.c. + +// Virtual-table object. +type Fts5Table = Fts5Table1 /* sqlite3.c:213556:26 */ + +// +// End of interface to code in fts5.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_hash.c. +type Fts5Hash1 = struct { + FeDetail int32 + _ [4]byte + FpnByte uintptr + FnEntry int32 + FnSlot int32 + FpScan uintptr + FaSlot uintptr +} /* sqlite3.c:213118:9 */ + +// +// End of interface to code in fts5.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_hash.c. +type Fts5Hash = Fts5Hash1 /* sqlite3.c:213582:25 */ + +// +// End of interface to code in fts5_hash.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_storage.c. fts5_storage.c contains contains +// code to access the data stored in the %_content and %_docsize tables. + +type Fts5Storage1 = struct { + FpConfig uintptr + FpIndex uintptr + FbTotalsValid int32 + _ [4]byte + FnTotalRow I64 + FaTotalSize uintptr + FaStmt [11]uintptr +} /* sqlite3.c:213638:9 */ + +// +// End of interface to code in fts5_hash.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_storage.c. fts5_storage.c contains contains +// code to access the data stored in the %_content and %_docsize tables. + +type Fts5Storage = Fts5Storage1 /* sqlite3.c:213638:28 */ + +// +// End of interface to code in fts5_storage.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_expr.c. +type Fts5Expr1 = struct { + FpIndex uintptr + FpConfig uintptr + FpRoot uintptr + FbDesc int32 + FnPhrase int32 + FapExprPhrase uintptr +} /* sqlite3.c:213118:9 */ + +// +// End of interface to code in fts5_storage.c. +// + +// ************************************************************************* +// +// Interface to code in fts5_expr.c. +type Fts5Expr = Fts5Expr1 /* sqlite3.c:213681:25 */ +type Fts5ExprNode1 = struct { + FeType int32 + FbEof int32 + FbNomatch int32 + _ [4]byte + FxNext uintptr + FiRowid I64 + FpNear uintptr + FnChild int32 + _ [4]byte + FapChild [1]uintptr +} /* sqlite3.c:213118:9 */ + +type Fts5ExprNode = Fts5ExprNode1 /* sqlite3.c:213682:29 */ +type Fts5Parse1 = struct { + FpConfig uintptr + FzErr uintptr + Frc int32 + FnPhrase int32 + FapPhrase uintptr + FpExpr uintptr + FbPhraseToAnd int32 + _ [4]byte +} /* sqlite3.c:213683:9 */ + +type Fts5Parse = Fts5Parse1 /* sqlite3.c:213683:26 */ +type Fts5Token1 = struct { + Fp uintptr + Fn int32 + _ [4]byte +} /* sqlite3.c:213684:9 */ + +type Fts5Token = Fts5Token1 /* sqlite3.c:213684:26 */ +type Fts5ExprPhrase1 = struct { + FpNode uintptr + Fposlist Fts5Buffer + FnTerm int32 + _ [4]byte + FaTerm [1]Fts5ExprTerm +} /* sqlite3.c:213118:9 */ + +type Fts5ExprPhrase = Fts5ExprPhrase1 /* sqlite3.c:213685:31 */ +type Fts5ExprNearset1 = struct { + FnNear int32 + _ [4]byte + FpColset uintptr + FnPhrase int32 + _ [4]byte + FapPhrase [1]uintptr +} /* sqlite3.c:213118:9 */ + +type Fts5ExprNearset = Fts5ExprNearset1 /* sqlite3.c:213686:32 */ + +type Fts5PoslistPopulator1 = struct { + Fwriter Fts5PoslistWriter + FbOk int32 + FbMiss int32 +} /* sqlite3.c:213734:9 */ + +type Fts5PoslistPopulator = Fts5PoslistPopulator1 /* sqlite3.c:213734:37 */ +// +// End of interface to code in fts5_unicode2.c. +// + +// This file is automatically generated by Lemon from input grammar +// source file "fts5parse.y". +// 2000-05-29 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// Driver template for the LEMON parser generator. +// +// The "lemon" program processes an LALR(1) input grammar file, then uses +// this template to construct a parser. The "lemon" program inserts text +// at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +// interstitial "-" characters) contained in this template is changed into +// the value of the %name directive from the grammar. Otherwise, the content +// of this template is copied straight through into the generate parser +// source file. +// +// The following is the concatenation of all %include directives from the +// input grammar file: +//*********** Begin %include sections from the grammar *********************** + +// #include "fts5Int.h" +// #include "fts5parse.h" + +// Disable all error recovery processing in the parser push-down +// automaton. + +// Make fts5yytestcase() the same as testcase() + +// Indicate that sqlite3ParserFree() will never be called with a null +// pointer. + +// Alternative datatype for the argument to the malloc() routine passed +// into sqlite3ParserAlloc(). The default is size_t. + +//*************** End of %include directives ********************************* +// These constants specify the various numeric values for terminal symbols. +// Begin token definitions ************************************ +//*************** End token definitions ************************************** + +// The next sections is a series of control #defines. +// various aspects of the generated parser. +// fts5YYCODETYPE is the data type used to store the integer codes +// that represent terminal and non-terminal symbols. +// "unsigned char" is used if there are fewer than +// 256 symbols. Larger types otherwise. +// fts5YYNOCODE is a number of type fts5YYCODETYPE that is not used for +// any terminal or nonterminal symbol. +// fts5YYFALLBACK If defined, this indicates that one or more tokens +// (also known as: "terminal symbols") have fall-back +// values which should be used if the original symbol +// would not parse. This permits keywords to sometimes +// be used as identifiers, for example. +// fts5YYACTIONTYPE is the data type used for "action codes" - numbers +// that indicate what to do in response to the next +// token. +// sqlite3Fts5ParserFTS5TOKENTYPE is the data type used for minor type for terminal +// symbols. Background: A "minor type" is a semantic +// value associated with a terminal or non-terminal +// symbols. For example, for an "ID" terminal symbol, +// the minor type might be the name of the identifier. +// Each non-terminal can have a different minor type. +// Terminal symbols all have the same minor type, though. +// This macros defines the minor type for terminal +// symbols. +// fts5YYMINORTYPE is the data type used for all minor types. +// This is typically a union of many types, one of +// which is sqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union +// for terminal symbols is called "fts5yy0". +// fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If +// zero the stack is dynamically sized using realloc() +// sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument +// sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument +// sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter +// sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser +// sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser +// sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context +// fts5YYERRORSYMBOL is the code number of the error symbol. If not +// defined, then do no error processing. +// fts5YYNSTATE the combined number of states. +// fts5YYNRULE the number of rules in the grammar +// fts5YYNFTS5TOKEN Number of terminal symbols +// fts5YY_MAX_SHIFT Maximum value for shift actions +// fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +// fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +// fts5YY_ERROR_ACTION The fts5yy_action[] code for syntax error +// fts5YY_ACCEPT_ACTION The fts5yy_action[] code for accept +// fts5YY_NO_ACTION The fts5yy_action[] code for no-op +// fts5YY_MIN_REDUCE Minimum value for reduce actions +// fts5YY_MAX_REDUCE Maximum value for reduce actions +//************ Begin control #defines **************************************** +type Fts5YYMINORTYPE = struct { + _ [0]uint64 + Ffts5yyinit int32 + _ [12]byte +} /* sqlite3.c:214010:3 */ +//************ End control #defines ****************************************** + +// Define the fts5yytestcase() macro to be a no-op if is not already defined +// otherwise. +// +// Applications can choose to define fts5yytestcase() in the %include section +// to a macro that can assist in verifying code coverage. For production +// code the fts5yytestcase() macro should be turned off. But it is useful +// for testing. + +// Next are the tables used to determine what action to take based on the +// current state and lookahead token. These tables are used to implement +// functions that take a state number and lookahead value and return an +// action integer. +// +// Suppose the action integer is N. Then the action is determined as +// follows +// +// 0 <= N <= fts5YY_MAX_SHIFT Shift N. That is, push the lookahead +// token onto the stack and goto state N. +// +// N between fts5YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +// and fts5YY_MAX_SHIFTREDUCE reduce by rule N-fts5YY_MIN_SHIFTREDUCE. +// +// N == fts5YY_ERROR_ACTION A syntax error has occurred. +// +// N == fts5YY_ACCEPT_ACTION The parser accepts its input. +// +// N == fts5YY_NO_ACTION No such action. Denotes unused +// slots in the fts5yy_action[] table. +// +// N between fts5YY_MIN_REDUCE Reduce by rule N-fts5YY_MIN_REDUCE +// and fts5YY_MAX_REDUCE +// +// The action table is constructed as a single large table named fts5yy_action[]. +// Given state S and lookahead X, the action is computed as either: +// +// (A) N = fts5yy_action[ fts5yy_shift_ofst[S] + X ] +// (B) N = fts5yy_default[S] +// +// The (A) formula is preferred. The B formula is used instead if +// fts5yy_lookahead[fts5yy_shift_ofst[S]+X] is not equal to X. +// +// The formulas above are for computing the action when the lookahead is +// a terminal symbol. If the lookahead is a non-terminal (as occurs after +// a reduce action) then the fts5yy_reduce_ofst[] array is used in place of +// the fts5yy_shift_ofst[] array. +// +// The following are the tables generated in this section: +// +// fts5yy_action[] A single table containing all actions. +// fts5yy_lookahead[] A table containing the lookahead for each entry in +// fts5yy_action. Used to detect hash collisions. +// fts5yy_shift_ofst[] For each state, the offset into fts5yy_action for +// shifting terminals. +// fts5yy_reduce_ofst[] For each state, the offset into fts5yy_action for +// shifting non-terminals after a reduce. +// fts5yy_default[] Default action for each state. +// +// Begin parsing tables ********************************************* +var fts5yy_action = [105]uint8{ + /* 0 */ uint8(81), uint8(20), uint8(96), uint8(6), uint8(28), uint8(99), uint8(98), uint8(26), uint8(26), uint8(18), + /* 10 */ uint8(96), uint8(6), uint8(28), uint8(17), uint8(98), uint8(56), uint8(26), uint8(19), uint8(96), uint8(6), + /* 20 */ uint8(28), uint8(14), uint8(98), uint8(14), uint8(26), uint8(31), uint8(92), uint8(96), uint8(6), uint8(28), + /* 30 */ uint8(108), uint8(98), uint8(25), uint8(26), uint8(21), uint8(96), uint8(6), uint8(28), uint8(78), uint8(98), + /* 40 */ uint8(58), uint8(26), uint8(29), uint8(96), uint8(6), uint8(28), uint8(107), uint8(98), uint8(22), uint8(26), + /* 50 */ uint8(24), uint8(16), uint8(12), uint8(11), uint8(1), uint8(13), uint8(13), uint8(24), uint8(16), uint8(23), + /* 60 */ uint8(11), uint8(33), uint8(34), uint8(13), uint8(97), uint8(8), uint8(27), uint8(32), uint8(98), uint8(7), + /* 70 */ uint8(26), uint8(3), uint8(4), uint8(5), uint8(3), uint8(4), uint8(5), uint8(3), uint8(83), uint8(4), + /* 80 */ uint8(5), uint8(3), uint8(63), uint8(5), uint8(3), uint8(62), uint8(12), uint8(2), uint8(86), uint8(13), + /* 90 */ uint8(9), uint8(30), uint8(10), uint8(10), uint8(54), uint8(57), uint8(75), uint8(78), uint8(78), uint8(53), + /* 100 */ uint8(57), uint8(15), uint8(82), uint8(82), uint8(71), +} /* sqlite3.c:214103:31 */ +var fts5yy_lookahead = [121]uint8{ + /* 0 */ uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(22), uint8(22), uint8(24), uint8(24), uint8(17), + /* 10 */ uint8(18), uint8(19), uint8(20), uint8(7), uint8(22), uint8(9), uint8(24), uint8(17), uint8(18), uint8(19), + /* 20 */ uint8(20), uint8(9), uint8(22), uint8(9), uint8(24), uint8(13), uint8(17), uint8(18), uint8(19), uint8(20), + /* 30 */ uint8(26), uint8(22), uint8(24), uint8(24), uint8(17), uint8(18), uint8(19), uint8(20), uint8(15), uint8(22), + /* 40 */ uint8(9), uint8(24), uint8(17), uint8(18), uint8(19), uint8(20), uint8(26), uint8(22), uint8(21), uint8(24), + /* 50 */ uint8(6), uint8(7), uint8(9), uint8(9), uint8(10), uint8(12), uint8(12), uint8(6), uint8(7), uint8(21), + /* 60 */ uint8(9), uint8(24), uint8(25), uint8(12), uint8(18), uint8(5), uint8(20), uint8(14), uint8(22), uint8(5), + /* 70 */ uint8(24), uint8(3), uint8(1), uint8(2), uint8(3), uint8(1), uint8(2), uint8(3), uint8(0), uint8(1), + /* 80 */ uint8(2), uint8(3), uint8(11), uint8(2), uint8(3), uint8(11), uint8(9), uint8(10), uint8(5), uint8(12), + /* 90 */ uint8(23), uint8(24), uint8(10), uint8(10), uint8(8), uint8(9), uint8(9), uint8(15), uint8(15), uint8(8), + /* 100 */ uint8(9), uint8(9), uint8(27), uint8(27), uint8(11), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* 110 */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), + /* 120 */ uint8(27), +} /* sqlite3.c:214116:29 */ +var fts5yy_shift_ofst = [35]uint8{ + /* 0 */ uint8(44), uint8(44), uint8(44), uint8(44), uint8(44), uint8(44), uint8(51), uint8(77), uint8(43), uint8(12), + /* 10 */ uint8(14), uint8(83), uint8(82), uint8(14), uint8(23), uint8(23), uint8(31), uint8(31), uint8(71), uint8(74), + /* 20 */ uint8(78), uint8(81), uint8(86), uint8(91), uint8(6), uint8(53), uint8(53), uint8(60), uint8(64), uint8(68), + /* 30 */ uint8(53), uint8(87), uint8(92), uint8(53), uint8(93), +} /* sqlite3.c:214134:28 */ +var fts5yy_reduce_ofst = [18]int8{ + /* 0 */ int8(-16), int8(-8), int8(0), int8(9), int8(17), int8(25), int8(46), int8(-17), int8(-17), int8(37), + /* 10 */ int8(67), int8(4), int8(4), int8(8), int8(4), int8(20), int8(27), int8(38), +} /* sqlite3.c:214143:26 */ +var fts5yy_default = [35]uint8{ + /* 0 */ uint8(80), uint8(80), uint8(80), uint8(80), uint8(80), uint8(80), uint8(95), uint8(80), uint8(80), uint8(105), + /* 10 */ uint8(80), uint8(110), uint8(110), uint8(80), uint8(110), uint8(110), uint8(80), uint8(80), uint8(80), uint8(80), + /* 20 */ uint8(80), uint8(91), uint8(80), uint8(80), uint8(80), uint8(101), uint8(100), uint8(80), uint8(80), uint8(90), + /* 30 */ uint8(103), uint8(80), uint8(80), uint8(104), uint8(80), +} /* sqlite3.c:214147:31 */ +//********* End of lemon-generated parsing tables **************************** + +// The next table maps tokens (terminal symbols) into fallback tokens. +// If a construct like the following: +// +// %fallback ID X Y Z. +// +// appears in the grammar, then ID becomes a fallback token for X, Y, +// and Z. Whenever one of the tokens X, Y, or Z is input to the parser +// but it does not parse, the type of the token is changed to ID and +// the parse is retried before an error is thrown. +// +// This feature can be used, for example, to cause some keywords in a language +// to revert to identifiers if they keyword does not apply in the context where +// it appears. + +// The following structure represents a single element of the +// parser's stack. Information stored includes: +// +// + The state number for the parser at this level of the stack. +// +// + The value of the token stored at this level of the stack. +// (In other words, the "major" token.) +// +// + The semantic value stored at this level of the stack. This is +// the information used by the action routines in the grammar. +// It is sometimes called the "minor" token. +// +// After the "shift" half of a SHIFTREDUCE action, the stateno field +// actually contains the reduce action for the second half of the +// SHIFTREDUCE. +type fts5yyStackEntry = struct { + Fstateno uint8 + Fmajor uint8 + _ [6]byte + Fminor Fts5YYMINORTYPE +} /* sqlite3.c:214190:1 */ + +type Fts5yyStackEntry = fts5yyStackEntry /* sqlite3.c:214197:33 */ + +// The state of the parser is completely contained in an instance of +// the following structure +type fts5yyParser = struct { + Ffts5yytos uintptr + FpParse uintptr + Ffts5yystack [100]Fts5yyStackEntry + Ffts5yystackEnd uintptr +} /* sqlite3.c:214201:1 */ + +type Fts5yyParser = fts5yyParser /* sqlite3.c:214220:29 */ + +// Datatype of the argument to the memory allocated passed as the +// second argument to sqlite3Fts5ParserAlloc() below. This can be changed by +// putting an appropriate #define in the %include section of the input +// grammar. + +// Initialize a new parser that has already been allocated. +func sqlite3Fts5ParserInit(tls *libc.TLS, fts5yypRawParser uintptr) { /* sqlite3.c:214369:13: */ + var fts5yypParser uintptr = fts5yypRawParser + + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos = fts5yypParser + 16 /* &.fts5yystack */ + (*Fts5yyStackEntry)(unsafe.Pointer((fts5yypParser + 16 /* &.fts5yystack */))).Fstateno = uint8(0) + (*Fts5yyStackEntry)(unsafe.Pointer((fts5yypParser + 16 /* &.fts5yystack */))).Fmajor = uint8(0) + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystackEnd = ((fts5yypParser + 16 /* &.fts5yystack */) + 99*24) +} + +// This function allocates a new parser. +// The only argument is a pointer to a function which works like +// malloc. +// +// Inputs: +// A pointer to the function used to allocate memory. +// +// Outputs: +// A pointer to a parser. This pointer is used in subsequent calls +// to sqlite3Fts5Parser and sqlite3Fts5ParserFree. +func sqlite3Fts5ParserAlloc(tls *libc.TLS, mallocProc uintptr) uintptr { /* sqlite3.c:214408:13: */ + var fts5yypParser uintptr + fts5yypParser = (*(*func(*libc.TLS, U64) uintptr)(unsafe.Pointer(&mallocProc)))(tls, U64(unsafe.Sizeof(Fts5yyParser{}))) + if fts5yypParser != 0 { + + sqlite3Fts5ParserInit(tls, fts5yypParser) + } + return fts5yypParser +} + +// The following function deletes the "minor type" or semantic value +// associated with a symbol. The symbol can be either a terminal +// or nonterminal. "fts5yymajor" is the symbol code, and "fts5yypminor" is +// a pointer to the value to be deleted. The code used to do the +// deletions is derived from the %destructor and/or %token_destructor +// directives of the input grammar. +func fts5yy_destructor(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor uint8, fts5yypminor uintptr) { /* sqlite3.c:214427:13: */ + var pParse uintptr = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + _ = pParse + + switch int32(fts5yymajor) { + // Here is inserted the actions which take place when a + // terminal or non-terminal is destroyed. This can happen + // when the symbol is popped from the stack during a + // reduce or during error processing or when a parser is + // being destroyed before it is finished parsing. + // + // Note: during a reduce, the only symbols destroyed are those + // which appear on the RHS of the rule, but which are *not* used + // inside the C code. + //******** Begin destructor definitions ************************************** + case 16: /* input */ + { + _ = pParse + } + break + case 17: + fallthrough // expr + case 18: + fallthrough // cnearset + case 19: /* exprlist */ + { + sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor /* .Ffts5yy24 */))) + } + break + case 20: + fallthrough // colset + case 21: /* colsetlist */ + { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor /* .Ffts5yy11 */))) + } + break + case 22: + fallthrough // nearset + case 23: /* nearphrases */ + { + sqlite3Fts5ParseNearsetFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor /* .Ffts5yy46 */))) + } + break + case 24: /* phrase */ + { + sqlite3Fts5ParsePhraseFree(tls, *(*uintptr)(unsafe.Pointer(fts5yypminor /* .Ffts5yy53 */))) + } + break + //******** End destructor definitions **************************************** + default: + break // If no destructor action specified: do nothing + } +} + +// Pop the parser's stack once. +// +// If there is a destructor routine associated with the token which +// is popped from the stack, then call it. +func fts5yy_pop_parser_stack(tls *libc.TLS, pParser uintptr) { /* sqlite3.c:214486:13: */ + var fts5yytos uintptr + + fts5yytos = libc.PostDecUintptr(&(*Fts5yyParser)(unsafe.Pointer(pParser)).Ffts5yytos, 24) + fts5yy_destructor(tls, pParser, (*Fts5yyStackEntry)(unsafe.Pointer(fts5yytos)).Fmajor, (fts5yytos + 8 /* &.minor */)) +} + +// Clear all secondary memory allocations from the parser +func sqlite3Fts5ParserFinalize(tls *libc.TLS, p uintptr) { /* sqlite3.c:214504:13: */ + var pParser uintptr = p + for (*Fts5yyParser)(unsafe.Pointer(pParser)).Ffts5yytos > pParser+16 /* &.fts5yystack */ { + fts5yy_pop_parser_stack(tls, pParser) + } +} + +// Deallocate and destroy a parser. Destructors are called for +// all stack elements before shutting the parser down. +// +// If the fts5YYPARSEFREENEVERNULL macro exists (for example because it +// is defined in a %include section of the input grammar) then it is +// assumed that the input pointer is never NULL. +func sqlite3Fts5ParserFree(tls *libc.TLS, p uintptr, freeProc uintptr) { /* sqlite3.c:214521:13: */ + if p == uintptr(0) { + return + } + sqlite3Fts5ParserFinalize(tls, p) + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&freeProc)))(tls, p) +} + +// Return the peak depth of the stack for a parser. + +// This array of booleans keeps track of the parser statement +// coverage. The element fts5yycoverage[X][Y] is set when the parser +// is in state X and has a lookahead token Y. In a well-tested +// systems, every element of this matrix should end up being set. + +// Write into out a description of every state/lookahead combination that +// +// (1) has not been used by the parser, and +// (2) is not a syntax error. +// +// Return the number of missed state/lookahead combinations. + +// Find the appropriate action for a parser given the terminal +// look-ahead token iLookAhead. +func fts5yy_find_shift_action(tls *libc.TLS, iLookAhead uint8, stateno uint8) uint8 { /* sqlite3.c:214584:25: */ + var i int32 + + if int32(stateno) > Fts5YY_MAX_SHIFT { + return stateno + } + + for ok := true; ok; ok = 1 != 0 { + i = int32(fts5yy_shift_ofst[stateno]) + + i = i + (int32(iLookAhead)) + + if int32(fts5yy_lookahead[i]) != int32(iLookAhead) { + return fts5yy_default[stateno] + } else { + + return fts5yy_action[i] + } + } + return uint8(0) +} + +// Find the appropriate action for a parser given the non-terminal +// look-ahead token iLookAhead. +func fts5yy_find_reduce_action(tls *libc.TLS, stateno uint8, iLookAhead uint8) uint8 { /* sqlite3.c:214649:25: */ + var i int32 + + i = int32(fts5yy_reduce_ofst[stateno]) + + i = i + (int32(iLookAhead)) + + return fts5yy_action[i] +} + +// The following routine is called if the stack overflows. +func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:214678:13: */ + var pParse uintptr = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + + for (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos > fts5yypParser+16 /* &.fts5yystack */ { + fts5yy_pop_parser_stack(tls, fts5yypParser) + } + // Here code is inserted which will execute if the parser + // stack every overflows + //******* Begin %stack_overflow code ***************************************** + + sqlite3Fts5ParseError(tls, pParse, ts+31883 /* "fts5: parser sta..." */, 0) + //******* End %stack_overflow code ******************************************* + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var + +} + +// Print tracing information for a SHIFT action + +// Perform a shift action. +func fts5yy_shift(tls *libc.TLS, fts5yypParser uintptr, fts5yyNewState uint8, fts5yyMajor uint8, fts5yyMinor Fts5Token) { /* sqlite3.c:214721:13: */ + var fts5yytos uintptr + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos += 24 + if (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos > (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystackEnd { + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos -= 24 + fts5yyStackOverflow(tls, fts5yypParser) + return + } + if int32(fts5yyNewState) > Fts5YY_MAX_SHIFT { + fts5yyNewState = uint8(int32(fts5yyNewState) + (Fts5YY_MIN_REDUCE - Fts5YY_MIN_SHIFTREDUCE)) + } + fts5yytos = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos + (*Fts5yyStackEntry)(unsafe.Pointer(fts5yytos)).Fstateno = fts5yyNewState + (*Fts5yyStackEntry)(unsafe.Pointer(fts5yytos)).Fmajor = fts5yyMajor + *(*Fts5Token)(unsafe.Pointer(fts5yytos + 8 /* &.minor */)) = fts5yyMinor + +} + +// For rule J, fts5yyRuleInfoLhs[J] contains the symbol on the left-hand side +// of that rule +var fts5yyRuleInfoLhs = [28]uint8{ + uint8(16), // (0) input ::= expr + uint8(20), // (1) colset ::= MINUS LCP colsetlist RCP + uint8(20), // (2) colset ::= LCP colsetlist RCP + uint8(20), // (3) colset ::= STRING + uint8(20), // (4) colset ::= MINUS STRING + uint8(21), // (5) colsetlist ::= colsetlist STRING + uint8(21), // (6) colsetlist ::= STRING + uint8(17), // (7) expr ::= expr AND expr + uint8(17), // (8) expr ::= expr OR expr + uint8(17), // (9) expr ::= expr NOT expr + uint8(17), // (10) expr ::= colset COLON LP expr RP + uint8(17), // (11) expr ::= LP expr RP + uint8(17), // (12) expr ::= exprlist + uint8(19), // (13) exprlist ::= cnearset + uint8(19), // (14) exprlist ::= exprlist cnearset + uint8(18), // (15) cnearset ::= nearset + uint8(18), // (16) cnearset ::= colset COLON nearset + uint8(22), // (17) nearset ::= phrase + uint8(22), // (18) nearset ::= CARET phrase + uint8(22), // (19) nearset ::= STRING LP nearphrases neardist_opt RP + uint8(23), // (20) nearphrases ::= phrase + uint8(23), // (21) nearphrases ::= nearphrases phrase + uint8(25), // (22) neardist_opt ::= + uint8(25), // (23) neardist_opt ::= COMMA STRING + uint8(24), // (24) phrase ::= phrase PLUS STRING star_opt + uint8(24), // (25) phrase ::= STRING star_opt + uint8(26), // (26) star_opt ::= STAR + uint8(26), // (27) star_opt ::= +} /* sqlite3.c:214762:29 */ + +// For rule J, fts5yyRuleInfoNRhs[J] contains the negative of the number +// of symbols on the right-hand side of that rule. +var fts5yyRuleInfoNRhs = [28]int8{ + int8(-1), // (0) input ::= expr + int8(-4), // (1) colset ::= MINUS LCP colsetlist RCP + int8(-3), // (2) colset ::= LCP colsetlist RCP + int8(-1), // (3) colset ::= STRING + int8(-2), // (4) colset ::= MINUS STRING + int8(-2), // (5) colsetlist ::= colsetlist STRING + int8(-1), // (6) colsetlist ::= STRING + int8(-3), // (7) expr ::= expr AND expr + int8(-3), // (8) expr ::= expr OR expr + int8(-3), // (9) expr ::= expr NOT expr + int8(-5), // (10) expr ::= colset COLON LP expr RP + int8(-3), // (11) expr ::= LP expr RP + int8(-1), // (12) expr ::= exprlist + int8(-1), // (13) exprlist ::= cnearset + int8(-2), // (14) exprlist ::= exprlist cnearset + int8(-1), // (15) cnearset ::= nearset + int8(-3), // (16) cnearset ::= colset COLON nearset + int8(-1), // (17) nearset ::= phrase + int8(-2), // (18) nearset ::= CARET phrase + int8(-5), // (19) nearset ::= STRING LP nearphrases neardist_opt RP + int8(-1), // (20) nearphrases ::= phrase + int8(-2), // (21) nearphrases ::= nearphrases phrase + int8(0), // (22) neardist_opt ::= + int8(-2), // (23) neardist_opt ::= COMMA STRING + int8(-4), // (24) phrase ::= phrase PLUS STRING star_opt + int8(-2), // (25) phrase ::= STRING star_opt + int8(-1), // (26) star_opt ::= STAR + int8(0), // (27) star_opt ::= +} /* sqlite3.c:214795:26 */ + +// Forward Declaration + +// Perform a reduce action and the shift that must immediately +// follow the reduce. +// +// The fts5yyLookahead and fts5yyLookaheadToken parameters provide reduce actions +// access to the lookahead token (if any). The fts5yyLookahead will be fts5YYNOCODE +// if the lookahead token has already been consumed. As this procedure is +// only called from one place, optimizing compilers will in-line it, which +// means that the extra parameters have no performance impact. +func fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, fts5yyLookahead int32, fts5yyLookaheadToken Fts5Token) uint8 { /* sqlite3.c:214838:25: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var fts5yygoto int32 // The next state + var fts5yyact uint8 // The next action + var fts5yymsp uintptr // The top of the parser's stack + var fts5yysize int32 // Amount to pop the stack + var pParse uintptr = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + _ = fts5yyLookahead + _ = fts5yyLookaheadToken + fts5yymsp = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos + + switch fts5yyruleno { + // Beginning here are the reduction cases. A typical example + // follows: + // case 0: + // #line + // { ... } // User supplied code + // #line + // break; + //********* Begin reduce actions ********************************************* + // var fts5yylhsminor Fts5YYMINORTYPE at bp, 16 + + case uint32(0): /* input ::= expr */ + { + sqlite3Fts5ParseFinished(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + break + case uint32(1): /* colset ::= MINUS LCP colsetlist RCP */ + { + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(2): /* colset ::= LCP colsetlist RCP */ + { + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(3): /* colset ::= STRING */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseColset(tls, pParse, uintptr(0), (fts5yymsp + 8 /* &.minor */ /* &.fts5yy0 */)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(4): /* colset ::= MINUS STRING */ + { + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = sqlite3Fts5ParseColset(tls, pParse, uintptr(0), (fts5yymsp + 8 /* &.minor */ /* &.fts5yy0 */)) + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = sqlite3Fts5ParseColsetInvert(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) + } + break + case uint32(5): /* colsetlist ::= colsetlist STRING */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (fts5yymsp + 8 /* &.minor */ /* &.fts5yy0 */)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(6): /* colsetlist ::= STRING */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseColset(tls, pParse, uintptr(0), (fts5yymsp + 8 /* &.minor */ /* &.fts5yy0 */)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(7): /* expr ::= expr AND expr */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNode(tls, pParse, FTS5_AND, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)), uintptr(0)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(8): /* expr ::= expr OR expr */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNode(tls, pParse, FTS5_OR, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)), uintptr(0)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(9): /* expr ::= expr NOT expr */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNode(tls, pParse, FTS5_NOT, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)), uintptr(0)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(10): /* expr ::= colset COLON LP expr RP */ + { + sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(11): /* expr ::= LP expr RP */ + { + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + } + break + case uint32(12): + fallthrough // expr ::= exprlist + case uint32(13): /* exprlist ::= cnearset */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(14): /* exprlist ::= exprlist cnearset */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseImplicitAnd(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(15): /* cnearset ::= nearset */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNode(tls, pParse, FTS5_STRING, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(16): /* cnearset ::= colset COLON nearset */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNode(tls, pParse, FTS5_STRING, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + sqlite3Fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(17): /* nearset ::= phrase */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(18): /* nearset ::= CARET phrase */ + { + sqlite3Fts5ParseSetCaret(tls, *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + break + case uint32(19): /* nearset ::= STRING LP nearphrases neardist_opt RP */ + { + sqlite3Fts5ParseNear(tls, pParse, (fts5yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.fts5yy0 */)) + sqlite3Fts5ParseSetDistance(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.fts5yy0 */)) + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(20): /* nearphrases ::= phrase */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(21): /* nearphrases ::= nearphrases phrase */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseNearset(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(22): /* neardist_opt ::= */ + { + (*Fts5Token)(unsafe.Pointer(fts5yymsp + 1*24 + 8 /* &.minor */)).Fp = uintptr(0) + (*Fts5Token)(unsafe.Pointer(fts5yymsp + 1*24 + 8 /* &.minor */)).Fn = 0 + } + break + case uint32(23): /* neardist_opt ::= COMMA STRING */ + { + *(*Fts5Token)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*Fts5Token)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) + } + break + case uint32(24): /* phrase ::= phrase PLUS STRING star_opt */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseTerm(tls, pParse, *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), (fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.fts5yy0 */), *(*int32)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(25): /* phrase ::= STRING star_opt */ + { + *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) = sqlite3Fts5ParseTerm(tls, pParse, uintptr(0), (fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.fts5yy0 */), *(*int32)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */))) + } + *(*uintptr)(unsafe.Pointer(fts5yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp /* &fts5yylhsminor */)) + break + case uint32(26): /* star_opt ::= STAR */ + { + *(*int32)(unsafe.Pointer(fts5yymsp + 8 /* &.minor */)) = 1 + } + break + case uint32(27): /* star_opt ::= */ + { + *(*int32)(unsafe.Pointer(fts5yymsp + 1*24 + 8 /* &.minor */)) = 0 + } + break + default: + break + //********* End reduce actions *********************************************** + } + + fts5yygoto = int32(fts5yyRuleInfoLhs[fts5yyruleno]) + fts5yysize = int32(fts5yyRuleInfoNRhs[fts5yyruleno]) + fts5yyact = fts5yy_find_reduce_action(tls, (*Fts5yyStackEntry)(unsafe.Pointer(fts5yymsp+uintptr(fts5yysize)*24)).Fstateno, uint8(fts5yygoto)) + + // There are no SHIFTREDUCE actions on nonterminals because the table + // generator has simplified them to pure REDUCE actions. + + // It is not possible for a REDUCE to be followed by an error + + fts5yymsp += 24 * (uintptr(fts5yysize + 1)) + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos = fts5yymsp + (*Fts5yyStackEntry)(unsafe.Pointer(fts5yymsp)).Fstateno = fts5yyact + (*Fts5yyStackEntry)(unsafe.Pointer(fts5yymsp)).Fmajor = uint8(fts5yygoto) + + return fts5yyact +} + +// The following code executes when the parse fails + +// The following code executes when a syntax error first occurs. +func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32, fts5yyminor Fts5Token) { /* sqlite3.c:215056:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pParse uintptr = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + + //*********** Begin %syntax_error code *************************************** + + _ = fts5yymajor // Silence a compiler warning + sqlite3Fts5ParseError(tls, + pParse, ts+31911 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + //*********** End %syntax_error code ***************************************** + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable + +} + +// The following is executed when the parser accepts +func fts5yy_accept(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:215078:13: */ + var pParse uintptr = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse + + // Here code is inserted which will be executed whenever the + // parser accepts + //********** Begin %parse_accept code **************************************** + //********** End %parse_accept code ****************************************** + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable + +} + +// The main parser program. +// The first argument is a pointer to a structure obtained from +// "sqlite3Fts5ParserAlloc" which describes the current state of the parser. +// The second argument is the major token number. The third is +// the minor token. The fourth optional argument is whatever the +// user wants (and specified in the grammar) and is available for +// use by the action routines. +// +// Inputs: +//
    +//
  • A pointer to the parser (an opaque structure.) +//
  • The major token number. +//
  • The minor token number. +//
  • An option argument of a grammar-specified type. +//
+// +// Outputs: +// None. +func sqlite3Fts5Parser(tls *libc.TLS, fts5yyp uintptr, fts5yymajor int32, fts5yyminor Fts5Token, pParse uintptr) { /* sqlite3.c:215119:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var fts5yyminorunion Fts5YYMINORTYPE at bp, 16 + + var fts5yyact uint8 // The parser action. + var fts5yypParser uintptr = fts5yyp // The parser + + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse + + fts5yyact = (*Fts5yyStackEntry)(unsafe.Pointer((*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos)).Fstateno + + for 1 != 0 { // Exit by "break" + + fts5yyact = fts5yy_find_shift_action(tls, uint8(fts5yymajor), fts5yyact) + if int32(fts5yyact) >= Fts5YY_MIN_REDUCE { + var fts5yyruleno uint32 = (uint32(int32(fts5yyact) - Fts5YY_MIN_REDUCE)) // Reduce by this rule + + // Check that the stack is large enough to grow by a single entry + // if the RHS of the rule is empty. This ensures that there is room + // enough on the stack to push the LHS value + if int32(fts5yyRuleInfoNRhs[fts5yyruleno]) == 0 { + if (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos >= (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yystackEnd { + fts5yyStackOverflow(tls, fts5yypParser) + break + } + } + fts5yyact = fts5yy_reduce(tls, fts5yypParser, fts5yyruleno, fts5yymajor, fts5yyminor) + } else if int32(fts5yyact) <= Fts5YY_MAX_SHIFTREDUCE { + fts5yy_shift(tls, fts5yypParser, fts5yyact, uint8(fts5yymajor), fts5yyminor) + break + } else if int32(fts5yyact) == Fts5YY_ACCEPT_ACTION { + (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).Ffts5yytos -= 24 + fts5yy_accept(tls, fts5yypParser) + return + } else { + + *(*Fts5Token)(unsafe.Pointer(bp /* &fts5yyminorunion */)) = fts5yyminor + // If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to + // do any kind of error recovery. Instead, simply invoke the syntax + // error routine and continue going as if nothing had happened. + // + // Applications can set this macro (for example inside %include) if + // they intend to abandon the parse upon the first syntax error seen. + fts5yy_syntax_error(tls, fts5yypParser, fts5yymajor, fts5yyminor) + fts5yy_destructor(tls, fts5yypParser, uint8(fts5yymajor), bp /* &fts5yyminorunion */) + break + } + } + return +} + +// Return the fallback token corresponding to canonical token iToken, or +// 0 if iToken has no fallback. +func sqlite3Fts5ParserFallback(tls *libc.TLS, iToken int32) int32 { /* sqlite3.c:215337:12: */ + _ = iToken + return 0 +} + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// #include "fts5Int.h" +// ==================================================== +// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +// +// Developed at SunPro, a Sun Microsystems, Inc. business. +// Permission to use, copy, modify, and distribute this +// software is freely granted, provided that this notice +// is preserved. +// ==================================================== + +// from: @(#)fdlibm.h 5.1 93/09/24 +// $FreeBSD$ + +// Object used to iterate through all "coalesced phrase instances" in +// a single column of the current row. If the phrase instances in the +// column being considered do not overlap, this object simply iterates +// through them. Or, if they do overlap (share one or more tokens in +// common), each set of overlapping instances is treated as a single +// match. See documentation for the highlight() auxiliary function for +// details. +// +// Usage is: +// +// for(rc = fts5CInstIterNext(pApi, pFts, iCol, &iter); +// (rc==SQLITE_OK && 0==fts5CInstIterEof(&iter); +// rc = fts5CInstIterNext(&iter) +// ){ +// printf("instance starts at %d, ends at %d\n", iter.iStart, iter.iEnd); +// } +// +type CInstIter1 = struct { + FpApi uintptr + FpFts uintptr + FiCol int32 + FiInst int32 + FnInst int32 + FiStart int32 + FiEnd int32 + _ [4]byte +} /* sqlite3.c:215383:9 */ + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// #include "fts5Int.h" +// ==================================================== +// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +// +// Developed at SunPro, a Sun Microsystems, Inc. business. +// Permission to use, copy, modify, and distribute this +// software is freely granted, provided that this notice +// is preserved. +// ==================================================== + +// from: @(#)fdlibm.h 5.1 93/09/24 +// $FreeBSD$ + +// Object used to iterate through all "coalesced phrase instances" in +// a single column of the current row. If the phrase instances in the +// column being considered do not overlap, this object simply iterates +// through them. Or, if they do overlap (share one or more tokens in +// common), each set of overlapping instances is treated as a single +// match. See documentation for the highlight() auxiliary function for +// details. +// +// Usage is: +// +// for(rc = fts5CInstIterNext(pApi, pFts, iCol, &iter); +// (rc==SQLITE_OK && 0==fts5CInstIterEof(&iter); +// rc = fts5CInstIterNext(&iter) +// ){ +// printf("instance starts at %d, ends at %d\n", iter.iStart, iter.iEnd); +// } +// +type CInstIter = CInstIter1 /* sqlite3.c:215383:26 */ + +// Advance the iterator to the next coalesced phrase instance. Return +// an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func fts5CInstIterNext(tls *libc.TLS, pIter uintptr) int32 { /* sqlite3.c:215400:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var rc int32 = SQLITE_OK + (*CInstIter)(unsafe.Pointer(pIter)).FiStart = -1 + (*CInstIter)(unsafe.Pointer(pIter)).FiEnd = -1 + + for (rc == SQLITE_OK) && ((*CInstIter)(unsafe.Pointer(pIter)).FiInst < (*CInstIter)(unsafe.Pointer(pIter)).FnInst) { + // var ip int32 at bp, 4 + + // var ic int32 at bp+4, 4 + + // var io int32 at bp+8, 4 + + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*CInstIter)(unsafe.Pointer(pIter)).FpApi + 72 /* &.xInst */))))(tls, (*CInstIter)(unsafe.Pointer(pIter)).FpFts, (*CInstIter)(unsafe.Pointer(pIter)).FiInst, bp /* &ip */, bp+4 /* &ic */, bp+8 /* &io */) + if rc == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 4 /* ic */)) == (*CInstIter)(unsafe.Pointer(pIter)).FiCol { + var iEnd int32 = ((*(*int32)(unsafe.Pointer(bp + 8 /* io */)) - 1) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*CInstIter)(unsafe.Pointer(pIter)).FpApi + 56 /* &.xPhraseSize */))))(tls, (*CInstIter)(unsafe.Pointer(pIter)).FpFts, *(*int32)(unsafe.Pointer(bp /* ip */)))) + if (*CInstIter)(unsafe.Pointer(pIter)).FiStart < 0 { + (*CInstIter)(unsafe.Pointer(pIter)).FiStart = *(*int32)(unsafe.Pointer(bp + 8 /* io */)) + (*CInstIter)(unsafe.Pointer(pIter)).FiEnd = iEnd + } else if *(*int32)(unsafe.Pointer(bp + 8 /* io */)) <= (*CInstIter)(unsafe.Pointer(pIter)).FiEnd { + if iEnd > (*CInstIter)(unsafe.Pointer(pIter)).FiEnd { + (*CInstIter)(unsafe.Pointer(pIter)).FiEnd = iEnd + } + } else { + break + } + } + (*CInstIter)(unsafe.Pointer(pIter)).FiInst++ + } + } + + return rc +} + +// Initialize the iterator object indicated by the final parameter to +// iterate through coalesced phrase instances in column iCol. +func fts5CInstIterInit(tls *libc.TLS, pApi uintptr, pFts uintptr, iCol int32, pIter uintptr) int32 { /* sqlite3.c:215431:12: */ + var rc int32 + + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(CInstIter{}))) + (*CInstIter)(unsafe.Pointer(pIter)).FpApi = pApi + (*CInstIter)(unsafe.Pointer(pIter)).FpFts = pFts + (*CInstIter)(unsafe.Pointer(pIter)).FiCol = iCol + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xInstCount */))))(tls, pFts, (pIter + 24 /* &.nInst */)) + + if rc == SQLITE_OK { + rc = fts5CInstIterNext(tls, pIter) + } + + return rc +} + +// ************************************************************************ +// +// Start of highlight() implementation. +type HighlightContext1 = struct { + Fiter CInstIter + FiPos int32 + FiRangeStart int32 + FiRangeEnd int32 + _ [4]byte + FzOpen uintptr + FzClose uintptr + FzIn uintptr + FnIn int32 + FiOff int32 + FzOut uintptr +} /* sqlite3.c:215457:9 */ + +// ************************************************************************ +// +// Start of highlight() implementation. +type HighlightContext = HighlightContext1 /* sqlite3.c:215457:33 */ + +// Append text to the HighlightContext output string - p->zOut. Argument +// z points to a buffer containing n bytes of text to append. If n is +// negative, everything up until the first '\0' is appended to the output. +// +// If *pRc is set to any value other than SQLITE_OK when this function is +// called, it is a no-op. If an error (i.e. an OOM condition) is encountered, +// *pRc is set to an error code before returning. +func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int32) { /* sqlite3.c:215480:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (z != 0) { + if n < 0 { + n = int32(libc.Xstrlen(tls, z)) + } + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31942 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } +} + +// Tokenizer callback used by implementation of highlight() function. +func fts5HighlightCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iStartOff int32, iEndOff int32) int32 { /* sqlite3.c:215495:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = pContext + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var iPos int32 + + _ = pToken + _ = nToken + + if (tflags & FTS5_TOKEN_COLOCATED) != 0 { + return SQLITE_OK + } + iPos = libc.PostIncInt32(&(*HighlightContext)(unsafe.Pointer(p)).FiPos, 1) + + if (*HighlightContext)(unsafe.Pointer(p)).FiRangeEnd > 0 { + if (iPos < (*HighlightContext)(unsafe.Pointer(p)).FiRangeStart) || (iPos > (*HighlightContext)(unsafe.Pointer(p)).FiRangeEnd) { + return SQLITE_OK + } + if ((*HighlightContext)(unsafe.Pointer(p)).FiRangeStart != 0) && (iPos == (*HighlightContext)(unsafe.Pointer(p)).FiRangeStart) { + (*HighlightContext)(unsafe.Pointer(p)).FiOff = iStartOff + } + } + + if iPos == (*HighlightContext)(unsafe.Pointer(p)).Fiter.FiStart { + fts5HighlightAppend(tls, bp /* &rc */, p, ((*HighlightContext)(unsafe.Pointer(p)).FzIn + uintptr((*HighlightContext)(unsafe.Pointer(p)).FiOff)), (iStartOff - (*HighlightContext)(unsafe.Pointer(p)).FiOff)) + fts5HighlightAppend(tls, bp /* &rc */, p, (*HighlightContext)(unsafe.Pointer(p)).FzOpen, -1) + (*HighlightContext)(unsafe.Pointer(p)).FiOff = iStartOff + } + + if iPos == (*HighlightContext)(unsafe.Pointer(p)).Fiter.FiEnd { + if ((*HighlightContext)(unsafe.Pointer(p)).FiRangeEnd != 0) && ((*HighlightContext)(unsafe.Pointer(p)).Fiter.FiStart < (*HighlightContext)(unsafe.Pointer(p)).FiRangeStart) { + fts5HighlightAppend(tls, bp /* &rc */, p, (*HighlightContext)(unsafe.Pointer(p)).FzOpen, -1) + } + fts5HighlightAppend(tls, bp /* &rc */, p, ((*HighlightContext)(unsafe.Pointer(p)).FzIn + uintptr((*HighlightContext)(unsafe.Pointer(p)).FiOff)), (iEndOff - (*HighlightContext)(unsafe.Pointer(p)).FiOff)) + fts5HighlightAppend(tls, bp /* &rc */, p, (*HighlightContext)(unsafe.Pointer(p)).FzClose, -1) + (*HighlightContext)(unsafe.Pointer(p)).FiOff = iEndOff + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp /* rc */)) = fts5CInstIterNext(tls, (p /* &.iter */)) + } + } + + if ((*HighlightContext)(unsafe.Pointer(p)).FiRangeEnd > 0) && (iPos == (*HighlightContext)(unsafe.Pointer(p)).FiRangeEnd) { + fts5HighlightAppend(tls, bp /* &rc */, p, ((*HighlightContext)(unsafe.Pointer(p)).FzIn + uintptr((*HighlightContext)(unsafe.Pointer(p)).FiOff)), (iEndOff - (*HighlightContext)(unsafe.Pointer(p)).FiOff)) + (*HighlightContext)(unsafe.Pointer(p)).FiOff = iEndOff + if (iPos >= (*HighlightContext)(unsafe.Pointer(p)).Fiter.FiStart) && (iPos < (*HighlightContext)(unsafe.Pointer(p)).Fiter.FiEnd) { + fts5HighlightAppend(tls, bp /* &rc */, p, (*HighlightContext)(unsafe.Pointer(p)).FzClose, -1) + } + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Implementation of highlight() function. +func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* sqlite3.c:215549:13: */ + bp := tls.Alloc(100) + defer tls.Free(100) + + // var ctx HighlightContext at bp, 96 + + // var rc int32 at bp+96, 4 + + var iCol int32 + + if nVal != 3 { + var zErr uintptr = ts + 31949 /* "wrong number of ..." */ + Xsqlite3_result_error(tls, pCtx, zErr, -1) + return + } + + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) + libc.Xmemset(tls, bp /* &ctx */, 0, uint64(unsafe.Sizeof(HighlightContext{}))) + (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzOpen = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzClose = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 2*8))) + *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 88 /* &.xColumnText */))))(tls, pFts, iCol, (bp /* &ctx */ + 72 /* &.zIn */), (bp /* &ctx */ + 80 /* &.nIn */)) + + if (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzIn != 0 { + if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = fts5CInstIterInit(tls, pApi, pFts, iCol, (bp /* &ctx */ /* &.iter */)) + } + + if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 40 /* &.xTokenize */))))(tls, pFts, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzIn, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FnIn, bp /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5HighlightCb}))) + } + fts5HighlightAppend(tls, bp+96 /* &rc */, bp /* &ctx */, ((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzIn + uintptr((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiOff)), ((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FnIn - (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiOff)) + + if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK { + Xsqlite3_result_text(tls, pCtx, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzOut, -1, libc.UintptrFromInt32(-1)) + } + Xsqlite3_free(tls, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzOut) + } + if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) != SQLITE_OK { + Xsqlite3_result_error_code(tls, pCtx, *(*int32)(unsafe.Pointer(bp + 96 /* rc */))) + } +} + +// +// End of highlight() implementation. +// + +// Context object passed to the fts5SentenceFinderCb() function. +type Fts5SFinder1 = struct { + FiPos int32 + FnFirstAlloc int32 + FnFirst int32 + _ [4]byte + FaFirst uintptr + FzDoc uintptr +} /* sqlite3.c:215598:9 */ + +// +// End of highlight() implementation. +// + +// Context object passed to the fts5SentenceFinderCb() function. +type Fts5SFinder = Fts5SFinder1 /* sqlite3.c:215598:28 */ + +// Add an entry to the Fts5SFinder.aFirst[] array. Grow the array if +// necessary. Return SQLITE_OK if successful, or SQLITE_NOMEM if an +// error occurs. +func fts5SentenceFinderAdd(tls *libc.TLS, p uintptr, iAdd int32) int32 { /* sqlite3.c:215612:12: */ + if (*Fts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc == (*Fts5SFinder)(unsafe.Pointer(p)).FnFirst { + var nNew int32 + if (*Fts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc != 0 { + nNew = ((*Fts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc * 2) + } else { + nNew = 64 + } + var aNew uintptr + + aNew = Xsqlite3_realloc64(tls, (*Fts5SFinder)(unsafe.Pointer(p)).FaFirst, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(int32(0)))))) + if aNew == uintptr(0) { + return SQLITE_NOMEM + } + (*Fts5SFinder)(unsafe.Pointer(p)).FaFirst = aNew + (*Fts5SFinder)(unsafe.Pointer(p)).FnFirstAlloc = nNew + } + *(*int32)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(p)).FaFirst + uintptr(libc.PostIncInt32(&(*Fts5SFinder)(unsafe.Pointer(p)).FnFirst, 1))*4)) = iAdd + return SQLITE_OK +} + +// This function is an xTokenize() callback used by the auxiliary snippet() +// function. Its job is to identify tokens that are the first in a sentence. +// For each such token, an entry is added to the SFinder.aFirst[] array. +func fts5SentenceFinderCb(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iStartOff int32, iEndOff int32) int32 { /* sqlite3.c:215631:12: */ + var rc int32 = SQLITE_OK + + _ = pToken + _ = nToken + _ = iEndOff + + if (tflags & FTS5_TOKEN_COLOCATED) == 0 { + var p uintptr = pContext + if (*Fts5SFinder)(unsafe.Pointer(p)).FiPos > 0 { + var i int32 + var c int8 = int8(0) + for i = (iStartOff - 1); i >= 0; i-- { + c = *(*int8)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(p)).FzDoc + uintptr(i))) + if (((int32(c) != ' ') && (int32(c) != '\t')) && (int32(c) != '\n')) && (int32(c) != '\r') { + break + } + } + if (i != (iStartOff - 1)) && ((int32(c) == '.') || (int32(c) == ':')) { + rc = fts5SentenceFinderAdd(tls, p, (*Fts5SFinder)(unsafe.Pointer(p)).FiPos) + } + } else { + rc = fts5SentenceFinderAdd(tls, p, 0) + } + (*Fts5SFinder)(unsafe.Pointer(p)).FiPos++ + } + return rc +} + +func fts5SnippetScore(tls *libc.TLS, pApi uintptr, pFts uintptr, nDocsize int32, aSeen uintptr, iCol int32, iPos int32, nToken int32, pnScore uintptr, piPos uintptr) int32 { /* sqlite3.c:215664:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 + var i int32 + *(*int32)(unsafe.Pointer(bp + 4 /* ip */)) = 0 + *(*int32)(unsafe.Pointer(bp + 8 /* ic */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) = 0 + var iFirst int32 = -1 + // var nInst int32 at bp, 4 + + var nScore int32 = 0 + var iLast int32 = 0 + var iEnd Sqlite3_int64 = (Sqlite3_int64(iPos) + Sqlite3_int64(nToken)) + + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xInstCount */))))(tls, pFts, bp /* &nInst */) + for i = 0; (i < *(*int32)(unsafe.Pointer(bp /* nInst */))) && (rc == SQLITE_OK); i++ { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 72 /* &.xInst */))))(tls, pFts, i, bp+4 /* &ip */, bp+8 /* &ic */, bp+12 /* &iOff */) + if (((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 8 /* ic */)) == iCol)) && (*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) >= iPos)) && (Sqlite3_int64(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))) < iEnd) { + nScore = nScore + (func() int32 { + if *(*uint8)(unsafe.Pointer(aSeen + uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* ip */))))) != 0 { + return 1 + } + return 1000 + }()) + *(*uint8)(unsafe.Pointer(aSeen + uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* ip */))))) = uint8(1) + if iFirst < 0 { + iFirst = *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) + } + iLast = (*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pApi + 56 /* &.xPhraseSize */))))(tls, pFts, *(*int32)(unsafe.Pointer(bp + 4 /* ip */)))) + } + } + + *(*int32)(unsafe.Pointer(pnScore)) = nScore + if piPos != 0 { + var iAdj Sqlite3_int64 = (Sqlite3_int64(iFirst - ((nToken - (iLast - iFirst)) / 2))) + if (iAdj + Sqlite3_int64(nToken)) > Sqlite3_int64(nDocsize) { + iAdj = (Sqlite3_int64(nDocsize - nToken)) + } + if iAdj < int64(0) { + iAdj = int64(0) + } + *(*int32)(unsafe.Pointer(piPos)) = int32(iAdj) + } + + return rc +} + +// Return the value in pVal interpreted as utf-8 text. Except, if pVal +// contains a NULL value, return a pointer to a static string zero +// bytes in length instead of a NULL pointer. +func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713:19: */ + var zRet uintptr = Xsqlite3_value_text(tls, pVal) + if zRet != 0 { + return zRet + } + return ts + 756 /* "" */ +} + +// Implementation of snippet() function. +func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* sqlite3.c:215721:13: */ + bp := tls.Alloc(172) + defer tls.Free(172) + + // var ctx HighlightContext at bp, 96 + + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = SQLITE_OK // Return code + var iCol int32 // 1st argument to snippet() + var zEllips uintptr // 4th argument to snippet() + var nToken int32 // 5th argument to snippet() + *(*int32)(unsafe.Pointer(bp + 96 /* nInst */)) = 0 // Number of instance matches this row + var i int32 // Used to iterate through instances + var nPhrase int32 // Number of phrases in query + var aSeen uintptr // Array of "seen instance" flags + var iBestCol int32 // Column containing best snippet + var iBestStart int32 = 0 // First token of best snippet + var nBestScore int32 = 0 // Score of best snippet + *(*int32)(unsafe.Pointer(bp + 164 /* nColSize */)) = 0 // Total size of iBestCol in tokens + // var sFinder Fts5SFinder at bp+104, 32 + // Used to find the beginnings of sentences + var nCol int32 + + if nVal != 5 { + var zErr uintptr = ts + 31999 /* "wrong number of ..." */ + Xsqlite3_result_error(tls, pCtx, zErr, -1) + return + } + + nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 16 /* &.xColumnCount */))))(tls, pFts) + libc.Xmemset(tls, bp /* &ctx */, 0, uint64(unsafe.Sizeof(HighlightContext{}))) + iCol = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal))) + (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzOpen = fts5ValueToText(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzClose = fts5ValueToText(tls, *(*uintptr)(unsafe.Pointer(apVal + 2*8))) + zEllips = fts5ValueToText(tls, *(*uintptr)(unsafe.Pointer(apVal + 3*8))) + nToken = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal + 4*8))) + + iBestCol = func() int32 { + if iCol >= 0 { + return iCol + } + return 0 + }() + nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 48 /* &.xPhraseCount */))))(tls, pFts) + aSeen = Xsqlite3_malloc(tls, nPhrase) + if aSeen == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = SQLITE_NOMEM + } + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xInstCount */))))(tls, pFts, bp+96 /* &nInst */) + } + + libc.Xmemset(tls, bp+104 /* &sFinder */, 0, uint64(unsafe.Sizeof(Fts5SFinder{}))) + for i = 0; i < nCol; i++ { + if (iCol < 0) || (iCol == i) { + // var nDoc int32 at bp+136, 4 + + // var nDocsize int32 at bp+140, 4 + + var ii int32 + (*Fts5SFinder)(unsafe.Pointer(bp + 104 /* &sFinder */)).FiPos = 0 + (*Fts5SFinder)(unsafe.Pointer(bp + 104 /* &sFinder */)).FnFirst = 0 + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 88 /* &.xColumnText */))))(tls, pFts, i, (bp + 104 /* &sFinder */ + 24 /* &.zDoc */), bp+136 /* &nDoc */) + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) != SQLITE_OK { + break + } + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 40 /* &.xTokenize */))))(tls, pFts, + (*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FzDoc, *(*int32)(unsafe.Pointer(bp + 136 /* nDoc */)), bp+104 /* &sFinder */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5SentenceFinderCb}))) + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) != SQLITE_OK { + break + } + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 96 /* &.xColumnSize */))))(tls, pFts, i, bp+140 /* &nDocsize */) + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) != SQLITE_OK { + break + } + + for ii = 0; (*(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK) && (ii < *(*int32)(unsafe.Pointer(bp + 96 /* nInst */))); ii++ { + // var ip int32 at bp+144, 4 + + // var ic int32 at bp+148, 4 + + // var io int32 at bp+152, 4 + + // var iAdj int32 at bp+160, 4 + + // var nScore int32 at bp+156, 4 + + var jj int32 + + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 72 /* &.xInst */))))(tls, pFts, ii, bp+144 /* &ip */, bp+148 /* &ic */, bp+152 /* &io */) + if *(*int32)(unsafe.Pointer(bp + 148 /* ic */)) != i { + continue + } + if *(*int32)(unsafe.Pointer(bp + 152 /* io */)) > *(*int32)(unsafe.Pointer(bp + 140 /* nDocsize */)) { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) != SQLITE_OK { + continue + } + libc.Xmemset(tls, aSeen, 0, uint64(nPhrase)) + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = fts5SnippetScore(tls, pApi, pFts, *(*int32)(unsafe.Pointer(bp + 140 /* nDocsize */)), aSeen, i, + *(*int32)(unsafe.Pointer(bp + 152 /* io */)), nToken, bp+156 /* &nScore */, bp+160 /* &iAdj */) + if (*(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 156 /* nScore */)) > nBestScore) { + nBestScore = *(*int32)(unsafe.Pointer(bp + 156 /* nScore */)) + iBestCol = i + iBestStart = *(*int32)(unsafe.Pointer(bp + 160 /* iAdj */)) + *(*int32)(unsafe.Pointer(bp + 164 /* nColSize */)) = *(*int32)(unsafe.Pointer(bp + 140 /* nDocsize */)) + } + + if ((*(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK) && ((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FnFirst != 0)) && (*(*int32)(unsafe.Pointer(bp + 140 /* nDocsize */)) > nToken) { + for jj = 0; jj < ((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FnFirst - 1); jj++ { + if *(*int32)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FaFirst + uintptr((jj+1))*4)) > *(*int32)(unsafe.Pointer(bp + 152 /* io */)) { + break + } + } + + if *(*int32)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FaFirst + uintptr(jj)*4)) < *(*int32)(unsafe.Pointer(bp + 152 /* io */)) { + libc.Xmemset(tls, aSeen, 0, uint64(nPhrase)) + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = fts5SnippetScore(tls, pApi, pFts, *(*int32)(unsafe.Pointer(bp + 140 /* nDocsize */)), aSeen, i, + *(*int32)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FaFirst + uintptr(jj)*4)), nToken, bp+156 /* &nScore */, uintptr(0)) + + *(*int32)(unsafe.Pointer(bp + 156 /* nScore */)) += func() int32 { + if *(*int32)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FaFirst + uintptr(jj)*4)) == 0 { + return 120 + } + return 100 + }() + if (*(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 156 /* nScore */)) > nBestScore) { + nBestScore = *(*int32)(unsafe.Pointer(bp + 156 /* nScore */)) + iBestCol = i + iBestStart = *(*int32)(unsafe.Pointer((*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FaFirst + uintptr(jj)*4)) + *(*int32)(unsafe.Pointer(bp + 164 /* nColSize */)) = *(*int32)(unsafe.Pointer(bp + 140 /* nDocsize */)) + } + } + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 88 /* &.xColumnText */))))(tls, pFts, iBestCol, (bp /* &ctx */ + 72 /* &.zIn */), (bp /* &ctx */ + 80 /* &.nIn */)) + } + if (*(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 164 /* nColSize */)) == 0) { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 96 /* &.xColumnSize */))))(tls, pFts, iBestCol, bp+164 /* &nColSize */) + } + if (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzIn != 0 { + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = fts5CInstIterInit(tls, pApi, pFts, iBestCol, (bp /* &ctx */ /* &.iter */)) + } + + (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiRangeStart = iBestStart + (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiRangeEnd = ((iBestStart + nToken) - 1) + + if iBestStart > 0 { + fts5HighlightAppend(tls, bp+168 /* &rc */, bp /* &ctx */, zEllips, -1) + } + + // Advance iterator ctx.iter so that it points to the first coalesced + // phrase instance at or following position iBestStart. + for (((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).Fiter.FiStart >= 0) && ((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).Fiter.FiStart < iBestStart)) && (*(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = fts5CInstIterNext(tls, (bp /* &ctx */ /* &.iter */)) + } + + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 40 /* &.xTokenize */))))(tls, pFts, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzIn, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FnIn, bp /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5HighlightCb}))) + } + if (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiRangeEnd >= (*(*int32)(unsafe.Pointer(bp + 164 /* nColSize */)) - 1) { + fts5HighlightAppend(tls, bp+168 /* &rc */, bp /* &ctx */, ((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzIn + uintptr((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiOff)), ((*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FnIn - (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FiOff)) + } else { + fts5HighlightAppend(tls, bp+168 /* &rc */, bp /* &ctx */, zEllips, -1) + } + } + if *(*int32)(unsafe.Pointer(bp + 168 /* rc */)) == SQLITE_OK { + Xsqlite3_result_text(tls, pCtx, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzOut, -1, libc.UintptrFromInt32(-1)) + } else { + Xsqlite3_result_error_code(tls, pCtx, *(*int32)(unsafe.Pointer(bp + 168 /* rc */))) + } + Xsqlite3_free(tls, (*HighlightContext)(unsafe.Pointer(bp /* &ctx */)).FzOut) + Xsqlite3_free(tls, aSeen) + Xsqlite3_free(tls, (*Fts5SFinder)(unsafe.Pointer(bp+104 /* &sFinder */)).FaFirst) +} + +//********************************************************************** + +// The first time the bm25() function is called for a query, an instance +// of the following structure is allocated and populated. +type Fts5Bm25Data1 = struct { + FnPhrase int32 + _ [4]byte + Favgdl float64 + FaIDF uintptr + FaFreq uintptr +} /* sqlite3.c:215879:9 */ + +//********************************************************************** + +// The first time the bm25() function is called for a query, an instance +// of the following structure is allocated and populated. +type Fts5Bm25Data = Fts5Bm25Data1 /* sqlite3.c:215879:29 */ + +// Callback used by fts5Bm25GetData() to count the number of rows in the +// table matched by each individual phrase within the query. +func fts5CountCb(tls *libc.TLS, pApi uintptr, pFts uintptr, pUserData uintptr) int32 { /* sqlite3.c:215891:12: */ + var pn uintptr = pUserData + _ = pApi + _ = pFts + (*(*Sqlite3_int64)(unsafe.Pointer(pn)))++ + return SQLITE_OK +} + +// Set *ppData to point to the Fts5Bm25Data object for the current query. +// If the object has not already been allocated, allocate and populate it +// now. +func fts5Bm25GetData(tls *libc.TLS, pApi uintptr, pFts uintptr, ppData uintptr) int32 { /* sqlite3.c:215907:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 = SQLITE_OK // Return code + var p uintptr // Object to return + + p = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((pApi + 120 /* &.xGetAuxdata */))))(tls, pFts, 0) + if p == uintptr(0) { + var nPhrase int32 // Number of phrases in query + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nRow */)) = int64(0) // Number of rows in table + *(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* nToken */)) = int64(0) // Number of tokens in table + var nByte Sqlite3_int64 // Bytes of space to allocate + var i int32 + + // Allocate the Fts5Bm25Data object + nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 48 /* &.xPhraseCount */))))(tls, pFts) + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Bm25Data{})) + ((uint64(nPhrase * 2)) * uint64(unsafe.Sizeof(float64(0)))))) + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, Size_t(nByte)) + (*Fts5Bm25Data)(unsafe.Pointer(p)).FnPhrase = nPhrase + (*Fts5Bm25Data)(unsafe.Pointer(p)).FaIDF = (p + 1*32) + (*Fts5Bm25Data)(unsafe.Pointer(p)).FaFreq = ((*Fts5Bm25Data)(unsafe.Pointer(p)).FaIDF + uintptr(nPhrase)*8) + } + + // Calculate the average document length for this FTS5 table + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 24 /* &.xRowCount */))))(tls, pFts, bp /* &nRow */) + } + + if rc == SQLITE_OK { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 32 /* &.xColumnTotalSize */))))(tls, pFts, -1, bp+8 /* &nToken */) + } + if rc == SQLITE_OK { + (*Fts5Bm25Data)(unsafe.Pointer(p)).Favgdl = (float64(*(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* nToken */))) / float64(*(*Sqlite3_int64)(unsafe.Pointer(bp /* nRow */)))) + } + + // Calculate an IDF for each phrase in the query + for i = 0; (rc == SQLITE_OK) && (i < nPhrase); i++ { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* nHit */)) = int64(0) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 104 /* &.xQueryPhrase */))))(tls, pFts, i, bp+16 /* &nHit */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) int32 + }{fts5CountCb}))) + if rc == SQLITE_OK { + // Calculate the IDF (Inverse Document Frequency) for phrase i. + // This is done using the standard BM25 formula as found on wikipedia: + // + // IDF = log( (N - nHit + 0.5) / (nHit + 0.5) ) + // + // where "N" is the total number of documents in the set and nHit + // is the number that contain at least one instance of the phrase + // under consideration. + // + // The problem with this is that if (N < 2*nHit), the IDF is + // negative. Which is undesirable. So the mimimum allowable IDF is + // (1e-6) - roughly the same as a term that appears in just over + // half of set of 5,000,000 documents. + var idf float64 = libc.Xlog(tls, (((float64(*(*Sqlite3_int64)(unsafe.Pointer(bp /* nRow */)) - *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* nHit */)))) + 0.5) / (float64(*(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* nHit */))) + 0.5))) + if idf <= 0.0 { + idf = 1e-6 + } + *(*float64)(unsafe.Pointer((*Fts5Bm25Data)(unsafe.Pointer(p)).FaIDF + uintptr(i)*8)) = idf + } + } + + if rc != SQLITE_OK { + Xsqlite3_free(tls, p) + } else { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 112 /* &.xSetAuxdata */))))(tls, pFts, p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + } + if rc != SQLITE_OK { + p = uintptr(0) + } + } + *(*uintptr)(unsafe.Pointer(ppData)) = p + return rc +} + +// Implementation of bm25() function. +func fts5Bm25Function(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* sqlite3.c:215980:13: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var k1 float64 = 1.2 // Constant "k1" from BM25 formula + var b float64 = 0.75 // Constant "b" from BM25 formula + var rc int32 // Error code + var score float64 = 0.0 // SQL function return value + // var pData uintptr at bp, 8 + // Values allocated/calculated once only + var i int32 // Iterator variable + *(*int32)(unsafe.Pointer(bp + 8 /* nInst */)) = 0 // Value returned by xInstCount() + var D float64 = 0.0 // Total number of tokens in row + var aFreq uintptr = uintptr(0) // Array of phrase freq. for current row + + // Calculate the phrase frequency (symbol "f(qi,D)" in the documentation) + // for each phrase in the query for the current row. + rc = fts5Bm25GetData(tls, pApi, pFts, bp /* &pData */) + if rc == SQLITE_OK { + aFreq = (*Fts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pData */)))).FaFreq + libc.Xmemset(tls, aFreq, 0, (uint64(unsafe.Sizeof(float64(0))) * uint64((*Fts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pData */)))).FnPhrase))) + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xInstCount */))))(tls, pFts, bp+8 /* &nInst */) + } + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nInst */))); i++ { + // var ip int32 at bp+12, 4 + + // var ic int32 at bp+16, 4 + + // var io int32 at bp+20, 4 + + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 72 /* &.xInst */))))(tls, pFts, i, bp+12 /* &ip */, bp+16 /* &ic */, bp+20 /* &io */) + if rc == SQLITE_OK { + var w float64 + if nVal > *(*int32)(unsafe.Pointer(bp + 16 /* ic */)) { + w = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* ic */)))*8))) + } else { + w = 1.0 + } + *(*float64)(unsafe.Pointer(aFreq + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* ip */)))*8)) += (w) + } + } + + // Figure out the total size of the current row in tokens. + if rc == SQLITE_OK { + // var nTok int32 at bp+24, 4 + + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 96 /* &.xColumnSize */))))(tls, pFts, -1, bp+24 /* &nTok */) + D = float64(*(*int32)(unsafe.Pointer(bp + 24 /* nTok */))) + } + + // Determine and return the BM25 score for the current row. Or, if an + // error has occurred, throw an exception. + if rc == SQLITE_OK { + for i = 0; i < (*Fts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pData */)))).FnPhrase; i++ { + score = score + (*(*float64)(unsafe.Pointer((*Fts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pData */)))).FaIDF + uintptr(i)*8)) * ((*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) * (k1 + 1.0)) / (*(*float64)(unsafe.Pointer(aFreq + uintptr(i)*8)) + (k1 * ((float64(1) - b) + ((b * D) / (*Fts5Bm25Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pData */)))).Favgdl)))))) + } + Xsqlite3_result_double(tls, pCtx, (-1.0 * score)) + } else { + Xsqlite3_result_error_code(tls, pCtx, rc) + } +} + +func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036:12: */ + bp := tls.Alloc(96) + defer tls.Free(96) + + *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ + {FzFunc: ts + 32047 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) + }{fts5SnippetFunction}))}, + {FzFunc: ts + 32055 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) + }{fts5HighlightFunction}))}, + {FzFunc: ts + 32065 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) + }{fts5Bm25Function}))}, + } + var rc int32 = SQLITE_OK // Return code + var i int32 // To iterate through builtin functions + + for i = 0; (rc == SQLITE_OK) && (i < (int32(uint64(unsafe.Sizeof([3]Builtin{})) / uint64(unsafe.Sizeof(Builtin{}))))); i++ { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, Fts5_extension_function, uintptr) int32)(unsafe.Pointer((pApi + 24 /* &.xCreateFunction */))))(tls, pApi, + (*Builtin)(unsafe.Pointer(bp /* &aBuiltin */ +uintptr(i)*32)).FzFunc, + (*Builtin)(unsafe.Pointer(bp /* &aBuiltin */ +uintptr(i)*32)).FpUserData, + (*Builtin)(unsafe.Pointer(bp /* &aBuiltin */ +uintptr(i)*32)).FxFunc, + (*Builtin)(unsafe.Pointer(bp /* &aBuiltin */ +uintptr(i)*32)).FxDestroy) + } + + return rc +} + +type Builtin = struct { + FzFunc uintptr + FpUserData uintptr + FxFunc Fts5_extension_function + FxDestroy uintptr +} /* sqlite3.c:216037:3 */ + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// #include "fts5Int.h" + +func sqlite3Fts5BufferSize(tls *libc.TLS, pRc uintptr, pBuf uintptr, nByte U32) int32 { /* sqlite3.c:216079:12: */ + if U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) < nByte { + var nNew U64 + if (*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace != 0 { + nNew = uint64((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace) + } else { + nNew = uint64(64) + } + var pNew uintptr + for nNew < U64(nByte) { + nNew = (nNew * uint64(2)) + } + pNew = Xsqlite3_realloc64(tls, (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp, nNew) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } else { + (*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace = int32(nNew) + (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp = pNew + } + } + return 0 +} + +// Encode value iVal as an SQLite varint and append it to the buffer object +// pBuf. If an OOM error occurs, set the error code in p. +func sqlite3Fts5BufferAppendVarint(tls *libc.TLS, pRc uintptr, pBuf uintptr, iVal I64) { /* sqlite3.c:216103:13: */ + if func() int32 { + if ((U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + (U32(9))) <= (U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace)) { + return 0 + } + return sqlite3Fts5BufferSize(tls, pRc, pBuf, (uint32((9) + (*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn))) + }() != 0 { + return + } + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), uint64(iVal))) +} + +func sqlite3Fts5Put32(tls *libc.TLS, aBuf uintptr, iVal int32) { /* sqlite3.c:216108:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((iVal >> 24) & 0x00FF)) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((iVal >> 16) & 0x00FF)) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((iVal >> 8) & 0x00FF)) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((iVal >> 0) & 0x00FF)) +} + +func sqlite3Fts5Get32(tls *libc.TLS, aBuf uintptr) int32 { /* sqlite3.c:216115:12: */ + return (int32(((((U32(*(*U8)(unsafe.Pointer(aBuf)))) << 24) + (U32(int32(*(*U8)(unsafe.Pointer(aBuf + 1))) << 16))) + (U32(int32(*(*U8)(unsafe.Pointer(aBuf + 2))) << 8))) + U32(*(*U8)(unsafe.Pointer(aBuf + 3))))) +} + +// Append buffer nData/pData to buffer pBuf. If an OOM error occurs, set +// the error code in p. If an error has already occurred when this function +// is called, it is a no-op. +func sqlite3Fts5BufferAppendBlob(tls *libc.TLS, pRc uintptr, pBuf uintptr, nData U32, pData uintptr) { /* sqlite3.c:216124:13: */ + + if nData != 0 { + if func() int32 { + if ((U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + (nData)) <= (U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace)) { + return 0 + } + return sqlite3Fts5BufferSize(tls, pRc, pBuf, ((nData) + U32((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn))) + }() != 0 { + return + } + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), pData, uint64(nData)) + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += int32((nData)) + } +} + +// Append the nul-terminated string zStr to the buffer pBuf. This function +// ensures that the byte following the buffer data is set to 0x00, even +// though this byte is not included in the pBuf->n count. +func sqlite3Fts5BufferAppendString(tls *libc.TLS, pRc uintptr, pBuf uintptr, zStr uintptr) { /* sqlite3.c:216143:13: */ + var nStr int32 = int32(libc.Xstrlen(tls, zStr)) + sqlite3Fts5BufferAppendBlob(tls, pRc, pBuf, (uint32(nStr + 1)), zStr) + (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn-- +} + +// Argument zFmt is a printf() style format string. This function performs +// the printf() style processing, then appends the results to buffer pBuf. +// +// Like sqlite3Fts5BufferAppendString(), this function ensures that the byte +// following the buffer data is set to 0x00, even though this byte is not +// included in the pBuf->n count. +func sqlite3Fts5BufferAppendPrintf(tls *libc.TLS, pRc uintptr, pBuf uintptr, zFmt uintptr, va uintptr) { /* sqlite3.c:216161:13: */ + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var zTmp uintptr + var ap Va_list + _ = ap + ap = va + zTmp = Xsqlite3_vmprintf(tls, zFmt, ap) + _ = ap + + if zTmp == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + sqlite3Fts5BufferAppendString(tls, pRc, pBuf, zTmp) + Xsqlite3_free(tls, zTmp) + } + } +} + +func sqlite3Fts5Mprintf(tls *libc.TLS, pRc uintptr, zFmt uintptr, va uintptr) uintptr { /* sqlite3.c:216182:13: */ + var zRet uintptr = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var ap Va_list + _ = ap + ap = va + zRet = Xsqlite3_vmprintf(tls, zFmt, ap) + _ = ap + if zRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + return zRet +} + +// Free any buffer allocated by pBuf. Zero the structure before returning. +func sqlite3Fts5BufferFree(tls *libc.TLS, pBuf uintptr) { /* sqlite3.c:216200:13: */ + Xsqlite3_free(tls, (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp) + libc.Xmemset(tls, pBuf, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) +} + +// Zero the contents of the buffer object. But do not free the associated +// memory allocation. +func sqlite3Fts5BufferZero(tls *libc.TLS, pBuf uintptr) { /* sqlite3.c:216209:13: */ + (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn = 0 +} + +// Set the buffer to contain nData/pData. If an OOM error occurs, leave an +// the error code in p. If an error has already occurred when this function +// is called, it is a no-op. +func sqlite3Fts5BufferSet(tls *libc.TLS, pRc uintptr, pBuf uintptr, nData int32, pData uintptr) { /* sqlite3.c:216218:13: */ + (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn = 0 + sqlite3Fts5BufferAppendBlob(tls, pRc, pBuf, uint32(nData), pData) +} + +func sqlite3Fts5PoslistNext64(tls *libc.TLS, a uintptr, n int32, pi uintptr, piOff uintptr) int32 { /* sqlite3.c:216228:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 = *(*int32)(unsafe.Pointer(pi)) + if i >= n { + // EOF + *(*I64)(unsafe.Pointer(piOff)) = int64(-1) + return 1 + } else { + var iOff I64 = *(*I64)(unsafe.Pointer(piOff)) + // var iVal int32 at bp, 4 + + { + *(*int32)(unsafe.Pointer(bp /* iVal */)) = int32(*(*U8)(unsafe.Pointer((a) + uintptr(libc.PostIncInt32(&i, 1))))) + if (*(*int32)(unsafe.Pointer(bp /* iVal */)) & 0x80) != 0 { + i-- + i = i + (sqlite3Fts5GetVarint32(tls, ((a) + uintptr(i)), bp /* &iVal */)) + } + } + + if *(*int32)(unsafe.Pointer(bp /* iVal */)) <= 1 { + if *(*int32)(unsafe.Pointer(bp /* iVal */)) == 0 { + *(*int32)(unsafe.Pointer(pi)) = i + return 0 + } + { + *(*int32)(unsafe.Pointer(bp /* iVal */)) = int32(*(*U8)(unsafe.Pointer((a) + uintptr(libc.PostIncInt32(&i, 1))))) + if (*(*int32)(unsafe.Pointer(bp /* iVal */)) & 0x80) != 0 { + i-- + i = i + (sqlite3Fts5GetVarint32(tls, ((a) + uintptr(i)), bp /* &iVal */)) + } + } + + iOff = ((I64(*(*int32)(unsafe.Pointer(bp /* iVal */)))) << 32) + { + *(*int32)(unsafe.Pointer(bp /* iVal */)) = int32(*(*U8)(unsafe.Pointer((a) + uintptr(libc.PostIncInt32(&i, 1))))) + if (*(*int32)(unsafe.Pointer(bp /* iVal */)) & 0x80) != 0 { + i-- + i = i + (sqlite3Fts5GetVarint32(tls, ((a) + uintptr(i)), bp /* &iVal */)) + } + } + + if *(*int32)(unsafe.Pointer(bp /* iVal */)) < 2 { + // This is a corrupt record. So stop parsing it here. + *(*I64)(unsafe.Pointer(piOff)) = int64(-1) + return 1 + } + *(*I64)(unsafe.Pointer(piOff)) = (iOff + (I64((*(*int32)(unsafe.Pointer(bp /* iVal */)) - 2) & 0x7FFFFFFF))) + } else { + *(*I64)(unsafe.Pointer(piOff)) = ((iOff & (I64(int64(0x7FFFFFFF)) << 32)) + ((iOff + (I64(*(*int32)(unsafe.Pointer(bp /* iVal */)) - 2))) & int64(0x7FFFFFFF))) + } + *(*int32)(unsafe.Pointer(pi)) = i + + return 0 + } + return int32(0) +} + +// Advance the iterator object passed as the only argument. Return true +// if the iterator reaches EOF, or false otherwise. +func sqlite3Fts5PoslistReaderNext(tls *libc.TLS, pIter uintptr) int32 { /* sqlite3.c:216271:12: */ + if sqlite3Fts5PoslistNext64(tls, (*Fts5PoslistReader)(unsafe.Pointer(pIter)).Fa, (*Fts5PoslistReader)(unsafe.Pointer(pIter)).Fn, (pIter+12 /* &.i */), (pIter+24 /* &.iPos */)) != 0 { + (*Fts5PoslistReader)(unsafe.Pointer(pIter)).FbEof = U8(1) + } + return int32((*Fts5PoslistReader)(unsafe.Pointer(pIter)).FbEof) +} + +func sqlite3Fts5PoslistReaderInit(tls *libc.TLS, a uintptr, n int32, pIter uintptr) int32 { /* sqlite3.c:216278:12: */ + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(Fts5PoslistReader{}))) + (*Fts5PoslistReader)(unsafe.Pointer(pIter)).Fa = a + (*Fts5PoslistReader)(unsafe.Pointer(pIter)).Fn = n + sqlite3Fts5PoslistReaderNext(tls, pIter) + return int32((*Fts5PoslistReader)(unsafe.Pointer(pIter)).FbEof) +} + +// Append position iPos to the position list being accumulated in buffer +// pBuf, which must be already be large enough to hold the new data. +// The previous position written to this list is *piPrev. *piPrev is set +// to iPos before returning. +func sqlite3Fts5PoslistSafeAppend(tls *libc.TLS, pBuf uintptr, piPrev uintptr, iPos I64) { /* sqlite3.c:216295:13: */ + if iPos >= *(*I64)(unsafe.Pointer(piPrev)) { + if (iPos & colmask) != (*(*I64)(unsafe.Pointer(piPrev)) & colmask) { + *(*U8)(unsafe.Pointer((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(libc.PostIncInt32(&(*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn, 1)))) = U8(1) + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), (uint64(iPos >> 32)))) + *(*I64)(unsafe.Pointer(piPrev)) = (iPos & colmask) + } + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), (uint64((iPos - *(*I64)(unsafe.Pointer(piPrev))) + int64(2))))) + *(*I64)(unsafe.Pointer(piPrev)) = iPos + } +} + +var colmask I64 = (I64((int64(0x7FFFFFFF))) << 32) /* sqlite3.c:216301:22 */ + +func sqlite3Fts5PoslistWriterAppend(tls *libc.TLS, pBuf uintptr, pWriter uintptr, iPos I64) int32 { /* sqlite3.c:216312:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 // Initialized only to suppress erroneous warning from Clang + if func() int32 { + if ((U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + (U32((5 + 5) + 5))) <= (U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace)) { + return 0 + } + return sqlite3Fts5BufferSize(tls, bp /* &rc */, pBuf, (uint32(((5 + 5) + 5) + (*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn))) + }() != 0 { + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + sqlite3Fts5PoslistSafeAppend(tls, pBuf, (pWriter /* &.iPrev */), iPos) + return SQLITE_OK +} + +func sqlite3Fts5MallocZero(tls *libc.TLS, pRc uintptr, nByte Sqlite3_int64) uintptr { /* sqlite3.c:216323:13: */ + var pRet uintptr = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pRet == uintptr(0) { + if nByte > int64(0) { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } else { + libc.Xmemset(tls, pRet, 0, Size_t(nByte)) + } + } + return pRet +} + +// Return a nul-terminated copy of the string indicated by pIn. If nIn +// is non-negative, then it is the length of the string in bytes. Otherwise, +// the length of the string is determined using strlen(). +// +// It is the responsibility of the caller to eventually free the returned +// buffer using sqlite3_free(). If an OOM error occurs, NULL is returned. +func sqlite3Fts5Strndup(tls *libc.TLS, pRc uintptr, pIn uintptr, nIn int32) uintptr { /* sqlite3.c:216344:13: */ + var zRet uintptr = uintptr(0) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + if nIn < 0 { + nIn = int32(libc.Xstrlen(tls, pIn)) + } + zRet = Xsqlite3_malloc(tls, (nIn + 1)) + if zRet != 0 { + libc.Xmemcpy(tls, zRet, pIn, uint64(nIn)) + *(*int8)(unsafe.Pointer(zRet + uintptr(nIn))) = int8(0) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + return zRet +} + +// Return true if character 't' may be part of an FTS5 bareword, or false +// otherwise. Characters that may be part of barewords: +// +// * All non-ASCII characters, +// * The 52 upper and lower case ASCII characters, and +// * The 10 integer ASCII characters. +// * The underscore character "_" (0x5F). +// * The unicode "subsitute" character (0x1A). +func sqlite3Fts5IsBareword(tls *libc.TLS, t int8) int32 { /* sqlite3.c:216372:12: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + *(*[128]U8)(unsafe.Pointer(bp /* aBareword */)) = [128]U8{ + U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), // 0x00 .. 0x0F + U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(1), U8(0), U8(0), U8(0), U8(0), U8(0), // 0x10 .. 0x1F + U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), // 0x20 .. 0x2F + U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), // 0x30 .. 0x3F + U8(0), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), // 0x40 .. 0x4F + U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(0), U8(0), U8(0), U8(0), U8(1), // 0x50 .. 0x5F + U8(0), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), // 0x60 .. 0x6F + U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(1), U8(0), U8(0), U8(0), U8(0), U8(0), // 0x70 .. 0x7F + } + + return (libc.Bool32(((int32(t) & 0x80) != 0) || (*(*U8)(unsafe.Pointer(bp /* &aBareword[0] */ + uintptr(int32(t)))) != 0))) +} + +// ************************************************************************ +// +type Fts5TermsetEntry1 = struct { + FpTerm uintptr + FnTerm int32 + FiIdx int32 + FpNext uintptr +} /* sqlite3.c:213342:9 */ + +// ************************************************************************ +// +type Fts5TermsetEntry = Fts5TermsetEntry1 /* sqlite3.c:216390:33 */ + +func sqlite3Fts5TermsetNew(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:216402:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(pp)) = sqlite3Fts5MallocZero(tls, bp /* &rc */, int64(unsafe.Sizeof(Fts5Termset{}))) + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +func sqlite3Fts5TermsetAdd(tls *libc.TLS, p uintptr, iIdx int32, pTerm uintptr, nTerm int32, pbPresent uintptr) int32 { /* sqlite3.c:216408:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(pbPresent)) = 0 + if p != 0 { + var i int32 + var hash U32 = U32(13) + var pEntry uintptr + + // Calculate a hash value for this term. This is the same hash checksum + // used by the fts5_hash.c module. This is not important for correct + // operation of the module, but is necessary to ensure that some tests + // designed to produce hash table collisions really do work. + for i = (nTerm - 1); i >= 0; i-- { + hash = (((hash << 3) ^ hash) ^ U32(*(*int8)(unsafe.Pointer(pTerm + uintptr(i))))) + } + hash = (((hash << 3) ^ hash) ^ U32(iIdx)) + hash = (hash % (U32((int32(uint64(unsafe.Sizeof([512]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))))))) + + for pEntry = *(*uintptr)(unsafe.Pointer((p /* &.apHash */) + uintptr(hash)*8)); pEntry != 0; pEntry = (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FpNext { + if (((*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FiIdx == iIdx) && + ((*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FnTerm == nTerm)) && + (libc.Xmemcmp(tls, (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FpTerm, pTerm, uint64(nTerm)) == 0) { + *(*int32)(unsafe.Pointer(pbPresent)) = 1 + break + } + } + + if pEntry == uintptr(0) { + pEntry = sqlite3Fts5MallocZero(tls, bp /* &rc */, (int64(uint64(unsafe.Sizeof(Fts5TermsetEntry{})) + uint64(nTerm)))) + if pEntry != 0 { + (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FpTerm = (pEntry + 1*24) + (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FnTerm = nTerm + (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FiIdx = iIdx + libc.Xmemcpy(tls, (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FpTerm, pTerm, uint64(nTerm)) + (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FpNext = *(*uintptr)(unsafe.Pointer((p /* &.apHash */) + uintptr(hash)*8)) + *(*uintptr)(unsafe.Pointer((p /* &.apHash */) + uintptr(hash)*8)) = pEntry + } + } + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +func sqlite3Fts5TermsetFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:216457:13: */ + if p != 0 { + var i U32 + for i = U32(0); i < (U32((int32(uint64(unsafe.Sizeof([512]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))))); i++ { + var pEntry uintptr = *(*uintptr)(unsafe.Pointer((p /* &.apHash */) + uintptr(i)*8)) + for pEntry != 0 { + var pDel uintptr = pEntry + pEntry = (*Fts5TermsetEntry)(unsafe.Pointer(pEntry)).FpNext + Xsqlite3_free(tls, pDel) + } + } + Xsqlite3_free(tls, p) + } +} + +// 2014 Jun 09 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is an SQLite module implementing full-text search. + +// #include "fts5Int.h" + +// Maximum allowed page size + +func fts5_iswhitespace(tls *libc.TLS, x int8) int32 { /* sqlite3.c:216499:12: */ + return (libc.Bool32(int32(x) == ' ')) +} + +func fts5_isopenquote(tls *libc.TLS, x int8) int32 { /* sqlite3.c:216503:12: */ + return (libc.Bool32((((int32(x) == '"') || (int32(x) == '\'')) || (int32(x) == '[')) || (int32(x) == '`'))) +} + +// Argument pIn points to a character that is part of a nul-terminated +// string. Return a pointer to the first character following *pIn in +// the string that is not a white-space character. +func fts5ConfigSkipWhitespace(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:216512:19: */ + var p uintptr = pIn + if p != 0 { + for fts5_iswhitespace(tls, *(*int8)(unsafe.Pointer(p))) != 0 { + p++ + } + } + return p +} + +// Argument pIn points to a character that is part of a nul-terminated +// string. Return a pointer to the first character following *pIn in +// the string that is not a "bareword" character. +func fts5ConfigSkipBareword(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:216525:19: */ + var p uintptr = pIn + for sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(p))) != 0 { + p++ + } + if p == pIn { + p = uintptr(0) + } + return p +} + +func fts5_isdigit(tls *libc.TLS, a int8) int32 { /* sqlite3.c:216532:12: */ + return (libc.Bool32((int32(a) >= '0') && (int32(a) <= '9'))) +} + +func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:216538:19: */ + var p uintptr = pIn + switch int32(*(*int8)(unsafe.Pointer(p))) { + case 'n': + fallthrough + case 'N': + if Xsqlite3_strnicmp(tls, ts+5259 /* "null" */, p, 4) == 0 { + p = (p + 4) + } else { + p = uintptr(0) + } + break + + case 'x': + fallthrough + case 'X': + p++ + if int32(*(*int8)(unsafe.Pointer(p))) == '\'' { + p++ + for (((int32(*(*int8)(unsafe.Pointer(p))) >= 'a') && (int32(*(*int8)(unsafe.Pointer(p))) <= 'f')) || + ((int32(*(*int8)(unsafe.Pointer(p))) >= 'A') && (int32(*(*int8)(unsafe.Pointer(p))) <= 'F'))) || + ((int32(*(*int8)(unsafe.Pointer(p))) >= '0') && (int32(*(*int8)(unsafe.Pointer(p))) <= '9')) { + p++ + } + if (int32(*(*int8)(unsafe.Pointer(p))) == '\'') && (int64(0) == (((int64(p) - int64(pIn)) / 1) % int64(2))) { + p++ + } else { + p = uintptr(0) + } + } else { + p = uintptr(0) + } + break + + case '\'': + p++ + for p != 0 { + if int32(*(*int8)(unsafe.Pointer(p))) == '\'' { + p++ + if int32(*(*int8)(unsafe.Pointer(p))) != '\'' { + break + } + } + p++ + if int32(*(*int8)(unsafe.Pointer(p))) == 0 { + p = uintptr(0) + } + } + break + + default: + // maybe a number + if (int32(*(*int8)(unsafe.Pointer(p))) == '+') || (int32(*(*int8)(unsafe.Pointer(p))) == '-') { + p++ + } + for fts5_isdigit(tls, *(*int8)(unsafe.Pointer(p))) != 0 { + p++ + } + + // At this point, if the literal was an integer, the parse is + // finished. Or, if it is a floating point value, it may continue + // with either a decimal point or an 'E' character. + if (int32(*(*int8)(unsafe.Pointer(p))) == '.') && (fts5_isdigit(tls, *(*int8)(unsafe.Pointer(p + 1))) != 0) { + p += uintptr(2) + for fts5_isdigit(tls, *(*int8)(unsafe.Pointer(p))) != 0 { + p++ + } + } + if p == pIn { + p = uintptr(0) + } + + break + } + + return p +} + +// The first character of the string pointed to by argument z is guaranteed +// to be an open-quote character (see function fts5_isopenquote()). +// +// This function searches for the corresponding close-quote character within +// the string and, if found, dequotes the string in place and adds a new +// nul-terminator byte. +// +// If the close-quote is found, the value returned is the byte offset of +// the character immediately following it. Or, if the close-quote is not +// found, -1 is returned. If -1 is returned, the buffer is left in an +// undefined state. +func fts5Dequote(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:216614:12: */ + var q int8 + var iIn int32 = 1 + var iOut int32 = 0 + q = *(*int8)(unsafe.Pointer(z)) + + // Set stack variable q to the close-quote character + + if int32(q) == '[' { + q = int8(']') + } + + for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 { + if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) { + if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) { + // Character iIn was the close quote. + iIn++ + break + } else { + // Character iIn and iIn+1 form an escaped quote character. Skip + // the input cursor past both and copy a single quote character + // to the output buffer. + iIn = iIn + (2) + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q + } + } else { + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1)))) + } + } + + *(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0) + return iIn +} + +// Convert an SQL-style quoted string into a normal string by removing +// the quote characters. The conversion is done in-place. If the +// input does not begin with a quote character, then this routine +// is a no-op. +// +// Examples: +// +// "abc" becomes abc +// 'xyz' becomes xyz +// [pqr] becomes pqr +// `mno` becomes mno +func sqlite3Fts5Dequote(tls *libc.TLS, z uintptr) { /* sqlite3.c:216659:13: */ + var quote int8 // Quote character (if any ) + + quote = *(*int8)(unsafe.Pointer(z)) + if (((int32(quote) == '[') || (int32(quote) == '\'')) || (int32(quote) == '"')) || (int32(quote) == '`') { + fts5Dequote(tls, z) + } +} + +type Fts5Enum1 = struct { + FzName uintptr + FeVal int32 + _ [4]byte +} /* sqlite3.c:216670:1 */ + +type Fts5Enum = Fts5Enum1 /* sqlite3.c:216674:25 */ + +func fts5ConfigSetEnum(tls *libc.TLS, aEnum uintptr, zEnum uintptr, peVal uintptr) int32 { /* sqlite3.c:216676:12: */ + var nEnum int32 = int32(libc.Xstrlen(tls, zEnum)) + var i int32 + var iVal int32 = -1 + + for i = 0; (*Fts5Enum)(unsafe.Pointer(aEnum+uintptr(i)*16)).FzName != 0; i++ { + if Xsqlite3_strnicmp(tls, (*Fts5Enum)(unsafe.Pointer(aEnum+uintptr(i)*16)).FzName, zEnum, nEnum) == 0 { + if iVal >= 0 { + return SQLITE_ERROR + } + iVal = (*Fts5Enum)(unsafe.Pointer(aEnum + uintptr(i)*16)).FeVal + } + } + + *(*int32)(unsafe.Pointer(peVal)) = iVal + if iVal < 0 { + return SQLITE_ERROR + } + return SQLITE_OK +} + +// Parse a "special" CREATE VIRTUAL TABLE directive and update +// configuration object pConfig as appropriate. +// +// If successful, object pConfig is updated and SQLITE_OK returned. If +// an error occurs, an SQLite error code is returned and an error message +// may be left in *pzErr. It is the responsibility of the caller to +// eventually free any such error message using sqlite3_free(). +func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCmd uintptr, zArg uintptr, pzErr uintptr) int32 { /* sqlite3.c:216705:12: */ + bp := tls.Alloc(112) + defer tls.Free(112) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) + if Xsqlite3_strnicmp(tls, ts+32070 /* "prefix" */, zCmd, nCmd) == 0 { + var nByte int32 = (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(FTS5_MAX_PREFIX_INDEXES))) + var p uintptr + var bFirst int32 = 1 + if (*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix == uintptr(0) { + (*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, int64(nByte)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + } + + p = zArg + for 1 != 0 { + var nPre int32 = 0 + + for int32(*(*int8)(unsafe.Pointer(p))) == ' ' { + p++ + } + if (bFirst == 0) && (int32(*(*int8)(unsafe.Pointer(p))) == ',') { + p++ + for int32(*(*int8)(unsafe.Pointer(p))) == ' ' { + p++ + } + } else if int32(*(*int8)(unsafe.Pointer(p))) == 0 { + break + } + if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32077 /* "malformed prefix..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + break + } + + if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, + ts+32108 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + break + } + + for ((int32(*(*int8)(unsafe.Pointer(p))) >= '0') && (int32(*(*int8)(unsafe.Pointer(p))) <= '9')) && (nPre < 1000) { + nPre = ((nPre * 10) + (int32(*(*int8)(unsafe.Pointer(p))) - '0')) + p++ + } + + if (nPre <= 0) || (nPre >= 1000) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32141 /* "prefix length ou..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + break + } + + *(*int32)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr((*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix)*4)) = nPre + (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix++ + bFirst = 0 + } + + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + if Xsqlite3_strnicmp(tls, ts+32178 /* "tokenize" */, zCmd, nCmd) == 0 { + var p uintptr = zArg + var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + uint64(1))) + var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) + var pDel uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (nArg * int64(2))) + var pSpace uintptr = pDel + + if (azArg != 0) && (pSpace != 0) { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32187 /* "multiple tokeniz..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } else { + for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { + var p2 uintptr = fts5ConfigSkipWhitespace(tls, p) + if int32(*(*int8)(unsafe.Pointer(p2))) == '\'' { + p = fts5ConfigSkipLiteral(tls, p2) + } else { + p = fts5ConfigSkipBareword(tls, p2) + } + if p != 0 { + libc.Xmemcpy(tls, pSpace, p2, (uint64((int64(p) - int64(p2)) / 1))) + *(*uintptr)(unsafe.Pointer(azArg + uintptr(nArg)*8)) = pSpace + sqlite3Fts5Dequote(tls, pSpace) + pSpace += (uintptr(((int64(p) - int64(p2)) / 1) + int64(1))) + p = fts5ConfigSkipWhitespace(tls, p) + } + } + if p == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32220 /* "parse error in t..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, + azArg, int32(nArg), pConfig, + pzErr) + } + } + } + + Xsqlite3_free(tls, azArg) + Xsqlite3_free(tls, pDel) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + if Xsqlite3_strnicmp(tls, ts+32254 /* "content" */, zCmd, nCmd) == 0 { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32262 /* "multiple content..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } else { + if *(*int8)(unsafe.Pointer(zArg)) != 0 { + (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32294 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE + } + } + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + if Xsqlite3_strnicmp(tls, ts+32300 /* "content_rowid" */, zCmd, nCmd) == 0 { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32314 /* "multiple content..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) + } + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + if Xsqlite3_strnicmp(tls, ts+32352 /* "columnsize" */, zCmd, nCmd) == 0 { + if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32363 /* "malformed column..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) + } + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + if Xsqlite3_strnicmp(tls, ts+4190 /* "detail" */, zCmd, nCmd) == 0 { + *(*[4]Fts5Enum)(unsafe.Pointer(bp + 48 /* aDetail */)) = [4]Fts5Enum{ + {FzName: ts + 15829 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 15834 /* "full" */}, + {FzName: ts + 32398 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {}, + } + + if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+48 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32406 /* "malformed detail..." */, 0) + } + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32437 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + return SQLITE_ERROR +} + +// Allocate an instance of the default tokenizer ("simple") at +// Fts5Config.pTokenizer. Return SQLITE_OK if successful, or an SQLite error +// code if an error occurs. +func fts5ConfigDefaultTokenizer(tls *libc.TLS, pGlobal uintptr, pConfig uintptr) int32 { /* sqlite3.c:216869:12: */ + + return sqlite3Fts5GetTokenizer(tls, pGlobal, uintptr(0), 0, pConfig, uintptr(0)) +} + +// Gobble up the first bareword or quoted word from the input buffer zIn. +// Return a pointer to the character immediately following the last in +// the gobbled word if successful, or a NULL pointer otherwise (failed +// to find close-quote character). +// +// Before returning, set pzOut to point to a new buffer containing a +// nul-terminated, dequoted copy of the gobbled word. If the word was +// quoted, *pbQuoted is also set to 1 before returning. +// +// If *pRc is other than SQLITE_OK when this function is called, it is +// a no-op (NULL is returned). Otherwise, if an OOM occurs within this +// function, *pRc is set to SQLITE_NOMEM before returning. *pRc is *not* +// set if a parse error (failed to find close quote) occurs. +func fts5ConfigGobbleWord(tls *libc.TLS, pRc uintptr, zIn uintptr, pzOut uintptr, pbQuoted uintptr) uintptr { /* sqlite3.c:216889:19: */ + var zRet uintptr = uintptr(0) + + var nIn Sqlite3_int64 = Sqlite3_int64(libc.Xstrlen(tls, zIn)) + var zOut uintptr = Xsqlite3_malloc64(tls, (uint64(nIn + int64(1)))) + + *(*int32)(unsafe.Pointer(pbQuoted)) = 0 + *(*uintptr)(unsafe.Pointer(pzOut)) = uintptr(0) + + if zOut == uintptr(0) { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + libc.Xmemcpy(tls, zOut, zIn, (Size_t(nIn + int64(1)))) + if fts5_isopenquote(tls, *(*int8)(unsafe.Pointer(zOut))) != 0 { + var ii int32 = fts5Dequote(tls, zOut) + zRet = (zIn + uintptr(ii)) + *(*int32)(unsafe.Pointer(pbQuoted)) = 1 + } else { + zRet = fts5ConfigSkipBareword(tls, zIn) + if zRet != 0 { + *(*int8)(unsafe.Pointer(zOut + uintptr(((int64(zRet) - int64(zIn)) / 1)))) = int8(0) + } + } + } + + if zRet == uintptr(0) { + Xsqlite3_free(tls, zOut) + } else { + *(*uintptr)(unsafe.Pointer(pzOut)) = zOut + } + + return zRet +} + +func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, pzErr uintptr) int32 { /* sqlite3.c:216929:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 = SQLITE_OK + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20498 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+14758 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32465 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + rc = SQLITE_ERROR + } else if zArg != 0 { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32495 /* "unindexed" */) { + *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32505 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + rc = SQLITE_ERROR + } + } + + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(libc.PostIncInt32(&(*Fts5Config)(unsafe.Pointer(p)).FnCol, 1))*8)) = zCol + return rc +} + +// Populate the Fts5Config.zContentExprlist string. +func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:216957:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var i int32 + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf */)) = Fts5Buffer{} + + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32536 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { + for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { + if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32541 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + } else { + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32548 /* ", T.c%d" */, libc.VaList(bp+16, i)) + } + } + } + + (*Fts5Config)(unsafe.Pointer(p)).FzContentExprlist = (*Fts5Buffer)(unsafe.Pointer(bp + 32 /* &buf */)).Fp + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Arguments nArg/azArg contain the string arguments passed to the xCreate +// or xConnect method of the virtual table. This function attempts to +// allocate an instance of Fts5Config containing the results of parsing +// those arguments. +// +// If successful, SQLITE_OK is returned and *ppOut is set to point to the +// new Fts5Config object. If an error occurs, an SQLite error code is +// returned, *ppOut is set to NULL and an error message may be left in +// *pzErr. It is the responsibility of the caller to eventually free any +// such error message using sqlite3_free(). +func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int32, azArg uintptr, ppOut uintptr, pzErr uintptr) int32 { /* sqlite3.c:216990:12: */ + bp := tls.Alloc(76) + defer tls.Free(76) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK // Return code + var pRet uintptr // New object to return + var i int32 + var nByte Sqlite3_int64 + + *(*uintptr)(unsafe.Pointer(ppOut)) = libc.AssignUintptr(&pRet, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5Config{})))) + if pRet == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(Fts5Config{}))) + (*Fts5Config)(unsafe.Pointer(pRet)).Fdb = db + (*Fts5Config)(unsafe.Pointer(pRet)).FiCookie = -1 + + nByte = (Sqlite3_int64(uint64(nArg) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))))) + (*Fts5Config)(unsafe.Pointer(pRet)).FazCol = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, nByte) + (*Fts5Config)(unsafe.Pointer(pRet)).FabUnindexed = func() uintptr { + if (*Fts5Config)(unsafe.Pointer(pRet)).FazCol != 0 { + return ((*Fts5Config)(unsafe.Pointer(pRet)).FazCol + uintptr(nArg)*8) + } + return uintptr(0) + }() + (*Fts5Config)(unsafe.Pointer(pRet)).FzDb = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 1*8)), -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 + (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20498 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32556 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } + + for i = 3; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (i < nArg); i++ { + var zOrig uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)) + var z uintptr + *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) = uintptr(0) + var bOption int32 = 0 + *(*int32)(unsafe.Pointer(bp + 56 /* bMustBeCol */)) = 0 + + z = fts5ConfigGobbleWord(tls, bp+40 /* &rc */, zOrig, bp+48 /* &zOne */, bp+56 /* &bMustBeCol */) + z = fts5ConfigSkipWhitespace(tls, z) + if (z != 0) && (int32(*(*int8)(unsafe.Pointer(z))) == '=') { + bOption = 1 + z++ + if *(*int32)(unsafe.Pointer(bp + 56 /* bMustBeCol */)) != 0 { + z = uintptr(0) + } + } + z = fts5ConfigSkipWhitespace(tls, z) + if (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) { + // var bDummy int32 at bp+72, 4 + + z = fts5ConfigGobbleWord(tls, bp+40 /* &rc */, z, bp+64 /* &zTwo */, bp+72 /* &bDummy */) + if (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) { + z = uintptr(0) + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if z == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32585 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR + } else { + if bOption != 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseSpecial(tls, pGlobal, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) != 0 { + return *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) + } + return ts + 756 /* "" */ + }(), pzErr) + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)), pzErr) + *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)) = uintptr(0) + } + } + } + + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */))) + } + + // If a tokenizer= option was successfully parsed, the tokenizer has + // already been allocated. Otherwise, allocate an instance of the default + // tokenizer (unicode61) now. + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FpTok == uintptr(0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigDefaultTokenizer(tls, pGlobal, pRet) + } + + // If no zContent option was specified, fill in the default values. + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0)) { + var zTail uintptr = uintptr(0) + + if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { + zTail = ts + 32254 /* "content" */ + } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { + zTail = ts + 32605 /* "docsize" */ + } + + if zTail != 0 { + (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, + bp+40 /* &rc */, ts+32613 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + } + } + + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14758 /* "rowid" */, -1) + } + + // Formulate the zContentExprlist text + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigMakeExprlist(tls, pRet) + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + sqlite3Fts5ConfigFree(tls, pRet) + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Free the configuration object passed as the only argument. +func sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { /* sqlite3.c:217109:13: */ + if pConfig != 0 { + var i int32 + if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi + 8 /* &.xDelete */))))(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok) + } + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName) + for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8))) + } + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FazCol) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentExprlist) + Xsqlite3_free(tls, pConfig) + } +} + +// Call sqlite3_declare_vtab() based on the contents of the configuration +// object passed as the only argument. Return SQLITE_OK if successful, or +// an SQLite error code if an error occurs. +func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:217136:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var i int32 + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK + var zSql uintptr + + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32624 /* "CREATE TABLE x(" */, 0) + for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { + var zSep uintptr = func() uintptr { + if i == 0 { + return ts + 756 /* "" */ + } + return ts + 13325 /* ", " */ + }() + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32640 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + } + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32647, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20498 /* "rank" */)) + + if zSql != 0 { + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) + Xsqlite3_free(tls, zSql) + } + + return *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) +} + +// Tokenize the text passed via the second and third arguments. +// +// The callback is invoked once for each token in the input text. The +// arguments passed to it are, in order: +// +// void *pCtx // Copy of 4th argument to sqlite3Fts5Tokenize() +// const char *pToken // Pointer to buffer containing token +// int nToken // Size of token in bytes +// int iStart // Byte offset of start of token within input text +// int iEnd // Byte offset of end of token within input text +// int iPos // Position of token in input (first token is 0) +// +// If the callback returns a non-zero value the tokenization is abandoned +// and no further callbacks are issued. +// +// This function returns SQLITE_OK if successful or an SQLite error code +// if an error occurs. If the tokenization was abandoned early because +// the callback returned SQLITE_DONE, this is not an error and this function +// still returns SQLITE_OK. Or, if the tokenization was abandoned early +// because the callback returned another non-zero value, it is assumed +// to be an SQLite error code and returned to the caller. +func sqlite3Fts5Tokenize(tls *libc.TLS, pConfig uintptr, flags int32, pText uintptr, nText int32, pCtx uintptr, xToken uintptr) int32 { /* sqlite3.c:217182:12: */ + if pText == uintptr(0) { + return SQLITE_OK + } + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi + 16 /* &.xTokenize */))))(tls, + (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok, pCtx, flags, pText, nText, xToken) +} + +// Argument pIn points to the first character in what is expected to be +// a comma-separated list of SQL literals followed by a ')' character. +// If it actually is this, return a pointer to the ')'. Otherwise, return +// NULL to indicate a parse error. +func fts5ConfigSkipArgs(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:217201:19: */ + var p uintptr = pIn + + for 1 != 0 { + p = fts5ConfigSkipWhitespace(tls, p) + p = fts5ConfigSkipLiteral(tls, p) + p = fts5ConfigSkipWhitespace(tls, p) + if (p == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(p))) == ')') { + break + } + if int32(*(*int8)(unsafe.Pointer(p))) != ',' { + p = uintptr(0) + break + } + p++ + } + + return p +} + +// Parameter zIn contains a rank() function specification. The format of +// this is: +// +// + Bareword (function name) +// + Open parenthesis - "(" +// + Zero or more SQL literals in a comma separated list +// + Close parenthesis - ")" +func sqlite3Fts5ConfigParseRank(tls *libc.TLS, zIn uintptr, pzRank uintptr, pzRankArgs uintptr) int32 { /* sqlite3.c:217228:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = zIn + var pRank uintptr + var zRank uintptr = uintptr(0) + var zRankArgs uintptr = uintptr(0) + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + *(*uintptr)(unsafe.Pointer(pzRank)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pzRankArgs)) = uintptr(0) + + if p == uintptr(0) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR + } else { + p = fts5ConfigSkipWhitespace(tls, p) + pRank = p + p = fts5ConfigSkipBareword(tls, p) + + if p != 0 { + zRank = sqlite3Fts5MallocZero(tls, bp /* &rc */, (int64(((int64(uintptr(1) + p)) - int64(pRank)) / 1))) + if zRank != 0 { + libc.Xmemcpy(tls, zRank, pRank, (uint64((int64(p) - int64(pRank)) / 1))) + } + } else { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR + } + + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + p = fts5ConfigSkipWhitespace(tls, p) + if int32(*(*int8)(unsafe.Pointer(p))) != '(' { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR + } + p++ + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + var pArgs uintptr + p = fts5ConfigSkipWhitespace(tls, p) + pArgs = p + if int32(*(*int8)(unsafe.Pointer(p))) != ')' { + p = fts5ConfigSkipArgs(tls, p) + if p == uintptr(0) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR + } else { + zRankArgs = sqlite3Fts5MallocZero(tls, bp /* &rc */, (int64(((int64(uintptr(1) + p)) - int64(pArgs)) / 1))) + if zRankArgs != 0 { + libc.Xmemcpy(tls, zRankArgs, pArgs, (uint64((int64(p) - int64(pArgs)) / 1))) + } + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, zRank) + + } else { + *(*uintptr)(unsafe.Pointer(pzRank)) = zRank + *(*uintptr)(unsafe.Pointer(pzRankArgs)) = zRankArgs + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVal uintptr, pbBadkey uintptr) int32 { /* sqlite3.c:217287:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 = SQLITE_OK + + if 0 == Xsqlite3_stricmp(tls, zKey, ts+32673 /* "pgsz" */) { + var pgsz int32 = 0 + if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { + pgsz = Xsqlite3_value_int(tls, pVal) + } + if (pgsz < 32) || (pgsz > (64 * 1024)) { + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz + } + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32678 /* "hashsize" */) { + var nHashSize int32 = -1 + if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { + nHashSize = Xsqlite3_value_int(tls, pVal) + } + if nHashSize <= 0 { + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize + } + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32687 /* "automerge" */) { + var nAutomerge int32 = -1 + if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { + nAutomerge = Xsqlite3_value_int(tls, pVal) + } + if (nAutomerge < 0) || (nAutomerge > 64) { + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } else { + if nAutomerge == 1 { + nAutomerge = FTS5_DEFAULT_AUTOMERGE + } + (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge + } + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32697 /* "usermerge" */) { + var nUsermerge int32 = -1 + if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { + nUsermerge = Xsqlite3_value_int(tls, pVal) + } + if (nUsermerge < 2) || (nUsermerge > 16) { + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge + } + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32707 /* "crisismerge" */) { + var nCrisisMerge int32 = -1 + if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { + nCrisisMerge = Xsqlite3_value_int(tls, pVal) + } + if nCrisisMerge < 0 { + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } else { + if nCrisisMerge <= 1 { + nCrisisMerge = FTS5_DEFAULT_CRISISMERGE + } + if nCrisisMerge >= FTS5_MAX_SEGMENT { + nCrisisMerge = (FTS5_MAX_SEGMENT - 1) + } + (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge + } + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20498 /* "rank" */) { + var zIn uintptr = Xsqlite3_value_text(tls, pVal) + // var zRank uintptr at bp, 8 + + // var zRankArgs uintptr at bp+8, 8 + + rc = sqlite3Fts5ConfigParseRank(tls, zIn, bp /* &zRank */, bp+8 /* &zRankArgs */) + if rc == SQLITE_OK { + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank) + Xsqlite3_free(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank = *(*uintptr)(unsafe.Pointer(bp /* zRank */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs = *(*uintptr)(unsafe.Pointer(bp + 8 /* zRankArgs */)) + } else if rc == SQLITE_ERROR { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } + } else { + *(*int32)(unsafe.Pointer(pbBadkey)) = 1 + } + return rc +} + +// Load the contents of the %_config table into memory. +func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 { /* sqlite3.c:217381:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var zSelect uintptr = ts + 32719 /* "SELECT k, v FROM..." */ + var zSql uintptr + *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + var iVersion int32 = 0 + + // Set default values + (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = FTS5_DEFAULT_PAGE_SIZE + (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = FTS5_DEFAULT_AUTOMERGE + (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = FTS5_DEFAULT_USERMERGE + (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = FTS5_DEFAULT_CRISISMERGE + (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = (1024 * 1024) + + zSql = sqlite3Fts5Mprintf(tls, bp+32 /* &rc */, zSelect, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + if zSql != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, bp+40 /* &p */, uintptr(0)) + Xsqlite3_free(tls, zSql) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) { + var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 0) + var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 1) + if 0 == Xsqlite3_stricmp(tls, zK, ts+32751 /* "version" */) { + iVersion = Xsqlite3_value_int(tls, pVal) + } else { + *(*int32)(unsafe.Pointer(bp + 48 /* bDummy */)) = 0 + sqlite3Fts5ConfigSetValue(tls, pConfig, zK, pVal, bp+48 /* &bDummy */) + } + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) + } + + if (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (iVersion != FTS5_CURRENT_VERSION) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { + + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, + ts+32759, /* "invalid fts5 fil..." */ + libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + (*Fts5Config)(unsafe.Pointer(pConfig)).FiCookie = iCookie + } + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// #include "fts5Int.h" +// #include "fts5parse.h" + +// All token types in the generated fts5parse.h file are greater than 0. + +type Fts5ExprTerm1 = struct { + FbPrefix U8 + FbFirst U8 + _ [6]byte + FzTerm uintptr + FpIter uintptr + FpSynonym uintptr +} /* sqlite3.c:213118:9 */ + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// #include "fts5Int.h" +// #include "fts5parse.h" + +// All token types in the generated fts5parse.h file are greater than 0. + +type Fts5ExprTerm = Fts5ExprTerm1 /* sqlite3.c:217459:29 */ + +func sqlite3Fts5ParseError(tls *libc.TLS, pParse uintptr, zFmt uintptr, va uintptr) { /* sqlite3.c:217566:13: */ + var ap Va_list + _ = ap + ap = va + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_vmprintf(tls, zFmt, ap) + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + } + _ = ap +} + +func fts5ExprIsspace(tls *libc.TLS, t int8) int32 { /* sqlite3.c:217576:12: */ + return (libc.Bool32((((int32(t) == ' ') || (int32(t) == '\t')) || (int32(t) == '\n')) || (int32(t) == '\r'))) +} + +// Read the first token from the nul-terminated string at *pz. +func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) int32 { /* sqlite3.c:217583:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var z uintptr = *(*uintptr)(unsafe.Pointer(pz)) + var tok int32 + + // Skip past any whitespace + for fts5ExprIsspace(tls, *(*int8)(unsafe.Pointer(z))) != 0 { + z++ + } + + (*Fts5Token)(unsafe.Pointer(pToken)).Fp = z + (*Fts5Token)(unsafe.Pointer(pToken)).Fn = 1 + switch int32(*(*int8)(unsafe.Pointer(z))) { + case '(': + tok = FTS5_LP + break + case ')': + tok = FTS5_RP + break + case '{': + tok = FTS5_LCP + break + case '}': + tok = FTS5_RCP + break + case ':': + tok = FTS5_COLON + break + case ',': + tok = FTS5_COMMA + break + case '+': + tok = FTS5_PLUS + break + case '*': + tok = FTS5_STAR + break + case '-': + tok = FTS5_MINUS + break + case '^': + tok = FTS5_CARET + break + case 0: + tok = FTS5_EOF + break + + case '"': + { + var z2 uintptr + tok = FTS5_STRING + + for z2 = (z + 1); 1 != 0; z2++ { + if int32(*(*int8)(unsafe.Pointer(z2))) == '"' { + z2++ + if int32(*(*int8)(unsafe.Pointer(z2))) != '"' { + break + } + } + if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { + sqlite3Fts5ParseError(tls, pParse, ts+32824 /* "unterminated str..." */, 0) + return FTS5_EOF + } + } + (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) + break + + } + + default: + { + var z2 uintptr + if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { + sqlite3Fts5ParseError(tls, pParse, ts+32844 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + return FTS5_EOF + } + tok = FTS5_STRING + for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { + } + (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32875 /* "OR" */, uint64(2)) == 0) { + tok = FTS5_OR + } + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32878 /* "NOT" */, uint64(3)) == 0) { + tok = FTS5_NOT + } + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28286 /* "AND" */, uint64(3)) == 0) { + tok = FTS5_AND + } + break + + } + } + + *(*uintptr)(unsafe.Pointer(pz)) = ((*Fts5Token)(unsafe.Pointer(pToken)).Fp + uintptr((*Fts5Token)(unsafe.Pointer(pToken)).Fn)) + return tok +} + +func fts5ParseAlloc(tls *libc.TLS, t U64) uintptr { /* sqlite3.c:217647:13: */ + return Xsqlite3_malloc64(tls, uint64(Sqlite3_int64(t))) +} + +func fts5ParseFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:217648:13: */ + Xsqlite3_free(tls, p) +} + +func sqlite3Fts5ExprNew(tls *libc.TLS, pConfig uintptr, bPhraseToAnd int32, iCol int32, zExpr uintptr, ppNew uintptr, pzErr uintptr) int32 { /* sqlite3.c:217650:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sParse Fts5Parse at bp, 48 + + // var token Fts5Token at bp+56, 16 + + *(*uintptr)(unsafe.Pointer(bp + 48 /* z */)) = zExpr + var t int32 // Next token type + var pEngine uintptr + var pNew uintptr + + *(*uintptr)(unsafe.Pointer(ppNew)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pzErr)) = uintptr(0) + libc.Xmemset(tls, bp /* &sParse */, 0, uint64(unsafe.Sizeof(Fts5Parse{}))) + (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FbPhraseToAnd = bPhraseToAnd + pEngine = sqlite3Fts5ParserAlloc(tls, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, U64) uintptr }{fts5ParseAlloc}))) + if pEngine == uintptr(0) { + return SQLITE_NOMEM + } + (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpConfig = pConfig + + for ok := true; ok; ok = (((*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc == SQLITE_OK) && (t != FTS5_EOF)) { + t = fts5ExprGetToken(tls, bp /* &sParse */, bp+48 /* &z */, bp+56 /* &token */) + sqlite3Fts5Parser(tls, pEngine, t, *(*Fts5Token)(unsafe.Pointer(bp + 56 /* token */)), bp /* &sParse */) + } + sqlite3Fts5ParserFree(tls, pEngine, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ParseFree}))) + + // If the LHS of the MATCH expression was a user column, apply the + // implicit column-filter. + if ((iCol < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol) && ((*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpExpr != 0)) && ((*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc == SQLITE_OK) { + var n int32 = int32(unsafe.Sizeof(Fts5Colset{})) + var pColset uintptr = sqlite3Fts5MallocZero(tls, (bp /* &sParse */ + 16 /* &.rc */), int64(n)) + if pColset != 0 { + (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol = 1 + *(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */))) = iCol + sqlite3Fts5ParseSetColset(tls, bp /* &sParse */, (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpExpr, pColset) + } + } + + if (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(ppNew)) = libc.AssignUintptr(&pNew, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5Expr{})))) + if pNew == uintptr(0) { + (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc = SQLITE_NOMEM + sqlite3Fts5ParseNodeFree(tls, (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpExpr) + } else { + if !(int32((*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpExpr) != 0) { + var nByte int32 = int32(unsafe.Sizeof(Fts5ExprNode{})) + (*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot = sqlite3Fts5MallocZero(tls, (bp /* &sParse */ + 16 /* &.rc */), int64(nByte)) + if (*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot != 0 { + (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FbEof = 1 + } + } else { + (*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot = (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpExpr + } + (*Fts5Expr)(unsafe.Pointer(pNew)).FpIndex = uintptr(0) + (*Fts5Expr)(unsafe.Pointer(pNew)).FpConfig = pConfig + (*Fts5Expr)(unsafe.Pointer(pNew)).FapExprPhrase = (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FapPhrase + (*Fts5Expr)(unsafe.Pointer(pNew)).FnPhrase = (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FnPhrase + (*Fts5Expr)(unsafe.Pointer(pNew)).FbDesc = 0 + (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FapPhrase = uintptr(0) + } + } else { + sqlite3Fts5ParseNodeFree(tls, (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FpExpr) + } + + Xsqlite3_free(tls, (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FapPhrase) + *(*uintptr)(unsafe.Pointer(pzErr)) = (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).FzErr + return (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc +} + +// This function is only called when using the special 'trigram' tokenizer. +// Argument zText contains the text of a LIKE or GLOB pattern matched +// against column iCol. This function creates and compiles an FTS5 MATCH +// expression that will match a superset of the rows matched by the LIKE or +// GLOB. If successful, SQLITE_OK is returned. Otherwise, an SQLite error +// code. +func sqlite3Fts5ExprPattern(tls *libc.TLS, pConfig uintptr, bGlob int32, iCol int32, zText uintptr, pp uintptr) int32 { /* sqlite3.c:217731:12: */ + bp := tls.Alloc(3) + defer tls.Free(3) + + var nText I64 = I64(libc.Xstrlen(tls, zText)) + var zExpr uintptr = Xsqlite3_malloc64(tls, (uint64((nText * int64(4)) + int64(1)))) + var rc int32 = SQLITE_OK + + if zExpr == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var aSpec [3]int8 at bp, 3 + + var iOut int32 = 0 + var i int32 = 0 + var iFirst int32 = 0 + + if bGlob == 0 { + *(*int8)(unsafe.Pointer(bp /* &aSpec[0] */)) = int8('_') + *(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 1)) = int8('%') + *(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 2)) = int8(0) + } else { + *(*int8)(unsafe.Pointer(bp /* &aSpec[0] */)) = int8('*') + *(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 1)) = int8('?') + *(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 2)) = int8('[') + } + + for I64(i) <= nText { + if (((I64(i) == nText) || + (int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp /* &aSpec[0] */))))) || (int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 1))))) || (int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 2)))) { + if (i - iFirst) >= 3 { + var jj int32 + *(*int8)(unsafe.Pointer(zExpr + uintptr(libc.PostIncInt32(&iOut, 1)))) = int8('"') + for jj = iFirst; jj < i; jj++ { + *(*int8)(unsafe.Pointer(zExpr + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zText + uintptr(jj))) + if int32(*(*int8)(unsafe.Pointer(zText + uintptr(jj)))) == '"' { + *(*int8)(unsafe.Pointer(zExpr + uintptr(libc.PostIncInt32(&iOut, 1)))) = int8('"') + } + } + *(*int8)(unsafe.Pointer(zExpr + uintptr(libc.PostIncInt32(&iOut, 1)))) = int8('"') + *(*int8)(unsafe.Pointer(zExpr + uintptr(libc.PostIncInt32(&iOut, 1)))) = int8(' ') + } + if int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp /* &aSpec[0] */ + 2))) { + i = i + (2) + if int32(*(*int8)(unsafe.Pointer(zText + uintptr((i - 1))))) == '^' { + i++ + } + for (I64(i) < nText) && (int32(*(*int8)(unsafe.Pointer(zText + uintptr(i)))) != ']') { + i++ + } + } + iFirst = (i + 1) + } + i++ + } + if iOut > 0 { + var bAnd int32 = 0 + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail != FTS5_DETAIL_FULL { + bAnd = 1 + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_NONE { + iCol = (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol + } + } + *(*int8)(unsafe.Pointer(zExpr + uintptr(iOut))) = int8(0) + rc = sqlite3Fts5ExprNew(tls, pConfig, bAnd, iCol, zExpr, pp, (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg) + } else { + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + Xsqlite3_free(tls, zExpr) + } + + return rc +} + +// Free the expression node object passed as the only argument. +func sqlite3Fts5ParseNodeFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:217801:13: */ + if p != 0 { + var i int32 + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(p)).FnChild; i++ { + sqlite3Fts5ParseNodeFree(tls, *(*uintptr)(unsafe.Pointer((p + 48 /* &.apChild */) + uintptr(i)*8))) + } + sqlite3Fts5ParseNearsetFree(tls, (*Fts5ExprNode)(unsafe.Pointer(p)).FpNear) + Xsqlite3_free(tls, p) + } +} + +// Free the expression object passed as the only argument. +func sqlite3Fts5ExprFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:217815:13: */ + if p != 0 { + sqlite3Fts5ParseNodeFree(tls, (*Fts5Expr)(unsafe.Pointer(p)).FpRoot) + Xsqlite3_free(tls, (*Fts5Expr)(unsafe.Pointer(p)).FapExprPhrase) + Xsqlite3_free(tls, p) + } +} + +func sqlite3Fts5ExprAnd(tls *libc.TLS, pp1 uintptr, p2 uintptr) int32 { /* sqlite3.c:217823:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var sParse Fts5Parse at bp, 48 + + libc.Xmemset(tls, bp /* &sParse */, 0, uint64(unsafe.Sizeof(Fts5Parse{}))) + + if *(*uintptr)(unsafe.Pointer(pp1)) != 0 { + var p1 uintptr = *(*uintptr)(unsafe.Pointer(pp1)) + var nPhrase int32 = ((*Fts5Expr)(unsafe.Pointer(p1)).FnPhrase + (*Fts5Expr)(unsafe.Pointer(p2)).FnPhrase) + + (*Fts5Expr)(unsafe.Pointer(p1)).FpRoot = sqlite3Fts5ParseNode(tls, bp /* &sParse */, FTS5_AND, (*Fts5Expr)(unsafe.Pointer(p1)).FpRoot, (*Fts5Expr)(unsafe.Pointer(p2)).FpRoot, uintptr(0)) + (*Fts5Expr)(unsafe.Pointer(p2)).FpRoot = uintptr(0) + + if (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc == SQLITE_OK { + var ap uintptr = Xsqlite3_realloc(tls, + (*Fts5Expr)(unsafe.Pointer(p1)).FapExprPhrase, (int32(uint64(nPhrase) * uint64(unsafe.Sizeof(uintptr(0)))))) + if ap == uintptr(0) { + (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc = SQLITE_NOMEM + } else { + var i int32 + libc.Xmemmove(tls, (ap + uintptr((*Fts5Expr)(unsafe.Pointer(p2)).FnPhrase)*8), ap, (uint64((*Fts5Expr)(unsafe.Pointer(p1)).FnPhrase) * uint64(unsafe.Sizeof(uintptr(0))))) + for i = 0; i < (*Fts5Expr)(unsafe.Pointer(p2)).FnPhrase; i++ { + *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(p2)).FapExprPhrase + uintptr(i)*8)) + } + (*Fts5Expr)(unsafe.Pointer(p1)).FnPhrase = nPhrase + (*Fts5Expr)(unsafe.Pointer(p1)).FapExprPhrase = ap + } + } + Xsqlite3_free(tls, (*Fts5Expr)(unsafe.Pointer(p2)).FapExprPhrase) + Xsqlite3_free(tls, p2) + } else { + *(*uintptr)(unsafe.Pointer(pp1)) = p2 + } + + return (*Fts5Parse)(unsafe.Pointer(bp /* &sParse */)).Frc +} + +// Argument pTerm must be a synonym iterator. Return the current rowid +// that it points to. +func fts5ExprSynonymRowid(tls *libc.TLS, pTerm uintptr, bDesc int32, pbEof uintptr) I64 { /* sqlite3.c:217863:12: */ + var iRet I64 = int64(0) + var bRetValid int32 = 0 + var p uintptr + + for p = pTerm; p != 0; p = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpSynonym { + if 0 == (int32((*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof)) { + var iRowid I64 = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FiRowid + if (bRetValid == 0) || (bDesc != (libc.Bool32(iRowid < iRet))) { + iRet = iRowid + bRetValid = 1 + } + } + } + + if (pbEof != 0) && (bRetValid == 0) { + *(*int32)(unsafe.Pointer(pbEof)) = 1 + } + return iRet +} + +// Argument pTerm must be a synonym iterator. +func fts5ExprSynonymList(tls *libc.TLS, pTerm uintptr, iRowid I64, pBuf uintptr, pa uintptr, pn uintptr) int32 { /* sqlite3.c:217887:12: */ + bp := tls.Alloc(136) + defer tls.Free(136) + + // var aStatic [4]Fts5PoslistReader at bp, 128 + + var aIter uintptr + var nIter int32 + var nAlloc int32 + var rc int32 + var p uintptr + var nByte Sqlite3_int64 + var aNew uintptr + var pIter uintptr + var i int32 + var iMin I64 + // var writer Fts5PoslistWriter at bp+128, 8 + + var iPrev I64 + aIter = bp /* aStatic */ + nIter = 0 + nAlloc = 4 + rc = SQLITE_OK + + p = pTerm +__1: + if !(p != 0) { + goto __3 + } + pIter = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter + if !(((int32((*Fts5IndexIter)(unsafe.Pointer(pIter)).FbEof)) == 0) && ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FiRowid == iRowid)) { + goto __4 + } + if !((*Fts5IndexIter)(unsafe.Pointer(pIter)).FnData == 0) { + goto __5 + } + goto __2 +__5: + ; + if !(nIter == nAlloc) { + goto __6 + } + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(Fts5PoslistReader{})) * uint64(nAlloc)) * uint64(2))) + aNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(aNew == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto synonym_poslist_out +__7: + ; + libc.Xmemcpy(tls, aNew, aIter, (uint64(unsafe.Sizeof(Fts5PoslistReader{})) * uint64(nIter))) + nAlloc = (nAlloc * 2) + if !(aIter != bp /* aStatic */) { + goto __8 + } + Xsqlite3_free(tls, aIter) +__8: + ; + aIter = aNew +__6: + ; + sqlite3Fts5PoslistReaderInit(tls, (*Fts5IndexIter)(unsafe.Pointer(pIter)).FpData, (*Fts5IndexIter)(unsafe.Pointer(pIter)).FnData, (aIter + uintptr(nIter)*32)) + + nIter++ +__4: + ; + goto __2 +__2: + p = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpSynonym + goto __1 + goto __3 +__3: + ; + + if !(nIter == 1) { + goto __9 + } + *(*uintptr)(unsafe.Pointer(pa)) = (*Fts5PoslistReader)(unsafe.Pointer(aIter)).Fa + *(*int32)(unsafe.Pointer(pn)) = (*Fts5PoslistReader)(unsafe.Pointer(aIter)).Fn + goto __10 +__9: + *(*Fts5PoslistWriter)(unsafe.Pointer(bp + 128 /* writer */)) = Fts5PoslistWriter{} + iPrev = int64(-1) + sqlite3Fts5BufferZero(tls, pBuf) +__11: + if !(1 != 0) { + goto __12 + } + iMin = (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) + i = 0 +__13: + if !(i < nIter) { + goto __15 + } + if !(int32((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FbEof) == 0) { + goto __16 + } + if !((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FiPos == iPrev) { + goto __17 + } + if !(sqlite3Fts5PoslistReaderNext(tls, (aIter+uintptr(i)*32)) != 0) { + goto __18 + } + goto __14 +__18: + ; +__17: + ; + if !((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FiPos < iMin) { + goto __19 + } + iMin = (*Fts5PoslistReader)(unsafe.Pointer(aIter + uintptr(i)*32)).FiPos +__19: + ; +__16: + ; + goto __14 +__14: + i++ + goto __13 + goto __15 +__15: + ; + if !((iMin == (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) || (rc != SQLITE_OK)) { + goto __20 + } + goto __12 +__20: + ; + rc = sqlite3Fts5PoslistWriterAppend(tls, pBuf, bp+128 /* &writer */, iMin) + iPrev = iMin + goto __11 +__12: + ; + if !(rc == SQLITE_OK) { + goto __21 + } + *(*uintptr)(unsafe.Pointer(pa)) = (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + *(*int32)(unsafe.Pointer(pn)) = (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn +__21: + ; +__10: + ; + +synonym_poslist_out: + if !(aIter != bp /* aStatic */) { + goto __22 + } + Xsqlite3_free(tls, aIter) +__22: + ; + return rc +} + +// All individual term iterators in pPhrase are guaranteed to be valid and +// pointing to the same rowid when this function is called. This function +// checks if the current rowid really is a match, and if so populates +// the pPhrase->poslist buffer accordingly. Output parameter *pbMatch +// is set to true if this is really a match, or false otherwise. +// +// SQLITE_OK is returned if an error occurs, or an SQLite error code +// otherwise. It is not considered an error code if the current rowid is +// not a match. +func fts5ExprPhraseIsMatch(tls *libc.TLS, pNode uintptr, pPhrase uintptr, pbMatch uintptr) int32 { /* sqlite3.c:217970:12: */ + bp := tls.Alloc(168) + defer tls.Free(168) + + // var writer Fts5PoslistWriter at bp+160, 8 + + // var aStatic [4]Fts5PoslistReader at bp, 128 + + var aIter uintptr + var i int32 + var rc int32 + var bFirst int32 + var nByte Sqlite3_int64 + // var buf Fts5Buffer at bp+128, 16 + + var pTerm uintptr + // var n int32 at bp+152, 4 + + var bFlag int32 + // var a uintptr at bp+144, 8 + + var pPos uintptr + var iAdj I64 + var bMatch int32 + var iPos I64 + *(*Fts5PoslistWriter)(unsafe.Pointer(bp + 160 /* writer */)) = Fts5PoslistWriter{} + aIter = bp /* aStatic */ + rc = SQLITE_OK + bFirst = int32((*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FbFirst) + + sqlite3Fts5BufferZero(tls, (pPhrase + 8 /* &.poslist */)) + + // If the aStatic[] array is not large enough, allocate a large array + // using sqlite3_malloc(). This approach could be improved upon. + if !((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > (int32(uint64(unsafe.Sizeof([4]Fts5PoslistReader{})) / uint64(unsafe.Sizeof(Fts5PoslistReader{}))))) { + goto __1 + } + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5PoslistReader{})) * uint64((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm))) + aIter = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(!(aIter != 0)) { + goto __2 + } + return SQLITE_NOMEM +__2: + ; +__1: + ; + libc.Xmemset(tls, aIter, 0, (uint64(unsafe.Sizeof(Fts5PoslistReader{})) * uint64((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm))) + + // Initialize a term iterator for each term in the phrase + i = 0 +__3: + if !(i < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + goto __5 + } + pTerm = ((pPhrase + 32 /* &.aTerm */) + uintptr(i)*32) + *(*int32)(unsafe.Pointer(bp + 152 /* n */)) = 0 + bFlag = 0 + *(*uintptr)(unsafe.Pointer(bp + 144 /* a */)) = uintptr(0) + if !((*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0) { + goto __6 + } + *(*Fts5Buffer)(unsafe.Pointer(bp + 128 /* buf */)) = Fts5Buffer{} + rc = fts5ExprSynonymList(tls, pTerm, (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid, bp+128 /* &buf */, bp+144 /* &a */, bp+152 /* &n */) + if !(rc != 0) { + goto __8 + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 144 /* a */))) + goto ismatch_out +__8: + ; + if !(*(*uintptr)(unsafe.Pointer(bp + 144 /* a */)) == (*Fts5Buffer)(unsafe.Pointer(bp+128 /* &buf */)).Fp) { + goto __9 + } + bFlag = 1 +__9: + ; + goto __7 +__6: + *(*uintptr)(unsafe.Pointer(bp + 144 /* a */)) = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter)).FpData + *(*int32)(unsafe.Pointer(bp + 152 /* n */)) = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter)).FnData +__7: + ; + sqlite3Fts5PoslistReaderInit(tls, *(*uintptr)(unsafe.Pointer(bp + 144 /* a */)), *(*int32)(unsafe.Pointer(bp + 152 /* n */)), (aIter + uintptr(i)*32)) + (*Fts5PoslistReader)(unsafe.Pointer(aIter + uintptr(i)*32)).FbFlag = U8(bFlag) + if !((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FbEof != 0) { + goto __10 + } + goto ismatch_out +__10: + ; + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; + +__11: + if !(1 != 0) { + goto __12 + } + iPos = (*Fts5PoslistReader)(unsafe.Pointer(aIter)).FiPos +__13: + bMatch = 1 + i = 0 +__16: + if !(i < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + goto __18 + } + pPos = (aIter + uintptr(i)*32) + iAdj = (iPos + I64(i)) + if !((*Fts5PoslistReader)(unsafe.Pointer(pPos)).FiPos != iAdj) { + goto __19 + } + bMatch = 0 +__20: + if !((*Fts5PoslistReader)(unsafe.Pointer(pPos)).FiPos < iAdj) { + goto __21 + } + if !(sqlite3Fts5PoslistReaderNext(tls, pPos) != 0) { + goto __22 + } + goto ismatch_out +__22: + ; + goto __20 +__21: + ; + if !((*Fts5PoslistReader)(unsafe.Pointer(pPos)).FiPos > iAdj) { + goto __23 + } + iPos = ((*Fts5PoslistReader)(unsafe.Pointer(pPos)).FiPos - I64(i)) +__23: + ; +__19: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + goto __14 +__14: + if bMatch == 0 { + goto __13 + } + goto __15 +__15: + ; + + // Append position iPos to the output + if !((bFirst == 0) || ((int32(iPos & int64(0x7FFFFFFF))) == 0)) { + goto __24 + } + rc = sqlite3Fts5PoslistWriterAppend(tls, (pPhrase + 8 /* &.poslist */), bp+160 /* &writer */, iPos) + if !(rc != SQLITE_OK) { + goto __25 + } + goto ismatch_out +__25: + ; +__24: + ; + + i = 0 +__26: + if !(i < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + goto __28 + } + if !(sqlite3Fts5PoslistReaderNext(tls, (aIter+uintptr(i)*32)) != 0) { + goto __29 + } + goto ismatch_out +__29: + ; + goto __27 +__27: + i++ + goto __26 + goto __28 +__28: + ; + goto __11 +__12: + ; + +ismatch_out: + *(*int32)(unsafe.Pointer(pbMatch)) = (libc.Bool32((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn > 0)) + i = 0 +__30: + if !(i < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm) { + goto __32 + } + if !((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FbFlag != 0) { + goto __33 + } + Xsqlite3_free(tls, (*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).Fa) +__33: + ; + goto __31 +__31: + i++ + goto __30 + goto __32 +__32: + ; + if !(aIter != bp /* aStatic */) { + goto __34 + } + Xsqlite3_free(tls, aIter) +__34: + ; + return rc +} + +type Fts5LookaheadReader1 = struct { + Fa uintptr + Fn int32 + Fi int32 + FiPos I64 + FiLookahead I64 +} /* sqlite3.c:218054:9 */ + +type Fts5LookaheadReader = Fts5LookaheadReader1 /* sqlite3.c:218054:36 */ + +func fts5LookaheadReaderNext(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:218065:12: */ + (*Fts5LookaheadReader)(unsafe.Pointer(p)).FiPos = (*Fts5LookaheadReader)(unsafe.Pointer(p)).FiLookahead + if sqlite3Fts5PoslistNext64(tls, (*Fts5LookaheadReader)(unsafe.Pointer(p)).Fa, (*Fts5LookaheadReader)(unsafe.Pointer(p)).Fn, (p+12 /* &.i */), (p+24 /* &.iLookahead */)) != 0 { + (*Fts5LookaheadReader)(unsafe.Pointer(p)).FiLookahead = (I64((int64(1))) << 62) + } + return (libc.Bool32((*Fts5LookaheadReader)(unsafe.Pointer(p)).FiPos == (I64((int64(1))) << 62))) +} + +func fts5LookaheadReaderInit(tls *libc.TLS, a uintptr, n int32, p uintptr) int32 { /* sqlite3.c:218073:12: */ + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Fts5LookaheadReader{}))) + (*Fts5LookaheadReader)(unsafe.Pointer(p)).Fa = a + (*Fts5LookaheadReader)(unsafe.Pointer(p)).Fn = n + fts5LookaheadReaderNext(tls, p) + return fts5LookaheadReaderNext(tls, p) +} + +type Fts5NearTrimmer1 = struct { + Freader Fts5LookaheadReader + Fwriter Fts5PoslistWriter + FpOut uintptr +} /* sqlite3.c:218084:9 */ + +type Fts5NearTrimmer = Fts5NearTrimmer1 /* sqlite3.c:218084:32 */ + +// The near-set object passed as the first argument contains more than +// one phrase. All phrases currently point to the same row. The +// Fts5ExprPhrase.poslist buffers are populated accordingly. This function +// tests if the current row contains instances of each phrase sufficiently +// close together to meet the NEAR constraint. Non-zero is returned if it +// does, or zero otherwise. +// +// If in/out parameter (*pRc) is set to other than SQLITE_OK when this +// function is called, it is a no-op. Or, if an error (e.g. SQLITE_NOMEM) +// occurs within this function (*pRc) is set accordingly before returning. +// The return value is undefined in both these cases. +// +// If no error occurs and non-zero (a match) is returned, the position-list +// of each phrase object is edited to contain only those entries that +// meet the constraint before returning. +func fts5ExprNearIsMatch(tls *libc.TLS, pRc uintptr, pNear uintptr) int32 { /* sqlite3.c:218108:12: */ + bp := tls.Alloc(196) + defer tls.Free(196) + + // var aStatic [4]Fts5NearTrimmer at bp, 192 + + var a uintptr + var apPhrase uintptr + var i int32 + // var rc int32 at bp+192, 4 + + var bMatch int32 + var nByte Sqlite3_int64 + var pPoslist uintptr + var pPos uintptr + var iPos I64 + var pWriter uintptr + var iAdv int32 + var iMin I64 + var iMax I64 + var bRet int32 + a = bp /* aStatic */ + apPhrase = pNear + 24 /* &.apPhrase */ + *(*int32)(unsafe.Pointer(bp + 192 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + + // If the aStatic[] array is not large enough, allocate a large array + // using sqlite3_malloc(). This approach could be improved upon. + if !((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase > (int32(uint64(unsafe.Sizeof([4]Fts5NearTrimmer{})) / uint64(unsafe.Sizeof(Fts5NearTrimmer{}))))) { + goto __1 + } + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5NearTrimmer{})) * uint64((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase))) + a = sqlite3Fts5MallocZero(tls, bp+192 /* &rc */, nByte) + goto __2 +__1: + libc.Xmemset(tls, bp /* &aStatic[0] */, 0, uint64(unsafe.Sizeof([4]Fts5NearTrimmer{}))) +__2: + ; + if !(*(*int32)(unsafe.Pointer(bp + 192 /* rc */)) != SQLITE_OK) { + goto __3 + } + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192 /* rc */)) + return 0 +__3: + ; + + // Initialize a lookahead iterator for each phrase. After passing the + // buffer and buffer size to the lookaside-reader init function, zero + // the phrase poslist buffer. The new poslist for the phrase (containing + // the same entries as the original with some entries removed on account + // of the NEAR constraint) is written over the original even as it is + // being read. This is safe as the entries for the new poslist are a + // subset of the old, so it is not possible for data yet to be read to + // be overwritten. + i = 0 +__4: + if !(i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + goto __6 + } + pPoslist = (*(*uintptr)(unsafe.Pointer(apPhrase + uintptr(i)*8)) + 8 /* &.poslist */) + fts5LookaheadReaderInit(tls, (*Fts5Buffer)(unsafe.Pointer(pPoslist)).Fp, (*Fts5Buffer)(unsafe.Pointer(pPoslist)).Fn, (a + uintptr(i)*48 /* &.reader */)) + (*Fts5Buffer)(unsafe.Pointer(pPoslist)).Fn = 0 + (*Fts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48)).FpOut = pPoslist + goto __5 +__5: + i++ + goto __4 + goto __6 +__6: + ; + +__7: + if !(1 != 0) { + goto __8 + } + + // This block advances the phrase iterators until they point to a set of + // entries that together comprise a match. + iMax = (*Fts5NearTrimmer)(unsafe.Pointer(a)).Freader.FiPos +__9: + bMatch = 1 + i = 0 +__12: + if !(i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + goto __14 + } + pPos = (a + uintptr(i)*48 /* &.reader */) + iMin = ((iMax - I64((*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(i)*8)))).FnTerm)) - I64((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnNear)) + if !(((*Fts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos < iMin) || ((*Fts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos > iMax)) { + goto __15 + } + bMatch = 0 +__16: + if !((*Fts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos < iMin) { + goto __17 + } + if !(fts5LookaheadReaderNext(tls, pPos) != 0) { + goto __18 + } + goto ismatch_out +__18: + ; + goto __16 +__17: + ; + if !((*Fts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos > iMax) { + goto __19 + } + iMax = (*Fts5LookaheadReader)(unsafe.Pointer(pPos)).FiPos +__19: + ; +__15: + ; + goto __13 +__13: + i++ + goto __12 + goto __14 +__14: + ; + goto __10 +__10: + if bMatch == 0 { + goto __9 + } + goto __11 +__11: + ; + + // Add an entry to each output position list + i = 0 +__20: + if !(i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + goto __22 + } + iPos = (*Fts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48)).Freader.FiPos + pWriter = (a + uintptr(i)*48 + 32 /* &.writer */) + if !(((*Fts5Buffer)(unsafe.Pointer((*Fts5NearTrimmer)(unsafe.Pointer(a+uintptr(i)*48)).FpOut)).Fn == 0) || (iPos != (*Fts5PoslistWriter)(unsafe.Pointer(pWriter)).FiPrev)) { + goto __23 + } + sqlite3Fts5PoslistWriterAppend(tls, (*Fts5NearTrimmer)(unsafe.Pointer(a+uintptr(i)*48)).FpOut, pWriter, iPos) +__23: + ; + goto __21 +__21: + i++ + goto __20 + goto __22 +__22: + ; + + iAdv = 0 + iMin = (*Fts5NearTrimmer)(unsafe.Pointer(a)).Freader.FiLookahead + i = 0 +__24: + if !(i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) { + goto __26 + } + if !((*Fts5NearTrimmer)(unsafe.Pointer(a+uintptr(i)*48)).Freader.FiLookahead < iMin) { + goto __27 + } + iMin = (*Fts5NearTrimmer)(unsafe.Pointer(a + uintptr(i)*48)).Freader.FiLookahead + iAdv = i +__27: + ; + goto __25 +__25: + i++ + goto __24 + goto __26 +__26: + ; + if !(fts5LookaheadReaderNext(tls, (a+uintptr(iAdv)*48 /* &.reader */)) != 0) { + goto __28 + } + goto ismatch_out +__28: + ; + goto __7 +__8: + ; + +ismatch_out: + bRet = (libc.Bool32((*Fts5Buffer)(unsafe.Pointer((*Fts5NearTrimmer)(unsafe.Pointer(a)).FpOut)).Fn > 0)) + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 192 /* rc */)) + if !(a != bp /* aStatic */) { + goto __29 + } + Xsqlite3_free(tls, a) +__29: + ; + return bRet + + return int32(0) +} + +// Advance iterator pIter until it points to a value equal to or laster +// than the initial value of *piLast. If this means the iterator points +// to a value laster than *piLast, update *piLast to the new lastest value. +// +// If the iterator reaches EOF, set *pbEof to true before returning. If +// an error occurs, set *pRc to an error code. If either *pbEof or *pRc +// are set, return a non-zero value. Otherwise, return zero. +func fts5ExprAdvanceto(tls *libc.TLS, pIter uintptr, bDesc int32, piLast uintptr, pRc uintptr, pbEof uintptr) int32 { /* sqlite3.c:218207:12: */ + var iLast I64 = *(*I64)(unsafe.Pointer(piLast)) + var iRowid I64 + + iRowid = (*Fts5IndexIter)(unsafe.Pointer(pIter)).FiRowid + if ((bDesc == 0) && (iLast > iRowid)) || ((bDesc != 0) && (iLast < iRowid)) { + var rc int32 = sqlite3Fts5IterNextFrom(tls, pIter, iLast) + if (rc != 0) || ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0) { + *(*int32)(unsafe.Pointer(pRc)) = rc + *(*int32)(unsafe.Pointer(pbEof)) = 1 + return 1 + } + iRowid = (*Fts5IndexIter)(unsafe.Pointer(pIter)).FiRowid + + } + *(*I64)(unsafe.Pointer(piLast)) = iRowid + + return 0 +} + +func fts5ExprSynonymAdvanceto(tls *libc.TLS, pTerm uintptr, bDesc int32, piLast uintptr, pRc uintptr) int32 { /* sqlite3.c:218233:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var iLast I64 = *(*I64)(unsafe.Pointer(piLast)) + var p uintptr + *(*int32)(unsafe.Pointer(bp /* bEof */)) = 0 + + for p = pTerm; (rc == SQLITE_OK) && (p != 0); p = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpSynonym { + if (int32((*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof)) == 0 { + var iRowid I64 = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FiRowid + if ((bDesc == 0) && (iLast > iRowid)) || ((bDesc != 0) && (iLast < iRowid)) { + rc = sqlite3Fts5IterNextFrom(tls, (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter, iLast) + } + } + } + + if rc != SQLITE_OK { + *(*int32)(unsafe.Pointer(pRc)) = rc + *(*int32)(unsafe.Pointer(bp /* bEof */)) = 1 + } else { + *(*I64)(unsafe.Pointer(piLast)) = fts5ExprSynonymRowid(tls, pTerm, bDesc, bp /* &bEof */) + } + return *(*int32)(unsafe.Pointer(bp /* bEof */)) +} + +func fts5ExprNearTest(tls *libc.TLS, pRc uintptr, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218263:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pNear uintptr = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + + if (*Fts5Config)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { + var pTerm uintptr + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))) + (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 + for pTerm = (pPhrase + 32 /* &.aTerm */); pTerm != 0; pTerm = (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym { + var pIter uintptr = (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter + if (int32((*Fts5IndexIter)(unsafe.Pointer(pIter)).FbEof)) == 0 { + if ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FiRowid == (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid) && ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FnData > 0) { + (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 1 + } + } + } + return (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn + } else { + var i int32 + + // Check that each phrase in the nearset matches the current row. + // Populate the pPhrase->poslist buffers at the same time. If any + // phrase is not a match, break out of the loop early. + for i = 0; (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && (i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase); i++ { + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(i)*8)) + if ((((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 1) || ((*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FpSynonym != 0)) || + ((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset != 0)) || ((*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FbFirst != 0) { + *(*int32)(unsafe.Pointer(bp /* bMatch */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = fts5ExprPhraseIsMatch(tls, pNode, pPhrase, bp /* &bMatch */) + if *(*int32)(unsafe.Pointer(bp /* bMatch */)) == 0 { + break + } + } else { + var pIter uintptr = (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FpIter + sqlite3Fts5BufferSet(tls, bp+4 /* &rc */, (pPhrase + 8 /* &.poslist */), (*Fts5IndexIter)(unsafe.Pointer(pIter)).FnData, (*Fts5IndexIter)(unsafe.Pointer(pIter)).FpData) + } + } + + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) + if (i == (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase) && ((i == 1) || (fts5ExprNearIsMatch(tls, pRc, pNear) != 0)) { + return 1 + } + return 0 + } + return int32(0) +} + +// Initialize all term iterators in the pNear object. If any term is found +// to match no documents at all, return immediately without initializing any +// further iterators. +// +// If an error occurs, return an SQLite error code. Otherwise, return +// SQLITE_OK. It is not considered an error if some term matches zero +// documents. +func fts5ExprNearInitAll(tls *libc.TLS, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218322:12: */ + var pNear uintptr = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + var i int32 + + for i = 0; i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase; i++ { + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(i)*8)) + if (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm == 0 { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 1 + return SQLITE_OK + } else { + var j int32 + for j = 0; j < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm; j++ { + var pTerm uintptr = ((pPhrase + 32 /* &.aTerm */) + uintptr(j)*32) + var p uintptr + var bHit int32 = 0 + + for p = pTerm; p != 0; p = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpSynonym { + var rc int32 + if (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter != 0 { + sqlite3Fts5IterClose(tls, (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter) + (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter = uintptr(0) + } + rc = sqlite3Fts5IndexQuery(tls, + (*Fts5Expr)(unsafe.Pointer(pExpr)).FpIndex, (*Fts5ExprTerm)(unsafe.Pointer(p)).FzTerm, int32(libc.Xstrlen(tls, (*Fts5ExprTerm)(unsafe.Pointer(p)).FzTerm)), + ((func() int32 { + if (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FbPrefix != 0 { + return FTS5INDEX_QUERY_PREFIX + } + return 0 + }()) | (func() int32 { + if (*Fts5Expr)(unsafe.Pointer(pExpr)).FbDesc != 0 { + return FTS5INDEX_QUERY_DESC + } + return 0 + }())), + (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset, + (p + 16 /* &.pIter */)) + + if rc != SQLITE_OK { + return rc + } + if 0 == (int32((*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof)) { + bHit = 1 + } + } + + if bHit == 0 { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 1 + return SQLITE_OK + } + } + } + } + + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 + return SQLITE_OK +} + +// If pExpr is an ASC iterator, this function returns a value with the +// same sign as: +// +// (iLhs - iRhs) +// +// Otherwise, if this is a DESC iterator, the opposite is returned: +// +// (iRhs - iLhs) +func fts5RowidCmp(tls *libc.TLS, pExpr uintptr, iLhs I64, iRhs I64) int32 { /* sqlite3.c:218384:12: */ + + if (*Fts5Expr)(unsafe.Pointer(pExpr)).FbDesc == 0 { + if iLhs < iRhs { + return -1 + } + return (libc.Bool32(iLhs > iRhs)) + } else { + if iLhs > iRhs { + return -1 + } + return (libc.Bool32(iLhs < iRhs)) + } + return int32(0) +} + +func fts5ExprSetEof(tls *libc.TLS, pNode uintptr) { /* sqlite3.c:218399:13: */ + var i int32 + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 1 + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + fts5ExprSetEof(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8))) + } +} + +func fts5ExprNodeZeroPoslist(tls *libc.TLS, pNode uintptr) { /* sqlite3.c:218408:13: */ + if ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType == FTS5_STRING) || ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType == FTS5_TERM) { + var pNear uintptr = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + var i int32 + for i = 0; i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase; i++ { + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(i)*8)) + (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = 0 + } + } else { + var i int32 + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + fts5ExprNodeZeroPoslist(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8))) + } + } +} + +// Compare the values currently indicated by the two nodes as follows: +// +// res = (*p1) - (*p2) +// +// Nodes that point to values that come later in the iteration order are +// considered to be larger. Nodes at EOF are the largest of all. +// +// This means that if the iteration order is ASC, then numerically larger +// rowids are considered larger. Or if it is the default DESC, numerically +// smaller rowids are larger. +func fts5NodeCompare(tls *libc.TLS, pExpr uintptr, p1 uintptr, p2 uintptr) int32 { /* sqlite3.c:218438:12: */ + if (*Fts5ExprNode)(unsafe.Pointer(p2)).FbEof != 0 { + return -1 + } + if (*Fts5ExprNode)(unsafe.Pointer(p1)).FbEof != 0 { + return +1 + } + return fts5RowidCmp(tls, pExpr, (*Fts5ExprNode)(unsafe.Pointer(p1)).FiRowid, (*Fts5ExprNode)(unsafe.Pointer(p2)).FiRowid) +} + +// All individual term iterators in pNear are guaranteed to be valid when +// this function is called. This function checks if all term iterators +// point to the same rowid, and if not, advances them until they do. +// If an EOF is reached before this happens, *pbEof is set to true before +// returning. +// +// SQLITE_OK is returned if an error occurs, or an SQLite error code +// otherwise. It is not considered an error code if an iterator reaches +// EOF. +func fts5ExprNodeTest_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218459:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pNear uintptr = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + var pLeft uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + // var iLast I64 at bp, 8 + // Lastest rowid any iterator points to + var i int32 + var j int32 // Phrase and token index, respectively + var bMatch int32 // True if all terms are at the same rowid + var bDesc int32 = (*Fts5Expr)(unsafe.Pointer(pExpr)).FbDesc + + // Check that this node should not be FTS5_TERM + + // Initialize iLast, the "lastest" rowid any iterator points to. If the + // iterator skips through rowids in the default ascending order, this means + // the maximum rowid. Or, if the iterator is "ORDER BY rowid DESC", then it + // means the minimum rowid. + if (*Fts5ExprTerm)(unsafe.Pointer((pLeft + 32 /* &.aTerm */))).FpSynonym != 0 { + *(*I64)(unsafe.Pointer(bp /* iLast */)) = fts5ExprSynonymRowid(tls, (pLeft + 32 /* &.aTerm */), bDesc, uintptr(0)) + } else { + *(*I64)(unsafe.Pointer(bp /* iLast */)) = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer((pLeft + 32 /* &.aTerm */))).FpIter)).FiRowid + } + + for ok := true; ok; ok = (bMatch == 0) { + bMatch = 1 + for i = 0; i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase; i++ { + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(i)*8)) + for j = 0; j < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm; j++ { + var pTerm uintptr = ((pPhrase + 32 /* &.aTerm */) + uintptr(j)*32) + if (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + var iRowid I64 = fts5ExprSynonymRowid(tls, pTerm, bDesc, uintptr(0)) + if iRowid == *(*I64)(unsafe.Pointer(bp /* iLast */)) { + continue + } + bMatch = 0 + if fts5ExprSynonymAdvanceto(tls, pTerm, bDesc, bp /* &iLast */, bp+8 /* &rc */) != 0 { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 1 + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } else { + var pIter uintptr = (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */) + uintptr(j)*32)).FpIter + if ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FiRowid == *(*I64)(unsafe.Pointer(bp /* iLast */))) || ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0) { + continue + } + bMatch = 0 + if fts5ExprAdvanceto(tls, pIter, bDesc, bp /* &iLast */, bp+8 /* &rc */, (pNode+4 /* &.bEof */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } + } + } + } + + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = *(*I64)(unsafe.Pointer(bp /* iLast */)) + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = (libc.Bool32((0 == fts5ExprNearTest(tls, bp+8 /* &rc */, pExpr, pNode)) && (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK))) + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Advance the first term iterator in the first phrase of pNear. Set output +// variable *pbEof to true if it reaches EOF or if an error occurs. +// +// Return SQLITE_OK if successful, or an SQLite error code if an error +// occurs. +func fts5ExprNodeNext_STRING(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom I64) int32 { /* sqlite3.c:218529:12: */ + var pTerm uintptr = (*(*uintptr)(unsafe.Pointer(((*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24 /* &.apPhrase */))) + 32 /* &.aTerm */) + var rc int32 = SQLITE_OK + + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + if (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + var bEof int32 = 1 + var p uintptr + + // Find the firstest rowid any synonym points to. + var iRowid I64 = fts5ExprSynonymRowid(tls, pTerm, (*Fts5Expr)(unsafe.Pointer(pExpr)).FbDesc, uintptr(0)) + + // Advance each iterator that currently points to iRowid. Or, if iFrom + // is valid - each iterator that points to a rowid before iFrom. + for p = pTerm; p != 0; p = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpSynonym { + if (int32((*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof)) == 0 { + var ii I64 = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FiRowid + if (ii == iRowid) || + (((bFromValid != 0) && (ii != iFrom)) && ((libc.Bool32(ii > iFrom)) == (*Fts5Expr)(unsafe.Pointer(pExpr)).FbDesc)) { + if bFromValid != 0 { + rc = sqlite3Fts5IterNextFrom(tls, (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter, iFrom) + } else { + rc = sqlite3Fts5IterNext(tls, (*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter) + } + if rc != SQLITE_OK { + break + } + if (int32((*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer(p)).FpIter)).FbEof)) == 0 { + bEof = 0 + } + } else { + bEof = 0 + } + } + } + + // Set the EOF flag if either all synonym iterators are at EOF or an + // error has occurred. + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (libc.Bool32((rc != 0) || (bEof != 0))) + } else { + var pIter uintptr = (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter + + if bFromValid != 0 { + rc = sqlite3Fts5IterNextFrom(tls, pIter, iFrom) + } else { + rc = sqlite3Fts5IterNext(tls, pIter) + } + + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (libc.Bool32((rc != 0) || ((*Fts5IndexIter)(unsafe.Pointer(pIter)).FbEof != 0))) + } + + if (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 { + + rc = fts5ExprNodeTest_STRING(tls, pExpr, pNode) + } + + return rc +} + +func fts5ExprNodeTest_TERM(tls *libc.TLS, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218594:12: */ + // As this "NEAR" object is actually a single phrase that consists + // of a single term only, grab pointers into the poslist managed by the + // fts5_index.c iterator object. This is much faster than synthesizing + // a new poslist the way we have to for more complicated phrase or NEAR + // expressions. + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer(((*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24 /* &.apPhrase */))) + var pIter uintptr = (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FpIter + + (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn = (*Fts5IndexIter)(unsafe.Pointer(pIter)).FnData + if (*Fts5Config)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FpConfig)).FeDetail == FTS5_DETAIL_FULL { + (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fp = (*Fts5IndexIter)(unsafe.Pointer(pIter)).FpData + } + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*Fts5IndexIter)(unsafe.Pointer(pIter)).FiRowid + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = (libc.Bool32((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn == 0)) + return SQLITE_OK +} + +// xNext() method for a node of type FTS5_TERM. +func fts5ExprNodeNext_TERM(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom I64) int32 { /* sqlite3.c:218622:12: */ + var rc int32 + var pIter uintptr = (*Fts5ExprTerm)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(((*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24 /* &.apPhrase */))) + 32 /* &.aTerm */))).FpIter + + if bFromValid != 0 { + rc = sqlite3Fts5IterNextFrom(tls, pIter, iFrom) + } else { + rc = sqlite3Fts5IterNext(tls, pIter) + } + if (rc == SQLITE_OK) && ((int32((*Fts5IndexIter)(unsafe.Pointer(pIter)).FbEof)) == 0) { + rc = fts5ExprNodeTest_TERM(tls, pExpr, pNode) + } else { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 1 + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + } + return rc +} + +func fts5ExprNodeTest_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr) { /* sqlite3.c:218646:13: */ + var pNext uintptr = *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))) + var i int32 + + for i = 1; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + var pChild uintptr = *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8)) + var cmp int32 = fts5NodeCompare(tls, pExpr, pNext, pChild) + if (cmp > 0) || ((cmp == 0) && ((*Fts5ExprNode)(unsafe.Pointer(pChild)).FbNomatch == 0)) { + pNext = pChild + } + } + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*Fts5ExprNode)(unsafe.Pointer(pNext)).FiRowid + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*Fts5ExprNode)(unsafe.Pointer(pNext)).FbEof + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = (*Fts5ExprNode)(unsafe.Pointer(pNext)).FbNomatch +} + +func fts5ExprNodeNext_OR(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom I64) int32 { /* sqlite3.c:218665:12: */ + var i int32 + var iLast I64 = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid + + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + var p1 uintptr = *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8)) + + if (*Fts5ExprNode)(unsafe.Pointer(p1)).FbEof == 0 { + if ((*Fts5ExprNode)(unsafe.Pointer(p1)).FiRowid == iLast) || + ((bFromValid != 0) && (fts5RowidCmp(tls, pExpr, (*Fts5ExprNode)(unsafe.Pointer(p1)).FiRowid, iFrom) < 0)) { + var rc int32 = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((p1 + 16 /* &.xNext */))))(tls, pExpr, p1, bFromValid, iFrom) + if rc != SQLITE_OK { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + return rc + } + } + } + } + + fts5ExprNodeTest_OR(tls, pExpr, pNode) + return SQLITE_OK +} + +// Argument pNode is an FTS5_AND node. +func fts5ExprNodeTest_AND(tls *libc.TLS, pExpr uintptr, pAnd uintptr) int32 { /* sqlite3.c:218697:12: */ + var iChild int32 + var iLast I64 = (*Fts5ExprNode)(unsafe.Pointer(pAnd)).FiRowid + var rc int32 = SQLITE_OK + var bMatch int32 + + for ok := true; ok; ok = (bMatch == 0) { + (*Fts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = 0 + bMatch = 1 + for iChild = 0; iChild < (*Fts5ExprNode)(unsafe.Pointer(pAnd)).FnChild; iChild++ { + var pChild uintptr = *(*uintptr)(unsafe.Pointer((pAnd + 48 /* &.apChild */) + uintptr(iChild)*8)) + var cmp int32 = fts5RowidCmp(tls, pExpr, iLast, (*Fts5ExprNode)(unsafe.Pointer(pChild)).FiRowid) + if cmp > 0 { + // Advance pChild until it points to iLast or laster + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((pChild + 16 /* &.xNext */))))(tls, pExpr, pChild, 1, iLast) + if rc != SQLITE_OK { + (*Fts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = 0 + return rc + } + } + + // If the child node is now at EOF, so is the parent AND node. Otherwise, + // the child node is guaranteed to have advanced at least as far as + // rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the + // new lastest rowid seen so far. + + if (*Fts5ExprNode)(unsafe.Pointer(pChild)).FbEof != 0 { + fts5ExprSetEof(tls, pAnd) + bMatch = 1 + break + } else if iLast != (*Fts5ExprNode)(unsafe.Pointer(pChild)).FiRowid { + bMatch = 0 + iLast = (*Fts5ExprNode)(unsafe.Pointer(pChild)).FiRowid + } + + if (*Fts5ExprNode)(unsafe.Pointer(pChild)).FbNomatch != 0 { + (*Fts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch = 1 + } + } + } + + if ((*Fts5ExprNode)(unsafe.Pointer(pAnd)).FbNomatch != 0) && (pAnd != (*Fts5Expr)(unsafe.Pointer(pExpr)).FpRoot) { + fts5ExprNodeZeroPoslist(tls, pAnd) + } + (*Fts5ExprNode)(unsafe.Pointer(pAnd)).FiRowid = iLast + return SQLITE_OK +} + +func fts5ExprNodeNext_AND(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom I64) int32 { /* sqlite3.c:218749:12: */ + var rc int32 = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))) + 16 /* &.xNext */))))(tls, pExpr, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))), bFromValid, iFrom) + if rc == SQLITE_OK { + rc = fts5ExprNodeTest_AND(tls, pExpr, pNode) + } else { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + } + return rc +} + +func fts5ExprNodeTest_NOT(tls *libc.TLS, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218764:12: */ + var rc int32 = SQLITE_OK + var p1 uintptr = *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))) + var p2 uintptr = *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + 1*8)) + + for (rc == SQLITE_OK) && ((*Fts5ExprNode)(unsafe.Pointer(p1)).FbEof == 0) { + var cmp int32 = fts5NodeCompare(tls, pExpr, p1, p2) + if cmp > 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((p2 + 16 /* &.xNext */))))(tls, pExpr, p2, 1, (*Fts5ExprNode)(unsafe.Pointer(p1)).FiRowid) + cmp = fts5NodeCompare(tls, pExpr, p1, p2) + } + + if (cmp != 0) || ((*Fts5ExprNode)(unsafe.Pointer(p2)).FbNomatch != 0) { + break + } + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((p1 + 16 /* &.xNext */))))(tls, pExpr, p1, 0, int64(0)) + } + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*Fts5ExprNode)(unsafe.Pointer(p1)).FbEof + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = (*Fts5ExprNode)(unsafe.Pointer(p1)).FbNomatch + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*Fts5ExprNode)(unsafe.Pointer(p1)).FiRowid + if (*Fts5ExprNode)(unsafe.Pointer(p1)).FbEof != 0 { + fts5ExprNodeZeroPoslist(tls, p2) + } + return rc +} + +func fts5ExprNodeNext_NOT(tls *libc.TLS, pExpr uintptr, pNode uintptr, bFromValid int32, iFrom I64) int32 { /* sqlite3.c:218792:12: */ + var rc int32 = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))) + 16 /* &.xNext */))))(tls, pExpr, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))), bFromValid, iFrom) + if rc == SQLITE_OK { + rc = fts5ExprNodeTest_NOT(tls, pExpr, pNode) + } + if rc != SQLITE_OK { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + } + return rc +} + +// If pNode currently points to a match, this function returns SQLITE_OK +// without modifying it. Otherwise, pNode is advanced until it does point +// to a match or EOF is reached. +func fts5ExprNodeTest(tls *libc.TLS, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218813:12: */ + var rc int32 = SQLITE_OK + if (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0 { + switch (*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType { + + case FTS5_STRING: + { + rc = fts5ExprNodeTest_STRING(tls, pExpr, pNode) + break + + } + fallthrough + + case FTS5_TERM: + { + rc = fts5ExprNodeTest_TERM(tls, pExpr, pNode) + break + + } + fallthrough + + case FTS5_AND: + { + rc = fts5ExprNodeTest_AND(tls, pExpr, pNode) + break + + } + fallthrough + + case FTS5_OR: + { + fts5ExprNodeTest_OR(tls, pExpr, pNode) + break + + } + fallthrough + + default: + { + rc = fts5ExprNodeTest_NOT(tls, pExpr, pNode) + break + + } + } + } + return rc +} + +// Set node pNode, which is part of expression pExpr, to point to the first +// match. If there are no matches, set the Node.bEof flag to indicate EOF. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +// It is not an error if there are no matches. +func fts5ExprNodeFirst(tls *libc.TLS, pExpr uintptr, pNode uintptr) int32 { /* sqlite3.c:218858:12: */ + var rc int32 = SQLITE_OK + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbNomatch = 0 + + if ((*Fts5ExprNode)(unsafe.Pointer((pNode))).FeType == FTS5_TERM) || ((*Fts5ExprNode)(unsafe.Pointer((pNode))).FeType == FTS5_STRING) { + // Initialize all term iterators in the NEAR object. + rc = fts5ExprNearInitAll(tls, pExpr, pNode) + } else if (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext == uintptr(0) { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 1 + } else { + var i int32 + var nEof int32 = 0 + for i = 0; (i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild) && (rc == SQLITE_OK); i++ { + var pChild uintptr = *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8)) + rc = fts5ExprNodeFirst(tls, pExpr, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8))) + + nEof = nEof + ((*Fts5ExprNode)(unsafe.Pointer(pChild)).FbEof) + } + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = (*Fts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))))).FiRowid + + switch (*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType { + case FTS5_AND: + if nEof > 0 { + fts5ExprSetEof(tls, pNode) + } + break + fallthrough + + case FTS5_OR: + if (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild == nEof { + fts5ExprSetEof(tls, pNode) + } + break + fallthrough + + default: + + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = (*Fts5ExprNode)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))))).FbEof + break + } + } + + if rc == SQLITE_OK { + rc = fts5ExprNodeTest(tls, pExpr, pNode) + } + return rc +} + +// Begin iterating through the set of documents in index pIdx matched by +// the MATCH expression passed as the first argument. If the "bDesc" +// parameter is passed a non-zero value, iteration is in descending rowid +// order. Or, if it is zero, in ascending order. +// +// If iterating in ascending rowid order (bDesc==0), the first document +// visited is that with the smallest rowid that is larger than or equal +// to parameter iFirst. Or, if iterating in ascending order (bDesc==1), +// then the first document visited must have a rowid smaller than or +// equal to iFirst. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. It +// is not considered an error if the query does not match any documents. +func sqlite3Fts5ExprFirst(tls *libc.TLS, p uintptr, pIdx uintptr, iFirst I64, bDesc int32) int32 { /* sqlite3.c:218917:12: */ + var pRoot uintptr = (*Fts5Expr)(unsafe.Pointer(p)).FpRoot + var rc int32 // Return code + + (*Fts5Expr)(unsafe.Pointer(p)).FpIndex = pIdx + (*Fts5Expr)(unsafe.Pointer(p)).FbDesc = bDesc + rc = fts5ExprNodeFirst(tls, p, pRoot) + + // If not at EOF but the current rowid occurs earlier than iFirst in + // the iteration order, move to document iFirst or later. + if ((rc == SQLITE_OK) && + (0 == (*Fts5ExprNode)(unsafe.Pointer(pRoot)).FbEof)) && + (fts5RowidCmp(tls, p, (*Fts5ExprNode)(unsafe.Pointer(pRoot)).FiRowid, iFirst) < 0) { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((pRoot + 16 /* &.xNext */))))(tls, p, pRoot, 1, iFirst) + } + + // If the iterator is not at a real match, skip forward until it is. + for ((*Fts5ExprNode)(unsafe.Pointer(pRoot)).FbNomatch != 0) && (rc == SQLITE_OK) { + + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((pRoot + 16 /* &.xNext */))))(tls, p, pRoot, 0, int64(0)) + } + return rc +} + +// Move to the next document +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. It +// is not considered an error if the query does not match any documents. +func sqlite3Fts5ExprNext(tls *libc.TLS, p uintptr, iLast I64) int32 { /* sqlite3.c:218948:12: */ + var rc int32 + var pRoot uintptr = (*Fts5Expr)(unsafe.Pointer(p)).FpRoot + + for ok := true; ok; ok = (*Fts5ExprNode)(unsafe.Pointer(pRoot)).FbNomatch != 0 { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, I64) int32)(unsafe.Pointer((pRoot + 16 /* &.xNext */))))(tls, p, pRoot, 0, int64(0)) + + } + if fts5RowidCmp(tls, p, (*Fts5ExprNode)(unsafe.Pointer(pRoot)).FiRowid, iLast) > 0 { + (*Fts5ExprNode)(unsafe.Pointer(pRoot)).FbEof = 1 + } + return rc +} + +func sqlite3Fts5ExprEof(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:218962:12: */ + return (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(p)).FpRoot)).FbEof +} + +func sqlite3Fts5ExprRowid(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:218966:12: */ + return (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(p)).FpRoot)).FiRowid +} + +func fts5ParseStringFromToken(tls *libc.TLS, pToken uintptr, pz uintptr) int32 { /* sqlite3.c:218970:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(pz)) = sqlite3Fts5Strndup(tls, bp /* &rc */, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, (*Fts5Token)(unsafe.Pointer(pToken)).Fn) + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Free the phrase object passed as the only argument. +func fts5ExprPhraseFree(tls *libc.TLS, pPhrase uintptr) { /* sqlite3.c:218979:13: */ + if pPhrase != 0 { + var i int32 + for i = 0; i < (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm; i++ { + var pSyn uintptr + var pNext uintptr + var pTerm uintptr = ((pPhrase + 32 /* &.aTerm */) + uintptr(i)*32) + Xsqlite3_free(tls, (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FzTerm) + sqlite3Fts5IterClose(tls, (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpIter) + for pSyn = (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym; pSyn != 0; pSyn = pNext { + pNext = (*Fts5ExprTerm)(unsafe.Pointer(pSyn)).FpSynonym + sqlite3Fts5IterClose(tls, (*Fts5ExprTerm)(unsafe.Pointer(pSyn)).FpIter) + sqlite3Fts5BufferFree(tls, (pSyn + 1*32)) + Xsqlite3_free(tls, pSyn) + } + } + if (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.FnSpace > 0 { + sqlite3Fts5BufferFree(tls, (pPhrase + 8 /* &.poslist */)) + } + Xsqlite3_free(tls, pPhrase) + } +} + +// Set the "bFirst" flag on the first token of the phrase passed as the +// only argument. +func sqlite3Fts5ParseSetCaret(tls *libc.TLS, pPhrase uintptr) { /* sqlite3.c:219004:13: */ + if (pPhrase != 0) && ((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm != 0) { + (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FbFirst = U8(1) + } +} + +// If argument pNear is NULL, then a new Fts5ExprNearset object is allocated +// and populated with pPhrase. Or, if pNear is not NULL, phrase pPhrase is +// appended to it and the results returned. +// +// If an OOM error occurs, both the pNear and pPhrase objects are freed and +// NULL returned. +func sqlite3Fts5ParseNearset(tls *libc.TLS, pParse uintptr, pNear uintptr, pPhrase uintptr) uintptr { /* sqlite3.c:219018:24: */ + var SZALLOC int32 = 8 + var pRet uintptr = uintptr(0) + + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + if pPhrase == uintptr(0) { + return pNear + } + if pNear == uintptr(0) { + var nByte Sqlite3_int64 + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5ExprNearset{})) + (uint64(SZALLOC) * uint64(unsafe.Sizeof(uintptr(0)))))) + pRet = Xsqlite3_malloc64(tls, uint64(nByte)) + if pRet == uintptr(0) { + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pRet, 0, Size_t(nByte)) + } + } else if ((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase % SZALLOC) == 0 { + var nNew int32 = ((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase + SZALLOC) + var nByte Sqlite3_int64 + + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5ExprNearset{})) + (uint64(nNew) * uint64(unsafe.Sizeof(uintptr(0)))))) + pRet = Xsqlite3_realloc64(tls, pNear, uint64(nByte)) + if pRet == uintptr(0) { + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + } + } else { + pRet = pNear + } + } + + if pRet == uintptr(0) { + + sqlite3Fts5ParseNearsetFree(tls, pNear) + sqlite3Fts5ParsePhraseFree(tls, pPhrase) + } else { + if (*Fts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase > 0 { + var pLast uintptr = *(*uintptr)(unsafe.Pointer((pRet + 24 /* &.apPhrase */) + uintptr(((*Fts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-1))*8)) + + if (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm == 0 { + fts5ExprPhraseFree(tls, pPhrase) + (*Fts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-- + (*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + pPhrase = pLast + } else if (*Fts5ExprPhrase)(unsafe.Pointer(pLast)).FnTerm == 0 { + fts5ExprPhraseFree(tls, pLast) + *(*uintptr)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr(((*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-2))*8)) = pPhrase + (*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + (*Fts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase-- + } + } + *(*uintptr)(unsafe.Pointer((pRet + 24 /* &.apPhrase */) + uintptr(libc.PostIncInt32(&(*Fts5ExprNearset)(unsafe.Pointer(pRet)).FnPhrase, 1))*8)) = pPhrase + } + return pRet +} + +type TokenCtx1 = struct { + FpPhrase uintptr + Frc int32 + _ [4]byte +} /* sqlite3.c:219078:9 */ + +type TokenCtx = TokenCtx1 /* sqlite3.c:219078:25 */ + +// Callback for tokenizing terms used by ParseTerm(). +func fts5ParseTokenize(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iUnused1 int32, iUnused2 int32) int32 { /* sqlite3.c:219087:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var SZALLOC int32 = 8 + var pCtx uintptr = pContext + var pPhrase uintptr = (*TokenCtx)(unsafe.Pointer(pCtx)).FpPhrase + + _ = iUnused1 + _ = iUnused2 + + // If an error has already occurred, this is a no-op + if (*TokenCtx)(unsafe.Pointer(pCtx)).Frc != SQLITE_OK { + return (*TokenCtx)(unsafe.Pointer(pCtx)).Frc + } + if nToken > FTS5_MAX_TOKEN_SIZE { + nToken = FTS5_MAX_TOKEN_SIZE + } + + if ((pPhrase != 0) && ((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0)) && ((tflags & FTS5_TOKEN_COLOCATED) != 0) { + var pSyn uintptr + var nByte Sqlite3_int64 = (Sqlite3_int64(((uint64(unsafe.Sizeof(Fts5ExprTerm{})) + uint64(unsafe.Sizeof(Fts5Buffer{}))) + uint64(nToken)) + uint64(1))) + pSyn = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSyn == uintptr(0) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pSyn, 0, Size_t(nByte)) + (*Fts5ExprTerm)(unsafe.Pointer(pSyn)).FzTerm = (((pSyn) + uintptr(uint64(unsafe.Sizeof(Fts5ExprTerm{})))) + uintptr(uint64(unsafe.Sizeof(Fts5Buffer{})))) + libc.Xmemcpy(tls, (*Fts5ExprTerm)(unsafe.Pointer(pSyn)).FzTerm, pToken, uint64(nToken)) + (*Fts5ExprTerm)(unsafe.Pointer(pSyn)).FpSynonym = (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */) + uintptr(((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm-1))*32)).FpSynonym + (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */) + uintptr(((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm-1))*32)).FpSynonym = pSyn + } + } else { + var pTerm uintptr + if (pPhrase == uintptr(0)) || (((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm % SZALLOC) == 0) { + var pNew uintptr + var nNew int32 = (SZALLOC + (func() int32 { + if pPhrase != 0 { + return (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm + } + return 0 + }())) + + pNew = Xsqlite3_realloc64(tls, pPhrase, + (uint64(uint64(unsafe.Sizeof(Fts5ExprPhrase{})) + (uint64(unsafe.Sizeof(Fts5ExprTerm{})) * uint64(nNew))))) + if pNew == uintptr(0) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM + } else { + if pPhrase == uintptr(0) { + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Fts5ExprPhrase{}))) + } + (*TokenCtx)(unsafe.Pointer(pCtx)).FpPhrase = libc.AssignUintptr(&pPhrase, pNew) + (*Fts5ExprPhrase)(unsafe.Pointer(pNew)).FnTerm = (nNew - SZALLOC) + } + } + + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + pTerm = ((pPhrase + 32 /* &.aTerm */) + uintptr(libc.PostIncInt32(&(*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm, 1))*32) + libc.Xmemset(tls, pTerm, 0, uint64(unsafe.Sizeof(Fts5ExprTerm{}))) + (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FzTerm = sqlite3Fts5Strndup(tls, bp /* &rc */, pToken, nToken) + } + } + + (*TokenCtx)(unsafe.Pointer(pCtx)).Frc = *(*int32)(unsafe.Pointer(bp /* rc */)) + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Free the phrase object passed as the only argument. +func sqlite3Fts5ParsePhraseFree(tls *libc.TLS, pPhrase uintptr) { /* sqlite3.c:219152:13: */ + fts5ExprPhraseFree(tls, pPhrase) +} + +// Free the phrase object passed as the second argument. +func sqlite3Fts5ParseNearsetFree(tls *libc.TLS, pNear uintptr) { /* sqlite3.c:219159:13: */ + if pNear != 0 { + var i int32 + for i = 0; i < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase; i++ { + fts5ExprPhraseFree(tls, *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(i)*8))) + } + Xsqlite3_free(tls, (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset) + Xsqlite3_free(tls, pNear) + } +} + +func sqlite3Fts5ParseFinished(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:219170:13: */ + + (*Fts5Parse)(unsafe.Pointer(pParse)).FpExpr = p +} + +func parseGrowPhraseArray(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:219175:12: */ + if ((*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase % 8) == 0 { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64((*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase + 8)))) + var apNew uintptr + apNew = Xsqlite3_realloc64(tls, (*Fts5Parse)(unsafe.Pointer(pParse)).FapPhrase, uint64(nByte)) + if apNew == uintptr(0) { + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + return SQLITE_NOMEM + } + (*Fts5Parse)(unsafe.Pointer(pParse)).FapPhrase = apNew + } + return SQLITE_OK +} + +// This function is called by the parser to process a string token. The +// string may or may not be quoted. In any case it is tokenized and a +// phrase object consisting of all tokens returned. +func sqlite3Fts5ParseTerm(tls *libc.TLS, pParse uintptr, pAppend uintptr, pToken uintptr, bPrefix int32) uintptr { /* sqlite3.c:219194:23: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pConfig uintptr = (*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig + // var sCtx TokenCtx at bp, 16 + // Context object passed to callback + var rc int32 // Tokenize return code + *(*uintptr)(unsafe.Pointer(bp + 16 /* z */)) = uintptr(0) + + libc.Xmemset(tls, bp /* &sCtx */, 0, uint64(unsafe.Sizeof(TokenCtx{}))) + (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase = pAppend + + rc = fts5ParseStringFromToken(tls, pToken, bp+16 /* &z */) + if rc == SQLITE_OK { + var flags int32 = (FTS5_TOKENIZE_QUERY | (func() int32 { + if bPrefix != 0 { + return FTS5_TOKENIZE_PREFIX + } + return 0 + }())) + var n int32 + sqlite3Fts5Dequote(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* z */))) + n = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* z */)))) + rc = sqlite3Fts5Tokenize(tls, pConfig, flags, *(*uintptr)(unsafe.Pointer(bp + 16 /* z */)), n, bp /* &sCtx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5ParseTokenize}))) + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* z */))) + if (rc != 0) || (libc.AssignInt32(&rc, (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).Frc) != 0) { + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = rc + fts5ExprPhraseFree(tls, (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase) + (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase = uintptr(0) + } else { + + if pAppend == uintptr(0) { + if parseGrowPhraseArray(tls, pParse) != 0 { + fts5ExprPhraseFree(tls, (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase) + return uintptr(0) + } + (*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase++ + } + + if (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase == uintptr(0) { + // This happens when parsing a token or quoted phrase that contains + // no token characters at all. (e.g ... MATCH '""'). + (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase = sqlite3Fts5MallocZero(tls, (pParse + 16 /* &.rc */), int64(unsafe.Sizeof(Fts5ExprPhrase{}))) + } else if (*Fts5ExprPhrase)(unsafe.Pointer((*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase)).FnTerm != 0 { + (*Fts5ExprTerm)(unsafe.Pointer(((*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase + 32 /* &.aTerm */) + uintptr(((*Fts5ExprPhrase)(unsafe.Pointer((*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase)).FnTerm-1))*32)).FbPrefix = U8(bPrefix) + } + *(*uintptr)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr(((*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-1))*8)) = (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase + } + + return (*TokenCtx)(unsafe.Pointer(bp /* &sCtx */)).FpPhrase +} + +// Create a new FTS5 expression by cloning phrase iPhrase of the +// expression passed as the second argument. +func sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, ppNew uintptr) int32 { /* sqlite3.c:219248:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Return code + var pOrig uintptr // The phrase extracted from pExpr + var pNew uintptr = uintptr(0) // Expression to return via *ppNew + *(*TokenCtx)(unsafe.Pointer(bp + 8 /* sCtx */)) = TokenCtx{} // Context object for fts5ParseTokenize + + pOrig = *(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + pNew = sqlite3Fts5MallocZero(tls, bp /* &rc */, int64(unsafe.Sizeof(Fts5Expr{}))) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + (*Fts5Expr)(unsafe.Pointer(pNew)).FapExprPhrase = sqlite3Fts5MallocZero(tls, bp, /* &rc */ + int64(unsafe.Sizeof(uintptr(0)))) + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + (*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot = sqlite3Fts5MallocZero(tls, bp, /* &rc */ + int64(unsafe.Sizeof(Fts5ExprNode{}))) + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear = sqlite3Fts5MallocZero(tls, bp, /* &rc */ + (int64(uint64(unsafe.Sizeof(Fts5ExprNearset{})) + uint64(unsafe.Sizeof(uintptr(0)))))) + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + var pColsetOrig uintptr = (*Fts5ExprNearset)(unsafe.Pointer((*Fts5ExprNode)(unsafe.Pointer((*Fts5ExprPhrase)(unsafe.Pointer(pOrig)).FpNode)).FpNear)).FpColset + if pColsetOrig != 0 { + var nByte Sqlite3_int64 + var pColset uintptr + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Colset{})) + ((uint64((*Fts5Colset)(unsafe.Pointer(pColsetOrig)).FnCol - 1)) * uint64(unsafe.Sizeof(int32(0)))))) + pColset = sqlite3Fts5MallocZero(tls, bp /* &rc */, nByte) + if pColset != 0 { + libc.Xmemcpy(tls, pColset, pColsetOrig, Size_t(nByte)) + } + (*Fts5ExprNearset)(unsafe.Pointer((*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear)).FpColset = pColset + } + } + + if (*Fts5ExprPhrase)(unsafe.Pointer(pOrig)).FnTerm != 0 { + var i int32 // Used to iterate through phrase terms + for i = 0; (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (i < (*Fts5ExprPhrase)(unsafe.Pointer(pOrig)).FnTerm); i++ { + var tflags int32 = 0 + var p uintptr + for p = ((pOrig + 32 /* &.aTerm */) + uintptr(i)*32); (p != 0) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK); p = (*Fts5ExprTerm)(unsafe.Pointer(p)).FpSynonym { + var zTerm uintptr = (*Fts5ExprTerm)(unsafe.Pointer(p)).FzTerm + *(*int32)(unsafe.Pointer(bp /* rc */)) = fts5ParseTokenize(tls, bp+8 /* &sCtx */, tflags, zTerm, int32(libc.Xstrlen(tls, zTerm)), + 0, 0) + tflags = FTS5_TOKEN_COLOCATED + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + (*Fts5ExprTerm)(unsafe.Pointer(((*TokenCtx)(unsafe.Pointer(bp+8 /* &sCtx */)).FpPhrase + 32 /* &.aTerm */) + uintptr(i)*32)).FbPrefix = (*Fts5ExprTerm)(unsafe.Pointer((pOrig + 32 /* &.aTerm */) + uintptr(i)*32)).FbPrefix + (*Fts5ExprTerm)(unsafe.Pointer(((*TokenCtx)(unsafe.Pointer(bp+8 /* &sCtx */)).FpPhrase + 32 /* &.aTerm */) + uintptr(i)*32)).FbFirst = (*Fts5ExprTerm)(unsafe.Pointer((pOrig + 32 /* &.aTerm */) + uintptr(i)*32)).FbFirst + } + } + } else { + // This happens when parsing a token or quoted phrase that contains + // no token characters at all. (e.g ... MATCH '""'). + (*TokenCtx)(unsafe.Pointer(bp + 8 /* &sCtx */)).FpPhrase = sqlite3Fts5MallocZero(tls, bp /* &rc */, int64(unsafe.Sizeof(Fts5ExprPhrase{}))) + } + + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + // All the allocations succeeded. Put the expression object together. + (*Fts5Expr)(unsafe.Pointer(pNew)).FpIndex = (*Fts5Expr)(unsafe.Pointer(pExpr)).FpIndex + (*Fts5Expr)(unsafe.Pointer(pNew)).FpConfig = (*Fts5Expr)(unsafe.Pointer(pExpr)).FpConfig + (*Fts5Expr)(unsafe.Pointer(pNew)).FnPhrase = 1 + *(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FapExprPhrase)) = (*TokenCtx)(unsafe.Pointer(bp + 8 /* &sCtx */)).FpPhrase + *(*uintptr)(unsafe.Pointer(((*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear + 24 /* &.apPhrase */))) = (*TokenCtx)(unsafe.Pointer(bp + 8 /* &sCtx */)).FpPhrase + (*Fts5ExprNearset)(unsafe.Pointer((*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FpNear)).FnPhrase = 1 + (*Fts5ExprPhrase)(unsafe.Pointer((*TokenCtx)(unsafe.Pointer(bp + 8 /* &sCtx */)).FpPhrase)).FpNode = (*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot + + if (((*Fts5ExprPhrase)(unsafe.Pointer(pOrig)).FnTerm == 1) && + ((*Fts5ExprTerm)(unsafe.Pointer((pOrig + 32 /* &.aTerm */))).FpSynonym == uintptr(0))) && + (int32((*Fts5ExprTerm)(unsafe.Pointer((pOrig + 32 /* &.aTerm */))).FbFirst) == 0) { + (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FeType = FTS5_TERM + (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_TERM})) + } else { + (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FeType = FTS5_STRING + (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pNew)).FpRoot)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_STRING})) + } + } else { + sqlite3Fts5ExprFree(tls, pNew) + fts5ExprPhraseFree(tls, (*TokenCtx)(unsafe.Pointer(bp+8 /* &sCtx */)).FpPhrase) + pNew = uintptr(0) + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Token pTok has appeared in a MATCH expression where the NEAR operator +// is expected. If token pTok does not contain "NEAR", store an error +// in the pParse object. +func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqlite3.c:219344:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+32882 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { + sqlite3Fts5ParseError(tls, + pParse, ts+31911 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + } +} + +func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p uintptr) { /* sqlite3.c:219352:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if pNear != 0 { + var nNear int32 = 0 + var i int32 + if (*Fts5Token)(unsafe.Pointer(p)).Fn != 0 { + for i = 0; i < (*Fts5Token)(unsafe.Pointer(p)).Fn; i++ { + var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) + if (int32(c) < '0') || (int32(c) > '9') { + sqlite3Fts5ParseError(tls, + pParse, ts+32887 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + return + } + nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) + } + } else { + nNear = FTS5_DEFAULT_NEARDIST + } + (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnNear = nNear + } +} + +// The second argument passed to this function may be NULL, or it may be +// an existing Fts5Colset object. This function returns a pointer to +// a new colset object containing the contents of (p) with new value column +// number iCol appended. +// +// If an OOM error occurs, store an error code in pParse and return NULL. +// The old colset object (if any) is not freed in this case. +func fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) uintptr { /* sqlite3.c:219387:19: */ + var nCol int32 + if p != 0 { + nCol = (*Fts5Colset)(unsafe.Pointer(p)).FnCol + } else { + nCol = 0 + } // Num. columns already in colset object + var pNew uintptr // New colset object to return + + pNew = Xsqlite3_realloc64(tls, p, (uint64(uint64(unsafe.Sizeof(Fts5Colset{})) + (uint64(unsafe.Sizeof(int32(0))) * uint64(nCol))))) + if pNew == uintptr(0) { + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM + } else { + var aiCol uintptr = pNew + 4 /* &.aiCol */ + var i int32 + var j int32 + for i = 0; i < nCol; i++ { + if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) == iCol { + return pNew + } + if *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) > iCol { + break + } + } + for j = nCol; j > i; j-- { + *(*int32)(unsafe.Pointer(aiCol + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(aiCol + uintptr((j-1))*4)) + } + *(*int32)(unsafe.Pointer(aiCol + uintptr(i)*4)) = iCol + (*Fts5Colset)(unsafe.Pointer(pNew)).FnCol = (nCol + 1) + + } + + return pNew +} + +// Allocate and return an Fts5Colset object specifying the inverse of +// the colset passed as the second argument. Free the colset passed +// as the second argument before returning. +func sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) uintptr { /* sqlite3.c:219428:19: */ + var pRet uintptr + var nCol int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FnCol + + pRet = sqlite3Fts5MallocZero(tls, (pParse + 16 /* &.rc */), + (int64(uint64(unsafe.Sizeof(Fts5Colset{})) + (uint64(unsafe.Sizeof(int32(0))) * uint64(nCol))))) + if pRet != 0 { + var i int32 + var iOld int32 = 0 + for i = 0; i < nCol; i++ { + if (iOld >= (*Fts5Colset)(unsafe.Pointer(p)).FnCol) || (*(*int32)(unsafe.Pointer((p + 4 /* &.aiCol */) + uintptr(iOld)*4)) != i) { + *(*int32)(unsafe.Pointer((pRet + 4 /* &.aiCol */) + uintptr(libc.PostIncInt32(&(*Fts5Colset)(unsafe.Pointer(pRet)).FnCol, 1))*4)) = i + } else { + iOld++ + } + } + } + + Xsqlite3_free(tls, p) + return pRet +} + +func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p uintptr) uintptr { /* sqlite3.c:219451:19: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pRet uintptr = uintptr(0) + var iCol int32 + var z uintptr // Dequoted copy of token p + + z = sqlite3Fts5Strndup(tls, (pParse + 16 /* &.rc */), (*Fts5Token)(unsafe.Pointer(p)).Fp, (*Fts5Token)(unsafe.Pointer(p)).Fn) + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + var pConfig uintptr = (*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig + sqlite3Fts5Dequote(tls, z) + for iCol = 0; iCol < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; iCol++ { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(iCol)*8)), z) { + break + } + } + if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { + sqlite3Fts5ParseError(tls, pParse, ts+18881 /* "no such column: ..." */, libc.VaList(bp, z)) + } else { + pRet = fts5ParseColset(tls, pParse, pColset, iCol) + } + Xsqlite3_free(tls, z) + } + + if pRet == uintptr(0) { + + Xsqlite3_free(tls, pColset) + } + + return pRet +} + +// If argument pOrig is NULL, or if (*pRc) is set to anything other than +// SQLITE_OK when this function is called, NULL is returned. +// +// Otherwise, a copy of (*pOrig) is made into memory obtained from +// sqlite3Fts5MallocZero() and a pointer to it returned. If the allocation +// fails, (*pRc) is set to SQLITE_NOMEM and NULL is returned. +func fts5CloneColset(tls *libc.TLS, pRc uintptr, pOrig uintptr) uintptr { /* sqlite3.c:219491:19: */ + var pRet uintptr + if pOrig != 0 { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Colset{})) + ((uint64((*Fts5Colset)(unsafe.Pointer(pOrig)).FnCol - 1)) * uint64(unsafe.Sizeof(int32(0)))))) + pRet = sqlite3Fts5MallocZero(tls, pRc, nByte) + if pRet != 0 { + libc.Xmemcpy(tls, pRet, pOrig, Size_t(nByte)) + } + } else { + pRet = uintptr(0) + } + return pRet +} + +// Remove from colset pColset any columns that are not also in colset pMerge. +func fts5MergeColset(tls *libc.TLS, pColset uintptr, pMerge uintptr) { /* sqlite3.c:219508:13: */ + var iIn int32 = 0 // Next input in pColset + var iMerge int32 = 0 // Next input in pMerge + var iOut int32 = 0 // Next output slot in pColset + + for (iIn < (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol) && (iMerge < (*Fts5Colset)(unsafe.Pointer(pMerge)).FnCol) { + var iDiff int32 = (*(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */) + uintptr(iIn)*4)) - *(*int32)(unsafe.Pointer((pMerge + 4 /* &.aiCol */) + uintptr(iMerge)*4))) + if iDiff == 0 { + *(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */) + uintptr(libc.PostIncInt32(&iOut, 1))*4)) = *(*int32)(unsafe.Pointer((pMerge + 4 /* &.aiCol */) + uintptr(iMerge)*4)) + iMerge++ + iIn++ + } else if iDiff > 0 { + iMerge++ + } else { + iIn++ + } + } + (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol = iOut +} + +// Recursively apply colset pColset to expression node pNode and all of +// its decendents. If (*ppFree) is not NULL, it contains a spare copy +// of pColset. This function may use the spare copy and set (*ppFree) to +// zero, or it may create copies of pColset using fts5CloneColset(). +func fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pNode uintptr, pColset uintptr, ppFree uintptr) { /* sqlite3.c:219534:13: */ + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + + if ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType == FTS5_STRING) || ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType == FTS5_TERM) { + var pNear uintptr = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset != 0 { + fts5MergeColset(tls, (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset, pColset) + if (*Fts5Colset)(unsafe.Pointer((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset)).FnCol == 0 { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType = FTS5_EOF + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext = uintptr(0) + } + } else if *(*uintptr)(unsafe.Pointer(ppFree)) != 0 { + (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset = pColset + *(*uintptr)(unsafe.Pointer(ppFree)) = uintptr(0) + } else { + (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FpColset = fts5CloneColset(tls, (pParse + 16 /* &.rc */), pColset) + } + } else { + var i int32 + + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + fts5ParseSetColset(tls, pParse, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8)), pColset, ppFree) + } + } + } +} + +// Apply colset pColset to expression node pExpr and all of its descendents. +func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pColset uintptr) { /* sqlite3.c:219572:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pFree */)) = pColset + if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, + ts+32916 /* "fts5: column que..." */, 0) + } else { + fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp /* pFree */))) +} + +func fts5ExprAssignXNext(tls *libc.TLS, pNode uintptr) { /* sqlite3.c:219589:13: */ + switch (*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType { + case FTS5_STRING: + { + var pNear uintptr = (*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + if ((((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1) && ((*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))))).FnTerm == 1)) && + ((*Fts5ExprTerm)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))) + 32 /* &.aTerm */))).FpSynonym == uintptr(0))) && + (int32((*Fts5ExprTerm)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))) + 32 /* &.aTerm */))).FbFirst) == 0) { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType = FTS5_TERM + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_TERM})) + } else { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_STRING})) + } + break + + } + + case FTS5_OR: + { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_OR})) + break + + } + + case FTS5_AND: + { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_AND})) + break + + } + + default: + { + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, I64) int32 + }{fts5ExprNodeNext_NOT})) + break + + } + + } +} + +func fts5ExprAddChildren(tls *libc.TLS, p uintptr, pSub uintptr) { /* sqlite3.c:219622:13: */ + if ((*Fts5ExprNode)(unsafe.Pointer(p)).FeType != FTS5_NOT) && ((*Fts5ExprNode)(unsafe.Pointer(pSub)).FeType == (*Fts5ExprNode)(unsafe.Pointer(p)).FeType) { + var nByte int32 = (int32(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Fts5ExprNode)(unsafe.Pointer(pSub)).FnChild))) + libc.Xmemcpy(tls, ((p + 48 /* &.apChild */) + uintptr((*Fts5ExprNode)(unsafe.Pointer(p)).FnChild)*8), pSub+48 /* &.apChild */, uint64(nByte)) + *(*int32)(unsafe.Pointer(p + 40 /* &.nChild */)) += ((*Fts5ExprNode)(unsafe.Pointer(pSub)).FnChild) + Xsqlite3_free(tls, pSub) + } else { + *(*uintptr)(unsafe.Pointer((p + 48 /* &.apChild */) + uintptr(libc.PostIncInt32(&(*Fts5ExprNode)(unsafe.Pointer(p)).FnChild, 1))*8)) = pSub + } +} + +// This function is used when parsing LIKE or GLOB patterns against +// trigram indexes that specify either detail=column or detail=none. +// It converts a phrase: +// +// abc + def + ghi +// +// into an AND tree: +// +// abc AND def AND ghi +func fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) uintptr { /* sqlite3.c:219644:21: */ + var nTerm int32 = (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))))).FnTerm + var ii int32 + var nByte int32 + var pRet uintptr + + nByte = (int32(uint64(unsafe.Sizeof(Fts5ExprNode{})) + (uint64(nTerm) * uint64(unsafe.Sizeof(uintptr(0)))))) + pRet = sqlite3Fts5MallocZero(tls, (pParse + 16 /* &.rc */), int64(nByte)) + if pRet != 0 { + (*Fts5ExprNode)(unsafe.Pointer(pRet)).FeType = FTS5_AND + (*Fts5ExprNode)(unsafe.Pointer(pRet)).FnChild = nTerm + fts5ExprAssignXNext(tls, pRet) + (*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + for ii = 0; ii < nTerm; ii++ { + var pPhrase uintptr = sqlite3Fts5MallocZero(tls, + (pParse + 16 /* &.rc */), int64(unsafe.Sizeof(Fts5ExprPhrase{}))) + if pPhrase != 0 { + if parseGrowPhraseArray(tls, pParse) != 0 { + fts5ExprPhraseFree(tls, pPhrase) + } else { + *(*uintptr)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr(libc.PostIncInt32(&(*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase, 1))*8)) = pPhrase + (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm = 1 + (*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FzTerm = sqlite3Fts5Strndup(tls, + (pParse + 16 /* &.rc */), (*Fts5ExprTerm)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */)))+32 /* &.aTerm */)+uintptr(ii)*32)).FzTerm, -1) + *(*uintptr)(unsafe.Pointer((pRet + 48 /* &.apChild */) + uintptr(ii)*8)) = sqlite3Fts5ParseNode(tls, pParse, FTS5_STRING, + uintptr(0), uintptr(0), sqlite3Fts5ParseNearset(tls, pParse, uintptr(0), pPhrase)) + } + } + } + + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { + sqlite3Fts5ParseNodeFree(tls, pRet) + pRet = uintptr(0) + } else { + sqlite3Fts5ParseNearsetFree(tls, pNear) + } + } + + return pRet +} + +// Allocate and return a new expression object. If anything goes wrong (i.e. +// OOM error), leave an error code in pParse and return NULL. +func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uintptr, pRight uintptr, pNear uintptr) uintptr { /* sqlite3.c:219698:21: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pRet uintptr = uintptr(0) + + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc == SQLITE_OK { + var nChild int32 = 0 // Number of children of returned node + var nByte Sqlite3_int64 // Bytes of space to allocate for this node + + if (eType == FTS5_STRING) && (pNear == uintptr(0)) { + return uintptr(0) + } + if (eType != FTS5_STRING) && (pLeft == uintptr(0)) { + return pRight + } + if (eType != FTS5_STRING) && (pRight == uintptr(0)) { + return pLeft + } + + if ((eType == FTS5_STRING) && + ((*Fts5Parse)(unsafe.Pointer(pParse)).FbPhraseToAnd != 0)) && + ((*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))))).FnTerm > 1) { + pRet = fts5ParsePhraseToAnd(tls, pParse, pNear) + } else { + if eType == FTS5_NOT { + nChild = 2 + } else if (eType == FTS5_AND) || (eType == FTS5_OR) { + nChild = 2 + if (*Fts5ExprNode)(unsafe.Pointer(pLeft)).FeType == eType { + nChild = nChild + ((*Fts5ExprNode)(unsafe.Pointer(pLeft)).FnChild - 1) + } + if (*Fts5ExprNode)(unsafe.Pointer(pRight)).FeType == eType { + nChild = nChild + ((*Fts5ExprNode)(unsafe.Pointer(pRight)).FnChild - 1) + } + } + + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5ExprNode{})) + (uint64(unsafe.Sizeof(uintptr(0))) * (uint64(nChild - 1))))) + pRet = sqlite3Fts5MallocZero(tls, (pParse + 16 /* &.rc */), nByte) + + if pRet != 0 { + (*Fts5ExprNode)(unsafe.Pointer(pRet)).FeType = eType + (*Fts5ExprNode)(unsafe.Pointer(pRet)).FpNear = pNear + fts5ExprAssignXNext(tls, pRet) + if eType == FTS5_STRING { + var iPhrase int32 + for iPhrase = 0; iPhrase < (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase; iPhrase++ { + (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(iPhrase)*8)))).FpNode = pRet + if (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */) + uintptr(iPhrase)*8)))).FnTerm == 0 { + (*Fts5ExprNode)(unsafe.Pointer(pRet)).FxNext = uintptr(0) + (*Fts5ExprNode)(unsafe.Pointer(pRet)).FeType = FTS5_EOF + } + } + + if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail != FTS5_DETAIL_FULL { + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((pNear + 24 /* &.apPhrase */))) + if (((*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase != 1) || + ((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 1)) || + (((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FnTerm > 0) && ((*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FbFirst != 0)) { + + (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR + + (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, + ts+32969, /* "fts5: %s queries..." */ + libc.VaList(bp, func() uintptr { + if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { + return ts + 33019 /* "phrase" */ + } + return ts + 32882 /* "NEAR" */ + }())) + Xsqlite3_free(tls, pRet) + pRet = uintptr(0) + } + } + } else { + fts5ExprAddChildren(tls, pRet, pLeft) + fts5ExprAddChildren(tls, pRet, pRight) + } + } + } + } + + if pRet == uintptr(0) { + + sqlite3Fts5ParseNodeFree(tls, pLeft) + sqlite3Fts5ParseNodeFree(tls, pRight) + sqlite3Fts5ParseNearsetFree(tls, pNear) + } + return pRet +} + +func sqlite3Fts5ParseImplicitAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:219783:21: */ + var pRet uintptr = uintptr(0) + var pPrev uintptr + + if (*Fts5Parse)(unsafe.Pointer(pParse)).Frc != 0 { + sqlite3Fts5ParseNodeFree(tls, pLeft) + sqlite3Fts5ParseNodeFree(tls, pRight) + } else { + + if (*Fts5ExprNode)(unsafe.Pointer(pLeft)).FeType == FTS5_AND { + pPrev = *(*uintptr)(unsafe.Pointer((pLeft + 48 /* &.apChild */) + uintptr(((*Fts5ExprNode)(unsafe.Pointer(pLeft)).FnChild-1))*8)) + } else { + pPrev = pLeft + } + + if (*Fts5ExprNode)(unsafe.Pointer(pRight)).FeType == FTS5_EOF { + + sqlite3Fts5ParseNodeFree(tls, pRight) + pRet = pLeft + (*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + } else if (*Fts5ExprNode)(unsafe.Pointer(pPrev)).FeType == FTS5_EOF { + var ap uintptr + + if pPrev == pLeft { + pRet = pRight + } else { + *(*uintptr)(unsafe.Pointer((pLeft + 48 /* &.apChild */) + uintptr(((*Fts5ExprNode)(unsafe.Pointer(pLeft)).FnChild-1))*8)) = pRight + pRet = pLeft + } + + ap = ((*Fts5Parse)(unsafe.Pointer(pParse)).FapPhrase + uintptr((((*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-1)-(*Fts5ExprNearset)(unsafe.Pointer((*Fts5ExprNode)(unsafe.Pointer(pRight)).FpNear)).FnPhrase))*8) + + libc.Xmemmove(tls, ap, (ap + 1*8), (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Fts5ExprNearset)(unsafe.Pointer((*Fts5ExprNode)(unsafe.Pointer(pRight)).FpNear)).FnPhrase))) + (*Fts5Parse)(unsafe.Pointer(pParse)).FnPhrase-- + + sqlite3Fts5ParseNodeFree(tls, pPrev) + } else { + pRet = sqlite3Fts5ParseNode(tls, pParse, FTS5_AND, pLeft, pRight, uintptr(0)) + } + } + + return pRet +} + +// This is called during initialization to register the fts5_expr() scalar +// UDF with the SQLite handle passed as the only argument. +func sqlite3Fts5ExprInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:220220:12: */ + var rc int32 = SQLITE_OK + _ = pGlobal + _ = db + + // Avoid warnings indicating that sqlite3Fts5ParserTrace() and + // sqlite3Fts5ParserFallback() are unused + _ = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{sqlite3Fts5ParserFallback})) + + return rc +} + +// Return the number of phrases in expression pExpr. +func sqlite3Fts5ExprPhraseCount(tls *libc.TLS, pExpr uintptr) int32 { /* sqlite3.c:220257:12: */ + return func() int32 { + if pExpr != 0 { + return (*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase + } + return 0 + }() +} + +// Return the number of terms in the iPhrase'th phrase in pExpr. +func sqlite3Fts5ExprPhraseSize(tls *libc.TLS, pExpr uintptr, iPhrase int32) int32 { /* sqlite3.c:220264:12: */ + if (iPhrase < 0) || (iPhrase >= (*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase) { + return 0 + } + return (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)))).FnTerm +} + +// This function is used to access the current position list for phrase +// iPhrase. +func sqlite3Fts5ExprPoslist(tls *libc.TLS, pExpr uintptr, iPhrase int32, pa uintptr) int32 { /* sqlite3.c:220273:12: */ + var nRet int32 + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + var pNode uintptr = (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FpNode + if ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0) && ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid == (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid) { + *(*uintptr)(unsafe.Pointer(pa)) = (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fp + nRet = (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn + } else { + *(*uintptr)(unsafe.Pointer(pa)) = uintptr(0) + nRet = 0 + } + return nRet +} + +func sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) uintptr { /* sqlite3.c:220293:29: */ + var pRet uintptr + pRet = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(Fts5PoslistPopulator{})) * uint64((*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase)))) + if pRet != 0 { + var i int32 + libc.Xmemset(tls, pRet, 0, (uint64(unsafe.Sizeof(Fts5PoslistPopulator{})) * uint64((*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase))) + for i = 0; i < (*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase; i++ { + var pBuf uintptr = (*(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)) + 8 /* &.poslist */) + var pNode uintptr = (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)))).FpNode + + if (bLive != 0) && ((((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn == 0) || ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid != (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid)) || ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof != 0)) { + (*Fts5PoslistPopulator)(unsafe.Pointer(pRet + uintptr(i)*16)).FbMiss = 1 + } else { + (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn = 0 + } + } + } + return pRet +} + +type Fts5ExprCtx1 = struct { + FpExpr uintptr + FaPopulator uintptr + FiOff I64 +} /* sqlite3.c:220315:1 */ + +type Fts5ExprCtx = Fts5ExprCtx1 /* sqlite3.c:220320:28 */ + +// TODO: Make this more efficient! +func fts5ExprColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) int32 { /* sqlite3.c:220325:12: */ + var i int32 + for i = 0; i < (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol; i++ { + if *(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */) + uintptr(i)*4)) == iCol { + return 1 + } + } + return 0 +} + +func fts5ExprPopulatePoslistsCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nToken int32, iUnused1 int32, iUnused2 int32) int32 { /* sqlite3.c:220333:12: */ + var p uintptr = pCtx + var pExpr uintptr = (*Fts5ExprCtx)(unsafe.Pointer(p)).FpExpr + var i int32 + + _ = iUnused1 + _ = iUnused2 + + if nToken > FTS5_MAX_TOKEN_SIZE { + nToken = FTS5_MAX_TOKEN_SIZE + } + if (tflags & FTS5_TOKEN_COLOCATED) == 0 { + (*Fts5ExprCtx)(unsafe.Pointer(p)).FiOff++ + } + for i = 0; i < (*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase; i++ { + var pTerm uintptr + if (*Fts5PoslistPopulator)(unsafe.Pointer((*Fts5ExprCtx)(unsafe.Pointer(p)).FaPopulator+uintptr(i)*16)).FbOk == 0 { + continue + } + for pTerm = (*(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)) + 32 /* &.aTerm */); pTerm != 0; pTerm = (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym { + var nTerm int32 = int32(libc.Xstrlen(tls, (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FzTerm)) + if ((nTerm == nToken) || ((nTerm < nToken) && ((*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FbPrefix != 0))) && + (libc.Xmemcmp(tls, (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FzTerm, pToken, uint64(nTerm)) == 0) { + var rc int32 = sqlite3Fts5PoslistWriterAppend(tls, + (*(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)) + 8 /* &.poslist */), ((*Fts5ExprCtx)(unsafe.Pointer(p)).FaPopulator + uintptr(i)*16 /* &.writer */), (*Fts5ExprCtx)(unsafe.Pointer(p)).FiOff) + if rc != 0 { + return rc + } + break + } + } + } + return SQLITE_OK +} + +func sqlite3Fts5ExprPopulatePoslists(tls *libc.TLS, pConfig uintptr, pExpr uintptr, aPopulator uintptr, iCol int32, z uintptr, n int32) int32 { /* sqlite3.c:220368:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + // var sCtx Fts5ExprCtx at bp, 24 + + (*Fts5ExprCtx)(unsafe.Pointer(bp /* &sCtx */)).FpExpr = pExpr + (*Fts5ExprCtx)(unsafe.Pointer(bp /* &sCtx */)).FaPopulator = aPopulator + (*Fts5ExprCtx)(unsafe.Pointer(bp /* &sCtx */)).FiOff = (((I64(iCol)) << 32) - int64(1)) + + for i = 0; i < (*Fts5Expr)(unsafe.Pointer(pExpr)).FnPhrase; i++ { + var pNode uintptr = (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(i)*8)))).FpNode + var pColset uintptr = (*Fts5ExprNearset)(unsafe.Pointer((*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear)).FpColset + if ((pColset != 0) && (0 == fts5ExprColsetTest(tls, pColset, iCol))) || + ((*Fts5PoslistPopulator)(unsafe.Pointer(aPopulator+uintptr(i)*16)).FbMiss != 0) { + (*Fts5PoslistPopulator)(unsafe.Pointer(aPopulator + uintptr(i)*16)).FbOk = 0 + } else { + (*Fts5PoslistPopulator)(unsafe.Pointer(aPopulator + uintptr(i)*16)).FbOk = 1 + } + } + + return sqlite3Fts5Tokenize(tls, pConfig, + FTS5_TOKENIZE_DOCUMENT, z, n, bp /* &sCtx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5ExprPopulatePoslistsCb}))) +} + +func fts5ExprClearPoslists(tls *libc.TLS, pNode uintptr) { /* sqlite3.c:220398:13: */ + if ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType == FTS5_TERM) || ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType == FTS5_STRING) { + (*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(((*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24 /* &.apPhrase */))))).Fposlist.Fn = 0 + } else { + var i int32 + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + fts5ExprClearPoslists(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8))) + } + } +} + +func fts5ExprCheckPoslists(tls *libc.TLS, pNode uintptr, iRowid I64) int32 { /* sqlite3.c:220409:12: */ + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid = iRowid + (*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof = 0 + switch (*Fts5ExprNode)(unsafe.Pointer(pNode)).FeType { + case FTS5_TERM: + fallthrough + case FTS5_STRING: + return (libc.Bool32((*Fts5ExprPhrase)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(((*Fts5ExprNode)(unsafe.Pointer(pNode)).FpNear + 24 /* &.apPhrase */))))).Fposlist.Fn > 0)) + + case FTS5_AND: + { + var i int32 + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + if fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8)), iRowid) == 0 { + fts5ExprClearPoslists(tls, pNode) + return 0 + } + } + break + + } + + case FTS5_OR: + { + var i int32 + var bRet int32 = 0 + for i = 0; i < (*Fts5ExprNode)(unsafe.Pointer(pNode)).FnChild; i++ { + if fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + uintptr(i)*8)), iRowid) != 0 { + bRet = 1 + } + } + return bRet + + } + + default: + { + + if (0 == fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */))), iRowid)) || + (0 != fts5ExprCheckPoslists(tls, *(*uintptr)(unsafe.Pointer((pNode + 48 /* &.apChild */) + 1*8)), iRowid)) { + fts5ExprClearPoslists(tls, pNode) + return 0 + } + break + + } + } + return 1 +} + +func sqlite3Fts5ExprCheckPoslists(tls *libc.TLS, pExpr uintptr, iRowid I64) { /* sqlite3.c:220453:13: */ + fts5ExprCheckPoslists(tls, (*Fts5Expr)(unsafe.Pointer(pExpr)).FpRoot, iRowid) +} + +// This function is only called for detail=columns tables. +func sqlite3Fts5ExprPhraseCollist(tls *libc.TLS, pExpr uintptr, iPhrase int32, ppCollist uintptr, pnCollist uintptr) int32 { /* sqlite3.c:220460:12: */ + var pPhrase uintptr = *(*uintptr)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FapExprPhrase + uintptr(iPhrase)*8)) + var pNode uintptr = (*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).FpNode + var rc int32 = SQLITE_OK + + if (((*Fts5ExprNode)(unsafe.Pointer(pNode)).FbEof == 0) && + ((*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid == (*Fts5ExprNode)(unsafe.Pointer((*Fts5Expr)(unsafe.Pointer(pExpr)).FpRoot)).FiRowid)) && + ((*Fts5ExprPhrase)(unsafe.Pointer(pPhrase)).Fposlist.Fn > 0) { + var pTerm uintptr = (pPhrase + 32 /* &.aTerm */) + if (*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym != 0 { + var pBuf uintptr = ((*Fts5ExprTerm)(unsafe.Pointer(pTerm)).FpSynonym + 1*32) + rc = fts5ExprSynonymList(tls, + pTerm, (*Fts5ExprNode)(unsafe.Pointer(pNode)).FiRowid, pBuf, ppCollist, pnCollist) + } else { + *(*uintptr)(unsafe.Pointer(ppCollist)) = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FpIter)).FpData + *(*int32)(unsafe.Pointer(pnCollist)) = (*Fts5IndexIter)(unsafe.Pointer((*Fts5ExprTerm)(unsafe.Pointer((pPhrase + 32 /* &.aTerm */))).FpIter)).FnData + } + } else { + *(*uintptr)(unsafe.Pointer(ppCollist)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCollist)) = 0 + } + + return rc +} + +// 2014 August 11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// #include "fts5Int.h" + +type Fts5HashEntry1 = struct { + FpHashNext uintptr + FpScanNext uintptr + FnAlloc int32 + FiSzPoslist int32 + FnData int32 + FnKey int32 + FbDel U8 + FbContent U8 + FiCol I16 + FiPos int32 + FiRowid I64 +} /* sqlite3.c:213118:9 */ + +// 2014 August 11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// + +// #include "fts5Int.h" + +type Fts5HashEntry = Fts5HashEntry1 /* sqlite3.c:220513:30 */ + +// Eqivalent to: +// +// char *fts5EntryKey(Fts5HashEntry *pEntry){ return zKey; } + +// Allocate a new hash table. +func sqlite3Fts5HashNew(tls *libc.TLS, pConfig uintptr, ppNew uintptr, pnByte uintptr) int32 { /* sqlite3.c:220579:12: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + *(*uintptr)(unsafe.Pointer(ppNew)) = libc.AssignUintptr(&pNew, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5Hash{})))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var nByte Sqlite3_int64 + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Fts5Hash{}))) + (*Fts5Hash)(unsafe.Pointer(pNew)).FpnByte = pnByte + (*Fts5Hash)(unsafe.Pointer(pNew)).FeDetail = (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail + + (*Fts5Hash)(unsafe.Pointer(pNew)).FnSlot = 1024 + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Fts5Hash)(unsafe.Pointer(pNew)).FnSlot))) + (*Fts5Hash)(unsafe.Pointer(pNew)).FaSlot = Xsqlite3_malloc64(tls, uint64(nByte)) + if (*Fts5Hash)(unsafe.Pointer(pNew)).FaSlot == uintptr(0) { + Xsqlite3_free(tls, pNew) + *(*uintptr)(unsafe.Pointer(ppNew)) = uintptr(0) + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, (*Fts5Hash)(unsafe.Pointer(pNew)).FaSlot, 0, Size_t(nByte)) + } + } + return rc +} + +// Free a hash table object. +func sqlite3Fts5HashFree(tls *libc.TLS, pHash uintptr) { /* sqlite3.c:220609:13: */ + if pHash != 0 { + sqlite3Fts5HashClear(tls, pHash) + Xsqlite3_free(tls, (*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot) + Xsqlite3_free(tls, pHash) + } +} + +// Empty (but do not delete) a hash table. +func sqlite3Fts5HashClear(tls *libc.TLS, pHash uintptr) { /* sqlite3.c:220620:13: */ + var i int32 + for i = 0; i < (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot; i++ { + var pNext uintptr + var pSlot uintptr + for pSlot = *(*uintptr)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(i)*8)); pSlot != 0; pSlot = pNext { + pNext = (*Fts5HashEntry)(unsafe.Pointer(pSlot)).FpHashNext + Xsqlite3_free(tls, pSlot) + } + } + libc.Xmemset(tls, (*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot, 0, (uint64((*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot) * uint64(unsafe.Sizeof(uintptr(0))))) + (*Fts5Hash)(unsafe.Pointer(pHash)).FnEntry = 0 +} + +func fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) uint32 { /* sqlite3.c:220634:21: */ + var i int32 + var h uint32 = uint32(13) + for i = (n - 1); i >= 0; i-- { + h = (((h << 3) ^ h) ^ uint32(*(*U8)(unsafe.Pointer(p + uintptr(i))))) + } + return (h % uint32(nSlot)) +} + +func fts5HashKey2(tls *libc.TLS, nSlot int32, b U8, p uintptr, n int32) uint32 { /* sqlite3.c:220643:21: */ + var i int32 + var h uint32 = uint32(13) + for i = (n - 1); i >= 0; i-- { + h = (((h << 3) ^ h) ^ uint32(*(*U8)(unsafe.Pointer(p + uintptr(i))))) + } + h = (((h << 3) ^ h) ^ uint32(b)) + return (h % uint32(nSlot)) +} + +// Resize the hash table by doubling the number of slots. +func fts5HashResize(tls *libc.TLS, pHash uintptr) int32 { /* sqlite3.c:220656:12: */ + var nNew int32 = ((*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot * 2) + var i int32 + var apNew uintptr + var apOld uintptr = (*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + + apNew = Xsqlite3_malloc64(tls, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(uintptr(0)))))) + if !(apNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, apNew, 0, (uint64(nNew) * uint64(unsafe.Sizeof(uintptr(0))))) + + for i = 0; i < (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot; i++ { + for *(*uintptr)(unsafe.Pointer(apOld + uintptr(i)*8)) != 0 { + var iHash uint32 + var p uintptr = *(*uintptr)(unsafe.Pointer(apOld + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer(apOld + uintptr(i)*8)) = (*Fts5HashEntry)(unsafe.Pointer(p)).FpHashNext + iHash = fts5HashKey(tls, nNew, ((p) + 1*48), + int32(libc.Xstrlen(tls, ((p)+1*48)))) + (*Fts5HashEntry)(unsafe.Pointer(p)).FpHashNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + Xsqlite3_free(tls, apOld) + (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot = nNew + (*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot = apNew + return SQLITE_OK +} + +func fts5HashAddPoslistSize(tls *libc.TLS, pHash uintptr, p uintptr, p2 uintptr) int32 { /* sqlite3.c:220684:12: */ + var nRet int32 = 0 + if (*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist != 0 { + var pPtr uintptr + if p2 != 0 { + pPtr = p2 + } else { + pPtr = p + } + var nData int32 = (*Fts5HashEntry)(unsafe.Pointer(p)).FnData + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_NONE { + + if (*Fts5HashEntry)(unsafe.Pointer(p)).FbDel != 0 { + *(*U8)(unsafe.Pointer(pPtr + uintptr(libc.PostIncInt32(&nData, 1)))) = U8(0x00) + if (*Fts5HashEntry)(unsafe.Pointer(p)).FbContent != 0 { + *(*U8)(unsafe.Pointer(pPtr + uintptr(libc.PostIncInt32(&nData, 1)))) = U8(0x00) + } + } + } else { + var nSz int32 = ((nData - (*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist) - 1) // Size in bytes + var nPos int32 = ((nSz * 2) + int32((*Fts5HashEntry)(unsafe.Pointer(p)).FbDel)) // Value of nPos field + + if nPos <= 127 { + *(*U8)(unsafe.Pointer(pPtr + uintptr((*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist))) = U8(nPos) + } else { + var nByte int32 = sqlite3Fts5GetVarintLen(tls, U32(nPos)) + libc.Xmemmove(tls, (pPtr + uintptr(((*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist + nByte))), (pPtr + uintptr(((*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist + 1))), uint64(nSz)) + sqlite3Fts5PutVarint(tls, (pPtr + uintptr((*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist)), uint64(nPos)) + nData = nData + (nByte - 1) + } + } + + nRet = (nData - (*Fts5HashEntry)(unsafe.Pointer(p)).FnData) + if p2 == uintptr(0) { + (*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist = 0 + (*Fts5HashEntry)(unsafe.Pointer(p)).FbDel = U8(0) + (*Fts5HashEntry)(unsafe.Pointer(p)).FbContent = U8(0) + (*Fts5HashEntry)(unsafe.Pointer(p)).FnData = nData + } + } + return nRet +} + +// Add an entry to the in-memory hash table. The key is the concatenation +// of bByte and (pToken/nToken). The value is (iRowid/iCol/iPos). +// +// (bByte || pToken) -> (iRowid,iCol,iPos) +// +// Or, if iCol is negative, then the value is a delete marker. +func sqlite3Fts5HashWrite(tls *libc.TLS, pHash uintptr, iRowid I64, iCol int32, iPos int32, bByte int8, pToken uintptr, nToken int32) int32 { /* sqlite3.c:220735:12: */ + var iHash uint32 + var p uintptr + var pPtr uintptr + var nIncr int32 = 0 // Amount to increment (*pHash->pnByte) by + var bNew int32 // If non-delete entry should be written + + bNew = (libc.Bool32((*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL)) + + // Attempt to locate an existing hash entry + iHash = fts5HashKey2(tls, (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot, U8(bByte), pToken, nToken) + for p = *(*uintptr)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)); p != 0; p = (*Fts5HashEntry)(unsafe.Pointer(p)).FpHashNext { + var zKey uintptr = ((p) + 1*48) + if ((int32(*(*int8)(unsafe.Pointer(zKey))) == int32(bByte)) && + ((*Fts5HashEntry)(unsafe.Pointer(p)).FnKey == nToken)) && + (libc.Xmemcmp(tls, (zKey+1), pToken, uint64(nToken)) == 0) { + break + } + } + + // If an existing hash entry cannot be found, create a new one. + if p == uintptr(0) { + // Figure out how much space to allocate + var zKey uintptr + var nByte Sqlite3_int64 = (Sqlite3_int64(((uint64(unsafe.Sizeof(Fts5HashEntry{})) + (uint64(nToken + 1))) + uint64(1)) + uint64(64))) + if nByte < int64(128) { + nByte = int64(128) + } + + // Grow the Fts5Hash.aSlot[] array if necessary. + if ((*Fts5Hash)(unsafe.Pointer(pHash)).FnEntry * 2) >= (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot { + var rc int32 = fts5HashResize(tls, pHash) + if rc != SQLITE_OK { + return rc + } + iHash = fts5HashKey2(tls, (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot, U8(bByte), pToken, nToken) + } + + // Allocate new Fts5HashEntry and add it to the hash table. + p = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(p != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Fts5HashEntry{}))) + (*Fts5HashEntry)(unsafe.Pointer(p)).FnAlloc = int32(nByte) + zKey = ((p) + 1*48) + *(*int8)(unsafe.Pointer(zKey)) = bByte + libc.Xmemcpy(tls, (zKey + 1), pToken, uint64(nToken)) + + (*Fts5HashEntry)(unsafe.Pointer(p)).FnKey = nToken + *(*int8)(unsafe.Pointer(zKey + uintptr((nToken + 1)))) = int8(0) + (*Fts5HashEntry)(unsafe.Pointer(p)).FnData = (int32((uint64((nToken + 1) + 1)) + uint64(unsafe.Sizeof(Fts5HashEntry{})))) + (*Fts5HashEntry)(unsafe.Pointer(p)).FpHashNext = *(*uintptr)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)) = p + (*Fts5Hash)(unsafe.Pointer(pHash)).FnEntry++ + + // Add the first rowid field to the hash-entry + *(*int32)(unsafe.Pointer(p + 24 /* &.nData */)) += (sqlite3Fts5PutVarint(tls, ((p) + uintptr((*Fts5HashEntry)(unsafe.Pointer(p)).FnData)), uint64(iRowid))) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiRowid = iRowid + + (*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist = (*Fts5HashEntry)(unsafe.Pointer(p)).FnData + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail != FTS5_DETAIL_NONE { + *(*int32)(unsafe.Pointer(p + 24 /* &.nData */)) += (1) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiCol = func() int16 { + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL { + return int16(0) + } + return int16(-1) + }() + } + + } else { + + // Appending to an existing hash-entry. Check that there is enough + // space to append the largest possible new entry. Worst case scenario + // is: + // + // + 9 bytes for a new rowid, + // + 4 byte reserved for the "poslist size" varint. + // + 1 byte for a "new column" byte, + // + 3 bytes for a new column number (16-bit max) as a varint, + // + 5 bytes for the new position offset (32-bit max). + if ((*Fts5HashEntry)(unsafe.Pointer(p)).FnAlloc - (*Fts5HashEntry)(unsafe.Pointer(p)).FnData) < ((((9 + 4) + 1) + 3) + 5) { + var nNew Sqlite3_int64 = (Sqlite3_int64((*Fts5HashEntry)(unsafe.Pointer(p)).FnAlloc * 2)) + var pNew uintptr + var pp uintptr + pNew = Xsqlite3_realloc64(tls, p, uint64(nNew)) + if pNew == uintptr(0) { + return SQLITE_NOMEM + } + (*Fts5HashEntry)(unsafe.Pointer(pNew)).FnAlloc = int32(nNew) + for pp = ((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != p; pp = (*(*uintptr)(unsafe.Pointer(pp)) /* &.pHashNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = pNew + p = pNew + } + nIncr = nIncr - ((*Fts5HashEntry)(unsafe.Pointer(p)).FnData) + } + + pPtr = p + + // If this is a new rowid, append the 4-byte size field for the previous + // entry, and the new rowid for this entry. + if iRowid != (*Fts5HashEntry)(unsafe.Pointer(p)).FiRowid { + var iDiff U64 = (U64(iRowid) - U64((*Fts5HashEntry)(unsafe.Pointer(p)).FiRowid)) + fts5HashAddPoslistSize(tls, pHash, p, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 24 /* &.nData */)) += (sqlite3Fts5PutVarint(tls, (pPtr + uintptr((*Fts5HashEntry)(unsafe.Pointer(p)).FnData)), iDiff)) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiRowid = iRowid + bNew = 1 + (*Fts5HashEntry)(unsafe.Pointer(p)).FiSzPoslist = (*Fts5HashEntry)(unsafe.Pointer(p)).FnData + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail != FTS5_DETAIL_NONE { + *(*int32)(unsafe.Pointer(p + 24 /* &.nData */)) += (1) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiCol = func() int16 { + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL { + return int16(0) + } + return int16(-1) + }() + (*Fts5HashEntry)(unsafe.Pointer(p)).FiPos = 0 + } + } + + if iCol >= 0 { + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_NONE { + (*Fts5HashEntry)(unsafe.Pointer(p)).FbContent = U8(1) + } else { + // Append a new column value, if necessary + + if iCol != int32((*Fts5HashEntry)(unsafe.Pointer(p)).FiCol) { + if (*Fts5Hash)(unsafe.Pointer(pHash)).FeDetail == FTS5_DETAIL_FULL { + *(*U8)(unsafe.Pointer(pPtr + uintptr(libc.PostIncInt32(&(*Fts5HashEntry)(unsafe.Pointer(p)).FnData, 1)))) = U8(0x01) + *(*int32)(unsafe.Pointer(p + 24 /* &.nData */)) += (sqlite3Fts5PutVarint(tls, (pPtr + uintptr((*Fts5HashEntry)(unsafe.Pointer(p)).FnData)), uint64(iCol))) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiCol = I16(iCol) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiPos = 0 + } else { + bNew = 1 + (*Fts5HashEntry)(unsafe.Pointer(p)).FiCol = I16(libc.AssignInt32(&iPos, iCol)) + } + } + + // Append the new position offset, if necessary + if bNew != 0 { + *(*int32)(unsafe.Pointer(p + 24 /* &.nData */)) += (sqlite3Fts5PutVarint(tls, (pPtr + uintptr((*Fts5HashEntry)(unsafe.Pointer(p)).FnData)), (uint64((iPos - (*Fts5HashEntry)(unsafe.Pointer(p)).FiPos) + 2)))) + (*Fts5HashEntry)(unsafe.Pointer(p)).FiPos = iPos + } + } + } else { + // This is a delete. Set the delete flag. + (*Fts5HashEntry)(unsafe.Pointer(p)).FbDel = U8(1) + } + + nIncr = nIncr + ((*Fts5HashEntry)(unsafe.Pointer(p)).FnData) + *(*int32)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FpnByte)) += (nIncr) + return SQLITE_OK +} + +// Arguments pLeft and pRight point to linked-lists of hash-entry objects, +// each sorted in key order. This function merges the two lists into a +// single list and returns a pointer to its first element. +func fts5HashEntryMerge(tls *libc.TLS, pLeft uintptr, pRight uintptr) uintptr { /* sqlite3.c:220888:22: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p1 uintptr = pLeft + var p2 uintptr = pRight + *(*uintptr)(unsafe.Pointer(bp /* pRet */)) = uintptr(0) + var ppOut uintptr = bp /* &pRet */ + + for (p1 != 0) || (p2 != 0) { + if p1 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(ppOut)) = p2 + p2 = uintptr(0) + } else if p2 == uintptr(0) { + *(*uintptr)(unsafe.Pointer(ppOut)) = p1 + p1 = uintptr(0) + } else { + var i int32 = 0 + var zKey1 uintptr = ((p1) + 1*48) + var zKey2 uintptr = ((p2) + 1*48) + for int32(*(*int8)(unsafe.Pointer(zKey1 + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(zKey2 + uintptr(i)))) { + i++ + } + + if (int32(U8(*(*int8)(unsafe.Pointer(zKey1 + uintptr(i)))))) > (int32(U8(*(*int8)(unsafe.Pointer(zKey2 + uintptr(i)))))) { + // p2 is smaller + *(*uintptr)(unsafe.Pointer(ppOut)) = p2 + ppOut = (p2 + 8 /* &.pScanNext */) + p2 = (*Fts5HashEntry)(unsafe.Pointer(p2)).FpScanNext + } else { + // p1 is smaller + *(*uintptr)(unsafe.Pointer(ppOut)) = p1 + ppOut = (p1 + 8 /* &.pScanNext */) + p1 = (*Fts5HashEntry)(unsafe.Pointer(p1)).FpScanNext + } + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } + } + + return *(*uintptr)(unsafe.Pointer(bp /* pRet */)) +} + +// Extract all tokens from hash table iHash and link them into a list +// in sorted order. The hash table is cleared before returning. It is +// the responsibility of the caller to free the elements of the returned +// list. +func fts5HashEntrySort(tls *libc.TLS, pHash uintptr, pTerm uintptr, nTerm int32, ppSorted uintptr) int32 { /* sqlite3.c:220934:12: */ + var nMergeSlot int32 = 32 + var ap uintptr + var pList uintptr + var iSlot int32 + var i int32 + + *(*uintptr)(unsafe.Pointer(ppSorted)) = uintptr(0) + ap = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nMergeSlot)))) + if !(ap != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, ap, 0, (uint64(unsafe.Sizeof(uintptr(0))) * uint64(nMergeSlot))) + + for iSlot = 0; iSlot < (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot; iSlot++ { + var pIter uintptr + for pIter = *(*uintptr)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iSlot)*8)); pIter != 0; pIter = (*Fts5HashEntry)(unsafe.Pointer(pIter)).FpHashNext { + if (pTerm == uintptr(0)) || + ((((*Fts5HashEntry)(unsafe.Pointer(pIter)).FnKey + 1) >= nTerm) && (0 == libc.Xmemcmp(tls, ((pIter)+1*48), pTerm, uint64(nTerm)))) { + var pEntry uintptr = pIter + (*Fts5HashEntry)(unsafe.Pointer(pEntry)).FpScanNext = uintptr(0) + for i = 0; *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) != 0; i++ { + pEntry = fts5HashEntryMerge(tls, pEntry, *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8))) + *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8)) = pEntry + } + } + } + + pList = uintptr(0) + for i = 0; i < nMergeSlot; i++ { + pList = fts5HashEntryMerge(tls, pList, *(*uintptr)(unsafe.Pointer(ap + uintptr(i)*8))) + } + + (*Fts5Hash)(unsafe.Pointer(pHash)).FnEntry = 0 + Xsqlite3_free(tls, ap) + *(*uintptr)(unsafe.Pointer(ppSorted)) = pList + return SQLITE_OK +} + +// Query the hash table for a doclist associated with term pTerm/nTerm. +func sqlite3Fts5HashQuery(tls *libc.TLS, pHash uintptr, nPre int32, pTerm uintptr, nTerm int32, ppOut uintptr, pnDoclist uintptr) int32 { /* sqlite3.c:220981:12: */ + var iHash uint32 = fts5HashKey(tls, (*Fts5Hash)(unsafe.Pointer(pHash)).FnSlot, pTerm, nTerm) + var zKey uintptr = uintptr(0) + var p uintptr + + for p = *(*uintptr)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(pHash)).FaSlot + uintptr(iHash)*8)); p != 0; p = (*Fts5HashEntry)(unsafe.Pointer(p)).FpHashNext { + zKey = ((p) + 1*48) + + if (nTerm == ((*Fts5HashEntry)(unsafe.Pointer(p)).FnKey + 1)) && (libc.Xmemcmp(tls, zKey, pTerm, uint64(nTerm)) == 0) { + break + } + } + + if p != 0 { + var nHashPre int32 = (int32((uint64(unsafe.Sizeof(Fts5HashEntry{})) + uint64(nTerm)) + uint64(1))) + var nList int32 = ((*Fts5HashEntry)(unsafe.Pointer(p)).FnData - nHashPre) + var pRet uintptr = libc.AssignPtrUintptr(ppOut, Xsqlite3_malloc64(tls, (uint64((nPre+nList)+10)))) + if pRet != 0 { + var pFaux uintptr = (pRet + uintptr((nPre - nHashPre))) + libc.Xmemcpy(tls, (pRet + uintptr(nPre)), ((p) + uintptr(nHashPre)), uint64(nList)) + nList = nList + (fts5HashAddPoslistSize(tls, pHash, p, pFaux)) + *(*int32)(unsafe.Pointer(pnDoclist)) = nList + } else { + *(*int32)(unsafe.Pointer(pnDoclist)) = 0 + return SQLITE_NOMEM + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnDoclist)) = 0 + } + + return SQLITE_OK +} + +func sqlite3Fts5HashScanInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32) int32 { /* sqlite3.c:221019:12: */ + return fts5HashEntrySort(tls, p, pTerm, nTerm, (p + 24 /* &.pScan */)) +} + +func sqlite3Fts5HashScanNext(tls *libc.TLS, p uintptr) { /* sqlite3.c:221026:13: */ + + (*Fts5Hash)(unsafe.Pointer(p)).FpScan = (*Fts5HashEntry)(unsafe.Pointer((*Fts5Hash)(unsafe.Pointer(p)).FpScan)).FpScanNext +} + +func sqlite3Fts5HashScanEof(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:221031:12: */ + return (libc.Bool32((*Fts5Hash)(unsafe.Pointer(p)).FpScan == uintptr(0))) +} + +func sqlite3Fts5HashScanEntry(tls *libc.TLS, pHash uintptr, pzTerm uintptr, ppDoclist uintptr, pnDoclist uintptr) { /* sqlite3.c:221035:13: */ + var p uintptr + if libc.AssignUintptr(&p, (*Fts5Hash)(unsafe.Pointer(pHash)).FpScan) != 0 { + var zKey uintptr = ((p) + 1*48) + var nTerm int32 = int32(libc.Xstrlen(tls, zKey)) + fts5HashAddPoslistSize(tls, pHash, p, uintptr(0)) + *(*uintptr)(unsafe.Pointer(pzTerm)) = zKey + *(*uintptr)(unsafe.Pointer(ppDoclist)) = (zKey + uintptr((nTerm + 1))) + *(*int32)(unsafe.Pointer(pnDoclist)) = (int32(uint64((*Fts5HashEntry)(unsafe.Pointer(p)).FnData) - ((uint64(unsafe.Sizeof(Fts5HashEntry{})) + uint64(nTerm)) + uint64(1)))) + } else { + *(*uintptr)(unsafe.Pointer(pzTerm)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(ppDoclist)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnDoclist)) = 0 + } +} + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Low level access to the FTS index stored in the database file. The +// routines in this file file implement all read and write access to the +// %_data table. Other parts of the system access this functionality via +// the interface defined in fts5Int.h. + +// #include "fts5Int.h" + +// Overview: +// +// The %_data table contains all the FTS indexes for an FTS5 virtual table. +// As well as the main term index, there may be up to 31 prefix indexes. +// The format is similar to FTS3/4, except that: +// +// * all segment b-tree leaf data is stored in fixed size page records +// (e.g. 1000 bytes). A single doclist may span multiple pages. Care is +// taken to ensure it is possible to iterate in either direction through +// the entries in a doclist, or to seek to a specific entry within a +// doclist, without loading it into memory. +// +// * large doclists that span many pages have associated "doclist index" +// records that contain a copy of the first rowid on each page spanned by +// the doclist. This is used to speed up seek operations, and merges of +// large doclists with very small doclists. +// +// * extra fields in the "structure record" record the state of ongoing +// incremental merge operations. +// + +// Details: +// +// The %_data table managed by this module, +// +// CREATE TABLE %_data(id INTEGER PRIMARY KEY, block BLOB); +// +// , contains the following 5 types of records. See the comments surrounding +// the FTS5_*_ROWID macros below for a description of how %_data rowids are +// assigned to each fo them. +// +// 1. Structure Records: +// +// The set of segments that make up an index - the index structure - are +// recorded in a single record within the %_data table. The record consists +// of a single 32-bit configuration cookie value followed by a list of +// SQLite varints. If the FTS table features more than one index (because +// there are one or more prefix indexes), it is guaranteed that all share +// the same cookie value. +// +// Immediately following the configuration cookie, the record begins with +// three varints: +// +// + number of levels, +// + total number of segments on all levels, +// + value of write counter. +// +// Then, for each level from 0 to nMax: +// +// + number of input segments in ongoing merge. +// + total number of segments in level. +// + for each segment from oldest to newest: +// + segment id (always > 0) +// + first leaf page number (often 1, always greater than 0) +// + final leaf page number +// +// 2. The Averages Record: +// +// A single record within the %_data table. The data is a list of varints. +// The first value is the number of rows in the index. Then, for each column +// from left to right, the total number of tokens in the column for all +// rows of the table. +// +// 3. Segment leaves: +// +// TERM/DOCLIST FORMAT: +// +// Most of each segment leaf is taken up by term/doclist data. The +// general format of term/doclist, starting with the first term +// on the leaf page, is: +// +// varint : size of first term +// blob: first term data +// doclist: first doclist +// zero-or-more { +// varint: number of bytes in common with previous term +// varint: number of bytes of new term data (nNew) +// blob: nNew bytes of new term data +// doclist: next doclist +// } +// +// doclist format: +// +// varint: first rowid +// poslist: first poslist +// zero-or-more { +// varint: rowid delta (always > 0) +// poslist: next poslist +// } +// +// poslist format: +// +// varint: size of poslist in bytes multiplied by 2, not including +// this field. Plus 1 if this entry carries the "delete" flag. +// collist: collist for column 0 +// zero-or-more { +// 0x01 byte +// varint: column number (I) +// collist: collist for column I +// } +// +// collist format: +// +// varint: first offset + 2 +// zero-or-more { +// varint: offset delta + 2 +// } +// +// PAGE FORMAT +// +// Each leaf page begins with a 4-byte header containing 2 16-bit +// unsigned integer fields in big-endian format. They are: +// +// * The byte offset of the first rowid on the page, if it exists +// and occurs before the first term (otherwise 0). +// +// * The byte offset of the start of the page footer. If the page +// footer is 0 bytes in size, then this field is the same as the +// size of the leaf page in bytes. +// +// The page footer consists of a single varint for each term located +// on the page. Each varint is the byte offset of the current term +// within the page, delta-compressed against the previous value. In +// other words, the first varint in the footer is the byte offset of +// the first term, the second is the byte offset of the second less that +// of the first, and so on. +// +// The term/doclist format described above is accurate if the entire +// term/doclist data fits on a single leaf page. If this is not the case, +// the format is changed in two ways: +// +// + if the first rowid on a page occurs before the first term, it +// is stored as a literal value: +// +// varint: first rowid +// +// + the first term on each page is stored in the same way as the +// very first term of the segment: +// +// varint : size of first term +// blob: first term data +// +// 5. Segment doclist indexes: +// +// Doclist indexes are themselves b-trees, however they usually consist of +// a single leaf record only. The format of each doclist index leaf page +// is: +// +// * Flags byte. Bits are: +// 0x01: Clear if leaf is also the root page, otherwise set. +// +// * Page number of fts index leaf page. As a varint. +// +// * First rowid on page indicated by previous field. As a varint. +// +// * A list of varints, one for each subsequent termless page. A +// positive delta if the termless page contains at least one rowid, +// or an 0x00 byte otherwise. +// +// Internal doclist index nodes are: +// +// * Flags byte. Bits are: +// 0x01: Clear for root page, otherwise set. +// +// * Page number of first child page. As a varint. +// +// * Copy of first rowid on page indicated by previous field. As a varint. +// +// * A list of delta-encoded varints - the first rowid on each subsequent +// child page. +// + +// Rowids for the averages and structure records in the %_data table. + +// Macros determining the rowids used by segment leaves and dlidx leaves +// and nodes. All nodes and leaves are stored in the %_data table with large +// positive rowids. +// +// Each segment has a unique non-zero 16-bit id. +// +// The rowid for each segment leaf is found by passing the segment id and +// the leaf page number to the FTS5_SEGMENT_ROWID macro. Leaves are numbered +// sequentially starting from 1. + +// Each time a blob is read from the %_data table, it is padded with this +// many zero bytes. This makes it easier to decode the various record formats +// without overreading if the records are corrupt. + +type Fts5Data1 = struct { + Fp uintptr + Fnn int32 + FszLeaf int32 +} /* sqlite3.c:221310:9 */ + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Low level access to the FTS index stored in the database file. The +// routines in this file file implement all read and write access to the +// %_data table. Other parts of the system access this functionality via +// the interface defined in fts5Int.h. + +// #include "fts5Int.h" + +// Overview: +// +// The %_data table contains all the FTS indexes for an FTS5 virtual table. +// As well as the main term index, there may be up to 31 prefix indexes. +// The format is similar to FTS3/4, except that: +// +// * all segment b-tree leaf data is stored in fixed size page records +// (e.g. 1000 bytes). A single doclist may span multiple pages. Care is +// taken to ensure it is possible to iterate in either direction through +// the entries in a doclist, or to seek to a specific entry within a +// doclist, without loading it into memory. +// +// * large doclists that span many pages have associated "doclist index" +// records that contain a copy of the first rowid on each page spanned by +// the doclist. This is used to speed up seek operations, and merges of +// large doclists with very small doclists. +// +// * extra fields in the "structure record" record the state of ongoing +// incremental merge operations. +// + +// Details: +// +// The %_data table managed by this module, +// +// CREATE TABLE %_data(id INTEGER PRIMARY KEY, block BLOB); +// +// , contains the following 5 types of records. See the comments surrounding +// the FTS5_*_ROWID macros below for a description of how %_data rowids are +// assigned to each fo them. +// +// 1. Structure Records: +// +// The set of segments that make up an index - the index structure - are +// recorded in a single record within the %_data table. The record consists +// of a single 32-bit configuration cookie value followed by a list of +// SQLite varints. If the FTS table features more than one index (because +// there are one or more prefix indexes), it is guaranteed that all share +// the same cookie value. +// +// Immediately following the configuration cookie, the record begins with +// three varints: +// +// + number of levels, +// + total number of segments on all levels, +// + value of write counter. +// +// Then, for each level from 0 to nMax: +// +// + number of input segments in ongoing merge. +// + total number of segments in level. +// + for each segment from oldest to newest: +// + segment id (always > 0) +// + first leaf page number (often 1, always greater than 0) +// + final leaf page number +// +// 2. The Averages Record: +// +// A single record within the %_data table. The data is a list of varints. +// The first value is the number of rows in the index. Then, for each column +// from left to right, the total number of tokens in the column for all +// rows of the table. +// +// 3. Segment leaves: +// +// TERM/DOCLIST FORMAT: +// +// Most of each segment leaf is taken up by term/doclist data. The +// general format of term/doclist, starting with the first term +// on the leaf page, is: +// +// varint : size of first term +// blob: first term data +// doclist: first doclist +// zero-or-more { +// varint: number of bytes in common with previous term +// varint: number of bytes of new term data (nNew) +// blob: nNew bytes of new term data +// doclist: next doclist +// } +// +// doclist format: +// +// varint: first rowid +// poslist: first poslist +// zero-or-more { +// varint: rowid delta (always > 0) +// poslist: next poslist +// } +// +// poslist format: +// +// varint: size of poslist in bytes multiplied by 2, not including +// this field. Plus 1 if this entry carries the "delete" flag. +// collist: collist for column 0 +// zero-or-more { +// 0x01 byte +// varint: column number (I) +// collist: collist for column I +// } +// +// collist format: +// +// varint: first offset + 2 +// zero-or-more { +// varint: offset delta + 2 +// } +// +// PAGE FORMAT +// +// Each leaf page begins with a 4-byte header containing 2 16-bit +// unsigned integer fields in big-endian format. They are: +// +// * The byte offset of the first rowid on the page, if it exists +// and occurs before the first term (otherwise 0). +// +// * The byte offset of the start of the page footer. If the page +// footer is 0 bytes in size, then this field is the same as the +// size of the leaf page in bytes. +// +// The page footer consists of a single varint for each term located +// on the page. Each varint is the byte offset of the current term +// within the page, delta-compressed against the previous value. In +// other words, the first varint in the footer is the byte offset of +// the first term, the second is the byte offset of the second less that +// of the first, and so on. +// +// The term/doclist format described above is accurate if the entire +// term/doclist data fits on a single leaf page. If this is not the case, +// the format is changed in two ways: +// +// + if the first rowid on a page occurs before the first term, it +// is stored as a literal value: +// +// varint: first rowid +// +// + the first term on each page is stored in the same way as the +// very first term of the segment: +// +// varint : size of first term +// blob: first term data +// +// 5. Segment doclist indexes: +// +// Doclist indexes are themselves b-trees, however they usually consist of +// a single leaf record only. The format of each doclist index leaf page +// is: +// +// * Flags byte. Bits are: +// 0x01: Clear if leaf is also the root page, otherwise set. +// +// * Page number of fts index leaf page. As a varint. +// +// * First rowid on page indicated by previous field. As a varint. +// +// * A list of varints, one for each subsequent termless page. A +// positive delta if the termless page contains at least one rowid, +// or an 0x00 byte otherwise. +// +// Internal doclist index nodes are: +// +// * Flags byte. Bits are: +// 0x01: Clear for root page, otherwise set. +// +// * Page number of first child page. As a varint. +// +// * Copy of first rowid on page indicated by previous field. As a varint. +// +// * A list of delta-encoded varints - the first rowid on each subsequent +// child page. +// + +// Rowids for the averages and structure records in the %_data table. + +// Macros determining the rowids used by segment leaves and dlidx leaves +// and nodes. All nodes and leaves are stored in the %_data table with large +// positive rowids. +// +// Each segment has a unique non-zero 16-bit id. +// +// The rowid for each segment leaf is found by passing the segment id and +// the leaf page number to the FTS5_SEGMENT_ROWID macro. Leaves are numbered +// sequentially starting from 1. + +// Each time a blob is read from the %_data table, it is padded with this +// many zero bytes. This makes it easier to decode the various record formats +// without overreading if the records are corrupt. + +type Fts5Data = Fts5Data1 /* sqlite3.c:221310:25 */ +type Fts5DlidxIter1 = struct { + FnLvl int32 + FiSegid int32 + FaLvl [1]Fts5DlidxLvl +} /* sqlite3.c:221311:9 */ + +type Fts5DlidxIter = Fts5DlidxIter1 /* sqlite3.c:221311:30 */ +type Fts5DlidxLvl1 = struct { + FpData uintptr + FiOff int32 + FbEof int32 + FiFirstOff int32 + FiLeafPgno int32 + FiRowid I64 +} /* sqlite3.c:221311:9 */ + +type Fts5DlidxLvl = Fts5DlidxLvl1 /* sqlite3.c:221312:29 */ +type Fts5DlidxWriter1 = struct { + Fpgno int32 + FbPrevValid int32 + FiPrev I64 + Fbuf Fts5Buffer +} /* sqlite3.c:221313:9 */ + +type Fts5DlidxWriter = Fts5DlidxWriter1 /* sqlite3.c:221313:32 */ +type Fts5Iter1 = struct { + Fbase Fts5IndexIter + FpIndex uintptr + Fposlist Fts5Buffer + FpColset uintptr + FxSetOutputs uintptr + FnSeg int32 + FbRev int32 + FbSkipEmpty U8 + _ [7]byte + FiSwitchRowid I64 + FaFirst uintptr + FaSeg [1]Fts5SegIter +} /* sqlite3.c:221314:9 */ + +type Fts5Iter = Fts5Iter1 /* sqlite3.c:221314:25 */ +type Fts5PageWriter1 = struct { + Fpgno int32 + FiPrevPgidx int32 + Fbuf Fts5Buffer + Fpgidx Fts5Buffer + Fterm Fts5Buffer +} /* sqlite3.c:221315:9 */ + +type Fts5PageWriter = Fts5PageWriter1 /* sqlite3.c:221315:31 */ +type Fts5SegIter1 = struct { + FpSeg uintptr + Fflags int32 + FiLeafPgno int32 + FpLeaf uintptr + FpNextLeaf uintptr + FiLeafOffset I64 + FxNext uintptr + FiTermLeafPgno int32 + FiTermLeafOffset int32 + FiPgidxOff int32 + FiEndofDoclist int32 + FiRowidOffset int32 + FnRowidOffset int32 + FaRowidOffset uintptr + FpDlidx uintptr + Fterm Fts5Buffer + FiRowid I64 + FnPos int32 + FbDel U8 + _ [3]byte +} /* sqlite3.c:221314:9 */ + +type Fts5SegIter = Fts5SegIter1 /* sqlite3.c:221316:28 */ +type Fts5DoclistIter1 = struct { + FaEof uintptr + FiRowid I64 + FaPoslist uintptr + FnPoslist int32 + FnSize int32 +} /* sqlite3.c:221317:9 */ + +type Fts5DoclistIter = Fts5DoclistIter1 /* sqlite3.c:221317:32 */ +type Fts5SegWriter1 = struct { + FiSegid int32 + _ [4]byte + Fwriter Fts5PageWriter + FiPrevRowid I64 + FbFirstRowidInDoclist U8 + FbFirstRowidInPage U8 + FbFirstTermInPage U8 + _ [1]byte + FnLeafWritten int32 + FnEmpty int32 + FnDlidx int32 + FaDlidx uintptr + Fbtterm Fts5Buffer + FiBtPage int32 + _ [4]byte +} /* sqlite3.c:221318:9 */ + +type Fts5SegWriter = Fts5SegWriter1 /* sqlite3.c:221318:30 */ +type Fts5Structure1 = struct { + FnRef int32 + _ [4]byte + FnWriteCounter U64 + FnSegment int32 + FnLevel int32 + FaLevel [1]Fts5StructureLevel +} /* sqlite3.c:213118:9 */ + +type Fts5Structure = Fts5Structure1 /* sqlite3.c:221319:30 */ +type Fts5StructureLevel1 = struct { + FnMerge int32 + FnSeg int32 + FaSeg uintptr +} /* sqlite3.c:213118:9 */ + +type Fts5StructureLevel = Fts5StructureLevel1 /* sqlite3.c:221320:35 */ +type Fts5StructureSegment1 = struct { + FiSegid int32 + FpgnoFirst int32 + FpgnoLast int32 +} /* sqlite3.c:213118:9 */ + +type Fts5StructureSegment = Fts5StructureSegment1 /* sqlite3.c:221321:37 */ + +type Fts5CResult1 = struct { + FiFirst U16 + FbTermEq U8 + _ [1]byte +} /* sqlite3.c:221314:9 */ + +type Fts5CResult = Fts5CResult1 /* sqlite3.c:221431:28 */ + +func fts5PutU16(tls *libc.TLS, aOut uintptr, iVal U16) { /* sqlite3.c:221610:13: */ + *(*U8)(unsafe.Pointer(aOut)) = (U8(int32(iVal) >> 8)) + *(*U8)(unsafe.Pointer(aOut + 1)) = (U8(int32(iVal) & 0xFF)) +} + +func fts5GetU16(tls *libc.TLS, aIn uintptr) U16 { /* sqlite3.c:221615:12: */ + return (U16((int32(U16(*(*U8)(unsafe.Pointer(aIn)))) << 8) + int32(*(*U8)(unsafe.Pointer(aIn + 1))))) +} + +// Allocate and return a buffer at least nByte bytes in size. +// +// If an OOM error is encountered, return NULL and set the error code in +// the Fts5Index handle passed as the first argument. +func fts5IdxMalloc(tls *libc.TLS, p uintptr, nByte Sqlite3_int64) uintptr { /* sqlite3.c:221625:13: */ + return sqlite3Fts5MallocZero(tls, (p + 52 /* &.rc */), nByte) +} + +// Compare the contents of the pLeft buffer with the pRight/nRight blob. +// +// Return -ve if pLeft is smaller than pRight, 0 if they are equal or +// +ve if pRight is smaller than pLeft. In other words: +// +// res = *pLeft - *pRight + +// Compare the contents of the two buffers using memcmp(). If one buffer +// is a prefix of the other, it is considered the lesser. +// +// Return -ve if pLeft is smaller than pRight, 0 if they are equal or +// +ve if pRight is smaller than pLeft. In other words: +// +// res = *pLeft - *pRight +func fts5BufferCompare(tls *libc.TLS, pLeft uintptr, pRight uintptr) int32 { /* sqlite3.c:221657:12: */ + var nCmp int32 = func() int32 { + if ((*Fts5Buffer)(unsafe.Pointer(pLeft)).Fn) < ((*Fts5Buffer)(unsafe.Pointer(pRight)).Fn) { + return (*Fts5Buffer)(unsafe.Pointer(pLeft)).Fn + } + return (*Fts5Buffer)(unsafe.Pointer(pRight)).Fn + }() + var res int32 = func() int32 { + if (nCmp) == 0 { + return 0 + } + return libc.Xmemcmp(tls, (*Fts5Buffer)(unsafe.Pointer(pLeft)).Fp, (*Fts5Buffer)(unsafe.Pointer(pRight)).Fp, uint64(nCmp)) + }() + return func() int32 { + if res == 0 { + return ((*Fts5Buffer)(unsafe.Pointer(pLeft)).Fn - (*Fts5Buffer)(unsafe.Pointer(pRight)).Fn) + } + return res + }() +} + +func fts5LeafFirstTermOff(tls *libc.TLS, pLeaf uintptr) int32 { /* sqlite3.c:221663:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var ret int32 at bp, 4 + + sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr((*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf)), bp /* &ret */) + return *(*int32)(unsafe.Pointer(bp /* ret */)) +} + +// Close the read-only blob handle, if it is open. +func sqlite3Fts5IndexCloseReader(tls *libc.TLS, p uintptr) { /* sqlite3.c:221672:13: */ + if (*Fts5Index)(unsafe.Pointer(p)).FpReader != 0 { + var pReader uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpReader + (*Fts5Index)(unsafe.Pointer(p)).FpReader = uintptr(0) + Xsqlite3_blob_close(tls, pReader) + } +} + +// Retrieve a record from the %_data table. +// +// If an error occurs, NULL is returned and an error left in the +// Fts5Index object. +func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:221686:17: */ + var pRet uintptr = uintptr(0) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var rc int32 = SQLITE_OK + + if (*Fts5Index)(unsafe.Pointer(p)).FpReader != 0 { + // This call may return SQLITE_ABORT if there has been a savepoint + // rollback since it was last used. In this case a new blob handle + // is required. + var pBlob uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpReader + (*Fts5Index)(unsafe.Pointer(p)).FpReader = uintptr(0) + rc = Xsqlite3_blob_reopen(tls, pBlob, iRowid) + + (*Fts5Index)(unsafe.Pointer(p)).FpReader = pBlob + if rc != SQLITE_OK { + sqlite3Fts5IndexCloseReader(tls, p) + } + if rc == SQLITE_ABORT { + rc = SQLITE_OK + } + } + + // If the blob handle is not open at this point, open it and seek + // to the requested entry. + if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33026 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) + } + + // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls + // above returned SQLITE_ERROR, return SQLITE_CORRUPT_VTAB instead. + // All the reasons those functions might return SQLITE_ERROR - missing + // table, missing row, non-blob/text in block column - indicate + // backing store corruption. + if rc == SQLITE_ERROR { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + + if rc == SQLITE_OK { + var aOut uintptr = uintptr(0) // Read blob data into this buffer + var nByte int32 = Xsqlite3_blob_bytes(tls, (*Fts5Index)(unsafe.Pointer(p)).FpReader) + var nAlloc Sqlite3_int64 = (Sqlite3_int64((uint64(unsafe.Sizeof(Fts5Data{})) + uint64(nByte)) + uint64(FTS5_DATA_PADDING))) + pRet = Xsqlite3_malloc64(tls, uint64(nAlloc)) + if pRet != 0 { + (*Fts5Data)(unsafe.Pointer(pRet)).Fnn = nByte + aOut = libc.AssignPtrUintptr(pRet /* &.p */, (pRet + 1*16)) + } else { + rc = SQLITE_NOMEM + } + + if rc == SQLITE_OK { + rc = Xsqlite3_blob_read(tls, (*Fts5Index)(unsafe.Pointer(p)).FpReader, aOut, nByte, 0) + } + if rc != SQLITE_OK { + Xsqlite3_free(tls, pRet) + pRet = uintptr(0) + } else { + // TODO1: Fix this + *(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer(pRet)).Fp + uintptr(nByte))) = U8(0x00) + *(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer(pRet)).Fp + uintptr((nByte + 1)))) = U8(0x00) + (*Fts5Data)(unsafe.Pointer(pRet)).FszLeaf = int32(fts5GetU16(tls, ((*Fts5Data)(unsafe.Pointer(pRet)).Fp + 2))) + } + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = rc + (*Fts5Index)(unsafe.Pointer(p)).FnRead++ + } + + return pRet +} + +// Release a reference to data record returned by an earlier call to +// fts5DataRead(). +func fts5DataRelease(tls *libc.TLS, pData uintptr) { /* sqlite3.c:221759:13: */ + Xsqlite3_free(tls, pData) +} + +func fts5LeafRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:221763:17: */ + var pRet uintptr = fts5DataRead(tls, p, iRowid) + if pRet != 0 { + if ((*Fts5Data)(unsafe.Pointer(pRet)).Fnn < 4) || ((*Fts5Data)(unsafe.Pointer(pRet)).FszLeaf > (*Fts5Data)(unsafe.Pointer(pRet)).Fnn) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + fts5DataRelease(tls, pRet) + pRet = uintptr(0) + } + } + return pRet +} + +func fts5IndexPrepareStmt(tls *libc.TLS, p uintptr, ppStmt uintptr, zSql uintptr) int32 { /* sqlite3.c:221775:12: */ + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if zSql != 0 { + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fdb, zSql, -1, + (uint32(SQLITE_PREPARE_PERSISTENT | SQLITE_PREPARE_NO_VTAB)), + ppStmt, uintptr(0)) + } else { + (*Fts5Index)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } + } + Xsqlite3_free(tls, zSql) + return (*Fts5Index)(unsafe.Pointer(p)).Frc +} + +// INSERT OR REPLACE a record into the %_data table. +func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData int32) { /* sqlite3.c:221797:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + + if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pWriter */), Xsqlite3_mprintf(tls, + ts+33032, /* "REPLACE INTO '%q..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + } + + Xsqlite3_bind_int64(tls, (*Fts5Index)(unsafe.Pointer(p)).FpWriter, 1, iRowid) + Xsqlite3_bind_blob(tls, (*Fts5Index)(unsafe.Pointer(p)).FpWriter, 2, pData, nData, uintptr(0)) + Xsqlite3_step(tls, (*Fts5Index)(unsafe.Pointer(p)).FpWriter) + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*Fts5Index)(unsafe.Pointer(p)).FpWriter) + Xsqlite3_bind_null(tls, (*Fts5Index)(unsafe.Pointer(p)).FpWriter, 2) +} + +// Execute the following SQL: +// +// DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast +func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite3.c:221821:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + + if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + var zSql uintptr = Xsqlite3_mprintf(tls, + ts+33083, /* "DELETE FROM '%q'..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + if fts5IndexPrepareStmt(tls, p, (p+72 /* &.pDeleter */), zSql) != 0 { + return + } + } + + Xsqlite3_bind_int64(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDeleter, 1, iFirst) + Xsqlite3_bind_int64(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDeleter, 2, iLast) + Xsqlite3_step(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDeleter) + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDeleter) +} + +// Remove all records associated with segment iSegid. +func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3.c:221842:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var iFirst I64 = (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (int64(0))) + var iLast I64 = ((((((I64(iSegid + 1)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (int64(0))) - int64(1)) + fts5DataDelete(tls, p, iFirst, iLast) + if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + fts5IndexPrepareStmt(tls, p, (p + 88 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, + ts+33132, /* "DELETE FROM '%q'..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) + } + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + Xsqlite3_bind_int(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter, 1, iSegid) + Xsqlite3_step(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter) + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter) + } +} + +// Release a reference to an Fts5Structure object returned by an earlier +// call to fts5StructureRead() or fts5StructureDecode(). +func fts5StructureRelease(tls *libc.TLS, pStruct uintptr) { /* sqlite3.c:221864:13: */ + if (pStruct != 0) && (0 >= (libc.PreDecInt32(&(*Fts5Structure)(unsafe.Pointer(pStruct)).FnRef, 1))) { + var i int32 + + for i = 0; i < (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel; i++ { + Xsqlite3_free(tls, (*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(i)*16)).FaSeg) + } + Xsqlite3_free(tls, pStruct) + } +} + +func fts5StructureRef(tls *libc.TLS, pStruct uintptr) { /* sqlite3.c:221875:13: */ + (*Fts5Structure)(unsafe.Pointer(pStruct)).FnRef++ +} + +// Deserialize and return the structure record currently stored in serialized +// form within buffer pData/nData. +// +// The Fts5Structure.aLevel[] and each Fts5StructureLevel.aSeg[] array +// are over-allocated by one slot. This allows the structure contents +// to be more easily edited. +// +// If an error occurs, *ppOut is set to NULL and an SQLite error code +// returned. Otherwise, *ppOut is set to point to the new object and +// SQLITE_OK returned. +func fts5StructureDecode(tls *libc.TLS, pData uintptr, nData int32, piCookie uintptr, ppOut uintptr) int32 { /* sqlite3.c:221891:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + var i int32 = 0 + var iLvl int32 + *(*int32)(unsafe.Pointer(bp /* nLevel */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* nSegment */)) = 0 + var nByte Sqlite3_int64 // Bytes of space to allocate at pRet + var pRet uintptr = uintptr(0) // Structure object to return + + // Grab the cookie value + if piCookie != 0 { + *(*int32)(unsafe.Pointer(piCookie)) = sqlite3Fts5Get32(tls, pData) + } + i = 4 + + // Read the total number of levels and segments from the start of the + // structure record. + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), bp /* &nLevel */)) + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), bp+4 /* &nSegment */)) + if (((*(*int32)(unsafe.Pointer(bp /* nLevel */)) > FTS5_MAX_SEGMENT) || (*(*int32)(unsafe.Pointer(bp /* nLevel */)) < 0)) || + (*(*int32)(unsafe.Pointer(bp + 4 /* nSegment */)) > FTS5_MAX_SEGMENT)) || (*(*int32)(unsafe.Pointer(bp + 4 /* nSegment */)) < 0) { + return (SQLITE_CORRUPT | (int32(1) << 8)) + } + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Structure{})) + (uint64(unsafe.Sizeof(Fts5StructureLevel{})) * (uint64(*(*int32)(unsafe.Pointer(bp /* nLevel */)) - 1))))) + pRet = sqlite3Fts5MallocZero(tls, bp+8 /* &rc */, nByte) + + if pRet != 0 { + (*Fts5Structure)(unsafe.Pointer(pRet)).FnRef = 1 + (*Fts5Structure)(unsafe.Pointer(pRet)).FnLevel = *(*int32)(unsafe.Pointer(bp /* nLevel */)) + (*Fts5Structure)(unsafe.Pointer(pRet)).FnSegment = *(*int32)(unsafe.Pointer(bp + 4 /* nSegment */)) + i = i + (int32(sqlite3Fts5GetVarint(tls, (pData + uintptr(i)), (pRet + 8 /* &.nWriteCounter */)))) + + for iLvl = 0; (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (iLvl < *(*int32)(unsafe.Pointer(bp /* nLevel */))); iLvl++ { + var pLvl uintptr = ((pRet + 24 /* &.aLevel */) + uintptr(iLvl)*16) + *(*int32)(unsafe.Pointer(bp + 12 /* nTotal */)) = 0 + var iSeg int32 + + if i >= nData { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), (pLvl /* &.nMerge */))) + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), bp+12 /* &nTotal */)) + if *(*int32)(unsafe.Pointer(bp + 12 /* nTotal */)) < (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg = sqlite3Fts5MallocZero(tls, bp+8, /* &rc */ + (int64(uint64(*(*int32)(unsafe.Pointer(bp + 12 /* nTotal */))) * uint64(unsafe.Sizeof(Fts5StructureSegment{}))))) + *(*int32)(unsafe.Pointer(bp + 4 /* nSegment */)) -= *(*int32)(unsafe.Pointer(bp + 12 /* nTotal */)) + } + + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg = *(*int32)(unsafe.Pointer(bp + 12 /* nTotal */)) + for iSeg = 0; iSeg < *(*int32)(unsafe.Pointer(bp + 12 /* nTotal */)); iSeg++ { + var pSeg uintptr = ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*12) + if i >= nData { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + break + } + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), (pSeg /* &.iSegid */))) + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), (pSeg + 4 /* &.pgnoFirst */))) + i = i + (sqlite3Fts5GetVarint32(tls, (pData + uintptr(i)), (pSeg + 8 /* &.pgnoLast */))) + if (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast < (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + break + } + } + if ((iLvl > 0) && ((*Fts5StructureLevel)(unsafe.Pointer(pLvl+libc.UintptrFromInt32(-1)*16)).FnMerge != 0)) && (*(*int32)(unsafe.Pointer(bp + 12 /* nTotal */)) == 0) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } + if (iLvl == (*(*int32)(unsafe.Pointer(bp /* nLevel */)) - 1)) && ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + } + if (*(*int32)(unsafe.Pointer(bp + 4 /* nSegment */)) != 0) && (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } + + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + fts5StructureRelease(tls, pRet) + pRet = uintptr(0) + } + } + + *(*uintptr)(unsafe.Pointer(ppOut)) = pRet + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// +func fts5StructureAddLevel(tls *libc.TLS, pRc uintptr, ppStruct uintptr) { /* sqlite3.c:221982:13: */ + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var pStruct uintptr = *(*uintptr)(unsafe.Pointer(ppStruct)) + var nLevel int32 = (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Structure{})) + (uint64(unsafe.Sizeof(Fts5StructureLevel{})) * (uint64(nLevel + 1))))) + + pStruct = Xsqlite3_realloc64(tls, pStruct, uint64(nByte)) + if pStruct != 0 { + libc.Xmemset(tls, ((pStruct + 24 /* &.aLevel */) + uintptr(nLevel)*16), 0, uint64(unsafe.Sizeof(Fts5StructureLevel{}))) + (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel++ + *(*uintptr)(unsafe.Pointer(ppStruct)) = pStruct + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } +} + +// Extend level iLvl so that there is room for at least nExtra more +// segments. +func fts5StructureExtendLevel(tls *libc.TLS, pRc uintptr, pStruct uintptr, iLvl int32, nExtra int32, bInsert int32) { /* sqlite3.c:222006:13: */ + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var pLvl uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr(iLvl)*16) + var aNew uintptr + var nByte Sqlite3_int64 + + nByte = (Sqlite3_int64((uint64((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg + nExtra)) * uint64(unsafe.Sizeof(Fts5StructureSegment{})))) + aNew = Xsqlite3_realloc64(tls, (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg, uint64(nByte)) + if aNew != 0 { + if bInsert == 0 { + libc.Xmemset(tls, (aNew + uintptr((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg)*12), 0, (uint64(unsafe.Sizeof(Fts5StructureSegment{})) * uint64(nExtra))) + } else { + var nMove int32 = (int32(uint64((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg) * uint64(unsafe.Sizeof(Fts5StructureSegment{})))) + libc.Xmemmove(tls, (aNew + uintptr(nExtra)*12), aNew, uint64(nMove)) + libc.Xmemset(tls, aNew, 0, (uint64(unsafe.Sizeof(Fts5StructureSegment{})) * uint64(nExtra))) + } + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg = aNew + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } +} + +func fts5StructureReadUncached(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:222035:22: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) = uintptr(0) + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + // var iCookie int32 at bp, 4 + // Configuration cookie + var pData uintptr + + pData = fts5DataRead(tls, p, int64(FTS5_STRUCTURE_ROWID)) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + // TODO: Do we need this if the leaf-index is appended? Probably... + libc.Xmemset(tls, ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr((*Fts5Data)(unsafe.Pointer(pData)).Fnn)), 0, uint64(FTS5_DATA_PADDING)) + (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5StructureDecode(tls, (*Fts5Data)(unsafe.Pointer(pData)).Fp, (*Fts5Data)(unsafe.Pointer(pData)).Fnn, bp /* &iCookie */, bp+8 /* &pRet */) + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (((*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz == 0) || ((*Fts5Config)(unsafe.Pointer(pConfig)).FiCookie != *(*int32)(unsafe.Pointer(bp /* iCookie */)))) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = sqlite3Fts5ConfigLoad(tls, pConfig, *(*int32)(unsafe.Pointer(bp /* iCookie */))) + } + fts5DataRelease(tls, pData) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) = uintptr(0) + } + } + + return *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) +} + +func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var iVersion I64 = int64(0) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 112 /* &.pDataVersion */), + Xsqlite3_mprintf(tls, ts+33172 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + return int64(0) + } + } + + if SQLITE_ROW == Xsqlite3_step(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion) { + iVersion = Xsqlite3_column_int64(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion, 0) + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion) + } + + return iVersion +} + +// Read, deserialize and return the structure record. +// +// The Fts5Structure.aLevel[] and each Fts5StructureLevel.aSeg[] array +// are over-allocated as described for function fts5StructureDecode() +// above. +// +// If an error occurs, NULL is returned and an error code left in the +// Fts5Index handle. If an error has already occurred when this function +// is called, it is a no-op. +func fts5StructureRead(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:222090:22: */ + + if (*Fts5Index)(unsafe.Pointer(p)).FpStruct == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).FiStructVersion = fts5IndexDataVersion(tls, p) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5Index)(unsafe.Pointer(p)).FpStruct = fts5StructureReadUncached(tls, p) + } + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return uintptr(0) + } + + fts5StructureRef(tls, (*Fts5Index)(unsafe.Pointer(p)).FpStruct) + return (*Fts5Index)(unsafe.Pointer(p)).FpStruct +} + +func fts5StructureInvalidate(tls *libc.TLS, p uintptr) { /* sqlite3.c:222129:13: */ + if (*Fts5Index)(unsafe.Pointer(p)).FpStruct != 0 { + fts5StructureRelease(tls, (*Fts5Index)(unsafe.Pointer(p)).FpStruct) + (*Fts5Index)(unsafe.Pointer(p)).FpStruct = uintptr(0) + } +} + +// Return the total number of segments in index structure pStruct. This +// function is only ever used as part of assert() conditions. + +// Serialize and store the "structure" record. +// +// If an error occurs, leave an error code in the Fts5Index object. If an +// error has already occurred, this function is a no-op. +func fts5StructureWrite(tls *libc.TLS, p uintptr, pStruct uintptr) { /* sqlite3.c:222172:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + // var buf Fts5Buffer at bp, 16 + // Buffer to serialize record into + var iLvl int32 // Used to iterate through levels + var iCookie int32 // Cookie value to store + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + + // Append the current configuration cookie + iCookie = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FiCookie + if iCookie < 0 { + iCookie = 0 + } + + if 0 == sqlite3Fts5BufferSize(tls, (p+52 /* &.rc */), bp /* &buf */, (uint32(((4+9)+9)+9))) { + sqlite3Fts5Put32(tls, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp, iCookie) + (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn = 4 + { + *(*int32)(unsafe.Pointer(bp /* &buf */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fn)), uint64((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel))) + } + + { + *(*int32)(unsafe.Pointer(bp /* &buf */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fn)), uint64((*Fts5Structure)(unsafe.Pointer(pStruct)).FnSegment))) + } + + { + *(*int32)(unsafe.Pointer(bp /* &buf */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fn)), uint64(I64((*Fts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter)))) + } + + } + + for iLvl = 0; iLvl < (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel; iLvl++ { + var iSeg int32 // Used to iterate through segments + var pLvl uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr(iLvl)*16) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge)) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg)) + + for iSeg = 0; iSeg < (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg; iSeg++ { + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64((*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(iSeg)*12)).FiSegid)) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64((*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(iSeg)*12)).FpgnoFirst)) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64((*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(iSeg)*12)).FpgnoLast)) + } + } + + fts5DataWrite(tls, p, int64(FTS5_STRUCTURE_ROWID), (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn) + sqlite3Fts5BufferFree(tls, bp /* &buf */) + } +} + +func fts5SegmentSize(tls *libc.TLS, pSeg uintptr) int32 { /* sqlite3.c:222227:12: */ + return ((1 + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast) - (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst) +} + +// Return a copy of index structure pStruct. Except, promote as many +// segments as possible to level iPromote. If an OOM occurs, NULL is +// returned. +func fts5StructurePromoteTo(tls *libc.TLS, p uintptr, iPromote int32, szPromote int32, pStruct uintptr) { /* sqlite3.c:222236:13: */ + var il int32 + var is int32 + var pOut uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr(iPromote)*16) + + if (*Fts5StructureLevel)(unsafe.Pointer(pOut)).FnMerge == 0 { + for il = (iPromote + 1); il < (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel; il++ { + var pLvl uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr(il)*16) + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0 { + return + } + for is = ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg - 1); is >= 0; is-- { + var sz int32 = fts5SegmentSize(tls, ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(is)*12)) + if sz > szPromote { + return + } + fts5StructureExtendLevel(tls, (p + 52 /* &.rc */), pStruct, iPromote, 1, 1) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + libc.Xmemcpy(tls, (*Fts5StructureLevel)(unsafe.Pointer(pOut)).FaSeg, ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(is)*12), uint64(unsafe.Sizeof(Fts5StructureSegment{}))) + (*Fts5StructureLevel)(unsafe.Pointer(pOut)).FnSeg++ + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg-- + } + } + } +} + +// A new segment has just been written to level iLvl of index structure +// pStruct. This function determines if any segments should be promoted +// as a result. Segments are promoted in two scenarios: +// +// a) If the segment just written is smaller than one or more segments +// within the previous populated level, it is promoted to the previous +// populated level. +// +// b) If the segment just written is larger than the newest segment on +// the next populated level, then that segment, and any other adjacent +// segments that are also smaller than the one just written, are +// promoted. +// +// If one or more segments are promoted, the structure object is updated +// to reflect this. +func fts5StructurePromote(tls *libc.TLS, p uintptr, iLvl int32, pStruct uintptr) { /* sqlite3.c:222279:13: */ + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var iTst int32 + var iPromote int32 = -1 + var szPromote int32 = 0 // Promote anything this size or smaller + var pSeg uintptr // Segment just written + var szSeg int32 // Size of segment just written + var nSeg int32 = (*Fts5StructureLevel)(unsafe.Pointer((pStruct + 24 /* &.aLevel */) + uintptr(iLvl)*16)).FnSeg + + if nSeg == 0 { + return + } + pSeg = ((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FaSeg + uintptr(((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg-1))*12) + szSeg = ((1 + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast) - (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst) + + // Check for condition (a) + for iTst = (iLvl - 1); (iTst >= 0) && ((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iTst)*16)).FnSeg == 0); iTst-- { + } + if iTst >= 0 { + var i int32 + var szMax int32 = 0 + var pTst uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr(iTst)*16) + + for i = 0; i < (*Fts5StructureLevel)(unsafe.Pointer(pTst)).FnSeg; i++ { + var sz int32 = (((*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pTst)).FaSeg+uintptr(i)*12)).FpgnoLast - (*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pTst)).FaSeg+uintptr(i)*12)).FpgnoFirst) + 1) + if sz > szMax { + szMax = sz + } + } + if szMax >= szSeg { + // Condition (a) is true. Promote the newest segment on level + // iLvl to level iTst. + iPromote = iTst + szPromote = szMax + } + } + + // If condition (a) is not met, assume (b) is true. StructurePromoteTo() + // is a no-op if it is not. + if iPromote < 0 { + iPromote = iLvl + szPromote = szSeg + } + fts5StructurePromoteTo(tls, p, iPromote, szPromote, pStruct) + } +} + +// Advance the iterator passed as the only argument. If the end of the +// doclist-index page is reached, return non-zero. +func fts5DlidxLvlNext(tls *libc.TLS, pLvl uintptr) int32 { /* sqlite3.c:222330:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pData uintptr = (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData + + if (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff == 0 { + + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = 1 + *(*int32)(unsafe.Pointer(pLvl + 8 /* &.iOff */)) += (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pData)).Fp + 1), (pLvl + 20 /* &.iLeafPgno */))) + *(*int32)(unsafe.Pointer(pLvl + 8 /* &.iOff */)) += (int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr((*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff)), (pLvl + 24 /* &.iRowid */)))) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff = (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff + } else { + var iOff int32 + for iOff = (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff; iOff < (*Fts5Data)(unsafe.Pointer(pData)).Fnn; iOff++ { + if *(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr(iOff))) != 0 { + break + } + } + + if iOff < (*Fts5Data)(unsafe.Pointer(pData)).Fnn { + // var iVal I64 at bp, 8 + + *(*int32)(unsafe.Pointer(pLvl + 20 /* &.iLeafPgno */)) += ((iOff - (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff) + 1) + iOff = iOff + (int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr(iOff)), bp /* &iVal */))) + *(*I64)(unsafe.Pointer(pLvl + 24 /* &.iRowid */)) += (*(*I64)(unsafe.Pointer(bp /* iVal */))) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = iOff + } else { + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = 1 + } + } + + return (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof +} + +// Advance the iterator passed as the only argument. +func fts5DlidxIterNextR(tls *libc.TLS, p uintptr, pIter uintptr, iLvl int32) int32 { /* sqlite3.c:222362:12: */ + var pLvl uintptr = ((pIter + 8 /* &.aLvl */) + uintptr(iLvl)*32) + + if fts5DlidxLvlNext(tls, pLvl) != 0 { + if (iLvl + 1) < (*Fts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl { + fts5DlidxIterNextR(tls, p, pIter, (iLvl + 1)) + if (*Fts5DlidxLvl)(unsafe.Pointer(pLvl+1*32)).FbEof == 0 { + fts5DataRelease(tls, (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData) + libc.Xmemset(tls, pLvl, 0, uint64(unsafe.Sizeof(Fts5DlidxLvl{}))) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData = fts5DataRead(tls, p, + (((((I64((*Fts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(1))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + ((I64(iLvl)) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5DlidxLvl)(unsafe.Pointer(pLvl + 1*32)).FiLeafPgno)))) + if (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData != 0 { + fts5DlidxLvlNext(tls, pLvl) + } + } + } + } + + return (*Fts5DlidxLvl)(unsafe.Pointer((pIter + 8 /* &.aLvl */))).FbEof +} + +func fts5DlidxIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:222382:12: */ + return fts5DlidxIterNextR(tls, p, pIter, 0) +} + +// The iterator passed as the first argument has the following fields set +// as follows. This function sets up the rest of the iterator so that it +// points to the first rowid in the doclist-index. +// +// pData: +// pointer to doclist-index record, +// +// When this function is called pIter->iLeafPgno is the page number the +// doclist is associated with (the one featuring the term). +func fts5DlidxIterFirst(tls *libc.TLS, pIter uintptr) int32 { /* sqlite3.c:222397:12: */ + var i int32 + for i = 0; i < (*Fts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl; i++ { + fts5DlidxLvlNext(tls, ((pIter + 8 /* &.aLvl */) + uintptr(i)*32)) + } + return (*Fts5DlidxLvl)(unsafe.Pointer((pIter + 8 /* &.aLvl */))).FbEof +} + +func fts5DlidxIterEof(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:222406:12: */ + return (libc.Bool32(((*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK) || ((*Fts5DlidxLvl)(unsafe.Pointer((pIter + 8 /* &.aLvl */))).FbEof != 0))) +} + +func fts5DlidxIterLast(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222410:13: */ + var i int32 + + // Advance each level to the last entry on the last page + for i = ((*Fts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl - 1); ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i >= 0); i-- { + var pLvl uintptr = ((pIter + 8 /* &.aLvl */) + uintptr(i)*32) + for fts5DlidxLvlNext(tls, pLvl) == 0 { + } + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = 0 + + if i > 0 { + var pChild uintptr = (pLvl + libc.UintptrFromInt32(-1)*32) + fts5DataRelease(tls, (*Fts5DlidxLvl)(unsafe.Pointer(pChild)).FpData) + libc.Xmemset(tls, pChild, 0, uint64(unsafe.Sizeof(Fts5DlidxLvl{}))) + (*Fts5DlidxLvl)(unsafe.Pointer(pChild)).FpData = fts5DataRead(tls, p, + (((((I64((*Fts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(1))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + ((I64(i - 1)) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiLeafPgno)))) + } + } +} + +// Move the iterator passed as the only argument to the previous entry. +func fts5DlidxLvlPrev(tls *libc.TLS, pLvl uintptr) int32 { /* sqlite3.c:222433:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var iOff int32 = (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff + + if iOff <= (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff { + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = 1 + } else { + var a uintptr = (*Fts5Data)(unsafe.Pointer((*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData)).Fp + // var iVal I64 at bp, 8 + + var iLimit int32 + var ii int32 + var nZero int32 = 0 + + // Currently iOff points to the first byte of a varint. This block + // decrements iOff until it points to the first byte of the previous + // varint. Taking care not to read any memory locations that occur + // before the buffer in memory. + iLimit = func() int32 { + if iOff > 9 { + return (iOff - 9) + } + return 0 + }() + for iOff--; iOff > iLimit; iOff-- { + if (int32(*(*U8)(unsafe.Pointer(a + uintptr((iOff - 1))))) & 0x80) == 0 { + break + } + } + + sqlite3Fts5GetVarint(tls, (a + uintptr(iOff)), bp /* &iVal */) + *(*I64)(unsafe.Pointer(pLvl + 24 /* &.iRowid */)) -= (*(*I64)(unsafe.Pointer(bp /* iVal */))) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiLeafPgno-- + + // Skip backwards past any 0x00 varints. + for ii = (iOff - 1); (ii >= (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff) && (int32(*(*U8)(unsafe.Pointer(a + uintptr(ii)))) == 0x00); ii-- { + nZero++ + } + if (ii >= (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff) && ((int32(*(*U8)(unsafe.Pointer(a + uintptr(ii)))) & 0x80) != 0) { + // The byte immediately before the last 0x00 byte has the 0x80 bit + // set. So the last 0x00 is only a varint 0 if there are 8 more 0x80 + // bytes before a[ii]. + var bZero int32 = 0 // True if last 0x00 counts + if (ii - 8) >= (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiFirstOff { + var j int32 + for j = 1; (j <= 8) && ((int32(*(*U8)(unsafe.Pointer(a + uintptr((ii - j))))) & 0x80) != 0); j++ { + } + bZero = (libc.Bool32(j > 8)) + } + if bZero == 0 { + nZero-- + } + } + *(*int32)(unsafe.Pointer(pLvl + 20 /* &.iLeafPgno */)) -= (nZero) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FiOff = (iOff - nZero) + } + + return (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof +} + +func fts5DlidxIterPrevR(tls *libc.TLS, p uintptr, pIter uintptr, iLvl int32) int32 { /* sqlite3.c:222482:12: */ + var pLvl uintptr = ((pIter + 8 /* &.aLvl */) + uintptr(iLvl)*32) + + if fts5DlidxLvlPrev(tls, pLvl) != 0 { + if (iLvl + 1) < (*Fts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl { + fts5DlidxIterPrevR(tls, p, pIter, (iLvl + 1)) + if (*Fts5DlidxLvl)(unsafe.Pointer(pLvl+1*32)).FbEof == 0 { + fts5DataRelease(tls, (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData) + libc.Xmemset(tls, pLvl, 0, uint64(unsafe.Sizeof(Fts5DlidxLvl{}))) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData = fts5DataRead(tls, p, + (((((I64((*Fts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(1))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + ((I64(iLvl)) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5DlidxLvl)(unsafe.Pointer(pLvl + 1*32)).FiLeafPgno)))) + if (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData != 0 { + for fts5DlidxLvlNext(tls, pLvl) == 0 { + } + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FbEof = 0 + } + } + } + } + + return (*Fts5DlidxLvl)(unsafe.Pointer((pIter + 8 /* &.aLvl */))).FbEof +} + +func fts5DlidxIterPrev(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:222505:12: */ + return fts5DlidxIterPrevR(tls, p, pIter, 0) +} + +// Free a doclist-index iterator object allocated by fts5DlidxIterInit(). +func fts5DlidxIterFree(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:222512:13: */ + if pIter != 0 { + var i int32 + for i = 0; i < (*Fts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl; i++ { + fts5DataRelease(tls, (*Fts5DlidxLvl)(unsafe.Pointer((pIter+8 /* &.aLvl */)+uintptr(i)*32)).FpData) + } + Xsqlite3_free(tls, pIter) + } +} + +func fts5DlidxIterInit(tls *libc.TLS, p uintptr, bRev int32, iSegid int32, iLeafPg int32) uintptr { /* sqlite3.c:222522:22: */ + var pIter uintptr = uintptr(0) + var i int32 + var bDone int32 = 0 + + for i = 0; ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bDone == 0); i++ { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5DlidxIter{})) + (uint64(i) * uint64(unsafe.Sizeof(Fts5DlidxLvl{}))))) + var pNew uintptr + + pNew = Xsqlite3_realloc64(tls, pIter, uint64(nByte)) + if pNew == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } else { + var iRowid I64 = (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(1))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + ((I64(i)) << (FTS5_DATA_PAGE_B))) + (I64(iLeafPg))) + var pLvl uintptr = ((pNew + 8 /* &.aLvl */) + uintptr(i)*32) + pIter = pNew + libc.Xmemset(tls, pLvl, 0, uint64(unsafe.Sizeof(Fts5DlidxLvl{}))) + (*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData = fts5DataRead(tls, p, iRowid) + if ((*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData != 0) && ((int32(*(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer((*Fts5DlidxLvl)(unsafe.Pointer(pLvl)).FpData)).Fp))) & 0x0001) == 0) { + bDone = 1 + } + (*Fts5DlidxIter)(unsafe.Pointer(pIter)).FnLvl = (i + 1) + } + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5DlidxIter)(unsafe.Pointer(pIter)).FiSegid = iSegid + if bRev == 0 { + fts5DlidxIterFirst(tls, pIter) + } else { + fts5DlidxIterLast(tls, p, pIter) + } + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + fts5DlidxIterFree(tls, pIter) + pIter = uintptr(0) + } + + return pIter +} + +func fts5DlidxIterRowid(tls *libc.TLS, pIter uintptr) I64 { /* sqlite3.c:222569:12: */ + return (*Fts5DlidxLvl)(unsafe.Pointer((pIter + 8 /* &.aLvl */))).FiRowid +} + +func fts5DlidxIterPgno(tls *libc.TLS, pIter uintptr) int32 { /* sqlite3.c:222572:12: */ + return (*Fts5DlidxLvl)(unsafe.Pointer((pIter + 8 /* &.aLvl */))).FiLeafPgno +} + +// Load the next leaf page into the segment iterator. +func fts5SegIterNextPage(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222579:13: */ + var pLeaf uintptr + var pSeg uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno++ + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf != 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf = uintptr(0) + } else if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno <= (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = fts5LeafRead(tls, p, + (((((I64((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno)))) + } else { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + } + pLeaf = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf + + if pLeaf != 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + if (*Fts5Data)(unsafe.Pointer((pLeaf))).FszLeaf >= (*Fts5Data)(unsafe.Pointer((pLeaf))).Fnn { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fnn + 1) + } else { + *(*int32)(unsafe.Pointer(pIter + 56 /* &.iPgidxOff */)) += (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff)), (pIter + 60 /* &.iEndofDoclist */))) + } + } +} + +// Argument p points to a buffer containing a varint to be interpreted as a +// position list size field. Read the varint and return the number of bytes +// read. Before returning, set *pnSz to the number of bytes in the position +// list, and *pbDel to true if the delete flag is set, or false otherwise. +func fts5GetPoslistSize(tls *libc.TLS, p uintptr, pnSz uintptr, pbDel uintptr) int32 { /* sqlite3.c:222617:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var nSz int32 at bp, 4 + + var n int32 = 0 + { + *(*int32)(unsafe.Pointer(bp /* nSz */)) = int32(*(*U8)(unsafe.Pointer((p) + uintptr(libc.PostIncInt32(&n, 1))))) + if (*(*int32)(unsafe.Pointer(bp /* nSz */)) & 0x80) != 0 { + n-- + n = n + (sqlite3Fts5GetVarint32(tls, ((p) + uintptr(n)), bp /* &nSz */)) + } + } + + *(*int32)(unsafe.Pointer(pnSz)) = (*(*int32)(unsafe.Pointer(bp /* nSz */)) / 2) + *(*int32)(unsafe.Pointer(pbDel)) = (*(*int32)(unsafe.Pointer(bp /* nSz */)) & 0x0001) + return n +} + +// Fts5SegIter.iLeafOffset currently points to the first byte of a +// position-list size field. Read the value of the field and store it +// in the following variables: +// +// Fts5SegIter.nPos +// Fts5SegIter.bDel +// +// Leave Fts5SegIter.iLeafOffset pointing to the first byte of the +// position list content (if any). +func fts5SegIterLoadNPos(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222638:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var iOff int32 = int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) // Offset to read at + + if (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { + var iEod int32 = func() int32 { + if ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist) < ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) { + return (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist + } + return (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + }() + (*Fts5SegIter)(unsafe.Pointer(pIter)).FbDel = U8(0) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos = 1 + if (iOff < iEod) && (int32(*(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iOff)))) == 0) { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FbDel = U8(1) + iOff++ + if (iOff < iEod) && (int32(*(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iOff)))) == 0) { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos = 1 + iOff++ + } else { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos = 0 + } + } + } else { + // var nSz int32 at bp, 4 + + { + *(*int32)(unsafe.Pointer(bp /* nSz */)) = int32(*(*U8)(unsafe.Pointer(((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp) + uintptr(libc.PostIncInt32(&iOff, 1))))) + if (*(*int32)(unsafe.Pointer(bp /* nSz */)) & 0x80) != 0 { + iOff-- + iOff = iOff + (sqlite3Fts5GetVarint32(tls, (((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp) + uintptr(iOff)), bp /* &nSz */)) + } + } + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FbDel = (U8(*(*int32)(unsafe.Pointer(bp /* nSz */)) & 0x0001)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos = (*(*int32)(unsafe.Pointer(bp /* nSz */)) >> 1) + + } + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iOff) + } +} + +func fts5SegIterLoadRowid(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222667:13: */ + var a uintptr = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp // Buffer to read data from + var iOff I64 = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset + + if iOff >= I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf) { + fts5SegIterNextPage(tls, p, pIter) + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0) { + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + return + } + iOff = int64(4) + a = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + } + iOff = iOff + (I64(sqlite3Fts5GetVarint(tls, (a + uintptr(iOff)), (pIter + 104 /* &.iRowid */)))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = iOff +} + +// Fts5SegIter.iLeafOffset currently points to the first byte of the +// "nSuffix" field of a term. Function parameter nKeep contains the value +// of the "nPrefix" field (if there was one - it is passed 0 if this is +// the first term in the segment). +// +// This function populates: +// +// Fts5SegIter.term +// Fts5SegIter.rowid +// +// accordingly and leaves (Fts5SegIter.iLeafOffset) set to the content of +// the first position list. The position list belonging to document +// (Fts5SegIter.iRowid). +func fts5SegIterLoadTerm(tls *libc.TLS, p uintptr, pIter uintptr, nKeep int32) { /* sqlite3.c:222700:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var a uintptr = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp // Buffer to read data from + var iOff I64 = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset // Offset to read at + // var nNew int32 at bp, 4 + // Bytes of new data + + iOff = iOff + (I64(sqlite3Fts5GetVarint32(tls, (a + uintptr(iOff)), bp /* &nNew */))) + if (((iOff + I64(*(*int32)(unsafe.Pointer(bp /* nNew */)))) > I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf)) || (nKeep > (*Fts5SegIter)(unsafe.Pointer(pIter)).Fterm.Fn)) || (*(*int32)(unsafe.Pointer(bp /* nNew */)) == 0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return + } + (*Fts5SegIter)(unsafe.Pointer(pIter)).Fterm.Fn = nKeep + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pIter + 88 /* &.term */), uint32(*(*int32)(unsafe.Pointer(bp /* nNew */))), (a + uintptr(iOff))) + + iOff = iOff + (I64(*(*int32)(unsafe.Pointer(bp /* nNew */)))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset = int32(iOff) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = iOff + + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff >= (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + 1) + } else { + // var nExtra int32 at bp+4, 4 + + *(*int32)(unsafe.Pointer(pIter + 56 /* &.iPgidxOff */)) += (sqlite3Fts5GetVarint32(tls, (a + uintptr((*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff)), bp+4 /* &nExtra */)) + *(*int32)(unsafe.Pointer(pIter + 60 /* &.iEndofDoclist */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nExtra */))) + } + + fts5SegIterLoadRowid(tls, p, pIter) +} + +func fts5SegIterSetNext(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222733:13: */ + if ((*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags & FTS5_SEGITER_REVERSE) != 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) + }{fts5SegIterNext_Reverse})) + } else if (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) + }{fts5SegIterNext_None})) + } else { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FxNext = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr) + }{fts5SegIterNext})) + } +} + +// Initialize the iterator object pIter to iterate through the entries in +// segment pSeg. The iterator is left pointing to the first entry when +// this function returns. +// +// If an error occurs, Fts5Index.rc is set to an appropriate error code. If +// an error has already occurred when this function is called, it is a no-op. +func fts5SegIterInit(tls *libc.TLS, p uintptr, pSeg uintptr, pIter uintptr) { /* sqlite3.c:222751:13: */ + if (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst == 0 { + // This happens if the segment is being used as an input to an incremental + // merge and all data has already been "trimmed". See function + // fts5TrimSegments() for details. In this case leave the iterator empty. + // The caller will see the (pIter->pLeaf==0) and assume the iterator is + // at EOF already. + + return + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(Fts5SegIter{}))) + fts5SegIterSetNext(tls, p, pIter) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg = pSeg + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = ((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst - 1) + fts5SegIterNextPage(tls, p, pIter) + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = int64(4) + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + 1) + fts5SegIterLoadTerm(tls, p, pIter, 0) + fts5SegIterLoadNPos(tls, p, pIter) + } +} + +// This function is only ever called on iterators created by calls to +// Fts5IndexQuery() with the FTS5INDEX_QUERY_DESC flag set. +// +// The iterator is in an unusual state when this function is called: the +// Fts5SegIter.iLeafOffset variable is set to the offset of the start of +// the position-list size field for the first relevant rowid on the page. +// Fts5SegIter.rowid is set, but nPos and bDel are not. +// +// This function advances the iterator so that it points to the last +// relevant rowid on the page and, if necessary, initializes the +// aRowidOffset[] and iRowidOffset variables. At this point the iterator +// is in its regular state - Fts5SegIter.iLeafOffset points to the first +// byte of the position list content associated with said rowid. +func fts5SegIterReverseInitPage(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222799:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail + var n int32 = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + var i int32 = int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + var a uintptr = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + var iRowidOffset int32 = 0 + + if n > (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { + n = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist + } + + for 1 != 0 { + *(*U64)(unsafe.Pointer(bp + 8 /* iDelta */)) = uint64(0) + + if eDetail == FTS5_DETAIL_NONE { + // todo + if (i < n) && (int32(*(*U8)(unsafe.Pointer(a + uintptr(i)))) == 0) { + i++ + if (i < n) && (int32(*(*U8)(unsafe.Pointer(a + uintptr(i)))) == 0) { + i++ + } + } + } else { + // var nPos int32 at bp, 4 + + // var bDummy int32 at bp+4, 4 + + i = i + (fts5GetPoslistSize(tls, (a + uintptr(i)), bp /* &nPos */, bp+4 /* &bDummy */)) + i = i + (*(*int32)(unsafe.Pointer(bp /* nPos */))) + } + if i >= n { + break + } + i = i + (int32(sqlite3Fts5GetVarint(tls, (a + uintptr(i)), bp+8 /* &iDelta */))) + *(*I64)(unsafe.Pointer(pIter + 104 /* &.iRowid */)) += I64((*(*U64)(unsafe.Pointer(bp + 8 /* iDelta */)))) + + // If necessary, grow the pIter->aRowidOffset[] array. + if iRowidOffset >= (*Fts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset { + var nNew int32 = ((*Fts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset + 8) + var aNew uintptr = Xsqlite3_realloc64(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(int32(0)))))) + if aNew == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + break + } + (*Fts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset = aNew + (*Fts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset = nNew + } + + *(*int32)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset + uintptr(libc.PostIncInt32(&iRowidOffset, 1))*4)) = int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(i) + } + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset = iRowidOffset + fts5SegIterLoadNPos(tls, p, pIter) +} + +// +func fts5SegIterReverseNewPage(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:222852:13: */ + + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno > (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno) { + var pNew uintptr + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno-- + pNew = fts5DataRead(tls, p, (((((I64((*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno)))) + if pNew != 0 { + // iTermLeafOffset may be equal to szLeaf if the term is the last + // thing on the page - i.e. the first rowid is on the following page. + // In this case leave pIter->pLeaf==0, this iterator is at EOF. + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno == (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno { + + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset < (*Fts5Data)(unsafe.Pointer(pNew)).FszLeaf { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pNew + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64((*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset) + } + } else { + var iRowidOff int32 + iRowidOff = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pNew)).Fp)) + if iRowidOff != 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pNew + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iRowidOff) + } + } + + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + var a uintptr = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset)) + *(*I64)(unsafe.Pointer(pIter + 32 /* &.iLeafOffset */)) += (I64(sqlite3Fts5GetVarint(tls, a, (pIter + 104 /* &.iRowid */)))) + break + } else { + fts5DataRelease(tls, pNew) + } + } + } + + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + 1) + fts5SegIterReverseInitPage(tls, p, pIter) + } +} + +// Return true if the iterator passed as the second argument currently +// points to a delete marker. A delete marker is an entry with a 0 byte +// position-list. +func fts5MultiIterIsEmpty(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:222904:12: */ + var pSeg uintptr = ((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+1*4)).FiFirst)*120) + return (libc.Bool32((((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0)) && ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos == 0))) +} + +// Advance iterator pIter to the next entry. +// +// This version of fts5SegIterNext() is only used by reverse iterators. +func fts5SegIterNext_Reverse(tls *libc.TLS, p uintptr, pIter uintptr, pbUnused uintptr) { /* sqlite3.c:222914:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + _ = pbUnused + + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset > 0 { + var a uintptr = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + var iOff int32 + // var iDelta U64 at bp, 8 + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset-- + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(*(*int32)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset + uintptr((*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowidOffset)*4))) + fts5SegIterLoadNPos(tls, p, pIter) + iOff = int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + if (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail != FTS5_DETAIL_NONE { + iOff = iOff + ((*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos) + } + sqlite3Fts5GetVarint(tls, (a + uintptr(iOff)), bp /* &iDelta */) + *(*I64)(unsafe.Pointer(pIter + 104 /* &.iRowid */)) -= I64((*(*U64)(unsafe.Pointer(bp /* iDelta */)))) + } else { + fts5SegIterReverseNewPage(tls, p, pIter) + } +} + +// Advance iterator pIter to the next entry. +// +// This version of fts5SegIterNext() is only used if detail=none and the +// iterator is not a reverse direction iterator. +func fts5SegIterNext_None(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr) { /* sqlite3.c:222948:13: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + var iOff int32 + // Next entry is on the current page + // var iDelta I64 at bp, 8 + + // var nKeep int32 at bp+8, 4 + + // var pList uintptr at bp+24, 8 + + // var zTerm uintptr at bp+16, 8 + + // var nList int32 at bp+32, 4 + + iOff = int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + + // Next entry is on the next page + if !(((*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg != 0) && (iOff >= (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf)) { + goto __1 + } + fts5SegIterNextPage(tls, p, pIter) + if !(((*Fts5Index)(unsafe.Pointer(p)).Frc != 0) || ((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0))) { + goto __2 + } + return +__2: + ; + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowid = int64(0) + iOff = 4 +__1: + ; + + if !(iOff < (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist) { + goto __3 + } + iOff = iOff + (int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iOff)), bp /* &iDelta */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iOff) + *(*I64)(unsafe.Pointer(pIter + 104 /* &.iRowid */)) += (*(*I64)(unsafe.Pointer(bp /* iDelta */))) + goto __4 +__3: + if !(((*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags & FTS5_SEGITER_ONETERM) == 0) { + goto __5 + } + if !((*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg != 0) { + goto __7 + } + *(*int32)(unsafe.Pointer(bp + 8 /* nKeep */)) = 0 + if !(iOff != fts5LeafFirstTermOff(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)) { + goto __9 + } + iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iOff)), bp+8 /* &nKeep */)) +__9: + ; + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iOff) + fts5SegIterLoadTerm(tls, p, pIter, *(*int32)(unsafe.Pointer(bp + 8 /* nKeep */))) + goto __8 +__7: + *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zTerm */)) = uintptr(0) + sqlite3Fts5HashScanNext(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash) + sqlite3Fts5HashScanEntry(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash, bp+16 /* &zTerm */, bp+24 /* &pList */, bp+32 /* &nList */) + if !(*(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)) == uintptr(0)) { + goto __10 + } + goto next_none_eof +__10: + ; + (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp = *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)) + (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn = *(*int32)(unsafe.Pointer(bp + 32 /* nList */)) + (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf = *(*int32)(unsafe.Pointer(bp + 32 /* nList */)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = *(*int32)(unsafe.Pointer(bp + 32 /* nList */)) + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), (pIter + 88 /* &.term */), int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zTerm */)))), *(*uintptr)(unsafe.Pointer(bp + 16 /* zTerm */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(sqlite3Fts5GetVarint(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)), (pIter + 104 /* &.iRowid */))) +__8: + ; + + if !(pbNewTerm != 0) { + goto __11 + } + *(*int32)(unsafe.Pointer(pbNewTerm)) = 1 +__11: + ; + goto __6 +__5: + goto next_none_eof +__6: + ; +__4: + ; + + fts5SegIterLoadNPos(tls, p, pIter) + + return +next_none_eof: + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) +} + +// Advance iterator pIter to the next entry. +// +// If an error occurs, Fts5Index.rc is set to an appropriate error code. It +// is not considered an error if the iterator reaches EOF. If an error has +// already occurred when this function is called, it is a no-op. +func fts5SegIterNext(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr) { /* sqlite3.c:223020:13: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + var pLeaf uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf + // var iOff int32 at bp+36, 4 + + var bNewTerm int32 = 0 + *(*int32)(unsafe.Pointer(bp /* nKeep */)) = 0 + var a uintptr + var n int32 + + // Search for the end of the position list within the current page. + a = (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + n = (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + + *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) = (int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset + I64((*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos))) + + if *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) < n { + // The next entry is on the current page. + + if *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) >= (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist { + bNewTerm = 1 + if *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) != fts5LeafFirstTermOff(tls, pLeaf) { + *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) += sqlite3Fts5GetVarint32(tls, (a + uintptr(*(*int32)(unsafe.Pointer(bp + 36 /* iOff */)))), bp /* &nKeep */) + } + } else { + // var iDelta U64 at bp+8, 8 + + *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) += int32(sqlite3Fts5GetVarint(tls, (a + uintptr(*(*int32)(unsafe.Pointer(bp + 36 /* iOff */)))), bp+8 /* &iDelta */)) + *(*I64)(unsafe.Pointer(pIter + 104 /* &.iRowid */)) += I64((*(*U64)(unsafe.Pointer(bp + 8 /* iDelta */)))) + + } + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(*(*int32)(unsafe.Pointer(bp + 36 /* iOff */))) + + } else if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zTerm */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32 /* nList */)) = 0 + + if 0 == ((*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags & FTS5_SEGITER_ONETERM) { + sqlite3Fts5HashScanNext(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash) + sqlite3Fts5HashScanEntry(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash, bp+16 /* &zTerm */, bp+24 /* &pList */, bp+32 /* &nList */) + } + if *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)) == uintptr(0) { + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + } else { + (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp = *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)) + (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn = *(*int32)(unsafe.Pointer(bp + 32 /* nList */)) + (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf = *(*int32)(unsafe.Pointer(bp + 32 /* nList */)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*(*int32)(unsafe.Pointer(bp + 32 /* nList */)) + 1) + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), (pIter + 88 /* &.term */), int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zTerm */)))), + *(*uintptr)(unsafe.Pointer(bp + 16 /* zTerm */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(sqlite3Fts5GetVarint(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pList */)), (pIter + 104 /* &.iRowid */))) + *(*int32)(unsafe.Pointer(pbNewTerm)) = 1 + } + } else { + *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) = 0 + // Next entry is not on the current page + for *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) == 0 { + fts5SegIterNextPage(tls, p, pIter) + pLeaf = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf + if pLeaf == uintptr(0) { + break + } + + if (libc.AssignPtrInt32(bp+36 /* iOff */, int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp))) != 0) && (*(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) < (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) += int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(*(*int32)(unsafe.Pointer(bp + 36 /* iOff */)))), (pIter + 104 /* &.iRowid */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(*(*int32)(unsafe.Pointer(bp + 36 /* iOff */))) + + if (*Fts5Data)(unsafe.Pointer(pLeaf)).Fnn > (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = ((*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr((*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf)), (pIter+60 /* &.iEndofDoclist */))) + } + } else if (*Fts5Data)(unsafe.Pointer(pLeaf)).Fnn > (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = ((*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp+uintptr((*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf)), bp+36 /* &iOff */)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(*(*int32)(unsafe.Pointer(bp + 36 /* iOff */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) + bNewTerm = 1 + } + + if *(*int32)(unsafe.Pointer(bp + 36 /* iOff */)) > (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return + } + } + } + + // Check if the iterator is now at EOF. If so, return early. + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + if bNewTerm != 0 { + if ((*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags & FTS5_SEGITER_ONETERM) != 0 { + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + } else { + fts5SegIterLoadTerm(tls, p, pIter, *(*int32)(unsafe.Pointer(bp /* nKeep */))) + fts5SegIterLoadNPos(tls, p, pIter) + if pbNewTerm != 0 { + *(*int32)(unsafe.Pointer(pbNewTerm)) = 1 + } + } + } else { + // The following could be done by calling fts5SegIterLoadNPos(). But + // this block is particularly performance critical, so equivalent + // code is inlined. + // var nSz int32 at bp+40, 4 + + { + *(*int32)(unsafe.Pointer(bp + 40 /* nSz */)) = int32(*(*U8)(unsafe.Pointer(((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp) + uintptr(libc.PostIncInt64(&(*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset, 1))))) + if (*(*int32)(unsafe.Pointer(bp + 40 /* nSz */)) & 0x80) != 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset-- + *(*I64)(unsafe.Pointer(pIter + 32 /* &.iLeafOffset */)) += (I64(sqlite3Fts5GetVarint32(tls, (((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp) + uintptr((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset)), bp+40 /* &nSz */))) + } + } + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FbDel = (U8(*(*int32)(unsafe.Pointer(bp + 40 /* nSz */)) & 0x0001)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FnPos = (*(*int32)(unsafe.Pointer(bp + 40 /* nSz */)) >> 1) + + } + } +} + +// Iterator pIter currently points to the first rowid in a doclist. This +// function sets the iterator up so that iterates in reverse order through +// the doclist. +func fts5SegIterReverse(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:223151:13: */ + var pDlidx uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpDlidx + var pLast uintptr = uintptr(0) + var pgnoLast int32 = 0 + + if pDlidx != 0 { + var iSegid int32 = (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid + pgnoLast = fts5DlidxIterPgno(tls, pDlidx) + pLast = fts5DataRead(tls, p, (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(pgnoLast)))) + } else { + var pLeaf uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf // Current leaf data + + // Currently, Fts5SegIter.iLeafOffset points to the first byte of + // position-list content for the current rowid. Back it up so that it + // points to the start of the position-list size field. + var iPoslist int32 + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno == (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { + iPoslist = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset + } else { + iPoslist = 4 + } + { + var iEnd int32 = (iPoslist + 9) + for ((int32(*(*U8)(unsafe.Pointer((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(libc.PostIncInt32(&iPoslist, 1))))) & 0x80) != 0) && (iPoslist < iEnd) { + } + } + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iPoslist) + + // If this condition is true then the largest rowid for the current + // term may not be stored on the current page. So search forward to + // see where said rowid really is. + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist >= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + var pgno int32 + var pSeg uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg + + // The last rowid in the doclist may not be on the current page. Search + // forward to find the page containing the last rowid. + for pgno = ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno + 1); !((*Fts5Index)(unsafe.Pointer(p)).Frc != 0) && (pgno <= (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast); pgno++ { + var iAbs I64 = (((((I64((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(pgno))) + var pNew uintptr = fts5DataRead(tls, p, iAbs) + if pNew != 0 { + var iRowid int32 + var bTermless int32 + iRowid = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pNew)).Fp)) + bTermless = (libc.Bool32((*Fts5Data)(unsafe.Pointer((pNew))).FszLeaf >= (*Fts5Data)(unsafe.Pointer((pNew))).Fnn)) + if iRowid != 0 { + { + var tmp uintptr + tmp = pNew + pNew = pLast + pLast = tmp + } + + pgnoLast = pgno + } + fts5DataRelease(tls, pNew) + if bTermless == 0 { + break + } + } + } + } + } + + // If pLast is NULL at this point, then the last rowid for this doclist + // lies on the page currently indicated by the iterator. In this case + // pIter->iLeafOffset is already set to point to the position-list size + // field associated with the first relevant rowid on the page. + // + // Or, if pLast is non-NULL, then it is the page that contains the last + // rowid. In this case configure the iterator so that it points to the + // first rowid on this page. + if pLast != 0 { + var iOff int32 + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pLast + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = pgnoLast + iOff = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLast)).Fp)) + iOff = iOff + (int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pLast)).Fp + uintptr(iOff)), (pIter + 104 /* &.iRowid */)))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iOff) + + if (*Fts5Data)(unsafe.Pointer((pLast))).FszLeaf >= (*Fts5Data)(unsafe.Pointer((pLast))).Fnn { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = ((*Fts5Data)(unsafe.Pointer(pLast)).Fnn + 1) + } else { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = fts5LeafFirstTermOff(tls, pLast) + } + + } + + fts5SegIterReverseInitPage(tls, p, pIter) +} + +// Iterator pIter currently points to the first rowid of a doclist. +// There is a doclist-index associated with the final term on the current +// page. If the current term is the last term on the page, load the +// doclist-index from disk and initialize an iterator at (pIter->pDlidx). +func fts5SegIterLoadDlidx(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:223237:13: */ + var iSeg int32 = (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FiSegid + var bRev int32 = ((*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags & FTS5_SEGITER_REVERSE) + var pLeaf uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf // Current leaf data + + // Check if the current doclist ends on this page. If it does, return + // early without loading the doclist-index (as it belongs to a different + // term. + if ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno == (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno) && + ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist < (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + return + } + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpDlidx = fts5DlidxIterInit(tls, p, bRev, iSeg, (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno) +} + +// The iterator object passed as the second argument currently contains +// no valid values except for the Fts5SegIter.pLeaf member variable. This +// function searches the leaf page for a term matching (pTerm/nTerm). +// +// If the specified term is found on the page, then the iterator is left +// pointing to it. If argument bGe is zero and the term is not found, +// the iterator is left pointing at EOF. +// +// If bGe is non-zero and the specified term is not found, then the +// iterator is left pointing to the smallest term in the segment that +// is larger than the specified term, even if this term is not on the +// current page. +func fts5LeafSeek(tls *libc.TLS, p uintptr, bGe int32, pIter uintptr, pTerm uintptr, nTerm int32) { /* sqlite3.c:223271:13: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + // var iOff int32 at bp+12, 4 + + var a uintptr + var szLeaf int32 + var n int32 + var nMatch U32 + // var nKeep U32 at bp+8, 4 + + // var nNew U32 at bp+4, 4 + + // var iTermOff U32 at bp, 4 + + var iPgidx int32 // Current offset in pgidx + var bEndOfPage int32 + var nCmp U32 + var i U32 + // var nExtra int32 at bp+16, 4 + a = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + szLeaf = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + n = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + nMatch = U32(0) + *(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) = U32(0) + *(*U32)(unsafe.Pointer(bp + 4 /* nNew */)) = U32(0) + bEndOfPage = 0 + + iPgidx = szLeaf + iPgidx = iPgidx + (sqlite3Fts5GetVarint32(tls, (a + uintptr(iPgidx)), bp /* &iTermOff */)) + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) = int32(*(*U32)(unsafe.Pointer(bp /* iTermOff */))) + if !(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) > n) { + goto __1 + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + /* Figure out how many new bytes are in this term */ + *(*U32)(unsafe.Pointer(bp + 4 /* nNew */)) = U32(*(*U8)(unsafe.Pointer((a) + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)), 1))))) + if !((*(*U32)(unsafe.Pointer(bp + 4 /* nNew */)) & U32(0x80)) != 0) { + goto __4 + } + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */))-- + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) += sqlite3Fts5GetVarint32(tls, ((a) + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)))), bp+4 /* &nNew */) +__4: + ; + + if !(*(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) < nMatch) { + goto __5 + } + goto search_failed +__5: + ; + + if !(*(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) == nMatch) { + goto __6 + } + nCmp = func() uint32 { + if (*(*U32)(unsafe.Pointer(bp + 4 /* nNew */))) < (U32(nTerm) - nMatch) { + return *(*U32)(unsafe.Pointer(bp + 4 /* nNew */)) + } + return (U32(nTerm) - nMatch) + }() + i = U32(0) +__7: + if !(i < nCmp) { + goto __9 + } + if !(int32(*(*U8)(unsafe.Pointer(a + uintptr((U32(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))) + i))))) != int32(*(*U8)(unsafe.Pointer(pTerm + uintptr((nMatch + i)))))) { + goto __10 + } + goto __9 +__10: + ; + goto __8 +__8: + i++ + goto __7 + goto __9 +__9: + ; + nMatch = nMatch + (i) + + if !(U32(nTerm) == nMatch) { + goto __11 + } + if !(i == *(*U32)(unsafe.Pointer(bp + 4 /* nNew */))) { + goto __13 + } + goto search_success + goto __14 +__13: + goto search_failed +__14: + ; + goto __12 +__11: + if !((i < *(*U32)(unsafe.Pointer(bp + 4 /* nNew */))) && (int32(*(*U8)(unsafe.Pointer(a + uintptr((U32(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))) + i))))) > int32(*(*U8)(unsafe.Pointer(pTerm + uintptr(nMatch)))))) { + goto __15 + } + goto search_failed +__15: + ; +__12: + ; +__6: + ; + + if !(iPgidx >= n) { + goto __16 + } + bEndOfPage = 1 + goto __3 +__16: + ; + + iPgidx = iPgidx + (sqlite3Fts5GetVarint32(tls, (a + uintptr(iPgidx)), bp+8 /* &nKeep */)) + *(*U32)(unsafe.Pointer(bp /* iTermOff */)) += *(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) = int32(*(*U32)(unsafe.Pointer(bp /* iTermOff */))) + + if !(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) >= n) { + goto __17 + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return +__17: + ; + + /* Read the nKeep field of the next term. */ + *(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) = U32(*(*U8)(unsafe.Pointer((a) + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)), 1))))) + if !((*(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) & U32(0x80)) != 0) { + goto __18 + } + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */))-- + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) += sqlite3Fts5GetVarint32(tls, ((a) + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)))), bp+8 /* &nKeep */) +__18: + ; + + goto __2 +__3: + ; + +search_failed: + if !(bGe == 0) { + goto __19 + } + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = uintptr(0) + return + goto __20 +__19: + if !(bEndOfPage != 0) { + goto __21 + } +__22: + fts5SegIterNextPage(tls, p, pIter) + if !((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0)) { + goto __25 + } + return +__25: + ; + a = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + if !((libc.Bool32((*Fts5Data)(unsafe.Pointer(((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf))).FszLeaf >= (*Fts5Data)(unsafe.Pointer(((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf))).Fnn)) == 0) { + goto __26 + } + iPgidx = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + iPgidx = iPgidx + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + uintptr(iPgidx)), bp+12 /* &iOff */)) + if !((*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) < 4) || (*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) >= (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf)) { + goto __27 + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return + goto __28 +__27: + *(*U32)(unsafe.Pointer(bp + 8 /* nKeep */)) = U32(0) + *(*U32)(unsafe.Pointer(bp /* iTermOff */)) = U32(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))) + n = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + *(*int32)(unsafe.Pointer(bp + 12 /* iOff */)) += sqlite3Fts5GetVarint32(tls, (a + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */)))), bp+4 /* &nNew */) + goto __24 +__28: + ; +__26: + ; + goto __23 +__23: + if 1 != 0 { + goto __22 + } + goto __24 +__24: + ; +__21: + ; +__20: + ; + +search_success: + if !(((I64(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))) + I64(*(*U32)(unsafe.Pointer(bp + 4 /* nNew */)))) > I64(n)) || (*(*U32)(unsafe.Pointer(bp + 4 /* nNew */)) < U32(1))) { + goto __29 + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return +__29: + ; + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = (I64(U32(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))) + *(*U32)(unsafe.Pointer(bp + 4 /* nNew */)))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafOffset = int32((*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiTermLeafPgno = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno + + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), (pIter + 88 /* &.term */), int32(*(*U32)(unsafe.Pointer(bp + 8 /* nKeep */))), pTerm) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pIter + 88 /* &.term */), *(*U32)(unsafe.Pointer(bp + 4 /* nNew */)), (a + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* iOff */))))) + + if !(iPgidx >= n) { + goto __30 + } + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fnn + 1) + goto __31 +__30: + iPgidx = iPgidx + (sqlite3Fts5GetVarint32(tls, (a + uintptr(iPgidx)), bp+16 /* &nExtra */)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (int32(*(*U32)(unsafe.Pointer(bp /* iTermOff */)) + U32(*(*int32)(unsafe.Pointer(bp + 16 /* nExtra */))))) +__31: + ; + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiPgidxOff = iPgidx + + fts5SegIterLoadRowid(tls, p, pIter) + fts5SegIterLoadNPos(tls, p, pIter) +} + +func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:21: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect == uintptr(0) { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + fts5IndexPrepareStmt(tls, p, (p + 96 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, + + ts+33195, /* "SELECT pgno FROM..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) + } + return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect +} + +// Initialize the object pIter to point to term pTerm/nTerm within segment +// pSeg. If there is no such term in the index, the iterator is set to EOF. +// +// If an error occurs, Fts5Index.rc is set to an appropriate error code. If +// an error has already occurred when this function is called, it is a no-op. +func fts5SegIterSeekInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32, flags int32, pSeg uintptr, pIter uintptr) { /* sqlite3.c:223417:13: */ + var iPg int32 = 1 + var bGe int32 = (flags & FTS5INDEX_QUERY_SCAN) + var bDlidx int32 = 0 // True if there is a doclist-index + var pIdxSelect uintptr = uintptr(0) + + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(Fts5SegIter{}))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg = pSeg + + // This block sets stack variable iPg to the leaf page number that may + // contain term (pTerm/nTerm), if it is present in the segment. + pIdxSelect = fts5IdxSelectStmt(tls, p) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + Xsqlite3_bind_int(tls, pIdxSelect, 1, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid) + Xsqlite3_bind_blob(tls, pIdxSelect, 2, pTerm, nTerm, uintptr(0)) + if SQLITE_ROW == Xsqlite3_step(tls, pIdxSelect) { + var val I64 = I64(Xsqlite3_column_int(tls, pIdxSelect, 0)) + iPg = (int32(val >> 1)) + bDlidx = (int32(val & int64(0x0001))) + } + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, pIdxSelect) + Xsqlite3_bind_null(tls, pIdxSelect, 2) + + if iPg < (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst { + iPg = (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst + bDlidx = 0 + } + + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = (iPg - 1) + fts5SegIterNextPage(tls, p, pIter) + + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + fts5LeafSeek(tls, p, bGe, pIter, pTerm, nTerm) + } + + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bGe == 0) { + *(*int32)(unsafe.Pointer(pIter + 8 /* &.flags */)) |= (FTS5_SEGITER_ONETERM) + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf != 0 { + if (flags & FTS5INDEX_QUERY_DESC) != 0 { + *(*int32)(unsafe.Pointer(pIter + 8 /* &.flags */)) |= (FTS5_SEGITER_REVERSE) + } + if bDlidx != 0 { + fts5SegIterLoadDlidx(tls, p, pIter) + } + if (flags & FTS5INDEX_QUERY_DESC) != 0 { + fts5SegIterReverse(tls, p, pIter) + } + } + } + + fts5SegIterSetNext(tls, p, pIter) + + // Either: + // + // 1) an error has occurred, or + // 2) the iterator points to EOF, or + // 3) the iterator points to an entry with term (pTerm/nTerm), or + // 4) the FTS5INDEX_QUERY_SCAN flag was set and the iterator points + // to an entry with a term greater than or equal to (pTerm/nTerm). + +} + +// Initialize the object pIter to point to term pTerm/nTerm within the +// in-memory hash table. If there is no such term in the hash-table, the +// iterator is set to EOF. +// +// If an error occurs, Fts5Index.rc is set to an appropriate error code. If +// an error has already occurred when this function is called, it is a no-op. +func fts5SegIterHashInit(tls *libc.TLS, p uintptr, pTerm uintptr, nTerm int32, flags int32, pIter uintptr) { /* sqlite3.c:223500:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + *(*int32)(unsafe.Pointer(bp + 16 /* nList */)) = 0 + *(*uintptr)(unsafe.Pointer(bp /* z */)) = uintptr(0) + var n int32 = 0 + *(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) = uintptr(0) + + if (pTerm == uintptr(0)) || ((flags & FTS5INDEX_QUERY_SCAN) != 0) { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pList */)) = uintptr(0) + + (*Fts5Index)(unsafe.Pointer(p)).Frc = sqlite3Fts5HashScanInit(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash, pTerm, nTerm) + sqlite3Fts5HashScanEntry(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash, bp /* &z */, bp+8 /* &pList */, bp+16 /* &nList */) + n = func() int32 { + if *(*uintptr)(unsafe.Pointer(bp /* z */)) != 0 { + return int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp /* z */)))) + } + return 0 + }() + if *(*uintptr)(unsafe.Pointer(bp + 8 /* pList */)) != 0 { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) = fts5IdxMalloc(tls, p, int64(unsafe.Sizeof(Fts5Data{}))) + if *(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) != 0 { + (*Fts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)))).Fp = *(*uintptr)(unsafe.Pointer(bp + 8 /* pList */)) + } + } + } else { + (*Fts5Index)(unsafe.Pointer(p)).Frc = sqlite3Fts5HashQuery(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash, int32(unsafe.Sizeof(Fts5Data{})), + pTerm, nTerm, bp+24 /* &pLeaf */, bp+16 /* &nList */) + if *(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) != 0 { + (*Fts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)))).Fp = (*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) + 1*16) + } + *(*uintptr)(unsafe.Pointer(bp /* z */)) = pTerm + n = nTerm + *(*int32)(unsafe.Pointer(pIter + 8 /* &.flags */)) |= (FTS5_SEGITER_ONETERM) + } + + if *(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) != 0 { + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), (pIter + 88 /* &.term */), n, *(*uintptr)(unsafe.Pointer(bp /* z */))) + (*Fts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)))).Fnn = libc.AssignPtrInt32(*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */))+12 /* &.szLeaf */, *(*int32)(unsafe.Pointer(bp + 16 /* nList */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = *(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(sqlite3Fts5GetVarint(tls, (*Fts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)))).Fp, (pIter + 104 /* &.iRowid */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*Fts5Data)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pLeaf */)))).Fnn + + if (flags & FTS5INDEX_QUERY_DESC) != 0 { + *(*int32)(unsafe.Pointer(pIter + 8 /* &.flags */)) |= (FTS5_SEGITER_REVERSE) + fts5SegIterReverseInitPage(tls, p, pIter) + } else { + fts5SegIterLoadNPos(tls, p, pIter) + } + } + + fts5SegIterSetNext(tls, p, pIter) +} + +// Zero the iterator passed as the only argument. +func fts5SegIterClear(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:223559:13: */ + sqlite3Fts5BufferFree(tls, (pIter + 88 /* &.term */)) + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf) + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf) + fts5DlidxIterFree(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpDlidx) + Xsqlite3_free(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset) + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(Fts5SegIter{}))) +} + +// Do the comparison necessary to populate pIter->aFirst[iOut]. +// +// If the returned value is non-zero, then it is the index of an entry +// in the pIter->aSeg[] array that is (a) not at EOF, and (b) pointing +// to a key that is a duplicate of another, higher priority, +// segment-iterator in the pSeg->aSeg[] array. +func fts5MultiIterDoCompare(tls *libc.TLS, pIter uintptr, iOut int32) int32 { /* sqlite3.c:223663:12: */ + var i1 int32 // Index of left-hand Fts5SegIter + var i2 int32 // Index of right-hand Fts5SegIter + var iRes int32 + var p1 uintptr // Left-hand Fts5SegIter + var p2 uintptr // Right-hand Fts5SegIter + var pRes uintptr = ((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(iOut)*4) + + if iOut >= ((*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg / 2) { + i1 = ((iOut - ((*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg / 2)) * 2) + i2 = (i1 + 1) + } else { + i1 = int32((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr((iOut*2))*4)).FiFirst) + i2 = int32((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(((iOut*2)+1))*4)).FiFirst) + } + p1 = ((pIter + 96 /* &.aSeg */) + uintptr(i1)*120) + p2 = ((pIter + 96 /* &.aSeg */) + uintptr(i2)*120) + + (*Fts5CResult)(unsafe.Pointer(pRes)).FbTermEq = U8(0) + if (*Fts5SegIter)(unsafe.Pointer(p1)).FpLeaf == uintptr(0) { // If p1 is at EOF + iRes = i2 + } else if (*Fts5SegIter)(unsafe.Pointer(p2)).FpLeaf == uintptr(0) { // If p2 is at EOF + iRes = i1 + } else { + var res int32 = fts5BufferCompare(tls, (p1 + 88 /* &.term */), (p2 + 88 /* &.term */)) + if res == 0 { + + (*Fts5CResult)(unsafe.Pointer(pRes)).FbTermEq = U8(1) + if (*Fts5SegIter)(unsafe.Pointer(p1)).FiRowid == (*Fts5SegIter)(unsafe.Pointer(p2)).FiRowid { + (*Fts5SegIter)(unsafe.Pointer(p1)).FbDel = (*Fts5SegIter)(unsafe.Pointer(p2)).FbDel + return i2 + } + if (libc.Bool32((*Fts5SegIter)(unsafe.Pointer(p1)).FiRowid > (*Fts5SegIter)(unsafe.Pointer(p2)).FiRowid)) == (*Fts5Iter)(unsafe.Pointer(pIter)).FbRev { + res = -1 + } else { + res = +1 + } + } + + if res < 0 { + iRes = i1 + } else { + iRes = i2 + } + } + + (*Fts5CResult)(unsafe.Pointer(pRes)).FiFirst = U16(iRes) + return 0 +} + +// Move the seg-iter so that it points to the first rowid on page iLeafPgno. +// It is an error if leaf iLeafPgno does not exist or contains no rowids. +func fts5SegIterGotoPage(tls *libc.TLS, p uintptr, pIter uintptr, iLeafPgno int32) { /* sqlite3.c:223717:13: */ + + if iLeafPgno > (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpSeg)).FpgnoLast { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpNextLeaf = uintptr(0) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = (iLeafPgno - 1) + fts5SegIterNextPage(tls, p, pIter) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var iOff int32 + var a uintptr = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp + var n int32 = (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).FszLeaf + + iOff = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf)).Fp)) + if (iOff < 4) || (iOff >= n) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + iOff = iOff + (int32(sqlite3Fts5GetVarint(tls, (a + uintptr(iOff)), (pIter + 104 /* &.iRowid */)))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(iOff) + fts5SegIterLoadNPos(tls, p, pIter) + } + } + } +} + +// Advance the iterator passed as the second argument until it is at or +// past rowid iFrom. Regardless of the value of iFrom, the iterator is +// always advanced at least once. +func fts5SegIterNextFrom(tls *libc.TLS, p uintptr, pIter uintptr, iMatch I64) { /* sqlite3.c:223755:13: */ + var bRev int32 = ((*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags & FTS5_SEGITER_REVERSE) + var pDlidx uintptr = (*Fts5SegIter)(unsafe.Pointer(pIter)).FpDlidx + var iLeafPgno int32 = (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno + var bMove int32 = 1 + + if bRev == 0 { + for !(fts5DlidxIterEof(tls, p, pDlidx) != 0) && (iMatch > fts5DlidxIterRowid(tls, pDlidx)) { + iLeafPgno = fts5DlidxIterPgno(tls, pDlidx) + fts5DlidxIterNext(tls, p, pDlidx) + } + + if iLeafPgno > (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { + fts5SegIterGotoPage(tls, p, pIter, iLeafPgno) + bMove = 0 + } + } else { + + for !(fts5DlidxIterEof(tls, p, pDlidx) != 0) && (iMatch < fts5DlidxIterRowid(tls, pDlidx)) { + fts5DlidxIterPrev(tls, p, pDlidx) + } + iLeafPgno = fts5DlidxIterPgno(tls, pDlidx) + + if iLeafPgno < (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafPgno = (iLeafPgno + 1) + fts5SegIterReverseNewPage(tls, p, pIter) + bMove = 0 + } + } + + for ok := true; ok; ok = ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + if (bMove != 0) && ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pIter + 40 /* &.xNext */))))(tls, p, pIter, uintptr(0)) + } + if (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf == uintptr(0) { + break + } + if (bRev == 0) && ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowid >= iMatch) { + break + } + if (bRev != 0) && ((*Fts5SegIter)(unsafe.Pointer(pIter)).FiRowid <= iMatch) { + break + } + bMove = 1 + } +} + +// Free the iterator object passed as the second argument. +func fts5MultiIterFree(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:223809:13: */ + if pIter != 0 { + var i int32 + for i = 0; i < (*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg; i++ { + fts5SegIterClear(tls, ((pIter + 96 /* &.aSeg */) + uintptr(i)*120)) + } + sqlite3Fts5BufferFree(tls, (pIter + 32 /* &.poslist */)) + Xsqlite3_free(tls, pIter) + } +} + +func fts5MultiIterAdvanced(tls *libc.TLS, p uintptr, pIter uintptr, iChanged int32, iMinset int32) { /* sqlite3.c:223820:13: */ + var i int32 + for i = (((*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg + iChanged) / 2); (i >= iMinset) && ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK); i = (i / 2) { + var iEq int32 + if libc.AssignInt32(&iEq, fts5MultiIterDoCompare(tls, pIter, i)) != 0 { + var pSeg uintptr = ((pIter + 96 /* &.aSeg */) + uintptr(iEq)*120) + + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pSeg + 40 /* &.xNext */))))(tls, p, pSeg, uintptr(0)) + i = ((*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg + iEq) + } + } +} + +// Sub-iterator iChanged of iterator pIter has just been advanced. It still +// points to the same term though - just a different rowid. This function +// attempts to update the contents of the pIter->aFirst[] accordingly. +// If it does so successfully, 0 is returned. Otherwise 1. +// +// If non-zero is returned, the caller should call fts5MultiIterAdvanced() +// on the iterator instead. That function does the same as this one, except +// that it deals with more complicated cases as well. +func fts5MultiIterAdvanceRowid(tls *libc.TLS, pIter uintptr, iChanged int32, ppFirst uintptr) int32 { /* sqlite3.c:223848:12: */ + var pNew uintptr = ((pIter + 96 /* &.aSeg */) + uintptr(iChanged)*120) + + if ((*Fts5SegIter)(unsafe.Pointer(pNew)).FiRowid == (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid) || + ((libc.Bool32((*Fts5SegIter)(unsafe.Pointer(pNew)).FiRowid < (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid)) == (*Fts5Iter)(unsafe.Pointer(pIter)).FbRev) { + var i int32 + var pOther uintptr = ((pIter + 96 /* &.aSeg */) + uintptr((iChanged^0x0001))*120) + (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = func() int64 { + if (*Fts5Iter)(unsafe.Pointer(pIter)).FbRev != 0 { + return ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + } + return (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) + }() + for i = (((*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg + iChanged) / 2); 1 != 0; i = (i / 2) { + var pRes uintptr = ((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst + uintptr(i)*4) + + if (*Fts5CResult)(unsafe.Pointer(pRes)).FbTermEq != 0 { + if (*Fts5SegIter)(unsafe.Pointer(pNew)).FiRowid == (*Fts5SegIter)(unsafe.Pointer(pOther)).FiRowid { + return 1 + } else if (libc.Bool32((*Fts5SegIter)(unsafe.Pointer(pOther)).FiRowid > (*Fts5SegIter)(unsafe.Pointer(pNew)).FiRowid)) == (*Fts5Iter)(unsafe.Pointer(pIter)).FbRev { + (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = (*Fts5SegIter)(unsafe.Pointer(pOther)).FiRowid + pNew = pOther + } else if (libc.Bool32((*Fts5SegIter)(unsafe.Pointer(pOther)).FiRowid > (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid)) == (*Fts5Iter)(unsafe.Pointer(pIter)).FbRev { + (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = (*Fts5SegIter)(unsafe.Pointer(pOther)).FiRowid + } + } + (*Fts5CResult)(unsafe.Pointer(pRes)).FiFirst = (U16(int64((pNew - (pIter + 96 /* &.aSeg */)) / 120))) + if i == 1 { + break + } + + pOther = ((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+uintptr((i^0x0001))*4)).FiFirst)*120) + } + } + + *(*uintptr)(unsafe.Pointer(ppFirst)) = pNew + return 0 +} + +// Set the pIter->bEof variable based on the state of the sub-iterators. +func fts5MultiIterSetEof(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:223891:13: */ + var pSeg uintptr = ((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+1*4)).FiFirst)*120) + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof = (U8(libc.Bool32((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf == uintptr(0)))) + (*Fts5Iter)(unsafe.Pointer(pIter)).FiSwitchRowid = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiRowid +} + +// Move the iterator to the next entry. +// +// If an error occurs, an error code is left in Fts5Index.rc. It is not +// considered an error if the iterator reaches EOF, or if it is already at +// EOF when this function is called. +func fts5MultiIterNext(tls *libc.TLS, p uintptr, pIter uintptr, bFrom int32, iFrom I64) { /* sqlite3.c:223904:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var bUseFrom int32 = bFrom + + for (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var iFirst int32 = int32((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4)).FiFirst) + *(*int32)(unsafe.Pointer(bp /* bNewTerm */)) = 0 + *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)) = ((pIter + 96 /* &.aSeg */) + uintptr(iFirst)*120) + + if (bUseFrom != 0) && ((*Fts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)))).FpDlidx != 0) { + fts5SegIterNextFrom(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)), iFrom) + } else { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)) + 40 /* &.xNext */))))(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)), bp /* &bNewTerm */) + } + + if (((*Fts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)))).FpLeaf == uintptr(0)) || (*(*int32)(unsafe.Pointer(bp /* bNewTerm */)) != 0)) || + (fts5MultiIterAdvanceRowid(tls, pIter, iFirst, bp+8 /* &pSeg */) != 0) { + fts5MultiIterAdvanced(tls, p, pIter, iFirst, 1) + fts5MultiIterSetEof(tls, pIter) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)) = ((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+1*4)).FiFirst)*120) + if (*Fts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)))).FpLeaf == uintptr(0) { + return + } + } + + if (int32((*Fts5Iter)(unsafe.Pointer(pIter)).FbSkipEmpty) == 0) || ((*Fts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)))).FnPos != 0) { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pIter + 56 /* &.xSetOutputs */))))(tls, pIter, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */))) + return + } + bUseFrom = 0 + } +} + +func fts5MultiIterNext2(tls *libc.TLS, p uintptr, pIter uintptr, pbNewTerm uintptr) { /* sqlite3.c:223942:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + *(*int32)(unsafe.Pointer(pbNewTerm)) = 0 + for ok := true; ok; ok = fts5MultiIterIsEmpty(tls, p, pIter) != 0 { + var iFirst int32 = int32((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst + 1*4)).FiFirst) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)) = ((pIter + 96 /* &.aSeg */) + uintptr(iFirst)*120) + *(*int32)(unsafe.Pointer(bp /* bNewTerm */)) = 0 + + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)) + 40 /* &.xNext */))))(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)), bp /* &bNewTerm */) + if (((*Fts5SegIter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pSeg */)))).FpLeaf == uintptr(0)) || (*(*int32)(unsafe.Pointer(bp /* bNewTerm */)) != 0)) || + (fts5MultiIterAdvanceRowid(tls, pIter, iFirst, bp+8 /* &pSeg */) != 0) { + fts5MultiIterAdvanced(tls, p, pIter, iFirst, 1) + fts5MultiIterSetEof(tls, pIter) + *(*int32)(unsafe.Pointer(pbNewTerm)) = 1 + } + + } + } +} + +func fts5IterSetOutputs_Noop(tls *libc.TLS, pUnused1 uintptr, pUnused2 uintptr) { /* sqlite3.c:223970:13: */ + _ = pUnused1 + _ = pUnused2 +} + +func fts5MultiIterAlloc(tls *libc.TLS, p uintptr, nSeg int32) uintptr { /* sqlite3.c:223974:17: */ + var pNew uintptr + var nSlot int32 // Power of two >= nSeg + + for nSlot = 2; nSlot < nSeg; nSlot = (nSlot * 2) { + } + pNew = fts5IdxMalloc(tls, p, + (int64((uint64(unsafe.Sizeof(Fts5Iter{})) + (uint64(unsafe.Sizeof(Fts5SegIter{})) * (uint64(nSlot - 1)))) + (uint64(unsafe.Sizeof(Fts5CResult{})) * uint64(nSlot))))) + if pNew != 0 { + (*Fts5Iter)(unsafe.Pointer(pNew)).FnSeg = nSlot + (*Fts5Iter)(unsafe.Pointer(pNew)).FaFirst = ((pNew + 96 /* &.aSeg */) + uintptr(nSlot)*120) + (*Fts5Iter)(unsafe.Pointer(pNew)).FpIndex = p + (*Fts5Iter)(unsafe.Pointer(pNew)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_Noop})) + } + return pNew +} + +func fts5PoslistCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { /* sqlite3.c:223996:13: */ + _ = pUnused + + if nChunk > 0 { + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((pContext))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pContext))).Fn)), pChunk, uint64(nChunk)) + *(*int32)(unsafe.Pointer(pContext + 8 /* &.n */)) += (nChunk) + } + + } +} + +type PoslistCallbackCtx1 = struct { + FpBuf uintptr + FpColset uintptr + FeState int32 + _ [4]byte +} /* sqlite3.c:224008:9 */ + +type PoslistCallbackCtx = PoslistCallbackCtx1 /* sqlite3.c:224008:35 */ + +type PoslistOffsetsCtx1 = struct { + FpBuf uintptr + FpColset uintptr + FiRead int32 + FiWrite int32 +} /* sqlite3.c:224015:9 */ + +type PoslistOffsetsCtx = PoslistOffsetsCtx1 /* sqlite3.c:224015:34 */ + +// TODO: Make this more efficient! +func fts5IndexColsetTest(tls *libc.TLS, pColset uintptr, iCol int32) int32 { /* sqlite3.c:224026:12: */ + var i int32 + for i = 0; i < (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol; i++ { + if *(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */) + uintptr(i)*4)) == iCol { + return 1 + } + } + return 0 +} + +func fts5PoslistOffsetsCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { /* sqlite3.c:224034:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pCtx uintptr = pContext + _ = pUnused + + if nChunk > 0 { + var i int32 = 0 + for i < nChunk { + // var iVal int32 at bp, 4 + + i = i + (sqlite3Fts5GetVarint32(tls, (pChunk + uintptr(i)), bp /* &iVal */)) + *(*int32)(unsafe.Pointer(bp /* iVal */)) += ((*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiRead - 2) + (*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiRead = *(*int32)(unsafe.Pointer(bp /* iVal */)) + if fts5IndexColsetTest(tls, (*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp /* iVal */))) != 0 { + { + *(*int32)(unsafe.Pointer((*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(((*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(((*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fn)), (uint64((*(*int32)(unsafe.Pointer(bp /* iVal */)) + 2) - (*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiWrite)))) + } + + (*PoslistOffsetsCtx)(unsafe.Pointer(pCtx)).FiWrite = *(*int32)(unsafe.Pointer(bp /* iVal */)) + } + } + } +} + +func fts5PoslistFilterCallback(tls *libc.TLS, pUnused uintptr, pContext uintptr, pChunk uintptr, nChunk int32) { /* sqlite3.c:224057:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pCtx uintptr = pContext + _ = pUnused + + if nChunk > 0 { + // Search through to find the first varint with value 1. This is the + // start of the next columns hits. + var i int32 = 0 + var iStart int32 = 0 + + if (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState == 2 { + // var iCol int32 at bp, 4 + + { + *(*int32)(unsafe.Pointer(bp /* iCol */)) = int32(*(*U8)(unsafe.Pointer((pChunk) + uintptr(libc.PostIncInt32(&i, 1))))) + if (*(*int32)(unsafe.Pointer(bp /* iCol */)) & 0x80) != 0 { + i-- + i = i + (sqlite3Fts5GetVarint32(tls, ((pChunk) + uintptr(i)), bp /* &iCol */)) + } + } + + if fts5IndexColsetTest(tls, (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp /* iCol */))) != 0 { + (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = 1 + { + *(*int32)(unsafe.Pointer((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fn)), uint64(1))) + } + + } else { + (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = 0 + } + } + + for ok := true; ok; ok = (i < nChunk) { + for (i < nChunk) && (int32(*(*U8)(unsafe.Pointer(pChunk + uintptr(i)))) != 0x01) { + for (int32(*(*U8)(unsafe.Pointer(pChunk + uintptr(i)))) & 0x80) != 0 { + i++ + } + i++ + } + if (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState != 0 { + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer(((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fn)), (pChunk + uintptr(iStart)), (uint64(i - iStart))) + *(*int32)(unsafe.Pointer((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8 /* &.n */)) += (i - iStart) + } + + } + if i < nChunk { + // var iCol int32 at bp+4, 4 + + iStart = i + i++ + if i >= nChunk { + (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = 2 + } else { + { + *(*int32)(unsafe.Pointer(bp + 4 /* iCol */)) = int32(*(*U8)(unsafe.Pointer((pChunk) + uintptr(libc.PostIncInt32(&i, 1))))) + if (*(*int32)(unsafe.Pointer(bp + 4 /* iCol */)) & 0x80) != 0 { + i-- + i = i + (sqlite3Fts5GetVarint32(tls, ((pChunk) + uintptr(i)), bp+4 /* &iCol */)) + } + } + + (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState = fts5IndexColsetTest(tls, (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpColset, *(*int32)(unsafe.Pointer(bp + 4 /* iCol */))) + if (*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FeState != 0 { + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer(((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf))).Fn)), (pChunk + uintptr(iStart)), (uint64(i - iStart))) + *(*int32)(unsafe.Pointer((*PoslistCallbackCtx)(unsafe.Pointer(pCtx)).FpBuf + 8 /* &.n */)) += (i - iStart) + } + + iStart = i + } + } + } + } + } +} + +func fts5ChunkIterate(tls *libc.TLS, p uintptr, pSeg uintptr, pCtx uintptr, xChunk uintptr) { /* sqlite3.c:224109:13: */ + var nRem int32 = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos // Number of bytes still to come + var pData uintptr = uintptr(0) + var pChunk uintptr = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset)) + var nChunk int32 = func() int32 { + if (I64(nRem)) < (I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) - (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset) { + return nRem + } + return (int32(I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) - (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset)) + }() + var pgno int32 = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno + var pgnoSave int32 = 0 + + // This function does not work with detail=none databases. + + if ((*Fts5SegIter)(unsafe.Pointer(pSeg)).Fflags & FTS5_SEGITER_REVERSE) == 0 { + pgnoSave = (pgno + 1) + } + + for 1 != 0 { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&xChunk)))(tls, p, pCtx, pChunk, nChunk) + nRem = nRem - (nChunk) + fts5DataRelease(tls, pData) + if nRem <= 0 { + break + } else if (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + return + } else { + pgno++ + pData = fts5LeafRead(tls, p, (((((I64((*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(pgno)))) + if pData == uintptr(0) { + break + } + pChunk = ((*Fts5Data)(unsafe.Pointer(pData)).Fp + 4) + nChunk = func() int32 { + if (nRem) < ((*Fts5Data)(unsafe.Pointer(pData)).FszLeaf - 4) { + return nRem + } + return ((*Fts5Data)(unsafe.Pointer(pData)).FszLeaf - 4) + }() + if pgno == pgnoSave { + + (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpNextLeaf = pData + pData = uintptr(0) + } + } + } +} + +// Iterator pIter currently points to a valid entry (not EOF). This +// function appends the position list data for the current entry to +// buffer pBuf. It does not make a copy of the position-list size +// field. +func fts5SegiterPoslist(tls *libc.TLS, p uintptr, pSeg uintptr, pColset uintptr, pBuf uintptr) { /* sqlite3.c:224159:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + if 0 == (func() int32 { + if ((U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + (U32((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos + FTS5_DATA_ZERO_PADDING))) <= (U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace)) { + return 0 + } + return sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), pBuf, (uint32(((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos + FTS5_DATA_ZERO_PADDING) + (*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn))) + }()) { + libc.Xmemset(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn + (*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos))), 0, uint64(FTS5_DATA_ZERO_PADDING)) + if pColset == uintptr(0) { + fts5ChunkIterate(tls, p, pSeg, pBuf, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32) + }{fts5PoslistCallback}))) + } else { + if (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == FTS5_DETAIL_FULL { + // var sCtx PoslistCallbackCtx at bp, 24 + + (*PoslistCallbackCtx)(unsafe.Pointer(bp /* &sCtx */)).FpBuf = pBuf + (*PoslistCallbackCtx)(unsafe.Pointer(bp /* &sCtx */)).FpColset = pColset + (*PoslistCallbackCtx)(unsafe.Pointer(bp /* &sCtx */)).FeState = fts5IndexColsetTest(tls, pColset, 0) + + fts5ChunkIterate(tls, p, pSeg, bp /* &sCtx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32) + }{fts5PoslistFilterCallback}))) + } else { + // var sCtx PoslistOffsetsCtx at bp+24, 24 + + libc.Xmemset(tls, bp+24 /* &sCtx */, 0, uint64(unsafe.Sizeof(PoslistOffsetsCtx{}))) + (*PoslistOffsetsCtx)(unsafe.Pointer(bp + 24 /* &sCtx */)).FpBuf = pBuf + (*PoslistOffsetsCtx)(unsafe.Pointer(bp + 24 /* &sCtx */)).FpColset = pColset + fts5ChunkIterate(tls, p, pSeg, bp+24 /* &sCtx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32) + }{fts5PoslistOffsetsCallback}))) + } + } + } +} + +// Parameter pPos points to a buffer containing a position list, size nPos. +// This function filters it according to pColset (which must be non-NULL) +// and sets pIter->base.pData/nData to point to the new position list. +// If memory is required for the new position list, use buffer pIter->poslist. +// Or, if the new position list is a contiguous subset of the input, set +// pIter->base.pData/nData to point directly to it. +// +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. If an OOM error is encountered, *pRc is set to SQLITE_NOMEM +// before returning. +func fts5IndexExtractColset(tls *libc.TLS, pRc uintptr, pColset uintptr, pPos uintptr, nPos int32, pIter uintptr) { /* sqlite3.c:224200:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var p uintptr = pPos + var aCopy uintptr = p + var pEnd uintptr = (p + uintptr(nPos)) // One byte past end of position list + var i int32 = 0 + *(*int32)(unsafe.Pointer(bp /* iCurrent */)) = 0 + + if ((*Fts5Colset)(unsafe.Pointer(pColset)).FnCol > 1) && (sqlite3Fts5BufferSize(tls, pRc, (pIter+32 /* &.poslist */), uint32(nPos)) != 0) { + return + } + + for 1 != 0 { + for *(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */) + uintptr(i)*4)) < *(*int32)(unsafe.Pointer(bp /* iCurrent */)) { + i++ + if i == (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol { + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn + return + } + } + + // Advance pointer p until it points to pEnd or an 0x01 byte that is + // not part of a varint + for (p < pEnd) && (int32(*(*U8)(unsafe.Pointer(p))) != 0x01) { + for (int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1)))) & 0x80) != 0 { + } + } + + if *(*int32)(unsafe.Pointer((pColset + 4 /* &.aiCol */) + uintptr(i)*4)) == *(*int32)(unsafe.Pointer(bp /* iCurrent */)) { + if (*Fts5Colset)(unsafe.Pointer(pColset)).FnCol == 1 { + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = aCopy + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (int32((int64(p) - int64(aCopy)) / 1)) + return + } + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((pIter + 32 /* &.poslist */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pIter + 32 /* &.poslist */))).Fn)), aCopy, (uint64((int64(p) - int64(aCopy)) / 1))) + *(*int32)(unsafe.Pointer((pIter + 32 /* &.poslist */) + 8 /* &.n */)) += int32(((int64(p) - int64(aCopy)) / 1)) + } + + } + if p >= pEnd { + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn + return + } + aCopy = libc.PostIncUintptr(&p, 1) + *(*int32)(unsafe.Pointer(bp /* iCurrent */)) = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1)))) + if (*(*int32)(unsafe.Pointer(bp /* iCurrent */)) & 0x80) != 0 { + p-- + p += uintptr(sqlite3Fts5GetVarint32(tls, p, bp /* &iCurrent */)) + } + } + } + +} + +// xSetOutputs callback used by detail=none tables. +func fts5IterSetOutputs_None(tls *libc.TLS, pIter uintptr, pSeg uintptr) { /* sqlite3.c:224260:13: */ + + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos +} + +// xSetOutputs callback used by detail=full and detail=col tables when no +// column filters are specified. +func fts5IterSetOutputs_Nocolset(tls *libc.TLS, pIter uintptr, pSeg uintptr) { /* sqlite3.c:224270:13: */ + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos + + if ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset + I64((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos)) <= I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { + // All data is stored on the current page. Populate the output + // variables to point into the body of the page object. + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset)) + } else { + // The data is distributed over two or more pages. Copy it into the + // Fts5Iter.poslist buffer and then set the output pointer to point + // to this buffer. + sqlite3Fts5BufferZero(tls, (pIter + 32 /* &.poslist */)) + fts5SegiterPoslist(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex, pSeg, uintptr(0), (pIter + 32 /* &.poslist */)) + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + } +} + +// xSetOutputs callback used when the Fts5Colset object has nCol==0 (match +// against no columns at all). +func fts5IterSetOutputs_ZeroColset(tls *libc.TLS, pIter uintptr, pSeg uintptr) { /* sqlite3.c:224295:13: */ + _ = pSeg + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = 0 +} + +// xSetOutputs callback used by detail=col when there is a column filter +// and there are 100 or more columns. Also called as a fallback from +// fts5IterSetOutputs_Col100 if the column-list spans more than one page. +func fts5IterSetOutputs_Col(tls *libc.TLS, pIter uintptr, pSeg uintptr) { /* sqlite3.c:224305:13: */ + sqlite3Fts5BufferZero(tls, (pIter + 32 /* &.poslist */)) + fts5SegiterPoslist(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex, pSeg, (*Fts5Iter)(unsafe.Pointer(pIter)).FpColset, (pIter + 32 /* &.poslist */)) + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn +} + +// xSetOutputs callback used when: +// +// * detail=col, +// * there is a column filter, and +// * the table contains 100 or fewer columns. +// +// The last point is to ensure all column numbers are stored as +// single-byte varints. +func fts5IterSetOutputs_Col100(tls *libc.TLS, pIter uintptr, pSeg uintptr) { /* sqlite3.c:224323:13: */ + var a uintptr + var pEnd uintptr + var iPrev int32 + var aiCol uintptr + var aiColEnd uintptr + var aOut uintptr + var iPrevOut int32 + + if !(((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset + I64((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos)) > I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf)) { + goto __1 + } + fts5IterSetOutputs_Col(tls, pIter, pSeg) + goto __2 +__1: + a = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset)) + pEnd = (a + uintptr((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos)) + iPrev = 0 + aiCol = (*Fts5Iter)(unsafe.Pointer(pIter)).FpColset + 4 /* &.aiCol */ + aiColEnd = (aiCol + uintptr((*Fts5Colset)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FpColset)).FnCol)*4) + aOut = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + iPrevOut = 0 + + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + +__3: + if !(a < pEnd) { + goto __4 + } + iPrev = iPrev + (int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) - 2) +__5: + if !(*(*int32)(unsafe.Pointer(aiCol)) < iPrev) { + goto __6 + } + aiCol += 4 + if !(aiCol == aiColEnd) { + goto __7 + } + goto setoutputs_col_out +__7: + ; + goto __5 +__6: + ; + if !(*(*int32)(unsafe.Pointer(aiCol)) == iPrev) { + goto __8 + } + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = (U8((iPrev - iPrevOut) + 2)) + iPrevOut = iPrev +__8: + ; + goto __3 +__4: + ; + +setoutputs_col_out: + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (int32((int64(aOut) - int64((*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp)) / 1)) +__2: +} + +// xSetOutputs callback used by detail=full when there is a column filter. +func fts5IterSetOutputs_Full(tls *libc.TLS, pIter uintptr, pSeg uintptr) { /* sqlite3.c:224363:13: */ + var pColset uintptr = (*Fts5Iter)(unsafe.Pointer(pIter)).FpColset + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FiRowid = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiRowid + + if ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset + I64((*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos)) <= I64((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).FszLeaf) { + // All data is stored on the current page. Populate the output + // variables to point into the body of the page object. + var a uintptr = ((*Fts5Data)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafOffset)) + var pRc uintptr = ((*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex + 52 /* &.rc */) + sqlite3Fts5BufferZero(tls, (pIter + 32 /* &.poslist */)) + fts5IndexExtractColset(tls, pRc, pColset, a, (*Fts5SegIter)(unsafe.Pointer(pSeg)).FnPos, pIter) + } else { + // The data is distributed over two or more pages. Copy it into the + // Fts5Iter.poslist buffer and then set the output pointer to point + // to this buffer. + sqlite3Fts5BufferZero(tls, (pIter + 32 /* &.poslist */)) + fts5SegiterPoslist(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex, pSeg, pColset, (pIter + 32 /* &.poslist */)) + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FpData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fp + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FnData = (*Fts5Iter)(unsafe.Pointer(pIter)).Fposlist.Fn + } +} + +func fts5IterSetOutputCb(tls *libc.TLS, pRc uintptr, pIter uintptr) { /* sqlite3.c:224388:13: */ + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex)).FpConfig + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_NONE { + (*Fts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_None})) + } else if (*Fts5Iter)(unsafe.Pointer(pIter)).FpColset == uintptr(0) { + (*Fts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_Nocolset})) + } else if (*Fts5Colset)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FpColset)).FnCol == 0 { + (*Fts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_ZeroColset})) + } else if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_FULL { + (*Fts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_Full})) + } else { + + if (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol <= 100 { + (*Fts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_Col100})) + sqlite3Fts5BufferSize(tls, pRc, (pIter + 32 /* &.poslist */), uint32((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)) + } else { + (*Fts5Iter)(unsafe.Pointer(pIter)).FxSetOutputs = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) + }{fts5IterSetOutputs_Col})) + } + } + } +} + +// Allocate a new Fts5Iter object. +// +// The new object will be used to iterate through data in structure pStruct. +// If iLevel is -ve, then all data in all segments is merged. Or, if iLevel +// is zero or greater, data from the first nSegment segments on level iLevel +// is merged. +// +// The iterator initially points to the first term/rowid entry in the +// iterated data. +func fts5MultiIterNew(tls *libc.TLS, p uintptr, pStruct uintptr, flags int32, pColset uintptr, pTerm uintptr, nTerm int32, iLevel int32, nSegment int32, ppOut uintptr) { /* sqlite3.c:224431:13: */ + var nSeg int32 = 0 // Number of segment-iters in use + var iIter int32 = 0 // + var iSeg int32 // Used to iterate through segments + var pLvl uintptr + var pNew uintptr + + // Allocate space for the new multi-seg-iterator. + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if iLevel < 0 { + + nSeg = (*Fts5Structure)(unsafe.Pointer(pStruct)).FnSegment + nSeg = nSeg + (func() int32 { + if (*Fts5Index)(unsafe.Pointer(p)).FpHash != 0 { + return 1 + } + return 0 + }()) + } else { + nSeg = func() int32 { + if ((*Fts5StructureLevel)(unsafe.Pointer((pStruct + 24 /* &.aLevel */) + uintptr(iLevel)*16)).FnSeg) < (nSegment) { + return (*Fts5StructureLevel)(unsafe.Pointer((pStruct + 24 /* &.aLevel */) + uintptr(iLevel)*16)).FnSeg + } + return nSegment + }() + } + } + *(*uintptr)(unsafe.Pointer(ppOut)) = libc.AssignUintptr(&pNew, fts5MultiIterAlloc(tls, p, nSeg)) + if pNew == uintptr(0) { + return + } + (*Fts5Iter)(unsafe.Pointer(pNew)).FbRev = (libc.Bool32(0 != (flags & FTS5INDEX_QUERY_DESC))) + (*Fts5Iter)(unsafe.Pointer(pNew)).FbSkipEmpty = (U8(libc.Bool32(0 != (flags & FTS5INDEX_QUERY_SKIPEMPTY)))) + (*Fts5Iter)(unsafe.Pointer(pNew)).FpColset = pColset + if (flags & FTS5INDEX_QUERY_NOOUTPUT) == 0 { + fts5IterSetOutputCb(tls, (p + 52 /* &.rc */), pNew) + } + + // Initialize each of the component segment iterators. + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if iLevel < 0 { + var pEnd uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel)*16) + if (*Fts5Index)(unsafe.Pointer(p)).FpHash != 0 { + // Add a segment iterator for the current contents of the hash table. + var pIter uintptr = ((pNew + 96 /* &.aSeg */) + uintptr(libc.PostIncInt32(&iIter, 1))*120) + fts5SegIterHashInit(tls, p, pTerm, nTerm, flags, pIter) + } + for pLvl = (pStruct + 24 /* &.aLevel */); pLvl < pEnd; pLvl += 16 { + for iSeg = ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg - 1); iSeg >= 0; iSeg-- { + var pSeg uintptr = ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*12) + var pIter uintptr = ((pNew + 96 /* &.aSeg */) + uintptr(libc.PostIncInt32(&iIter, 1))*120) + if pTerm == uintptr(0) { + fts5SegIterInit(tls, p, pSeg, pIter) + } else { + fts5SegIterSeekInit(tls, p, pTerm, nTerm, flags, pSeg, pIter) + } + } + } + } else { + pLvl = ((pStruct + 24 /* &.aLevel */) + uintptr(iLevel)*16) + for iSeg = (nSeg - 1); iSeg >= 0; iSeg-- { + fts5SegIterInit(tls, p, ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSeg)*12), ((pNew + 96 /* &.aSeg */) + uintptr(libc.PostIncInt32(&iIter, 1))*120)) + } + } + + } + + // If the above was successful, each component iterators now points + // to the first entry in its segment. In this case initialize the + // aFirst[] array. Or, if an error has occurred, free the iterator + // object and set the output variable to NULL. + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + for iIter = ((*Fts5Iter)(unsafe.Pointer(pNew)).FnSeg - 1); iIter > 0; iIter-- { + var iEq int32 + if libc.AssignInt32(&iEq, fts5MultiIterDoCompare(tls, pNew, iIter)) != 0 { + var pSeg uintptr = ((pNew + 96 /* &.aSeg */) + uintptr(iEq)*120) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pSeg + 40 /* &.xNext */))))(tls, p, pSeg, uintptr(0)) + } + fts5MultiIterAdvanced(tls, p, pNew, iEq, iIter) + } + } + fts5MultiIterSetEof(tls, pNew) + + if ((*Fts5Iter)(unsafe.Pointer(pNew)).FbSkipEmpty != 0) && (fts5MultiIterIsEmpty(tls, p, pNew) != 0) { + fts5MultiIterNext(tls, p, pNew, 0, int64(0)) + } else if int32((*Fts5Iter)(unsafe.Pointer(pNew)).Fbase.FbEof) == 0 { + var pSeg uintptr = ((pNew + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pNew)).FaFirst+1*4)).FiFirst)*120) + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pNew + 56 /* &.xSetOutputs */))))(tls, pNew, pSeg) + } + + } else { + fts5MultiIterFree(tls, pNew) + *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) + } +} + +// Create an Fts5Iter that iterates through the doclist provided +// as the second argument. +func fts5MultiIterNew2(tls *libc.TLS, p uintptr, pData uintptr, bDesc int32, ppOut uintptr) { /* sqlite3.c:224530:13: */ + var pNew uintptr + pNew = fts5MultiIterAlloc(tls, p, 2) + if pNew != 0 { + var pIter uintptr = ((pNew + 96 /* &.aSeg */) + 1*120) + + (*Fts5SegIter)(unsafe.Pointer(pIter)).Fflags = FTS5_SEGITER_ONETERM + if (*Fts5Data)(unsafe.Pointer(pData)).FszLeaf > 0 { + (*Fts5SegIter)(unsafe.Pointer(pIter)).FpLeaf = pData + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiLeafOffset = I64(sqlite3Fts5GetVarint(tls, (*Fts5Data)(unsafe.Pointer(pData)).Fp, (pIter + 104 /* &.iRowid */))) + (*Fts5SegIter)(unsafe.Pointer(pIter)).FiEndofDoclist = (*Fts5Data)(unsafe.Pointer(pData)).Fnn + (*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pNew)).FaFirst + 1*4)).FiFirst = U16(1) + if bDesc != 0 { + (*Fts5Iter)(unsafe.Pointer(pNew)).FbRev = 1 + *(*int32)(unsafe.Pointer(pIter + 8 /* &.flags */)) |= (FTS5_SEGITER_REVERSE) + fts5SegIterReverseInitPage(tls, p, pIter) + } else { + fts5SegIterLoadNPos(tls, p, pIter) + } + pData = uintptr(0) + } else { + (*Fts5Iter)(unsafe.Pointer(pNew)).Fbase.FbEof = U8(1) + } + fts5SegIterSetNext(tls, p, pIter) + + *(*uintptr)(unsafe.Pointer(ppOut)) = pNew + } + + fts5DataRelease(tls, pData) +} + +// Return true if the iterator is at EOF or if an error has occurred. +// False otherwise. +func fts5MultiIterEof(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:224570:12: */ + + return (libc.Bool32(((*Fts5Index)(unsafe.Pointer(p)).Frc != 0) || ((*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof != 0))) +} + +// Return the rowid of the entry that the iterator currently points +// to. If the iterator points to EOF when this function is called the +// results are undefined. +func fts5MultiIterRowid(tls *libc.TLS, pIter uintptr) I64 { /* sqlite3.c:224582:12: */ + + return (*Fts5SegIter)(unsafe.Pointer((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+1*4)).FiFirst)*120)).FiRowid +} + +// Move the iterator to the next entry at or following iMatch. +func fts5MultiIterNextFrom(tls *libc.TLS, p uintptr, pIter uintptr, iMatch I64) { /* sqlite3.c:224590:13: */ + for 1 != 0 { + var iRowid I64 + fts5MultiIterNext(tls, p, pIter, 1, iMatch) + if fts5MultiIterEof(tls, p, pIter) != 0 { + break + } + iRowid = fts5MultiIterRowid(tls, pIter) + if ((*Fts5Iter)(unsafe.Pointer(pIter)).FbRev == 0) && (iRowid >= iMatch) { + break + } + if ((*Fts5Iter)(unsafe.Pointer(pIter)).FbRev != 0) && (iRowid <= iMatch) { + break + } + } +} + +// Return a pointer to a buffer containing the term associated with the +// entry that the iterator currently points to. +func fts5MultiIterTerm(tls *libc.TLS, pIter uintptr, pn uintptr) uintptr { /* sqlite3.c:224609:17: */ + var p uintptr = ((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+1*4)).FiFirst)*120) + *(*int32)(unsafe.Pointer(pn)) = (*Fts5SegIter)(unsafe.Pointer(p)).Fterm.Fn + return (*Fts5SegIter)(unsafe.Pointer(p)).Fterm.Fp +} + +// Allocate a new segment-id for the structure pStruct. The new segment +// id must be between 1 and 65335 inclusive, and must not be used by +// any currently existing segment. If a free segment id cannot be found, +// SQLITE_FULL is returned. +// +// If an error has already occurred, this function is a no-op. 0 is +// returned in this case. +func fts5AllocateSegid(tls *libc.TLS, p uintptr, pStruct uintptr) int32 { /* sqlite3.c:224624:12: */ + bp := tls.Alloc(252) + defer tls.Free(252) + + var iSegid int32 = 0 + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + if (*Fts5Structure)(unsafe.Pointer(pStruct)).FnSegment >= FTS5_MAX_SEGMENT { + (*Fts5Index)(unsafe.Pointer(p)).Frc = SQLITE_FULL + } else { + // FTS5_MAX_SEGMENT is currently defined as 2000. So the following + // array is 63 elements, or 252 bytes, in size. + // var aUsed [63]U32 at bp, 252 + + var iLvl int32 + var iSeg int32 + var i int32 + var mask U32 + libc.Xmemset(tls, bp /* &aUsed[0] */, 0, uint64(unsafe.Sizeof([63]U32{}))) + for iLvl = 0; iLvl < (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel; iLvl++ { + for iSeg = 0; iSeg < (*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg; iSeg++ { + var iId int32 = (*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FaSeg + uintptr(iSeg)*12)).FiSegid + if (iId <= FTS5_MAX_SEGMENT) && (iId > 0) { + *(*U32)(unsafe.Pointer(bp /* &aUsed */ + uintptr(((iId-1)/32))*4)) |= (U32(U32(1)) << ((iId - 1) % 32)) + } + } + } + + for i = 0; *(*U32)(unsafe.Pointer(bp /* &aUsed[0] */ + uintptr(i)*4)) == 0xFFFFFFFF; i++ { + } + mask = *(*U32)(unsafe.Pointer(bp /* &aUsed[0] */ + uintptr(i)*4)) + for iSegid = 0; (mask & (U32(U32(1)) << iSegid)) != 0; iSegid++ { + } + iSegid = iSegid + (1 + (i * 32)) + + } + } + + return iSegid +} + +// Discard all data currently cached in the hash-tables. +func fts5IndexDiscardData(tls *libc.TLS, p uintptr) { /* sqlite3.c:224681:13: */ + + if (*Fts5Index)(unsafe.Pointer(p)).FpHash != 0 { + sqlite3Fts5HashClear(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash) + (*Fts5Index)(unsafe.Pointer(p)).FnPendingData = 0 + } +} + +// Return the size of the prefix, in bytes, that buffer +// (pNew/) shares with buffer (pOld/nOld). +// +// Buffer (pNew/) is guaranteed to be greater +// than buffer (pOld/nOld). +func fts5PrefixCompress(tls *libc.TLS, nOld int32, pOld uintptr, pNew uintptr) int32 { /* sqlite3.c:224696:12: */ + var i int32 + for i = 0; i < nOld; i++ { + if int32(*(*U8)(unsafe.Pointer(pOld + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(pNew + uintptr(i)))) { + break + } + } + return i +} + +func fts5WriteDlidxClear(tls *libc.TLS, p uintptr, pWriter uintptr, bFlush int32) { /* sqlite3.c:224704:13: */ + var i int32 + + for i = 0; i < (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx; i++ { + var pDlidx uintptr = ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + uintptr(i)*32) + if (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fn == 0 { + break + } + if bFlush != 0 { + + fts5DataWrite(tls, p, + (((((I64((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(1))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + ((I64(i)) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fpgno))), + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fp, (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fn) + } + sqlite3Fts5BufferZero(tls, (pDlidx + 16 /* &.buf */)) + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).FbPrevValid = 0 + } +} + +// Grow the pWriter->aDlidx[] array to at least nLvl elements in size. +// Any new array elements are zeroed before returning. +func fts5WriteDlidxGrow(tls *libc.TLS, p uintptr, pWriter uintptr, nLvl int32) int32 { /* sqlite3.c:224730:12: */ + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (nLvl >= (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx) { + var aDlidx uintptr = Xsqlite3_realloc64(tls, + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx, (uint64(uint64(unsafe.Sizeof(Fts5DlidxWriter{})) * uint64(nLvl)))) + if aDlidx == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM + } else { + var nByte Size_t = (uint64(unsafe.Sizeof(Fts5DlidxWriter{})) * (uint64(nLvl - (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx))) + libc.Xmemset(tls, (aDlidx + uintptr((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx)*32), 0, nByte) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx = aDlidx + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx = nLvl + } + } + return (*Fts5Index)(unsafe.Pointer(p)).Frc +} + +// If the current doclist-index accumulating in pWriter->aDlidx[] is large +// enough, flush it to disk and return 1. Otherwise discard it and return +// zero. +func fts5WriteFlushDlidx(tls *libc.TLS, p uintptr, pWriter uintptr) int32 { /* sqlite3.c:224756:12: */ + var bFlag int32 = 0 + + // If there were FTS5_MIN_DLIDX_SIZE or more empty leaf pages written + // to the database, also write the doclist-index to disk. + if ((*Fts5DlidxWriter)(unsafe.Pointer((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx)).Fbuf.Fn > 0) && ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnEmpty >= FTS5_MIN_DLIDX_SIZE) { + bFlag = 1 + } + fts5WriteDlidxClear(tls, p, pWriter, bFlag) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnEmpty = 0 + return bFlag +} + +// This function is called whenever processing of the doclist for the +// last term on leaf page (pWriter->iBtPage) is completed. +// +// The doclist-index for that term is currently stored in-memory within the +// Fts5SegWriter.aDlidx[] array. If it is large enough, this function +// writes it out to disk. Or, if it is too small to bother with, discards +// it. +// +// Fts5SegWriter.btterm currently contains the first term on page iBtPage. +func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3.c:224780:13: */ + var bFlag int32 + + if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage == 0 { + return + } + bFlag = fts5WriteFlushDlidx(tls, p, pWriter) + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var z uintptr = func() uintptr { + if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { + return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp + } + return ts + 756 /* "" */ + }() + // The following was already done in fts5WriteInit(): + // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); + Xsqlite3_bind_blob(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter, 2, z, (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn, uintptr(0)) + Xsqlite3_bind_int64(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter, 3, (I64(bFlag) + (I64((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage) << 1))) + Xsqlite3_step(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter) + (*Fts5Index)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter) + Xsqlite3_bind_null(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter, 2) + } + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage = 0 +} + +// This is called once for each leaf page except the first that contains +// at least one term. Argument (nTerm/pTerm) is the split-key - a term that +// is larger than all terms written to earlier leaves, and equal to or +// smaller than the first term on the new leaf. +// +// If an error occurs, an error code is left in Fts5Index.rc. If an error +// has already occurred when this function is called, it is a no-op. +func fts5WriteBtreeTerm(tls *libc.TLS, p uintptr, pWriter uintptr, nTerm int32, pTerm uintptr) { /* sqlite3.c:224809:13: */ + fts5WriteFlushBtree(tls, p, pWriter) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), (pWriter + 96 /* &.btterm */), nTerm, pTerm) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage = (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fpgno + } +} + +// This function is called when flushing a leaf page that contains no +// terms at all to disk. +func fts5WriteBtreeNoTerm(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3.c:224825:13: */ + // If there were no rowids on the leaf page either and the doclist-index + // has already been started, append an 0x00 byte to it. + if ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0) && ((*Fts5DlidxWriter)(unsafe.Pointer((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx)).Fbuf.Fn > 0) { + var pDlidx uintptr = ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx) + + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 16 /* &.buf */), int64(0)) + } + + // Increment the "number of sequential leaves without a term" counter. + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnEmpty++ +} + +func fts5DlidxExtractFirstRowid(tls *libc.TLS, pBuf uintptr) I64 { /* sqlite3.c:224841:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var iRowid I64 at bp, 8 + + var iOff int32 + + iOff = (1 + int32(sqlite3Fts5GetVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp+1), bp /* &iRowid */))) + sqlite3Fts5GetVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(iOff)), bp /* &iRowid */) + return *(*I64)(unsafe.Pointer(bp /* iRowid */)) +} + +// Rowid iRowid has just been appended to the current leaf page. It is the +// first on the page. This function appends an appropriate entry to the current +// doclist-index. +func fts5WriteDlidxAppend(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid I64) { /* sqlite3.c:224855:13: */ + var i int32 + var bDone int32 = 0 + + for i = 0; ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bDone == 0); i++ { + var iVal I64 + var pDlidx uintptr = ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + uintptr(i)*32) + + if (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fn >= (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + // The current doclist-index page is full. Write it to disk and push + // a copy of iRowid (which will become the first rowid on the next + // doclist-index leaf page) up into the next level of the b-tree + // hierarchy. If the node being flushed is currently the root node, + // also push its first rowid upwards. + *(*U8)(unsafe.Pointer((*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fp)) = U8(0x01) // Not the root node + fts5DataWrite(tls, p, + (((((I64((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(1))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + ((I64(i)) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fpgno))), + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fp, (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fbuf.Fn) + fts5WriteDlidxGrow(tls, p, pWriter, (i + 2)) + pDlidx = ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + uintptr(i)*32) + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5DlidxWriter)(unsafe.Pointer(pDlidx+1*32)).Fbuf.Fn == 0) { + var iFirst I64 = fts5DlidxExtractFirstRowid(tls, (pDlidx + 16 /* &.buf */)) + + // This was the root node. Push its first rowid up to the new root. + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx + 1*32)).Fpgno = (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fpgno + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 1*32 + 16 /* &.buf */), int64(0)) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 1*32 + 16 /* &.buf */), int64((*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fpgno)) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 1*32 + 16 /* &.buf */), iFirst) + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx + 1*32)).FbPrevValid = 1 + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx + 1*32)).FiPrev = iFirst + } + + sqlite3Fts5BufferZero(tls, (pDlidx + 16 /* &.buf */)) + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).FbPrevValid = 0 + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).Fpgno++ + } else { + bDone = 1 + } + + if (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).FbPrevValid != 0 { + iVal = (iRowid - (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).FiPrev) + } else { + var iPgno I64 = func() int64 { + if i == 0 { + return int64((*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fpgno) + } + return int64((*Fts5DlidxWriter)(unsafe.Pointer(pDlidx + libc.UintptrFromInt32(-1)*32)).Fpgno) + }() + + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 16 /* &.buf */), libc.BoolInt64(!(bDone != 0))) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 16 /* &.buf */), iPgno) + iVal = iRowid + } + + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pDlidx + 16 /* &.buf */), iVal) + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).FbPrevValid = 1 + (*Fts5DlidxWriter)(unsafe.Pointer(pDlidx)).FiPrev = iRowid + } +} + +func fts5WriteFlushLeaf(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3.c:224915:13: */ + var pPage uintptr = (pWriter + 8 /* &.writer */) + var iRowid I64 + + // Set the szLeaf header field. + + fts5PutU16(tls, ((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fp + 2), U16((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn)) + + if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage != 0 { + // No term was written to this page. + + fts5WriteBtreeNoTerm(tls, p, pWriter) + } else { + // Append the pgidx to the page buffer. Set the szLeaf header field. + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), uint32((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn), (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fp) + } + + // Write the page out to disk + iRowid = (((((I64((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgno))) + fts5DataWrite(tls, p, iRowid, (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fp, (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn) + + // Initialize the next page. + sqlite3Fts5BufferZero(tls, (pPage + 8 /* &.buf */)) + sqlite3Fts5BufferZero(tls, (pPage + 24 /* &.pgidx */)) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), uint32(4), uintptr(unsafe.Pointer(&zero))) + (*Fts5PageWriter)(unsafe.Pointer(pPage)).FiPrevPgidx = 0 + (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgno++ + + // Increase the leaves written counter + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnLeafWritten++ + + // The new leaf holds no terms or rowids + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = U8(1) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage = U8(1) +} + +var zero = [4]U8{U8(0x00), U8(0x00), U8(0x00), U8(0x00)} /* sqlite3.c:224916:19 */ + +// Append term pTerm/nTerm to the segment being written by the writer passed +// as the second argument. +// +// If an error occurs, set the Fts5Index.rc error code. If an error has +// already occurred, this function is a no-op. +func fts5WriteAppendTerm(tls *libc.TLS, p uintptr, pWriter uintptr, nTerm int32, pTerm uintptr) { /* sqlite3.c:224961:13: */ + var nPrefix int32 // Bytes of prefix compression for term + var pPage uintptr = (pWriter + 8 /* &.writer */) + var pPgidx uintptr = (pWriter + 8 /* &.writer */ + 24 /* &.pgidx */) + var nMin int32 = func() int32 { + if ((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fn) < (nTerm) { + return (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fn + } + return nTerm + }() + + // If the current leaf page is full, flush it to disk. + if ((((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn + (*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn) + nTerm) + 2) >= (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + if (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn > 4 { + fts5WriteFlushLeaf(tls, p, pWriter) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + } + if !(((U32((*Fts5Buffer)(unsafe.Pointer((pPage + 8 /* &.buf */))).Fn)) + (U32(nTerm + FTS5_DATA_PADDING))) <= (U32((*Fts5Buffer)(unsafe.Pointer((pPage + 8 /* &.buf */))).FnSpace))) { + sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), (uint32((nTerm + FTS5_DATA_PADDING) + (*Fts5Buffer)(unsafe.Pointer((pPage + 8 /* &.buf */))).Fn))) + } + } + + // TODO1: Updating pgidx here. + *(*int32)(unsafe.Pointer(pPgidx + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, + ((*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn)), (uint64((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn - (*Fts5PageWriter)(unsafe.Pointer(pPage)).FiPrevPgidx)))) + (*Fts5PageWriter)(unsafe.Pointer(pPage)).FiPrevPgidx = (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn + + if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage != 0 { + nPrefix = 0 + if (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgno != 1 { + // This is the first term on a leaf that is not the leftmost leaf in + // the segment b-tree. In this case it is necessary to add a term to + // the b-tree hierarchy that is (a) larger than the largest term + // already written to the segment and (b) smaller than or equal to + // this term. In other words, a prefix of (pTerm/nTerm) that is one + // byte longer than the longest prefix (pTerm/nTerm) shares with the + // previous term. + // + // Usually, the previous term is available in pPage->term. The exception + // is if this is the first term written in an incremental-merge step. + // In this case the previous term is not available, so just write a + // copy of (pTerm/nTerm) into the parent node. This is slightly + // inefficient, but still correct. + var n int32 = nTerm + if (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fn != 0 { + n = (1 + fts5PrefixCompress(tls, nMin, (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fp, pTerm)) + } + fts5WriteBtreeTerm(tls, p, pWriter, n, pTerm) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return + } + pPage = (pWriter + 8 /* &.writer */) + } + } else { + nPrefix = fts5PrefixCompress(tls, nMin, (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fterm.Fp, pTerm) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), int64(nPrefix)) + } + + // Append the number of bytes of new data, then the term data itself + // to the page. + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), (int64(nTerm - nPrefix))) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), (uint32(nTerm - nPrefix)), (pTerm + uintptr(nPrefix))) + + // Update the Fts5PageWriter.term field. + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), (pPage + 40 /* &.term */), nTerm, pTerm) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = U8(0) + + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage = U8(0) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist = U8(1) + + (*Fts5DlidxWriter)(unsafe.Pointer((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx)).Fpgno = (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgno +} + +// Append a rowid and position-list size field to the writers output. +func fts5WriteAppendRowid(tls *libc.TLS, p uintptr, pWriter uintptr, iRowid I64) { /* sqlite3.c:225042:13: */ + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var pPage uintptr = (pWriter + 8 /* &.writer */) + + if ((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn + (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn) >= (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz { + fts5WriteFlushLeaf(tls, p, pWriter) + } + + // If this is to be the first rowid written to the page, set the + // rowid-pointer in the page-header. Also append a value to the dlidx + // buffer, in case a doclist-index is required. + if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0 { + fts5PutU16(tls, (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fp, U16((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn)) + fts5WriteDlidxAppend(tls, p, pWriter, iRowid) + } + + // Write the rowid. + if ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist != 0) || ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage != 0) { + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), iRowid) + } else { + + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), (iRowid - (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiPrevRowid)) + } + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiPrevRowid = iRowid + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInDoclist = U8(0) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstRowidInPage = U8(0) + } +} + +func fts5WriteAppendPoslistData(tls *libc.TLS, p uintptr, pWriter uintptr, aData uintptr, nData int32) { /* sqlite3.c:225075:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pPage uintptr = (pWriter + 8 /* &.writer */) + var a uintptr = aData + var n int32 = nData + + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && + ((((*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn + (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn) + n) >= (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz) { + var nReq int32 = (((*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz - (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fbuf.Fn) - (*Fts5PageWriter)(unsafe.Pointer(pPage)).Fpgidx.Fn) + var nCopy int32 = 0 + for nCopy < nReq { + // var dummy I64 at bp, 8 + + nCopy = nCopy + (int32(sqlite3Fts5GetVarint(tls, (a + uintptr(nCopy)), bp /* &dummy */))) + } + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), uint32(nCopy), a) + a += uintptr(nCopy) + n = n - (nCopy) + fts5WriteFlushLeaf(tls, p, pWriter) + } + if n > 0 { + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), (pPage + 8 /* &.buf */), uint32(n), a) + } +} + +// Flush any data cached by the writer object to the database. Free any +// allocations associated with the writer. +func fts5WriteFinish(tls *libc.TLS, p uintptr, pWriter uintptr, pnLeaf uintptr) { /* sqlite3.c:225109:13: */ + var i int32 + var pLeaf uintptr = (pWriter + 8 /* &.writer */) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + + if (*Fts5PageWriter)(unsafe.Pointer(pLeaf)).Fbuf.Fn > 4 { + fts5WriteFlushLeaf(tls, p, pWriter) + } + *(*int32)(unsafe.Pointer(pnLeaf)) = ((*Fts5PageWriter)(unsafe.Pointer(pLeaf)).Fpgno - 1) + if (*Fts5PageWriter)(unsafe.Pointer(pLeaf)).Fpgno > 1 { + fts5WriteFlushBtree(tls, p, pWriter) + } + } + sqlite3Fts5BufferFree(tls, (pLeaf + 40 /* &.term */)) + sqlite3Fts5BufferFree(tls, (pLeaf + 8 /* &.buf */)) + sqlite3Fts5BufferFree(tls, (pLeaf + 24 /* &.pgidx */)) + sqlite3Fts5BufferFree(tls, (pWriter + 96 /* &.btterm */)) + + for i = 0; i < (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx; i++ { + sqlite3Fts5BufferFree(tls, ((*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx + uintptr(i)*32 + 16 /* &.buf */)) + } + Xsqlite3_free(tls, (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx) +} + +func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* sqlite3.c:225137:13: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nBuffer int32 = ((*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz + FTS5_DATA_PADDING) + + libc.Xmemset(tls, pWriter, 0, uint64(unsafe.Sizeof(Fts5SegWriter{}))) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid = iSegid + + fts5WriteDlidxGrow(tls, p, pWriter, 1) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fpgno = 1 + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FbFirstTermInPage = U8(1) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiBtPage = 1 + + // Grow the two buffers to pgsz + padding bytes in size. + sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), (pWriter + 8 /* &.writer */ + 24 /* &.pgidx */), uint32(nBuffer)) + sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), (pWriter + 8 /* &.writer */ + 8 /* &.buf */), uint32(nBuffer)) + + if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + fts5IndexPrepareStmt(tls, p, (p + 80 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, + ts+33279, /* "INSERT INTO '%q'..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + // Initialize the 4-byte leaf-page header to 0x00. + libc.Xmemset(tls, (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fbuf.Fp, 0, uint64(4)) + (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fwriter.Fbuf.Fn = 4 + + // Bind the current output segment id to the index-writer. This is an + // optimization over binding the same value over and over as rows are + // inserted into %_idx by the current writer. + Xsqlite3_bind_int(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter, 1, (*Fts5SegWriter)(unsafe.Pointer(pWriter)).FiSegid) + } +} + +// Iterator pIter was used to iterate through the input segments of on an +// incremental merge operation. This function is called if the incremental +// merge step has finished but the input has not been completely exhausted. +func fts5TrimSegments(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:225184:13: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + // var buf Fts5Buffer at bp, 16 + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + for i = 0; (i < (*Fts5Iter)(unsafe.Pointer(pIter)).FnSeg) && ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK); i++ { + var pSeg uintptr = ((pIter + 96 /* &.aSeg */) + uintptr(i)*120) + if (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg == uintptr(0) { + // no-op + } else if (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf == uintptr(0) { + // All keys from this input segment have been transfered to the output. + // Set both the first and last page-numbers to 0 to indicate that the + // segment is now empty. + (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FpgnoLast = 0 + (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FpgnoFirst = 0 + } else { + var iOff int32 = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafOffset // Offset on new first leaf page + var iLeafRowid I64 + var pData uintptr + var iId int32 = (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FiSegid + *(*[4]U8)(unsafe.Pointer(bp + 16 /* aHdr */)) = [4]U8{U8(0x00), U8(0x00), U8(0x00), U8(0x00)} + + iLeafRowid = (((((I64(iId)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno))) + pData = fts5LeafRead(tls, p, iLeafRowid) + if pData != 0 { + if iOff > (*Fts5Data)(unsafe.Pointer(pData)).FszLeaf { + // This can occur if the pages that the segments occupy overlap - if + // a single page has been assigned to more than one segment. In + // this case a prior iteration of this loop may have corrupted the + // segment currently being trimmed. + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + sqlite3Fts5BufferZero(tls, bp /* &buf */) + if !(((U32((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn)) + (U32((*Fts5Data)(unsafe.Pointer(pData)).Fnn))) <= (U32((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).FnSpace))) { + sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), bp /* &buf */, (uint32(((*Fts5Data)(unsafe.Pointer(pData)).Fnn) + (*Fts5Buffer)(unsafe.Pointer((bp /* &buf */))).Fn))) + } + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp /* &buf */, uint32(unsafe.Sizeof([4]U8{})), bp+16 /* &aHdr[0] */) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64((*Fts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fn)) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp /* &buf */, uint32((*Fts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fn), (*Fts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fp) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp /* &buf */, (uint32((*Fts5Data)(unsafe.Pointer(pData)).FszLeaf - iOff)), ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr(iOff))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + // Set the szLeaf field + fts5PutU16(tls, ((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp + 2), U16((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn)) + } + + // Set up the new page-index array + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, int64(4)) + if (((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiLeafPgno == (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno) && + ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiEndofDoclist < (*Fts5Data)(unsafe.Pointer(pData)).FszLeaf)) && + ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiPgidxOff <= (*Fts5Data)(unsafe.Pointer(pData)).Fnn) { + var nDiff int32 = ((*Fts5Data)(unsafe.Pointer(pData)).FszLeaf - (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiEndofDoclist) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), bp /* &buf */, (int64((((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn - 1) - nDiff) - 4))) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp /* &buf */, (uint32((*Fts5Data)(unsafe.Pointer(pData)).Fnn - (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiPgidxOff)), ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr((*Fts5SegIter)(unsafe.Pointer(pSeg)).FiPgidxOff))) + } + + (*Fts5StructureSegment)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpSeg)).FpgnoFirst = (*Fts5SegIter)(unsafe.Pointer(pSeg)).FiTermLeafPgno + fts5DataDelete(tls, p, (((((I64(iId)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (int64(1))), iLeafRowid) + fts5DataWrite(tls, p, iLeafRowid, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn) + } + fts5DataRelease(tls, pData) + } + } + } + sqlite3Fts5BufferFree(tls, bp /* &buf */) +} + +func fts5MergeChunkCallback(tls *libc.TLS, p uintptr, pCtx uintptr, pChunk uintptr, nChunk int32) { /* sqlite3.c:225250:13: */ + var pWriter uintptr = pCtx + fts5WriteAppendPoslistData(tls, p, pWriter, pChunk, nChunk) +} + +// +func fts5IndexMergeLevel(tls *libc.TLS, p uintptr, ppStruct uintptr, iLvl int32, pnRem uintptr) { /* sqlite3.c:225262:13: */ + bp := tls.Alloc(148) + defer tls.Free(148) + + var pStruct uintptr = *(*uintptr)(unsafe.Pointer(ppStruct)) + var pLvl uintptr = ((pStruct + 24 /* &.aLevel */) + uintptr(iLvl)*16) + var pLvlOut uintptr + *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */)) = uintptr(0) // Iterator to read input data + var nRem int32 + if pnRem != 0 { + nRem = *(*int32)(unsafe.Pointer(pnRem)) + } else { + nRem = 0 + } // Output leaf pages left to write + var nInput int32 // Number of input segments + // var writer Fts5SegWriter at bp, 120 + // Writer object + var pSeg uintptr // Output segment + // var term Fts5Buffer at bp+120, 16 + + var bOldest int32 // True if the output segment is the oldest + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail + var flags int32 = FTS5INDEX_QUERY_NOOUTPUT + var bTermWritten int32 = 0 // True if current term already output + + libc.Xmemset(tls, bp /* &writer */, 0, uint64(unsafe.Sizeof(Fts5SegWriter{}))) + libc.Xmemset(tls, bp+120 /* &term */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0 { + pLvlOut = ((pStruct + 24 /* &.aLevel */) + uintptr((iLvl+1))*16) + + nInput = (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge + pSeg = ((*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FaSeg + uintptr(((*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg-1))*12) + + fts5WriteInit(tls, p, bp /* &writer */, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid) + (*Fts5SegWriter)(unsafe.Pointer(bp /* &writer */)).Fwriter.Fpgno = ((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast + 1) + (*Fts5SegWriter)(unsafe.Pointer(bp /* &writer */)).FiBtPage = 0 + } else { + var iSegid int32 = fts5AllocateSegid(tls, p, pStruct) + + // Extend the Fts5Structure object as required to ensure the output + // segment exists. + if iLvl == ((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel - 1) { + fts5StructureAddLevel(tls, (p + 52 /* &.rc */), ppStruct) + pStruct = *(*uintptr)(unsafe.Pointer(ppStruct)) + } + fts5StructureExtendLevel(tls, (p + 52 /* &.rc */), pStruct, (iLvl + 1), 1, 0) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + pLvl = ((pStruct + 24 /* &.aLevel */) + uintptr(iLvl)*16) + pLvlOut = ((pStruct + 24 /* &.aLevel */) + uintptr((iLvl+1))*16) + + fts5WriteInit(tls, p, bp /* &writer */, iSegid) + + // Add the new segment to the output level + pSeg = ((*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FaSeg + uintptr((*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg)*12) + (*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg++ + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst = 1 + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid = iSegid + (*Fts5Structure)(unsafe.Pointer(pStruct)).FnSegment++ + + // Read input from all segments in the input level + nInput = (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg + } + bOldest = (libc.Bool32(((*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg == 1) && ((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel == (iLvl + 2)))) + + for fts5MultiIterNew(tls, p, pStruct, flags, uintptr(0), uintptr(0), 0, iLvl, nInput, bp+136 /* &pIter */); fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */))) == 0; fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */)), 0, int64(0)) { + var pSegIter uintptr = ((*(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */)))).FaFirst+1*4)).FiFirst)*120) + var nPos int32 // position-list size field value + // var nTerm int32 at bp+144, 4 + + var pTerm uintptr + + pTerm = fts5MultiIterTerm(tls, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */)), bp+144 /* &nTerm */) + if (*(*int32)(unsafe.Pointer(bp + 144 /* nTerm */)) != (*Fts5Buffer)(unsafe.Pointer(bp+120 /* &term */)).Fn) || (func() int32 { + if (*(*int32)(unsafe.Pointer(bp + 144 /* nTerm */))) == 0 { + return 0 + } + return libc.Xmemcmp(tls, pTerm, (*Fts5Buffer)(unsafe.Pointer(bp+120 /* &term */)).Fp, uint64(*(*int32)(unsafe.Pointer(bp + 144 /* nTerm */)))) + }() != 0) { + if (pnRem != 0) && ((*Fts5SegWriter)(unsafe.Pointer(bp /* &writer */)).FnLeafWritten > nRem) { + break + } + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), bp+120 /* &term */, *(*int32)(unsafe.Pointer(bp + 144 /* nTerm */)), pTerm) + bTermWritten = 0 + } + + // Check for key annihilation. + if ((*Fts5SegIter)(unsafe.Pointer(pSegIter)).FnPos == 0) && ((bOldest != 0) || (int32((*Fts5SegIter)(unsafe.Pointer(pSegIter)).FbDel) == 0)) { + continue + } + + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bTermWritten == 0) { + // This is a new term. Append a term to the output segment. + fts5WriteAppendTerm(tls, p, bp /* &writer */, *(*int32)(unsafe.Pointer(bp + 144 /* nTerm */)), pTerm) + bTermWritten = 1 + } + + // Append the rowid to the output + // WRITEPOSLISTSIZE + fts5WriteAppendRowid(tls, p, bp /* &writer */, fts5MultiIterRowid(tls, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */)))) + + if eDetail == FTS5_DETAIL_NONE { + if (*Fts5SegIter)(unsafe.Pointer(pSegIter)).FbDel != 0 { + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (bp /* &writer */ + 8 /* &.writer */ + 8 /* &.buf */), int64(0)) + if (*Fts5SegIter)(unsafe.Pointer(pSegIter)).FnPos > 0 { + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (bp /* &writer */ + 8 /* &.writer */ + 8 /* &.buf */), int64(0)) + } + } + } else { + // Append the position-list data to the output + nPos = (((*Fts5SegIter)(unsafe.Pointer(pSegIter)).FnPos * 2) + int32((*Fts5SegIter)(unsafe.Pointer(pSegIter)).FbDel)) + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), (bp /* &writer */ + 8 /* &.writer */ + 8 /* &.buf */), int64(nPos)) + fts5ChunkIterate(tls, p, pSegIter, bp /* &writer */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, int32) + }{fts5MergeChunkCallback}))) + } + } + + // Flush the last leaf page to disk. Set the output segment b-tree height + // and last leaf page number at the same time. + fts5WriteFinish(tls, p, bp /* &writer */, (pSeg + 8 /* &.pgnoLast */)) + + if fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */))) != 0 { + var i int32 + + // Remove the redundant segments from the %_data table + for i = 0; i < nInput; i++ { + fts5DataRemoveSegment(tls, p, (*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg+uintptr(i)*12)).FiSegid) + } + + // Remove the redundant segments from the input level + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg != nInput { + var nMove int32 = (int32((uint64((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg - nInput)) * uint64(unsafe.Sizeof(Fts5StructureSegment{})))) + libc.Xmemmove(tls, (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg, ((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(nInput)*12), uint64(nMove)) + } + *(*int32)(unsafe.Pointer(pStruct + 16 /* &.nSegment */)) -= (nInput) + *(*int32)(unsafe.Pointer(pLvl + 4 /* &.nSeg */)) -= (nInput) + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge = 0 + if (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast == 0 { + (*Fts5StructureLevel)(unsafe.Pointer(pLvlOut)).FnSeg-- + (*Fts5Structure)(unsafe.Pointer(pStruct)).FnSegment-- + } + } else { + + fts5TrimSegments(tls, p, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */))) + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge = nInput + } + + fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 136 /* pIter */))) + sqlite3Fts5BufferFree(tls, bp+120 /* &term */) + if pnRem != 0 { + *(*int32)(unsafe.Pointer(pnRem)) -= ((*Fts5SegWriter)(unsafe.Pointer(bp /* &writer */)).FnLeafWritten) + } +} + +// Do up to nPg pages of automerge work on the index. +// +// Return true if any changes were actually made, or false otherwise. +func fts5IndexMerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nPg int32, nMin int32) int32 { /* sqlite3.c:225411:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* nRem */)) = nPg + var bRet int32 = 0 + *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) = *(*uintptr)(unsafe.Pointer(ppStruct)) + for (*(*int32)(unsafe.Pointer(bp + 8 /* nRem */)) > 0) && ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + var iLvl int32 // To iterate through levels + var iBestLvl int32 = 0 // Level offering the most input segments + var nBest int32 = 0 // Number of input segments on best level + + // Set iBestLvl to the level to read input segments from. + + for iLvl = 0; iLvl < (*Fts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pStruct */)))).FnLevel; iLvl++ { + var pLvl uintptr = ((*(*uintptr)(unsafe.Pointer(bp /* pStruct */)) + 24 /* &.aLevel */) + uintptr(iLvl)*16) + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge != 0 { + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge > nBest { + iBestLvl = iLvl + nBest = (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnMerge + } + break + } + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg > nBest { + nBest = (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FnSeg + iBestLvl = iLvl + } + } + + // If nBest is still 0, then the index must be empty. + + if (nBest < nMin) && ((*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pStruct */))+24 /* &.aLevel */)+uintptr(iBestLvl)*16)).FnMerge == 0) { + break + } + bRet = 1 + fts5IndexMergeLevel(tls, p, bp /* &pStruct */, iBestLvl, bp+8 /* &nRem */) + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pStruct */))+24 /* &.aLevel */)+uintptr(iBestLvl)*16)).FnMerge == 0) { + fts5StructurePromote(tls, p, (iBestLvl + 1), *(*uintptr)(unsafe.Pointer(bp /* pStruct */))) + } + } + *(*uintptr)(unsafe.Pointer(ppStruct)) = *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) + return bRet +} + +// A total of nLeaf leaf pages of data has just been flushed to a level-0 +// segment. This function updates the write-counter accordingly and, if +// necessary, performs incremental merge work. +// +// If an error occurs, set the Fts5Index.rc error code. If an error has +// already occurred, this function is a no-op. +func fts5IndexAutomerge(tls *libc.TLS, p uintptr, ppStruct uintptr, nLeaf int32) { /* sqlite3.c:225470:13: */ + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FnAutomerge > 0) { + var pStruct uintptr = *(*uintptr)(unsafe.Pointer(ppStruct)) + var nWrite U64 // Initial value of write-counter + var nWork int32 // Number of work-quanta to perform + var nRem int32 // Number of leaf pages left to write + + // Update the write-counter. While doing so, set nWork. + nWrite = (*Fts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter + nWork = (int32(((nWrite + U64(nLeaf)) / U64((*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit)) - (nWrite / U64((*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit)))) + *(*U64)(unsafe.Pointer(pStruct + 8 /* &.nWriteCounter */)) += (U64(nLeaf)) + nRem = (((*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit * nWork) * (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel) + + fts5IndexMerge(tls, p, ppStruct, nRem, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FnAutomerge) + } +} + +func fts5IndexCrisismerge(tls *libc.TLS, p uintptr, ppStruct uintptr) { /* sqlite3.c:225491:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var nCrisis int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FnCrisisMerge + *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) = *(*uintptr)(unsafe.Pointer(ppStruct)) + var iLvl int32 = 0 + + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pStruct */))+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg >= nCrisis) { + fts5IndexMergeLevel(tls, p, bp /* &pStruct */, iLvl, uintptr(0)) + + fts5StructurePromote(tls, p, (iLvl + 1), *(*uintptr)(unsafe.Pointer(bp /* pStruct */))) + iLvl++ + } + *(*uintptr)(unsafe.Pointer(ppStruct)) = *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) +} + +func fts5IndexReturn(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:225509:12: */ + var rc int32 = (*Fts5Index)(unsafe.Pointer(p)).Frc + (*Fts5Index)(unsafe.Pointer(p)).Frc = SQLITE_OK + return rc +} + +type Fts5FlushCtx1 = struct { + FpIdx uintptr + Fwriter Fts5SegWriter +} /* sqlite3.c:225515:9 */ + +type Fts5FlushCtx = Fts5FlushCtx1 /* sqlite3.c:225515:29 */ + +// Buffer aBuf[] contains a list of varints, all small enough to fit +// in a 32-bit integer. Return the size of the largest prefix of this +// list nMax bytes or less in size. +func fts5PoslistPrefix(tls *libc.TLS, aBuf uintptr, nMax int32) int32 { /* sqlite3.c:225526:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var ret int32 + // var dummy U32 at bp, 4 + + ret = sqlite3Fts5GetVarint32(tls, aBuf, bp /* &dummy */) + if ret < nMax { + for 1 != 0 { + var i int32 = sqlite3Fts5GetVarint32(tls, (aBuf + uintptr(ret)), bp /* &dummy */) + if (ret + i) > nMax { + break + } + ret = ret + (i) + } + } + return ret +} + +// Flush the contents of in-memory hash table iHash to a new level-0 +// segment on disk. Also update the corresponding structure record. +// +// If an error occurs, set the Fts5Index.rc error code. If an error has +// already occurred, this function is a no-op. +func fts5FlushOneHash(tls *libc.TLS, p uintptr) { /* sqlite3.c:225547:13: */ + bp := tls.Alloc(176) + defer tls.Free(176) + + var pHash uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpHash + // var pStruct uintptr at bp+168, 8 + + var iSegid int32 + *(*int32)(unsafe.Pointer(bp + 160 /* pgnoLast */)) = 0 // Last leaf page number in segment + + // Obtain a reference to the index structure and allocate a new segment-id + // for the new level-0 segment. + *(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */)) = fts5StructureRead(tls, p) + iSegid = fts5AllocateSegid(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */))) + fts5StructureInvalidate(tls, p) + + if iSegid != 0 { + var pgsz int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail + var pSeg uintptr // New segment within pStruct + var pBuf uintptr // Buffer in which to assemble leaf page + var pPgidx uintptr // Buffer in which to assemble pgidx + + // var writer Fts5SegWriter at bp, 120 + + fts5WriteInit(tls, p, bp /* &writer */, iSegid) + + pBuf = (bp /* &writer */ + 8 /* &.writer */ + 8 /* &.buf */) + pPgidx = (bp /* &writer */ + 8 /* &.writer */ + 24 /* &.pgidx */) + + // fts5WriteInit() should have initialized the buffers to (most likely) + // the maximum space required. + + // Begin scanning through hash table entries. This loop runs once for each + // term/doclist currently stored within the hash table. + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5Index)(unsafe.Pointer(p)).Frc = sqlite3Fts5HashScanInit(tls, pHash, uintptr(0), 0) + } + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (0 == sqlite3Fts5HashScanEof(tls, pHash)) { + // var zTerm uintptr at bp+120, 8 + // Buffer containing term + // var pDoclist uintptr at bp+128, 8 + // Pointer to doclist for this term + // var nDoclist int32 at bp+136, 4 + // Size of doclist in bytes + + // Write the term for this entry to disk. + sqlite3Fts5HashScanEntry(tls, pHash, bp+120 /* &zTerm */, bp+128 /* &pDoclist */, bp+136 /* &nDoclist */) + fts5WriteAppendTerm(tls, p, bp /* &writer */, int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 120 /* zTerm */)))), *(*uintptr)(unsafe.Pointer(bp + 120 /* zTerm */))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + break + } + + if pgsz >= ((((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn + (*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn) + *(*int32)(unsafe.Pointer(bp + 136 /* nDoclist */))) + 1) { + /* The entire doclist will fit on the current leaf. */ + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn)), *(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)), uint64(*(*int32)(unsafe.Pointer(bp + 136 /* nDoclist */)))) + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (*(*int32)(unsafe.Pointer(bp + 136 /* nDoclist */))) + } + + } else { + var iRowid I64 = int64(0) + *(*U64)(unsafe.Pointer(bp + 144 /* iDelta */)) = uint64(0) + var iOff int32 = 0 + + // The entire doclist will not fit on this leaf. The following + // loop iterates through the poslists that make up the current + // doclist. + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iOff < *(*int32)(unsafe.Pointer(bp + 136 /* nDoclist */))) { + iOff = iOff + (int32(sqlite3Fts5GetVarint(tls, (*(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)) + uintptr(iOff)), bp+144 /* &iDelta */))) + iRowid = I64(U64(iRowid) + (*(*U64)(unsafe.Pointer(bp + 144 /* iDelta */)))) + + if (*Fts5SegWriter)(unsafe.Pointer(bp /* &writer */)).FbFirstRowidInPage != 0 { + fts5PutU16(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp), U16((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) // first rowid on page + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), uint64(iRowid))) + (*Fts5SegWriter)(unsafe.Pointer(bp /* &writer */)).FbFirstRowidInPage = U8(0) + fts5WriteDlidxAppend(tls, p, bp /* &writer */, iRowid) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { + break + } + } else { + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), *(*U64)(unsafe.Pointer(bp + 144 /* iDelta */)))) + } + + if eDetail == FTS5_DETAIL_NONE { + if (iOff < *(*int32)(unsafe.Pointer(bp + 136 /* nDoclist */))) && (int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)) + uintptr(iOff)))) == 0) { + *(*U8)(unsafe.Pointer((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(libc.PostIncInt32(&(*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn, 1)))) = U8(0) + iOff++ + if (iOff < *(*int32)(unsafe.Pointer(bp + 136 /* nDoclist */))) && (int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)) + uintptr(iOff)))) == 0) { + *(*U8)(unsafe.Pointer((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr(libc.PostIncInt32(&(*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn, 1)))) = U8(0) + iOff++ + } + } + if ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn + (*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn) >= pgsz { + fts5WriteFlushLeaf(tls, p, bp /* &writer */) + } + } else { + // var bDummy int32 at bp+156, 4 + + // var nPos int32 at bp+152, 4 + + var nCopy int32 = fts5GetPoslistSize(tls, (*(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)) + uintptr(iOff)), bp+152 /* &nPos */, bp+156 /* &bDummy */) + nCopy = nCopy + (*(*int32)(unsafe.Pointer(bp + 152 /* nPos */))) + if (((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn + (*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn) + nCopy) <= pgsz { + /* The entire poslist will fit on the current leaf. So copy + ** it in one go. */ + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn)), (*(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)) + uintptr(iOff)), uint64(nCopy)) + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (nCopy) + } + + } else { + // The entire poslist will not fit on this leaf. So it needs + // to be broken into sections. The only qualification being + // that each varint must be stored contiguously. + var pPoslist uintptr = (*(*uintptr)(unsafe.Pointer(bp + 128 /* pDoclist */)) + uintptr(iOff)) + var iPos int32 = 0 + for (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var nSpace int32 = ((pgsz - (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn) - (*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn) + var n int32 = 0 + if (nCopy - iPos) <= nSpace { + n = (nCopy - iPos) + } else { + n = fts5PoslistPrefix(tls, (pPoslist + uintptr(iPos)), nSpace) + } + + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn)), (pPoslist + uintptr(iPos)), uint64(n)) + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (n) + } + + iPos = iPos + (n) + if ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn + (*Fts5Buffer)(unsafe.Pointer(pPgidx)).Fn) >= pgsz { + fts5WriteFlushLeaf(tls, p, bp /* &writer */) + } + if iPos >= nCopy { + break + } + } + } + iOff = iOff + (nCopy) + } + } + } + + // TODO2: Doclist terminator written here. + // pBuf->p[pBuf->n++] = '\0'; + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + sqlite3Fts5HashScanNext(tls, pHash) + } + } + sqlite3Fts5HashClear(tls, pHash) + fts5WriteFinish(tls, p, bp /* &writer */, bp+160 /* &pgnoLast */) + + // Update the Fts5Structure. It is written back to the database by the + // fts5StructureRelease() call below. + if (*Fts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */)))).FnLevel == 0 { + fts5StructureAddLevel(tls, (p + 52 /* &.rc */), bp+168 /* &pStruct */) + } + fts5StructureExtendLevel(tls, (p + 52 /* &.rc */), *(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */)), 0, 1, 0) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + pSeg = ((*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */)) + 24 /* &.aLevel */))).FaSeg + uintptr(libc.PostIncInt32(&(*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */))+24 /* &.aLevel */))).FnSeg, 1))*12) + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid = iSegid + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst = 1 + (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast = *(*int32)(unsafe.Pointer(bp + 160 /* pgnoLast */)) + (*Fts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */)))).FnSegment++ + } + fts5StructurePromote(tls, p, 0, *(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */))) + } + + fts5IndexAutomerge(tls, p, bp+168 /* &pStruct */, *(*int32)(unsafe.Pointer(bp + 160 /* pgnoLast */))) + fts5IndexCrisismerge(tls, p, bp+168 /* &pStruct */) + fts5StructureWrite(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */))) + fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pStruct */))) +} + +// Flush any data stored in the in-memory hash tables to the database. +func fts5IndexFlush(tls *libc.TLS, p uintptr) { /* sqlite3.c:225701:13: */ + // Unless it is empty, flush the hash table to disk + if (*Fts5Index)(unsafe.Pointer(p)).FnPendingData != 0 { + + (*Fts5Index)(unsafe.Pointer(p)).FnPendingData = 0 + fts5FlushOneHash(tls, p) + } +} + +func fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) uintptr { /* sqlite3.c:225710:22: */ + var pNew uintptr = uintptr(0) + var nByte Sqlite3_int64 = Sqlite3_int64(unsafe.Sizeof(Fts5Structure{})) + var nSeg int32 = (*Fts5Structure)(unsafe.Pointer(pStruct)).FnSegment + var i int32 + + // Figure out if this structure requires optimization. A structure does + // not require optimization if either: + // + // + it consists of fewer than two segments, or + // + all segments are on the same level, or + // + all segments except one are currently inputs to a merge operation. + // + // In the first case, return NULL. In the second, increment the ref-count + // on *pStruct and return a copy of the pointer to it. + if nSeg < 2 { + return uintptr(0) + } + for i = 0; i < (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel; i++ { + var nThis int32 = (*Fts5StructureLevel)(unsafe.Pointer((pStruct + 24 /* &.aLevel */) + uintptr(i)*16)).FnSeg + if (nThis == nSeg) || ((nThis == (nSeg - 1)) && ((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(i)*16)).FnMerge == nThis)) { + fts5StructureRef(tls, pStruct) + return pStruct + } + + } + + nByte = Sqlite3_int64(uint64(nByte) + (uint64((uint64((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel + 1)) * uint64(unsafe.Sizeof(Fts5StructureLevel{}))))) + pNew = sqlite3Fts5MallocZero(tls, (p + 52 /* &.rc */), nByte) + + if pNew != 0 { + var pLvl uintptr + nByte = (Sqlite3_int64(uint64(nSeg) * uint64(unsafe.Sizeof(Fts5StructureSegment{})))) + (*Fts5Structure)(unsafe.Pointer(pNew)).FnLevel = ((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel + 1) + (*Fts5Structure)(unsafe.Pointer(pNew)).FnRef = 1 + (*Fts5Structure)(unsafe.Pointer(pNew)).FnWriteCounter = (*Fts5Structure)(unsafe.Pointer(pStruct)).FnWriteCounter + pLvl = ((pNew + 24 /* &.aLevel */) + uintptr((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel)*16) + (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg = sqlite3Fts5MallocZero(tls, (p + 52 /* &.rc */), nByte) + if (*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg != 0 { + var iLvl int32 + var iSeg int32 + var iSegOut int32 = 0 + // Iterate through all segments, from oldest to newest. Add them to + // the new Fts5Level object so that pLvl->aSeg[0] is the oldest + // segment in the data structure. + for iLvl = ((*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel - 1); iLvl >= 0; iLvl-- { + for iSeg = 0; iSeg < (*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg; iSeg++ { + *(*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer(pLvl)).FaSeg + uintptr(iSegOut)*12)) = *(*Fts5StructureSegment)(unsafe.Pointer((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FaSeg + uintptr(iSeg)*12)) + iSegOut++ + } + } + (*Fts5Structure)(unsafe.Pointer(pNew)).FnSegment = libc.AssignPtrInt32(pLvl+4 /* &.nSeg */, nSeg) + } else { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + + return pNew +} + +func sqlite3Fts5IndexOptimize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:225772:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pStruct uintptr + *(*uintptr)(unsafe.Pointer(bp /* pNew */)) = uintptr(0) + + fts5IndexFlush(tls, p) + pStruct = fts5StructureRead(tls, p) + fts5StructureInvalidate(tls, p) + + if pStruct != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pNew */)) = fts5IndexOptimizeStruct(tls, p, pStruct) + } + fts5StructureRelease(tls, pStruct) + + if *(*uintptr)(unsafe.Pointer(bp /* pNew */)) != 0 { + var iLvl int32 + for iLvl = 0; (*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pNew */))+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg == 0; iLvl++ { + } + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5StructureLevel)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pNew */))+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg > 0) { + *(*int32)(unsafe.Pointer(bp + 8 /* nRem */)) = FTS5_OPT_WORK_UNIT + fts5IndexMergeLevel(tls, p, bp /* &pNew */, iLvl, bp+8 /* &nRem */) + } + + fts5StructureWrite(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + } + + return fts5IndexReturn(tls, p) +} + +// This is called to implement the special "VALUES('merge', $nMerge)" +// INSERT command. +func sqlite3Fts5IndexMerge(tls *libc.TLS, p uintptr, nMerge int32) int32 { /* sqlite3.c:225806:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) = fts5StructureRead(tls, p) + if *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) != 0 { + var nMin int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FnUsermerge + fts5StructureInvalidate(tls, p) + if nMerge < 0 { + var pNew uintptr = fts5IndexOptimizeStruct(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pStruct */))) + fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp /* pStruct */))) + *(*uintptr)(unsafe.Pointer(bp /* pStruct */)) = pNew + nMin = 2 + nMerge = (nMerge * -1) + } + if (*(*uintptr)(unsafe.Pointer(bp /* pStruct */)) != 0) && ((*Fts5Structure)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pStruct */)))).FnLevel != 0) { + if fts5IndexMerge(tls, p, bp /* &pStruct */, nMerge, nMin) != 0 { + fts5StructureWrite(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pStruct */))) + } + } + fts5StructureRelease(tls, *(*uintptr)(unsafe.Pointer(bp /* pStruct */))) + } + return fts5IndexReturn(tls, p) +} + +func fts5AppendRowid(tls *libc.TLS, p uintptr, iDelta I64, pUnused uintptr, pBuf uintptr) { /* sqlite3.c:225828:13: */ + _ = pUnused + sqlite3Fts5BufferAppendVarint(tls, (p + 52 /* &.rc */), pBuf, iDelta) +} + +func fts5AppendPoslist(tls *libc.TLS, p uintptr, iDelta I64, pMulti uintptr, pBuf uintptr) { /* sqlite3.c:225838:13: */ + var nData int32 = (*Fts5Iter)(unsafe.Pointer(pMulti)).Fbase.FnData + var nByte int32 = (((nData + 9) + 9) + FTS5_DATA_ZERO_PADDING) + + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (0 == (func() int32 { + if ((U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + (U32(nByte))) <= (U32((*Fts5Buffer)(unsafe.Pointer(pBuf)).FnSpace)) { + return 0 + } + return sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), pBuf, (uint32((nByte) + (*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn))) + }())) { + { + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn)), uint64(iDelta))) + } + + { + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn)), (uint64(nData * 2)))) + } + + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((pBuf))).Fn)), (*Fts5Iter)(unsafe.Pointer(pMulti)).Fbase.FpData, uint64(nData)) + *(*int32)(unsafe.Pointer(pBuf + 8 /* &.n */)) += (nData) + } + + libc.Xmemset(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)), 0, uint64(FTS5_DATA_ZERO_PADDING)) + } +} + +func fts5DoclistIterNext(tls *libc.TLS, pIter uintptr) { /* sqlite3.c:225856:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var p uintptr = (((*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist + uintptr((*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnSize)) + uintptr((*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist)) + + if p >= (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaEof { + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = uintptr(0) + } else { + // var iDelta I64 at bp, 8 + + p += uintptr(sqlite3Fts5GetVarint(tls, p, bp /* &iDelta */)) + *(*I64)(unsafe.Pointer(pIter + 8 /* &.iRowid */)) += (*(*I64)(unsafe.Pointer(bp /* iDelta */))) + + // Read position list size + if (int32(*(*U8)(unsafe.Pointer(p))) & 0x80) != 0 { + // var nPos int32 at bp+8, 4 + + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnSize = sqlite3Fts5GetVarint32(tls, p, bp+8 /* &nPos */) + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist = (*(*int32)(unsafe.Pointer(bp + 8 /* nPos */)) >> 1) + } else { + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist = ((int32(*(*U8)(unsafe.Pointer(p)))) >> 1) + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnSize = 1 + } + + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = p + if ((*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist + uintptr((*Fts5DoclistIter)(unsafe.Pointer(pIter)).FnPoslist)) > (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaEof { + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = uintptr(0) + } + } +} + +func fts5DoclistIterInit(tls *libc.TLS, pBuf uintptr, pIter uintptr) { /* sqlite3.c:225885:13: */ + libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(Fts5DoclistIter{}))) + if (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn > 0 { + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaPoslist = (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + (*Fts5DoclistIter)(unsafe.Pointer(pIter)).FaEof = ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn)) + fts5DoclistIterNext(tls, pIter) + } +} + +// Swap the contents of buffer *p1 with that of *p2. +func fts5BufferSwap(tls *libc.TLS, p1 uintptr, p2 uintptr) { /* sqlite3.c:225924:13: */ + var tmp = *(*Fts5Buffer)(unsafe.Pointer(p1)) + *(*Fts5Buffer)(unsafe.Pointer(p1)) = *(*Fts5Buffer)(unsafe.Pointer(p2)) + *(*Fts5Buffer)(unsafe.Pointer(p2)) = tmp +} + +func fts5NextRowid(tls *libc.TLS, pBuf uintptr, piOff uintptr, piRowid uintptr) { /* sqlite3.c:225930:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 = *(*int32)(unsafe.Pointer(piOff)) + if i >= (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn { + *(*int32)(unsafe.Pointer(piOff)) = -1 + } else { + // var iVal U64 at bp, 8 + + *(*int32)(unsafe.Pointer(piOff)) = (i + int32(sqlite3Fts5GetVarint(tls, ((*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp+uintptr(i)), bp /* &iVal */))) + *(*I64)(unsafe.Pointer(piRowid)) += I64((*(*U64)(unsafe.Pointer(bp /* iVal */)))) + } +} + +// This is the equivalent of fts5MergePrefixLists() for detail=none mode. +// In this case the buffers consist of a delta-encoded list of rowids only. +func fts5MergeRowidLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBuf uintptr) { /* sqlite3.c:225945:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 16 /* i1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 32 /* i2 */)) = 0 + *(*I64)(unsafe.Pointer(bp + 24 /* iRowid1 */)) = int64(0) + *(*I64)(unsafe.Pointer(bp + 40 /* iRowid2 */)) = int64(0) + var iOut I64 = int64(0) + var p2 uintptr = (aBuf) + // var out Fts5Buffer at bp, 16 + + _ = nBuf + libc.Xmemset(tls, bp /* &out */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + + sqlite3Fts5BufferSize(tls, (p + 52 /* &.rc */), bp /* &out */, (uint32((*Fts5Buffer)(unsafe.Pointer(p1)).Fn + (*Fts5Buffer)(unsafe.Pointer(p2)).Fn))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + return + } + + fts5NextRowid(tls, p1, bp+16 /* &i1 */, bp+24 /* &iRowid1 */) + fts5NextRowid(tls, p2, bp+32 /* &i2 */, bp+40 /* &iRowid2 */) + for (*(*int32)(unsafe.Pointer(bp + 16 /* i1 */)) >= 0) || (*(*int32)(unsafe.Pointer(bp + 32 /* i2 */)) >= 0) { + if (*(*int32)(unsafe.Pointer(bp + 16 /* i1 */)) >= 0) && ((*(*int32)(unsafe.Pointer(bp + 32 /* i2 */)) < 0) || (*(*I64)(unsafe.Pointer(bp + 24 /* iRowid1 */)) < *(*I64)(unsafe.Pointer(bp + 40 /* iRowid2 */)))) { + + { + *(*int32)(unsafe.Pointer(bp /* &out */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp /* &out */))).Fn)), (uint64(*(*I64)(unsafe.Pointer(bp + 24 /* iRowid1 */)) - iOut)))) + } + + iOut = *(*I64)(unsafe.Pointer(bp + 24 /* iRowid1 */)) + fts5NextRowid(tls, p1, bp+16 /* &i1 */, bp+24 /* &iRowid1 */) + } else { + + { + *(*int32)(unsafe.Pointer(bp /* &out */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp /* &out */))).Fn)), (uint64(*(*I64)(unsafe.Pointer(bp + 40 /* iRowid2 */)) - iOut)))) + } + + iOut = *(*I64)(unsafe.Pointer(bp + 40 /* iRowid2 */)) + if (*(*int32)(unsafe.Pointer(bp + 16 /* i1 */)) >= 0) && (*(*I64)(unsafe.Pointer(bp + 24 /* iRowid1 */)) == *(*I64)(unsafe.Pointer(bp + 40 /* iRowid2 */))) { + fts5NextRowid(tls, p1, bp+16 /* &i1 */, bp+24 /* &iRowid1 */) + } + fts5NextRowid(tls, p2, bp+32 /* &i2 */, bp+40 /* &iRowid2 */) + } + } + + fts5BufferSwap(tls, bp /* &out */, p1) + sqlite3Fts5BufferFree(tls, bp /* &out */) +} + +type PrefixMerger1 = struct { + Fiter Fts5DoclistIter + FiPos I64 + FiOff int32 + _ [4]byte + FaPos uintptr + FpNext uintptr +} /* sqlite3.c:225988:9 */ + +type PrefixMerger = PrefixMerger1 /* sqlite3.c:225988:29 */ + +func fts5PrefixMergerInsertByRowid(tls *libc.TLS, ppHead uintptr, p uintptr) { /* sqlite3.c:225997:13: */ + if (*PrefixMerger)(unsafe.Pointer(p)).Fiter.FaPoslist != 0 { + var pp uintptr = ppHead + for (*(*uintptr)(unsafe.Pointer(pp)) != 0) && ((*PrefixMerger)(unsafe.Pointer(p)).Fiter.FiRowid > (*PrefixMerger)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fiter.FiRowid) { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 56 /* &.pNext */) + } + (*PrefixMerger)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = p + } +} + +func fts5PrefixMergerInsertByPosition(tls *libc.TLS, ppHead uintptr, p uintptr) { /* sqlite3.c:226011:13: */ + if (*PrefixMerger)(unsafe.Pointer(p)).FiPos >= int64(0) { + var pp uintptr = ppHead + for (*(*uintptr)(unsafe.Pointer(pp)) != 0) && ((*PrefixMerger)(unsafe.Pointer(p)).FiPos > (*PrefixMerger)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).FiPos) { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 56 /* &.pNext */) + } + (*PrefixMerger)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = p + } +} + +// Array aBuf[] contains nBuf doclists. These are all merged in with the +// doclist in buffer p1. +func fts5MergePrefixLists(tls *libc.TLS, p uintptr, p1 uintptr, nBuf int32, aBuf uintptr) { /* sqlite3.c:226030:13: */ + bp := tls.Alloc(1072) + defer tls.Free(1072) + + // var aMerger [16]PrefixMerger at bp, 1024 + + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = uintptr(0) + var i int32 + var nOut int32 = 0 + *(*Fts5Buffer)(unsafe.Pointer(bp + 1032 /* out */)) = Fts5Buffer{} + *(*Fts5Buffer)(unsafe.Pointer(bp + 1048 /* tmp */)) = Fts5Buffer{} + var iLastRowid I64 = int64(0) + + // Initialize a doclist-iterator for each input buffer. Arrange them in + // a linked-list starting at pHead in ascending order of rowid. Avoid + // linking any iterators already at EOF into the linked list at all. + + libc.Xmemset(tls, bp /* &aMerger[0] */, 0, (uint64(unsafe.Sizeof(PrefixMerger{})) * (uint64(nBuf + 1)))) + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = (bp /* &aMerger */ + uintptr(nBuf)*64) + fts5DoclistIterInit(tls, p1, (*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) /* &.iter */)) + for i = 0; i < nBuf; i++ { + fts5DoclistIterInit(tls, (aBuf + uintptr(i)*16), (bp /* &aMerger */ + uintptr(i)*64 /* &.iter */)) + fts5PrefixMergerInsertByRowid(tls, bp+1024 /* &pHead */, (bp /* &aMerger */ + uintptr(i)*64)) + nOut = nOut + ((*Fts5Buffer)(unsafe.Pointer(aBuf + uintptr(i)*16)).Fn) + } + if nOut == 0 { + return + } + nOut = nOut + (((*Fts5Buffer)(unsafe.Pointer(p1)).Fn + 9) + (10 * nBuf)) + + // The maximum size of the output is equal to the sum of the + // input sizes + 1 varint (9 bytes). The extra varint is because if the + // first rowid in one input is a large negative number, and the first in + // the other a non-negative number, the delta for the non-negative + // number will be larger on disk than the literal integer value + // was. + // + // Or, if the input position-lists are corrupt, then the output might + // include up to (nBuf+1) extra 10-byte positions created by interpreting -1 + // (the value PoslistNext64() uses for EOF) as a position and appending + // it to the output. This can happen at most once for each input + // position-list, hence (nBuf+1) 10 byte paddings. + if sqlite3Fts5BufferSize(tls, (p+52 /* &.rc */), bp+1032 /* &out */, uint32(nOut)) != 0 { + return + } + + for *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) != 0 { + { + { + *(*int32)(unsafe.Pointer(bp + 1032 /* &out */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fn)), (uint64(((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).Fiter.FiRowid) - (iLastRowid))))) + } + (iLastRowid) = (*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).Fiter.FiRowid + } + + if ((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FpNext != 0) && (iLastRowid == (*PrefixMerger)(unsafe.Pointer((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FpNext)).Fiter.FiRowid) { + // Merge data from two or more poslists + *(*I64)(unsafe.Pointer(bp + 1064 /* iPrev */)) = int64(0) + var nTmp int32 = FTS5_DATA_ZERO_PADDING + var nMerge int32 = 0 + var pSave uintptr = *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) + var pThis uintptr = uintptr(0) + var nTail int32 = 0 + + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = uintptr(0) + for (pSave != 0) && ((*PrefixMerger)(unsafe.Pointer(pSave)).Fiter.FiRowid == iLastRowid) { + var pNext uintptr = (*PrefixMerger)(unsafe.Pointer(pSave)).FpNext + (*PrefixMerger)(unsafe.Pointer(pSave)).FiOff = 0 + (*PrefixMerger)(unsafe.Pointer(pSave)).FiPos = int64(0) + (*PrefixMerger)(unsafe.Pointer(pSave)).FaPos = ((*PrefixMerger)(unsafe.Pointer(pSave)).Fiter.FaPoslist + uintptr((*PrefixMerger)(unsafe.Pointer(pSave)).Fiter.FnSize)) + sqlite3Fts5PoslistNext64(tls, (*PrefixMerger)(unsafe.Pointer(pSave)).FaPos, (*PrefixMerger)(unsafe.Pointer((pSave))).Fiter.FnPoslist, (pSave + 40 /* &.iOff */), (pSave + 32 /* &.iPos */)) + nTmp = nTmp + ((*PrefixMerger)(unsafe.Pointer(pSave)).Fiter.FnPoslist + 10) + nMerge++ + fts5PrefixMergerInsertByPosition(tls, bp+1024 /* &pHead */, pSave) + pSave = pNext + } + + if (*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) == uintptr(0)) || ((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FpNext == uintptr(0)) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + break + } + + // See the earlier comment in this function for an explanation of why + // corrupt input position lists might cause the output to consume + // at most nMerge*10 bytes of unexpected space. + if sqlite3Fts5BufferSize(tls, (p+52 /* &.rc */), bp+1048 /* &tmp */, (uint32(nTmp+(nMerge*10)))) != 0 { + break + } + sqlite3Fts5BufferZero(tls, bp+1048 /* &tmp */) + + pThis = *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = (*PrefixMerger)(unsafe.Pointer(pThis)).FpNext + sqlite3Fts5PoslistSafeAppend(tls, bp+1048 /* &tmp */, bp+1064 /* &iPrev */, (*PrefixMerger)(unsafe.Pointer(pThis)).FiPos) + sqlite3Fts5PoslistNext64(tls, (*PrefixMerger)(unsafe.Pointer(pThis)).FaPos, (*PrefixMerger)(unsafe.Pointer((pThis))).Fiter.FnPoslist, (pThis + 40 /* &.iOff */), (pThis + 32 /* &.iPos */)) + fts5PrefixMergerInsertByPosition(tls, bp+1024 /* &pHead */, pThis) + + for (*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FpNext != 0 { + pThis = *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) + if (*PrefixMerger)(unsafe.Pointer(pThis)).FiPos != *(*I64)(unsafe.Pointer(bp + 1064 /* iPrev */)) { + sqlite3Fts5PoslistSafeAppend(tls, bp+1048 /* &tmp */, bp+1064 /* &iPrev */, (*PrefixMerger)(unsafe.Pointer(pThis)).FiPos) + } + sqlite3Fts5PoslistNext64(tls, (*PrefixMerger)(unsafe.Pointer(pThis)).FaPos, (*PrefixMerger)(unsafe.Pointer((pThis))).Fiter.FnPoslist, (pThis + 40 /* &.iOff */), (pThis + 32 /* &.iPos */)) + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = (*PrefixMerger)(unsafe.Pointer(pThis)).FpNext + fts5PrefixMergerInsertByPosition(tls, bp+1024 /* &pHead */, pThis) + } + + if (*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FiPos != *(*I64)(unsafe.Pointer(bp + 1064 /* iPrev */)) { + sqlite3Fts5PoslistSafeAppend(tls, bp+1048 /* &tmp */, bp+1064 /* &iPrev */, (*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FiPos) + } + nTail = ((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).Fiter.FnPoslist - (*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FiOff) + + // WRITEPOSLISTSIZE + + if ((*Fts5Buffer)(unsafe.Pointer(bp+1048 /* &tmp */)).Fn + nTail) > (nTmp - FTS5_DATA_ZERO_PADDING) { + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + break + } + { + *(*int32)(unsafe.Pointer(bp + 1032 /* &out */ + 8 /* &.n */)) += (sqlite3Fts5PutVarint(tls, ((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fn)), (uint64(((*Fts5Buffer)(unsafe.Pointer(bp+1048 /* &tmp */)).Fn + nTail) * 2)))) + } + + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fn)), (*Fts5Buffer)(unsafe.Pointer(bp+1048 /* &tmp */)).Fp, uint64((*Fts5Buffer)(unsafe.Pointer(bp+1048 /* &tmp */)).Fn)) + *(*int32)(unsafe.Pointer(bp + 1032 /* &out */ + 8 /* &.n */)) += ((*Fts5Buffer)(unsafe.Pointer(bp + 1048 /* &tmp */)).Fn) + } + + if nTail > 0 { + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fn)), ((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FaPos + uintptr((*PrefixMerger)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)))).FiOff)), uint64(nTail)) + *(*int32)(unsafe.Pointer(bp + 1032 /* &out */ + 8 /* &.n */)) += (nTail) + } + + } + + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = pSave + for i = 0; i < (nBuf + 1); i++ { + var pX uintptr = (bp /* &aMerger */ + uintptr(i)*64) + if ((*PrefixMerger)(unsafe.Pointer(pX)).Fiter.FaPoslist != 0) && ((*PrefixMerger)(unsafe.Pointer(pX)).Fiter.FiRowid == iLastRowid) { + fts5DoclistIterNext(tls, (pX /* &.iter */)) + fts5PrefixMergerInsertByRowid(tls, bp+1024 /* &pHead */, pX) + } + } + + } else { + // Copy poslist from pHead to output + var pThis uintptr = *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) + var pI uintptr = (pThis /* &.iter */) + { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer((bp + 1032 /* &out */))).Fn)), (*Fts5DoclistIter)(unsafe.Pointer(pI)).FaPoslist, (uint64((*Fts5DoclistIter)(unsafe.Pointer(pI)).FnPoslist + (*Fts5DoclistIter)(unsafe.Pointer(pI)).FnSize))) + *(*int32)(unsafe.Pointer(bp + 1032 /* &out */ + 8 /* &.n */)) += ((*Fts5DoclistIter)(unsafe.Pointer(pI)).FnPoslist + (*Fts5DoclistIter)(unsafe.Pointer(pI)).FnSize) + } + + fts5DoclistIterNext(tls, pI) + *(*uintptr)(unsafe.Pointer(bp + 1024 /* pHead */)) = (*PrefixMerger)(unsafe.Pointer(pThis)).FpNext + fts5PrefixMergerInsertByRowid(tls, bp+1024 /* &pHead */, pThis) + } + } + + sqlite3Fts5BufferFree(tls, p1) + sqlite3Fts5BufferFree(tls, bp+1048 /* &tmp */) + libc.Xmemset(tls, ((*Fts5Buffer)(unsafe.Pointer(bp+1032 /* &out */)).Fp + uintptr((*Fts5Buffer)(unsafe.Pointer(bp+1032 /* &out */)).Fn)), 0, uint64(FTS5_DATA_ZERO_PADDING)) + *(*Fts5Buffer)(unsafe.Pointer(p1)) = *(*Fts5Buffer)(unsafe.Pointer(bp + 1032 /* out */)) +} + +func fts5SetupPrefixIter(tls *libc.TLS, p uintptr, bDesc int32, iIdx int32, pToken uintptr, nToken int32, pColset uintptr, ppIter uintptr) { /* sqlite3.c:226174:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pStruct uintptr + var aBuf uintptr + var nBuf int32 = 32 + var nMerge int32 = 1 + var xMerge uintptr + var xAppend uintptr + if (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { + xMerge = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) + }{fts5MergeRowidLists})) + xAppend = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, I64, uintptr, uintptr) + }{fts5AppendRowid})) + } else { + nMerge = (FTS5_MERGE_NLIST - 1) + nBuf = (nMerge * 8) // Sufficient to merge (16^8)==(2^32) lists + xMerge = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) + }{fts5MergePrefixLists})) + xAppend = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, I64, uintptr, uintptr) + }{fts5AppendPoslist})) + } + + aBuf = fts5IdxMalloc(tls, p, (int64(uint64(unsafe.Sizeof(Fts5Buffer{})) * uint64(nBuf)))) + pStruct = fts5StructureRead(tls, p) + + if (aBuf != 0) && (pStruct != 0) { + var flags int32 = ((FTS5INDEX_QUERY_SCAN | + FTS5INDEX_QUERY_SKIPEMPTY) | + FTS5INDEX_QUERY_NOOUTPUT) + var i int32 + var iLastRowid I64 = int64(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)) = uintptr(0) // Iterator used to gather data from index + var pData uintptr + // var doclist Fts5Buffer at bp, 16 + + *(*int32)(unsafe.Pointer(bp + 28 /* bNewTerm */)) = 1 + + libc.Xmemset(tls, bp /* &doclist */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + if iIdx != 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* dummy */)) = 0 + var f2 int32 = (FTS5INDEX_QUERY_SKIPEMPTY | FTS5INDEX_QUERY_NOOUTPUT) + *(*U8)(unsafe.Pointer(pToken)) = U8('0') + fts5MultiIterNew(tls, p, pStruct, f2, pColset, pToken, nToken, -1, 0, bp+16 /* &p1 */) + fts5IterSetOutputCb(tls, (p + 52 /* &.rc */), *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */))) + for ; fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */))) == 0; fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)), bp+24 /* &dummy */) { + var pSeg uintptr = ((*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).FaFirst+1*4)).FiFirst)*120) + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)) + 56 /* &.xSetOutputs */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)), pSeg) + if (*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FnData != 0 { + (*(*func(*libc.TLS, uintptr, I64, uintptr, uintptr))(unsafe.Pointer(&xAppend)))(tls, p, ((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FiRowid - iLastRowid), *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)), bp /* &doclist */) + iLastRowid = (*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FiRowid + } + } + fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */))) + } + + *(*U8)(unsafe.Pointer(pToken)) = (U8('0' + iIdx)) + fts5MultiIterNew(tls, p, pStruct, flags, pColset, pToken, nToken, -1, 0, bp+16 /* &p1 */) + fts5IterSetOutputCb(tls, (p + 52 /* &.rc */), *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */))) + for ; fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */))) == 0; fts5MultiIterNext2(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)), bp+28 /* &bNewTerm */) { + var pSeg uintptr = ((*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).FaFirst+1*4)).FiFirst)*120) + var nTerm int32 = (*Fts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fn + var pTerm uintptr = (*Fts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fp + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)) + 56 /* &.xSetOutputs */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)), pSeg) + + if *(*int32)(unsafe.Pointer(bp + 28 /* bNewTerm */)) != 0 { + if (nTerm < nToken) || (libc.Xmemcmp(tls, pToken, pTerm, uint64(nToken)) != 0) { + break + } + } + + if (*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FnData == 0 { + continue + } + + if ((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FiRowid <= iLastRowid) && ((*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fn > 0) { + for i = 0; ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fn != 0); i++ { + var i1 int32 = (i * nMerge) + var iStore int32 + + for iStore = i1; iStore < (i1 + nMerge); iStore++ { + if (*Fts5Buffer)(unsafe.Pointer(aBuf+uintptr(iStore)*16)).Fn == 0 { + fts5BufferSwap(tls, bp /* &doclist */, (aBuf + uintptr(iStore)*16)) + sqlite3Fts5BufferZero(tls, bp /* &doclist */) + break + } + } + if iStore == (i1 + nMerge) { + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(&xMerge)))(tls, p, bp /* &doclist */, nMerge, (aBuf + uintptr(i1)*16)) + for iStore = i1; iStore < (i1 + nMerge); iStore++ { + sqlite3Fts5BufferZero(tls, (aBuf + uintptr(iStore)*16)) + } + } + } + iLastRowid = int64(0) + } + + (*(*func(*libc.TLS, uintptr, I64, uintptr, uintptr))(unsafe.Pointer(&xAppend)))(tls, p, ((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FiRowid - iLastRowid), *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)), bp /* &doclist */) + iLastRowid = (*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))).Fbase.FiRowid + } + + for i = 0; i < nBuf; i = i + (nMerge) { + var iFree int32 + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(&xMerge)))(tls, p, bp /* &doclist */, nMerge, (aBuf + uintptr(i)*16)) + } + for iFree = i; iFree < (i + nMerge); iFree++ { + sqlite3Fts5BufferFree(tls, (aBuf + uintptr(iFree)*16)) + } + } + fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */))) + + pData = fts5IdxMalloc(tls, p, (int64((uint64(unsafe.Sizeof(Fts5Data{})) + uint64((*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fn)) + uint64(FTS5_DATA_ZERO_PADDING)))) + if pData != 0 { + (*Fts5Data)(unsafe.Pointer(pData)).Fp = (pData + 1*16) + (*Fts5Data)(unsafe.Pointer(pData)).Fnn = libc.AssignPtrInt32(pData+12 /* &.szLeaf */, (*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fn) + if (*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fn != 0 { + libc.Xmemcpy(tls, (*Fts5Data)(unsafe.Pointer(pData)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fp, uint64((*Fts5Buffer)(unsafe.Pointer(bp /* &doclist */)).Fn)) + } + fts5MultiIterNew2(tls, p, pData, bDesc, ppIter) + } + sqlite3Fts5BufferFree(tls, bp /* &doclist */) + } + + fts5StructureRelease(tls, pStruct) + Xsqlite3_free(tls, aBuf) +} + +// Indicate that all subsequent calls to sqlite3Fts5IndexWrite() pertain +// to the document with rowid iRowid. +func sqlite3Fts5IndexBeginWrite(tls *libc.TLS, p uintptr, bDelete int32, iRowid I64) int32 { /* sqlite3.c:226311:12: */ + + // Allocate the hash table if it has not already been allocated + if (*Fts5Index)(unsafe.Pointer(p)).FpHash == uintptr(0) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = sqlite3Fts5HashNew(tls, (*Fts5Index)(unsafe.Pointer(p)).FpConfig, (p + 24 /* &.pHash */), (p + 32 /* &.nPendingData */)) + } + + // Flush the hash table to disk if required + if ((iRowid < (*Fts5Index)(unsafe.Pointer(p)).FiWriteRowid) || + ((iRowid == (*Fts5Index)(unsafe.Pointer(p)).FiWriteRowid) && ((*Fts5Index)(unsafe.Pointer(p)).FbDelete == 0))) || + ((*Fts5Index)(unsafe.Pointer(p)).FnPendingData > (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FnHashSize) { + fts5IndexFlush(tls, p) + } + + (*Fts5Index)(unsafe.Pointer(p)).FiWriteRowid = iRowid + (*Fts5Index)(unsafe.Pointer(p)).FbDelete = bDelete + return fts5IndexReturn(tls, p) +} + +// Commit data to disk. +func sqlite3Fts5IndexSync(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:226335:12: */ + + fts5IndexFlush(tls, p) + sqlite3Fts5IndexCloseReader(tls, p) + return fts5IndexReturn(tls, p) +} + +// Discard any data stored in the in-memory hash tables. Do not write it +// to the database. Additionally, assume that the contents of the %_data +// table may have changed on disk. So any in-memory caches of %_data +// records must be invalidated. +func sqlite3Fts5IndexRollback(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:226348:12: */ + sqlite3Fts5IndexCloseReader(tls, p) + fts5IndexDiscardData(tls, p) + fts5StructureInvalidate(tls, p) + // assert( p->rc==SQLITE_OK ); + return SQLITE_OK +} + +// The %_data table is completely empty when this function is called. This +// function populates it with the initial structure objects for each index, +// and the initial version of the "averages" record (a zero-byte blob). +func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:226361:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + // var s Fts5Structure at bp, 40 + + fts5StructureInvalidate(tls, p) + fts5IndexDiscardData(tls, p) + libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Fts5Structure{}))) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+756 /* "" */, 0) + fts5StructureWrite(tls, p, bp /* &s */) + return fts5IndexReturn(tls, p) +} + +// Open a new Fts5Index handle. If the bCreate argument is true, create +// and initialize the underlying %_data table. +// +// If successful, set *pp to point to the new object and return SQLITE_OK. +// Otherwise, set *pp to NULL and return an SQLite error code. +func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uintptr, pzErr uintptr) int32 { /* sqlite3.c:226378:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + var p uintptr // New object + + *(*uintptr)(unsafe.Pointer(pp)) = libc.AssignUintptr(&p, sqlite3Fts5MallocZero(tls, bp+8 /* &rc */, int64(unsafe.Sizeof(Fts5Index{})))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig + (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33336 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, + pConfig, ts+23317 /* "data" */, ts+33344 /* "id INTEGER PRIMA..." */, 0, pzErr) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10213, /* "idx" */ + ts+33379, /* "segid, term, pgn..." */ + 1, pzErr) + } + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5IndexReinit(tls, p) + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != 0 { + sqlite3Fts5IndexClose(tls, p) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Close a handle opened by an earlier call to sqlite3Fts5IndexOpen(). +func sqlite3Fts5IndexClose(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:226419:12: */ + var rc int32 = SQLITE_OK + if p != 0 { + + fts5StructureInvalidate(tls, p) + Xsqlite3_finalize(tls, (*Fts5Index)(unsafe.Pointer(p)).FpWriter) + Xsqlite3_finalize(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDeleter) + Xsqlite3_finalize(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter) + Xsqlite3_finalize(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter) + Xsqlite3_finalize(tls, (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect) + Xsqlite3_finalize(tls, (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion) + sqlite3Fts5HashFree(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash) + Xsqlite3_free(tls, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl) + Xsqlite3_free(tls, p) + } + return rc +} + +// Argument p points to a buffer containing utf-8 text that is n bytes in +// size. Return the number of bytes in the nChar character prefix of the +// buffer, or 0 if there are less than nChar characters in total. +func sqlite3Fts5IndexCharlenToBytelen(tls *libc.TLS, p uintptr, nByte int32, nChar int32) int32 { /* sqlite3.c:226442:12: */ + var n int32 = 0 + var i int32 + for i = 0; i < nChar; i++ { + if n >= nByte { + return 0 + } // Input contains fewer than nChar chars + if int32(uint8(*(*int8)(unsafe.Pointer(p + uintptr(libc.PostIncInt32(&n, 1)))))) >= 0xc0 { + if n >= nByte { + return 0 + } + for (int32(*(*int8)(unsafe.Pointer(p + uintptr(n)))) & 0xc0) == 0x80 { + n++ + if n >= nByte { + if (i + 1) == nChar { + break + } + return 0 + } + } + } + } + return n +} + +// pIn is a UTF-8 encoded string, nIn bytes in size. Return the number of +// unicode characters in the string. +func fts5IndexCharlen(tls *libc.TLS, pIn uintptr, nIn int32) int32 { /* sqlite3.c:226469:12: */ + var nChar int32 = 0 + var i int32 = 0 + for i < nIn { + if int32(uint8(*(*int8)(unsafe.Pointer(pIn + uintptr(libc.PostIncInt32(&i, 1)))))) >= 0xc0 { + for (i < nIn) && ((int32(*(*int8)(unsafe.Pointer(pIn + uintptr(i)))) & 0xc0) == 0x80) { + i++ + } + } + nChar++ + } + return nChar +} + +// Insert or remove data to or from the index. Each time a document is +// added to or removed from the index, this function is called one or more +// times. +// +// For an insert, it must be called once for each token in the new document. +// If the operation is a delete, it must be called (at least) once for each +// unique token in the document with an iCol value less than zero. The iPos +// argument is ignored for a delete. +func sqlite3Fts5IndexWrite(tls *libc.TLS, p uintptr, iCol int32, iPos int32, pToken uintptr, nToken int32) int32 { /* sqlite3.c:226491:12: */ + var i int32 // Used to iterate through indexes + var rc int32 = SQLITE_OK // Return code + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + + // Add the entry to the main terms index. + rc = sqlite3Fts5HashWrite(tls, + (*Fts5Index)(unsafe.Pointer(p)).FpHash, (*Fts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, int8('0'), pToken, nToken) + + for i = 0; (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix) && (rc == SQLITE_OK); i++ { + var nChar int32 = *(*int32)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr(i)*4)) + var nByte int32 = sqlite3Fts5IndexCharlenToBytelen(tls, pToken, nToken, nChar) + if nByte != 0 { + rc = sqlite3Fts5HashWrite(tls, (*Fts5Index)(unsafe.Pointer(p)).FpHash, + (*Fts5Index)(unsafe.Pointer(p)).FiWriteRowid, iCol, iPos, (int8(('0' + i) + 1)), pToken, + nByte) + } + } + + return rc +} + +// Open a new iterator to iterate though all rowid that match the +// specified token or token prefix. +func sqlite3Fts5IndexQuery(tls *libc.TLS, p uintptr, pToken uintptr, nToken int32, flags int32, pColset uintptr, ppIter uintptr) int32 { /* sqlite3.c:226527:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) = uintptr(0) + *(*Fts5Buffer)(unsafe.Pointer(bp /* buf */)) = Fts5Buffer{} + + // If the QUERY_SCAN flag is set, all other flags must be clear. + + if sqlite3Fts5BufferSize(tls, (p+52 /* &.rc */), bp /* &buf */, (uint32(nToken+1))) == 0 { + var iIdx int32 = 0 // Index to search + var iPrefixIdx int32 = 0 // +1 prefix index + if nToken != 0 { + libc.Xmemcpy(tls, ((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp + 1), pToken, uint64(nToken)) + } + + // Figure out which index to search and set iIdx accordingly. If this + // is a prefix query for which there is no prefix index, set iIdx to + // greater than pConfig->nPrefix to indicate that the query will be + // satisfied by scanning multiple terms in the main index. + // + // If the QUERY_TEST_NOIDX flag was specified, then this must be a + // prefix-query. Instead of using a prefix-index (if one exists), + // evaluate the prefix query using the main FTS index. This is used + // for internal sanity checking by the integrity-check in debug + // mode only. + if (flags & FTS5INDEX_QUERY_PREFIX) != 0 { + var nChar int32 = fts5IndexCharlen(tls, pToken, nToken) + for iIdx = 1; iIdx <= (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix; iIdx++ { + var nIdxChar int32 = *(*int32)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix + uintptr((iIdx-1))*4)) + if nIdxChar == nChar { + break + } + if nIdxChar == (nChar + 1) { + iPrefixIdx = iIdx + } + } + } + + if iIdx <= (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix { + // Straight index lookup + var pStruct uintptr = fts5StructureRead(tls, p) + *(*U8)(unsafe.Pointer((*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp)) = (U8('0' + iIdx)) + if pStruct != 0 { + fts5MultiIterNew(tls, p, pStruct, (flags | FTS5INDEX_QUERY_SKIPEMPTY), + pColset, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp, (nToken + 1), -1, 0, bp+16 /* &pRet */) + fts5StructureRelease(tls, pStruct) + } + } else { + // Scan multiple terms in the main index + var bDesc int32 = (libc.Bool32((flags & FTS5INDEX_QUERY_DESC) != 0)) + fts5SetupPrefixIter(tls, p, bDesc, iPrefixIdx, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp, (nToken + 1), pColset, bp+16 /* &pRet */) + + fts5IterSetOutputCb(tls, (p + 52 /* &.rc */), *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var pSeg uintptr = ((*(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)))).FaFirst+1*4)).FiFirst)*120) + if (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0 { + (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) + 56 /* &.xSetOutputs */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)), pSeg) + } + } + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + sqlite3Fts5IterClose(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */))) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) = uintptr(0) + sqlite3Fts5IndexCloseReader(tls, p) + } + + *(*uintptr)(unsafe.Pointer(ppIter)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) + sqlite3Fts5BufferFree(tls, bp /* &buf */) + } + return fts5IndexReturn(tls, p) +} + +// Return true if the iterator passed as the only argument is at EOF. +// Move to the next matching rowid. +func sqlite3Fts5IterNext(tls *libc.TLS, pIndexIter uintptr) int32 { /* sqlite3.c:226611:12: */ + var pIter uintptr = pIndexIter + + fts5MultiIterNext(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex, pIter, 0, int64(0)) + return fts5IndexReturn(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex) +} + +// Move to the next matching term/rowid. Used by the fts5vocab module. +func sqlite3Fts5IterNextScan(tls *libc.TLS, pIndexIter uintptr) int32 { /* sqlite3.c:226621:12: */ + var pIter uintptr = pIndexIter + var p uintptr = (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex + + fts5MultiIterNext(tls, p, pIter, 0, int64(0)) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + var pSeg uintptr = ((pIter + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(pIter)).FaFirst+1*4)).FiFirst)*120) + if ((*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf != 0) && (int32(*(*U8)(unsafe.Pointer((*Fts5SegIter)(unsafe.Pointer(pSeg)).Fterm.Fp))) != '0') { + fts5DataRelease(tls, (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf) + (*Fts5SegIter)(unsafe.Pointer(pSeg)).FpLeaf = uintptr(0) + (*Fts5Iter)(unsafe.Pointer(pIter)).Fbase.FbEof = U8(1) + } + } + + return fts5IndexReturn(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex) +} + +// Move to the next matching rowid that occurs at or after iMatch. The +// definition of "at or after" depends on whether this iterator iterates +// in ascending or descending rowid order. +func sqlite3Fts5IterNextFrom(tls *libc.TLS, pIndexIter uintptr, iMatch I64) int32 { /* sqlite3.c:226645:12: */ + var pIter uintptr = pIndexIter + fts5MultiIterNextFrom(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex, pIter, iMatch) + return fts5IndexReturn(tls, (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex) +} + +// Return the current term. +func sqlite3Fts5IterTerm(tls *libc.TLS, pIndexIter uintptr, pn uintptr) uintptr { /* sqlite3.c:226654:19: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var n int32 at bp, 4 + + var z uintptr = fts5MultiIterTerm(tls, pIndexIter, bp /* &n */) + + *(*int32)(unsafe.Pointer(pn)) = (*(*int32)(unsafe.Pointer(bp /* n */)) - 1) + return func() uintptr { + if z != 0 { + return (z + 1) + } + return uintptr(0) + }() +} + +// Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery(). +func sqlite3Fts5IterClose(tls *libc.TLS, pIndexIter uintptr) { /* sqlite3.c:226665:13: */ + if pIndexIter != 0 { + var pIter uintptr = pIndexIter + var pIndex uintptr = (*Fts5Iter)(unsafe.Pointer(pIter)).FpIndex + fts5MultiIterFree(tls, pIter) + sqlite3Fts5IndexCloseReader(tls, pIndex) + } +} + +// Read and decode the "averages" record from the database. +// +// Parameter anSize must point to an array of size nCol, where nCol is +// the number of user defined columns in the FTS table. +func sqlite3Fts5IndexGetAverages(tls *libc.TLS, p uintptr, pnRow uintptr, anSize uintptr) int32 { /* sqlite3.c:226680:12: */ + var nCol int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FnCol + var pData uintptr + + *(*I64)(unsafe.Pointer(pnRow)) = int64(0) + libc.Xmemset(tls, anSize, 0, (uint64(unsafe.Sizeof(I64(0))) * uint64(nCol))) + pData = fts5DataRead(tls, p, int64(FTS5_AVERAGES_ROWID)) + if ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Fts5Data)(unsafe.Pointer(pData)).Fnn != 0) { + var i int32 = 0 + var iCol int32 + i = i + (int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr(i)), pnRow))) + for iCol = 0; (i < (*Fts5Data)(unsafe.Pointer(pData)).Fnn) && (iCol < nCol); iCol++ { + i = i + (int32(sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pData)).Fp + uintptr(i)), (anSize + uintptr(iCol)*8)))) + } + } + + fts5DataRelease(tls, pData) + return fts5IndexReturn(tls, p) +} + +// Replace the current "averages" record with the contents of the buffer +// supplied as the second argument. +func sqlite3Fts5IndexSetAverages(tls *libc.TLS, p uintptr, pData uintptr, nData int32) int32 { /* sqlite3.c:226704:12: */ + + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), pData, nData) + return fts5IndexReturn(tls, p) +} + +// Return the total number of blocks this module has read from the %_data +// table since it was created. +func sqlite3Fts5IndexReads(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:226714:12: */ + return (*Fts5Index)(unsafe.Pointer(p)).FnRead +} + +// Set the 32-bit cookie value stored at the start of all structure +// records to the value passed as the second argument. +// +// Return SQLITE_OK if successful, or an SQLite error code if an error +// occurs. +func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3.c:226725:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig // Configuration object + // var aCookie [4]U8 at bp, 4 + // Binary representation of iNew + *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)) = uintptr(0) + + sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) + + rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, + ts+33026 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) + if rc == SQLITE_OK { + Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) + rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))) + } + + return rc +} + +func sqlite3Fts5IndexLoadConfig(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:226745:12: */ + var pStruct uintptr + pStruct = fts5StructureRead(tls, p) + fts5StructureRelease(tls, pStruct) + return fts5IndexReturn(tls, p) +} + +// ************************************************************************ +// +// +// Below this point is the implementation of the integrity-check +// functionality. + +// Return a simple checksum value based on the arguments. +func sqlite3Fts5IndexEntryCksum(tls *libc.TLS, iRowid I64, iCol int32, iPos int32, iIdx int32, pTerm uintptr, nTerm int32) U64 { /* sqlite3.c:226762:12: */ + var i int32 + var ret U64 = U64(iRowid) + ret = ret + ((ret << 3) + U64(iCol)) + ret = ret + ((ret << 3) + U64(iPos)) + if iIdx >= 0 { + ret = ret + ((ret << 3) + (U64('0' + iIdx))) + } + for i = 0; i < nTerm; i++ { + ret = ret + ((ret << 3) + U64(*(*int8)(unsafe.Pointer(pTerm + uintptr(i))))) + } + return ret +} + +// Check that: +// +// 1) All leaves of pSeg between iFirst and iLast (inclusive) exist and +// contain zero terms. +// 2) All leaves of pSeg between iNoRowid and iLast (inclusive) exist and +// contain zero rowids. +func fts5IndexIntegrityCheckEmpty(tls *libc.TLS, p uintptr, pSeg uintptr, iFirst int32, iNoRowid int32, iLast int32) { /* sqlite3.c:226980:13: */ + var i int32 + + // Now check that the iter.nEmpty leaves following the current leaf + // (a) exist and (b) contain no terms. + for i = iFirst; ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i <= iLast); i++ { + var pLeaf uintptr = fts5DataRead(tls, p, (((((I64((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(i)))) + if pLeaf != 0 { + if !((*Fts5Data)(unsafe.Pointer((pLeaf))).FszLeaf >= (*Fts5Data)(unsafe.Pointer((pLeaf))).Fnn) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + if (i >= iNoRowid) && (0 != (int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp)))) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + fts5DataRelease(tls, pLeaf) + } +} + +func fts5IntegrityCheckPgidx(tls *libc.TLS, p uintptr, pLeaf uintptr) { /* sqlite3.c:227001:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var iTermOff int32 = 0 + var ii int32 + + *(*Fts5Buffer)(unsafe.Pointer(bp + 8 /* buf1 */)) = Fts5Buffer{} + *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = Fts5Buffer{} + + ii = (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf + for (ii < (*Fts5Data)(unsafe.Pointer(pLeaf)).Fnn) && ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) { + var res int32 + var iOff int32 + // var nIncr int32 at bp, 4 + + ii = ii + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(ii)), bp /* &nIncr */)) + iTermOff = iTermOff + (*(*int32)(unsafe.Pointer(bp /* nIncr */))) + iOff = iTermOff + + if iOff >= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else if iTermOff == *(*int32)(unsafe.Pointer(bp /* nIncr */)) { + // var nByte int32 at bp+4, 4 + + iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), bp+4 /* &nByte */)) + if (iOff + *(*int32)(unsafe.Pointer(bp + 4 /* nByte */))) > (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), bp+8 /* &buf1 */, *(*int32)(unsafe.Pointer(bp + 4 /* nByte */)), ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff))) + } + } else { + // var nKeep int32 at bp+24, 4 + + // var nByte int32 at bp+28, 4 + + iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), bp+24 /* &nKeep */)) + iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), bp+28 /* &nByte */)) + if (*(*int32)(unsafe.Pointer(bp + 24 /* nKeep */)) > (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &buf1 */)).Fn) || ((iOff + *(*int32)(unsafe.Pointer(bp + 28 /* nByte */))) > (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + (*Fts5Buffer)(unsafe.Pointer(bp + 8 /* &buf1 */)).Fn = *(*int32)(unsafe.Pointer(bp + 24 /* nKeep */)) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+8 /* &buf1 */, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nByte */))), ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff))) + } + + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + res = fts5BufferCompare(tls, bp+8 /* &buf1 */, bp+32 /* &buf2 */) + if res <= 0 { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + } + sqlite3Fts5BufferSet(tls, (p + 52 /* &.rc */), bp+32 /* &buf2 */, (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &buf1 */)).Fn, (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &buf1 */)).Fp) + } + + sqlite3Fts5BufferFree(tls, bp+8 /* &buf1 */) + sqlite3Fts5BufferFree(tls, bp+32 /* &buf2 */) +} + +func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* sqlite3.c:227051:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig + *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) + var rc2 int32 + var iIdxPrevLeaf int32 = ((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst - 1) + var iDlidxPrevLeaf int32 = (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast + + if (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst == 0 { + return + } + + fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, + + ts+33423, /* "SELECT segid, te..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) + + // Iterate through the b-tree hierarchy. + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)))) { + var iRow I64 // Rowid for this leaf + var pLeaf uintptr // Data for this leaf + + var zIdxTerm uintptr = Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 1) + var nIdxTerm int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 1) + var iIdxLeaf int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 2) + var bIdxDlidx int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 3) + + // If the leaf in question has already been trimmed from the segment, + // ignore this b-tree entry. Otherwise, load it into memory. + if iIdxLeaf < (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst { + continue + } + iRow = (((((I64((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(iIdxLeaf))) + pLeaf = fts5LeafRead(tls, p, iRow) + if pLeaf == uintptr(0) { + break + } + + // Check that the leaf contains at least one term, and that it is equal + // to or larger than the split-key in zIdxTerm. Also check that if there + // is also a rowid pointer within the leaf page header, it points to a + // location before the term. + if (*Fts5Data)(unsafe.Pointer(pLeaf)).Fnn <= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + var iOff int32 // Offset of first term on leaf + var iRowidOff int32 // Offset of first rowid on leaf + // var nTerm int32 at bp+32, 4 + // Size of term on leaf in bytes + var res int32 // Comparison of term and split-key + + iOff = fts5LeafFirstTermOff(tls, pLeaf) + iRowidOff = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp)) + if (iRowidOff >= iOff) || (iOff >= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), bp+32 /* &nTerm */)) + res = func() int32 { + if (func() int32 { + if (*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */))) < (nIdxTerm) { + return *(*int32)(unsafe.Pointer(bp + 32 /* nTerm */)) + } + return nIdxTerm + }()) == 0 { + return 0 + } + return libc.Xmemcmp(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), zIdxTerm, func() uint64 { + if (*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */))) < (nIdxTerm) { + return uint64(*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */))) + } + return uint64(nIdxTerm) + }()) + }() + if res == 0 { + res = (*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */)) - nIdxTerm) + } + if res < 0 { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + + fts5IntegrityCheckPgidx(tls, p, pLeaf) + } + fts5DataRelease(tls, pLeaf) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + break + } + + // Now check that the iter.nEmpty leaves following the current leaf + // (a) exist and (b) contain no terms. + fts5IndexIntegrityCheckEmpty(tls, + p, pSeg, (iIdxPrevLeaf + 1), (iDlidxPrevLeaf + 1), (iIdxLeaf - 1)) + if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { + break + } + + // If there is a doclist-index, check that it looks right. + if bIdxDlidx != 0 { + var pDlidx uintptr = uintptr(0) // For iterating through doclist index + var iPrevLeaf int32 = iIdxLeaf + var iSegid int32 = (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid + var iPg int32 = 0 + var iKey I64 + + for pDlidx = fts5DlidxIterInit(tls, p, 0, iSegid, iIdxLeaf); fts5DlidxIterEof(tls, p, pDlidx) == 0; fts5DlidxIterNext(tls, p, pDlidx) { + + // Check any rowid-less pages that occur before the current leaf. + for iPg = (iPrevLeaf + 1); iPg < fts5DlidxIterPgno(tls, pDlidx); iPg++ { + iKey = (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(iPg))) + pLeaf = fts5DataRead(tls, p, iKey) + if pLeaf != 0 { + if (int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp))) != 0 { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + fts5DataRelease(tls, pLeaf) + } + } + iPrevLeaf = fts5DlidxIterPgno(tls, pDlidx) + + // Check that the leaf page indicated by the iterator really does + // contain the rowid suggested by the same. + iKey = (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(iPrevLeaf))) + pLeaf = fts5DataRead(tls, p, iKey) + if pLeaf != 0 { + // var iRowid I64 at bp+40, 8 + + var iRowidOff int32 = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp)) + + if iRowidOff >= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iRowidOff)), bp+40 /* &iRowid */) + if *(*I64)(unsafe.Pointer(bp + 40 /* iRowid */)) != fts5DlidxIterRowid(tls, pDlidx) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + fts5DataRelease(tls, pLeaf) + } + } + + iDlidxPrevLeaf = iPg + fts5DlidxIterFree(tls, pDlidx) + + } else { + iDlidxPrevLeaf = (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast + // TODO: Check there is no doclist index + } + + iIdxPrevLeaf = iIdxLeaf + } + + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) + if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { + (*Fts5Index)(unsafe.Pointer(p)).Frc = rc2 + } + + // Page iter.iLeaf must now be the rightmost leaf-page in the segment +} + +// Run internal checks to ensure that the FTS index (a) is internally +// consistent and (b) contains entries for which the XOR of the checksums +// as calculated by sqlite3Fts5IndexEntryCksum() is cksum. +// +// Return SQLITE_CORRUPT if any of the internal checks fail, or if the +// checksum does not match. Return SQLITE_OK if all checks pass without +// error, or some other SQLite error code if another error (e.g. OOM) +// occurs. +func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCksum int32) int32 { /* sqlite3.c:227196:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FeDetail + var cksum2 U64 = uint64(0) // Checksum based on contents of indexes + *(*Fts5Buffer)(unsafe.Pointer(bp + 16 /* poslist */)) = Fts5Buffer{} // Buffer used to hold a poslist + // var pIter uintptr at bp, 8 + // Used to iterate through entire index + var pStruct uintptr // Index structure + + var flags int32 = FTS5INDEX_QUERY_NOOUTPUT + + // Load the FTS index structure + pStruct = fts5StructureRead(tls, p) + + // Check that the internal nodes of each segment match the leaves + if pStruct != 0 { + var iLvl int32 + var iSeg int32 + for iLvl = 0; iLvl < (*Fts5Structure)(unsafe.Pointer(pStruct)).FnLevel; iLvl++ { + for iSeg = 0; iSeg < (*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FnSeg; iSeg++ { + var pSeg uintptr = ((*Fts5StructureLevel)(unsafe.Pointer((pStruct+24 /* &.aLevel */)+uintptr(iLvl)*16)).FaSeg + uintptr(iSeg)*12) + fts5IndexIntegrityCheckSegment(tls, p, pSeg) + } + } + } + + // The cksum argument passed to this function is a checksum calculated + // based on all expected entries in the FTS index (including prefix index + // entries). This block checks that a checksum calculated based on the + // actual contents of FTS index is identical. + // + // Two versions of the same checksum are calculated. The first (stack + // variable cksum2) based on entries extracted from the full-text index + // while doing a linear scan of each individual index in turn. + // + // As each term visited by the linear scans, a separate query for the + // same term is performed. cksum3 is calculated based on the entries + // extracted by these queries. + for fts5MultiIterNew(tls, p, pStruct, flags, uintptr(0), uintptr(0), 0, -1, 0, bp /* &pIter */); fts5MultiIterEof(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) == 0; fts5MultiIterNext(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), 0, int64(0)) { + // var n int32 at bp+8, 4 + // Size of term in bytes + *(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) = int64(0) // Position read from poslist + *(*int32)(unsafe.Pointer(bp + 32 /* iOff */)) = 0 // Offset within poslist + var iRowid I64 = fts5MultiIterRowid(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + var z uintptr = fts5MultiIterTerm(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), bp+8 /* &n */) + + // If this is a new term, query for it. Update cksum3 with the results. + + if eDetail == FTS5_DETAIL_NONE { + if 0 == fts5MultiIterIsEmpty(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) { + cksum2 = cksum2 ^ (sqlite3Fts5IndexEntryCksum(tls, iRowid, 0, 0, -1, z, *(*int32)(unsafe.Pointer(bp + 8 /* n */)))) + } + } else { + (*Fts5Buffer)(unsafe.Pointer(bp + 16 /* &poslist */)).Fn = 0 + fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*120), uintptr(0), bp+16 /* &poslist */) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+33509 /* "\x00\x00\x00\x00" */) + for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fn, bp+32 /* &iOff */, bp+40 /* &iPos */) { + var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) >> 32)) + var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) & int64(0x7FFFFFFF))) + cksum2 = cksum2 ^ (sqlite3Fts5IndexEntryCksum(tls, iRowid, iCol, iTokOff, -1, z, *(*int32)(unsafe.Pointer(bp + 8 /* n */)))) + } + } + } + + fts5MultiIterFree(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + if (((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bUseCksum != 0)) && (cksum != cksum2) { + (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + + fts5StructureRelease(tls, pStruct) + sqlite3Fts5BufferFree(tls, bp+16 /* &poslist */) + return fts5IndexReturn(tls, p) +} + +// ************************************************************************ +// +// +// Below this point is the implementation of the fts5_decode() scalar +// function only. + +// This is called as part of registering the FTS5 module with database +// connection db. It registers several user-defined scalar functions useful +// with FTS5. +// +// If successful, SQLITE_OK is returned. If an error occurs, some other +// SQLite error code is returned instead. +func sqlite3Fts5IndexInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:227757:12: */ + return SQLITE_OK + _ = db + return int32(0) +} + +func sqlite3Fts5IndexReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:227783:12: */ + + if fts5IndexDataVersion(tls, p) != (*Fts5Index)(unsafe.Pointer(p)).FiStructVersion { + fts5StructureInvalidate(tls, p) + } + return fts5IndexReturn(tls, p) +} + +// 2014 Jun 09 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is an SQLite module implementing full-text search. + +// #include "fts5Int.h" + +// This variable is set to false when running tests for which the on disk +// structures should not be corrupt. Otherwise, true. If it is false, extra +// assert() conditions in the fts5 code are activated - conditions that are +// only true if it is guaranteed that the fts5 database is not corrupt. + +type Fts5Auxdata1 = struct { + FpAux uintptr + FpPtr uintptr + FxDelete uintptr + FpNext uintptr +} /* sqlite3.c:213118:9 */ + +// 2014 Jun 09 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is an SQLite module implementing full-text search. + +// #include "fts5Int.h" + +// This variable is set to false when running tests for which the on disk +// structures should not be corrupt. Otherwise, true. If it is false, extra +// assert() conditions in the fts5 code are activated - conditions that are +// only true if it is guaranteed that the fts5 database is not corrupt. + +type Fts5Auxdata = Fts5Auxdata1 /* sqlite3.c:227820:28 */ +type Fts5Auxiliary1 = struct { + FpGlobal uintptr + FzFunc uintptr + FpUserData uintptr + FxFunc Fts5_extension_function + FxDestroy uintptr + FpNext uintptr +} /* sqlite3.c:213118:9 */ + +type Fts5Auxiliary = Fts5Auxiliary1 /* sqlite3.c:227821:30 */ +type Fts5Cursor1 = struct { + Fbase Sqlite3_vtab_cursor + FpNext uintptr + FaColumnSize uintptr + FiCsrId I64 + FePlan int32 + FbDesc int32 + FiFirstRowid I64 + FiLastRowid I64 + FpStmt uintptr + FpExpr uintptr + FpSorter uintptr + Fcsrflags int32 + _ [4]byte + FiSpecial I64 + FzRank uintptr + FzRankArgs uintptr + FpRank uintptr + FnRankArg int32 + _ [4]byte + FapRankArg uintptr + FpRankArgStmt uintptr + FpAux uintptr + FpAuxdata uintptr + FaInstIter uintptr + FnInstAlloc int32 + FnInstCount int32 + FaInst uintptr +} /* sqlite3.c:213118:9 */ + +type Fts5Cursor = Fts5Cursor1 /* sqlite3.c:227822:27 */ +type Fts5FullTable1 = struct { + Fp Fts5Table + FpStorage uintptr + FpGlobal uintptr + FpSortCsr uintptr +} /* sqlite3.c:227823:9 */ + +type Fts5FullTable = Fts5FullTable1 /* sqlite3.c:227823:30 */ +type Fts5Sorter1 = struct { + FpStmt uintptr + FiRowid I64 + FaPoslist uintptr + FnIdx int32 + FaIdx [1]int32 +} /* sqlite3.c:213118:9 */ + +type Fts5Sorter = Fts5Sorter1 /* sqlite3.c:227824:27 */ +type Fts5TokenizerModule1 = struct { + FzName uintptr + FpUserData uintptr + Fx Fts5_tokenizer + FxDestroy uintptr + FpNext uintptr +} /* sqlite3.c:213118:9 */ + +type Fts5TokenizerModule = Fts5TokenizerModule1 /* sqlite3.c:227825:36 */ + +// NOTES ON TRANSACTIONS: +// +// SQLite invokes the following virtual table methods as transactions are +// opened and closed by the user: +// +// xBegin(): Start of a new transaction. +// xSync(): Initial part of two-phase commit. +// xCommit(): Final part of two-phase commit. +// xRollback(): Rollback the transaction. +// +// Anything that is required as part of a commit that may fail is performed +// in the xSync() callback. Current versions of SQLite ignore any errors +// returned by xCommit(). +// +// And as sub-transactions are opened/closed: +// +// xSavepoint(int S): Open savepoint S. +// xRelease(int S): Commit and close savepoint S. +// xRollbackTo(int S): Rollback to start of savepoint S. +// +// During a write-transaction the fts5_index.c module may cache some data +// in-memory. It is flushed to disk whenever xSync(), xRelease() or +// xSavepoint() is called. And discarded whenever xRollback() or xRollbackTo() +// is called. +// +// Additionally, if SQLITE_DEBUG is defined, an instance of the following +// structure is used to record the current transaction state. This information +// is not required, but it is used in the assert() statements executed by +// function fts5CheckTransactionState() (see below). +type Fts5TransactionState = struct { + FeState int32 + FiSavepoint int32 +} /* sqlite3.c:227858:1 */ + +type Fts5MatchPhrase = struct { + FpPoslist uintptr + FnTerm int32 + _ [4]byte +} /* sqlite3.c:227915:1 */ + +// Return true if pTab is a contentless table. +func fts5IsContentless(tls *libc.TLS, pTab uintptr) int32 { /* sqlite3.c:228099:12: */ + return (libc.Bool32((*Fts5Config)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FeContent == FTS5_CONTENT_NONE)) +} + +// Delete a virtual table handle allocated by fts5InitVtab(). +func fts5FreeVtab(tls *libc.TLS, pTab uintptr) { /* sqlite3.c:228106:13: */ + if pTab != 0 { + sqlite3Fts5IndexClose(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + sqlite3Fts5StorageClose(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + sqlite3Fts5ConfigFree(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig) + Xsqlite3_free(tls, pTab) + } +} + +// The xDisconnect() virtual table method. +func fts5DisconnectMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:228118:12: */ + fts5FreeVtab(tls, pVtab) + return SQLITE_OK +} + +// The xDestroy() virtual table method. +func fts5DestroyMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:228126:12: */ + var pTab uintptr = pVtab + var rc int32 = sqlite3Fts5DropAll(tls, (*Fts5Table)(unsafe.Pointer(pTab)).FpConfig) + if rc == SQLITE_OK { + fts5FreeVtab(tls, pVtab) + } + return rc +} + +// This function is the implementation of both the xConnect and xCreate +// methods of the FTS3 virtual table. +// +// The argv[] array contains the following: +// +// argv[0] -> module name ("fts5") +// argv[1] -> database name +// argv[2] -> table name +// argv[...] -> "column name" and other module argument fields. +func fts5InitVtab(tls *libc.TLS, bCreate int32, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* sqlite3.c:228146:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pGlobal uintptr = pAux + var azConfig uintptr = argv + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */)) = uintptr(0) // Results of parsing argc/argv + var pTab uintptr = uintptr(0) // New virtual table object + + // Allocate the new vtab object and parse the configuration + pTab = sqlite3Fts5MallocZero(tls, bp /* &rc */, int64(unsafe.Sizeof(Fts5FullTable{}))) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5ConfigParse(tls, pGlobal, db, argc, azConfig, bp+8 /* &pConfig */, pzErr) + + } + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig = *(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).FpGlobal = pGlobal + } + + // Open the index sub-system + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5IndexOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */)), bCreate, (pTab /* &.p */ + 32 /* &.pIndex */), pzErr) + } + + // Open the storage sub-system + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageOpen(tls, + *(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */)), (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex, bCreate, (pTab + 40 /* &.pStorage */), pzErr) + } + + // Call sqlite3_declare_vtab() + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5ConfigDeclareVtab(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */))) + } + + // Load the initial configuration + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + + (*Fts5Config)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */)))).FpzErrmsg = pzErr + *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5IndexLoadConfig(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + sqlite3Fts5IndexRollback(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + (*Fts5Config)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pConfig */)))).FpzErrmsg = uintptr(0) + } + + if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK { + fts5FreeVtab(tls, pTab) + pTab = uintptr(0) + } else if bCreate != 0 { + + } + *(*uintptr)(unsafe.Pointer(ppVTab)) = pTab + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// The xConnect() and xCreate() methods for the virtual table. All the +// work is done in function fts5InitVtab(). +func fts5ConnectMethod(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:228212:12: */ + return fts5InitVtab(tls, 0, db, pAux, argc, argv, ppVtab, pzErr) +} + +func fts5CreateMethod(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:228222:12: */ + return fts5InitVtab(tls, 1, db, pAux, argc, argv, ppVtab, pzErr) +} + +// The different query plans. + +// Set the SQLITE_INDEX_SCAN_UNIQUE flag in pIdxInfo->flags. Unless this +// extension is currently being used by a version of SQLite too old to +// support index-info flags. In that case this function is a no-op. +func fts5SetUniqueFlag(tls *libc.TLS, pIdxInfo uintptr) { /* sqlite3.c:228248:13: */ + { + *(*int32)(unsafe.Pointer(pIdxInfo + 80 /* &.idxFlags */)) |= (SQLITE_INDEX_SCAN_UNIQUE) + + } +} + +func fts5UsePatternMatch(tls *libc.TLS, pConfig uintptr, p uintptr) int32 { /* sqlite3.c:228259:12: */ + + if ((*Fts5Config)(unsafe.Pointer(pConfig)).FePattern == FTS5_PATTERN_GLOB) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == FTS5_PATTERN_GLOB) { + return 1 + } + if ((*Fts5Config)(unsafe.Pointer(pConfig)).FePattern == FTS5_PATTERN_LIKE) && + ((int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == FTS5_PATTERN_LIKE) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == FTS5_PATTERN_GLOB)) { + return 1 + } + return 0 +} + +// Implementation of the xBestIndex method for FTS5 tables. Within the +// WHERE constraint, it searches for the following: +// +// 1. A MATCH constraint against the table column. +// 2. A MATCH constraint against the "rank" column. +// 3. A MATCH constraint against some other column. +// 4. An == constraint against the rowid column. +// 5. A < or <= constraint against the rowid column. +// 6. A > or >= constraint against the rowid column. +// +// Within the ORDER BY, the following are supported: +// +// 5. ORDER BY rank [ASC|DESC] +// 6. ORDER BY rowid [ASC|DESC] +// +// Information for the xFilter call is passed via both the idxNum and +// idxStr variables. Specifically, idxNum is a bitmask of the following +// flags used to encode the ORDER BY clause: +// +// FTS5_BI_ORDER_RANK +// FTS5_BI_ORDER_ROWID +// FTS5_BI_ORDER_DESC +// +// idxStr is used to encode data from the WHERE clause. For each argument +// passed to the xFilter method, the following is appended to idxStr: +// +// Match against table column: "m" +// Match against rank column: "r" +// Match against other column: "M" +// LIKE against other column: "L" +// GLOB against other column: "G" +// Equality constraint against the rowid: "=" +// A < or <= against the rowid: "<" +// A > or >= against the rowid: ">" +// +// This function ensures that there is at most one "r" or "=". And that if +// there exists an "=" then there is no "<" or ">". +// +// Costs are assigned as follows: +// +// a) If an unusable MATCH operator is present in the WHERE clause, the +// cost is unconditionally set to 1e50 (a really big number). +// +// a) If a MATCH operator is present, the cost depends on the other +// constraints also present. As follows: +// +// * No other constraints: cost=1000.0 +// * One rowid range constraint: cost=750.0 +// * Both rowid range constraints: cost=500.0 +// * An == rowid constraint: cost=100.0 +// +// b) Otherwise, if there is no MATCH: +// +// * No other constraints: cost=1000000.0 +// * One rowid range constraint: cost=750000.0 +// * Both rowid range constraints: cost=250000.0 +// * An == rowid constraint: cost=10.0 +// +// Costs are not modified by the ORDER BY clause. +func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* sqlite3.c:228337:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTab uintptr = pVTab + var pConfig uintptr = (*Fts5Table)(unsafe.Pointer(pTab)).FpConfig + var nCol int32 = (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol + var idxFlags int32 = 0 // Parameter passed through to xFilter() + var i int32 + var idxStr uintptr + var iIdxStr int32 = 0 + var iCons int32 = 0 + + var bSeenEq int32 = 0 + var bSeenGt int32 = 0 + var bSeenLt int32 = 0 + var bSeenMatch int32 = 0 + var bSeenRank int32 = 0 + + if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { + (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, + ts+33514 /* "recursively defi..." */, 0) + return SQLITE_ERROR + } + + idxStr = Xsqlite3_malloc(tls, (((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint * 8) + 1)) + if idxStr == uintptr(0) { + return SQLITE_NOMEM + } + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxStr = idxStr + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FneedToFreeIdxStr = 1 + + for i = 0; i < (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint; i++ { + var p uintptr = ((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint + uintptr(i)*12) + var iCol int32 = (*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn + if (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) || + ((int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) && (iCol >= nCol)) { + // A MATCH operator or equivalent + if (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) == 0) || (iCol < 0) { + // As there exists an unusable MATCH constraint this is an + // unusable plan. Set a prohibitively high cost. + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = 1e50 + + *(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr))) = int8(0) + return SQLITE_OK + } else { + if iCol == (nCol + 1) { + if bSeenRank != 0 { + continue + } + *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('r') + bSeenRank = 1 + } else if iCol >= 0 { + bSeenMatch = 1 + *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4090 /* "%d" */, libc.VaList(bp, iCol)) + idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) + + } + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1) + } + } else if (*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0 { + if ((iCol >= 0) && (iCol < nCol)) && (fts5UsePatternMatch(tls, pConfig, p) != 0) { + + *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = func() int8 { + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == FTS5_PATTERN_LIKE { + return int8('L') + } + return int8('G') + }() + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4090 /* "%d" */, libc.VaList(bp+8, iCol)) + idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) + + } else if ((bSeenEq == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ)) && (iCol < 0) { + *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('=') + bSeenEq = 1 + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) + } + } + } + + if bSeenEq == 0 { + for i = 0; i < (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint; i++ { + var p uintptr = ((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint + uintptr(i)*12) + if ((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn < 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0) { + var op int32 = int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) + if (op == SQLITE_INDEX_CONSTRAINT_LT) || (op == SQLITE_INDEX_CONSTRAINT_LE) { + if bSeenLt != 0 { + continue + } + *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('<') + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) + bSeenLt = 1 + } else if (op == SQLITE_INDEX_CONSTRAINT_GT) || (op == SQLITE_INDEX_CONSTRAINT_GE) { + if bSeenGt != 0 { + continue + } + *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('>') + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) + bSeenGt = 1 + } + } + } + } + *(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr))) = int8(0) + + // Set idxFlags flags for the ORDER BY clause + if (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FnOrderBy == 1 { + var iSort int32 = (*sqlite3_index_orderby)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy)).FiColumn + if (iSort == ((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol + 1)) && (bSeenMatch != 0) { + idxFlags = idxFlags | (FTS5_BI_ORDER_RANK) + } else if iSort == -1 { + idxFlags = idxFlags | (FTS5_BI_ORDER_ROWID) + } + if ((idxFlags) & (FTS5_BI_ORDER_RANK | FTS5_BI_ORDER_ROWID)) != 0 { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).ForderByConsumed = 1 + if (*sqlite3_index_orderby)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy)).Fdesc != 0 { + idxFlags = idxFlags | (FTS5_BI_ORDER_DESC) + } + } + } + + // Calculate the estimated cost based on the flags set in idxFlags. + if bSeenEq != 0 { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = func() float64 { + if bSeenMatch != 0 { + return 100.0 + } + return 10.0 + }() + if bSeenMatch == 0 { + fts5SetUniqueFlag(tls, pInfo) + } + } else if (bSeenLt != 0) && (bSeenGt != 0) { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = func() float64 { + if bSeenMatch != 0 { + return 500.0 + } + return 250000.0 + }() + } else if (bSeenLt != 0) || (bSeenGt != 0) { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = func() float64 { + if bSeenMatch != 0 { + return 750.0 + } + return 750000.0 + }() + } else { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = func() float64 { + if bSeenMatch != 0 { + return 1000.0 + } + return 1000000.0 + }() + } + + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = idxFlags + return SQLITE_OK +} + +func fts5NewTransaction(tls *libc.TLS, pTab uintptr) int32 { /* sqlite3.c:228472:12: */ + var pCsr uintptr + for pCsr = (*Fts5Global)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpGlobal)).FpCsr; pCsr != 0; pCsr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpNext { + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab == pTab { + return SQLITE_OK + } + } + return sqlite3Fts5StorageReset(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) +} + +// Implementation of xOpen method. +func fts5OpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* sqlite3.c:228483:12: */ + var pTab uintptr = pVTab + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + var pCsr uintptr = uintptr(0) // New cursor object + var nByte Sqlite3_int64 // Bytes of space to allocate + var rc int32 // Return code + + rc = fts5NewTransaction(tls, pTab) + if rc == SQLITE_OK { + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Cursor{})) + (uint64((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol) * uint64(unsafe.Sizeof(int32(0)))))) + pCsr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pCsr != 0 { + var pGlobal uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).FpGlobal + libc.Xmemset(tls, pCsr, 0, Size_t(nByte)) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize = (pCsr + 1*184) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpNext = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpCsr + (*Fts5Global)(unsafe.Pointer(pGlobal)).FpCsr = pCsr + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId = libc.PreIncInt64(&(*Fts5Global)(unsafe.Pointer(pGlobal)).FiNextId, 1) + } else { + rc = SQLITE_NOMEM + } + } + *(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr + return rc +} + +func fts5StmtType(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:228509:12: */ + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_SCAN { + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FbDesc != 0 { + return FTS5_STMT_SCAN_DESC + } + return FTS5_STMT_SCAN_ASC + } + return FTS5_STMT_LOOKUP +} + +// This function is called after the cursor passed as the only argument +// is moved to point at a different row. It clears all cached data +// specific to the previous row stored by the cursor object. +func fts5CsrNewrow(tls *libc.TLS, pCsr uintptr) { /* sqlite3.c:228521:13: */ + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (((FTS5CSR_REQUIRE_CONTENT | FTS5CSR_REQUIRE_DOCSIZE) | FTS5CSR_REQUIRE_INST) | FTS5CSR_REQUIRE_POSLIST) +} + +func fts5FreeCursorComponents(tls *libc.TLS, pCsr uintptr) { /* sqlite3.c:228530:13: */ + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var pData uintptr + var pNext uintptr + + Xsqlite3_free(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInstIter) + Xsqlite3_free(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst) + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt != 0 { + var eStmt int32 = fts5StmtType(tls, pCsr) + sqlite3Fts5StorageStmtRelease(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, eStmt, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + } + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0 { + var pSorter uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter + Xsqlite3_finalize(tls, (*Fts5Sorter)(unsafe.Pointer(pSorter)).FpStmt) + Xsqlite3_free(tls, pSorter) + } + + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan != FTS5_PLAN_SOURCE { + sqlite3Fts5ExprFree(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + } + + for pData = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAuxdata; pData != 0; pData = pNext { + pNext = (*Fts5Auxdata)(unsafe.Pointer(pData)).FpNext + if (*Fts5Auxdata)(unsafe.Pointer(pData)).FxDelete != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pData + 16 /* &.xDelete */))))(tls, (*Fts5Auxdata)(unsafe.Pointer(pData)).FpPtr) + } + Xsqlite3_free(tls, pData) + } + + Xsqlite3_finalize(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt) + Xsqlite3_free(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg) + + if ((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_FREE_ZRANK)) != 0 { + Xsqlite3_free(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank) + Xsqlite3_free(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs) + } + + sqlite3Fts5IndexCloseReader(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + libc.Xmemset(tls, (pCsr + 32 /* &.ePlan */), 0, (uint64(unsafe.Sizeof(Fts5Cursor{})) - (uint64((int64((pCsr + 32 /* &.ePlan */)) - int64(pCsr)) / 1)))) +} + +// Close the cursor. For additional information see the documentation +// on the xClose method of the virtual table interface. +func fts5CloseMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228574:12: */ + if pCursor != 0 { + var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + var pCsr uintptr = pCursor + var pp uintptr + + fts5FreeCursorComponents(tls, pCsr) + // Remove the cursor from the Fts5Global.pCsr list + for pp = ((*Fts5FullTable)(unsafe.Pointer(pTab)).FpGlobal + 72 /* &.pCsr */); (*(*uintptr)(unsafe.Pointer(pp))) != pCsr; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 8 /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(pp)) = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpNext + + Xsqlite3_free(tls, pCsr) + } + return SQLITE_OK +} + +func fts5SorterNext(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:228590:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSorter uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter + var rc int32 + + rc = Xsqlite3_step(tls, (*Fts5Sorter)(unsafe.Pointer(pSorter)).FpStmt) + if rc == SQLITE_DONE { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_EOF) + } else if rc == SQLITE_ROW { + var a uintptr + var aBlob uintptr + var nBlob int32 + var i int32 + var iOff int32 = 0 + rc = SQLITE_OK + + (*Fts5Sorter)(unsafe.Pointer(pSorter)).FiRowid = Xsqlite3_column_int64(tls, (*Fts5Sorter)(unsafe.Pointer(pSorter)).FpStmt, 0) + nBlob = Xsqlite3_column_bytes(tls, (*Fts5Sorter)(unsafe.Pointer(pSorter)).FpStmt, 1) + aBlob = libc.AssignUintptr(&a, Xsqlite3_column_blob(tls, (*Fts5Sorter)(unsafe.Pointer(pSorter)).FpStmt, 1)) + + // nBlob==0 in detail=none mode. + if nBlob > 0 { + for i = 0; i < ((*Fts5Sorter)(unsafe.Pointer(pSorter)).FnIdx - 1); i++ { + // var iVal int32 at bp, 4 + + a += uintptr(sqlite3Fts5GetVarint32(tls, a, bp /* &iVal */)) + iOff = iOff + (*(*int32)(unsafe.Pointer(bp /* iVal */))) + *(*int32)(unsafe.Pointer((pSorter + 28 /* &.aIdx */) + uintptr(i)*4)) = iOff + } + *(*int32)(unsafe.Pointer((pSorter + 28 /* &.aIdx */) + uintptr(i)*4)) = (int32((int64((aBlob + uintptr(nBlob))) - int64(a)) / 1)) + (*Fts5Sorter)(unsafe.Pointer(pSorter)).FaPoslist = a + } + + fts5CsrNewrow(tls, pCsr) + } + + return rc +} + +// Set the FTS5CSR_REQUIRE_RESEEK flag on all FTS5_PLAN_MATCH cursors +// open on table pTab. +func fts5TripCursors(tls *libc.TLS, pTab uintptr) { /* sqlite3.c:228633:13: */ + var pCsr uintptr + for pCsr = (*Fts5Global)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpGlobal)).FpCsr; pCsr != 0; pCsr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpNext { + if ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_MATCH) && + ((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab == pTab) { + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_REQUIRE_RESEEK) + } + } +} + +// If the REQUIRE_RESEEK flag is set on the cursor passed as the first +// argument, close and reopen all Fts5IndexIter iterators that the cursor +// is using. Then attempt to move the cursor to a rowid equal to or laster +// (in the cursors sort order - ASC or DESC) than the current rowid. +// +// If the new rowid is not equal to the old, set output parameter *pbSkip +// to 1 before returning. Otherwise, leave it unchanged. +// +// Return SQLITE_OK if successful or if no reseek was required, or an +// error code if an error occurred. +func fts5CursorReseek(tls *libc.TLS, pCsr uintptr, pbSkip uintptr) int32 { /* sqlite3.c:228656:12: */ + var rc int32 = SQLITE_OK + + if ((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_REQUIRE_RESEEK)) != 0 { + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var bDesc int32 = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FbDesc + var iRowid I64 = sqlite3Fts5ExprRowid(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + + rc = sqlite3Fts5ExprFirst(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex, iRowid, bDesc) + if (rc == SQLITE_OK) && (iRowid != sqlite3Fts5ExprRowid(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr)) { + *(*int32)(unsafe.Pointer(pbSkip)) = 1 + } + + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) &= (libc.CplInt32(FTS5CSR_REQUIRE_RESEEK)) + fts5CsrNewrow(tls, pCsr) + if sqlite3Fts5ExprEof(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) != 0 { + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_EOF) + *(*int32)(unsafe.Pointer(pbSkip)) = 1 + } + } + return rc +} + +// Advance the cursor to the next row in the table that matches the +// search criteria. +// +// Return SQLITE_OK if nothing goes wrong. SQLITE_OK is returned +// even if we reach end-of-file. The fts5EofMethod() will be called +// subsequently to determine whether or not an EOF was hit. +func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pCsr uintptr = pCursor + var rc int32 + + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan < 3 { + *(*int32)(unsafe.Pointer(bp + 8 /* bSkip */)) = 0 + if (libc.AssignInt32(&rc, fts5CursorReseek(tls, pCsr, bp+8 /* &bSkip */)) != 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* bSkip */)) != 0) { + return rc + } + rc = sqlite3Fts5ExprNext(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid) + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (sqlite3Fts5ExprEof(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr)) + fts5CsrNewrow(tls, pCsr) + } else { + switch (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan { + case FTS5_PLAN_SPECIAL: + { + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_EOF) + rc = SQLITE_OK + break + + } + fallthrough + + case FTS5_PLAN_SORTED_MATCH: + { + rc = fts5SorterNext(tls, pCsr) + break + + } + fallthrough + + default: + { + var pConfig uintptr = (*Fts5Table)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FpConfig + (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock++ + rc = Xsqlite3_step(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock-- + if rc != SQLITE_ROW { + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_EOF) + rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + if rc != SQLITE_OK { + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, + ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + } + } else { + rc = SQLITE_OK + } + break + + } + } + } + + return rc +} + +func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt uintptr, va uintptr) int32 { /* sqlite3.c:228741:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) = uintptr(0) + var rc int32 + var zSql uintptr + var ap Va_list + _ = ap + + ap = va + zSql = Xsqlite3_vmprintf(tls, zFmt, ap) + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, + uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) + if rc != SQLITE_OK { + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + } + Xsqlite3_free(tls, zSql) + } + + _ = ap + *(*uintptr)(unsafe.Pointer(ppStmt)) = *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) + return rc +} + +func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int32) int32 { /* sqlite3.c:228770:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + var pSorter uintptr + var nPhrase int32 + var nByte Sqlite3_int64 + var rc int32 + var zRank uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank + var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs + + nPhrase = sqlite3Fts5ExprPhraseCount(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Sorter{})) + (uint64(unsafe.Sizeof(int32(0))) * (uint64(nPhrase - 1))))) + pSorter = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSorter == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pSorter, 0, Size_t(nByte)) + (*Fts5Sorter)(unsafe.Pointer(pSorter)).FnIdx = nPhrase + + // TODO: It would be better to have some system for reusing statement + // handles here, rather than preparing a new one for each query. But that + // is not possible as SQLite reference counts the virtual table objects. + // And since the statement required here reads from this very virtual + // table, saving it creates a circular reference. + // + // If SQLite a built-in statement cache, this wouldn't be a problem. + rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, + ts+33553, /* "SELECT rowid, ra..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, + func() uintptr { + if zRankArgs != 0 { + return ts + 13325 /* ", " */ + } + return ts + 756 /* "" */ + }(), + func() uintptr { + if zRankArgs != 0 { + return zRankArgs + } + return ts + 756 /* "" */ + }(), + func() uintptr { + if bDesc != 0 { + return ts + 33608 /* "DESC" */ + } + return ts + 33613 /* "ASC" */ + }())) + + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter + if rc == SQLITE_OK { + + (*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = pCsr + rc = fts5SorterNext(tls, pCsr) + (*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr = uintptr(0) + } + + if rc != SQLITE_OK { + Xsqlite3_finalize(tls, (*Fts5Sorter)(unsafe.Pointer(pSorter)).FpStmt) + Xsqlite3_free(tls, pSorter) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = uintptr(0) + } + + return rc +} + +func fts5CursorFirst(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int32) int32 { /* sqlite3.c:228822:12: */ + var rc int32 + var pExpr uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr + rc = sqlite3Fts5ExprFirst(tls, pExpr, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid, bDesc) + if sqlite3Fts5ExprEof(tls, pExpr) != 0 { + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_EOF) + } + fts5CsrNewrow(tls, pCsr) + return rc +} + +// Process a "special" query. A special query is identified as one with a +// MATCH expression that begins with a '*' character. The remainder of +// the text passed to the MATCH operator are used as the special query +// parameters. +func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) int32 { /* sqlite3.c:228839:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 = SQLITE_OK // Return code + var z uintptr = zQuery // Special query text + var n int32 // Number of bytes in text at z + + for int32(*(*int8)(unsafe.Pointer(z))) == ' ' { + z++ + } + for n = 0; (*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(n)))) != ' '); n++ { + } + + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL + + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+33617 /* "reads" */, z, n)) { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4172 /* "id" */, z, n)) { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId + } else { + // An unrecognized directive. Return an error message. + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33623 /* "unknown special ..." */, libc.VaList(bp, n, z)) + rc = SQLITE_ERROR + } + + return rc +} + +// Search for an auxiliary function named zName that can be used with table +// pTab. If one is found, return a pointer to the corresponding Fts5Auxiliary +// structure. Otherwise, if no such function exists, return NULL. +func fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) uintptr { /* sqlite3.c:228874:22: */ + var pAux uintptr + + for pAux = (*Fts5Global)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpGlobal)).FpAux; pAux != 0; pAux = (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpNext { + if Xsqlite3_stricmp(tls, zName, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FzFunc) == 0 { + return pAux + } + } + + // No function of the specified name was found. Return 0. + return uintptr(0) +} + +func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:228886:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pAux uintptr = uintptr(0) + var zRank uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank + var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs + + if zRankArgs != 0 { + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+33651 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + if zSql != 0 { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, + uint32(SQLITE_PREPARE_PERSISTENT), bp+24 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zSql) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) { + var nByte Sqlite3_int64 + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg))) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg = sqlite3Fts5MallocZero(tls, bp+16 /* &rc */, nByte) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var i int32 + for i = 0; i < (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg; i++ { + *(*uintptr)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), i) + } + } + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt = *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) + + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + pAux = fts5FindAuxiliary(tls, pTab, zRank) + if pAux == uintptr(0) { + + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33661 /* "no such function..." */, libc.VaList(bp+8, zRank)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR + } + } + + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRank = pAux + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uintptr) int32 { /* sqlite3.c:228937:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var rc int32 = SQLITE_OK + if pRank != 0 { + var z uintptr = Xsqlite3_value_text(tls, pRank) + *(*uintptr)(unsafe.Pointer(bp + 8 /* zRank */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zRankArgs */)) = uintptr(0) + + if z == uintptr(0) { + if Xsqlite3_value_type(tls, pRank) == SQLITE_NULL { + rc = SQLITE_ERROR + } + } else { + rc = sqlite3Fts5ConfigParseRank(tls, z, bp+8 /* &zRank */, bp+16 /* &zRankArgs */) + } + if rc == SQLITE_OK { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = *(*uintptr)(unsafe.Pointer(bp + 8 /* zRank */)) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = *(*uintptr)(unsafe.Pointer(bp + 16 /* zRankArgs */)) + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) + } else if rc == SQLITE_ERROR { + (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, + ts+33682 /* "parse error in r..." */, libc.VaList(bp, z)) + } + } else { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs + } else { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32065 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) + } + } + return rc +} + +func fts5GetRowidLimit(tls *libc.TLS, pVal uintptr, iDefault I64) I64 { /* sqlite3.c:228974:12: */ + if pVal != 0 { + var eType int32 = Xsqlite3_value_numeric_type(tls, pVal) + if eType == SQLITE_INTEGER { + return Xsqlite3_value_int64(tls, pVal) + } + } + return iDefault +} + +// This is the xFilter interface for the virtual table. See +// the virtual table xFilter method documentation for additional +// information. +// +// There are three possible query strategies: +// +// 1. Full-text search using a MATCH operator. +// 2. A by-rowid lookup. +// 3. A full-table scan. +func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, nVal int32, apVal uintptr) int32 { /* sqlite3.c:228995:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pTab uintptr + var pConfig uintptr + var pCsr uintptr + var rc int32 // Error code + var bDesc int32 // True if ORDER BY [rank|rowid] DESC + var bOrderByRank int32 // True if ORDER BY rank + var pRank uintptr // rank MATCH ? expression (or NULL) + var pRowidEq uintptr // rowid = ? expression (or NULL) + var pRowidLe uintptr // rowid <= ? expression (or NULL) + var pRowidGe uintptr // rowid >= ? expression (or NULL) + var iCol int32 // Column on LHS of MATCH operator + var pzErrmsg uintptr + var i int32 + var iIdxStr int32 + // var pExpr uintptr at bp+8, 8 + + var pzErr uintptr + var zText uintptr + var bGlob int32 + var zText1 uintptr + pTab = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + pConfig = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + pCsr = pCursor + rc = SQLITE_OK + pRank = uintptr(0) + pRowidEq = uintptr(0) + pRowidLe = uintptr(0) + pRowidGe = uintptr(0) + pzErrmsg = (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg + iIdxStr = 0 + *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */)) = uintptr(0) + + if !((*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0) { + goto __1 + } + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, + ts+33514 /* "recursively defi..." */, 0) + return SQLITE_ERROR +__1: + ; + + if !((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan != 0) { + goto __2 + } + fts5FreeCursorComponents(tls, pCsr) + libc.Xmemset(tls, (pCsr + 32 /* &.ePlan */), 0, (uint64(unsafe.Sizeof(Fts5Cursor{})) - (uint64((int64((pCsr + 32 /* &.ePlan */)) - int64(pCsr)) / 1)))) +__2: + ; + + (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) + + // Decode the arguments passed through to this function. + i = 0 +__3: + if !(i < nVal) { + goto __5 + } + switch int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1))))) { + case 'r': + goto __7 + case 'M': + goto __8 + case 'L': + goto __9 + case 'G': + goto __10 + case '=': + goto __11 + case '<': + goto __12 + default: + goto __13 + } + goto __6 +__7: + pRank = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + goto __6 +__8: + zText = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + if !(zText == uintptr(0)) { + goto __14 + } + zText = ts + 756 /* "" */ +__14: + ; + iCol = 0 +__15: + iCol = ((iCol * 10) + (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) - '0')) + iIdxStr++ + goto __16 +__16: + if (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) <= '9') { + goto __15 + } + goto __17 +__17: + ; + + if !(int32(*(*int8)(unsafe.Pointer(zText))) == '*') { + goto __18 + } + // The user has issued a query of the form "MATCH '*...'". This + // indicates that the MATCH expression is not a full text query, + // but a request for an internal parameter. + rc = fts5SpecialMatch(tls, pTab, pCsr, (zText + 1)) + goto filter_out + goto __19 +__18: + pzErr = (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) + rc = sqlite3Fts5ExprNew(tls, pConfig, 0, iCol, zText, bp+8 /* &pExpr */, pzErr) + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sqlite3Fts5ExprAnd(tls, (pCsr + 64 /* &.pExpr */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */)) = uintptr(0) +__20: + ; + if !(rc != SQLITE_OK) { + goto __21 + } + goto filter_out +__21: + ; +__19: + ; + + goto __6 + +__9: +__10: + bGlob = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(idxStr + uintptr((iIdxStr - 1))))) == 'G')) + zText1 = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + iCol = 0 +__22: + iCol = ((iCol * 10) + (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) - '0')) + iIdxStr++ + goto __23 +__23: + if (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(iIdxStr)))) <= '9') { + goto __22 + } + goto __24 +__24: + ; + if !(zText1 != 0) { + goto __25 + } + rc = sqlite3Fts5ExprPattern(tls, pConfig, bGlob, iCol, zText1, bp+8 /* &pExpr */) +__25: + ; + if !(rc == SQLITE_OK) { + goto __26 + } + rc = sqlite3Fts5ExprAnd(tls, (pCsr + 64 /* &.pExpr */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */)) = uintptr(0) +__26: + ; + if !(rc != SQLITE_OK) { + goto __27 + } + goto filter_out +__27: + ; + goto __6 + +__11: + pRowidEq = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + goto __6 +__12: + pRowidLe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + goto __6 +__13: + ; + pRowidGe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8)) + goto __6 +__6: + ; + goto __4 +__4: + i++ + goto __3 + goto __5 +__5: + ; + bOrderByRank = func() int32 { + if (idxNum & FTS5_BI_ORDER_RANK) != 0 { + return 1 + } + return 0 + }() + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FbDesc = libc.AssignInt32(&bDesc, func() int32 { + if (idxNum & FTS5_BI_ORDER_DESC) != 0 { + return 1 + } + return 0 + }()) + + // Set the cursor upper and lower rowid limits. Only some strategies + // actually use them. This is ok, as the xBestIndex() method leaves the + // sqlite3_index_constraint.omit flag clear for range constraints + // on the rowid field. + if !(pRowidEq != 0) { + goto __28 + } + pRowidLe = libc.AssignUintptr(&pRowidGe, pRowidEq) +__28: + ; + if !(bDesc != 0) { + goto __29 + } + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = fts5GetRowidLimit(tls, pRowidLe, (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = fts5GetRowidLimit(tls, pRowidGe, ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) + goto __30 +__29: + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = fts5GetRowidLimit(tls, pRowidLe, (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = fts5GetRowidLimit(tls, pRowidGe, ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) +__30: + ; + + if !((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr != 0) { + goto __31 + } + // If pSortCsr is non-NULL, then this call is being made as part of + // processing for a "... MATCH ORDER BY rank" query (ePlan is + // set to FTS5_PLAN_SORTED_MATCH). pSortCsr is the cursor that will + // return results to the user for this query. The current cursor + // (pCursor) is used to execute the query issued by function + // fts5CursorFirstSorted() above. + + if !((*Fts5Cursor)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FbDesc != 0) { + goto __33 + } + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = (*Fts5Cursor)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiFirstRowid + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = (*Fts5Cursor)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiLastRowid + goto __34 +__33: + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid = (*Fts5Cursor)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiLastRowid + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid = (*Fts5Cursor)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FiFirstRowid +__34: + ; + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SOURCE + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr = (*Fts5Cursor)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).FpSortCsr)).FpExpr + rc = fts5CursorFirst(tls, pTab, pCsr, bDesc) + goto __32 +__31: + if !((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr != 0) { + goto __35 + } + rc = fts5CursorParseRank(tls, pConfig, pCsr, pRank) + if !(rc == SQLITE_OK) { + goto __37 + } + if !(bOrderByRank != 0) { + goto __38 + } + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SORTED_MATCH + rc = fts5CursorFirstSorted(tls, pTab, pCsr, bDesc) + goto __39 +__38: + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_MATCH + rc = fts5CursorFirst(tls, pTab, pCsr, bDesc) +__39: + ; +__37: + ; + goto __36 +__35: + if !((*Fts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0)) { + goto __40 + } + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, + ts+33715 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + rc = SQLITE_ERROR + goto __41 +__40: + // This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup + // by rowid (ePlan==FTS5_PLAN_ROWID). + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = func() int32 { + if pRowidEq != 0 { + return FTS5_PLAN_ROWID + } + return FTS5_PLAN_SCAN + }() + rc = sqlite3Fts5StorageStmt(tls, + (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, fts5StmtType(tls, pCsr), (pCsr + 56 /* &.pStmt */), (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */)) + if !(rc == SQLITE_OK) { + goto __42 + } + if !((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_ROWID) { + goto __43 + } + Xsqlite3_bind_value(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, 1, pRowidEq) + goto __44 +__43: + Xsqlite3_bind_int64(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, 1, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiFirstRowid) + Xsqlite3_bind_int64(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, 2, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid) +__44: + ; + rc = fts5NextMethod(tls, pCursor) +__42: + ; +__41: + ; +__36: + ; +__32: + ; + +filter_out: + sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */))) + (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg + return rc +} + +// This is the xEof method of the virtual table. SQLite calls this +// routine to find out if it has reached the end of a result set. +func fts5EofMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:229187:12: */ + var pCsr uintptr = pCursor + return func() int32 { + if ((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_EOF)) != 0 { + return 1 + } + return 0 + }() +} + +// Return the rowid that the cursor currently points to. +func fts5CursorRowid(tls *libc.TLS, pCsr uintptr) I64 { /* sqlite3.c:229195:12: */ + + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0 { + return (*Fts5Sorter)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter)).FiRowid + } else { + return sqlite3Fts5ExprRowid(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + } + return I64(0) +} + +// This is the xRowid method. The SQLite core calls this routine to +// retrieve the rowid for the current row of the result set. fts5 +// exposes %_content.rowid as the rowid for the virtual table. The +// rowid should be written to *pRowid. +func fts5RowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* sqlite3.c:229213:12: */ + var pCsr uintptr = pCursor + var ePlan int32 = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan + + switch ePlan { + case FTS5_PLAN_SPECIAL: + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0) + break + + case FTS5_PLAN_SOURCE: + fallthrough + case FTS5_PLAN_MATCH: + fallthrough + case FTS5_PLAN_SORTED_MATCH: + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = fts5CursorRowid(tls, pCsr) + break + + default: + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = Xsqlite3_column_int64(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, 0) + break + } + + return SQLITE_OK +} + +// If the cursor requires seeking (bSeekRequired flag is set), seek it. +// Return SQLITE_OK if no error occurs, or an SQLite error code otherwise. +// +// If argument bErrormsg is true and an error occurs, an error message may +// be left in sqlite3_vtab.zErrMsg. +func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sqlite3.c:229244:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + + // If the cursor does not yet have a statement handle, obtain one now. + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0) { + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var eStmt int32 = fts5StmtType(tls, pCsr) + rc = sqlite3Fts5StorageStmt(tls, + (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, eStmt, (pCsr + 56 /* &.pStmt */), func() uintptr { + if bErrormsg != 0 { + return (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) + } + return uintptr(0) + }()) + + } + + if (rc == SQLITE_OK) && (((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_REQUIRE_CONTENT)) != 0) { + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + + Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + Xsqlite3_bind_int64(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, 1, fts5CursorRowid(tls, pCsr)) + (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FbLock++ + rc = Xsqlite3_step(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FbLock-- + if rc == SQLITE_ROW { + rc = SQLITE_OK + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) &= (libc.CplInt32(FTS5CSR_REQUIRE_CONTENT)) + } else { + rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) + if rc == SQLITE_OK { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, + ts+2791 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + } + } + } + return rc +} + +func fts5SetVtabError(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:229283:13: */ + var ap Va_list + _ = ap // ... printf arguments + ap = va + + (*Fts5FullTable)(unsafe.Pointer(p)).Fp.Fbase.FzErrMsg = Xsqlite3_vmprintf(tls, zFormat, ap) + _ = ap +} + +// This function is called to handle an FTS INSERT command. In other words, +// an INSERT statement of the form: +// +// INSERT INTO fts(fts) VALUES($pCmd) +// INSERT INTO fts(fts, rank) VALUES($pCmd, $pVal) +// +// Argument pVal is the value assigned to column "fts" by the INSERT +// statement. This function returns SQLITE_OK if successful, or an SQLite +// error code if an error occurs. +// +// The commands implemented by this function are documented in the "Special +// INSERT Directives" section of the documentation. It should be updated if +// more commands are added to this function. +func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) int32 { /* sqlite3.c:229306:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 + + if 0 == Xsqlite3_stricmp(tls, ts+33751 /* "delete-all" */, zCmd) { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { + fts5SetVtabError(tls, pTab, + + ts+33762 /* "'delete-all' may..." */, 0) + rc = SQLITE_ERROR + } else { + rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + } + } else if 0 == Xsqlite3_stricmp(tls, ts+33842 /* "rebuild" */, zCmd) { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { + fts5SetVtabError(tls, pTab, + ts+33850 /* "'rebuild' may no..." */, 0) + rc = SQLITE_ERROR + } else { + rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + } + } else if 0 == Xsqlite3_stricmp(tls, ts+15429 /* "optimize" */, zCmd) { + rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + } else if 0 == Xsqlite3_stricmp(tls, ts+33906 /* "merge" */, zCmd) { + var nMerge int32 = Xsqlite3_value_int(tls, pVal) + rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) + } else if 0 == Xsqlite3_stricmp(tls, ts+33912 /* "integrity-check" */, zCmd) { + var iArg int32 = Xsqlite3_value_int(tls, pVal) + rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) + } else { + rc = sqlite3Fts5IndexLoadConfig(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex) + if rc == SQLITE_OK { + rc = sqlite3Fts5ConfigSetValue(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig, zCmd, pVal, bp /* &bError */) + } + if rc == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp /* bError */)) != 0 { + rc = SQLITE_ERROR + } else { + rc = sqlite3Fts5StorageConfigValue(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, zCmd, pVal, 0) + } + } + } + return rc +} + +func fts5SpecialDelete(tls *libc.TLS, pTab uintptr, apVal uintptr) int32 { /* sqlite3.c:229362:12: */ + var rc int32 = SQLITE_OK + var eType1 int32 = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + if eType1 == SQLITE_INTEGER { + var iDel Sqlite3_int64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + rc = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iDel, (apVal + 2*8)) + } + return rc +} + +func fts5StorageInsert(tls *libc.TLS, pRc uintptr, pTab uintptr, apVal uintptr, piRowid uintptr) { /* sqlite3.c:229375:13: */ + var rc int32 = *(*int32)(unsafe.Pointer(pRc)) + if rc == SQLITE_OK { + rc = sqlite3Fts5StorageContentInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, piRowid) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5StorageIndexInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, *(*I64)(unsafe.Pointer(piRowid))) + } + *(*int32)(unsafe.Pointer(pRc)) = rc +} + +// This function is the implementation of the xUpdate callback used by +// FTS3 virtual tables. It is invoked by SQLite each time a row is to be +// inserted, updated or deleted. +// +// A delete specifies a single argument - the rowid of the row to remove. +// +// Update and insert operations pass: +// +// 1. The "old" rowid, or NULL. +// 2. The "new" rowid. +// 3. Values for each of the nCol matchable columns. +// 4. Values for the two hidden columns ( and "rank"). +func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, pRowid uintptr) int32 { /* sqlite3.c:229405:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var pTab uintptr = pVtab + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + var eType0 int32 // value_type() of apVal[0] + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK // Return code + + // A transaction must be open when this is called. + + (*Fts5Config)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) + + // Put any active cursors into REQUIRE_SEEK state. + fts5TripCursors(tls, pTab) + + eType0 = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal))) + if (eType0 == SQLITE_NULL) && + (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) != SQLITE_NULL) { + // A "special" INSERT op. These are handled separately. + var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) + if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && + (0 == Xsqlite3_stricmp(tls, ts+15968 /* "delete" */, z)) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) + } + } else { + // A regular INSERT, UPDATE or DELETE statement. The trick here is that + // any conflict on the rowid value must be detected before any + // modifications are made to the database file. There are 4 cases: + // + // 1) DELETE + // 2) UPDATE (rowid not modified) + // 3) UPDATE (rowid modified) + // 4) INSERT + // + // Cases 3 and 4 may violate the rowid constraint. + var eConflict int32 = SQLITE_ABORT + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { + eConflict = Xsqlite3_vtab_on_conflict(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb) + } + + // Filter out attempts to run UPDATE or DELETE on contentless tables. + // This is not suported. + if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, + ts+33928, /* "cannot %s conten..." */ + libc.VaList(bp, func() uintptr { + if nArg > 1 { + return ts + 18782 /* "UPDATE" */ + } + return ts + 33965 /* "DELETE from" */ + }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR + } else if nArg == 1 { + var iDel I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal))) // Rowid to delete + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iDel, uintptr(0)) + } else { + var eType1 int32 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + + if (eType1 != SQLITE_INTEGER) && (eType1 != SQLITE_NULL) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISMATCH + } else if eType0 != SQLITE_INTEGER { + // If this is a REPLACE, first remove the current entry (if any) + if (eConflict == SQLITE_REPLACE) && (eType1 == SQLITE_INTEGER) { + var iNew I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) // Rowid to delete + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iNew, uintptr(0)) + } + fts5StorageInsert(tls, bp+16 /* &rc */, pTab, apVal, pRowid) + } else { + var iOld I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal))) // Old rowid + var iNew I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) // New rowid + if (eType1 == SQLITE_INTEGER) && (iOld != iNew) { + if eConflict == SQLITE_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iNew, uintptr(0)) + } + fts5StorageInsert(tls, bp+16 /* &rc */, pTab, apVal, pRowid) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageContentInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, pRowid) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageIndexInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, *(*Sqlite_int64)(unsafe.Pointer(pRowid))) + } + } + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) + fts5StorageInsert(tls, bp+16 /* &rc */, pTab, apVal, pRowid) + } + } + } + } + + (*Fts5Config)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = uintptr(0) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Implementation of xSync() method. +func fts5SyncMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:229531:12: */ + var rc int32 + var pTab uintptr = pVtab + + (*Fts5Config)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) + fts5TripCursors(tls, pTab) + rc = sqlite3Fts5StorageSync(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + (*Fts5Config)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = uintptr(0) + return rc +} + +// Implementation of xBegin() method. +func fts5BeginMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:229545:12: */ + + fts5NewTransaction(tls, pVtab) + return SQLITE_OK +} + +// Implementation of xCommit() method. This is a no-op. The contents of +// the pending-terms hash-table have already been flushed into the database +// by fts5SyncMethod(). +func fts5CommitMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:229556:12: */ + _ = pVtab // Call below is a no-op for NDEBUG builds + + return SQLITE_OK +} + +// Implementation of xRollback(). Discard the contents of the pending-terms +// hash-table. Any changes made to the database are reverted by SQLite. +func fts5RollbackMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:229566:12: */ + var rc int32 + var pTab uintptr = pVtab + + rc = sqlite3Fts5StorageRollback(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) + return rc +} + +func fts5ApiUserData(tls *libc.TLS, pCtx uintptr) uintptr { /* sqlite3.c:229576:13: */ + var pCsr uintptr = pCtx + return (*Fts5Auxiliary)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAux)).FpUserData +} + +func fts5ApiColumnCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:229581:12: */ + var pCsr uintptr = pCtx + return (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpConfig)).FnCol +} + +func fts5ApiColumnTotalSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr) int32 { /* sqlite3.c:229586:12: */ + var pCsr uintptr = pCtx + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + return sqlite3Fts5StorageSize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iCol, pnToken) +} + +func fts5ApiRowCount(tls *libc.TLS, pCtx uintptr, pnRow uintptr) int32 { /* sqlite3.c:229596:12: */ + var pCsr uintptr = pCtx + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + return sqlite3Fts5StorageRowCount(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, pnRow) +} + +func fts5ApiTokenize(tls *libc.TLS, pCtx uintptr, pText uintptr, nText int32, pUserData uintptr, xToken uintptr) int32 { /* sqlite3.c:229602:12: */ + var pCsr uintptr = pCtx + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + return sqlite3Fts5Tokenize(tls, + (*Fts5Table)(unsafe.Pointer(pTab)).FpConfig, FTS5_TOKENIZE_AUX, pText, nText, pUserData, xToken) +} + +func fts5ApiPhraseCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:229615:12: */ + var pCsr uintptr = pCtx + return sqlite3Fts5ExprPhraseCount(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) +} + +func fts5ApiPhraseSize(tls *libc.TLS, pCtx uintptr, iPhrase int32) int32 { /* sqlite3.c:229620:12: */ + var pCsr uintptr = pCtx + return sqlite3Fts5ExprPhraseSize(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, iPhrase) +} + +func fts5ApiColumnText(tls *libc.TLS, pCtx uintptr, iCol int32, pz uintptr, pn uintptr) int32 { /* sqlite3.c:229625:12: */ + var rc int32 = SQLITE_OK + var pCsr uintptr = pCtx + if (fts5IsContentless(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab) != 0) || + ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_SPECIAL) { + *(*uintptr)(unsafe.Pointer(pz)) = uintptr(0) + *(*int32)(unsafe.Pointer(pn)) = 0 + } else { + rc = fts5SeekCursor(tls, pCsr, 0) + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pz)) = Xsqlite3_column_text(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, (iCol + 1)) + *(*int32)(unsafe.Pointer(pn)) = Xsqlite3_column_bytes(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, (iCol + 1)) + } + } + return rc +} + +func fts5CsrPoslist(tls *libc.TLS, pCsr uintptr, iPhrase int32, pa uintptr, pn uintptr) int32 { /* sqlite3.c:229648:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pConfig uintptr = (*Fts5Table)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpConfig + var rc int32 = SQLITE_OK + var bLive int32 = (libc.Bool32((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter == uintptr(0))) + + if ((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_REQUIRE_POSLIST)) != 0 { + + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail != FTS5_DETAIL_FULL { + var aPopulator uintptr + var i int32 + aPopulator = sqlite3Fts5ExprClearPoslists(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, bLive) + if aPopulator == uintptr(0) { + rc = SQLITE_NOMEM + } + for i = 0; (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol) && (rc == SQLITE_OK); i++ { + // var n int32 at bp+8, 4 + + // var z uintptr at bp, 8 + + rc = fts5ApiColumnText(tls, pCsr, i, bp /* &z */, bp+8 /* &n */) + if rc == SQLITE_OK { + rc = sqlite3Fts5ExprPopulatePoslists(tls, + pConfig, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, aPopulator, i, *(*uintptr)(unsafe.Pointer(bp /* z */)), *(*int32)(unsafe.Pointer(bp + 8 /* n */))) + } + } + Xsqlite3_free(tls, aPopulator) + + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0 { + sqlite3Fts5ExprCheckPoslists(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, (*Fts5Sorter)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter)).FiRowid) + } + } + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) &= (libc.CplInt32(FTS5CSR_REQUIRE_POSLIST)) + } + + if ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter != 0) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_FULL) { + var pSorter uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter + var i1 int32 = func() int32 { + if iPhrase == 0 { + return 0 + } + return *(*int32)(unsafe.Pointer((pSorter + 28 /* &.aIdx */) + uintptr((iPhrase-1))*4)) + }() + *(*int32)(unsafe.Pointer(pn)) = (*(*int32)(unsafe.Pointer((pSorter + 28 /* &.aIdx */) + uintptr(iPhrase)*4)) - i1) + *(*uintptr)(unsafe.Pointer(pa)) = ((*Fts5Sorter)(unsafe.Pointer(pSorter)).FaPoslist + uintptr(i1)) + } else { + *(*int32)(unsafe.Pointer(pn)) = sqlite3Fts5ExprPoslist(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, iPhrase, pa) + } + + return rc +} + +// Ensure that the Fts5Cursor.nInstCount and aInst[] variables are populated +// correctly for the current view. Return SQLITE_OK if successful, or an +// SQLite error code otherwise. +func fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:229700:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + var aIter uintptr // One iterator for each phrase + var nIter int32 // Number of iterators/phrases + var nCol int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpConfig)).FnCol + + nIter = sqlite3Fts5ExprPhraseCount(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInstIter == uintptr(0) { + var nByte Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5PoslistReader{})) * uint64(nIter))) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInstIter = sqlite3Fts5MallocZero(tls, bp /* &rc */, nByte) + } + aIter = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInstIter + + if aIter != 0 { + var nInst int32 = 0 // Number instances seen so far + var i int32 + + // Initialize all iterators + for i = 0; (i < nIter) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK); i++ { + // var a uintptr at bp+8, 8 + + // var n int32 at bp+16, 4 + + *(*int32)(unsafe.Pointer(bp /* rc */)) = fts5CsrPoslist(tls, pCsr, i, bp+8 /* &a */, bp+16 /* &n */) + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + sqlite3Fts5PoslistReaderInit(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* a */)), *(*int32)(unsafe.Pointer(bp + 16 /* n */)), (aIter + uintptr(i)*32)) + } + } + + if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK { + for 1 != 0 { + var aInst uintptr + var iBest int32 = -1 + for i = 0; i < nIter; i++ { + if (int32((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FbEof) == 0) && + ((iBest < 0) || ((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(i)*32)).FiPos < (*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(iBest)*32)).FiPos)) { + iBest = i + } + } + if iBest < 0 { + break + } + + nInst++ + if nInst >= (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstAlloc { + var nNewSize int32 + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstAlloc != 0 { + nNewSize = ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstAlloc * 2) + } else { + nNewSize = 32 + } + aInst = Xsqlite3_realloc64(tls, + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst, (uint64((uint64(nNewSize) * uint64(unsafe.Sizeof(int32(0)))) * uint64(3)))) + if aInst != 0 { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst = aInst + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstAlloc = nNewSize + } else { + nInst-- + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM + break + } + } + + aInst = ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst + uintptr((3*(nInst-1)))*4) + *(*int32)(unsafe.Pointer(aInst)) = iBest + *(*int32)(unsafe.Pointer(aInst + 1*4)) = (int32((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(iBest)*32)).FiPos >> 32)) + *(*int32)(unsafe.Pointer(aInst + 2*4)) = (int32((*Fts5PoslistReader)(unsafe.Pointer(aIter+uintptr(iBest)*32)).FiPos & int64(0x7FFFFFFF))) + if (*(*int32)(unsafe.Pointer(aInst + 1*4)) < 0) || (*(*int32)(unsafe.Pointer(aInst + 1*4)) >= nCol) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + break + } + sqlite3Fts5PoslistReaderNext(tls, (aIter + uintptr(iBest)*32)) + } + } + + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstCount = nInst + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) &= (libc.CplInt32(FTS5CSR_REQUIRE_INST)) + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +func fts5ApiInstCount(tls *libc.TLS, pCtx uintptr, pnInst uintptr) int32 { /* sqlite3.c:229774:12: */ + var pCsr uintptr = pCtx + var rc int32 = SQLITE_OK + if (((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_REQUIRE_INST)) == 0) || + (SQLITE_OK == (libc.AssignInt32(&rc, fts5CacheInstArray(tls, pCsr)))) { + *(*int32)(unsafe.Pointer(pnInst)) = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstCount + } + return rc +} + +func fts5ApiInst(tls *libc.TLS, pCtx uintptr, iIdx int32, piPhrase uintptr, piCol uintptr, piOff uintptr) int32 { /* sqlite3.c:229784:12: */ + var pCsr uintptr = pCtx + var rc int32 = SQLITE_OK + if (((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_REQUIRE_INST)) == 0) || + (SQLITE_OK == (libc.AssignInt32(&rc, fts5CacheInstArray(tls, pCsr)))) { + if (iIdx < 0) || (iIdx >= (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnInstCount) { + rc = SQLITE_RANGE + } else { + *(*int32)(unsafe.Pointer(piPhrase)) = *(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst + uintptr((iIdx*3))*4)) + *(*int32)(unsafe.Pointer(piCol)) = *(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst + uintptr(((iIdx*3)+1))*4)) + *(*int32)(unsafe.Pointer(piOff)) = *(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaInst + uintptr(((iIdx*3)+2))*4)) + } + } + return rc +} + +func fts5ApiRowid(tls *libc.TLS, pCtx uintptr) Sqlite3_int64 { /* sqlite3.c:229813:22: */ + return fts5CursorRowid(tls, pCtx) +} + +func fts5ColumnSizeCb(tls *libc.TLS, pContext uintptr, tflags int32, pUnused uintptr, nUnused int32, iUnused1 int32, iUnused2 int32) int32 { /* sqlite3.c:229817:12: */ + var pCnt uintptr = pContext + _ = pUnused + _ = nUnused + _ = iUnused1 + _ = iUnused2 + if (tflags & FTS5_TOKEN_COLOCATED) == 0 { + (*(*int32)(unsafe.Pointer(pCnt)))++ + } + return SQLITE_OK +} + +func fts5ApiColumnSize(tls *libc.TLS, pCtx uintptr, iCol int32, pnToken uintptr) int32 { /* sqlite3.c:229834:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var pCsr uintptr = pCtx + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + var rc int32 = SQLITE_OK + + if ((*Fts5Cursor)(unsafe.Pointer((pCsr))).Fcsrflags & (FTS5CSR_REQUIRE_DOCSIZE)) != 0 { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { + var iRowid I64 = fts5CursorRowid(tls, pCsr) + rc = sqlite3Fts5StorageDocsize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iRowid, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize) + } else if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent == uintptr(0) { + var i int32 + for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { + if int32(*(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr(i)))) == 0 { + *(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i)*4)) = -1 + } + } + } else { + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { + if int32(*(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr(i)))) == 0 { + // var z uintptr at bp, 8 + + // var n int32 at bp+8, 4 + + var p uintptr = ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i)*4) + *(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i)*4)) = 0 + rc = fts5ApiColumnText(tls, pCtx, i, bp /* &z */, bp+8 /* &n */) + if rc == SQLITE_OK { + rc = sqlite3Fts5Tokenize(tls, + pConfig, FTS5_TOKENIZE_AUX, *(*uintptr)(unsafe.Pointer(bp /* z */)), *(*int32)(unsafe.Pointer(bp + 8 /* n */)), p, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5ColumnSizeCb}))) + } + } + } + } + *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) &= (libc.CplInt32(FTS5CSR_REQUIRE_DOCSIZE)) + } + if iCol < 0 { + var i int32 + *(*int32)(unsafe.Pointer(pnToken)) = 0 + for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { + *(*int32)(unsafe.Pointer(pnToken)) += (*(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(i)*4))) + } + } else if iCol < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { + *(*int32)(unsafe.Pointer(pnToken)) = *(*int32)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FaColumnSize + uintptr(iCol)*4)) + } else { + *(*int32)(unsafe.Pointer(pnToken)) = 0 + rc = SQLITE_RANGE + } + return rc +} + +// Implementation of the xSetAuxdata() method. +func fts5ApiSetAuxdata(tls *libc.TLS, pCtx uintptr, pPtr uintptr, xDelete uintptr) int32 { /* sqlite3.c:229887:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pCsr uintptr = pCtx + var pData uintptr + + // Search through the cursors list of Fts5Auxdata objects for one that + // corresponds to the currently executing auxiliary function. + for pData = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAuxdata; pData != 0; pData = (*Fts5Auxdata)(unsafe.Pointer(pData)).FpNext { + if (*Fts5Auxdata)(unsafe.Pointer(pData)).FpAux == (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAux { + break + } + } + + if pData != 0 { + if (*Fts5Auxdata)(unsafe.Pointer(pData)).FxDelete != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pData + 16 /* &.xDelete */))))(tls, (*Fts5Auxdata)(unsafe.Pointer(pData)).FpPtr) + } + } else { + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + pData = sqlite3Fts5MallocZero(tls, bp /* &rc */, int64(unsafe.Sizeof(Fts5Auxdata{}))) + if pData == uintptr(0) { + if xDelete != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDelete)))(tls, pPtr) + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) + } + (*Fts5Auxdata)(unsafe.Pointer(pData)).FpAux = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAux + (*Fts5Auxdata)(unsafe.Pointer(pData)).FpNext = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAuxdata + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAuxdata = pData + } + + (*Fts5Auxdata)(unsafe.Pointer(pData)).FxDelete = xDelete + (*Fts5Auxdata)(unsafe.Pointer(pData)).FpPtr = pPtr + return SQLITE_OK +} + +func fts5ApiGetAuxdata(tls *libc.TLS, pCtx uintptr, bClear int32) uintptr { /* sqlite3.c:229922:13: */ + var pCsr uintptr = pCtx + var pData uintptr + var pRet uintptr = uintptr(0) + + for pData = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAuxdata; pData != 0; pData = (*Fts5Auxdata)(unsafe.Pointer(pData)).FpNext { + if (*Fts5Auxdata)(unsafe.Pointer(pData)).FpAux == (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAux { + break + } + } + + if pData != 0 { + pRet = (*Fts5Auxdata)(unsafe.Pointer(pData)).FpPtr + if bClear != 0 { + (*Fts5Auxdata)(unsafe.Pointer(pData)).FpPtr = uintptr(0) + (*Fts5Auxdata)(unsafe.Pointer(pData)).FxDelete = uintptr(0) + } + } + + return pRet +} + +func fts5ApiPhraseNext(tls *libc.TLS, pUnused uintptr, pIter uintptr, piCol uintptr, piOff uintptr) { /* sqlite3.c:229942:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + _ = pUnused + if (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa >= (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fb { + *(*int32)(unsafe.Pointer(piCol)) = -1 + *(*int32)(unsafe.Pointer(piOff)) = -1 + } else { + // var iVal int32 at bp, 4 + + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(sqlite3Fts5GetVarint32(tls, (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa, bp /* &iVal */))) + if *(*int32)(unsafe.Pointer(bp /* iVal */)) == 1 { + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(sqlite3Fts5GetVarint32(tls, (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa, bp /* &iVal */))) + *(*int32)(unsafe.Pointer(piCol)) = *(*int32)(unsafe.Pointer(bp /* iVal */)) + *(*int32)(unsafe.Pointer(piOff)) = 0 + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(sqlite3Fts5GetVarint32(tls, (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa, bp /* &iVal */))) + } + *(*int32)(unsafe.Pointer(piOff)) += (*(*int32)(unsafe.Pointer(bp /* iVal */)) - 2) + } +} + +func fts5ApiPhraseFirst(tls *libc.TLS, pCtx uintptr, iPhrase int32, pIter uintptr, piCol uintptr, piOff uintptr) int32 { /* sqlite3.c:229964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pCsr uintptr = pCtx + // var n int32 at bp, 4 + + var rc int32 = fts5CsrPoslist(tls, pCsr, iPhrase, (pIter /* &.a */), bp /* &n */) + if rc == SQLITE_OK { + + (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fb = func() uintptr { + if (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa != 0 { + return ((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp /* n */)))) + } + return uintptr(0) + }() + *(*int32)(unsafe.Pointer(piCol)) = 0 + *(*int32)(unsafe.Pointer(piOff)) = 0 + fts5ApiPhraseNext(tls, pCtx, pIter, piCol, piOff) + } + return rc +} + +func fts5ApiPhraseNextColumn(tls *libc.TLS, pCtx uintptr, pIter uintptr, piCol uintptr) { /* sqlite3.c:229983:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pCsr uintptr = pCtx + var pConfig uintptr = (*Fts5Table)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpConfig + + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_COLUMNS { + if (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa >= (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fb { + *(*int32)(unsafe.Pointer(piCol)) = -1 + } else { + // var iIncr int32 at bp, 4 + + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(sqlite3Fts5GetVarint32(tls, ((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa), bp /* &iIncr */))) + *(*int32)(unsafe.Pointer(piCol)) += (*(*int32)(unsafe.Pointer(bp /* iIncr */)) - 2) + } + } else { + for 1 != 0 { + // var dummy int32 at bp+4, 4 + + if (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa >= (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fb { + *(*int32)(unsafe.Pointer(piCol)) = -1 + return + } + if int32(*(*uint8)(unsafe.Pointer((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa))) == 0x01 { + break + } + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(sqlite3Fts5GetVarint32(tls, (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa, bp+4 /* &dummy */))) + } + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(1 + sqlite3Fts5GetVarint32(tls, ((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa+1), piCol))) + } +} + +func fts5ApiPhraseFirstColumn(tls *libc.TLS, pCtx uintptr, iPhrase int32, pIter uintptr, piCol uintptr) int32 { /* sqlite3.c:230013:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var pCsr uintptr = pCtx + var pConfig uintptr = (*Fts5Table)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpConfig + + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_COLUMNS { + var pSorter uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter + // var n int32 at bp, 4 + + if pSorter != 0 { + var i1 int32 = func() int32 { + if iPhrase == 0 { + return 0 + } + return *(*int32)(unsafe.Pointer((pSorter + 28 /* &.aIdx */) + uintptr((iPhrase-1))*4)) + }() + *(*int32)(unsafe.Pointer(bp /* n */)) = (*(*int32)(unsafe.Pointer((pSorter + 28 /* &.aIdx */) + uintptr(iPhrase)*4)) - i1) + (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa = ((*Fts5Sorter)(unsafe.Pointer(pSorter)).FaPoslist + uintptr(i1)) + } else { + rc = sqlite3Fts5ExprPhraseCollist(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, iPhrase, (pIter /* &.a */), bp /* &n */) + } + if rc == SQLITE_OK { + + (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fb = func() uintptr { + if (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa != 0 { + return ((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp /* n */)))) + } + return uintptr(0) + }() + *(*int32)(unsafe.Pointer(piCol)) = 0 + fts5ApiPhraseNextColumn(tls, pCtx, pIter, piCol) + } + } else { + // var n int32 at bp+4, 4 + + rc = fts5CsrPoslist(tls, pCsr, iPhrase, (pIter /* &.a */), bp+4 /* &n */) + if rc == SQLITE_OK { + + (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fb = func() uintptr { + if (*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa != 0 { + return ((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa + uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */)))) + } + return uintptr(0) + }() + if *(*int32)(unsafe.Pointer(bp + 4 /* n */)) <= 0 { + *(*int32)(unsafe.Pointer(piCol)) = -1 + } else if int32(*(*uint8)(unsafe.Pointer((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa))) == 0x01 { + *(*uintptr)(unsafe.Pointer(pIter /* &.a */)) += (uintptr(1 + sqlite3Fts5GetVarint32(tls, ((*Fts5PhraseIter)(unsafe.Pointer(pIter)).Fa+1), piCol))) + } else { + *(*int32)(unsafe.Pointer(piCol)) = 0 + } + } + } + + return rc +} + +var sFts5Api = Fts5ExtensionApi{ + FiVersion: 2, // iVersion + FxUserData: 0, + FxColumnCount: 0, + FxRowCount: 0, + FxColumnTotalSize: 0, + FxTokenize: 0, + FxPhraseCount: 0, + FxPhraseSize: 0, + FxInstCount: 0, + FxInst: 0, + FxRowid: 0, + FxColumnText: 0, + FxColumnSize: 0, + FxQueryPhrase: 0, + FxSetAuxdata: 0, + FxGetAuxdata: 0, + FxPhraseFirst: 0, + FxPhraseNext: 0, + FxPhraseFirstColumn: 0, + FxPhraseNextColumn: 0, +} /* sqlite3.c:230063:31 */ + +// Implementation of API function xQueryPhrase(). +func fts5ApiQueryPhrase(tls *libc.TLS, pCtx uintptr, iPhrase int32, pUserData uintptr, xCallback uintptr) int32 { /* sqlite3.c:230089:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pCsr uintptr = pCtx + var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + var rc int32 + *(*uintptr)(unsafe.Pointer(bp /* pNew */)) = uintptr(0) + + rc = fts5OpenMethod(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab, bp /* &pNew */) + if rc == SQLITE_OK { + (*Fts5Cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).FePlan = FTS5_PLAN_MATCH + (*Fts5Cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).FiFirstRowid = ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + (*Fts5Cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).FiLastRowid = (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)) + (*Fts5Cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pNew */)))).Fbase.FpVtab = pTab + rc = sqlite3Fts5ExprClonePhrase(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, iPhrase, (*(*uintptr)(unsafe.Pointer(bp /* pNew */)) + 64 /* &.pExpr */)) + } + + if rc == SQLITE_OK { + for rc = fts5CursorFirst(tls, pTab, *(*uintptr)(unsafe.Pointer(bp /* pNew */)), 0); (rc == SQLITE_OK) && (((*Fts5Cursor)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pNew */))))).Fcsrflags & (FTS5CSR_EOF)) == 0); rc = fts5NextMethod(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xCallback)))(tls, uintptr(unsafe.Pointer(&sFts5Api)), *(*uintptr)(unsafe.Pointer(bp /* pNew */)), pUserData) + if rc != SQLITE_OK { + if rc == SQLITE_DONE { + rc = SQLITE_OK + } + break + } + } + } + + fts5CloseMethod(tls, *(*uintptr)(unsafe.Pointer(bp /* pNew */))) + return rc +} + +func fts5ApiInvoke(tls *libc.TLS, pAux uintptr, pCsr uintptr, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:230126:13: */ + + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAux = pAux + (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr))(unsafe.Pointer((pAux + 24 /* &.xFunc */))))(tls, uintptr(unsafe.Pointer(&sFts5Api)), pCsr, context, argc, argv) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpAux = uintptr(0) +} + +func fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId I64) uintptr { /* sqlite3.c:230139:19: */ + var pCsr uintptr + for pCsr = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpCsr; pCsr != 0; pCsr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpNext { + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId == iCsrId { + break + } + } + return pCsr +} + +func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:230147:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pAux uintptr + var pCsr uintptr + var iCsrId I64 + + pAux = Xsqlite3_user_data(tls, context) + iCsrId = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + + pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) + if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { + var zErr uintptr = Xsqlite3_mprintf(tls, ts+33977 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + Xsqlite3_result_error(tls, context, zErr, -1) + Xsqlite3_free(tls, zErr) + } else { + fts5ApiInvoke(tls, pAux, pCsr, context, (argc - 1), (argv + 1*8)) + } +} + +// Given cursor id iId, return a pointer to the corresponding Fts5Table +// object. Or NULL If the cursor id does not exist. +func sqlite3Fts5TableFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId I64) uintptr { /* sqlite3.c:230176:18: */ + var pCsr uintptr + pCsr = fts5CursorFromCsrid(tls, pGlobal, iCsrId) + if pCsr != 0 { + return (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab + } + return uintptr(0) +} + +// Return a "position-list blob" corresponding to the current position of +// cursor pCsr via sqlite3_result_blob(). A position-list blob contains +// the current position-list for each phrase in the query associated with +// cursor pCsr. +// +// A position-list blob begins with (nPhrase-1) varints, where nPhrase is +// the number of phrases in the query. Following the varints are the +// concatenated position lists for each phrase, in order. +// +// The first varint (if it exists) contains the size of the position list +// for phrase 0. The second (same disclaimer) contains the size of position +// list 1. And so on. There is no size field for the final position list, +// as it can be derived from the total size of the blob. +func fts5PoslistBlob(tls *libc.TLS, pCtx uintptr, pCsr uintptr) int32 { /* sqlite3.c:230203:12: */ + bp := tls.Alloc(68) + defer tls.Free(68) + + var i int32 + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var nPhrase int32 = sqlite3Fts5ExprPhraseCount(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr) + // var val Fts5Buffer at bp, 16 + + libc.Xmemset(tls, bp /* &val */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + switch (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpConfig)).FeDetail { + case FTS5_DETAIL_FULL: + + // Append the varints + for i = 0; i < (nPhrase - 1); i++ { + // var dummy uintptr at bp+16, 8 + + var nByte int32 = sqlite3Fts5ExprPoslist(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, i, bp+16 /* &dummy */) + sqlite3Fts5BufferAppendVarint(tls, bp+24 /* &rc */, bp /* &val */, int64(nByte)) + } + + // Append the position lists + for i = 0; i < nPhrase; i++ { + // var pPoslist uintptr at bp+32, 8 + + var nPoslist int32 + nPoslist = sqlite3Fts5ExprPoslist(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, i, bp+32 /* &pPoslist */) + sqlite3Fts5BufferAppendBlob(tls, bp+24 /* &rc */, bp /* &val */, uint32(nPoslist), *(*uintptr)(unsafe.Pointer(bp + 32 /* pPoslist */))) + } + break + + case FTS5_DETAIL_COLUMNS: + + // Append the varints + for i = 0; (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (i < (nPhrase - 1)); i++ { + // var dummy uintptr at bp+40, 8 + + // var nByte int32 at bp+48, 4 + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5ExprPhraseCollist(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, i, bp+40 /* &dummy */, bp+48 /* &nByte */) + sqlite3Fts5BufferAppendVarint(tls, bp+24 /* &rc */, bp /* &val */, int64(*(*int32)(unsafe.Pointer(bp + 48 /* nByte */)))) + } + + // Append the position lists + for i = 0; (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (i < nPhrase); i++ { + // var pPoslist uintptr at bp+56, 8 + + // var nPoslist int32 at bp+64, 4 + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5ExprPhraseCollist(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, i, bp+56 /* &pPoslist */, bp+64 /* &nPoslist */) + sqlite3Fts5BufferAppendBlob(tls, bp+24 /* &rc */, bp /* &val */, uint32(*(*int32)(unsafe.Pointer(bp + 64 /* nPoslist */))), *(*uintptr)(unsafe.Pointer(bp + 56 /* pPoslist */))) + } + break + + default: + break + } + + Xsqlite3_result_blob(tls, pCtx, (*Fts5Buffer)(unsafe.Pointer(bp /* &val */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp /* &val */)).Fn, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// This is the xColumn method, called by SQLite to request a value from +// the row that the supplied cursor currently points to. +func fts5ColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) int32 { /* sqlite3.c:230260:12: */ + var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig + var pCsr uintptr = pCursor + var rc int32 = SQLITE_OK + + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_SPECIAL { + if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { + Xsqlite3_result_int64(tls, pCtx, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial) + } + } else if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { + // User is requesting the value of the special column with the same name + // as the table. Return the cursor integer id number. This value is only + // useful in that it may be passed as the first argument to an FTS5 + // auxiliary function. + Xsqlite3_result_int64(tls, pCtx, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId) + } else if iCol == ((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol + 1) { + + // The value of the "rank" column. + if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_SOURCE { + fts5PoslistBlob(tls, pCtx, pCsr) + } else if ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_MATCH) || + ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == FTS5_PLAN_SORTED_MATCH) { + if ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRank != 0) || (SQLITE_OK == (libc.AssignInt32(&rc, fts5FindRankFunction(tls, pCsr)))) { + fts5ApiInvoke(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRank, pCsr, pCtx, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg) + } + } + } else if !(fts5IsContentless(tls, pTab) != 0) { + (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) + rc = fts5SeekCursor(tls, pCsr, 1) + if rc == SQLITE_OK { + Xsqlite3_result_value(tls, pCtx, Xsqlite3_column_value(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt, (iCol+1))) + } + (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = uintptr(0) + } + return rc +} + +// This routine implements the xFindFunction method for the FTS3 +// virtual table. +func fts5FindFunctionMethod(tls *libc.TLS, pVtab uintptr, nUnused int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:230313:12: */ + var pTab uintptr = pVtab + var pAux uintptr + + _ = nUnused + pAux = fts5FindAuxiliary(tls, pTab, zName) + if pAux != 0 { + *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{fts5ApiCallback})) + *(*uintptr)(unsafe.Pointer(ppArg)) = pAux + return 1 + } + + // No function of the specified name was found. Return 0. + return 0 +} + +// Implementation of FTS5 xRename method. Rename an fts5 table. +func fts5RenameMethod(tls *libc.TLS, pVtab uintptr, zName uintptr) int32 { /* sqlite3.c:230338:12: */ + var pTab uintptr = pVtab + return sqlite3Fts5StorageRename(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, zName) +} + +func sqlite3Fts5FlushToDisk(tls *libc.TLS, pTab uintptr) int32 { /* sqlite3.c:230346:12: */ + fts5TripCursors(tls, pTab) + return sqlite3Fts5StorageSync(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) +} + +// The xSavepoint() method. +// +// Flush the contents of the pending-terms table to disk. +func fts5SavepointMethod(tls *libc.TLS, pVtab uintptr, iSavepoint int32) int32 { /* sqlite3.c:230356:12: */ + _ = iSavepoint // Call below is a no-op for NDEBUG builds + + return sqlite3Fts5FlushToDisk(tls, pVtab) +} + +// The xRelease() method. +// +// This is a no-op. +func fts5ReleaseMethod(tls *libc.TLS, pVtab uintptr, iSavepoint int32) int32 { /* sqlite3.c:230367:12: */ + _ = iSavepoint // Call below is a no-op for NDEBUG builds + + return sqlite3Fts5FlushToDisk(tls, pVtab) +} + +// The xRollbackTo() method. +// +// Discard the contents of the pending terms table. +func fts5RollbackToMethod(tls *libc.TLS, pVtab uintptr, iSavepoint int32) int32 { /* sqlite3.c:230378:12: */ + var pTab uintptr = pVtab + _ = iSavepoint // Call below is a no-op for NDEBUG builds + + fts5TripCursors(tls, pTab) + return sqlite3Fts5StorageRollback(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) +} + +// Register a new auxiliary function with global context pGlobal. +func fts5CreateAux(tls *libc.TLS, pApi uintptr, zName uintptr, pUserData uintptr, xFunc Fts5_extension_function, xDestroy uintptr) int32 { /* sqlite3.c:230389:12: */ + var pGlobal uintptr = pApi + var rc int32 = Xsqlite3_overload_function(tls, (*Fts5Global)(unsafe.Pointer(pGlobal)).Fdb, zName, -1) + if rc == SQLITE_OK { + var pAux uintptr + var nName Sqlite3_int64 // Size of zName in bytes, including \0 + var nByte Sqlite3_int64 // Bytes of space to allocate + + nName = (Sqlite3_int64(libc.Xstrlen(tls, zName) + uint64(1))) + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Auxiliary{})) + uint64(nName))) + pAux = Xsqlite3_malloc64(tls, uint64(nByte)) + if pAux != 0 { + libc.Xmemset(tls, pAux, 0, Size_t(nByte)) + (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FzFunc = (pAux + 1*48) + libc.Xmemcpy(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FzFunc, zName, uint64(nName)) + (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal = pGlobal + (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpUserData = pUserData + (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FxFunc = xFunc + (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FxDestroy = xDestroy + (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpNext = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpAux + (*Fts5Global)(unsafe.Pointer(pGlobal)).FpAux = pAux + } else { + rc = SQLITE_NOMEM + } + } + + return rc +} + +// Register a new tokenizer. This is the implementation of the +// fts5_api.xCreateTokenizer() method. +func fts5CreateTokenizer(tls *libc.TLS, pApi uintptr, zName uintptr, pUserData uintptr, pTokenizer uintptr, xDestroy uintptr) int32 { /* sqlite3.c:230428:12: */ + var pGlobal uintptr = pApi + var pNew uintptr + var nName Sqlite3_int64 // Size of zName and its \0 terminator + var nByte Sqlite3_int64 // Bytes of space to allocate + var rc int32 = SQLITE_OK + + nName = (Sqlite3_int64(libc.Xstrlen(tls, zName) + uint64(1))) + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5TokenizerModule{})) + uint64(nName))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew != 0 { + libc.Xmemset(tls, pNew, 0, Size_t(nByte)) + (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).FzName = (pNew + 1*56) + libc.Xmemcpy(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).FzName, zName, uint64(nName)) + (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).FpUserData = pUserData + (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).Fx = *(*Fts5_tokenizer)(unsafe.Pointer(pTokenizer)) + (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).FxDestroy = xDestroy + (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).FpNext = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpTok + (*Fts5Global)(unsafe.Pointer(pGlobal)).FpTok = pNew + if (*Fts5TokenizerModule)(unsafe.Pointer(pNew)).FpNext == uintptr(0) { + (*Fts5Global)(unsafe.Pointer(pGlobal)).FpDfltTok = pNew + } + } else { + rc = SQLITE_NOMEM + } + + return rc +} + +func fts5LocateTokenizer(tls *libc.TLS, pGlobal uintptr, zName uintptr) uintptr { /* sqlite3.c:230463:28: */ + var pMod uintptr = uintptr(0) + + if zName == uintptr(0) { + pMod = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpDfltTok + } else { + for pMod = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpTok; pMod != 0; pMod = (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpNext { + if Xsqlite3_stricmp(tls, zName, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FzName) == 0 { + break + } + } + } + + return pMod +} + +// Find a tokenizer. This is the implementation of the +// fts5_api.xFindTokenizer() method. +func fts5FindTokenizer(tls *libc.TLS, pApi uintptr, zName uintptr, ppUserData uintptr, pTokenizer uintptr) int32 { /* sqlite3.c:230484:12: */ + var rc int32 = SQLITE_OK + var pMod uintptr + + pMod = fts5LocateTokenizer(tls, pApi, zName) + if pMod != 0 { + *(*Fts5_tokenizer)(unsafe.Pointer(pTokenizer)) = (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).Fx + *(*uintptr)(unsafe.Pointer(ppUserData)) = (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData + } else { + libc.Xmemset(tls, pTokenizer, 0, uint64(unsafe.Sizeof(Fts5_tokenizer{}))) + rc = SQLITE_ERROR + } + + return rc +} + +func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg int32, pConfig uintptr, pzErr uintptr) int32 { /* sqlite3.c:230505:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pMod uintptr + var rc int32 = SQLITE_OK + + pMod = fts5LocateTokenizer(tls, pGlobal, func() uintptr { + if nArg == 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(azArg)) + }()) + if pMod == uintptr(0) { + + rc = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33998 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + } else { + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 16 /* &.x */ /* &.xCreate */))))(tls, + (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { + if azArg != 0 { + return (azArg + 1*8) + } + return uintptr(0) + }(), func() int32 { + if nArg != 0 { + return (nArg - 1) + } + return 0 + }(), (pConfig + 104 /* &.pTok */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 16 /* &.x */) + if rc != SQLITE_OK { + if pzErr != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34020 /* "error in tokeniz..." */, 0) + } + } else { + (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, + (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).Fx.FxCreate, (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok) + } + } + + if rc != SQLITE_OK { + (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = uintptr(0) + (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok = uintptr(0) + } + + return rc +} + +func fts5ModuleDestroy(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:230542:13: */ + var pTok uintptr + var pNextTok uintptr + var pAux uintptr + var pNextAux uintptr + var pGlobal uintptr = pCtx + + for pAux = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpAux; pAux != 0; pAux = pNextAux { + pNextAux = (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpNext + if (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FxDestroy != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pAux + 32 /* &.xDestroy */))))(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpUserData) + } + Xsqlite3_free(tls, pAux) + } + + for pTok = (*Fts5Global)(unsafe.Pointer(pGlobal)).FpTok; pTok != 0; pTok = pNextTok { + pNextTok = (*Fts5TokenizerModule)(unsafe.Pointer(pTok)).FpNext + if (*Fts5TokenizerModule)(unsafe.Pointer(pTok)).FxDestroy != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pTok + 40 /* &.xDestroy */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pTok)).FpUserData) + } + Xsqlite3_free(tls, pTok) + } + + Xsqlite3_free(tls, pGlobal) +} + +func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:230562:13: */ + var pGlobal uintptr = Xsqlite3_user_data(tls, pCtx) + var ppApi uintptr + _ = nArg + + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34051 /* "fts5_api_ptr" */) + if ppApi != 0 { + *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) + } +} + +// Implementation of fts5_source_id() function. +func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) { /* sqlite3.c:230578:13: */ + + _ = nArg + _ = apUnused + Xsqlite3_result_text(tls, pCtx, ts+34064 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) +} + +// Return true if zName is the extension on one of the shadow tables used +// by this module. +func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12: */ + var i uint32 + for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof(azName2)) / uint64(unsafe.Sizeof(uintptr(0)))); i++ { + if Xsqlite3_stricmp(tls, zName, azName2[i]) == 0 { + return 1 + } + } + return 0 +} + +var azName2 = [5]uintptr{ + ts + 34155 /* "config" */, ts + 32254 /* "content" */, ts + 23317 /* "data" */, ts + 32605 /* "docsize" */, ts + 10213, /* "idx" */ +} /* sqlite3.c:230593:21 */ + +func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ + var rc int32 + var pGlobal uintptr = uintptr(0) + + pGlobal = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5Global{}))) + if pGlobal == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var p uintptr = pGlobal + libc.Xmemset(tls, pGlobal, 0, uint64(unsafe.Sizeof(Fts5Global{}))) + (*Fts5Global)(unsafe.Pointer(pGlobal)).Fdb = db + (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FiVersion = 2 + (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateFunction = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, Fts5_extension_function, uintptr) int32 + }{fts5CreateAux})) + (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxCreateTokenizer = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) int32 + }{fts5CreateTokenizer})) + (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 + }{fts5FindTokenizer})) + rc = Xsqlite3_create_module_v2(tls, db, ts+34162 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + if rc == SQLITE_OK { + rc = sqlite3Fts5IndexInit(tls, db) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5ExprInit(tls, pGlobal, db) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5AuxInit(tls, (pGlobal /* &.api */)) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5TokenizerInit(tls, (pGlobal /* &.api */)) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5VocabInit(tls, pGlobal, db) + } + if rc == SQLITE_OK { + rc = Xsqlite3_create_function(tls, + db, ts+34162 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{fts5Fts5Func})), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_create_function(tls, + db, ts+34167 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) + }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) + } + } + + // If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file + // fts5_test_mi.c is compiled and linked into the executable. And call + // its entry point to enable the matchinfo() demo. + + return rc +} + +var fts5Mod = Sqlite3_module{ + /* iVersion */ FiVersion: 3, + /* xCreate */ FxCreate: 0, + /* xConnect */ FxConnect: 0, + /* xBestIndex */ FxBestIndex: 0, + /* xDisconnect */ FxDisconnect: 0, + /* xDestroy */ FxDestroy: 0, + /* xOpen */ FxOpen: 0, + /* xClose */ FxClose: 0, + /* xFilter */ FxFilter: 0, + /* xNext */ FxNext: 0, + /* xEof */ FxEof: 0, + /* xColumn */ FxColumn: 0, + /* xRowid */ FxRowid: 0, + /* xUpdate */ FxUpdate: 0, + /* xBegin */ FxBegin: 0, + /* xSync */ FxSync: 0, + /* xCommit */ FxCommit: 0, + /* xRollback */ FxRollback: 0, + /* xFindFunction */ FxFindFunction: 0, + /* xRename */ FxRename: 0, + /* xSavepoint */ FxSavepoint: 0, + /* xRelease */ FxRelease: 0, + /* xRollbackTo */ FxRollbackTo: 0, + /* xShadowName */ FxShadowName: 0, +} /* sqlite3.c:230604:31 */ + +// The following functions are used to register the module with SQLite. If +// this module is being built as part of the SQLite core (SQLITE_CORE is +// defined), then sqlite3_open() will call sqlite3Fts5Init() directly. +// +// Or, if this module is being built as a loadable extension, +// sqlite3Fts5Init() is omitted and the two standard entry points +// sqlite3_fts_init() and sqlite3_fts5_init() defined instead. +func Xsqlite3Fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230712:20: */ + return fts5Init(tls, db) +} + +// Prepare the two insert statements - Fts5Storage.pInsertContent and +// Fts5Storage.pInsertDocsize - if they have not already been prepared. +// Return SQLITE_OK if successful, or an SQLite error code if an error +// occurs. +func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:230770:12: */ + bp := tls.Alloc(216) + defer tls.Free(216) + + var rc int32 = SQLITE_OK + + // If there is no %_docsize table, there should be no requests for + // statements to operate on it. + + if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { + *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ + ts + 34182, /* "SELECT %s FROM %..." */ + ts + 34250, /* "SELECT %s FROM %..." */ + ts + 34319, /* "SELECT %s FROM %..." */ // LOOKUP + + ts + 34352, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34391, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34431, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34470, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34511, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + + ts + 34550, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + + ts + 34592, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 34632, /* "SELECT %s FROM %..." */ // SCAN + } + var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + var zSql uintptr = uintptr(0) + + switch eStmt { + case FTS5_STMT_SCAN: + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, (*Fts5Config)(unsafe.Pointer(pC)).FzContent)) + break + fallthrough + + case FTS5_STMT_SCAN_ASC: + fallthrough + case FTS5_STMT_SCAN_DESC: + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, + (*Fts5Config)(unsafe.Pointer(pC)).FzContent, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid, + (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid)) + break + fallthrough + + case FTS5_STMT_LOOKUP: + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), + libc.VaList(bp+56, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, (*Fts5Config)(unsafe.Pointer(pC)).FzContent, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid)) + break + fallthrough + + case FTS5_STMT_INSERT_CONTENT: + fallthrough + case FTS5_STMT_REPLACE_CONTENT: + { + var nCol int32 = ((*Fts5Config)(unsafe.Pointer(pC)).FnCol + 1) + var zBind uintptr + var i int32 + + zBind = Xsqlite3_malloc64(tls, (uint64(1 + (nCol * 2)))) + if zBind != 0 { + for i = 0; i < nCol; i++ { + *(*int8)(unsafe.Pointer(zBind + uintptr((i * 2)))) = int8('?') + *(*int8)(unsafe.Pointer(zBind + uintptr(((i * 2) + 1)))) = int8(',') + } + *(*int8)(unsafe.Pointer(zBind + uintptr(((i * 2) - 1)))) = int8(0) + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+80, (*Fts5Config)(unsafe.Pointer(pC)).FzDb, (*Fts5Config)(unsafe.Pointer(pC)).FzName, zBind)) + Xsqlite3_free(tls, zBind) + } + break + + } + fallthrough + + default: + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+104, (*Fts5Config)(unsafe.Pointer(pC)).FzDb, (*Fts5Config)(unsafe.Pointer(pC)).FzName)) + break + } + + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var f int32 = SQLITE_PREPARE_PERSISTENT + if eStmt > FTS5_STMT_LOOKUP { + f = f | (SQLITE_PREPARE_NO_VTAB) + } + (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock++ + rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb, zSql, -1, uint32(f), ((p + 40 /* &.aStmt */) + uintptr(eStmt)*8), uintptr(0)) + (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- + Xsqlite3_free(tls, zSql) + if (rc != SQLITE_OK) && (pzErrMsg != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2791 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + } + } + } + + *(*uintptr)(unsafe.Pointer(ppStmt)) = *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) + Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(ppStmt))) + return rc +} + +func fts5ExecPrintf(tls *libc.TLS, db uintptr, pzErr uintptr, zFormat uintptr, va uintptr) int32 { /* sqlite3.c:230873:12: */ + var rc int32 + var ap Va_list + _ = ap // ... printf arguments + var zSql uintptr + + ap = va + zSql = Xsqlite3_vmprintf(tls, zFormat, ap) + + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + rc = Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), pzErr) + Xsqlite3_free(tls, zSql) + } + + _ = ap + return rc +} + +// Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error +// code otherwise. +func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230901:12: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), + + ts+34655, /* "DROP TABLE IF EX..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), + ts+34759, /* "DROP TABLE IF EX..." */ + libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + } + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), + ts+34797, /* "DROP TABLE IF EX..." */ + libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + } + return rc +} + +func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uintptr, zName uintptr) { /* sqlite3.c:230925:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), + ts+34835, /* "ALTER TABLE %Q.'..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) + } +} + +func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) int32 { /* sqlite3.c:230939:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig + *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) + + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23317 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10213 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34155 /* "config" */, zName) + if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32605 /* "docsize" */, zName) + } + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32254 /* "content" */, zName) + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Create the shadow table named zPost, with definition zDefn. Return +// SQLITE_OK if successful, or an SQLite error code otherwise. +func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn uintptr, bWithout int32, pzErr uintptr) int32 { /* sqlite3.c:230959:12: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + var rc int32 + *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) + + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+34877, /* "CREATE TABLE %Q...." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, + func() uintptr { + if bWithout != 0 { + return ts + 27932 /* " WITHOUT ROWID" */ + } + return ts + 756 /* "" */ + }())) + if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, + ts+34907, /* "fts5: error crea..." */ + libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) + } + + return rc +} + +// Open a new Fts5Index handle. If the bCreate argument is true, create +// and initialize the underlying tables +// +// If successful, set *pp to point to the new object and return SQLITE_OK. +// Otherwise, set *pp to NULL and return an SQLite error code. +func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCreate int32, pp uintptr, pzErr uintptr) int32 { /* sqlite3.c:230994:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var p uintptr // New object + var nByte Sqlite3_int64 // Bytes of space to allocate + + nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(Fts5Storage{})) + // Fts5Storage object + (uint64((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol) * uint64(unsafe.Sizeof(I64(0)))))) // Fts5Storage.aTotalSize[] + *(*uintptr)(unsafe.Pointer(pp)) = libc.AssignUintptr(&p, Xsqlite3_malloc64(tls, uint64(nByte))) + if !(p != 0) { + return SQLITE_NOMEM + } + + libc.Xmemset(tls, p, 0, Size_t(nByte)) + (*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize = (p + 1*128) + (*Fts5Storage)(unsafe.Pointer(p)).FpConfig = pConfig + (*Fts5Storage)(unsafe.Pointer(p)).FpIndex = pIndex + + if bCreate != 0 { + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { + var nDefn int32 = (32 + ((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol * 10)) + var zDefn uintptr = Xsqlite3_malloc64(tls, (uint64(int64(32) + (Sqlite3_int64((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol) * int64(10))))) + if zDefn == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var iOff int32 + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34951 /* "id INTEGER PRIMA..." */, 0) + iOff = int32(libc.Xstrlen(tls, zDefn)) + for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34974 /* ", c%d" */, libc.VaList(bp, i)) + iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) + } + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32254 /* "content" */, zDefn, 0, pzErr) + } + Xsqlite3_free(tls, zDefn) + } + + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { + rc = sqlite3Fts5CreateTable(tls, + pConfig, ts+32605 /* "docsize" */, ts+34980 /* "id INTEGER PRIMA..." */, 0, pzErr) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5CreateTable(tls, + pConfig, ts+34155 /* "config" */, ts+35012 /* "k PRIMARY KEY, v" */, 1, pzErr) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32751 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + } + } + + if rc != 0 { + sqlite3Fts5StorageClose(tls, p) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + return rc +} + +// Close a handle opened by an earlier call to sqlite3Fts5StorageOpen(). +func sqlite3Fts5StorageClose(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231060:12: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 + + // Finalize all SQL statements + for i = 0; i < (int32(uint64(unsafe.Sizeof([11]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))); i++ { + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(i)*8))) + } + + Xsqlite3_free(tls, p) + } + return rc +} + +type Fts5InsertCtx1 = struct { + FpStorage uintptr + FiCol int32 + FszCol int32 +} /* sqlite3.c:231075:9 */ + +type Fts5InsertCtx = Fts5InsertCtx1 /* sqlite3.c:231075:30 */ + +// Tokenization callback used when inserting tokens into the FTS index. +func fts5StorageInsertCallback(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iUnused1 int32, iUnused2 int32) int32 { /* sqlite3.c:231085:12: */ + var pCtx uintptr = pContext + var pIdx uintptr = (*Fts5Storage)(unsafe.Pointer((*Fts5InsertCtx)(unsafe.Pointer(pCtx)).FpStorage)).FpIndex + _ = iUnused1 + _ = iUnused2 + if nToken > FTS5_MAX_TOKEN_SIZE { + nToken = FTS5_MAX_TOKEN_SIZE + } + if ((tflags & FTS5_TOKEN_COLOCATED) == 0) || ((*Fts5InsertCtx)(unsafe.Pointer(pCtx)).FszCol == 0) { + (*Fts5InsertCtx)(unsafe.Pointer(pCtx)).FszCol++ + } + return sqlite3Fts5IndexWrite(tls, pIdx, (*Fts5InsertCtx)(unsafe.Pointer(pCtx)).FiCol, ((*Fts5InsertCtx)(unsafe.Pointer(pCtx)).FszCol - 1), pToken, nToken) +} + +// If a row with rowid iDel is present in the %_content table, add the +// delete-markers to the FTS index necessary to delete it. Do not actually +// remove the %_content row at this time though. +func fts5StorageDeleteFromIndex(tls *libc.TLS, p uintptr, iDel I64, apVal uintptr) int32 { /* sqlite3.c:231108:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + *(*uintptr)(unsafe.Pointer(bp /* pSeek */)) = uintptr(0) // SELECT to read row iDel from %_data + var rc int32 // Return code + var rc2 int32 // sqlite3_reset() return code + var iCol int32 + // var ctx Fts5InsertCtx at bp+8, 16 + + if apVal == uintptr(0) { + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_LOOKUP, bp /* &pSeek */, uintptr(0)) + if rc != SQLITE_OK { + return rc + } + Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pSeek */)), 1, iDel) + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSeek */))) != SQLITE_ROW { + return Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pSeek */))) + } + } + + (*Fts5InsertCtx)(unsafe.Pointer(bp + 8 /* &ctx */)).FpStorage = p + (*Fts5InsertCtx)(unsafe.Pointer(bp + 8 /* &ctx */)).FiCol = -1 + rc = sqlite3Fts5IndexBeginWrite(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, 1, iDel) + for iCol = 1; (rc == SQLITE_OK) && (iCol <= (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); iCol++ { + if int32(*(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr((iCol - 1))))) == 0 { + var zText uintptr + var nText int32 + if *(*uintptr)(unsafe.Pointer(bp /* pSeek */)) != 0 { + zText = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pSeek */)), iCol) + nText = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pSeek */)), iCol) + } else { + zText = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol-1))*8))) + nText = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol-1))*8))) + } + (*Fts5InsertCtx)(unsafe.Pointer(bp + 8 /* &ctx */)).FszCol = 0 + rc = sqlite3Fts5Tokenize(tls, pConfig, FTS5_TOKENIZE_DOCUMENT, + zText, nText, bp+8 /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5StorageInsertCallback}))) + *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((iCol-1))*8)) -= (I64((*Fts5InsertCtx)(unsafe.Pointer(bp + 8 /* &ctx */)).FszCol)) + if *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((iCol-1))*8)) < int64(0) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + } + if (rc == SQLITE_OK) && ((*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow < int64(1)) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } else { + (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow-- + } + + rc2 = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pSeek */))) + if rc == SQLITE_OK { + rc = rc2 + } + return rc +} + +// Insert a record into the %_docsize table. Specifically, do: +// +// INSERT OR REPLACE INTO %_docsize(id, sz) VALUES(iRowid, pBuf); +// +// If there is no %_docsize table (as happens if the columnsize=0 option +// is specified when the FTS5 table is created), this function is a no-op. +func fts5StorageInsertDocsize(tls *libc.TLS, p uintptr, iRowid I64, pBuf uintptr) int32 { /* sqlite3.c:231173:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + if (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbColumnsize != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pReplace */)) = uintptr(0) + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_REPLACE_DOCSIZE, bp /* &pReplace */, uintptr(0)) + if rc == SQLITE_OK { + Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 1, iRowid) + Xsqlite3_bind_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 2, (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fp, (*Fts5Buffer)(unsafe.Pointer(pBuf)).Fn, uintptr(0)) + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */))) + Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 2) + } + } + return rc +} + +// Load the contents of the "averages" record from disk into the +// p->nTotalRow and p->aTotalSize[] variables. If successful, and if +// argument bCache is true, set the p->bTotalsValid flag to indicate +// that the contents of aTotalSize[] and nTotalRow are valid until +// further notice. +// +// Return SQLITE_OK if successful, or an SQLite error code if an error +// occurs. +func fts5StorageLoadTotals(tls *libc.TLS, p uintptr, bCache int32) int32 { /* sqlite3.c:231203:12: */ + var rc int32 = SQLITE_OK + if (*Fts5Storage)(unsafe.Pointer(p)).FbTotalsValid == 0 { + rc = sqlite3Fts5IndexGetAverages(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, (p + 24 /* &.nTotalRow */), (*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize) + (*Fts5Storage)(unsafe.Pointer(p)).FbTotalsValid = bCache + } + return rc +} + +// Store the current contents of the p->nTotalRow and p->aTotalSize[] +// variables in the "averages" record on disk. +// +// Return SQLITE_OK if successful, or an SQLite error code if an error +// occurs. +func fts5StorageSaveTotals(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231219:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var nCol int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FnCol + var i int32 + // var buf Fts5Buffer at bp, 16 + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + + sqlite3Fts5BufferAppendVarint(tls, bp+16 /* &rc */, bp /* &buf */, (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) + for i = 0; i < nCol; i++ { + sqlite3Fts5BufferAppendVarint(tls, bp+16 /* &rc */, bp /* &buf */, *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5IndexSetAverages(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fn) + } + Xsqlite3_free(tls, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Remove a row from the FTS table. +func sqlite3Fts5StorageDelete(tls *libc.TLS, p uintptr, iDel I64, apVal uintptr) int32 { /* sqlite3.c:231241:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + var rc int32 + *(*uintptr)(unsafe.Pointer(bp /* pDel */)) = uintptr(0) + + rc = fts5StorageLoadTotals(tls, p, 1) + + // Delete the index records + if rc == SQLITE_OK { + rc = fts5StorageDeleteFromIndex(tls, p, iDel, apVal) + } + + // Delete the %_docsize record + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_DELETE_DOCSIZE, bp /* &pDel */, uintptr(0)) + if rc == SQLITE_OK { + Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pDel */)), 1, iDel) + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pDel */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pDel */))) + } + } + + // Delete the %_content record + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { + if rc == SQLITE_OK { + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_DELETE_CONTENT, bp /* &pDel */, uintptr(0)) + } + if rc == SQLITE_OK { + Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pDel */)), 1, iDel) + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pDel */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pDel */))) + } + } + + return rc +} + +// Delete all entries in the FTS5 index. +func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231282:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + var rc int32 + + (*Fts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 + + // Delete the contents of the %_data and %_docsize tables. + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), + + ts+35029, /* "DELETE FROM %Q.'..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), + ts+35079, /* "DELETE FROM %Q.'..." */ + libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + } + + // Reinitialize the %_data table. This call creates the initial structure + // and averages records. + if rc == SQLITE_OK { + rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) + } + if rc == SQLITE_OK { + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32751 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + } + return rc +} + +func sqlite3Fts5StorageRebuild(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231313:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*Fts5Buffer)(unsafe.Pointer(bp + 24 /* buf */)) = Fts5Buffer{} + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + *(*uintptr)(unsafe.Pointer(bp + 16 /* pScan */)) = uintptr(0) + // var ctx Fts5InsertCtx at bp, 16 + + // var rc int32 at bp+40, 4 + + var rc2 int32 + + libc.Xmemset(tls, bp /* &ctx */, 0, uint64(unsafe.Sizeof(Fts5InsertCtx{}))) + (*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FpStorage = p + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5StorageDeleteAll(tls, p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5StorageLoadTotals(tls, p, 1) + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5StorageGetStmt(tls, p, FTS5_STMT_SCAN, bp+16 /* &pScan */, uintptr(0)) + } + + for (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pScan */)))) { + var iRowid I64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pScan */)), 0) + + sqlite3Fts5BufferZero(tls, bp+24 /* &buf */) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5IndexBeginWrite(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, 0, iRowid) + for (*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol = 0; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); (*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol++ { + (*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol = 0 + if int32(*(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol)))) == 0 { + var zText uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pScan */)), ((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol + 1)) + var nText int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pScan */)), ((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol + 1)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5Tokenize(tls, pConfig, + FTS5_TOKENIZE_DOCUMENT, + zText, nText, + bp, /* &ctx */ + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5StorageInsertCallback}))) + } + sqlite3Fts5BufferAppendVarint(tls, bp+40 /* &rc */, bp+24 /* &buf */, int64((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol)) + *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol)*8)) += (I64((*Fts5InsertCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol)) + } + (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow++ + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5StorageInsertDocsize(tls, p, iRowid, bp+24 /* &buf */) + } + } + Xsqlite3_free(tls, (*Fts5Buffer)(unsafe.Pointer(bp+24 /* &buf */)).Fp) + rc2 = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pScan */))) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = rc2 + } + + // Write the averages record + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5StorageSaveTotals(tls, p) + } + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +func sqlite3Fts5StorageOptimize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231368:12: */ + return sqlite3Fts5IndexOptimize(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) +} + +func sqlite3Fts5StorageMerge(tls *libc.TLS, p uintptr, nMerge int32) int32 { /* sqlite3.c:231372:12: */ + return sqlite3Fts5IndexMerge(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, nMerge) +} + +func sqlite3Fts5StorageReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231376:12: */ + return sqlite3Fts5IndexReset(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) +} + +// Allocate a new rowid. This is used for "external content" tables when +// a NULL value is inserted into the rowid column. The new rowid is allocated +// by inserting a dummy row into the %_docsize table. The dummy will be +// overwritten later. +// +// If the %_docsize table does not exist, SQLITE_MISMATCH is returned. In +// this case the user is required to provide a rowid explicitly. +func fts5StorageNewRowid(tls *libc.TLS, p uintptr, piRowid uintptr) int32 { /* sqlite3.c:231389:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_MISMATCH + if (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbColumnsize != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pReplace */)) = uintptr(0) + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_REPLACE_DOCSIZE, bp /* &pReplace */, uintptr(0)) + if rc == SQLITE_OK { + Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 1) + Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 2) + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */))) + } + if rc == SQLITE_OK { + *(*I64)(unsafe.Pointer(piRowid)) = Xsqlite3_last_insert_rowid(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).Fdb) + } + } + return rc +} + +// Insert a new row into the FTS content table. +func sqlite3Fts5StorageContentInsert(tls *libc.TLS, p uintptr, apVal uintptr, piRowid uintptr) int32 { /* sqlite3.c:231410:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + var rc int32 = SQLITE_OK + + // Insert the new row into the %_content table. + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(piRowid)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) + } else { + rc = fts5StorageNewRowid(tls, p, piRowid) + } + } else { + *(*uintptr)(unsafe.Pointer(bp /* pInsert */)) = uintptr(0) // Statement to write %_content table + var i int32 // Counter variable + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_INSERT_CONTENT, bp /* &pInsert */, uintptr(0)) + for i = 1; (rc == SQLITE_OK) && (i <= ((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol + 1)); i++ { + rc = Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp /* pInsert */)), i, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pInsert */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pInsert */))) + } + *(*I64)(unsafe.Pointer(piRowid)) = Xsqlite3_last_insert_rowid(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb) + } + + return rc +} + +// Insert new entries into the FTS index and %_docsize table. +func sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRowid I64) int32 { /* sqlite3.c:231445:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code + // var ctx Fts5InsertCtx at bp+16, 16 + // Tokenization callback context object + // var buf Fts5Buffer at bp, 16 + // Buffer used to build up %_docsize blob + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(Fts5Buffer{}))) + (*Fts5InsertCtx)(unsafe.Pointer(bp + 16 /* &ctx */)).FpStorage = p + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = fts5StorageLoadTotals(tls, p, 1) + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sqlite3Fts5IndexBeginWrite(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, 0, iRowid) + } + for (*Fts5InsertCtx)(unsafe.Pointer(bp + 16 /* &ctx */)).FiCol = 0; (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && ((*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FiCol < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); (*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FiCol++ { + (*Fts5InsertCtx)(unsafe.Pointer(bp + 16 /* &ctx */)).FszCol = 0 + if int32(*(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr((*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FiCol)))) == 0 { + var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FiCol+2))*8))) + var nText int32 = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FiCol+2))*8))) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sqlite3Fts5Tokenize(tls, pConfig, + FTS5_TOKENIZE_DOCUMENT, + zText, nText, + bp+16, /* &ctx */ + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5StorageInsertCallback}))) + } + sqlite3Fts5BufferAppendVarint(tls, bp+32 /* &rc */, bp /* &buf */, int64((*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FszCol)) + *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr((*Fts5InsertCtx)(unsafe.Pointer(bp+16 /* &ctx */)).FiCol)*8)) += (I64((*Fts5InsertCtx)(unsafe.Pointer(bp + 16 /* &ctx */)).FszCol)) + } + (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow++ + + // Write the %_docsize record + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = fts5StorageInsertDocsize(tls, p, iRowid, bp /* &buf */) + } + Xsqlite3_free(tls, (*Fts5Buffer)(unsafe.Pointer(bp /* &buf */)).Fp) + + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) int32 { /* sqlite3.c:231488:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + var zSql uintptr + var rc int32 + + zSql = Xsqlite3_mprintf(tls, ts+35108, /* "SELECT count(*) ..." */ + libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) + if zSql == uintptr(0) { + rc = SQLITE_NOMEM + } else { + *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */)) = uintptr(0) + rc = Xsqlite3_prepare_v2(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, bp+24 /* &pCnt */, uintptr(0)) + if rc == SQLITE_OK { + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */))) { + *(*I64)(unsafe.Pointer(pnRow)) = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */)), 0) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */))) + } + } + + Xsqlite3_free(tls, zSql) + return rc +} + +// Context object used by sqlite3Fts5StorageIntegrity(). +type Fts5IntegrityCtx1 = struct { + FiRowid I64 + FiCol int32 + FszCol int32 + Fcksum U64 + FpTermset uintptr + FpConfig uintptr +} /* sqlite3.c:231516:9 */ + +// Context object used by sqlite3Fts5StorageIntegrity(). +type Fts5IntegrityCtx = Fts5IntegrityCtx1 /* sqlite3.c:231516:33 */ + +// Tokenization callback used by integrity check. +func fts5StorageIntegrityCallback(tls *libc.TLS, pContext uintptr, tflags int32, pToken uintptr, nToken int32, iUnused1 int32, iUnused2 int32) int32 { /* sqlite3.c:231530:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pCtx uintptr = pContext + var pTermset uintptr = (*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FpTermset + // var bPresent int32 at bp, 4 + + var ii int32 + var rc int32 = SQLITE_OK + var iPos int32 + var iCol int32 + + _ = iUnused1 + _ = iUnused2 + if nToken > FTS5_MAX_TOKEN_SIZE { + nToken = FTS5_MAX_TOKEN_SIZE + } + + if ((tflags & FTS5_TOKEN_COLOCATED) == 0) || ((*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FszCol == 0) { + (*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FszCol++ + } + + switch (*Fts5Config)(unsafe.Pointer((*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FpConfig)).FeDetail { + case FTS5_DETAIL_FULL: + iPos = ((*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FszCol - 1) + iCol = (*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FiCol + break + + case FTS5_DETAIL_COLUMNS: + iPos = (*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FiCol + iCol = 0 + break + + default: + + iPos = 0 + iCol = 0 + break + } + + rc = sqlite3Fts5TermsetAdd(tls, pTermset, 0, pToken, nToken, bp /* &bPresent */) + if (rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* bPresent */)) == 0) { + *(*U64)(unsafe.Pointer(pCtx + 16 /* &.cksum */)) ^= (sqlite3Fts5IndexEntryCksum(tls, + (*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FiRowid, iCol, iPos, 0, pToken, nToken)) + } + + for ii = 0; (rc == SQLITE_OK) && (ii < (*Fts5Config)(unsafe.Pointer((*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FpConfig)).FnPrefix); ii++ { + var nChar int32 = *(*int32)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FpConfig)).FaPrefix + uintptr(ii)*4)) + var nByte int32 = sqlite3Fts5IndexCharlenToBytelen(tls, pToken, nToken, nChar) + if nByte != 0 { + rc = sqlite3Fts5TermsetAdd(tls, pTermset, (ii + 1), pToken, nByte, bp /* &bPresent */) + if *(*int32)(unsafe.Pointer(bp /* bPresent */)) == 0 { + *(*U64)(unsafe.Pointer(pCtx + 16 /* &.cksum */)) ^= (sqlite3Fts5IndexEntryCksum(tls, + (*Fts5IntegrityCtx)(unsafe.Pointer(pCtx)).FiRowid, iCol, iPos, (ii + 1), pToken, nByte)) + } + } + } + + return rc +} + +// Check that the contents of the FTS index match that of the %_content +// table. Return SQLITE_OK if they do, or SQLITE_CORRUPT if not. Return +// some other SQLite error code if an error occurs while attempting to +// determine this. +func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { /* sqlite3.c:231600:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + var rc int32 = SQLITE_OK // Return code + var aColSize uintptr // Array of size pConfig->nCol + var aTotalSize uintptr // Array of size pConfig->nCol + // var ctx Fts5IntegrityCtx at bp, 40 + + // var pScan uintptr at bp+40, 8 + + var bUseCksum int32 + + libc.Xmemset(tls, bp /* &ctx */, 0, uint64(unsafe.Sizeof(Fts5IntegrityCtx{}))) + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FpConfig = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig + aTotalSize = Xsqlite3_malloc64(tls, (uint64(uint64((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol) * (uint64(unsafe.Sizeof(int32(0))) + uint64(unsafe.Sizeof(I64(0))))))) + if !(aTotalSize != 0) { + return SQLITE_NOMEM + } + aColSize = (aTotalSize + uintptr((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)*8) + libc.Xmemset(tls, aTotalSize, 0, (uint64(unsafe.Sizeof(I64(0))) * uint64((*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))) + + bUseCksum = (libc.Bool32(((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) || + (((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_EXTERNAL) && (iArg != 0)))) + if bUseCksum != 0 { + // Generate the expected index checksum based on the contents of the + // %_content table. This block stores the checksum in ctx.cksum. + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_SCAN, bp+40 /* &pScan */, uintptr(0)) + if rc == SQLITE_OK { + var rc2 int32 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pScan */))) { + var i int32 + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FiRowid = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pScan */)), 0) + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol = 0 + if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { + rc = sqlite3Fts5StorageDocsize(tls, p, (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FiRowid, aColSize) + } + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_NONE) { + rc = sqlite3Fts5TermsetNew(tls, (bp /* &ctx */ + 24 /* &.pTermset */)) + } + for i = 0; (rc == SQLITE_OK) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { + if *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FabUnindexed + uintptr(i))) != 0 { + continue + } + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FiCol = i + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol = 0 + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_COLUMNS { + rc = sqlite3Fts5TermsetNew(tls, (bp /* &ctx */ + 24 /* &.pTermset */)) + } + if rc == SQLITE_OK { + var zText uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pScan */)), (i + 1)) + var nText int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pScan */)), (i + 1)) + rc = sqlite3Fts5Tokenize(tls, pConfig, + FTS5_TOKENIZE_DOCUMENT, + zText, nText, + bp, /* &ctx */ + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5StorageIntegrityCallback}))) + } + if ((rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0)) && ((*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol != *(*int32)(unsafe.Pointer(aColSize + uintptr(i)*4))) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + *(*I64)(unsafe.Pointer(aTotalSize + uintptr(i)*8)) += (I64((*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FszCol)) + if (*Fts5Config)(unsafe.Pointer(pConfig)).FeDetail == FTS5_DETAIL_COLUMNS { + sqlite3Fts5TermsetFree(tls, (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FpTermset) + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FpTermset = uintptr(0) + } + } + sqlite3Fts5TermsetFree(tls, (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FpTermset) + (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).FpTermset = uintptr(0) + + if rc != SQLITE_OK { + break + } + } + rc2 = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pScan */))) + if rc == SQLITE_OK { + rc = rc2 + } + } + + // Test that the "totals" (sometimes called "averages") record looks Ok + if rc == SQLITE_OK { + var i int32 + rc = fts5StorageLoadTotals(tls, p, 0) + for i = 0; (rc == SQLITE_OK) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { + if *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8)) != *(*I64)(unsafe.Pointer(aTotalSize + uintptr(i)*8)) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + } + + // Check that the %_docsize and %_content tables contain the expected + // number of rows. + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { + *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) + rc = fts5StorageCount(tls, p, ts+32254 /* "content" */, bp+48 /* &nRow */) + if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { + *(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) = int64(0) + rc = fts5StorageCount(tls, p, ts+32605 /* "docsize" */, bp+56 /* &nRow */) + if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + } + + // Pass the expected checksum down to the FTS index module. It will + // verify, amongst other things, that it matches the checksum generated by + // inspecting the index itself. + if rc == SQLITE_OK { + rc = sqlite3Fts5IndexIntegrityCheck(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, (*Fts5IntegrityCtx)(unsafe.Pointer(bp /* &ctx */)).Fcksum, bUseCksum) + } + + Xsqlite3_free(tls, aTotalSize) + return rc +} + +// Obtain an SQLite statement handle that may be used to read data from the +// %_content table. +func sqlite3Fts5StorageStmt(tls *libc.TLS, p uintptr, eStmt int32, pp uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:231708:12: */ + var rc int32 + + rc = fts5StorageGetStmt(tls, p, eStmt, pp, pzErrMsg) + if rc == SQLITE_OK { + + *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) = uintptr(0) + } + return rc +} + +// Release an SQLite statement handle obtained via an earlier call to +// sqlite3Fts5StorageStmt(). The eStmt parameter passed to this function +// must match that passed to the sqlite3Fts5StorageStmt() call. +func sqlite3Fts5StorageStmtRelease(tls *libc.TLS, p uintptr, eStmt int32, pStmt uintptr) { /* sqlite3.c:231732:13: */ + + if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { + Xsqlite3_reset(tls, pStmt) + *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) = pStmt + } else { + Xsqlite3_finalize(tls, pStmt) + } +} + +func fts5StorageDecodeSizeArray(tls *libc.TLS, aCol uintptr, nCol int32, aBlob uintptr, nBlob int32) int32 { /* sqlite3.c:231749:12: */ + var i int32 + var iOff int32 = 0 + for i = 0; i < nCol; i++ { + if iOff >= nBlob { + return 1 + } + iOff = iOff + (sqlite3Fts5GetVarint32(tls, (aBlob + uintptr(iOff)), (aCol + uintptr(i)*4))) + } + return (libc.Bool32(iOff != nBlob)) +} + +// Argument aCol points to an array of integers containing one entry for +// each table column. This function reads the %_docsize record for the +// specified rowid and populates aCol[] with the results. +// +// An SQLite error code is returned if an error occurs, or SQLITE_OK +// otherwise. +func sqlite3Fts5StorageDocsize(tls *libc.TLS, p uintptr, iRowid I64, aCol uintptr) int32 { /* sqlite3.c:231770:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var nCol int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FnCol // Number of user columns in table + *(*uintptr)(unsafe.Pointer(bp /* pLookup */)) = uintptr(0) // Statement to query %_docsize + var rc int32 // Return Code + + rc = fts5StorageGetStmt(tls, p, FTS5_STMT_LOOKUP_DOCSIZE, bp /* &pLookup */, uintptr(0)) + if rc == SQLITE_OK { + var bCorrupt int32 = 1 + Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pLookup */)), 1, iRowid) + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pLookup */))) { + var aBlob uintptr = Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pLookup */)), 0) + var nBlob int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pLookup */)), 0) + if 0 == fts5StorageDecodeSizeArray(tls, aCol, nCol, aBlob, nBlob) { + bCorrupt = 0 + } + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pLookup */))) + if (bCorrupt != 0) && (rc == SQLITE_OK) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + + return rc +} + +func sqlite3Fts5StorageSize(tls *libc.TLS, p uintptr, iCol int32, pnToken uintptr) int32 { /* sqlite3.c:231796:12: */ + var rc int32 = fts5StorageLoadTotals(tls, p, 0) + if rc == SQLITE_OK { + *(*I64)(unsafe.Pointer(pnToken)) = int64(0) + if iCol < 0 { + var i int32 + for i = 0; i < (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FnCol; i++ { + *(*I64)(unsafe.Pointer(pnToken)) += (*(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(i)*8))) + } + } else if iCol < (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FnCol { + *(*I64)(unsafe.Pointer(pnToken)) = *(*I64)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FaTotalSize + uintptr(iCol)*8)) + } else { + rc = SQLITE_RANGE + } + } + return rc +} + +func sqlite3Fts5StorageRowCount(tls *libc.TLS, p uintptr, pnRow uintptr) int32 { /* sqlite3.c:231814:12: */ + var rc int32 = fts5StorageLoadTotals(tls, p, 0) + if rc == SQLITE_OK { + // nTotalRow being zero does not necessarily indicate a corrupt + // database - it might be that the FTS5 table really does contain zero + // rows. However this function is only called from the xRowCount() API, + // and there is no way for that API to be invoked if the table contains + // no rows. Hence the FTS5_CORRUPT return. + *(*I64)(unsafe.Pointer(pnRow)) = (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow + if (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow <= int64(0) { + rc = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + return rc +} + +// Flush any data currently held in-memory to disk. +func sqlite3Fts5StorageSync(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231831:12: */ + var rc int32 = SQLITE_OK + var iLastRowid I64 = Xsqlite3_last_insert_rowid(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).Fdb) + if (*Fts5Storage)(unsafe.Pointer(p)).FbTotalsValid != 0 { + rc = fts5StorageSaveTotals(tls, p) + (*Fts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 + } + if rc == SQLITE_OK { + rc = sqlite3Fts5IndexSync(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) + } + Xsqlite3_set_last_insert_rowid(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).Fdb, iLastRowid) + return rc +} + +func sqlite3Fts5StorageRollback(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231845:12: */ + (*Fts5Storage)(unsafe.Pointer(p)).FbTotalsValid = 0 + return sqlite3Fts5IndexRollback(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) +} + +func sqlite3Fts5StorageConfigValue(tls *libc.TLS, p uintptr, z uintptr, pVal uintptr, iVal int32) int32 { /* sqlite3.c:231850:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pReplace */)) = uintptr(0) + var rc int32 = fts5StorageGetStmt(tls, p, FTS5_STMT_REPLACE_CONFIG, bp /* &pReplace */, uintptr(0)) + if rc == SQLITE_OK { + Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 1, z, -1, uintptr(0)) + if pVal != 0 { + Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 2, pVal) + } else { + Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 2, iVal) + } + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */))) + Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp /* pReplace */)), 1) + } + if (rc == SQLITE_OK) && (pVal != 0) { + var iNew int32 = ((*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FiCookie + 1) + rc = sqlite3Fts5IndexSetCookie(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex, iNew) + if rc == SQLITE_OK { + (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FiCookie = iNew + } + } + return rc +} + +// 2014 May 31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// #include "fts5Int.h" + +// ************************************************************************* +// +// Start of ascii tokenizer implementation. + +// For tokenizers with no "unicode" modifier, the set of token characters +// is the same as the set of ASCII range alphanumeric characters. +var aAsciiTokenChar = [128]uint8{ + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), // 0x00..0x0F + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), // 0x10..0x1F + uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), // 0x20..0x2F + uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), // 0x30..0x3F + uint8(0), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), // 0x40..0x4F + uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), // 0x50..0x5F + uint8(0), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), // 0x60..0x6F + uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), // 0x70..0x7F +} /* sqlite3.c:231903:22 */ + +type AsciiTokenizer1 = struct{ FaTokenChar [128]uint8 } /* sqlite3.c:231914:9 */ + +type AsciiTokenizer = AsciiTokenizer1 /* sqlite3.c:231914:31 */ + +func fts5AsciiAddExceptions(tls *libc.TLS, p uintptr, zArg uintptr, bTokenChars int32) { /* sqlite3.c:231919:13: */ + var i int32 + for i = 0; *(*int8)(unsafe.Pointer(zArg + uintptr(i))) != 0; i++ { + if (int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i)))) & 0x80) == 0 { + *(*uint8)(unsafe.Pointer((p /* &.aTokenChar */) + uintptr(int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i))))))) = uint8(bTokenChars) + } + } +} + +// Delete a "ascii" tokenizer. +func fts5AsciiDelete(tls *libc.TLS, p uintptr) { /* sqlite3.c:231935:13: */ + Xsqlite3_free(tls, p) +} + +// Create an "ascii" tokenizer. +func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, ppOut uintptr) int32 { /* sqlite3.c:231942:12: */ + var rc int32 = SQLITE_OK + var p uintptr = uintptr(0) + _ = pUnused + if (nArg % 2) != 0 { + rc = SQLITE_ERROR + } else { + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(AsciiTokenizer{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(AsciiTokenizer{}))) + libc.Xmemcpy(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint64(unsafe.Sizeof(aAsciiTokenChar))) + for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { + var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35140 /* "tokenchars" */) { + fts5AsciiAddExceptions(tls, p, zArg, 1) + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35151 /* "separators" */) { + fts5AsciiAddExceptions(tls, p, zArg, 0) + } else { + rc = SQLITE_ERROR + } + } + if rc != SQLITE_OK { + fts5AsciiDelete(tls, p) + p = uintptr(0) + } + } + } + + *(*uintptr)(unsafe.Pointer(ppOut)) = p + return rc +} + +func asciiFold(tls *libc.TLS, aOut uintptr, aIn uintptr, nByte int32) { /* sqlite3.c:231983:13: */ + var i int32 + for i = 0; i < nByte; i++ { + var c int8 = *(*int8)(unsafe.Pointer(aIn + uintptr(i))) + if (int32(c) >= 'A') && (int32(c) <= 'Z') { + c = int8(int32(c) + (32)) + } + *(*int8)(unsafe.Pointer(aOut + uintptr(i))) = c + } +} + +// Tokenize some text using the ascii tokenizer. +func fts5AsciiTokenize(tls *libc.TLS, pTokenizer uintptr, pCtx uintptr, iUnused int32, pText uintptr, nText int32, xToken uintptr) int32 { /* sqlite3.c:231995:12: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var p uintptr = pTokenizer + var rc int32 = SQLITE_OK + var ie int32 + var is int32 = 0 + // var aFold [64]int8 at bp, 64 + + var nFold int32 = int32(unsafe.Sizeof([64]int8{})) + var pFold uintptr = bp /* aFold */ + var a uintptr = p /* &.aTokenChar */ + + _ = iUnused + + for (is < nText) && (rc == SQLITE_OK) { + var nByte int32 + + // Skip any leading divider characters. + for (is < nText) && (((int32(*(*int8)(unsafe.Pointer(pText + uintptr(is)))) & 0x80) == 0) && (int32(*(*uint8)(unsafe.Pointer(a + uintptr(int32(*(*int8)(unsafe.Pointer(pText + uintptr(is)))))))) == 0)) { + is++ + } + if is == nText { + break + } + + // Count the token characters + ie = (is + 1) + for (ie < nText) && (((int32(*(*int8)(unsafe.Pointer(pText + uintptr(ie)))) & 0x80) != 0) || (*(*uint8)(unsafe.Pointer(a + uintptr(int32(*(*int8)(unsafe.Pointer(pText + uintptr(ie))))))) != 0)) { + ie++ + } + + // Fold to lower case + nByte = (ie - is) + if nByte > nFold { + if pFold != bp /* aFold */ { + Xsqlite3_free(tls, pFold) + } + pFold = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nByte) * int64(2)))) + if pFold == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nFold = (nByte * 2) + } + asciiFold(tls, pFold, (pText + uintptr(is)), nByte) + + // Invoke the token callback + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&xToken)))(tls, pCtx, 0, pFold, nByte, is, ie) + is = (ie + 1) + } + + if pFold != bp /* aFold */ { + Xsqlite3_free(tls, pFold) + } + if rc == SQLITE_DONE { + rc = SQLITE_OK + } + return rc +} + +// ************************************************************************* +// +// Start of unicode61 tokenizer implementation. + +// The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied +// from the sqlite3 source file utf.c. If this file is compiled as part +// of the amalgamation, they are not required. + +type Unicode61Tokenizer1 = struct { + FaTokenChar [128]uint8 + FaFold uintptr + FnFold int32 + FeRemoveDiacritic int32 + FnException int32 + _ [4]byte + FaiException uintptr + FaCategory [32]uint8 +} /* sqlite3.c:232110:9 */ + +// ************************************************************************* +// +// Start of unicode61 tokenizer implementation. + +// The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied +// from the sqlite3 source file utf.c. If this file is compiled as part +// of the amalgamation, they are not required. + +type Unicode61Tokenizer = Unicode61Tokenizer1 /* sqlite3.c:232110:35 */ + +// Values for eRemoveDiacritic (must match internals of fts5_unicode2.c) + +func fts5UnicodeAddExceptions(tls *libc.TLS, p uintptr, z uintptr, bTokenChars int32) int32 { /* sqlite3.c:232127:12: */ + var rc int32 = SQLITE_OK + var n int32 = int32(libc.Xstrlen(tls, z)) + var aNew uintptr + + if n > 0 { + aNew = Xsqlite3_realloc64(tls, (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaiException, + (uint64((uint64(n + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnException)) * uint64(unsafe.Sizeof(int32(0)))))) + if aNew != 0 { + var nNew int32 = (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnException + var zCsr uintptr = z + var zTerm uintptr = (z + uintptr(n)) + for zCsr < zTerm { + var iCode U32 + var bToken int32 + iCode = U32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zCsr, 1)))) + if iCode >= U32(0xc0) { + iCode = U32(sqlite3Utf8Trans1[(iCode - U32(0xc0))]) + for (zCsr != zTerm) && ((int32(*(*uint8)(unsafe.Pointer(zCsr))) & 0xc0) == 0x80) { + iCode = ((iCode << 6) + (U32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zCsr, 1))))))) + } + if ((iCode < U32(0x80)) || ((iCode & 0xFFFFF800) == U32(0xD800))) || ((iCode & 0xFFFFFFFE) == U32(0xFFFE)) { + iCode = U32(0xFFFD) + } + } + + if iCode < U32(128) { + *(*uint8)(unsafe.Pointer((p /* &.aTokenChar */) + uintptr(iCode))) = uint8(bTokenChars) + } else { + bToken = int32(*(*uint8)(unsafe.Pointer((p + 160 /* &.aCategory */) + uintptr(sqlite3Fts5UnicodeCategory(tls, iCode))))) + + if (bToken != bTokenChars) && (sqlite3Fts5UnicodeIsdiacritic(tls, int32(iCode)) == 0) { + var i int32 + for i = 0; i < nNew; i++ { + if U32(*(*int32)(unsafe.Pointer(aNew + uintptr(i)*4))) > iCode { + break + } + } + libc.Xmemmove(tls, (aNew + uintptr((i+1))*4), (aNew + uintptr(i)*4), ((uint64(nNew - i)) * uint64(unsafe.Sizeof(int32(0))))) + *(*int32)(unsafe.Pointer(aNew + uintptr(i)*4)) = int32(iCode) + nNew++ + } + } + } + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaiException = aNew + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnException = nNew + } else { + rc = SQLITE_NOMEM + } + } + + return rc +} + +// Return true if the p->aiException[] array contains the value iCode. +func fts5UnicodeIsException(tls *libc.TLS, p uintptr, iCode int32) int32 { /* sqlite3.c:232177:12: */ + if (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnException > 0 { + var a uintptr = (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaiException + var iLo int32 = 0 + var iHi int32 = ((*Unicode61Tokenizer)(unsafe.Pointer(p)).FnException - 1) + + for iHi >= iLo { + var iTest int32 = ((iHi + iLo) / 2) + if iCode == *(*int32)(unsafe.Pointer(a + uintptr(iTest)*4)) { + return 1 + } else if iCode > *(*int32)(unsafe.Pointer(a + uintptr(iTest)*4)) { + iLo = (iTest + 1) + } else { + iHi = (iTest - 1) + } + } + } + + return 0 +} + +// Delete a "unicode61" tokenizer. +func fts5UnicodeDelete(tls *libc.TLS, pTok uintptr) { /* sqlite3.c:232201:13: */ + if pTok != 0 { + var p uintptr = pTok + Xsqlite3_free(tls, (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaiException) + Xsqlite3_free(tls, (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold) + Xsqlite3_free(tls, p) + } + return +} + +func unicodeSetCategories(tls *libc.TLS, p uintptr, zCat uintptr) int32 { /* sqlite3.c:232211:12: */ + var z uintptr = zCat + + for *(*int8)(unsafe.Pointer(z)) != 0 { + for (int32(*(*int8)(unsafe.Pointer(z))) == ' ') || (int32(*(*int8)(unsafe.Pointer(z))) == '\t') { + z++ + } + if (*(*int8)(unsafe.Pointer(z)) != 0) && (sqlite3Fts5UnicodeCatParse(tls, z, p+160 /* &.aCategory */) != 0) { + return SQLITE_ERROR + } + for ((int32(*(*int8)(unsafe.Pointer(z))) != ' ') && (int32(*(*int8)(unsafe.Pointer(z))) != '\t')) && (int32(*(*int8)(unsafe.Pointer(z))) != 0) { + z++ + } + } + + sqlite3Fts5UnicodeAscii(tls, p+160 /* &.aCategory */, p /* &.aTokenChar */) + return SQLITE_OK +} + +// Create a "unicode61" tokenizer. +func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, ppOut uintptr) int32 { /* sqlite3.c:232229:12: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr = uintptr(0) // New tokenizer object + + _ = pUnused + + if (nArg % 2) != 0 { + rc = SQLITE_ERROR + } else { + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) + if p != 0 { + var zCat uintptr = ts + 35162 /* "L* N* Co" */ + var i int32 + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Unicode61Tokenizer{}))) + + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = FTS5_REMOVE_DIACRITICS_SIMPLE + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnFold = 64 + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold = Xsqlite3_malloc64(tls, (uint64(uint64((*Unicode61Tokenizer)(unsafe.Pointer(p)).FnFold) * uint64(unsafe.Sizeof(int8(0)))))) + if (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold == uintptr(0) { + rc = SQLITE_NOMEM + } + + // Search for a "categories" argument + for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35171 /* "categories" */) { + zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) + } + } + + if rc == SQLITE_OK { + rc = unicodeSetCategories(tls, p, zCat) + } + + for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { + var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35182 /* "remove_diacritic..." */) { + if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { + rc = SQLITE_ERROR + } else { + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') + + } + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35140 /* "tokenchars" */) { + rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35151 /* "separators" */) { + rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35171 /* "categories" */) { + // no-op + } else { + rc = SQLITE_ERROR + } + } + + } else { + rc = SQLITE_NOMEM + } + if rc != SQLITE_OK { + fts5UnicodeDelete(tls, p) + p = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(ppOut)) = p + } + return rc +} + +// Return true if, for the purposes of tokenizing with the tokenizer +// passed as the first argument, codepoint iCode is considered a token +// character (not a separator). +func fts5UnicodeIsAlnum(tls *libc.TLS, p uintptr, iCode int32) int32 { /* sqlite3.c:232309:12: */ + return (int32(*(*uint8)(unsafe.Pointer((p + 160 /* &.aCategory */) + uintptr(sqlite3Fts5UnicodeCategory(tls, U32(iCode)))))) ^ + fts5UnicodeIsException(tls, p, iCode)) +} + +func fts5UnicodeTokenize(tls *libc.TLS, pTokenizer uintptr, pCtx uintptr, iUnused int32, pText uintptr, nText int32, xToken uintptr) int32 { /* sqlite3.c:232316:12: */ + var p uintptr + var rc int32 + var a uintptr + var zTerm uintptr + var zCsr uintptr + + // Output buffer + var aFold uintptr + var nFold int32 + var pEnd uintptr + var iCode U32 // non-ASCII codepoint read from input + var zOut uintptr + var is int32 + var ie int32 + p = pTokenizer + rc = SQLITE_OK + a = p /* &.aTokenChar */ + zTerm = (pText + uintptr(nText)) + zCsr = pText + aFold = (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold + nFold = (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnFold + pEnd = (aFold + uintptr((nFold - 6))) + + _ = iUnused + + // Each iteration of this loop gobbles up a contiguous run of separators, + // then the next token. +__1: + if !(rc == SQLITE_OK) { + goto __2 + } + zOut = aFold + + // Skip any separator characters. +__3: + if !(1 != 0) { + goto __4 + } + if !(zCsr >= zTerm) { + goto __5 + } + goto tokenize_done +__5: + ; + if !((int32(*(*uint8)(unsafe.Pointer(zCsr))) & 0x80) != 0) { + goto __6 + } + // A character outside of the ascii range. Skip past it if it is + // a separator character. Or break out of the loop if it is not. + is = (int32((int64(zCsr) - int64(pText)) / 1)) + iCode = U32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zCsr, 1)))) + if !(iCode >= U32(0xc0)) { + goto __8 + } + iCode = U32(sqlite3Utf8Trans1[(iCode - U32(0xc0))]) +__9: + if !((zCsr != zTerm) && ((int32(*(*uint8)(unsafe.Pointer(zCsr))) & 0xc0) == 0x80)) { + goto __10 + } + iCode = ((iCode << 6) + (U32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zCsr, 1))))))) + goto __9 +__10: + ; + if !(((iCode < U32(0x80)) || ((iCode & 0xFFFFF800) == U32(0xD800))) || ((iCode & 0xFFFFFFFE) == U32(0xFFFE))) { + goto __11 + } + iCode = U32(0xFFFD) +__11: + ; +__8: + ; + + if !(fts5UnicodeIsAlnum(tls, p, int32(iCode)) != 0) { + goto __12 + } + goto non_ascii_tokenchar +__12: + ; + goto __7 +__6: + if !(*(*uint8)(unsafe.Pointer(a + uintptr(*(*uint8)(unsafe.Pointer(zCsr))))) != 0) { + goto __13 + } + is = (int32((int64(zCsr) - int64(pText)) / 1)) + goto ascii_tokenchar +__13: + ; + zCsr++ +__7: + ; + goto __3 +__4: + ; + + // Run through the tokenchars. Fold them into the output buffer along + // the way. +__14: + if !(zCsr < zTerm) { + goto __15 + } + + // Grow the output buffer so that there is sufficient space to fit the + // largest possible utf-8 character. + if !(zOut > pEnd) { + goto __16 + } + aFold = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nFold) * int64(2)))) + if !(aFold == uintptr(0)) { + goto __17 + } + rc = SQLITE_NOMEM + goto tokenize_done +__17: + ; + zOut = (aFold + uintptr(((int64(zOut) - int64((*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold)) / 1))) + libc.Xmemcpy(tls, aFold, (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold, uint64(nFold)) + Xsqlite3_free(tls, (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold) + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FaFold = aFold + (*Unicode61Tokenizer)(unsafe.Pointer(p)).FnFold = libc.AssignInt32(&nFold, (nFold * 2)) + pEnd = (aFold + uintptr((nFold - 6))) +__16: + ; + + if !((int32(*(*uint8)(unsafe.Pointer(zCsr))) & 0x80) != 0) { + goto __18 + } + // An non-ascii-range character. Fold it into the output buffer if + // it is a token character, or break out of the loop if it is not. + iCode = U32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zCsr, 1)))) + if !(iCode >= U32(0xc0)) { + goto __20 + } + iCode = U32(sqlite3Utf8Trans1[(iCode - U32(0xc0))]) +__21: + if !((zCsr != zTerm) && ((int32(*(*uint8)(unsafe.Pointer(zCsr))) & 0xc0) == 0x80)) { + goto __22 + } + iCode = ((iCode << 6) + (U32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zCsr, 1))))))) + goto __21 +__22: + ; + if !(((iCode < U32(0x80)) || ((iCode & 0xFFFFF800) == U32(0xD800))) || ((iCode & 0xFFFFFFFE) == U32(0xFFFE))) { + goto __23 + } + iCode = U32(0xFFFD) +__23: + ; +__20: + ; + + if !((fts5UnicodeIsAlnum(tls, p, int32(iCode)) != 0) || (sqlite3Fts5UnicodeIsdiacritic(tls, int32(iCode)) != 0)) { + goto __24 + } +non_ascii_tokenchar: + iCode = U32(sqlite3Fts5UnicodeFold(tls, int32(iCode), (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic)) + if !(iCode != 0) { + goto __26 + } + if !(iCode < U32(0x00080)) { + goto __27 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8((U8(iCode & U32(0xFF)))) + goto __28 +__27: + if !(iCode < U32(0x00800)) { + goto __29 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xC0 + int32((U8((iCode >> 6) & U32(0x1F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + goto __30 +__29: + if !(iCode < U32(0x10000)) { + goto __31 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xE0 + int32((U8((iCode >> 12) & U32(0x0F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + goto __32 +__31: + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xF0 + int32((U8((iCode >> 18) & U32(0x07)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 12) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) +__32: + ; +__30: + ; +__28: + ; +__26: + ; + + goto __25 +__24: + goto __15 +__25: + ; + goto __19 +__18: + if !(int32(*(*uint8)(unsafe.Pointer(a + uintptr(*(*uint8)(unsafe.Pointer(zCsr)))))) == 0) { + goto __33 + } + // An ascii-range separator character. End of token. + goto __15 + goto __34 +__33: +ascii_tokenchar: + if !((int32(*(*uint8)(unsafe.Pointer(zCsr))) >= 'A') && (int32(*(*uint8)(unsafe.Pointer(zCsr))) <= 'Z')) { + goto __35 + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(int32(*(*uint8)(unsafe.Pointer(zCsr))) + 32)) + goto __36 +__35: + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8(*(*uint8)(unsafe.Pointer(zCsr))) +__36: + ; + zCsr++ +__34: + ; +__19: + ; + ie = (int32((int64(zCsr) - int64(pText)) / 1)) + goto __14 +__15: + ; + + // Invoke the token callback + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&xToken)))(tls, pCtx, 0, aFold, (int32((int64(zOut) - int64(aFold)) / 1)), is, ie) + goto __1 +__2: + ; + +tokenize_done: + if !(rc == SQLITE_DONE) { + goto __37 + } + rc = SQLITE_OK +__37: + ; + return rc +} + +// ************************************************************************* +// +// Start of porter stemmer implementation. + +// Any tokens larger than this (in bytes) are passed through without +// stemming. + +type PorterTokenizer1 = struct { + Ftokenizer Fts5_tokenizer + FpTokenizer uintptr + FaBuf [128]int8 +} /* sqlite3.c:232428:9 */ + +// ************************************************************************* +// +// Start of porter stemmer implementation. + +// Any tokens larger than this (in bytes) are passed through without +// stemming. + +type PorterTokenizer = PorterTokenizer1 /* sqlite3.c:232428:32 */ + +// Delete a "porter" tokenizer. +func fts5PorterDelete(tls *libc.TLS, pTok uintptr) { /* sqlite3.c:232438:13: */ + if pTok != 0 { + var p uintptr = pTok + if (*PorterTokenizer)(unsafe.Pointer(p)).FpTokenizer != 0 { + (*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p /* &.tokenizer */ + 8 /* &.xDelete */))))(tls, (*PorterTokenizer)(unsafe.Pointer(p)).FpTokenizer) + } + Xsqlite3_free(tls, p) + } +} + +// Create a "porter" tokenizer. +func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, ppOut uintptr) int32 { /* sqlite3.c:232451:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pApi uintptr = pCtx + var rc int32 = SQLITE_OK + var pRet uintptr + *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) + var zBase uintptr = ts + 35200 /* "unicode61" */ + + if nArg > 0 { + zBase = *(*uintptr)(unsafe.Pointer(azArg)) + } + + pRet = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(PorterTokenizer{}))) + if pRet != 0 { + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(PorterTokenizer{}))) + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 16 /* &.xFindTokenizer */))))(tls, pApi, zBase, bp /* &pUserdata */, (pRet /* &.tokenizer */)) + } else { + rc = SQLITE_NOMEM + } + if rc == SQLITE_OK { + var nArg2 int32 = func() int32 { + if nArg > 0 { + return (nArg - 1) + } + return 0 + }() + var azArg2 uintptr = func() uintptr { + if nArg2 != 0 { + return (azArg + 1*8) + } + return uintptr(0) + }() + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pRet /* &.tokenizer */ /* &.xCreate */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)), azArg2, nArg2, (pRet + 24 /* &.pTokenizer */)) + } + + if rc != SQLITE_OK { + fts5PorterDelete(tls, pRet) + pRet = uintptr(0) + } + *(*uintptr)(unsafe.Pointer(ppOut)) = pRet + return rc +} + +type PorterContext1 = struct { + FpCtx uintptr + FxToken uintptr + FaBuf uintptr +} /* sqlite3.c:232487:9 */ + +type PorterContext = PorterContext1 /* sqlite3.c:232487:30 */ + +type PorterRule1 = struct { + FzSuffix uintptr + FnSuffix int32 + _ [4]byte + FxCond uintptr + FzOutput uintptr + FnOutput int32 + _ [4]byte +} /* sqlite3.c:232494:9 */ + +type PorterRule = PorterRule1 /* sqlite3.c:232494:27 */ + +func fts5PorterIsVowel(tls *libc.TLS, c int8, bYIsVowel int32) int32 { /* sqlite3.c:232529:12: */ + return (libc.Bool32((((((int32(c) == 'a') || (int32(c) == 'e')) || (int32(c) == 'i')) || (int32(c) == 'o')) || (int32(c) == 'u')) || ((bYIsVowel != 0) && (int32(c) == 'y')))) +} + +func fts5PorterGobbleVC(tls *libc.TLS, zStem uintptr, nStem int32, bPrevCons int32) int32 { /* sqlite3.c:232535:12: */ + var i int32 + var bCons int32 = bPrevCons + + // Scan for a vowel + for i = 0; i < nStem; i++ { + if 0 == (libc.AssignInt32(&bCons, libc.BoolInt32(!(fts5PorterIsVowel(tls, *(*int8)(unsafe.Pointer(zStem + uintptr(i))), bCons) != 0)))) { + break + } + } + + // Scan for a consonent + for i++; i < nStem; i++ { + if libc.AssignInt32(&bCons, libc.BoolInt32(!(fts5PorterIsVowel(tls, *(*int8)(unsafe.Pointer(zStem + uintptr(i))), bCons) != 0))) != 0 { + return (i + 1) + } + } + return 0 +} + +// porter rule condition: (m > 0) +func fts5Porter_MGt0(tls *libc.TLS, zStem uintptr, nStem int32) int32 { /* sqlite3.c:232552:12: */ + return libc.BoolInt32(!(!(fts5PorterGobbleVC(tls, zStem, nStem, 0) != 0))) +} + +// porter rule condition: (m > 1) +func fts5Porter_MGt1(tls *libc.TLS, zStem uintptr, nStem int32) int32 { /* sqlite3.c:232557:12: */ + var n int32 + n = fts5PorterGobbleVC(tls, zStem, nStem, 0) + if (n != 0) && (fts5PorterGobbleVC(tls, (zStem+uintptr(n)), (nStem-n), 1) != 0) { + return 1 + } + return 0 +} + +// porter rule condition: (m = 1) +func fts5Porter_MEq1(tls *libc.TLS, zStem uintptr, nStem int32) int32 { /* sqlite3.c:232567:12: */ + var n int32 + n = fts5PorterGobbleVC(tls, zStem, nStem, 0) + if (n != 0) && (0 == fts5PorterGobbleVC(tls, (zStem+uintptr(n)), (nStem-n), 1)) { + return 1 + } + return 0 +} + +// porter rule condition: (*o) +func fts5Porter_Ostar(tls *libc.TLS, zStem uintptr, nStem int32) int32 { /* sqlite3.c:232577:12: */ + if ((int32(*(*int8)(unsafe.Pointer(zStem + uintptr((nStem - 1))))) == 'w') || (int32(*(*int8)(unsafe.Pointer(zStem + uintptr((nStem - 1))))) == 'x')) || (int32(*(*int8)(unsafe.Pointer(zStem + uintptr((nStem - 1))))) == 'y') { + return 0 + } else { + var i int32 + var mask int32 = 0 + var bCons int32 = 0 + for i = 0; i < nStem; i++ { + bCons = libc.BoolInt32(!(fts5PorterIsVowel(tls, *(*int8)(unsafe.Pointer(zStem + uintptr(i))), bCons) != 0)) + + mask = ((mask << 1) + bCons) + } + return (libc.Bool32((mask & 0x0007) == 0x0005)) + } + return int32(0) +} + +// porter rule condition: (m > 1 and (*S or *T)) +func fts5Porter_MGt1_and_S_or_T(tls *libc.TLS, zStem uintptr, nStem int32) int32 { /* sqlite3.c:232594:12: */ + + return (libc.Bool32(((int32(*(*int8)(unsafe.Pointer(zStem + uintptr((nStem - 1))))) == 's') || (int32(*(*int8)(unsafe.Pointer(zStem + uintptr((nStem - 1))))) == 't')) && + (fts5Porter_MGt1(tls, zStem, nStem) != 0))) +} + +// porter rule condition: (*v*) +func fts5Porter_Vowel(tls *libc.TLS, zStem uintptr, nStem int32) int32 { /* sqlite3.c:232601:12: */ + var i int32 + for i = 0; i < nStem; i++ { + if fts5PorterIsVowel(tls, *(*int8)(unsafe.Pointer(zStem + uintptr(i))), (libc.Bool32(i > 0))) != 0 { + return 1 + } + } + return 0 +} + +// ************************************************************************* +// +// +// GENERATED CODE STARTS HERE (mkportersteps.tcl) + +func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqlite3.c:232617:12: */ + var ret int32 = 0 + var nBuf int32 = *(*int32)(unsafe.Pointer(pnBuf)) + switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { + + case 'a': + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35210 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) + } + } + break + + case 'c': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35213 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) + } + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35218 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) + } + } + break + + case 'e': + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35223 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) + } + } + break + + case 'i': + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35226 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) + } + } + break + + case 'l': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35229 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) + } + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35234 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) + } + } + break + + case 'n': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35239 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35243 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) + } + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35249 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) + } + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35254 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + case 'o': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35258 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35262 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) + } + } + break + + case 's': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35265 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + case 't': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35269 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35273 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + case 'u': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35277 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + case 'v': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35281 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + case 'z': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35285 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + } + return ret +} + +func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqlite3.c:232751:12: */ + var ret int32 = 0 + var nBuf int32 = *(*int32)(unsafe.Pointer(pnBuf)) + switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { + + case 'a': + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35289 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35269 /* "ate" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) + ret = 1 + } + break + + case 'b': + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35292 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35295 /* "ble" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) + ret = 1 + } + break + + case 'i': + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35299 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35285 /* "ize" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) + ret = 1 + } + break + + } + return ret +} + +func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqlite3.c:232785:12: */ + var ret int32 = 0 + var nBuf int32 = *(*int32)(unsafe.Pointer(pnBuf)) + switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { + + case 'a': + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35302 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35269 /* "ate" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) + } + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35310 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35317 /* "tion" */, uint64(4)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) + } + } + break + + case 'c': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35322 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35218 /* "ence" */, uint64(4)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) + } + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35327 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35213 /* "ance" */, uint64(4)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) + } + } + break + + case 'e': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35332 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35285 /* "ize" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) + } + } + break + + case 'g': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35337 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14779 /* "log" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) + } + } + break + + case 'l': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35342 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35295 /* "ble" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) + } + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35346 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35210 /* "al" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) + } + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35351 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35254 /* "ent" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) + } + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35357 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35361 /* "e" */, uint64(1)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) + } + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35363 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35277 /* "ous" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) + } + } + break + + case 'o': + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35369 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35285 /* "ize" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) + } + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35377 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35269 /* "ate" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) + } + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35383 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35269 /* "ate" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) + } + } + break + + case 's': + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35388 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35210 /* "al" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) + } + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35394 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35281 /* "ive" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) + } + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35402 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35410 /* "ful" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) + } + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35414 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35277 /* "ous" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) + } + } + break + + case 't': + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35422 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35210 /* "al" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) + } + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35428 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35281 /* "ive" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) + } + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35434 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35295 /* "ble" */, uint64(3)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) + } + } + break + + } + return ret +} + +func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqlite3.c:232932:12: */ + var ret int32 = 0 + var nBuf int32 = *(*int32)(unsafe.Pointer(pnBuf)) + switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { + + case 'a': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35441 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35226 /* "ic" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) + } + } + break + + case 's': + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35446 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) + } + } + break + + case 't': + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35451 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35226 /* "ic" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) + } + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35457 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35226 /* "ic" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) + } + } + break + + case 'u': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35410 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + } + } + break + + case 'v': + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35463 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) + } + } + break + + case 'z': + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35469 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35210 /* "al" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) + } + } + break + + } + return ret +} + +func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqlite3.c:232998:12: */ + var ret int32 = 0 + var nBuf int32 = *(*int32)(unsafe.Pointer(pnBuf)) + switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { + + case 'e': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35475 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35479 /* "ee" */, uint64(2)) + *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) + } + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35482 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) + ret = 1 + } + } + break + + case 'n': + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35485 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) + ret = 1 + } + } + break + + } + return ret +} + +// +// GENERATED CODE ENDS HERE (mkportersteps.tcl) +// +// + +func fts5PorterStep1A(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) { /* sqlite3.c:233035:13: */ + var nBuf int32 = *(*int32)(unsafe.Pointer(pnBuf)) + if int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 1))))) == 's' { + if int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) == 'e' { + if (((nBuf > 4) && (int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 4))))) == 's')) && (int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 3))))) == 's')) || + ((nBuf > 3) && (int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 3))))) == 'i')) { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) + } else { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 1) + } + } else if int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) != 's' { + *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 1) + } + } +} + +func fts5PorterCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* sqlite3.c:233053:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr + var aBuf uintptr + // var nBuf int32 at bp, 4 + + var c int8 + p = pCtx + + if !((nToken > FTS5_PORTER_MAX_TOKEN) || (nToken < 3)) { + goto __1 + } + goto pass_through +__1: + ; + aBuf = (*PorterContext)(unsafe.Pointer(p)).FaBuf + *(*int32)(unsafe.Pointer(bp /* nBuf */)) = nToken + libc.Xmemcpy(tls, aBuf, pToken, uint64(*(*int32)(unsafe.Pointer(bp /* nBuf */)))) + + // Step 1. + fts5PorterStep1A(tls, aBuf, bp /* &nBuf */) + if !(fts5PorterStep1B(tls, aBuf, bp /* &nBuf */) != 0) { + goto __2 + } + if !(fts5PorterStep1B2(tls, aBuf, bp /* &nBuf */) == 0) { + goto __3 + } + c = *(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 1)))) + if !(((((fts5PorterIsVowel(tls, c, 0) == 0) && + (int32(c) != 'l')) && (int32(c) != 's')) && (int32(c) != 'z')) && (int32(c) == int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 2))))))) { + goto __4 + } + *(*int32)(unsafe.Pointer(bp /* nBuf */))-- + goto __5 +__4: + if !((fts5Porter_MEq1(tls, aBuf, *(*int32)(unsafe.Pointer(bp /* nBuf */))) != 0) && (fts5Porter_Ostar(tls, aBuf, *(*int32)(unsafe.Pointer(bp /* nBuf */))) != 0)) { + goto __6 + } + *(*int8)(unsafe.Pointer(aBuf + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp /* nBuf */)), 1)))) = int8('e') +__6: + ; +__5: + ; +__3: + ; +__2: + ; + + // Step 1C. + if !((int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 1))))) == 'y') && (fts5Porter_Vowel(tls, aBuf, (*(*int32)(unsafe.Pointer(bp /* nBuf */))-1)) != 0)) { + goto __7 + } + *(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 1)))) = int8('i') +__7: + ; + + // Steps 2 through 4. + fts5PorterStep2(tls, aBuf, bp /* &nBuf */) + fts5PorterStep3(tls, aBuf, bp /* &nBuf */) + fts5PorterStep4(tls, aBuf, bp /* &nBuf */) + + // Step 5a. + + if !(int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 1))))) == 'e') { + goto __8 + } + if !((fts5Porter_MGt1(tls, aBuf, (*(*int32)(unsafe.Pointer(bp /* nBuf */))-1)) != 0) || + ((fts5Porter_MEq1(tls, aBuf, (*(*int32)(unsafe.Pointer(bp /* nBuf */))-1)) != 0) && !(fts5Porter_Ostar(tls, aBuf, (*(*int32)(unsafe.Pointer(bp /* nBuf */))-1)) != 0))) { + goto __9 + } + *(*int32)(unsafe.Pointer(bp /* nBuf */))-- +__9: + ; +__8: + ; + + // Step 5b. + if !((((*(*int32)(unsafe.Pointer(bp /* nBuf */)) > 1) && (int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 1))))) == 'l')) && + (int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((*(*int32)(unsafe.Pointer(bp /* nBuf */)) - 2))))) == 'l')) && (fts5Porter_MGt1(tls, aBuf, (*(*int32)(unsafe.Pointer(bp /* nBuf */))-1)) != 0)) { + goto __10 + } + *(*int32)(unsafe.Pointer(bp /* nBuf */))-- +__10: + ; + + return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer((p + 8 /* &.xToken */))))(tls, (*PorterContext)(unsafe.Pointer(p)).FpCtx, tflags, aBuf, *(*int32)(unsafe.Pointer(bp /* nBuf */)), iStart, iEnd) + +pass_through: + return (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer((p + 8 /* &.xToken */))))(tls, (*PorterContext)(unsafe.Pointer(p)).FpCtx, tflags, pToken, nToken, iStart, iEnd) +} + +// Tokenize using the porter tokenizer. +func fts5PorterTokenize(tls *libc.TLS, pTokenizer uintptr, pCtx uintptr, flags int32, pText uintptr, nText int32, xToken uintptr) int32 { /* sqlite3.c:233122:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var p uintptr = pTokenizer + // var sCtx PorterContext at bp, 24 + + (*PorterContext)(unsafe.Pointer(bp /* &sCtx */)).FxToken = xToken + (*PorterContext)(unsafe.Pointer(bp /* &sCtx */)).FpCtx = pCtx + (*PorterContext)(unsafe.Pointer(bp /* &sCtx */)).FaBuf = p + 32 /* &.aBuf */ + return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.tokenizer */ + 16 /* &.xTokenize */))))(tls, + (*PorterTokenizer)(unsafe.Pointer(p)).FpTokenizer, bp /* &sCtx */, flags, pText, nText, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32 + }{fts5PorterCb}))) +} + +// ************************************************************************* +// +// Start of trigram implementation. +type TrigramTokenizer1 = struct{ FbFold int32 } /* sqlite3.c:233142:9 */ + +// ************************************************************************* +// +// Start of trigram implementation. +type TrigramTokenizer = TrigramTokenizer1 /* sqlite3.c:233142:33 */ + +// Free a trigram tokenizer. +func fts5TriDelete(tls *libc.TLS, p uintptr) { /* sqlite3.c:233150:13: */ + Xsqlite3_free(tls, p) +} + +// Allocate a trigram tokenizer. +func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, ppOut uintptr) int32 { /* sqlite3.c:233157:12: */ + var rc int32 = SQLITE_OK + var pNew uintptr = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(TrigramTokenizer{}))) + _ = pUnused + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 + for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { + var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35489 /* "case_sensitive" */) { + if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { + rc = SQLITE_ERROR + } else { + (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '0')) + } + } else { + rc = SQLITE_ERROR + } + } + if rc != SQLITE_OK { + fts5TriDelete(tls, pNew) + pNew = uintptr(0) + } + } + *(*uintptr)(unsafe.Pointer(ppOut)) = pNew + return rc +} + +// Trigram tokenizer tokenize routine. +func fts5TriTokenize(tls *libc.TLS, pTok uintptr, pCtx uintptr, unusedFlags int32, pText uintptr, nText int32, xToken uintptr) int32 { /* sqlite3.c:233195:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var p uintptr = pTok + var rc int32 = SQLITE_OK + // var aBuf [32]int8 at bp, 32 + + var zIn uintptr = pText + var zEof uintptr = (zIn + uintptr(nText)) + var iCode U32 + + _ = unusedFlags + for 1 != 0 { + var zOut uintptr = bp /* aBuf */ + var iStart int32 = (int32((int64(zIn) - int64(pText)) / 1)) + var zNext uintptr + + iCode = U32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + if iCode >= U32(0xc0) { + iCode = U32(sqlite3Utf8Trans1[(iCode - U32(0xc0))]) + for (zIn != zEof) && ((int32(*(*uint8)(unsafe.Pointer(zIn))) & 0xc0) == 0x80) { + iCode = ((iCode << 6) + (U32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))))) + } + if ((iCode < U32(0x80)) || ((iCode & 0xFFFFF800) == U32(0xD800))) || ((iCode & 0xFFFFFFFE) == U32(0xFFFE)) { + iCode = U32(0xFFFD) + } + } + + if iCode == U32(0) { + break + } + zNext = zIn + if zIn < zEof { + if (*TrigramTokenizer)(unsafe.Pointer(p)).FbFold != 0 { + iCode = U32(sqlite3Fts5UnicodeFold(tls, int32(iCode), 0)) + } + { + if iCode < U32(0x00080) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8((U8(iCode & U32(0xFF)))) + } else if iCode < U32(0x00800) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xC0 + int32((U8((iCode >> 6) & U32(0x1F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } else if iCode < U32(0x10000) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xE0 + int32((U8((iCode >> 12) & U32(0x0F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } else { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xF0 + int32((U8((iCode >> 18) & U32(0x07)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 12) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } + } + + iCode = U32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + if iCode >= U32(0xc0) { + iCode = U32(sqlite3Utf8Trans1[(iCode - U32(0xc0))]) + for (zIn != zEof) && ((int32(*(*uint8)(unsafe.Pointer(zIn))) & 0xc0) == 0x80) { + iCode = ((iCode << 6) + (U32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))))) + } + if ((iCode < U32(0x80)) || ((iCode & 0xFFFFF800) == U32(0xD800))) || ((iCode & 0xFFFFFFFE) == U32(0xFFFE)) { + iCode = U32(0xFFFD) + } + } + + if iCode == U32(0) { + break + } + } else { + break + } + if zIn < zEof { + if (*TrigramTokenizer)(unsafe.Pointer(p)).FbFold != 0 { + iCode = U32(sqlite3Fts5UnicodeFold(tls, int32(iCode), 0)) + } + { + if iCode < U32(0x00080) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8((U8(iCode & U32(0xFF)))) + } else if iCode < U32(0x00800) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xC0 + int32((U8((iCode >> 6) & U32(0x1F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } else if iCode < U32(0x10000) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xE0 + int32((U8((iCode >> 12) & U32(0x0F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } else { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xF0 + int32((U8((iCode >> 18) & U32(0x07)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 12) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } + } + + iCode = U32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1)))) + if iCode >= U32(0xc0) { + iCode = U32(sqlite3Utf8Trans1[(iCode - U32(0xc0))]) + for (zIn != zEof) && ((int32(*(*uint8)(unsafe.Pointer(zIn))) & 0xc0) == 0x80) { + iCode = ((iCode << 6) + (U32(0x3f & int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))))))) + } + if ((iCode < U32(0x80)) || ((iCode & 0xFFFFF800) == U32(0xD800))) || ((iCode & 0xFFFFFFFE) == U32(0xFFFE)) { + iCode = U32(0xFFFD) + } + } + + if iCode == U32(0) { + break + } + if (*TrigramTokenizer)(unsafe.Pointer(p)).FbFold != 0 { + iCode = U32(sqlite3Fts5UnicodeFold(tls, int32(iCode), 0)) + } + { + if iCode < U32(0x00080) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8((U8(iCode & U32(0xFF)))) + } else if iCode < U32(0x00800) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xC0 + int32((U8((iCode >> 6) & U32(0x1F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } else if iCode < U32(0x10000) { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xE0 + int32((U8((iCode >> 12) & U32(0x0F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } else { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0xF0 + int32((U8((iCode >> 18) & U32(0x07)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 12) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8((iCode >> 6) & U32(0x3F)))))) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8(0x80 + int32((U8(iCode & U32(0x3F)))))) + } + } + + } else { + break + } + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&xToken)))(tls, pCtx, 0, bp /* &aBuf[0] */, (int32(int64((zOut - bp /* &aBuf[0] */) / 1))), iStart, (int32(int64(((uintptr(iStart) + zOut) - bp /* &aBuf[0] */) / 1)))) + if rc != SQLITE_OK { + break + } + zIn = zNext + } + + return rc +} + +// Argument xCreate is a pointer to a constructor function for a tokenizer. +// pTok is a tokenizer previously created using the same method. This function +// returns one of FTS5_PATTERN_NONE, FTS5_PATTERN_LIKE or FTS5_PATTERN_GLOB +// indicating the style of pattern matching that the tokenizer can support. +// In practice, this is: +// +// "trigram" tokenizer, case_sensitive=1 - FTS5_PATTERN_GLOB +// "trigram" tokenizer, case_sensitive=0 (the default) - FTS5_PATTERN_LIKE +// all other tokenizers - FTS5_PATTERN_NONE +func sqlite3Fts5TokenizerPattern(tls *libc.TLS, xCreate uintptr, pTok uintptr) int32 { /* sqlite3.c:233255:12: */ + if xCreate == *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 + }{fts5TriCreate})) { + var p uintptr = pTok + if (*TrigramTokenizer)(unsafe.Pointer(p)).FbFold != 0 { + return FTS5_PATTERN_LIKE + } + return FTS5_PATTERN_GLOB + } + return FTS5_PATTERN_NONE +} + +// Register all built-in tokenizers with FTS5. +func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:233269:12: */ + bp := tls.Alloc(128) + defer tls.Free(128) + + *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ + {FzName: ts + 35200 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 + }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 + }{fts5UnicodeTokenize}))}}, + {FzName: ts + 35504 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 + }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 + }{fts5AsciiTokenize}))}}, + {FzName: ts + 35510 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 + }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 + }{fts5PorterTokenize}))}}, + {FzName: ts + 35517 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 + }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 + }{fts5TriTokenize}))}}, + } + + var rc int32 = SQLITE_OK // Return code + var i int32 // To iterate through builtin functions + + for i = 0; (rc == SQLITE_OK) && (i < (int32(uint64(unsafe.Sizeof([4]BuiltinTokenizer{})) / uint64(unsafe.Sizeof(BuiltinTokenizer{}))))); i++ { + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 8 /* &.xCreateTokenizer */))))(tls, pApi, + (*BuiltinTokenizer)(unsafe.Pointer(bp /* &aBuiltin */ +uintptr(i)*32)).FzName, + pApi, + (bp /* &aBuiltin */ + uintptr(i)*32 + 8 /* &.x */), + uintptr(0)) + } + + return rc +} + +type BuiltinTokenizer = struct { + FzName uintptr + Fx Fts5_tokenizer +} /* sqlite3.c:233270:3 */ + +// 2012-05-25 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// + +// DO NOT EDIT THIS MACHINE GENERATED FILE. + +// #include + +// If the argument is a codepoint corresponding to a lowercase letter +// in the ASCII range with a diacritic added, return the codepoint +// of the ASCII letter only. For example, if passed 235 - "LATIN +// SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER +// E"). The resuls of passing a codepoint that corresponds to an +// uppercase letter are undefined. +func fts5_remove_diacritic(tls *libc.TLS, c int32, bComplex int32) int32 { /* sqlite3.c:233325:12: */ + bp := tls.Alloc(378) + defer tls.Free(378) + + *(*[126]uint16)(unsafe.Pointer(bp /* aDia */)) = [126]uint16{ + uint16(0), uint16(1797), uint16(1848), uint16(1859), uint16(1891), uint16(1928), uint16(1940), uint16(1995), + uint16(2024), uint16(2040), uint16(2060), uint16(2110), uint16(2168), uint16(2206), uint16(2264), uint16(2286), + uint16(2344), uint16(2383), uint16(2472), uint16(2488), uint16(2516), uint16(2596), uint16(2668), uint16(2732), + uint16(2782), uint16(2842), uint16(2894), uint16(2954), uint16(2984), uint16(3000), uint16(3028), uint16(3336), + uint16(3456), uint16(3696), uint16(3712), uint16(3728), uint16(3744), uint16(3766), uint16(3832), uint16(3896), + uint16(3912), uint16(3928), uint16(3944), uint16(3968), uint16(4008), uint16(4040), uint16(4056), uint16(4106), + uint16(4138), uint16(4170), uint16(4202), uint16(4234), uint16(4266), uint16(4296), uint16(4312), uint16(4344), + uint16(4408), uint16(4424), uint16(4442), uint16(4472), uint16(4488), uint16(4504), uint16(6148), uint16(6198), + uint16(6264), uint16(6280), uint16(6360), uint16(6429), uint16(6505), uint16(6529), uint16(61448), uint16(61468), + uint16(61512), uint16(61534), uint16(61592), uint16(61610), uint16(61642), uint16(61672), uint16(61688), uint16(61704), + uint16(61726), uint16(61784), uint16(61800), uint16(61816), uint16(61836), uint16(61880), uint16(61896), uint16(61914), + uint16(61948), uint16(61998), uint16(62062), uint16(62122), uint16(62154), uint16(62184), uint16(62200), uint16(62218), + uint16(62252), uint16(62302), uint16(62364), uint16(62410), uint16(62442), uint16(62478), uint16(62536), uint16(62554), + uint16(62584), uint16(62604), uint16(62640), uint16(62648), uint16(62656), uint16(62664), uint16(62730), uint16(62766), + uint16(62830), uint16(62890), uint16(62924), uint16(62974), uint16(63032), uint16(63050), uint16(63082), uint16(63118), + uint16(63182), uint16(63242), uint16(63274), uint16(63310), uint16(63368), uint16(63390), + } + *(*[126]uint8)(unsafe.Pointer(bp + 252 /* aChar */)) = [126]uint8{ + uint8(0), uint8('a'), uint8('c'), uint8('e'), uint8('i'), uint8('n'), + uint8('o'), uint8('u'), uint8('y'), uint8('y'), uint8('a'), uint8('c'), + uint8('d'), uint8('e'), uint8('e'), uint8('g'), uint8('h'), uint8('i'), + uint8('j'), uint8('k'), uint8('l'), uint8('n'), uint8('o'), uint8('r'), + uint8('s'), uint8('t'), uint8('u'), uint8('u'), uint8('w'), uint8('y'), + uint8('z'), uint8('o'), uint8('u'), uint8('a'), uint8('i'), uint8('o'), + uint8('u'), (uint8('u' | (int32(uint8(0x80))))), (uint8('a' | (int32(uint8(0x80))))), uint8('g'), uint8('k'), uint8('o'), + (uint8('o' | (int32(uint8(0x80))))), uint8('j'), uint8('g'), uint8('n'), (uint8('a' | (int32(uint8(0x80))))), uint8('a'), + uint8('e'), uint8('i'), uint8('o'), uint8('r'), uint8('u'), uint8('s'), + uint8('t'), uint8('h'), uint8('a'), uint8('e'), (uint8('o' | (int32(uint8(0x80))))), uint8('o'), + (uint8('o' | (int32(uint8(0x80))))), uint8('y'), uint8(0), uint8(0), uint8(0), uint8(0), + uint8(0), uint8(0), uint8(0), uint8(0), uint8('a'), uint8('b'), + (uint8('c' | (int32(uint8(0x80))))), uint8('d'), uint8('d'), (uint8('e' | (int32(uint8(0x80))))), uint8('e'), (uint8('e' | (int32(uint8(0x80))))), + uint8('f'), uint8('g'), uint8('h'), uint8('h'), uint8('i'), (uint8('i' | (int32(uint8(0x80))))), + uint8('k'), uint8('l'), (uint8('l' | (int32(uint8(0x80))))), uint8('l'), uint8('m'), uint8('n'), + (uint8('o' | (int32(uint8(0x80))))), uint8('p'), uint8('r'), (uint8('r' | (int32(uint8(0x80))))), uint8('r'), uint8('s'), + (uint8('s' | (int32(uint8(0x80))))), uint8('t'), uint8('u'), (uint8('u' | (int32(uint8(0x80))))), uint8('v'), uint8('w'), + uint8('w'), uint8('x'), uint8('y'), uint8('z'), uint8('h'), uint8('t'), + uint8('w'), uint8('y'), uint8('a'), (uint8('a' | (int32(uint8(0x80))))), (uint8('a' | (int32(uint8(0x80))))), (uint8('a' | (int32(uint8(0x80))))), + uint8('e'), (uint8('e' | (int32(uint8(0x80))))), (uint8('e' | (int32(uint8(0x80))))), uint8('i'), uint8('o'), (uint8('o' | (int32(uint8(0x80))))), + (uint8('o' | (int32(uint8(0x80))))), (uint8('o' | (int32(uint8(0x80))))), uint8('u'), (uint8('u' | (int32(uint8(0x80))))), (uint8('u' | (int32(uint8(0x80))))), uint8('y'), + } + + var key uint32 = (((uint32(c)) << 3) | uint32(0x00000007)) + var iRes int32 = 0 + var iHi int32 = (int32((uint64(unsafe.Sizeof([126]uint16{})) / uint64(unsafe.Sizeof(uint16(0)))) - uint64(1))) + var iLo int32 = 0 + for iHi >= iLo { + var iTest int32 = ((iHi + iLo) / 2) + if key >= uint32(*(*uint16)(unsafe.Pointer(bp /* &aDia[0] */ + uintptr(iTest)*2))) { + iRes = iTest + iLo = (iTest + 1) + } else { + iHi = (iTest - 1) + } + } + + if (bComplex == 0) && ((int32(*(*uint8)(unsafe.Pointer(bp + 252 /* &aChar[0] */ + uintptr(iRes)))) & 0x80) != 0) { + return c + } + if c > ((int32(*(*uint16)(unsafe.Pointer(bp /* &aDia[0] */ + uintptr(iRes)*2))) >> 3) + (int32(*(*uint16)(unsafe.Pointer(bp /* &aDia[0] */ + uintptr(iRes)*2))) & 0x07)) { + return c + } + return (int32(*(*uint8)(unsafe.Pointer(bp + 252 /* &aChar[0] */ + uintptr(iRes)))) & 0x7F) +} + +// Return true if the argument interpreted as a unicode codepoint +// is a diacritical modifier character. +func sqlite3Fts5UnicodeIsdiacritic(tls *libc.TLS, c int32) int32 { /* sqlite3.c:233392:12: */ + var mask0 uint32 = uint32(0x08029FDF) + var mask1 uint32 = uint32(0x000361F8) + if (c < 768) || (c > 817) { + return 0 + } + if c < (768 + 32) { + return (int32(mask0 & (uint32(uint32(1)) << (c - 768)))) + } + return (int32(mask1 & (uint32(uint32(1)) << ((c - 768) - 32)))) +} + +// Interpret the argument as a unicode codepoint. If the codepoint +// is an upper case character that has a lower case equivalent, +// return the codepoint corresponding to the lower case version. +// Otherwise, return a copy of the argument. +// +// The results are undefined if the value passed to this function +// is less than zero. +func sqlite3Fts5UnicodeFold(tls *libc.TLS, c int32, eRemoveDiacritic int32) int32 { /* sqlite3.c:233411:12: */ + + var ret int32 = c + + if c < 128 { + if (c >= 'A') && (c <= 'Z') { + ret = (c + ('a' - 'A')) + } + } else if c < 65536 { + var p uintptr + var iHi int32 = (int32((uint64(unsafe.Sizeof(aEntry)) / uint64(unsafe.Sizeof(TableEntry{}))) - uint64(1))) + var iLo int32 = 0 + var iRes int32 = -1 + + for iHi >= iLo { + var iTest int32 = ((iHi + iLo) / 2) + var cmp int32 = (c - int32(aEntry[iTest].FiCode)) + if cmp >= 0 { + iRes = iTest + iLo = (iTest + 1) + } else { + iHi = (iTest - 1) + } + } + + p = (uintptr(unsafe.Pointer(&aEntry)) + uintptr(iRes)*4) + if (c < (int32((*TableEntry)(unsafe.Pointer(p)).FiCode) + int32((*TableEntry)(unsafe.Pointer(p)).FnRange))) && (0 == ((0x01 & int32((*TableEntry)(unsafe.Pointer(p)).Fflags)) & (int32((*TableEntry)(unsafe.Pointer(p)).FiCode) ^ c))) { + ret = ((c + (int32(aiOff[(int32((*TableEntry)(unsafe.Pointer(p)).Fflags) >> 1)]))) & 0x0000FFFF) + + } + + if eRemoveDiacritic != 0 { + ret = fts5_remove_diacritic(tls, ret, (libc.Bool32(eRemoveDiacritic == 2))) + } + } else if (c >= 66560) && (c < 66600) { + ret = (c + 40) + } + + return ret +} + +// Each entry in the following array defines a rule for folding a range +// of codepoints to lower case. The rule applies to a range of nRange +// codepoints starting at codepoint iCode. +// +// If the least significant bit in flags is clear, then the rule applies +// to all nRange codepoints (i.e. all nRange codepoints are upper case and +// need to be folded). Or, if it is set, then the rule only applies to +// every second codepoint in the range, starting with codepoint C. +// +// The 7 most significant bits in flags are an index into the aiOff[] +// array. If a specific codepoint C does require folding, then its lower +// case equivalent is ((C + aiOff[flags>>1]) & 0xFFFF). +// +// The contents of this array are generated by parsing the CaseFolding.txt +// file distributed as part of the "Unicode Character Database". See +// http://www.unicode.org for details. +type TableEntry = struct { + FiCode uint16 + Fflags uint8 + FnRange uint8 +} /* sqlite3.c:233429:16 */ + +var aEntry = [163]TableEntry{ + {FiCode: uint16(65), Fflags: uint8(14), FnRange: uint8(26)}, {FiCode: uint16(181), Fflags: uint8(64), FnRange: uint8(1)}, {FiCode: uint16(192), Fflags: uint8(14), FnRange: uint8(23)}, + {FiCode: uint16(216), Fflags: uint8(14), FnRange: uint8(7)}, {FiCode: uint16(256), Fflags: uint8(1), FnRange: uint8(48)}, {FiCode: uint16(306), Fflags: uint8(1), FnRange: uint8(6)}, + {FiCode: uint16(313), Fflags: uint8(1), FnRange: uint8(16)}, {FiCode: uint16(330), Fflags: uint8(1), FnRange: uint8(46)}, {FiCode: uint16(376), Fflags: uint8(116), FnRange: uint8(1)}, + {FiCode: uint16(377), Fflags: uint8(1), FnRange: uint8(6)}, {FiCode: uint16(383), Fflags: uint8(104), FnRange: uint8(1)}, {FiCode: uint16(385), Fflags: uint8(50), FnRange: uint8(1)}, + {FiCode: uint16(386), Fflags: uint8(1), FnRange: uint8(4)}, {FiCode: uint16(390), Fflags: uint8(44), FnRange: uint8(1)}, {FiCode: uint16(391), FnRange: uint8(1)}, + {FiCode: uint16(393), Fflags: uint8(42), FnRange: uint8(2)}, {FiCode: uint16(395), FnRange: uint8(1)}, {FiCode: uint16(398), Fflags: uint8(32), FnRange: uint8(1)}, + {FiCode: uint16(399), Fflags: uint8(38), FnRange: uint8(1)}, {FiCode: uint16(400), Fflags: uint8(40), FnRange: uint8(1)}, {FiCode: uint16(401), FnRange: uint8(1)}, + {FiCode: uint16(403), Fflags: uint8(42), FnRange: uint8(1)}, {FiCode: uint16(404), Fflags: uint8(46), FnRange: uint8(1)}, {FiCode: uint16(406), Fflags: uint8(52), FnRange: uint8(1)}, + {FiCode: uint16(407), Fflags: uint8(48), FnRange: uint8(1)}, {FiCode: uint16(408), FnRange: uint8(1)}, {FiCode: uint16(412), Fflags: uint8(52), FnRange: uint8(1)}, + {FiCode: uint16(413), Fflags: uint8(54), FnRange: uint8(1)}, {FiCode: uint16(415), Fflags: uint8(56), FnRange: uint8(1)}, {FiCode: uint16(416), Fflags: uint8(1), FnRange: uint8(6)}, + {FiCode: uint16(422), Fflags: uint8(60), FnRange: uint8(1)}, {FiCode: uint16(423), FnRange: uint8(1)}, {FiCode: uint16(425), Fflags: uint8(60), FnRange: uint8(1)}, + {FiCode: uint16(428), FnRange: uint8(1)}, {FiCode: uint16(430), Fflags: uint8(60), FnRange: uint8(1)}, {FiCode: uint16(431), FnRange: uint8(1)}, + {FiCode: uint16(433), Fflags: uint8(58), FnRange: uint8(2)}, {FiCode: uint16(435), Fflags: uint8(1), FnRange: uint8(4)}, {FiCode: uint16(439), Fflags: uint8(62), FnRange: uint8(1)}, + {FiCode: uint16(440), FnRange: uint8(1)}, {FiCode: uint16(444), FnRange: uint8(1)}, {FiCode: uint16(452), Fflags: uint8(2), FnRange: uint8(1)}, + {FiCode: uint16(453), FnRange: uint8(1)}, {FiCode: uint16(455), Fflags: uint8(2), FnRange: uint8(1)}, {FiCode: uint16(456), FnRange: uint8(1)}, + {FiCode: uint16(458), Fflags: uint8(2), FnRange: uint8(1)}, {FiCode: uint16(459), Fflags: uint8(1), FnRange: uint8(18)}, {FiCode: uint16(478), Fflags: uint8(1), FnRange: uint8(18)}, + {FiCode: uint16(497), Fflags: uint8(2), FnRange: uint8(1)}, {FiCode: uint16(498), Fflags: uint8(1), FnRange: uint8(4)}, {FiCode: uint16(502), Fflags: uint8(122), FnRange: uint8(1)}, + {FiCode: uint16(503), Fflags: uint8(134), FnRange: uint8(1)}, {FiCode: uint16(504), Fflags: uint8(1), FnRange: uint8(40)}, {FiCode: uint16(544), Fflags: uint8(110), FnRange: uint8(1)}, + {FiCode: uint16(546), Fflags: uint8(1), FnRange: uint8(18)}, {FiCode: uint16(570), Fflags: uint8(70), FnRange: uint8(1)}, {FiCode: uint16(571), FnRange: uint8(1)}, + {FiCode: uint16(573), Fflags: uint8(108), FnRange: uint8(1)}, {FiCode: uint16(574), Fflags: uint8(68), FnRange: uint8(1)}, {FiCode: uint16(577), FnRange: uint8(1)}, + {FiCode: uint16(579), Fflags: uint8(106), FnRange: uint8(1)}, {FiCode: uint16(580), Fflags: uint8(28), FnRange: uint8(1)}, {FiCode: uint16(581), Fflags: uint8(30), FnRange: uint8(1)}, + {FiCode: uint16(582), Fflags: uint8(1), FnRange: uint8(10)}, {FiCode: uint16(837), Fflags: uint8(36), FnRange: uint8(1)}, {FiCode: uint16(880), Fflags: uint8(1), FnRange: uint8(4)}, + {FiCode: uint16(886), FnRange: uint8(1)}, {FiCode: uint16(902), Fflags: uint8(18), FnRange: uint8(1)}, {FiCode: uint16(904), Fflags: uint8(16), FnRange: uint8(3)}, + {FiCode: uint16(908), Fflags: uint8(26), FnRange: uint8(1)}, {FiCode: uint16(910), Fflags: uint8(24), FnRange: uint8(2)}, {FiCode: uint16(913), Fflags: uint8(14), FnRange: uint8(17)}, + {FiCode: uint16(931), Fflags: uint8(14), FnRange: uint8(9)}, {FiCode: uint16(962), FnRange: uint8(1)}, {FiCode: uint16(975), Fflags: uint8(4), FnRange: uint8(1)}, + {FiCode: uint16(976), Fflags: uint8(140), FnRange: uint8(1)}, {FiCode: uint16(977), Fflags: uint8(142), FnRange: uint8(1)}, {FiCode: uint16(981), Fflags: uint8(146), FnRange: uint8(1)}, + {FiCode: uint16(982), Fflags: uint8(144), FnRange: uint8(1)}, {FiCode: uint16(984), Fflags: uint8(1), FnRange: uint8(24)}, {FiCode: uint16(1008), Fflags: uint8(136), FnRange: uint8(1)}, + {FiCode: uint16(1009), Fflags: uint8(138), FnRange: uint8(1)}, {FiCode: uint16(1012), Fflags: uint8(130), FnRange: uint8(1)}, {FiCode: uint16(1013), Fflags: uint8(128), FnRange: uint8(1)}, + {FiCode: uint16(1015), FnRange: uint8(1)}, {FiCode: uint16(1017), Fflags: uint8(152), FnRange: uint8(1)}, {FiCode: uint16(1018), FnRange: uint8(1)}, + {FiCode: uint16(1021), Fflags: uint8(110), FnRange: uint8(3)}, {FiCode: uint16(1024), Fflags: uint8(34), FnRange: uint8(16)}, {FiCode: uint16(1040), Fflags: uint8(14), FnRange: uint8(32)}, + {FiCode: uint16(1120), Fflags: uint8(1), FnRange: uint8(34)}, {FiCode: uint16(1162), Fflags: uint8(1), FnRange: uint8(54)}, {FiCode: uint16(1216), Fflags: uint8(6), FnRange: uint8(1)}, + {FiCode: uint16(1217), Fflags: uint8(1), FnRange: uint8(14)}, {FiCode: uint16(1232), Fflags: uint8(1), FnRange: uint8(88)}, {FiCode: uint16(1329), Fflags: uint8(22), FnRange: uint8(38)}, + {FiCode: uint16(4256), Fflags: uint8(66), FnRange: uint8(38)}, {FiCode: uint16(4295), Fflags: uint8(66), FnRange: uint8(1)}, {FiCode: uint16(4301), Fflags: uint8(66), FnRange: uint8(1)}, + {FiCode: uint16(7680), Fflags: uint8(1), FnRange: uint8(150)}, {FiCode: uint16(7835), Fflags: uint8(132), FnRange: uint8(1)}, {FiCode: uint16(7838), Fflags: uint8(96), FnRange: uint8(1)}, + {FiCode: uint16(7840), Fflags: uint8(1), FnRange: uint8(96)}, {FiCode: uint16(7944), Fflags: uint8(150), FnRange: uint8(8)}, {FiCode: uint16(7960), Fflags: uint8(150), FnRange: uint8(6)}, + {FiCode: uint16(7976), Fflags: uint8(150), FnRange: uint8(8)}, {FiCode: uint16(7992), Fflags: uint8(150), FnRange: uint8(8)}, {FiCode: uint16(8008), Fflags: uint8(150), FnRange: uint8(6)}, + {FiCode: uint16(8025), Fflags: uint8(151), FnRange: uint8(8)}, {FiCode: uint16(8040), Fflags: uint8(150), FnRange: uint8(8)}, {FiCode: uint16(8072), Fflags: uint8(150), FnRange: uint8(8)}, + {FiCode: uint16(8088), Fflags: uint8(150), FnRange: uint8(8)}, {FiCode: uint16(8104), Fflags: uint8(150), FnRange: uint8(8)}, {FiCode: uint16(8120), Fflags: uint8(150), FnRange: uint8(2)}, + {FiCode: uint16(8122), Fflags: uint8(126), FnRange: uint8(2)}, {FiCode: uint16(8124), Fflags: uint8(148), FnRange: uint8(1)}, {FiCode: uint16(8126), Fflags: uint8(100), FnRange: uint8(1)}, + {FiCode: uint16(8136), Fflags: uint8(124), FnRange: uint8(4)}, {FiCode: uint16(8140), Fflags: uint8(148), FnRange: uint8(1)}, {FiCode: uint16(8152), Fflags: uint8(150), FnRange: uint8(2)}, + {FiCode: uint16(8154), Fflags: uint8(120), FnRange: uint8(2)}, {FiCode: uint16(8168), Fflags: uint8(150), FnRange: uint8(2)}, {FiCode: uint16(8170), Fflags: uint8(118), FnRange: uint8(2)}, + {FiCode: uint16(8172), Fflags: uint8(152), FnRange: uint8(1)}, {FiCode: uint16(8184), Fflags: uint8(112), FnRange: uint8(2)}, {FiCode: uint16(8186), Fflags: uint8(114), FnRange: uint8(2)}, + {FiCode: uint16(8188), Fflags: uint8(148), FnRange: uint8(1)}, {FiCode: uint16(8486), Fflags: uint8(98), FnRange: uint8(1)}, {FiCode: uint16(8490), Fflags: uint8(92), FnRange: uint8(1)}, + {FiCode: uint16(8491), Fflags: uint8(94), FnRange: uint8(1)}, {FiCode: uint16(8498), Fflags: uint8(12), FnRange: uint8(1)}, {FiCode: uint16(8544), Fflags: uint8(8), FnRange: uint8(16)}, + {FiCode: uint16(8579), FnRange: uint8(1)}, {FiCode: uint16(9398), Fflags: uint8(10), FnRange: uint8(26)}, {FiCode: uint16(11264), Fflags: uint8(22), FnRange: uint8(47)}, + {FiCode: uint16(11360), FnRange: uint8(1)}, {FiCode: uint16(11362), Fflags: uint8(88), FnRange: uint8(1)}, {FiCode: uint16(11363), Fflags: uint8(102), FnRange: uint8(1)}, + {FiCode: uint16(11364), Fflags: uint8(90), FnRange: uint8(1)}, {FiCode: uint16(11367), Fflags: uint8(1), FnRange: uint8(6)}, {FiCode: uint16(11373), Fflags: uint8(84), FnRange: uint8(1)}, + {FiCode: uint16(11374), Fflags: uint8(86), FnRange: uint8(1)}, {FiCode: uint16(11375), Fflags: uint8(80), FnRange: uint8(1)}, {FiCode: uint16(11376), Fflags: uint8(82), FnRange: uint8(1)}, + {FiCode: uint16(11378), FnRange: uint8(1)}, {FiCode: uint16(11381), FnRange: uint8(1)}, {FiCode: uint16(11390), Fflags: uint8(78), FnRange: uint8(2)}, + {FiCode: uint16(11392), Fflags: uint8(1), FnRange: uint8(100)}, {FiCode: uint16(11499), Fflags: uint8(1), FnRange: uint8(4)}, {FiCode: uint16(11506), FnRange: uint8(1)}, + {FiCode: uint16(42560), Fflags: uint8(1), FnRange: uint8(46)}, {FiCode: uint16(42624), Fflags: uint8(1), FnRange: uint8(24)}, {FiCode: uint16(42786), Fflags: uint8(1), FnRange: uint8(14)}, + {FiCode: uint16(42802), Fflags: uint8(1), FnRange: uint8(62)}, {FiCode: uint16(42873), Fflags: uint8(1), FnRange: uint8(4)}, {FiCode: uint16(42877), Fflags: uint8(76), FnRange: uint8(1)}, + {FiCode: uint16(42878), Fflags: uint8(1), FnRange: uint8(10)}, {FiCode: uint16(42891), FnRange: uint8(1)}, {FiCode: uint16(42893), Fflags: uint8(74), FnRange: uint8(1)}, + {FiCode: uint16(42896), Fflags: uint8(1), FnRange: uint8(4)}, {FiCode: uint16(42912), Fflags: uint8(1), FnRange: uint8(10)}, {FiCode: uint16(42922), Fflags: uint8(72), FnRange: uint8(1)}, + {FiCode: uint16(65313), Fflags: uint8(14), FnRange: uint8(26)}, +} /* sqlite3.c:233433:5 */ +var aiOff = [77]uint16{ + uint16(1), uint16(2), uint16(8), uint16(15), uint16(16), uint16(26), uint16(28), uint16(32), + uint16(37), uint16(38), uint16(40), uint16(48), uint16(63), uint16(64), uint16(69), uint16(71), + uint16(79), uint16(80), uint16(116), uint16(202), uint16(203), uint16(205), uint16(206), uint16(207), + uint16(209), uint16(210), uint16(211), uint16(213), uint16(214), uint16(217), uint16(218), uint16(219), + uint16(775), uint16(7264), uint16(10792), uint16(10795), uint16(23228), uint16(23256), uint16(30204), uint16(54721), + uint16(54753), uint16(54754), uint16(54756), uint16(54787), uint16(54793), uint16(54809), uint16(57153), uint16(57274), + uint16(57921), uint16(58019), uint16(58363), uint16(61722), uint16(65268), uint16(65341), uint16(65373), uint16(65406), + uint16(65408), uint16(65410), uint16(65415), uint16(65424), uint16(65436), uint16(65439), uint16(65450), uint16(65462), + uint16(65472), uint16(65476), uint16(65478), uint16(65480), uint16(65482), uint16(65488), uint16(65506), uint16(65511), + uint16(65514), uint16(65521), uint16(65527), uint16(65528), uint16(65529), +} /* sqlite3.c:233490:31 */ + +func sqlite3Fts5UnicodeCatParse(tls *libc.TLS, zCat uintptr, aArray uintptr) int32 { /* sqlite3.c:233547:12: */ + *(*U8)(unsafe.Pointer(aArray)) = U8(1) + switch int32(*(*int8)(unsafe.Pointer(zCat))) { + case 'C': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'c': + *(*U8)(unsafe.Pointer(aArray + 1)) = U8(1) + break + case 'f': + *(*U8)(unsafe.Pointer(aArray + 2)) = U8(1) + break + case 'n': + *(*U8)(unsafe.Pointer(aArray + 3)) = U8(1) + break + case 's': + *(*U8)(unsafe.Pointer(aArray + 4)) = U8(1) + break + case 'o': + *(*U8)(unsafe.Pointer(aArray + 31)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 1)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 2)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 3)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 4)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 31)) = U8(1) + break + default: + return 1 + } + break + + case 'L': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'l': + *(*U8)(unsafe.Pointer(aArray + 5)) = U8(1) + break + case 'm': + *(*U8)(unsafe.Pointer(aArray + 6)) = U8(1) + break + case 'o': + *(*U8)(unsafe.Pointer(aArray + 7)) = U8(1) + break + case 't': + *(*U8)(unsafe.Pointer(aArray + 8)) = U8(1) + break + case 'u': + *(*U8)(unsafe.Pointer(aArray + 9)) = U8(1) + break + case 'C': + *(*U8)(unsafe.Pointer(aArray + 30)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 5)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 6)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 7)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 8)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 9)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 30)) = U8(1) + break + default: + return 1 + } + break + + case 'M': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'c': + *(*U8)(unsafe.Pointer(aArray + 10)) = U8(1) + break + case 'e': + *(*U8)(unsafe.Pointer(aArray + 11)) = U8(1) + break + case 'n': + *(*U8)(unsafe.Pointer(aArray + 12)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 10)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 11)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 12)) = U8(1) + break + default: + return 1 + } + break + + case 'N': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'd': + *(*U8)(unsafe.Pointer(aArray + 13)) = U8(1) + break + case 'l': + *(*U8)(unsafe.Pointer(aArray + 14)) = U8(1) + break + case 'o': + *(*U8)(unsafe.Pointer(aArray + 15)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 13)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 14)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 15)) = U8(1) + break + default: + return 1 + } + break + + case 'P': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'c': + *(*U8)(unsafe.Pointer(aArray + 16)) = U8(1) + break + case 'd': + *(*U8)(unsafe.Pointer(aArray + 17)) = U8(1) + break + case 'e': + *(*U8)(unsafe.Pointer(aArray + 18)) = U8(1) + break + case 'f': + *(*U8)(unsafe.Pointer(aArray + 19)) = U8(1) + break + case 'i': + *(*U8)(unsafe.Pointer(aArray + 20)) = U8(1) + break + case 'o': + *(*U8)(unsafe.Pointer(aArray + 21)) = U8(1) + break + case 's': + *(*U8)(unsafe.Pointer(aArray + 22)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 16)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 17)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 18)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 19)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 20)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 21)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 22)) = U8(1) + break + default: + return 1 + } + break + + case 'S': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'c': + *(*U8)(unsafe.Pointer(aArray + 23)) = U8(1) + break + case 'k': + *(*U8)(unsafe.Pointer(aArray + 24)) = U8(1) + break + case 'm': + *(*U8)(unsafe.Pointer(aArray + 25)) = U8(1) + break + case 'o': + *(*U8)(unsafe.Pointer(aArray + 26)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 23)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 24)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 25)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 26)) = U8(1) + break + default: + return 1 + } + break + + case 'Z': + switch int32(*(*int8)(unsafe.Pointer(zCat + 1))) { + case 'l': + *(*U8)(unsafe.Pointer(aArray + 27)) = U8(1) + break + case 'p': + *(*U8)(unsafe.Pointer(aArray + 28)) = U8(1) + break + case 's': + *(*U8)(unsafe.Pointer(aArray + 29)) = U8(1) + break + case '*': + *(*U8)(unsafe.Pointer(aArray + 27)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 28)) = U8(1) + *(*U8)(unsafe.Pointer(aArray + 29)) = U8(1) + break + default: + return 1 + } + break + + } + return 0 +} + +var aFts5UnicodeBlock = [17]U16{ + U16(0), U16(1471), U16(1753), U16(1760), U16(1760), U16(1760), U16(1760), U16(1760), U16(1760), U16(1760), + U16(1760), U16(1760), U16(1760), U16(1760), U16(1760), U16(1763), U16(1765), +} /* sqlite3.c:233665:12 */ +var aFts5UnicodeMap = [1765]U16{ + U16(0), U16(32), U16(33), U16(36), U16(37), U16(40), U16(41), U16(42), U16(43), U16(44), + U16(45), U16(46), U16(48), U16(58), U16(60), U16(63), U16(65), U16(91), U16(92), U16(93), + U16(94), U16(95), U16(96), U16(97), U16(123), U16(124), U16(125), U16(126), U16(127), U16(160), + U16(161), U16(162), U16(166), U16(167), U16(168), U16(169), U16(170), U16(171), U16(172), U16(173), + U16(174), U16(175), U16(176), U16(177), U16(178), U16(180), U16(181), U16(182), U16(184), U16(185), + U16(186), U16(187), U16(188), U16(191), U16(192), U16(215), U16(216), U16(223), U16(247), U16(248), + U16(256), U16(312), U16(313), U16(329), U16(330), U16(377), U16(383), U16(385), U16(387), U16(388), + U16(391), U16(394), U16(396), U16(398), U16(402), U16(403), U16(405), U16(406), U16(409), U16(412), + U16(414), U16(415), U16(417), U16(418), U16(423), U16(427), U16(428), U16(431), U16(434), U16(436), + U16(437), U16(440), U16(442), U16(443), U16(444), U16(446), U16(448), U16(452), U16(453), U16(454), + U16(455), U16(456), U16(457), U16(458), U16(459), U16(460), U16(461), U16(477), U16(478), U16(496), + U16(497), U16(498), U16(499), U16(500), U16(503), U16(505), U16(506), U16(564), U16(570), U16(572), + U16(573), U16(575), U16(577), U16(580), U16(583), U16(584), U16(592), U16(660), U16(661), U16(688), + U16(706), U16(710), U16(722), U16(736), U16(741), U16(748), U16(749), U16(750), U16(751), U16(768), + U16(880), U16(884), U16(885), U16(886), U16(890), U16(891), U16(894), U16(900), U16(902), U16(903), + U16(904), U16(908), U16(910), U16(912), U16(913), U16(931), U16(940), U16(975), U16(977), U16(978), + U16(981), U16(984), U16(1008), U16(1012), U16(1014), U16(1015), U16(1018), U16(1020), U16(1021), U16(1072), + U16(1120), U16(1154), U16(1155), U16(1160), U16(1162), U16(1217), U16(1231), U16(1232), U16(1329), U16(1369), + U16(1370), U16(1377), U16(1417), U16(1418), U16(1423), U16(1425), U16(1470), U16(1471), U16(1472), U16(1473), + U16(1475), U16(1476), U16(1478), U16(1479), U16(1488), U16(1520), U16(1523), U16(1536), U16(1542), U16(1545), + U16(1547), U16(1548), U16(1550), U16(1552), U16(1563), U16(1566), U16(1568), U16(1600), U16(1601), U16(1611), + U16(1632), U16(1642), U16(1646), U16(1648), U16(1649), U16(1748), U16(1749), U16(1750), U16(1757), U16(1758), + U16(1759), U16(1765), U16(1767), U16(1769), U16(1770), U16(1774), U16(1776), U16(1786), U16(1789), U16(1791), + U16(1792), U16(1807), U16(1808), U16(1809), U16(1810), U16(1840), U16(1869), U16(1958), U16(1969), U16(1984), + U16(1994), U16(2027), U16(2036), U16(2038), U16(2039), U16(2042), U16(2048), U16(2070), U16(2074), U16(2075), + U16(2084), U16(2085), U16(2088), U16(2089), U16(2096), U16(2112), U16(2137), U16(2142), U16(2208), U16(2210), + U16(2276), U16(2304), U16(2307), U16(2308), U16(2362), U16(2363), U16(2364), U16(2365), U16(2366), U16(2369), + U16(2377), U16(2381), U16(2382), U16(2384), U16(2385), U16(2392), U16(2402), U16(2404), U16(2406), U16(2416), + U16(2417), U16(2418), U16(2425), U16(2433), U16(2434), U16(2437), U16(2447), U16(2451), U16(2474), U16(2482), + U16(2486), U16(2492), U16(2493), U16(2494), U16(2497), U16(2503), U16(2507), U16(2509), U16(2510), U16(2519), + U16(2524), U16(2527), U16(2530), U16(2534), U16(2544), U16(2546), U16(2548), U16(2554), U16(2555), U16(2561), + U16(2563), U16(2565), U16(2575), U16(2579), U16(2602), U16(2610), U16(2613), U16(2616), U16(2620), U16(2622), + U16(2625), U16(2631), U16(2635), U16(2641), U16(2649), U16(2654), U16(2662), U16(2672), U16(2674), U16(2677), + U16(2689), U16(2691), U16(2693), U16(2703), U16(2707), U16(2730), U16(2738), U16(2741), U16(2748), U16(2749), + U16(2750), U16(2753), U16(2759), U16(2761), U16(2763), U16(2765), U16(2768), U16(2784), U16(2786), U16(2790), + U16(2800), U16(2801), U16(2817), U16(2818), U16(2821), U16(2831), U16(2835), U16(2858), U16(2866), U16(2869), + U16(2876), U16(2877), U16(2878), U16(2879), U16(2880), U16(2881), U16(2887), U16(2891), U16(2893), U16(2902), + U16(2903), U16(2908), U16(2911), U16(2914), U16(2918), U16(2928), U16(2929), U16(2930), U16(2946), U16(2947), + U16(2949), U16(2958), U16(2962), U16(2969), U16(2972), U16(2974), U16(2979), U16(2984), U16(2990), U16(3006), + U16(3008), U16(3009), U16(3014), U16(3018), U16(3021), U16(3024), U16(3031), U16(3046), U16(3056), U16(3059), + U16(3065), U16(3066), U16(3073), U16(3077), U16(3086), U16(3090), U16(3114), U16(3125), U16(3133), U16(3134), + U16(3137), U16(3142), U16(3146), U16(3157), U16(3160), U16(3168), U16(3170), U16(3174), U16(3192), U16(3199), + U16(3202), U16(3205), U16(3214), U16(3218), U16(3242), U16(3253), U16(3260), U16(3261), U16(3262), U16(3263), + U16(3264), U16(3270), U16(3271), U16(3274), U16(3276), U16(3285), U16(3294), U16(3296), U16(3298), U16(3302), + U16(3313), U16(3330), U16(3333), U16(3342), U16(3346), U16(3389), U16(3390), U16(3393), U16(3398), U16(3402), + U16(3405), U16(3406), U16(3415), U16(3424), U16(3426), U16(3430), U16(3440), U16(3449), U16(3450), U16(3458), + U16(3461), U16(3482), U16(3507), U16(3517), U16(3520), U16(3530), U16(3535), U16(3538), U16(3542), U16(3544), + U16(3570), U16(3572), U16(3585), U16(3633), U16(3634), U16(3636), U16(3647), U16(3648), U16(3654), U16(3655), + U16(3663), U16(3664), U16(3674), U16(3713), U16(3716), U16(3719), U16(3722), U16(3725), U16(3732), U16(3737), + U16(3745), U16(3749), U16(3751), U16(3754), U16(3757), U16(3761), U16(3762), U16(3764), U16(3771), U16(3773), + U16(3776), U16(3782), U16(3784), U16(3792), U16(3804), U16(3840), U16(3841), U16(3844), U16(3859), U16(3860), + U16(3861), U16(3864), U16(3866), U16(3872), U16(3882), U16(3892), U16(3893), U16(3894), U16(3895), U16(3896), + U16(3897), U16(3898), U16(3899), U16(3900), U16(3901), U16(3902), U16(3904), U16(3913), U16(3953), U16(3967), + U16(3968), U16(3973), U16(3974), U16(3976), U16(3981), U16(3993), U16(4030), U16(4038), U16(4039), U16(4046), + U16(4048), U16(4053), U16(4057), U16(4096), U16(4139), U16(4141), U16(4145), U16(4146), U16(4152), U16(4153), + U16(4155), U16(4157), U16(4159), U16(4160), U16(4170), U16(4176), U16(4182), U16(4184), U16(4186), U16(4190), + U16(4193), U16(4194), U16(4197), U16(4199), U16(4206), U16(4209), U16(4213), U16(4226), U16(4227), U16(4229), + U16(4231), U16(4237), U16(4238), U16(4239), U16(4240), U16(4250), U16(4253), U16(4254), U16(4256), U16(4295), + U16(4301), U16(4304), U16(4347), U16(4348), U16(4349), U16(4682), U16(4688), U16(4696), U16(4698), U16(4704), + U16(4746), U16(4752), U16(4786), U16(4792), U16(4800), U16(4802), U16(4808), U16(4824), U16(4882), U16(4888), + U16(4957), U16(4960), U16(4969), U16(4992), U16(5008), U16(5024), U16(5120), U16(5121), U16(5741), U16(5743), + U16(5760), U16(5761), U16(5787), U16(5788), U16(5792), U16(5867), U16(5870), U16(5888), U16(5902), U16(5906), + U16(5920), U16(5938), U16(5941), U16(5952), U16(5970), U16(5984), U16(5998), U16(6002), U16(6016), U16(6068), + U16(6070), U16(6071), U16(6078), U16(6086), U16(6087), U16(6089), U16(6100), U16(6103), U16(6104), U16(6107), + U16(6108), U16(6109), U16(6112), U16(6128), U16(6144), U16(6150), U16(6151), U16(6155), U16(6158), U16(6160), + U16(6176), U16(6211), U16(6212), U16(6272), U16(6313), U16(6314), U16(6320), U16(6400), U16(6432), U16(6435), + U16(6439), U16(6441), U16(6448), U16(6450), U16(6451), U16(6457), U16(6464), U16(6468), U16(6470), U16(6480), + U16(6512), U16(6528), U16(6576), U16(6593), U16(6600), U16(6608), U16(6618), U16(6622), U16(6656), U16(6679), + U16(6681), U16(6686), U16(6688), U16(6741), U16(6742), U16(6743), U16(6744), U16(6752), U16(6753), U16(6754), + U16(6755), U16(6757), U16(6765), U16(6771), U16(6783), U16(6784), U16(6800), U16(6816), U16(6823), U16(6824), + U16(6912), U16(6916), U16(6917), U16(6964), U16(6965), U16(6966), U16(6971), U16(6972), U16(6973), U16(6978), + U16(6979), U16(6981), U16(6992), U16(7002), U16(7009), U16(7019), U16(7028), U16(7040), U16(7042), U16(7043), + U16(7073), U16(7074), U16(7078), U16(7080), U16(7082), U16(7083), U16(7084), U16(7086), U16(7088), U16(7098), + U16(7142), U16(7143), U16(7144), U16(7146), U16(7149), U16(7150), U16(7151), U16(7154), U16(7164), U16(7168), + U16(7204), U16(7212), U16(7220), U16(7222), U16(7227), U16(7232), U16(7245), U16(7248), U16(7258), U16(7288), + U16(7294), U16(7360), U16(7376), U16(7379), U16(7380), U16(7393), U16(7394), U16(7401), U16(7405), U16(7406), + U16(7410), U16(7412), U16(7413), U16(7424), U16(7468), U16(7531), U16(7544), U16(7545), U16(7579), U16(7616), + U16(7676), U16(7680), U16(7830), U16(7838), U16(7936), U16(7944), U16(7952), U16(7960), U16(7968), U16(7976), + U16(7984), U16(7992), U16(8000), U16(8008), U16(8016), U16(8025), U16(8027), U16(8029), U16(8031), U16(8033), + U16(8040), U16(8048), U16(8064), U16(8072), U16(8080), U16(8088), U16(8096), U16(8104), U16(8112), U16(8118), + U16(8120), U16(8124), U16(8125), U16(8126), U16(8127), U16(8130), U16(8134), U16(8136), U16(8140), U16(8141), + U16(8144), U16(8150), U16(8152), U16(8157), U16(8160), U16(8168), U16(8173), U16(8178), U16(8182), U16(8184), + U16(8188), U16(8189), U16(8192), U16(8203), U16(8208), U16(8214), U16(8216), U16(8217), U16(8218), U16(8219), + U16(8221), U16(8222), U16(8223), U16(8224), U16(8232), U16(8233), U16(8234), U16(8239), U16(8240), U16(8249), + U16(8250), U16(8251), U16(8255), U16(8257), U16(8260), U16(8261), U16(8262), U16(8263), U16(8274), U16(8275), + U16(8276), U16(8277), U16(8287), U16(8288), U16(8298), U16(8304), U16(8305), U16(8308), U16(8314), U16(8317), + U16(8318), U16(8319), U16(8320), U16(8330), U16(8333), U16(8334), U16(8336), U16(8352), U16(8400), U16(8413), + U16(8417), U16(8418), U16(8421), U16(8448), U16(8450), U16(8451), U16(8455), U16(8456), U16(8458), U16(8459), + U16(8462), U16(8464), U16(8467), U16(8468), U16(8469), U16(8470), U16(8472), U16(8473), U16(8478), U16(8484), + U16(8485), U16(8486), U16(8487), U16(8488), U16(8489), U16(8490), U16(8494), U16(8495), U16(8496), U16(8500), + U16(8501), U16(8505), U16(8506), U16(8508), U16(8510), U16(8512), U16(8517), U16(8519), U16(8522), U16(8523), + U16(8524), U16(8526), U16(8527), U16(8528), U16(8544), U16(8579), U16(8581), U16(8585), U16(8592), U16(8597), + U16(8602), U16(8604), U16(8608), U16(8609), U16(8611), U16(8612), U16(8614), U16(8615), U16(8622), U16(8623), + U16(8654), U16(8656), U16(8658), U16(8659), U16(8660), U16(8661), U16(8692), U16(8960), U16(8968), U16(8972), + U16(8992), U16(8994), U16(9001), U16(9002), U16(9003), U16(9084), U16(9085), U16(9115), U16(9140), U16(9180), + U16(9186), U16(9216), U16(9280), U16(9312), U16(9372), U16(9450), U16(9472), U16(9655), U16(9656), U16(9665), + U16(9666), U16(9720), U16(9728), U16(9839), U16(9840), U16(9985), U16(10088), U16(10089), U16(10090), U16(10091), + U16(10092), U16(10093), U16(10094), U16(10095), U16(10096), U16(10097), U16(10098), U16(10099), U16(10100), U16(10101), + U16(10102), U16(10132), U16(10176), U16(10181), U16(10182), U16(10183), U16(10214), U16(10215), U16(10216), U16(10217), + U16(10218), U16(10219), U16(10220), U16(10221), U16(10222), U16(10223), U16(10224), U16(10240), U16(10496), U16(10627), + U16(10628), U16(10629), U16(10630), U16(10631), U16(10632), U16(10633), U16(10634), U16(10635), U16(10636), U16(10637), + U16(10638), U16(10639), U16(10640), U16(10641), U16(10642), U16(10643), U16(10644), U16(10645), U16(10646), U16(10647), + U16(10648), U16(10649), U16(10712), U16(10713), U16(10714), U16(10715), U16(10716), U16(10748), U16(10749), U16(10750), + U16(11008), U16(11056), U16(11077), U16(11079), U16(11088), U16(11264), U16(11312), U16(11360), U16(11363), U16(11365), + U16(11367), U16(11374), U16(11377), U16(11378), U16(11380), U16(11381), U16(11383), U16(11388), U16(11390), U16(11393), + U16(11394), U16(11492), U16(11493), U16(11499), U16(11503), U16(11506), U16(11513), U16(11517), U16(11518), U16(11520), + U16(11559), U16(11565), U16(11568), U16(11631), U16(11632), U16(11647), U16(11648), U16(11680), U16(11688), U16(11696), + U16(11704), U16(11712), U16(11720), U16(11728), U16(11736), U16(11744), U16(11776), U16(11778), U16(11779), U16(11780), + U16(11781), U16(11782), U16(11785), U16(11786), U16(11787), U16(11788), U16(11789), U16(11790), U16(11799), U16(11800), + U16(11802), U16(11803), U16(11804), U16(11805), U16(11806), U16(11808), U16(11809), U16(11810), U16(11811), U16(11812), + U16(11813), U16(11814), U16(11815), U16(11816), U16(11817), U16(11818), U16(11823), U16(11824), U16(11834), U16(11904), + U16(11931), U16(12032), U16(12272), U16(12288), U16(12289), U16(12292), U16(12293), U16(12294), U16(12295), U16(12296), + U16(12297), U16(12298), U16(12299), U16(12300), U16(12301), U16(12302), U16(12303), U16(12304), U16(12305), U16(12306), + U16(12308), U16(12309), U16(12310), U16(12311), U16(12312), U16(12313), U16(12314), U16(12315), U16(12316), U16(12317), + U16(12318), U16(12320), U16(12321), U16(12330), U16(12334), U16(12336), U16(12337), U16(12342), U16(12344), U16(12347), + U16(12348), U16(12349), U16(12350), U16(12353), U16(12441), U16(12443), U16(12445), U16(12447), U16(12448), U16(12449), + U16(12539), U16(12540), U16(12543), U16(12549), U16(12593), U16(12688), U16(12690), U16(12694), U16(12704), U16(12736), + U16(12784), U16(12800), U16(12832), U16(12842), U16(12872), U16(12880), U16(12881), U16(12896), U16(12928), U16(12938), + U16(12977), U16(12992), U16(13056), U16(13312), U16(19893), U16(19904), U16(19968), U16(40908), U16(40960), U16(40981), + U16(40982), U16(42128), U16(42192), U16(42232), U16(42238), U16(42240), U16(42508), U16(42509), U16(42512), U16(42528), + U16(42538), U16(42560), U16(42606), U16(42607), U16(42608), U16(42611), U16(42612), U16(42622), U16(42623), U16(42624), + U16(42655), U16(42656), U16(42726), U16(42736), U16(42738), U16(42752), U16(42775), U16(42784), U16(42786), U16(42800), + U16(42802), U16(42864), U16(42865), U16(42873), U16(42878), U16(42888), U16(42889), U16(42891), U16(42896), U16(42912), + U16(43000), U16(43002), U16(43003), U16(43010), U16(43011), U16(43014), U16(43015), U16(43019), U16(43020), U16(43043), + U16(43045), U16(43047), U16(43048), U16(43056), U16(43062), U16(43064), U16(43065), U16(43072), U16(43124), U16(43136), + U16(43138), U16(43188), U16(43204), U16(43214), U16(43216), U16(43232), U16(43250), U16(43256), U16(43259), U16(43264), + U16(43274), U16(43302), U16(43310), U16(43312), U16(43335), U16(43346), U16(43359), U16(43360), U16(43392), U16(43395), + U16(43396), U16(43443), U16(43444), U16(43446), U16(43450), U16(43452), U16(43453), U16(43457), U16(43471), U16(43472), + U16(43486), U16(43520), U16(43561), U16(43567), U16(43569), U16(43571), U16(43573), U16(43584), U16(43587), U16(43588), + U16(43596), U16(43597), U16(43600), U16(43612), U16(43616), U16(43632), U16(43633), U16(43639), U16(43642), U16(43643), + U16(43648), U16(43696), U16(43697), U16(43698), U16(43701), U16(43703), U16(43705), U16(43710), U16(43712), U16(43713), + U16(43714), U16(43739), U16(43741), U16(43742), U16(43744), U16(43755), U16(43756), U16(43758), U16(43760), U16(43762), + U16(43763), U16(43765), U16(43766), U16(43777), U16(43785), U16(43793), U16(43808), U16(43816), U16(43968), U16(44003), + U16(44005), U16(44006), U16(44008), U16(44009), U16(44011), U16(44012), U16(44013), U16(44016), U16(44032), U16(55203), + U16(55216), U16(55243), U16(55296), U16(56191), U16(56319), U16(57343), U16(57344), U16(63743), U16(63744), U16(64112), + U16(64256), U16(64275), U16(64285), U16(64286), U16(64287), U16(64297), U16(64298), U16(64312), U16(64318), U16(64320), + U16(64323), U16(64326), U16(64434), U16(64467), U16(64830), U16(64831), U16(64848), U16(64914), U16(65008), U16(65020), + U16(65021), U16(65024), U16(65040), U16(65047), U16(65048), U16(65049), U16(65056), U16(65072), U16(65073), U16(65075), + U16(65077), U16(65078), U16(65079), U16(65080), U16(65081), U16(65082), U16(65083), U16(65084), U16(65085), U16(65086), + U16(65087), U16(65088), U16(65089), U16(65090), U16(65091), U16(65092), U16(65093), U16(65095), U16(65096), U16(65097), + U16(65101), U16(65104), U16(65108), U16(65112), U16(65113), U16(65114), U16(65115), U16(65116), U16(65117), U16(65118), + U16(65119), U16(65122), U16(65123), U16(65124), U16(65128), U16(65129), U16(65130), U16(65136), U16(65142), U16(65279), + U16(65281), U16(65284), U16(65285), U16(65288), U16(65289), U16(65290), U16(65291), U16(65292), U16(65293), U16(65294), + U16(65296), U16(65306), U16(65308), U16(65311), U16(65313), U16(65339), U16(65340), U16(65341), U16(65342), U16(65343), + U16(65344), U16(65345), U16(65371), U16(65372), U16(65373), U16(65374), U16(65375), U16(65376), U16(65377), U16(65378), + U16(65379), U16(65380), U16(65382), U16(65392), U16(65393), U16(65438), U16(65440), U16(65474), U16(65482), U16(65490), + U16(65498), U16(65504), U16(65506), U16(65507), U16(65508), U16(65509), U16(65512), U16(65513), U16(65517), U16(65529), + U16(65532), U16(0), U16(13), U16(40), U16(60), U16(63), U16(80), U16(128), U16(256), U16(263), + U16(311), U16(320), U16(373), U16(377), U16(394), U16(400), U16(464), U16(509), U16(640), U16(672), + U16(768), U16(800), U16(816), U16(833), U16(834), U16(842), U16(896), U16(927), U16(928), U16(968), + U16(976), U16(977), U16(1024), U16(1064), U16(1104), U16(1184), U16(2048), U16(2056), U16(2058), U16(2103), + U16(2108), U16(2111), U16(2135), U16(2136), U16(2304), U16(2326), U16(2335), U16(2336), U16(2367), U16(2432), + U16(2494), U16(2560), U16(2561), U16(2565), U16(2572), U16(2576), U16(2581), U16(2585), U16(2616), U16(2623), + U16(2624), U16(2640), U16(2656), U16(2685), U16(2687), U16(2816), U16(2873), U16(2880), U16(2904), U16(2912), + U16(2936), U16(3072), U16(3680), U16(4096), U16(4097), U16(4098), U16(4099), U16(4152), U16(4167), U16(4178), + U16(4198), U16(4224), U16(4226), U16(4227), U16(4272), U16(4275), U16(4279), U16(4281), U16(4283), U16(4285), + U16(4286), U16(4304), U16(4336), U16(4352), U16(4355), U16(4391), U16(4396), U16(4397), U16(4406), U16(4416), + U16(4480), U16(4482), U16(4483), U16(4531), U16(4534), U16(4543), U16(4545), U16(4549), U16(4560), U16(5760), + U16(5803), U16(5804), U16(5805), U16(5806), U16(5808), U16(5814), U16(5815), U16(5824), U16(8192), U16(9216), + U16(9328), U16(12288), U16(26624), U16(28416), U16(28496), U16(28497), U16(28559), U16(28563), U16(45056), U16(53248), + U16(53504), U16(53545), U16(53605), U16(53607), U16(53610), U16(53613), U16(53619), U16(53627), U16(53635), U16(53637), + U16(53644), U16(53674), U16(53678), U16(53760), U16(53826), U16(53829), U16(54016), U16(54112), U16(54272), U16(54298), + U16(54324), U16(54350), U16(54358), U16(54376), U16(54402), U16(54428), U16(54430), U16(54434), U16(54437), U16(54441), + U16(54446), U16(54454), U16(54459), U16(54461), U16(54469), U16(54480), U16(54506), U16(54532), U16(54535), U16(54541), + U16(54550), U16(54558), U16(54584), U16(54587), U16(54592), U16(54598), U16(54602), U16(54610), U16(54636), U16(54662), + U16(54688), U16(54714), U16(54740), U16(54766), U16(54792), U16(54818), U16(54844), U16(54870), U16(54896), U16(54922), + U16(54952), U16(54977), U16(54978), U16(55003), U16(55004), U16(55010), U16(55035), U16(55036), U16(55061), U16(55062), + U16(55068), U16(55093), U16(55094), U16(55119), U16(55120), U16(55126), U16(55151), U16(55152), U16(55177), U16(55178), + U16(55184), U16(55209), U16(55210), U16(55235), U16(55236), U16(55242), U16(55246), U16(60928), U16(60933), U16(60961), + U16(60964), U16(60967), U16(60969), U16(60980), U16(60985), U16(60987), U16(60994), U16(60999), U16(61001), U16(61003), + U16(61005), U16(61009), U16(61012), U16(61015), U16(61017), U16(61019), U16(61021), U16(61023), U16(61025), U16(61028), + U16(61031), U16(61036), U16(61044), U16(61049), U16(61054), U16(61056), U16(61067), U16(61089), U16(61093), U16(61099), + U16(61168), U16(61440), U16(61488), U16(61600), U16(61617), U16(61633), U16(61649), U16(61696), U16(61712), U16(61744), + U16(61808), U16(61926), U16(61968), U16(62016), U16(62032), U16(62208), U16(62256), U16(62263), U16(62336), U16(62368), + U16(62406), U16(62432), U16(62464), U16(62528), U16(62530), U16(62713), U16(62720), U16(62784), U16(62800), U16(62971), + U16(63045), U16(63104), U16(63232), U16(0), U16(42710), U16(42752), U16(46900), U16(46912), U16(47133), U16(63488), + U16(1), U16(32), U16(256), U16(0), U16(65533), +} /* sqlite3.c:233669:12 */ +var aFts5UnicodeData = [1765]U16{ + U16(1025), U16(61), U16(117), U16(55), U16(117), U16(54), U16(50), U16(53), U16(57), U16(53), + U16(49), U16(85), U16(333), U16(85), U16(121), U16(85), U16(841), U16(54), U16(53), U16(50), + U16(56), U16(48), U16(56), U16(837), U16(54), U16(57), U16(50), U16(57), U16(1057), U16(61), + U16(53), U16(151), U16(58), U16(53), U16(56), U16(58), U16(39), U16(52), U16(57), U16(34), + U16(58), U16(56), U16(58), U16(57), U16(79), U16(56), U16(37), U16(85), U16(56), U16(47), + U16(39), U16(51), U16(111), U16(53), U16(745), U16(57), U16(233), U16(773), U16(57), U16(261), + U16(1822), U16(37), U16(542), U16(37), U16(1534), U16(222), U16(69), U16(73), U16(37), U16(126), + U16(126), U16(73), U16(69), U16(137), U16(37), U16(73), U16(37), U16(105), U16(101), U16(73), + U16(37), U16(73), U16(37), U16(190), U16(158), U16(37), U16(126), U16(126), U16(73), U16(37), + U16(126), U16(94), U16(37), U16(39), U16(94), U16(69), U16(135), U16(41), U16(40), U16(37), + U16(41), U16(40), U16(37), U16(41), U16(40), U16(37), U16(542), U16(37), U16(606), U16(37), + U16(41), U16(40), U16(37), U16(126), U16(73), U16(37), U16(1886), U16(197), U16(73), U16(37), + U16(73), U16(69), U16(126), U16(105), U16(37), U16(286), U16(2181), U16(39), U16(869), U16(582), + U16(152), U16(390), U16(472), U16(166), U16(248), U16(38), U16(56), U16(38), U16(568), U16(3596), + U16(158), U16(38), U16(56), U16(94), U16(38), U16(101), U16(53), U16(88), U16(41), U16(53), + U16(105), U16(41), U16(73), U16(37), U16(553), U16(297), U16(1125), U16(94), U16(37), U16(105), + U16(101), U16(798), U16(133), U16(94), U16(57), U16(126), U16(94), U16(37), U16(1641), U16(1541), + U16(1118), U16(58), U16(172), U16(75), U16(1790), U16(478), U16(37), U16(2846), U16(1225), U16(38), + U16(213), U16(1253), U16(53), U16(49), U16(55), U16(1452), U16(49), U16(44), U16(53), U16(76), + U16(53), U16(76), U16(53), U16(44), U16(871), U16(103), U16(85), U16(162), U16(121), U16(85), + U16(55), U16(85), U16(90), U16(364), U16(53), U16(85), U16(1031), U16(38), U16(327), U16(684), + U16(333), U16(149), U16(71), U16(44), U16(3175), U16(53), U16(39), U16(236), U16(34), U16(58), + U16(204), U16(70), U16(76), U16(58), U16(140), U16(71), U16(333), U16(103), U16(90), U16(39), + U16(469), U16(34), U16(39), U16(44), U16(967), U16(876), U16(2855), U16(364), U16(39), U16(333), + U16(1063), U16(300), U16(70), U16(58), U16(117), U16(38), U16(711), U16(140), U16(38), U16(300), + U16(38), U16(108), U16(38), U16(172), U16(501), U16(807), U16(108), U16(53), U16(39), U16(359), + U16(876), U16(108), U16(42), U16(1735), U16(44), U16(42), U16(44), U16(39), U16(106), U16(268), + U16(138), U16(44), U16(74), U16(39), U16(236), U16(327), U16(76), U16(85), U16(333), U16(53), + U16(38), U16(199), U16(231), U16(44), U16(74), U16(263), U16(71), U16(711), U16(231), U16(39), + U16(135), U16(44), U16(39), U16(106), U16(140), U16(74), U16(74), U16(44), U16(39), U16(42), + U16(71), U16(103), U16(76), U16(333), U16(71), U16(87), U16(207), U16(58), U16(55), U16(76), + U16(42), U16(199), U16(71), U16(711), U16(231), U16(71), U16(71), U16(71), U16(44), U16(106), + U16(76), U16(76), U16(108), U16(44), U16(135), U16(39), U16(333), U16(76), U16(103), U16(44), + U16(76), U16(42), U16(295), U16(103), U16(711), U16(231), U16(71), U16(167), U16(44), U16(39), + U16(106), U16(172), U16(76), U16(42), U16(74), U16(44), U16(39), U16(71), U16(76), U16(333), + U16(53), U16(55), U16(44), U16(74), U16(263), U16(71), U16(711), U16(231), U16(71), U16(167), + U16(44), U16(39), U16(42), U16(44), U16(42), U16(140), U16(74), U16(74), U16(44), U16(44), + U16(42), U16(71), U16(103), U16(76), U16(333), U16(58), U16(39), U16(207), U16(44), U16(39), + U16(199), U16(103), U16(135), U16(71), U16(39), U16(71), U16(71), U16(103), U16(391), U16(74), + U16(44), U16(74), U16(106), U16(106), U16(44), U16(39), U16(42), U16(333), U16(111), U16(218), + U16(55), U16(58), U16(106), U16(263), U16(103), U16(743), U16(327), U16(167), U16(39), U16(108), + U16(138), U16(108), U16(140), U16(76), U16(71), U16(71), U16(76), U16(333), U16(239), U16(58), + U16(74), U16(263), U16(103), U16(743), U16(327), U16(167), U16(44), U16(39), U16(42), U16(44), + U16(170), U16(44), U16(74), U16(74), U16(76), U16(74), U16(39), U16(71), U16(76), U16(333), + U16(71), U16(74), U16(263), U16(103), U16(1319), U16(39), U16(106), U16(140), U16(106), U16(106), + U16(44), U16(39), U16(42), U16(71), U16(76), U16(333), U16(207), U16(58), U16(199), U16(74), + U16(583), U16(775), U16(295), U16(39), U16(231), U16(44), U16(106), U16(108), U16(44), U16(266), + U16(74), U16(53), U16(1543), U16(44), U16(71), U16(236), U16(55), U16(199), U16(38), U16(268), + U16(53), U16(333), U16(85), U16(71), U16(39), U16(71), U16(39), U16(39), U16(135), U16(231), + U16(103), U16(39), U16(39), U16(71), U16(135), U16(44), U16(71), U16(204), U16(76), U16(39), + U16(167), U16(38), U16(204), U16(333), U16(135), U16(39), U16(122), U16(501), U16(58), U16(53), + U16(122), U16(76), U16(218), U16(333), U16(335), U16(58), U16(44), U16(58), U16(44), U16(58), + U16(44), U16(54), U16(50), U16(54), U16(50), U16(74), U16(263), U16(1159), U16(460), U16(42), + U16(172), U16(53), U16(76), U16(167), U16(364), U16(1164), U16(282), U16(44), U16(218), U16(90), + U16(181), U16(154), U16(85), U16(1383), U16(74), U16(140), U16(42), U16(204), U16(42), U16(76), + U16(74), U16(76), U16(39), U16(333), U16(213), U16(199), U16(74), U16(76), U16(135), U16(108), + U16(39), U16(106), U16(71), U16(234), U16(103), U16(140), U16(423), U16(44), U16(74), U16(76), + U16(202), U16(44), U16(39), U16(42), U16(333), U16(106), U16(44), U16(90), U16(1225), U16(41), + U16(41), U16(1383), U16(53), U16(38), U16(10631), U16(135), U16(231), U16(39), U16(135), U16(1319), + U16(135), U16(1063), U16(135), U16(231), U16(39), U16(135), U16(487), U16(1831), U16(135), U16(2151), + U16(108), U16(309), U16(655), U16(519), U16(346), U16(2727), U16(49), U16(19847), U16(85), U16(551), + U16(61), U16(839), U16(54), U16(50), U16(2407), U16(117), U16(110), U16(423), U16(135), U16(108), + U16(583), U16(108), U16(85), U16(583), U16(76), U16(423), U16(103), U16(76), U16(1671), U16(76), + U16(42), U16(236), U16(266), U16(44), U16(74), U16(364), U16(117), U16(38), U16(117), U16(55), + U16(39), U16(44), U16(333), U16(335), U16(213), U16(49), U16(149), U16(108), U16(61), U16(333), + U16(1127), U16(38), U16(1671), U16(1319), U16(44), U16(39), U16(2247), U16(935), U16(108), U16(138), + U16(76), U16(106), U16(74), U16(44), U16(202), U16(108), U16(58), U16(85), U16(333), U16(967), + U16(167), U16(1415), U16(554), U16(231), U16(74), U16(333), U16(47), U16(1114), U16(743), U16(76), + U16(106), U16(85), U16(1703), U16(42), U16(44), U16(42), U16(236), U16(44), U16(42), U16(44), + U16(74), U16(268), U16(202), U16(332), U16(44), U16(333), U16(333), U16(245), U16(38), U16(213), + U16(140), U16(42), U16(1511), U16(44), U16(42), U16(172), U16(42), U16(44), U16(170), U16(44), + U16(74), U16(231), U16(333), U16(245), U16(346), U16(300), U16(314), U16(76), U16(42), U16(967), + U16(42), U16(140), U16(74), U16(76), U16(42), U16(44), U16(74), U16(71), U16(333), U16(1415), + U16(44), U16(42), U16(76), U16(106), U16(44), U16(42), U16(108), U16(74), U16(149), U16(1159), + U16(266), U16(268), U16(74), U16(76), U16(181), U16(333), U16(103), U16(333), U16(967), U16(198), + U16(85), U16(277), U16(108), U16(53), U16(428), U16(42), U16(236), U16(135), U16(44), U16(135), + U16(74), U16(44), U16(71), U16(1413), U16(2022), U16(421), U16(38), U16(1093), U16(1190), U16(1260), + U16(140), U16(4830), U16(261), U16(3166), U16(261), U16(265), U16(197), U16(201), U16(261), U16(265), + U16(261), U16(265), U16(197), U16(201), U16(261), U16(41), U16(41), U16(41), U16(94), U16(229), + U16(265), U16(453), U16(261), U16(264), U16(261), U16(264), U16(261), U16(264), U16(165), U16(69), + U16(137), U16(40), U16(56), U16(37), U16(120), U16(101), U16(69), U16(137), U16(40), U16(120), + U16(133), U16(69), U16(137), U16(120), U16(261), U16(169), U16(120), U16(101), U16(69), U16(137), + U16(40), U16(88), U16(381), U16(162), U16(209), U16(85), U16(52), U16(51), U16(54), U16(84), + U16(51), U16(54), U16(52), U16(277), U16(59), U16(60), U16(162), U16(61), U16(309), U16(52), + U16(51), U16(149), U16(80), U16(117), U16(57), U16(54), U16(50), U16(373), U16(57), U16(53), + U16(48), U16(341), U16(61), U16(162), U16(194), U16(47), U16(38), U16(207), U16(121), U16(54), + U16(50), U16(38), U16(335), U16(121), U16(54), U16(50), U16(422), U16(855), U16(428), U16(139), + U16(44), U16(107), U16(396), U16(90), U16(41), U16(154), U16(41), U16(90), U16(37), U16(105), + U16(69), U16(105), U16(37), U16(58), U16(41), U16(90), U16(57), U16(169), U16(218), U16(41), + U16(58), U16(41), U16(58), U16(41), U16(58), U16(137), U16(58), U16(37), U16(137), U16(37), + U16(135), U16(37), U16(90), U16(69), U16(73), U16(185), U16(94), U16(101), U16(58), U16(57), + U16(90), U16(37), U16(58), U16(527), U16(1134), U16(94), U16(142), U16(47), U16(185), U16(186), + U16(89), U16(154), U16(57), U16(90), U16(57), U16(90), U16(57), U16(250), U16(57), U16(1018), + U16(89), U16(90), U16(57), U16(58), U16(57), U16(1018), U16(8601), U16(282), U16(153), U16(666), + U16(89), U16(250), U16(54), U16(50), U16(2618), U16(57), U16(986), U16(825), U16(1306), U16(217), + U16(602), U16(1274), U16(378), U16(1935), U16(2522), U16(719), U16(5882), U16(57), U16(314), U16(57), + U16(1754), U16(281), U16(3578), U16(57), U16(4634), U16(3322), U16(54), U16(50), U16(54), U16(50), + U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), + U16(975), U16(1434), U16(185), U16(54), U16(50), U16(1017), U16(54), U16(50), U16(54), U16(50), + U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(537), U16(8218), U16(4217), U16(54), + U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), + U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), + U16(50), U16(2041), U16(54), U16(50), U16(54), U16(50), U16(1049), U16(54), U16(50), U16(8281), + U16(1562), U16(697), U16(90), U16(217), U16(346), U16(1513), U16(1509), U16(126), U16(73), U16(69), + U16(254), U16(105), U16(37), U16(94), U16(37), U16(94), U16(165), U16(70), U16(105), U16(37), + U16(3166), U16(37), U16(218), U16(158), U16(108), U16(94), U16(149), U16(47), U16(85), U16(1221), + U16(37), U16(37), U16(1799), U16(38), U16(53), U16(44), U16(743), U16(231), U16(231), U16(231), + U16(231), U16(231), U16(231), U16(231), U16(231), U16(1036), U16(85), U16(52), U16(51), U16(52), + U16(51), U16(117), U16(52), U16(51), U16(53), U16(52), U16(51), U16(309), U16(49), U16(85), + U16(49), U16(53), U16(52), U16(51), U16(85), U16(52), U16(51), U16(54), U16(50), U16(54), + U16(50), U16(54), U16(50), U16(54), U16(50), U16(181), U16(38), U16(341), U16(81), U16(858), + U16(2874), U16(6874), U16(410), U16(61), U16(117), U16(58), U16(38), U16(39), U16(46), U16(54), + U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(90), + U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(49), U16(54), + U16(82), U16(58), U16(302), U16(140), U16(74), U16(49), U16(166), U16(90), U16(110), U16(38), + U16(39), U16(53), U16(90), U16(2759), U16(76), U16(88), U16(70), U16(39), U16(49), U16(2887), + U16(53), U16(102), U16(39), U16(1319), U16(3015), U16(90), U16(143), U16(346), U16(871), U16(1178), + U16(519), U16(1018), U16(335), U16(986), U16(271), U16(58), U16(495), U16(1050), U16(335), U16(1274), + U16(495), U16(2042), U16(8218), U16(39), U16(39), U16(2074), U16(39), U16(39), U16(679), U16(38), + U16(36583), U16(1786), U16(1287), U16(198), U16(85), U16(8583), U16(38), U16(117), U16(519), U16(333), + U16(71), U16(1502), U16(39), U16(44), U16(107), U16(53), U16(332), U16(53), U16(38), U16(798), + U16(44), U16(2247), U16(334), U16(76), U16(213), U16(760), U16(294), U16(88), U16(478), U16(69), + U16(2014), U16(38), U16(261), U16(190), U16(350), U16(38), U16(88), U16(158), U16(158), U16(382), + U16(70), U16(37), U16(231), U16(44), U16(103), U16(44), U16(135), U16(44), U16(743), U16(74), + U16(76), U16(42), U16(154), U16(207), U16(90), U16(55), U16(58), U16(1671), U16(149), U16(74), + U16(1607), U16(522), U16(44), U16(85), U16(333), U16(588), U16(199), U16(117), U16(39), U16(333), + U16(903), U16(268), U16(85), U16(743), U16(364), U16(74), U16(53), U16(935), U16(108), U16(42), + U16(1511), U16(44), U16(74), U16(140), U16(74), U16(44), U16(138), U16(437), U16(38), U16(333), + U16(85), U16(1319), U16(204), U16(74), U16(76), U16(74), U16(76), U16(103), U16(44), U16(263), + U16(44), U16(42), U16(333), U16(149), U16(519), U16(38), U16(199), U16(122), U16(39), U16(42), + U16(1543), U16(44), U16(39), U16(108), U16(71), U16(76), U16(167), U16(76), U16(39), U16(44), + U16(39), U16(71), U16(38), U16(85), U16(359), U16(42), U16(76), U16(74), U16(85), U16(39), + U16(70), U16(42), U16(44), U16(199), U16(199), U16(199), U16(231), U16(231), U16(1127), U16(74), + U16(44), U16(74), U16(44), U16(74), U16(53), U16(42), U16(44), U16(333), U16(39), U16(39), + U16(743), U16(1575), U16(36), U16(68), U16(68), U16(36), U16(63), U16(63), U16(11719), U16(3399), + U16(229), U16(165), U16(39), U16(44), U16(327), U16(57), U16(423), U16(167), U16(39), U16(71), + U16(71), U16(3463), U16(536), U16(11623), U16(54), U16(50), U16(2055), U16(1735), U16(391), U16(55), + U16(58), U16(524), U16(245), U16(54), U16(50), U16(53), U16(236), U16(53), U16(81), U16(80), + U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), + U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), U16(85), U16(54), U16(50), U16(149), + U16(112), U16(117), U16(149), U16(49), U16(54), U16(50), U16(54), U16(50), U16(54), U16(50), + U16(117), U16(57), U16(49), U16(121), U16(53), U16(55), U16(85), U16(167), U16(4327), U16(34), + U16(117), U16(55), U16(117), U16(54), U16(50), U16(53), U16(57), U16(53), U16(49), U16(85), + U16(333), U16(85), U16(121), U16(85), U16(841), U16(54), U16(53), U16(50), U16(56), U16(48), + U16(56), U16(837), U16(54), U16(57), U16(50), U16(57), U16(54), U16(50), U16(53), U16(54), + U16(50), U16(85), U16(327), U16(38), U16(1447), U16(70), U16(999), U16(199), U16(199), U16(199), + U16(103), U16(87), U16(57), U16(56), U16(58), U16(87), U16(58), U16(153), U16(90), U16(98), + U16(90), U16(391), U16(839), U16(615), U16(71), U16(487), U16(455), U16(3943), U16(117), U16(1455), + U16(314), U16(1710), U16(143), U16(570), U16(47), U16(410), U16(1466), U16(44), U16(935), U16(1575), + U16(999), U16(143), U16(551), U16(46), U16(263), U16(46), U16(967), U16(53), U16(1159), U16(263), + U16(53), U16(174), U16(1289), U16(1285), U16(2503), U16(333), U16(199), U16(39), U16(1415), U16(71), + U16(39), U16(743), U16(53), U16(271), U16(711), U16(207), U16(53), U16(839), U16(53), U16(1799), + U16(71), U16(39), U16(108), U16(76), U16(140), U16(135), U16(103), U16(871), U16(108), U16(44), + U16(271), U16(309), U16(935), U16(79), U16(53), U16(1735), U16(245), U16(711), U16(271), U16(615), + U16(271), U16(2343), U16(1007), U16(42), U16(44), U16(42), U16(1703), U16(492), U16(245), U16(655), + U16(333), U16(76), U16(42), U16(1447), U16(106), U16(140), U16(74), U16(76), U16(85), U16(34), + U16(149), U16(807), U16(333), U16(108), U16(1159), U16(172), U16(42), U16(268), U16(333), U16(149), + U16(76), U16(42), U16(1543), U16(106), U16(300), U16(74), U16(135), U16(149), U16(333), U16(1383), + U16(44), U16(42), U16(44), U16(74), U16(204), U16(42), U16(44), U16(333), U16(28135), U16(3182), + U16(149), U16(34279), U16(18215), U16(2215), U16(39), U16(1482), U16(140), U16(422), U16(71), U16(7898), + U16(1274), U16(1946), U16(74), U16(108), U16(122), U16(202), U16(258), U16(268), U16(90), U16(236), + U16(986), U16(140), U16(1562), U16(2138), U16(108), U16(58), U16(2810), U16(591), U16(841), U16(837), + U16(841), U16(229), U16(581), U16(841), U16(837), U16(41), U16(73), U16(41), U16(73), U16(137), + U16(265), U16(133), U16(37), U16(229), U16(357), U16(841), U16(837), U16(73), U16(137), U16(265), + U16(233), U16(837), U16(73), U16(137), U16(169), U16(41), U16(233), U16(837), U16(841), U16(837), + U16(841), U16(837), U16(841), U16(837), U16(841), U16(837), U16(841), U16(837), U16(841), U16(901), + U16(809), U16(57), U16(805), U16(57), U16(197), U16(809), U16(57), U16(805), U16(57), U16(197), + U16(809), U16(57), U16(805), U16(57), U16(197), U16(809), U16(57), U16(805), U16(57), U16(197), + U16(809), U16(57), U16(805), U16(57), U16(197), U16(94), U16(1613), U16(135), U16(871), U16(71), + U16(39), U16(39), U16(327), U16(135), U16(39), U16(39), U16(39), U16(39), U16(39), U16(39), + U16(103), U16(71), U16(39), U16(39), U16(39), U16(39), U16(39), U16(39), U16(71), U16(39), + U16(135), U16(231), U16(135), U16(135), U16(39), U16(327), U16(551), U16(103), U16(167), U16(551), + U16(89), U16(1434), U16(3226), U16(506), U16(474), U16(506), U16(506), U16(367), U16(1018), U16(1946), + U16(1402), U16(954), U16(1402), U16(314), U16(90), U16(1082), U16(218), U16(2266), U16(666), U16(1210), + U16(186), U16(570), U16(2042), U16(58), U16(5850), U16(154), U16(2010), U16(154), U16(794), U16(2266), + U16(378), U16(2266), U16(3738), U16(39), U16(39), U16(39), U16(39), U16(39), U16(39), U16(17351), + U16(34), U16(3074), U16(7692), U16(63), U16(63), +} /* sqlite3.c:233848:12 */ + +func sqlite3Fts5UnicodeCategory(tls *libc.TLS, iCode U32) int32 { /* sqlite3.c:234028:12: */ + var iRes int32 = -1 + var iHi int32 + var iLo int32 + var ret int32 + var iKey U16 + + if iCode >= (U32(int32(1) << 20)) { + return 0 + } + iLo = int32(aFts5UnicodeBlock[(iCode >> 16)]) + iHi = int32(aFts5UnicodeBlock[(U32(1) + (iCode >> 16))]) + iKey = (U16(iCode & U32(0xFFFF))) + for iHi > iLo { + var iTest int32 = ((iHi + iLo) / 2) + + if int32(iKey) >= int32(aFts5UnicodeMap[iTest]) { + iRes = iTest + iLo = (iTest + 1) + } else { + iHi = iTest + } + } + + if iRes < 0 { + return 0 + } + if int32(iKey) >= (int32(aFts5UnicodeMap[iRes]) + (int32(aFts5UnicodeData[iRes]) >> 5)) { + return 0 + } + ret = (int32(aFts5UnicodeData[iRes]) & 0x1F) + if ret != 30 { + return ret + } + if ((int32(iKey) - int32(aFts5UnicodeMap[iRes])) & 0x01) != 0 { + return 5 + } + return 9 +} + +func sqlite3Fts5UnicodeAscii(tls *libc.TLS, aArray uintptr, aAscii uintptr) { /* sqlite3.c:234059:13: */ + var i int32 = 0 + var iTbl int32 = 0 + for i < 128 { + var bToken int32 = int32(*(*U8)(unsafe.Pointer(aArray + uintptr((int32(aFts5UnicodeData[iTbl]) & 0x1F))))) + var n int32 = ((int32(aFts5UnicodeData[iTbl]) >> 5) + i) + for ; (i < 128) && (i < n); i++ { + *(*U8)(unsafe.Pointer(aAscii + uintptr(i))) = U8(bToken) + } + iTbl++ + } + *(*U8)(unsafe.Pointer(aAscii)) = U8(0) // 0x00 is never a token character +} + +// 2015 May 30 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// Routines for varint serialization and deserialization. + +// #include "fts5Int.h" + +// This is a copy of the sqlite3GetVarint32() routine from the SQLite core. +// Except, this version does handle the single byte case that the core +// version depends on being handled before its function is called. +func sqlite3Fts5GetVarint32(tls *libc.TLS, p uintptr, v uintptr) int32 { /* sqlite3.c:234097:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var a U32 + var b U32 + + // The 1-byte case. Overwhelmingly the most common. + a = U32(*(*uint8)(unsafe.Pointer(p))) + // a: p0 (unmasked) + if !((a & U32(0x80)) != 0) { + // Values between 0 and 127 + *(*U32)(unsafe.Pointer(v)) = a + return 1 + } + + // The 2-byte case + p++ + b = U32(*(*uint8)(unsafe.Pointer(p))) + // b: p1 (unmasked) + if !((b & U32(0x80)) != 0) { + // Values between 128 and 16383 + a = a & (U32(0x7f)) + a = (a << 7) + *(*U32)(unsafe.Pointer(v)) = (a | b) + return 2 + } + + // The 3-byte case + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p0<<14 | p2 (unmasked) + if !((a & U32(0x80)) != 0) { + // Values between 16384 and 2097151 + a = a & (U32((int32(0x7f) << 14) | (0x7f))) + b = b & (U32(0x7f)) + b = (b << 7) + *(*U32)(unsafe.Pointer(v)) = (a | b) + return 3 + } + + /* A 32-bit varint is used to store size information in btrees. + ** Objects are rarely larger than 2MiB limit of a 3-byte varint. + ** A 3-byte varint is sufficient, for example, to record the size + ** of a 1048569-byte BLOB or string. + ** + ** We only unroll the first 1-, 2-, and 3- byte cases. The very + ** rare larger cases can be handled by the slower 64-bit varint + ** routine. + */ + { + // var v64 U64 at bp, 8 + + var n U8 + p -= uintptr(2) + n = sqlite3Fts5GetVarint(tls, p, bp /* &v64 */) + *(*U32)(unsafe.Pointer(v)) = ((U32(*(*U64)(unsafe.Pointer(bp /* v64 */)))) & U32(0x7FFFFFFF)) + + return int32(n) + + } + return int32(0) +} + +// Bitmasks used by sqlite3GetVarint(). These precomputed constants +// are defined here rather than simply putting the constant expressions +// inline in order to work around bugs in the RVT compiler. +// +// SLOT_2_0 A mask for (0x7f<<14) | 0x7f +// +// SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0 + +// Read a 64-bit variable-length integer from memory starting at p[0]. +// Return the number of bytes read. The value is stored in *v. +func sqlite3Fts5GetVarint(tls *libc.TLS, p uintptr, v uintptr) U8 { /* sqlite3.c:234175:11: */ + var a U32 + var b U32 + var s U32 + + a = U32(*(*uint8)(unsafe.Pointer(p))) + // a: p0 (unmasked) + if !((a & U32(0x80)) != 0) { + *(*U64)(unsafe.Pointer(v)) = U64(a) + return U8(1) + } + + p++ + b = U32(*(*uint8)(unsafe.Pointer(p))) + // b: p1 (unmasked) + if !((b & U32(0x80)) != 0) { + a = a & (U32(0x7f)) + a = (a << 7) + a = a | (b) + *(*U64)(unsafe.Pointer(v)) = U64(a) + return U8(2) + } + + // Verify that constants are precomputed correctly + + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p0<<14 | p2 (unmasked) + if !((a & U32(0x80)) != 0) { + a = a & (U32(SLOT_2_0)) + b = b & (U32(0x7f)) + b = (b << 7) + a = a | (b) + *(*U64)(unsafe.Pointer(v)) = U64(a) + return U8(3) + } + + // CSE1 from below + a = a & (U32(SLOT_2_0)) + p++ + b = (b << 14) + b = b | (U32(*(*uint8)(unsafe.Pointer(p)))) + // b: p1<<14 | p3 (unmasked) + if !((b & U32(0x80)) != 0) { + b = b & (U32(SLOT_2_0)) + // moved CSE1 up + // a &= (0x7f<<14)|(0x7f); + a = (a << 7) + a = a | (b) + *(*U64)(unsafe.Pointer(v)) = U64(a) + return U8(4) + } + + // a: p0<<14 | p2 (masked) + // b: p1<<14 | p3 (unmasked) + // 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) + // moved CSE1 up + // a &= (0x7f<<14)|(0x7f); + b = b & (U32(SLOT_2_0)) + s = a + // s: p0<<14 | p2 (masked) + + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p0<<28 | p2<<14 | p4 (unmasked) + if !((a & U32(0x80)) != 0) { + // we can skip these cause they were (effectively) done above in calc'ing s + // a &= (0x7f<<28)|(0x7f<<14)|(0x7f); + // b &= (0x7f<<14)|(0x7f); + b = (b << 7) + a = a | (b) + s = (s >> 18) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(5) + } + + // 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) + s = (s << 7) + s = s | (b) + // s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) + + p++ + b = (b << 14) + b = b | (U32(*(*uint8)(unsafe.Pointer(p)))) + // b: p1<<28 | p3<<14 | p5 (unmasked) + if !((b & U32(0x80)) != 0) { + // we can skip this cause it was (effectively) done above in calc'ing s + // b &= (0x7f<<28)|(0x7f<<14)|(0x7f); + a = a & (U32(SLOT_2_0)) + a = (a << 7) + a = a | (b) + s = (s >> 18) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(6) + } + + p++ + a = (a << 14) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p2<<28 | p4<<14 | p6 (unmasked) + if !((a & U32(0x80)) != 0) { + a = a & (SLOT_4_2_0) + b = b & (U32(SLOT_2_0)) + b = (b << 7) + a = a | (b) + s = (s >> 11) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(7) + } + + // CSE2 from below + a = a & (U32(SLOT_2_0)) + p++ + b = (b << 14) + b = b | (U32(*(*uint8)(unsafe.Pointer(p)))) + // b: p3<<28 | p5<<14 | p7 (unmasked) + if !((b & U32(0x80)) != 0) { + b = b & (SLOT_4_2_0) + // moved CSE2 up + // a &= (0x7f<<14)|(0x7f); + a = (a << 7) + a = a | (b) + s = (s >> 4) + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + return U8(8) + } + + p++ + a = (a << 15) + a = a | (U32(*(*uint8)(unsafe.Pointer(p)))) + // a: p4<<29 | p6<<15 | p8 (unmasked) + + // moved CSE2 up + // a &= (0x7f<<29)|(0x7f<<15)|(0xff); + b = b & (U32(SLOT_2_0)) + b = (b << 8) + a = a | (b) + + s = (s << 4) + b = U32(*(*uint8)(unsafe.Pointer(p + libc.UintptrFromInt32(-4)))) + b = b & (U32(0x7f)) + b = (b >> 3) + s = s | (b) + + *(*U64)(unsafe.Pointer(v)) = (((U64(s)) << 32) | U64(a)) + + return U8(9) +} + +// The variable-length integer encoding is as follows: +// +// KEY: +// A = 0xxxxxxx 7 bits of data and one flag bit +// B = 1xxxxxxx 7 bits of data and one flag bit +// C = xxxxxxxx 8 bits of data +// +// 7 bits - A +// 14 bits - BA +// 21 bits - BBA +// 28 bits - BBBA +// 35 bits - BBBBA +// 42 bits - BBBBBA +// 49 bits - BBBBBBA +// 56 bits - BBBBBBBA +// 64 bits - BBBBBBBBC + +// Write a 64-bit variable-length integer to memory starting at p[0]. +// The length of data write will be between 1 and 9 bytes. The number +// of bytes written is returned. +// +// A variable-length integer consists of the lower 7 bits of each byte +// for all bytes that have the 8th bit set and one byte with the 8th +// bit clear. Except, if we get to the 9th byte, it stores the full +// 8 bits and is the last byte. +func fts5PutVarint64(tls *libc.TLS, p uintptr, v U64) int32 { /* sqlite3.c:234369:26: */ + bp := tls.Alloc(10) + defer tls.Free(10) + + var i int32 + var j int32 + var n int32 + // var buf [10]U8 at bp, 10 + + if (v & (U64((uint64(0xff000000))) << 32)) != 0 { + *(*uint8)(unsafe.Pointer(p + 8)) = U8(v) + v >>= 8 + for i = 7; i >= 0; i-- { + *(*uint8)(unsafe.Pointer(p + uintptr(i))) = (U8((v & uint64(0x7f)) | uint64(0x80))) + v >>= 7 + } + return 9 + } + n = 0 + for ok := true; ok; ok = (v != uint64(0)) { + *(*U8)(unsafe.Pointer(bp /* &buf[0] */ + uintptr(libc.PostIncInt32(&n, 1)))) = (U8((v & uint64(0x7f)) | uint64(0x80))) + v >>= 7 + } + *(*U8)(unsafe.Pointer(bp /* &buf */)) &= U8((0x7f)) + + i = 0 + j = (n - 1) +__1: + if !(j >= 0) { + goto __3 + } + { + *(*uint8)(unsafe.Pointer(p + uintptr(i))) = *(*U8)(unsafe.Pointer(bp /* &buf[0] */ + uintptr(j))) + + } + goto __2 +__2: + j-- + i++ + goto __1 + goto __3 +__3: + ; + return n +} + +func sqlite3Fts5PutVarint(tls *libc.TLS, p uintptr, v U64) int32 { /* sqlite3.c:234394:12: */ + if v <= uint64(0x7f) { + *(*uint8)(unsafe.Pointer(p)) = (uint8(v & uint64(0x7f))) + return 1 + } + if v <= uint64(0x3fff) { + *(*uint8)(unsafe.Pointer(p)) = (uint8(((v >> 7) & uint64(0x7f)) | uint64(0x80))) + *(*uint8)(unsafe.Pointer(p + 1)) = (uint8(v & uint64(0x7f))) + return 2 + } + return fts5PutVarint64(tls, p, v) +} + +func sqlite3Fts5GetVarintLen(tls *libc.TLS, iVal U32) int32 { /* sqlite3.c:234408:12: */ + + if iVal < (U32(int32(1) << 14)) { + return 2 + } + if iVal < (U32(int32(1) << 21)) { + return 3 + } + if iVal < (U32(int32(1) << 28)) { + return 4 + } + return 5 +} + +// 2015 May 08 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is an SQLite virtual table module implementing direct access to an +// existing FTS5 index. The module may create several different types of +// tables: +// +// col: +// CREATE TABLE vocab(term, col, doc, cnt, PRIMARY KEY(term, col)); +// +// One row for each term/column combination. The value of $doc is set to +// the number of fts5 rows that contain at least one instance of term +// $term within column $col. Field $cnt is set to the total number of +// instances of term $term in column $col (in any row of the fts5 table). +// +// row: +// CREATE TABLE vocab(term, doc, cnt, PRIMARY KEY(term)); +// +// One row for each term in the database. The value of $doc is set to +// the number of fts5 rows that contain at least one instance of term +// $term. Field $cnt is set to the total number of instances of term +// $term in the database. +// +// instance: +// CREATE TABLE vocab(term, doc, col, offset, PRIMARY KEY()); +// +// One row for each term instance in the database. + +// #include "fts5Int.h" + +type Fts5VocabTable1 = struct { + Fbase Sqlite3_vtab + FzFts5Tbl uintptr + FzFts5Db uintptr + Fdb uintptr + FpGlobal uintptr + FeType int32 + FbBusy uint32 +} /* sqlite3.c:234461:9 */ + +// 2015 May 08 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This is an SQLite virtual table module implementing direct access to an +// existing FTS5 index. The module may create several different types of +// tables: +// +// col: +// CREATE TABLE vocab(term, col, doc, cnt, PRIMARY KEY(term, col)); +// +// One row for each term/column combination. The value of $doc is set to +// the number of fts5 rows that contain at least one instance of term +// $term within column $col. Field $cnt is set to the total number of +// instances of term $term in column $col (in any row of the fts5 table). +// +// row: +// CREATE TABLE vocab(term, doc, cnt, PRIMARY KEY(term)); +// +// One row for each term in the database. The value of $doc is set to +// the number of fts5 rows that contain at least one instance of term +// $term. Field $cnt is set to the total number of instances of term +// $term in the database. +// +// instance: +// CREATE TABLE vocab(term, doc, col, offset, PRIMARY KEY()); +// +// One row for each term instance in the database. + +// #include "fts5Int.h" + +type Fts5VocabTable = Fts5VocabTable1 /* sqlite3.c:234461:31 */ +type Fts5VocabCursor1 = struct { + Fbase Sqlite3_vtab_cursor + FpStmt uintptr + FpFts5 uintptr + FbEof int32 + _ [4]byte + FpIter uintptr + FnLeTerm int32 + _ [4]byte + FzLeTerm uintptr + FiCol int32 + _ [4]byte + FaCnt uintptr + FaDoc uintptr + Frowid I64 + Fterm Fts5Buffer + FiInstPos I64 + FiInstOff int32 + _ [4]byte +} /* sqlite3.c:234462:9 */ + +type Fts5VocabCursor = Fts5VocabCursor1 /* sqlite3.c:234462:32 */ + +// Bits for the mask used as the idxNum value by xBestIndex/xFilter. + +// Translate a string containing an fts5vocab table type to an +// FTS5_VOCAB_XXX constant. If successful, set *peType to the output +// value and return SQLITE_OK. Otherwise, set *pzErr to an error message +// and return SQLITE_ERROR. +func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uintptr) int32 { /* sqlite3.c:234521:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + sqlite3Fts5Dequote(tls, zCopy) + if Xsqlite3_stricmp(tls, zCopy, ts+35525 /* "col" */) == 0 { + *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL + } else if Xsqlite3_stricmp(tls, zCopy, ts+35529 /* "row" */) == 0 { + *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW + } else if Xsqlite3_stricmp(tls, zCopy, ts+35533 /* "instance" */) == 0 { + *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE + } else { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35542 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR + } + Xsqlite3_free(tls, zCopy) + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// The xDisconnect() virtual table method. +func fts5VocabDisconnectMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:234550:12: */ + var pTab uintptr = pVtab + Xsqlite3_free(tls, pTab) + return SQLITE_OK +} + +// The xDestroy() virtual table method. +func fts5VocabDestroyMethod(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:234559:12: */ + var pTab uintptr = pVtab + Xsqlite3_free(tls, pTab) + return SQLITE_OK +} + +// This function is the implementation of both the xConnect and xCreate +// methods of the FTS3 virtual table. +// +// The argv[] array contains the following: +// +// argv[0] -> module name ("fts5vocab") +// argv[1] -> database name +// argv[2] -> table name +// +// then: +// +// argv[3] -> name of fts5 table +// argv[4] -> type of fts5vocab table +// +// or, for tables in the TEMP schema only. +// +// argv[3] -> name of fts5 tables database +// argv[4] -> name of fts5 table +// argv[5] -> type of fts5vocab table +func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* sqlite3.c:234586:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + *(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azSchema */)) = [3]uintptr{ + ts + 35576, /* "CREATE TABlE voc..." */ + ts + 35616, /* "CREATE TABlE voc..." */ + ts + 35651, /* "CREATE TABlE voc..." */ + } + + var pRet uintptr = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code + var bDb int32 + + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+21626 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) + + if (argc != 5) && (bDb == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35694 /* "wrong number of ..." */, 0) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } else { + var nByte int32 // Bytes of space to allocate + var zDb uintptr + if bDb != 0 { + zDb = *(*uintptr)(unsafe.Pointer(argv + 3*8)) + } else { + zDb = *(*uintptr)(unsafe.Pointer(argv + 1*8)) + } + var zTab uintptr + if bDb != 0 { + zTab = *(*uintptr)(unsafe.Pointer(argv + 4*8)) + } else { + zTab = *(*uintptr)(unsafe.Pointer(argv + 3*8)) + } + var zType uintptr + if bDb != 0 { + zType = *(*uintptr)(unsafe.Pointer(argv + 5*8)) + } else { + zType = *(*uintptr)(unsafe.Pointer(argv + 4*8)) + } + var nDb int32 = (int32(libc.Xstrlen(tls, zDb)) + 1) + var nTab int32 = (int32(libc.Xstrlen(tls, zTab)) + 1) + *(*int32)(unsafe.Pointer(bp /* eType */)) = 0 + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = fts5VocabTableType(tls, zType, pzErr, bp /* &eType */) + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_declare_vtab(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* &azSchema[0] */ + uintptr(*(*int32)(unsafe.Pointer(bp /* eType */)))*8))) + } + + nByte = (int32((uint64(unsafe.Sizeof(Fts5VocabTable{})) + uint64(nDb)) + uint64(nTab))) + pRet = sqlite3Fts5MallocZero(tls, bp+32 /* &rc */, int64(nByte)) + if pRet != 0 { + (*Fts5VocabTable)(unsafe.Pointer(pRet)).FpGlobal = pAux + (*Fts5VocabTable)(unsafe.Pointer(pRet)).FeType = *(*int32)(unsafe.Pointer(bp /* eType */)) + (*Fts5VocabTable)(unsafe.Pointer(pRet)).Fdb = db + (*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Tbl = (pRet + 1*64) + (*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Db = ((*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Tbl + uintptr(nTab)) + libc.Xmemcpy(tls, (*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Tbl, zTab, uint64(nTab)) + libc.Xmemcpy(tls, (*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Db, zDb, uint64(nDb)) + sqlite3Fts5Dequote(tls, (*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Tbl) + sqlite3Fts5Dequote(tls, (*Fts5VocabTable)(unsafe.Pointer(pRet)).FzFts5Db) + } + } + + *(*uintptr)(unsafe.Pointer(ppVTab)) = pRet + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// The xConnect() and xCreate() methods for the virtual table. All the +// work is done in function fts5VocabInitVtab(). +func fts5VocabConnectMethod(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:234648:12: */ + return fts5VocabInitVtab(tls, db, pAux, argc, argv, ppVtab, pzErr) +} + +func fts5VocabCreateMethod(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:234658:12: */ + return fts5VocabInitVtab(tls, db, pAux, argc, argv, ppVtab, pzErr) +} + +// Implementation of the xBestIndex method. +// +// Only constraints of the form: +// +// term <= ? +// term == ? +// term >= ? +// +// are interpreted. Less-than and less-than-or-equal are treated +// identically, as are greater-than and greater-than-or-equal. +func fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) int32 { /* sqlite3.c:234681:12: */ + var i int32 + var iTermEq int32 = -1 + var iTermGe int32 = -1 + var iTermLe int32 = -1 + var idxNum int32 = 0 + var nArg int32 = 0 + + _ = pUnused + + for i = 0; i < (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint; i++ { + var p uintptr = ((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint + uintptr(i)*12) + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) == 0 { + continue + } + if (*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0 { // term column + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ { + iTermEq = i + } + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_LE { + iTermLe = i + } + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_LT { + iTermLe = i + } + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_GE { + iTermGe = i + } + if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_GT { + iTermGe = i + } + } + } + + if iTermEq >= 0 { + idxNum = idxNum | (FTS5_VOCAB_TERM_EQ) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(iTermEq)*8)).FargvIndex = libc.PreIncInt32(&nArg, 1) + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = float64(100) + } else { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = float64(1000000) + if iTermGe >= 0 { + idxNum = idxNum | (FTS5_VOCAB_TERM_GE) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(iTermGe)*8)).FargvIndex = libc.PreIncInt32(&nArg, 1) + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = ((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost / float64(2)) + } + if iTermLe >= 0 { + idxNum = idxNum | (FTS5_VOCAB_TERM_LE) + (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(iTermLe)*8)).FargvIndex = libc.PreIncInt32(&nArg, 1) + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = ((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost / float64(2)) + } + } + + // This virtual table always delivers results in ascending order of + // the "term" column (column 0). So if the user has requested this + // specifically - "ORDER BY term" or "ORDER BY term ASC" - set the + // sqlite3_index_info.orderByConsumed flag to tell the core the results + // are already in sorted order. + if (((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FnOrderBy == 1) && + ((*sqlite3_index_orderby)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy)).FiColumn == 0)) && + (int32((*sqlite3_index_orderby)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaOrderBy)).Fdesc) == 0) { + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).ForderByConsumed = 1 + } + + (*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = idxNum + return SQLITE_OK +} + +// Implementation of xOpen method. +func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* sqlite3.c:234743:12: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + var pTab uintptr = pVTab + var pFts5 uintptr = uintptr(0) + var pCsr uintptr = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) + var zSql uintptr = uintptr(0) + + if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { + (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, + ts+35727 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + return SQLITE_ERROR + } + zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ + ts+35758, /* "SELECT t.%Q FROM..." */ + libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + if zSql != 0 { + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+72 /* &pStmt */, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_ERROR { + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK + } + + (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy = uint32(1) + if (*(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) != 0) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) == SQLITE_ROW) { + var iId I64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)), 0) + pFts5 = sqlite3Fts5TableFromCsrid(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FpGlobal, iId) + } + (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy = uint32(0) + + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { + if pFts5 == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) + *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { + (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, + ts+35809 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + } + } else { + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = sqlite3Fts5FlushToDisk(tls, pFts5) + } + } + + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { + var nByte int32 = (int32(((uint64((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pFts5)).FpConfig)).FnCol) * uint64(unsafe.Sizeof(I64(0)))) * uint64(2)) + uint64(unsafe.Sizeof(Fts5VocabCursor{})))) + pCsr = sqlite3Fts5MallocZero(tls, bp+64 /* &rc */, int64(nByte)) + } + + if pCsr != 0 { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5 = pFts5 + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt = (pCsr + 1*120) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc = ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt + uintptr((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pFts5)).FpConfig)).FnCol)*8) + } else { + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) + } + + *(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr + return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) +} + +func fts5VocabResetCursor(tls *libc.TLS, pCsr uintptr) { /* sqlite3.c:234811:13: */ + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Frowid = int64(0) + sqlite3Fts5IterClose(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter = uintptr(0) + Xsqlite3_free(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = -1 + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = uintptr(0) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = 0 +} + +// Close the cursor. For additional information see the documentation +// on the xClose method of the virtual table interface. +func fts5VocabCloseMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:234825:12: */ + var pCsr uintptr = pCursor + fts5VocabResetCursor(tls, pCsr) + sqlite3Fts5BufferFree(tls, (pCsr + 88 /* &.term */)) + Xsqlite3_finalize(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpStmt) + Xsqlite3_free(tls, pCsr) + return SQLITE_OK +} + +func fts5VocabInstanceNewTerm(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:234834:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK + + if (*Fts5IndexIter)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter)).FbEof != 0 { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = 1 + } else { + var zTerm uintptr + // var nTerm int32 at bp, 4 + + zTerm = sqlite3Fts5IterTerm(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter, bp /* &nTerm */) + if (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm >= 0 { + var nCmp int32 = func() int32 { + if (*(*int32)(unsafe.Pointer(bp /* nTerm */))) < ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm) { + return *(*int32)(unsafe.Pointer(bp /* nTerm */)) + } + return (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + }() + var bCmp int32 = libc.Xmemcmp(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm, zTerm, uint64(nCmp)) + if (bCmp < 0) || ((bCmp == 0) && ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm < *(*int32)(unsafe.Pointer(bp /* nTerm */)))) { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = 1 + } + } + + sqlite3Fts5BufferSet(tls, bp+4 /* &rc */, (pCsr + 88 /* &.term */), *(*int32)(unsafe.Pointer(bp /* nTerm */)), zTerm) + } + return *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) +} + +func fts5VocabInstanceNext(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:234856:12: */ + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FeDetail + var rc int32 = SQLITE_OK + var pIter uintptr = (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter + var pp uintptr = (pCsr + 104 /* &.iInstPos */) + var po uintptr = (pCsr + 112 /* &.iInstOff */) + + for (eDetail == FTS5_DETAIL_NONE) || + (sqlite3Fts5PoslistNext64(tls, (*Fts5IndexIter)(unsafe.Pointer(pIter)).FpData, (*Fts5IndexIter)(unsafe.Pointer(pIter)).FnData, po, pp) != 0) { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstPos = int64(0) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstOff = 0 + + rc = sqlite3Fts5IterNextScan(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter) + if rc == SQLITE_OK { + rc = fts5VocabInstanceNewTerm(tls, pCsr) + if ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof != 0) || (eDetail == FTS5_DETAIL_NONE) { + break + } + } + if rc != 0 { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = 1 + break + } + } + + return rc +} + +// Advance the cursor to the next row in the table. +func fts5VocabNextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:234888:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var pCsr uintptr = pCursor + var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK + var nCol int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FnCol + + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Frowid++ + + if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType == FTS5_VOCAB_INSTANCE { + return fts5VocabInstanceNext(tls, pCsr) + } + + if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType == FTS5_VOCAB_COL { + for (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++; (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol < nCol; (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ { + if *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc + uintptr((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol)*8)) != 0 { + break + } + } + } + + if ((*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType != FTS5_VOCAB_COL) || ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol >= nCol) { + if (*Fts5IndexIter)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter)).FbEof != 0 { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = 1 + } else { + var zTerm uintptr + // var nTerm int32 at bp, 4 + + zTerm = sqlite3Fts5IterTerm(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter, bp /* &nTerm */) + + if (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm >= 0 { + var nCmp int32 = func() int32 { + if (*(*int32)(unsafe.Pointer(bp /* nTerm */))) < ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm) { + return *(*int32)(unsafe.Pointer(bp /* nTerm */)) + } + return (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + }() + var bCmp int32 = libc.Xmemcmp(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm, zTerm, uint64(nCmp)) + if (bCmp < 0) || ((bCmp == 0) && ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm < *(*int32)(unsafe.Pointer(bp /* nTerm */)))) { + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof = 1 + return SQLITE_OK + } + } + + sqlite3Fts5BufferSet(tls, bp+4 /* &rc */, (pCsr + 88 /* &.term */), *(*int32)(unsafe.Pointer(bp /* nTerm */)), zTerm) + libc.Xmemset(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt, 0, (uint64(nCol) * uint64(unsafe.Sizeof(I64(0))))) + libc.Xmemset(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc, 0, (uint64(nCol) * uint64(unsafe.Sizeof(I64(0))))) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol = 0 + + for *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FeDetail + var pPos uintptr + var nPos int32 // Position list + *(*I64)(unsafe.Pointer(bp + 16 /* iPos */)) = int64(0) // 64-bit position read from poslist + *(*int32)(unsafe.Pointer(bp + 8 /* iOff */)) = 0 // Current offset within position list + + pPos = (*Fts5IndexIter)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter)).FpData + nPos = (*Fts5IndexIter)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter)).FnData + + switch (*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType { + case FTS5_VOCAB_ROW: + if eDetail == FTS5_DETAIL_FULL { + for 0 == sqlite3Fts5PoslistNext64(tls, pPos, nPos, bp+8 /* &iOff */, bp+16 /* &iPos */) { + *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt))++ + } + } + *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc))++ + break + fallthrough + + case FTS5_VOCAB_COL: + if eDetail == FTS5_DETAIL_FULL { + var iCol int32 = -1 + for 0 == sqlite3Fts5PoslistNext64(tls, pPos, nPos, bp+8 /* &iOff */, bp+16 /* &iPos */) { + var ii int32 = (int32(*(*I64)(unsafe.Pointer(bp + 16 /* iPos */)) >> 32)) + if iCol != ii { + if ii >= nCol { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + break + } + *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc + uintptr(ii)*8))++ + iCol = ii + } + *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt + uintptr(ii)*8))++ + } + } else if eDetail == FTS5_DETAIL_COLUMNS { + for 0 == sqlite3Fts5PoslistNext64(tls, pPos, nPos, bp+8 /* &iOff */, bp+16 /* &iPos */) { + + if *(*I64)(unsafe.Pointer(bp + 16 /* iPos */)) >= I64(nCol) { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + break + } + *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc + uintptr(*(*I64)(unsafe.Pointer(bp + 16 /* iPos */)))*8))++ + } + } else { + + *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc))++ + } + break + fallthrough + + default: + + break + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3Fts5IterNextScan(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter) + } + if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType == FTS5_VOCAB_INSTANCE { + break + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + zTerm = sqlite3Fts5IterTerm(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter, bp /* &nTerm */) + if (*(*int32)(unsafe.Pointer(bp /* nTerm */)) != (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Fterm.Fn) || + ((*(*int32)(unsafe.Pointer(bp /* nTerm */)) > 0) && (libc.Xmemcmp(tls, zTerm, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Fterm.Fp, uint64(*(*int32)(unsafe.Pointer(bp /* nTerm */)))) != 0)) { + break + } + if (*Fts5IndexIter)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter)).FbEof != 0 { + break + } + } + } + } + } + + if ((*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof == 0)) && ((*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType == FTS5_VOCAB_COL) { + for ; ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol < nCol) && (*(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc + uintptr((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol)*8)) == int64(0)); (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol++ { + } + if (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol == nCol { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = (SQLITE_CORRUPT | (int32(1) << 8)) + } + } + return *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) +} + +// This is the xFilter implementation for the virtual table. +func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused uintptr, nUnused int32, apVal uintptr) int32 { /* sqlite3.c:235014:12: */ + var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab + var pCsr uintptr = pCursor + var eType int32 = (*Fts5VocabTable)(unsafe.Pointer(pTab)).FeType + var rc int32 = SQLITE_OK + + var iVal int32 = 0 + var f int32 = FTS5INDEX_QUERY_SCAN + var zTerm uintptr = uintptr(0) + var nTerm int32 = 0 + + var pEq uintptr = uintptr(0) + var pGe uintptr = uintptr(0) + var pLe uintptr = uintptr(0) + + _ = zUnused + _ = nUnused + + fts5VocabResetCursor(tls, pCsr) + if (idxNum & FTS5_VOCAB_TERM_EQ) != 0 { + pEq = *(*uintptr)(unsafe.Pointer(apVal + uintptr(libc.PostIncInt32(&iVal, 1))*8)) + } + if (idxNum & FTS5_VOCAB_TERM_GE) != 0 { + pGe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(libc.PostIncInt32(&iVal, 1))*8)) + } + if (idxNum & FTS5_VOCAB_TERM_LE) != 0 { + pLe = *(*uintptr)(unsafe.Pointer(apVal + uintptr(libc.PostIncInt32(&iVal, 1))*8)) + } + + if pEq != 0 { + zTerm = Xsqlite3_value_text(tls, pEq) + nTerm = Xsqlite3_value_bytes(tls, pEq) + f = 0 + } else { + if pGe != 0 { + zTerm = Xsqlite3_value_text(tls, pGe) + nTerm = Xsqlite3_value_bytes(tls, pGe) + } + if pLe != 0 { + var zCopy uintptr = Xsqlite3_value_text(tls, pLe) + if zCopy == uintptr(0) { + zCopy = ts + 756 /* "" */ + } + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) + if (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemcpy(tls, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm, zCopy, (uint64((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1))) + } + } + } + + if rc == SQLITE_OK { + var pIndex uintptr = (*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpIndex + rc = sqlite3Fts5IndexQuery(tls, pIndex, zTerm, nTerm, f, uintptr(0), (pCsr + 32 /* &.pIter */)) + } + if (rc == SQLITE_OK) && (eType == FTS5_VOCAB_INSTANCE) { + rc = fts5VocabInstanceNewTerm(tls, pCsr) + } + if ((rc == SQLITE_OK) && !((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof != 0)) && + ((eType != FTS5_VOCAB_INSTANCE) || + ((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FeDetail != FTS5_DETAIL_NONE)) { + rc = fts5VocabNextMethod(tls, pCursor) + } + + return rc +} + +// This is the xEof method of the virtual table. SQLite calls this +// routine to find out if it has reached the end of a result set. +func fts5VocabEofMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:235085:12: */ + var pCsr uintptr = pCursor + return (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FbEof +} + +func fts5VocabColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) int32 { /* sqlite3.c:235090:12: */ + var pCsr uintptr = pCursor + var eDetail int32 = (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FeDetail + var eType int32 = (*Fts5VocabTable)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FeType + var iVal I64 = int64(0) + + if iCol == 0 { + Xsqlite3_result_text(tls, + pCtx, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Fterm.Fp, (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Fterm.Fn, libc.UintptrFromInt32(-1)) + } else if eType == FTS5_VOCAB_COL { + + if iCol == 1 { + if eDetail != FTS5_DETAIL_NONE { + var z uintptr = *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FazCol + uintptr((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol)*8)) + Xsqlite3_result_text(tls, pCtx, z, -1, uintptr(0)) + } + } else if iCol == 2 { + iVal = *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc + uintptr((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol)*8)) + } else { + iVal = *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt + uintptr((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiCol)*8)) + } + } else if eType == FTS5_VOCAB_ROW { + + if iCol == 1 { + iVal = *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc)) + } else { + iVal = *(*I64)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt)) + } + } else { + + switch iCol { + case 1: + Xsqlite3_result_int64(tls, pCtx, (*Fts5IndexIter)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpIter)).FiRowid) + break + fallthrough + case 2: + { + var ii int32 = -1 + if eDetail == FTS5_DETAIL_FULL { + ii = (int32((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstPos >> 32)) + } else if eDetail == FTS5_DETAIL_COLUMNS { + ii = int32((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstPos) + } + if (ii >= 0) && (ii < (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FnCol) { + var z uintptr = *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5)).FpConfig)).FazCol + uintptr(ii)*8)) + Xsqlite3_result_text(tls, pCtx, z, -1, uintptr(0)) + } + break + + } + fallthrough + default: + { + + if eDetail == FTS5_DETAIL_FULL { + var ii int32 = (int32((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FiInstPos & int64(0x7FFFFFFF))) + Xsqlite3_result_int(tls, pCtx, ii) + } + break + + } + } + } + + if iVal > int64(0) { + Xsqlite3_result_int64(tls, pCtx, iVal) + } + return SQLITE_OK +} + +// This is the xRowid method. The SQLite core calls this routine to +// retrieve the rowid for the current row of the result set. The +// rowid should be written to *pRowid. +func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* sqlite3.c:235162:12: */ + var pCsr uintptr = pCursor + *(*Sqlite_int64)(unsafe.Pointer(pRowid)) = (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).Frowid + return SQLITE_OK +} + +func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ + var p uintptr = pGlobal + + return Xsqlite3_create_module_v2(tls, db, ts+35835 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) +} + +var fts5Vocab = Sqlite3_module{ + /* iVersion */ FiVersion: 2, + /* xCreate */ FxCreate: 0, + /* xConnect */ FxConnect: 0, + /* xBestIndex */ FxBestIndex: 0, + /* xDisconnect */ FxDisconnect: 0, + /* xDestroy */ FxDestroy: 0, + /* xOpen */ FxOpen: 0, + /* xClose */ FxClose: 0, + /* xFilter */ FxFilter: 0, + /* xNext */ FxNext: 0, + /* xEof */ FxEof: 0, + /* xColumn */ FxColumn: 0, + /* xRowid */ FxRowid: 0, +} /* sqlite3.c:235172:31 */ + +//************* End of fts5.c *********************************************** +//************* Begin file stmt.c ******************************************* +// 2017-05-31 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file demonstrates an eponymous virtual table that returns information +// about all prepared statements for the database connection. +// +// Usage example: +// +// .load ./stmt +// .mode line +// .header on +// SELECT * FROM stmt; + +//************* End of stmt.c *********************************************** +// Return the source-id for this library +func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ + return ts + 35845 /* "2021-06-18 18:36..." */ +} + +//************************* End of sqlite3.c ***************************** + +func init() { + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&Xsqlite3aEQb)) + 0)) = (uintptr(unsafe.Pointer(&Xsqlite3UpperToLower)) + 210) // sqlite3.c:20881:51: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&Xsqlite3aGTb)) + 0)) = (uintptr(unsafe.Pointer(&Xsqlite3UpperToLower)) + 216) // sqlite3.c:20882:51: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&Xsqlite3aLTb)) + 0)) = (uintptr(unsafe.Pointer(&Xsqlite3UpperToLower)) + 204) // sqlite3.c:20880:51: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg)) + 16 /* .xStep */)) = jsonArrayStep // sqlite3.c:192213:7: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg)) + 24 /* .xFinal */)) = jsonArrayFinal // sqlite3.c:192213:24: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg)) + 32 /* .xValue */)) = jsonArrayValue // sqlite3.c:192213:41: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg)) + 56 /* .xStep */)) = jsonObjectStep // sqlite3.c:192215:7: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg)) + 64 /* .xFinal */)) = jsonObjectFinal // sqlite3.c:192215:24: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg)) + 72 /* .xValue */)) = jsonObjectValue // sqlite3.c:192215:41: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg1)) + 0 /* .xStep */)) = geopolyBBoxStep // sqlite3.c:198435:8: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAgg1)) + 8 /* .xFinal */)) = geopolyBBoxFinal // sqlite3.c:198435:25: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAlterTableFuncs)) + 24 /* .xSFunc */)) = renameColumnFunc // sqlite3.c:109586:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAlterTableFuncs)) + 96 /* .xSFunc */)) = renameTableFunc // sqlite3.c:109587:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAlterTableFuncs)) + 168 /* .xSFunc */)) = renameTableTest // sqlite3.c:109588:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAlterTableFuncs)) + 240 /* .xSFunc */)) = dropColumnFunc // sqlite3.c:109589:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aAlterTableFuncs)) + 312 /* .xSFunc */)) = renameQuotefixFunc // sqlite3.c:109590:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 24 /* .xSFunc */)) = versionFunc // sqlite3.c:121440:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 96 /* .xSFunc */)) = versionFunc // sqlite3.c:121441:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 168 /* .xSFunc */)) = versionFunc // sqlite3.c:121442:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 240 /* .xSFunc */)) = soundexFunc // sqlite3.c:121448:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 312 /* .xSFunc */)) = loadExt // sqlite3.c:121451:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 384 /* .xSFunc */)) = loadExt // sqlite3.c:121452:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 456 /* .xSFunc */)) = compileoptionusedFunc // sqlite3.c:121458:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 528 /* .xSFunc */)) = compileoptiongetFunc // sqlite3.c:121459:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 600 /* .xSFunc */)) = versionFunc // sqlite3.c:121461:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 672 /* .xSFunc */)) = versionFunc // sqlite3.c:121462:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 744 /* .xSFunc */)) = versionFunc // sqlite3.c:121463:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 816 /* .xSFunc */)) = versionFunc // sqlite3.c:121465:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 888 /* .xSFunc */)) = trimFunc // sqlite3.c:121468:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 960 /* .xSFunc */)) = trimFunc // sqlite3.c:121469:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1032 /* .xSFunc */)) = trimFunc // sqlite3.c:121470:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1104 /* .xSFunc */)) = trimFunc // sqlite3.c:121471:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1176 /* .xSFunc */)) = trimFunc // sqlite3.c:121472:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1248 /* .xSFunc */)) = trimFunc // sqlite3.c:121473:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1320 /* .xSFunc */)) = minmaxFunc // sqlite3.c:121474:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1464 /* .xSFunc */)) = minmaxStep // sqlite3.c:121476:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1472 /* .xFinalize */)) = minMaxFinalize // sqlite3.c:121476:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1480 /* .xValue */)) = minMaxValue // sqlite3.c:121476:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1536 /* .xSFunc */)) = minmaxFunc // sqlite3.c:121478:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1680 /* .xSFunc */)) = minmaxStep // sqlite3.c:121480:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1688 /* .xFinalize */)) = minMaxFinalize // sqlite3.c:121480:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1696 /* .xValue */)) = minMaxValue // sqlite3.c:121480:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1752 /* .xSFunc */)) = typeofFunc // sqlite3.c:121482:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1824 /* .xSFunc */)) = lengthFunc // sqlite3.c:121483:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1896 /* .xSFunc */)) = instrFunc // sqlite3.c:121484:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 1968 /* .xSFunc */)) = printfFunc // sqlite3.c:121485:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2040 /* .xSFunc */)) = unicodeFunc // sqlite3.c:121486:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2112 /* .xSFunc */)) = charFunc // sqlite3.c:121487:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2184 /* .xSFunc */)) = absFunc // sqlite3.c:121488:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2256 /* .xSFunc */)) = roundFunc // sqlite3.c:121490:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2328 /* .xSFunc */)) = roundFunc // sqlite3.c:121491:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2400 /* .xSFunc */)) = upperFunc // sqlite3.c:121493:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2472 /* .xSFunc */)) = lowerFunc // sqlite3.c:121494:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2544 /* .xSFunc */)) = hexFunc // sqlite3.c:121495:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2616 /* .xSFunc */)) = versionFunc // sqlite3.c:121496:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2688 /* .xSFunc */)) = randomFunc // sqlite3.c:121497:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2760 /* .xSFunc */)) = randomBlob // sqlite3.c:121498:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2832 /* .xSFunc */)) = nullifFunc // sqlite3.c:121499:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2904 /* .xSFunc */)) = versionFunc // sqlite3.c:121500:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 2976 /* .xSFunc */)) = sourceidFunc // sqlite3.c:121501:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3048 /* .xSFunc */)) = errlogFunc // sqlite3.c:121502:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3120 /* .xSFunc */)) = quoteFunc // sqlite3.c:121503:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3192 /* .xSFunc */)) = last_insert_rowid // sqlite3.c:121504:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3264 /* .xSFunc */)) = changes // sqlite3.c:121505:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3336 /* .xSFunc */)) = total_changes // sqlite3.c:121506:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3408 /* .xSFunc */)) = replaceFunc // sqlite3.c:121507:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3480 /* .xSFunc */)) = zeroblobFunc // sqlite3.c:121508:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3552 /* .xSFunc */)) = substrFunc // sqlite3.c:121509:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3624 /* .xSFunc */)) = substrFunc // sqlite3.c:121510:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3696 /* .xSFunc */)) = substrFunc // sqlite3.c:121511:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3768 /* .xSFunc */)) = substrFunc // sqlite3.c:121512:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3840 /* .xSFunc */)) = sumStep // sqlite3.c:121513:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3848 /* .xFinalize */)) = sumFinalize // sqlite3.c:121513:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3856 /* .xValue */)) = sumFinalize // sqlite3.c:121513:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3864 /* .xInverse */)) = sumInverse // sqlite3.c:121513:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3912 /* .xSFunc */)) = sumStep // sqlite3.c:121514:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3920 /* .xFinalize */)) = totalFinalize // sqlite3.c:121514:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3928 /* .xValue */)) = totalFinalize // sqlite3.c:121514:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3936 /* .xInverse */)) = sumInverse // sqlite3.c:121514:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3984 /* .xSFunc */)) = sumStep // sqlite3.c:121515:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 3992 /* .xFinalize */)) = avgFinalize // sqlite3.c:121515:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4000 /* .xValue */)) = avgFinalize // sqlite3.c:121515:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4008 /* .xInverse */)) = sumInverse // sqlite3.c:121515:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4056 /* .xSFunc */)) = countStep // sqlite3.c:121516:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4064 /* .xFinalize */)) = countFinalize // sqlite3.c:121516:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4072 /* .xValue */)) = countFinalize // sqlite3.c:121516:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4080 /* .xInverse */)) = countInverse // sqlite3.c:121516:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4128 /* .xSFunc */)) = countStep // sqlite3.c:121518:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4136 /* .xFinalize */)) = countFinalize // sqlite3.c:121518:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4144 /* .xValue */)) = countFinalize // sqlite3.c:121518:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4152 /* .xInverse */)) = countInverse // sqlite3.c:121518:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4200 /* .xSFunc */)) = groupConcatStep // sqlite3.c:121520:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4208 /* .xFinalize */)) = groupConcatFinalize // sqlite3.c:121520:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4216 /* .xValue */)) = groupConcatValue // sqlite3.c:121520:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4224 /* .xInverse */)) = groupConcatInverse // sqlite3.c:121520:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4272 /* .xSFunc */)) = groupConcatStep // sqlite3.c:121522:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4280 /* .xFinalize */)) = groupConcatFinalize // sqlite3.c:121522:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4288 /* .xValue */)) = groupConcatValue // sqlite3.c:121522:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4296 /* .xInverse */)) = groupConcatInverse // sqlite3.c:121522:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4328 /* .pUserData */)) = uintptr(unsafe.Pointer(&globInfo)) // sqlite3.c:121525:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4344 /* .xSFunc */)) = likeFunc // sqlite3.c:121525:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4400 /* .pUserData */)) = uintptr(unsafe.Pointer(&likeInfoNorm)) // sqlite3.c:121530:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4416 /* .xSFunc */)) = likeFunc // sqlite3.c:121530:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4472 /* .pUserData */)) = uintptr(unsafe.Pointer(&likeInfoNorm)) // sqlite3.c:121531:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4488 /* .xSFunc */)) = likeFunc // sqlite3.c:121531:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4704 /* .xSFunc */)) = signFunc // sqlite3.c:121574:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4776 /* .xSFunc */)) = versionFunc // sqlite3.c:121575:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aBuiltinFunc)) + 4848 /* .xSFunc */)) = versionFunc // sqlite3.c:121576:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 8 /* .pUserData */)) = uintptr(unsafe.Pointer(&Xsqlite3Config)) // sqlite3.c:23407:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 24 /* .xSFunc */)) = juliandayFunc // sqlite3.c:23407:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 80 /* .pUserData */)) = uintptr(unsafe.Pointer(&Xsqlite3Config)) // sqlite3.c:23408:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 96 /* .xSFunc */)) = dateFunc // sqlite3.c:23408:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 152 /* .pUserData */)) = uintptr(unsafe.Pointer(&Xsqlite3Config)) // sqlite3.c:23409:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 168 /* .xSFunc */)) = timeFunc // sqlite3.c:23409:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 224 /* .pUserData */)) = uintptr(unsafe.Pointer(&Xsqlite3Config)) // sqlite3.c:23410:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 240 /* .xSFunc */)) = datetimeFunc // sqlite3.c:23410:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 296 /* .pUserData */)) = uintptr(unsafe.Pointer(&Xsqlite3Config)) // sqlite3.c:23411:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 312 /* .xSFunc */)) = strftimeFunc // sqlite3.c:23411:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 384 /* .xSFunc */)) = ctimeFunc // sqlite3.c:23412:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 456 /* .xSFunc */)) = ctimestampFunc // sqlite3.c:23413:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aDateTimeFuncs)) + 528 /* .xSFunc */)) = cdateFunc // sqlite3.c:23414:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 16 /* .xFunc */)) = jsonRemoveFunc // sqlite3.c:192183:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 40 /* .xFunc */)) = jsonArrayFunc // sqlite3.c:192184:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 64 /* .xFunc */)) = jsonArrayLengthFunc // sqlite3.c:192185:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 88 /* .xFunc */)) = jsonArrayLengthFunc // sqlite3.c:192186:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 112 /* .xFunc */)) = jsonExtractFunc // sqlite3.c:192187:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 136 /* .xFunc */)) = jsonSetFunc // sqlite3.c:192188:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 160 /* .xFunc */)) = jsonObjectFunc // sqlite3.c:192189:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 184 /* .xFunc */)) = jsonPatchFunc // sqlite3.c:192190:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 208 /* .xFunc */)) = jsonQuoteFunc // sqlite3.c:192191:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 232 /* .xFunc */)) = jsonRemoveFunc // sqlite3.c:192192:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 256 /* .xFunc */)) = jsonReplaceFunc // sqlite3.c:192193:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 280 /* .xFunc */)) = jsonSetFunc // sqlite3.c:192194:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 304 /* .xFunc */)) = jsonTypeFunc // sqlite3.c:192195:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 328 /* .xFunc */)) = jsonTypeFunc // sqlite3.c:192196:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 352 /* .xFunc */)) = jsonValidFunc // sqlite3.c:192197:39: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 0 /* .xFunc */)) = geopolyAreaFunc // sqlite3.c:198417:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 24 /* .xFunc */)) = geopolyBlobFunc // sqlite3.c:198418:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 48 /* .xFunc */)) = geopolyJsonFunc // sqlite3.c:198419:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 72 /* .xFunc */)) = geopolySvgFunc // sqlite3.c:198420:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 96 /* .xFunc */)) = geopolyWithinFunc // sqlite3.c:198421:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 120 /* .xFunc */)) = geopolyContainsPointFunc // sqlite3.c:198422:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 144 /* .xFunc */)) = geopolyOverlapFunc // sqlite3.c:198423:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 168 /* .xFunc */)) = geopolyDebugFunc // sqlite3.c:198424:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 192 /* .xFunc */)) = geopolyBBoxFunc // sqlite3.c:198425:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 216 /* .xFunc */)) = geopolyXformFunc // sqlite3.c:198426:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 240 /* .xFunc */)) = geopolyRegularFunc // sqlite3.c:198427:8: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 264 /* .xFunc */)) = geopolyCcwFunc // sqlite3.c:198428:8: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aMod)) + 8 /* .pModule */)) = uintptr(unsafe.Pointer(&jsonEachModule)) // sqlite3.c:192222:31: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aMod)) + 24 /* .pModule */)) = uintptr(unsafe.Pointer(&jsonTreeModule)) // sqlite3.c:192223:31: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 8 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, int32) int32 + }{posixOpen})) // sqlite3.c:34447:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 32 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{libc.Xclose})) // sqlite3.c:34450:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 56 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32) int32 + }{libc.Xaccess})) // sqlite3.c:34453:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 80 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Size_t) uintptr + }{libc.Xgetcwd})) // sqlite3.c:34456:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 104 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{libc.Xstat})) // sqlite3.c:34459:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 128 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr) int32 + }{libc.Xfstat})) // sqlite3.c:34472:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 152 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, Off_t) int32 + }{libc.Xftruncate})) // sqlite3.c:34476:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 176 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, int32, uintptr) int32 + }{libc.Xfcntl})) // sqlite3.c:34479:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 200 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr, Size_t) Ssize_t + }{libc.Xread})) // sqlite3.c:34482:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 272 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, uintptr, Size_t) Ssize_t + }{libc.Xwrite})) // sqlite3.c:34499:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 344 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, Mode_t) int32 + }{libc.Xfchmod})) // sqlite3.c:34518:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 392 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{libc.Xunlink})) // sqlite3.c:34528:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 416 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{openDirectory})) // sqlite3.c:34531:25: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 440 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Mode_t) int32 + }{libc.Xmkdir})) // sqlite3.c:34534:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 464 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{libc.Xrmdir})) // sqlite3.c:34537:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 488 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, int32, Uid_t, Gid_t) int32 + }{libc.Xfchown})) // sqlite3.c:34541:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 512 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) Uid_t }{libc.Xgeteuid})) // sqlite3.c:34548:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 536 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Size_t, int32, int32, int32, Off_t) uintptr + }{libc.Xmmap})) // sqlite3.c:34555:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 560 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, Size_t) int32 + }{libc.Xmunmap})) // sqlite3.c:34562:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 608 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{unixGetpagesize})) // sqlite3.c:34576:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 632 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t + }{libc.Xreadlink})) // sqlite3.c:34583:21: + *(*Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 656 /* .pCurrent */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr) int32 + }{libc.Xlstat})) // sqlite3.c:34590:22: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 32 /* .pAppData */)) = uintptr(unsafe.Pointer(&posixIoFinder)) // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 40 /* .xOpen */)) = unixOpen // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 48 /* .xDelete */)) = unixDelete // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 56 /* .xAccess */)) = unixAccess // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 64 /* .xFullPathname */)) = unixFullPathname // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 72 /* .xDlOpen */)) = unixDlOpen // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 80 /* .xDlError */)) = unixDlError // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 88 /* .xDlSym */)) = unixDlSym // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 96 /* .xDlClose */)) = unixDlClose // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 104 /* .xRandomness */)) = unixRandomness // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 112 /* .xSleep */)) = unixSleep // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 120 /* .xCurrentTime */)) = unixCurrentTime // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 128 /* .xGetLastError */)) = unixGetLastError // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 136 /* .xCurrentTimeInt64 */)) = unixCurrentTimeInt64 // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 144 /* .xSetSystemCall */)) = unixSetSystemCall // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr) Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 152 /* .xGetSystemCall */)) = unixGetSystemCall // sqlite3.c:42097:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 160 /* .xNextSystemCall */)) = unixNextSystemCall // sqlite3.c:42097:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 200 /* .pAppData */)) = uintptr(unsafe.Pointer(&nolockIoFinder)) // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 208 /* .xOpen */)) = unixOpen // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 216 /* .xDelete */)) = unixDelete // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 224 /* .xAccess */)) = unixAccess // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 232 /* .xFullPathname */)) = unixFullPathname // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 240 /* .xDlOpen */)) = unixDlOpen // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 248 /* .xDlError */)) = unixDlError // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 256 /* .xDlSym */)) = unixDlSym // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 264 /* .xDlClose */)) = unixDlClose // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 272 /* .xRandomness */)) = unixRandomness // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 280 /* .xSleep */)) = unixSleep // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 288 /* .xCurrentTime */)) = unixCurrentTime // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 296 /* .xGetLastError */)) = unixGetLastError // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 304 /* .xCurrentTimeInt64 */)) = unixCurrentTimeInt64 // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 312 /* .xSetSystemCall */)) = unixSetSystemCall // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr) Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 320 /* .xGetSystemCall */)) = unixGetSystemCall // sqlite3.c:42099:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 328 /* .xNextSystemCall */)) = unixNextSystemCall // sqlite3.c:42099:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 368 /* .pAppData */)) = uintptr(unsafe.Pointer(&dotlockIoFinder)) // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 376 /* .xOpen */)) = unixOpen // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 384 /* .xDelete */)) = unixDelete // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 392 /* .xAccess */)) = unixAccess // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 400 /* .xFullPathname */)) = unixFullPathname // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 408 /* .xDlOpen */)) = unixDlOpen // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 416 /* .xDlError */)) = unixDlError // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 424 /* .xDlSym */)) = unixDlSym // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 432 /* .xDlClose */)) = unixDlClose // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 440 /* .xRandomness */)) = unixRandomness // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 448 /* .xSleep */)) = unixSleep // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 456 /* .xCurrentTime */)) = unixCurrentTime // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 464 /* .xGetLastError */)) = unixGetLastError // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 472 /* .xCurrentTimeInt64 */)) = unixCurrentTimeInt64 // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 480 /* .xSetSystemCall */)) = unixSetSystemCall // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr) Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 488 /* .xGetSystemCall */)) = unixGetSystemCall // sqlite3.c:42100:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 496 /* .xNextSystemCall */)) = unixNextSystemCall // sqlite3.c:42100:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 536 /* .pAppData */)) = uintptr(unsafe.Pointer(&posixIoFinder)) // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 544 /* .xOpen */)) = unixOpen // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 552 /* .xDelete */)) = unixDelete // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 560 /* .xAccess */)) = unixAccess // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 568 /* .xFullPathname */)) = unixFullPathname // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 576 /* .xDlOpen */)) = unixDlOpen // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 584 /* .xDlError */)) = unixDlError // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 592 /* .xDlSym */)) = unixDlSym // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 600 /* .xDlClose */)) = unixDlClose // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 608 /* .xRandomness */)) = unixRandomness // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 616 /* .xSleep */)) = unixSleep // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 624 /* .xCurrentTime */)) = unixCurrentTime // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 632 /* .xGetLastError */)) = unixGetLastError // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 640 /* .xCurrentTimeInt64 */)) = unixCurrentTimeInt64 // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 648 /* .xSetSystemCall */)) = unixSetSystemCall // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr) Sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 656 /* .xGetSystemCall */)) = unixGetSystemCall // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aVfs)) + 664 /* .xNextSystemCall */)) = unixNextSystemCall // sqlite3.c:42101:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 24 /* .xSFunc */)) = row_numberStepFunc // sqlite3.c:155523:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 32 /* .xFinalize */)) = row_numberValueFunc // sqlite3.c:155523:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 40 /* .xValue */)) = row_numberValueFunc // sqlite3.c:155523:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 48 /* .xInverse */)) = noopStepFunc // sqlite3.c:155523:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 56 /* .zName */)) = uintptr(unsafe.Pointer(&row_numberName)) // sqlite3.c:155523:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 96 /* .xSFunc */)) = dense_rankStepFunc // sqlite3.c:155524:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 104 /* .xFinalize */)) = dense_rankValueFunc // sqlite3.c:155524:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 112 /* .xValue */)) = dense_rankValueFunc // sqlite3.c:155524:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 120 /* .xInverse */)) = noopStepFunc // sqlite3.c:155524:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 128 /* .zName */)) = uintptr(unsafe.Pointer(&dense_rankName)) // sqlite3.c:155524:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 168 /* .xSFunc */)) = rankStepFunc // sqlite3.c:155525:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 176 /* .xFinalize */)) = rankValueFunc // sqlite3.c:155525:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 184 /* .xValue */)) = rankValueFunc // sqlite3.c:155525:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 192 /* .xInverse */)) = noopStepFunc // sqlite3.c:155525:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 200 /* .zName */)) = uintptr(unsafe.Pointer(&rankName)) // sqlite3.c:155525:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 240 /* .xSFunc */)) = percent_rankStepFunc // sqlite3.c:155526:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 248 /* .xFinalize */)) = percent_rankValueFunc // sqlite3.c:155526:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 256 /* .xValue */)) = percent_rankValueFunc // sqlite3.c:155526:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 264 /* .xInverse */)) = percent_rankInvFunc // sqlite3.c:155526:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 272 /* .zName */)) = uintptr(unsafe.Pointer(&percent_rankName)) // sqlite3.c:155526:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 312 /* .xSFunc */)) = cume_distStepFunc // sqlite3.c:155527:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 320 /* .xFinalize */)) = cume_distValueFunc // sqlite3.c:155527:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 328 /* .xValue */)) = cume_distValueFunc // sqlite3.c:155527:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 336 /* .xInverse */)) = cume_distInvFunc // sqlite3.c:155527:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 344 /* .zName */)) = uintptr(unsafe.Pointer(&cume_distName)) // sqlite3.c:155527:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 384 /* .xSFunc */)) = ntileStepFunc // sqlite3.c:155528:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 392 /* .xFinalize */)) = ntileValueFunc // sqlite3.c:155528:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 400 /* .xValue */)) = ntileValueFunc // sqlite3.c:155528:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 408 /* .xInverse */)) = ntileInvFunc // sqlite3.c:155528:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 416 /* .zName */)) = uintptr(unsafe.Pointer(&ntileName)) // sqlite3.c:155528:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 456 /* .xSFunc */)) = last_valueStepFunc // sqlite3.c:155529:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 464 /* .xFinalize */)) = last_valueFinalizeFunc // sqlite3.c:155529:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 472 /* .xValue */)) = last_valueValueFunc // sqlite3.c:155529:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 480 /* .xInverse */)) = last_valueInvFunc // sqlite3.c:155529:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 488 /* .zName */)) = uintptr(unsafe.Pointer(&last_valueName)) // sqlite3.c:155529:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 528 /* .xSFunc */)) = nth_valueStepFunc // sqlite3.c:155530:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 536 /* .xFinalize */)) = nth_valueFinalizeFunc // sqlite3.c:155530:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 544 /* .xValue */)) = noopValueFunc // sqlite3.c:155530:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 552 /* .xInverse */)) = noopStepFunc // sqlite3.c:155530:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 560 /* .zName */)) = uintptr(unsafe.Pointer(&nth_valueName)) // sqlite3.c:155530:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 600 /* .xSFunc */)) = first_valueStepFunc // sqlite3.c:155531:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 608 /* .xFinalize */)) = first_valueFinalizeFunc // sqlite3.c:155531:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 616 /* .xValue */)) = noopValueFunc // sqlite3.c:155531:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 624 /* .xInverse */)) = noopStepFunc // sqlite3.c:155531:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 632 /* .zName */)) = uintptr(unsafe.Pointer(&first_valueName)) // sqlite3.c:155531:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 672 /* .xSFunc */)) = noopStepFunc // sqlite3.c:155532:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 680 /* .xFinalize */)) = noopValueFunc // sqlite3.c:155532:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 688 /* .xValue */)) = noopValueFunc // sqlite3.c:155532:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 696 /* .xInverse */)) = noopStepFunc // sqlite3.c:155532:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 704 /* .zName */)) = uintptr(unsafe.Pointer(&leadName)) // sqlite3.c:155532:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 744 /* .xSFunc */)) = noopStepFunc // sqlite3.c:155533:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 752 /* .xFinalize */)) = noopValueFunc // sqlite3.c:155533:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 760 /* .xValue */)) = noopValueFunc // sqlite3.c:155533:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 768 /* .xInverse */)) = noopStepFunc // sqlite3.c:155533:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 776 /* .zName */)) = uintptr(unsafe.Pointer(&leadName)) // sqlite3.c:155533:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 816 /* .xSFunc */)) = noopStepFunc // sqlite3.c:155534:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 824 /* .xFinalize */)) = noopValueFunc // sqlite3.c:155534:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 832 /* .xValue */)) = noopValueFunc // sqlite3.c:155534:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 840 /* .xInverse */)) = noopStepFunc // sqlite3.c:155534:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 848 /* .zName */)) = uintptr(unsafe.Pointer(&leadName)) // sqlite3.c:155534:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 888 /* .xSFunc */)) = noopStepFunc // sqlite3.c:155535:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 896 /* .xFinalize */)) = noopValueFunc // sqlite3.c:155535:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 904 /* .xValue */)) = noopValueFunc // sqlite3.c:155535:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 912 /* .xInverse */)) = noopStepFunc // sqlite3.c:155535:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 920 /* .zName */)) = uintptr(unsafe.Pointer(&lagName)) // sqlite3.c:155535:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 960 /* .xSFunc */)) = noopStepFunc // sqlite3.c:155536:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 968 /* .xFinalize */)) = noopValueFunc // sqlite3.c:155536:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 976 /* .xValue */)) = noopValueFunc // sqlite3.c:155536:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 984 /* .xInverse */)) = noopStepFunc // sqlite3.c:155536:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 992 /* .zName */)) = uintptr(unsafe.Pointer(&lagName)) // sqlite3.c:155536:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 1032 /* .xSFunc */)) = noopStepFunc // sqlite3.c:155537:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 1040 /* .xFinalize */)) = noopValueFunc // sqlite3.c:155537:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 1048 /* .xValue */)) = noopValueFunc // sqlite3.c:155537:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 1056 /* .xInverse */)) = noopStepFunc // sqlite3.c:155537:5: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aWindowFuncs)) + 1064 /* .zName */)) = uintptr(unsafe.Pointer(&lagName)) // sqlite3.c:155537:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&attach_func)) + 24 /* .xSFunc */)) = attachFunc // sqlite3.c:111969:5: + *(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 0 /* .xMalloc */)) = sqlite3MemMalloc // sqlite3.c:24299:6: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 8 /* .xFree */)) = sqlite3MemFree // sqlite3.c:24300:6: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 16 /* .xRealloc */)) = sqlite3MemRealloc // sqlite3.c:24301:6: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 24 /* .xSize */)) = sqlite3MemSize // sqlite3.c:24302:6: + *(*func(*libc.TLS, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 32 /* .xRoundup */)) = sqlite3MemRoundup // sqlite3.c:24303:6: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 40 /* .xInit */)) = sqlite3MemInit // sqlite3.c:24304:6: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods)) + 48 /* .xShutdown */)) = sqlite3MemShutdown // sqlite3.c:24305:6: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 16 /* .xInit */)) = pcache1Init // sqlite3.c:51891:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 24 /* .xShutdown */)) = pcache1Shutdown // sqlite3.c:51892:5: + *(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 32 /* .xCreate */)) = pcache1Create // sqlite3.c:51893:5: + *(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 40 /* .xCachesize */)) = pcache1Cachesize // sqlite3.c:51894:5: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 48 /* .xPagecount */)) = pcache1Pagecount // sqlite3.c:51895:5: + *(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 56 /* .xFetch */)) = pcache1Fetch // sqlite3.c:51896:5: + *(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 64 /* .xUnpin */)) = pcache1Unpin // sqlite3.c:51897:5: + *(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 72 /* .xRekey */)) = pcache1Rekey // sqlite3.c:51898:5: + *(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 80 /* .xTruncate */)) = pcache1Truncate // sqlite3.c:51899:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 88 /* .xDestroy */)) = pcache1Destroy // sqlite3.c:51900:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&defaultMethods1)) + 96 /* .xShrink */)) = pcache1Shrink // sqlite3.c:51901:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&detach_func)) + 24 /* .xSFunc */)) = detachFunc // sqlite3.c:111949:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoFinder)) + 0)) = dotlockIoFinderImpl // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 8 /* .xClose */)) = dotlockClose // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 16 /* .xRead */)) = unixRead // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 24 /* .xWrite */)) = unixWrite // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, I64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 32 /* .xTruncate */)) = unixTruncate // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 40 /* .xSync */)) = unixSync // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 48 /* .xFileSize */)) = unixFileSize // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 56 /* .xLock */)) = dotlockLock // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 64 /* .xUnlock */)) = dotlockUnlock // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 72 /* .xCheckReservedLock */)) = dotlockCheckReservedLock // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 80 /* .xFileControl */)) = unixFileControl // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 88 /* .xSectorSize */)) = unixSectorSize // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 96 /* .xDeviceCharacteristics */)) = unixDeviceCharacteristics // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 112 /* .xShmLock */)) = unixShmLock // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 120 /* .xShmBarrier */)) = unixShmBarrier // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 128 /* .xShmUnmap */)) = unixShmUnmap // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, I64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 136 /* .xFetch */)) = unixFetch // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, I64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&dotlockIoMethods)) + 144 /* .xUnfetch */)) = unixUnfetch // sqlite3.c:39472:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 8 /* .xCreate */)) = fts5CreateMethod // sqlite3.c:230606:25: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 16 /* .xConnect */)) = fts5ConnectMethod // sqlite3.c:230607:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 24 /* .xBestIndex */)) = fts5BestIndexMethod // sqlite3.c:230608:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 32 /* .xDisconnect */)) = fts5DisconnectMethod // sqlite3.c:230609:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 40 /* .xDestroy */)) = fts5DestroyMethod // sqlite3.c:230610:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 48 /* .xOpen */)) = fts5OpenMethod // sqlite3.c:230611:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 56 /* .xClose */)) = fts5CloseMethod // sqlite3.c:230612:25: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 64 /* .xFilter */)) = fts5FilterMethod // sqlite3.c:230613:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 72 /* .xNext */)) = fts5NextMethod // sqlite3.c:230614:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 80 /* .xEof */)) = fts5EofMethod // sqlite3.c:230615:25: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 88 /* .xColumn */)) = fts5ColumnMethod // sqlite3.c:230616:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 96 /* .xRowid */)) = fts5RowidMethod // sqlite3.c:230617:25: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 104 /* .xUpdate */)) = fts5UpdateMethod // sqlite3.c:230618:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 112 /* .xBegin */)) = fts5BeginMethod // sqlite3.c:230619:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 120 /* .xSync */)) = fts5SyncMethod // sqlite3.c:230620:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 128 /* .xCommit */)) = fts5CommitMethod // sqlite3.c:230621:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 136 /* .xRollback */)) = fts5RollbackMethod // sqlite3.c:230622:25: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 144 /* .xFindFunction */)) = fts5FindFunctionMethod // sqlite3.c:230623:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 152 /* .xRename */)) = fts5RenameMethod // sqlite3.c:230624:25: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 160 /* .xSavepoint */)) = fts5SavepointMethod // sqlite3.c:230625:25: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 168 /* .xRelease */)) = fts5ReleaseMethod // sqlite3.c:230626:25: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 176 /* .xRollbackTo */)) = fts5RollbackToMethod // sqlite3.c:230627:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Mod)) + 184 /* .xShadowName */)) = fts5ShadowName // sqlite3.c:230628:25: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 8 /* .xCreate */)) = fts5VocabCreateMethod // sqlite3.c:235174:25: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 16 /* .xConnect */)) = fts5VocabConnectMethod // sqlite3.c:235175:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 24 /* .xBestIndex */)) = fts5VocabBestIndexMethod // sqlite3.c:235176:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 32 /* .xDisconnect */)) = fts5VocabDisconnectMethod // sqlite3.c:235177:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 40 /* .xDestroy */)) = fts5VocabDestroyMethod // sqlite3.c:235178:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 48 /* .xOpen */)) = fts5VocabOpenMethod // sqlite3.c:235179:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 56 /* .xClose */)) = fts5VocabCloseMethod // sqlite3.c:235180:25: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 64 /* .xFilter */)) = fts5VocabFilterMethod // sqlite3.c:235181:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 72 /* .xNext */)) = fts5VocabNextMethod // sqlite3.c:235182:25: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 80 /* .xEof */)) = fts5VocabEofMethod // sqlite3.c:235183:25: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 88 /* .xColumn */)) = fts5VocabColumnMethod // sqlite3.c:235184:25: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5Vocab)) + 96 /* .xRowid */)) = fts5VocabRowidMethod // sqlite3.c:235185:25: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 8 /* .xCreate */)) = geopolyCreate // sqlite3.c:198384:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 16 /* .xConnect */)) = geopolyConnect // sqlite3.c:198385:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 24 /* .xBestIndex */)) = geopolyBestIndex // sqlite3.c:198386:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 32 /* .xDisconnect */)) = rtreeDisconnect // sqlite3.c:198387:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 40 /* .xDestroy */)) = rtreeDestroy // sqlite3.c:198388:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 48 /* .xOpen */)) = rtreeOpen // sqlite3.c:198389:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 56 /* .xClose */)) = rtreeClose // sqlite3.c:198390:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 64 /* .xFilter */)) = geopolyFilter // sqlite3.c:198391:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 72 /* .xNext */)) = rtreeNext // sqlite3.c:198392:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 80 /* .xEof */)) = rtreeEof // sqlite3.c:198393:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 88 /* .xColumn */)) = geopolyColumn // sqlite3.c:198394:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 96 /* .xRowid */)) = rtreeRowid // sqlite3.c:198395:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 104 /* .xUpdate */)) = geopolyUpdate // sqlite3.c:198396:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 112 /* .xBegin */)) = rtreeBeginTransaction // sqlite3.c:198397:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 120 /* .xSync */)) = rtreeEndTransaction // sqlite3.c:198398:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 128 /* .xCommit */)) = rtreeEndTransaction // sqlite3.c:198399:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 136 /* .xRollback */)) = rtreeEndTransaction // sqlite3.c:198400:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 144 /* .xFindFunction */)) = geopolyFindFunction // sqlite3.c:198401:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 152 /* .xRename */)) = rtreeRename // sqlite3.c:198402:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 160 /* .xSavepoint */)) = rtreeSavepoint // sqlite3.c:198403:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&geopolyModule)) + 184 /* .xShadowName */)) = rtreeShadowName // sqlite3.c:198406:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 16 /* .xConnect */)) = jsonEachConnect // sqlite3.c:192115:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 24 /* .xBestIndex */)) = jsonEachBestIndex // sqlite3.c:192116:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 32 /* .xDisconnect */)) = jsonEachDisconnect // sqlite3.c:192117:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 48 /* .xOpen */)) = jsonEachOpenEach // sqlite3.c:192119:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 56 /* .xClose */)) = jsonEachClose // sqlite3.c:192120:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 64 /* .xFilter */)) = jsonEachFilter // sqlite3.c:192121:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 72 /* .xNext */)) = jsonEachNext // sqlite3.c:192122:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 80 /* .xEof */)) = jsonEachEof // sqlite3.c:192123:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 88 /* .xColumn */)) = jsonEachColumn // sqlite3.c:192124:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonEachModule)) + 96 /* .xRowid */)) = jsonEachRowid // sqlite3.c:192125:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 16 /* .xConnect */)) = jsonEachConnect // sqlite3.c:192143:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 24 /* .xBestIndex */)) = jsonEachBestIndex // sqlite3.c:192144:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 32 /* .xDisconnect */)) = jsonEachDisconnect // sqlite3.c:192145:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 48 /* .xOpen */)) = jsonEachOpenTree // sqlite3.c:192147:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 56 /* .xClose */)) = jsonEachClose // sqlite3.c:192148:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 64 /* .xFilter */)) = jsonEachFilter // sqlite3.c:192149:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 72 /* .xNext */)) = jsonEachNext // sqlite3.c:192150:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 80 /* .xEof */)) = jsonEachEof // sqlite3.c:192151:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 88 /* .xColumn */)) = jsonEachColumn // sqlite3.c:192152:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jsonTreeModule)) + 96 /* .xRowid */)) = jsonEachRowid // sqlite3.c:192153:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 8 /* .xClose */)) = memdbClose // sqlite3.c:48683:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 16 /* .xRead */)) = memdbRead // sqlite3.c:48684:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 24 /* .xWrite */)) = memdbWrite // sqlite3.c:48685:3: + *(*func(*libc.TLS, uintptr, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 32 /* .xTruncate */)) = memdbTruncate // sqlite3.c:48686:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 40 /* .xSync */)) = memdbSync // sqlite3.c:48687:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 48 /* .xFileSize */)) = memdbFileSize // sqlite3.c:48688:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 56 /* .xLock */)) = memdbLock // sqlite3.c:48689:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 64 /* .xUnlock */)) = memdbLock // sqlite3.c:48690:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 80 /* .xFileControl */)) = memdbFileControl // sqlite3.c:48692:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 96 /* .xDeviceCharacteristics */)) = memdbDeviceCharacteristics // sqlite3.c:48694:3: + *(*func(*libc.TLS, uintptr, Sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 136 /* .xFetch */)) = memdbFetch // sqlite3.c:48699:3: + *(*func(*libc.TLS, uintptr, Sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_io_methods)) + 144 /* .xUnfetch */)) = memdbUnfetch // sqlite3.c:48700:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 40 /* .xOpen */)) = memdbOpen // sqlite3.c:48663:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 56 /* .xAccess */)) = memdbAccess // sqlite3.c:48665:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 64 /* .xFullPathname */)) = memdbFullPathname // sqlite3.c:48666:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 72 /* .xDlOpen */)) = memdbDlOpen // sqlite3.c:48667:3: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 80 /* .xDlError */)) = memdbDlError // sqlite3.c:48668:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 88 /* .xDlSym */)) = memdbDlSym // sqlite3.c:48669:3: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 96 /* .xDlClose */)) = memdbDlClose // sqlite3.c:48670:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 104 /* .xRandomness */)) = memdbRandomness // sqlite3.c:48671:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 112 /* .xSleep */)) = memdbSleep // sqlite3.c:48672:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 128 /* .xGetLastError */)) = memdbGetLastError // sqlite3.c:48674:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&memdb_vfs)) + 136 /* .xCurrentTimeInt64 */)) = memdbCurrentTimeInt64 // sqlite3.c:48675:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoFinder)) + 0)) = nolockIoFinderImpl // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 8 /* .xClose */)) = nolockClose // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 16 /* .xRead */)) = unixRead // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 24 /* .xWrite */)) = unixWrite // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, I64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 32 /* .xTruncate */)) = unixTruncate // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 40 /* .xSync */)) = unixSync // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 48 /* .xFileSize */)) = unixFileSize // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 56 /* .xLock */)) = nolockLock // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 64 /* .xUnlock */)) = nolockUnlock // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 72 /* .xCheckReservedLock */)) = nolockCheckReservedLock // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 80 /* .xFileControl */)) = unixFileControl // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 88 /* .xSectorSize */)) = unixSectorSize // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 96 /* .xDeviceCharacteristics */)) = unixDeviceCharacteristics // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 112 /* .xShmLock */)) = unixShmLock // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 120 /* .xShmBarrier */)) = unixShmBarrier // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 128 /* .xShmUnmap */)) = unixShmUnmap // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, I64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 136 /* .xFetch */)) = unixFetch // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, I64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&nolockIoMethods)) + 144 /* .xUnfetch */)) = unixUnfetch // sqlite3.c:39462:1: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoFinder)) + 0)) = posixIoFinderImpl // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 8 /* .xClose */)) = unixClose // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 16 /* .xRead */)) = unixRead // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 24 /* .xWrite */)) = unixWrite // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, I64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 32 /* .xTruncate */)) = unixTruncate // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 40 /* .xSync */)) = unixSync // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 48 /* .xFileSize */)) = unixFileSize // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 56 /* .xLock */)) = unixLock // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 64 /* .xUnlock */)) = unixUnlock // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 72 /* .xCheckReservedLock */)) = unixCheckReservedLock // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 80 /* .xFileControl */)) = unixFileControl // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 88 /* .xSectorSize */)) = unixSectorSize // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 96 /* .xDeviceCharacteristics */)) = unixDeviceCharacteristics // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 104 /* .xShmMap */)) = unixShmMap // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 112 /* .xShmLock */)) = unixShmLock // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 120 /* .xShmBarrier */)) = unixShmBarrier // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 128 /* .xShmUnmap */)) = unixShmUnmap // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, I64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 136 /* .xFetch */)) = unixFetch // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, I64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&posixIoMethods)) + 144 /* .xUnfetch */)) = unixUnfetch // sqlite3.c:39452:1: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 16 /* .xConnect */)) = pragmaVtabConnect // sqlite3.c:131005:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 24 /* .xBestIndex */)) = pragmaVtabBestIndex // sqlite3.c:131006:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 32 /* .xDisconnect */)) = pragmaVtabDisconnect // sqlite3.c:131007:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 48 /* .xOpen */)) = pragmaVtabOpen // sqlite3.c:131009:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 56 /* .xClose */)) = pragmaVtabClose // sqlite3.c:131010:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 64 /* .xFilter */)) = pragmaVtabFilter // sqlite3.c:131011:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 72 /* .xNext */)) = pragmaVtabNext // sqlite3.c:131012:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 80 /* .xEof */)) = pragmaVtabEof // sqlite3.c:131013:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 88 /* .xColumn */)) = pragmaVtabColumn // sqlite3.c:131014:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&pragmaVtabModule)) + 96 /* .xRowid */)) = pragmaVtabRowid // sqlite3.c:131015:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 8 /* .xClose */)) = rbuVfsClose // sqlite3.c:205026:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 16 /* .xRead */)) = rbuVfsRead // sqlite3.c:205027:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 24 /* .xWrite */)) = rbuVfsWrite // sqlite3.c:205028:5: + *(*func(*libc.TLS, uintptr, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 32 /* .xTruncate */)) = rbuVfsTruncate // sqlite3.c:205029:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 40 /* .xSync */)) = rbuVfsSync // sqlite3.c:205030:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 48 /* .xFileSize */)) = rbuVfsFileSize // sqlite3.c:205031:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 56 /* .xLock */)) = rbuVfsLock // sqlite3.c:205032:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 64 /* .xUnlock */)) = rbuVfsUnlock // sqlite3.c:205033:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 72 /* .xCheckReservedLock */)) = rbuVfsCheckReservedLock // sqlite3.c:205034:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 80 /* .xFileControl */)) = rbuVfsFileControl // sqlite3.c:205035:5: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 88 /* .xSectorSize */)) = rbuVfsSectorSize // sqlite3.c:205036:5: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 96 /* .xDeviceCharacteristics */)) = rbuVfsDeviceCharacteristics // sqlite3.c:205037:5: + *(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 104 /* .xShmMap */)) = rbuVfsShmMap // sqlite3.c:205038:5: + *(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 112 /* .xShmLock */)) = rbuVfsShmLock // sqlite3.c:205039:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 120 /* .xShmBarrier */)) = rbuVfsShmBarrier // sqlite3.c:205040:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rbuvfs_io_methods)) + 128 /* .xShmUnmap */)) = rbuVfsShmUnmap // sqlite3.c:205041:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 8 /* .xCreate */)) = rtreeCreate // sqlite3.c:195728:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 16 /* .xConnect */)) = rtreeConnect // sqlite3.c:195729:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 24 /* .xBestIndex */)) = rtreeBestIndex // sqlite3.c:195730:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 32 /* .xDisconnect */)) = rtreeDisconnect // sqlite3.c:195731:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 40 /* .xDestroy */)) = rtreeDestroy // sqlite3.c:195732:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 48 /* .xOpen */)) = rtreeOpen // sqlite3.c:195733:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 56 /* .xClose */)) = rtreeClose // sqlite3.c:195734:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 64 /* .xFilter */)) = rtreeFilter // sqlite3.c:195735:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 72 /* .xNext */)) = rtreeNext // sqlite3.c:195736:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 80 /* .xEof */)) = rtreeEof // sqlite3.c:195737:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 88 /* .xColumn */)) = rtreeColumn // sqlite3.c:195738:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 96 /* .xRowid */)) = rtreeRowid // sqlite3.c:195739:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 104 /* .xUpdate */)) = rtreeUpdate // sqlite3.c:195740:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 112 /* .xBegin */)) = rtreeBeginTransaction // sqlite3.c:195741:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 120 /* .xSync */)) = rtreeEndTransaction // sqlite3.c:195742:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 128 /* .xCommit */)) = rtreeEndTransaction // sqlite3.c:195743:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 136 /* .xRollback */)) = rtreeEndTransaction // sqlite3.c:195744:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 152 /* .xRename */)) = rtreeRename // sqlite3.c:195746:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 160 /* .xSavepoint */)) = rtreeSavepoint // sqlite3.c:195747:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&rtreeModule)) + 184 /* .xShadowName */)) = rtreeShadowName // sqlite3.c:195750:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 8 /* .xUserData */)) = fts5ApiUserData // sqlite3.c:230065:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 16 /* .xColumnCount */)) = fts5ApiColumnCount // sqlite3.c:230066:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 24 /* .xRowCount */)) = fts5ApiRowCount // sqlite3.c:230067:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 32 /* .xColumnTotalSize */)) = fts5ApiColumnTotalSize // sqlite3.c:230068:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 40 /* .xTokenize */)) = fts5ApiTokenize // sqlite3.c:230069:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 48 /* .xPhraseCount */)) = fts5ApiPhraseCount // sqlite3.c:230070:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 56 /* .xPhraseSize */)) = fts5ApiPhraseSize // sqlite3.c:230071:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 64 /* .xInstCount */)) = fts5ApiInstCount // sqlite3.c:230072:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 72 /* .xInst */)) = fts5ApiInst // sqlite3.c:230073:3: + *(*func(*libc.TLS, uintptr) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 80 /* .xRowid */)) = fts5ApiRowid // sqlite3.c:230074:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 88 /* .xColumnText */)) = fts5ApiColumnText // sqlite3.c:230075:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 96 /* .xColumnSize */)) = fts5ApiColumnSize // sqlite3.c:230076:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 104 /* .xQueryPhrase */)) = fts5ApiQueryPhrase // sqlite3.c:230077:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 112 /* .xSetAuxdata */)) = fts5ApiSetAuxdata // sqlite3.c:230078:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 120 /* .xGetAuxdata */)) = fts5ApiGetAuxdata // sqlite3.c:230079:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 128 /* .xPhraseFirst */)) = fts5ApiPhraseFirst // sqlite3.c:230080:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 136 /* .xPhraseNext */)) = fts5ApiPhraseNext // sqlite3.c:230081:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 144 /* .xPhraseFirstColumn */)) = fts5ApiPhraseFirstColumn // sqlite3.c:230082:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sFts5Api)) + 152 /* .xPhraseNextColumn */)) = fts5ApiPhraseNextColumn // sqlite3.c:230083:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMemJournalMethods)) + 8 /* .xClose */)) = memjrnlClose // sqlite3.c:98830:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMemJournalMethods)) + 16 /* .xRead */)) = memjrnlRead // sqlite3.c:98831:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMemJournalMethods)) + 24 /* .xWrite */)) = memjrnlWrite // sqlite3.c:98832:3: + *(*func(*libc.TLS, uintptr, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMemJournalMethods)) + 32 /* .xTruncate */)) = memjrnlTruncate // sqlite3.c:98833:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMemJournalMethods)) + 40 /* .xSync */)) = memjrnlSync // sqlite3.c:98834:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMemJournalMethods)) + 48 /* .xFileSize */)) = memjrnlFileSize // sqlite3.c:98835:3: + *(*func(*libc.TLS) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 0 /* .xMutexInit */)) = noopMutexInit // sqlite3.c:26532:5: + *(*func(*libc.TLS) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 8 /* .xMutexEnd */)) = noopMutexEnd // sqlite3.c:26533:5: + *(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 16 /* .xMutexAlloc */)) = noopMutexAlloc // sqlite3.c:26534:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 24 /* .xMutexFree */)) = noopMutexFree // sqlite3.c:26535:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 32 /* .xMutexEnter */)) = noopMutexEnter // sqlite3.c:26536:5: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 40 /* .xMutexTry */)) = noopMutexTry // sqlite3.c:26537:5: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sMutex)) + 48 /* .xMutexLeave */)) = noopMutexLeave // sqlite3.c:26538:5: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 0 /* .aggregate_context */)) = Xsqlite3_aggregate_context // sqlite3.c:127068:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 8 /* .aggregate_count */)) = Xsqlite3_aggregate_count // sqlite3.c:127070:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 16 /* .bind_blob */)) = Xsqlite3_bind_blob // sqlite3.c:127074:3: + *(*func(*libc.TLS, uintptr, int32, float64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 24 /* .bind_double */)) = Xsqlite3_bind_double // sqlite3.c:127075:3: + *(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 32 /* .bind_int */)) = Xsqlite3_bind_int // sqlite3.c:127076:3: + *(*func(*libc.TLS, uintptr, int32, Sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 40 /* .bind_int64 */)) = Xsqlite3_bind_int64 // sqlite3.c:127077:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 48 /* .bind_null */)) = Xsqlite3_bind_null // sqlite3.c:127078:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 56 /* .bind_parameter_count */)) = Xsqlite3_bind_parameter_count // sqlite3.c:127079:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 64 /* .bind_parameter_index */)) = Xsqlite3_bind_parameter_index // sqlite3.c:127080:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 72 /* .bind_parameter_name */)) = Xsqlite3_bind_parameter_name // sqlite3.c:127081:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 80 /* .bind_text */)) = Xsqlite3_bind_text // sqlite3.c:127082:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 88 /* .bind_text16 */)) = Xsqlite3_bind_text16 // sqlite3.c:127083:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 96 /* .bind_value */)) = Xsqlite3_bind_value // sqlite3.c:127084:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 104 /* .busy_handler */)) = Xsqlite3_busy_handler // sqlite3.c:127085:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 112 /* .busy_timeout */)) = Xsqlite3_busy_timeout // sqlite3.c:127086:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 120 /* .changes */)) = Xsqlite3_changes // sqlite3.c:127087:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 128 /* .close */)) = Xsqlite3_close // sqlite3.c:127088:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 136 /* .collation_needed */)) = Xsqlite3_collation_needed // sqlite3.c:127089:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 144 /* .collation_needed16 */)) = Xsqlite3_collation_needed16 // sqlite3.c:127090:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 152 /* .column_blob */)) = Xsqlite3_column_blob // sqlite3.c:127091:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 160 /* .column_bytes */)) = Xsqlite3_column_bytes // sqlite3.c:127092:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 168 /* .column_bytes16 */)) = Xsqlite3_column_bytes16 // sqlite3.c:127093:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 176 /* .column_count */)) = Xsqlite3_column_count // sqlite3.c:127094:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 184 /* .column_database_name */)) = Xsqlite3_column_database_name // sqlite3.c:127095:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 192 /* .column_database_name16 */)) = Xsqlite3_column_database_name16 // sqlite3.c:127096:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 200 /* .column_decltype */)) = Xsqlite3_column_decltype // sqlite3.c:127097:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 208 /* .column_decltype16 */)) = Xsqlite3_column_decltype16 // sqlite3.c:127098:3: + *(*func(*libc.TLS, uintptr, int32) float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 216 /* .column_double */)) = Xsqlite3_column_double // sqlite3.c:127099:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 224 /* .column_int */)) = Xsqlite3_column_int // sqlite3.c:127100:3: + *(*func(*libc.TLS, uintptr, int32) Sqlite_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 232 /* .column_int64 */)) = Xsqlite3_column_int64 // sqlite3.c:127101:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 240 /* .column_name */)) = Xsqlite3_column_name // sqlite3.c:127102:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 248 /* .column_name16 */)) = Xsqlite3_column_name16 // sqlite3.c:127103:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 256 /* .column_origin_name */)) = Xsqlite3_column_origin_name // sqlite3.c:127104:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 264 /* .column_origin_name16 */)) = Xsqlite3_column_origin_name16 // sqlite3.c:127105:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 272 /* .column_table_name */)) = Xsqlite3_column_table_name // sqlite3.c:127106:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 280 /* .column_table_name16 */)) = Xsqlite3_column_table_name16 // sqlite3.c:127107:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 288 /* .column_text */)) = Xsqlite3_column_text // sqlite3.c:127108:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 296 /* .column_text16 */)) = Xsqlite3_column_text16 // sqlite3.c:127109:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 304 /* .column_type */)) = Xsqlite3_column_type // sqlite3.c:127110:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 312 /* .column_value */)) = Xsqlite3_column_value // sqlite3.c:127111:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 320 /* .commit_hook */)) = Xsqlite3_commit_hook // sqlite3.c:127112:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 328 /* .complete */)) = Xsqlite3_complete // sqlite3.c:127113:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 336 /* .complete16 */)) = Xsqlite3_complete16 // sqlite3.c:127114:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 344 /* .create_collation */)) = Xsqlite3_create_collation // sqlite3.c:127115:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 352 /* .create_collation16 */)) = Xsqlite3_create_collation16 // sqlite3.c:127116:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 360 /* .create_function */)) = Xsqlite3_create_function // sqlite3.c:127117:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 368 /* .create_function16 */)) = Xsqlite3_create_function16 // sqlite3.c:127118:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 376 /* .create_module */)) = Xsqlite3_create_module // sqlite3.c:127119:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 384 /* .data_count */)) = Xsqlite3_data_count // sqlite3.c:127120:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 392 /* .db_handle */)) = Xsqlite3_db_handle // sqlite3.c:127121:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 400 /* .declare_vtab */)) = Xsqlite3_declare_vtab // sqlite3.c:127122:3: + *(*func(*libc.TLS, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 408 /* .enable_shared_cache */)) = Xsqlite3_enable_shared_cache // sqlite3.c:127123:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 416 /* .errcode */)) = Xsqlite3_errcode // sqlite3.c:127124:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 424 /* .errmsg */)) = Xsqlite3_errmsg // sqlite3.c:127125:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 432 /* .errmsg16 */)) = Xsqlite3_errmsg16 // sqlite3.c:127126:3: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_callback, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 440 /* .exec */)) = Xsqlite3_exec // sqlite3.c:127127:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 448 /* .expired */)) = Xsqlite3_expired // sqlite3.c:127129:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 456 /* .finalize */)) = Xsqlite3_finalize // sqlite3.c:127133:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 464 /* .free */)) = Xsqlite3_free // sqlite3.c:127134:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 472 /* .free_table */)) = Xsqlite3_free_table // sqlite3.c:127135:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 480 /* .get_autocommit */)) = Xsqlite3_get_autocommit // sqlite3.c:127136:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 488 /* .get_auxdata */)) = Xsqlite3_get_auxdata // sqlite3.c:127137:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 496 /* .get_table */)) = Xsqlite3_get_table // sqlite3.c:127138:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 512 /* .interruptx */)) = Xsqlite3_interrupt // sqlite3.c:127140:3: + *(*func(*libc.TLS, uintptr) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 520 /* .last_insert_rowid */)) = Xsqlite3_last_insert_rowid // sqlite3.c:127141:3: + *(*func(*libc.TLS) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 528 /* .libversion */)) = Xsqlite3_libversion // sqlite3.c:127142:3: + *(*func(*libc.TLS) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 536 /* .libversion_number */)) = Xsqlite3_libversion_number // sqlite3.c:127143:3: + *(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 544 /* .malloc */)) = Xsqlite3_malloc // sqlite3.c:127144:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 552 /* .mprintf */)) = Xsqlite3_mprintf // sqlite3.c:127145:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 560 /* .open */)) = Xsqlite3_open // sqlite3.c:127146:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 568 /* .open16 */)) = Xsqlite3_open16 // sqlite3.c:127147:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 576 /* .prepare */)) = Xsqlite3_prepare // sqlite3.c:127148:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 584 /* .prepare16 */)) = Xsqlite3_prepare16 // sqlite3.c:127149:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 592 /* .profile */)) = Xsqlite3_profile // sqlite3.c:127150:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 600 /* .progress_handler */)) = Xsqlite3_progress_handler // sqlite3.c:127151:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 608 /* .realloc */)) = Xsqlite3_realloc // sqlite3.c:127152:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 616 /* .reset */)) = Xsqlite3_reset // sqlite3.c:127153:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 624 /* .result_blob */)) = Xsqlite3_result_blob // sqlite3.c:127154:3: + *(*func(*libc.TLS, uintptr, float64))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 632 /* .result_double */)) = Xsqlite3_result_double // sqlite3.c:127155:3: + *(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 640 /* .result_error */)) = Xsqlite3_result_error // sqlite3.c:127156:3: + *(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 648 /* .result_error16 */)) = Xsqlite3_result_error16 // sqlite3.c:127157:3: + *(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 656 /* .result_int */)) = Xsqlite3_result_int // sqlite3.c:127158:3: + *(*func(*libc.TLS, uintptr, I64))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 664 /* .result_int64 */)) = Xsqlite3_result_int64 // sqlite3.c:127159:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 672 /* .result_null */)) = Xsqlite3_result_null // sqlite3.c:127160:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 680 /* .result_text */)) = Xsqlite3_result_text // sqlite3.c:127161:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 688 /* .result_text16 */)) = Xsqlite3_result_text16 // sqlite3.c:127162:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 696 /* .result_text16be */)) = Xsqlite3_result_text16be // sqlite3.c:127163:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 704 /* .result_text16le */)) = Xsqlite3_result_text16le // sqlite3.c:127164:3: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 712 /* .result_value */)) = Xsqlite3_result_value // sqlite3.c:127165:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 720 /* .rollback_hook */)) = Xsqlite3_rollback_hook // sqlite3.c:127166:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 728 /* .set_authorizer */)) = Xsqlite3_set_authorizer // sqlite3.c:127167:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 736 /* .set_auxdata */)) = Xsqlite3_set_auxdata // sqlite3.c:127168:3: + *(*func(*libc.TLS, int32, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 744 /* .xsnprintf */)) = Xsqlite3_snprintf // sqlite3.c:127169:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 752 /* .step */)) = Xsqlite3_step // sqlite3.c:127170:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 760 /* .table_column_metadata */)) = Xsqlite3_table_column_metadata // sqlite3.c:127171:3: + *(*func(*libc.TLS))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 768 /* .thread_cleanup */)) = Xsqlite3_thread_cleanup // sqlite3.c:127173:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 776 /* .total_changes */)) = Xsqlite3_total_changes // sqlite3.c:127177:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 784 /* .trace */)) = Xsqlite3_trace // sqlite3.c:127178:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 792 /* .transfer_bindings */)) = Xsqlite3_transfer_bindings // sqlite3.c:127180:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 800 /* .update_hook */)) = Xsqlite3_update_hook // sqlite3.c:127184:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 808 /* .user_data */)) = Xsqlite3_user_data // sqlite3.c:127185:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 816 /* .value_blob */)) = Xsqlite3_value_blob // sqlite3.c:127186:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 824 /* .value_bytes */)) = Xsqlite3_value_bytes // sqlite3.c:127187:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 832 /* .value_bytes16 */)) = Xsqlite3_value_bytes16 // sqlite3.c:127188:3: + *(*func(*libc.TLS, uintptr) float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 840 /* .value_double */)) = Xsqlite3_value_double // sqlite3.c:127189:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 848 /* .value_int */)) = Xsqlite3_value_int // sqlite3.c:127190:3: + *(*func(*libc.TLS, uintptr) Sqlite_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 856 /* .value_int64 */)) = Xsqlite3_value_int64 // sqlite3.c:127191:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 864 /* .value_numeric_type */)) = Xsqlite3_value_numeric_type // sqlite3.c:127192:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 872 /* .value_text */)) = Xsqlite3_value_text // sqlite3.c:127193:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 880 /* .value_text16 */)) = Xsqlite3_value_text16 // sqlite3.c:127194:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 888 /* .value_text16be */)) = Xsqlite3_value_text16be // sqlite3.c:127195:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 896 /* .value_text16le */)) = Xsqlite3_value_text16le // sqlite3.c:127196:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 904 /* .value_type */)) = Xsqlite3_value_type // sqlite3.c:127197:3: + *(*func(*libc.TLS, uintptr, Va_list) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 912 /* .vmprintf */)) = Xsqlite3_vmprintf // sqlite3.c:127198:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 920 /* .overload_function */)) = Xsqlite3_overload_function // sqlite3.c:127207:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 928 /* .prepare_v2 */)) = Xsqlite3_prepare_v2 // sqlite3.c:127212:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 936 /* .prepare16_v2 */)) = Xsqlite3_prepare16_v2 // sqlite3.c:127213:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 944 /* .clear_bindings */)) = Xsqlite3_clear_bindings // sqlite3.c:127214:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 952 /* .create_module_v2 */)) = Xsqlite3_create_module_v2 // sqlite3.c:127219:3: + *(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 960 /* .bind_zeroblob */)) = Xsqlite3_bind_zeroblob // sqlite3.c:127224:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 968 /* .blob_bytes */)) = Xsqlite3_blob_bytes // sqlite3.c:127225:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 976 /* .blob_close */)) = Xsqlite3_blob_close // sqlite3.c:127226:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, Sqlite_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 984 /* .blob_open */)) = Xsqlite3_blob_open // sqlite3.c:127227:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 992 /* .blob_read */)) = Xsqlite3_blob_read // sqlite3.c:127228:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1000 /* .blob_write */)) = Xsqlite3_blob_write // sqlite3.c:127229:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1008 /* .create_collation_v2 */)) = Xsqlite3_create_collation_v2 // sqlite3.c:127230:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1016 /* .file_control */)) = Xsqlite3_file_control // sqlite3.c:127231:3: + *(*func(*libc.TLS, int32) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1024 /* .memory_highwater */)) = Xsqlite3_memory_highwater // sqlite3.c:127232:3: + *(*func(*libc.TLS) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1032 /* .memory_used */)) = Xsqlite3_memory_used // sqlite3.c:127233:3: + *(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1040 /* .mutex_alloc */)) = Xsqlite3_mutex_alloc // sqlite3.c:127241:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1048 /* .mutex_enter */)) = Xsqlite3_mutex_enter // sqlite3.c:127242:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1056 /* .mutex_free */)) = Xsqlite3_mutex_free // sqlite3.c:127243:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1064 /* .mutex_leave */)) = Xsqlite3_mutex_leave // sqlite3.c:127244:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1072 /* .mutex_try */)) = Xsqlite3_mutex_try // sqlite3.c:127245:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1080 /* .open_v2 */)) = Xsqlite3_open_v2 // sqlite3.c:127247:3: + *(*func(*libc.TLS, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1088 /* .release_memory */)) = Xsqlite3_release_memory // sqlite3.c:127248:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1096 /* .result_error_nomem */)) = Xsqlite3_result_error_nomem // sqlite3.c:127249:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1104 /* .result_error_toobig */)) = Xsqlite3_result_error_toobig // sqlite3.c:127250:3: + *(*func(*libc.TLS, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1112 /* .sleep */)) = Xsqlite3_sleep // sqlite3.c:127251:3: + *(*func(*libc.TLS, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1120 /* .soft_heap_limit */)) = Xsqlite3_soft_heap_limit // sqlite3.c:127252:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1128 /* .vfs_find */)) = Xsqlite3_vfs_find // sqlite3.c:127253:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1136 /* .vfs_register */)) = Xsqlite3_vfs_register // sqlite3.c:127254:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1144 /* .vfs_unregister */)) = Xsqlite3_vfs_unregister // sqlite3.c:127255:3: + *(*func(*libc.TLS) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1152 /* .xthreadsafe */)) = Xsqlite3_threadsafe // sqlite3.c:127260:3: + *(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1160 /* .result_zeroblob */)) = Xsqlite3_result_zeroblob // sqlite3.c:127261:3: + *(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1168 /* .result_error_code */)) = Xsqlite3_result_error_code // sqlite3.c:127262:3: + *(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1176 /* .test_control */)) = Xsqlite3_test_control // sqlite3.c:127263:3: + *(*func(*libc.TLS, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1184 /* .randomness */)) = Xsqlite3_randomness // sqlite3.c:127264:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1192 /* .context_db_handle */)) = Xsqlite3_context_db_handle // sqlite3.c:127265:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1200 /* .extended_result_codes */)) = Xsqlite3_extended_result_codes // sqlite3.c:127270:3: + *(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1208 /* .limit */)) = Xsqlite3_limit // sqlite3.c:127271:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1216 /* .next_stmt */)) = Xsqlite3_next_stmt // sqlite3.c:127272:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1224 /* .sql */)) = Xsqlite3_sql // sqlite3.c:127273:3: + *(*func(*libc.TLS, int32, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1232 /* .status */)) = Xsqlite3_status // sqlite3.c:127274:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1240 /* .backup_finish */)) = Xsqlite3_backup_finish // sqlite3.c:127279:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1248 /* .backup_init */)) = Xsqlite3_backup_init // sqlite3.c:127280:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1256 /* .backup_pagecount */)) = Xsqlite3_backup_pagecount // sqlite3.c:127281:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1264 /* .backup_remaining */)) = Xsqlite3_backup_remaining // sqlite3.c:127282:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1272 /* .backup_step */)) = Xsqlite3_backup_step // sqlite3.c:127283:3: + *(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1280 /* .compileoption_get */)) = Xsqlite3_compileoption_get // sqlite3.c:127285:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1288 /* .compileoption_used */)) = Xsqlite3_compileoption_used // sqlite3.c:127286:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, int32, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1296 /* .create_function_v2 */)) = Xsqlite3_create_function_v2 // sqlite3.c:127291:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1304 /* .db_config */)) = Xsqlite3_db_config // sqlite3.c:127292:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1312 /* .db_mutex */)) = Xsqlite3_db_mutex // sqlite3.c:127293:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1320 /* .db_status */)) = Xsqlite3_db_status // sqlite3.c:127294:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1328 /* .extended_errcode */)) = Xsqlite3_extended_errcode // sqlite3.c:127295:3: + *(*func(*libc.TLS, int32, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1336 /* .log */)) = Xsqlite3_log // sqlite3.c:127296:3: + *(*func(*libc.TLS, Sqlite3_int64) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1344 /* .soft_heap_limit64 */)) = Xsqlite3_soft_heap_limit64 // sqlite3.c:127297:3: + *(*func(*libc.TLS) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1352 /* .sourceid */)) = Xsqlite3_sourceid // sqlite3.c:127298:3: + *(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1360 /* .stmt_status */)) = Xsqlite3_stmt_status // sqlite3.c:127299:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1368 /* .strnicmp */)) = Xsqlite3_strnicmp // sqlite3.c:127300:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1376 /* .unlock_notify */)) = Xsqlite3_unlock_notify // sqlite3.c:127302:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1384 /* .wal_autocheckpoint */)) = Xsqlite3_wal_autocheckpoint // sqlite3.c:127307:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1392 /* .wal_checkpoint */)) = Xsqlite3_wal_checkpoint // sqlite3.c:127308:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1400 /* .wal_hook */)) = Xsqlite3_wal_hook // sqlite3.c:127309:3: + *(*func(*libc.TLS, uintptr, Sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1408 /* .blob_reopen */)) = Xsqlite3_blob_reopen // sqlite3.c:127315:3: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1416 /* .vtab_config */)) = Xsqlite3_vtab_config // sqlite3.c:127316:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1424 /* .vtab_on_conflict */)) = Xsqlite3_vtab_on_conflict // sqlite3.c:127317:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1432 /* .close_v2 */)) = Xsqlite3_close_v2 // sqlite3.c:127318:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1440 /* .db_filename */)) = Xsqlite3_db_filename // sqlite3.c:127319:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1448 /* .db_readonly */)) = Xsqlite3_db_readonly // sqlite3.c:127320:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1456 /* .db_release_memory */)) = Xsqlite3_db_release_memory // sqlite3.c:127321:3: + *(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1464 /* .errstr */)) = Xsqlite3_errstr // sqlite3.c:127322:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1472 /* .stmt_busy */)) = Xsqlite3_stmt_busy // sqlite3.c:127323:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1480 /* .stmt_readonly */)) = Xsqlite3_stmt_readonly // sqlite3.c:127324:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1488 /* .stricmp */)) = Xsqlite3_stricmp // sqlite3.c:127325:3: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1496 /* .uri_boolean */)) = Xsqlite3_uri_boolean // sqlite3.c:127326:3: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_int64) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1504 /* .uri_int64 */)) = Xsqlite3_uri_int64 // sqlite3.c:127327:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1512 /* .uri_parameter */)) = Xsqlite3_uri_parameter // sqlite3.c:127328:3: + *(*func(*libc.TLS, int32, uintptr, uintptr, Va_list) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1520 /* .xvsnprintf */)) = Xsqlite3_vsnprintf // sqlite3.c:127329:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1528 /* .wal_checkpoint_v2 */)) = Xsqlite3_wal_checkpoint_v2 // sqlite3.c:127330:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1536 /* .auto_extension */)) = Xsqlite3_auto_extension // sqlite3.c:127332:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, Sqlite3_uint64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1544 /* .bind_blob64 */)) = Xsqlite3_bind_blob64 // sqlite3.c:127333:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, Sqlite3_uint64, uintptr, uint8) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1552 /* .bind_text64 */)) = Xsqlite3_bind_text64 // sqlite3.c:127334:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1560 /* .cancel_auto_extension */)) = Xsqlite3_cancel_auto_extension // sqlite3.c:127335:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1568 /* .load_extension */)) = Xsqlite3_load_extension // sqlite3.c:127336:3: + *(*func(*libc.TLS, Sqlite3_uint64) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1576 /* .malloc64 */)) = Xsqlite3_malloc64 // sqlite3.c:127337:3: + *(*func(*libc.TLS, uintptr) Sqlite3_uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1584 /* .msize */)) = Xsqlite3_msize // sqlite3.c:127338:3: + *(*func(*libc.TLS, uintptr, Sqlite3_uint64) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1592 /* .realloc64 */)) = Xsqlite3_realloc64 // sqlite3.c:127339:3: + *(*func(*libc.TLS))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1600 /* .reset_auto_extension */)) = Xsqlite3_reset_auto_extension // sqlite3.c:127340:3: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_uint64, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1608 /* .result_blob64 */)) = Xsqlite3_result_blob64 // sqlite3.c:127341:3: + *(*func(*libc.TLS, uintptr, uintptr, Sqlite3_uint64, uintptr, uint8))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1616 /* .result_text64 */)) = Xsqlite3_result_text64 // sqlite3.c:127342:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1624 /* .strglob */)) = Xsqlite3_strglob // sqlite3.c:127343:3: + *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1632 /* .value_dup */)) = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) uintptr + }{Xsqlite3_value_dup})) // sqlite3.c:127345:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1640 /* .value_free */)) = Xsqlite3_value_free // sqlite3.c:127346:3: + *(*func(*libc.TLS, uintptr, U64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1648 /* .result_zeroblob64 */)) = Xsqlite3_result_zeroblob64 // sqlite3.c:127347:3: + *(*func(*libc.TLS, uintptr, int32, Sqlite3_uint64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1656 /* .bind_zeroblob64 */)) = Xsqlite3_bind_zeroblob64 // sqlite3.c:127348:3: + *(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1664 /* .value_subtype */)) = Xsqlite3_value_subtype // sqlite3.c:127350:3: + *(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1672 /* .result_subtype */)) = Xsqlite3_result_subtype // sqlite3.c:127351:3: + *(*func(*libc.TLS, int32, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1680 /* .status64 */)) = Xsqlite3_status64 // sqlite3.c:127353:3: + *(*func(*libc.TLS, uintptr, uintptr, uint32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1688 /* .strlike */)) = Xsqlite3_strlike // sqlite3.c:127354:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1696 /* .db_cacheflush */)) = Xsqlite3_db_cacheflush // sqlite3.c:127355:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1704 /* .system_errno */)) = Xsqlite3_system_errno // sqlite3.c:127357:3: + *(*func(*libc.TLS, uintptr, uint32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1712 /* .trace_v2 */)) = Xsqlite3_trace_v2 // sqlite3.c:127359:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1720 /* .expanded_sql */)) = Xsqlite3_expanded_sql // sqlite3.c:127360:3: + *(*func(*libc.TLS, uintptr, Sqlite3_int64))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1728 /* .set_last_insert_rowid */)) = Xsqlite3_set_last_insert_rowid // sqlite3.c:127362:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uint32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1736 /* .prepare_v3 */)) = Xsqlite3_prepare_v3 // sqlite3.c:127364:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, uint32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1744 /* .prepare16_v3 */)) = Xsqlite3_prepare16_v3 // sqlite3.c:127365:3: + *(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1752 /* .bind_pointer */)) = Xsqlite3_bind_pointer // sqlite3.c:127366:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1760 /* .result_pointer */)) = Xsqlite3_result_pointer // sqlite3.c:127367:3: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1768 /* .value_pointer */)) = Xsqlite3_value_pointer // sqlite3.c:127368:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1776 /* .vtab_nochange */)) = Xsqlite3_vtab_nochange // sqlite3.c:127370:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1784 /* .value_nochange */)) = Xsqlite3_value_nochange // sqlite3.c:127371:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1792 /* .vtab_collation */)) = Xsqlite3_vtab_collation // sqlite3.c:127372:3: + *(*func(*libc.TLS) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1800 /* .keyword_count */)) = Xsqlite3_keyword_count // sqlite3.c:127374:3: + *(*func(*libc.TLS, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1808 /* .keyword_name */)) = Xsqlite3_keyword_name // sqlite3.c:127375:3: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1816 /* .keyword_check */)) = Xsqlite3_keyword_check // sqlite3.c:127376:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1824 /* .str_new */)) = Xsqlite3_str_new // sqlite3.c:127377:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1832 /* .str_finish */)) = Xsqlite3_str_finish // sqlite3.c:127378:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1840 /* .str_appendf */)) = Xsqlite3_str_appendf // sqlite3.c:127379:3: + *(*func(*libc.TLS, uintptr, uintptr, Va_list))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1848 /* .str_vappendf */)) = Xsqlite3_str_vappendf // sqlite3.c:127380:3: + *(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1856 /* .str_append */)) = Xsqlite3_str_append // sqlite3.c:127381:3: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1864 /* .str_appendall */)) = Xsqlite3_str_appendall // sqlite3.c:127382:3: + *(*func(*libc.TLS, uintptr, int32, int8))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1872 /* .str_appendchar */)) = Xsqlite3_str_appendchar // sqlite3.c:127383:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1880 /* .str_reset */)) = Xsqlite3_str_reset // sqlite3.c:127384:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1888 /* .str_errcode */)) = Xsqlite3_str_errcode // sqlite3.c:127385:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1896 /* .str_length */)) = Xsqlite3_str_length // sqlite3.c:127386:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1904 /* .str_value */)) = Xsqlite3_str_value // sqlite3.c:127387:3: + *(*func(*libc.TLS, uintptr, uintptr, int32, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1912 /* .create_window_function */)) = Xsqlite3_create_window_function // sqlite3.c:127389:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1928 /* .stmt_isexplain */)) = Xsqlite3_stmt_isexplain // sqlite3.c:127397:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1936 /* .value_frombind */)) = Xsqlite3_value_frombind // sqlite3.c:127398:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1944 /* .drop_modules */)) = Xsqlite3_drop_modules // sqlite3.c:127401:3: + *(*func(*libc.TLS, Sqlite3_int64) Sqlite3_int64)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1952 /* .hard_heap_limit64 */)) = Xsqlite3_hard_heap_limit64 // sqlite3.c:127406:3: + *(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1960 /* .uri_key */)) = Xsqlite3_uri_key // sqlite3.c:127407:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1968 /* .filename_database */)) = Xsqlite3_filename_database // sqlite3.c:127408:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1976 /* .filename_journal */)) = Xsqlite3_filename_journal // sqlite3.c:127409:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1984 /* .filename_wal */)) = Xsqlite3_filename_wal // sqlite3.c:127410:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 1992 /* .create_filename */)) = Xsqlite3_create_filename // sqlite3.c:127412:3: + *(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 2000 /* .free_filename */)) = Xsqlite3_free_filename // sqlite3.c:127413:3: + *(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 2008 /* .database_file_object */)) = Xsqlite3_database_file_object // sqlite3.c:127414:3: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3Apis)) + 2016 /* .txn_state */)) = Xsqlite3_txn_state // sqlite3.c:127416:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3BuiltinExtensions)) + 0)) = Xsqlite3Fts5Init // sqlite3.c:165154:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3BuiltinExtensions)) + 8)) = Xsqlite3RtreeInit // sqlite3.c:165160:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3BuiltinExtensions)) + 16)) = sqlite3TestExtInit // sqlite3.c:165168:3: + *(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&sqlite3BuiltinExtensions)) + 24)) = Xsqlite3Json1Init // sqlite3.c:165170:3: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&statGetFuncdef)) + 24 /* .xSFunc */)) = statGet // sqlite3.c:110531:3: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&statInitFuncdef)) + 24 /* .xSFunc */)) = statInit // sqlite3.c:110089:3: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&statPushFuncdef)) + 24 /* .xSFunc */)) = statPush // sqlite3.c:110379:3: + *(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 40 /* .xOpen */)) = rbuVfsOpen // sqlite3.c:205283:5: + *(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 48 /* .xDelete */)) = rbuVfsDelete // sqlite3.c:205284:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 56 /* .xAccess */)) = rbuVfsAccess // sqlite3.c:205285:5: + *(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 64 /* .xFullPathname */)) = rbuVfsFullPathname // sqlite3.c:205286:5: + *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 72 /* .xDlOpen */)) = rbuVfsDlOpen // sqlite3.c:205289:5: + *(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 80 /* .xDlError */)) = rbuVfsDlError // sqlite3.c:205290:5: + *(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 88 /* .xDlSym */)) = rbuVfsDlSym // sqlite3.c:205291:5: + *(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 96 /* .xDlClose */)) = rbuVfsDlClose // sqlite3.c:205292:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 104 /* .xRandomness */)) = rbuVfsRandomness // sqlite3.c:205297:5: + *(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 112 /* .xSleep */)) = rbuVfsSleep // sqlite3.c:205298:5: + *(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 120 /* .xCurrentTime */)) = rbuVfsCurrentTime // sqlite3.c:205299:5: + *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 128 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: +} + +var ts1 = "COMPILER=gcc-10.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go index a361d692..bcb5e2d9 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_386.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_386.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_386.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1414,6 +1414,9 @@ const ( SEEK_HOLE = 4 SEEK_SET = 0 SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 SF_Aggregate = 0x0000008 SF_All = 0x0000002 SF_ComplexResult = 0x0040000 @@ -1560,6 +1563,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -1716,6 +1730,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -2083,6 +2098,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -3697,7 +3714,7 @@ type X__float128 = float64 /* :47:21 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [18]uintptr{ +var sqlite3azCompileOpt = [19]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=gcc-8.3..." */ @@ -3710,14 +3727,15 @@ var sqlite3azCompileOpt = [18]uintptr{ ts + 130, /* "ENABLE_PREUPDATE..." */ ts + 152, /* "ENABLE_RBU" */ ts + 163, /* "ENABLE_RTREE" */ - ts + 176, /* "ENABLE_SNAPSHOT" */ - ts + 192, /* "ENABLE_STAT4" */ - ts + 205, /* "ENABLE_UNLOCK_NO..." */ - ts + 226, /* "LIKE_DOESNT_MATC..." */ - ts + 250, /* "MUTEX_NOOP" */ - ts + 261, /* "SOUNDEX" */ - ts + 269, /* "SYSTEM_MALLOC" */ - ts + 283, /* "THREADSAFE=1" */ + ts + 176, /* "ENABLE_SESSION" */ + ts + 191, /* "ENABLE_SNAPSHOT" */ + ts + 207, /* "ENABLE_STAT4" */ + ts + 220, /* "ENABLE_UNLOCK_NO..." */ + ts + 241, /* "LIKE_DOESNT_MATC..." */ + ts + 265, /* "MUTEX_NOOP" */ + ts + 276, /* "SOUNDEX" */ + ts + 284, /* "SYSTEM_MALLOC" */ + ts + 298, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -4033,7 +4051,7 @@ type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 296 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 311 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -6569,6 +6587,493 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -6618,10 +7123,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -11032,7 +11536,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 303 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 318 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -12176,7 +12680,7 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+310 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+325 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 @@ -12213,13 +12717,13 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+318 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+333 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+326 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+341 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -12338,7 +12842,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+330 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+345 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -12419,7 +12923,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+342 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+357 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -12601,7 +13105,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+44 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 92 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+44 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) if osLocaltime(tls, bp+92 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+346 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+361 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -12636,12 +13140,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 369 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 376 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 383 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 388 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 392 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 398 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 384 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 391 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 398 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 403 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 407 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 413 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -12680,7 +13184,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+403 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+418 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -12694,7 +13198,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+413 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+428 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 4 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 4 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 4 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -12703,7 +13207,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+423 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+438 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -12728,7 +13232,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+427 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+442 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+4 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 4 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 4 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 4 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -12753,7 +13257,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+436 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+451 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -12767,14 +13271,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+392 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+407 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+398 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+413 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+388 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+403 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -12995,7 +13499,7 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // var zBuf [100]int8 at bp+96, 100 computeYMD_HMS(tls, bp+48 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+446, /* "%04d-%02d-%02d %..." */ + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+461, /* "%04d-%02d-%02d %..." */ libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } @@ -13014,7 +13518,7 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeHMS(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+476 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13032,7 +13536,7 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeYMD(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+506 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13159,7 +13663,7 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (Size_t(2)) break fallthrough @@ -13169,14 +13673,14 @@ __3: if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+511 /* "%06.3f" */, libc.VaList(bp+8, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+526 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (Size_t(2)) break fallthrough @@ -13194,10 +13698,10 @@ __3: if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (Size_t(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+518 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+533 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (Size_t(3)) } break @@ -13206,19 +13710,19 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+523 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+538 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (Size_t(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (Size_t(2)) break fallthrough @@ -13232,7 +13736,7 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (Size_t(2)) break fallthrough @@ -13245,7 +13749,7 @@ __3: fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+529 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+544 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -13302,14 +13806,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 534 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 544 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 554 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 563 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 572 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 585 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 603 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 559 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 564 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 569 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 578 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 587 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 600 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 618 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -13886,7 +14390,7 @@ func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:1 p += 8 } else { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+616 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+631 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -13937,7 +14441,7 @@ func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* } else { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+654, /* "failed memory re..." */ + ts+669, /* "failed memory re..." */ libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) } return p @@ -15121,8 +15625,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 690 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 723 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 705 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 738 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -15376,7 +15880,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+730 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+745 /* "%" */, 1) goto __5 __11: ; @@ -15959,7 +16463,7 @@ __125: if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 732 /* "NaN" */ + bufpt = ts + 747 /* "NaN" */ length = 3 goto __58 __127: @@ -16019,7 +16523,7 @@ __138: } bufpt = bp + 8 /* &buf[0] */ *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix - libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+736 /* "Inf" */, uint32(4)) + libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+751 /* "Inf" */, uint32(4)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: @@ -16376,7 +16880,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 740 /* "" */ + bufpt = ts + 755 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -16505,9 +17009,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 741 /* "NULL" */ + return ts + 756 /* "NULL" */ } - return ts + 746 /* "(NULL)" */ + return ts + 761 /* "(NULL)" */ }() __220: ; @@ -16642,7 +17146,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+768 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -16657,7 +17161,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+755 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+770 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -16720,7 +17224,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 767 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 782 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -18931,7 +19435,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 776 /* "9223372036854775..." */ + var pow63 uintptr = ts + 791 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -19581,7 +20085,7 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+795, /* "API call with %s..." */ + ts+810, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -19600,14 +20104,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+741 /* "NULL" */) + logBadConnection(tls, ts+756 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+840 /* "unopened" */) + logBadConnection(tls, ts+855 /* "unopened" */) } return 0 } else { @@ -19621,7 +20125,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+849 /* "invalid" */) + logBadConnection(tls, ts+864 /* "invalid" */) return 0 } else { return 1 @@ -20149,186 +20653,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 857, /* "Savepoint" */ - /* 1 */ ts + 867, /* "AutoCommit" */ - /* 2 */ ts + 878, /* "Transaction" */ - /* 3 */ ts + 890, /* "SorterNext" */ - /* 4 */ ts + 901, /* "Prev" */ - /* 5 */ ts + 906, /* "Next" */ - /* 6 */ ts + 911, /* "Checkpoint" */ - /* 7 */ ts + 922, /* "JournalMode" */ - /* 8 */ ts + 934, /* "Vacuum" */ - /* 9 */ ts + 941, /* "VFilter" */ - /* 10 */ ts + 949, /* "VUpdate" */ - /* 11 */ ts + 957, /* "Goto" */ - /* 12 */ ts + 962, /* "Gosub" */ - /* 13 */ ts + 968, /* "InitCoroutine" */ - /* 14 */ ts + 982, /* "Yield" */ - /* 15 */ ts + 988, /* "MustBeInt" */ - /* 16 */ ts + 998, /* "Jump" */ - /* 17 */ ts + 1003, /* "Once" */ - /* 18 */ ts + 1008, /* "If" */ - /* 19 */ ts + 1011, /* "Not" */ - /* 20 */ ts + 1015, /* "IfNot" */ - /* 21 */ ts + 1021, /* "IfNullRow" */ - /* 22 */ ts + 1031, /* "SeekLT" */ - /* 23 */ ts + 1038, /* "SeekLE" */ - /* 24 */ ts + 1045, /* "SeekGE" */ - /* 25 */ ts + 1052, /* "SeekGT" */ - /* 26 */ ts + 1059, /* "IfNotOpen" */ - /* 27 */ ts + 1069, /* "IfNoHope" */ - /* 28 */ ts + 1078, /* "NoConflict" */ - /* 29 */ ts + 1089, /* "NotFound" */ - /* 30 */ ts + 1098, /* "Found" */ - /* 31 */ ts + 1104, /* "SeekRowid" */ - /* 32 */ ts + 1114, /* "NotExists" */ - /* 33 */ ts + 1124, /* "Last" */ - /* 34 */ ts + 1129, /* "IfSmaller" */ - /* 35 */ ts + 1139, /* "SorterSort" */ - /* 36 */ ts + 1150, /* "Sort" */ - /* 37 */ ts + 1155, /* "Rewind" */ - /* 38 */ ts + 1162, /* "IdxLE" */ - /* 39 */ ts + 1168, /* "IdxGT" */ - /* 40 */ ts + 1174, /* "IdxLT" */ - /* 41 */ ts + 1180, /* "IdxGE" */ - /* 42 */ ts + 1186, /* "RowSetRead" */ - /* 43 */ ts + 1197, /* "Or" */ - /* 44 */ ts + 1200, /* "And" */ - /* 45 */ ts + 1204, /* "RowSetTest" */ - /* 46 */ ts + 1215, /* "Program" */ - /* 47 */ ts + 1223, /* "FkIfZero" */ - /* 48 */ ts + 1232, /* "IfPos" */ - /* 49 */ ts + 1238, /* "IfNotZero" */ - /* 50 */ ts + 1248, /* "IsNull" */ - /* 51 */ ts + 1255, /* "NotNull" */ - /* 52 */ ts + 1263, /* "Ne" */ - /* 53 */ ts + 1266, /* "Eq" */ - /* 54 */ ts + 1269, /* "Gt" */ - /* 55 */ ts + 1272, /* "Le" */ - /* 56 */ ts + 1275, /* "Lt" */ - /* 57 */ ts + 1278, /* "Ge" */ - /* 58 */ ts + 1281, /* "ElseEq" */ - /* 59 */ ts + 1288, /* "DecrJumpZero" */ - /* 60 */ ts + 1301, /* "IncrVacuum" */ - /* 61 */ ts + 1312, /* "VNext" */ - /* 62 */ ts + 1318, /* "Init" */ - /* 63 */ ts + 1323, /* "PureFunc" */ - /* 64 */ ts + 1332, /* "Function" */ - /* 65 */ ts + 1341, /* "Return" */ - /* 66 */ ts + 1348, /* "EndCoroutine" */ - /* 67 */ ts + 1361, /* "HaltIfNull" */ - /* 68 */ ts + 1372, /* "Halt" */ - /* 69 */ ts + 1377, /* "Integer" */ - /* 70 */ ts + 1385, /* "Int64" */ - /* 71 */ ts + 1391, /* "String" */ - /* 72 */ ts + 1398, /* "Null" */ - /* 73 */ ts + 1403, /* "SoftNull" */ - /* 74 */ ts + 1412, /* "Blob" */ - /* 75 */ ts + 1417, /* "Variable" */ - /* 76 */ ts + 1426, /* "Move" */ - /* 77 */ ts + 1431, /* "Copy" */ - /* 78 */ ts + 1436, /* "SCopy" */ - /* 79 */ ts + 1442, /* "IntCopy" */ - /* 80 */ ts + 1450, /* "ChngCntRow" */ - /* 81 */ ts + 1461, /* "ResultRow" */ - /* 82 */ ts + 1471, /* "CollSeq" */ - /* 83 */ ts + 1479, /* "AddImm" */ - /* 84 */ ts + 1486, /* "RealAffinity" */ - /* 85 */ ts + 1499, /* "Cast" */ - /* 86 */ ts + 1504, /* "Permutation" */ - /* 87 */ ts + 1516, /* "Compare" */ - /* 88 */ ts + 1524, /* "IsTrue" */ - /* 89 */ ts + 1531, /* "ZeroOrNull" */ - /* 90 */ ts + 1542, /* "Offset" */ - /* 91 */ ts + 1549, /* "Column" */ - /* 92 */ ts + 1556, /* "Affinity" */ - /* 93 */ ts + 1565, /* "MakeRecord" */ - /* 94 */ ts + 1576, /* "Count" */ - /* 95 */ ts + 1582, /* "ReadCookie" */ - /* 96 */ ts + 1593, /* "SetCookie" */ - /* 97 */ ts + 1603, /* "ReopenIdx" */ - /* 98 */ ts + 1613, /* "OpenRead" */ - /* 99 */ ts + 1622, /* "OpenWrite" */ - /* 100 */ ts + 1632, /* "OpenDup" */ - /* 101 */ ts + 1640, /* "OpenAutoindex" */ - /* 102 */ ts + 1654, /* "BitAnd" */ - /* 103 */ ts + 1661, /* "BitOr" */ - /* 104 */ ts + 1667, /* "ShiftLeft" */ - /* 105 */ ts + 1677, /* "ShiftRight" */ - /* 106 */ ts + 1688, /* "Add" */ - /* 107 */ ts + 1692, /* "Subtract" */ - /* 108 */ ts + 1701, /* "Multiply" */ - /* 109 */ ts + 1710, /* "Divide" */ - /* 110 */ ts + 1717, /* "Remainder" */ - /* 111 */ ts + 1727, /* "Concat" */ - /* 112 */ ts + 1734, /* "OpenEphemeral" */ - /* 113 */ ts + 1748, /* "BitNot" */ - /* 114 */ ts + 1755, /* "SorterOpen" */ - /* 115 */ ts + 1766, /* "SequenceTest" */ - /* 116 */ ts + 1779, /* "String8" */ - /* 117 */ ts + 1787, /* "OpenPseudo" */ - /* 118 */ ts + 1798, /* "Close" */ - /* 119 */ ts + 1804, /* "ColumnsUsed" */ - /* 120 */ ts + 1816, /* "SeekScan" */ - /* 121 */ ts + 1825, /* "SeekHit" */ - /* 122 */ ts + 1833, /* "Sequence" */ - /* 123 */ ts + 1842, /* "NewRowid" */ - /* 124 */ ts + 1851, /* "Insert" */ - /* 125 */ ts + 1858, /* "RowCell" */ - /* 126 */ ts + 1866, /* "Delete" */ - /* 127 */ ts + 1873, /* "ResetCount" */ - /* 128 */ ts + 1884, /* "SorterCompare" */ - /* 129 */ ts + 1898, /* "SorterData" */ - /* 130 */ ts + 1909, /* "RowData" */ - /* 131 */ ts + 1917, /* "Rowid" */ - /* 132 */ ts + 1923, /* "NullRow" */ - /* 133 */ ts + 1931, /* "SeekEnd" */ - /* 134 */ ts + 1939, /* "IdxInsert" */ - /* 135 */ ts + 1949, /* "SorterInsert" */ - /* 136 */ ts + 1962, /* "IdxDelete" */ - /* 137 */ ts + 1972, /* "DeferredSeek" */ - /* 138 */ ts + 1985, /* "IdxRowid" */ - /* 139 */ ts + 1994, /* "FinishSeek" */ - /* 140 */ ts + 2005, /* "Destroy" */ - /* 141 */ ts + 2013, /* "Clear" */ - /* 142 */ ts + 2019, /* "ResetSorter" */ - /* 143 */ ts + 2031, /* "CreateBtree" */ - /* 144 */ ts + 2043, /* "SqlExec" */ - /* 145 */ ts + 2051, /* "ParseSchema" */ - /* 146 */ ts + 2063, /* "LoadAnalysis" */ - /* 147 */ ts + 2076, /* "DropTable" */ - /* 148 */ ts + 2086, /* "DropIndex" */ - /* 149 */ ts + 2096, /* "DropTrigger" */ - /* 150 */ ts + 2108, /* "IntegrityCk" */ - /* 151 */ ts + 2120, /* "RowSetAdd" */ - /* 152 */ ts + 2130, /* "Real" */ - /* 153 */ ts + 2135, /* "Param" */ - /* 154 */ ts + 2141, /* "FkCounter" */ - /* 155 */ ts + 2151, /* "MemMax" */ - /* 156 */ ts + 2158, /* "OffsetLimit" */ - /* 157 */ ts + 2170, /* "AggInverse" */ - /* 158 */ ts + 2181, /* "AggStep" */ - /* 159 */ ts + 2189, /* "AggStep1" */ - /* 160 */ ts + 2198, /* "AggValue" */ - /* 161 */ ts + 2207, /* "AggFinal" */ - /* 162 */ ts + 2216, /* "Expire" */ - /* 163 */ ts + 2223, /* "CursorLock" */ - /* 164 */ ts + 2234, /* "CursorUnlock" */ - /* 165 */ ts + 2247, /* "TableLock" */ - /* 166 */ ts + 2257, /* "VBegin" */ - /* 167 */ ts + 2264, /* "VCreate" */ - /* 168 */ ts + 2272, /* "VDestroy" */ - /* 169 */ ts + 2281, /* "VOpen" */ - /* 170 */ ts + 2287, /* "VColumn" */ - /* 171 */ ts + 2295, /* "VRename" */ - /* 172 */ ts + 2303, /* "Pagecount" */ - /* 173 */ ts + 2313, /* "MaxPgcnt" */ - /* 174 */ ts + 2322, /* "Trace" */ - /* 175 */ ts + 2328, /* "CursorHint" */ - /* 176 */ ts + 2339, /* "ReleaseReg" */ - /* 177 */ ts + 2350, /* "Noop" */ - /* 178 */ ts + 2355, /* "Explain" */ - /* 179 */ ts + 2363, /* "Abortable" */ + /* 0 */ ts + 872, /* "Savepoint" */ + /* 1 */ ts + 882, /* "AutoCommit" */ + /* 2 */ ts + 893, /* "Transaction" */ + /* 3 */ ts + 905, /* "SorterNext" */ + /* 4 */ ts + 916, /* "Prev" */ + /* 5 */ ts + 921, /* "Next" */ + /* 6 */ ts + 926, /* "Checkpoint" */ + /* 7 */ ts + 937, /* "JournalMode" */ + /* 8 */ ts + 949, /* "Vacuum" */ + /* 9 */ ts + 956, /* "VFilter" */ + /* 10 */ ts + 964, /* "VUpdate" */ + /* 11 */ ts + 972, /* "Goto" */ + /* 12 */ ts + 977, /* "Gosub" */ + /* 13 */ ts + 983, /* "InitCoroutine" */ + /* 14 */ ts + 997, /* "Yield" */ + /* 15 */ ts + 1003, /* "MustBeInt" */ + /* 16 */ ts + 1013, /* "Jump" */ + /* 17 */ ts + 1018, /* "Once" */ + /* 18 */ ts + 1023, /* "If" */ + /* 19 */ ts + 1026, /* "Not" */ + /* 20 */ ts + 1030, /* "IfNot" */ + /* 21 */ ts + 1036, /* "IfNullRow" */ + /* 22 */ ts + 1046, /* "SeekLT" */ + /* 23 */ ts + 1053, /* "SeekLE" */ + /* 24 */ ts + 1060, /* "SeekGE" */ + /* 25 */ ts + 1067, /* "SeekGT" */ + /* 26 */ ts + 1074, /* "IfNotOpen" */ + /* 27 */ ts + 1084, /* "IfNoHope" */ + /* 28 */ ts + 1093, /* "NoConflict" */ + /* 29 */ ts + 1104, /* "NotFound" */ + /* 30 */ ts + 1113, /* "Found" */ + /* 31 */ ts + 1119, /* "SeekRowid" */ + /* 32 */ ts + 1129, /* "NotExists" */ + /* 33 */ ts + 1139, /* "Last" */ + /* 34 */ ts + 1144, /* "IfSmaller" */ + /* 35 */ ts + 1154, /* "SorterSort" */ + /* 36 */ ts + 1165, /* "Sort" */ + /* 37 */ ts + 1170, /* "Rewind" */ + /* 38 */ ts + 1177, /* "IdxLE" */ + /* 39 */ ts + 1183, /* "IdxGT" */ + /* 40 */ ts + 1189, /* "IdxLT" */ + /* 41 */ ts + 1195, /* "IdxGE" */ + /* 42 */ ts + 1201, /* "RowSetRead" */ + /* 43 */ ts + 1212, /* "Or" */ + /* 44 */ ts + 1215, /* "And" */ + /* 45 */ ts + 1219, /* "RowSetTest" */ + /* 46 */ ts + 1230, /* "Program" */ + /* 47 */ ts + 1238, /* "FkIfZero" */ + /* 48 */ ts + 1247, /* "IfPos" */ + /* 49 */ ts + 1253, /* "IfNotZero" */ + /* 50 */ ts + 1263, /* "IsNull" */ + /* 51 */ ts + 1270, /* "NotNull" */ + /* 52 */ ts + 1278, /* "Ne" */ + /* 53 */ ts + 1281, /* "Eq" */ + /* 54 */ ts + 1284, /* "Gt" */ + /* 55 */ ts + 1287, /* "Le" */ + /* 56 */ ts + 1290, /* "Lt" */ + /* 57 */ ts + 1293, /* "Ge" */ + /* 58 */ ts + 1296, /* "ElseEq" */ + /* 59 */ ts + 1303, /* "DecrJumpZero" */ + /* 60 */ ts + 1316, /* "IncrVacuum" */ + /* 61 */ ts + 1327, /* "VNext" */ + /* 62 */ ts + 1333, /* "Init" */ + /* 63 */ ts + 1338, /* "PureFunc" */ + /* 64 */ ts + 1347, /* "Function" */ + /* 65 */ ts + 1356, /* "Return" */ + /* 66 */ ts + 1363, /* "EndCoroutine" */ + /* 67 */ ts + 1376, /* "HaltIfNull" */ + /* 68 */ ts + 1387, /* "Halt" */ + /* 69 */ ts + 1392, /* "Integer" */ + /* 70 */ ts + 1400, /* "Int64" */ + /* 71 */ ts + 1406, /* "String" */ + /* 72 */ ts + 1413, /* "Null" */ + /* 73 */ ts + 1418, /* "SoftNull" */ + /* 74 */ ts + 1427, /* "Blob" */ + /* 75 */ ts + 1432, /* "Variable" */ + /* 76 */ ts + 1441, /* "Move" */ + /* 77 */ ts + 1446, /* "Copy" */ + /* 78 */ ts + 1451, /* "SCopy" */ + /* 79 */ ts + 1457, /* "IntCopy" */ + /* 80 */ ts + 1465, /* "ChngCntRow" */ + /* 81 */ ts + 1476, /* "ResultRow" */ + /* 82 */ ts + 1486, /* "CollSeq" */ + /* 83 */ ts + 1494, /* "AddImm" */ + /* 84 */ ts + 1501, /* "RealAffinity" */ + /* 85 */ ts + 1514, /* "Cast" */ + /* 86 */ ts + 1519, /* "Permutation" */ + /* 87 */ ts + 1531, /* "Compare" */ + /* 88 */ ts + 1539, /* "IsTrue" */ + /* 89 */ ts + 1546, /* "ZeroOrNull" */ + /* 90 */ ts + 1557, /* "Offset" */ + /* 91 */ ts + 1564, /* "Column" */ + /* 92 */ ts + 1571, /* "Affinity" */ + /* 93 */ ts + 1580, /* "MakeRecord" */ + /* 94 */ ts + 1591, /* "Count" */ + /* 95 */ ts + 1597, /* "ReadCookie" */ + /* 96 */ ts + 1608, /* "SetCookie" */ + /* 97 */ ts + 1618, /* "ReopenIdx" */ + /* 98 */ ts + 1628, /* "OpenRead" */ + /* 99 */ ts + 1637, /* "OpenWrite" */ + /* 100 */ ts + 1647, /* "OpenDup" */ + /* 101 */ ts + 1655, /* "OpenAutoindex" */ + /* 102 */ ts + 1669, /* "BitAnd" */ + /* 103 */ ts + 1676, /* "BitOr" */ + /* 104 */ ts + 1682, /* "ShiftLeft" */ + /* 105 */ ts + 1692, /* "ShiftRight" */ + /* 106 */ ts + 1703, /* "Add" */ + /* 107 */ ts + 1707, /* "Subtract" */ + /* 108 */ ts + 1716, /* "Multiply" */ + /* 109 */ ts + 1725, /* "Divide" */ + /* 110 */ ts + 1732, /* "Remainder" */ + /* 111 */ ts + 1742, /* "Concat" */ + /* 112 */ ts + 1749, /* "OpenEphemeral" */ + /* 113 */ ts + 1763, /* "BitNot" */ + /* 114 */ ts + 1770, /* "SorterOpen" */ + /* 115 */ ts + 1781, /* "SequenceTest" */ + /* 116 */ ts + 1794, /* "String8" */ + /* 117 */ ts + 1802, /* "OpenPseudo" */ + /* 118 */ ts + 1813, /* "Close" */ + /* 119 */ ts + 1819, /* "ColumnsUsed" */ + /* 120 */ ts + 1831, /* "SeekScan" */ + /* 121 */ ts + 1840, /* "SeekHit" */ + /* 122 */ ts + 1848, /* "Sequence" */ + /* 123 */ ts + 1857, /* "NewRowid" */ + /* 124 */ ts + 1866, /* "Insert" */ + /* 125 */ ts + 1873, /* "RowCell" */ + /* 126 */ ts + 1881, /* "Delete" */ + /* 127 */ ts + 1888, /* "ResetCount" */ + /* 128 */ ts + 1899, /* "SorterCompare" */ + /* 129 */ ts + 1913, /* "SorterData" */ + /* 130 */ ts + 1924, /* "RowData" */ + /* 131 */ ts + 1932, /* "Rowid" */ + /* 132 */ ts + 1938, /* "NullRow" */ + /* 133 */ ts + 1946, /* "SeekEnd" */ + /* 134 */ ts + 1954, /* "IdxInsert" */ + /* 135 */ ts + 1964, /* "SorterInsert" */ + /* 136 */ ts + 1977, /* "IdxDelete" */ + /* 137 */ ts + 1987, /* "DeferredSeek" */ + /* 138 */ ts + 2000, /* "IdxRowid" */ + /* 139 */ ts + 2009, /* "FinishSeek" */ + /* 140 */ ts + 2020, /* "Destroy" */ + /* 141 */ ts + 2028, /* "Clear" */ + /* 142 */ ts + 2034, /* "ResetSorter" */ + /* 143 */ ts + 2046, /* "CreateBtree" */ + /* 144 */ ts + 2058, /* "SqlExec" */ + /* 145 */ ts + 2066, /* "ParseSchema" */ + /* 146 */ ts + 2078, /* "LoadAnalysis" */ + /* 147 */ ts + 2091, /* "DropTable" */ + /* 148 */ ts + 2101, /* "DropIndex" */ + /* 149 */ ts + 2111, /* "DropTrigger" */ + /* 150 */ ts + 2123, /* "IntegrityCk" */ + /* 151 */ ts + 2135, /* "RowSetAdd" */ + /* 152 */ ts + 2145, /* "Real" */ + /* 153 */ ts + 2150, /* "Param" */ + /* 154 */ ts + 2156, /* "FkCounter" */ + /* 155 */ ts + 2166, /* "MemMax" */ + /* 156 */ ts + 2173, /* "OffsetLimit" */ + /* 157 */ ts + 2185, /* "AggInverse" */ + /* 158 */ ts + 2196, /* "AggStep" */ + /* 159 */ ts + 2204, /* "AggStep1" */ + /* 160 */ ts + 2213, /* "AggValue" */ + /* 161 */ ts + 2222, /* "AggFinal" */ + /* 162 */ ts + 2231, /* "Expire" */ + /* 163 */ ts + 2238, /* "CursorLock" */ + /* 164 */ ts + 2249, /* "CursorUnlock" */ + /* 165 */ ts + 2262, /* "TableLock" */ + /* 166 */ ts + 2272, /* "VBegin" */ + /* 167 */ ts + 2279, /* "VCreate" */ + /* 168 */ ts + 2287, /* "VDestroy" */ + /* 169 */ ts + 2296, /* "VOpen" */ + /* 170 */ ts + 2302, /* "VColumn" */ + /* 171 */ ts + 2310, /* "VRename" */ + /* 172 */ ts + 2318, /* "Pagecount" */ + /* 173 */ ts + 2328, /* "MaxPgcnt" */ + /* 174 */ ts + 2337, /* "Trace" */ + /* 175 */ ts + 2343, /* "CursorHint" */ + /* 176 */ ts + 2354, /* "ReleaseReg" */ + /* 177 */ ts + 2365, /* "Noop" */ + /* 178 */ ts + 2370, /* "Explain" */ + /* 179 */ ts + 2378, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -21936,67 +22440,67 @@ type unix_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [29]unix_syscall{ - {FzName: ts + 2373 /* "open" */, FpCurrent: 0}, + {FzName: ts + 2388 /* "open" */, FpCurrent: 0}, - {FzName: ts + 2378 /* "close" */, FpCurrent: 0}, + {FzName: ts + 2393 /* "close" */, FpCurrent: 0}, - {FzName: ts + 2384 /* "access" */, FpCurrent: 0}, + {FzName: ts + 2399 /* "access" */, FpCurrent: 0}, - {FzName: ts + 2391 /* "getcwd" */, FpCurrent: 0}, + {FzName: ts + 2406 /* "getcwd" */, FpCurrent: 0}, - {FzName: ts + 2398 /* "stat" */, FpCurrent: 0}, + {FzName: ts + 2413 /* "stat" */, FpCurrent: 0}, // The DJGPP compiler environment looks mostly like Unix, but it // lacks the fcntl() system call. So redefine fcntl() to be something // that always succeeds. This means that locking does not occur under // DJGPP. But it is DOS - what did you expect? - {FzName: ts + 2403 /* "fstat" */, FpCurrent: 0}, + {FzName: ts + 2418 /* "fstat" */, FpCurrent: 0}, - {FzName: ts + 2409 /* "ftruncate" */, FpCurrent: 0}, + {FzName: ts + 2424 /* "ftruncate" */, FpCurrent: 0}, - {FzName: ts + 2419 /* "fcntl" */, FpCurrent: 0}, + {FzName: ts + 2434 /* "fcntl" */, FpCurrent: 0}, - {FzName: ts + 2425 /* "read" */, FpCurrent: 0}, + {FzName: ts + 2440 /* "read" */, FpCurrent: 0}, - {FzName: ts + 2430 /* "pread" */}, + {FzName: ts + 2445 /* "pread" */}, - {FzName: ts + 2436 /* "pread64" */}, + {FzName: ts + 2451 /* "pread64" */}, - {FzName: ts + 2444 /* "write" */, FpCurrent: 0}, + {FzName: ts + 2459 /* "write" */, FpCurrent: 0}, - {FzName: ts + 2450 /* "pwrite" */}, + {FzName: ts + 2465 /* "pwrite" */}, - {FzName: ts + 2457 /* "pwrite64" */}, + {FzName: ts + 2472 /* "pwrite64" */}, - {FzName: ts + 2466 /* "fchmod" */, FpCurrent: 0}, + {FzName: ts + 2481 /* "fchmod" */, FpCurrent: 0}, - {FzName: ts + 2473 /* "fallocate" */}, + {FzName: ts + 2488 /* "fallocate" */}, - {FzName: ts + 2483 /* "unlink" */, FpCurrent: 0}, + {FzName: ts + 2498 /* "unlink" */, FpCurrent: 0}, - {FzName: ts + 2490 /* "openDirectory" */, FpCurrent: 0}, + {FzName: ts + 2505 /* "openDirectory" */, FpCurrent: 0}, - {FzName: ts + 2504 /* "mkdir" */, FpCurrent: 0}, + {FzName: ts + 2519 /* "mkdir" */, FpCurrent: 0}, - {FzName: ts + 2510 /* "rmdir" */, FpCurrent: 0}, + {FzName: ts + 2525 /* "rmdir" */, FpCurrent: 0}, - {FzName: ts + 2516 /* "fchown" */, FpCurrent: 0}, + {FzName: ts + 2531 /* "fchown" */, FpCurrent: 0}, - {FzName: ts + 2523 /* "geteuid" */, FpCurrent: 0}, + {FzName: ts + 2538 /* "geteuid" */, FpCurrent: 0}, - {FzName: ts + 2531 /* "mmap" */, FpCurrent: 0}, + {FzName: ts + 2546 /* "mmap" */, FpCurrent: 0}, - {FzName: ts + 2536 /* "munmap" */, FpCurrent: 0}, + {FzName: ts + 2551 /* "munmap" */, FpCurrent: 0}, - {FzName: ts + 2543 /* "mremap" */, FpCurrent: 0}, + {FzName: ts + 2558 /* "mremap" */, FpCurrent: 0}, - {FzName: ts + 2550 /* "getpagesize" */, FpCurrent: 0}, + {FzName: ts + 2565 /* "getpagesize" */, FpCurrent: 0}, - {FzName: ts + 2562 /* "readlink" */, FpCurrent: 0}, + {FzName: ts + 2577 /* "readlink" */, FpCurrent: 0}, - {FzName: ts + 2571 /* "lstat" */, FpCurrent: 0}, + {FzName: ts + 2586 /* "lstat" */, FpCurrent: 0}, - {FzName: ts + 2577 /* "ioctl" */}, + {FzName: ts + 2592 /* "ioctl" */}, } /* sqlite3.c:34446:3 */ // End of the overrideable system calls @@ -22130,9 +22634,9 @@ func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3 } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*12 + 4 /* &.pCurrent */))))(tls, fd) Xsqlite3_log(tls, SQLITE_WARNING, - ts+2583 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + ts+2598 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) fd = -1 - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4 /* &.pCurrent */))))(tls, ts+2626 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4 /* &.pCurrent */))))(tls, ts+2641 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { break } } @@ -22390,13 +22894,13 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // the strerror() function to obtain the human-readable error message // equivalent to errno. Otherwise, use strerror_r(). // This is a threadsafe build, but strerror_r() is not available. - zErr = ts + 740 /* "" */ + zErr = ts + 755 /* "" */ if zPath == uintptr(0) { - zPath = ts + 740 /* "" */ + zPath = ts + 755 /* "" */ } Xsqlite3_log(tls, errcode, - ts+2636, /* "os_unix.c:%d: (%..." */ + ts+2651, /* "os_unix.c:%d: (%..." */ libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) return errcode @@ -22415,7 +22919,7 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // and move on. func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*12 + 4 /* &.pCurrent */))))(tls, h) != 0 { - unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2378, /* "close" */ + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2393, /* "close" */ func() uintptr { if pFile != 0 { return (*UnixFile)(unsafe.Pointer(pFile)).FzPath @@ -22574,19 +23078,19 @@ func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*12 + 4 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) if rc != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2667 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2682 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink == X__nlink_t(0) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2691 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2706 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink > X__nlink_t(1) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2720 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2735 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2747 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2762 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -23700,7 +24204,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql var fd int32 = -1 // var zDirname [513]int8 at bp+8, 513 - Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2775 /* "%s" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2790 /* "%s" */, libc.VaList(bp, zFilename)) for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { } if ii > 0 { @@ -23719,7 +24223,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql if fd >= 0 { return SQLITE_OK } - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2490 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2505 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) } // Make sure all writes to a particular file are committed to disk. @@ -23754,7 +24258,7 @@ func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793 if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2778 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2793 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) } // Also fsync the directory containing the file if the DIRSYNC flag @@ -23792,7 +24296,7 @@ func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:378 rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2409 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2424 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) } else { // If the file was just truncated to a size smaller than the currently @@ -23871,7 +24375,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if iWrite >= nSize { iWrite = (nSize - int64(1)) } - nWrite = seekAndWrite(tls, pFile, iWrite, ts+740 /* "" */, 1) + nWrite = seekAndWrite(tls, pFile, iWrite, ts+755 /* "" */, 1) if nWrite != 1 { return (SQLITE_IOERR | (int32(3) << 8)) } @@ -23884,7 +24388,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2409 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2424 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) } } @@ -23958,7 +24462,7 @@ func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK } @@ -24244,7 +24748,7 @@ func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 // help detect if a -shm file truncation is legitimate or is the work // or a rogue process. if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2409 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2424 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) } } } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { @@ -24350,7 +24854,7 @@ __4: ; libc.Xmemset(tls, pShmNode, 0, (uint32(unsafe.Sizeof(unixShmNode{})) + uint32(nShmFilename))) zShm = libc.AssignPtrUintptr(pShmNode+8 /* &.zFilename */, (pShmNode + 1*68)) - Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2789 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2804 /* "%s-shm" */, libc.VaList(bp, zBasePath)) (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode @@ -24372,7 +24876,7 @@ __5: if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { goto __7 } - if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2796 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2811 /* "readonly_shm" */, 0)) { goto __8 } (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | 0400000), @@ -24387,7 +24891,7 @@ __8: if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { goto __10 } - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2373 /* "open" */, zShm, 38716) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2388 /* "open" */, zShm, 38716) goto shm_open_err __10: ; @@ -24554,11 +25058,11 @@ __11: goto __13 } *(*int32)(unsafe.Pointer(bp + 96 /* x */)) = 0 - if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+740 /* "" */, 1, bp+96 /* &x */) != 1) { + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+755 /* "" */, 1, bp+96 /* &x */) != 1) { goto __14 } zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2444 /* "write" */, zFile, 38860) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2459 /* "write" */, zFile, 38860) goto shmpage_out __14: ; @@ -24606,7 +25110,7 @@ __16: if !(pMem == (libc.UintptrFromInt32(-1))) { goto __20 } - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2531 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2546 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) goto shmpage_out __20: ; @@ -24865,7 +25369,7 @@ func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ // continue accessing the database using the xRead() and xWrite() // methods. func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ - var zErr uintptr = ts + 2531 /* "mmap" */ + var zErr uintptr = ts + 2546 /* "mmap" */ var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes @@ -24882,7 +25386,7 @@ func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13 } pNew = (*(*func(*libc.TLS, uintptr, Size_t, Size_t, int32, uintptr) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 24*12 + 4 /* &.pCurrent */))))(tls, pOrig, uint32(nReuse), uint32(nNew), MREMAP_MAYMOVE, 0) - zErr = ts + 2543 /* "mremap" */ + zErr = ts + 2558 /* "mremap" */ // The attempt to extend the existing mapping failed. Free it. if (pNew == (libc.UintptrFromInt32(-1))) || (pNew == uintptr(0)) { @@ -25118,10 +25622,10 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename } return uintptr(0) }(), - ts+2809 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + ts+2824 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { *(*uint16)(unsafe.Pointer(pNew + 18 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2814 /* "unix-excl" */) == 0 { + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2829 /* "unix-excl" */) == 0 { *(*uint16)(unsafe.Pointer(pNew + 18 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) } @@ -25167,7 +25671,7 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename if zLockFile == uintptr(0) { rc = SQLITE_NOMEM } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2824 /* "%s.lock" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2839 /* "%s.lock" */, libc.VaList(bp, zFilename)) } (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -25197,10 +25701,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var zDir uintptr = Xsqlite3_temp_directory if !(int32(azDirs[0]) != 0) { - azDirs[0] = libc.Xgetenv(tls, ts+2832 /* "SQLITE_TMPDIR" */) + azDirs[0] = libc.Xgetenv(tls, ts+2847 /* "SQLITE_TMPDIR" */) } if !(int32(azDirs[1]) != 0) { - azDirs[1] = libc.Xgetenv(tls, ts+2846 /* "TMPDIR" */) + azDirs[1] = libc.Xgetenv(tls, ts+2861 /* "TMPDIR" */) } for 1 != 0 { if (((zDir != uintptr(0)) && @@ -25220,10 +25724,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var azDirs = [6]uintptr{ uintptr(0), uintptr(0), - ts + 2853, /* "/var/tmp" */ - ts + 2862, /* "/usr/tmp" */ - ts + 2871, /* "/tmp" */ - ts + 753, /* "." */ + ts + 2868, /* "/var/tmp" */ + ts + 2877, /* "/usr/tmp" */ + ts + 2886, /* "/tmp" */ + ts + 768, /* "." */ } /* sqlite3.c:39857:21 */ // Create a temporary file name in zBuf. zBuf must be allocated @@ -25251,7 +25755,7 @@ func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2876, /* "%s/etilqs_%llx%c" */ + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2891, /* "%s/etilqs_%llx%c" */ libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { return SQLITE_ERROR @@ -25407,7 +25911,7 @@ func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr // filename, check for the "modeof" parameter. If present, interpret // its value as a filename and try to copy the mode, uid and gid from // that file. - var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2893 /* "modeof" */) + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2908 /* "modeof" */) if z != 0 { rc = getFileMode(tls, z, pMode, pUid, pGid) } @@ -25633,7 +26137,7 @@ __15: if !(fd < 0) { goto __19 } - rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2373 /* "open" */, zName, 40257) + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2388 /* "open" */, zName, 40257) if !(rc == SQLITE_OK) { goto __20 } @@ -25744,7 +26248,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) == ENOENT { rc = (SQLITE_IOERR | (int32(23) << 8)) } else { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2483 /* "unlink" */, zPath, 40396) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2498 /* "unlink" */, zPath, 40396) } return rc } @@ -25754,7 +26258,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*12 + 4 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) if rc == SQLITE_OK { if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2900 /* "fsync" */, zPath, 40406) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2915 /* "fsync" */, zPath, 40406) } robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) } else { @@ -25829,7 +26333,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*12 + 4 /* &.pCurrent */))))(tls, zOut, (uint32(nOut-2))) == uintptr(0) { - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2391 /* "getcwd" */, zPath, 40485) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2406 /* "getcwd" */, zPath, 40485) } iOff = Xsqlite3Strlen30(tls, zOut) *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') @@ -25840,7 +26344,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) return Xsqlite3CantopenError(tls, 40494) } - Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2775 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2790 /* "%s" */, libc.VaList(bp, zPath)) // Remove duplicate '/' characters. Except, two // at the beginning // of a pathname is allowed since this is important on windows. @@ -25915,7 +26419,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*12 + 4 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) != ENOENT { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2571 /* "lstat" */, zIn, 40577) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2586 /* "lstat" */, zIn, 40577) } } else { bLink = (libc.Bool32((((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode) & X__mode_t(0170000)) == (X__mode_t(0120000)))) @@ -25935,7 +26439,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if rc == SQLITE_OK { nByte = (*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*12 + 4 /* &.pCurrent */))))(tls, zIn, zDel, (uint32(nOut - 1))) if nByte < 0 { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2562 /* "readlink" */, zIn, 40595) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2577 /* "readlink" */, zIn, 40595) } else { if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { var n int32 @@ -26027,7 +26531,7 @@ func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { unixEnterMutex(tls) zErr = libc.Xdlerror(tls) if zErr != 0 { - Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2775 /* "%s" */, libc.VaList(bp, zErr)) + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2790 /* "%s" */, libc.VaList(bp, zErr)) } unixLeaveMutex(tls) } @@ -26084,7 +26588,7 @@ func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) in { var fd int32 var got int32 - fd = robust_open(tls, ts+2906 /* "/dev/urandom" */, O_RDONLY, uint32(0)) + fd = robust_open(tls, ts+2921 /* "/dev/urandom" */, O_RDONLY, uint32(0)) if fd < 0 { // var t Time_t at bp, 4 @@ -26381,10 +26885,10 @@ func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ } var aVfs = [4]Sqlite3_vfs{ - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2919 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2924 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2934 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2814 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2934 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2939 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2949 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2829 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, } /* sqlite3.c:42091:22 */ // Shutdown the operating system interface. @@ -26476,7 +26980,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 2947, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 2962, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -26708,7 +27212,7 @@ func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int3 var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2953 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2968 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -26851,7 +27355,7 @@ func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+2775 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+2790 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -26968,7 +27472,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+2968 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+2983 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { @@ -27041,7 +27545,7 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+2991 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3006 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } @@ -32516,7 +33020,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3006, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3021, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -34268,7 +34772,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint32(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3033 /* "-journal" */, uint32(8)) + libc.Xmemcpy(tls, pPtr, ts+3048 /* "-journal" */, uint32(8)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -34283,7 +34787,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint32(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3042 /* "-wal" */, uint32(4)) + libc.Xmemcpy(tls, pPtr, ts+3057 /* "-wal" */, uint32(4)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -34342,9 +34846,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3047 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3062 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3054 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3069 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -38238,7 +38742,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+3064, /* "recovered %d fra..." */ + ts+3079, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -38982,7 +39486,7 @@ func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13 } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+3101 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+3116 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -41761,7 +42265,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3127 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3142 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -43801,7 +44305,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3143 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3158 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -44675,7 +45179,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+3152 /* "@ " */, uint32(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+3167 /* "@ " */, uint32(3)) != 0) { goto __14 } goto page1_init_failed @@ -52190,7 +52694,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 40 /* &.errMsg */), ts+3156 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 40 /* &.errMsg */), ts+3171 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 40 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -52226,11 +52730,11 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+3158 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3173 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+3181 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + checkAppendMsg(tls, pCheck, ts+3196 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+284 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -52257,13 +52761,13 @@ func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent P if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+3206 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+3221 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+3235, /* "Bad ptr map entr..." */ + ts+3250, /* "Bad ptr map entr..." */ libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } @@ -52286,7 +52790,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } N-- if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+3289 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3304 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) @@ -52297,7 +52801,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+3311 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + ts+3326 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -52323,12 +52827,12 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+3350, /* "%s is %d but sho..." */ + ts+3365, /* "%s is %d but sho..." */ libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 3376 /* "size" */ + return ts + 3391 /* "size" */ } - return ts + 3381 /* "overflow list le..." */ + return ts + 3396 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -52472,13 +52976,13 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3402 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3417 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+3412 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+3427 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; @@ -52492,7 +52996,7 @@ __3: } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+3450 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + ts+3465 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; @@ -52500,7 +53004,7 @@ __4: goto __5 } - checkAppendMsg(tls, pCheck, ts+3488 /* "free space corru..." */, libc.VaList(bp+16, rc)) + checkAppendMsg(tls, pCheck, ts+3503 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; @@ -52508,7 +53012,7 @@ __5: hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3510 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3525 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -52530,7 +53034,7 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3536 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3551 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; @@ -52561,7 +53065,7 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+3564, /* "Offset %d out of..." */ + checkAppendMsg(tls, pCheck, ts+3579, /* "Offset %d out of..." */ libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 @@ -52572,7 +53076,7 @@ __12: if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+108 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+3594 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+3609 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: @@ -52590,7 +53094,7 @@ __13: }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+3618 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+108 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+3633 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+108 /* &info */)).FnKey)) __15: ; *(*I64)(unsafe.Pointer(bp + 100 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 108 /* &info */)).FnKey @@ -52631,7 +53135,7 @@ __20: if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+3642 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+3657 /* "Child page depth..." */, 0) depth = d2 __21: ; @@ -52729,7 +53233,7 @@ __29: goto __31 } checkAppendMsg(tls, pCheck, - ts+3667 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 128 /* x */))>>16), iPage)) + ts+3682 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 128 /* x */))>>16), iPage)) goto __30 goto __32 __31: @@ -52749,7 +53253,7 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+3704, /* "Fragmentation of..." */ + ts+3719, /* "Fragmentation of..." */ libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; @@ -52878,7 +53382,7 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3756 /* "Main freelist: " */ + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3771 /* "Main freelist: " */ checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) @@ -52916,7 +53420,7 @@ __13: goto __15 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3772, /* "max rootpage (%d..." */ + ts+3787, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -52926,7 +53430,7 @@ __9: goto __16 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3817 /* "incremental_vacu..." */, 0) + ts+3832 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -52976,13 +53480,13 @@ __23: if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3872 /* "Page %d is never..." */, libc.VaList(bp+16, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3887 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3894 /* "Pointer map page..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3909 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -53301,7 +53805,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint32(unsafe.Sizeof(Parse{}))) (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2775 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2790 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) @@ -53312,7 +53816,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3928 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3943 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -53333,7 +53837,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3948 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3963 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -53360,7 +53864,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+3979 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+3994 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -53974,7 +54478,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4019, /* "%!.15g" */ + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4034, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -54615,7 +55119,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -54821,6 +55325,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -55125,7 +55631,7 @@ __9: goto __10 } rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -55197,7 +55703,7 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 740 /* "" */ + zNeg = ts + 755 /* "" */ rc = SQLITE_OK __1: @@ -55246,7 +55752,7 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 4026 /* "-" */ + zNeg = ts + 4041 /* "-" */ __6: ; @@ -55266,7 +55772,7 @@ __9: Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+4028 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+4043 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } @@ -56711,34 +57217,34 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4033 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4048 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 20 /* &.aColl */) + uintptr(j)*4)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 740 /* "" */ + zColl = ts + 755 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+303 /* "BINARY" */) == 0 { - zColl = ts + 4038 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+318 /* "BINARY" */) == 0 { + zColl = ts + 4053 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4040, /* ",%s%s%s" */ + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4055, /* ",%s%s%s" */ libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 4026 /* "-" */ + return ts + 4041 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 4048 /* "N." */ + return ts + 4063 /* "N." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4066 /* ")" */, 1) break } @@ -56746,7 +57252,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4053 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4068 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -56754,32 +57260,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4062 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4077 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4062 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4077 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4074 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4089 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -56789,14 +57295,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 741 /* "NULL" */ + zP4 = ts + 756 /* "NULL" */ } else { - zP4 = ts + 4077 /* "(blob)" */ + zP4 = ts + 4092 /* "(blob)" */ } break @@ -56804,7 +57310,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4099 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -56815,20 +57321,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4092 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4107 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4097 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4112 /* "]" */, 1) break } case -4: { - zP4 = ts + 4099 /* "program" */ + zP4 = ts + 4114 /* "program" */ break } @@ -56860,7 +57366,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 4107 /* "?" */, ts + 4109 /* "8" */, ts + 4111 /* "16LE" */, ts + 4116 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 4122 /* "?" */, ts + 4124 /* "8" */, ts + 4126 /* "16LE" */, ts + 4131 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -57391,8 +57897,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 4121 /* "addr" */, ts + 4126 /* "opcode" */, ts + 4133 /* "p1" */, ts + 4136 /* "p2" */, ts + 4139 /* "p3" */, ts + 4142 /* "p4" */, ts + 4145 /* "p5" */, ts + 4148, /* "comment" */ - ts + 4156 /* "id" */, ts + 4159 /* "parent" */, ts + 4166 /* "notused" */, ts + 4174, /* "detail" */ + ts + 4136 /* "addr" */, ts + 4141 /* "opcode" */, ts + 4148 /* "p1" */, ts + 4151 /* "p2" */, ts + 4154 /* "p3" */, ts + 4157 /* "p4" */, ts + 4160 /* "p5" */, ts + 4163, /* "comment" */ + ts + 4171 /* "id" */, ts + 4174 /* "parent" */, ts + 4181 /* "notused" */, ts + 4189, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -57640,7 +58146,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+4181 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+4196 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } @@ -57650,16 +58156,16 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4193 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4208 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4207 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4222 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4222, /* "-mj%06X9%02X" */ + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4237, /* "-mj%06X9%02X" */ libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. @@ -57853,7 +58359,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+4235 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4250 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -58135,7 +58641,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -59686,13 +60192,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 4265 /* "a CHECK constrai..." */ + zContext = ts + 4280 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 4284 /* "a generated colu..." */ + zContext = ts + 4299 /* "a generated colu..." */ } else { - zContext = ts + 4303 /* "an index" */ + zContext = ts + 4318 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+4312, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+4327, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -59823,7 +60329,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4348 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4363 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -59833,7 +60339,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4393 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4408 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -60303,7 +60809,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4433 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4448 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -61054,7 +61560,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+4456 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+4471 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -61831,7 +62337,7 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4496 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4511 /* "-- " */, 3) Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, ((int32(zRawSql) - int32(zStart)) / 1)) } @@ -61869,11 +62375,11 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 176 /* idx */))-1))*40) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+741 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+756 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4069 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4084 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4019 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4034 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc @@ -61888,21 +62394,21 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = bp + 180 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4500 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4515 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { Xsqlite3VdbeMemRelease(tls, bp+180 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4507 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4522 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4520 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4535 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4523 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4538 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4528 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4543 /* "'" */, 1) } } } @@ -65601,19 +66107,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+4530 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+4545 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4551 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4566 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4558 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4573 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -68163,7 +68669,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+4582 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4597 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -68236,7 +68742,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+4633 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + Xsqlite3VdbeError(tls, p, ts+4648 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -68246,7 +68752,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+4655 /* "cannot release s..." */, 0) + ts+4670 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -68451,7 +68957,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+4709 /* "cannot commit tr..." */, 0) + ts+4724 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -68494,13 +69000,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 4764 /* "cannot start a t..." */ + return ts + 4779 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 4812 /* "cannot rollback ..." */ + return ts + 4827 /* "cannot rollback ..." */ } - return ts + 4855 /* "cannot commit - ..." */ + return ts + 4870 /* "cannot commit - ..." */ }() }(), 0) @@ -68618,7 +69124,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4896 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4911 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -69000,7 +69506,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*40)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*40)).Fz = ts + 740 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*40)).Fz = ts + 755 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -71130,7 +71636,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4924 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4939 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -71563,14 +72069,14 @@ __137: goto __720 __719: - zSchema = ts + 4941 /* "sqlite_master" */ + zSchema = ts + 4956 /* "sqlite_master" */ (*InitData)(unsafe.Pointer(bp + 568 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 568 /* &initData */)).FiDb = iDb3 (*InitData)(unsafe.Pointer(bp + 568 /* &initData */)).FpzErrMsg = (p + 120 /* &.zErrMsg */) (*InitData)(unsafe.Pointer(bp + 568 /* &initData */)).FmInitFlags = U32(0) (*InitData)(unsafe.Pointer(bp + 568 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*16)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+4955, /* "SELECT*FROM\"%w\"...." */ + ts+4970, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*16)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 @@ -71903,7 +72409,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+4998 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5013 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -72348,7 +72854,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -72426,7 +72932,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -72541,12 +73047,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+5035, /* "cannot change %s..." */ + ts+5050, /* "cannot change %s..." */ libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 5087 /* "into" */ + return ts + 5102 /* "into" */ } - return ts + 5092 /* "out of" */ + return ts + 5107 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -72749,7 +73255,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+5099 /* "database table i..." */, libc.VaList(bp+112, z1)) + Xsqlite3VdbeError(tls, p, ts+5114 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -72993,7 +73499,7 @@ __833: if !((*Sqlite3_context)(unsafe.Pointer(bp+672 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) rc = (*Sqlite3_context)(unsafe.Pointer(bp + 672 /* &sContext */)).FisError __834: ; @@ -73324,7 +73830,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -73414,7 +73920,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+5128 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+5143 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 204 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -73517,13 +74023,13 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+5134, /* "statement aborts..." */ + Xsqlite3_log(tls, rc, ts+5149, /* "statement aborts..." */ libc.VaList(bp+152, ((int32(pOp)-int32(aOp))/20), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { @@ -73568,14 +74074,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+4433 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4448 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+5166 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+5181 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -73588,8 +74094,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 5180 /* "NOT NULL" */, ts + 5189 /* "UNIQUE" */, ts + 5196, /* "CHECK" */ - ts + 5202 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 5195 /* "NOT NULL" */, ts + 5204 /* "UNIQUE" */, ts + 5211, /* "CHECK" */ + ts + 5217 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -73696,16 +74202,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5214, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5229, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 5243 /* "null" */ + return ts + 5258 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 5248 /* "real" */ + return ts + 5263 /* "real" */ } - return ts + 5253 /* "integer" */ + return ts + 5268 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -73725,10 +74231,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5261 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5276 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -73791,21 +74297,21 @@ __4: goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5281 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5296 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5311 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5326 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5347 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5362 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { @@ -73850,7 +74356,7 @@ __12: goto __14 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5368 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5383 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -73879,7 +74385,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+36 /* &.aCol */)+uintptr(j)*8)).FiFrom == iCol) { goto __23 } - zFault = ts + 5389 /* "foreign key" */ + zFault = ts + 5404 /* "foreign key" */ __23: ; goto __21 @@ -73912,7 +74418,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 5401 /* "indexed" */ + zFault = ts + 5416 /* "indexed" */ __30: ; goto __28 @@ -73933,7 +74439,7 @@ __26: goto __31 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5409 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5424 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74042,7 +74548,7 @@ __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)))) @@ -74207,7 +74713,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) @@ -77755,7 +78261,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5443 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5458 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -77958,14 +78464,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5448 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5463 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5452 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5467 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -77982,7 +78488,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 8 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5456 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5471 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -78159,7 +78665,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+5465 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5480 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -78167,14 +78673,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+5496 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5511 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -78250,7 +78756,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+5551 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + ts+5566 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 44 /* &.y */)) = uintptr(0) return WRC_Prune @@ -78271,23 +78777,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 5586 /* "no such column" */ + zErr = ts + 5601 /* "no such column" */ } else { - zErr = ts + 5601 /* "ambiguous column..." */ + zErr = ts + 5616 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+5623 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5638 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+5636 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5651 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+5646 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5661 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -78421,15 +78927,15 @@ func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExp bp := tls.Alloc(16) defer tls.Free(16) - var zIn uintptr = ts + 5653 /* "partial index WH..." */ + var zIn uintptr = ts + 5668 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 5681 /* "index expression..." */ + zIn = ts + 5696 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 5699 /* "CHECK constraint..." */ + zIn = ts + 5714 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 5717 /* "generated column..." */ + zIn = ts + 5732 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5735 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+5750 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -78537,10 +79043,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5755 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5770 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5760 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5775 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -78593,7 +79099,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5766 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5781 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -78660,7 +79166,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+5783 /* "second argument ..." */, 0) + ts+5798 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -78685,7 +79191,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+5854, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+5869, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -78709,7 +79215,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5889 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5904 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -78738,30 +79244,30 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+5917 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + ts+5932 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 5961 /* "window" */ + zType = ts + 5976 /* "window" */ } else { - zType = ts + 5968 /* "aggregate" */ + zType = ts + 5983 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5978 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+5993 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6007 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6022 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6030, /* "wrong number of ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6045, /* "wrong number of ..." */ libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+6075, /* "FILTER may not b..." */ + ts+6090, /* "FILTER may not b..." */ libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -78836,7 +79342,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6124 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6139 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */))) @@ -78853,7 +79359,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6135 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6150 /* "parameters" */, pExpr) } break @@ -78913,7 +79419,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) } break @@ -79018,7 +79524,7 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 Xsqlite3ErrorMsg(tls, pParse, - ts+6146 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+6161 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -79050,7 +79556,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6202 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6217 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -79085,7 +79591,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+6236 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + resolveOutOfRangeError(tls, pParse, ts+6251 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { @@ -79156,7 +79662,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*20) + 12 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6242 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+6257 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -79184,7 +79690,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6303 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+6318 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -79473,7 +79979,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 24 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6334 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6349 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -79530,7 +80036,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6236 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6251 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -79543,7 +80049,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6378 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6393 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -79555,7 +80061,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6384 /* "aggregate functi..." */, 0) + ts+6399 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -80325,7 +80831,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) return } @@ -80401,7 +80907,7 @@ func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 108 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+6443 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+6458 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -80642,7 +81148,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -80664,7 +81170,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 108 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6493 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+6508 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 20 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -80698,7 +81204,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+6527 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6542 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -80751,7 +81257,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6546, /* "variable number ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6561, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 9*4)))) return } @@ -80778,7 +81284,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6589 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6604 /* "too many SQL var..." */, 0) } } @@ -81447,7 +81953,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+6612, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6627, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -81582,7 +82088,7 @@ func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 108 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+6642 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+6657 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -81637,10 +82143,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+5755 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5770 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+5760 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5775 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -82085,13 +82591,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+6665 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6680 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6673 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6688 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6679 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6694 /* "OID" */) == 0 { return 1 } return 0 @@ -82319,7 +82825,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6683 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6698 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -82410,7 +82916,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6730 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6745 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -82516,7 +83022,7 @@ func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpec defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 6761 /* "sub-select retur..." */ + var zFmt uintptr = ts + 6776 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -82534,7 +83040,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) } } @@ -82587,7 +83093,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6805 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6820 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -82623,11 +83129,11 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6828 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6843 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 6847 /* "CORRELATED " */ + return ts + 6862 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. @@ -82773,7 +83279,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6859 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6874 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -82806,11 +83312,11 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6877 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6892 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 6847 /* "CORRELATED " */ + return ts + 6862 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr @@ -82834,7 +83340,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -82844,7 +83350,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6898 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6913 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -83336,12 +83842,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+6900 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6903 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if Xsqlite3_strnicmp(tls, z, ts+6915 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6918 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 4026 /* "-" */ + return ts + 4041 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -83416,7 +83922,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6929 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6944 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 16 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -83975,7 +84481,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+6929, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6944, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -84227,7 +84733,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+6959 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+6974 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*20)).FiMem @@ -84269,7 +84775,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+6985 /* "unknown function..." */, libc.VaList(bp+16, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7000 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -84463,7 +84969,7 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+6612, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6627, /* "%d columns assig..." */ libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; @@ -84545,7 +85051,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -84669,7 +85175,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+7008 /* "RAISE() may only..." */, 0) + ts+7023 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -84708,7 +85214,7 @@ __3: return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7058 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7073 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -86545,11 +87051,11 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq bp := tls.Alloc(8) defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7074 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7089 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -86567,14 +87073,14 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+7102, /* "SELECT 1 FROM \"%..." */ + ts+7117, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7277, /* "SELECT 1 FROM te..." */ + ts+7292, /* "SELECT 1 FROM te..." */ libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -86590,11 +87096,11 @@ func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { Xsqlite3NestedParse(tls, pParse, - ts+7451 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+7466 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7598 /* "UPDATE temp.sqli..." */, 0) + ts+7613 /* "UPDATE temp.sqli..." */, 0) } } @@ -86668,7 +87174,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+7749 /* "there is already..." */, libc.VaList(bp, zName)) + ts+7764 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -86681,7 +87187,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7808 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7823 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -86691,7 +87197,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+7814 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7829 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -86744,24 +87250,24 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+7841 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+7856 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+8025, /* "UPDATE %Q.sqlite..." */ + ts+8040, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+8330 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+8345 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+8346, /* "UPDATE \"%w\".sqli..." */ + ts+8361, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -86774,7 +87280,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+8404 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+8419 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -86792,7 +87298,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8669 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8684 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -86807,7 +87313,7 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+8682, /* "SELECT raise(ABO..." */ + ts+8697, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -86855,12 +87361,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8720 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+8735 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+8752 /* "Cannot add a UNI..." */, 0) + ts+8767 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -86873,11 +87379,11 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8779 /* "Cannot add a REF..." */) + ts+8794 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8838 /* "Cannot add a NOT..." */) + ts+8853 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() @@ -86893,12 +87399,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8891 /* "Cannot add a col..." */) + ts+8906 /* "Cannot add a col..." */) } Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8937 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8952 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -86914,7 +87420,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+8964, /* "UPDATE \"%w\".sqli..." */ + ts+8979, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -86985,7 +87491,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+9110 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9125 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -86994,7 +87500,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+9144 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9159 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -87029,7 +87535,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint32(unsafe.Sizeof(Column{})) * uint32(nAlloc)))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9174 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9189 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -87076,18 +87582,18 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 9193 /* "view" */ + zType = ts + 9208 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 9198 /* "virtual table" */ + zType = ts + 9213 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9212, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9227, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 9230 /* "drop column from" */ + return ts + 9245 /* "drop column from" */ } - return ts + 9247 /* "rename columns o..." */ + return ts + 9262 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -87180,13 +87686,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+5368 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+5383 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -87204,19 +87710,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+9265, /* "UPDATE \"%w\".sqli..." */ + ts+9280, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+9483, /* "UPDATE temp.sqli..." */ + ts+9498, /* "UPDATE temp.sqli..." */ libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8669 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8684 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -87511,12 +88017,12 @@ func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType ui var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+9614, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+9629, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 9637 /* " " */ + return ts + 9652 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -87625,7 +88131,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+9639 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+9654 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -87675,12 +88181,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.Xmemcpy(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9645 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9660 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 9637 /* " " */ + return ts + 9652 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -88185,7 +88691,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+20 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+20 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+20 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -88365,7 +88871,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+48 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+48 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+48 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -88647,7 +89153,7 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+9650 /* "%.*s%s" */, libc.VaList(bp, ((int32((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+9665 /* "%.*s%s" */, libc.VaList(bp, ((int32((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) @@ -88735,7 +89241,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+5368 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5383 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -88745,12 +89251,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*20)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+9657, /* "cannot drop %s c..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9672, /* "cannot drop %s c..." */ libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*20)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 9685 /* "PRIMARY KEY" */ + return ts + 9700 /* "PRIMARY KEY" */ } - return ts + 5189 /* "UNIQUE" */ + return ts + 5204 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -88761,7 +89267,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+9697 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+9712 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -88770,15 +89276,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+9745 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+9760 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9866 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9881 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*20)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -88889,11 +89395,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9884 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9905 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9925 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9944 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9963 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9899 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9920 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9940 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9959 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9978 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -89090,7 +89596,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+9986 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + ts+10001 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } @@ -89102,10 +89608,10 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10009, /* "DELETE FROM %Q.%..." */ + ts+10024, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+10039 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+10054 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) @@ -89126,9 +89632,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 10057 /* "sqlite_stat1" */, FzCols: ts + 10070 /* "tbl,idx,stat" */}, - {FzName: ts + 10083 /* "sqlite_stat4" */, FzCols: ts + 10096 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 10124 /* "sqlite_stat3" */}, + {FzName: ts + 10072 /* "sqlite_stat1" */, FzCols: ts + 10085 /* "tbl,idx,stat" */}, + {FzName: ts + 10098 /* "sqlite_stat4" */, FzCols: ts + 10111 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10139 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -89358,7 +89864,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10137 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 10152 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -89676,7 +90182,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10147 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 10162 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -89733,7 +90239,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+10157, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+10172, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -89744,7 +90250,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+10162 /* " %llu" */, libc.VaList(bp+8, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+10177 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -89793,7 +90299,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+10168 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+10183 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -89810,7 +90316,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10174 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 10189 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -89857,7 +90363,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+10183 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+10198 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -89875,7 +90381,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*76) - libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10057 /* "sqlite_stat1" */, uint32(13)) + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10072 /* "sqlite_stat1" */, uint32(13)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -90108,7 +90614,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10193 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10208 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -90170,7 +90676,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10193 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10208 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -90223,9 +90729,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 40 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10197 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10212 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10201 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10216 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -90320,7 +90826,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 740 /* "" */ + z = ts + 755 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -90342,15 +90848,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+10205 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+10220 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+10216 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10231 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+10226 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10241 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -90669,10 +91175,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+10083 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+10098 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+10238, /* "SELECT idx,count..." */ - ts+10292, /* "SELECT idx,neq,n..." */ + ts+10253, /* "SELECT idx,count..." */ + ts+10307, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -90723,9 +91229,9 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit // Load new statistics out of the sqlite_stat1 table (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+10057 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + if Xsqlite3FindTable(tls, db, ts+10072 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+10344 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + ts+10359 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { @@ -90817,7 +91323,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5443 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5458 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -90868,13 +91374,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 740 /* "" */ + zFile = ts + 755 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __2: ; @@ -90884,7 +91390,7 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2947 /* "memdb" */) + *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2962 /* "memdb" */) if !(*(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)) == uintptr(0)) { goto __5 } @@ -90900,7 +91406,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)), ts+10385 /* "x\x00" */, db, (pNew + 4 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)), ts+10400 /* "x\x00" */, db, (pNew + 4 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -90913,7 +91419,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10388, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10403, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -90927,7 +91433,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10425 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10440 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -90998,7 +91504,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10455 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10470 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -91015,7 +91521,7 @@ __21: goto __23 } *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+10484 /* "attached databas..." */, 0) + ts+10499 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -91085,13 +91591,13 @@ __29: } Xsqlite3OomFault(tls, db) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5166 /* "out of memory" */, 0) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5181 /* "out of memory" */, 0) goto __31 __30: if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10552 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10567 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -91147,7 +91653,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __1: ; i = 0 @@ -91179,14 +91685,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10580 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10595 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10601 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10616 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -91194,7 +91700,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10627 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10642 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -91317,7 +91823,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10649 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 10664 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -91330,7 +91836,7 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10663 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 10678 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ @@ -91345,7 +91851,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10677 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10692 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -91378,7 +91884,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+10701, /* "%s %T cannot ref..." */ + ts+10716, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -91577,7 +92083,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+10747 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10762 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -91601,11 +92107,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 348 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+10770 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+10785 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+10776 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+10791 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+10782 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+10797 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -91657,7 +92163,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*20)).FzName } else { - zCol = ts + 6673 /* "ROWID" */ + zCol = ts + 6688 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -91689,7 +92195,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 348 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+10809 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10824 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -91999,25 +92505,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+5443 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+5458 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*16)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10824 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4941 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10839 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4956 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 8 /* &.tblHash */), - ts+10857 /* "sqlite_temp_mast..." */) + ts+10872 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*16)).FpSchema + 8 /* &.tblHash */), - ts+4941 /* "sqlite_master" */) + ts+4956 /* "sqlite_master" */) } } } @@ -92040,12 +92546,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4941 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10824 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4956 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10839 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 8 /* &.tblHash */), - ts+10857 /* "sqlite_temp_mast..." */) + ts+10872 /* "sqlite_temp_mast..." */) } } } @@ -92081,7 +92587,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 372 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10876 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10891 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -92099,14 +92605,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 10884 /* "no such view" */ + zMsg = ts + 10899 /* "no such view" */ } else { - zMsg = ts + 10897 /* "no such table" */ + zMsg = ts + 10912 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+5636 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5651 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5646 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5661 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -92419,7 +92925,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4941 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4956 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -92446,7 +92952,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5443 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5458 /* "main" */, zName)) { goto __3 } @@ -92499,13 +93005,13 @@ func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10911 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10926 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10928 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+10943 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -92546,13 +93052,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*4))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*4))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+10948, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10963, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -92721,9 +93227,9 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 @@ -92741,7 +93247,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+10990 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11005 /* "temporary table ..." */, 0) return __4: ; @@ -92769,9 +93275,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 9193 /* "view" */ + return ts + 9208 /* "view" */ } - return ts + 7808 /* "table" */ + return ts + 7823 /* "table" */ }(), zName) != 0) { goto __8 } @@ -92788,9 +93294,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -92828,7 +93334,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+11031 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+11046 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -92842,7 +93348,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+11055 /* "there is already..." */, libc.VaList(bp+8, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11070 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -92958,7 +93464,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 40 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+11090 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+11105 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -92982,7 +93488,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11107 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11122 /* "cannot use RETUR..." */, 0) } else { } @@ -93003,7 +93509,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11090 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11105 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -93015,7 +93521,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 40 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+11090 /* "sqlite_returning" */, (pRet+8 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+11105 /* "sqlite_returning" */, (pRet+8 /* &.retTrig */)) == (pRet + 8 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -93043,7 +93549,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11141 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11156 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -93059,7 +93565,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*20)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*20)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11164 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11179 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -93233,11 +93739,11 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*20) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11190, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11205, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11235 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11250 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. @@ -93287,7 +93793,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11276 /* "generated column..." */, 0) + ts+11291 /* "generated column..." */, 0) } } @@ -93332,7 +93838,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+11328 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11343 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -93392,7 +93898,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), ts+11369 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), ts+11384 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -93420,7 +93926,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+11377 /* "AUTOINCREMENT is..." */, 0) + ts+11392 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -93524,7 +94030,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+11433 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11448 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -93537,13 +94043,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11476 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11491 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11484 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11499 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -93576,7 +94082,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+11491, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11506, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -93718,13 +94224,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 740 /* "" */ - zSep2 = ts + 11522 /* "," */ - zEnd = ts + 4051 /* ")" */ + zSep = ts + 755 /* "" */ + zSep2 = ts + 11537 /* "," */ + zEnd = ts + 4066 /* ")" */ } else { - zSep = ts + 11524 /* "\n " */ - zSep2 = ts + 11528 /* ",\n " */ - zEnd = ts + 11533 /* "\n)" */ + zSep = ts + 11539 /* "\n " */ + zSep2 = ts + 11543 /* ",\n " */ + zEnd = ts + 11548 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -93732,7 +94238,7 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+11536 /* "CREATE TABLE " */, 0) + Xsqlite3_snprintf(tls, n, zStmt, ts+11551 /* "CREATE TABLE " */, 0) *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') @@ -93766,16 +94272,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2775 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2790 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 740, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 11550, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 11556, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 11561, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 11566, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 755, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11565, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11571, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11576, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11581, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -94212,7 +94718,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -94225,11 +94731,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11572 /* "AUTOINCREMENT no..." */, 0) + ts+11587 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11622 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11637 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 36 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -94273,7 +94779,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11654 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11669 /* "must have at lea..." */, 0) return } } @@ -94306,12 +94812,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 7808 /* "table" */ - zType2 = ts + 11698 /* "TABLE" */ + zType = ts + 7823 /* "table" */ + zType2 = ts + 11713 /* "TABLE" */ } else { // A view - zType = ts + 9193 /* "view" */ - zType2 = ts + 11704 /* "VIEW" */ + zType = ts + 9208 /* "view" */ + zType2 = ts + 11719 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -94392,7 +94898,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+11709 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+11724 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -94400,7 +94906,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+11724, /* "UPDATE %Q.sqlite..." */ + ts+11739, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, @@ -94418,14 +94924,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+11822, /* "CREATE TABLE %Q...." */ + ts+11837, /* "CREATE TABLE %Q...." */ libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+11864 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+11879 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -94446,7 +94952,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8330 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8345 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -94483,7 +94989,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+11898 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11913 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -94505,7 +95011,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+4 /* &sFix */, pParse, iDb, ts+9193 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+4 /* &sFix */, pParse, iDb, ts+9208 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+4 /* &sFix */, pSelect) != 0) { goto __3 } @@ -94622,7 +95128,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11934 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11949 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -94764,7 +95270,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+11964 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11979 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -94778,7 +95284,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+11979, /* "UPDATE %Q.sqlite..." */ + ts+11994, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*16)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -94842,10 +95348,10 @@ func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uint for i = 1; i <= 4; i++ { // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12046 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12061 /* "sqlite_stat%d" */, libc.VaList(bp, i)) if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10009, /* "DELETE FROM %Q.%..." */ + ts+10024, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } @@ -94885,7 +95391,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+12060, /* "DELETE FROM %Q.s..." */ + ts+12075, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -94897,7 +95403,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+12105, /* "DELETE FROM %Q.s..." */ + ts+12120, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) @@ -94927,11 +95433,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2398 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2413 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6135 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6150 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -95012,9 +95518,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName zArg2 = uintptr(0) @@ -95074,7 +95580,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+12172 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12187 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -95084,14 +95590,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+12200 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12215 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+12234 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12249 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -95106,7 +95612,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+10201 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10216 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -95171,7 +95677,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+12266, /* "foreign key on %..." */ + ts+12281, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*20)).FzName, pTo)) goto fk_end __5: @@ -95184,7 +95690,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+12329 /* "number of column..." */, 0) + ts+12344 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -95268,7 +95774,7 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+12423, /* "unknown column \"..." */ + ts+12438, /* "unknown column \"..." */ libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*20)).FzEName)) goto fk_end __23: @@ -95518,12 +96024,12 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*20 + 12 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*20)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+12469, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12484, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 12497 /* "FIRST" */ + return ts + 12512 /* "FIRST" */ } - return ts + 12503 /* "LAST" */ + return ts + 12518 /* "LAST" */ }())) return 1 } @@ -95681,7 +96187,7 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+132 /* &sFix */, pParse, iDb, ts+12508 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + Xsqlite3FixInit(tls, bp+132 /* &sFix */, pParse, iDb, ts+12523 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+132 /* &sFix */, pTblName) != 0) { goto __10 } @@ -95702,7 +96208,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+12514, /* "cannot create a ..." */ + ts+12529, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -95729,26 +96235,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12564 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12579 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+12592 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12607 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+12617 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12632 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -95775,7 +96281,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12508 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12523 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -95790,7 +96296,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+12651 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12666 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -95802,7 +96308,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+12685 /* "index %s already..." */, libc.VaList(bp+24, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12700 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -95831,7 +96337,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+12709 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+12724 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -95860,9 +96366,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -95906,7 +96412,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12508 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12523 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -96023,7 +96529,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+12732 /* "expressions proh..." */, 0) + ts+12747 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -96252,7 +96758,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+12793 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) + ts+12808 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -96308,7 +96814,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+12835 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12850 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -96366,12 +96872,12 @@ __104: __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+12852, /* "CREATE%s INDEX %..." */ + zStmt = Xsqlite3MPrintf(tls, db, ts+12867, /* "CREATE%s INDEX %..." */ libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 12872 /* " UNIQUE" */ + return ts + 12887 /* " UNIQUE" */ }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: @@ -96383,7 +96889,7 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+12880, /* "INSERT INTO %Q.s..." */ + ts+12895, /* "INSERT INTO %Q.s..." */ libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -96399,7 +96905,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+12939 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+12954 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -96583,7 +97089,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+12966 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+12981 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -96598,7 +97104,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+12984 /* "index associated..." */, libc.VaList(bp+8, 0)) + ts+12999 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -96609,9 +97115,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -96639,9 +97145,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+13057, /* "DELETE FROM %Q.s..." */ + ts+13072, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+10197 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10212 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -96792,7 +97298,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+13117, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13132, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -97004,12 +97510,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13153, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13168, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 13189 /* "ON" */ + return ts + 13204 /* "ON" */ } - return ts + 13192 /* "USING" */ + return ts + 13207 /* "USING" */ }())) goto append_from_error __1: @@ -97137,7 +97643,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -97173,9 +97679,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 13204 /* "ROLLBACK" */ + return ts + 13219 /* "ROLLBACK" */ } - return ts + 13213 /* "COMMIT" */ + return ts + 13228 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -97200,7 +97706,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 13198 /* "BEGIN" */, ts + 13220 /* "RELEASE" */, ts + 13204 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 13213 /* "BEGIN" */, ts + 13235 /* "RELEASE" */, ts + 13219 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -97216,7 +97722,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+13228 /* "unable to open a..." */, 0) + ts+13243 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -97359,17 +97865,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 108 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13298 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13313 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*20)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13309 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13324 /* ", " */, 2) } Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+768 /* "." */, 1) Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } @@ -97392,11 +97898,11 @@ func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*20)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13312 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13327 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -97539,7 +98045,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+13321 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13336 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -97649,7 +98155,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+12 /* &.a */)+uintptr(i)*24)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13367 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13382 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -97883,7 +98389,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13397 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13412 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -98249,11 +98755,11 @@ func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int3 defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13428 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13443 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13457 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13472 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -98846,7 +99352,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13495 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13510 /* "rows deleted" */, uintptr(0)) __61: ; @@ -98991,7 +99497,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10057 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10072 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -99269,7 +99775,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 5253 /* "integer" */, ts + 5248 /* "real" */, ts + 13508 /* "text" */, ts + 13513 /* "blob" */, ts + 5243 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 5268 /* "integer" */, ts + 5263 /* "real" */, ts + 13523 /* "text" */, ts + 13528 /* "blob" */, ts + 5258 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -99333,7 +99839,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+13518 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13533 /* "integer overflow" */, -1) return } iVal = -iVal @@ -99671,7 +100177,7 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+13535 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+13550 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -100121,7 +100627,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+13540 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+13555 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -100133,7 +100639,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+13573 /* "ESCAPE expressio..." */, -1) + ts+13588 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -100199,7 +100705,7 @@ func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))) } // Implementation of the sqlite_compileoption_used() function. @@ -100256,10 +100762,10 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4019 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4034 /* "%!.15g" */, libc.VaList(bp, r1)) Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+68 /* &r2 */, 20, uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp + 68 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13618 /* "%!.20e" */, libc.VaList(bp+8, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13633 /* "%!.20e" */, libc.VaList(bp+8, r1)) } Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break @@ -100333,7 +100839,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+741 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+756 /* "NULL" */, 4, uintptr(0)) break } @@ -100644,7 +101150,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 9637 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 9652 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -100665,7 +101171,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 740 /* "" */ + zIn = ts + 755 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -100691,7 +101197,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+13625 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+13640 /* "?000" */, 4, uintptr(0)) } } @@ -100719,7 +101225,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+10809 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+10824 /* "not authorized" */, -1) return } @@ -100807,7 +101313,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+13518 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13533 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -100961,7 +101467,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) } else { - zSep = ts + 11522 /* "," */ + zSep = ts + 11537 /* "," */ nSep = 1 } if zSep != 0 { @@ -101039,7 +101545,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+13630 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+13645 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -101059,14 +101565,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+13636 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13651 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+13636 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13651 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13636 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13636 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13651 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13651 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -101171,76 +101677,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_implies_nonnull_row), FxSFunc: 0, FzName: ts + 13641 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_compare), FxSFunc: 0, FzName: ts + 13661 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_implies_expr), FxSFunc: 0, FzName: ts + 13674 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_implies_nonnull_row), FxSFunc: 0, FzName: ts + 13656 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_compare), FxSFunc: 0, FzName: ts + 13676 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_implies_expr), FxSFunc: 0, FzName: ts + 13689 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13692 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13700 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13700 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13715 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13741 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13766 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13775 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13786 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13793 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13807 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13807 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13813 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13813 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13819 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13819 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13824 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13824 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13824 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13828 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FzName: ts + 13828 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(1), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13828 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13832 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13839 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13846 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13852 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13859 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13867 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13872 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13882 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13888 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13894 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13898 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13905 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13912 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13923 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13930 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13945 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13962 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13973 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13979 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13997 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14005 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14019 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14027 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14036 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14036 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14053 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14057 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14063 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13707 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13715 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13715 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13730 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13756 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13781 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13790 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13801 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13808 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13822 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13822 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13828 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13828 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13834 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13834 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13839 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13839 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13839 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13843 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FzName: ts + 13843 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(1), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13843 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13847 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13854 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13861 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13867 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13874 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13882 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13887 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13891 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13891 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13897 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13903 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13909 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13913 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13920 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13927 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13938 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13945 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13960 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13977 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13988 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13994 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14012 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14020 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14034 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14042 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14051 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14051 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14058 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14058 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14068 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14072 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14078 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14082 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14082 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14088 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14088 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14086 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13636 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13636 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14091 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14091 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14100 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14091 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_iif), FxSFunc: 0, FzName: ts + 14105 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14101 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13651 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13651 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14106 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14106 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14115 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14106 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_iif), FxSFunc: 0, FzName: ts + 14120 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -101526,7 +102032,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+14109, /* "foreign key mism..." */ + ts+14124, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -102422,8 +102928,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 24 /* tOld */)) = Token{Fz: ts + 5452 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 32 /* tNew */)) = Token{Fz: ts + 5448 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 24 /* tOld */)) = Token{Fz: ts + 5467 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 32 /* tNew */)) = Token{Fz: ts + 5463 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+16, 8 // Name of column in child table // var tToCol Token at bp+8, 8 @@ -102511,7 +103017,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 40 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 40 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4235 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4250 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -102941,7 +103447,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6929 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6944 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -103505,7 +104011,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+14154, /* "cannot INSERT in..." */ + ts+14169, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*20)).FzName)) goto insert_cleanup __24: @@ -103530,7 +104036,7 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+14195, /* "table %S has no ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14210, /* "table %S has no ..." */ libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*8)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup @@ -103700,7 +104206,7 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+14227, /* "table %S has %d ..." */ + ts+14242, /* "table %S has %d ..." */ libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: @@ -103710,7 +104216,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+14279 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+14294 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -103766,7 +104272,7 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+14304, /* "UPSERT not imple..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14319, /* "UPSERT not imple..." */ libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: @@ -103774,7 +104280,7 @@ __56: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+14350 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14365 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -104254,7 +104760,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14371 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14386 /* "rows inserted" */, uintptr(0)) __123: ; @@ -104597,7 +105103,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -106000,7 +106506,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 740 /* "" */ + zSql = ts + 755 /* "" */ __2: ; @@ -106561,7 +107067,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10809 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10824 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -106571,7 +107077,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 14385 /* "sqlite3_extensio..." */ + zEntry = ts + 14400 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -106591,7 +107097,7 @@ __5: if !((ii < (int32(uint32(unsafe.Sizeof(azEndings)) / uint32(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+10770 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+10785 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -106637,7 +107143,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.Xmemcpy(tls, zAltEntry, ts+14408 /* "sqlite3_" */, uint32(8)) + libc.Xmemcpy(tls, zAltEntry, ts+14423 /* "sqlite3_" */, uint32(8)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { @@ -106651,7 +107157,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14417 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14432 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -106675,7 +107181,7 @@ __17: goto __18 __18: ; - libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14421 /* "_init" */, uint32(6)) + libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14436 /* "_init" */, uint32(6)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -106693,7 +107199,7 @@ __10: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14427 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + ts+14442 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; @@ -106718,7 +107224,7 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14470 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14485 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) @@ -106758,7 +107264,7 @@ extension_not_found: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14502 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + ts+14517 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; @@ -106768,7 +107274,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 14539, /* "so" */ + ts + 14554, /* "so" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -106934,7 +107440,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+14542 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + ts+14557 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) @@ -106979,61 +107485,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 4156, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 14581, /* "seq" */ - /* 2 */ ts + 7808, /* "table" */ - /* 3 */ ts + 14585, /* "from" */ - /* 4 */ ts + 14590, /* "to" */ - /* 5 */ ts + 14593, /* "on_update" */ - /* 6 */ ts + 14603, /* "on_delete" */ - /* 7 */ ts + 14613, /* "match" */ - /* 8 */ ts + 14619, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 14623, /* "name" */ - /* 10 */ ts + 14628, /* "type" */ - /* 11 */ ts + 14633, /* "notnull" */ - /* 12 */ ts + 14641, /* "dflt_value" */ - /* 13 */ ts + 14652, /* "pk" */ - /* 14 */ ts + 14655, /* "hidden" */ + /* 0 */ ts + 4171, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 14596, /* "seq" */ + /* 2 */ ts + 7823, /* "table" */ + /* 3 */ ts + 14600, /* "from" */ + /* 4 */ ts + 14605, /* "to" */ + /* 5 */ ts + 14608, /* "on_update" */ + /* 6 */ ts + 14618, /* "on_delete" */ + /* 7 */ ts + 14628, /* "match" */ + /* 8 */ ts + 14634, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 14638, /* "name" */ + /* 10 */ ts + 14643, /* "type" */ + /* 11 */ ts + 14648, /* "notnull" */ + /* 12 */ ts + 14656, /* "dflt_value" */ + /* 13 */ ts + 14667, /* "pk" */ + /* 14 */ ts + 14670, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 14662, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 14619, /* "cid" */ - /* 17 */ ts + 14623, /* "name" */ - /* 18 */ ts + 14668, /* "desc" */ - /* 19 */ ts + 14673, /* "coll" */ - /* 20 */ ts + 14678, /* "key" */ - /* 21 */ ts + 14623, /* "name" */ // Used by: function_list - /* 22 */ ts + 14682, /* "builtin" */ - /* 23 */ ts + 14628, /* "type" */ - /* 24 */ ts + 14690, /* "enc" */ - /* 25 */ ts + 14694, /* "narg" */ - /* 26 */ ts + 14699, /* "flags" */ - /* 27 */ ts + 10201, /* "tbl" */ // Used by: stats - /* 28 */ ts + 10197, /* "idx" */ - /* 29 */ ts + 14705, /* "wdth" */ - /* 30 */ ts + 14710, /* "hght" */ - /* 31 */ ts + 14715, /* "flgs" */ - /* 32 */ ts + 14581, /* "seq" */ // Used by: index_list - /* 33 */ ts + 14623, /* "name" */ - /* 34 */ ts + 14720, /* "unique" */ - /* 35 */ ts + 14727, /* "origin" */ - /* 36 */ ts + 14734, /* "partial" */ - /* 37 */ ts + 7808, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 14742, /* "rowid" */ - /* 39 */ ts + 4159, /* "parent" */ - /* 40 */ ts + 14748, /* "fkid" */ + /* 15 */ ts + 14677, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 14634, /* "cid" */ + /* 17 */ ts + 14638, /* "name" */ + /* 18 */ ts + 14683, /* "desc" */ + /* 19 */ ts + 14688, /* "coll" */ + /* 20 */ ts + 14693, /* "key" */ + /* 21 */ ts + 14638, /* "name" */ // Used by: function_list + /* 22 */ ts + 14697, /* "builtin" */ + /* 23 */ ts + 14643, /* "type" */ + /* 24 */ ts + 14705, /* "enc" */ + /* 25 */ ts + 14709, /* "narg" */ + /* 26 */ ts + 14714, /* "flags" */ + /* 27 */ ts + 10216, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10212, /* "idx" */ + /* 29 */ ts + 14720, /* "wdth" */ + /* 30 */ ts + 14725, /* "hght" */ + /* 31 */ ts + 14730, /* "flgs" */ + /* 32 */ ts + 14596, /* "seq" */ // Used by: index_list + /* 33 */ ts + 14638, /* "name" */ + /* 34 */ ts + 14735, /* "unique" */ + /* 35 */ ts + 14742, /* "origin" */ + /* 36 */ ts + 14749, /* "partial" */ + /* 37 */ ts + 7823, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 14757, /* "rowid" */ + /* 39 */ ts + 4174, /* "parent" */ + /* 40 */ ts + 14763, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 14581, /* "seq" */ // Used by: database_list - /* 42 */ ts + 14623, /* "name" */ - /* 43 */ ts + 14753, /* "file" */ - /* 44 */ ts + 14758, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 14763, /* "log" */ - /* 46 */ ts + 14767, /* "checkpointed" */ + /* 41 */ ts + 14596, /* "seq" */ // Used by: database_list + /* 42 */ ts + 14638, /* "name" */ + /* 43 */ ts + 14768, /* "file" */ + /* 44 */ ts + 14773, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 14778, /* "log" */ + /* 46 */ ts + 14782, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 14780, /* "database" */ // Used by: lock_status - /* 48 */ ts + 14789, /* "status" */ - /* 49 */ ts + 14796, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 14795, /* "database" */ // Used by: lock_status + /* 48 */ ts + 14804, /* "status" */ + /* 49 */ ts + 14811, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 14807, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 14822, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -107049,234 +107555,234 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [65]PragmaName{ - { /* zName: */ FzName: ts + 14815, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 14830, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14830, /* "application_id" */ + { /* zName: */ FzName: ts + 14845, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 14845, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 14860, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14857, /* "automatic_index" */ + { /* zName: */ FzName: ts + 14872, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 14873, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 14888, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 14796, /* "cache_size" */ + { /* zName: */ FzName: ts + 14811, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14886, /* "cache_spill" */ + { /* zName: */ FzName: ts + 14901, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14898, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 14913, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 14918, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 14933, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 14934, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 14949, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 14955, /* "collation_list" */ + { /* zName: */ FzName: ts + 14970, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 14970, /* "compile_options" */ + { /* zName: */ FzName: ts + 14985, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14986, /* "count_changes" */ + { /* zName: */ FzName: ts + 15001, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 15000, /* "data_version" */ + { /* zName: */ FzName: ts + 15015, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 15013, /* "database_list" */ + { /* zName: */ FzName: ts + 15028, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15027, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 15042, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15046, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 15061, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 15065, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 15080, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 15088, /* "encoding" */ + { /* zName: */ FzName: ts + 15103, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15097, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 15112, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 15115, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 15130, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 15132, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 15147, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 15145, /* "freelist_count" */ + { /* zName: */ FzName: ts + 15160, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 15160, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 15175, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 15178, /* "fullfsync" */ + { /* zName: */ FzName: ts + 15193, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 15188, /* "function_list" */ + { /* zName: */ FzName: ts + 15203, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15202, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 15217, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15218, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 15233, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 15243, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 15258, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 15262, /* "index_info" */ + { /* zName: */ FzName: ts + 15277, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15273, /* "index_list" */ + { /* zName: */ FzName: ts + 15288, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 15284, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 15299, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15296, /* "integrity_check" */ + { /* zName: */ FzName: ts + 15311, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15312, /* "journal_mode" */ + { /* zName: */ FzName: ts + 15327, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15325, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 15340, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15344, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 15359, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 15363, /* "locking_mode" */ + { /* zName: */ FzName: ts + 15378, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15376, /* "max_page_count" */ + { /* zName: */ FzName: ts + 15391, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15391, /* "mmap_size" */ + { /* zName: */ FzName: ts + 15406, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 15401, /* "module_list" */ + { /* zName: */ FzName: ts + 15416, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15413, /* "optimize" */ + { /* zName: */ FzName: ts + 15428, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 15422, /* "page_count" */ + { /* zName: */ FzName: ts + 15437, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15433, /* "page_size" */ + { /* zName: */ FzName: ts + 15448, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15443, /* "pragma_list" */ + { /* zName: */ FzName: ts + 15458, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15455, /* "query_only" */ + { /* zName: */ FzName: ts + 15470, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 15466, /* "quick_check" */ + { /* zName: */ FzName: ts + 15481, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15478, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 15493, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 15495, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 15510, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 15514, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 15529, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 15540, /* "schema_version" */ + { /* zName: */ FzName: ts + 15555, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 15555, /* "secure_delete" */ + { /* zName: */ FzName: ts + 15570, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15569, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 15584, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 15588, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 15603, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 15602, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 15617, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15618, /* "synchronous" */ + { /* zName: */ FzName: ts + 15633, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15630, /* "table_info" */ + { /* zName: */ FzName: ts + 15645, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15641, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 15656, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15653, /* "temp_store" */ + { /* zName: */ FzName: ts + 15668, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15664, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 15679, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 15685, /* "threads" */ + { /* zName: */ FzName: ts + 15700, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15693, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 15708, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 15708, /* "user_version" */ + { /* zName: */ FzName: ts + 15723, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 15721, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 15736, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 15740, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 15755, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15755, /* "writable_schema" */ + { /* zName: */ FzName: ts + 15770, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -107313,7 +107819,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 15771 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 15786 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -107330,10 +107836,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+15796 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15811 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15806 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15821 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -107346,13 +107852,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+15813 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15828 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15818 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15833 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+15823 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15838 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -107370,9 +107876,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+14753 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+14768 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+15835 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+15850 /* "memory" */) == 0 { return 2 } else { return 0 @@ -107388,7 +107894,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+15842 /* "temporary storag..." */, 0) + ts+15857 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpBt) @@ -107488,19 +107994,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 15904 /* "SET NULL" */ + zName = ts + 15919 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 15913 /* "SET DEFAULT" */ + zName = ts + 15928 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 15925 /* "CASCADE" */ + zName = ts + 15940 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 15933 /* "RESTRICT" */ + zName = ts + 15948 /* "RESTRICT" */ break default: - zName = ts + 15942 /* "NO ACTION" */ + zName = ts + 15957 /* "NO ACTION" */ break } return zName @@ -107518,7 +108024,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 15952 /* "delete" */, ts + 15959 /* "persist" */, ts + 15967 /* "off" */, ts + 15971 /* "truncate" */, ts + 15835 /* "memory" */, ts + 15980, /* "wal" */ + ts + 15967 /* "delete" */, ts + 15974 /* "persist" */, ts + 15982 /* "off" */, ts + 15986 /* "truncate" */, ts + 15850 /* "memory" */, ts + 15995, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -107564,13 +108070,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 15984 /* "w" */ + zType = ts + 15999 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 15986 /* "a" */ + zType = ts + 16001 /* "a" */ } else { - zType = ts + 15988 /* "s" */ + zType = ts + 16003 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15990, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16005, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -107579,7 +108085,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 15997 /* "utf8" */, ts + 16002 /* "utf16le" */, ts + 16010 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16012 /* "utf8" */, ts + 16017 /* "utf16le" */, ts + 16025 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -107841,7 +108347,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+16018 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+16033 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -107896,7 +108402,7 @@ __8: if !(*(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */))) __10: ; @@ -108468,7 +108974,7 @@ __18: if !(zRight != 0) { goto __62 } - if !(Xsqlite3_stricmp(tls, zRight, ts+16022 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+16037 /* "fast" */) == 0) { goto __63 } b = 2 @@ -108557,7 +109063,7 @@ __70: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 15806 /* "normal" */ + zRet = ts + 15821 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -108598,7 +109104,7 @@ __77: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __82 } - zRet = ts + 15796 /* "exclusive" */ + zRet = ts + 15811 /* "exclusive" */ __82: ; returnSingleText(tls, v, zRet) @@ -108963,7 +109469,7 @@ __122: if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 412 /* res */)) == 0)) { goto __125 } - Xsqlite3ErrorMsg(tls, pParse, ts+16027 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16042 /* "not a writable d..." */, 0) goto pragma_out __125: ; @@ -108981,7 +109487,7 @@ __126: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __127 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+16, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+16, zRight)) goto __128 __127: Xsqlite3_temp_directory = uintptr(0) @@ -109009,7 +109515,7 @@ __129: goto __131 } Xsqlite3ErrorMsg(tls, pParse, - ts+16052 /* "Safety level may..." */, 0) + ts+16067 /* "Safety level may..." */, 0) goto __132 __131: if !(iDb != 1) { @@ -109168,13 +109674,13 @@ __153: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 16105 /* "issisii" */ + return ts + 16120 /* "issisii" */ } - return ts + 16113 /* "issisi" */ + return ts + 16128 /* "issisi" */ }(), libc.VaList(bp+24, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -109249,7 +109755,7 @@ __165: goto __167 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16120 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16135 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -109259,7 +109765,7 @@ __165: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __168 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16125, /* "isiX" */ + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16140, /* "isiX" */ libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*4)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) @@ -109296,8 +109802,8 @@ __171: if !(pIdx1 != 0) { goto __173 } - *(*[3]uintptr)(unsafe.Pointer(bp + 416 /* azOrigin */)) = [3]uintptr{ts + 16130 /* "c" */, ts + 16132 /* "u" */, ts + 14652 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16134, /* "isisi" */ + *(*[3]uintptr)(unsafe.Pointer(bp + 416 /* azOrigin */)) = [3]uintptr{ts + 16145 /* "c" */, ts + 16147 /* "u" */, ts + 14667 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16149, /* "isisi" */ libc.VaList(bp+128, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), @@ -109331,7 +109837,7 @@ __174: __177: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16140, /* "iss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16155, /* "iss" */ libc.VaList(bp+168, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*16)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*16)).FpBt))) @@ -109354,7 +109860,7 @@ __178: goto __180 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16144 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16159 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __179 __179: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -109418,7 +109924,7 @@ __190: goto __192 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15988 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16003 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __191 __191: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -109435,7 +109941,7 @@ __193: if !(i6 < (int32(uint32(unsafe.Sizeof(aPragmaName)) / uint32(unsafe.Sizeof(PragmaName{}))))) { goto __195 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15988 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16003 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) goto __194 __194: i6++ @@ -109471,7 +109977,7 @@ __201: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __203 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16147, /* "iissssss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16162, /* "iissssss" */ libc.VaList(bp+224, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, @@ -109479,7 +109985,7 @@ __201: (*sColMap)(unsafe.Pointer((pFK+36 /* &.aCol */)+uintptr(j2)*8)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 25 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 25 /* &.aAction */)))), // ON DELETE - ts+16156 /* "NONE" */)) + ts+16171 /* "NONE" */)) goto __202 __202: j2++ @@ -109672,7 +110178,7 @@ __230: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __231: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16161 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16176 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 432 /* aiCols */))) @@ -109938,7 +110444,7 @@ __258: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+16165 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*16)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+16180 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*16)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -110028,7 +110534,7 @@ __277: __278: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+16189 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+16204 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*20)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -110068,7 +110574,7 @@ __283: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+16209, /* "CHECK constraint..." */ + zErr1 = Xsqlite3MPrintf(tls, db, ts+16224, /* "CHECK constraint..." */ libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) @@ -110102,9 +110608,9 @@ __288: // Verify that an index entry exists for the current table row jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 444 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16239 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16254 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+16244 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16259 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -110144,7 +110650,7 @@ __292: Xsqlite3VdbeJumpHere(tls, v, jmp6) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 444 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16265 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16280 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __289: @@ -110166,7 +110672,7 @@ __284: if !(!(isQuick != 0)) { goto __294 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+16292 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+16307 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __295: @@ -110217,7 +110723,7 @@ __240: } (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 436 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*20)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16 /* &.p4 */)) = ts + 16321 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16 /* &.p4 */)) = ts + 16336 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*20)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*20 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __299: @@ -110295,7 +110801,7 @@ __306: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __308 } - Xsqlite3ErrorMsg(tls, pParse, ts+16324 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+16339 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) __308: ; __303: @@ -110407,19 +110913,19 @@ __47: if !(zRight != 0) { goto __315 } - if !(Xsqlite3StrICmp(tls, zRight, ts+15818 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15833 /* "full" */) == 0) { goto __316 } eMode2 = SQLITE_CHECKPOINT_FULL goto __317 __316: - if !(Xsqlite3StrICmp(tls, zRight, ts+16349 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16364 /* "restart" */) == 0) { goto __318 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __319 __318: - if !(Xsqlite3StrICmp(tls, zRight, ts+15971 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15986 /* "truncate" */) == 0) { goto __320 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -110606,7 +111112,7 @@ __335: __337: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+16357, /* "ANALYZE \"%w\".\"%w..." */ + zSubSql = Xsqlite3MPrintf(tls, db, ts+16372, /* "ANALYZE \"%w\".\"%w..." */ libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __338 @@ -110790,14 +111296,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 16375 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 16380 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 16386 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 16395 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 16404 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 16412 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 16420 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 16427 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16390 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16395 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16401 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16410 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16419 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16427 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16435 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16442 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -110854,7 +111360,7 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argc _ = argv Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+56 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16433 /* "CREATE TABLE x" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16448 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -110862,7 +111368,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16448 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16463 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -110875,19 +111381,19 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16455 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16470 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16461 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16476 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16473 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16488 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4066 /* ")" */, 1) Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) rc = Xsqlite3_declare_vtab(tls, db, bp+56 /* &zBuf[0] */) @@ -110903,7 +111409,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -111066,7 +111572,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + uintptr(j)*4)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + uintptr(j)*4)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + uintptr(j)*4)) == uintptr(0) { return SQLITE_NOMEM } @@ -111082,13 +111588,13 @@ __2: __3: ; Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 108 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16488 /* "PRAGMA " */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16503 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + 1*4)) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16496 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + 1*4)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16511 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + 1*4)))) } Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16500 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16515 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */))))) } zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { @@ -111097,7 +111603,7 @@ __3: rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 4 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -111190,12 +111696,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+16504 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), + ts+16519 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 16532 /* "rename" */ + return ts + 16547 /* "rename" */ } - return ts + 16539 /* "drop column" */ + return ts + 16554 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -111207,11 +111713,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*4)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*4)) } else { - zObj = ts + 4107 /* "?" */ + zObj = ts + 4122 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+16551 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+16566 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+16582 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+16597 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -111288,7 +111794,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), (db+160 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12835 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12850 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+160 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -111325,13 +111831,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*4)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+16590 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+16605 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), (pIndex+44 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12835 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12850 /* "invalid rootpage" */) } } } @@ -111374,16 +111880,16 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7808 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7823 /* "table" */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*4)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*4)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*4)) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*4)) = ts + 6898 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*4)) = ts + 16603 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*4)) = ts + 6913 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*4)) = ts + 16618 /* "CREATE TABLE x(t..." */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*4)) = uintptr(0) (*InitData)(unsafe.Pointer(bp + 40 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 40 /* &initData */)).FiDb = iDb @@ -111496,7 +112002,7 @@ __10: goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+10484 /* "attached databas..." */) + ts+10499 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -111536,7 +112042,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+16675 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+16690 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -111558,7 +112064,7 @@ __18: (*InitData)(unsafe.Pointer(bp + 40 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+16699, /* "SELECT*FROM\"%w\"...." */ + ts+16714, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth @@ -111918,7 +112424,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+16733 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+16748 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -111946,7 +112452,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16763 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16778 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -112009,7 +112515,7 @@ __19: if !(*(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */)))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */))) goto __21 __20: @@ -112484,24 +112990,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 9637 /* " " */ + var zSp uintptr = ts + 9652 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+16782 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+16797 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+16826 /* "RIGHT and FULL O..." */, 0) + ts+16841 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16881 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16896 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -112707,7 +113213,7 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16915 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+16930 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { @@ -112731,7 +113237,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16965 /* "cannot have both..." */, 0) + ts+16980 /* "cannot have both..." */, 0) return 1 } @@ -112766,7 +113272,7 @@ __1: if (iRightCol < 0) || !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17020 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + ts+17035 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, @@ -113557,16 +114063,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 17084 /* "UNION ALL" */ + z = ts + 17099 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 17094 /* "INTERSECT" */ + z = ts + 17109 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 17104 /* "EXCEPT" */ + z = ts + 17119 /* "EXCEPT" */ break default: - z = ts + 17111 /* "UNION" */ + z = ts + 17126 /* "UNION" */ break } return z @@ -113584,7 +114090,7 @@ func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite bp := tls.Alloc(8) defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17117 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17132 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -113850,8 +114356,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 11369 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 40 /* zOrigCol */)) = ts + 14742 /* "rowid" */ + zType = ts + 11384 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 40 /* zOrigCol */)) = ts + 14757 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 40 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20), uintptr(0)) @@ -114004,13 +114510,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 14742 /* "rowid" */ + zCol = ts + 14757 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -114018,7 +114524,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*20)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+17140 /* "column%d" */, libc.VaList(bp+16, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+17155 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -114107,7 +114613,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20)).FzName } else { - zName = ts + 14742 /* "rowid" */ + zName = ts + 14757 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -114120,7 +114626,7 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+17140 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+17155 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, @@ -114135,7 +114641,7 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+17149 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 48 /* cnt */)), 1))) + zName = Xsqlite3MPrintf(tls, db, ts+17164 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 48 /* cnt */)), 1))) if *(*U32)(unsafe.Pointer(bp + 48 /* cnt */)) > U32(3) { Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+48 /* &cnt */) } @@ -114492,7 +114998,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+17157 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17172 /* "cannot use windo..." */, 0) return __1: ; @@ -114603,7 +115109,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+17206 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17221 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -114625,7 +115131,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17248 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17263 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -114668,7 +115174,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17254 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17269 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -114718,11 +115224,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17269 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17284 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 17292 /* "S" */ + return ts + 17307 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -114874,8 +115380,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17294 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17309 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17309 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17324 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -114924,7 +115430,7 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17084 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17099 /* "UNION ALL" */, 0) rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) @@ -115000,7 +115506,7 @@ __23: pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 48 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17328 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17343 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+48 /* &uniondest */) @@ -115072,7 +115578,7 @@ __26: pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 76 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17328 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17343 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+76 /* &intersectdest */) @@ -115233,10 +115739,10 @@ func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17349 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17364 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+17395, /* "SELECTs to the l..." */ + ts+17410, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -115616,9 +116122,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6236 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6251 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6236 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6251 /* "ORDER" */) } // Compute the limit registers @@ -115647,7 +116153,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) Xsqlite3SelectDestInit(tls, bp+36 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17477 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17492 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -115655,7 +116161,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17488 /* "LEFT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17503 /* "LEFT" */, 0) Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -115669,7 +116175,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17493 /* "RIGHT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17508 /* "RIGHT" */, 0) Xsqlite3Select(tls, pParse, p, bp+36 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -115865,7 +116371,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 303 /* "BINARY" */ + return ts + 318 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -117078,12 +117584,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+13824 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+13839 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+13828 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+13843 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -117152,7 +117658,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+17499 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+17514 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -117263,7 +117769,7 @@ func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* s defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 36 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17517 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17532 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -117451,7 +117957,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+36 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+17540 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+17555 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -117467,7 +117973,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17583 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17598 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { @@ -117493,7 +117999,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+17606, /* "table %s has %d ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17621, /* "table %s has %d ..." */ libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 @@ -117504,9 +118010,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 42 /* &.nCol */), (pTab + 4 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17644 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17659 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17678 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17693 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -117554,7 +118060,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17716 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17731 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -117681,7 +118187,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+17728, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17743, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -117700,7 +118206,7 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+17767, /* "access to view \"..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17782, /* "access to view \"..." */ libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -117708,7 +118214,7 @@ __1: ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 36 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+17798, /* "unsafe use of vi..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17813, /* "unsafe use of vi..." */ libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) @@ -117823,7 +118329,7 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName } else { - zSchemaName = ts + 17831 /* "*" */ + zSchemaName = ts + 17846 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { @@ -117872,7 +118378,7 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { @@ -117888,7 +118394,7 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*20)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17833, /* "%s.%s.%s" */ + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17848, /* "%s.%s.%s" */ libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } @@ -117908,9 +118414,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17842 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17857 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+17860 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17875 /* "no tables specif..." */, 0) } } } @@ -117920,7 +118426,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+17880 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17895 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -118108,13 +118614,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 20 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 20 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+17911 /* "DISTINCT aggrega..." */, 0) + ts+17926 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 20 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17962 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17977 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -118314,19 +118820,19 @@ func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintpt if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 56 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17995, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18010, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 18007 /* " USING COVERING ..." */ + return ts + 18022 /* " USING COVERING ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) } } @@ -118346,7 +118852,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6898 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6913 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -118648,7 +119154,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+18030, /* "target object/al..." */ + ts+18045, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -118728,7 +119234,7 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18084, /* "expected %d colu..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18099, /* "expected %d colu..." */ libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: @@ -118869,7 +119375,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+740 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+755 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -118934,7 +119440,7 @@ __35: (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop Xsqlite3SelectDestInit(tls, bp+88 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18124 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18139 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+88 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+36 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) @@ -118996,7 +119502,7 @@ __44: __45: ; Xsqlite3SelectDestInit(tls, bp+88 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18139 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18154 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+88 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { @@ -119516,9 +120022,9 @@ __97: explainTempTable(tls, pParse, func() uintptr { if ((*DistinctCtx)(unsafe.Pointer(bp+116 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 18155 /* "DISTINCT" */ + return ts + 18170 /* "DISTINCT" */ } - return ts + 18164 /* "GROUP BY" */ + return ts + 18179 /* "GROUP BY" */ }()) groupBySort = 1 @@ -119930,7 +120436,7 @@ __58: if !(int32((*DistinctCtx)(unsafe.Pointer(bp+116 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+18155 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+18170 /* "DISTINCT" */) __140: ; @@ -119942,9 +120448,9 @@ __140: explainTempTable(tls, pParse, func() uintptr { if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { - return ts + 18173 /* "RIGHT PART OF OR..." */ + return ts + 18188 /* "RIGHT PART OF OR..." */ } - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ }()) generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) @@ -120077,7 +120583,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*4)))) + z = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*4)))) if !(z == uintptr(0)) { goto __10 } @@ -120099,7 +120605,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+18205 /* "sqlite3_get_tabl..." */, 0) + ts+18220 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -120198,7 +120704,7 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } @@ -120359,7 +120865,7 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+18270 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18285 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; @@ -120420,7 +120926,7 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+36 /* &sFix */, pParse, iDb, ts+18316 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3FixInit(tls, bp+36 /* &sFix */, pParse, iDb, ts+18331 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+36 /* &sFix */, pTableName) != 0) { goto __9 } @@ -120438,7 +120944,7 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+18324 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18339 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; @@ -120453,7 +120959,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18316 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18331 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -120469,7 +120975,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+18365 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+18380 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -120483,10 +120989,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18391 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18406 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -120496,12 +121002,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+18429, /* "cannot create %s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18444, /* "cannot create %s..." */ libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 18466 /* "BEFORE" */ + return ts + 18481 /* "BEFORE" */ } - return ts + 18473 /* "AFTER" */ + return ts + 18488 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -120510,7 +121016,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+18479 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + ts+18494 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -120540,9 +121046,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -120676,7 +121182,7 @@ __2: __3: ; Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+48 /* &sFix */, pParse, iDb, ts+18316 /* "trigger" */, bp+40 /* &nameToken */) + Xsqlite3FixInit(tls, bp+48 /* &sFix */, pParse, iDb, ts+18331 /* "trigger" */, bp+40 /* &nameToken */) if !((Xsqlite3FixTriggerStep(tls, bp+48 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || (Xsqlite3FixExpr(tls, bp+48 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 @@ -120713,13 +121219,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+18525, /* "INSERT INTO %Q.s..." */ + ts+18540, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+18600 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+18615 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -120985,7 +121491,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+18629 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+18644 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -121026,9 +121532,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -121041,7 +121547,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+18649, /* "DELETE FROM %Q.s..." */ + ts+18664, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -121160,12 +121666,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+18711, /* "%s RETURNING is ..." */ + ts+18726, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 18759 /* "DELETE" */ + return ts + 18774 /* "DELETE" */ } - return ts + 18766 /* "UPDATE" */ + return ts + 18781 /* "UPDATE" */ }())) __15: ; @@ -121261,7 +121767,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+18773 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18788 /* "RETURNING may no..." */, 0) return 1 } @@ -121402,7 +121908,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+5128 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+5143 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -121532,7 +122038,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+18815 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+18830 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -122235,7 +122741,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+18829, /* "cannot UPDATE ge..." */ + ts+18844, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*20)).FzName)) goto update_cleanup __27: @@ -122267,7 +122773,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+18865 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*20)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18880 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*20)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -122278,7 +122784,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 6673 /* "ROWID" */ + return ts + 6688 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*20)).FzName }(), @@ -123309,7 +123815,7 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18884 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18899 /* "rows updated" */, uintptr(0)) __169: ; @@ -123696,10 +124202,10 @@ __1: if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { *(*int8)(unsafe.Pointer(bp + 152 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+152 /* &zWhich[0] */, ts+18897 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+152 /* &zWhich[0] */, ts+18912 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+18901 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+152 /* &zWhich[0] */)) + ts+18916 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+152 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -123790,7 +124296,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+10911 /* "corrupt database" */, -1) + ts+10926 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -123858,7 +124364,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+18974 /* "CRE" */, uint32(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18978 /* "INS" */, uint32(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+18989 /* "CRE" */, uint32(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18993 /* "INS" */, uint32(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -124008,14 +124514,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+18982 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+18997 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19022 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19037 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -124026,7 +124532,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19065 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19080 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -124035,7 +124541,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 56 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 740 /* "" */ + zOut = ts + 755 /* "" */ __4: ; @@ -124071,7 +124577,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+19083 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+19098 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -124092,7 +124598,7 @@ __6: goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+19106 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19121 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -124108,7 +124614,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+13198 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+13213 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -124159,7 +124665,7 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+19133, /* "SELECT sql FROM ..." */ + ts+19148, /* "SELECT sql FROM ..." */ libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 @@ -124169,7 +124675,7 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+19241, /* "SELECT sql FROM ..." */ + ts+19256, /* "SELECT sql FROM ..." */ libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 @@ -124184,7 +124690,7 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+19295, /* "SELECT'INSERT IN..." */ + ts+19310, /* "SELECT'INSERT IN..." */ libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 24 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) @@ -124201,7 +124707,7 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+19446, /* "INSERT INTO vacu..." */ + ts+19461, /* "INSERT INTO vacu..." */ libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 @@ -124581,7 +125087,7 @@ func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintp var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 108 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11141 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11156 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -124675,7 +125181,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32(((int32((*Token)(unsafe.Pointer(pEnd)).Fz) - int32((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1)) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+19576 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+180 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+19591 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+180 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -124687,7 +125193,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+19600, /* "UPDATE %Q.sqlite..." */ + ts+19615, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -124697,7 +125203,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+19699 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+19714 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -124762,7 +125268,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+19718 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+19733 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -124800,9 +125306,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19760 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19775 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2775 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2790 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) @@ -124814,7 +125320,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 19790 /* "vtable construct..." */ + var zFormat uintptr = ts + 19805 /* "vtable construct..." */ *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR @@ -124830,12 +125336,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20), ts+740 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20), ts+755 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+14655 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+14670 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -124894,13 +125400,13 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+19836 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+19851 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) @@ -124962,7 +125468,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19836 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19851 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -125039,7 +125545,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 280 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 280 /* zErr */)))) @@ -125411,7 +125917,7 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 @@ -125837,10 +126343,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 19855 /* "" */ + return ts + 19870 /* "" */ } if i == (-1) { - return ts + 14742 /* "rowid" */ + return ts + 14757 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*20)).FzName } @@ -125855,35 +126361,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+19862 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19877 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19868 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19883 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11537 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19868 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19883 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11537 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+4107 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4122 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } } @@ -125912,29 +126418,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+19870 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+19885 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+19862 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19877 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 19873 /* "%s=?" */ + return ts + 19888 /* "%s=?" */ } - return ts + 19878 /* "ANY(%s)" */ + return ts + 19893 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19886 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19901 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19888 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19903 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -125979,11 +126485,11 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+72 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19890 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19905 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 19896 /* "SEARCH" */ + return ts + 19911 /* "SEARCH" */ } - return ts + 19903 /* "SCAN" */ + return ts + 19918 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -125993,38 +126499,38 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 56 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 9685 /* "PRIMARY KEY" */ + zFmt = ts + 9700 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 19908 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 19923 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 19941 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 19956 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 19966 /* "COVERING INDEX %..." */ + zFmt = ts + 19981 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 19984 /* "INDEX %s" */ + zFmt = ts + 19999 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+48 /* &str */, ts+19993 /* " USING " */, 7) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20008 /* " USING " */, 7) Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 20001 /* "=" */ + zRangeOp = ts + 20016 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 20003 /* ">? AND rowid<" */ + zRangeOp = ts + 20018 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 19886 /* ">" */ + zRangeOp = ts + 19901 /* ">" */ } else { - zRangeOp = ts + 19888 /* "<" */ + zRangeOp = ts + 19903 /* "<" */ } Xsqlite3_str_appendf(tls, bp+48, /* &str */ - ts+20017 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + ts+20032 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20055, /* " VIRTUAL TABLE I..." */ + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20070, /* " VIRTUAL TABLE I..." */ libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) @@ -127580,7 +128086,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20082 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20097 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*48) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -127599,7 +128105,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20097 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20112 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -128348,10 +128854,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 14613 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 14086 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 13636 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 20106 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 14628 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14101 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 13651 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20121 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -129052,7 +129558,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+20113 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20128 /* "ON clause refere..." */, 0) return } } @@ -129128,7 +129634,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5760 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5775 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -129229,7 +129735,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 16 /* noCase */)) != 0 { - return ts + 20154 /* "NOCASE" */ + return ts + 20169 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -129531,7 +130037,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+20161, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+20176, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -130354,7 +130860,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+20197 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+20212 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*20)).FzName)) sentWarning = U8(1) __6: @@ -130435,7 +130941,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20223 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20238 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -130668,7 +131174,7 @@ __3: ((uint32(unsafe.Sizeof(sqlite3_index_constraint{})) + uint32(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint32(nTerm))) + (uint32(unsafe.Sizeof(sqlite3_index_orderby{})) * uint32(nOrderBy))) + uint32(unsafe.Sizeof(HiddenIndexInfo1{}))))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5166 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5181 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*64) @@ -130795,9 +131301,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -132847,7 +133353,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*4)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20234 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20249 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -132895,7 +133401,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*4)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+20234 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20249 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -133284,7 +133790,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+20260 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+20275 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -134053,7 +134559,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+20295 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20310 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -134434,7 +134940,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint32(unsafe.Sizeof(Bitmask(0))) * uint32(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+20313 /* "at most %d table..." */, libc.VaList(bp, (int32(uint32(unsafe.Sizeof(Bitmask(0)))*uint32(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+20328 /* "at most %d table..." */, libc.VaList(bp, (int32(uint32(unsafe.Sizeof(Bitmask(0)))*uint32(8))))) return uintptr(0) __3: ; @@ -134509,7 +135015,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20341 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20356 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -135644,7 +136150,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+20359 /* "second argument ..." */, -1) + pCtx, ts+20374 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -135793,7 +136299,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+20415 /* "argument of ntil..." */, -1) + pCtx, ts+20430 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -135889,17 +136395,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20460 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20471 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20482 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20487 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20500 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20510 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20516 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20527 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20537 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20549 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20554 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20475 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20486 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20497 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20502 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20515 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20525 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20531 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20542 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20552 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20564 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20569 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -135963,7 +136469,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20558 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20573 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -136007,12 +136513,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+20577 /* "RANGE with offse..." */, 0) + ts+20592 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20648 /* "FILTER clause ma..." */, 0) + ts+20663 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -136035,7 +136541,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*16)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6898 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6913 /* "1" */) } break } @@ -136276,7 +136782,7 @@ func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+6959 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+6974 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -136406,7 +136912,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 28 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 28 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -136546,7 +137052,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+20711 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20726 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -136612,15 +137118,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 20743 /* "PARTITION clause" */ + zErr = ts + 20758 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 20760 /* "ORDER BY clause" */ + zErr = ts + 20775 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 20776 /* "frame specificat..." */ + zErr = ts + 20791 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20796 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+20811 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -136643,7 +137149,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+20829 /* "DISTINCT is not ..." */, 0) + ts+20844 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -136794,7 +137300,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -136816,11 +137322,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 20876, /* "frame starting o..." */ - ts + 20929, /* "frame ending off..." */ - ts + 20359, /* "second argument ..." */ - ts + 20980, /* "frame starting o..." */ - ts + 21032, /* "frame ending off..." */ + ts + 20891, /* "frame starting o..." */ + ts + 20944, /* "frame ending off..." */ + ts + 20374, /* "second argument ..." */ + ts + 20995, /* "frame starting o..." */ + ts + 21047, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -137421,7 +137927,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -138434,19 +138940,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21082, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21097, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ } - return ts + 21124 /* "LIMIT" */ + return ts + 21139 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 108 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+21130 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21145 /* "too many terms i..." */, 0) } } @@ -138526,7 +139032,7 @@ func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdT var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21164, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21179, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -139751,7 +140257,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+21202 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21217 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -140730,11 +141236,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz, ts+14742 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz, ts+14757 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+21224 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+21239 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz)) } } break @@ -141469,7 +141975,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*12 + 4 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)), ts+21251 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)), ts+21266 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 4 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*12 + 4 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -141622,7 +142128,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(bp + 68 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 4 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21260 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+68 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21275 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+68 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 4 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 4 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) @@ -141826,9 +142332,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*12 + 4 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*12 + 4 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*12 + 4 /* &.minor */)) != 0 { - return ts + 6898 /* "1" */ + return ts + 6913 /* "1" */ } - return ts + 6491 /* "0" */ + return ts + 6506 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -142103,21 +142609,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 4 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+21284 /* "qualified table ..." */, 0) + ts+21299 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21379 /* "the INDEXED BY c..." */, 0) + ts+21394 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21463 /* "the NOT INDEXED ..." */, 0) + ts+21478 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ @@ -142566,9 +143072,9 @@ func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor To _ = yymajor // Silence some compiler warnings if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21260 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21275 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21548 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21563 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -143775,7 +144281,7 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin *(*int32)(unsafe.Pointer(bp + 1252 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21565 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+21580 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } @@ -143795,12 +144301,12 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21592, /* "%s in \"%s\"" */ + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21607, /* "%s in \"%s\"" */ libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ @@ -144012,7 +144518,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21603 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21618 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -144025,11 +144531,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18316 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18331 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21610 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21625 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21615 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21630 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -144042,9 +144548,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21625 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21640 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21629 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21644 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -145072,7 +145578,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+21637 /* "unable to close ..." */, 0) + ts+21652 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -145294,23 +145800,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 21705 /* "unknown error" */ + var zErr uintptr = ts + 21720 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 21719 /* "abort due to ROL..." */ + zErr = ts + 21734 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 21741 /* "another row avai..." */ + zErr = ts + 21756 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 21763 /* "no more rows ava..." */ + zErr = ts + 21778 /* "no more rows ava..." */ break } @@ -145328,35 +145834,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 21786, /* "not an error" */ - /* SQLITE_ERROR */ ts + 21799, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 21801, /* "not an error" */ + /* SQLITE_ERROR */ ts + 21814, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 21815, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 21840, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 21854, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 21873, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 5166, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 21898, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 21935, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 21947, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 21962, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 21995, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 22013, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 22038, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 22067, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 21830, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 21855, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 21869, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 21888, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5181, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 21913, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 21950, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 21962, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 21977, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 22010, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22028, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22053, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22082, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 4896, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 4433, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 22084, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 22102, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 22120, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 4911, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4448, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22099, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22117, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22135, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 22154, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 22169, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 22175, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 22201, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 22224, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 22245, /* "warning message" */ + /* SQLITE_RANGE */ ts + 22190, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22216, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22239, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22260, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -145521,7 +146027,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22261 /* "unable to delete..." */, 0) + ts+22276 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -145654,7 +146160,7 @@ func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUs _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+22324 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+22339 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -145876,7 +146382,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22375 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22390 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -146095,7 +146601,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22396 /* "unable to delete..." */, 0) + ts+22411 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -146238,7 +146744,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22464 /* "file:" */, uint32(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22479 /* "file:" */, uint32(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -146286,10 +146792,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22470 /* "localhost" */, (zUri+7), uint32(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22485 /* "localhost" */, (zUri+7), uint32(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22480, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22495, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -146411,7 +146917,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22508 /* "vfs" */, zOpt, uint32(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22523 /* "vfs" */, zOpt, uint32(3)) == 0)) { goto __29 } zVfs = zVal @@ -146422,17 +146928,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22512 /* "cache" */, zOpt, uint32(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22527 /* "cache" */, zOpt, uint32(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 22512 /* "cache" */ + zModeType = ts + 22527 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22518 /* "mode" */, zOpt, uint32(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22533 /* "mode" */, zOpt, uint32(4)) == 0)) { goto __32 } @@ -146440,7 +146946,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 2384 /* "access" */ + zModeType = ts + 2399 /* "access" */ __32: ; @@ -146471,7 +146977,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22523 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22538 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -146479,7 +146985,7 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22543, /* "%s mode not allo..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22558, /* "%s mode not allo..." */ libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out @@ -146522,7 +147028,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22567 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22582 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -146545,15 +147051,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 22583 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 22590 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 22598 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 22605 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 22598 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 22601 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 22604 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 15835 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 22613 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 22616 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 22619 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 15850 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -146735,10 +147241,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+20154 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+20169 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+22608 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+22623 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -146784,7 +147290,7 @@ __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)))) @@ -146822,9 +147328,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5443 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5458 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*16)).FzDbSName = ts + 21610 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*16)).FzDbSName = ts + 21625 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*16)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -146942,7 +147448,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 22614 /* "\x00\x00" */ + zFilename = ts + 22629 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -147045,24 +147551,24 @@ func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) bp := tls.Alloc(24) defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+22617, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+22632, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22642 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22657 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22662 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22677 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22669 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22684 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -147189,7 +147695,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 11369 /* "INTEGER" */ + zDataType = ts + 11384 /* "INTEGER" */ primarykey = 1 __13: ; @@ -147241,14 +147747,14 @@ __19: goto __20 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22686 /* "no such table co..." */, libc.VaList(bp, zTableName, + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22701 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -148047,7 +148553,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+22714 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+22729 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -148208,7 +148714,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 22722 /* "database is dead..." */ + return ts + 22737 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -149007,7 +149513,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 5243 /* "null" */, ts + 5755 /* "true" */, ts + 5760 /* "false" */, ts + 5253 /* "integer" */, ts + 5248 /* "real" */, ts + 13508 /* "text" */, ts + 22745 /* "array" */, ts + 22751, /* "object" */ + ts + 5258 /* "null" */, ts + 5770 /* "true" */, ts + 5775 /* "false" */, ts + 5268 /* "integer" */, ts + 5263 /* "real" */, ts + 13523 /* "text" */, ts + 22760 /* "array" */, ts + 22766, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -149187,7 +149693,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 22758 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 22773 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -149215,7 +149721,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+5258 /* "null" */, uint32(4)) break } @@ -149244,7 +149750,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22775 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22790 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -149321,19 +149827,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5258 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+5755 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5770 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+5760 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+5775 /* "false" */, uint32(5)) break } @@ -149899,17 +150405,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5243 /* "null" */, uint32(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5258 /* "null" */, uint32(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5755 /* "true" */, uint32(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5770 /* "true" */, uint32(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5760 /* "false" */, uint32(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5775 /* "false" */, uint32(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -150017,7 +150523,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+22804 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+22819 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -150337,7 +150843,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+22819 /* "[0]" */, uint32(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+22834 /* "[0]" */, uint32(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -150354,7 +150860,7 @@ func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190 bp := tls.Alloc(8) defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+22823 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+22838 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -150421,7 +150927,7 @@ func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlit bp := tls.Alloc(8) defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22849, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22864, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -150565,7 +151071,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+5258 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -150693,14 +151199,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+22892 /* "json_object() re..." */, -1) + ts+22907 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+22943 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+22958 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -150808,7 +151314,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+14019 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+14034 /* "replace" */) return __2: ; @@ -150894,9 +151400,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 22977 /* "set" */ + return ts + 22992 /* "set" */ } - return ts + 22981 /* "insert" */ + return ts + 22996 /* "insert" */ }()) return __2: @@ -151044,7 +151550,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22988 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23003 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -151149,7 +151655,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22991 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23006 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -151202,7 +151708,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+22994 /* "CREATE TABLE x(k..." */) + ts+23009 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -151340,14 +151846,14 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*12) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*12) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+23077 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+23092 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 12 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23082 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23097 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } @@ -151440,9 +151946,9 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+24 /* &x */, ts+23077 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23092 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23082 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23097 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } jsonResult(tls, bp+24 /* &x */) @@ -151466,7 +151972,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 23088 /* "$" */ + zRoot = ts + 23103 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -151598,7 +152104,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22804 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22819 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -151738,21 +152244,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 23090 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23095 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23106 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23106 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23124 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23137 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23149 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23161 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23172 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23183 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23195 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23208 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 23217 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23217 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23227 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23105 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23110 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23121 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23121 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23139 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23152 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23164 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23176 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23187 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23198 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23210 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23223 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23232 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23232 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23242 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -151761,17 +152267,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 23238 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 23253 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 23255 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 23270 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 23273 /* "json_each" */, FpModule: 0}, - {FzName: ts + 23283 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 23288 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23298 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -152114,11 +152620,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+23293 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23308 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23301 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23316 /* "data" */, iNode, 0, (pRtree + 72 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -152363,7 +152869,7 @@ func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+23306, /* "DROP TABLE '%q'...." */ + ts+23321, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -153123,7 +153629,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23388 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23403 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -153387,7 +153893,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+24 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+24 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -154647,7 +155153,7 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+23402 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+23417 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { @@ -154659,12 +155165,12 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if iCol == 0 { var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23422 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+23437 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23454 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+23469 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } @@ -154932,7 +155438,7 @@ func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqli var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+23491 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+23506 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -154970,7 +155476,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit bp := tls.Alloc(20) defer tls.Free(20) - var zFmt uintptr = ts + 23636 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 23651 /* "SELECT stat FROM..." */ var zSql uintptr // var p uintptr at bp+16, 4 @@ -154978,7 +155484,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10057 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10072 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -155031,7 +155537,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 23692 /* "node" */, ts + 4159 /* "parent" */, ts + 14742, /* "rowid" */ + ts + 23707 /* "node" */, ts + 4174 /* "parent" */, ts + 14757, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -155075,19 +155581,19 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+23697, /* "CREATE TABLE \"%w..." */ + ts+23712, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+23759 /* ",a%d" */, libc.VaList(bp+16, ii)) + Xsqlite3_str_appendf(tls, p, ts+23774 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+23764, /* ");CREATE TABLE \"..." */ + ts+23779, /* ");CREATE TABLE \"..." */ libc.VaList(bp+24, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23828, /* "CREATE TABLE \"%w..." */ + ts+23843, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23898, /* "INSERT INTO \"%w\"..." */ + ts+23913, /* "INSERT INTO \"%w\"..." */ libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { @@ -155118,7 +155624,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 23947 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 23962 /* "INSERT INTO\"%w\"...." */ } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { @@ -155130,7 +155636,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+24055, /* "SELECT * FROM \"%..." */ + ts+24070, /* "SELECT * FROM \"%..." */ libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM @@ -155138,18 +155644,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+24100 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+24115 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+11537 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+24127 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+24142 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+24149 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+24164 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+24157 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+24172 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -155165,18 +155671,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 24173, /* "INSERT OR REPLAC..." */ - ts + 24226, /* "DELETE FROM '%q'..." */ + ts + 24188, /* "INSERT OR REPLAC..." */ + ts + 24241, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 24271, /* "SELECT nodeno FR..." */ - ts + 24323, /* "INSERT OR REPLAC..." */ - ts + 24377, /* "DELETE FROM '%q'..." */ + ts + 24286, /* "SELECT nodeno FR..." */ + ts + 24338, /* "INSERT OR REPLAC..." */ + ts + 24392, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 24422, /* "SELECT parentnod..." */ - ts + 24480, /* "INSERT OR REPLAC..." */ - ts + 24535, /* "DELETE FROM '%q'..." */ + ts + 24437, /* "SELECT parentnod..." */ + ts + 24495, /* "INSERT OR REPLAC..." */ + ts + 24550, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -155223,7 +155729,7 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr var zSql uintptr if isCreate != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+24582 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, ts+24597 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) @@ -155231,19 +155737,19 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+24602, /* "SELECT length(da..." */ + ts+24617, /* "SELECT length(da..." */ libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 16 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24659, /* "undersize RTree ..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24674, /* "undersize RTree ..." */ libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -155294,17 +155800,17 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr ii = 4 *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 24694, /* "Wrong number of ..." */ // 1 - ts + 24737, /* "Too few columns ..." */ // 2 - ts + 24772, /* "Too many columns..." */ // 3 - ts + 24808, /* "Auxiliary rtree ..." */ // 4 + ts + 24709, /* "Wrong number of ..." */ // 1 + ts + 24752, /* "Too few columns ..." */ // 2 + ts + 24787, /* "Too many columns..." */ // 3 + ts + 24823, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*4)))) return SQLITE_ERROR __1: ; @@ -155334,7 +155840,7 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+24845, /* "CREATE TABLE x(%..." */ + Xsqlite3_str_appendf(tls, pSql, ts+24860, /* "CREATE TABLE x(%..." */ libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))), *(*uintptr)(unsafe.Pointer(argv + 3*4)))) ii = 4 __3: @@ -155346,7 +155852,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+24869 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+24884 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -155369,7 +155875,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+24875 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24890 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -155380,14 +155886,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*4)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -155430,7 +155936,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*4)))) goto rtreeInit_fail __22: ; @@ -155448,7 +155954,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -155468,7 +155974,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 24878 /* ",%.*s REAL" */, ts + 24889 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 24893 /* ",%.*s REAL" */, ts + 24904 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -155523,13 +156029,13 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit nodeGetCell(tls, bp+44 /* &tree */, bp+16 /* &node */, ii, bp+544 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+9637 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+9652 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+24899 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+544 /* &cell */)).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, ts+24914 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+544 /* &cell */)).FiRowid)) for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+44 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+24905 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 544 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+24920 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 544 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+24909 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+24924 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -155548,7 +156054,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+24911 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+24926 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -155635,12 +156141,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24944, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24959, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 3156 /* "\n" */ + return ts + 3171 /* "\n" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -155671,7 +156177,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+24951, /* "SELECT data FROM..." */ + ts+24966, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -155690,7 +156196,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+24996 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+25011 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -155714,8 +156220,8 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa var rc int32 var pStmt uintptr *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ - ts + 25028, /* "SELECT parentnod..." */ - ts + 25082, /* "SELECT nodeno FR..." */ + ts + 25043, /* "SELECT parentnod..." */ + ts + 25097, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 24 /* &.aCheckMapping */) + uintptr(bLeaf)*4)) == uintptr(0) { @@ -155730,23 +156236,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+25130, /* "Mapping (%lld ->..." */ + rtreeCheckAppendMsg(tls, pCheck, ts+25145, /* "Mapping (%lld ->..." */ libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 25175 /* "%_rowid" */ + return ts + 25190 /* "%_rowid" */ } - return ts + 25183 /* "%_parent" */ + return ts + 25198 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+25192, /* "Found (%lld -> %..." */ + ts+25207, /* "Found (%lld -> %..." */ libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 25175 /* "%_rowid" */ + return ts + 25190 /* "%_rowid" */ } - return ts + 25183 /* "%_parent" */ + return ts + 25198 /* "%_parent" */ }(), iKey, iVal)) } } @@ -155789,7 +156295,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+25250 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+25265 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { @@ -155809,7 +156315,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+25298 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + ts+25313 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -155832,14 +156338,14 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr if aNode != 0 { if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+25365 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + ts+25380 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+25399 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+25414 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } @@ -155847,7 +156353,7 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr nCell = readInt16(tls, (aNode + 2)) if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+25429, /* "Node %lld is too..." */ + ts+25444, /* "Node %lld is too..." */ libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { @@ -155881,14 +156387,14 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+25484, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+25499, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+25515 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + ts+25530 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -155918,13 +156424,13 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25582 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25597 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) @@ -155933,12 +156439,12 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23402 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23417 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25610 /* "Schema corrupt o..." */, 0) + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25625 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } @@ -155953,8 +156459,8 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+32 /* &check */, ts+25641 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+32 /* &check */, ts+25648 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25656 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25663 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check @@ -155964,7 +156470,7 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+25656 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + var rc int32 = Xsqlite3_exec(tls, db, ts+25671 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } @@ -156010,7 +156516,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+25660 /* "wrong number of ..." */, -1) + ts+25675 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -156018,7 +156524,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 5443 /* "main" */ + zDb = ts + 5458 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*4))) } @@ -156028,7 +156534,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 16321 /* "ok" */ + return ts + 16336 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -156464,11 +156970,11 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+25711 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+25726 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+25713 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+25728 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+25724 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+25739 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -156492,19 +156998,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+25735 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+25788 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -157518,7 +158024,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+25786 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25801 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -157527,7 +158033,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+25808 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) + Xsqlite3_str_appendf(tls, pSql, ts+25823 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) goto __3 __3: ii++ @@ -157535,7 +158041,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+24875 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24890 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -157546,7 +158052,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -157572,7 +158078,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -157805,7 +158311,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14742 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14757 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -157815,7 +158321,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25812 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25827 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -157823,7 +158329,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25818 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25833 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -157961,7 +158467,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25827 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25842 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -158106,14 +158612,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+25867 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25882 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+25883 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25898 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -158178,7 +158684,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+25898 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25913 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -158190,25 +158696,25 @@ var aFunc1 = [12]struct { _ [2]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25906 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25919 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25932 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25945 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25883 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25957 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25867 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 25980 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25994 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26007 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26021 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26037 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25921 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25934 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25947 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25960 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25898 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25972 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25882 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 25995 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26009 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26022 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26036 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26052 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 26049 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 26064 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -158221,26 +158727,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+26068 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26083 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26078 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26093 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26089 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26104 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+25812 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25827 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26100 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26115 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -158312,7 +158818,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23388 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23403 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -159591,7 +160097,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+26110 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26125 /* "corrupt fossil d..." */, -1) return } @@ -159602,7 +160108,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+26110 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26125 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -159623,7 +160129,7 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -159641,7 +160147,7 @@ func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -159745,7 +160251,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+26131 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + ts+26146 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -159829,7 +160335,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > Size_t(4)) && (libc.Xmemcmp(tls, ts+23301 /* "data" */, zIn, uint32(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > Size_t(4)) && (libc.Xmemcmp(tls, ts+23316 /* "data" */, zIn, uint32(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -159857,17 +160363,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26302 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+26317 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 26452 /* "AND rootpage!=0 ..." */ + return ts + 26467 /* "AND rootpage!=0 ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 4 /* &.pIdxIter */), (p + 36 /* &.zErrmsg */), - ts+26493 /* "SELECT name, roo..." */) + ts+26508 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -160005,7 +160511,7 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -160068,7 +160574,7 @@ func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26618 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + ts+26633 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } @@ -160086,7 +160592,7 @@ __2: *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*4), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26699 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + Xsqlite3_mprintf(tls, ts+26714 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -160104,7 +160610,7 @@ __4: } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*4), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26720 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + ts+26735 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } @@ -160128,7 +160634,7 @@ __5: ; (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*4), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26771 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + Xsqlite3_mprintf(tls, ts+26786 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } @@ -160177,7 +160683,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint32(unsafe.Sizeof(U8(0))) * uint32((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26792 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26807 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 @@ -160192,7 +160698,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint32(unsafe.Sizeof(U8(0))) * uint32((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+20 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pXInfo */)))) { var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pXInfo */)), 1) if iCid >= 0 { @@ -160242,7 +160748,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 36 /* &.eType */), bp+56 /* &iTnum */, (pIter + 60 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17842 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17857 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc @@ -160255,18 +160761,18 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // of the input table. Ignore any input table columns that begin with // "rbu_". (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+60 /* &pStmt */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26849 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + Xsqlite3_mprintf(tls, ts+26864 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+26868 /* "rbu_" */, zName, 4) != 0 { + if Xsqlite3_strnicmp(tls, ts+26883 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 32 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*4)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+26873 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+26888 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } @@ -160278,12 +160784,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+26883 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+26898 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 26912 /* "may not have" */ + return ts + 26927 /* "may not have" */ } - return ts + 26925 /* "requires" */ + return ts + 26940 /* "requires" */ }())) } @@ -160292,7 +160798,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+60 /* &pStmt */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26934 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26949 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)))) { var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)), 1) @@ -160306,7 +160812,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26956, /* "column missing f..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26971, /* "column missing f..." */ libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)), 5) @@ -160352,12 +160858,12 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = rbuMPrintf(tls, p, ts+26983 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 13309 /* ", " */ + zList = rbuMPrintf(tls, p, ts+26998 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13324 /* ", " */ } return zList } @@ -160372,13 +160878,13 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zRet = rbuMPrintf(tls, p, ts+26992 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+27007 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -160417,25 +160923,25 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, if bRowid != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27005 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + ts+27020 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27037 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + zRet = rbuMPrintf(tls, p, ts+27052 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+27060 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27066 /* "quote(" */, ts+27073 /* "||','||" */, ts+4051 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+740 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+27075 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27081 /* "quote(" */, ts+27088 /* "||','||" */, ts+4066 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+755 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27081, /* "SELECT %s FROM \"..." */ + ts+27096, /* "SELECT %s FROM \"..." */ libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27123 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + zRet = rbuMPrintf(tls, p, ts+27138 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } @@ -160493,12 +160999,12 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 @@ -160535,7 +161041,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) goto __7 __6: - zCol = ts + 27143 /* "_rowid_" */ + zCol = ts + 27158 /* "_rowid_" */ __7: ; goto __5 @@ -160544,13 +161050,13 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+27151, /* "%z%s \"%w\" COLLAT..." */ + zLhs = rbuMPrintf(tls, p, ts+27166, /* "%z%s \"%w\" COLLAT..." */ libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+27172, /* "%z%s \"rbu_imp_%d..." */ + zOrder = rbuMPrintf(tls, p, ts+27187, /* "%z%s \"rbu_imp_%d..." */ libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+27208, /* "%z%s quote(\"rbu_..." */ + zSelect = rbuMPrintf(tls, p, ts+27223, /* "%z%s quote(\"rbu_..." */ libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ iCol++ goto __1 __2: @@ -160569,12 +161075,12 @@ __11: *(*uintptr)(unsafe.Pointer(bp + 180 /* pSel */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+180 /* &pSel */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27235, /* "SELECT %s FROM \"..." */ + Xsqlite3_mprintf(tls, ts+27250, /* "SELECT %s FROM \"..." */ libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 180 /* pSel */))))) { goto __13 } - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -160596,8 +161102,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+27283 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) - zSep = ts + 13309 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+27298 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13324 /* ", " */ goto __15 __15: iCol++ @@ -160609,7 +161115,7 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+27290 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+27305 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: @@ -160659,14 +161165,14 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 740 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 740 /* "" */ // Set to " AND " later on + var zCom uintptr = ts + 755 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 755 /* "" */ // Set to " AND " later on *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { @@ -160678,9 +161184,9 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC if iCid == -2 { var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+27302 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + zRet = Xsqlite3_mprintf(tls, ts+27317 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*8)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*8)).FzSpan, zCollate)) - zType = ts + 740 /* "" */ + zType = ts + 755 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -160692,37 +161198,37 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 27143 /* "_rowid_" */ + zCol = ts + 27158 /* "_rowid_" */ } else { - zCol = ts + 26873 /* "rbu_rowid" */ + zCol = ts + 26888 /* "rbu_rowid" */ } - zType = ts + 11369 /* "INTEGER" */ + zType = ts + 11384 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*4)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)) } - zRet = Xsqlite3_mprintf(tls, ts+27324 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+27339 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 27060 /* " DESC" */ + return ts + 27075 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+27344, /* "%z%s\"rbu_imp_%d%..." */ + zImpPK = Xsqlite3_mprintf(tls, ts+27359, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+27365, /* "%z%s\"rbu_imp_%d%..." */ + zImpCols = Xsqlite3_mprintf(tls, ts+27380, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+27398 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + ts+27413 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 13309 /* ", " */ - zAnd = ts + 19862 /* " AND " */ + zCom = ts + 13324 /* ", " */ + zAnd = ts + 19877 /* " AND " */ nBind++ } @@ -160765,16 +161271,16 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 740 /* "" */ + var zS uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = Xsqlite3_mprintf(tls, ts+27422 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+27437 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+27434 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+27449 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 13309 /* ", " */ + zS = ts + 13324 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -160783,7 +161289,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27443 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+27458 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -160803,27 +161309,27 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27458 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+27473 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+27472 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) - zSep = ts + 19862 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27487 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 19877 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+27484 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + ts+27499 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = rbuMPrintf(tls, p, ts+27534 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) - zSep = ts + 19862 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27549 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 19877 /* " AND " */ } } } @@ -160837,7 +161343,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27547 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27562 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -160866,21 +161372,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+27534, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+27549, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+27573, /* "%z%s\"%w\"=rbu_del..." */ + zList = rbuMPrintf(tls, p, ts+27588, /* "%z%s\"%w\"=rbu_del..." */ libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+27603, /* "%z%s\"%w\"=rbu_fos..." */ + zList = rbuMPrintf(tls, p, ts+27618, /* "%z%s\"%w\"=rbu_fos..." */ libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } } } @@ -160938,19 +161444,19 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 27640 /* "PRIMARY KEY(" */ + var zSep uintptr = ts + 27655 /* "PRIMARY KEY(" */ *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26792 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26807 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14652 /* "pk" */) == 0) { + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14667 /* "pk" */) == 0) { var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+60 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } @@ -160963,15 +161469,15 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */)), 2) var zDesc uintptr if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */)), 3) != 0 { - zDesc = ts + 27060 /* " DESC" */ + zDesc = ts + 27075 /* " DESC" */ } else { - zDesc = ts + 740 /* "" */ + zDesc = ts + 755 /* "" */ } - z = rbuMPrintf(tls, p, ts+27653 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = ts + 13309 /* ", " */ + z = rbuMPrintf(tls, p, ts+27668 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13324 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+27664 /* "%z)" */, libc.VaList(bp+48, z)) + z = rbuMPrintf(tls, p, ts+27679 /* "%z)" */, libc.VaList(bp+48, z)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */))) } return z @@ -161003,7 +161509,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration @@ -161011,7 +161517,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 36 /* &.zErrmsg */), - ts+27668 /* "SELECT name FROM..." */) + ts+27683 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { @@ -161020,7 +161526,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit } if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+172 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) @@ -161030,25 +161536,25 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)), 1) var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)), 3) var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+27718 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + zCols = rbuMPrintf(tls, p, ts+27733 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+27740 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+27755 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 27060 /* " DESC" */ + return ts + 27075 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 13309 /* ", " */ + zComma = ts + 13324 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+27750 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + zCols = rbuMPrintf(tls, p, ts+27765 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+27765, /* "CREATE TABLE rbu..." */ + ts+27780, /* "CREATE TABLE rbu..." */ libc.VaList(bp+120, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) } } @@ -161076,52 +161582,52 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 740 /* "" */ + var zPk uintptr = ts + 755 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*4)) *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 27827 /* "PRIMARY KEY " */ + zPk = ts + 27842 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+27840, /* "%z%s\"%w\" %s %sCO..." */ + zSql = rbuMPrintf(tls, p, ts+27855, /* "%z%s\"%w\" %s %sCO..." */ libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*4)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 27867 /* " NOT NULL" */ + return ts + 27882 /* " NOT NULL" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 13309 /* ", " */ + zComma = ts + 13324 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+27877 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+27892 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27884, /* "CREATE TABLE \"rb..." */ + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27899, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 27916 /* " WITHOUT ROWID" */ + return ts + 27931 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) } } @@ -161144,7 +161650,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 88 /* &.pTmpInsert */), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27931, /* "INSERT INTO %s.'..." */ + ts+27946, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -161181,7 +161687,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+27988 /* "SELECT trim(sql)..." */) + ts+28003 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -161291,7 +161797,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+28054 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+28069 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -161312,26 +161818,26 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 612 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28074, /* "CREATE TABLE \"rb..." */ + ts+28089, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 604 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) // Create the statement to insert index entries (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 612 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 80 /* &.pInsert */), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28139 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+28154 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 84 /* &.pDelete */), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28175 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 608 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+28190 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 608 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -161348,7 +161854,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+28209, /* "SELECT %s, 0 AS ..." */ + ts+28224, /* "SELECT %s, 0 AS ..." */ libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, @@ -161356,32 +161862,32 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 28270 /* "AND" */ + return ts + 28285 /* "AND" */ } - return ts + 28274 /* "WHERE" */ + return ts + 28289 /* "WHERE" */ }() } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+28280, /* "SELECT %s, rbu_c..." */ + ts+28295, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+216, zCollist, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+28341, /* "SELECT %s, rbu_c..." */ + ts+28356, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+264, zCollist, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 28270 /* "AND" */ + return ts + 28285 /* "AND" */ } - return ts + 28274 /* "WHERE" */ + return ts + 28289 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -161406,8 +161912,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5452 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5448 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5467 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5463 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -161417,21 +161923,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 28500 /* "rbu_imp_" */ + return ts + 28515 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 80 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+28509, /* "INSERT INTO \"%s%..." */ + ts+28524, /* "INSERT INTO \"%s%..." */ libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 28545 /* ", _rowid_" */ + return ts + 28560 /* ", _rowid_" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zBindings))) } @@ -161441,28 +161947,28 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 84 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+28555 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + ts+28570 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 28583 /* ", rbu_rowid" */ + zRbuRowid = ts + 28598 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+28595 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+28610 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 28671 /* ", 0 AS rbu_rowid" */ + return ts + 28686 /* ", 0 AS rbu_rowid" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28688, /* "CREATE TEMP TRIG..." */ + ts+28703, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) @@ -161470,7 +161976,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28987, /* "CREATE TEMP TRIG..." */ + ts+29002, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } @@ -161479,14 +161985,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 29086 /* ",_rowid_ " */ + zRbuRowid = ts + 29101 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 29096 /* ",rbu_rowid" */ + zRbuRowid = ts + 29111 /* ",rbu_rowid" */ } } @@ -161499,35 +162005,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+27143 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+27158 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+740 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+755 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 76 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+29107, /* "SELECT %s,%s rbu..." */ + ts+29122, /* "SELECT %s,%s rbu..." */ libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 29155 /* "0 AS " */ + return ts + 29170 /* "0 AS " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zOrder, zLimit))) } @@ -161602,12 +162108,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 740 /* "" */ + var zPrefix uintptr = ts + 755 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 28500 /* "rbu_imp_" */ + zPrefix = ts + 28515 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+29161, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+29176, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 4 /* &.pUpdate */), (p + 36 /* &.zErrmsg */), zUpdate) @@ -161634,7 +162140,7 @@ func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uin return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } @@ -161675,7 +162181,7 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ } *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29191 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+24 /* &.zStateDb */))) + Xsqlite3_mprintf(tls, ts+29206 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+24 /* &.zStateDb */))) for (*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: @@ -161747,31 +162253,31 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29221 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29236 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29248 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+2398 /* "stat" */, uint32(4)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29263 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+2413 /* "stat" */, uint32(4)) } else { - libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+5443 /* "main" */, uint32(4)) + libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+5458 /* "main" */, uint32(4)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29266 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+24 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29281 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+24 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -161804,11 +162310,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29332 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29347 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= Size_t(5)) && (0 == libc.Xmemcmp(tls, ts+22464 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= Size_t(5)) && (0 == libc.Xmemcmp(tls, ts+22479 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -161820,16 +162326,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+29364, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+29379, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 29396 /* "&" */ + return ts + 29411 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } return zExtra }())) @@ -161845,40 +162351,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29398 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29413 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29413 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+29428 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29430 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29445 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29446 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29461 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29474 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29489 /* "rbu vfs not foun..." */, 0) } } @@ -161947,7 +162453,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29446 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29461 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -161981,7 +162487,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29492 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29507 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -162108,16 +162614,16 @@ func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ bp := tls.Alloc(16) defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+29527 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+29534 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+29542 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+29549 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -162257,7 +162763,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22102 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22117 /* "datatype mismatc..." */, 0) return } @@ -162375,7 +162881,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // var pStmt uintptr at bp+8, 4 (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+29541 /* "PRAGMA schema_ve..." */) + ts+29556 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot @@ -162388,7 +162894,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29563 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29578 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -162413,7 +162919,7 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+29590, /* "INSERT OR REPLAC..." */ + ts+29605, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+24, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -162458,9 +162964,9 @@ func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29748 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + Xsqlite3_mprintf(tls, ts+29763 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29763, /* "PRAGMA main.%s =..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29778, /* "PRAGMA main.%s =..." */ libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) @@ -162477,11 +162983,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 4 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29783 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29798 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 36 /* &.zErrmsg */), - ts+29808 /* "SELECT sql FROM ..." */) + ts+29823 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -162495,12 +163001,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 36 /* &.zErrmsg */), - ts+29916 /* "SELECT * FROM sq..." */) + ts+29931 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4 /* &pInsert */, (p + 36 /* &.zErrmsg */), - ts+29981 /* "INSERT INTO sqli..." */) + ts+29996 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -162512,7 +163018,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30025 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30040 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -162534,8 +163040,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+15708 /* "user_version" */) - rbuCopyPragma(tls, p, ts+14830 /* "application_id" */) + rbuCopyPragma(tls, p, ts+15723 /* "user_version" */) + rbuCopyPragma(tls, p, ts+14845 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -162546,7 +163052,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30050 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+30065 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -162572,10 +163078,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -162692,7 +163198,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30078 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30093 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -162711,7 +163217,7 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ bp := tls.Alloc(8) defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+29527 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+29542 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -162733,7 +163239,7 @@ func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ // var zRnd [64]int8 at bp+12, 64 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30103 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30118 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) @@ -162772,7 +163278,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+12, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+30114 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+30129 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 12 /* zErrmsg */)), -1) } else { @@ -162815,7 +163321,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30186 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30201 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -162823,7 +163329,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+30200 /* "SELECT 1 FROM sq..." */) + ts+30215 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -162835,7 +163341,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+30257 /* "SELECT sum(cnt *..." */) + ts+30272 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -162881,7 +163387,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + Size_t(1))) pCsr += (uintptr(nRbu + Size_t(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2775 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2790 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -162918,7 +163424,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30331 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30346 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -162940,12 +163446,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30363, /* "database modifie..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30378, /* "database modifie..." */ libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30395 /* "vacuum" */ + return ts + 30410 /* "vacuum" */ } - return ts + 30402 /* "update" */ + return ts + 30417 /* "update" */ }())) } } @@ -162953,7 +163459,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -162967,24 +163473,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+15433 /* "page_size" */) - rbuCopyPragma(tls, p, ts+14845 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+15448 /* "page_size" */) + rbuCopyPragma(tls, p, ts+14860 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30409 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30424 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+5443 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+5458 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+30425 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + db, ts+30440 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } } @@ -163037,7 +163543,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30449 /* "-vactmp" */, (zState+uintptr((n-7))), uint32(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30464 /* "-vactmp" */, (zState+uintptr((n-7))), uint32(7))) { return rbuMisuseError(tls) } } @@ -163067,7 +163573,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); i < (nErrmsg - Size_t(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28500 /* "rbu_imp_" */, uint32(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28515 /* "rbu_imp_" */, uint32(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -163086,7 +163592,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -163098,7 +163604,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } // Close any open statement handles. @@ -163110,7 +163616,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30457 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30472 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -163209,7 +163715,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163226,19 +163732,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 13198 /* "BEGIN" */ + zBegin = ts + 13213 /* "BEGIN" */ } else { - zBegin = ts + 30409 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 30424 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30409 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30424 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163642,7 +164148,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30484 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30499 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -163665,7 +164171,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+30507 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30522 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -163828,7 +164334,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5443 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5458 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -163843,7 +164349,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+30518 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+30533 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -164150,6 +164656,5666 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + FaData uintptr + FnData int32 + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint32(8)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nVarint + 1))), z, uint32(n)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 36 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 36 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 4 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+4, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 4 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 12 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.Xmemcpy(tls, bp+4 /* &iVal */, bp+12 /* &rVal */, uint32(8)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 4 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint32(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint32(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint32(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 4 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 12 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 16 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+8, 4 + + var aOld uintptr + // var nNew int32 at bp+20, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+4 /* &aOld2 */, bp+8 /* &nOld */) + aNew = sessionMergeValue(tls, bp+12 /* &aNew1 */, bp+16 /* &aNew2 */, bp+20 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 20 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint32(*(*int32)(unsafe.Pointer(bp + 20 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.Xmemcpy(tls, aOut, aOld, uint32(*(*int32)(unsafe.Pointer(bp + 8 /* nOld */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 4 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 12 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 16 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+24, 4 + + var aOld uintptr + // var nNew int32 at bp+28, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+4 /* &aOld2 */, bp+24 /* &nOld */) + aNew = sessionMergeValue(tls, bp+12 /* &aNew1 */, bp+16 /* &aNew2 */, bp+28 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 24 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 28 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.Xmemcpy(tls, aOut, aNew, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nNew */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 28 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 4 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 12 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 12 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+4, 8 + + libc.Xmemcpy(tls, bp+4 /* &rVal */, bp+12 /* &iVal */, uint32(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 4 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+20, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 20 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 20 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint32(*(*int32)(unsafe.Pointer(bp + 20 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (Sqlite3_int64(unsafe.Sizeof(uintptr(0))) * nNew)) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, (uint32(Sqlite3_int64(unsafe.Sizeof(uintptr(0))) * nNew))) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*4)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*4)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 4 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+30544 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+755 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+30665 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = nByte + (Sqlite3_int64(uint32(nDbCol) * ((uint32(unsafe.Sizeof(uintptr(0))) + uint32(unsafe.Sizeof(U8(0)))) + uint32(1)))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*4) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, (uint32(nThis + 1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, (uint32(nName + 1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 4 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 8 /* &.nCol */), uintptr(0), (pTab + 16 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 44 /* &.nMaxChangesetSize */)) += (I64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + Size_t(1))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 4 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 12 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+4 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 12 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+12 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 12 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 24 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 24 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */))))) + } else { + // var dVal float64 at bp+16, 8 + + libc.Xmemcpy(tls, bp+16 /* &dVal */, bp+24 /* &iVal */, uint32(8)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 16 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+32, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+32 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 32 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 32 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 32 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* p */))), uint32(*(*int32)(unsafe.Pointer(bp + 32 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 32 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 12 /* p */)), bp+4 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 4 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 4 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 44 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var iHash int32 at bp+24, 4 + + // var bNull int32 at bp+28, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 24 + + var p uintptr + // var p1 uintptr at bp+32, 4 + + // var p2 uintptr at bp+44, 4 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+36, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 28 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 12 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+755 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+24 /* &iHash */, bp+28 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 28 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* iHash */)))*4)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 36 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 32 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+32 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+32 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 32 /* p1 */)), bp+36 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 36 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.Xmemset(tls, pC, 0, uint32(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*20) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 36 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 44 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+44 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+44 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 36 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 44 /* p2 */)), bp+36 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 16 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 36 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* iHash */)))*4)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* iHash */)))*4)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 64 /* &.hook */ + 16 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 32 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 4 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+30694, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)))) + zSep = ts + 19877 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+30728, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)))) + zSep = ts + 30769 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6506 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+30774, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 4 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+30852, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 4 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 8 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+12, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+20, 4 + + // var azCol uintptr at bp+16, 4 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+8, 4 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.Xmemset(tls, bp /* &d */, 0, uint32(unsafe.Sizeof(SessionDiffCtx{}))) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+8 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 16 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+12 /* &nCol */, uintptr(0), bp+16 /* &azCol */, bp+20 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 12 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 12 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* azCol */)) + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FazCol + uintptr(i)*4))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+30905 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(Sqlite3_session{})) + uint32(nDb)) + uint32(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(Sqlite3_session{}))) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*84) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.Xmemcpy(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint32(nDb + 1))) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 4 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 56 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint32(unsafe.Sizeof(SessionTable{})) + uint32(nName)) + uint32(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*36) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint32(nName + 1))) + for ppTab = (pSession + 60 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint32(nBlob)) + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint32(nStr)) + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint32(unsafe.Sizeof([24]int8{})) - uint32(1))), bp+8 /* &aBuf[0] */, ts+4089 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = ((int32(zOut) - int32((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint32(8)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(36) + defer tls.Free(36) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 12 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 12 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+4, 8 + + libc.Xmemcpy(tls, bp+4 /* &dVal */, bp+12 /* &iVal */, uint32(8)) + if *(*float64)(unsafe.Pointer(bp + 4 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+20, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+20 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 20 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 20 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 20 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint32(*(*int32)(unsafe.Pointer(bp + 20 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+24 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+24 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, ((int32(a) - int32(pStart)) / 1), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+30932 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31042 /* "SELECT * FROM " */, bp+20 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+20 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+768 /* "." */, bp+20 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+20 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31057 /* " WHERE " */, bp+20 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+20 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), bp+20 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31065 /* " IS ?" */, bp+20 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+20 /* &rc */) + zSep = ts + 19877 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp /* &rVal */, bp+8 /* &iVal */, uint32(8)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 12 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+24, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31071 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+8, 4 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 4 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+4 /* &azCol */, bp+8 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint32(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+12 /* &buf */, bPatchset, pTab, bp+24 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 4 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */)), bp+28 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+12 /* &buf */, uint8(SQLITE_INSERT), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+24 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+12 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)), iCol, bp+24 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionAppendUpdate(tls, bp+12 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionAppendDelete(tls, bp+12 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31091 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint32(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.Xmemmove(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint32(nMove)) + } + *(*int32)(unsafe.Pointer(pIn + 20 /* &.buf */ + 4 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+20 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 32 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 20 /* &.buf */ + 4 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, aCopy, aData, uint32(nData)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 12 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 12 /* v */))) + } else { + // var d float64 at bp+4, 8 + + libc.Xmemcpy(tls, bp+4 /* &d */, bp+12 /* &v */, uint32(8)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)), *(*float64)(unsafe.Pointer(bp + 4 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 80 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint32((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint32(unsafe.Sizeof(uintptr(0)))) * uint32(2)) + uint32(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 44 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint32(unsafe.Sizeof(uintptr(0))) * uint32((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint32(2)) + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint32(*(*int32)(unsafe.Pointer(bp /* nCopy */)))) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*4) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+68 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) + } + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint32(unsafe.Sizeof(uintptr(0))) * uint32((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint32(2))) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+68 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+68 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+68 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*4) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*4) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*4)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) == uintptr(0) { + return libc.AssignPtrInt32(p+68 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*4)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*4)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*4)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + // var rc int32 at bp+32, 4 + // Return value + // var sOut SessionBuffer at bp, 12 + // Output buffer + // var nCol int32 at bp+16, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+20, 12 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+12, 4 + + var nVar int32 + // var nByte1 int32 at bp+36, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 20 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.Xmemset(tls, bp /* &sOut */, 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+32 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+32 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+12 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+16 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 20 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+20 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), bp+32 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+32 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 12 /* nByte */)), bp+32 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 12 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 20 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), bp+36 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+32 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 36 /* nByte1 */)), bp+32 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 36 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(uintptr(0))) * uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))) * uint32(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.Xmemset(tls, apVal, 0, ((uint32(unsafe.Sizeof(uintptr(0))) * uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))) * uint32(2))) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+32 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+32 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))*4), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 16 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)) + }())))*4)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+32 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 16 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*4)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+32 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*4))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.Xmemset(tls, apVal, 0, ((uint32(unsafe.Sizeof(uintptr(0))) * uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))) * uint32(2))) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+20 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + // var sInput SessionInput at bp, 44 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint32(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + // var sInput SessionInput at bp, 44 + + var rc int32 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint32(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [2]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint32(nU32) * uint32(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint32(nU32) * uint32(unsafe.Sizeof(U32(0))))) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*4)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 32 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint32(nU32)*uint32(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 8 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint32(unsafe.Sizeof(SessionUpdate{})) * uint32(nU32)) * uint32(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10072 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 755 /* "" */ + // var buf SessionBuffer at bp, 12 + + libc.Xmemset(tls, bp /* &buf */, 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*12) + libc.Xmemcpy(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint32(nU32) * uint32(unsafe.Sizeof(U32(0))))) + + sessionAppendStr(tls, bp /* &buf */, ts+31109 /* "UPDATE main." */, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31122 /* " SET " */, bp+12 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*4)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31128 /* " = ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+12 /* &rc */) + zSep = ts + 13324 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 755 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31057 /* " WHERE " */, bp+12 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*4)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31133 /* "idx IS CASE WHEN..." */, bp+12 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31065 /* " IS ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+12 /* &rc */) + } + zSep = ts + 19877 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31208 /* "DELETE FROM main..." */, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31057 /* " WHERE " */, bp+12 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31128 /* " = ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+12 /* &rc */) + zSep = ts + 19877 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31226 /* " AND (?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+30769 /* " OR " */, bp+12 /* &rc */) + + zSep = ts + 755 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31065 /* " IS ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+12 /* &rc */) + zSep = ts + 31234 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4066 /* ")" */, bp+12 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 4 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5458 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 12 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31239 /* "INSERT INTO main..." */, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+19883 /* "(" */, bp+12 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13324 /* ", " */, bp+12 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp+12 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31257 /* ") VALUES(?" */, bp+12 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31268 /* ", ?" */, bp+12 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4066 /* ")" */, bp+12 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10072 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pInsert */), + + ts+31272 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 4 /* &.pDelete */), + + ts+31385 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 4 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var rc int32 // Return code + // var nCol int32 at bp+4, 4 + // Number of columns in table + // var op int32 at bp+8, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 4 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 60 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 60 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 60 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 60 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 60 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 60 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 4 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+4 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+4 /* &pVal */) + } + sessionAppendValue(tls, (p + 60 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 4 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+12, 4 + + // var nCol int32 at bp+4, 4 + + // var op int32 at bp+8, 4 + + // var zDummy uintptr at bp, 4 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 48 /* &.constraints */), aBlob, nBlob, bp+12 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var zDummy uintptr at bp, 4 + + // var op int32 at bp+8, 4 + + // var nCol int32 at bp+4, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 4 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 4 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+12 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*4)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*4)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31529 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31550 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, (pApply + 48 /* &.constraints */), 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint32(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint32(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 44 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte) + } + + for (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(252) + defer tls.Free(252) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 76 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.Xmemset(tls, bp+48 /* &sApply */, 0, uint32(unsafe.Sizeof(SessionApplyCtx{}))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+31569 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31595 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+128, 4 + + // var op int32 at bp+132, 4 + + // var zNew uintptr at bp+124, 4 + + Xsqlite3changeset_op(tls, pIter, bp+124 /* &zNew */, bp+128 /* &nCol */, bp+132 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+136, 4 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.Xmemset(tls, (bp + 48 /* &sApply */ + 48 /* &.constraints */), 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+136 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5458 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)), (bp + 48 /* &sApply */ + 16 /* &.nCol */), bp+140 /* &zTab */, (bp + 48 /* &sApply */ + 20 /* &.azCol */), (bp + 48 /* &sApply */ + 24 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31625 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 128 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+31669, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 128 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 128 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 136 /* abPK */)), uint32(*(*int32)(unsafe.Pointer(bp + 128 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31740 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 128 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), ts+10072 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+144, 4 + + // var notUsed int32 at bp+148, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+144 /* &nFk */, bp+148 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 144 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+152, 100 + + libc.Xmemset(tls, bp+152 /* &sIter */, 0, uint32(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 152 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 144 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+152 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+31800 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31830 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+31854 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+31830 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint32(unsafe.Sizeof(SessionChange{})) + uint32(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*20) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint32(nRec)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint32(nIn)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = ((int32(pOut) - int32((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint32(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint32(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.Xmemset(tls, pNew, 0, uint32(nByte)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+12 /* &.aRecord */, (pNew + 1*20)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut, a1, uint32(n1)) + pOut += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut, a2, uint32(n2)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = ((int32(pOut) - int32((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+4, 4 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint32(unsafe.Sizeof(SessionChange{})) + uint32((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint32(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)) = libc.AssignPtrUintptr(pNew+12 /* &.aRecord */, (pNew + 1*20)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+4 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)), aRec, uint32(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+4 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 8 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 12 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+8 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+12 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+4 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 8 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 12 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)), aRec, uint32(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+4 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = ((int32(*(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */))) - int32((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aRec uintptr at bp, 4 + + // var nRec int32 at bp+4, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+4 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+8, 4 + + // var nCol int32 at bp+12, 4 + + // var op int32 at bp+16, 4 + + var iHash int32 + // var bIndirect int32 at bp+20, 4 + + // var pChange uintptr at bp+28, 4 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+8 /* &zNew */, bp+12 /* &nCol */, bp+16 /* &op */, bp+20 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)))) + // var abPK uintptr at bp+24, 4 + + Xsqlite3changeset_pk(tls, pIter, bp+24 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint32(unsafe.Sizeof(SessionTable{})) + uint32(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) + uint32(nNew)) + uint32(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 12 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*36) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 24 /* abPK */)), uint32(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)), (uint32(nNew + 1))) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 12 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 24 /* abPK */)), uint32(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 16 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 16 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 16 /* op */)), *(*int32)(unsafe.Pointer(bp + 20 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+28 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 28 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4)) = *(*uintptr)(unsafe.Pointer(bp + 28 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+12 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+12 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+12 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+12 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Sqlite3_changegroup{}))) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pGrp uintptr at bp, 4 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pGrp uintptr at bp, 4 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint32(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint32(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = ((int32(pOut) - int32((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.Xmemcpy(tls, pOut, a1, uint32(n1)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.Xmemcpy(tls, pOut, a2, uint32(n2)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint32(n1)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = ((int32(pOut) - int32((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 8 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 12 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+4 /* &nRec */, bp+8 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 8 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 8 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+12 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+24 /* &rc */) + sessionAppendVarint(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+24 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+12 /* &sOut */, uint8(SQLITE_UPDATE), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+24 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 28 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+28 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8(SQLITE_INSERT), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendRecordMerge(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 28 /* pCsr */)), (*(*int32)(unsafe.Pointer(bp + 4 /* nRec */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 28 /* pCsr */))) - int32(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1)), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+24 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+12 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+24 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+12 /* &sOut */, uint8(SQLITE_DELETE), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendRecordMerge(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+24 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+24 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf) + libc.Xmemset(tls, bp+12 /* &sOut */, 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(Sqlite3_rebaser{}))) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -164220,71 +170386,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -165098,7 +171199,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+30529 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+31882 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -165421,7 +171522,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+30557 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+31910 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -165720,7 +171821,7 @@ func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+30588 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31941 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -165794,7 +171895,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 30595 /* "wrong number of ..." */ + var zErr uintptr = ts + 31948 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -165960,7 +172061,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 740 /* "" */ + return ts + 755 /* "" */ } // Implementation of snippet() function. @@ -165987,7 +172088,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 30645 /* "wrong number of ..." */ + var zErr uintptr = ts + 31998 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -166328,13 +172429,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(48) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 30693 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32046 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 30701 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32054 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 30711 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32064 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -166828,7 +172929,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+5243 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+5258 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -167006,7 +173107,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+30716 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32069 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint32(unsafe.Sizeof(int32(0))) * uint32(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 @@ -167033,14 +173134,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30723 /* "malformed prefix..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32076 /* "malformed prefix..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+30754 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + ts+32107 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -167051,7 +173152,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30787 /* "prefix length ou..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32140 /* "prefix length ou..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -167064,7 +173165,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30824 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32177 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + Size_t(1))) var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (Sqlite3_int64(unsafe.Sizeof(uintptr(0))) * nArg)) @@ -167073,7 +173174,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30833 /* "multiple tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32186 /* "multiple tokeniz..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { @@ -167092,7 +173193,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30866 /* "parse error in t..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32219 /* "parse error in t..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, @@ -167107,14 +173208,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30900 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32253 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30908 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32261 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+30940 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32293 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } @@ -167122,9 +173223,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30946 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32299 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30960 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32313 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) @@ -167132,9 +173233,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30998 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32351 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31009 /* "malformed column..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32362 /* "malformed column..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) @@ -167142,21 +173243,21 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+4174 /* "detail" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+4189 /* "detail" */, zCmd, nCmd) == 0 { *(*[4]Fts5Enum)(unsafe.Pointer(bp + 44 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 15813 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 15818 /* "full" */}, - {FzName: ts + 31044 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {FzName: ts + 15828 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 15833 /* "full" */}, + {FzName: ts + 32397 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+44 /* &aDetail[0] */, zArg, (pConfig+48 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31052 /* "malformed detail..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32405 /* "malformed detail..." */, 0) } return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31083 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32436 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -167220,15 +173321,15 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+20482 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+14742 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31111 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20497 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+14757 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32464 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+31141 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32494 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31151 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32504 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -167246,13 +173347,13 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK *(*Fts5Buffer)(unsafe.Pointer(bp + 28 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+31182 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+32535 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+31187 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+32540 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+31194 /* ", T.c%d" */, libc.VaList(bp+16, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+32547 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } @@ -167300,8 +173401,8 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*4)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20482 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31202 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20497 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32555 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } @@ -167334,7 +173435,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31231 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32584 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { @@ -167342,7 +173443,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*uintptr)(unsafe.Pointer(bp + 52 /* zTwo */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp + 52 /* zTwo */)) } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), pzErr) } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 44 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 52 /* zTwo */)), pzErr) @@ -167367,19 +173468,19 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 30900 /* "content" */ + zTail = ts + 32253 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 31251 /* "docsize" */ + zTail = ts + 32604 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+40 /* &rc */, ts+31259 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+32612 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14742 /* "rowid" */, -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14757 /* "rowid" */, -1) } // Formulate the zContentExprlist text @@ -167428,18 +173529,18 @@ func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31270 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32623 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 13309 /* ", " */ + return ts + 13324 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31286 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32639 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31293, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20482 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32646, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20497 /* "rank" */)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -167579,7 +173680,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+31319 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+32672 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -167589,7 +173690,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31324 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32677 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -167599,7 +173700,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31333 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32686 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -167612,7 +173713,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31343 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32696 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -167622,7 +173723,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31353 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32706 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -167638,7 +173739,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20482 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20497 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 4 @@ -167665,7 +173766,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 bp := tls.Alloc(44) defer tls.Free(44) - var zSelect uintptr = ts + 31365 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 32718 /* "SELECT k, v FROM..." */ var zSql uintptr *(*uintptr)(unsafe.Pointer(bp + 36 /* p */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK @@ -167688,7 +173789,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 36 /* p */))) { var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 36 /* p */)), 0) var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 36 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+31397 /* "version" */) { + if 0 == Xsqlite3_stricmp(tls, zK, ts+32750 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 40 /* bDummy */)) = 0 @@ -167703,7 +173804,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+31405, /* "invalid fts5 fil..." */ + ts+32758, /* "invalid fts5 fil..." */ libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } @@ -167837,7 +173938,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31470 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+32823 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -167850,20 +173951,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31490 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+32843 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = ((int32(z2) - int32(z)) / 1) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31521 /* "OR" */, uint32(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32874 /* "OR" */, uint32(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31524 /* "NOT" */, uint32(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32877 /* "NOT" */, uint32(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28270 /* "AND" */, uint32(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28285 /* "AND" */, uint32(3)) == 0) { tok = FTS5_AND } break @@ -169835,9 +175936,9 @@ func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqli bp := tls.Alloc(16) defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+31528 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+32881 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+30557 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+31910 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -169853,7 +175954,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+31533 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+32886 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -169950,7 +176051,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+18865 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+18880 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -170046,7 +176147,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31562 /* "fts5: column que..." */, 0) + ts+32915 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -170230,12 +176331,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31615, /* "fts5: %s queries..." */ + ts+32968, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 31665 /* "phrase" */ + return ts + 33018 /* "phrase" */ } - return ts + 31528 /* "NEAR" */ + return ts + 32881 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -171705,7 +177806,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+31672 /* "block" */, iRowid, 0, (p + 36 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33025 /* "block" */, iRowid, 0, (p + 36 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -171793,7 +177894,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 40 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+31678, /* "REPLACE INTO '%q..." */ + ts+33031, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -171821,7 +177922,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+31729, /* "DELETE FROM '%q'..." */ + ts+33082, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+44 /* &.pDeleter */), zSql) != 0 { return @@ -171845,7 +177946,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 52 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+31778, /* "DELETE FROM '%q'..." */ + ts+33131, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -172053,7 +178154,7 @@ func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12 if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+31818 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+33171 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -173488,7 +179589,7 @@ func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:2 var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 56 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+31841, /* "SELECT pgno FROM..." */ + ts+33194, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -174744,7 +180845,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -175085,7 +181186,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 48 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+31925, /* "INSERT INTO '%q'..." */ + ts+33278, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -176301,7 +182402,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.Xmemset(tls, bp /* &s */, 0, uint32(unsafe.Sizeof(Fts5Structure{}))) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+740 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+755 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -176322,13 +182423,13 @@ func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uint if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+31982 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33335 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+23301 /* "data" */, ts+31990 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+23316 /* "data" */, ts+33343 /* "id INTEGER PRIMA..." */, 0, pzErr) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10197, /* "idx" */ - ts+32025, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10212, /* "idx" */ + ts+33378, /* "segid, term, pgn..." */ 1, pzErr) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { @@ -176634,7 +182735,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+31672 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+4 /* &pBlob */) + ts+33025 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+4 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pBlob */))) @@ -176771,7 +182872,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+32069, /* "SELECT segid, te..." */ + ts+33422, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. @@ -176981,7 +183082,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 8 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 68 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*92), uintptr(0), bp+8 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 32 /* &.rc */), bp+8 /* &poslist */, uint32(4), ts+32155 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 32 /* &.rc */), bp+8 /* &poslist */, uint32(4), ts+33508 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &poslist */)).Fn, bp+20 /* &iOff */, bp+24 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 24 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 24 /* iPos */)) & int64(0x7FFFFFFF))) @@ -177389,7 +183490,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32160 /* "recursively defi..." */, 0) + ts+33513 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -177423,7 +183524,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4074 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4089 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -177439,7 +183540,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4074 /* "%d" */, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4089 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -177782,7 +183883,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -177814,7 +183915,7 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -177853,25 +183954,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+32199, /* "SELECT rowid, ra..." */ + ts+33552, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 13309 /* ", " */ + return ts + 13324 /* ", " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 32254 /* "DESC" */ + return ts + 33607 /* "DESC" */ } - return ts + 32259 /* "ASC" */ + return ts + 33612 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -177922,13 +184023,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+32263 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+33616 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4156 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4171 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32269 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33622 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -177963,7 +184064,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+32297 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+33650 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, @@ -177995,7 +184096,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32307 /* "no such function..." */, libc.VaList(bp+8, zRank)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33660 /* "no such function..." */, libc.VaList(bp+8, zRank)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } @@ -178027,14 +184128,14 @@ func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uin *(*int32)(unsafe.Pointer(pCsr + 56 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+32328 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+33681 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 30711 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32064 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -178100,7 +184201,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32160 /* "recursively defi..." */, 0) + ts+33513 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -178146,7 +184247,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 740 /* "" */ + zText = ts + 755 /* "" */ __14: ; iCol = 0 @@ -178335,7 +184436,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32361 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+33714 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -178472,7 +184573,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -178509,29 +184610,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+32397 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+33750 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+32408 /* "'delete-all' may..." */, 0) + ts+33761 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+32488 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33841 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+32496 /* "'rebuild' may no..." */, 0) + ts+33849 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+15413 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+15428 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+32552 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33905 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+32558 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33911 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -178605,7 +184706,7 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*4))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+15952 /* "delete" */, z)) { + (0 == Xsqlite3_stricmp(tls, ts+15967 /* "delete" */, z)) { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*4))) @@ -178630,12 +184731,12 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32574, /* "cannot %s conten..." */ + ts+33927, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 18766 /* "UPDATE" */ + return ts + 18781 /* "UPDATE" */ } - return ts + 32611 /* "DELETE from" */ + return ts + 33964 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { @@ -179305,7 +185406,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+32623 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+33976 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -179610,7 +185711,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32644 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33997 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 8 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -179627,7 +185728,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 8 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32666 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34019 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -179674,7 +185775,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+32697 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34050 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -179685,7 +185786,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+32710 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+34063 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -179701,7 +185802,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 32801 /* "config" */, ts + 30900 /* "content" */, ts + 23301 /* "data" */, ts + 31251 /* "docsize" */, ts + 10197, /* "idx" */ + ts + 34154 /* "config" */, ts + 32253 /* "content" */, ts + 23316 /* "data" */, ts + 32604 /* "docsize" */, ts + 10212, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -179725,7 +185826,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+32808 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+34161 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -179743,13 +185844,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32808 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34161 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32813 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34166 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -179815,20 +185916,20 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p if *(*uintptr)(unsafe.Pointer((p + 24 /* &.aStmt */) + uintptr(eStmt)*4)) == uintptr(0) { *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ - ts + 32828, /* "SELECT %s FROM %..." */ - ts + 32896, /* "SELECT %s FROM %..." */ - ts + 32965, /* "SELECT %s FROM %..." */ // LOOKUP + ts + 34181, /* "SELECT %s FROM %..." */ + ts + 34249, /* "SELECT %s FROM %..." */ + ts + 34318, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 32998, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 33037, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 33077, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 33116, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 33157, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 34351, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34390, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34430, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34469, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34510, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 33196, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 34549, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 33238, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 33278, /* "SELECT %s FROM %..." */ // SCAN + ts + 34591, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 34631, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) @@ -179895,7 +185996,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -179933,18 +186034,18 @@ func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230 var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33301, /* "DROP TABLE IF EX..." */ + ts+34654, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33405, /* "DROP TABLE IF EX..." */ + ts+34758, /* "DROP TABLE IF EX..." */ libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33443, /* "DROP TABLE IF EX..." */ + ts+34796, /* "DROP TABLE IF EX..." */ libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc @@ -179956,7 +186057,7 @@ func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uin if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33481, /* "ALTER TABLE %Q.'..." */ + ts+34834, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -179968,14 +186069,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23301 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10197 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32801 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23316 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10212 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34154 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31251 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32604 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+30900 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32253 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -179989,17 +186090,17 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn var rc int32 *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+33523, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+34876, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 27916 /* " WITHOUT ROWID" */ + return ts + 27931 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+33553, /* "fts5: error crea..." */ + ts+34906, /* "fts5: error crea..." */ libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } @@ -180041,27 +186142,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+33597 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34950 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+33620 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34973 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+30900 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32253 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+31251 /* "docsize" */, ts+33626 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+32604 /* "docsize" */, ts+34979 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+32801 /* "config" */, ts+33658 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+34154 /* "config" */, ts+35011 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31397 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32750 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -180298,12 +186399,12 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33675, /* "DELETE FROM %Q.'..." */ + ts+35028, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33725, /* "DELETE FROM %Q.'..." */ + ts+35078, /* "DELETE FROM %Q.'..." */ libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } @@ -180313,7 +186414,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31397 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32750 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -180508,7 +186609,7 @@ func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+33754, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+35107, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -180705,14 +186806,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 36 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+30900 /* "content" */, bp+36 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32253 /* "content" */, bp+36 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 36 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 44 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31251 /* "docsize" */, bp+44 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32604 /* "docsize" */, bp+44 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 44 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -180948,9 +187049,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.Xmemcpy(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint32(unsafe.Sizeof(aAsciiTokenChar))) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33786 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35139 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33797 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35150 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -181189,7 +187290,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 33808 /* "L* N* Co" */ + var zCat uintptr = ts + 35161 /* "L* N* Co" */ var i int32 libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Unicode61Tokenizer{}))) @@ -181202,7 +187303,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33817 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35170 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) } } @@ -181213,18 +187314,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33828 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35181 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33786 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35139 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33797 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35150 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33817 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35170 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -181536,7 +187637,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 33846 /* "unicode61" */ + var zBase uintptr = ts + 35199 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -181687,7 +187788,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33856 /* "al" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35209 /* "al" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181695,11 +187796,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33859 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35212 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33864 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35217 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -181707,7 +187808,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33869 /* "er" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35222 /* "er" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181715,7 +187816,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33872 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35225 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181723,11 +187824,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33875 /* "able" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35228 /* "able" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33880 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35233 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -181735,19 +187836,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33885 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35238 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33889 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35242 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33895 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35248 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33900 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35253 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181755,11 +187856,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33904 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35257 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33908 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35261 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181767,7 +187868,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33911 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35264 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181775,11 +187876,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33915 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35268 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33919 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35272 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181787,7 +187888,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33923 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35276 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181795,7 +187896,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33927 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35280 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181803,7 +187904,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33931 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35284 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181820,24 +187921,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33935 /* "at" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33915 /* "ate" */, uint32(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35288 /* "at" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33938 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33941 /* "ble" */, uint32(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35291 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35294 /* "ble" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33945 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33931 /* "ize" */, uint32(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35298 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35284 /* "ize" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -181853,137 +187954,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+33948 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35301 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33915 /* "ate" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+33956 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35309 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33963 /* "tion" */, uint32(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35316 /* "tion" */, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33968 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35321 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33864 /* "ence" */, uint32(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35217 /* "ence" */, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33973 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35326 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33859 /* "ance" */, uint32(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35212 /* "ance" */, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33978 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35331 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33931 /* "ize" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35284 /* "ize" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33983 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35336 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14763 /* "log" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14778 /* "log" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33988 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35341 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+33941 /* "ble" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35294 /* "ble" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33992 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35345 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33997 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35350 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33900 /* "ent" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35253 /* "ent" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34003 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35356 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34007 /* "e" */, uint32(1)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35360 /* "e" */, uint32(1)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34009 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35362 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33923 /* "ous" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35276 /* "ous" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34015 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35368 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33931 /* "ize" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35284 /* "ize" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34023 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35376 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33915 /* "ate" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34029 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35382 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33915 /* "ate" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34034 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35387 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34040 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35393 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33927 /* "ive" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35280 /* "ive" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34048 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35401 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+34056 /* "ful" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35409 /* "ful" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34060 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35413 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33923 /* "ous" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35276 /* "ous" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34068 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35421 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34074 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35427 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33927 /* "ive" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35280 /* "ive" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34080 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35433 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33941 /* "ble" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35294 /* "ble" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -181999,16 +188100,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34087 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35440 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33872 /* "ic" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35225 /* "ic" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34092 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35445 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -182016,21 +188117,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34097 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35450 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33872 /* "ic" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35225 /* "ic" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34103 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35456 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33872 /* "ic" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35225 /* "ic" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34056 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35409 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182038,7 +188139,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34109 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35462 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -182046,9 +188147,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34115 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35468 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -182064,12 +188165,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34121 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35474 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34125 /* "ee" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35478 /* "ee" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34128 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35481 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -182078,7 +188179,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34131 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35484 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -182248,7 +188349,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+34135 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35488 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -182438,22 +188539,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(64) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 33846 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35199 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 34150 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35503 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 34156 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35509 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 34163 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35516 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -183796,14 +189897,14 @@ func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uint var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+34171 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+35524 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+34175 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35528 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+34179 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35532 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34188 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35541 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) @@ -183850,19 +189951,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(20) *(*[3]uintptr)(unsafe.Pointer(bp + 4 /* azSchema */)) = [3]uintptr{ - ts + 34222, /* "CREATE TABlE voc..." */ - ts + 34262, /* "CREATE TABlE voc..." */ - ts + 34297, /* "CREATE TABlE voc..." */ + ts + 35575, /* "CREATE TABlE voc..." */ + ts + 35615, /* "CREATE TABlE voc..." */ + ts + 35650, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == Size_t(4))) && (libc.Xmemcmp(tls, ts+21610 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == Size_t(4))) && (libc.Xmemcmp(tls, ts+21625 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34340 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35693 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -184014,11 +190115,11 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34373 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35726 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ - ts+34404, /* "SELECT t.%Q FROM..." */ + ts+35757, /* "SELECT t.%Q FROM..." */ libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+68 /* &pStmt */, uintptr(0)) @@ -184042,7 +190143,7 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* *(*uintptr)(unsafe.Pointer(bp + 68 /* pStmt */)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34455 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35808 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { @@ -184330,7 +190431,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 740 /* "" */ + zCopy = ts + 755 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -184447,7 +190548,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+34481 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+35834 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -184492,7 +190593,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 34491 /* "2021-06-18 18:36..." */ + return ts + 35844 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -185380,5 +191481,5 @@ func init() { *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 68 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: } -var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go index 07723ece..c4ce1443 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1449,6 +1449,9 @@ const ( SEEK_HOLE = 4 SEEK_SET = 0 SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 SF_Aggregate = 0x0000008 SF_All = 0x0000002 SF_ComplexResult = 0x0040000 @@ -1595,6 +1598,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -1751,6 +1765,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -2119,6 +2134,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -3827,7 +3844,7 @@ type X__float128 = float64 /* :47:21 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [17]uintptr{ +var sqlite3azCompileOpt = [18]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=gcc-8.3..." */ @@ -3840,13 +3857,14 @@ var sqlite3azCompileOpt = [17]uintptr{ ts + 130, /* "ENABLE_PREUPDATE..." */ ts + 152, /* "ENABLE_RBU" */ ts + 163, /* "ENABLE_RTREE" */ - ts + 176, /* "ENABLE_SNAPSHOT" */ - ts + 192, /* "ENABLE_STAT4" */ - ts + 205, /* "ENABLE_UNLOCK_NO..." */ - ts + 226, /* "LIKE_DOESNT_MATC..." */ - ts + 250, /* "SOUNDEX" */ - ts + 258, /* "SYSTEM_MALLOC" */ - ts + 272, /* "THREADSAFE=1" */ + ts + 176, /* "ENABLE_SESSION" */ + ts + 191, /* "ENABLE_SNAPSHOT" */ + ts + 207, /* "ENABLE_STAT4" */ + ts + 220, /* "ENABLE_UNLOCK_NO..." */ + ts + 241, /* "LIKE_DOESNT_MATC..." */ + ts + 265, /* "SOUNDEX" */ + ts + 273, /* "SYSTEM_MALLOC" */ + ts + 287, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -4162,7 +4180,7 @@ type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 285 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 300 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -7413,6 +7431,495 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + _ [4]byte + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + _ [4]byte + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -7463,10 +7970,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -11946,7 +12452,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 292 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 307 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -13097,7 +13603,7 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+299 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+314 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 @@ -13134,13 +13640,13 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+307 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+322 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+315 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+330 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -13259,7 +13765,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+319 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+334 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -13340,7 +13846,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+331 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+346 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -13522,7 +14028,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+56 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 104 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) if osLocaltime(tls, bp+104 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+335 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+350 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -13557,12 +14063,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 358 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 365 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 372 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 377 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 381 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 387 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 373 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 380 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 387 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 392 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 396 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 402 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -13601,7 +14107,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+392 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+407 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -13615,7 +14121,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+402 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+417 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -13624,7 +14130,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+412 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+427 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -13649,7 +14155,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+416 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+431 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -13674,7 +14180,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+425 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+440 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -13688,14 +14194,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+381 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+396 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+387 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+402 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+377 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+392 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -13916,7 +14422,7 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // var zBuf [100]int8 at bp+96, 100 computeYMD_HMS(tls, bp+48 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+435, /* "%04d-%02d-%02d %..." */ + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+450, /* "%04d-%02d-%02d %..." */ libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } @@ -13935,7 +14441,7 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeHMS(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+465 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+480 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13953,7 +14459,7 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeYMD(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+480 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+495 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -14080,7 +14586,7 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+495 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+510 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (uint64(2)) break fallthrough @@ -14090,14 +14596,14 @@ __3: if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+500 /* "%06.3f" */, libc.VaList(bp+8, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+515 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+495 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+510 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (uint64(2)) break fallthrough @@ -14115,10 +14621,10 @@ __3: if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+495 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+510 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (uint64(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+507 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+522 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (uint64(3)) } break @@ -14127,19 +14633,19 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+512 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+527 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+495 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+510 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (uint64(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+495 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+510 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (uint64(2)) break fallthrough @@ -14153,7 +14659,7 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+495 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+510 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (uint64(2)) break fallthrough @@ -14166,7 +14672,7 @@ __3: fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+518 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+533 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -14223,14 +14729,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 523 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 533 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 538 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 543 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 552 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 561 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 574 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 592 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 538 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 548 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 553 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 558 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 567 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 576 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 589 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 607 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -14807,7 +15313,7 @@ func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:1 p += 8 } else { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+605 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+620 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -14858,7 +15364,7 @@ func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* } else { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+643, /* "failed memory re..." */ + ts+658, /* "failed memory re..." */ libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) } return p @@ -16600,8 +17106,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 679 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 712 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 694 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 727 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -16855,7 +17361,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+719 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+734 /* "%" */, 1) goto __5 __11: ; @@ -17438,7 +17944,7 @@ __125: if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 721 /* "NaN" */ + bufpt = ts + 736 /* "NaN" */ length = 3 goto __58 __127: @@ -17498,7 +18004,7 @@ __138: } bufpt = bp + 8 /* &buf[0] */ *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix - libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+725 /* "Inf" */, uint64(4)) + libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+740 /* "Inf" */, uint64(4)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: @@ -17855,7 +18361,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 729 /* "" */ + bufpt = ts + 744 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -17984,9 +18490,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 730 /* "NULL" */ + return ts + 745 /* "NULL" */ } - return ts + 735 /* "(NULL)" */ + return ts + 750 /* "(NULL)" */ }() __220: ; @@ -18121,7 +18627,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+742 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+757 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -18136,7 +18642,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+744 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+759 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -18199,7 +18705,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 756 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 771 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -20433,7 +20939,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 765 /* "9223372036854775..." */ + var pow63 uintptr = ts + 780 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -21083,7 +21589,7 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+784, /* "API call with %s..." */ + ts+799, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -21102,14 +21608,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+730 /* "NULL" */) + logBadConnection(tls, ts+745 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+829 /* "unopened" */) + logBadConnection(tls, ts+844 /* "unopened" */) } return 0 } else { @@ -21123,7 +21629,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+838 /* "invalid" */) + logBadConnection(tls, ts+853 /* "invalid" */) return 0 } else { return 1 @@ -21651,186 +22157,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 846, /* "Savepoint" */ - /* 1 */ ts + 856, /* "AutoCommit" */ - /* 2 */ ts + 867, /* "Transaction" */ - /* 3 */ ts + 879, /* "SorterNext" */ - /* 4 */ ts + 890, /* "Prev" */ - /* 5 */ ts + 895, /* "Next" */ - /* 6 */ ts + 900, /* "Checkpoint" */ - /* 7 */ ts + 911, /* "JournalMode" */ - /* 8 */ ts + 923, /* "Vacuum" */ - /* 9 */ ts + 930, /* "VFilter" */ - /* 10 */ ts + 938, /* "VUpdate" */ - /* 11 */ ts + 946, /* "Goto" */ - /* 12 */ ts + 951, /* "Gosub" */ - /* 13 */ ts + 957, /* "InitCoroutine" */ - /* 14 */ ts + 971, /* "Yield" */ - /* 15 */ ts + 977, /* "MustBeInt" */ - /* 16 */ ts + 987, /* "Jump" */ - /* 17 */ ts + 992, /* "Once" */ - /* 18 */ ts + 997, /* "If" */ - /* 19 */ ts + 1000, /* "Not" */ - /* 20 */ ts + 1004, /* "IfNot" */ - /* 21 */ ts + 1010, /* "IfNullRow" */ - /* 22 */ ts + 1020, /* "SeekLT" */ - /* 23 */ ts + 1027, /* "SeekLE" */ - /* 24 */ ts + 1034, /* "SeekGE" */ - /* 25 */ ts + 1041, /* "SeekGT" */ - /* 26 */ ts + 1048, /* "IfNotOpen" */ - /* 27 */ ts + 1058, /* "IfNoHope" */ - /* 28 */ ts + 1067, /* "NoConflict" */ - /* 29 */ ts + 1078, /* "NotFound" */ - /* 30 */ ts + 1087, /* "Found" */ - /* 31 */ ts + 1093, /* "SeekRowid" */ - /* 32 */ ts + 1103, /* "NotExists" */ - /* 33 */ ts + 1113, /* "Last" */ - /* 34 */ ts + 1118, /* "IfSmaller" */ - /* 35 */ ts + 1128, /* "SorterSort" */ - /* 36 */ ts + 1139, /* "Sort" */ - /* 37 */ ts + 1144, /* "Rewind" */ - /* 38 */ ts + 1151, /* "IdxLE" */ - /* 39 */ ts + 1157, /* "IdxGT" */ - /* 40 */ ts + 1163, /* "IdxLT" */ - /* 41 */ ts + 1169, /* "IdxGE" */ - /* 42 */ ts + 1175, /* "RowSetRead" */ - /* 43 */ ts + 1186, /* "Or" */ - /* 44 */ ts + 1189, /* "And" */ - /* 45 */ ts + 1193, /* "RowSetTest" */ - /* 46 */ ts + 1204, /* "Program" */ - /* 47 */ ts + 1212, /* "FkIfZero" */ - /* 48 */ ts + 1221, /* "IfPos" */ - /* 49 */ ts + 1227, /* "IfNotZero" */ - /* 50 */ ts + 1237, /* "IsNull" */ - /* 51 */ ts + 1244, /* "NotNull" */ - /* 52 */ ts + 1252, /* "Ne" */ - /* 53 */ ts + 1255, /* "Eq" */ - /* 54 */ ts + 1258, /* "Gt" */ - /* 55 */ ts + 1261, /* "Le" */ - /* 56 */ ts + 1264, /* "Lt" */ - /* 57 */ ts + 1267, /* "Ge" */ - /* 58 */ ts + 1270, /* "ElseEq" */ - /* 59 */ ts + 1277, /* "DecrJumpZero" */ - /* 60 */ ts + 1290, /* "IncrVacuum" */ - /* 61 */ ts + 1301, /* "VNext" */ - /* 62 */ ts + 1307, /* "Init" */ - /* 63 */ ts + 1312, /* "PureFunc" */ - /* 64 */ ts + 1321, /* "Function" */ - /* 65 */ ts + 1330, /* "Return" */ - /* 66 */ ts + 1337, /* "EndCoroutine" */ - /* 67 */ ts + 1350, /* "HaltIfNull" */ - /* 68 */ ts + 1361, /* "Halt" */ - /* 69 */ ts + 1366, /* "Integer" */ - /* 70 */ ts + 1374, /* "Int64" */ - /* 71 */ ts + 1380, /* "String" */ - /* 72 */ ts + 1387, /* "Null" */ - /* 73 */ ts + 1392, /* "SoftNull" */ - /* 74 */ ts + 1401, /* "Blob" */ - /* 75 */ ts + 1406, /* "Variable" */ - /* 76 */ ts + 1415, /* "Move" */ - /* 77 */ ts + 1420, /* "Copy" */ - /* 78 */ ts + 1425, /* "SCopy" */ - /* 79 */ ts + 1431, /* "IntCopy" */ - /* 80 */ ts + 1439, /* "ChngCntRow" */ - /* 81 */ ts + 1450, /* "ResultRow" */ - /* 82 */ ts + 1460, /* "CollSeq" */ - /* 83 */ ts + 1468, /* "AddImm" */ - /* 84 */ ts + 1475, /* "RealAffinity" */ - /* 85 */ ts + 1488, /* "Cast" */ - /* 86 */ ts + 1493, /* "Permutation" */ - /* 87 */ ts + 1505, /* "Compare" */ - /* 88 */ ts + 1513, /* "IsTrue" */ - /* 89 */ ts + 1520, /* "ZeroOrNull" */ - /* 90 */ ts + 1531, /* "Offset" */ - /* 91 */ ts + 1538, /* "Column" */ - /* 92 */ ts + 1545, /* "Affinity" */ - /* 93 */ ts + 1554, /* "MakeRecord" */ - /* 94 */ ts + 1565, /* "Count" */ - /* 95 */ ts + 1571, /* "ReadCookie" */ - /* 96 */ ts + 1582, /* "SetCookie" */ - /* 97 */ ts + 1592, /* "ReopenIdx" */ - /* 98 */ ts + 1602, /* "OpenRead" */ - /* 99 */ ts + 1611, /* "OpenWrite" */ - /* 100 */ ts + 1621, /* "OpenDup" */ - /* 101 */ ts + 1629, /* "OpenAutoindex" */ - /* 102 */ ts + 1643, /* "BitAnd" */ - /* 103 */ ts + 1650, /* "BitOr" */ - /* 104 */ ts + 1656, /* "ShiftLeft" */ - /* 105 */ ts + 1666, /* "ShiftRight" */ - /* 106 */ ts + 1677, /* "Add" */ - /* 107 */ ts + 1681, /* "Subtract" */ - /* 108 */ ts + 1690, /* "Multiply" */ - /* 109 */ ts + 1699, /* "Divide" */ - /* 110 */ ts + 1706, /* "Remainder" */ - /* 111 */ ts + 1716, /* "Concat" */ - /* 112 */ ts + 1723, /* "OpenEphemeral" */ - /* 113 */ ts + 1737, /* "BitNot" */ - /* 114 */ ts + 1744, /* "SorterOpen" */ - /* 115 */ ts + 1755, /* "SequenceTest" */ - /* 116 */ ts + 1768, /* "String8" */ - /* 117 */ ts + 1776, /* "OpenPseudo" */ - /* 118 */ ts + 1787, /* "Close" */ - /* 119 */ ts + 1793, /* "ColumnsUsed" */ - /* 120 */ ts + 1805, /* "SeekScan" */ - /* 121 */ ts + 1814, /* "SeekHit" */ - /* 122 */ ts + 1822, /* "Sequence" */ - /* 123 */ ts + 1831, /* "NewRowid" */ - /* 124 */ ts + 1840, /* "Insert" */ - /* 125 */ ts + 1847, /* "RowCell" */ - /* 126 */ ts + 1855, /* "Delete" */ - /* 127 */ ts + 1862, /* "ResetCount" */ - /* 128 */ ts + 1873, /* "SorterCompare" */ - /* 129 */ ts + 1887, /* "SorterData" */ - /* 130 */ ts + 1898, /* "RowData" */ - /* 131 */ ts + 1906, /* "Rowid" */ - /* 132 */ ts + 1912, /* "NullRow" */ - /* 133 */ ts + 1920, /* "SeekEnd" */ - /* 134 */ ts + 1928, /* "IdxInsert" */ - /* 135 */ ts + 1938, /* "SorterInsert" */ - /* 136 */ ts + 1951, /* "IdxDelete" */ - /* 137 */ ts + 1961, /* "DeferredSeek" */ - /* 138 */ ts + 1974, /* "IdxRowid" */ - /* 139 */ ts + 1983, /* "FinishSeek" */ - /* 140 */ ts + 1994, /* "Destroy" */ - /* 141 */ ts + 2002, /* "Clear" */ - /* 142 */ ts + 2008, /* "ResetSorter" */ - /* 143 */ ts + 2020, /* "CreateBtree" */ - /* 144 */ ts + 2032, /* "SqlExec" */ - /* 145 */ ts + 2040, /* "ParseSchema" */ - /* 146 */ ts + 2052, /* "LoadAnalysis" */ - /* 147 */ ts + 2065, /* "DropTable" */ - /* 148 */ ts + 2075, /* "DropIndex" */ - /* 149 */ ts + 2085, /* "DropTrigger" */ - /* 150 */ ts + 2097, /* "IntegrityCk" */ - /* 151 */ ts + 2109, /* "RowSetAdd" */ - /* 152 */ ts + 2119, /* "Real" */ - /* 153 */ ts + 2124, /* "Param" */ - /* 154 */ ts + 2130, /* "FkCounter" */ - /* 155 */ ts + 2140, /* "MemMax" */ - /* 156 */ ts + 2147, /* "OffsetLimit" */ - /* 157 */ ts + 2159, /* "AggInverse" */ - /* 158 */ ts + 2170, /* "AggStep" */ - /* 159 */ ts + 2178, /* "AggStep1" */ - /* 160 */ ts + 2187, /* "AggValue" */ - /* 161 */ ts + 2196, /* "AggFinal" */ - /* 162 */ ts + 2205, /* "Expire" */ - /* 163 */ ts + 2212, /* "CursorLock" */ - /* 164 */ ts + 2223, /* "CursorUnlock" */ - /* 165 */ ts + 2236, /* "TableLock" */ - /* 166 */ ts + 2246, /* "VBegin" */ - /* 167 */ ts + 2253, /* "VCreate" */ - /* 168 */ ts + 2261, /* "VDestroy" */ - /* 169 */ ts + 2270, /* "VOpen" */ - /* 170 */ ts + 2276, /* "VColumn" */ - /* 171 */ ts + 2284, /* "VRename" */ - /* 172 */ ts + 2292, /* "Pagecount" */ - /* 173 */ ts + 2302, /* "MaxPgcnt" */ - /* 174 */ ts + 2311, /* "Trace" */ - /* 175 */ ts + 2317, /* "CursorHint" */ - /* 176 */ ts + 2328, /* "ReleaseReg" */ - /* 177 */ ts + 2339, /* "Noop" */ - /* 178 */ ts + 2344, /* "Explain" */ - /* 179 */ ts + 2352, /* "Abortable" */ + /* 0 */ ts + 861, /* "Savepoint" */ + /* 1 */ ts + 871, /* "AutoCommit" */ + /* 2 */ ts + 882, /* "Transaction" */ + /* 3 */ ts + 894, /* "SorterNext" */ + /* 4 */ ts + 905, /* "Prev" */ + /* 5 */ ts + 910, /* "Next" */ + /* 6 */ ts + 915, /* "Checkpoint" */ + /* 7 */ ts + 926, /* "JournalMode" */ + /* 8 */ ts + 938, /* "Vacuum" */ + /* 9 */ ts + 945, /* "VFilter" */ + /* 10 */ ts + 953, /* "VUpdate" */ + /* 11 */ ts + 961, /* "Goto" */ + /* 12 */ ts + 966, /* "Gosub" */ + /* 13 */ ts + 972, /* "InitCoroutine" */ + /* 14 */ ts + 986, /* "Yield" */ + /* 15 */ ts + 992, /* "MustBeInt" */ + /* 16 */ ts + 1002, /* "Jump" */ + /* 17 */ ts + 1007, /* "Once" */ + /* 18 */ ts + 1012, /* "If" */ + /* 19 */ ts + 1015, /* "Not" */ + /* 20 */ ts + 1019, /* "IfNot" */ + /* 21 */ ts + 1025, /* "IfNullRow" */ + /* 22 */ ts + 1035, /* "SeekLT" */ + /* 23 */ ts + 1042, /* "SeekLE" */ + /* 24 */ ts + 1049, /* "SeekGE" */ + /* 25 */ ts + 1056, /* "SeekGT" */ + /* 26 */ ts + 1063, /* "IfNotOpen" */ + /* 27 */ ts + 1073, /* "IfNoHope" */ + /* 28 */ ts + 1082, /* "NoConflict" */ + /* 29 */ ts + 1093, /* "NotFound" */ + /* 30 */ ts + 1102, /* "Found" */ + /* 31 */ ts + 1108, /* "SeekRowid" */ + /* 32 */ ts + 1118, /* "NotExists" */ + /* 33 */ ts + 1128, /* "Last" */ + /* 34 */ ts + 1133, /* "IfSmaller" */ + /* 35 */ ts + 1143, /* "SorterSort" */ + /* 36 */ ts + 1154, /* "Sort" */ + /* 37 */ ts + 1159, /* "Rewind" */ + /* 38 */ ts + 1166, /* "IdxLE" */ + /* 39 */ ts + 1172, /* "IdxGT" */ + /* 40 */ ts + 1178, /* "IdxLT" */ + /* 41 */ ts + 1184, /* "IdxGE" */ + /* 42 */ ts + 1190, /* "RowSetRead" */ + /* 43 */ ts + 1201, /* "Or" */ + /* 44 */ ts + 1204, /* "And" */ + /* 45 */ ts + 1208, /* "RowSetTest" */ + /* 46 */ ts + 1219, /* "Program" */ + /* 47 */ ts + 1227, /* "FkIfZero" */ + /* 48 */ ts + 1236, /* "IfPos" */ + /* 49 */ ts + 1242, /* "IfNotZero" */ + /* 50 */ ts + 1252, /* "IsNull" */ + /* 51 */ ts + 1259, /* "NotNull" */ + /* 52 */ ts + 1267, /* "Ne" */ + /* 53 */ ts + 1270, /* "Eq" */ + /* 54 */ ts + 1273, /* "Gt" */ + /* 55 */ ts + 1276, /* "Le" */ + /* 56 */ ts + 1279, /* "Lt" */ + /* 57 */ ts + 1282, /* "Ge" */ + /* 58 */ ts + 1285, /* "ElseEq" */ + /* 59 */ ts + 1292, /* "DecrJumpZero" */ + /* 60 */ ts + 1305, /* "IncrVacuum" */ + /* 61 */ ts + 1316, /* "VNext" */ + /* 62 */ ts + 1322, /* "Init" */ + /* 63 */ ts + 1327, /* "PureFunc" */ + /* 64 */ ts + 1336, /* "Function" */ + /* 65 */ ts + 1345, /* "Return" */ + /* 66 */ ts + 1352, /* "EndCoroutine" */ + /* 67 */ ts + 1365, /* "HaltIfNull" */ + /* 68 */ ts + 1376, /* "Halt" */ + /* 69 */ ts + 1381, /* "Integer" */ + /* 70 */ ts + 1389, /* "Int64" */ + /* 71 */ ts + 1395, /* "String" */ + /* 72 */ ts + 1402, /* "Null" */ + /* 73 */ ts + 1407, /* "SoftNull" */ + /* 74 */ ts + 1416, /* "Blob" */ + /* 75 */ ts + 1421, /* "Variable" */ + /* 76 */ ts + 1430, /* "Move" */ + /* 77 */ ts + 1435, /* "Copy" */ + /* 78 */ ts + 1440, /* "SCopy" */ + /* 79 */ ts + 1446, /* "IntCopy" */ + /* 80 */ ts + 1454, /* "ChngCntRow" */ + /* 81 */ ts + 1465, /* "ResultRow" */ + /* 82 */ ts + 1475, /* "CollSeq" */ + /* 83 */ ts + 1483, /* "AddImm" */ + /* 84 */ ts + 1490, /* "RealAffinity" */ + /* 85 */ ts + 1503, /* "Cast" */ + /* 86 */ ts + 1508, /* "Permutation" */ + /* 87 */ ts + 1520, /* "Compare" */ + /* 88 */ ts + 1528, /* "IsTrue" */ + /* 89 */ ts + 1535, /* "ZeroOrNull" */ + /* 90 */ ts + 1546, /* "Offset" */ + /* 91 */ ts + 1553, /* "Column" */ + /* 92 */ ts + 1560, /* "Affinity" */ + /* 93 */ ts + 1569, /* "MakeRecord" */ + /* 94 */ ts + 1580, /* "Count" */ + /* 95 */ ts + 1586, /* "ReadCookie" */ + /* 96 */ ts + 1597, /* "SetCookie" */ + /* 97 */ ts + 1607, /* "ReopenIdx" */ + /* 98 */ ts + 1617, /* "OpenRead" */ + /* 99 */ ts + 1626, /* "OpenWrite" */ + /* 100 */ ts + 1636, /* "OpenDup" */ + /* 101 */ ts + 1644, /* "OpenAutoindex" */ + /* 102 */ ts + 1658, /* "BitAnd" */ + /* 103 */ ts + 1665, /* "BitOr" */ + /* 104 */ ts + 1671, /* "ShiftLeft" */ + /* 105 */ ts + 1681, /* "ShiftRight" */ + /* 106 */ ts + 1692, /* "Add" */ + /* 107 */ ts + 1696, /* "Subtract" */ + /* 108 */ ts + 1705, /* "Multiply" */ + /* 109 */ ts + 1714, /* "Divide" */ + /* 110 */ ts + 1721, /* "Remainder" */ + /* 111 */ ts + 1731, /* "Concat" */ + /* 112 */ ts + 1738, /* "OpenEphemeral" */ + /* 113 */ ts + 1752, /* "BitNot" */ + /* 114 */ ts + 1759, /* "SorterOpen" */ + /* 115 */ ts + 1770, /* "SequenceTest" */ + /* 116 */ ts + 1783, /* "String8" */ + /* 117 */ ts + 1791, /* "OpenPseudo" */ + /* 118 */ ts + 1802, /* "Close" */ + /* 119 */ ts + 1808, /* "ColumnsUsed" */ + /* 120 */ ts + 1820, /* "SeekScan" */ + /* 121 */ ts + 1829, /* "SeekHit" */ + /* 122 */ ts + 1837, /* "Sequence" */ + /* 123 */ ts + 1846, /* "NewRowid" */ + /* 124 */ ts + 1855, /* "Insert" */ + /* 125 */ ts + 1862, /* "RowCell" */ + /* 126 */ ts + 1870, /* "Delete" */ + /* 127 */ ts + 1877, /* "ResetCount" */ + /* 128 */ ts + 1888, /* "SorterCompare" */ + /* 129 */ ts + 1902, /* "SorterData" */ + /* 130 */ ts + 1913, /* "RowData" */ + /* 131 */ ts + 1921, /* "Rowid" */ + /* 132 */ ts + 1927, /* "NullRow" */ + /* 133 */ ts + 1935, /* "SeekEnd" */ + /* 134 */ ts + 1943, /* "IdxInsert" */ + /* 135 */ ts + 1953, /* "SorterInsert" */ + /* 136 */ ts + 1966, /* "IdxDelete" */ + /* 137 */ ts + 1976, /* "DeferredSeek" */ + /* 138 */ ts + 1989, /* "IdxRowid" */ + /* 139 */ ts + 1998, /* "FinishSeek" */ + /* 140 */ ts + 2009, /* "Destroy" */ + /* 141 */ ts + 2017, /* "Clear" */ + /* 142 */ ts + 2023, /* "ResetSorter" */ + /* 143 */ ts + 2035, /* "CreateBtree" */ + /* 144 */ ts + 2047, /* "SqlExec" */ + /* 145 */ ts + 2055, /* "ParseSchema" */ + /* 146 */ ts + 2067, /* "LoadAnalysis" */ + /* 147 */ ts + 2080, /* "DropTable" */ + /* 148 */ ts + 2090, /* "DropIndex" */ + /* 149 */ ts + 2100, /* "DropTrigger" */ + /* 150 */ ts + 2112, /* "IntegrityCk" */ + /* 151 */ ts + 2124, /* "RowSetAdd" */ + /* 152 */ ts + 2134, /* "Real" */ + /* 153 */ ts + 2139, /* "Param" */ + /* 154 */ ts + 2145, /* "FkCounter" */ + /* 155 */ ts + 2155, /* "MemMax" */ + /* 156 */ ts + 2162, /* "OffsetLimit" */ + /* 157 */ ts + 2174, /* "AggInverse" */ + /* 158 */ ts + 2185, /* "AggStep" */ + /* 159 */ ts + 2193, /* "AggStep1" */ + /* 160 */ ts + 2202, /* "AggValue" */ + /* 161 */ ts + 2211, /* "AggFinal" */ + /* 162 */ ts + 2220, /* "Expire" */ + /* 163 */ ts + 2227, /* "CursorLock" */ + /* 164 */ ts + 2238, /* "CursorUnlock" */ + /* 165 */ ts + 2251, /* "TableLock" */ + /* 166 */ ts + 2261, /* "VBegin" */ + /* 167 */ ts + 2268, /* "VCreate" */ + /* 168 */ ts + 2276, /* "VDestroy" */ + /* 169 */ ts + 2285, /* "VOpen" */ + /* 170 */ ts + 2291, /* "VColumn" */ + /* 171 */ ts + 2299, /* "VRename" */ + /* 172 */ ts + 2307, /* "Pagecount" */ + /* 173 */ ts + 2317, /* "MaxPgcnt" */ + /* 174 */ ts + 2326, /* "Trace" */ + /* 175 */ ts + 2332, /* "CursorHint" */ + /* 176 */ ts + 2343, /* "ReleaseReg" */ + /* 177 */ ts + 2354, /* "Noop" */ + /* 178 */ ts + 2359, /* "Explain" */ + /* 179 */ ts + 2367, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -23443,67 +23949,67 @@ type unix_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [29]unix_syscall{ - {FzName: ts + 2362 /* "open" */, FpCurrent: 0}, + {FzName: ts + 2377 /* "open" */, FpCurrent: 0}, - {FzName: ts + 2367 /* "close" */, FpCurrent: 0}, + {FzName: ts + 2382 /* "close" */, FpCurrent: 0}, - {FzName: ts + 2373 /* "access" */, FpCurrent: 0}, + {FzName: ts + 2388 /* "access" */, FpCurrent: 0}, - {FzName: ts + 2380 /* "getcwd" */, FpCurrent: 0}, + {FzName: ts + 2395 /* "getcwd" */, FpCurrent: 0}, - {FzName: ts + 2387 /* "stat" */, FpCurrent: 0}, + {FzName: ts + 2402 /* "stat" */, FpCurrent: 0}, // The DJGPP compiler environment looks mostly like Unix, but it // lacks the fcntl() system call. So redefine fcntl() to be something // that always succeeds. This means that locking does not occur under // DJGPP. But it is DOS - what did you expect? - {FzName: ts + 2392 /* "fstat" */, FpCurrent: 0}, + {FzName: ts + 2407 /* "fstat" */, FpCurrent: 0}, - {FzName: ts + 2398 /* "ftruncate" */, FpCurrent: 0}, + {FzName: ts + 2413 /* "ftruncate" */, FpCurrent: 0}, - {FzName: ts + 2408 /* "fcntl" */, FpCurrent: 0}, + {FzName: ts + 2423 /* "fcntl" */, FpCurrent: 0}, - {FzName: ts + 2414 /* "read" */, FpCurrent: 0}, + {FzName: ts + 2429 /* "read" */, FpCurrent: 0}, - {FzName: ts + 2419 /* "pread" */}, + {FzName: ts + 2434 /* "pread" */}, - {FzName: ts + 2425 /* "pread64" */}, + {FzName: ts + 2440 /* "pread64" */}, - {FzName: ts + 2433 /* "write" */, FpCurrent: 0}, + {FzName: ts + 2448 /* "write" */, FpCurrent: 0}, - {FzName: ts + 2439 /* "pwrite" */}, + {FzName: ts + 2454 /* "pwrite" */}, - {FzName: ts + 2446 /* "pwrite64" */}, + {FzName: ts + 2461 /* "pwrite64" */}, - {FzName: ts + 2455 /* "fchmod" */, FpCurrent: 0}, + {FzName: ts + 2470 /* "fchmod" */, FpCurrent: 0}, - {FzName: ts + 2462 /* "fallocate" */}, + {FzName: ts + 2477 /* "fallocate" */}, - {FzName: ts + 2472 /* "unlink" */, FpCurrent: 0}, + {FzName: ts + 2487 /* "unlink" */, FpCurrent: 0}, - {FzName: ts + 2479 /* "openDirectory" */, FpCurrent: 0}, + {FzName: ts + 2494 /* "openDirectory" */, FpCurrent: 0}, - {FzName: ts + 2493 /* "mkdir" */, FpCurrent: 0}, + {FzName: ts + 2508 /* "mkdir" */, FpCurrent: 0}, - {FzName: ts + 2499 /* "rmdir" */, FpCurrent: 0}, + {FzName: ts + 2514 /* "rmdir" */, FpCurrent: 0}, - {FzName: ts + 2505 /* "fchown" */, FpCurrent: 0}, + {FzName: ts + 2520 /* "fchown" */, FpCurrent: 0}, - {FzName: ts + 2512 /* "geteuid" */, FpCurrent: 0}, + {FzName: ts + 2527 /* "geteuid" */, FpCurrent: 0}, - {FzName: ts + 2520 /* "mmap" */, FpCurrent: 0}, + {FzName: ts + 2535 /* "mmap" */, FpCurrent: 0}, - {FzName: ts + 2525 /* "munmap" */, FpCurrent: 0}, + {FzName: ts + 2540 /* "munmap" */, FpCurrent: 0}, - {FzName: ts + 2532 /* "mremap" */, FpCurrent: 0}, + {FzName: ts + 2547 /* "mremap" */, FpCurrent: 0}, - {FzName: ts + 2539 /* "getpagesize" */, FpCurrent: 0}, + {FzName: ts + 2554 /* "getpagesize" */, FpCurrent: 0}, - {FzName: ts + 2551 /* "readlink" */, FpCurrent: 0}, + {FzName: ts + 2566 /* "readlink" */, FpCurrent: 0}, - {FzName: ts + 2560 /* "lstat" */, FpCurrent: 0}, + {FzName: ts + 2575 /* "lstat" */, FpCurrent: 0}, - {FzName: ts + 2566 /* "ioctl" */}, + {FzName: ts + 2581 /* "ioctl" */}, } /* sqlite3.c:34446:3 */ // End of the overrideable system calls @@ -23637,9 +24143,9 @@ func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3 } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, fd) Xsqlite3_log(tls, SQLITE_WARNING, - ts+2572 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + ts+2587 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) fd = -1 - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2615 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2630 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { break } } @@ -23897,13 +24403,13 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // the strerror() function to obtain the human-readable error message // equivalent to errno. Otherwise, use strerror_r(). // This is a threadsafe build, but strerror_r() is not available. - zErr = ts + 729 /* "" */ + zErr = ts + 744 /* "" */ if zPath == uintptr(0) { - zPath = ts + 729 /* "" */ + zPath = ts + 744 /* "" */ } Xsqlite3_log(tls, errcode, - ts+2625, /* "os_unix.c:%d: (%..." */ + ts+2640, /* "os_unix.c:%d: (%..." */ libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) return errcode @@ -23922,7 +24428,7 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // and move on. func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, h) != 0 { - unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2367, /* "close" */ + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2382, /* "close" */ func() uintptr { if pFile != 0 { return (*UnixFile)(unsafe.Pointer(pFile)).FzPath @@ -24081,19 +24587,19 @@ func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) if rc != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2656 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2671 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink == uint64(0) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2680 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2695 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink > uint64(1) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2709 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2724 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2736 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2751 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -25207,7 +25713,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql var fd int32 = -1 // var zDirname [513]int8 at bp+8, 513 - Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2764 /* "%s" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2779 /* "%s" */, libc.VaList(bp, zFilename)) for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { } if ii > 0 { @@ -25226,7 +25732,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql if fd >= 0 { return SQLITE_OK } - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2479 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2494 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) } // Make sure all writes to a particular file are committed to disk. @@ -25261,7 +25767,7 @@ func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793 if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2767 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2782 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) } // Also fsync the directory containing the file if the DIRSYNC flag @@ -25299,7 +25805,7 @@ func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:378 rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2398 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2413 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) } else { // If the file was just truncated to a size smaller than the currently @@ -25378,7 +25884,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if iWrite >= nSize { iWrite = (nSize - int64(1)) } - nWrite = seekAndWrite(tls, pFile, iWrite, ts+729 /* "" */, 1) + nWrite = seekAndWrite(tls, pFile, iWrite, ts+744 /* "" */, 1) if nWrite != 1 { return (SQLITE_IOERR | (int32(3) << 8)) } @@ -25391,7 +25897,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2398 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2413 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) } } @@ -25465,7 +25971,7 @@ func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK } @@ -25751,7 +26257,7 @@ func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 // help detect if a -shm file truncation is legitimate or is the work // or a rogue process. if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2398 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2413 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) } } } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { @@ -25857,7 +26363,7 @@ __4: ; libc.Xmemset(tls, pShmNode, 0, (uint64(unsafe.Sizeof(unixShmNode{})) + uint64(nShmFilename))) zShm = libc.AssignPtrUintptr(pShmNode+16 /* &.zFilename */, (pShmNode + 1*96)) - Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2778 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2793 /* "%s-shm" */, libc.VaList(bp, zBasePath)) (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode @@ -25879,7 +26385,7 @@ __5: if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { goto __7 } - if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2785 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2800 /* "readonly_shm" */, 0)) { goto __8 } (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | 0400000), @@ -25894,7 +26400,7 @@ __8: if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { goto __10 } - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2362 /* "open" */, zShm, 38716) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2377 /* "open" */, zShm, 38716) goto shm_open_err __10: ; @@ -26061,11 +26567,11 @@ __11: goto __13 } *(*int32)(unsafe.Pointer(bp + 144 /* x */)) = 0 - if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+729 /* "" */, 1, bp+144 /* &x */) != 1) { + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+744 /* "" */, 1, bp+144 /* &x */) != 1) { goto __14 } zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2433 /* "write" */, zFile, 38860) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2448 /* "write" */, zFile, 38860) goto shmpage_out __14: ; @@ -26113,7 +26619,7 @@ __16: if !(pMem == (libc.UintptrFromInt32(-1))) { goto __20 } - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2520 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2535 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) goto shmpage_out __20: ; @@ -26372,7 +26878,7 @@ func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ // continue accessing the database using the xRead() and xWrite() // methods. func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ - var zErr uintptr = ts + 2520 /* "mmap" */ + var zErr uintptr = ts + 2535 /* "mmap" */ var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes @@ -26389,7 +26895,7 @@ func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13 } pNew = (*(*func(*libc.TLS, uintptr, Size_t, Size_t, int32, uintptr) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 24*24 + 8 /* &.pCurrent */))))(tls, pOrig, uint64(nReuse), uint64(nNew), MREMAP_MAYMOVE, 0) - zErr = ts + 2532 /* "mremap" */ + zErr = ts + 2547 /* "mremap" */ // The attempt to extend the existing mapping failed. Free it. if (pNew == (libc.UintptrFromInt32(-1))) || (pNew == uintptr(0)) { @@ -26625,10 +27131,10 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename } return uintptr(0) }(), - ts+2798 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + ts+2813 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2803 /* "unix-excl" */) == 0 { + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2818 /* "unix-excl" */) == 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) } @@ -26674,7 +27180,7 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename if zLockFile == uintptr(0) { rc = SQLITE_NOMEM } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2813 /* "%s.lock" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2828 /* "%s.lock" */, libc.VaList(bp, zFilename)) } (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -26704,10 +27210,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var zDir uintptr = Xsqlite3_temp_directory if !(int32(azDirs[0]) != 0) { - azDirs[0] = libc.Xgetenv(tls, ts+2821 /* "SQLITE_TMPDIR" */) + azDirs[0] = libc.Xgetenv(tls, ts+2836 /* "SQLITE_TMPDIR" */) } if !(int32(azDirs[1]) != 0) { - azDirs[1] = libc.Xgetenv(tls, ts+2835 /* "TMPDIR" */) + azDirs[1] = libc.Xgetenv(tls, ts+2850 /* "TMPDIR" */) } for 1 != 0 { if (((zDir != uintptr(0)) && @@ -26727,10 +27233,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var azDirs = [6]uintptr{ uintptr(0), uintptr(0), - ts + 2842, /* "/var/tmp" */ - ts + 2851, /* "/usr/tmp" */ - ts + 2860, /* "/tmp" */ - ts + 742, /* "." */ + ts + 2857, /* "/var/tmp" */ + ts + 2866, /* "/usr/tmp" */ + ts + 2875, /* "/tmp" */ + ts + 757, /* "." */ } /* sqlite3.c:39857:21 */ // Create a temporary file name in zBuf. zBuf must be allocated @@ -26758,7 +27264,7 @@ func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2865, /* "%s/etilqs_%llx%c" */ + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2880, /* "%s/etilqs_%llx%c" */ libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { return SQLITE_ERROR @@ -26914,7 +27420,7 @@ func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr // filename, check for the "modeof" parameter. If present, interpret // its value as a filename and try to copy the mode, uid and gid from // that file. - var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2882 /* "modeof" */) + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2897 /* "modeof" */) if z != 0 { rc = getFileMode(tls, z, pMode, pUid, pGid) } @@ -27140,7 +27646,7 @@ __15: if !(fd < 0) { goto __19 } - rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2362 /* "open" */, zName, 40257) + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2377 /* "open" */, zName, 40257) if !(rc == SQLITE_OK) { goto __20 } @@ -27251,7 +27757,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) == ENOENT { rc = (SQLITE_IOERR | (int32(23) << 8)) } else { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2472 /* "unlink" */, zPath, 40396) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2487 /* "unlink" */, zPath, 40396) } return rc } @@ -27261,7 +27767,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) if rc == SQLITE_OK { if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2889 /* "fsync" */, zPath, 40406) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2904 /* "fsync" */, zPath, 40406) } robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) } else { @@ -27336,7 +27842,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, zOut, (uint64(nOut-2))) == uintptr(0) { - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2380 /* "getcwd" */, zPath, 40485) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2395 /* "getcwd" */, zPath, 40485) } iOff = Xsqlite3Strlen30(tls, zOut) *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') @@ -27347,7 +27853,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) return Xsqlite3CantopenError(tls, 40494) } - Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2764 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2779 /* "%s" */, libc.VaList(bp, zPath)) // Remove duplicate '/' characters. Except, two // at the beginning // of a pathname is allowed since this is important on windows. @@ -27422,7 +27928,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*24 + 8 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) != ENOENT { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2560 /* "lstat" */, zIn, 40577) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2575 /* "lstat" */, zIn, 40577) } } else { bLink = (libc.Bool32((((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode) & X__mode_t(0170000)) == (X__mode_t(0120000)))) @@ -27442,7 +27948,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if rc == SQLITE_OK { nByte = int32((*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls, zIn, zDel, (uint64(nOut - 1)))) if nByte < 0 { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2551 /* "readlink" */, zIn, 40595) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2566 /* "readlink" */, zIn, 40595) } else { if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { var n int32 @@ -27536,7 +28042,7 @@ func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { unixEnterMutex(tls) zErr = libc.Xdlerror(tls) if zErr != 0 { - Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2764 /* "%s" */, libc.VaList(bp, zErr)) + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2779 /* "%s" */, libc.VaList(bp, zErr)) } unixLeaveMutex(tls) } @@ -27593,7 +28099,7 @@ func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) in { var fd int32 var got int32 - fd = robust_open(tls, ts+2895 /* "/dev/urandom" */, O_RDONLY, uint32(0)) + fd = robust_open(tls, ts+2910 /* "/dev/urandom" */, O_RDONLY, uint32(0)) if fd < 0 { // var t Time_t at bp, 8 @@ -27890,10 +28396,10 @@ func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ } var aVfs = [4]Sqlite3_vfs{ - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2908 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2913 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2923 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2803 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2923 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2928 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2938 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2818 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, } /* sqlite3.c:42091:22 */ // Shutdown the operating system interface. @@ -27988,7 +28494,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 2936, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 2951, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -28220,7 +28726,7 @@ func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int3 var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2942 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2957 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -28363,7 +28869,7 @@ func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+2764 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+2779 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -28480,7 +28986,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+2957 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+2972 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { @@ -28553,7 +29059,7 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+2980 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+2995 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } @@ -34031,7 +34537,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+2995, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3010, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -35783,7 +36289,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3022 /* "-journal" */, uint64(8)) + libc.Xmemcpy(tls, pPtr, ts+3037 /* "-journal" */, uint64(8)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -35798,7 +36304,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3031 /* "-wal" */, uint64(4)) + libc.Xmemcpy(tls, pPtr, ts+3046 /* "-wal" */, uint64(4)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -35857,9 +36363,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3036 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3051 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3043 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3058 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -39756,7 +40262,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+3053, /* "recovered %d fra..." */ + ts+3068, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -40501,7 +41007,7 @@ func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13 } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+3090 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+3105 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -43281,7 +43787,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3116 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3131 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -45321,7 +45827,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3132 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3147 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -46195,7 +46701,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+3141 /* "@ " */, uint64(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+3156 /* "@ " */, uint64(3)) != 0) { goto __14 } goto page1_init_failed @@ -53711,7 +54217,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3145 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3160 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 56 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -53747,11 +54253,11 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+3147 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3162 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+3170 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + checkAppendMsg(tls, pCheck, ts+3185 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -53778,13 +54284,13 @@ func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent P if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+3195 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+3210 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+3224, /* "Bad ptr map entr..." */ + ts+3239, /* "Bad ptr map entr..." */ libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } @@ -53807,7 +54313,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } N-- if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+3278 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3293 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) @@ -53818,7 +54324,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+3300 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + ts+3315 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -53844,12 +54350,12 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+3339, /* "%s is %d but sho..." */ + ts+3354, /* "%s is %d but sho..." */ libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 3365 /* "size" */ + return ts + 3380 /* "size" */ } - return ts + 3370 /* "overflow list le..." */ + return ts + 3385 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -53993,13 +54499,13 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3391 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3406 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+3401 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+3416 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; @@ -54013,7 +54519,7 @@ __3: } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+3439 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + ts+3454 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; @@ -54021,7 +54527,7 @@ __4: goto __5 } - checkAppendMsg(tls, pCheck, ts+3477 /* "free space corru..." */, libc.VaList(bp+16, rc)) + checkAppendMsg(tls, pCheck, ts+3492 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; @@ -54029,7 +54535,7 @@ __5: hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3499 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3514 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -54051,7 +54557,7 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3525 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3540 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; @@ -54082,7 +54588,7 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+3553, /* "Offset %d out of..." */ + checkAppendMsg(tls, pCheck, ts+3568, /* "Offset %d out of..." */ libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 @@ -54093,7 +54599,7 @@ __12: if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+3583 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+3598 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: @@ -54111,7 +54617,7 @@ __13: }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+3607 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+3622 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) __15: ; *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey @@ -54152,7 +54658,7 @@ __20: if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+3631 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+3646 /* "Child page depth..." */, 0) depth = d2 __21: ; @@ -54250,7 +54756,7 @@ __29: goto __31 } checkAppendMsg(tls, pCheck, - ts+3656 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) + ts+3671 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) goto __30 goto __32 __31: @@ -54270,7 +54776,7 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+3693, /* "Fragmentation of..." */ + ts+3708, /* "Fragmentation of..." */ libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; @@ -54399,7 +54905,7 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3745 /* "Main freelist: " */ + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3760 /* "Main freelist: " */ checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) @@ -54437,7 +54943,7 @@ __13: goto __15 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3761, /* "max rootpage (%d..." */ + ts+3776, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -54447,7 +54953,7 @@ __9: goto __16 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3806 /* "incremental_vacu..." */, 0) + ts+3821 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -54497,13 +55003,13 @@ __23: if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3861 /* "Page %d is never..." */, libc.VaList(bp+16, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3876 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3883 /* "Pointer map page..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3898 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -54822,7 +55328,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2764 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2779 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) @@ -54833,7 +55339,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3917 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3932 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -54854,7 +55360,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3937 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3952 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -54881,7 +55387,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+3968 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+3983 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -55495,7 +56001,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4008, /* "%!.15g" */ + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4023, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -56136,7 +56642,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -56342,6 +56848,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -56647,7 +57155,7 @@ __9: goto __10 } rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -56719,7 +57227,7 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 729 /* "" */ + zNeg = ts + 744 /* "" */ rc = SQLITE_OK __1: @@ -56768,7 +57276,7 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 4015 /* "-" */ + zNeg = ts + 4030 /* "-" */ __6: ; @@ -56788,7 +57296,7 @@ __9: Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+4017 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+4032 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } @@ -58233,34 +58741,34 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4022 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4037 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(j)*8)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 729 /* "" */ + zColl = ts + 744 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+292 /* "BINARY" */) == 0 { - zColl = ts + 4027 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+307 /* "BINARY" */) == 0 { + zColl = ts + 4042 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4029, /* ",%s%s%s" */ + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4044, /* ",%s%s%s" */ libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 4015 /* "-" */ + return ts + 4030 /* "-" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 4037 /* "N." */ + return ts + 4052 /* "N." */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4040 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4055 /* ")" */, 1) break } @@ -58268,7 +58776,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4042 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4057 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -58276,32 +58784,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4051 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4066 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4051 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4066 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4058 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4073 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4063 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4078 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+512 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+527 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -58311,14 +58819,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4058 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4073 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+512 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+527 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 730 /* "NULL" */ + zP4 = ts + 745 /* "NULL" */ } else { - zP4 = ts + 4066 /* "(blob)" */ + zP4 = ts + 4081 /* "(blob)" */ } break @@ -58326,7 +58834,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4073 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4088 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -58337,20 +58845,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4081 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4096 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4086 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4101 /* "]" */, 1) break } case -4: { - zP4 = ts + 4088 /* "program" */ + zP4 = ts + 4103 /* "program" */ break } @@ -58382,7 +58890,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 4096 /* "?" */, ts + 4098 /* "8" */, ts + 4100 /* "16LE" */, ts + 4105 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 4111 /* "?" */, ts + 4113 /* "8" */, ts + 4115 /* "16LE" */, ts + 4120 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -58913,8 +59421,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 4110 /* "addr" */, ts + 4115 /* "opcode" */, ts + 4122 /* "p1" */, ts + 4125 /* "p2" */, ts + 4128 /* "p3" */, ts + 4131 /* "p4" */, ts + 4134 /* "p5" */, ts + 4137, /* "comment" */ - ts + 4145 /* "id" */, ts + 4148 /* "parent" */, ts + 4155 /* "notused" */, ts + 4163, /* "detail" */ + ts + 4125 /* "addr" */, ts + 4130 /* "opcode" */, ts + 4137 /* "p1" */, ts + 4140 /* "p2" */, ts + 4143 /* "p3" */, ts + 4146 /* "p4" */, ts + 4149 /* "p5" */, ts + 4152, /* "comment" */ + ts + 4160 /* "id" */, ts + 4163 /* "parent" */, ts + 4170 /* "notused" */, ts + 4178, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -59162,7 +59670,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+4170 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+4185 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } @@ -59172,16 +59680,16 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4182 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4197 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4196 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4211 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4211, /* "-mj%06X9%02X" */ + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4226, /* "-mj%06X9%02X" */ libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. @@ -59375,7 +59883,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+4224 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4239 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -59657,7 +60165,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 2764 /* "%s" */ + return ts + 2779 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -61208,13 +61716,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 4254 /* "a CHECK constrai..." */ + zContext = ts + 4269 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 4273 /* "a generated colu..." */ + zContext = ts + 4288 /* "a generated colu..." */ } else { - zContext = ts + 4292 /* "an index" */ + zContext = ts + 4307 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+4301, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+4316, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -61345,7 +61853,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4337 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4352 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -61355,7 +61863,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4382 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4397 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -61825,7 +62333,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4422 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4437 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -62576,7 +63084,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+4445 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+4460 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -63353,7 +63861,7 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4485 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4500 /* "-- " */, 3) Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) } @@ -63391,11 +63899,11 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 184 /* idx */))-1))*56) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+730 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+745 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4058 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4073 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4008 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4023 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc @@ -63410,21 +63918,21 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = bp + 192 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4489 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4504 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { Xsqlite3VdbeMemRelease(tls, bp+192 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4496 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4511 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4509 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4524 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4512 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4527 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4517 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4532 /* "'" */, 1) } } } @@ -67123,19 +67631,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+4519 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+4534 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4540 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4555 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+2764 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+2779 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4547 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4562 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -69685,7 +70193,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+4571 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4586 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -69758,7 +70266,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+4622 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + Xsqlite3VdbeError(tls, p, ts+4637 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -69768,7 +70276,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+4644 /* "cannot release s..." */, 0) + ts+4659 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -69973,7 +70481,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+4698 /* "cannot commit tr..." */, 0) + ts+4713 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -70016,13 +70524,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 4753 /* "cannot start a t..." */ + return ts + 4768 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 4801 /* "cannot rollback ..." */ + return ts + 4816 /* "cannot rollback ..." */ } - return ts + 4844 /* "cannot commit - ..." */ + return ts + 4859 /* "cannot commit - ..." */ }() }(), 0) @@ -70140,7 +70648,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4885 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4900 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -70522,7 +71030,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 729 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 744 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -72652,7 +73160,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4913 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4928 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -73085,14 +73593,14 @@ __137: goto __720 __719: - zSchema = ts + 4930 /* "sqlite_master" */ + zSchema = ts + 4945 /* "sqlite_master" */ (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FiDb = iDb3 (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmInitFlags = U32(0) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+4944, /* "SELECT*FROM\"%w\"...." */ + ts+4959, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 @@ -73425,7 +73933,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+4987 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5002 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -73870,7 +74378,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+2764 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+2779 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -73948,7 +74456,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+2764 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+2779 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -74063,12 +74571,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+5024, /* "cannot change %s..." */ + ts+5039, /* "cannot change %s..." */ libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 5076 /* "into" */ + return ts + 5091 /* "into" */ } - return ts + 5081 /* "out of" */ + return ts + 5096 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -74271,7 +74779,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+5088 /* "database table i..." */, libc.VaList(bp+112, z1)) + Xsqlite3VdbeError(tls, p, ts+5103 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -74515,7 +75023,7 @@ __833: if !((*Sqlite3_context)(unsafe.Pointer(bp+872 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+2764 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + Xsqlite3VdbeError(tls, p, ts+2779 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) rc = (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FisError __834: ; @@ -74846,7 +75354,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+2764 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+2779 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -74936,7 +75444,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+5117 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+5132 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -75039,13 +75547,13 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+2764 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+2779 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+5123, /* "statement aborts..." */ + Xsqlite3_log(tls, rc, ts+5138, /* "statement aborts..." */ libc.VaList(bp+152, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { @@ -75090,14 +75598,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+4422 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4437 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+5155 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+5170 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -75110,8 +75618,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 5169 /* "NOT NULL" */, ts + 5178 /* "UNIQUE" */, ts + 5185, /* "CHECK" */ - ts + 5191 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 5184 /* "NOT NULL" */, ts + 5193 /* "UNIQUE" */, ts + 5200, /* "CHECK" */ + ts + 5206 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -75218,16 +75726,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5203, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5218, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 5232 /* "null" */ + return ts + 5247 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 5237 /* "real" */ + return ts + 5252 /* "real" */ } - return ts + 5242 /* "integer" */ + return ts + 5257 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -75247,10 +75755,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5250 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5265 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2764 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2779 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -75313,21 +75821,21 @@ __4: goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5270 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5285 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5300 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5315 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5336 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5351 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { @@ -75372,7 +75880,7 @@ __12: goto __14 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5357 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5372 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -75401,7 +75909,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FiFrom == iCol) { goto __23 } - zFault = ts + 5378 /* "foreign key" */ + zFault = ts + 5393 /* "foreign key" */ __23: ; goto __21 @@ -75434,7 +75942,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 5390 /* "indexed" */ + zFault = ts + 5405 /* "indexed" */ __30: ; goto __28 @@ -75455,7 +75963,7 @@ __26: goto __31 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5398 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5413 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -75564,7 +76072,7 @@ __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) != 0 { - return ts + 2764 /* "%s" */ + return ts + 2779 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)))) @@ -75729,7 +76237,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { - return ts + 2764 /* "%s" */ + return ts + 2779 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) @@ -79287,7 +79795,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5432 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5447 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -79490,14 +79998,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5437 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5452 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5441 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5456 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -79514,7 +80022,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5445 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5460 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -79691,7 +80199,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+5454 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5469 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -79699,14 +80207,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+5485 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5500 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+5522 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5537 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -79782,7 +80290,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+5540 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + ts+5555 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) return WRC_Prune @@ -79803,23 +80311,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 5575 /* "no such column" */ + zErr = ts + 5590 /* "no such column" */ } else { - zErr = ts + 5590 /* "ambiguous column..." */ + zErr = ts + 5605 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+5612 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5627 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+5625 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5640 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+5635 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5650 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -79953,15 +80461,15 @@ func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExp bp := tls.Alloc(16) defer tls.Free(16) - var zIn uintptr = ts + 5642 /* "partial index WH..." */ + var zIn uintptr = ts + 5657 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 5670 /* "index expression..." */ + zIn = ts + 5685 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 5688 /* "CHECK constraint..." */ + zIn = ts + 5703 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 5706 /* "generated column..." */ + zIn = ts + 5721 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5724 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+5739 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -80069,10 +80577,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5744 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5759 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5749 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5764 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -80125,7 +80633,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5755 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5770 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -80192,7 +80700,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+5772 /* "second argument ..." */, 0) + ts+5787 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -80217,7 +80725,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+5843, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+5858, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -80241,7 +80749,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5878 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5893 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -80270,30 +80778,30 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+5906 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + ts+5921 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 5950 /* "window" */ + zType = ts + 5965 /* "window" */ } else { - zType = ts + 5957 /* "aggregate" */ + zType = ts + 5972 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5967 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+5982 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5996 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6011 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6019, /* "wrong number of ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6034, /* "wrong number of ..." */ libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+6064, /* "FILTER may not b..." */ + ts+6079, /* "FILTER may not b..." */ libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -80368,7 +80876,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6113 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6128 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) @@ -80385,7 +80893,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6124 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6139 /* "parameters" */, pExpr) } break @@ -80445,7 +80953,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+5522 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5537 /* "row value misuse..." */, 0) } break @@ -80550,7 +81058,7 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 Xsqlite3ErrorMsg(tls, pParse, - ts+6135 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+6150 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -80582,7 +81090,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6191 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6206 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -80617,7 +81125,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+6225 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + resolveOutOfRangeError(tls, pParse, ts+6240 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { @@ -80688,7 +81196,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6231 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+6246 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -80716,7 +81224,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6292 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+6307 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -81005,7 +81513,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6323 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6338 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -81062,7 +81570,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6225 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6240 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -81075,7 +81583,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6367 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6382 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -81087,7 +81595,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6373 /* "aggregate functi..." */, 0) + ts+6388 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -81857,7 +82365,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+5522 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5537 /* "row value misuse..." */, 0) return } @@ -81933,7 +82441,7 @@ func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+6432 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+6447 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -82174,7 +82682,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6480 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6495 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -82196,7 +82704,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6482 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+6497 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -82230,7 +82738,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+6516 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6531 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -82283,7 +82791,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6535, /* "variable number ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6550, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) return } @@ -82310,7 +82818,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6578 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6593 /* "too many SQL var..." */, 0) } } @@ -82979,7 +83487,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+6601, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6616, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -83114,7 +83622,7 @@ func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+6631 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+6646 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -83169,10 +83677,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+5744 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5759 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+5749 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5764 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -83617,13 +84125,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+6654 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6669 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6662 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6677 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6668 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6683 /* "OID" */) == 0 { return 1 } return 0 @@ -83851,7 +84359,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6672 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6687 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -83942,7 +84450,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6719 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6734 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -84048,7 +84556,7 @@ func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpec defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 6750 /* "sub-select retur..." */ + var zFmt uintptr = ts + 6765 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -84066,7 +84574,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5522 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5537 /* "row value misuse..." */, 0) } } @@ -84119,7 +84627,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6794 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6809 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -84155,11 +84663,11 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6817 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6832 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 6836 /* "CORRELATED " */ + return ts + 6851 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. @@ -84305,7 +84813,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6848 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6863 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -84338,11 +84846,11 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6866 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6881 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 6836 /* "CORRELATED " */ + return ts + 6851 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr @@ -84366,7 +84874,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6480 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6495 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -84376,7 +84884,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6887 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6902 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -84868,12 +85376,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+6889 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6892 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if Xsqlite3_strnicmp(tls, z, ts+6904 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6907 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 4015 /* "-" */ + return ts + 4030 /* "-" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -84948,7 +85456,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6918 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6933 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -85507,7 +86015,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+6918, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6933, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -85759,7 +86267,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+6948 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+6963 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32)).FiMem @@ -85801,7 +86309,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+6974 /* "unknown function..." */, libc.VaList(bp+16, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6989 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -85995,7 +86503,7 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+6601, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6616, /* "%d columns assig..." */ libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; @@ -86077,7 +86585,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+5522 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5537 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -86201,7 +86709,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+6997 /* "RAISE() may only..." */, 0) + ts+7012 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -86240,7 +86748,7 @@ __3: return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7047 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7062 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -88077,11 +88585,11 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq bp := tls.Alloc(8) defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7055 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7070 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7063 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7078 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -88099,14 +88607,14 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+7091, /* "SELECT 1 FROM \"%..." */ + ts+7106, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7266, /* "SELECT 1 FROM te..." */ + ts+7281, /* "SELECT 1 FROM te..." */ libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -88122,11 +88630,11 @@ func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { Xsqlite3NestedParse(tls, pParse, - ts+7440 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+7455 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7587 /* "UPDATE temp.sqli..." */, 0) + ts+7602 /* "UPDATE temp.sqli..." */, 0) } } @@ -88200,7 +88708,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+7738 /* "there is already..." */, libc.VaList(bp, zName)) + ts+7753 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -88213,7 +88721,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7797 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7812 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -88223,7 +88731,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+7803 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7818 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -88276,24 +88784,24 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+7830 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+7845 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+8014, /* "UPDATE %Q.sqlite..." */ + ts+8029, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+8319 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+8334 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+8335, /* "UPDATE \"%w\".sqli..." */ + ts+8350, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -88306,7 +88814,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+8393 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+8408 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -88324,7 +88832,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8658 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8673 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -88339,7 +88847,7 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+8671, /* "SELECT raise(ABO..." */ + ts+8686, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -88387,12 +88895,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8709 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+8724 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+8741 /* "Cannot add a UNI..." */, 0) + ts+8756 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -88405,11 +88913,11 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8768 /* "Cannot add a REF..." */) + ts+8783 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8827 /* "Cannot add a NOT..." */) + ts+8842 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() @@ -88425,12 +88933,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8880 /* "Cannot add a col..." */) + ts+8895 /* "Cannot add a col..." */) } Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8926 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8941 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -88446,7 +88954,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+8953, /* "UPDATE \"%w\".sqli..." */ + ts+8968, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -88517,7 +89025,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+9099 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9114 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -88526,7 +89034,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+9133 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9148 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -88561,7 +89069,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Column{})) * uint64(nAlloc)))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9163 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9178 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -88608,18 +89116,18 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 9182 /* "view" */ + zType = ts + 9197 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 9187 /* "virtual table" */ + zType = ts + 9202 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9201, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9216, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 9219 /* "drop column from" */ + return ts + 9234 /* "drop column from" */ } - return ts + 9236 /* "rename columns o..." */ + return ts + 9251 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -88712,13 +89220,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+5357 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+5372 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+729 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+744 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -88736,19 +89244,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+9254, /* "UPDATE \"%w\".sqli..." */ + ts+9269, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+9472, /* "UPDATE temp.sqli..." */ + ts+9487, /* "UPDATE temp.sqli..." */ libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8658 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8673 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -89043,12 +89551,12 @@ func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType ui var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+9603, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+9618, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 9626 /* " " */ + return ts + 9641 /* " " */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -89157,7 +89665,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+9628 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+9643 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -89207,12 +89715,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.Xmemcpy(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9634 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9649 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 9626 /* " " */ + return ts + 9641 /* " " */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -89717,7 +90225,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+729 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) + renameColumnParseError(tls, context, ts+744 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -89897,7 +90405,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+729 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) + renameColumnParseError(tls, context, ts+744 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -90179,7 +90687,7 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+9639 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+9654 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) @@ -90267,7 +90775,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+5357 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5372 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -90277,12 +90785,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+9646, /* "cannot drop %s c..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9661, /* "cannot drop %s c..." */ libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 9674 /* "PRIMARY KEY" */ + return ts + 9689 /* "PRIMARY KEY" */ } - return ts + 5178 /* "UNIQUE" */ + return ts + 5193 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -90293,7 +90801,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+9686 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+9701 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -90302,15 +90810,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+729 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+744 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+9734 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+9749 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9855 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9870 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -90421,11 +90929,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9873 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9894 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9914 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9933 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9952 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9888 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9909 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9929 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9948 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9967 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -90622,7 +91130,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+9975 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + ts+9990 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } @@ -90634,10 +91142,10 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+9998, /* "DELETE FROM %Q.%..." */ + ts+10013, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+10028 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+10043 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) @@ -90658,9 +91166,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 10046 /* "sqlite_stat1" */, FzCols: ts + 10059 /* "tbl,idx,stat" */}, - {FzName: ts + 10072 /* "sqlite_stat4" */, FzCols: ts + 10085 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 10113 /* "sqlite_stat3" */}, + {FzName: ts + 10061 /* "sqlite_stat1" */, FzCols: ts + 10074 /* "tbl,idx,stat" */}, + {FzName: ts + 10087 /* "sqlite_stat4" */, FzCols: ts + 10100 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10128 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -90891,7 +91399,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10126 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 10141 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -91209,7 +91717,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10136 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 10151 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -91266,7 +91774,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+10146, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+10161, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -91277,7 +91785,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+10151 /* " %llu" */, libc.VaList(bp+8, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+10166 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -91326,7 +91834,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+10157 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+10172 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -91343,7 +91851,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10163 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 10178 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -91390,7 +91898,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+10172 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+10187 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -91408,7 +91916,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*120) - libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10046 /* "sqlite_stat1" */, uint64(13)) + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10061 /* "sqlite_stat1" */, uint64(13)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -91641,7 +92149,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10182 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10197 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -91703,7 +92211,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10182 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10197 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -91756,9 +92264,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10186 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10201 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10190 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10205 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -91853,7 +92361,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 729 /* "" */ + z = ts + 744 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -91875,15 +92383,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+10194 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+10209 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+10205 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10220 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+10215 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10230 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -92202,10 +92710,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+10072 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+10087 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+10227, /* "SELECT idx,count..." */ - ts+10281, /* "SELECT idx,neq,n..." */ + ts+10242, /* "SELECT idx,count..." */ + ts+10296, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -92256,9 +92764,9 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit // Load new statistics out of the sqlite_stat1 table (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+10046 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + if Xsqlite3FindTable(tls, db, ts+10061 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+10333 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + ts+10348 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { @@ -92350,7 +92858,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5432 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5447 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -92401,13 +92909,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 729 /* "" */ + zFile = ts + 744 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 729 /* "" */ + zName = ts + 744 /* "" */ __2: ; @@ -92417,7 +92925,7 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2936 /* "memdb" */) + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2951 /* "memdb" */) if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) == uintptr(0)) { goto __5 } @@ -92433,7 +92941,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10374 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10389 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -92446,7 +92954,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10377, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10392, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -92460,7 +92968,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10414 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10429 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -92531,7 +93039,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10444 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10459 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -92548,7 +93056,7 @@ __21: goto __23 } *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+10473 /* "attached databas..." */, 0) + ts+10488 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -92618,13 +93126,13 @@ __29: } Xsqlite3OomFault(tls, db) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5155 /* "out of memory" */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5170 /* "out of memory" */, 0) goto __31 __30: if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10541 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10556 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -92680,7 +93188,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 729 /* "" */ + zName = ts + 744 /* "" */ __1: ; i = 0 @@ -92712,14 +93220,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10569 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10584 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10590 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10605 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -92727,7 +93235,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10616 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10631 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -92850,7 +93358,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10638 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 10653 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -92863,7 +93371,7 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10652 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 10667 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ @@ -92878,7 +93386,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10666 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10681 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -92911,7 +93419,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+10690, /* "%s %T cannot ref..." */ + ts+10705, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -93110,7 +93618,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+10736 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10751 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -93134,11 +93642,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+10759 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+10774 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+10765 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+10780 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+10771 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+10786 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -93190,7 +93698,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName } else { - zCol = ts + 6662 /* "ROWID" */ + zCol = ts + 6677 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -93222,7 +93730,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+10798 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10813 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -93532,25 +94040,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+5432 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+5447 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7055 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7070 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10813 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10832 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4930 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10828 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10847 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4945 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+10846 /* "sqlite_temp_mast..." */) + ts+10861 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10832 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10847 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), - ts+4930 /* "sqlite_master" */) + ts+4945 /* "sqlite_master" */) } } } @@ -93573,12 +94081,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7055 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10832 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4930 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10813 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7070 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10847 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4945 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10828 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+10846 /* "sqlite_temp_mast..." */) + ts+10861 /* "sqlite_temp_mast..." */) } } } @@ -93614,7 +94122,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10865 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10880 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -93632,14 +94140,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 10873 /* "no such view" */ + zMsg = ts + 10888 /* "no such view" */ } else { - zMsg = ts + 10886 /* "no such table" */ + zMsg = ts + 10901 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+5625 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5640 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5635 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5650 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -93952,7 +94460,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4930 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4945 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -93979,7 +94487,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5432 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5447 /* "main" */, zName)) { goto __3 } @@ -94032,13 +94540,13 @@ func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10900 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10915 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10917 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+10932 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -94079,13 +94587,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*8))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*8))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+729 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+744 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7055 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7070 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+10937, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10952, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -94254,9 +94762,9 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 @@ -94274,7 +94782,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+10979 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10994 /* "temporary table ..." */, 0) return __4: ; @@ -94302,9 +94810,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 9182 /* "view" */ + return ts + 9197 /* "view" */ } - return ts + 7797 /* "table" */ + return ts + 7812 /* "table" */ }(), zName) != 0) { goto __8 } @@ -94321,9 +94829,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -94361,7 +94869,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+11020 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+11035 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -94375,7 +94883,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+11044 /* "there is already..." */, libc.VaList(bp+8, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11059 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -94491,7 +94999,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+11079 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+11094 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -94515,7 +95023,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11096 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11111 /* "cannot use RETUR..." */, 0) } else { } @@ -94536,7 +95044,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11079 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11094 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -94548,7 +95056,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+11079 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+11094 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == (pRet + 16 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -94576,7 +95084,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11130 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11145 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -94592,7 +95100,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11153 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11168 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -94766,11 +95274,11 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11179, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11194, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11224 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11239 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. @@ -94820,7 +95328,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11265 /* "generated column..." */, 0) + ts+11280 /* "generated column..." */, 0) } } @@ -94865,7 +95373,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+11317 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11332 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -94925,7 +95433,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+729 /* "" */), ts+11358 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+744 /* "" */), ts+11373 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -94953,7 +95461,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+11366 /* "AUTOINCREMENT is..." */, 0) + ts+11381 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -95057,7 +95565,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+11422 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11437 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -95070,13 +95578,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11465 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11480 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11473 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11488 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -95109,7 +95617,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+11480, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11495, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -95251,13 +95759,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 729 /* "" */ - zSep2 = ts + 11511 /* "," */ - zEnd = ts + 4040 /* ")" */ + zSep = ts + 744 /* "" */ + zSep2 = ts + 11526 /* "," */ + zEnd = ts + 4055 /* ")" */ } else { - zSep = ts + 11513 /* "\n " */ - zSep2 = ts + 11517 /* ",\n " */ - zEnd = ts + 11522 /* "\n)" */ + zSep = ts + 11528 /* "\n " */ + zSep2 = ts + 11532 /* ",\n " */ + zEnd = ts + 11537 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -95265,7 +95773,7 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+11525 /* "CREATE TABLE " */, 0) + Xsqlite3_snprintf(tls, n, zStmt, ts+11540 /* "CREATE TABLE " */, 0) *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') @@ -95299,16 +95807,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2764 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2779 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 729, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 11539, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 11545, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 11550, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 11555, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 744, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11554, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11560, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11565, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11570, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -95745,7 +96253,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+729 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+744 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -95758,11 +96266,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11561 /* "AUTOINCREMENT no..." */, 0) + ts+11576 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11611 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11626 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -95806,7 +96314,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11643 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11658 /* "must have at lea..." */, 0) return } } @@ -95839,12 +96347,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 7797 /* "table" */ - zType2 = ts + 11687 /* "TABLE" */ + zType = ts + 7812 /* "table" */ + zType2 = ts + 11702 /* "TABLE" */ } else { // A view - zType = ts + 9182 /* "view" */ - zType2 = ts + 11693 /* "VIEW" */ + zType = ts + 9197 /* "view" */ + zType2 = ts + 11708 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -95925,7 +96433,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+11698 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+11713 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -95933,7 +96441,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+11713, /* "UPDATE %Q.sqlite..." */ + ts+11728, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, @@ -95951,14 +96459,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+11811, /* "CREATE TABLE %Q...." */ + ts+11826, /* "CREATE TABLE %Q...." */ libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+11853 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+11868 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -95979,7 +96487,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8319 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8334 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -96016,7 +96524,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+11887 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11902 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -96038,7 +96546,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9182 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9197 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+8 /* &sFix */, pSelect) != 0) { goto __3 } @@ -96155,7 +96663,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11923 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11938 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -96297,7 +96805,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+11953 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11968 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -96311,7 +96819,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+11968, /* "UPDATE %Q.sqlite..." */ + ts+11983, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -96375,10 +96883,10 @@ func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uint for i = 1; i <= 4; i++ { // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12035 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12050 /* "sqlite_stat%d" */, libc.VaList(bp, i)) if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+9998, /* "DELETE FROM %Q.%..." */ + ts+10013, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } @@ -96418,7 +96926,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+12049, /* "DELETE FROM %Q.s..." */ + ts+12064, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -96430,7 +96938,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+12094, /* "DELETE FROM %Q.s..." */ + ts+12109, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) @@ -96460,11 +96968,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7055 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2387 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7070 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2402 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6124 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6139 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -96545,9 +97053,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zArg2 = uintptr(0) @@ -96607,7 +97115,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+12161 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12176 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -96617,14 +97125,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+12189 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12204 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+12223 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12238 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -96639,7 +97147,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+10190 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10205 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -96704,7 +97212,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+12255, /* "foreign key on %..." */ + ts+12270, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*32)).FzName, pTo)) goto fk_end __5: @@ -96717,7 +97225,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+12318 /* "number of column..." */, 0) + ts+12333 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -96801,7 +97309,7 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+12412, /* "unknown column \"..." */ + ts+12427, /* "unknown column \"..." */ libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) goto fk_end __23: @@ -97051,12 +97559,12 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+12458, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12473, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 12486 /* "FIRST" */ + return ts + 12501 /* "FIRST" */ } - return ts + 12492 /* "LAST" */ + return ts + 12507 /* "LAST" */ }())) return 1 } @@ -97214,7 +97722,7 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12497 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12512 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+136 /* &sFix */, pTblName) != 0) { goto __10 } @@ -97235,7 +97743,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+12503, /* "cannot create a ..." */ + ts+12518, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -97262,26 +97770,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7055 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7070 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12553 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12568 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+12581 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12596 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+12606 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12621 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -97308,7 +97816,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12497 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12512 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -97323,7 +97831,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+12640 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12655 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -97335,7 +97843,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+12674 /* "index %s already..." */, libc.VaList(bp+24, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12689 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -97364,7 +97872,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+12698 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+12713 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -97393,9 +97901,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -97439,7 +97947,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12497 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12512 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -97556,7 +98064,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+12721 /* "expressions proh..." */, 0) + ts+12736 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -97785,7 +98293,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+12782 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) + ts+12797 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -97841,7 +98349,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+12824 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12839 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -97899,12 +98407,12 @@ __104: __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+12841, /* "CREATE%s INDEX %..." */ + zStmt = Xsqlite3MPrintf(tls, db, ts+12856, /* "CREATE%s INDEX %..." */ libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 12861 /* " UNIQUE" */ + return ts + 12876 /* " UNIQUE" */ }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: @@ -97916,7 +98424,7 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+12869, /* "INSERT INTO %Q.s..." */ + ts+12884, /* "INSERT INTO %Q.s..." */ libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -97932,7 +98440,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+12928 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+12943 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -98116,7 +98624,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+12955 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+12970 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -98131,7 +98639,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+12973 /* "index associated..." */, libc.VaList(bp+8, 0)) + ts+12988 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -98142,9 +98650,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -98172,9 +98680,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+13046, /* "DELETE FROM %Q.s..." */ + ts+13061, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+10186 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10201 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -98325,7 +98833,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+13106, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13121, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -98537,12 +99045,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13142, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13157, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 13178 /* "ON" */ + return ts + 13193 /* "ON" */ } - return ts + 13181 /* "USING" */ + return ts + 13196 /* "USING" */ }())) goto append_from_error __1: @@ -98670,7 +99178,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13187 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13202 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -98706,9 +99214,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 13193 /* "ROLLBACK" */ + return ts + 13208 /* "ROLLBACK" */ } - return ts + 13202 /* "COMMIT" */ + return ts + 13217 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -98733,7 +99241,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 13187 /* "BEGIN" */, ts + 13209 /* "RELEASE" */, ts + 13193 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 13202 /* "BEGIN" */, ts + 13224 /* "RELEASE" */, ts + 13208 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -98749,7 +99257,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+13217 /* "unable to open a..." */, 0) + ts+13232 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -98892,17 +99400,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13287 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13302 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*32)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13298 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13313 /* ", " */, 2) } Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+742 /* "." */, 1) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+757 /* "." */, 1) Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } @@ -98925,11 +99433,11 @@ func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10759 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10774 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13301 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13316 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -99072,7 +99580,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+13310 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13325 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -99182,7 +99690,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13356 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13371 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -99416,7 +99924,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13386 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13401 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -99782,11 +100290,11 @@ func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int3 defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13417 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13432 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13446 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13461 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -100379,7 +100887,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13484 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13499 /* "rows deleted" */, uintptr(0)) __61: ; @@ -100524,7 +101032,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10046 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10061 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -100802,7 +101310,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 5242 /* "integer" */, ts + 5237 /* "real" */, ts + 13497 /* "text" */, ts + 13502 /* "blob" */, ts + 5232 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 5257 /* "integer" */, ts + 5252 /* "real" */, ts + 13512 /* "text" */, ts + 13517 /* "blob" */, ts + 5247 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -100866,7 +101374,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+13507 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13522 /* "integer overflow" */, -1) return } iVal = -iVal @@ -101204,7 +101712,7 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+13524 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+13539 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -101654,7 +102162,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+13529 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+13544 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -101666,7 +102174,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+13562 /* "ESCAPE expressio..." */, -1) + ts+13577 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -101732,7 +102240,7 @@ func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) } // Implementation of the sqlite_compileoption_used() function. @@ -101789,10 +102297,10 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4008 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4023 /* "%!.15g" */, libc.VaList(bp, r1)) Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13607 /* "%!.20e" */, libc.VaList(bp+8, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13622 /* "%!.20e" */, libc.VaList(bp+8, r1)) } Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break @@ -101866,7 +102374,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+730 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+745 /* "NULL" */, 4, uintptr(0)) break } @@ -102177,7 +102685,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 9626 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 9641 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -102198,7 +102706,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 729 /* "" */ + zIn = ts + 744 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -102224,7 +102732,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+13614 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+13629 /* "?000" */, 4, uintptr(0)) } } @@ -102252,7 +102760,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+10798 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+10813 /* "not authorized" */, -1) return } @@ -102340,7 +102848,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+13507 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13522 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -102494,7 +103002,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) } else { - zSep = ts + 11511 /* "," */ + zSep = ts + 11526 /* "," */ nSep = 1 } if zSep != 0 { @@ -102572,7 +103080,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+13619 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+13634 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -102592,14 +103100,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+13625 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13640 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+13625 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13640 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13625 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13625 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13640 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13640 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -102704,76 +103212,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 13630 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 13650 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 13663 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 13645 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 13665 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 13678 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13681 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13689 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13689 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13704 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13730 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13755 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13764 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13775 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13782 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13796 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13796 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13802 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13802 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13808 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13808 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13813 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13813 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13813 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13817 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 13817 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13817 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13821 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13828 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13835 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13841 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13848 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13856 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13861 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13865 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13865 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13871 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13877 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13883 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13887 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13894 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13901 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13912 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13919 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13934 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13951 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13962 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13968 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13986 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13994 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14008 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14016 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14025 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14025 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14032 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14032 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14042 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14046 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14052 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14056 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14056 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14062 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14062 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13696 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13704 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13704 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13719 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13745 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13770 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13779 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13790 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13797 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13811 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13811 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13817 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13817 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13823 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13823 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13828 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13828 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13828 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13832 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 13832 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13832 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13836 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13843 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13850 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13856 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13863 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13871 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13880 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13880 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13886 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13892 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13898 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13902 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13909 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13916 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13927 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13934 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13949 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13966 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13977 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13983 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14001 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14009 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14023 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14031 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14040 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14040 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14047 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14047 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14057 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14061 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14071 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14071 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14077 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14077 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14075 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13625 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13625 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14080 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14080 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14089 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14080 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14094 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14090 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13640 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13640 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14095 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14095 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14104 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14095 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14109 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -103059,7 +103567,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+14098, /* "foreign key mism..." */ + ts+14113, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -103955,8 +104463,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5441 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5437 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5456 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5452 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+32, 16 // Name of column in child table // var tToCol Token at bp+16, 16 @@ -104044,7 +104552,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4224 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4239 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -104474,7 +104982,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6918 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6933 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -105038,7 +105546,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+14143, /* "cannot INSERT in..." */ + ts+14158, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto insert_cleanup __24: @@ -105063,7 +105571,7 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+14184, /* "table %S has no ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14199, /* "table %S has no ..." */ libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup @@ -105233,7 +105741,7 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+14216, /* "table %S has %d ..." */ + ts+14231, /* "table %S has %d ..." */ libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: @@ -105243,7 +105751,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+14268 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+14283 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -105299,7 +105807,7 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+14293, /* "UPSERT not imple..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14308, /* "UPSERT not imple..." */ libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: @@ -105307,7 +105815,7 @@ __56: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+14339 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14354 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -105787,7 +106295,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14360 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14375 /* "rows inserted" */, uintptr(0)) __123: ; @@ -106131,7 +106639,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10759 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10774 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -107534,7 +108042,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 729 /* "" */ + zSql = ts + 744 /* "" */ __2: ; @@ -108095,7 +108603,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10798 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10813 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -108105,7 +108613,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 14374 /* "sqlite3_extensio..." */ + zEntry = ts + 14389 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -108125,7 +108633,7 @@ __5: if !((ii < (int32(uint64(unsafe.Sizeof(azEndings)) / uint64(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+10759 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+10774 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -108171,7 +108679,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.Xmemcpy(tls, zAltEntry, ts+14397 /* "sqlite3_" */, uint64(8)) + libc.Xmemcpy(tls, zAltEntry, ts+14412 /* "sqlite3_" */, uint64(8)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { @@ -108185,7 +108693,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14406 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14421 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -108209,7 +108717,7 @@ __17: goto __18 __18: ; - libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14410 /* "_init" */, uint64(6)) + libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14425 /* "_init" */, uint64(6)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -108227,7 +108735,7 @@ __10: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14416 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + ts+14431 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; @@ -108252,7 +108760,7 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14459 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14474 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) @@ -108292,7 +108800,7 @@ extension_not_found: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14491 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + ts+14506 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; @@ -108302,7 +108810,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 14528, /* "so" */ + ts + 14543, /* "so" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -108469,7 +108977,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+14531 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + ts+14546 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) @@ -108514,61 +109022,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 4145, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 14570, /* "seq" */ - /* 2 */ ts + 7797, /* "table" */ - /* 3 */ ts + 14574, /* "from" */ - /* 4 */ ts + 14579, /* "to" */ - /* 5 */ ts + 14582, /* "on_update" */ - /* 6 */ ts + 14592, /* "on_delete" */ - /* 7 */ ts + 14602, /* "match" */ - /* 8 */ ts + 14608, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 14612, /* "name" */ - /* 10 */ ts + 14617, /* "type" */ - /* 11 */ ts + 14622, /* "notnull" */ - /* 12 */ ts + 14630, /* "dflt_value" */ - /* 13 */ ts + 14641, /* "pk" */ - /* 14 */ ts + 14644, /* "hidden" */ + /* 0 */ ts + 4160, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 14585, /* "seq" */ + /* 2 */ ts + 7812, /* "table" */ + /* 3 */ ts + 14589, /* "from" */ + /* 4 */ ts + 14594, /* "to" */ + /* 5 */ ts + 14597, /* "on_update" */ + /* 6 */ ts + 14607, /* "on_delete" */ + /* 7 */ ts + 14617, /* "match" */ + /* 8 */ ts + 14623, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 14627, /* "name" */ + /* 10 */ ts + 14632, /* "type" */ + /* 11 */ ts + 14637, /* "notnull" */ + /* 12 */ ts + 14645, /* "dflt_value" */ + /* 13 */ ts + 14656, /* "pk" */ + /* 14 */ ts + 14659, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 14651, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 14608, /* "cid" */ - /* 17 */ ts + 14612, /* "name" */ - /* 18 */ ts + 14657, /* "desc" */ - /* 19 */ ts + 14662, /* "coll" */ - /* 20 */ ts + 14667, /* "key" */ - /* 21 */ ts + 14612, /* "name" */ // Used by: function_list - /* 22 */ ts + 14671, /* "builtin" */ - /* 23 */ ts + 14617, /* "type" */ - /* 24 */ ts + 14679, /* "enc" */ - /* 25 */ ts + 14683, /* "narg" */ - /* 26 */ ts + 14688, /* "flags" */ - /* 27 */ ts + 10190, /* "tbl" */ // Used by: stats - /* 28 */ ts + 10186, /* "idx" */ - /* 29 */ ts + 14694, /* "wdth" */ - /* 30 */ ts + 14699, /* "hght" */ - /* 31 */ ts + 14704, /* "flgs" */ - /* 32 */ ts + 14570, /* "seq" */ // Used by: index_list - /* 33 */ ts + 14612, /* "name" */ - /* 34 */ ts + 14709, /* "unique" */ - /* 35 */ ts + 14716, /* "origin" */ - /* 36 */ ts + 14723, /* "partial" */ - /* 37 */ ts + 7797, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 14731, /* "rowid" */ - /* 39 */ ts + 4148, /* "parent" */ - /* 40 */ ts + 14737, /* "fkid" */ + /* 15 */ ts + 14666, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 14623, /* "cid" */ + /* 17 */ ts + 14627, /* "name" */ + /* 18 */ ts + 14672, /* "desc" */ + /* 19 */ ts + 14677, /* "coll" */ + /* 20 */ ts + 14682, /* "key" */ + /* 21 */ ts + 14627, /* "name" */ // Used by: function_list + /* 22 */ ts + 14686, /* "builtin" */ + /* 23 */ ts + 14632, /* "type" */ + /* 24 */ ts + 14694, /* "enc" */ + /* 25 */ ts + 14698, /* "narg" */ + /* 26 */ ts + 14703, /* "flags" */ + /* 27 */ ts + 10205, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10201, /* "idx" */ + /* 29 */ ts + 14709, /* "wdth" */ + /* 30 */ ts + 14714, /* "hght" */ + /* 31 */ ts + 14719, /* "flgs" */ + /* 32 */ ts + 14585, /* "seq" */ // Used by: index_list + /* 33 */ ts + 14627, /* "name" */ + /* 34 */ ts + 14724, /* "unique" */ + /* 35 */ ts + 14731, /* "origin" */ + /* 36 */ ts + 14738, /* "partial" */ + /* 37 */ ts + 7812, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 14746, /* "rowid" */ + /* 39 */ ts + 4163, /* "parent" */ + /* 40 */ ts + 14752, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 14570, /* "seq" */ // Used by: database_list - /* 42 */ ts + 14612, /* "name" */ - /* 43 */ ts + 14742, /* "file" */ - /* 44 */ ts + 14747, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 14752, /* "log" */ - /* 46 */ ts + 14756, /* "checkpointed" */ + /* 41 */ ts + 14585, /* "seq" */ // Used by: database_list + /* 42 */ ts + 14627, /* "name" */ + /* 43 */ ts + 14757, /* "file" */ + /* 44 */ ts + 14762, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 14767, /* "log" */ + /* 46 */ ts + 14771, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 14769, /* "database" */ // Used by: lock_status - /* 48 */ ts + 14778, /* "status" */ - /* 49 */ ts + 14785, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 14784, /* "database" */ // Used by: lock_status + /* 48 */ ts + 14793, /* "status" */ + /* 49 */ ts + 14800, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 14796, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 14811, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -108585,234 +109093,234 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [65]PragmaName{ - { /* zName: */ FzName: ts + 14804, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 14819, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14819, /* "application_id" */ + { /* zName: */ FzName: ts + 14834, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 14834, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 14849, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14846, /* "automatic_index" */ + { /* zName: */ FzName: ts + 14861, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 14862, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 14877, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 14785, /* "cache_size" */ + { /* zName: */ FzName: ts + 14800, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14875, /* "cache_spill" */ + { /* zName: */ FzName: ts + 14890, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14887, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 14902, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 14907, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 14922, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 14923, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 14938, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 14944, /* "collation_list" */ + { /* zName: */ FzName: ts + 14959, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 14959, /* "compile_options" */ + { /* zName: */ FzName: ts + 14974, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14975, /* "count_changes" */ + { /* zName: */ FzName: ts + 14990, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 14989, /* "data_version" */ + { /* zName: */ FzName: ts + 15004, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 15002, /* "database_list" */ + { /* zName: */ FzName: ts + 15017, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15016, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 15031, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15035, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 15050, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 15054, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 15069, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 15077, /* "encoding" */ + { /* zName: */ FzName: ts + 15092, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15086, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 15101, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 15104, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 15119, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 15121, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 15136, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 15134, /* "freelist_count" */ + { /* zName: */ FzName: ts + 15149, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 15149, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 15164, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 15167, /* "fullfsync" */ + { /* zName: */ FzName: ts + 15182, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 15177, /* "function_list" */ + { /* zName: */ FzName: ts + 15192, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15191, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 15206, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15207, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 15222, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 15232, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 15247, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 15251, /* "index_info" */ + { /* zName: */ FzName: ts + 15266, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15262, /* "index_list" */ + { /* zName: */ FzName: ts + 15277, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 15273, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 15288, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15285, /* "integrity_check" */ + { /* zName: */ FzName: ts + 15300, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15301, /* "journal_mode" */ + { /* zName: */ FzName: ts + 15316, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15314, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 15329, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15333, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 15348, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 15352, /* "locking_mode" */ + { /* zName: */ FzName: ts + 15367, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15365, /* "max_page_count" */ + { /* zName: */ FzName: ts + 15380, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15380, /* "mmap_size" */ + { /* zName: */ FzName: ts + 15395, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 15390, /* "module_list" */ + { /* zName: */ FzName: ts + 15405, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15402, /* "optimize" */ + { /* zName: */ FzName: ts + 15417, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 15411, /* "page_count" */ + { /* zName: */ FzName: ts + 15426, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15422, /* "page_size" */ + { /* zName: */ FzName: ts + 15437, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15432, /* "pragma_list" */ + { /* zName: */ FzName: ts + 15447, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15444, /* "query_only" */ + { /* zName: */ FzName: ts + 15459, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 15455, /* "quick_check" */ + { /* zName: */ FzName: ts + 15470, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15467, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 15482, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 15484, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 15499, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 15503, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 15518, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 15529, /* "schema_version" */ + { /* zName: */ FzName: ts + 15544, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 15544, /* "secure_delete" */ + { /* zName: */ FzName: ts + 15559, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15558, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 15573, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 15577, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 15592, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 15591, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 15606, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15607, /* "synchronous" */ + { /* zName: */ FzName: ts + 15622, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15619, /* "table_info" */ + { /* zName: */ FzName: ts + 15634, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15630, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 15645, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15642, /* "temp_store" */ + { /* zName: */ FzName: ts + 15657, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15653, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 15668, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 15674, /* "threads" */ + { /* zName: */ FzName: ts + 15689, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15682, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 15697, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 15697, /* "user_version" */ + { /* zName: */ FzName: ts + 15712, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 15710, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 15725, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 15729, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 15744, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15744, /* "writable_schema" */ + { /* zName: */ FzName: ts + 15759, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -108849,7 +109357,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 15760 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 15775 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -108866,10 +109374,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+15785 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15800 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15795 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15810 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -108882,13 +109390,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+15802 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15817 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15807 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15822 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+15812 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15827 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -108906,9 +109414,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+14742 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+14757 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+15824 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+15839 /* "memory" */) == 0 { return 2 } else { return 0 @@ -108924,7 +109432,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+15831 /* "temporary storag..." */, 0) + ts+15846 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) @@ -109024,19 +109532,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 15893 /* "SET NULL" */ + zName = ts + 15908 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 15902 /* "SET DEFAULT" */ + zName = ts + 15917 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 15914 /* "CASCADE" */ + zName = ts + 15929 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 15922 /* "RESTRICT" */ + zName = ts + 15937 /* "RESTRICT" */ break default: - zName = ts + 15931 /* "NO ACTION" */ + zName = ts + 15946 /* "NO ACTION" */ break } return zName @@ -109054,7 +109562,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 15941 /* "delete" */, ts + 15948 /* "persist" */, ts + 15956 /* "off" */, ts + 15960 /* "truncate" */, ts + 15824 /* "memory" */, ts + 15969, /* "wal" */ + ts + 15956 /* "delete" */, ts + 15963 /* "persist" */, ts + 15971 /* "off" */, ts + 15975 /* "truncate" */, ts + 15839 /* "memory" */, ts + 15984, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -109100,13 +109608,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 15973 /* "w" */ + zType = ts + 15988 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 15975 /* "a" */ + zType = ts + 15990 /* "a" */ } else { - zType = ts + 15977 /* "s" */ + zType = ts + 15992 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15979, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15994, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -109115,7 +109623,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 15986 /* "utf8" */, ts + 15991 /* "utf16le" */, ts + 15999 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16001 /* "utf8" */, ts + 16006 /* "utf16le" */, ts + 16014 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -109377,7 +109885,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+16007 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+16022 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -109432,7 +109940,7 @@ __8: if !(*(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+2764 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2779 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) __10: ; @@ -110004,7 +110512,7 @@ __18: if !(zRight != 0) { goto __62 } - if !(Xsqlite3_stricmp(tls, zRight, ts+16011 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+16026 /* "fast" */) == 0) { goto __63 } b = 2 @@ -110093,7 +110601,7 @@ __70: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 15795 /* "normal" */ + zRet = ts + 15810 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -110134,7 +110642,7 @@ __77: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __82 } - zRet = ts + 15785 /* "exclusive" */ + zRet = ts + 15800 /* "exclusive" */ __82: ; returnSingleText(tls, v, zRet) @@ -110499,7 +111007,7 @@ __122: if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 432 /* res */)) == 0)) { goto __125 } - Xsqlite3ErrorMsg(tls, pParse, ts+16016 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16031 /* "not a writable d..." */, 0) goto pragma_out __125: ; @@ -110517,7 +111025,7 @@ __126: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __127 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+16, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+16, zRight)) goto __128 __127: Xsqlite3_temp_directory = uintptr(0) @@ -110545,7 +111053,7 @@ __129: goto __131 } Xsqlite3ErrorMsg(tls, pParse, - ts+16041 /* "Safety level may..." */, 0) + ts+16056 /* "Safety level may..." */, 0) goto __132 __131: if !(iDb != 1) { @@ -110704,13 +111212,13 @@ __153: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 16094 /* "issisii" */ + return ts + 16109 /* "issisii" */ } - return ts + 16102 /* "issisi" */ + return ts + 16117 /* "issisi" */ }(), libc.VaList(bp+24, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+729 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+744 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -110785,7 +111293,7 @@ __165: goto __167 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16109 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16124 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -110795,7 +111303,7 @@ __165: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __168 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16114, /* "isiX" */ + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16129, /* "isiX" */ libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) @@ -110832,8 +111340,8 @@ __171: if !(pIdx1 != 0) { goto __173 } - *(*[3]uintptr)(unsafe.Pointer(bp + 440 /* azOrigin */)) = [3]uintptr{ts + 16119 /* "c" */, ts + 16121 /* "u" */, ts + 14641 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16123, /* "isisi" */ + *(*[3]uintptr)(unsafe.Pointer(bp + 440 /* azOrigin */)) = [3]uintptr{ts + 16134 /* "c" */, ts + 16136 /* "u" */, ts + 14656 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16138, /* "isisi" */ libc.VaList(bp+128, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), @@ -110867,7 +111375,7 @@ __174: __177: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16129, /* "iss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16144, /* "iss" */ libc.VaList(bp+168, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt))) @@ -110890,7 +111398,7 @@ __178: goto __180 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16133 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16148 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __179 __179: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -110954,7 +111462,7 @@ __190: goto __192 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15977 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15992 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __191 __191: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -110971,7 +111479,7 @@ __193: if !(i6 < (int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{}))))) { goto __195 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15977 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15992 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) goto __194 __194: i6++ @@ -111007,7 +111515,7 @@ __201: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __203 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16136, /* "iissssss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16151, /* "iissssss" */ libc.VaList(bp+224, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, @@ -111015,7 +111523,7 @@ __201: (*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */)))), // ON DELETE - ts+16145 /* "NONE" */)) + ts+16160 /* "NONE" */)) goto __202 __202: j2++ @@ -111208,7 +111716,7 @@ __230: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __231: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16150 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16165 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 472 /* aiCols */))) @@ -111474,7 +111982,7 @@ __258: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+16154 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+16169 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -111564,7 +112072,7 @@ __277: __278: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+16178 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+16193 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -111604,7 +112112,7 @@ __283: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+16198, /* "CHECK constraint..." */ + zErr1 = Xsqlite3MPrintf(tls, db, ts+16213, /* "CHECK constraint..." */ libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) @@ -111638,9 +112146,9 @@ __288: // Verify that an index entry exists for the current table row jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16228 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16243 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+16233 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16248 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -111680,7 +112188,7 @@ __292: Xsqlite3VdbeJumpHere(tls, v, jmp6) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16254 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16269 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __289: @@ -111702,7 +112210,7 @@ __284: if !(!(isQuick != 0)) { goto __294 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+16281 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+16296 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __295: @@ -111753,7 +112261,7 @@ __240: } (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 480 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*24)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16310 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16325 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*24)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __299: @@ -111831,7 +112339,7 @@ __306: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __308 } - Xsqlite3ErrorMsg(tls, pParse, ts+16313 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+16328 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) __308: ; __303: @@ -111943,19 +112451,19 @@ __47: if !(zRight != 0) { goto __315 } - if !(Xsqlite3StrICmp(tls, zRight, ts+15807 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15822 /* "full" */) == 0) { goto __316 } eMode2 = SQLITE_CHECKPOINT_FULL goto __317 __316: - if !(Xsqlite3StrICmp(tls, zRight, ts+16338 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16353 /* "restart" */) == 0) { goto __318 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __319 __318: - if !(Xsqlite3StrICmp(tls, zRight, ts+15960 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15975 /* "truncate" */) == 0) { goto __320 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -112142,7 +112650,7 @@ __335: __337: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+16346, /* "ANALYZE \"%w\".\"%w..." */ + zSubSql = Xsqlite3MPrintf(tls, db, ts+16361, /* "ANALYZE \"%w\".\"%w..." */ libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __338 @@ -112326,14 +112834,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 16364 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 16369 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 16375 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 16384 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 16393 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 16401 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 16409 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 16416 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16379 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16384 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16390 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16399 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16408 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16416 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16424 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16431 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -112390,7 +112898,7 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argc _ = argv Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+64 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16422 /* "CREATE TABLE x" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16437 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -112398,7 +112906,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16437 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16452 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -112411,19 +112919,19 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16444 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16459 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16450 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16465 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16462 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16477 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4040 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4055 /* ")" */, 1) Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) rc = Xsqlite3_declare_vtab(tls, db, bp+64 /* &zBuf[0] */) @@ -112439,7 +112947,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -112602,7 +113110,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) == uintptr(0) { return SQLITE_NOMEM } @@ -112618,13 +113126,13 @@ __2: __3: ; Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16477 /* "PRAGMA " */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16492 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16485 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16500 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) } Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16489 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16504 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) } zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { @@ -112633,7 +113141,7 @@ __3: rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -112726,12 +113234,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+16493 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), + ts+16508 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 16521 /* "rename" */ + return ts + 16536 /* "rename" */ } - return ts + 16528 /* "drop column" */ + return ts + 16543 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -112743,11 +113251,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - zObj = ts + 4096 /* "?" */ + zObj = ts + 4111 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+16540 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+16555 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+16571 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+16586 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -112824,7 +113332,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (db+184 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12824 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12839 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -112861,13 +113369,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+16579 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+16594 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (pIndex+88 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12824 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12839 /* "invalid rootpage" */) } } } @@ -112910,16 +113418,16 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7797 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7812 /* "table" */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 6887 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 16592 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 6902 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 16607 /* "CREATE TABLE x(t..." */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*8)) = uintptr(0) (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FiDb = iDb @@ -113032,7 +113540,7 @@ __10: goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+10473 /* "attached databas..." */) + ts+10488 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -113072,7 +113580,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+16664 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+16679 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -113094,7 +113602,7 @@ __18: (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+16688, /* "SELECT*FROM\"%w\"...." */ + ts+16703, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth @@ -113454,7 +113962,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+16722 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+16737 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -113482,7 +113990,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16752 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16767 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -113545,7 +114053,7 @@ __19: if !(*(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+2764 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2779 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */))) goto __21 __20: @@ -114020,24 +114528,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 9626 /* " " */ + var zSp uintptr = ts + 9641 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+16771 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+16786 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+16815 /* "RIGHT and FULL O..." */, 0) + ts+16830 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16870 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16885 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -114243,7 +114751,7 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16904 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+16919 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { @@ -114267,7 +114775,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16954 /* "cannot have both..." */, 0) + ts+16969 /* "cannot have both..." */, 0) return 1 } @@ -114302,7 +114810,7 @@ __1: if (iRightCol < 0) || !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17009 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + ts+17024 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, @@ -115093,16 +115601,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 17073 /* "UNION ALL" */ + z = ts + 17088 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 17083 /* "INTERSECT" */ + z = ts + 17098 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 17093 /* "EXCEPT" */ + z = ts + 17108 /* "EXCEPT" */ break default: - z = ts + 17100 /* "UNION" */ + z = ts + 17115 /* "UNION" */ break } return z @@ -115120,7 +115628,7 @@ func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite bp := tls.Alloc(8) defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17106 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17121 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -115386,8 +115894,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 11358 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 14731 /* "rowid" */ + zType = ts + 11373 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 14746 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), uintptr(0)) @@ -115540,13 +116048,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 14731 /* "rowid" */ + zCol = ts + 14746 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+10759 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+10774 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -115554,7 +116062,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+17129 /* "column%d" */, libc.VaList(bp+16, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+17144 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -115643,7 +116151,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } else { - zName = ts + 14731 /* "rowid" */ + zName = ts + 14746 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -115656,7 +116164,7 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+17129 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+17144 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, @@ -115671,7 +116179,7 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+17138 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) + zName = Xsqlite3MPrintf(tls, db, ts+17153 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) if *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) > U32(3) { Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &cnt */) } @@ -116028,7 +116536,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+17146 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17161 /* "cannot use windo..." */, 0) return __1: ; @@ -116139,7 +116647,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+17195 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17210 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -116161,7 +116669,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17237 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17252 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -116204,7 +116712,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17243 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17258 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -116254,11 +116762,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17258 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17273 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 17281 /* "S" */ + return ts + 17296 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -116410,8 +116918,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17283 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17298 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17298 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17313 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -116460,7 +116968,7 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17073 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17088 /* "UNION ALL" */, 0) rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) @@ -116536,7 +117044,7 @@ __23: pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 64 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17317 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17332 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+64 /* &uniondest */) @@ -116608,7 +117116,7 @@ __26: pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 104 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17317 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17332 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+104 /* &intersectdest */) @@ -116769,10 +117277,10 @@ func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17338 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17353 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+17384, /* "SELECTs to the l..." */ + ts+17399, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -117152,9 +117660,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6225 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6240 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6225 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6240 /* "ORDER" */) } // Compute the limit registers @@ -117183,7 +117691,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) Xsqlite3SelectDestInit(tls, bp+48 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17466 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17481 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -117191,7 +117699,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17477 /* "LEFT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17492 /* "LEFT" */, 0) Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -117205,7 +117713,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17482 /* "RIGHT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17497 /* "RIGHT" */, 0) Xsqlite3Select(tls, pParse, p, bp+48 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -117402,7 +117910,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 292 /* "BINARY" */ + return ts + 307 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -118615,12 +119123,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+13813 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+13828 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+13817 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+13832 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -118689,7 +119197,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+17488 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+17503 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -118800,7 +119308,7 @@ func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* s defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17506 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17521 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -118988,7 +119496,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+17529 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+17544 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -119004,7 +119512,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17572 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17587 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { @@ -119030,7 +119538,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+17595, /* "table %s has %d ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17610, /* "table %s has %d ..." */ libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 @@ -119041,9 +119549,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17633 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17648 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17667 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17682 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -119091,7 +119599,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17705 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17720 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -119218,7 +119726,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+17717, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17732, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -119237,7 +119745,7 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+17756, /* "access to view \"..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17771, /* "access to view \"..." */ libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -119245,7 +119753,7 @@ __1: ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+17787, /* "unsafe use of vi..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17802, /* "unsafe use of vi..." */ libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) @@ -119360,7 +119868,7 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName } else { - zSchemaName = ts + 17820 /* "*" */ + zSchemaName = ts + 17835 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { @@ -119409,7 +119917,7 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+10759 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+10774 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { @@ -119425,7 +119933,7 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17822, /* "%s.%s.%s" */ + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17837, /* "%s.%s.%s" */ libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } @@ -119445,9 +119953,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17831 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17846 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+17849 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17864 /* "no tables specif..." */, 0) } } } @@ -119457,7 +119965,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+17869 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17884 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -119645,13 +120153,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+17900 /* "DISTINCT aggrega..." */, 0) + ts+17915 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17951 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17966 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -119851,19 +120359,19 @@ func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintpt if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17984, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17999, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 17996 /* " USING COVERING ..." */ + return ts + 18011 /* " USING COVERING ..." */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }())) } } @@ -119883,7 +120391,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6887 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -120185,7 +120693,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+18019, /* "target object/al..." */ + ts+18034, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -120265,7 +120773,7 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18073, /* "expected %d colu..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18088, /* "expected %d colu..." */ libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: @@ -120406,7 +120914,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+729 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+744 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -120471,7 +120979,7 @@ __35: (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18113 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18128 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) @@ -120533,7 +121041,7 @@ __44: __45: ; Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18128 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18143 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { @@ -121053,9 +121561,9 @@ __97: explainTempTable(tls, pParse, func() uintptr { if ((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 18144 /* "DISTINCT" */ + return ts + 18159 /* "DISTINCT" */ } - return ts + 18153 /* "GROUP BY" */ + return ts + 18168 /* "GROUP BY" */ }()) groupBySort = 1 @@ -121467,7 +121975,7 @@ __58: if !(int32((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+18144 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+18159 /* "DISTINCT" */) __140: ; @@ -121479,9 +121987,9 @@ __140: explainTempTable(tls, pParse, func() uintptr { if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { - return ts + 18162 /* "RIGHT PART OF OR..." */ + return ts + 18177 /* "RIGHT PART OF OR..." */ } - return ts + 18185 /* "ORDER BY" */ + return ts + 18200 /* "ORDER BY" */ }()) generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) @@ -121615,7 +122123,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + z = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) if !(z == uintptr(0)) { goto __10 } @@ -121637,7 +122145,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+18194 /* "sqlite3_get_tabl..." */, 0) + ts+18209 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -121736,7 +122244,7 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } @@ -121897,7 +122405,7 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+18259 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18274 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; @@ -121958,7 +122466,7 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18305 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18320 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+40 /* &sFix */, pTableName) != 0) { goto __9 } @@ -121976,7 +122484,7 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+18313 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18328 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; @@ -121991,7 +122499,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18305 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18320 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -122007,7 +122515,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+18354 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+18369 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -122021,10 +122529,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7055 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7070 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18380 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18395 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -122034,12 +122542,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+18418, /* "cannot create %s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18433, /* "cannot create %s..." */ libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 18455 /* "BEFORE" */ + return ts + 18470 /* "BEFORE" */ } - return ts + 18462 /* "AFTER" */ + return ts + 18477 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -122048,7 +122556,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+18468 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + ts+18483 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -122078,9 +122586,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -122214,7 +122722,7 @@ __2: __3: ; Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18305 /* "trigger" */, bp+40 /* &nameToken */) + Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18320 /* "trigger" */, bp+40 /* &nameToken */) if !((Xsqlite3FixTriggerStep(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || (Xsqlite3FixExpr(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 @@ -122251,13 +122759,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+18514, /* "INSERT INTO %Q.s..." */ + ts+18529, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+18589 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+18604 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -122523,7 +123031,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+18618 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+18633 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -122564,9 +123072,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10846 /* "sqlite_temp_mast..." */ + return ts + 10861 /* "sqlite_temp_mast..." */ } - return ts + 4930 /* "sqlite_master" */ + return ts + 4945 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -122579,7 +123087,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+18638, /* "DELETE FROM %Q.s..." */ + ts+18653, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -122698,12 +123206,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+18700, /* "%s RETURNING is ..." */ + ts+18715, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 18748 /* "DELETE" */ + return ts + 18763 /* "DELETE" */ } - return ts + 18755 /* "UPDATE" */ + return ts + 18770 /* "UPDATE" */ }())) __15: ; @@ -122799,7 +123307,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+18762 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18777 /* "RETURNING may no..." */, 0) return 1 } @@ -122940,7 +123448,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+5117 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+5132 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -123070,7 +123578,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+18804 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+18819 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -123773,7 +124281,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+18818, /* "cannot UPDATE ge..." */ + ts+18833, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto update_cleanup __27: @@ -123805,7 +124313,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+18854 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18869 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -123816,7 +124324,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 6662 /* "ROWID" */ + return ts + 6677 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName }(), @@ -124847,7 +125355,7 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18873 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18888 /* "rows updated" */, uintptr(0)) __169: ; @@ -125234,10 +125742,10 @@ __1: if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { *(*int8)(unsafe.Pointer(bp + 216 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+18886 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+18901 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+18890 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) + ts+18905 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -125328,7 +125836,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+10900 /* "corrupt database" */, -1) + ts+10915 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -125396,7 +125904,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+18963 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18967 /* "INS" */, uint64(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+18978 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18982 /* "INS" */, uint64(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -125546,14 +126054,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+18971 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+18986 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19011 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19026 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -125564,7 +126072,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19054 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19069 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -125573,7 +126081,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 729 /* "" */ + zOut = ts + 744 /* "" */ __4: ; @@ -125609,7 +126117,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+19072 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+19087 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -125630,7 +126138,7 @@ __6: goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+19095 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19110 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -125646,7 +126154,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+13187 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+13202 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -125697,7 +126205,7 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+19122, /* "SELECT sql FROM ..." */ + ts+19137, /* "SELECT sql FROM ..." */ libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 @@ -125707,7 +126215,7 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+19230, /* "SELECT sql FROM ..." */ + ts+19245, /* "SELECT sql FROM ..." */ libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 @@ -125722,7 +126230,7 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+19284, /* "SELECT'INSERT IN..." */ + ts+19299, /* "SELECT'INSERT IN..." */ libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) @@ -125739,7 +126247,7 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+19435, /* "INSERT INTO vacu..." */ + ts+19450, /* "INSERT INTO vacu..." */ libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 @@ -126119,7 +126627,7 @@ func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintp var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11130 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11145 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -126213,7 +126721,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(pEnd)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+19565 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+19580 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -126225,7 +126733,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+19589, /* "UPDATE %Q.sqlite..." */ + ts+19604, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -126235,7 +126743,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+19688 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+19703 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -126300,7 +126808,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+19707 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+19722 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -126338,9 +126846,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19749 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19764 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2764 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2779 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) @@ -126352,7 +126860,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 19779 /* "vtable construct..." */ + var zFormat uintptr = ts + 19794 /* "vtable construct..." */ *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR @@ -126368,12 +126876,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+729 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+744 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+14644 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+14659 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -126432,13 +126940,13 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+19825 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+19840 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+2764 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2779 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) @@ -126500,7 +127008,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19825 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19840 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -126577,7 +127085,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) != 0 { - return ts + 2764 /* "%s" */ + return ts + 2779 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)))) @@ -126949,7 +127457,7 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+2764 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2779 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 @@ -127380,10 +127888,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 19844 /* "" */ + return ts + 19859 /* "" */ } if i == (-1) { - return ts + 14731 /* "rowid" */ + return ts + 14746 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*32)).FzName } @@ -127398,35 +127906,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+19851 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19866 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19857 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19872 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11511 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11526 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4040 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4055 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19857 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19872 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11511 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11526 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+4096 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4111 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4040 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4055 /* ")" */, 1) } } @@ -127455,29 +127963,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+19859 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+19874 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+19851 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19866 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 19862 /* "%s=?" */ + return ts + 19877 /* "%s=?" */ } - return ts + 19867 /* "ANY(%s)" */ + return ts + 19882 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19875 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19890 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19877 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19892 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+4040 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4055 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -127522,11 +128030,11 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+80 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19879 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19894 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 19885 /* "SEARCH" */ + return ts + 19900 /* "SEARCH" */ } - return ts + 19892 /* "SCAN" */ + return ts + 19907 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -127536,38 +128044,38 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 9674 /* "PRIMARY KEY" */ + zFmt = ts + 9689 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 19897 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 19912 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 19930 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 19945 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 19955 /* "COVERING INDEX %..." */ + zFmt = ts + 19970 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 19973 /* "INDEX %s" */ + zFmt = ts + 19988 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+48 /* &str */, ts+19982 /* " USING " */, 7) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+19997 /* " USING " */, 7) Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 19990 /* "=" */ + zRangeOp = ts + 20005 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 19992 /* ">? AND rowid<" */ + zRangeOp = ts + 20007 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 19875 /* ">" */ + zRangeOp = ts + 19890 /* ">" */ } else { - zRangeOp = ts + 19877 /* "<" */ + zRangeOp = ts + 19892 /* "<" */ } Xsqlite3_str_appendf(tls, bp+48, /* &str */ - ts+20006 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + ts+20021 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20044, /* " VIRTUAL TABLE I..." */ + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20059, /* " VIRTUAL TABLE I..." */ libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) @@ -129123,7 +129631,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20071 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20086 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -129142,7 +129650,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20086 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20101 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -129891,10 +130399,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 14602 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 14075 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 13625 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 20095 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 14617 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14090 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 13640 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20110 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -130595,7 +131103,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+20102 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20117 /* "ON clause refere..." */, 0) return } } @@ -130671,7 +131179,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5749 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5764 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -130772,7 +131280,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { - return ts + 20143 /* "NOCASE" */ + return ts + 20158 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -131074,7 +131582,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+20150, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+20165, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -131897,7 +132405,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+20186 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+20201 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*32)).FzName)) sentWarning = U8(1) __6: @@ -131978,7 +132486,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20212 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20227 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -132211,7 +132719,7 @@ __3: ((uint64(unsafe.Sizeof(sqlite3_index_constraint{})) + uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint64(nTerm))) + (uint64(unsafe.Sizeof(sqlite3_index_orderby{})) * uint64(nOrderBy))) + uint64(unsafe.Sizeof(HiddenIndexInfo1{}))))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5155 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5170 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*96) @@ -132338,9 +132846,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+2764 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+2779 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -134390,7 +134898,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20223 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20238 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -134438,7 +134946,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+20223 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20238 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -134827,7 +135335,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+20249 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+20264 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -135596,7 +136104,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+20284 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20299 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -135977,7 +136485,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+20302 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+20317 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) return uintptr(0) __3: ; @@ -136052,7 +136560,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20330 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20345 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -137187,7 +137695,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+20348 /* "second argument ..." */, -1) + pCtx, ts+20363 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -137336,7 +137844,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+20404 /* "argument of ntil..." */, -1) + pCtx, ts+20419 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -137433,17 +137941,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20449 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20460 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20471 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20476 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20489 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20499 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20505 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20516 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20526 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20538 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20543 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20464 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20475 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20486 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20491 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20504 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20514 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20520 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20531 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20541 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20553 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20558 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -137507,7 +138015,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20547 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20562 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -137551,12 +138059,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+20566 /* "RANGE with offse..." */, 0) + ts+20581 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20637 /* "FILTER clause ma..." */, 0) + ts+20652 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -137579,7 +138087,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6887 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6902 /* "1" */) } break } @@ -137821,7 +138329,7 @@ func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+6948 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+6963 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -137951,7 +138459,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+6480 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6495 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -138091,7 +138599,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+20700 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20715 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -138157,15 +138665,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 20732 /* "PARTITION clause" */ + zErr = ts + 20747 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 20749 /* "ORDER BY clause" */ + zErr = ts + 20764 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 20765 /* "frame specificat..." */ + zErr = ts + 20780 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20785 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+20800 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -138188,7 +138696,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+20818 /* "DISTINCT is not ..." */, 0) + ts+20833 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -138339,7 +138847,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+729 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+744 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -138361,11 +138869,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 20865, /* "frame starting o..." */ - ts + 20918, /* "frame ending off..." */ - ts + 20348, /* "second argument ..." */ - ts + 20969, /* "frame starting o..." */ - ts + 21021, /* "frame ending off..." */ + ts + 20880, /* "frame starting o..." */ + ts + 20933, /* "frame ending off..." */ + ts + 20363, /* "second argument ..." */ + ts + 20984, /* "frame starting o..." */ + ts + 21036, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -138967,7 +139475,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+729 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+744 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -139982,19 +140490,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21071, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21086, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 18185 /* "ORDER BY" */ + return ts + 18200 /* "ORDER BY" */ } - return ts + 21113 /* "LIMIT" */ + return ts + 21128 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+21119 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21134 /* "too many terms i..." */, 0) } } @@ -140074,7 +140582,7 @@ func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdT var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21153, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21168, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -141301,7 +141809,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+21191 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21206 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -142280,11 +142788,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+14731 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+14746 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+21213 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+21228 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) } } break @@ -143019,7 +143527,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21240 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21255 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -143172,7 +143680,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(bp + 96 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21249 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21264 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) @@ -143376,9 +143884,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { - return ts + 6887 /* "1" */ + return ts + 6902 /* "1" */ } - return ts + 6480 /* "0" */ + return ts + 6495 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -143653,21 +144161,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+21273 /* "qualified table ..." */, 0) + ts+21288 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21368 /* "the INDEXED BY c..." */, 0) + ts+21383 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21452 /* "the NOT INDEXED ..." */, 0) + ts+21467 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ @@ -144116,9 +144624,9 @@ func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor To _ = yymajor // Silence some compiler warnings if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21249 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21264 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21537 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21552 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -145325,7 +145833,7 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21554 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+21569 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } @@ -145345,12 +145853,12 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2764 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2779 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21581, /* "%s in \"%s\"" */ + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21596, /* "%s in \"%s\"" */ libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ @@ -145562,7 +146070,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21592 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21607 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -145575,11 +146083,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18305 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18320 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21599 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21614 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21604 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21619 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -145592,9 +146100,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21614 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21629 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21618 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21633 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -146622,7 +147130,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+21626 /* "unable to close ..." */, 0) + ts+21641 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -146844,23 +147352,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 21694 /* "unknown error" */ + var zErr uintptr = ts + 21709 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 21708 /* "abort due to ROL..." */ + zErr = ts + 21723 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 21730 /* "another row avai..." */ + zErr = ts + 21745 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 21752 /* "no more rows ava..." */ + zErr = ts + 21767 /* "no more rows ava..." */ break } @@ -146878,35 +147386,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 21775, /* "not an error" */ - /* SQLITE_ERROR */ ts + 21788, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 21790, /* "not an error" */ + /* SQLITE_ERROR */ ts + 21803, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 21804, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 21829, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 21843, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 21862, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 5155, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 21887, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 21924, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 21936, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 21951, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 21984, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 22002, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 22027, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 22056, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 21819, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 21844, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 21858, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 21877, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5170, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 21902, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 21939, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 21951, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 21966, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 21999, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22017, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22042, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22071, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 4885, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 4422, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 22073, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 22091, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 22109, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 4900, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4437, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22088, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22106, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22124, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 22143, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 22158, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 22164, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 22190, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 22213, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 22234, /* "warning message" */ + /* SQLITE_RANGE */ ts + 22179, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22205, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22228, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22249, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -147071,7 +147579,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22250 /* "unable to delete..." */, 0) + ts+22265 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -147204,7 +147712,7 @@ func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUs _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+22313 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+22328 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -147426,7 +147934,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22364 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22379 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -147645,7 +148153,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22385 /* "unable to delete..." */, 0) + ts+22400 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -147788,7 +148296,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22453 /* "file:" */, uint64(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22468 /* "file:" */, uint64(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -147836,10 +148344,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22459 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22474 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22469, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22484, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -147961,7 +148469,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22497 /* "vfs" */, zOpt, uint64(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22512 /* "vfs" */, zOpt, uint64(3)) == 0)) { goto __29 } zVfs = zVal @@ -147972,17 +148480,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22501 /* "cache" */, zOpt, uint64(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22516 /* "cache" */, zOpt, uint64(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 22501 /* "cache" */ + zModeType = ts + 22516 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22507 /* "mode" */, zOpt, uint64(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22522 /* "mode" */, zOpt, uint64(4)) == 0)) { goto __32 } @@ -147990,7 +148498,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 2373 /* "access" */ + zModeType = ts + 2388 /* "access" */ __32: ; @@ -148021,7 +148529,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22512 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22527 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -148029,7 +148537,7 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22532, /* "%s mode not allo..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22547, /* "%s mode not allo..." */ libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out @@ -148072,7 +148580,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22556 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22571 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -148096,15 +148604,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 22572 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 22579 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 22587 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 22594 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 22587 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 22590 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 22593 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 15824 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 22602 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 22605 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 22608 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 15839 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -148286,10 +148794,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+20143 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+20158 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+22597 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+22612 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -148335,7 +148843,7 @@ __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2764 /* "%s" */ + return ts + 2779 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -148373,9 +148881,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5432 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5447 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 21599 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 21614 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -148493,7 +149001,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 22603 /* "\x00\x00" */ + zFilename = ts + 22618 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -148596,24 +149104,24 @@ func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) bp := tls.Alloc(24) defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+22606, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+22621, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22631 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22646 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22651 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22666 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22658 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22673 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -148740,7 +149248,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 11358 /* "INTEGER" */ + zDataType = ts + 11373 /* "INTEGER" */ primarykey = 1 __13: ; @@ -148792,14 +149300,14 @@ __19: goto __20 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22675 /* "no such table co..." */, libc.VaList(bp, zTableName, + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22690 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2764 /* "%s" */ + return ts + 2779 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -149598,7 +150106,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+22703 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+22718 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -149759,7 +150267,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 22711 /* "database is dead..." */ + return ts + 22726 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -150559,7 +151067,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 5232 /* "null" */, ts + 5744 /* "true" */, ts + 5749 /* "false" */, ts + 5242 /* "integer" */, ts + 5237 /* "real" */, ts + 13497 /* "text" */, ts + 22734 /* "array" */, ts + 22740, /* "object" */ + ts + 5247 /* "null" */, ts + 5759 /* "true" */, ts + 5764 /* "false" */, ts + 5257 /* "integer" */, ts + 5252 /* "real" */, ts + 13512 /* "text" */, ts + 22749 /* "array" */, ts + 22755, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -150739,7 +151247,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 22747 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 22762 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -150767,7 +151275,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+5232 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+5247 /* "null" */, uint32(4)) break } @@ -150796,7 +151304,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22764 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22779 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -150873,19 +151381,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+5232 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5247 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+5744 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5759 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+5749 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+5764 /* "false" */, uint32(5)) break } @@ -151451,17 +151959,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5232 /* "null" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5247 /* "null" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5744 /* "true" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5759 /* "true" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5749 /* "false" */, uint64(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5764 /* "false" */, uint64(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -151569,7 +152077,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+22793 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+22808 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -151889,7 +152397,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+22808 /* "[0]" */, uint64(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+22823 /* "[0]" */, uint64(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -151906,7 +152414,7 @@ func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190 bp := tls.Alloc(8) defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+22812 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+22827 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -151973,7 +152481,7 @@ func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlit bp := tls.Alloc(8) defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22838, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22853, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -152117,7 +152625,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+5232 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+5247 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -152245,14 +152753,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+22881 /* "json_object() re..." */, -1) + ts+22896 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+22932 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+22947 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -152360,7 +152868,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+14008 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+14023 /* "replace" */) return __2: ; @@ -152446,9 +152954,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 22966 /* "set" */ + return ts + 22981 /* "set" */ } - return ts + 22970 /* "insert" */ + return ts + 22985 /* "insert" */ }()) return __2: @@ -152596,7 +153104,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22977 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+22992 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -152701,7 +153209,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22980 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+22995 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -152754,7 +153262,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+22983 /* "CREATE TABLE x(k..." */) + ts+22998 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -152892,14 +153400,14 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*16) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+23066 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+23081 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 16 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23071 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23086 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } @@ -152992,9 +153500,9 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+24 /* &x */, ts+23066 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23081 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23071 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23086 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } jsonResult(tls, bp+24 /* &x */) @@ -153018,7 +153526,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 23077 /* "$" */ + zRoot = ts + 23092 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -153150,7 +153658,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22793 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22808 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -153291,21 +153799,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 23079 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23084 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23095 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23095 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23113 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23126 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23138 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23150 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23161 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23172 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23184 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23197 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 23206 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23206 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23216 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23094 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23099 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23110 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23110 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23128 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23141 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23153 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23165 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23176 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23187 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23199 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23212 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23221 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23221 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23231 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -153315,17 +153823,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 23227 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 23242 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 23244 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 23259 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 23262 /* "json_each" */, FpModule: 0}, - {FzName: ts + 23272 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 23277 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23287 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -153675,11 +154183,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+23282 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23297 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23290 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23305 /* "data" */, iNode, 0, (pRtree + 112 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -153924,7 +154432,7 @@ func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+23295, /* "DROP TABLE '%q'...." */ + ts+23310, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -154684,7 +155192,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23377 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23392 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -154948,7 +155456,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -156208,7 +156716,7 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+23391 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+23406 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { @@ -156220,12 +156728,12 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if iCol == 0 { var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23411 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+23426 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23443 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+23458 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } @@ -156493,7 +157001,7 @@ func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqli var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+23480 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+23495 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -156531,7 +157039,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit bp := tls.Alloc(24) defer tls.Free(24) - var zFmt uintptr = ts + 23625 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 23640 /* "SELECT stat FROM..." */ var zSql uintptr // var p uintptr at bp+16, 8 @@ -156539,7 +157047,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10046 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10061 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -156592,7 +157100,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 23681 /* "node" */, ts + 4148 /* "parent" */, ts + 14731, /* "rowid" */ + ts + 23696 /* "node" */, ts + 4163 /* "parent" */, ts + 14746, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -156636,19 +157144,19 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+23686, /* "CREATE TABLE \"%w..." */ + ts+23701, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+23748 /* ",a%d" */, libc.VaList(bp+16, ii)) + Xsqlite3_str_appendf(tls, p, ts+23763 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+23753, /* ");CREATE TABLE \"..." */ + ts+23768, /* ");CREATE TABLE \"..." */ libc.VaList(bp+24, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23817, /* "CREATE TABLE \"%w..." */ + ts+23832, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23887, /* "INSERT INTO \"%w\"..." */ + ts+23902, /* "INSERT INTO \"%w\"..." */ libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { @@ -156679,7 +157187,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 23936 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 23951 /* "INSERT INTO\"%w\"...." */ } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { @@ -156691,7 +157199,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+24044, /* "SELECT * FROM \"%..." */ + ts+24059, /* "SELECT * FROM \"%..." */ libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM @@ -156699,18 +157207,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+24089 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+24104 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+11511 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+11526 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+24116 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+24131 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+24138 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+24153 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+24146 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+24161 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -156726,18 +157234,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 24162, /* "INSERT OR REPLAC..." */ - ts + 24215, /* "DELETE FROM '%q'..." */ + ts + 24177, /* "INSERT OR REPLAC..." */ + ts + 24230, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 24260, /* "SELECT nodeno FR..." */ - ts + 24312, /* "INSERT OR REPLAC..." */ - ts + 24366, /* "DELETE FROM '%q'..." */ + ts + 24275, /* "SELECT nodeno FR..." */ + ts + 24327, /* "INSERT OR REPLAC..." */ + ts + 24381, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 24411, /* "SELECT parentnod..." */ - ts + 24469, /* "INSERT OR REPLAC..." */ - ts + 24524, /* "DELETE FROM '%q'..." */ + ts + 24426, /* "SELECT parentnod..." */ + ts + 24484, /* "INSERT OR REPLAC..." */ + ts + 24539, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -156784,7 +157292,7 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr var zSql uintptr if isCreate != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+24571 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, ts+24586 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) @@ -156792,19 +157300,19 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+24591, /* "SELECT length(da..." */ + ts+24606, /* "SELECT length(da..." */ libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 32 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24648, /* "undersize RTree ..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24663, /* "undersize RTree ..." */ libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -156855,17 +157363,17 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr ii = 4 *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 24683, /* "Wrong number of ..." */ // 1 - ts + 24726, /* "Too few columns ..." */ // 2 - ts + 24761, /* "Too many columns..." */ // 3 - ts + 24797, /* "Auxiliary rtree ..." */ // 4 + ts + 24698, /* "Wrong number of ..." */ // 1 + ts + 24741, /* "Too few columns ..." */ // 2 + ts + 24776, /* "Too many columns..." */ // 3 + ts + 24812, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) return SQLITE_ERROR __1: ; @@ -156895,7 +157403,7 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+24834, /* "CREATE TABLE x(%..." */ + Xsqlite3_str_appendf(tls, pSql, ts+24849, /* "CREATE TABLE x(%..." */ libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = 4 __3: @@ -156907,7 +157415,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+24858 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+24873 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -156930,7 +157438,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+24864 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24879 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -156941,14 +157449,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -156991,7 +157499,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) goto rtreeInit_fail __22: ; @@ -157009,7 +157517,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -157029,7 +157537,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 24867 /* ",%.*s REAL" */, ts + 24878 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 24882 /* ",%.*s REAL" */, ts + 24893 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -157084,13 +157592,13 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit nodeGetCell(tls, bp+56 /* &tree */, bp+16 /* &node */, ii, bp+1024 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+9626 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+9641 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+24888 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, ts+24903 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+24894 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+24909 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+24898 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+24913 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -157109,7 +157617,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+24900 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+24915 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -157198,12 +157706,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24933, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24948, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 3145 /* "\n" */ + return ts + 3160 /* "\n" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -157234,7 +157742,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+24940, /* "SELECT data FROM..." */ + ts+24955, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -157253,7 +157761,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+24985 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+25000 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -157277,8 +157785,8 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa var rc int32 var pStmt uintptr *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ - ts + 25017, /* "SELECT parentnod..." */ - ts + 25071, /* "SELECT nodeno FR..." */ + ts + 25032, /* "SELECT parentnod..." */ + ts + 25086, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) == uintptr(0) { @@ -157293,23 +157801,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+25119, /* "Mapping (%lld ->..." */ + rtreeCheckAppendMsg(tls, pCheck, ts+25134, /* "Mapping (%lld ->..." */ libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 25164 /* "%_rowid" */ + return ts + 25179 /* "%_rowid" */ } - return ts + 25172 /* "%_parent" */ + return ts + 25187 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+25181, /* "Found (%lld -> %..." */ + ts+25196, /* "Found (%lld -> %..." */ libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 25164 /* "%_rowid" */ + return ts + 25179 /* "%_rowid" */ } - return ts + 25172 /* "%_parent" */ + return ts + 25187 /* "%_parent" */ }(), iKey, iVal)) } } @@ -157352,7 +157860,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+25239 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+25254 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { @@ -157372,7 +157880,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+25287 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + ts+25302 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -157395,14 +157903,14 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr if aNode != 0 { if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+25354 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + ts+25369 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+25388 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+25403 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } @@ -157410,7 +157918,7 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr nCell = readInt16(tls, (aNode + 2)) if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+25418, /* "Node %lld is too..." */ + ts+25433, /* "Node %lld is too..." */ libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { @@ -157444,14 +157952,14 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+25473, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+25488, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+25504 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + ts+25519 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -157481,13 +157989,13 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13187 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13202 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25571 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25586 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) @@ -157496,12 +158004,12 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23391 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23406 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25599 /* "Schema corrupt o..." */, 0) + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25614 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } @@ -157516,8 +158024,8 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+32 /* &check */, ts+25630 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+32 /* &check */, ts+25637 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25645 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25652 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check @@ -157527,7 +158035,7 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+25645 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + var rc int32 = Xsqlite3_exec(tls, db, ts+25660 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } @@ -157573,7 +158081,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+25649 /* "wrong number of ..." */, -1) + ts+25664 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -157581,7 +158089,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 5432 /* "main" */ + zDb = ts + 5447 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -157591,7 +158099,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 16310 /* "ok" */ + return ts + 16325 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -158028,11 +158536,11 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+25700 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+25715 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+25702 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+25717 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+25713 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+25728 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -158056,19 +158564,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+25724 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+25777 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -159084,7 +159592,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+25775 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25790 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -159093,7 +159601,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+25797 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, ts+25812 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto __3 __3: ii++ @@ -159101,7 +159609,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+24864 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24879 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -159112,7 +159620,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -159138,7 +159646,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -159371,7 +159879,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14731 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14746 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -159381,7 +159889,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25801 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25816 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -159389,7 +159897,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25807 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25822 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -159527,7 +160035,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25816 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25831 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -159672,14 +160180,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+25856 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25871 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+25872 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25887 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -159744,7 +160252,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+25887 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25902 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -159756,25 +160264,25 @@ var aFunc1 = [12]struct { _ [6]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25895 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25908 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25921 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25934 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25872 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25946 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25856 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 25969 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25983 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 25996 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26010 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26026 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25910 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25923 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25936 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25949 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25887 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25961 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25871 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 25984 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25998 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26011 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26025 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26041 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 26038 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 26053 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -159787,26 +160295,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+26057 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26072 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26067 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26082 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26078 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26093 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+25801 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25816 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26089 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26104 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -159878,7 +160386,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23377 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23392 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -161169,7 +161677,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+26099 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26114 /* "corrupt fossil d..." */, -1) return } @@ -161180,7 +161688,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+26099 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26114 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -161201,7 +161709,7 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -161219,7 +161727,7 @@ func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -161323,7 +161831,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+26120 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + ts+26135 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -161407,7 +161915,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23290 /* "data" */, zIn, uint64(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23305 /* "data" */, zIn, uint64(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -161435,17 +161943,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26291 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+26306 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 26441 /* "AND rootpage!=0 ..." */ + return ts + 26456 /* "AND rootpage!=0 ..." */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 8 /* &.pIdxIter */), (p + 64 /* &.zErrmsg */), - ts+26482 /* "SELECT name, roo..." */) + ts+26497 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -161583,7 +162091,7 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -161646,7 +162154,7 @@ func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26607 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + ts+26622 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } @@ -161664,7 +162172,7 @@ __2: *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26688 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + Xsqlite3_mprintf(tls, ts+26703 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -161682,7 +162190,7 @@ __4: } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26709 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + ts+26724 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } @@ -161706,7 +162214,7 @@ __5: ; (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26760 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + Xsqlite3_mprintf(tls, ts+26775 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } @@ -161755,7 +162263,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26781 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26796 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 @@ -161770,7 +162278,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+24 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26809 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26824 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)))) { var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)), 1) if iCid >= 0 { @@ -161820,7 +162328,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+56 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17831 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17846 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc @@ -161833,18 +162341,18 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // of the input table. Ignore any input table columns that begin with // "rbu_". (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26838 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + Xsqlite3_mprintf(tls, ts+26853 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+26857 /* "rbu_" */, zName, 4) != 0 { + if Xsqlite3_strnicmp(tls, ts+26872 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 56 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*8)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+26862 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+26877 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } @@ -161856,12 +162364,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+26872 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+26887 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 26901 /* "may not have" */ + return ts + 26916 /* "may not have" */ } - return ts + 26914 /* "requires" */ + return ts + 26929 /* "requires" */ }())) } @@ -161870,7 +162378,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26923 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26938 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) { var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 1) @@ -161884,7 +162392,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26945, /* "column missing f..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26960, /* "column missing f..." */ libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 5) @@ -161930,12 +162438,12 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 729 /* "" */ + var zSep uintptr = ts + 744 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+26972 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 13298 /* ", " */ + zList = rbuMPrintf(tls, p, ts+26987 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13313 /* ", " */ } return zList } @@ -161950,13 +162458,13 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 729 /* "" */ + var zSep uintptr = ts + 744 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = rbuMPrintf(tls, p, ts+26981 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+26996 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -161995,25 +162503,25 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, if bRowid != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26994 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + ts+27009 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27026 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + zRet = rbuMPrintf(tls, p, ts+27041 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+729 /* "" */, ts+13298 /* ", " */, ts+27049 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27055 /* "quote(" */, ts+27062 /* "||','||" */, ts+4040 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+729 /* "" */, ts+13298 /* ", " */, ts+729 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+744 /* "" */, ts+13313 /* ", " */, ts+27064 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27070 /* "quote(" */, ts+27077 /* "||','||" */, ts+4055 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+744 /* "" */, ts+13313 /* ", " */, ts+744 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27070, /* "SELECT %s FROM \"..." */ + ts+27085, /* "SELECT %s FROM \"..." */ libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27112 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + zRet = rbuMPrintf(tls, p, ts+27127 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } @@ -162071,12 +162579,12 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 729 /* "" */ + zSep = ts + 744 /* "" */ iCol = 0 *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26809 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26824 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 @@ -162113,7 +162621,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) goto __7 __6: - zCol = ts + 27132 /* "_rowid_" */ + zCol = ts + 27147 /* "_rowid_" */ __7: ; goto __5 @@ -162122,13 +162630,13 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+27140, /* "%z%s \"%w\" COLLAT..." */ + zLhs = rbuMPrintf(tls, p, ts+27155, /* "%z%s \"%w\" COLLAT..." */ libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+27161, /* "%z%s \"rbu_imp_%d..." */ + zOrder = rbuMPrintf(tls, p, ts+27176, /* "%z%s \"rbu_imp_%d..." */ libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+27197, /* "%z%s quote(\"rbu_..." */ + zSelect = rbuMPrintf(tls, p, ts+27212, /* "%z%s quote(\"rbu_..." */ libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) - zSep = ts + 13298 /* ", " */ + zSep = ts + 13313 /* ", " */ iCol++ goto __1 __2: @@ -162147,12 +162655,12 @@ __11: *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+184 /* &pSel */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27224, /* "SELECT %s FROM \"..." */ + Xsqlite3_mprintf(tls, ts+27239, /* "SELECT %s FROM \"..." */ libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))))) { goto __13 } - zSep = ts + 729 /* "" */ + zSep = ts + 744 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -162174,8 +162682,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+27272 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) - zSep = ts + 13298 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+27287 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13313 /* ", " */ goto __15 __15: iCol++ @@ -162187,7 +162695,7 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+27279 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+27294 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: @@ -162237,14 +162745,14 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 729 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 729 /* "" */ // Set to " AND " later on + var zCom uintptr = ts + 744 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 744 /* "" */ // Set to " AND " later on *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26809 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26824 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { @@ -162256,9 +162764,9 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC if iCid == -2 { var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+27291 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + zRet = Xsqlite3_mprintf(tls, ts+27306 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FzSpan, zCollate)) - zType = ts + 729 /* "" */ + zType = ts + 744 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -162270,37 +162778,37 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 27132 /* "_rowid_" */ + zCol = ts + 27147 /* "_rowid_" */ } else { - zCol = ts + 26862 /* "rbu_rowid" */ + zCol = ts + 26877 /* "rbu_rowid" */ } - zType = ts + 11358 /* "INTEGER" */ + zType = ts + 11373 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, ts+27313 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+27328 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 27049 /* " DESC" */ + return ts + 27064 /* " DESC" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+27333, /* "%z%s\"rbu_imp_%d%..." */ + zImpPK = Xsqlite3_mprintf(tls, ts+27348, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+27354, /* "%z%s\"rbu_imp_%d%..." */ + zImpCols = Xsqlite3_mprintf(tls, ts+27369, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+27387 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + ts+27402 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 13298 /* ", " */ - zAnd = ts + 19851 /* " AND " */ + zCom = ts + 13313 /* ", " */ + zAnd = ts + 19866 /* " AND " */ nBind++ } @@ -162343,16 +162851,16 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 729 /* "" */ + var zS uintptr = ts + 744 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, ts+27411 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+27426 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+27423 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+27438 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 13298 /* ", " */ + zS = ts + 13313 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -162361,7 +162869,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27432 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+27447 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -162381,27 +162889,27 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27447 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+27462 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 729 /* "" */ + var zSep uintptr = ts + 744 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+27461 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) - zSep = ts + 19851 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27476 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 19866 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+27473 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + ts+27488 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 729 /* "" */ + var zSep uintptr = ts + 744 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+27523 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) - zSep = ts + 19851 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27538 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 19866 /* " AND " */ } } } @@ -162415,7 +162923,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27536 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27551 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -162444,21 +162952,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 729 /* "" */ + var zSep uintptr = ts + 744 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+27523, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+27538, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13298 /* ", " */ + zSep = ts + 13313 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+27562, /* "%z%s\"%w\"=rbu_del..." */ + zList = rbuMPrintf(tls, p, ts+27577, /* "%z%s\"%w\"=rbu_del..." */ libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13298 /* ", " */ + zSep = ts + 13313 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+27592, /* "%z%s\"%w\"=rbu_fos..." */ + zList = rbuMPrintf(tls, p, ts+27607, /* "%z%s\"%w\"=rbu_fos..." */ libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13298 /* ", " */ + zSep = ts + 13313 /* ", " */ } } } @@ -162516,19 +163024,19 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 27629 /* "PRIMARY KEY(" */ + var zSep uintptr = ts + 27644 /* "PRIMARY KEY(" */ *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26781 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26796 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14641 /* "pk" */) == 0) { + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14656 /* "pk" */) == 0) { var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26809 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26824 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } @@ -162541,15 +163049,15 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 2) var zDesc uintptr if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 3) != 0 { - zDesc = ts + 27049 /* " DESC" */ + zDesc = ts + 27064 /* " DESC" */ } else { - zDesc = ts + 729 /* "" */ + zDesc = ts + 744 /* "" */ } - z = rbuMPrintf(tls, p, ts+27642 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = ts + 13298 /* ", " */ + z = rbuMPrintf(tls, p, ts+27657 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13313 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+27653 /* "%z)" */, libc.VaList(bp+48, z)) + z = rbuMPrintf(tls, p, ts+27668 /* "%z)" */, libc.VaList(bp+48, z)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */))) } return z @@ -162581,7 +163089,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 729 /* "" */ + var zComma uintptr = ts + 744 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration @@ -162589,7 +163097,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 64 /* &.zErrmsg */), - ts+27657 /* "SELECT name FROM..." */) + ts+27672 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { @@ -162598,7 +163106,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit } if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26809 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + Xsqlite3_mprintf(tls, ts+26824 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) @@ -162608,25 +163116,25 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+27707 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + zCols = rbuMPrintf(tls, p, ts+27722 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+27729 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+27744 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 27049 /* " DESC" */ + return ts + 27064 /* " DESC" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }())) - zComma = ts + 13298 /* ", " */ + zComma = ts + 13313 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+27739 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + zCols = rbuMPrintf(tls, p, ts+27754 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+27754, /* "CREATE TABLE rbu..." */ + ts+27769, /* "CREATE TABLE rbu..." */ libc.VaList(bp+120, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 0, 0)) } } @@ -162654,52 +163162,52 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 729 /* "" */ + var zComma uintptr = ts + 744 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 729 /* "" */ + var zPk uintptr = ts + 744 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 27816 /* "PRIMARY KEY " */ + zPk = ts + 27831 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+27829, /* "%z%s\"%w\" %s %sCO..." */ + zSql = rbuMPrintf(tls, p, ts+27844, /* "%z%s\"%w\" %s %sCO..." */ libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 27856 /* " NOT NULL" */ + return ts + 27871 /* " NOT NULL" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }())) - zComma = ts + 13298 /* ", " */ + zComma = ts + 13313 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+27866 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+27881 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27873, /* "CREATE TABLE \"rb..." */ + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27888, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 27905 /* " WITHOUT ROWID" */ + return ts + 27920 /* " WITHOUT ROWID" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 0, 0)) } } @@ -162722,7 +163230,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 152 /* &.pTmpInsert */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27920, /* "INSERT INTO %s.'..." */ + ts+27935, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -162759,7 +163267,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+27977 /* "SELECT trim(sql)..." */) + ts+27992 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -162869,7 +163377,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+28043 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+28058 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -162890,26 +163398,26 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 624 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28063, /* "CREATE TABLE \"rb..." */ + ts+28078, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, 0, 0)) // Create the statement to insert index entries (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28128 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+28143 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28164 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+28179 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -162926,7 +163434,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+28198, /* "SELECT %s, 0 AS ..." */ + ts+28213, /* "SELECT %s, 0 AS ..." */ libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, @@ -162934,32 +163442,32 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 28259 /* "AND" */ + return ts + 28274 /* "AND" */ } - return ts + 28263 /* "WHERE" */ + return ts + 28278 /* "WHERE" */ }() } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+28269, /* "SELECT %s, rbu_c..." */ + ts+28284, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+216, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+28330, /* "SELECT %s, rbu_c..." */ + ts+28345, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+264, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 28259 /* "AND" */ + return ts + 28274 /* "AND" */ } - return ts + 28263 /* "WHERE" */ + return ts + 28278 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -162984,8 +163492,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5441 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5437 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5456 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5452 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -162995,21 +163503,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 28489 /* "rbu_imp_" */ + return ts + 28504 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+28498, /* "INSERT INTO \"%s%..." */ + ts+28513, /* "INSERT INTO \"%s%..." */ libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 28534 /* ", _rowid_" */ + return ts + 28549 /* ", _rowid_" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), zBindings))) } @@ -163019,28 +163527,28 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+28544 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + ts+28559 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 729 /* "" */ + var zRbuRowid uintptr = ts + 744 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 28572 /* ", rbu_rowid" */ + zRbuRowid = ts + 28587 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+28584 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+28599 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 28660 /* ", 0 AS rbu_rowid" */ + return ts + 28675 /* ", 0 AS rbu_rowid" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28677, /* "CREATE TEMP TRIG..." */ + ts+28692, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) @@ -163048,7 +163556,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28976, /* "CREATE TEMP TRIG..." */ + ts+28991, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } @@ -163057,14 +163565,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 729 /* "" */ + var zRbuRowid uintptr = ts + 744 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 29075 /* ",_rowid_ " */ + zRbuRowid = ts + 29090 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 29085 /* ",rbu_rowid" */ + zRbuRowid = ts + 29100 /* ",rbu_rowid" */ } } @@ -163077,35 +163585,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+27132 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+27147 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+729 /* "" */, ts+13298 /* ", " */, ts+729 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+744 /* "" */, ts+13313 /* ", " */, ts+744 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+29096, /* "SELECT %s,%s rbu..." */ + ts+29111, /* "SELECT %s,%s rbu..." */ libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 29144 /* "0 AS " */ + return ts + 29159 /* "0 AS " */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 18185 /* "ORDER BY" */ + return ts + 18200 /* "ORDER BY" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), zOrder, zLimit))) } @@ -163180,12 +163688,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 729 /* "" */ + var zPrefix uintptr = ts + 744 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 28489 /* "rbu_imp_" */ + zPrefix = ts + 28504 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+29150, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+29165, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 8 /* &.pUpdate */), (p + 64 /* &.zErrmsg */), zUpdate) @@ -163212,7 +163720,7 @@ func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uin return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } @@ -163253,7 +163761,7 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ } *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29180 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) + Xsqlite3_mprintf(tls, ts+29195 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: @@ -163325,31 +163833,31 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5432 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5447 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5432 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29210 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5447 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29225 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29237 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+2387 /* "stat" */, uint64(4)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29252 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+2402 /* "stat" */, uint64(4)) } else { - libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+5432 /* "main" */, uint64(4)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+5447 /* "main" */, uint64(4)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29255 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29270 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5432 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5447 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -163382,11 +163890,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29321 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29336 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22453 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22468 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -163398,16 +163906,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+29353, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5432 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+29368, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5447 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 29385 /* "&" */ + return ts + 29400 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } return zExtra }())) @@ -163423,40 +163931,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29387 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29402 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29402 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+29417 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29419 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29434 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29435 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29450 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29463 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29478 /* "rbu vfs not foun..." */, 0) } } @@ -163525,7 +164033,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29435 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29450 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163559,7 +164067,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29481 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29496 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -163686,16 +164194,16 @@ func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ bp := tls.Alloc(16) defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5432 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5447 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5432 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5447 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+29516 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+29523 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+29531 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+29538 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -163835,7 +164343,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22091 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22106 /* "datatype mismatc..." */, 0) return } @@ -163953,7 +164461,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // var pStmt uintptr at bp+8, 8 (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+29530 /* "PRAGMA schema_ve..." */) + ts+29545 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot @@ -163966,7 +164474,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29552 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29567 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -163991,7 +164499,7 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+29579, /* "INSERT OR REPLAC..." */ + ts+29594, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+48, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -164036,9 +164544,9 @@ func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29737 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + Xsqlite3_mprintf(tls, ts+29752 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29752, /* "PRAGMA main.%s =..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29767, /* "PRAGMA main.%s =..." */ libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) @@ -164055,11 +164563,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29772 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29787 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+29797 /* "SELECT sql FROM ..." */) + ts+29812 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -164073,12 +164581,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+29905 /* "SELECT * FROM sq..." */) + ts+29920 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8 /* &pInsert */, (p + 64 /* &.zErrmsg */), - ts+29970 /* "INSERT INTO sqli..." */) + ts+29985 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -164090,7 +164598,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30014 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30029 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -164112,8 +164620,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+15697 /* "user_version" */) - rbuCopyPragma(tls, p, ts+14819 /* "application_id" */) + rbuCopyPragma(tls, p, ts+15712 /* "user_version" */) + rbuCopyPragma(tls, p, ts+14834 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -164124,7 +164632,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30039 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+30054 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -164150,10 +164658,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13202 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13217 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13202 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13217 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -164270,7 +164778,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30067 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30082 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -164289,7 +164797,7 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ bp := tls.Alloc(8) defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+29516 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+29531 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -164311,7 +164819,7 @@ func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ // var zRnd [64]int8 at bp+12, 64 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30092 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30107 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) @@ -164350,7 +164858,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+16, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+30103 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+30118 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)), -1) } else { @@ -164393,7 +164901,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30175 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30190 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -164401,7 +164909,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30189 /* "SELECT 1 FROM sq..." */) + ts+30204 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -164413,7 +164921,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30246 /* "SELECT sum(cnt *..." */) + ts+30261 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -164459,7 +164967,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + uint64(1))) pCsr += (uintptr(nRbu + uint64(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2764 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2779 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -164496,7 +165004,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30320 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30335 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -164518,12 +165026,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30352, /* "database modifie..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30367, /* "database modifie..." */ libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30384 /* "vacuum" */ + return ts + 30399 /* "vacuum" */ } - return ts + 30391 /* "update" */ + return ts + 30406 /* "update" */ }())) } } @@ -164531,7 +165039,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13187 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13202 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -164545,24 +165053,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+15422 /* "page_size" */) - rbuCopyPragma(tls, p, ts+14834 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+15437 /* "page_size" */) + rbuCopyPragma(tls, p, ts+14849 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30398 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30413 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+5432 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+5447 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+30414 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + db, ts+30429 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } } @@ -164615,7 +165123,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30438 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30453 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { return rbuMisuseError(tls) } } @@ -164645,7 +165153,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); Size_t(i) < (nErrmsg - uint64(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28489 /* "rbu_imp_" */, uint64(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28504 /* "rbu_imp_" */, uint64(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -164664,7 +165172,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13202 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13217 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -164676,7 +165184,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13202 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13217 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Close any open statement handles. @@ -164688,7 +165196,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30446 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30461 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -164787,7 +165295,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13202 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13217 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -164804,19 +165312,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13202 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13217 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 13187 /* "BEGIN" */ + zBegin = ts + 13202 /* "BEGIN" */ } else { - zBegin = ts + 30398 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 30413 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30398 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30413 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -165220,7 +165728,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30473 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30488 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -165243,7 +165751,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+30496 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30511 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -165406,7 +165914,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5432 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5447 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -165421,7 +165929,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+30507 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+30522 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -165728,6 +166236,5673 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + _ [4]byte + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + _ [4]byte + FaData uintptr + FnData int32 + _ [4]byte + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 + _ [4]byte +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nVarint + 1))), z, uint64(n)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 8 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.Xmemcpy(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint64(8)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint64(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint64(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+16, 4 + + var aOld uintptr + // var nNew int32 at bp+40, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+16 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+40 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.Xmemcpy(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+44, 4 + + var aOld uintptr + // var nNew int32 at bp+48, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+44 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+48 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 44 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.Xmemcpy(tls, aOut, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 8 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint64(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 8 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10061 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+30533 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+744 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+30654 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(uint64(nDbCol) * ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))) + uint64(1))))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*8) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, (uint64(nThis + 1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, (uint64(nName + 1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 8 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 16 /* &.nCol */), uintptr(0), (pTab + 24 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10061 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += I64((uint64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + uint64(1)))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 24 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 32 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.Xmemcpy(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint64(8)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + // var iHash int32 at bp+48, 4 + + // var bNull int32 at bp+52, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 48 + + var p uintptr + // var p1 uintptr at bp+56, 8 + + // var p2 uintptr at bp+72, 8 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+64, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 24 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+744 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+48 /* &iHash */, bp+52 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)), bp+64 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.Xmemset(tls, pC, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*32) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)), bp+64 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 48 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 8 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 + _ [4]byte +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 744 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+30683, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 19866 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 744 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+30717, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 30758 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6495 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+30763, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+30841, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 16 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+24, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+40, 8 + + // var azCol uintptr at bp+32, 8 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+16, 8 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.Xmemset(tls, bp /* &d */, 0, uint64(unsafe.Sizeof(SessionDiffCtx{}))) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+16 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24 /* &nCol */, uintptr(0), bp+32 /* &azCol */, bp+40 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol + uintptr(i)*8))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+30894 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(Sqlite3_session{})) + uint64(nDb)) + uint64(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_session{}))) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*136) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.Xmemcpy(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint64(nDb + 1))) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 8 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 80 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionTable{})) + uint64(nName)) + uint64(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint64(nName + 1))) + for ppTab = (pSession + 88 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint64(nBlob)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint64(nStr)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([24]int8{})) - uint64(1))), bp+8 /* &aBuf[0] */, ts+4078 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = (int32((int64(zOut) - int64((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint64(8)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+32 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+32 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, (int32((int64(a) - int64(pStart)) / 1)), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10061 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+30921 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 744 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31031 /* "SELECT * FROM " */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+757 /* "." */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31046 /* " WHERE " */, bp+24 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31054 /* " IS ?" */, bp+24 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+24 /* &rc */) + zSep = ts + 19866 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp /* &rVal */, bp+8 /* &iVal */, uint64(8)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+40, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31060 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+16, 8 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+8 /* &azCol */, bp+16 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+24 /* &buf */, bPatchset, pTab, bp+40 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), bp+48 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+24 /* &buf */, uint8(SQLITE_INSERT), bp+40 /* &rc */) + sessionAppendByte(tls, bp+24 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+40 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+24 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), iCol, bp+40 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendUpdate(tls, bp+24 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendDelete(tls, bp+24 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31080 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.Xmemmove(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint64(nMove)) + } + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+32 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 48 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, aCopy, aData, uint64(nData)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &d */, bp+16 /* &v */, uint64(8)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 120 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)) + uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 72 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)) + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */)))) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*8) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+100 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2))) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+100 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*8)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var rc int32 at bp+40, 4 + // Return value + // var sOut SessionBuffer at bp, 16 + // Output buffer + // var nCol int32 at bp+20, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+24, 16 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+16, 4 + + var nVar int32 + // var nByte1 int32 at bp+44, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.Xmemset(tls, bp /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+16 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+20 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+24 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 16 /* nByte */)), bp+40 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 16 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+44 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */)), bp+40 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+40 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))*8), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) + }())))*8)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+40 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+40 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + var rc int32 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + _ [4]byte + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [6]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 64 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint64(nU32)*uint64(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionUpdate{})) * uint64(nU32)) * uint64(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10061 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 744 /* "" */ + // var buf SessionBuffer at bp, 16 + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*24) + libc.Xmemcpy(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + + sessionAppendStr(tls, bp /* &buf */, ts+31098 /* "UPDATE main." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31111 /* " SET " */, bp+16 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31117 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+16 /* &rc */) + zSep = ts + 13313 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 744 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31046 /* " WHERE " */, bp+16 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*8)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31122 /* "idx IS CASE WHEN..." */, bp+16 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31054 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+16 /* &rc */) + } + zSep = ts + 19866 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + var zSep uintptr = ts + 744 /* "" */ + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31197 /* "DELETE FROM main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31046 /* " WHERE " */, bp+16 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31117 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 19866 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31215 /* " AND (?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+30758 /* " OR " */, bp+16 /* &rc */) + + zSep = ts + 744 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31054 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 31223 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4055 /* ")" */, bp+16 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5447 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 24 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31228 /* "INSERT INTO main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+19872 /* "(" */, bp+16 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13313 /* ", " */, bp+16 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31246 /* ") VALUES(?" */, bp+16 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31257 /* ", ?" */, bp+16 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4055 /* ")" */, bp+16 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 16 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10061 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 16 /* &.pInsert */), + + ts+31261 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pDelete */), + + ts+31374 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 8 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var nCol int32 at bp+8, 4 + // Number of columns in table + // var op int32 at bp+12, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 8 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 104 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 104 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 104 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+8 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8 /* &pVal */) + } + sessionAppendValue(tls, (p + 104 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+16, 4 + + // var nCol int32 at bp+8, 4 + + // var op int32 at bp+12, 4 + + // var zDummy uintptr at bp, 8 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 88 /* &.constraints */), aBlob, nBlob, bp+16 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var zDummy uintptr at bp, 8 + + // var op int32 at bp+12, 4 + + // var nCol int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 8 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+16 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*8)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*8)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31518 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31539 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, (pApply + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint64(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint64(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 72 /* &.tblhdr */), int64(nByte), bp+8 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte) + } + + for (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(368) + defer tls.Free(368) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 128 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.Xmemset(tls, bp+48 /* &sApply */, 0, uint64(unsafe.Sizeof(SessionApplyCtx{}))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+31558 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31584 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+184, 4 + + // var op int32 at bp+188, 4 + + // var zNew uintptr at bp+176, 8 + + Xsqlite3changeset_op(tls, pIter, bp+176 /* &zNew */, bp+184 /* &nCol */, bp+188 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+192, 8 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.Xmemset(tls, (bp + 48 /* &sApply */ + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+192 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5447 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), (bp + 48 /* &sApply */ + 32 /* &.nCol */), bp+200 /* &zTab */, (bp + 48 /* &sApply */ + 40 /* &.azCol */), (bp + 48 /* &sApply */ + 48 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31614 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+31658, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 192 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31729 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), ts+10061 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+208, 4 + + // var notUsed int32 at bp+212, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+208 /* &nFk */, bp+212 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+216, 152 + + libc.Xmemset(tls, bp+216 /* &sIter */, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 216 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+216 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+31789 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31819 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+31843 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+31819 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(SessionChange{})) + uint64(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*32) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint64(nIn)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.Xmemset(tls, pNew, 0, uint64(nByte)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+8, 8 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(SessionChange{})) + uint64((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+16 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+24 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */))) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var aRec uintptr at bp, 8 + + // var nRec int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+16, 8 + + // var nCol int32 at bp+24, 4 + + // var op int32 at bp+28, 4 + + var iHash int32 + // var bIndirect int32 at bp+32, 4 + + // var pChange uintptr at bp+48, 8 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+16 /* &zNew */, bp+24 /* &nCol */, bp+28 /* &op */, bp+32 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)))) + // var abPK uintptr at bp+40, 8 + + Xsqlite3changeset_pk(tls, pIter, bp+40 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(SessionTable{})) + uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + uint64(nNew)) + uint64(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 24 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (uint64(nNew + 1))) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28 /* op */)), *(*int32)(unsafe.Pointer(bp + 32 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+48 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+16 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+16 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+16 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3_changegroup{}))) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint64(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint64(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 16 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, bp+12 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+16 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+32 /* &rc */) + sessionAppendVarint(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+32 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_UPDATE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+40 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_INSERT), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)), (int32(int64(*(*int32)(unsafe.Pointer(bp + 8 /* nRec */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */))) - int64(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1))), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+16 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_DELETE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + libc.Xmemset(tls, bp+16 /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_rebaser{}))) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -165798,71 +171973,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -166692,7 +172802,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+30518 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+31871 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -167015,7 +173125,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+30546 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+31899 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -167316,7 +173426,7 @@ func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+30577 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31930 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -167390,7 +173500,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 30584 /* "wrong number of ..." */ + var zErr uintptr = ts + 31937 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -167557,7 +173667,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 729 /* "" */ + return ts + 744 /* "" */ } // Implementation of snippet() function. @@ -167584,7 +173694,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 30634 /* "wrong number of ..." */ + var zErr uintptr = ts + 31987 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -167926,13 +174036,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(96) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 30682 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32035 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 30690 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32043 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 30700 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32053 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -168426,7 +174536,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+5232 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+5247 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -168605,7 +174715,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+30705 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32058 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 @@ -168632,14 +174742,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30712 /* "malformed prefix..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32065 /* "malformed prefix..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+30743 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + ts+32096 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -168650,7 +174760,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30776 /* "prefix length ou..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32129 /* "prefix length ou..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -168663,7 +174773,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30813 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32166 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + uint64(1))) var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) @@ -168672,7 +174782,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30822 /* "multiple tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32175 /* "multiple tokeniz..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { @@ -168691,7 +174801,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30855 /* "parse error in t..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32208 /* "parse error in t..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, @@ -168706,14 +174816,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30889 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32242 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30897 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32250 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+30929 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32282 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } @@ -168721,9 +174831,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30935 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32288 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30949 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32302 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) @@ -168731,9 +174841,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30987 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32340 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30998 /* "malformed column..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32351 /* "malformed column..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) @@ -168741,21 +174851,21 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+4163 /* "detail" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+4178 /* "detail" */, zCmd, nCmd) == 0 { *(*[4]Fts5Enum)(unsafe.Pointer(bp + 48 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 15802 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 15807 /* "full" */}, - {FzName: ts + 31033 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {FzName: ts + 15817 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 15822 /* "full" */}, + {FzName: ts + 32386 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+48 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31041 /* "malformed detail..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32394 /* "malformed detail..." */, 0) } return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31072 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32425 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -168819,15 +174929,15 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+20471 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+14731 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31100 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20486 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+14746 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32453 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+31130 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32483 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31140 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32493 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -168845,13 +174955,13 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31171 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32524 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31176 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32529 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31183 /* ", T.c%d" */, libc.VaList(bp+16, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32536 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } @@ -168899,8 +175009,8 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20471 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31191 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20486 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32544 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } @@ -168933,7 +175043,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31220 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32573 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { @@ -168941,7 +175051,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), pzErr) } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)), pzErr) @@ -168966,19 +175076,19 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 30889 /* "content" */ + zTail = ts + 32242 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 31240 /* "docsize" */ + zTail = ts + 32593 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+40 /* &rc */, ts+31248 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+32601 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14731 /* "rowid" */, -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14746 /* "rowid" */, -1) } // Formulate the zContentExprlist text @@ -169027,18 +175137,18 @@ func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31259 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32612 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 729 /* "" */ + return ts + 744 /* "" */ } - return ts + 13298 /* ", " */ + return ts + 13313 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31275 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32628 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31282, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20471 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32635, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20486 /* "rank" */)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -169178,7 +175288,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+31308 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+32661 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -169188,7 +175298,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31313 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32666 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -169198,7 +175308,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31322 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32675 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -169211,7 +175321,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31332 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32685 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -169221,7 +175331,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31342 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32695 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -169237,7 +175347,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20471 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20486 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 8 @@ -169264,7 +175374,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 bp := tls.Alloc(52) defer tls.Free(52) - var zSelect uintptr = ts + 31354 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 32707 /* "SELECT k, v FROM..." */ var zSql uintptr *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK @@ -169287,7 +175397,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) { var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 0) var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+31386 /* "version" */) { + if 0 == Xsqlite3_stricmp(tls, zK, ts+32739 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 48 /* bDummy */)) = 0 @@ -169302,7 +175412,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+31394, /* "invalid fts5 fil..." */ + ts+32747, /* "invalid fts5 fil..." */ libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } @@ -169436,7 +175546,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31459 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+32812 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -169449,20 +175559,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31479 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+32832 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31510 /* "OR" */, uint64(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32863 /* "OR" */, uint64(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31513 /* "NOT" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32866 /* "NOT" */, uint64(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28259 /* "AND" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28274 /* "AND" */, uint64(3)) == 0) { tok = FTS5_AND } break @@ -171435,9 +177545,9 @@ func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqli bp := tls.Alloc(16) defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+31517 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+32870 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+30546 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+31899 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -171453,7 +177563,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+31522 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+32875 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -171550,7 +177660,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+18854 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+18869 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -171646,7 +177756,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31551 /* "fts5: column que..." */, 0) + ts+32904 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -171830,12 +177940,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31604, /* "fts5: %s queries..." */ + ts+32957, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 31654 /* "phrase" */ + return ts + 33007 /* "phrase" */ } - return ts + 31517 /* "NEAR" */ + return ts + 32870 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -173308,7 +179418,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+31661 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33014 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -173396,7 +179506,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+31667, /* "REPLACE INTO '%q..." */ + ts+33020, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -173424,7 +179534,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+31718, /* "DELETE FROM '%q'..." */ + ts+33071, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+72 /* &.pDeleter */), zSql) != 0 { return @@ -173448,7 +179558,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 88 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+31767, /* "DELETE FROM '%q'..." */ + ts+33120, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -173656,7 +179766,7 @@ func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12 if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 112 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+31807 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+33160 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -175091,7 +181201,7 @@ func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:2 var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 96 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+31830, /* "SELECT pgno FROM..." */ + ts+33183, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -176348,7 +182458,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -176689,7 +182799,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 80 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+31914, /* "INSERT INTO '%q'..." */ + ts+33267, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -177906,7 +184016,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Fts5Structure{}))) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+729 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+744 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -177927,13 +184037,13 @@ func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uint if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+31971 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33324 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+23290 /* "data" */, ts+31979 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+23305 /* "data" */, ts+33332 /* "id INTEGER PRIMA..." */, 0, pzErr) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10186, /* "idx" */ - ts+32014, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10201, /* "idx" */ + ts+33367, /* "segid, term, pgn..." */ 1, pzErr) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { @@ -178239,7 +184349,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+31661 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) + ts+33014 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))) @@ -178376,7 +184486,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+32058, /* "SELECT segid, te..." */ + ts+33411, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. @@ -178586,7 +184696,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 16 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*120), uintptr(0), bp+16 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+32144 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+33497 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fn, bp+32 /* &iOff */, bp+40 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) & int64(0x7FFFFFFF))) @@ -178997,7 +185107,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32149 /* "recursively defi..." */, 0) + ts+33502 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -179031,7 +185141,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4063 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4078 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -179047,7 +185157,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4063 /* "%d" */, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4078 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -179390,7 +185500,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -179422,7 +185532,7 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -179461,25 +185571,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+32188, /* "SELECT rowid, ra..." */ + ts+33541, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 13298 /* ", " */ + return ts + 13313 /* ", " */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 32243 /* "DESC" */ + return ts + 33596 /* "DESC" */ } - return ts + 32248 /* "ASC" */ + return ts + 33601 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -179530,13 +185640,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+32252 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+33605 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4145 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4160 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32258 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33611 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -179571,7 +185681,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+32286 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+33639 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, @@ -179603,7 +185713,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32296 /* "no such function..." */, libc.VaList(bp+8, zRank)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33649 /* "no such function..." */, libc.VaList(bp+8, zRank)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } @@ -179635,14 +185745,14 @@ func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uin *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+32317 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+33670 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 30700 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32053 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -179708,7 +185818,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32149 /* "recursively defi..." */, 0) + ts+33502 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -179754,7 +185864,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 729 /* "" */ + zText = ts + 744 /* "" */ __14: ; iCol = 0 @@ -179943,7 +186053,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32350 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+33703 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -180080,7 +186190,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+2764 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+2779 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -180117,29 +186227,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+32386 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+33739 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+32397 /* "'delete-all' may..." */, 0) + ts+33750 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+32477 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33830 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+32485 /* "'rebuild' may no..." */, 0) + ts+33838 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+15402 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+15417 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+32541 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33894 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+32547 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33900 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -180213,7 +186323,7 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+15941 /* "delete" */, z)) { + (0 == Xsqlite3_stricmp(tls, ts+15956 /* "delete" */, z)) { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) @@ -180238,12 +186348,12 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32563, /* "cannot %s conten..." */ + ts+33916, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 18755 /* "UPDATE" */ + return ts + 18770 /* "UPDATE" */ } - return ts + 32600 /* "DELETE from" */ + return ts + 33953 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { @@ -180913,7 +187023,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+32612 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+33965 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -181218,7 +187328,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32633 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33986 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 16 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -181235,7 +187345,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 16 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32655 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34008 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -181282,7 +187392,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+32686 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34039 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -181293,7 +187403,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+32699 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+34052 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -181309,7 +187419,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 32790 /* "config" */, ts + 30889 /* "content" */, ts + 23290 /* "data" */, ts + 31240 /* "docsize" */, ts + 10186, /* "idx" */ + ts + 34143 /* "config" */, ts + 32242 /* "content" */, ts + 23305 /* "data" */, ts + 32593 /* "docsize" */, ts + 10201, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -181333,7 +187443,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+32797 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+34150 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -181351,13 +187461,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32797 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34150 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32802 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34155 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -181423,20 +187533,20 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ - ts + 32817, /* "SELECT %s FROM %..." */ - ts + 32885, /* "SELECT %s FROM %..." */ - ts + 32954, /* "SELECT %s FROM %..." */ // LOOKUP + ts + 34170, /* "SELECT %s FROM %..." */ + ts + 34238, /* "SELECT %s FROM %..." */ + ts + 34307, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 32987, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 33026, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 33066, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 33105, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 33146, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 34340, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34379, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34419, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34458, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34499, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 33185, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 34538, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 33227, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 33267, /* "SELECT %s FROM %..." */ // SCAN + ts + 34580, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 34620, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) @@ -181503,7 +187613,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2764 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2779 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -181541,18 +187651,18 @@ func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230 var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33290, /* "DROP TABLE IF EX..." */ + ts+34643, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33394, /* "DROP TABLE IF EX..." */ + ts+34747, /* "DROP TABLE IF EX..." */ libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33432, /* "DROP TABLE IF EX..." */ + ts+34785, /* "DROP TABLE IF EX..." */ libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc @@ -181564,7 +187674,7 @@ func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uin if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33470, /* "ALTER TABLE %Q.'..." */ + ts+34823, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -181576,14 +187686,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23290 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10186 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32790 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23305 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10201 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34143 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31240 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32593 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+30889 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32242 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -181597,17 +187707,17 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn var rc int32 *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+33512, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+34865, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 27905 /* " WITHOUT ROWID" */ + return ts + 27920 /* " WITHOUT ROWID" */ } - return ts + 729 /* "" */ + return ts + 744 /* "" */ }())) if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+33542, /* "fts5: error crea..." */ + ts+34895, /* "fts5: error crea..." */ libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } @@ -181649,27 +187759,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+33586 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34939 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+33609 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34962 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+30889 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32242 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+31240 /* "docsize" */, ts+33615 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+32593 /* "docsize" */, ts+34968 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+32790 /* "config" */, ts+33647 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+34143 /* "config" */, ts+35000 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31386 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32739 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -181906,12 +188016,12 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33664, /* "DELETE FROM %Q.'..." */ + ts+35017, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33714, /* "DELETE FROM %Q.'..." */ + ts+35067, /* "DELETE FROM %Q.'..." */ libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } @@ -181921,7 +188031,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31386 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32739 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -182116,7 +188226,7 @@ func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+33743, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+35096, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -182313,14 +188423,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+30889 /* "content" */, bp+48 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32242 /* "content" */, bp+48 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31240 /* "docsize" */, bp+56 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32593 /* "docsize" */, bp+56 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -182556,9 +188666,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.Xmemcpy(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint64(unsafe.Sizeof(aAsciiTokenChar))) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33775 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35128 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33786 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35139 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -182798,7 +188908,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 33797 /* "L* N* Co" */ + var zCat uintptr = ts + 35150 /* "L* N* Co" */ var i int32 libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Unicode61Tokenizer{}))) @@ -182811,7 +188921,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33806 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35159 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) } } @@ -182822,18 +188932,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33817 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35170 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33775 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35128 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33786 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35139 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33806 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35159 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -183145,7 +189255,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 33835 /* "unicode61" */ + var zBase uintptr = ts + 35188 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -183298,7 +189408,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33845 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35198 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -183306,11 +189416,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33848 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35201 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33853 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35206 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -183318,7 +189428,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33858 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35211 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -183326,7 +189436,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33861 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35214 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -183334,11 +189444,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33864 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35217 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33869 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35222 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -183346,19 +189456,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33874 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35227 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33878 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35231 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33884 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35237 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33889 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35242 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183366,11 +189476,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33893 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35246 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33897 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35250 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -183378,7 +189488,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33900 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35253 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183386,11 +189496,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33904 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35257 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33908 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35261 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183398,7 +189508,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33912 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35265 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183406,7 +189516,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33916 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35269 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183414,7 +189524,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33920 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35273 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183431,24 +189541,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33924 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33904 /* "ate" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35277 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35257 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33927 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33930 /* "ble" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35280 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35283 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33934 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33920 /* "ize" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35287 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35273 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -183464,137 +189574,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+33937 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35290 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33904 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35257 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+33945 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35298 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33952 /* "tion" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35305 /* "tion" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33957 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35310 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33853 /* "ence" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35206 /* "ence" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33962 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35315 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33848 /* "ance" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35201 /* "ance" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33967 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35320 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33920 /* "ize" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35273 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33972 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35325 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14752 /* "log" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14767 /* "log" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33977 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35330 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+33930 /* "ble" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35283 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33981 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35334 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33845 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35198 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33986 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35339 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33889 /* "ent" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35242 /* "ent" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33992 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35345 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+33996 /* "e" */, uint64(1)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35349 /* "e" */, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33998 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35351 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33912 /* "ous" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35265 /* "ous" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34004 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35357 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33920 /* "ize" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35273 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34012 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35365 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33904 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35257 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34018 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35371 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33904 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35257 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34023 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35376 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33845 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35198 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34029 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35382 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33916 /* "ive" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35269 /* "ive" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34037 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35390 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+34045 /* "ful" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35398 /* "ful" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34049 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35402 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33912 /* "ous" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35265 /* "ous" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34057 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35410 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33845 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35198 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34063 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35416 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33916 /* "ive" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35269 /* "ive" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34069 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35422 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33930 /* "ble" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35283 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -183610,16 +189720,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34076 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35429 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33861 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35214 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34081 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35434 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -183627,21 +189737,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34086 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35439 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33861 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35214 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34092 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35445 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33861 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35214 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34045 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35398 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -183649,7 +189759,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34098 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35451 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -183657,9 +189767,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34104 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35457 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33845 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35198 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -183675,12 +189785,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34110 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35463 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34114 /* "ee" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35467 /* "ee" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34117 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35470 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -183689,7 +189799,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34120 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35473 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -183859,7 +189969,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34124 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35477 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -184049,22 +190159,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(128) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 33835 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35188 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 34139 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35492 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 34145 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35498 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 34152 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35505 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -185411,14 +191521,14 @@ func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uint var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+34160 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+35513 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+34164 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35517 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+34168 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35521 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34177 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35530 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) @@ -185465,19 +191575,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(36) *(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azSchema */)) = [3]uintptr{ - ts + 34211, /* "CREATE TABlE voc..." */ - ts + 34251, /* "CREATE TABlE voc..." */ - ts + 34286, /* "CREATE TABlE voc..." */ + ts + 35564, /* "CREATE TABlE voc..." */ + ts + 35604, /* "CREATE TABlE voc..." */ + ts + 35639, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+21599 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+21614 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34329 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35682 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -185629,11 +191739,11 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34362 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35715 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ - ts+34393, /* "SELECT t.%Q FROM..." */ + ts+35746, /* "SELECT t.%Q FROM..." */ libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+72 /* &pStmt */, uintptr(0)) @@ -185657,7 +191767,7 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34444 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35797 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { @@ -185945,7 +192055,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 729 /* "" */ + zCopy = ts + 744 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -186062,7 +192172,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+34470 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+35823 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -186107,7 +192217,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 34480 /* "2021-06-18 18:36..." */ + return ts + 35833 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -187002,5 +193112,5 @@ func init() { *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 128 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: } -var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go index b4f2161e..e390e851 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_arm.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_arm.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1387,6 +1387,9 @@ const ( SEEK_HOLE = 4 SEEK_SET = 0 SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 SF_Aggregate = 0x0000008 SF_All = 0x0000002 SF_ComplexResult = 0x0040000 @@ -1533,6 +1536,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -1689,6 +1703,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -2056,6 +2071,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -3678,7 +3695,7 @@ type X__float128 = float64 /* :47:21 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [18]uintptr{ +var sqlite3azCompileOpt = [19]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=gcc-8.3..." */ @@ -3691,14 +3708,15 @@ var sqlite3azCompileOpt = [18]uintptr{ ts + 130, /* "ENABLE_PREUPDATE..." */ ts + 152, /* "ENABLE_RBU" */ ts + 163, /* "ENABLE_RTREE" */ - ts + 176, /* "ENABLE_SNAPSHOT" */ - ts + 192, /* "ENABLE_STAT4" */ - ts + 205, /* "ENABLE_UNLOCK_NO..." */ - ts + 226, /* "LIKE_DOESNT_MATC..." */ - ts + 250, /* "MUTEX_NOOP" */ - ts + 261, /* "SOUNDEX" */ - ts + 269, /* "SYSTEM_MALLOC" */ - ts + 283, /* "THREADSAFE=1" */ + ts + 176, /* "ENABLE_SESSION" */ + ts + 191, /* "ENABLE_SNAPSHOT" */ + ts + 207, /* "ENABLE_STAT4" */ + ts + 220, /* "ENABLE_UNLOCK_NO..." */ + ts + 241, /* "LIKE_DOESNT_MATC..." */ + ts + 265, /* "MUTEX_NOOP" */ + ts + 276, /* "SOUNDEX" */ + ts + 284, /* "SYSTEM_MALLOC" */ + ts + 298, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -4014,7 +4032,7 @@ type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 296 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 311 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -6556,6 +6574,494 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + FpFilterCtx uintptr + FxTableFilter uintptr + _ [4]byte + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -6605,10 +7111,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -11035,7 +11540,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 303 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 318 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -12182,7 +12687,7 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+310 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+325 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 @@ -12219,13 +12724,13 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+318 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+333 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+326 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+341 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -12344,7 +12849,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+330 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+345 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -12425,7 +12930,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+342 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+357 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -12607,7 +13112,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+48 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 96 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) if osLocaltime(tls, bp+96 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+346 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+361 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -12642,12 +13147,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 369 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 376 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 383 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 388 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 392 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 398 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 384 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 391 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 398 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 403 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 407 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 413 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -12686,7 +13191,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+403 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+418 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -12700,7 +13205,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+413 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+428 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -12709,7 +13214,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+423 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+438 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -12734,7 +13239,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+427 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+442 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -12759,7 +13264,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+436 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+451 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -12773,14 +13278,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+392 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+407 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+398 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+413 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+388 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+403 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -13001,7 +13506,7 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // var zBuf [100]int8 at bp+96, 100 computeYMD_HMS(tls, bp+48 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+446, /* "%04d-%02d-%02d %..." */ + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+461, /* "%04d-%02d-%02d %..." */ libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } @@ -13020,7 +13525,7 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeHMS(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+476 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13038,7 +13543,7 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeYMD(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+506 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13165,7 +13670,7 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (Size_t(2)) break fallthrough @@ -13175,14 +13680,14 @@ __3: if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+511 /* "%06.3f" */, libc.VaList(bp+8, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+526 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (Size_t(2)) break fallthrough @@ -13200,10 +13705,10 @@ __3: if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (Size_t(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+518 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+533 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (Size_t(3)) } break @@ -13212,19 +13717,19 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+523 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+538 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (Size_t(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (Size_t(2)) break fallthrough @@ -13238,7 +13743,7 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (Size_t(2)) break fallthrough @@ -13251,7 +13756,7 @@ __3: fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+529 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+544 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -13308,14 +13813,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 534 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 544 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 554 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 563 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 572 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 585 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 603 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 559 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 564 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 569 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 578 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 587 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 600 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 618 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -13892,7 +14397,7 @@ func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:1 p += 8 } else { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+616 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+631 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -13943,7 +14448,7 @@ func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* } else { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+654, /* "failed memory re..." */ + ts+669, /* "failed memory re..." */ libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) } return p @@ -15129,8 +15634,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 690 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 723 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 705 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 738 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -15384,7 +15889,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+730 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+745 /* "%" */, 1) goto __5 __11: ; @@ -15967,7 +16472,7 @@ __125: if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 732 /* "NaN" */ + bufpt = ts + 747 /* "NaN" */ length = 3 goto __58 __127: @@ -16027,7 +16532,7 @@ __138: } bufpt = bp + 8 /* &buf[0] */ *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix - libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+736 /* "Inf" */, uint32(4)) + libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+751 /* "Inf" */, uint32(4)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: @@ -16384,7 +16889,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 740 /* "" */ + bufpt = ts + 755 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -16513,9 +17018,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 741 /* "NULL" */ + return ts + 756 /* "NULL" */ } - return ts + 746 /* "(NULL)" */ + return ts + 761 /* "(NULL)" */ }() __220: ; @@ -16650,7 +17155,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+768 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -16665,7 +17170,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+755 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+770 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -16728,7 +17233,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 767 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 782 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -19042,7 +19547,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 776 /* "9223372036854775..." */ + var pow63 uintptr = ts + 791 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -19692,7 +20197,7 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+795, /* "API call with %s..." */ + ts+810, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -19711,14 +20216,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+741 /* "NULL" */) + logBadConnection(tls, ts+756 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+840 /* "unopened" */) + logBadConnection(tls, ts+855 /* "unopened" */) } return 0 } else { @@ -19732,7 +20237,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+849 /* "invalid" */) + logBadConnection(tls, ts+864 /* "invalid" */) return 0 } else { return 1 @@ -20260,186 +20765,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 857, /* "Savepoint" */ - /* 1 */ ts + 867, /* "AutoCommit" */ - /* 2 */ ts + 878, /* "Transaction" */ - /* 3 */ ts + 890, /* "SorterNext" */ - /* 4 */ ts + 901, /* "Prev" */ - /* 5 */ ts + 906, /* "Next" */ - /* 6 */ ts + 911, /* "Checkpoint" */ - /* 7 */ ts + 922, /* "JournalMode" */ - /* 8 */ ts + 934, /* "Vacuum" */ - /* 9 */ ts + 941, /* "VFilter" */ - /* 10 */ ts + 949, /* "VUpdate" */ - /* 11 */ ts + 957, /* "Goto" */ - /* 12 */ ts + 962, /* "Gosub" */ - /* 13 */ ts + 968, /* "InitCoroutine" */ - /* 14 */ ts + 982, /* "Yield" */ - /* 15 */ ts + 988, /* "MustBeInt" */ - /* 16 */ ts + 998, /* "Jump" */ - /* 17 */ ts + 1003, /* "Once" */ - /* 18 */ ts + 1008, /* "If" */ - /* 19 */ ts + 1011, /* "Not" */ - /* 20 */ ts + 1015, /* "IfNot" */ - /* 21 */ ts + 1021, /* "IfNullRow" */ - /* 22 */ ts + 1031, /* "SeekLT" */ - /* 23 */ ts + 1038, /* "SeekLE" */ - /* 24 */ ts + 1045, /* "SeekGE" */ - /* 25 */ ts + 1052, /* "SeekGT" */ - /* 26 */ ts + 1059, /* "IfNotOpen" */ - /* 27 */ ts + 1069, /* "IfNoHope" */ - /* 28 */ ts + 1078, /* "NoConflict" */ - /* 29 */ ts + 1089, /* "NotFound" */ - /* 30 */ ts + 1098, /* "Found" */ - /* 31 */ ts + 1104, /* "SeekRowid" */ - /* 32 */ ts + 1114, /* "NotExists" */ - /* 33 */ ts + 1124, /* "Last" */ - /* 34 */ ts + 1129, /* "IfSmaller" */ - /* 35 */ ts + 1139, /* "SorterSort" */ - /* 36 */ ts + 1150, /* "Sort" */ - /* 37 */ ts + 1155, /* "Rewind" */ - /* 38 */ ts + 1162, /* "IdxLE" */ - /* 39 */ ts + 1168, /* "IdxGT" */ - /* 40 */ ts + 1174, /* "IdxLT" */ - /* 41 */ ts + 1180, /* "IdxGE" */ - /* 42 */ ts + 1186, /* "RowSetRead" */ - /* 43 */ ts + 1197, /* "Or" */ - /* 44 */ ts + 1200, /* "And" */ - /* 45 */ ts + 1204, /* "RowSetTest" */ - /* 46 */ ts + 1215, /* "Program" */ - /* 47 */ ts + 1223, /* "FkIfZero" */ - /* 48 */ ts + 1232, /* "IfPos" */ - /* 49 */ ts + 1238, /* "IfNotZero" */ - /* 50 */ ts + 1248, /* "IsNull" */ - /* 51 */ ts + 1255, /* "NotNull" */ - /* 52 */ ts + 1263, /* "Ne" */ - /* 53 */ ts + 1266, /* "Eq" */ - /* 54 */ ts + 1269, /* "Gt" */ - /* 55 */ ts + 1272, /* "Le" */ - /* 56 */ ts + 1275, /* "Lt" */ - /* 57 */ ts + 1278, /* "Ge" */ - /* 58 */ ts + 1281, /* "ElseEq" */ - /* 59 */ ts + 1288, /* "DecrJumpZero" */ - /* 60 */ ts + 1301, /* "IncrVacuum" */ - /* 61 */ ts + 1312, /* "VNext" */ - /* 62 */ ts + 1318, /* "Init" */ - /* 63 */ ts + 1323, /* "PureFunc" */ - /* 64 */ ts + 1332, /* "Function" */ - /* 65 */ ts + 1341, /* "Return" */ - /* 66 */ ts + 1348, /* "EndCoroutine" */ - /* 67 */ ts + 1361, /* "HaltIfNull" */ - /* 68 */ ts + 1372, /* "Halt" */ - /* 69 */ ts + 1377, /* "Integer" */ - /* 70 */ ts + 1385, /* "Int64" */ - /* 71 */ ts + 1391, /* "String" */ - /* 72 */ ts + 1398, /* "Null" */ - /* 73 */ ts + 1403, /* "SoftNull" */ - /* 74 */ ts + 1412, /* "Blob" */ - /* 75 */ ts + 1417, /* "Variable" */ - /* 76 */ ts + 1426, /* "Move" */ - /* 77 */ ts + 1431, /* "Copy" */ - /* 78 */ ts + 1436, /* "SCopy" */ - /* 79 */ ts + 1442, /* "IntCopy" */ - /* 80 */ ts + 1450, /* "ChngCntRow" */ - /* 81 */ ts + 1461, /* "ResultRow" */ - /* 82 */ ts + 1471, /* "CollSeq" */ - /* 83 */ ts + 1479, /* "AddImm" */ - /* 84 */ ts + 1486, /* "RealAffinity" */ - /* 85 */ ts + 1499, /* "Cast" */ - /* 86 */ ts + 1504, /* "Permutation" */ - /* 87 */ ts + 1516, /* "Compare" */ - /* 88 */ ts + 1524, /* "IsTrue" */ - /* 89 */ ts + 1531, /* "ZeroOrNull" */ - /* 90 */ ts + 1542, /* "Offset" */ - /* 91 */ ts + 1549, /* "Column" */ - /* 92 */ ts + 1556, /* "Affinity" */ - /* 93 */ ts + 1565, /* "MakeRecord" */ - /* 94 */ ts + 1576, /* "Count" */ - /* 95 */ ts + 1582, /* "ReadCookie" */ - /* 96 */ ts + 1593, /* "SetCookie" */ - /* 97 */ ts + 1603, /* "ReopenIdx" */ - /* 98 */ ts + 1613, /* "OpenRead" */ - /* 99 */ ts + 1622, /* "OpenWrite" */ - /* 100 */ ts + 1632, /* "OpenDup" */ - /* 101 */ ts + 1640, /* "OpenAutoindex" */ - /* 102 */ ts + 1654, /* "BitAnd" */ - /* 103 */ ts + 1661, /* "BitOr" */ - /* 104 */ ts + 1667, /* "ShiftLeft" */ - /* 105 */ ts + 1677, /* "ShiftRight" */ - /* 106 */ ts + 1688, /* "Add" */ - /* 107 */ ts + 1692, /* "Subtract" */ - /* 108 */ ts + 1701, /* "Multiply" */ - /* 109 */ ts + 1710, /* "Divide" */ - /* 110 */ ts + 1717, /* "Remainder" */ - /* 111 */ ts + 1727, /* "Concat" */ - /* 112 */ ts + 1734, /* "OpenEphemeral" */ - /* 113 */ ts + 1748, /* "BitNot" */ - /* 114 */ ts + 1755, /* "SorterOpen" */ - /* 115 */ ts + 1766, /* "SequenceTest" */ - /* 116 */ ts + 1779, /* "String8" */ - /* 117 */ ts + 1787, /* "OpenPseudo" */ - /* 118 */ ts + 1798, /* "Close" */ - /* 119 */ ts + 1804, /* "ColumnsUsed" */ - /* 120 */ ts + 1816, /* "SeekScan" */ - /* 121 */ ts + 1825, /* "SeekHit" */ - /* 122 */ ts + 1833, /* "Sequence" */ - /* 123 */ ts + 1842, /* "NewRowid" */ - /* 124 */ ts + 1851, /* "Insert" */ - /* 125 */ ts + 1858, /* "RowCell" */ - /* 126 */ ts + 1866, /* "Delete" */ - /* 127 */ ts + 1873, /* "ResetCount" */ - /* 128 */ ts + 1884, /* "SorterCompare" */ - /* 129 */ ts + 1898, /* "SorterData" */ - /* 130 */ ts + 1909, /* "RowData" */ - /* 131 */ ts + 1917, /* "Rowid" */ - /* 132 */ ts + 1923, /* "NullRow" */ - /* 133 */ ts + 1931, /* "SeekEnd" */ - /* 134 */ ts + 1939, /* "IdxInsert" */ - /* 135 */ ts + 1949, /* "SorterInsert" */ - /* 136 */ ts + 1962, /* "IdxDelete" */ - /* 137 */ ts + 1972, /* "DeferredSeek" */ - /* 138 */ ts + 1985, /* "IdxRowid" */ - /* 139 */ ts + 1994, /* "FinishSeek" */ - /* 140 */ ts + 2005, /* "Destroy" */ - /* 141 */ ts + 2013, /* "Clear" */ - /* 142 */ ts + 2019, /* "ResetSorter" */ - /* 143 */ ts + 2031, /* "CreateBtree" */ - /* 144 */ ts + 2043, /* "SqlExec" */ - /* 145 */ ts + 2051, /* "ParseSchema" */ - /* 146 */ ts + 2063, /* "LoadAnalysis" */ - /* 147 */ ts + 2076, /* "DropTable" */ - /* 148 */ ts + 2086, /* "DropIndex" */ - /* 149 */ ts + 2096, /* "DropTrigger" */ - /* 150 */ ts + 2108, /* "IntegrityCk" */ - /* 151 */ ts + 2120, /* "RowSetAdd" */ - /* 152 */ ts + 2130, /* "Real" */ - /* 153 */ ts + 2135, /* "Param" */ - /* 154 */ ts + 2141, /* "FkCounter" */ - /* 155 */ ts + 2151, /* "MemMax" */ - /* 156 */ ts + 2158, /* "OffsetLimit" */ - /* 157 */ ts + 2170, /* "AggInverse" */ - /* 158 */ ts + 2181, /* "AggStep" */ - /* 159 */ ts + 2189, /* "AggStep1" */ - /* 160 */ ts + 2198, /* "AggValue" */ - /* 161 */ ts + 2207, /* "AggFinal" */ - /* 162 */ ts + 2216, /* "Expire" */ - /* 163 */ ts + 2223, /* "CursorLock" */ - /* 164 */ ts + 2234, /* "CursorUnlock" */ - /* 165 */ ts + 2247, /* "TableLock" */ - /* 166 */ ts + 2257, /* "VBegin" */ - /* 167 */ ts + 2264, /* "VCreate" */ - /* 168 */ ts + 2272, /* "VDestroy" */ - /* 169 */ ts + 2281, /* "VOpen" */ - /* 170 */ ts + 2287, /* "VColumn" */ - /* 171 */ ts + 2295, /* "VRename" */ - /* 172 */ ts + 2303, /* "Pagecount" */ - /* 173 */ ts + 2313, /* "MaxPgcnt" */ - /* 174 */ ts + 2322, /* "Trace" */ - /* 175 */ ts + 2328, /* "CursorHint" */ - /* 176 */ ts + 2339, /* "ReleaseReg" */ - /* 177 */ ts + 2350, /* "Noop" */ - /* 178 */ ts + 2355, /* "Explain" */ - /* 179 */ ts + 2363, /* "Abortable" */ + /* 0 */ ts + 872, /* "Savepoint" */ + /* 1 */ ts + 882, /* "AutoCommit" */ + /* 2 */ ts + 893, /* "Transaction" */ + /* 3 */ ts + 905, /* "SorterNext" */ + /* 4 */ ts + 916, /* "Prev" */ + /* 5 */ ts + 921, /* "Next" */ + /* 6 */ ts + 926, /* "Checkpoint" */ + /* 7 */ ts + 937, /* "JournalMode" */ + /* 8 */ ts + 949, /* "Vacuum" */ + /* 9 */ ts + 956, /* "VFilter" */ + /* 10 */ ts + 964, /* "VUpdate" */ + /* 11 */ ts + 972, /* "Goto" */ + /* 12 */ ts + 977, /* "Gosub" */ + /* 13 */ ts + 983, /* "InitCoroutine" */ + /* 14 */ ts + 997, /* "Yield" */ + /* 15 */ ts + 1003, /* "MustBeInt" */ + /* 16 */ ts + 1013, /* "Jump" */ + /* 17 */ ts + 1018, /* "Once" */ + /* 18 */ ts + 1023, /* "If" */ + /* 19 */ ts + 1026, /* "Not" */ + /* 20 */ ts + 1030, /* "IfNot" */ + /* 21 */ ts + 1036, /* "IfNullRow" */ + /* 22 */ ts + 1046, /* "SeekLT" */ + /* 23 */ ts + 1053, /* "SeekLE" */ + /* 24 */ ts + 1060, /* "SeekGE" */ + /* 25 */ ts + 1067, /* "SeekGT" */ + /* 26 */ ts + 1074, /* "IfNotOpen" */ + /* 27 */ ts + 1084, /* "IfNoHope" */ + /* 28 */ ts + 1093, /* "NoConflict" */ + /* 29 */ ts + 1104, /* "NotFound" */ + /* 30 */ ts + 1113, /* "Found" */ + /* 31 */ ts + 1119, /* "SeekRowid" */ + /* 32 */ ts + 1129, /* "NotExists" */ + /* 33 */ ts + 1139, /* "Last" */ + /* 34 */ ts + 1144, /* "IfSmaller" */ + /* 35 */ ts + 1154, /* "SorterSort" */ + /* 36 */ ts + 1165, /* "Sort" */ + /* 37 */ ts + 1170, /* "Rewind" */ + /* 38 */ ts + 1177, /* "IdxLE" */ + /* 39 */ ts + 1183, /* "IdxGT" */ + /* 40 */ ts + 1189, /* "IdxLT" */ + /* 41 */ ts + 1195, /* "IdxGE" */ + /* 42 */ ts + 1201, /* "RowSetRead" */ + /* 43 */ ts + 1212, /* "Or" */ + /* 44 */ ts + 1215, /* "And" */ + /* 45 */ ts + 1219, /* "RowSetTest" */ + /* 46 */ ts + 1230, /* "Program" */ + /* 47 */ ts + 1238, /* "FkIfZero" */ + /* 48 */ ts + 1247, /* "IfPos" */ + /* 49 */ ts + 1253, /* "IfNotZero" */ + /* 50 */ ts + 1263, /* "IsNull" */ + /* 51 */ ts + 1270, /* "NotNull" */ + /* 52 */ ts + 1278, /* "Ne" */ + /* 53 */ ts + 1281, /* "Eq" */ + /* 54 */ ts + 1284, /* "Gt" */ + /* 55 */ ts + 1287, /* "Le" */ + /* 56 */ ts + 1290, /* "Lt" */ + /* 57 */ ts + 1293, /* "Ge" */ + /* 58 */ ts + 1296, /* "ElseEq" */ + /* 59 */ ts + 1303, /* "DecrJumpZero" */ + /* 60 */ ts + 1316, /* "IncrVacuum" */ + /* 61 */ ts + 1327, /* "VNext" */ + /* 62 */ ts + 1333, /* "Init" */ + /* 63 */ ts + 1338, /* "PureFunc" */ + /* 64 */ ts + 1347, /* "Function" */ + /* 65 */ ts + 1356, /* "Return" */ + /* 66 */ ts + 1363, /* "EndCoroutine" */ + /* 67 */ ts + 1376, /* "HaltIfNull" */ + /* 68 */ ts + 1387, /* "Halt" */ + /* 69 */ ts + 1392, /* "Integer" */ + /* 70 */ ts + 1400, /* "Int64" */ + /* 71 */ ts + 1406, /* "String" */ + /* 72 */ ts + 1413, /* "Null" */ + /* 73 */ ts + 1418, /* "SoftNull" */ + /* 74 */ ts + 1427, /* "Blob" */ + /* 75 */ ts + 1432, /* "Variable" */ + /* 76 */ ts + 1441, /* "Move" */ + /* 77 */ ts + 1446, /* "Copy" */ + /* 78 */ ts + 1451, /* "SCopy" */ + /* 79 */ ts + 1457, /* "IntCopy" */ + /* 80 */ ts + 1465, /* "ChngCntRow" */ + /* 81 */ ts + 1476, /* "ResultRow" */ + /* 82 */ ts + 1486, /* "CollSeq" */ + /* 83 */ ts + 1494, /* "AddImm" */ + /* 84 */ ts + 1501, /* "RealAffinity" */ + /* 85 */ ts + 1514, /* "Cast" */ + /* 86 */ ts + 1519, /* "Permutation" */ + /* 87 */ ts + 1531, /* "Compare" */ + /* 88 */ ts + 1539, /* "IsTrue" */ + /* 89 */ ts + 1546, /* "ZeroOrNull" */ + /* 90 */ ts + 1557, /* "Offset" */ + /* 91 */ ts + 1564, /* "Column" */ + /* 92 */ ts + 1571, /* "Affinity" */ + /* 93 */ ts + 1580, /* "MakeRecord" */ + /* 94 */ ts + 1591, /* "Count" */ + /* 95 */ ts + 1597, /* "ReadCookie" */ + /* 96 */ ts + 1608, /* "SetCookie" */ + /* 97 */ ts + 1618, /* "ReopenIdx" */ + /* 98 */ ts + 1628, /* "OpenRead" */ + /* 99 */ ts + 1637, /* "OpenWrite" */ + /* 100 */ ts + 1647, /* "OpenDup" */ + /* 101 */ ts + 1655, /* "OpenAutoindex" */ + /* 102 */ ts + 1669, /* "BitAnd" */ + /* 103 */ ts + 1676, /* "BitOr" */ + /* 104 */ ts + 1682, /* "ShiftLeft" */ + /* 105 */ ts + 1692, /* "ShiftRight" */ + /* 106 */ ts + 1703, /* "Add" */ + /* 107 */ ts + 1707, /* "Subtract" */ + /* 108 */ ts + 1716, /* "Multiply" */ + /* 109 */ ts + 1725, /* "Divide" */ + /* 110 */ ts + 1732, /* "Remainder" */ + /* 111 */ ts + 1742, /* "Concat" */ + /* 112 */ ts + 1749, /* "OpenEphemeral" */ + /* 113 */ ts + 1763, /* "BitNot" */ + /* 114 */ ts + 1770, /* "SorterOpen" */ + /* 115 */ ts + 1781, /* "SequenceTest" */ + /* 116 */ ts + 1794, /* "String8" */ + /* 117 */ ts + 1802, /* "OpenPseudo" */ + /* 118 */ ts + 1813, /* "Close" */ + /* 119 */ ts + 1819, /* "ColumnsUsed" */ + /* 120 */ ts + 1831, /* "SeekScan" */ + /* 121 */ ts + 1840, /* "SeekHit" */ + /* 122 */ ts + 1848, /* "Sequence" */ + /* 123 */ ts + 1857, /* "NewRowid" */ + /* 124 */ ts + 1866, /* "Insert" */ + /* 125 */ ts + 1873, /* "RowCell" */ + /* 126 */ ts + 1881, /* "Delete" */ + /* 127 */ ts + 1888, /* "ResetCount" */ + /* 128 */ ts + 1899, /* "SorterCompare" */ + /* 129 */ ts + 1913, /* "SorterData" */ + /* 130 */ ts + 1924, /* "RowData" */ + /* 131 */ ts + 1932, /* "Rowid" */ + /* 132 */ ts + 1938, /* "NullRow" */ + /* 133 */ ts + 1946, /* "SeekEnd" */ + /* 134 */ ts + 1954, /* "IdxInsert" */ + /* 135 */ ts + 1964, /* "SorterInsert" */ + /* 136 */ ts + 1977, /* "IdxDelete" */ + /* 137 */ ts + 1987, /* "DeferredSeek" */ + /* 138 */ ts + 2000, /* "IdxRowid" */ + /* 139 */ ts + 2009, /* "FinishSeek" */ + /* 140 */ ts + 2020, /* "Destroy" */ + /* 141 */ ts + 2028, /* "Clear" */ + /* 142 */ ts + 2034, /* "ResetSorter" */ + /* 143 */ ts + 2046, /* "CreateBtree" */ + /* 144 */ ts + 2058, /* "SqlExec" */ + /* 145 */ ts + 2066, /* "ParseSchema" */ + /* 146 */ ts + 2078, /* "LoadAnalysis" */ + /* 147 */ ts + 2091, /* "DropTable" */ + /* 148 */ ts + 2101, /* "DropIndex" */ + /* 149 */ ts + 2111, /* "DropTrigger" */ + /* 150 */ ts + 2123, /* "IntegrityCk" */ + /* 151 */ ts + 2135, /* "RowSetAdd" */ + /* 152 */ ts + 2145, /* "Real" */ + /* 153 */ ts + 2150, /* "Param" */ + /* 154 */ ts + 2156, /* "FkCounter" */ + /* 155 */ ts + 2166, /* "MemMax" */ + /* 156 */ ts + 2173, /* "OffsetLimit" */ + /* 157 */ ts + 2185, /* "AggInverse" */ + /* 158 */ ts + 2196, /* "AggStep" */ + /* 159 */ ts + 2204, /* "AggStep1" */ + /* 160 */ ts + 2213, /* "AggValue" */ + /* 161 */ ts + 2222, /* "AggFinal" */ + /* 162 */ ts + 2231, /* "Expire" */ + /* 163 */ ts + 2238, /* "CursorLock" */ + /* 164 */ ts + 2249, /* "CursorUnlock" */ + /* 165 */ ts + 2262, /* "TableLock" */ + /* 166 */ ts + 2272, /* "VBegin" */ + /* 167 */ ts + 2279, /* "VCreate" */ + /* 168 */ ts + 2287, /* "VDestroy" */ + /* 169 */ ts + 2296, /* "VOpen" */ + /* 170 */ ts + 2302, /* "VColumn" */ + /* 171 */ ts + 2310, /* "VRename" */ + /* 172 */ ts + 2318, /* "Pagecount" */ + /* 173 */ ts + 2328, /* "MaxPgcnt" */ + /* 174 */ ts + 2337, /* "Trace" */ + /* 175 */ ts + 2343, /* "CursorHint" */ + /* 176 */ ts + 2354, /* "ReleaseReg" */ + /* 177 */ ts + 2365, /* "Noop" */ + /* 178 */ ts + 2370, /* "Explain" */ + /* 179 */ ts + 2378, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -22064,67 +22569,67 @@ type unix_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [29]unix_syscall{ - {FzName: ts + 2373 /* "open" */, FpCurrent: 0}, + {FzName: ts + 2388 /* "open" */, FpCurrent: 0}, - {FzName: ts + 2378 /* "close" */, FpCurrent: 0}, + {FzName: ts + 2393 /* "close" */, FpCurrent: 0}, - {FzName: ts + 2384 /* "access" */, FpCurrent: 0}, + {FzName: ts + 2399 /* "access" */, FpCurrent: 0}, - {FzName: ts + 2391 /* "getcwd" */, FpCurrent: 0}, + {FzName: ts + 2406 /* "getcwd" */, FpCurrent: 0}, - {FzName: ts + 2398 /* "stat" */, FpCurrent: 0}, + {FzName: ts + 2413 /* "stat" */, FpCurrent: 0}, // The DJGPP compiler environment looks mostly like Unix, but it // lacks the fcntl() system call. So redefine fcntl() to be something // that always succeeds. This means that locking does not occur under // DJGPP. But it is DOS - what did you expect? - {FzName: ts + 2403 /* "fstat" */, FpCurrent: 0}, + {FzName: ts + 2418 /* "fstat" */, FpCurrent: 0}, - {FzName: ts + 2409 /* "ftruncate" */, FpCurrent: 0}, + {FzName: ts + 2424 /* "ftruncate" */, FpCurrent: 0}, - {FzName: ts + 2419 /* "fcntl" */, FpCurrent: 0}, + {FzName: ts + 2434 /* "fcntl" */, FpCurrent: 0}, - {FzName: ts + 2425 /* "read" */, FpCurrent: 0}, + {FzName: ts + 2440 /* "read" */, FpCurrent: 0}, - {FzName: ts + 2430 /* "pread" */}, + {FzName: ts + 2445 /* "pread" */}, - {FzName: ts + 2436 /* "pread64" */}, + {FzName: ts + 2451 /* "pread64" */}, - {FzName: ts + 2444 /* "write" */, FpCurrent: 0}, + {FzName: ts + 2459 /* "write" */, FpCurrent: 0}, - {FzName: ts + 2450 /* "pwrite" */}, + {FzName: ts + 2465 /* "pwrite" */}, - {FzName: ts + 2457 /* "pwrite64" */}, + {FzName: ts + 2472 /* "pwrite64" */}, - {FzName: ts + 2466 /* "fchmod" */, FpCurrent: 0}, + {FzName: ts + 2481 /* "fchmod" */, FpCurrent: 0}, - {FzName: ts + 2473 /* "fallocate" */}, + {FzName: ts + 2488 /* "fallocate" */}, - {FzName: ts + 2483 /* "unlink" */, FpCurrent: 0}, + {FzName: ts + 2498 /* "unlink" */, FpCurrent: 0}, - {FzName: ts + 2490 /* "openDirectory" */, FpCurrent: 0}, + {FzName: ts + 2505 /* "openDirectory" */, FpCurrent: 0}, - {FzName: ts + 2504 /* "mkdir" */, FpCurrent: 0}, + {FzName: ts + 2519 /* "mkdir" */, FpCurrent: 0}, - {FzName: ts + 2510 /* "rmdir" */, FpCurrent: 0}, + {FzName: ts + 2525 /* "rmdir" */, FpCurrent: 0}, - {FzName: ts + 2516 /* "fchown" */, FpCurrent: 0}, + {FzName: ts + 2531 /* "fchown" */, FpCurrent: 0}, - {FzName: ts + 2523 /* "geteuid" */, FpCurrent: 0}, + {FzName: ts + 2538 /* "geteuid" */, FpCurrent: 0}, - {FzName: ts + 2531 /* "mmap" */, FpCurrent: 0}, + {FzName: ts + 2546 /* "mmap" */, FpCurrent: 0}, - {FzName: ts + 2536 /* "munmap" */, FpCurrent: 0}, + {FzName: ts + 2551 /* "munmap" */, FpCurrent: 0}, - {FzName: ts + 2543 /* "mremap" */, FpCurrent: 0}, + {FzName: ts + 2558 /* "mremap" */, FpCurrent: 0}, - {FzName: ts + 2550 /* "getpagesize" */, FpCurrent: 0}, + {FzName: ts + 2565 /* "getpagesize" */, FpCurrent: 0}, - {FzName: ts + 2562 /* "readlink" */, FpCurrent: 0}, + {FzName: ts + 2577 /* "readlink" */, FpCurrent: 0}, - {FzName: ts + 2571 /* "lstat" */, FpCurrent: 0}, + {FzName: ts + 2586 /* "lstat" */, FpCurrent: 0}, - {FzName: ts + 2577 /* "ioctl" */}, + {FzName: ts + 2592 /* "ioctl" */}, } /* sqlite3.c:34446:3 */ // End of the overrideable system calls @@ -22258,9 +22763,9 @@ func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3 } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*12 + 4 /* &.pCurrent */))))(tls, fd) Xsqlite3_log(tls, SQLITE_WARNING, - ts+2583 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + ts+2598 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) fd = -1 - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4 /* &.pCurrent */))))(tls, ts+2626 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4 /* &.pCurrent */))))(tls, ts+2641 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { break } } @@ -22518,13 +23023,13 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // the strerror() function to obtain the human-readable error message // equivalent to errno. Otherwise, use strerror_r(). // This is a threadsafe build, but strerror_r() is not available. - zErr = ts + 740 /* "" */ + zErr = ts + 755 /* "" */ if zPath == uintptr(0) { - zPath = ts + 740 /* "" */ + zPath = ts + 755 /* "" */ } Xsqlite3_log(tls, errcode, - ts+2636, /* "os_unix.c:%d: (%..." */ + ts+2651, /* "os_unix.c:%d: (%..." */ libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) return errcode @@ -22543,7 +23048,7 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // and move on. func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*12 + 4 /* &.pCurrent */))))(tls, h) != 0 { - unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2378, /* "close" */ + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2393, /* "close" */ func() uintptr { if pFile != 0 { return (*UnixFile)(unsafe.Pointer(pFile)).FzPath @@ -22702,19 +23207,19 @@ func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*12 + 4 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) if rc != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2667 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2682 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink == X__nlink_t(0) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2691 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2706 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink > X__nlink_t(1) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2720 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2735 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2747 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2762 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -23828,7 +24333,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql var fd int32 = -1 // var zDirname [513]int8 at bp+8, 513 - Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2775 /* "%s" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2790 /* "%s" */, libc.VaList(bp, zFilename)) for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { } if ii > 0 { @@ -23847,7 +24352,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql if fd >= 0 { return SQLITE_OK } - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2490 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2505 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) } // Make sure all writes to a particular file are committed to disk. @@ -23882,7 +24387,7 @@ func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793 if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2778 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2793 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) } // Also fsync the directory containing the file if the DIRSYNC flag @@ -23920,7 +24425,7 @@ func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:378 rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2409 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2424 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) } else { // If the file was just truncated to a size smaller than the currently @@ -23999,7 +24504,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if iWrite >= nSize { iWrite = (nSize - int64(1)) } - nWrite = seekAndWrite(tls, pFile, iWrite, ts+740 /* "" */, 1) + nWrite = seekAndWrite(tls, pFile, iWrite, ts+755 /* "" */, 1) if nWrite != 1 { return (SQLITE_IOERR | (int32(3) << 8)) } @@ -24012,7 +24517,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2409 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2424 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) } } @@ -24086,7 +24591,7 @@ func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK } @@ -24372,7 +24877,7 @@ func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 // help detect if a -shm file truncation is legitimate or is the work // or a rogue process. if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2409 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2424 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) } } } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { @@ -24478,7 +24983,7 @@ __4: ; libc.Xmemset(tls, pShmNode, 0, (uint32(unsafe.Sizeof(unixShmNode{})) + uint32(nShmFilename))) zShm = libc.AssignPtrUintptr(pShmNode+8 /* &.zFilename */, (pShmNode + 1*68)) - Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2789 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2804 /* "%s-shm" */, libc.VaList(bp, zBasePath)) (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode @@ -24500,7 +25005,7 @@ __5: if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { goto __7 } - if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2796 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2811 /* "readonly_shm" */, 0)) { goto __8 } (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | 0100000), @@ -24515,7 +25020,7 @@ __8: if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { goto __10 } - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2373 /* "open" */, zShm, 38716) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2388 /* "open" */, zShm, 38716) goto shm_open_err __10: ; @@ -24682,11 +25187,11 @@ __11: goto __13 } *(*int32)(unsafe.Pointer(bp + 104 /* x */)) = 0 - if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+740 /* "" */, 1, bp+104 /* &x */) != 1) { + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+755 /* "" */, 1, bp+104 /* &x */) != 1) { goto __14 } zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2444 /* "write" */, zFile, 38860) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2459 /* "write" */, zFile, 38860) goto shmpage_out __14: ; @@ -24734,7 +25239,7 @@ __16: if !(pMem == (libc.UintptrFromInt32(-1))) { goto __20 } - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2531 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2546 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) goto shmpage_out __20: ; @@ -24993,7 +25498,7 @@ func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ // continue accessing the database using the xRead() and xWrite() // methods. func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ - var zErr uintptr = ts + 2531 /* "mmap" */ + var zErr uintptr = ts + 2546 /* "mmap" */ var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes @@ -25010,7 +25515,7 @@ func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13 } pNew = (*(*func(*libc.TLS, uintptr, Size_t, Size_t, int32, uintptr) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 24*12 + 4 /* &.pCurrent */))))(tls, pOrig, uint32(nReuse), uint32(nNew), MREMAP_MAYMOVE, 0) - zErr = ts + 2543 /* "mremap" */ + zErr = ts + 2558 /* "mremap" */ // The attempt to extend the existing mapping failed. Free it. if (pNew == (libc.UintptrFromInt32(-1))) || (pNew == uintptr(0)) { @@ -25246,10 +25751,10 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename } return uintptr(0) }(), - ts+2809 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + ts+2824 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { *(*uint16)(unsafe.Pointer(pNew + 18 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2814 /* "unix-excl" */) == 0 { + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2829 /* "unix-excl" */) == 0 { *(*uint16)(unsafe.Pointer(pNew + 18 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) } @@ -25295,7 +25800,7 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename if zLockFile == uintptr(0) { rc = SQLITE_NOMEM } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2824 /* "%s.lock" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2839 /* "%s.lock" */, libc.VaList(bp, zFilename)) } (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -25325,10 +25830,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var zDir uintptr = Xsqlite3_temp_directory if !(int32(azDirs[0]) != 0) { - azDirs[0] = libc.Xgetenv(tls, ts+2832 /* "SQLITE_TMPDIR" */) + azDirs[0] = libc.Xgetenv(tls, ts+2847 /* "SQLITE_TMPDIR" */) } if !(int32(azDirs[1]) != 0) { - azDirs[1] = libc.Xgetenv(tls, ts+2846 /* "TMPDIR" */) + azDirs[1] = libc.Xgetenv(tls, ts+2861 /* "TMPDIR" */) } for 1 != 0 { if (((zDir != uintptr(0)) && @@ -25348,10 +25853,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var azDirs = [6]uintptr{ uintptr(0), uintptr(0), - ts + 2853, /* "/var/tmp" */ - ts + 2862, /* "/usr/tmp" */ - ts + 2871, /* "/tmp" */ - ts + 753, /* "." */ + ts + 2868, /* "/var/tmp" */ + ts + 2877, /* "/usr/tmp" */ + ts + 2886, /* "/tmp" */ + ts + 768, /* "." */ } /* sqlite3.c:39857:21 */ // Create a temporary file name in zBuf. zBuf must be allocated @@ -25379,7 +25884,7 @@ func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2876, /* "%s/etilqs_%llx%c" */ + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2891, /* "%s/etilqs_%llx%c" */ libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { return SQLITE_ERROR @@ -25535,7 +26040,7 @@ func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr // filename, check for the "modeof" parameter. If present, interpret // its value as a filename and try to copy the mode, uid and gid from // that file. - var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2893 /* "modeof" */) + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2908 /* "modeof" */) if z != 0 { rc = getFileMode(tls, z, pMode, pUid, pGid) } @@ -25761,7 +26266,7 @@ __15: if !(fd < 0) { goto __19 } - rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2373 /* "open" */, zName, 40257) + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2388 /* "open" */, zName, 40257) if !(rc == SQLITE_OK) { goto __20 } @@ -25872,7 +26377,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) == ENOENT { rc = (SQLITE_IOERR | (int32(23) << 8)) } else { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2483 /* "unlink" */, zPath, 40396) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2498 /* "unlink" */, zPath, 40396) } return rc } @@ -25882,7 +26387,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*12 + 4 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) if rc == SQLITE_OK { if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2900 /* "fsync" */, zPath, 40406) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2915 /* "fsync" */, zPath, 40406) } robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) } else { @@ -25957,7 +26462,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*12 + 4 /* &.pCurrent */))))(tls, zOut, (uint32(nOut-2))) == uintptr(0) { - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2391 /* "getcwd" */, zPath, 40485) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2406 /* "getcwd" */, zPath, 40485) } iOff = Xsqlite3Strlen30(tls, zOut) *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') @@ -25968,7 +26473,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) return Xsqlite3CantopenError(tls, 40494) } - Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2775 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2790 /* "%s" */, libc.VaList(bp, zPath)) // Remove duplicate '/' characters. Except, two // at the beginning // of a pathname is allowed since this is important on windows. @@ -26043,7 +26548,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*12 + 4 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) != ENOENT { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2571 /* "lstat" */, zIn, 40577) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2586 /* "lstat" */, zIn, 40577) } } else { bLink = (libc.Bool32((((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode) & X__mode_t(0170000)) == (X__mode_t(0120000)))) @@ -26063,7 +26568,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if rc == SQLITE_OK { nByte = (*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*12 + 4 /* &.pCurrent */))))(tls, zIn, zDel, (uint32(nOut - 1))) if nByte < 0 { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2562 /* "readlink" */, zIn, 40595) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2577 /* "readlink" */, zIn, 40595) } else { if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { var n int32 @@ -26155,7 +26660,7 @@ func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { unixEnterMutex(tls) zErr = libc.Xdlerror(tls) if zErr != 0 { - Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2775 /* "%s" */, libc.VaList(bp, zErr)) + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2790 /* "%s" */, libc.VaList(bp, zErr)) } unixLeaveMutex(tls) } @@ -26212,7 +26717,7 @@ func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) in { var fd int32 var got int32 - fd = robust_open(tls, ts+2906 /* "/dev/urandom" */, O_RDONLY, uint32(0)) + fd = robust_open(tls, ts+2921 /* "/dev/urandom" */, O_RDONLY, uint32(0)) if fd < 0 { // var t Time_t at bp, 4 @@ -26509,10 +27014,10 @@ func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ } var aVfs = [4]Sqlite3_vfs{ - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2919 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2924 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2934 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2814 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2934 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2939 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2949 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2829 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, } /* sqlite3.c:42091:22 */ // Shutdown the operating system interface. @@ -26604,7 +27109,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 2947, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 2962, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -26836,7 +27341,7 @@ func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int3 var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2953 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2968 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -26979,7 +27484,7 @@ func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+2775 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+2790 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -27096,7 +27601,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+2968 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+2983 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { @@ -27169,7 +27674,7 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+2991 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3006 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } @@ -32645,7 +33150,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3006, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3021, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -34397,7 +34902,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint32(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3033 /* "-journal" */, uint32(8)) + libc.Xmemcpy(tls, pPtr, ts+3048 /* "-journal" */, uint32(8)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -34412,7 +34917,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint32(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3042 /* "-wal" */, uint32(4)) + libc.Xmemcpy(tls, pPtr, ts+3057 /* "-wal" */, uint32(4)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -34471,9 +34976,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3047 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3062 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3054 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3069 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -38367,7 +38872,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+3064, /* "recovered %d fra..." */ + ts+3079, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -39111,7 +39616,7 @@ func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13 } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+3101 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+3116 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -41891,7 +42396,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3127 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3142 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -43931,7 +44436,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3143 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3158 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -44805,7 +45310,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+3152 /* "@ " */, uint32(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+3167 /* "@ " */, uint32(3)) != 0) { goto __14 } goto page1_init_failed @@ -52320,7 +52825,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 40 /* &.errMsg */), ts+3156 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 40 /* &.errMsg */), ts+3171 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 40 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -52356,11 +52861,11 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+3158 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3173 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+3181 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + checkAppendMsg(tls, pCheck, ts+3196 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+288 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -52387,13 +52892,13 @@ func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent P if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+3206 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+3221 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+3235, /* "Bad ptr map entr..." */ + ts+3250, /* "Bad ptr map entr..." */ libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } @@ -52416,7 +52921,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } N-- if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+3289 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3304 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) @@ -52427,7 +52932,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+3311 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + ts+3326 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -52453,12 +52958,12 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+3350, /* "%s is %d but sho..." */ + ts+3365, /* "%s is %d but sho..." */ libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 3376 /* "size" */ + return ts + 3391 /* "size" */ } - return ts + 3381 /* "overflow list le..." */ + return ts + 3396 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -52602,13 +53107,13 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3402 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3417 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+3412 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+3427 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; @@ -52622,7 +53127,7 @@ __3: } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+3450 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + ts+3465 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; @@ -52630,7 +53135,7 @@ __4: goto __5 } - checkAppendMsg(tls, pCheck, ts+3488 /* "free space corru..." */, libc.VaList(bp+16, rc)) + checkAppendMsg(tls, pCheck, ts+3503 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; @@ -52638,7 +53143,7 @@ __5: hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3510 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3525 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -52660,7 +53165,7 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3536 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3551 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; @@ -52691,7 +53196,7 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+3564, /* "Offset %d out of..." */ + checkAppendMsg(tls, pCheck, ts+3579, /* "Offset %d out of..." */ libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 @@ -52702,7 +53207,7 @@ __12: if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+3594 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+3609 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: @@ -52720,7 +53225,7 @@ __13: }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+3618 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+3633 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) __15: ; *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey @@ -52761,7 +53266,7 @@ __20: if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+3642 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+3657 /* "Child page depth..." */, 0) depth = d2 __21: ; @@ -52859,7 +53364,7 @@ __29: goto __31 } checkAppendMsg(tls, pCheck, - ts+3667 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) + ts+3682 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) goto __30 goto __32 __31: @@ -52879,7 +53384,7 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+3704, /* "Fragmentation of..." */ + ts+3719, /* "Fragmentation of..." */ libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; @@ -53008,7 +53513,7 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3756 /* "Main freelist: " */ + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3771 /* "Main freelist: " */ checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) @@ -53046,7 +53551,7 @@ __13: goto __15 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3772, /* "max rootpage (%d..." */ + ts+3787, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -53056,7 +53561,7 @@ __9: goto __16 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3817 /* "incremental_vacu..." */, 0) + ts+3832 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -53106,13 +53611,13 @@ __23: if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3872 /* "Page %d is never..." */, libc.VaList(bp+16, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3887 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3894 /* "Pointer map page..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3909 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -53431,7 +53936,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint32(unsafe.Sizeof(Parse{}))) (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2775 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2790 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) @@ -53442,7 +53947,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3928 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3943 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -53463,7 +53968,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3948 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3963 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -53490,7 +53995,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+3979 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+3994 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -54104,7 +54609,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4019, /* "%!.15g" */ + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4034, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -54745,7 +55250,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -54951,6 +55456,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -55255,7 +55762,7 @@ __9: goto __10 } rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -55327,7 +55834,7 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 740 /* "" */ + zNeg = ts + 755 /* "" */ rc = SQLITE_OK __1: @@ -55376,7 +55883,7 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 4026 /* "-" */ + zNeg = ts + 4041 /* "-" */ __6: ; @@ -55396,7 +55903,7 @@ __9: Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+4028 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+4043 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } @@ -56841,34 +57348,34 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4033 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4048 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 20 /* &.aColl */) + uintptr(j)*4)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 740 /* "" */ + zColl = ts + 755 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+303 /* "BINARY" */) == 0 { - zColl = ts + 4038 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+318 /* "BINARY" */) == 0 { + zColl = ts + 4053 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4040, /* ",%s%s%s" */ + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4055, /* ",%s%s%s" */ libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 4026 /* "-" */ + return ts + 4041 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 4048 /* "N." */ + return ts + 4063 /* "N." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4066 /* ")" */, 1) break } @@ -56876,7 +57383,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4053 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4068 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -56884,32 +57391,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4062 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4077 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4062 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4077 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4074 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4089 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -56919,14 +57426,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 741 /* "NULL" */ + zP4 = ts + 756 /* "NULL" */ } else { - zP4 = ts + 4077 /* "(blob)" */ + zP4 = ts + 4092 /* "(blob)" */ } break @@ -56934,7 +57441,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4099 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -56945,20 +57452,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4092 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4107 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4097 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4112 /* "]" */, 1) break } case -4: { - zP4 = ts + 4099 /* "program" */ + zP4 = ts + 4114 /* "program" */ break } @@ -56990,7 +57497,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 4107 /* "?" */, ts + 4109 /* "8" */, ts + 4111 /* "16LE" */, ts + 4116 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 4122 /* "?" */, ts + 4124 /* "8" */, ts + 4126 /* "16LE" */, ts + 4131 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -57522,8 +58029,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 4121 /* "addr" */, ts + 4126 /* "opcode" */, ts + 4133 /* "p1" */, ts + 4136 /* "p2" */, ts + 4139 /* "p3" */, ts + 4142 /* "p4" */, ts + 4145 /* "p5" */, ts + 4148, /* "comment" */ - ts + 4156 /* "id" */, ts + 4159 /* "parent" */, ts + 4166 /* "notused" */, ts + 4174, /* "detail" */ + ts + 4136 /* "addr" */, ts + 4141 /* "opcode" */, ts + 4148 /* "p1" */, ts + 4151 /* "p2" */, ts + 4154 /* "p3" */, ts + 4157 /* "p4" */, ts + 4160 /* "p5" */, ts + 4163, /* "comment" */ + ts + 4171 /* "id" */, ts + 4174 /* "parent" */, ts + 4181 /* "notused" */, ts + 4189, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -57771,7 +58278,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+4181 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+4196 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } @@ -57781,16 +58288,16 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4193 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4208 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4207 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4222 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4222, /* "-mj%06X9%02X" */ + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4237, /* "-mj%06X9%02X" */ libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. @@ -57984,7 +58491,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+4235 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4250 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -58266,7 +58773,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -59817,13 +60324,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 4265 /* "a CHECK constrai..." */ + zContext = ts + 4280 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 4284 /* "a generated colu..." */ + zContext = ts + 4299 /* "a generated colu..." */ } else { - zContext = ts + 4303 /* "an index" */ + zContext = ts + 4318 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+4312, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+4327, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -59954,7 +60461,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4348 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4363 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -59964,7 +60471,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4393 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4408 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -60434,7 +60941,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4433 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4448 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -61185,7 +61692,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+4456 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+4471 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -61962,7 +62469,7 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4496 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4511 /* "-- " */, 3) Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, ((int32(zRawSql) - int32(zStart)) / 1)) } @@ -62000,11 +62507,11 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 176 /* idx */))-1))*40) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+741 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+756 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4069 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4084 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4019 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4034 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc @@ -62019,21 +62526,21 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = bp + 184 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4500 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4515 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { Xsqlite3VdbeMemRelease(tls, bp+184 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4507 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4522 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4520 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4535 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4523 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4538 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4528 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4543 /* "'" */, 1) } } } @@ -65732,19 +66239,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+4530 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+4545 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4551 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4566 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4558 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4573 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -68294,7 +68801,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+4582 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4597 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -68367,7 +68874,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+4633 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + Xsqlite3VdbeError(tls, p, ts+4648 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -68377,7 +68884,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+4655 /* "cannot release s..." */, 0) + ts+4670 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -68582,7 +69089,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+4709 /* "cannot commit tr..." */, 0) + ts+4724 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -68625,13 +69132,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 4764 /* "cannot start a t..." */ + return ts + 4779 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 4812 /* "cannot rollback ..." */ + return ts + 4827 /* "cannot rollback ..." */ } - return ts + 4855 /* "cannot commit - ..." */ + return ts + 4870 /* "cannot commit - ..." */ }() }(), 0) @@ -68749,7 +69256,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4896 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4911 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -69131,7 +69638,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*40)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*40)).Fz = ts + 740 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*40)).Fz = ts + 755 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*4)) @@ -71261,7 +71768,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4924 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4939 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -71694,14 +72201,14 @@ __137: goto __720 __719: - zSchema = ts + 4941 /* "sqlite_master" */ + zSchema = ts + 4956 /* "sqlite_master" */ (*InitData)(unsafe.Pointer(bp + 604 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 604 /* &initData */)).FiDb = iDb3 (*InitData)(unsafe.Pointer(bp + 604 /* &initData */)).FpzErrMsg = (p + 124 /* &.zErrMsg */) (*InitData)(unsafe.Pointer(bp + 604 /* &initData */)).FmInitFlags = U32(0) (*InitData)(unsafe.Pointer(bp + 604 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*16)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+4955, /* "SELECT*FROM\"%w\"...." */ + ts+4970, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*16)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 @@ -72034,7 +72541,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+4998 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5013 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -72479,7 +72986,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -72557,7 +73064,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -72672,12 +73179,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+5035, /* "cannot change %s..." */ + ts+5050, /* "cannot change %s..." */ libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 5087 /* "into" */ + return ts + 5102 /* "into" */ } - return ts + 5092 /* "out of" */ + return ts + 5107 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -72880,7 +73387,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+5099 /* "database table i..." */, libc.VaList(bp+112, z1)) + Xsqlite3VdbeError(tls, p, ts+5114 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -73124,7 +73631,7 @@ __833: if !((*Sqlite3_context)(unsafe.Pointer(bp+716 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) rc = (*Sqlite3_context)(unsafe.Pointer(bp + 716 /* &sContext */)).FisError __834: ; @@ -73455,7 +73962,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -73545,7 +74052,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+5128 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+5143 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 208 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -73648,13 +74155,13 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+5134, /* "statement aborts..." */ + Xsqlite3_log(tls, rc, ts+5149, /* "statement aborts..." */ libc.VaList(bp+152, ((int32(pOp)-int32(aOp))/20), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { @@ -73699,14 +74206,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+4433 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4448 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+5166 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+5181 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -73719,8 +74226,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 5180 /* "NOT NULL" */, ts + 5189 /* "UNIQUE" */, ts + 5196, /* "CHECK" */ - ts + 5202 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 5195 /* "NOT NULL" */, ts + 5204 /* "UNIQUE" */, ts + 5211, /* "CHECK" */ + ts + 5217 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -73827,16 +74334,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5214, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5229, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 5243 /* "null" */ + return ts + 5258 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 5248 /* "real" */ + return ts + 5263 /* "real" */ } - return ts + 5253 /* "integer" */ + return ts + 5268 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -73856,10 +74363,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5261 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5276 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -73922,21 +74429,21 @@ __4: goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5281 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5296 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5311 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5326 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5347 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5362 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { @@ -73981,7 +74488,7 @@ __12: goto __14 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5368 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5383 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74010,7 +74517,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+36 /* &.aCol */)+uintptr(j)*8)).FiFrom == iCol) { goto __23 } - zFault = ts + 5389 /* "foreign key" */ + zFault = ts + 5404 /* "foreign key" */ __23: ; goto __21 @@ -74043,7 +74550,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 5401 /* "indexed" */ + zFault = ts + 5416 /* "indexed" */ __30: ; goto __28 @@ -74064,7 +74571,7 @@ __26: goto __31 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5409 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5424 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74173,7 +74680,7 @@ __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 320 /* zErr */)))) @@ -74338,7 +74845,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) @@ -77894,7 +78401,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5443 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5458 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -78097,14 +78604,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5448 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5463 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5452 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5467 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -78121,7 +78628,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 8 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5456 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5471 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -78298,7 +78805,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+5465 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5480 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -78306,14 +78813,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+5496 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5511 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -78389,7 +78896,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+5551 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + ts+5566 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 44 /* &.y */)) = uintptr(0) return WRC_Prune @@ -78410,23 +78917,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 5586 /* "no such column" */ + zErr = ts + 5601 /* "no such column" */ } else { - zErr = ts + 5601 /* "ambiguous column..." */ + zErr = ts + 5616 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+5623 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5638 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+5636 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5651 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+5646 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5661 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -78560,15 +79067,15 @@ func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExp bp := tls.Alloc(16) defer tls.Free(16) - var zIn uintptr = ts + 5653 /* "partial index WH..." */ + var zIn uintptr = ts + 5668 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 5681 /* "index expression..." */ + zIn = ts + 5696 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 5699 /* "CHECK constraint..." */ + zIn = ts + 5714 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 5717 /* "generated column..." */ + zIn = ts + 5732 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5735 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+5750 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -78676,10 +79183,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5755 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5770 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5760 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5775 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -78732,7 +79239,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5766 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5781 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -78799,7 +79306,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+5783 /* "second argument ..." */, 0) + ts+5798 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -78824,7 +79331,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+5854, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+5869, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -78848,7 +79355,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5889 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5904 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -78877,30 +79384,30 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+5917 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + ts+5932 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 5961 /* "window" */ + zType = ts + 5976 /* "window" */ } else { - zType = ts + 5968 /* "aggregate" */ + zType = ts + 5983 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5978 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+5993 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6007 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6022 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6030, /* "wrong number of ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6045, /* "wrong number of ..." */ libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+6075, /* "FILTER may not b..." */ + ts+6090, /* "FILTER may not b..." */ libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -78975,7 +79482,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6124 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6139 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */))) @@ -78992,7 +79499,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6135 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6150 /* "parameters" */, pExpr) } break @@ -79052,7 +79559,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) } break @@ -79157,7 +79664,7 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 Xsqlite3ErrorMsg(tls, pParse, - ts+6146 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+6161 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -79189,7 +79696,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6202 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6217 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -79224,7 +79731,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+6236 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + resolveOutOfRangeError(tls, pParse, ts+6251 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { @@ -79295,7 +79802,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*20) + 12 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6242 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+6257 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -79323,7 +79830,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6303 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+6318 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -79612,7 +80119,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 24 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6334 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6349 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -79669,7 +80176,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6236 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6251 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -79682,7 +80189,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6378 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6393 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -79694,7 +80201,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6384 /* "aggregate functi..." */, 0) + ts+6399 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -80464,7 +80971,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) return } @@ -80540,7 +81047,7 @@ func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 112 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+6443 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+6458 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -80781,7 +81288,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -80803,7 +81310,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 112 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6493 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+6508 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 20 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -80837,7 +81344,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+6527 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6542 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -80890,7 +81397,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6546, /* "variable number ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6561, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 9*4)))) return } @@ -80917,7 +81424,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6589 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6604 /* "too many SQL var..." */, 0) } } @@ -81586,7 +82093,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+6612, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6627, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -81721,7 +82228,7 @@ func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 112 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+6642 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+6657 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -81776,10 +82283,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+5755 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5770 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+5760 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5775 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -82224,13 +82731,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+6665 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6680 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6673 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6688 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6679 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6694 /* "OID" */) == 0 { return 1 } return 0 @@ -82458,7 +82965,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6683 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6698 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -82549,7 +83056,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6730 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6745 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -82655,7 +83162,7 @@ func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpec defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 6761 /* "sub-select retur..." */ + var zFmt uintptr = ts + 6776 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -82673,7 +83180,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) } } @@ -82726,7 +83233,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6805 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6820 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -82762,11 +83269,11 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 20 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6828 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6843 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 6847 /* "CORRELATED " */ + return ts + 6862 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. @@ -82912,7 +83419,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6859 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6874 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 44 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -82945,11 +83452,11 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6877 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6892 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 6847 /* "CORRELATED " */ + return ts + 6862 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr @@ -82973,7 +83480,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -82983,7 +83490,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6898 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6913 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -83475,12 +83982,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+6900 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6903 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if Xsqlite3_strnicmp(tls, z, ts+6915 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6918 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 4026 /* "-" */ + return ts + 4041 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -83555,7 +84062,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6929 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6944 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 16 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -84114,7 +84621,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+6929, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6944, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -84366,7 +84873,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+6959 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+6974 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*20)).FiMem @@ -84408,7 +84915,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+6985 /* "unknown function..." */, libc.VaList(bp+16, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7000 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -84602,7 +85109,7 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+6612, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6627, /* "%d columns assig..." */ libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; @@ -84684,7 +85191,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -84808,7 +85315,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+7008 /* "RAISE() may only..." */, 0) + ts+7023 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -84847,7 +85354,7 @@ __3: return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7058 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7073 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -86684,11 +87191,11 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq bp := tls.Alloc(8) defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7074 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7089 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -86706,14 +87213,14 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+7102, /* "SELECT 1 FROM \"%..." */ + ts+7117, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7277, /* "SELECT 1 FROM te..." */ + ts+7292, /* "SELECT 1 FROM te..." */ libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -86729,11 +87236,11 @@ func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { Xsqlite3NestedParse(tls, pParse, - ts+7451 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+7466 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7598 /* "UPDATE temp.sqli..." */, 0) + ts+7613 /* "UPDATE temp.sqli..." */, 0) } } @@ -86807,7 +87314,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+7749 /* "there is already..." */, libc.VaList(bp, zName)) + ts+7764 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -86820,7 +87327,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7808 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7823 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -86830,7 +87337,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+7814 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7829 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -86883,24 +87390,24 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+7841 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+7856 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+8025, /* "UPDATE %Q.sqlite..." */ + ts+8040, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+8330 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+8345 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+8346, /* "UPDATE \"%w\".sqli..." */ + ts+8361, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -86913,7 +87420,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+8404 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+8419 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -86931,7 +87438,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8669 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8684 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -86946,7 +87453,7 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+8682, /* "SELECT raise(ABO..." */ + ts+8697, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -86994,12 +87501,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8720 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+8735 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+8752 /* "Cannot add a UNI..." */, 0) + ts+8767 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -87012,11 +87519,11 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8779 /* "Cannot add a REF..." */) + ts+8794 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8838 /* "Cannot add a NOT..." */) + ts+8853 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() @@ -87032,12 +87539,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8891 /* "Cannot add a col..." */) + ts+8906 /* "Cannot add a col..." */) } Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8937 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8952 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -87053,7 +87560,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+8964, /* "UPDATE \"%w\".sqli..." */ + ts+8979, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -87124,7 +87631,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+9110 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9125 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -87133,7 +87640,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+9144 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9159 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -87168,7 +87675,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint32(unsafe.Sizeof(Column{})) * uint32(nAlloc)))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9174 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9189 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -87215,18 +87722,18 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 9193 /* "view" */ + zType = ts + 9208 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 9198 /* "virtual table" */ + zType = ts + 9213 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9212, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9227, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 9230 /* "drop column from" */ + return ts + 9245 /* "drop column from" */ } - return ts + 9247 /* "rename columns o..." */ + return ts + 9262 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -87319,13 +87826,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+5368 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+5383 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -87343,19 +87850,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+9265, /* "UPDATE \"%w\".sqli..." */ + ts+9280, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+9483, /* "UPDATE temp.sqli..." */ + ts+9498, /* "UPDATE temp.sqli..." */ libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8669 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8684 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -87650,12 +88157,12 @@ func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType ui var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+9614, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+9629, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 9637 /* " " */ + return ts + 9652 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -87764,7 +88271,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+9639 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+9654 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -87814,12 +88321,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.Xmemcpy(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9645 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9660 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 9637 /* " " */ + return ts + 9652 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -88324,7 +88831,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+20 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+20 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+20 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -88504,7 +89011,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+48 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+48 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+48 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -88786,7 +89293,7 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+9650 /* "%.*s%s" */, libc.VaList(bp, ((int32((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+9665 /* "%.*s%s" */, libc.VaList(bp, ((int32((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int32(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) @@ -88874,7 +89381,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+5368 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5383 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -88884,12 +89391,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*20)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+9657, /* "cannot drop %s c..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9672, /* "cannot drop %s c..." */ libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*20)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 9685 /* "PRIMARY KEY" */ + return ts + 9700 /* "PRIMARY KEY" */ } - return ts + 5189 /* "UNIQUE" */ + return ts + 5204 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -88900,7 +89407,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+9697 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+9712 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -88909,15 +89416,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+9745 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+9760 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9866 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9881 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*20)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -89028,11 +89535,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9884 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9905 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9925 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9944 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9963 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9899 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9920 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9940 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9959 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9978 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -89229,7 +89736,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+9986 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + ts+10001 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } @@ -89241,10 +89748,10 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10009, /* "DELETE FROM %Q.%..." */ + ts+10024, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+10039 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+10054 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) @@ -89265,9 +89772,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 10057 /* "sqlite_stat1" */, FzCols: ts + 10070 /* "tbl,idx,stat" */}, - {FzName: ts + 10083 /* "sqlite_stat4" */, FzCols: ts + 10096 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 10124 /* "sqlite_stat3" */}, + {FzName: ts + 10072 /* "sqlite_stat1" */, FzCols: ts + 10085 /* "tbl,idx,stat" */}, + {FzName: ts + 10098 /* "sqlite_stat4" */, FzCols: ts + 10111 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10139 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -89499,7 +90006,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10137 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 10152 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -89817,7 +90324,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10147 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 10162 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -89874,7 +90381,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+10157, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+10172, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -89885,7 +90392,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+10162 /* " %llu" */, libc.VaList(bp+8, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+10177 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -89934,7 +90441,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+10168 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+10183 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -89951,7 +90458,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10174 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 10189 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -89998,7 +90505,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+10183 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+10198 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -90016,7 +90523,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*76) - libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10057 /* "sqlite_stat1" */, uint32(13)) + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10072 /* "sqlite_stat1" */, uint32(13)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -90249,7 +90756,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10193 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10208 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -90311,7 +90818,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10193 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10208 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -90364,9 +90871,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 40 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10197 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10212 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10201 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10216 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -90461,7 +90968,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 740 /* "" */ + z = ts + 755 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -90483,15 +90990,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+10205 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+10220 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+10216 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10231 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+10226 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10241 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+56 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -90810,10 +91317,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+10083 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+10098 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+10238, /* "SELECT idx,count..." */ - ts+10292, /* "SELECT idx,neq,n..." */ + ts+10253, /* "SELECT idx,count..." */ + ts+10307, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -90864,9 +91371,9 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit // Load new statistics out of the sqlite_stat1 table (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+10057 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + if Xsqlite3FindTable(tls, db, ts+10072 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+10344 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + ts+10359 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { @@ -90958,7 +91465,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5443 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5458 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -91009,13 +91516,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 740 /* "" */ + zFile = ts + 755 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __2: ; @@ -91025,7 +91532,7 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2947 /* "memdb" */) + *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2962 /* "memdb" */) if !(*(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)) == uintptr(0)) { goto __5 } @@ -91041,7 +91548,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)), ts+10385 /* "x\x00" */, db, (pNew + 4 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pVfs */)), ts+10400 /* "x\x00" */, db, (pNew + 4 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -91054,7 +91561,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10388, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10403, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -91068,7 +91575,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10425 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10440 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -91139,7 +91646,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10455 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10470 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -91156,7 +91663,7 @@ __21: goto __23 } *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+10484 /* "attached databas..." */, 0) + ts+10499 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -91226,13 +91733,13 @@ __29: } Xsqlite3OomFault(tls, db) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5166 /* "out of memory" */, 0) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5181 /* "out of memory" */, 0) goto __31 __30: if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10552 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10567 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -91288,7 +91795,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __1: ; i = 0 @@ -91320,14 +91827,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10580 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10595 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10601 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10616 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -91335,7 +91842,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10627 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10642 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -91458,7 +91965,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10649 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 10664 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -91471,7 +91978,7 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10663 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 10678 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ @@ -91486,7 +91993,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10677 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10692 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -91519,7 +92026,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+10701, /* "%s %T cannot ref..." */ + ts+10716, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -91718,7 +92225,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+10747 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10762 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -91742,11 +92249,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 352 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+10770 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+10785 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+10776 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+10791 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+10782 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+10797 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -91798,7 +92305,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*20)).FzName } else { - zCol = ts + 6673 /* "ROWID" */ + zCol = ts + 6688 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -91830,7 +92337,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 352 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+10809 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10824 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -92140,25 +92647,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+5443 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+5458 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*16)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10824 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4941 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10839 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4956 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 8 /* &.tblHash */), - ts+10857 /* "sqlite_temp_mast..." */) + ts+10872 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*16)).FpSchema + 8 /* &.tblHash */), - ts+4941 /* "sqlite_master" */) + ts+4956 /* "sqlite_master" */) } } } @@ -92181,12 +92688,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4941 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10824 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4956 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10839 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 8 /* &.tblHash */), - ts+10857 /* "sqlite_temp_mast..." */) + ts+10872 /* "sqlite_temp_mast..." */) } } } @@ -92222,7 +92729,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 376 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10876 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10891 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -92240,14 +92747,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 10884 /* "no such view" */ + zMsg = ts + 10899 /* "no such view" */ } else { - zMsg = ts + 10897 /* "no such table" */ + zMsg = ts + 10912 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+5636 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5651 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5646 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5661 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -92560,7 +93067,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4941 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4956 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -92587,7 +93094,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5443 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5458 /* "main" */, zName)) { goto __3 } @@ -92640,13 +93147,13 @@ func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10911 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10926 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10928 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+10943 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -92687,13 +93194,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*4))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*4))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+10948, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10963, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -92862,9 +93369,9 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 @@ -92882,7 +93389,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+10990 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11005 /* "temporary table ..." */, 0) return __4: ; @@ -92910,9 +93417,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 9193 /* "view" */ + return ts + 9208 /* "view" */ } - return ts + 7808 /* "table" */ + return ts + 7823 /* "table" */ }(), zName) != 0) { goto __8 } @@ -92929,9 +93436,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -92969,7 +93476,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+11031 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+11046 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -92983,7 +93490,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+11055 /* "there is already..." */, libc.VaList(bp+8, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11070 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -93099,7 +93606,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 40 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+11090 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+11105 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -93123,7 +93630,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11107 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11122 /* "cannot use RETUR..." */, 0) } else { } @@ -93144,7 +93651,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11090 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11105 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -93156,7 +93663,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema + 40 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+11090 /* "sqlite_returning" */, (pRet+8 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+11105 /* "sqlite_returning" */, (pRet+8 /* &.retTrig */)) == (pRet + 8 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -93184,7 +93691,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11141 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11156 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -93200,7 +93707,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*20)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*20)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11164 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11179 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -93374,11 +93881,11 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*20) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11190, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11205, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11235 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11250 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. @@ -93428,7 +93935,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11276 /* "generated column..." */, 0) + ts+11291 /* "generated column..." */, 0) } } @@ -93473,7 +93980,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+11328 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11343 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -93533,7 +94040,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), ts+11369 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), ts+11384 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -93561,7 +94068,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+11377 /* "AUTOINCREMENT is..." */, 0) + ts+11392 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -93665,7 +94172,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+11433 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11448 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -93678,13 +94185,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11476 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11491 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11484 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11499 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -93717,7 +94224,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+11491, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11506, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -93859,13 +94366,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 740 /* "" */ - zSep2 = ts + 11522 /* "," */ - zEnd = ts + 4051 /* ")" */ + zSep = ts + 755 /* "" */ + zSep2 = ts + 11537 /* "," */ + zEnd = ts + 4066 /* ")" */ } else { - zSep = ts + 11524 /* "\n " */ - zSep2 = ts + 11528 /* ",\n " */ - zEnd = ts + 11533 /* "\n)" */ + zSep = ts + 11539 /* "\n " */ + zSep2 = ts + 11543 /* ",\n " */ + zEnd = ts + 11548 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -93873,7 +94380,7 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+11536 /* "CREATE TABLE " */, 0) + Xsqlite3_snprintf(tls, n, zStmt, ts+11551 /* "CREATE TABLE " */, 0) *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') @@ -93907,16 +94414,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2775 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2790 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 740, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 11550, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 11556, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 11561, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 11566, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 755, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11565, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11571, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11576, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11581, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -94353,7 +94860,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -94366,11 +94873,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11572 /* "AUTOINCREMENT no..." */, 0) + ts+11587 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11622 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11637 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 36 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -94414,7 +94921,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11654 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11669 /* "must have at lea..." */, 0) return } } @@ -94447,12 +94954,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 7808 /* "table" */ - zType2 = ts + 11698 /* "TABLE" */ + zType = ts + 7823 /* "table" */ + zType2 = ts + 11713 /* "TABLE" */ } else { // A view - zType = ts + 9193 /* "view" */ - zType2 = ts + 11704 /* "VIEW" */ + zType = ts + 9208 /* "view" */ + zType2 = ts + 11719 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -94533,7 +95040,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+11709 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+11724 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -94541,7 +95048,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+11724, /* "UPDATE %Q.sqlite..." */ + ts+11739, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, @@ -94559,14 +95066,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+11822, /* "CREATE TABLE %Q...." */ + ts+11837, /* "CREATE TABLE %Q...." */ libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+11864 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+11879 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -94587,7 +95094,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8330 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8345 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -94624,7 +95131,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+11898 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11913 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -94646,7 +95153,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+4 /* &sFix */, pParse, iDb, ts+9193 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+4 /* &sFix */, pParse, iDb, ts+9208 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+4 /* &sFix */, pSelect) != 0) { goto __3 } @@ -94763,7 +95270,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11934 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11949 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -94905,7 +95412,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+11964 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11979 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -94919,7 +95426,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+11979, /* "UPDATE %Q.sqlite..." */ + ts+11994, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*16)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -94983,10 +95490,10 @@ func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uint for i = 1; i <= 4; i++ { // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12046 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12061 /* "sqlite_stat%d" */, libc.VaList(bp, i)) if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10009, /* "DELETE FROM %Q.%..." */ + ts+10024, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } @@ -95026,7 +95533,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+12060, /* "DELETE FROM %Q.s..." */ + ts+12075, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -95038,7 +95545,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+12105, /* "DELETE FROM %Q.s..." */ + ts+12120, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) @@ -95068,11 +95575,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2398 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2413 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6135 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6150 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -95153,9 +95660,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName zArg2 = uintptr(0) @@ -95215,7 +95722,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+12172 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12187 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -95225,14 +95732,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+12200 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12215 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+12234 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12249 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -95247,7 +95754,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+10201 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10216 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -95312,7 +95819,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+12266, /* "foreign key on %..." */ + ts+12281, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*20)).FzName, pTo)) goto fk_end __5: @@ -95325,7 +95832,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+12329 /* "number of column..." */, 0) + ts+12344 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -95409,7 +95916,7 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+12423, /* "unknown column \"..." */ + ts+12438, /* "unknown column \"..." */ libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*20)).FzEName)) goto fk_end __23: @@ -95659,12 +96166,12 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*20 + 12 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*20)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+12469, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12484, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 12497 /* "FIRST" */ + return ts + 12512 /* "FIRST" */ } - return ts + 12503 /* "LAST" */ + return ts + 12518 /* "LAST" */ }())) return 1 } @@ -95822,7 +96329,7 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+132 /* &sFix */, pParse, iDb, ts+12508 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + Xsqlite3FixInit(tls, bp+132 /* &sFix */, pParse, iDb, ts+12523 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+132 /* &sFix */, pTblName) != 0) { goto __10 } @@ -95843,7 +96350,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+12514, /* "cannot create a ..." */ + ts+12529, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -95870,26 +96377,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12564 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12579 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+12592 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12607 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+12617 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12632 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -95916,7 +96423,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12508 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12523 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -95931,7 +96438,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+12651 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12666 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -95943,7 +96450,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+12685 /* "index %s already..." */, libc.VaList(bp+24, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12700 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -95972,7 +96479,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+12709 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+12724 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -96001,9 +96508,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -96047,7 +96554,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12508 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12523 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -96164,7 +96671,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+12732 /* "expressions proh..." */, 0) + ts+12747 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -96393,7 +96900,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+12793 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) + ts+12808 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -96449,7 +96956,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+12835 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12850 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -96507,12 +97014,12 @@ __104: __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+12852, /* "CREATE%s INDEX %..." */ + zStmt = Xsqlite3MPrintf(tls, db, ts+12867, /* "CREATE%s INDEX %..." */ libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 12872 /* " UNIQUE" */ + return ts + 12887 /* " UNIQUE" */ }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: @@ -96524,7 +97031,7 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+12880, /* "INSERT INTO %Q.s..." */ + ts+12895, /* "INSERT INTO %Q.s..." */ libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -96540,7 +97047,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+12939 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+12954 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -96724,7 +97231,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+12966 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+12981 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -96739,7 +97246,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+12984 /* "index associated..." */, libc.VaList(bp+8, 0)) + ts+12999 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -96750,9 +97257,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -96780,9 +97287,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+13057, /* "DELETE FROM %Q.s..." */ + ts+13072, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+10197 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10212 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -96933,7 +97440,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+13117, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13132, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -97145,12 +97652,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13153, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13168, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 13189 /* "ON" */ + return ts + 13204 /* "ON" */ } - return ts + 13192 /* "USING" */ + return ts + 13207 /* "USING" */ }())) goto append_from_error __1: @@ -97278,7 +97785,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -97314,9 +97821,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 13204 /* "ROLLBACK" */ + return ts + 13219 /* "ROLLBACK" */ } - return ts + 13213 /* "COMMIT" */ + return ts + 13228 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -97341,7 +97848,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 13198 /* "BEGIN" */, ts + 13220 /* "RELEASE" */, ts + 13204 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 13213 /* "BEGIN" */, ts + 13235 /* "RELEASE" */, ts + 13219 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -97357,7 +97864,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+13228 /* "unable to open a..." */, 0) + ts+13243 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -97500,17 +98007,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 112 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13298 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13313 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*20)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13309 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13324 /* ", " */, 2) } Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+768 /* "." */, 1) Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } @@ -97533,11 +98040,11 @@ func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*20)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13312 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13327 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -97680,7 +98187,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+13321 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13336 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -97790,7 +98297,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+12 /* &.a */)+uintptr(i)*24)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13367 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13382 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -98024,7 +98531,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13397 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13412 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -98390,11 +98897,11 @@ func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int3 defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13428 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13443 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13457 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13472 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -98987,7 +99494,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13495 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13510 /* "rows deleted" */, uintptr(0)) __61: ; @@ -99132,7 +99639,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10057 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10072 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -99410,7 +99917,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 5253 /* "integer" */, ts + 5248 /* "real" */, ts + 13508 /* "text" */, ts + 13513 /* "blob" */, ts + 5243 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 5268 /* "integer" */, ts + 5263 /* "real" */, ts + 13523 /* "text" */, ts + 13528 /* "blob" */, ts + 5258 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -99474,7 +99981,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+13518 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13533 /* "integer overflow" */, -1) return } iVal = -iVal @@ -99812,7 +100319,7 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+13535 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+13550 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -100262,7 +100769,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+13540 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+13555 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -100274,7 +100781,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+13573 /* "ESCAPE expressio..." */, -1) + ts+13588 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -100340,7 +100847,7 @@ func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))) } // Implementation of the sqlite_compileoption_used() function. @@ -100397,10 +100904,10 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4019 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4034 /* "%!.15g" */, libc.VaList(bp, r1)) Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13618 /* "%!.20e" */, libc.VaList(bp+8, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13633 /* "%!.20e" */, libc.VaList(bp+8, r1)) } Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break @@ -100474,7 +100981,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+741 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+756 /* "NULL" */, 4, uintptr(0)) break } @@ -100785,7 +101292,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 9637 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 9652 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -100806,7 +101313,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 740 /* "" */ + zIn = ts + 755 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -100832,7 +101339,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+13625 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+13640 /* "?000" */, 4, uintptr(0)) } } @@ -100860,7 +101367,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+10809 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+10824 /* "not authorized" */, -1) return } @@ -100948,7 +101455,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+13518 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13533 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -101102,7 +101609,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) } else { - zSep = ts + 11522 /* "," */ + zSep = ts + 11537 /* "," */ nSep = 1 } if zSep != 0 { @@ -101180,7 +101687,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+13630 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+13645 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -101200,14 +101707,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+13636 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13651 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+13636 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13651 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13636 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13636 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13651 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13651 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -101312,76 +101819,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_implies_nonnull_row), FxSFunc: 0, FzName: ts + 13641 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_compare), FxSFunc: 0, FzName: ts + 13661 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_implies_expr), FxSFunc: 0, FzName: ts + 13674 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_implies_nonnull_row), FxSFunc: 0, FzName: ts + 13656 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_compare), FxSFunc: 0, FzName: ts + 13676 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_expr_implies_expr), FxSFunc: 0, FzName: ts + 13689 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13692 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13700 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13700 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13715 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13741 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13766 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13775 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13786 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13793 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13807 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13807 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13813 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13813 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13819 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13819 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13824 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13824 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13824 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13828 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FzName: ts + 13828 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(1), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13828 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13832 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13839 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13846 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13852 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13859 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13867 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13872 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13882 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13888 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13894 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13898 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13905 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13912 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13923 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13930 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13945 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13962 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13973 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13979 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13997 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14005 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14019 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14027 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14036 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14036 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14053 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14057 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14063 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13707 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13715 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13715 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13730 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13756 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13781 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13790 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(INLINEFUNC_unlikely), FxSFunc: 0, FzName: ts + 13801 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13808 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13822 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13822 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13828 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(2), FxSFunc: 0, FzName: ts + 13828 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13834 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(3), FxSFunc: 0, FzName: ts + 13834 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13839 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13839 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13839 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FxSFunc: 0, FzName: ts + 13843 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(1), FzName: ts + 13843 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(1), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13843 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13847 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13854 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13861 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13867 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13874 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13882 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13887 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13891 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13891 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13897 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13903 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13909 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13913 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13920 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13927 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13938 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13945 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13960 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13977 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13988 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13994 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14012 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14020 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14034 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14042 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14051 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14051 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14058 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14058 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14068 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14072 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14078 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14082 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14082 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14088 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14088 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14086 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13636 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13636 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14091 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14091 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14100 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14091 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_iif), FxSFunc: 0, FzName: ts + 14105 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14101 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13651 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13651 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14106 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14106 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14115 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14106 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(INLINEFUNC_iif), FxSFunc: 0, FzName: ts + 14120 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -101667,7 +102174,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+14109, /* "foreign key mism..." */ + ts+14124, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -102563,8 +103070,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 24 /* tOld */)) = Token{Fz: ts + 5452 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 32 /* tNew */)) = Token{Fz: ts + 5448 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 24 /* tOld */)) = Token{Fz: ts + 5467 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 32 /* tNew */)) = Token{Fz: ts + 5463 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+16, 8 // Name of column in child table // var tToCol Token at bp+8, 8 @@ -102652,7 +103159,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 40 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 40 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4235 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4250 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -103082,7 +103589,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6929 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6944 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -103646,7 +104153,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+14154, /* "cannot INSERT in..." */ + ts+14169, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*20)).FzName)) goto insert_cleanup __24: @@ -103671,7 +104178,7 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+14195, /* "table %S has no ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14210, /* "table %S has no ..." */ libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*8)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup @@ -103841,7 +104348,7 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+14227, /* "table %S has %d ..." */ + ts+14242, /* "table %S has %d ..." */ libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: @@ -103851,7 +104358,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+14279 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+14294 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -103907,7 +104414,7 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+14304, /* "UPSERT not imple..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14319, /* "UPSERT not imple..." */ libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: @@ -103915,7 +104422,7 @@ __56: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+14350 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14365 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -104395,7 +104902,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14371 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14386 /* "rows inserted" */, uintptr(0)) __123: ; @@ -104738,7 +105245,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -106141,7 +106648,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 740 /* "" */ + zSql = ts + 755 /* "" */ __2: ; @@ -106702,7 +107209,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10809 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10824 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -106712,7 +107219,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 14385 /* "sqlite3_extensio..." */ + zEntry = ts + 14400 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -106732,7 +107239,7 @@ __5: if !((ii < (int32(uint32(unsafe.Sizeof(azEndings)) / uint32(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+10770 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+10785 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -106778,7 +107285,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.Xmemcpy(tls, zAltEntry, ts+14408 /* "sqlite3_" */, uint32(8)) + libc.Xmemcpy(tls, zAltEntry, ts+14423 /* "sqlite3_" */, uint32(8)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { @@ -106792,7 +107299,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14417 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14432 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -106816,7 +107323,7 @@ __17: goto __18 __18: ; - libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14421 /* "_init" */, uint32(6)) + libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14436 /* "_init" */, uint32(6)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -106834,7 +107341,7 @@ __10: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14427 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + ts+14442 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; @@ -106859,7 +107366,7 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14470 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14485 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) @@ -106899,7 +107406,7 @@ extension_not_found: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14502 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + ts+14517 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; @@ -106909,7 +107416,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 14539, /* "so" */ + ts + 14554, /* "so" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -107075,7 +107582,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+14542 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + ts+14557 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) @@ -107120,61 +107627,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 4156, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 14581, /* "seq" */ - /* 2 */ ts + 7808, /* "table" */ - /* 3 */ ts + 14585, /* "from" */ - /* 4 */ ts + 14590, /* "to" */ - /* 5 */ ts + 14593, /* "on_update" */ - /* 6 */ ts + 14603, /* "on_delete" */ - /* 7 */ ts + 14613, /* "match" */ - /* 8 */ ts + 14619, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 14623, /* "name" */ - /* 10 */ ts + 14628, /* "type" */ - /* 11 */ ts + 14633, /* "notnull" */ - /* 12 */ ts + 14641, /* "dflt_value" */ - /* 13 */ ts + 14652, /* "pk" */ - /* 14 */ ts + 14655, /* "hidden" */ + /* 0 */ ts + 4171, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 14596, /* "seq" */ + /* 2 */ ts + 7823, /* "table" */ + /* 3 */ ts + 14600, /* "from" */ + /* 4 */ ts + 14605, /* "to" */ + /* 5 */ ts + 14608, /* "on_update" */ + /* 6 */ ts + 14618, /* "on_delete" */ + /* 7 */ ts + 14628, /* "match" */ + /* 8 */ ts + 14634, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 14638, /* "name" */ + /* 10 */ ts + 14643, /* "type" */ + /* 11 */ ts + 14648, /* "notnull" */ + /* 12 */ ts + 14656, /* "dflt_value" */ + /* 13 */ ts + 14667, /* "pk" */ + /* 14 */ ts + 14670, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 14662, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 14619, /* "cid" */ - /* 17 */ ts + 14623, /* "name" */ - /* 18 */ ts + 14668, /* "desc" */ - /* 19 */ ts + 14673, /* "coll" */ - /* 20 */ ts + 14678, /* "key" */ - /* 21 */ ts + 14623, /* "name" */ // Used by: function_list - /* 22 */ ts + 14682, /* "builtin" */ - /* 23 */ ts + 14628, /* "type" */ - /* 24 */ ts + 14690, /* "enc" */ - /* 25 */ ts + 14694, /* "narg" */ - /* 26 */ ts + 14699, /* "flags" */ - /* 27 */ ts + 10201, /* "tbl" */ // Used by: stats - /* 28 */ ts + 10197, /* "idx" */ - /* 29 */ ts + 14705, /* "wdth" */ - /* 30 */ ts + 14710, /* "hght" */ - /* 31 */ ts + 14715, /* "flgs" */ - /* 32 */ ts + 14581, /* "seq" */ // Used by: index_list - /* 33 */ ts + 14623, /* "name" */ - /* 34 */ ts + 14720, /* "unique" */ - /* 35 */ ts + 14727, /* "origin" */ - /* 36 */ ts + 14734, /* "partial" */ - /* 37 */ ts + 7808, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 14742, /* "rowid" */ - /* 39 */ ts + 4159, /* "parent" */ - /* 40 */ ts + 14748, /* "fkid" */ + /* 15 */ ts + 14677, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 14634, /* "cid" */ + /* 17 */ ts + 14638, /* "name" */ + /* 18 */ ts + 14683, /* "desc" */ + /* 19 */ ts + 14688, /* "coll" */ + /* 20 */ ts + 14693, /* "key" */ + /* 21 */ ts + 14638, /* "name" */ // Used by: function_list + /* 22 */ ts + 14697, /* "builtin" */ + /* 23 */ ts + 14643, /* "type" */ + /* 24 */ ts + 14705, /* "enc" */ + /* 25 */ ts + 14709, /* "narg" */ + /* 26 */ ts + 14714, /* "flags" */ + /* 27 */ ts + 10216, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10212, /* "idx" */ + /* 29 */ ts + 14720, /* "wdth" */ + /* 30 */ ts + 14725, /* "hght" */ + /* 31 */ ts + 14730, /* "flgs" */ + /* 32 */ ts + 14596, /* "seq" */ // Used by: index_list + /* 33 */ ts + 14638, /* "name" */ + /* 34 */ ts + 14735, /* "unique" */ + /* 35 */ ts + 14742, /* "origin" */ + /* 36 */ ts + 14749, /* "partial" */ + /* 37 */ ts + 7823, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 14757, /* "rowid" */ + /* 39 */ ts + 4174, /* "parent" */ + /* 40 */ ts + 14763, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 14581, /* "seq" */ // Used by: database_list - /* 42 */ ts + 14623, /* "name" */ - /* 43 */ ts + 14753, /* "file" */ - /* 44 */ ts + 14758, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 14763, /* "log" */ - /* 46 */ ts + 14767, /* "checkpointed" */ + /* 41 */ ts + 14596, /* "seq" */ // Used by: database_list + /* 42 */ ts + 14638, /* "name" */ + /* 43 */ ts + 14768, /* "file" */ + /* 44 */ ts + 14773, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 14778, /* "log" */ + /* 46 */ ts + 14782, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 14780, /* "database" */ // Used by: lock_status - /* 48 */ ts + 14789, /* "status" */ - /* 49 */ ts + 14796, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 14795, /* "database" */ // Used by: lock_status + /* 48 */ ts + 14804, /* "status" */ + /* 49 */ ts + 14811, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 14807, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 14822, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -107190,234 +107697,234 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [65]PragmaName{ - { /* zName: */ FzName: ts + 14815, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 14830, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14830, /* "application_id" */ + { /* zName: */ FzName: ts + 14845, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 14845, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 14860, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14857, /* "automatic_index" */ + { /* zName: */ FzName: ts + 14872, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 14873, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 14888, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 14796, /* "cache_size" */ + { /* zName: */ FzName: ts + 14811, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14886, /* "cache_spill" */ + { /* zName: */ FzName: ts + 14901, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14898, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 14913, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 14918, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 14933, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 14934, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 14949, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 14955, /* "collation_list" */ + { /* zName: */ FzName: ts + 14970, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 14970, /* "compile_options" */ + { /* zName: */ FzName: ts + 14985, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14986, /* "count_changes" */ + { /* zName: */ FzName: ts + 15001, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 15000, /* "data_version" */ + { /* zName: */ FzName: ts + 15015, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 15013, /* "database_list" */ + { /* zName: */ FzName: ts + 15028, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15027, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 15042, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15046, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 15061, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 15065, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 15080, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 15088, /* "encoding" */ + { /* zName: */ FzName: ts + 15103, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15097, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 15112, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 15115, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 15130, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 15132, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 15147, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 15145, /* "freelist_count" */ + { /* zName: */ FzName: ts + 15160, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 15160, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 15175, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 15178, /* "fullfsync" */ + { /* zName: */ FzName: ts + 15193, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 15188, /* "function_list" */ + { /* zName: */ FzName: ts + 15203, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15202, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 15217, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15218, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 15233, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 15243, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 15258, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 15262, /* "index_info" */ + { /* zName: */ FzName: ts + 15277, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15273, /* "index_list" */ + { /* zName: */ FzName: ts + 15288, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 15284, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 15299, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15296, /* "integrity_check" */ + { /* zName: */ FzName: ts + 15311, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15312, /* "journal_mode" */ + { /* zName: */ FzName: ts + 15327, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15325, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 15340, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15344, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 15359, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 15363, /* "locking_mode" */ + { /* zName: */ FzName: ts + 15378, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15376, /* "max_page_count" */ + { /* zName: */ FzName: ts + 15391, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15391, /* "mmap_size" */ + { /* zName: */ FzName: ts + 15406, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 15401, /* "module_list" */ + { /* zName: */ FzName: ts + 15416, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15413, /* "optimize" */ + { /* zName: */ FzName: ts + 15428, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 15422, /* "page_count" */ + { /* zName: */ FzName: ts + 15437, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15433, /* "page_size" */ + { /* zName: */ FzName: ts + 15448, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15443, /* "pragma_list" */ + { /* zName: */ FzName: ts + 15458, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15455, /* "query_only" */ + { /* zName: */ FzName: ts + 15470, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 15466, /* "quick_check" */ + { /* zName: */ FzName: ts + 15481, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15478, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 15493, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 15495, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 15510, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 15514, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 15529, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 15540, /* "schema_version" */ + { /* zName: */ FzName: ts + 15555, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 15555, /* "secure_delete" */ + { /* zName: */ FzName: ts + 15570, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15569, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 15584, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 15588, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 15603, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 15602, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 15617, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15618, /* "synchronous" */ + { /* zName: */ FzName: ts + 15633, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15630, /* "table_info" */ + { /* zName: */ FzName: ts + 15645, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15641, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 15656, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15653, /* "temp_store" */ + { /* zName: */ FzName: ts + 15668, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15664, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 15679, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 15685, /* "threads" */ + { /* zName: */ FzName: ts + 15700, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15693, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 15708, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 15708, /* "user_version" */ + { /* zName: */ FzName: ts + 15723, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 15721, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 15736, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 15740, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 15755, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15755, /* "writable_schema" */ + { /* zName: */ FzName: ts + 15770, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -107454,7 +107961,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 15771 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 15786 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -107471,10 +107978,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+15796 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15811 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15806 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15821 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -107487,13 +107994,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+15813 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15828 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15818 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15833 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+15823 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15838 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -107511,9 +108018,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+14753 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+14768 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+15835 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+15850 /* "memory" */) == 0 { return 2 } else { return 0 @@ -107529,7 +108036,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+15842 /* "temporary storag..." */, 0) + ts+15857 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpBt) @@ -107629,19 +108136,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 15904 /* "SET NULL" */ + zName = ts + 15919 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 15913 /* "SET DEFAULT" */ + zName = ts + 15928 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 15925 /* "CASCADE" */ + zName = ts + 15940 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 15933 /* "RESTRICT" */ + zName = ts + 15948 /* "RESTRICT" */ break default: - zName = ts + 15942 /* "NO ACTION" */ + zName = ts + 15957 /* "NO ACTION" */ break } return zName @@ -107659,7 +108166,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 15952 /* "delete" */, ts + 15959 /* "persist" */, ts + 15967 /* "off" */, ts + 15971 /* "truncate" */, ts + 15835 /* "memory" */, ts + 15980, /* "wal" */ + ts + 15967 /* "delete" */, ts + 15974 /* "persist" */, ts + 15982 /* "off" */, ts + 15986 /* "truncate" */, ts + 15850 /* "memory" */, ts + 15995, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -107705,13 +108212,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 15984 /* "w" */ + zType = ts + 15999 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 15986 /* "a" */ + zType = ts + 16001 /* "a" */ } else { - zType = ts + 15988 /* "s" */ + zType = ts + 16003 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15990, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16005, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -107720,7 +108227,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 15997 /* "utf8" */, ts + 16002 /* "utf16le" */, ts + 16010 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16012 /* "utf8" */, ts + 16017 /* "utf16le" */, ts + 16025 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -107982,7 +108489,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+16018 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+16033 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -108037,7 +108544,7 @@ __8: if !(*(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 364 /* &aFcntl[0] */))) __10: ; @@ -108609,7 +109116,7 @@ __18: if !(zRight != 0) { goto __62 } - if !(Xsqlite3_stricmp(tls, zRight, ts+16022 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+16037 /* "fast" */) == 0) { goto __63 } b = 2 @@ -108698,7 +109205,7 @@ __70: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 15806 /* "normal" */ + zRet = ts + 15821 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -108739,7 +109246,7 @@ __77: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __82 } - zRet = ts + 15796 /* "exclusive" */ + zRet = ts + 15811 /* "exclusive" */ __82: ; returnSingleText(tls, v, zRet) @@ -109104,7 +109611,7 @@ __122: if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 416 /* res */)) == 0)) { goto __125 } - Xsqlite3ErrorMsg(tls, pParse, ts+16027 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16042 /* "not a writable d..." */, 0) goto pragma_out __125: ; @@ -109122,7 +109629,7 @@ __126: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __127 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+16, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+16, zRight)) goto __128 __127: Xsqlite3_temp_directory = uintptr(0) @@ -109150,7 +109657,7 @@ __129: goto __131 } Xsqlite3ErrorMsg(tls, pParse, - ts+16052 /* "Safety level may..." */, 0) + ts+16067 /* "Safety level may..." */, 0) goto __132 __131: if !(iDb != 1) { @@ -109309,13 +109816,13 @@ __153: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 16105 /* "issisii" */ + return ts + 16120 /* "issisii" */ } - return ts + 16113 /* "issisi" */ + return ts + 16128 /* "issisi" */ }(), libc.VaList(bp+24, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -109390,7 +109897,7 @@ __165: goto __167 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16120 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16135 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -109400,7 +109907,7 @@ __165: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __168 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16125, /* "isiX" */ + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16140, /* "isiX" */ libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*4)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) @@ -109437,8 +109944,8 @@ __171: if !(pIdx1 != 0) { goto __173 } - *(*[3]uintptr)(unsafe.Pointer(bp + 420 /* azOrigin */)) = [3]uintptr{ts + 16130 /* "c" */, ts + 16132 /* "u" */, ts + 14652 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16134, /* "isisi" */ + *(*[3]uintptr)(unsafe.Pointer(bp + 420 /* azOrigin */)) = [3]uintptr{ts + 16145 /* "c" */, ts + 16147 /* "u" */, ts + 14667 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16149, /* "isisi" */ libc.VaList(bp+128, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), @@ -109472,7 +109979,7 @@ __174: __177: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16140, /* "iss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16155, /* "iss" */ libc.VaList(bp+168, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*16)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*16)).FpBt))) @@ -109495,7 +110002,7 @@ __178: goto __180 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16144 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16159 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __179 __179: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -109559,7 +110066,7 @@ __190: goto __192 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15988 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16003 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __191 __191: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -109576,7 +110083,7 @@ __193: if !(i6 < (int32(uint32(unsafe.Sizeof(aPragmaName)) / uint32(unsafe.Sizeof(PragmaName{}))))) { goto __195 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15988 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16003 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) goto __194 __194: i6++ @@ -109612,7 +110119,7 @@ __201: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __203 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16147, /* "iissssss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16162, /* "iissssss" */ libc.VaList(bp+224, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, @@ -109620,7 +110127,7 @@ __201: (*sColMap)(unsafe.Pointer((pFK+36 /* &.aCol */)+uintptr(j2)*8)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 25 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 25 /* &.aAction */)))), // ON DELETE - ts+16156 /* "NONE" */)) + ts+16171 /* "NONE" */)) goto __202 __202: j2++ @@ -109813,7 +110320,7 @@ __230: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __231: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16161 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16176 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 436 /* aiCols */))) @@ -110079,7 +110586,7 @@ __258: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+16165 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*16)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+16180 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*16)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -110169,7 +110676,7 @@ __277: __278: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+16189 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+16204 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*20)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -110209,7 +110716,7 @@ __283: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+16209, /* "CHECK constraint..." */ + zErr1 = Xsqlite3MPrintf(tls, db, ts+16224, /* "CHECK constraint..." */ libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) @@ -110243,9 +110750,9 @@ __288: // Verify that an index entry exists for the current table row jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 448 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16239 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16254 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+16244 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16259 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -110285,7 +110792,7 @@ __292: Xsqlite3VdbeJumpHere(tls, v, jmp6) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 448 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16265 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16280 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __289: @@ -110307,7 +110814,7 @@ __284: if !(!(isQuick != 0)) { goto __294 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+16292 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+16307 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __295: @@ -110358,7 +110865,7 @@ __240: } (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 440 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*20)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16 /* &.p4 */)) = ts + 16321 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*20 + 16 /* &.p4 */)) = ts + 16336 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*20)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*20 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __299: @@ -110436,7 +110943,7 @@ __306: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __308 } - Xsqlite3ErrorMsg(tls, pParse, ts+16324 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+16339 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) __308: ; __303: @@ -110548,19 +111055,19 @@ __47: if !(zRight != 0) { goto __315 } - if !(Xsqlite3StrICmp(tls, zRight, ts+15818 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15833 /* "full" */) == 0) { goto __316 } eMode2 = SQLITE_CHECKPOINT_FULL goto __317 __316: - if !(Xsqlite3StrICmp(tls, zRight, ts+16349 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16364 /* "restart" */) == 0) { goto __318 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __319 __318: - if !(Xsqlite3StrICmp(tls, zRight, ts+15971 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15986 /* "truncate" */) == 0) { goto __320 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -110747,7 +111254,7 @@ __335: __337: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+16357, /* "ANALYZE \"%w\".\"%w..." */ + zSubSql = Xsqlite3MPrintf(tls, db, ts+16372, /* "ANALYZE \"%w\".\"%w..." */ libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __338 @@ -110931,14 +111438,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 16375 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 16380 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 16386 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 16395 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 16404 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 16412 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 16420 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 16427 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16390 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16395 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16401 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16410 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16419 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16427 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16435 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16442 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -110995,7 +111502,7 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argc _ = argv Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+56 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16433 /* "CREATE TABLE x" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16448 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -111003,7 +111510,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16448 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16463 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -111016,19 +111523,19 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16455 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16470 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16461 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16476 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16473 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16488 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4066 /* ")" */, 1) Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) rc = Xsqlite3_declare_vtab(tls, db, bp+56 /* &zBuf[0] */) @@ -111044,7 +111551,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -111207,7 +111714,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + uintptr(j)*4)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + uintptr(j)*4)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + uintptr(j)*4)) == uintptr(0) { return SQLITE_NOMEM } @@ -111223,13 +111730,13 @@ __2: __3: ; Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 112 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16488 /* "PRAGMA " */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16503 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + 1*4)) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16496 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + 1*4)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16511 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */) + 1*4)))) } Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16500 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16515 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 16 /* &.azArg */))))) } zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { @@ -111238,7 +111745,7 @@ __3: rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 4 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -111331,12 +111838,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+16504 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), + ts+16519 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*4)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 16532 /* "rename" */ + return ts + 16547 /* "rename" */ } - return ts + 16539 /* "drop column" */ + return ts + 16554 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -111348,11 +111855,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*4)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*4)) } else { - zObj = ts + 4107 /* "?" */ + zObj = ts + 4122 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+16551 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+16566 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+16582 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+16597 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -111429,7 +111936,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), (db+164 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12835 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12850 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+164 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -111466,13 +111973,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*4)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+16590 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+16605 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)), (pIndex+44 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12835 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12850 /* "invalid rootpage" */) } } } @@ -111515,16 +112022,16 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7808 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7823 /* "table" */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*4)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*4)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*4)) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*4)) = ts + 6898 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*4)) = ts + 16603 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*4)) = ts + 6913 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*4)) = ts + 16618 /* "CREATE TABLE x(t..." */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*4)) = uintptr(0) (*InitData)(unsafe.Pointer(bp + 40 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 40 /* &initData */)).FiDb = iDb @@ -111637,7 +112144,7 @@ __10: goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+10484 /* "attached databas..." */) + ts+10499 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -111677,7 +112184,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+16675 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+16690 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -111699,7 +112206,7 @@ __18: (*InitData)(unsafe.Pointer(bp + 40 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+16699, /* "SELECT*FROM\"%w\"...." */ + ts+16714, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth @@ -112059,7 +112566,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*16)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+16733 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+16748 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -112087,7 +112594,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16763 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16778 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -112150,7 +112657,7 @@ __19: if !(*(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */)))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErrMsg */))) goto __21 __20: @@ -112625,24 +113132,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 9637 /* " " */ + var zSp uintptr = ts + 9652 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+16782 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+16797 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+16826 /* "RIGHT and FULL O..." */, 0) + ts+16841 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16881 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16896 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -112848,7 +113355,7 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16915 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+16930 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { @@ -112872,7 +113379,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16965 /* "cannot have both..." */, 0) + ts+16980 /* "cannot have both..." */, 0) return 1 } @@ -112907,7 +113414,7 @@ __1: if (iRightCol < 0) || !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17020 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + ts+17035 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, @@ -113698,16 +114205,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 17084 /* "UNION ALL" */ + z = ts + 17099 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 17094 /* "INTERSECT" */ + z = ts + 17109 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 17104 /* "EXCEPT" */ + z = ts + 17119 /* "EXCEPT" */ break default: - z = ts + 17111 /* "UNION" */ + z = ts + 17126 /* "UNION" */ break } return z @@ -113725,7 +114232,7 @@ func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite bp := tls.Alloc(8) defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17117 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17132 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -113991,8 +114498,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 11369 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 40 /* zOrigCol */)) = ts + 14742 /* "rowid" */ + zType = ts + 11384 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 40 /* zOrigCol */)) = ts + 14757 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 40 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20), uintptr(0)) @@ -114145,13 +114652,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 14742 /* "rowid" */ + zCol = ts + 14757 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -114159,7 +114666,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*20)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+17140 /* "column%d" */, libc.VaList(bp+16, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+17155 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -114248,7 +114755,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20)).FzName } else { - zName = ts + 14742 /* "rowid" */ + zName = ts + 14757 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -114261,7 +114768,7 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+17140 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+17155 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, @@ -114276,7 +114783,7 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+17149 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 48 /* cnt */)), 1))) + zName = Xsqlite3MPrintf(tls, db, ts+17164 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 48 /* cnt */)), 1))) if *(*U32)(unsafe.Pointer(bp + 48 /* cnt */)) > U32(3) { Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+48 /* &cnt */) } @@ -114633,7 +115140,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+17157 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17172 /* "cannot use windo..." */, 0) return __1: ; @@ -114744,7 +115251,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+17206 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17221 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -114766,7 +115273,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17248 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17263 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -114809,7 +115316,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17254 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17269 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -114859,11 +115366,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17269 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17284 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 17292 /* "S" */ + return ts + 17307 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -115015,8 +115522,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17294 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17309 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17309 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17324 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -115065,7 +115572,7 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17084 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17099 /* "UNION ALL" */, 0) rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) @@ -115141,7 +115648,7 @@ __23: pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 48 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17328 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17343 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+48 /* &uniondest */) @@ -115213,7 +115720,7 @@ __26: pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 76 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17328 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17343 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+76 /* &intersectdest */) @@ -115374,10 +115881,10 @@ func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17349 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17364 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+17395, /* "SELECTs to the l..." */ + ts+17410, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -115757,9 +116264,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6236 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6251 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6236 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6251 /* "ORDER" */) } // Compute the limit registers @@ -115788,7 +116295,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) Xsqlite3SelectDestInit(tls, bp+36 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17477 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17492 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -115796,7 +116303,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17488 /* "LEFT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17503 /* "LEFT" */, 0) Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -115810,7 +116317,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17493 /* "RIGHT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17508 /* "RIGHT" */, 0) Xsqlite3Select(tls, pParse, p, bp+36 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -116006,7 +116513,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 303 /* "BINARY" */ + return ts + 318 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -117219,12 +117726,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+13824 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+13839 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+13828 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+13843 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -117293,7 +117800,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+17499 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+17514 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -117404,7 +117911,7 @@ func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* s defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 36 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17517 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17532 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -117592,7 +118099,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+36 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+17540 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+17555 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -117608,7 +118115,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17583 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17598 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { @@ -117634,7 +118141,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+17606, /* "table %s has %d ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17621, /* "table %s has %d ..." */ libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 @@ -117645,9 +118152,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 42 /* &.nCol */), (pTab + 4 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17644 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17659 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17678 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17693 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -117695,7 +118202,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17716 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17731 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -117822,7 +118329,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+17728, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17743, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -117841,7 +118348,7 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*16)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+17767, /* "access to view \"..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17782, /* "access to view \"..." */ libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -117849,7 +118356,7 @@ __1: ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 36 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+17798, /* "unsafe use of vi..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17813, /* "unsafe use of vi..." */ libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) @@ -117964,7 +118471,7 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName } else { - zSchemaName = ts + 17831 /* "*" */ + zSchemaName = ts + 17846 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { @@ -118013,7 +118520,7 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { @@ -118029,7 +118536,7 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*20)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17833, /* "%s.%s.%s" */ + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17848, /* "%s.%s.%s" */ libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } @@ -118049,9 +118556,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17842 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17857 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+17860 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17875 /* "no tables specif..." */, 0) } } } @@ -118061,7 +118568,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+17880 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17895 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -118249,13 +118756,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 20 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 20 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+17911 /* "DISTINCT aggrega..." */, 0) + ts+17926 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 20 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17962 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17977 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -118455,19 +118962,19 @@ func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintpt if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 56 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17995, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18010, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 18007 /* " USING COVERING ..." */ + return ts + 18022 /* " USING COVERING ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) } } @@ -118487,7 +118994,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6898 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6913 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -118789,7 +119296,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+18030, /* "target object/al..." */ + ts+18045, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -118869,7 +119376,7 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18084, /* "expected %d colu..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18099, /* "expected %d colu..." */ libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: @@ -119010,7 +119517,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+740 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+755 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -119075,7 +119582,7 @@ __35: (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop Xsqlite3SelectDestInit(tls, bp+88 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18124 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18139 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+88 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+36 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) @@ -119137,7 +119644,7 @@ __44: __45: ; Xsqlite3SelectDestInit(tls, bp+88 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18139 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18154 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+88 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { @@ -119657,9 +120164,9 @@ __97: explainTempTable(tls, pParse, func() uintptr { if ((*DistinctCtx)(unsafe.Pointer(bp+116 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 18155 /* "DISTINCT" */ + return ts + 18170 /* "DISTINCT" */ } - return ts + 18164 /* "GROUP BY" */ + return ts + 18179 /* "GROUP BY" */ }()) groupBySort = 1 @@ -120071,7 +120578,7 @@ __58: if !(int32((*DistinctCtx)(unsafe.Pointer(bp+116 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+18155 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+18170 /* "DISTINCT" */) __140: ; @@ -120083,9 +120590,9 @@ __140: explainTempTable(tls, pParse, func() uintptr { if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { - return ts + 18173 /* "RIGHT PART OF OR..." */ + return ts + 18188 /* "RIGHT PART OF OR..." */ } - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ }()) generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) @@ -120218,7 +120725,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*4)))) + z = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*4)))) if !(z == uintptr(0)) { goto __10 } @@ -120240,7 +120747,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+18205 /* "sqlite3_get_tabl..." */, 0) + ts+18220 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -120339,7 +120846,7 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } @@ -120500,7 +121007,7 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+18270 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18285 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; @@ -120561,7 +121068,7 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+36 /* &sFix */, pParse, iDb, ts+18316 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3FixInit(tls, bp+36 /* &sFix */, pParse, iDb, ts+18331 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+36 /* &sFix */, pTableName) != 0) { goto __9 } @@ -120579,7 +121086,7 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+18324 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18339 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; @@ -120594,7 +121101,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18316 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18331 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -120610,7 +121117,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+18365 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+18380 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -120624,10 +121131,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18391 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18406 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -120637,12 +121144,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+18429, /* "cannot create %s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18444, /* "cannot create %s..." */ libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 18466 /* "BEFORE" */ + return ts + 18481 /* "BEFORE" */ } - return ts + 18473 /* "AFTER" */ + return ts + 18488 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -120651,7 +121158,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+18479 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + ts+18494 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -120681,9 +121188,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -120817,7 +121324,7 @@ __2: __3: ; Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+48 /* &sFix */, pParse, iDb, ts+18316 /* "trigger" */, bp+40 /* &nameToken */) + Xsqlite3FixInit(tls, bp+48 /* &sFix */, pParse, iDb, ts+18331 /* "trigger" */, bp+40 /* &nameToken */) if !((Xsqlite3FixTriggerStep(tls, bp+48 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || (Xsqlite3FixExpr(tls, bp+48 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 @@ -120854,13 +121361,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+18525, /* "INSERT INTO %Q.s..." */ + ts+18540, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+18600 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+18615 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -121126,7 +121633,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+18629 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+18644 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -121167,9 +121674,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -121182,7 +121689,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+18649, /* "DELETE FROM %Q.s..." */ + ts+18664, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -121301,12 +121808,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+18711, /* "%s RETURNING is ..." */ + ts+18726, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 18759 /* "DELETE" */ + return ts + 18774 /* "DELETE" */ } - return ts + 18766 /* "UPDATE" */ + return ts + 18781 /* "UPDATE" */ }())) __15: ; @@ -121402,7 +121909,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+18773 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18788 /* "RETURNING may no..." */, 0) return 1 } @@ -121543,7 +122050,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+5128 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+5143 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -121673,7 +122180,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+18815 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+18830 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -122376,7 +122883,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+18829, /* "cannot UPDATE ge..." */ + ts+18844, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*20)).FzName)) goto update_cleanup __27: @@ -122408,7 +122915,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+18865 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*20)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18880 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*20)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -122419,7 +122926,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 6673 /* "ROWID" */ + return ts + 6688 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*20)).FzName }(), @@ -123450,7 +123957,7 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18884 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18899 /* "rows updated" */, uintptr(0)) __169: ; @@ -123837,10 +124344,10 @@ __1: if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { *(*int8)(unsafe.Pointer(bp + 152 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+152 /* &zWhich[0] */, ts+18897 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+152 /* &zWhich[0] */, ts+18912 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+18901 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+152 /* &zWhich[0] */)) + ts+18916 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+152 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -123931,7 +124438,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+10911 /* "corrupt database" */, -1) + ts+10926 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -123999,7 +124506,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+18974 /* "CRE" */, uint32(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18978 /* "INS" */, uint32(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+18989 /* "CRE" */, uint32(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18993 /* "INS" */, uint32(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -124149,14 +124656,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+18982 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+18997 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19022 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19037 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -124167,7 +124674,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19065 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19080 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -124176,7 +124683,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 60 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 740 /* "" */ + zOut = ts + 755 /* "" */ __4: ; @@ -124212,7 +124719,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+19083 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+19098 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -124233,7 +124740,7 @@ __6: goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+19106 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19121 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -124249,7 +124756,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+13198 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+13213 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -124300,7 +124807,7 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+19133, /* "SELECT sql FROM ..." */ + ts+19148, /* "SELECT sql FROM ..." */ libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 @@ -124310,7 +124817,7 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+19241, /* "SELECT sql FROM ..." */ + ts+19256, /* "SELECT sql FROM ..." */ libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 @@ -124325,7 +124832,7 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+19295, /* "SELECT'INSERT IN..." */ + ts+19310, /* "SELECT'INSERT IN..." */ libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 24 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) @@ -124342,7 +124849,7 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+19446, /* "INSERT INTO vacu..." */ + ts+19461, /* "INSERT INTO vacu..." */ libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 @@ -124722,7 +125229,7 @@ func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintp var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 112 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11141 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11156 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -124816,7 +125323,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32(((int32((*Token)(unsafe.Pointer(pEnd)).Fz) - int32((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1)) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+19576 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+180 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+19591 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+180 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -124828,7 +125335,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+19600, /* "UPDATE %Q.sqlite..." */ + ts+19615, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*16)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -124838,7 +125345,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+19699 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+19714 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -124903,7 +125410,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+19718 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+19733 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -124941,9 +125448,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19760 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19775 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2775 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2790 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) @@ -124955,7 +125462,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 19790 /* "vtable construct..." */ + var zFormat uintptr = ts + 19805 /* "vtable construct..." */ *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR @@ -124971,12 +125478,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20), ts+740 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*20), ts+755 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+14655 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+14670 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -125035,13 +125542,13 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+19836 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+19851 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) @@ -125103,7 +125610,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19836 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19851 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -125180,7 +125687,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 280 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 280 /* zErr */)))) @@ -125552,7 +126059,7 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 @@ -125982,10 +126489,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 19855 /* "" */ + return ts + 19870 /* "" */ } if i == (-1) { - return ts + 14742 /* "rowid" */ + return ts + 14757 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*20)).FzName } @@ -126000,35 +126507,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+19862 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19877 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19868 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19883 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11537 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19868 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19883 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11537 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+4107 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4122 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } } @@ -126057,29 +126564,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+19870 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+19885 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+19862 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19877 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 19873 /* "%s=?" */ + return ts + 19888 /* "%s=?" */ } - return ts + 19878 /* "ANY(%s)" */ + return ts + 19893 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19886 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19901 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19888 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19903 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -126124,11 +126631,11 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+72 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19890 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19905 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 19896 /* "SEARCH" */ + return ts + 19911 /* "SEARCH" */ } - return ts + 19903 /* "SCAN" */ + return ts + 19918 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -126138,38 +126645,38 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 56 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 9685 /* "PRIMARY KEY" */ + zFmt = ts + 9700 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 19908 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 19923 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 19941 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 19956 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 19966 /* "COVERING INDEX %..." */ + zFmt = ts + 19981 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 19984 /* "INDEX %s" */ + zFmt = ts + 19999 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+48 /* &str */, ts+19993 /* " USING " */, 7) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20008 /* " USING " */, 7) Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 20001 /* "=" */ + zRangeOp = ts + 20016 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 20003 /* ">? AND rowid<" */ + zRangeOp = ts + 20018 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 19886 /* ">" */ + zRangeOp = ts + 19901 /* ">" */ } else { - zRangeOp = ts + 19888 /* "<" */ + zRangeOp = ts + 19903 /* "<" */ } Xsqlite3_str_appendf(tls, bp+48, /* &str */ - ts+20017 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + ts+20032 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20055, /* " VIRTUAL TABLE I..." */ + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20070, /* " VIRTUAL TABLE I..." */ libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) @@ -127725,7 +128232,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20082 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20097 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*48) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -127744,7 +128251,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20097 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20112 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -128493,10 +129000,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 14613 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 14086 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 13636 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 20106 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 14628 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14101 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 13651 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20121 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -129197,7 +129704,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+20113 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20128 /* "ON clause refere..." */, 0) return } } @@ -129273,7 +129780,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5760 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5775 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -129374,7 +129881,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 16 /* noCase */)) != 0 { - return ts + 20154 /* "NOCASE" */ + return ts + 20169 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -129676,7 +130183,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+20161, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+20176, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -130499,7 +131006,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+20197 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+20212 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*20)).FzName)) sentWarning = U8(1) __6: @@ -130580,7 +131087,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20223 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20238 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -130813,7 +131320,7 @@ __3: ((uint32(unsafe.Sizeof(sqlite3_index_constraint{})) + uint32(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint32(nTerm))) + (uint32(unsafe.Sizeof(sqlite3_index_orderby{})) * uint32(nOrderBy))) + uint32(unsafe.Sizeof(HiddenIndexInfo1{}))))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5166 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5181 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*72) @@ -130940,9 +131447,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -132992,7 +133499,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*4)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20234 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20249 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -133040,7 +133547,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*4)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+20234 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20249 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -133429,7 +133936,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+20260 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+20275 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -134198,7 +134705,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+20295 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20310 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -134579,7 +135086,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint32(unsafe.Sizeof(Bitmask(0))) * uint32(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+20313 /* "at most %d table..." */, libc.VaList(bp, (int32(uint32(unsafe.Sizeof(Bitmask(0)))*uint32(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+20328 /* "at most %d table..." */, libc.VaList(bp, (int32(uint32(unsafe.Sizeof(Bitmask(0)))*uint32(8))))) return uintptr(0) __3: ; @@ -134654,7 +135161,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20341 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20356 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -135790,7 +136297,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+20359 /* "second argument ..." */, -1) + pCtx, ts+20374 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -135939,7 +136446,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+20415 /* "argument of ntil..." */, -1) + pCtx, ts+20430 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -136035,17 +136542,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20460 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20471 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20482 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20487 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20500 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20510 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20516 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20527 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20537 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20549 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20554 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20475 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20486 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20497 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20502 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20515 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20525 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20531 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20542 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20552 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20564 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20569 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -136109,7 +136616,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20558 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20573 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -136153,12 +136660,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+20577 /* "RANGE with offse..." */, 0) + ts+20592 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20648 /* "FILTER clause ma..." */, 0) + ts+20663 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -136181,7 +136688,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*16)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6898 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6913 /* "1" */) } break } @@ -136422,7 +136929,7 @@ func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+6959 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+6974 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -136552,7 +137059,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 28 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 28 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -136692,7 +137199,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+20711 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20726 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -136758,15 +137265,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 20743 /* "PARTITION clause" */ + zErr = ts + 20758 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 20760 /* "ORDER BY clause" */ + zErr = ts + 20775 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 20776 /* "frame specificat..." */ + zErr = ts + 20791 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20796 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+20811 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -136789,7 +137296,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+20829 /* "DISTINCT is not ..." */, 0) + ts+20844 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -136940,7 +137447,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -136962,11 +137469,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 20876, /* "frame starting o..." */ - ts + 20929, /* "frame ending off..." */ - ts + 20359, /* "second argument ..." */ - ts + 20980, /* "frame starting o..." */ - ts + 21032, /* "frame ending off..." */ + ts + 20891, /* "frame starting o..." */ + ts + 20944, /* "frame ending off..." */ + ts + 20374, /* "second argument ..." */ + ts + 20995, /* "frame starting o..." */ + ts + 21047, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -137567,7 +138074,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -138580,19 +139087,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21082, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21097, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ } - return ts + 21124 /* "LIMIT" */ + return ts + 21139 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 112 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+21130 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21145 /* "too many terms i..." */, 0) } } @@ -138672,7 +139179,7 @@ func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdT var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21164, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21179, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -139897,7 +140404,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+21202 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21217 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -140876,11 +141383,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz, ts+14742 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz, ts+14757 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+21224 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+21239 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+4 /* &.minor */)).Fz)) } } break @@ -141615,7 +142122,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*12 + 4 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)), ts+21251 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)), ts+21266 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*12 + 4 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 4 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*12 + 4 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -141768,7 +142275,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(bp + 68 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 4 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21260 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+68 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21275 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+68 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 4 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 4 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) @@ -141972,9 +142479,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*12 + 4 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*12 + 4 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*12 + 4 /* &.minor */)) != 0 { - return ts + 6898 /* "1" */ + return ts + 6913 /* "1" */ } - return ts + 6491 /* "0" */ + return ts + 6506 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*12 + 4 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -142249,21 +142756,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*12 + 4 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 4 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+21284 /* "qualified table ..." */, 0) + ts+21299 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21379 /* "the INDEXED BY c..." */, 0) + ts+21394 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21463 /* "the NOT INDEXED ..." */, 0) + ts+21478 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ @@ -142712,9 +143219,9 @@ func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor To _ = yymajor // Silence some compiler warnings if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21260 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21275 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21548 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21563 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -143921,7 +144428,7 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin *(*int32)(unsafe.Pointer(bp + 1252 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21565 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+21580 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } @@ -143941,12 +144448,12 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21592, /* "%s in \"%s\"" */ + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21607, /* "%s in \"%s\"" */ libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ @@ -144158,7 +144665,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21603 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21618 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -144171,11 +144678,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18316 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18331 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21610 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21625 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21615 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21630 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -144188,9 +144695,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21625 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21640 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21629 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21644 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -145218,7 +145725,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+21637 /* "unable to close ..." */, 0) + ts+21652 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -145440,23 +145947,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 21705 /* "unknown error" */ + var zErr uintptr = ts + 21720 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 21719 /* "abort due to ROL..." */ + zErr = ts + 21734 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 21741 /* "another row avai..." */ + zErr = ts + 21756 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 21763 /* "no more rows ava..." */ + zErr = ts + 21778 /* "no more rows ava..." */ break } @@ -145474,35 +145981,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 21786, /* "not an error" */ - /* SQLITE_ERROR */ ts + 21799, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 21801, /* "not an error" */ + /* SQLITE_ERROR */ ts + 21814, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 21815, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 21840, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 21854, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 21873, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 5166, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 21898, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 21935, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 21947, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 21962, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 21995, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 22013, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 22038, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 22067, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 21830, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 21855, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 21869, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 21888, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5181, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 21913, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 21950, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 21962, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 21977, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 22010, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22028, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22053, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22082, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 4896, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 4433, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 22084, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 22102, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 22120, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 4911, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4448, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22099, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22117, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22135, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 22154, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 22169, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 22175, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 22201, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 22224, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 22245, /* "warning message" */ + /* SQLITE_RANGE */ ts + 22190, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22216, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22239, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22260, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -145667,7 +146174,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22261 /* "unable to delete..." */, 0) + ts+22276 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -145800,7 +146307,7 @@ func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUs _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+22324 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+22339 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -146022,7 +146529,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22375 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22390 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -146241,7 +146748,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22396 /* "unable to delete..." */, 0) + ts+22411 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -146384,7 +146891,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22464 /* "file:" */, uint32(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22479 /* "file:" */, uint32(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -146432,10 +146939,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22470 /* "localhost" */, (zUri+7), uint32(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22485 /* "localhost" */, (zUri+7), uint32(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22480, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22495, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -146557,7 +147064,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22508 /* "vfs" */, zOpt, uint32(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22523 /* "vfs" */, zOpt, uint32(3)) == 0)) { goto __29 } zVfs = zVal @@ -146568,17 +147075,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22512 /* "cache" */, zOpt, uint32(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22527 /* "cache" */, zOpt, uint32(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 22512 /* "cache" */ + zModeType = ts + 22527 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22518 /* "mode" */, zOpt, uint32(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22533 /* "mode" */, zOpt, uint32(4)) == 0)) { goto __32 } @@ -146586,7 +147093,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 2384 /* "access" */ + zModeType = ts + 2399 /* "access" */ __32: ; @@ -146617,7 +147124,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22523 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22538 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -146625,7 +147132,7 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22543, /* "%s mode not allo..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22558, /* "%s mode not allo..." */ libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out @@ -146668,7 +147175,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22567 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22582 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -146691,15 +147198,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 22583 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 22590 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 22598 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 22605 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 22598 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 22601 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 22604 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 15835 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 22613 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 22616 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 22619 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 15850 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -146881,10 +147388,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+20154 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+20169 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+22608 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+22623 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -146930,7 +147437,7 @@ __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrMsg */)))) @@ -146968,9 +147475,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5443 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5458 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*16)).FzDbSName = ts + 21610 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*16)).FzDbSName = ts + 21625 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*16)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -147088,7 +147595,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 22614 /* "\x00\x00" */ + zFilename = ts + 22629 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -147191,24 +147698,24 @@ func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) bp := tls.Alloc(24) defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+22617, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+22632, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22642 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22657 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22662 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22677 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22669 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22684 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -147335,7 +147842,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 11369 /* "INTEGER" */ + zDataType = ts + 11384 /* "INTEGER" */ primarykey = 1 __13: ; @@ -147387,14 +147894,14 @@ __19: goto __20 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22686 /* "no such table co..." */, libc.VaList(bp, zTableName, + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22701 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -148193,7 +148700,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+22714 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+22729 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -148354,7 +148861,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 22722 /* "database is dead..." */ + return ts + 22737 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -149153,7 +149660,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 5243 /* "null" */, ts + 5755 /* "true" */, ts + 5760 /* "false" */, ts + 5253 /* "integer" */, ts + 5248 /* "real" */, ts + 13508 /* "text" */, ts + 22745 /* "array" */, ts + 22751, /* "object" */ + ts + 5258 /* "null" */, ts + 5770 /* "true" */, ts + 5775 /* "false" */, ts + 5268 /* "integer" */, ts + 5263 /* "real" */, ts + 13523 /* "text" */, ts + 22760 /* "array" */, ts + 22766, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -149333,7 +149840,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 22758 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 22773 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -149361,7 +149868,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+5258 /* "null" */, uint32(4)) break } @@ -149390,7 +149897,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22775 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22790 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -149467,19 +149974,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5258 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+5755 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5770 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+5760 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+5775 /* "false" */, uint32(5)) break } @@ -150045,17 +150552,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5243 /* "null" */, uint32(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5258 /* "null" */, uint32(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5755 /* "true" */, uint32(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5770 /* "true" */, uint32(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5760 /* "false" */, uint32(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5775 /* "false" */, uint32(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -150163,7 +150670,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+22804 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+22819 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -150483,7 +150990,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+22819 /* "[0]" */, uint32(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+22834 /* "[0]" */, uint32(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -150500,7 +151007,7 @@ func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190 bp := tls.Alloc(8) defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+22823 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+22838 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -150567,7 +151074,7 @@ func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlit bp := tls.Alloc(8) defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22849, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22864, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -150711,7 +151218,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+5258 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -150839,14 +151346,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+22892 /* "json_object() re..." */, -1) + ts+22907 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+22943 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+22958 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -150954,7 +151461,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+14019 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+14034 /* "replace" */) return __2: ; @@ -151040,9 +151547,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 22977 /* "set" */ + return ts + 22992 /* "set" */ } - return ts + 22981 /* "insert" */ + return ts + 22996 /* "insert" */ }()) return __2: @@ -151190,7 +151697,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22988 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23003 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -151295,7 +151802,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22991 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23006 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -151348,7 +151855,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+22994 /* "CREATE TABLE x(k..." */) + ts+23009 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -151486,14 +151993,14 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*12) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*12) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+23077 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+23092 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 12 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23082 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23097 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } @@ -151586,9 +152093,9 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+24 /* &x */, ts+23077 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23092 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23082 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23097 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } jsonResult(tls, bp+24 /* &x */) @@ -151612,7 +152119,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 23088 /* "$" */ + zRoot = ts + 23103 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -151744,7 +152251,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22804 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22819 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -151884,21 +152391,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 23090 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23095 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23106 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23106 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23124 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23137 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23149 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23161 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23172 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23183 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23195 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23208 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 23217 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23217 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23227 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23105 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23110 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23121 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23121 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23139 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23152 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23164 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23176 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23187 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23198 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23210 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23223 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23232 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23232 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23242 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -151907,17 +152414,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 23238 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 23253 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 23255 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 23270 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 23273 /* "json_each" */, FpModule: 0}, - {FzName: ts + 23283 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 23288 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23298 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -152264,11 +152771,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+23293 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23308 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23301 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23316 /* "data" */, iNode, 0, (pRtree + 76 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -152513,7 +153020,7 @@ func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+23306, /* "DROP TABLE '%q'...." */ + ts+23321, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -153273,7 +153780,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23388 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23403 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -153537,7 +154044,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+24 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+24 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -154797,7 +155304,7 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+23402 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+23417 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { @@ -154809,12 +155316,12 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if iCol == 0 { var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23422 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+23437 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23454 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+23469 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } @@ -155082,7 +155589,7 @@ func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqli var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+23491 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+23506 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -155120,7 +155627,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit bp := tls.Alloc(20) defer tls.Free(20) - var zFmt uintptr = ts + 23636 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 23651 /* "SELECT stat FROM..." */ var zSql uintptr // var p uintptr at bp+16, 4 @@ -155128,7 +155635,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10057 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10072 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -155181,7 +155688,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 23692 /* "node" */, ts + 4159 /* "parent" */, ts + 14742, /* "rowid" */ + ts + 23707 /* "node" */, ts + 4174 /* "parent" */, ts + 14757, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -155225,19 +155732,19 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+23697, /* "CREATE TABLE \"%w..." */ + ts+23712, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+23759 /* ",a%d" */, libc.VaList(bp+16, ii)) + Xsqlite3_str_appendf(tls, p, ts+23774 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+23764, /* ");CREATE TABLE \"..." */ + ts+23779, /* ");CREATE TABLE \"..." */ libc.VaList(bp+24, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23828, /* "CREATE TABLE \"%w..." */ + ts+23843, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23898, /* "INSERT INTO \"%w\"..." */ + ts+23913, /* "INSERT INTO \"%w\"..." */ libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { @@ -155268,7 +155775,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 23947 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 23962 /* "INSERT INTO\"%w\"...." */ } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { @@ -155280,7 +155787,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+24055, /* "SELECT * FROM \"%..." */ + ts+24070, /* "SELECT * FROM \"%..." */ libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM @@ -155288,18 +155795,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+24100 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+24115 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+11537 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+24127 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+24142 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+24149 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+24164 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+24157 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+24172 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -155315,18 +155822,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 24173, /* "INSERT OR REPLAC..." */ - ts + 24226, /* "DELETE FROM '%q'..." */ + ts + 24188, /* "INSERT OR REPLAC..." */ + ts + 24241, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 24271, /* "SELECT nodeno FR..." */ - ts + 24323, /* "INSERT OR REPLAC..." */ - ts + 24377, /* "DELETE FROM '%q'..." */ + ts + 24286, /* "SELECT nodeno FR..." */ + ts + 24338, /* "INSERT OR REPLAC..." */ + ts + 24392, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 24422, /* "SELECT parentnod..." */ - ts + 24480, /* "INSERT OR REPLAC..." */ - ts + 24535, /* "DELETE FROM '%q'..." */ + ts + 24437, /* "SELECT parentnod..." */ + ts + 24495, /* "INSERT OR REPLAC..." */ + ts + 24550, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -155373,7 +155880,7 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr var zSql uintptr if isCreate != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+24582 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, ts+24597 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) @@ -155381,19 +155888,19 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+24602, /* "SELECT length(da..." */ + ts+24617, /* "SELECT length(da..." */ libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 16 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24659, /* "undersize RTree ..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24674, /* "undersize RTree ..." */ libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -155444,17 +155951,17 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr ii = 4 *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 24694, /* "Wrong number of ..." */ // 1 - ts + 24737, /* "Too few columns ..." */ // 2 - ts + 24772, /* "Too many columns..." */ // 3 - ts + 24808, /* "Auxiliary rtree ..." */ // 4 + ts + 24709, /* "Wrong number of ..." */ // 1 + ts + 24752, /* "Too few columns ..." */ // 2 + ts + 24787, /* "Too many columns..." */ // 3 + ts + 24823, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*4)))) return SQLITE_ERROR __1: ; @@ -155484,7 +155991,7 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+24845, /* "CREATE TABLE x(%..." */ + Xsqlite3_str_appendf(tls, pSql, ts+24860, /* "CREATE TABLE x(%..." */ libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))), *(*uintptr)(unsafe.Pointer(argv + 3*4)))) ii = 4 __3: @@ -155496,7 +156003,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+24869 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+24884 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -155519,7 +156026,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+24875 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24890 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -155530,14 +156037,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*4)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -155580,7 +156087,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*4)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*4)))) goto rtreeInit_fail __22: ; @@ -155598,7 +156105,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -155618,7 +156125,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 24878 /* ",%.*s REAL" */, ts + 24889 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 24893 /* ",%.*s REAL" */, ts + 24904 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -155673,13 +156180,13 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit nodeGetCell(tls, bp+48 /* &tree */, bp+16 /* &node */, ii, bp+552 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+9637 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+9652 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+24899 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+552 /* &cell */)).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, ts+24914 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+552 /* &cell */)).FiRowid)) for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+48 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+24905 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 552 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+24920 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 552 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+24909 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+24924 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -155698,7 +156205,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+24911 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+24926 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -155785,12 +156292,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24944, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24959, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 3156 /* "\n" */ + return ts + 3171 /* "\n" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -155821,7 +156328,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+24951, /* "SELECT data FROM..." */ + ts+24966, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -155840,7 +156347,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+24996 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+25011 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -155864,8 +156371,8 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa var rc int32 var pStmt uintptr *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ - ts + 25028, /* "SELECT parentnod..." */ - ts + 25082, /* "SELECT nodeno FR..." */ + ts + 25043, /* "SELECT parentnod..." */ + ts + 25097, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 24 /* &.aCheckMapping */) + uintptr(bLeaf)*4)) == uintptr(0) { @@ -155880,23 +156387,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+25130, /* "Mapping (%lld ->..." */ + rtreeCheckAppendMsg(tls, pCheck, ts+25145, /* "Mapping (%lld ->..." */ libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 25175 /* "%_rowid" */ + return ts + 25190 /* "%_rowid" */ } - return ts + 25183 /* "%_parent" */ + return ts + 25198 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+25192, /* "Found (%lld -> %..." */ + ts+25207, /* "Found (%lld -> %..." */ libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 25175 /* "%_rowid" */ + return ts + 25190 /* "%_rowid" */ } - return ts + 25183 /* "%_parent" */ + return ts + 25198 /* "%_parent" */ }(), iKey, iVal)) } } @@ -155939,7 +156446,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+25250 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+25265 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { @@ -155959,7 +156466,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+25298 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + ts+25313 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -155982,14 +156489,14 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr if aNode != 0 { if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+25365 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + ts+25380 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+25399 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+25414 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } @@ -155997,7 +156504,7 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr nCell = readInt16(tls, (aNode + 2)) if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+25429, /* "Node %lld is too..." */ + ts+25444, /* "Node %lld is too..." */ libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { @@ -156031,14 +156538,14 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+25484, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+25499, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+25515 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + ts+25530 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -156068,13 +156575,13 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25582 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25597 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) @@ -156083,12 +156590,12 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23402 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23417 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25610 /* "Schema corrupt o..." */, 0) + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25625 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } @@ -156103,8 +156610,8 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+32 /* &check */, ts+25641 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+32 /* &check */, ts+25648 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25656 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25663 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check @@ -156114,7 +156621,7 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+25656 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + var rc int32 = Xsqlite3_exec(tls, db, ts+25671 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } @@ -156160,7 +156667,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+25660 /* "wrong number of ..." */, -1) + ts+25675 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -156168,7 +156675,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 5443 /* "main" */ + zDb = ts + 5458 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*4))) } @@ -156178,7 +156685,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 16321 /* "ok" */ + return ts + 16336 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -156614,11 +157121,11 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+25711 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+25726 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+25713 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+25728 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+25724 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+25739 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -156642,19 +157149,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+25735 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+25788 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -157669,7 +158176,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+25786 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25801 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -157678,7 +158185,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+25808 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) + Xsqlite3_str_appendf(tls, pSql, ts+25823 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))) goto __3 __3: ii++ @@ -157686,7 +158193,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+24875 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24890 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -157697,7 +158204,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -157723,7 +158230,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -157956,7 +158463,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14742 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14757 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -157966,7 +158473,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25812 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25827 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -157974,7 +158481,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25818 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25833 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -158112,7 +158619,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25827 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25842 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -158257,14 +158764,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+25867 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25882 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+25883 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25898 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -158329,7 +158836,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+25898 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25913 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -158341,25 +158848,25 @@ var aFunc1 = [12]struct { _ [2]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25906 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25919 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25932 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25945 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25883 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25957 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25867 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 25980 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25994 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26007 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26021 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26037 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25921 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25934 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25947 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25960 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25898 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25972 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25882 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 25995 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26009 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26022 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26036 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26052 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 26049 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 26064 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -158372,26 +158879,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+26068 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26083 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26078 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26093 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26089 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26104 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+25812 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25827 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26100 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26115 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -158463,7 +158970,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23388 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23403 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -159745,7 +160252,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+26110 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26125 /* "corrupt fossil d..." */, -1) return } @@ -159756,7 +160263,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+26110 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26125 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -159777,7 +160284,7 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -159795,7 +160302,7 @@ func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -159899,7 +160406,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+26131 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + ts+26146 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -159983,7 +160490,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > Size_t(4)) && (libc.Xmemcmp(tls, ts+23301 /* "data" */, zIn, uint32(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > Size_t(4)) && (libc.Xmemcmp(tls, ts+23316 /* "data" */, zIn, uint32(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -160011,17 +160518,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26302 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+26317 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 26452 /* "AND rootpage!=0 ..." */ + return ts + 26467 /* "AND rootpage!=0 ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 4 /* &.pIdxIter */), (p + 36 /* &.zErrmsg */), - ts+26493 /* "SELECT name, roo..." */) + ts+26508 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -160159,7 +160666,7 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -160222,7 +160729,7 @@ func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26618 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + ts+26633 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } @@ -160240,7 +160747,7 @@ __2: *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*4), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26699 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + Xsqlite3_mprintf(tls, ts+26714 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -160258,7 +160765,7 @@ __4: } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*4), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26720 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + ts+26735 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } @@ -160282,7 +160789,7 @@ __5: ; (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*4), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26771 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + Xsqlite3_mprintf(tls, ts+26786 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } @@ -160331,7 +160838,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint32(unsafe.Sizeof(U8(0))) * uint32((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26792 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26807 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 @@ -160346,7 +160853,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint32(unsafe.Sizeof(U8(0))) * uint32((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+20 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pXInfo */)))) { var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pXInfo */)), 1) if iCid >= 0 { @@ -160396,7 +160903,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 36 /* &.eType */), bp+56 /* &iTnum */, (pIter + 60 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17842 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17857 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc @@ -160409,18 +160916,18 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // of the input table. Ignore any input table columns that begin with // "rbu_". (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+60 /* &pStmt */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26849 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + Xsqlite3_mprintf(tls, ts+26864 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+26868 /* "rbu_" */, zName, 4) != 0 { + if Xsqlite3_strnicmp(tls, ts+26883 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 32 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*4)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+26873 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+26888 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } @@ -160432,12 +160939,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+26883 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+26898 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 26912 /* "may not have" */ + return ts + 26927 /* "may not have" */ } - return ts + 26925 /* "requires" */ + return ts + 26940 /* "requires" */ }())) } @@ -160446,7 +160953,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+60 /* &pStmt */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26934 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26949 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)))) { var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)), 1) @@ -160460,7 +160967,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26956, /* "column missing f..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26971, /* "column missing f..." */ libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)), 5) @@ -160506,12 +161013,12 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = rbuMPrintf(tls, p, ts+26983 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 13309 /* ", " */ + zList = rbuMPrintf(tls, p, ts+26998 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13324 /* ", " */ } return zList } @@ -160526,13 +161033,13 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zRet = rbuMPrintf(tls, p, ts+26992 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+27007 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -160571,25 +161078,25 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, if bRowid != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27005 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + ts+27020 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27037 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + zRet = rbuMPrintf(tls, p, ts+27052 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+27060 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27066 /* "quote(" */, ts+27073 /* "||','||" */, ts+4051 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+740 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+27075 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27081 /* "quote(" */, ts+27088 /* "||','||" */, ts+4066 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+755 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27081, /* "SELECT %s FROM \"..." */ + ts+27096, /* "SELECT %s FROM \"..." */ libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27123 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + zRet = rbuMPrintf(tls, p, ts+27138 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } @@ -160647,12 +161154,12 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 @@ -160689,7 +161196,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) goto __7 __6: - zCol = ts + 27143 /* "_rowid_" */ + zCol = ts + 27158 /* "_rowid_" */ __7: ; goto __5 @@ -160698,13 +161205,13 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+27151, /* "%z%s \"%w\" COLLAT..." */ + zLhs = rbuMPrintf(tls, p, ts+27166, /* "%z%s \"%w\" COLLAT..." */ libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+27172, /* "%z%s \"rbu_imp_%d..." */ + zOrder = rbuMPrintf(tls, p, ts+27187, /* "%z%s \"rbu_imp_%d..." */ libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+27208, /* "%z%s quote(\"rbu_..." */ + zSelect = rbuMPrintf(tls, p, ts+27223, /* "%z%s quote(\"rbu_..." */ libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ iCol++ goto __1 __2: @@ -160723,12 +161230,12 @@ __11: *(*uintptr)(unsafe.Pointer(bp + 180 /* pSel */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+180 /* &pSel */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27235, /* "SELECT %s FROM \"..." */ + Xsqlite3_mprintf(tls, ts+27250, /* "SELECT %s FROM \"..." */ libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 180 /* pSel */))))) { goto __13 } - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -160750,8 +161257,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+27283 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) - zSep = ts + 13309 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+27298 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13324 /* ", " */ goto __15 __15: iCol++ @@ -160763,7 +161270,7 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+27290 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+27305 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: @@ -160813,14 +161320,14 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 740 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 740 /* "" */ // Set to " AND " later on + var zCom uintptr = ts + 755 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 755 /* "" */ // Set to " AND " later on *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { @@ -160832,9 +161339,9 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC if iCid == -2 { var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+27302 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + zRet = Xsqlite3_mprintf(tls, ts+27317 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*8)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*8)).FzSpan, zCollate)) - zType = ts + 740 /* "" */ + zType = ts + 755 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -160846,37 +161353,37 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 27143 /* "_rowid_" */ + zCol = ts + 27158 /* "_rowid_" */ } else { - zCol = ts + 26873 /* "rbu_rowid" */ + zCol = ts + 26888 /* "rbu_rowid" */ } - zType = ts + 11369 /* "INTEGER" */ + zType = ts + 11384 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*4)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)) } - zRet = Xsqlite3_mprintf(tls, ts+27324 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+27339 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 27060 /* " DESC" */ + return ts + 27075 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+27344, /* "%z%s\"rbu_imp_%d%..." */ + zImpPK = Xsqlite3_mprintf(tls, ts+27359, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+27365, /* "%z%s\"rbu_imp_%d%..." */ + zImpCols = Xsqlite3_mprintf(tls, ts+27380, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+27398 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + ts+27413 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 13309 /* ", " */ - zAnd = ts + 19862 /* " AND " */ + zCom = ts + 13324 /* ", " */ + zAnd = ts + 19877 /* " AND " */ nBind++ } @@ -160919,16 +161426,16 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 740 /* "" */ + var zS uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = Xsqlite3_mprintf(tls, ts+27422 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+27437 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+27434 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+27449 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 13309 /* ", " */ + zS = ts + 13324 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -160937,7 +161444,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27443 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+27458 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -160957,27 +161464,27 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27458 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+27473 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+27472 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) - zSep = ts + 19862 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27487 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 19877 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+27484 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + ts+27499 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)) - zList = rbuMPrintf(tls, p, ts+27534 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) - zSep = ts + 19862 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27549 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 19877 /* " AND " */ } } } @@ -160991,7 +161498,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27547 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27562 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -161020,21 +161527,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+27534, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+27549, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+27573, /* "%z%s\"%w\"=rbu_del..." */ + zList = rbuMPrintf(tls, p, ts+27588, /* "%z%s\"%w\"=rbu_del..." */ libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+27603, /* "%z%s\"%w\"=rbu_fos..." */ + zList = rbuMPrintf(tls, p, ts+27618, /* "%z%s\"%w\"=rbu_fos..." */ libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*4)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } } } @@ -161092,19 +161599,19 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 27640 /* "PRIMARY KEY(" */ + var zSep uintptr = ts + 27655 /* "PRIMARY KEY(" */ *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26792 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26807 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14652 /* "pk" */) == 0) { + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14667 /* "pk" */) == 0) { var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+60 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } @@ -161117,15 +161624,15 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */)), 2) var zDesc uintptr if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */)), 3) != 0 { - zDesc = ts + 27060 /* " DESC" */ + zDesc = ts + 27075 /* " DESC" */ } else { - zDesc = ts + 740 /* "" */ + zDesc = ts + 755 /* "" */ } - z = rbuMPrintf(tls, p, ts+27653 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = ts + 13309 /* ", " */ + z = rbuMPrintf(tls, p, ts+27668 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13324 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+27664 /* "%z)" */, libc.VaList(bp+48, z)) + z = rbuMPrintf(tls, p, ts+27679 /* "%z)" */, libc.VaList(bp+48, z)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 60 /* pXInfo */))) } return z @@ -161157,7 +161664,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration @@ -161165,7 +161672,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 36 /* &.zErrmsg */), - ts+27668 /* "SELECT name FROM..." */) + ts+27683 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { @@ -161174,7 +161681,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit } if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+172 /* &pXInfo */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) @@ -161184,25 +161691,25 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)), 1) var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)), 3) var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+27718 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + zCols = rbuMPrintf(tls, p, ts+27733 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*4)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+27740 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+27755 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 27060 /* " DESC" */ + return ts + 27075 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 13309 /* ", " */ + zComma = ts + 13324 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+27750 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + zCols = rbuMPrintf(tls, p, ts+27765 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 172 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+27765, /* "CREATE TABLE rbu..." */ + ts+27780, /* "CREATE TABLE rbu..." */ libc.VaList(bp+120, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) } } @@ -161230,52 +161737,52 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 740 /* "" */ + var zPk uintptr = ts + 755 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*4)) *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 27827 /* "PRIMARY KEY " */ + zPk = ts + 27842 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+27840, /* "%z%s\"%w\" %s %sCO..." */ + zSql = rbuMPrintf(tls, p, ts+27855, /* "%z%s\"%w\" %s %sCO..." */ libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*4)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 27867 /* " NOT NULL" */ + return ts + 27882 /* " NOT NULL" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 13309 /* ", " */ + zComma = ts + 13324 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+27877 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+27892 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27884, /* "CREATE TABLE \"rb..." */ + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27899, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 27916 /* " WITHOUT ROWID" */ + return ts + 27931 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) } } @@ -161298,7 +161805,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 88 /* &.pTmpInsert */), (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27931, /* "INSERT INTO %s.'..." */ + ts+27946, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -161335,7 +161842,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+27988 /* "SELECT trim(sql)..." */) + ts+28003 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -161445,7 +161952,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+28054 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+28069 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -161466,26 +161973,26 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 612 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28074, /* "CREATE TABLE \"rb..." */ + ts+28089, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 604 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) // Create the statement to insert index entries (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 612 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 80 /* &.pInsert */), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28139 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+28154 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 84 /* &.pDelete */), (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28175 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 608 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+28190 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 608 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -161502,7 +162009,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+28209, /* "SELECT %s, 0 AS ..." */ + ts+28224, /* "SELECT %s, 0 AS ..." */ libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, @@ -161510,32 +162017,32 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 28270 /* "AND" */ + return ts + 28285 /* "AND" */ } - return ts + 28274 /* "WHERE" */ + return ts + 28289 /* "WHERE" */ }() } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+28280, /* "SELECT %s, rbu_c..." */ + ts+28295, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+216, zCollist, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+28341, /* "SELECT %s, rbu_c..." */ + ts+28356, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+264, zCollist, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 28270 /* "AND" */ + return ts + 28285 /* "AND" */ } - return ts + 28274 /* "WHERE" */ + return ts + 28289 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -161560,8 +162067,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5452 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5448 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5467 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5463 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -161571,21 +162078,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 28500 /* "rbu_imp_" */ + return ts + 28515 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 80 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+28509, /* "INSERT INTO \"%s%..." */ + ts+28524, /* "INSERT INTO \"%s%..." */ libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 28545 /* ", _rowid_" */ + return ts + 28560 /* ", _rowid_" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zBindings))) } @@ -161595,28 +162102,28 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 84 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+28555 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + ts+28570 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 28583 /* ", rbu_rowid" */ + zRbuRowid = ts + 28598 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+28595 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+28610 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 28671 /* ", 0 AS rbu_rowid" */ + return ts + 28686 /* ", 0 AS rbu_rowid" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28688, /* "CREATE TEMP TRIG..." */ + ts+28703, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) @@ -161624,7 +162131,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28987, /* "CREATE TEMP TRIG..." */ + ts+29002, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } @@ -161633,14 +162140,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 29086 /* ",_rowid_ " */ + zRbuRowid = ts + 29101 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 29096 /* ",rbu_rowid" */ + zRbuRowid = ts + 29111 /* ",rbu_rowid" */ } } @@ -161653,35 +162160,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+27143 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+27158 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+740 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+755 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 76 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+29107, /* "SELECT %s,%s rbu..." */ + ts+29122, /* "SELECT %s,%s rbu..." */ libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 29155 /* "0 AS " */ + return ts + 29170 /* "0 AS " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zOrder, zLimit))) } @@ -161756,12 +162263,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 740 /* "" */ + var zPrefix uintptr = ts + 755 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 28500 /* "rbu_imp_" */ + zPrefix = ts + 28515 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+29161, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+29176, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 4 /* &.pUpdate */), (p + 36 /* &.zErrmsg */), zUpdate) @@ -161788,7 +162295,7 @@ func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uin return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } @@ -161829,7 +162336,7 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ } *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29191 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+24 /* &.zStateDb */))) + Xsqlite3_mprintf(tls, ts+29206 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+24 /* &.zStateDb */))) for (*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: @@ -161901,31 +162408,31 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29221 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29236 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29248 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+2398 /* "stat" */, uint32(4)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29263 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+2413 /* "stat" */, uint32(4)) } else { - libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+5443 /* "main" */, uint32(4)) + libc.Xmemcpy(tls, p+24 /* &.zStateDb */, ts+5458 /* "main" */, uint32(4)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29266 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+24 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29281 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+24 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -161958,11 +162465,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29332 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29347 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= Size_t(5)) && (0 == libc.Xmemcmp(tls, ts+22464 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= Size_t(5)) && (0 == libc.Xmemcmp(tls, ts+22479 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint32(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -161974,16 +162481,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+29364, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+29379, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 29396 /* "&" */ + return ts + 29411 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } return zExtra }())) @@ -161999,40 +162506,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29398 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29413 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29413 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+29428 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29430 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29445 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29446 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29461 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29474 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29489 /* "rbu vfs not foun..." */, 0) } } @@ -162101,7 +162608,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29446 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29461 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -162135,7 +162642,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29492 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29507 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -162262,16 +162769,16 @@ func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ bp := tls.Alloc(16) defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+29527 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+29534 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+29542 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+29549 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -162411,7 +162918,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22102 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22117 /* "datatype mismatc..." */, 0) return } @@ -162529,7 +163036,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // var pStmt uintptr at bp+8, 4 (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+29541 /* "PRAGMA schema_ve..." */) + ts+29556 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot @@ -162542,7 +163049,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29563 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29578 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -162567,7 +163074,7 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 36 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+29590, /* "INSERT OR REPLAC..." */ + ts+29605, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+24, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -162612,9 +163119,9 @@ func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 36 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29748 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + Xsqlite3_mprintf(tls, ts+29763 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29763, /* "PRAGMA main.%s =..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29778, /* "PRAGMA main.%s =..." */ libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) @@ -162631,11 +163138,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 4 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29783 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29798 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 36 /* &.zErrmsg */), - ts+29808 /* "SELECT sql FROM ..." */) + ts+29823 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -162649,12 +163156,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 36 /* &.zErrmsg */), - ts+29916 /* "SELECT * FROM sq..." */) + ts+29931 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+4 /* &pInsert */, (p + 36 /* &.zErrmsg */), - ts+29981 /* "INSERT INTO sqli..." */) + ts+29996 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -162666,7 +163173,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30025 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30040 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -162688,8 +163195,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+15708 /* "user_version" */) - rbuCopyPragma(tls, p, ts+14830 /* "application_id" */) + rbuCopyPragma(tls, p, ts+15723 /* "user_version" */) + rbuCopyPragma(tls, p, ts+14845 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -162700,7 +163207,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30050 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+30065 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+24 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -162726,10 +163233,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -162846,7 +163353,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30078 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30093 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -162865,7 +163372,7 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ bp := tls.Alloc(8) defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+29527 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+29542 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -162887,7 +163394,7 @@ func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ // var zRnd [64]int8 at bp+12, 64 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30103 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30118 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) @@ -162926,7 +163433,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+12, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+30114 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+30129 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 12 /* zErrmsg */)), -1) } else { @@ -162969,7 +163476,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30186 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30201 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -162977,7 +163484,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+30200 /* "SELECT 1 FROM sq..." */) + ts+30215 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -162989,7 +163496,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 36 /* &.zErrmsg */), - ts+30257 /* "SELECT sum(cnt *..." */) + ts+30272 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -163035,7 +163542,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + Size_t(1))) pCsr += (uintptr(nRbu + Size_t(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2775 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2790 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -163072,7 +163579,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30331 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30346 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -163094,12 +163601,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30363, /* "database modifie..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30378, /* "database modifie..." */ libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30395 /* "vacuum" */ + return ts + 30410 /* "vacuum" */ } - return ts + 30402 /* "update" */ + return ts + 30417 /* "update" */ }())) } } @@ -163107,7 +163614,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -163121,24 +163628,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+15433 /* "page_size" */) - rbuCopyPragma(tls, p, ts+14845 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+15448 /* "page_size" */) + rbuCopyPragma(tls, p, ts+14860 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30409 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30424 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+5443 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+5458 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+30425 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + db, ts+30440 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } } @@ -163191,7 +163698,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30449 /* "-vactmp" */, (zState+uintptr((n-7))), uint32(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30464 /* "-vactmp" */, (zState+uintptr((n-7))), uint32(7))) { return rbuMisuseError(tls) } } @@ -163221,7 +163728,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); i < (nErrmsg - Size_t(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28500 /* "rbu_imp_" */, uint32(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28515 /* "rbu_imp_" */, uint32(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -163240,7 +163747,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -163252,7 +163759,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 36 /* &.zErrmsg */)) } // Close any open statement handles. @@ -163264,7 +163771,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30457 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30472 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -163363,7 +163870,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163380,19 +163887,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 13198 /* "BEGIN" */ + zBegin = ts + 13213 /* "BEGIN" */ } else { - zBegin = ts + 30409 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 30424 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30409 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30424 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163796,7 +164303,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30484 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30499 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -163819,7 +164326,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+30507 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30522 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -163982,7 +164489,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5443 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5458 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -163997,7 +164504,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+30518 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+30533 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -164304,6 +164811,5666 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + FaData uintptr + FnData int32 + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint32(8)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nVarint + 1))), z, uint32(n)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 40 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 40 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 4 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.Xmemcpy(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint32(8)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint32(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint32(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint32(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 4 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 12 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 16 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+8, 4 + + var aOld uintptr + // var nNew int32 at bp+20, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+4 /* &aOld2 */, bp+8 /* &nOld */) + aNew = sessionMergeValue(tls, bp+12 /* &aNew1 */, bp+16 /* &aNew2 */, bp+20 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 20 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint32(*(*int32)(unsafe.Pointer(bp + 20 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.Xmemcpy(tls, aOut, aOld, uint32(*(*int32)(unsafe.Pointer(bp + 8 /* nOld */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 4 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 12 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 16 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+24, 4 + + var aOld uintptr + // var nNew int32 at bp+28, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+4 /* &aOld2 */, bp+24 /* &nOld */) + aNew = sessionMergeValue(tls, bp+12 /* &aNew1 */, bp+16 /* &aNew2 */, bp+28 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 24 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 28 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.Xmemcpy(tls, aOut, aNew, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nNew */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 28 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 4 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint32(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint32(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (Sqlite3_int64(unsafe.Sizeof(uintptr(0))) * nNew)) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, (uint32(Sqlite3_int64(unsafe.Sizeof(uintptr(0))) * nNew))) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*4)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*4)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 4 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+30544 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+755 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+30665 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = nByte + (Sqlite3_int64(uint32(nDbCol) * ((uint32(unsafe.Sizeof(uintptr(0))) + uint32(unsafe.Sizeof(U8(0)))) + uint32(1)))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*4) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, (uint32(nThis + 1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, (uint32(nName + 1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 4 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 8 /* &.nCol */), uintptr(0), (pTab + 16 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 48 /* &.nMaxChangesetSize */)) += (I64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + Size_t(1))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 4 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 12 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.Xmemcpy(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint32(8)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint32(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 48 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + // var iHash int32 at bp+24, 4 + + // var bNull int32 at bp+28, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 24 + + var p uintptr + // var p1 uintptr at bp+32, 4 + + // var p2 uintptr at bp+48, 4 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+40, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 28 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 12 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+755 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+24 /* &iHash */, bp+28 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 28 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* iHash */)))*4)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 40 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 32 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+32 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+32 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 32 /* p1 */)), bp+40 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 40 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.Xmemset(tls, pC, 0, uint32(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*20) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 40 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 48 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 4 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+48 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 8 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+48 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 40 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 48 /* p2 */)), bp+40 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 16 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 40 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* iHash */)))*4)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* iHash */)))*4)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 68 /* &.hook */ + 16 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 32 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 4 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+30694, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)))) + zSep = ts + 19877 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+30728, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)))) + zSep = ts + 30769 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6506 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+30774, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 4 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+30852, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 4 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 8 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+12, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+20, 4 + + // var azCol uintptr at bp+16, 4 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+8, 4 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.Xmemset(tls, bp /* &d */, 0, uint32(unsafe.Sizeof(SessionDiffCtx{}))) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+8 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 16 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+12 /* &nCol */, uintptr(0), bp+16 /* &azCol */, bp+20 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 12 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 12 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* azCol */)) + uintptr(i)*4)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FazCol + uintptr(i)*4))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+30905 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(Sqlite3_session{})) + uint32(nDb)) + uint32(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(Sqlite3_session{}))) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*88) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.Xmemcpy(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint32(nDb + 1))) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 4 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 60 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint32(unsafe.Sizeof(SessionTable{})) + uint32(nName)) + uint32(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*36) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint32(nName + 1))) + for ppTab = (pSession + 64 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint32(nBlob)) + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint32(nStr)) + *(*int32)(unsafe.Pointer(p + 4 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint32(unsafe.Sizeof([24]int8{})) - uint32(1))), bp+8 /* &aBuf[0] */, ts+4089 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = ((int32(zOut) - int32((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint32(8)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 28 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint32(8)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint32(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+28 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+28 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+28 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+28 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+28 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, ((int32(a) - int32(pStart)) / 1), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+30932 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31042 /* "SELECT * FROM " */, bp+20 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+20 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+768 /* "." */, bp+20 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+20 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31057 /* " WHERE " */, bp+20 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+20 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), bp+20 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31065 /* " IS ?" */, bp+20 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+20 /* &rc */) + zSep = ts + 19877 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 20 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp /* &rVal */, bp+8 /* &iVal */, uint32(8)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 12 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+24, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31071 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+8, 4 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 4 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+4 /* &azCol */, bp+8 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint32(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+12 /* &buf */, bPatchset, pTab, bp+24 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 4 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */)), bp+28 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+12 /* &buf */, uint8(SQLITE_INSERT), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+24 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+12 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)), iCol, bp+24 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionAppendUpdate(tls, bp+12 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sessionAppendDelete(tls, bp+12 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31091 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint32(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.Xmemmove(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint32(nMove)) + } + *(*int32)(unsafe.Pointer(pIn + 20 /* &.buf */ + 4 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+20 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 32 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 20 /* &.buf */ + 4 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, aCopy, aData, uint32(nData)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &d */, bp+16 /* &v */, uint32(8)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*4)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 80 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint32((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint32(unsafe.Sizeof(uintptr(0)))) * uint32(2)) + uint32(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 44 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint32(unsafe.Sizeof(uintptr(0))) * uint32((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint32(2)) + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint32(*(*int32)(unsafe.Pointer(bp /* nCopy */)))) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*4) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+68 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) + } + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint32(unsafe.Sizeof(uintptr(0))) * uint32((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint32(2))) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+68 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+68 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+68 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*4) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*4) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*4)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4)) == uintptr(0) { + return libc.AssignPtrInt32(p+68 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*4)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*4)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*4)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*4))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + // var rc int32 at bp+32, 4 + // Return value + // var sOut SessionBuffer at bp, 12 + // Output buffer + // var nCol int32 at bp+16, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+20, 12 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+12, 4 + + var nVar int32 + // var nByte1 int32 at bp+36, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 20 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.Xmemset(tls, bp /* &sOut */, 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+32 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+32 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+12 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+16 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 20 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+20 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), bp+32 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+32 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 12 /* nByte */)), bp+32 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 12 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 20 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), bp+36 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+32 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 36 /* nByte1 */)), bp+32 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 36 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(uintptr(0))) * uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))) * uint32(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.Xmemset(tls, apVal, 0, ((uint32(unsafe.Sizeof(uintptr(0))) * uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))) * uint32(2))) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+32 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+32 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))*4), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 16 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 16 /* nCol */)) + }())))*4)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+32 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 16 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*4)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+32 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*4))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.Xmemset(tls, apVal, 0, ((uint32(unsafe.Sizeof(uintptr(0))) * uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nCol */)))) * uint32(2))) + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+20 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + // var sInput SessionInput at bp, 44 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint32(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + // var sInput SessionInput at bp, 44 + + var rc int32 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint32(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [2]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint32(nU32) * uint32(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint32(nU32) * uint32(unsafe.Sizeof(U32(0))))) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*4)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 32 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint32(nU32)*uint32(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 8 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint32(unsafe.Sizeof(SessionUpdate{})) * uint32(nU32)) * uint32(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10072 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 755 /* "" */ + // var buf SessionBuffer at bp, 12 + + libc.Xmemset(tls, bp /* &buf */, 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*12) + libc.Xmemcpy(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint32(nU32) * uint32(unsafe.Sizeof(U32(0))))) + + sessionAppendStr(tls, bp /* &buf */, ts+31109 /* "UPDATE main." */, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31122 /* " SET " */, bp+12 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*4)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31128 /* " = ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+12 /* &rc */) + zSep = ts + 13324 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 755 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31057 /* " WHERE " */, bp+12 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*4)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31133 /* "idx IS CASE WHEN..." */, bp+12 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31065 /* " IS ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+12 /* &rc */) + } + zSep = ts + 19877 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31208 /* "DELETE FROM main..." */, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31057 /* " WHERE " */, bp+12 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31128 /* " = ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+12 /* &rc */) + zSep = ts + 19877 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31226 /* " AND (?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+30769 /* " OR " */, bp+12 /* &rc */) + + zSep = ts + 755 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31065 /* " IS ?" */, bp+12 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+12 /* &rc */) + zSep = ts + 31234 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4066 /* ")" */, bp+12 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 4 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5458 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 12 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31239 /* "INSERT INTO main..." */, bp+12 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+12 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+19883 /* "(" */, bp+12 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13324 /* ", " */, bp+12 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)), bp+12 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31257 /* ") VALUES(?" */, bp+12 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31268 /* ", ?" */, bp+12 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4066 /* ")" */, bp+12 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10072 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pInsert */), + + ts+31272 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 4 /* &.pDelete */), + + ts+31385 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 4 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + var rc int32 // Return code + // var nCol int32 at bp+4, 4 + // Number of columns in table + // var op int32 at bp+8, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 4 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 60 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 60 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 60 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 60 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 60 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 60 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 4 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+4 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+4 /* &pVal */) + } + sessionAppendValue(tls, (p + 60 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 4 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+12, 4 + + // var nCol int32 at bp+4, 4 + + // var op int32 at bp+8, 4 + + // var zDummy uintptr at bp, 4 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 48 /* &.constraints */), aBlob, nBlob, bp+12 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + // var zDummy uintptr at bp, 4 + + // var op int32 at bp+8, 4 + + // var nCol int32 at bp+4, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 4 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 4 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+12 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*4)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*4)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31529 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31550 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, (pApply + 48 /* &.constraints */), 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint32(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint32(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 44 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte) + } + + for (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(252) + defer tls.Free(252) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 76 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.Xmemset(tls, bp+48 /* &sApply */, 0, uint32(unsafe.Sizeof(SessionApplyCtx{}))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+31569 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31595 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+128, 4 + + // var op int32 at bp+132, 4 + + // var zNew uintptr at bp+124, 4 + + Xsqlite3changeset_op(tls, pIter, bp+124 /* &zNew */, bp+128 /* &nCol */, bp+132 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+136, 4 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.Xmemset(tls, (bp + 48 /* &sApply */ + 48 /* &.constraints */), 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+136 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5458 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 124 /* zNew */)), (bp + 48 /* &sApply */ + 16 /* &.nCol */), bp+140 /* &zTab */, (bp + 48 /* &sApply */ + 20 /* &.azCol */), (bp + 48 /* &sApply */ + 24 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31625 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 128 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+31669, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 128 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 128 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 136 /* abPK */)), uint32(*(*int32)(unsafe.Pointer(bp + 128 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31740 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 128 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), ts+10072 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 140 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+144, 4 + + // var notUsed int32 at bp+148, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+144 /* &nFk */, bp+148 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 144 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+152, 100 + + libc.Xmemset(tls, bp+152 /* &sIter */, 0, uint32(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 152 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 144 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+152 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+31800 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31830 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+31854 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+31830 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint32(unsafe.Sizeof(SessionChange{})) + uint32(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*20) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint32(nRec)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint32(nIn)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = ((int32(pOut) - int32((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint32(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint32(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.Xmemset(tls, pNew, 0, uint32(nByte)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+12 /* &.aRecord */, (pNew + 1*20)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut, a1, uint32(n1)) + pOut += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut, a2, uint32(n2)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = ((int32(pOut) - int32((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+4, 4 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint32(unsafe.Sizeof(SessionChange{})) + uint32((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint32(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)) = libc.AssignPtrUintptr(pNew+12 /* &.aRecord */, (pNew + 1*20)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+4 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)), aRec, uint32(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+4 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 8 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 12 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+8 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+12 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+4 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 8 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 12 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)), aRec, uint32(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+4 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = ((int32(*(*uintptr)(unsafe.Pointer(bp + 4 /* aCsr */))) - int32((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aRec uintptr at bp, 4 + + // var nRec int32 at bp+4, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+4 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+8, 4 + + // var nCol int32 at bp+12, 4 + + // var op int32 at bp+16, 4 + + var iHash int32 + // var bIndirect int32 at bp+20, 4 + + // var pChange uintptr at bp+28, 4 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+8 /* &zNew */, bp+12 /* &nCol */, bp+16 /* &op */, bp+20 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)))) + // var abPK uintptr at bp+24, 4 + + Xsqlite3changeset_pk(tls, pIter, bp+24 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint32(unsafe.Sizeof(SessionTable{})) + uint32(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) + uint32(nNew)) + uint32(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 12 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*36) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 24 /* abPK */)), uint32(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 8 /* zNew */)), (uint32(nNew + 1))) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 12 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 24 /* abPK */)), uint32(*(*int32)(unsafe.Pointer(bp + 12 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 16 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 16 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 16 /* op */)), *(*int32)(unsafe.Pointer(bp + 20 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+28 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 28 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4)) = *(*uintptr)(unsafe.Pointer(bp + 28 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+12 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*4)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+12 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+12 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+12 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 12 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Sqlite3_changegroup{}))) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pIter uintptr at bp, 4 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pGrp uintptr at bp, 4 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var pGrp uintptr at bp, 4 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint32(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint32(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = ((int32(pOut) - int32((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.Xmemcpy(tls, pOut, a1, uint32(n1)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.Xmemcpy(tls, pOut, a2, uint32(n2)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint32(n1)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = ((int32(pOut) - int32((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 8 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 12 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+4 /* &nRec */, bp+8 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 8 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 8 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+12 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+24 /* &rc */) + sessionAppendVarint(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+24 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*4)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+12 /* &sOut */, uint8(SQLITE_UPDATE), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+24 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 28 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+28 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8(SQLITE_INSERT), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendRecordMerge(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 28 /* pCsr */)), (*(*int32)(unsafe.Pointer(bp + 4 /* nRec */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 28 /* pCsr */))) - int32(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1)), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+24 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+12 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+24 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+12 /* &sOut */, uint8(SQLITE_DELETE), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendRecordMerge(tls, bp+12 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+24 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+24 /* &rc */) + sessionAppendByte(tls, bp+12 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+24 /* &rc */) + sessionAppendBlob(tls, bp+12 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 4 /* nRec */)), bp+24 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf) + libc.Xmemset(tls, bp+12 /* &sOut */, 0, uint32(unsafe.Sizeof(SessionBuffer{}))) + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 12 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+12 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(Sqlite3_rebaser{}))) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -164375,71 +170542,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -165257,7 +171359,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+30529 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+31882 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -165580,7 +171682,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+30557 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+31910 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -165879,7 +171981,7 @@ func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+30588 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31941 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -165953,7 +172055,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 30595 /* "wrong number of ..." */ + var zErr uintptr = ts + 31948 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -166119,7 +172221,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 740 /* "" */ + return ts + 755 /* "" */ } // Implementation of snippet() function. @@ -166146,7 +172248,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 30645 /* "wrong number of ..." */ + var zErr uintptr = ts + 31998 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -166488,13 +172590,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(48) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 30693 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32046 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 30701 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32054 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 30711 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32064 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -166988,7 +173090,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+5243 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+5258 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -167166,7 +173268,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+30716 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32069 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint32(unsafe.Sizeof(int32(0))) * uint32(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 @@ -167193,14 +173295,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30723 /* "malformed prefix..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32076 /* "malformed prefix..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+30754 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + ts+32107 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -167211,7 +173313,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30787 /* "prefix length ou..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32140 /* "prefix length ou..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -167224,7 +173326,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30824 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32177 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + Size_t(1))) var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (Sqlite3_int64(unsafe.Sizeof(uintptr(0))) * nArg)) @@ -167233,7 +173335,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30833 /* "multiple tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32186 /* "multiple tokeniz..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { @@ -167252,7 +173354,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30866 /* "parse error in t..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32219 /* "parse error in t..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, @@ -167267,14 +173369,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30900 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32253 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30908 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32261 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+30940 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32293 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } @@ -167282,9 +173384,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30946 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32299 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30960 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32313 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) @@ -167292,9 +173394,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30998 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32351 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31009 /* "malformed column..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32362 /* "malformed column..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) @@ -167302,21 +173404,21 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+4174 /* "detail" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+4189 /* "detail" */, zCmd, nCmd) == 0 { *(*[4]Fts5Enum)(unsafe.Pointer(bp + 44 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 15813 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 15818 /* "full" */}, - {FzName: ts + 31044 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {FzName: ts + 15828 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 15833 /* "full" */}, + {FzName: ts + 32397 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+44 /* &aDetail[0] */, zArg, (pConfig+48 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31052 /* "malformed detail..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32405 /* "malformed detail..." */, 0) } return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31083 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32436 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -167380,15 +173482,15 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+20482 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+14742 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31111 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20497 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+14757 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32464 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+31141 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32494 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31151 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32504 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -167406,13 +173508,13 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK *(*Fts5Buffer)(unsafe.Pointer(bp + 28 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+31182 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+32535 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+31187 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+32540 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*4)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+31194 /* ", T.c%d" */, libc.VaList(bp+16, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+28 /* &buf */, ts+32547 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } @@ -167460,8 +173562,8 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*4)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20482 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31202 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20497 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32555 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } @@ -167494,7 +173596,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31231 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32584 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { @@ -167502,7 +173604,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*uintptr)(unsafe.Pointer(bp + 52 /* zTwo */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp + 52 /* zTwo */)) } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), pzErr) } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 44 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 52 /* zTwo */)), pzErr) @@ -167527,19 +173629,19 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 30900 /* "content" */ + zTail = ts + 32253 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 31251 /* "docsize" */ + zTail = ts + 32604 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+40 /* &rc */, ts+31259 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+32612 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14742 /* "rowid" */, -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14757 /* "rowid" */, -1) } // Formulate the zContentExprlist text @@ -167588,18 +173690,18 @@ func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31270 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32623 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 13309 /* ", " */ + return ts + 13324 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31286 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32639 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*4)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31293, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20482 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32646, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20497 /* "rank" */)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -167739,7 +173841,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+31319 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+32672 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -167749,7 +173851,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31324 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32677 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -167759,7 +173861,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31333 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32686 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -167772,7 +173874,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31343 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32696 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -167782,7 +173884,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31353 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32706 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -167798,7 +173900,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20482 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20497 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 4 @@ -167825,7 +173927,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 bp := tls.Alloc(44) defer tls.Free(44) - var zSelect uintptr = ts + 31365 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 32718 /* "SELECT k, v FROM..." */ var zSql uintptr *(*uintptr)(unsafe.Pointer(bp + 36 /* p */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK @@ -167848,7 +173950,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 36 /* p */))) { var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 36 /* p */)), 0) var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 36 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+31397 /* "version" */) { + if 0 == Xsqlite3_stricmp(tls, zK, ts+32750 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 40 /* bDummy */)) = 0 @@ -167863,7 +173965,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+31405, /* "invalid fts5 fil..." */ + ts+32758, /* "invalid fts5 fil..." */ libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } @@ -167997,7 +174099,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31470 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+32823 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -168010,20 +174112,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31490 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+32843 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = ((int32(z2) - int32(z)) / 1) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31521 /* "OR" */, uint32(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32874 /* "OR" */, uint32(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31524 /* "NOT" */, uint32(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32877 /* "NOT" */, uint32(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28270 /* "AND" */, uint32(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28285 /* "AND" */, uint32(3)) == 0) { tok = FTS5_AND } break @@ -169997,9 +176099,9 @@ func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqli bp := tls.Alloc(16) defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+31528 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+32881 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint32(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+30557 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+31910 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -170015,7 +176117,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+31533 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+32886 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -170112,7 +176214,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+18865 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+18880 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -170208,7 +176310,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31562 /* "fts5: column que..." */, 0) + ts+32915 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -170392,12 +176494,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31615, /* "fts5: %s queries..." */ + ts+32968, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 31665 /* "phrase" */ + return ts + 33018 /* "phrase" */ } - return ts + 31528 /* "NEAR" */ + return ts + 32881 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -171876,7 +177978,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+31672 /* "block" */, iRowid, 0, (p + 40 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33025 /* "block" */, iRowid, 0, (p + 40 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -171964,7 +178066,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 44 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+31678, /* "REPLACE INTO '%q..." */ + ts+33031, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -171992,7 +178094,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+31729, /* "DELETE FROM '%q'..." */ + ts+33082, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+48 /* &.pDeleter */), zSql) != 0 { return @@ -172016,7 +178118,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 56 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+31778, /* "DELETE FROM '%q'..." */ + ts+33131, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -172224,7 +178326,7 @@ func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12 if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 68 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+31818 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+33171 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -173659,7 +179761,7 @@ func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:2 var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 60 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+31841, /* "SELECT pgno FROM..." */ + ts+33194, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -174915,7 +181017,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -175256,7 +181358,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 52 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+31925, /* "INSERT INTO '%q'..." */ + ts+33278, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -176474,7 +182576,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.Xmemset(tls, bp /* &s */, 0, uint32(unsafe.Sizeof(Fts5Structure{}))) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+740 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+755 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -176495,13 +182597,13 @@ func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uint if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+31982 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33335 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+23301 /* "data" */, ts+31990 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+23316 /* "data" */, ts+33343 /* "id INTEGER PRIMA..." */, 0, pzErr) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10197, /* "idx" */ - ts+32025, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10212, /* "idx" */ + ts+33378, /* "segid, term, pgn..." */ 1, pzErr) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { @@ -176807,7 +182909,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+31672 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+4 /* &pBlob */) + ts+33025 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+4 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pBlob */))) @@ -176944,7 +183046,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+32069, /* "SELECT segid, te..." */ + ts+33422, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. @@ -177154,7 +183256,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 8 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 80 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*96), uintptr(0), bp+8 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 36 /* &.rc */), bp+8 /* &poslist */, uint32(4), ts+32155 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 36 /* &.rc */), bp+8 /* &poslist */, uint32(4), ts+33508 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+8 /* &poslist */)).Fn, bp+20 /* &iOff */, bp+24 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 24 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 24 /* iPos */)) & int64(0x7FFFFFFF))) @@ -177565,7 +183667,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32160 /* "recursively defi..." */, 0) + ts+33513 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -177599,7 +183701,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4074 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4089 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -177615,7 +183717,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4074 /* "%d" */, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4089 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -177958,7 +184060,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -177990,7 +184092,7 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -178029,25 +184131,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+32199, /* "SELECT rowid, ra..." */ + ts+33552, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 13309 /* ", " */ + return ts + 13324 /* ", " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 32254 /* "DESC" */ + return ts + 33607 /* "DESC" */ } - return ts + 32259 /* "ASC" */ + return ts + 33612 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -178098,13 +184200,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+32263 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+33616 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4156 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4171 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32269 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33622 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -178139,7 +184241,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+32297 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+33650 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, @@ -178171,7 +184273,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32307 /* "no such function..." */, libc.VaList(bp+8, zRank)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33660 /* "no such function..." */, libc.VaList(bp+8, zRank)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } @@ -178203,14 +184305,14 @@ func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uin *(*int32)(unsafe.Pointer(pCsr + 60 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+32328 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+33681 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 30711 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32064 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -178276,7 +184378,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32160 /* "recursively defi..." */, 0) + ts+33513 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -178322,7 +184424,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 740 /* "" */ + zText = ts + 755 /* "" */ __14: ; iCol = 0 @@ -178511,7 +184613,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32361 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+33714 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -178648,7 +184750,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -178685,29 +184787,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+32397 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+33750 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+32408 /* "'delete-all' may..." */, 0) + ts+33761 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+32488 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33841 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+32496 /* "'rebuild' may no..." */, 0) + ts+33849 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+15413 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+15428 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+32552 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33905 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+32558 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33911 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -178781,7 +184883,7 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*4))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+15952 /* "delete" */, z)) { + (0 == Xsqlite3_stricmp(tls, ts+15967 /* "delete" */, z)) { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*4))) @@ -178806,12 +184908,12 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32574, /* "cannot %s conten..." */ + ts+33927, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 18766 /* "UPDATE" */ + return ts + 18781 /* "UPDATE" */ } - return ts + 32611 /* "DELETE from" */ + return ts + 33964 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { @@ -179481,7 +185583,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+32623 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+33976 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -179786,7 +185888,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32644 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33997 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 8 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -179803,7 +185905,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 8 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32666 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34019 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -179850,7 +185952,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+32697 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34050 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -179861,7 +185963,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+32710 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+34063 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -179877,7 +185979,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 32801 /* "config" */, ts + 30900 /* "content" */, ts + 23301 /* "data" */, ts + 31251 /* "docsize" */, ts + 10197, /* "idx" */ + ts + 34154 /* "config" */, ts + 32253 /* "content" */, ts + 23316 /* "data" */, ts + 32604 /* "docsize" */, ts + 10212, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -179901,7 +186003,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+32808 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+34161 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -179919,13 +186021,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32808 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34161 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32813 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34166 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -179991,20 +186093,20 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p if *(*uintptr)(unsafe.Pointer((p + 28 /* &.aStmt */) + uintptr(eStmt)*4)) == uintptr(0) { *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ - ts + 32828, /* "SELECT %s FROM %..." */ - ts + 32896, /* "SELECT %s FROM %..." */ - ts + 32965, /* "SELECT %s FROM %..." */ // LOOKUP + ts + 34181, /* "SELECT %s FROM %..." */ + ts + 34249, /* "SELECT %s FROM %..." */ + ts + 34318, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 32998, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 33037, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 33077, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 33116, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 33157, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 34351, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34390, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34430, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34469, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34510, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 33196, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 34549, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 33238, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 33278, /* "SELECT %s FROM %..." */ // SCAN + ts + 34591, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 34631, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) @@ -180071,7 +186173,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -180109,18 +186211,18 @@ func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230 var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33301, /* "DROP TABLE IF EX..." */ + ts+34654, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33405, /* "DROP TABLE IF EX..." */ + ts+34758, /* "DROP TABLE IF EX..." */ libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33443, /* "DROP TABLE IF EX..." */ + ts+34796, /* "DROP TABLE IF EX..." */ libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc @@ -180132,7 +186234,7 @@ func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uin if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33481, /* "ALTER TABLE %Q.'..." */ + ts+34834, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -180144,14 +186246,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23301 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10197 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32801 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23316 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10212 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34154 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31251 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32604 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+30900 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32253 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -180165,17 +186267,17 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn var rc int32 *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+33523, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+34876, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 27916 /* " WITHOUT ROWID" */ + return ts + 27931 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+33553, /* "fts5: error crea..." */ + ts+34906, /* "fts5: error crea..." */ libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } @@ -180217,27 +186319,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+33597 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34950 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+33620 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34973 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+30900 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32253 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+31251 /* "docsize" */, ts+33626 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+32604 /* "docsize" */, ts+34979 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+32801 /* "config" */, ts+33658 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+34154 /* "config" */, ts+35011 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31397 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32750 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -180474,12 +186576,12 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33675, /* "DELETE FROM %Q.'..." */ + ts+35028, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33725, /* "DELETE FROM %Q.'..." */ + ts+35078, /* "DELETE FROM %Q.'..." */ libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } @@ -180489,7 +186591,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31397 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32750 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -180684,7 +186786,7 @@ func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+33754, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+35107, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -180881,14 +186983,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 40 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+30900 /* "content" */, bp+40 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32253 /* "content" */, bp+40 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 40 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31251 /* "docsize" */, bp+48 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32604 /* "docsize" */, bp+48 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -181124,9 +187226,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.Xmemcpy(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint32(unsafe.Sizeof(aAsciiTokenChar))) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33786 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35139 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33797 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35150 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -181365,7 +187467,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 33808 /* "L* N* Co" */ + var zCat uintptr = ts + 35161 /* "L* N* Co" */ var i int32 libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Unicode61Tokenizer{}))) @@ -181378,7 +187480,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33817 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35170 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) } } @@ -181389,18 +187491,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33828 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35181 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33786 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35139 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33797 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35150 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+33817 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35170 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -181712,7 +187814,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 33846 /* "unicode61" */ + var zBase uintptr = ts + 35199 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -181863,7 +187965,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33856 /* "al" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35209 /* "al" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181871,11 +187973,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33859 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35212 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33864 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35217 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -181883,7 +187985,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33869 /* "er" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35222 /* "er" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181891,7 +187993,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33872 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35225 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181899,11 +188001,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33875 /* "able" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35228 /* "able" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33880 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35233 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -181911,19 +188013,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33885 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35238 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33889 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35242 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33895 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35248 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33900 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35253 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181931,11 +188033,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33904 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35257 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33908 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35261 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -181943,7 +188045,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33911 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35264 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181951,11 +188053,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33915 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35268 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33919 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35272 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181963,7 +188065,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33923 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35276 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181971,7 +188073,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33927 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35280 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181979,7 +188081,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33931 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35284 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -181996,24 +188098,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33935 /* "at" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33915 /* "ate" */, uint32(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35288 /* "at" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33938 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33941 /* "ble" */, uint32(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35291 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35294 /* "ble" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33945 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33931 /* "ize" */, uint32(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35298 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35284 /* "ize" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -182029,137 +188131,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+33948 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35301 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33915 /* "ate" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+33956 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35309 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33963 /* "tion" */, uint32(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35316 /* "tion" */, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33968 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35321 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33864 /* "ence" */, uint32(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35217 /* "ence" */, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33973 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35326 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33859 /* "ance" */, uint32(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35212 /* "ance" */, uint32(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33978 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35331 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33931 /* "ize" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35284 /* "ize" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33983 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35336 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14763 /* "log" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14778 /* "log" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33988 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35341 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+33941 /* "ble" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35294 /* "ble" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33992 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35345 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33997 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35350 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33900 /* "ent" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35253 /* "ent" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34003 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35356 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34007 /* "e" */, uint32(1)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35360 /* "e" */, uint32(1)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34009 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35362 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33923 /* "ous" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35276 /* "ous" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34015 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35368 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33931 /* "ize" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35284 /* "ize" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34023 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35376 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33915 /* "ate" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34029 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35382 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33915 /* "ate" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35268 /* "ate" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34034 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35387 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34040 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35393 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33927 /* "ive" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35280 /* "ive" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34048 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35401 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+34056 /* "ful" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35409 /* "ful" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34060 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35413 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint32(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33923 /* "ous" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35276 /* "ous" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34068 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35421 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34074 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35427 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33927 /* "ive" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35280 /* "ive" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34080 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35433 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint32(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33941 /* "ble" */, uint32(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35294 /* "ble" */, uint32(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -182175,16 +188277,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34087 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35440 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33872 /* "ic" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35225 /* "ic" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34092 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35445 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint32(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -182192,21 +188294,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34097 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35450 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33872 /* "ic" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35225 /* "ic" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34103 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35456 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33872 /* "ic" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35225 /* "ic" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34056 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35409 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182214,7 +188316,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34109 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35462 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -182222,9 +188324,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34115 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35468 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint32(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -182240,12 +188342,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34121 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35474 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34125 /* "ee" */, uint32(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35478 /* "ee" */, uint32(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34128 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35481 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint32(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -182254,7 +188356,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34131 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35484 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint32(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -182424,7 +188526,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*4)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+34135 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), ts+35488 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -182614,22 +188716,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(64) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 33846 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35199 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 34150 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35503 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 34156 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35509 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 34163 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35516 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -183974,14 +190076,14 @@ func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uint var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+34171 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+35524 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+34175 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35528 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+34179 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35532 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34188 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35541 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) @@ -184028,19 +190130,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(20) *(*[3]uintptr)(unsafe.Pointer(bp + 4 /* azSchema */)) = [3]uintptr{ - ts + 34222, /* "CREATE TABlE voc..." */ - ts + 34262, /* "CREATE TABlE voc..." */ - ts + 34297, /* "CREATE TABlE voc..." */ + ts + 35575, /* "CREATE TABlE voc..." */ + ts + 35615, /* "CREATE TABlE voc..." */ + ts + 35650, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == Size_t(4))) && (libc.Xmemcmp(tls, ts+21610 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == Size_t(4))) && (libc.Xmemcmp(tls, ts+21625 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), uint32(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34340 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35693 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -184192,11 +190294,11 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34373 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35726 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ - ts+34404, /* "SELECT t.%Q FROM..." */ + ts+35757, /* "SELECT t.%Q FROM..." */ libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+68 /* &pStmt */, uintptr(0)) @@ -184220,7 +190322,7 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* *(*uintptr)(unsafe.Pointer(bp + 68 /* pStmt */)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34455 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35808 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { @@ -184508,7 +190610,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 740 /* "" */ + zCopy = ts + 755 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -184625,7 +190727,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+34481 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+35834 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -184670,7 +190772,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 34491 /* "2021-06-18 18:36..." */ + return ts + 35844 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -185558,5 +191660,5 @@ func init() { *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 68 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: } -var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go index 256616bb..a10a5527 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_linux_arm64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_UNIX=1', DO NOT EDIT. package sqlite3 @@ -1415,6 +1415,9 @@ const ( SEEK_HOLE = 4 SEEK_SET = 0 SELECTTRACE_ENABLED = 0 + SESSIONS_STRM_CHUNK_SIZE = 1024 + SESSION_MAX_BUFFER_SZ = 2147483391 + SESSION_UPDATE_CACHE_SZ = 12 SF_Aggregate = 0x0000008 SF_All = 0x0000002 SF_ComplexResult = 0x0040000 @@ -1561,6 +1564,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -1717,6 +1731,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -2084,6 +2099,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -3714,7 +3731,7 @@ type X__float128 = float64 /* :47:21 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [18]uintptr{ +var sqlite3azCompileOpt = [19]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=gcc-8.3..." */ @@ -3727,14 +3744,15 @@ var sqlite3azCompileOpt = [18]uintptr{ ts + 130, /* "ENABLE_PREUPDATE..." */ ts + 152, /* "ENABLE_RBU" */ ts + 163, /* "ENABLE_RTREE" */ - ts + 176, /* "ENABLE_SNAPSHOT" */ - ts + 192, /* "ENABLE_STAT4" */ - ts + 205, /* "ENABLE_UNLOCK_NO..." */ - ts + 226, /* "LIKE_DOESNT_MATC..." */ - ts + 250, /* "MUTEX_NOOP" */ - ts + 261, /* "SOUNDEX" */ - ts + 269, /* "SYSTEM_MALLOC" */ - ts + 283, /* "THREADSAFE=1" */ + ts + 176, /* "ENABLE_SESSION" */ + ts + 191, /* "ENABLE_SNAPSHOT" */ + ts + 207, /* "ENABLE_STAT4" */ + ts + 220, /* "ENABLE_UNLOCK_NO..." */ + ts + 241, /* "LIKE_DOESNT_MATC..." */ + ts + 265, /* "MUTEX_NOOP" */ + ts + 276, /* "SOUNDEX" */ + ts + 284, /* "SYSTEM_MALLOC" */ + ts + 298, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -4050,7 +4068,7 @@ type Va_list = X__gnuc_va_list /* stdarg.h:99:24 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 296 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 311 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -6601,6 +6619,495 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + _ [4]byte + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + _ [4]byte + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -6651,10 +7158,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -11168,7 +11674,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 303 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 318 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -12319,7 +12825,7 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+310 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+325 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 @@ -12356,13 +12862,13 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+318 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+333 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+326 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+341 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -12481,7 +12987,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+330 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+345 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -12562,7 +13068,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+342 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+357 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -12744,7 +13250,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+56 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 104 /* t */)) = (Time_t(((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000)))) if osLocaltime(tls, bp+104 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+346 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+361 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -12779,12 +13285,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 369 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 376 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 383 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 388 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 392 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 398 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 384 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 391 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 398 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 403 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 407 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 413 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -12823,7 +13329,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+403 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+418 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -12837,7 +13343,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+413 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+428 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -12846,7 +13352,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+423 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+438 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -12871,7 +13377,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+427 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+442 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -12896,7 +13402,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+436 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+451 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -12910,14 +13416,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+392 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+407 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+398 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+413 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+388 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+403 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -13138,7 +13644,7 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // var zBuf [100]int8 at bp+96, 100 computeYMD_HMS(tls, bp+48 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+446, /* "%04d-%02d-%02d %..." */ + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+461, /* "%04d-%02d-%02d %..." */ libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } @@ -13157,7 +13663,7 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeHMS(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+476 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13175,7 +13681,7 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // var zBuf [100]int8 at bp+72, 100 computeYMD(tls, bp+24 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+506 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -13302,7 +13808,7 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (uint64(2)) break fallthrough @@ -13312,14 +13818,14 @@ __3: if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+511 /* "%06.3f" */, libc.VaList(bp+8, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+526 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (uint64(2)) break fallthrough @@ -13337,10 +13843,10 @@ __3: if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (uint64(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+518 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+533 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (uint64(3)) } break @@ -13349,19 +13855,19 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+523 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+538 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (uint64(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (uint64(2)) break fallthrough @@ -13375,7 +13881,7 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (uint64(2)) break fallthrough @@ -13388,7 +13894,7 @@ __3: fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+529 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+544 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -13445,14 +13951,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 534 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 544 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 554 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 563 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 572 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 585 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 603 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 559 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 564 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 569 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 578 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 587 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 600 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 618 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -14029,7 +14535,7 @@ func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:1 p += 8 } else { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+616 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+631 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -14080,7 +14586,7 @@ func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* } else { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+654, /* "failed memory re..." */ + ts+669, /* "failed memory re..." */ libc.VaList(bp, sqlite3MemSize(tls, pPrior), nByte)) } return p @@ -15265,8 +15771,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 690 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 723 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 705 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 738 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -15520,7 +16026,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+730 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+745 /* "%" */, 1) goto __5 __11: ; @@ -16103,7 +16609,7 @@ __125: if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 732 /* "NaN" */ + bufpt = ts + 747 /* "NaN" */ length = 3 goto __58 __127: @@ -16163,7 +16669,7 @@ __138: } bufpt = bp + 8 /* &buf[0] */ *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix - libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+736 /* "Inf" */, uint64(4)) + libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+751 /* "Inf" */, uint64(4)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: @@ -16520,7 +17026,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 740 /* "" */ + bufpt = ts + 755 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -16649,9 +17155,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 741 /* "NULL" */ + return ts + 756 /* "NULL" */ } - return ts + 746 /* "(NULL)" */ + return ts + 761 /* "(NULL)" */ }() __220: ; @@ -16786,7 +17292,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+768 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -16801,7 +17307,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+755 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+770 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -16864,7 +17370,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 767 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 782 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -19136,7 +19642,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 776 /* "9223372036854775..." */ + var pow63 uintptr = ts + 791 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -19786,7 +20292,7 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+795, /* "API call with %s..." */ + ts+810, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -19805,14 +20311,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+741 /* "NULL" */) + logBadConnection(tls, ts+756 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+840 /* "unopened" */) + logBadConnection(tls, ts+855 /* "unopened" */) } return 0 } else { @@ -19826,7 +20332,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+849 /* "invalid" */) + logBadConnection(tls, ts+864 /* "invalid" */) return 0 } else { return 1 @@ -20354,186 +20860,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 857, /* "Savepoint" */ - /* 1 */ ts + 867, /* "AutoCommit" */ - /* 2 */ ts + 878, /* "Transaction" */ - /* 3 */ ts + 890, /* "SorterNext" */ - /* 4 */ ts + 901, /* "Prev" */ - /* 5 */ ts + 906, /* "Next" */ - /* 6 */ ts + 911, /* "Checkpoint" */ - /* 7 */ ts + 922, /* "JournalMode" */ - /* 8 */ ts + 934, /* "Vacuum" */ - /* 9 */ ts + 941, /* "VFilter" */ - /* 10 */ ts + 949, /* "VUpdate" */ - /* 11 */ ts + 957, /* "Goto" */ - /* 12 */ ts + 962, /* "Gosub" */ - /* 13 */ ts + 968, /* "InitCoroutine" */ - /* 14 */ ts + 982, /* "Yield" */ - /* 15 */ ts + 988, /* "MustBeInt" */ - /* 16 */ ts + 998, /* "Jump" */ - /* 17 */ ts + 1003, /* "Once" */ - /* 18 */ ts + 1008, /* "If" */ - /* 19 */ ts + 1011, /* "Not" */ - /* 20 */ ts + 1015, /* "IfNot" */ - /* 21 */ ts + 1021, /* "IfNullRow" */ - /* 22 */ ts + 1031, /* "SeekLT" */ - /* 23 */ ts + 1038, /* "SeekLE" */ - /* 24 */ ts + 1045, /* "SeekGE" */ - /* 25 */ ts + 1052, /* "SeekGT" */ - /* 26 */ ts + 1059, /* "IfNotOpen" */ - /* 27 */ ts + 1069, /* "IfNoHope" */ - /* 28 */ ts + 1078, /* "NoConflict" */ - /* 29 */ ts + 1089, /* "NotFound" */ - /* 30 */ ts + 1098, /* "Found" */ - /* 31 */ ts + 1104, /* "SeekRowid" */ - /* 32 */ ts + 1114, /* "NotExists" */ - /* 33 */ ts + 1124, /* "Last" */ - /* 34 */ ts + 1129, /* "IfSmaller" */ - /* 35 */ ts + 1139, /* "SorterSort" */ - /* 36 */ ts + 1150, /* "Sort" */ - /* 37 */ ts + 1155, /* "Rewind" */ - /* 38 */ ts + 1162, /* "IdxLE" */ - /* 39 */ ts + 1168, /* "IdxGT" */ - /* 40 */ ts + 1174, /* "IdxLT" */ - /* 41 */ ts + 1180, /* "IdxGE" */ - /* 42 */ ts + 1186, /* "RowSetRead" */ - /* 43 */ ts + 1197, /* "Or" */ - /* 44 */ ts + 1200, /* "And" */ - /* 45 */ ts + 1204, /* "RowSetTest" */ - /* 46 */ ts + 1215, /* "Program" */ - /* 47 */ ts + 1223, /* "FkIfZero" */ - /* 48 */ ts + 1232, /* "IfPos" */ - /* 49 */ ts + 1238, /* "IfNotZero" */ - /* 50 */ ts + 1248, /* "IsNull" */ - /* 51 */ ts + 1255, /* "NotNull" */ - /* 52 */ ts + 1263, /* "Ne" */ - /* 53 */ ts + 1266, /* "Eq" */ - /* 54 */ ts + 1269, /* "Gt" */ - /* 55 */ ts + 1272, /* "Le" */ - /* 56 */ ts + 1275, /* "Lt" */ - /* 57 */ ts + 1278, /* "Ge" */ - /* 58 */ ts + 1281, /* "ElseEq" */ - /* 59 */ ts + 1288, /* "DecrJumpZero" */ - /* 60 */ ts + 1301, /* "IncrVacuum" */ - /* 61 */ ts + 1312, /* "VNext" */ - /* 62 */ ts + 1318, /* "Init" */ - /* 63 */ ts + 1323, /* "PureFunc" */ - /* 64 */ ts + 1332, /* "Function" */ - /* 65 */ ts + 1341, /* "Return" */ - /* 66 */ ts + 1348, /* "EndCoroutine" */ - /* 67 */ ts + 1361, /* "HaltIfNull" */ - /* 68 */ ts + 1372, /* "Halt" */ - /* 69 */ ts + 1377, /* "Integer" */ - /* 70 */ ts + 1385, /* "Int64" */ - /* 71 */ ts + 1391, /* "String" */ - /* 72 */ ts + 1398, /* "Null" */ - /* 73 */ ts + 1403, /* "SoftNull" */ - /* 74 */ ts + 1412, /* "Blob" */ - /* 75 */ ts + 1417, /* "Variable" */ - /* 76 */ ts + 1426, /* "Move" */ - /* 77 */ ts + 1431, /* "Copy" */ - /* 78 */ ts + 1436, /* "SCopy" */ - /* 79 */ ts + 1442, /* "IntCopy" */ - /* 80 */ ts + 1450, /* "ChngCntRow" */ - /* 81 */ ts + 1461, /* "ResultRow" */ - /* 82 */ ts + 1471, /* "CollSeq" */ - /* 83 */ ts + 1479, /* "AddImm" */ - /* 84 */ ts + 1486, /* "RealAffinity" */ - /* 85 */ ts + 1499, /* "Cast" */ - /* 86 */ ts + 1504, /* "Permutation" */ - /* 87 */ ts + 1516, /* "Compare" */ - /* 88 */ ts + 1524, /* "IsTrue" */ - /* 89 */ ts + 1531, /* "ZeroOrNull" */ - /* 90 */ ts + 1542, /* "Offset" */ - /* 91 */ ts + 1549, /* "Column" */ - /* 92 */ ts + 1556, /* "Affinity" */ - /* 93 */ ts + 1565, /* "MakeRecord" */ - /* 94 */ ts + 1576, /* "Count" */ - /* 95 */ ts + 1582, /* "ReadCookie" */ - /* 96 */ ts + 1593, /* "SetCookie" */ - /* 97 */ ts + 1603, /* "ReopenIdx" */ - /* 98 */ ts + 1613, /* "OpenRead" */ - /* 99 */ ts + 1622, /* "OpenWrite" */ - /* 100 */ ts + 1632, /* "OpenDup" */ - /* 101 */ ts + 1640, /* "OpenAutoindex" */ - /* 102 */ ts + 1654, /* "BitAnd" */ - /* 103 */ ts + 1661, /* "BitOr" */ - /* 104 */ ts + 1667, /* "ShiftLeft" */ - /* 105 */ ts + 1677, /* "ShiftRight" */ - /* 106 */ ts + 1688, /* "Add" */ - /* 107 */ ts + 1692, /* "Subtract" */ - /* 108 */ ts + 1701, /* "Multiply" */ - /* 109 */ ts + 1710, /* "Divide" */ - /* 110 */ ts + 1717, /* "Remainder" */ - /* 111 */ ts + 1727, /* "Concat" */ - /* 112 */ ts + 1734, /* "OpenEphemeral" */ - /* 113 */ ts + 1748, /* "BitNot" */ - /* 114 */ ts + 1755, /* "SorterOpen" */ - /* 115 */ ts + 1766, /* "SequenceTest" */ - /* 116 */ ts + 1779, /* "String8" */ - /* 117 */ ts + 1787, /* "OpenPseudo" */ - /* 118 */ ts + 1798, /* "Close" */ - /* 119 */ ts + 1804, /* "ColumnsUsed" */ - /* 120 */ ts + 1816, /* "SeekScan" */ - /* 121 */ ts + 1825, /* "SeekHit" */ - /* 122 */ ts + 1833, /* "Sequence" */ - /* 123 */ ts + 1842, /* "NewRowid" */ - /* 124 */ ts + 1851, /* "Insert" */ - /* 125 */ ts + 1858, /* "RowCell" */ - /* 126 */ ts + 1866, /* "Delete" */ - /* 127 */ ts + 1873, /* "ResetCount" */ - /* 128 */ ts + 1884, /* "SorterCompare" */ - /* 129 */ ts + 1898, /* "SorterData" */ - /* 130 */ ts + 1909, /* "RowData" */ - /* 131 */ ts + 1917, /* "Rowid" */ - /* 132 */ ts + 1923, /* "NullRow" */ - /* 133 */ ts + 1931, /* "SeekEnd" */ - /* 134 */ ts + 1939, /* "IdxInsert" */ - /* 135 */ ts + 1949, /* "SorterInsert" */ - /* 136 */ ts + 1962, /* "IdxDelete" */ - /* 137 */ ts + 1972, /* "DeferredSeek" */ - /* 138 */ ts + 1985, /* "IdxRowid" */ - /* 139 */ ts + 1994, /* "FinishSeek" */ - /* 140 */ ts + 2005, /* "Destroy" */ - /* 141 */ ts + 2013, /* "Clear" */ - /* 142 */ ts + 2019, /* "ResetSorter" */ - /* 143 */ ts + 2031, /* "CreateBtree" */ - /* 144 */ ts + 2043, /* "SqlExec" */ - /* 145 */ ts + 2051, /* "ParseSchema" */ - /* 146 */ ts + 2063, /* "LoadAnalysis" */ - /* 147 */ ts + 2076, /* "DropTable" */ - /* 148 */ ts + 2086, /* "DropIndex" */ - /* 149 */ ts + 2096, /* "DropTrigger" */ - /* 150 */ ts + 2108, /* "IntegrityCk" */ - /* 151 */ ts + 2120, /* "RowSetAdd" */ - /* 152 */ ts + 2130, /* "Real" */ - /* 153 */ ts + 2135, /* "Param" */ - /* 154 */ ts + 2141, /* "FkCounter" */ - /* 155 */ ts + 2151, /* "MemMax" */ - /* 156 */ ts + 2158, /* "OffsetLimit" */ - /* 157 */ ts + 2170, /* "AggInverse" */ - /* 158 */ ts + 2181, /* "AggStep" */ - /* 159 */ ts + 2189, /* "AggStep1" */ - /* 160 */ ts + 2198, /* "AggValue" */ - /* 161 */ ts + 2207, /* "AggFinal" */ - /* 162 */ ts + 2216, /* "Expire" */ - /* 163 */ ts + 2223, /* "CursorLock" */ - /* 164 */ ts + 2234, /* "CursorUnlock" */ - /* 165 */ ts + 2247, /* "TableLock" */ - /* 166 */ ts + 2257, /* "VBegin" */ - /* 167 */ ts + 2264, /* "VCreate" */ - /* 168 */ ts + 2272, /* "VDestroy" */ - /* 169 */ ts + 2281, /* "VOpen" */ - /* 170 */ ts + 2287, /* "VColumn" */ - /* 171 */ ts + 2295, /* "VRename" */ - /* 172 */ ts + 2303, /* "Pagecount" */ - /* 173 */ ts + 2313, /* "MaxPgcnt" */ - /* 174 */ ts + 2322, /* "Trace" */ - /* 175 */ ts + 2328, /* "CursorHint" */ - /* 176 */ ts + 2339, /* "ReleaseReg" */ - /* 177 */ ts + 2350, /* "Noop" */ - /* 178 */ ts + 2355, /* "Explain" */ - /* 179 */ ts + 2363, /* "Abortable" */ + /* 0 */ ts + 872, /* "Savepoint" */ + /* 1 */ ts + 882, /* "AutoCommit" */ + /* 2 */ ts + 893, /* "Transaction" */ + /* 3 */ ts + 905, /* "SorterNext" */ + /* 4 */ ts + 916, /* "Prev" */ + /* 5 */ ts + 921, /* "Next" */ + /* 6 */ ts + 926, /* "Checkpoint" */ + /* 7 */ ts + 937, /* "JournalMode" */ + /* 8 */ ts + 949, /* "Vacuum" */ + /* 9 */ ts + 956, /* "VFilter" */ + /* 10 */ ts + 964, /* "VUpdate" */ + /* 11 */ ts + 972, /* "Goto" */ + /* 12 */ ts + 977, /* "Gosub" */ + /* 13 */ ts + 983, /* "InitCoroutine" */ + /* 14 */ ts + 997, /* "Yield" */ + /* 15 */ ts + 1003, /* "MustBeInt" */ + /* 16 */ ts + 1013, /* "Jump" */ + /* 17 */ ts + 1018, /* "Once" */ + /* 18 */ ts + 1023, /* "If" */ + /* 19 */ ts + 1026, /* "Not" */ + /* 20 */ ts + 1030, /* "IfNot" */ + /* 21 */ ts + 1036, /* "IfNullRow" */ + /* 22 */ ts + 1046, /* "SeekLT" */ + /* 23 */ ts + 1053, /* "SeekLE" */ + /* 24 */ ts + 1060, /* "SeekGE" */ + /* 25 */ ts + 1067, /* "SeekGT" */ + /* 26 */ ts + 1074, /* "IfNotOpen" */ + /* 27 */ ts + 1084, /* "IfNoHope" */ + /* 28 */ ts + 1093, /* "NoConflict" */ + /* 29 */ ts + 1104, /* "NotFound" */ + /* 30 */ ts + 1113, /* "Found" */ + /* 31 */ ts + 1119, /* "SeekRowid" */ + /* 32 */ ts + 1129, /* "NotExists" */ + /* 33 */ ts + 1139, /* "Last" */ + /* 34 */ ts + 1144, /* "IfSmaller" */ + /* 35 */ ts + 1154, /* "SorterSort" */ + /* 36 */ ts + 1165, /* "Sort" */ + /* 37 */ ts + 1170, /* "Rewind" */ + /* 38 */ ts + 1177, /* "IdxLE" */ + /* 39 */ ts + 1183, /* "IdxGT" */ + /* 40 */ ts + 1189, /* "IdxLT" */ + /* 41 */ ts + 1195, /* "IdxGE" */ + /* 42 */ ts + 1201, /* "RowSetRead" */ + /* 43 */ ts + 1212, /* "Or" */ + /* 44 */ ts + 1215, /* "And" */ + /* 45 */ ts + 1219, /* "RowSetTest" */ + /* 46 */ ts + 1230, /* "Program" */ + /* 47 */ ts + 1238, /* "FkIfZero" */ + /* 48 */ ts + 1247, /* "IfPos" */ + /* 49 */ ts + 1253, /* "IfNotZero" */ + /* 50 */ ts + 1263, /* "IsNull" */ + /* 51 */ ts + 1270, /* "NotNull" */ + /* 52 */ ts + 1278, /* "Ne" */ + /* 53 */ ts + 1281, /* "Eq" */ + /* 54 */ ts + 1284, /* "Gt" */ + /* 55 */ ts + 1287, /* "Le" */ + /* 56 */ ts + 1290, /* "Lt" */ + /* 57 */ ts + 1293, /* "Ge" */ + /* 58 */ ts + 1296, /* "ElseEq" */ + /* 59 */ ts + 1303, /* "DecrJumpZero" */ + /* 60 */ ts + 1316, /* "IncrVacuum" */ + /* 61 */ ts + 1327, /* "VNext" */ + /* 62 */ ts + 1333, /* "Init" */ + /* 63 */ ts + 1338, /* "PureFunc" */ + /* 64 */ ts + 1347, /* "Function" */ + /* 65 */ ts + 1356, /* "Return" */ + /* 66 */ ts + 1363, /* "EndCoroutine" */ + /* 67 */ ts + 1376, /* "HaltIfNull" */ + /* 68 */ ts + 1387, /* "Halt" */ + /* 69 */ ts + 1392, /* "Integer" */ + /* 70 */ ts + 1400, /* "Int64" */ + /* 71 */ ts + 1406, /* "String" */ + /* 72 */ ts + 1413, /* "Null" */ + /* 73 */ ts + 1418, /* "SoftNull" */ + /* 74 */ ts + 1427, /* "Blob" */ + /* 75 */ ts + 1432, /* "Variable" */ + /* 76 */ ts + 1441, /* "Move" */ + /* 77 */ ts + 1446, /* "Copy" */ + /* 78 */ ts + 1451, /* "SCopy" */ + /* 79 */ ts + 1457, /* "IntCopy" */ + /* 80 */ ts + 1465, /* "ChngCntRow" */ + /* 81 */ ts + 1476, /* "ResultRow" */ + /* 82 */ ts + 1486, /* "CollSeq" */ + /* 83 */ ts + 1494, /* "AddImm" */ + /* 84 */ ts + 1501, /* "RealAffinity" */ + /* 85 */ ts + 1514, /* "Cast" */ + /* 86 */ ts + 1519, /* "Permutation" */ + /* 87 */ ts + 1531, /* "Compare" */ + /* 88 */ ts + 1539, /* "IsTrue" */ + /* 89 */ ts + 1546, /* "ZeroOrNull" */ + /* 90 */ ts + 1557, /* "Offset" */ + /* 91 */ ts + 1564, /* "Column" */ + /* 92 */ ts + 1571, /* "Affinity" */ + /* 93 */ ts + 1580, /* "MakeRecord" */ + /* 94 */ ts + 1591, /* "Count" */ + /* 95 */ ts + 1597, /* "ReadCookie" */ + /* 96 */ ts + 1608, /* "SetCookie" */ + /* 97 */ ts + 1618, /* "ReopenIdx" */ + /* 98 */ ts + 1628, /* "OpenRead" */ + /* 99 */ ts + 1637, /* "OpenWrite" */ + /* 100 */ ts + 1647, /* "OpenDup" */ + /* 101 */ ts + 1655, /* "OpenAutoindex" */ + /* 102 */ ts + 1669, /* "BitAnd" */ + /* 103 */ ts + 1676, /* "BitOr" */ + /* 104 */ ts + 1682, /* "ShiftLeft" */ + /* 105 */ ts + 1692, /* "ShiftRight" */ + /* 106 */ ts + 1703, /* "Add" */ + /* 107 */ ts + 1707, /* "Subtract" */ + /* 108 */ ts + 1716, /* "Multiply" */ + /* 109 */ ts + 1725, /* "Divide" */ + /* 110 */ ts + 1732, /* "Remainder" */ + /* 111 */ ts + 1742, /* "Concat" */ + /* 112 */ ts + 1749, /* "OpenEphemeral" */ + /* 113 */ ts + 1763, /* "BitNot" */ + /* 114 */ ts + 1770, /* "SorterOpen" */ + /* 115 */ ts + 1781, /* "SequenceTest" */ + /* 116 */ ts + 1794, /* "String8" */ + /* 117 */ ts + 1802, /* "OpenPseudo" */ + /* 118 */ ts + 1813, /* "Close" */ + /* 119 */ ts + 1819, /* "ColumnsUsed" */ + /* 120 */ ts + 1831, /* "SeekScan" */ + /* 121 */ ts + 1840, /* "SeekHit" */ + /* 122 */ ts + 1848, /* "Sequence" */ + /* 123 */ ts + 1857, /* "NewRowid" */ + /* 124 */ ts + 1866, /* "Insert" */ + /* 125 */ ts + 1873, /* "RowCell" */ + /* 126 */ ts + 1881, /* "Delete" */ + /* 127 */ ts + 1888, /* "ResetCount" */ + /* 128 */ ts + 1899, /* "SorterCompare" */ + /* 129 */ ts + 1913, /* "SorterData" */ + /* 130 */ ts + 1924, /* "RowData" */ + /* 131 */ ts + 1932, /* "Rowid" */ + /* 132 */ ts + 1938, /* "NullRow" */ + /* 133 */ ts + 1946, /* "SeekEnd" */ + /* 134 */ ts + 1954, /* "IdxInsert" */ + /* 135 */ ts + 1964, /* "SorterInsert" */ + /* 136 */ ts + 1977, /* "IdxDelete" */ + /* 137 */ ts + 1987, /* "DeferredSeek" */ + /* 138 */ ts + 2000, /* "IdxRowid" */ + /* 139 */ ts + 2009, /* "FinishSeek" */ + /* 140 */ ts + 2020, /* "Destroy" */ + /* 141 */ ts + 2028, /* "Clear" */ + /* 142 */ ts + 2034, /* "ResetSorter" */ + /* 143 */ ts + 2046, /* "CreateBtree" */ + /* 144 */ ts + 2058, /* "SqlExec" */ + /* 145 */ ts + 2066, /* "ParseSchema" */ + /* 146 */ ts + 2078, /* "LoadAnalysis" */ + /* 147 */ ts + 2091, /* "DropTable" */ + /* 148 */ ts + 2101, /* "DropIndex" */ + /* 149 */ ts + 2111, /* "DropTrigger" */ + /* 150 */ ts + 2123, /* "IntegrityCk" */ + /* 151 */ ts + 2135, /* "RowSetAdd" */ + /* 152 */ ts + 2145, /* "Real" */ + /* 153 */ ts + 2150, /* "Param" */ + /* 154 */ ts + 2156, /* "FkCounter" */ + /* 155 */ ts + 2166, /* "MemMax" */ + /* 156 */ ts + 2173, /* "OffsetLimit" */ + /* 157 */ ts + 2185, /* "AggInverse" */ + /* 158 */ ts + 2196, /* "AggStep" */ + /* 159 */ ts + 2204, /* "AggStep1" */ + /* 160 */ ts + 2213, /* "AggValue" */ + /* 161 */ ts + 2222, /* "AggFinal" */ + /* 162 */ ts + 2231, /* "Expire" */ + /* 163 */ ts + 2238, /* "CursorLock" */ + /* 164 */ ts + 2249, /* "CursorUnlock" */ + /* 165 */ ts + 2262, /* "TableLock" */ + /* 166 */ ts + 2272, /* "VBegin" */ + /* 167 */ ts + 2279, /* "VCreate" */ + /* 168 */ ts + 2287, /* "VDestroy" */ + /* 169 */ ts + 2296, /* "VOpen" */ + /* 170 */ ts + 2302, /* "VColumn" */ + /* 171 */ ts + 2310, /* "VRename" */ + /* 172 */ ts + 2318, /* "Pagecount" */ + /* 173 */ ts + 2328, /* "MaxPgcnt" */ + /* 174 */ ts + 2337, /* "Trace" */ + /* 175 */ ts + 2343, /* "CursorHint" */ + /* 176 */ ts + 2354, /* "ReleaseReg" */ + /* 177 */ ts + 2365, /* "Noop" */ + /* 178 */ ts + 2370, /* "Explain" */ + /* 179 */ ts + 2378, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -22195,67 +22701,67 @@ type unix_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [29]unix_syscall{ - {FzName: ts + 2373 /* "open" */, FpCurrent: 0}, + {FzName: ts + 2388 /* "open" */, FpCurrent: 0}, - {FzName: ts + 2378 /* "close" */, FpCurrent: 0}, + {FzName: ts + 2393 /* "close" */, FpCurrent: 0}, - {FzName: ts + 2384 /* "access" */, FpCurrent: 0}, + {FzName: ts + 2399 /* "access" */, FpCurrent: 0}, - {FzName: ts + 2391 /* "getcwd" */, FpCurrent: 0}, + {FzName: ts + 2406 /* "getcwd" */, FpCurrent: 0}, - {FzName: ts + 2398 /* "stat" */, FpCurrent: 0}, + {FzName: ts + 2413 /* "stat" */, FpCurrent: 0}, // The DJGPP compiler environment looks mostly like Unix, but it // lacks the fcntl() system call. So redefine fcntl() to be something // that always succeeds. This means that locking does not occur under // DJGPP. But it is DOS - what did you expect? - {FzName: ts + 2403 /* "fstat" */, FpCurrent: 0}, + {FzName: ts + 2418 /* "fstat" */, FpCurrent: 0}, - {FzName: ts + 2409 /* "ftruncate" */, FpCurrent: 0}, + {FzName: ts + 2424 /* "ftruncate" */, FpCurrent: 0}, - {FzName: ts + 2419 /* "fcntl" */, FpCurrent: 0}, + {FzName: ts + 2434 /* "fcntl" */, FpCurrent: 0}, - {FzName: ts + 2425 /* "read" */, FpCurrent: 0}, + {FzName: ts + 2440 /* "read" */, FpCurrent: 0}, - {FzName: ts + 2430 /* "pread" */}, + {FzName: ts + 2445 /* "pread" */}, - {FzName: ts + 2436 /* "pread64" */}, + {FzName: ts + 2451 /* "pread64" */}, - {FzName: ts + 2444 /* "write" */, FpCurrent: 0}, + {FzName: ts + 2459 /* "write" */, FpCurrent: 0}, - {FzName: ts + 2450 /* "pwrite" */}, + {FzName: ts + 2465 /* "pwrite" */}, - {FzName: ts + 2457 /* "pwrite64" */}, + {FzName: ts + 2472 /* "pwrite64" */}, - {FzName: ts + 2466 /* "fchmod" */, FpCurrent: 0}, + {FzName: ts + 2481 /* "fchmod" */, FpCurrent: 0}, - {FzName: ts + 2473 /* "fallocate" */}, + {FzName: ts + 2488 /* "fallocate" */}, - {FzName: ts + 2483 /* "unlink" */, FpCurrent: 0}, + {FzName: ts + 2498 /* "unlink" */, FpCurrent: 0}, - {FzName: ts + 2490 /* "openDirectory" */, FpCurrent: 0}, + {FzName: ts + 2505 /* "openDirectory" */, FpCurrent: 0}, - {FzName: ts + 2504 /* "mkdir" */, FpCurrent: 0}, + {FzName: ts + 2519 /* "mkdir" */, FpCurrent: 0}, - {FzName: ts + 2510 /* "rmdir" */, FpCurrent: 0}, + {FzName: ts + 2525 /* "rmdir" */, FpCurrent: 0}, - {FzName: ts + 2516 /* "fchown" */, FpCurrent: 0}, + {FzName: ts + 2531 /* "fchown" */, FpCurrent: 0}, - {FzName: ts + 2523 /* "geteuid" */, FpCurrent: 0}, + {FzName: ts + 2538 /* "geteuid" */, FpCurrent: 0}, - {FzName: ts + 2531 /* "mmap" */, FpCurrent: 0}, + {FzName: ts + 2546 /* "mmap" */, FpCurrent: 0}, - {FzName: ts + 2536 /* "munmap" */, FpCurrent: 0}, + {FzName: ts + 2551 /* "munmap" */, FpCurrent: 0}, - {FzName: ts + 2543 /* "mremap" */, FpCurrent: 0}, + {FzName: ts + 2558 /* "mremap" */, FpCurrent: 0}, - {FzName: ts + 2550 /* "getpagesize" */, FpCurrent: 0}, + {FzName: ts + 2565 /* "getpagesize" */, FpCurrent: 0}, - {FzName: ts + 2562 /* "readlink" */, FpCurrent: 0}, + {FzName: ts + 2577 /* "readlink" */, FpCurrent: 0}, - {FzName: ts + 2571 /* "lstat" */, FpCurrent: 0}, + {FzName: ts + 2586 /* "lstat" */, FpCurrent: 0}, - {FzName: ts + 2577 /* "ioctl" */}, + {FzName: ts + 2592 /* "ioctl" */}, } /* sqlite3.c:34446:3 */ // End of the overrideable system calls @@ -22389,9 +22895,9 @@ func robust_open(tls *libc.TLS, z uintptr, f int32, m Mode_t) int32 { /* sqlite3 } (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, fd) Xsqlite3_log(tls, SQLITE_WARNING, - ts+2583 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) + ts+2598 /* "attempt to open ..." */, libc.VaList(bp, z, fd)) fd = -1 - if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2626 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { + if (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls, ts+2641 /* "/dev/null" */, O_RDONLY, int32(m)) < 0 { break } } @@ -22649,13 +23155,13 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // the strerror() function to obtain the human-readable error message // equivalent to errno. Otherwise, use strerror_r(). // This is a threadsafe build, but strerror_r() is not available. - zErr = ts + 740 /* "" */ + zErr = ts + 755 /* "" */ if zPath == uintptr(0) { - zPath = ts + 740 /* "" */ + zPath = ts + 755 /* "" */ } Xsqlite3_log(tls, errcode, - ts+2636, /* "os_unix.c:%d: (%..." */ + ts+2651, /* "os_unix.c:%d: (%..." */ libc.VaList(bp, iLine, iErrno, zFunc, zPath, zErr)) return errcode @@ -22674,7 +23180,7 @@ func unixLogErrorAtLine(tls *libc.TLS, errcode int32, zFunc uintptr, zPath uintp // and move on. func robust_close(tls *libc.TLS, pFile uintptr, h int32, lineno int32) { /* sqlite3.c:35345:13: */ if (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*24 + 8 /* &.pCurrent */))))(tls, h) != 0 { - unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2378, /* "close" */ + unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), ts+2393, /* "close" */ func() uintptr { if pFile != 0 { return (*UnixFile)(unsafe.Pointer(pFile)).FzPath @@ -22833,19 +23339,19 @@ func verifyDbFile(tls *libc.TLS, pFile uintptr) { /* sqlite3.c:35532:13: */ rc = (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*24 + 8 /* &.pCurrent */))))(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, bp+32 /* &buf */) if rc != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2667 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2682 /* "cannot fstat db ..." */, libc.VaList(bp, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink == X__nlink_t(0) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2691 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2706 /* "file unlinked wh..." */, libc.VaList(bp+8, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if (*stat)(unsafe.Pointer(bp+32 /* &buf */)).Fst_nlink > X__nlink_t(1) { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2720 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2735 /* "multiple links t..." */, libc.VaList(bp+16, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } if fileHasMoved(tls, pFile) != 0 { - Xsqlite3_log(tls, SQLITE_WARNING, ts+2747 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) + Xsqlite3_log(tls, SQLITE_WARNING, ts+2762 /* "file renamed whi..." */, libc.VaList(bp+24, (*UnixFile)(unsafe.Pointer(pFile)).FzPath)) return } } @@ -23959,7 +24465,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql var fd int32 = -1 // var zDirname [513]int8 at bp+8, 513 - Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2775 /* "%s" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, MAX_PATHNAME, bp+8 /* &zDirname[0] */, ts+2790 /* "%s" */, libc.VaList(bp, zFilename)) for ii = int32(libc.Xstrlen(tls, bp+8 /* &zDirname[0] */)); (ii > 0) && (int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zDirname[0] */ + uintptr(ii)))) != '/'); ii-- { } if ii > 0 { @@ -23978,7 +24484,7 @@ func openDirectory(tls *libc.TLS, zFilename uintptr, pFd uintptr) int32 { /* sql if fd >= 0 { return SQLITE_OK } - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2490 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 37775), ts+2505 /* "openDirectory" */, bp+8 /* &zDirname[0] */, 37775) } // Make sure all writes to a particular file are committed to disk. @@ -24013,7 +24519,7 @@ func unixSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:37793 if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2778 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), ts+2793 /* "full_fsync" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37816) } // Also fsync the directory containing the file if the DIRSYNC flag @@ -24051,7 +24557,7 @@ func unixTruncate(tls *libc.TLS, id uintptr, nByte I64) int32 { /* sqlite3.c:378 rc = robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) if rc != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2409 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2424 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37861) } else { // If the file was just truncated to a size smaller than the currently @@ -24130,7 +24636,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if iWrite >= nSize { iWrite = (nSize - int64(1)) } - nWrite = seekAndWrite(tls, pFile, iWrite, ts+740 /* "" */, 1) + nWrite = seekAndWrite(tls, pFile, iWrite, ts+755 /* "" */, 1) if nWrite != 1 { return (SQLITE_IOERR | (int32(3) << 8)) } @@ -24143,7 +24649,7 @@ func fcntlSizeHint(tls *libc.TLS, pFile uintptr, nByte I64) int32 { /* sqlite3.c if (*UnixFile)(unsafe.Pointer(pFile)).FszChunk <= 0 { if robust_ftruncate(tls, (*UnixFile)(unsafe.Pointer(pFile)).Fh, nByte) != 0 { storeLastErrno(tls, pFile, *(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) - return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2409 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) + return unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), ts+2424 /* "ftruncate" */, (*UnixFile)(unsafe.Pointer(pFile)).FzPath, 37982) } } @@ -24217,7 +24723,7 @@ func unixFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK } @@ -24503,7 +25009,7 @@ func unixLockSharedMemory(tls *libc.TLS, pDbFd uintptr, pShmNode uintptr) int32 // help detect if a -shm file truncation is legitimate or is the work // or a rogue process. if (rc == SQLITE_OK) && (robust_ftruncate(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(3)) != 0) { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2409 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), ts+2424 /* "ftruncate" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38591) } } } else if int32((*flock)(unsafe.Pointer(bp+8 /* &lock */)).Fl_type) == F_WRLCK { @@ -24609,7 +25115,7 @@ __4: ; libc.Xmemset(tls, pShmNode, 0, (uint64(unsafe.Sizeof(unixShmNode{})) + uint64(nShmFilename))) zShm = libc.AssignPtrUintptr(pShmNode+16 /* &.zFilename */, (pShmNode + 1*96)) - Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2789 /* "%s-shm" */, libc.VaList(bp, zBasePath)) + Xsqlite3_snprintf(tls, nShmFilename, zShm, ts+2804 /* "%s-shm" */, libc.VaList(bp, zBasePath)) (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = -1 (*UnixInodeInfo)(unsafe.Pointer((*UnixFile)(unsafe.Pointer(pDbFd)).FpInode)).FpShmNode = pShmNode @@ -24631,7 +25137,7 @@ __5: if !(int32((*UnixInodeInfo)(unsafe.Pointer(pInode)).FbProcessLock) == 0) { goto __7 } - if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2796 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*UnixFile)(unsafe.Pointer(pDbFd)).FzPath, ts+2811 /* "readonly_shm" */, 0)) { goto __8 } (*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm = robust_open(tls, zShm, ((O_RDWR | O_CREAT) | 0100000), @@ -24646,7 +25152,7 @@ __8: if !((*unixShmNode)(unsafe.Pointer(pShmNode)).FhShm < 0) { goto __10 } - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2373 /* "open" */, zShm, 38716) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 38716), ts+2388 /* "open" */, zShm, 38716) goto shm_open_err __10: ; @@ -24813,11 +25319,11 @@ __11: goto __13 } *(*int32)(unsafe.Pointer(bp + 128 /* x */)) = 0 - if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+740 /* "" */, 1, bp+128 /* &x */) != 1) { + if !(seekAndWriteFd(tls, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FhShm, (int64(((iPg*pgsz)+pgsz)-1)), ts+755 /* "" */, 1, bp+128 /* &x */) != 1) { goto __14 } zFile = (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2444 /* "write" */, zFile, 38860) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), ts+2459 /* "write" */, zFile, 38860) goto shmpage_out __14: ; @@ -24865,7 +25371,7 @@ __16: if !(pMem == (libc.UintptrFromInt32(-1))) { goto __20 } - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2531 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), ts+2546 /* "mmap" */, (*UnixShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 38887) goto shmpage_out __20: ; @@ -25124,7 +25630,7 @@ func unixUnmapfile(tls *libc.TLS, pFd uintptr) { /* sqlite3.c:39165:13: */ // continue accessing the database using the xRead() and xWrite() // methods. func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13: */ - var zErr uintptr = ts + 2531 /* "mmap" */ + var zErr uintptr = ts + 2546 /* "mmap" */ var h int32 = (*UnixFile)(unsafe.Pointer(pFd)).Fh // File descriptor open on db file var pOrig uintptr = (*UnixFile)(unsafe.Pointer(pFd)).FpMapRegion // Pointer to current file mapping var nOrig I64 = (*UnixFile)(unsafe.Pointer(pFd)).FmmapSizeActual // Size of pOrig region in bytes @@ -25141,7 +25647,7 @@ func unixRemapfile(tls *libc.TLS, pFd uintptr, nNew I64) { /* sqlite3.c:39190:13 } pNew = (*(*func(*libc.TLS, uintptr, Size_t, Size_t, int32, uintptr) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 24*24 + 8 /* &.pCurrent */))))(tls, pOrig, uint64(nReuse), uint64(nNew), MREMAP_MAYMOVE, 0) - zErr = ts + 2543 /* "mremap" */ + zErr = ts + 2558 /* "mremap" */ // The attempt to extend the existing mapping failed. Free it. if (pNew == (libc.UintptrFromInt32(-1))) || (pNew == uintptr(0)) { @@ -25377,10 +25883,10 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename } return uintptr(0) }(), - ts+2809 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { + ts+2824 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_PSOW)) } - if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2814 /* "unix-excl" */) == 0 { + if libc.Xstrcmp(tls, (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, ts+2829 /* "unix-excl" */) == 0 { *(*uint16)(unsafe.Pointer(pNew + 30 /* &.ctrlFlags */)) |= uint16((UNIXFILE_EXCL)) } @@ -25426,7 +25932,7 @@ func fillInUnixFile(tls *libc.TLS, pVfs uintptr, h int32, pId uintptr, zFilename if zLockFile == uintptr(0) { rc = SQLITE_NOMEM } else { - Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2824 /* "%s.lock" */, libc.VaList(bp, zFilename)) + Xsqlite3_snprintf(tls, nFilename, zLockFile, ts+2839 /* "%s.lock" */, libc.VaList(bp, zFilename)) } (*UnixFile)(unsafe.Pointer(pNew)).FlockingContext = zLockFile } @@ -25456,10 +25962,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var zDir uintptr = Xsqlite3_temp_directory if !(int32(azDirs[0]) != 0) { - azDirs[0] = libc.Xgetenv(tls, ts+2832 /* "SQLITE_TMPDIR" */) + azDirs[0] = libc.Xgetenv(tls, ts+2847 /* "SQLITE_TMPDIR" */) } if !(int32(azDirs[1]) != 0) { - azDirs[1] = libc.Xgetenv(tls, ts+2846 /* "TMPDIR" */) + azDirs[1] = libc.Xgetenv(tls, ts+2861 /* "TMPDIR" */) } for 1 != 0 { if (((zDir != uintptr(0)) && @@ -25479,10 +25985,10 @@ func unixTempFileDir(tls *libc.TLS) uintptr { /* sqlite3.c:39856:19: */ var azDirs = [6]uintptr{ uintptr(0), uintptr(0), - ts + 2853, /* "/var/tmp" */ - ts + 2862, /* "/usr/tmp" */ - ts + 2871, /* "/tmp" */ - ts + 753, /* "." */ + ts + 2868, /* "/var/tmp" */ + ts + 2877, /* "/usr/tmp" */ + ts + 2886, /* "/tmp" */ + ts + 768, /* "." */ } /* sqlite3.c:39857:21 */ // Create a temporary file name in zBuf. zBuf must be allocated @@ -25510,7 +26016,7 @@ func unixGetTempname(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqlite3 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U64(0))), bp+24 /* &r */) *(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2)))) = int8(0) - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2876, /* "%s/etilqs_%llx%c" */ + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+2891, /* "%s/etilqs_%llx%c" */ libc.VaList(bp, zDir, *(*U64)(unsafe.Pointer(bp + 24 /* r */)), 0)) if (int32(*(*int8)(unsafe.Pointer(zBuf + uintptr((nBuf - 2))))) != 0) || ((libc.PostIncInt32(&iLimit, 1)) > 10) { return SQLITE_ERROR @@ -25666,7 +26172,7 @@ func findCreateFileMode(tls *libc.TLS, zPath uintptr, flags int32, pMode uintptr // filename, check for the "modeof" parameter. If present, interpret // its value as a filename and try to copy the mode, uid and gid from // that file. - var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2893 /* "modeof" */) + var z uintptr = Xsqlite3_uri_parameter(tls, zPath, ts+2908 /* "modeof" */) if z != 0 { rc = getFileMode(tls, z, pMode, pUid, pGid) } @@ -25892,7 +26398,7 @@ __15: if !(fd < 0) { goto __19 } - rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2373 /* "open" */, zName, 40257) + rc2 = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40257), ts+2388 /* "open" */, zName, 40257) if !(rc == SQLITE_OK) { goto __20 } @@ -26003,7 +26509,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) == ENOENT { rc = (SQLITE_IOERR | (int32(23) << 8)) } else { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2483 /* "unlink" */, zPath, 40396) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), ts+2498 /* "unlink" */, zPath, 40396) } return rc } @@ -26013,7 +26519,7 @@ func unixDelete(tls *libc.TLS, NotUsed uintptr, zPath uintptr, dirSync int32) in rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*24 + 8 /* &.pCurrent */))))(tls, zPath, bp /* &fd */) if rc == SQLITE_OK { if full_fsync(tls, *(*int32)(unsafe.Pointer(bp /* fd */)), 0, 0) != 0 { - rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2900 /* "fsync" */, zPath, 40406) + rc = unixLogErrorAtLine(tls, (SQLITE_IOERR | (int32(5) << 8)), ts+2915 /* "fsync" */, zPath, 40406) } robust_close(tls, uintptr(0), *(*int32)(unsafe.Pointer(bp /* fd */)), 40408) } else { @@ -26088,7 +26594,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 if int32(*(*int8)(unsafe.Pointer(zPath))) != '/' { if (*(*func(*libc.TLS, uintptr, Size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, zOut, (uint64(nOut-2))) == uintptr(0) { - return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2391 /* "getcwd" */, zPath, 40485) + return unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40485), ts+2406 /* "getcwd" */, zPath, 40485) } iOff = Xsqlite3Strlen30(tls, zOut) *(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOff, 1)))) = int8('/') @@ -26099,7 +26605,7 @@ func mkFullPathname(tls *libc.TLS, zPath uintptr, zOut uintptr, nOut int32) int3 *(*int8)(unsafe.Pointer(zOut + uintptr(iOff))) = int8(0) return Xsqlite3CantopenError(tls, 40494) } - Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2775 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, (nOut - iOff), (zOut + uintptr(iOff)), ts+2790 /* "%s" */, libc.VaList(bp, zPath)) // Remove duplicate '/' characters. Except, two // at the beginning // of a pathname is allowed since this is important on windows. @@ -26174,7 +26680,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 27*24 + 8 /* &.pCurrent */))))(tls, zIn, bp /* &buf */) != 0 { if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) != ENOENT { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2571 /* "lstat" */, zIn, 40577) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40577), ts+2586 /* "lstat" */, zIn, 40577) } } else { bLink = (libc.Bool32((((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mode) & X__mode_t(0170000)) == (X__mode_t(0120000)))) @@ -26194,7 +26700,7 @@ func unixFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zO if rc == SQLITE_OK { nByte = int32((*(*func(*libc.TLS, uintptr, uintptr, Size_t) Ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls, zIn, zDel, (uint64(nOut - 1)))) if nByte < 0 { - rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2562 /* "readlink" */, zIn, 40595) + rc = unixLogErrorAtLine(tls, Xsqlite3CantopenError(tls, 40595), ts+2577 /* "readlink" */, zIn, 40595) } else { if int32(*(*int8)(unsafe.Pointer(zDel))) != '/' { var n int32 @@ -26288,7 +26794,7 @@ func unixDlError(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBufOut uintptr) { unixEnterMutex(tls) zErr = libc.Xdlerror(tls) if zErr != 0 { - Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2775 /* "%s" */, libc.VaList(bp, zErr)) + Xsqlite3_snprintf(tls, nBuf, zBufOut, ts+2790 /* "%s" */, libc.VaList(bp, zErr)) } unixLeaveMutex(tls) } @@ -26345,7 +26851,7 @@ func unixRandomness(tls *libc.TLS, NotUsed uintptr, nBuf int32, zBuf uintptr) in { var fd int32 var got int32 - fd = robust_open(tls, ts+2906 /* "/dev/urandom" */, O_RDONLY, uint32(0)) + fd = robust_open(tls, ts+2921 /* "/dev/urandom" */, O_RDONLY, uint32(0)) if fd < 0 { // var t Time_t at bp, 8 @@ -26642,10 +27148,10 @@ func Xsqlite3_os_init(tls *libc.TLS) int32 { /* sqlite3.c:42038:16: */ } var aVfs = [4]Sqlite3_vfs{ - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2919 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2924 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2934 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, - {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2814 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2934 /* "unix" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2939 /* "unix-none" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2949 /* "unix-dotfile" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, + {FiVersion: 3 /* iVersion */, FszOsFile: int32(unsafe.Sizeof(UnixFile{})) /* szOsFile */, FmxPathname: MAX_PATHNAME /* pNext */, FzName: ts + 2829 /* "unix-excl" */ /* zName */, FpAppData: 0 /* pAppData */, FxOpen: 0 /* xOpen */, FxDelete: 0 /* xDelete */, FxAccess: 0 /* xAccess */, FxFullPathname: 0 /* xFullPathname */, FxDlOpen: 0 /* xDlOpen */, FxDlError: 0 /* xDlError */, FxDlSym: 0 /* xDlSym */, FxDlClose: 0 /* xDlClose */, FxRandomness: 0 /* xRandomness */, FxSleep: 0 /* xSleep */, FxCurrentTime: 0 /* xCurrentTime */, FxGetLastError: 0 /* xGetLastError */, FxCurrentTimeInt64: 0 /* xCurrentTimeInt64 */, FxSetSystemCall: 0 /* xSetSystemCall */, FxGetSystemCall: 0 /* xGetSystemCall */, FxNextSystemCall: 0 /* xNextSystemCall */}, } /* sqlite3.c:42091:22 */ // Shutdown the operating system interface. @@ -26740,7 +27246,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 2947, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 2962, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -26972,7 +27478,7 @@ func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int3 var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2953 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+2968 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -27115,7 +27621,7 @@ func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, z defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+2775 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+2790 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -27232,7 +27738,7 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+2968 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+2983 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { @@ -27305,7 +27811,7 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+2991 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+3006 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } @@ -32783,7 +33289,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3006, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+3021, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -34535,7 +35041,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3033 /* "-journal" */, uint64(8)) + libc.Xmemcpy(tls, pPtr, ts+3048 /* "-journal" */, uint64(8)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -34550,7 +35056,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+3042 /* "-wal" */, uint64(4)) + libc.Xmemcpy(tls, pPtr, ts+3057 /* "-wal" */, uint64(4)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -34609,9 +35115,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3047 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3062 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3054 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+3069 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -38508,7 +39014,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+3064, /* "recovered %d fra..." */ + ts+3079, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -39253,7 +39759,7 @@ func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13 } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+3101 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+3116 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -42033,7 +42539,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3127 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 3142 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -44073,7 +44579,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3143 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+3158 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -44947,7 +45453,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+3152 /* "@ " */, uint64(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+3167 /* "@ " */, uint64(3)) != 0) { goto __14 } goto page1_init_failed @@ -52463,7 +52969,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3156 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+3171 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 56 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -52499,11 +53005,11 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+3158 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3173 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+3181 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) + checkAppendMsg(tls, pCheck, ts+3196 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -52530,13 +53036,13 @@ func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent P if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+3206 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+3221 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+3235, /* "Bad ptr map entr..." */ + ts+3250, /* "Bad ptr map entr..." */ libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } @@ -52559,7 +53065,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } N-- if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+3289 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+3304 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) @@ -52570,7 +53076,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+3311 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) + ts+3326 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -52596,12 +53102,12 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+3350, /* "%s is %d but sho..." */ + ts+3365, /* "%s is %d but sho..." */ libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 3376 /* "size" */ + return ts + 3391 /* "size" */ } - return ts + 3381 /* "overflow list le..." */ + return ts + 3396 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -52745,13 +53251,13 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3402 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3417 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+3412 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+3427 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; @@ -52765,7 +53271,7 @@ __3: } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+3450 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) + ts+3465 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; @@ -52773,7 +53279,7 @@ __4: goto __5 } - checkAppendMsg(tls, pCheck, ts+3488 /* "free space corru..." */, libc.VaList(bp+16, rc)) + checkAppendMsg(tls, pCheck, ts+3503 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; @@ -52781,7 +53287,7 @@ __5: hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3510 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3525 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -52803,7 +53309,7 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3536 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 3551 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; @@ -52834,7 +53340,7 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+3564, /* "Offset %d out of..." */ + checkAppendMsg(tls, pCheck, ts+3579, /* "Offset %d out of..." */ libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 @@ -52845,7 +53351,7 @@ __12: if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+3594 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+3609 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: @@ -52863,7 +53369,7 @@ __13: }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+3618 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+3633 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) __15: ; *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey @@ -52904,7 +53410,7 @@ __20: if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+3642 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+3657 /* "Child page depth..." */, 0) depth = d2 __21: ; @@ -53002,7 +53508,7 @@ __29: goto __31 } checkAppendMsg(tls, pCheck, - ts+3667 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) + ts+3682 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) goto __30 goto __32 __31: @@ -53022,7 +53528,7 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+3704, /* "Fragmentation of..." */ + ts+3719, /* "Fragmentation of..." */ libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; @@ -53151,7 +53657,7 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3756 /* "Main freelist: " */ + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 3771 /* "Main freelist: " */ checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) @@ -53189,7 +53695,7 @@ __13: goto __15 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3772, /* "max rootpage (%d..." */ + ts+3787, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -53199,7 +53705,7 @@ __9: goto __16 } checkAppendMsg(tls, bp+32, /* &sCheck */ - ts+3817 /* "incremental_vacu..." */, 0) + ts+3832 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -53249,13 +53755,13 @@ __23: if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3872 /* "Page %d is never..." */, libc.VaList(bp+16, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3887 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3894 /* "Pointer map page..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+3909 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -53574,7 +54080,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2775 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+2790 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) @@ -53585,7 +54091,7 @@ func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintpt } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3928 /* "unknown database..." */, libc.VaList(bp+8, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+3943 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -53606,7 +54112,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3948 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+3963 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -53633,7 +54139,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+3979 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+3994 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -54247,7 +54753,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4019, /* "%!.15g" */ + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+4034, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -54888,7 +55394,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -55094,6 +55600,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -55399,7 +55907,7 @@ __9: goto __10 } rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -55471,7 +55979,7 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 zVal = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 740 /* "" */ + zNeg = ts + 755 /* "" */ rc = SQLITE_OK __1: @@ -55520,7 +56028,7 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 4026 /* "-" */ + zNeg = ts + 4041 /* "-" */ __6: ; @@ -55540,7 +56048,7 @@ __9: Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+4028 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+4043 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } @@ -56985,34 +57493,34 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4033 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4048 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(j)*8)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 740 /* "" */ + zColl = ts + 755 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+303 /* "BINARY" */) == 0 { - zColl = ts + 4038 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+318 /* "BINARY" */) == 0 { + zColl = ts + 4053 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4040, /* ",%s%s%s" */ + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4055, /* ",%s%s%s" */ libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 4026 /* "-" */ + return ts + 4041 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 4048 /* "N." */ + return ts + 4063 /* "N." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4066 /* ")" */, 1) break } @@ -57020,7 +57528,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4053 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4068 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -57028,32 +57536,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4062 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4077 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4062 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4077 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4074 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4089 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -57063,14 +57571,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4069 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 741 /* "NULL" */ + zP4 = ts + 756 /* "NULL" */ } else { - zP4 = ts + 4077 /* "(blob)" */ + zP4 = ts + 4092 /* "(blob)" */ } break @@ -57078,7 +57586,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4084 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4099 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -57089,20 +57597,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4092 /* "%c%u" */, libc.VaList(bp+128, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+4107 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4097 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+4112 /* "]" */, 1) break } case -4: { - zP4 = ts + 4099 /* "program" */ + zP4 = ts + 4114 /* "program" */ break } @@ -57134,7 +57642,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 4107 /* "?" */, ts + 4109 /* "8" */, ts + 4111 /* "16LE" */, ts + 4116 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 4122 /* "?" */, ts + 4124 /* "8" */, ts + 4126 /* "16LE" */, ts + 4131 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -57665,8 +58173,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 4121 /* "addr" */, ts + 4126 /* "opcode" */, ts + 4133 /* "p1" */, ts + 4136 /* "p2" */, ts + 4139 /* "p3" */, ts + 4142 /* "p4" */, ts + 4145 /* "p5" */, ts + 4148, /* "comment" */ - ts + 4156 /* "id" */, ts + 4159 /* "parent" */, ts + 4166 /* "notused" */, ts + 4174, /* "detail" */ + ts + 4136 /* "addr" */, ts + 4141 /* "opcode" */, ts + 4148 /* "p1" */, ts + 4151 /* "p2" */, ts + 4154 /* "p3" */, ts + 4157 /* "p4" */, ts + 4160 /* "p5" */, ts + 4163, /* "comment" */ + ts + 4171 /* "id" */, ts + 4174 /* "parent" */, ts + 4181 /* "notused" */, ts + 4189, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -57914,7 +58422,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+4181 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+4196 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } @@ -57924,16 +58432,16 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4193 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4208 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+4207 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+4222 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4222, /* "-mj%06X9%02X" */ + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+4237, /* "-mj%06X9%02X" */ libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. @@ -58127,7 +58635,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+4235 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4250 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -58409,7 +58917,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -59960,13 +60468,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 4265 /* "a CHECK constrai..." */ + zContext = ts + 4280 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 4284 /* "a generated colu..." */ + zContext = ts + 4299 /* "a generated colu..." */ } else { - zContext = ts + 4303 /* "an index" */ + zContext = ts + 4318 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+4312, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+4327, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -60097,7 +60605,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4348 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4363 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -60107,7 +60615,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+4393 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+4408 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -60577,7 +61085,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4433 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+4448 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -61328,7 +61836,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+4456 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+4471 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -62105,7 +62613,7 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4496 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4511 /* "-- " */, 3) Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) } @@ -62143,11 +62651,11 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 184 /* idx */))-1))*56) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+741 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+756 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4069 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4084 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4019 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4034 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc @@ -62162,21 +62670,21 @@ func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { pVar = bp + 192 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4500 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4515 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { Xsqlite3VdbeMemRelease(tls, bp+192 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4507 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4522 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4520 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4535 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4523 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+4538 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4528 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+4543 /* "'" */, 1) } } } @@ -65875,19 +66383,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+4530 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+4545 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4551 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+4566 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4558 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+4573 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -68437,7 +68945,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+4582 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4597 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -68510,7 +69018,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+4633 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) + Xsqlite3VdbeError(tls, p, ts+4648 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -68520,7 +69028,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+4655 /* "cannot release s..." */, 0) + ts+4670 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -68725,7 +69233,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+4709 /* "cannot commit tr..." */, 0) + ts+4724 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -68768,13 +69276,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 4764 /* "cannot start a t..." */ + return ts + 4779 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 4812 /* "cannot rollback ..." */ + return ts + 4827 /* "cannot rollback ..." */ } - return ts + 4855 /* "cannot commit - ..." */ + return ts + 4870 /* "cannot commit - ..." */ }() }(), 0) @@ -68892,7 +69400,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4896 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+4911 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -69274,7 +69782,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 740 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 755 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -71404,7 +71912,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4924 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+4939 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -71837,14 +72345,14 @@ __137: goto __720 __719: - zSchema = ts + 4941 /* "sqlite_master" */ + zSchema = ts + 4956 /* "sqlite_master" */ (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FiDb = iDb3 (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmInitFlags = U32(0) (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+4955, /* "SELECT*FROM\"%w\"...." */ + ts+4970, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 @@ -72177,7 +72685,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+4998 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5013 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -72622,7 +73130,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -72700,7 +73208,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -72815,12 +73323,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+5035, /* "cannot change %s..." */ + ts+5050, /* "cannot change %s..." */ libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 5087 /* "into" */ + return ts + 5102 /* "into" */ } - return ts + 5092 /* "out of" */ + return ts + 5107 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -73023,7 +73531,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+5099 /* "database table i..." */, libc.VaList(bp+112, z1)) + Xsqlite3VdbeError(tls, p, ts+5114 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -73267,7 +73775,7 @@ __833: if !((*Sqlite3_context)(unsafe.Pointer(bp+872 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) rc = (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FisError __834: ; @@ -73598,7 +74106,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -73688,7 +74196,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+5128 /* "-- %s" */, libc.VaList(bp+136, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+5143 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -73791,13 +74299,13 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+2775 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+2790 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+5134, /* "statement aborts..." */ + Xsqlite3_log(tls, rc, ts+5149, /* "statement aborts..." */ libc.VaList(bp+152, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { @@ -73842,14 +74350,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+4433 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+4448 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+5166 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+5181 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -73862,8 +74370,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 5180 /* "NOT NULL" */, ts + 5189 /* "UNIQUE" */, ts + 5196, /* "CHECK" */ - ts + 5202 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 5195 /* "NOT NULL" */, ts + 5204 /* "UNIQUE" */, ts + 5211, /* "CHECK" */ + ts + 5217 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -73970,16 +74478,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5214, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5229, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 5243 /* "null" */ + return ts + 5258 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 5248 /* "real" */ + return ts + 5263 /* "real" */ } - return ts + 5253 /* "integer" */ + return ts + 5268 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -73999,10 +74507,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5261 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+5276 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -74065,21 +74573,21 @@ __4: goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5281 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5296 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5311 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5326 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5347 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+5362 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { @@ -74124,7 +74632,7 @@ __12: goto __14 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5368 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5383 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74153,7 +74661,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FiFrom == iCol) { goto __23 } - zFault = ts + 5389 /* "foreign key" */ + zFault = ts + 5404 /* "foreign key" */ __23: ; goto __21 @@ -74186,7 +74694,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 5401 /* "indexed" */ + zFault = ts + 5416 /* "indexed" */ __30: ; goto __28 @@ -74207,7 +74715,7 @@ __26: goto __31 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5409 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+5424 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -74316,7 +74824,7 @@ __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)))) @@ -74481,7 +74989,7 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) @@ -78039,7 +78547,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5443 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+5458 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -78242,14 +78750,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5448 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5463 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5452 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+5467 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -78266,7 +78774,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5456 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+5471 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -78443,7 +78951,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+5465 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5480 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -78451,14 +78959,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+5496 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+5511 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -78534,7 +79042,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+5551 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) + ts+5566 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) return WRC_Prune @@ -78555,23 +79063,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 5586 /* "no such column" */ + zErr = ts + 5601 /* "no such column" */ } else { - zErr = ts + 5601 /* "ambiguous column..." */ + zErr = ts + 5616 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+5623 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5638 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+5636 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5651 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+5646 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5661 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -78705,15 +79213,15 @@ func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExp bp := tls.Alloc(16) defer tls.Free(16) - var zIn uintptr = ts + 5653 /* "partial index WH..." */ + var zIn uintptr = ts + 5668 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 5681 /* "index expression..." */ + zIn = ts + 5696 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 5699 /* "CHECK constraint..." */ + zIn = ts + 5714 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 5717 /* "generated column..." */ + zIn = ts + 5732 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5735 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+5750 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -78821,10 +79329,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5755 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5770 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5760 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5775 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -78877,7 +79385,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5766 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5781 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -78944,7 +79452,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+5783 /* "second argument ..." */, 0) + ts+5798 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -78969,7 +79477,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+5854, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+5869, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -78993,7 +79501,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+5889 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+5904 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -79022,30 +79530,30 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+5917 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) + ts+5932 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 5961 /* "window" */ + zType = ts + 5976 /* "window" */ } else { - zType = ts + 5968 /* "aggregate" */ + zType = ts + 5983 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+5978 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+5993 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6007 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+6022 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6030, /* "wrong number of ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6045, /* "wrong number of ..." */ libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+6075, /* "FILTER may not b..." */ + ts+6090, /* "FILTER may not b..." */ libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -79120,7 +79628,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6124 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6139 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) @@ -79137,7 +79645,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+6135 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+6150 /* "parameters" */, pExpr) } break @@ -79197,7 +79705,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) } break @@ -79302,7 +79810,7 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 Xsqlite3ErrorMsg(tls, pParse, - ts+6146 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+6161 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -79334,7 +79842,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6202 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6217 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -79369,7 +79877,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+6236 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + resolveOutOfRangeError(tls, pParse, ts+6251 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { @@ -79440,7 +79948,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+6242 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+6257 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -79468,7 +79976,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6303 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+6318 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -79757,7 +80265,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6334 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6349 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -79814,7 +80322,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6236 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6251 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -79827,7 +80335,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6378 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+6393 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -79839,7 +80347,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+6384 /* "aggregate functi..." */, 0) + ts+6399 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -80609,7 +81117,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) return } @@ -80685,7 +81193,7 @@ func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+6443 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+6458 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -80926,7 +81434,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -80948,7 +81456,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6493 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+6508 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -80982,7 +81490,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+6527 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6542 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -81035,7 +81543,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+6546, /* "variable number ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6561, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) return } @@ -81062,7 +81570,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+6589 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6604 /* "too many SQL var..." */, 0) } } @@ -81731,7 +82239,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+6612, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6627, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -81866,7 +82374,7 @@ func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+6642 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+6657 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -81921,10 +82429,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+5755 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5770 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+5760 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+5775 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -82369,13 +82877,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+6665 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6680 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6673 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6688 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+6679 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+6694 /* "OID" */) == 0 { return 1 } return 0 @@ -82603,7 +83111,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6683 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6698 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -82694,7 +83202,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6730 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6745 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -82800,7 +83308,7 @@ func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpec defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 6761 /* "sub-select retur..." */ + var zFmt uintptr = ts + 6776 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -82818,7 +83326,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) } } @@ -82871,7 +83379,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6805 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6820 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -82907,11 +83415,11 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6828 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6843 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 6847 /* "CORRELATED " */ + return ts + 6862 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. @@ -83057,7 +83565,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6859 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+6874 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -83090,11 +83598,11 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6877 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+6892 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 6847 /* "CORRELATED " */ + return ts + 6862 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr @@ -83118,7 +83626,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -83128,7 +83636,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6898 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+6913 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 @@ -83620,12 +84128,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+6900 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6903 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + if Xsqlite3_strnicmp(tls, z, ts+6915 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+6918 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 4026 /* "-" */ + return ts + 4041 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -83700,7 +84208,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6929 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6944 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -84259,7 +84767,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+6929, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6944, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -84511,7 +85019,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+6959 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+6974 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32)).FiMem @@ -84553,7 +85061,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+6985 /* "unknown function..." */, libc.VaList(bp+16, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7000 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -84747,7 +85255,7 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+6612, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+6627, /* "%d columns assig..." */ libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; @@ -84829,7 +85337,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+5533 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5548 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -84953,7 +85461,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+7008 /* "RAISE() may only..." */, 0) + ts+7023 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -84992,7 +85500,7 @@ __3: return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7058 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 7073 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -86829,11 +87337,11 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq bp := tls.Alloc(8) defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7074 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7089 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -86851,14 +87359,14 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+7102, /* "SELECT 1 FROM \"%..." */ + ts+7117, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7277, /* "SELECT 1 FROM te..." */ + ts+7292, /* "SELECT 1 FROM te..." */ libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -86874,11 +87382,11 @@ func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { Xsqlite3NestedParse(tls, pParse, - ts+7451 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+7466 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+7598 /* "UPDATE temp.sqli..." */, 0) + ts+7613 /* "UPDATE temp.sqli..." */, 0) } } @@ -86952,7 +87460,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+7749 /* "there is already..." */, libc.VaList(bp, zName)) + ts+7764 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -86965,7 +87473,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7808 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+7823 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -86975,7 +87483,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+7814 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7829 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -87028,24 +87536,24 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+7841 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+7856 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+8025, /* "UPDATE %Q.sqlite..." */ + ts+8040, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+8330 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+8345 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+8346, /* "UPDATE \"%w\".sqli..." */ + ts+8361, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -87058,7 +87566,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+8404 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+8419 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -87076,7 +87584,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8669 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+8684 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -87091,7 +87599,7 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+8682, /* "SELECT raise(ABO..." */ + ts+8697, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -87139,12 +87647,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8720 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+8735 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+8752 /* "Cannot add a UNI..." */, 0) + ts+8767 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -87157,11 +87665,11 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8779 /* "Cannot add a REF..." */) + ts+8794 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8838 /* "Cannot add a NOT..." */) + ts+8853 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() @@ -87177,12 +87685,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+8891 /* "Cannot add a col..." */) + ts+8906 /* "Cannot add a col..." */) } Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8937 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+8952 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -87198,7 +87706,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+8964, /* "UPDATE \"%w\".sqli..." */ + ts+8979, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -87269,7 +87777,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+9110 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9125 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -87278,7 +87786,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+9144 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+9159 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -87313,7 +87821,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(uint64(unsafe.Sizeof(Column{})) * uint64(nAlloc)))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9174 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+9189 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -87360,18 +87868,18 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 9193 /* "view" */ + zType = ts + 9208 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 9198 /* "virtual table" */ + zType = ts + 9213 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+9212, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9227, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 9230 /* "drop column from" */ + return ts + 9245 /* "drop column from" */ } - return ts + 9247 /* "rename columns o..." */ + return ts + 9262 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -87464,13 +87972,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+5368 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+5383 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -87488,19 +87996,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+9265, /* "UPDATE \"%w\".sqli..." */ + ts+9280, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+9483, /* "UPDATE temp.sqli..." */ + ts+9498, /* "UPDATE temp.sqli..." */ libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8669 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+8684 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -87795,12 +88303,12 @@ func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType ui var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+9614, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+9629, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 9637 /* " " */ + return ts + 9652 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -87909,7 +88417,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+9639 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+9654 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -87959,12 +88467,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.Xmemcpy(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9645 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+9660 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 9637 /* " " */ + return ts + 9652 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -88469,7 +88977,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -88649,7 +89157,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -88931,7 +89439,7 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+9650 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+9665 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) @@ -89019,7 +89527,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+5368 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+5383 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -89029,12 +89537,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+9657, /* "cannot drop %s c..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+9672, /* "cannot drop %s c..." */ libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 9685 /* "PRIMARY KEY" */ + return ts + 9700 /* "PRIMARY KEY" */ } - return ts + 5189 /* "UNIQUE" */ + return ts + 5204 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -89045,7 +89553,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+9697 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+9712 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -89054,15 +89562,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+9745 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+9760 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9866 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+9881 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -89173,11 +89681,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9884 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9905 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9925 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9944 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9963 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9899 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9920 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9940 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9959 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 9978 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -89374,7 +89882,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+9986 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + ts+10001 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } @@ -89386,10 +89894,10 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10009, /* "DELETE FROM %Q.%..." */ + ts+10024, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+10039 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+10054 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) @@ -89410,9 +89918,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 10057 /* "sqlite_stat1" */, FzCols: ts + 10070 /* "tbl,idx,stat" */}, - {FzName: ts + 10083 /* "sqlite_stat4" */, FzCols: ts + 10096 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 10124 /* "sqlite_stat3" */}, + {FzName: ts + 10072 /* "sqlite_stat1" */, FzCols: ts + 10085 /* "tbl,idx,stat" */}, + {FzName: ts + 10098 /* "sqlite_stat4" */, FzCols: ts + 10111 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 10139 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -89643,7 +90151,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10137 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 10152 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -89961,7 +90469,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10147 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 10162 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -90018,7 +90526,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+10157, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+10172, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -90029,7 +90537,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+10162 /* " %llu" */, libc.VaList(bp+8, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+10177 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -90078,7 +90586,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+10168 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+10183 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -90095,7 +90603,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10174 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 10189 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -90142,7 +90650,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+10183 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+10198 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -90160,7 +90668,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*120) - libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10057 /* "sqlite_stat1" */, uint64(13)) + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+10072 /* "sqlite_stat1" */, uint64(13)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -90393,7 +90901,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10193 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10208 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -90455,7 +90963,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10193 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+10208 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -90508,9 +91016,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10197 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+10212 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10201 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10216 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -90605,7 +91113,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 740 /* "" */ + z = ts + 755 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -90627,15 +91135,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+10205 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+10220 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+10216 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10231 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+10226 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+10241 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -90954,10 +91462,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+10083 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+10098 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+10238, /* "SELECT idx,count..." */ - ts+10292, /* "SELECT idx,neq,n..." */ + ts+10253, /* "SELECT idx,count..." */ + ts+10307, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -91008,9 +91516,9 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit // Load new statistics out of the sqlite_stat1 table (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+10057 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { + if Xsqlite3FindTable(tls, db, ts+10072 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+10344 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) + ts+10359 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { @@ -91102,7 +91610,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5443 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+5458 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -91153,13 +91661,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 740 /* "" */ + zFile = ts + 755 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __2: ; @@ -91169,7 +91677,7 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2947 /* "memdb" */) + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+2962 /* "memdb" */) if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) == uintptr(0)) { goto __5 } @@ -91185,7 +91693,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10385 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+10400 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -91198,7 +91706,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10388, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10403, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -91212,7 +91720,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10425 /* "database %s is a..." */, libc.VaList(bp+8, zName)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10440 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -91283,7 +91791,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10455 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10470 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -91300,7 +91808,7 @@ __21: goto __23 } *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+10484 /* "attached databas..." */, 0) + ts+10499 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -91370,13 +91878,13 @@ __29: } Xsqlite3OomFault(tls, db) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5166 /* "out of memory" */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+5181 /* "out of memory" */, 0) goto __31 __30: if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10552 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+10567 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -91432,7 +91940,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __1: ; i = 0 @@ -91464,14 +91972,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10580 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10595 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10601 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10616 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -91479,7 +91987,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10627 /* "database %s is l..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+10642 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -91602,7 +92110,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10649 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 10664 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -91615,7 +92123,7 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 10663 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 10678 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ @@ -91630,7 +92138,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10677 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+10692 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -91663,7 +92171,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+10701, /* "%s %T cannot ref..." */ + ts+10716, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -91862,7 +92370,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+10747 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10762 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -91886,11 +92394,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+10770 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+10785 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+10776 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+10791 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+10782 /* "access to %z is ..." */, libc.VaList(bp+32, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+10797 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -91942,7 +92450,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName } else { - zCol = ts + 6673 /* "ROWID" */ + zCol = ts + 6688 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -91974,7 +92482,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+10809 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10824 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -92284,25 +92792,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+5443 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+5458 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10824 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4941 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10839 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+4956 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+10857 /* "sqlite_temp_mast..." */) + ts+10872 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), - ts+4941 /* "sqlite_master" */) + ts+4956 /* "sqlite_master" */) } } } @@ -92325,12 +92833,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10843 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4941 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10824 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10858 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+4956 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+10839 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+10857 /* "sqlite_temp_mast..." */) + ts+10872 /* "sqlite_temp_mast..." */) } } } @@ -92366,7 +92874,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10876 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+10891 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -92384,14 +92892,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 10884 /* "no such view" */ + zMsg = ts + 10899 /* "no such view" */ } else { - zMsg = ts + 10897 /* "no such table" */ + zMsg = ts + 10912 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+5636 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5651 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+5646 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+5661 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -92704,7 +93212,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4941 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+4956 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -92731,7 +93239,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5443 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+5458 /* "main" */, zName)) { goto __3 } @@ -92784,13 +93292,13 @@ func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10911 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10926 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10928 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+10943 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -92831,13 +93339,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*8))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*8))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7066 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+7081 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+10948, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10963, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -93006,9 +93514,9 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 @@ -93026,7 +93534,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+10990 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11005 /* "temporary table ..." */, 0) return __4: ; @@ -93054,9 +93562,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 9193 /* "view" */ + return ts + 9208 /* "view" */ } - return ts + 7808 /* "table" */ + return ts + 7823 /* "table" */ }(), zName) != 0) { goto __8 } @@ -93073,9 +93581,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -93113,7 +93621,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+11031 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+11046 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -93127,7 +93635,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+11055 /* "there is already..." */, libc.VaList(bp+8, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11070 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -93243,7 +93751,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+11090 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+11105 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -93267,7 +93775,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11107 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11122 /* "cannot use RETUR..." */, 0) } else { } @@ -93288,7 +93796,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11090 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 11105 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -93300,7 +93808,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+11090 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+11105 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == (pRet + 16 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -93328,7 +93836,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11141 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11156 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -93344,7 +93852,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11164 /* "duplicate column..." */, libc.VaList(bp+8, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+11179 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -93518,11 +94026,11 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11190, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11205, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11235 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11250 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. @@ -93572,7 +94080,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11276 /* "generated column..." */, 0) + ts+11291 /* "generated column..." */, 0) } } @@ -93617,7 +94125,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+11328 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11343 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -93677,7 +94185,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), ts+11369 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), ts+11384 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -93705,7 +94213,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+11377 /* "AUTOINCREMENT is..." */, 0) + ts+11392 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -93809,7 +94317,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+11433 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11448 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -93822,13 +94330,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11476 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+11491 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11484 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+11499 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -93861,7 +94369,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+11491, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+11506, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -94003,13 +94511,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 740 /* "" */ - zSep2 = ts + 11522 /* "," */ - zEnd = ts + 4051 /* ")" */ + zSep = ts + 755 /* "" */ + zSep2 = ts + 11537 /* "," */ + zEnd = ts + 4066 /* ")" */ } else { - zSep = ts + 11524 /* "\n " */ - zSep2 = ts + 11528 /* ",\n " */ - zEnd = ts + 11533 /* "\n)" */ + zSep = ts + 11539 /* "\n " */ + zSep2 = ts + 11543 /* ",\n " */ + zEnd = ts + 11548 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -94017,7 +94525,7 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+11536 /* "CREATE TABLE " */, 0) + Xsqlite3_snprintf(tls, n, zStmt, ts+11551 /* "CREATE TABLE " */, 0) *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') @@ -94051,16 +94559,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2775 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+2790 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 740, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 11550, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 11556, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 11561, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 11566, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 755, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 11565, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 11571, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 11576, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 11581, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -94497,7 +95005,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -94510,11 +95018,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+11572 /* "AUTOINCREMENT no..." */, 0) + ts+11587 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+11622 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11637 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -94558,7 +95066,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11654 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11669 /* "must have at lea..." */, 0) return } } @@ -94591,12 +95099,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 7808 /* "table" */ - zType2 = ts + 11698 /* "TABLE" */ + zType = ts + 7823 /* "table" */ + zType2 = ts + 11713 /* "TABLE" */ } else { // A view - zType = ts + 9193 /* "view" */ - zType2 = ts + 11704 /* "VIEW" */ + zType = ts + 9208 /* "view" */ + zType2 = ts + 11719 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -94677,7 +95185,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+11709 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+11724 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -94685,7 +95193,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+11724, /* "UPDATE %Q.sqlite..." */ + ts+11739, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, @@ -94703,14 +95211,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+11822, /* "CREATE TABLE %Q...." */ + ts+11837, /* "CREATE TABLE %Q...." */ libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+11864 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+11879 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -94731,7 +95239,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8330 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+8345 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -94768,7 +95276,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+11898 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11913 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -94790,7 +95298,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9193 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+9208 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+8 /* &sFix */, pSelect) != 0) { goto __3 } @@ -94907,7 +95415,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+11934 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11949 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -95049,7 +95557,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+11964 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+11979 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -95063,7 +95571,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+11979, /* "UPDATE %Q.sqlite..." */ + ts+11994, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -95127,10 +95635,10 @@ func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uint for i = 1; i <= 4; i++ { // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12046 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+12061 /* "sqlite_stat%d" */, libc.VaList(bp, i)) if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+10009, /* "DELETE FROM %Q.%..." */ + ts+10024, /* "DELETE FROM %Q.%..." */ libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } @@ -95170,7 +95678,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+12060, /* "DELETE FROM %Q.s..." */ + ts+12075, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -95182,7 +95690,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+12105, /* "DELETE FROM %Q.s..." */ + ts+12120, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) @@ -95212,11 +95720,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2398 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+2413 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6135 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+6150 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -95297,9 +95805,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zArg2 = uintptr(0) @@ -95359,7 +95867,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+12172 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12187 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -95369,14 +95877,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+12200 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12215 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+12234 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12249 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -95391,7 +95899,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+10201 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10216 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -95456,7 +95964,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+12266, /* "foreign key on %..." */ + ts+12281, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*32)).FzName, pTo)) goto fk_end __5: @@ -95469,7 +95977,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+12329 /* "number of column..." */, 0) + ts+12344 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -95553,7 +96061,7 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+12423, /* "unknown column \"..." */ + ts+12438, /* "unknown column \"..." */ libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) goto fk_end __23: @@ -95803,12 +96311,12 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+12469, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12484, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 12497 /* "FIRST" */ + return ts + 12512 /* "FIRST" */ } - return ts + 12503 /* "LAST" */ + return ts + 12518 /* "LAST" */ }())) return 1 } @@ -95966,7 +96474,7 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12508 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+12523 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+136 /* &sFix */, pTblName) != 0) { goto __10 } @@ -95987,7 +96495,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+12514, /* "cannot create a ..." */ + ts+12529, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -96014,26 +96522,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12564 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12579 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+12592 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12607 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+12617 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12632 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -96060,7 +96568,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12508 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+12523 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -96075,7 +96583,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+12651 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12666 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -96087,7 +96595,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+12685 /* "index %s already..." */, libc.VaList(bp+24, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12700 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -96116,7 +96624,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+12709 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+12724 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -96145,9 +96653,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -96191,7 +96699,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12508 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+12523 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -96308,7 +96816,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+12732 /* "expressions proh..." */, 0) + ts+12747 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -96537,7 +97045,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+12793 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) + ts+12808 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -96593,7 +97101,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+12835 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12850 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -96651,12 +97159,12 @@ __104: __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+12852, /* "CREATE%s INDEX %..." */ + zStmt = Xsqlite3MPrintf(tls, db, ts+12867, /* "CREATE%s INDEX %..." */ libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 12872 /* " UNIQUE" */ + return ts + 12887 /* " UNIQUE" */ }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: @@ -96668,7 +97176,7 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+12880, /* "INSERT INTO %Q.s..." */ + ts+12895, /* "INSERT INTO %Q.s..." */ libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -96684,7 +97192,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+12939 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+12954 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -96868,7 +97376,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+12966 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+12981 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -96883,7 +97391,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+12984 /* "index associated..." */, libc.VaList(bp+8, 0)) + ts+12999 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -96894,9 +97402,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -96924,9 +97432,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+13057, /* "DELETE FROM %Q.s..." */ + ts+13072, /* "DELETE FROM %Q.s..." */ libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+10197 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+10212 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -97077,7 +97585,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+13117, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13132, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -97289,12 +97797,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13153, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13168, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 13189 /* "ON" */ + return ts + 13204 /* "ON" */ } - return ts + 13192 /* "USING" */ + return ts + 13207 /* "USING" */ }())) goto append_from_error __1: @@ -97422,7 +97930,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -97458,9 +97966,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 13204 /* "ROLLBACK" */ + return ts + 13219 /* "ROLLBACK" */ } - return ts + 13213 /* "COMMIT" */ + return ts + 13228 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -97485,7 +97993,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 13198 /* "BEGIN" */, ts + 13220 /* "RELEASE" */, ts + 13204 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 13213 /* "BEGIN" */, ts + 13235 /* "RELEASE" */, ts + 13219 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -97501,7 +98009,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+13228 /* "unable to open a..." */, 0) + ts+13243 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -97644,17 +98152,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13298 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+13313 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*32)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13309 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+13324 /* ", " */, 2) } Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+768 /* "." */, 1) Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } @@ -97677,11 +98185,11 @@ func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13312 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+13327 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -97824,7 +98332,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+13321 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13336 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -97934,7 +98442,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13367 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13382 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -98168,7 +98676,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13397 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13412 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -98534,11 +99042,11 @@ func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int3 defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13428 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13443 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+13457 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13472 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -99131,7 +99639,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13495 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+13510 /* "rows deleted" */, uintptr(0)) __61: ; @@ -99276,7 +99784,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10057 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+10072 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -99554,7 +100062,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 5253 /* "integer" */, ts + 5248 /* "real" */, ts + 13508 /* "text" */, ts + 13513 /* "blob" */, ts + 5243 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 5268 /* "integer" */, ts + 5263 /* "real" */, ts + 13523 /* "text" */, ts + 13528 /* "blob" */, ts + 5258 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -99618,7 +100126,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+13518 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13533 /* "integer overflow" */, -1) return } iVal = -iVal @@ -99956,7 +100464,7 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+13535 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+13550 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -100406,7 +100914,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+13540 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+13555 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -100418,7 +100926,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+13573 /* "ESCAPE expressio..." */, -1) + ts+13588 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -100484,7 +100992,7 @@ func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) } // Implementation of the sqlite_compileoption_used() function. @@ -100541,10 +101049,10 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4019 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+4034 /* "%!.15g" */, libc.VaList(bp, r1)) Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13618 /* "%!.20e" */, libc.VaList(bp+8, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+13633 /* "%!.20e" */, libc.VaList(bp+8, r1)) } Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break @@ -100618,7 +101126,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+741 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+756 /* "NULL" */, 4, uintptr(0)) break } @@ -100929,7 +101437,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 9637 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 9652 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -100950,7 +101458,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 740 /* "" */ + zIn = ts + 755 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -100976,7 +101484,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+13625 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+13640 /* "?000" */, 4, uintptr(0)) } } @@ -101004,7 +101512,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+10809 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+10824 /* "not authorized" */, -1) return } @@ -101092,7 +101600,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+13518 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+13533 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -101246,7 +101754,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) } else { - zSep = ts + 11522 /* "," */ + zSep = ts + 11537 /* "," */ nSep = 1 } if zSep != 0 { @@ -101324,7 +101832,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+13630 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+13645 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -101344,14 +101852,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+13636 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13651 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+13636 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+13651 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13636 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13636 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13651 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+13651 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -101456,76 +101964,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 13641 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 13661 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 13674 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 13656 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 13676 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 13689 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13692 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13700 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13700 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13715 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13741 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13766 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13775 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13786 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13793 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13807 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13807 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13813 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13813 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13819 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13819 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13824 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13824 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13824 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13828 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 13828 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13828 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13832 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13839 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13846 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13852 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13859 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13867 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13872 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13876 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13882 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13888 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13894 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13898 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13905 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13912 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13923 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13930 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13945 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13962 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13973 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13979 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13997 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14005 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14019 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14027 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14036 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14036 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14043 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14053 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14057 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14063 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14067 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14073 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13707 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13715 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 13715 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13730 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13756 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13781 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13790 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 13801 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13808 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13822 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13822 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13828 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 13828 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13834 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 13834 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13839 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 13839 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13839 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 13843 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 13843 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 13843 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 13847 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 13854 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13861 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13867 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13874 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13882 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13887 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13891 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13891 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13897 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13903 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13909 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 13913 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13920 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13927 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13938 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13945 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 13960 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13977 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13988 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 13994 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14012 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14020 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14034 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14042 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14051 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14051 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14058 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14058 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14068 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14072 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14078 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14082 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14082 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14088 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 14088 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14086 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13636 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13636 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14091 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14091 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14100 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14091 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14105 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 14101 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13651 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 13651 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14106 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 14106 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 14115 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 14106 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 14120 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -101811,7 +102319,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+14109, /* "foreign key mism..." */ + ts+14124, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -102707,8 +103215,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5452 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5448 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 5467 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 5463 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+32, 16 // Name of column in child table // var tToCol Token at bp+16, 16 @@ -102796,7 +103304,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4235 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+4250 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -103226,7 +103734,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6929 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+6944 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -103790,7 +104298,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+14154, /* "cannot INSERT in..." */ + ts+14169, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto insert_cleanup __24: @@ -103815,7 +104323,7 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+14195, /* "table %S has no ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14210, /* "table %S has no ..." */ libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup @@ -103985,7 +104493,7 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+14227, /* "table %S has %d ..." */ + ts+14242, /* "table %S has %d ..." */ libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: @@ -103995,7 +104503,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+14279 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+14294 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -104051,7 +104559,7 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+14304, /* "UPSERT not imple..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14319, /* "UPSERT not imple..." */ libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: @@ -104059,7 +104567,7 @@ __56: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+14350 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14365 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -104539,7 +105047,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14371 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14386 /* "rows inserted" */, uintptr(0)) __123: ; @@ -104883,7 +105391,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -106286,7 +106794,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 740 /* "" */ + zSql = ts + 755 /* "" */ __2: ; @@ -106847,7 +107355,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10809 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+10824 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -106857,7 +107365,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 14385 /* "sqlite3_extensio..." */ + zEntry = ts + 14400 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -106877,7 +107385,7 @@ __5: if !((ii < (int32(uint64(unsafe.Sizeof(azEndings)) / uint64(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+10770 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+10785 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -106923,7 +107431,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.Xmemcpy(tls, zAltEntry, ts+14408 /* "sqlite3_" */, uint64(8)) + libc.Xmemcpy(tls, zAltEntry, ts+14423 /* "sqlite3_" */, uint64(8)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/')) { @@ -106937,7 +107445,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14417 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+14432 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -106961,7 +107469,7 @@ __17: goto __18 __18: ; - libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14421 /* "_init" */, uint64(6)) + libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+14436 /* "_init" */, uint64(6)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -106979,7 +107487,7 @@ __10: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14427 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + ts+14442 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; @@ -107004,7 +107512,7 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14470 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+14485 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) @@ -107044,7 +107552,7 @@ extension_not_found: } // zErrmsg would be NULL if not so Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), - ts+14502 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + ts+14517 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; @@ -107054,7 +107562,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 14539, /* "so" */ + ts + 14554, /* "so" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -107221,7 +107729,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+14542 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) + ts+14557 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) @@ -107266,61 +107774,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 4156, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 14581, /* "seq" */ - /* 2 */ ts + 7808, /* "table" */ - /* 3 */ ts + 14585, /* "from" */ - /* 4 */ ts + 14590, /* "to" */ - /* 5 */ ts + 14593, /* "on_update" */ - /* 6 */ ts + 14603, /* "on_delete" */ - /* 7 */ ts + 14613, /* "match" */ - /* 8 */ ts + 14619, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 14623, /* "name" */ - /* 10 */ ts + 14628, /* "type" */ - /* 11 */ ts + 14633, /* "notnull" */ - /* 12 */ ts + 14641, /* "dflt_value" */ - /* 13 */ ts + 14652, /* "pk" */ - /* 14 */ ts + 14655, /* "hidden" */ + /* 0 */ ts + 4171, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 14596, /* "seq" */ + /* 2 */ ts + 7823, /* "table" */ + /* 3 */ ts + 14600, /* "from" */ + /* 4 */ ts + 14605, /* "to" */ + /* 5 */ ts + 14608, /* "on_update" */ + /* 6 */ ts + 14618, /* "on_delete" */ + /* 7 */ ts + 14628, /* "match" */ + /* 8 */ ts + 14634, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 14638, /* "name" */ + /* 10 */ ts + 14643, /* "type" */ + /* 11 */ ts + 14648, /* "notnull" */ + /* 12 */ ts + 14656, /* "dflt_value" */ + /* 13 */ ts + 14667, /* "pk" */ + /* 14 */ ts + 14670, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 14662, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 14619, /* "cid" */ - /* 17 */ ts + 14623, /* "name" */ - /* 18 */ ts + 14668, /* "desc" */ - /* 19 */ ts + 14673, /* "coll" */ - /* 20 */ ts + 14678, /* "key" */ - /* 21 */ ts + 14623, /* "name" */ // Used by: function_list - /* 22 */ ts + 14682, /* "builtin" */ - /* 23 */ ts + 14628, /* "type" */ - /* 24 */ ts + 14690, /* "enc" */ - /* 25 */ ts + 14694, /* "narg" */ - /* 26 */ ts + 14699, /* "flags" */ - /* 27 */ ts + 10201, /* "tbl" */ // Used by: stats - /* 28 */ ts + 10197, /* "idx" */ - /* 29 */ ts + 14705, /* "wdth" */ - /* 30 */ ts + 14710, /* "hght" */ - /* 31 */ ts + 14715, /* "flgs" */ - /* 32 */ ts + 14581, /* "seq" */ // Used by: index_list - /* 33 */ ts + 14623, /* "name" */ - /* 34 */ ts + 14720, /* "unique" */ - /* 35 */ ts + 14727, /* "origin" */ - /* 36 */ ts + 14734, /* "partial" */ - /* 37 */ ts + 7808, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 14742, /* "rowid" */ - /* 39 */ ts + 4159, /* "parent" */ - /* 40 */ ts + 14748, /* "fkid" */ + /* 15 */ ts + 14677, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 14634, /* "cid" */ + /* 17 */ ts + 14638, /* "name" */ + /* 18 */ ts + 14683, /* "desc" */ + /* 19 */ ts + 14688, /* "coll" */ + /* 20 */ ts + 14693, /* "key" */ + /* 21 */ ts + 14638, /* "name" */ // Used by: function_list + /* 22 */ ts + 14697, /* "builtin" */ + /* 23 */ ts + 14643, /* "type" */ + /* 24 */ ts + 14705, /* "enc" */ + /* 25 */ ts + 14709, /* "narg" */ + /* 26 */ ts + 14714, /* "flags" */ + /* 27 */ ts + 10216, /* "tbl" */ // Used by: stats + /* 28 */ ts + 10212, /* "idx" */ + /* 29 */ ts + 14720, /* "wdth" */ + /* 30 */ ts + 14725, /* "hght" */ + /* 31 */ ts + 14730, /* "flgs" */ + /* 32 */ ts + 14596, /* "seq" */ // Used by: index_list + /* 33 */ ts + 14638, /* "name" */ + /* 34 */ ts + 14735, /* "unique" */ + /* 35 */ ts + 14742, /* "origin" */ + /* 36 */ ts + 14749, /* "partial" */ + /* 37 */ ts + 7823, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 14757, /* "rowid" */ + /* 39 */ ts + 4174, /* "parent" */ + /* 40 */ ts + 14763, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 14581, /* "seq" */ // Used by: database_list - /* 42 */ ts + 14623, /* "name" */ - /* 43 */ ts + 14753, /* "file" */ - /* 44 */ ts + 14758, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 14763, /* "log" */ - /* 46 */ ts + 14767, /* "checkpointed" */ + /* 41 */ ts + 14596, /* "seq" */ // Used by: database_list + /* 42 */ ts + 14638, /* "name" */ + /* 43 */ ts + 14768, /* "file" */ + /* 44 */ ts + 14773, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 14778, /* "log" */ + /* 46 */ ts + 14782, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 14780, /* "database" */ // Used by: lock_status - /* 48 */ ts + 14789, /* "status" */ - /* 49 */ ts + 14796, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 14795, /* "database" */ // Used by: lock_status + /* 48 */ ts + 14804, /* "status" */ + /* 49 */ ts + 14811, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 14807, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 14822, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -107337,234 +107845,234 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [65]PragmaName{ - { /* zName: */ FzName: ts + 14815, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 14830, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14830, /* "application_id" */ + { /* zName: */ FzName: ts + 14845, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 14845, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 14860, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14857, /* "automatic_index" */ + { /* zName: */ FzName: ts + 14872, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 14873, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 14888, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 14796, /* "cache_size" */ + { /* zName: */ FzName: ts + 14811, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14886, /* "cache_spill" */ + { /* zName: */ FzName: ts + 14901, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 14898, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 14913, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 14918, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 14933, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 14934, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 14949, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 14955, /* "collation_list" */ + { /* zName: */ FzName: ts + 14970, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 14970, /* "compile_options" */ + { /* zName: */ FzName: ts + 14985, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 14986, /* "count_changes" */ + { /* zName: */ FzName: ts + 15001, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 15000, /* "data_version" */ + { /* zName: */ FzName: ts + 15015, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 15013, /* "database_list" */ + { /* zName: */ FzName: ts + 15028, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15027, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 15042, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15046, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 15061, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 15065, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 15080, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 15088, /* "encoding" */ + { /* zName: */ FzName: ts + 15103, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15097, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 15112, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 15115, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 15130, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 15132, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 15147, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 15145, /* "freelist_count" */ + { /* zName: */ FzName: ts + 15160, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 15160, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 15175, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 15178, /* "fullfsync" */ + { /* zName: */ FzName: ts + 15193, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 15188, /* "function_list" */ + { /* zName: */ FzName: ts + 15203, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15202, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 15217, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15218, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 15233, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 15243, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 15258, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 15262, /* "index_info" */ + { /* zName: */ FzName: ts + 15277, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15273, /* "index_list" */ + { /* zName: */ FzName: ts + 15288, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 15284, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 15299, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15296, /* "integrity_check" */ + { /* zName: */ FzName: ts + 15311, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15312, /* "journal_mode" */ + { /* zName: */ FzName: ts + 15327, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15325, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 15340, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15344, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 15359, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 15363, /* "locking_mode" */ + { /* zName: */ FzName: ts + 15378, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15376, /* "max_page_count" */ + { /* zName: */ FzName: ts + 15391, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15391, /* "mmap_size" */ + { /* zName: */ FzName: ts + 15406, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 15401, /* "module_list" */ + { /* zName: */ FzName: ts + 15416, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15413, /* "optimize" */ + { /* zName: */ FzName: ts + 15428, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 15422, /* "page_count" */ + { /* zName: */ FzName: ts + 15437, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 15433, /* "page_size" */ + { /* zName: */ FzName: ts + 15448, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15443, /* "pragma_list" */ + { /* zName: */ FzName: ts + 15458, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 15455, /* "query_only" */ + { /* zName: */ FzName: ts + 15470, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 15466, /* "quick_check" */ + { /* zName: */ FzName: ts + 15481, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 15478, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 15493, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 15495, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 15510, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 15514, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 15529, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 15540, /* "schema_version" */ + { /* zName: */ FzName: ts + 15555, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 15555, /* "secure_delete" */ + { /* zName: */ FzName: ts + 15570, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15569, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 15584, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 15588, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 15603, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 15602, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 15617, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15618, /* "synchronous" */ + { /* zName: */ FzName: ts + 15633, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15630, /* "table_info" */ + { /* zName: */ FzName: ts + 15645, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 15641, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 15656, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 15653, /* "temp_store" */ + { /* zName: */ FzName: ts + 15668, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 15664, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 15679, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 15685, /* "threads" */ + { /* zName: */ FzName: ts + 15700, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 15693, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 15708, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 15708, /* "user_version" */ + { /* zName: */ FzName: ts + 15723, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 15721, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 15736, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 15740, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 15755, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 15755, /* "writable_schema" */ + { /* zName: */ FzName: ts + 15770, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -107601,7 +108109,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 15771 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 15786 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -107618,10 +108126,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+15796 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15811 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15806 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15821 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -107634,13 +108142,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+15813 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15828 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+15818 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15833 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+15823 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+15838 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -107658,9 +108166,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+14753 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+14768 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+15835 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+15850 /* "memory" */) == 0 { return 2 } else { return 0 @@ -107676,7 +108184,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+15842 /* "temporary storag..." */, 0) + ts+15857 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) @@ -107776,19 +108284,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 15904 /* "SET NULL" */ + zName = ts + 15919 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 15913 /* "SET DEFAULT" */ + zName = ts + 15928 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 15925 /* "CASCADE" */ + zName = ts + 15940 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 15933 /* "RESTRICT" */ + zName = ts + 15948 /* "RESTRICT" */ break default: - zName = ts + 15942 /* "NO ACTION" */ + zName = ts + 15957 /* "NO ACTION" */ break } return zName @@ -107806,7 +108314,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 15952 /* "delete" */, ts + 15959 /* "persist" */, ts + 15967 /* "off" */, ts + 15971 /* "truncate" */, ts + 15835 /* "memory" */, ts + 15980, /* "wal" */ + ts + 15967 /* "delete" */, ts + 15974 /* "persist" */, ts + 15982 /* "off" */, ts + 15986 /* "truncate" */, ts + 15850 /* "memory" */, ts + 15995, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -107852,13 +108360,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 15984 /* "w" */ + zType = ts + 15999 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 15986 /* "a" */ + zType = ts + 16001 /* "a" */ } else { - zType = ts + 15988 /* "s" */ + zType = ts + 16003 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15990, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16005, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -107867,7 +108375,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 15997 /* "utf8" */, ts + 16002 /* "utf16le" */, ts + 16010 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 16012 /* "utf8" */, ts + 16017 /* "utf16le" */, ts + 16025 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -108129,7 +108637,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+16018 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+16033 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -108184,7 +108692,7 @@ __8: if !(*(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* &aFcntl[0] */))) __10: ; @@ -108756,7 +109264,7 @@ __18: if !(zRight != 0) { goto __62 } - if !(Xsqlite3_stricmp(tls, zRight, ts+16022 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+16037 /* "fast" */) == 0) { goto __63 } b = 2 @@ -108845,7 +109353,7 @@ __70: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 15806 /* "normal" */ + zRet = ts + 15821 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -108886,7 +109394,7 @@ __77: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __82 } - zRet = ts + 15796 /* "exclusive" */ + zRet = ts + 15811 /* "exclusive" */ __82: ; returnSingleText(tls, v, zRet) @@ -109251,7 +109759,7 @@ __122: if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 432 /* res */)) == 0)) { goto __125 } - Xsqlite3ErrorMsg(tls, pParse, ts+16027 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+16042 /* "not a writable d..." */, 0) goto pragma_out __125: ; @@ -109269,7 +109777,7 @@ __126: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __127 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+16, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+16, zRight)) goto __128 __127: Xsqlite3_temp_directory = uintptr(0) @@ -109297,7 +109805,7 @@ __129: goto __131 } Xsqlite3ErrorMsg(tls, pParse, - ts+16052 /* "Safety level may..." */, 0) + ts+16067 /* "Safety level may..." */, 0) goto __132 __131: if !(iDb != 1) { @@ -109456,13 +109964,13 @@ __153: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 16105 /* "issisii" */ + return ts + 16120 /* "issisii" */ } - return ts + 16113 /* "issisi" */ + return ts + 16128 /* "issisi" */ }(), libc.VaList(bp+24, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -109537,7 +110045,7 @@ __165: goto __167 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16120 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16135 /* "iisX" */, libc.VaList(bp+80, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -109547,7 +110055,7 @@ __165: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __168 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16125, /* "isiX" */ + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+16140, /* "isiX" */ libc.VaList(bp+104, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) @@ -109584,8 +110092,8 @@ __171: if !(pIdx1 != 0) { goto __173 } - *(*[3]uintptr)(unsafe.Pointer(bp + 440 /* azOrigin */)) = [3]uintptr{ts + 16130 /* "c" */, ts + 16132 /* "u" */, ts + 14652 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16134, /* "isisi" */ + *(*[3]uintptr)(unsafe.Pointer(bp + 440 /* azOrigin */)) = [3]uintptr{ts + 16145 /* "c" */, ts + 16147 /* "u" */, ts + 14667 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16149, /* "isisi" */ libc.VaList(bp+128, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), @@ -109619,7 +110127,7 @@ __174: __177: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16140, /* "iss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16155, /* "iss" */ libc.VaList(bp+168, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt))) @@ -109642,7 +110150,7 @@ __178: goto __180 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16144 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16159 /* "is" */, libc.VaList(bp+192, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __179 __179: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -109706,7 +110214,7 @@ __190: goto __192 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15988 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16003 /* "s" */, libc.VaList(bp+208, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __191 __191: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -109723,7 +110231,7 @@ __193: if !(i6 < (int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{}))))) { goto __195 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+15988 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16003 /* "s" */, libc.VaList(bp+216, aPragmaName[i6].FzName)) goto __194 __194: i6++ @@ -109759,7 +110267,7 @@ __201: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __203 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16147, /* "iissssss" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+16162, /* "iissssss" */ libc.VaList(bp+224, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, @@ -109767,7 +110275,7 @@ __201: (*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */)))), // ON DELETE - ts+16156 /* "NONE" */)) + ts+16171 /* "NONE" */)) goto __202 __202: j2++ @@ -109960,7 +110468,7 @@ __230: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __231: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16161 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+16176 /* "siX" */, libc.VaList(bp+288, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 472 /* aiCols */))) @@ -110226,7 +110734,7 @@ __258: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+16165 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+16180 /* "*** in database ..." */, libc.VaList(bp+304, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -110316,7 +110824,7 @@ __277: __278: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+16189 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+16204 /* "NULL value in %s..." */, libc.VaList(bp+312, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -110356,7 +110864,7 @@ __283: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+16209, /* "CHECK constraint..." */ + zErr1 = Xsqlite3MPrintf(tls, db, ts+16224, /* "CHECK constraint..." */ libc.VaList(bp+328, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) @@ -110390,9 +110898,9 @@ __288: // Verify that an index entry exists for the current table row jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16239 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16254 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+16244 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+16259 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -110432,7 +110940,7 @@ __292: Xsqlite3VdbeJumpHere(tls, v, jmp6) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 488 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+16265 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+16280 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __289: @@ -110454,7 +110962,7 @@ __284: if !(!(isQuick != 0)) { goto __294 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+16292 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+16307 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __295: @@ -110505,7 +111013,7 @@ __240: } (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 480 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*24)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16321 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 16336 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*24)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __299: @@ -110583,7 +111091,7 @@ __306: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __308 } - Xsqlite3ErrorMsg(tls, pParse, ts+16324 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+16339 /* "unsupported enco..." */, libc.VaList(bp+336, zRight)) __308: ; __303: @@ -110695,19 +111203,19 @@ __47: if !(zRight != 0) { goto __315 } - if !(Xsqlite3StrICmp(tls, zRight, ts+15818 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15833 /* "full" */) == 0) { goto __316 } eMode2 = SQLITE_CHECKPOINT_FULL goto __317 __316: - if !(Xsqlite3StrICmp(tls, zRight, ts+16349 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+16364 /* "restart" */) == 0) { goto __318 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __319 __318: - if !(Xsqlite3StrICmp(tls, zRight, ts+15971 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+15986 /* "truncate" */) == 0) { goto __320 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -110894,7 +111402,7 @@ __335: __337: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+16357, /* "ANALYZE \"%w\".\"%w..." */ + zSubSql = Xsqlite3MPrintf(tls, db, ts+16372, /* "ANALYZE \"%w\".\"%w..." */ libc.VaList(bp+344, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __338 @@ -111078,14 +111586,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 16375 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 16380 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 16386 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 16395 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 16404 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 16412 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 16420 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 16427 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16390 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 16395 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 16401 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 16410 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 16419 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 16427 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 16435 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 16442 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -111142,7 +111650,7 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv _ = argc _ = argv Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+64 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16433 /* "CREATE TABLE x" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16448 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -111150,7 +111658,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16448 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16463 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -111163,19 +111671,19 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16455 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16470 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16461 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16476 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16473 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16488 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+4066 /* ")" */, 1) Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) rc = Xsqlite3_declare_vtab(tls, db, bp+64 /* &zBuf[0] */) @@ -111191,7 +111699,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -111354,7 +111862,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) == uintptr(0) { return SQLITE_NOMEM } @@ -111370,13 +111878,13 @@ __2: __3: ; Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16488 /* "PRAGMA " */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+16503 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16496 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16511 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) } Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16500 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+16515 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) } zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { @@ -111385,7 +111893,7 @@ __3: rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -111478,12 +111986,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+16504 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), + ts+16519 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 16532 /* "rename" */ + return ts + 16547 /* "rename" */ } - return ts + 16539 /* "drop column" */ + return ts + 16554 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -111495,11 +112003,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - zObj = ts + 4107 /* "?" */ + zObj = ts + 4122 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+16551 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+16566 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+16582 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+16597 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -111576,7 +112084,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (db+184 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12835 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12850 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -111613,13 +112121,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+16590 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+16605 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (pIndex+88 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+12835 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+12850 /* "invalid rootpage" */) } } } @@ -111662,16 +112170,16 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7808 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 7823 /* "table" */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }()) *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 6898 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 16603 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 6913 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 16618 /* "CREATE TABLE x(t..." */ *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*8)) = uintptr(0) (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Fdb = db (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FiDb = iDb @@ -111784,7 +112292,7 @@ __10: goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+10484 /* "attached databas..." */) + ts+10499 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -111824,7 +112332,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+16675 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+16690 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -111846,7 +112354,7 @@ __18: (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+16699, /* "SELECT*FROM\"%w\"...." */ + ts+16714, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth @@ -112206,7 +112714,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+16733 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+16748 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -112234,7 +112742,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16763 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+16778 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -112297,7 +112805,7 @@ __19: if !(*(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */))) goto __21 __20: @@ -112772,24 +113280,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 9637 /* " " */ + var zSp uintptr = ts + 9652 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+16782 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+16797 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+16826 /* "RIGHT and FULL O..." */, 0) + ts+16841 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16881 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 16896 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -112995,7 +113503,7 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16915 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+16930 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { @@ -113019,7 +113527,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+16965 /* "cannot have both..." */, 0) + ts+16980 /* "cannot have both..." */, 0) return 1 } @@ -113054,7 +113562,7 @@ __1: if (iRightCol < 0) || !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+17020 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) + ts+17035 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, @@ -113845,16 +114353,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 17084 /* "UNION ALL" */ + z = ts + 17099 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 17094 /* "INTERSECT" */ + z = ts + 17109 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 17104 /* "EXCEPT" */ + z = ts + 17119 /* "EXCEPT" */ break default: - z = ts + 17111 /* "UNION" */ + z = ts + 17126 /* "UNION" */ break } return z @@ -113872,7 +114380,7 @@ func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite bp := tls.Alloc(8) defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17117 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17132 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -114138,8 +114646,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 11369 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 14742 /* "rowid" */ + zType = ts + 11384 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 14757 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), uintptr(0)) @@ -114292,13 +114800,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 14742 /* "rowid" */ + zCol = ts + 14757 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -114306,7 +114814,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+17140 /* "column%d" */, libc.VaList(bp+16, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+17155 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -114395,7 +114903,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } else { - zName = ts + 14742 /* "rowid" */ + zName = ts + 14757 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -114408,7 +114916,7 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+17140 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+17155 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, @@ -114423,7 +114931,7 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+17149 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) + zName = Xsqlite3MPrintf(tls, db, ts+17164 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) if *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) > U32(3) { Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &cnt */) } @@ -114780,7 +115288,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+17157 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17172 /* "cannot use windo..." */, 0) return __1: ; @@ -114891,7 +115399,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+17206 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17221 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -114913,7 +115421,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17248 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17263 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -114956,7 +115464,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17254 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17269 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -115006,11 +115514,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17269 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17284 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 17292 /* "S" */ + return ts + 17307 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -115162,8 +115670,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17294 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17309 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17309 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17324 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -115212,7 +115720,7 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17084 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17099 /* "UNION ALL" */, 0) rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) @@ -115288,7 +115796,7 @@ __23: pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 64 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17328 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17343 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+64 /* &uniondest */) @@ -115360,7 +115868,7 @@ __26: pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) (*SelectDest)(unsafe.Pointer(bp + 104 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17328 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17343 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) rc = Xsqlite3Select(tls, pParse, p, bp+104 /* &intersectdest */) @@ -115521,10 +116029,10 @@ func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17349 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17364 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+17395, /* "SELECTs to the l..." */ + ts+17410, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -115904,9 +116412,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6236 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+6251 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6236 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+6251 /* "ORDER" */) } // Compute the limit registers @@ -115935,7 +116443,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) Xsqlite3SelectDestInit(tls, bp+48 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17477 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17492 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -115943,7 +116451,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17488 /* "LEFT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17503 /* "LEFT" */, 0) Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -115957,7 +116465,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17493 /* "RIGHT" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+17508 /* "RIGHT" */, 0) Xsqlite3Select(tls, pParse, p, bp+48 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset @@ -116154,7 +116662,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 303 /* "BINARY" */ + return ts + 318 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -117367,12 +117875,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+13824 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+13839 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+13828 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+13843 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -117441,7 +117949,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+17499 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+17514 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -117552,7 +118060,7 @@ func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* s defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17517 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17532 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -117740,7 +118248,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+17540 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+17555 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -117756,7 +118264,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17583 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17598 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { @@ -117782,7 +118290,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+17606, /* "table %s has %d ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17621, /* "table %s has %d ..." */ libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 @@ -117793,9 +118301,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17644 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17659 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17678 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 17693 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -117843,7 +118351,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17716 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+17731 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -117970,7 +118478,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+17728, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17743, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -117989,7 +118497,7 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+17767, /* "access to view \"..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17782, /* "access to view \"..." */ libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -117997,7 +118505,7 @@ __1: ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+17798, /* "unsafe use of vi..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+17813, /* "unsafe use of vi..." */ libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) @@ -118112,7 +118620,7 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName } else { - zSchemaName = ts + 17831 /* "*" */ + zSchemaName = ts + 17846 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { @@ -118161,7 +118669,7 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+10770 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+10785 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { @@ -118177,7 +118685,7 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17833, /* "%s.%s.%s" */ + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+17848, /* "%s.%s.%s" */ libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } @@ -118197,9 +118705,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+17842 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+17857 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+17860 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17875 /* "no tables specif..." */, 0) } } } @@ -118209,7 +118717,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+17880 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17895 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -118397,13 +118905,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+17911 /* "DISTINCT aggrega..." */, 0) + ts+17926 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17962 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17977 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -118603,19 +119111,19 @@ func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintpt if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+17995, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18010, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 18007 /* " USING COVERING ..." */ + return ts + 18022 /* " USING COVERING ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) } } @@ -118635,7 +119143,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6898 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6913 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -118937,7 +119445,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+18030, /* "target object/al..." */ + ts+18045, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -119017,7 +119525,7 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18084, /* "expected %d colu..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18099, /* "expected %d colu..." */ libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: @@ -119158,7 +119666,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+740 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+755 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -119223,7 +119731,7 @@ __35: (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18124 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18139 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) @@ -119285,7 +119793,7 @@ __44: __45: ; Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18139 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18154 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { @@ -119805,9 +120313,9 @@ __97: explainTempTable(tls, pParse, func() uintptr { if ((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 18155 /* "DISTINCT" */ + return ts + 18170 /* "DISTINCT" */ } - return ts + 18164 /* "GROUP BY" */ + return ts + 18179 /* "GROUP BY" */ }()) groupBySort = 1 @@ -120219,7 +120727,7 @@ __58: if !(int32((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+18155 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+18170 /* "DISTINCT" */) __140: ; @@ -120231,9 +120739,9 @@ __140: explainTempTable(tls, pParse, func() uintptr { if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { - return ts + 18173 /* "RIGHT PART OF OR..." */ + return ts + 18188 /* "RIGHT PART OF OR..." */ } - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ }()) generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) @@ -120367,7 +120875,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + z = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) if !(z == uintptr(0)) { goto __10 } @@ -120389,7 +120897,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+18205 /* "sqlite3_get_tabl..." */, 0) + ts+18220 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -120488,7 +120996,7 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } @@ -120649,7 +121157,7 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+18270 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18285 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; @@ -120710,7 +121218,7 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18316 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+18331 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(Xsqlite3FixSrcList(tls, bp+40 /* &sFix */, pTableName) != 0) { goto __9 } @@ -120728,7 +121236,7 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+18324 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18339 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; @@ -120743,7 +121251,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18316 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+18331 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -120759,7 +121267,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+18365 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+18380 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -120773,10 +121281,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7066 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+7081 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+18391 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18406 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -120786,12 +121294,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+18429, /* "cannot create %s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+18444, /* "cannot create %s..." */ libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 18466 /* "BEFORE" */ + return ts + 18481 /* "BEFORE" */ } - return ts + 18473 /* "AFTER" */ + return ts + 18488 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -120800,7 +121308,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+18479 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) + ts+18494 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -120830,9 +121338,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -120966,7 +121474,7 @@ __2: __3: ; Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18316 /* "trigger" */, bp+40 /* &nameToken */) + Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+18331 /* "trigger" */, bp+40 /* &nameToken */) if !((Xsqlite3FixTriggerStep(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || (Xsqlite3FixExpr(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 @@ -121003,13 +121511,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+18525, /* "INSERT INTO %Q.s..." */ + ts+18540, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+18600 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+18615 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -121275,7 +121783,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+18629 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+18644 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -121316,9 +121824,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 10857 /* "sqlite_temp_mast..." */ + return ts + 10872 /* "sqlite_temp_mast..." */ } - return ts + 4941 /* "sqlite_master" */ + return ts + 4956 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -121331,7 +121839,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+18649, /* "DELETE FROM %Q.s..." */ + ts+18664, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -121450,12 +121958,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+18711, /* "%s RETURNING is ..." */ + ts+18726, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 18759 /* "DELETE" */ + return ts + 18774 /* "DELETE" */ } - return ts + 18766 /* "UPDATE" */ + return ts + 18781 /* "UPDATE" */ }())) __15: ; @@ -121551,7 +122059,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+18773 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18788 /* "RETURNING may no..." */, 0) return 1 } @@ -121692,7 +122200,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+5128 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+5143 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -121822,7 +122330,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+18815 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+18830 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -122525,7 +123033,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+18829, /* "cannot UPDATE ge..." */ + ts+18844, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto update_cleanup __27: @@ -122557,7 +123065,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+18865 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18880 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -122568,7 +123076,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 6673 /* "ROWID" */ + return ts + 6688 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName }(), @@ -123599,7 +124107,7 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18884 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+18899 /* "rows updated" */, uintptr(0)) __169: ; @@ -123986,10 +124494,10 @@ __1: if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { *(*int8)(unsafe.Pointer(bp + 216 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+18897 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+18912 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+18901 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) + ts+18916 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -124080,7 +124588,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+10911 /* "corrupt database" */, -1) + ts+10926 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -124148,7 +124656,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+18974 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18978 /* "INS" */, uint64(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+18989 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+18993 /* "INS" */, uint64(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -124298,14 +124806,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+18982 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+18997 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19022 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19037 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -124316,7 +124824,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+19065 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19080 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -124325,7 +124833,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 740 /* "" */ + zOut = ts + 755 /* "" */ __4: ; @@ -124361,7 +124869,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+19083 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+19098 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -124382,7 +124890,7 @@ __6: goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+19106 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+19121 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -124398,7 +124906,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+13198 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+13213 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -124449,7 +124957,7 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+19133, /* "SELECT sql FROM ..." */ + ts+19148, /* "SELECT sql FROM ..." */ libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 @@ -124459,7 +124967,7 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+19241, /* "SELECT sql FROM ..." */ + ts+19256, /* "SELECT sql FROM ..." */ libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 @@ -124474,7 +124982,7 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+19295, /* "SELECT'INSERT IN..." */ + ts+19310, /* "SELECT'INSERT IN..." */ libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) @@ -124491,7 +124999,7 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+19446, /* "INSERT INTO vacu..." */ + ts+19461, /* "INSERT INTO vacu..." */ libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 @@ -124871,7 +125379,7 @@ func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintp var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+11141 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+11156 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -124965,7 +125473,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(pEnd)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+19576 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+19591 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -124977,7 +125485,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+19600, /* "UPDATE %Q.sqlite..." */ + ts+19615, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, @@ -124987,7 +125495,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+19699 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+19714 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -125052,7 +125560,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+19718 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+19733 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -125090,9 +125598,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, if SQLITE_OK != rc { if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19760 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19775 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2775 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+2790 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) @@ -125104,7 +125612,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 19790 /* "vtable construct..." */ + var zFormat uintptr = ts + 19805 /* "vtable construct..." */ *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR @@ -125120,12 +125628,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+740 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+755 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+14655 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+14670 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -125184,13 +125692,13 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+19836 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+19851 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) @@ -125252,7 +125760,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19836 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+19851 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -125329,7 +125837,7 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)))) @@ -125701,7 +126209,7 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 @@ -126132,10 +126640,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 19855 /* "" */ + return ts + 19870 /* "" */ } if i == (-1) { - return ts + 14742 /* "rowid" */ + return ts + 14757 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*32)).FzName } @@ -126150,35 +126658,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+19862 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19877 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19868 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19883 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11537 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+19868 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+19883 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+11537 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+4107 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4122 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } } @@ -126207,29 +126715,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+19870 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+19885 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+19862 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+19877 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 19873 /* "%s=?" */ + return ts + 19888 /* "%s=?" */ } - return ts + 19878 /* "ANY(%s)" */ + return ts + 19893 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19886 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+19901 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19888 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+19903 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+4051 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+4066 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -126274,11 +126782,11 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+80 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19890 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+19905 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 19896 /* "SEARCH" */ + return ts + 19911 /* "SEARCH" */ } - return ts + 19903 /* "SCAN" */ + return ts + 19918 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -126288,38 +126796,38 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 9685 /* "PRIMARY KEY" */ + zFmt = ts + 9700 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 19908 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 19923 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 19941 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 19956 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 19966 /* "COVERING INDEX %..." */ + zFmt = ts + 19981 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 19984 /* "INDEX %s" */ + zFmt = ts + 19999 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+48 /* &str */, ts+19993 /* " USING " */, 7) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+20008 /* " USING " */, 7) Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 20001 /* "=" */ + zRangeOp = ts + 20016 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 20003 /* ">? AND rowid<" */ + zRangeOp = ts + 20018 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 19886 /* ">" */ + zRangeOp = ts + 19901 /* ">" */ } else { - zRangeOp = ts + 19888 /* "<" */ + zRangeOp = ts + 19903 /* "<" */ } Xsqlite3_str_appendf(tls, bp+48, /* &str */ - ts+20017 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) + ts+20032 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20055, /* " VIRTUAL TABLE I..." */ + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+20070, /* " VIRTUAL TABLE I..." */ libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) @@ -127875,7 +128383,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20082 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20097 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -127894,7 +128402,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20097 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+20112 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -128643,10 +129151,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 14613 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 14086 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 13636 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 20106 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 14628 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 14101 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 13651 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 20121 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -129347,7 +129855,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+20113 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20128 /* "ON clause refere..." */, 0) return } } @@ -129423,7 +129931,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5760 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 5775 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -129524,7 +130032,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { - return ts + 20154 /* "NOCASE" */ + return ts + 20169 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -129826,7 +130334,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+20161, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+20176, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -130649,7 +131157,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+20197 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+20212 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*32)).FzName)) sentWarning = U8(1) __6: @@ -130730,7 +131238,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20223 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 20238 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -130963,7 +131471,7 @@ __3: ((uint64(unsafe.Sizeof(sqlite3_index_constraint{})) + uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint64(nTerm))) + (uint64(unsafe.Sizeof(sqlite3_index_orderby{})) * uint64(nOrderBy))) + uint64(unsafe.Sizeof(HiddenIndexInfo1{}))))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+5166 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+5181 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*96) @@ -131090,9 +131598,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+2775 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+2790 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -133142,7 +133650,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20234 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20249 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -133190,7 +133698,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+20234 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20249 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -133579,7 +134087,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+20260 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+20275 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -134348,7 +134856,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+20295 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20310 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -134729,7 +135237,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+20313 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+20328 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) return uintptr(0) __3: ; @@ -134804,7 +135312,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20341 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+20356 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -135939,7 +136447,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+20359 /* "second argument ..." */, -1) + pCtx, ts+20374 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -136088,7 +136596,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+20415 /* "argument of ntil..." */, -1) + pCtx, ts+20430 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -136185,17 +136693,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20460 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20471 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20482 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20487 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20500 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20510 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20516 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20527 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20537 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20549 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20554 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 20475 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 20486 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 20497 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 20502 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 20515 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 20525 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 20531 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 20542 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 20552 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 20564 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 20569 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -136259,7 +136767,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+20558 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20573 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -136303,12 +136811,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+20577 /* "RANGE with offse..." */, 0) + ts+20592 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20648 /* "FILTER clause ma..." */, 0) + ts+20663 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -136331,7 +136839,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6898 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+6913 /* "1" */) } break } @@ -136573,7 +137081,7 @@ func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+6959 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+6974 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -136703,7 +137211,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+6491 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+6506 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -136843,7 +137351,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+20711 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20726 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -136909,15 +137417,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 20743 /* "PARTITION clause" */ + zErr = ts + 20758 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 20760 /* "ORDER BY clause" */ + zErr = ts + 20775 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 20776 /* "frame specificat..." */ + zErr = ts + 20791 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+20796 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+20811 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -136940,7 +137448,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+20829 /* "DISTINCT is not ..." */, 0) + ts+20844 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -137091,7 +137599,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -137113,11 +137621,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 20876, /* "frame starting o..." */ - ts + 20929, /* "frame ending off..." */ - ts + 20359, /* "second argument ..." */ - ts + 20980, /* "frame starting o..." */ - ts + 21032, /* "frame ending off..." */ + ts + 20891, /* "frame starting o..." */ + ts + 20944, /* "frame ending off..." */ + ts + 20374, /* "second argument ..." */ + ts + 20995, /* "frame starting o..." */ + ts + 21047, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -137719,7 +138227,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -138734,19 +139242,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21082, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21097, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ } - return ts + 21124 /* "LIMIT" */ + return ts + 21139 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+21130 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21145 /* "too many terms i..." */, 0) } } @@ -138826,7 +139334,7 @@ func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdT var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21164, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21179, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -140053,7 +140561,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+21202 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21217 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -141032,11 +141540,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+14742 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+14757 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+21224 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+21239 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) } } break @@ -141771,7 +142279,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21251 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+21266 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -141924,7 +142432,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(bp + 96 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21260 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21275 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) @@ -142128,9 +142636,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { - return ts + 6898 /* "1" */ + return ts + 6913 /* "1" */ } - return ts + 6491 /* "0" */ + return ts + 6506 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -142405,21 +142913,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+21284 /* "qualified table ..." */, 0) + ts+21299 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21379 /* "the INDEXED BY c..." */, 0) + ts+21394 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+21463 /* "the NOT INDEXED ..." */, 0) + ts+21478 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ @@ -142868,9 +143376,9 @@ func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor To _ = yymajor // Silence some compiler warnings if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21260 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) + Xsqlite3ErrorMsg(tls, pParse, ts+21275 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21548 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21563 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -144077,7 +144585,7 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+21565 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+21580 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } @@ -144097,12 +144605,12 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21592, /* "%s in \"%s\"" */ + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+21607, /* "%s in \"%s\"" */ libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ @@ -144314,7 +144822,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21603 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+21618 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -144327,11 +144835,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18316 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+18331 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21610 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+21625 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21615 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+21630 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -144344,9 +144852,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21625 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+21640 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21629 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+21644 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -145374,7 +145882,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+21637 /* "unable to close ..." */, 0) + ts+21652 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -145596,23 +146104,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 21705 /* "unknown error" */ + var zErr uintptr = ts + 21720 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 21719 /* "abort due to ROL..." */ + zErr = ts + 21734 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 21741 /* "another row avai..." */ + zErr = ts + 21756 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 21763 /* "no more rows ava..." */ + zErr = ts + 21778 /* "no more rows ava..." */ break } @@ -145630,35 +146138,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 21786, /* "not an error" */ - /* SQLITE_ERROR */ ts + 21799, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 21801, /* "not an error" */ + /* SQLITE_ERROR */ ts + 21814, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 21815, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 21840, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 21854, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 21873, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 5166, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 21898, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 21935, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 21947, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 21962, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 21995, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 22013, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 22038, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 22067, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 21830, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 21855, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 21869, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 21888, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 5181, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 21913, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 21950, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 21962, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 21977, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 22010, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 22028, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 22053, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 22082, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 4896, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 4433, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 22084, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 22102, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 22120, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 4911, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 4448, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 22099, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 22117, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 22135, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 22154, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 22169, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 22175, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 22201, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 22224, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 22245, /* "warning message" */ + /* SQLITE_RANGE */ ts + 22190, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 22216, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 22239, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 22260, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -145823,7 +146331,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22261 /* "unable to delete..." */, 0) + ts+22276 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -145956,7 +146464,7 @@ func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUs _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+22324 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+22339 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -146178,7 +146686,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22375 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+22390 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -146397,7 +146905,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+22396 /* "unable to delete..." */, 0) + ts+22411 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -146540,7 +147048,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22464 /* "file:" */, uint64(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+22479 /* "file:" */, uint64(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -146588,10 +147096,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22470 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+22485 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22480, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22495, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -146713,7 +147221,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22508 /* "vfs" */, zOpt, uint64(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+22523 /* "vfs" */, zOpt, uint64(3)) == 0)) { goto __29 } zVfs = zVal @@ -146724,17 +147232,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22512 /* "cache" */, zOpt, uint64(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+22527 /* "cache" */, zOpt, uint64(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 22512 /* "cache" */ + zModeType = ts + 22527 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22518 /* "mode" */, zOpt, uint64(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+22533 /* "mode" */, zOpt, uint64(4)) == 0)) { goto __32 } @@ -146742,7 +147250,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 2384 /* "access" */ + zModeType = ts + 2399 /* "access" */ __32: ; @@ -146773,7 +147281,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22523 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22538 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -146781,7 +147289,7 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22543, /* "%s mode not allo..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22558, /* "%s mode not allo..." */ libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out @@ -146824,7 +147332,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22567 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+22582 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -146848,15 +147356,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 22583 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 22590 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 22598 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 22605 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 22598 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 22601 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 22604 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 15835 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 22613 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 22616 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 22619 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 15850 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -147038,10 +147546,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+20154 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+20169 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+22608 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+22623 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -147087,7 +147595,7 @@ __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -147125,9 +147633,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5443 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 5458 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 21610 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 21625 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -147245,7 +147753,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 22614 /* "\x00\x00" */ + zFilename = ts + 22629 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -147348,24 +147856,24 @@ func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) bp := tls.Alloc(24) defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+22617, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+22632, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22642 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+22657 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22662 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+22677 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22669 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+22684 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -147492,7 +148000,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 11369 /* "INTEGER" */ + zDataType = ts + 11384 /* "INTEGER" */ primarykey = 1 __13: ; @@ -147544,14 +148052,14 @@ __19: goto __20 } Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22686 /* "no such table co..." */, libc.VaList(bp, zTableName, + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+22701 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { - return ts + 2775 /* "%s" */ + return ts + 2790 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) @@ -148350,7 +148858,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+22714 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+22729 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -148511,7 +149019,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 22722 /* "database is dead..." */ + return ts + 22737 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -149311,7 +149819,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 5243 /* "null" */, ts + 5755 /* "true" */, ts + 5760 /* "false" */, ts + 5253 /* "integer" */, ts + 5248 /* "real" */, ts + 13508 /* "text" */, ts + 22745 /* "array" */, ts + 22751, /* "object" */ + ts + 5258 /* "null" */, ts + 5770 /* "true" */, ts + 5775 /* "false" */, ts + 5268 /* "integer" */, ts + 5263 /* "real" */, ts + 13523 /* "text" */, ts + 22760 /* "array" */, ts + 22766, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -149491,7 +149999,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 22758 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 22773 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -149519,7 +150027,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+5258 /* "null" */, uint32(4)) break } @@ -149548,7 +150056,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22775 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+22790 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -149625,19 +150133,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5258 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+5755 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+5770 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+5760 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+5775 /* "false" */, uint32(5)) break } @@ -150203,17 +150711,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5243 /* "null" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5258 /* "null" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5755 /* "true" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5770 /* "true" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5760 /* "false" */, uint64(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+5775 /* "false" */, uint64(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -150321,7 +150829,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+22804 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+22819 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -150641,7 +151149,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+22819 /* "[0]" */, uint64(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+22834 /* "[0]" */, uint64(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -150658,7 +151166,7 @@ func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190 bp := tls.Alloc(8) defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+22823 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+22838 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -150725,7 +151233,7 @@ func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlit bp := tls.Alloc(8) defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22849, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+22864, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -150869,7 +151377,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+5243 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+5258 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -150997,14 +151505,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+22892 /* "json_object() re..." */, -1) + ts+22907 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+22943 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+22958 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -151112,7 +151620,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+14019 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+14034 /* "replace" */) return __2: ; @@ -151198,9 +151706,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 22977 /* "set" */ + return ts + 22992 /* "set" */ } - return ts + 22981 /* "insert" */ + return ts + 22996 /* "insert" */ }()) return __2: @@ -151348,7 +151856,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22988 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23003 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -151453,7 +151961,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+22991 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+23006 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -151506,7 +152014,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+22994 /* "CREATE TABLE x(k..." */) + ts+23009 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -151644,14 +152152,14 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*16) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+23077 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+23092 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 16 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23082 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+23097 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } @@ -151744,9 +152252,9 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+24 /* &x */, ts+23077 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+23092 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23082 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+23097 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } jsonResult(tls, bp+24 /* &x */) @@ -151770,7 +152278,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 23088 /* "$" */ + zRoot = ts + 23103 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -151902,7 +152410,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22804 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+22819 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -152043,21 +152551,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 23090 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23095 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23106 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23106 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23124 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23137 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23149 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23161 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23172 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23183 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23195 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 23208 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 23217 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 23217 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 23227 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23105 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23110 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23121 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23121 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23139 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23152 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23164 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23176 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23187 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23198 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23210 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 23223 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 23232 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 23232 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 23242 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -152067,17 +152575,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 23238 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 23253 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 23255 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 23270 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 23273 /* "json_each" */, FpModule: 0}, - {FzName: ts + 23283 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 23288 /* "json_each" */, FpModule: 0}, + {FzName: ts + 23298 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -152427,11 +152935,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+23293 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+23308 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23301 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+23316 /* "data" */, iNode, 0, (pRtree + 112 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -152676,7 +153184,7 @@ func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+23306, /* "DROP TABLE '%q'...." */ + ts+23321, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -153436,7 +153944,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23388 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+23403 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -153700,7 +154208,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -154960,7 +155468,7 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+23402 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+23417 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { @@ -154972,12 +155480,12 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if iCol == 0 { var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23422 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+23437 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+23454 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+23469 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } @@ -155245,7 +155753,7 @@ func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqli var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+23491 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+23506 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -155283,7 +155791,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit bp := tls.Alloc(24) defer tls.Free(24) - var zFmt uintptr = ts + 23636 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 23651 /* "SELECT stat FROM..." */ var zSql uintptr // var p uintptr at bp+16, 8 @@ -155291,7 +155799,7 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10057 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+10072 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -155344,7 +155852,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 23692 /* "node" */, ts + 4159 /* "parent" */, ts + 14742, /* "rowid" */ + ts + 23707 /* "node" */, ts + 4174 /* "parent" */, ts + 14757, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -155388,19 +155896,19 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+23697, /* "CREATE TABLE \"%w..." */ + ts+23712, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+23759 /* ",a%d" */, libc.VaList(bp+16, ii)) + Xsqlite3_str_appendf(tls, p, ts+23774 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+23764, /* ");CREATE TABLE \"..." */ + ts+23779, /* ");CREATE TABLE \"..." */ libc.VaList(bp+24, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23828, /* "CREATE TABLE \"%w..." */ + ts+23843, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+23898, /* "INSERT INTO \"%w\"..." */ + ts+23913, /* "INSERT INTO \"%w\"..." */ libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { @@ -155431,7 +155939,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 23947 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 23962 /* "INSERT INTO\"%w\"...." */ } zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { @@ -155443,7 +155951,7 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+24055, /* "SELECT * FROM \"%..." */ + ts+24070, /* "SELECT * FROM \"%..." */ libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM @@ -155451,18 +155959,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+24100 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+24115 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+11522 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+11537 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+24127 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+24142 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+24149 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+24164 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+24157 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+24172 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -155478,18 +155986,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 24173, /* "INSERT OR REPLAC..." */ - ts + 24226, /* "DELETE FROM '%q'..." */ + ts + 24188, /* "INSERT OR REPLAC..." */ + ts + 24241, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 24271, /* "SELECT nodeno FR..." */ - ts + 24323, /* "INSERT OR REPLAC..." */ - ts + 24377, /* "DELETE FROM '%q'..." */ + ts + 24286, /* "SELECT nodeno FR..." */ + ts + 24338, /* "INSERT OR REPLAC..." */ + ts + 24392, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 24422, /* "SELECT parentnod..." */ - ts + 24480, /* "INSERT OR REPLAC..." */ - ts + 24535, /* "DELETE FROM '%q'..." */ + ts + 24437, /* "SELECT parentnod..." */ + ts + 24495, /* "INSERT OR REPLAC..." */ + ts + 24550, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -155536,7 +156044,7 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr var zSql uintptr if isCreate != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+24582 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + zSql = Xsqlite3_mprintf(tls, ts+24597 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) @@ -155544,19 +156052,19 @@ func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzEr (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+24602, /* "SELECT length(da..." */ + ts+24617, /* "SELECT length(da..." */ libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 32 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24659, /* "undersize RTree ..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+24674, /* "undersize RTree ..." */ libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -155607,17 +156115,17 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr ii = 4 *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 24694, /* "Wrong number of ..." */ // 1 - ts + 24737, /* "Too few columns ..." */ // 2 - ts + 24772, /* "Too many columns..." */ // 3 - ts + 24808, /* "Auxiliary rtree ..." */ // 4 + ts + 24709, /* "Wrong number of ..." */ // 1 + ts + 24752, /* "Too few columns ..." */ // 2 + ts + 24787, /* "Too many columns..." */ // 3 + ts + 24823, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) return SQLITE_ERROR __1: ; @@ -155647,7 +156155,7 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+24845, /* "CREATE TABLE x(%..." */ + Xsqlite3_str_appendf(tls, pSql, ts+24860, /* "CREATE TABLE x(%..." */ libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = 4 __3: @@ -155659,7 +156167,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+24869 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+24884 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -155682,7 +156190,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+24875 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24890 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -155693,14 +156201,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -155743,7 +156251,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) goto rtreeInit_fail __22: ; @@ -155761,7 +156269,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -155781,7 +156289,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 24878 /* ",%.*s REAL" */, ts + 24889 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 24893 /* ",%.*s REAL" */, ts + 24904 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -155836,13 +156344,13 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit nodeGetCell(tls, bp+56 /* &tree */, bp+16 /* &node */, ii, bp+1024 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+9637 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+9652 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+24899 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) + Xsqlite3_str_appendf(tls, pOut, ts+24914 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+24905 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+24920 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+24909 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+24924 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -155861,7 +156369,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+24911 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+24926 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -155950,12 +156458,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24944, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+24959, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 3156 /* "\n" */ + return ts + 3171 /* "\n" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -155986,7 +156494,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+24951, /* "SELECT data FROM..." */ + ts+24966, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -156005,7 +156513,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+24996 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+25011 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -156029,8 +156537,8 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa var rc int32 var pStmt uintptr *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ - ts + 25028, /* "SELECT parentnod..." */ - ts + 25082, /* "SELECT nodeno FR..." */ + ts + 25043, /* "SELECT parentnod..." */ + ts + 25097, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) == uintptr(0) { @@ -156045,23 +156553,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+25130, /* "Mapping (%lld ->..." */ + rtreeCheckAppendMsg(tls, pCheck, ts+25145, /* "Mapping (%lld ->..." */ libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 25175 /* "%_rowid" */ + return ts + 25190 /* "%_rowid" */ } - return ts + 25183 /* "%_parent" */ + return ts + 25198 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+25192, /* "Found (%lld -> %..." */ + ts+25207, /* "Found (%lld -> %..." */ libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 25175 /* "%_rowid" */ + return ts + 25190 /* "%_rowid" */ } - return ts + 25183 /* "%_parent" */ + return ts + 25198 /* "%_parent" */ }(), iKey, iVal)) } } @@ -156104,7 +156612,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+25250 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+25265 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { @@ -156124,7 +156632,7 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+25298 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) + ts+25313 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -156147,14 +156655,14 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr if aNode != 0 { if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+25365 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) + ts+25380 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+25399 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+25414 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } @@ -156162,7 +156670,7 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr nCell = readInt16(tls, (aNode + 2)) if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+25429, /* "Node %lld is too..." */ + ts+25444, /* "Node %lld is too..." */ libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { @@ -156196,14 +156704,14 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+25484, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+25499, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+25515 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) + ts+25530 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -156233,13 +156741,13 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25582 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+25597 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) @@ -156248,12 +156756,12 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23402 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+23417 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25610 /* "Schema corrupt o..." */, 0) + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+25625 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } @@ -156268,8 +156776,8 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+32 /* &check */, ts+25641 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+32 /* &check */, ts+25648 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25656 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+25663 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check @@ -156279,7 +156787,7 @@ func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzRep // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+25656 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + var rc int32 = Xsqlite3_exec(tls, db, ts+25671 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } @@ -156325,7 +156833,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+25660 /* "wrong number of ..." */, -1) + ts+25675 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -156333,7 +156841,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 5443 /* "main" */ + zDb = ts + 5458 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -156343,7 +156851,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 16321 /* "ok" */ + return ts + 16336 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -156780,11 +157288,11 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+25711 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+25726 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+25713 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+25728 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+25724 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+25739 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -156808,19 +157316,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+25735 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+25788 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -157836,7 +158344,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+25786 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+25801 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -157845,7 +158353,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+25808 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, ts+25823 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto __3 __3: ii++ @@ -157853,7 +158361,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+24875 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+24890 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -157864,7 +158372,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -157890,7 +158398,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -158123,7 +158631,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14742 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 14757 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -158133,7 +158641,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25812 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25827 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -158141,7 +158649,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25818 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 25833 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -158279,7 +158787,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25827 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+25842 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -158424,14 +158932,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+25867 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25882 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+25883 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+25898 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -158496,7 +159004,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+25898 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25913 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -158508,25 +159016,25 @@ var aFunc1 = [12]struct { _ [6]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25906 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25919 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25932 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25945 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25883 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25957 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25867 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 25980 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25994 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26007 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26021 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26037 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25921 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25934 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 25947 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 25960 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25898 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 25972 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 25882 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 25995 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26009 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 26022 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 26036 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 26052 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 26049 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 26064 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -158539,26 +159047,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+26068 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26083 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26078 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26093 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+26089 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+26104 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+25812 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+25827 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+26100 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+26115 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -158630,7 +159138,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23388 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+23403 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -159921,7 +160429,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+26110 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26125 /* "corrupt fossil d..." */, -1) return } @@ -159932,7 +160440,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+26110 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+26125 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -159953,7 +160461,7 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -159971,7 +160479,7 @@ func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -160075,7 +160583,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+26131 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + ts+26146 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -160159,7 +160667,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23301 /* "data" */, zIn, uint64(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+23316 /* "data" */, zIn, uint64(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -160187,17 +160695,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26302 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+26317 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 26452 /* "AND rootpage!=0 ..." */ + return ts + 26467 /* "AND rootpage!=0 ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 8 /* &.pIdxIter */), (p + 64 /* &.zErrmsg */), - ts+26493 /* "SELECT name, roo..." */) + ts+26508 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -160335,7 +160843,7 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -160398,7 +160906,7 @@ func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26618 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + ts+26633 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } @@ -160416,7 +160924,7 @@ __2: *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26699 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) + Xsqlite3_mprintf(tls, ts+26714 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -160434,7 +160942,7 @@ __4: } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+26720 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) + ts+26735 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } @@ -160458,7 +160966,7 @@ __5: ; (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26771 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) + Xsqlite3_mprintf(tls, ts+26786 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } @@ -160507,7 +161015,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26792 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26807 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 @@ -160522,7 +161030,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+24 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)))) { var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)), 1) if iCid >= 0 { @@ -160572,7 +161080,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+56 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17842 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+17857 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc @@ -160585,18 +161093,18 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // of the input table. Ignore any input table columns that begin with // "rbu_". (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26849 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + Xsqlite3_mprintf(tls, ts+26864 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+26868 /* "rbu_" */, zName, 4) != 0 { + if Xsqlite3_strnicmp(tls, ts+26883 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 56 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*8)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+26873 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+26888 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } @@ -160608,12 +161116,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+26883 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+26898 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 26912 /* "may not have" */ + return ts + 26927 /* "may not have" */ } - return ts + 26925 /* "requires" */ + return ts + 26940 /* "requires" */ }())) } @@ -160622,7 +161130,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26934 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26949 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) { var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 1) @@ -160636,7 +161144,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26956, /* "column missing f..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+26971, /* "column missing f..." */ libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 5) @@ -160682,12 +161190,12 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+26983 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 13309 /* ", " */ + zList = rbuMPrintf(tls, p, ts+26998 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 13324 /* ", " */ } return zList } @@ -160702,13 +161210,13 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = rbuMPrintf(tls, p, ts+26992 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+27007 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -160747,25 +161255,25 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, if bRowid != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27005 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + ts+27020 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27037 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) + zRet = rbuMPrintf(tls, p, ts+27052 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+27060 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27066 /* "quote(" */, ts+27073 /* "||','||" */, ts+4051 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+740 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+27075 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+27081 /* "quote(" */, ts+27088 /* "||','||" */, ts+4066 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+755 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27081, /* "SELECT %s FROM \"..." */ + ts+27096, /* "SELECT %s FROM \"..." */ libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+27123 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) + zRet = rbuMPrintf(tls, p, ts+27138 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } @@ -160823,12 +161331,12 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 @@ -160865,7 +161373,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) goto __7 __6: - zCol = ts + 27143 /* "_rowid_" */ + zCol = ts + 27158 /* "_rowid_" */ __7: ; goto __5 @@ -160874,13 +161382,13 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+27151, /* "%z%s \"%w\" COLLAT..." */ + zLhs = rbuMPrintf(tls, p, ts+27166, /* "%z%s \"%w\" COLLAT..." */ libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+27172, /* "%z%s \"rbu_imp_%d..." */ + zOrder = rbuMPrintf(tls, p, ts+27187, /* "%z%s \"rbu_imp_%d..." */ libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+27208, /* "%z%s quote(\"rbu_..." */ + zSelect = rbuMPrintf(tls, p, ts+27223, /* "%z%s quote(\"rbu_..." */ libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ iCol++ goto __1 __2: @@ -160899,12 +161407,12 @@ __11: *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+184 /* &pSel */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+27235, /* "SELECT %s FROM \"..." */ + Xsqlite3_mprintf(tls, ts+27250, /* "SELECT %s FROM \"..." */ libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))))) { goto __13 } - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { @@ -160926,8 +161434,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+27283 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) - zSep = ts + 13309 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+27298 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 13324 /* ", " */ goto __15 __15: iCol++ @@ -160939,7 +161447,7 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+27290 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+27305 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: @@ -160989,14 +161497,14 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 740 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 740 /* "" */ // Set to " AND " later on + var zCom uintptr = ts + 755 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 755 /* "" */ // Set to " AND " later on *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { @@ -161008,9 +161516,9 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC if iCid == -2 { var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+27302 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, + zRet = Xsqlite3_mprintf(tls, ts+27317 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FzSpan, zCollate)) - zType = ts + 740 /* "" */ + zType = ts + 755 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -161022,37 +161530,37 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 27143 /* "_rowid_" */ + zCol = ts + 27158 /* "_rowid_" */ } else { - zCol = ts + 26873 /* "rbu_rowid" */ + zCol = ts + 26888 /* "rbu_rowid" */ } - zType = ts + 11369 /* "INTEGER" */ + zType = ts + 11384 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, ts+27324 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+27339 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 27060 /* " DESC" */ + return ts + 27075 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+27344, /* "%z%s\"rbu_imp_%d%..." */ + zImpPK = Xsqlite3_mprintf(tls, ts+27359, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+27365, /* "%z%s\"rbu_imp_%d%..." */ + zImpCols = Xsqlite3_mprintf(tls, ts+27380, /* "%z%s\"rbu_imp_%d%..." */ libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+27398 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) + ts+27413 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 13309 /* ", " */ - zAnd = ts + 19862 /* " AND " */ + zCom = ts + 13324 /* ", " */ + zAnd = ts + 19877 /* " AND " */ nBind++ } @@ -161095,16 +161603,16 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 740 /* "" */ + var zS uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, ts+27422 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+27437 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+27434 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+27449 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 13309 /* ", " */ + zS = ts + 13324 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -161113,7 +161621,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27443 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+27458 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -161133,27 +161641,27 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+27458 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+27473 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+27472 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) - zSep = ts + 19862 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27487 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 19877 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+27484 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) + ts+27499 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+27534 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) - zSep = ts + 19862 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+27549 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 19877 /* " AND " */ } } } @@ -161167,7 +161675,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27547 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+27562 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -161196,21 +161704,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+27534, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+27549, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+27573, /* "%z%s\"%w\"=rbu_del..." */ + zList = rbuMPrintf(tls, p, ts+27588, /* "%z%s\"%w\"=rbu_del..." */ libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+27603, /* "%z%s\"%w\"=rbu_fos..." */ + zList = rbuMPrintf(tls, p, ts+27618, /* "%z%s\"%w\"=rbu_fos..." */ libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 13309 /* ", " */ + zSep = ts + 13324 /* ", " */ } } } @@ -161268,19 +161776,19 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 27640 /* "PRIMARY KEY(" */ + var zSep uintptr = ts + 27655 /* "PRIMARY KEY(" */ *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26792 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + Xsqlite3_mprintf(tls, ts+26807 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14652 /* "pk" */) == 0) { + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+14667 /* "pk" */) == 0) { var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } @@ -161293,15 +161801,15 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 2) var zDesc uintptr if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 3) != 0 { - zDesc = ts + 27060 /* " DESC" */ + zDesc = ts + 27075 /* " DESC" */ } else { - zDesc = ts + 740 /* "" */ + zDesc = ts + 755 /* "" */ } - z = rbuMPrintf(tls, p, ts+27653 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) - zSep = ts + 13309 /* ", " */ + z = rbuMPrintf(tls, p, ts+27668 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 13324 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+27664 /* "%z)" */, libc.VaList(bp+48, z)) + z = rbuMPrintf(tls, p, ts+27679 /* "%z)" */, libc.VaList(bp+48, z)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */))) } return z @@ -161333,7 +161841,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration @@ -161341,7 +161849,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 64 /* &.zErrmsg */), - ts+27668 /* "SELECT name FROM..." */) + ts+27683 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { @@ -161350,7 +161858,7 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit } if zIdx != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+26820 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + Xsqlite3_mprintf(tls, ts+26835 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) @@ -161360,25 +161868,25 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+27718 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, + zCols = rbuMPrintf(tls, p, ts+27733 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+27740 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+27755 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 27060 /* " DESC" */ + return ts + 27075 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 13309 /* ", " */ + zComma = ts + 13324 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+27750 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + zCols = rbuMPrintf(tls, p, ts+27765 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+27765, /* "CREATE TABLE rbu..." */ + ts+27780, /* "CREATE TABLE rbu..." */ libc.VaList(bp+120, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) } } @@ -161406,52 +161914,52 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 740 /* "" */ + var zPk uintptr = ts + 755 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 27827 /* "PRIMARY KEY " */ + zPk = ts + 27842 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+27840, /* "%z%s\"%w\" %s %sCO..." */ + zSql = rbuMPrintf(tls, p, ts+27855, /* "%z%s\"%w\" %s %sCO..." */ libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 27867 /* " NOT NULL" */ + return ts + 27882 /* " NOT NULL" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 13309 /* ", " */ + zComma = ts + 13324 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+27877 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+27892 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27884, /* "CREATE TABLE \"rb..." */ + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+27899, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 27916 /* " WITHOUT ROWID" */ + return ts + 27931 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) } } @@ -161474,7 +161982,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 152 /* &.pTmpInsert */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27931, /* "INSERT INTO %s.'..." */ + ts+27946, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -161511,7 +162019,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+27988 /* "SELECT trim(sql)..." */) + ts+28003 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -161621,7 +162129,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+28054 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+28069 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -161642,26 +162150,26 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 624 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28074, /* "CREATE TABLE \"rb..." */ + ts+28089, /* "CREATE TABLE \"rb..." */ libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, 0, 0)) // Create the statement to insert index entries (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28139 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+28154 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28175 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+28190 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -161678,7 +162186,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+28209, /* "SELECT %s, 0 AS ..." */ + ts+28224, /* "SELECT %s, 0 AS ..." */ libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, @@ -161686,32 +162194,32 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 28270 /* "AND" */ + return ts + 28285 /* "AND" */ } - return ts + 28274 /* "WHERE" */ + return ts + 28289 /* "WHERE" */ }() } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+28280, /* "SELECT %s, rbu_c..." */ + ts+28295, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+216, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+28341, /* "SELECT %s, rbu_c..." */ + ts+28356, /* "SELECT %s, rbu_c..." */ libc.VaList(bp+264, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 28270 /* "AND" */ + return ts + 28285 /* "AND" */ } - return ts + 28274 /* "WHERE" */ + return ts + 28289 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -161736,8 +162244,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5452 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5448 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5467 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+5463 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -161747,21 +162255,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 28500 /* "rbu_imp_" */ + return ts + 28515 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+28509, /* "INSERT INTO \"%s%..." */ + ts+28524, /* "INSERT INTO \"%s%..." */ libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 28545 /* ", _rowid_" */ + return ts + 28560 /* ", _rowid_" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zBindings))) } @@ -161771,28 +162279,28 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+28555 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) + ts+28570 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 28583 /* ", rbu_rowid" */ + zRbuRowid = ts + 28598 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+28595 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+28610 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 28671 /* ", 0 AS rbu_rowid" */ + return ts + 28686 /* ", 0 AS rbu_rowid" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28688, /* "CREATE TEMP TRIG..." */ + ts+28703, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) @@ -161800,7 +162308,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+28987, /* "CREATE TEMP TRIG..." */ + ts+29002, /* "CREATE TEMP TRIG..." */ libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } @@ -161809,14 +162317,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 29086 /* ",_rowid_ " */ + zRbuRowid = ts + 29101 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 29096 /* ",rbu_rowid" */ + zRbuRowid = ts + 29111 /* ",rbu_rowid" */ } } @@ -161829,35 +162337,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+27143 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+27158 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+13309 /* ", " */, ts+740 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+13324 /* ", " */, ts+755 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+29107, /* "SELECT %s,%s rbu..." */ + ts+29122, /* "SELECT %s,%s rbu..." */ libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 29155 /* "0 AS " */ + return ts + 29170 /* "0 AS " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 18196 /* "ORDER BY" */ + return ts + 18211 /* "ORDER BY" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zOrder, zLimit))) } @@ -161932,12 +162440,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 740 /* "" */ + var zPrefix uintptr = ts + 755 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 28500 /* "rbu_imp_" */ + zPrefix = ts + 28515 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+29161, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+29176, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 8 /* &.pUpdate */), (p + 64 /* &.zErrmsg */), zUpdate) @@ -161964,7 +162472,7 @@ func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uin return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } @@ -162005,7 +162513,7 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ } *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29191 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) + Xsqlite3_mprintf(tls, ts+29206 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: @@ -162077,31 +162585,31 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29221 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+29236 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29248 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+2398 /* "stat" */, uint64(4)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29263 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+2413 /* "stat" */, uint64(4)) } else { - libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+5443 /* "main" */, uint64(4)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+5458 /* "main" */, uint64(4)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29266 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+29281 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -162134,11 +162642,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29332 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29347 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22464 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+22479 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -162150,16 +162658,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+29364, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+29379, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 29396 /* "&" */ + return ts + 29411 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } return zExtra }())) @@ -162175,40 +162683,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29398 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29413 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29413 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+29428 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29430 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+29445 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29446 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29461 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29474 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+29489 /* "rbu vfs not foun..." */, 0) } } @@ -162277,7 +162785,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29446 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29461 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -162311,7 +162819,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29492 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29507 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -162438,16 +162946,16 @@ func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ bp := tls.Alloc(16) defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5443 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+5458 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5443 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+5458 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+29527 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+29534 /* "%s-wal" */, libc.VaList(bp+8, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+29542 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+29549 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -162587,7 +163095,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22102 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+22117 /* "datatype mismatc..." */, 0) return } @@ -162705,7 +163213,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // var pStmt uintptr at bp+8, 8 (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+29541 /* "PRAGMA schema_ve..." */) + ts+29556 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot @@ -162718,7 +163226,7 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29563 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29578 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -162743,7 +163251,7 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+29590, /* "INSERT OR REPLAC..." */ + ts+29605, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+48, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -162788,9 +163296,9 @@ func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29748 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + Xsqlite3_mprintf(tls, ts+29763 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29763, /* "PRAGMA main.%s =..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29778, /* "PRAGMA main.%s =..." */ libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) @@ -162807,11 +163315,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29783 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29798 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+29808 /* "SELECT sql FROM ..." */) + ts+29823 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -162825,12 +163333,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+29916 /* "SELECT * FROM sq..." */) + ts+29931 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8 /* &pInsert */, (p + 64 /* &.zErrmsg */), - ts+29981 /* "INSERT INTO sqli..." */) + ts+29996 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -162842,7 +163350,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30025 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30040 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -162864,8 +163372,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+15708 /* "user_version" */) - rbuCopyPragma(tls, p, ts+14830 /* "application_id" */) + rbuCopyPragma(tls, p, ts+15723 /* "user_version" */) + rbuCopyPragma(tls, p, ts+14845 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -162876,7 +163384,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30050 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+30065 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -162902,10 +163410,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -163022,7 +163530,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30078 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30093 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -163041,7 +163549,7 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ bp := tls.Alloc(8) defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+29527 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+29542 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -163063,7 +163571,7 @@ func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ // var zRnd [64]int8 at bp+12, 64 Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30103 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+30118 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) @@ -163102,7 +163610,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+16, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+30114 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+30129 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)), -1) } else { @@ -163145,7 +163653,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30186 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30201 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -163153,7 +163661,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30200 /* "SELECT 1 FROM sq..." */) + ts+30215 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -163165,7 +163673,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30257 /* "SELECT sum(cnt *..." */) + ts+30272 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -163211,7 +163719,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + uint64(1))) pCsr += (uintptr(nRbu + uint64(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2775 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+2790 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -163248,7 +163756,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30331 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30346 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -163270,12 +163778,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30363, /* "database modifie..." */ + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30378, /* "database modifie..." */ libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30395 /* "vacuum" */ + return ts + 30410 /* "vacuum" */ } - return ts + 30402 /* "update" */ + return ts + 30417 /* "update" */ }())) } } @@ -163283,7 +163791,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13198 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -163297,24 +163805,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+15433 /* "page_size" */) - rbuCopyPragma(tls, p, ts+14845 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+15448 /* "page_size" */) + rbuCopyPragma(tls, p, ts+14860 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30409 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+30424 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+5443 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+5458 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+30425 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + db, ts+30440 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } } @@ -163367,7 +163875,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30449 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+30464 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { return rbuMisuseError(tls) } } @@ -163397,7 +163905,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); Size_t(i) < (nErrmsg - uint64(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28500 /* "rbu_imp_" */, uint64(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+28515 /* "rbu_imp_" */, uint64(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -163416,7 +163924,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -163428,7 +163936,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Close any open statement handles. @@ -163440,7 +163948,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30457 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30472 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -163539,7 +164047,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163556,19 +164064,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13213 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+13228 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 13198 /* "BEGIN" */ + zBegin = ts + 13213 /* "BEGIN" */ } else { - zBegin = ts + 30409 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 30424 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30409 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30424 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -163972,7 +164480,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30484 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30499 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -163995,7 +164503,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+30507 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+30522 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -164158,7 +164666,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5443 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+5458 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -164173,7 +164681,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+30518 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+30533 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -164480,6 +164988,5673 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + _ [4]byte + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + _ [4]byte + FaData uintptr + FnData int32 + _ [4]byte + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 + _ [4]byte +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nVarint + 1))), z, uint64(n)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 8 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.Xmemcpy(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint64(8)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint64(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint64(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+16, 4 + + var aOld uintptr + // var nNew int32 at bp+40, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+16 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+40 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.Xmemcpy(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+44, 4 + + var aOld uintptr + // var nNew int32 at bp+48, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+44 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+48 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 44 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.Xmemcpy(tls, aOut, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 8 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint64(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 8 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+30544 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+755 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+30665 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(uint64(nDbCol) * ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))) + uint64(1))))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*8) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, (uint64(nThis + 1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, (uint64(nName + 1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 8 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 16 /* &.nCol */), uintptr(0), (pTab + 24 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += I64((uint64(((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + uint64(1)))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 24 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 32 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.Xmemcpy(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint64(8)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + // var iHash int32 at bp+48, 4 + + // var bNull int32 at bp+52, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 48 + + var p uintptr + // var p1 uintptr at bp+56, 8 + + // var p2 uintptr at bp+72, 8 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+64, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 24 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+755 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+48 /* &iHash */, bp+52 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)), bp+64 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.Xmemset(tls, pC, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*32) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)), bp+64 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 48 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 8 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 + _ [4]byte +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+30694, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 19877 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+30728, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 30769 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+6506 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+30774, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+30852, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 16 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+24, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+40, 8 + + // var azCol uintptr at bp+32, 8 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+16, 8 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.Xmemset(tls, bp /* &d */, 0, uint64(unsafe.Sizeof(SessionDiffCtx{}))) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+16 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24 /* &nCol */, uintptr(0), bp+32 /* &azCol */, bp+40 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol + uintptr(i)*8))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+30905 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(Sqlite3_session{})) + uint64(nDb)) + uint64(1)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_session{}))) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*136) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.Xmemcpy(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint64(nDb + 1))) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 8 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 80 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionTable{})) + uint64(nName)) + uint64(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint64(nName + 1))) + for ppTab = (pSession + 88 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint64(nBlob)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint64(nStr)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([24]int8{})) - uint64(1))), bp+8 /* &aBuf[0] */, ts+4089 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = (int32((int64(zOut) - int64((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint64(8)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+32 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+32 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, (int32((int64(a) - int64(pStart)) / 1)), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+10072 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+30932 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+31042 /* "SELECT * FROM " */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+768 /* "." */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31057 /* " WHERE " */, bp+24 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+31065 /* " IS ?" */, bp+24 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+24 /* &rc */) + zSep = ts + 19877 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp /* &rVal */, bp+8 /* &iVal */, uint64(8)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+40, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+31071 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+16, 8 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+8 /* &azCol */, bp+16 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+24 /* &buf */, bPatchset, pTab, bp+40 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), bp+48 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+24 /* &buf */, uint8(SQLITE_INSERT), bp+40 /* &rc */) + sessionAppendByte(tls, bp+24 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+40 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+24 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), iCol, bp+40 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendUpdate(tls, bp+24 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendDelete(tls, bp+24 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+31091 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.Xmemmove(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint64(nMove)) + } + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+32 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 48 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, aCopy, aData, uint64(nData)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &d */, bp+16 /* &v */, uint64(8)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 120 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)) + uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 72 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)) + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */)))) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*8) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+100 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2))) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+100 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*8)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var rc int32 at bp+40, 4 + // Return value + // var sOut SessionBuffer at bp, 16 + // Output buffer + // var nCol int32 at bp+20, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+24, 16 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+16, 4 + + var nVar int32 + // var nByte1 int32 at bp+44, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.Xmemset(tls, bp /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+16 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+20 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+24 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 16 /* nByte */)), bp+40 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 16 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+44 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */)), bp+40 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2)))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+40 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))*8), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) + }())))*8)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+40 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+40 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + var rc int32 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + _ [4]byte + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [6]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 64 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint64(nU32)*uint64(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionUpdate{})) * uint64(nU32)) * uint64(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+10072 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 755 /* "" */ + // var buf SessionBuffer at bp, 16 + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*24) + libc.Xmemcpy(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + + sessionAppendStr(tls, bp /* &buf */, ts+31109 /* "UPDATE main." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31122 /* " SET " */, bp+16 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31128 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+16 /* &rc */) + zSep = ts + 13324 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 755 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+31057 /* " WHERE " */, bp+16 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*8)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+31133 /* "idx IS CASE WHEN..." */, bp+16 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31065 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+16 /* &rc */) + } + zSep = ts + 19877 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+31208 /* "DELETE FROM main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31057 /* " WHERE " */, bp+16 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31128 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 19877 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+31226 /* " AND (?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+30769 /* " OR " */, bp+16 /* &rc */) + + zSep = ts + 755 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+31065 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 31234 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+4066 /* ")" */, bp+16 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+5458 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 24 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+31239 /* "INSERT INTO main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+19883 /* "(" */, bp+16 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+13324 /* ", " */, bp+16 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+31257 /* ") VALUES(?" */, bp+16 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+31268 /* ", ?" */, bp+16 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+4066 /* ")" */, bp+16 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 16 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+10072 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 16 /* &.pInsert */), + + ts+31272 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pDelete */), + + ts+31385 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 8 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var nCol int32 at bp+8, 4 + // Number of columns in table + // var op int32 at bp+12, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 8 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 104 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 104 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 104 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+8 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8 /* &pVal */) + } + sessionAppendValue(tls, (p + 104 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+16, 4 + + // var nCol int32 at bp+8, 4 + + // var op int32 at bp+12, 4 + + // var zDummy uintptr at bp, 8 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 88 /* &.constraints */), aBlob, nBlob, bp+16 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var zDummy uintptr at bp, 8 + + // var op int32 at bp+12, 4 + + // var nCol int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 8 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+16 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*8)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*8)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+31529 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31550 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, (pApply + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint64(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint64(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 72 /* &.tblhdr */), int64(nByte), bp+8 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte) + } + + for (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(368) + defer tls.Free(368) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 128 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.Xmemset(tls, bp+48 /* &sApply */, 0, uint64(unsafe.Sizeof(SessionApplyCtx{}))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+31569 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31595 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+184, 4 + + // var op int32 at bp+188, 4 + + // var zNew uintptr at bp+176, 8 + + Xsqlite3changeset_op(tls, pIter, bp+176 /* &zNew */, bp+184 /* &nCol */, bp+188 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+192, 8 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.Xmemset(tls, (bp + 48 /* &sApply */ + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+192 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+5458 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), (bp + 48 /* &sApply */ + 32 /* &.nCol */), bp+200 /* &zTab */, (bp + 48 /* &sApply */ + 40 /* &.azCol */), (bp + 48 /* &sApply */ + 48 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31625 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+31669, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 192 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+31740 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), ts+10072 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+208, 4 + + // var notUsed int32 at bp+212, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+208 /* &nFk */, bp+212 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+216, 152 + + libc.Xmemset(tls, bp+216 /* &sIter */, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 216 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+216 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+31800 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+31830 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+31854 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+31830 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(SessionChange{})) + uint64(nRec)))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*32) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint64(nIn)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.Xmemset(tls, pNew, 0, uint64(nByte)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+8, 8 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(SessionChange{})) + uint64((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+16 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+24 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */))) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var aRec uintptr at bp, 8 + + // var nRec int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+16, 8 + + // var nCol int32 at bp+24, 4 + + // var op int32 at bp+28, 4 + + var iHash int32 + // var bIndirect int32 at bp+32, 4 + + // var pChange uintptr at bp+48, 8 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+16 /* &zNew */, bp+24 /* &nCol */, bp+28 /* &op */, bp+32 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)))) + // var abPK uintptr at bp+40, 8 + + Xsqlite3changeset_pk(tls, pIter, bp+40 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(SessionTable{})) + uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + uint64(nNew)) + uint64(1)))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 24 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (uint64(nNew + 1))) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28 /* op */)), *(*int32)(unsafe.Pointer(bp + 32 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+48 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+16 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+16 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+16 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3_changegroup{}))) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint64(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint64(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 16 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, bp+12 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+16 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+32 /* &rc */) + sessionAppendVarint(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+32 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_UPDATE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+40 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_INSERT), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)), (int32(int64(*(*int32)(unsafe.Pointer(bp + 8 /* nRec */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */))) - int64(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1))), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+16 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_DELETE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + libc.Xmemset(tls, bp+16 /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_rebaser{}))) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -164550,71 +170725,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -165444,7 +171554,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+30529 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+31882 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -165767,7 +171877,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+30557 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+31910 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -166068,7 +172178,7 @@ func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+30588 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31941 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -166142,7 +172252,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 30595 /* "wrong number of ..." */ + var zErr uintptr = ts + 31948 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -166309,7 +172419,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 740 /* "" */ + return ts + 755 /* "" */ } // Implementation of snippet() function. @@ -166336,7 +172446,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 30645 /* "wrong number of ..." */ + var zErr uintptr = ts + 31998 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -166678,13 +172788,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(96) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 30693 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32046 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 30701 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32054 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 30711 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 32064 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -167178,7 +173288,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+5243 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+5258 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -167357,7 +173467,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+30716 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32069 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 @@ -167384,14 +173494,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30723 /* "malformed prefix..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32076 /* "malformed prefix..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+30754 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + ts+32107 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -167402,7 +173512,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30787 /* "prefix length ou..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32140 /* "prefix length ou..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -167415,7 +173525,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30824 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32177 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + uint64(1))) var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) @@ -167424,7 +173534,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30833 /* "multiple tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32186 /* "multiple tokeniz..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { @@ -167443,7 +173553,7 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30866 /* "parse error in t..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32219 /* "parse error in t..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, @@ -167458,14 +173568,14 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30900 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32253 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30908 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32261 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+30940 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+32293 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } @@ -167473,9 +173583,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30946 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32299 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+30960 /* "multiple content..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32313 /* "multiple content..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) @@ -167483,9 +173593,9 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+30998 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+32351 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31009 /* "malformed column..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32362 /* "malformed column..." */, 0) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) @@ -167493,21 +173603,21 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+4174 /* "detail" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+4189 /* "detail" */, zCmd, nCmd) == 0 { *(*[4]Fts5Enum)(unsafe.Pointer(bp + 48 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 15813 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 15818 /* "full" */}, - {FzName: ts + 31044 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + {FzName: ts + 15828 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 15833 /* "full" */}, + {FzName: ts + 32397 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+48 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31052 /* "malformed detail..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32405 /* "malformed detail..." */, 0) } return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31083 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32436 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -167571,15 +173681,15 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+20482 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+14742 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31111 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+20497 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+14757 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32464 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+31141 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+32494 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31151 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32504 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -167597,13 +173707,13 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31182 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32535 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31187 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32540 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+31194 /* ", T.c%d" */, libc.VaList(bp+16, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+32547 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } @@ -167651,8 +173761,8 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20482 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31202 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+20497 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32555 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } @@ -167685,7 +173795,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+31231 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32584 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { @@ -167693,7 +173803,7 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), pzErr) } else { *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)), pzErr) @@ -167718,19 +173828,19 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 30900 /* "content" */ + zTail = ts + 32253 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 31251 /* "docsize" */ + zTail = ts + 32604 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+40 /* &rc */, ts+31259 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+32612 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14742 /* "rowid" */, -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+14757 /* "rowid" */, -1) } // Formulate the zContentExprlist text @@ -167779,18 +173889,18 @@ func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31270 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32623 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 13309 /* ", " */ + return ts + 13324 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31286 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32639 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+31293, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20482 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+32646, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+20497 /* "rank" */)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) @@ -167930,7 +174040,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+31319 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+32672 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -167940,7 +174050,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31324 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32677 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -167950,7 +174060,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31333 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32686 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -167963,7 +174073,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31343 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32696 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -167973,7 +174083,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+31353 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32706 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -167989,7 +174099,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20482 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+20497 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 8 @@ -168016,7 +174126,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 bp := tls.Alloc(52) defer tls.Free(52) - var zSelect uintptr = ts + 31365 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 32718 /* "SELECT k, v FROM..." */ var zSql uintptr *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK @@ -168039,7 +174149,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) { var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 0) var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+31397 /* "version" */) { + if 0 == Xsqlite3_stricmp(tls, zK, ts+32750 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { *(*int32)(unsafe.Pointer(bp + 48 /* bDummy */)) = 0 @@ -168054,7 +174164,7 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+31405, /* "invalid fts5 fil..." */ + ts+32758, /* "invalid fts5 fil..." */ libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } @@ -168188,7 +174298,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31470 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+32823 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -168201,20 +174311,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+31490 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+32843 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31521 /* "OR" */, uint64(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32874 /* "OR" */, uint64(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+31524 /* "NOT" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32877 /* "NOT" */, uint64(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28270 /* "AND" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+28285 /* "AND" */, uint64(3)) == 0) { tok = FTS5_AND } break @@ -170187,9 +176297,9 @@ func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqli bp := tls.Alloc(16) defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+31528 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+32881 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+30557 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+31910 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } @@ -170205,7 +176315,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+31533 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+32886 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -170302,7 +176412,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+18865 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+18880 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -170398,7 +176508,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31562 /* "fts5: column que..." */, 0) + ts+32915 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -170582,12 +176692,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+31615, /* "fts5: %s queries..." */ + ts+32968, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 31665 /* "phrase" */ + return ts + 33018 /* "phrase" */ } - return ts + 31528 /* "NEAR" */ + return ts + 32881 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -172060,7 +178170,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+31672 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33025 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -172148,7 +178258,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+31678, /* "REPLACE INTO '%q..." */ + ts+33031, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -172176,7 +178286,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+31729, /* "DELETE FROM '%q'..." */ + ts+33082, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+72 /* &.pDeleter */), zSql) != 0 { return @@ -172200,7 +178310,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 88 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+31778, /* "DELETE FROM '%q'..." */ + ts+33131, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -172408,7 +178518,7 @@ func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12 if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 112 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+31818 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+33171 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -173843,7 +179953,7 @@ func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:2 var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 96 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+31841, /* "SELECT pgno FROM..." */ + ts+33194, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -175100,7 +181210,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -175441,7 +181551,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 80 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+31925, /* "INSERT INTO '%q'..." */ + ts+33278, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -176658,7 +182768,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Fts5Structure{}))) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+740 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+755 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -176679,13 +182789,13 @@ func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uint if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+31982 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+33335 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+23301 /* "data" */, ts+31990 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+23316 /* "data" */, ts+33343 /* "id INTEGER PRIMA..." */, 0, pzErr) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10197, /* "idx" */ - ts+32025, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+10212, /* "idx" */ + ts+33378, /* "segid, term, pgn..." */ 1, pzErr) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { @@ -176991,7 +183101,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+31672 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) + ts+33025 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))) @@ -177128,7 +183238,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+32069, /* "SELECT segid, te..." */ + ts+33422, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. @@ -177338,7 +183448,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 16 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*120), uintptr(0), bp+16 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+32155 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+33508 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fn, bp+32 /* &iOff */, bp+40 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) & int64(0x7FFFFFFF))) @@ -177749,7 +183859,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32160 /* "recursively defi..." */, 0) + ts+33513 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -177783,7 +183893,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4074 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4089 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -177799,7 +183909,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4074 /* "%d" */, libc.VaList(bp+8, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+4089 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -178142,7 +184252,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -178174,7 +184284,7 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } @@ -178213,25 +184323,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+32199, /* "SELECT rowid, ra..." */ + ts+33552, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 13309 /* ", " */ + return ts + 13324 /* ", " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 32254 /* "DESC" */ + return ts + 33607 /* "DESC" */ } - return ts + 32259 /* "ASC" */ + return ts + 33612 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -178282,13 +184392,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+32263 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+33616 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4156 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+4171 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32269 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33622 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -178323,7 +184433,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+32297 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+33650 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, @@ -178355,7 +184465,7 @@ func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:2288 pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+32307 /* "no such function..." */, libc.VaList(bp+8, zRank)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33660 /* "no such function..." */, libc.VaList(bp+8, zRank)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } @@ -178387,14 +184497,14 @@ func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uin *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+32328 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+33681 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 30711 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32064 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -178460,7 +184570,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32160 /* "recursively defi..." */, 0) + ts+33513 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -178506,7 +184616,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 740 /* "" */ + zText = ts + 755 /* "" */ __14: ; iCol = 0 @@ -178695,7 +184805,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32361 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+33714 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -178832,7 +184942,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+2775 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+2790 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -178869,29 +184979,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+32397 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+33750 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+32408 /* "'delete-all' may..." */, 0) + ts+33761 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+32488 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33841 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+32496 /* "'rebuild' may no..." */, 0) + ts+33849 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+15413 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+15428 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+32552 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33905 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+32558 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+33911 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -178965,7 +185075,7 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+15952 /* "delete" */, z)) { + (0 == Xsqlite3_stricmp(tls, ts+15967 /* "delete" */, z)) { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) @@ -178990,12 +185100,12 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+32574, /* "cannot %s conten..." */ + ts+33927, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 18766 /* "UPDATE" */ + return ts + 18781 /* "UPDATE" */ } - return ts + 32611 /* "DELETE from" */ + return ts + 33964 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { @@ -179665,7 +185775,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+32623 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+33976 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -179970,7 +186080,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32644 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33997 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 16 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -179987,7 +186097,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 16 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32666 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34019 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -180034,7 +186144,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+32697 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34050 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -180045,7 +186155,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+32710 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+34063 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -180061,7 +186171,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 32801 /* "config" */, ts + 30900 /* "content" */, ts + 23301 /* "data" */, ts + 31251 /* "docsize" */, ts + 10197, /* "idx" */ + ts + 34154 /* "config" */, ts + 32253 /* "content" */, ts + 23316 /* "data" */, ts + 32604 /* "docsize" */, ts + 10212, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -180085,7 +186195,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+32808 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+34161 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -180103,13 +186213,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32808 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34161 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+32813 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+34166 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -180175,20 +186285,20 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ - ts + 32828, /* "SELECT %s FROM %..." */ - ts + 32896, /* "SELECT %s FROM %..." */ - ts + 32965, /* "SELECT %s FROM %..." */ // LOOKUP + ts + 34181, /* "SELECT %s FROM %..." */ + ts + 34249, /* "SELECT %s FROM %..." */ + ts + 34318, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 32998, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 33037, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 33077, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 33116, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 33157, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 34351, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 34390, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 34430, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 34469, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 34510, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 33196, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 34549, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 33238, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 33278, /* "SELECT %s FROM %..." */ // SCAN + ts + 34591, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 34631, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) @@ -180255,7 +186365,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2775 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+2790 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -180293,18 +186403,18 @@ func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230 var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33301, /* "DROP TABLE IF EX..." */ + ts+34654, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33405, /* "DROP TABLE IF EX..." */ + ts+34758, /* "DROP TABLE IF EX..." */ libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33443, /* "DROP TABLE IF EX..." */ + ts+34796, /* "DROP TABLE IF EX..." */ libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc @@ -180316,7 +186426,7 @@ func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uin if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33481, /* "ALTER TABLE %Q.'..." */ + ts+34834, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -180328,14 +186438,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23301 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10197 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32801 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+23316 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+10212 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34154 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+31251 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32604 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+30900 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32253 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -180349,17 +186459,17 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn var rc int32 *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+33523, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+34876, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 27916 /* " WITHOUT ROWID" */ + return ts + 27931 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+33553, /* "fts5: error crea..." */ + ts+34906, /* "fts5: error crea..." */ libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } @@ -180401,27 +186511,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+33597 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34950 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+33620 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+34973 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+30900 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32253 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+31251 /* "docsize" */, ts+33626 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+32604 /* "docsize" */, ts+34979 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+32801 /* "config" */, ts+33658 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+34154 /* "config" */, ts+35011 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31397 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32750 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -180658,12 +186768,12 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33675, /* "DELETE FROM %Q.'..." */ + ts+35028, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+33725, /* "DELETE FROM %Q.'..." */ + ts+35078, /* "DELETE FROM %Q.'..." */ libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } @@ -180673,7 +186783,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+31397 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32750 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -180868,7 +186978,7 @@ func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+33754, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+35107, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -181065,14 +187175,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+30900 /* "content" */, bp+48 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32253 /* "content" */, bp+48 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+31251 /* "docsize" */, bp+56 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+32604 /* "docsize" */, bp+56 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -181308,9 +187418,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.Xmemcpy(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint64(unsafe.Sizeof(aAsciiTokenChar))) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33786 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35139 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33797 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35150 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -181550,7 +187660,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 33808 /* "L* N* Co" */ + var zCat uintptr = ts + 35161 /* "L* N* Co" */ var i int32 libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Unicode61Tokenizer{}))) @@ -181563,7 +187673,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33817 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35170 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) } } @@ -181574,18 +187684,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33828 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35181 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33786 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35139 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33797 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35150 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+33817 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35170 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -181897,7 +188007,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 33846 /* "unicode61" */ + var zBase uintptr = ts + 35199 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -182050,7 +188160,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33856 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35209 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -182058,11 +188168,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33859 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35212 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33864 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35217 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -182070,7 +188180,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33869 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35222 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -182078,7 +188188,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33872 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35225 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -182086,11 +188196,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33875 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35228 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33880 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35233 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -182098,19 +188208,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33885 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35238 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33889 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35242 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33895 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35248 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33900 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35253 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182118,11 +188228,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33904 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35257 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33908 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35261 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -182130,7 +188240,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33911 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35264 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182138,11 +188248,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33915 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35268 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33919 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35272 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182150,7 +188260,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33923 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35276 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182158,7 +188268,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33927 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35280 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182166,7 +188276,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33931 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35284 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182183,24 +188293,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33935 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33915 /* "ate" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35288 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35268 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33938 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33941 /* "ble" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35291 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35294 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+33945 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+33931 /* "ize" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35298 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35284 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -182216,137 +188326,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+33948 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35301 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33915 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35268 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+33956 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35309 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33963 /* "tion" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35316 /* "tion" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33968 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35321 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33864 /* "ence" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35217 /* "ence" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33973 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35326 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33859 /* "ance" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35212 /* "ance" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33978 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35331 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33931 /* "ize" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35284 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33983 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35336 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14763 /* "log" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+14778 /* "log" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+33988 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35341 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+33941 /* "ble" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35294 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+33992 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35345 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33856 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35209 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+33997 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35350 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33900 /* "ent" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35253 /* "ent" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34003 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35356 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34007 /* "e" */, uint64(1)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35360 /* "e" */, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34009 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35362 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33923 /* "ous" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35276 /* "ous" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34015 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35368 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33931 /* "ize" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35284 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34023 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35376 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33915 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35268 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34029 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35382 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33915 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35268 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34034 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35387 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34040 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35393 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33927 /* "ive" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35280 /* "ive" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34048 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35401 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+34056 /* "ful" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35409 /* "ful" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+34060 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35413 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+33923 /* "ous" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35276 /* "ous" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34068 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35421 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34074 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35427 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33927 /* "ive" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35280 /* "ive" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+34080 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35433 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+33941 /* "ble" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35294 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -182362,16 +188472,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34087 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35440 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+33872 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35225 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+34092 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35445 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -182379,21 +188489,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34097 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35450 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33872 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35225 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34103 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35456 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33872 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35225 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34056 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35409 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -182401,7 +188511,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34109 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35462 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -182409,9 +188519,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+34115 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35468 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+33856 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35209 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -182427,12 +188537,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34121 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35474 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+34125 /* "ee" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35478 /* "ee" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+34128 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35481 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -182441,7 +188551,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+34131 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35484 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -182611,7 +188721,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+34135 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35488 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -182801,22 +188911,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(128) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 33846 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35199 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 34150 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35503 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 34156 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35509 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 34163 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 35516 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -184163,14 +190273,14 @@ func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uint var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+34171 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+35524 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+34175 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35528 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+34179 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+35532 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34188 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35541 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) @@ -184217,19 +190327,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(36) *(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azSchema */)) = [3]uintptr{ - ts + 34222, /* "CREATE TABlE voc..." */ - ts + 34262, /* "CREATE TABlE voc..." */ - ts + 34297, /* "CREATE TABlE voc..." */ + ts + 35575, /* "CREATE TABlE voc..." */ + ts + 35615, /* "CREATE TABlE voc..." */ + ts + 35650, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+21610 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+21625 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34340 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35693 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -184381,11 +190491,11 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34373 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35726 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ - ts+34404, /* "SELECT t.%Q FROM..." */ + ts+35757, /* "SELECT t.%Q FROM..." */ libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+72 /* &pStmt */, uintptr(0)) @@ -184409,7 +190519,7 @@ func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+34455 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+35808 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { @@ -184697,7 +190807,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 740 /* "" */ + zCopy = ts + 755 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -184814,7 +190924,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+34481 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+35834 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -184859,7 +190969,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 34491 /* "2021-06-18 18:36..." */ + return ts + 35844 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -185747,5 +191857,5 @@ func init() { *(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfs_template)) + 128 /* .xGetLastError */)) = rbuVfsGetLastError // sqlite3.c:205300:5: } -var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=gcc-8.3.0\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00open\x00close\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00read\x00pread\x00pread64\x00write\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00unlink\x00openDirectory\x00mkdir\x00rmdir\x00fchown\x00geteuid\x00mmap\x00munmap\x00mremap\x00getpagesize\x00readlink\x00lstat\x00ioctl\x00attempt to open \"%s\" as file descriptor %d\x00/dev/null\x00os_unix.c:%d: (%d) %s(%s) - %s\x00cannot fstat db file %s\x00file unlinked while open: %s\x00multiple links to file: %s\x00file renamed while open: %s\x00%s\x00full_fsync\x00%s-shm\x00readonly_shm\x00psow\x00unix-excl\x00%s.lock\x00SQLITE_TMPDIR\x00TMPDIR\x00/var/tmp\x00/usr/tmp\x00/tmp\x00%s/etilqs_%llx%c\x00modeof\x00fsync\x00/dev/urandom\x00unix\x00unix-none\x00unix-dotfile\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00so\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00exclusive\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go index f781191a..10c8cbd9 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_windows_amd64.go @@ -1,4 +1,4 @@ -// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_windows_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_WIN=1 -D_MSC_VER=1900', DO NOT EDIT. +// Code generated by 'ccgo -DSQLITE_PRIVATE= -export-defines "" -export-enums "" -export-externs X -export-fields F -export-typedefs "" -pkgname sqlite3 -o lib/sqlite_windows_amd64.go -trace-translation-units testdata/sqlite-amalgamation-3360000/sqlite3.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CORE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -DSQLITE_OS_WIN=1 -D_MSC_VER=1900', DO NOT EDIT. package sqlite3 @@ -13489,11 +13489,14 @@ const ( SERVICE_WIN32 = 48 SERVICE_WIN32_OWN_PROCESS = 0x00000010 SERVICE_WIN32_SHARE_PROCESS = 0x00000020 + SESSIONS_STRM_CHUNK_SIZE = 1024 SESSION_ABORTED = 0x06 SESSION_ALL_ACCESS = 983043 SESSION_ESTABLISHED = 0x03 + SESSION_MAX_BUFFER_SZ = 2147483391 SESSION_MODIFY_ACCESS = 0x2 SESSION_QUERY_ACCESS = 0x1 + SESSION_UPDATE_CACHE_SZ = 12 SETABORTPROC = 9 SETALLJUSTVALUES = 771 SETBREAK = 8 @@ -14225,6 +14228,17 @@ const ( SQLITE_CANTOPEN_NOTEMPDIR = 270 SQLITE_CANTOPEN_SYMLINK = 1550 SQLITE_CDECL = 0 + SQLITE_CHANGESETAPPLY_INVERT = 0x0002 + SQLITE_CHANGESETAPPLY_NOSAVEPOINT = 0x0001 + SQLITE_CHANGESETSTART_INVERT = 0x0002 + SQLITE_CHANGESET_ABORT = 2 + SQLITE_CHANGESET_CONFLICT = 3 + SQLITE_CHANGESET_CONSTRAINT = 4 + SQLITE_CHANGESET_DATA = 1 + SQLITE_CHANGESET_FOREIGN_KEY = 5 + SQLITE_CHANGESET_NOTFOUND = 2 + SQLITE_CHANGESET_OMIT = 0 + SQLITE_CHANGESET_REPLACE = 1 SQLITE_CHECKPOINT_FULL = 1 SQLITE_CHECKPOINT_PASSIVE = 0 SQLITE_CHECKPOINT_RESTART = 2 @@ -14379,6 +14393,7 @@ const ( SQLITE_ENABLE_PREUPDATE_HOOK = 1 SQLITE_ENABLE_RBU = 1 SQLITE_ENABLE_RTREE = 1 + SQLITE_ENABLE_SESSION = 1 SQLITE_ENABLE_SNAPSHOT = 1 SQLITE_ENABLE_STAT4 = 1 SQLITE_ENABLE_UNLOCK_NOTIFY = 1 @@ -14751,6 +14766,8 @@ const ( SQLITE_SCHEMA = 17 SQLITE_SELECT = 21 SQLITE_SERIALIZE_NOCOPY = 0x001 + SQLITE_SESSION_CONFIG_STRMSIZE = 1 + SQLITE_SESSION_OBJCONFIG_SIZE = 1 SQLITE_SET_LOCKPROXYFILE = 3 SQLITE_SHM_EXCLUSIVE = 8 SQLITE_SHM_LOCK = 2 @@ -21707,7 +21724,7 @@ type Va_list = X__builtin_va_list /* :50:27 */ // This array looks large, but in a typical installation actually uses // only a handful of compile-time options, so most times this array is usually // rather short and uses little memory space. -var sqlite3azCompileOpt = [18]uintptr{ +var sqlite3azCompileOpt = [19]uintptr{ // BEGIN CODE GENERATED BY tool/mkctime.tcl ts, /* "COMPILER=msvc-19..." */ @@ -21720,14 +21737,15 @@ var sqlite3azCompileOpt = [18]uintptr{ ts + 130, /* "ENABLE_PREUPDATE..." */ ts + 152, /* "ENABLE_RBU" */ ts + 163, /* "ENABLE_RTREE" */ - ts + 176, /* "ENABLE_SNAPSHOT" */ - ts + 192, /* "ENABLE_STAT4" */ - ts + 205, /* "ENABLE_UNLOCK_NO..." */ - ts + 226, /* "LIKE_DOESNT_MATC..." */ - ts + 250, /* "MUTEX_NOOP" */ - ts + 261, /* "SOUNDEX" */ - ts + 269, /* "SYSTEM_MALLOC" */ - ts + 283, /* "THREADSAFE=1" */ + ts + 176, /* "ENABLE_SESSION" */ + ts + 191, /* "ENABLE_SNAPSHOT" */ + ts + 207, /* "ENABLE_STAT4" */ + ts + 220, /* "ENABLE_UNLOCK_NO..." */ + ts + 241, /* "LIKE_DOESNT_MATC..." */ + ts + 265, /* "MUTEX_NOOP" */ + ts + 276, /* "SOUNDEX" */ + ts + 284, /* "SYSTEM_MALLOC" */ + ts + 298, /* "THREADSAFE=1" */ // END CODE GENERATED BY tool/mkctime.tcl } /* sqlite3.c:72:19 */ @@ -22053,7 +22071,7 @@ type X__gnuc_va_list = X__builtin_va_list /* stdarg.h:45:27 */ // of the hash might be different from [SQLITE_SOURCE_ID].)^ // // See also: [sqlite_version()] and [sqlite_source_id()]. -var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 296 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ +var Xsqlite3_version = *(*[7]int8)(unsafe.Pointer(ts + 311 /* "3.36.0" */)) /* sqlite3.c:1244:23 */ // CAPI3REF: Database Connection Handle // KEYWORDS: {database connection} {database connections} @@ -24604,6 +24622,495 @@ type Sqlite3_rtree_dbl = float64 /* sqlite3.c:11048:18 */ //******* End of sqlite3rtree.h ******** //******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type sqlite3_session = struct { + Fdb uintptr + FzDb uintptr + FbEnableSize int32 + FbEnable int32 + FbIndirect int32 + FbAutoAttach int32 + Frc int32 + _ [4]byte + FpFilterCtx uintptr + FxTableFilter uintptr + FnMalloc I64 + FnMaxChangesetSize I64 + FpZeroBlob uintptr + FpNext uintptr + FpTable uintptr + Fhook SessionHook +} /* sqlite3.c:11155:9 */ + +// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. + +//******* End of sqlite3rtree.h ******** +//******* Begin file sqlite3session.h ******** + +// Make sure we can call this stuff from C++. + +// CAPI3REF: Session Object Handle +// +// An instance of this object is a [session] that can be used to +// record changes to a database. +type Sqlite3_session = sqlite3_session /* sqlite3.c:11155:32 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type sqlite3_changeset_iter = struct { + Fin SessionInput + Ftblhdr SessionBuffer + FbPatchset int32 + FbInvert int32 + FbSkipEmpty int32 + Frc int32 + FpConflict uintptr + FzTab uintptr + FnCol int32 + Fop int32 + FbIndirect int32 + _ [4]byte + FabPK uintptr + FapValue uintptr +} /* sqlite3.c:11163:9 */ + +// CAPI3REF: Changeset Iterator Handle +// +// An instance of this object acts as a cursor for iterating +// over the elements of a [changeset] or [patchset]. +type Sqlite3_changeset_iter = sqlite3_changeset_iter /* sqlite3.c:11163:39 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type sqlite3_changegroup = struct { + Frc int32 + FbPatch int32 + FpList uintptr +} /* sqlite3.c:12015:9 */ + +// CAPI3REF: Changegroup Handle +// +// A changegroup is an object used to combine two or more +// [changesets] or [patchsets] +type Sqlite3_changegroup = sqlite3_changegroup /* sqlite3.c:12015:36 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type sqlite3_rebaser = struct{ Fgrp Sqlite3_changegroup } /* sqlite3.c:12579:9 */ + +// CAPI3REF: Flags for sqlite3changeset_apply_v2 +// +// The following flags may passed via the 9th parameter to +// [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: +// +//
+//
SQLITE_CHANGESETAPPLY_NOSAVEPOINT
+// Usually, the sessions module encloses all operations performed by +// a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The +// SAVEPOINT is committed if the changeset or patchset is successfully +// applied, or rolled back if an error occurs. Specifying this flag +// causes the sessions module to omit this savepoint. In this case, if the +// caller has an open transaction or savepoint when apply_v2() is called, +// it may revert the partially applied changeset by rolling it back. +// +//
SQLITE_CHANGESETAPPLY_INVERT
+// Invert the changeset before applying it. This is equivalent to inverting +// a changeset using sqlite3changeset_invert() before applying it. It is +// an error to specify this flag with a patchset. + +// CAPI3REF: Constants Passed To The Conflict Handler +// +// Values that may be passed as the second argument to a conflict-handler. +// +//
+//
SQLITE_CHANGESET_DATA
+// The conflict handler is invoked with CHANGESET_DATA as the second argument +// when processing a DELETE or UPDATE change if a row with the required +// PRIMARY KEY fields is present in the database, but one or more other +// (non primary-key) fields modified by the update do not contain the +// expected "before" values. +// +// The conflicting row, in this case, is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_NOTFOUND
+// The conflict handler is invoked with CHANGESET_NOTFOUND as the second +// argument when processing a DELETE or UPDATE change if a row with the +// required PRIMARY KEY fields is not present in the database. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
SQLITE_CHANGESET_CONFLICT
+// CHANGESET_CONFLICT is passed as the second argument to the conflict +// handler while processing an INSERT change if the operation would result +// in duplicate primary key values. +// +// The conflicting row in this case is the database row with the matching +// primary key. +// +//
SQLITE_CHANGESET_FOREIGN_KEY
+// If foreign key handling is enabled, and applying a changeset leaves the +// database in a state containing foreign key violations, the conflict +// handler is invoked with CHANGESET_FOREIGN_KEY as the second argument +// exactly once before the changeset is committed. If the conflict handler +// returns CHANGESET_OMIT, the changes, including those that caused the +// foreign key constraint violation, are committed. Or, if it returns +// CHANGESET_ABORT, the changeset is rolled back. +// +// No current or conflicting row information is provided. The only function +// it is possible to call on the supplied sqlite3_changeset_iter handle +// is sqlite3changeset_fk_conflicts(). +// +//
SQLITE_CHANGESET_CONSTRAINT
+// If any other constraint violation occurs while applying a change (i.e. +// a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is +// invoked with CHANGESET_CONSTRAINT as the second argument. +// +// There is no conflicting row in this case. The results of invoking the +// sqlite3changeset_conflict() API are undefined. +// +//
+ +// CAPI3REF: Constants Returned By The Conflict Handler +// +// A conflict handler callback must return one of the following three values. +// +//
+//
SQLITE_CHANGESET_OMIT
+// If a conflict handler returns this value no special action is taken. The +// change that caused the conflict is not applied. The session module +// continues to the next change in the changeset. +// +//
SQLITE_CHANGESET_REPLACE
+// This value may only be returned if the second argument to the conflict +// handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this +// is not the case, any changes applied so far are rolled back and the +// call to sqlite3changeset_apply() returns SQLITE_MISUSE. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict +// handler, then the conflicting row is either updated or deleted, depending +// on the type of change. +// +// If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict +// handler, then the conflicting row is removed from the database and a +// second attempt to apply the change is made. If this second attempt fails, +// the original row is restored to the database before continuing. +// +//
SQLITE_CHANGESET_ABORT
+// If this value is returned, any changes applied so far are rolled back +// and the call to sqlite3changeset_apply() returns SQLITE_ABORT. +//
+ +// CAPI3REF: Rebasing changesets +// EXPERIMENTAL +// +// Suppose there is a site hosting a database in state S0. And that +// modifications are made that move that database to state S1 and a +// changeset recorded (the "local" changeset). Then, a changeset based +// on S0 is received from another site (the "remote" changeset) and +// applied to the database. The database is then in state +// (S1+"remote"), where the exact state depends on any conflict +// resolution decisions (OMIT or REPLACE) made while applying "remote". +// Rebasing a changeset is to update it to take those conflict +// resolution decisions into account, so that the same conflicts +// do not have to be resolved elsewhere in the network. +// +// For example, if both the local and remote changesets contain an +// INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)": +// +// local: INSERT INTO t1 VALUES(1, 'v1'); +// remote: INSERT INTO t1 VALUES(1, 'v2'); +// +// and the conflict resolution is REPLACE, then the INSERT change is +// removed from the local changeset (it was overridden). Or, if the +// conflict resolution was "OMIT", then the local changeset is modified +// to instead contain: +// +// UPDATE t1 SET b = 'v2' WHERE a=1; +// +// Changes within the local changeset are rebased as follows: +// +//
+//
Local INSERT
+// This may only conflict with a remote INSERT. If the conflict +// resolution was OMIT, then add an UPDATE change to the rebased +// changeset. Or, if the conflict resolution was REPLACE, add +// nothing to the rebased changeset. +// +//
Local DELETE
+// This may conflict with a remote UPDATE or DELETE. In both cases the +// only possible resolution is OMIT. If the remote operation was a +// DELETE, then add no change to the rebased changeset. If the remote +// operation was an UPDATE, then the old.* fields of change are updated +// to reflect the new.* values in the UPDATE. +// +//
Local UPDATE
+// This may conflict with a remote UPDATE or DELETE. If it conflicts +// with a DELETE, and the conflict resolution was OMIT, then the update +// is changed into an INSERT. Any undefined values in the new.* record +// from the update change are filled in using the old.* values from +// the conflicting DELETE. Or, if the conflict resolution was REPLACE, +// the UPDATE change is simply omitted from the rebased changeset. +// +// If conflict is with a remote UPDATE and the resolution is OMIT, then +// the old.* values are rebased using the new.* values in the remote +// change. Or, if the resolution is REPLACE, then the change is copied +// into the rebased changeset with updates to columns also updated by +// the conflicting remote UPDATE removed. If this means no columns would +// be updated, the change is omitted. +//
+// +// A local change may be rebased against multiple remote changes +// simultaneously. If a single key is modified by multiple remote +// changesets, they are combined as follows before the local changeset +// is rebased: +// +//
    +//
  • If there has been one or more REPLACE resolutions on a +// key, it is rebased according to a REPLACE. +// +//
  • If there have been no REPLACE resolutions on a key, then +// the local changeset is rebased according to the most recent +// of the OMIT resolutions. +//
+// +// Note that conflict resolutions from multiple remote changesets are +// combined on a per-field basis, not per-row. This means that in the +// case of multiple remote UPDATE operations, some fields of a single +// local change may be rebased for REPLACE while others are rebased for +// OMIT. +// +// In order to rebase a local changeset, the remote changeset must first +// be applied to the local database using sqlite3changeset_apply_v2() and +// the buffer of rebase information captured. Then: +// +//
    +//
  1. An sqlite3_rebaser object is created by calling +// sqlite3rebaser_create(). +//
  2. The new object is configured with the rebase buffer obtained from +// sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure(). +// If the local changeset is to be rebased against multiple remote +// changesets, then sqlite3rebaser_configure() should be called +// multiple times, in the same order that the multiple +// sqlite3changeset_apply_v2() calls were made. +//
  3. Each local changeset is rebased by calling sqlite3rebaser_rebase(). +//
  4. The sqlite3_rebaser object is deleted by calling +// sqlite3rebaser_delete(). +//
+type Sqlite3_rebaser = sqlite3_rebaser /* sqlite3.c:12579:32 */ + +// CAPI3REF: Values for sqlite3session_config(). + +// Make sure we can call this stuff from C++. + //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** // 2014 May 31 @@ -24654,10 +25161,9 @@ type Fts5ExtensionApi1 = struct { FxPhraseNextColumn uintptr } /* sqlite3.c:12895:9 */ -// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. +// CAPI3REF: Values for sqlite3session_config(). -//******* End of sqlite3rtree.h ******** -//******* Begin file sqlite3session.h ******** +// Make sure we can call this stuff from C++. //******* End of sqlite3session.h ******** //******* Begin file fts5.h ******** @@ -28271,7 +28777,7 @@ var Xsqlite3WhereTrace U32 = U32(0) /* sqlite3.c:21129:20 */ var Xsqlite3OpcodeProperty = [180]uint8{ /* 0 */ uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x10) /* 8 */, uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x03) /* 16 */, uint8(0x01), uint8(0x01), uint8(0x03), uint8(0x12), uint8(0x03), uint8(0x01), uint8(0x09), uint8(0x09) /* 24 */, uint8(0x09), uint8(0x09), uint8(0x01), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09), uint8(0x09) /* 32 */, uint8(0x09), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01) /* 40 */, uint8(0x01), uint8(0x01), uint8(0x23), uint8(0x26), uint8(0x26), uint8(0x0b), uint8(0x01), uint8(0x01) /* 48 */, uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x03), uint8(0x0b), uint8(0x0b), uint8(0x0b), uint8(0x0b) /* 56 */, uint8(0x0b), uint8(0x0b), uint8(0x01), uint8(0x03), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00) /* 64 */, uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x08), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x10) /* 72 */, uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 80 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x00), uint8(0x00) /* 88 */, uint8(0x12), uint8(0x1e), uint8(0x20), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10) /* 96 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x26), uint8(0x26) /* 104 */, uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26), uint8(0x26) /* 112 */, uint8(0x00), uint8(0x12), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00) /* 120 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 128 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x04), uint8(0x04) /* 136 */, uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x10), uint8(0x00), uint8(0x00), uint8(0x10) /* 144 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x06) /* 152 */, uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x04), uint8(0x1a), uint8(0x00), uint8(0x00), uint8(0x00) /* 160 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00) /* 168 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x10), uint8(0x10), uint8(0x00), uint8(0x00) /* 176 */, uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00)} /* sqlite3.c:21138:36 */ // Name of the default collating sequence -var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 303 /* "BINARY" */)) /* sqlite3.c:21143:27 */ +var Xsqlite3StrBINARY = *(*[7]int8)(unsafe.Pointer(ts + 318 /* "BINARY" */)) /* sqlite3.c:21143:27 */ //************* End of global.c ********************************************* //************* Begin file status.c ***************************************** @@ -29172,13 +29678,13 @@ var aMx = [6]U16{U16(12), U16(14), U16(24), U16(31), U16(59), U16(9999)} /* sqli // // A missing specifier is not considered an error. func parseTimezone(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22336:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var sgn int32 - // var nHr int32 at bp+24, 4 + // var nHr int32 at bp+16, 4 - // var nMn int32 at bp+28, 4 + // var nMn int32 at bp+20, 4 var c int32 sgn = 0 @@ -29219,14 +29725,14 @@ __6: __4: ; zDate++ - if !(getDigits(tls, zDate, ts+310 /* "20b:20e" */, libc.VaList(bp, bp+24 /* &nHr */, bp+28 /* &nMn */)) != 2) { + if !(getDigits(tls, zDate, ts+325 /* "20b:20e" */, libc.VaList(bp, bp+16 /* &nHr */, bp+20 /* &nMn */)) != 2) { goto __9 } return 1 __9: ; zDate += uintptr(5) - (*DateTime)(unsafe.Pointer(p)).Ftz = (sgn * (*(*int32)(unsafe.Pointer(bp + 28 /* nMn */)) + (*(*int32)(unsafe.Pointer(bp + 24 /* nHr */)) * 60))) + (*DateTime)(unsafe.Pointer(p)).Ftz = (sgn * (*(*int32)(unsafe.Pointer(bp + 20 /* nMn */)) + (*(*int32)(unsafe.Pointer(bp + 16 /* nHr */)) * 60))) zulu_time: __10: if !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zDate)))]) & 0x01) != 0) { @@ -29246,23 +29752,23 @@ __11: // // Return 1 if there is a parsing error and 0 on success. func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22372:12: */ - bp := tls.Alloc(52) - defer tls.Free(52) + bp := tls.Alloc(36) + defer tls.Free(36) - // var h int32 at bp+40, 4 + // var h int32 at bp+24, 4 - // var m int32 at bp+44, 4 + // var m int32 at bp+28, 4 - // var s int32 at bp+48, 4 + // var s int32 at bp+32, 4 var ms float64 = 0.0 - if getDigits(tls, zDate, ts+318 /* "20c:20e" */, libc.VaList(bp, bp+40 /* &h */, bp+44 /* &m */)) != 2 { + if getDigits(tls, zDate, ts+333 /* "20c:20e" */, libc.VaList(bp, bp+24 /* &h */, bp+28 /* &m */)) != 2 { return 1 } zDate += uintptr(5) if int32(*(*int8)(unsafe.Pointer(zDate))) == ':' { zDate++ - if getDigits(tls, zDate, ts+326 /* "20e" */, libc.VaList(bp+24, bp+48 /* &s */)) != 1 { + if getDigits(tls, zDate, ts+341 /* "20e" */, libc.VaList(bp+16, bp+32 /* &s */)) != 1 { return 1 } zDate += uintptr(2) @@ -29277,14 +29783,14 @@ func parseHhMmSs(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:2 ms = ms / (rScale) } } else { - *(*int32)(unsafe.Pointer(bp + 48 /* s */)) = 0 + *(*int32)(unsafe.Pointer(bp + 32 /* s */)) = 0 } (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidHMS = int8(1) - (*DateTime)(unsafe.Pointer(p)).Fh = *(*int32)(unsafe.Pointer(bp + 40 /* h */)) - (*DateTime)(unsafe.Pointer(p)).Fm = *(*int32)(unsafe.Pointer(bp + 44 /* m */)) - (*DateTime)(unsafe.Pointer(p)).Fs = (float64(*(*int32)(unsafe.Pointer(bp + 48 /* s */))) + ms) + (*DateTime)(unsafe.Pointer(p)).Fh = *(*int32)(unsafe.Pointer(bp + 24 /* h */)) + (*DateTime)(unsafe.Pointer(p)).Fm = *(*int32)(unsafe.Pointer(bp + 28 /* m */)) + (*DateTime)(unsafe.Pointer(p)).Fs = (float64(*(*int32)(unsafe.Pointer(bp + 32 /* s */))) + ms) if parseTimezone(tls, zDate, p) != 0 { return 1 } @@ -29364,14 +29870,14 @@ func computeJD(tls *libc.TLS, p uintptr) { /* sqlite3.c:22423:13: */ // on success and 1 if the input string is not a well-formed // date. func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c:22473:12: */ - bp := tls.Alloc(44) - defer tls.Free(44) + bp := tls.Alloc(36) + defer tls.Free(36) - // var Y int32 at bp+32, 4 + // var Y int32 at bp+24, 4 - // var M int32 at bp+36, 4 + // var M int32 at bp+28, 4 - // var D int32 at bp+40, 4 + // var D int32 at bp+32, 4 var neg int32 @@ -29381,7 +29887,7 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c } else { neg = 0 } - if getDigits(tls, zDate, ts+330 /* "40f-21a-21d" */, libc.VaList(bp, bp+32 /* &Y */, bp+36 /* &M */, bp+40 /* &D */)) != 3 { + if getDigits(tls, zDate, ts+345 /* "40f-21a-21d" */, libc.VaList(bp, bp+24 /* &Y */, bp+28 /* &M */, bp+32 /* &D */)) != 3 { return 1 } zDate += uintptr(10) @@ -29399,12 +29905,12 @@ func parseYyyyMmDd(tls *libc.TLS, zDate uintptr, p uintptr) int32 { /* sqlite3.c (*DateTime)(unsafe.Pointer(p)).FvalidYMD = int8(1) (*DateTime)(unsafe.Pointer(p)).FY = func() int32 { if neg != 0 { - return -*(*int32)(unsafe.Pointer(bp + 32 /* Y */)) + return -*(*int32)(unsafe.Pointer(bp + 24 /* Y */)) } - return *(*int32)(unsafe.Pointer(bp + 32 /* Y */)) + return *(*int32)(unsafe.Pointer(bp + 24 /* Y */)) }() - (*DateTime)(unsafe.Pointer(p)).FM = *(*int32)(unsafe.Pointer(bp + 36 /* M */)) - (*DateTime)(unsafe.Pointer(p)).FD = *(*int32)(unsafe.Pointer(bp + 40 /* D */)) + (*DateTime)(unsafe.Pointer(p)).FM = *(*int32)(unsafe.Pointer(bp + 28 /* M */)) + (*DateTime)(unsafe.Pointer(p)).FD = *(*int32)(unsafe.Pointer(bp + 32 /* D */)) if (*DateTime)(unsafe.Pointer(p)).FvalidTZ != 0 { computeJD(tls, p) } @@ -29462,7 +29968,7 @@ func parseDateOrTime(tls *libc.TLS, context uintptr, zDate uintptr, p uintptr) i return 0 } else if parseHhMmSs(tls, zDate, p) == 0 { return 0 - } else if (Xsqlite3StrICmp(tls, zDate, ts+342 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { + } else if (Xsqlite3StrICmp(tls, zDate, ts+357 /* "now" */) == 0) && (Xsqlite3NotPureFunc(tls, context) != 0) { return setDateTimeToCurrent(tls, context, p) } else if Xsqlite3AtoF(tls, zDate, bp /* &r */, Xsqlite3Strlen30(tls, zDate), uint8(SQLITE_UTF8)) > 0 { setRawDateNumber(tls, p, *(*float64)(unsafe.Pointer(bp /* r */))) @@ -29644,7 +30150,7 @@ func localtimeOffset(tls *libc.TLS, p uintptr, pCtx uintptr, pRc uintptr) Sqlite computeJD(tls, bp+40 /* &x */) *(*Time_t)(unsafe.Pointer(bp + 88 /* t */)) = (((*DateTime)(unsafe.Pointer(bp+40 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000))) if osLocaltime(tls, bp+88 /* &t */, bp /* &sLocal */) != 0 { - Xsqlite3_result_error(tls, pCtx, ts+346 /* "local time unava..." */, -1) + Xsqlite3_result_error(tls, pCtx, ts+361 /* "local time unava..." */, -1) *(*int32)(unsafe.Pointer(pRc)) = SQLITE_ERROR return int64(0) } @@ -29679,12 +30185,12 @@ var aXformType = [6]struct { FrLimit float64 FrXform float64 }{ - {FnName: U8(6), FzName: ts + 369 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, - {FnName: U8(6), FzName: ts + 376 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, - {FnName: U8(4), FzName: ts + 383 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, - {FnName: U8(3), FzName: ts + 388 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, - {FeType: U8(1), FnName: U8(5), FzName: ts + 392 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, - {FeType: U8(2), FnName: U8(4), FzName: ts + 398 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, + {FnName: U8(6), FzName: ts + 384 /* "second" */, FrLimit: 464269060800.0, FrXform: 1000.0}, + {FnName: U8(6), FzName: ts + 391 /* "minute" */, FrLimit: 7737817680.0, FrXform: 60000.0}, + {FnName: U8(4), FzName: ts + 398 /* "hour" */, FrLimit: 128963628.0, FrXform: 3600000.0}, + {FnName: U8(3), FzName: ts + 403 /* "day" */, FrLimit: 5373485.0, FrXform: 86400000.0}, + {FeType: U8(1), FnName: U8(5), FzName: ts + 407 /* "month" */, FrLimit: 176546.0, FrXform: 2592000000.0}, + {FeType: U8(2), FnName: U8(4), FzName: ts + 413 /* "year" */, FrLimit: 14713.0, FrXform: 31536000000.0}, } /* sqlite3.c:22795:3 */ // Process a modifier to a date-time stamp. The modifiers are @@ -29723,7 +30229,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Assuming the current time value is UTC (a.k.a. GMT), shift it to // show local time. - if (Xsqlite3_stricmp(tls, z, ts+403 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + if (Xsqlite3_stricmp(tls, z, ts+418 /* "localtime" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { computeJD(tls, p) *(*Sqlite3_int64)(unsafe.Pointer(p /* &.iJD */)) += (localtimeOffset(tls, p, pCtx, bp /* &rc */)) clearYMD_HMS_TZ(tls, p) @@ -29737,7 +30243,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Treat the current value of p->s as the number of // seconds since 1970. Convert to a real julian day number. - if (Xsqlite3_stricmp(tls, z, ts+413 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { + if (Xsqlite3_stricmp(tls, z, ts+428 /* "unixepoch" */) == 0) && ((*DateTime)(unsafe.Pointer(p)).FrawS != 0) { *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = (((*DateTime)(unsafe.Pointer(p)).Fs * 1000.0) + 210866760000000.0) if (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) >= 0.0) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < 464269060800000.0) { clearYMD_HMS_TZ(tls, p) @@ -29746,7 +30252,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } - } else if (Xsqlite3_stricmp(tls, z, ts+423 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { + } else if (Xsqlite3_stricmp(tls, z, ts+438 /* "utc" */) == 0) && (Xsqlite3NotPureFunc(tls, pCtx) != 0) { if int32((*DateTime)(unsafe.Pointer(p)).FtzSet) == 0 { var c1 Sqlite3_int64 computeJD(tls, p) @@ -29771,7 +30277,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // Move the date to the same time on the next occurrence of // weekday N where 0==Sunday, 1==Monday, and so forth. If the // date is already on the appropriate weekday, this is a no-op. - if ((((Xsqlite3_strnicmp(tls, z, ts+427 /* "weekday " */, 8) == 0) && + if ((((Xsqlite3_strnicmp(tls, z, ts+442 /* "weekday " */, 8) == 0) && (Xsqlite3AtoF(tls, (z+8), bp+8 /* &r */, Xsqlite3Strlen30(tls, (z+8)), uint8(SQLITE_UTF8)) > 0)) && ((float64(libc.AssignInt32(&n, int32(*(*float64)(unsafe.Pointer(bp + 8 /* r */)))))) == *(*float64)(unsafe.Pointer(bp + 8 /* r */)))) && (n >= 0)) && (*(*float64)(unsafe.Pointer(bp + 8 /* r */)) < float64(7)) { var Z Sqlite3_int64 @@ -29796,7 +30302,7 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i // // Move the date backwards to the beginning of the current day, // or month or year. - if Xsqlite3_strnicmp(tls, z, ts+436 /* "start of " */, 9) != 0 { + if Xsqlite3_strnicmp(tls, z, ts+451 /* "start of " */, 9) != 0 { break } if (!(int32((*DateTime)(unsafe.Pointer(p)).FvalidJD) != 0) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidYMD) != 0)) && !(int32((*DateTime)(unsafe.Pointer(p)).FvalidHMS) != 0) { @@ -29810,14 +30316,14 @@ func parseModifier(tls *libc.TLS, pCtx uintptr, z uintptr, n int32, p uintptr) i (*DateTime)(unsafe.Pointer(p)).FrawS = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidTZ = int8(0) (*DateTime)(unsafe.Pointer(p)).FvalidJD = int8(0) - if Xsqlite3_stricmp(tls, z, ts+392 /* "month" */) == 0 { + if Xsqlite3_stricmp(tls, z, ts+407 /* "month" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+398 /* "year" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+413 /* "year" */) == 0 { (*DateTime)(unsafe.Pointer(p)).FM = 1 (*DateTime)(unsafe.Pointer(p)).FD = 1 *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 - } else if Xsqlite3_stricmp(tls, z, ts+388 /* "day" */) == 0 { + } else if Xsqlite3_stricmp(tls, z, ts+403 /* "day" */) == 0 { *(*int32)(unsafe.Pointer(bp /* rc */)) = 0 } break @@ -30029,18 +30535,18 @@ func juliandayFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { / // // Return YYYY-MM-DD HH:MM:SS func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23106:13: */ - bp := tls.Alloc(204) - defer tls.Free(204) + bp := tls.Alloc(196) + defer tls.Free(196) - // var x DateTime at bp+56, 48 + // var x DateTime at bp+48, 48 - if isDate(tls, context, argc, argv, bp+56 /* &x */) == 0 { - // var zBuf [100]int8 at bp+104, 100 + if isDate(tls, context, argc, argv, bp+48 /* &x */) == 0 { + // var zBuf [100]int8 at bp+96, 100 - computeYMD_HMS(tls, bp+56 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+104 /* &zBuf[0] */, ts+446, /* "%04d-%02d-%02d %..." */ - libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+56 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+56 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+56 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+56 /* &x */)).Fs))) - Xsqlite3_result_text(tls, context, bp+104 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + computeYMD_HMS(tls, bp+48 /* &x */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+96 /* &zBuf[0] */, ts+461, /* "%04d-%02d-%02d %..." */ + libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).FD, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+48 /* &x */)).Fs))) + Xsqlite3_result_text(tls, context, bp+96 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -30048,17 +30554,17 @@ func datetimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* // // Return HH:MM:SS func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23126:13: */ - bp := tls.Alloc(180) - defer tls.Free(180) + bp := tls.Alloc(172) + defer tls.Free(172) - // var x DateTime at bp+32, 48 + // var x DateTime at bp+24, 48 - if isDate(tls, context, argc, argv, bp+32 /* &x */) == 0 { - // var zBuf [100]int8 at bp+80, 100 + if isDate(tls, context, argc, argv, bp+24 /* &x */) == 0 { + // var zBuf [100]int8 at bp+72, 100 - computeHMS(tls, bp+32 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+80 /* &zBuf[0] */, ts+476 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+32 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+32 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+32 /* &x */)).Fs))) - Xsqlite3_result_text(tls, context, bp+80 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + computeHMS(tls, bp+24 /* &x */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+491 /* "%02d:%02d:%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fh, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fm, int32((*DateTime)(unsafe.Pointer(bp+24 /* &x */)).Fs))) + Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -30066,17 +30572,17 @@ func timeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // // Return YYYY-MM-DD func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23145:13: */ - bp := tls.Alloc(180) - defer tls.Free(180) + bp := tls.Alloc(172) + defer tls.Free(172) - // var x DateTime at bp+32, 48 + // var x DateTime at bp+24, 48 - if isDate(tls, context, argc, argv, bp+32 /* &x */) == 0 { - // var zBuf [100]int8 at bp+80, 100 + if isDate(tls, context, argc, argv, bp+24 /* &x */) == 0 { + // var zBuf [100]int8 at bp+72, 100 - computeYMD(tls, bp+32 /* &x */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+80 /* &zBuf[0] */, ts+491 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+32 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+32 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+32 /* &x */)).FD)) - Xsqlite3_result_text(tls, context, bp+80 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + computeYMD(tls, bp+24 /* &x */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+506 /* "%04d-%02d-%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FY, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FM, (*DateTime)(unsafe.Pointer(bp+24 /* &x */)).FD)) + Xsqlite3_result_text(tls, context, bp+72 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) } } @@ -30098,10 +30604,10 @@ func dateFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql // %Y year 0000-9999 // %% % func strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:23178:13: */ - bp := tls.Alloc(360) - defer tls.Free(360) + bp := tls.Alloc(280) + defer tls.Free(280) - // var x DateTime at bp+160, 48 + // var x DateTime at bp+80, 48 var n U64 var i Size_t @@ -30109,13 +30615,13 @@ func strftimeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* var z uintptr var db uintptr var zFmt uintptr - // var zBuf [100]int8 at bp+208, 100 + // var zBuf [100]int8 at bp+128, 100 if argc == 0 { return } zFmt = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) - if (zFmt == uintptr(0)) || (isDate(tls, context, (argc-1), (argv+uintptr(1)*8), bp+160 /* &x */) != 0) { + if (zFmt == uintptr(0)) || (isDate(tls, context, (argc-1), (argv+uintptr(1)*8), bp+80 /* &x */) != 0) { return } db = Xsqlite3_context_db_handle(tls, context) @@ -30182,7 +30688,7 @@ __3: ; if n < U64(unsafe.Sizeof([100]int8{})) { - z = bp + 208 /* &zBuf[0] */ + z = bp + 128 /* &zBuf[0] */ } else if n > U64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) { Xsqlite3_result_error_toobig(tls, context) return @@ -30193,8 +30699,8 @@ __3: return } } - computeJD(tls, bp+160 /* &x */) - computeYMD_HMS(tls, bp+160 /* &x */) + computeJD(tls, bp+80 /* &x */) + computeYMD_HMS(tls, bp+80 /* &x */) for i = libc.AssignUint64(&j, uint64(0)); *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) != 0; i++ { if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) != '%' { *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncUint64(&j, 1)))) = *(*int8)(unsafe.Pointer(zFmt + uintptr(i))) @@ -30202,24 +30708,24 @@ __3: i++ switch int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) { case 'd': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FD)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FD)) j = j + (uint64(2)) break fallthrough case 'f': { - var s float64 = (*DateTime)(unsafe.Pointer(bp + 160 /* &x */)).Fs + var s float64 = (*DateTime)(unsafe.Pointer(bp + 80 /* &x */)).Fs if s > 59.999 { s = 59.999 } - Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+511 /* "%06.3f" */, libc.VaList(bp+16, s)) + Xsqlite3_snprintf(tls, 7, (z + uintptr(j)), ts+526 /* "%06.3f" */, libc.VaList(bp+8, s)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'H': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+32, (*DateTime)(unsafe.Pointer(bp+160 /* &x */)).Fh)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+16, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fh)) j = j + (uint64(2)) break fallthrough @@ -30228,19 +30734,19 @@ __3: case 'j': { var nDay int32 // Number of days since 1st day of year - *(*DateTime)(unsafe.Pointer(bp + 312 /* y */)) = *(*DateTime)(unsafe.Pointer(bp + 160 /* x */)) - (*DateTime)(unsafe.Pointer(bp + 312 /* &y */)).FvalidJD = int8(0) - (*DateTime)(unsafe.Pointer(bp + 312 /* &y */)).FM = 1 - (*DateTime)(unsafe.Pointer(bp + 312 /* &y */)).FD = 1 - computeJD(tls, bp+312 /* &y */) - nDay = (int32((((*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FiJD - (*DateTime)(unsafe.Pointer(bp+312 /* &y */)).FiJD) + int64(43200000)) / int64(86400000))) + *(*DateTime)(unsafe.Pointer(bp + 232 /* y */)) = *(*DateTime)(unsafe.Pointer(bp + 80 /* x */)) + (*DateTime)(unsafe.Pointer(bp + 232 /* &y */)).FvalidJD = int8(0) + (*DateTime)(unsafe.Pointer(bp + 232 /* &y */)).FM = 1 + (*DateTime)(unsafe.Pointer(bp + 232 /* &y */)).FD = 1 + computeJD(tls, bp+232 /* &y */) + nDay = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD - (*DateTime)(unsafe.Pointer(bp+232 /* &y */)).FiJD) + int64(43200000)) / int64(86400000))) if int32(*(*int8)(unsafe.Pointer(zFmt + uintptr(i)))) == 'W' { var wd int32 // 0=Monday, 1=Tuesday, ... 6=Sunday - wd = (int32((((*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+48, (((nDay+7)-wd)/7))) + wd = (int32((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(43200000)) / int64(86400000)) % int64(7))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+24, (((nDay+7)-wd)/7))) j = j + (uint64(2)) } else { - Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+518 /* "%03d" */, libc.VaList(bp+64, (nDay+1))) + Xsqlite3_snprintf(tls, 4, (z + uintptr(j)), ts+533 /* "%03d" */, libc.VaList(bp+32, (nDay+1))) j = j + (uint64(3)) } break @@ -30249,25 +30755,25 @@ __3: fallthrough case 'J': { - Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+523 /* "%.16g" */, libc.VaList(bp+80, (float64((*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FiJD)/86400000.0))) + Xsqlite3_snprintf(tls, 20, (z + uintptr(j)), ts+538 /* "%.16g" */, libc.VaList(bp+40, (float64((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD)/86400000.0))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break } fallthrough case 'm': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+96, (*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FM)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+48, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FM)) j = j + (uint64(2)) break fallthrough case 'M': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+112, (*DateTime)(unsafe.Pointer(bp+160 /* &x */)).Fm)) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+56, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fm)) j = j + (uint64(2)) break fallthrough case 's': { - var iS I64 = (((*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000))) + var iS I64 = (((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD / int64(1000)) - (int64(21086676) * int64(10000))) Xsqlite3Int64ToText(tls, iS, (z + uintptr(j))) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -30275,20 +30781,20 @@ __3: } fallthrough case 'S': - Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+506 /* "%02d" */, libc.VaList(bp+128, int32((*DateTime)(unsafe.Pointer(bp+160 /* &x */)).Fs))) + Xsqlite3_snprintf(tls, 3, (z + uintptr(j)), ts+521 /* "%02d" */, libc.VaList(bp+64, int32((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).Fs))) j = j + (uint64(2)) break fallthrough case 'w': { - *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncUint64(&j, 1)))) = (int8(int32((int8((((*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FiJD + int64(129600000)) / int64(86400000)) % int64(7)))) + '0')) + *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncUint64(&j, 1)))) = (int8(int32((int8((((*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FiJD + int64(129600000)) / int64(86400000)) % int64(7)))) + '0')) break } fallthrough case 'Y': { - Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+529 /* "%04d" */, libc.VaList(bp+144, (*DateTime)(unsafe.Pointer(bp+160 /* &x */)).FY)) + Xsqlite3_snprintf(tls, 5, (z + uintptr(j)), ts+544 /* "%04d" */, libc.VaList(bp+72, (*DateTime)(unsafe.Pointer(bp+80 /* &x */)).FY)) j = j + (Size_t(Xsqlite3Strlen30(tls, (z + uintptr(j))))) break @@ -30303,7 +30809,7 @@ __3: *(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0) Xsqlite3_result_text(tls, context, z, -1, func() uintptr { - if z == bp+208 /* zBuf */ { + if z == bp+128 /* zBuf */ { return libc.UintptrFromInt32(-1) } return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault})) @@ -30345,14 +30851,14 @@ func Xsqlite3RegisterDateTimeFunctions(tls *libc.TLS) { /* sqlite3.c:23404:21: * } var aDateTimeFuncs = [8]FuncDef{ - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 534 /* "julianday" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 544 /* "date" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "time" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 554 /* "datetime" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 563 /* "strftime" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 572 /* "current_time" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 585 /* "current_timestam..." */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 603 /* "current_date" */}} /* sqlite3.c:23405:18 */ + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 549 /* "julianday" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 559 /* "date" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 564 /* "time" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 569 /* "datetime" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_SLOCHNG | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FpUserData: 0, FxSFunc: 0, FzName: ts + 578 /* "strftime" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 587 /* "current_time" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 600 /* "current_timestam..." */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 618 /* "current_date" */}} /* sqlite3.c:23405:18 */ //************* End of date.c *********************************************** //************* Begin file os.c ********************************************* @@ -30922,15 +31428,15 @@ func Xsqlite3EndBenignMalloc(tls *libc.TLS) { /* sqlite3.c:23948:21: */ // cases of nByte<=0 will be intercepted and dealt with by higher level // routines. func sqlite3MemMalloc(tls *libc.TLS, nByte int32) uintptr { /* sqlite3.c:24148:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var p uintptr p = libc.Xmalloc(tls, uint64(nByte)) if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_NOMEM, ts+616 /* "failed to alloca..." */, libc.VaList(bp, nByte)) + Xsqlite3_log(tls, SQLITE_NOMEM, ts+631 /* "failed to alloca..." */, libc.VaList(bp, nByte)) } return p } @@ -30961,14 +31467,14 @@ func sqlite3MemSize(tls *libc.TLS, pPrior uintptr) int32 { /* sqlite3.c:24197:12 // cases where nByte<=0 will have been intercepted by higher-level // routines and redirected to xFree. func sqlite3MemRealloc(tls *libc.TLS, pPrior uintptr, nByte int32) uintptr { /* sqlite3.c:24220:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var p uintptr = libc.Xrealloc(tls, pPrior, uint64(nByte)) if p == uintptr(0) { Xsqlite3_log(tls, SQLITE_NOMEM, - ts+654, /* "failed memory re..." */ + ts+669, /* "failed memory re..." */ libc.VaList(bp, libc.X_msize(tls, pPrior), nByte)) } return p @@ -30996,8 +31502,8 @@ func sqlite3MemShutdown(tls *libc.TLS, NotUsed uintptr) { /* sqlite3.c:24286:13: // Populate the low-level memory allocation function pointers in // sqlite3GlobalConfig.m with pointers to the routines in this file. func Xsqlite3MemSetDefault(tls *libc.TLS) { /* sqlite3.c:24297:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp, uintptr(unsafe.Pointer(&defaultMethods)))) } @@ -62690,8 +63196,8 @@ type Et_info = et_info /* sqlite3.c:28672:3 */ // The following table is searched linearly, so it is good to put the // most frequently used conversion types first. -var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 690 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ -var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 723 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ +var aDigits = *(*[33]int8)(unsafe.Pointer(ts + 705 /* "0123456789ABCDEF..." */)) /* sqlite3.c:28685:19 */ +var aPrefix = *(*[7]int8)(unsafe.Pointer(ts + 738 /* "-x0\x00X0" */)) /* sqlite3.c:28686:19 */ var fmtinfo = [23]Et_info{ {Ffmttype: int8('d'), Fbase: EtByte(10), Fflags: EtByte(1), Ftype: EtByte(EtDECIMAL)}, {Ffmttype: int8('s'), Fflags: EtByte(4), Ftype: EtByte(EtSTRING)}, @@ -62822,8 +63328,8 @@ func printfTempBuf(tls *libc.TLS, pAccum uintptr, n Sqlite3_int64) uintptr { /* // Render a string given by "fmt" into the StrAccum object. func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Va_list) { /* sqlite3.c:28828:17: */ - bp := tls.Alloc(116) - defer tls.Free(116) + bp := tls.Alloc(108) + defer tls.Free(108) var c int32 // Next character in the format string var bufpt uintptr // Pointer to the conversion buffer @@ -62843,7 +63349,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Va_lis var bArgList U8 // True for SQLITE_PRINTF_SQLFUNC var prefix int8 // Prefix character. "+" or "-" or " " or '\0'. var longvalue Sqlite_uint64 // Value for integer types - // var realvalue float64 at bp+104, 8 + // var realvalue float64 at bp+96, 8 // Value for real types var infop uintptr // Pointer to the appropriate info structure var zOut uintptr // Rendering buffer @@ -62851,13 +63357,13 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Va_lis var zExtra uintptr // Malloced memory used by some conversion var exp int32 var e2 int32 // exponent of real numbers - // var nsd int32 at bp+112, 4 + // var nsd int32 at bp+104, 4 // Number of significant digits returned var rounder float64 // Used for rounding floating point values var flag_dp EtByte // True if decimal point should be shown var flag_rtz EtByte // True if trailing zeros should be removed var pArgList uintptr // Arguments for SQLITE_PRINTF_SQLFUNC - // var buf [70]int8 at bp+16, 70 + // var buf [70]int8 at bp+8, 70 var wx uint32 var px uint32 @@ -62870,9 +63376,9 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Va_lis var ix int32 // Add "0" or "0x" var pre uintptr var x1 int8 - // var rx float64 at bp+96, 8 + // var rx float64 at bp+88, 8 - // var u Sqlite3_uint64 at bp+88, 8 + // var u Sqlite3_uint64 at bp+80, 8 var ex int32 var scale float64 @@ -62945,7 +63451,7 @@ __6: if !((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PreIncUintptr(&fmt, 1)))))) == 0) { goto __11 } - Xsqlite3_str_append(tls, pAccum, ts+730 /* "%" */, 1) + Xsqlite3_str_append(tls, pAccum, ts+745 /* "%" */, 1) goto __5 __11: ; @@ -63340,7 +63846,7 @@ __94: goto __95 } nOut = SQLITE_PRINT_BUF_SIZE - zOut = bp + 16 /* &buf[0] */ + zOut = bp + 8 /* &buf[0] */ goto __96 __95: n = (U64(precision) + uint64(10)) @@ -63462,10 +63968,10 @@ __65: if !(bArgList != 0) { goto __116 } - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) = getDoubleArg(tls, pArgList) + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) = getDoubleArg(tls, pArgList) goto __117 __116: - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) = float64(libc.VaFloat64(&ap)) + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) = float64(libc.VaFloat64(&ap)) __117: ; if !(precision < 0) { @@ -63480,10 +63986,10 @@ __118: precision = SQLITE_FP_PRECISION_LIMIT __119: ; - if !(*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) < 0.0) { + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) < 0.0) { goto __120 } - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) = -*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) = -*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) prefix = int8('-') goto __121 __120: @@ -63511,34 +64017,34 @@ __124: if !(int32(xtype) == EtFLOAT) { goto __125 } - *(*float64)(unsafe.Pointer(bp + 96 /* rx */)) = *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) - libc.Xmemcpy(tls, bp+88 /* &u */, bp+96 /* &rx */, uint64(unsafe.Sizeof(Sqlite3_uint64(0)))) - ex = (-1023 + (int32((*(*Sqlite3_uint64)(unsafe.Pointer(bp + 88 /* u */)) >> 52) & uint64(0x7ff)))) + *(*float64)(unsafe.Pointer(bp + 88 /* rx */)) = *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) + libc.Xmemcpy(tls, bp+80 /* &u */, bp+88 /* &rx */, uint64(unsafe.Sizeof(Sqlite3_uint64(0)))) + ex = (-1023 + (int32((*(*Sqlite3_uint64)(unsafe.Pointer(bp + 80 /* u */)) >> 52) & uint64(0x7ff)))) if !((precision + (ex / 3)) < 15) { goto __126 } - rounder = rounder + (*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) * 3e-16) + rounder = rounder + (*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) * 3e-16) __126: ; - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) += rounder + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) += rounder __125: ; // Normalize realvalue to within 10.0 > realvalue >= 1.0 exp = 0 - if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */))) != 0) { + if !(Xsqlite3IsNaN(tls, *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */))) != 0) { goto __127 } - bufpt = ts + 732 /* "NaN" */ + bufpt = ts + 747 /* "NaN" */ length = 3 goto __58 __127: ; - if !(*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) > 0.0) { + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) > 0.0) { goto __128 } scale = 1.0 __129: - if !((*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) >= (1e100 * scale)) && (exp <= 350)) { + if !((*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= (1e100 * scale)) && (exp <= 350)) { goto __130 } scale = scale * (1e100) @@ -63547,7 +64053,7 @@ __129: __130: ; __131: - if !((*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) >= (1e10 * scale)) && (exp <= 350)) { + if !((*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= (1e10 * scale)) && (exp <= 350)) { goto __132 } scale = scale * (1e10) @@ -63556,7 +64062,7 @@ __131: __132: ; __133: - if !((*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) >= (10.0 * scale)) && (exp <= 350)) { + if !((*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= (10.0 * scale)) && (exp <= 350)) { goto __134 } scale = scale * (10.0) @@ -63564,21 +64070,21 @@ __133: goto __133 __134: ; - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) /= scale + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) /= scale __135: - if !(*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) < 1e-8) { + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) < 1e-8) { goto __136 } - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) *= 1e8 + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) *= 1e8 exp = exp - (8) goto __135 __136: ; __137: - if !(*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) < 1.0) { + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) < 1.0) { goto __138 } - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) *= 10.0 + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) *= 10.0 exp-- goto __137 __138: @@ -63586,26 +64092,26 @@ __138: if !(exp > 350) { goto __139 } - bufpt = bp + 16 /* &buf[0] */ - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = prefix - libc.Xmemcpy(tls, (bp + 16 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+736 /* "Inf" */, uint64(4)) + bufpt = bp + 8 /* &buf[0] */ + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = prefix + libc.Xmemcpy(tls, (bp + 8 /* &buf[0] */ + uintptr((libc.Bool32(int32(prefix) != 0)))), ts+751 /* "Inf" */, uint64(4)) length = (3 + (libc.Bool32(int32(prefix) != 0))) goto __58 __139: ; __128: ; - bufpt = bp + 16 /* &buf[0] */ + bufpt = bp + 8 /* &buf[0] */ // If the field type is etGENERIC, then convert to either etEXP // or etFLOAT, as appropriate. if !(int32(xtype) != EtFLOAT) { goto __140 } - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) += rounder - if !(*(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) >= 10.0) { + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) += rounder + if !(*(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) >= 10.0) { goto __141 } - *(*float64)(unsafe.Pointer(bp + 104 /* realvalue */)) *= 0.1 + *(*float64)(unsafe.Pointer(bp + 96 /* realvalue */)) *= 0.1 exp++ __141: ; @@ -63660,7 +64166,7 @@ __148: ; zOut = bufpt - *(*int32)(unsafe.Pointer(bp + 112 /* nsd */)) = (16 + (int32(flag_altform2) * 10)) + *(*int32)(unsafe.Pointer(bp + 104 /* nsd */)) = (16 + (int32(flag_altform2) * 10)) flag_dp = (EtByte(((func() int32 { if precision > 0 { return 1 @@ -63686,7 +64192,7 @@ __153: if !(e2 >= 0) { goto __155 } - *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = et_getdigit(tls, bp+104 /* &realvalue */, bp+112 /* &nsd */) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = et_getdigit(tls, bp+96 /* &realvalue */, bp+104 /* &nsd */) goto __154 __154: e2-- @@ -63725,7 +64231,7 @@ __160: if !((libc.PostDecInt32(&precision, 1)) > 0) { goto __161 } - *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = et_getdigit(tls, bp+104 /* &realvalue */, bp+112 /* &nsd */) + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) = et_getdigit(tls, bp+96 /* &realvalue */, bp+104 /* &nsd */) goto __160 __161: ; @@ -63834,8 +64340,8 @@ __178: length = libc.AssignInt32(&width, 0) goto __58 __67: - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = int8('%') - bufpt = bp + 16 /* &buf[0] */ + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = int8('%') + bufpt = bp + 8 /* &buf[0] */ length = 1 goto __58 __68: @@ -63847,7 +64353,7 @@ __68: if !(bufpt != 0) { goto __181 } - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = int8(libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = int8(libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1)))))) if !((c & 0xc0) == 0xc0) { goto __183 } @@ -63855,7 +64361,7 @@ __184: if !((length < 4) && ((int32(*(*int8)(unsafe.Pointer(bufpt))) & 0xc0) == 0x80)) { goto __185 } - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + uintptr(libc.PostIncInt32(&length, 1)))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + uintptr(libc.PostIncInt32(&length, 1)))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&bufpt, 1))) goto __184 __185: ; @@ -63863,7 +64369,7 @@ __183: ; goto __182 __181: - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = int8(0) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = int8(0) __182: ; goto __180 @@ -63872,31 +64378,31 @@ __179: if !(ch < uint32(0x00080)) { goto __186 } - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = (int8(ch & uint32(0xff))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(ch & uint32(0xff))) length = 1 goto __187 __186: if !(ch < uint32(0x00800)) { goto __188 } - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = (int8(0xc0 + int32((U8((ch >> 6) & uint32(0x1f)))))) - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(0xc0 + int32((U8((ch >> 6) & uint32(0x1f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) length = 2 goto __189 __188: if !(ch < uint32(0x10000)) { goto __190 } - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = (int8(0xe0 + int32((U8((ch >> 12) & uint32(0x0f)))))) - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8((ch >> 6) & uint32(0x3f)))))) - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + 2)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(0xe0 + int32((U8((ch >> 12) & uint32(0x0f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8((ch >> 6) & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 2)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) length = 3 goto __191 __190: - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */)) = (int8(0xf0 + int32((U8((ch >> 18) & uint32(0x07)))))) - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8((ch >> 12) & uint32(0x3f)))))) - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + 2)) = (int8(0x80 + int32((U8((ch >> 6) & uint32(0x3f)))))) - *(*int8)(unsafe.Pointer(bp + 16 /* &buf[0] */ + 3)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */)) = (int8(0xf0 + int32((U8((ch >> 18) & uint32(0x07)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 1)) = (int8(0x80 + int32((U8((ch >> 12) & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 2)) = (int8(0x80 + int32((U8((ch >> 6) & uint32(0x3f)))))) + *(*int8)(unsafe.Pointer(bp + 8 /* &buf[0] */ + 3)) = (int8(0x80 + int32((U8(ch & uint32(0x3f)))))) length = 4 __191: ; @@ -63921,13 +64427,13 @@ __194: if !(libc.PostDecInt32(&precision, 1) > 1) { goto __195 } - Xsqlite3_str_append(tls, pAccum, bp+16 /* &buf[0] */, length) + Xsqlite3_str_append(tls, pAccum, bp+8 /* &buf[0] */, length) goto __194 __195: ; __192: ; - bufpt = bp + 16 /* &buf[0] */ + bufpt = bp + 8 /* &buf[0] */ flag_altform2 = EtByte(1) goto adjust_width_for_utf8 __69: @@ -63945,7 +64451,7 @@ __197: if !(bufpt == uintptr(0)) { goto __198 } - bufpt = ts + 740 /* "" */ + bufpt = ts + 755 /* "" */ goto __199 __198: if !(int32(xtype) == EtDYNSTRING) { @@ -64074,9 +64580,9 @@ __219: } escarg = func() uintptr { if int32(xtype) == EtSQLESCAPE2 { - return ts + 741 /* "NULL" */ + return ts + 756 /* "NULL" */ } - return ts + 746 /* "(NULL)" */ + return ts + 761 /* "(NULL)" */ }() __220: ; @@ -64131,7 +64637,7 @@ __230: ; goto __229 __228: - bufpt = bp + 16 /* &buf[0] */ + bufpt = bp + 8 /* &buf[0] */ __229: ; j = 0 @@ -64211,7 +64717,7 @@ __240: goto __244 } Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) - Xsqlite3_str_append(tls, pAccum, ts+753 /* "." */, 1) + Xsqlite3_str_append(tls, pAccum, ts+768 /* "." */, 1) __244: ; Xsqlite3_str_appendall(tls, pAccum, (*SrcItem)(unsafe.Pointer(pItem)).FzName) @@ -64226,7 +64732,7 @@ __245: if !((*SrcItem)(unsafe.Pointer(pItem)).FpSelect != 0) { goto __247 } - Xsqlite3_str_appendf(tls, pAccum, ts+755 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) + Xsqlite3_str_appendf(tls, pAccum, ts+770 /* "SUBQUERY %u" */, libc.VaList(bp, (*Select)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem)).FpSelect)).FselId)) __247: ; __246: @@ -64289,7 +64795,7 @@ __5: // End for loop over the format string } -var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 767 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ +var zOrd = *(*[9]int8)(unsafe.Pointer(ts + 782 /* "thstndrd" */)) /* sqlite3.c:29091:29 */ // End of function @@ -66429,7 +66935,7 @@ func compare2pow63(tls *libc.TLS, zNum uintptr, incr int32) int32 { /* sqlite3.c var c int32 = 0 var i int32 // 012345678901234567 - var pow63 uintptr = ts + 776 /* "9223372036854775..." */ + var pow63 uintptr = ts + 791 /* "9223372036854775..." */ for i = 0; (c == 0) && (i < 18); i++ { c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr((i * incr))))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10) } @@ -67075,11 +67581,11 @@ func Xsqlite3HexToBlob(tls *libc.TLS, db uintptr, z uintptr, n int32) uintptr { // not have been used. The "type" of connection pointer is given as the // argument. The zType is a word like "NULL" or "closed" or "invalid". func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+795, /* "API call with %s..." */ + ts+810, /* "API call with %s..." */ libc.VaList(bp, zType)) } @@ -67098,14 +67604,14 @@ func logBadConnection(tls *libc.TLS, zType uintptr) { /* sqlite3.c:33033:13: */ func Xsqlite3SafetyCheckOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:33054:20: */ var magic U32 if db == uintptr(0) { - logBadConnection(tls, ts+741 /* "NULL" */) + logBadConnection(tls, ts+756 /* "NULL" */) return 0 } magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if magic != SQLITE_MAGIC_OPEN { if Xsqlite3SafetyCheckSickOrOk(tls, db) != 0 { - logBadConnection(tls, ts+840 /* "unopened" */) + logBadConnection(tls, ts+855 /* "unopened" */) } return 0 } else { @@ -67119,7 +67625,7 @@ func Xsqlite3SafetyCheckSickOrOk(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c magic = (*Sqlite3)(unsafe.Pointer(db)).Fmagic if ((magic != U32(SQLITE_MAGIC_SICK)) && (magic != SQLITE_MAGIC_OPEN)) && (magic != SQLITE_MAGIC_BUSY) { - logBadConnection(tls, ts+849 /* "invalid" */) + logBadConnection(tls, ts+864 /* "invalid" */) return 0 } else { return 1 @@ -67647,186 +68153,186 @@ func Xsqlite3OpcodeName(tls *libc.TLS, i int32) uintptr { /* sqlite3.c:33672:27: } var azName = [180]uintptr{ - /* 0 */ ts + 857, /* "Savepoint" */ - /* 1 */ ts + 867, /* "AutoCommit" */ - /* 2 */ ts + 878, /* "Transaction" */ - /* 3 */ ts + 890, /* "SorterNext" */ - /* 4 */ ts + 901, /* "Prev" */ - /* 5 */ ts + 906, /* "Next" */ - /* 6 */ ts + 911, /* "Checkpoint" */ - /* 7 */ ts + 922, /* "JournalMode" */ - /* 8 */ ts + 934, /* "Vacuum" */ - /* 9 */ ts + 941, /* "VFilter" */ - /* 10 */ ts + 949, /* "VUpdate" */ - /* 11 */ ts + 957, /* "Goto" */ - /* 12 */ ts + 962, /* "Gosub" */ - /* 13 */ ts + 968, /* "InitCoroutine" */ - /* 14 */ ts + 982, /* "Yield" */ - /* 15 */ ts + 988, /* "MustBeInt" */ - /* 16 */ ts + 998, /* "Jump" */ - /* 17 */ ts + 1003, /* "Once" */ - /* 18 */ ts + 1008, /* "If" */ - /* 19 */ ts + 1011, /* "Not" */ - /* 20 */ ts + 1015, /* "IfNot" */ - /* 21 */ ts + 1021, /* "IfNullRow" */ - /* 22 */ ts + 1031, /* "SeekLT" */ - /* 23 */ ts + 1038, /* "SeekLE" */ - /* 24 */ ts + 1045, /* "SeekGE" */ - /* 25 */ ts + 1052, /* "SeekGT" */ - /* 26 */ ts + 1059, /* "IfNotOpen" */ - /* 27 */ ts + 1069, /* "IfNoHope" */ - /* 28 */ ts + 1078, /* "NoConflict" */ - /* 29 */ ts + 1089, /* "NotFound" */ - /* 30 */ ts + 1098, /* "Found" */ - /* 31 */ ts + 1104, /* "SeekRowid" */ - /* 32 */ ts + 1114, /* "NotExists" */ - /* 33 */ ts + 1124, /* "Last" */ - /* 34 */ ts + 1129, /* "IfSmaller" */ - /* 35 */ ts + 1139, /* "SorterSort" */ - /* 36 */ ts + 1150, /* "Sort" */ - /* 37 */ ts + 1155, /* "Rewind" */ - /* 38 */ ts + 1162, /* "IdxLE" */ - /* 39 */ ts + 1168, /* "IdxGT" */ - /* 40 */ ts + 1174, /* "IdxLT" */ - /* 41 */ ts + 1180, /* "IdxGE" */ - /* 42 */ ts + 1186, /* "RowSetRead" */ - /* 43 */ ts + 1197, /* "Or" */ - /* 44 */ ts + 1200, /* "And" */ - /* 45 */ ts + 1204, /* "RowSetTest" */ - /* 46 */ ts + 1215, /* "Program" */ - /* 47 */ ts + 1223, /* "FkIfZero" */ - /* 48 */ ts + 1232, /* "IfPos" */ - /* 49 */ ts + 1238, /* "IfNotZero" */ - /* 50 */ ts + 1248, /* "IsNull" */ - /* 51 */ ts + 1255, /* "NotNull" */ - /* 52 */ ts + 1263, /* "Ne" */ - /* 53 */ ts + 1266, /* "Eq" */ - /* 54 */ ts + 1269, /* "Gt" */ - /* 55 */ ts + 1272, /* "Le" */ - /* 56 */ ts + 1275, /* "Lt" */ - /* 57 */ ts + 1278, /* "Ge" */ - /* 58 */ ts + 1281, /* "ElseEq" */ - /* 59 */ ts + 1288, /* "DecrJumpZero" */ - /* 60 */ ts + 1301, /* "IncrVacuum" */ - /* 61 */ ts + 1312, /* "VNext" */ - /* 62 */ ts + 1318, /* "Init" */ - /* 63 */ ts + 1323, /* "PureFunc" */ - /* 64 */ ts + 1332, /* "Function" */ - /* 65 */ ts + 1341, /* "Return" */ - /* 66 */ ts + 1348, /* "EndCoroutine" */ - /* 67 */ ts + 1361, /* "HaltIfNull" */ - /* 68 */ ts + 1372, /* "Halt" */ - /* 69 */ ts + 1377, /* "Integer" */ - /* 70 */ ts + 1385, /* "Int64" */ - /* 71 */ ts + 1391, /* "String" */ - /* 72 */ ts + 1398, /* "Null" */ - /* 73 */ ts + 1403, /* "SoftNull" */ - /* 74 */ ts + 1412, /* "Blob" */ - /* 75 */ ts + 1417, /* "Variable" */ - /* 76 */ ts + 1426, /* "Move" */ - /* 77 */ ts + 1431, /* "Copy" */ - /* 78 */ ts + 1436, /* "SCopy" */ - /* 79 */ ts + 1442, /* "IntCopy" */ - /* 80 */ ts + 1450, /* "ChngCntRow" */ - /* 81 */ ts + 1461, /* "ResultRow" */ - /* 82 */ ts + 1471, /* "CollSeq" */ - /* 83 */ ts + 1479, /* "AddImm" */ - /* 84 */ ts + 1486, /* "RealAffinity" */ - /* 85 */ ts + 1499, /* "Cast" */ - /* 86 */ ts + 1504, /* "Permutation" */ - /* 87 */ ts + 1516, /* "Compare" */ - /* 88 */ ts + 1524, /* "IsTrue" */ - /* 89 */ ts + 1531, /* "ZeroOrNull" */ - /* 90 */ ts + 1542, /* "Offset" */ - /* 91 */ ts + 1549, /* "Column" */ - /* 92 */ ts + 1556, /* "Affinity" */ - /* 93 */ ts + 1565, /* "MakeRecord" */ - /* 94 */ ts + 1576, /* "Count" */ - /* 95 */ ts + 1582, /* "ReadCookie" */ - /* 96 */ ts + 1593, /* "SetCookie" */ - /* 97 */ ts + 1603, /* "ReopenIdx" */ - /* 98 */ ts + 1613, /* "OpenRead" */ - /* 99 */ ts + 1622, /* "OpenWrite" */ - /* 100 */ ts + 1632, /* "OpenDup" */ - /* 101 */ ts + 1640, /* "OpenAutoindex" */ - /* 102 */ ts + 1654, /* "BitAnd" */ - /* 103 */ ts + 1661, /* "BitOr" */ - /* 104 */ ts + 1667, /* "ShiftLeft" */ - /* 105 */ ts + 1677, /* "ShiftRight" */ - /* 106 */ ts + 1688, /* "Add" */ - /* 107 */ ts + 1692, /* "Subtract" */ - /* 108 */ ts + 1701, /* "Multiply" */ - /* 109 */ ts + 1710, /* "Divide" */ - /* 110 */ ts + 1717, /* "Remainder" */ - /* 111 */ ts + 1727, /* "Concat" */ - /* 112 */ ts + 1734, /* "OpenEphemeral" */ - /* 113 */ ts + 1748, /* "BitNot" */ - /* 114 */ ts + 1755, /* "SorterOpen" */ - /* 115 */ ts + 1766, /* "SequenceTest" */ - /* 116 */ ts + 1779, /* "String8" */ - /* 117 */ ts + 1787, /* "OpenPseudo" */ - /* 118 */ ts + 1798, /* "Close" */ - /* 119 */ ts + 1804, /* "ColumnsUsed" */ - /* 120 */ ts + 1816, /* "SeekScan" */ - /* 121 */ ts + 1825, /* "SeekHit" */ - /* 122 */ ts + 1833, /* "Sequence" */ - /* 123 */ ts + 1842, /* "NewRowid" */ - /* 124 */ ts + 1851, /* "Insert" */ - /* 125 */ ts + 1858, /* "RowCell" */ - /* 126 */ ts + 1866, /* "Delete" */ - /* 127 */ ts + 1873, /* "ResetCount" */ - /* 128 */ ts + 1884, /* "SorterCompare" */ - /* 129 */ ts + 1898, /* "SorterData" */ - /* 130 */ ts + 1909, /* "RowData" */ - /* 131 */ ts + 1917, /* "Rowid" */ - /* 132 */ ts + 1923, /* "NullRow" */ - /* 133 */ ts + 1931, /* "SeekEnd" */ - /* 134 */ ts + 1939, /* "IdxInsert" */ - /* 135 */ ts + 1949, /* "SorterInsert" */ - /* 136 */ ts + 1962, /* "IdxDelete" */ - /* 137 */ ts + 1972, /* "DeferredSeek" */ - /* 138 */ ts + 1985, /* "IdxRowid" */ - /* 139 */ ts + 1994, /* "FinishSeek" */ - /* 140 */ ts + 2005, /* "Destroy" */ - /* 141 */ ts + 2013, /* "Clear" */ - /* 142 */ ts + 2019, /* "ResetSorter" */ - /* 143 */ ts + 2031, /* "CreateBtree" */ - /* 144 */ ts + 2043, /* "SqlExec" */ - /* 145 */ ts + 2051, /* "ParseSchema" */ - /* 146 */ ts + 2063, /* "LoadAnalysis" */ - /* 147 */ ts + 2076, /* "DropTable" */ - /* 148 */ ts + 2086, /* "DropIndex" */ - /* 149 */ ts + 2096, /* "DropTrigger" */ - /* 150 */ ts + 2108, /* "IntegrityCk" */ - /* 151 */ ts + 2120, /* "RowSetAdd" */ - /* 152 */ ts + 2130, /* "Real" */ - /* 153 */ ts + 2135, /* "Param" */ - /* 154 */ ts + 2141, /* "FkCounter" */ - /* 155 */ ts + 2151, /* "MemMax" */ - /* 156 */ ts + 2158, /* "OffsetLimit" */ - /* 157 */ ts + 2170, /* "AggInverse" */ - /* 158 */ ts + 2181, /* "AggStep" */ - /* 159 */ ts + 2189, /* "AggStep1" */ - /* 160 */ ts + 2198, /* "AggValue" */ - /* 161 */ ts + 2207, /* "AggFinal" */ - /* 162 */ ts + 2216, /* "Expire" */ - /* 163 */ ts + 2223, /* "CursorLock" */ - /* 164 */ ts + 2234, /* "CursorUnlock" */ - /* 165 */ ts + 2247, /* "TableLock" */ - /* 166 */ ts + 2257, /* "VBegin" */ - /* 167 */ ts + 2264, /* "VCreate" */ - /* 168 */ ts + 2272, /* "VDestroy" */ - /* 169 */ ts + 2281, /* "VOpen" */ - /* 170 */ ts + 2287, /* "VColumn" */ - /* 171 */ ts + 2295, /* "VRename" */ - /* 172 */ ts + 2303, /* "Pagecount" */ - /* 173 */ ts + 2313, /* "MaxPgcnt" */ - /* 174 */ ts + 2322, /* "Trace" */ - /* 175 */ ts + 2328, /* "CursorHint" */ - /* 176 */ ts + 2339, /* "ReleaseReg" */ - /* 177 */ ts + 2350, /* "Noop" */ - /* 178 */ ts + 2355, /* "Explain" */ - /* 179 */ ts + 2363, /* "Abortable" */ + /* 0 */ ts + 872, /* "Savepoint" */ + /* 1 */ ts + 882, /* "AutoCommit" */ + /* 2 */ ts + 893, /* "Transaction" */ + /* 3 */ ts + 905, /* "SorterNext" */ + /* 4 */ ts + 916, /* "Prev" */ + /* 5 */ ts + 921, /* "Next" */ + /* 6 */ ts + 926, /* "Checkpoint" */ + /* 7 */ ts + 937, /* "JournalMode" */ + /* 8 */ ts + 949, /* "Vacuum" */ + /* 9 */ ts + 956, /* "VFilter" */ + /* 10 */ ts + 964, /* "VUpdate" */ + /* 11 */ ts + 972, /* "Goto" */ + /* 12 */ ts + 977, /* "Gosub" */ + /* 13 */ ts + 983, /* "InitCoroutine" */ + /* 14 */ ts + 997, /* "Yield" */ + /* 15 */ ts + 1003, /* "MustBeInt" */ + /* 16 */ ts + 1013, /* "Jump" */ + /* 17 */ ts + 1018, /* "Once" */ + /* 18 */ ts + 1023, /* "If" */ + /* 19 */ ts + 1026, /* "Not" */ + /* 20 */ ts + 1030, /* "IfNot" */ + /* 21 */ ts + 1036, /* "IfNullRow" */ + /* 22 */ ts + 1046, /* "SeekLT" */ + /* 23 */ ts + 1053, /* "SeekLE" */ + /* 24 */ ts + 1060, /* "SeekGE" */ + /* 25 */ ts + 1067, /* "SeekGT" */ + /* 26 */ ts + 1074, /* "IfNotOpen" */ + /* 27 */ ts + 1084, /* "IfNoHope" */ + /* 28 */ ts + 1093, /* "NoConflict" */ + /* 29 */ ts + 1104, /* "NotFound" */ + /* 30 */ ts + 1113, /* "Found" */ + /* 31 */ ts + 1119, /* "SeekRowid" */ + /* 32 */ ts + 1129, /* "NotExists" */ + /* 33 */ ts + 1139, /* "Last" */ + /* 34 */ ts + 1144, /* "IfSmaller" */ + /* 35 */ ts + 1154, /* "SorterSort" */ + /* 36 */ ts + 1165, /* "Sort" */ + /* 37 */ ts + 1170, /* "Rewind" */ + /* 38 */ ts + 1177, /* "IdxLE" */ + /* 39 */ ts + 1183, /* "IdxGT" */ + /* 40 */ ts + 1189, /* "IdxLT" */ + /* 41 */ ts + 1195, /* "IdxGE" */ + /* 42 */ ts + 1201, /* "RowSetRead" */ + /* 43 */ ts + 1212, /* "Or" */ + /* 44 */ ts + 1215, /* "And" */ + /* 45 */ ts + 1219, /* "RowSetTest" */ + /* 46 */ ts + 1230, /* "Program" */ + /* 47 */ ts + 1238, /* "FkIfZero" */ + /* 48 */ ts + 1247, /* "IfPos" */ + /* 49 */ ts + 1253, /* "IfNotZero" */ + /* 50 */ ts + 1263, /* "IsNull" */ + /* 51 */ ts + 1270, /* "NotNull" */ + /* 52 */ ts + 1278, /* "Ne" */ + /* 53 */ ts + 1281, /* "Eq" */ + /* 54 */ ts + 1284, /* "Gt" */ + /* 55 */ ts + 1287, /* "Le" */ + /* 56 */ ts + 1290, /* "Lt" */ + /* 57 */ ts + 1293, /* "Ge" */ + /* 58 */ ts + 1296, /* "ElseEq" */ + /* 59 */ ts + 1303, /* "DecrJumpZero" */ + /* 60 */ ts + 1316, /* "IncrVacuum" */ + /* 61 */ ts + 1327, /* "VNext" */ + /* 62 */ ts + 1333, /* "Init" */ + /* 63 */ ts + 1338, /* "PureFunc" */ + /* 64 */ ts + 1347, /* "Function" */ + /* 65 */ ts + 1356, /* "Return" */ + /* 66 */ ts + 1363, /* "EndCoroutine" */ + /* 67 */ ts + 1376, /* "HaltIfNull" */ + /* 68 */ ts + 1387, /* "Halt" */ + /* 69 */ ts + 1392, /* "Integer" */ + /* 70 */ ts + 1400, /* "Int64" */ + /* 71 */ ts + 1406, /* "String" */ + /* 72 */ ts + 1413, /* "Null" */ + /* 73 */ ts + 1418, /* "SoftNull" */ + /* 74 */ ts + 1427, /* "Blob" */ + /* 75 */ ts + 1432, /* "Variable" */ + /* 76 */ ts + 1441, /* "Move" */ + /* 77 */ ts + 1446, /* "Copy" */ + /* 78 */ ts + 1451, /* "SCopy" */ + /* 79 */ ts + 1457, /* "IntCopy" */ + /* 80 */ ts + 1465, /* "ChngCntRow" */ + /* 81 */ ts + 1476, /* "ResultRow" */ + /* 82 */ ts + 1486, /* "CollSeq" */ + /* 83 */ ts + 1494, /* "AddImm" */ + /* 84 */ ts + 1501, /* "RealAffinity" */ + /* 85 */ ts + 1514, /* "Cast" */ + /* 86 */ ts + 1519, /* "Permutation" */ + /* 87 */ ts + 1531, /* "Compare" */ + /* 88 */ ts + 1539, /* "IsTrue" */ + /* 89 */ ts + 1546, /* "ZeroOrNull" */ + /* 90 */ ts + 1557, /* "Offset" */ + /* 91 */ ts + 1564, /* "Column" */ + /* 92 */ ts + 1571, /* "Affinity" */ + /* 93 */ ts + 1580, /* "MakeRecord" */ + /* 94 */ ts + 1591, /* "Count" */ + /* 95 */ ts + 1597, /* "ReadCookie" */ + /* 96 */ ts + 1608, /* "SetCookie" */ + /* 97 */ ts + 1618, /* "ReopenIdx" */ + /* 98 */ ts + 1628, /* "OpenRead" */ + /* 99 */ ts + 1637, /* "OpenWrite" */ + /* 100 */ ts + 1647, /* "OpenDup" */ + /* 101 */ ts + 1655, /* "OpenAutoindex" */ + /* 102 */ ts + 1669, /* "BitAnd" */ + /* 103 */ ts + 1676, /* "BitOr" */ + /* 104 */ ts + 1682, /* "ShiftLeft" */ + /* 105 */ ts + 1692, /* "ShiftRight" */ + /* 106 */ ts + 1703, /* "Add" */ + /* 107 */ ts + 1707, /* "Subtract" */ + /* 108 */ ts + 1716, /* "Multiply" */ + /* 109 */ ts + 1725, /* "Divide" */ + /* 110 */ ts + 1732, /* "Remainder" */ + /* 111 */ ts + 1742, /* "Concat" */ + /* 112 */ ts + 1749, /* "OpenEphemeral" */ + /* 113 */ ts + 1763, /* "BitNot" */ + /* 114 */ ts + 1770, /* "SorterOpen" */ + /* 115 */ ts + 1781, /* "SequenceTest" */ + /* 116 */ ts + 1794, /* "String8" */ + /* 117 */ ts + 1802, /* "OpenPseudo" */ + /* 118 */ ts + 1813, /* "Close" */ + /* 119 */ ts + 1819, /* "ColumnsUsed" */ + /* 120 */ ts + 1831, /* "SeekScan" */ + /* 121 */ ts + 1840, /* "SeekHit" */ + /* 122 */ ts + 1848, /* "Sequence" */ + /* 123 */ ts + 1857, /* "NewRowid" */ + /* 124 */ ts + 1866, /* "Insert" */ + /* 125 */ ts + 1873, /* "RowCell" */ + /* 126 */ ts + 1881, /* "Delete" */ + /* 127 */ ts + 1888, /* "ResetCount" */ + /* 128 */ ts + 1899, /* "SorterCompare" */ + /* 129 */ ts + 1913, /* "SorterData" */ + /* 130 */ ts + 1924, /* "RowData" */ + /* 131 */ ts + 1932, /* "Rowid" */ + /* 132 */ ts + 1938, /* "NullRow" */ + /* 133 */ ts + 1946, /* "SeekEnd" */ + /* 134 */ ts + 1954, /* "IdxInsert" */ + /* 135 */ ts + 1964, /* "SorterInsert" */ + /* 136 */ ts + 1977, /* "IdxDelete" */ + /* 137 */ ts + 1987, /* "DeferredSeek" */ + /* 138 */ ts + 2000, /* "IdxRowid" */ + /* 139 */ ts + 2009, /* "FinishSeek" */ + /* 140 */ ts + 2020, /* "Destroy" */ + /* 141 */ ts + 2028, /* "Clear" */ + /* 142 */ ts + 2034, /* "ResetSorter" */ + /* 143 */ ts + 2046, /* "CreateBtree" */ + /* 144 */ ts + 2058, /* "SqlExec" */ + /* 145 */ ts + 2066, /* "ParseSchema" */ + /* 146 */ ts + 2078, /* "LoadAnalysis" */ + /* 147 */ ts + 2091, /* "DropTable" */ + /* 148 */ ts + 2101, /* "DropIndex" */ + /* 149 */ ts + 2111, /* "DropTrigger" */ + /* 150 */ ts + 2123, /* "IntegrityCk" */ + /* 151 */ ts + 2135, /* "RowSetAdd" */ + /* 152 */ ts + 2145, /* "Real" */ + /* 153 */ ts + 2150, /* "Param" */ + /* 154 */ ts + 2156, /* "FkCounter" */ + /* 155 */ ts + 2166, /* "MemMax" */ + /* 156 */ ts + 2173, /* "OffsetLimit" */ + /* 157 */ ts + 2185, /* "AggInverse" */ + /* 158 */ ts + 2196, /* "AggStep" */ + /* 159 */ ts + 2204, /* "AggStep1" */ + /* 160 */ ts + 2213, /* "AggValue" */ + /* 161 */ ts + 2222, /* "AggFinal" */ + /* 162 */ ts + 2231, /* "Expire" */ + /* 163 */ ts + 2238, /* "CursorLock" */ + /* 164 */ ts + 2249, /* "CursorUnlock" */ + /* 165 */ ts + 2262, /* "TableLock" */ + /* 166 */ ts + 2272, /* "VBegin" */ + /* 167 */ ts + 2279, /* "VCreate" */ + /* 168 */ ts + 2287, /* "VDestroy" */ + /* 169 */ ts + 2296, /* "VOpen" */ + /* 170 */ ts + 2302, /* "VColumn" */ + /* 171 */ ts + 2310, /* "VRename" */ + /* 172 */ ts + 2318, /* "Pagecount" */ + /* 173 */ ts + 2328, /* "MaxPgcnt" */ + /* 174 */ ts + 2337, /* "Trace" */ + /* 175 */ ts + 2343, /* "CursorHint" */ + /* 176 */ ts + 2354, /* "ReleaseReg" */ + /* 177 */ ts + 2365, /* "Noop" */ + /* 178 */ ts + 2370, /* "Explain" */ + /* 179 */ ts + 2378, /* "Abortable" */ } /* sqlite3.c:33673:20 */ //************* End of opcodes.c ******************************************** @@ -68235,170 +68741,170 @@ type win_syscall = struct { // testing and sandboxing. The following array holds the names and pointers // to all overrideable system calls. var aSyscall = [80]win_syscall{ - {FzName: ts + 2373 /* "AreFileApisANSI" */, FpCurrent: 0}, + {FzName: ts + 2388 /* "AreFileApisANSI" */, FpCurrent: 0}, - {FzName: ts + 2389 /* "CharLowerW" */}, + {FzName: ts + 2404 /* "CharLowerW" */}, - {FzName: ts + 2400 /* "CharUpperW" */}, + {FzName: ts + 2415 /* "CharUpperW" */}, - {FzName: ts + 2411 /* "CloseHandle" */, FpCurrent: 0}, + {FzName: ts + 2426 /* "CloseHandle" */, FpCurrent: 0}, - {FzName: ts + 2423 /* "CreateFileA" */, FpCurrent: 0}, + {FzName: ts + 2438 /* "CreateFileA" */, FpCurrent: 0}, - {FzName: ts + 2435 /* "CreateFileW" */, FpCurrent: 0}, + {FzName: ts + 2450 /* "CreateFileW" */, FpCurrent: 0}, - {FzName: ts + 2447 /* "CreateFileMappin..." */, FpCurrent: 0}, + {FzName: ts + 2462 /* "CreateFileMappin..." */, FpCurrent: 0}, - {FzName: ts + 2466 /* "CreateFileMappin..." */, FpCurrent: 0}, + {FzName: ts + 2481 /* "CreateFileMappin..." */, FpCurrent: 0}, - {FzName: ts + 2485 /* "CreateMutexW" */, FpCurrent: 0}, + {FzName: ts + 2500 /* "CreateMutexW" */, FpCurrent: 0}, - {FzName: ts + 2498 /* "DeleteFileA" */, FpCurrent: 0}, + {FzName: ts + 2513 /* "DeleteFileA" */, FpCurrent: 0}, - {FzName: ts + 2510 /* "DeleteFileW" */, FpCurrent: 0}, + {FzName: ts + 2525 /* "DeleteFileW" */, FpCurrent: 0}, - {FzName: ts + 2522 /* "FileTimeToLocalF..." */}, + {FzName: ts + 2537 /* "FileTimeToLocalF..." */}, - {FzName: ts + 2546 /* "FileTimeToSystem..." */}, + {FzName: ts + 2561 /* "FileTimeToSystem..." */}, - {FzName: ts + 2567 /* "FlushFileBuffers" */, FpCurrent: 0}, + {FzName: ts + 2582 /* "FlushFileBuffers" */, FpCurrent: 0}, - {FzName: ts + 2584 /* "FormatMessageA" */, FpCurrent: 0}, + {FzName: ts + 2599 /* "FormatMessageA" */, FpCurrent: 0}, - {FzName: ts + 2599 /* "FormatMessageW" */, FpCurrent: 0}, + {FzName: ts + 2614 /* "FormatMessageW" */, FpCurrent: 0}, - {FzName: ts + 2614 /* "FreeLibrary" */, FpCurrent: 0}, + {FzName: ts + 2629 /* "FreeLibrary" */, FpCurrent: 0}, - {FzName: ts + 2626 /* "GetCurrentProces..." */, FpCurrent: 0}, + {FzName: ts + 2641 /* "GetCurrentProces..." */, FpCurrent: 0}, - {FzName: ts + 2646 /* "GetDiskFreeSpace..." */, FpCurrent: 0}, + {FzName: ts + 2661 /* "GetDiskFreeSpace..." */, FpCurrent: 0}, - {FzName: ts + 2664 /* "GetDiskFreeSpace..." */, FpCurrent: 0}, + {FzName: ts + 2679 /* "GetDiskFreeSpace..." */, FpCurrent: 0}, - {FzName: ts + 2682 /* "GetFileAttribute..." */, FpCurrent: 0}, + {FzName: ts + 2697 /* "GetFileAttribute..." */, FpCurrent: 0}, - {FzName: ts + 2701 /* "GetFileAttribute..." */, FpCurrent: 0}, + {FzName: ts + 2716 /* "GetFileAttribute..." */, FpCurrent: 0}, - {FzName: ts + 2720 /* "GetFileAttribute..." */, FpCurrent: 0}, + {FzName: ts + 2735 /* "GetFileAttribute..." */, FpCurrent: 0}, - {FzName: ts + 2741 /* "GetFileSize" */, FpCurrent: 0}, + {FzName: ts + 2756 /* "GetFileSize" */, FpCurrent: 0}, - {FzName: ts + 2753 /* "GetFullPathNameA" */, FpCurrent: 0}, + {FzName: ts + 2768 /* "GetFullPathNameA" */, FpCurrent: 0}, - {FzName: ts + 2770 /* "GetFullPathNameW" */, FpCurrent: 0}, + {FzName: ts + 2785 /* "GetFullPathNameW" */, FpCurrent: 0}, - {FzName: ts + 2787 /* "GetLastError" */, FpCurrent: 0}, + {FzName: ts + 2802 /* "GetLastError" */, FpCurrent: 0}, // All other Windows platforms expect GetProcAddress() to take // an ANSI string regardless of the _UNICODE setting - {FzName: ts + 2800 /* "GetProcAddressA" */, FpCurrent: 0}, + {FzName: ts + 2815 /* "GetProcAddressA" */, FpCurrent: 0}, - {FzName: ts + 2816 /* "GetSystemInfo" */, FpCurrent: 0}, + {FzName: ts + 2831 /* "GetSystemInfo" */, FpCurrent: 0}, - {FzName: ts + 2830 /* "GetSystemTime" */, FpCurrent: 0}, + {FzName: ts + 2845 /* "GetSystemTime" */, FpCurrent: 0}, - {FzName: ts + 2844 /* "GetSystemTimeAsF..." */, FpCurrent: 0}, + {FzName: ts + 2859 /* "GetSystemTimeAsF..." */, FpCurrent: 0}, - {FzName: ts + 2868 /* "GetTempPathA" */, FpCurrent: 0}, + {FzName: ts + 2883 /* "GetTempPathA" */, FpCurrent: 0}, - {FzName: ts + 2881 /* "GetTempPathW" */, FpCurrent: 0}, + {FzName: ts + 2896 /* "GetTempPathW" */, FpCurrent: 0}, - {FzName: ts + 2894 /* "GetTickCount" */, FpCurrent: 0}, + {FzName: ts + 2909 /* "GetTickCount" */, FpCurrent: 0}, - {FzName: ts + 2907 /* "GetVersionExA" */, FpCurrent: 0}, + {FzName: ts + 2922 /* "GetVersionExA" */, FpCurrent: 0}, - {FzName: ts + 2921 /* "GetVersionExW" */, FpCurrent: 0}, + {FzName: ts + 2936 /* "GetVersionExW" */, FpCurrent: 0}, - {FzName: ts + 2935 /* "HeapAlloc" */, FpCurrent: 0}, + {FzName: ts + 2950 /* "HeapAlloc" */, FpCurrent: 0}, - {FzName: ts + 2945 /* "HeapCreate" */, FpCurrent: 0}, + {FzName: ts + 2960 /* "HeapCreate" */, FpCurrent: 0}, - {FzName: ts + 2956 /* "HeapDestroy" */, FpCurrent: 0}, + {FzName: ts + 2971 /* "HeapDestroy" */, FpCurrent: 0}, - {FzName: ts + 2968 /* "HeapFree" */, FpCurrent: 0}, + {FzName: ts + 2983 /* "HeapFree" */, FpCurrent: 0}, - {FzName: ts + 2977 /* "HeapReAlloc" */, FpCurrent: 0}, + {FzName: ts + 2992 /* "HeapReAlloc" */, FpCurrent: 0}, - {FzName: ts + 2989 /* "HeapSize" */, FpCurrent: 0}, + {FzName: ts + 3004 /* "HeapSize" */, FpCurrent: 0}, - {FzName: ts + 2998 /* "HeapValidate" */, FpCurrent: 0}, + {FzName: ts + 3013 /* "HeapValidate" */, FpCurrent: 0}, - {FzName: ts + 3011 /* "HeapCompact" */, FpCurrent: 0}, + {FzName: ts + 3026 /* "HeapCompact" */, FpCurrent: 0}, - {FzName: ts + 3023 /* "LoadLibraryA" */, FpCurrent: 0}, + {FzName: ts + 3038 /* "LoadLibraryA" */, FpCurrent: 0}, - {FzName: ts + 3036 /* "LoadLibraryW" */, FpCurrent: 0}, + {FzName: ts + 3051 /* "LoadLibraryW" */, FpCurrent: 0}, - {FzName: ts + 3049 /* "LocalFree" */, FpCurrent: 0}, + {FzName: ts + 3064 /* "LocalFree" */, FpCurrent: 0}, - {FzName: ts + 3059 /* "LockFile" */, FpCurrent: 0}, + {FzName: ts + 3074 /* "LockFile" */, FpCurrent: 0}, - {FzName: ts + 3068 /* "LockFileEx" */, FpCurrent: 0}, + {FzName: ts + 3083 /* "LockFileEx" */, FpCurrent: 0}, - {FzName: ts + 3079 /* "MapViewOfFile" */, FpCurrent: 0}, + {FzName: ts + 3094 /* "MapViewOfFile" */, FpCurrent: 0}, - {FzName: ts + 3093 /* "MultiByteToWideC..." */, FpCurrent: 0}, + {FzName: ts + 3108 /* "MultiByteToWideC..." */, FpCurrent: 0}, - {FzName: ts + 3113 /* "QueryPerformance..." */, FpCurrent: 0}, + {FzName: ts + 3128 /* "QueryPerformance..." */, FpCurrent: 0}, - {FzName: ts + 3137 /* "ReadFile" */, FpCurrent: 0}, + {FzName: ts + 3152 /* "ReadFile" */, FpCurrent: 0}, - {FzName: ts + 3146 /* "SetEndOfFile" */, FpCurrent: 0}, + {FzName: ts + 3161 /* "SetEndOfFile" */, FpCurrent: 0}, - {FzName: ts + 3159 /* "SetFilePointer" */, FpCurrent: 0}, + {FzName: ts + 3174 /* "SetFilePointer" */, FpCurrent: 0}, - {FzName: ts + 3174 /* "Sleep" */, FpCurrent: 0}, + {FzName: ts + 3189 /* "Sleep" */, FpCurrent: 0}, - {FzName: ts + 3180 /* "SystemTimeToFile..." */, FpCurrent: 0}, + {FzName: ts + 3195 /* "SystemTimeToFile..." */, FpCurrent: 0}, - {FzName: ts + 3201 /* "UnlockFile" */, FpCurrent: 0}, + {FzName: ts + 3216 /* "UnlockFile" */, FpCurrent: 0}, - {FzName: ts + 3212 /* "UnlockFileEx" */, FpCurrent: 0}, + {FzName: ts + 3227 /* "UnlockFileEx" */, FpCurrent: 0}, - {FzName: ts + 3225 /* "UnmapViewOfFile" */, FpCurrent: 0}, + {FzName: ts + 3240 /* "UnmapViewOfFile" */, FpCurrent: 0}, - {FzName: ts + 3241 /* "WideCharToMultiB..." */, FpCurrent: 0}, + {FzName: ts + 3256 /* "WideCharToMultiB..." */, FpCurrent: 0}, - {FzName: ts + 3261 /* "WriteFile" */, FpCurrent: 0}, + {FzName: ts + 3276 /* "WriteFile" */, FpCurrent: 0}, - {FzName: ts + 3271 /* "CreateEventExW" */}, + {FzName: ts + 3286 /* "CreateEventExW" */}, - {FzName: ts + 3286 /* "WaitForSingleObj..." */, FpCurrent: 0}, + {FzName: ts + 3301 /* "WaitForSingleObj..." */, FpCurrent: 0}, - {FzName: ts + 3306 /* "WaitForSingleObj..." */, FpCurrent: 0}, + {FzName: ts + 3321 /* "WaitForSingleObj..." */, FpCurrent: 0}, - {FzName: ts + 3328 /* "SetFilePointerEx" */}, + {FzName: ts + 3343 /* "SetFilePointerEx" */}, - {FzName: ts + 3345 /* "GetFileInformati..." */}, + {FzName: ts + 3360 /* "GetFileInformati..." */}, - {FzName: ts + 3374 /* "MapViewOfFileFro..." */}, + {FzName: ts + 3389 /* "MapViewOfFileFro..." */}, - {FzName: ts + 3395 /* "CreateFile2" */}, + {FzName: ts + 3410 /* "CreateFile2" */}, - {FzName: ts + 3407 /* "LoadPackagedLibr..." */}, + {FzName: ts + 3422 /* "LoadPackagedLibr..." */}, - {FzName: ts + 3427 /* "GetTickCount64" */}, + {FzName: ts + 3442 /* "GetTickCount64" */}, - {FzName: ts + 3442 /* "GetNativeSystemI..." */}, + {FzName: ts + 3457 /* "GetNativeSystemI..." */}, - {FzName: ts + 3462 /* "OutputDebugStrin..." */, FpCurrent: 0}, + {FzName: ts + 3477 /* "OutputDebugStrin..." */, FpCurrent: 0}, - {FzName: ts + 3481 /* "OutputDebugStrin..." */, FpCurrent: 0}, + {FzName: ts + 3496 /* "OutputDebugStrin..." */, FpCurrent: 0}, - {FzName: ts + 3500 /* "GetProcessHeap" */, FpCurrent: 0}, + {FzName: ts + 3515 /* "GetProcessHeap" */, FpCurrent: 0}, - {FzName: ts + 3515 /* "CreateFileMappin..." */}, + {FzName: ts + 3530 /* "CreateFileMappin..." */}, // NOTE: On some sub-platforms, the InterlockedCompareExchange "function" // is really just a macro that uses a compiler intrinsic (e.g. x64). // So do not try to make this is into a redefinable interface. - {FzName: ts + 3540 /* "InterlockedCompa..." */}, + {FzName: ts + 3555 /* "InterlockedCompa..." */}, - {FzName: ts + 3567 /* "UuidCreate" */}, + {FzName: ts + 3582 /* "UuidCreate" */}, - {FzName: ts + 3578 /* "UuidCreateSequen..." */}, + {FzName: ts + 3593 /* "UuidCreateSequen..." */}, - {FzName: ts + 3599 /* "FlushViewOfFile" */, FpCurrent: 0}, + {FzName: ts + 3614 /* "FlushViewOfFile" */, FpCurrent: 0}, } /* sqlite3.c:42872:3 */ // End of the overrideable system calls @@ -68748,8 +69254,8 @@ func Xsqlite3_win32_utf8_to_mbcs_v2(tls *libc.TLS, zText uintptr, useAnsi int32) // This function is the same as sqlite3_win32_set_directory (below); however, // it accepts a UTF-8 string. func Xsqlite3_win32_set_directory8(tls *libc.TLS, type1 uint32, zValue uintptr) int32 { /* sqlite3.c:44279:16: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var ppDirectory uintptr = uintptr(0) var rc int32 = Xsqlite3_initialize(tls) @@ -68765,7 +69271,7 @@ func Xsqlite3_win32_set_directory8(tls *libc.TLS, type1 uint32, zValue uintptr) if ppDirectory != 0 { var zCopy uintptr = uintptr(0) if (zValue != 0) && (*(*int8)(unsafe.Pointer(zValue)) != 0) { - zCopy = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, zValue)) + zCopy = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, zValue)) if zCopy == uintptr(0) { return SQLITE_NOMEM } @@ -68808,8 +69314,8 @@ func Xsqlite3_win32_set_directory(tls *libc.TLS, type1 uint32, zValue uintptr) i // is zero if the error message fits in the buffer, or non-zero // otherwise (if the message was truncated). func winGetLastErrorMsg(tls *libc.TLS, lastErrno DWORD, nBuf int32, zBuf uintptr) int32 { /* sqlite3.c:44350:12: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(40) + defer tls.Free(40) // FormatMessage returns 0 on failure. Otherwise it // returns the number of TCHARs written to the output @@ -68818,45 +69324,45 @@ func winGetLastErrorMsg(tls *libc.TLS, lastErrno DWORD, nBuf int32, zBuf uintptr var zOut uintptr = uintptr(0) if (sqlite3_os_type == 2) || (Xsqlite3_win32_is_nt(tls) != 0) { - *(*LPWSTR)(unsafe.Pointer(bp + 40 /* zTempWide */)) = uintptr(0) + *(*LPWSTR)(unsafe.Pointer(bp + 24 /* zTempWide */)) = uintptr(0) dwLen = (*(*func(*libc.TLS, DWORD, LPCVOID, DWORD, DWORD, LPWSTR, DWORD, uintptr) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 15*24 + 8 /* &.pCurrent */))))(tls, (uint32((FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM) | FORMAT_MESSAGE_IGNORE_INSERTS)), uintptr(0), lastErrno, uint32(0), - bp+40, /* &zTempWide */ + bp+24, /* &zTempWide */ uint32(0), uintptr(0)) if dwLen > DWORD(0) { // allocate a buffer and convert to UTF8 Xsqlite3BeginBenignMalloc(tls) - zOut = winUnicodeToUtf8(tls, *(*LPWSTR)(unsafe.Pointer(bp + 40 /* zTempWide */))) + zOut = winUnicodeToUtf8(tls, *(*LPWSTR)(unsafe.Pointer(bp + 24 /* zTempWide */))) Xsqlite3EndBenignMalloc(tls) // free the system buffer allocated by FormatMessage - (*(*func(*libc.TLS, HLOCAL) HLOCAL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 46*24 + 8 /* &.pCurrent */))))(tls, *(*LPWSTR)(unsafe.Pointer(bp + 40 /* zTempWide */))) + (*(*func(*libc.TLS, HLOCAL) HLOCAL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 46*24 + 8 /* &.pCurrent */))))(tls, *(*LPWSTR)(unsafe.Pointer(bp + 24 /* zTempWide */))) } } else { - *(*uintptr)(unsafe.Pointer(bp + 48 /* zTemp */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 32 /* zTemp */)) = uintptr(0) dwLen = (*(*func(*libc.TLS, DWORD, LPCVOID, DWORD, DWORD, LPSTR, DWORD, uintptr) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 14*24 + 8 /* &.pCurrent */))))(tls, (uint32((FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM) | FORMAT_MESSAGE_IGNORE_INSERTS)), uintptr(0), lastErrno, uint32(0), - bp+48, /* &zTemp */ + bp+32, /* &zTemp */ uint32(0), uintptr(0)) if dwLen > DWORD(0) { // allocate a buffer and convert to UTF8 Xsqlite3BeginBenignMalloc(tls) - zOut = winMbcsToUtf8(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zTemp */)), (*(*func(*libc.TLS) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls)) + zOut = winMbcsToUtf8(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zTemp */)), (*(*func(*libc.TLS) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls)) Xsqlite3EndBenignMalloc(tls) // free the system buffer allocated by FormatMessage - (*(*func(*libc.TLS, HLOCAL) HLOCAL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 46*24 + 8 /* &.pCurrent */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zTemp */))) + (*(*func(*libc.TLS, HLOCAL) HLOCAL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 46*24 + 8 /* &.pCurrent */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zTemp */))) } } if DWORD(0) == dwLen { - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+3618 /* "OsError 0x%lx (%..." */, libc.VaList(bp, lastErrno, lastErrno)) + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+3633 /* "OsError 0x%lx (%..." */, libc.VaList(bp, lastErrno, lastErrno)) } else { // copy a maximum of nBuf chars to output buffer - Xsqlite3_snprintf(tls, nBuf, zBuf, ts+3615 /* "%s" */, libc.VaList(bp+24, zOut)) + Xsqlite3_snprintf(tls, nBuf, zBuf, ts+3630 /* "%s" */, libc.VaList(bp+16, zOut)) // free the UTF8 buffer Xsqlite3_free(tls, zOut) } @@ -68877,25 +69383,25 @@ func winGetLastErrorMsg(tls *libc.TLS, lastErrno DWORD, nBuf int32, zBuf uintptr // The two subsequent arguments should be the name of the OS function that // failed and the associated file-system path, if any. func winLogErrorAtLine(tls *libc.TLS, errcode int32, lastErrno DWORD, zFunc uintptr, zPath uintptr, iLine int32) int32 { /* sqlite3.c:44441:12: */ - bp := tls.Alloc(548) - defer tls.Free(548) + bp := tls.Alloc(540) + defer tls.Free(540) - // var zMsg [500]int8 at bp+48, 500 + // var zMsg [500]int8 at bp+40, 500 // Human readable error text var i int32 // Loop counter - *(*int8)(unsafe.Pointer(bp + 48 /* &zMsg[0] */)) = int8(0) - winGetLastErrorMsg(tls, lastErrno, int32(unsafe.Sizeof([500]int8{})), bp+48 /* &zMsg[0] */) + *(*int8)(unsafe.Pointer(bp + 40 /* &zMsg[0] */)) = int8(0) + winGetLastErrorMsg(tls, lastErrno, int32(unsafe.Sizeof([500]int8{})), bp+40 /* &zMsg[0] */) if zPath == uintptr(0) { - zPath = ts + 740 /* "" */ + zPath = ts + 755 /* "" */ } - for i = 0; ((*(*int8)(unsafe.Pointer(bp + 48 /* &zMsg[0] */ + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 48 /* &zMsg[0] */ + uintptr(i)))) != '\r')) && (int32(*(*int8)(unsafe.Pointer(bp + 48 /* &zMsg[0] */ + uintptr(i)))) != '\n'); i++ { + for i = 0; ((*(*int8)(unsafe.Pointer(bp + 40 /* &zMsg[0] */ + uintptr(i))) != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 40 /* &zMsg[0] */ + uintptr(i)))) != '\r')) && (int32(*(*int8)(unsafe.Pointer(bp + 40 /* &zMsg[0] */ + uintptr(i)))) != '\n'); i++ { } - *(*int8)(unsafe.Pointer(bp + 48 /* &zMsg[0] */ + uintptr(i))) = int8(0) + *(*int8)(unsafe.Pointer(bp + 40 /* &zMsg[0] */ + uintptr(i))) = int8(0) Xsqlite3_log(tls, errcode, - ts+3638, /* "os_win.c:%d: (%l..." */ - libc.VaList(bp, iLine, lastErrno, zFunc, zPath, bp+48 /* &zMsg[0] */)) + ts+3653, /* "os_win.c:%d: (%l..." */ + libc.VaList(bp, iLine, lastErrno, zFunc, zPath, bp+40 /* &zMsg[0] */)) return errcode } @@ -68946,12 +69452,12 @@ func winRetryIoerr(tls *libc.TLS, pnRetry uintptr, pError uintptr) int32 { /* sq // Log a I/O error retry episode. func winLogIoerr(tls *libc.TLS, nRetry int32, lineno int32) { /* sqlite3.c:44540:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if nRetry != 0 { Xsqlite3_log(tls, SQLITE_NOTICE, - ts+3669, /* "delayed %dms for..." */ + ts+3684, /* "delayed %dms for..." */ libc.VaList(bp, (((winIoerrRetryDelay*nRetry)*(nRetry+1))/2), lineno)) } } @@ -69032,7 +69538,7 @@ func winSeekFile(tls *libc.TLS, pFile uintptr, iOffset Sqlite3_int64) int32 { /* if (dwRet == (libc.Uint32(libc.Uint32FromInt32(-1)))) && ((libc.AssignUint32(&lastErrno, (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls))) != DWORD(0)) { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = lastErrno - winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(22) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3719 /* "winSeekFile" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 44971) + winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(22) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3734 /* "winSeekFile" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 44971) return 1 } @@ -69066,7 +69572,7 @@ func winClose(tls *libc.TLS, id uintptr) int32 { /* sqlite3.c:45020:12: */ if rc != 0 { return SQLITE_OK } - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3731 /* "winClose" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45067) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(16) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3746 /* "winClose" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45067) } // Read data from a file into a buffer. Return SQLITE_OK if all @@ -69110,7 +69616,7 @@ func winRead(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Sqlite3_ } (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = *(*DWORD)(unsafe.Pointer(bp + 40 /* lastErrno */)) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(1) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3740 /* "winRead" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45135) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(1) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3755 /* "winRead" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45135) } winLogIoerr(tls, *(*int32)(unsafe.Pointer(bp + 36 /* nRetry */)), 45138) if *(*DWORD)(unsafe.Pointer(bp + 32 /* nRead */)) < DWORD(amt) { @@ -69175,10 +69681,10 @@ func winWrite(tls *libc.TLS, id uintptr, pBuf uintptr, amt int32, offset Sqlite3 if ((*WinFile)(unsafe.Pointer(pFile)).FlastErrno == DWORD(39)) || ((*WinFile)(unsafe.Pointer(pFile)).FlastErrno == DWORD(112)) { - return winLogErrorAtLine(tls, SQLITE_FULL, (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3748 /* "winWrite1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45247) + return winLogErrorAtLine(tls, SQLITE_FULL, (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3763 /* "winWrite1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45247) } - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(3) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3758 /* "winWrite2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45252) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(3) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3773 /* "winWrite2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45252) } else { winLogIoerr(tls, *(*int32)(unsafe.Pointer(bp + 36 /* nRetry */)), 45255) } @@ -69229,10 +69735,10 @@ func winTruncate(tls *libc.TLS, id uintptr, nByte Sqlite3_int64) int32 { /* sqli // SetEndOfFile() returns non-zero when successful, or zero when it fails. if winSeekFile(tls, pFile, nByte) != 0 { - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3768 /* "winTruncate1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45318) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3783 /* "winTruncate1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45318) } else if (0 == (*(*func(*libc.TLS, HANDLE) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 53*24 + 8 /* &.pCurrent */))))(tls, (*WinFile)(unsafe.Pointer(pFile)).Fh)) && ((libc.AssignUint32(&lastErrno, (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls))) != DWORD(1224)) { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = lastErrno - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3781 /* "winTruncate2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45323) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(6) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3796 /* "winTruncate2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45323) } if (rc == SQLITE_OK) && (oldMmapSize > int64(0)) { @@ -69269,7 +69775,7 @@ func winSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:45354: } else { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3794 /* "winSync1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45415) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3809 /* "winSync1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45415) } } rc = (*(*func(*libc.TLS, HANDLE) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 13*24 + 8 /* &.pCurrent */))))(tls, (*WinFile)(unsafe.Pointer(pFile)).Fh) @@ -69280,7 +69786,7 @@ func winSync(tls *libc.TLS, id uintptr, flags int32) int32 { /* sqlite3.c:45354: } else { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3803 /* "winSync2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45430) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(4) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3818 /* "winSync2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45430) } return int32(0) } @@ -69304,7 +69810,7 @@ func winFileSize(tls *libc.TLS, id uintptr, pSize uintptr) int32 { /* sqlite3.c: if (lowerBits == (0xffffffff)) && ((libc.AssignUint32(&lastErrno, (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls))) != DWORD(0)) { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = lastErrno - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(7) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3812 /* "winFileSize" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45471) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(7) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3827 /* "winFileSize" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45471) } } @@ -69363,7 +69869,7 @@ func winUnlockReadLock(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:45552: } if (res == 0) && ((libc.AssignUint32(&lastErrno, (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls))) != DWORD(158)) { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = lastErrno - winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(8) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3824 /* "winUnlockReadLoc..." */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45566) + winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(8) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3839 /* "winUnlockReadLoc..." */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45566) } return res @@ -69553,7 +70059,7 @@ func winUnlock(tls *libc.TLS, id uintptr, locktype int32) int32 { /* sqlite3.c:4 if (locktype == SHARED_LOCK) && !(winGetReadLock(tls, pFile) != 0) { // This should never happen. We should always be able to // reacquire the read lock - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(8) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3842 /* "winUnlock" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45792) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(8) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3857 /* "winUnlock" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 45792) } } if type1 >= RESERVED_LOCK { @@ -69625,8 +70131,8 @@ func winModeBit(tls *libc.TLS, pFile uintptr, mask uint8, pArg uintptr) { /* sql // Control and query of the open file handle. func winFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:45874:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var pFile uintptr = id @@ -69655,12 +70161,12 @@ func winFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { / case SQLITE_FCNTL_SIZE_HINT: { if (*WinFile)(unsafe.Pointer(pFile)).FszChunk > 0 { - // var oldSz Sqlite3_int64 at bp+16, 8 + // var oldSz Sqlite3_int64 at bp+8, 8 - var rc int32 = winFileSize(tls, id, bp+16 /* &oldSz */) + var rc int32 = winFileSize(tls, id, bp+8 /* &oldSz */) if rc == SQLITE_OK { var newSz Sqlite3_int64 = *(*Sqlite3_int64)(unsafe.Pointer(pArg)) - if newSz > *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* oldSz */)) { + if newSz > *(*Sqlite3_int64)(unsafe.Pointer(bp + 8 /* oldSz */)) { rc = winTruncate(tls, id, newSz) @@ -69689,7 +70195,7 @@ func winFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { / } case SQLITE_FCNTL_VFSNAME: { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*WinFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, (*Sqlite3_vfs)(unsafe.Pointer((*WinFile)(unsafe.Pointer(pFile)).FpVfs)).FzName)) return SQLITE_OK @@ -69721,10 +70227,10 @@ func winFileControl(tls *libc.TLS, id uintptr, op int32, pArg uintptr) int32 { / } case SQLITE_FCNTL_TEMPFILENAME: { - *(*uintptr)(unsafe.Pointer(bp + 24 /* zTFile */)) = uintptr(0) - var rc int32 = winGetTempname(tls, (*WinFile)(unsafe.Pointer(pFile)).FpVfs, bp+24 /* &zTFile */) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zTFile */)) = uintptr(0) + var rc int32 = winGetTempname(tls, (*WinFile)(unsafe.Pointer(pFile)).FpVfs, bp+16 /* &zTFile */) if rc == SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pArg)) = *(*uintptr)(unsafe.Pointer(bp + 24 /* zTFile */)) + *(*uintptr)(unsafe.Pointer(pArg)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* zTFile */)) } return rc @@ -69936,7 +70442,7 @@ func winLockSharedMemory(tls *libc.TLS, pShmNode uintptr) int32 { /* sqlite3.c:4 return (SQLITE_READONLY | (int32(5) << 8)) } else if winTruncate(tls, (pShmNode+16 /* &.hFile */), int64(0)) != 0 { winShmSystemLock(tls, pShmNode, WINSHM_UNLCK, (((22 + SQLITE_SHM_NLOCK) * 4) + SQLITE_SHM_NLOCK), 1) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3852 /* "winLockSharedMem..." */, (*WinShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 46258) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(18) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3867 /* "winLockSharedMem..." */, (*WinShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 46258) } } @@ -69953,8 +70459,8 @@ func winLockSharedMemory(tls *libc.TLS, pShmNode uintptr) int32 { /* sqlite3.c:4 // file are currently open, in this process or in other processes, then // the file must be truncated to zero length or have its header cleared. func winOpenSharedMemory(tls *libc.TLS, pDbFd uintptr) int32 { /* sqlite3.c:46277:12: */ - bp := tls.Alloc(20) - defer tls.Free(20) + bp := tls.Alloc(12) + defer tls.Free(12) var p uintptr // The connection to be opened var pShmNode uintptr // The underlying mmapped file @@ -69962,7 +70468,7 @@ func winOpenSharedMemory(tls *libc.TLS, pDbFd uintptr) int32 { /* sqlite3.c:4627 var pNew uintptr // Newly allocated winShmNode var nName int32 var inFlags int32 - // var outFlags int32 at bp+16, 4 + // var outFlags int32 at bp+8, 4 pShmNode = uintptr(0) rc = SQLITE_OK // Size of zName in bytes @@ -69987,7 +70493,7 @@ __1: __2: ; (*WinShmNode)(unsafe.Pointer(pNew)).FzFilename = (pNew + 1*160) - Xsqlite3_snprintf(tls, (nName + 15), (*WinShmNode)(unsafe.Pointer(pNew)).FzFilename, ts+3872 /* "%s-shm" */, libc.VaList(bp, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath)) + Xsqlite3_snprintf(tls, (nName + 15), (*WinShmNode)(unsafe.Pointer(pNew)).FzFilename, ts+3887 /* "%s-shm" */, libc.VaList(bp, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath)) // Look to see if there is an existing winShmNode that can be used. // If no matching winShmNode currently exists, create a new one. @@ -70019,7 +70525,7 @@ __5: goto __8 __7: inFlags = SQLITE_OPEN_WAL - *(*int32)(unsafe.Pointer(bp + 16 /* outFlags */)) = 0 + *(*int32)(unsafe.Pointer(bp + 8 /* outFlags */)) = 0 pShmNode = pNew pNew = uintptr(0) @@ -70041,7 +70547,7 @@ __10: __9: ; - if !(0 == Xsqlite3_uri_boolean(tls, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, ts+3879 /* "readonly_shm" */, 0)) { + if !(0 == Xsqlite3_uri_boolean(tls, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, ts+3894 /* "readonly_shm" */, 0)) { goto __11 } inFlags = inFlags | (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) @@ -70052,15 +70558,15 @@ __12: ; rc = winOpen(tls, (*WinFile)(unsafe.Pointer(pDbFd)).FpVfs, (*WinShmNode)(unsafe.Pointer(pShmNode)).FzFilename, (pShmNode + 16 /* &.hFile */), - inFlags, bp+16 /* &outFlags */) + inFlags, bp+8 /* &outFlags */) if !(rc != SQLITE_OK) { goto __13 } - rc = winLogErrorAtLine(tls, rc, (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3892 /* "winOpenShm" */, (*WinShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 46340) + rc = winLogErrorAtLine(tls, rc, (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3907 /* "winOpenShm" */, (*WinShmNode)(unsafe.Pointer(pShmNode)).FzFilename, 46340) goto shm_open_err __13: ; - if !(*(*int32)(unsafe.Pointer(bp + 16 /* outFlags */)) == SQLITE_OPEN_READONLY) { + if !(*(*int32)(unsafe.Pointer(bp + 8 /* outFlags */)) == SQLITE_OPEN_READONLY) { goto __14 } (*WinShmNode)(unsafe.Pointer(pShmNode)).FisReadonly = U8(1) @@ -70333,7 +70839,7 @@ __3: if !(rc != SQLITE_OK) { goto __6 } - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3903 /* "winShmMap1" */, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, 46607) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3918 /* "winShmMap1" */, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, 46607) goto shmpage_out __6: ; @@ -70356,7 +70862,7 @@ __8: if !(rc != SQLITE_OK) { goto __9 } - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3914 /* "winShmMap2" */, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, 46622) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(19) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+3929 /* "winShmMap2" */, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, 46622) goto shmpage_out __9: ; @@ -70407,7 +70913,7 @@ __14: goto __15 } (*WinShmNode)(unsafe.Pointer(pShmNode)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), (*WinShmNode)(unsafe.Pointer(pShmNode)).FlastErrno, ts+3925 /* "winShmMap3" */, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, 46681) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(21) << 8)), (*WinShmNode)(unsafe.Pointer(pShmNode)).FlastErrno, ts+3940 /* "winShmMap3" */, (*WinFile)(unsafe.Pointer(pDbFd)).FzPath, 46681) if !(hMap != 0) { goto __16 } @@ -70457,7 +70963,7 @@ func winUnmapfile(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:46718:12: * if !((*(*func(*libc.TLS, LPCVOID) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 59*24 + 8 /* &.pCurrent */))))(tls, (*WinFile)(unsafe.Pointer(pFile)).FpMapRegion) != 0) { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3936 /* "winUnmapfile1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 46730) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3951 /* "winUnmapfile1" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 46730) } (*WinFile)(unsafe.Pointer(pFile)).FpMapRegion = uintptr(0) (*WinFile)(unsafe.Pointer(pFile)).FmmapSize = int64(0) @@ -70466,7 +70972,7 @@ func winUnmapfile(tls *libc.TLS, pFile uintptr) int32 { /* sqlite3.c:46718:12: * if !((*(*func(*libc.TLS, HANDLE) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, (*WinFile)(unsafe.Pointer(pFile)).FhMap) != 0) { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3950 /* "winUnmapfile2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 46741) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+3965 /* "winUnmapfile2" */, (*WinFile)(unsafe.Pointer(pFile)).FzPath, 46741) } (*WinFile)(unsafe.Pointer(pFile)).FhMap = uintptr(0) } @@ -70525,7 +71031,7 @@ func winMapfile(tls *libc.TLS, pFd uintptr, nByte Sqlite3_int64) int32 { /* sqli (DWORD(*(*Sqlite3_int64)(unsafe.Pointer(bp /* nMap */)) & int64(0xffffffff))), uintptr(0)) if (*WinFile)(unsafe.Pointer(pFd)).FhMap == (uintptr(0)) { (*WinFile)(unsafe.Pointer(pFd)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFd)).FlastErrno, ts+3964 /* "winMapfile1" */, (*WinFile)(unsafe.Pointer(pFd)).FzPath, 46818) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFd)).FlastErrno, ts+3979 /* "winMapfile1" */, (*WinFile)(unsafe.Pointer(pFd)).FzPath, 46818) // Log the error, but continue normal operation using xRead/xWrite return SQLITE_OK @@ -70536,7 +71042,7 @@ func winMapfile(tls *libc.TLS, pFd uintptr, nByte Sqlite3_int64) int32 { /* sqli (*(*func(*libc.TLS, HANDLE) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*24 + 8 /* &.pCurrent */))))(tls, (*WinFile)(unsafe.Pointer(pFd)).FhMap) (*WinFile)(unsafe.Pointer(pFd)).FhMap = uintptr(0) (*WinFile)(unsafe.Pointer(pFd)).FlastErrno = (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls) - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFd)).FlastErrno, ts+3976 /* "winMapfile2" */, (*WinFile)(unsafe.Pointer(pFd)).FzPath, 46836) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(24) << 8)), (*WinFile)(unsafe.Pointer(pFd)).FlastErrno, ts+3991 /* "winMapfile2" */, (*WinFile)(unsafe.Pointer(pFd)).FzPath, 46836) // Log the error, but continue normal operation using xRead/xWrite return SQLITE_OK @@ -70717,12 +71223,12 @@ func winMakeEndInDirSep(tls *libc.TLS, nBuf int32, zBuf uintptr) int32 { /* sqli // Create a temporary file name and store the resulting pointer into pzBuf. // The pointer returned in pzBuf must be freed via sqlite3_free(). func winGetTempname(tls *libc.TLS, pVfs uintptr, pzBuf uintptr) int32 { /* sqlite3.c:47083:12: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(24) + defer tls.Free(24) var i Size_t var j Size_t - var nPre int32 = Xsqlite3Strlen30(tls, ts+3988 /* "etilqs_" */) + var nPre int32 = Xsqlite3Strlen30(tls, ts+4003 /* "etilqs_" */) var nMax int32 var nBuf int32 var nDir int32 @@ -70757,9 +71263,9 @@ func winGetTempname(tls *libc.TLS, pVfs uintptr, pzBuf uintptr) int32 { /* sqlit if nDirLen > nDir { Xsqlite3_free(tls, zBuf) - return winLogErrorAtLine(tls, SQLITE_ERROR, uint32(0), ts+3996 /* "winGetTempname1" */, uintptr(0), 47124) + return winLogErrorAtLine(tls, SQLITE_ERROR, uint32(0), ts+4011 /* "winGetTempname1" */, uintptr(0), 47124) } - Xsqlite3_snprintf(tls, nMax, zBuf, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_temp_directory)) + Xsqlite3_snprintf(tls, nMax, zBuf, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_temp_directory)) } } else if (sqlite3_os_type == 2) || (Xsqlite3_win32_is_nt(tls) != 0) { var zMulti uintptr @@ -70773,11 +71279,11 @@ func winGetTempname(tls *libc.TLS, pVfs uintptr, pzBuf uintptr) int32 { /* sqlit Xsqlite3_free(tls, zWidePath) Xsqlite3_free(tls, zBuf) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(25) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4012 /* "winGetTempname2" */, uintptr(0), 47222) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(25) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4027 /* "winGetTempname2" */, uintptr(0), 47222) } zMulti = winUnicodeToUtf8(tls, zWidePath) if zMulti != 0 { - Xsqlite3_snprintf(tls, nMax, zBuf, ts+3615 /* "%s" */, libc.VaList(bp+16, zMulti)) + Xsqlite3_snprintf(tls, nMax, zBuf, ts+3630 /* "%s" */, libc.VaList(bp+8, zMulti)) Xsqlite3_free(tls, zMulti) Xsqlite3_free(tls, zWidePath) } else { @@ -70797,11 +71303,11 @@ func winGetTempname(tls *libc.TLS, pVfs uintptr, pzBuf uintptr) int32 { /* sqlit if (*(*func(*libc.TLS, DWORD, LPSTR) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 31*24 + 8 /* &.pCurrent */))))(tls, uint32(nMax), zMbcsPath) == DWORD(0) { Xsqlite3_free(tls, zBuf) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(25) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4028 /* "winGetTempname3" */, uintptr(0), 47249) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(25) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4043 /* "winGetTempname3" */, uintptr(0), 47249) } zUtf8 = winMbcsToUtf8(tls, zMbcsPath, (*(*func(*libc.TLS) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls)) if zUtf8 != 0 { - Xsqlite3_snprintf(tls, nMax, zBuf, ts+3615 /* "%s" */, libc.VaList(bp+32, zUtf8)) + Xsqlite3_snprintf(tls, nMax, zBuf, ts+3630 /* "%s" */, libc.VaList(bp+16, zUtf8)) Xsqlite3_free(tls, zUtf8) } else { Xsqlite3_free(tls, zBuf) @@ -70816,7 +71322,7 @@ func winGetTempname(tls *libc.TLS, pVfs uintptr, pzBuf uintptr) int32 { /* sqlit if !(winMakeEndInDirSep(tls, (nDir+1), zBuf) != 0) { Xsqlite3_free(tls, zBuf) - return winLogErrorAtLine(tls, SQLITE_ERROR, uint32(0), ts+4044 /* "winGetTempname4" */, uintptr(0), 47273) + return winLogErrorAtLine(tls, SQLITE_ERROR, uint32(0), ts+4059 /* "winGetTempname4" */, uintptr(0), 47273) } // Check that the output buffer is large enough for the temporary file @@ -70832,10 +71338,10 @@ func winGetTempname(tls *libc.TLS, pVfs uintptr, pzBuf uintptr) int32 { /* sqlit if ((nLen + nPre) + 17) > nBuf { Xsqlite3_free(tls, zBuf) - return winLogErrorAtLine(tls, SQLITE_ERROR, uint32(0), ts+4060 /* "winGetTempname5" */, uintptr(0), 47291) + return winLogErrorAtLine(tls, SQLITE_ERROR, uint32(0), ts+4075 /* "winGetTempname5" */, uintptr(0), 47291) } - Xsqlite3_snprintf(tls, ((nBuf - 16) - nLen), (zBuf + uintptr(nLen)), ts+3988 /* "etilqs_" */, 0) + Xsqlite3_snprintf(tls, ((nBuf - 16) - nLen), (zBuf + uintptr(nLen)), ts+4003 /* "etilqs_" */, 0) j = Size_t(Xsqlite3Strlen30(tls, zBuf)) Xsqlite3_randomness(tls, 15, (zBuf + uintptr(j))) @@ -70863,7 +71369,7 @@ __3: return SQLITE_OK } -var zChars = *(*[63]int8)(unsafe.Pointer(ts + 4076 /* "abcdefghijklmnop..." */)) /* sqlite3.c:47084:15 */ +var zChars = *(*[63]int8)(unsafe.Pointer(ts + 4091 /* "abcdefghijklmnop..." */)) /* sqlite3.c:47084:15 */ // Return TRUE if the named file is really a directory. Return false if // it is something other than a directory, or if there is any kind of memory @@ -70991,7 +71497,7 @@ func winOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, id uintptr, flags int32 dwCreationDisposition = DWORD(OPEN_EXISTING) } - if 0 == Xsqlite3_uri_boolean(tls, zName, ts+4139 /* "exclusive" */, 0) { + if 0 == Xsqlite3_uri_boolean(tls, zName, ts+4154 /* "exclusive" */, 0) { dwShareMode = (DWORD(FILE_SHARE_READ | FILE_SHARE_WRITE)) } else { dwShareMode = DWORD(0) @@ -71063,7 +71569,7 @@ func winOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, id uintptr, flags int32 pOutFlags) } else { (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = *(*DWORD)(unsafe.Pointer(bp + 12 /* lastErrno */)) - winLogErrorAtLine(tls, SQLITE_CANTOPEN, (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+4149 /* "winOpen" */, zUtf8Name, 47595) + winLogErrorAtLine(tls, SQLITE_CANTOPEN, (*WinFile)(unsafe.Pointer(pFile)).FlastErrno, ts+4164 /* "winOpen" */, zUtf8Name, 47595) return Xsqlite3CantopenError(tls, 47596) } } @@ -71096,7 +71602,7 @@ func winOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, id uintptr, flags int32 *(*U8)(unsafe.Pointer(pFile + 28 /* &.ctrlFlags */)) |= U8((WINFILE_RDONLY)) } if ((flags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+4157 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+4172 /* "psow" */, SQLITE_POWERSAFE_OVERWRITE) != 0) { *(*U8)(unsafe.Pointer(pFile + 28 /* &.ctrlFlags */)) |= U8((WINFILE_PSOW)) } (*WinFile)(unsafe.Pointer(pFile)).FlastErrno = DWORD(0) @@ -71190,7 +71696,7 @@ func winDelete(tls *libc.TLS, pVfs uintptr, zFilename uintptr, syncDir int32) in } } if (rc != 0) && (rc != (SQLITE_IOERR | (int32(23) << 8))) { - rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), *(*DWORD)(unsafe.Pointer(bp + 4 /* lastErrno */)), ts+4162 /* "winDelete" */, zFilename, 47768) + rc = winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(10) << 8)), *(*DWORD)(unsafe.Pointer(bp + 4 /* lastErrno */)), ts+4177 /* "winDelete" */, zFilename, 47768) } else { winLogIoerr(tls, *(*int32)(unsafe.Pointer(bp /* cnt */)), 47770) } @@ -71238,7 +71744,7 @@ func winAccess(tls *libc.TLS, pVfs uintptr, zFilename uintptr, flags int32, pRes winLogIoerr(tls, *(*int32)(unsafe.Pointer(bp + 36 /* cnt */)), 47820) if (*(*DWORD)(unsafe.Pointer(bp + 40 /* lastErrno */)) != DWORD(2)) && (*(*DWORD)(unsafe.Pointer(bp + 40 /* lastErrno */)) != DWORD(3)) { Xsqlite3_free(tls, zConverted) - return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(13) << 8)), *(*DWORD)(unsafe.Pointer(bp + 40 /* lastErrno */)), ts+4172 /* "winAccess" */, zFilename, 47823) + return winLogErrorAtLine(tls, (SQLITE_IOERR | (int32(13) << 8)), *(*DWORD)(unsafe.Pointer(bp + 40 /* lastErrno */)), ts+4187 /* "winAccess" */, zFilename, 47823) } else { attr = libc.Uint32(libc.Uint32FromInt32(-1)) } @@ -71308,8 +71814,8 @@ func winIsVerbatimPathname(tls *libc.TLS, zPathname uintptr) WINBOOL { /* sqlite // pathname into zOut[]. zOut[] will be at least pVfs->mxPathname // bytes in size. func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32, zFull uintptr) int32 { /* sqlite3.c:47917:12: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) var nByte DWORD var zConverted uintptr @@ -71337,7 +71843,7 @@ func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32 return nFull } return (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname - }(), zFull, ts+4182, /* "%s%c%s" */ + }(), zFull, ts+4197, /* "%s%c%s" */ libc.VaList(bp, Xsqlite3_data_directory, '\\', zRelative)) return SQLITE_OK } @@ -71350,7 +71856,7 @@ func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32 nByte = (*(*func(*libc.TLS, LPCWSTR, DWORD, LPWSTR, uintptr) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 25*24 + 8 /* &.pCurrent */))))(tls, zConverted, uint32(0), uintptr(0), uintptr(0)) if nByte == DWORD(0) { Xsqlite3_free(tls, zConverted) - return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4189 /* "winFullPathname1" */, zRelative, 48040) + return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4204 /* "winFullPathname1" */, zRelative, 48040) } nByte = nByte + (DWORD(3)) zTemp = Xsqlite3MallocZero(tls, (uint64(nByte) * uint64(unsafe.Sizeof(WCHAR(0))))) @@ -71362,7 +71868,7 @@ func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32 if nByte == DWORD(0) { Xsqlite3_free(tls, zConverted) Xsqlite3_free(tls, zTemp) - return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4206 /* "winFullPathname2" */, zRelative, 48053) + return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4221 /* "winFullPathname2" */, zRelative, 48053) } Xsqlite3_free(tls, zConverted) zOut = winUnicodeToUtf8(tls, zTemp) @@ -71372,7 +71878,7 @@ func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32 nByte = (*(*func(*libc.TLS, LPCSTR, DWORD, LPSTR, uintptr) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 24*24 + 8 /* &.pCurrent */))))(tls, zConverted, uint32(0), uintptr(0), uintptr(0)) if nByte == DWORD(0) { Xsqlite3_free(tls, zConverted) - return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4223 /* "winFullPathname3" */, zRelative, 48066) + return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4238 /* "winFullPathname3" */, zRelative, 48066) } nByte = nByte + (DWORD(3)) zTemp = Xsqlite3MallocZero(tls, (uint64(nByte) * uint64(unsafe.Sizeof(int8(0))))) @@ -71384,7 +71890,7 @@ func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32 if nByte == DWORD(0) { Xsqlite3_free(tls, zConverted) Xsqlite3_free(tls, zTemp) - return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4240 /* "winFullPathname4" */, zRelative, 48079) + return winLogErrorAtLine(tls, (SQLITE_CANTOPEN | (int32(3) << 8)), (*(*func(*libc.TLS) DWORD)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 26*24 + 8 /* &.pCurrent */))))(tls), ts+4255 /* "winFullPathname4" */, zRelative, 48079) } Xsqlite3_free(tls, zConverted) zOut = winMbcsToUtf8(tls, zTemp, (*(*func(*libc.TLS) WINBOOL)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.pCurrent */))))(tls)) @@ -71396,7 +71902,7 @@ func winFullPathname(tls *libc.TLS, pVfs uintptr, zRelative uintptr, nFull int32 return nFull } return (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname - }(), zFull, ts+3615 /* "%s" */, libc.VaList(bp+32, zOut)) + }(), zFull, ts+3630 /* "%s" */, libc.VaList(bp+24, zOut)) Xsqlite3_free(tls, zOut) return SQLITE_OK } else { @@ -71635,7 +72141,7 @@ var winVfs = Sqlite3_vfs{ FiVersion: 3, // iVersion FszOsFile: int32(unsafe.Sizeof(WinFile{})), // szOsFile FmxPathname: ((MAX_PATH) * 4), // pNext - FzName: ts + 4257, /* "win32" */ // zName + FzName: ts + 4272, /* "win32" */ // zName FpAppData: 0, // pAppData FxOpen: 0, // xOpen FxDelete: 0, // xDelete @@ -71658,7 +72164,7 @@ var winLongPathVfs = Sqlite3_vfs{ FiVersion: 3, // iVersion FszOsFile: int32(unsafe.Sizeof(WinFile{})), // szOsFile FmxPathname: (int32(uint64(unsafe.Sizeof(WCHAR(0))) * (uint64(32767)))), // pNext - FzName: ts + 4263, /* "win32-longpath" */ // zName + FzName: ts + 4278, /* "win32-longpath" */ // zName FpAppData: 0, // pAppData FxOpen: 0, // xOpen FxDelete: 0, // xDelete @@ -71681,7 +72187,7 @@ var winNolockVfs = Sqlite3_vfs{ FiVersion: 3, // iVersion FszOsFile: int32(unsafe.Sizeof(WinFile{})), // szOsFile FmxPathname: ((MAX_PATH) * 4), // pNext - FzName: ts + 4278, /* "win32-none" */ // zName + FzName: ts + 4293, /* "win32-none" */ // zName FpAppData: 0, // pAppData FxOpen: 0, // xOpen FxDelete: 0, // xDelete @@ -71704,7 +72210,7 @@ var winLongPathNolockVfs = Sqlite3_vfs{ FiVersion: 3, // iVersion FszOsFile: int32(unsafe.Sizeof(WinFile{})), // szOsFile FmxPathname: (int32(uint64(unsafe.Sizeof(WCHAR(0))) * (uint64(32767)))), // pNext - FzName: ts + 4289, /* "win32-longpath-n..." */ // zName + FzName: ts + 4304, /* "win32-longpath-n..." */ // zName FpAppData: 0, // pAppData FxOpen: 0, // xOpen FxDelete: 0, // xDelete @@ -71797,7 +72303,7 @@ var memdb_g MemFS /* sqlite3.c:48620:3: */ var memdb_vfs = Sqlite3_vfs{ FiVersion: 2, // szOsFile (set when registered) FmxPathname: 1024, // pNext - FzName: ts + 4309, /* "memdb" */ // pAppData (set when registered) + FzName: ts + 4324, /* "memdb" */ // pAppData (set when registered) FxOpen: 0, /* memdbDelete, */ // xDelete FxAccess: 0, // xAccess FxFullPathname: 0, // xFullPathname @@ -72022,14 +72528,14 @@ func memdbLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* sqlite3.c:4 // File control method. For custom operations on an memdb-file. func memdbFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:48940:12: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var p uintptr = (*MemFile)(unsafe.Pointer(pFile)).FpStore var rc int32 = SQLITE_NOTFOUND memdbEnter(tls, p) if op == SQLITE_FCNTL_VFSNAME { - *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+4315 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) + *(*uintptr)(unsafe.Pointer(pArg)) = Xsqlite3_mprintf(tls, ts+4330 /* "memdb(%p,%lld)" */, libc.VaList(bp, (*MemStore)(unsafe.Pointer(p)).FaData, (*MemStore)(unsafe.Pointer(p)).Fsz)) rc = SQLITE_OK } if op == SQLITE_FCNTL_SIZE_LIMIT { @@ -72168,11 +72674,11 @@ func memdbAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOu // to the pathname in zPath. zOut is guaranteed to point to a buffer // of at least (INST_MAX_PATHNAME+1) bytes. func memdbFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* sqlite3.c:49133:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) _ = pVfs - Xsqlite3_snprintf(tls, nOut, zOut, ts+3615 /* "%s" */, libc.VaList(bp, zPath)) + Xsqlite3_snprintf(tls, nOut, zOut, ts+3630 /* "%s" */, libc.VaList(bp, zPath)) return SQLITE_OK } @@ -72244,15 +72750,15 @@ func memdbFromDbSchema(tls *libc.TLS, db uintptr, zSchema uintptr) uintptr { /* // Return the serialization of a database func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintptr, mFlags uint32) uintptr { /* sqlite3.c:49226:26: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var p uintptr var iDb int32 var pBt uintptr var sz Sqlite3_int64 var szPage int32 = 0 - *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) var pOut uintptr var zSql uintptr var rc int32 @@ -72289,9 +72795,9 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp return uintptr(0) } szPage = Xsqlite3BtreeGetPageSize(tls, pBt) - zSql = Xsqlite3_mprintf(tls, ts+4330 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+4345 /* "PRAGMA \"%w\".page..." */, libc.VaList(bp, zSchema)) if zSql != 0 { - rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0)) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) } else { rc = SQLITE_NOMEM } @@ -72299,11 +72805,11 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp if rc != 0 { return uintptr(0) } - rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) if rc != SQLITE_ROW { pOut = uintptr(0) } else { - sz = (Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) * Sqlite_int64(szPage)) + sz = (Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) * Sqlite_int64(szPage)) if piSize != 0 { *(*Sqlite3_int64)(unsafe.Pointer(piSize)) = sz } @@ -72312,40 +72818,40 @@ func Xsqlite3_serialize(tls *libc.TLS, db uintptr, zSchema uintptr, piSize uintp } else { pOut = Xsqlite3_malloc64(tls, uint64(sz)) if pOut != 0 { - var nPage int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) + var nPage int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) var pPager uintptr = Xsqlite3BtreePager(tls, pBt) var pgno int32 for pgno = 1; pgno <= nPage; pgno++ { - *(*uintptr)(unsafe.Pointer(bp + 24 /* pPage */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pPage */)) = uintptr(0) var pTo uintptr = (pOut + uintptr((Sqlite3_int64(szPage) * (Sqlite3_int64(pgno - 1))))) - rc = Xsqlite3PagerGet(tls, pPager, uint32(pgno), bp+24 /* &pPage */, 0) + rc = Xsqlite3PagerGet(tls, pPager, uint32(pgno), bp+16 /* &pPage */, 0) if rc == SQLITE_OK { - libc.Xmemcpy(tls, pTo, Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPage */))), uint64(szPage)) + libc.Xmemcpy(tls, pTo, Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pPage */))), uint64(szPage)) } else { libc.Xmemset(tls, pTo, 0, uint64(szPage)) } - Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPage */))) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pPage */))) } } } } - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) return pOut } // Convert zSchema to a MemDB and initialize its content. func Xsqlite3_deserialize(tls *libc.TLS, db uintptr, zSchema uintptr, pData uintptr, szDb Sqlite3_int64, szBuf Sqlite3_int64, mFlags uint32) int32 { /* sqlite3.c:49307:16: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var p uintptr var zSql uintptr - // var pStmt uintptr at bp+16, 8 + // var pStmt uintptr at bp+8, 8 var rc int32 var iDb int32 var pStore uintptr - *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) if !(zSchema == uintptr(0)) { @@ -72362,14 +72868,14 @@ __1: goto end_deserialize __2: ; - zSql = Xsqlite3_mprintf(tls, ts+4353 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) + zSql = Xsqlite3_mprintf(tls, ts+4368 /* "ATTACH x AS %Q" */, libc.VaList(bp, zSchema)) if !(zSql == uintptr(0)) { goto __3 } rc = SQLITE_NOMEM goto __4 __3: - rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0)) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0)) Xsqlite3_free(tls, zSql) __4: ; @@ -72381,7 +72887,7 @@ __5: ; (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(iDb) libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.reopenMemdb */, uint32(1), 2, 0x4) - rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + rc = Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.reopenMemdb */, uint32(0), 2, 0x4) if !(rc != SQLITE_DONE) { goto __6 @@ -72415,7 +72921,7 @@ __8: ; end_deserialize: - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) if !((pData != 0) && ((mFlags & uint32(SQLITE_DESERIALIZE_FREEONCLOSE)) != uint32(0))) { goto __10 } @@ -74556,8 +75062,8 @@ func pcache1Destroy(tls *libc.TLS, p uintptr) { /* sqlite3.c:51864:13: */ // install the default pluggable cache module, assuming the user has not // already provided an alternative. func Xsqlite3PCacheSetDefault(tls *libc.TLS) { /* sqlite3.c:51887:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp, uintptr(unsafe.Pointer(&defaultMethods1)))) } @@ -77578,35 +78084,35 @@ func setSectorSize(tls *libc.TLS, pPager uintptr) { /* sqlite3.c:55315:13: */ // back any content. If the journal is merely persistent, no reset is // needed. func pager_playback(tls *libc.TLS, pPager uintptr, isHot int32) int32 { /* sqlite3.c:55388:12: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(40) + defer tls.Free(40) var pVfs uintptr - // var szJ I64 at bp+24, 8 + // var szJ I64 at bp+16, 8 // Size of the journal file in bytes - // var nRec U32 at bp+36, 4 + // var nRec U32 at bp+28, 4 // Number of Records in the journal var u U32 // Unsigned loop counter - // var mxPg Pgno at bp+40, 4 + // var mxPg Pgno at bp+32, 4 // Size of the original file in pages var rc int32 // Result code of a subroutine - // var res int32 at bp+32, 4 + // var res int32 at bp+24, 4 // Value returned by sqlite3OsAccess() var zSuper uintptr // Name of super-journal file if any var needPagerReset int32 // True to reset page prior to first page rollback var nPlayback int32 // Total number of pages restored from journal - // var savedPageSize U32 at bp+44, 4 + // var savedPageSize U32 at bp+36, 4 pVfs = (*Pager)(unsafe.Pointer(pPager)).FpVfs - *(*Pgno)(unsafe.Pointer(bp + 40 /* mxPg */)) = Pgno(0) - *(*int32)(unsafe.Pointer(bp + 32 /* res */)) = 1 + *(*Pgno)(unsafe.Pointer(bp + 32 /* mxPg */)) = Pgno(0) + *(*int32)(unsafe.Pointer(bp + 24 /* res */)) = 1 zSuper = uintptr(0) nPlayback = 0 - *(*U32)(unsafe.Pointer(bp + 44 /* savedPageSize */)) = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) + *(*U32)(unsafe.Pointer(bp + 36 /* savedPageSize */)) = U32((*Pager)(unsafe.Pointer(pPager)).FpageSize) // Figure out how many records are in the journal. Abort early if // the journal is empty. - rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp+24 /* &szJ */) + rc = Xsqlite3OsFileSize(tls, (*Pager)(unsafe.Pointer(pPager)).Fjfd, bp+16 /* &szJ */) if !(rc != SQLITE_OK) { goto __1 } @@ -77629,11 +78135,11 @@ __1: if !((rc == SQLITE_OK) && (*(*int8)(unsafe.Pointer(zSuper)) != 0)) { goto __2 } - rc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+32 /* &res */) + rc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+24 /* &res */) __2: ; zSuper = uintptr(0) - if !((rc != SQLITE_OK) || !(*(*int32)(unsafe.Pointer(bp + 32 /* res */)) != 0)) { + if !((rc != SQLITE_OK) || !(*(*int32)(unsafe.Pointer(bp + 24 /* res */)) != 0)) { goto __3 } goto end_playback @@ -77653,7 +78159,7 @@ __4: // not enough bytes left in the journal file for a complete header, or // it is corrupted, then a process must have failed while writing it. // This indicates nothing more needs to be rolled back. - rc = readJournalHdr(tls, pPager, isHot, *(*I64)(unsafe.Pointer(bp + 24 /* szJ */)), bp+36 /* &nRec */, bp+40 /* &mxPg */) + rc = readJournalHdr(tls, pPager, isHot, *(*I64)(unsafe.Pointer(bp + 16 /* szJ */)), bp+28 /* &nRec */, bp+32 /* &mxPg */) if !(rc != SQLITE_OK) { goto __6 } @@ -77671,11 +78177,11 @@ __6: // working in no-sync mode. This means that the rest of the journal // file consists of pages, there are no more journal headers. Compute // the value of nRec based on this assumption. - if !(*(*U32)(unsafe.Pointer(bp + 36 /* nRec */)) == 0xffffffff) { + if !(*(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) == 0xffffffff) { goto __8 } - *(*U32)(unsafe.Pointer(bp + 36 /* nRec */)) = U32((int32((*(*I64)(unsafe.Pointer(bp + 24 /* szJ */)) - (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8))))) + *(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) = U32((int32((*(*I64)(unsafe.Pointer(bp + 16 /* szJ */)) - (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8))))) __8: ; @@ -77692,10 +78198,10 @@ __8: // the journal, it means that the journal might contain additional // pages that need to be rolled back and that the number of pages // should be computed based on the journal file size. - if !(((*(*U32)(unsafe.Pointer(bp + 36 /* nRec */)) == U32(0)) && !(isHot != 0)) && (((*Pager)(unsafe.Pointer(pPager)).FjournalHdr + (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) == (*Pager)(unsafe.Pointer(pPager)).FjournalOff)) { + if !(((*(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) == U32(0)) && !(isHot != 0)) && (((*Pager)(unsafe.Pointer(pPager)).FjournalHdr + (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) == (*Pager)(unsafe.Pointer(pPager)).FjournalOff)) { goto __9 } - *(*U32)(unsafe.Pointer(bp + 36 /* nRec */)) = U32((int32((*(*I64)(unsafe.Pointer(bp + 24 /* szJ */)) - (*Pager)(unsafe.Pointer(pPager)).FjournalOff) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8))))) + *(*U32)(unsafe.Pointer(bp + 28 /* nRec */)) = U32((int32((*(*I64)(unsafe.Pointer(bp + 16 /* szJ */)) - (*Pager)(unsafe.Pointer(pPager)).FjournalOff) / (I64(((*Pager)(unsafe.Pointer(pPager)).FpageSize) + 8))))) __9: ; @@ -77704,14 +78210,14 @@ __9: if !((*Pager)(unsafe.Pointer(pPager)).FjournalOff == (I64((*Pager)(unsafe.Pointer(pPager)).FsectorSize))) { goto __10 } - rc = pager_truncate(tls, pPager, *(*Pgno)(unsafe.Pointer(bp + 40 /* mxPg */))) + rc = pager_truncate(tls, pPager, *(*Pgno)(unsafe.Pointer(bp + 32 /* mxPg */))) if !(rc != SQLITE_OK) { goto __11 } goto end_playback __11: ; - (*Pager)(unsafe.Pointer(pPager)).FdbSize = *(*Pgno)(unsafe.Pointer(bp + 40 /* mxPg */)) + (*Pager)(unsafe.Pointer(pPager)).FdbSize = *(*Pgno)(unsafe.Pointer(bp + 32 /* mxPg */)) __10: ; @@ -77719,7 +78225,7 @@ __10: // database file and/or page cache. u = U32(0) __12: - if !(u < *(*U32)(unsafe.Pointer(bp + 36 /* nRec */))) { + if !(u < *(*U32)(unsafe.Pointer(bp + 28 /* nRec */))) { goto __14 } if !(needPagerReset != 0) { @@ -77739,7 +78245,7 @@ __16: if !(rc == SQLITE_DONE) { goto __18 } - (*Pager)(unsafe.Pointer(pPager)).FjournalOff = *(*I64)(unsafe.Pointer(bp + 24 /* szJ */)) + (*Pager)(unsafe.Pointer(pPager)).FjournalOff = *(*I64)(unsafe.Pointer(bp + 16 /* szJ */)) goto __14 goto __19 __18: @@ -77782,7 +78288,7 @@ end_playback: if !(rc == SQLITE_OK) { goto __22 } - rc = Xsqlite3PagerSetPagesize(tls, pPager, bp+44 /* &savedPageSize */, -1) + rc = Xsqlite3PagerSetPagesize(tls, pPager, bp+36 /* &savedPageSize */, -1) __22: ; // Following a rollback, the database file should be back in its original @@ -77826,7 +78332,7 @@ __24: __25: ; - if !(((rc == SQLITE_OK) && (*(*int8)(unsafe.Pointer(zSuper)) != 0)) && (*(*int32)(unsafe.Pointer(bp + 32 /* res */)) != 0)) { + if !(((rc == SQLITE_OK) && (*(*int8)(unsafe.Pointer(zSuper)) != 0)) && (*(*int32)(unsafe.Pointer(bp + 24 /* res */)) != 0)) { goto __26 } // If there was a super-journal and this routine will return success, @@ -77840,7 +78346,7 @@ __26: if !((isHot != 0) && (nPlayback != 0)) { goto __27 } - Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+4368, /* "recovered %d pag..." */ + Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(2) << 8)), ts+4383, /* "recovered %d pag..." */ libc.VaList(bp, nPlayback, (*Pager)(unsafe.Pointer(pPager)).FzJournal)) __27: ; @@ -79592,7 +80098,7 @@ __15: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzJournal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+4395 /* "-journal" */, uint64(8)) + libc.Xmemcpy(tls, pPtr, ts+4410 /* "-journal" */, uint64(8)) pPtr += (uintptr(8 + 1)) goto __19 __18: @@ -79607,7 +80113,7 @@ __19: (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzWal = pPtr libc.Xmemcpy(tls, pPtr, zPathname, uint64(nPathname)) pPtr += uintptr(nPathname) - libc.Xmemcpy(tls, pPtr, ts+4404 /* "-wal" */, uint64(4)) + libc.Xmemcpy(tls, pPtr, ts+4419 /* "-wal" */, uint64(4)) pPtr += (uintptr(4 + 1)) goto __21 __20: @@ -79666,9 +80172,9 @@ __27: ; __26: ; - (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+4409 /* "nolock" */, 0)) + (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FnoLock = U8(Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+4424 /* "nolock" */, 0)) if !(((iDc & SQLITE_IOCAP_IMMUTABLE) != 0) || - (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+4416 /* "immutable" */, 0) != 0)) { + (Xsqlite3_uri_boolean(tls, (*Pager)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pPager */)))).FzFilename, ts+4431 /* "immutable" */, 0) != 0)) { goto __30 } vfsFlags = vfsFlags | (SQLITE_OPEN_READONLY) @@ -83262,28 +83768,28 @@ func walIndexAppend(tls *libc.TLS, pWal uintptr, iFrame U32, iPage U32) int32 { // that this thread is running recovery. If unable to establish // the necessary locks, this routine returns SQLITE_BUSY. func walIndexRecover(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:61503:12: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(80) + defer tls.Free(80) var rc int32 // Return Code - // var nSize I64 at bp+24, 8 + // var nSize I64 at bp+16, 8 // Size of log file - // var aFrameCksum [2]U32 at bp+80, 8 + // var aFrameCksum [2]U32 at bp+72, 8 var iLock int32 var iOffset I64 - // var pgno U32 at bp+72, 4 + // var pgno U32 at bp+64, 4 // Database page number for frame - // var nTruncate U32 at bp+76, 4 + // var nTruncate U32 at bp+68, 4 - // var aShare uintptr at bp+64, 8 + // var aShare uintptr at bp+56, 8 var iFrame U32 // Index of last frame read var iLast U32 var iFirst U32 var nHdr U32 var nHdr32 U32 - // var aBuf [32]U8 at bp+32, 32 + // var aBuf [32]U8 at bp+24, 32 // Buffer to load WAL header into var aPrivate uintptr // Heap copy of *-shm hash being populated var aFrame uintptr // Malloc'd buffer to load entire frame @@ -83297,7 +83803,7 @@ func walIndexRecover(tls *libc.TLS, pWal uintptr) int32 { /* sqlite3.c:61503:12: var iLastFrame U32 var pInfo uintptr var i int32 - *(*[2]U32)(unsafe.Pointer(bp + 80 /* aFrameCksum */)) = [2]U32{U32(0), U32(0)} // Lock offset to lock for checkpoint + *(*[2]U32)(unsafe.Pointer(bp + 72 /* aFrameCksum */)) = [2]U32{U32(0), U32(0)} // Lock offset to lock for checkpoint // Obtain an exclusive lock on all byte in the locking range not already // locked by the caller. The caller is guaranteed to have locked the @@ -83316,7 +83822,7 @@ __1: libc.Xmemset(tls, (pWal + 72 /* &.hdr */), 0, uint64(unsafe.Sizeof(WalIndexHdr{}))) - rc = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+24 /* &nSize */) + rc = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+16 /* &nSize */) if !(rc != SQLITE_OK) { goto __2 } @@ -83324,14 +83830,14 @@ __1: __2: ; - if !(*(*I64)(unsafe.Pointer(bp + 24 /* nSize */)) > int64(WAL_HDRSIZE)) { + if !(*(*I64)(unsafe.Pointer(bp + 16 /* nSize */)) > int64(WAL_HDRSIZE)) { goto __3 } // Buffer to load WAL header into aPrivate = uintptr(0) // Heap copy of *-shm hash being populated aFrame = uintptr(0) // Last frame in wal, based on nSize alone // Read in the WAL header. - rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+32 /* &aBuf[0] */, WAL_HDRSIZE, int64(0)) + rc = Xsqlite3OsRead(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+24 /* &aBuf[0] */, WAL_HDRSIZE, int64(0)) if !(rc != SQLITE_OK) { goto __4 } @@ -83343,8 +83849,8 @@ __4: // SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid // data. Similarly, if the 'magic' value is invalid, ignore the whole // WAL file. - magic = Xsqlite3Get4byte(tls, (bp + 32 /* &aBuf */)) - szPage = int32(Xsqlite3Get4byte(tls, (bp + 32 /* &aBuf */ + 8))) + magic = Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */)) + szPage = int32(Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */ + 8))) if !(((((magic & 0xFFFFFFFE) != U32(WAL_MAGIC)) || ((szPage & (szPage - 1)) != 0)) || (szPage > SQLITE_MAX_PAGE_SIZE)) || @@ -83356,14 +83862,14 @@ __5: ; (*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum = (U8(magic & U32(0x00000001))) (*Wal)(unsafe.Pointer(pWal)).FszPage = U32(szPage) - (*Wal)(unsafe.Pointer(pWal)).FnCkpt = Xsqlite3Get4byte(tls, (bp + 32 /* &aBuf */ + 12)) - libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */ + 32 /* &.aSalt */), (bp + 32 /* &aBuf */ + 16), uint64(8)) + (*Wal)(unsafe.Pointer(pWal)).FnCkpt = Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */ + 12)) + libc.Xmemcpy(tls, (pWal + 72 /* &.hdr */ + 32 /* &.aSalt */), (bp + 24 /* &aBuf */ + 16), uint64(8)) // Verify that the WAL header checksum is correct walChecksumBytes(tls, (libc.Bool32(int32((*Wal)(unsafe.Pointer(pWal)).Fhdr.FbigEndCksum) == SQLITE_BIGENDIAN)), - bp+32 /* &aBuf[0] */, (WAL_HDRSIZE - (2 * 4)), uintptr(0), pWal+72 /* &.hdr */ +24 /* &.aFrameCksum */) - if !((*(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) != Xsqlite3Get4byte(tls, (bp+32 /* &aBuf */ +24))) || - (*(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) != Xsqlite3Get4byte(tls, (bp+32 /* &aBuf */ +28)))) { + bp+24 /* &aBuf[0] */, (WAL_HDRSIZE - (2 * 4)), uintptr(0), pWal+72 /* &.hdr */ +24 /* &.aFrameCksum */) + if !((*(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) != Xsqlite3Get4byte(tls, (bp+24 /* &aBuf */ +24))) || + (*(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) != Xsqlite3Get4byte(tls, (bp+24 /* &aBuf */ +28)))) { goto __6 } goto finished @@ -83372,7 +83878,7 @@ __6: // Verify that the version number on the WAL format is one that // are able to understand - version = Xsqlite3Get4byte(tls, (bp + 32 /* &aBuf */ + 4)) + version = Xsqlite3Get4byte(tls, (bp + 24 /* &aBuf */ + 4)) if !(version != U32(WAL_MAX_VERSION)) { goto __7 } @@ -83395,7 +83901,7 @@ __8: aPrivate = (aData + uintptr(szPage)) // Read all frames from the log file. - iLastFrame = (U32((*(*I64)(unsafe.Pointer(bp + 24 /* nSize */)) - int64(WAL_HDRSIZE)) / I64(szFrame))) + iLastFrame = (U32((*(*I64)(unsafe.Pointer(bp + 16 /* nSize */)) - int64(WAL_HDRSIZE)) / I64(szFrame))) iPg = U32(0) __9: if !(iPg <= U32(walFramePage(tls, iLastFrame))) { @@ -83413,7 +83919,7 @@ __9: } return ((uint64(HASHTABLE_NPAGE) - (((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{}))) / uint64(unsafe.Sizeof(U32(0))))) + (uint64((iPg - U32(1)) * U32(HASHTABLE_NPAGE)))) }()))) - rc = walIndexPage(tls, pWal, int32(iPg), bp+64 /* &aShare */) + rc = walIndexPage(tls, pWal, int32(iPg), bp+56 /* &aShare */) if !(rc != 0) { goto __12 } @@ -83437,14 +83943,14 @@ __13: goto __15 __16: ; - isValid = walDecodeFrame(tls, pWal, bp+72 /* &pgno */, bp+76 /* &nTruncate */, aData, aFrame) + isValid = walDecodeFrame(tls, pWal, bp+64 /* &pgno */, bp+68 /* &nTruncate */, aData, aFrame) if !(!(isValid != 0)) { goto __17 } goto __15 __17: ; - rc = walIndexAppend(tls, pWal, iFrame, *(*U32)(unsafe.Pointer(bp + 72 /* pgno */))) + rc = walIndexAppend(tls, pWal, iFrame, *(*U32)(unsafe.Pointer(bp + 64 /* pgno */))) if !(rc != SQLITE_OK) { goto __18 } @@ -83453,15 +83959,15 @@ __18: ; // If nTruncate is non-zero, this is a commit record. - if !(*(*U32)(unsafe.Pointer(bp + 76 /* nTruncate */)) != 0) { + if !(*(*U32)(unsafe.Pointer(bp + 68 /* nTruncate */)) != 0) { goto __19 } (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame = iFrame - (*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage = *(*U32)(unsafe.Pointer(bp + 76 /* nTruncate */)) + (*Wal)(unsafe.Pointer(pWal)).Fhdr.FnPage = *(*U32)(unsafe.Pointer(bp + 68 /* nTruncate */)) (*Wal)(unsafe.Pointer(pWal)).Fhdr.FszPage = (U16((szPage & 0xff00) | (szPage >> 16))) - *(*U32)(unsafe.Pointer(bp + 80 /* &aFrameCksum[0] */)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) - *(*U32)(unsafe.Pointer(bp + 80 /* &aFrameCksum[0] */ + 1*4)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) + *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) + *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */ + 1*4)) = *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) __19: ; goto __14 @@ -83471,7 +83977,7 @@ __14: goto __15 __15: ; - *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 64 /* aShare */)) + *(*uintptr)(unsafe.Pointer((*Wal)(unsafe.Pointer(pWal)).FapWiData + uintptr(iPg)*8)) = *(*uintptr)(unsafe.Pointer(bp + 56 /* aShare */)) nHdr = func() uint32 { if iPg == U32(0) { return (uint32((uint64(unsafe.Sizeof(WalIndexHdr{})) * uint64(2)) + uint64(unsafe.Sizeof(WalCkptInfo{})))) @@ -83486,7 +83992,7 @@ __15: // do that, according to the spec, but no memcpy() implementation that // we know of actually does that, which is why we say that memcpy() // is safe for this. Memcpy() is certainly a lot faster. - libc.Xmemcpy(tls, (*(*uintptr)(unsafe.Pointer(bp + 64 /* aShare */)) + uintptr(nHdr32)*4), (aPrivate + uintptr(nHdr32)*4), (((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0))))) - uint64(nHdr))) + libc.Xmemcpy(tls, (*(*uintptr)(unsafe.Pointer(bp + 56 /* aShare */)) + uintptr(nHdr32)*4), (aPrivate + uintptr(nHdr32)*4), (((uint64(unsafe.Sizeof(Ht_slot(0))) * (uint64(HASHTABLE_NPAGE * 2))) + (uint64(HASHTABLE_NPAGE) * uint64(unsafe.Sizeof(U32(0))))) - uint64(nHdr))) if !(iFrame <= iLast) { goto __20 } @@ -83509,8 +84015,8 @@ finished: if !(rc == SQLITE_OK) { goto __21 } - *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = *(*U32)(unsafe.Pointer(bp + 80 /* &aFrameCksum[0] */)) - *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = *(*U32)(unsafe.Pointer(bp + 80 /* &aFrameCksum[0] */ + 1*4)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */))) = *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */)) + *(*U32)(unsafe.Pointer((pWal + 72 /* &.hdr */ + 24 /* &.aFrameCksum */) + 1*4)) = *(*U32)(unsafe.Pointer(bp + 72 /* &aFrameCksum[0] */ + 1*4)) walIndexWriteHdr(tls, pWal) // Reset the checkpoint-header. This is safe because this thread is @@ -83565,7 +84071,7 @@ __24: goto __30 } Xsqlite3_log(tls, (SQLITE_NOTICE | (int32(1) << 8)), - ts+4426, /* "recovered %d fra..." */ + ts+4441, /* "recovered %d fra..." */ libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).Fhdr.FmxFrame, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) __30: ; @@ -84297,20 +84803,20 @@ walcheckpoint_out: // If the WAL file is currently larger than nMax bytes in size, truncate // it to exactly nMax bytes. If an error occurs while doing so, ignore it. func walLimitSize(tls *libc.TLS, pWal uintptr, nMax I64) { /* sqlite3.c:62473:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) - // var sz I64 at bp+16, 8 + // var sz I64 at bp+8, 8 var rx int32 Xsqlite3BeginBenignMalloc(tls) - rx = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+16 /* &sz */) - if (rx == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 16 /* sz */)) > nMax) { + rx = Xsqlite3OsFileSize(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, bp+8 /* &sz */) + if (rx == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 8 /* sz */)) > nMax) { rx = Xsqlite3OsTruncate(tls, (*Wal)(unsafe.Pointer(pWal)).FpWalFd, nMax) } Xsqlite3EndBenignMalloc(tls) if rx != 0 { - Xsqlite3_log(tls, rx, ts+4463 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) + Xsqlite3_log(tls, rx, ts+4478 /* "cannot limit WAL..." */, libc.VaList(bp, (*Wal)(unsafe.Pointer(pWal)).FzWalName)) } } @@ -87090,7 +87596,7 @@ func Xsqlite3BtreeLeaveCursor(tls *libc.TLS, pCur uintptr) { /* sqlite3.c:65443: // The header string that appears at the beginning of every // SQLite database. -var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 4489 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ +var zMagicHeader = *(*[16]int8)(unsafe.Pointer(ts + 4504 /* "SQLite format 3" */)) /* sqlite3.c:65474:19 */ // Set this global variable to 1 to enable tracing using the TRACE // macro. @@ -89130,7 +89636,7 @@ func Xsqlite3BtreeOpen(tls *libc.TLS, pVfs uintptr, zFilename uintptr, db uintpt mutexOpen = uintptr(0) rc = SQLITE_OK isTempDb = (libc.Bool32((zFilename == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zFilename))) == 0))) - isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+4505 /* ":memory:" */) == 0)) || + isMemdb = (libc.Bool32((((zFilename != 0) && (libc.Xstrcmp(tls, zFilename, ts+4520 /* ":memory:" */) == 0)) || ((isTempDb != 0) && (Xsqlite3TempInMemory(tls, db) != 0))) || ((vfsFlags & SQLITE_OPEN_MEMORY) != 0))) @@ -90004,7 +90510,7 @@ __10: // // The original design allowed these amounts to vary, but as of // version 3.6.0, we require them to be fixed. - if !(libc.Xmemcmp(tls, (page1+21), ts+4514 /* "@ " */, uint64(3)) != 0) { + if !(libc.Xmemcmp(tls, (page1+21), ts+4529 /* "@ " */, uint64(3)) != 0) { goto __14 } goto page1_init_failed @@ -97508,8 +98014,8 @@ func Xsqlite3BtreePager(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:75273:2 // Append a message to the error message string. func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) { /* sqlite3.c:75281:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var ap Va_list _ = ap @@ -97520,7 +98026,7 @@ func checkAppendMsg(tls *libc.TLS, pCheck uintptr, zFormat uintptr, va uintptr) (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr++ ap = va if (*IntegrityCk)(unsafe.Pointer(pCheck)).FerrMsg.FnChar != 0 { - Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+4518 /* "\n" */, 1) + Xsqlite3_str_append(tls, (pCheck + 56 /* &.errMsg */), ts+4533 /* "\n" */, 1) } if (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx != 0 { Xsqlite3_str_appendf(tls, (pCheck + 56 /* &.errMsg */), (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx, libc.VaList(bp, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1, (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2)) @@ -97552,15 +98058,15 @@ func setPageReferenced(tls *libc.TLS, pCheck uintptr, iPg Pgno) { /* sqlite3.c:7 // // Also check that the page number is in bounds. func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75333:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) if (iPage > (*IntegrityCk)(unsafe.Pointer(pCheck)).FnPage) || (iPage == Pgno(0)) { - checkAppendMsg(tls, pCheck, ts+4520 /* "invalid page num..." */, libc.VaList(bp, iPage)) + checkAppendMsg(tls, pCheck, ts+4535 /* "invalid page num..." */, libc.VaList(bp, iPage)) return 1 } if getPageReferenced(tls, pCheck, iPage) != 0 { - checkAppendMsg(tls, pCheck, ts+4543 /* "2nd reference to..." */, libc.VaList(bp+16, iPage)) + checkAppendMsg(tls, pCheck, ts+4558 /* "2nd reference to..." */, libc.VaList(bp+8, iPage)) return 1 } if libc.AtomicLoadNInt32(((*IntegrityCk)(unsafe.Pointer(pCheck)).Fdb+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { @@ -97574,52 +98080,52 @@ func checkRef(tls *libc.TLS, pCheck uintptr, iPage Pgno) int32 { /* sqlite3.c:75 // page iParent, pointer type ptrType. If not, append an error message // to pCheck. func checkPtrmap(tls *libc.TLS, pCheck uintptr, iChild Pgno, eType U8, iParent Pgno) { /* sqlite3.c:75353:13: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(56) + defer tls.Free(56) var rc int32 - // var ePtrmapType U8 at bp+64, 1 + // var ePtrmapType U8 at bp+48, 1 - // var iPtrmapParent Pgno at bp+68, 4 + // var iPtrmapParent Pgno at bp+52, 4 - rc = ptrmapGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt, iChild, bp+64 /* &ePtrmapType */, bp+68 /* &iPtrmapParent */) + rc = ptrmapGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt, iChild, bp+48 /* &ePtrmapType */, bp+52 /* &iPtrmapParent */) if rc != SQLITE_OK { if (rc == SQLITE_NOMEM) || (rc == (SQLITE_IOERR | (int32(12) << 8))) { (*IntegrityCk)(unsafe.Pointer(pCheck)).FbOomFault = 1 } - checkAppendMsg(tls, pCheck, ts+4568 /* "Failed to read p..." */, libc.VaList(bp, iChild)) + checkAppendMsg(tls, pCheck, ts+4583 /* "Failed to read p..." */, libc.VaList(bp, iChild)) return } - if (int32(*(*U8)(unsafe.Pointer(bp + 64 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 68 /* iPtrmapParent */)) != iParent) { + if (int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))) != int32(eType)) || (*(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)) != iParent) { checkAppendMsg(tls, pCheck, - ts+4597, /* "Bad ptr map entr..." */ - libc.VaList(bp+16, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 64 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 68 /* iPtrmapParent */)))) + ts+4612, /* "Bad ptr map entr..." */ + libc.VaList(bp+8, iChild, int32(eType), iParent, int32(*(*U8)(unsafe.Pointer(bp + 48 /* ePtrmapType */))), *(*Pgno)(unsafe.Pointer(bp + 52 /* iPtrmapParent */)))) } } // Check the integrity of the freelist or of an overflow page list. // Verify that the number of pages on the list is N. func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U32) { /* sqlite3.c:75382:13: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(48) + defer tls.Free(48) var i int32 var expected U32 = N var nErrAtStart int32 = (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr for (iPage != Pgno(0)) && ((*IntegrityCk)(unsafe.Pointer(pCheck)).FmxErr != 0) { - // var pOvflPage uintptr at bp+64, 8 + // var pOvflPage uintptr at bp+40, 8 var pOvflData uintptr if checkRef(tls, pCheck, iPage) != 0 { break } N-- - if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+64 /* &pOvflPage */, 0) != 0 { - checkAppendMsg(tls, pCheck, ts+4651 /* "failed to get pa..." */, libc.VaList(bp, iPage)) + if Xsqlite3PagerGet(tls, (*IntegrityCk)(unsafe.Pointer(pCheck)).FpPager, iPage, bp+40 /* &pOvflPage */, 0) != 0 { + checkAppendMsg(tls, pCheck, ts+4666 /* "failed to get pa..." */, libc.VaList(bp, iPage)) break } - pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pOvflPage */))) + pOvflData = Xsqlite3PagerGetData(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) if isFreeList != 0 { var n U32 = Xsqlite3Get4byte(tls, (pOvflData + 4)) if (*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FautoVacuum != 0 { @@ -97627,7 +98133,7 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } if n > (((*BtShared)(unsafe.Pointer((*IntegrityCk)(unsafe.Pointer(pCheck)).FpBt)).FusableSize / U32(4)) - U32(2)) { checkAppendMsg(tls, pCheck, - ts+4673 /* "freelist leaf co..." */, libc.VaList(bp+16, iPage)) + ts+4688 /* "freelist leaf co..." */, libc.VaList(bp+8, iPage)) N-- } else { for i = 0; i < int32(n); i++ { @@ -97649,16 +98155,16 @@ func checkList(tls *libc.TLS, pCheck uintptr, isFreeList int32, iPage Pgno, N U3 } } iPage = Xsqlite3Get4byte(tls, pOvflData) - Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pOvflPage */))) + Xsqlite3PagerUnref(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pOvflPage */))) } if (N != 0) && (nErrAtStart == (*IntegrityCk)(unsafe.Pointer(pCheck)).FnErr) { checkAppendMsg(tls, pCheck, - ts+4712, /* "%s is %d but sho..." */ - libc.VaList(bp+32, func() uintptr { + ts+4727, /* "%s is %d but sho..." */ + libc.VaList(bp+16, func() uintptr { if isFreeList != 0 { - return ts + 4738 /* "size" */ + return ts + 4753 /* "size" */ } - return ts + 4743 /* "overflow list le..." */ + return ts + 4758 /* "overflow list le..." */ }(), (expected-N), expected)) } @@ -97736,11 +98242,11 @@ func btreeHeapPull(tls *libc.TLS, aHeap uintptr, pOut uintptr) int32 { /* sqlite // 4. Recursively call checkTreePage on all children. // 5. Verify that the depth of all children is the same. func checkTreePage(tls *libc.TLS, pCheck uintptr, iPage Pgno, piMinKey uintptr, maxKey I64) int32 { /* sqlite3.c:75515:12: */ - bp := tls.Alloc(196) - defer tls.Free(196) - *(*I64)(unsafe.Pointer(bp + 160)) = maxKey + bp := tls.Alloc(140) + defer tls.Free(140) + *(*I64)(unsafe.Pointer(bp + 104)) = maxKey - // var pPage uintptr at bp+152, 8 + // var pPage uintptr at bp+96, 8 // The page being analyzed var i int32 // Loop counter var rc int32 // Result code from subroutine call @@ -97762,7 +98268,7 @@ func checkTreePage(tls *libc.TLS, pCheck uintptr, iPage Pgno, piMinKey uintptr, var usableSize U32 // Usable size of the page var contentOffset U32 // Offset to the start of the cell content area var heap uintptr // Min-heap used for checking cell coverage - // var x U32 at bp+192, 4 + // var x U32 at bp+136, 4 var prev U32 // Next and previous entry on the min-heap var saved_zPfx uintptr @@ -97771,12 +98277,12 @@ func checkTreePage(tls *libc.TLS, pCheck uintptr, iPage Pgno, piMinKey uintptr, var savedIsInit U8 var nPage U32 // Number of pages on the overflow chain var pgnoOvfl Pgno - // var info CellInfo at bp+168, 24 + // var info CellInfo at bp+112, 24 var size U32 var size1 int32 var j int32 - *(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)) = uintptr(0) depth = -1 doCoverageCheck = 1 keyCanBeEqual = 1 @@ -97802,43 +98308,43 @@ __1: return 0 __2: ; - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 4764 /* "Page %u: " */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 4779 /* "Page %u: " */ (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = iPage - if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+152 /* &pPage */, 0))) != 0) { + if !((libc.AssignInt32(&rc, btreeGetPage(tls, pBt, iPage, bp+96 /* &pPage */, 0))) != 0) { goto __3 } checkAppendMsg(tls, pCheck, - ts+4774 /* "unable to get th..." */, libc.VaList(bp, rc)) + ts+4789 /* "unable to get th..." */, libc.VaList(bp, rc)) goto end_of_check __3: ; // Clear MemPage.isInit to make sure the corruption detection code in // btreeInitPage() is executed. - savedIsInit = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).FisInit - (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).FisInit = U8(0) - if !((libc.AssignInt32(&rc, btreeInitPage(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */))))) != 0) { + savedIsInit = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FisInit + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FisInit = U8(0) + if !((libc.AssignInt32(&rc, btreeInitPage(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */))))) != 0) { goto __4 } // The only possible error from InitPage checkAppendMsg(tls, pCheck, - ts+4812 /* "btreeInitPage() ..." */, libc.VaList(bp+16, rc)) + ts+4827 /* "btreeInitPage() ..." */, libc.VaList(bp+8, rc)) goto end_of_check __4: ; - if !((libc.AssignInt32(&rc, btreeComputeFreeSpace(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */))))) != 0) { + if !((libc.AssignInt32(&rc, btreeComputeFreeSpace(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */))))) != 0) { goto __5 } - checkAppendMsg(tls, pCheck, ts+4850 /* "free space corru..." */, libc.VaList(bp+32, rc)) + checkAppendMsg(tls, pCheck, ts+4865 /* "free space corru..." */, libc.VaList(bp+16, rc)) goto end_of_check __5: ; - data = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).FaData - hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).FhdrOffset) + data = (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FaData + hdr = int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FhdrOffset) // Set up for cell analysis - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 4872 /* "On tree page %u ..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 4887 /* "On tree page %u ..." */ contentOffset = (U32(((((int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5)))))) << 8) | int32(*(*U8)(unsafe.Pointer((data + uintptr((hdr + 5))) + 1)))) - 1) & 0xffff) + 1)) // Enforced by btreeInitPage() @@ -97848,11 +98354,11 @@ __5: // EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page // immediately follows the b-tree page header. - cellStart = ((hdr + 12) - (4 * int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).Fleaf))) + cellStart = ((hdr + 12) - (4 * int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf))) pCellIdx = (data + uintptr((cellStart + (2 * (nCell - 1))))) - if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).Fleaf) != 0)) { + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf) != 0)) { goto __6 } // Analyze the right-child page of internal pages @@ -97860,11 +98366,11 @@ __5: if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __8 } - (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 4898 /* "On page %u at ri..." */ + (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = ts + 4913 /* "On page %u at ri..." */ checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __8: ; - depth = checkTreePage(tls, pCheck, uint32(pgno), bp+160 /* &maxKey */, *(*I64)(unsafe.Pointer(bp + 160 /* maxKey */))) + depth = checkTreePage(tls, pCheck, uint32(pgno), bp+104 /* &maxKey */, *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */))) keyCanBeEqual = 0 goto __7 __6: @@ -97891,50 +98397,50 @@ __9: if !((pc < contentOffset) || (pc > (usableSize - U32(4)))) { goto __12 } - checkAppendMsg(tls, pCheck, ts+4926, /* "Offset %d out of..." */ - libc.VaList(bp+48, pc, contentOffset, (usableSize-U32(4)))) + checkAppendMsg(tls, pCheck, ts+4941, /* "Offset %d out of..." */ + libc.VaList(bp+24, pc, contentOffset, (usableSize-U32(4)))) doCoverageCheck = 0 goto __10 __12: ; pCell = (data + uintptr(pc)) - (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)) + 128 /* &.xParseCell */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)), pCell, bp+168 /* &info */) - if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnSize)) > usableSize) { + (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)) + 128 /* &.xParseCell */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)), pCell, bp+112 /* &info */) + if !((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) > usableSize) { goto __13 } - checkAppendMsg(tls, pCheck, ts+4956 /* "Extends off end ..." */, 0) + checkAppendMsg(tls, pCheck, ts+4971 /* "Extends off end ..." */, 0) doCoverageCheck = 0 goto __10 __13: ; // Check for integer primary key out of range - if !((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).FintKey != 0) { + if !((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FintKey != 0) { goto __14 } if !(func() int32 { if keyCanBeEqual != 0 { - return (libc.Bool32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnKey > *(*I64)(unsafe.Pointer(bp + 160 /* maxKey */)))) + return (libc.Bool32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey > *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)))) } - return (libc.Bool32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnKey >= *(*I64)(unsafe.Pointer(bp + 160 /* maxKey */)))) + return (libc.Bool32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey >= *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)))) }() != 0) { goto __15 } - checkAppendMsg(tls, pCheck, ts+4980 /* "Rowid %lld out o..." */, libc.VaList(bp+80, (*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnKey)) + checkAppendMsg(tls, pCheck, ts+4995 /* "Rowid %lld out o..." */, libc.VaList(bp+48, (*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnKey)) __15: ; - *(*I64)(unsafe.Pointer(bp + 160 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 168 /* &info */)).FnKey + *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) = (*CellInfo)(unsafe.Pointer(bp + 112 /* &info */)).FnKey keyCanBeEqual = 0 // Only the first key on the page may ==maxKey __14: ; // Check the content overflow list - if !((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnPayload > U32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnLocal)) { + if !((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnPayload > U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnLocal)) { goto __16 } // First page of the overflow chain - nPage = (((((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnPayload - U32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnLocal)) + usableSize) - U32(5)) / (usableSize - U32(4))) - pgnoOvfl = Xsqlite3Get4byte(tls, (pCell + uintptr((int32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnSize) - 4)))) + nPage = (((((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnPayload - U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnLocal)) + usableSize) - U32(5)) / (usableSize - U32(4))) + pgnoOvfl = Xsqlite3Get4byte(tls, (pCell + uintptr((int32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize) - 4)))) if !((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) { goto __17 } @@ -97945,7 +98451,7 @@ __17: __16: ; - if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).Fleaf) != 0)) { + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf) != 0)) { goto __18 } // Check sanity of left child page for internal pages @@ -97956,19 +98462,19 @@ __16: checkPtrmap(tls, pCheck, uint32(pgno), uint8(PTRMAP_BTREE), iPage) __20: ; - d2 = checkTreePage(tls, pCheck, uint32(pgno), bp+160 /* &maxKey */, *(*I64)(unsafe.Pointer(bp + 160 /* maxKey */))) + d2 = checkTreePage(tls, pCheck, uint32(pgno), bp+104 /* &maxKey */, *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */))) keyCanBeEqual = 0 if !(d2 != depth) { goto __21 } - checkAppendMsg(tls, pCheck, ts+5004 /* "Child page depth..." */, 0) + checkAppendMsg(tls, pCheck, ts+5019 /* "Child page depth..." */, 0) depth = d2 __21: ; goto __19 __18: // Populate the coverage-checking heap for leaf pages - btreeHeapInsert(tls, heap, ((pc << 16) | ((pc + U32((*CellInfo)(unsafe.Pointer(bp+168 /* &info */)).FnSize)) - U32(1)))) + btreeHeapInsert(tls, heap, ((pc << 16) | ((pc + U32((*CellInfo)(unsafe.Pointer(bp+112 /* &info */)).FnSize)) - U32(1)))) __19: ; goto __10 @@ -97978,7 +98484,7 @@ __10: goto __11 __11: ; - *(*I64)(unsafe.Pointer(piMinKey)) = *(*I64)(unsafe.Pointer(bp + 160 /* maxKey */)) + *(*I64)(unsafe.Pointer(piMinKey)) = *(*I64)(unsafe.Pointer(bp + 104 /* maxKey */)) // Check for complete coverage of the page (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = uintptr(0) @@ -97988,7 +98494,7 @@ __11: // For leaf pages, the min-heap has already been initialized and the // cells have already been inserted. But for internal pages, that has // not yet been done, so do it now - if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).Fleaf) != 0)) { + if !(!(int32((*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).Fleaf) != 0)) { goto __23 } heap = (*IntegrityCk)(unsafe.Pointer(pCheck)).Fheap @@ -97999,7 +98505,7 @@ __24: goto __26 } pc = U32(libc.X__builtin_bswap16(tls, *(*U16)(unsafe.Pointer((data + uintptr((cellStart + (i * 2)))))))) - size = U32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)) + 120 /* &.xCellSize */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)), (data + uintptr(pc)))) + size = U32((*(*func(*libc.TLS, uintptr, uintptr) U16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)) + 120 /* &.xCellSize */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)), (data + uintptr(pc)))) btreeHeapInsert(tls, heap, ((pc << 16) | ((pc + size) - U32(1)))) goto __25 __25: @@ -98052,19 +98558,19 @@ __28: nFrag = 0 prev = (contentOffset - U32(1)) // Implied first min-heap entry __29: - if !(btreeHeapPull(tls, heap, bp+192 /* &x */) != 0) { + if !(btreeHeapPull(tls, heap, bp+136 /* &x */) != 0) { goto __30 } - if !((prev & U32(0xffff)) >= (*(*U32)(unsafe.Pointer(bp + 192 /* x */)) >> 16)) { + if !((prev & U32(0xffff)) >= (*(*U32)(unsafe.Pointer(bp + 136 /* x */)) >> 16)) { goto __31 } checkAppendMsg(tls, pCheck, - ts+5029 /* "Multiple uses fo..." */, libc.VaList(bp+96, (*(*U32)(unsafe.Pointer(bp + 192 /* x */))>>16), iPage)) + ts+5044 /* "Multiple uses fo..." */, libc.VaList(bp+56, (*(*U32)(unsafe.Pointer(bp + 136 /* x */))>>16), iPage)) goto __30 goto __32 __31: - nFrag = int32(U32(nFrag) + (((*(*U32)(unsafe.Pointer(bp + 192 /* x */)) >> 16) - (prev & U32(0xffff))) - U32(1))) - prev = *(*U32)(unsafe.Pointer(bp + 192 /* x */)) + nFrag = int32(U32(nFrag) + (((*(*U32)(unsafe.Pointer(bp + 136 /* x */)) >> 16) - (prev & U32(0xffff))) - U32(1))) + prev = *(*U32)(unsafe.Pointer(bp + 136 /* x */)) __32: ; goto __29 @@ -98079,8 +98585,8 @@ __30: goto __33 } checkAppendMsg(tls, pCheck, - ts+5066, /* "Fragmentation of..." */ - libc.VaList(bp+120, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) + ts+5081, /* "Fragmentation of..." */ + libc.VaList(bp+72, nFrag, int32(*(*U8)(unsafe.Pointer(data + uintptr((hdr + 7))))), iPage)) __33: ; __22: @@ -98090,10 +98596,10 @@ end_of_check: if !(!(doCoverageCheck != 0)) { goto __34 } - (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */)))).FisInit = savedIsInit + (*MemPage)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */)))).FisInit = savedIsInit __34: ; - releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* pPage */))) + releasePage(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pPage */))) (*IntegrityCk)(unsafe.Pointer(pCheck)).FzPfx = saved_zPfx (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv1 = Pgno(saved_v1) (*IntegrityCk)(unsafe.Pointer(pCheck)).Fv2 = saved_v2 @@ -98121,21 +98627,21 @@ __34: // the unverified btrees. Except, if aRoot[1] is 1, then the freelist // checks are still performed. func Xsqlite3BtreeIntegrityCheck(tls *libc.TLS, db uintptr, p uintptr, aRoot uintptr, nRoot int32, mxErr int32, pnErr uintptr) uintptr { /* sqlite3.c:75794:21: */ - bp := tls.Alloc(272) - defer tls.Free(272) + bp := tls.Alloc(248) + defer tls.Free(248) var i Pgno - // var sCheck IntegrityCk at bp+56, 104 + // var sCheck IntegrityCk at bp+32, 104 var pBt uintptr var savedDbFlags U64 - // var zErr [100]int8 at bp+160, 100 + // var zErr [100]int8 at bp+136, 100 var bPartial int32 // True if not checking all btrees var bCkFreelist int32 var mx Pgno var mxInHdr Pgno - // var notUsed I64 at bp+264, 8 + // var notUsed I64 at bp+240, 8 pBt = (*Btree)(unsafe.Pointer(p)).FpBt savedDbFlags = (*Sqlite3)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb)).Fflags bPartial = 0 @@ -98158,49 +98664,49 @@ __1: Xsqlite3BtreeEnter(tls, p) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).Fdb = db - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FpBt = pBt - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FpPager = (*BtShared)(unsafe.Pointer(pBt)).FpPager - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FnPage = btreePagecount(tls, (*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FpBt) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FmxErr = mxErr - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FnErr = 0 - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FbOomFault = 0 - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FzPfx = uintptr(0) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).Fv1 = Pgno(0) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).Fv2 = 0 - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FaPgRef = uintptr(0) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).Fheap = uintptr(0) - Xsqlite3StrAccumInit(tls, (bp + 56 /* &sCheck */ + 56 /* &.errMsg */), uintptr(0), bp+160 /* &zErr[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FerrMsg.FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - if !((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FnPage == Pgno(0)) { + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fdb = db + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FpBt = pBt + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FpPager = (*BtShared)(unsafe.Pointer(pBt)).FpPager + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FnPage = btreePagecount(tls, (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FpBt) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FmxErr = mxErr + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FnErr = 0 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FbOomFault = 0 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fv1 = Pgno(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fv2 = 0 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FaPgRef = uintptr(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fheap = uintptr(0) + Xsqlite3StrAccumInit(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */), uintptr(0), bp+136 /* &zErr[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FerrMsg.FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage == Pgno(0)) { goto __3 } goto integrity_ck_cleanup __3: ; - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FaPgRef = Xsqlite3MallocZero(tls, (uint64(((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FnPage / Pgno(8)) + Pgno(1)))) - if !(!(int32((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FaPgRef) != 0)) { + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FaPgRef = Xsqlite3MallocZero(tls, (uint64(((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage / Pgno(8)) + Pgno(1)))) + if !(!(int32((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FaPgRef) != 0)) { goto __4 } - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FbOomFault = 1 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FbOomFault = 1 goto integrity_ck_cleanup __4: ; - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).Fheap = Xsqlite3PageMalloc(tls, int32((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) - if !((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).Fheap == uintptr(0)) { + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).Fheap = Xsqlite3PageMalloc(tls, int32((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).Fheap == uintptr(0)) { goto __5 } - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FbOomFault = 1 + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FbOomFault = 1 goto integrity_ck_cleanup __5: ; i = ((U32(Xsqlite3PendingByte) / ((*BtShared)(unsafe.Pointer(pBt)).FpageSize)) + U32(1)) - if !(i <= (*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FnPage) { + if !(i <= (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage) { goto __6 } - setPageReferenced(tls, bp+56 /* &sCheck */, i) + setPageReferenced(tls, bp+32 /* &sCheck */, i) __6: ; @@ -98208,10 +98714,10 @@ __6: if !(bCkFreelist != 0) { goto __7 } - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FzPfx = ts + 5118 /* "Main freelist: " */ - checkList(tls, bp+56 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = ts + 5133 /* "Main freelist: " */ + checkList(tls, bp+32 /* &sCheck */, 1, Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+32)), Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+36))) - (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FzPfx = uintptr(0) + (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FzPfx = uintptr(0) __7: ; @@ -98245,8 +98751,8 @@ __13: if !(mx != mxInHdr) { goto __15 } - checkAppendMsg(tls, bp+56, /* &sCheck */ - ts+5134, /* "max rootpage (%d..." */ + checkAppendMsg(tls, bp+32, /* &sCheck */ + ts+5149, /* "max rootpage (%d..." */ libc.VaList(bp, mx, mxInHdr)) __15: ; @@ -98255,8 +98761,8 @@ __9: if !(Xsqlite3Get4byte(tls, ((*MemPage)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).FpPage1)).FaData+64)) != U32(0)) { goto __16 } - checkAppendMsg(tls, bp+56, /* &sCheck */ - ts+5179 /* "incremental_vacu..." */, 0) + checkAppendMsg(tls, bp+32, /* &sCheck */ + ts+5194 /* "incremental_vacu..." */, 0) __16: ; __10: @@ -98267,7 +98773,7 @@ __8: *(*U64)(unsafe.Pointer((*BtShared)(unsafe.Pointer(pBt)).Fdb + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_CellSizeCk))) i = Pgno(0) __17: - if !((int32(i) < nRoot) && ((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FmxErr != 0)) { + if !((int32(i) < nRoot) && ((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FmxErr != 0)) { goto __19 } if !(*(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) == Pgno(0)) { @@ -98279,10 +98785,10 @@ __20: if !((((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0) && (*(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)) > Pgno(1))) && !(bPartial != 0)) { goto __21 } - checkPtrmap(tls, bp+56 /* &sCheck */, *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), uint8(PTRMAP_ROOTPAGE), uint32(0)) + checkPtrmap(tls, bp+32 /* &sCheck */, *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), uint8(PTRMAP_ROOTPAGE), uint32(0)) __21: ; - checkTreePage(tls, bp+56 /* &sCheck */, *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+264 /* ¬Used */, (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + checkTreePage(tls, bp+32 /* &sCheck */, *(*Pgno)(unsafe.Pointer(aRoot + uintptr(i)*4)), bp+240 /* ¬Used */, (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) goto __18 __18: i++ @@ -98298,21 +98804,21 @@ __19: } i = Pgno(1) __23: - if !((i <= (*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FnPage) && ((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FmxErr != 0)) { + if !((i <= (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnPage) && ((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FmxErr != 0)) { goto __25 } // If the database supports auto-vacuum, make sure no tables contain // references to pointer-map pages. - if !((getPageReferenced(tls, bp+56 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { + if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) == 0) && ((ptrmapPageno(tls, pBt, i) != i) || !(int32((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum) != 0))) { goto __26 } - checkAppendMsg(tls, bp+56 /* &sCheck */, ts+5234 /* "Page %d is never..." */, libc.VaList(bp+24, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+5249 /* "Page %d is never..." */, libc.VaList(bp+16, i)) __26: ; - if !((getPageReferenced(tls, bp+56 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { + if !((getPageReferenced(tls, bp+32 /* &sCheck */, i) != 0) && ((ptrmapPageno(tls, pBt, i) == i) && ((*BtShared)(unsafe.Pointer(pBt)).FautoVacuum != 0))) { goto __27 } - checkAppendMsg(tls, bp+56 /* &sCheck */, ts+5256 /* "Pointer map page..." */, libc.VaList(bp+40, i)) + checkAppendMsg(tls, bp+32 /* &sCheck */, ts+5271 /* "Pointer map page..." */, libc.VaList(bp+24, i)) __27: ; goto __24 @@ -98327,26 +98833,26 @@ __22: // Clean up and report errors. integrity_ck_cleanup: - Xsqlite3PageFree(tls, (*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).Fheap) - Xsqlite3_free(tls, (*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FaPgRef) - if !((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FbOomFault != 0) { + Xsqlite3PageFree(tls, (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).Fheap) + Xsqlite3_free(tls, (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FaPgRef) + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FbOomFault != 0) { goto __28 } - Xsqlite3_str_reset(tls, (bp + 56 /* &sCheck */ + 56 /* &.errMsg */)) - (*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FnErr++ + Xsqlite3_str_reset(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */)) + (*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnErr++ __28: ; - *(*int32)(unsafe.Pointer(pnErr)) = (*IntegrityCk)(unsafe.Pointer(bp + 56 /* &sCheck */)).FnErr - if !((*IntegrityCk)(unsafe.Pointer(bp+56 /* &sCheck */)).FnErr == 0) { + *(*int32)(unsafe.Pointer(pnErr)) = (*IntegrityCk)(unsafe.Pointer(bp + 32 /* &sCheck */)).FnErr + if !((*IntegrityCk)(unsafe.Pointer(bp+32 /* &sCheck */)).FnErr == 0) { goto __29 } - Xsqlite3_str_reset(tls, (bp + 56 /* &sCheck */ + 56 /* &.errMsg */)) + Xsqlite3_str_reset(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */)) __29: ; // Make sure this analysis did not leave any unref() pages. Xsqlite3BtreeLeave(tls, p) - return Xsqlite3StrAccumFinish(tls, (bp + 56 /* &sCheck */ + 56 /* &.errMsg */)) + return Xsqlite3StrAccumFinish(tls, (bp + 32 /* &sCheck */ + 56 /* &.errMsg */)) } // Return the full pathname of the underlying database file. Return @@ -98619,30 +99125,30 @@ func Xsqlite3BtreeConnectionCount(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c // function. If an error occurs while doing so, return 0 and write an // error message to pErrorDb. func findBtree(tls *libc.TLS, pErrorDb uintptr, pDb uintptr, zDb uintptr) uintptr { /* sqlite3.c:76305:14: */ - bp := tls.Alloc(440) - defer tls.Free(440) + bp := tls.Alloc(424) + defer tls.Free(424) var i int32 = Xsqlite3FindDbName(tls, pDb, zDb) if i == 1 { - // var sParse Parse at bp+32, 408 + // var sParse Parse at bp+16, 408 var rc int32 = 0 - libc.Xmemset(tls, bp+32 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).Fdb = pDb - if Xsqlite3OpenTempDatabase(tls, bp+32 /* &sParse */) != 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).Frc, ts+3615 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg)) + libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = pDb + if Xsqlite3OpenTempDatabase(tls, bp+16 /* &sParse */) != 0 { + Xsqlite3ErrorWithMsg(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc, ts+3630 /* "%s" */, libc.VaList(bp, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg)) rc = SQLITE_ERROR } - Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg) - Xsqlite3ParserReset(tls, bp+32 /* &sParse */) + Xsqlite3DbFree(tls, pErrorDb, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzErrMsg) + Xsqlite3ParserReset(tls, bp+16 /* &sParse */) if rc != 0 { return uintptr(0) } } if i < 0 { - Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+5290 /* "unknown database..." */, libc.VaList(bp+16, zDb)) + Xsqlite3ErrorWithMsg(tls, pErrorDb, SQLITE_ERROR, ts+5305 /* "unknown database..." */, libc.VaList(bp+8, zDb)) return uintptr(0) } @@ -98663,7 +99169,7 @@ func setDestPgsz(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:76336:12: */ // message in database handle db. func checkReadTransaction(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:76348:12: */ if Xsqlite3BtreeTxnState(tls, p) != SQLITE_TXN_NONE { - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+5310 /* "destination data..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+5325 /* "destination data..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -98690,7 +99196,7 @@ func Xsqlite3_backup_init(tls *libc.TLS, pDestDb uintptr, zDestDb uintptr, pSrcD if pSrcDb == pDestDb { Xsqlite3ErrorWithMsg(tls, - pDestDb, SQLITE_ERROR, ts+5341 /* "source and desti..." */, 0) + pDestDb, SQLITE_ERROR, ts+5356 /* "source and desti..." */, 0) p = uintptr(0) } else { // Allocate space for a new sqlite3_backup object... @@ -99290,21 +99796,21 @@ copy_finished: // Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal // into a buffer. func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sqlite3.c:77103:13: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) - // var acc StrAccum at bp+24, 32 + // var acc StrAccum at bp+16, 32 if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Int) != 0 { // Work-around for GCC bug // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270 - // var x I64 at bp+16, 8 + // var x I64 at bp+8, 8 - libc.Xmemcpy(tls, bp+16 /* &x */, (p /* &.u */), (uint64((int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Int) * 2))) - Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 16 /* x */)), zBuf) + libc.Xmemcpy(tls, bp+8 /* &x */, (p /* &.u */), (uint64((int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_Int) * 2))) + Xsqlite3Int64ToText(tls, *(*I64)(unsafe.Pointer(bp + 8 /* x */)), zBuf) } else { - Xsqlite3StrAccumInit(tls, bp+24 /* &acc */, uintptr(0), zBuf, sz, 0) - Xsqlite3_str_appendf(tls, bp+24 /* &acc */, ts+5381, /* "%!.15g" */ + Xsqlite3StrAccumInit(tls, bp+16 /* &acc */, uintptr(0), zBuf, sz, 0) + Xsqlite3_str_appendf(tls, bp+16 /* &acc */, ts+5396, /* "%!.15g" */ libc.VaList(bp, func() float64 { if (int32((*Mem)(unsafe.Pointer(p)).Fflags) & MEM_IntReal) != 0 { return float64(*(*I64)(unsafe.Pointer(p /* &.u */))) @@ -99312,7 +99818,7 @@ func vdbeMemRenderNum(tls *libc.TLS, sz int32, zBuf uintptr, p uintptr) { /* sql return *(*float64)(unsafe.Pointer(p /* &.u */)) }())) - *(*int8)(unsafe.Pointer(zBuf + uintptr((*StrAccum)(unsafe.Pointer(bp+24 /* &acc */)).FnChar))) = int8(0) // Fast version of sqlite3StrAccumFinish(&acc) + *(*int8)(unsafe.Pointer(zBuf + uintptr((*StrAccum)(unsafe.Pointer(bp+16 /* &acc */)).FnChar))) = int8(0) // Fast version of sqlite3StrAccumFinish(&acc) } } @@ -99945,7 +100451,7 @@ func Xsqlite3VdbeMemSetPointer(tls *libc.TLS, pMem uintptr, pPtr uintptr, zPType if zPType != 0 { return zPType } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() (*Mem)(unsafe.Pointer(pMem)).Fz = pPtr (*Mem)(unsafe.Pointer(pMem)).Fflags = (U16(((MEM_Null | MEM_Dyn) | MEM_Subtype) | MEM_Term)) @@ -100151,6 +100657,8 @@ func Xsqlite3VdbeMemSetStr(tls *libc.TLS, pMem uintptr, z uintptr, n I64, enc U8 (*Mem)(unsafe.Pointer(pMem)).Fflags = flags if enc != 0 { (*Mem)(unsafe.Pointer(pMem)).Fenc = enc + } else if (*Mem)(unsafe.Pointer(pMem)).Fdb == uintptr(0) { + (*Mem)(unsafe.Pointer(pMem)).Fenc = U8(SQLITE_UTF8) } else { (*Mem)(unsafe.Pointer(pMem)).Fenc = (*Sqlite3)(unsafe.Pointer((*Mem)(unsafe.Pointer(pMem)).Fdb)).Fenc @@ -100370,10 +100878,10 @@ func valueNew(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:78324 // and sets (*ppVal) to NULL. Or, if an error occurs, (*ppVal) is set to // NULL and an SQLite error code returned. func valueFromFunction(tls *libc.TLS, db uintptr, p uintptr, enc U8, aff U8, ppVal uintptr, pCtx uintptr) int32 { /* sqlite3.c:78386:12: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(64) + defer tls.Free(64) - // var ctx Sqlite3_context at bp+16, 56 + // var ctx Sqlite3_context at bp+8, 56 // Context object for function invocation var apVal uintptr // Function arguments var nVal int32 // Size of apVal[] array @@ -100448,15 +100956,15 @@ __3: __9: ; - libc.Xmemset(tls, bp+16 /* &ctx */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) - (*Sqlite3_context)(unsafe.Pointer(bp + 16 /* &ctx */)).FpOut = pVal - (*Sqlite3_context)(unsafe.Pointer(bp + 16 /* &ctx */)).FpFunc = pFunc - (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pFunc + 24 /* &.xSFunc */))))(tls, bp+16 /* &ctx */, nVal, apVal) - if !((*Sqlite3_context)(unsafe.Pointer(bp+16 /* &ctx */)).FisError != 0) { + libc.Xmemset(tls, bp+8 /* &ctx */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) + (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FpOut = pVal + (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FpFunc = pFunc + (*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pFunc + 24 /* &.xSFunc */))))(tls, bp+8 /* &ctx */, nVal, apVal) + if !((*Sqlite3_context)(unsafe.Pointer(bp+8 /* &ctx */)).FisError != 0) { goto __10 } - rc = (*Sqlite3_context)(unsafe.Pointer(bp + 16 /* &ctx */)).FisError - Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) + rc = (*Sqlite3_context)(unsafe.Pointer(bp + 8 /* &ctx */)).FisError + Xsqlite3ErrorMsg(tls, (*ValueNewStat4Ctx)(unsafe.Pointer(pCtx)).FpParse, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, pVal))) goto __11 __10: Xsqlite3ValueApplyAffinity(tls, pVal, aff, uint8(SQLITE_UTF8)) @@ -100513,12 +101021,12 @@ __14: // NULL, it is assumed that the caller will free any allocated object // in all cases. func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8, ppVal uintptr, pCtx uintptr) int32 { /* sqlite3.c:78480:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var op int32 var zVal uintptr - // var pVal uintptr at bp+24, 8 + // var pVal uintptr at bp+16, 8 var negInt int32 var zNeg uintptr @@ -100526,9 +101034,9 @@ func valueFromExpr(tls *libc.TLS, db uintptr, pExpr uintptr, enc U8, affinity U8 var aff U8 var nVal int32 zVal = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = uintptr(0) negInt = 1 - zNeg = ts + 740 /* "" */ + zNeg = ts + 755 /* "" */ rc = SQLITE_OK __1: @@ -100577,15 +101085,15 @@ __4: pExpr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft op = int32((*Expr)(unsafe.Pointer(pExpr)).Fop) negInt = -1 - zNeg = ts + 5388 /* "-" */ + zNeg = ts + 5403 /* "-" */ __6: ; if !(((op == TK_STRING) || (op == TK_FLOAT)) || (op == TK_INTEGER)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) = valueNew(tls, db, pCtx) - if !(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) == uintptr(0)) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) == uintptr(0)) { goto __9 } goto no_mem @@ -100594,40 +101102,40 @@ __9: if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_IntValue))) != U32(0)) { goto __10 } - Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), (I64(*(*int32)(unsafe.Pointer(pExpr + 8 /* &.u */))) * I64(negInt))) goto __11 __10: - zVal = Xsqlite3MPrintf(tls, db, ts+5390 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + zVal = Xsqlite3MPrintf(tls, db, ts+5405 /* "%s%s" */, libc.VaList(bp, zNeg, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) if !(zVal == uintptr(0)) { goto __12 } goto no_mem __12: ; - Xsqlite3ValueSetStr(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), -1, zVal, uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) + Xsqlite3ValueSetStr(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), -1, zVal, uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) __11: ; if !(((op == TK_INTEGER) || (op == TK_FLOAT)) && (int32(affinity) == SQLITE_AFF_BLOB)) { goto __13 } - Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), uint8(SQLITE_AFF_NUMERIC), uint8(SQLITE_UTF8)) + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), uint8(SQLITE_AFF_NUMERIC), uint8(SQLITE_UTF8)) goto __14 __13: - Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), affinity, uint8(SQLITE_UTF8)) + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), affinity, uint8(SQLITE_UTF8)) __14: ; - if !((int32((*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))).Fflags) & ((MEM_Int | MEM_IntReal) | MEM_Real)) != 0) { + if !((int32((*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags) & ((MEM_Int | MEM_IntReal) | MEM_Real)) != 0) { goto __15 } - *(*U16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Str))) + *(*U16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Str))) __15: ; if !(int32(enc) != SQLITE_UTF8) { goto __16 } - rc = Xsqlite3VdbeChangeEncoding(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), int32(enc)) + rc = Xsqlite3VdbeChangeEncoding(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), int32(enc)) __16: ; goto __8 @@ -100636,30 +101144,30 @@ __7: goto __17 } // This branch happens for multiple negative signs. Ex: -(-5) - if !((SQLITE_OK == valueFromExpr(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, enc, affinity, bp+24 /* &pVal */, pCtx)) && - (*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) != uintptr(0))) { + if !((SQLITE_OK == valueFromExpr(tls, db, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, enc, affinity, bp+16 /* &pVal */, pCtx)) && + (*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) != uintptr(0))) { goto __19 } - Xsqlite3VdbeMemNumerify(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */))) - if !((int32((*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))).Fflags) & MEM_Real) != 0) { + Xsqlite3VdbeMemNumerify(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) + if !((int32((*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags) & MEM_Real) != 0) { goto __20 } - *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) = -*(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) + *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = -*(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) goto __21 __20: - if !(*(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) { + if !(*(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) { goto __22 } - *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) = -(float64((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) - (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))).Fflags = (U16((int32((*Sqlite3_value)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */))))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Real)) + *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = -(float64((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32)))) + (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags = (U16((int32((*Sqlite3_value)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Real)) goto __23 __22: - *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) = -*(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) + *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = -*(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) __23: ; __21: ; - Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), affinity, enc) + Xsqlite3ValueApplyAffinity(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), affinity, enc) __19: ; goto __18 @@ -100667,22 +101175,22 @@ __17: if !(op == TK_NULL) { goto __24 } - *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) = valueNew(tls, db, pCtx) - if !(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) == uintptr(0)) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) == uintptr(0)) { goto __26 } goto no_mem __26: ; - Xsqlite3VdbeMemSetNull(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */))) + Xsqlite3VdbeMemSetNull(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) goto __25 __24: if !(op == TK_BLOB) { goto __27 } - *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) = valueNew(tls, db, pCtx) - if !(!(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) != 0)) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(!(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) != 0)) { goto __29 } goto no_mem @@ -100691,25 +101199,25 @@ __29: zVal = (*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 2) nVal = (Xsqlite3Strlen30(tls, zVal) - 1) - Xsqlite3VdbeMemSetStr(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)), Xsqlite3HexToBlob(tls, db, zVal, nVal), (int64(nVal / 2)), + Xsqlite3VdbeMemSetStr(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)), Xsqlite3HexToBlob(tls, db, zVal, nVal), (int64(nVal / 2)), uint8(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) goto __28 __27: if !((op == TK_FUNCTION) && (pCtx != uintptr(0))) { goto __30 } - rc = valueFromFunction(tls, db, pExpr, enc, affinity, bp+24 /* &pVal */, pCtx) + rc = valueFromFunction(tls, db, pExpr, enc, affinity, bp+16 /* &pVal */, pCtx) goto __31 __30: if !(op == TK_TRUEFALSE) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) = valueNew(tls, db, pCtx) - if !(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) != 0) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) = valueNew(tls, db, pCtx) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) != 0) { goto __33 } - (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))).Fflags = U16(MEM_Int) - *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) /* &.u */)) = (I64(libc.Bool32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 4))) == 0))) + (*Sqlite3_value)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))).Fflags = U16(MEM_Int) + *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) /* &.u */)) = (I64(libc.Bool32(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) + 4))) == 0))) __33: ; __32: @@ -100725,7 +101233,7 @@ __18: __8: ; - *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)) + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)) return rc no_mem: @@ -100740,7 +101248,7 @@ __34: if !(pCtx == uintptr(0)) { goto __35 } - Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */))) + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */))) __35: ; return SQLITE_NOMEM @@ -102029,47 +102537,47 @@ var dummy VdbeOp /* sqlite3.c:80340:17: */ // Compute a string that describes the P4 parameter for an opcode. // Use zTemp for any required temporary buffer space. func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* sqlite3.c:80540:21: */ - bp := tls.Alloc(272) - defer tls.Free(272) + bp := tls.Alloc(176) + defer tls.Free(176) var zP4 uintptr = uintptr(0) - // var x StrAccum at bp+240, 32 + // var x StrAccum at bp+144, 32 - Xsqlite3StrAccumInit(tls, bp+240 /* &x */, uintptr(0), uintptr(0), 0, SQLITE_MAX_LENGTH) + Xsqlite3StrAccumInit(tls, bp+144 /* &x */, uintptr(0), uintptr(0), 0, SQLITE_MAX_LENGTH) switch int32((*Op)(unsafe.Pointer(pOp)).Fp4type) { case -9: { var j int32 var pKeyInfo uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5395 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5410 /* "k(%d" */, libc.VaList(bp, int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField))) for j = 0; j < int32((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FnKeyField); j++ { var pColl uintptr = *(*uintptr)(unsafe.Pointer((pKeyInfo + 32 /* &.aColl */) + uintptr(j)*8)) var zColl uintptr if pColl != 0 { zColl = (*CollSeq)(unsafe.Pointer(pColl)).FzName } else { - zColl = ts + 740 /* "" */ + zColl = ts + 755 /* "" */ } - if libc.Xstrcmp(tls, zColl, ts+303 /* "BINARY" */) == 0 { - zColl = ts + 5400 /* "B" */ + if libc.Xstrcmp(tls, zColl, ts+318 /* "BINARY" */) == 0 { + zColl = ts + 5415 /* "B" */ } - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5402, /* ",%s%s%s" */ - libc.VaList(bp+16, func() uintptr { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5417, /* ",%s%s%s" */ + libc.VaList(bp+8, func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_DESC) != 0 { - return ts + 5388 /* "-" */ + return ts + 5403 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if (int32(*(*U8)(unsafe.Pointer((*KeyInfo)(unsafe.Pointer(pKeyInfo)).FaSortFlags + uintptr(j)))) & KEYINFO_ORDER_BIGNULL) != 0 { - return ts + 5410 /* "N." */ + return ts + 5425 /* "N." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zColl)) } - Xsqlite3_str_append(tls, bp+240 /* &x */, ts+5413 /* ")" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+5428 /* ")" */, 1) break } @@ -102077,7 +102585,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* { var pColl uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5415 /* "%.18s-%s" */, libc.VaList(bp+48, (*CollSeq)(unsafe.Pointer(pColl)).FzName, + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5430 /* "%.18s-%s" */, libc.VaList(bp+32, (*CollSeq)(unsafe.Pointer(pColl)).FzName, encnames[(*CollSeq)(unsafe.Pointer(pColl)).Fenc])) break @@ -102085,32 +102593,32 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -8: { var pDef uintptr = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5424 /* "%s(%d)" */, libc.VaList(bp+72, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5439 /* "%s(%d)" */, libc.VaList(bp+48, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -16: { var pDef uintptr = (*Sqlite3_context)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpFunc - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5424 /* "%s(%d)" */, libc.VaList(bp+96, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5439 /* "%s(%d)" */, libc.VaList(bp+64, (*FuncDef)(unsafe.Pointer(pDef)).FzName, int32((*FuncDef)(unsafe.Pointer(pDef)).FnArg))) break } case -14: { - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5431 /* "%lld" */, libc.VaList(bp+120, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5446 /* "%lld" */, libc.VaList(bp+80, *(*I64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } case -3: { - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5436 /* "%d" */, libc.VaList(bp+136, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5451 /* "%d" */, libc.VaList(bp+88, *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) break } case -13: { - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+152, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+96, *(*float64)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))))) break } @@ -102120,14 +102628,14 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Str) != 0 { zP4 = (*Mem)(unsafe.Pointer(pMem)).Fz } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5431 /* "%lld" */, libc.VaList(bp+168, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5446 /* "%lld" */, libc.VaList(bp+104, *(*I64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+523 /* "%.16g" */, libc.VaList(bp+184, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+538 /* "%.16g" */, libc.VaList(bp+112, *(*float64)(unsafe.Pointer(pMem /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pMem)).Fflags) & MEM_Null) != 0 { - zP4 = ts + 741 /* "NULL" */ + zP4 = ts + 756 /* "NULL" */ } else { - zP4 = ts + 5439 /* "(blob)" */ + zP4 = ts + 5454 /* "(blob)" */ } break @@ -102135,7 +102643,7 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* case -12: { var pVtab uintptr = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5446 /* "vtab:%p" */, libc.VaList(bp+200, pVtab)) + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5461 /* "vtab:%p" */, libc.VaList(bp+120, pVtab)) break } @@ -102146,20 +102654,20 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* var n U32 = *(*U32)(unsafe.Pointer(ai)) // The first element of an INTARRAY is always the // count of the number of elements to follow for i = U32(1); i <= n; i++ { - Xsqlite3_str_appendf(tls, bp+240 /* &x */, ts+5454 /* "%c%u" */, libc.VaList(bp+216, func() int32 { + Xsqlite3_str_appendf(tls, bp+144 /* &x */, ts+5469 /* "%c%u" */, libc.VaList(bp+128, func() int32 { if i == U32(1) { return '[' } return ',' }(), *(*U32)(unsafe.Pointer(ai + uintptr(i)*4)))) } - Xsqlite3_str_append(tls, bp+240 /* &x */, ts+5459 /* "]" */, 1) + Xsqlite3_str_append(tls, bp+144 /* &x */, ts+5474 /* "]" */, 1) break } case -4: { - zP4 = ts + 5461 /* "program" */ + zP4 = ts + 5476 /* "program" */ break } @@ -102183,15 +102691,15 @@ func Xsqlite3VdbeDisplayP4(tls *libc.TLS, db uintptr, pOp uintptr) uintptr { /* } } if zP4 != 0 { - Xsqlite3_str_appendall(tls, bp+240 /* &x */, zP4) + Xsqlite3_str_appendall(tls, bp+144 /* &x */, zP4) } - if (int32((*StrAccum)(unsafe.Pointer(bp+240 /* &x */)).FaccError) & SQLITE_NOMEM) != 0 { + if (int32((*StrAccum)(unsafe.Pointer(bp+144 /* &x */)).FaccError) & SQLITE_NOMEM) != 0 { Xsqlite3OomFault(tls, db) } - return Xsqlite3StrAccumFinish(tls, bp+240 /* &x */) + return Xsqlite3StrAccumFinish(tls, bp+144 /* &x */) } -var encnames = [4]uintptr{ts + 5469 /* "?" */, ts + 5471 /* "8" */, ts + 5473 /* "16LE" */, ts + 5478 /* "16BE" */} /* sqlite3.c:80570:25 */ +var encnames = [4]uintptr{ts + 5484 /* "?" */, ts + 5486 /* "8" */, ts + 5488 /* "16LE" */, ts + 5493 /* "16BE" */} /* sqlite3.c:80570:25 */ // Declare to the Vdbe that the BTree object at db->aDb[i] is used. // @@ -102722,8 +103230,8 @@ func Xsqlite3VdbeMakeReady(tls *libc.TLS, p uintptr, pParse uintptr) { /* sqlite } var azColName = [12]uintptr{ - ts + 5483 /* "addr" */, ts + 5488 /* "opcode" */, ts + 5495 /* "p1" */, ts + 5498 /* "p2" */, ts + 5501 /* "p3" */, ts + 5504 /* "p4" */, ts + 5507 /* "p5" */, ts + 5510, /* "comment" */ - ts + 5518 /* "id" */, ts + 5521 /* "parent" */, ts + 5528 /* "notused" */, ts + 5536, /* "detail" */ + ts + 5498 /* "addr" */, ts + 5503 /* "opcode" */, ts + 5510 /* "p1" */, ts + 5513 /* "p2" */, ts + 5516 /* "p3" */, ts + 5519 /* "p4" */, ts + 5522 /* "p5" */, ts + 5525, /* "comment" */ + ts + 5533 /* "id" */, ts + 5536 /* "parent" */, ts + 5543 /* "notused" */, ts + 5551, /* "detail" */ } /* sqlite3.c:81298:23 */ // Close a VDBE cursor and release all the resources that cursor @@ -102877,8 +103385,8 @@ func Xsqlite3VdbeSetColName(tls *libc.TLS, p uintptr, idx int32, var1 int32, zNa // write-transaction spanning more than one database file, this routine // takes care of the super-journal trickery. func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537:12: */ - bp := tls.Alloc(104) - defer tls.Free(104) + bp := tls.Alloc(72) + defer tls.Free(72) var i int32 var nTrans int32 = 0 // Number of databases with an active write-transaction @@ -102962,44 +103470,44 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 var pVfs uintptr = (*Sqlite3)(unsafe.Pointer(db)).FpVfs var zSuper uintptr = uintptr(0) // File-name for the super-journal var zMainFile uintptr = Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpBt) - *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)) = uintptr(0) var offset I64 = int64(0) - // var res int32 at bp+92, 4 + // var res int32 at bp+60, 4 var retryCount int32 = 0 var nMainFile int32 // Select a super-journal file name nMainFile = Xsqlite3Strlen30(tls, zMainFile) - zSuper = Xsqlite3MPrintf(tls, db, ts+5543 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) + zSuper = Xsqlite3MPrintf(tls, db, ts+5558 /* "%.4c%s%.16c" */, libc.VaList(bp, 0, zMainFile, 0)) if zSuper == uintptr(0) { return SQLITE_NOMEM } zSuper += uintptr(4) - for ok := true; ok; ok = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 92 /* res */)) != 0)) { - // var iRandom U32 at bp+88, 4 + for ok := true; ok; ok = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 60 /* res */)) != 0)) { + // var iRandom U32 at bp+56, 4 if retryCount != 0 { if retryCount > 100 { - Xsqlite3_log(tls, SQLITE_FULL, ts+5555 /* "MJ delete: %s" */, libc.VaList(bp+32, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+5570 /* "MJ delete: %s" */, libc.VaList(bp+24, zSuper)) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) break } else if retryCount == 1 { - Xsqlite3_log(tls, SQLITE_FULL, ts+5569 /* "MJ collide: %s" */, libc.VaList(bp+48, zSuper)) + Xsqlite3_log(tls, SQLITE_FULL, ts+5584 /* "MJ collide: %s" */, libc.VaList(bp+32, zSuper)) } } retryCount++ - Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+88 /* &iRandom */) - Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+5584, /* "-mj%06X9%02X" */ - libc.VaList(bp+64, ((*(*U32)(unsafe.Pointer(bp + 88 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 88 /* iRandom */))&U32(0xff)))) + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &iRandom */) + Xsqlite3_snprintf(tls, 13, (zSuper + uintptr(nMainFile)), ts+5599, /* "-mj%06X9%02X" */ + libc.VaList(bp+40, ((*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))>>8)&U32(0xffffff)), (*(*U32)(unsafe.Pointer(bp + 56 /* iRandom */))&U32(0xff)))) // The antipenultimate character of the super-journal name must // be "9" to avoid name collisions when using 8+3 filenames. - rc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+92 /* &res */) + rc = Xsqlite3OsAccess(tls, pVfs, zSuper, SQLITE_ACCESS_EXISTS, bp+60 /* &res */) } if rc == SQLITE_OK { // Open the super-journal. - rc = Xsqlite3OsOpenMalloc(tls, pVfs, zSuper, bp+96, /* &pSuperJrnl */ + rc = Xsqlite3OsOpenMalloc(tls, pVfs, zSuper, bp+64, /* &pSuperJrnl */ (((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_SUPER_JOURNAL), uintptr(0)) } if rc != SQLITE_OK { @@ -103020,10 +103528,10 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 continue // Ignore TEMP and :memory: databases } - rc = Xsqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */)), zFile, (Xsqlite3Strlen30(tls, zFile) + 1), offset) + rc = Xsqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)), zFile, (Xsqlite3Strlen30(tls, zFile) + 1), offset) offset = offset + (I64(Xsqlite3Strlen30(tls, zFile) + 1)) if rc != SQLITE_OK { - Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */))) + Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) return rc @@ -103033,9 +103541,9 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 // Sync the super-journal file. If the IOCAP_SEQUENTIAL device // flag is set this is not required. - if (0 == (Xsqlite3OsDeviceCharacteristics(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */))) & SQLITE_IOCAP_SEQUENTIAL)) && - (SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsSync(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */)), SQLITE_SYNC_NORMAL)))) { - Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */))) + if (0 == (Xsqlite3OsDeviceCharacteristics(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) & SQLITE_IOCAP_SEQUENTIAL)) && + (SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3OsSync(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */)), SQLITE_SYNC_NORMAL)))) { + Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) Xsqlite3OsDelete(tls, pVfs, zSuper, 0) Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) return rc @@ -103056,7 +103564,7 @@ func vdbeCommit(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:81537 rc = Xsqlite3BtreeCommitPhaseOne(tls, pBt, zSuper) } } - Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pSuperJrnl */))) + Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pSuperJrnl */))) if rc != SQLITE_OK { Xsqlite3DbFree(tls, db, (zSuper - uintptr(4))) @@ -103184,7 +103692,7 @@ func Xsqlite3VdbeCheckFk(tls *libc.TLS, p uintptr, deferred int32) int32 { /* sq (!(deferred != 0) && ((*Vdbe)(unsafe.Pointer(p)).FnFkConstraint > int64(0))) { (*Vdbe)(unsafe.Pointer(p)).Frc = (SQLITE_CONSTRAINT | (int32(3) << 8)) (*Vdbe)(unsafe.Pointer(p)).FerrorAction = U8(OE_Abort) - Xsqlite3VdbeError(tls, p, ts+5597 /* "FOREIGN KEY cons..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5612 /* "FOREIGN KEY cons..." */, 0) return SQLITE_ERROR } return SQLITE_OK @@ -103435,8 +103943,8 @@ func Xsqlite3VdbeTransferError(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82 // virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to // VDBE_MAGIC_INIT. func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var db uintptr db = (*Vdbe)(unsafe.Pointer(p)).Fdb @@ -103466,7 +103974,7 @@ func Xsqlite3VdbeReset(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:82187:20: // called), set the database error in this case as well. Xsqlite3ErrorWithMsg(tls, db, (*Vdbe)(unsafe.Pointer(p)).Frc, func() uintptr { if (*Vdbe)(unsafe.Pointer(p)).FzErrMsg != 0 { - return ts + 3615 /* "%s" */ + return ts + 3630 /* "%s" */ } return uintptr(0) }(), libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) @@ -105005,8 +105513,8 @@ func Xsqlite3VdbeSetVarmask(tls *libc.TLS, v uintptr, iVar int32) { /* sqlite3.c // This routine is invoked by date/time functions that use non-deterministic // features such as 'now'. func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023:20: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pOp uintptr if (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpVdbe == uintptr(0) { @@ -105017,13 +105525,13 @@ func Xsqlite3NotPureFunc(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:84023 var zContext uintptr var zMsg uintptr if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_IsCheck) != 0 { - zContext = ts + 5627 /* "a CHECK constrai..." */ + zContext = ts + 5642 /* "a CHECK constrai..." */ } else if (int32((*VdbeOp)(unsafe.Pointer(pOp)).Fp5) & NC_GenCol) != 0 { - zContext = ts + 5646 /* "a generated colu..." */ + zContext = ts + 5661 /* "a generated colu..." */ } else { - zContext = ts + 5665 /* "an index" */ + zContext = ts + 5680 /* "an index" */ } - zMsg = Xsqlite3_mprintf(tls, ts+5674, /* "non-deterministi..." */ + zMsg = Xsqlite3_mprintf(tls, ts+5689, /* "non-deterministi..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*Sqlite3_context)(unsafe.Pointer(pCtx)).FpFunc)).FzName, zContext)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -105154,7 +105662,7 @@ func Xsqlite3_expired(tls *libc.TLS, pStmt uintptr) int32 { /* sqlite3.c:84185:1 // invalid). Return false if it is ok. func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ if (*Vdbe)(unsafe.Pointer(p)).Fdb == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+5710 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+5725 /* "API called with ..." */, 0) return 1 } else { return 0 @@ -105164,7 +105672,7 @@ func vdbeSafety(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84196:12: */ func vdbeSafetyNotNull(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:84204:12: */ if p == uintptr(0) { - Xsqlite3_log(tls, SQLITE_MISUSE, ts+5755 /* "API called with ..." */, 0) + Xsqlite3_log(tls, SQLITE_MISUSE, ts+5770 /* "API called with ..." */, 0) return 1 } else { return vdbeSafety(tls, p) @@ -105634,7 +106142,7 @@ func Xsqlite3_result_error_code(tls *libc.TLS, pCtx uintptr, errCode int32) { /* func Xsqlite3_result_error_toobig(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:84708:17: */ (*Sqlite3_context)(unsafe.Pointer(pCtx)).FisError = SQLITE_TOOBIG - Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+5795 /* "string or blob t..." */, int64(-1), + Xsqlite3VdbeMemSetStr(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx)).FpOut, ts+5810 /* "string or blob t..." */, int64(-1), uint8(SQLITE_UTF8), uintptr(0)) } @@ -106373,8 +106881,8 @@ func Xsqlite3_column_origin_name16(tls *libc.TLS, pStmt uintptr, N int32) uintpt // The error code stored in database p->db is overwritten with the return // value in any case. func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pVar uintptr if vdbeSafetyNotNull(tls, p) != 0 { @@ -106385,7 +106893,7 @@ func vdbeUnbind(tls *libc.TLS, p uintptr, i int32) int32 { /* sqlite3.c:85487:12 Xsqlite3Error(tls, (*Vdbe)(unsafe.Pointer(p)).Fdb, SQLITE_MISUSE) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).Fdb)).Fmutex) Xsqlite3_log(tls, SQLITE_MISUSE, - ts+5818 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) + ts+5833 /* "bind on a busy p..." */, libc.VaList(bp, (*Vdbe)(unsafe.Pointer(p)).FzSql)) return Xsqlite3MisuseError(tls, 85498) } if (i < 1) || (i > int32((*Vdbe)(unsafe.Pointer(p)).FnVar)) { @@ -107136,111 +107644,111 @@ func findNextHostParameter(tls *libc.TLS, zSql uintptr, pnToken uintptr) int32 { // parameter index is known, locate the value in p->aVar[]. Then render // the value as a literal in place of the host parameter name. func Xsqlite3VdbeExpandSql(tls *libc.TLS, p uintptr, zRawSql uintptr) uintptr { /* sqlite3.c:86286:21: */ - bp := tls.Alloc(288) - defer tls.Free(288) + bp := tls.Alloc(248) + defer tls.Free(248) var db uintptr // The database connection - *(*int32)(unsafe.Pointer(bp + 224 /* idx */)) = 0 // Index of a host parameter + *(*int32)(unsafe.Pointer(bp + 184 /* idx */)) = 0 // Index of a host parameter var nextIndex int32 = 1 // Index of next ? host parameter var n int32 // Length of a token prefix - // var nToken int32 at bp+220, 4 + // var nToken int32 at bp+180, 4 // Length of the parameter token var i int32 // Loop counter var pVar uintptr // Value of a host parameter - // var out StrAccum at bp+88, 32 + // var out StrAccum at bp+48, 32 // Accumulate the output here - // var utf8 Mem at bp+232, 56 + // var utf8 Mem at bp+192, 56 // Used to convert UTF16 into UTF8 for display - // var zBase [100]int8 at bp+120, 100 + // var zBase [100]int8 at bp+80, 100 // Initial working space db = (*Vdbe)(unsafe.Pointer(p)).Fdb - Xsqlite3StrAccumInit(tls, bp+88 /* &out */, uintptr(0), bp+120 /* &zBase[0] */, int32(unsafe.Sizeof([100]int8{})), + Xsqlite3StrAccumInit(tls, bp+48 /* &out */, uintptr(0), bp+80 /* &zBase[0] */, int32(unsafe.Sizeof([100]int8{})), *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1 { for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { var zStart uintptr = zRawSql for (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zRawSql, 1)))) != '\n') && (*(*int8)(unsafe.Pointer(zRawSql)) != 0) { } - Xsqlite3_str_append(tls, bp+88 /* &out */, ts+5858 /* "-- " */, 3) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+5873 /* "-- " */, 3) - Xsqlite3_str_append(tls, bp+88 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) + Xsqlite3_str_append(tls, bp+48 /* &out */, zStart, (int32((int64(zRawSql) - int64(zStart)) / 1))) } } else if int32((*Vdbe)(unsafe.Pointer(p)).FnVar) == 0 { - Xsqlite3_str_append(tls, bp+88 /* &out */, zRawSql, Xsqlite3Strlen30(tls, zRawSql)) + Xsqlite3_str_append(tls, bp+48 /* &out */, zRawSql, Xsqlite3Strlen30(tls, zRawSql)) } else { for *(*int8)(unsafe.Pointer(zRawSql)) != 0 { - n = findNextHostParameter(tls, zRawSql, bp+220 /* &nToken */) + n = findNextHostParameter(tls, zRawSql, bp+180 /* &nToken */) - Xsqlite3_str_append(tls, bp+88 /* &out */, zRawSql, n) + Xsqlite3_str_append(tls, bp+48 /* &out */, zRawSql, n) zRawSql += uintptr(n) - if *(*int32)(unsafe.Pointer(bp + 220 /* nToken */)) == 0 { + if *(*int32)(unsafe.Pointer(bp + 180 /* nToken */)) == 0 { break } if int32(*(*int8)(unsafe.Pointer(zRawSql))) == '?' { - if *(*int32)(unsafe.Pointer(bp + 220 /* nToken */)) > 1 { + if *(*int32)(unsafe.Pointer(bp + 180 /* nToken */)) > 1 { - Xsqlite3GetInt32(tls, (zRawSql + 1), bp+224 /* &idx */) + Xsqlite3GetInt32(tls, (zRawSql + 1), bp+184 /* &idx */) } else { - *(*int32)(unsafe.Pointer(bp + 224 /* idx */)) = nextIndex + *(*int32)(unsafe.Pointer(bp + 184 /* idx */)) = nextIndex } } else { - *(*int32)(unsafe.Pointer(bp + 224 /* idx */)) = Xsqlite3VdbeParameterIndex(tls, p, zRawSql, *(*int32)(unsafe.Pointer(bp + 220 /* nToken */))) + *(*int32)(unsafe.Pointer(bp + 184 /* idx */)) = Xsqlite3VdbeParameterIndex(tls, p, zRawSql, *(*int32)(unsafe.Pointer(bp + 180 /* nToken */))) } - zRawSql += uintptr(*(*int32)(unsafe.Pointer(bp + 220 /* nToken */))) + zRawSql += uintptr(*(*int32)(unsafe.Pointer(bp + 180 /* nToken */))) nextIndex = func() int32 { - if (*(*int32)(unsafe.Pointer(bp + 224 /* idx */)) + 1) > (nextIndex) { - return (*(*int32)(unsafe.Pointer(bp + 224 /* idx */)) + 1) + if (*(*int32)(unsafe.Pointer(bp + 184 /* idx */)) + 1) > (nextIndex) { + return (*(*int32)(unsafe.Pointer(bp + 184 /* idx */)) + 1) } return nextIndex }() - pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 224 /* idx */))-1))*56) + pVar = ((*Vdbe)(unsafe.Pointer(p)).FaVar + uintptr((*(*int32)(unsafe.Pointer(bp + 184 /* idx */))-1))*56) if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Null) != 0 { - Xsqlite3_str_append(tls, bp+88 /* &out */, ts+741 /* "NULL" */, 4) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+756 /* "NULL" */, 4) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & (MEM_Int | MEM_IntReal)) != 0 { - Xsqlite3_str_appendf(tls, bp+88 /* &out */, ts+5431 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+5446 /* "%lld" */, libc.VaList(bp, *(*I64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Real) != 0 { - Xsqlite3_str_appendf(tls, bp+88 /* &out */, ts+5381 /* "%!.15g" */, libc.VaList(bp+16, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+5396 /* "%!.15g" */, libc.VaList(bp+8, *(*float64)(unsafe.Pointer(pVar /* &.u */)))) } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Str) != 0 { var nOut int32 // Number of bytes of the string text to include in output var enc U8 = (*Sqlite3)(unsafe.Pointer(db)).Fenc if int32(enc) != SQLITE_UTF8 { - libc.Xmemset(tls, bp+232 /* &utf8 */, 0, uint64(unsafe.Sizeof(Mem{}))) - (*Mem)(unsafe.Pointer(bp + 232 /* &utf8 */)).Fdb = db - Xsqlite3VdbeMemSetStr(tls, bp+232 /* &utf8 */, (*Mem)(unsafe.Pointer(pVar)).Fz, int64((*Mem)(unsafe.Pointer(pVar)).Fn), enc, uintptr(0)) - if SQLITE_NOMEM == Xsqlite3VdbeChangeEncoding(tls, bp+232 /* &utf8 */, SQLITE_UTF8) { - (*StrAccum)(unsafe.Pointer(bp + 88 /* &out */)).FaccError = U8(SQLITE_NOMEM) - (*StrAccum)(unsafe.Pointer(bp + 88 /* &out */)).FnAlloc = U32(0) + libc.Xmemset(tls, bp+192 /* &utf8 */, 0, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(bp + 192 /* &utf8 */)).Fdb = db + Xsqlite3VdbeMemSetStr(tls, bp+192 /* &utf8 */, (*Mem)(unsafe.Pointer(pVar)).Fz, int64((*Mem)(unsafe.Pointer(pVar)).Fn), enc, uintptr(0)) + if SQLITE_NOMEM == Xsqlite3VdbeChangeEncoding(tls, bp+192 /* &utf8 */, SQLITE_UTF8) { + (*StrAccum)(unsafe.Pointer(bp + 48 /* &out */)).FaccError = U8(SQLITE_NOMEM) + (*StrAccum)(unsafe.Pointer(bp + 48 /* &out */)).FnAlloc = U32(0) } - pVar = bp + 232 /* &utf8 */ + pVar = bp + 192 /* &utf8 */ } nOut = (*Mem)(unsafe.Pointer(pVar)).Fn - Xsqlite3_str_appendf(tls, bp+88 /* &out */, ts+5862 /* "'%.*q'" */, libc.VaList(bp+32, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+5877 /* "'%.*q'" */, libc.VaList(bp+16, nOut, (*Mem)(unsafe.Pointer(pVar)).Fz)) if int32(enc) != SQLITE_UTF8 { - Xsqlite3VdbeMemRelease(tls, bp+232 /* &utf8 */) + Xsqlite3VdbeMemRelease(tls, bp+192 /* &utf8 */) } } else if (int32((*Mem)(unsafe.Pointer(pVar)).Fflags) & MEM_Zero) != 0 { - Xsqlite3_str_appendf(tls, bp+88 /* &out */, ts+5869 /* "zeroblob(%d)" */, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+5884 /* "zeroblob(%d)" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pVar /* &.u */)))) } else { var nOut int32 // Number of bytes of the blob to include in output - Xsqlite3_str_append(tls, bp+88 /* &out */, ts+5882 /* "x'" */, 2) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+5897 /* "x'" */, 2) nOut = (*Mem)(unsafe.Pointer(pVar)).Fn for i = 0; i < nOut; i++ { - Xsqlite3_str_appendf(tls, bp+88 /* &out */, ts+5885 /* "%02x" */, libc.VaList(bp+72, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) + Xsqlite3_str_appendf(tls, bp+48 /* &out */, ts+5900 /* "%02x" */, libc.VaList(bp+40, (int32(*(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pVar)).Fz + uintptr(i))))&0xff))) } - Xsqlite3_str_append(tls, bp+88 /* &out */, ts+5890 /* "'" */, 1) + Xsqlite3_str_append(tls, bp+48 /* &out */, ts+5905 /* "'" */, 1) } } } - if (*StrAccum)(unsafe.Pointer(bp+88 /* &out */)).FaccError != 0 { - Xsqlite3_str_reset(tls, bp+88 /* &out */) + if (*StrAccum)(unsafe.Pointer(bp+48 /* &out */)).FaccError != 0 { + Xsqlite3_str_reset(tls, bp+48 /* &out */) } - return Xsqlite3StrAccumFinish(tls, bp+88 /* &out */) + return Xsqlite3StrAccumFinish(tls, bp+48 /* &out */) } //************* End of vdbetrace.c ****************************************** @@ -107626,8 +108134,8 @@ func out2Prerelease(tls *libc.TLS, p uintptr, pOp uintptr) uintptr { /* sqlite3. // Execute as much of a VDBE program as we can. // This is the core of sqlite3_step(). func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: */ - bp := tls.Alloc(1056) - defer tls.Free(1056) + bp := tls.Alloc(936) + defer tls.Free(936) var aOp uintptr // Copy of p->aOp var pOp uintptr // Current operation @@ -107664,13 +108172,13 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var type1 U16 // Numeric type of left operand var type2 U16 // Numeric type of right operand var iA I64 // Integer value of left operand - // var iB I64 at bp+296, 8 + // var iB I64 at bp+176, 8 // Integer value of right operand var rA float64 // Real value of left operand var rB float64 // same as TK_RSHIFT, in1, in2, out3 - // var iA1 I64 at bp+312, 8 + // var iA1 I64 at bp+192, 8 - // var uA U64 at bp+304, 8 + // var uA U64 at bp+184, 8 var iB1 I64 var op U8 // same as TK_GE, jump, in1, in3 @@ -107694,22 +108202,22 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var c int32 // jump, in1 var c1 int32 // out3 var pC uintptr - // var p22 U32 at bp+328, 4 + // var p22 U32 at bp+208, 4 // column number to retrieve - // var pC1 uintptr at bp+320, 8 + // var pC1 uintptr at bp+200, 8 // The VDBE cursor var pCrsr uintptr // The BTree cursor var aOffset uintptr // aOffset[i] is offset to start of data for i-th column var len int32 // The length of the serialized data for the column var i2 int32 // Loop counter var pDest uintptr // Where to write the extracted value - // var sMem Mem at bp+336, 56 + // var sMem Mem at bp+216, 56 // For storing the record being decoded var zData uintptr // Part of the record being decoded var zHdr uintptr // Next unparsed byte of the header var zEndHdr uintptr // Pointer to first byte after the header var offset64 U64 // 64-bit offset - // var t U32 at bp+392, 4 + // var t U32 at bp+272, 4 // A type code from the record header var pReg uintptr var zAffinity uintptr @@ -107731,7 +108239,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var len1 U32 // Length of a field var zHdr1 uintptr // Where to write next byte of the header var zPayload uintptr // out2 - // var nEntry I64 at bp+400, 8 + // var nEntry I64 at bp+280, 8 var pCrsr1 uintptr var isSchemaChange int32 @@ -107751,9 +108259,9 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var desiredAutoCommit int32 var iRollback int32 var pBt uintptr - // var iMeta int32 at bp+408, 4 + // var iMeta int32 at bp+288, 4 // out2 - // var iMeta1 int32 at bp+412, 4 + // var iMeta1 int32 at bp+292, 4 var iDb int32 var iCookie int32 @@ -107775,20 +108283,20 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pCx3 uintptr var flags31 U16 var newType U16 // jump, in3, group - // var res1 int32 at bp+416, 4 + // var res1 int32 at bp+296, 4 // Comparison result var oc int32 // Opcode var pC3 uintptr // The cursor to seek - // var r UnpackedRecord at bp+424, 24 + // var r UnpackedRecord at bp+304, 24 // The key to seek for var nField2 int32 // Number of columns or fields in the key var iKey I64 // The rowid we are to seek to var eqOnly int32 var pC4 uintptr - // var res3 int32 at bp+472, 4 + // var res3 int32 at bp+352, 4 var nStep int32 - // var r1 UnpackedRecord at bp+448, 24 + // var r1 UnpackedRecord at bp+328, 24 var pC5 uintptr // jump, in3 var pC6 uintptr // jump, in3 @@ -107796,28 +108304,28 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var takeJump int32 var ii1 int32 var pC7 uintptr - // var res4 int32 at bp+504, 4 + // var res4 int32 at bp+384, 4 var pFree uintptr var pIdxKey uintptr - // var r2 UnpackedRecord at bp+480, 24 + // var r2 UnpackedRecord at bp+360, 24 // If pIn3->u.i does not contain an integer, compute iKey as the // integer value of pIn3. Jump to P2 if pIn3 cannot be converted // into an integer without loss of information. Take care to avoid // changing the datatype of pIn3, however, as it is used by other // parts of the prepared statement. - // var x Mem at bp+512, 56 + // var x Mem at bp+392, 56 // jump, in3 var pC8 uintptr var pCrsr2 uintptr - // var res5 int32 at bp+568, 4 + // var res5 int32 at bp+448, 4 var iKey1 U64 // out2 - // var v I64 at bp+576, 8 + // var v I64 at bp+456, 8 // The new rowid var pC9 uintptr // Cursor of table to get the new rowid - // var res6 int32 at bp+572, 4 + // var res6 int32 at bp+452, 4 // Result of an sqlite3BtreeLast() var cnt1 int32 // Counter to limit the number of searches var pMem1 uintptr // Register holding largest rowid for AUTOINCREMENT @@ -107828,7 +108336,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var seekResult int32 // Result of prior seek or 0 if no USESEEKRESULT flag var zDb uintptr // database name - used by the update hook var pTab uintptr // Table structure - used by update and pre-update hooks - // var x1 BtreePayload at bp+584, 48 + // var x1 BtreePayload at bp+464, 48 var pDest1 uintptr // Cursor to write to var pSrc uintptr // Cursor to read from @@ -107838,7 +108346,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pTab1 uintptr var opflags int32 var pC12 uintptr - // var res7 int32 at bp+632, 4 + // var res7 int32 at bp+512, 4 var nKeyCol int32 var pC13 uintptr @@ -107846,69 +108354,69 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pCrsr3 uintptr var n3 U32 // out2 var pC15 uintptr - // var v3 I64 at bp+640, 8 + // var v3 I64 at bp+520, 8 var pVtab uintptr var pModule uintptr var pC16 uintptr // jump var pC17 uintptr var pCrsr4 uintptr - // var res8 int32 at bp+648, 4 + // var res8 int32 at bp+528, 4 // jump var pC18 uintptr var pCrsr5 uintptr - // var res9 int32 at bp+652, 4 + // var res9 int32 at bp+532, 4 var sz I64 // jump var pC19 uintptr var pCrsr6 uintptr - // var res10 int32 at bp+656, 4 + // var res10 int32 at bp+536, 4 // jump var pC20 uintptr // in2 var pC21 uintptr - // var x2 BtreePayload at bp+664, 48 + // var x2 BtreePayload at bp+544, 48 // in2 var pC22 uintptr var pC23 uintptr var pCrsr7 uintptr - // var res11 int32 at bp+736, 4 + // var res11 int32 at bp+616, 4 - // var r3 UnpackedRecord at bp+712, 24 + // var r3 UnpackedRecord at bp+592, 24 // out2 var pC24 uintptr // The P1 index cursor var pTabCur uintptr // The P2 table cursor (OP_DeferredSeek only) - // var rowid I64 at bp+744, 8 + // var rowid I64 at bp+624, 8 var pC25 uintptr var nCellKey I64 var pCur1 uintptr - // var m Mem at bp+752, 56 + // var m Mem at bp+632, 56 // jump var pC26 uintptr var res12 int32 - // var r4 UnpackedRecord at bp+808, 24 + // var r4 UnpackedRecord at bp+688, 24 // out2 - // var iMoved int32 at bp+832, 4 + // var iMoved int32 at bp+712, 4 var iDb2 int32 - // var nChange int32 at bp+836, 4 + // var nChange int32 at bp+716, 4 var pC27 uintptr // out2 - // var pgno Pgno at bp+840, 4 + // var pgno Pgno at bp+720, 4 var pDb2 uintptr var iDb3 int32 var zSchema uintptr var zSql uintptr - // var initData InitData at bp+848, 40 + // var initData InitData at bp+728, 40 var nRoot int32 // Number of tables to check. (Number of root pages.) var aRoot uintptr // Array of rootpage numbers for tables to be checked - // var nErr int32 at bp+888, 4 + // var nErr int32 at bp+768, 4 // Number of errors reported var z uintptr // Text of the error report var pnErr uintptr // jump, in1, out3 - // var val I64 at bp+896, 8 + // var val I64 at bp+776, 8 // jump, in1, in3 var iSet int32 var exists int32 // jump @@ -107923,7 +108431,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pFrame3 uintptr var pIn uintptr // in2 var pFrame4 uintptr // in1, out2, in3 - // var x3 I64 at bp+904, 8 + // var x3 I64 at bp+784, 8 var n4 int32 var pCtx uintptr @@ -107932,7 +108440,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pMem3 uintptr var pMem4 uintptr var i5 int32 // Loop counter - // var aRes [3]int32 at bp+912, 12 + // var aRes [3]int32 at bp+792, 12 // Results var pMem5 uintptr // out2 var pBt1 uintptr // Btree to change journal mode of @@ -107947,11 +108455,11 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var p13 int32 var isWriteLock U8 var pVTab uintptr - // var sMem1 Mem at bp+928, 56 + // var sMem1 Mem at bp+808, 56 // For storing the record being decoded var zTab uintptr var pCur2 uintptr - // var pVCur uintptr at bp+984, 8 + // var pVCur uintptr at bp+864, 8 var pVtab1 uintptr var pModule1 uintptr // jump @@ -107969,7 +108477,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pVtab3 uintptr var pModule3 uintptr var pDest2 uintptr - // var sContext Sqlite3_context at bp+992, 56 + // var sContext Sqlite3_context at bp+872, 56 var pCur4 uintptr // jump var pVtab4 uintptr @@ -107984,7 +108492,7 @@ func Xsqlite3VdbeExec(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:87179:20: * var pModule5 uintptr var nArg1 int32 var i7 int32 - // var rowid1 Sqlite_int64 at bp+1048, 8 + // var rowid1 Sqlite_int64 at bp+928, 8 var apArg1 uintptr var pX1 uintptr // out2 @@ -110932,19 +111440,19 @@ __190: goto __193 } - Xsqlite3VdbeError(tls, p, ts+5892 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) + Xsqlite3VdbeError(tls, p, ts+5907 /* "%s constraint fa..." */, libc.VaList(bp, azType[(int32((*Op)(unsafe.Pointer(pOp)).Fp5)-1)])) if !(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) != 0) { goto __195 } - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+5913 /* "%z: %s" */, libc.VaList(bp+16, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+5928 /* "%z: %s" */, libc.VaList(bp+8, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __195: ; goto __194 __193: - Xsqlite3VdbeError(tls, p, ts+3615 /* "%s" */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + Xsqlite3VdbeError(tls, p, ts+3630 /* "%s" */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) __194: ; - Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+5920 /* "abort at %d in [..." */, libc.VaList(bp+56, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, (*Op)(unsafe.Pointer(pOp)).Fp1, ts+5935 /* "abort at %d in [..." */, libc.VaList(bp+32, pcx, (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) __192: ; rc = Xsqlite3VdbeHalt(tls, p) @@ -111516,7 +112024,7 @@ __37: // Real value of right operand goto __236 } iA = *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) - *(*I64)(unsafe.Pointer(bp + 296 /* iB */)) = *(*I64)(unsafe.Pointer(pIn2 /* &.u */)) + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) = *(*I64)(unsafe.Pointer(pIn2 /* &.u */)) switch int32((*Op)(unsafe.Pointer(pOp)).Fopcode) { case OP_Add: goto __239 @@ -111531,7 +112039,7 @@ __37: // Real value of right operand } goto __238 __239: - if !(Xsqlite3AddInt64(tls, bp+296 /* &iB */, iA) != 0) { + if !(Xsqlite3AddInt64(tls, bp+176 /* &iB */, iA) != 0) { goto __244 } goto fp_math @@ -111539,7 +112047,7 @@ __244: ; goto __238 __240: - if !(Xsqlite3SubInt64(tls, bp+296 /* &iB */, iA) != 0) { + if !(Xsqlite3SubInt64(tls, bp+176 /* &iB */, iA) != 0) { goto __245 } goto fp_math @@ -111547,7 +112055,7 @@ __245: ; goto __238 __241: - if !(Xsqlite3MulInt64(tls, bp+296 /* &iB */, iA) != 0) { + if !(Xsqlite3MulInt64(tls, bp+176 /* &iB */, iA) != 0) { goto __246 } goto fp_math @@ -111561,13 +112069,13 @@ __242: goto arithmetic_result_is_null __247: ; - if !((iA == int64(-1)) && (*(*I64)(unsafe.Pointer(bp + 296 /* iB */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { + if !((iA == int64(-1)) && (*(*I64)(unsafe.Pointer(bp + 176 /* iB */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { goto __248 } goto fp_math __248: ; - *(*I64)(unsafe.Pointer(bp + 296 /* iB */)) /= iA + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) /= iA goto __238 __243: @@ -111583,12 +112091,12 @@ __249: iA = int64(1) __250: ; - *(*I64)(unsafe.Pointer(bp + 296 /* iB */)) %= iA + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) %= iA goto __238 __238: ; - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 296 /* iB */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) goto __237 __236: @@ -111636,7 +112144,7 @@ __259: __258: iA = Xsqlite3VdbeIntValue(tls, pIn1) - *(*I64)(unsafe.Pointer(bp + 296 /* iB */)) = Xsqlite3VdbeIntValue(tls, pIn2) + *(*I64)(unsafe.Pointer(bp + 176 /* iB */)) = Xsqlite3VdbeIntValue(tls, pIn2) if !(iA == int64(0)) { goto __260 } @@ -111649,7 +112157,7 @@ __260: iA = int64(1) __261: ; - rB = (float64(*(*I64)(unsafe.Pointer(bp + 296 /* iB */)) % iA)) + rB = (float64(*(*I64)(unsafe.Pointer(bp + 176 /* iB */)) % iA)) goto __253 __253: @@ -111737,19 +112245,19 @@ __42: goto __8 __264: ; - *(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) = Xsqlite3VdbeIntValue(tls, pIn2) + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) = Xsqlite3VdbeIntValue(tls, pIn2) iB1 = Xsqlite3VdbeIntValue(tls, pIn1) op = (*Op)(unsafe.Pointer(pOp)).Fopcode if !(int32(op) == OP_BitAnd) { goto __265 } - *(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) &= iB1 + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) &= iB1 goto __266 __265: if !(int32(op) == OP_BitOr) { goto __267 } - *(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) |= iB1 + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) |= iB1 goto __268 __267: if !(iB1 != int64(0)) { @@ -111773,31 +112281,31 @@ __270: if !(iB1 >= int64(64)) { goto __271 } - if (*(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) >= int64(0)) || (int32(op) == OP_ShiftLeft) { - *(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) = int64(0) + if (*(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) >= int64(0)) || (int32(op) == OP_ShiftLeft) { + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) = int64(0) } else { - *(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) = int64(-1) + *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) = int64(-1) } goto __272 __271: - libc.Xmemcpy(tls, bp+304 /* &uA */, bp+312 /* &iA1 */, uint64(unsafe.Sizeof(U64(0)))) + libc.Xmemcpy(tls, bp+184 /* &uA */, bp+192 /* &iA1 */, uint64(unsafe.Sizeof(U64(0)))) if !(int32(op) == OP_ShiftLeft) { goto __273 } - *(*U64)(unsafe.Pointer(bp + 304 /* uA */)) <<= iB1 + *(*U64)(unsafe.Pointer(bp + 184 /* uA */)) <<= iB1 goto __274 __273: - *(*U64)(unsafe.Pointer(bp + 304 /* uA */)) >>= iB1 + *(*U64)(unsafe.Pointer(bp + 184 /* uA */)) >>= iB1 // Sign-extend on a right shift of a negative number - if !(*(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) < int64(0)) { + if !(*(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) < int64(0)) { goto __275 } - *(*U64)(unsafe.Pointer(bp + 304 /* uA */)) |= (U64(((U64((uint64(0xffffffff))) << 32) | uint64(0xffffffff))) << (int64(64) - iB1)) + *(*U64)(unsafe.Pointer(bp + 184 /* uA */)) |= (U64(((U64((uint64(0xffffffff))) << 32) | uint64(0xffffffff))) << (int64(64) - iB1)) __275: ; __274: ; - libc.Xmemcpy(tls, bp+312 /* &iA1 */, bp+304 /* &uA */, uint64(unsafe.Sizeof(I64(0)))) + libc.Xmemcpy(tls, bp+192 /* &iA1 */, bp+184 /* &uA */, uint64(unsafe.Sizeof(I64(0)))) __272: ; __269: @@ -111806,7 +112314,7 @@ __268: ; __266: ; - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 312 /* iA1 */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 192 /* iA1 */)) (*Mem)(unsafe.Pointer(pOut)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pOut))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Int)) goto __8 @@ -112660,14 +113168,14 @@ __344: __70: // PseudoTable input register ; - *(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) + *(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) - *(*U32)(unsafe.Pointer(bp + 328 /* p22 */)) = U32((*Op)(unsafe.Pointer(pOp)).Fp2) + *(*U32)(unsafe.Pointer(bp + 208 /* p22 */)) = U32((*Op)(unsafe.Pointer(pOp)).Fp2) // If the cursor cache is stale (meaning it is not currently point at // the correct row) then bring it up-to-date by doing the necessary // B-Tree seek. - rc = Xsqlite3VdbeCursorMoveto(tls, bp+320 /* &pC1 */, bp+328 /* &p22 */) + rc = Xsqlite3VdbeCursorMoveto(tls, bp+200 /* &pC1 */, bp+208 /* &p22 */) if !(rc != 0) { goto __345 } @@ -112677,24 +113185,24 @@ __345: pDest = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) - aOffset = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaOffset + aOffset = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaOffset - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FcacheStatus != (*Vdbe)(unsafe.Pointer(p)).FcacheCtr) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FcacheStatus != (*Vdbe)(unsafe.Pointer(p)).FcacheCtr) { goto __346 } //OPTIMIZATION-IF-FALSE - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FnullRow != 0) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnullRow != 0) { goto __347 } - if !(int32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FeCurType) == CURTYPE_PSEUDO) { + if !(int32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FeCurType) == CURTYPE_PSEUDO) { goto __349 } // For the special case of as pseudo-cursor, the seekResult field // identifies the register that holds the record - pReg = (aMem + uintptr((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FseekResult)*56) + pReg = (aMem + uintptr((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FseekResult)*56) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FpayloadSize = libc.AssignPtrUint32(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */))+116 /* &.szRow */, U32((*Mem)(unsafe.Pointer(pReg)).Fn)) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow = (*Mem)(unsafe.Pointer(pReg)).Fz + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize = libc.AssignPtrUint32(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */))+116 /* &.szRow */, U32((*Mem)(unsafe.Pointer(pReg)).Fn)) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow = (*Mem)(unsafe.Pointer(pReg)).Fz goto __350 __349: Xsqlite3VdbeMemSetNull(tls, pDest) @@ -112703,13 +113211,13 @@ __350: ; goto __348 __347: - pCrsr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) + 56 /* &.uc */)) + pCrsr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 56 /* &.uc */)) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FpayloadSize = Xsqlite3BtreePayloadSize(tls, pCrsr) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow = Xsqlite3BtreePayloadFetch(tls, pCrsr, (*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) + 116 /* &.szRow */)) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize = Xsqlite3BtreePayloadSize(tls, pCrsr) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow = Xsqlite3BtreePayloadFetch(tls, pCrsr, (*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 116 /* &.szRow */)) // Maximum page size is 64KiB - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FpayloadSize > U32(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))))) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize > U32(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */))))) { goto __351 } goto too_big @@ -112717,27 +113225,27 @@ __351: ; __348: ; - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FcacheStatus = (*Vdbe)(unsafe.Pointer(p)).FcacheCtr - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FiHdrOffset = U32(func() uint8 { - if int32(*(*U8)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow))) < int32(U8(0x80)) { + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FcacheStatus = (*Vdbe)(unsafe.Pointer(p)).FcacheCtr + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset = U32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow))) < int32(U8(0x80)) { return uint8(func() int32 { - (*(*U32)(unsafe.Pointer(aOffset))) = U32(*(*U8)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow))) + (*(*U32)(unsafe.Pointer(aOffset))) = U32(*(*U8)(unsafe.Pointer((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow))) return 1 }()) } - return Xsqlite3GetVarint32(tls, (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow, (aOffset)) + return Xsqlite3GetVarint32(tls, (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow, (aOffset)) }()) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FnHdrParsed = U16(0) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed = U16(0) - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FszRow < *(*U32)(unsafe.Pointer(aOffset))) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FszRow < *(*U32)(unsafe.Pointer(aOffset))) { goto __352 } //OPTIMIZATION-IF-FALSE // pC->aRow does not have to hold the entire row, but it does at least // need to cover the header of the record. If pC->aRow does not contain // the complete header, then set it to zero, forcing the header to be // dynamically allocated. - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow = uintptr(0) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FszRow = U32(0) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow = uintptr(0) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FszRow = U32(0) // Make sure a corrupt database has not given us an oversize header. // Do this now to avoid an oversize memory allocation. @@ -112747,7 +113255,7 @@ __348: // them, respectively. So the maximum header length results from a // 3-byte type for each of the maximum of 32768 columns plus three // extra bytes for the header length itself. 32768*3 + 3 = 98307. - if !((*(*U32)(unsafe.Pointer(aOffset)) > U32(98307)) || (*(*U32)(unsafe.Pointer(aOffset)) > (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FpayloadSize)) { + if !((*(*U32)(unsafe.Pointer(aOffset)) > U32(98307)) || (*(*U32)(unsafe.Pointer(aOffset)) > (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize)) { goto __354 } goto op_column_corrupt @@ -112767,7 +113275,7 @@ __352: // content area, the "page header" comes after the page content and so // this overread is harmless. Similar overreads can occur for a corrupt // database file. - zData = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow + zData = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow // Conditional skipped goto op_column_read_header @@ -112778,57 +113286,57 @@ __346: // Make sure at least the first p2+1 entries of the header have been // parsed and valid information is in aOffset[] and pC->aType[]. - if !(U32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FnHdrParsed) <= *(*U32)(unsafe.Pointer(bp + 328 /* p22 */))) { + if !(U32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed) <= *(*U32)(unsafe.Pointer(bp + 208 /* p22 */))) { goto __355 } // If there is more header available for parsing in the record, try // to extract additional fields up through the p2+1-th field - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FiHdrOffset < *(*U32)(unsafe.Pointer(aOffset))) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset < *(*U32)(unsafe.Pointer(aOffset))) { goto __357 } // Make sure zData points to enough of the record to cover the header. - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow == uintptr(0)) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow == uintptr(0)) { goto __359 } - libc.Xmemset(tls, bp+336 /* &sMem */, 0, uint64(unsafe.Sizeof(Mem{}))) - rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) + 56 /* &.uc */)), *(*U32)(unsafe.Pointer(aOffset)), bp+336 /* &sMem */) + libc.Xmemset(tls, bp+216 /* &sMem */, 0, uint64(unsafe.Sizeof(Mem{}))) + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 56 /* &.uc */)), *(*U32)(unsafe.Pointer(aOffset)), bp+216 /* &sMem */) if !(rc != SQLITE_OK) { goto __361 } goto abort_due_to_error __361: ; - zData = (*Mem)(unsafe.Pointer(bp + 336 /* &sMem */)).Fz + zData = (*Mem)(unsafe.Pointer(bp + 216 /* &sMem */)).Fz goto __360 __359: - zData = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow + zData = (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow __360: ; // Fill in pC->aType[i] and aOffset[i] values through the p2-th field. op_column_read_header: - i2 = int32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FnHdrParsed) + i2 = int32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed) offset64 = U64(*(*U32)(unsafe.Pointer(aOffset + uintptr(i2)*4))) - zHdr = (zData + uintptr((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FiHdrOffset)) + zHdr = (zData + uintptr((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset)) zEndHdr = (zData + uintptr(*(*U32)(unsafe.Pointer(aOffset)))) __362: - if !((libc.AssignPtrUint32((*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */))+120 /* &.aType */)+uintptr(i2)*4, libc.AssignPtrUint32(bp+392 /* t */, U32(*(*U8)(unsafe.Pointer(zHdr)))))) < U32(0x80)) { + if !((libc.AssignPtrUint32((*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */))+120 /* &.aType */)+uintptr(i2)*4, libc.AssignPtrUint32(bp+272 /* t */, U32(*(*U8)(unsafe.Pointer(zHdr)))))) < U32(0x80)) { goto __365 } zHdr++ - offset64 = offset64 + (U64(Xsqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*U32)(unsafe.Pointer(bp + 392 /* t */)))))) + offset64 = offset64 + (U64(Xsqlite3VdbeOneByteSerialTypeLen(tls, uint8(*(*U32)(unsafe.Pointer(bp + 272 /* t */)))))) goto __366 __365: - zHdr += uintptr(Xsqlite3GetVarint32(tls, zHdr, bp+392 /* &t */)) - *(*U32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) + 120 /* &.aType */) + uintptr(i2)*4)) = *(*U32)(unsafe.Pointer(bp + 392 /* t */)) - offset64 = offset64 + (U64(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 392 /* t */))))) + zHdr += uintptr(Xsqlite3GetVarint32(tls, zHdr, bp+272 /* &t */)) + *(*U32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 120 /* &.aType */) + uintptr(i2)*4)) = *(*U32)(unsafe.Pointer(bp + 272 /* t */)) + offset64 = offset64 + (U64(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 272 /* t */))))) __366: ; *(*U32)(unsafe.Pointer(aOffset + uintptr(libc.PreIncInt32(&i2, 1))*4)) = (U32(offset64 & uint64(0xffffffff))) goto __363 __363: - if (U32(i2) <= *(*U32)(unsafe.Pointer(bp + 328 /* p22 */))) && (zHdr < zEndHdr) { + if (U32(i2) <= *(*U32)(unsafe.Pointer(bp + 208 /* p22 */))) && (zHdr < zEndHdr) { goto __362 } goto __364 @@ -112839,8 +113347,8 @@ __364: // (1) the bytes of the header extend past the declared header size // (2) the entire header was used but not all data was used // (3) the end of the data extends beyond the end of the record. - if !(((zHdr >= zEndHdr) && ((zHdr > zEndHdr) || (offset64 != U64((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FpayloadSize)))) || - (offset64 > U64((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FpayloadSize))) { + if !(((zHdr >= zEndHdr) && ((zHdr > zEndHdr) || (offset64 != U64((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize)))) || + (offset64 > U64((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FpayloadSize))) { goto __367 } if !(*(*U32)(unsafe.Pointer(aOffset)) == U32(0)) { @@ -112850,10 +113358,10 @@ __364: zHdr = zEndHdr goto __369 __368: - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow == uintptr(0)) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow == uintptr(0)) { goto __370 } - Xsqlite3VdbeMemRelease(tls, bp+336 /* &sMem */) + Xsqlite3VdbeMemRelease(tls, bp+216 /* &sMem */) __370: ; goto op_column_corrupt @@ -112862,24 +113370,24 @@ __369: __367: ; - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FnHdrParsed = U16(i2) - (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FiHdrOffset = (U32((int64(zHdr) - int64(zData)) / 1)) - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow == uintptr(0)) { + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed = U16(i2) + (*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FiHdrOffset = (U32((int64(zHdr) - int64(zData)) / 1)) + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow == uintptr(0)) { goto __371 } - Xsqlite3VdbeMemRelease(tls, bp+336 /* &sMem */) + Xsqlite3VdbeMemRelease(tls, bp+216 /* &sMem */) __371: ; goto __358 __357: - *(*U32)(unsafe.Pointer(bp + 392 /* t */)) = U32(0) + *(*U32)(unsafe.Pointer(bp + 272 /* t */)) = U32(0) __358: ; // If after trying to extract new entries from the header, nHdrParsed is // still not up to p2, that means that the record has fewer than p2 // columns. So the result will be either the default value or a NULL. - if !(U32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FnHdrParsed) <= *(*U32)(unsafe.Pointer(bp + 328 /* p22 */))) { + if !(U32((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FnHdrParsed) <= *(*U32)(unsafe.Pointer(bp + 208 /* p22 */))) { goto __372 } if !(int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-11)) { @@ -112896,7 +113404,7 @@ __372: ; goto __356 __355: - *(*U32)(unsafe.Pointer(bp + 392 /* t */)) = *(*U32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) + 120 /* &.aType */) + uintptr(*(*U32)(unsafe.Pointer(bp + 328 /* p22 */)))*4)) + *(*U32)(unsafe.Pointer(bp + 272 /* t */)) = *(*U32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 120 /* &.aType */) + uintptr(*(*U32)(unsafe.Pointer(bp + 208 /* p22 */)))*4)) __356: ; @@ -112911,19 +113419,19 @@ __356: __375: ; - if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FszRow >= *(*U32)(unsafe.Pointer(aOffset + uintptr((*(*U32)(unsafe.Pointer(bp + 328 /* p22 */))+U32(1)))*4))) { + if !((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FszRow >= *(*U32)(unsafe.Pointer(aOffset + uintptr((*(*U32)(unsafe.Pointer(bp + 208 /* p22 */))+U32(1)))*4))) { goto __376 } // This is the common case where the desired content fits on the original // page - where the content is not on an overflow page - zData = ((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)))).FaRow + uintptr(*(*U32)(unsafe.Pointer(aOffset + uintptr(*(*U32)(unsafe.Pointer(bp + 328 /* p22 */)))*4)))) - if !(*(*U32)(unsafe.Pointer(bp + 392 /* t */)) < U32(12)) { + zData = ((*VdbeCursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)))).FaRow + uintptr(*(*U32)(unsafe.Pointer(aOffset + uintptr(*(*U32)(unsafe.Pointer(bp + 208 /* p22 */)))*4)))) + if !(*(*U32)(unsafe.Pointer(bp + 272 /* t */)) < U32(12)) { goto __378 } - Xsqlite3VdbeSerialGet(tls, zData, *(*U32)(unsafe.Pointer(bp + 392 /* t */)), pDest) + Xsqlite3VdbeSerialGet(tls, zData, *(*U32)(unsafe.Pointer(bp + 272 /* t */)), pDest) goto __379 __378: - (*Mem)(unsafe.Pointer(pDest)).Fn = libc.AssignInt32(&len, (int32((*(*U32)(unsafe.Pointer(bp + 392 /* t */)) - U32(12)) / U32(2)))) + (*Mem)(unsafe.Pointer(pDest)).Fn = libc.AssignInt32(&len, (int32((*(*U32)(unsafe.Pointer(bp + 272 /* t */)) - U32(12)) / U32(2)))) (*Mem)(unsafe.Pointer(pDest)).Fenc = encoding if !((*Mem)(unsafe.Pointer(pDest)).FszMalloc < (len + 2)) { goto __380 @@ -112943,7 +113451,7 @@ __381: libc.Xmemcpy(tls, (*Mem)(unsafe.Pointer(pDest)).Fz, zData, uint64(len)) *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pDest)).Fz + uintptr(len))) = int8(0) *(*int8)(unsafe.Pointer((*Mem)(unsafe.Pointer(pDest)).Fz + uintptr((len + 1)))) = int8(0) - (*Mem)(unsafe.Pointer(pDest)).Fflags = aFlag1[(*(*U32)(unsafe.Pointer(bp + 392 /* t */)) & U32(1))] + (*Mem)(unsafe.Pointer(pDest)).Fflags = aFlag1[(*(*U32)(unsafe.Pointer(bp + 272 /* t */)) & U32(1))] __379: ; goto __377 @@ -112951,8 +113459,8 @@ __376: (*Mem)(unsafe.Pointer(pDest)).Fenc = encoding // This branch happens only when content is on overflow pages if !((((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & (OPFLAG_LENGTHARG | OPFLAG_TYPEOFARG)) != 0) && - (((*(*U32)(unsafe.Pointer(bp + 392 /* t */)) >= U32(12)) && ((*(*U32)(unsafe.Pointer(bp + 392 /* t */)) & U32(1)) == U32(0))) || ((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_TYPEOFARG) != 0))) || - ((libc.AssignInt32(&len, int32(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 392 /* t */)))))) == 0)) { + (((*(*U32)(unsafe.Pointer(bp + 272 /* t */)) >= U32(12)) && ((*(*U32)(unsafe.Pointer(bp + 272 /* t */)) & U32(1)) == U32(0))) || ((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_TYPEOFARG) != 0))) || + ((libc.AssignInt32(&len, int32(Xsqlite3VdbeSerialTypeLen(tls, *(*U32)(unsafe.Pointer(bp + 272 /* t */)))))) == 0)) { goto __383 } // Content is irrelevant for @@ -112967,17 +113475,17 @@ __376: // read more. Use the global constant sqlite3CtypeMap[] as the array, // as that array is 256 bytes long (plenty for VdbeMemPrettyPrint()) // and it begins with a bunch of zeros. - Xsqlite3VdbeSerialGet(tls, uintptr(uintptr(unsafe.Pointer(&Xsqlite3CtypeMap))), *(*U32)(unsafe.Pointer(bp + 392 /* t */)), pDest) + Xsqlite3VdbeSerialGet(tls, uintptr(uintptr(unsafe.Pointer(&Xsqlite3CtypeMap))), *(*U32)(unsafe.Pointer(bp + 272 /* t */)), pDest) goto __384 __383: - rc = Xsqlite3VdbeMemFromBtree(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 320 /* pC1 */)) + 56 /* &.uc */)), *(*U32)(unsafe.Pointer(aOffset + uintptr(*(*U32)(unsafe.Pointer(bp + 328 /* p22 */)))*4)), uint32(len), pDest) + rc = Xsqlite3VdbeMemFromBtree(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pC1 */)) + 56 /* &.uc */)), *(*U32)(unsafe.Pointer(aOffset + uintptr(*(*U32)(unsafe.Pointer(bp + 208 /* p22 */)))*4)), uint32(len), pDest) if !(rc != SQLITE_OK) { goto __385 } goto abort_due_to_error __385: ; - Xsqlite3VdbeSerialGet(tls, (*Mem)(unsafe.Pointer(pDest)).Fz, *(*U32)(unsafe.Pointer(bp + 392 /* t */)), pDest) + Xsqlite3VdbeSerialGet(tls, (*Mem)(unsafe.Pointer(pDest)).Fz, *(*U32)(unsafe.Pointer(bp + 272 /* t */)), pDest) *(*U16)(unsafe.Pointer(pDest + 8 /* &.flags */)) &= libc.Uint16FromInt32((libc.CplInt32(MEM_Ephem))) __384: ; @@ -113455,11 +113963,11 @@ __73: if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { goto __442 } - *(*I64)(unsafe.Pointer(bp + 400 /* nEntry */)) = Xsqlite3BtreeRowCountEst(tls, pCrsr1) + *(*I64)(unsafe.Pointer(bp + 280 /* nEntry */)) = Xsqlite3BtreeRowCountEst(tls, pCrsr1) goto __443 __442: - *(*I64)(unsafe.Pointer(bp + 400 /* nEntry */)) = int64(0) // Not needed. Only used to silence a warning. - rc = Xsqlite3BtreeCount(tls, db, pCrsr1, bp+400 /* &nEntry */) + *(*I64)(unsafe.Pointer(bp + 280 /* nEntry */)) = int64(0) // Not needed. Only used to silence a warning. + rc = Xsqlite3BtreeCount(tls, db, pCrsr1, bp+280 /* &nEntry */) if !(rc != 0) { goto __444 } @@ -113469,7 +113977,7 @@ __444: __443: ; pOut = out2Prerelease(tls, p, pOp) - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 400 /* nEntry */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 280 /* nEntry */)) goto check_for_interrupt // Opcode: Savepoint P1 * * P4 * @@ -113494,7 +114002,7 @@ __74: } // A new savepoint cannot be created if there are active write // statements (i.e. open read/write incremental blob handles). - Xsqlite3VdbeError(tls, p, ts+5944 /* "cannot open save..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5959 /* "cannot open save..." */, 0) rc = SQLITE_BUSY goto __448 __447: @@ -113567,7 +114075,7 @@ __455: if !(!(pSavepoint != 0)) { goto __456 } - Xsqlite3VdbeError(tls, p, ts+5995 /* "no such savepoin..." */, libc.VaList(bp+88, zName)) + Xsqlite3VdbeError(tls, p, ts+6010 /* "no such savepoin..." */, libc.VaList(bp+56, zName)) rc = SQLITE_ERROR goto __457 __456: @@ -113577,7 +114085,7 @@ __456: // It is not possible to release (commit) a savepoint if there are // active write statements. Xsqlite3VdbeError(tls, p, - ts+6017 /* "cannot release s..." */, 0) + ts+6032 /* "cannot release s..." */, 0) rc = SQLITE_BUSY goto __459 __458: @@ -113782,7 +114290,7 @@ __488: // If this instruction implements a COMMIT and other VMs are writing // return an error indicating that the other VMs must complete first. Xsqlite3VdbeError(tls, p, - ts+6071 /* "cannot commit tr..." */, 0) + ts+6086 /* "cannot commit tr..." */, 0) rc = SQLITE_BUSY goto abort_due_to_error goto __491 @@ -113825,13 +114333,13 @@ __486: Xsqlite3VdbeError(tls, p, func() uintptr { if !(desiredAutoCommit != 0) { - return ts + 6126 /* "cannot start a t..." */ + return ts + 6141 /* "cannot start a t..." */ } return func() uintptr { if iRollback != 0 { - return ts + 6174 /* "cannot rollback ..." */ + return ts + 6189 /* "cannot rollback ..." */ } - return ts + 6217 /* "cannot commit - ..." */ + return ts + 6232 /* "cannot commit - ..." */ }() }(), 0) @@ -113876,7 +114384,7 @@ __487: // halts. The sqlite3_step() wrapper function might then reprepare the // statement and rerun it from the beginning. __76: - *(*int32)(unsafe.Pointer(bp + 408 /* iMeta */)) = 0 + *(*int32)(unsafe.Pointer(bp + 288 /* iMeta */)) = 0 if !(((*Op)(unsafe.Pointer(pOp)).Fp2 != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_QueryOnly)) != uint64(0))) { goto __497 @@ -113890,7 +114398,7 @@ __497: if !(pBt != 0) { goto __498 } - rc = Xsqlite3BtreeBeginTrans(tls, pBt, (*Op)(unsafe.Pointer(pOp)).Fp2, bp+408 /* &iMeta */) + rc = Xsqlite3BtreeBeginTrans(tls, pBt, (*Op)(unsafe.Pointer(pOp)).Fp2, bp+288 /* &iMeta */) if !(rc != SQLITE_OK) { goto __499 @@ -113941,7 +114449,7 @@ __498: ; if !(((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) && - ((*(*int32)(unsafe.Pointer(bp + 408 /* iMeta */)) != (*Op)(unsafe.Pointer(pOp)).Fp3) || + ((*(*int32)(unsafe.Pointer(bp + 288 /* iMeta */)) != (*Op)(unsafe.Pointer(pOp)).Fp3) || ((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpSchema)).FiGeneration != *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))))) { goto __504 } @@ -113949,7 +114457,7 @@ __498: // version is checked to ensure that the schema has not changed since the // SQL statement was prepared. Xsqlite3DbFree(tls, db, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg) - (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+6258 /* "database schema ..." */) + (*Vdbe)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3DbStrDup(tls, db, ts+6273 /* "database schema ..." */) // If the schema-cookie from the database file matches the cookie // stored with the in-memory representation of the schema, do // not reload the schema from the database file. @@ -113962,7 +114470,7 @@ __498: // v-table would have to be ready for the sqlite3_vtab structure itself // to be invalidated whenever sqlite3_step() is called from within // a v-table method. - if !((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpSchema)).Fschema_cookie != *(*int32)(unsafe.Pointer(bp + 408 /* iMeta */))) { + if !((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32)).FpSchema)).Fschema_cookie != *(*int32)(unsafe.Pointer(bp + 288 /* iMeta */))) { goto __505 } Xsqlite3ResetOneSchema(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1) @@ -113996,9 +114504,9 @@ __77: iDb = (*Op)(unsafe.Pointer(pOp)).Fp1 iCookie = (*Op)(unsafe.Pointer(pOp)).Fp3 - Xsqlite3BtreeGetMeta(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpBt, iCookie, bp+412 /* &iMeta1 */) + Xsqlite3BtreeGetMeta(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FpBt, iCookie, bp+292 /* &iMeta1 */) pOut = out2Prerelease(tls, p, pOp) - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*int32)(unsafe.Pointer(bp + 412 /* iMeta1 */))) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*int32)(unsafe.Pointer(bp + 292 /* iMeta1 */))) goto __8 // Opcode: SetCookie P1 P2 P3 * P5 @@ -114331,7 +114839,7 @@ __84: // Only used when number of columns is zero (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fn = 0 - (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 740 /* "" */ + (*Mem)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56)).Fz = ts + 755 /* "" */ __524: ; pCx1 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -114644,7 +115152,7 @@ __541: goto jump_to_p2 goto __546 __545: - rc = Xsqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), bp+416 /* &res1 */) + rc = Xsqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), bp+296 /* &res1 */) if !(rc != SQLITE_OK) { goto __547 } @@ -114693,7 +115201,7 @@ __544: ; __542: ; - rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), uintptr(0), int64(U64(iKey)), 0, bp+416 /* &res1 */) + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), uintptr(0), int64(U64(iKey)), 0, bp+296 /* &res1 */) (*VdbeCursor)(unsafe.Pointer(pC3)).FmovetoTarget = iKey // Used by OP_Delete if !(rc != SQLITE_OK) { goto __553 @@ -114717,8 +115225,8 @@ __554: nField2 = *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - (*UnpackedRecord)(unsafe.Pointer(bp + 424 /* &r */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC3)).FpKeyInfo - (*UnpackedRecord)(unsafe.Pointer(bp + 424 /* &r */)).FnField = U16(nField2) + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC3)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FnField = U16(nField2) // The next line of code computes as follows, only faster: // if( oc==OP_SeekGT || oc==OP_SeekLE ){ @@ -114726,23 +115234,23 @@ __554: // }else{ // r.default_rc = +1; // } - (*UnpackedRecord)(unsafe.Pointer(bp + 424 /* &r */)).Fdefault_rc = func() int8 { + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).Fdefault_rc = func() int8 { if (1 & (oc - OP_SeekLT)) != 0 { return int8(-1) } return +int8(1) }() - (*UnpackedRecord)(unsafe.Pointer(bp + 424 /* &r */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) - (*UnpackedRecord)(unsafe.Pointer(bp + 424 /* &r */)).FeqSeen = U8(0) - rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), bp+424 /* &r */, int64(0), 0, bp+416 /* &res1 */) + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + (*UnpackedRecord)(unsafe.Pointer(bp + 304 /* &r */)).FeqSeen = U8(0) + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), bp+304 /* &r */, int64(0), 0, bp+296 /* &res1 */) if !(rc != SQLITE_OK) { goto __555 } goto abort_due_to_error __555: ; - if !((eqOnly != 0) && (int32((*UnpackedRecord)(unsafe.Pointer(bp+424 /* &r */)).FeqSeen) == 0)) { + if !((eqOnly != 0) && (int32((*UnpackedRecord)(unsafe.Pointer(bp+304 /* &r */)).FeqSeen) == 0)) { goto __556 } @@ -114754,10 +115262,10 @@ __540: if !(oc >= OP_SeekGE) { goto __557 } - if !((*(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) < 0) || ((*(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) == 0) && (oc == OP_SeekGT))) { + if !((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) < 0) || ((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) == 0) && (oc == OP_SeekGT))) { goto __559 } - *(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 0 rc = Xsqlite3BtreeNext(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), 0) if !(rc != SQLITE_OK) { goto __561 @@ -114766,7 +115274,7 @@ __540: goto __562 } rc = SQLITE_OK - *(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) = 1 + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 1 goto __563 __562: goto abort_due_to_error @@ -114776,16 +115284,16 @@ __561: ; goto __560 __559: - *(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 0 __560: ; goto __558 __557: ; - if !((*(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) > 0) || ((*(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) == 0) && (oc == OP_SeekLT))) { + if !((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) > 0) || ((*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) == 0) && (oc == OP_SeekLT))) { goto __564 } - *(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 0 rc = Xsqlite3BtreePrevious(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */)), 0) if !(rc != SQLITE_OK) { goto __566 @@ -114794,7 +115302,7 @@ __557: goto __567 } rc = SQLITE_OK - *(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) = 1 + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = 1 goto __568 __567: goto abort_due_to_error @@ -114806,7 +115314,7 @@ __566: __564: // res might be negative because the table is empty. Check to // see if this is the case. - *(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) = Xsqlite3BtreeEof(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */))) + *(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) = Xsqlite3BtreeEof(tls, *(*uintptr)(unsafe.Pointer(pC3 + 56 /* &.uc */))) __565: ; __558: @@ -114814,7 +115322,7 @@ __558: seek_not_found: ; - if !(*(*int32)(unsafe.Pointer(bp + 416 /* res1 */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 296 /* res1 */)) != 0) { goto __569 } goto jump_to_p2 @@ -114892,23 +115400,23 @@ __572: ; nStep = (*Op)(unsafe.Pointer(pOp)).Fp1 - (*UnpackedRecord)(unsafe.Pointer(bp + 448 /* &r1 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC4)).FpKeyInfo - (*UnpackedRecord)(unsafe.Pointer(bp + 448 /* &r1 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 1*24 + 16 /* &.p4 */))) - (*UnpackedRecord)(unsafe.Pointer(bp + 448 /* &r1 */)).Fdefault_rc = int8(0) - (*UnpackedRecord)(unsafe.Pointer(bp + 448 /* &r1 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp+1*24)).Fp3)*56) - *(*int32)(unsafe.Pointer(bp + 472 /* res3 */)) = 0 // Not needed. Only used to silence a warning. + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC4)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 1*24 + 16 /* &.p4 */))) + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).Fdefault_rc = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 328 /* &r1 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp+1*24)).Fp3)*56) + *(*int32)(unsafe.Pointer(bp + 352 /* res3 */)) = 0 // Not needed. Only used to silence a warning. __573: if !(1 != 0) { goto __574 } - rc = Xsqlite3VdbeIdxKeyCompare(tls, db, pC4, bp+448 /* &r1 */, bp+472 /* &res3 */) + rc = Xsqlite3VdbeIdxKeyCompare(tls, db, pC4, bp+328 /* &r1 */, bp+352 /* &res3 */) if !(rc != 0) { goto __575 } goto abort_due_to_error __575: ; - if !(*(*int32)(unsafe.Pointer(bp + 472 /* res3 */)) > 0) { + if !(*(*int32)(unsafe.Pointer(bp + 352 /* res3 */)) > 0) { goto __576 } seekscan_search_fail: @@ -114917,7 +115425,7 @@ seekscan_search_fail: goto jump_to_p2 __576: ; - if !(*(*int32)(unsafe.Pointer(bp + 472 /* res3 */)) == 0) { + if !(*(*int32)(unsafe.Pointer(bp + 352 /* res3 */)) == 0) { goto __577 } @@ -115112,10 +115620,10 @@ __99: if !(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) > 0) { goto __587 } - (*UnpackedRecord)(unsafe.Pointer(bp + 480 /* &r2 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC7)).FpKeyInfo - (*UnpackedRecord)(unsafe.Pointer(bp + 480 /* &r2 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) - (*UnpackedRecord)(unsafe.Pointer(bp + 480 /* &r2 */)).FaMem = pIn3 - pIdxKey = bp + 480 /* &r2 */ + (*UnpackedRecord)(unsafe.Pointer(bp + 360 /* &r2 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC7)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 360 /* &r2 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + (*UnpackedRecord)(unsafe.Pointer(bp + 360 /* &r2 */)).FaMem = pIn3 + pIdxKey = bp + 360 /* &r2 */ pFree = uintptr(0) goto __588 __587: @@ -115172,7 +115680,7 @@ __594: ; __591: ; - rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC7 + 56 /* &.uc */)), pIdxKey, int64(0), 0, bp+504 /* &res4 */) + rc = Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC7 + 56 /* &.uc */)), pIdxKey, int64(0), 0, bp+384 /* &res4 */) if !(pFree != 0) { goto __596 } @@ -115185,8 +115693,8 @@ __596: goto abort_due_to_error __597: ; - (*VdbeCursor)(unsafe.Pointer(pC7)).FseekResult = *(*int32)(unsafe.Pointer(bp + 504 /* res4 */)) - alreadyExists = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 504 /* res4 */)) == 0)) + (*VdbeCursor)(unsafe.Pointer(pC7)).FseekResult = *(*int32)(unsafe.Pointer(bp + 384 /* res4 */)) + alreadyExists = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 384 /* res4 */)) == 0)) (*VdbeCursor)(unsafe.Pointer(pC7)).FnullRow = (U8(1 - alreadyExists)) (*VdbeCursor)(unsafe.Pointer(pC7)).FdeferredMoveto = U8(0) (*VdbeCursor)(unsafe.Pointer(pC7)).FcacheStatus = U32(CACHE_STALE) @@ -115276,15 +115784,15 @@ __100: // into an integer without loss of information. Take care to avoid // changing the datatype of pIn3, however, as it is used by other // parts of the prepared statement. - *(*Mem)(unsafe.Pointer(bp + 512 /* x */)) = *(*Mem)(unsafe.Pointer(pIn3)) - applyAffinity(tls, bp+512 /* &x */, int8(SQLITE_AFF_NUMERIC), encoding) - if !((int32((*Mem)(unsafe.Pointer(bp+512 /* &x */)).Fflags) & MEM_Int) == 0) { + *(*Mem)(unsafe.Pointer(bp + 392 /* x */)) = *(*Mem)(unsafe.Pointer(pIn3)) + applyAffinity(tls, bp+392 /* &x */, int8(SQLITE_AFF_NUMERIC), encoding) + if !((int32((*Mem)(unsafe.Pointer(bp+392 /* &x */)).Fflags) & MEM_Int) == 0) { goto __604 } goto jump_to_p2 __604: ; - iKey1 = U64(*(*I64)(unsafe.Pointer(bp + 512 /* &x */ /* &.u */))) + iKey1 = U64(*(*I64)(unsafe.Pointer(bp + 392 /* &x */ /* &.u */))) goto notExistsWithKey __603: ; @@ -115297,16 +115805,16 @@ notExistsWithKey: pCrsr2 = *(*uintptr)(unsafe.Pointer(pC8 + 56 /* &.uc */)) - *(*int32)(unsafe.Pointer(bp + 568 /* res5 */)) = 0 - rc = Xsqlite3BtreeMovetoUnpacked(tls, pCrsr2, uintptr(0), int64(iKey1), 0, bp+568 /* &res5 */) + *(*int32)(unsafe.Pointer(bp + 448 /* res5 */)) = 0 + rc = Xsqlite3BtreeMovetoUnpacked(tls, pCrsr2, uintptr(0), int64(iKey1), 0, bp+448 /* &res5 */) (*VdbeCursor)(unsafe.Pointer(pC8)).FmovetoTarget = I64(iKey1) // Used by OP_Delete (*VdbeCursor)(unsafe.Pointer(pC8)).FnullRow = U8(0) (*VdbeCursor)(unsafe.Pointer(pC8)).FcacheStatus = U32(CACHE_STALE) (*VdbeCursor)(unsafe.Pointer(pC8)).FdeferredMoveto = U8(0) - (*VdbeCursor)(unsafe.Pointer(pC8)).FseekResult = *(*int32)(unsafe.Pointer(bp + 568 /* res5 */)) - if !(*(*int32)(unsafe.Pointer(bp + 568 /* res5 */)) != 0) { + (*VdbeCursor)(unsafe.Pointer(pC8)).FseekResult = *(*int32)(unsafe.Pointer(bp + 448 /* res5 */)) + if !(*(*int32)(unsafe.Pointer(bp + 448 /* res5 */)) != 0) { goto __605 } @@ -115359,8 +115867,8 @@ __102: // out2 // AUTOINCREMENT feature. __103: // Root frame of VDBE - *(*I64)(unsafe.Pointer(bp + 576 /* v */)) = int64(0) - *(*int32)(unsafe.Pointer(bp + 572 /* res6 */)) = 0 + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) = 0 pOut = out2Prerelease(tls, p, pOp) pC9 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) @@ -115385,28 +115893,28 @@ __103: // Root frame of VDBE if !(!((int32(*(*uint8)(unsafe.Pointer(pC9 + 8 /* &.useRandomRowid */)) & 0x2 >> 1)) != 0)) { goto __609 } - rc = Xsqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */)), bp+572 /* &res6 */) + rc = Xsqlite3BtreeLast(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */)), bp+452 /* &res6 */) if !(rc != SQLITE_OK) { goto __610 } goto abort_due_to_error __610: ; - if !(*(*int32)(unsafe.Pointer(bp + 572 /* res6 */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) != 0) { goto __611 } - *(*I64)(unsafe.Pointer(bp + 576 /* v */)) = int64(1) // IMP: R-61914-48074 + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = int64(1) // IMP: R-61914-48074 goto __612 __611: ; - *(*I64)(unsafe.Pointer(bp + 576 /* v */)) = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */))) - if !(*(*I64)(unsafe.Pointer(bp + 576 /* v */)) >= (int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) { + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */))) + if !(*(*I64)(unsafe.Pointer(bp + 456 /* v */)) >= (int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) { goto __613 } libc.SetBitFieldPtr8Uint32(pC9+8 /* &.useRandomRowid */, Bool(1), 1, 0x2) goto __614 __613: - *(*I64)(unsafe.Pointer(bp + 576 /* v */))++ // IMP: R-29538-34987 + *(*I64)(unsafe.Pointer(bp + 456 /* v */))++ // IMP: R-29538-34987 __614: ; __612: @@ -115455,13 +115963,13 @@ __617: goto abort_due_to_error __621: ; - if !(*(*I64)(unsafe.Pointer(bp + 576 /* v */)) < (*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) + int64(1))) { + if !(*(*I64)(unsafe.Pointer(bp + 456 /* v */)) < (*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) + int64(1))) { goto __622 } - *(*I64)(unsafe.Pointer(bp + 576 /* v */)) = (*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) + int64(1)) + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) = (*(*I64)(unsafe.Pointer(pMem1 /* &.u */)) + int64(1)) __622: ; - *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 576 /* v */)) + *(*I64)(unsafe.Pointer(pMem1 /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 456 /* v */)) __615: ; if !((Bool(int32(*(*uint8)(unsafe.Pointer(pC9 + 8 /* &.useRandomRowid */)) & 0x2 >> 1))) != 0) { @@ -115475,14 +115983,14 @@ __615: // an AUTOINCREMENT table. cnt1 = 0 __624: - Xsqlite3_randomness(tls, int32(unsafe.Sizeof(I64(0))), bp+576 /* &v */) - *(*I64)(unsafe.Pointer(bp + 576 /* v */)) &= (I64((int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) >> 1) - *(*I64)(unsafe.Pointer(bp + 576 /* v */))++ // Ensure that v is greater than zero + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(I64(0))), bp+456 /* &v */) + *(*I64)(unsafe.Pointer(bp + 456 /* v */)) &= (I64((int64((U64((uint64(0x7fffffff))) << 32) | uint64(0xffffffff)))) >> 1) + *(*I64)(unsafe.Pointer(bp + 456 /* v */))++ // Ensure that v is greater than zero goto __625 __625: - if (((libc.AssignInt32(&rc, Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */)), uintptr(0), int64(U64(*(*I64)(unsafe.Pointer(bp + 576 /* v */)))), - 0, bp+572 /* &res6 */))) == SQLITE_OK) && - (*(*int32)(unsafe.Pointer(bp + 572 /* res6 */)) == 0)) && + if (((libc.AssignInt32(&rc, Xsqlite3BtreeMovetoUnpacked(tls, *(*uintptr)(unsafe.Pointer(pC9 + 56 /* &.uc */)), uintptr(0), int64(U64(*(*I64)(unsafe.Pointer(bp + 456 /* v */)))), + 0, bp+452 /* &res6 */))) == SQLITE_OK) && + (*(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) == 0)) && (libc.PreIncInt32(&cnt1, 1) < 100) { goto __624 } @@ -115495,7 +116003,7 @@ __626: goto abort_due_to_error __627: ; - if !(*(*int32)(unsafe.Pointer(bp + 572 /* res6 */)) == 0) { + if !(*(*int32)(unsafe.Pointer(bp + 452 /* res6 */)) == 0) { goto __628 } rc = SQLITE_FULL // IMP: R-38219-53002 @@ -115508,7 +116016,7 @@ __623: (*VdbeCursor)(unsafe.Pointer(pC9)).FdeferredMoveto = U8(0) (*VdbeCursor)(unsafe.Pointer(pC9)).FcacheStatus = U32(CACHE_STALE) - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 576 /* v */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 456 /* v */)) goto __8 // Opcode: Insert P1 P2 P3 P4 P5 @@ -115555,7 +116063,7 @@ __104: // Payload to be inserted pKey = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) - (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FnKey = *(*I64)(unsafe.Pointer(pKey /* &.u */)) + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnKey = *(*I64)(unsafe.Pointer(pKey /* &.u */)) if !((int32((*Op)(unsafe.Pointer(pOp)).Fp4type) == (-6)) && (((*Sqlite3)(unsafe.Pointer((db))).FxPreUpdateCallback != 0) || ((*Sqlite3)(unsafe.Pointer((db))).FxUpdateCallback != 0))) { goto __629 @@ -115578,7 +116086,7 @@ __630: if !(((*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0) && !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_ISUPDATE) != 0)) { goto __632 } - Xsqlite3VdbePreUpdateHook(tls, p, pC10, SQLITE_INSERT, zDb, pTab, (*BtreePayload)(unsafe.Pointer(bp+584 /* &x1 */)).FnKey, (*Op)(unsafe.Pointer(pOp)).Fp2, -1) + Xsqlite3VdbePreUpdateHook(tls, p, pC10, SQLITE_INSERT, zDb, pTab, (*BtreePayload)(unsafe.Pointer(bp+464 /* &x1 */)).FnKey, (*Op)(unsafe.Pointer(pOp)).Fp2, -1) __632: ; if !(((*Sqlite3)(unsafe.Pointer(db)).FxUpdateCallback == uintptr(0)) || ((*Table)(unsafe.Pointer(pTab)).FaCol == uintptr(0))) { @@ -115606,12 +116114,12 @@ __635: if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_LASTROWID) != 0) { goto __636 } - (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FnKey + (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnKey __636: ; - (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FpData = (*Mem)(unsafe.Pointer(pData)).Fz - (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FnData = (*Mem)(unsafe.Pointer(pData)).Fn + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FpData = (*Mem)(unsafe.Pointer(pData)).Fz + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnData = (*Mem)(unsafe.Pointer(pData)).Fn seekResult = func() int32 { if (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_USESEEKRESULT) != 0 { return (*VdbeCursor)(unsafe.Pointer(pC10)).FseekResult @@ -115621,14 +116129,14 @@ __636: if !((int32((*Mem)(unsafe.Pointer(pData)).Fflags) & MEM_Zero) != 0) { goto __637 } - (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FnZero = *(*int32)(unsafe.Pointer(pData /* &.u */)) + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnZero = *(*int32)(unsafe.Pointer(pData /* &.u */)) goto __638 __637: - (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FnZero = 0 + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FnZero = 0 __638: ; - (*BtreePayload)(unsafe.Pointer(bp + 584 /* &x1 */)).FpKey = uintptr(0) - rc = Xsqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC10 + 56 /* &.uc */)), bp+584, /* &x1 */ + (*BtreePayload)(unsafe.Pointer(bp + 464 /* &x1 */)).FpKey = uintptr(0) + rc = Xsqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC10 + 56 /* &.uc */)), bp+464, /* &x1 */ (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & ((OPFLAG_APPEND | OPFLAG_SAVEPOSITION) | OPFLAG_PREFORMAT)), seekResult) (*VdbeCursor)(unsafe.Pointer(pC10)).FdeferredMoveto = U8(0) @@ -115652,7 +116160,7 @@ __639: } return SQLITE_INSERT }(), - zDb, (*Table)(unsafe.Pointer(pTab)).FzName, (*BtreePayload)(unsafe.Pointer(bp+584 /* &x1 */)).FnKey) + zDb, (*Table)(unsafe.Pointer(pTab)).FzName, (*BtreePayload)(unsafe.Pointer(bp+464 /* &x1 */)).FnKey) __640: ; goto __8 @@ -115834,8 +116342,8 @@ __108: pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) nKeyCol = *(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - *(*int32)(unsafe.Pointer(bp + 632 /* res7 */)) = 0 - rc = Xsqlite3VdbeSorterCompare(tls, pC12, pIn3, nKeyCol, bp+632 /* &res7 */) + *(*int32)(unsafe.Pointer(bp + 512 /* res7 */)) = 0 + rc = Xsqlite3VdbeSorterCompare(tls, pC12, pIn3, nKeyCol, bp+512 /* &res7 */) if !(rc != 0) { goto __650 @@ -115843,7 +116351,7 @@ __108: goto abort_due_to_error __650: ; - if !(*(*int32)(unsafe.Pointer(bp + 632 /* res7 */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 512 /* res7 */)) != 0) { goto __651 } goto jump_to_p2 @@ -115975,7 +116483,7 @@ __657: if !((*VdbeCursor)(unsafe.Pointer(pC15)).FdeferredMoveto != 0) { goto __659 } - *(*I64)(unsafe.Pointer(bp + 640 /* v3 */)) = (*VdbeCursor)(unsafe.Pointer(pC15)).FmovetoTarget + *(*I64)(unsafe.Pointer(bp + 520 /* v3 */)) = (*VdbeCursor)(unsafe.Pointer(pC15)).FmovetoTarget goto __660 __659: if !(int32((*VdbeCursor)(unsafe.Pointer(pC15)).FeCurType) == CURTYPE_VTAB) { @@ -115985,7 +116493,7 @@ __659: pVtab = (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */)))).FpVtab pModule = (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FpModule - rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pModule + 96 /* &.xRowid */))))(tls, *(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */)), bp+640 /* &v3 */) + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pModule + 96 /* &.xRowid */))))(tls, *(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */)), bp+520 /* &v3 */) Xsqlite3VtabImportErrmsg(tls, p, pVtab) if !(rc != 0) { goto __663 @@ -116011,14 +116519,14 @@ __664: goto __8 __665: ; - *(*I64)(unsafe.Pointer(bp + 640 /* v3 */)) = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */))) + *(*I64)(unsafe.Pointer(bp + 520 /* v3 */)) = Xsqlite3BtreeIntegerKey(tls, *(*uintptr)(unsafe.Pointer(pC15 + 56 /* &.uc */))) __662: ; __660: ; __658: ; - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 640 /* v3 */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 520 /* v3 */)) goto __8 // Opcode: NullRow P1 * * * * @@ -116067,7 +116575,7 @@ __114: pC17 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) pCrsr4 = *(*uintptr)(unsafe.Pointer(pC17 + 56 /* &.uc */)) - *(*int32)(unsafe.Pointer(bp + 648 /* res8 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 528 /* res8 */)) = 0 if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) == OP_SeekEnd) { goto __667 @@ -116082,8 +116590,8 @@ __668: ; __667: ; - rc = Xsqlite3BtreeLast(tls, pCrsr4, bp+648 /* &res8 */) - (*VdbeCursor)(unsafe.Pointer(pC17)).FnullRow = U8(*(*int32)(unsafe.Pointer(bp + 648 /* res8 */))) + rc = Xsqlite3BtreeLast(tls, pCrsr4, bp+528 /* &res8 */) + (*VdbeCursor)(unsafe.Pointer(pC17)).FnullRow = U8(*(*int32)(unsafe.Pointer(bp + 528 /* res8 */))) (*VdbeCursor)(unsafe.Pointer(pC17)).FdeferredMoveto = U8(0) (*VdbeCursor)(unsafe.Pointer(pC17)).FcacheStatus = U32(CACHE_STALE) if !(rc != 0) { @@ -116096,7 +116604,7 @@ __669: goto __670 } - if !(*(*int32)(unsafe.Pointer(bp + 648 /* res8 */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 528 /* res8 */)) != 0) { goto __671 } goto jump_to_p2 @@ -116116,27 +116624,27 @@ __115: pCrsr5 = *(*uintptr)(unsafe.Pointer(pC18 + 56 /* &.uc */)) - rc = Xsqlite3BtreeFirst(tls, pCrsr5, bp+652 /* &res9 */) + rc = Xsqlite3BtreeFirst(tls, pCrsr5, bp+532 /* &res9 */) if !(rc != 0) { goto __672 } goto abort_due_to_error __672: ; - if !(*(*int32)(unsafe.Pointer(bp + 652 /* res9 */)) == 0) { + if !(*(*int32)(unsafe.Pointer(bp + 532 /* res9 */)) == 0) { goto __673 } sz = Xsqlite3BtreeRowCountEst(tls, pCrsr5) if !((sz >= int64(0)) && (int32(Xsqlite3LogEst(tls, U64(sz))) < (*Op)(unsafe.Pointer(pOp)).Fp3)) { goto __674 } - *(*int32)(unsafe.Pointer(bp + 652 /* res9 */)) = 1 + *(*int32)(unsafe.Pointer(bp + 532 /* res9 */)) = 1 __674: ; __673: ; - if !(*(*int32)(unsafe.Pointer(bp + 652 /* res9 */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 532 /* res9 */)) != 0) { goto __675 } goto jump_to_p2 @@ -116183,17 +116691,17 @@ __118: pC19 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) - *(*int32)(unsafe.Pointer(bp + 656 /* res10 */)) = 1 + *(*int32)(unsafe.Pointer(bp + 536 /* res10 */)) = 1 if !(int32((*VdbeCursor)(unsafe.Pointer((pC19))).FeCurType) == CURTYPE_SORTER) { goto __676 } - rc = Xsqlite3VdbeSorterRewind(tls, pC19, bp+656 /* &res10 */) + rc = Xsqlite3VdbeSorterRewind(tls, pC19, bp+536 /* &res10 */) goto __677 __676: ; pCrsr6 = *(*uintptr)(unsafe.Pointer(pC19 + 56 /* &.uc */)) - rc = Xsqlite3BtreeFirst(tls, pCrsr6, bp+656 /* &res10 */) + rc = Xsqlite3BtreeFirst(tls, pCrsr6, bp+536 /* &res10 */) (*VdbeCursor)(unsafe.Pointer(pC19)).FdeferredMoveto = U8(0) (*VdbeCursor)(unsafe.Pointer(pC19)).FcacheStatus = U32(CACHE_STALE) __677: @@ -116204,9 +116712,9 @@ __677: goto abort_due_to_error __678: ; - (*VdbeCursor)(unsafe.Pointer(pC19)).FnullRow = U8(*(*int32)(unsafe.Pointer(bp + 656 /* res10 */))) + (*VdbeCursor)(unsafe.Pointer(pC19)).FnullRow = U8(*(*int32)(unsafe.Pointer(bp + 536 /* res10 */))) - if !(*(*int32)(unsafe.Pointer(bp + 656 /* res10 */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 536 /* res10 */)) != 0) { goto __679 } goto jump_to_p2 @@ -116360,11 +116868,11 @@ __682: goto abort_due_to_error __683: ; - (*BtreePayload)(unsafe.Pointer(bp + 664 /* &x2 */)).FnKey = Sqlite3_int64((*Mem)(unsafe.Pointer(pIn2)).Fn) - (*BtreePayload)(unsafe.Pointer(bp + 664 /* &x2 */)).FpKey = (*Mem)(unsafe.Pointer(pIn2)).Fz - (*BtreePayload)(unsafe.Pointer(bp + 664 /* &x2 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) - (*BtreePayload)(unsafe.Pointer(bp + 664 /* &x2 */)).FnMem = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) - rc = Xsqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC21 + 56 /* &.uc */)), bp+664, /* &x2 */ + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FnKey = Sqlite3_int64((*Mem)(unsafe.Pointer(pIn2)).Fn) + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FpKey = (*Mem)(unsafe.Pointer(pIn2)).Fz + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + (*BtreePayload)(unsafe.Pointer(bp + 544 /* &x2 */)).FnMem = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + rc = Xsqlite3BtreeInsert(tls, *(*uintptr)(unsafe.Pointer(pC21 + 56 /* &.uc */)), bp+544, /* &x2 */ (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & ((OPFLAG_APPEND | OPFLAG_SAVEPOSITION) | OPFLAG_PREFORMAT)), func() int32 { if (int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_USESEEKRESULT) != 0 { @@ -116435,18 +116943,18 @@ __124: pCrsr7 = *(*uintptr)(unsafe.Pointer(pC23 + 56 /* &.uc */)) - (*UnpackedRecord)(unsafe.Pointer(bp + 712 /* &r3 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC23)).FpKeyInfo - (*UnpackedRecord)(unsafe.Pointer(bp + 712 /* &r3 */)).FnField = U16((*Op)(unsafe.Pointer(pOp)).Fp3) - (*UnpackedRecord)(unsafe.Pointer(bp + 712 /* &r3 */)).Fdefault_rc = int8(0) - (*UnpackedRecord)(unsafe.Pointer(bp + 712 /* &r3 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) - rc = Xsqlite3BtreeMovetoUnpacked(tls, pCrsr7, bp+712 /* &r3 */, int64(0), 0, bp+736 /* &res11 */) + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC23)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).FnField = U16((*Op)(unsafe.Pointer(pOp)).Fp3) + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).Fdefault_rc = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 592 /* &r3 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56) + rc = Xsqlite3BtreeMovetoUnpacked(tls, pCrsr7, bp+592 /* &r3 */, int64(0), 0, bp+616 /* &res11 */) if !(rc != 0) { goto __687 } goto abort_due_to_error __687: ; - if !(*(*int32)(unsafe.Pointer(bp + 736 /* res11 */)) == 0) { + if !(*(*int32)(unsafe.Pointer(bp + 616 /* res11 */)) == 0) { goto __688 } rc = Xsqlite3BtreeDelete(tls, pCrsr7, uint8(BTREE_AUXDELETE)) @@ -116461,7 +116969,7 @@ __688: if !((*Op)(unsafe.Pointer(pOp)).Fp5 != 0) { goto __691 } - rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+6286 /* "index corruption" */) + rc = Xsqlite3ReportError(tls, (SQLITE_CORRUPT | (int32(3) << 8)), 92446, ts+6301 /* "index corruption" */) goto abort_due_to_error __691: ; @@ -116521,8 +117029,8 @@ __692: if !(!(int32((*VdbeCursor)(unsafe.Pointer(pC24)).FnullRow) != 0)) { goto __693 } - *(*I64)(unsafe.Pointer(bp + 744 /* rowid */)) = int64(0) // Not needed. Only used to silence a warning. - rc = Xsqlite3VdbeIdxRowid(tls, db, *(*uintptr)(unsafe.Pointer(pC24 + 56 /* &.uc */)), bp+744 /* &rowid */) + *(*I64)(unsafe.Pointer(bp + 624 /* rowid */)) = int64(0) // Not needed. Only used to silence a warning. + rc = Xsqlite3VdbeIdxRowid(tls, db, *(*uintptr)(unsafe.Pointer(pC24 + 56 /* &.uc */)), bp+624 /* &rowid */) if !(rc != SQLITE_OK) { goto __695 } @@ -116536,7 +117044,7 @@ __695: pTabCur = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*8)) (*VdbeCursor)(unsafe.Pointer(pTabCur)).FnullRow = U8(0) - (*VdbeCursor)(unsafe.Pointer(pTabCur)).FmovetoTarget = *(*I64)(unsafe.Pointer(bp + 744 /* rowid */)) + (*VdbeCursor)(unsafe.Pointer(pTabCur)).FmovetoTarget = *(*I64)(unsafe.Pointer(bp + 624 /* rowid */)) (*VdbeCursor)(unsafe.Pointer(pTabCur)).FdeferredMoveto = U8(1) (*VdbeCursor)(unsafe.Pointer(pTabCur)).FaAltMap = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) @@ -116545,7 +117053,7 @@ __695: goto __697 __696: pOut = out2Prerelease(tls, p, pOp) - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 744 /* rowid */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 624 /* rowid */)) __697: ; goto __694 @@ -116626,20 +117134,20 @@ __131: ; pC26 = *(*uintptr)(unsafe.Pointer((*Vdbe)(unsafe.Pointer(p)).FapCsr + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*8)) - (*UnpackedRecord)(unsafe.Pointer(bp + 808 /* &r4 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC26)).FpKeyInfo - (*UnpackedRecord)(unsafe.Pointer(bp + 808 /* &r4 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).FpKeyInfo = (*VdbeCursor)(unsafe.Pointer(pC26)).FpKeyInfo + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).FnField = U16(*(*int32)(unsafe.Pointer(pOp + 16 /* &.p4 */))) if !(int32((*Op)(unsafe.Pointer(pOp)).Fopcode) < OP_IdxLT) { goto __700 } - (*UnpackedRecord)(unsafe.Pointer(bp + 808 /* &r4 */)).Fdefault_rc = int8(-1) + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).Fdefault_rc = int8(-1) goto __701 __700: ; - (*UnpackedRecord)(unsafe.Pointer(bp + 808 /* &r4 */)).Fdefault_rc = int8(0) + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).Fdefault_rc = int8(0) __701: ; - (*UnpackedRecord)(unsafe.Pointer(bp + 808 /* &r4 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) + (*UnpackedRecord)(unsafe.Pointer(bp + 688 /* &r4 */)).FaMem = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) /* Inlined version of sqlite3VdbeIdxKeyCompare() */ @@ -116657,16 +117165,16 @@ __701: goto abort_due_to_error __702: ; - Xsqlite3VdbeMemInit(tls, bp+752 /* &m */, db, uint16(0)) - rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, pCur1, U32(nCellKey), bp+752 /* &m */) + Xsqlite3VdbeMemInit(tls, bp+632 /* &m */, db, uint16(0)) + rc = Xsqlite3VdbeMemFromBtreeZeroOffset(tls, pCur1, U32(nCellKey), bp+632 /* &m */) if !(rc != 0) { goto __703 } goto abort_due_to_error __703: ; - res12 = Xsqlite3VdbeRecordCompareWithSkip(tls, (*Mem)(unsafe.Pointer(bp+752 /* &m */)).Fn, (*Mem)(unsafe.Pointer(bp+752 /* &m */)).Fz, bp+808 /* &r4 */, 0) - Xsqlite3VdbeMemRelease(tls, bp+752 /* &m */) + res12 = Xsqlite3VdbeRecordCompareWithSkip(tls, (*Mem)(unsafe.Pointer(bp+632 /* &m */)).Fn, (*Mem)(unsafe.Pointer(bp+632 /* &m */)).Fz, bp+688 /* &r4 */, 0) + Xsqlite3VdbeMemRelease(tls, bp+632 /* &m */) // End of inlined sqlite3VdbeIdxKeyCompare() @@ -116731,20 +117239,20 @@ __132: __707: iDb2 = (*Op)(unsafe.Pointer(pOp)).Fp3 - *(*int32)(unsafe.Pointer(bp + 832 /* iMoved */)) = 0 // Not needed. Only to silence a warning. - rc = Xsqlite3BtreeDropTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb2)*32)).FpBt, (*Op)(unsafe.Pointer(pOp)).Fp1, bp+832 /* &iMoved */) + *(*int32)(unsafe.Pointer(bp + 712 /* iMoved */)) = 0 // Not needed. Only to silence a warning. + rc = Xsqlite3BtreeDropTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb2)*32)).FpBt, (*Op)(unsafe.Pointer(pOp)).Fp1, bp+712 /* &iMoved */) (*Mem)(unsafe.Pointer(pOut)).Fflags = U16(MEM_Int) - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*int32)(unsafe.Pointer(bp + 832 /* iMoved */))) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*int32)(unsafe.Pointer(bp + 712 /* iMoved */))) if !(rc != 0) { goto __709 } goto abort_due_to_error __709: ; - if !(*(*int32)(unsafe.Pointer(bp + 832 /* iMoved */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 712 /* iMoved */)) != 0) { goto __710 } - Xsqlite3RootPageMoved(tls, db, iDb2, uint32(*(*int32)(unsafe.Pointer(bp + 832 /* iMoved */))), uint32((*Op)(unsafe.Pointer(pOp)).Fp1)) + Xsqlite3RootPageMoved(tls, db, iDb2, uint32(*(*int32)(unsafe.Pointer(bp + 712 /* iMoved */))), uint32((*Op)(unsafe.Pointer(pOp)).Fp1)) // All OP_Destroy operations occur on the same btree resetSchemaOnFault = (U8(iDb2 + 1)) @@ -116772,18 +117280,18 @@ __708: // See also: Destroy __133: ; - *(*int32)(unsafe.Pointer(bp + 836 /* nChange */)) = 0 + *(*int32)(unsafe.Pointer(bp + 716 /* nChange */)) = 0 - rc = Xsqlite3BtreeClearTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*32)).FpBt, int32(U32((*Op)(unsafe.Pointer(pOp)).Fp1)), bp+836 /* &nChange */) + rc = Xsqlite3BtreeClearTable(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*32)).FpBt, int32(U32((*Op)(unsafe.Pointer(pOp)).Fp1)), bp+716 /* &nChange */) if !((*Op)(unsafe.Pointer(pOp)).Fp3 != 0) { goto __711 } - *(*int32)(unsafe.Pointer(p + 60 /* &.nChange */)) += (*(*int32)(unsafe.Pointer(bp + 836 /* nChange */))) + *(*int32)(unsafe.Pointer(p + 60 /* &.nChange */)) += (*(*int32)(unsafe.Pointer(bp + 716 /* nChange */))) if !((*Op)(unsafe.Pointer(pOp)).Fp3 > 0) { goto __712 } - *(*I64)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56 /* &.u */ /* &.i */)) += (I64(*(*int32)(unsafe.Pointer(bp + 836 /* nChange */)))) + *(*I64)(unsafe.Pointer(aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56 /* &.u */ /* &.i */)) += (I64(*(*int32)(unsafe.Pointer(bp + 716 /* nChange */)))) __712: ; __711: @@ -116837,18 +117345,18 @@ __715: __135: ; pOut = out2Prerelease(tls, p, pOp) - *(*Pgno)(unsafe.Pointer(bp + 840 /* pgno */)) = Pgno(0) + *(*Pgno)(unsafe.Pointer(bp + 720 /* pgno */)) = Pgno(0) pDb2 = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*32) - rc = Xsqlite3BtreeCreateTable(tls, (*Db)(unsafe.Pointer(pDb2)).FpBt, bp+840 /* &pgno */, (*Op)(unsafe.Pointer(pOp)).Fp3) + rc = Xsqlite3BtreeCreateTable(tls, (*Db)(unsafe.Pointer(pDb2)).FpBt, bp+720 /* &pgno */, (*Op)(unsafe.Pointer(pOp)).Fp3) if !(rc != 0) { goto __717 } goto abort_due_to_error __717: ; - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*Pgno)(unsafe.Pointer(bp + 840 /* pgno */))) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = I64(*(*Pgno)(unsafe.Pointer(bp + 720 /* pgno */))) goto __8 // Opcode: SqlExec * * * P4 * @@ -116894,15 +117402,15 @@ __137: goto __720 __719: - zSchema = ts + 6303 /* "sqlite_master" */ - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).Fdb = db - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).FiDb = iDb3 - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).FmInitFlags = U32(0) - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) + zSchema = ts + 6318 /* "sqlite_master" */ + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Fdb = db + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FiDb = iDb3 + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FpzErrMsg = (p + 168 /* &.zErrMsg */) + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmInitFlags = U32(0) + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+6317, /* "SELECT*FROM\"%w\"...." */ - libc.VaList(bp+104, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) + ts+6332, /* "SELECT*FROM\"%w\"...." */ + libc.VaList(bp+64, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb3)*32)).FzDbSName, zSchema, *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))) if !(zSql == uintptr(0)) { goto __721 } @@ -116911,19 +117419,19 @@ __719: __721: ; (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy = U8(1) - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).Frc = SQLITE_OK - (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).FnInitRow = U32(0) + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Frc = SQLITE_OK + (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).FnInitRow = U32(0) rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 - }{Xsqlite3InitCallback})), bp+848 /* &initData */, uintptr(0)) + }{Xsqlite3InitCallback})), bp+728 /* &initData */, uintptr(0)) if !(rc == SQLITE_OK) { goto __723 } - rc = (*InitData)(unsafe.Pointer(bp + 848 /* &initData */)).Frc + rc = (*InitData)(unsafe.Pointer(bp + 728 /* &initData */)).Frc __723: ; - if !((rc == SQLITE_OK) && ((*InitData)(unsafe.Pointer(bp+848 /* &initData */)).FnInitRow == U32(0))) { + if !((rc == SQLITE_OK) && ((*InitData)(unsafe.Pointer(bp+728 /* &initData */)).FnInitRow == U32(0))) { goto __724 } // The OP_ParseSchema opcode with a non-NULL P4 argument should parse @@ -117034,9 +117542,9 @@ __142: // Register keeping track of errors remaining pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) z = Xsqlite3BtreeIntegrityCheck(tls, db, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr((*Op)(unsafe.Pointer(pOp)).Fp5)*32)).FpBt, (aRoot + 1*4), nRoot, - (int32(*(*I64)(unsafe.Pointer(pnErr /* &.u */))) + 1), bp+888 /* &nErr */) + (int32(*(*I64)(unsafe.Pointer(pnErr /* &.u */))) + 1), bp+768 /* &nErr */) Xsqlite3VdbeMemSetNull(tls, pIn1) - if !(*(*int32)(unsafe.Pointer(bp + 888 /* nErr */)) == 0) { + if !(*(*int32)(unsafe.Pointer(bp + 768 /* nErr */)) == 0) { goto __728 } @@ -117048,7 +117556,7 @@ __728: goto no_mem goto __731 __730: - *(*I64)(unsafe.Pointer(pnErr /* &.u */ /* &.i */)) -= (I64(*(*int32)(unsafe.Pointer(bp + 888 /* nErr */)) - 1)) + *(*I64)(unsafe.Pointer(pnErr /* &.u */ /* &.i */)) -= (I64(*(*int32)(unsafe.Pointer(bp + 768 /* nErr */)) - 1)) Xsqlite3VdbeMemSetStr(tls, pIn1, z, int64(-1), uint8(SQLITE_UTF8), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) __731: ; @@ -117096,7 +117604,7 @@ __144: pIn1 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp1)*56) if !(((int32((*Mem)(unsafe.Pointer(pIn1)).Fflags) & MEM_Blob) == 0) || - (Xsqlite3RowSetNext(tls, (*Mem)(unsafe.Pointer(pIn1)).Fz, bp+896 /* &val */) == 0)) { + (Xsqlite3RowSetNext(tls, (*Mem)(unsafe.Pointer(pIn1)).Fz, bp+776 /* &val */) == 0)) { goto __734 } // The boolean index is empty @@ -117107,7 +117615,7 @@ __144: __734: // A value was pulled from the index ; - Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56), *(*I64)(unsafe.Pointer(bp + 896 /* val */))) + Xsqlite3VdbeMemSetInt64(tls, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56), *(*I64)(unsafe.Pointer(bp + 776 /* val */))) __735: ; goto check_for_interrupt @@ -117234,7 +117742,7 @@ __741: goto __746 } rc = SQLITE_ERROR - Xsqlite3VdbeError(tls, p, ts+6360 /* "too many levels ..." */, 0) + Xsqlite3VdbeError(tls, p, ts+6375 /* "too many levels ..." */, 0) goto abort_due_to_error __746: ; @@ -117497,8 +118005,8 @@ __152: pIn3 = (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp3)*56) pOut = out2Prerelease(tls, p, pOp) - *(*I64)(unsafe.Pointer(bp + 904 /* x3 */)) = *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) - if !((*(*I64)(unsafe.Pointer(bp + 904 /* x3 */)) <= int64(0)) || (Xsqlite3AddInt64(tls, bp+904 /* &x3 */, func() int64 { + *(*I64)(unsafe.Pointer(bp + 784 /* x3 */)) = *(*I64)(unsafe.Pointer(pIn1 /* &.u */)) + if !((*(*I64)(unsafe.Pointer(bp + 784 /* x3 */)) <= int64(0)) || (Xsqlite3AddInt64(tls, bp+784 /* &x3 */, func() int64 { if *(*I64)(unsafe.Pointer(pIn3 /* &.u */)) > int64(0) { return *(*I64)(unsafe.Pointer(pIn3 /* &.u */)) } @@ -117516,7 +118024,7 @@ __152: *(*I64)(unsafe.Pointer(pOut /* &.u */)) = int64(-1) goto __770 __769: - *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 904 /* x3 */)) + *(*I64)(unsafe.Pointer(pOut /* &.u */)) = *(*I64)(unsafe.Pointer(bp + 784 /* x3 */)) __770: ; goto __8 @@ -117679,7 +118187,7 @@ __781: if !((*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError > 0) { goto __783 } - Xsqlite3VdbeError(tls, p, ts+3615 /* "%s" */, libc.VaList(bp+136, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) + Xsqlite3VdbeError(tls, p, ts+3630 /* "%s" */, libc.VaList(bp+88, Xsqlite3_value_text(tls, (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FpOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx1)).FisError __783: ; @@ -117757,7 +118265,7 @@ __788: if !(rc != 0) { goto __789 } - Xsqlite3VdbeError(tls, p, ts+3615 /* "%s" */, libc.VaList(bp+152, Xsqlite3_value_text(tls, pMem4))) + Xsqlite3VdbeError(tls, p, ts+3630 /* "%s" */, libc.VaList(bp+96, Xsqlite3_value_text(tls, pMem4))) goto abort_due_to_error __789: ; @@ -117784,10 +118292,10 @@ __790: __160: // Write results here ; - *(*int32)(unsafe.Pointer(bp + 912 /* &aRes[0] */)) = 0 - *(*int32)(unsafe.Pointer(bp + 912 /* &aRes[0] */ + 1*4)) = libc.AssignPtrInt32(bp+912 /* &aRes */ +2*4, -1) + *(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */)) = 0 + *(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */ + 1*4)) = libc.AssignPtrInt32(bp+792 /* &aRes */ +2*4, -1) - rc = Xsqlite3Checkpoint(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, (*Op)(unsafe.Pointer(pOp)).Fp2, (bp + 912 /* &aRes */ + 1*4), (bp + 912 /* &aRes */ + 2*4)) + rc = Xsqlite3Checkpoint(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, (*Op)(unsafe.Pointer(pOp)).Fp2, (bp + 792 /* &aRes */ + 1*4), (bp + 792 /* &aRes */ + 2*4)) if !(rc != 0) { goto __791 } @@ -117798,7 +118306,7 @@ __160: // Write results here __792: ; rc = SQLITE_OK - *(*int32)(unsafe.Pointer(bp + 912 /* &aRes[0] */)) = 1 + *(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */)) = 1 __791: ; i5 = 0 @@ -117807,7 +118315,7 @@ __793: if !(i5 < 3) { goto __795 } - Xsqlite3VdbeMemSetInt64(tls, pMem5, I64(*(*int32)(unsafe.Pointer(bp + 912 /* &aRes[0] */ + uintptr(i5)*4)))) + Xsqlite3VdbeMemSetInt64(tls, pMem5, I64(*(*int32)(unsafe.Pointer(bp + 792 /* &aRes[0] */ + uintptr(i5)*4)))) goto __794 __794: i5++ @@ -117872,12 +118380,12 @@ __798: } rc = SQLITE_ERROR Xsqlite3VdbeError(tls, p, - ts+6397, /* "cannot change %s..." */ - libc.VaList(bp+168, func() uintptr { + ts+6412, /* "cannot change %s..." */ + libc.VaList(bp+104, func() uintptr { if eNew == PAGER_JOURNALMODE_WAL { - return ts + 6449 /* "into" */ + return ts + 6464 /* "into" */ } - return ts + 6454 /* "out of" */ + return ts + 6469 /* "out of" */ }())) goto abort_due_to_error goto __801 @@ -118080,7 +118588,7 @@ __167: goto __816 } z1 = *(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)) - Xsqlite3VdbeError(tls, p, ts+6461 /* "database table i..." */, libc.VaList(bp+184, z1)) + Xsqlite3VdbeError(tls, p, ts+6476 /* "database table i..." */, libc.VaList(bp+112, z1)) __816: ; goto abort_due_to_error @@ -118121,14 +118629,14 @@ __818: // P1. Call the xCreate method for that table. __169: // Name of the virtual table - libc.Xmemset(tls, bp+928 /* &sMem1 */, 0, uint64(unsafe.Sizeof(Mem{}))) - (*Mem)(unsafe.Pointer(bp + 928 /* &sMem1 */)).Fdb = db + libc.Xmemset(tls, bp+808 /* &sMem1 */, 0, uint64(unsafe.Sizeof(Mem{}))) + (*Mem)(unsafe.Pointer(bp + 808 /* &sMem1 */)).Fdb = db // Because P2 is always a static string, it is impossible for the // sqlite3VdbeMemCopy() to fail - rc = Xsqlite3VdbeMemCopy(tls, bp+928 /* &sMem1 */, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56)) + rc = Xsqlite3VdbeMemCopy(tls, bp+808 /* &sMem1 */, (aMem + uintptr((*Op)(unsafe.Pointer(pOp)).Fp2)*56)) - zTab = Xsqlite3_value_text(tls, bp+928 /* &sMem1 */) + zTab = Xsqlite3_value_text(tls, bp+808 /* &sMem1 */) if !(zTab != 0) { goto __819 @@ -118136,7 +118644,7 @@ __169: // Name of the virtual table rc = Xsqlite3VtabCallCreate(tls, db, (*Op)(unsafe.Pointer(pOp)).Fp1, zTab, (p + 168 /* &.zErrMsg */)) __819: ; - Xsqlite3VdbeMemRelease(tls, bp+928 /* &sMem1 */) + Xsqlite3VdbeMemRelease(tls, bp+808 /* &sMem1 */) if !(rc != 0) { goto __820 } @@ -118170,7 +118678,7 @@ __821: __171: ; pCur2 = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 984 /* pVCur */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */)) = uintptr(0) pVtab1 = (*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FpVtab if !((pVtab1 == uintptr(0)) || ((*Sqlite3_vtab)(unsafe.Pointer(pVtab1)).FpModule == uintptr(0))) { goto __822 @@ -118180,7 +118688,7 @@ __171: __822: ; pModule1 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab1)).FpModule - rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pModule1 + 48 /* &.xOpen */))))(tls, pVtab1, bp+984 /* &pVCur */) + rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pModule1 + 48 /* &.xOpen */))))(tls, pVtab1, bp+864 /* &pVCur */) Xsqlite3VtabImportErrmsg(tls, p, pVtab1) if !(rc != 0) { goto __823 @@ -118190,19 +118698,19 @@ __823: ; // Initialize sqlite3_vtab_cursor base class - (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 984 /* pVCur */)))).FpVtab = pVtab1 + (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */)))).FpVtab = pVtab1 // Initialize vdbe cursor object pCur2 = allocateCursor(tls, p, (*Op)(unsafe.Pointer(pOp)).Fp1, 0, -1, uint8(CURTYPE_VTAB)) if !(pCur2 != 0) { goto __824 } - *(*uintptr)(unsafe.Pointer(pCur2 + 56 /* &.uc */)) = *(*uintptr)(unsafe.Pointer(bp + 984 /* pVCur */)) + *(*uintptr)(unsafe.Pointer(pCur2 + 56 /* &.uc */)) = *(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */)) (*Sqlite3_vtab)(unsafe.Pointer(pVtab1)).FnRef++ goto __825 __824: ; - (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule1 + 56 /* &.xClose */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 984 /* pVCur */))) + (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pModule1 + 56 /* &.xClose */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 864 /* pVCur */))) goto no_mem __825: ; @@ -118305,8 +118813,8 @@ __831: pVtab3 = (*Sqlite3_vtab_cursor)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pCur4 + 56 /* &.uc */)))).FpVtab pModule3 = (*Sqlite3_vtab)(unsafe.Pointer(pVtab3)).FpModule - libc.Xmemset(tls, bp+992 /* &sContext */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) - (*Sqlite3_context)(unsafe.Pointer(bp + 992 /* &sContext */)).FpOut = pDest2 + libc.Xmemset(tls, bp+872 /* &sContext */, 0, uint64(unsafe.Sizeof(Sqlite3_context{}))) + (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FpOut = pDest2 if !((int32((*Op)(unsafe.Pointer(pOp)).Fp5) & OPFLAG_NOCHNG) != 0) { goto __832 @@ -118319,13 +118827,13 @@ __832: (*Mem)(unsafe.Pointer(pDest2)).Fflags = (U16((int32((*Mem)(unsafe.Pointer((pDest2))).Fflags) & libc.CplInt32((MEM_TypeMask | MEM_Zero))) | MEM_Null)) __833: ; - rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pModule3 + 88 /* &.xColumn */))))(tls, *(*uintptr)(unsafe.Pointer(pCur4 + 56 /* &.uc */)), bp+992 /* &sContext */, (*Op)(unsafe.Pointer(pOp)).Fp2) + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pModule3 + 88 /* &.xColumn */))))(tls, *(*uintptr)(unsafe.Pointer(pCur4 + 56 /* &.uc */)), bp+872 /* &sContext */, (*Op)(unsafe.Pointer(pOp)).Fp2) Xsqlite3VtabImportErrmsg(tls, p, pVtab3) - if !((*Sqlite3_context)(unsafe.Pointer(bp+992 /* &sContext */)).FisError > 0) { + if !((*Sqlite3_context)(unsafe.Pointer(bp+872 /* &sContext */)).FisError > 0) { goto __834 } - Xsqlite3VdbeError(tls, p, ts+3615 /* "%s" */, libc.VaList(bp+200, Xsqlite3_value_text(tls, pDest2))) - rc = (*Sqlite3_context)(unsafe.Pointer(bp + 992 /* &sContext */)).FisError + Xsqlite3VdbeError(tls, p, ts+3630 /* "%s" */, libc.VaList(bp+120, Xsqlite3_value_text(tls, pDest2))) + rc = (*Sqlite3_context)(unsafe.Pointer(bp + 872 /* &sContext */)).FisError __834: ; Xsqlite3VdbeChangeEncoding(tls, pDest2, int32(encoding)) @@ -118492,14 +119000,14 @@ __847: __848: ; (*Sqlite3)(unsafe.Pointer(db)).FvtabOnConflict = U8((*Op)(unsafe.Pointer(pOp)).Fp5) - rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pModule5 + 104 /* &.xUpdate */))))(tls, pVtab6, nArg1, apArg1, bp+1048 /* &rowid1 */) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pModule5 + 104 /* &.xUpdate */))))(tls, pVtab6, nArg1, apArg1, bp+928 /* &rowid1 */) (*Sqlite3)(unsafe.Pointer(db)).FvtabOnConflict = vtabOnConflict Xsqlite3VtabImportErrmsg(tls, p, pVtab6) if !((rc == SQLITE_OK) && ((*Op)(unsafe.Pointer(pOp)).Fp1 != 0)) { goto __849 } - (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = *(*Sqlite_int64)(unsafe.Pointer(bp + 1048 /* rowid1 */)) + (*Sqlite3)(unsafe.Pointer(db)).FlastRowid = *(*Sqlite_int64)(unsafe.Pointer(bp + 928 /* rowid1 */)) __849: ; if !(((rc & 0xff) == SQLITE_CONSTRAINT) && ((*VTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pOp + 16 /* &.p4 */)))).FbConstraint != 0)) { @@ -118655,7 +119163,7 @@ __857: if !((*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError > 0) { goto __862 } - Xsqlite3VdbeError(tls, p, ts+3615 /* "%s" */, libc.VaList(bp+216, Xsqlite3_value_text(tls, pOut))) + Xsqlite3VdbeError(tls, p, ts+3630 /* "%s" */, libc.VaList(bp+128, Xsqlite3_value_text(tls, pOut))) rc = (*Sqlite3_context)(unsafe.Pointer(pCtx2)).FisError __862: ; @@ -118745,7 +119253,7 @@ __867: if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeExec > 1) { goto __869 } - z3 = Xsqlite3MPrintf(tls, db, ts+6490 /* "-- %s" */, libc.VaList(bp+232, zTrace)) + z3 = Xsqlite3MPrintf(tls, db, ts+6505 /* "-- %s" */, libc.VaList(bp+136, zTrace)) (*(*func(*libc.TLS, U32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 240 /* &.trace */ /* &.xV2 */))))(tls, uint32(SQLITE_TRACE_STMT), (*Sqlite3)(unsafe.Pointer(db)).FpTraceArg, p, z3) Xsqlite3DbFree(tls, db, z3) goto __870 @@ -118848,14 +119356,14 @@ __878: if !(((*Vdbe)(unsafe.Pointer(p)).FzErrMsg == uintptr(0)) && (rc != (SQLITE_IOERR | (int32(12) << 8)))) { goto __880 } - Xsqlite3VdbeError(tls, p, ts+3615 /* "%s" */, libc.VaList(bp+248, Xsqlite3ErrStr(tls, rc))) + Xsqlite3VdbeError(tls, p, ts+3630 /* "%s" */, libc.VaList(bp+144, Xsqlite3ErrStr(tls, rc))) __880: ; (*Vdbe)(unsafe.Pointer(p)).Frc = rc Xsqlite3SystemError(tls, db, rc) - Xsqlite3_log(tls, rc, ts+6496, /* "statement aborts..." */ - libc.VaList(bp+264, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) + Xsqlite3_log(tls, rc, ts+6511, /* "statement aborts..." */ + libc.VaList(bp+152, (int32((int64(pOp)-int64(aOp))/24)), (*Vdbe)(unsafe.Pointer(p)).FzSql, (*Vdbe)(unsafe.Pointer(p)).FzErrMsg)) Xsqlite3VdbeHalt(tls, p) if !(rc == (SQLITE_IOERR | (int32(12) << 8))) { goto __881 @@ -118899,14 +119407,14 @@ __884: // Jump to here if a string or blob larger than SQLITE_MAX_LENGTH // is encountered. too_big: - Xsqlite3VdbeError(tls, p, ts+5795 /* "string or blob t..." */, 0) + Xsqlite3VdbeError(tls, p, ts+5810 /* "string or blob t..." */, 0) rc = SQLITE_TOOBIG goto abort_due_to_error // Jump to here if a malloc() fails. no_mem: Xsqlite3OomFault(tls, db) - Xsqlite3VdbeError(tls, p, ts+6528 /* "out of memory" */, 0) + Xsqlite3VdbeError(tls, p, ts+6543 /* "out of memory" */, 0) rc = SQLITE_NOMEM goto abort_due_to_error @@ -118919,8 +119427,8 @@ abort_due_to_interrupt: return int32(0) } -var azType = [4]uintptr{ts + 6542 /* "NOT NULL" */, ts + 6551 /* "UNIQUE" */, ts + 6558, /* "CHECK" */ - ts + 6564 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ +var azType = [4]uintptr{ts + 6557 /* "NOT NULL" */, ts + 6566 /* "UNIQUE" */, ts + 6573, /* "CHECK" */ + ts + 6579 /* "FOREIGN KEY" */} /* sqlite3.c:87624:25 */ var and_logic = [9]uint8{uint8(0), uint8(0), uint8(0), uint8(0), uint8(1), uint8(2), uint8(0), uint8(2), uint8(2)} /* sqlite3.c:88844:32 */ var or_logic = [9]uint8{uint8(0), uint8(1), uint8(2), uint8(1), uint8(1), uint8(1), uint8(2), uint8(1), uint8(2)} /* sqlite3.c:88847:32 */ var aFlag1 = [2]U16{U16(MEM_Blob), (U16(MEM_Str | MEM_Term))} /* sqlite3.c:89315:24 */ @@ -118994,8 +119502,8 @@ type Incrblob = Incrblob1 /* sqlite3.c:94829:25 */ // calls to sqlite3_blob_read(), blob_write() or blob_reopen() will // immediately return SQLITE_ABORT. func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) int32 { /* sqlite3.c:94859:12: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(24) + defer tls.Free(24) var rc int32 // Error code var zErr uintptr = uintptr(0) // Error message @@ -119027,16 +119535,16 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) } if type1 < U32(12) { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+6576, /* "cannot open valu..." */ + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+6591, /* "cannot open valu..." */ libc.VaList(bp, func() uintptr { if type1 == U32(0) { - return ts + 6605 /* "null" */ + return ts + 6620 /* "null" */ } return func() uintptr { if type1 == U32(7) { - return ts + 6610 /* "real" */ + return ts + 6625 /* "real" */ } - return ts + 6615 /* "integer" */ + return ts + 6630 /* "integer" */ }() }())) rc = SQLITE_ERROR @@ -119056,10 +119564,10 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) rc = Xsqlite3_finalize(tls, (*Incrblob)(unsafe.Pointer(p)).FpStmt) (*Incrblob)(unsafe.Pointer(p)).FpStmt = uintptr(0) if rc == SQLITE_OK { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+6623 /* "no such rowid: %..." */, libc.VaList(bp+16, iRow)) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+6638 /* "no such rowid: %..." */, libc.VaList(bp+8, iRow)) rc = SQLITE_ERROR } else { - zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+3615 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) + zErr = Xsqlite3MPrintf(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb, ts+3630 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, (*Incrblob)(unsafe.Pointer(p)).Fdb))) } } @@ -119069,17 +119577,17 @@ func blobSeekToRow(tls *libc.TLS, p uintptr, iRow Sqlite3_int64, pzErr uintptr) // Open a blob handle. func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, zColumn uintptr, iRow Sqlite_int64, wrFlag int32, ppBlob uintptr) int32 { /* sqlite3.c:94924:16: */ - bp := tls.Alloc(512) - defer tls.Free(512) + bp := tls.Alloc(464) + defer tls.Free(464) var nAttempt int32 var iCol int32 // Index of zColumn in row-record var rc int32 - // var zErr uintptr at bp+504, 8 + // var zErr uintptr at bp+456, 8 var pTab uintptr var pBlob uintptr - // var sParse Parse at bp+96, 408 + // var sParse Parse at bp+48, 408 var j int32 // Check that the column is not part of an FK child key definition. It @@ -119095,7 +119603,7 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, var aOp uintptr nAttempt = 0 rc = SQLITE_OK - *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = uintptr(0) pBlob = uintptr(0) *(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0) @@ -119105,49 +119613,49 @@ func Xsqlite3_blob_open(tls *libc.TLS, db uintptr, zDb uintptr, zTable uintptr, pBlob = Xsqlite3DbMallocZero(tls, db, uint64(unsafe.Sizeof(Incrblob{}))) __1: - libc.Xmemset(tls, bp+96 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) + libc.Xmemset(tls, bp+48 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) if !(!(pBlob != 0)) { goto __4 } goto blob_open_out __4: ; - (*Parse)(unsafe.Pointer(bp + 96 /* &sParse */)).Fdb = db - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)) = uintptr(0) + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).Fdb = db + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = uintptr(0) Xsqlite3BtreeEnterAll(tls, db) - pTab = Xsqlite3LocateTable(tls, bp+96 /* &sParse */, uint32(0), zTable, zDb) + pTab = Xsqlite3LocateTable(tls, bp+48 /* &sParse */, uint32(0), zTable, zDb) if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) { goto __5 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+96 /* &sParse */, ts+6643 /* "cannot open virt..." */, libc.VaList(bp, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+6658 /* "cannot open virt..." */, libc.VaList(bp, zTable)) __5: ; if !((pTab != 0) && !(((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0))) { goto __6 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+96 /* &sParse */, ts+6673 /* "cannot open tabl..." */, libc.VaList(bp+16, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+6688 /* "cannot open tabl..." */, libc.VaList(bp+8, zTable)) __6: ; if !((pTab != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __7 } pTab = uintptr(0) - Xsqlite3ErrorMsg(tls, bp+96 /* &sParse */, ts+6709 /* "cannot open view..." */, libc.VaList(bp+32, zTable)) + Xsqlite3ErrorMsg(tls, bp+48 /* &sParse */, ts+6724 /* "cannot open view..." */, libc.VaList(bp+16, zTable)) __7: ; if !(!(pTab != 0)) { goto __8 } - if !((*Parse)(unsafe.Pointer(bp+96 /* &sParse */)).FzErrMsg != 0) { + if !((*Parse)(unsafe.Pointer(bp+48 /* &sParse */)).FzErrMsg != 0) { goto __9 } - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)) = (*Parse)(unsafe.Pointer(bp + 96 /* &sParse */)).FzErrMsg - (*Parse)(unsafe.Pointer(bp + 96 /* &sParse */)).FzErrMsg = uintptr(0) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FzErrMsg + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FzErrMsg = uintptr(0) __9: ; rc = SQLITE_ERROR @@ -119180,8 +119688,8 @@ __12: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __14 } - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+6730 /* "no such column: ..." */, libc.VaList(bp+48, zColumn)) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+6745 /* "no such column: ..." */, libc.VaList(bp+24, zColumn)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -119210,7 +119718,7 @@ __20: if !((*sColMap)(unsafe.Pointer((pFKey+64 /* &.aCol */)+uintptr(j)*16)).FiFrom == iCol) { goto __23 } - zFault = ts + 6751 /* "foreign key" */ + zFault = ts + 6766 /* "foreign key" */ __23: ; goto __21 @@ -119243,7 +119751,7 @@ __27: if !((int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == iCol) || (int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j1)*2))) == (-2))) { goto __30 } - zFault = ts + 6763 /* "indexed" */ + zFault = ts + 6778 /* "indexed" */ __30: ; goto __28 @@ -119263,8 +119771,8 @@ __26: if !(zFault != 0) { goto __31 } - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */))) - *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+6771 /* "cannot open %s c..." */, libc.VaList(bp+64, zFault)) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) = Xsqlite3MPrintf(tls, db, ts+6786 /* "cannot open %s c..." */, libc.VaList(bp+32, zFault)) rc = SQLITE_ERROR Xsqlite3BtreeLeaveAll(tls, db) goto blob_open_out @@ -119273,7 +119781,7 @@ __31: __15: ; - (*Incrblob)(unsafe.Pointer(pBlob)).FpStmt = Xsqlite3VdbeCreate(tls, bp+96 /* &sParse */) + (*Incrblob)(unsafe.Pointer(pBlob)).FpStmt = Xsqlite3VdbeCreate(tls, bp+48 /* &sParse */) if !((*Incrblob)(unsafe.Pointer(pBlob)).FpStmt != 0) { goto __32 @@ -119327,10 +119835,10 @@ __35: *(*int32)(unsafe.Pointer(aOp + 1*24 + 16 /* &.p4 */)) = (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1) (*VdbeOp)(unsafe.Pointer(aOp + 3*24)).Fp2 = int32((*Table)(unsafe.Pointer(pTab)).FnCol) - (*Parse)(unsafe.Pointer(bp + 96 /* &sParse */)).FnVar = int16(0) - (*Parse)(unsafe.Pointer(bp + 96 /* &sParse */)).FnMem = 1 - (*Parse)(unsafe.Pointer(bp + 96 /* &sParse */)).FnTab = 1 - Xsqlite3VdbeMakeReady(tls, v, bp+96 /* &sParse */) + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FnVar = int16(0) + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FnMem = 1 + (*Parse)(unsafe.Pointer(bp + 48 /* &sParse */)).FnTab = 1 + Xsqlite3VdbeMakeReady(tls, v, bp+48 /* &sParse */) __34: ; __32: @@ -119345,7 +119853,7 @@ __32: goto blob_open_out __36: ; - rc = blobSeekToRow(tls, pBlob, iRow, bp+504 /* &zErr */) + rc = blobSeekToRow(tls, pBlob, iRow, bp+456 /* &zErr */) goto __2 __2: if ((libc.PreIncInt32(&nAttempt, 1)) < SQLITE_MAX_SCHEMA_RETRY) && (rc == SQLITE_SCHEMA) { @@ -119372,13 +119880,13 @@ __39: __38: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { - if *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)) != 0 { - return ts + 3615 /* "%s" */ + if *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)) != 0 { + return ts + 3630 /* "%s" */ } return uintptr(0) - }(), libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */)))) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 504 /* zErr */))) - Xsqlite3ParserReset(tls, bp+96 /* &sParse */) + }(), libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 456 /* zErr */))) + Xsqlite3ParserReset(tls, bp+48 /* &sParse */) rc = Xsqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -119513,8 +120021,8 @@ func Xsqlite3_blob_bytes(tls *libc.TLS, pBlob uintptr) int32 { /* sqlite3.c:9526 // subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) // immediately return SQLITE_ABORT. func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int32 { /* sqlite3.c:95283:16: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var rc int32 var p uintptr = pBlob @@ -119531,18 +120039,18 @@ func Xsqlite3_blob_reopen(tls *libc.TLS, pBlob uintptr, iRow Sqlite3_int64) int3 // already been invalidated. Return SQLITE_ABORT in this case. rc = SQLITE_ABORT } else { - // var zErr uintptr at bp+16, 8 + // var zErr uintptr at bp+8, 8 (*Vdbe)(unsafe.Pointer((*Incrblob)(unsafe.Pointer(p)).FpStmt)).Frc = SQLITE_OK - rc = blobSeekToRow(tls, p, iRow, bp+16 /* &zErr */) + rc = blobSeekToRow(tls, p, iRow, bp+8 /* &zErr */) if rc != SQLITE_OK { Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { - if *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) != 0 { - return ts + 3615 /* "%s" */ + if *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) != 0 { + return ts + 3630 /* "%s" */ } return uintptr(0) - }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) + }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) } } @@ -123015,8 +123523,8 @@ func Xsqlite3ExprColUsed(tls *libc.TLS, pExpr uintptr) Bitmask { /* sqlite3.c:99 // If the name cannot be resolved unambiguously, leave an error message // in pParse and return WRC_Abort. Return WRC_Prune on success. func lookupName(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zCol uintptr, pNC uintptr, pExpr uintptr) int32 { /* sqlite3.c:99446:12: */ - bp := tls.Alloc(144) - defer tls.Free(144) + bp := tls.Alloc(96) + defer tls.Free(96) var i int32 var j int32 // Loop counters @@ -123096,7 +123604,7 @@ __5: goto __6 __6: ; - if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+6805 /* "main" */, zDb) == 0)) { + if !((i == (*Sqlite3)(unsafe.Pointer(db)).FnDb) && (Xsqlite3StrICmp(tls, ts+6820 /* "main" */, zDb) == 0)) { goto __8 } // This branch is taken when the main database has been renamed @@ -123299,14 +123807,14 @@ __40: ; goto __39 __38: - if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+6810 /* "new" */, zTab) == 0)) { + if !(((op != TK_DELETE) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+6825 /* "new" */, zTab) == 0)) { goto __41 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 1 pTab = (*Parse)(unsafe.Pointer(pParse)).FpTriggerTab goto __42 __41: - if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+6814 /* "old" */, zTab) == 0)) { + if !(((op != TK_INSERT) && (zTab != 0)) && (Xsqlite3StrICmp(tls, ts+6829 /* "old" */, zTab) == 0)) { goto __43 } (*Expr)(unsafe.Pointer(pExpr)).FiTable = 0 @@ -123323,7 +123831,7 @@ __37: goto __44 } pUpsert = *(*uintptr)(unsafe.Pointer(pNC + 16 /* &.uNC */)) - if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+6818 /* "excluded" */, zTab) == 0)) { + if !((pUpsert != 0) && (Xsqlite3StrICmp(tls, ts+6833 /* "excluded" */, zTab) == 0)) { goto __45 } pTab = (*SrcItem)(unsafe.Pointer(((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertSrc + 8 /* &.a */))).FpTab @@ -123500,7 +124008,7 @@ __66: if !((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0) && (((*Expr)(unsafe.Pointer((pOrig))).Fflags & (U32(EP_Agg))) != U32(0))) { goto __70 } - Xsqlite3ErrorMsg(tls, pParse, ts+6827 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+6842 /* "misuse of aliase..." */, libc.VaList(bp, zAs)) return WRC_Abort __70: ; @@ -123508,14 +124016,14 @@ __70: ((((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0) || (pNC != pTopNC))) { goto __71 } - Xsqlite3ErrorMsg(tls, pParse, ts+6858 /* "misuse of aliase..." */, libc.VaList(bp+16, zAs)) + Xsqlite3ErrorMsg(tls, pParse, ts+6873 /* "misuse of aliase..." */, libc.VaList(bp+8, zAs)) return WRC_Abort __71: ; if !(Xsqlite3ExprVectorSize(tls, pOrig) != 1) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+6895 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6910 /* "row value misuse..." */, 0) return WRC_Abort __72: ; @@ -123591,7 +124099,7 @@ __11: // a huge amount of legacy SQL that uses it. So for now, we just // issue a warning. Xsqlite3_log(tls, SQLITE_WARNING, - ts+6913 /* "double-quoted st..." */, libc.VaList(bp+32, zCol)) + ts+6928 /* "double-quoted st..." */, libc.VaList(bp+16, zCol)) (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_STRING) *(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)) = uintptr(0) return WRC_Prune @@ -123612,23 +124120,23 @@ __75: goto __78 } if cnt == 0 { - zErr = ts + 6948 /* "no such column" */ + zErr = ts + 6963 /* "no such column" */ } else { - zErr = ts + 6963 /* "ambiguous column..." */ + zErr = ts + 6978 /* "ambiguous column..." */ } if !(zDb != 0) { goto __79 } - Xsqlite3ErrorMsg(tls, pParse, ts+6985 /* "%s: %s.%s.%s" */, libc.VaList(bp+48, zErr, zDb, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+7000 /* "%s: %s.%s.%s" */, libc.VaList(bp+24, zErr, zDb, zTab, zCol)) goto __80 __79: if !(zTab != 0) { goto __81 } - Xsqlite3ErrorMsg(tls, pParse, ts+6998 /* "%s: %s.%s" */, libc.VaList(bp+88, zErr, zTab, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+7013 /* "%s: %s.%s" */, libc.VaList(bp+56, zErr, zTab, zCol)) goto __82 __81: - Xsqlite3ErrorMsg(tls, pParse, ts+7008 /* "%s: %s" */, libc.VaList(bp+120, zErr, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+7023 /* "%s: %s" */, libc.VaList(bp+80, zErr, zCol)) __82: ; __80: @@ -123759,18 +124267,18 @@ func Xsqlite3CreateColumnExpr(tls *libc.TLS, db uintptr, pSrc uintptr, iSrc int3 // (because errors are rare), the conditional is moved outside of the // function call using a macro. func notValidImpl(tls *libc.TLS, pParse uintptr, pNC uintptr, zMsg uintptr, pExpr uintptr) { /* sqlite3.c:99922:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) - var zIn uintptr = ts + 7015 /* "partial index WH..." */ + var zIn uintptr = ts + 7030 /* "partial index WH..." */ if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IdxExpr) != 0 { - zIn = ts + 7043 /* "index expression..." */ + zIn = ts + 7058 /* "index expression..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_IsCheck) != 0 { - zIn = ts + 7061 /* "CHECK constraint..." */ + zIn = ts + 7076 /* "CHECK constraint..." */ } else if ((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_GenCol) != 0 { - zIn = ts + 7079 /* "generated column..." */ + zIn = ts + 7094 /* "generated column..." */ } - Xsqlite3ErrorMsg(tls, pParse, ts+7097 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) + Xsqlite3ErrorMsg(tls, pParse, ts+7112 /* "%s prohibited in..." */, libc.VaList(bp, zMsg, zIn)) if pExpr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } @@ -123805,8 +124313,8 @@ func exprProbability(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:99948:12: */ // function names. The operator for aggregate functions is changed // to TK_AGG_FUNCTION. func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:99968:12: */ - bp := tls.Alloc(176) - defer tls.Free(176) + bp := tls.Alloc(128) + defer tls.Free(128) var pNC uintptr var pParse uintptr @@ -123853,7 +124361,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s fallthrough case TK_ISNULL: { - // var anRef [8]int32 at bp+144, 32 + // var anRef [8]int32 at bp+96, 32 var p uintptr var i int32 @@ -123864,7 +124372,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s goto __3 } { - *(*int32)(unsafe.Pointer(bp + 144 /* &anRef[0] */ + uintptr(i)*4)) = (*NameContext)(unsafe.Pointer(p)).FnRef + *(*int32)(unsafe.Pointer(bp + 96 /* &anRef[0] */ + uintptr(i)*4)) = (*NameContext)(unsafe.Pointer(p)).FnRef } goto __2 @@ -123878,10 +124386,10 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s Xsqlite3WalkExpr(tls, pWalker, (*Expr)(unsafe.Pointer(pExpr)).FpLeft) if (0 == Xsqlite3ExprCanBeNull(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft)) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_NOTNULL { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 7117 /* "true" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 7132 /* "true" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsTrue)) } else { - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 7122 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 7137 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) } (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) @@ -123892,7 +124400,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s goto __6 } { - (*NameContext)(unsafe.Pointer(p)).FnRef = *(*int32)(unsafe.Pointer(bp + 144 /* &anRef[0] */ + uintptr(i)*4)) + (*NameContext)(unsafe.Pointer(p)).FnRef = *(*int32)(unsafe.Pointer(bp + 96 /* &anRef[0] */ + uintptr(i)*4)) } goto __5 @@ -123934,7 +124442,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var pLeft uintptr = (*Expr)(unsafe.Pointer(pExpr)).FpLeft if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (NC_IdxExpr | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+7128 /* "the \".\" operator" */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+7143 /* "the \".\" operator" */, uintptr(0)) } pRight = (*Expr)(unsafe.Pointer(pExpr)).FpRight @@ -124001,7 +124509,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if (*Expr)(unsafe.Pointer(pExpr)).FiTable < 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+7145 /* "second argument ..." */, 0) + ts+7160 /* "second argument ..." */, 0) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } } else { @@ -124026,7 +124534,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var auth int32 = Xsqlite3AuthCheck(tls, pParse, SQLITE_FUNCTION, uintptr(0), (*FuncDef)(unsafe.Pointer(pDef)).FzName, uintptr(0)) if auth != SQLITE_OK { if auth == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+7216, /* "not authorized t..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7231, /* "not authorized t..." */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } @@ -124050,7 +124558,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s // in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all // all this. if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & ((NC_IdxExpr | NC_PartIdx) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+7251 /* "non-deterministi..." */, uintptr(0)) + notValidImpl(tls, pParse, pNC, ts+7266 /* "non-deterministi..." */, uintptr(0)) } } else { @@ -124079,31 +124587,31 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s if ((pDef != 0) && ((*FuncDef)(unsafe.Pointer(pDef)).FxValue == uintptr(0))) && (pWin != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+7279 /* "%.*s() may not b..." */, libc.VaList(bp+16, nId, zId)) + ts+7294 /* "%.*s() may not b..." */, libc.VaList(bp+8, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (((is_agg != 0) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowAgg) == 0)) || (((is_agg != 0) && (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0)) && !(pWin != 0))) || (((is_agg != 0) && (pWin != 0)) && (((*NameContext)(unsafe.Pointer(pNC)).FncFlags & NC_AllowWin) == 0)) { var zType uintptr if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0) || (pWin != 0) { - zType = ts + 7323 /* "window" */ + zType = ts + 7338 /* "window" */ } else { - zType = ts + 7330 /* "aggregate" */ + zType = ts + 7345 /* "aggregate" */ } - Xsqlite3ErrorMsg(tls, pParse, ts+7340 /* "misuse of %s fun..." */, libc.VaList(bp+40, zType, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7355 /* "misuse of %s fun..." */, libc.VaList(bp+24, zType, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ is_agg = 0 } else if (no_such_func != 0) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+7369 /* "no such function..." */, libc.VaList(bp+72, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7384 /* "no such function..." */, libc.VaList(bp+48, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if wrong_num_args != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+7392, /* "wrong number of ..." */ - libc.VaList(bp+96, nId, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+7407, /* "wrong number of ..." */ + libc.VaList(bp+64, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } else if (is_agg == 0) && (((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { Xsqlite3ErrorMsg(tls, pParse, - ts+7437, /* "FILTER may not b..." */ - libc.VaList(bp+120, nId, zId)) + ts+7452, /* "FILTER may not b..." */ + libc.VaList(bp+80, nId, zId)) (*NameContext)(unsafe.Pointer(pNC)).FnNcErr++ } if is_agg != 0 { @@ -124177,7 +124685,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s var nRef int32 = (*NameContext)(unsafe.Pointer(pNC)).FnRef if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+7486 /* "subqueries" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+7501 /* "subqueries" */, pExpr) } Xsqlite3WalkSelect(tls, pWalker, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) @@ -124194,7 +124702,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s { if ((*NameContext)(unsafe.Pointer((pNC))).FncFlags & (((NC_IsCheck | NC_PartIdx) | NC_IdxExpr) | NC_GenCol)) != 0 { - notValidImpl(tls, pParse, pNC, ts+7497 /* "parameters" */, pExpr) + notValidImpl(tls, pParse, pNC, ts+7512 /* "parameters" */, pExpr) } break @@ -124254,7 +124762,7 @@ func resolveExprStep(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* s } if nLeft != nRight { - Xsqlite3ErrorMsg(tls, pParse, ts+6895 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6910 /* "row value misuse..." */, 0) } break @@ -124354,12 +124862,12 @@ func resolveOrderByTermToExprList(tls *libc.TLS, pParse uintptr, pSelect uintptr // Generate an ORDER BY or GROUP BY term out-of-range error. func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int32, mx int32) { /* sqlite3.c:100497:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) Xsqlite3ErrorMsg(tls, pParse, - ts+7508 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) + ts+7523 /* "%r %s BY term ou..." */, libc.VaList(bp, i, zType, mx)) } // Analyze the ORDER BY clause in a compound SELECT statement. Modify @@ -124376,8 +124884,8 @@ func resolveOutOfRangeError(tls *libc.TLS, pParse uintptr, zType uintptr, i int3 // // Return the number of errors seen. func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int32 { /* sqlite3.c:100523:12: */ - bp := tls.Alloc(20) - defer tls.Free(20) + bp := tls.Alloc(12) + defer tls.Free(12) var i int32 var pOrderBy uintptr @@ -124391,7 +124899,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 } db = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7564 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+7579 /* "too many terms i..." */, 0) return 1 } for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { @@ -124414,7 +124922,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 goto __3 } { - *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) = -1 + *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) = -1 var pE uintptr var pDup uintptr if (uint32(int32(*(*uint8)(unsafe.Pointer(pItem + 20 /* &.done */)) & 0x4 >> 2))) != 0 { @@ -124424,14 +124932,14 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 if pE == uintptr(0) { goto __2 } - if Xsqlite3ExprIsInteger(tls, pE, bp+16 /* &iCol */) != 0 { - if (*(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { - resolveOutOfRangeError(tls, pParse, ts+7598 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + if Xsqlite3ExprIsInteger(tls, pE, bp+8 /* &iCol */) != 0 { + if (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > (*ExprList)(unsafe.Pointer(pEList)).FnExpr) { + resolveOutOfRangeError(tls, pParse, ts+7613 /* "ORDER" */, (i + 1), (*ExprList)(unsafe.Pointer(pEList)).FnExpr) return 1 } } else { - *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) = resolveAsName(tls, pParse, pEList, pE) - if *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) == 0 { + *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) = resolveAsName(tls, pParse, pEList, pE) + if *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) == 0 { // Now test if expression pE matches one of the values returned // by pSelect. In the usual case this is done by duplicating the // expression, resolving any symbols in it, and then comparing @@ -124446,15 +124954,15 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 pDup = Xsqlite3ExprDup(tls, db, pE, 0) if !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0) { - *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) = resolveOrderByTermToExprList(tls, pParse, pSelect, pDup) - if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) > 0) { + *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) = resolveOrderByTermToExprList(tls, pParse, pSelect, pDup) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > 0) { resolveOrderByTermToExprList(tls, pParse, pSelect, pE) } } Xsqlite3ExprDelete(tls, db, pDup) } } - if *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) > 0 { + if *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) > 0 { // Convert the ORDER BY term into an integer column number iCol, // taking care to preserve the COLLATE clause if it exists. if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { @@ -124463,7 +124971,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 return 1 } *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_IntValue)) - *(*int32)(unsafe.Pointer(pNew + 8 /* &.u */)) = *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) + *(*int32)(unsafe.Pointer(pNew + 8 /* &.u */)) = *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) if (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr == pE { (*ExprList_item)(unsafe.Pointer(pItem)).FpExpr = pNew } else { @@ -124476,7 +124984,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 (*Expr)(unsafe.Pointer(pParent)).FpLeft = pNew } Xsqlite3ExprDelete(tls, db, pE) - *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(*(*int32)(unsafe.Pointer(bp + 16 /* iCol */))) + *(*U16)(unsafe.Pointer(pItem + 24 /* &.u */ /* &.x */ /* &.iOrderByCol */)) = U16(*(*int32)(unsafe.Pointer(bp + 8 /* iCol */))) } libc.SetBitFieldPtr8Uint32(pItem+20 /* &.done */, uint32(1), 2, 0x4) } else { @@ -124497,7 +125005,7 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 for i = 0; i < (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr; i++ { if (int32(*(*uint8)(unsafe.Pointer(((pOrderBy + 8 /* &.a */) + uintptr(i)*32) + 20 /* &.done */)) & 0x4 >> 2)) == 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+7604 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) + ts+7619 /* "%r ORDER BY term..." */, libc.VaList(bp, (i+1))) return 1 } } @@ -124513,8 +125021,8 @@ func resolveCompoundOrderBy(tls *libc.TLS, pParse uintptr, pSelect uintptr) int3 // If any errors are detected, add an error message to pParse and // return non-zero. Return zero if no errors are seen. func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, pOrderBy uintptr, zType uintptr) int32 { /* sqlite3.c:100636:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var i int32 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb @@ -124525,7 +125033,7 @@ func Xsqlite3ResolveOrderGroupBy(tls *libc.TLS, pParse uintptr, pSelect uintptr, return 0 } if (*ExprList)(unsafe.Pointer(pOrderBy)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7665 /* "too many terms i..." */, libc.VaList(bp, zType)) + Xsqlite3ErrorMsg(tls, pParse, ts+7680 /* "too many terms i..." */, libc.VaList(bp, zType)) return 1 } pEList = (*Select)(unsafe.Pointer(pSelect)).FpEList @@ -124814,7 +125322,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql *(*int32)(unsafe.Pointer(bp /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_UEList) if (*Select)(unsafe.Pointer(p)).FpHaving != 0 { if !(pGroupBy != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+7696 /* "a GROUP BY claus..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+7711 /* "a GROUP BY claus..." */, 0) return WRC_Abort } if Xsqlite3ResolveExprNames(tls, bp /* &sNC */, (*Select)(unsafe.Pointer(p)).FpHaving) != 0 { @@ -124871,7 +125379,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql // resolve those symbols on the incorrect ORDER BY for consistency. if (((*Select)(unsafe.Pointer(p)).FpOrderBy != uintptr(0)) && (isCompound <= nCompound)) && // Defer right-most ORDER BY of a compound - (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+7598 /* "ORDER" */) != 0) { + (resolveOrderGroupBy(tls, bp /* &sNC */, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+7613 /* "ORDER" */) != 0) { return WRC_Abort } if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -124884,7 +125392,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql if pGroupBy != 0 { var pItem uintptr - if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+7740 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { + if (resolveOrderGroupBy(tls, bp /* &sNC */, p, pGroupBy, ts+7755 /* "GROUP" */) != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { return WRC_Abort } i = 0 @@ -124896,7 +125404,7 @@ func resolveSelectStep(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sql { if ((*Expr)(unsafe.Pointer(((*ExprList_item)(unsafe.Pointer(pItem)).FpExpr))).Fflags & (U32(EP_Agg))) != U32(0) { Xsqlite3ErrorMsg(tls, pParse, - ts+7746 /* "aggregate functi..." */, 0) + ts+7761 /* "aggregate functi..." */, 0) return WRC_Abort } @@ -125666,7 +126174,7 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, return } if nLeft != Xsqlite3ExprVectorSize(tls, pRight) { - Xsqlite3ErrorMsg(tls, pParse, ts+6895 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6910 /* "row value misuse..." */, 0) return } @@ -125735,14 +126243,14 @@ func codeVectorCompare(tls *libc.TLS, pParse uintptr, pExpr uintptr, dest int32, // expression depth allowed. If it is not, leave an error message in // pParse. func Xsqlite3ExprCheckHeight(tls *libc.TLS, pParse uintptr, nHeight int32) int32 { /* sqlite3.c:101913:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = SQLITE_OK var mxHeight int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 3*4)) if nHeight > mxHeight { Xsqlite3ErrorMsg(tls, pParse, - ts+7805 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) + ts+7820 /* "Expression tree ..." */, libc.VaList(bp, mxHeight)) rc = SQLITE_ERROR } return rc @@ -125983,7 +126491,7 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { Xsqlite3ExprDeferredDelete(tls, pParse, pLeft) Xsqlite3ExprDeferredDelete(tls, pParse, pRight) - return Xsqlite3Expr(tls, db, TK_INTEGER, ts+7853 /* "0" */) + return Xsqlite3Expr(tls, db, TK_INTEGER, ts+7868 /* "0" */) } else { return Xsqlite3PExpr(tls, pParse, TK_AND, pLeft, pRight) } @@ -125993,8 +126501,8 @@ func Xsqlite3ExprAnd(tls *libc.TLS, pParse uintptr, pLeft uintptr, pRight uintpt // Construct a new expression node for a function with multiple // arguments. func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken uintptr, eDistinct int32) uintptr { /* sqlite3.c:102202:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pNew uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb @@ -126005,7 +126513,7 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } if (pList != 0) && ((*ExprList)(unsafe.Pointer(pList)).FnExpr > *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 6*4))) { - Xsqlite3ErrorMsg(tls, pParse, ts+7855 /* "too many argumen..." */, libc.VaList(bp, pToken)) + Xsqlite3ErrorMsg(tls, pParse, ts+7870 /* "too many argumen..." */, libc.VaList(bp, pToken)) } *(*uintptr)(unsafe.Pointer(pNew + 32 /* &.x */)) = pList *(*U32)(unsafe.Pointer(pNew + 4 /* &.flags */)) |= (U32(EP_HasFunc)) @@ -126027,8 +126535,8 @@ func Xsqlite3ExprFunction(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u // // If the function is not usable, create an error. func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pDef uintptr) { /* sqlite3.c:102238:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromDDL))) != U32(0) { if (((*FuncDef)(unsafe.Pointer(pDef)).FfuncFlags & U32(SQLITE_FUNC_DIRECT)) != U32(0)) || @@ -126039,7 +126547,7 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // is tagged with SQLITE_FUNC_UNSAFE) and // SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning // that the schema is possibly tainted). - Xsqlite3ErrorMsg(tls, pParse, ts+7889 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7904 /* "unsafe use of %s..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer(pDef)).FzName)) } } } @@ -126059,8 +126567,8 @@ func Xsqlite3ExprFunctionUsable(tls *libc.TLS, pParse uintptr, pExpr uintptr, pD // instance of the wildcard, the next sequential variable number is // assigned. func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n U32) { /* sqlite3.c:102277:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb var z uintptr @@ -126081,22 +126589,22 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n if int32(*(*int8)(unsafe.Pointer(z))) == '?' { // Wildcard of the form "?nnn". Convert "nnn" to an integer and // use it as the variable number - // var i I64 at bp+16, 8 + // var i I64 at bp+8, 8 var bOk int32 if n == U32(2) { //OPTIMIZATION-IF-TRUE - *(*I64)(unsafe.Pointer(bp + 16 /* i */)) = (I64(int32(*(*int8)(unsafe.Pointer(z + 1))) - '0')) // The common case of ?N for a single digit N + *(*I64)(unsafe.Pointer(bp + 8 /* i */)) = (I64(int32(*(*int8)(unsafe.Pointer(z + 1))) - '0')) // The common case of ?N for a single digit N bOk = 1 } else { - bOk = (libc.Bool32(0 == Xsqlite3Atoi64(tls, (z+1), bp+16 /* &i */, (int32(n-U32(1))), uint8(SQLITE_UTF8)))) + bOk = (libc.Bool32(0 == Xsqlite3Atoi64(tls, (z+1), bp+8 /* &i */, (int32(n-U32(1))), uint8(SQLITE_UTF8)))) } - if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 16 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 16 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+7908, /* "variable number ..." */ + if ((bOk == 0) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) < int64(1))) || (*(*I64)(unsafe.Pointer(bp + 8 /* i */)) > I64(*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) { + Xsqlite3ErrorMsg(tls, pParse, ts+7923, /* "variable number ..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)))) return } - x = YnVar(*(*I64)(unsafe.Pointer(bp + 16 /* i */))) + x = YnVar(*(*I64)(unsafe.Pointer(bp + 8 /* i */))) if int32(x) > int32((*Parse)(unsafe.Pointer(pParse)).FnVar) { (*Parse)(unsafe.Pointer(pParse)).FnVar = YnVar(int32(x)) doAdd = 1 @@ -126119,7 +126627,7 @@ func Xsqlite3ExprAssignVarNumber(tls *libc.TLS, pParse uintptr, pExpr uintptr, n } (*Expr)(unsafe.Pointer(pExpr)).FiColumn = x if int32(x) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 9*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+7951 /* "too many SQL var..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+7966 /* "too many SQL var..." */, 0) } } @@ -126751,8 +127259,8 @@ func Xsqlite3ExprListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pExpr // expression list pList. In the case of a subquery on the RHS, append // TK_SELECT_COLUMN expressions. func Xsqlite3ExprListAppendVector(tls *libc.TLS, pParse uintptr, pList uintptr, pColumns uintptr, pExpr uintptr) uintptr { /* sqlite3.c:102981:25: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var db uintptr var n int32 @@ -126788,7 +127296,7 @@ __2: if !((int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_SELECT) && ((*IdList)(unsafe.Pointer(pColumns)).FnId != (libc.AssignInt32(&n, Xsqlite3ExprVectorSize(tls, pExpr))))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+7974, /* "%d columns assig..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+7989, /* "%d columns assig..." */ libc.VaList(bp, (*IdList)(unsafe.Pointer(pColumns)).FnId, n)) goto vector_append_error __3: @@ -126917,13 +127425,13 @@ func Xsqlite3ExprListSetSpan(tls *libc.TLS, pParse uintptr, pList uintptr, zStar // If the expression list pEList contains more than iLimit elements, // leave an error message in pParse. func Xsqlite3ExprListCheckLength(tls *libc.TLS, pParse uintptr, pEList uintptr, zObject uintptr) { /* sqlite3.c:103140:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var mx int32 = *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 2*4)) if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr > mx) { - Xsqlite3ErrorMsg(tls, pParse, ts+8004 /* "too many columns..." */, libc.VaList(bp, zObject)) + Xsqlite3ErrorMsg(tls, pParse, ts+8019 /* "too many columns..." */, libc.VaList(bp, zObject)) } } @@ -126978,10 +127486,10 @@ func Xsqlite3SelectWalkFail(tls *libc.TLS, pWalker uintptr, NotUsed uintptr) int // "false" EP_IsFalse // anything else 0 func Xsqlite3IsTrueOrFalse(tls *libc.TLS, zIn uintptr) U32 { /* sqlite3.c:103208:20: */ - if Xsqlite3StrICmp(tls, zIn, ts+7117 /* "true" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+7132 /* "true" */) == 0 { return U32(EP_IsTrue) } - if Xsqlite3StrICmp(tls, zIn, ts+7122 /* "false" */) == 0 { + if Xsqlite3StrICmp(tls, zIn, ts+7137 /* "false" */) == 0 { return U32(EP_IsFalse) } return U32(0) @@ -127426,13 +127934,13 @@ func Xsqlite3ExprNeedsNoAffinityChange(tls *libc.TLS, p uintptr, aff int8) int32 // Return TRUE if the given string is a row-id column name. func Xsqlite3IsRowid(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:103650:20: */ - if Xsqlite3StrICmp(tls, z, ts+8027 /* "_ROWID_" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+8042 /* "_ROWID_" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+8035 /* "ROWID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+8050 /* "ROWID" */) == 0 { return 1 } - if Xsqlite3StrICmp(tls, z, ts+8041 /* "OID" */) == 0 { + if Xsqlite3StrICmp(tls, z, ts+8056 /* "OID" */) == 0 { return 1 } return 0 @@ -127603,8 +128111,8 @@ func sqlite3InRhsIsConstant(tls *libc.TLS, pIn uintptr) int32 { /* sqlite3.c:103 // // then aiMap[] is populated with {2, 0, 1}. func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, prRhsHasNull uintptr, aiMap uintptr, piTab uintptr) int32 { /* sqlite3.c:103820:20: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) var p uintptr // SELECT to the right of IN operator var eType int32 = 0 // Type of RHS table. IN_INDEX_* @@ -127660,7 +128168,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, Xsqlite3OpenTable(tls, pParse, iTab, iDb, pTab, OP_OpenRead) eType = IN_INDEX_ROWID - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8045 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8060 /* "USING ROWID SEAR..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VdbeJumpHere(tls, v, iAddr) } else { var pIdx uintptr // Iterator variable @@ -127751,7 +128259,7 @@ func Xsqlite3FindInIndex(tls *libc.TLS, pParse uintptr, pX uintptr, inFlags U32, if colUsed == ((Bitmask((uint64(1))) << (nExpr)) - uint64(1)) { // If we reach this point, that means the index pIdx is usable var iAddr int32 = Xsqlite3VdbeAddOp0(tls, v, OP_Once) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8092 /* "USING INDEX %s F..." */, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8107 /* "USING INDEX %s F..." */, libc.VaList(bp+8, (*Index)(unsafe.Pointer(pIdx)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, iTab, int32((*Index)(unsafe.Pointer(pIdx)).Ftnum), iDb) Xsqlite3VdbeSetP4KeyInfo(tls, pParse, pIdx) @@ -127853,11 +128361,11 @@ func exprINAffinity(tls *libc.TLS, pParse uintptr, pExpr uintptr) uintptr { /* s // // "sub-select returns N columns - expected M" func Xsqlite3SubselectError(tls *libc.TLS, pParse uintptr, nActual int32, nExpect int32) { /* sqlite3.c:104075:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Parse)(unsafe.Pointer(pParse)).FnErr == 0 { - var zFmt uintptr = ts + 8123 /* "sub-select retur..." */ + var zFmt uintptr = ts + 8138 /* "sub-select retur..." */ Xsqlite3ErrorMsg(tls, pParse, zFmt, libc.VaList(bp, nActual, nExpect)) } } @@ -127875,7 +128383,7 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_xIsSelect)) != 0 { Xsqlite3SubselectError(tls, pParse, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FpEList)).FnExpr, 1) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+6895 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6910 /* "row value misuse..." */, 0) } } @@ -127900,8 +128408,8 @@ func Xsqlite3VectorErrorMsg(tls *libc.TLS, pParse uintptr, pExpr uintptr) { /* s // 'x' nor the SELECT... statement are columns, then numeric affinity // is used. func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int32) { /* sqlite3.c:104128:21: */ - bp := tls.Alloc(81) - defer tls.Free(81) + bp := tls.Alloc(65) + defer tls.Free(65) var addrOnce int32 = 0 // Address of the OP_Once instruction at top var addr int32 // Address of OP_OpenEphemeral instruction @@ -127928,7 +128436,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_xIsSelect))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8167 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8182 /* "REUSE LIST SUBQU..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)))).FselId)) } Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) @@ -127964,22 +128472,22 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 var pSelect uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) var pEList uintptr = (*Select)(unsafe.Pointer(pSelect)).FpEList - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+8190 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+16, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+8205 /* "%sLIST SUBQUERY ..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 8209 /* "CORRELATED " */ + return ts + 8224 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSelect)).FselId)) // If the LHS and RHS of the IN operator do not match, that // error will have been caught long before we reach this point. if (*ExprList)(unsafe.Pointer(pEList)).FnExpr == nVal { var pCopy uintptr - // var dest SelectDest at bp+40, 40 + // var dest SelectDest at bp+24, 40 var i int32 var rc int32 - Xsqlite3SelectDestInit(tls, bp+40 /* &dest */, SRT_Set, iTab) - (*SelectDest)(unsafe.Pointer(bp + 40 /* &dest */)).FzAffSdst = exprINAffinity(tls, pParse, pExpr) + Xsqlite3SelectDestInit(tls, bp+24 /* &dest */, SRT_Set, iTab) + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FzAffSdst = exprINAffinity(tls, pParse, pExpr) (*Select)(unsafe.Pointer(pSelect)).FiLimit = 0 // Caused by OOM in sqlite3KeyInfoAlloc() @@ -127987,10 +128495,10 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FmallocFailed != 0 { rc = 1 } else { - rc = Xsqlite3Select(tls, pParse, pCopy, bp+40 /* &dest */) + rc = Xsqlite3Select(tls, pParse, pCopy, bp+24 /* &dest */) } Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pCopy) - Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SelectDest)(unsafe.Pointer(bp+40 /* &dest */)).FzAffSdst) + Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FzAffSdst) if rc != 0 { Xsqlite3KeyInfoUnref(tls, pKeyInfo) return @@ -128010,18 +128518,18 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 // store it in the temporary table. If is a column, then use // that columns affinity when building index keys. If is not // a column, use numeric affinity. - // var affinity int8 at bp+80, 1 + // var affinity int8 at bp+64, 1 // Affinity of the LHS of the IN var i int32 var pList uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */)) var pItem uintptr var r1 int32 var r2 int32 - *(*int8)(unsafe.Pointer(bp + 80 /* affinity */)) = Xsqlite3ExprAffinity(tls, pLeft) - if int32(*(*int8)(unsafe.Pointer(bp + 80 /* affinity */))) <= SQLITE_AFF_NONE { - *(*int8)(unsafe.Pointer(bp + 80 /* affinity */)) = int8(SQLITE_AFF_BLOB) - } else if int32(*(*int8)(unsafe.Pointer(bp + 80 /* affinity */))) == SQLITE_AFF_REAL { - *(*int8)(unsafe.Pointer(bp + 80 /* affinity */)) = int8(SQLITE_AFF_NUMERIC) + *(*int8)(unsafe.Pointer(bp + 64 /* affinity */)) = Xsqlite3ExprAffinity(tls, pLeft) + if int32(*(*int8)(unsafe.Pointer(bp + 64 /* affinity */))) <= SQLITE_AFF_NONE { + *(*int8)(unsafe.Pointer(bp + 64 /* affinity */)) = int8(SQLITE_AFF_BLOB) + } else if int32(*(*int8)(unsafe.Pointer(bp + 64 /* affinity */))) == SQLITE_AFF_REAL { + *(*int8)(unsafe.Pointer(bp + 64 /* affinity */)) = int8(SQLITE_AFF_NUMERIC) } if pKeyInfo != 0 { @@ -128052,7 +128560,7 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 // Evaluate the expression and insert it into the temp table Xsqlite3ExprCode(tls, pParse, pE2, r1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, r1, 1, r2, bp+80 /* &affinity */, 1) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, r1, 1, r2, bp+64 /* &affinity */, 1) Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxInsert, iTab, r2, r1, 1) } @@ -128092,13 +128600,13 @@ func Xsqlite3CodeRhsOfIN(tls *libc.TLS, pParse uintptr, pExpr uintptr, iTab int3 // return value is the register of the left-most result column. // Return 0 if an error occurs. func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { /* sqlite3.c:104320:20: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(64) + defer tls.Free(64) var addrOnce int32 = 0 // Address of OP_Once at top of subroutine var rReg int32 = 0 // Register storing resulting var pSel uintptr // SELECT statement to encode - // var dest SelectDest at bp+40, 40 + // var dest SelectDest at bp+24, 40 // How to deal with SELECT result var nReg int32 // Registers to allocate var pLimit uintptr // New limit expression @@ -128114,7 +128622,7 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // If this routine has already been coded, then invoke it as a // subroutine. if ((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_Subrtn))) != U32(0) { - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8221 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+8236 /* "REUSE SUBQUERY %..." */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) Xsqlite3VdbeAddOp2(tls, v, OP_Gosub, *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ + 4 /* &.regReturn */)), *(*int32)(unsafe.Pointer(pExpr + 64 /* &.y */ /* &.sub */ /* &.iAddr */))) return (*Expr)(unsafe.Pointer(pExpr)).FiTable @@ -128147,35 +128655,35 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { // // In both cases, the query is augmented with "LIMIT 1". Any // preexisting limit is discarded in place of the new LIMIT 1. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+8239 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+16, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+8254 /* "%sSCALAR SUBQUER..." */, libc.VaList(bp+8, func() uintptr { if addrOnce != 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 8209 /* "CORRELATED " */ + return ts + 8224 /* "CORRELATED " */ }(), (*Select)(unsafe.Pointer(pSel)).FselId)) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { nReg = (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpEList)).FnExpr } else { nReg = 1 } - Xsqlite3SelectDestInit(tls, bp+40 /* &dest */, 0, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1)) + Xsqlite3SelectDestInit(tls, bp+24 /* &dest */, 0, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1)) *(*int32)(unsafe.Pointer(pParse + 56 /* &.nMem */)) += (nReg) if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_SELECT { - (*SelectDest)(unsafe.Pointer(bp + 40 /* &dest */)).FeDest = U8(SRT_Mem) - (*SelectDest)(unsafe.Pointer(bp + 40 /* &dest */)).FiSdst = (*SelectDest)(unsafe.Pointer(bp + 40 /* &dest */)).FiSDParm - (*SelectDest)(unsafe.Pointer(bp + 40 /* &dest */)).FnSdst = nReg - Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, (*SelectDest)(unsafe.Pointer(bp+40 /* &dest */)).FiSDParm, (((*SelectDest)(unsafe.Pointer(bp+40 /* &dest */)).FiSDParm + nReg) - 1)) + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FeDest = U8(SRT_Mem) + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FiSdst = (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FiSDParm + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FnSdst = nReg + Xsqlite3VdbeAddOp3(tls, v, OP_Null, 0, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm, (((*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm + nReg) - 1)) } else { - (*SelectDest)(unsafe.Pointer(bp + 40 /* &dest */)).FeDest = U8(SRT_Exists) - Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*SelectDest)(unsafe.Pointer(bp+40 /* &dest */)).FiSDParm) + (*SelectDest)(unsafe.Pointer(bp + 24 /* &dest */)).FeDest = U8(SRT_Exists) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm) } if (*Select)(unsafe.Pointer(pSel)).FpLimit != 0 { // The subquery already has a limit. If the pre-existing limit is X // then make the new limit X<>0 so that the new limit is either 1 or 0 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb - pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7853 /* "0" */) + pLimit = Xsqlite3Expr(tls, db, TK_INTEGER, ts+7868 /* "0" */) if pLimit != 0 { (*Expr)(unsafe.Pointer(pLimit)).FaffExpr = int8(SQLITE_AFF_NUMERIC) pLimit = Xsqlite3PExpr(tls, pParse, TK_NE, @@ -128185,18 +128693,18 @@ func Xsqlite3CodeSubselect(tls *libc.TLS, pParse uintptr, pExpr uintptr) int32 { (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(pSel)).FpLimit)).FpLeft = pLimit } else { // If there is no pre-existing limit add a limit of 1 - pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+8260 /* "1" */) + pLimit = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, ts+8275 /* "1" */) (*Select)(unsafe.Pointer(pSel)).FpLimit = Xsqlite3PExpr(tls, pParse, TK_LIMIT, pLimit, uintptr(0)) } (*Select)(unsafe.Pointer(pSel)).FiLimit = 0 - if Xsqlite3Select(tls, pParse, pSel, bp+40 /* &dest */) != 0 { + if Xsqlite3Select(tls, pParse, pSel, bp+24 /* &dest */) != 0 { if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop2 = (*Expr)(unsafe.Pointer(pExpr)).Fop (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_ERROR) } return 0 } - (*Expr)(unsafe.Pointer(pExpr)).FiTable = libc.AssignInt32(&rReg, (*SelectDest)(unsafe.Pointer(bp+40 /* &dest */)).FiSDParm) + (*Expr)(unsafe.Pointer(pExpr)).FiTable = libc.AssignInt32(&rReg, (*SelectDest)(unsafe.Pointer(bp+24 /* &dest */)).FiSDParm) if addrOnce != 0 { Xsqlite3VdbeJumpHere(tls, v, addrOnce) @@ -128658,8 +129166,8 @@ func codeReal(tls *libc.TLS, v uintptr, z uintptr, negateFlag int32, iMem int32) // // Expr.u.zToken is always UTF8 and zero-terminated. func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iMem int32) { /* sqlite3.c:104756:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe if ((*Expr)(unsafe.Pointer(pExpr)).Fflags & U32(EP_IntValue)) != 0 { @@ -128671,18 +129179,18 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM Xsqlite3VdbeAddOp2(tls, v, OP_Integer, i, iMem) } else { var c int32 - // var value I64 at bp+24, 8 + // var value I64 at bp+16, 8 var z uintptr = *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) - c = Xsqlite3DecOrHexToI64(tls, z, bp+24 /* &value */) - if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 24 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { - if Xsqlite3_strnicmp(tls, z, ts+8262 /* "0x" */, 2) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8265 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { + c = Xsqlite3DecOrHexToI64(tls, z, bp+16 /* &value */) + if (((c == 3) && !(negFlag != 0)) || (c == 2)) || ((negFlag != 0) && (*(*I64)(unsafe.Pointer(bp + 16 /* value */)) == ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))))) { + if Xsqlite3_strnicmp(tls, z, ts+8277 /* "0x" */, 2) == 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+8280 /* "hex literal too ..." */, libc.VaList(bp, func() uintptr { if negFlag != 0 { - return ts + 5388 /* "-" */ + return ts + 5403 /* "-" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) } else { codeReal(tls, v, z, negFlag, iMem) @@ -128690,12 +129198,12 @@ func codeInteger(tls *libc.TLS, pParse uintptr, pExpr uintptr, negFlag int32, iM } else { if negFlag != 0 { if c == 3 { - *(*I64)(unsafe.Pointer(bp + 24 /* value */)) = ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) + *(*I64)(unsafe.Pointer(bp + 16 /* value */)) = ((int64(-1)) - (int64(0xffffffff) | (I64((int64(0x7fffffff))) << 32))) } else { - *(*I64)(unsafe.Pointer(bp + 24 /* value */)) = -*(*I64)(unsafe.Pointer(bp + 24 /* value */)) + *(*I64)(unsafe.Pointer(bp + 16 /* value */)) = -*(*I64)(unsafe.Pointer(bp + 16 /* value */)) } } - Xsqlite3VdbeAddOp4Dup8(tls, v, OP_Int64, 0, iMem, 0, bp+24 /* &value */, -14) + Xsqlite3VdbeAddOp4Dup8(tls, v, OP_Int64, 0, iMem, 0, bp+16 /* &value */, -14) } } } @@ -128737,8 +129245,8 @@ func Xsqlite3ExprCodeGeneratedColumn(tls *libc.TLS, pParse uintptr, pCol uintptr // Generate code to extract the value of the iCol-th column of a table. func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iTabCur int32, iCol int32, regOut int32) { /* sqlite3.c:104843:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pCol uintptr @@ -128757,7 +129265,7 @@ func Xsqlite3ExprCodeGetColumnOfTable(tls *libc.TLS, v uintptr, pTab uintptr, iT } else if (int32((*Column)(unsafe.Pointer((libc.AssignUintptr(&pCol, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32))))).FcolFlags) & COLFLAG_VIRTUAL) != 0 { var pParse uintptr = Xsqlite3VdbeParser(tls, v) if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_BUSY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8291 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+8306 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else { var savedSelfTab int32 = (*Parse)(unsafe.Pointer(pParse)).FiSelfTab *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) @@ -128964,19 +129472,19 @@ func exprCodeInlineFunction(tls *libc.TLS, pParse uintptr, pFarg uintptr, iFuncI // must check the return code and move the results to the desired // register. func Xsqlite3ExprCodeTarget(tls *libc.TLS, pParse uintptr, pExpr uintptr, target int32) int32 { /* sqlite3.c:105104:20: */ - bp := tls.Alloc(224) - defer tls.Free(224) + bp := tls.Alloc(192) + defer tls.Free(192) var v uintptr // The VM under construction var op int32 // The opcode being coded var inReg int32 // Results stored in register inReg - // var regFree1 int32 at bp+72, 4 + // var regFree1 int32 at bp+40, 4 // If non-zero free this temporary register - // var regFree2 int32 at bp+76, 4 + // var regFree2 int32 at bp+44, 4 // If non-zero free this temporary register var r1 int32 var r2 int32 // Various register numbers - // var tempX Expr at bp+80, 72 + // var tempX Expr at bp+48, 72 // Temporary expression node var p5 int32 var pTab uintptr @@ -129059,7 +129567,7 @@ func Xsqlite3ExprCodeTarget(tls *libc.TLS, pParse uintptr, pExpr uintptr, target var i1 int32 // Loop counter var pEList uintptr // List of WHEN terms var aListelem uintptr // Array of WHEN terms - // var opCompare Expr at bp+152, 72 + // var opCompare Expr at bp+120, 72 // The X==Ei expression var pX uintptr // The X expression var pTest uintptr // X==Ei (form A) or just Ei (form B) @@ -129067,8 +129575,8 @@ func Xsqlite3ExprCodeTarget(tls *libc.TLS, pParse uintptr, pExpr uintptr, target var db1 uintptr v = (*Parse)(unsafe.Pointer(pParse)).FpVdbe inReg = target - *(*int32)(unsafe.Pointer(bp + 72 /* regFree1 */)) = 0 - *(*int32)(unsafe.Pointer(bp + 76 /* regFree2 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 40 /* regFree1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 44 /* regFree2 */)) = 0 p5 = 0 expr_code_doover: @@ -129316,7 +129824,7 @@ __69: if !((int32((*Column)(unsafe.Pointer(pCol1)).FcolFlags) & COLFLAG_BUSY) != 0) { goto __72 } - Xsqlite3ErrorMsg(tls, pParse, ts+8291, /* "generated column..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+8306, /* "generated column..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol1)).FzName)) return 0 __72: @@ -129456,8 +129964,8 @@ __22: codeVectorCompare(tls, pParse, pExpr, target, uint8(op), uint8(p5)) goto __80 __79: - r1 = Xsqlite3ExprCodeTemp(tls, pParse, pLeft, bp+72 /* ®Free1 */) - r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+76 /* ®Free2 */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, pLeft, bp+40 /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+44 /* ®Free2 */) Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, inReg) codeCompare(tls, pParse, pLeft, (*Expr)(unsafe.Pointer(pExpr)).FpRight, op, r1, r2, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), p5, @@ -129491,8 +129999,8 @@ __33: __34: ; - r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+72 /* ®Free1 */) - r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+76 /* ®Free2 */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpRight, bp+44 /* ®Free2 */) Xsqlite3VdbeAddOp3(tls, v, op, r2, r1, target) goto __3 @@ -129515,12 +130023,12 @@ __83: return target goto __86 __85: - (*Expr)(unsafe.Pointer(bp + 80 /* &tempX */)).Fop = U8(TK_INTEGER) - (*Expr)(unsafe.Pointer(bp + 80 /* &tempX */)).Fflags = (U32(EP_IntValue | EP_TokenOnly)) - *(*int32)(unsafe.Pointer(bp + 80 /* &tempX */ + 8 /* &.u */)) = 0 + (*Expr)(unsafe.Pointer(bp + 48 /* &tempX */)).Fop = U8(TK_INTEGER) + (*Expr)(unsafe.Pointer(bp + 48 /* &tempX */)).Fflags = (U32(EP_IntValue | EP_TokenOnly)) + *(*int32)(unsafe.Pointer(bp + 48 /* &tempX */ + 8 /* &.u */)) = 0 - r1 = Xsqlite3ExprCodeTemp(tls, pParse, bp+80 /* &tempX */, bp+72 /* ®Free1 */) - r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+76 /* ®Free2 */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, bp+48 /* &tempX */, bp+40 /* ®Free1 */) + r2 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+44 /* ®Free2 */) Xsqlite3VdbeAddOp3(tls, v, OP_Subtract, r2, r1, target) __86: @@ -129533,13 +130041,13 @@ __36: __37: ; - r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+72 /* ®Free1 */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) Xsqlite3VdbeAddOp2(tls, v, op, r1, inReg) goto __3 __38: // IS TRUE or IS FALSE - r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+72 /* ®Free1 */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) isTrue = Xsqlite3ExprTruthValue(tls, (*Expr)(unsafe.Pointer(pExpr)).FpRight) bNormal = (libc.Bool32(int32((*Expr)(unsafe.Pointer(pExpr)).Fop2) == TK_IS)) @@ -129552,7 +130060,7 @@ __40: ; Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 1, target) - r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+72 /* ®Free1 */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pExpr)).FpLeft, bp+40 /* ®Free1 */) addr = Xsqlite3VdbeAddOp1(tls, v, op, r1) @@ -129568,7 +130076,7 @@ __41: goto __87 } - Xsqlite3ErrorMsg(tls, pParse, ts+8321 /* "misuse of aggreg..." */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+8336 /* "misuse of aggreg..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) goto __88 __87: return (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pInfo)).FaFunc + uintptr((*Expr)(unsafe.Pointer(pExpr)).FiAgg)*32)).FiMem @@ -129610,7 +130118,7 @@ __90: if !((pDef == uintptr(0)) || ((*FuncDef)(unsafe.Pointer(pDef)).FxFinalize != uintptr(0))) { goto __91 } - Xsqlite3ErrorMsg(tls, pParse, ts+8347 /* "unknown function..." */, libc.VaList(bp+32, zId)) + Xsqlite3ErrorMsg(tls, pParse, ts+8362 /* "unknown function..." */, libc.VaList(bp+16, zId)) goto __3 __91: ; @@ -129804,8 +130312,8 @@ __122: ((*Expr)(unsafe.Pointer(pExpr)).FiTable != (libc.AssignInt32(&n1, Xsqlite3ExprVectorSize(tls, (*Expr)(unsafe.Pointer(pExpr)).FpLeft))))) { goto __123 } - Xsqlite3ErrorMsg(tls, pParse, ts+7974, /* "%d columns assig..." */ - libc.VaList(bp+48, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) + Xsqlite3ErrorMsg(tls, pParse, ts+7989, /* "%d columns assig..." */ + libc.VaList(bp+24, (*Expr)(unsafe.Pointer(pExpr)).FiTable, n1)) __123: ; return ((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pExpr)).FpLeft)).FiTable + int32((*Expr)(unsafe.Pointer(pExpr)).FiColumn)) @@ -129886,7 +130394,7 @@ __124: goto __3 __52: - Xsqlite3ErrorMsg(tls, pParse, ts+6895 /* "row value misuse..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6910 /* "row value misuse..." */, 0) goto __3 // TK_IF_NULL_ROW Expr nodes are inserted ahead of expressions @@ -129948,17 +130456,17 @@ __54: // The X expression __126: ; - exprToRegister(tls, pDel, exprCodeVector(tls, pParse, pDel, bp+72 /* ®Free1 */)) + exprToRegister(tls, pDel, exprCodeVector(tls, pParse, pDel, bp+40 /* ®Free1 */)) - libc.Xmemset(tls, bp+152 /* &opCompare */, 0, uint64(unsafe.Sizeof(Expr{}))) - (*Expr)(unsafe.Pointer(bp + 152 /* &opCompare */)).Fop = U8(TK_EQ) - (*Expr)(unsafe.Pointer(bp + 152 /* &opCompare */)).FpLeft = pDel - pTest = bp + 152 /* &opCompare */ + libc.Xmemset(tls, bp+120 /* &opCompare */, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(bp + 120 /* &opCompare */)).Fop = U8(TK_EQ) + (*Expr)(unsafe.Pointer(bp + 120 /* &opCompare */)).FpLeft = pDel + pTest = bp + 120 /* &opCompare */ // Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: // The value in regFree1 might get SCopy-ed into the file result. // So make sure that the regFree1 register is not reused for other // purposes and possibly overwritten. - *(*int32)(unsafe.Pointer(bp + 72 /* regFree1 */)) = 0 + *(*int32)(unsafe.Pointer(bp + 40 /* regFree1 */)) = 0 __125: ; i1 = 0 @@ -129970,7 +130478,7 @@ __127: goto __130 } - (*Expr)(unsafe.Pointer(bp + 152 /* &opCompare */)).FpRight = (*ExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32)).FpExpr + (*Expr)(unsafe.Pointer(bp + 120 /* &opCompare */)).FpRight = (*ExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32)).FpExpr goto __131 __130: pTest = (*ExprList_item)(unsafe.Pointer(aListelem + uintptr(i1)*32)).FpExpr @@ -130010,7 +130518,7 @@ __55: goto __134 } Xsqlite3ErrorMsg(tls, pParse, - ts+8370 /* "RAISE() may only..." */, 0) + ts+8385 /* "RAISE() may only..." */, 0) return 0 __134: ; @@ -130044,12 +130552,12 @@ __137: __3: ; - Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 72 /* regFree1 */))) - Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 76 /* regFree2 */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 40 /* regFree1 */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 44 /* regFree2 */))) return inReg } -var zAff = *(*[8]int8)(unsafe.Pointer(ts + 8420 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ +var zAff = *(*[8]int8)(unsafe.Pointer(ts + 8435 /* "B\x00C\x00D\x00E" */)) /* sqlite3.c:105169:29 */ // Generate code that will evaluate expression pExpr just one time // per prepared statement execution. @@ -131883,14 +132391,14 @@ func Xsqlite3ClearTempRegCache(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:107 // // Or, if zName is not a system table, zero is returned. func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sqlite3.c:107433:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) - if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8428 /* "sqlite_" */, 7)) || + if ((0 == Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8443 /* "sqlite_" */, 7)) || (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Eponymous)) != U32(0))) || ((((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Shadow)) != U32(0)) && (Xsqlite3ReadOnlyShadowTables(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+8436 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+8451 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -131902,21 +132410,21 @@ func isAlterableTable(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sq // statement to ensure that the operation has not rendered any schema // objects unusable. func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, zWhen uintptr, bNoDQS int32) { /* sqlite3.c:107455:13: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(64) + defer tls.Free(64) (*Parse)(unsafe.Pointer(pParse)).FcolNamesSet = U8(1) Xsqlite3NestedParse(tls, pParse, - ts+8464, /* "SELECT 1 FROM \"%..." */ + ts+8479, /* "SELECT 1 FROM \"%..." */ libc.VaList(bp, zDb, zDb, bTemp, zWhen, bNoDQS)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+8639, /* "SELECT 1 FROM te..." */ - libc.VaList(bp+48, zDb, zWhen, bNoDQS)) + ts+8654, /* "SELECT 1 FROM te..." */ + libc.VaList(bp+40, zDb, zWhen, bNoDQS)) } } @@ -131926,16 +132434,16 @@ func renameTestSchema(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32, z // not true, similarly update all SQL statements in the sqlite_schema table // of the temp db. func renameFixQuotes(tls *libc.TLS, pParse uintptr, zDb uintptr, bTemp int32) { /* sqlite3.c:107492:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) Xsqlite3NestedParse(tls, pParse, - ts+8813 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) + ts+8828 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp, zDb, zDb)) if bTemp == 0 { Xsqlite3NestedParse(tls, pParse, - ts+8960 /* "UPDATE temp.sqli..." */, 0) + ts+8975 /* "UPDATE temp.sqli..." */, 0) } } @@ -131955,8 +132463,8 @@ func renameReloadSchema(tls *libc.TLS, pParse uintptr, iDb int32, p5 U16) { /* s // Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" // command. func Xsqlite3AlterRenameTable(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName uintptr) { /* sqlite3.c:107526:21: */ - bp := tls.Alloc(232) - defer tls.Free(232) + bp := tls.Alloc(184) + defer tls.Free(184) var iDb int32 // Database that contains the table var zDb uintptr // Name of database iDb @@ -132009,7 +132517,7 @@ __3: goto __4 } Xsqlite3ErrorMsg(tls, pParse, - ts+9111 /* "there is already..." */, libc.VaList(bp, zName)) + ts+9126 /* "there is already..." */, libc.VaList(bp, zName)) goto exit_rename_table __4: ; @@ -132022,7 +132530,7 @@ __4: goto exit_rename_table __5: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+9170 /* "table" */, zName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+9185 /* "table" */, zName)) { goto __6 } goto exit_rename_table @@ -132032,7 +132540,7 @@ __6: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+9176 /* "view %s may not ..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+9191 /* "view %s may not ..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_rename_table __7: ; @@ -132085,25 +132593,25 @@ __12: // the schema to use the new table name. Xsqlite3NestedParse(tls, pParse, - ts+9203 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) + ts+9218 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+16, zDb, zDb, zTabName, zName, (libc.Bool32(iDb == 1)), zTabName)) // Update the tbl_name and name columns of the sqlite_schema table // as required. Xsqlite3NestedParse(tls, pParse, - ts+9387, /* "UPDATE %Q.sqlite..." */ - libc.VaList(bp+88, zDb, + ts+9402, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp+64, zDb, zName, zName, zName, nTabName, zTabName)) // If the sqlite_sequence table exists in this database, then update // it with the new table name. - if !(Xsqlite3FindTable(tls, db, ts+9692 /* "sqlite_sequence" */, zDb) != 0) { + if !(Xsqlite3FindTable(tls, db, ts+9707 /* "sqlite_sequence" */, zDb) != 0) { goto __13 } Xsqlite3NestedParse(tls, pParse, - ts+9708, /* "UPDATE \"%w\".sqli..." */ - libc.VaList(bp+144, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+9723, /* "UPDATE \"%w\".sqli..." */ + libc.VaList(bp+112, zDb, zName, (*Table)(unsafe.Pointer(pTab)).FzName)) __13: ; @@ -132115,7 +132623,7 @@ __13: } Xsqlite3NestedParse(tls, pParse, - ts+9766 /* "UPDATE sqlite_te..." */, libc.VaList(bp+176, zDb, zTabName, zName, zTabName, zDb, zName)) + ts+9781 /* "UPDATE sqlite_te..." */, libc.VaList(bp+136, zDb, zTabName, zName, zTabName, zDb, zName)) __14: ; @@ -132133,7 +132641,7 @@ __15: ; renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+10031 /* "after rename" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+10046 /* "after rename" */, 0) exit_rename_table: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -132144,11 +132652,11 @@ exit_rename_table: // Write code that will raise an error if the table described by // zDb and zTab is not empty. func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uintptr, zErr uintptr) { /* sqlite3.c:107699:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) Xsqlite3NestedParse(tls, pParse, - ts+10044, /* "SELECT raise(ABO..." */ + ts+10059, /* "SELECT raise(ABO..." */ libc.VaList(bp, zErr, zDb, zTab)) } @@ -132159,8 +132667,8 @@ func sqlite3ErrorIfNotEmpty(tls *libc.TLS, pParse uintptr, zDb uintptr, zTab uin // The Table structure pParse->pNewTable was extended to include // the new column during parsing. func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr) { /* sqlite3.c:107719:21: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) var pNew uintptr // Copy of pParse->pNewTable var pTab uintptr // Table being altered @@ -132196,12 +132704,12 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // If there is a NOT NULL constraint, then the default value for the // column must not be NULL. if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10082 /* "Cannot add a PRI..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10097 /* "Cannot add a PRI..." */, 0) return } if (*Table)(unsafe.Pointer(pNew)).FpIndex != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+10114 /* "Cannot add a UNI..." */, 0) + ts+10129 /* "Cannot add a UNI..." */, 0) return } if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) == 0 { @@ -132214,32 +132722,32 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr } if ((((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ForeignKeys)) != 0) && ((*Table)(unsafe.Pointer(pNew)).FpFKey != 0)) && (pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+10141 /* "Cannot add a REF..." */) + ts+10156 /* "Cannot add a REF..." */) } if ((*Column)(unsafe.Pointer(pCol)).FnotNull != 0) && !(pDflt != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+10200 /* "Cannot add a NOT..." */) + ts+10215 /* "Cannot add a NOT..." */) } // Ensure the default expression is something that sqlite3ValueFromExpr() // can handle (i.e. not CURRENT_TIME etc.) if pDflt != 0 { - *(*uintptr)(unsafe.Pointer(bp + 48 /* pVal */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) = uintptr(0) var rc int32 - rc = Xsqlite3ValueFromExpr(tls, db, pDflt, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp+48 /* &pVal */) + rc = Xsqlite3ValueFromExpr(tls, db, pDflt, uint8(SQLITE_UTF8), uint8(SQLITE_AFF_BLOB), bp+40 /* &pVal */) if rc != SQLITE_OK { return } - if !(*(*uintptr)(unsafe.Pointer(bp + 48 /* pVal */)) != 0) { + if !(*(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)) != 0) { sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, - ts+10253 /* "Cannot add a col..." */) + ts+10268 /* "Cannot add a col..." */) } - Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pVal */))) + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */))) } } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_STORED) != 0 { - sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+10299 /* "cannot add a STO..." */) + sqlite3ErrorIfNotEmpty(tls, pParse, zDb, zTab, ts+10314 /* "cannot add a STO..." */) } // Modify the CREATE TABLE statement. @@ -132255,7 +132763,7 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // have to use printf() to translate between these units: Xsqlite3NestedParse(tls, pParse, - ts+10326, /* "UPDATE \"%w\".sqli..." */ + ts+10341, /* "UPDATE \"%w\".sqli..." */ libc.VaList(bp, zDb, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zCol, (*Table)(unsafe.Pointer(pNew)).FaddColOffset, zTab)) Xsqlite3DbFree(tls, db, zCol) @@ -132295,8 +132803,8 @@ func Xsqlite3AlterFinishAddColumn(tls *libc.TLS, pParse uintptr, pColDef uintptr // Routine sqlite3AlterFinishAddColumn() will be called to complete // coding the "ALTER TABLE ... ADD" statement. func Xsqlite3AlterBeginAddColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr) { /* sqlite3.c:107867:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pNew uintptr var pTab uintptr @@ -132326,7 +132834,7 @@ __2: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+10472 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10487 /* "virtual tables m..." */, 0) goto exit_begin_add_column __3: ; @@ -132335,7 +132843,7 @@ __3: if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+10506 /* "Cannot add a col..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+10521 /* "Cannot add a col..." */, 0) goto exit_begin_add_column __4: ; @@ -132370,7 +132878,7 @@ __6: nAlloc = ((((int32((*Table)(unsafe.Pointer(pNew)).FnCol) - 1) / 8) * 8) + 8) (*Table)(unsafe.Pointer(pNew)).FaCol = Xsqlite3DbMallocZero(tls, db, (uint64(unsafe.Sizeof(Column{})) * uint64(nAlloc))) - (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+10536 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + (*Table)(unsafe.Pointer(pNew)).FzName = Xsqlite3MPrintf(tls, db, ts+10551 /* "sqlite_altertab_..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(!(int32((*Table)(unsafe.Pointer(pNew)).FaCol) != 0) || !(int32((*Table)(unsafe.Pointer(pNew)).FzName) != 0)) { goto __7 } @@ -132412,23 +132920,23 @@ exit_begin_add_column: // // Or, if pTab is not a view or virtual table, zero is returned. func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 { /* sqlite3.c:107949:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var zType uintptr = uintptr(0) if (*Table)(unsafe.Pointer(pTab)).FpSelect != 0 { - zType = ts + 10555 /* "view" */ + zType = ts + 10570 /* "view" */ } if (*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0 { - zType = ts + 10560 /* "virtual table" */ + zType = ts + 10575 /* "virtual table" */ } if zType != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+10574, /* "cannot %s %s \"%s..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+10589, /* "cannot %s %s \"%s..." */ libc.VaList(bp, func() uintptr { if bDrop != 0 { - return ts + 10592 /* "drop column from" */ + return ts + 10607 /* "drop column from" */ } - return ts + 10609 /* "rename columns o..." */ + return ts + 10624 /* "rename columns o..." */ }(), zType, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 @@ -132440,8 +132948,8 @@ func isRealTable(tls *libc.TLS, pParse uintptr, pTab uintptr, bDrop int32) int32 // // cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew func Xsqlite3AlterRenameColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pOld uintptr, pNew uintptr) { /* sqlite3.c:107979:21: */ - bp := tls.Alloc(136) - defer tls.Free(136) + bp := tls.Alloc(112) + defer tls.Free(112) var db uintptr // Database connection var pTab uintptr // Table being updated @@ -132521,13 +133029,13 @@ __8: if !(iCol == int32((*Table)(unsafe.Pointer(pTab)).FnCol)) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+6730 /* "no such column: ..." */, libc.VaList(bp, zOld)) + Xsqlite3ErrorMsg(tls, pParse, ts+6745 /* "no such column: ..." */, libc.VaList(bp, zOld)) goto exit_rename_column __10: ; // Ensure the schema contains no double-quoted strings - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iSchema == 1))) // Do the rename operation using a recursive UPDATE statement that @@ -132545,19 +133053,19 @@ __11: bQuote = (int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(pNew)).Fz)))]) & 0x80) Xsqlite3NestedParse(tls, pParse, - ts+10627, /* "UPDATE \"%w\".sqli..." */ - libc.VaList(bp+16, zDb, + ts+10642, /* "UPDATE \"%w\".sqli..." */ + libc.VaList(bp+8, zDb, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote, (libc.Bool32(iSchema == 1)), (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3NestedParse(tls, pParse, - ts+10845, /* "UPDATE temp.sqli..." */ - libc.VaList(bp+88, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) + ts+10860, /* "UPDATE temp.sqli..." */ + libc.VaList(bp+72, zDb, (*Table)(unsafe.Pointer(pTab)).FzName, iCol, zNew, bQuote)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iSchema, uint16(INITFLAG_AlterRename)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+10031 /* "after rename" */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iSchema == 1)), ts+10046 /* "after rename" */, 1) exit_rename_column: Xsqlite3SrcListDelete(tls, db, pSrc) @@ -132845,19 +133353,19 @@ func renameColumnTokenNext(tls *libc.TLS, pCtx uintptr) uintptr { /* sqlite3.c:1 // sub-routine is currently stored in pParse->zErrMsg. This function // adds context to the error message and then stores it in pCtx. func renameColumnParseError(tls *libc.TLS, pCtx uintptr, zWhen uintptr, pType uintptr, pObject uintptr, pParse uintptr) { /* sqlite3.c:108431:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(40) + defer tls.Free(40) var zT uintptr = Xsqlite3_value_text(tls, pType) var zN uintptr = Xsqlite3_value_text(tls, pObject) var zErr uintptr - zErr = Xsqlite3_mprintf(tls, ts+10976, /* "error in %s %s%s..." */ + zErr = Xsqlite3_mprintf(tls, ts+10991, /* "error in %s %s%s..." */ libc.VaList(bp, zT, zN, func() uintptr { if *(*int8)(unsafe.Pointer(zWhen)) != 0 { - return ts + 10999 /* " " */ + return ts + 11014 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zWhen, (*Parse)(unsafe.Pointer(pParse)).FzErrMsg)) Xsqlite3_result_error(tls, pCtx, zErr, -1) @@ -132947,8 +133455,8 @@ func renameParseSql(tls *libc.TLS, p uintptr, zDb uintptr, db uintptr, zSql uint // Or, if an error occurs (i.e. an OOM condition), an error is left in // pCtx and an SQLite error code returned. func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, zNew uintptr, bQuote int32) int32 { /* sqlite3.c:108558:12: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var nNew I64 = I64(Xsqlite3Strlen30(tls, zNew)) var nSql I64 = I64(Xsqlite3Strlen30(tls, zSql)) @@ -132966,7 +133474,7 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z // ALTER TABLE statement was quoted (bQuote==1), then set zNew to // point to zQuot so that all substitutions are made using the // quoted version of the new column name. - zQuot = Xsqlite3MPrintf(tls, db, ts+11001 /* "\"%w\" " */, libc.VaList(bp, zNew)) + zQuot = Xsqlite3MPrintf(tls, db, ts+11016 /* "\"%w\" " */, libc.VaList(bp, zNew)) if zQuot == uintptr(0) { return SQLITE_NOMEM } else { @@ -133016,12 +133524,12 @@ func renameEditSql(tls *libc.TLS, pCtx uintptr, pRename uintptr, zSql uintptr, z libc.Xmemcpy(tls, zBuf1, (*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz, uint64((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)) *(*int8)(unsafe.Pointer(zBuf1 + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn))) = int8(0) Xsqlite3Dequote(tls, zBuf1) - Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+11007 /* "%Q%s" */, libc.VaList(bp+16, zBuf1, + Xsqlite3_snprintf(tls, (int32(nSql * int64(2))), zBuf2, ts+11022 /* "%Q%s" */, libc.VaList(bp+8, zBuf1, func() uintptr { if int32(*(*int8)(unsafe.Pointer((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fz + uintptr((*RenameToken)(unsafe.Pointer(pBest)).Ft.Fn)))) == '\'' { - return ts + 10999 /* " " */ + return ts + 11014 /* " " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) zReplace = zBuf2 nReplace = U32(Xsqlite3Strlen30(tls, zReplace)) @@ -133526,7 +134034,7 @@ renameColumnFunc_done: if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzErrMsg != 0) { goto __44 } - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &sParse */) goto __45 __44: Xsqlite3_result_error_code(tls, context, rc) @@ -133706,7 +134214,7 @@ func renameTableFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr } if rc != SQLITE_OK { if (*Parse)(unsafe.Pointer(bp+80 /* &sParse */)).FzErrMsg != 0 { - renameColumnParseError(tls, context, ts+740 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) + renameColumnParseError(tls, context, ts+755 /* "" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &sParse */) } else { Xsqlite3_result_error_code(tls, context, rc) } @@ -133924,8 +134432,8 @@ func renameTableTest(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr // The value returned is a string containing the CREATE TABLE statement // with column argv[2] removed. func dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:109390:13: */ - bp := tls.Alloc(440) - defer tls.Free(440) + bp := tls.Alloc(432) + defer tls.Free(432) var db uintptr var iSchema int32 @@ -133933,7 +134441,7 @@ func dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) var iCol int32 var zDb uintptr var rc int32 - // var sParse Parse at bp+32, 408 + // var sParse Parse at bp+24, 408 var pCol uintptr var pTab uintptr @@ -133951,14 +134459,14 @@ func dropColumnFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) _ = NotUsed - rc = renameParseSql(tls, bp+32 /* &sParse */, zDb, db, zSql, (libc.Bool32(iSchema == 1))) + rc = renameParseSql(tls, bp+24 /* &sParse */, zDb, db, zSql, (libc.Bool32(iSchema == 1))) if !(rc != SQLITE_OK) { goto __1 } goto drop_column_done __1: ; - pTab = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpNewTable + pTab = (*Parse)(unsafe.Pointer(bp + 24 /* &sParse */)).FpNewTable if !(((pTab == uintptr(0)) || (int32((*Table)(unsafe.Pointer(pTab)).FnCol) == 1)) || (iCol >= int32((*Table)(unsafe.Pointer(pTab)).FnCol))) { goto __2 } @@ -133968,11 +134476,11 @@ __1: __2: ; - pCol = renameTokenFind(tls, bp+32 /* &sParse */, uintptr(0), (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName) + pCol = renameTokenFind(tls, bp+24 /* &sParse */, uintptr(0), (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FzName) if !(iCol < (int32((*Table)(unsafe.Pointer(pTab)).FnCol) - 1)) { goto __3 } - pEnd = renameTokenFind(tls, bp+32 /* &sParse */, uintptr(0), (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((iCol+1))*32)).FzName) + pEnd = renameTokenFind(tls, bp+24 /* &sParse */, uintptr(0), (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((iCol+1))*32)).FzName) zEnd = (*RenameToken)(unsafe.Pointer(pEnd)).Ft.Fz goto __4 __3: @@ -133988,12 +134496,12 @@ __6: __4: ; - zNew = Xsqlite3MPrintf(tls, db, ts+11012 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) + zNew = Xsqlite3MPrintf(tls, db, ts+11027 /* "%.*s%s" */, libc.VaList(bp, ((int64((*RenameToken)(unsafe.Pointer(pCol)).Ft.Fz)-int64(zSql))/1), zSql, zEnd)) Xsqlite3_result_text(tls, context, zNew, -1, libc.UintptrFromInt32(-1)) Xsqlite3_free(tls, zNew) drop_column_done: - renameParseCleanup(tls, bp+32 /* &sParse */) + renameParseCleanup(tls, bp+24 /* &sParse */) (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if !(rc != SQLITE_OK) { goto __7 @@ -134009,8 +134517,8 @@ __7: // statement. Argument pSrc contains the possibly qualified name of the // table being edited, and token pName the name of the column to drop. func Xsqlite3AlterDropColumn(tls *libc.TLS, pParse uintptr, pSrc uintptr, pName uintptr) { /* sqlite3.c:109454:21: */ - bp := tls.Alloc(96) - defer tls.Free(96) + bp := tls.Alloc(64) + defer tls.Free(64) var db uintptr // Database handle var pTab uintptr // Table to modify @@ -134076,7 +134584,7 @@ __5: if !(iCol < 0) { goto __6 } - Xsqlite3ErrorMsg(tls, pParse, ts+6730 /* "no such column: ..." */, libc.VaList(bp, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+6745 /* "no such column: ..." */, libc.VaList(bp, zCol)) goto exit_drop_column __6: ; @@ -134086,12 +134594,12 @@ __6: if !((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & (COLFLAG_PRIMKEY | COLFLAG_UNIQUE)) != 0) { goto __7 } - Xsqlite3ErrorMsg(tls, pParse, ts+11019, /* "cannot drop %s c..." */ - libc.VaList(bp+16, func() uintptr { + Xsqlite3ErrorMsg(tls, pParse, ts+11034, /* "cannot drop %s c..." */ + libc.VaList(bp+8, func() uintptr { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_PRIMKEY) != 0 { - return ts + 11047 /* "PRIMARY KEY" */ + return ts + 11062 /* "PRIMARY KEY" */ } - return ts + 6551 /* "UNIQUE" */ + return ts + 6566 /* "UNIQUE" */ }(), zCol)) goto exit_drop_column @@ -134102,7 +134610,7 @@ __7: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) <= 1) { goto __8 } - Xsqlite3ErrorMsg(tls, pParse, ts+11059 /* "cannot drop colu..." */, libc.VaList(bp+40, zCol)) + Xsqlite3ErrorMsg(tls, pParse, ts+11074 /* "cannot drop colu..." */, libc.VaList(bp+24, zCol)) goto exit_drop_column __8: ; @@ -134111,15 +134619,15 @@ __8: iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+740 /* "" */, 0) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+755 /* "" */, 0) renameFixQuotes(tls, pParse, zDb, (libc.Bool32(iDb == 1))) Xsqlite3NestedParse(tls, pParse, - ts+11107 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+56, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+11122 /* "UPDATE \"%w\".sqli..." */, libc.VaList(bp+32, zDb, iDb, iCol, (*Table)(unsafe.Pointer(pTab)).FzName)) // Drop and reload the database schema. renameReloadSchema(tls, pParse, iDb, uint16(INITFLAG_AlterDrop)) - renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+11228 /* "after drop colum..." */, 1) + renameTestSchema(tls, pParse, zDb, (libc.Bool32(iDb == 1)), ts+11243 /* "after drop colum..." */, 1) // Edit rows of table on disk if !(((*Parse)(unsafe.Pointer(pParse)).FnErr == 0) && ((int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(iCol)*32)).FcolFlags) & COLFLAG_VIRTUAL) == 0)) { @@ -134230,11 +134738,11 @@ func Xsqlite3AlterFunctions(tls *libc.TLS) { /* sqlite3.c:109584:21: */ } var aAlterTableFuncs = [5]FuncDef{ - {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11246 /* "sqlite_rename_co..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11267 /* "sqlite_rename_ta..." */}, - {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11287 /* "sqlite_rename_te..." */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11306 /* "sqlite_drop_colu..." */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11325 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ + {FnArg: int8(9), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11261 /* "sqlite_rename_co..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11282 /* "sqlite_rename_ta..." */}, + {FnArg: int8(7), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11302 /* "sqlite_rename_te..." */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11321 /* "sqlite_drop_colu..." */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_INTERNAL | SQLITE_UTF8) | SQLITE_FUNC_CONSTANT)), FxSFunc: 0, FzName: ts + 11340 /* "sqlite_rename_qu..." */}} /* sqlite3.c:109585:18 */ //************* End of alter.c ********************************************** //************* Begin file analyze.c **************************************** @@ -134391,16 +134899,16 @@ var aAlterTableFuncs = [5]FuncDef{ // the sqlite_statN tables associated with the named table are deleted. // If zWhere==0, then code is generated to delete all stat table entries. func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWhere uintptr, zWhereType uintptr) { /* sqlite3.c:109763:13: */ - bp := tls.Alloc(112) - defer tls.Free(112) + bp := tls.Alloc(88) + defer tls.Free(88) var i int32 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb var pDb uintptr var v uintptr = Xsqlite3GetVdbe(tls, pParse) - // var aRoot [3]U32 at bp+100, 12 + // var aRoot [3]U32 at bp+76, 12 - // var aCreateTbl [3]U8 at bp+96, 3 + // var aCreateTbl [3]U8 at bp+72, 3 var nToOpen int32 if ((*Sqlite3)(unsafe.Pointer((db))).FdbOptFlags & (U32(SQLITE_Stat4))) == U32(0) { @@ -134423,7 +134931,7 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh }{})))); i++ { var zTab uintptr = aTable[i].FzName var pStat uintptr - *(*U8)(unsafe.Pointer(bp + 96 /* &aCreateTbl[0] */ + uintptr(i))) = U8(0) + *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(0) if (libc.AssignUintptr(&pStat, Xsqlite3FindTable(tls, db, zTab, (*Db)(unsafe.Pointer(pDb)).FzDbSName))) == uintptr(0) { if i < nToOpen { // The sqlite_statN table does not exist. Create it. Note that a @@ -134431,25 +134939,25 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // of the new table in register pParse->regRoot. This is important // because the OpenWrite opcode below will be needing it. Xsqlite3NestedParse(tls, pParse, - ts+11348 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) - *(*U32)(unsafe.Pointer(bp + 100 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) - *(*U8)(unsafe.Pointer(bp + 96 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) + ts+11363 /* "CREATE TABLE %Q...." */, libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, aTable[i].FzCols)) + *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = U32((*Parse)(unsafe.Pointer(pParse)).FregRoot) + *(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))) = U8(OPFLAG_P2ISREG) } } else { // The table already exists. If zWhere is not NULL, delete all entries // associated with the table zWhere. If zWhere is NULL, delete the // entire contents of the table. - *(*U32)(unsafe.Pointer(bp + 100 /* &aRoot[0] */ + uintptr(i)*4)) = (*Table)(unsafe.Pointer(pStat)).Ftnum - Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 100 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) + *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)) = (*Table)(unsafe.Pointer(pStat)).Ftnum + Xsqlite3TableLock(tls, pParse, iDb, *(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4)), uint8(1), zTab) if zWhere != 0 { Xsqlite3NestedParse(tls, pParse, - ts+11371, /* "DELETE FROM %Q.%..." */ - libc.VaList(bp+32, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) + ts+11386, /* "DELETE FROM %Q.%..." */ + libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab, zWhereType, zWhere)) } else if (*Sqlite3)(unsafe.Pointer(db)).FxPreUpdateCallback != 0 { - Xsqlite3NestedParse(tls, pParse, ts+11401 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+72, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) + Xsqlite3NestedParse(tls, pParse, ts+11416 /* "DELETE FROM %Q.%..." */, libc.VaList(bp+56, (*Db)(unsafe.Pointer(pDb)).FzDbSName, zTab)) } else { // The sqlite_stat[134] table already exists. Delete all rows. - Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 100 /* &aRoot[0] */ + uintptr(i)*4))), iDb) + Xsqlite3VdbeAddOp2(tls, v, OP_Clear, int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb) } } } @@ -134457,8 +134965,8 @@ func openStatTable(tls *libc.TLS, pParse uintptr, iDb int32, iStatCur int32, zWh // Open the sqlite_stat[134] tables for writing. for i = 0; i < nToOpen; i++ { - Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, (iStatCur + i), int32(*(*U32)(unsafe.Pointer(bp + 100 /* &aRoot[0] */ + uintptr(i)*4))), iDb, 3) - Xsqlite3VdbeChangeP5(tls, v, uint16(*(*U8)(unsafe.Pointer(bp + 96 /* &aCreateTbl[0] */ + uintptr(i))))) + Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, (iStatCur + i), int32(*(*U32)(unsafe.Pointer(bp + 76 /* &aRoot[0] */ + uintptr(i)*4))), iDb, 3) + Xsqlite3VdbeChangeP5(tls, v, uint16(*(*U8)(unsafe.Pointer(bp + 72 /* &aCreateTbl[0] */ + uintptr(i))))) } } @@ -134467,9 +134975,9 @@ var aTable = [3]struct { FzName uintptr FzCols uintptr }{ - {FzName: ts + 11419 /* "sqlite_stat1" */, FzCols: ts + 11432 /* "tbl,idx,stat" */}, - {FzName: ts + 11445 /* "sqlite_stat4" */, FzCols: ts + 11458 /* "tbl,idx,neq,nlt,..." */}, - {FzName: ts + 11486 /* "sqlite_stat3" */}, + {FzName: ts + 11434 /* "sqlite_stat1" */, FzCols: ts + 11447 /* "tbl,idx,stat" */}, + {FzName: ts + 11460 /* "sqlite_stat4" */, FzCols: ts + 11473 /* "tbl,idx,neq,nlt,..." */}, + {FzName: ts + 11501 /* "sqlite_stat3" */}, } /* sqlite3.c:109773:5 */ // Recommended number of samples for sqlite_stat4 @@ -134700,7 +135208,7 @@ var statInitFuncdef = FuncDef{ FnArg: int8(4), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11499 /* "stat_init" */} /* sqlite3.c:110084:22 */ + FzName: ts + 11514 /* "stat_init" */} /* sqlite3.c:110084:22 */ // pNew and pOld are both candidate non-periodic samples selected for // the same column (pNew->iCol==pOld->iCol). Ignoring this column and @@ -135018,7 +135526,7 @@ var statPushFuncdef = FuncDef{ FnArg: (int8(2 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11509 /* "stat_push" */} /* sqlite3.c:110374:22 */ + FzName: ts + 11524 /* "stat_push" */} /* sqlite3.c:110374:22 */ // Implementation of the stat_get(P,J) SQL function. This routine is // used to query statistical information that has been gathered into @@ -135038,8 +135546,8 @@ var statPushFuncdef = FuncDef{ // a one-parameter function, stat_get(P), that always returns the // stat1 table entry information. func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:110411:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(24) + defer tls.Free(24) var p uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv))) // STAT4 has a parameter on this routine. @@ -135075,7 +135583,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli return } - Xsqlite3_snprintf(tls, 24, zRet, ts+11519, /* "%llu" */ + Xsqlite3_snprintf(tls, 24, zRet, ts+11534, /* "%llu" */ libc.VaList(bp, func() uint64 { if (*StatAccum)(unsafe.Pointer(p)).FnSkipAhead != 0 { return U64((*StatAccum)(unsafe.Pointer(p)).FnEst) @@ -135086,7 +135594,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnKeyCol; i++ { var nDistinct U64 = (U64(*(*TRowcnt)(unsafe.Pointer((*StatAccum)(unsafe.Pointer(p)).Fcurrent.FanDLt + uintptr(i)*4)) + TRowcnt(1))) var iVal U64 = (((U64((*StatAccum)(unsafe.Pointer(p)).FnRow) + nDistinct) - uint64(1)) / nDistinct) - Xsqlite3_snprintf(tls, 24, z, ts+11524 /* " %llu" */, libc.VaList(bp+16, iVal)) + Xsqlite3_snprintf(tls, 24, z, ts+11539 /* " %llu" */, libc.VaList(bp+8, iVal)) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -135135,7 +135643,7 @@ func statGet(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli var i int32 var z uintptr = zRet for i = 0; i < (*StatAccum)(unsafe.Pointer(p)).FnCol; i++ { - Xsqlite3_snprintf(tls, 24, z, ts+11530 /* "%llu " */, libc.VaList(bp+32, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) + Xsqlite3_snprintf(tls, 24, z, ts+11545 /* "%llu " */, libc.VaList(bp+16, U64(*(*TRowcnt)(unsafe.Pointer(aCnt + uintptr(i)*4))))) z += uintptr(Xsqlite3Strlen30(tls, z)) } @@ -135152,7 +135660,7 @@ var statGetFuncdef = FuncDef{ FnArg: (int8(1 + IsStat4)), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 11536 /* "stat_get" */} /* sqlite3.c:110526:22 */ + FzName: ts + 11551 /* "stat_get" */} /* sqlite3.c:110526:22 */ func callStatGet(tls *libc.TLS, pParse uintptr, regStat int32, iParam int32, regOut int32) { /* sqlite3.c:110538:13: */ Xsqlite3VdbeAddOp2(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Integer, iParam, (regStat + 1)) @@ -135199,7 +135707,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Do not gather statistics on views or virtual tables return } - if Xsqlite3_strlike(tls, ts+11545 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { + if Xsqlite3_strlike(tls, ts+11560 /* "sqlite\\_%" */, (*Table)(unsafe.Pointer(pTab)).FzName, uint32('\\')) == 0 { // Do not gather statistics on system tables return } @@ -135217,7 +135725,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp return } (*Table)(unsafe.Pointer(pStat1)).FzName = (pStat1 + 1*120) - libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+11419 /* "sqlite_stat1" */, uint64(13)) + libc.Xmemcpy(tls, (*Table)(unsafe.Pointer(pStat1)).FzName, ts+11434 /* "sqlite_stat1" */, uint64(13)) (*Table)(unsafe.Pointer(pStat1)).FnCol = int16(3) (*Table)(unsafe.Pointer(pStat1)).FiPKey = int16(-1) Xsqlite3VdbeAddOp4(tls, (*Parse)(unsafe.Pointer(pParse)).FpVdbe, OP_Noop, 0, 0, 0, pStat1, -17) @@ -135450,7 +135958,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp // Add the entry to the stat1 table. callStatGet(tls, pParse, regStat, STAT_GET_STAT1, regStat1) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+11555 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+11570 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP4(tls, v, -1, pStat1, -6) @@ -135512,7 +136020,7 @@ func analyzeOneTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintp jZeroRows = Xsqlite3VdbeAddOp1(tls, v, OP_IfNot, regStat1) Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regIdxname) - Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+11555 /* "BBB" */, 0) + Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regTabname, 3, regTemp, ts+11570 /* "BBB" */, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, iStatCur, regNewRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, iStatCur, regTemp, regNewRowid) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_APPEND)) @@ -135565,9 +136073,9 @@ func analyzeTable(tls *libc.TLS, pParse uintptr, pTab uintptr, pOnlyIdx uintptr) iStatCur = (*Parse)(unsafe.Pointer(pParse)).FnTab *(*int32)(unsafe.Pointer(pParse + 52 /* &.nTab */)) += (3) if pOnlyIdx != 0 { - openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+11559 /* "idx" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Index)(unsafe.Pointer(pOnlyIdx)).FzName, ts+11574 /* "idx" */) } else { - openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+11563 /* "tbl" */) + openStatTable(tls, pParse, iDb, iStatCur, (*Table)(unsafe.Pointer(pTab)).FzName, ts+11578 /* "tbl" */) } analyzeOneTable(tls, pParse, pTab, pOnlyIdx, iStatCur, ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1), (*Parse)(unsafe.Pointer(pParse)).FnTab) loadAnalysis(tls, pParse, iDb) @@ -135662,7 +136170,7 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, var v TRowcnt if z == uintptr(0) { - z = ts + 740 /* "" */ + z = ts + 755 /* "" */ } for i = 0; (*(*int8)(unsafe.Pointer(z)) != 0) && (i < nOut); i++ { v = TRowcnt(0) @@ -135684,15 +136192,15 @@ func decodeIntArray(tls *libc.TLS, zIntArray uintptr, nOut int32, aOut uintptr, libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(0), 2, 0x4) libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(0), 6, 0x40) for *(*int8)(unsafe.Pointer(z)) != 0 { - if Xsqlite3_strglob(tls, ts+11567 /* "unordered*" */, z) == 0 { + if Xsqlite3_strglob(tls, ts+11582 /* "unordered*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.bUnordered */, uint32(1), 2, 0x4) - } else if Xsqlite3_strglob(tls, ts+11578 /* "sz=[0-9]*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+11593 /* "sz=[0-9]*" */, z) == 0 { var sz int32 = Xsqlite3Atoi(tls, (z + uintptr(3))) if sz < 2 { sz = 2 } (*Index)(unsafe.Pointer(pIndex)).FszIdxRow = Xsqlite3LogEst(tls, uint64(sz)) - } else if Xsqlite3_strglob(tls, ts+11588 /* "noskipscan*" */, z) == 0 { + } else if Xsqlite3_strglob(tls, ts+11603 /* "noskipscan*" */, z) == 0 { libc.SetBitFieldPtr16Uint32(pIndex+100 /* &.noSkipScan */, uint32(1), 6, 0x40) } for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') { @@ -135873,11 +136381,11 @@ func findIndexOrPrimaryKey(tls *libc.TLS, db uintptr, zName uintptr, zDb uintptr // // where %Q is replaced with the database name before the SQL is executed. func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb uintptr) int32 { /* sqlite3.c:111317:12: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var rc int32 // Result codes from subroutines - *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) = uintptr(0) // An SQL statement being run + *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0) // An SQL statement being run var zSql uintptr // Text of the SQL statement var pPrevIdx uintptr = uintptr(0) // Previous index in the loop var pSample uintptr // A slot in pIdx->aSample[] @@ -135886,13 +136394,13 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui if !(zSql != 0) { return SQLITE_NOMEM } - rc = Xsqlite3_prepare(tls, db, zSql, -1, bp+32 /* &pStmt */, uintptr(0)) + rc = Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0)) Xsqlite3DbFree(tls, db, zSql) if rc != 0 { return rc } - for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) == SQLITE_ROW { + for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) == SQLITE_ROW { var nIdxCol int32 = 1 // Number of columns in stat4 records var zIndex uintptr // Index name @@ -135902,11 +136410,11 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui var i int32 // Bytes of space required var pSpace uintptr - zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 0) + zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) if zIndex == uintptr(0) { continue } - nSample = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 1) + nSample = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) pIdx = findIndexOrPrimaryKey(tls, db, zIndex, zDb) if pIdx == uintptr(0) { @@ -135925,7 +136433,7 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui (*Index)(unsafe.Pointer(pIdx)).FaSample = Xsqlite3DbMallocZero(tls, db, uint64(nByte)) if (*Index)(unsafe.Pointer(pIdx)).FaSample == uintptr(0) { - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) return SQLITE_NOMEM } pSpace = ((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr(nSample)*40) @@ -135942,27 +136450,27 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui } } - rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) if rc != 0 { return rc } - zSql = Xsqlite3MPrintf(tls, db, zSql2, libc.VaList(bp+16, zDb)) + zSql = Xsqlite3MPrintf(tls, db, zSql2, libc.VaList(bp+8, zDb)) if !(zSql != 0) { return SQLITE_NOMEM } - rc = Xsqlite3_prepare(tls, db, zSql, -1, bp+32 /* &pStmt */, uintptr(0)) + rc = Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0)) Xsqlite3DbFree(tls, db, zSql) if rc != 0 { return rc } - for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) == SQLITE_ROW { + for Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) == SQLITE_ROW { var zIndex uintptr // Index name var pIdx uintptr // Pointer to the index object var nCol int32 = 1 // Number of columns in index - zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 0) + zIndex = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) if zIndex == uintptr(0) { continue } @@ -135978,9 +136486,9 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui pPrevIdx = pIdx } pSample = ((*Index)(unsafe.Pointer(pIdx)).FaSample + uintptr((*Index)(unsafe.Pointer(pIdx)).FnSample)*40) - decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 1), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanEq, uintptr(0), uintptr(0)) - decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 2), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanLt, uintptr(0), uintptr(0)) - decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 3), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanDLt, uintptr(0), uintptr(0)) + decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanEq, uintptr(0), uintptr(0)) + decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 2), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanLt, uintptr(0), uintptr(0)) + decodeIntArray(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 3), nCol, (*IndexSample)(unsafe.Pointer(pSample)).FanDLt, uintptr(0), uintptr(0)) // Take a copy of the sample. Add two 0x00 bytes the end of the buffer. // This is in case the sample record is corrupted. In that case, the @@ -135988,18 +136496,18 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui // end of the allocated buffer before it realizes it is dealing with // a corrupt record. Adding the two 0x00 bytes prevents this from causing // a buffer overread. - (*IndexSample)(unsafe.Pointer(pSample)).Fn = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 4) + (*IndexSample)(unsafe.Pointer(pSample)).Fn = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 4) (*IndexSample)(unsafe.Pointer(pSample)).Fp = Xsqlite3DbMallocZero(tls, db, (uint64((*IndexSample)(unsafe.Pointer(pSample)).Fn + 2))) if (*IndexSample)(unsafe.Pointer(pSample)).Fp == uintptr(0) { - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) return SQLITE_NOMEM } if (*IndexSample)(unsafe.Pointer(pSample)).Fn != 0 { - libc.Xmemcpy(tls, (*IndexSample)(unsafe.Pointer(pSample)).Fp, Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 4), uint64((*IndexSample)(unsafe.Pointer(pSample)).Fn)) + libc.Xmemcpy(tls, (*IndexSample)(unsafe.Pointer(pSample)).Fp, Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 4), uint64((*IndexSample)(unsafe.Pointer(pSample)).Fn)) } (*Index)(unsafe.Pointer(pIdx)).FnSample++ } - rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) if rc == SQLITE_OK { initAvgEq(tls, pPrevIdx) } @@ -136011,10 +136519,10 @@ func loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb ui func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:111438:12: */ var rc int32 = SQLITE_OK // Result codes from subroutines - if Xsqlite3FindTable(tls, db, ts+11445 /* "sqlite_stat4" */, zDb) != 0 { + if Xsqlite3FindTable(tls, db, ts+11460 /* "sqlite_stat4" */, zDb) != 0 { rc = loadStatTbl(tls, db, - ts+11600, /* "SELECT idx,count..." */ - ts+11654, /* "SELECT idx,neq,n..." */ + ts+11615, /* "SELECT idx,count..." */ + ts+11669, /* "SELECT idx,neq,n..." */ zDb) } return rc @@ -136039,10 +136547,10 @@ func loadStat4(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* sqlite3.c:1114 // This means if the caller does not care about other errors, the return // code may be ignored. func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlite3.c:111473:20: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) - // var sInfo AnalysisInfo at bp+16, 16 + // var sInfo AnalysisInfo at bp+8, 16 var i uintptr var zSql uintptr @@ -136063,17 +136571,17 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit } // Load new statistics out of the sqlite_stat1 table - (*AnalysisInfo)(unsafe.Pointer(bp + 16 /* &sInfo */)).Fdb = db - (*AnalysisInfo)(unsafe.Pointer(bp + 16 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName - if Xsqlite3FindTable(tls, db, ts+11419 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+16 /* &sInfo */)).FzDatabase) != uintptr(0) { + (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).Fdb = db + (*AnalysisInfo)(unsafe.Pointer(bp + 8 /* &sInfo */)).FzDatabase = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName + if Xsqlite3FindTable(tls, db, ts+11434 /* "sqlite_stat1" */, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) != uintptr(0) { zSql = Xsqlite3MPrintf(tls, db, - ts+11706 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+16 /* &sInfo */)).FzDatabase)) + ts+11721 /* "SELECT tbl,idx,s..." */, libc.VaList(bp, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 - }{analysisLoader})), bp+16 /* &sInfo */, uintptr(0)) + }{analysisLoader})), bp+8 /* &sInfo */, uintptr(0)) Xsqlite3DbFree(tls, db, zSql) } } @@ -136091,7 +136599,7 @@ func Xsqlite3AnalysisLoad(tls *libc.TLS, db uintptr, iDb int32) int32 { /* sqlit if rc == SQLITE_OK { (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) - rc = loadStat4(tls, db, (*AnalysisInfo)(unsafe.Pointer(bp+16 /* &sInfo */)).FzDatabase) + rc = loadStat4(tls, db, (*AnalysisInfo)(unsafe.Pointer(bp+8 /* &sInfo */)).FzDatabase) (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable-- (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = func() uint16 { if (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable != 0 { @@ -136159,7 +136667,7 @@ func resolveAttachExpr(tls *libc.TLS, pName uintptr, pExpr uintptr) int32 { /* s // database iDb attached to handle db. func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int32 { /* sqlite3.c:111595:20: */ return (libc.Bool32((Xsqlite3StrICmp(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName) == 0) || - ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+6805 /* "main" */, zName) == 0)))) + ((iDb == 0) && (Xsqlite3StrICmp(tls, ts+6820 /* "main" */, zName) == 0)))) } // An SQL user-function registered to do the work of an ATTACH statement. The @@ -136176,33 +136684,33 @@ func Xsqlite3DbIsNamed(tls *libc.TLS, db uintptr, iDb int32, zName uintptr) int3 // new database, close the database on db->init.iDb and reopen it as an // empty MemDB. func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:111617:13: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(64) + defer tls.Free(64) var i int32 var rc int32 var db uintptr var zName uintptr var zFile uintptr - // var zPath uintptr at bp+64, 8 + // var zPath uintptr at bp+40, 8 - // var zErr uintptr at bp+72, 8 + // var zErr uintptr at bp+48, 8 - // var flags uint32 at bp+48, 4 + // var flags uint32 at bp+24, 4 var aNew uintptr // New array of Db pointers var pNew uintptr // Db object for the newly attached database - // var zErrDyn uintptr at bp+80, 8 + // var zErrDyn uintptr at bp+56, 8 - // var pVfs uintptr at bp+56, 8 + // var pVfs uintptr at bp+32, 8 var pPager uintptr var iDb int32 rc = 0 db = Xsqlite3_context_db_handle(tls, context) - *(*uintptr)(unsafe.Pointer(bp + 64 /* zPath */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 72 /* zErr */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 40 /* zPath */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = uintptr(0) _ = NotUsed zFile = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) @@ -136210,13 +136718,13 @@ func attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zFile == uintptr(0)) { goto __1 } - zFile = ts + 740 /* "" */ + zFile = ts + 755 /* "" */ __1: ; if !(zName == uintptr(0)) { goto __2 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __2: ; @@ -136226,8 +136734,8 @@ __2: // This is not a real ATTACH. Instead, this routine is being called // from sqlite3_deserialize() to close database db->init.iDb and // reopen it as a MemDB - *(*uintptr)(unsafe.Pointer(bp + 56 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+4309 /* "memdb" */) - if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* pVfs */)) == uintptr(0)) { + *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) = Xsqlite3_vfs_find(tls, ts+4324 /* "memdb" */) + if !(*(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)) == uintptr(0)) { goto __5 } return @@ -136242,7 +136750,7 @@ __6: ; (*Db)(unsafe.Pointer(pNew)).FpBt = uintptr(0) (*Db)(unsafe.Pointer(pNew)).FpSchema = uintptr(0) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pVfs */)), ts+11747 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), ts+11762 /* "x\x00" */, db, (pNew + 8 /* &.pBt */), 0, SQLITE_OPEN_MAIN_DB) goto __4 __3: // This is a real ATTACH @@ -136255,7 +136763,7 @@ __3: if !((*Sqlite3)(unsafe.Pointer(db)).FnDb >= (*(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)) + 2)) { goto __7 } - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11750, /* "too many attache..." */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11765, /* "too many attache..." */ libc.VaList(bp, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 7*4)))) goto attach_error __7: @@ -136269,7 +136777,7 @@ __8: if !(Xsqlite3DbIsNamed(tls, db, i, zName) != 0) { goto __11 } - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11787 /* "database %s is a..." */, libc.VaList(bp+16, zName)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11802 /* "database %s is a..." */, libc.VaList(bp+8, zName)) goto attach_error __11: ; @@ -136312,8 +136820,8 @@ __13: // Open the database file. If the btree is successfully opened, use // it to obtain the database schema. At this point the schema may // or may not be initialized. - *(*uint32)(unsafe.Pointer(bp + 48 /* flags */)) = (*Sqlite3)(unsafe.Pointer(db)).FopenFlags - rc = Xsqlite3ParseUri(tls, (*Sqlite3_vfs)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpVfs)).FzName, zFile, bp+48 /* &flags */, bp+56 /* &pVfs */, bp+64 /* &zPath */, bp+72 /* &zErr */) + *(*uint32)(unsafe.Pointer(bp + 24 /* flags */)) = (*Sqlite3)(unsafe.Pointer(db)).FopenFlags + rc = Xsqlite3ParseUri(tls, (*Sqlite3_vfs)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FpVfs)).FzName, zFile, bp+24 /* &flags */, bp+32 /* &pVfs */, bp+40 /* &zPath */, bp+48 /* &zErr */) if !(rc != SQLITE_OK) { goto __16 } @@ -136323,14 +136831,14 @@ __13: Xsqlite3OomFault(tls, db) __17: ; - Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 72 /* zErr */)), -1) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* zErr */))) + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)), -1) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */))) return __16: ; - *(*uint32)(unsafe.Pointer(bp + 48 /* flags */)) |= uint32(SQLITE_OPEN_MAIN_DB) - rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pVfs */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zPath */)), db, (pNew + 8 /* &.pBt */), 0, int32(*(*uint32)(unsafe.Pointer(bp + 48 /* flags */)))) + *(*uint32)(unsafe.Pointer(bp + 24 /* flags */)) |= uint32(SQLITE_OPEN_MAIN_DB) + rc = Xsqlite3BtreeOpen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVfs */)), *(*uintptr)(unsafe.Pointer(bp + 40 /* zPath */)), db, (pNew + 8 /* &.pBt */), 0, int32(*(*uint32)(unsafe.Pointer(bp + 24 /* flags */)))) (*Sqlite3)(unsafe.Pointer(db)).FnDb++ (*Db)(unsafe.Pointer(pNew)).FzDbSName = Xsqlite3DbStrDup(tls, db, zName) __4: @@ -136340,7 +136848,7 @@ __4: goto __18 } rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11817 /* "database is alre..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11832 /* "database is alre..." */, 0) goto __19 __18: if !(rc == SQLITE_OK) { @@ -136356,8 +136864,8 @@ __21: if !(((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pNew)).FpSchema)).Ffile_format != 0) && (int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pNew)).FpSchema)).Fenc) != (int32((*Sqlite3)(unsafe.Pointer(db)).Fenc)))) { goto __23 } - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, - ts+11846 /* "attached databas..." */, 0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, + ts+11861 /* "attached databas..." */, 0) rc = SQLITE_ERROR __23: ; @@ -136382,7 +136890,7 @@ __19: rc = SQLITE_NOMEM __24: ; - Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zPath */))) + Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* zPath */))) // If the file was opened successfully, read the schema for the new database. // If this fails, or if opening the file failed, then close the file and @@ -136397,7 +136905,7 @@ __24: if !(!((int32(*(*uint8)(unsafe.Pointer(db + 184 /* &.init */ + 8 /* &.reopenMemdb */)) & 0x4 >> 2)) != 0)) { goto __26 } - rc = Xsqlite3Init(tls, db, bp+80 /* &zErrDyn */) + rc = Xsqlite3Init(tls, db, bp+56 /* &zErrDyn */) __26: ; Xsqlite3BtreeLeaveAll(tls, db) @@ -136426,14 +136934,14 @@ __29: goto __30 } Xsqlite3OomFault(tls, db) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */))) - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+6528 /* "out of memory" */, 0) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+6543 /* "out of memory" */, 0) goto __31 __30: - if !(*(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) == uintptr(0)) { + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) == uintptr(0)) { goto __32 } - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11914 /* "unable to open d..." */, libc.VaList(bp+32, zFile)) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) = Xsqlite3MPrintf(tls, db, ts+11929 /* "unable to open d..." */, libc.VaList(bp+16, zFile)) __32: ; __31: @@ -136448,11 +136956,11 @@ __27: attach_error: // Return an error if we get here - if !(*(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)) != 0) { + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)) != 0) { goto __33 } - Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */)), -1) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 80 /* zErrDyn */))) + Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */)), -1) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrDyn */))) __33: ; if !(rc != 0) { @@ -136469,15 +136977,15 @@ __34: // // SELECT sqlite_detach(x) func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { /* sqlite3.c:111810:13: */ - bp := tls.Alloc(176) - defer tls.Free(176) + bp := tls.Alloc(152) + defer tls.Free(152) var zName uintptr var db uintptr var i int32 var pDb uintptr var pEntry uintptr - // var zErr [128]int8 at bp+48, 128 + // var zErr [128]int8 at bp+24, 128 var pTrig uintptr zName = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) @@ -136489,7 +136997,7 @@ func detachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / if !(zName == uintptr(0)) { goto __1 } - zName = ts + 740 /* "" */ + zName = ts + 755 /* "" */ __1: ; i = 0 @@ -136521,14 +137029,14 @@ __4: if !(i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb) { goto __7 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+48 /* &zErr[0] */, ts+11942 /* "no such database..." */, libc.VaList(bp, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11957 /* "no such database..." */, libc.VaList(bp, zName)) goto detach_error __7: ; if !(i < 2) { goto __8 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+48 /* &zErr[0] */, ts+11963 /* "cannot detach da..." */, libc.VaList(bp+16, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+11978 /* "cannot detach da..." */, libc.VaList(bp+8, zName)) goto detach_error __8: ; @@ -136536,7 +137044,7 @@ __8: (Xsqlite3BtreeIsInBackup(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) != 0)) { goto __9 } - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+48 /* &zErr[0] */, ts+11989 /* "database %s is l..." */, libc.VaList(bp+32, zName)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([128]int8{})), bp+24 /* &zErr[0] */, ts+12004 /* "database %s is l..." */, libc.VaList(bp+16, zName)) goto detach_error __9: ; @@ -136568,7 +137076,7 @@ __11: return detach_error: - Xsqlite3_result_error(tls, context, bp+48 /* &zErr[0] */, -1) + Xsqlite3_result_error(tls, context, bp+24 /* &zErr[0] */, -1) } // This procedure generates VDBE code for a single invocation of either the @@ -136659,7 +137167,7 @@ var detach_func = FuncDef{ FnArg: int8(1), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 12011 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ + FzName: ts + 12026 /* "sqlite_detach" */} /* sqlite3.c:111944:24 */ // Called by the parser to compile an ATTACH statement. // @@ -136672,12 +137180,12 @@ var attach_func = FuncDef{ FnArg: int8(3), // nArg FfuncFlags: U32(SQLITE_UTF8), // pNext FxSFunc: 0, // xValue, xInverse - FzName: ts + 12025 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ + FzName: ts + 12040 /* "sqlite_attach" */} /* sqlite3.c:111964:24 */ // Expression callback used by sqlite3FixAAAA() routines. func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111982:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pFix uintptr = *(*uintptr)(unsafe.Pointer(p + 40 /* &.u */)) if !(int32((*DbFixer)(unsafe.Pointer(pFix)).FbTemp) != 0) { @@ -136687,7 +137195,7 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 if (*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer((*DbFixer)(unsafe.Pointer(pFix)).FpParse)).Fdb)).Finit.Fbusy != 0 { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_NULL) } else { - Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+12039 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) + Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, ts+12054 /* "%s cannot use va..." */, libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType)) return WRC_Abort } } @@ -136696,8 +137204,8 @@ func fixExprCb(tls *libc.TLS, p uintptr, pExpr uintptr) int32 { /* sqlite3.c:111 // Select callback used by sqlite3FixAAAA() routines. func fixSelectCb(tls *libc.TLS, p uintptr, pSelect uintptr) int32 { /* sqlite3.c:111999:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var pFix uintptr = *(*uintptr)(unsafe.Pointer(p + 40 /* &.u */)) var i int32 @@ -136720,7 +137228,7 @@ __1: if (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase != 0 { if iDb != Xsqlite3FindDbName(tls, db, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase) { Xsqlite3ErrorMsg(tls, (*DbFixer)(unsafe.Pointer(pFix)).FpParse, - ts+12063, /* "%s %T cannot ref..." */ + ts+12078, /* "%s %T cannot ref..." */ libc.VaList(bp, (*DbFixer)(unsafe.Pointer(pFix)).FzType, (*DbFixer)(unsafe.Pointer(pFix)).FpName, (*SrcItem)(unsafe.Pointer(pItem)).FzDatabase)) return WRC_Abort } @@ -136919,7 +137427,7 @@ func Xsqlite3_set_authorizer(tls *libc.TLS, db uintptr, xAuth uintptr, pArg uint // Write an error message into pParse->zErrMsg that explains that the // user-supplied authorization function returned an illegal value. func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:112233:13: */ - Xsqlite3ErrorMsg(tls, pParse, ts+12109 /* "authorizer malfu..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12124 /* "authorizer malfu..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR } @@ -136931,8 +137439,8 @@ func sqliteAuthBadReturnCode(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:11223 // to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE // is treated as SQLITE_DENY. In this case an error is left in pParse. func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintptr, iDb int32) int32 { /* sqlite3.c:112247:20: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(40) + defer tls.Free(40) var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database handle var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName // Schema name of attached database @@ -136943,11 +137451,11 @@ func Xsqlite3AuthReadCol(tls *libc.TLS, pParse uintptr, zTab uintptr, zCol uintp } rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, SQLITE_READ, zTab, zCol, zDb, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - var z uintptr = Xsqlite3_mprintf(tls, ts+12132 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) + var z uintptr = Xsqlite3_mprintf(tls, ts+12147 /* "%s.%s" */, libc.VaList(bp, zTab, zCol)) if ((*Sqlite3)(unsafe.Pointer(db)).FnDb > 2) || (iDb != 0) { - z = Xsqlite3_mprintf(tls, ts+12138 /* "%s.%z" */, libc.VaList(bp+24, zDb, z)) + z = Xsqlite3_mprintf(tls, ts+12153 /* "%s.%z" */, libc.VaList(bp+16, zDb, z)) } - Xsqlite3ErrorMsg(tls, pParse, ts+12144 /* "access to %z is ..." */, libc.VaList(bp+48, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+12159 /* "access to %z is ..." */, libc.VaList(bp+32, z)) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_IGNORE) && (rc != SQLITE_OK) { sqliteAuthBadReturnCode(tls, pParse) @@ -136999,7 +137507,7 @@ func Xsqlite3AuthRead(tls *libc.TLS, pParse uintptr, pExpr uintptr, pSchema uint zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName } else { - zCol = ts + 8035 /* "ROWID" */ + zCol = ts + 8050 /* "ROWID" */ } if SQLITE_IGNORE == Xsqlite3AuthReadCol(tls, pParse, (*Table)(unsafe.Pointer(pTab)).FzName, zCol, iDb) { @@ -137031,7 +137539,7 @@ func Xsqlite3AuthCheck(tls *libc.TLS, pParse uintptr, code int32, zArg1 uintptr, rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((db + 496 /* &.xAuth */))))(tls, (*Sqlite3)(unsafe.Pointer(db)).FpAuthArg, code, zArg1, zArg2, zArg3, (*Parse)(unsafe.Pointer(pParse)).FzAuthContext) if rc == SQLITE_DENY { - Xsqlite3ErrorMsg(tls, pParse, ts+12171 /* "not authorized" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12186 /* "not authorized" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_AUTH } else if (rc != SQLITE_OK) && (rc != SQLITE_IGNORE) { rc = SQLITE_DENY @@ -137341,25 +137849,25 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp if i >= (*Sqlite3)(unsafe.Pointer(db)).FnDb { // No match against the official names. But always match "main" // to schema 0 as a legacy fallback. - if Xsqlite3StrICmp(tls, zDatabase, ts+6805 /* "main" */) == 0 { + if Xsqlite3StrICmp(tls, zDatabase, ts+6820 /* "main" */) == 0 { i = 0 } else { return uintptr(0) } } p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), zName) - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+8428 /* "sqlite_" */, 7) == 0) { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+8443 /* "sqlite_" */, 7) == 0) { if i == 1 { - if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12186 /* "sqlite_temp_sche..." */ +7)) == 0) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12205 /* "sqlite_schema" */ +7)) == 0)) || - (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+6303 /* "sqlite_master" */ +7)) == 0) { + if ((Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12201 /* "sqlite_temp_sche..." */ +7)) == 0) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12220 /* "sqlite_schema" */ +7)) == 0)) || + (Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+6318 /* "sqlite_master" */ +7)) == 0) { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+12219 /* "sqlite_temp_mast..." */) + ts+12234 /* "sqlite_temp_mast..." */) } } else { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12205 /* "sqlite_schema" */ +7)) == 0 { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12220 /* "sqlite_schema" */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i)*32)).FpSchema + 8 /* &.tblHash */), - ts+6303 /* "sqlite_master" */) + ts+6318 /* "sqlite_master" */) } } } @@ -137382,12 +137890,12 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp break } } - if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+8428 /* "sqlite_" */, 7) == 0) { - if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12205 /* "sqlite_schema" */ +7)) == 0 { - p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+6303 /* "sqlite_master" */) - } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12186 /* "sqlite_temp_sche..." */ +7)) == 0 { + if (p == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+8443 /* "sqlite_" */, 7) == 0) { + if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12220 /* "sqlite_schema" */ +7)) == 0 { + p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FpSchema + 8 /* &.tblHash */), ts+6318 /* "sqlite_master" */) + } else if Xsqlite3StrICmp(tls, (zName+uintptr(7)), (ts+12201 /* "sqlite_temp_sche..." */ +7)) == 0 { p = Xsqlite3HashFind(tls, ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 8 /* &.tblHash */), - ts+12219 /* "sqlite_temp_mast..." */) + ts+12234 /* "sqlite_temp_mast..." */) } } } @@ -137403,8 +137911,8 @@ func Xsqlite3FindTable(tls *libc.TLS, db uintptr, zName uintptr, zDatabase uintp // routine leaves an error message in pParse->zErrMsg where // sqlite3FindTable() does not. func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr, zDbase uintptr) uintptr { /* sqlite3.c:112841:22: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(40) + defer tls.Free(40) var p uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb @@ -137423,7 +137931,7 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr // can be an eponymous virtual table. if (int32((*Parse)(unsafe.Pointer(pParse)).FdisableVtab) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { var pMod uintptr = Xsqlite3HashFind(tls, (db + 536 /* &.aModule */), zName) - if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+12238 /* "pragma_" */, 7) == 0) { + if (pMod == uintptr(0)) && (Xsqlite3_strnicmp(tls, zName, ts+12253 /* "pragma_" */, 7) == 0) { pMod = Xsqlite3PragmaVtabRegister(tls, db, zName) } if (pMod != 0) && (Xsqlite3VtabEponymousTableInit(tls, pParse, pMod) != 0) { @@ -137441,14 +137949,14 @@ func Xsqlite3LocateTable(tls *libc.TLS, pParse uintptr, flags U32, zName uintptr if p == uintptr(0) { var zMsg uintptr if (flags & U32(LOCATE_VIEW)) != 0 { - zMsg = ts + 12246 /* "no such view" */ + zMsg = ts + 12261 /* "no such view" */ } else { - zMsg = ts + 12259 /* "no such table" */ + zMsg = ts + 12274 /* "no such table" */ } if zDbase != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+6998 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7013 /* "%s: %s.%s" */, libc.VaList(bp, zMsg, zDbase, zName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+7008 /* "%s: %s" */, libc.VaList(bp+32, zMsg, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+7023 /* "%s: %s" */, libc.VaList(bp+24, zMsg, zName)) } } else { @@ -137761,7 +138269,7 @@ func Xsqlite3NameFromToken(tls *libc.TLS, db uintptr, pName uintptr) uintptr { / // writing. The table is opened using cursor 0. func Xsqlite3OpenSchemaTable(tls *libc.TLS, p uintptr, iDb int32) { /* sqlite3.c:113223:21: */ var v uintptr = Xsqlite3GetVdbe(tls, p) - Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+6303 /* "sqlite_master" */) + Xsqlite3TableLock(tls, p, iDb, uint32(SCHEMA_ROOT), uint8(1), ts+6318 /* "sqlite_master" */) Xsqlite3VdbeAddOp4Int(tls, v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5) if (*Parse)(unsafe.Pointer(p)).FnTab == 0 { (*Parse)(unsafe.Pointer(p)).FnTab = 1 @@ -137788,7 +138296,7 @@ func Xsqlite3FindDbName(tls *libc.TLS, db uintptr, zName uintptr) int32 { /* sql } // "main" is always an acceptable alias for the primary database // even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME. - if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+6805 /* "main" */, zName)) { + if (i == 0) && (0 == Xsqlite3_stricmp(tls, ts+6820 /* "main" */, zName)) { goto __3 } @@ -137833,21 +138341,21 @@ func Xsqlite3FindDb(tls *libc.TLS, db uintptr, pName uintptr) int32 { /* sqlite3 // pName2) that stores the unqualified table name. The index of the // database "xxx" is returned. func Xsqlite3TwoPartName(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pUnqual uintptr) int32 { /* sqlite3.c:113283:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var iDb int32 // Database holding the object var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Token)(unsafe.Pointer(pName2)).Fn > uint32(0) { if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12273 /* "corrupt database" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12288 /* "corrupt database" */, 0) return -1 } *(*uintptr)(unsafe.Pointer(pUnqual)) = pName2 iDb = Xsqlite3FindDb(tls, db, pName1) if iDb < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12290 /* "unknown database..." */, libc.VaList(bp, pName1)) + Xsqlite3ErrorMsg(tls, pParse, ts+12305 /* "unknown database..." */, libc.VaList(bp, pName1)) return -1 } } else { @@ -137874,8 +138382,8 @@ func Xsqlite3WritableSchema(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:1133 // make sure the "type", "name", and "tbl_name" columns are consistent // with the SQL. func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType uintptr, zTblName uintptr) int32 { /* sqlite3.c:113338:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((Xsqlite3WritableSchema(tls, db) != 0) || @@ -137888,13 +138396,13 @@ func Xsqlite3CheckObjectName(tls *libc.TLS, pParse uintptr, zName uintptr, zType if ((Xsqlite3_stricmp(tls, zType, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit))) != 0) || (Xsqlite3_stricmp(tls, zName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 1*8))) != 0)) || (Xsqlite3_stricmp(tls, zTblName, *(*uintptr)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).Finit.FazInit + 2*8))) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) // corruptSchema() will supply the error + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) // corruptSchema() will supply the error return SQLITE_ERROR } } else { - if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+8428 /* "sqlite_" */, 7))) || + if ((int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) && (0 == Xsqlite3_strnicmp(tls, zName, ts+8443 /* "sqlite_" */, 7))) || ((Xsqlite3ReadOnlyShadowTables(tls, db) != 0) && (Xsqlite3ShadowTableName(tls, db, zName) != 0)) { - Xsqlite3ErrorMsg(tls, pParse, ts+12310, /* "object name rese..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12325, /* "object name rese..." */ libc.VaList(bp, zName)) return SQLITE_ERROR } @@ -138036,15 +138544,15 @@ func sqlite3ForceNotReadOnly(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:11348 // At the end of the CREATE TABLE statement, the sqlite3EndTable() routine // is called to complete the construction of the new table record. func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, isTemp int32, isView int32, isVirtual int32, noErr int32) { /* sqlite3.c:113507:21: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var pTable uintptr var zName uintptr // The name of the new table var db uintptr var v uintptr var iDb int32 // Database number to create the table in - // var pName uintptr at bp+32, 8 + // var pName uintptr at bp+16, 8 var zDb uintptr var zDb1 uintptr @@ -138063,15 +138571,15 @@ func Xsqlite3StartTable(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 ui iDb = int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) zName = Xsqlite3DbStrDup(tls, db, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }()) - *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)) = pName1 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)) = pName1 goto __2 __1: // The common case - iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+32 /* &pName */) + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+16 /* &pName */) if !(iDb < 0) { goto __3 } @@ -138083,7 +138591,7 @@ __3: } // If creating a temp table, the name may not be qualified. Unless // the database name is "temp" anyway. - Xsqlite3ErrorMsg(tls, pParse, ts+12352 /* "temporary table ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12367 /* "temporary table ..." */, 0) return __4: ; @@ -138093,16 +138601,16 @@ __4: iDb = 1 __5: ; - zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */))) if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { goto __6 } - Xsqlite3RenameTokenMap(tls, pParse, zName, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + Xsqlite3RenameTokenMap(tls, pParse, zName, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */))) __6: ; __2: ; - (*Parse)(unsafe.Pointer(pParse)).FsNameToken = *(*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + (*Parse)(unsafe.Pointer(pParse)).FsNameToken = *(*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) if !(zName == uintptr(0)) { goto __7 } @@ -138111,9 +138619,9 @@ __7: ; if !(Xsqlite3CheckObjectName(tls, pParse, zName, func() uintptr { if isView != 0 { - return ts + 10555 /* "view" */ + return ts + 10570 /* "view" */ } - return ts + 9170 /* "table" */ + return ts + 9185 /* "table" */ }(), zName) != 0) { goto __8 } @@ -138130,9 +138638,9 @@ __9: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (isTemp == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __10 } @@ -138170,7 +138678,7 @@ __13: if !(!(noErr != 0)) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+12393 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+12408 /* "table %T already..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* pName */)))) goto __16 __15: ; @@ -138184,7 +138692,7 @@ __14: if !(Xsqlite3FindIndex(tls, db, zName, zDb1) != uintptr(0)) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+12417 /* "there is already..." */, libc.VaList(bp+16, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12432 /* "there is already..." */, libc.VaList(bp+8, zName)) goto begin_table_error __17: ; @@ -138300,7 +138808,7 @@ var nullRow = [6]int8{int8(6), int8(0), int8(0), int8(0), int8(0), int8(0)} /* s func sqlite3DeleteReturning(tls *libc.TLS, db uintptr, pRet uintptr) { /* sqlite3.c:113716:13: */ var pHash uintptr pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - Xsqlite3HashInsert(tls, pHash, ts+12452 /* "sqlite_returning" */, uintptr(0)) + Xsqlite3HashInsert(tls, pHash, ts+12467 /* "sqlite_returning" */, uintptr(0)) Xsqlite3ExprListDelete(tls, db, (*Returning)(unsafe.Pointer(pRet)).FpReturnEL) Xsqlite3DbFree(tls, db, pRet) } @@ -138324,7 +138832,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql var pHash uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Parse)(unsafe.Pointer(pParse)).FpNewTrigger != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12469 /* "cannot use RETUR..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12484 /* "cannot use RETUR..." */, 0) } else { } @@ -138345,7 +138853,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { return } - (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 12452 /* "sqlite_returning" */ + (*Returning)(unsafe.Pointer(pRet)).FretTrig.FzName = ts + 12467 /* "sqlite_returning" */ (*Returning)(unsafe.Pointer(pRet)).FretTrig.Fop = U8(TK_RETURNING) (*Returning)(unsafe.Pointer(pRet)).FretTrig.Ftr_tm = U8(TRIGGER_AFTER) (*Returning)(unsafe.Pointer(pRet)).FretTrig.FbReturning = U8(1) @@ -138357,7 +138865,7 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql (*Returning)(unsafe.Pointer(pRet)).FretTStep.FpExprList = pList pHash = ((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema + 56 /* &.trigHash */) - if Xsqlite3HashInsert(tls, pHash, ts+12452 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == + if Xsqlite3HashInsert(tls, pHash, ts+12467 /* "sqlite_returning" */, (pRet+16 /* &.retTrig */)) == (pRet + 16 /* &.retTrig */) { Xsqlite3OomFault(tls, db) } @@ -138370,8 +138878,8 @@ func Xsqlite3AddReturning(tls *libc.TLS, pParse uintptr, pList uintptr) { /* sql // first to get things going. Then this routine is called for each // column. func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintptr) { /* sqlite3.c:113788:21: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) var p uintptr var i int32 @@ -138385,7 +138893,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp return } if (int32((*Table)(unsafe.Pointer(p)).FnCol) + 1) > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+12503 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12518 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } z = Xsqlite3DbMallocRaw(tls, db, (uint64(((*Token)(unsafe.Pointer(pName)).Fn + (*Token)(unsafe.Pointer(pType)).Fn) + uint32(2)))) @@ -138401,7 +138909,7 @@ func Xsqlite3AddColumn(tls *libc.TLS, pParse uintptr, pName uintptr, pType uintp hName = Xsqlite3StrIHash(tls, z) for i = 0; i < int32((*Table)(unsafe.Pointer(p)).FnCol); i++ { if (int32((*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FhName) == int32(hName)) && (Xsqlite3StrICmp(tls, z, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(i)*32)).FzName) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+12526 /* "duplicate column..." */, libc.VaList(bp+16, z)) + Xsqlite3ErrorMsg(tls, pParse, ts+12541 /* "duplicate column..." */, libc.VaList(bp+8, z)) Xsqlite3DbFree(tls, db, z) return } @@ -138564,8 +139072,8 @@ func Xsqlite3AffinityType(tls *libc.TLS, zIn uintptr, pCol uintptr) int8 { /* sq // This routine is called by the parser while in the middle of // parsing a CREATE TABLE statement. func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStart uintptr, zEnd uintptr) { /* sqlite3.c:113984:21: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(80) + defer tls.Free(80) var p uintptr var pCol uintptr @@ -138575,24 +139083,24 @@ func Xsqlite3AddDefaultValue(tls *libc.TLS, pParse uintptr, pExpr uintptr, zStar var isInit int32 = (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb) != 1))) pCol = ((*Table)(unsafe.Pointer(p)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(p)).FnCol)-1))*32) if !(Xsqlite3ExprIsConstantOrFunction(tls, pExpr, uint8(isInit)) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+12552, /* "default value of..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12567, /* "default value of..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) } else if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+12597 /* "cannot use DEFAU..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12612 /* "cannot use DEFAU..." */, 0) } else { // A copy of pExpr is used instead of the original, as pExpr contains // tokens that point to volatile memory. - // var x Expr at bp+16, 72 + // var x Expr at bp+8, 72 Xsqlite3ExprDelete(tls, db, (*Column)(unsafe.Pointer(pCol)).FpDflt) - libc.Xmemset(tls, bp+16 /* &x */, 0, uint64(unsafe.Sizeof(Expr{}))) - (*Expr)(unsafe.Pointer(bp + 16 /* &x */)).Fop = U8(TK_SPAN) - *(*uintptr)(unsafe.Pointer(bp + 16 /* &x */ + 8 /* &.u */)) = Xsqlite3DbSpanDup(tls, db, zStart, zEnd) - (*Expr)(unsafe.Pointer(bp + 16 /* &x */)).FpLeft = pExpr - (*Expr)(unsafe.Pointer(bp + 16 /* &x */)).Fflags = U32(EP_Skip) - (*Column)(unsafe.Pointer(pCol)).FpDflt = Xsqlite3ExprDup(tls, db, bp+16 /* &x */, EXPRDUP_REDUCE) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* &x */ + 8 /* &.u */))) + libc.Xmemset(tls, bp+8 /* &x */, 0, uint64(unsafe.Sizeof(Expr{}))) + (*Expr)(unsafe.Pointer(bp + 8 /* &x */)).Fop = U8(TK_SPAN) + *(*uintptr)(unsafe.Pointer(bp + 8 /* &x */ + 8 /* &.u */)) = Xsqlite3DbSpanDup(tls, db, zStart, zEnd) + (*Expr)(unsafe.Pointer(bp + 8 /* &x */)).FpLeft = pExpr + (*Expr)(unsafe.Pointer(bp + 8 /* &x */)).Fflags = U32(EP_Skip) + (*Column)(unsafe.Pointer(pCol)).FpDflt = Xsqlite3ExprDup(tls, db, bp+8 /* &x */, EXPRDUP_REDUCE) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* &x */ + 8 /* &.u */))) } } if int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME { @@ -138629,7 +139137,7 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_GENERATED) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+12638 /* "generated column..." */, 0) + ts+12653 /* "generated column..." */, 0) } } @@ -138650,8 +139158,8 @@ func makeColumnPartOfPrimaryKey(tls *libc.TLS, pParse uintptr, pCol uintptr) { / // If the key is not an INTEGER PRIMARY KEY, then create a unique // index for the key. No index is created for INTEGER PRIMARY KEYs. func Xsqlite3AddPrimaryKey(tls *libc.TLS, pParse uintptr, pList uintptr, onError int32, autoInc int32, sortOrder int32) { /* sqlite3.c:114084:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pTab uintptr var pCol uintptr @@ -138674,7 +139182,7 @@ __1: goto __2 } Xsqlite3ErrorMsg(tls, pParse, - ts+12690 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+12705 /* "table \"%s\" has m..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto primary_key_exit __2: ; @@ -138734,7 +139242,7 @@ __4: ; if !((((nTerm == 1) && (pCol != 0)) && - (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), ts+12731 /* "INTEGER" */) == 0)) && + (Xsqlite3StrICmp(tls, Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), ts+12746 /* "INTEGER" */) == 0)) && (sortOrder != SQLITE_SO_DESC)) { goto __13 } @@ -138762,7 +139270,7 @@ __13: goto __17 } Xsqlite3ErrorMsg(tls, pParse, - ts+12739 /* "AUTOINCREMENT is..." */, 0) + ts+12754 /* "AUTOINCREMENT is..." */, 0) goto __18 __17: Xsqlite3CreateIndex(tls, pParse, uintptr(0), uintptr(0), uintptr(0), pList, onError, uintptr(0), @@ -138847,8 +139355,8 @@ func Xsqlite3AddCollateType(tls *libc.TLS, pParse uintptr, pToken uintptr) { /* // Change the most recently parsed column to be a GENERATED ALWAYS AS // column. func Xsqlite3AddGenerated(tls *libc.TLS, pParse uintptr, pExpr uintptr, pType uintptr) { /* sqlite3.c:114228:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var eType U8 var pTab uintptr @@ -138866,7 +139374,7 @@ __1: if !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) == PARSE_MODE_DECLARE_VTAB) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+12795 /* "virtual tables c..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+12810 /* "virtual tables c..." */, 0) goto generated_done __2: ; @@ -138879,13 +139387,13 @@ __3: if !(pType != 0) { goto __4 } - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+12838 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(7)) && (Xsqlite3_strnicmp(tls, ts+12853 /* "virtual" */, (*Token)(unsafe.Pointer(pType)).Fz, 7) == 0)) { goto __5 } // no-op goto __6 __5: - if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+12846 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { + if !(((*Token)(unsafe.Pointer(pType)).Fn == uint32(6)) && (Xsqlite3_strnicmp(tls, ts+12861 /* "stored" */, (*Token)(unsafe.Pointer(pType)).Fz, 6) == 0)) { goto __7 } eType = U8(COLFLAG_STORED) @@ -138918,7 +139426,7 @@ __10: goto generated_done generated_error: - Xsqlite3ErrorMsg(tls, pParse, ts+12853, /* "error in generat..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+12868, /* "error in generat..." */ libc.VaList(bp, (*Column)(unsafe.Pointer(pCol)).FzName)) generated_done: Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pExpr) @@ -139027,11 +139535,11 @@ func identPut(tls *libc.TLS, z uintptr, pIdx uintptr, zSignedIdent uintptr) { /* // table. Memory to hold the text of the statement is obtained // from sqliteMalloc() and must be freed by the calling function. func createTableStmt(tls *libc.TLS, db uintptr, p uintptr) uintptr { /* sqlite3.c:114361:13: */ - bp := tls.Alloc(20) - defer tls.Free(20) + bp := tls.Alloc(12) + defer tls.Free(12) var i int32 - // var k int32 at bp+16, 4 + // var k int32 at bp+8, 4 var n int32 var zStmt uintptr @@ -139060,13 +139568,13 @@ __3: ; n = n + (identLength(tls, (*Table)(unsafe.Pointer(p)).FzName)) if n < 50 { - zSep = ts + 740 /* "" */ - zSep2 = ts + 12884 /* "," */ - zEnd = ts + 5413 /* ")" */ + zSep = ts + 755 /* "" */ + zSep2 = ts + 12899 /* "," */ + zEnd = ts + 5428 /* ")" */ } else { - zSep = ts + 12886 /* "\n " */ - zSep2 = ts + 12890 /* ",\n " */ - zEnd = ts + 12895 /* "\n)" */ + zSep = ts + 12901 /* "\n " */ + zSep2 = ts + 12905 /* ",\n " */ + zEnd = ts + 12910 /* "\n)" */ } n = n + (35 + (6 * int32((*Table)(unsafe.Pointer(p)).FnCol))) zStmt = Xsqlite3DbMallocRaw(tls, uintptr(0), uint64(n)) @@ -139074,10 +139582,10 @@ __3: Xsqlite3OomFault(tls, db) return uintptr(0) } - Xsqlite3_snprintf(tls, n, zStmt, ts+12898 /* "CREATE TABLE " */, 0) - *(*int32)(unsafe.Pointer(bp + 16 /* k */)) = Xsqlite3Strlen30(tls, zStmt) - identPut(tls, zStmt, bp+16 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) - *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 16 /* k */)), 1)))) = int8('(') + Xsqlite3_snprintf(tls, n, zStmt, ts+12913 /* "CREATE TABLE " */, 0) + *(*int32)(unsafe.Pointer(bp + 8 /* k */)) = Xsqlite3Strlen30(tls, zStmt) + identPut(tls, zStmt, bp+8 /* &k */, (*Table)(unsafe.Pointer(p)).FzName) + *(*int8)(unsafe.Pointer(zStmt + uintptr(libc.PostIncInt32(&*(*int32)(unsafe.Pointer(bp + 8 /* k */)), 1)))) = int8('(') pCol = (*Table)(unsafe.Pointer(p)).FaCol i = 0 __4: @@ -139088,16 +139596,16 @@ __4: var len int32 var zType uintptr - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 16 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* k */)))), zSep, 0) - *(*int32)(unsafe.Pointer(bp + 16 /* k */)) += Xsqlite3Strlen30(tls, (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* k */))))) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), zSep, 0) + *(*int32)(unsafe.Pointer(bp + 8 /* k */)) += Xsqlite3Strlen30(tls, (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */))))) zSep = zSep2 - identPut(tls, zStmt, bp+16 /* &k */, (*Column)(unsafe.Pointer(pCol)).FzName) + identPut(tls, zStmt, bp+8 /* &k */, (*Column)(unsafe.Pointer(pCol)).FzName) zType = azType1[(int32((*Column)(unsafe.Pointer(pCol)).Faffinity) - SQLITE_AFF_BLOB)] len = Xsqlite3Strlen30(tls, zType) - libc.Xmemcpy(tls, (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* k */)))), zType, uint64(len)) - *(*int32)(unsafe.Pointer(bp + 16 /* k */)) += len + libc.Xmemcpy(tls, (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), zType, uint64(len)) + *(*int32)(unsafe.Pointer(bp + 8 /* k */)) += len } goto __5 @@ -139108,16 +139616,16 @@ __5: goto __6 __6: ; - Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 16 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* k */)))), ts+3615 /* "%s" */, libc.VaList(bp, zEnd)) + Xsqlite3_snprintf(tls, (n - *(*int32)(unsafe.Pointer(bp + 8 /* k */))), (zStmt + uintptr(*(*int32)(unsafe.Pointer(bp + 8 /* k */)))), ts+3630 /* "%s" */, libc.VaList(bp, zEnd)) return zStmt } var azType1 = [5]uintptr{ - /* SQLITE_AFF_BLOB */ ts + 740, /* "" */ - /* SQLITE_AFF_TEXT */ ts + 12912, /* " TEXT" */ - /* SQLITE_AFF_NUMERIC */ ts + 12918, /* " NUM" */ - /* SQLITE_AFF_INTEGER */ ts + 12923, /* " INT" */ - /* SQLITE_AFF_REAL */ ts + 12928, /* " REAL" */ + /* SQLITE_AFF_BLOB */ ts + 755, /* "" */ + /* SQLITE_AFF_TEXT */ ts + 12927, /* " TEXT" */ + /* SQLITE_AFF_NUMERIC */ ts + 12933, /* " NUM" */ + /* SQLITE_AFF_INTEGER */ ts + 12938, /* " INT" */ + /* SQLITE_AFF_REAL */ ts + 12943, /* " REAL" */ } /* sqlite3.c:114391:23 */ // Resize an Index object to hold N columns total. Return SQLITE_OK @@ -139524,8 +140032,8 @@ func Xsqlite3ShadowTableName(tls *libc.TLS, db uintptr, zName uintptr) int32 { / // "CREATE TABLE ... AS SELECT ..." statement. The column names of // the new table will match the result set of the SELECT. func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr, tabOpts U8, pSelect uintptr) { /* sqlite3.c:114830:21: */ - bp := tls.Alloc(184) - defer tls.Free(184) + bp := tls.Alloc(144) + defer tls.Free(144) var p uintptr // The new table var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection @@ -139554,7 +140062,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // table itself. So mark it read-only. if (*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy != 0 { if pSelect != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+740 /* "" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+755 /* "" */, 0) return } (*Table)(unsafe.Pointer(p)).Ftnum = (*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum @@ -139567,11 +140075,11 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (int32(tabOpts) & TF_WithoutRowid) != 0 { if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+12934 /* "AUTOINCREMENT no..." */, 0) + ts+12949 /* "AUTOINCREMENT no..." */, 0) return } if ((*Table)(unsafe.Pointer(p)).FtabFlags & U32(TF_HasPrimaryKey)) == U32(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+12984 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12999 /* "PRIMARY KEY miss..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(p)).FzName)) return } *(*U32)(unsafe.Pointer(p + 64 /* &.tabFlags */)) |= (U32(TF_WithoutRowid | TF_NoVisibleRowid)) @@ -139615,7 +140123,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr } } if nNG == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13016 /* "must have at lea..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13031 /* "must have at lea..." */, 0) return } } @@ -139648,12 +140156,12 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // Initialize zType for the new view or table. if (*Table)(unsafe.Pointer(p)).FpSelect == uintptr(0) { // A regular table - zType = ts + 9170 /* "table" */ - zType2 = ts + 13060 /* "TABLE" */ + zType = ts + 9185 /* "table" */ + zType2 = ts + 13075 /* "TABLE" */ } else { // A view - zType = ts + 10555 /* "view" */ - zType2 = ts + 13066 /* "VIEW" */ + zType = ts + 10570 /* "view" */ + zType2 = ts + 13081 /* "VIEW" */ } // If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -139669,7 +140177,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // a schema-lock excludes all other database users, the write-lock would // be redundant. if pSelect != 0 { - // var dest SelectDest at bp+144, 40 + // var dest SelectDest at bp+104, 40 // Where the SELECT should store results var regYield int32 // Register holding co-routine entry-point var addrTop int32 // Top of the co-routine @@ -139701,16 +140209,16 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr (*Table)(unsafe.Pointer(pSelTab)).FnCol = int16(0) (*Table)(unsafe.Pointer(pSelTab)).FaCol = uintptr(0) Xsqlite3DeleteTable(tls, db, pSelTab) - Xsqlite3SelectDestInit(tls, bp+144 /* &dest */, SRT_Coroutine, regYield) - Xsqlite3Select(tls, pParse, pSelect, bp+144 /* &dest */) + Xsqlite3SelectDestInit(tls, bp+104 /* &dest */, SRT_Coroutine, regYield) + Xsqlite3Select(tls, pParse, pSelect, bp+104 /* &dest */) if (*Parse)(unsafe.Pointer(pParse)).FnErr != 0 { return } Xsqlite3VdbeEndCoroutine(tls, v, regYield) Xsqlite3VdbeJumpHere(tls, v, (addrTop - 1)) - addrInsLoop = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+144 /* &dest */)).FiSDParm) + addrInsLoop = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+104 /* &dest */)).FiSDParm) - Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (*SelectDest)(unsafe.Pointer(bp+144 /* &dest */)).FiSdst, (*SelectDest)(unsafe.Pointer(bp+144 /* &dest */)).FnSdst, regRec) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (*SelectDest)(unsafe.Pointer(bp+104 /* &dest */)).FiSdst, (*SelectDest)(unsafe.Pointer(bp+104 /* &dest */)).FnSdst, regRec) Xsqlite3TableAffinity(tls, v, p, 0) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, 1, regRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, 1, regRec, regRowid) @@ -139734,7 +140242,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr n = int32(uint32(n) + ((*Token)(unsafe.Pointer(pEnd2)).Fn)) } zStmt = Xsqlite3MPrintf(tls, db, - ts+13071 /* "CREATE %s %.*s" */, libc.VaList(bp+16, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) + ts+13086 /* "CREATE %s %.*s" */, libc.VaList(bp+8, zType2, n, (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) } // A slot for the record has already been allocated in the @@ -139742,8 +140250,8 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // the information we've collected. Xsqlite3NestedParse(tls, pParse, - ts+13086, /* "UPDATE %Q.sqlite..." */ - libc.VaList(bp+48, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, + ts+13101, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zType, (*Table)(unsafe.Pointer(p)).FzName, (*Table)(unsafe.Pointer(p)).FzName, @@ -139760,14 +140268,14 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr if (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).FpSeqTab == uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+13184, /* "CREATE TABLE %Q...." */ - libc.VaList(bp+112, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) + ts+13199, /* "CREATE TABLE %Q...." */ + libc.VaList(bp+88, (*Db)(unsafe.Pointer(pDb)).FzDbSName)) } } // Reparse everything to update our internal data structures Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+13226 /* "tbl_name='%q' AN..." */, libc.VaList(bp+128, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+13241 /* "tbl_name='%q' AN..." */, libc.VaList(bp+96, (*Table)(unsafe.Pointer(p)).FzName)), uint16(0)) } // Add the table to the in-memory representation of the database. @@ -139788,7 +140296,7 @@ func Xsqlite3EndTable(tls *libc.TLS, pParse uintptr, pCons uintptr, pEnd uintptr // then record a pointer to this table in the main database structure // so that INSERT can find the table easily. - if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+9692 /* "sqlite_sequence" */) == 0 { + if libc.Xstrcmp(tls, (*Table)(unsafe.Pointer(p)).FzName, ts+9707 /* "sqlite_sequence" */) == 0 { (*Schema)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FpSchema)).FpSeqTab = p } @@ -139825,7 +140333,7 @@ func Xsqlite3CreateView(tls *libc.TLS, pParse uintptr, pBegin uintptr, pName1 ui if !(int32((*Parse)(unsafe.Pointer(pParse)).FnVar) > 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+13260 /* "parameters are n..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13275 /* "parameters are n..." */, 0) goto create_view_fail __1: ; @@ -139847,7 +140355,7 @@ __2: Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp /* &pName */) iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(p)).FpSchema) - Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+10555 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) + Xsqlite3FixInit(tls, bp+8 /* &sFix */, pParse, iDb, ts+10570 /* "view" */, *(*uintptr)(unsafe.Pointer(bp /* pName */))) if !(Xsqlite3FixSelect(tls, bp+8 /* &sFix */, pSelect) != 0) { goto __3 } @@ -139922,8 +140430,8 @@ __10: // the columns of the view in the pTable structure. Return the number // of errors. If an error is seen leave an error message in pParse->zErrMsg. func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) int32 { /* sqlite3.c:115220:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pSelTab uintptr // A fake table from which we get the result set var pSel uintptr // Copy of the SELECT that implements the view @@ -139964,7 +140472,7 @@ func Xsqlite3ViewGetColumnNames(tls *libc.TLS, pParse uintptr, pTable uintptr) i // CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; // SELECT * FROM temp.ex1; if int32((*Table)(unsafe.Pointer(pTable)).FnCol) < 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+13296 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13311 /* "view %s is circu..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) return 1 } @@ -140100,13 +140608,13 @@ func Xsqlite3RootPageMoved(tls *libc.TLS, db uintptr, iDb int32, iFrom Pgno, iTo // if a root-page of another table is moved by the btree-layer whilst // erasing iTable (this can happen with an auto-vacuum database). func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { /* sqlite3.c:115417:13: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(32) + defer tls.Free(32) var v uintptr = Xsqlite3GetVdbe(tls, pParse) var r1 int32 = Xsqlite3GetTempReg(tls, pParse) if iTable < 2 { - Xsqlite3ErrorMsg(tls, pParse, ts+13326 /* "corrupt schema" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13341 /* "corrupt schema" */, 0) } Xsqlite3VdbeAddOp3(tls, v, OP_Destroy, iTable, r1, iDb) Xsqlite3MayAbort(tls, pParse) @@ -140120,7 +140628,7 @@ func destroyRootPage(tls *libc.TLS, pParse uintptr, iTable int32, iDb int32) { / // token for additional information. Xsqlite3NestedParse(tls, pParse, - ts+13341, /* "UPDATE %Q.sqlite..." */ + ts+13356, /* "UPDATE %Q.sqlite..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb+uintptr(iDb)*32)).FzDbSName, iTable, r1, r1)) Xsqlite3ReleaseTempReg(tls, pParse, r1) } @@ -140176,27 +140684,27 @@ func destroyTable(tls *libc.TLS, pParse uintptr, pTab uintptr) { /* sqlite3.c:11 // Remove entries from the sqlite_statN tables (for N in (1,2,3)) // after a DROP INDEX or DROP TABLE command. func sqlite3ClearStatTables(tls *libc.TLS, pParse uintptr, iDb int32, zType uintptr, zName uintptr) { /* sqlite3.c:115496:13: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(64) + defer tls.Free(64) var i int32 var zDbName uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).FaDb + uintptr(iDb)*32)).FzDbSName for i = 1; i <= 4; i++ { - // var zTab [24]int8 at bp+56, 24 + // var zTab [24]int8 at bp+40, 24 - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+56 /* &zTab[0] */, ts+13408 /* "sqlite_stat%d" */, libc.VaList(bp, i)) - if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+56 /* &zTab[0] */, zDbName) != 0 { + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([24]int8{})), bp+40 /* &zTab[0] */, ts+13423 /* "sqlite_stat%d" */, libc.VaList(bp, i)) + if Xsqlite3FindTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, bp+40 /* &zTab[0] */, zDbName) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+11371, /* "DELETE FROM %Q.%..." */ - libc.VaList(bp+16, zDbName, bp+56 /* &zTab[0] */, zType, zName)) + ts+11386, /* "DELETE FROM %Q.%..." */ + libc.VaList(bp+8, zDbName, bp+40 /* &zTab[0] */, zType, zName)) } } } // Generate code to drop a table. func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int32, isView int32) { /* sqlite3.c:115519:21: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) var v uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb @@ -140227,7 +140735,7 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // move as a result of the drop (can happen in auto-vacuum mode). if ((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != 0 { Xsqlite3NestedParse(tls, pParse, - ts+13422, /* "DELETE FROM %Q.s..." */ + ts+13437, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) } @@ -140239,8 +140747,8 @@ func Xsqlite3CodeDropTable(tls *libc.TLS, pParse uintptr, pTab uintptr, iDb int3 // database. Xsqlite3NestedParse(tls, pParse, - ts+13467, /* "DELETE FROM %Q.s..." */ - libc.VaList(bp+24, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+13482, /* "DELETE FROM %Q.s..." */ + libc.VaList(bp+16, (*Db)(unsafe.Pointer(pDb)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName)) if !(isView != 0) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { destroyTable(tls, pParse, pTab) } @@ -140269,11 +140777,11 @@ func Xsqlite3ReadOnlyShadowTables(tls *libc.TLS, db uintptr) int32 { /* sqlite3. // Return true if it is not allowed to drop the given table func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sqlite3.c:115607:12: */ - if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8428 /* "sqlite_" */, 7) == 0 { - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+13534 /* "stat" */, 4) == 0 { + if Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8443 /* "sqlite_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+13549 /* "stat" */, 4) == 0 { return 0 } - if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+7497 /* "parameters" */, 10) == 0 { + if Xsqlite3_strnicmp(tls, ((*Table)(unsafe.Pointer(pTab)).FzName+uintptr(7)), ts+7512 /* "parameters" */, 10) == 0 { return 0 } return 1 @@ -140287,8 +140795,8 @@ func tableMayNotBeDropped(tls *libc.TLS, db uintptr, pTab uintptr) int32 { /* sq // This routine is called to do the work of a DROP TABLE statement. // pName is the name of the table to be dropped. func Xsqlite3DropTable(tls *libc.TLS, pParse uintptr, pName uintptr, isView int32, noErr int32) { /* sqlite3.c:115623:21: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(24) + defer tls.Free(24) var pTab uintptr var v uintptr @@ -140354,9 +140862,9 @@ __7: zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }() zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zArg2 = uintptr(0) @@ -140416,7 +140924,7 @@ __18: if !(tableMayNotBeDropped(tls, db, pTab) != 0) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+13539 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13554 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __19: ; @@ -140426,14 +140934,14 @@ __19: if !((isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect == uintptr(0))) { goto __20 } - Xsqlite3ErrorMsg(tls, pParse, ts+13567 /* "use DROP TABLE t..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13582 /* "use DROP TABLE t..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __20: ; if !(!(isView != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0)) { goto __21 } - Xsqlite3ErrorMsg(tls, pParse, ts+13601 /* "use DROP VIEW to..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13616 /* "use DROP VIEW to..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_drop_table __21: ; @@ -140448,7 +140956,7 @@ __21: if !(!(isView != 0)) { goto __23 } - sqlite3ClearStatTables(tls, pParse, iDb, ts+11563 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) + sqlite3ClearStatTables(tls, pParse, iDb, ts+11578 /* "tbl" */, (*Table)(unsafe.Pointer(pTab)).FzName) Xsqlite3FkDropTable(tls, pParse, pName, pTab) __23: ; @@ -140475,8 +140983,8 @@ exit_drop_table: // The foreign key is set for IMMEDIATE processing. A subsequent call // to sqlite3DeferForeignKey() might change this to DEFERRED. func Xsqlite3CreateForeignKey(tls *libc.TLS, pParse uintptr, pFromCol uintptr, pTo uintptr, pToCol uintptr, flags int32) { /* sqlite3.c:115743:21: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var db uintptr var pFKey uintptr @@ -140513,7 +141021,7 @@ __4: goto __5 } Xsqlite3ErrorMsg(tls, pParse, - ts+13633, /* "foreign key on %..." */ + ts+13648, /* "foreign key on %..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(p)).FaCol+uintptr(iCol)*32)).FzName, pTo)) goto fk_end __5: @@ -140526,7 +141034,7 @@ __2: } Xsqlite3ErrorMsg(tls, pParse, - ts+13696 /* "number of column..." */, 0) + ts+13711 /* "number of column..." */, 0) goto fk_end goto __7 __6: @@ -140610,8 +141118,8 @@ __21: goto __23 } Xsqlite3ErrorMsg(tls, pParse, - ts+13790, /* "unknown column \"..." */ - libc.VaList(bp+24, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) + ts+13805, /* "unknown column \"..." */ + libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pFromCol+8 /* &.a */)+uintptr(i)*32)).FzEName)) goto fk_end __23: ; @@ -140852,20 +141360,20 @@ func Xsqlite3AllocateIndexObject(tls *libc.TLS, db uintptr, nCol I16, nExtra int // an explicit "NULLS FIRST" or "NULLS LAST" clause, leave an error in // pParse and return non-zero. Otherwise, return zero. func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int32 { /* sqlite3.c:116033:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) if pList != 0 { var i int32 for i = 0; i < (*ExprList)(unsafe.Pointer(pList)).FnExpr; i++ { if (uint32(int32(*(*uint8)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32 + 20 /* &.bNulls */)) & 0x20 >> 5))) != 0 { var sf U8 = (*ExprList_item)(unsafe.Pointer((pList + 8 /* &.a */) + uintptr(i)*32)).FsortFlags - Xsqlite3ErrorMsg(tls, pParse, ts+13836, /* "unsupported use ..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+13851, /* "unsupported use ..." */ libc.VaList(bp, func() uintptr { if (int32(sf) == 0) || (int32(sf) == 3) { - return ts + 13864 /* "FIRST" */ + return ts + 13879 /* "FIRST" */ } - return ts + 13870 /* "LAST" */ + return ts + 13885 /* "LAST" */ }())) return 1 } @@ -140885,8 +141393,8 @@ func Xsqlite3HasExplicitNulls(tls *libc.TLS, pParse uintptr, pList uintptr) int3 // is a primary key or unique-constraint on the most recent column added // to the table currently under construction. func Xsqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, pTblName uintptr, pList uintptr, onError int32, pStart uintptr, pPIWhere uintptr, sortOrder int32, ifNotExist int32, idxType U8) { /* sqlite3.c:116061:21: */ - bp := tls.Alloc(328) - defer tls.Free(328) + bp := tls.Alloc(256) + defer tls.Free(256) var pTab uintptr // Table to be indexed var pIndex uintptr // The index to be created @@ -140894,24 +141402,24 @@ func Xsqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u var nName int32 // Number of characters in zName var i int32 var j int32 - // var sFix DbFixer at bp+208, 96 + // var sFix DbFixer at bp+136, 96 // For assigning database names to pTable var sortOrderMask int32 // 1 to honor DESC in index. 0 to ignore. var db uintptr var pDb uintptr // The specific table containing the indexed database var iDb int32 // Index of the database that is being written - // var pName uintptr at bp+200, 8 + // var pName uintptr at bp+128, 8 // Unqualified name of the index to create var pListItem uintptr // For looping over pList var nExtra int32 // Space allocated for zExtra[] var nExtraCol int32 // Number of extra columns needed - // var zExtra uintptr at bp+320, 8 + // var zExtra uintptr at bp+248, 8 // Extra space after the Index object var pPk uintptr var n int32 var pLoop uintptr var zDb uintptr - // var prevCol Token at bp+304, 16 + // var prevCol Token at bp+232, 16 var pCol uintptr var pExpr uintptr @@ -140960,9 +141468,9 @@ func Xsqlite3CreateIndex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 u pIndex = uintptr(0) zName = uintptr(0) db = (*Parse)(unsafe.Pointer(pParse)).Fdb - *(*uintptr)(unsafe.Pointer(bp + 200 /* pName */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)) = uintptr(0) nExtra = 0 - *(*uintptr)(unsafe.Pointer(bp + 320 /* zExtra */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) = uintptr(0) pPk = uintptr(0) // PRIMARY KEY index for WITHOUT ROWID tables if !(((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) || ((*Parse)(unsafe.Pointer(pParse)).FnErr > 0)) { @@ -140999,7 +141507,7 @@ __4: // to search for the table. 'Fix' the table name to this db // before looking up the table. - iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+200 /* &pName */) + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+128 /* &pName */) if !(iDb < 0) { goto __7 } @@ -141023,8 +141531,8 @@ __9: __8: ; - Xsqlite3FixInit(tls, bp+208 /* &sFix */, pParse, iDb, ts+13875 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 200 /* pName */))) - if !(Xsqlite3FixSrcList(tls, bp+208 /* &sFix */, pTblName) != 0) { + Xsqlite3FixInit(tls, bp+136 /* &sFix */, pParse, iDb, ts+13890 /* "index" */, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) + if !(Xsqlite3FixSrcList(tls, bp+136 /* &sFix */, pTblName) != 0) { goto __10 } // Because the parser constructs pTblName from a single identifier, @@ -141044,7 +141552,7 @@ __11: goto __12 } Xsqlite3ErrorMsg(tls, pParse, - ts+13881, /* "cannot create a ..." */ + ts+13896, /* "cannot create a ..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __12: @@ -141071,26 +141579,26 @@ __6: ; pDb = ((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32) - if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8428 /* "sqlite_" */, 7) == 0) && + if !(((Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8443 /* "sqlite_" */, 7) == 0) && (int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0)) && (pTblName != uintptr(0))) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+13931 /* "table %s may not..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+13946 /* "table %s may not..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) goto exit_create_index __15: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+13959 /* "views may not be..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13974 /* "views may not be..." */, 0) goto exit_create_index __16: ; if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __17 } - Xsqlite3ErrorMsg(tls, pParse, ts+13984 /* "virtual tables m..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+13999 /* "virtual tables m..." */, 0) goto exit_create_index __17: ; @@ -141106,10 +141614,10 @@ __17: // If pName==0 it means that we are // dealing with a primary key or UNIQUE constraint. We have to invent our // own name. - if !(*(*uintptr)(unsafe.Pointer(bp + 200 /* pName */)) != 0) { + if !(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)) != 0) { goto __18 } - zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* pName */))) + zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 128 /* pName */))) if !(zName == uintptr(0)) { goto __20 } @@ -141117,7 +141625,7 @@ __17: __20: ; - if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+13875 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { + if !(SQLITE_OK != Xsqlite3CheckObjectName(tls, pParse, zName, ts+13890 /* "index" */, (*Table)(unsafe.Pointer(pTab)).FzName)) { goto __21 } goto exit_create_index @@ -141132,7 +141640,7 @@ __21: if !(Xsqlite3FindTable(tls, db, zName, uintptr(0)) != uintptr(0)) { goto __24 } - Xsqlite3ErrorMsg(tls, pParse, ts+14018 /* "there is already..." */, libc.VaList(bp+32, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+14033 /* "there is already..." */, libc.VaList(bp+16, zName)) goto exit_create_index __24: ; @@ -141144,7 +141652,7 @@ __23: if !(!(ifNotExist != 0)) { goto __26 } - Xsqlite3ErrorMsg(tls, pParse, ts+14052 /* "index %s already..." */, libc.VaList(bp+48, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+14067 /* "index %s already..." */, libc.VaList(bp+24, zName)) goto __27 __26: ; @@ -141173,7 +141681,7 @@ __29: goto __30 __30: ; - zName = Xsqlite3MPrintf(tls, db, ts+14076 /* "sqlite_autoindex..." */, libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName, n)) + zName = Xsqlite3MPrintf(tls, db, ts+14091 /* "sqlite_autoindex..." */, libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName, n)) if !(zName == uintptr(0)) { goto __31 } @@ -141202,9 +141710,9 @@ __19: zDb = (*Db)(unsafe.Pointer(pDb)).FzDbSName if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __34 } @@ -141235,9 +141743,9 @@ __33: } pCol = ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr((int32((*Table)(unsafe.Pointer(pTab)).FnCol)-1))*32) *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_UNIQUE)) - Xsqlite3TokenInit(tls, bp+304 /* &prevCol */, (*Column)(unsafe.Pointer(pCol)).FzName) + Xsqlite3TokenInit(tls, bp+232 /* &prevCol */, (*Column)(unsafe.Pointer(pCol)).FzName) pList = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3ExprAlloc(tls, db, TK_ID, bp+304 /* &prevCol */, 0)) + Xsqlite3ExprAlloc(tls, db, TK_ID, bp+232 /* &prevCol */, 0)) if !(pList == uintptr(0)) { goto __39 } @@ -141248,7 +141756,7 @@ __39: Xsqlite3ExprListSetSortOrder(tls, pList, sortOrder, -1) goto __38 __37: - Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+13875 /* "index" */) + Xsqlite3ExprListCheckLength(tls, pParse, pList, ts+13890 /* "index" */) if !((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) { goto __40 } @@ -141290,7 +141798,7 @@ __43: } pIndex = Xsqlite3AllocateIndexObject(tls, db, (int16((*ExprList)(unsafe.Pointer(pList)).FnExpr + nExtraCol)), - ((nName + nExtra) + 1), bp+320 /* &zExtra */) + ((nName + nExtra) + 1), bp+248 /* &zExtra */) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { goto __45 } @@ -141298,8 +141806,8 @@ __43: __45: ; - (*Index)(unsafe.Pointer(pIndex)).FzName = *(*uintptr)(unsafe.Pointer(bp + 320 /* zExtra */)) - *(*uintptr)(unsafe.Pointer(bp + 320 /* zExtra */)) += (uintptr(nName + 1)) + (*Index)(unsafe.Pointer(pIndex)).FzName = *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) + *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) += (uintptr(nName + 1)) libc.Xmemcpy(tls, (*Index)(unsafe.Pointer(pIndex)).FzName, zName, (uint64(nName + 1))) (*Index)(unsafe.Pointer(pIndex)).FpTable = pTab (*Index)(unsafe.Pointer(pIndex)).FonError = U8(onError) @@ -141365,7 +141873,7 @@ __53: goto __56 } Xsqlite3ErrorMsg(tls, pParse, - ts+14099 /* "expressions proh..." */, 0) + ts+14114 /* "expressions proh..." */, 0) goto exit_create_index __56: ; @@ -141413,9 +141921,9 @@ __55: zColl = *(*uintptr)(unsafe.Pointer((*ExprList_item)(unsafe.Pointer(pListItem)).FpExpr + 8 /* &.u */)) nColl = (Xsqlite3Strlen30(tls, zColl) + 1) - libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 320 /* zExtra */)), zColl, uint64(nColl)) - zColl = *(*uintptr)(unsafe.Pointer(bp + 320 /* zExtra */)) - *(*uintptr)(unsafe.Pointer(bp + 320 /* zExtra */)) += uintptr(nColl) + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)), zColl, uint64(nColl)) + zColl = *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) + *(*uintptr)(unsafe.Pointer(bp + 248 /* zExtra */)) += uintptr(nColl) nExtra = nExtra - (nColl) goto __63 __62: @@ -141594,7 +142102,7 @@ __88: goto __93 } Xsqlite3ErrorMsg(tls, pParse, - ts+14160 /* "conflicting ON C..." */, libc.VaList(bp+88, 0)) + ts+14175 /* "conflicting ON C..." */, libc.VaList(bp+48, 0)) __93: ; if !(int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Default) { @@ -141650,7 +142158,7 @@ __81: if !(Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { goto __101 } - Xsqlite3ErrorMsg(tls, pParse, ts+14202 /* "invalid rootpage" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14217 /* "invalid rootpage" */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = Xsqlite3CorruptError(tls, 116514) goto exit_create_index __101: @@ -141700,21 +142208,21 @@ __104: if !(pStart != 0) { goto __105 } - n1 = (int32(uint32((int32((int64((*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fz) - int64((*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pName */)))).Fz)) / 1))) + (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fn)) - if !(int32(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pName */)))).Fz + uintptr((n1 - 1))))) == ';') { + n1 = (int32(uint32((int32((int64((*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fz) - int64((*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) / 1))) + (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fn)) + if !(int32(*(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz + uintptr((n1 - 1))))) == ';') { goto __107 } n1-- __107: ; // A named index with an explicit CREATE INDEX statement - zStmt = Xsqlite3MPrintf(tls, db, ts+14219, /* "CREATE%s INDEX %..." */ - libc.VaList(bp+104, func() uintptr { + zStmt = Xsqlite3MPrintf(tls, db, ts+14234, /* "CREATE%s INDEX %..." */ + libc.VaList(bp+56, func() uintptr { if onError == OE_None { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 14239 /* " UNIQUE" */ - }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 200 /* pName */)))).Fz)) + return ts + 14254 /* " UNIQUE" */ + }(), n1, (*Token)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 128 /* pName */)))).Fz)) goto __106 __105: // An automatic index created by a PRIMARY KEY or UNIQUE constraint @@ -141725,8 +142233,8 @@ __106: // Add an entry in sqlite_schema for this index Xsqlite3NestedParse(tls, pParse, - ts+14247, /* "INSERT INTO %Q.s..." */ - libc.VaList(bp+136, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, + ts+14262, /* "INSERT INTO %Q.s..." */ + libc.VaList(bp+80, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, iMem, @@ -141741,7 +142249,7 @@ __106: sqlite3RefillIndex(tls, pParse, pIndex, iMem) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+14306 /* "name='%q' AND ty..." */, libc.VaList(bp+184, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+14321 /* "name='%q' AND ty..." */, libc.VaList(bp+120, (*Index)(unsafe.Pointer(pIndex)).FzName)), uint16(0)) Xsqlite3VdbeAddOp2(tls, v, OP_Expire, 0, 1) __108: ; @@ -141891,8 +142399,8 @@ var aVal = [5]LogEst{int16(33), int16(32), int16(30), int16(28), int16(26)} /* s // This routine will drop an existing named index. This routine // implements the DROP INDEX statement. func Xsqlite3DropIndex(tls *libc.TLS, pParse uintptr, pName uintptr, ifExists int32) { /* sqlite3.c:116713:21: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(32) + defer tls.Free(32) var pIndex uintptr var v uintptr @@ -141925,7 +142433,7 @@ __2: if !(!(ifExists != 0)) { goto __4 } - Xsqlite3ErrorMsg(tls, pParse, ts+14333 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+14348 /* "no such index: %..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __5 __4: Xsqlite3CodeVerifyNamedSchema(tls, pParse, (*SrcItem)(unsafe.Pointer((pName + 8 /* &.a */))).FzDatabase) @@ -141940,7 +142448,7 @@ __3: goto __6 } Xsqlite3ErrorMsg(tls, pParse, - ts+14351 /* "index associated..." */, libc.VaList(bp+16, 0)) + ts+14366 /* "index associated..." */, libc.VaList(bp+8, 0)) goto exit_drop_index __6: ; @@ -141951,9 +142459,9 @@ __6: zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName zTab = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }() if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_DELETE, zTab, uintptr(0), zDb) != 0) { goto __7 @@ -141981,9 +142489,9 @@ __9: } Xsqlite3BeginWriteOperation(tls, pParse, 1, iDb) Xsqlite3NestedParse(tls, pParse, - ts+14424, /* "DELETE FROM %Q.s..." */ - libc.VaList(bp+32, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) - sqlite3ClearStatTables(tls, pParse, iDb, ts+11559 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) + ts+14439, /* "DELETE FROM %Q.s..." */ + libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Index)(unsafe.Pointer(pIndex)).FzName)) + sqlite3ClearStatTables(tls, pParse, iDb, ts+11574 /* "idx" */, (*Index)(unsafe.Pointer(pIndex)).FzName) Xsqlite3ChangeCookie(tls, pParse, iDb) destroyRootPage(tls, pParse, int32((*Index)(unsafe.Pointer(pIndex)).Ftnum), iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropIndex, iDb, 0, 0, (*Index)(unsafe.Pointer(pIndex)).FzName, 0) @@ -142120,8 +142628,8 @@ func Xsqlite3IdListIndex(tls *libc.TLS, pList uintptr, zName uintptr) int32 { /* // the original SrcList unchanged, return NULL, and leave an error message // in pParse. func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra int32, iStart int32) uintptr { /* sqlite3.c:116908:24: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var i int32 @@ -142134,7 +142642,7 @@ func Xsqlite3SrcListEnlarge(tls *libc.TLS, pParse uintptr, pSrc uintptr, nExtra var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*SrcList)(unsafe.Pointer(pSrc)).FnSrc + nExtra) >= SQLITE_MAX_SRCLIST { - Xsqlite3ErrorMsg(tls, pParse, ts+14484, /* "too many FROM cl..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14499, /* "too many FROM cl..." */ libc.VaList(bp, SQLITE_MAX_SRCLIST)) return uintptr(0) } @@ -142336,8 +142844,8 @@ __3: // Return a new SrcList which encodes is the FROM with the new // term added. func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTable uintptr, pDatabase uintptr, pAlias uintptr, pSubquery uintptr, pOn uintptr, pUsing uintptr) uintptr { /* sqlite3.c:117094:24: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pItem uintptr var db uintptr @@ -142346,12 +142854,12 @@ func Xsqlite3SrcListAppendFromTerm(tls *libc.TLS, pParse uintptr, p uintptr, pTa if !(!(p != 0) && ((pOn != 0) || (pUsing != 0))) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+14520, /* "a JOIN clause is..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+14535, /* "a JOIN clause is..." */ libc.VaList(bp, func() uintptr { if pOn != 0 { - return ts + 14556 /* "ON" */ + return ts + 14571 /* "ON" */ } - return ts + 14559 /* "USING" */ + return ts + 14574 /* "USING" */ }())) goto append_from_error __1: @@ -142479,7 +142987,7 @@ func Xsqlite3BeginTransaction(tls *libc.TLS, pParse uintptr, type1 int32) { /* s db = (*Parse)(unsafe.Pointer(pParse)).Fdb - if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+14565 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { + if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, ts+14580 /* "BEGIN" */, uintptr(0), uintptr(0)) != 0 { return } v = Xsqlite3GetVdbe(tls, pParse) @@ -142515,9 +143023,9 @@ func Xsqlite3EndTransaction(tls *libc.TLS, pParse uintptr, eType int32) { /* sql if Xsqlite3AuthCheck(tls, pParse, SQLITE_TRANSACTION, func() uintptr { if isRollback != 0 { - return ts + 14571 /* "ROLLBACK" */ + return ts + 14586 /* "ROLLBACK" */ } - return ts + 14580 /* "COMMIT" */ + return ts + 14595 /* "COMMIT" */ }(), uintptr(0), uintptr(0)) != 0 { return } @@ -142542,7 +143050,7 @@ func Xsqlite3Savepoint(tls *libc.TLS, pParse uintptr, op int32, pName uintptr) { } } -var az = [3]uintptr{ts + 14565 /* "BEGIN" */, ts + 14587 /* "RELEASE" */, ts + 14571 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ +var az = [3]uintptr{ts + 14580 /* "BEGIN" */, ts + 14602 /* "RELEASE" */, ts + 14586 /* "ROLLBACK" */} /* sqlite3.c:117293:23 */ // Make sure the TEMP database is open and available for use. Return // the number of errors. Leave any error messages in the pParse structure. @@ -142558,7 +143066,7 @@ func Xsqlite3OpenTempDatabase(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3. rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, uintptr(0), db, bp /* &pBt */, 0, flags) if rc != SQLITE_OK { Xsqlite3ErrorMsg(tls, pParse, - ts+14595 /* "unable to open a..." */, 0) + ts+14610 /* "unable to open a..." */, 0) (*Parse)(unsafe.Pointer(pParse)).Frc = rc return 1 } @@ -142689,33 +143197,33 @@ func Xsqlite3HaltConstraint(tls *libc.TLS, pParse uintptr, errCode int32, onErro // Code an OP_Halt due to UNIQUE or PRIMARY KEY constraint violation. func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx uintptr) { /* sqlite3.c:117455:21: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(40) + defer tls.Free(40) var zErr uintptr var j int32 - // var errMsg StrAccum at bp+16, 32 + // var errMsg StrAccum at bp+8, 32 var pTab uintptr = (*Index)(unsafe.Pointer(pIdx)).FpTable - Xsqlite3StrAccumInit(tls, bp+16 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, + Xsqlite3StrAccumInit(tls, bp+8 /* &errMsg */, (*Parse)(unsafe.Pointer(pParse)).Fdb, uintptr(0), 0, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */)))) if (*Index)(unsafe.Pointer(pIdx)).FaColExpr != 0 { - Xsqlite3_str_appendf(tls, bp+16 /* &errMsg */, ts+14665 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) + Xsqlite3_str_appendf(tls, bp+8 /* &errMsg */, ts+14680 /* "index '%q'" */, libc.VaList(bp, (*Index)(unsafe.Pointer(pIdx)).FzName)) } else { for j = 0; j < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol); j++ { var zCol uintptr zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(j)*2)))*32)).FzName if j != 0 { - Xsqlite3_str_append(tls, bp+16 /* &errMsg */, ts+14676 /* ", " */, 2) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+14691 /* ", " */, 2) } - Xsqlite3_str_appendall(tls, bp+16 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) - Xsqlite3_str_append(tls, bp+16 /* &errMsg */, ts+753 /* "." */, 1) - Xsqlite3_str_appendall(tls, bp+16 /* &errMsg */, zCol) + Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, (*Table)(unsafe.Pointer(pTab)).FzName) + Xsqlite3_str_append(tls, bp+8 /* &errMsg */, ts+768 /* "." */, 1) + Xsqlite3_str_appendall(tls, bp+8 /* &errMsg */, zCol) } } - zErr = Xsqlite3StrAccumFinish(tls, bp+16 /* &errMsg */) + zErr = Xsqlite3StrAccumFinish(tls, bp+8 /* &errMsg */) Xsqlite3HaltConstraint(tls, pParse, func() int32 { if (int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY { @@ -142728,17 +143236,17 @@ func Xsqlite3UniqueConstraint(tls *libc.TLS, pParse uintptr, onError int32, pIdx // Code an OP_Halt due to non-unique rowid. func Xsqlite3RowidConstraint(tls *libc.TLS, pParse uintptr, onError int32, pTab uintptr) { /* sqlite3.c:117491:21: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var zMsg uintptr var rc int32 if int32((*Table)(unsafe.Pointer(pTab)).FiPKey) >= 0 { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+12132 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+12147 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr((*Table)(unsafe.Pointer(pTab)).FiPKey)*32)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(6) << 8)) } else { - zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+14679 /* "%s.rowid" */, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) + zMsg = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+14694 /* "%s.rowid" */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) rc = (SQLITE_CONSTRAINT | (int32(10) << 8)) } Xsqlite3HaltConstraint(tls, pParse, rc, onError, zMsg, int8(-7), @@ -142881,7 +143389,7 @@ func Xsqlite3Reindex(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintp sqlite3RefillIndex(tls, pParse, pIndex, -1) return } - Xsqlite3ErrorMsg(tls, pParse, ts+14688 /* "unable to identi..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+14703 /* "unable to identi..." */, 0) } // Return a KeyInfo structure that is appropriate for the given Index. @@ -142973,8 +143481,8 @@ func Xsqlite3CteDelete(tls *libc.TLS, db uintptr, pCte uintptr) { /* sqlite3.c:1 // the WITH clause of the second argument. If the second argument is // NULL, then a new WITH argument is created. func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) uintptr { /* sqlite3.c:117742:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb var pNew uintptr @@ -142991,7 +143499,7 @@ func Xsqlite3WithAdd(tls *libc.TLS, pParse uintptr, pWith uintptr, pCte uintptr) var i int32 for i = 0; i < (*With)(unsafe.Pointer(pWith)).FnCte; i++ { if Xsqlite3StrICmp(tls, zName, (*Cte)(unsafe.Pointer((pWith+16 /* &.a */)+uintptr(i)*48)).FzName) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+14734 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+14749 /* "duplicate WITH t..." */, libc.VaList(bp, zName)) } } } @@ -143204,8 +143712,8 @@ func Xsqlite3SetTextEncoding(tls *libc.TLS, db uintptr, enc U8) { /* sqlite3.c:1 // // See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zName uintptr) uintptr { /* sqlite3.c:118005:24: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var p uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb @@ -143225,7 +143733,7 @@ func Xsqlite3GetCollSeq(tls *libc.TLS, pParse uintptr, enc U8, pColl uintptr, zN } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+14764 /* "no such collatio..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+14779 /* "no such collatio..." */, libc.VaList(bp, zName)) (*Parse)(unsafe.Pointer(pParse)).Frc = (SQLITE_ERROR | (int32(1) << 8)) } return p @@ -143587,15 +144095,15 @@ func tabIsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sqlit // writable, generate an error message and return 1. If it is // writable return 0; func Xsqlite3IsReadOnly(tls *libc.TLS, pParse uintptr, pTab uintptr, viewOk int32) int32 { /* sqlite3.c:118421:20: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) if tabIsReadOnly(tls, pParse, pTab) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+14795 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+14810 /* "table %s may not..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } if !(viewOk != 0) && ((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+14824 /* "cannot modify %s..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+14839 /* "cannot modify %s..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) return 1 } return 0 @@ -144188,7 +144696,7 @@ __60: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, memCnt, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14862 /* "rows deleted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+14877 /* "rows deleted" */, uintptr(0)) __61: ; @@ -144333,7 +144841,7 @@ func Xsqlite3GenerateRowDelete(tls *libc.TLS, pParse uintptr, pTab uintptr, pTri } return 0 }()) - if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+11419 /* "sqlite_stat1" */)) { + if (int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0) || (0 == Xsqlite3_stricmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+11434 /* "sqlite_stat1" */)) { Xsqlite3VdbeAppendP4(tls, v, pTab, -6) } if int32(eMode) != ONEPASS_OFF { @@ -144611,7 +145119,7 @@ func typeofFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { / Xsqlite3_result_text(tls, context, azType2[i], -1, uintptr(0)) } -var azType2 = [5]uintptr{ts + 6615 /* "integer" */, ts + 6610 /* "real" */, ts + 14875 /* "text" */, ts + 14880 /* "blob" */, ts + 6605 /* "null" */} /* sqlite3.c:119398:21 */ +var azType2 = [5]uintptr{ts + 6630 /* "integer" */, ts + 6625 /* "real" */, ts + 14890 /* "text" */, ts + 14895 /* "blob" */, ts + 6620 /* "null" */} /* sqlite3.c:119398:21 */ // Implementation of the length() function func lengthFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119418:13: */ @@ -144675,7 +145183,7 @@ func absFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // IMP: R-31676-45509 If X is the integer -9223372036854775808 // then abs(X) throws an integer overflow error since there is no // equivalent positive 64-bit two complement value. - Xsqlite3_result_error(tls, context, ts+14885 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+14900 /* "integer overflow" */, -1) return } iVal = -iVal @@ -144833,26 +145341,26 @@ endInstrOOM: // Implementation of the printf() function. func printfFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119577:13: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(56) + defer tls.Free(56) - // var x PrintfArguments at bp+48, 16 + // var x PrintfArguments at bp+40, 16 - // var str StrAccum at bp+16, 32 + // var str StrAccum at bp+8, 32 var zFormat uintptr var n int32 var db uintptr = Xsqlite3_context_db_handle(tls, context) if (argc >= 1) && ((libc.AssignUintptr(&zFormat, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))))) != uintptr(0)) { - (*PrintfArguments)(unsafe.Pointer(bp + 48 /* &x */)).FnArg = (argc - 1) - (*PrintfArguments)(unsafe.Pointer(bp + 48 /* &x */)).FnUsed = 0 - (*PrintfArguments)(unsafe.Pointer(bp + 48 /* &x */)).FapArg = (argv + uintptr(1)*8) - Xsqlite3StrAccumInit(tls, bp+16 /* &str */, db, uintptr(0), 0, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) - (*StrAccum)(unsafe.Pointer(bp + 16 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_SQLFUNC) - Xsqlite3_str_appendf(tls, bp+16 /* &str */, zFormat, libc.VaList(bp, bp+48 /* &x */)) - n = int32((*StrAccum)(unsafe.Pointer(bp + 16 /* &str */)).FnChar) - Xsqlite3_result_text(tls, context, Xsqlite3StrAccumFinish(tls, bp+16 /* &str */), n, + (*PrintfArguments)(unsafe.Pointer(bp + 40 /* &x */)).FnArg = (argc - 1) + (*PrintfArguments)(unsafe.Pointer(bp + 40 /* &x */)).FnUsed = 0 + (*PrintfArguments)(unsafe.Pointer(bp + 40 /* &x */)).FapArg = (argv + uintptr(1)*8) + Xsqlite3StrAccumInit(tls, bp+8 /* &str */, db, uintptr(0), 0, *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */)))) + (*StrAccum)(unsafe.Pointer(bp + 8 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_SQLFUNC) + Xsqlite3_str_appendf(tls, bp+8 /* &str */, zFormat, libc.VaList(bp, bp+40 /* &x */)) + n = int32((*StrAccum)(unsafe.Pointer(bp + 8 /* &str */)).FnChar) + Xsqlite3_result_text(tls, context, Xsqlite3StrAccumFinish(tls, bp+8 /* &str */), n, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } } @@ -144976,11 +145484,11 @@ func substrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* s // Implementation of the round() function func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:119708:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var n int32 = 0 - // var r float64 at bp+24, 8 + // var r float64 at bp+16, 8 var zBuf uintptr @@ -144999,29 +145507,29 @@ func roundFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL { return } - *(*float64)(unsafe.Pointer(bp + 24 /* r */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) + *(*float64)(unsafe.Pointer(bp + 16 /* r */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) // If Y==0 and X will fit in a 64-bit int, // handle the rounding directly, // otherwise use printf. - if (*(*float64)(unsafe.Pointer(bp + 24 /* r */)) < -4503599627370496.0) || (*(*float64)(unsafe.Pointer(bp + 24 /* r */)) > +4503599627370496.0) { + if (*(*float64)(unsafe.Pointer(bp + 16 /* r */)) < -4503599627370496.0) || (*(*float64)(unsafe.Pointer(bp + 16 /* r */)) > +4503599627370496.0) { // The value has no fractional part so there is nothing to round } else if n == 0 { - *(*float64)(unsafe.Pointer(bp + 24 /* r */)) = float64((Sqlite_int64(*(*float64)(unsafe.Pointer(bp + 24 /* r */)) + (func() float64 { - if *(*float64)(unsafe.Pointer(bp + 24 /* r */)) < float64(0) { + *(*float64)(unsafe.Pointer(bp + 16 /* r */)) = float64((Sqlite_int64(*(*float64)(unsafe.Pointer(bp + 16 /* r */)) + (func() float64 { + if *(*float64)(unsafe.Pointer(bp + 16 /* r */)) < float64(0) { return -0.5 } return +0.5 }())))) } else { - zBuf = Xsqlite3_mprintf(tls, ts+14902 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 24 /* r */)))) + zBuf = Xsqlite3_mprintf(tls, ts+14917 /* "%.*f" */, libc.VaList(bp, n, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))) if zBuf == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return } - Xsqlite3AtoF(tls, zBuf, bp+24 /* &r */, Xsqlite3Strlen30(tls, zBuf), uint8(SQLITE_UTF8)) + Xsqlite3AtoF(tls, zBuf, bp+16 /* &r */, Xsqlite3Strlen30(tls, zBuf), uint8(SQLITE_UTF8)) Xsqlite3_free(tls, zBuf) } - Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 24 /* r */))) + Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 16 /* r */))) } // Allocate nByte bytes of space using sqlite3Malloc(). If the @@ -145463,7 +145971,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql nPat = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))) if nPat > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 8*4)) { - Xsqlite3_result_error(tls, context, ts+14907 /* "LIKE or GLOB pat..." */, -1) + Xsqlite3_result_error(tls, context, ts+14922 /* "LIKE or GLOB pat..." */, -1) return } if argc == 3 { @@ -145475,7 +145983,7 @@ func likeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } if Xsqlite3Utf8CharLen(tls, *(*uintptr)(unsafe.Pointer(bp /* zEsc */)), -1) != 1 { Xsqlite3_result_error(tls, context, - ts+14940 /* "ESCAPE expressio..." */, -1) + ts+14955 /* "ESCAPE expressio..." */, -1) return } escape = Xsqlite3Utf8Read(tls, bp /* &zEsc */) @@ -145536,12 +146044,12 @@ func sourceidFunc(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintpt // sqlite3_log(). The return value is NULL. The function exists purely for // its side-effects. func errlogFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120280:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) _ = argc _ = context - Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) + Xsqlite3_log(tls, Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv))), ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))) } // Implementation of the sqlite_compileoption_used() function. @@ -145585,25 +146093,25 @@ var hexdigits = [16]int8{ // "NULL". Otherwise, the argument is enclosed in single quotes with // single-quote escapes. func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:120350:13: */ - bp := tls.Alloc(96) - defer tls.Free(96) + bp := tls.Alloc(80) + defer tls.Free(80) _ = argc switch Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) { case SQLITE_FLOAT: { var r1 float64 - // var r2 float64 at bp+88, 8 + // var r2 float64 at bp+72, 8 - // var zBuf [50]int8 at bp+32, 50 + // var zBuf [50]int8 at bp+16, 50 r1 = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+32 /* &zBuf[0] */, ts+5381 /* "%!.15g" */, libc.VaList(bp, r1)) - Xsqlite3AtoF(tls, bp+32 /* &zBuf[0] */, bp+88 /* &r2 */, 20, uint8(SQLITE_UTF8)) - if r1 != *(*float64)(unsafe.Pointer(bp + 88 /* r2 */)) { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+32 /* &zBuf[0] */, ts+14985 /* "%!.20e" */, libc.VaList(bp+16, r1)) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+5396 /* "%!.15g" */, libc.VaList(bp, r1)) + Xsqlite3AtoF(tls, bp+16 /* &zBuf[0] */, bp+72 /* &r2 */, 20, uint8(SQLITE_UTF8)) + if r1 != *(*float64)(unsafe.Pointer(bp + 72 /* r2 */)) { + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+16 /* &zBuf[0] */, ts+15000 /* "%!.20e" */, libc.VaList(bp+8, r1)) } - Xsqlite3_result_text(tls, context, bp+32 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1)) break } @@ -145675,7 +146183,7 @@ func quoteFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sq default: { - Xsqlite3_result_text(tls, context, ts+741 /* "NULL" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+756 /* "NULL" */, 4, uintptr(0)) break } @@ -145986,7 +146494,7 @@ func trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sql } var lenOne = [1]uint32{uint32(1)} /* sqlite3.c:120648:27 */ -var azOne = [1]uintptr{uintptr(ts + 10999 /* " " */)} /* sqlite3.c:120649:26 */ +var azOne = [1]uintptr{uintptr(ts + 11014 /* " " */)} /* sqlite3.c:120649:26 */ // IMP: R-25361-16150 This function is omitted from SQLite by default. It // is only available if the SQLITE_SOUNDEX compile-time option is used @@ -146007,7 +146515,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zIn = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))) if zIn == uintptr(0) { - zIn = ts + 740 /* "" */ + zIn = ts + 755 /* "" */ } for i = 0; (*(*U8)(unsafe.Pointer(zIn + uintptr(i))) != 0) && !((int32(Xsqlite3CtypeMap[*(*U8)(unsafe.Pointer(zIn + uintptr(i)))]) & 0x02) != 0); i++ { } @@ -146033,7 +146541,7 @@ func soundexFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* } else { // IMP: R-64894-50321 The string "?000" is returned if the argument // is NULL or contains no ASCII alphabetic characters. - Xsqlite3_result_text(tls, context, ts+14992 /* "?000" */, 4, uintptr(0)) + Xsqlite3_result_text(tls, context, ts+15007 /* "?000" */, 4, uintptr(0)) } } @@ -146061,7 +146569,7 @@ func loadExt(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqli // Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc // flag is set. See the sqlite3_enable_load_extension() API. if ((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_LoadExtFunc)) == uint64(0) { - Xsqlite3_result_error(tls, context, ts+12171 /* "not authorized" */, -1) + Xsqlite3_result_error(tls, context, ts+12186 /* "not authorized" */, -1) return } @@ -146149,7 +146657,7 @@ func sumFinalize(tls *libc.TLS, context uintptr) { /* sqlite3.c:120889:13: */ p = Xsqlite3_aggregate_context(tls, context, 0) if (p != 0) && ((*SumCtx)(unsafe.Pointer(p)).Fcnt > int64(0)) { if (*SumCtx)(unsafe.Pointer(p)).Foverflow != 0 { - Xsqlite3_result_error(tls, context, ts+14885 /* "integer overflow" */, -1) + Xsqlite3_result_error(tls, context, ts+14900 /* "integer overflow" */, -1) } else if (*SumCtx)(unsafe.Pointer(p)).Fapprox != 0 { Xsqlite3_result_double(tls, context, (*SumCtx)(unsafe.Pointer(p)).FrSum) } else { @@ -146303,7 +146811,7 @@ func groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { zSep = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) nSep = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) } else { - zSep = ts + 12884 /* "," */ + zSep = ts + 12899 /* "," */ nSep = 1 } if zSep != 0 { @@ -146381,7 +146889,7 @@ func groupConcatValue(tls *libc.TLS, context uintptr) { /* sqlite3.c:121112:13: // of the built-in functions above are part of the global function set. // This routine only deals with those that are not global. func Xsqlite3RegisterPerConnectionBuiltinFunctions(tls *libc.TLS, db uintptr) { /* sqlite3.c:121135:21: */ - var rc int32 = Xsqlite3_overload_function(tls, db, ts+14997 /* "MATCH" */, 2) + var rc int32 = Xsqlite3_overload_function(tls, db, ts+15012 /* "MATCH" */, 2) if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) @@ -146401,14 +146909,14 @@ func Xsqlite3RegisterLikeFunctions(tls *libc.TLS, db uintptr, caseSensitive int3 pInfo = uintptr(unsafe.Pointer(&likeInfoNorm)) flags = SQLITE_FUNC_LIKE } - Xsqlite3CreateFunc(tls, db, ts+15003 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+15018 /* "like" */, 2, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - Xsqlite3CreateFunc(tls, db, ts+15003 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { + Xsqlite3CreateFunc(tls, db, ts+15018 /* "like" */, 3, SQLITE_UTF8, pInfo, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{likeFunc})), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+15003 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) - *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+15003 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+15018 /* "like" */, 2, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) + *(*U32)(unsafe.Pointer(Xsqlite3FindFunction(tls, db, ts+15018 /* "like" */, 3, uint8(SQLITE_UTF8), uint8(0)) + 4 /* &.funcFlags */)) |= (U32(flags)) } // pExpr points to an expression which implements a function. If @@ -146513,76 +147021,76 @@ func Xsqlite3RegisterBuiltinFunctions(tls *libc.TLS) { /* sqlite3.c:121427:21: * var aBuiltinFunc = [68]FuncDef{ //**** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS **** - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 15008 /* "implies_nonnull_..." */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 15028 /* "expr_compare" */}, - {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 15041 /* "expr_implies_exp..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_implies_nonnull_row)), FxSFunc: 0, FzName: ts + 15023 /* "implies_nonnull_..." */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_compare)), FxSFunc: 0, FzName: ts + 15043 /* "expr_compare" */}, + {FnArg: int8(2), FfuncFlags: (U32(((((SQLITE_UTF8 | SQLITE_FUNC_INTERNAL) | SQLITE_FUNC_TEST) | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_expr_implies_expr)), FxSFunc: 0, FzName: ts + 15056 /* "expr_implies_exp..." */}, //**** Regular functions **** - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15059 /* "soundex" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 15067 /* "load_extension" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 15067 /* "load_extension" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15082 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15108 /* "sqlite_compileop..." */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 15133 /* "unlikely" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 15142 /* "likelihood" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 15153 /* "likely" */}, - {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 15160 /* "sqlite_offset" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 15174 /* "ltrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 15174 /* "ltrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 15180 /* "rtrim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 15180 /* "rtrim" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 15186 /* "trim" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 15186 /* "trim" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15191 /* "min" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 15191 /* "min" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 15191 /* "min" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 15195 /* "max" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 15195 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 15195 /* "max" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 15199 /* "typeof" */}, - {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 15206 /* "length" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15213 /* "instr" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15219 /* "printf" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15226 /* "unicode" */}, - {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15234 /* "char" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15239 /* "abs" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15243 /* "round" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15243 /* "round" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15249 /* "upper" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15255 /* "lower" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15261 /* "hex" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 15265 /* "ifnull" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15272 /* "random" */}, - {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15279 /* "randomblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15290 /* "nullif" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15297 /* "sqlite_version" */}, - {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15312 /* "sqlite_source_id" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15329 /* "sqlite_log" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15340 /* "quote" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15346 /* "last_insert_rowi..." */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15364 /* "changes" */}, - {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15372 /* "total_changes" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15386 /* "replace" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15394 /* "zeroblob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15403 /* "substr" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15403 /* "substr" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15410 /* "substring" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15410 /* "substring" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15420 /* "sum" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15424 /* "total" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15430 /* "avg" */}, - {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15434 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15434 /* "count" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15440 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15440 /* "group_concat" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15074 /* "soundex" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 15082 /* "load_extension" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_DIRECTONLY) | SQLITE_FUNC_UNSAFE)), FxSFunc: 0, FzName: ts + 15082 /* "load_extension" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15097 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15123 /* "sqlite_compileop..." */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 15148 /* "unlikely" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 15157 /* "likelihood" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (SQLITE_FUNC_UNLIKELY))), FpUserData: uintptr(int64(INLINEFUNC_unlikely)), FxSFunc: 0, FzName: ts + 15168 /* "likely" */}, + {FnArg: int8(1), FfuncFlags: (U32((((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_OFFSET) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 15175 /* "sqlite_offset" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 15189 /* "ltrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 15189 /* "ltrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 15195 /* "rtrim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(2)), FxSFunc: 0, FzName: ts + 15195 /* "rtrim" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 15201 /* "trim" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(3)), FxSFunc: 0, FzName: ts + 15201 /* "trim" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15206 /* "min" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 15206 /* "min" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 15206 /* "min" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FxSFunc: 0, FzName: ts + 15210 /* "max" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FpUserData: uintptr(int64(1)), FzName: ts + 15210 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (1 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_MINMAX)), FpUserData: uintptr(int64(1)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FzName: ts + 15210 /* "max" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_TYPEOF)), FxSFunc: 0, FzName: ts + 15214 /* "typeof" */}, + {FnArg: int8(1), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_LENGTH)), FxSFunc: 0, FzName: ts + 15221 /* "length" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15228 /* "instr" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15234 /* "printf" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15241 /* "unicode" */}, + {FnArg: int8(-1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15249 /* "char" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15254 /* "abs" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15258 /* "round" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15258 /* "round" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15264 /* "upper" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15270 /* "lower" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15276 /* "hex" */}, + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 15280 /* "ifnull" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15287 /* "random" */}, + {FnArg: int8(1), FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15294 /* "randomblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (1 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15305 /* "nullif" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15312 /* "sqlite_version" */}, + {FfuncFlags: (U32(SQLITE_FUNC_SLOCHNG | SQLITE_UTF8)), FxSFunc: 0, FzName: ts + 15327 /* "sqlite_source_id" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15344 /* "sqlite_log" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15355 /* "quote" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15361 /* "last_insert_rowi..." */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15379 /* "changes" */}, + {FfuncFlags: (U32(SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15387 /* "total_changes" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15401 /* "replace" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15409 /* "zeroblob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15418 /* "substr" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15418 /* "substr" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15425 /* "substring" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15425 /* "substring" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15435 /* "sum" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15439 /* "total" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15445 /* "avg" */}, + {FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | SQLITE_FUNC_COUNT)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15449 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15449 /* "count" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15455 /* "group_concat" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_UTF8 | (0 * SQLITE_FUNC_NEEDCOLL)) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: ts + 15455 /* "group_concat" */}, - {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 15453 /* "glob" */}, - {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 15003 /* "like" */}, - {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 15003 /* "like" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 15458 /* "coalesce" */}, - {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 15458 /* "coalesce" */}, - {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15467 /* "sign" */}, - {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 15458 /* "coalesce" */}, - {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 15472 /* "iif" */}} /* sqlite3.c:121438:18 */ + {FnArg: int8(2), FfuncFlags: (U32(((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE) | SQLITE_FUNC_CASE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 15468 /* "glob" */}, + {FnArg: int8(2), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 15018 /* "like" */}, + {FnArg: int8(3), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | SQLITE_FUNC_LIKE)), FpUserData: 0, FxSFunc: 0, FzName: ts + 15018 /* "like" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 15473 /* "coalesce" */}, + {FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FzName: ts + 15473 /* "coalesce" */}, + {FnArg: int8(1), FfuncFlags: (U32((SQLITE_FUNC_CONSTANT | SQLITE_UTF8) | (0 * SQLITE_FUNC_NEEDCOLL))), FxSFunc: 0, FzName: ts + 15482 /* "sign" */}, + {FnArg: int8(-1), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FxSFunc: 0, FzName: ts + 15473 /* "coalesce" */}, + {FnArg: int8(3), FfuncFlags: (U32(((SQLITE_UTF8 | SQLITE_FUNC_INLINE) | SQLITE_FUNC_CONSTANT) | (0))), FpUserData: uintptr(int64(INLINEFUNC_iif)), FxSFunc: 0, FzName: ts + 15487 /* "iif" */}} /* sqlite3.c:121438:18 */ //************* End of func.c *********************************************** //************* Begin file fkey.c ******************************************* @@ -146758,8 +147266,8 @@ var aBuiltinFunc = [68]FuncDef{ // into pParse. If an OOM error occurs, non-zero is returned and the // pParse->db->mallocFailed flag is set. func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey uintptr, ppIdx uintptr, paiCol uintptr) int32 { /* sqlite3.c:121786:20: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pIdx uintptr = uintptr(0) // Value to return via *ppIdx var aiCol uintptr = uintptr(0) // Value to return via *paiCol @@ -146868,7 +147376,7 @@ func Xsqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey if !(pIdx != 0) { if !(int32((*Parse)(unsafe.Pointer(pParse)).FdisableTriggers) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+15476, /* "foreign key mism..." */ + ts+15491, /* "foreign key mism..." */ libc.VaList(bp, (*Table)(unsafe.Pointer((*FKey)(unsafe.Pointer(pFKey)).FpFrom)).FzName, (*FKey)(unsafe.Pointer(pFKey)).FzTo)) } Xsqlite3DbFree(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, aiCol) @@ -147764,8 +148272,8 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, } for i = 0; i < (*FKey)(unsafe.Pointer(pFKey)).FnCol; i++ { - *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 6814 /* "old" */, Fn: uint32(3)} // Literal "old" token - *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 6810 /* "new" */, Fn: uint32(3)} // Literal "new" token + *(*Token)(unsafe.Pointer(bp + 48 /* tOld */)) = Token{Fz: ts + 6829 /* "old" */, Fn: uint32(3)} // Literal "old" token + *(*Token)(unsafe.Pointer(bp + 64 /* tNew */)) = Token{Fz: ts + 6825 /* "new" */, Fn: uint32(3)} // Literal "new" token // var tFromCol Token at bp+32, 16 // Name of column in child table // var tToCol Token at bp+16, 16 @@ -147853,7 +148361,7 @@ func fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr, (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fz = zFrom (*Token)(unsafe.Pointer(bp + 80 /* &tFrom */)).Fn = uint32(nFrom) - pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+5597 /* "FOREIGN KEY cons..." */) + pRaise = Xsqlite3Expr(tls, db, TK_RAISE, ts+5612 /* "FOREIGN KEY cons..." */) if pRaise != 0 { (*Expr)(unsafe.Pointer(pRaise)).FaffExpr = int8(OE_Abort) } @@ -148204,11 +148712,11 @@ func exprColumnFlagUnion(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { // back and computes the values for those columns based on the previously // computed normal columns. func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore int32, pTab uintptr) { /* sqlite3.c:123282:21: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(56) + defer tls.Free(56) var i int32 - // var w Walker at bp+16, 48 + // var w Walker at bp+8, 48 var pRedo uintptr var eProgress int32 @@ -148247,12 +148755,12 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } - *(*uintptr)(unsafe.Pointer(bp + 16 /* &w */ + 40 /* &.u */)) = pTab - (*Walker)(unsafe.Pointer(bp + 16 /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { + *(*uintptr)(unsafe.Pointer(bp + 8 /* &w */ + 40 /* &.u */)) = pTab + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FxExprCallback = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr) int32 }{exprColumnFlagUnion})) - (*Walker)(unsafe.Pointer(bp + 16 /* &w */)).FxSelectCallback = uintptr(0) - (*Walker)(unsafe.Pointer(bp + 16 /* &w */)).FxSelectCallback2 = uintptr(0) + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FxSelectCallback = uintptr(0) + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FxSelectCallback2 = uintptr(0) // On the second pass, compute the value of each NOT-AVAILABLE column. // Companion code in the TK_COLUMN case of sqlite3ExprCodeTarget() will @@ -148267,10 +148775,10 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in if (int32((*Column)(unsafe.Pointer(pCol)).FcolFlags) & COLFLAG_NOTAVAIL) != 0 { var x int32 *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) |= U16((COLFLAG_BUSY)) - (*Walker)(unsafe.Pointer(bp + 16 /* &w */)).FeCode = U16(0) - Xsqlite3WalkExpr(tls, bp+16 /* &w */, (*Column)(unsafe.Pointer(pCol)).FpDflt) + (*Walker)(unsafe.Pointer(bp + 8 /* &w */)).FeCode = U16(0) + Xsqlite3WalkExpr(tls, bp+8 /* &w */, (*Column)(unsafe.Pointer(pCol)).FpDflt) *(*U16)(unsafe.Pointer(pCol + 28 /* &.colFlags */)) &= libc.Uint16FromInt32((libc.CplInt32(COLFLAG_BUSY))) - if (int32((*Walker)(unsafe.Pointer(bp+16 /* &w */)).FeCode) & COLFLAG_NOTAVAIL) != 0 { + if (int32((*Walker)(unsafe.Pointer(bp+8 /* &w */)).FeCode) & COLFLAG_NOTAVAIL) != 0 { pRedo = pCol continue } @@ -148283,7 +148791,7 @@ func Xsqlite3ComputeGeneratedColumns(tls *libc.TLS, pParse uintptr, iRegStore in } } if pRedo != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+8291 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+8306 /* "generated column..." */, libc.VaList(bp, (*Column)(unsafe.Pointer(pRedo)).FzName)) } (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 } @@ -148578,8 +149086,8 @@ func Xsqlite3AutoincrementEnd(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:1235 // end loop // D: cleanup func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uintptr, pColumn uintptr, onError int32, pUpsert uintptr) { /* sqlite3.c:123681:21: */ - bp := tls.Alloc(228) - defer tls.Free(228) + bp := tls.Alloc(188) + defer tls.Free(188) var db uintptr // The main database structure var pTab uintptr // The table to insert into. aka TABLE @@ -148589,16 +149097,16 @@ func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin var pIdx uintptr // For looping over indices of the table var nColumn int32 // Number of columns in the data var nHidden int32 // Number of hidden columns if TABLE is virtual - // var iDataCur int32 at bp+216, 4 + // var iDataCur int32 at bp+176, 4 // VDBE cursor that is the main data repository - // var iIdxCur int32 at bp+220, 4 + // var iIdxCur int32 at bp+180, 4 // First index cursor var ipkColumn int32 // Column that is the INTEGER PRIMARY KEY var endOfLoop int32 // Label for the end of the insertion loop var srcTab int32 // Data comes from this temporary cursor if >=0 var addrInsTop int32 // Jump to label "D" var addrCont int32 // Top of insert loop. Label "C" in templates 3 and 4 - // var dest SelectDest at bp+120, 40 + // var dest SelectDest at bp+80, 40 // Destination for SELECT on rhs of INSERT var iDb int32 // Index of database holding TABLE var useTempTable U8 // Store SELECT results in intermediate table @@ -148619,7 +149127,7 @@ func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin var isView int32 // True if attempting to insert into a view var pTrigger uintptr // List of triggers on pTab, if required - // var tmask int32 at bp+112, 4 + // var tmask int32 at bp+72, 4 // Invoke the coroutine to extract information from the SELECT // and add it to a transient table srcTab. The code generated @@ -148640,7 +149148,7 @@ func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin var rc int32 // This is the case if the data for the INSERT is coming from a // single-row VALUES clause - // var sNC NameContext at bp+160, 56 + // var sNC NameContext at bp+120, 56 var nIdx int32 var pNx uintptr @@ -148651,12 +149159,12 @@ func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin var pIpk uintptr var addr11 int32 var pVTab uintptr - // var isReplace int32 at bp+224, 4 + // var isReplace int32 at bp+184, 4 // Set to true if constraints may cause a replace var bUseSeek int32 nHidden = 0 - *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)) = 0 - *(*int32)(unsafe.Pointer(bp + 220 /* iIdxCur */)) = 0 + *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)) = 0 + *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)) = 0 ipkColumn = -1 srcTab = 0 addrInsTop = 0 @@ -148676,7 +149184,7 @@ func Xsqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin goto insert_cleanup __1: ; - (*SelectDest)(unsafe.Pointer(bp + 120 /* &dest */)).FiSDParm = 0 // Suppress a harmless compiler warning + (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FiSDParm = 0 // Suppress a harmless compiler warning // If the Select object is really just a simple VALUES() list with a // single row (the common case) then keep that one row of values @@ -148713,7 +149221,7 @@ __4: // Figure out if we have any triggers and if the table being // inserted into is a view - pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_INSERT, uintptr(0), bp+112 /* &tmask */) + pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_INSERT, uintptr(0), bp+72 /* &tmask */) isView = (libc.Bool32((*Table)(unsafe.Pointer(pTab)).FpSelect != uintptr(0))) // If pTab is really a view, make sure it has been initialized. @@ -148726,7 +149234,7 @@ __5: ; // Cannot insert into a read-only table. - if !(Xsqlite3IsReadOnly(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 112 /* tmask */))) != 0) { + if !(Xsqlite3IsReadOnly(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 72 /* tmask */))) != 0) { goto __6 } goto insert_cleanup @@ -148847,7 +149355,7 @@ __23: goto __24 } Xsqlite3ErrorMsg(tls, pParse, - ts+15521, /* "cannot INSERT in..." */ + ts+15536, /* "cannot INSERT in..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto insert_cleanup __24: @@ -148872,8 +149380,8 @@ __20: bIdListInOrder = U8(0) goto __27 __26: - Xsqlite3ErrorMsg(tls, pParse, ts+15562, /* "table %S has no ..." */ - libc.VaList(bp+16, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+15577, /* "table %S has no ..." */ + libc.VaList(bp+8, pTabList+8 /* &.a */, (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pColumn)).Fa+uintptr(i)*16)).FzName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto insert_cleanup __27: @@ -148901,16 +149409,16 @@ __11: regYield = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) addrTop = (Xsqlite3VdbeCurrentAddr(tls, v) + 1) Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regYield, 0, addrTop) - Xsqlite3SelectDestInit(tls, bp+120 /* &dest */, SRT_Coroutine, regYield) - (*SelectDest)(unsafe.Pointer(bp + 120 /* &dest */)).FiSdst = func() int32 { + Xsqlite3SelectDestInit(tls, bp+80 /* &dest */, SRT_Coroutine, regYield) + (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FiSdst = func() int32 { if bIdListInOrder != 0 { return regData } return 0 }() - (*SelectDest)(unsafe.Pointer(bp + 120 /* &dest */)).FnSdst = int32((*Table)(unsafe.Pointer(pTab)).FnCol) - rc = Xsqlite3Select(tls, pParse, pSelect, bp+120 /* &dest */) - regFromSelect = (*SelectDest)(unsafe.Pointer(bp + 120 /* &dest */)).FiSdst + (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FnSdst = int32((*Table)(unsafe.Pointer(pTab)).FnCol) + rc = Xsqlite3Select(tls, pParse, pSelect, bp+80 /* &dest */) + regFromSelect = (*SelectDest)(unsafe.Pointer(bp + 80 /* &dest */)).FiSdst if !(((rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) || ((*Parse)(unsafe.Pointer(pParse)).FnErr != 0)) { goto __30 } @@ -148945,7 +149453,7 @@ __31: regRec = Xsqlite3GetTempReg(tls, pParse) regTempRowid = Xsqlite3GetTempReg(tls, pParse) Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, srcTab, nColumn) - addrL = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+120 /* &dest */)).FiSDParm) + addrL = Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+80 /* &dest */)).FiSDParm) Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regFromSelect, nColumn, regRec) Xsqlite3VdbeAddOp2(tls, v, OP_NewRowid, srcTab, regTempRowid) Xsqlite3VdbeAddOp3(tls, v, OP_Insert, srcTab, regRec, regTempRowid) @@ -148957,15 +149465,15 @@ __32: ; goto __29 __28: - libc.Xmemset(tls, bp+160 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) - (*NameContext)(unsafe.Pointer(bp + 160 /* &sNC */)).FpParse = pParse + libc.Xmemset(tls, bp+120 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 120 /* &sNC */)).FpParse = pParse srcTab = -1 if !(pList != 0) { goto __33 } nColumn = (*ExprList)(unsafe.Pointer(pList)).FnExpr - if !(Xsqlite3ResolveExprListNames(tls, bp+160 /* &sNC */, pList) != 0) { + if !(Xsqlite3ResolveExprListNames(tls, bp+120 /* &sNC */, pList) != 0) { goto __35 } goto insert_cleanup @@ -149042,8 +149550,8 @@ __42: goto __47 } Xsqlite3ErrorMsg(tls, pParse, - ts+15594, /* "table %S has %d ..." */ - libc.VaList(bp+40, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) + ts+15609, /* "table %S has %d ..." */ + libc.VaList(bp+24, pTabList+8 /* &.a */, (int32((*Table)(unsafe.Pointer(pTab)).FnCol)-nHidden), nColumn)) goto insert_cleanup __47: ; @@ -149052,7 +149560,7 @@ __36: if !((pColumn != uintptr(0)) && (nColumn != (*IdList)(unsafe.Pointer(pColumn)).FnId)) { goto __48 } - Xsqlite3ErrorMsg(tls, pParse, ts+15646 /* "%d values for %d..." */, libc.VaList(bp+72, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) + Xsqlite3ErrorMsg(tls, pParse, ts+15661 /* "%d values for %d..." */, libc.VaList(bp+48, nColumn, (*IdList)(unsafe.Pointer(pColumn)).FnId)) goto insert_cleanup __48: ; @@ -149074,7 +149582,7 @@ __49: goto __50 } nIdx = Xsqlite3OpenTableAndIndices(tls, pParse, pTab, OP_OpenWrite, uint8(0), -1, uintptr(0), - bp+216 /* &iDataCur */, bp+220 /* &iIdxCur */) + bp+176 /* &iDataCur */, bp+180 /* &iIdxCur */) aRegIdx = Xsqlite3DbMallocRawNN(tls, db, (uint64(unsafe.Sizeof(int32(0))) * (uint64(nIdx + 2)))) if !(aRegIdx == uintptr(0)) { goto __51 @@ -149108,15 +149616,15 @@ __50: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __56 } - Xsqlite3ErrorMsg(tls, pParse, ts+15671, /* "UPSERT not imple..." */ - libc.VaList(bp+96, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+15686, /* "UPSERT not imple..." */ + libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName)) goto insert_cleanup __56: ; if !((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) { goto __57 } - Xsqlite3ErrorMsg(tls, pParse, ts+15717 /* "cannot UPSERT a ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+15732 /* "cannot UPSERT a ..." */, 0) goto insert_cleanup __57: ; @@ -149126,13 +149634,13 @@ __57: goto insert_cleanup __58: ; - (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor = *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)) + (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor = *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)) pNx = pUpsert __59: (*Upsert)(unsafe.Pointer(pNx)).FpUpsertSrc = pTabList (*Upsert)(unsafe.Pointer(pNx)).FregData = regData - (*Upsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)) - (*Upsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 220 /* iIdxCur */)) + (*Upsert)(unsafe.Pointer(pNx)).FiDataCur = *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)) + (*Upsert)(unsafe.Pointer(pNx)).FiIdxCur = *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)) if !((*Upsert)(unsafe.Pointer(pNx)).FpUpsertTarget != 0) { goto __62 } @@ -149183,7 +149691,7 @@ __64: // goto C // D: ... - addrInsTop = libc.AssignInt32(&addrCont, Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+120 /* &dest */)).FiSDParm)) + addrInsTop = libc.AssignInt32(&addrCont, Xsqlite3VdbeAddOp1(tls, v, OP_Yield, (*SelectDest)(unsafe.Pointer(bp+80 /* &dest */)).FiSDParm)) if !(ipkColumn >= 0) { goto __67 @@ -149245,7 +149753,7 @@ __73: // triggers, the slots used for stored columns will be OP_Copy-ed // to a second block of registers, so the register needs to be // initialized to NULL to avoid an uninitialized register read - if !((*(*int32)(unsafe.Pointer(bp + 112 /* tmask */)) & TRIGGER_BEFORE) != 0) { + if !((*(*int32)(unsafe.Pointer(bp + 72 /* tmask */)) & TRIGGER_BEFORE) != 0) { goto __77 } Xsqlite3VdbeAddOp1(tls, v, OP_SoftNull, iRegStore) @@ -149343,7 +149851,7 @@ __70: // Run the BEFORE and INSTEAD OF triggers, if there are any endOfLoop = Xsqlite3VdbeMakeLabel(tls, pParse) - if !((*(*int32)(unsafe.Pointer(bp + 112 /* tmask */)) & TRIGGER_BEFORE) != 0) { + if !((*(*int32)(unsafe.Pointer(bp + 72 /* tmask */)) & TRIGGER_BEFORE) != 0) { goto __92 } regCols = Xsqlite3GetTempRange(tls, pParse, (int32((*Table)(unsafe.Pointer(pTab)).FnCol) + 1)) @@ -149442,7 +149950,7 @@ __105: if !((int32((*Expr)(unsafe.Pointer(pIpk)).Fop) == TK_NULL) && !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0)) { goto __107 } - Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)), regRowid, regAutoinc) + Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), regRowid, regAutoinc) appendFlag = U8(1) goto __108 __107: @@ -149462,7 +149970,7 @@ __104: goto __110 } addr11 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, regRowid) - Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)), regRowid, regAutoinc) + Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), regRowid, regAutoinc) Xsqlite3VdbeJumpHere(tls, v, addr11) goto __111 __110: @@ -149481,7 +149989,7 @@ __101: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, regRowid) goto __113 __112: - Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)), regRowid, regAutoinc) + Xsqlite3VdbeAddOp3(tls, v, OP_NewRowid, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), regRowid, regAutoinc) appendFlag = U8(1) __113: ; @@ -149518,9 +150026,9 @@ __114: goto __116 __115: - *(*int32)(unsafe.Pointer(bp + 224 /* isReplace */)) = 0 // True to use OPFLAG_SEEKRESULT - Xsqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 220 /* iIdxCur */)), - regIns, 0, (uint8(libc.Bool32(ipkColumn >= 0))), uint8(onError), endOfLoop, bp+224 /* &isReplace */, uintptr(0), pUpsert) + *(*int32)(unsafe.Pointer(bp + 184 /* isReplace */)) = 0 // True to use OPFLAG_SEEKRESULT + Xsqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)), + regIns, 0, (uint8(libc.Bool32(ipkColumn >= 0))), uint8(onError), endOfLoop, bp+184 /* &isReplace */, uintptr(0), pUpsert) Xsqlite3FkCheck(tls, pParse, pTab, 0, regIns, uintptr(0), 0) // Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE @@ -149531,8 +150039,8 @@ __115: // cursor that is disturbed. And these instructions both clear the // VdbeCursor.seekResult variable, disabling the OPFLAG_USESEEKRESULT // functionality. - bUseSeek = (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 224 /* isReplace */)) == 0) || !(Xsqlite3VdbeHasSubProgram(tls, v) != 0))) - Xsqlite3CompleteInsertion(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 216 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 220 /* iIdxCur */)), + bUseSeek = (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 184 /* isReplace */)) == 0) || !(Xsqlite3VdbeHasSubProgram(tls, v) != 0))) + Xsqlite3CompleteInsertion(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 176 /* iDataCur */)), *(*int32)(unsafe.Pointer(bp + 180 /* iIdxCur */)), regIns, aRegIdx, 0, int32(appendFlag), bUseSeek) __116: ; @@ -149596,7 +150104,7 @@ __122: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+15738 /* "rows inserted" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+15753 /* "rows inserted" */, uintptr(0)) __123: ; @@ -149825,15 +150333,15 @@ func indexIteratorNext(tls *libc.TLS, pIter uintptr, pIx uintptr) uintptr { /* s // is used. Or if pParse->onError==OE_Default then the onError value // for the constraint is used. func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintptr, aRegIdx uintptr, iDataCur int32, iIdxCur int32, regNewData int32, regOldData int32, pkChng U8, overrideError U8, ignoreDest int32, pbMayReplace uintptr, aiChng uintptr, pUpsert uintptr) { /* sqlite3.c:124634:21: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(72) + defer tls.Free(72) var v uintptr // VDBE under constrution var pIdx uintptr // Pointer to one of the indices var pPk uintptr = uintptr(0) // The PRIMARY KEY index for WITHOUT ROWID tables var db uintptr // Database connection var i int32 // loop counter - // var ix int32 at bp+48, 4 + // var ix int32 at bp+40, 4 // Index loop counter var nCol int32 // Number of columns var onError int32 // Conflict resolution strategy @@ -149853,7 +150361,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt var lblRecheckOk int32 = 0 // Each recheck jumps to this label if it passes var pTrigger uintptr // List of DELETE triggers on the table pTab var nReplaceTrig int32 = 0 // Number of replace triggers coded - // var sIdxIter IndexIterator at bp+24, 24 + // var sIdxIter IndexIterator at bp+16, 24 // Index iterator isUpdate = (U8(libc.Bool32(regOldData != 0))) @@ -149940,7 +150448,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt fallthrough case OE_Fail: { - var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+12132 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, + var zMsg uintptr = Xsqlite3MPrintf(tls, db, ts+12147 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, (*Column)(unsafe.Pointer(pCol)).FzName)) Xsqlite3VdbeAddOp3(tls, v, OP_HaltIfNull, (SQLITE_CONSTRAINT | (int32(5) << 8)), onError, iReg) @@ -150054,10 +150562,10 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt // The ordering of (2) and (3) is accomplished by making sure the linked // list of indexes attached to a table puts all OE_Replace indexes last // in the list. See sqlite3CreateIndex() for where that happens. - (*IndexIterator)(unsafe.Pointer(bp + 24 /* &sIdxIter */)).FeType = 0 - (*IndexIterator)(unsafe.Pointer(bp + 24 /* &sIdxIter */)).Fi = 0 - *(*uintptr)(unsafe.Pointer(bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) = uintptr(0) // Silence harmless compiler warning - *(*uintptr)(unsafe.Pointer(bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.lx */ /* &.pIdx */)) = (*Table)(unsafe.Pointer(pTab)).FpIndex + (*IndexIterator)(unsafe.Pointer(bp + 16 /* &sIdxIter */)).FeType = 0 + (*IndexIterator)(unsafe.Pointer(bp + 16 /* &sIdxIter */)).Fi = 0 + *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) = uintptr(0) // Silence harmless compiler warning + *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.lx */ /* &.pIdx */)) = (*Table)(unsafe.Pointer(pTab)).FpIndex if pUpsert != 0 { if (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget == uintptr(0) { // There is just on ON CONFLICT clause and it has no constraint-target @@ -150097,15 +150605,15 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt goto __3 __3: ; - (*IndexIterator)(unsafe.Pointer(bp + 24 /* &sIdxIter */)).FeType = 1 - *(*int32)(unsafe.Pointer(bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ /* &.nIdx */)) = nIdx + (*IndexIterator)(unsafe.Pointer(bp + 16 /* &sIdxIter */)).FeType = 1 + *(*int32)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ /* &.nIdx */)) = nIdx nByte = (((uint64(unsafe.Sizeof(IndexListTerm{})) + uint64(1)) * uint64(nIdx)) + uint64(nIdx)) - *(*uintptr)(unsafe.Pointer(bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) = Xsqlite3DbMallocZero(tls, db, nByte) - if *(*uintptr)(unsafe.Pointer((bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) = Xsqlite3DbMallocZero(tls, db, nByte) + if *(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) == uintptr(0) { return } // OOM - bUsed = (*(*uintptr)(unsafe.Pointer((bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(nIdx)*16) - (*Upsert)(unsafe.Pointer(pUpsert)).FpToFree = *(*uintptr)(unsafe.Pointer(bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) + bUsed = (*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(nIdx)*16) + (*Upsert)(unsafe.Pointer(pUpsert)).FpToFree = *(*uintptr)(unsafe.Pointer(bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */ + 8 /* &.aIdx */)) i = 0 pTerm = pUpsert for ; pTerm != 0; pTerm = (*Upsert)(unsafe.Pointer(pTerm)).FpNextUpsert { @@ -150125,8 +150633,8 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt continue } // Duplicate ON CONFLICT clause ignored *(*U8)(unsafe.Pointer(bUsed + uintptr(jj))) = U8(1) - (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp = pIdx - (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix = jj + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp = pIdx + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix = jj i++ } jj = 0 @@ -150139,8 +150647,8 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt if *(*U8)(unsafe.Pointer(bUsed + uintptr(jj))) != 0 { goto __5 } - (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp = pIdx - (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 24 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix = jj + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fp = pIdx + (*IndexListTerm)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((bp + 16 /* &sIdxIter */ + 8 /* &.u */ /* &.ax */) + 8 /* &.aIdx */)) + uintptr(i)*16)).Fix = jj i++ } @@ -150348,14 +150856,14 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt // // This loop also handles the case of the PRIMARY KEY index for a // WITHOUT ROWID table. - for pIdx = indexIteratorFirst(tls, bp+24 /* &sIdxIter */, bp+48 /* &ix */); pIdx != 0; pIdx = indexIteratorNext(tls, bp+24 /* &sIdxIter */, bp+48 /* &ix */) { + for pIdx = indexIteratorFirst(tls, bp+16 /* &sIdxIter */, bp+40 /* &ix */); pIdx != 0; pIdx = indexIteratorNext(tls, bp+16 /* &sIdxIter */, bp+40 /* &ix */) { var regIdx int32 // Range of registers hold conent for pIdx var regR int32 // Range of registers holding conflicting PK var iThisCur int32 // Cursor for this UNIQUE index var addrUniqueOk int32 // Jump here if the UNIQUE constraint is satisfied var addrConflictCk int32 // First opcode in the conflict check logic - if *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* ix */)))*4)) == 0 { + if *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4)) == 0 { continue } // Skip indices that do not change if pUpsert != 0 { @@ -150370,11 +150878,11 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt bAffinityDone = U8(1) } - iThisCur = (iIdxCur + *(*int32)(unsafe.Pointer(bp + 48 /* ix */))) + iThisCur = (iIdxCur + *(*int32)(unsafe.Pointer(bp + 40 /* ix */))) // Skip partial indices for which the WHERE clause is not true if (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere != 0 { - Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* ix */)))*4))) + Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4))) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = -(regNewData + 1) Xsqlite3ExprIfFalseDup(tls, pParse, (*Index)(unsafe.Pointer(pIdx)).FpPartIdxWhere, addrUniqueOk, SQLITE_JUMPIFNULL) @@ -150383,7 +150891,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt // Create a record for this index entry as it should appear after // the insert or update. Store that record in the aRegIdx[ix] register - regIdx = (*(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* ix */)))*4)) + 1) + regIdx = (*(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4)) + 1) for i = 0; i < int32((*Index)(unsafe.Pointer(pIdx)).FnColumn); i++ { var iField int32 = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) var x int32 @@ -150403,7 +150911,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt } } - Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regIdx, int32((*Index)(unsafe.Pointer(pIdx)).FnColumn), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* ix */)))*4))) + Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, regIdx, int32((*Index)(unsafe.Pointer(pIdx)).FnColumn), *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4))) // In an UPDATE operation, if this index is the PRIMARY KEY index // of a WITHOUT ROWID table and there has been no change the @@ -150530,7 +151038,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt } case OE_Update: { - Xsqlite3UpsertDoUpdate(tls, pParse, pUpsert, pTab, pIdx, (iIdxCur + *(*int32)(unsafe.Pointer(bp + 48 /* ix */)))) + Xsqlite3UpsertDoUpdate(tls, pParse, pUpsert, pTab, pIdx, (iIdxCur + *(*int32)(unsafe.Pointer(bp + 40 /* ix */)))) } fallthrough @@ -150586,27 +151094,27 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt // the constraint-ok jump destination to be the address of // the next retest block for nConflictCk > 0 { - // var x VdbeOp at bp+56, 24 + // var x VdbeOp at bp+48, 24 // Conflict check opcode to copy // The sqlite3VdbeAddOp4() call might reallocate the opcode array. // Hence, make a complete copy of the opcode, rather than using // a pointer to the opcode. - *(*VdbeOp)(unsafe.Pointer(bp + 56 /* x */)) = *(*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, addrConflictCk))) - if int32((*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fopcode) != OP_IdxRowid { + *(*VdbeOp)(unsafe.Pointer(bp + 48 /* x */)) = *(*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, addrConflictCk))) + if int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fopcode) != OP_IdxRowid { var p2 int32 // New P2 value for copied conflict check opcode var zP4 uintptr - if (int32(Xsqlite3OpcodeProperty[(*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fopcode]) & OPFLG_JUMP) != 0 { + if (int32(Xsqlite3OpcodeProperty[(*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fopcode]) & OPFLG_JUMP) != 0 { p2 = lblRecheckOk } else { - p2 = (*VdbeOp)(unsafe.Pointer(bp + 56 /* &x */)).Fp2 + p2 = (*VdbeOp)(unsafe.Pointer(bp + 48 /* &x */)).Fp2 } - if int32((*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fp4type) == (-3) { - zP4 = uintptr(int64(*(*int32)(unsafe.Pointer(bp + 56 /* &x */ + 16 /* &.p4 */)))) + if int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp4type) == (-3) { + zP4 = uintptr(int64(*(*int32)(unsafe.Pointer(bp + 48 /* &x */ + 16 /* &.p4 */)))) } else { - zP4 = *(*uintptr)(unsafe.Pointer(bp + 56 /* &x */ + 16 /* &.p4 */)) + zP4 = *(*uintptr)(unsafe.Pointer(bp + 48 /* &x */ + 16 /* &.p4 */)) } - Xsqlite3VdbeAddOp4(tls, v, int32((*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fopcode), (*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fp1, p2, (*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fp3, zP4, int32((*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fp4type)) - Xsqlite3VdbeChangeP5(tls, v, (*VdbeOp)(unsafe.Pointer(bp+56 /* &x */)).Fp5) + Xsqlite3VdbeAddOp4(tls, v, int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fopcode), (*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp1, p2, (*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp3, zP4, int32((*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp4type)) + Xsqlite3VdbeChangeP5(tls, v, (*VdbeOp)(unsafe.Pointer(bp+48 /* &x */)).Fp5) } nConflictCk-- @@ -150664,7 +151172,7 @@ func Xsqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt // Generate the table record if ((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0) { - var regRec int32 = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* ix */)))*4)) + var regRec int32 = *(*int32)(unsafe.Pointer(aRegIdx + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* ix */)))*4)) Xsqlite3VdbeAddOp3(tls, v, OP_MakeRecord, (regNewData + 1), int32((*Table)(unsafe.Pointer(pTab)).FnNVCol), regRec) if !(bAffinityDone != 0) { @@ -151343,7 +151851,7 @@ __1: if !(zSql == uintptr(0)) { goto __2 } - zSql = ts + 740 /* "" */ + zSql = ts + 755 /* "" */ __2: ; @@ -151861,13 +152369,13 @@ var sqlite3Apis = Sqlite3_api_routines{ // error message text. The calling function should free this memory // by calling sqlite3DbFree(db, ). func sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127439:12: */ - bp := tls.Alloc(96) - defer tls.Free(96) + bp := tls.Alloc(64) + defer tls.Free(64) var pVfs uintptr var handle uintptr var xInit Sqlite3_loadext_entry - // var zErrmsg uintptr at bp+88, 8 + // var zErrmsg uintptr at bp+56, 8 var zEntry uintptr var zAltEntry uintptr @@ -151881,7 +152389,7 @@ func sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintpt var c int32 var ncFile int32 pVfs = (*Sqlite3)(unsafe.Pointer(db)).FpVfs - *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)) = uintptr(0) zAltEntry = uintptr(0) nMsg = libc.Xstrlen(tls, zFile) @@ -151904,7 +152412,7 @@ __1: if !(pzErrMsg != 0) { goto __3 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+12171 /* "not authorized" */, 0) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+12186 /* "not authorized" */, 0) __3: ; return SQLITE_ERROR @@ -151914,7 +152422,7 @@ __2: if zProc != 0 { zEntry = zProc } else { - zEntry = ts + 15752 /* "sqlite3_extensio..." */ + zEntry = ts + 15767 /* "sqlite3_extensio..." */ } // tag-20210611-1. Some dlopen() implementations will segfault if given @@ -151934,7 +152442,7 @@ __5: if !((ii < (int32(uint64(unsafe.Sizeof(azEndings)) / uint64(unsafe.Sizeof(uintptr(0)))))) && (handle == uintptr(0))) { goto __7 } - zAltFile = Xsqlite3_mprintf(tls, ts+12132 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) + zAltFile = Xsqlite3_mprintf(tls, ts+12147 /* "%s.%s" */, libc.VaList(bp, zFile, azEndings[ii])) if !(zAltFile == uintptr(0)) { goto __8 } @@ -151980,7 +152488,7 @@ __9: return SQLITE_NOMEM __11: ; - libc.Xmemcpy(tls, zAltEntry, ts+15775 /* "sqlite3_" */, uint64(8)) + libc.Xmemcpy(tls, zAltEntry, ts+15790 /* "sqlite3_" */, uint64(8)) iFile = (ncFile - 1) __12: if !((iFile >= 0) && !(((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '/') || ((int32(*(*int8)(unsafe.Pointer(zFile + uintptr(iFile))))) == '\\'))) { @@ -151994,7 +152502,7 @@ __13: __14: ; iFile++ - if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+15784 /* "lib" */, 3) == 0) { + if !(Xsqlite3_strnicmp(tls, (zFile+uintptr(iFile)), ts+15799 /* "lib" */, 3) == 0) { goto __15 } iFile = iFile + (3) @@ -152018,7 +152526,7 @@ __17: goto __18 __18: ; - libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+15788 /* "_init" */, uint64(6)) + libc.Xmemcpy(tls, (zAltEntry + uintptr(iEntry)), ts+15803 /* "_init" */, uint64(6)) zEntry = zAltEntry xInit = Xsqlite3OsDlSym(tls, pVfs, handle, zEntry) __10: @@ -152030,14 +152538,14 @@ __10: goto __21 } nMsg = nMsg + (libc.Xstrlen(tls, zEntry) + uint64(300)) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = libc.AssignPtrUintptr(bp+88 /* zErrmsg */, Xsqlite3_malloc64(tls, nMsg)) - if !(*(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = libc.AssignPtrUintptr(bp+56 /* zErrmsg */, Xsqlite3_malloc64(tls, nMsg)) + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)) != 0) { goto __22 } // zErrmsg would be NULL if not so - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */)), - ts+15794 /* "no entry point [..." */, libc.VaList(bp+24, zEntry, zFile)) - Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */))) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), + ts+15809 /* "no entry point [..." */, libc.VaList(bp+16, zEntry, zFile)) + Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __22: ; __21: @@ -152048,7 +152556,7 @@ __21: __20: ; Xsqlite3_free(tls, zAltEntry) - rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+88 /* &zErrmsg */, uintptr(unsafe.Pointer(&sqlite3Apis))) + rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+56 /* &zErrmsg */, uintptr(unsafe.Pointer(&sqlite3Apis))) if !(rc != 0) { goto __23 } @@ -152061,10 +152569,10 @@ __24: if !(pzErrMsg != 0) { goto __25 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+15837 /* "error during ini..." */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */)))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+15852 /* "error during ini..." */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)))) __25: ; - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) Xsqlite3OsDlClose(tls, pVfs, handle) return SQLITE_ERROR __23: @@ -152095,14 +152603,14 @@ extension_not_found: goto __28 } nMsg = nMsg + (uint64(300)) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = libc.AssignPtrUintptr(bp+88 /* zErrmsg */, Xsqlite3_malloc64(tls, nMsg)) - if !(*(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */)) != 0) { + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = libc.AssignPtrUintptr(bp+56 /* zErrmsg */, Xsqlite3_malloc64(tls, nMsg)) + if !(*(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)) != 0) { goto __29 } // zErrmsg would be NULL if not so - Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */)), - ts+15869 /* "unable to open s..." */, libc.VaList(bp+64, FILENAME_MAX, zFile)) - Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 88 /* zErrmsg */))) + Xsqlite3_snprintf(tls, int32(nMsg), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */)), + ts+15884 /* "unable to open s..." */, libc.VaList(bp+40, FILENAME_MAX, zFile)) + Xsqlite3OsDlError(tls, pVfs, (int32(nMsg - uint64(1))), *(*uintptr)(unsafe.Pointer(bp + 56 /* zErrmsg */))) __29: ; __28: @@ -152111,7 +152619,7 @@ __28: } var azEndings = [1]uintptr{ - ts + 15906, /* "dll" */ + ts + 15921, /* "dll" */ } /* sqlite3.c:127457:21 */ func Xsqlite3_load_extension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:127590:16: */ @@ -152250,8 +152758,8 @@ func Xsqlite3_reset_auto_extension(tls *libc.TLS) { /* sqlite3.c:127739:17: */ // // If anything goes wrong, set an error in the database connection. func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var i U32 var go1 int32 = 1 @@ -152263,7 +152771,7 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 return } for i = U32(0); go1 != 0; i++ { - // var zErrmsg uintptr at bp+16, 8 + // var zErrmsg uintptr at bp+8, 8 var mutex uintptr = Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_STATIC_MAIN) var pThunk uintptr = uintptr(unsafe.Pointer(&sqlite3Apis)) @@ -152275,13 +152783,13 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 xInit = *(*uintptr)(unsafe.Pointer(sqlite3Autoext.FaExt + uintptr(i)*8)) } Xsqlite3_mutex_leave(tls, mutex) - *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)) = uintptr(0) - if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+16 /* &zErrmsg */, pThunk))) != 0) { + *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)) = uintptr(0) + if (xInit != 0) && ((libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xInit)))(tls, db, bp+8 /* &zErrmsg */, pThunk))) != 0) { Xsqlite3ErrorWithMsg(tls, db, rc, - ts+15910 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)))) + ts+15925 /* "automatic extens..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */)))) go1 = 0 } - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErrmsg */))) } } @@ -152323,61 +152831,61 @@ func Xsqlite3AutoLoadExtensions(tls *libc.TLS, db uintptr) { /* sqlite3.c:127761 // or that return single-column results where the name of the // result column is different from the name of the pragma var pragCName = [51]uintptr{ - /* 0 */ ts + 5518, /* "id" */ // Used by: foreign_key_list - /* 1 */ ts + 15949, /* "seq" */ - /* 2 */ ts + 9170, /* "table" */ - /* 3 */ ts + 15953, /* "from" */ - /* 4 */ ts + 15958, /* "to" */ - /* 5 */ ts + 15961, /* "on_update" */ - /* 6 */ ts + 15971, /* "on_delete" */ - /* 7 */ ts + 15981, /* "match" */ - /* 8 */ ts + 15987, /* "cid" */ // Used by: table_xinfo - /* 9 */ ts + 15991, /* "name" */ - /* 10 */ ts + 15996, /* "type" */ - /* 11 */ ts + 16001, /* "notnull" */ - /* 12 */ ts + 16009, /* "dflt_value" */ - /* 13 */ ts + 16020, /* "pk" */ - /* 14 */ ts + 16023, /* "hidden" */ + /* 0 */ ts + 5533, /* "id" */ // Used by: foreign_key_list + /* 1 */ ts + 15964, /* "seq" */ + /* 2 */ ts + 9185, /* "table" */ + /* 3 */ ts + 15968, /* "from" */ + /* 4 */ ts + 15973, /* "to" */ + /* 5 */ ts + 15976, /* "on_update" */ + /* 6 */ ts + 15986, /* "on_delete" */ + /* 7 */ ts + 15996, /* "match" */ + /* 8 */ ts + 16002, /* "cid" */ // Used by: table_xinfo + /* 9 */ ts + 16006, /* "name" */ + /* 10 */ ts + 16011, /* "type" */ + /* 11 */ ts + 16016, /* "notnull" */ + /* 12 */ ts + 16024, /* "dflt_value" */ + /* 13 */ ts + 16035, /* "pk" */ + /* 14 */ ts + 16038, /* "hidden" */ // table_info reuses 8 - /* 15 */ ts + 16030, /* "seqno" */ // Used by: index_xinfo - /* 16 */ ts + 15987, /* "cid" */ - /* 17 */ ts + 15991, /* "name" */ - /* 18 */ ts + 16036, /* "desc" */ - /* 19 */ ts + 16041, /* "coll" */ - /* 20 */ ts + 16046, /* "key" */ - /* 21 */ ts + 15991, /* "name" */ // Used by: function_list - /* 22 */ ts + 16050, /* "builtin" */ - /* 23 */ ts + 15996, /* "type" */ - /* 24 */ ts + 16058, /* "enc" */ - /* 25 */ ts + 16062, /* "narg" */ - /* 26 */ ts + 16067, /* "flags" */ - /* 27 */ ts + 11563, /* "tbl" */ // Used by: stats - /* 28 */ ts + 11559, /* "idx" */ - /* 29 */ ts + 16073, /* "wdth" */ - /* 30 */ ts + 16078, /* "hght" */ - /* 31 */ ts + 16083, /* "flgs" */ - /* 32 */ ts + 15949, /* "seq" */ // Used by: index_list - /* 33 */ ts + 15991, /* "name" */ - /* 34 */ ts + 16088, /* "unique" */ - /* 35 */ ts + 16095, /* "origin" */ - /* 36 */ ts + 16102, /* "partial" */ - /* 37 */ ts + 9170, /* "table" */ // Used by: foreign_key_check - /* 38 */ ts + 16110, /* "rowid" */ - /* 39 */ ts + 5521, /* "parent" */ - /* 40 */ ts + 16116, /* "fkid" */ + /* 15 */ ts + 16045, /* "seqno" */ // Used by: index_xinfo + /* 16 */ ts + 16002, /* "cid" */ + /* 17 */ ts + 16006, /* "name" */ + /* 18 */ ts + 16051, /* "desc" */ + /* 19 */ ts + 16056, /* "coll" */ + /* 20 */ ts + 16061, /* "key" */ + /* 21 */ ts + 16006, /* "name" */ // Used by: function_list + /* 22 */ ts + 16065, /* "builtin" */ + /* 23 */ ts + 16011, /* "type" */ + /* 24 */ ts + 16073, /* "enc" */ + /* 25 */ ts + 16077, /* "narg" */ + /* 26 */ ts + 16082, /* "flags" */ + /* 27 */ ts + 11578, /* "tbl" */ // Used by: stats + /* 28 */ ts + 11574, /* "idx" */ + /* 29 */ ts + 16088, /* "wdth" */ + /* 30 */ ts + 16093, /* "hght" */ + /* 31 */ ts + 16098, /* "flgs" */ + /* 32 */ ts + 15964, /* "seq" */ // Used by: index_list + /* 33 */ ts + 16006, /* "name" */ + /* 34 */ ts + 16103, /* "unique" */ + /* 35 */ ts + 16110, /* "origin" */ + /* 36 */ ts + 16117, /* "partial" */ + /* 37 */ ts + 9185, /* "table" */ // Used by: foreign_key_check + /* 38 */ ts + 16125, /* "rowid" */ + /* 39 */ ts + 5536, /* "parent" */ + /* 40 */ ts + 16131, /* "fkid" */ // index_info reuses 15 - /* 41 */ ts + 15949, /* "seq" */ // Used by: database_list - /* 42 */ ts + 15991, /* "name" */ - /* 43 */ ts + 16121, /* "file" */ - /* 44 */ ts + 16126, /* "busy" */ // Used by: wal_checkpoint - /* 45 */ ts + 16131, /* "log" */ - /* 46 */ ts + 16135, /* "checkpointed" */ + /* 41 */ ts + 15964, /* "seq" */ // Used by: database_list + /* 42 */ ts + 16006, /* "name" */ + /* 43 */ ts + 16136, /* "file" */ + /* 44 */ ts + 16141, /* "busy" */ // Used by: wal_checkpoint + /* 45 */ ts + 16146, /* "log" */ + /* 46 */ ts + 16150, /* "checkpointed" */ // collation_list reuses 32 - /* 47 */ ts + 16148, /* "database" */ // Used by: lock_status - /* 48 */ ts + 16157, /* "status" */ - /* 49 */ ts + 16164, /* "cache_size" */ // Used by: default_cache_size + /* 47 */ ts + 16163, /* "database" */ // Used by: lock_status + /* 48 */ ts + 16172, /* "status" */ + /* 49 */ ts + 16179, /* "cache_size" */ // Used by: default_cache_size // module_list pragma_list reuses 9 - /* 50 */ ts + 16175, /* "timeout" */ // Used by: busy_timeout + /* 50 */ ts + 16190, /* "timeout" */ // Used by: busy_timeout } /* sqlite3.c:127901:19 */ // Definitions of all built-in pragmas @@ -152394,237 +152902,237 @@ type PragmaName1 = struct { // Definitions of all built-in pragmas type PragmaName = PragmaName1 /* sqlite3.c:127967:3 */ var aPragmaName = [66]PragmaName{ - { /* zName: */ FzName: ts + 16183, /* "analysis_limit" */ + { /* zName: */ FzName: ts + 16198, /* "analysis_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ANALYSIS_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16198, /* "application_id" */ + { /* zName: */ FzName: ts + 16213, /* "application_id" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_APPLICATION_ID)}, - { /* zName: */ FzName: ts + 16213, /* "auto_vacuum" */ + { /* zName: */ FzName: ts + 16228, /* "auto_vacuum" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_AUTO_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16225, /* "automatic_index" */ + { /* zName: */ FzName: ts + 16240, /* "automatic_index" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_AutoIndex)}, - { /* zName: */ FzName: ts + 16241, /* "busy_timeout" */ + { /* zName: */ FzName: ts + 16256, /* "busy_timeout" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_BUSY_TIMEOUT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(50), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 16164, /* "cache_size" */ + { /* zName: */ FzName: ts + 16179, /* "cache_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16254, /* "cache_spill" */ + { /* zName: */ FzName: ts + 16269, /* "cache_spill" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CACHE_SPILL), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16266, /* "case_sensitive_l..." */ + { /* zName: */ FzName: ts + 16281, /* "case_sensitive_l..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_CASE_SENSITIVE_LIKE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 16286, /* "cell_size_check" */ + { /* zName: */ FzName: ts + 16301, /* "cell_size_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CellSizeCk)}, - { /* zName: */ FzName: ts + 16302, /* "checkpoint_fullf..." */ + { /* zName: */ FzName: ts + 16317, /* "checkpoint_fullf..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_CkptFullFSync)}, - { /* zName: */ FzName: ts + 16323, /* "collation_list" */ + { /* zName: */ FzName: ts + 16338, /* "collation_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COLLATION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(2)}, - { /* zName: */ FzName: ts + 16338, /* "compile_options" */ + { /* zName: */ FzName: ts + 16353, /* "compile_options" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_COMPILE_OPTIONS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16354, /* "count_changes" */ + { /* zName: */ FzName: ts + 16369, /* "count_changes" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (U64((uint64(0x00001))) << 32)}, - { /* zName: */ FzName: ts + 16368, /* "data_store_direc..." */ + { /* zName: */ FzName: ts + 16383, /* "data_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATA_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 16389, /* "data_version" */ + { /* zName: */ FzName: ts + 16404, /* "data_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_DATA_VERSION)}, - { /* zName: */ FzName: ts + 16402, /* "database_list" */ + { /* zName: */ FzName: ts + 16417, /* "database_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DATABASE_LIST), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_Result0)), /* ColNames: */ FiPragCName: U8(41), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 16416, /* "default_cache_si..." */ + { /* zName: */ FzName: ts + 16431, /* "default_cache_si..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_DEFAULT_CACHE_SIZE), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1)), /* ColNames: */ FiPragCName: U8(49), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 16435, /* "defer_foreign_ke..." */ + { /* zName: */ FzName: ts + 16450, /* "defer_foreign_ke..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_DeferFKs)}, - { /* zName: */ FzName: ts + 16454, /* "empty_result_cal..." */ + { /* zName: */ FzName: ts + 16469, /* "empty_result_cal..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_NullCallback)}, - { /* zName: */ FzName: ts + 16477, /* "encoding" */ + { /* zName: */ FzName: ts + 16492, /* "encoding" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_ENCODING), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16486, /* "foreign_key_chec..." */ + { /* zName: */ FzName: ts + 16501, /* "foreign_key_chec..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_CHECK), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(37), FnPragCName: U8(4)}, - { /* zName: */ FzName: ts + 16504, /* "foreign_key_list" */ + { /* zName: */ FzName: ts + 16519, /* "foreign_key_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FOREIGN_KEY_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), FnPragCName: U8(8)}, - { /* zName: */ FzName: ts + 16521, /* "foreign_keys" */ + { /* zName: */ FzName: ts + 16536, /* "foreign_keys" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ForeignKeys)}, - { /* zName: */ FzName: ts + 16534, /* "freelist_count" */ + { /* zName: */ FzName: ts + 16549, /* "freelist_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_ReadOnly | PragFlg_Result0))}, - { /* zName: */ FzName: ts + 16549, /* "full_column_name..." */ + { /* zName: */ FzName: ts + 16564, /* "full_column_name..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullColNames)}, - { /* zName: */ FzName: ts + 16567, /* "fullfsync" */ + { /* zName: */ FzName: ts + 16582, /* "fullfsync" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_FullFSync)}, - { /* zName: */ FzName: ts + 16577, /* "function_list" */ + { /* zName: */ FzName: ts + 16592, /* "function_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FUNCTION_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(21), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 16591, /* "hard_heap_limit" */ + { /* zName: */ FzName: ts + 16606, /* "hard_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HARD_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16607, /* "ignore_check_con..." */ + { /* zName: */ FzName: ts + 16622, /* "ignore_check_con..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_IgnoreChecks)}, - { /* zName: */ FzName: ts + 16632, /* "incremental_vacu..." */ + { /* zName: */ FzName: ts + 16647, /* "incremental_vacu..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INCREMENTAL_VACUUM), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NeedSchema | PragFlg_NoColumns))}, - { /* zName: */ FzName: ts + 16651, /* "index_info" */ + { /* zName: */ FzName: ts + 16666, /* "index_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 16662, /* "index_list" */ + { /* zName: */ FzName: ts + 16677, /* "index_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_LIST), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(32), FnPragCName: U8(5)}, - { /* zName: */ FzName: ts + 16673, /* "index_xinfo" */ + { /* zName: */ FzName: ts + 16688, /* "index_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INDEX_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(15), FnPragCName: U8(6), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 16685, /* "integrity_check" */ + { /* zName: */ FzName: ts + 16700, /* "integrity_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 16701, /* "journal_mode" */ + { /* zName: */ FzName: ts + 16716, /* "journal_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_MODE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 16714, /* "journal_size_lim..." */ + { /* zName: */ FzName: ts + 16729, /* "journal_size_lim..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_JOURNAL_SIZE_LIMIT), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 16733, /* "legacy_alter_tab..." */ + { /* zName: */ FzName: ts + 16748, /* "legacy_alter_tab..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_LegacyAlter)}, - { /* zName: */ FzName: ts + 16752, /* "locking_mode" */ + { /* zName: */ FzName: ts + 16767, /* "locking_mode" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_LOCKING_MODE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 16765, /* "max_page_count" */ + { /* zName: */ FzName: ts + 16780, /* "max_page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 16780, /* "mmap_size" */ + { /* zName: */ FzName: ts + 16795, /* "mmap_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MMAP_SIZE)}, - { /* zName: */ FzName: ts + 16790, /* "module_list" */ + { /* zName: */ FzName: ts + 16805, /* "module_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_MODULE_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 16802, /* "optimize" */ + { /* zName: */ FzName: ts + 16817, /* "optimize" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_OPTIMIZE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result1 | PragFlg_NeedSchema))}, - { /* zName: */ FzName: ts + 16811, /* "page_count" */ + { /* zName: */ FzName: ts + 16826, /* "page_count" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_COUNT), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq))}, - { /* zName: */ FzName: ts + 16822, /* "page_size" */ + { /* zName: */ FzName: ts + 16837, /* "page_size" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PAGE_SIZE), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_Result0 | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 16832, /* "pragma_list" */ + { /* zName: */ FzName: ts + 16847, /* "pragma_list" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_PRAGMA_LIST), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0), /* ColNames: */ FiPragCName: U8(9), FnPragCName: U8(1)}, - { /* zName: */ FzName: ts + 16844, /* "query_only" */ + { /* zName: */ FzName: ts + 16859, /* "query_only" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_QueryOnly)}, - { /* zName: */ FzName: ts + 16855, /* "quick_check" */ + { /* zName: */ FzName: ts + 16870, /* "quick_check" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_INTEGRITY_CHECK), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_Result1))}, - { /* zName: */ FzName: ts + 16867, /* "read_uncommitted" */ + { /* zName: */ FzName: ts + 16882, /* "read_uncommitted" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReadUncommit)}, - { /* zName: */ FzName: ts + 16884, /* "recursive_trigge..." */ + { /* zName: */ FzName: ts + 16899, /* "recursive_trigge..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_RecTriggers)}, - { /* zName: */ FzName: ts + 16903, /* "reverse_unordere..." */ + { /* zName: */ FzName: ts + 16918, /* "reverse_unordere..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ReverseOrder)}, - { /* zName: */ FzName: ts + 16929, /* "schema_version" */ + { /* zName: */ FzName: ts + 16944, /* "schema_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_SCHEMA_VERSION)}, - { /* zName: */ FzName: ts + 16944, /* "secure_delete" */ + { /* zName: */ FzName: ts + 16959, /* "secure_delete" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SECURE_DELETE), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 16958, /* "short_column_nam..." */ + { /* zName: */ FzName: ts + 16973, /* "short_column_nam..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_ShortColNames)}, - { /* zName: */ FzName: ts + 16977, /* "shrink_memory" */ + { /* zName: */ FzName: ts + 16992, /* "shrink_memory" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SHRINK_MEMORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns)}, - { /* zName: */ FzName: ts + 16991, /* "soft_heap_limit" */ + { /* zName: */ FzName: ts + 17006, /* "soft_heap_limit" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SOFT_HEAP_LIMIT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 17007, /* "synchronous" */ + { /* zName: */ FzName: ts + 17022, /* "synchronous" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_SYNCHRONOUS), /* ePragFlg: */ FmPragFlg: (U8(((PragFlg_NeedSchema | PragFlg_Result0) | PragFlg_SchemaReq) | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 17019, /* "table_info" */ + { /* zName: */ FzName: ts + 17034, /* "table_info" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(6)}, - { /* zName: */ FzName: ts + 17030, /* "table_xinfo" */ + { /* zName: */ FzName: ts + 17045, /* "table_xinfo" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TABLE_INFO), /* ePragFlg: */ FmPragFlg: (U8((PragFlg_NeedSchema | PragFlg_Result1) | PragFlg_SchemaOpt)), /* ColNames: */ FiPragCName: U8(8), FnPragCName: U8(7), /* iArg: */ FiArg: uint64(1)}, - { /* zName: */ FzName: ts + 17042, /* "temp_store" */ + { /* zName: */ FzName: ts + 17057, /* "temp_store" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1))}, - { /* zName: */ FzName: ts + 17053, /* "temp_store_direc..." */ + { /* zName: */ FzName: ts + 17068, /* "temp_store_direc..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_TEMP_STORE_DIRECTORY), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NoColumns1)}, - { /* zName: */ FzName: ts + 17074, /* "threads" */ + { /* zName: */ FzName: ts + 17089, /* "threads" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_THREADS), /* ePragFlg: */ FmPragFlg: U8(PragFlg_Result0)}, - { /* zName: */ FzName: ts + 17082, /* "trusted_schema" */ + { /* zName: */ FzName: ts + 17097, /* "trusted_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: uint64(SQLITE_TrustedSchema)}, - { /* zName: */ FzName: ts + 17097, /* "user_version" */ + { /* zName: */ FzName: ts + 17112, /* "user_version" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_HEADER_VALUE), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_NoColumns1 | PragFlg_Result0)), /* iArg: */ FiArg: uint64(BTREE_USER_VERSION)}, - { /* zName: */ FzName: ts + 17110, /* "wal_autocheckpoi..." */ + { /* zName: */ FzName: ts + 17125, /* "wal_autocheckpoi..." */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_AUTOCHECKPOINT)}, - { /* zName: */ FzName: ts + 17129, /* "wal_checkpoint" */ + { /* zName: */ FzName: ts + 17144, /* "wal_checkpoint" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_WAL_CHECKPOINT), /* ePragFlg: */ FmPragFlg: U8(PragFlg_NeedSchema), /* ColNames: */ FiPragCName: U8(44), FnPragCName: U8(3)}, - { /* zName: */ FzName: ts + 17144, /* "writable_schema" */ + { /* zName: */ FzName: ts + 17159, /* "writable_schema" */ /* ePragTyp: */ FePragTyp: U8(PragTyp_FLAG), /* ePragFlg: */ FmPragFlg: (U8(PragFlg_Result0 | PragFlg_NoColumns1)), /* iArg: */ FiArg: (uint64(SQLITE_WriteSchema | SQLITE_NoSchemaError))}, @@ -152661,7 +153169,7 @@ func getSafetyLevel(tls *libc.TLS, z uintptr, omitFull int32, dflt U8) U8 { /* s return dflt } -var zText = *(*[25]int8)(unsafe.Pointer(ts + 17160 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ +var zText = *(*[25]int8)(unsafe.Pointer(ts + 17175 /* "onoffalseyestrue..." */)) /* sqlite3.c:128499:21 */ var iOffset = [8]U8{U8(0), U8(1), U8(2), U8(4), U8(9), U8(12), U8(15), U8(20)} /* sqlite3.c:128500:19 */ var iLength = [8]U8{U8(2), U8(2), U8(3), U8(5), U8(3), U8(4), U8(5), U8(4)} /* sqlite3.c:128501:19 */ var iValue = [8]U8{U8(1), U8(0), U8(0), U8(0), U8(1), U8(1), U8(3), U8(2)} /* sqlite3.c:128502:19 */ @@ -152678,10 +153186,10 @@ func Xsqlite3GetBoolean(tls *libc.TLS, z uintptr, dflt U8) U8 { /* sqlite3.c:128 // Interpret the given string as a locking mode value. func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ if z != 0 { - if 0 == Xsqlite3StrICmp(tls, z, ts+4139 /* "exclusive" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+4154 /* "exclusive" */) { return PAGER_LOCKINGMODE_EXCLUSIVE } - if 0 == Xsqlite3StrICmp(tls, z, ts+17185 /* "normal" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+17200 /* "normal" */) { return PAGER_LOCKINGMODE_NORMAL } } @@ -152694,13 +153202,13 @@ func getLockingMode(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128535:12: */ // acceptable, as are their numeric equivalents: 0, 1 and 2 respectively. func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ var i int32 - if 0 == Xsqlite3StrICmp(tls, z, ts+17192 /* "none" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+17207 /* "none" */) { return BTREE_AUTOVACUUM_NONE } - if 0 == Xsqlite3StrICmp(tls, z, ts+17197 /* "full" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+17212 /* "full" */) { return BTREE_AUTOVACUUM_FULL } - if 0 == Xsqlite3StrICmp(tls, z, ts+17202 /* "incremental" */) { + if 0 == Xsqlite3StrICmp(tls, z, ts+17217 /* "incremental" */) { return BTREE_AUTOVACUUM_INCR } i = Xsqlite3Atoi(tls, z) @@ -152718,9 +153226,9 @@ func getAutoVacuum(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128550:12: */ func getTempStore(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:128566:12: */ if (int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '2') { return (int32(*(*int8)(unsafe.Pointer(z))) - '0') - } else if Xsqlite3StrICmp(tls, z, ts+16121 /* "file" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+16136 /* "file" */) == 0 { return 1 - } else if Xsqlite3StrICmp(tls, z, ts+17214 /* "memory" */) == 0 { + } else if Xsqlite3StrICmp(tls, z, ts+17229 /* "memory" */) == 0 { return 2 } else { return 0 @@ -152736,7 +153244,7 @@ func invalidateTempStorage(tls *libc.TLS, pParse uintptr) int32 { /* sqlite3.c:1 if !(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0) || (Xsqlite3BtreeTxnState(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) != SQLITE_TXN_NONE) { Xsqlite3ErrorMsg(tls, pParse, - ts+17221 /* "temporary storag..." */, 0) + ts+17236 /* "temporary storag..." */, 0) return SQLITE_ERROR } Xsqlite3BtreeClose(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpBt) @@ -152836,19 +153344,19 @@ func actionName(tls *libc.TLS, action U8) uintptr { /* sqlite3.c:128694:19: */ var zName uintptr switch int32(action) { case OE_SetNull: - zName = ts + 17283 /* "SET NULL" */ + zName = ts + 17298 /* "SET NULL" */ break case OE_SetDflt: - zName = ts + 17292 /* "SET DEFAULT" */ + zName = ts + 17307 /* "SET DEFAULT" */ break case OE_Cascade: - zName = ts + 17304 /* "CASCADE" */ + zName = ts + 17319 /* "CASCADE" */ break case OE_Restrict: - zName = ts + 17312 /* "RESTRICT" */ + zName = ts + 17327 /* "RESTRICT" */ break default: - zName = ts + 17321 /* "NO ACTION" */ + zName = ts + 17336 /* "NO ACTION" */ break } return zName @@ -152866,7 +153374,7 @@ func Xsqlite3JournalModename(tls *libc.TLS, eMode int32) uintptr { /* sqlite3.c: } var azModeName = [6]uintptr{ - ts + 17331 /* "delete" */, ts + 17338 /* "persist" */, ts + 17346 /* "off" */, ts + 17350 /* "truncate" */, ts + 17214 /* "memory" */, ts + 17359, /* "wal" */ + ts + 17346 /* "delete" */, ts + 17353 /* "persist" */, ts + 17361 /* "off" */, ts + 17365 /* "truncate" */, ts + 17229 /* "memory" */, ts + 17374, /* "wal" */ } /* sqlite3.c:128715:15 */ // Locate a pragma in the aPragmaName[] array. @@ -152898,8 +153406,8 @@ func pragmaLocate(tls *libc.TLS, zName uintptr) uintptr { /* sqlite3.c:128736:25 // Create zero or more entries in the output for the SQL functions // defined by FuncDef p. func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, showInternFuncs int32) { /* sqlite3.c:128757:13: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) for ; p != 0; p = (*FuncDef)(unsafe.Pointer(p)).FpNext { var zType uintptr @@ -152912,13 +153420,13 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh continue } if (*FuncDef)(unsafe.Pointer(p)).FxValue != uintptr(0) { - zType = ts + 17363 /* "w" */ + zType = ts + 17378 /* "w" */ } else if (*FuncDef)(unsafe.Pointer(p)).FxFinalize != uintptr(0) { - zType = ts + 17365 /* "a" */ + zType = ts + 17380 /* "a" */ } else { - zType = ts + 17367 /* "s" */ + zType = ts + 17382 /* "s" */ } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17369, /* "sissii" */ + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17384, /* "sissii" */ libc.VaList(bp, (*FuncDef)(unsafe.Pointer(p)).FzName, isBuiltin, zType, azEnc[((*FuncDef)(unsafe.Pointer(p)).FfuncFlags&U32(SQLITE_FUNC_ENCMASK))], int32((*FuncDef)(unsafe.Pointer(p)).FnArg), @@ -152927,7 +153435,7 @@ func pragmaFunclistLine(tls *libc.TLS, v uintptr, p uintptr, isBuiltin int32, sh } var mask U32 = (U32((((SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY) | SQLITE_SUBTYPE) | SQLITE_INNOCUOUS) | SQLITE_FUNC_INTERNAL)) /* sqlite3.c:128765:22 */ -var azEnc = [4]uintptr{uintptr(0), ts + 17376 /* "utf8" */, ts + 17381 /* "utf16le" */, ts + 17389 /* "utf16be" */} /* sqlite3.c:128772:23 */ +var azEnc = [4]uintptr{uintptr(0), ts + 17391 /* "utf8" */, ts + 17396 /* "utf16le" */, ts + 17404 /* "utf16be" */} /* sqlite3.c:128772:23 */ // Helper subroutine for PRAGMA integrity_check: // @@ -152957,15 +153465,15 @@ func integrityCheckResultRow(tls *libc.TLS, v uintptr) int32 { /* sqlite3.c:1288 // and pId2 is the id. If the left side is just "id" then pId1 is the // id and pId2 is any empty string. func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, pValue uintptr, minusFlag int32) { /* sqlite3.c:128833:21: */ - bp := tls.Alloc(688) - defer tls.Free(688) + bp := tls.Alloc(536) + defer tls.Free(536) var zLeft uintptr // Nul-terminated UTF-8 string var zRight uintptr // Nul-terminated UTF-8 string , or NULL var zDb uintptr // The database name - // var pId uintptr at bp+520, 8 + // var pId uintptr at bp+368, 8 // Pointer to token - // var aFcntl [4]uintptr at bp+528, 32 + // var aFcntl [4]uintptr at bp+376, 32 // Argument to SQLITE_FCNTL_PRAGMA var iDb int32 // Database index for var rc int32 // return value form SQLITE_FCNTL_PRAGMA @@ -152981,7 +153489,7 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var pBt1 uintptr var b int32 var iReg int32 - // var x I64 at bp+560, 8 + // var x I64 at bp+408, 8 // This indicates that no database name was specified as part // of the PRAGMA command. In this case the locking-mode must be @@ -152999,24 +153507,24 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var eMode1 int32 // One of the PAGER_JOURNALMODE_XXX symbols var ii2 int32 var pPager1 uintptr - // var iLimit I64 at bp+568, 8 + // var iLimit I64 at bp+416, 8 var aOp1 uintptr var iAddr int32 var eAuto int32 var pBt2 uintptr - // var iLimit1 int32 at bp+576, 4 + // var iLimit1 int32 at bp+424, 4 var addr int32 var size2 int32 - // var size3 int32 at bp+580, 4 + // var size3 int32 at bp+428, 4 var ii3 int32 - // var sz Sqlite3_int64 at bp+584, 8 + // var sz Sqlite3_int64 at bp+432, 8 - // var res int32 at bp+592, 4 + // var res int32 at bp+440, 4 - // var res1 int32 at bp+596, 4 + // var res1 int32 at bp+444, 4 var iLevel int32 var mask U64 @@ -153033,7 +153541,7 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var mx int32 var pIdx uintptr var pTab1 uintptr - // var azOrigin [3]uintptr at bp+600, 24 + // var azOrigin [3]uintptr at bp+448, 24 var iTabDb int32 var pIdx1 uintptr @@ -153060,7 +153568,7 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var pFK1 uintptr // A foreign key constraint var pTab4 uintptr // Child table contain "REFERENCES" keyword var pParent uintptr // Parent table that child points to - // var pIdx2 uintptr at bp+624, 8 + // var pIdx2 uintptr at bp+472, 8 // Index in the parent table var i8 int32 // Loop counter: Foreign key number for pTab var j3 int32 // Loop counter: Field of the foreign key @@ -153071,7 +153579,7 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var regRow int32 // Registers to hold a row from pTab var addrTop int32 // Top of a loop checking foreign keys var addrOk int32 // Jump here if the key is OK - // var aiCols uintptr at bp+632, 8 + // var aiCols uintptr at bp+480, 8 var pTab5 uintptr // Current table var pIdx3 uintptr // An index on pTab @@ -153090,7 +153598,7 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var jmp6 int32 var kk int32 var jmp21 int32 - // var jmp3 int32 at bp+652, 4 + // var jmp3 int32 at bp+500, 4 var jmp4 int32 var jmp5 int32 @@ -153100,9 +153608,9 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var pPk1 uintptr var pPrior uintptr var loopTop int32 - // var iDataCur int32 at bp+644, 4 + // var iDataCur int32 at bp+492, 4 - // var iIdxCur int32 at bp+648, 4 + // var iIdxCur int32 at bp+496, 4 var r1 int32 var x2 uintptr // For looping over tables in the schema @@ -153114,7 +153622,7 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var i9 int32 var j4 int32 var addr1 int32 - // var mxErr int32 at bp+640, 4 + // var mxErr int32 at bp+488, 4 var pObjTab uintptr // Check only this one table, if not NULL @@ -153138,14 +153646,14 @@ func Xsqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p var szThreshold LogEst // Size threshold above which reanalysis is needd var zSubSql uintptr // SQL statement for the OP_SqlExec opcode var opMask U32 - // var N Sqlite3_int64 at bp+656, 8 + // var N Sqlite3_int64 at bp+504, 8 var iPrior Sqlite3_int64 - // var N1 Sqlite3_int64 at bp+664, 8 + // var N1 Sqlite3_int64 at bp+512, 8 - // var N2 Sqlite3_int64 at bp+672, 8 + // var N2 Sqlite3_int64 at bp+520, 8 - // var N3 Sqlite3_int64 at bp+680, 8 + // var N3 Sqlite3_int64 at bp+528, 8 zLeft = uintptr(0) zRight = uintptr(0) zDb = uintptr(0) @@ -153163,7 +153671,7 @@ __1: // Interpret the [schema.] part of the pragma statement. iDb is the // index of the database this pragma is being applied to in db.aDb[]. - iDb = Xsqlite3TwoPartName(tls, pParse, pId1, pId2, bp+520 /* &pId */) + iDb = Xsqlite3TwoPartName(tls, pParse, pId1, pId2, bp+368 /* &pId */) if !(iDb < 0) { goto __2 } @@ -153181,7 +153689,7 @@ __2: __3: ; - zLeft = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 520 /* pId */))) + zLeft = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 368 /* pId */))) if !(!(zLeft != 0)) { goto __4 } @@ -153191,7 +153699,7 @@ __4: if !(minusFlag != 0) { goto __5 } - zRight = Xsqlite3MPrintf(tls, db, ts+17397 /* "-%T" */, libc.VaList(bp, pValue)) + zRight = Xsqlite3MPrintf(tls, db, ts+17412 /* "-%T" */, libc.VaList(bp, pValue)) goto __6 __5: zRight = Xsqlite3NameFromToken(tls, db, pValue) @@ -153224,30 +153732,30 @@ __7: // second element of the array is the name of the pragma and the third // element is the argument to the pragma or NULL if the pragma has no // argument. - *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */ + 1*8)) = zLeft - *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */ + 2*8)) = zRight - *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */ + 3*8)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */ + 1*8)) = zLeft + *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */ + 2*8)) = zRight + *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */ + 3*8)) = uintptr(0) (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 - rc = Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_PRAGMA, bp+528 /* aFcntl */) + rc = Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_PRAGMA, bp+376 /* aFcntl */) if !(rc == SQLITE_OK) { goto __8 } Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */)), libc.UintptrFromInt32(-1)) - returnSingleText(tls, v, *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */))) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */)), libc.UintptrFromInt32(-1)) + returnSingleText(tls, v, *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */))) goto pragma_out __8: ; if !(rc != SQLITE_NOTFOUND) { goto __9 } - if !(*(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */)) != 0) { + if !(*(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */)) != 0) { goto __10 } - Xsqlite3ErrorMsg(tls, pParse, ts+3615 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */)))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 528 /* &aFcntl[0] */))) + Xsqlite3ErrorMsg(tls, pParse, ts+3630 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 376 /* &aFcntl[0] */))) __10: ; (*Parse)(unsafe.Pointer(pParse)).FnErr++ @@ -153832,7 +154340,7 @@ __18: if !(zRight != 0) { goto __63 } - if !(Xsqlite3_stricmp(tls, zRight, ts+17401 /* "fast" */) == 0) { + if !(Xsqlite3_stricmp(tls, zRight, ts+17416 /* "fast" */) == 0) { goto __64 } b = 2 @@ -153881,7 +154389,7 @@ __66: // // Return the number of pages in the specified database. __19: - *(*I64)(unsafe.Pointer(bp + 560 /* x */)) = int64(0) + *(*I64)(unsafe.Pointer(bp + 408 /* x */)) = int64(0) Xsqlite3CodeVerifySchema(tls, pParse, iDb) iReg = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) if !((int32(Xsqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zLeft)))])) == 'p') { @@ -153890,29 +154398,29 @@ __19: Xsqlite3VdbeAddOp2(tls, v, OP_Pagecount, iDb, iReg) goto __71 __70: - if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+560 /* &x */) == 0)) { + if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+408 /* &x */) == 0)) { goto __72 } - if !(*(*I64)(unsafe.Pointer(bp + 560 /* x */)) < int64(0)) { + if !(*(*I64)(unsafe.Pointer(bp + 408 /* x */)) < int64(0)) { goto __74 } - *(*I64)(unsafe.Pointer(bp + 560 /* x */)) = int64(0) + *(*I64)(unsafe.Pointer(bp + 408 /* x */)) = int64(0) goto __75 __74: - if !(*(*I64)(unsafe.Pointer(bp + 560 /* x */)) > int64(0xfffffffe)) { + if !(*(*I64)(unsafe.Pointer(bp + 408 /* x */)) > int64(0xfffffffe)) { goto __76 } - *(*I64)(unsafe.Pointer(bp + 560 /* x */)) = int64(0xfffffffe) + *(*I64)(unsafe.Pointer(bp + 408 /* x */)) = int64(0xfffffffe) __76: ; __75: ; goto __73 __72: - *(*I64)(unsafe.Pointer(bp + 560 /* x */)) = int64(0) + *(*I64)(unsafe.Pointer(bp + 408 /* x */)) = int64(0) __73: ; - Xsqlite3VdbeAddOp3(tls, v, OP_MaxPgcnt, iDb, iReg, int32(*(*I64)(unsafe.Pointer(bp + 560 /* x */)))) + Xsqlite3VdbeAddOp3(tls, v, OP_MaxPgcnt, iDb, iReg, int32(*(*I64)(unsafe.Pointer(bp + 408 /* x */)))) __71: ; Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, iReg, 1) @@ -153921,7 +154429,7 @@ __71: // PRAGMA [schema.]locking_mode // PRAGMA [schema.]locking_mode = (normal|exclusive) __20: - zRet = ts + 17185 /* "normal" */ + zRet = ts + 17200 /* "normal" */ eMode = getLockingMode(tls, zRight) if !(((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) && (eMode == -1)) { @@ -153962,7 +154470,7 @@ __78: if !(eMode == PAGER_LOCKINGMODE_EXCLUSIVE) { goto __83 } - zRet = ts + 4139 /* "exclusive" */ + zRet = ts + 4154 /* "exclusive" */ __83: ; returnSingleText(tls, v, zRet) @@ -154054,21 +154562,21 @@ __95: // Get or set the size limit on rollback journal files. __22: pPager1 = Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) - *(*I64)(unsafe.Pointer(bp + 568 /* iLimit */)) = int64(-2) + *(*I64)(unsafe.Pointer(bp + 416 /* iLimit */)) = int64(-2) if !(zRight != 0) { goto __97 } - Xsqlite3DecOrHexToI64(tls, zRight, bp+568 /* &iLimit */) - if !(*(*I64)(unsafe.Pointer(bp + 568 /* iLimit */)) < int64(-1)) { + Xsqlite3DecOrHexToI64(tls, zRight, bp+416 /* &iLimit */) + if !(*(*I64)(unsafe.Pointer(bp + 416 /* iLimit */)) < int64(-1)) { goto __98 } - *(*I64)(unsafe.Pointer(bp + 568 /* iLimit */)) = int64(-1) + *(*I64)(unsafe.Pointer(bp + 416 /* iLimit */)) = int64(-1) __98: ; __97: ; - *(*I64)(unsafe.Pointer(bp + 568 /* iLimit */)) = Xsqlite3PagerJournalSizeLimit(tls, pPager1, *(*I64)(unsafe.Pointer(bp + 568 /* iLimit */))) - returnSingleInt(tls, v, *(*I64)(unsafe.Pointer(bp + 568 /* iLimit */))) + *(*I64)(unsafe.Pointer(bp + 416 /* iLimit */)) = Xsqlite3PagerJournalSizeLimit(tls, pPager1, *(*I64)(unsafe.Pointer(bp + 416 /* iLimit */))) + returnSingleInt(tls, v, *(*I64)(unsafe.Pointer(bp + 416 /* iLimit */))) goto __15 // PRAGMA [schema.]auto_vacuum @@ -154121,14 +154629,14 @@ __100: // // Do N steps of incremental vacuuming on a database. __24: - if !(((zRight == uintptr(0)) || !(Xsqlite3GetInt32(tls, zRight, bp+576 /* &iLimit1 */) != 0)) || (*(*int32)(unsafe.Pointer(bp + 576 /* iLimit1 */)) <= 0)) { + if !(((zRight == uintptr(0)) || !(Xsqlite3GetInt32(tls, zRight, bp+424 /* &iLimit1 */) != 0)) || (*(*int32)(unsafe.Pointer(bp + 424 /* iLimit1 */)) <= 0)) { goto __103 } - *(*int32)(unsafe.Pointer(bp + 576 /* iLimit1 */)) = 0x7fffffff + *(*int32)(unsafe.Pointer(bp + 424 /* iLimit1 */)) = 0x7fffffff __103: ; Xsqlite3BeginWriteOperation(tls, pParse, 0, iDb) - Xsqlite3VdbeAddOp2(tls, v, OP_Integer, *(*int32)(unsafe.Pointer(bp + 576 /* iLimit1 */)), 1) + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, *(*int32)(unsafe.Pointer(bp + 424 /* iLimit1 */)), 1) addr = Xsqlite3VdbeAddOp1(tls, v, OP_IncrVacuum, iDb) Xsqlite3VdbeAddOp1(tls, v, OP_ResultRow, 1) Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, 1, -1) @@ -154194,14 +154702,14 @@ __26: }()) goto __107 __106: - *(*int32)(unsafe.Pointer(bp + 580 /* size3 */)) = 1 - if !(Xsqlite3GetInt32(tls, zRight, bp+580 /* &size3 */) != 0) { + *(*int32)(unsafe.Pointer(bp + 428 /* size3 */)) = 1 + if !(Xsqlite3GetInt32(tls, zRight, bp+428 /* &size3 */) != 0) { goto __108 } - Xsqlite3BtreeSetSpillSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, *(*int32)(unsafe.Pointer(bp + 580 /* size3 */))) + Xsqlite3BtreeSetSpillSize(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, *(*int32)(unsafe.Pointer(bp + 428 /* size3 */))) __108: ; - if !(Xsqlite3GetBoolean(tls, zRight, (uint8(libc.Bool32(*(*int32)(unsafe.Pointer(bp + 580 /* size3 */)) != 0)))) != 0) { + if !(Xsqlite3GetBoolean(tls, zRight, (uint8(libc.Bool32(*(*int32)(unsafe.Pointer(bp + 428 /* size3 */)) != 0)))) != 0) { goto __109 } *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) |= (uint64(SQLITE_CacheSpill)) @@ -154232,17 +154740,17 @@ __27: if !(zRight != 0) { goto __111 } - Xsqlite3DecOrHexToI64(tls, zRight, bp+584 /* &sz */) - if !(*(*Sqlite3_int64)(unsafe.Pointer(bp + 584 /* sz */)) < int64(0)) { + Xsqlite3DecOrHexToI64(tls, zRight, bp+432 /* &sz */) + if !(*(*Sqlite3_int64)(unsafe.Pointer(bp + 432 /* sz */)) < int64(0)) { goto __112 } - *(*Sqlite3_int64)(unsafe.Pointer(bp + 584 /* sz */)) = Xsqlite3Config.FszMmap + *(*Sqlite3_int64)(unsafe.Pointer(bp + 432 /* sz */)) = Xsqlite3Config.FszMmap __112: ; if !((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)) { goto __113 } - (*Sqlite3)(unsafe.Pointer(db)).FszMmap = *(*Sqlite3_int64)(unsafe.Pointer(bp + 584 /* sz */)) + (*Sqlite3)(unsafe.Pointer(db)).FszMmap = *(*Sqlite3_int64)(unsafe.Pointer(bp + 432 /* sz */)) __113: ; ii3 = ((*Sqlite3)(unsafe.Pointer(db)).FnDb - 1) @@ -154253,7 +154761,7 @@ __114: if !(((*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii3)*32)).FpBt != 0) && ((ii3 == iDb) || ((*Token)(unsafe.Pointer(pId2)).Fn == uint32(0)))) { goto __117 } - Xsqlite3BtreeSetMmapLimit(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii3)*32)).FpBt, *(*Sqlite3_int64)(unsafe.Pointer(bp + 584 /* sz */))) + Xsqlite3BtreeSetMmapLimit(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(ii3)*32)).FpBt, *(*Sqlite3_int64)(unsafe.Pointer(bp + 432 /* sz */))) __117: ; goto __115 @@ -154265,12 +154773,12 @@ __116: ; __111: ; - *(*Sqlite3_int64)(unsafe.Pointer(bp + 584 /* sz */)) = int64(-1) - rc = Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_MMAP_SIZE, bp+584 /* &sz */) + *(*Sqlite3_int64)(unsafe.Pointer(bp + 432 /* sz */)) = int64(-1) + rc = Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_MMAP_SIZE, bp+432 /* &sz */) if !(rc == SQLITE_OK) { goto __118 } - returnSingleInt(tls, v, *(*Sqlite3_int64)(unsafe.Pointer(bp + 584 /* sz */))) + returnSingleInt(tls, v, *(*Sqlite3_int64)(unsafe.Pointer(bp + 432 /* sz */))) goto __119 __118: if !(rc != SQLITE_NOTFOUND) { @@ -154323,11 +154831,11 @@ __123: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __125 } - rc = Xsqlite3OsAccess(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, zRight, SQLITE_ACCESS_READWRITE, bp+592 /* &res */) - if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 592 /* res */)) == 0)) { + rc = Xsqlite3OsAccess(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, zRight, SQLITE_ACCESS_READWRITE, bp+440 /* &res */) + if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 440 /* res */)) == 0)) { goto __126 } - Xsqlite3ErrorMsg(tls, pParse, ts+17406 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17421 /* "not a writable d..." */, 0) goto pragma_out __126: ; @@ -154345,7 +154853,7 @@ __127: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __128 } - Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+32, zRight)) + Xsqlite3_temp_directory = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+16, zRight)) goto __129 __128: Xsqlite3_temp_directory = uintptr(0) @@ -154376,11 +154884,11 @@ __130: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __132 } - rc = Xsqlite3OsAccess(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, zRight, SQLITE_ACCESS_READWRITE, bp+596 /* &res1 */) - if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 596 /* res1 */)) == 0)) { + rc = Xsqlite3OsAccess(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, zRight, SQLITE_ACCESS_READWRITE, bp+444 /* &res1 */) + if !((rc != SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp + 444 /* res1 */)) == 0)) { goto __133 } - Xsqlite3ErrorMsg(tls, pParse, ts+17406 /* "not a writable d..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+17421 /* "not a writable d..." */, 0) goto pragma_out __133: ; @@ -154390,7 +154898,7 @@ __132: if !(*(*int8)(unsafe.Pointer(zRight)) != 0) { goto __134 } - Xsqlite3_data_directory = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+48, zRight)) + Xsqlite3_data_directory = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+24, zRight)) goto __135 __134: Xsqlite3_data_directory = uintptr(0) @@ -154418,7 +154926,7 @@ __136: goto __138 } Xsqlite3ErrorMsg(tls, pParse, - ts+17431 /* "Safety level may..." */, 0) + ts+17446 /* "Safety level may..." */, 0) goto __139 __138: if !(iDb != 1) { @@ -154577,13 +155085,13 @@ __160: Xsqlite3VdbeMultiLoad(tls, v, 1, func() uintptr { if (*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0 { - return ts + 17484 /* "issisii" */ + return ts + 17499 /* "issisii" */ } - return ts + 17492 /* "issisi" */ + return ts + 17507 /* "issisi" */ }(), - libc.VaList(bp+64, (i-nHidden), + libc.VaList(bp+32, (i-nHidden), (*Column)(unsafe.Pointer(pCol)).FzName, - Xsqlite3ColumnType(tls, pCol, ts+740 /* "" */), + Xsqlite3ColumnType(tls, pCol, ts+755 /* "" */), func() int32 { if (*Column)(unsafe.Pointer(pCol)).FnotNull != 0 { return 1 @@ -154658,7 +155166,7 @@ __172: goto __174 } cnum = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i1)*2)) - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17499 /* "iisX" */, libc.VaList(bp+128, i1, int32(cnum), + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17514 /* "iisX" */, libc.VaList(bp+88, i1, int32(cnum), func() uintptr { if int32(cnum) < 0 { return uintptr(0) @@ -154668,8 +155176,8 @@ __172: if !((*PragmaName)(unsafe.Pointer(pPragma)).FiArg != 0) { goto __175 } - Xsqlite3VdbeMultiLoad(tls, v, 4, ts+17504, /* "isiX" */ - libc.VaList(bp+160, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), + Xsqlite3VdbeMultiLoad(tls, v, 4, ts+17519, /* "isiX" */ + libc.VaList(bp+112, int32(*(*U8)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaSortOrder + uintptr(i1)))), *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(i1)*8)), (libc.Bool32(i1 < int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol))))) __175: @@ -154705,12 +155213,12 @@ __178: if !(pIdx1 != 0) { goto __180 } - *(*[3]uintptr)(unsafe.Pointer(bp + 600 /* azOrigin */)) = [3]uintptr{ts + 17509 /* "c" */, ts + 17511 /* "u" */, ts + 16020 /* "pk" */} - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17513, /* "isisi" */ - libc.VaList(bp+192, i2, + *(*[3]uintptr)(unsafe.Pointer(bp + 448 /* azOrigin */)) = [3]uintptr{ts + 17524 /* "c" */, ts + 17526 /* "u" */, ts + 16035 /* "pk" */} + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17528, /* "isisi" */ + libc.VaList(bp+136, i2, (*Index)(unsafe.Pointer(pIdx1)).FzName, (libc.Bool32(int32((*Index)(unsafe.Pointer((pIdx1))).FonError) != OE_None)), - *(*uintptr)(unsafe.Pointer(bp + 600 /* &azOrigin[0] */ + uintptr((uint32(int32(*(*uint16)(unsafe.Pointer(pIdx1 + 100 /* &.idxType */))&0x3>>0))))*8)), + *(*uintptr)(unsafe.Pointer(bp + 448 /* &azOrigin[0] */ + uintptr((uint32(int32(*(*uint16)(unsafe.Pointer(pIdx1 + 100 /* &.idxType */))&0x3>>0))))*8)), (libc.Bool32((*Index)(unsafe.Pointer(pIdx1)).FpPartIdxWhere != uintptr(0))))) goto __179 __179: @@ -154740,8 +155248,8 @@ __181: __184: ; - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17519, /* "iss" */ - libc.VaList(bp+240, i3, + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17534, /* "iss" */ + libc.VaList(bp+176, i3, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FzDbSName, Xsqlite3BtreeGetFilename(tls, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i3)*32)).FpBt))) goto __182 @@ -154763,7 +155271,7 @@ __185: goto __187 } pColl = (*HashElem)(unsafe.Pointer(p)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17523 /* "is" */, libc.VaList(bp+272, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17538 /* "is" */, libc.VaList(bp+200, libc.PostIncInt32(&i4, 1), (*CollSeq)(unsafe.Pointer(pColl)).FzName)) goto __186 __186: p = (*HashElem)(unsafe.Pointer(p)).Fnext @@ -154827,7 +155335,7 @@ __197: goto __199 } pMod = (*HashElem)(unsafe.Pointer(j1)).Fdata - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17367 /* "s" */, libc.VaList(bp+296, (*Module)(unsafe.Pointer(pMod)).FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17382 /* "s" */, libc.VaList(bp+216, (*Module)(unsafe.Pointer(pMod)).FzName)) goto __198 __198: j1 = (*HashElem)(unsafe.Pointer(j1)).Fnext @@ -154844,7 +155352,7 @@ __200: if !(i6 < (int32(uint64(unsafe.Sizeof(aPragmaName)) / uint64(unsafe.Sizeof(PragmaName{}))))) { goto __202 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17367 /* "s" */, libc.VaList(bp+312, aPragmaName[i6].FzName)) + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17382 /* "s" */, libc.VaList(bp+224, aPragmaName[i6].FzName)) goto __201 __201: i6++ @@ -154880,15 +155388,15 @@ __208: if !(j2 < (*FKey)(unsafe.Pointer(pFK)).FnCol) { goto __210 } - Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17526, /* "iissssss" */ - libc.VaList(bp+328, i7, + Xsqlite3VdbeMultiLoad(tls, v, 1, ts+17541, /* "iissssss" */ + libc.VaList(bp+232, i7, j2, (*FKey)(unsafe.Pointer(pFK)).FzTo, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab3)).FaCol+uintptr((*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FiFrom)*32)).FzName, (*sColMap)(unsafe.Pointer((pFK+64 /* &.aCol */)+uintptr(j2)*16)).FzCol, actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */) + 1))), // ON UPDATE actionName(tls, *(*U8)(unsafe.Pointer((pFK + 45 /* &.aAction */)))), // ON DELETE - ts+17535 /* "NONE" */)) + ts+17550 /* "NONE" */)) goto __209 __209: j2++ @@ -154962,20 +155470,20 @@ __217: goto __218 __220: ; - *(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */)) = uintptr(0) Xsqlite3TableLock(tls, pParse, iDb, (*Table)(unsafe.Pointer(pParent)).Ftnum, uint8(0), (*Table)(unsafe.Pointer(pParent)).FzName) - x1 = Xsqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+624 /* &pIdx2 */, uintptr(0)) + x1 = Xsqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+472 /* &pIdx2 */, uintptr(0)) if !(x1 == 0) { goto __221 } - if !(*(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */)) == uintptr(0)) { + if !(*(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */)) == uintptr(0)) { goto __223 } Xsqlite3OpenTable(tls, pParse, i8, iDb, pParent, OP_OpenRead) goto __224 __223: - Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, i8, int32((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */)))).Ftnum), iDb) - Xsqlite3VdbeSetP4KeyInfo(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */))) + Xsqlite3VdbeAddOp3(tls, v, OP_OpenRead, i8, int32((*Index)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */)))).Ftnum), iDb) + Xsqlite3VdbeSetP4KeyInfo(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */))) __224: ; goto __222 @@ -155013,12 +155521,12 @@ __227: goto __229 } pParent = Xsqlite3FindTable(tls, db, (*FKey)(unsafe.Pointer(pFK1)).FzTo, zDb) - *(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 632 /* aiCols */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 480 /* aiCols */)) = uintptr(0) if !(pParent != 0) { goto __230 } - x1 = Xsqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+624 /* &pIdx2 */, bp+632 /* &aiCols */) + x1 = Xsqlite3FkLocateIndex(tls, pParse, pParent, pFK1, bp+472 /* &pIdx2 */, bp+480 /* &aiCols */) __230: ; @@ -155033,8 +155541,8 @@ __231: if !(j3 < (*FKey)(unsafe.Pointer(pFK1)).FnCol) { goto __233 } - if *(*uintptr)(unsafe.Pointer(bp + 632 /* aiCols */)) != 0 { - iCol = *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 632 /* aiCols */)) + uintptr(j3)*4)) + if *(*uintptr)(unsafe.Pointer(bp + 480 /* aiCols */)) != 0 { + iCol = *(*int32)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 480 /* aiCols */)) + uintptr(j3)*4)) } else { iCol = (*sColMap)(unsafe.Pointer((pFK1 + 64 /* &.aCol */) + uintptr(j3)*16)).FiFrom } @@ -155050,11 +155558,11 @@ __233: // Generate code to query the parent index for a matching parent // key. If a match is found, jump to addrOk. - if !(*(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */)) != 0) { + if !(*(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */)) != 0) { goto __234 } Xsqlite3VdbeAddOp4(tls, v, OP_MakeRecord, regRow, (*FKey)(unsafe.Pointer(pFK1)).FnCol, regKey, - Xsqlite3IndexAffinityStr(tls, db, *(*uintptr)(unsafe.Pointer(bp + 624 /* pIdx2 */))), (*FKey)(unsafe.Pointer(pFK1)).FnCol) + Xsqlite3IndexAffinityStr(tls, db, *(*uintptr)(unsafe.Pointer(bp + 472 /* pIdx2 */))), (*FKey)(unsafe.Pointer(pFK1)).FnCol) Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, i8, addrOk, regKey, 0) goto __235 @@ -155081,10 +155589,10 @@ __237: Xsqlite3VdbeAddOp2(tls, v, OP_Null, 0, (regResult + 1)) __238: ; - Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+17540 /* "siX" */, libc.VaList(bp+400, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) + Xsqlite3VdbeMultiLoad(tls, v, (regResult + 2), ts+17555 /* "siX" */, libc.VaList(bp+296, (*FKey)(unsafe.Pointer(pFK1)).FzTo, (i8-1))) Xsqlite3VdbeAddOp2(tls, v, OP_ResultRow, regResult, 4) Xsqlite3VdbeResolveLabel(tls, v, addrOk) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 632 /* aiCols */))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 480 /* aiCols */))) goto __228 __228: i8++ @@ -155162,17 +155670,17 @@ __240: (*Parse)(unsafe.Pointer(pParse)).FnMem = 6 // Set the maximum error count - *(*int32)(unsafe.Pointer(bp + 640 /* mxErr */)) = SQLITE_INTEGRITY_CHECK_ERROR_MAX + *(*int32)(unsafe.Pointer(bp + 488 /* mxErr */)) = SQLITE_INTEGRITY_CHECK_ERROR_MAX if !(zRight != 0) { goto __241 } - if !(Xsqlite3GetInt32(tls, zRight, bp+640 /* &mxErr */) != 0) { + if !(Xsqlite3GetInt32(tls, zRight, bp+488 /* &mxErr */) != 0) { goto __242 } - if !(*(*int32)(unsafe.Pointer(bp + 640 /* mxErr */)) <= 0) { + if !(*(*int32)(unsafe.Pointer(bp + 488 /* mxErr */)) <= 0) { goto __244 } - *(*int32)(unsafe.Pointer(bp + 640 /* mxErr */)) = SQLITE_INTEGRITY_CHECK_ERROR_MAX + *(*int32)(unsafe.Pointer(bp + 488 /* mxErr */)) = SQLITE_INTEGRITY_CHECK_ERROR_MAX __244: ; goto __243 @@ -155188,7 +155696,7 @@ __243: ; __241: ; - Xsqlite3VdbeAddOp2(tls, v, OP_Integer, (*(*int32)(unsafe.Pointer(bp + 640 /* mxErr */)) - 1), 1) // reg[1] holds errors left + Xsqlite3VdbeAddOp2(tls, v, OP_Integer, (*(*int32)(unsafe.Pointer(bp + 488 /* mxErr */)) - 1), 1) // reg[1] holds errors left // Do an integrity check on each database file i9 = 0 @@ -155347,7 +155855,7 @@ __265: Xsqlite3VdbeChangeP5(tls, v, uint16(U8(i9))) addr1 = Xsqlite3VdbeAddOp1(tls, v, OP_IsNull, 2) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, - Xsqlite3MPrintf(tls, db, ts+17544 /* "*** in database ..." */, libc.VaList(bp+424, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), + Xsqlite3MPrintf(tls, db, ts+17559 /* "*** in database ..." */, libc.VaList(bp+312, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(i9)*32)).FzDbSName)), -7) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 2, 3, 3) integrityCheckResultRow(tls, v) @@ -155381,7 +155889,7 @@ __275: pPk1 = Xsqlite3PrimaryKeyIndex(tls, pTab7) } Xsqlite3OpenTableAndIndices(tls, pParse, pTab7, OP_OpenRead, uint8(0), - 1, uintptr(0), bp+644 /* &iDataCur */, bp+648 /* &iIdxCur */) + 1, uintptr(0), bp+492 /* &iDataCur */, bp+496 /* &iIdxCur */) // reg[7] counts the number of entries in the table. // reg[8+i] counts the number of entries in the i-th index Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, 7) @@ -155401,13 +155909,13 @@ __277: __278: ; - Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, *(*int32)(unsafe.Pointer(bp + 644 /* iDataCur */)), 0) + Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, *(*int32)(unsafe.Pointer(bp + 492 /* iDataCur */)), 0) loopTop = Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, 7, 1) if !(!(isQuick != 0)) { goto __279 } // Sanity check on record header decoding - Xsqlite3VdbeAddOp3(tls, v, OP_Column, *(*int32)(unsafe.Pointer(bp + 644 /* iDataCur */)), (int32((*Table)(unsafe.Pointer(pTab7)).FnNVCol) - 1), 3) + Xsqlite3VdbeAddOp3(tls, v, OP_Column, *(*int32)(unsafe.Pointer(bp + 492 /* iDataCur */)), (int32((*Table)(unsafe.Pointer(pTab7)).FnNVCol) - 1), 3) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_TYPEOFARG)) __279: ; @@ -155429,7 +155937,7 @@ __283: goto __281 __284: ; - Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab7, *(*int32)(unsafe.Pointer(bp + 644 /* iDataCur */)), j4, 3) + Xsqlite3ExprCodeGetColumnOfTable(tls, v, pTab7, *(*int32)(unsafe.Pointer(bp + 492 /* iDataCur */)), j4, 3) if !(int32((*VdbeOp)(unsafe.Pointer(Xsqlite3VdbeGetOp(tls, v, -1))).Fopcode) == OP_Column) { goto __285 } @@ -155437,7 +155945,7 @@ __284: __285: ; jmp2 = Xsqlite3VdbeAddOp1(tls, v, OP_NotNull, 3) - zErr = Xsqlite3MPrintf(tls, db, ts+17568 /* "NULL value in %s..." */, libc.VaList(bp+440, (*Table)(unsafe.Pointer(pTab7)).FzName, + zErr = Xsqlite3MPrintf(tls, db, ts+17583 /* "NULL value in %s..." */, libc.VaList(bp+320, (*Table)(unsafe.Pointer(pTab7)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab7)).FaCol+uintptr(j4)*32)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr, -7) integrityCheckResultRow(tls, v) @@ -155459,7 +155967,7 @@ __282: } addrCkFault = Xsqlite3VdbeMakeLabel(tls, pParse) addrCkOk = Xsqlite3VdbeMakeLabel(tls, pParse) - (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = (*(*int32)(unsafe.Pointer(bp + 644 /* iDataCur */)) + 1) + (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = (*(*int32)(unsafe.Pointer(bp + 492 /* iDataCur */)) + 1) k2 = ((*ExprList)(unsafe.Pointer(pCheck)).FnExpr - 1) __288: if !(k2 > 0) { @@ -155477,8 +155985,8 @@ __290: SQLITE_JUMPIFNULL) Xsqlite3VdbeResolveLabel(tls, v, addrCkFault) (*Parse)(unsafe.Pointer(pParse)).FiSelfTab = 0 - zErr1 = Xsqlite3MPrintf(tls, db, ts+17588, /* "CHECK constraint..." */ - libc.VaList(bp+464, (*Table)(unsafe.Pointer(pTab7)).FzName)) + zErr1 = Xsqlite3MPrintf(tls, db, ts+17603, /* "CHECK constraint..." */ + libc.VaList(bp+336, (*Table)(unsafe.Pointer(pTab7)).FzName)) Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, 3, 0, zErr1, -7) integrityCheckResultRow(tls, v) Xsqlite3VdbeResolveLabel(tls, v, addrCkOk) @@ -155504,16 +156012,16 @@ __292: goto __293 __295: ; - r1 = Xsqlite3GenerateIndexKey(tls, pParse, pIdx5, *(*int32)(unsafe.Pointer(bp + 644 /* iDataCur */)), 0, 0, bp+652, /* &jmp3 */ + r1 = Xsqlite3GenerateIndexKey(tls, pParse, pIdx5, *(*int32)(unsafe.Pointer(bp + 492 /* iDataCur */)), 0, 0, bp+500, /* &jmp3 */ pPrior, r1) pPrior = pIdx5 Xsqlite3VdbeAddOp2(tls, v, OP_AddImm, (8 + j4), 1) // increment entry count // Verify that an index entry exists for the current table row - jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 648 /* iIdxCur */)) + j4), ckUniq, r1, + jmp21 = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), ckUniq, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnColumn)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+17618 /* "row " */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+17633 /* "row " */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 7, 3, 3) - Xsqlite3VdbeLoadString(tls, v, 4, ts+17623 /* " missing from in..." */) + Xsqlite3VdbeLoadString(tls, v, 4, ts+17638 /* " missing from in..." */) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) jmp5 = Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) Xsqlite3VdbeAddOp3(tls, v, OP_Concat, 4, 3, 3) @@ -155548,18 +156056,18 @@ __298: goto __299 __299: ; - jmp6 = Xsqlite3VdbeAddOp1(tls, v, OP_Next, (*(*int32)(unsafe.Pointer(bp + 648 /* iIdxCur */)) + j4)) + jmp6 = Xsqlite3VdbeAddOp1(tls, v, OP_Next, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4)) Xsqlite3VdbeGoto(tls, v, uniqOk) Xsqlite3VdbeJumpHere(tls, v, jmp6) - Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 648 /* iIdxCur */)) + j4), uniqOk, r1, + Xsqlite3VdbeAddOp4Int(tls, v, OP_IdxGT, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), uniqOk, r1, int32((*Index)(unsafe.Pointer(pIdx5)).FnKeyCol)) - Xsqlite3VdbeLoadString(tls, v, 3, ts+17644 /* "non-unique entry..." */) + Xsqlite3VdbeLoadString(tls, v, 3, ts+17659 /* "non-unique entry..." */) Xsqlite3VdbeGoto(tls, v, jmp5) Xsqlite3VdbeResolveLabel(tls, v, uniqOk) __296: ; Xsqlite3VdbeJumpHere(tls, v, jmp4) - Xsqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 652 /* jmp3 */))) + Xsqlite3ResolvePartIdxLabel(tls, pParse, *(*int32)(unsafe.Pointer(bp + 500 /* jmp3 */))) goto __293 __293: pIdx5 = (*Index)(unsafe.Pointer(pIdx5)).FpNext @@ -155570,12 +156078,12 @@ __294: ; __291: ; - Xsqlite3VdbeAddOp2(tls, v, OP_Next, *(*int32)(unsafe.Pointer(bp + 644 /* iDataCur */)), loopTop) + Xsqlite3VdbeAddOp2(tls, v, OP_Next, *(*int32)(unsafe.Pointer(bp + 492 /* iDataCur */)), loopTop) Xsqlite3VdbeJumpHere(tls, v, (loopTop - 1)) if !(!(isQuick != 0)) { goto __301 } - Xsqlite3VdbeLoadString(tls, v, 2, ts+17671 /* "wrong # of entri..." */) + Xsqlite3VdbeLoadString(tls, v, 2, ts+17686 /* "wrong # of entri..." */) j4 = 0 pIdx5 = (*Table)(unsafe.Pointer(pTab7)).FpIndex __302: @@ -155588,7 +156096,7 @@ __302: goto __303 __305: ; - Xsqlite3VdbeAddOp2(tls, v, OP_Count, (*(*int32)(unsafe.Pointer(bp + 648 /* iIdxCur */)) + j4), 3) + Xsqlite3VdbeAddOp2(tls, v, OP_Count, (*(*int32)(unsafe.Pointer(bp + 496 /* iIdxCur */)) + j4), 3) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_Eq, (8 + j4), 0, 3) Xsqlite3VdbeChangeP5(tls, v, uint16(SQLITE_NOTNULL)) Xsqlite3VdbeLoadString(tls, v, 4, (*Index)(unsafe.Pointer(pIdx5)).FzName) @@ -155624,9 +156132,9 @@ __247: if !(aOp2 != 0) { goto __306 } - (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 640 /* mxErr */))) + (*VdbeOp)(unsafe.Pointer(aOp2)).Fp2 = (1 - *(*int32)(unsafe.Pointer(bp + 488 /* mxErr */))) (*VdbeOp)(unsafe.Pointer(aOp2 + 2*24)).Fp4type = int8(-1) - *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 17700 /* "ok" */ + *(*uintptr)(unsafe.Pointer(aOp2 + 2*24 + 16 /* &.p4 */)) = ts + 17715 /* "ok" */ (*VdbeOp)(unsafe.Pointer(aOp2 + 5*24)).Fp4type = int8(-1) *(*uintptr)(unsafe.Pointer(aOp2 + 5*24 + 16 /* &.p4 */)) = Xsqlite3ErrStr(tls, SQLITE_CORRUPT) __306: @@ -155704,7 +156212,7 @@ __313: if !(!(int32((*EncName)(unsafe.Pointer(pEnc)).FzName) != 0)) { goto __315 } - Xsqlite3ErrorMsg(tls, pParse, ts+17703 /* "unsupported enco..." */, libc.VaList(bp+480, zRight)) + Xsqlite3ErrorMsg(tls, pParse, ts+17718 /* "unsupported enco..." */, libc.VaList(bp+344, zRight)) __315: ; __310: @@ -155816,19 +156324,19 @@ __48: if !(zRight != 0) { goto __322 } - if !(Xsqlite3StrICmp(tls, zRight, ts+17197 /* "full" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+17212 /* "full" */) == 0) { goto __323 } eMode2 = SQLITE_CHECKPOINT_FULL goto __324 __323: - if !(Xsqlite3StrICmp(tls, zRight, ts+17728 /* "restart" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+17743 /* "restart" */) == 0) { goto __325 } eMode2 = SQLITE_CHECKPOINT_RESTART goto __326 __325: - if !(Xsqlite3StrICmp(tls, zRight, ts+17350 /* "truncate" */) == 0) { + if !(Xsqlite3StrICmp(tls, zRight, ts+17365 /* "truncate" */) == 0) { goto __327 } eMode2 = SQLITE_CHECKPOINT_TRUNCATE @@ -156015,8 +156523,8 @@ __342: __344: ; - zSubSql = Xsqlite3MPrintf(tls, db, ts+17736, /* "ANALYZE \"%w\".\"%w..." */ - libc.VaList(bp+496, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) + zSubSql = Xsqlite3MPrintf(tls, db, ts+17751, /* "ANALYZE \"%w\".\"%w..." */ + libc.VaList(bp+352, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab8)).FzName)) if !((opMask & U32(0x01)) != 0) { goto __345 } @@ -156074,10 +156582,10 @@ __347: // returns the same integer that would be returned by the // sqlite3_soft_heap_limit64(-1) C-language function. __53: - if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+656 /* &N */) == SQLITE_OK)) { + if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+504 /* &N */) == SQLITE_OK)) { goto __348 } - Xsqlite3_soft_heap_limit64(tls, *(*Sqlite3_int64)(unsafe.Pointer(bp + 656 /* N */))) + Xsqlite3_soft_heap_limit64(tls, *(*Sqlite3_int64)(unsafe.Pointer(bp + 504 /* N */))) __348: ; returnSingleInt(tls, v, Xsqlite3_soft_heap_limit64(tls, int64(-1))) @@ -156093,14 +156601,14 @@ __348: // the hard heap limit. This allows an application to set a heap limit // constraint that cannot be relaxed by an untrusted SQL script. __54: - if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+664 /* &N1 */) == SQLITE_OK)) { + if !((zRight != 0) && (Xsqlite3DecOrHexToI64(tls, zRight, bp+512 /* &N1 */) == SQLITE_OK)) { goto __349 } iPrior = Xsqlite3_hard_heap_limit64(tls, int64(-1)) - if !((*(*Sqlite3_int64)(unsafe.Pointer(bp + 664 /* N1 */)) > int64(0)) && ((iPrior == int64(0)) || (iPrior > *(*Sqlite3_int64)(unsafe.Pointer(bp + 664 /* N1 */))))) { + if !((*(*Sqlite3_int64)(unsafe.Pointer(bp + 512 /* N1 */)) > int64(0)) && ((iPrior == int64(0)) || (iPrior > *(*Sqlite3_int64)(unsafe.Pointer(bp + 512 /* N1 */))))) { goto __350 } - Xsqlite3_hard_heap_limit64(tls, *(*Sqlite3_int64)(unsafe.Pointer(bp + 664 /* N1 */))) + Xsqlite3_hard_heap_limit64(tls, *(*Sqlite3_int64)(unsafe.Pointer(bp + 512 /* N1 */))) __350: ; __349: @@ -156115,11 +156623,11 @@ __349: // maximum, which might be less than requested. __55: if !(((zRight != 0) && - (Xsqlite3DecOrHexToI64(tls, zRight, bp+672 /* &N2 */) == SQLITE_OK)) && - (*(*Sqlite3_int64)(unsafe.Pointer(bp + 672 /* N2 */)) >= int64(0))) { + (Xsqlite3DecOrHexToI64(tls, zRight, bp+520 /* &N2 */) == SQLITE_OK)) && + (*(*Sqlite3_int64)(unsafe.Pointer(bp + 520 /* N2 */)) >= int64(0))) { goto __351 } - Xsqlite3_limit(tls, db, SQLITE_LIMIT_WORKER_THREADS, (int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 672 /* N2 */)) & int64(0x7fffffff)))) + Xsqlite3_limit(tls, db, SQLITE_LIMIT_WORKER_THREADS, (int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 520 /* N2 */)) & int64(0x7fffffff)))) __351: ; returnSingleInt(tls, v, int64(Xsqlite3_limit(tls, db, SQLITE_LIMIT_WORKER_THREADS, -1))) @@ -156132,11 +156640,11 @@ __351: // in each index that it looks at. Return the new limit. __56: if !(((zRight != 0) && - (Xsqlite3DecOrHexToI64(tls, zRight, bp+680 /* &N3 */) == SQLITE_OK)) && - (*(*Sqlite3_int64)(unsafe.Pointer(bp + 680 /* N3 */)) >= int64(0))) { + (Xsqlite3DecOrHexToI64(tls, zRight, bp+528 /* &N3 */) == SQLITE_OK)) && + (*(*Sqlite3_int64)(unsafe.Pointer(bp + 528 /* N3 */)) >= int64(0))) { goto __352 } - (*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit = (int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 680 /* N3 */)) & int64(0x7fffffff))) + (*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit = (int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 528 /* N3 */)) & int64(0x7fffffff))) __352: ; returnSingleInt(tls, v, int64((*Sqlite3)(unsafe.Pointer(db)).FnAnalysisLimit)) @@ -156199,14 +156707,14 @@ var endCode = [7]VdbeOpList{ {Fopcode: U8(OP_Goto), Fp2: int8(3)}, // 6 } /* sqlite3.c:130233:31 */ var encnames1 = [9]EncName{ - {FzName: ts + 17754 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, - {FzName: ts + 17759 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] - {FzName: ts + 17765 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] - {FzName: ts + 17774 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] - {FzName: ts + 17783 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, - {FzName: ts + 17791 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, - {FzName: ts + 17799 /* "UTF-16" */}, // SQLITE_UTF16NATIVE - {FzName: ts + 17806 /* "UTF16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 17769 /* "UTF8" */, Fenc: U8(SQLITE_UTF8)}, + {FzName: ts + 17774 /* "UTF-8" */, Fenc: U8(SQLITE_UTF8)}, // Must be element [1] + {FzName: ts + 17780 /* "UTF-16le" */, Fenc: U8(SQLITE_UTF16LE)}, // Must be element [2] + {FzName: ts + 17789 /* "UTF-16be" */, Fenc: U8(SQLITE_UTF16BE)}, // Must be element [3] + {FzName: ts + 17798 /* "UTF16le" */, Fenc: U8(SQLITE_UTF16LE)}, + {FzName: ts + 17806 /* "UTF16be" */, Fenc: U8(SQLITE_UTF16BE)}, + {FzName: ts + 17814 /* "UTF-16" */}, // SQLITE_UTF16NATIVE + {FzName: ts + 17821 /* "UTF16" */}, // SQLITE_UTF16NATIVE {}, } /* sqlite3.c:130285:7 */ var setCookie = [2]VdbeOpList{ @@ -156247,8 +156755,8 @@ type PragmaVtabCursor = PragmaVtabCursor1 /* sqlite3.c:130741:33 */ // Pragma virtual table module xConnect method. func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3.c:130759:12: */ - bp := tls.Alloc(288) - defer tls.Free(288) + bp := tls.Alloc(264) + defer tls.Free(264) var pPragma uintptr = pAux var pTab uintptr = uintptr(0) @@ -156256,14 +156764,14 @@ func pragmaVtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv var i int32 var j int32 var cSep int8 = int8('(') - // var acc StrAccum at bp+56, 32 + // var acc StrAccum at bp+32, 32 - // var zBuf [200]int8 at bp+88, 200 + // var zBuf [200]int8 at bp+64, 200 _ = argc _ = argv - Xsqlite3StrAccumInit(tls, bp+56 /* &acc */, uintptr(0), bp+88 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) - Xsqlite3_str_appendall(tls, bp+56 /* &acc */, ts+17812 /* "CREATE TABLE x" */) + Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), bp+64 /* &zBuf[0] */, int32(unsafe.Sizeof([200]int8{})), 0) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+17827 /* "CREATE TABLE x" */) i = 0 j = int32((*PragmaName)(unsafe.Pointer(pPragma)).FiPragCName) __1: @@ -156271,7 +156779,7 @@ __1: goto __3 } { - Xsqlite3_str_appendf(tls, bp+56 /* &acc */, ts+17827 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+17842 /* "%c\"%s\"" */, libc.VaList(bp, int32(cSep), pragCName[j])) cSep = int8(',') } @@ -156284,22 +156792,22 @@ __2: __3: ; if i == 0 { - Xsqlite3_str_appendf(tls, bp+56 /* &acc */, ts+17834 /* "(\"%s\"" */, libc.VaList(bp+24, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+17849 /* "(\"%s\"" */, libc.VaList(bp+16, (*PragmaName)(unsafe.Pointer(pPragma)).FzName)) i++ } j = 0 if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & PragFlg_Result1) != 0 { - Xsqlite3_str_appendall(tls, bp+56 /* &acc */, ts+17840 /* ",arg HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+17855 /* ",arg HIDDEN" */) j++ } if (int32((*PragmaName)(unsafe.Pointer(pPragma)).FmPragFlg) & (PragFlg_SchemaOpt | PragFlg_SchemaReq)) != 0 { - Xsqlite3_str_appendall(tls, bp+56 /* &acc */, ts+17852 /* ",schema HIDDEN" */) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+17867 /* ",schema HIDDEN" */) j++ } - Xsqlite3_str_append(tls, bp+56 /* &acc */, ts+5413 /* ")" */, 1) - Xsqlite3StrAccumFinish(tls, bp+56 /* &acc */) + Xsqlite3_str_append(tls, bp+32 /* &acc */, ts+5428 /* ")" */, 1) + Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) - rc = Xsqlite3_declare_vtab(tls, db, bp+88 /* &zBuf[0] */) + rc = Xsqlite3_declare_vtab(tls, db, bp+64 /* &zBuf[0] */) if rc == SQLITE_OK { pTab = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(PragmaVtab{}))) if pTab == uintptr(0) { @@ -156312,7 +156820,7 @@ __3: (*PragmaVtab)(unsafe.Pointer(pTab)).FnHidden = U8(j) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+40, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) } *(*uintptr)(unsafe.Pointer(ppVtab)) = pTab @@ -156446,15 +156954,15 @@ func pragmaVtabNext(tls *libc.TLS, pVtabCursor uintptr) int32 { /* sqlite3.c:130 // Pragma virtual table module xFilter method. func pragmaVtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3.c:130919:12: */ - bp := tls.Alloc(96) - defer tls.Free(96) + bp := tls.Alloc(64) + defer tls.Free(64) var pCsr uintptr = pVtabCursor var pTab uintptr = (*Sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab var rc int32 var i int32 var j int32 - // var acc StrAccum at bp+64, 32 + // var acc StrAccum at bp+32, 32 var zSql uintptr @@ -156475,7 +156983,7 @@ __1: var zText uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) if zText != 0 { - *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, zText)) + *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, zText)) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + uintptr(j)*8)) == uintptr(0) { return SQLITE_NOMEM } @@ -156490,23 +156998,23 @@ __2: goto __3 __3: ; - Xsqlite3StrAccumInit(tls, bp+64 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) - Xsqlite3_str_appendall(tls, bp+64 /* &acc */, ts+17867 /* "PRAGMA " */) + Xsqlite3StrAccumInit(tls, bp+32 /* &acc */, uintptr(0), uintptr(0), 0, *(*int32)(unsafe.Pointer(((*PragmaVtab)(unsafe.Pointer(pTab)).Fdb + 128 /* &.aLimit */) + 1*4))) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, ts+17882 /* "PRAGMA " */) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)) != 0 { - Xsqlite3_str_appendf(tls, bp+64 /* &acc */, ts+17875 /* "%Q." */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+17890 /* "%Q." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */) + 1*8)))) } - Xsqlite3_str_appendall(tls, bp+64 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) + Xsqlite3_str_appendall(tls, bp+32 /* &acc */, (*PragmaName)(unsafe.Pointer((*PragmaVtab)(unsafe.Pointer(pTab)).FpName)).FzName) if *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))) != 0 { - Xsqlite3_str_appendf(tls, bp+64 /* &acc */, ts+17879 /* "=%Q" */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) + Xsqlite3_str_appendf(tls, bp+32 /* &acc */, ts+17894 /* "=%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((pCsr + 24 /* &.azArg */))))) } - zSql = Xsqlite3StrAccumFinish(tls, bp+64 /* &acc */) + zSql = Xsqlite3StrAccumFinish(tls, bp+32 /* &acc */) if zSql == uintptr(0) { return SQLITE_NOMEM } rc = Xsqlite3_prepare_v2(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pPragma */), uintptr(0)) Xsqlite3_free(tls, zSql) if rc != SQLITE_OK { - (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+48, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) + (*PragmaVtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, (*PragmaVtab)(unsafe.Pointer(pTab)).Fdb))) return rc } return pragmaVtabNext(tls, pVtabCursor) @@ -156589,8 +157097,8 @@ func Xsqlite3PragmaVtabRegister(tls *libc.TLS, db uintptr, zName uintptr) uintpt // Fill the InitData structure with an error message that indicates // that the database is corrupt. func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) { /* sqlite3.c:131071:13: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(56) + defer tls.Free(56) var db uintptr = (*InitData)(unsafe.Pointer(pData)).Fdb if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { @@ -156599,12 +157107,12 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) // A error message has already been generated. Do not overwrite it } else if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & (U32(INITFLAG_AlterRename | INITFLAG_AlterDrop))) != 0 { *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = Xsqlite3MPrintf(tls, db, - ts+17883 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), + ts+17898 /* "error in %s %s a..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azObj)), *(*uintptr)(unsafe.Pointer(azObj + 1*8)), func() uintptr { if ((*InitData)(unsafe.Pointer(pData)).FmInitFlags & U32(INITFLAG_AlterRename)) != 0 { - return ts + 17911 /* "rename" */ + return ts + 17926 /* "rename" */ } - return ts + 17918 /* "drop column" */ + return ts + 17933 /* "drop column" */ }(), zExtra)) (*InitData)(unsafe.Pointer(pData)).Frc = SQLITE_ERROR @@ -156616,11 +157124,11 @@ func corruptSchema(tls *libc.TLS, pData uintptr, azObj uintptr, zExtra uintptr) if *(*uintptr)(unsafe.Pointer(azObj + 1*8)) != 0 { zObj = *(*uintptr)(unsafe.Pointer(azObj + 1*8)) } else { - zObj = ts + 5469 /* "?" */ + zObj = ts + 5484 /* "?" */ } - z = Xsqlite3MPrintf(tls, db, ts+17930 /* "malformed databa..." */, libc.VaList(bp+40, zObj)) + z = Xsqlite3MPrintf(tls, db, ts+17945 /* "malformed databa..." */, libc.VaList(bp+32, zObj)) if (zExtra != 0) && (*(*int8)(unsafe.Pointer(zExtra)) != 0) { - z = Xsqlite3MPrintf(tls, db, ts+17961 /* "%z - %s" */, libc.VaList(bp+56, z, zExtra)) + z = Xsqlite3MPrintf(tls, db, ts+17976 /* "%z - %s" */, libc.VaList(bp+40, z, zExtra)) } *(*uintptr)(unsafe.Pointer((*InitData)(unsafe.Pointer(pData)).FpzErrMsg)) = z (*InitData)(unsafe.Pointer(pData)).Frc = Xsqlite3CorruptError(tls, 131096) @@ -156697,7 +157205,7 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr if (Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (db+184 /* &.init */ /* &.newTnum */)) == 0) || (((*Sqlite3)(unsafe.Pointer(db)).Finit.FnewTnum > (*InitData)(unsafe.Pointer(pData)).FmxPage) && ((*InitData)(unsafe.Pointer(pData)).FmxPage > Pgno(0))) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+14202 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+14217 /* "invalid rootpage" */) } } libc.SetBitFieldPtr8Uint32(db+184 /* &.init */ +8 /* &.orphanTrigger */, uint32(0), 0, 0x1) @@ -156734,13 +157242,13 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr var pIndex uintptr pIndex = Xsqlite3FindIndex(tls, db, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName) if pIndex == uintptr(0) { - corruptSchema(tls, pData, argv, ts+17969 /* "orphan index" */) + corruptSchema(tls, pData, argv, ts+17984 /* "orphan index" */) } else if (((Xsqlite3GetUInt32(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (pIndex+88 /* &.tnum */)) == 0) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum < Pgno(2))) || ((*Index)(unsafe.Pointer(pIndex)).Ftnum > (*InitData)(unsafe.Pointer(pData)).FmxPage)) || (Xsqlite3IndexHasDuplicateRootPage(tls, pIndex) != 0) { if Xsqlite3Config.FbExtraSchemaChecks != 0 { - corruptSchema(tls, pData, argv, ts+14202 /* "invalid rootpage" */) + corruptSchema(tls, pData, argv, ts+14217 /* "invalid rootpage" */) } } } @@ -156754,18 +157262,18 @@ func Xsqlite3InitCallback(tls *libc.TLS, pInit uintptr, argc int32, argv uintptr // auxiliary databases. Return one of the SQLITE_ error codes to // indicate success or failure. func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFlags U32) int32 { /* sqlite3.c:131241:20: */ - bp := tls.Alloc(132) - defer tls.Free(132) + bp := tls.Alloc(124) + defer tls.Free(124) var rc int32 var i int32 var size int32 var pDb uintptr - // var azArg [6]uintptr at bp+24, 48 + // var azArg [6]uintptr at bp+16, 48 - // var meta [5]int32 at bp+112, 20 + // var meta [5]int32 at bp+104, 20 - // var initData InitData at bp+72, 40 + // var initData InitData at bp+64, 40 var zSchemaTabName uintptr var openedTransaction int32 @@ -156783,30 +157291,30 @@ func Xsqlite3InitOne(tls *libc.TLS, db uintptr, iDb int32, pzErrMsg uintptr, mFl // table name will be inserted automatically by the parser so we can just // use the abbreviation "x" here. The parser will also automatically tag // the schema table as read-only. - *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */)) = ts + 9170 /* "table" */ - *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */)) = ts + 9185 /* "table" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) = libc.AssignUintptr(&zSchemaTabName, func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }()) - *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */ + 1*8)) - *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */ + 3*8)) = ts + 8260 /* "1" */ - *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */ + 4*8)) = ts + 17982 /* "CREATE TABLE x(t..." */ - *(*uintptr)(unsafe.Pointer(bp + 24 /* &azArg[0] */ + 5*8)) = uintptr(0) - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).Fdb = db - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).FiDb = iDb - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).Frc = SQLITE_OK - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).FpzErrMsg = pzErrMsg - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).FmInitFlags = mFlags - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).FnInitRow = U32(0) - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).FmxPage = Pgno(0) - Xsqlite3InitCallback(tls, bp+72 /* &initData */, 5, bp+24 /* azArg */, uintptr(0)) + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 2*8)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 1*8)) + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 3*8)) = ts + 8275 /* "1" */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 4*8)) = ts + 17997 /* "CREATE TABLE x(t..." */ + *(*uintptr)(unsafe.Pointer(bp + 16 /* &azArg[0] */ + 5*8)) = uintptr(0) + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Fdb = db + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FiDb = iDb + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Frc = SQLITE_OK + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FpzErrMsg = pzErrMsg + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmInitFlags = mFlags + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FnInitRow = U32(0) + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Pgno(0) + Xsqlite3InitCallback(tls, bp+64 /* &initData */, 5, bp+16 /* azArg */, uintptr(0)) *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (U32(mask)) - if !((*InitData)(unsafe.Pointer(bp+72 /* &initData */)).Frc != 0) { + if !((*InitData)(unsafe.Pointer(bp+64 /* &initData */)).Frc != 0) { goto __1 } - rc = (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).Frc + rc = (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Frc goto error_out __1: ; @@ -156863,7 +157371,7 @@ __5: if !(i < (int32(uint64(unsafe.Sizeof([5]int32{})) / uint64(unsafe.Sizeof(int32(0)))))) { goto __7 } - Xsqlite3BtreeGetMeta(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (i + 1), (bp + 112 /* &meta */ + uintptr(i)*4)) + Xsqlite3BtreeGetMeta(tls, (*Db)(unsafe.Pointer(pDb)).FpBt, (i + 1), (bp + 104 /* &meta */ + uintptr(i)*4)) goto __6 __6: i++ @@ -156874,23 +157382,23 @@ __7: if !(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_ResetDatabase)) != uint64(0)) { goto __8 } - libc.Xmemset(tls, bp+112 /* &meta[0] */, 0, uint64(unsafe.Sizeof([5]int32{}))) + libc.Xmemset(tls, bp+104 /* &meta[0] */, 0, uint64(unsafe.Sizeof([5]int32{}))) __8: ; - (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fschema_cookie = *(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */)) + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fschema_cookie = *(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */)) // If opening a non-empty database, check the text encoding. For the // main database, set sqlite3.enc to the encoding of the main database. // For an attached db, it is an error if the encoding is not the same // as sqlite3.enc. - if !(*(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */ + 4*4)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 4*4)) != 0) { goto __9 } // text encoding if !((iDb == 0) && (((*Sqlite3)(unsafe.Pointer(db)).FmDbFlags & U32(DBFLAG_EncodingFixed)) == U32(0))) { goto __10 } // If opening the main database, set ENC(db). - encoding = (U8(int32(U8(*(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */ + 4*4)))) & 3)) + encoding = (U8(int32(U8(*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 4*4)))) & 3)) if !(int32(encoding) == 0) { goto __12 } @@ -156901,11 +157409,11 @@ __12: goto __11 __10: // If opening an attached database, the encoding much match ENC(db) - if !((*(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */ + 4*4)) & 3) != (int32((*Sqlite3)(unsafe.Pointer(db)).Fenc))) { + if !((*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 4*4)) & 3) != (int32((*Sqlite3)(unsafe.Pointer(db)).Fenc))) { goto __13 } Xsqlite3SetString(tls, pzErrMsg, db, - ts+11846 /* "attached databas..." */) + ts+11861 /* "attached databas..." */) rc = SQLITE_ERROR goto initone_error_out __13: @@ -156919,7 +157427,7 @@ __9: if !((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Fcache_size == 0) { goto __14 } - size = Xsqlite3AbsInt32(tls, *(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */ + 2*4))) + size = Xsqlite3AbsInt32(tls, *(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 2*4))) if !(size == 0) { goto __15 } @@ -156935,7 +157443,7 @@ __14: // file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN // file_format==3 Version 3.1.4. // ditto but with non-NULL defaults // file_format==4 Version 3.3.0. // DESC indices. Boolean constants - (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = U8(*(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */ + 1*4))) + (*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format = U8(*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 1*4))) if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) == 0) { goto __16 } @@ -156945,7 +157453,7 @@ __16: if !(int32((*Schema)(unsafe.Pointer((*Db)(unsafe.Pointer(pDb)).FpSchema)).Ffile_format) > SQLITE_MAX_FILE_FORMAT) { goto __17 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+18054 /* "unsupported file..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+18069 /* "unsupported file..." */) rc = SQLITE_ERROR goto initone_error_out __17: @@ -156955,7 +157463,7 @@ __17: // clear the legacy_file_format pragma flag so that a VACUUM will // not downgrade the database and thus invalidate any descending // indices that the user might have created. - if !((iDb == 0) && (*(*int32)(unsafe.Pointer(bp + 112 /* &meta[0] */ + 1*4)) >= 4)) { + if !((iDb == 0) && (*(*int32)(unsafe.Pointer(bp + 104 /* &meta[0] */ + 1*4)) >= 4)) { goto __18 } *(*U64)(unsafe.Pointer(db + 48 /* &.flags */)) &= (libc.CplUint64(uint64(SQLITE_LegacyFileFmt))) @@ -156964,23 +157472,23 @@ __18: // Read the schema information out of the schema tables - (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) + (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).FmxPage = Xsqlite3BtreeLastPage(tls, (*Db)(unsafe.Pointer(pDb)).FpBt) zSql = Xsqlite3MPrintf(tls, db, - ts+18078, /* "SELECT*FROM\"%w\"...." */ + ts+18093, /* "SELECT*FROM\"%w\"...." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zSchemaTabName)) xAuth = (*Sqlite3)(unsafe.Pointer(db)).FxAuth (*Sqlite3)(unsafe.Pointer(db)).FxAuth = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 - }{Xsqlite3InitCallback})), bp+72 /* &initData */, uintptr(0)) + }{Xsqlite3InitCallback})), bp+64 /* &initData */, uintptr(0)) (*Sqlite3)(unsafe.Pointer(db)).FxAuth = xAuth if !(rc == SQLITE_OK) { goto __19 } - rc = (*InitData)(unsafe.Pointer(bp + 72 /* &initData */)).Frc + rc = (*InitData)(unsafe.Pointer(bp + 64 /* &initData */)).Frc __19: ; Xsqlite3DbFree(tls, db, zSql) @@ -157252,26 +157760,26 @@ func Xsqlite3ParserAddCleanup(tls *libc.TLS, pParse uintptr, xCleanup uintptr, p // Compile the UTF-8 encoded SQL statement zSql into a statement handle. func sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepFlags U32, pReprepare uintptr, ppStmt uintptr, pzTail uintptr) int32 { /* sqlite3.c:131686:12: */ - bp := tls.Alloc(448) - defer tls.Free(448) + bp := tls.Alloc(432) + defer tls.Free(432) - // var zErrMsg uintptr at bp+440, 8 + // var zErrMsg uintptr at bp+424, 8 // Error message var rc int32 // Result code var i int32 // Loop counter - // var sParse Parse at bp+32, 408 + // var sParse Parse at bp+16, 408 var zDb uintptr var pBt uintptr var zSqlCopy uintptr var mxLen int32 var pT uintptr - *(*uintptr)(unsafe.Pointer(bp + 440 /* zErrMsg */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) = uintptr(0) rc = SQLITE_OK // Parsing context - libc.Xmemset(tls, bp+32 /* &sParse */, 0, uint64((uintptr(0) + 208 /* &.aTempReg */))) - libc.Xmemset(tls, ((bp + 32 /* &sParse */) + uintptr((uint64((uintptr(0) + 256 /* &.sLastToken */))))), 0, (uint64(unsafe.Sizeof(Parse{})) - (uint64((uintptr(0) + 256 /* &.sLastToken */))))) - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpReprepare = pReprepare + libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64((uintptr(0) + 208 /* &.aTempReg */))) + libc.Xmemset(tls, ((bp + 16 /* &sParse */) + uintptr((uint64((uintptr(0) + 256 /* &.sLastToken */))))), 0, (uint64(unsafe.Sizeof(Parse{})) - (uint64((uintptr(0) + 256 /* &.sLastToken */))))) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpReprepare = pReprepare // assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA @@ -157280,12 +157788,12 @@ func sqlite3Prepare(tls *libc.TLS, db uintptr, zSql uintptr, nBytes int32, prepF if !((prepFlags & U32(SQLITE_PREPARE_PERSISTENT)) != 0) { goto __1 } - (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FdisableLookaside++ + (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FdisableLookaside++ (*Sqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ (*Sqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = U16(0) __1: ; - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FdisableVtab = (U8(libc.Bool32((prepFlags & U32(SQLITE_PREPARE_NO_VTAB)) != U32(0)))) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FdisableVtab = (U8(libc.Bool32((prepFlags & U32(SQLITE_PREPARE_NO_VTAB)) != U32(0)))) // Check to verify that it is possible to get a read lock on all // database schemas. The inability to get a read lock indicates that @@ -157327,7 +157835,7 @@ __3: goto __7 } zDb = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(i)*32)).FzDbSName - Xsqlite3ErrorWithMsg(tls, db, rc, ts+18112 /* "database schema ..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+18127 /* "database schema ..." */, libc.VaList(bp, zDb)) goto end_prepare __7: @@ -157346,7 +157854,7 @@ __2: Xsqlite3VtabUnlockList(tls, db) - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).Fdb = db + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = db if !((nBytes >= 0) && ((nBytes == 0) || (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((nBytes - 1))))) != 0))) { goto __8 } @@ -157355,7 +157863,7 @@ __2: if !(nBytes > mxLen) { goto __10 } - Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+18142 /* "statement too lo..." */, 0) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_TOOBIG, ts+18157 /* "statement too lo..." */, 0) rc = Xsqlite3ApiExit(tls, db, SQLITE_TOOBIG) goto end_prepare __10: @@ -157364,62 +157872,62 @@ __10: if !(zSqlCopy != 0) { goto __11 } - Xsqlite3RunParser(tls, bp+32 /* &sParse */, zSqlCopy, bp+440 /* &zErrMsg */) - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FzTail = (zSql + uintptr(((int64((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzTail) - int64(zSqlCopy)) / 1))) + Xsqlite3RunParser(tls, bp+16 /* &sParse */, zSqlCopy, bp+424 /* &zErrMsg */) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FzTail = (zSql + uintptr(((int64((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzTail) - int64(zSqlCopy)) / 1))) Xsqlite3DbFree(tls, db, zSqlCopy) goto __12 __11: - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FzTail = (zSql + uintptr(nBytes)) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FzTail = (zSql + uintptr(nBytes)) __12: ; goto __9 __8: - Xsqlite3RunParser(tls, bp+32 /* &sParse */, zSql, bp+440 /* &zErrMsg */) + Xsqlite3RunParser(tls, bp+16 /* &sParse */, zSql, bp+424 /* &zErrMsg */) __9: ; if !(pzTail != 0) { goto __13 } - *(*uintptr)(unsafe.Pointer(pzTail)) = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FzTail + *(*uintptr)(unsafe.Pointer(pzTail)) = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FzTail __13: ; if !(int32((*Sqlite3)(unsafe.Pointer(db)).Finit.Fbusy) == 0) { goto __14 } - Xsqlite3VdbeSetSql(tls, (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpVdbe, zSql, (int32((int64((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FzTail) - int64(zSql)) / 1)), uint8(prepFlags)) + Xsqlite3VdbeSetSql(tls, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe, zSql, (int32((int64((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FzTail) - int64(zSql)) / 1)), uint8(prepFlags)) __14: ; if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { goto __15 } - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).Frc = SQLITE_NOMEM - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FcheckSchema = U8(0) + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Frc = SQLITE_NOMEM + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FcheckSchema = U8(0) __15: ; - if !(((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).Frc != SQLITE_DONE)) { + if !(((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).Frc != SQLITE_DONE)) { goto __16 } - if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FcheckSchema != 0) { + if !((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FcheckSchema != 0) { goto __18 } - schemaIsValid(tls, bp+32 /* &sParse */) + schemaIsValid(tls, bp+16 /* &sParse */) __18: ; - if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpVdbe != 0) { + if !((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe != 0) { goto __19 } - Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpVdbe) + Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe) __19: ; - rc = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).Frc - if !(*(*uintptr)(unsafe.Pointer(bp + 440 /* zErrMsg */)) != 0) { + rc = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Frc + if !(*(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)) != 0) { goto __20 } - Xsqlite3ErrorWithMsg(tls, db, rc, ts+3615 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 440 /* zErrMsg */)))) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 440 /* zErrMsg */))) + Xsqlite3ErrorWithMsg(tls, db, rc, ts+3630 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErrMsg */))) goto __21 __20: Xsqlite3Error(tls, db, rc) @@ -157428,7 +157936,7 @@ __21: goto __17 __16: ; - *(*uintptr)(unsafe.Pointer(ppStmt)) = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpVdbe + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpVdbe rc = SQLITE_OK Xsqlite3ErrorClear(tls, db) __17: @@ -157436,11 +157944,11 @@ __17: // Delete any TriggerPrg structures allocated while parsing this statement. __22: - if !((*Parse)(unsafe.Pointer(bp+32 /* &sParse */)).FpTriggerPrg != 0) { + if !((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpTriggerPrg != 0) { goto __23 } - pT = (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpTriggerPrg - (*Parse)(unsafe.Pointer(bp + 32 /* &sParse */)).FpTriggerPrg = (*TriggerPrg)(unsafe.Pointer(pT)).FpNext + pT = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpTriggerPrg + (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpTriggerPrg = (*TriggerPrg)(unsafe.Pointer(pT)).FpNext Xsqlite3DbFree(tls, db, pT) goto __22 __23: @@ -157448,7 +157956,7 @@ __23: end_prepare: - Xsqlite3ParserReset(tls, bp+32 /* &sParse */) + Xsqlite3ParserReset(tls, bp+16 /* &sParse */) return rc } @@ -157857,20 +158365,20 @@ func findRightmost(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:132257:15: * // If an illegal or unsupported join type is seen, then still return // a join type, but put an error in the pParse structure. func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC uintptr) int32 { /* sqlite3.c:132279:20: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(56) + defer tls.Free(56) var jointype int32 = 0 - // var apAll [3]uintptr at bp+40, 24 + // var apAll [3]uintptr at bp+32, 24 var p uintptr var i int32 var j int32 - *(*uintptr)(unsafe.Pointer(bp + 40 /* &apAll[0] */)) = pA - *(*uintptr)(unsafe.Pointer(bp + 40 /* &apAll[0] */ + 1*8)) = pB - *(*uintptr)(unsafe.Pointer(bp + 40 /* &apAll[0] */ + 2*8)) = pC - for i = 0; (i < 3) && (*(*uintptr)(unsafe.Pointer(bp + 40 /* &apAll[0] */ + uintptr(i)*8)) != 0); i++ { - p = *(*uintptr)(unsafe.Pointer(bp + 40 /* &apAll[0] */ + uintptr(i)*8)) + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */)) = pA + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + 1*8)) = pB + *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + 2*8)) = pC + for i = 0; (i < 3) && (*(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + uintptr(i)*8)) != 0); i++ { + p = *(*uintptr)(unsafe.Pointer(bp + 32 /* &apAll[0] */ + uintptr(i)*8)) for j = 0; j < (int32(uint64(unsafe.Sizeof(aKeyword)) / uint64(unsafe.Sizeof(struct { Fi U8 FnChar U8 @@ -157893,24 +158401,24 @@ func Xsqlite3JoinType(tls *libc.TLS, pParse uintptr, pA uintptr, pB uintptr, pC } } if ((jointype & (JT_INNER | JT_OUTER)) == (JT_INNER | JT_OUTER)) || ((jointype & JT_ERROR) != 0) { - var zSp uintptr = ts + 10999 /* " " */ + var zSp uintptr = ts + 11014 /* " " */ if pC == uintptr(0) { zSp++ } Xsqlite3ErrorMsg(tls, pParse, - ts+18161 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) + ts+18176 /* "unknown or unsup..." */, libc.VaList(bp, pA, pB, zSp, pC)) jointype = JT_INNER } else if ((jointype & JT_OUTER) != 0) && ((jointype & (JT_LEFT | JT_RIGHT)) != JT_LEFT) { Xsqlite3ErrorMsg(tls, pParse, - ts+18205 /* "RIGHT and FULL O..." */, 0) + ts+18220 /* "RIGHT and FULL O..." */, 0) jointype = JT_INNER } return jointype } -var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 18260 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ +var zKeyText = *(*[34]int8)(unsafe.Pointer(ts + 18275 /* "naturaleftouteri..." */)) /* sqlite3.c:132284:21 */ var aKeyword = [7]struct { Fi U8 FnChar U8 @@ -158085,8 +158593,8 @@ func unsetJoinExpr(tls *libc.TLS, p uintptr, iTable int32) { /* sqlite3.c:132479 // // This routine returns the number of errors encountered. func sqliteProcessJoin(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* sqlite3.c:132513:12: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) var pSrc uintptr // All tables in the FROM clause var i int32 @@ -158116,22 +158624,22 @@ __1: if (int32((*SrcItem)(unsafe.Pointer(pRight)).Ffg.Fjointype) & JT_NATURAL) != 0 { if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) || ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+18294 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) + ts+18309 /* "a NATURAL join m..." */, libc.VaList(bp, 0)) return 1 } for j = 0; j < int32((*Table)(unsafe.Pointer(pRightTab)).FnCol); j++ { var zName uintptr // Name of column in the right table - // var iLeft int32 at bp+32, 4 + // var iLeft int32 at bp+16, 4 // Matching left table - // var iLeftCol int32 at bp+36, 4 + // var iLeftCol int32 at bp+20, 4 // Matching column in the left table if (int32((*Column)(unsafe.Pointer(((*Table)(unsafe.Pointer(pRightTab)).FaCol + uintptr(j)*32))).FcolFlags) & COLFLAG_HIDDEN) != 0 { continue } zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pRightTab)).FaCol + uintptr(j)*32)).FzName - if tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+32 /* &iLeft */, bp+36 /* &iLeftCol */, 1) != 0 { - addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 32 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 36 /* iLeftCol */)), (i + 1), j, + if tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+16 /* &iLeft */, bp+20 /* &iLeftCol */, 1) != 0 { + addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 16 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 20 /* iLeftCol */)), (i + 1), j, isOuter, (p + 48 /* &.pWhere */)) } } @@ -158140,7 +158648,7 @@ __1: // Disallow both ON and USING clauses in the same join if ((*SrcItem)(unsafe.Pointer(pRight)).FpOn != 0) && ((*SrcItem)(unsafe.Pointer(pRight)).FpUsing != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+18344 /* "cannot have both..." */, 0) + ts+18359 /* "cannot have both..." */, 0) return 1 } @@ -158164,21 +158672,21 @@ __1: var pList uintptr = (*SrcItem)(unsafe.Pointer(pRight)).FpUsing for j = 0; j < (*IdList)(unsafe.Pointer(pList)).FnId; j++ { var zName uintptr // Name of the term in the USING clause - // var iLeft int32 at bp+40, 4 + // var iLeft int32 at bp+24, 4 // Table on the left with matching column name - // var iLeftCol int32 at bp+44, 4 + // var iLeftCol int32 at bp+28, 4 // Column number of matching column on the left var iRightCol int32 // Column number of matching column on the right zName = (*IdList_item)(unsafe.Pointer((*IdList)(unsafe.Pointer(pList)).Fa + uintptr(j)*16)).FzName iRightCol = Xsqlite3ColumnIndex(tls, pRightTab, zName) if (iRightCol < 0) || - !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+40 /* &iLeft */, bp+44 /* &iLeftCol */, 0) != 0) { + !(tableAndColumnIndex(tls, pSrc, (i+1), zName, bp+24 /* &iLeft */, bp+28 /* &iLeftCol */, 0) != 0) { Xsqlite3ErrorMsg(tls, pParse, - ts+18399 /* "cannot join usin..." */, libc.VaList(bp+16, zName)) + ts+18414 /* "cannot join usin..." */, libc.VaList(bp+8, zName)) return 1 } - addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 40 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 44 /* iLeftCol */)), (i + 1), iRightCol, + addWhereTerm(tls, pParse, pSrc, *(*int32)(unsafe.Pointer(bp + 24 /* iLeft */)), *(*int32)(unsafe.Pointer(bp + 28 /* iLeftCol */)), (i + 1), iRightCol, isOuter, (p + 48 /* &.pWhere */)) } } @@ -158966,16 +159474,16 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 var z uintptr switch id { case TK_ALL: - z = ts + 18463 /* "UNION ALL" */ + z = ts + 18478 /* "UNION ALL" */ break case TK_INTERSECT: - z = ts + 18473 /* "INTERSECT" */ + z = ts + 18488 /* "INTERSECT" */ break case TK_EXCEPT: - z = ts + 18483 /* "EXCEPT" */ + z = ts + 18498 /* "EXCEPT" */ break default: - z = ts + 18490 /* "UNION" */ + z = ts + 18505 /* "UNION" */ break } return z @@ -158990,10 +159498,10 @@ func Xsqlite3SelectOpName(tls *libc.TLS, id int32) uintptr { /* sqlite3.c:133540 // where xxx is one of "DISTINCT", "ORDER BY" or "GROUP BY". Exactly which // is determined by the zUsage argument. func explainTempTable(tls *libc.TLS, pParse uintptr, zUsage uintptr) { /* sqlite3.c:133562:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18496 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18511 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, zUsage)) } // Assign expression b to lvalue a. A second, no-op, version of this macro @@ -159259,8 +159767,8 @@ func columnTypeImpl(tls *libc.TLS, pNC uintptr, pExpr uintptr, pzOrigDb uintptr, } if iCol < 0 { - zType = ts + 12731 /* "INTEGER" */ - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 16110 /* "rowid" */ + zType = ts + 12746 /* "INTEGER" */ + *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = ts + 16125 /* "rowid" */ } else { *(*uintptr)(unsafe.Pointer(bp + 72 /* zOrigCol */)) = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName zType = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), uintptr(0)) @@ -159362,8 +159870,8 @@ func generateColumnTypes(tls *libc.TLS, pParse uintptr, pTabList uintptr, pEList // then the result column name with the table name // prefix, ex: TABLE.COLUMN. Otherwise use zSpan. func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) { /* sqlite3.c:134029:21: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe var i int32 @@ -159413,13 +159921,13 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } if iCol < 0 { - zCol = ts + 16110 /* "rowid" */ + zCol = ts + 16125 /* "rowid" */ } else { zCol = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } if fullName != 0 { var zName uintptr = uintptr(0) - zName = Xsqlite3MPrintf(tls, db, ts+12132 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) + zName = Xsqlite3MPrintf(tls, db, ts+12147 /* "%s.%s" */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, zCol)) Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zName, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3OomFault}))) } else { Xsqlite3VdbeSetColName(tls, v, i, COLNAME_NAME, zCol, libc.UintptrFromInt32(-1)) @@ -159427,7 +159935,7 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) } else { var z uintptr = (*ExprList_item)(unsafe.Pointer((pEList + 8 /* &.a */) + uintptr(i)*32)).FzEName if z == uintptr(0) { - z = Xsqlite3MPrintf(tls, db, ts+18519 /* "column%d" */, libc.VaList(bp+24, (i+1))) + z = Xsqlite3MPrintf(tls, db, ts+18534 /* "column%d" */, libc.VaList(bp+16, (i+1))) } else { z = Xsqlite3DbStrDup(tls, db, z) } @@ -159458,24 +159966,24 @@ func Xsqlite3GenerateColumnNames(tls *libc.TLS, pParse uintptr, pSelect uintptr) // // See Also: sqlite3GenerateColumnNames() func Xsqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, pnCol uintptr, paCol uintptr) int32 { /* sqlite3.c:134121:20: */ - bp := tls.Alloc(76) - defer tls.Free(76) + bp := tls.Alloc(60) + defer tls.Free(60) var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // Database connection var i int32 var j int32 // Loop counters - // var cnt U32 at bp+72, 4 + // var cnt U32 at bp+56, 4 // Index added to make the name unique var aCol uintptr var pCol uintptr // For looping over result columns var nCol int32 // Number of columns in the result set var zName uintptr // Column name var nName int32 // Size of name in zName[] - // var ht Hash at bp+48, 24 + // var ht Hash at bp+32, 24 // Hash table of column names var pTab uintptr - Xsqlite3HashInit(tls, bp+48 /* &ht */) + Xsqlite3HashInit(tls, bp+32 /* &ht */) if pEList != 0 { nCol = (*ExprList)(unsafe.Pointer(pEList)).FnExpr aCol = Xsqlite3DbMallocZero(tls, db, (uint64(unsafe.Sizeof(Column{})) * uint64(nCol))) @@ -159516,7 +160024,7 @@ __1: if iCol >= 0 { zName = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32)).FzName } else { - zName = ts + 16110 /* "rowid" */ + zName = ts + 16125 /* "rowid" */ } } else if int32((*Expr)(unsafe.Pointer(pColExpr)).Fop) == TK_ID { @@ -159529,13 +160037,13 @@ __1: if (zName != 0) && !(Xsqlite3IsTrueOrFalse(tls, zName) != 0) { zName = Xsqlite3DbStrDup(tls, db, zName) } else { - zName = Xsqlite3MPrintf(tls, db, ts+18519 /* "column%d" */, libc.VaList(bp, (i+1))) + zName = Xsqlite3MPrintf(tls, db, ts+18534 /* "column%d" */, libc.VaList(bp, (i+1))) } // Make sure the column name is unique. If the name is not unique, // append an integer to the name so that it becomes unique. - *(*U32)(unsafe.Pointer(bp + 72 /* cnt */)) = U32(0) - for (zName != 0) && (Xsqlite3HashFind(tls, bp+48 /* &ht */, zName) != uintptr(0)) { + *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) = U32(0) + for (zName != 0) && (Xsqlite3HashFind(tls, bp+32 /* &ht */, zName) != uintptr(0)) { nName = Xsqlite3Strlen30(tls, zName) if nName > 0 { for j = (nName - 1); (j > 0) && ((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zName + uintptr(j))))]) & 0x04) != 0); j-- { @@ -159544,15 +160052,15 @@ __1: nName = j } } - zName = Xsqlite3MPrintf(tls, db, ts+18528 /* "%.*z:%u" */, libc.VaList(bp+16, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 72 /* cnt */)), 1))) - if *(*U32)(unsafe.Pointer(bp + 72 /* cnt */)) > U32(3) { - Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+72 /* &cnt */) + zName = Xsqlite3MPrintf(tls, db, ts+18543 /* "%.*z:%u" */, libc.VaList(bp+8, nName, zName, libc.PreIncUint32(&*(*U32)(unsafe.Pointer(bp + 56 /* cnt */)), 1))) + if *(*U32)(unsafe.Pointer(bp + 56 /* cnt */)) > U32(3) { + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(U32(0))), bp+56 /* &cnt */) } } (*Column)(unsafe.Pointer(pCol)).FzName = zName (*Column)(unsafe.Pointer(pCol)).FhName = Xsqlite3StrIHash(tls, zName) - if (zName != 0) && (Xsqlite3HashInsert(tls, bp+48 /* &ht */, zName, pCol) == pCol) { + if (zName != 0) && (Xsqlite3HashInsert(tls, bp+32 /* &ht */, zName, pCol) == pCol) { Xsqlite3OomFault(tls, db) } @@ -159565,7 +160073,7 @@ __2: goto __3 __3: ; - Xsqlite3HashClear(tls, bp+48 /* &ht */) + Xsqlite3HashClear(tls, bp+32 /* &ht */) if (*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { for j = 0; j < i; j++ { Xsqlite3DbFree(tls, db, (*Column)(unsafe.Pointer(aCol+uintptr(j)*32)).FzName) @@ -159901,7 +160409,7 @@ func generateWithRecursiveQuery(tls *libc.TLS, pParse uintptr, p uintptr, pDest if !((*Select)(unsafe.Pointer(p)).FpWin != 0) { goto __1 } - Xsqlite3ErrorMsg(tls, pParse, ts+18536 /* "cannot use windo..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18551 /* "cannot use windo..." */, 0) return __1: ; @@ -160012,7 +160520,7 @@ __12: if !(((*Select)(unsafe.Pointer(pFirstRec)).FselFlags & U32(SF_Aggregate)) != 0) { goto __15 } - Xsqlite3ErrorMsg(tls, pParse, ts+18585 /* "recursive aggreg..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18600 /* "recursive aggreg..." */, 0) goto end_of_recursive_query __15: ; @@ -160034,7 +160542,7 @@ __14: // Store the results of the setup-query in Queue. pSetup = (*Select)(unsafe.Pointer(pFirstRec)).FpPrior (*Select)(unsafe.Pointer(pSetup)).FpNext = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18627 /* "SETUP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18642 /* "SETUP" */, 0) rc = Xsqlite3Select(tls, pParse, pSetup, bp /* &destQueue */) (*Select)(unsafe.Pointer(pSetup)).FpNext = p if !(rc != 0) { @@ -160077,7 +160585,7 @@ __20: // Execute the recursive SELECT taking the single row in Current as // the value for the recursive-table. Store the results in the Queue. (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = uintptr(0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18633 /* "RECURSIVE STEP" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18648 /* "RECURSIVE STEP" */, 0) Xsqlite3Select(tls, pParse, p, bp /* &destQueue */) (*Select)(unsafe.Pointer(pFirstRec)).FpPrior = pSetup @@ -160108,8 +160616,8 @@ end_of_recursive_query: // The sqlite3CodeSubselect will have added the LIMIT 1 clause in tht case. // Since the limit is exactly 1, we only need to evalutes the left-most VALUES. func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:134671:12: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var nRow int32 = 1 var rc int32 = 0 @@ -160127,11 +160635,11 @@ func multiSelectValues(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) p = (*Select)(unsafe.Pointer(p)).FpPrior nRow = nRow + (bShowAll) } - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18648 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+18663 /* "SCAN %d CONSTANT..." */, libc.VaList(bp, nRow, func() uintptr { if nRow == 1 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 18671 /* "S" */ + return ts + 18686 /* "S" */ }())) for p != 0 { selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, 1, 1) @@ -160184,18 +160692,18 @@ func hasAnchor(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:134708:12: */ // Notice that because of the way SQLite parses compound SELECTs, the // individual selects always group from left to right. func multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:134744:12: */ - bp := tls.Alloc(160) - defer tls.Free(160) + bp := tls.Alloc(144) + defer tls.Free(144) var rc int32 // Success code from a subroutine var pPrior uintptr // Another SELECT immediately to our left var v uintptr // Generate code to this VDBE - // var dest SelectDest at bp+32, 40 + // var dest SelectDest at bp+16, 40 // Alternative data destination var pDelete uintptr // Chain of simple selects to delete var db uintptr var addr int32 - // var nLimit int32 at bp+72, 4 + // var nLimit int32 at bp+56, 4 var iCont int32 var iBreak int32 @@ -160205,7 +160713,7 @@ func multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 var priorOp int32 // The SRT_ operation to apply to prior selects var pLimit uintptr // Saved values of p->nLimit var addr1 int32 - // var uniondest SelectDest at bp+80, 40 + // var uniondest SelectDest at bp+64, 40 var tab1 int32 var tab2 int32 @@ -160214,7 +160722,7 @@ func multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 var iStart1 int32 var pLimit1 uintptr var addr2 int32 - // var intersectdest SelectDest at bp+120, 40 + // var intersectdest SelectDest at bp+104, 40 var r1 int32 var addr3 int32 @@ -160232,18 +160740,18 @@ func multiSelect(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 db = (*Parse)(unsafe.Pointer(pParse)).Fdb pPrior = (*Select)(unsafe.Pointer(p)).FpPrior - *(*SelectDest)(unsafe.Pointer(bp + 32 /* dest */)) = *(*SelectDest)(unsafe.Pointer(pDest)) + *(*SelectDest)(unsafe.Pointer(bp + 16 /* dest */)) = *(*SelectDest)(unsafe.Pointer(pDest)) v = Xsqlite3GetVdbe(tls, pParse) // The VDBE already created by calling function // Create the destination temporary table if necessary - if !(int32((*SelectDest)(unsafe.Pointer(bp+32 /* &dest */)).FeDest) == SRT_EphemTab) { + if !(int32((*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FeDest) == SRT_EphemTab) { goto __1 } - Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*SelectDest)(unsafe.Pointer(bp+32 /* &dest */)).FiSDParm, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr) - (*SelectDest)(unsafe.Pointer(bp + 32 /* &dest */)).FeDest = U8(SRT_Table) + Xsqlite3VdbeAddOp2(tls, v, OP_OpenEphemeral, (*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FiSDParm, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr) + (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FeDest = U8(SRT_Table) __1: ; @@ -160251,7 +160759,7 @@ __1: if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) != 0) { goto __2 } - rc = multiSelectValues(tls, pParse, p, bp+32 /* &dest */) + rc = multiSelectValues(tls, pParse, p, bp+16 /* &dest */) if !(rc >= 0) { goto __3 } @@ -160268,7 +160776,7 @@ __2: if !((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Recursive)) != U32(0)) && (hasAnchor(tls, p) != 0)) { goto __4 } - generateWithRecursiveQuery(tls, pParse, p, bp+32 /* &dest */) + generateWithRecursiveQuery(tls, pParse, p, bp+16 /* &dest */) goto __5 __4: @@ -160283,8 +160791,8 @@ __6: if !((*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0)) { goto __8 } - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18673 /* "COMPOUND QUERY" */, 0) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18688 /* "LEFT-MOST SUBQUE..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18688 /* "COMPOUND QUERY" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18703 /* "LEFT-MOST SUBQUE..." */, 0) __8: ; @@ -160302,13 +160810,13 @@ __8: goto __9 __10: addr = 0 - *(*int32)(unsafe.Pointer(bp + 72 /* nLimit */)) = 0 // Initialize to suppress harmless compiler warning + *(*int32)(unsafe.Pointer(bp + 56 /* nLimit */)) = 0 // Initialize to suppress harmless compiler warning (*Select)(unsafe.Pointer(pPrior)).FiLimit = (*Select)(unsafe.Pointer(p)).FiLimit (*Select)(unsafe.Pointer(pPrior)).FiOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(pPrior)).FpLimit = (*Select)(unsafe.Pointer(p)).FpLimit - rc = Xsqlite3Select(tls, pParse, pPrior, bp+32 /* &dest */) + rc = Xsqlite3Select(tls, pParse, pPrior, bp+16 /* &dest */) (*Select)(unsafe.Pointer(pPrior)).FpLimit = uintptr(0) if !(rc != 0) { goto __14 @@ -160333,19 +160841,19 @@ __16: ; __15: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18463 /* "UNION ALL" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18478 /* "UNION ALL" */, 0) - rc = Xsqlite3Select(tls, pParse, p, bp+32 /* &dest */) + rc = Xsqlite3Select(tls, pParse, p, bp+16 /* &dest */) pDelete = (*Select)(unsafe.Pointer(p)).FpPrior (*Select)(unsafe.Pointer(p)).FpPrior = pPrior (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEstAdd(tls, (*Select)(unsafe.Pointer(p)).FnSelectRow, (*Select)(unsafe.Pointer(pPrior)).FnSelectRow) if !(((((*Select)(unsafe.Pointer(p)).FpLimit != 0) && - (Xsqlite3ExprIsInteger(tls, (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpLimit)).FpLeft, bp+72 /* &nLimit */) != 0)) && - (*(*int32)(unsafe.Pointer(bp + 72 /* nLimit */)) > 0)) && (int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > int32(Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp + 72 /* nLimit */))))))) { + (Xsqlite3ExprIsInteger(tls, (*Expr)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpLimit)).FpLeft, bp+56 /* &nLimit */) != 0)) && + (*(*int32)(unsafe.Pointer(bp + 56 /* nLimit */)) > 0)) && (int32((*Select)(unsafe.Pointer(p)).FnSelectRow) > int32(Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp + 56 /* nLimit */))))))) { goto __17 } - (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp + 72 /* nLimit */)))) + (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3LogEst(tls, U64(*(*int32)(unsafe.Pointer(bp + 56 /* nLimit */)))) __17: ; if !(addr != 0) { @@ -160361,13 +160869,13 @@ __12: // Cursor number of the temp table holding result op = U8(0) priorOp = SRT_Union - if !(int32((*SelectDest)(unsafe.Pointer(bp+32 /* &dest */)).FeDest) == priorOp) { + if !(int32((*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FeDest) == priorOp) { goto __19 } // We can reuse a temporary table generated by a SELECT to our // right. // Not allowed on leftward elements - unionTab = (*SelectDest)(unsafe.Pointer(bp + 32 /* &dest */)).FiSDParm + unionTab = (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FiSDParm goto __20 __19: // We will need to create our own temporary table to hold the @@ -160384,9 +160892,9 @@ __20: // Code the SELECT statements to our left - Xsqlite3SelectDestInit(tls, bp+80 /* &uniondest */, priorOp, unionTab) + Xsqlite3SelectDestInit(tls, bp+64 /* &uniondest */, priorOp, unionTab) - rc = Xsqlite3Select(tls, pParse, pPrior, bp+80 /* &uniondest */) + rc = Xsqlite3Select(tls, pParse, pPrior, bp+64 /* &uniondest */) if !(rc != 0) { goto __21 } @@ -160408,10 +160916,10 @@ __23: (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) pLimit = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) - (*SelectDest)(unsafe.Pointer(bp + 80 /* &uniondest */)).FeDest = op - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18707 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + (*SelectDest)(unsafe.Pointer(bp + 64 /* &uniondest */)).FeDest = op + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18722 /* "%s USING TEMP B-..." */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) - rc = Xsqlite3Select(tls, pParse, p, bp+80 /* &uniondest */) + rc = Xsqlite3Select(tls, pParse, p, bp+64 /* &uniondest */) pDelete = (*Select)(unsafe.Pointer(p)).FpPrior (*Select)(unsafe.Pointer(p)).FpPrior = pPrior @@ -160430,7 +160938,7 @@ __24: // Convert the data in the temporary table into whatever form // it is that we currently need. - if !((int32((*SelectDest)(unsafe.Pointer(bp+32 /* &dest */)).FeDest) != priorOp) && (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0)) { + if !((int32((*SelectDest)(unsafe.Pointer(bp+16 /* &dest */)).FeDest) != priorOp) && (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0)) { goto __25 } iBreak = Xsqlite3VdbeMakeLabel(tls, pParse) @@ -160439,7 +160947,7 @@ __24: Xsqlite3VdbeAddOp2(tls, v, OP_Rewind, unionTab, iBreak) iStart = Xsqlite3VdbeCurrentAddr(tls, v) selectInnerLoop(tls, pParse, p, unionTab, - uintptr(0), uintptr(0), bp+32 /* &dest */, iCont, iBreak) + uintptr(0), uintptr(0), bp+16 /* &dest */, iCont, iBreak) Xsqlite3VdbeResolveLabel(tls, v, iCont) Xsqlite3VdbeAddOp2(tls, v, OP_Next, unionTab, iStart) Xsqlite3VdbeResolveLabel(tls, v, iBreak) @@ -160463,9 +160971,9 @@ __13: *(*U32)(unsafe.Pointer(findRightmost(tls, p) + 4 /* &.selFlags */)) |= (U32(SF_UsesEphemeral)) // Code the SELECTs to our left into temporary table "tab1". - Xsqlite3SelectDestInit(tls, bp+120 /* &intersectdest */, SRT_Union, tab1) + Xsqlite3SelectDestInit(tls, bp+104 /* &intersectdest */, SRT_Union, tab1) - rc = Xsqlite3Select(tls, pParse, pPrior, bp+120 /* &intersectdest */) + rc = Xsqlite3Select(tls, pParse, pPrior, bp+104 /* &intersectdest */) if !(rc != 0) { goto __26 } @@ -160480,10 +160988,10 @@ __26: (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) pLimit1 = (*Select)(unsafe.Pointer(p)).FpLimit (*Select)(unsafe.Pointer(p)).FpLimit = uintptr(0) - (*SelectDest)(unsafe.Pointer(bp + 120 /* &intersectdest */)).FiSDParm = tab2 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18707 /* "%s USING TEMP B-..." */, libc.VaList(bp+16, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + (*SelectDest)(unsafe.Pointer(bp + 104 /* &intersectdest */)).FiSDParm = tab2 + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18722 /* "%s USING TEMP B-..." */, libc.VaList(bp+8, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) - rc = Xsqlite3Select(tls, pParse, p, bp+120 /* &intersectdest */) + rc = Xsqlite3Select(tls, pParse, p, bp+104 /* &intersectdest */) pDelete = (*Select)(unsafe.Pointer(p)).FpPrior (*Select)(unsafe.Pointer(p)).FpPrior = pPrior @@ -160515,7 +161023,7 @@ __28: Xsqlite3ReleaseTempReg(tls, pParse, r1) selectInnerLoop(tls, pParse, p, tab1, - uintptr(0), uintptr(0), bp+32 /* &dest */, iCont1, iBreak1) + uintptr(0), uintptr(0), bp+16 /* &dest */, iCont1, iBreak1) Xsqlite3VdbeResolveLabel(tls, v, iCont1) Xsqlite3VdbeAddOp2(tls, v, OP_Next, tab1, iStart1) Xsqlite3VdbeResolveLabel(tls, v, iBreak1) @@ -160629,8 +161137,8 @@ __31: ; multi_select_end: - (*SelectDest)(unsafe.Pointer(pDest)).FiSdst = (*SelectDest)(unsafe.Pointer(bp + 32 /* &dest */)).FiSdst - (*SelectDest)(unsafe.Pointer(pDest)).FnSdst = (*SelectDest)(unsafe.Pointer(bp + 32 /* &dest */)).FnSdst + (*SelectDest)(unsafe.Pointer(pDest)).FiSdst = (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FiSdst + (*SelectDest)(unsafe.Pointer(pDest)).FnSdst = (*SelectDest)(unsafe.Pointer(bp + 16 /* &dest */)).FnSdst Xsqlite3SelectDelete(tls, db, pDelete) return rc } @@ -160638,14 +161146,14 @@ multi_select_end: // Error message for when two or more terms of a compound select have different // size result sets. func Xsqlite3SelectWrongNumTermsError(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:135095:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) if ((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Values)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+18728 /* "all VALUES must ..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+18743 /* "all VALUES must ..." */, 0) } else { Xsqlite3ErrorMsg(tls, pParse, - ts+18774, /* "SELECTs to the l..." */ + ts+18789, /* "SELECTs to the l..." */ libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) } } @@ -160865,16 +161373,16 @@ func generateOutputSubroutine(tls *libc.TLS, pParse uintptr, p uintptr, pIn uint // until all data is exhausted then jump to the "end" labe. AltB, AeqB, // and AgtB jump to either L2 or to one of EofA or EofB. func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:135333:12: */ - bp := tls.Alloc(96) - defer tls.Free(96) + bp := tls.Alloc(88) + defer tls.Free(88) var i int32 var j int32 // Loop counters var pPrior uintptr // Another SELECT immediately to our left var v uintptr // Generate code to this VDBE - // var destA SelectDest at bp+16, 40 + // var destA SelectDest at bp+8, 40 // Destination for coroutine A - // var destB SelectDest at bp+56, 40 + // var destB SelectDest at bp+48, 40 // Destination for coroutine B var regAddrA int32 // Address register for select-A coroutine var regAddrB int32 // Address register for select-B coroutine @@ -161025,9 +161533,9 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Separate the left and the right query from one another (*Select)(unsafe.Pointer(p)).FpPrior = uintptr(0) (*Select)(unsafe.Pointer(pPrior)).FpNext = uintptr(0) - Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+7598 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, p, (*Select)(unsafe.Pointer(p)).FpOrderBy, ts+7613 /* "ORDER" */) if (*Select)(unsafe.Pointer(pPrior)).FpPrior == uintptr(0) { - Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+7598 /* "ORDER" */) + Xsqlite3ResolveOrderGroupBy(tls, pParse, pPrior, (*Select)(unsafe.Pointer(pPrior)).FpOrderBy, ts+7613 /* "ORDER" */) } // Compute the limit registers @@ -161053,10 +161561,10 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) regAddrB = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) regOutA = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) regOutB = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) - Xsqlite3SelectDestInit(tls, bp+16 /* &destA */, SRT_Coroutine, regAddrA) - Xsqlite3SelectDestInit(tls, bp+56 /* &destB */, SRT_Coroutine, regAddrB) + Xsqlite3SelectDestInit(tls, bp+8 /* &destA */, SRT_Coroutine, regAddrA) + Xsqlite3SelectDestInit(tls, bp+48 /* &destB */, SRT_Coroutine, regAddrB) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18856 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18871 /* "MERGE (%s)" */, libc.VaList(bp, Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(p)).Fop)))) // Generate a coroutine to evaluate the SELECT statement to the // left of the compound operator - the "A" select. @@ -161064,8 +161572,8 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) addr1 = Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, regAddrA, 0, addrSelectA) (*Select)(unsafe.Pointer(pPrior)).FiLimit = regLimitA - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18867 /* "LEFT" */, 0) - Xsqlite3Select(tls, pParse, pPrior, bp+16 /* &destA */) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18882 /* "LEFT" */, 0) + Xsqlite3Select(tls, pParse, pPrior, bp+8 /* &destA */) Xsqlite3VdbeEndCoroutine(tls, v, regAddrA) Xsqlite3VdbeJumpHere(tls, v, addr1) @@ -161078,8 +161586,8 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) savedOffset = (*Select)(unsafe.Pointer(p)).FiOffset (*Select)(unsafe.Pointer(p)).FiLimit = regLimitB (*Select)(unsafe.Pointer(p)).FiOffset = 0 - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18872 /* "RIGHT" */, 0) - Xsqlite3Select(tls, pParse, p, bp+56 /* &destB */) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+18887 /* "RIGHT" */, 0) + Xsqlite3Select(tls, pParse, p, bp+48 /* &destB */) (*Select)(unsafe.Pointer(p)).FiLimit = savedLimit (*Select)(unsafe.Pointer(p)).FiOffset = savedOffset Xsqlite3VdbeEndCoroutine(tls, v, regAddrB) @@ -161088,7 +161596,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // select as the next output row of the compound select. addrOutA = generateOutputSubroutine(tls, pParse, - p, bp+16 /* &destA */, pDest, regOutA, + p, bp+8 /* &destA */, pDest, regOutA, regPrev, pKeyDup, labelEnd) // Generate a subroutine that outputs the current row of the B @@ -161096,7 +161604,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) if (op == TK_ALL) || (op == TK_UNION) { addrOutB = generateOutputSubroutine(tls, pParse, - p, bp+56 /* &destB */, pDest, regOutB, + p, bp+48 /* &destB */, pDest, regOutB, regPrev, pKeyDup, labelEnd) } Xsqlite3KeyInfoUnref(tls, pKeyDup) @@ -161163,7 +161671,7 @@ func multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) // Implement the main merge loop Xsqlite3VdbeResolveLabel(tls, v, labelCmpr) Xsqlite3VdbeAddOp4(tls, v, OP_Permutation, 0, 0, 0, aPermute, -15) - Xsqlite3VdbeAddOp4(tls, v, OP_Compare, (*SelectDest)(unsafe.Pointer(bp+16 /* &destA */)).FiSdst, (*SelectDest)(unsafe.Pointer(bp+56 /* &destB */)).FiSdst, nOrderBy, + Xsqlite3VdbeAddOp4(tls, v, OP_Compare, (*SelectDest)(unsafe.Pointer(bp+8 /* &destA */)).FiSdst, (*SelectDest)(unsafe.Pointer(bp+48 /* &destB */)).FiSdst, nOrderBy, pKeyMerge, -9) Xsqlite3VdbeChangeP5(tls, v, uint16(OPFLAG_PERMUTE)) Xsqlite3VdbeAddOp3(tls, v, OP_Jump, addrAltB, addrAeqB, addrAgtB) @@ -161275,7 +161783,7 @@ func substExpr(tls *libc.TLS, pSubst uintptr, pExpr uintptr) uintptr { /* sqlite if pColl != 0 { return (*CollSeq)(unsafe.Pointer(pColl)).FzName } - return ts + 303 /* "BINARY" */ + return ts + 318 /* "BINARY" */ }()) } *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) &= (libc.Uint32FromInt32(libc.CplInt32(EP_Collate))) @@ -162488,12 +162996,12 @@ func minMaxQuery(tls *libc.TLS, db uintptr, pFunc uintptr, ppMinMax uintptr) U8 return U8(eRet) } zFunc = *(*uintptr)(unsafe.Pointer(pFunc + 8 /* &.u */)) - if Xsqlite3StrICmp(tls, zFunc, ts+15191 /* "min" */) == 0 { + if Xsqlite3StrICmp(tls, zFunc, ts+15206 /* "min" */) == 0 { eRet = WHERE_ORDERBY_MIN if Xsqlite3ExprCanBeNull(tls, (*ExprList_item)(unsafe.Pointer((pEList+8 /* &.a */))).FpExpr) != 0 { sortFlags = U8(KEYINFO_ORDER_BIGNULL) } - } else if Xsqlite3StrICmp(tls, zFunc, ts+15195 /* "max" */) == 0 { + } else if Xsqlite3StrICmp(tls, zFunc, ts+15210 /* "max" */) == 0 { eRet = WHERE_ORDERBY_MAX sortFlags = U8(KEYINFO_ORDER_DESC) } else { @@ -162552,8 +163060,8 @@ func isSimpleCount(tls *libc.TLS, p uintptr, pAggInfo uintptr) uintptr { /* sqli // SQLITE_ERROR and leave an error in pParse. Otherwise, populate // pFrom->pIndex and return SQLITE_OK. func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* sqlite3.c:137011:20: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pTab uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpTab var zIndexedBy uintptr = *(*uintptr)(unsafe.Pointer(pFrom + 96 /* &.u1 */)) @@ -162562,7 +163070,7 @@ func Xsqlite3IndexedByLookup(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; (pIdx != 0) && (Xsqlite3StrICmp(tls, (*Index)(unsafe.Pointer(pIdx)).FzName, zIndexedBy) != 0); pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { } if !(pIdx != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+18878 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) + Xsqlite3ErrorMsg(tls, pParse, ts+18893 /* "no such index: %..." */, libc.VaList(bp, zIndexedBy, 0)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) return SQLITE_ERROR } @@ -162669,11 +163177,11 @@ func convertCompoundSelectToSubquery(tls *libc.TLS, pWalker uintptr, p uintptr) // arguments. If it does, leave an error message in pParse and return // non-zero, since pFrom is not allowed to be a table-valued function. func cannotBeFunction(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* sqlite3.c:137117:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) if (uint32(int32(*(*uint16)(unsafe.Pointer(pFrom + 60 /* &.fg */ + 4 /* &.isTabFunc */)) & 0x4 >> 2))) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+18896 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+18911 /* "'%s' is not a fu..." */, libc.VaList(bp, (*SrcItem)(unsafe.Pointer(pFrom)).FzName)) return 1 } return 0 @@ -162756,11 +163264,11 @@ func Xsqlite3WithPush(tls *libc.TLS, pParse uintptr, pWith uintptr, bFree U8) ui // Return 1 if a match is found. // Return 2 if an error condition is detected. func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom uintptr) int32 { /* sqlite3.c:137206:12: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(48) + defer tls.Free(48) var pCte uintptr // Matched CTE (or NULL if no match) - // var pWith uintptr at bp+64, 8 + // var pWith uintptr at bp+40, 8 // The matching WITH if (*Parse)(unsafe.Pointer(pParse)).FpWith == uintptr(0) { @@ -162784,7 +163292,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom // (2) This is the first term in the FROM clause of an UPDATE. return 0 } - pCte = searchWith(tls, (*Parse)(unsafe.Pointer(pParse)).FpWith, pFrom, bp+64 /* &pWith */) + pCte = searchWith(tls, (*Parse)(unsafe.Pointer(pParse)).FpWith, pFrom, bp+40 /* &pWith */) if pCte != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb var pTab uintptr @@ -162861,7 +163369,7 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom libc.SetBitFieldPtr16Uint32(pItem+60 /* &.fg */ +4 /* &.isRecursive */, uint32(1), 5, 0x20) if ((*Select)(unsafe.Pointer(pRecTerm)).FselFlags & U32(SF_Recursive)) != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+18919 /* "multiple referen..." */, libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName)) + ts+18934 /* "multiple referen..." */, libc.VaList(bp+8, (*Cte)(unsafe.Pointer(pCte)).FzName)) return 2 } *(*U32)(unsafe.Pointer(pRecTerm + 4 /* &.selFlags */)) |= (U32(SF_Recursive)) @@ -162877,9 +163385,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom pRecTerm = (*Select)(unsafe.Pointer(pRecTerm)).FpPrior } - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18962 /* "circular referen..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 18977 /* "circular referen..." */ pSavedWith = (*Parse)(unsafe.Pointer(pParse)).FpWith - (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 64 /* pWith */)) + (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { var rc int32 @@ -162896,15 +163404,15 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom return 2 } } - (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 64 /* pWith */)) + (*Parse)(unsafe.Pointer(pParse)).FpWith = *(*uintptr)(unsafe.Pointer(bp + 40 /* pWith */)) for pLeft = pSel; (*Select)(unsafe.Pointer(pLeft)).FpPrior != 0; pLeft = (*Select)(unsafe.Pointer(pLeft)).FpPrior { } pEList = (*Select)(unsafe.Pointer(pLeft)).FpEList if (*Cte)(unsafe.Pointer(pCte)).FpCols != 0 { if (pEList != 0) && ((*ExprList)(unsafe.Pointer(pEList)).FnExpr != (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr) { - Xsqlite3ErrorMsg(tls, pParse, ts+18985, /* "table %s has %d ..." */ - libc.VaList(bp+32, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) + Xsqlite3ErrorMsg(tls, pParse, ts+19000, /* "table %s has %d ..." */ + libc.VaList(bp+16, (*Cte)(unsafe.Pointer(pCte)).FzName, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, (*ExprList)(unsafe.Pointer((*Cte)(unsafe.Pointer(pCte)).FpCols)).FnExpr)) (*Parse)(unsafe.Pointer(pParse)).FpWith = pSavedWith return 2 } @@ -162914,9 +163422,9 @@ func resolveFromTermToCte(tls *libc.TLS, pParse uintptr, pWalker uintptr, pFrom Xsqlite3ColumnsFromExprList(tls, pParse, pEList, (pTab + 70 /* &.nCol */), (pTab + 8 /* &.aCol */)) if bMayRecursive != 0 { if ((*Select)(unsafe.Pointer(pSel)).FselFlags & U32(SF_Recursive)) != 0 { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 19023 /* "multiple recursi..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 19038 /* "multiple recursi..." */ } else { - (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 19057 /* "recursive refere..." */ + (*Cte)(unsafe.Pointer(pCte)).FzCteErr = ts + 19072 /* "recursive refere..." */ } Xsqlite3WalkSelect(tls, pWalker, pSel) } @@ -162950,8 +163458,8 @@ func Xsqlite3SelectPopWith(tls *libc.TLS, pWalker uintptr, p uintptr) { /* sqlit // SQLITE_OK is returned. Otherwise, if an OOM error is encountered, // SQLITE_NOMEM. func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 { /* sqlite3.c:137405:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pSel uintptr = (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect var pTab uintptr @@ -162964,7 +163472,7 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 if (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias != 0 { (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3DbStrDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*SrcItem)(unsafe.Pointer(pFrom)).FzAlias) } else { - (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+19095 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) + (*Table)(unsafe.Pointer(pTab)).FzName = Xsqlite3MPrintf(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, ts+19110 /* "subquery_%u" */, libc.VaList(bp, (*Select)(unsafe.Pointer(pSel)).FselId)) } for (*Select)(unsafe.Pointer(pSel)).FpPrior != 0 { pSel = (*Select)(unsafe.Pointer(pSel)).FpPrior @@ -163004,8 +163512,8 @@ func Xsqlite3ExpandSubquery(tls *libc.TLS, pParse uintptr, pFrom uintptr) int32 // and TABLE.* to be every column in TABLE. // func selectExpander(tls *libc.TLS, pWalker uintptr, p uintptr) int32 { /* sqlite3.c:137457:12: */ - bp := tls.Alloc(136) - defer tls.Free(136) + bp := tls.Alloc(88) + defer tls.Free(88) var pParse uintptr = (*Walker)(unsafe.Pointer(pWalker)).FpParse var i int32 @@ -163091,7 +163599,7 @@ __1: return WRC_Abort } if (*Table)(unsafe.Pointer(pTab)).FnTabRef >= U32(0xffff) { - Xsqlite3ErrorMsg(tls, pParse, ts+19107, /* "too many referen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+19122, /* "too many referen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) (*SrcItem)(unsafe.Pointer(pFrom)).FpTab = uintptr(0) return WRC_Abort @@ -163110,16 +163618,16 @@ __1: if (((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_EnableView)) == uint64(0))) && ((*Table)(unsafe.Pointer(pTab)).FpSchema != (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+1*32)).FpSchema) { - Xsqlite3ErrorMsg(tls, pParse, ts+19146, /* "access to view \"..." */ - libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+19161, /* "access to view \"..." */ + libc.VaList(bp+8, (*Table)(unsafe.Pointer(pTab)).FzName)) } if ((((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) && ((uint32(int32(*(*uint16)(unsafe.Pointer((pFrom + 60 /* &.fg */) + 4 /* &.fromDDL */)) & 0x40 >> 6))) != 0)) && ((*Table)(unsafe.Pointer(pTab)).FpVTable != uintptr(0))) && (int32((*VTable)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FpVTable)).FeVtabRisk) > (libc.Bool32(((*Sqlite3)(unsafe.Pointer(db)).Fflags & uint64(SQLITE_TrustedSchema)) != uint64(0)))) { - Xsqlite3ErrorMsg(tls, pParse, ts+19177, /* "unsafe use of vi..." */ - libc.VaList(bp+32, (*Table)(unsafe.Pointer(pTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+19192, /* "unsafe use of vi..." */ + libc.VaList(bp+16, (*Table)(unsafe.Pointer(pTab)).FzName)) } (*SrcItem)(unsafe.Pointer(pFrom)).FpSelect = Xsqlite3SelectDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSelect, 0) nCol = (*Table)(unsafe.Pointer(pTab)).FnCol @@ -163233,14 +163741,14 @@ __3: if iDb >= 0 { zSchemaName = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName } else { - zSchemaName = ts + 19210 /* "*" */ + zSchemaName = ts + 19225 /* "*" */ } } for j = 0; j < int32((*Table)(unsafe.Pointer(pTab)).FnCol); j++ { var zName uintptr = (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName var zColname uintptr // The computed column name var zToFree uintptr // Malloced string that needs to be freed - // var sColname Token at bp+120, 16 + // var sColname Token at bp+72, 16 // Computed column name as a token if ((zTName != 0) && (pSub != 0)) && @@ -163282,15 +163790,15 @@ __3: pExpr = Xsqlite3PExpr(tls, pParse, TK_DOT, pLeft, pExpr) } if longNames != 0 { - zColname = Xsqlite3MPrintf(tls, db, ts+12132 /* "%s.%s" */, libc.VaList(bp+48, zTabName, zName)) + zColname = Xsqlite3MPrintf(tls, db, ts+12147 /* "%s.%s" */, libc.VaList(bp+24, zTabName, zName)) zToFree = zColname } } else { pExpr = pRight } pNew = Xsqlite3ExprListAppend(tls, pParse, pNew, pExpr) - Xsqlite3TokenInit(tls, bp+120 /* &sColname */, zColname) - Xsqlite3ExprListSetName(tls, pParse, pNew, bp+120 /* &sColname */, 0) + Xsqlite3TokenInit(tls, bp+72 /* &sColname */, zColname) + Xsqlite3ExprListSetName(tls, pParse, pNew, bp+72 /* &sColname */, 0) if ((pNew != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_NestedFrom)) != U32(0))) && !(int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) { var pX uintptr = ((pNew + 8 /* &.a */) + uintptr(((*ExprList)(unsafe.Pointer(pNew)).FnExpr-1))*32) Xsqlite3DbFree(tls, db, (*ExprList_item)(unsafe.Pointer(pX)).FzEName) @@ -163298,8 +163806,8 @@ __3: (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3DbStrDup(tls, db, (*ExprList_item)(unsafe.Pointer(((*Select)(unsafe.Pointer(pSub)).FpEList+8 /* &.a */)+uintptr(j)*32)).FzEName) } else { - (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+19212, /* "%s.%s.%s" */ - libc.VaList(bp+72, zSchemaName, zTabName, zColname)) + (*ExprList_item)(unsafe.Pointer(pX)).FzEName = Xsqlite3MPrintf(tls, db, ts+19227, /* "%s.%s.%s" */ + libc.VaList(bp+40, zSchemaName, zTabName, zColname)) } libc.SetBitFieldPtr8Uint32(pX+20 /* &.eEName */, uint32(ENAME_TAB), 0, 0x3) @@ -163318,9 +163826,9 @@ __3: ; if !(tableSeen != 0) { if zTName != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+19221 /* "no such table: %..." */, libc.VaList(bp+104, zTName)) + Xsqlite3ErrorMsg(tls, pParse, ts+19236 /* "no such table: %..." */, libc.VaList(bp+64, zTName)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+19239 /* "no tables specif..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19254 /* "no tables specif..." */, 0) } } } @@ -163330,7 +163838,7 @@ __3: } if (*Select)(unsafe.Pointer(p)).FpEList != 0 { if (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(p)).FpEList)).FnExpr > *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+19259 /* "too many columns..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19274 /* "too many columns..." */, 0) return WRC_Abort } if (elistFlags & (U32(EP_HasFunc | EP_Subquery))) != U32(0) { @@ -163492,8 +164000,8 @@ func Xsqlite3SelectPrep(tls *libc.TLS, pParse uintptr, p uintptr, pOuterNC uintp // routine generates code that stores NULLs in all of those memory // cells. func resetAccumulator(tls *libc.TLS, pParse uintptr, pAggInfo uintptr) { /* sqlite3.c:137894:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe var i int32 @@ -163518,13 +164026,13 @@ __1: if (*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)) == uintptr(0)) || ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)))).FnExpr != 1) { Xsqlite3ErrorMsg(tls, pParse, - ts+19290 /* "DISTINCT aggrega..." */, 0) + ts+19305 /* "DISTINCT aggrega..." */, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct = -1 } else { var pKeyInfo uintptr = Xsqlite3KeyInfoFromExprList(tls, pParse, *(*uintptr)(unsafe.Pointer(pE + 32 /* &.x */)), 0, 0) (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistAddr = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, (*AggInfo_func)(unsafe.Pointer(pFunc)).FiDistinct, 0, 0, pKeyInfo, -9) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+19341 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+19356 /* "USE TEMP B-TREE ..." */, libc.VaList(bp, (*FuncDef)(unsafe.Pointer((*AggInfo_func)(unsafe.Pointer(pFunc)).FpFunc)).FzName)) } } @@ -163719,24 +164227,24 @@ __9: // Add a single OP_Explain instruction to the VDBE to explain a simple // count(*) query ("SELECT count(*) FROM pTab"). func explainSimpleCount(tls *libc.TLS, pParse uintptr, pTab uintptr, pIdx uintptr) { /* sqlite3.c:138061:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) if int32((*Parse)(unsafe.Pointer(pParse)).Fexplain) == 2 { var bCover int32 = (libc.Bool32((pIdx != uintptr(0)) && ((((*Table)(unsafe.Pointer((pTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) || !((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY)))) - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+19374, /* "SCAN %s%s%s" */ + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+19389, /* "SCAN %s%s%s" */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if bCover != 0 { - return ts + 19386 /* " USING COVERING ..." */ + return ts + 19401 /* " USING COVERING ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bCover != 0 { return (*Index)(unsafe.Pointer(pIdx)).FzName } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) } } @@ -163756,7 +164264,7 @@ func havingToWhereExprCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { if (Xsqlite3ExprIsConstantOrGroupBy(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, pExpr, (*Select)(unsafe.Pointer(pS)).FpGroupBy) != 0) && ((libc.Bool32(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_FromJoin | EP_IsFalse))) == U32(EP_IsFalse))) == 0) { var db uintptr = (*Parse)(unsafe.Pointer((*Walker)(unsafe.Pointer(pWalker)).FpParse)).Fdb - var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+8260 /* "1" */) + var pNew uintptr = Xsqlite3Expr(tls, db, TK_INTEGER, ts+8275 /* "1" */) if pNew != 0 { var pWhere uintptr = (*Select)(unsafe.Pointer(pS)).FpWhere { @@ -163865,8 +164373,8 @@ func agginfoFree(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:138181:13: // This routine does NOT free the Select structure passed in. The // calling function needs to do that. func Xsqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int32 { /* sqlite3.c:138287:20: */ - bp := tls.Alloc(248) - defer tls.Free(248) + bp := tls.Alloc(216) + defer tls.Free(216) var i int32 var j int32 // Loop counters @@ -163880,13 +164388,13 @@ func Xsqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int var pHaving uintptr // The HAVING clause. May be NULL var pAggInfo uintptr // Aggregate information var rc int32 // Value to return from this function - // var sDistinct DistinctCtx at bp+168, 12 + // var sDistinct DistinctCtx at bp+136, 12 // Info on how to code the DISTINCT keyword - // var sSort SortCtx at bp+80, 48 + // var sSort SortCtx at bp+48, 48 // Info on how to code the ORDER BY clause var iEnd int32 // Address of the end of the query var db uintptr // The database connection - // var pMinMaxOrderBy uintptr at bp+240, 8 + // var pMinMaxOrderBy uintptr at bp+208, 8 // Added ORDER BY for min/max queries var minMaxFlag U8 var p1 uintptr @@ -163911,7 +164419,7 @@ func Xsqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int var retAddr int32 var pItem1 uintptr var pPrior uintptr - // var dest SelectDest at bp+128, 40 + // var dest SelectDest at bp+96, 40 var pSub1 uintptr var zSavedAuthContext uintptr @@ -163978,7 +164486,7 @@ func Xsqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int var pTab1 uintptr // This case when there exist aggregate functions or a GROUP BY clause // or both - // var sNC NameContext at bp+184, 56 + // var sNC NameContext at bp+152, 56 // Name context for processing aggregate information var iAMem int32 // First Mem address for storing current GROUP BY var iBMem int32 // First Mem address for previous GROUP BY @@ -163994,7 +164502,7 @@ func Xsqlite3Select(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr) int pEList = uintptr(0) pAggInfo = uintptr(0) rc = 1 - *(*uintptr)(unsafe.Pointer(bp + 240 /* pMinMaxOrderBy */)) = uintptr(0) // Flag for min/max queries + *(*uintptr)(unsafe.Pointer(bp + 208 /* pMinMaxOrderBy */)) = uintptr(0) // Flag for min/max queries db = (*Parse)(unsafe.Pointer(pParse)).Fdb v = Xsqlite3GetVdbe(tls, pParse) @@ -164058,7 +164566,7 @@ __7: goto __10 } Xsqlite3ErrorMsg(tls, pParse, - ts+19409, /* "target object/al..." */ + ts+19424, /* "target object/al..." */ libc.VaList(bp, func() uintptr { if (*SrcItem)(unsafe.Pointer(p0)).FzAlias != 0 { return (*SrcItem)(unsafe.Pointer(p0)).FzAlias @@ -164094,8 +164602,8 @@ __12: ; pTabList = (*Select)(unsafe.Pointer(p)).FpSrc isAgg = (libc.Bool32(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Aggregate)) != U32(0))) - libc.Xmemset(tls, bp+80 /* &sSort */, 0, uint64(unsafe.Sizeof(SortCtx{}))) - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy + libc.Xmemset(tls, bp+48 /* &sSort */, 0, uint64(unsafe.Sizeof(SortCtx{}))) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy // Try to do various optimizations (flattening subqueries, and strength // reduction of join operators) in the FROM clause up into the main query @@ -164138,8 +164646,8 @@ __17: if !(int32((*Table)(unsafe.Pointer(pTab)).FnCol) != (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+19463, /* "expected %d colu..." */ - libc.VaList(bp+16, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) + Xsqlite3ErrorMsg(tls, pParse, ts+19478, /* "expected %d colu..." */ + libc.VaList(bp+8, int32((*Table)(unsafe.Pointer(pTab)).FnCol), (*Table)(unsafe.Pointer(pTab)).FzName, (*ExprList)(unsafe.Pointer((*Select)(unsafe.Pointer(pSub)).FpEList)).FnExpr)) goto select_end __18: ; @@ -164208,7 +164716,7 @@ __23: if !(!((int32((*SelectDest)(unsafe.Pointer(pDest)).FeDest)) <= SRT_Fifo)) { goto __24 } - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = (*Select)(unsafe.Pointer(p)).FpOrderBy __24: ; goto __14 @@ -164279,7 +164787,7 @@ __29: if !(((*SrcItem)(unsafe.Pointer(pItem1)).FcolUsed == uint64(0)) && ((*SrcItem)(unsafe.Pointer(pItem1)).FzName != uintptr(0))) { goto __32 } - Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+740 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) + Xsqlite3AuthCheck(tls, pParse, SQLITE_READ, (*SrcItem)(unsafe.Pointer(pItem1)).FzName, ts+755 /* "" */, (*SrcItem)(unsafe.Pointer(pItem1)).FzDatabase) __32: ; @@ -164343,12 +164851,12 @@ __35: Xsqlite3VdbeAddOp3(tls, v, OP_InitCoroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn, 0, addrTop) (*SrcItem)(unsafe.Pointer(pItem1)).FaddrFillSub = addrTop - Xsqlite3SelectDestInit(tls, bp+128 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+19503 /* "CO-ROUTINE %!S" */, libc.VaList(bp+48, pItem1)) - Xsqlite3Select(tls, pParse, pSub1, bp+128 /* &dest */) + Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_Coroutine, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+19518 /* "CO-ROUTINE %!S" */, libc.VaList(bp+32, pItem1)) + Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow libc.SetBitFieldPtr16Uint32(pItem1+60 /* &.fg */ +4 /* &.viaCoroutine */, uint32(1), 4, 0x10) - (*SrcItem)(unsafe.Pointer(pItem1)).FregResult = (*SelectDest)(unsafe.Pointer(bp + 128 /* &dest */)).FiSdst + (*SrcItem)(unsafe.Pointer(pItem1)).FregResult = (*SelectDest)(unsafe.Pointer(bp + 96 /* &dest */)).FiSdst Xsqlite3VdbeEndCoroutine(tls, v, (*SrcItem)(unsafe.Pointer(pItem1)).FregReturn) Xsqlite3VdbeJumpHere(tls, v, (addrTop - 1)) Xsqlite3ClearTempRegCache(tls, pParse) @@ -164405,9 +164913,9 @@ __44: ; __45: ; - Xsqlite3SelectDestInit(tls, bp+128 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+19518 /* "MATERIALIZE %!S" */, libc.VaList(bp+64, pItem1)) - Xsqlite3Select(tls, pParse, pSub1, bp+128 /* &dest */) + Xsqlite3SelectDestInit(tls, bp+96 /* &dest */, SRT_EphemTab, (*SrcItem)(unsafe.Pointer(pItem1)).FiCursor) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+19533 /* "MATERIALIZE %!S" */, libc.VaList(bp+40, pItem1)) + Xsqlite3Select(tls, pParse, pSub1, bp+96 /* &dest */) (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pItem1)).FpTab)).FnRowLogEst = (*Select)(unsafe.Pointer(pSub1)).FnSelectRow if !(onceAddr != 0) { goto __46 @@ -164457,7 +164965,7 @@ __31: pWhere = (*Select)(unsafe.Pointer(p)).FpWhere pGroupBy = (*Select)(unsafe.Pointer(p)).FpGroupBy pHaving = (*Select)(unsafe.Pointer(p)).FpHaving - (*DistinctCtx)(unsafe.Pointer(bp + 168 /* &sDistinct */)).FisTnct = (U8(libc.Bool32(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != U32(0)))) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FisTnct = (U8(libc.Bool32(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != U32(0)))) // If the query is DISTINCT with an ORDER BY but is not an aggregate, and // if the select-list is the same as the ORDER BY list, then this query @@ -164474,7 +164982,7 @@ __31: // written the query must use a temp-table for at least one of the ORDER // BY and DISTINCT, and an index or separate temp-table for the other. if !(((((*Select)(unsafe.Pointer(p)).FselFlags & (U32(SF_Distinct | SF_Aggregate))) == U32(SF_Distinct)) && - (Xsqlite3ExprListCompare(tls, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy, pEList, -1) == 0)) && + (Xsqlite3ExprListCompare(tls, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, pEList, -1) == 0)) && ((*Select)(unsafe.Pointer(p)).FpWin == uintptr(0))) { goto __49 } @@ -164495,18 +165003,18 @@ __49: // changed to an OP_Noop once we figure out that the sorting index is // not needed. The sSort.addrSortIndex variable is used to facilitate // that change. - if !((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy != 0) { + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) { goto __50 } pKeyInfo = Xsqlite3KeyInfoFromExprList(tls, - pParse, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy, 0, (*ExprList)(unsafe.Pointer(pEList)).FnExpr) - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FiECursor = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FaddrSortIndex = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, - (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FiECursor, (((*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy)).FnExpr + 1) + (*ExprList)(unsafe.Pointer(pEList)).FnExpr), 0, + pParse, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, 0, (*ExprList)(unsafe.Pointer(pEList)).FnExpr) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FiECursor = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FaddrSortIndex = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, + (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FiECursor, (((*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy)).FnExpr + 1) + (*ExprList)(unsafe.Pointer(pEList)).FnExpr), 0, pKeyInfo, -9) goto __51 __50: - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FaddrSortIndex = -1 + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FaddrSortIndex = -1 __51: ; @@ -164527,11 +165035,11 @@ __52: __53: ; computeLimitRegisters(tls, pParse, p, iEnd) - if !(((*Select)(unsafe.Pointer(p)).FiLimit == 0) && ((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FaddrSortIndex >= 0)) { + if !(((*Select)(unsafe.Pointer(p)).FiLimit == 0) && ((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex >= 0)) { goto __54 } - Xsqlite3VdbeChangeOpcode(tls, v, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FaddrSortIndex, uint8(OP_SorterOpen)) - *(*U8)(unsafe.Pointer(bp + 80 /* &sSort */ + 36 /* &.sortFlags */)) |= U8((SORTFLAG_UseSorter)) + Xsqlite3VdbeChangeOpcode(tls, v, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex, uint8(OP_SorterOpen)) + *(*U8)(unsafe.Pointer(bp + 48 /* &sSort */ + 36 /* &.sortFlags */)) |= U8((SORTFLAG_UseSorter)) __54: ; @@ -164539,16 +165047,16 @@ __54: if !(((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) != 0) { goto __55 } - (*DistinctCtx)(unsafe.Pointer(bp + 168 /* &sDistinct */)).FtabTnct = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) - (*DistinctCtx)(unsafe.Pointer(bp + 168 /* &sDistinct */)).FaddrTnct = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, - (*DistinctCtx)(unsafe.Pointer(bp+168 /* &sDistinct */)).FtabTnct, 0, 0, + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FtabTnct = libc.PostIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnTab, 1) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FaddrTnct = Xsqlite3VdbeAddOp4(tls, v, OP_OpenEphemeral, + (*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FtabTnct, 0, 0, Xsqlite3KeyInfoFromExprList(tls, pParse, (*Select)(unsafe.Pointer(p)).FpEList, 0, 0), -9) Xsqlite3VdbeChangeP5(tls, v, uint16(BTREE_UNORDERED)) - (*DistinctCtx)(unsafe.Pointer(bp + 168 /* &sDistinct */)).FeTnctType = U8(WHERE_DISTINCT_UNORDERED) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FeTnctType = U8(WHERE_DISTINCT_UNORDERED) goto __56 __55: - (*DistinctCtx)(unsafe.Pointer(bp + 168 /* &sDistinct */)).FeTnctType = U8(WHERE_DISTINCT_NOOP) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FeTnctType = U8(WHERE_DISTINCT_NOOP) __56: ; @@ -164557,7 +165065,7 @@ __56: } // No aggregate functions and no GROUP BY clause wctrlFlags = (U16((func() uint32 { - if (*DistinctCtx)(unsafe.Pointer(bp+168 /* &sDistinct */)).FisTnct != 0 { + if (*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0 { return uint32(WHERE_WANT_DISTINCT) } return uint32(0) @@ -164573,7 +165081,7 @@ __59: // Begin the database scan. - pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy, + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, (*Select)(unsafe.Pointer(p)).FpEList, wctrlFlags, int32((*Select)(unsafe.Pointer(p)).FnSelectRow)) if !(pWInfo == uintptr(0)) { goto __60 @@ -164587,21 +165095,21 @@ __60: (*Select)(unsafe.Pointer(p)).FnSelectRow = Xsqlite3WhereOutputRowCount(tls, pWInfo) __61: ; - if !(((*DistinctCtx)(unsafe.Pointer(bp+168 /* &sDistinct */)).FisTnct != 0) && (Xsqlite3WhereIsDistinct(tls, pWInfo) != 0)) { + if !(((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (Xsqlite3WhereIsDistinct(tls, pWInfo) != 0)) { goto __62 } - (*DistinctCtx)(unsafe.Pointer(bp + 168 /* &sDistinct */)).FeTnctType = U8(Xsqlite3WhereIsDistinct(tls, pWInfo)) + (*DistinctCtx)(unsafe.Pointer(bp + 136 /* &sDistinct */)).FeTnctType = U8(Xsqlite3WhereIsDistinct(tls, pWInfo)) __62: ; - if !((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy != 0) { + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) { goto __63 } - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FnOBSat = Xsqlite3WhereIsOrdered(tls, pWInfo) - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FlabelOBLopt = Xsqlite3WhereOrderByLimitOptLabel(tls, pWInfo) - if !((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FnOBSat == (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy)).FnExpr) { + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FnOBSat = Xsqlite3WhereIsOrdered(tls, pWInfo) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FlabelOBLopt = Xsqlite3WhereOrderByLimitOptLabel(tls, pWInfo) + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat == (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy)).FnExpr) { goto __64 } - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FpOrderBy = uintptr(0) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = uintptr(0) __64: ; __63: @@ -164610,10 +165118,10 @@ __63: // If sorting index that was created by a prior OP_OpenEphemeral // instruction ended up not being needed, then change the OP_OpenEphemeral // into an OP_Noop. - if !(((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FaddrSortIndex >= 0) && ((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy == uintptr(0))) { + if !(((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex >= 0) && ((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy == uintptr(0))) { goto __65 } - Xsqlite3VdbeChangeToNoop(tls, v, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FaddrSortIndex) + Xsqlite3VdbeChangeToNoop(tls, v, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex) __65: ; @@ -164630,8 +165138,8 @@ __65: Xsqlite3VdbeAddOp2(tls, v, OP_Goto, 0, iBreak) Xsqlite3VdbeResolveLabel(tls, v, addrGosub) - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FlabelOBLopt = 0 - selectInnerLoop(tls, pParse, p, -1, bp+80 /* &sSort */, bp+168 /* &sDistinct */, pDest, iCont, iBreak) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FlabelOBLopt = 0 + selectInnerLoop(tls, pParse, p, -1, bp+48 /* &sSort */, bp+136 /* &sDistinct */, pDest, iCont, iBreak) Xsqlite3VdbeResolveLabel(tls, v, iCont) Xsqlite3VdbeAddOp1(tls, v, OP_Return, regGosub) @@ -164640,7 +165148,7 @@ __65: __66: // Use the standard inner loop. - selectInnerLoop(tls, pParse, p, -1, bp+80 /* &sSort */, bp+168 /* &sDistinct */, pDest, + selectInnerLoop(tls, pParse, p, -1, bp+48 /* &sSort */, bp+136 /* &sDistinct */, pDest, Xsqlite3WhereContinueLabel(tls, pWInfo), Xsqlite3WhereBreakLabel(tls, pWInfo)) @@ -164707,7 +165215,7 @@ __76: // but not actually sorted. Either way, record the fact that the // ORDER BY and GROUP BY clauses are the same by setting the orderByGrp // variable. - if !(((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy != 0) && ((*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr == (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy)).FnExpr)) { + if !(((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) && ((*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr == (*ExprList)(unsafe.Pointer((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy)).FnExpr)) { goto __77 } // The GROUP BY processing doesn't care whether rows are delivered in @@ -164720,7 +165228,7 @@ __78: if !(ii < (*ExprList)(unsafe.Pointer(pGroupBy)).FnExpr) { goto __80 } - sortFlags = (U8(int32((*ExprList_item)(unsafe.Pointer(((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy+8 /* &.a */)+uintptr(ii)*32)).FsortFlags) & KEYINFO_ORDER_DESC)) + sortFlags = (U8(int32((*ExprList_item)(unsafe.Pointer(((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy+8 /* &.a */)+uintptr(ii)*32)).FsortFlags) & KEYINFO_ORDER_DESC)) (*ExprList_item)(unsafe.Pointer((pGroupBy + 8 /* &.a */) + uintptr(ii)*32)).FsortFlags = sortFlags goto __79 __79: @@ -164729,7 +165237,7 @@ __79: goto __80 __80: ; - if !(Xsqlite3ExprListCompare(tls, pGroupBy, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy, -1) == 0) { + if !(Xsqlite3ExprListCompare(tls, pGroupBy, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy, -1) == 0) { goto __81 } orderByGrp = 1 @@ -164768,10 +165276,10 @@ __82: __83: ; (*AggInfo)(unsafe.Pointer(pAggInfo)).FselId = (*Select)(unsafe.Pointer(p)).FselId - libc.Xmemset(tls, bp+184 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) - (*NameContext)(unsafe.Pointer(bp + 184 /* &sNC */)).FpParse = pParse - (*NameContext)(unsafe.Pointer(bp + 184 /* &sNC */)).FpSrcList = pTabList - *(*uintptr)(unsafe.Pointer(bp + 184 /* &sNC */ + 16 /* &.uNC */)) = pAggInfo + libc.Xmemset(tls, bp+152 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 152 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 152 /* &sNC */)).FpSrcList = pTabList + *(*uintptr)(unsafe.Pointer(bp + 152 /* &sNC */ + 16 /* &.uNC */)) = pAggInfo (*AggInfo)(unsafe.Pointer(pAggInfo)).FmnReg = ((*Parse)(unsafe.Pointer(pParse)).FnMem + 1) (*AggInfo)(unsafe.Pointer(pAggInfo)).FnSortingColumn = func() int32 { @@ -164781,8 +165289,8 @@ __83: return 0 }() (*AggInfo)(unsafe.Pointer(pAggInfo)).FpGroupBy = pGroupBy - Xsqlite3ExprAnalyzeAggList(tls, bp+184 /* &sNC */, pEList) - Xsqlite3ExprAnalyzeAggList(tls, bp+184 /* &sNC */, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy) + Xsqlite3ExprAnalyzeAggList(tls, bp+152 /* &sNC */, pEList) + Xsqlite3ExprAnalyzeAggList(tls, bp+152 /* &sNC */, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy) if !(pHaving != 0) { goto __84 } @@ -164794,14 +165302,14 @@ __83: pWhere = (*Select)(unsafe.Pointer(p)).FpWhere __85: ; - Xsqlite3ExprAnalyzeAggregates(tls, bp+184 /* &sNC */, pHaving) + Xsqlite3ExprAnalyzeAggregates(tls, bp+152 /* &sNC */, pHaving) __84: ; (*AggInfo)(unsafe.Pointer(pAggInfo)).FnAccumulator = (*AggInfo)(unsafe.Pointer(pAggInfo)).FnColumn if !((((*Select)(unsafe.Pointer(p)).FpGroupBy == uintptr(0)) && ((*Select)(unsafe.Pointer(p)).FpHaving == uintptr(0))) && ((*AggInfo)(unsafe.Pointer(pAggInfo)).FnFunc == 1)) { goto __86 } - minMaxFlag = minMaxQuery(tls, db, (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFExpr, bp+240 /* &pMinMaxOrderBy */) + minMaxFlag = minMaxQuery(tls, db, (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc)).FpFExpr, bp+208 /* &pMinMaxOrderBy */) goto __87 __86: minMaxFlag = U8(WHERE_ORDERBY_NORMAL) @@ -164814,16 +165322,16 @@ __88: } pExpr = (*AggInfo_func)(unsafe.Pointer((*AggInfo)(unsafe.Pointer(pAggInfo)).FaFunc + uintptr(i)*32)).FpFExpr - *(*int32)(unsafe.Pointer(bp + 184 /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_InAggFunc) - Xsqlite3ExprAnalyzeAggList(tls, bp+184 /* &sNC */, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) + *(*int32)(unsafe.Pointer(bp + 152 /* &sNC */ + 40 /* &.ncFlags */)) |= (NC_InAggFunc) + Xsqlite3ExprAnalyzeAggList(tls, bp+152 /* &sNC */, *(*uintptr)(unsafe.Pointer(pExpr + 32 /* &.x */))) if !(((*Expr)(unsafe.Pointer((pExpr))).Fflags & (U32(EP_WinFunc))) != U32(0)) { goto __91 } - Xsqlite3ExprAnalyzeAggregates(tls, bp+184 /* &sNC */, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpFilter) + Xsqlite3ExprAnalyzeAggregates(tls, bp+152 /* &sNC */, (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pExpr + 64 /* &.y */)))).FpFilter) __91: ; - *(*int32)(unsafe.Pointer(bp + 184 /* &sNC */ + 40 /* &.ncFlags */)) &= (libc.CplInt32(NC_InAggFunc)) + *(*int32)(unsafe.Pointer(bp + 152 /* &sNC */ + 40 /* &.ncFlags */)) &= (libc.CplInt32(NC_InAggFunc)) goto __89 __89: i++ @@ -164925,10 +165433,10 @@ __97: explainTempTable(tls, pParse, func() uintptr { - if ((*DistinctCtx)(unsafe.Pointer(bp+168 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { - return ts + 19534 /* "DISTINCT" */ + if ((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FisTnct != 0) && (((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_Distinct)) == U32(0)) { + return ts + 19549 /* "DISTINCT" */ } - return ts + 19543 /* "GROUP BY" */ + return ts + 19558 /* "GROUP BY" */ }()) groupBySort = 1 @@ -165006,8 +165514,8 @@ __98: ((groupBySort != 0) || (Xsqlite3WhereIsSorted(tls, pWInfo) != 0))) { goto __107 } - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FpOrderBy = uintptr(0) - Xsqlite3VdbeChangeToNoop(tls, v, (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FaddrSortIndex) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = uintptr(0) + Xsqlite3VdbeChangeToNoop(tls, v, (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FaddrSortIndex) __107: ; @@ -165109,8 +165617,8 @@ __115: Xsqlite3VdbeAddOp1(tls, v, OP_Return, regOutputRow) finalizeAggFunctions(tls, pParse, pAggInfo) Xsqlite3ExprIfFalse(tls, pParse, pHaving, (addrOutputRow + 1), SQLITE_JUMPIFNULL) - selectInnerLoop(tls, pParse, p, -1, bp+80, /* &sSort */ - bp+168 /* &sDistinct */, pDest, + selectInnerLoop(tls, pParse, p, -1, bp+48, /* &sSort */ + bp+136 /* &sDistinct */, pDest, (addrOutputRow + 1), addrSetAbort) Xsqlite3VdbeAddOp1(tls, v, OP_Return, regOutputRow) @@ -165289,7 +165797,7 @@ __128: // WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX and pMinMaxOrderBy will // be an appropriate ORDER BY expression for the optimization. - pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, *(*uintptr)(unsafe.Pointer(bp + 240 /* pMinMaxOrderBy */)), + pWInfo = Xsqlite3WhereBegin(tls, pParse, pTabList, pWhere, *(*uintptr)(unsafe.Pointer(bp + 208 /* pMinMaxOrderBy */)), pDistinct1, (uint16(int32(minMaxFlag) | int32(distFlag1))), 0) if !(pWInfo == uintptr(0)) { goto __136 @@ -165326,7 +165834,7 @@ __139: __118: ; - (*SortCtx)(unsafe.Pointer(bp + 80 /* &sSort */)).FpOrderBy = uintptr(0) + (*SortCtx)(unsafe.Pointer(bp + 48 /* &sSort */)).FpOrderBy = uintptr(0) Xsqlite3ExprIfFalse(tls, pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL) selectInnerLoop(tls, pParse, p, -1, uintptr(0), uintptr(0), pDest, addrEnd, addrEnd) @@ -165337,27 +165845,27 @@ __94: __58: ; // endif aggregate query - if !(int32((*DistinctCtx)(unsafe.Pointer(bp+168 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { + if !(int32((*DistinctCtx)(unsafe.Pointer(bp+136 /* &sDistinct */)).FeTnctType) == WHERE_DISTINCT_UNORDERED) { goto __140 } - explainTempTable(tls, pParse, ts+19534 /* "DISTINCT" */) + explainTempTable(tls, pParse, ts+19549 /* "DISTINCT" */) __140: ; // If there is an ORDER BY clause, then we need to sort the results // and send them to the callback one by one. - if !((*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FpOrderBy != 0) { + if !((*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FpOrderBy != 0) { goto __141 } explainTempTable(tls, pParse, func() uintptr { - if (*SortCtx)(unsafe.Pointer(bp+80 /* &sSort */)).FnOBSat > 0 { - return ts + 19552 /* "RIGHT PART OF OR..." */ + if (*SortCtx)(unsafe.Pointer(bp+48 /* &sSort */)).FnOBSat > 0 { + return ts + 19567 /* "RIGHT PART OF OR..." */ } - return ts + 19575 /* "ORDER BY" */ + return ts + 19590 /* "ORDER BY" */ }()) - generateSortTail(tls, pParse, p, bp+80 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) + generateSortTail(tls, pParse, p, bp+48 /* &sSort */, (*ExprList)(unsafe.Pointer(pEList)).FnExpr, pDest) __141: ; @@ -165373,7 +165881,7 @@ __141: select_end: ; *(*int32)(unsafe.Pointer(pParse + 48 /* &.nErr */)) += (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed)) - Xsqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 240 /* pMinMaxOrderBy */))) + Xsqlite3ExprListDelete(tls, db, *(*uintptr)(unsafe.Pointer(bp + 208 /* pMinMaxOrderBy */))) Xsqlite3VdbeExplainPop(tls, pParse) return rc @@ -165440,8 +165948,8 @@ type TabResult = TabResult1 /* sqlite3.c:139506:3 */ // is to fill in the TabResult structure appropriately, allocating new // memory as necessary. func sqlite3_get_table_cb(tls *libc.TLS, pArg uintptr, nCol int32, argv uintptr, colv uintptr) int32 { /* sqlite3.c:139513:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var p uintptr // Result accumulator var need int32 // Slots needed in p->azResult[] @@ -165488,7 +165996,7 @@ __7: if !(i < nCol) { goto __9 } - z = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) + z = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(colv + uintptr(i)*8)))) if !(z == uintptr(0)) { goto __10 } @@ -165510,7 +166018,7 @@ __5: } Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(p)).FzErrMsg) (*TabResult)(unsafe.Pointer(p)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+19584 /* "sqlite3_get_tabl..." */, 0) + ts+19599 /* "sqlite3_get_tabl..." */, 0) (*TabResult)(unsafe.Pointer(p)).Frc = SQLITE_ERROR return 1 __11: @@ -165571,11 +166079,11 @@ malloc_failed: // Instead, the entire table should be passed to sqlite3_free_table() when // the calling procedure is finished using it. func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintptr, pnRow uintptr, pnColumn uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:139587:16: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) var rc int32 - // var res TabResult at bp+16, 40 + // var res TabResult at bp+8, 40 *(*uintptr)(unsafe.Pointer(pazResult)) = uintptr(0) if pnColumn != 0 { @@ -165587,56 +166095,56 @@ func Xsqlite3_get_table(tls *libc.TLS, db uintptr, zSql uintptr, pazResult uintp if pzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) } - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FzErrMsg = uintptr(0) - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnRow = U32(0) - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnColumn = U32(0) - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnData = U32(1) - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnAlloc = U32(20) - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).Frc = SQLITE_OK - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FazResult = Xsqlite3_malloc64(tls, (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FnAlloc))) - if (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FazResult == uintptr(0) { + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FzErrMsg = uintptr(0) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnRow = U32(0) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnColumn = U32(0) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnData = U32(1) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnAlloc = U32(20) + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).Frc = SQLITE_OK + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult = Xsqlite3_malloc64(tls, (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnAlloc))) + if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult == uintptr(0) { (*Sqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_NOMEM return SQLITE_NOMEM } - *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FazResult)) = uintptr(0) + *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult)) = uintptr(0) rc = Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32 - }{sqlite3_get_table_cb})), bp+16 /* &res */, pzErrMsg) + }{sqlite3_get_table_cb})), bp+8 /* &res */, pzErrMsg) - *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FazResult)) = uintptr(int64((*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnData)) + *(*uintptr)(unsafe.Pointer((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult)) = uintptr(int64((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnData)) if (rc & 0xff) == SQLITE_ABORT { - Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FazResult + 1*8)) - if (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FzErrMsg != 0 { + Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8)) + if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg != 0 { if pzErrMsg != 0 { Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErrMsg))) - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FzErrMsg)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg)) } - Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FzErrMsg) + Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) } - (*Sqlite3)(unsafe.Pointer(db)).FerrCode = (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).Frc // Assume 32-bit assignment is atomic - return (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).Frc + (*Sqlite3)(unsafe.Pointer(db)).FerrCode = (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).Frc // Assume 32-bit assignment is atomic + return (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).Frc } - Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FzErrMsg) + Xsqlite3_free(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FzErrMsg) if rc != SQLITE_OK { - Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FazResult + 1*8)) + Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8)) return rc } - if (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FnAlloc > (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FnData { + if (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnAlloc > (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnData { var azNew uintptr - azNew = Xsqlite3Realloc(tls, (*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FazResult, (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FnData))) + azNew = Xsqlite3Realloc(tls, (*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult, (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FnData))) if azNew == uintptr(0) { - Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FazResult + 1*8)) + Xsqlite3_free_table(tls, ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8)) (*Sqlite3)(unsafe.Pointer(db)).FerrCode = SQLITE_NOMEM return SQLITE_NOMEM } - (*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FazResult = azNew + (*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FazResult = azNew } - *(*uintptr)(unsafe.Pointer(pazResult)) = ((*TabResult)(unsafe.Pointer(bp+16 /* &res */)).FazResult + 1*8) + *(*uintptr)(unsafe.Pointer(pazResult)) = ((*TabResult)(unsafe.Pointer(bp+8 /* &res */)).FazResult + 1*8) if pnColumn != 0 { - *(*int32)(unsafe.Pointer(pnColumn)) = int32((*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnColumn) + *(*int32)(unsafe.Pointer(pnColumn)) = int32((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnColumn) } if pnRow != 0 { - *(*int32)(unsafe.Pointer(pnRow)) = int32((*TabResult)(unsafe.Pointer(bp + 16 /* &res */)).FnRow) + *(*int32)(unsafe.Pointer(pnRow)) = int32((*TabResult)(unsafe.Pointer(bp + 8 /* &res */)).FnRow) } return rc } @@ -165741,17 +166249,17 @@ func Xsqlite3TriggerList(tls *libc.TLS, pParse uintptr, pTab uintptr) uintptr { // sqlite3FinishTrigger() function is called to complete the trigger // construction process. func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 uintptr, tr_tm int32, op int32, pColumns uintptr, pTableName uintptr, pWhen uintptr, isTemp int32, noErr int32) { /* sqlite3.c:139778:21: */ - bp := tls.Alloc(160) - defer tls.Free(160) + bp := tls.Alloc(136) + defer tls.Free(136) var pTrigger uintptr // The new trigger var pTab uintptr // Table that the trigger fires off of var zName uintptr // Name of the trigger var db uintptr // The database connection var iDb int32 // The database to store the trigger in - // var pName uintptr at bp+56, 8 + // var pName uintptr at bp+32, 8 // The unqualified db name - // var sFix DbFixer at bp+64, 96 + // var sFix DbFixer at bp+40, 96 var iTabDb int32 var code int32 @@ -165770,16 +166278,16 @@ func Xsqlite3BeginTrigger(tls *libc.TLS, pParse uintptr, pName1 uintptr, pName2 if !((*Token)(unsafe.Pointer(pName2)).Fn > uint32(0)) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+19649 /* "temporary trigge..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19664 /* "temporary trigge..." */, 0) goto trigger_cleanup __3: ; iDb = 1 - *(*uintptr)(unsafe.Pointer(bp + 56 /* pName */)) = pName1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)) = pName1 goto __2 __1: // Figure out the db that the trigger will be created in - iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+56 /* &pName */) + iDb = Xsqlite3TwoPartName(tls, pParse, pName1, pName2, bp+32 /* &pName */) if !(iDb < 0) { goto __4 } @@ -165831,8 +166339,8 @@ __7: __8: ; - Xsqlite3FixInit(tls, bp+64 /* &sFix */, pParse, iDb, ts+19695 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 56 /* pName */))) - if !(Xsqlite3FixSrcList(tls, bp+64 /* &sFix */, pTableName) != 0) { + Xsqlite3FixInit(tls, bp+40 /* &sFix */, pParse, iDb, ts+19710 /* "trigger" */, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) + if !(Xsqlite3FixSrcList(tls, bp+40 /* &sFix */, pTableName) != 0) { goto __9 } goto trigger_cleanup @@ -165849,14 +166357,14 @@ __10: if !((*Table)(unsafe.Pointer(pTab)).FnModuleArg != 0) { goto __11 } - Xsqlite3ErrorMsg(tls, pParse, ts+19703 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19718 /* "cannot create tr..." */, 0) goto trigger_orphan_error __11: ; // Check that the trigger name is not reserved and that no trigger of the // specified name exists - zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 56 /* pName */))) + zName = Xsqlite3NameFromToken(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */))) if !(zName == uintptr(0)) { goto __12 } @@ -165864,7 +166372,7 @@ __11: goto trigger_cleanup __12: ; - if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+19695 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { + if !(Xsqlite3CheckObjectName(tls, pParse, zName, ts+19710 /* "trigger" */, (*Table)(unsafe.Pointer(pTab)).FzName) != 0) { goto __13 } goto trigger_cleanup @@ -165880,7 +166388,7 @@ __13: if !(!(noErr != 0)) { goto __16 } - Xsqlite3ErrorMsg(tls, pParse, ts+19744 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 56 /* pName */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+19759 /* "trigger %T alrea..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* pName */)))) goto __17 __16: ; @@ -165894,10 +166402,10 @@ __14: ; // Do not create a trigger on a system table - if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8428 /* "sqlite_" */, 7) == 0) { + if !(Xsqlite3_strnicmp(tls, (*Table)(unsafe.Pointer(pTab)).FzName, ts+8443 /* "sqlite_" */, 7) == 0) { goto __18 } - Xsqlite3ErrorMsg(tls, pParse, ts+19770 /* "cannot create tr..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+19785 /* "cannot create tr..." */, 0) goto trigger_cleanup __18: ; @@ -165907,12 +166415,12 @@ __18: if !(((*Table)(unsafe.Pointer(pTab)).FpSelect != 0) && (tr_tm != TK_INSTEAD)) { goto __19 } - Xsqlite3ErrorMsg(tls, pParse, ts+19808, /* "cannot create %s..." */ - libc.VaList(bp+16, func() uintptr { + Xsqlite3ErrorMsg(tls, pParse, ts+19823, /* "cannot create %s..." */ + libc.VaList(bp+8, func() uintptr { if tr_tm == TK_BEFORE { - return ts + 19845 /* "BEFORE" */ + return ts + 19860 /* "BEFORE" */ } - return ts + 19852 /* "AFTER" */ + return ts + 19867 /* "AFTER" */ }(), pTableName+8 /* &.a */)) goto trigger_orphan_error __19: @@ -165921,7 +166429,7 @@ __19: goto __20 } Xsqlite3ErrorMsg(tls, pParse, - ts+19858 /* "cannot create IN..." */, libc.VaList(bp+40, pTableName+8 /* &.a */)) + ts+19873 /* "cannot create IN..." */, libc.VaList(bp+24, pTableName+8 /* &.a */)) goto trigger_orphan_error __20: ; @@ -165951,9 +166459,9 @@ __23: ; if !(Xsqlite3AuthCheck(tls, pParse, SQLITE_INSERT, func() uintptr { if (!(0 != 0)) && (iTabDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }(), uintptr(0), zDb) != 0) { goto __24 } @@ -166048,16 +166556,16 @@ __31: // This routine is called after all of the trigger actions have been parsed // in order to complete the process of building the trigger. func Xsqlite3FinishTrigger(tls *libc.TLS, pParse uintptr, pStepList uintptr, pAll uintptr) { /* sqlite3.c:139985:21: */ - bp := tls.Alloc(168) - defer tls.Free(168) + bp := tls.Alloc(152) + defer tls.Free(152) var pTrig uintptr // Trigger being finished var zName uintptr // Name of trigger var db uintptr // The database - // var sFix DbFixer at bp+72, 96 + // var sFix DbFixer at bp+56, 96 // Fixer object var iDb int32 // Database containing the trigger - // var nameToken Token at bp+56, 16 + // var nameToken Token at bp+40, 16 var v uintptr var z uintptr @@ -166086,10 +166594,10 @@ __2: goto __2 __3: ; - Xsqlite3TokenInit(tls, bp+56 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) - Xsqlite3FixInit(tls, bp+72 /* &sFix */, pParse, iDb, ts+19695 /* "trigger" */, bp+56 /* &nameToken */) - if !((Xsqlite3FixTriggerStep(tls, bp+72 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || - (Xsqlite3FixExpr(tls, bp+72 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { + Xsqlite3TokenInit(tls, bp+40 /* &nameToken */, (*Trigger)(unsafe.Pointer(pTrig)).FzName) + Xsqlite3FixInit(tls, bp+56 /* &sFix */, pParse, iDb, ts+19710 /* "trigger" */, bp+40 /* &nameToken */) + if !((Xsqlite3FixTriggerStep(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).Fstep_list) != 0) || + (Xsqlite3FixExpr(tls, bp+56 /* &sFix */, (*Trigger)(unsafe.Pointer(pTrig)).FpWhen) != 0)) { goto __4 } goto triggerfinish_cleanup @@ -166124,13 +166632,13 @@ __8: Xsqlite3NestedParse(tls, pParse, - ts+19904, /* "INSERT INTO %Q.s..." */ + ts+19919, /* "INSERT INTO %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, zName, (*Trigger)(unsafe.Pointer(pTrig)).Ftable, z)) Xsqlite3DbFree(tls, db, z) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, - Xsqlite3MPrintf(tls, db, ts+19979 /* "type='trigger' A..." */, libc.VaList(bp+40, zName)), uint16(0)) + Xsqlite3MPrintf(tls, db, ts+19994 /* "type='trigger' A..." */, libc.VaList(bp+32, zName)), uint16(0)) __7: ; __6: @@ -166331,8 +166839,8 @@ func Xsqlite3DeleteTrigger(tls *libc.TLS, db uintptr, pTrigger uintptr) { /* sql // instead of the trigger name. // func Xsqlite3DropTrigger(tls *libc.TLS, pParse uintptr, pName uintptr, noErr int32) { /* sqlite3.c:140273:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pTrigger uintptr var i int32 @@ -166396,7 +166904,7 @@ __5: if !(!(noErr != 0)) { goto __9 } - Xsqlite3ErrorMsg(tls, pParse, ts+20008 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) + Xsqlite3ErrorMsg(tls, pParse, ts+20023 /* "no such trigger:..." */, libc.VaList(bp, pName+8 /* &.a */)) goto __10 __9: Xsqlite3CodeVerifyNamedSchema(tls, pParse, zDb) @@ -166420,8 +166928,8 @@ func tableOfTrigger(tls *libc.TLS, pTrigger uintptr) uintptr { /* sqlite3.c:1403 // Drop a trigger given a pointer to that trigger. func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { /* sqlite3.c:140323:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pTable uintptr var v uintptr @@ -166437,9 +166945,9 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / var zDb uintptr = (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FzDbSName var zTab uintptr = func() uintptr { if (!(0 != 0)) && (iDb == 1) { - return ts + 12219 /* "sqlite_temp_mast..." */ + return ts + 12234 /* "sqlite_temp_mast..." */ } - return ts + 6303 /* "sqlite_master" */ + return ts + 6318 /* "sqlite_master" */ }() if iDb == 1 { code = SQLITE_DROP_TEMP_TRIGGER @@ -166452,7 +166960,7 @@ func Xsqlite3DropTriggerPtr(tls *libc.TLS, pParse uintptr, pTrigger uintptr) { / // Generate code to destroy the database record of the trigger. if (libc.AssignUintptr(&v, Xsqlite3GetVdbe(tls, pParse))) != uintptr(0) { Xsqlite3NestedParse(tls, pParse, - ts+20028, /* "DELETE FROM %Q.s..." */ + ts+20043, /* "DELETE FROM %Q.s..." */ libc.VaList(bp, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)) Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp4(tls, v, OP_DropTrigger, iDb, 0, 0, (*Trigger)(unsafe.Pointer(pTrigger)).FzName, 0) @@ -166509,8 +167017,8 @@ func checkColumnOverlap(tls *libc.TLS, pIdList uintptr, pEList uintptr) int32 { // performed on the table, and, if that operation is an UPDATE, if at // least one of the columns in pChanges is being modified. func Xsqlite3TriggersExist(tls *libc.TLS, pParse uintptr, pTab uintptr, op int32, pChanges uintptr, pMask uintptr) uintptr { /* sqlite3.c:140410:24: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var mask int32 var pList uintptr @@ -166571,12 +167079,12 @@ __9: goto __15 } Xsqlite3ErrorMsg(tls, pParse, - ts+20090, /* "%s RETURNING is ..." */ + ts+20105, /* "%s RETURNING is ..." */ libc.VaList(bp, func() uintptr { if op == TK_DELETE { - return ts + 20138 /* "DELETE" */ + return ts + 20153 /* "DELETE" */ } - return ts + 20145 /* "UPDATE" */ + return ts + 20160 /* "UPDATE" */ }())) __15: ; @@ -166672,7 +167180,7 @@ func isAsteriskTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr) int32 { /* sql if int32((*Expr)(unsafe.Pointer((*Expr)(unsafe.Pointer(pTerm)).FpRight)).Fop) != TK_ASTERISK { return 0 } - Xsqlite3ErrorMsg(tls, pParse, ts+20152 /* "RETURNING may no..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+20167 /* "RETURNING may no..." */, 0) return 1 } @@ -166784,8 +167292,8 @@ func codeReturningTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab // Generate VDBE code for the statements inside the body of a single // trigger. func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf int32) int32 { /* sqlite3.c:140645:12: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) var pStep uintptr var v uintptr = (*Parse)(unsafe.Pointer(pParse)).FpVdbe @@ -166813,7 +167321,7 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf if (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan != 0 { Xsqlite3VdbeAddOp4(tls, v, OP_Trace, 0x7fffffff, 1, 0, - Xsqlite3MPrintf(tls, db, ts+6490 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), + Xsqlite3MPrintf(tls, db, ts+6505 /* "-- %s" */, libc.VaList(bp, (*TriggerStep)(unsafe.Pointer(pStep)).FzSpan)), -7) } @@ -166852,11 +167360,11 @@ func codeTriggerProgram(tls *libc.TLS, pParse uintptr, pStepList uintptr, orconf } default: { - // var sDest SelectDest at bp+16, 40 + // var sDest SelectDest at bp+8, 40 var pSelect uintptr = Xsqlite3SelectDup(tls, db, (*TriggerStep)(unsafe.Pointer(pStep)).FpSelect, 0) - Xsqlite3SelectDestInit(tls, bp+16 /* &sDest */, SRT_Discard, 0) - Xsqlite3Select(tls, pParse, pSelect, bp+16 /* &sDest */) + Xsqlite3SelectDestInit(tls, bp+8 /* &sDest */, SRT_Discard, 0) + Xsqlite3Select(tls, pParse, pSelect, bp+8 /* &sDest */) Xsqlite3SelectDelete(tls, db, pSelect) break @@ -166884,8 +167392,8 @@ func transferParseError(tls *libc.TLS, pTo uintptr, pFrom uintptr) { /* sqlite3. // Create and populate a new TriggerPrg object with a sub-program // implementing trigger pTrigger with ON CONFLICT policy orconf. func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintptr, orconf int32) uintptr { /* sqlite3.c:140765:19: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(64) + defer tls.Free(64) var pTop uintptr = func() uintptr { if (*Parse)(unsafe.Pointer(pParse)).FpToplevel != 0 { @@ -166897,7 +167405,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt var pPrg uintptr // Value to return var pWhen uintptr = uintptr(0) // Duplicate of trigger WHEN expression var v uintptr // Temporary VM - // var sNC NameContext at bp+16, 56 + // var sNC NameContext at bp+8, 56 // Name context for sub-vdbe var pProgram uintptr = uintptr(0) // Sub-vdbe for trigger program var pSubParse uintptr // Parse context for sub-vdbe @@ -166928,8 +167436,8 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if !(pSubParse != 0) { return uintptr(0) } - libc.Xmemset(tls, bp+16 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) - (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpParse = pSubParse + libc.Xmemset(tls, bp+8 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 8 /* &sNC */)).FpParse = pSubParse (*Parse)(unsafe.Pointer(pSubParse)).Fdb = db (*Parse)(unsafe.Pointer(pSubParse)).FpTriggerTab = pTab (*Parse)(unsafe.Pointer(pSubParse)).FpToplevel = pTop @@ -166943,7 +167451,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FzName != 0 { Xsqlite3VdbeChangeP4(tls, v, -1, - Xsqlite3MPrintf(tls, db, ts+20194 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) + Xsqlite3MPrintf(tls, db, ts+20209 /* "-- TRIGGER %s" */, libc.VaList(bp, (*Trigger)(unsafe.Pointer(pTrigger)).FzName)), -7) } // If one was specified, code the WHEN clause. If it evaluates to false @@ -166952,7 +167460,7 @@ func codeRowTrigger(tls *libc.TLS, pParse uintptr, pTrigger uintptr, pTab uintpt if (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen != 0 { pWhen = Xsqlite3ExprDup(tls, db, (*Trigger)(unsafe.Pointer(pTrigger)).FpWhen, 0) if (int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) == 0) && - (SQLITE_OK == Xsqlite3ResolveExprNames(tls, bp+16 /* &sNC */, pWhen)) { + (SQLITE_OK == Xsqlite3ResolveExprNames(tls, bp+8 /* &sNC */, pWhen)) { iEndTrigger = Xsqlite3VdbeMakeLabel(tls, pSubParse) Xsqlite3ExprIfFalse(tls, pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL) } @@ -167370,8 +167878,8 @@ func updateFromSelect(tls *libc.TLS, pParse uintptr, iEph int32, pPk uintptr, pC // \_______________________/ // pTabList func Xsqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges uintptr, pWhere uintptr, onError int32, pOrderBy uintptr, pLimit uintptr, pUpsert uintptr) { /* sqlite3.c:141372:21: */ - bp := tls.Alloc(124) - defer tls.Free(124) + bp := tls.Alloc(108) + defer tls.Free(108) var i int32 var j int32 @@ -167398,9 +167906,9 @@ func Xsqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui var chngKey U8 // Either chngPk or chngRowid var pRowidExpr uintptr // Expression defining the new record number var iRowidExpr int32 // Index of "rowid=" (or IPK) assignment in pChanges - // var sContext AuthContext at bp+32, 16 + // var sContext AuthContext at bp+16, 16 // The authorization context - // var sNC NameContext at bp+56, 56 + // var sNC NameContext at bp+40, 56 // The name-context to resolve expressions in var iDb int32 // Database containing the table being updated var eOnePass int32 // ONEPASS_XXX value from where.c @@ -167411,17 +167919,17 @@ func Xsqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui var isView int32 // True when updating a view (INSTEAD OF trigger) var pTrigger uintptr // List of triggers on pTab, if required - // var tmask int32 at bp+48, 4 + // var tmask int32 at bp+32, 4 // Mask of TRIGGER_BEFORE|TRIGGER_AFTER var newmask int32 // Mask of NEW.* columns accessed by BEFORE triggers var iEph int32 // Ephemeral table holding all primary key values var nKey int32 // Number of elements in regKey for WITHOUT ROWID - // var aiCurOnePass [2]int32 at bp+112, 8 + // var aiCurOnePass [2]int32 at bp+96, 8 // The write cursors opened by WHERE_ONEPASS var addrOpen int32 // Address of OP_OpenEphemeral var iPk int32 // First of nPk cells holding PRIMARY KEY value var nPk I16 // Number of components of the PRIMARY KEY - // var bReplace int32 at bp+120, 4 + // var bReplace int32 at bp+104, 4 // True if REPLACE conflict resolution might happen var bFinishSeek int32 // The OP_FinishSeek opcode is needed var nChangeFrom int32 // If there is a FROM, pChanges->nExpr, else 0 @@ -167455,7 +167963,7 @@ func Xsqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui addrOpen = 0 iPk = 0 nPk = int16(0) - *(*int32)(unsafe.Pointer(bp + 120 /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) = 0 bFinishSeek = 1 nChangeFrom = 0 regRowCount = 0 @@ -167466,7 +167974,7 @@ func Xsqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui regRowSet = 0 regKey = 0 // composite PRIMARY KEY value - libc.Xmemset(tls, bp+32 /* &sContext */, 0, uint64(unsafe.Sizeof(AuthContext{}))) + libc.Xmemset(tls, bp+16 /* &sContext */, 0, uint64(unsafe.Sizeof(AuthContext{}))) db = (*Parse)(unsafe.Pointer(pParse)).Fdb if !(((*Parse)(unsafe.Pointer(pParse)).FnErr != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0)) { goto __1 @@ -167487,7 +167995,7 @@ __2: // Figure out if we have any triggers and if the table being // updated is a view. - pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_UPDATE, pChanges, bp+48 /* &tmask */) + pTrigger = Xsqlite3TriggersExist(tls, pParse, pTab, TK_UPDATE, pChanges, bp+32 /* &tmask */) isView = (libc.Bool32((*Table)(unsafe.Pointer(pTab)).FpSelect != uintptr(0))) // If there was a FROM clause, set nChangeFrom to the number of expressions @@ -167506,7 +168014,7 @@ __2: goto update_cleanup __3: ; - if !(Xsqlite3IsReadOnly(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 48 /* tmask */))) != 0) { + if !(Xsqlite3IsReadOnly(tls, pParse, pTab, *(*int32)(unsafe.Pointer(bp + 32 /* tmask */))) != 0) { goto __4 } goto update_cleanup @@ -167585,11 +168093,11 @@ __13: ; // Initialize the name-context - libc.Xmemset(tls, bp+56 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) - (*NameContext)(unsafe.Pointer(bp + 56 /* &sNC */)).FpParse = pParse - (*NameContext)(unsafe.Pointer(bp + 56 /* &sNC */)).FpSrcList = pTabList - *(*uintptr)(unsafe.Pointer(bp + 56 /* &sNC */ + 16 /* &.uNC */)) = pUpsert - (*NameContext)(unsafe.Pointer(bp + 56 /* &sNC */)).FncFlags = NC_UUpsert + libc.Xmemset(tls, bp+40 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 40 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 40 /* &sNC */)).FpSrcList = pTabList + *(*uintptr)(unsafe.Pointer(bp + 40 /* &sNC */ + 16 /* &.uNC */)) = pUpsert + (*NameContext)(unsafe.Pointer(bp + 40 /* &sNC */)).FncFlags = NC_UUpsert // Begin generating code. v = Xsqlite3GetVdbe(tls, pParse) @@ -167613,7 +168121,7 @@ __15: } // If this is an UPDATE with a FROM clause, do not resolve expressions // here. The call to sqlite3Select() below will do that. - if !((nChangeFrom == 0) && (Xsqlite3ResolveExprNames(tls, bp+56 /* &sNC */, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FpExpr) != 0)) { + if !((nChangeFrom == 0) && (Xsqlite3ResolveExprNames(tls, bp+40 /* &sNC */, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FpExpr) != 0)) { goto __18 } goto update_cleanup @@ -167646,7 +168154,7 @@ __25: } Xsqlite3ErrorMsg(tls, pParse, - ts+20208, /* "cannot UPDATE ge..." */ + ts+20223, /* "cannot UPDATE ge..." */ libc.VaList(bp, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol+uintptr(j)*32)).FzName)) goto update_cleanup __27: @@ -167678,7 +168186,7 @@ __21: iRowidExpr = i goto __30 __29: - Xsqlite3ErrorMsg(tls, pParse, ts+20244 /* "no such column: ..." */, libc.VaList(bp+16, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) + Xsqlite3ErrorMsg(tls, pParse, ts+20259 /* "no such column: ..." */, libc.VaList(bp+8, (*ExprList_item)(unsafe.Pointer((pChanges+8 /* &.a */)+uintptr(i)*32)).FzEName)) (*Parse)(unsafe.Pointer(pParse)).FcheckSchema = U8(1) goto update_cleanup __30: @@ -167689,7 +168197,7 @@ __28: rc = Xsqlite3AuthCheck(tls, pParse, SQLITE_UPDATE, (*Table)(unsafe.Pointer(pTab)).FzName, func() uintptr { if j < 0 { - return ts + 8035 /* "ROWID" */ + return ts + 8050 /* "ROWID" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(j)*32)).FzName }(), @@ -167793,7 +168301,7 @@ __34: if !(onError == OE_Replace) { goto __44 } - *(*int32)(unsafe.Pointer(bp + 120 /* bReplace */)) = 1 + *(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) = 1 __44: ; nAllIdx = 0 @@ -167824,7 +168332,7 @@ __50: if !((onError == OE_Default) && (int32((*Index)(unsafe.Pointer(pIdx)).FonError) == OE_Replace)) { goto __54 } - *(*int32)(unsafe.Pointer(bp + 120 /* bReplace */)) = 1 + *(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) = 1 __54: ; goto __52 @@ -167855,7 +168363,7 @@ __46: __47: ; *(*int32)(unsafe.Pointer(aRegIdx + uintptr(nAllIdx)*4)) = libc.PreIncInt32(&(*Parse)(unsafe.Pointer(pParse)).FnMem, 1) // Register storing the table record - if !(*(*int32)(unsafe.Pointer(bp + 120 /* bReplace */)) != 0) { + if !(*(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) != 0) { goto __56 } // If REPLACE conflict resolution might be invoked, open cursors on all @@ -167906,7 +168414,7 @@ __58: if !(isView != 0) { goto __61 } - Xsqlite3AuthContextPush(tls, pParse, bp+32 /* &sContext */, (*Table)(unsafe.Pointer(pTab)).FzName) + Xsqlite3AuthContextPush(tls, pParse, bp+16 /* &sContext */, (*Table)(unsafe.Pointer(pTab)).FzName) __61: ; @@ -167924,7 +168432,7 @@ __62: // Resolve the column names in all the expressions in the // WHERE clause. - if !((nChangeFrom == 0) && (Xsqlite3ResolveExprNames(tls, bp+56 /* &sNC */, pWhere) != 0)) { + if !((nChangeFrom == 0) && (Xsqlite3ResolveExprNames(tls, bp+40 /* &sNC */, pWhere) != 0)) { goto __63 } goto update_cleanup @@ -168054,7 +168562,7 @@ __76: // things might disturb a cursor being used to scan through the table // or index, causing a single-pass approach to malfunction. flags = WHERE_ONEPASS_DESIRED - if !((((!(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0) && !(pTrigger != 0)) && !(hasFK != 0)) && !(chngKey != 0)) && !(*(*int32)(unsafe.Pointer(bp + 120 /* bReplace */)) != 0)) { + if !((((!(int32((*Parse)(unsafe.Pointer(pParse)).Fnested) != 0) && !(pTrigger != 0)) && !(hasFK != 0)) && !(chngKey != 0)) && !(*(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) != 0)) { goto __78 } flags = flags | (WHERE_ONEPASS_MULTIROW) @@ -168078,7 +168586,7 @@ __79: // Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI // strategy that uses an index for which one or more columns are being // updated. - eOnePass = Xsqlite3WhereOkOnePass(tls, pWInfo, bp+112 /* &aiCurOnePass[0] */) + eOnePass = Xsqlite3WhereOkOnePass(tls, pWInfo, bp+96 /* &aiCurOnePass[0] */) bFinishSeek = Xsqlite3WhereUsesDeferredSeek(tls, pWInfo) if !(eOnePass != ONEPASS_SINGLE) { goto __80 @@ -168087,7 +168595,7 @@ __79: if !(eOnePass == ONEPASS_MULTI) { goto __81 } - iCur = *(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */ + 1*4)) + iCur = *(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) if !(((iCur >= 0) && (iCur != iDataCur)) && (*(*U8)(unsafe.Pointer(aToOpen + uintptr((iCur - iBaseCur)))) != 0)) { goto __82 } @@ -168188,22 +168696,22 @@ __95: if !(eOnePass != ONEPASS_OFF) { goto __97 } - if !(*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */)) >= 0) { + if !(*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */)) >= 0) { goto __98 } - *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */)) - iBaseCur)))) = U8(0) + *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */)) - iBaseCur)))) = U8(0) __98: ; - if !(*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */ + 1*4)) >= 0) { + if !(*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) >= 0) { goto __99 } - *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */ + 1*4)) - iBaseCur)))) = U8(0) + *(*U8)(unsafe.Pointer(aToOpen + uintptr((*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) - iBaseCur)))) = U8(0) __99: ; __97: ; - if !((eOnePass == ONEPASS_MULTI) && ((nIdx - (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */ + 1*4)) >= 0))) > 0)) { + if !((eOnePass == ONEPASS_MULTI) && ((nIdx - (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) >= 0))) > 0)) { goto __100 } addrOnce = Xsqlite3VdbeAddOp0(tls, v, OP_Once) @@ -168224,8 +168732,8 @@ __96: if !(eOnePass != ONEPASS_OFF) { goto __102 } - if !((*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */)) != iDataCur) && - (*(*int32)(unsafe.Pointer(bp + 112 /* &aiCurOnePass[0] */ + 1*4)) != iDataCur)) { + if !((*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */)) != iDataCur) && + (*(*int32)(unsafe.Pointer(bp + 96 /* &aiCurOnePass[0] */ + 1*4)) != iDataCur)) { goto __104 } @@ -168438,7 +168946,7 @@ __137: ; goto __135 __134: - if !(((0 == (*(*int32)(unsafe.Pointer(bp + 48 /* tmask */)) & TRIGGER_BEFORE)) || (i > 31)) || ((uint32(newmask) & (uint32((uint32(1))) << (i))) != 0)) { + if !(((0 == (*(*int32)(unsafe.Pointer(bp + 32 /* tmask */)) & TRIGGER_BEFORE)) || (i > 31)) || ((uint32(newmask) & (uint32((uint32(1))) << (i))) != 0)) { goto __138 } // This branch loads the value of a column that will not be changed @@ -168477,7 +168985,7 @@ __140: // Fire any BEFORE UPDATE triggers. This happens before constraints are // verified. One could argue that this is wrong. - if !((*(*int32)(unsafe.Pointer(bp + 48 /* tmask */)) & TRIGGER_BEFORE) != 0) { + if !((*(*int32)(unsafe.Pointer(bp + 32 /* tmask */)) & TRIGGER_BEFORE) != 0) { goto __141 } Xsqlite3TableAffinity(tls, v, pTab, regNew) @@ -168563,13 +169071,13 @@ __141: // Do constraint checks. Xsqlite3GenerateConstraintChecks(tls, pParse, pTab, aRegIdx, iDataCur, iIdxCur, - regNewRowid, regOldRowid, chngKey, uint8(onError), labelContinue, bp+120, /* &bReplace */ + regNewRowid, regOldRowid, chngKey, uint8(onError), labelContinue, bp+104, /* &bReplace */ aXRef, uintptr(0)) // If REPLACE conflict handling may have been used, or if the PK of the // row is changing, then the GenerateConstraintChecks() above may have // moved cursor iDataCur. Reseek it. - if !((*(*int32)(unsafe.Pointer(bp + 120 /* bReplace */)) != 0) || (chngKey != 0)) { + if !((*(*int32)(unsafe.Pointer(bp + 104 /* bReplace */)) != 0) || (chngKey != 0)) { goto __154 } if !(pPk != 0) { @@ -168720,12 +169228,12 @@ __168: } Xsqlite3VdbeAddOp2(tls, v, OP_ChngCntRow, regRowCount, 1) Xsqlite3VdbeSetNumCols(tls, v, 1) - Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+20263 /* "rows updated" */, uintptr(0)) + Xsqlite3VdbeSetColName(tls, v, 0, COLNAME_NAME, ts+20278 /* "rows updated" */, uintptr(0)) __169: ; update_cleanup: - Xsqlite3AuthContextPop(tls, bp+32 /* &sContext */) + Xsqlite3AuthContextPop(tls, bp+16 /* &sContext */) Xsqlite3DbFree(tls, db, aXRef) // Also frees aRegIdx[] and aToOpen[] Xsqlite3SrcListDelete(tls, db, pTabList) Xsqlite3ExprListDelete(tls, db, pChanges) @@ -168988,8 +169496,8 @@ func Xsqlite3UpsertNew(tls *libc.TLS, db uintptr, pTarget uintptr, pTargetWhere // Return SQLITE_OK if everything works, or an error code is something // is wrong. func Xsqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr, pUpsert uintptr) int32 { /* sqlite3.c:142514:20: */ - bp := tls.Alloc(248) - defer tls.Free(248) + bp := tls.Alloc(232) + defer tls.Free(232) var pTab uintptr // That table into which we are inserting var rc int32 // Result code @@ -168997,28 +169505,28 @@ func Xsqlite3UpsertAnalyzeTarget(tls *libc.TLS, pParse uintptr, pTabList uintptr var pIdx uintptr // One of the indexes of pTab var pTarget uintptr // The conflict-target clause var pTerm uintptr // One term of the conflict-target clause - // var sNC NameContext at bp+32, 56 + // var sNC NameContext at bp+16, 56 // Context for resolving symbolic names - // var sCol [2]Expr at bp+88, 144 + // var sCol [2]Expr at bp+72, 144 // Index column converted into an Expr var nClause int32 = 0 // Counter of ON CONFLICT clauses // Resolve all symbolic names in the conflict-target clause, which // includes both the list of columns and the optional partial-index // WHERE clause. - libc.Xmemset(tls, bp+32 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) - (*NameContext)(unsafe.Pointer(bp + 32 /* &sNC */)).FpParse = pParse - (*NameContext)(unsafe.Pointer(bp + 32 /* &sNC */)).FpSrcList = pTabList + libc.Xmemset(tls, bp+16 /* &sNC */, 0, uint64(unsafe.Sizeof(NameContext{}))) + (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpParse = pParse + (*NameContext)(unsafe.Pointer(bp + 16 /* &sNC */)).FpSrcList = pTabList __1: if !((pUpsert != 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget != 0)) { goto __3 } { - rc = Xsqlite3ResolveExprListNames(tls, bp+32 /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) + rc = Xsqlite3ResolveExprListNames(tls, bp+16 /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTarget) if rc != 0 { return rc } - rc = Xsqlite3ResolveExprNames(tls, bp+32 /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) + rc = Xsqlite3ResolveExprNames(tls, bp+16 /* &sNC */, (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertTargetWhere) if rc != 0 { return rc } @@ -169041,11 +169549,11 @@ __1: // operator and sCol[1] will be the TK_COLUMN operator. Code below // will populate the specific collation and column number values // prior to comparing against the conflict-target expression. - libc.Xmemset(tls, bp+88 /* &sCol[0] */, 0, uint64(unsafe.Sizeof([2]Expr{}))) - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */)).Fop = U8(TK_COLLATE) - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */)).FpLeft = (bp + 88 /* &sCol */ + 1*72) - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */ + 1*72)).Fop = U8(TK_COLUMN) - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */ + 1*72)).FiTable = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor + libc.Xmemset(tls, bp+72 /* &sCol[0] */, 0, uint64(unsafe.Sizeof([2]Expr{}))) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).Fop = U8(TK_COLLATE) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).FpLeft = (bp + 72 /* &sCol */ + 1*72) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */ + 1*72)).Fop = U8(TK_COLUMN) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */ + 1*72)).FiTable = (*SrcItem)(unsafe.Pointer((pTabList + 8 /* &.a */))).FiCursor // Check for matches against other indexes for pIdx = (*Table)(unsafe.Pointer(pTab)).FpIndex; pIdx != 0; pIdx = (*Index)(unsafe.Pointer(pIdx)).FpNext { @@ -169070,18 +169578,18 @@ __1: nn = int32((*Index)(unsafe.Pointer(pIdx)).FnKeyCol) for ii = 0; ii < nn; ii++ { var pExpr uintptr - *(*uintptr)(unsafe.Pointer(bp + 88 /* &sCol */ + 8 /* &.u */)) = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(ii)*8)) + *(*uintptr)(unsafe.Pointer(bp + 72 /* &sCol */ + 8 /* &.u */)) = *(*uintptr)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FazColl + uintptr(ii)*8)) if int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2))) == (-2) { pExpr = (*ExprList_item)(unsafe.Pointer(((*Index)(unsafe.Pointer(pIdx)).FaColExpr + 8 /* &.a */) + uintptr(ii)*32)).FpExpr if int32((*Expr)(unsafe.Pointer(pExpr)).Fop) != TK_COLLATE { - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */)).FpLeft = pExpr - pExpr = (bp + 88 /* &sCol */) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).FpLeft = pExpr + pExpr = (bp + 72 /* &sCol */) } } else { - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */)).FpLeft = (bp + 88 /* &sCol */ + 1*72) - (*Expr)(unsafe.Pointer(bp + 88 /* &sCol */ + 1*72)).FiColumn = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2)) - pExpr = (bp + 88 /* &sCol */) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */)).FpLeft = (bp + 72 /* &sCol */ + 1*72) + (*Expr)(unsafe.Pointer(bp + 72 /* &sCol */ + 1*72)).FiColumn = *(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(ii)*2)) + pExpr = (bp + 72 /* &sCol */) } for jj = 0; jj < nn; jj++ { if Xsqlite3ExprCompare(tls, pParse, (*ExprList_item)(unsafe.Pointer((pTarget+8 /* &.a */)+uintptr(jj)*32)).FpExpr, pExpr, iCursor) < 2 { @@ -169102,15 +169610,15 @@ __1: break } if (*Upsert)(unsafe.Pointer(pUpsert)).FpUpsertIdx == uintptr(0) { - // var zWhich [16]int8 at bp+232, 16 + // var zWhich [16]int8 at bp+216, 16 if (nClause == 0) && ((*Upsert)(unsafe.Pointer(pUpsert)).FpNextUpsert == uintptr(0)) { - *(*int8)(unsafe.Pointer(bp + 232 /* &zWhich[0] */)) = int8(0) + *(*int8)(unsafe.Pointer(bp + 216 /* &zWhich[0] */)) = int8(0) } else { - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+232 /* &zWhich[0] */, ts+20276 /* "%r " */, libc.VaList(bp, (nClause+1))) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([16]int8{})), bp+216 /* &zWhich[0] */, ts+20291 /* "%r " */, libc.VaList(bp, (nClause+1))) } Xsqlite3ErrorMsg(tls, pParse, - ts+20280 /* "%sON CONFLICT cl..." */, libc.VaList(bp+16, bp+232 /* &zWhich[0] */)) + ts+20295 /* "%sON CONFLICT cl..." */, libc.VaList(bp+8, bp+216 /* &zWhich[0] */)) return SQLITE_ERROR } @@ -169201,7 +169709,7 @@ func Xsqlite3UpsertDoUpdate(tls *libc.TLS, pParse uintptr, pUpsert uintptr, pTab i = Xsqlite3VdbeAddOp4Int(tls, v, OP_Found, iDataCur, 0, iPk, nPk) Xsqlite3VdbeAddOp4(tls, v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, - ts+12273 /* "corrupt database" */, -1) + ts+12288 /* "corrupt database" */, -1) Xsqlite3MayAbort(tls, pParse) Xsqlite3VdbeJumpHere(tls, v, i) } @@ -169269,7 +169777,7 @@ func execSql(tls *libc.TLS, db uintptr, pzErrMsg uintptr, zSql uintptr) int32 { // then run VACUUM to get those statements to execute at inappropriate // times. if (zSubSql != 0) && - ((libc.Xstrncmp(tls, zSubSql, ts+20353 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+20357 /* "INS" */, uint64(3)) == 0)) { + ((libc.Xstrncmp(tls, zSubSql, ts+20368 /* "CRE" */, uint64(3)) == 0) || (libc.Xstrncmp(tls, zSubSql, ts+20372 /* "INS" */, uint64(3)) == 0)) { rc = execSql(tls, db, pzErrMsg, zSubSql) if rc != SQLITE_OK { break @@ -169389,8 +169897,8 @@ build_vacuum_end: // This routine implements the OP_Vacuum opcode of the VDBE. func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, pOut uintptr) int32 { /* sqlite3.c:142885:36: */ - bp := tls.Alloc(92) - defer tls.Free(92) + bp := tls.Alloc(52) + defer tls.Free(52) var rc int32 // Return code from service routines var pMain uintptr // The database being vacuumed @@ -169408,9 +169916,9 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p var zDbMain uintptr // Schema name of database to vacuum var zOut uintptr var id uintptr - // var sz I64 at bp+80, 8 + // var sz I64 at bp+40, 8 - // var meta U32 at bp+88, 4 + // var meta U32 at bp+48, 4 var i int32 rc = SQLITE_OK @@ -169419,14 +169927,14 @@ func Xsqlite3RunVacuum(tls *libc.TLS, pzErrMsg uintptr, db uintptr, iDb int32, p if !(!(int32((*Sqlite3)(unsafe.Pointer(db)).FautoCommit) != 0)) { goto __1 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+20361 /* "cannot VACUUM fr..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+20376 /* "cannot VACUUM fr..." */) return SQLITE_ERROR // IMP: R-12218-18073 __1: ; if !((*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive > 1) { goto __2 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+20401 /* "cannot VACUUM - ..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+20416 /* "cannot VACUUM - ..." */) return SQLITE_ERROR // IMP: R-15610-35227 __2: ; @@ -169437,7 +169945,7 @@ __2: if !(Xsqlite3_value_type(tls, pOut) != SQLITE_TEXT) { goto __5 } - Xsqlite3SetString(tls, pzErrMsg, db, ts+20444 /* "non-text filenam..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+20459 /* "non-text filenam..." */) return SQLITE_ERROR __5: ; @@ -169446,7 +169954,7 @@ __5: *(*uint32)(unsafe.Pointer(db + 76 /* &.openFlags */)) |= (uint32(SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE)) goto __4 __3: - zOut = ts + 740 /* "" */ + zOut = ts + 755 /* "" */ __4: ; @@ -169482,7 +169990,7 @@ __4: // time to parse and run the PRAGMA to turn journalling off than it does // to write the journal header file. nDb = (*Sqlite3)(unsafe.Pointer(db)).FnDb - rc = execSqlF(tls, db, pzErrMsg, ts+20462 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) + rc = execSqlF(tls, db, pzErrMsg, ts+20477 /* "ATTACH %Q AS vac..." */, libc.VaList(bp, zOut)) (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = saved_openFlags if !(rc != SQLITE_OK) { goto __6 @@ -169498,12 +170006,12 @@ __6: goto __7 } id = Xsqlite3PagerFile(tls, Xsqlite3BtreePager(tls, pTemp)) - *(*I64)(unsafe.Pointer(bp + 80 /* sz */)) = int64(0) - if !(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0)) && ((Xsqlite3OsFileSize(tls, id, bp+80 /* &sz */) != SQLITE_OK) || (*(*I64)(unsafe.Pointer(bp + 80 /* sz */)) > int64(0)))) { + *(*I64)(unsafe.Pointer(bp + 40 /* sz */)) = int64(0) + if !(((*Sqlite3_file)(unsafe.Pointer(id)).FpMethods != uintptr(0)) && ((Xsqlite3OsFileSize(tls, id, bp+40 /* &sz */) != SQLITE_OK) || (*(*I64)(unsafe.Pointer(bp + 40 /* sz */)) > int64(0)))) { goto __8 } rc = SQLITE_ERROR - Xsqlite3SetString(tls, pzErrMsg, db, ts+20485 /* "output file alre..." */) + Xsqlite3SetString(tls, pzErrMsg, db, ts+20500 /* "output file alre..." */) goto end_of_vacuum __8: ; @@ -169519,7 +170027,7 @@ __7: // Begin a transaction and take an exclusive lock on the main database // file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, // to ensure that we do not try to change the page-size on a WAL database. - rc = execSql(tls, db, pzErrMsg, ts+14565 /* "BEGIN" */) + rc = execSql(tls, db, pzErrMsg, ts+14580 /* "BEGIN" */) if !(rc != SQLITE_OK) { goto __9 } @@ -169570,8 +170078,8 @@ __12: (*Sqlite3)(unsafe.Pointer(db)).Finit.FiDb = U8(nDb) // force new CREATE statements into vacuum_db rc = execSqlF(tls, db, pzErrMsg, - ts+20512, /* "SELECT sql FROM ..." */ - libc.VaList(bp+16, zDbMain)) + ts+20527, /* "SELECT sql FROM ..." */ + libc.VaList(bp+8, zDbMain)) if !(rc != SQLITE_OK) { goto __13 } @@ -169580,8 +170088,8 @@ __13: ; rc = execSqlF(tls, db, pzErrMsg, - ts+20620, /* "SELECT sql FROM ..." */ - libc.VaList(bp+32, zDbMain)) + ts+20635, /* "SELECT sql FROM ..." */ + libc.VaList(bp+16, zDbMain)) if !(rc != SQLITE_OK) { goto __14 } @@ -169595,8 +170103,8 @@ __14: // the contents to the temporary database. rc = execSqlF(tls, db, pzErrMsg, - ts+20674, /* "SELECT'INSERT IN..." */ - libc.VaList(bp+48, zDbMain)) + ts+20689, /* "SELECT'INSERT IN..." */ + libc.VaList(bp+24, zDbMain)) *(*U32)(unsafe.Pointer(db + 44 /* &.mDbFlags */)) &= (libc.Uint32FromInt32(libc.CplInt32(DBFLAG_Vacuum))) if !(rc != SQLITE_OK) { @@ -169612,8 +170120,8 @@ __15: // from the schema table. rc = execSqlF(tls, db, pzErrMsg, - ts+20825, /* "INSERT INTO vacu..." */ - libc.VaList(bp+64, zDbMain)) + ts+20840, /* "INSERT INTO vacu..." */ + libc.VaList(bp+32, zDbMain)) if !(rc != 0) { goto __16 } @@ -169636,8 +170144,8 @@ __17: } // GetMeta() and UpdateMeta() cannot fail in this context because // we already have page 1 loaded into cache and marked dirty. - Xsqlite3BtreeGetMeta(tls, pMain, int32(aCopy[i]), bp+88 /* &meta */) - rc = Xsqlite3BtreeUpdateMeta(tls, pTemp, int32(aCopy[i]), (*(*U32)(unsafe.Pointer(bp + 88 /* meta */)) + U32(aCopy[(i+1)]))) + Xsqlite3BtreeGetMeta(tls, pMain, int32(aCopy[i]), bp+48 /* &meta */) + rc = Xsqlite3BtreeUpdateMeta(tls, pTemp, int32(aCopy[i]), (*(*U32)(unsafe.Pointer(bp + 48 /* meta */)) + U32(aCopy[(i+1)]))) if !(rc != SQLITE_OK) { goto __20 } @@ -169985,14 +170493,14 @@ func Xsqlite3VtabClear(tls *libc.TLS, db uintptr, p uintptr) { /* sqlite3.c:1434 // string will be freed automatically when the table is // deleted. func addModuleArgument(tls *libc.TLS, pParse uintptr, pTable uintptr, zArg uintptr) { /* sqlite3.c:143503:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var nBytes Sqlite3_int64 = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(2 + (*Table)(unsafe.Pointer(pTable)).FnModuleArg)))) var azModuleArg uintptr var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if ((*Table)(unsafe.Pointer(pTable)).FnModuleArg + 3) >= *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 2*4)) { - Xsqlite3ErrorMsg(tls, pParse, ts+12503 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+12518 /* "too many columns..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName)) } azModuleArg = Xsqlite3DbRealloc(tls, db, (*Table)(unsafe.Pointer(pTable)).FazModuleArg, uint64(nBytes)) if azModuleArg == uintptr(0) { @@ -170053,8 +170561,8 @@ func addArgumentToVtab(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:143574:13: // The parser calls this routine after the CREATE VIRTUAL TABLE statement // has been completely parsed. func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* sqlite3.c:143587:21: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(64) + defer tls.Free(64) var pTab uintptr = (*Parse)(unsafe.Pointer(pParse)).FpNewTable // The table being constructed var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection @@ -170086,7 +170594,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s if pEnd != 0 { (*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(pEnd)).Fz) - int64((*Parse)(unsafe.Pointer(pParse)).FsNameToken.Fz)) / 1))) + (*Token)(unsafe.Pointer(pEnd)).Fn) } - zStmt = Xsqlite3MPrintf(tls, db, ts+20955 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) + zStmt = Xsqlite3MPrintf(tls, db, ts+20970 /* "CREATE VIRTUAL T..." */, libc.VaList(bp, (pParse+240 /* &.sNameToken */))) // A slot for the record has already been allocated in the // schema table. We just need to update that slot with all @@ -170098,8 +170606,8 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s iDb = Xsqlite3SchemaToIndex(tls, db, (*Table)(unsafe.Pointer(pTab)).FpSchema) Xsqlite3NestedParse(tls, pParse, - ts+20979, /* "UPDATE %Q.sqlite..." */ - libc.VaList(bp+16, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, + ts+20994, /* "UPDATE %Q.sqlite..." */ + libc.VaList(bp+8, (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb+uintptr(iDb)*32)).FzDbSName, (*Table)(unsafe.Pointer(pTab)).FzName, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt, @@ -170108,7 +170616,7 @@ func Xsqlite3VtabFinishParse(tls *libc.TLS, pParse uintptr, pEnd uintptr) { /* s Xsqlite3ChangeCookie(tls, pParse, iDb) Xsqlite3VdbeAddOp0(tls, v, OP_Expire) - zWhere = Xsqlite3MPrintf(tls, db, ts+21078 /* "name=%Q AND sql=..." */, libc.VaList(bp+64, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) + zWhere = Xsqlite3MPrintf(tls, db, ts+21093 /* "name=%Q AND sql=..." */, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName, zStmt)) Xsqlite3VdbeAddParseSchemaOp(tls, v, iDb, zWhere, uint16(0)) Xsqlite3DbFree(tls, db, zStmt) @@ -170155,16 +170663,16 @@ func Xsqlite3VtabArgExtend(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite // pointer to the function to invoke is passed as the fourth parameter // to this procedure. func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, xConstruct uintptr, pzErr uintptr) int32 { /* sqlite3.c:143699:12: */ - bp := tls.Alloc(104) - defer tls.Free(104) + bp := tls.Alloc(72) + defer tls.Free(72) - // var sCtx VtabCtx at bp+64, 32 + // var sCtx VtabCtx at bp+32, 32 var pVTable uintptr var rc int32 var azArg uintptr = (*Table)(unsafe.Pointer(pTab)).FazModuleArg var nArg int32 = (*Table)(unsafe.Pointer(pTab)).FnModuleArg - *(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) var zModuleName uintptr var iDb int32 var pCtx uintptr @@ -170173,7 +170681,7 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, for pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx; pCtx != 0; pCtx = (*VtabCtx)(unsafe.Pointer(pCtx)).FpPrior { if (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab == pTab { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, - ts+21097 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) + ts+21112 /* "vtable construct..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName)) return SQLITE_LOCKED } } @@ -170198,23 +170706,23 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, // Invoke the virtual table constructor - (*VtabCtx)(unsafe.Pointer(bp + 64 /* &sCtx */)).FpTab = pTab - (*VtabCtx)(unsafe.Pointer(bp + 64 /* &sCtx */)).FpVTable = pVTable - (*VtabCtx)(unsafe.Pointer(bp + 64 /* &sCtx */)).FpPrior = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx - (*VtabCtx)(unsafe.Pointer(bp + 64 /* &sCtx */)).FbDeclared = 0 - (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx = bp + 64 /* &sCtx */ - rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xConstruct)))(tls, db, (*Module)(unsafe.Pointer(pMod)).FpAux, nArg, azArg, (pVTable + 16 /* &.pVtab */), bp+96 /* &zErr */) - (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx = (*VtabCtx)(unsafe.Pointer(bp + 64 /* &sCtx */)).FpPrior + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpTab = pTab + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpVTable = pVTable + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpPrior = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx + (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FbDeclared = 0 + (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx = bp + 32 /* &sCtx */ + rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&xConstruct)))(tls, db, (*Module)(unsafe.Pointer(pMod)).FpAux, nArg, azArg, (pVTable + 16 /* &.pVtab */), bp+64 /* &zErr */) + (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx = (*VtabCtx)(unsafe.Pointer(bp + 32 /* &sCtx */)).FpPrior if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, db) } if SQLITE_OK != rc { - if *(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+21139 /* "vtable construct..." */, libc.VaList(bp+16, zModuleName)) + if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) == uintptr(0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+21154 /* "vtable construct..." */, libc.VaList(bp+8, zModuleName)) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+3615 /* "%s" */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+3630 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } Xsqlite3DbFree(tls, db, pVTable) } else if (*VTable)(unsafe.Pointer(pVTable)).FpVtab != 0 { @@ -170224,9 +170732,9 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Sqlite3_vtab)(unsafe.Pointer((*VTable)(unsafe.Pointer(pVTable)).FpVtab)).FpModule = (*Module)(unsafe.Pointer(pMod)).FpModule (*Module)(unsafe.Pointer(pMod)).FnRefModule++ (*VTable)(unsafe.Pointer(pVTable)).FnRef = 1 - if (*VtabCtx)(unsafe.Pointer(bp+64 /* &sCtx */)).FbDeclared == 0 { - var zFormat uintptr = ts + 21169 /* "vtable construct..." */ - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+48, (*Table)(unsafe.Pointer(pTab)).FzName)) + if (*VtabCtx)(unsafe.Pointer(bp+32 /* &sCtx */)).FbDeclared == 0 { + var zFormat uintptr = ts + 21184 /* "vtable construct..." */ + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, zFormat, libc.VaList(bp+24, (*Table)(unsafe.Pointer(pTab)).FzName)) Xsqlite3VtabUnlock(tls, pVTable) rc = SQLITE_ERROR } else { @@ -170241,12 +170749,12 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, (*Table)(unsafe.Pointer(pTab)).FpVTable = pVTable for iCol = 0; iCol < int32((*Table)(unsafe.Pointer(pTab)).FnCol); iCol++ { - var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+740 /* "" */) + var zType uintptr = Xsqlite3ColumnType(tls, ((*Table)(unsafe.Pointer(pTab)).FaCol + uintptr(iCol)*32), ts+755 /* "" */) var nType int32 var i int32 = 0 nType = Xsqlite3Strlen30(tls, zType) for i = 0; i < nType; i++ { - if ((0 == Xsqlite3_strnicmp(tls, ts+16023 /* "hidden" */, (zType+uintptr(i)), 6)) && + if ((0 == Xsqlite3_strnicmp(tls, ts+16038 /* "hidden" */, (zType+uintptr(i)), 6)) && ((i == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i - 1))))) == ' '))) && ((int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == 0) || (int32(*(*int8)(unsafe.Pointer(zType + uintptr((i + 6))))) == ' ')) { break @@ -170287,8 +170795,8 @@ func vtabCallConstructor(tls *libc.TLS, db uintptr, pTab uintptr, pMod uintptr, // // This call is a no-op if table pTab is not a virtual table. func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 { /* sqlite3.c:143832:20: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb var zMod uintptr @@ -170305,16 +170813,16 @@ func Xsqlite3VtabCallConnect(tls *libc.TLS, pParse uintptr, pTab uintptr) int32 if !(pMod != 0) { var zModule uintptr = *(*uintptr)(unsafe.Pointer((*Table)(unsafe.Pointer(pTab)).FazModuleArg)) - Xsqlite3ErrorMsg(tls, pParse, ts+21215 /* "no such module: ..." */, libc.VaList(bp, zModule)) + Xsqlite3ErrorMsg(tls, pParse, ts+21230 /* "no such module: ..." */, libc.VaList(bp, zModule)) rc = SQLITE_ERROR } else { - *(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)) = uintptr(0) - rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+32 /* &zErr */) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) + rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxConnect, bp+16 /* &zErr */) if rc != SQLITE_OK { - Xsqlite3ErrorMsg(tls, pParse, ts+3615 /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)))) + Xsqlite3ErrorMsg(tls, pParse, ts+3630 /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) (*Parse)(unsafe.Pointer(pParse)).Frc = rc } - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) } return rc @@ -170355,8 +170863,8 @@ func addToVTrans(tls *libc.TLS, db uintptr, pVTab uintptr) { /* sqlite3.c:143890 // description of the error and an SQLITE_XXX error code is returned. // In this case the caller must call sqlite3DbFree(db, ) on *pzErr. func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, pzErr uintptr) int32 { /* sqlite3.c:143904:20: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = SQLITE_OK var pTab uintptr @@ -170373,7 +170881,7 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // invoke it now. If the module has not been registered, return an // error. Otherwise, do nothing. if ((pMod == uintptr(0)) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate == uintptr(0))) || ((*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxDestroy == uintptr(0)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+21215 /* "no such module: ..." */, libc.VaList(bp, zMod)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3MPrintf(tls, db, ts+21230 /* "no such module: ..." */, libc.VaList(bp, zMod)) rc = SQLITE_ERROR } else { rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer((*Module)(unsafe.Pointer(pMod)).FpModule)).FxCreate, pzErr) @@ -170395,14 +170903,14 @@ func Xsqlite3VtabCallCreate(tls *libc.TLS, db uintptr, iDb int32, zTab uintptr, // valid to call this function from within the xCreate() or xConnect() of a // virtual table module. func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int32 { /* sqlite3.c:143945:16: */ - bp := tls.Alloc(432) - defer tls.Free(432) + bp := tls.Alloc(424) + defer tls.Free(424) var pCtx uintptr var rc int32 = SQLITE_OK var pTab uintptr - *(*uintptr)(unsafe.Pointer(bp + 424 /* zErr */)) = uintptr(0) - // var sParse Parse at bp+16, 408 + *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) = uintptr(0) + // var sParse Parse at bp+8, 408 Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) pCtx = (*Sqlite3)(unsafe.Pointer(db)).FpVtabCtx @@ -170413,17 +170921,17 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 } pTab = (*VtabCtx)(unsafe.Pointer(pCtx)).FpTab - libc.Xmemset(tls, bp+16 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) - (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FeParseMode = U8(PARSE_MODE_DECLARE_VTAB) - (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).Fdb = db - (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FnQueryLoop = U32(1) - if ((((SQLITE_OK == Xsqlite3RunParser(tls, bp+16 /* &sParse */, zCreateTable, bp+424 /* &zErr */)) && - ((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpNewTable != 0)) && + libc.Xmemset(tls, bp+8 /* &sParse */, 0, uint64(unsafe.Sizeof(Parse{}))) + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FeParseMode = U8(PARSE_MODE_DECLARE_VTAB) + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).Fdb = db + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FnQueryLoop = U32(1) + if ((((SQLITE_OK == Xsqlite3RunParser(tls, bp+8 /* &sParse */, zCreateTable, bp+416 /* &zErr */)) && + ((*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable != 0)) && !(int32((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed) != 0)) && - !(int32((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpNewTable)).FpSelect) != 0)) && - !((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpNewTable)).FnModuleArg != 0) { + !(int32((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable)).FpSelect) != 0)) && + !((*Table)(unsafe.Pointer((*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable)).FnModuleArg != 0) { if !(int32((*Table)(unsafe.Pointer(pTab)).FaCol) != 0) { - var pNew uintptr = (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FpNewTable + var pNew uintptr = (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FpNewTable var pIdx uintptr (*Table)(unsafe.Pointer(pTab)).FaCol = (*Table)(unsafe.Pointer(pNew)).FaCol (*Table)(unsafe.Pointer(pTab)).FnNVCol = libc.AssignPtrInt16(pTab+70 /* &.nCol */, (*Table)(unsafe.Pointer(pNew)).FnCol) @@ -170449,21 +170957,21 @@ func Xsqlite3_declare_vtab(tls *libc.TLS, db uintptr, zCreateTable uintptr) int3 (*VtabCtx)(unsafe.Pointer(pCtx)).FbDeclared = 1 } else { Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, func() uintptr { - if *(*uintptr)(unsafe.Pointer(bp + 424 /* zErr */)) != 0 { - return ts + 3615 /* "%s" */ + if *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)) != 0 { + return ts + 3630 /* "%s" */ } return uintptr(0) - }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErr */)))) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 424 /* zErr */))) + }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 416 /* zErr */))) rc = SQLITE_ERROR } - (*Parse)(unsafe.Pointer(bp + 16 /* &sParse */)).FeParseMode = U8(PARSE_MODE_NORMAL) + (*Parse)(unsafe.Pointer(bp + 8 /* &sParse */)).FeParseMode = U8(PARSE_MODE_NORMAL) - if (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe != 0 { - Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpVdbe) + if (*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpVdbe != 0 { + Xsqlite3VdbeFinalize(tls, (*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpVdbe) } - Xsqlite3DeleteTable(tls, db, (*Parse)(unsafe.Pointer(bp+16 /* &sParse */)).FpNewTable) - Xsqlite3ParserReset(tls, bp+16 /* &sParse */) + Xsqlite3DeleteTable(tls, db, (*Parse)(unsafe.Pointer(bp+8 /* &sParse */)).FpNewTable) + Xsqlite3ParserReset(tls, bp+8 /* &sParse */) rc = Xsqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) @@ -170788,12 +171296,12 @@ func Xsqlite3VtabMakeWritable(tls *libc.TLS, pParse uintptr, pTab uintptr) { /* // Any virtual table module for which xConnect and xCreate are the same // method can have an eponymous virtual table instance. func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) int32 { /* sqlite3.c:144353:20: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pModule uintptr = (*Module)(unsafe.Pointer(pMod)).FpModule var pTab uintptr - *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)) = uintptr(0) var rc int32 var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Module)(unsafe.Pointer(pMod)).FpEpoTab != 0 { @@ -170820,10 +171328,10 @@ func Xsqlite3VtabEponymousTableInit(tls *libc.TLS, pParse uintptr, pMod uintptr) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) addModuleArgument(tls, pParse, pTab, uintptr(0)) addModuleArgument(tls, pParse, pTab, Xsqlite3DbStrDup(tls, db, (*Table)(unsafe.Pointer(pTab)).FzName)) - rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+16 /* &zErr */) + rc = vtabCallConstructor(tls, db, pTab, pMod, (*Sqlite3_module)(unsafe.Pointer(pModule)).FxConnect, bp+8 /* &zErr */) if rc != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+3615 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */)))) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErr */))) + Xsqlite3ErrorMsg(tls, pParse, ts+3630 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 8 /* zErr */))) Xsqlite3VtabEponymousTableClear(tls, db, pMod) return 0 } @@ -171253,10 +171761,10 @@ type WhereExprMod = WhereExprMod1 /* sqlite3.c:144931:29 */ func explainIndexColumnName(tls *libc.TLS, pIdx uintptr, i int32) uintptr { /* sqlite3.c:145112:19: */ i = int32(*(*I16)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FaiColumn + uintptr(i)*2))) if i == (-2) { - return ts + 21234 /* "" */ + return ts + 21249 /* "" */ } if i == (-1) { - return ts + 16110 /* "rowid" */ + return ts + 16125 /* "rowid" */ } return (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer((*Index)(unsafe.Pointer(pIdx)).FpTable)).FaCol + uintptr(i)*32)).FzName } @@ -171271,35 +171779,35 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i var i int32 if bAnd != 0 { - Xsqlite3_str_append(tls, pStr, ts+21241 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+21256 /* " AND " */, 5) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+21247 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+21262 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+12884 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+12899 /* "," */, 1) } Xsqlite3_str_appendall(tls, pStr, explainIndexColumnName(tls, pIdx, (iTerm+i))) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+5413 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+5428 /* ")" */, 1) } Xsqlite3_str_append(tls, pStr, zOp, 1) if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+21247 /* "(" */, 1) + Xsqlite3_str_append(tls, pStr, ts+21262 /* "(" */, 1) } for i = 0; i < nTerm; i++ { if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+12884 /* "," */, 1) + Xsqlite3_str_append(tls, pStr, ts+12899 /* "," */, 1) } - Xsqlite3_str_append(tls, pStr, ts+5469 /* "?" */, 1) + Xsqlite3_str_append(tls, pStr, ts+5484 /* "?" */, 1) } if nTerm > 1 { - Xsqlite3_str_append(tls, pStr, ts+5413 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+5428 /* ")" */, 1) } } @@ -171316,8 +171824,8 @@ func explainAppendTerm(tls *libc.TLS, pStr uintptr, pIdx uintptr, nTerm int32, i // // "a=? AND b>?" func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3.c:145171:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pIndex uintptr = *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) var nEq U16 = *(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ /* &.nEq */)) @@ -171328,29 +171836,29 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. if (int32(nEq) == 0) && (((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & (U32(WHERE_BTM_LIMIT | WHERE_TOP_LIMIT))) == U32(0)) { return } - Xsqlite3_str_append(tls, pStr, ts+21249 /* " (" */, 2) + Xsqlite3_str_append(tls, pStr, ts+21264 /* " (" */, 2) for i = 0; i < int32(nEq); i++ { var z uintptr = explainIndexColumnName(tls, pIndex, i) if i != 0 { - Xsqlite3_str_append(tls, pStr, ts+21241 /* " AND " */, 5) + Xsqlite3_str_append(tls, pStr, ts+21256 /* " AND " */, 5) } Xsqlite3_str_appendf(tls, pStr, func() uintptr { if i >= int32(nSkip) { - return ts + 21252 /* "%s=?" */ + return ts + 21267 /* "%s=?" */ } - return ts + 21257 /* "ANY(%s)" */ + return ts + 21272 /* "ANY(%s)" */ }(), libc.VaList(bp, z)) } j = i if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_BTM_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+21265 /* ">" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 2 /* &.nBtm */))), j, i, ts+21280 /* ">" */) i = 1 } if ((*WhereLoop)(unsafe.Pointer(pLoop)).FwsFlags & U32(WHERE_TOP_LIMIT)) != 0 { - explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+21267 /* "<" */) + explainAppendTerm(tls, pStr, pIndex, int32(*(*U16)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 4 /* &.nTop */))), j, i, ts+21282 /* "<" */) } - Xsqlite3_str_append(tls, pStr, ts+5413 /* ")" */, 1) + Xsqlite3_str_append(tls, pStr, ts+5428 /* ")" */, 1) } // This function is a no-op unless currently processing an EXPLAIN QUERY PLAN @@ -171361,8 +171869,8 @@ func explainIndexRange(tls *libc.TLS, pStr uintptr, pLoop uintptr) { /* sqlite3. // If an OP_Explain opcode is added to the VM, its address is returned. // Otherwise, if no OP_Explain is coded, zero is returned. func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr, pLevel uintptr, wctrlFlags U16) int32 { /* sqlite3.c:145205:20: */ - bp := tls.Alloc(212) - defer tls.Free(212) + bp := tls.Alloc(180) + defer tls.Free(180) var ret int32 = 0 if int32((*Parse)(unsafe.Pointer((func() uintptr { @@ -171378,9 +171886,9 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr var pLoop uintptr // The controlling WhereLoop object var flags U32 // Flags that describe this loop var zMsg uintptr // Text to add to EQP output - // var str StrAccum at bp+80, 32 + // var str StrAccum at bp+48, 32 // EQP output string - // var zBuf [100]int8 at bp+112, 100 + // var zBuf [100]int8 at bp+80, 100 // Initial space for EQP output string pLoop = (*WhereLevel)(unsafe.Pointer(pLevel)).FpWLoop @@ -171393,13 +171901,13 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr (((flags & U32(WHERE_VIRTUALTABLE)) == U32(0)) && (int32(*(*U16)(unsafe.Pointer((pLoop + 24 /* &.u */ /* &.btree */) /* &.nEq */))) > 0))) || ((int32(wctrlFlags) & (WHERE_ORDERBY_MIN | WHERE_ORDERBY_MAX)) != 0))) - Xsqlite3StrAccumInit(tls, bp+80 /* &str */, db, bp+112 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) - (*StrAccum)(unsafe.Pointer(bp + 80 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) - Xsqlite3_str_appendf(tls, bp+80 /* &str */, ts+21269 /* "%s %S" */, libc.VaList(bp, func() uintptr { + Xsqlite3StrAccumInit(tls, bp+48 /* &str */, db, bp+80 /* &zBuf[0] */, int32(unsafe.Sizeof([100]int8{})), SQLITE_MAX_LENGTH) + (*StrAccum)(unsafe.Pointer(bp + 48 /* &str */)).FprintfFlags = U8(SQLITE_PRINTF_INTERNAL) + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+21284 /* "%s %S" */, libc.VaList(bp, func() uintptr { if isSearch != 0 { - return ts + 21275 /* "SEARCH" */ + return ts + 21290 /* "SEARCH" */ } - return ts + 21282 /* "SCAN" */ + return ts + 21297 /* "SCAN" */ }(), pItem)) if (flags & (U32(WHERE_IPK | WHERE_VIRTUALTABLE))) == U32(0) { var zFmt uintptr = uintptr(0) @@ -171409,41 +171917,41 @@ func Xsqlite3WhereExplainOneScan(tls *libc.TLS, pParse uintptr, pTabList uintptr if !(((*Table)(unsafe.Pointer(((*SrcItem)(unsafe.Pointer(pItem)).FpTab))).FtabFlags & U32(TF_WithoutRowid)) == U32(0)) && ((int32(*(*uint16)(unsafe.Pointer((pIdx) + 100 /* &.idxType */)) & 0x3 >> 0)) == SQLITE_IDXTYPE_PRIMARYKEY) { if isSearch != 0 { - zFmt = ts + 11047 /* "PRIMARY KEY" */ + zFmt = ts + 11062 /* "PRIMARY KEY" */ } } else if (flags & U32(WHERE_PARTIALIDX)) != 0 { - zFmt = ts + 21287 /* "AUTOMATIC PARTIA..." */ + zFmt = ts + 21302 /* "AUTOMATIC PARTIA..." */ } else if (flags & U32(WHERE_AUTO_INDEX)) != 0 { - zFmt = ts + 21320 /* "AUTOMATIC COVERI..." */ + zFmt = ts + 21335 /* "AUTOMATIC COVERI..." */ } else if (flags & U32(WHERE_IDX_ONLY)) != 0 { - zFmt = ts + 21345 /* "COVERING INDEX %..." */ + zFmt = ts + 21360 /* "COVERING INDEX %..." */ } else { - zFmt = ts + 21363 /* "INDEX %s" */ + zFmt = ts + 21378 /* "INDEX %s" */ } if zFmt != 0 { - Xsqlite3_str_append(tls, bp+80 /* &str */, ts+21372 /* " USING " */, 7) - Xsqlite3_str_appendf(tls, bp+80 /* &str */, zFmt, libc.VaList(bp+24, (*Index)(unsafe.Pointer(pIdx)).FzName)) - explainIndexRange(tls, bp+80 /* &str */, pLoop) + Xsqlite3_str_append(tls, bp+48 /* &str */, ts+21387 /* " USING " */, 7) + Xsqlite3_str_appendf(tls, bp+48 /* &str */, zFmt, libc.VaList(bp+16, (*Index)(unsafe.Pointer(pIdx)).FzName)) + explainIndexRange(tls, bp+48 /* &str */, pLoop) } } else if ((flags & U32(WHERE_IPK)) != U32(0)) && ((flags & U32(WHERE_CONSTRAINT)) != U32(0)) { var zRangeOp uintptr if (flags & (U32(WHERE_COLUMN_EQ | WHERE_COLUMN_IN))) != 0 { - zRangeOp = ts + 21380 /* "=" */ + zRangeOp = ts + 21395 /* "=" */ } else if (flags & U32(WHERE_BOTH_LIMIT)) == U32(WHERE_BOTH_LIMIT) { - zRangeOp = ts + 21382 /* ">? AND rowid<" */ + zRangeOp = ts + 21397 /* ">? AND rowid<" */ } else if (flags & U32(WHERE_BTM_LIMIT)) != 0 { - zRangeOp = ts + 21265 /* ">" */ + zRangeOp = ts + 21280 /* ">" */ } else { - zRangeOp = ts + 21267 /* "<" */ + zRangeOp = ts + 21282 /* "<" */ } - Xsqlite3_str_appendf(tls, bp+80, /* &str */ - ts+21396 /* " USING INTEGER P..." */, libc.VaList(bp+40, zRangeOp)) + Xsqlite3_str_appendf(tls, bp+48, /* &str */ + ts+21411 /* " USING INTEGER P..." */, libc.VaList(bp+24, zRangeOp)) } else if (flags & U32(WHERE_VIRTUALTABLE)) != U32(0) { - Xsqlite3_str_appendf(tls, bp+80 /* &str */, ts+21434, /* " VIRTUAL TABLE I..." */ - libc.VaList(bp+56, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) + Xsqlite3_str_appendf(tls, bp+48 /* &str */, ts+21449, /* " VIRTUAL TABLE I..." */ + libc.VaList(bp+32, *(*int32)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ /* &.idxNum */)), *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.vtab */ + 8 /* &.idxStr */)))) } - zMsg = Xsqlite3StrAccumFinish(tls, bp+80 /* &str */) + zMsg = Xsqlite3StrAccumFinish(tls, bp+48 /* &str */) ret = Xsqlite3VdbeAddOp4(tls, v, OP_Explain, Xsqlite3VdbeCurrentAddr(tls, v), (*Parse)(unsafe.Pointer(pParse)).FaddrExplain, 0, zMsg, -7) @@ -172203,8 +172711,8 @@ __3: // Generate code for the start of the iLevel-th loop in the WHERE clause // implementation described by pWInfo. func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWInfo uintptr, iLevel int32, pLevel uintptr, notReady Bitmask) Bitmask { /* sqlite3.c:146382:24: */ - bp := tls.Alloc(104) - defer tls.Free(104) + bp := tls.Alloc(96) + defer tls.Free(96) var j int32 var k int32 // Loop counters @@ -172414,13 +172922,13 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI if pStart != 0 { var pX uintptr // The expression that defines the start bound var r1 int32 - // var rTemp int32 at bp+20, 4 + // var rTemp int32 at bp+12, 4 // Registers for holding the start boundary var op int32 // Cursor seek operation // The following constant maps TK_xx codes into corresponding // seek opcodes. It depends on a particular ordering of TK_xx - *(*[4]U8)(unsafe.Pointer(bp + 16 /* aMoveOp */)) = [4]U8{ + *(*[4]U8)(unsafe.Pointer(bp + 8 /* aMoveOp */)) = [4]U8{ /* TK_GT */ U8(OP_SeekGT), /* TK_LE */ U8(OP_SeekLE), /* TK_LT */ U8(OP_SeekLT), @@ -172434,19 +172942,19 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // transitive constraints if Xsqlite3ExprIsVector(tls, (*Expr)(unsafe.Pointer(pX)).FpRight) != 0 { - r1 = libc.AssignPtrInt32(bp+20 /* rTemp */, Xsqlite3GetTempReg(tls, pParse)) + r1 = libc.AssignPtrInt32(bp+12 /* rTemp */, Xsqlite3GetTempReg(tls, pParse)) codeExprOrVector(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, r1, 1) - op = int32(*(*U8)(unsafe.Pointer(bp + 16 /* &aMoveOp[0] */ + uintptr(((((int32((*Expr)(unsafe.Pointer(pX)).Fop) - TK_GT) - 1) & 0x3) | 0x1))))) + op = int32(*(*U8)(unsafe.Pointer(bp + 8 /* &aMoveOp[0] */ + uintptr(((((int32((*Expr)(unsafe.Pointer(pX)).Fop) - TK_GT) - 1) & 0x3) | 0x1))))) } else { - r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, bp+20 /* &rTemp */) + r1 = Xsqlite3ExprCodeTemp(tls, pParse, (*Expr)(unsafe.Pointer(pX)).FpRight, bp+12 /* &rTemp */) disableTerm(tls, pLevel, pStart) - op = int32(*(*U8)(unsafe.Pointer(bp + 16 /* &aMoveOp[0] */ + uintptr((int32((*Expr)(unsafe.Pointer(pX)).Fop) - TK_GT))))) + op = int32(*(*U8)(unsafe.Pointer(bp + 8 /* &aMoveOp[0] */ + uintptr((int32((*Expr)(unsafe.Pointer(pX)).Fop) - TK_GT))))) } Xsqlite3VdbeAddOp3(tls, v, op, iCur, addrBrk, r1) - Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 20 /* rTemp */))) + Xsqlite3ReleaseTempReg(tls, pParse, *(*int32)(unsafe.Pointer(bp + 12 /* rTemp */))) } else { Xsqlite3VdbeAddOp2(tls, v, func() int32 { if bRev != 0 { @@ -172513,7 +173021,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI var iIdxCur int32 // The VDBE cursor for the index var nExtraReg int32 = 0 // Number of extra registers needed var op int32 // Instruction opcode - // var zStartAff uintptr at bp+24, 8 + // var zStartAff uintptr at bp+16, 8 // Affinity for start of range constraint var zEndAff uintptr = uintptr(0) // Affinity for end of range constraint var bSeekPastNull U8 = U8(0) // True to seek past initial nulls @@ -172607,10 +173115,10 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // and store the values of those terms in an array of registers // starting at regBase. - regBase = codeAllEqualityTerms(tls, pParse, pLevel, bRev, nExtraReg, bp+24 /* &zStartAff */) + regBase = codeAllEqualityTerms(tls, pParse, pLevel, bRev, nExtraReg, bp+16 /* &zStartAff */) - if (*(*uintptr)(unsafe.Pointer(bp + 24 /* zStartAff */)) != 0) && (nTop != 0) { - zEndAff = Xsqlite3DbStrDup(tls, db, (*(*uintptr)(unsafe.Pointer(bp + 24 /* zStartAff */)) + uintptr(nEq))) + if (*(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) != 0) && (nTop != 0) { + zEndAff = Xsqlite3DbStrDup(tls, db, (*(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) + uintptr(nEq))) } addrNxt = func() int32 { if regBignull != 0 { @@ -172634,8 +173142,8 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI Xsqlite3VdbeAddOp2(tls, v, OP_IsNull, (regBase + int32(nEq)), addrNxt) } - if *(*uintptr)(unsafe.Pointer(bp + 24 /* zStartAff */)) != 0 { - updateRangeAffinityStr(tls, pRight, int32(nBtm), (*(*uintptr)(unsafe.Pointer(bp + 24 /* zStartAff */)) + uintptr(nEq))) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) != 0 { + updateRangeAffinityStr(tls, pRight, int32(nBtm), (*(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */)) + uintptr(nEq))) } nConstraint = nConstraint + (int32(nBtm)) @@ -172655,7 +173163,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI start_constraints = 1 nConstraint++ } - codeApplyAffinity(tls, pParse, regBase, (nConstraint - int32(bSeekPastNull)), *(*uintptr)(unsafe.Pointer(bp + 24 /* zStartAff */))) + codeApplyAffinity(tls, pParse, regBase, (nConstraint - int32(bSeekPastNull)), *(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */))) if (int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip) > 0) && (nConstraint == int32((*WhereLoop)(unsafe.Pointer(pLoop)).FnSkip)) { // The skip-scan logic inside the call to codeAllEqualityConstraints() // above has already left the cursor sitting on the correct row, @@ -172726,7 +173234,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI } nConstraint++ } - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zStartAff */))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 16 /* zStartAff */))) Xsqlite3DbFree(tls, db, zEndAff) // Top of the loop body @@ -172996,7 +173504,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI // Run a separate WHERE clause for each term of the OR clause. After // eliminating duplicates from other WHERE clauses, the action for each // sub-WHERE clause is to to invoke the main loop body as a subroutine. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+21461 /* "MULTI-INDEX OR" */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+21476 /* "MULTI-INDEX OR" */, 0) for ii = 0; ii < (*WhereClause)(unsafe.Pointer(pOrWc)).FnTerm; ii++ { var pOrTerm uintptr = ((*WhereClause)(unsafe.Pointer(pOrWc)).Fa + uintptr(ii)*56) if ((*WhereTerm)(unsafe.Pointer(pOrTerm)).FleftCursor == iCur) || ((int32((*WhereTerm)(unsafe.Pointer(pOrTerm)).FeOperator) & WO_AND) != 0) { @@ -173015,7 +173523,7 @@ func Xsqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI pOrExpr = pAndExpr } // Loop through table entries that match term pOrTerm. - Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+21476 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) + Xsqlite3VdbeExplain(tls, pParse, uint8(1), ts+21491 /* "INDEX %d" */, libc.VaList(bp, (ii+1))) pSubWInfo = Xsqlite3WhereBegin(tls, pParse, pOrTab, pOrExpr, uintptr(0), uintptr(0), uint16(WHERE_OR_SUBCLAUSE), iCovCur) @@ -173266,7 +173774,7 @@ __4: } { var pE uintptr - // var sEAlt Expr at bp+32, 72 + // var sEAlt Expr at bp+24, 72 var pAlt uintptr if (int32((*WhereTerm)(unsafe.Pointer(pTerm)).FwtFlags) & (TERM_VIRTUAL | TERM_CODED)) != 0 { @@ -173300,9 +173808,9 @@ __4: goto __5 } - *(*Expr)(unsafe.Pointer(bp + 32 /* sEAlt */)) = *(*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pAlt)).FpExpr)) - (*Expr)(unsafe.Pointer(bp + 32 /* &sEAlt */)).FpLeft = (*Expr)(unsafe.Pointer(pE)).FpLeft - Xsqlite3ExprIfFalse(tls, pParse, bp+32 /* &sEAlt */, addrCont, SQLITE_JUMPIFNULL) + *(*Expr)(unsafe.Pointer(bp + 24 /* sEAlt */)) = *(*Expr)(unsafe.Pointer((*WhereTerm)(unsafe.Pointer(pAlt)).FpExpr)) + (*Expr)(unsafe.Pointer(bp + 24 /* &sEAlt */)).FpLeft = (*Expr)(unsafe.Pointer(pE)).FpLeft + Xsqlite3ExprIfFalse(tls, pParse, bp+24 /* &sEAlt */, addrCont, SQLITE_JUMPIFNULL) *(*U16)(unsafe.Pointer(pAlt + 18 /* &.wtFlags */)) |= U16((TERM_CODED)) } @@ -173764,10 +174272,10 @@ type Op2 = struct { } /* sqlite3.c:147955:18 */ var aOp = [4]Op2{ - {FzOp: ts + 15981 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, - {FzOp: ts + 15453 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, - {FzOp: ts + 15003 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, - {FzOp: ts + 21485 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, + {FzOp: ts + 15996 /* "match" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_MATCH)}, + {FzOp: ts + 15468 /* "glob" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_GLOB)}, + {FzOp: ts + 15018 /* "like" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_LIKE)}, + {FzOp: ts + 21500 /* "regexp" */, FeOp2: uint8(SQLITE_INDEX_CONSTRAINT_REGEXP)}, } /* sqlite3.c:147958:7 */ // If the pBase expression originated in the ON or USING clause of @@ -174468,7 +174976,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s extraRight = (x - uint64(1)) // ON clause terms may not be used with an index // on left table of a LEFT JOIN. Ticket #3015 if (prereqAll >> 1) >= x { - Xsqlite3ErrorMsg(tls, pParse, ts+21492 /* "ON clause refere..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21507 /* "ON clause refere..." */, 0) return } } @@ -174544,7 +175052,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s (*WhereTerm)(unsafe.Pointer(pNew)).FeOperator = (U16((int32(operatorMask(tls, int32((*Expr)(unsafe.Pointer(pDup)).Fop))) + int32(eExtraOp)) & int32(opMask))) } else if (op == TK_ISNULL) && (0 == Xsqlite3ExprCanBeNull(tls, pLeft)) { (*Expr)(unsafe.Pointer(pExpr)).Fop = U8(TK_TRUEFALSE) - *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 7122 /* "false" */ + *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)) = ts + 7137 /* "false" */ *(*U32)(unsafe.Pointer(pExpr + 4 /* &.flags */)) |= (U32(EP_IsFalse)) (*WhereTerm)(unsafe.Pointer(pTerm)).FprereqAll = uint64(0) (*WhereTerm)(unsafe.Pointer(pTerm)).FeOperator = U16(0) @@ -174645,7 +175153,7 @@ func exprAnalyze(tls *libc.TLS, pSrc uintptr, pWC uintptr, idxTerm int32) { /* s } zCollSeqName = func() uintptr { if *(*int32)(unsafe.Pointer(bp + 20 /* noCase */)) != 0 { - return ts + 21533 /* "NOCASE" */ + return ts + 21548 /* "NOCASE" */ } return uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)) }() @@ -174923,8 +175431,8 @@ func Xsqlite3WhereExprAnalyze(tls *libc.TLS, pTabList uintptr, pWC uintptr) { /* // Each function argument translates into an equality constraint against // a HIDDEN column in the table. func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC uintptr) { /* sqlite3.c:149188:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pTab uintptr var j int32 @@ -174947,7 +175455,7 @@ func Xsqlite3WhereTabFuncArgs(tls *libc.TLS, pParse uintptr, pItem uintptr, pWC k++ } if k >= int32((*Table)(unsafe.Pointer(pTab)).FnCol) { - Xsqlite3ErrorMsg(tls, pParse, ts+21540, /* "too many argumen..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+21555, /* "too many argumen..." */ libc.VaList(bp, (*Table)(unsafe.Pointer(pTab)).FzName, j)) return } @@ -175687,8 +176195,8 @@ func termCanDriveIndex(tls *libc.TLS, pTerm uintptr, pSrc uintptr, notReady Bitm // and to set up the WhereLevel object pLevel so that the code generator // makes use of the automatic index. func constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, pSrc uintptr, notReady Bitmask, pLevel uintptr) { /* sqlite3.c:149971:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var nKeyCol int32 // Number of columns in the constructed index var pTerm uintptr // A single term of the WHERE clause @@ -175704,7 +176212,7 @@ func constructAutomaticIndex(tls *libc.TLS, pParse uintptr, pWC uintptr, pSrc ui var mxBitCol int32 // Maximum column in pSrc->colUsed var pColl uintptr // Collating sequence to on a column var pLoop uintptr // The Loop object - // var zNotUsed uintptr at bp+24, 8 + // var zNotUsed uintptr at bp+16, 8 // Extra space on the end of pIdx var idxCols Bitmask // Bitmap of columns used for indexing var extraCols Bitmask // Bitmap of additional columns @@ -175770,7 +176278,7 @@ __4: goto __6 } Xsqlite3_log(tls, (SQLITE_WARNING | (int32(1) << 8)), - ts+21576 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, + ts+21591 /* "automatic index ..." */, libc.VaList(bp, (*Table)(unsafe.Pointer(pTable)).FzName, (*Column)(unsafe.Pointer((*Table)(unsafe.Pointer(pTable)).FaCol+uintptr(iCol)*32)).FzName)) sentWarning = U8(1) __6: @@ -175843,7 +176351,7 @@ __13: ; // Construct the Index object to describe this index - pIdx = Xsqlite3AllocateIndexObject(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (int16(nKeyCol + 1)), 0, bp+24 /* &zNotUsed */) + pIdx = Xsqlite3AllocateIndexObject(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (int16(nKeyCol + 1)), 0, bp+16 /* &zNotUsed */) if !(pIdx == uintptr(0)) { goto __14 } @@ -175851,7 +176359,7 @@ __13: __14: ; *(*uintptr)(unsafe.Pointer(pLoop + 24 /* &.u */ /* &.btree */ + 8 /* &.pIndex */)) = pIdx - (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 21602 /* "auto-index" */ + (*Index)(unsafe.Pointer(pIdx)).FzName = ts + 21617 /* "auto-index" */ (*Index)(unsafe.Pointer(pIdx)).FpTable = pTable n = 0 idxCols = uint64(0) @@ -176084,7 +176592,7 @@ __3: ((uint64(unsafe.Sizeof(sqlite3_index_constraint{})) + uint64(unsafe.Sizeof(sqlite3_index_constraint_usage{}))) * uint64(nTerm))) + (uint64(unsafe.Sizeof(sqlite3_index_orderby{})) * uint64(nOrderBy))) + uint64(unsafe.Sizeof(HiddenIndexInfo1{})))) if pIdxInfo == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+6528 /* "out of memory" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+6543 /* "out of memory" */, 0) return uintptr(0) } pHidden = (pIdxInfo + 1*96) @@ -176199,8 +176707,8 @@ __6: // caller to eventually free p->idxStr if p->needToFreeIdxStr indicates // that this is required. func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 { /* sqlite3.c:150333:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) var pVtab uintptr = (*VTable)(unsafe.Pointer(Xsqlite3GetVTable(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pTab))).FpVtab var rc int32 @@ -176211,9 +176719,9 @@ func vtabBestIndex(tls *libc.TLS, pParse uintptr, pTab uintptr, p uintptr) int32 if rc == SQLITE_NOMEM { Xsqlite3OomFault(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb) } else if !(int32((*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) + Xsqlite3ErrorMsg(tls, pParse, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3ErrStr(tls, rc))) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+3615 /* "%s" */, libc.VaList(bp+16, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) + Xsqlite3ErrorMsg(tls, pParse, ts+3630 /* "%s" */, libc.VaList(bp+8, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg)) } } Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg) @@ -178174,8 +178682,8 @@ __3: // Output parameter *pbIn is set to true if the plan added to pBuilder // uses one or more WO_IN terms, or false otherwise. func whereLoopAddVirtualOne(tls *libc.TLS, pBuilder uintptr, mPrereq Bitmask, mUsable Bitmask, mExclude U16, pIdxInfo uintptr, mNoOmit U16, pbIn uintptr) int32 { /* sqlite3.c:152472:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) var pWC uintptr = (*WhereLoopBuilder)(unsafe.Pointer(pBuilder)).FpWC var pIdxCons uintptr @@ -178263,7 +178771,7 @@ __4: (j >= (*WhereClause)(unsafe.Pointer(pWC)).FnTerm)) || (*(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(iTerm)*8)) != uintptr(0))) || (int32((*sqlite3_index_constraint)(unsafe.Pointer(pIdxCons)).Fusable) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21613 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+21628 /* "%s.xBestIndex ma..." */, libc.VaList(bp, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -178311,7 +178819,7 @@ __6: if *(*uintptr)(unsafe.Pointer((*WhereLoop)(unsafe.Pointer(pNew)).FaLTerm + uintptr(i)*8)) == uintptr(0) { // The non-zero argvIdx values must be contiguous. Raise an // error if they are not - Xsqlite3ErrorMsg(tls, pParse, ts+21613 /* "%s.xBestIndex ma..." */, libc.VaList(bp+16, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) + Xsqlite3ErrorMsg(tls, pParse, ts+21628 /* "%s.xBestIndex ma..." */, libc.VaList(bp+8, (*Table)(unsafe.Pointer((*SrcItem)(unsafe.Pointer(pSrc)).FpTab)).FzName)) return SQLITE_ERROR } @@ -178700,7 +179208,7 @@ __1: if (rc != 0) || ((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { if rc == SQLITE_DONE { // We hit the query planner search limit set by iPlanLimit - Xsqlite3_log(tls, SQLITE_WARNING, ts+21639 /* "abbreviated quer..." */, 0) + Xsqlite3_log(tls, SQLITE_WARNING, ts+21654 /* "abbreviated quer..." */, 0) rc = SQLITE_OK } else { goto __3 @@ -179469,7 +179977,7 @@ __3: } if nFrom == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+21674 /* "no query solutio..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+21689 /* "no query solutio..." */, 0) Xsqlite3DbFreeNN(tls, db, pSpace) return SQLITE_ERROR } @@ -179771,15 +180279,15 @@ func exprIsDeterministic(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:153907:1 // be used to compute the appropriate cursor depending on which index is // used. func Xsqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere uintptr, pOrderBy uintptr, pResultSet uintptr, wctrlFlags U16, iAuxArg int32) uintptr { /* sqlite3.c:154027:26: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(72) + defer tls.Free(72) var nByteWInfo int32 // Num. bytes allocated for WhereInfo struct var nTabList int32 // Number of elements in pTabList var pWInfo uintptr // Will become the return value of this function var v uintptr // The virtual database engine var notReady Bitmask // Cursors that are not yet positioned - // var sWLB WhereLoopBuilder at bp+16, 64 + // var sWLB WhereLoopBuilder at bp+8, 64 // The WhereLoop builder var pMaskSet uintptr // The expression mask set var pLevel uintptr // A single level in pWInfo->a[] @@ -179823,7 +180331,7 @@ func Xsqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere // Variable initialization db = (*Parse)(unsafe.Pointer(pParse)).Fdb - libc.Xmemset(tls, bp+16 /* &sWLB */, 0, uint64(unsafe.Sizeof(WhereLoopBuilder{}))) + libc.Xmemset(tls, bp+8 /* &sWLB */, 0, uint64(unsafe.Sizeof(WhereLoopBuilder{}))) // An ORDER/GROUP BY clause of more than 63 terms cannot be optimized @@ -179833,7 +180341,7 @@ func Xsqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere pOrderBy = uintptr(0) __1: ; - (*WhereLoopBuilder)(unsafe.Pointer(bp + 16 /* &sWLB */)).FpOrderBy = pOrderBy + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpOrderBy = pOrderBy // Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via // sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) @@ -179850,7 +180358,7 @@ __2: if !((*SrcList)(unsafe.Pointer(pTabList)).FnSrc > (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8)))) { goto __3 } - Xsqlite3ErrorMsg(tls, pParse, ts+21692 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) + Xsqlite3ErrorMsg(tls, pParse, ts+21707 /* "at most %d table..." */, libc.VaList(bp, (int32(uint64(unsafe.Sizeof(Bitmask(0)))*uint64(8))))) return uintptr(0) __3: ; @@ -179897,11 +180405,11 @@ __4: libc.Xmemset(tls, (pWInfo + 856 /* &.a */), 0, (uint64(unsafe.Sizeof(WhereLoop{})) + (uint64(nTabList) * uint64(unsafe.Sizeof(WhereLevel{}))))) // ONEPASS defaults to OFF pMaskSet = (pWInfo + 592 /* &.sMaskSet */) - (*WhereLoopBuilder)(unsafe.Pointer(bp + 16 /* &sWLB */)).FpWInfo = pWInfo - (*WhereLoopBuilder)(unsafe.Pointer(bp + 16 /* &sWLB */)).FpWC = (pWInfo + 104 /* &.sWC */) - (*WhereLoopBuilder)(unsafe.Pointer(bp + 16 /* &sWLB */)).FpNew = ((pWInfo) + uintptr(nByteWInfo)) + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWInfo = pWInfo + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWC = (pWInfo + 104 /* &.sWC */) + (*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpNew = ((pWInfo) + uintptr(nByteWInfo)) - whereLoopInit(tls, (*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpNew) + whereLoopInit(tls, (*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpNew) // Split the WHERE clause into separate subexpressions where each // subexpression is separated by an AND operator. @@ -179925,7 +180433,7 @@ __7: (*WhereInfo)(unsafe.Pointer(pWInfo)).FeDistinct = U8(WHERE_DISTINCT_UNIQUE) __8: ; - Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+21720 /* "SCAN CONSTANT RO..." */, 0) + Xsqlite3VdbeExplain(tls, pParse, uint8(0), ts+21735 /* "SCAN CONSTANT RO..." */, 0) goto __6 __5: // Assign a bit from the bitmask to every term in the FROM clause. @@ -179977,10 +180485,10 @@ __12: // FROM ... WHERE (SELECT random())>0; -- eval random() once overall ii = 0 __13: - if !(ii < (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpWC)).FnTerm) { + if !(ii < (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).FnTerm) { goto __15 } - pT = ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpWC)).Fa + uintptr(ii)*56) + pT = ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).Fa + uintptr(ii)*56) if !((int32((*WhereTerm)(unsafe.Pointer(pT)).FwtFlags) & TERM_VIRTUAL) != 0) { goto __16 } @@ -180027,10 +180535,10 @@ __18: // Construct the WhereLoop objects - if !((nTabList != 1) || (whereShortCut(tls, bp+16 /* &sWLB */) == 0)) { + if !((nTabList != 1) || (whereShortCut(tls, bp+8 /* &sWLB */) == 0)) { goto __22 } - rc = whereLoopAddAll(tls, bp+16 /* &sWLB */) + rc = whereLoopAddAll(tls, bp+8 /* &sWLB */) if !(rc != 0) { goto __23 } @@ -180043,7 +180551,7 @@ __23: // changed based on STAT4 information while computing subsequent loops, // then we need to rerun the whole loop building process so that all // loops will be built using the revised truthProb values. - if !((int32((*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FbldFlags2) & SQLITE_BLDF2_2NDPASS) != 0) { + if !((int32((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FbldFlags2) & SQLITE_BLDF2_2NDPASS) != 0) { goto __24 } @@ -180057,7 +180565,7 @@ __25: goto __25 __26: ; - rc = whereLoopAddAll(tls, bp+16 /* &sWLB */) + rc = whereLoopAddAll(tls, bp+8 /* &sWLB */) if !(rc != 0) { goto __27 } @@ -180137,10 +180645,10 @@ __32: goto __33 } tabUsed = Xsqlite3WhereExprListUsage(tls, pMaskSet, pResultSet) - if !((*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpOrderBy != 0) { + if !((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpOrderBy != 0) { goto __34 } - tabUsed = tabUsed | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpOrderBy)) + tabUsed = tabUsed | (Xsqlite3WhereExprListUsage(tls, pMaskSet, (*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpOrderBy)) __34: ; i = (int32((*WhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - 1) @@ -180169,8 +180677,8 @@ __39: goto __36 __40: ; - pEnd = ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+16 /* &sWLB */)).FpWC)).FnTerm)*56) - pTerm = (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp + 16 /* &sWLB */)).FpWC)).Fa + pEnd = ((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).Fa + uintptr((*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp+8 /* &sWLB */)).FpWC)).FnTerm)*56) + pTerm = (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWC)).Fa __41: if !(pTerm < pEnd) { goto __43 @@ -180202,7 +180710,7 @@ __46: ; notReady = notReady & (^(*WhereLoop)(unsafe.Pointer(pLoop)).FmaskSelf) - pTerm = (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp + 16 /* &sWLB */)).FpWC)).Fa + pTerm = (*WhereClause)(unsafe.Pointer((*WhereLoopBuilder)(unsafe.Pointer(bp + 8 /* &sWLB */)).FpWC)).Fa __47: if !(pTerm < pEnd) { goto __49 @@ -181060,7 +181568,7 @@ __1: error_out: Xsqlite3_result_error(tls, - pCtx, ts+21738 /* "second argument ..." */, -1) + pCtx, ts+21753 /* "second argument ..." */, -1) } func nth_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155162:13: */ @@ -181209,7 +181717,7 @@ func ntileStepFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* (*NtileCtx)(unsafe.Pointer(p)).FnParam = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))) if (*NtileCtx)(unsafe.Pointer(p)).FnParam <= int64(0) { Xsqlite3_result_error(tls, - pCtx, ts+21794 /* "argument of ntil..." */, -1) + pCtx, ts+21809 /* "argument of ntil..." */, -1) } } (*NtileCtx)(unsafe.Pointer(p)).FnTotal++ @@ -181306,17 +181814,17 @@ func last_valueFinalizeFunc(tls *libc.TLS, pCtx uintptr) { /* sqlite3.c:155441:1 // comparison of the zName pointer. Example: // // if( pFuncDef->zName==row_valueName ){ ... } -var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 21839 /* "row_number" */)) /* sqlite3.c:155459:19 */ -var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 21850 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ -var rankName = *(*[5]int8)(unsafe.Pointer(ts + 21861 /* "rank" */)) /* sqlite3.c:155461:19 */ -var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 21866 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ -var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 21879 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ -var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 21889 /* "ntile" */)) /* sqlite3.c:155464:19 */ -var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 21895 /* "last_value" */)) /* sqlite3.c:155465:19 */ -var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 21906 /* "nth_value" */)) /* sqlite3.c:155466:19 */ -var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 21916 /* "first_value" */)) /* sqlite3.c:155467:19 */ -var leadName = *(*[5]int8)(unsafe.Pointer(ts + 21928 /* "lead" */)) /* sqlite3.c:155468:19 */ -var lagName = *(*[4]int8)(unsafe.Pointer(ts + 21933 /* "lag" */)) /* sqlite3.c:155469:19 */ +var row_numberName = *(*[11]int8)(unsafe.Pointer(ts + 21854 /* "row_number" */)) /* sqlite3.c:155459:19 */ +var dense_rankName = *(*[11]int8)(unsafe.Pointer(ts + 21865 /* "dense_rank" */)) /* sqlite3.c:155460:19 */ +var rankName = *(*[5]int8)(unsafe.Pointer(ts + 21876 /* "rank" */)) /* sqlite3.c:155461:19 */ +var percent_rankName = *(*[13]int8)(unsafe.Pointer(ts + 21881 /* "percent_rank" */)) /* sqlite3.c:155462:19 */ +var cume_distName = *(*[10]int8)(unsafe.Pointer(ts + 21894 /* "cume_dist" */)) /* sqlite3.c:155463:19 */ +var ntileName = *(*[6]int8)(unsafe.Pointer(ts + 21904 /* "ntile" */)) /* sqlite3.c:155464:19 */ +var last_valueName = *(*[11]int8)(unsafe.Pointer(ts + 21910 /* "last_value" */)) /* sqlite3.c:155465:19 */ +var nth_valueName = *(*[10]int8)(unsafe.Pointer(ts + 21921 /* "nth_value" */)) /* sqlite3.c:155466:19 */ +var first_valueName = *(*[12]int8)(unsafe.Pointer(ts + 21931 /* "first_value" */)) /* sqlite3.c:155467:19 */ +var leadName = *(*[5]int8)(unsafe.Pointer(ts + 21943 /* "lead" */)) /* sqlite3.c:155468:19 */ +var lagName = *(*[4]int8)(unsafe.Pointer(ts + 21948 /* "lag" */)) /* sqlite3.c:155469:19 */ // No-op implementations of xStep() and xFinalize(). Used as place-holders // for built-in window functions that never call those interfaces. @@ -181370,8 +181878,8 @@ var aWindowFuncs = [15]FuncDef{ {FnArg: int8(3), FfuncFlags: (U32((SQLITE_UTF8 | SQLITE_FUNC_WINDOW) | 0)), FxSFunc: 0, FxFinalize: 0, FxValue: 0, FxInverse: 0, FzName: 0}} /* sqlite3.c:155522:18 */ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uintptr { /* sqlite3.c:155542:15: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var p uintptr for p = pList; p != 0; p = (*Window)(unsafe.Pointer(p)).FpNextWin { @@ -181380,7 +181888,7 @@ func windowFind(tls *libc.TLS, pParse uintptr, pList uintptr, zName uintptr) uin } } if p == uintptr(0) { - Xsqlite3ErrorMsg(tls, pParse, ts+21937 /* "no such window: ..." */, libc.VaList(bp, zName)) + Xsqlite3ErrorMsg(tls, pParse, ts+21952 /* "no such window: ..." */, libc.VaList(bp, zName)) } return p } @@ -181424,12 +181932,12 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (((*Window)(unsafe.Pointer(pWin)).FpStart != 0) || ((*Window)(unsafe.Pointer(pWin)).FpEnd != 0))) && (((*Window)(unsafe.Pointer(pWin)).FpOrderBy == uintptr(0)) || ((*ExprList)(unsafe.Pointer((*Window)(unsafe.Pointer(pWin)).FpOrderBy)).FnExpr != 1)) { Xsqlite3ErrorMsg(tls, pParse, - ts+21956 /* "RANGE with offse..." */, 0) + ts+21971 /* "RANGE with offse..." */, 0) } else if ((*FuncDef)(unsafe.Pointer(pFunc)).FfuncFlags & U32(SQLITE_FUNC_WINDOW)) != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb if (*Window)(unsafe.Pointer(pWin)).FpFilter != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+22027 /* "FILTER clause ma..." */, 0) + ts+22042 /* "FILTER clause ma..." */, 0) } else { *(*[8]WindowUpdate)(unsafe.Pointer(bp /* aUp */)) = [8]WindowUpdate{ {FzFunc: uintptr(unsafe.Pointer(&row_numberName)), FeFrmType: TK_ROWS, FeStart: TK_UNBOUNDED, FeEnd: TK_CURRENT}, @@ -181452,7 +181960,7 @@ func Xsqlite3WindowUpdate(tls *libc.TLS, pParse uintptr, pList uintptr, pWin uin (*Window)(unsafe.Pointer(pWin)).FeEnd = U8((*WindowUpdate)(unsafe.Pointer(bp /* &aUp */ + uintptr(i)*24)).FeEnd) (*Window)(unsafe.Pointer(pWin)).FeExclude = U8(0) if int32((*Window)(unsafe.Pointer(pWin)).FeStart) == TK_FOLLOWING { - (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+8260 /* "1" */) + (*Window)(unsafe.Pointer(pWin)).FpStart = Xsqlite3Expr(tls, db, TK_INTEGER, ts+8275 /* "1" */) } break } @@ -181689,12 +182197,12 @@ func sqlite3WindowExtraAggFuncDepth(tls *libc.TLS, pWalker uintptr, pExpr uintpt } func disallowAggregatesInOrderByCb(tls *libc.TLS, pWalker uintptr, pExpr uintptr) int32 { /* sqlite3.c:155855:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) if (int32((*Expr)(unsafe.Pointer(pExpr)).Fop) == TK_AGG_FUNCTION) && ((*Expr)(unsafe.Pointer(pExpr)).FpAggInfo == uintptr(0)) { Xsqlite3ErrorMsg(tls, (*Walker)(unsafe.Pointer(pWalker)).FpParse, - ts+8321 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) + ts+8336 /* "misuse of aggreg..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pExpr + 8 /* &.u */)))) } return WRC_Continue } @@ -181824,7 +182332,7 @@ func Xsqlite3WindowRewrite(tls *libc.TLS, pParse uintptr, p uintptr) int32 { /* // keep everything legal in this case. if *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) == uintptr(0) { *(*uintptr)(unsafe.Pointer(bp + 48 /* pSublist */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), - Xsqlite3Expr(tls, db, TK_INTEGER, ts+7853 /* "0" */)) + Xsqlite3Expr(tls, db, TK_INTEGER, ts+7868 /* "0" */)) } pSub = Xsqlite3SelectNew(tls, @@ -181964,7 +182472,7 @@ __1: ((eStart == TK_FOLLOWING) && ((eEnd == TK_PRECEDING) || (eEnd == TK_CURRENT)))) { goto __2 } - Xsqlite3ErrorMsg(tls, pParse, ts+22090 /* "unsupported fram..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+22105 /* "unsupported fram..." */, 0) goto windowAllocErr __2: ; @@ -182020,8 +182528,8 @@ func Xsqlite3WindowAssemble(tls *libc.TLS, pParse uintptr, pWin uintptr, pPartit // either updates *pWin according to the base specification, or else // leaves an error in pParse. func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uintptr) { /* sqlite3.c:156179:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Window)(unsafe.Pointer(pWin)).FzBase != 0 { var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb @@ -182030,15 +182538,15 @@ func Xsqlite3WindowChain(tls *libc.TLS, pParse uintptr, pWin uintptr, pList uint var zErr uintptr = uintptr(0) // Check for errors if (*Window)(unsafe.Pointer(pWin)).FpPartition != 0 { - zErr = ts + 22122 /* "PARTITION clause" */ + zErr = ts + 22137 /* "PARTITION clause" */ } else if ((*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0) && ((*Window)(unsafe.Pointer(pWin)).FpOrderBy != 0) { - zErr = ts + 22139 /* "ORDER BY clause" */ + zErr = ts + 22154 /* "ORDER BY clause" */ } else if int32((*Window)(unsafe.Pointer(pExist)).FbImplicitFrame) == 0 { - zErr = ts + 22155 /* "frame specificat..." */ + zErr = ts + 22170 /* "frame specificat..." */ } if zErr != 0 { Xsqlite3ErrorMsg(tls, pParse, - ts+22175 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) + ts+22190 /* "cannot override ..." */, libc.VaList(bp, zErr, (*Window)(unsafe.Pointer(pWin)).FzBase)) } else { (*Window)(unsafe.Pointer(pWin)).FpPartition = Xsqlite3ExprListDup(tls, db, (*Window)(unsafe.Pointer(pExist)).FpPartition, 0) if (*Window)(unsafe.Pointer(pExist)).FpOrderBy != 0 { @@ -182061,7 +182569,7 @@ func Xsqlite3WindowAttach(tls *libc.TLS, pParse uintptr, p uintptr, pWin uintptr (*Window)(unsafe.Pointer(pWin)).FpOwner = p if (((*Expr)(unsafe.Pointer(p)).Fflags & U32(EP_Distinct)) != 0) && (int32((*Window)(unsafe.Pointer(pWin)).FeFrmType) != TK_FILTER) { Xsqlite3ErrorMsg(tls, pParse, - ts+22208 /* "DISTINCT is not ..." */, 0) + ts+22223 /* "DISTINCT is not ..." */, 0) } } else { Xsqlite3WindowDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, pWin) @@ -182212,7 +182720,7 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / Xsqlite3VdbeAddOp2(tls, v, OP_Integer, 0, regZero) if eCond >= WINDOW_STARTING_NUM { var regString int32 = Xsqlite3GetTempReg(tls, pParse) - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, (Xsqlite3VdbeCurrentAddr(tls, v) + 2), reg) Xsqlite3VdbeChangeP5(tls, v, (uint16(SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL))) @@ -182234,11 +182742,11 @@ func windowCheckValue(tls *libc.TLS, pParse uintptr, reg int32, eCond int32) { / } var azErr = [5]uintptr{ - ts + 22255, /* "frame starting o..." */ - ts + 22308, /* "frame ending off..." */ - ts + 21738, /* "second argument ..." */ - ts + 22359, /* "frame starting o..." */ - ts + 22411, /* "frame ending off..." */ + ts + 22270, /* "frame starting o..." */ + ts + 22323, /* "frame ending off..." */ + ts + 21753, /* "second argument ..." */ + ts + 22374, /* "frame starting o..." */ + ts + 22426, /* "frame ending off..." */ } /* sqlite3.c:156372:21 */ var aOp1 = [5]int32{OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge} /* sqlite3.c:156379:14 */ @@ -182840,7 +183348,7 @@ func windowCodeRangeTest(tls *libc.TLS, p uintptr, op int32, csr1 int32, regVal // the add/subtract is skipped for these, as required. If reg1 is a NULL, // then the arithmetic is performed, but since adding or subtracting from // NULL is always NULL anyway, this case is handled as required too. - Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+740 /* "" */, -1) + Xsqlite3VdbeAddOp4(tls, v, OP_String8, 0, regString, 0, ts+755 /* "" */, -1) addrGe = Xsqlite3VdbeAddOp3(tls, v, OP_Ge, regString, 0, reg1) if ((op == OP_Ge) && (arith == OP_Add)) || ((op == OP_Le) && (arith == OP_Subtract)) { @@ -183837,8 +184345,8 @@ func disableLookaside(tls *libc.TLS, pParse uintptr) { /* sqlite3.c:158076:13: * // all elements in the list. And make sure list length does not exceed // SQLITE_LIMIT_COMPOUND_SELECT. func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlite3.c:158109:15: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Select)(unsafe.Pointer(p)).FpPrior != 0 { var pNext uintptr = uintptr(0) @@ -183855,19 +184363,19 @@ func parserDoubleLinkSelect(tls *libc.TLS, pParse uintptr, p uintptr) { /* sqlit } cnt++ if ((*Select)(unsafe.Pointer(pLoop)).FpOrderBy != 0) || ((*Select)(unsafe.Pointer(pLoop)).FpLimit != 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+22461, /* "%s clause should..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+22476, /* "%s clause should..." */ libc.VaList(bp, func() uintptr { if (*Select)(unsafe.Pointer(pLoop)).FpOrderBy != uintptr(0) { - return ts + 19575 /* "ORDER BY" */ + return ts + 19590 /* "ORDER BY" */ } - return ts + 22503 /* "LIMIT" */ + return ts + 22518 /* "LIMIT" */ }(), Xsqlite3SelectOpName(tls, int32((*Select)(unsafe.Pointer(pNext)).Fop)))) break } } if ((((*Select)(unsafe.Pointer(p)).FselFlags & U32(SF_MultiValue)) == U32(0)) && ((libc.AssignInt32(&mxSelect, *(*int32)(unsafe.Pointer(((*Parse)(unsafe.Pointer(pParse)).Fdb + 128 /* &.aLimit */) + 4*4)))) > 0)) && (cnt > mxSelect) { - Xsqlite3ErrorMsg(tls, pParse, ts+22509 /* "too many terms i..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+22524 /* "too many terms i..." */, 0) } } @@ -183941,13 +184449,13 @@ func binaryToUnaryIfNull(tls *libc.TLS, pParse uintptr, pY uintptr, pA uintptr, // a COLLATE clause or an ASC or DESC keyword, except ignore the // error while parsing a legacy schema. func parserAddExprIdListTerm(tls *libc.TLS, pParse uintptr, pPrior uintptr, pIdToken uintptr, hasCollate int32, sortOrder int32) uintptr { /* sqlite3.c:158204:19: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var p uintptr = Xsqlite3ExprListAppend(tls, pParse, pPrior, uintptr(0)) if ((hasCollate != 0) || (sortOrder != -1)) && (int32((*Sqlite3)(unsafe.Pointer((*Parse)(unsafe.Pointer(pParse)).Fdb)).Finit.Fbusy) == 0) { - Xsqlite3ErrorMsg(tls, pParse, ts+22543, /* "syntax error aft..." */ + Xsqlite3ErrorMsg(tls, pParse, ts+22558, /* "syntax error aft..." */ libc.VaList(bp, (*Token)(unsafe.Pointer(pIdToken)).Fn, (*Token)(unsafe.Pointer(pIdToken)).Fz)) } Xsqlite3ExprListSetName(tls, pParse, p, pIdToken, 1) @@ -185174,7 +185682,7 @@ func yyStackOverflow(tls *libc.TLS, yypParser uintptr) { /* sqlite3.c:160618:13: // stack every overflows //******* Begin %stack_overflow code ***************************************** - Xsqlite3ErrorMsg(tls, pParse, ts+22581 /* "parser stack ove..." */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+22596 /* "parser stack ove..." */, 0) //******* End %stack_overflow code ******************************************* (*YyParser)(unsafe.Pointer(yypParser)).FpParse = pParse @@ -186018,8 +186526,8 @@ var yyRuleInfoNRhs = [398]int8{ // only called from one place, optimizing compilers will in-line it, which // means that the extra parameters have no performance impact. func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead int32, yyLookaheadToken Token, pParse uintptr) uint16 { /* sqlite3.c:161518:21: */ - bp := tls.Alloc(144) - defer tls.Free(144) + bp := tls.Alloc(128) + defer tls.Free(128) var yygoto int32 // The next state var yyact uint16 // The next action @@ -186039,7 +186547,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in // #line // break; //********* Begin reduce actions ********************************************* - // var yylhsminor YYMINORTYPE at bp+96, 16 + // var yylhsminor YYMINORTYPE at bp+80, 16 case uint32(0): /* explain ::= EXPLAIN */ { @@ -186153,11 +186661,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(22): /* table_options ::= WITHOUT nm */ { - if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+16110 /* "rowid" */, 5) == 0) { + if ((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn == uint32(5)) && (Xsqlite3_strnicmp(tls, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz, ts+16125 /* "rowid" */, 5) == 0) { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = (TF_WithoutRowid | TF_NoVisibleRowid) } else { *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = 0 - Xsqlite3ErrorMsg(tls, pParse, ts+22603 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) + Xsqlite3ErrorMsg(tls, pParse, ts+22618 /* "unknown table op..." */, libc.VaList(bp, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn, (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz)) } } break @@ -186451,8 +186959,8 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(82): /* cmd ::= select */ { - *(*SelectDest)(unsafe.Pointer(bp + 40 /* dest */)) = SelectDest{FeDest: U8(SRT_Output)} - Xsqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), bp+40 /* &dest */) + *(*SelectDest)(unsafe.Pointer(bp + 24 /* dest */)) = SelectDest{FeDest: U8(SRT_Output)} + Xsqlite3Select(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), bp+24 /* &dest */) Xsqlite3SelectDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } break @@ -186481,11 +186989,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in var pLhs uintptr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) if (pRhs != 0) && ((*Select)(unsafe.Pointer(pRhs)).FpPrior != 0) { var pFrom uintptr - // var x Token at bp+80, 16 + // var x Token at bp+64, 16 - (*Token)(unsafe.Pointer(bp + 80 /* &x */)).Fn = uint32(0) + (*Token)(unsafe.Pointer(bp + 64 /* &x */)).Fn = uint32(0) parserDoubleLinkSelect(tls, pParse, pRhs) - pFrom = Xsqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp+80 /* &x */, pRhs, uintptr(0), uintptr(0)) + pFrom = Xsqlite3SrcListAppendFromTerm(tls, pParse, uintptr(0), uintptr(0), uintptr(0), bp+64 /* &x */, pRhs, uintptr(0), uintptr(0)) pRhs = Xsqlite3SelectNew(tls, pParse, uintptr(0), pFrom, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uint32(0), uintptr(0)) } if pRhs != 0 { @@ -186691,21 +187199,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(113): /* fullname ::= nm */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), uintptr(0)) - if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) != 0) { - Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + 8 /* &.a */))).FzName, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), uintptr(0)) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) != 0) { + Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + 8 /* &.a */))).FzName, (yymsp + 8 /* &.minor */ /* &.yy0 */)) } } - *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(114): /* fullname ::= nm DOT nm */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) - if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) != 0) { - Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + 8 /* &.a */))).FzName, (yymsp + 8 /* &.minor */ /* &.yy0 */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3SrcListAppend(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), (yymsp + 8 /* &.minor */ /* &.yy0 */)) + if (int32((*Parse)(unsafe.Pointer(pParse)).FeParseMode) >= PARSE_MODE_RENAME) && (*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) != 0) { + Xsqlite3RenameTokenMap(tls, pParse, (*SrcItem)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) + 8 /* &.a */))).FzName, (yymsp + 8 /* &.minor */ /* &.yy0 */)) } } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(115): /* xfullname ::= nm */ { @@ -186892,7 +187400,7 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in case uint32(155): /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { Xsqlite3SrcListIndexedBy(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) - Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+22630 /* "set list" */) + Xsqlite3ExprListCheckLength(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), ts+22645 /* "set list" */) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = Xsqlite3SrcListAppendList(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) Xsqlite3Update(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */)), uintptr(0), uintptr(0), uintptr(0)) } @@ -186910,10 +187418,10 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(158): /* setlist ::= nm EQ expr */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) - Xsqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprListAppend(tls, pParse, uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + Xsqlite3ExprListSetName(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)), (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */), 1) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(159): /* setlist ::= LP idlist RP EQ expr */ { @@ -187001,9 +187509,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3RenameTokenMap(tls, pParse, temp2, (yymsp + 8 /* &.minor */ /* &.yy0 */)) Xsqlite3RenameTokenMap(tls, pParse, temp1, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */)) } - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3PExpr(tls, pParse, TK_DOT, temp1, temp2) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3PExpr(tls, pParse, TK_DOT, temp1, temp2) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(179): /* expr ::= nm DOT nm DOT nm */ { @@ -187015,9 +187523,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3RenameTokenMap(tls, pParse, temp3, (yymsp + 8 /* &.minor */ /* &.yy0 */)) Xsqlite3RenameTokenMap(tls, pParse, temp2, (yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */ /* &.yy0 */)) } - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3PExpr(tls, pParse, TK_DOT, temp1, temp4) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3PExpr(tls, pParse, TK_DOT, temp1, temp4) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(180): fallthrough // term ::= NULL|FLOAT|BLOB @@ -187028,9 +187536,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(182): /* term ::= INTEGER */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprAlloc(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, (yymsp + 8 /* &.minor */ /* &.yy0 */), 1) } - *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(183): /* expr ::= VARIABLE */ { @@ -187042,15 +187550,15 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in // When doing a nested parse, one can include terms in an expression // that look like this: #1 #2 ... These terms refer to registers // in the virtual machine. #N is the N-th register. - *(*Token)(unsafe.Pointer(bp + 112 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X + *(*Token)(unsafe.Pointer(bp + 96 /* t */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) //A-overwrites-X if int32((*Parse)(unsafe.Pointer(pParse)).Fnested) == 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+22639 /* "near \"%T\": synta..." */, libc.VaList(bp+24, bp+112 /* &t */)) + Xsqlite3ErrorMsg(tls, pParse, ts+22654 /* "near \"%T\": synta..." */, libc.VaList(bp+16, bp+96 /* &t */)) *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = uintptr(0) } else { *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = Xsqlite3PExpr(tls, pParse, TK_REGISTER, uintptr(0), uintptr(0)) if *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) != 0 { - Xsqlite3GetInt32(tls, ((*Token)(unsafe.Pointer(bp+112 /* &t */)).Fz + 1), (*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + 44 /* &.iTable */)) + Xsqlite3GetInt32(tls, ((*Token)(unsafe.Pointer(bp+96 /* &t */)).Fz + 1), (*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + 44 /* &.iTable */)) } } } @@ -187069,35 +187577,35 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(186): /* expr ::= ID|INDEXED LP distinct exprlist RP */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(187): /* expr ::= ID|INDEXED LP STAR RP */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), 0) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(188): /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */))) - Xsqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */), *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */))) + Xsqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(189): /* expr ::= ID|INDEXED LP STAR RP filter_over */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), 0) - Xsqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), 0) + Xsqlite3WindowAttach(tls, pParse, *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(190): /* term ::= CTIME_KW */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), 0) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3ExprFunction(tls, pParse, uintptr(0), (yymsp + 8 /* &.minor */ /* &.yy0 */), 0) } - *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(191): /* expr ::= LP nexprlist COMMA expr RP */ { @@ -187249,9 +187757,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in Xsqlite3ExprUnmapAndDelete(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */))) *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = Xsqlite3Expr(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, TK_INTEGER, func() uintptr { if *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)) != 0 { - return ts + 8260 /* "1" */ + return ts + 8275 /* "1" */ } - return ts + 7853 /* "0" */ + return ts + 7868 /* "0" */ }()) } else if ((*ExprList)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FnExpr == 1) && (Xsqlite3ExprIsConstant(tls, (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))+8 /* &.a */))).FpExpr) != 0) { var pRHS uintptr = (*ExprList_item)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + 8 /* &.a */))).FpExpr @@ -187447,11 +187955,11 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(253): /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { - // var all Token at bp+128, 16 + // var all Token at bp+112, 16 - (*Token)(unsafe.Pointer(bp + 128 /* &all */)).Fz = (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)).Fz - (*Token)(unsafe.Pointer(bp + 128 /* &all */)).Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).Fz)) / 1))) + (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn) - Xsqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), bp+128 /* &all */) + (*Token)(unsafe.Pointer(bp + 112 /* &all */)).Fz = (*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)).Fz + (*Token)(unsafe.Pointer(bp + 112 /* &all */)).Fn = (uint32((int32((int64((*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fz) - int64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).Fz)) / 1))) + (*Token)(unsafe.Pointer(yymsp+8 /* &.minor */)).Fn) + Xsqlite3FinishTrigger(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), bp+112 /* &all */) } break case uint32(254): /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ @@ -187526,46 +188034,46 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in *(*Token)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*Token)(unsafe.Pointer(yymsp + 8 /* &.minor */)) Xsqlite3ErrorMsg(tls, pParse, - ts+22663 /* "qualified table ..." */, 0) + ts+22678 /* "qualified table ..." */, 0) } break case uint32(266): /* tridxby ::= INDEXED BY nm */ { Xsqlite3ErrorMsg(tls, pParse, - ts+22758 /* "the INDEXED BY c..." */, 0) + ts+22773 /* "the INDEXED BY c..." */, 0) } break case uint32(267): /* tridxby ::= NOT INDEXED */ { Xsqlite3ErrorMsg(tls, pParse, - ts+22842 /* "the NOT INDEXED ..." */, 0) + ts+22857 /* "the NOT INDEXED ..." */, 0) } break case uint32(268): /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3TriggerUpdateStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uint8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */))), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-8)*24+8 /* &.minor */)).Fz, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerUpdateStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), uint8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */))), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-8)*24+8 /* &.minor */)).Fz, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-8)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(269): /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3TriggerInsertStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), uint8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */))), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) //yylhsminor.yy157-overwrites-yymsp[-6].minor.yy376 + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerInsertStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), uint8(*(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-6)*24 + 8 /* &.minor */))), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) //yylhsminor.yy157-overwrites-yymsp[-6].minor.yy376 } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-7)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(270): /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3TriggerDeleteStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-5)*24+8 /* &.minor */)).Fz, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerDeleteStep(tls, pParse, (yymsp + libc.UintptrFromInt32(-3)*24 + 8 /* &.minor */ /* &.yy0 */), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-5)*24+8 /* &.minor */)).Fz, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(271): /* trigger_cmd ::= scanpt select scanpt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3TriggerSelectStep(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) /*yylhsminor.yy157-overwrites-yymsp[-1].minor.yy81*/ + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3TriggerSelectStep(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) /*yylhsminor.yy157-overwrites-yymsp[-1].minor.yy81*/ } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(272): /* expr ::= RAISE LP IGNORE RP */ { @@ -187723,27 +188231,27 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(306): /* windowdefn_list ::= windowdefn */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) } - *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(307): /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { Xsqlite3WindowChain(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */))) (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)))).FpNextWin = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(308): /* windowdefn ::= nm AS LP window RP */ { if *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) != 0 { (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)))).FzName = Xsqlite3DbStrNDup(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, (*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */)).Fz, uint64((*Token)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-4)*24+8 /* &.minor */)).Fn)) } - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(309): /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ { @@ -187752,9 +188260,9 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(310): /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */ /* &.yy0 */)) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(311): /* window ::= ORDER BY sortlist frame_opt */ { @@ -187763,23 +188271,23 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(312): /* window ::= nm ORDER BY sortlist frame_opt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)), (yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */ /* &.yy0 */)) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-4)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(313): fallthrough // window ::= frame_opt case uint32(332): /* filter_over ::= over_clause */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) } - *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(314): /* window ::= nm frame_opt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), uintptr(0), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAssemble(tls, pParse, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)), uintptr(0), uintptr(0), (yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */ /* &.yy0 */)) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(315): /* frame_opt ::= */ { @@ -187788,23 +188296,23 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in break case uint32(316): /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FpExpr, TK_CURRENT, uintptr(0), *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)), (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FpExpr, TK_CURRENT, uintptr(0), *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-2)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(317): /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).FpExpr, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FpExpr, *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */))) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3WindowAlloc(tls, pParse, *(*int32)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)), (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-3)*24+8 /* &.minor */)).FpExpr, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FeType, (*FrameBound)(unsafe.Pointer(yymsp+libc.UintptrFromInt32(-1)*24+8 /* &.minor */)).FpExpr, *(*U8)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-5)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(319): fallthrough // frame_bound_s ::= frame_bound case uint32(321): /* frame_bound_e ::= frame_bound */ { - *(*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = *(*FrameBound)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*FrameBound)(unsafe.Pointer(yymsp + 8 /* &.minor */)) } - *(*FrameBound)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*FrameBound)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(320): fallthrough // frame_bound_s ::= UNBOUNDED PRECEDING @@ -187812,17 +188320,17 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in fallthrough case uint32(324): /* frame_bound ::= CURRENT ROW */ { - (*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)).FeType = int32((*YyStackEntry)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24)).Fmajor) - (*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)).FpExpr = uintptr(0) + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FeType = int32((*YyStackEntry)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24)).Fmajor) + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FpExpr = uintptr(0) } - *(*FrameBound)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*FrameBound)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(323): /* frame_bound ::= expr PRECEDING|FOLLOWING */ { - (*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)).FeType = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) - (*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FeType = int32((*YyStackEntry)(unsafe.Pointer(yymsp)).Fmajor) + (*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)).FpExpr = *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) } - *(*FrameBound)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*FrameBound)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*FrameBound)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(325): /* frame_exclude_opt ::= */ { @@ -187858,21 +188366,21 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in } else { Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */))) } - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) } - *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + libc.UintptrFromInt32(-1)*24 + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(333): /* filter_over ::= filter_clause */ { - *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Window{}))) - if *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) != 0 { - (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)))).FeFrmType = U8(TK_FILTER) - (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) = Xsqlite3DbMallocZero(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, uint64(unsafe.Sizeof(Window{}))) + if *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) != 0 { + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)))).FeFrmType = U8(TK_FILTER) + (*Window)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)))).FpFilter = *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) } else { Xsqlite3ExprDelete(tls, (*Parse)(unsafe.Pointer(pParse)).Fdb, *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */))) } } - *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 96 /* &yylhsminor */)) + *(*uintptr)(unsafe.Pointer(yymsp + 8 /* &.minor */)) = *(*uintptr)(unsafe.Pointer(bp + 80 /* &yylhsminor */)) break case uint32(334): /* over_clause ::= OVER LP window RP */ { @@ -187980,18 +188488,18 @@ func yy_reduce(tls *libc.TLS, yypParser uintptr, yyruleno uint32, yyLookahead in // The following code executes when a syntax error first occurs. func yy_syntax_error(tls *libc.TLS, yypParser uintptr, yymajor int32, yyminor Token) { /* sqlite3.c:163044:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) - *(*Token)(unsafe.Pointer(bp + 16)) = yyminor + bp := tls.Alloc(24) + defer tls.Free(24) + *(*Token)(unsafe.Pointer(bp + 8)) = yyminor var pParse uintptr = (*YyParser)(unsafe.Pointer(yypParser)).FpParse //*********** Begin %syntax_error code *************************************** _ = yymajor // Silence some compiler warnings - if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 16 /* &yyminor */)).Fz)) != 0 { - Xsqlite3ErrorMsg(tls, pParse, ts+22639 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+16 /* &yyminor */)) + if *(*int8)(unsafe.Pointer((*Token)(unsafe.Pointer(bp + 8 /* &yyminor */)).Fz)) != 0 { + Xsqlite3ErrorMsg(tls, pParse, ts+22654 /* "near \"%T\": synta..." */, libc.VaList(bp, bp+8 /* &yyminor */)) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+22927 /* "incomplete input" */, 0) + Xsqlite3ErrorMsg(tls, pParse, ts+22942 /* "incomplete input" */, 0) } //*********** End %syntax_error code ***************************************** @@ -189134,18 +189642,18 @@ func Xsqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) int32 { /* sq // memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that // error message. func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:164392:20: */ - bp := tls.Alloc(2492) - defer tls.Free(2492) + bp := tls.Alloc(2468) + defer tls.Free(2468) var nErr int32 = 0 // Number of errors encountered var pEngine uintptr // The LEMON-generated LALR(1) parser var n int32 = 0 // Length of the next token token - // var tokenType int32 at bp+2488, 4 + // var tokenType int32 at bp+2464, 4 // type of the next token var lastTokenParsed int32 = -1 // type of the previous token var db uintptr = (*Parse)(unsafe.Pointer(pParse)).Fdb // The database connection var mxSqlLen int32 // Max length of an SQL string - // var sEngine YyParser at bp+64, 2424 + // var sEngine YyParser at bp+40, 2424 // Space to hold the Lemon-generated Parser object mxSqlLen = *(*int32)(unsafe.Pointer((db + 128 /* &.aLimit */) + 1*4)) @@ -189155,25 +189663,25 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_OK (*Parse)(unsafe.Pointer(pParse)).FzTail = zSql - pEngine = bp + 64 /* &sEngine */ + pEngine = bp + 40 /* &sEngine */ Xsqlite3ParserInit(tls, pEngine, pParse) (*Parse)(unsafe.Pointer(pParse)).FpParentParse = (*Sqlite3)(unsafe.Pointer(db)).FpParse (*Sqlite3)(unsafe.Pointer(db)).FpParse = pParse for 1 != 0 { - n = Xsqlite3GetToken(tls, zSql, bp+2488 /* &tokenType */) + n = Xsqlite3GetToken(tls, zSql, bp+2464 /* &tokenType */) mxSqlLen = mxSqlLen - (n) if mxSqlLen < 0 { (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_TOOBIG break } - if *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) >= TK_WINDOW { + if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) >= TK_WINDOW { if libc.AtomicLoadNInt32((db+400 /* &.u1 */ /* &.isInterrupted */), 0) != 0 { (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_INTERRUPT break } - if *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) == TK_SPACE { + if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_SPACE { zSql += uintptr(n) continue } @@ -189181,31 +189689,31 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin // Upon reaching the end of input, call the parser two more times // with tokens TK_SEMI and 0, in that order. if lastTokenParsed == TK_SEMI { - *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) = 0 + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = 0 } else if lastTokenParsed == 0 { break } else { - *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) = TK_SEMI + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = TK_SEMI } n = 0 - } else if *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) == TK_WINDOW { + } else if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_WINDOW { - *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) = analyzeWindowKeyword(tls, (zSql + 6)) - } else if *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) == TK_OVER { + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeWindowKeyword(tls, (zSql + 6)) + } else if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_OVER { - *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) = analyzeOverKeyword(tls, (zSql + 4), lastTokenParsed) - } else if *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) == TK_FILTER { + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeOverKeyword(tls, (zSql + 4), lastTokenParsed) + } else if *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) == TK_FILTER { - *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) + *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) = analyzeFilterKeyword(tls, (zSql + 6), lastTokenParsed) } else { - Xsqlite3ErrorMsg(tls, pParse, ts+22944 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) + Xsqlite3ErrorMsg(tls, pParse, ts+22959 /* "unrecognized tok..." */, libc.VaList(bp, n, zSql)) break } } (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fz = zSql (*Parse)(unsafe.Pointer(pParse)).FsLastToken.Fn = uint32(n) - Xsqlite3Parser(tls, pEngine, *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)), (*Parse)(unsafe.Pointer(pParse)).FsLastToken) - lastTokenParsed = *(*int32)(unsafe.Pointer(bp + 2488 /* tokenType */)) + Xsqlite3Parser(tls, pEngine, *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)), (*Parse)(unsafe.Pointer(pParse)).FsLastToken) + lastTokenParsed = *(*int32)(unsafe.Pointer(bp + 2464 /* tokenType */)) zSql += uintptr(n) if (*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK { @@ -189218,13 +189726,13 @@ func Xsqlite3RunParser(tls *libc.TLS, pParse uintptr, zSql uintptr, pzErrMsg uin (*Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_NOMEM } if (((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_OK) && ((*Parse)(unsafe.Pointer(pParse)).Frc != SQLITE_DONE)) && ((*Parse)(unsafe.Pointer(pParse)).FzErrMsg == uintptr(0)) { - (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+3615 /* "%s" */, libc.VaList(bp+24, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) + (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = Xsqlite3MPrintf(tls, db, ts+3630 /* "%s" */, libc.VaList(bp+16, Xsqlite3ErrStr(tls, (*Parse)(unsafe.Pointer(pParse)).Frc))) } if (*Parse)(unsafe.Pointer(pParse)).FzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = (*Parse)(unsafe.Pointer(pParse)).FzErrMsg - Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+22971, /* "%s in \"%s\"" */ - libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) + Xsqlite3_log(tls, (*Parse)(unsafe.Pointer(pParse)).Frc, ts+22986, /* "%s in \"%s\"" */ + libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(pzErrMsg)), (*Parse)(unsafe.Pointer(pParse)).FzTail)) (*Parse)(unsafe.Pointer(pParse)).FzErrMsg = uintptr(0) nErr++ } @@ -189435,7 +189943,7 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'C': { - if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+22982 /* "create" */, 6) == 0) { + if (nId == 6) && (Xsqlite3_strnicmp(tls, zSql, ts+22997 /* "create" */, 6) == 0) { token = U8(TkCREATE) } else { token = U8(TkOTHER) @@ -189448,11 +189956,11 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'T': { - if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+19695 /* "trigger" */, 7) == 0) { + if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+19710 /* "trigger" */, 7) == 0) { token = U8(TkTRIGGER) - } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+22989 /* "temp" */, 4) == 0) { + } else if (nId == 4) && (Xsqlite3_strnicmp(tls, zSql, ts+23004 /* "temp" */, 4) == 0) { token = U8(TkTEMP) - } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+22994 /* "temporary" */, 9) == 0) { + } else if (nId == 9) && (Xsqlite3_strnicmp(tls, zSql, ts+23009 /* "temporary" */, 9) == 0) { token = U8(TkTEMP) } else { token = U8(TkOTHER) @@ -189465,9 +189973,9 @@ func Xsqlite3_complete(tls *libc.TLS, zSql uintptr) int32 { /* sqlite3.c:164796: fallthrough case 'E': { - if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+23004 /* "end" */, 3) == 0) { + if (nId == 3) && (Xsqlite3_strnicmp(tls, zSql, ts+23019 /* "end" */, 3) == 0) { token = U8(TkEND) - } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+23008 /* "explain" */, 7) == 0) { + } else if (nId == 7) && (Xsqlite3_strnicmp(tls, zSql, ts+23023 /* "explain" */, 7) == 0) { token = U8(TkEXPLAIN) } else { token = U8(TkOTHER) @@ -190495,7 +191003,7 @@ func sqlite3Close(tls *libc.TLS, db uintptr, forceZombie int32) int32 { /* sqlit // SQLITE_BUSY if the connection can not be closed immediately. if !(forceZombie != 0) && (connectionIsBusy(tls, db) != 0) { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+23016 /* "unable to close ..." */, 0) + ts+23031 /* "unable to close ..." */, 0) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return SQLITE_BUSY } @@ -190717,23 +191225,23 @@ func Xsqlite3RollbackAll(tls *libc.TLS, db uintptr, tripCode int32) { /* sqlite3 // Return a static string that describes the kind of error specified in the // argument. func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: */ - var zErr uintptr = ts + 23084 /* "unknown error" */ + var zErr uintptr = ts + 23099 /* "unknown error" */ switch rc { case (SQLITE_ABORT | (int32(2) << 8)): { - zErr = ts + 23098 /* "abort due to ROL..." */ + zErr = ts + 23113 /* "abort due to ROL..." */ break } case SQLITE_ROW: { - zErr = ts + 23120 /* "another row avai..." */ + zErr = ts + 23135 /* "another row avai..." */ break } case SQLITE_DONE: { - zErr = ts + 23142 /* "no more rows ava..." */ + zErr = ts + 23157 /* "no more rows ava..." */ break } @@ -190751,35 +191259,35 @@ func Xsqlite3ErrStr(tls *libc.TLS, rc int32) uintptr { /* sqlite3.c:166655:27: * } var aMsg = [29]uintptr{ - /* SQLITE_OK */ ts + 23165, /* "not an error" */ - /* SQLITE_ERROR */ ts + 23178, /* "SQL logic error" */ + /* SQLITE_OK */ ts + 23180, /* "not an error" */ + /* SQLITE_ERROR */ ts + 23193, /* "SQL logic error" */ /* SQLITE_INTERNAL */ uintptr(0), - /* SQLITE_PERM */ ts + 23194, /* "access permissio..." */ - /* SQLITE_ABORT */ ts + 23219, /* "query aborted" */ - /* SQLITE_BUSY */ ts + 23233, /* "database is lock..." */ - /* SQLITE_LOCKED */ ts + 23252, /* "database table i..." */ - /* SQLITE_NOMEM */ ts + 6528, /* "out of memory" */ - /* SQLITE_READONLY */ ts + 23277, /* "attempt to write..." */ - /* SQLITE_INTERRUPT */ ts + 23314, /* "interrupted" */ - /* SQLITE_IOERR */ ts + 23326, /* "disk I/O error" */ - /* SQLITE_CORRUPT */ ts + 23341, /* "database disk im..." */ - /* SQLITE_NOTFOUND */ ts + 23374, /* "unknown operatio..." */ - /* SQLITE_FULL */ ts + 23392, /* "database or disk..." */ - /* SQLITE_CANTOPEN */ ts + 23417, /* "unable to open d..." */ - /* SQLITE_PROTOCOL */ ts + 23446, /* "locking protocol" */ + /* SQLITE_PERM */ ts + 23209, /* "access permissio..." */ + /* SQLITE_ABORT */ ts + 23234, /* "query aborted" */ + /* SQLITE_BUSY */ ts + 23248, /* "database is lock..." */ + /* SQLITE_LOCKED */ ts + 23267, /* "database table i..." */ + /* SQLITE_NOMEM */ ts + 6543, /* "out of memory" */ + /* SQLITE_READONLY */ ts + 23292, /* "attempt to write..." */ + /* SQLITE_INTERRUPT */ ts + 23329, /* "interrupted" */ + /* SQLITE_IOERR */ ts + 23341, /* "disk I/O error" */ + /* SQLITE_CORRUPT */ ts + 23356, /* "database disk im..." */ + /* SQLITE_NOTFOUND */ ts + 23389, /* "unknown operatio..." */ + /* SQLITE_FULL */ ts + 23407, /* "database or disk..." */ + /* SQLITE_CANTOPEN */ ts + 23432, /* "unable to open d..." */ + /* SQLITE_PROTOCOL */ ts + 23461, /* "locking protocol" */ /* SQLITE_EMPTY */ uintptr(0), - /* SQLITE_SCHEMA */ ts + 6258, /* "database schema ..." */ - /* SQLITE_TOOBIG */ ts + 5795, /* "string or blob t..." */ - /* SQLITE_CONSTRAINT */ ts + 23463, /* "constraint faile..." */ - /* SQLITE_MISMATCH */ ts + 23481, /* "datatype mismatc..." */ - /* SQLITE_MISUSE */ ts + 23499, /* "bad parameter or..." */ + /* SQLITE_SCHEMA */ ts + 6273, /* "database schema ..." */ + /* SQLITE_TOOBIG */ ts + 5810, /* "string or blob t..." */ + /* SQLITE_CONSTRAINT */ ts + 23478, /* "constraint faile..." */ + /* SQLITE_MISMATCH */ ts + 23496, /* "datatype mismatc..." */ + /* SQLITE_MISUSE */ ts + 23514, /* "bad parameter or..." */ /* SQLITE_NOLFS */ uintptr(0), - /* SQLITE_AUTH */ ts + 23533, /* "authorization de..." */ + /* SQLITE_AUTH */ ts + 23548, /* "authorization de..." */ /* SQLITE_FORMAT */ uintptr(0), - /* SQLITE_RANGE */ ts + 23554, /* "column index out..." */ - /* SQLITE_NOTADB */ ts + 23580, /* "file is not a da..." */ - /* SQLITE_NOTICE */ ts + 23603, /* "notification mes..." */ - /* SQLITE_WARNING */ ts + 23624, /* "warning message" */ + /* SQLITE_RANGE */ ts + 23569, /* "column index out..." */ + /* SQLITE_NOTADB */ ts + 23595, /* "file is not a da..." */ + /* SQLITE_NOTICE */ ts + 23618, /* "notification mes..." */ + /* SQLITE_WARNING */ ts + 23639, /* "warning message" */ } /* sqlite3.c:166656:20 */ // This routine implements a busy callback that sleeps and tries @@ -190944,7 +191452,7 @@ func Xsqlite3CreateFunc(tls *libc.TLS, db uintptr, zFunctionName uintptr, nArg i if ((p != 0) && (((*FuncDef)(unsafe.Pointer(p)).FfuncFlags & U32(SQLITE_FUNC_ENCMASK)) == U32(enc))) && (int32((*FuncDef)(unsafe.Pointer(p)).FnArg) == nArg) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+23640 /* "unable to delete..." */, 0) + ts+23655 /* "unable to delete..." */, 0) return SQLITE_BUSY } else { @@ -191069,15 +191577,15 @@ func Xsqlite3_create_function16(tls *libc.TLS, db uintptr, zFunctionName uintptr // for name resolution but are actually overloaded by the xFindFunction // method of virtual tables. func sqlite3InvalidFunction(tls *libc.TLS, context uintptr, NotUsed int32, NotUsed2 uintptr) { /* sqlite3.c:167136:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var zName uintptr = Xsqlite3_user_data(tls, context) var zErr uintptr _ = NotUsed _ = NotUsed2 zErr = Xsqlite3_mprintf(tls, - ts+23703 /* "unable to use fu..." */, libc.VaList(bp, zName)) + ts+23718 /* "unable to use fu..." */, libc.VaList(bp, zName)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } @@ -191271,8 +191779,8 @@ func Xsqlite3_wal_hook(tls *libc.TLS, db uintptr, xCallback uintptr, pArg uintpt // Checkpoint database zDb. func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode int32, pnLog uintptr, pnCkpt uintptr) int32 { /* sqlite3.c:167449:16: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 // Return code var iDb int32 // Schema to checkpoint @@ -191299,7 +191807,7 @@ func Xsqlite3_wal_checkpoint_v2(tls *libc.TLS, db uintptr, zDb uintptr, eMode in } if iDb < 0 { rc = SQLITE_ERROR - Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+23754 /* "unknown database..." */, libc.VaList(bp, zDb)) + Xsqlite3ErrorWithMsg(tls, db, SQLITE_ERROR, ts+23769 /* "unknown database..." */, libc.VaList(bp, zDb)) } else { (*Sqlite3)(unsafe.Pointer(db)).FbusyHandler.FnBusy = 0 rc = Xsqlite3Checkpoint(tls, db, iDb, eMode, pnLog, pnCkpt) @@ -191518,7 +192026,7 @@ func createCollation(tls *libc.TLS, db uintptr, zName uintptr, enc U8, pCtx uint if (pColl != 0) && ((*CollSeq)(unsafe.Pointer(pColl)).FxCmp != 0) { if (*Sqlite3)(unsafe.Pointer(db)).FnVdbeActive != 0 { Xsqlite3ErrorWithMsg(tls, db, SQLITE_BUSY, - ts+23775 /* "unable to delete..." */, 0) + ts+23790 /* "unable to delete..." */, 0) return SQLITE_BUSY } Xsqlite3ExpirePreparedStatements(tls, db, 0) @@ -191629,8 +192137,8 @@ func Xsqlite3_limit(tls *libc.TLS, db uintptr, limitId int32, newLimit int32) in // message. It is the responsibility of the caller to eventually release // this buffer by calling sqlite3_free(). func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags uintptr, ppVfs uintptr, pzFile uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:167922:20: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(56) + defer tls.Free(56) var rc int32 var flags uint32 @@ -191661,7 +192169,7 @@ func Xsqlite3ParseUri(tls *libc.TLS, zDefaultVfs uintptr, zUri uintptr, pFlags u if !(((((flags & uint32(SQLITE_OPEN_URI)) != 0) || // IMP: R-48725-32206 (Xsqlite3Config.FbOpenUri != 0)) && // IMP: R-51689-46548 - (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+23843 /* "file:" */, uint64(5)) == 0)) { + (nUri >= 5)) && (libc.Xmemcmp(tls, zUri, ts+23858 /* "file:" */, uint64(5)) == 0)) { goto __1 } // Input character index iOut = 0 // Output character index @@ -191709,10 +192217,10 @@ __8: goto __8 __9: ; - if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+23849 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { + if !((iIn != 7) && ((iIn != 16) || (libc.Xmemcmp(tls, ts+23864 /* "localhost" */, (zUri+7), uint64(9)) != 0))) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23859, /* "invalid uri auth..." */ + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23874, /* "invalid uri auth..." */ libc.VaList(bp, (iIn-7), (zUri+7))) rc = SQLITE_ERROR goto parse_uri_out @@ -191834,7 +192342,7 @@ __27: zVal = (zOpt + uintptr((nOpt + 1))) nVal = Xsqlite3Strlen30(tls, zVal) - if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+23887 /* "vfs" */, zOpt, uint64(3)) == 0)) { + if !((nOpt == 3) && (libc.Xmemcmp(tls, ts+23902 /* "vfs" */, zOpt, uint64(3)) == 0)) { goto __29 } zVfs = zVal @@ -191845,17 +192353,17 @@ __29: mask = 0 limit = 0 - if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+23891 /* "cache" */, zOpt, uint64(5)) == 0)) { + if !((nOpt == 5) && (libc.Xmemcmp(tls, ts+23906 /* "cache" */, zOpt, uint64(5)) == 0)) { goto __31 } mask = (SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_PRIVATECACHE) aMode = uintptr(unsafe.Pointer(&aCacheMode)) limit = mask - zModeType = ts + 23891 /* "cache" */ + zModeType = ts + 23906 /* "cache" */ __31: ; - if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+23897 /* "mode" */, zOpt, uint64(4)) == 0)) { + if !((nOpt == 4) && (libc.Xmemcmp(tls, ts+23912 /* "mode" */, zOpt, uint64(4)) == 0)) { goto __32 } @@ -191863,7 +192371,7 @@ __31: SQLITE_OPEN_CREATE) | SQLITE_OPEN_MEMORY) aMode = uintptr(unsafe.Pointer(&aOpenMode)) limit = (int32(uint32(mask) & flags)) - zModeType = ts + 23902 /* "access" */ + zModeType = ts + 23917 /* "access" */ __32: ; @@ -191894,7 +192402,7 @@ __36: if !(mode == 0) { goto __38 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23909 /* "no such %s mode:..." */, libc.VaList(bp+24, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23924 /* "no such %s mode:..." */, libc.VaList(bp+16, zModeType, zVal)) rc = SQLITE_ERROR goto parse_uri_out __38: @@ -191902,8 +192410,8 @@ __38: if !((mode & libc.CplInt32(SQLITE_OPEN_MEMORY)) > limit) { goto __39 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23929, /* "%s mode not allo..." */ - libc.VaList(bp+48, zModeType, zVal)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23944, /* "%s mode not allo..." */ + libc.VaList(bp+32, zModeType, zVal)) rc = SQLITE_PERM goto parse_uri_out __39: @@ -191945,7 +192453,7 @@ __2: if !(*(*uintptr)(unsafe.Pointer(ppVfs)) == uintptr(0)) { goto __42 } - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23953 /* "no such vfs: %s" */, libc.VaList(bp+72, zVfs)) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+23968 /* "no such vfs: %s" */, libc.VaList(bp+48, zVfs)) rc = SQLITE_ERROR __42: ; @@ -191969,15 +192477,15 @@ type OpenMode = struct { } /* sqlite3.c:168064:9 */ var aCacheMode = [3]OpenMode{ - {Fz: ts + 23969 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, - {Fz: ts + 23976 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, + {Fz: ts + 23984 /* "shared" */, Fmode: SQLITE_OPEN_SHAREDCACHE}, + {Fz: ts + 23991 /* "private" */, Fmode: SQLITE_OPEN_PRIVATECACHE}, {}, } /* sqlite3.c:168073:34 */ var aOpenMode = [5]OpenMode{ - {Fz: ts + 23984 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, - {Fz: ts + 23987 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, - {Fz: ts + 23990 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, - {Fz: ts + 17214 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, + {Fz: ts + 23999 /* "ro" */, Fmode: SQLITE_OPEN_READONLY}, + {Fz: ts + 24002 /* "rw" */, Fmode: SQLITE_OPEN_READWRITE}, + {Fz: ts + 24005 /* "rwc" */, Fmode: (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)}, + {Fz: ts + 17229 /* "memory" */, Fmode: SQLITE_OPEN_MEMORY}, {}, } /* sqlite3.c:168085:34 */ @@ -192000,20 +192508,20 @@ func uriParameter(tls *libc.TLS, zFilename uintptr, zParam uintptr) uintptr { /* // sqlite3_open() and sqlite3_open16(). The database filename "zFilename" // is UTF-8 encoded. func openDatabase(tls *libc.TLS, zFilename uintptr, ppDb uintptr, flags uint32, zVfs uintptr) int32 { /* sqlite3.c:168177:12: */ - bp := tls.Alloc(40) - defer tls.Free(40) - *(*uint32)(unsafe.Pointer(bp + 16)) = flags + bp := tls.Alloc(32) + defer tls.Free(32) + *(*uint32)(unsafe.Pointer(bp + 8)) = flags var db uintptr // Store allocated handle here var rc int32 // Return code var isThreadsafe int32 // True for threadsafe connections - // var zOpen uintptr at bp+24, 8 + // var zOpen uintptr at bp+16, 8 // Filename argument to pass to BtreeOpen() - // var zErrMsg uintptr at bp+32, 8 + // var zErrMsg uintptr at bp+24, 8 // Error message from sqlite3ParseUri() var i int32 - *(*uintptr)(unsafe.Pointer(bp + 24 /* zOpen */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 32 /* zErrMsg */)) = uintptr(0) // Loop counter + *(*uintptr)(unsafe.Pointer(bp + 16 /* zOpen */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = uintptr(0) // Loop counter *(*uintptr)(unsafe.Pointer(ppDb)) = uintptr(0) rc = Xsqlite3_initialize(tls) @@ -192030,13 +192538,13 @@ __1: isThreadsafe = 0 goto __3 __2: - if !((*(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) & uint32(SQLITE_OPEN_NOMUTEX)) != 0) { + if !((*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(SQLITE_OPEN_NOMUTEX)) != 0) { goto __4 } isThreadsafe = 0 goto __5 __4: - if !((*(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) & uint32(SQLITE_OPEN_FULLMUTEX)) != 0) { + if !((*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(SQLITE_OPEN_FULLMUTEX)) != 0) { goto __6 } isThreadsafe = 1 @@ -192050,16 +192558,16 @@ __5: __3: ; - if !((*(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) & uint32(SQLITE_OPEN_PRIVATECACHE)) != 0) { + if !((*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(SQLITE_OPEN_PRIVATECACHE)) != 0) { goto __8 } - *(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) &= libc.Uint32FromInt32(libc.CplInt32(SQLITE_OPEN_SHAREDCACHE)) + *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) &= libc.Uint32FromInt32(libc.CplInt32(SQLITE_OPEN_SHAREDCACHE)) goto __9 __8: if !(Xsqlite3Config.FsharedCacheEnabled != 0) { goto __10 } - *(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) |= uint32(SQLITE_OPEN_SHAREDCACHE) + *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) |= uint32(SQLITE_OPEN_SHAREDCACHE) __10: ; __9: @@ -192073,7 +192581,7 @@ __9: // SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE, // SQLITE_OPEN_PRIVATECACHE, and some reserved bits. Silently mask // off all other flags. - *(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) &= libc.Uint32FromInt32(libc.CplInt32((((((((((((SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB) | SQLITE_OPEN_TRANSIENT_DB) | SQLITE_OPEN_MAIN_JOURNAL) | SQLITE_OPEN_TEMP_JOURNAL) | SQLITE_OPEN_SUBJOURNAL) | SQLITE_OPEN_SUPER_JOURNAL) | SQLITE_OPEN_NOMUTEX) | SQLITE_OPEN_FULLMUTEX) | SQLITE_OPEN_WAL))) + *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) &= libc.Uint32FromInt32(libc.CplInt32((((((((((((SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB) | SQLITE_OPEN_TRANSIENT_DB) | SQLITE_OPEN_MAIN_JOURNAL) | SQLITE_OPEN_TEMP_JOURNAL) | SQLITE_OPEN_SUBJOURNAL) | SQLITE_OPEN_SUPER_JOURNAL) | SQLITE_OPEN_NOMUTEX) | SQLITE_OPEN_FULLMUTEX) | SQLITE_OPEN_WAL))) // Allocate the sqlite data structure db = Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(Sqlite3{}))) @@ -192159,10 +192667,10 @@ __12: createCollation(tls, db, uintptr(unsafe.Pointer(&Xsqlite3StrBINARY)), uint8(SQLITE_UTF16LE), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{binCollFunc})), uintptr(0)) - createCollation(tls, db, ts+21533 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+21548 /* "NOCASE" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{nocaseCollatingFunc})), uintptr(0)) - createCollation(tls, db, ts+23994 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + createCollation(tls, db, ts+24009 /* "RTRIM" */, uint8(SQLITE_UTF8), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32 }{rtrimCollFunc})), uintptr(0)) if !((*Sqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { @@ -192183,18 +192691,18 @@ __15: // 1: SQLITE_OPEN_READONLY // 2: SQLITE_OPEN_READWRITE // 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE - (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = *(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) + (*Sqlite3)(unsafe.Pointer(db)).FopenFlags = *(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) // READONLY // READWRITE // READWRITE | CREATE - if !(((int32(1) << (*(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) & uint32(7))) & 0x46) == 0) { + if !(((int32(1) << (*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) & uint32(7))) & 0x46) == 0) { goto __16 } rc = Xsqlite3MisuseError(tls, 168382) // IMP: R-18321-05872 goto __17 __16: - rc = Xsqlite3ParseUri(tls, zVfs, zFilename, bp+16 /* &flags */, (db /* &.pVfs */), bp+24 /* &zOpen */, bp+32 /* &zErrMsg */) + rc = Xsqlite3ParseUri(tls, zVfs, zFilename, bp+8 /* &flags */, (db /* &.pVfs */), bp+16 /* &zOpen */, bp+24 /* &zErrMsg */) __17: ; if !(rc != SQLITE_OK) { @@ -192207,19 +192715,19 @@ __17: __19: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { - if *(*uintptr)(unsafe.Pointer(bp + 32 /* zErrMsg */)) != 0 { - return ts + 3615 /* "%s" */ + if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { + return ts + 3630 /* "%s" */ } return uintptr(0) - }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErrMsg */)))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErrMsg */))) + }(), libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) goto opendb_out __18: ; // Open the backend database driver - rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer(bp + 24 /* zOpen */)), db, ((*Sqlite3)(unsafe.Pointer(db)).FaDb + 8 /* &.pBt */), 0, - (int32(*(*uint32)(unsafe.Pointer(bp + 16 /* flags */)) | uint32(SQLITE_OPEN_MAIN_DB)))) + rc = Xsqlite3BtreeOpen(tls, (*Sqlite3)(unsafe.Pointer(db)).FpVfs, *(*uintptr)(unsafe.Pointer(bp + 16 /* zOpen */)), db, ((*Sqlite3)(unsafe.Pointer(db)).FaDb + 8 /* &.pBt */), 0, + (int32(*(*uint32)(unsafe.Pointer(bp + 8 /* flags */)) | uint32(SQLITE_OPEN_MAIN_DB)))) if !(rc != SQLITE_OK) { goto __20 } @@ -192246,9 +192754,9 @@ __22: // The default safety_level for the main database is FULL; for the temp // database it is OFF. This matches the pager layer defaults. - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 6805 /* "main" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).FzDbSName = ts + 6820 /* "main" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb)).Fsafety_level = (U8(SQLITE_DEFAULT_SYNCHRONOUS + 1)) - (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 22989 /* "temp" */ + (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).FzDbSName = ts + 23004 /* "temp" */ (*Db)(unsafe.Pointer((*Sqlite3)(unsafe.Pointer(db)).FaDb + 1*32)).Fsafety_level = U8(PAGER_SYNCHRONOUS_OFF) (*Sqlite3)(unsafe.Pointer(db)).Fmagic = SQLITE_MAGIC_OPEN @@ -192340,7 +192848,7 @@ __33: __32: ; *(*uintptr)(unsafe.Pointer(ppDb)) = db - Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* zOpen */))) + Xsqlite3_free_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zOpen */))) return (rc & 0xff) } @@ -192366,7 +192874,7 @@ func Xsqlite3_open16(tls *libc.TLS, zFilename uintptr, ppDb uintptr) int32 { /* return rc } if zFilename == uintptr(0) { - zFilename = ts + 24000 /* "\x00\x00" */ + zFilename = ts + 24015 /* "\x00\x00" */ } pVal = Xsqlite3ValueNew(tls, uintptr(0)) Xsqlite3ValueSetStr(tls, pVal, -1, zFilename, uint8(SQLITE_UTF16LE), uintptr(0)) @@ -192466,27 +192974,27 @@ func Xsqlite3_get_autocommit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:168 // 2. Invoke sqlite3_log() to provide the source code location where // a low-level error is first detected. func Xsqlite3ReportError(tls *libc.TLS, iErr int32, lineno int32, zType uintptr) int32 { /* sqlite3.c:168706:20: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) - Xsqlite3_log(tls, iErr, ts+24003, /* "%s at line %d of..." */ + Xsqlite3_log(tls, iErr, ts+24018, /* "%s at line %d of..." */ libc.VaList(bp, zType, lineno, (uintptr(20)+Xsqlite3_sourceid(tls)))) return iErr } func Xsqlite3CorruptError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168711:20: */ - return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+24028 /* "database corrupt..." */) + return Xsqlite3ReportError(tls, SQLITE_CORRUPT, lineno, ts+24043 /* "database corrupt..." */) } func Xsqlite3MisuseError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168715:20: */ - return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+24048 /* "misuse" */) + return Xsqlite3ReportError(tls, SQLITE_MISUSE, lineno, ts+24063 /* "misuse" */) } func Xsqlite3CantopenError(tls *libc.TLS, lineno int32) int32 { /* sqlite3.c:168719:20: */ - return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+24055 /* "cannot open file" */) + return Xsqlite3ReportError(tls, SQLITE_CANTOPEN, lineno, ts+24070 /* "cannot open file" */) } // This is a convenience routine that makes sure that all thread-specific @@ -192500,11 +193008,11 @@ func Xsqlite3_thread_cleanup(tls *libc.TLS) { /* sqlite3.c:168750:17: */ // Return meta information about a specific column of a database table. // See comment in sqlite3.h (sqlite.h.in) for details. func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, zTableName uintptr, zColumnName uintptr, pzDataType uintptr, pzCollSeq uintptr, pNotNull uintptr, pPrimaryKey uintptr, pAutoinc uintptr) int32 { /* sqlite3.c:168758:16: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) var rc int32 - // var zErrMsg uintptr at bp+40, 8 + // var zErrMsg uintptr at bp+24, 8 var pTab uintptr var pCol uintptr @@ -192514,7 +193022,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, var notnull int32 var primarykey int32 var autoinc int32 - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrMsg */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = uintptr(0) pTab = uintptr(0) pCol = uintptr(0) iCol = 0 @@ -192527,7 +193035,7 @@ func Xsqlite3_table_column_metadata(tls *libc.TLS, db uintptr, zDbName uintptr, // Ensure the database schema has been loaded Xsqlite3_mutex_enter(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) Xsqlite3BtreeEnterAll(tls, db) - rc = Xsqlite3Init(tls, db, bp+40 /* &zErrMsg */) + rc = Xsqlite3Init(tls, db, bp+24 /* &zErrMsg */) if !(SQLITE_OK != rc) { goto __1 } @@ -192613,7 +193121,7 @@ __4: autoinc = (libc.Bool32((int32((*Table)(unsafe.Pointer(pTab)).FiPKey) == iCol) && (((*Table)(unsafe.Pointer(pTab)).FtabFlags & U32(TF_Autoincrement)) != U32(0)))) goto __13 __12: - zDataType = ts + 12731 /* "INTEGER" */ + zDataType = ts + 12746 /* "INTEGER" */ primarykey = 1 __13: ; @@ -192664,19 +193172,19 @@ __19: if !((SQLITE_OK == rc) && !(pTab != 0)) { goto __20 } - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrMsg */))) - *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+24072 /* "no such table co..." */, libc.VaList(bp, zTableName, + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) + *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) = Xsqlite3MPrintf(tls, db, ts+24087 /* "no such table co..." */, libc.VaList(bp, zTableName, zColumnName)) rc = SQLITE_ERROR __20: ; Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { - if *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrMsg */)) != 0 { - return ts + 3615 /* "%s" */ + if *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)) != 0 { + return ts + 3630 /* "%s" */ } return uintptr(0) - }(), libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrMsg */)))) - Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErrMsg */))) + }(), libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */)))) + Xsqlite3DbFree(tls, db, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrMsg */))) rc = Xsqlite3ApiExit(tls, db, rc) Xsqlite3_mutex_leave(tls, (*Sqlite3)(unsafe.Pointer(db)).Fmutex) return rc @@ -193471,7 +193979,7 @@ func Xsqlite3_compileoption_used(tls *libc.TLS, zOptName uintptr) int32 { /* sql azCompileOpt = Xsqlite3CompileOptions(tls, bp /* &nOpt */) - if Xsqlite3_strnicmp(tls, zOptName, ts+24100 /* "SQLITE_" */, 7) == 0 { + if Xsqlite3_strnicmp(tls, zOptName, ts+24115 /* "SQLITE_" */, 7) == 0 { zOptName += uintptr(7) } n = Xsqlite3Strlen30(tls, zOptName) @@ -193632,7 +194140,7 @@ func Xsqlite3_unlock_notify(tls *libc.TLS, db uintptr, xNotify uintptr, pArg uin Xsqlite3ErrorWithMsg(tls, db, rc, func() uintptr { if rc != 0 { - return ts + 24108 /* "database is dead..." */ + return ts + 24123 /* "database is dead..." */ } return uintptr(0) }(), 0) @@ -194432,7 +194940,7 @@ type JsonParse = JsonParse1 /* sqlite3.c:189738:26 */ // Names of the various JSON types: var jsonType = [8]uintptr{ - ts + 6605 /* "null" */, ts + 7117 /* "true" */, ts + 7122 /* "false" */, ts + 6615 /* "integer" */, ts + 6610 /* "real" */, ts + 14875 /* "text" */, ts + 24131 /* "array" */, ts + 24137, /* "object" */ + ts + 6620 /* "null" */, ts + 7132 /* "true" */, ts + 7137 /* "false" */, ts + 6630 /* "integer" */, ts + 6625 /* "real" */, ts + 14890 /* "text" */, ts + 24146 /* "array" */, ts + 24152, /* "object" */ } /* sqlite3.c:189771:19 */ // Maximum nesting depth of JSON for this implementation. @@ -194612,7 +195120,7 @@ __10: *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = int8('0') *(*int8)(unsafe.Pointer((*JsonString)(unsafe.Pointer(p)).FzBuf + uintptr(libc.PostIncUint64(&(*JsonString)(unsafe.Pointer(p)).FnUsed, 1)))) = (int8('0' + (int32(c) >> 4))) - c = uint8(*(*int8)(unsafe.Pointer(ts + 24144 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) + c = uint8(*(*int8)(unsafe.Pointer(ts + 24159 /* "0123456789abcdef" */ + uintptr((int32(c) & 0xf))))) __8: ; __6: @@ -194640,7 +195148,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 switch Xsqlite3_value_type(tls, pValue) { case SQLITE_NULL: { - jsonAppendRaw(tls, p, ts+6605 /* "null" */, uint32(4)) + jsonAppendRaw(tls, p, ts+6620 /* "null" */, uint32(4)) break } @@ -194669,7 +195177,7 @@ func jsonAppendValue(tls *libc.TLS, p uintptr, pValue uintptr) { /* sqlite3.c:18 default: { if int32((*JsonString)(unsafe.Pointer(p)).FbErr) == 0 { - Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+24161 /* "JSON cannot hold..." */, -1) + Xsqlite3_result_error(tls, (*JsonString)(unsafe.Pointer(p)).FpCtx, ts+24176 /* "JSON cannot hold..." */, -1) (*JsonString)(unsafe.Pointer(p)).FbErr = U8(2) jsonReset(tls, p) } @@ -194746,19 +195254,19 @@ func jsonRenderNode(tls *libc.TLS, pNode uintptr, pOut uintptr, aReplace uintptr default: { - jsonAppendRaw(tls, pOut, ts+6605 /* "null" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+6620 /* "null" */, uint32(4)) break } case JSON_TRUE: { - jsonAppendRaw(tls, pOut, ts+7117 /* "true" */, uint32(4)) + jsonAppendRaw(tls, pOut, ts+7132 /* "true" */, uint32(4)) break } case JSON_FALSE: { - jsonAppendRaw(tls, pOut, ts+7122 /* "false" */, uint32(5)) + jsonAppendRaw(tls, pOut, ts+7137 /* "false" */, uint32(5)) break } @@ -195324,17 +195832,17 @@ func jsonParseValue(tls *libc.TLS, pParse uintptr, i U32) int32 { /* sqlite3.c:1 } return (int32(j + U32(1))) } else if ((int32(c) == 'n') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6605 /* "null" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+6620 /* "null" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_NULL), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 't') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+7117 /* "true" */, uint64(4)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+7132 /* "true" */, uint64(4)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(4))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_TRUE), uint32(0), uintptr(0)) return (int32(i + U32(4))) } else if ((int32(c) == 'f') && - (libc.Xstrncmp(tls, (z+uintptr(i)), ts+7122 /* "false" */, uint64(5)) == 0)) && + (libc.Xstrncmp(tls, (z+uintptr(i)), ts+7137 /* "false" */, uint64(5)) == 0)) && !((int32(Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((i + U32(5))))))]) & 0x06) != 0) { jsonParseAddNode(tls, pParse, uint32(JSON_FALSE), uint32(0), uintptr(0)) return (int32(i + U32(5))) @@ -195442,7 +195950,7 @@ func jsonParse(tls *libc.TLS, pParse uintptr, pCtx uintptr, zJson uintptr) int32 if (*JsonParse)(unsafe.Pointer(pParse)).Foom != 0 { Xsqlite3_result_error_nomem(tls, pCtx) } else { - Xsqlite3_result_error(tls, pCtx, ts+24190 /* "malformed JSON" */, -1) + Xsqlite3_result_error(tls, pCtx, ts+24205 /* "malformed JSON" */, -1) } } jsonParseReset(tls, pParse) @@ -195762,7 +196270,7 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt } if int32(*(*int8)(unsafe.Pointer(zPath))) == '.' { jsonParseAddNode(tls, pParse, uint32(JSON_OBJECT), uint32(0), uintptr(0)) - } else if libc.Xstrncmp(tls, zPath, ts+24205 /* "[0]" */, uint64(3)) == 0 { + } else if libc.Xstrncmp(tls, zPath, ts+24220 /* "[0]" */, uint64(3)) == 0 { jsonParseAddNode(tls, pParse, uint32(JSON_ARRAY), uint32(0), uintptr(0)) } else { return uintptr(0) @@ -195776,10 +196284,10 @@ func jsonLookupAppend(tls *libc.TLS, pParse uintptr, zPath uintptr, pApnd uintpt // Return the text of a syntax error message on a JSON path. Space is // obtained from sqlite3_malloc(). func jsonPathSyntaxError(tls *libc.TLS, zErr uintptr) uintptr { /* sqlite3.c:190925:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) - return Xsqlite3_mprintf(tls, ts+24209 /* "JSON path error ..." */, libc.VaList(bp, zErr)) + return Xsqlite3_mprintf(tls, ts+24224 /* "JSON path error ..." */, libc.VaList(bp, zErr)) } // Do a node lookup using zPath. Return a pointer to the node on success. @@ -195843,10 +196351,10 @@ __5: // Report the wrong number of arguments for json_insert(), json_replace() // or json_set(). func jsonWrongNumArgs(tls *libc.TLS, pCtx uintptr, zFuncName uintptr) { /* sqlite3.c:190976:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) - var zMsg uintptr = Xsqlite3_mprintf(tls, ts+24235, /* "json_%s() needs ..." */ + var zMsg uintptr = Xsqlite3_mprintf(tls, ts+24250, /* "json_%s() needs ..." */ libc.VaList(bp, zFuncName)) Xsqlite3_result_error(tls, pCtx, zMsg, -1) Xsqlite3_free(tls, zMsg) @@ -195990,7 +196498,7 @@ func jsonExtractFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* if pNode != 0 { jsonRenderNode(tls, pNode, bp /* &jx */, uintptr(0)) } else { - jsonAppendRaw(tls, bp /* &jx */, ts+6605 /* "null" */, uint32(4)) + jsonAppendRaw(tls, bp /* &jx */, ts+6620 /* "null" */, uint32(4)) } } else if pNode != 0 { jsonReturn(tls, pNode, ctx, uintptr(0)) @@ -196118,14 +196626,14 @@ func jsonObjectFunc(tls *libc.TLS, ctx uintptr, argc int32, argv uintptr) { /* s if (argc & 1) != 0 { Xsqlite3_result_error(tls, ctx, - ts+24278 /* "json_object() re..." */, -1) + ts+24293 /* "json_object() re..." */, -1) return } jsonInit(tls, bp /* &jx */, ctx) jsonAppendChar(tls, bp /* &jx */, int8('{')) for i = 0; i < argc; i = i + (2) { if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != SQLITE_TEXT { - Xsqlite3_result_error(tls, ctx, ts+24329 /* "json_object() la..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+24344 /* "json_object() la..." */, -1) jsonReset(tls, bp /* &jx */) return } @@ -196233,7 +196741,7 @@ __1: if !((argc & 1) == 0) { goto __2 } - jsonWrongNumArgs(tls, ctx, ts+15386 /* "replace" */) + jsonWrongNumArgs(tls, ctx, ts+15401 /* "replace" */) return __2: ; @@ -196319,9 +196827,9 @@ __1: } jsonWrongNumArgs(tls, ctx, func() uintptr { if bIsSet != 0 { - return ts + 24363 /* "set" */ + return ts + 24378 /* "set" */ } - return ts + 24367 /* "insert" */ + return ts + 24382 /* "insert" */ }()) return __2: @@ -196469,7 +196977,7 @@ func jsonArrayCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c: (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+24374 /* "[]" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+24389 /* "[]" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -196574,7 +197082,7 @@ func jsonObjectCompute(tls *libc.TLS, ctx uintptr, isFinal int32) { /* sqlite3.c (*JsonString)(unsafe.Pointer(pStr)).FnUsed-- } } else { - Xsqlite3_result_text(tls, ctx, ts+24377 /* "{}" */, 2, uintptr(0)) + Xsqlite3_result_text(tls, ctx, ts+24392 /* "{}" */, 2, uintptr(0)) } Xsqlite3_result_subtype(tls, ctx, uint32(JSON_SUBTYPE)) } @@ -196627,7 +197135,7 @@ func jsonEachConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv u _ = pAux rc = Xsqlite3_declare_vtab(tls, db, - ts+24380 /* "CREATE TABLE x(k..." */) + ts+24395 /* "CREATE TABLE x(k..." */) if rc == SQLITE_OK { pNew = libc.AssignPtrUintptr(ppVtab, Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_vtab{})))) if pNew == uintptr(0) { @@ -196750,8 +197258,8 @@ func jsonEachNext(tls *libc.TLS, cur uintptr) int32 { /* sqlite3.c:191797:12: */ // Append the name of the path for element i to pStr func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sqlite3.c:191838:13: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var pNode uintptr var pUp uintptr @@ -196765,21 +197273,21 @@ func jsonEachComputePath(tls *libc.TLS, p uintptr, pStr uintptr, i U32) { /* sql pNode = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(i)*16) pUp = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr(iUp)*16) if int32((*JsonNode)(unsafe.Pointer(pUp)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, pStr, ts+24463 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) + jsonPrintf(tls, 30, pStr, ts+24478 /* "[%d]" */, libc.VaList(bp, *(*U32)(unsafe.Pointer(pUp + 8 /* &.u */)))) } else { if (int32((*JsonNode)(unsafe.Pointer(pNode)).FjnFlags) & JNODE_LABEL) == 0 { pNode -= 16 } - jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+24468 /* ".%.*s" */, libc.VaList(bp+16, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, (int32((*JsonNode)(unsafe.Pointer(pNode)).Fn + U32(1))), pStr, ts+24483 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pNode)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pNode + 8 /* &.u */))+uintptr(1)))) } } // Return the value of a column func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* sqlite3.c:191865:12: */ - bp := tls.Alloc(312) - defer tls.Free(312) + bp := tls.Alloc(296) + defer tls.Free(296) var p uintptr = cur var pThis uintptr = ((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaNode + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*16) @@ -196853,35 +197361,35 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* } case JEACH_FULLKEY: { - // var x JsonString at bp+40, 136 + // var x JsonString at bp+24, 136 - jsonInit(tls, bp+40 /* &x */, ctx) + jsonInit(tls, bp+24 /* &x */, ctx) if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { - jsonEachComputePath(tls, p, bp+40 /* &x */, (*JsonEachCursor)(unsafe.Pointer(p)).Fi) + jsonEachComputePath(tls, p, bp+24 /* &x */, (*JsonEachCursor)(unsafe.Pointer(p)).Fi) } else { if (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot != 0 { - jsonAppendRaw(tls, bp+40 /* &x */, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot, uint32(int32(libc.Xstrlen(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot)))) + jsonAppendRaw(tls, bp+24 /* &x */, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot, uint32(int32(libc.Xstrlen(tls, (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot)))) } else { - jsonAppendChar(tls, bp+40 /* &x */, int8('$')) + jsonAppendChar(tls, bp+24 /* &x */, int8('$')) } if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_ARRAY { - jsonPrintf(tls, 30, bp+40 /* &x */, ts+24463 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) + jsonPrintf(tls, 30, bp+24 /* &x */, ts+24478 /* "[%d]" */, libc.VaList(bp, (*JsonEachCursor)(unsafe.Pointer(p)).FiRowid)) } else if int32((*JsonEachCursor)(unsafe.Pointer(p)).FeType) == JSON_OBJECT { - jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+40 /* &x */, ts+24468 /* ".%.*s" */, libc.VaList(bp+16, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) + jsonPrintf(tls, int32((*JsonNode)(unsafe.Pointer(pThis)).Fn), bp+24 /* &x */, ts+24483 /* ".%.*s" */, libc.VaList(bp+8, ((*JsonNode)(unsafe.Pointer(pThis)).Fn-U32(2)), (*(*uintptr)(unsafe.Pointer(pThis + 8 /* &.u */))+uintptr(1)))) } } - jsonResult(tls, bp+40 /* &x */) + jsonResult(tls, bp+24 /* &x */) break } case JEACH_PATH: { if (*JsonEachCursor)(unsafe.Pointer(p)).FbRecursive != 0 { - // var x JsonString at bp+176, 136 + // var x JsonString at bp+160, 136 - jsonInit(tls, bp+176 /* &x */, ctx) - jsonEachComputePath(tls, p, bp+176 /* &x */, *(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4))) - jsonResult(tls, bp+176 /* &x */) + jsonInit(tls, bp+160 /* &x */, ctx) + jsonEachComputePath(tls, p, bp+160 /* &x */, *(*U32)(unsafe.Pointer((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.FaUp + uintptr((*JsonEachCursor)(unsafe.Pointer(p)).Fi)*4))) + jsonResult(tls, bp+160 /* &x */) break } @@ -196891,7 +197399,7 @@ func jsonEachColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* { var zRoot uintptr = (*JsonEachCursor)(unsafe.Pointer(p)).FzRoot if zRoot == uintptr(0) { - zRoot = ts + 24474 /* "$" */ + zRoot = ts + 24489 /* "$" */ } Xsqlite3_result_text(tls, ctx, zRoot, -1, uintptr(0)) break @@ -197023,7 +197531,7 @@ func jsonEachFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, ar var rc int32 = SQLITE_NOMEM if int32((*JsonEachCursor)(unsafe.Pointer(p)).FsParse.Foom) == 0 { Xsqlite3_free(tls, (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg) - (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+24190 /* "malformed JSON" */, 0) + (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+24205 /* "malformed JSON" */, 0) if (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).FzErrMsg != 0 { rc = SQLITE_ERROR } @@ -197164,21 +197672,21 @@ var aFunc = [15]struct { Fflag int32 FxFunc uintptr }{ - {FzName: ts + 24476 /* "json" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 24481 /* "json_array" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 24492 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 24492 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 24510 /* "json_extract" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 24523 /* "json_insert" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 24535 /* "json_object" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 24547 /* "json_patch" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 24558 /* "json_quote" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 24569 /* "json_remove" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 24581 /* "json_replace" */, FnArg: -1, FxFunc: 0}, - {FzName: ts + 24594 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, - {FzName: ts + 24603 /* "json_type" */, FnArg: 1, FxFunc: 0}, - {FzName: ts + 24603 /* "json_type" */, FnArg: 2, FxFunc: 0}, - {FzName: ts + 24613 /* "json_valid" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 24491 /* "json" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 24496 /* "json_array" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 24507 /* "json_array_lengt..." */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 24507 /* "json_array_lengt..." */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 24525 /* "json_extract" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 24538 /* "json_insert" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 24550 /* "json_object" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 24562 /* "json_patch" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 24573 /* "json_quote" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 24584 /* "json_remove" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 24596 /* "json_replace" */, FnArg: -1, FxFunc: 0}, + {FzName: ts + 24609 /* "json_set" */, FnArg: -1, Fflag: 1, FxFunc: 0}, + {FzName: ts + 24618 /* "json_type" */, FnArg: 1, FxFunc: 0}, + {FzName: ts + 24618 /* "json_type" */, FnArg: 2, FxFunc: 0}, + {FzName: ts + 24628 /* "json_valid" */, FnArg: 1, FxFunc: 0}, } /* sqlite3.c:192182:5 */ var aAgg = [2]struct { FzName uintptr @@ -197188,17 +197696,17 @@ var aAgg = [2]struct { FxFinal uintptr FxValue uintptr }{ - {FzName: ts + 24624 /* "json_group_array" */, FnArg: 1, + {FzName: ts + 24639 /* "json_group_array" */, FnArg: 1, FxStep: 0, FxFinal: 0, FxValue: 0}, - {FzName: ts + 24641 /* "json_group_objec..." */, FnArg: 2, + {FzName: ts + 24656 /* "json_group_objec..." */, FnArg: 2, FxStep: 0, FxFinal: 0, FxValue: 0}, } /* sqlite3.c:192211:5 */ var aMod = [2]struct { FzName uintptr FpModule uintptr }{ - {FzName: ts + 24659 /* "json_each" */, FpModule: 0}, - {FzName: ts + 24669 /* "json_tree" */, FpModule: 0}, + {FzName: ts + 24674 /* "json_each" */, FpModule: 0}, + {FzName: ts + 24684 /* "json_tree" */, FpModule: 0}, } /* sqlite3.c:192221:5 */ var enc int32 = ((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS) /* sqlite3.c:192226:20 */ // In the SQLite core @@ -197511,8 +198019,8 @@ func nodeInParentChain(tls *libc.TLS, pNode uintptr, pParent uintptr) int32 { /* // Obtain a reference to an r-tree node. func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNode uintptr) int32 { /* sqlite3.c:192953:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = SQLITE_OK var pNode uintptr = uintptr(0) @@ -197549,11 +198057,11 @@ func nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode I64, pParent uintptr, ppNo } } if (*Rtree)(unsafe.Pointer(pRtree)).FpNodeBlob == uintptr(0) { - var zTab uintptr = Xsqlite3_mprintf(tls, ts+24679 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + var zTab uintptr = Xsqlite3_mprintf(tls, ts+24694 /* "%s_node" */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zTab == uintptr(0) { return SQLITE_NOMEM } - rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+24687 /* "data" */, iNode, 0, + rc = Xsqlite3_blob_open(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, zTab, ts+24702 /* "data" */, iNode, 0, (pRtree + 112 /* &.pNodeBlob */)) Xsqlite3_free(tls, zTab) } @@ -197791,14 +198299,14 @@ func rtreeDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193300:1 // Rtree virtual table module xDestroy method. func rtreeDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:193308:12: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) var pRtree uintptr = pVtab var rc int32 var zCreate uintptr = Xsqlite3_mprintf(tls, - ts+24692, /* "DROP TABLE '%q'...." */ + ts+24707, /* "DROP TABLE '%q'...." */ libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) @@ -198558,7 +199066,7 @@ func deserializeGeometry(tls *libc.TLS, pValue uintptr, pCons uintptr) int32 { / var pSrc uintptr // BLOB returned by geometry function var pInfo uintptr // Callback information - pSrc = Xsqlite3_value_pointer(tls, pValue, ts+24774 /* "RtreeMatchArg" */) + pSrc = Xsqlite3_value_pointer(tls, pValue, ts+24789 /* "RtreeMatchArg" */) if pSrc == uintptr(0) { return SQLITE_ERROR } @@ -198728,8 +199236,8 @@ func rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintpt // to which the constraint applies. The leftmost coordinate column // is 'a', the second from the left 'b' etc. func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sqlite3.c:194235:12: */ - bp := tls.Alloc(57) - defer tls.Free(57) + bp := tls.Alloc(49) + defer tls.Free(49) var pRtree uintptr = tab var rc int32 = SQLITE_OK @@ -198738,9 +199246,9 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql var nRow I64 // Estimated rows returned by this scan var iIdx int32 = 0 - // var zIdxStr [41]int8 at bp+16, 41 + // var zIdxStr [41]int8 at bp+8, 41 - libc.Xmemset(tls, bp+16 /* &zIdxStr[0] */, 0, uint64(unsafe.Sizeof([41]int8{}))) + libc.Xmemset(tls, bp+8 /* &zIdxStr[0] */, 0, uint64(unsafe.Sizeof([41]int8{}))) // Check if there exists a MATCH constraint - even an unusable one. If there // is, do not consider the lookup-by-rowid plan as using such a plan would @@ -198812,8 +199320,8 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql break } if op != 0 { - *(*int8)(unsafe.Pointer(bp + 16 /* &zIdxStr[0] */ + uintptr(libc.PostIncInt32(&iIdx, 1)))) = int8(op) - *(*int8)(unsafe.Pointer(bp + 16 /* &zIdxStr[0] */ + uintptr(libc.PostIncInt32(&iIdx, 1)))) = (int8(((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn - 1) + '0')) + *(*int8)(unsafe.Pointer(bp + 8 /* &zIdxStr[0] */ + uintptr(libc.PostIncInt32(&iIdx, 1)))) = int8(op) + *(*int8)(unsafe.Pointer(bp + 8 /* &zIdxStr[0] */ + uintptr(libc.PostIncInt32(&iIdx, 1)))) = (int8(((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn - 1) + '0')) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)).FargvIndex = (iIdx / 2) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)).Fomit = uint8(1) } @@ -198822,7 +199330,7 @@ func rtreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* sql (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1 - if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, bp+16 /* &zIdxStr[0] */))))) { + if (iIdx > 0) && (uintptr(0) == (libc.AssignPtrUintptr(pIdxInfo+48 /* &.idxStr */, Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, bp+8 /* &zIdxStr[0] */))))) { return SQLITE_NOMEM } @@ -200075,16 +200583,16 @@ func rtreeValueUp(tls *libc.TLS, v uintptr) RtreeValue { /* sqlite3.c:195393:19: // // If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* sqlite3.c:195416:12: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(64) + defer tls.Free(64) - *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0) var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+24788 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + zSql = Xsqlite3_mprintf(tls, ts+24803 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) if zSql != 0 { - rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+80 /* &pStmt */, uintptr(0)) + rc = Xsqlite3_prepare_v2(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, -1, bp+56 /* &pStmt */, uintptr(0)) } else { rc = SQLITE_NOMEM } @@ -200092,18 +200600,18 @@ func rtreeConstraintError(tls *libc.TLS, pRtree uintptr, iCol int32) int32 { /* if rc == SQLITE_OK { if iCol == 0 { - var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), 0) + var zCol uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 0) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+24808 /* "UNIQUE constrain..." */, libc.VaList(bp+24, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) + ts+24823 /* "UNIQUE constrain..." */, libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol)) } else { - var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), iCol) - var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), (iCol + 1)) + var zCol1 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), iCol) + var zCol2 uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), (iCol + 1)) (*Rtree)(unsafe.Pointer(pRtree)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+24840 /* "rtree constraint..." */, libc.VaList(bp+48, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) + ts+24855 /* "rtree constraint..." */, libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zCol1, zCol2)) } } - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) return func() int32 { if rc == SQLITE_OK { return SQLITE_CONSTRAINT @@ -200360,14 +200868,14 @@ func rtreeEndTransaction(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3.c:1956 // The xRename method for rtree module virtual tables. func rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) int32 { /* sqlite3.c:195623:12: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(72) + defer tls.Free(72) var pRtree uintptr = pVtab var rc int32 = SQLITE_NOMEM var zSql uintptr = Xsqlite3_mprintf(tls, - ts+24877 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) + ts+24892 /* "ALTER TABLE %Q.'..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName, zNewName)) if zSql != 0 { nodeBlobReset(tls, pRtree) rc = Xsqlite3_exec(tls, (*Rtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0)) @@ -200402,18 +200910,18 @@ func rtreeSavepoint(tls *libc.TLS, pVtab uintptr, iSavepoint int32) int32 { /* s // of the number of rows in the virtual table. If possible, this is based // on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlite3.c:195671:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) - var zFmt uintptr = ts + 25022 /* "SELECT stat FROM..." */ + var zFmt uintptr = ts + 25037 /* "SELECT stat FROM..." */ var zSql uintptr - // var p uintptr at bp+24, 8 + // var p uintptr at bp+16, 8 var rc int32 var nRow I64 = int64(0) rc = Xsqlite3_table_column_metadata(tls, - db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+11419 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + db, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, ts+11434 /* "sqlite_stat1" */, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) if rc != SQLITE_OK { (*Rtree)(unsafe.Pointer(pRtree)).FnRowEst = int64(RTREE_DEFAULT_ROWEST) if rc == SQLITE_ERROR { @@ -200425,12 +200933,12 @@ func rtreeQueryStat1(tls *libc.TLS, db uintptr, pRtree uintptr) int32 { /* sqlit if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { - rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+24 /* &p */, uintptr(0)) + rc = Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+16 /* &p */, uintptr(0)) if rc == SQLITE_OK { - if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* p */))) == SQLITE_ROW { - nRow = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* p */)), 0) + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) == SQLITE_ROW { + nRow = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), 0) } - rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* p */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) } else if rc != SQLITE_NOMEM { rc = SQLITE_OK } @@ -200466,7 +200974,7 @@ func rtreeShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:195715:1 } var azName1 = [3]uintptr{ - ts + 25078 /* "node" */, ts + 5521 /* "parent" */, ts + 16110, /* "rowid" */ + ts + 25093 /* "node" */, ts + 5536 /* "parent" */, ts + 16125, /* "rowid" */ } /* sqlite3.c:195716:21 */ var rtreeModule = Sqlite3_module{ @@ -200494,11 +201002,11 @@ var rtreeModule = Sqlite3_module{ } /* sqlite3.c:195726:23 */ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefix uintptr, isCreate int32) int32 { /* sqlite3.c:195753:12: */ - bp := tls.Alloc(312) - defer tls.Free(312) + bp := tls.Alloc(232) + defer tls.Free(232) var rc int32 = SQLITE_OK - // var appStmt [8]uintptr at bp+248, 64 + // var appStmt [8]uintptr at bp+168, 64 var i int32 var f int32 = (SQLITE_PREPARE_PERSISTENT | SQLITE_PREPARE_NO_VTAB) @@ -200510,20 +201018,20 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 Xsqlite3_str_appendf(tls, p, - ts+25083, /* "CREATE TABLE \"%w..." */ + ts+25098, /* "CREATE TABLE \"%w..." */ libc.VaList(bp, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { - Xsqlite3_str_appendf(tls, p, ts+25145 /* ",a%d" */, libc.VaList(bp+24, ii)) + Xsqlite3_str_appendf(tls, p, ts+25160 /* ",a%d" */, libc.VaList(bp+16, ii)) } Xsqlite3_str_appendf(tls, p, - ts+25150, /* ");CREATE TABLE \"..." */ + ts+25165, /* ");CREATE TABLE \"..." */ + libc.VaList(bp+24, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, + ts+25229, /* "CREATE TABLE \"%w..." */ libc.VaList(bp+40, zDb, zPrefix)) Xsqlite3_str_appendf(tls, p, - ts+25214, /* "CREATE TABLE \"%w..." */ - libc.VaList(bp+64, zDb, zPrefix)) - Xsqlite3_str_appendf(tls, p, - ts+25284, /* "INSERT INTO \"%w\"..." */ - libc.VaList(bp+88, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) + ts+25299, /* "INSERT INTO \"%w\"..." */ + libc.VaList(bp+56, zDb, zPrefix, (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize)) zCreate = Xsqlite3_str_finish(tls, p) if !(zCreate != 0) { return SQLITE_NOMEM @@ -200535,14 +201043,14 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } } - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */)) = (pRtree + 120 /* &.pWriteNode */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 1*8)) = (pRtree + 128 /* &.pDeleteNode */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 2*8)) = (pRtree + 136 /* &.pReadRowid */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 3*8)) = (pRtree + 144 /* &.pWriteRowid */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 4*8)) = (pRtree + 152 /* &.pDeleteRowid */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 5*8)) = (pRtree + 160 /* &.pReadParent */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 6*8)) = (pRtree + 168 /* &.pWriteParent */) - *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + 7*8)) = (pRtree + 176 /* &.pDeleteParent */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */)) = (pRtree + 120 /* &.pWriteNode */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 1*8)) = (pRtree + 128 /* &.pDeleteNode */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 2*8)) = (pRtree + 136 /* &.pReadRowid */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 3*8)) = (pRtree + 144 /* &.pWriteRowid */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 4*8)) = (pRtree + 152 /* &.pDeleteRowid */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 5*8)) = (pRtree + 160 /* &.pReadParent */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 6*8)) = (pRtree + 168 /* &.pWriteParent */) + *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + 7*8)) = (pRtree + 176 /* &.pDeleteParent */) rc = rtreeQueryStat1(tls, db, pRtree) for i = 0; (i < N_STATEMENT) && (rc == SQLITE_OK); i++ { @@ -200553,11 +201061,11 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } else { // An UPSERT is very slightly slower than REPLACE, but it is needed // if there are auxiliary columns - zFormat = ts + 25333 /* "INSERT INTO\"%w\"...." */ + zFormat = ts + 25348 /* "INSERT INTO\"%w\"...." */ } - zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+120, zDb, zPrefix)) + zSql = Xsqlite3_mprintf(tls, zFormat, libc.VaList(bp+80, zDb, zPrefix)) if zSql != 0 { - rc = Xsqlite3_prepare_v3(tls, db, zSql, -1, uint32(f), *(*uintptr)(unsafe.Pointer(bp + 248 /* &appStmt[0] */ + uintptr(i)*8)), uintptr(0)) + rc = Xsqlite3_prepare_v3(tls, db, zSql, -1, uint32(f), *(*uintptr)(unsafe.Pointer(bp + 168 /* &appStmt[0] */ + uintptr(i)*8)), uintptr(0)) } else { rc = SQLITE_NOMEM } @@ -200565,26 +201073,26 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi } if (*Rtree)(unsafe.Pointer(pRtree)).FnAux != 0 { (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql = Xsqlite3_mprintf(tls, - ts+25441, /* "SELECT * FROM \"%..." */ - libc.VaList(bp+144, zDb, zPrefix)) + ts+25456, /* "SELECT * FROM \"%..." */ + libc.VaList(bp+96, zDb, zPrefix)) if (*Rtree)(unsafe.Pointer(pRtree)).FzReadAuxSql == uintptr(0) { rc = SQLITE_NOMEM } else { var p uintptr = Xsqlite3_str_new(tls, db) var ii int32 var zSql uintptr - Xsqlite3_str_appendf(tls, p, ts+25486 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+168, zDb, zPrefix)) + Xsqlite3_str_appendf(tls, p, ts+25501 /* "UPDATE \"%w\".\"%w_..." */, libc.VaList(bp+112, zDb, zPrefix)) for ii = 0; ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux); ii++ { if ii != 0 { - Xsqlite3_str_append(tls, p, ts+12884 /* "," */, 1) + Xsqlite3_str_append(tls, p, ts+12899 /* "," */, 1) } if ii < int32((*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull) { - Xsqlite3_str_appendf(tls, p, ts+25513 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+192, ii, (ii+2), ii)) + Xsqlite3_str_appendf(tls, p, ts+25528 /* "a%d=coalesce(?%d..." */, libc.VaList(bp+128, ii, (ii+2), ii)) } else { - Xsqlite3_str_appendf(tls, p, ts+25535 /* "a%d=?%d" */, libc.VaList(bp+224, ii, (ii+2))) + Xsqlite3_str_appendf(tls, p, ts+25550 /* "a%d=?%d" */, libc.VaList(bp+152, ii, (ii+2))) } } - Xsqlite3_str_appendf(tls, p, ts+25543 /* " WHERE rowid=?1" */, 0) + Xsqlite3_str_appendf(tls, p, ts+25558 /* " WHERE rowid=?1" */, 0) zSql = Xsqlite3_str_finish(tls, p) if zSql == uintptr(0) { rc = SQLITE_NOMEM @@ -200600,18 +201108,18 @@ func rtreeSqlInit(tls *libc.TLS, pRtree uintptr, db uintptr, zDb uintptr, zPrefi var azSql = [8]uintptr{ // Write the xxx_node table - ts + 25559, /* "INSERT OR REPLAC..." */ - ts + 25612, /* "DELETE FROM '%q'..." */ + ts + 25574, /* "INSERT OR REPLAC..." */ + ts + 25627, /* "DELETE FROM '%q'..." */ // Read and write the xxx_rowid table - ts + 25657, /* "SELECT nodeno FR..." */ - ts + 25709, /* "INSERT OR REPLAC..." */ - ts + 25763, /* "DELETE FROM '%q'..." */ + ts + 25672, /* "SELECT nodeno FR..." */ + ts + 25724, /* "INSERT OR REPLAC..." */ + ts + 25778, /* "DELETE FROM '%q'..." */ // Read and write the xxx_parent table - ts + 25808, /* "SELECT parentnod..." */ - ts + 25866, /* "INSERT OR REPLAC..." */ - ts + 25921, /* "DELETE FROM '%q'..." */ + ts + 25823, /* "SELECT parentnod..." */ + ts + 25881, /* "INSERT OR REPLAC..." */ + ts + 25936, /* "DELETE FROM '%q'..." */ } /* sqlite3.c:195763:21 */ // The second argument to this function contains the text of an SQL statement @@ -200651,35 +201159,35 @@ func getIntFromStmt(tls *libc.TLS, db uintptr, zSql uintptr, piVal uintptr) int3 // database page-size is so large that more than RTREE_MAXCELLS entries // would fit in a single node, use a smaller node-size. func getNodeSize(tls *libc.TLS, db uintptr, pRtree uintptr, isCreate int32, pzErr uintptr) int32 { /* sqlite3.c:195913:12: */ - bp := tls.Alloc(92) - defer tls.Free(92) + bp := tls.Alloc(52) + defer tls.Free(52) var rc int32 var zSql uintptr if isCreate != 0 { - *(*int32)(unsafe.Pointer(bp + 88 /* iPageSize */)) = 0 - zSql = Xsqlite3_mprintf(tls, ts+25968 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) - rc = getIntFromStmt(tls, db, zSql, bp+88 /* &iPageSize */) + *(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) = 0 + zSql = Xsqlite3_mprintf(tls, ts+25983 /* "PRAGMA %Q.page_s..." */, libc.VaList(bp, (*Rtree)(unsafe.Pointer(pRtree)).FzDb)) + rc = getIntFromStmt(tls, db, zSql, bp+48 /* &iPageSize */) if rc == SQLITE_OK { - (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 88 /* iPageSize */)) - 64) + (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (*(*int32)(unsafe.Pointer(bp + 48 /* iPageSize */)) - 64) if (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) < (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize { (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize = (4 + (int32((*Rtree)(unsafe.Pointer(pRtree)).FnBytesPerCell) * RTREE_MAXCELLS)) } } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+8, Xsqlite3_errmsg(tls, db))) } } else { zSql = Xsqlite3_mprintf(tls, - ts+25988, /* "SELECT length(da..." */ - libc.VaList(bp+32, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + ts+26003, /* "SELECT length(da..." */ + libc.VaList(bp+16, (*Rtree)(unsafe.Pointer(pRtree)).FzDb, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) rc = getIntFromStmt(tls, db, zSql, (pRtree + 32 /* &.iNodeSize */)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+56, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) } else if (*Rtree)(unsafe.Pointer(pRtree)).FiNodeSize < (512 - 64) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+26045, /* "undersize RTree ..." */ - libc.VaList(bp+72, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+26060, /* "undersize RTree ..." */ + libc.VaList(bp+40, (*Rtree)(unsafe.Pointer(pRtree)).FzName)) } } @@ -200704,8 +201212,8 @@ func rtreeTokenLength(tls *libc.TLS, z uintptr) int32 { /* sqlite3.c:195956:12: // argv[2] -> table name // argv[...] -> column names... func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr, isCreate int32) int32 { /* sqlite3.c:195970:12: */ - bp := tls.Alloc(208) - defer tls.Free(208) + bp := tls.Alloc(136) + defer tls.Free(136) var rc int32 var pRtree uintptr @@ -200716,7 +201224,7 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr var zSql uintptr var ii int32 var iErr int32 - // var aErrMsg [5]uintptr at bp+168, 40 + // var aErrMsg [5]uintptr at bp+96, 40 var zArg uintptr rc = SQLITE_OK @@ -200727,24 +201235,24 @@ func rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr return RTREE_COORD_REAL32 }() ii = 4 - *(*[5]uintptr)(unsafe.Pointer(bp + 168 /* aErrMsg */)) = [5]uintptr{ + *(*[5]uintptr)(unsafe.Pointer(bp + 96 /* aErrMsg */)) = [5]uintptr{ uintptr(0), // 0 - ts + 26080, /* "Wrong number of ..." */ // 1 - ts + 26123, /* "Too few columns ..." */ // 2 - ts + 26158, /* "Too many columns..." */ // 3 - ts + 26194, /* "Auxiliary rtree ..." */ // 4 + ts + 26095, /* "Wrong number of ..." */ // 1 + ts + 26138, /* "Too few columns ..." */ // 2 + ts + 26173, /* "Too many columns..." */ // 3 + ts + 26209, /* "Auxiliary rtree ..." */ // 4 } // Aux columns counted by a u8 if !((argc < 6) || (argc > (RTREE_MAX_AUX_COLUMN + 3))) { goto __1 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 168 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr((2+(libc.Bool32(argc >= 6))))*8)))) return SQLITE_ERROR __1: ; - Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_CONSTRAINT_SUPPORT, libc.VaList(bp+16, 1)) + Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_CONSTRAINT_SUPPORT, libc.VaList(bp+8, 1)) // Allocate the sqlite3_vtab structure nDb = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) @@ -200769,8 +201277,8 @@ __2: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+26231, /* "CREATE TABLE x(%..." */ - libc.VaList(bp+32, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) + Xsqlite3_str_appendf(tls, pSql, ts+26246, /* "CREATE TABLE x(%..." */ + libc.VaList(bp+16, rtreeTokenLength(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))), *(*uintptr)(unsafe.Pointer(argv + 3*8)))) ii = 4 __3: if !(ii < argc) { @@ -200781,7 +201289,7 @@ __3: goto __6 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+26255 /* ",%.*s" */, libc.VaList(bp+56, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) + Xsqlite3_str_appendf(tls, pSql, ts+26270 /* ",%.*s" */, libc.VaList(bp+32, rtreeTokenLength(tls, (zArg+uintptr(1))), (zArg+uintptr(1)))) goto __7 __6: if !(int32((*Rtree)(unsafe.Pointer(pRtree)).FnAux) > 0) { @@ -200792,7 +201300,7 @@ __6: __8: (*Rtree)(unsafe.Pointer(pRtree)).FnDim2++ Xsqlite3_str_appendf(tls, pSql, azFormat[eCoordType], - libc.VaList(bp+80, rtreeTokenLength(tls, zArg), zArg)) + libc.VaList(bp+48, rtreeTokenLength(tls, zArg), zArg)) __9: ; __7: @@ -200804,7 +201312,7 @@ __4: goto __5 __5: ; - Xsqlite3_str_appendf(tls, pSql, ts+26261 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+26276 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __10 @@ -200815,14 +201323,14 @@ __10: if !(ii < argc) { goto __12 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+104, *(*uintptr)(unsafe.Pointer(bp + 168 /* &aErrMsg[0] */ + 4*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + 4*8)))) rc = SQLITE_ERROR goto __13 __12: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __14 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+72, Xsqlite3_errmsg(tls, db))) __14: ; __13: @@ -200865,7 +201373,7 @@ __17: if !(iErr != 0) { goto __22 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+136, *(*uintptr)(unsafe.Pointer(bp + 168 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(bp + 96 /* &aErrMsg[0] */ + uintptr(iErr)*8)))) goto rtreeInit_fail __22: ; @@ -200883,7 +201391,7 @@ __23: if !(rc != 0) { goto __24 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+152, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+88, Xsqlite3_errmsg(tls, db))) goto rtreeInit_fail __24: ; @@ -200903,7 +201411,7 @@ __25: return rc } -var azFormat = [2]uintptr{ts + 26264 /* ",%.*s REAL" */, ts + 26275 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ +var azFormat = [2]uintptr{ts + 26279 /* ",%.*s REAL" */, ts + 26290 /* ",%.*s INT" */} /* sqlite3.c:196036:25 */ // Implementation of a scalar function that decodes r-tree nodes to // human readable strings. This can be used for debugging and analysis. @@ -200920,12 +201428,12 @@ var azFormat = [2]uintptr{ts + 26264 /* ",%.*s REAL" */, ts + 26275 /* ",%.*s IN // list, containing the 8-byte rowid/pageno followed by the // *2 coordinates. func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlite3.c:196107:13: */ - bp := tls.Alloc(1088) - defer tls.Free(1088) + bp := tls.Alloc(1072) + defer tls.Free(1072) - // var node RtreeNode at bp+32, 40 + // var node RtreeNode at bp+16, 40 - // var tree Rtree at bp+72, 968 + // var tree Rtree at bp+56, 968 var ii int32 var nData int32 @@ -200933,38 +201441,38 @@ func rtreenode(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqlit var pOut uintptr _ = nArg - libc.Xmemset(tls, bp+32 /* &node */, 0, uint64(unsafe.Sizeof(RtreeNode{}))) - libc.Xmemset(tls, bp+72 /* &tree */, 0, uint64(unsafe.Sizeof(Rtree{}))) - (*Rtree)(unsafe.Pointer(bp + 72 /* &tree */)).FnDim = U8(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apArg)))) - if (int32((*Rtree)(unsafe.Pointer(bp+72 /* &tree */)).FnDim) < 1) || (int32((*Rtree)(unsafe.Pointer(bp+72 /* &tree */)).FnDim) > 5) { + libc.Xmemset(tls, bp+16 /* &node */, 0, uint64(unsafe.Sizeof(RtreeNode{}))) + libc.Xmemset(tls, bp+56 /* &tree */, 0, uint64(unsafe.Sizeof(Rtree{}))) + (*Rtree)(unsafe.Pointer(bp + 56 /* &tree */)).FnDim = U8(Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apArg)))) + if (int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim) < 1) || (int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim) > 5) { return } - (*Rtree)(unsafe.Pointer(bp + 72 /* &tree */)).FnDim2 = (U8(int32((*Rtree)(unsafe.Pointer(bp+72 /* &tree */)).FnDim) * 2)) - (*Rtree)(unsafe.Pointer(bp + 72 /* &tree */)).FnBytesPerCell = (U8(8 + (8 * int32((*Rtree)(unsafe.Pointer(bp+72 /* &tree */)).FnDim)))) - (*RtreeNode)(unsafe.Pointer(bp + 32 /* &node */)).FzData = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) + (*Rtree)(unsafe.Pointer(bp + 56 /* &tree */)).FnDim2 = (U8(int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim) * 2)) + (*Rtree)(unsafe.Pointer(bp + 56 /* &tree */)).FnBytesPerCell = (U8(8 + (8 * int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim)))) + (*RtreeNode)(unsafe.Pointer(bp + 16 /* &node */)).FzData = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) nData = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) if nData < 4 { return } - if nData < (readInt16(tls, ((*RtreeNode)(unsafe.Pointer((bp+32 /* &node */))).FzData+2)) * int32((*Rtree)(unsafe.Pointer(bp+72 /* &tree */)).FnBytesPerCell)) { + if nData < (readInt16(tls, ((*RtreeNode)(unsafe.Pointer((bp+16 /* &node */))).FzData+2)) * int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnBytesPerCell)) { return } pOut = Xsqlite3_str_new(tls, uintptr(0)) - for ii = 0; ii < readInt16(tls, ((*RtreeNode)(unsafe.Pointer((bp+32 /* &node */))).FzData+2)); ii++ { - // var cell RtreeCell at bp+1040, 48 + for ii = 0; ii < readInt16(tls, ((*RtreeNode)(unsafe.Pointer((bp+16 /* &node */))).FzData+2)); ii++ { + // var cell RtreeCell at bp+1024, 48 var jj int32 - nodeGetCell(tls, bp+72 /* &tree */, bp+32 /* &node */, ii, bp+1040 /* &cell */) + nodeGetCell(tls, bp+56 /* &tree */, bp+16 /* &node */, ii, bp+1024 /* &cell */) if ii > 0 { - Xsqlite3_str_append(tls, pOut, ts+10999 /* " " */, 1) + Xsqlite3_str_append(tls, pOut, ts+11014 /* " " */, 1) } - Xsqlite3_str_appendf(tls, pOut, ts+26285 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1040 /* &cell */)).FiRowid)) - for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+72 /* &tree */)).FnDim2); jj++ { - Xsqlite3_str_appendf(tls, pOut, ts+26291 /* " %g" */, libc.VaList(bp+16, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1040 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) + Xsqlite3_str_appendf(tls, pOut, ts+26300 /* "{%lld" */, libc.VaList(bp, (*RtreeCell)(unsafe.Pointer(bp+1024 /* &cell */)).FiRowid)) + for jj = 0; jj < int32((*Rtree)(unsafe.Pointer(bp+56 /* &tree */)).FnDim2); jj++ { + Xsqlite3_str_appendf(tls, pOut, ts+26306 /* " %g" */, libc.VaList(bp+8, float64(*(*RtreeValue)(unsafe.Pointer((bp + 1024 /* &cell */ + 8 /* &.aCoord */) + uintptr(jj)*4))))) } - Xsqlite3_str_append(tls, pOut, ts+26295 /* "}" */, 1) + Xsqlite3_str_append(tls, pOut, ts+26310 /* "}" */, 1) } errCode = Xsqlite3_str_errcode(tls, pOut) Xsqlite3_result_text(tls, ctx, Xsqlite3_str_finish(tls, pOut), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) @@ -200983,7 +201491,7 @@ func rtreedepth(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli _ = nArg if (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_BLOB) || (Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apArg))) < 2) { - Xsqlite3_result_error(tls, ctx, ts+26297 /* "Invalid argument..." */, -1) + Xsqlite3_result_error(tls, ctx, ts+26312 /* "Invalid argument..." */, -1) } else { var zBlob uintptr = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apArg))) if zBlob != 0 { @@ -201061,8 +201569,8 @@ func rtreeCheckPrepare(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) // style format string and arguments. This function formats the string and // appends it to the report being accumuated in pCheck. func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr) { /* sqlite3.c:196243:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var ap Va_list _ = ap @@ -201072,12 +201580,12 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr if z == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM } else { - (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+26330, /* "%z%s%z" */ + (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport = Xsqlite3_mprintf(tls, ts+26345, /* "%z%s%z" */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport, func() uintptr { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport != 0 { - return ts + 4518 /* "\n" */ + return ts + 4533 /* "\n" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), z)) if (*RtreeCheck)(unsafe.Pointer(pCheck)).FzReport == uintptr(0) { (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = SQLITE_NOMEM @@ -201101,14 +201609,14 @@ func rtreeCheckAppendMsg(tls *libc.TLS, pCheck uintptr, zFmt uintptr, va uintptr // in the RtreeCheck object. The final value of *pnNode is undefined in // this case. func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) uintptr { /* sqlite3.c:196277:11: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(24) + defer tls.Free(24) var pRet uintptr = uintptr(0) // Return value if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && ((*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode == uintptr(0)) { (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode = rtreeCheckPrepare(tls, pCheck, - ts+26337, /* "SELECT data FROM..." */ + ts+26352, /* "SELECT data FROM..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } @@ -201127,7 +201635,7 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) } rtreeCheckReset(tls, pCheck, (*RtreeCheck)(unsafe.Pointer(pCheck)).FpGetNode) if ((*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK) && (pRet == uintptr(0)) { - rtreeCheckAppendMsg(tls, pCheck, ts+26382 /* "Node %lld missin..." */, libc.VaList(bp+24, iNode)) + rtreeCheckAppendMsg(tls, pCheck, ts+26397 /* "Node %lld missin..." */, libc.VaList(bp+16, iNode)) } } @@ -201145,19 +201653,19 @@ func rtreeCheckGetNode(tls *libc.TLS, pCheck uintptr, iNode I64, pnNode uintptr) // IPK value iKey and the second column set to iVal. // func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVal I64) { /* sqlite3.c:196321:13: */ - bp := tls.Alloc(120) - defer tls.Free(120) + bp := tls.Alloc(96) + defer tls.Free(96) var rc int32 var pStmt uintptr - *(*[2]uintptr)(unsafe.Pointer(bp + 104 /* azSql */)) = [2]uintptr{ - ts + 26414, /* "SELECT parentnod..." */ - ts + 26468, /* "SELECT nodeno FR..." */ + *(*[2]uintptr)(unsafe.Pointer(bp + 80 /* azSql */)) = [2]uintptr{ + ts + 26429, /* "SELECT parentnod..." */ + ts + 26483, /* "SELECT nodeno FR..." */ } if *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) == uintptr(0) { *(*uintptr)(unsafe.Pointer((pCheck + 40 /* &.aCheckMapping */) + uintptr(bLeaf)*8)) = rtreeCheckPrepare(tls, pCheck, - *(*uintptr)(unsafe.Pointer(bp + 104 /* &azSql[0] */ + uintptr(bLeaf)*8)), libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) + *(*uintptr)(unsafe.Pointer(bp + 80 /* &azSql[0] */ + uintptr(bLeaf)*8)), libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab)) } if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc != SQLITE_OK { return @@ -201167,23 +201675,23 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa Xsqlite3_bind_int64(tls, pStmt, 1, iKey) rc = Xsqlite3_step(tls, pStmt) if rc == SQLITE_DONE { - rtreeCheckAppendMsg(tls, pCheck, ts+26516, /* "Mapping (%lld ->..." */ - libc.VaList(bp+24, iKey, iVal, func() uintptr { + rtreeCheckAppendMsg(tls, pCheck, ts+26531, /* "Mapping (%lld ->..." */ + libc.VaList(bp+16, iKey, iVal, func() uintptr { if bLeaf != 0 { - return ts + 26561 /* "%_rowid" */ + return ts + 26576 /* "%_rowid" */ } - return ts + 26569 /* "%_parent" */ + return ts + 26584 /* "%_parent" */ }())) } else if rc == SQLITE_ROW { var ii I64 = Xsqlite3_column_int64(tls, pStmt, 0) if ii != iVal { rtreeCheckAppendMsg(tls, pCheck, - ts+26578, /* "Found (%lld -> %..." */ - libc.VaList(bp+56, iKey, ii, func() uintptr { + ts+26593, /* "Found (%lld -> %..." */ + libc.VaList(bp+40, iKey, ii, func() uintptr { if bLeaf != 0 { - return ts + 26561 /* "%_rowid" */ + return ts + 26576 /* "%_rowid" */ } - return ts + 26569 /* "%_parent" */ + return ts + 26584 /* "%_parent" */ }(), iKey, iVal)) } } @@ -201201,52 +201709,52 @@ func rtreeCheckMapping(tls *libc.TLS, pCheck uintptr, bLeaf int32, iKey I64, iVa // sets of coordinates are mutually consistent and an error message added // to the RtreeCheck object if they are not. func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, pCell uintptr, pParent uintptr) { /* sqlite3.c:196373:13: */ - bp := tls.Alloc(80) - defer tls.Free(80) + bp := tls.Alloc(64) + defer tls.Free(64) - // var c1 RtreeCoord at bp+64, 4 + // var c1 RtreeCoord at bp+48, 4 - // var c2 RtreeCoord at bp+68, 4 + // var c2 RtreeCoord at bp+52, 4 - // var p1 RtreeCoord at bp+72, 4 + // var p1 RtreeCoord at bp+56, 4 - // var p2 RtreeCoord at bp+76, 4 + // var p2 RtreeCoord at bp+60, 4 var i int32 for i = 0; i < (*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim; i++ { - readCoord(tls, (pCell + uintptr(((4 * 2) * i))), bp+64 /* &c1 */) - readCoord(tls, (pCell + uintptr((4 * ((2 * i) + 1)))), bp+68 /* &c2 */) + readCoord(tls, (pCell + uintptr(((4 * 2) * i))), bp+48 /* &c1 */) + readCoord(tls, (pCell + uintptr((4 * ((2 * i) + 1)))), bp+52 /* &c2 */) // printf("%e, %e\n", c1.u.f, c2.u.f); if func() int32 { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { - return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 64 /* &c1 */)) > *(*int32)(unsafe.Pointer(bp + 68 /* &c2 */)))) + return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*int32)(unsafe.Pointer(bp + 52 /* &c2 */)))) } - return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 64 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 68 /* &c2 */)))) + return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)))) }() != 0 { rtreeCheckAppendMsg(tls, pCheck, - ts+26636 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) + ts+26651 /* "Dimension %d of ..." */, libc.VaList(bp, i, iCell, iNode)) } if pParent != 0 { - readCoord(tls, (pParent + uintptr(((4 * 2) * i))), bp+72 /* &p1 */) - readCoord(tls, (pParent + uintptr((4 * ((2 * i) + 1)))), bp+76 /* &p2 */) + readCoord(tls, (pParent + uintptr(((4 * 2) * i))), bp+56 /* &p1 */) + readCoord(tls, (pParent + uintptr((4 * ((2 * i) + 1)))), bp+60 /* &p2 */) if (func() int32 { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { - return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 64 /* &c1 */)) < *(*int32)(unsafe.Pointer(bp + 72 /* &p1 */)))) + return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 48 /* &c1 */)) < *(*int32)(unsafe.Pointer(bp + 56 /* &p1 */)))) } - return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 64 /* &c1 */)) < *(*RtreeValue)(unsafe.Pointer(bp + 72 /* &p1 */)))) + return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 48 /* &c1 */)) < *(*RtreeValue)(unsafe.Pointer(bp + 56 /* &p1 */)))) }() != 0) || (func() int32 { if (*RtreeCheck)(unsafe.Pointer(pCheck)).FbInt != 0 { - return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 68 /* &c2 */)) > *(*int32)(unsafe.Pointer(bp + 76 /* &p2 */)))) + return (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*int32)(unsafe.Pointer(bp + 60 /* &p2 */)))) } - return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 68 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 76 /* &p2 */)))) + return (libc.Bool32(*(*RtreeValue)(unsafe.Pointer(bp + 52 /* &c2 */)) > *(*RtreeValue)(unsafe.Pointer(bp + 60 /* &p2 */)))) }() != 0) { rtreeCheckAppendMsg(tls, pCheck, - ts+26684 /* "Dimension %d of ..." */, libc.VaList(bp+32, i, iCell, iNode)) + ts+26699 /* "Dimension %d of ..." */, libc.VaList(bp+24, i, iCell, iNode)) } } } @@ -201259,33 +201767,33 @@ func rtreeCheckCellCoord(tls *libc.TLS, pCheck uintptr, iNode I64, iCell int32, // If any problems are discovered, an error message is appended to the // report accumulated in the RtreeCheck object. func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr, iNode I64) { /* sqlite3.c:196419:13: */ - bp := tls.Alloc(76) - defer tls.Free(76) + bp := tls.Alloc(52) + defer tls.Free(52) var aNode uintptr = uintptr(0) - *(*int32)(unsafe.Pointer(bp + 72 /* nNode */)) = 0 + *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) = 0 - aNode = rtreeCheckGetNode(tls, pCheck, iNode, bp+72 /* &nNode */) + aNode = rtreeCheckGetNode(tls, pCheck, iNode, bp+48 /* &nNode */) if aNode != 0 { - if *(*int32)(unsafe.Pointer(bp + 72 /* nNode */)) < 4 { + if *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) < 4 { rtreeCheckAppendMsg(tls, pCheck, - ts+26751 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 72 /* nNode */)))) + ts+26766 /* "Node %lld is too..." */, libc.VaList(bp, iNode, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { var nCell int32 // Number of cells on page var i int32 // Used to iterate through cells if aParent == uintptr(0) { iDepth = readInt16(tls, aNode) if iDepth > RTREE_MAX_DEPTH { - rtreeCheckAppendMsg(tls, pCheck, ts+26785 /* "Rtree depth out ..." */, libc.VaList(bp+24, iDepth)) + rtreeCheckAppendMsg(tls, pCheck, ts+26800 /* "Rtree depth out ..." */, libc.VaList(bp+16, iDepth)) Xsqlite3_free(tls, aNode) return } } nCell = readInt16(tls, (aNode + 2)) - if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 72 /* nNode */)) { + if (4 + (nCell * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))) > *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)) { rtreeCheckAppendMsg(tls, pCheck, - ts+26815, /* "Node %lld is too..." */ - libc.VaList(bp+40, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 72 /* nNode */)))) + ts+26830, /* "Node %lld is too..." */ + libc.VaList(bp+24, iNode, nCell, *(*int32)(unsafe.Pointer(bp + 48 /* nNode */)))) } else { for i = 0; i < nCell; i++ { var pCell uintptr = (aNode + uintptr((4 + (i * (8 + (((*RtreeCheck)(unsafe.Pointer(pCheck)).FnDim * 2) * 4)))))) @@ -201313,19 +201821,19 @@ func rtreeCheckNode(tls *libc.TLS, pCheck uintptr, iDepth int32, aParent uintptr // an error message to the report in the RtreeCheck object indicated // by the first argument. func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { /* sqlite3.c:196482:13: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(48) + defer tls.Free(48) if (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc == SQLITE_OK { var pCount uintptr - pCount = rtreeCheckPrepare(tls, pCheck, ts+26870, /* "SELECT count(*) ..." */ + pCount = rtreeCheckPrepare(tls, pCheck, ts+26885, /* "SELECT count(*) ..." */ libc.VaList(bp, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzDb, (*RtreeCheck)(unsafe.Pointer(pCheck)).FzTab, zTbl)) if pCount != 0 { if Xsqlite3_step(tls, pCount) == SQLITE_ROW { var nActual I64 = Xsqlite3_column_int64(tls, pCount, 0) if nActual != nExpect { rtreeCheckAppendMsg(tls, pCheck, - ts+26901 /* "Wrong number of ..." */, libc.VaList(bp+32, zTbl, nExpect, nActual)) + ts+26916 /* "Wrong number of ..." */, libc.VaList(bp+24, zTbl, nExpect, nActual)) } } (*RtreeCheck)(unsafe.Pointer(pCheck)).Frc = Xsqlite3_finalize(tls, pCount) @@ -201336,78 +201844,78 @@ func rtreeCheckCount(tls *libc.TLS, pCheck uintptr, zTbl uintptr, nExpect I64) { // This function does the bulk of the work for the rtree integrity-check. // It is called by rtreecheck(), which is the SQL function implementation. func rtreeCheckTable(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, pzReport uintptr) int32 { /* sqlite3.c:196506:12: */ - bp := tls.Alloc(136) - defer tls.Free(136) + bp := tls.Alloc(120) + defer tls.Free(120) - // var check RtreeCheck at bp+48, 88 + // var check RtreeCheck at bp+32, 88 // Common context for various routines var pStmt uintptr = uintptr(0) // Used to find column count of rtree table var bEnd int32 = 0 // True if transaction should be closed var nAux int32 = 0 // Number of extra columns. // Initialize the context object - libc.Xmemset(tls, bp+48 /* &check */, 0, uint64(unsafe.Sizeof(RtreeCheck{}))) - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).Fdb = db - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).FzDb = zDb - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).FzTab = zTab + libc.Xmemset(tls, bp+32 /* &check */, 0, uint64(unsafe.Sizeof(RtreeCheck{}))) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Fdb = db + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FzDb = zDb + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FzTab = zTab // If there is not already an open transaction, open one now. This is // to ensure that the queries run as part of this integrity-check operate // on a consistent snapshot. if Xsqlite3_get_autocommit(tls, db) != 0 { - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+14565 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = Xsqlite3_exec(tls, db, ts+14580 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0)) bEnd = 1 } // Find the number of auxiliary columns - if (*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).Frc == SQLITE_OK { - pStmt = rtreeCheckPrepare(tls, bp+48 /* &check */, ts+26968 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+26983 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zTab)) if pStmt != 0 { nAux = (Xsqlite3_column_count(tls, pStmt) - 2) Xsqlite3_finalize(tls, pStmt) } - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).Frc = SQLITE_OK + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = SQLITE_OK } // Find number of dimensions in the rtree table. - pStmt = rtreeCheckPrepare(tls, bp+48 /* &check */, ts+24788 /* "SELECT * FROM %Q..." */, libc.VaList(bp+24, zDb, zTab)) + pStmt = rtreeCheckPrepare(tls, bp+32 /* &check */, ts+24803 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, zDb, zTab)) if pStmt != 0 { var rc int32 - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) - if (*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).FnDim < 1 { - rtreeCheckAppendMsg(tls, bp+48 /* &check */, ts+26996 /* "Schema corrupt o..." */, 0) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FnDim = (((Xsqlite3_column_count(tls, pStmt) - 1) - nAux) / 2) + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim < 1 { + rtreeCheckAppendMsg(tls, bp+32 /* &check */, ts+27011 /* "Schema corrupt o..." */, 0) } else if SQLITE_ROW == Xsqlite3_step(tls, pStmt) { - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FbInt = (libc.Bool32(Xsqlite3_column_type(tls, pStmt, 1) == SQLITE_INTEGER)) } rc = Xsqlite3_finalize(tls, pStmt) if rc != SQLITE_CORRUPT { - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).Frc = rc + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } } // Do the actual integrity-check - if (*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).FnDim >= 1 { - if (*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).Frc == SQLITE_OK { - rtreeCheckNode(tls, bp+48 /* &check */, 0, uintptr(0), int64(1)) + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnDim >= 1 { + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { + rtreeCheckNode(tls, bp+32 /* &check */, 0, uintptr(0), int64(1)) } - rtreeCheckCount(tls, bp+48 /* &check */, ts+27027 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).FnLeaf)) - rtreeCheckCount(tls, bp+48 /* &check */, ts+27034 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).FnNonLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+27042 /* "_rowid" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnLeaf)) + rtreeCheckCount(tls, bp+32 /* &check */, ts+27049 /* "_parent" */, int64((*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FnNonLeaf)) } // Finalize SQL statements used by the integrity-check - Xsqlite3_finalize(tls, (*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).FpGetNode) - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((bp + 48 /* &check */ + 40 /* &.aCheckMapping */)))) - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((bp + 48 /* &check */ + 40 /* &.aCheckMapping */) + 1*8))) + Xsqlite3_finalize(tls, (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).FpGetNode) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((bp + 32 /* &check */ + 40 /* &.aCheckMapping */)))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer((bp + 32 /* &check */ + 40 /* &.aCheckMapping */) + 1*8))) // If one was opened, close the transaction if bEnd != 0 { - var rc int32 = Xsqlite3_exec(tls, db, ts+27042 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) - if (*RtreeCheck)(unsafe.Pointer(bp+48 /* &check */)).Frc == SQLITE_OK { - (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).Frc = rc + var rc int32 = Xsqlite3_exec(tls, db, ts+27057 /* "END" */, uintptr(0), uintptr(0), uintptr(0)) + if (*RtreeCheck)(unsafe.Pointer(bp+32 /* &check */)).Frc == SQLITE_OK { + (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc = rc } } - *(*uintptr)(unsafe.Pointer(pzReport)) = (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).FzReport - return (*RtreeCheck)(unsafe.Pointer(bp + 48 /* &check */)).Frc + *(*uintptr)(unsafe.Pointer(pzReport)) = (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).FzReport + return (*RtreeCheck)(unsafe.Pointer(bp + 32 /* &check */)).Frc } // Usage: @@ -201447,7 +201955,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if (nArg != 1) && (nArg != 2) { Xsqlite3_result_error(tls, ctx, - ts+27046 /* "wrong number of ..." */, -1) + ts+27061 /* "wrong number of ..." */, -1) } else { var rc int32 *(*uintptr)(unsafe.Pointer(bp /* zReport */)) = uintptr(0) @@ -201455,7 +201963,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli var zTab uintptr if nArg == 1 { zTab = zDb - zDb = ts + 6805 /* "main" */ + zDb = ts + 6820 /* "main" */ } else { zTab = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + 1*8))) } @@ -201465,7 +201973,7 @@ func rtreecheck(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* sqli if *(*uintptr)(unsafe.Pointer(bp /* zReport */)) != 0 { return *(*uintptr)(unsafe.Pointer(bp /* zReport */)) } - return ts + 17700 /* "ok" */ + return ts + 17715 /* "ok" */ }(), -1, libc.UintptrFromInt32(-1)) } else { Xsqlite3_result_error_code(tls, ctx, rc) @@ -201894,19 +202402,19 @@ func geopolyBlobFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { // Interpret X as a polygon and render it as a JSON array // of coordinates. Or, if X is not a valid polygon, return NULL. func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197024:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) var p uintptr = geopolyFuncParam(tls, context, *(*uintptr)(unsafe.Pointer(argv)), uintptr(0)) if p != 0 { var db uintptr = Xsqlite3_context_db_handle(tls, context) var x uintptr = Xsqlite3_str_new(tls, db) var i int32 - Xsqlite3_str_append(tls, x, ts+27097 /* "[" */, 1) + Xsqlite3_str_append(tls, x, ts+27112 /* "[" */, 1) for i = 0; i < (*GeoPoly)(unsafe.Pointer(p)).FnVertex; i++ { - Xsqlite3_str_appendf(tls, x, ts+27099 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) + Xsqlite3_str_appendf(tls, x, ts+27114 /* "[%!g,%!g]," */, libc.VaList(bp, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr(((i)*2))*4))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((((i)*2)+1))*4))))) } - Xsqlite3_str_appendf(tls, x, ts+27110 /* "[%!g,%!g]]" */, libc.VaList(bp+24, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) + Xsqlite3_str_appendf(tls, x, ts+27125 /* "[%!g,%!g]]" */, libc.VaList(bp+16, float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */)))), float64(*(*GeoCoord)(unsafe.Pointer((p + 8 /* &.a */) + 1*4))))) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -201917,8 +202425,8 @@ func geopolyJsonFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { // Interpret X as a polygon and render it as a SVG . // Additional arguments are added as attributes to the . func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:197050:13: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(48) + defer tls.Free(48) var p uintptr if argc < 1 { @@ -201930,19 +202438,19 @@ func geopolySvgFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { var x uintptr = Xsqlite3_str_new(tls, db) var i int32 var cSep int8 = int8('\'') - Xsqlite3_str_appendf(tls, x, ts+27121 /* "" */, 0) + Xsqlite3_str_appendf(tls, x, ts+27174 /* ">" */, 0) Xsqlite3_result_text(tls, context, Xsqlite3_str_finish(tls, x), -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) Xsqlite3_free(tls, p) } @@ -202919,8 +203427,8 @@ func geopolyDebugFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) // argv[2] -> table name // argv[...] -> column names... func geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr, isCreate int32) int32 { /* sqlite3.c:197867:12: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(32) + defer tls.Free(32) var rc int32 var pRtree uintptr @@ -202958,7 +203466,7 @@ __1: // that is successful, call sqlite3_declare_vtab() to configure // the r-tree table schema. pSql = Xsqlite3_str_new(tls, db) - Xsqlite3_str_appendf(tls, pSql, ts+27172 /* "CREATE TABLE x(_..." */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+27187 /* "CREATE TABLE x(_..." */, 0) (*Rtree)(unsafe.Pointer(pRtree)).FnAux = U8(1) // Add one for _shape (*Rtree)(unsafe.Pointer(pRtree)).FnAuxNotNull = U8(1) // The _shape column is always not-null ii = 3 @@ -202967,7 +203475,7 @@ __2: goto __4 } (*Rtree)(unsafe.Pointer(pRtree)).FnAux++ - Xsqlite3_str_appendf(tls, pSql, ts+27194 /* ",%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) + Xsqlite3_str_appendf(tls, pSql, ts+27209 /* ",%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))) goto __3 __3: ii++ @@ -202975,7 +203483,7 @@ __3: goto __4 __4: ; - Xsqlite3_str_appendf(tls, pSql, ts+26261 /* ");" */, 0) + Xsqlite3_str_appendf(tls, pSql, ts+26276 /* ");" */, 0) zSql = Xsqlite3_str_finish(tls, pSql) if !(!(zSql != 0)) { goto __5 @@ -202986,7 +203494,7 @@ __5: if !(SQLITE_OK != (libc.AssignInt32(&rc, Xsqlite3_declare_vtab(tls, db, zSql)))) { goto __7 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+32, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+16, Xsqlite3_errmsg(tls, db))) __7: ; __6: @@ -203012,7 +203520,7 @@ __9: if !(rc != 0) { goto __10 } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+48, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+24, Xsqlite3_errmsg(tls, db))) goto geopolyInit_fail __10: ; @@ -203245,7 +203753,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s if iRowidTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 16110 /* "rowid" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 16125 /* "rowid" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 30.0 @@ -203255,7 +203763,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s } if iFuncTerm >= 0 { (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 27198 /* "rtree" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 27213 /* "rtree" */ (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).FargvIndex = 1 (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iFuncTerm)*8)).Fomit = uint8(0) (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 300.0 @@ -203263,7 +203771,7 @@ func geopolyBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* s return SQLITE_OK } (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 4 - (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 27204 /* "fullscan" */ + (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = ts + 27219 /* "fullscan" */ (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3000000.0 (*Sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100000) return SQLITE_OK @@ -203401,7 +203909,7 @@ __1: if !(*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_ERROR) { goto __4 } - (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+27213 /* "_shape does not ..." */, 0) + (*Sqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, ts+27228 /* "_shape does not ..." */, 0) __4: ; goto geopoly_update_end @@ -203546,14 +204054,14 @@ geopoly_update_end: // Report that geopoly_overlap() is an overloaded function suitable // for use in xBestIndex. func geopolyFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* sqlite3.c:198361:12: */ - if Xsqlite3_stricmp(tls, zName, ts+27253 /* "geopoly_overlap" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+27268 /* "geopoly_overlap" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyOverlapFunc})) *(*uintptr)(unsafe.Pointer(ppArg)) = uintptr(0) return SQLITE_INDEX_CONSTRAINT_FUNCTION } - if Xsqlite3_stricmp(tls, zName, ts+27269 /* "geopoly_within" */) == 0 { + if Xsqlite3_stricmp(tls, zName, ts+27284 /* "geopoly_within" */) == 0 { *(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{geopolyWithinFunc})) @@ -203618,7 +204126,7 @@ func sqlite3_geopoly_init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198409 uintptr(0), aAgg1[i].FxStep, aAgg1[i].FxFinal) } if rc == SQLITE_OK { - rc = Xsqlite3_create_module_v2(tls, db, ts+27284 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+27299 /* "geopoly" */, uintptr(unsafe.Pointer(&geopolyModule)), uintptr(0), uintptr(0)) } return rc } @@ -203630,25 +204138,25 @@ var aFunc1 = [12]struct { _ [6]byte FzName uintptr }{ - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27292 /* "geopoly_area" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27305 /* "geopoly_blob" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27318 /* "geopoly_json" */}, - {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 27331 /* "geopoly_svg" */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 27269 /* "geopoly_within" */}, - {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 27343 /* "geopoly_contains..." */}, - {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 27253 /* "geopoly_overlap" */}, - {FxFunc: 0, FnArg: int8(1), FzName: ts + 27366 /* "geopoly_debug" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27380 /* "geopoly_bbox" */}, - {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 27393 /* "geopoly_xform" */}, - {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 27407 /* "geopoly_regular" */}, - {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27423 /* "geopoly_ccw" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27307 /* "geopoly_area" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27320 /* "geopoly_blob" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27333 /* "geopoly_json" */}, + {FxFunc: 0, FnArg: int8(-1), FbPure: uint8(1), FzName: ts + 27346 /* "geopoly_svg" */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 27284 /* "geopoly_within" */}, + {FxFunc: 0, FnArg: int8(3), FbPure: uint8(1), FzName: ts + 27358 /* "geopoly_contains..." */}, + {FxFunc: 0, FnArg: int8(2), FbPure: uint8(1), FzName: ts + 27268 /* "geopoly_overlap" */}, + {FxFunc: 0, FnArg: int8(1), FzName: ts + 27381 /* "geopoly_debug" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27395 /* "geopoly_bbox" */}, + {FxFunc: 0, FnArg: int8(7), FbPure: uint8(1), FzName: ts + 27408 /* "geopoly_xform" */}, + {FxFunc: 0, FnArg: int8(4), FbPure: uint8(1), FzName: ts + 27422 /* "geopoly_regular" */}, + {FxFunc: 0, FnArg: int8(1), FbPure: uint8(1), FzName: ts + 27438 /* "geopoly_ccw" */}, } /* sqlite3.c:198416:5 */ var aAgg1 = [1]struct { FxStep uintptr FxFinal uintptr FzName uintptr }{ - {FxStep: 0, FxFinal: 0, FzName: ts + 27435 /* "geopoly_group_bb..." */}, + {FxStep: 0, FxFinal: 0, FzName: ts + 27450 /* "geopoly_group_bb..." */}, } /* sqlite3.c:198434:5 */ //************* End of geopoly.c ******************************************** @@ -203661,26 +204169,26 @@ func Xsqlite3RtreeInit(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:198469:20 var utf8 int32 = SQLITE_UTF8 var rc int32 - rc = Xsqlite3_create_function(tls, db, ts+27454 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+27469 /* "rtreenode" */, 2, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreenode})), uintptr(0), uintptr(0)) if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+27464 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+27479 /* "rtreedepth" */, 1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreedepth})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_create_function(tls, db, ts+27475 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + rc = Xsqlite3_create_function(tls, db, ts+27490 /* "rtreecheck" */, -1, utf8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rtreecheck})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_REAL32) - rc = Xsqlite3_create_module_v2(tls, db, ts+27198 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+27213 /* "rtree" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { var c uintptr = uintptr(RTREE_COORD_INT32) - rc = Xsqlite3_create_module_v2(tls, db, ts+27486 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) + rc = Xsqlite3_create_module_v2(tls, db, ts+27501 /* "rtree_i32" */, uintptr(unsafe.Pointer(&rtreeModule)), c, uintptr(0)) } if rc == SQLITE_OK { rc = sqlite3_geopoly_init(tls, db) @@ -203752,7 +204260,7 @@ func geomCallback(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* sql Xsqlite3_result_error_nomem(tls, ctx) rtreeMatchArgFree(tls, pBlob) } else { - Xsqlite3_result_pointer(tls, ctx, pBlob, ts+24774 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) + Xsqlite3_result_pointer(tls, ctx, pBlob, ts+24789 /* "RtreeMatchArg" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{rtreeMatchArgFree}))) } } } @@ -205043,7 +205551,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // Figure out the size of the output nOut = rbuDeltaOutputSize(tls, aDelta, nDelta) if nOut < 0 { - Xsqlite3_result_error(tls, context, ts+27496 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+27511 /* "corrupt fossil d..." */, -1) return } @@ -205054,7 +205562,7 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr nOut2 = rbuDeltaApply(tls, aOrig, nOrig, aDelta, nDelta, aOut) if nOut2 != nOut { Xsqlite3_free(tls, aOut) - Xsqlite3_result_error(tls, context, ts+27496 /* "corrupt fossil d..." */, -1) + Xsqlite3_result_error(tls, context, ts+27511 /* "corrupt fossil d..." */, -1) } else { Xsqlite3_result_blob(tls, context, aOut, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) } @@ -205070,12 +205578,12 @@ func rbuFossilDeltaFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr // point to a buffer containing an error message. It is the responsibility // of the caller to (eventually) free this buffer using sqlite3_free(). func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) int32 { /* sqlite3.c:200791:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) } return rc @@ -205088,12 +205596,12 @@ func prepareAndCollectError(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg // containing an error message. It is the responsibility of the caller // to eventually free this buffer using sqlite3_free(). func resetAndCollectError(tls *libc.TLS, pStmt uintptr, pzErrmsg uintptr) int32 { /* sqlite3.c:200813:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = Xsqlite3_reset(tls, pStmt) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) + *(*uintptr)(unsafe.Pointer(pzErrmsg)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, Xsqlite3_db_handle(tls, pStmt)))) } return rc } @@ -205197,7 +205705,7 @@ func rbuObjIterNext(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3. if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+27517 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + ts+27532 /* "DROP TRIGGER IF ..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if rc == SQLITE_OK { @@ -205281,7 +205789,7 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { Xsqlite3_result_text(tls, pCtx, zIn, -1, uintptr(0)) } } else { - if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+24687 /* "data" */, zIn, uint64(4)) == 0) { + if (libc.Xstrlen(tls, zIn) > uint64(4)) && (libc.Xmemcmp(tls, ts+24702 /* "data" */, zIn, uint64(4)) == 0) { var i int32 for i = 4; (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) <= '9'); i++ { } @@ -205300,8 +205808,8 @@ func rbuTargetNameFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { // left in the RBU handle passed as the first argument. A copy of the // error code is returned. func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:201042:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 libc.Xmemset(tls, pIter, 0, uint64(unsafe.Sizeof(RbuObjIter{}))) @@ -205309,17 +205817,17 @@ func rbuObjIterFirst(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3 rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter /* &.pTblIter */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+27688 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { + ts+27703 /* "SELECT rbu_targe..." */, libc.VaList(bp, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 27838 /* "AND rootpage!=0 ..." */ + return ts + 27853 /* "AND rootpage!=0 ..." */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }()))) if rc == SQLITE_OK { rc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 8 /* &.pIdxIter */), (p + 64 /* &.zErrmsg */), - ts+27879 /* "SELECT name, roo..." */) + ts+27894 /* "SELECT name, roo..." */) } (*RbuObjIter)(unsafe.Pointer(pIter)).FbCleanup = 1 @@ -205450,14 +205958,14 @@ func rbuStrndup(tls *libc.TLS, zStr uintptr, pRc uintptr) uintptr { /* sqlite3.c // rbu handle error code is not already set, set the error code and error // message accordingly. func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var db uintptr = Xsqlite3_db_handle(tls, pStmt) var rc int32 = Xsqlite3_finalize(tls, pStmt) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (rc != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, db))) } } @@ -205500,45 +206008,45 @@ func rbuFinalize(tls *libc.TLS, p uintptr, pStmt uintptr) { /* sqlite3.c:201199: // return RBU_PK_NONE // } func rbuTableType(tls *libc.TLS, p uintptr, zTab uintptr, peType uintptr, piTnum uintptr, piPk uintptr) { /* sqlite3.c:201247:13: */ - bp := tls.Alloc(96) - defer tls.Free(96) + bp := tls.Alloc(64) + defer tls.Free(64) // 0) SELECT count(*) FROM sqlite_schema where name=%Q AND IsVirtual(%Q) // 1) PRAGMA index_list = ? // 2) SELECT count(*) FROM sqlite_schema where name=%Q // 3) PRAGMA table_info = ? - // var aStmt [4]uintptr at bp+64, 32 + // var aStmt [4]uintptr at bp+32, 32 var zOrig uintptr var zIdx uintptr var i uint32 - *(*[4]uintptr)(unsafe.Pointer(bp + 64 /* aStmt */)) = [4]uintptr{uintptr(0), uintptr(0), uintptr(0), uintptr(0)} + *(*[4]uintptr)(unsafe.Pointer(bp + 32 /* aStmt */)) = [4]uintptr{uintptr(0), uintptr(0), uintptr(0), uintptr(0)} *(*int32)(unsafe.Pointer(peType)) = RBU_PK_NOTABLE *(*int32)(unsafe.Pointer(piPk)) = 0 - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 64 /* &aStmt */), (p + 64 /* &.zErrmsg */), + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+28004 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) - if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */))) != SQLITE_ROW)) { + ts+28019 /* "SELECT (sql LIKE..." */, libc.VaList(bp, zTab))) + if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK) || (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */))) != SQLITE_ROW)) { goto __1 } // Either an error, or no such table. goto rbuTableType_end __1: ; - if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */)), 0) != 0) { + if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 0) != 0) { goto __2 } *(*int32)(unsafe.Pointer(peType)) = RBU_PK_VTAB // virtual table goto rbuTableType_end __2: ; - *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */)), 1) + *(*int32)(unsafe.Pointer(piTnum)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */)), 1) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 64 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28085 /* "PRAGMA index_lis..." */, libc.VaList(bp+16, zTab))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 1*8), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28100 /* "PRAGMA index_lis..." */, libc.VaList(bp+8, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0) { goto __3 } @@ -205546,24 +206054,24 @@ __2: __3: ; __4: - if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 1*8))) == SQLITE_ROW) { + if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 1*8))) == SQLITE_ROW) { goto __5 } - zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 1*8)), 3) - zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 1*8)), 1) + zOrig = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 1*8)), 3) + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 1*8)), 1) if !(((zOrig != 0) && (zIdx != 0)) && (int32(*(*U8)(unsafe.Pointer(zOrig))) == 'p')) { goto __6 } - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 64 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 2*8), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+28106 /* "SELECT rootpage ..." */, libc.VaList(bp+32, zIdx))) + ts+28121 /* "SELECT rootpage ..." */, libc.VaList(bp+16, zIdx))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __7 } - if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 2*8))) == SQLITE_ROW) { + if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 2*8))) == SQLITE_ROW) { goto __8 } - *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 2*8)), 0) + *(*int32)(unsafe.Pointer(piPk)) = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 2*8)), 0) *(*int32)(unsafe.Pointer(peType)) = RBU_PK_EXTERNAL goto __9 __8: @@ -205579,16 +206087,16 @@ __6: __5: ; - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 64 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28157 /* "PRAGMA table_inf..." */, libc.VaList(bp+48, zTab))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (bp + 32 /* &aStmt */ + 3*8), (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28172 /* "PRAGMA table_inf..." */, libc.VaList(bp+24, zTab))) if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __10 } __11: - if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 3*8))) == SQLITE_ROW) { + if !(Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 3*8))) == SQLITE_ROW) { goto __12 } - if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + 3*8)), 5) > 0) { + if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + 3*8)), 5) > 0) { goto __13 } *(*int32)(unsafe.Pointer(peType)) = RBU_PK_IPK // explicit IPK column @@ -205608,7 +206116,7 @@ __14: if !(uint64(i) < (uint64(unsafe.Sizeof([4]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))) { goto __16 } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* &aStmt[0] */ + uintptr(i)*8))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 32 /* &aStmt[0] */ + uintptr(i)*8))) goto __15 __15: i++ @@ -205620,33 +206128,33 @@ __16: // This is a helper function for rbuObjIterCacheTableInfo(). It populates // the pIter->abIndexed[] array. func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:201331:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) - *(*uintptr)(unsafe.Pointer(bp + 32 /* pList */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)) = uintptr(0) var bIndex int32 = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { libc.Xmemcpy(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, (*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+32 /* &pList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28178 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+16 /* &pList */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28193 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex = 0 - for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pList */)))) { - var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pList */)), 1) - var bPartial int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pList */)), 4) - *(*uintptr)(unsafe.Pointer(bp + 40 /* pXInfo */)) = uintptr(0) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)))) { + var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)), 1) + var bPartial int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */)), 4) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)) = uintptr(0) if zIdx == uintptr(0) { break } if bPartial != 0 { libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) } - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+40 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28206 /* "PRAGMA main.inde..." */, libc.VaList(bp+16, zIdx))) - for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pXInfo */)))) { - var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pXInfo */)), 1) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+24 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28221 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)))) { + var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */)), 1) if iCid >= 0 { *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(iCid))) = U8(1) } @@ -205654,7 +206162,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq libc.Xmemset(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed, 0x01, (uint64(unsafe.Sizeof(U8(0))) * uint64((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol))) } } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 40 /* pXInfo */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pXInfo */))) bIndex = 1 (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex++ } @@ -205664,7 +206172,7 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq (*RbuObjIter)(unsafe.Pointer(pIter)).FnIndex-- } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 32 /* pList */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* pList */))) if bIndex == 0 { (*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed = uintptr(0) } @@ -205678,64 +206186,64 @@ func rbuObjIterCacheIndexedCols(tls *libc.TLS, p uintptr, pIter uintptr) { /* sq // an error does occur, an error code and error message are also left in // the RBU handle. func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { /* sqlite3.c:201385:12: */ - bp := tls.Alloc(112) - defer tls.Free(112) + bp := tls.Alloc(72) + defer tls.Free(72) if (*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol == uintptr(0) { - *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) = uintptr(0) var nCol int32 = 0 var i int32 // for() loop iterator variable var bRbuRowid int32 = 0 // If input table has column "rbu_rowid" var iOrder int32 = 0 - *(*int32)(unsafe.Pointer(bp + 96 /* iTnum */)) = 0 + *(*int32)(unsafe.Pointer(bp + 56 /* iTnum */)) = 0 // Figure out the type of table this step will deal with. - rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+96 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) + rbuTableType(tls, p, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, (pIter + 72 /* &.eType */), bp+56 /* &iTnum */, (pIter + 108 /* &.iPkTnum */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NOTABLE) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+19221 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+19236 /* "no such table: %..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).Frc } if (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0) { - (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum = *(*int32)(unsafe.Pointer(bp + 96 /* iTnum */)) + (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum = *(*int32)(unsafe.Pointer(bp + 56 /* iTnum */)) } // Populate the azTblCol[] and nTblCol variables based on the columns // of the input table. Ignore any input table columns that begin with // "rbu_". - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+104 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28235 /* "SELECT * FROM '%..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28250 /* "SELECT * FROM '%..." */, libc.VaList(bp+8, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl))) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */))) + nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) rbuAllocateIterArrays(tls, p, pIter, nCol) } for i = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (i < nCol); i++ { - var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)), i) - if Xsqlite3_strnicmp(tls, ts+28254 /* "rbu_" */, zName, 4) != 0 { + var zName uintptr = Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), i) + if Xsqlite3_strnicmp(tls, ts+28269 /* "rbu_" */, zName, 4) != 0 { var zCopy uintptr = rbuStrndup(tls, zName, (p + 56 /* &.rc */)) *(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol)*4)) = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(libc.PostIncInt32(&(*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol, 1))*8)) = zCopy - } else if 0 == Xsqlite3_stricmp(tls, ts+28259 /* "rbu_rowid" */, zName) { + } else if 0 == Xsqlite3_stricmp(tls, ts+28274 /* "rbu_rowid" */, zName) { bRbuRowid = 1 } } - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */))) - *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)) = uintptr(0) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) = uintptr(0) if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0)) && (bRbuRowid != (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE)))) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, - ts+28269 /* "table %q %s rbu_..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+28284 /* "table %q %s rbu_..." */, libc.VaList(bp+16, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if bRbuRowid != 0 { - return ts + 28298 /* "may not have" */ + return ts + 28313 /* "may not have" */ } - return ts + 28311 /* "requires" */ + return ts + 28326 /* "requires" */ }())) } @@ -205743,11 +206251,11 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // present in the input table. Populate the abTblPk[], azTblType[] and // aiTblOrder[] arrays at the same time. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+104 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28320 /* "PRAGMA table_inf..." */, libc.VaList(bp+56, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pStmt */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28335 /* "PRAGMA table_inf..." */, libc.VaList(bp+32, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) } - for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)))) { - var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)), 1) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) { + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 1) if zName == uintptr(0) { break } // An OOM - finalize() below returns S_NOMEM @@ -205758,12 +206266,12 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } if i == (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28342, /* "column missing f..." */ - libc.VaList(bp+72, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28357, /* "column missing f..." */ + libc.VaList(bp+40, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zName)) } else { - var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)), 5) - var bNotNull int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)), 3) - var zType uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)), 2) + var iPk int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 5) + var bNotNull int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 3) + var zType uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 2) if i != iOrder { { @@ -205788,7 +206296,7 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / } } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) rbuObjIterCacheIndexedCols(tls, p, pIter) } @@ -205800,16 +206308,16 @@ func rbuObjIterCacheTableInfo(tls *libc.TLS, p uintptr, pIter uintptr) int32 { / // string containing some SQL clause or list based on one or more of the // column names currently stored in the pIter->azTblCol[] array. func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:201495:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var zList uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var z uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+28369 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) - zSep = ts + 14676 /* ", " */ + zList = rbuMPrintf(tls, p, ts+28384 /* "%z%s\"%w\"" */, libc.VaList(bp, zList, zSep, z)) + zSep = ts + 14691 /* ", " */ } return zList } @@ -205819,18 +206327,18 @@ func rbuObjIterGetCollist(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* // zPre. After each column name, add the zPost text. Use zSeparator as // the separator text (usually ", "). func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, zSeparator uintptr, zPost uintptr) uintptr { /* sqlite3.c:201516:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(40) + defer tls.Free(40) var iPk int32 = 1 var zRet uintptr = uintptr(0) - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for 1 != 0 { var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if int32(*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i)))) == iPk { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zRet = rbuMPrintf(tls, p, ts+28378 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) + zRet = rbuMPrintf(tls, p, ts+28393 /* "%z%s%s\"%w\"%s" */, libc.VaList(bp, zRet, zSep, zPre, zCol, zPost)) zSep = zSeparator break } @@ -205861,35 +206369,35 @@ func rbuObjIterGetPkList(tls *libc.TLS, p uintptr, pIter uintptr, zPre uintptr, // Instead of "?" placeholders, the actual WHERE clauses created by // this function contain literal SQL values. func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, zWrite uintptr) uintptr { /* sqlite3.c:201561:13: */ - bp := tls.Alloc(112) - defer tls.Free(112) + bp := tls.Alloc(80) + defer tls.Free(80) - *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)) = uintptr(0) var zRet uintptr = uintptr(0) if bRowid != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+104 /* &pMax */, (p + 64 /* &.zErrmsg */), + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+28391 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) - if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */)))) { - var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+28423 /* " WHERE _rowid_ >..." */, libc.VaList(bp+24, iMax)) + ts+28406 /* "SELECT max(_rowi..." */, libc.VaList(bp, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { + var iMax Sqlite3_int64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) + zRet = rbuMPrintf(tls, p, ts+28438 /* " WHERE _rowid_ >..." */, libc.VaList(bp+16, iMax)) } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } else { - var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+14676 /* ", " */, ts+28446 /* " DESC" */) - var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+28452 /* "quote(" */, ts+28459 /* "||','||" */, ts+5413 /* ")" */) - var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+14676 /* ", " */, ts+740 /* "" */) + var zOrder uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+14691 /* ", " */, ts+28461 /* " DESC" */) + var zSelect uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+28467 /* "quote(" */, ts+28474 /* "||','||" */, ts+5428 /* ")" */) + var zList uintptr = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+14691 /* ", " */, ts+755 /* "" */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+104 /* &pMax */, (p + 64 /* &.zErrmsg */), + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+72 /* &pMax */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+28467, /* "SELECT %s FROM \"..." */ - libc.VaList(bp+40, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) - if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */)))) { - var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */)), 0) - zRet = rbuMPrintf(tls, p, ts+28509 /* " WHERE (%s) > (%..." */, libc.VaList(bp+80, zList, zVal)) + ts+28482, /* "SELECT %s FROM \"..." */ + libc.VaList(bp+24, zSelect, zWrite, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)))) { + var zVal uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */)), 0) + zRet = rbuMPrintf(tls, p, ts+28524 /* " WHERE (%s) > (%..." */, libc.VaList(bp+56, zList, zVal)) } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 104 /* pMax */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 72 /* pMax */))) } Xsqlite3_free(tls, zOrder) @@ -205920,8 +206428,8 @@ func rbuVacuumTableStart(tls *libc.TLS, p uintptr, pIter uintptr, bRowid int32, // the caller has to use an OFFSET clause to extract only the required // rows from the sourct table, just as it does for an RBU update operation. func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:201628:6: */ - bp := tls.Alloc(248) - defer tls.Free(248) + bp := tls.Alloc(192) + defer tls.Free(192) var zOrder uintptr var zLhs uintptr @@ -205931,33 +206439,33 @@ func XrbuVacuumIndexStart(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* var bFailed int32 var zSep uintptr var iCol int32 - // var pXInfo uintptr at bp+232, 8 + // var pXInfo uintptr at bp+176, 8 var i int32 var iCid int32 var zCollate uintptr var zCol uintptr var zQuoted uintptr - // var pSel uintptr at bp+240, 8 + // var pSel uintptr at bp+184, 8 zOrder = uintptr(0) zLhs = uintptr(0) zSelect = uintptr(0) zVector = uintptr(0) zRet = uintptr(0) bFailed = 0 - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 - *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+232 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28206 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28221 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) __1: - if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */))))) { + if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))))) { goto __2 } - iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 1) - zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 4) - if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 3) != 0) { + iCid = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) + zCollate = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) + if !(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) != 0) { goto __3 } bFailed = 1 @@ -205987,7 +206495,7 @@ __10: zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) goto __7 __6: - zCol = ts + 28529 /* "_rowid_" */ + zCol = ts + 28544 /* "_rowid_" */ __7: ; goto __5 @@ -205996,18 +206504,18 @@ __4: __5: ; - zLhs = rbuMPrintf(tls, p, ts+28537, /* "%z%s \"%w\" COLLAT..." */ - libc.VaList(bp+16, zLhs, zSep, zCol, zCollate)) - zOrder = rbuMPrintf(tls, p, ts+28558, /* "%z%s \"rbu_imp_%d..." */ - libc.VaList(bp+56, zOrder, zSep, iCol, zCol, zCollate)) - zSelect = rbuMPrintf(tls, p, ts+28594, /* "%z%s quote(\"rbu_..." */ - libc.VaList(bp+104, zSelect, zSep, iCol, zCol)) - zSep = ts + 14676 /* ", " */ + zLhs = rbuMPrintf(tls, p, ts+28552, /* "%z%s \"%w\" COLLAT..." */ + libc.VaList(bp+8, zLhs, zSep, zCol, zCollate)) + zOrder = rbuMPrintf(tls, p, ts+28573, /* "%z%s \"rbu_imp_%d..." */ + libc.VaList(bp+40, zOrder, zSep, iCol, zCol, zCollate)) + zSelect = rbuMPrintf(tls, p, ts+28609, /* "%z%s quote(\"rbu_..." */ + libc.VaList(bp+80, zSelect, zSep, iCol, zCol)) + zSep = ts + 14691 /* ", " */ iCol++ goto __1 __2: ; - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) if !(bFailed != 0) { goto __11 } @@ -206018,21 +206526,21 @@ __11: if !((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { goto __12 } - *(*uintptr)(unsafe.Pointer(bp + 240 /* pSel */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+240 /* &pSel */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28621, /* "SELECT %s FROM \"..." */ - libc.VaList(bp+144, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) - if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 240 /* pSel */))))) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+184 /* &pSel */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28636, /* "SELECT %s FROM \"..." */ + libc.VaList(bp+112, zSelect, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zOrder))) + if !(((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))))) { goto __13 } - zSep = ts + 740 /* "" */ + zSep = ts + 755 /* "" */ iCol = 0 __14: if !(iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol) { goto __16 } - zQuoted = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 240 /* pSel */)), iCol) + zQuoted = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */)), iCol) if !(zQuoted == uintptr(0)) { goto __17 } @@ -206048,8 +206556,8 @@ __19: ; __18: ; - zVector = rbuMPrintf(tls, p, ts+28669 /* "%z%s%s" */, libc.VaList(bp+176, zVector, zSep, zQuoted)) - zSep = ts + 14676 /* ", " */ + zVector = rbuMPrintf(tls, p, ts+28684 /* "%z%s%s" */, libc.VaList(bp+136, zVector, zSep, zQuoted)) + zSep = ts + 14691 /* ", " */ goto __15 __15: iCol++ @@ -206061,12 +206569,12 @@ __16: if !(!(bFailed != 0)) { goto __20 } - zRet = rbuMPrintf(tls, p, ts+28676 /* "(%s) > (%s)" */, libc.VaList(bp+208, zLhs, zVector)) + zRet = rbuMPrintf(tls, p, ts+28691 /* "(%s) > (%s)" */, libc.VaList(bp+160, zLhs, zVector)) __20: ; __13: ; - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 240 /* pSel */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 184 /* pSel */))) __12: ; @@ -206101,8 +206609,8 @@ index_start_out: // pzImposterPk: ... // pzWhere: ... func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterCols uintptr, pzImposterPk uintptr, pzWhere uintptr, pnBind uintptr) uintptr { /* sqlite3.c:201743:13: */ - bp := tls.Alloc(256) - defer tls.Free(256) + bp := tls.Alloc(208) + defer tls.Free(208) var rc int32 = (*Sqlite3rbu)(unsafe.Pointer(p)).Frc // Error code var rc2 int32 // sqlite3_finalize() return code @@ -206111,28 +206619,28 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC var zImpPK uintptr = uintptr(0) // String to return via *pzImposterPK var zWhere uintptr = uintptr(0) // String to return via *pzWhere var nBind int32 = 0 // Value to return via *pnBind - var zCom uintptr = ts + 740 /* "" */ // Set to ", " later on - var zAnd uintptr = ts + 740 /* "" */ // Set to " AND " later on - *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? + var zCom uintptr = ts + 755 /* "" */ // Set to ", " later on + var zAnd uintptr = ts + 755 /* "" */ // Set to " AND " later on + *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = ? if rc == SQLITE_OK { - rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+248 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28206 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) + rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+200 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28221 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx))) } - for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)))) { - var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)), 1) - var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)), 3) - var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)), 4) + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)))) { + var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 1) + var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 3) + var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 4) var zCol uintptr = uintptr(0) var zType uintptr if iCid == -2 { - var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)), 0) - zRet = Xsqlite3_mprintf(tls, ts+28688 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+16, zRet, zCom, + var iSeq int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 0) + zRet = Xsqlite3_mprintf(tls, ts+28703 /* "%z%s(%.*s) COLLA..." */, libc.VaList(bp+8, zRet, zCom, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FnSpan, (*RbuSpan)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaIdxCol+uintptr(iSeq)*16)).FzSpan, zCollate)) - zType = ts + 740 /* "" */ + zType = ts + 755 /* "" */ } else { if iCid < 0 { // An integer primary key. If the table has an explicit IPK, use @@ -206144,41 +206652,41 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) } else if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zCol = ts + 28529 /* "_rowid_" */ + zCol = ts + 28544 /* "_rowid_" */ } else { - zCol = ts + 28259 /* "rbu_rowid" */ + zCol = ts + 28274 /* "rbu_rowid" */ } - zType = ts + 12731 /* "INTEGER" */ + zType = ts + 12746 /* "INTEGER" */ } else { zCol = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCid)*8)) zType = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)) } - zRet = Xsqlite3_mprintf(tls, ts+28710 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+64, zRet, zCom, zCol, zCollate)) + zRet = Xsqlite3_mprintf(tls, ts+28725 /* "%z%s\"%w\" COLLATE..." */, libc.VaList(bp+48, zRet, zCom, zCol, zCollate)) } - if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */)), 5) != 0) { + if ((*RbuObjIter)(unsafe.Pointer(pIter)).FbUnique == 0) || (Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */)), 5) != 0) { var zOrder uintptr = func() uintptr { if bDesc != 0 { - return ts + 28446 /* " DESC" */ + return ts + 28461 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() - zImpPK = Xsqlite3_mprintf(tls, ts+28730, /* "%z%s\"rbu_imp_%d%..." */ - libc.VaList(bp+104, zImpPK, zCom, nBind, zCol, zOrder)) + zImpPK = Xsqlite3_mprintf(tls, ts+28745, /* "%z%s\"rbu_imp_%d%..." */ + libc.VaList(bp+80, zImpPK, zCom, nBind, zCol, zOrder)) } - zImpCols = Xsqlite3_mprintf(tls, ts+28751, /* "%z%s\"rbu_imp_%d%..." */ - libc.VaList(bp+152, zImpCols, zCom, nBind, zCol, zType, zCollate)) + zImpCols = Xsqlite3_mprintf(tls, ts+28766, /* "%z%s\"rbu_imp_%d%..." */ + libc.VaList(bp+120, zImpCols, zCom, nBind, zCol, zType, zCollate)) zWhere = Xsqlite3_mprintf(tls, - ts+28784 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+208, zWhere, zAnd, nBind, zCol)) + ts+28799 /* "%z%s\"rbu_imp_%d%..." */, libc.VaList(bp+168, zWhere, zAnd, nBind, zCol)) if (((zRet == uintptr(0)) || (zImpPK == uintptr(0))) || (zImpCols == uintptr(0))) || (zWhere == uintptr(0)) { rc = SQLITE_NOMEM } - zCom = ts + 14676 /* ", " */ - zAnd = ts + 21241 /* " AND " */ + zCom = ts + 14691 /* ", " */ + zAnd = ts + 21256 /* " AND " */ nBind++ } - rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 248 /* pXInfo */))) + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* pXInfo */))) if rc == SQLITE_OK { rc = rc2 } @@ -206212,21 +206720,21 @@ func rbuObjIterGetIndexCols(tls *libc.TLS, p uintptr, pIter uintptr, pzImposterC // For tables with implicit rowids - RBU_PK_EXTERNAL and RBU_PK_NONE, append // the text ", old._rowid_" to the returned value. func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) uintptr { /* sqlite3.c:201855:13: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(64) + defer tls.Free(64) var zList uintptr = uintptr(0) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zS uintptr = ts + 740 /* "" */ + var zS uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = Xsqlite3_mprintf(tls, ts+28808 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) + zList = Xsqlite3_mprintf(tls, ts+28823 /* "%z%s%s.\"%w\"" */, libc.VaList(bp, zList, zS, zObj, zCol)) } else { - zList = Xsqlite3_mprintf(tls, ts+28820 /* "%z%sNULL" */, libc.VaList(bp+40, zList, zS)) + zList = Xsqlite3_mprintf(tls, ts+28835 /* "%z%sNULL" */, libc.VaList(bp+32, zList, zS)) } - zS = ts + 14676 /* ", " */ + zS = ts + 14691 /* ", " */ if zList == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM break @@ -206235,7 +206743,7 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // For a table with implicit rowids, append "old._rowid_" to the list. if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+28829 /* "%z, %s._rowid_" */, libc.VaList(bp+64, zList, zObj)) + zList = rbuMPrintf(tls, p, ts+28844 /* "%z, %s._rowid_" */, libc.VaList(bp+48, zList, zObj)) } } return zList @@ -206250,32 +206758,32 @@ func rbuObjIterGetOldlist(tls *libc.TLS, p uintptr, pIter uintptr, zObj uintptr) // // "b = ?1 AND c = ?2" func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:201896:13: */ - bp := tls.Alloc(112) - defer tls.Free(112) + bp := tls.Alloc(80) + defer tls.Free(80) var zList uintptr = uintptr(0) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zList = rbuMPrintf(tls, p, ts+28844 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) + zList = rbuMPrintf(tls, p, ts+28859 /* "_rowid_ = ?%d" */, libc.VaList(bp, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol+1))) } else if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { - zList = rbuMPrintf(tls, p, ts+28858 /* "%z%sc%d=?%d" */, libc.VaList(bp+16, zList, zSep, i, (i+1))) - zSep = ts + 21241 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+28873 /* "%z%sc%d=?%d" */, libc.VaList(bp+8, zList, zSep, i, (i+1))) + zSep = ts + 21256 /* " AND " */ } } zList = rbuMPrintf(tls, p, - ts+28870 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+56, zList)) + ts+28885 /* "_rowid_ = (SELEC..." */, libc.VaList(bp+40, zList)) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ var i int32 for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0 { var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)) - zList = rbuMPrintf(tls, p, ts+28920 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+72, zList, zSep, zCol, (i+1))) - zSep = ts + 21241 /* " AND " */ + zList = rbuMPrintf(tls, p, ts+28935 /* "%z%s\"%w\"=?%d" */, libc.VaList(bp+48, zList, zSep, zCol, (i+1))) + zSep = ts + 21256 /* " AND " */ } } } @@ -206289,7 +206797,7 @@ func rbuObjIterGetWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sq // of the RBU handle to something reflecting this. func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28933 /* "invalid rbu_cont..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+28948 /* "invalid rbu_cont..." */, 0) } // Return a nul-terminated string containing the comma separated list of @@ -206308,8 +206816,8 @@ func rbuBadControlError(tls *libc.TLS, p uintptr) { /* sqlite3.c:201937:13: */ // when this function is called, NULL is returned immediately, without // attempting the allocation or modifying the stored error code. func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr) uintptr { /* sqlite3.c:201960:13: */ - bp := tls.Alloc(136) - defer tls.Free(136) + bp := tls.Alloc(112) + defer tls.Free(112) var zList uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -206318,21 +206826,21 @@ func rbuObjIterGetSetlist(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr if int32(libc.Xstrlen(tls, zMask)) != (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol { rbuBadControlError(tls, p) } else { - var zSep uintptr = ts + 740 /* "" */ + var zSep uintptr = ts + 755 /* "" */ for i = 0; i < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol; i++ { var c int8 = *(*int8)(unsafe.Pointer(zMask + uintptr(*(*int32)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FaiSrcOrder + uintptr(i)*4))))) if int32(c) == 'x' { - zList = rbuMPrintf(tls, p, ts+28920, /* "%z%s\"%w\"=?%d" */ + zList = rbuMPrintf(tls, p, ts+28935, /* "%z%s\"%w\"=?%d" */ libc.VaList(bp, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 14676 /* ", " */ + zSep = ts + 14691 /* ", " */ } else if int32(c) == 'd' { - zList = rbuMPrintf(tls, p, ts+28959, /* "%z%s\"%w\"=rbu_del..." */ - libc.VaList(bp+40, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 14676 /* ", " */ + zList = rbuMPrintf(tls, p, ts+28974, /* "%z%s\"%w\"=rbu_del..." */ + libc.VaList(bp+32, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) + zSep = ts + 14691 /* ", " */ } else if int32(c) == 'f' { - zList = rbuMPrintf(tls, p, ts+28989, /* "%z%s\"%w\"=rbu_fos..." */ - libc.VaList(bp+88, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) - zSep = ts + 14676 /* ", " */ + zList = rbuMPrintf(tls, p, ts+29004, /* "%z%s\"%w\"=rbu_fos..." */ + libc.VaList(bp+72, zList, zSep, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(i)*8)), (i+1))) + zSep = ts + 14691 /* ", " */ } } } @@ -206384,47 +206892,47 @@ func rbuObjIterGetBindlist(tls *libc.TLS, p uintptr, nBind int32) uintptr { /* s // // PRIMARY KEY("b", "a" DESC) func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sqlite3.c:202041:13: */ - bp := tls.Alloc(104) - defer tls.Free(104) + bp := tls.Alloc(72) + defer tls.Free(72) var z uintptr = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zSep uintptr = ts + 29026 /* "PRIMARY KEY(" */ - *(*uintptr)(unsafe.Pointer(bp + 88 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) - *(*uintptr)(unsafe.Pointer(bp + 96 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = + var zSep uintptr = ts + 29041 /* "PRIMARY KEY(" */ + *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)) = uintptr(0) // PRAGMA index_list = (pIter->zTbl) + *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)) = uintptr(0) // PRAGMA index_xinfo = - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+88 /* &pXList */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28178 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) - for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pXList */)))) { - var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pXList */)), 3) - if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+16020 /* "pk" */) == 0) { - var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pXList */)), 1) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+56 /* &pXList */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28193 /* "PRAGMA main.inde..." */, libc.VaList(bp, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl))) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)))) { + var zOrig uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 3) + if (zOrig != 0) && (libc.Xstrcmp(tls, zOrig, ts+16035 /* "pk" */) == 0) { + var zIdx uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */)), 1) if zIdx != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+96 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28206 /* "PRAGMA main.inde..." */, libc.VaList(bp+16, zIdx))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+64 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28221 /* "PRAGMA main.inde..." */, libc.VaList(bp+8, zIdx))) } break } } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 88 /* pXList */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 56 /* pXList */))) - for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pXInfo */)))) { - if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pXInfo */)), 5) != 0 { + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)))) { + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 5) != 0 { // int iCid = sqlite3_column_int(pXInfo, 0); - var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pXInfo */)), 2) + var zCol uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 2) var zDesc uintptr - if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pXInfo */)), 3) != 0 { - zDesc = ts + 28446 /* " DESC" */ + if Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */)), 3) != 0 { + zDesc = ts + 28461 /* " DESC" */ } else { - zDesc = ts + 740 /* "" */ + zDesc = ts + 755 /* "" */ } - z = rbuMPrintf(tls, p, ts+29039 /* "%z%s\"%w\"%s" */, libc.VaList(bp+32, z, zSep, zCol, zDesc)) - zSep = ts + 14676 /* ", " */ + z = rbuMPrintf(tls, p, ts+29054 /* "%z%s\"%w\"%s" */, libc.VaList(bp+16, z, zSep, zCol, zDesc)) + zSep = ts + 14691 /* ", " */ } } - z = rbuMPrintf(tls, p, ts+29050 /* "%z)" */, libc.VaList(bp+72, z)) - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 96 /* pXInfo */))) + z = rbuMPrintf(tls, p, ts+29065 /* "%z)" */, libc.VaList(bp+48, z)) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 64 /* pXInfo */))) } return z } @@ -206447,60 +206955,60 @@ func rbuWithoutRowidPK(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { /* sql // CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID; // func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:202100:13: */ - bp := tls.Alloc(240) - defer tls.Free(240) + bp := tls.Alloc(184) + defer tls.Free(184) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiPkTnum // Root page of PK index - *(*uintptr)(unsafe.Pointer(bp + 224 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum + *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)) = uintptr(0) // SELECT name ... WHERE rootpage = $tnum var zIdx uintptr = uintptr(0) // Name of PK index - *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx - var zComma uintptr = ts + 740 /* "" */ + *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)) = uintptr(0) // PRAGMA main.index_xinfo = $zIdx + var zComma uintptr = ts + 755 /* "" */ var zCols uintptr = uintptr(0) // Used to build up list of table cols var zPk uintptr = uintptr(0) // Used to build up table PK declaration // Figure out the name of the primary key index for the current table. // This is needed for the argument to "PRAGMA index_xinfo". Set // zIdx to point to a nul-terminated string containing this name. - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+224 /* &pQuery */, (p + 64 /* &.zErrmsg */), - ts+29054 /* "SELECT name FROM..." */) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+168 /* &pQuery */, (p + 64 /* &.zErrmsg */), + ts+29069 /* "SELECT name FROM..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* pQuery */)), 1, tnum) - if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* pQuery */))) { - zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 224 /* pQuery */)), 0) + Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 1, tnum) + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) { + zIdx = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */)), 0) } } if zIdx != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+232 /* &pXInfo */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+28206 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+176 /* &pXInfo */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+28221 /* "PRAGMA main.inde..." */, libc.VaList(bp, zIdx))) } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 224 /* pQuery */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 168 /* pQuery */))) - for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)))) { - var bKey int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 5) + for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)))) { + var bKey int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 5) if bKey != 0 { - var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 1) - var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 3) - var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */)), 4) - zCols = rbuMPrintf(tls, p, ts+29104 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+16, zCols, zComma, + var iCid int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 1) + var bDesc int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 3) + var zCollate uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */)), 4) + zCols = rbuMPrintf(tls, p, ts+29119 /* "%z%sc%d %s COLLA..." */, libc.VaList(bp+8, zCols, zComma, iCid, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCid)*8)), zCollate)) - zPk = rbuMPrintf(tls, p, ts+29126 /* "%z%sc%d%s" */, libc.VaList(bp+64, zPk, zComma, iCid, func() uintptr { + zPk = rbuMPrintf(tls, p, ts+29141 /* "%z%sc%d%s" */, libc.VaList(bp+48, zPk, zComma, iCid, func() uintptr { if bDesc != 0 { - return ts + 28446 /* " DESC" */ + return ts + 28461 /* " DESC" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 14676 /* ", " */ + zComma = ts + 14691 /* ", " */ } } - zCols = rbuMPrintf(tls, p, ts+29136 /* "%z, id INTEGER" */, libc.VaList(bp+104, zCols)) - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 232 /* pXInfo */))) + zCols = rbuMPrintf(tls, p, ts+29151 /* "%z, id INTEGER" */, libc.VaList(bp+80, zCols)) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 176 /* pXInfo */))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+120, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+88, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29151, /* "CREATE TABLE rbu..." */ - libc.VaList(bp+160, zCols, zPk)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+184, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 0, 0)) + ts+29166, /* "CREATE TABLE rbu..." */ + libc.VaList(bp+120, zCols, zPk)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+136, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 0, 0)) } } @@ -206523,57 +207031,57 @@ func rbuCreateImposterTable2(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlit // collation sequences. For tables that do not have an external PRIMARY // KEY, it also means the same PRIMARY KEY declaration. func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite3.c:202174:13: */ - bp := tls.Alloc(248) - defer tls.Free(248) + bp := tls.Alloc(200) + defer tls.Free(200) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum - var zComma uintptr = ts + 740 /* "" */ + var zComma uintptr = ts + 755 /* "" */ var zSql uintptr = uintptr(0) var iCol int32 - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 0, 1)) for iCol = 0; ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (iCol < (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol); iCol++ { - var zPk uintptr = ts + 740 /* "" */ + var zPk uintptr = ts + 755 /* "" */ var zCol uintptr = *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblCol + uintptr(iCol)*8)) - *(*uintptr)(unsafe.Pointer(bp + 240 /* zColl */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)) = uintptr(0) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_table_column_metadata(tls, - (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+240 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zCol, uintptr(0), bp+192 /* &zColl */, uintptr(0), uintptr(0), uintptr(0)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(iCol))) != 0) { // If the target table column is an "INTEGER PRIMARY KEY", add // "PRIMARY KEY" to the imposter table column declaration. - zPk = ts + 29213 /* "PRIMARY KEY " */ + zPk = ts + 29228 /* "PRIMARY KEY " */ } - zSql = rbuMPrintf(tls, p, ts+29226, /* "%z%s\"%w\" %s %sCO..." */ - libc.VaList(bp+40, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 240 /* zColl */)), + zSql = rbuMPrintf(tls, p, ts+29241, /* "%z%s\"%w\" %s %sCO..." */ + libc.VaList(bp+32, zSql, zComma, zCol, *(*uintptr)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FazTblType + uintptr(iCol)*8)), zPk, *(*uintptr)(unsafe.Pointer(bp + 192 /* zColl */)), func() uintptr { if *(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabNotNull + uintptr(iCol))) != 0 { - return ts + 29253 /* " NOT NULL" */ + return ts + 29268 /* " NOT NULL" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - zComma = ts + 14676 /* ", " */ + zComma = ts + 14691 /* ", " */ } if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { var zPk uintptr = rbuWithoutRowidPK(tls, p, pIter) if zPk != 0 { - zSql = rbuMPrintf(tls, p, ts+29263 /* "%z, %z" */, libc.VaList(bp+104, zSql, zPk)) + zSql = rbuMPrintf(tls, p, ts+29278 /* "%z, %z" */, libc.VaList(bp+88, zSql, zPk)) } } - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+128, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 1, tnum)) - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29270, /* "CREATE TABLE \"rb..." */ - libc.VaList(bp+168, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+104, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 1, tnum)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+29285, /* "CREATE TABLE \"rb..." */ + libc.VaList(bp+136, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSql, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_WITHOUT_ROWID { - return ts + 29302 /* " WITHOUT ROWID" */ + return ts + 29317 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+200, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 0, 0)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+160, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 0, 0)) } } @@ -206587,8 +207095,8 @@ func rbuCreateImposterTable(tls *libc.TLS, p uintptr, pIter uintptr) { /* sqlite // (for the rbu_rowid column) if the target table is an implicit IPK or // virtual table. func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollist uintptr, zRbuRowid uintptr) { /* sqlite3.c:202230:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(40) + defer tls.Free(40) var bRbuRowid int32 = (libc.Bool32(((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE))) var zBind uintptr = rbuObjIterGetBindlist(tls, p, (((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + 1) + bRbuRowid)) @@ -206596,7 +207104,7 @@ func rbuObjIterPrepareTmpInsert(tls *libc.TLS, p uintptr, pIter uintptr, zCollis (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 152 /* &.pTmpInsert */), (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+29317, /* "INSERT INTO %s.'..." */ + ts+29332, /* "INSERT INTO %s.'..." */ libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zCollist, zRbuRowid, zBind))) } } @@ -206633,7 +207141,7 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+29374 /* "SELECT trim(sql)..." */) + ts+29389 /* "SELECT trim(sql)..." */) } if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { var rc2 int32 @@ -206732,8 +207240,8 @@ func rbuObjIterGetIndexWhere(tls *libc.TLS, p uintptr, pIter uintptr) uintptr { // target database object currently indicated by the iterator passed // as the second argument are available. func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32) int32 { /* sqlite3.c:202378:12: */ - bp := tls.Alloc(756) - defer tls.Free(756) + bp := tls.Alloc(628) + defer tls.Free(628) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect == uintptr(0)) && (rbuObjIterCacheTableInfo(tls, p, pIter) == SQLITE_OK) { var tnum int32 = (*RbuObjIter)(unsafe.Pointer(pIter)).FiTnum @@ -206743,7 +207251,7 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zLimit uintptr = uintptr(0) if nOffset != 0 { - zLimit = Xsqlite3_mprintf(tls, ts+29440 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) + zLimit = Xsqlite3_mprintf(tls, ts+29455 /* " LIMIT -1 OFFSET..." */, libc.VaList(bp, nOffset)) if !(zLimit != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM } @@ -206751,39 +207259,39 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if zIdx != 0 { var zTbl uintptr = (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl - *(*uintptr)(unsafe.Pointer(bp + 728 /* zImposterCols */)) = uintptr(0) // Columns for imposter table - *(*uintptr)(unsafe.Pointer(bp + 736 /* zImposterPK */)) = uintptr(0) // Primary key declaration for imposter - *(*uintptr)(unsafe.Pointer(bp + 744 /* zWhere */)) = uintptr(0) // WHERE clause on PK columns + *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)) = uintptr(0) // Columns for imposter table + *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)) = uintptr(0) // Primary key declaration for imposter + *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */)) = uintptr(0) // WHERE clause on PK columns var zBind uintptr = uintptr(0) var zPart uintptr = uintptr(0) - *(*int32)(unsafe.Pointer(bp + 752 /* nBind */)) = 0 + *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) = 0 zPart = rbuObjIterGetIndexWhere(tls, p, pIter) zCollist = rbuObjIterGetIndexCols(tls, - p, pIter, bp+728 /* &zImposterCols */, bp+736 /* &zImposterPK */, bp+744 /* &zWhere */, bp+752 /* &nBind */) - zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 752 /* nBind */))) + p, pIter, bp+600 /* &zImposterCols */, bp+608 /* &zImposterPK */, bp+616 /* &zWhere */, bp+624 /* &nBind */) + zBind = rbuObjIterGetBindlist(tls, p, *(*int32)(unsafe.Pointer(bp + 624 /* nBind */))) // Create the imposter table used to write to this index. - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 0, 1)) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+56, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 1, tnum)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+8, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 0, 1)) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+40, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 1, tnum)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+29460, /* "CREATE TABLE \"rb..." */ - libc.VaList(bp+96, zTbl, *(*uintptr)(unsafe.Pointer(bp + 728 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 736 /* zImposterPK */)))) - Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+128, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, 0, 0)) + ts+29475, /* "CREATE TABLE \"rb..." */ + libc.VaList(bp+72, zTbl, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */)), *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */)))) + Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+96, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, 0, 0)) // Create the statement to insert index entries - (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 752 /* nBind */)) + (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = *(*int32)(unsafe.Pointer(bp + 624 /* nBind */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29525 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+168, zTbl, zBind))) + Xsqlite3_mprintf(tls, ts+29540 /* "INSERT INTO \"rbu..." */, libc.VaList(bp+128, zTbl, zBind))) } // And to delete index entries if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+29561 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+192, zTbl, *(*uintptr)(unsafe.Pointer(bp + 744 /* zWhere */))))) + Xsqlite3_mprintf(tls, ts+29576 /* "DELETE FROM \"rbu..." */, libc.VaList(bp+144, zTbl, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))))) } // Create the SELECT statement to read keys in sorted order @@ -206800,40 +207308,40 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } zSql = Xsqlite3_mprintf(tls, - ts+29595, /* "SELECT %s, 0 AS ..." */ - libc.VaList(bp+216, zCollist, + ts+29610, /* "SELECT %s, 0 AS ..." */ + libc.VaList(bp+160, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zStart != 0 { return func() uintptr { if zPart != 0 { - return ts + 29656 /* "AND" */ + return ts + 29671 /* "AND" */ } - return ts + 29660 /* "WHERE" */ + return ts + 29675 /* "WHERE" */ }() } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zStart, zCollist, zLimit)) Xsqlite3_free(tls, zStart) } else if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { zSql = Xsqlite3_mprintf(tls, - ts+29666, /* "SELECT %s, rbu_c..." */ - libc.VaList(bp+280, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, + ts+29681, /* "SELECT %s, rbu_c..." */ + libc.VaList(bp+216, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, zLimit)) } else { zSql = Xsqlite3_mprintf(tls, - ts+29727, /* "SELECT %s, rbu_c..." */ - libc.VaList(bp+336, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, + ts+29742, /* "SELECT %s, rbu_c..." */ + libc.VaList(bp+264, zCollist, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, zCollist, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, zPart, func() uintptr { if zPart != 0 { - return ts + 29656 /* "AND" */ + return ts + 29671 /* "AND" */ } - return ts + 29660 /* "WHERE" */ + return ts + 29675 /* "WHERE" */ }(), zCollist, zLimit)) } @@ -206844,9 +207352,9 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 728 /* zImposterCols */))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 736 /* zImposterPK */))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 744 /* zWhere */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 600 /* zImposterCols */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 608 /* zImposterPK */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 616 /* zWhere */))) Xsqlite3_free(tls, zBind) Xsqlite3_free(tls, zPart) } else { @@ -206858,8 +207366,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 var zBindings uintptr = rbuObjIterGetBindlist(tls, p, ((*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol + bRbuRowid)) var zWhere uintptr = rbuObjIterGetWhere(tls, p, pIter) - var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+6814 /* "old" */) - var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+6810 /* "new" */) + var zOldlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+6829 /* "old" */) + var zNewlist uintptr = rbuObjIterGetOldlist(tls, p, pIter, ts+6825 /* "new" */) zCollist = rbuObjIterGetCollist(tls, p, pIter) (*RbuObjIter)(unsafe.Pointer(pIter)).FnCol = (*RbuObjIter)(unsafe.Pointer(pIter)).FnTblCol @@ -206869,21 +207377,21 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 rbuCreateImposterTable2(tls, p, pIter) zWrite = func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_VTAB { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 29886 /* "rbu_imp_" */ + return ts + 29901 /* "rbu_imp_" */ }() // Create the INSERT statement to write to the target PK b-tree if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 136 /* &.pInsert */), pz, Xsqlite3_mprintf(tls, - ts+29895, /* "INSERT INTO \"%s%..." */ - libc.VaList(bp+424, zWrite, zTbl, zCollist, func() uintptr { + ts+29910, /* "INSERT INTO \"%s%..." */ + libc.VaList(bp+344, zWrite, zTbl, zCollist, func() uintptr { if bRbuRowid != 0 { - return ts + 29931 /* ", _rowid_" */ + return ts + 29946 /* ", _rowid_" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zBindings))) } @@ -206893,37 +207401,37 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pIter + 144 /* &.pDelete */), pz, Xsqlite3_mprintf(tls, - ts+29941 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+472, zWrite, zTbl, zWhere))) + ts+29956 /* "DELETE FROM \"%s%..." */, libc.VaList(bp+384, zWrite, zTbl, zWhere))) } if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { - zRbuRowid = ts + 29969 /* ", rbu_rowid" */ + zRbuRowid = ts + 29984 /* ", rbu_rowid" */ } // Create the rbu_tmp_xxx table and the triggers to populate it. rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+29981 /* "CREATE TABLE IF ..." */, libc.VaList(bp+504, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { + ts+29996 /* "CREATE TABLE IF ..." */, libc.VaList(bp+408, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL { - return ts + 30057 /* ", 0 AS rbu_rowid" */ + return ts + 30072 /* ", 0 AS rbu_rowid" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+30074, /* "CREATE TEMP TRIG..." */ - libc.VaList(bp+544, zWrite, zTbl, zOldlist, + ts+30089, /* "CREATE TEMP TRIG..." */ + libc.VaList(bp+440, zWrite, zTbl, zOldlist, zWrite, zTbl, zOldlist, zWrite, zTbl, zNewlist)) if ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_EXTERNAL) || ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_NONE) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+30373, /* "CREATE TEMP TRIG..." */ - libc.VaList(bp+624, zWrite, zTbl, zNewlist)) + ts+30388, /* "CREATE TEMP TRIG..." */ + libc.VaList(bp+512, zWrite, zTbl, zNewlist)) } rbuObjIterPrepareTmpInsert(tls, p, pIter, zCollist, zRbuRowid) @@ -206931,14 +207439,14 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // Create the SELECT statement to read keys from data_xxx if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var zRbuRowid uintptr = ts + 740 /* "" */ + var zRbuRowid uintptr = ts + 755 /* "" */ var zStart uintptr = uintptr(0) var zOrder uintptr = uintptr(0) if bRbuRowid != 0 { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zRbuRowid = ts + 30472 /* ",_rowid_ " */ + zRbuRowid = ts + 30487 /* ",_rowid_ " */ } else { - zRbuRowid = ts + 30482 /* ",rbu_rowid" */ + zRbuRowid = ts + 30497 /* ",rbu_rowid" */ } } @@ -206951,35 +207459,35 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 } } if bRbuRowid != 0 { - zOrder = rbuMPrintf(tls, p, ts+28529 /* "_rowid_" */, 0) + zOrder = rbuMPrintf(tls, p, ts+28544 /* "_rowid_" */, 0) } else { - zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+740 /* "" */, ts+14676 /* ", " */, ts+740 /* "" */) + zOrder = rbuObjIterGetPkList(tls, p, pIter, ts+755 /* "" */, ts+14691 /* ", " */, ts+755 /* "" */) } } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, (pIter + 128 /* &.pSelect */), pz, Xsqlite3_mprintf(tls, - ts+30493, /* "SELECT %s,%s rbu..." */ - libc.VaList(bp+656, zCollist, + ts+30508, /* "SELECT %s,%s rbu..." */ + libc.VaList(bp+536, zCollist, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 30541 /* "0 AS " */ + return ts + 30556 /* "0 AS " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zRbuRowid, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl, func() uintptr { if zStart != 0 { return zStart } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zOrder != 0 { - return ts + 19575 /* "ORDER BY" */ + return ts + 19590 /* "ORDER BY" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), zOrder, zLimit))) } @@ -207007,8 +207515,8 @@ func rbuObjIterPrepareAll(tls *libc.TLS, p uintptr, pIter uintptr, nOffset int32 // If the zMask string does not specify any columns to update, then this // is not an error. Output variable *ppStmt is set to NULL in this case. func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, ppStmt uintptr) int32 { /* sqlite3.c:202645:12: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(32) + defer tls.Free(32) var pp uintptr var pUp uintptr = uintptr(0) @@ -207054,12 +207562,12 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp (*RbuObjIter)(unsafe.Pointer(pIter)).FpRbuUpdate = pUp if zSet != 0 { - var zPrefix uintptr = ts + 740 /* "" */ + var zPrefix uintptr = ts + 755 /* "" */ if (*RbuObjIter)(unsafe.Pointer(pIter)).FeType != RBU_PK_VTAB { - zPrefix = ts + 29886 /* "rbu_imp_" */ + zPrefix = ts + 29901 /* "rbu_imp_" */ } - zUpdate = Xsqlite3_mprintf(tls, ts+30547, /* "UPDATE \"%s%w\" SE..." */ + zUpdate = Xsqlite3_mprintf(tls, ts+30562, /* "UPDATE \"%s%w\" SE..." */ libc.VaList(bp, zPrefix, (*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl, zSet, zWhere)) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, (pUp + 8 /* &.pUpdate */), (p + 64 /* &.zErrmsg */), zUpdate) @@ -207073,25 +207581,25 @@ func rbuGetUpdateStmt(tls *libc.TLS, p uintptr, pIter uintptr, zMask uintptr, pp } func rbuOpenDbhandle(tls *libc.TLS, p uintptr, zName uintptr, bUseVfs int32) uintptr { /* sqlite3.c:202713:16: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) - *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var flags int32 = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_URI) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_open_v2(tls, zName, bp+16 /* &db */, flags, func() uintptr { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_open_v2(tls, zName, bp+8 /* &db */, flags, func() uintptr { if bUseVfs != 0 { return (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName } return uintptr(0) }()) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))))) - Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))) - *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) = uintptr(0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))))) + Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) = uintptr(0) } } - return *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) + return *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)) } // Free an RbuState object allocated by rbuLoadState(). @@ -207112,12 +207620,12 @@ func rbuFreeState(tls *libc.TLS, p uintptr) { /* sqlite3.c:202734:13: */ // If an error occurs, leave an error code and message in the rbu handle // and return NULL. func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ - bp := tls.Alloc(28) - defer tls.Free(28) + bp := tls.Alloc(20) + defer tls.Free(20) var pRet uintptr = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0) - // var rc int32 at bp+24, 4 + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) + // var rc int32 at bp+16, 4 var rc2 int32 @@ -207126,12 +207634,12 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ return uintptr(0) } - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+16 /* &pStmt */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+30577 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) - for (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))) { - switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+30592 /* "SELECT k, v FROM..." */, libc.VaList(bp, p+48 /* &.zStateDb */))) + for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))) { + switch Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) { case RBU_STATE_STAGE: - (*RbuState)(unsafe.Pointer(pRet)).FeStage = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + (*RbuState)(unsafe.Pointer(pRet)).FeStage = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) if (((*RbuState)(unsafe.Pointer(pRet)).FeStage != RBU_STAGE_OAL) && ((*RbuState)(unsafe.Pointer(pRet)).FeStage != RBU_STAGE_MOVE)) && ((*RbuState)(unsafe.Pointer(pRet)).FeStage != RBU_STAGE_CKPT) { @@ -207140,90 +207648,90 @@ func rbuLoadState(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:202752:17: */ break case RBU_STATE_TBL: - (*RbuState)(unsafe.Pointer(pRet)).FzTbl = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1), bp+24 /* &rc */) + (*RbuState)(unsafe.Pointer(pRet)).FzTbl = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1), bp+16 /* &rc */) break case RBU_STATE_IDX: - (*RbuState)(unsafe.Pointer(pRet)).FzIdx = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1), bp+24 /* &rc */) + (*RbuState)(unsafe.Pointer(pRet)).FzIdx = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1), bp+16 /* &rc */) break case RBU_STATE_ROW: - (*RbuState)(unsafe.Pointer(pRet)).FnRow = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + (*RbuState)(unsafe.Pointer(pRet)).FnRow = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) break case RBU_STATE_PROGRESS: - (*RbuState)(unsafe.Pointer(pRet)).FnProgress = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + (*RbuState)(unsafe.Pointer(pRet)).FnProgress = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) break case RBU_STATE_CKPT: - (*RbuState)(unsafe.Pointer(pRet)).FiWalCksum = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + (*RbuState)(unsafe.Pointer(pRet)).FiWalCksum = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) break case RBU_STATE_COOKIE: - (*RbuState)(unsafe.Pointer(pRet)).FiCookie = U32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1)) + (*RbuState)(unsafe.Pointer(pRet)).FiCookie = U32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1)) break case RBU_STATE_OALSZ: - (*RbuState)(unsafe.Pointer(pRet)).FiOalSz = I64(U32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + (*RbuState)(unsafe.Pointer(pRet)).FiOalSz = I64(U32(Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1))) break case RBU_STATE_PHASEONESTEP: - (*RbuState)(unsafe.Pointer(pRet)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + (*RbuState)(unsafe.Pointer(pRet)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1) break case RBU_STATE_DATATBL: - (*RbuState)(unsafe.Pointer(pRet)).FzDataTbl = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1), bp+24 /* &rc */) + (*RbuState)(unsafe.Pointer(pRet)).FzDataTbl = rbuStrndup(tls, Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1), bp+16 /* &rc */) break default: - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_CORRUPT + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT break } } - rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) - if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = rc2 + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = rc2 } - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) return pRet } // Open the database handle and attach the RBU database as "rbu". If an // error occurs, leave an error code and message in the RBU handle. func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:202829:13: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(56) + defer tls.Free(56) // Open the RBU database (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu = rbuOpenDbhandle(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, 1) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6805 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6820 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState == uintptr(0) { - var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6805 /* "main" */) - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+30607 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) + var zFile uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6820 /* "main" */) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+30622 /* "file://%s-vacuum..." */, libc.VaList(bp, zFile, zFile)) } } // If using separate RBU and state databases, attach the state database to // the RBU db handle now. if (*Sqlite3rbu)(unsafe.Pointer(p)).FzState != 0 { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30634 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+24, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) - libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+13534 /* "stat" */, uint64(4)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30649 /* "ATTACH %Q AS sta..." */, libc.VaList(bp+16, (*Sqlite3rbu)(unsafe.Pointer(p)).FzState)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+13549 /* "stat" */, uint64(4)) } else { - libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+6805 /* "main" */, uint64(4)) + libc.Xmemcpy(tls, p+48 /* &.zStateDb */, ts+6820 /* "main" */, uint64(4)) } // If it has not already been created, create the rbu_state table - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30652 /* "CREATE TABLE IF ..." */, libc.VaList(bp+40, p+48 /* &.zStateDb */)) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+30667 /* "CREATE TABLE IF ..." */, libc.VaList(bp+24, p+48 /* &.zStateDb */)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { var bOpen int32 = 0 var rc int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FnRbu = 0 (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd = uintptr(0) - rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6805 /* "main" */, SQLITE_FCNTL_RBUCNT, p) + rc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6820 /* "main" */, SQLITE_FCNTL_RBUCNT, p) if rc != SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc } @@ -207256,11 +207764,11 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 return } (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30718 /* "cannot vacuum wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30733 /* "cannot vacuum wa..." */, 0) } else { var zTarget uintptr var zExtra uintptr = uintptr(0) - if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+23843 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { + if (libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu) >= uint64(5)) && (0 == libc.Xmemcmp(tls, ts+23858 /* "file:" */, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, uint64(5))) { zExtra = ((*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu + 5) for *(*int8)(unsafe.Pointer(zExtra)) != 0 { if int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zExtra, 1)))) == '?' { @@ -207272,16 +207780,16 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 } } - zTarget = Xsqlite3_mprintf(tls, ts+30750, /* "file:%s-vactmp?r..." */ - libc.VaList(bp+56, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6805 /* "main" */), + zTarget = Xsqlite3_mprintf(tls, ts+30765, /* "file:%s-vactmp?r..." */ + libc.VaList(bp+32, Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6820 /* "main" */), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 30782 /* "&" */ + return ts + 30797 /* "&" */ }(), func() uintptr { if zExtra == uintptr(0) { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } return zExtra }())) @@ -207297,40 +207805,40 @@ func rbuOpenDatabase(tls *libc.TLS, p uintptr, pbRetry uintptr) { /* sqlite3.c:2 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+30784 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30799 /* "rbu_tmp_insert" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTmpInsertFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, - ts+30799 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { + ts+30814 /* "rbu_fossil_delta" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuFossilDeltaFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+30816 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+30831 /* "rbu_target_name" */, -1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuTargetNameFunc})), uintptr(0), uintptr(0)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, SQLITE_FCNTL_RBU, p) } - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30832 /* "SELECT * FROM sq..." */, 0) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30847 /* "SELECT * FROM sq..." */, 0) // Mark the database file just opened as an RBU target database. If // this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use. // This is an error. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */, SQLITE_FCNTL_RBU, p) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_file_control(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */, SQLITE_FCNTL_RBU, p) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30860 /* "rbu vfs not foun..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+30875 /* "rbu vfs not foun..." */, 0) } } @@ -207399,7 +207907,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if pState == uintptr(0) { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = 0 if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30832 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30847 /* "SELECT * FROM sq..." */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -207433,7 +207941,7 @@ func rbuSetupCheckpoint(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var rc2 int32 (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CAPTURE - rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30878 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) + rc2 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30893 /* "PRAGMA main.wal_..." */, uintptr(0), uintptr(0), uintptr(0)) if rc2 != SQLITE_INTERNAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -207557,19 +208065,19 @@ func rbuLockDatabase(tls *libc.TLS, p uintptr) { /* sqlite3.c:203202:13: */ // If an error occurs, leave an error code and error message in the rbu // handle. func rbuMoveOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203242:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) - var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6805 /* "main" */) + var zBase uintptr = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+6820 /* "main" */) var zMove uintptr = zBase var zOal uintptr var zWal uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6805 /* "main" */) + zMove = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+6820 /* "main" */) } - zOal = Xsqlite3_mprintf(tls, ts+30913 /* "%s-oal" */, libc.VaList(bp, zMove)) - zWal = Xsqlite3_mprintf(tls, ts+30920 /* "%s-wal" */, libc.VaList(bp+16, zMove)) + zOal = Xsqlite3_mprintf(tls, ts+30928 /* "%s-oal" */, libc.VaList(bp, zMove)) + zWal = Xsqlite3_mprintf(tls, ts+30935 /* "%s-wal" */, libc.VaList(bp+8, zMove)) if (zWal == uintptr(0)) || (zOal == uintptr(0)) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM @@ -207709,7 +208217,7 @@ func rbuStepOneOp(tls *libc.TLS, p uintptr, eType int32) { /* sqlite3.c:203389:1 ((*RbuObjIter)(unsafe.Pointer(pIter)).FzIdx == uintptr(0))) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FeType == RBU_PK_IPK)) && (*(*U8)(unsafe.Pointer((*RbuObjIter)(unsafe.Pointer(pIter)).FabTblPk + uintptr(i))) != 0)) && (Xsqlite3_column_type(tls, (*RbuObjIter)(unsafe.Pointer(pIter)).FpSelect, i) == SQLITE_NULL) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_MISMATCH - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+23481 /* "datatype mismatc..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+23496 /* "datatype mismatc..." */, 0) return } @@ -207813,8 +208321,8 @@ func rbuStep(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203472:12: */ // opened by p->dbMain to one more than the schema cookie of the main // db opened by p->dbRbu. func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var dbread uintptr = func() uintptr { @@ -207824,23 +208332,23 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ return (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain }() var iCookie int32 = 1000000 - // var pStmt uintptr at bp+16, 8 + // var pStmt uintptr at bp+8, 8 - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+16 /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+30927 /* "PRAGMA schema_ve..." */) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, dbread, bp+8 /* &pStmt */, (p + 64 /* &.zErrmsg */), + ts+30942 /* "PRAGMA schema_ve..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { // Coverage: it may be that this sqlite3_step() cannot fail. There // is already a transaction open, so the prepared statement cannot // throw an SQLITE_SCHEMA exception. The only database page the // statement reads is page 1, which is guaranteed to be in the cache. // And no memory allocations are required. - if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { - iCookie = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) { + iCookie = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30949 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) + rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+30964 /* "PRAGMA schema_ve..." */, libc.VaList(bp, (iCookie+1))) } } } @@ -207849,11 +208357,11 @@ func rbuIncrSchemaCookie(tls *libc.TLS, p uintptr) { /* sqlite3.c:203537:13: */ // value stored in the RBU_STATE_STAGE column is eStage. All other values // are determined by inspecting the rbu handle passed as the first argument. func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568:13: */ - bp := tls.Alloc(184) - defer tls.Free(184) + bp := tls.Alloc(176) + defer tls.Free(176) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) || ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) { - *(*uintptr)(unsafe.Pointer(bp + 176 /* pInsert */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 168 /* pInsert */)) = uintptr(0) var pFd uintptr = func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { return (*Sqlite3rbu)(unsafe.Pointer(p)).FpRbuFd @@ -207862,10 +208370,10 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: }() var rc int32 - rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+176 /* &pInsert */, (p + 64 /* &.zErrmsg */), + rc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+168 /* &pInsert */, (p + 64 /* &.zErrmsg */), Xsqlite3_mprintf(tls, - ts+30976, /* "INSERT OR REPLAC..." */ + ts+30991, /* "INSERT OR REPLAC..." */ libc.VaList(bp, p+48, /* &.zStateDb */ RBU_STATE_STAGE, eStage, RBU_STATE_TBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzTbl, @@ -207879,8 +208387,8 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: RBU_STATE_DATATBL, (*Sqlite3rbu)(unsafe.Pointer(p)).Fobjiter.FzDataTbl))) if rc == SQLITE_OK { - Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pInsert */))) - rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* pInsert */))) + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pInsert */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pInsert */))) } if rc != SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc @@ -207904,18 +208412,18 @@ func rbuSaveState(tls *libc.TLS, p uintptr, eStage int32) { /* sqlite3.c:203568: // In short, it copies the value of the specified PRAGMA setting from // dbRbu to dbMain. func rbuCopyPragma(tls *libc.TLS, p uintptr, zPragma uintptr) { /* sqlite3.c:203629:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - *(*uintptr)(unsafe.Pointer(bp + 40 /* pPragma */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+40 /* &pPragma */, (p + 64 /* &.zErrmsg */), - Xsqlite3_mprintf(tls, ts+31134 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) - if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pPragma */)))) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31149, /* "PRAGMA main.%s =..." */ - libc.VaList(bp+16, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pPragma */)), 0))) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)) = uintptr(0) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareFreeAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp+24 /* &pPragma */, (p + 64 /* &.zErrmsg */), + Xsqlite3_mprintf(tls, ts+31149 /* "PRAGMA main.%s" */, libc.VaList(bp, zPragma))) + if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)))) { + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31164, /* "PRAGMA main.%s =..." */ + libc.VaList(bp+8, zPragma, Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */)), 0))) } - rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 40 /* pPragma */))) + rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPragma */))) } } @@ -207929,11 +208437,11 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * *(*uintptr)(unsafe.Pointer(bp /* pSql */)) = uintptr(0) *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */)) = uintptr(0) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31169 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31184 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+31194 /* "SELECT sql FROM ..." */) + ts+31209 /* "SELECT sql FROM ..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -207947,12 +208455,12 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pSql */, (p + 64 /* &.zErrmsg */), - ts+31302 /* "SELECT * FROM sq..." */) + ts+31317 /* "SELECT * FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, bp+8 /* &pInsert */, (p + 64 /* &.zErrmsg */), - ts+31367 /* "INSERT INTO sqli..." */) + ts+31382 /* "INSERT INTO sqli..." */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) == SQLITE_ROW) { @@ -207964,7 +208472,7 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pInsert */))) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31411 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31426 /* "PRAGMA writable_..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } rbuFinalize(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pSql */))) @@ -207973,8 +208481,8 @@ func rbuCreateTargetSchema(tls *libc.TLS, p uintptr) { /* sqlite3.c:203649:13: * // Step the RBU object. func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) if p != 0 { switch (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage { @@ -207986,8 +208494,8 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // when this handle was opened, create the target database schema. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FnProgress == 0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) { rbuCreateTargetSchema(tls, p) - rbuCopyPragma(tls, p, ts+17097 /* "user_version" */) - rbuCopyPragma(tls, p, ts+16198 /* "application_id" */) + rbuCopyPragma(tls, p, ts+17112 /* "user_version" */) + rbuCopyPragma(tls, p, ts+16213 /* "application_id" */) } for ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl != 0) { @@ -207998,7 +208506,7 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // But the contents can be deleted. if ((libc.Bool32((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0))) == 0) && ((*RbuObjIter)(unsafe.Pointer(pIter)).FabIndexed != 0) { rbuMPrintfExec(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+31436 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) + ts+31451 /* "DELETE FROM %s.'..." */, libc.VaList(bp, p+48 /* &.zStateDb */, (*RbuObjIter)(unsafe.Pointer(pIter)).FzDataTbl)) } } else { rbuObjIterPrepareAll(tls, p, pIter, 0) @@ -208024,10 +208532,10 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: rbuSaveState(tls, p, RBU_STAGE_MOVE) rbuIncrSchemaCookie(tls, p) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+14580 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+14595 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14580 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14595 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_MOVE } @@ -208058,11 +208566,11 @@ func Xsqlite3rbu_step(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:203701:16: // Update nBackfill if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - // var ptr uintptr at bp+24, 8 + // var ptr uintptr at bp+16, 8 - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 104 /* &.xShmMap */))))(tls, pDb, 0, (32 * 1024), 0, bp+24 /* &ptr */) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*Sqlite3_file)(unsafe.Pointer(pDb)).FpMethods + 104 /* &.xShmMap */))))(tls, pDb, 0, (32 * 1024), 0, bp+16 /* &ptr */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - *(*U32)(unsafe.Pointer((libc.AtomicLoadPUintptr(bp + 24 /* ptr */)) + 24*4)) = (*Sqlite3rbu)(unsafe.Pointer(p)).FiMaxFrame + *(*U32)(unsafe.Pointer((libc.AtomicLoadPUintptr(bp + 16 /* ptr */)) + 24*4)) = (*Sqlite3rbu)(unsafe.Pointer(p)).FiMaxFrame } } @@ -208144,7 +208652,7 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 if (rc == SQLITE_OK) && !(int32((*RbuObjIter)(unsafe.Pointer(pIter)).FzTbl) != 0) { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31464 /* "rbu_state mismat..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31479 /* "rbu_state mismat..." */, 0) } if rc == SQLITE_OK { @@ -208160,10 +208668,10 @@ func rbuSetupOal(tls *libc.TLS, p uintptr, pState uintptr) { /* sqlite3.c:203846 // target database in the file-system, delete it. If an error occurs, // leave an error code and error message in the rbu handle. func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) - var zOal uintptr = rbuMPrintf(tls, p, ts+30913 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) + var zOal uintptr = rbuMPrintf(tls, p, ts+30928 /* "%s-oal" */, libc.VaList(bp, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget)) if zOal != 0 { var pVfs uintptr = Xsqlite3_vfs_find(tls, uintptr(0)) @@ -208177,18 +208685,18 @@ func rbuDeleteOalFile(tls *libc.TLS, p uintptr) { /* sqlite3.c:203879:13: */ // specified a URI with a vfs=? option in place of a target database // file name. func rbuCreateVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203895:13: */ - bp := tls.Alloc(84) - defer tls.Free(84) + bp := tls.Alloc(76) + defer tls.Free(76) - // var rnd int32 at bp+16, 4 + // var rnd int32 at bp+8, 4 - // var zRnd [64]int8 at bp+20, 64 + // var zRnd [64]int8 at bp+12, 64 - Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+16 /* &rnd */) - Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+20 /* &zRnd[0] */, ts+31489 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 16 /* rnd */)))) - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+20 /* &zRnd[0] */, uintptr(0)) + Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp+8 /* &rnd */) + Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zRnd[0] */, ts+31504 /* "rbu_vfs_%d" */, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* rnd */)))) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3rbu_create_vfs(tls, bp+12 /* &zRnd[0] */, uintptr(0)) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+20 /* &zRnd[0] */) + var pVfs uintptr = Xsqlite3_vfs_find(tls, bp+12 /* &zRnd[0] */) (*Sqlite3rbu)(unsafe.Pointer(p)).FzVfsName = (*Sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName (*Rbu_vfs)(unsafe.Pointer(pVfs)).FpRbu = p @@ -208208,12 +208716,12 @@ func rbuDeleteVfs(tls *libc.TLS, p uintptr) { /* sqlite3.c:203915:13: */ // name of a table expected to appear in the target database. It returns // the number of auxilliary indexes on the table. func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* sqlite3.c:203927:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var p uintptr = Xsqlite3_user_data(tls, pCtx) - *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrmsg */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)) = uintptr(0) var rc int32 var db uintptr = func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { @@ -208222,17 +208730,17 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / return (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain }() - rc = prepareFreeAndCollectError(tls, db, bp+16 /* &pStmt */, bp+24, /* &zErrmsg */ + rc = prepareFreeAndCollectError(tls, db, bp+8 /* &pStmt */, bp+16, /* &zErrmsg */ Xsqlite3_mprintf(tls, - ts+31500 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) + ts+31515 /* "SELECT count(*) ..." */, libc.VaList(bp, Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))))) if rc != SQLITE_OK { - Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrmsg */)), -1) + Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */)), -1) } else { var nIndex int32 = 0 - if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { - nIndex = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 0) + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) { + nIndex = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0) } - rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) if rc == SQLITE_OK { Xsqlite3_result_int(tls, pCtx, nIndex) } else { @@ -208240,7 +208748,7 @@ func rbuIndexCntFunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { / } } - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* zErrmsg */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zErrmsg */))) } // If the RBU database contains the rbu_count table, use it to initialize @@ -208267,7 +208775,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = int64(-1) (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_create_function(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, - ts+31572 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + ts+31587 /* "rbu_index_cnt" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{rbuIndexCntFunc})), uintptr(0), uintptr(0)) @@ -208275,7 +208783,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ // occurs, nPhaseOneStep will be left set to -1. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+31586 /* "SELECT 1 FROM sq..." */) + ts+31601 /* "SELECT 1 FROM sq..." */) } if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { @@ -208287,7 +208795,7 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (bExists != 0) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = prepareAndCollectError(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, bp /* &pStmt */, (p + 64 /* &.zErrmsg */), - ts+31643 /* "SELECT sum(cnt *..." */) + ts+31658 /* "SELECT sum(cnt *..." */) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { (*Sqlite3rbu)(unsafe.Pointer(p)).FnPhaseOneStep = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0) @@ -208299,8 +208807,8 @@ func rbuInitPhaseOneSteps(tls *libc.TLS, p uintptr) { /* sqlite3.c:203977:13: */ } func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) uintptr { /* sqlite3.c:204018:19: */ - bp := tls.Alloc(36) - defer tls.Free(36) + bp := tls.Alloc(20) + defer tls.Free(20) var p uintptr var nTarget Size_t @@ -208323,7 +208831,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // Open the target, RBU and state databases if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { var pCsr uintptr = (p + 1*392) - *(*int32)(unsafe.Pointer(bp + 32 /* bRetry */)) = 0 + *(*int32)(unsafe.Pointer(bp + 16 /* bRetry */)) = 0 if zTarget != 0 { (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget = pCsr libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzTarget, zTarget, (nTarget + uint64(1))) @@ -208333,7 +208841,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) libc.Xmemcpy(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzRbu, zRbu, (nRbu + uint64(1))) pCsr += (uintptr(nRbu + uint64(1))) if zState != 0 { - (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+3615 /* "%s" */, libc.VaList(bp, zState)) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzState = rbuMPrintf(tls, p, ts+3630 /* "%s" */, libc.VaList(bp, zState)) } // If the first attempt to open the database file fails and the bRetry @@ -208343,8 +208851,8 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // If this is the case, it will have been checkpointed and deleted // when the handle was closed and a second attempt to open the // database may succeed. - rbuOpenDatabase(tls, p, bp+32 /* &bRetry */) - if *(*int32)(unsafe.Pointer(bp + 32 /* bRetry */)) != 0 { + rbuOpenDatabase(tls, p, bp+16 /* &bRetry */) + if *(*int32)(unsafe.Pointer(bp + 16 /* bRetry */)) != 0 { rbuOpenDatabase(tls, p, uintptr(0)) } } @@ -208370,7 +208878,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Rbu_file)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FpTargetFd)).FpWalFd != 0) { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31717 /* "cannot update wa..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31732 /* "cannot update wa..." */, 0) } else if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_MOVE { (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_CKPT (*Sqlite3rbu)(unsafe.Pointer(p)).FnStep = 0 @@ -208392,12 +208900,12 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) // transaction is committed in rollback mode) currently stored on // page 1 of the database file. (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = SQLITE_BUSY - (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31749, /* "database modifie..." */ - libc.VaList(bp+16, func() uintptr { + (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31764, /* "database modifie..." */ + libc.VaList(bp+8, func() uintptr { if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - return ts + 31781 /* "vacuum" */ + return ts + 31796 /* "vacuum" */ } - return ts + 31788 /* "update" */ + return ts + 31803 /* "update" */ }())) } } @@ -208405,7 +208913,7 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { var db uintptr = (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14565 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14580 /* "BEGIN" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) // Point the object iterator at the first object if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -208419,24 +208927,24 @@ func openRbuHandle(tls *libc.TLS, zTarget uintptr, zRbu uintptr, zState uintptr) (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage = RBU_STAGE_DONE } else { if (((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*RbuState)(unsafe.Pointer(pState)).FeStage == 0)) && ((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) { - rbuCopyPragma(tls, p, ts+16822 /* "page_size" */) - rbuCopyPragma(tls, p, ts+16213 /* "auto_vacuum" */) + rbuCopyPragma(tls, p, ts+16837 /* "page_size" */) + rbuCopyPragma(tls, p, ts+16228 /* "auto_vacuum" */) } // Open transactions both databases. The *-oal file is opened or // created at this point. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+31795 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, db, ts+31810 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Check if the main database is a zipvfs db. If it is, set the upper // level pager to use "journal_mode=off". This prevents it from // generating a large journal using a temp file. if (*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK { - var frc int32 = Xsqlite3_file_control(tls, db, ts+6805 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) + var frc int32 = Xsqlite3_file_control(tls, db, ts+6820 /* "main" */, SQLITE_FCNTL_ZIPVFS, uintptr(0)) if frc == SQLITE_OK { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, - db, ts+31811 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + db, ts+31826 /* "PRAGMA journal_m..." */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } } @@ -208489,7 +208997,7 @@ func Xsqlite3rbu_vacuum(tls *libc.TLS, zTarget uintptr, zState uintptr) uintptr } if zState != 0 { var n int32 = int32(libc.Xstrlen(tls, zState)) - if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+31835 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { + if (n >= 7) && (0 == libc.Xmemcmp(tls, ts+31850 /* "-vactmp" */, (zState+uintptr((n-7))), uint64(7))) { return rbuMisuseError(tls) } } @@ -208519,7 +209027,7 @@ func rbuEditErrmsg(tls *libc.TLS, p uintptr) { /* sqlite3.c:204232:13: */ var i uint32 var nErrmsg Size_t = libc.Xstrlen(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg) for i = uint32(0); Size_t(i) < (nErrmsg - uint64(8)); i++ { - if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+29886 /* "rbu_imp_" */, uint64(8)) == 0 { + if libc.Xmemcmp(tls, ((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg+uintptr(i)), ts+29901 /* "rbu_imp_" */, uint64(8)) == 0 { var nDel int32 = 8 for (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) >= '0') && (int32(*(*int8)(unsafe.Pointer((*Sqlite3rbu)(unsafe.Pointer(p)).FzErrmsg + uintptr((i + uint32(nDel)))))) <= '9') { nDel++ @@ -208538,7 +209046,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // Commit the transaction to the *-oal file. if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+14580 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+14595 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Sync the db file if currently doing an incremental checkpoint @@ -208550,7 +209058,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq rbuSaveState(tls, p, (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_OK) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL) { - (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14580 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) + (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14595 /* "COMMIT" */, uintptr(0), uintptr(0), (p + 64 /* &.zErrmsg */)) } // Close any open statement handles. @@ -208562,7 +209070,7 @@ func Xsqlite3rbu_close(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sq // specifying the current target and state databases to start a new // vacuum from scratch. if (((*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc != SQLITE_OK)) && ((*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu != 0) { - var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+31843 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) + var rc2 int32 = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+31858 /* "DELETE FROM stat..." */, uintptr(0), uintptr(0), uintptr(0)) if ((*Sqlite3rbu)(unsafe.Pointer(p)).Frc == SQLITE_DONE) && (rc2 != SQLITE_OK) { (*Sqlite3rbu)(unsafe.Pointer(p)).Frc = rc2 } @@ -208661,7 +209169,7 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+14580 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+14595 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -208678,19 +209186,19 @@ func Xsqlite3rbu_savestate(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:204384 if (*Sqlite3rbu)(unsafe.Pointer(p)).FeStage == RBU_STAGE_OAL { if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14580 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, ts+14595 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { var zBegin uintptr if (*Sqlite3rbu)(unsafe.Pointer((p))).FzTarget == uintptr(0) { - zBegin = ts + 14565 /* "BEGIN" */ + zBegin = ts + 14580 /* "BEGIN" */ } else { - zBegin = ts + 31795 /* "BEGIN IMMEDIATE" */ + zBegin = ts + 31810 /* "BEGIN IMMEDIATE" */ } rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbRbu, zBegin, uintptr(0), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { - rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31795 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) + rc = Xsqlite3_exec(tls, (*Sqlite3rbu)(unsafe.Pointer(p)).FdbMain, ts+31810 /* "BEGIN IMMEDIATE" */, uintptr(0), uintptr(0), uintptr(0)) } } @@ -209072,8 +209580,8 @@ func rbuVfsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int3 // File control method. For custom operations on an rbuVfs-file. func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:204822:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var p uintptr = pFile var xControl uintptr = (*sqlite3_io_methods)(unsafe.Pointer((*Sqlite3_file)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(p)).FpReal)).FpMethods)).FxFileControl @@ -209090,11 +209598,11 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if rc == SQLITE_NOTFOUND { // Now search for a zipvfs instance lower down in the VFS stack. If // one is found, this is an error. - *(*uintptr)(unsafe.Pointer(bp + 24 /* dummy */)) = uintptr(0) - rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+24 /* &dummy */) + *(*uintptr)(unsafe.Pointer(bp + 16 /* dummy */)) = uintptr(0) + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xControl)))(tls, (*Rbu_file)(unsafe.Pointer(p)).FpReal, SQLITE_FCNTL_ZIPVFS, bp+16 /* &dummy */) if rc == SQLITE_OK { rc = SQLITE_ERROR - (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31870 /* "rbu/zipvfs setup..." */, 0) + (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FzErrmsg = Xsqlite3_mprintf(tls, ts+31885 /* "rbu/zipvfs setup..." */, 0) } else if rc == SQLITE_NOTFOUND { (*Sqlite3rbu)(unsafe.Pointer(pRbu)).FpTargetFd = p (*Rbu_file)(unsafe.Pointer(p)).FpRbu = pRbu @@ -209117,7 +209625,7 @@ func rbuVfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) { var pRbuVfs uintptr = (*Rbu_file)(unsafe.Pointer(p)).FpRbuVfs var zIn uintptr = *(*uintptr)(unsafe.Pointer(pArg)) - var zOut uintptr = Xsqlite3_mprintf(tls, ts+31893 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) + var zOut uintptr = Xsqlite3_mprintf(tls, ts+31908 /* "rbu(%s)/%z" */, libc.VaList(bp, (*Rbu_vfs)(unsafe.Pointer(pRbuVfs)).Fbase.FzName, zIn)) *(*uintptr)(unsafe.Pointer(pArg)) = zOut if zOut == uintptr(0) { rc = SQLITE_NOMEM @@ -209280,7 +209788,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags // This call is to open a *-wal file. Intead, open the *-oal. var nOpen Size_t if (*Sqlite3rbu)(unsafe.Pointer(((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu))).FzTarget == uintptr(0) { - zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+6805 /* "main" */) + zOpen = Xsqlite3_db_filename(tls, (*Sqlite3rbu)(unsafe.Pointer((*Rbu_file)(unsafe.Pointer(pDb)).FpRbu)).FdbRbu, ts+6820 /* "main" */) zOpen = Xsqlite3_filename_wal(tls, zOpen) } nOpen = libc.Xstrlen(tls, zOpen) @@ -209295,7 +209803,7 @@ func rbuVfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags } if ((oflags & SQLITE_OPEN_MAIN_DB) != 0) && - (Xsqlite3_uri_boolean(tls, zName, ts+31904 /* "rbu_memory" */, 0) != 0) { + (Xsqlite3_uri_boolean(tls, zName, ts+31919 /* "rbu_memory" */, 0) != 0) { oflags = ((((SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_CREATE) | SQLITE_OPEN_EXCLUSIVE) | SQLITE_OPEN_DELETEONCLOSE) zOpen = uintptr(0) @@ -209602,6 +210110,5673 @@ func Xsqlite3rbu_temp_size(tls *libc.TLS, pRbu uintptr) Sqlite3_int64 { /* sqlit //************* End of dbpage.c ********************************************* //************* Begin file sqlite3session.c ********************************* +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable1 = struct { + FpNext uintptr + FzName uintptr + FnCol int32 + FbStat1 int32 + FazCol uintptr + FabPK uintptr + FnEntry int32 + FnChange int32 + FapChange uintptr +} /* sqlite3.c:11155:9 */ + +//************************************************************************ + +//************* End of sqlite3rbu.c ***************************************** +//************* Begin file dbstat.c ***************************************** +// 2010 July 12 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "dbstat" virtual table. +// +// The dbstat virtual table is used to extract low-level storage +// information from an SQLite database in order to implement the +// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script +// for an example implementation. +// +// Additional information is available on the "dbstat.html" page of the +// official SQLite documentation. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbstat.c ********************************************* +//************* Begin file dbpage.c ***************************************** +// 2017-10-11 +// +// The author disclaims copyright to this source code. In place of +// a legal notice, here is a blessing: +// +// May you do good and not evil. +// May you find forgiveness for yourself and forgive others. +// May you share freely, never taking more than you give. +// +// +// +// This file contains an implementation of the "sqlite_dbpage" virtual table. +// +// The sqlite_dbpage virtual table is used to read or write whole raw +// pages of the database file. The pager interface is used so that +// uncommitted changes and changes recorded in the WAL file are correctly +// retrieved. +// +// Usage example: +// +// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; +// +// This is an eponymous virtual table so it does not need to be created before +// use. The optional argument to the sqlite_dbpage() table name is the +// schema for the database file that is to be read. The default schema is +// "main". +// +// The data field of sqlite_dbpage table can be updated. The new +// value must be a BLOB which is the correct page size, otherwise the +// update fails. Rows may not be deleted or inserted. + +// #include "sqliteInt.h" ** Requires access to internal data structures ** + +//************* End of dbpage.c ********************************************* +//************* Begin file sqlite3session.c ********************************* + +// #include "sqlite3session.h" +// #include +// #include + +type SessionTable = SessionTable1 /* sqlite3.c:206655:29 */ +type SessionChange1 = struct { + Fop U8 + FbIndirect U8 + _ [2]byte + FnMaxSize int32 + FnRecord int32 + _ [4]byte + FaRecord uintptr + FpNext uintptr +} /* sqlite3.c:11155:9 */ + +type SessionChange = SessionChange1 /* sqlite3.c:206656:30 */ +type SessionBuffer1 = struct { + FaBuf uintptr + FnBuf int32 + FnAlloc int32 +} /* sqlite3.c:11163:9 */ + +type SessionBuffer = SessionBuffer1 /* sqlite3.c:206657:30 */ +type SessionInput1 = struct { + FbNoDiscard int32 + FiCurrent int32 + FiNext int32 + _ [4]byte + FaData uintptr + FnData int32 + _ [4]byte + Fbuf SessionBuffer + FxInput uintptr + FpIn uintptr + FbEof int32 + _ [4]byte +} /* sqlite3.c:11163:9 */ + +type SessionInput = SessionInput1 /* sqlite3.c:206658:29 */ + +// Minimum chunk size used by streaming versions of functions. + +var sessions_strm_chunk_size int32 = SESSIONS_STRM_CHUNK_SIZE /* sqlite3.c:206671:12 */ + +type SessionHook1 = struct { + FpCtx uintptr + FxOld uintptr + FxNew uintptr + FxCount uintptr + FxDepth uintptr +} /* sqlite3.c:11155:9 */ + +type SessionHook = SessionHook1 /* sqlite3.c:206673:28 */ + +// Write a varint with value iVal into the buffer at aBuf. Return the +// number of bytes written. +func sessionVarintPut(tls *libc.TLS, aBuf uintptr, iVal int32) int32 { /* sqlite3.c:206951:12: */ + return int32(func() uint8 { + if (U32(iVal)) < U32(0x80) { + return uint8(func() int32 { *(*U8)(unsafe.Pointer(aBuf)) = uint8(iVal); return 1 }()) + } + return uint8(Xsqlite3PutVarint(tls, aBuf, uint64(iVal))) + }()) +} + +// Return the number of bytes required to store value iVal as a varint. +func sessionVarintLen(tls *libc.TLS, iVal int32) int32 { /* sqlite3.c:206958:12: */ + return Xsqlite3VarintLen(tls, uint64(iVal)) +} + +// Read a varint value from aBuf[] into *piVal. Return the number of +// bytes read. +func sessionVarintGet(tls *libc.TLS, aBuf uintptr, piVal uintptr) int32 { /* sqlite3.c:206966:12: */ + return int32(func() uint8 { + if int32(*(*U8)(unsafe.Pointer(aBuf))) < int32(U8(0x80)) { + return uint8(func() int32 { (*(*int32)(unsafe.Pointer(piVal))) = int32(U32(*(*U8)(unsafe.Pointer(aBuf)))); return 1 }()) + } + return Xsqlite3GetVarint32(tls, aBuf, piVal) + }()) +} + +// Load an unaligned and unsigned 32-bit integer + +// Read a 64-bit big-endian integer value from buffer aRec[]. Return +// the value read. +func sessionGetI64(tls *libc.TLS, aRec uintptr) Sqlite3_int64 { /* sqlite3.c:206977:22: */ + var x U64 = (U64((((U32(*(*U8)(unsafe.Pointer((aRec)))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec) + 3))))) + var y U32 = ((((U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4))))) << 24) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 1))) << 16))) | (U32(int32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 2))) << 8))) | U32(*(*U8)(unsafe.Pointer((aRec + uintptr(4)) + 3)))) + x = ((x << 32) + U64(y)) + return Sqlite3_int64(x) +} + +// Write a 64-bit big-endian integer value to the buffer aBuf[]. +func sessionPutI64(tls *libc.TLS, aBuf uintptr, i Sqlite3_int64) { /* sqlite3.c:206987:13: */ + *(*U8)(unsafe.Pointer(aBuf)) = (U8((i >> 56) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 1)) = (U8((i >> 48) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 2)) = (U8((i >> 40) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 3)) = (U8((i >> 32) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 4)) = (U8((i >> 24) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 5)) = (U8((i >> 16) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 6)) = (U8((i >> 8) & int64(0xFF))) + *(*U8)(unsafe.Pointer(aBuf + 7)) = (U8((i >> 0) & int64(0xFF))) +} + +// This function is used to serialize the contents of value pValue (see +// comment titled "RECORD FORMAT" above). +// +// If it is non-NULL, the serialized form of the value is written to +// buffer aBuf. *pnWrite is set to the number of bytes written before +// returning. Or, if aBuf is NULL, the only thing this function does is +// set *pnWrite. +// +// If no error occurs, SQLITE_OK is returned. Or, if an OOM error occurs +// within a call to sqlite3_value_text() (may fail if the db is utf-16)) +// SQLITE_NOMEM is returned. +func sessionSerializeValue(tls *libc.TLS, aBuf uintptr, pValue uintptr, pnWrite uintptr) int32 { /* sqlite3.c:207011:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var nByte int32 // Size of serialized value in bytes + + if pValue != 0 { + var eType int32 // Value type (SQLITE_NULL, TEXT etc.) + + eType = Xsqlite3_value_type(tls, pValue) + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(eType) + } + + switch eType { + case SQLITE_NULL: + nByte = 1 + break + fallthrough + + case SQLITE_INTEGER: + fallthrough + case SQLITE_FLOAT: + if aBuf != 0 { + // TODO: SQLite does something special to deal with mixed-endian + // floating point values (e.g. ARM7). This code probably should + // too. + // var i U64 at bp, 8 + + if eType == SQLITE_INTEGER { + *(*U64)(unsafe.Pointer(bp /* i */)) = U64(Xsqlite3_value_int64(tls, pValue)) + } else { + // var r float64 at bp+8, 8 + + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_value_double(tls, pValue) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, (aBuf + 1), int64(*(*U64)(unsafe.Pointer(bp /* i */)))) + } + nByte = 9 + break + fallthrough + + default: + { + var z uintptr + var n int32 + var nVarint int32 + + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, pValue) + } else { + z = Xsqlite3_value_blob(tls, pValue) + } + n = Xsqlite3_value_bytes(tls, pValue) + if (z == uintptr(0)) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + nVarint = sessionVarintLen(tls, n) + + if aBuf != 0 { + sessionVarintPut(tls, (aBuf + 1), n) + if n != 0 { + libc.Xmemcpy(tls, (aBuf + uintptr((nVarint + 1))), z, uint64(n)) + } + } + + nByte = ((1 + nVarint) + n) + break + + } + } + } else { + nByte = 1 + if aBuf != 0 { + *(*U8)(unsafe.Pointer(aBuf)) = U8(0) + } + } + + if pnWrite != 0 { + *(*Sqlite3_int64)(unsafe.Pointer(pnWrite)) += (Sqlite3_int64(nByte)) + } + return SQLITE_OK +} + +// Allocate and return a pointer to a buffer nByte bytes in size. If +// pSession is not NULL, increase the sqlite3_session.nMalloc variable +// by the number of bytes allocated. +func sessionMalloc64(tls *libc.TLS, pSession uintptr, nByte I64) uintptr { /* sqlite3.c:207087:13: */ + var pRet uintptr = Xsqlite3_malloc64(tls, uint64(nByte)) + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) += I64((Xsqlite3_msize(tls, pRet))) + } + return pRet +} + +// Free buffer pFree, which must have been allocated by an earlier +// call to sessionMalloc64(). If pSession is not NULL, decrease the +// sqlite3_session.nMalloc counter by the number of bytes freed. +func sessionFree(tls *libc.TLS, pSession uintptr, pFree uintptr) { /* sqlite3.c:207098:13: */ + if pSession != 0 { + *(*I64)(unsafe.Pointer(pSession + 56 /* &.nMalloc */)) -= I64((Xsqlite3_msize(tls, pFree))) + } + Xsqlite3_free(tls, pFree) +} + +// This macro is used to calculate hash key values for data structures. In +// order to use this macro, the entire data structure must be represented +// as a series of unsigned integers. In order to calculate a hash-key value +// for a data structure represented as three such integers, the macro may +// then be used as follows: +// +// int hash_key_value; +// hash_key_value = HASH_APPEND(0, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// hash_key_value = HASH_APPEND(hash_key_value, ); +// +// In practice, the data structures this macro is used for are the primary +// key values of modified rows. + +// Append the hash of the 64-bit integer passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendI64(tls *libc.TLS, h uint32, i I64) uint32 { /* sqlite3.c:207124:21: */ + h = ((((h) << 3) ^ (h)) ^ (uint32(i & int64(0xFFFFFFFF)))) + return ((((h) << 3) ^ (h)) ^ (uint32((i >> 32) & int64(0xFFFFFFFF)))) +} + +// Append the hash of the blob passed via the second and third arguments to +// the hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendBlob(tls *libc.TLS, h uint32, n int32, z uintptr) uint32 { /* sqlite3.c:207133:21: */ + var i int32 + for i = 0; i < n; i++ { + h = ((((h) << 3) ^ (h)) ^ (uint32(*(*U8)(unsafe.Pointer(z + uintptr(i)))))) + } + return h +} + +// Append the hash of the data type passed as the second argument to the +// hash-key value passed as the first. Return the new hash-key value. +func sessionHashAppendType(tls *libc.TLS, h uint32, eType int32) uint32 { /* sqlite3.c:207143:21: */ + return ((((h) << 3) ^ (h)) ^ (uint32(eType))) +} + +// This function may only be called from within a pre-update callback. +// It calculates a hash based on the primary key values of the old.* or +// new.* row currently available and, assuming no error occurs, writes it to +// *piHash before returning. If the primary key contains one or more NULL +// values, *pbNullPK is set to true before returning. +// +// If an error occurs, an SQLite error code is returned and the final values +// of *piHash asn *pbNullPK are undefined. Otherwise, SQLITE_OK is returned +// and the output variables are set as described above. +func sessionPreupdateHash(tls *libc.TLS, pSession uintptr, pTab uintptr, bNew int32, piHash uintptr, pbNullPK uintptr) int32 { /* sqlite3.c:207158:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var h uint32 = uint32(0) // Hash value to return + var i int32 // Used to iterate through columns + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0 { + var rc int32 + var eType int32 + // var pVal uintptr at bp, 8 + + if bNew != 0 { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } else { + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp /* &pVal */) + } + if rc != SQLITE_OK { + return rc + } + + eType = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var iVal I64 at bp+8, 8 + + if eType == SQLITE_INTEGER { + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)) = Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + + libc.Xmemcpy(tls, bp+8 /* &iVal */, bp+16 /* &rVal */, uint64(8)) + } + h = sessionHashAppendI64(tls, h, *(*I64)(unsafe.Pointer(bp + 8 /* iVal */))) + } else if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + var z uintptr + var n int32 + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + n = Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + if !(z != 0) && ((eType != SQLITE_BLOB) || (n > 0)) { + return SQLITE_NOMEM + } + h = sessionHashAppendBlob(tls, h, n, z) + } else { + + *(*int32)(unsafe.Pointer(pbNullPK)) = 1 + } + } + } + + *(*int32)(unsafe.Pointer(piHash)) = (int32(h % uint32((*SessionTable)(unsafe.Pointer(pTab)).FnChange))) + return SQLITE_OK +} + +// The buffer that the argument points to contains a serialized SQL value. +// Return the number of bytes of space occupied by the value (including +// the type byte). +func sessionSerialLen(tls *libc.TLS, a uintptr) int32 { /* sqlite3.c:207223:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var e int32 = int32(*(*U8)(unsafe.Pointer(a))) + // var n int32 at bp, 4 + + if (e == 0) || (e == 0xFF) { + return 1 + } + if e == SQLITE_NULL { + return 1 + } + if (e == SQLITE_INTEGER) || (e == SQLITE_FLOAT) { + return 9 + } + return ((sessionVarintGet(tls, (a+1), bp /* &n */) + 1) + *(*int32)(unsafe.Pointer(bp /* n */))) +} + +// Based on the primary key values stored in change aRecord, calculate a +// hash key. Assume the has table has nBucket buckets. The hash keys +// calculated by this function are compatible with those calculated by +// sessionPreupdateHash(). +// +// The bPkOnly argument is non-zero if the record at aRecord[] is from +// a patchset DELETE. In this case the non-PK fields are omitted entirely. +func sessionChangeHash(tls *libc.TLS, pTab uintptr, bPkOnly int32, aRecord uintptr, nBucket int32) uint32 { /* sqlite3.c:207241:21: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var h uint32 = uint32(0) // Value to return + var i int32 // Used to iterate through columns + var a uintptr = aRecord // Used to iterate through change record + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(a))) + var isPK int32 = int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) + if (bPkOnly != 0) && (isPK == 0) { + continue + } + + // It is not possible for eType to be SQLITE_NULL here. The session + // module does not record changes for rows with NULL values stored in + // primary key columns. + + if isPK != 0 { + a++ + h = sessionHashAppendType(tls, h, eType) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + h = sessionHashAppendI64(tls, h, sessionGetI64(tls, a)) + a += uintptr(8) + } else { + // var n int32 at bp, 4 + + a += uintptr(sessionVarintGet(tls, a, bp /* &n */)) + h = sessionHashAppendBlob(tls, h, *(*int32)(unsafe.Pointer(bp /* n */)), a) + a += uintptr(*(*int32)(unsafe.Pointer(bp /* n */))) + } + } else { + a += uintptr(sessionSerialLen(tls, a)) + } + } + return (h % uint32(nBucket)) +} + +// Arguments aLeft and aRight are pointers to change records for table pTab. +// This function returns true if the two records apply to the same row (i.e. +// have the same values stored in the primary key columns), or false +// otherwise. +func sessionChangeEqual(tls *libc.TLS, pTab uintptr, bLeftPkOnly int32, aLeft uintptr, bRightPkOnly int32, aRight uintptr) int32 { /* sqlite3.c:207290:12: */ + var a1 uintptr = aLeft // Cursor to iterate through aLeft + var a2 uintptr = aRight // Cursor to iterate through aRight + var iCol int32 // Used to iterate through table columns + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol))) != 0 { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + + if (n1 != n2) || (libc.Xmemcmp(tls, a1, a2, uint64(n1)) != 0) { + return 0 + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } else { + if bLeftPkOnly == 0 { + a1 += uintptr(sessionSerialLen(tls, a1)) + } + if bRightPkOnly == 0 { + a2 += uintptr(sessionSerialLen(tls, a2)) + } + } + } + + return 1 +} + +// Arguments aLeft and aRight both point to buffers containing change +// records with nCol columns. This function "merges" the two records into +// a single records which is written to the buffer at *paOut. *paOut is +// then set to point to one byte after the last byte written before +// returning. +// +// The merging of records is done as follows: For each column, if the +// aRight record contains a value for the column, copy the value from +// their. Otherwise, if aLeft contains a value, copy it. If neither +// record contains a value for a given column, then neither does the +// output record. +func sessionMergeRecord(tls *libc.TLS, paOut uintptr, nCol int32, aLeft uintptr, aRight uintptr) { /* sqlite3.c:207333:13: */ + var a1 uintptr = aLeft // Cursor used to iterate through aLeft + var a2 uintptr = aRight // Cursor used to iterate through aRight + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) // Output cursor + var iCol int32 // Used to iterate from 0 to nCol + + for iCol = 0; iCol < nCol; iCol++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + libc.Xmemcpy(tls, aOut, a2, uint64(n2)) + aOut += uintptr(n2) + } else { + libc.Xmemcpy(tls, aOut, a1, uint64(n1)) + aOut += uintptr(n1) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut +} + +// This is a helper function used by sessionMergeUpdate(). +// +// When this function is called, both *paOne and *paTwo point to a value +// within a change record. Before it returns, both have been advanced so +// as to point to the next value in the record. +// +// If, when this function is called, *paTwo points to a valid value (i.e. +// *paTwo[0] is not 0x00 - the "no value" placeholder), a copy of the *paTwo +// pointer is returned and *pnVal is set to the number of bytes in the +// serialized value. Otherwise, a copy of *paOne is returned and *pnVal +// set to the number of bytes in the value at *paOne. If *paOne points +// to the "no value" placeholder, *pnVal is set to 1. In other words: +// +// if( *paTwo is valid ) return *paTwo; +// return *paOne; +// +func sessionMergeValue(tls *libc.TLS, paOne uintptr, paTwo uintptr, pnVal uintptr) uintptr { /* sqlite3.c:207379:11: */ + var a1 uintptr = *(*uintptr)(unsafe.Pointer(paOne)) + var a2 uintptr = *(*uintptr)(unsafe.Pointer(paTwo)) + var pRet uintptr = uintptr(0) + var n1 int32 + + if a2 != 0 { + var n2 int32 = sessionSerialLen(tls, a2) + if *(*U8)(unsafe.Pointer(a2)) != 0 { + *(*int32)(unsafe.Pointer(pnVal)) = n2 + pRet = a2 + } + *(*uintptr)(unsafe.Pointer(paTwo)) = (a2 + uintptr(n2)) + } + + n1 = sessionSerialLen(tls, a1) + if pRet == uintptr(0) { + *(*int32)(unsafe.Pointer(pnVal)) = n1 + pRet = a1 + } + *(*uintptr)(unsafe.Pointer(paOne)) = (a1 + uintptr(n1)) + + return pRet +} + +// This function is used by changeset_concat() to merge two UPDATE changes +// on the same row. +func sessionMergeUpdate(tls *libc.TLS, paOut uintptr, pTab uintptr, bPatchset int32, aOldRecord1 uintptr, aOldRecord2 uintptr, aNewRecord1 uintptr, aNewRecord2 uintptr) int32 { /* sqlite3.c:207413:12: */ + bp := tls.Alloc(52) + defer tls.Free(52) + + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + + var aOut uintptr = *(*uintptr)(unsafe.Pointer(paOut)) + var i int32 + + if bPatchset == 0 { + var bRequired int32 = 0 + + // Write the old.* vector first. + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+16, 4 + + var aOld uintptr + // var nNew int32 at bp+40, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+16 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+40 /* &nNew */) + if ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)) != *(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) || (libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nNew */)))) != 0) { + if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + bRequired = 1 + } + libc.Xmemcpy(tls, aOut, aOld, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* nOld */))) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } + } + + if !(bRequired != 0) { + return 0 + } + } + + // Write the new.* vector + *(*uintptr)(unsafe.Pointer(bp /* aOld1 */)) = aOldRecord1 + *(*uintptr)(unsafe.Pointer(bp + 8 /* aOld2 */)) = aOldRecord2 + *(*uintptr)(unsafe.Pointer(bp + 24 /* aNew1 */)) = aNewRecord1 + *(*uintptr)(unsafe.Pointer(bp + 32 /* aNew2 */)) = aNewRecord2 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + // var nOld int32 at bp+44, 4 + + var aOld uintptr + // var nNew int32 at bp+48, 4 + + var aNew uintptr + + aOld = sessionMergeValue(tls, bp /* &aOld1 */, bp+8 /* &aOld2 */, bp+44 /* &nOld */) + aNew = sessionMergeValue(tls, bp+24 /* &aNew1 */, bp+32 /* &aNew2 */, bp+48 /* &nNew */) + if (bPatchset == 0) && + ((*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) || ((*(*int32)(unsafe.Pointer(bp + 44 /* nOld */)) == *(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) && (0 == libc.Xmemcmp(tls, aOld, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))))))) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aOut, 1))) = U8(0) + } else { + libc.Xmemcpy(tls, aOut, aNew, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */)))) + aOut += uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* nNew */))) + } + } + + *(*uintptr)(unsafe.Pointer(paOut)) = aOut + return 1 +} + +// This function is only called from within a pre-update-hook callback. +// It determines if the current pre-update-hook change affects the same row +// as the change stored in argument pChange. If so, it returns true. Otherwise +// if the pre-update-hook does not affect the same row as pChange, it returns +// false. +func sessionPreupdateEqual(tls *libc.TLS, pSession uintptr, pTab uintptr, pChange uintptr, op int32) int32 { /* sqlite3.c:207490:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + var iCol int32 // Used to iterate through columns + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord // Cursor used to scan change record + + for iCol = 0; iCol < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; iCol++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(iCol)))) != 0) { + a += uintptr(sessionSerialLen(tls, a)) + } else { + // var pVal uintptr at bp, 8 + // Value returned by preupdate_new/old + var rc int32 + _ = rc // Error code from preupdate_new/old + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) // Type of value from change record + + // The following calls to preupdate_new() and preupdate_old() can not + // fail. This is because they cache their return values, and by the + // time control flows to here they have already been called once from + // within sessionPreupdateHash(). The first two asserts below verify + // this (that the method has already been called). + if op == SQLITE_INSERT { + // assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } else { + // assert( db->pPreUpdate->pUnpacked ); + rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, iCol, bp /* &pVal */) + } + + if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != eType { + return 0 + } + + // A SessionChange object never has a NULL value in a PK column + + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, a) + a += uintptr(8) + if eType == SQLITE_INTEGER { + if Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*I64)(unsafe.Pointer(bp + 16 /* iVal */)) { + return 0 + } + } else { + // var rVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &rVal */, bp+16 /* &iVal */, uint64(8)) + if Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)) { + return 0 + } + } + } else { + // var n int32 at bp+24, 4 + + var z uintptr + a += uintptr(sessionVarintGet(tls, a, bp+24 /* &n */)) + if Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) != *(*int32)(unsafe.Pointer(bp + 24 /* n */)) { + return 0 + } + if eType == SQLITE_TEXT { + z = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } else { + z = Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + if (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) > 0) && (libc.Xmemcmp(tls, a, z, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))) != 0) { + return 0 + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* n */))) + } + } + } + + return 1 +} + +// If required, grow the hash table used to store changes on table pTab +// (part of the session pSession). If a fatal OOM error occurs, set the +// session object to failed and return SQLITE_ERROR. Otherwise, return +// SQLITE_OK. +// +// It is possible that a non-fatal OOM error occurs in this function. In +// that case the hash-table does not grow, but SQLITE_OK is returned anyway. +// Growing the hash table in this case is a performance optimization only, +// it is not required for correct operation. +func sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uintptr) int32 { /* sqlite3.c:207569:12: */ + if ((*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FnEntry >= ((*SessionTable)(unsafe.Pointer(pTab)).FnChange / 2)) { + var i int32 + var apNew uintptr + var nNew Sqlite3_int64 = (int64(2) * (func() int64 { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange != 0 { + return int64((*SessionTable)(unsafe.Pointer(pTab)).FnChange) + } + return int64(128) + }())) + + apNew = sessionMalloc64(tls, + pSession, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew)))) + if apNew == uintptr(0) { + if (*SessionTable)(unsafe.Pointer(pTab)).FnChange == 0 { + return SQLITE_ERROR + } + return SQLITE_OK + } + libc.Xmemset(tls, apNew, 0, (uint64(unsafe.Sizeof(uintptr(0))) * uint64(nNew))) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNext uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNext { + var bPkOnly int32 = (libc.Bool32((int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_DELETE) && (bPatchset != 0))) + var iHash int32 = int32(sessionChangeHash(tls, pTab, bPkOnly, (*SessionChange)(unsafe.Pointer(p)).FaRecord, int32(nNew))) + pNext = (*SessionChange)(unsafe.Pointer(p)).FpNext + (*SessionChange)(unsafe.Pointer(p)).FpNext = *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer(apNew + uintptr(iHash)*8)) = p + } + } + + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + (*SessionTable)(unsafe.Pointer(pTab)).FnChange = int32(nNew) + (*SessionTable)(unsafe.Pointer(pTab)).FapChange = apNew + } + + return SQLITE_OK +} + +// This function queries the database for the names of the columns of table +// zThis, in schema zDb. +// +// Otherwise, if they are not NULL, variable *pnCol is set to the number +// of columns in the database table and variable *pzTab is set to point to a +// nul-terminated copy of the table name. *pazCol (if not NULL) is set to +// point to an array of pointers to column names. And *pabPK (again, if not +// NULL) is set to point to an array of booleans - true if the corresponding +// column is part of the primary key. +// +// For example, if the table is declared as: +// +// CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +// +// Then the four output variables are populated as follows: +// +// *pnCol = 4 +// *pzTab = "tbl1" +// *pazCol = {"w", "x", "y", "z"} +// *pabPK = {1, 0, 0, 1} +// +// All returned buffers are part of the same single allocation, which must +// be freed using sqlite3_free() by the caller +func sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, zThis uintptr, pnCol uintptr, pzTab uintptr, pazCol uintptr, pabPK uintptr) int32 { /* sqlite3.c:207635:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var zPragma uintptr + // var pStmt uintptr at bp+16, 8 + + var rc int32 + var nByte Sqlite3_int64 + var nDbCol int32 = 0 + var nThis int32 + var i int32 + var pAlloc uintptr = uintptr(0) + var azCol uintptr = uintptr(0) + var abPK uintptr = uintptr(0) + + nThis = Xsqlite3Strlen30(tls, zThis) + if (nThis == 12) && (0 == Xsqlite3_stricmp(tls, ts+11434 /* "sqlite_stat1" */, zThis)) { + rc = Xsqlite3_table_column_metadata(tls, db, zDb, zThis, uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + // For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. + zPragma = Xsqlite3_mprintf(tls, + + ts+31930 /* "SELECT 0, 'tbl',..." */, 0) + } else if rc == SQLITE_ERROR { + zPragma = Xsqlite3_mprintf(tls, ts+755 /* "" */, 0) + } else { + return rc + } + } else { + zPragma = Xsqlite3_mprintf(tls, ts+32051 /* "PRAGMA '%q'.tabl..." */, libc.VaList(bp, zDb, zThis)) + } + if !(zPragma != 0) { + return SQLITE_NOMEM + } + + rc = Xsqlite3_prepare_v2(tls, db, zPragma, -1, bp+16 /* &pStmt */, uintptr(0)) + Xsqlite3_free(tls, zPragma) + if rc != SQLITE_OK { + return rc + } + + nByte = (Sqlite3_int64(nThis + 1)) + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + nByte = nByte + (Sqlite3_int64(Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1))) + nDbCol++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + if rc == SQLITE_OK { + nByte = Sqlite3_int64(uint64(nByte) + (uint64(nDbCol) * ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))) + uint64(1)))) + pAlloc = sessionMalloc64(tls, pSession, nByte) + if pAlloc == uintptr(0) { + rc = SQLITE_NOMEM + } + } + if rc == SQLITE_OK { + azCol = pAlloc + pAlloc = (azCol + uintptr(nDbCol)*8) + abPK = pAlloc + pAlloc = (abPK + uintptr(nDbCol)) + if pzTab != 0 { + libc.Xmemcpy(tls, pAlloc, zThis, (uint64(nThis + 1))) + *(*uintptr)(unsafe.Pointer(pzTab)) = pAlloc + pAlloc += (uintptr(nThis + 1)) + } + + i = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) { + var nName int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + var zName uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1) + if zName == uintptr(0) { + break + } + libc.Xmemcpy(tls, pAlloc, zName, (uint64(nName + 1))) + *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = pAlloc + pAlloc += (uintptr(nName + 1)) + *(*U8)(unsafe.Pointer(abPK + uintptr(i))) = U8(Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 5)) + i++ + } + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + + } + + // If successful, populate the output variables. Otherwise, zero them and + // free any allocation made. An error code will be returned in this case. + if rc == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pazCol)) = azCol + *(*uintptr)(unsafe.Pointer(pabPK)) = abPK + *(*int32)(unsafe.Pointer(pnCol)) = nDbCol + } else { + *(*uintptr)(unsafe.Pointer(pazCol)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(pabPK)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnCol)) = 0 + if pzTab != 0 { + *(*uintptr)(unsafe.Pointer(pzTab)) = uintptr(0) + } + sessionFree(tls, pSession, azCol) + } + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) + return rc +} + +// This function is only called from within a pre-update handler for a +// write to table pTab, part of session pSession. If this is the first +// write to this table, initalize the SessionTable.nCol, azCol[] and +// abPK[] arrays accordingly. +// +// If an error occurs, an error code is stored in sqlite3_session.rc and +// non-zero returned. Or, if no error occurs but the table has no primary +// key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to +// indicate that updates on this table should be ignored. SessionTable.abPK +// is set to NULL in this case. +func sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr) int32 { /* sqlite3.c:207752:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + if (*SessionTable)(unsafe.Pointer(pTab)).FnCol == 0 { + // var abPK uintptr at bp, 8 + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionTableInfo(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, + (*SessionTable)(unsafe.Pointer(pTab)).FzName, (pTab + 16 /* &.nCol */), uintptr(0), (pTab + 24 /* &.azCol */), bp /* &abPK */) + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc == SQLITE_OK { + var i int32 + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + if *(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* abPK */)) + uintptr(i))) != 0 { + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = *(*uintptr)(unsafe.Pointer(bp /* abPK */)) + break + } + } + if 0 == Xsqlite3_stricmp(tls, ts+11434 /* "sqlite_stat1" */, (*SessionTable)(unsafe.Pointer(pTab)).FzName) { + (*SessionTable)(unsafe.Pointer(pTab)).FbStat1 = 1 + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += I64((((Size_t((1 + sessionVarintLen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol)) + libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + uint64(1))) + } + } + } + return (libc.Bool32(((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) || ((*SessionTable)(unsafe.Pointer(pTab)).FabPK == uintptr(0)))) +} + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx1 = struct { + Fhook SessionHook + FpSession uintptr +} /* sqlite3.c:207787:9 */ + +// Versions of the four methods in object SessionHook for use with the +// sqlite_stat1 table. The purpose of this is to substitute a zero-length +// blob each time a NULL value is read from the "idx" column of the +// sqlite_stat1 table. +type SessionStat1Ctx = SessionStat1Ctx1 /* sqlite3.c:207787:32 */ + +func sessionStat1Old(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207792:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 8 /* &.xOld */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1New(tls *libc.TLS, pCtx uintptr, iCol int32, ppVal uintptr) int32 { /* sqlite3.c:207802:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = uintptr(0) + var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 16 /* &.xNew */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx, iCol, bp /* &pVal */) + if ((rc == SQLITE_OK) && (iCol == 1)) && (Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp /* pVal */))) == SQLITE_NULL) { + *(*uintptr)(unsafe.Pointer(bp /* pVal */)) = (*Sqlite3_session)(unsafe.Pointer((*SessionStat1Ctx)(unsafe.Pointer(p)).FpSession)).FpZeroBlob + } + *(*uintptr)(unsafe.Pointer(ppVal)) = *(*uintptr)(unsafe.Pointer(bp /* pVal */)) + return rc +} + +func sessionStat1Count(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207812:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 24 /* &.xCount */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionStat1Depth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:207816:12: */ + var p uintptr = pCtx + return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((p /* &.hook */ + 32 /* &.xDepth */))))(tls, (*SessionStat1Ctx)(unsafe.Pointer(p)).Fhook.FpCtx) +} + +func sessionUpdateMaxSize(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, pC uintptr) int32 { /* sqlite3.c:207821:12: */ + bp := tls.Alloc(44) + defer tls.Free(44) + + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = int64(2) + if int32((*SessionChange)(unsafe.Pointer(pC)).Fop) == SQLITE_INSERT { + if op != SQLITE_DELETE { + var ii int32 + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + *(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp /* &p */) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp /* p */)), bp+8 /* &nNew */) + } + } + } else if op == SQLITE_DELETE { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + if Xsqlite3_preupdate_blobwrite(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb) >= 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord) + } + } else { + var ii int32 + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(pC)).FaRecord + for ii = 0; ii < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; ii++ { + var bChanged int32 = 1 + var nOld int32 = 0 + var eType int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) = uintptr(0) + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, ii, bp+16 /* &p */) + if *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)) == uintptr(0) { + return SQLITE_NOMEM + } + + eType = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pCsr, 1)))) + switch eType { + case SQLITE_NULL: + bChanged = (libc.Bool32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) != SQLITE_NULL)) + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + if eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) = sessionGetI64(tls, pCsr) + if eType == SQLITE_INTEGER { + bChanged = (libc.Bool32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 32 /* iVal */)) != Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } else { + // var dVal float64 at bp+24, 8 + + libc.Xmemcpy(tls, bp+24 /* &dVal */, bp+32 /* &iVal */, uint64(8)) + bChanged = (libc.Bool32(*(*float64)(unsafe.Pointer(bp + 24 /* dVal */)) != Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) + } + } + nOld = 8 + pCsr += uintptr(8) + break + + } + fallthrough + + default: + { + // var nByte int32 at bp+40, 4 + + nOld = sessionVarintGet(tls, pCsr, bp+40 /* &nByte */) + pCsr += uintptr(nOld) + nOld = nOld + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + + if ((eType == Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)))) && + (*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))))) && + ((*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)) == 0) || (0 == libc.Xmemcmp(tls, pCsr, Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p */))), uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))) { + bChanged = 0 + } + pCsr += uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */))) + break + + } + } + + if (bChanged != 0) && (*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0) { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) = (I64((*SessionChange)(unsafe.Pointer(pC)).FnRecord + 2)) + break + } + + if bChanged != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(1 + nOld)) + sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* p */)), bp+8 /* &nNew */) + } else if *(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(ii))) != 0 { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += (I64(2 + nOld)) + } else { + *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) += int64(2) + } + } + } + + if *(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) > I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize) { + var nIncr int32 = (int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */)) - I64((*SessionChange)(unsafe.Pointer(pC)).FnMaxSize))) + (*SessionChange)(unsafe.Pointer(pC)).FnMaxSize = int32(*(*I64)(unsafe.Pointer(bp + 8 /* nNew */))) + *(*I64)(unsafe.Pointer(pSession + 64 /* &.nMaxChangesetSize */)) += (I64(nIncr)) + } + return SQLITE_OK +} + +// This function is only called from with a pre-update-hook reporting a +// change on table pTab (attached to session pSession). The type of change +// (UPDATE, INSERT, DELETE) is specified by the first argument. +// +// Unless one is already present or an error occurs, an entry is added +// to the changed-rows hash table associated with table pTab. +func sessionPreupdateOneChange(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr) { /* sqlite3.c:207927:13: */ + bp := tls.Alloc(80) + defer tls.Free(80) + + // var iHash int32 at bp+48, 4 + + // var bNull int32 at bp+52, 4 + + var rc int32 + // var stat1 SessionStat1Ctx at bp, 48 + + var p uintptr + // var p1 uintptr at bp+56, 8 + + // var p2 uintptr at bp+72, 8 + + // Create a new change object containing all the old values (if + // this is an SQLITE_UPDATE or SQLITE_DELETE), or just the PK + // values (if this is an INSERT). + // var nByte Sqlite3_int64 at bp+64, 8 + // Number of bytes to allocate + var i int32 + // Search the hash table for an existing record for this row. + var pC uintptr + *(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) = 0 + rc = SQLITE_OK + *(*SessionStat1Ctx)(unsafe.Pointer(bp /* stat1 */)) = SessionStat1Ctx{} + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0) { + goto __1 + } + return +__1: + ; + + // Load table details if required + if !(sessionInitTable(tls, pSession, pTab) != 0) { + goto __2 + } + return +__2: + ; + + // Check the number of columns in this xPreUpdate call matches the + // number of columns in the table. + if !((*SessionTable)(unsafe.Pointer(pTab)).FnCol != (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 24 /* &.xCount */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx)) { + goto __3 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_SCHEMA + return +__3: + ; + + // Grow the hash table if required + if !(sessionGrowHash(tls, pSession, 0, pTab) != 0) { + goto __4 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = SQLITE_NOMEM + return +__4: + ; + + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __5 + } + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook + (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).FpSession = pSession + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = bp /* &stat1 */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1New})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionStat1Old})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Count})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionStat1Depth})) + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob == uintptr(0)) { + goto __6 + } + p = Xsqlite3ValueNew(tls, uintptr(0)) + if !(p == uintptr(0)) { + goto __7 + } + rc = SQLITE_NOMEM + goto error_out +__7: + ; + Xsqlite3ValueSetStr(tls, p, 0, ts+755 /* "" */, uint8(0), uintptr(0)) + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob = p +__6: + ; +__5: + ; + + // Calculate the hash-key for this change. If the primary key of the row + // includes a NULL value, exit early. Such changes are ignored by the + // session module. + rc = sessionPreupdateHash(tls, pSession, pTab, (libc.Bool32(op == SQLITE_INSERT)), bp+48 /* &iHash */, bp+52 /* &bNull */) + if !(rc != SQLITE_OK) { + goto __8 + } + goto error_out +__8: + ; + + if !(*(*int32)(unsafe.Pointer(bp + 52 /* bNull */)) == 0) { + goto __9 + } + pC = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) +__10: + if !(pC != 0) { + goto __12 + } + if !(sessionPreupdateEqual(tls, pSession, pTab, pC, op) != 0) { + goto __13 + } + goto __12 +__13: + ; + goto __11 +__11: + pC = (*SessionChange)(unsafe.Pointer(pC)).FpNext + goto __10 + goto __12 +__12: + ; + + if !(pC == uintptr(0)) { + goto __14 + } // Used to iterate through columns + + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + + // Figure out how large an allocation is required + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = Sqlite3_int64(unsafe.Sizeof(SessionChange{})) + i = 0 +__16: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __18 + } + *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __19 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + + goto __20 +__19: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __21 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+56 /* &p1 */) + +__21: + ; +__20: + ; + + // This may fail if SQLite value p contains a utf-16 string that must + // be converted to utf-8 and an OOM error occurs while doing so. + rc = sessionSerializeValue(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 56 /* p1 */)), bp+64 /* &nByte */) + if !(rc != SQLITE_OK) { + goto __22 + } + goto error_out +__22: + ; + goto __17 +__17: + i++ + goto __16 + goto __18 +__18: + ; + + // Allocate the change object + pC = sessionMalloc64(tls, pSession, *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + if !(!(pC != 0)) { + goto __23 + } + rc = SQLITE_NOMEM + goto error_out + goto __24 +__23: + libc.Xmemset(tls, pC, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pC)).FaRecord = (pC + 1*32) +__24: + ; + + // Populate the change object. None of the preupdate_old(), + // preupdate_new() or SerializeValue() calls below may fail as all + // required values and encodings have already been cached in memory. + // It is not possible for an OOM to occur in this block. + *(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)) = int64(0) + i = 0 +__25: + if !(i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol) { + goto __27 + } + *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)) = uintptr(0) + if !(op != SQLITE_INSERT) { + goto __28 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 8 /* &.xOld */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) + goto __29 +__28: + if !(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i))) != 0) { + goto __30 + } + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 16 /* &.xNew */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx, i, bp+72 /* &p2 */) +__30: + ; +__29: + ; + sessionSerializeValue(tls, ((*SessionChange)(unsafe.Pointer(pC)).FaRecord + uintptr(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */)))), *(*uintptr)(unsafe.Pointer(bp + 72 /* p2 */)), bp+64 /* &nByte */) + goto __26 +__26: + i++ + goto __25 + goto __27 +__27: + ; + + // Add the change to the hash-table + if !(((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect != 0) || ((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) != 0)) { + goto __31 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(1) +__31: + ; + (*SessionChange)(unsafe.Pointer(pC)).FnRecord = int32(*(*Sqlite3_int64)(unsafe.Pointer(bp + 64 /* nByte */))) + (*SessionChange)(unsafe.Pointer(pC)).Fop = U8(op) + (*SessionChange)(unsafe.Pointer(pC)).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(*(*int32)(unsafe.Pointer(bp + 48 /* iHash */)))*8)) = pC + + goto __15 +__14: + if !((*SessionChange)(unsafe.Pointer(pC)).FbIndirect != 0) { + goto __32 + } + // If the existing change is considered "indirect", but this current + // change is "direct", mark the change object as direct. + if !(((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pSession + 96 /* &.hook */ + 32 /* &.xDepth */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx) == 0) && + ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect == 0)) { + goto __33 + } + (*SessionChange)(unsafe.Pointer(pC)).FbIndirect = U8(0) +__33: + ; +__32: + ; +__15: + ; + + if !((*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0) { + goto __34 + } + rc = sessionUpdateMaxSize(tls, op, pSession, pTab, pC) +__34: + ; +__9: + ; + + // If an error has occurred, mark the session object as failed. +error_out: + if !((*SessionTable)(unsafe.Pointer(pTab)).FbStat1 != 0) { + goto __35 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook = (*SessionStat1Ctx)(unsafe.Pointer(bp /* &stat1 */)).Fhook +__35: + ; + if !(rc != SQLITE_OK) { + goto __36 + } + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = rc +__36: +} + +func sessionFindTable(tls *libc.TLS, pSession uintptr, zName uintptr, ppTab uintptr) int32 { /* sqlite3.c:208076:12: */ + var rc int32 = SQLITE_OK + var nName int32 = Xsqlite3Strlen30(tls, zName) + var pRet uintptr + + // Search for an existing table + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pRet != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pRet)).FzName, zName, (nName+1)) { + break + } + } + + if (pRet == uintptr(0)) && ((*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach != 0) { + // If there is a table-filter configured, invoke it. If it returns 0, + // do not automatically add the new table. + if ((*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter == uintptr(0)) || + ((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pSession + 48 /* &.xTableFilter */))))(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx, zName) != 0) { + rc = Xsqlite3session_attach(tls, pSession, zName) + if rc == SQLITE_OK { + for pRet = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*SessionTable)(unsafe.Pointer(pRet)).FpNext != 0; pRet = (*SessionTable)(unsafe.Pointer(pRet)).FpNext { + } + + } + } + } + + *(*uintptr)(unsafe.Pointer(ppTab)) = pRet + return rc +} + +// The 'pre-update' hook registered by this module with SQLite databases. +func xPreUpdate(tls *libc.TLS, pCtx uintptr, db uintptr, op int32, zDb uintptr, zName uintptr, iKey1 Sqlite3_int64, iKey2 Sqlite3_int64) { /* sqlite3.c:208112:13: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var pSession uintptr + var nDb int32 = Xsqlite3Strlen30(tls, zDb) + + for pSession = pCtx; pSession != 0; pSession = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpNext { + // var pTab uintptr at bp, 8 + + // If this session is attached to a different database ("main", "temp" + // etc.), or if it is not currently enabled, there is nothing to do. Skip + // to the next session object attached to this database. + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable == 0 { + continue + } + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + continue + } + if Xsqlite3_strnicmp(tls, zDb, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (nDb+1)) != 0 { + continue + } + + (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc = sessionFindTable(tls, pSession, zName, bp /* &pTab */) + if *(*uintptr)(unsafe.Pointer(bp /* pTab */)) != 0 { + + sessionPreupdateOneChange(tls, op, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + if op == SQLITE_UPDATE { + sessionPreupdateOneChange(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp /* pTab */))) + } + } + } +} + +// The pre-update hook implementations. +func sessionPreupdateOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208150:12: */ + return Xsqlite3_preupdate_old(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208153:12: */ + return Xsqlite3_preupdate_new(tls, pCtx, iVal, ppVal) +} + +func sessionPreupdateCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208156:12: */ + return Xsqlite3_preupdate_count(tls, pCtx) +} + +func sessionPreupdateDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208159:12: */ + return Xsqlite3_preupdate_depth(tls, pCtx) +} + +// Install the pre-update hooks on the session object passed as the only +// argument. +func sessionPreupdateHooks(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208167:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionPreupdateNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionPreupdateDepth})) +} + +type SessionDiffCtx1 = struct { + FpStmt uintptr + FnOldOff int32 + _ [4]byte +} /* sqlite3.c:208177:9 */ + +type SessionDiffCtx = SessionDiffCtx1 /* sqlite3.c:208177:31 */ + +// The diff hook implementations. +func sessionDiffOld(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208186:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, (iVal + (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff)) + return SQLITE_OK +} + +func sessionDiffNew(tls *libc.TLS, pCtx uintptr, iVal int32, ppVal uintptr) int32 { /* sqlite3.c:208191:12: */ + var p uintptr = pCtx + *(*uintptr)(unsafe.Pointer(ppVal)) = Xsqlite3_column_value(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt, iVal) + return SQLITE_OK +} + +func sessionDiffCount(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208196:12: */ + var p uintptr = pCtx + if (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff != 0 { + return (*SessionDiffCtx)(unsafe.Pointer(p)).FnOldOff + } + return Xsqlite3_column_count(tls, (*SessionDiffCtx)(unsafe.Pointer(p)).FpStmt) +} + +func sessionDiffDepth(tls *libc.TLS, pCtx uintptr) int32 { /* sqlite3.c:208200:12: */ + return 0 +} + +// Install the diff hooks on the session object passed as the only +// argument. +func sessionDiffHooks(tls *libc.TLS, pSession uintptr, pDiffCtx uintptr) { /* sqlite3.c:208208:13: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx = pDiffCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxOld = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffOld})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxNew = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{sessionDiffNew})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxCount = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffCount})) + (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FxDepth = *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr) int32 + }{sessionDiffDepth})) +} + +func sessionExprComparePK(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208219:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + zRet = Xsqlite3_mprintf(tls, ts+32080, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 21256 /* " AND " */ + if zRet == uintptr(0) { + break + } + } + } + + return zRet +} + +func sessionExprCompareOther(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTab uintptr, azCol uintptr, abPK uintptr) uintptr { /* sqlite3.c:208242:13: */ + bp := tls.Alloc(64) + defer tls.Free(64) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + var zRet uintptr = uintptr(0) + var bHave int32 = 0 + + for i = 0; i < nCol; i++ { + if int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0 { + bHave = 1 + zRet = Xsqlite3_mprintf(tls, + ts+32114, /* "%z%s\"%w\".\"%w\".\"%..." */ + libc.VaList(bp, zRet, zSep, zDb1, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zDb2, zTab, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)))) + zSep = ts + 32155 /* " OR " */ + if zRet == uintptr(0) { + break + } + } + } + + if bHave == 0 { + + zRet = Xsqlite3_mprintf(tls, ts+7868 /* "0" */, 0) + } + + return zRet +} + +func sessionSelectFindNew(tls *libc.TLS, nCol int32, zDb1 uintptr, zDb2 uintptr, zTbl uintptr, zExpr uintptr) uintptr { /* sqlite3.c:208273:13: */ + bp := tls.Alloc(40) + defer tls.Free(40) + + var zRet uintptr = Xsqlite3_mprintf(tls, + + ts+32160, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, zDb1, zTbl, zDb2, zTbl, zExpr)) + return zRet +} + +func sessionDiffFindNew(tls *libc.TLS, op int32, pSession uintptr, pTab uintptr, zDb1 uintptr, zDb2 uintptr, zExpr uintptr) int32 { /* sqlite3.c:208289:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var rc int32 = SQLITE_OK + var zStmt uintptr = sessionSelectFindNew(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, zDb1, zDb2, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr) + + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp /* &pStmt */, uintptr(0)) + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = 0 + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) { + sessionPreupdateOneChange(tls, op, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + + return rc +} + +func sessionDiffFindModified(tls *libc.TLS, pSession uintptr, pTab uintptr, zFrom uintptr, zExpr uintptr) int32 { /* sqlite3.c:208320:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var rc int32 = SQLITE_OK + + var zExpr2 uintptr = sessionExprCompareOther(tls, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, + (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (*SessionTable)(unsafe.Pointer(pTab)).FazCol, (*SessionTable)(unsafe.Pointer(pTab)).FabPK) + if zExpr2 == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var zStmt uintptr = Xsqlite3_mprintf(tls, + ts+32238, /* "SELECT * FROM \"%..." */ + libc.VaList(bp, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zFrom, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zExpr, zExpr2)) + if zStmt == uintptr(0) { + rc = SQLITE_NOMEM + } else { + // var pStmt uintptr at bp+48, 8 + + rc = Xsqlite3_prepare(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, zStmt, -1, bp+48 /* &pStmt */, uintptr(0)) + + if rc == SQLITE_OK { + var pDiffCtx uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fhook.FpCtx + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */)) + (*SessionDiffCtx)(unsafe.Pointer(pDiffCtx)).FnOldOff = (*SessionTable)(unsafe.Pointer(pTab)).FnCol + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) { + sessionPreupdateOneChange(tls, SQLITE_UPDATE, pSession, pTab) + } + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pStmt */))) + } + Xsqlite3_free(tls, zStmt) + } + } + + return rc +} + +func Xsqlite3session_diff(tls *libc.TLS, pSession uintptr, zFrom uintptr, zTbl uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:208360:16: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + var zDb uintptr + var rc int32 + // var d SessionDiffCtx at bp, 16 + + var i int32 + var bHasPk int32 + var bMismatch int32 + // var nCol int32 at bp+24, 4 + // Columns in zFrom.zTbl + // var abPK uintptr at bp+40, 8 + + // var azCol uintptr at bp+32, 8 + + var zExpr uintptr + var db uintptr + // var pTo uintptr at bp+16, 8 + zDb = (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + + libc.Xmemset(tls, bp /* &d */, 0, uint64(unsafe.Sizeof(SessionDiffCtx{}))) + sessionDiffHooks(tls, pSession, bp /* &d */) + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if !(pzErrMsg != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) +__1: + ; + if !(rc == SQLITE_OK) { + goto __2 + } + zExpr = uintptr(0) + db = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Table zTbl + + // Locate and if necessary initialize the target table object + rc = sessionFindTable(tls, pSession, zTbl, bp+16 /* &pTo */) + if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)) == uintptr(0)) { + goto __3 + } + goto diff_out +__3: + ; + if !(sessionInitTable(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */))) != 0) { + goto __4 + } + rc = (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + goto diff_out +__4: + ; + + // Check the table schemas match + if !(rc == SQLITE_OK) { + goto __5 + } + bHasPk = 0 + bMismatch = 0 + *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) = uintptr(0) + rc = sessionTableInfo(tls, uintptr(0), db, zFrom, zTbl, bp+24 /* &nCol */, uintptr(0), bp+32 /* &azCol */, bp+40 /* &abPK */) + if !(rc == SQLITE_OK) { + goto __6 + } + if !((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __7 + } + bMismatch = 1 + goto __8 +__7: + i = 0 +__9: + if !(i < *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) { + goto __11 + } + if !(int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK + uintptr(i)))) != int32(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))))) { + goto __12 + } + bMismatch = 1 +__12: + ; + if !(Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */)) + uintptr(i)*8)), *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol + uintptr(i)*8))) != 0) { + goto __13 + } + bMismatch = 1 +__13: + ; + if !(*(*U8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)) + uintptr(i))) != 0) { + goto __14 + } + bHasPk = 1 +__14: + ; + goto __10 +__10: + i++ + goto __9 + goto __11 +__11: + ; +__8: + ; +__6: + ; + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* azCol */))) + if !(bMismatch != 0) { + goto __15 + } + if !(pzErrMsg != 0) { + goto __16 + } + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+32291 /* "table schemas do..." */, 0) +__16: + ; + rc = SQLITE_SCHEMA +__15: + ; + if !(bHasPk == 0) { + goto __17 + } + // Ignore tables with no primary keys + goto diff_out +__17: + ; +__5: + ; + + if !(rc == SQLITE_OK) { + goto __18 + } + zExpr = sessionExprComparePK(tls, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FnCol, + zDb, zFrom, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FzName, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FazCol, (*SessionTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)))).FabPK) +__18: + ; + + // Find new rows + if !(rc == SQLITE_OK) { + goto __19 + } + rc = sessionDiffFindNew(tls, SQLITE_INSERT, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zDb, zFrom, zExpr) +__19: + ; + + // Find old rows + if !(rc == SQLITE_OK) { + goto __20 + } + rc = sessionDiffFindNew(tls, SQLITE_DELETE, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zDb, zExpr) +__20: + ; + + // Find modified rows + if !(rc == SQLITE_OK) { + goto __21 + } + rc = sessionDiffFindModified(tls, pSession, *(*uintptr)(unsafe.Pointer(bp + 16 /* pTo */)), zFrom, zExpr) +__21: + ; + + Xsqlite3_free(tls, zExpr) +__2: + ; + +diff_out: + sessionPreupdateHooks(tls, pSession) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Create a session object. This session object will record changes to +// database zDb attached to connection db. +func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession uintptr) int32 { /* sqlite3.c:208455:16: */ + var pNew uintptr // Newly allocated session object + var pOld uintptr // Session object already attached to db + var nDb int32 = Xsqlite3Strlen30(tls, zDb) // Length of zDb in bytes + + // Zero the output value in case an error occurs. + *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) + + // Allocate and populate the new session object. + pNew = Xsqlite3_malloc64(tls, ((uint64(unsafe.Sizeof(Sqlite3_session{})) + uint64(nDb)) + uint64(1))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_session{}))) + (*Sqlite3_session)(unsafe.Pointer(pNew)).Fdb = db + (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb = (pNew + 1*136) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FbEnable = 1 + libc.Xmemcpy(tls, (*Sqlite3_session)(unsafe.Pointer(pNew)).FzDb, zDb, (uint64(nDb + 1))) + sessionPreupdateHooks(tls, pNew) + + // Add the new session object to the linked list of session objects + // attached to database handle $db. Do this under the cover of the db + // handle mutex. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + pOld = Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), pNew) + (*Sqlite3_session)(unsafe.Pointer(pNew)).FpNext = pOld + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + + *(*uintptr)(unsafe.Pointer(ppSession)) = pNew + return SQLITE_OK +} + +// Free the list of table objects passed as the first argument. The contents +// of the changed-rows hash tables are also deleted. +func sessionDeleteTable(tls *libc.TLS, pSession uintptr, pList uintptr) { /* sqlite3.c:208493:13: */ + var pNext uintptr + var pTab uintptr + + for pTab = pList; pTab != 0; pTab = pNext { + var i int32 + pNext = (*SessionTable)(unsafe.Pointer(pTab)).FpNext + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + var pNextChange uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = pNextChange { + pNextChange = (*SessionChange)(unsafe.Pointer(p)).FpNext + sessionFree(tls, pSession, p) + } + } + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FazCol) // cast works around VC++ bug + sessionFree(tls, pSession, (*SessionTable)(unsafe.Pointer(pTab)).FapChange) + sessionFree(tls, pSession, pTab) + } +} + +// Delete a session object previously allocated using sqlite3session_create(). +func Xsqlite3session_delete(tls *libc.TLS, pSession uintptr) { /* sqlite3.c:208517:17: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb + // var pHead uintptr at bp, 8 + + var pp uintptr + + // Unlink the session from the linked list of sessions attached to the + // database handle. Hold the db mutex while doing so. + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + *(*uintptr)(unsafe.Pointer(bp /* pHead */)) = Xsqlite3_preupdate_hook(tls, db, uintptr(0), uintptr(0)) + for pp = bp; /* &pHead */ (*(*uintptr)(unsafe.Pointer(pp))) != uintptr(0); pp = (*(*uintptr)(unsafe.Pointer(pp)) + 80 /* &.pNext */) { + if (*(*uintptr)(unsafe.Pointer(pp))) == pSession { + *(*uintptr)(unsafe.Pointer(pp)) = (*Sqlite3_session)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + if *(*uintptr)(unsafe.Pointer(bp /* pHead */)) != 0 { + Xsqlite3_preupdate_hook(tls, db, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, Sqlite3_int64, Sqlite3_int64) + }{xPreUpdate})), *(*uintptr)(unsafe.Pointer(bp /* pHead */))) + } + break + } + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + Xsqlite3ValueFree(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpZeroBlob) + + // Delete all attached table objects. And the contents of their + // associated hash-tables. + sessionDeleteTable(tls, pSession, (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable) + + // Assert that all allocations have been freed and then free the + // session object itself. + + Xsqlite3_free(tls, pSession) +} + +// Set a table filter on a Session Object. +func Xsqlite3session_table_filter(tls *libc.TLS, pSession uintptr, xFilter uintptr, pCtx uintptr) { /* sqlite3.c:208549:17: */ + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + (*Sqlite3_session)(unsafe.Pointer(pSession)).FpFilterCtx = pCtx + (*Sqlite3_session)(unsafe.Pointer(pSession)).FxTableFilter = xFilter +} + +// Attach a table to a session. All subsequent changes made to the table +// while the session object is enabled will be recorded. +// +// Only tables that have a PRIMARY KEY defined may be attached. It does +// not matter if the PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) +// or not. +func Xsqlite3session_attach(tls *libc.TLS, pSession uintptr, zName uintptr) int32 { /* sqlite3.c:208567:16: */ + var rc int32 = SQLITE_OK + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + if !(zName != 0) { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbAutoAttach = 1 + } else { + var pTab uintptr // New table object (if required) + var nName int32 // Number of bytes in string zName + + // First search for an existing entry. If one is found, this call is + // a no-op. Return early. + nName = Xsqlite3Strlen30(tls, zName) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (nName+1)) { + break + } + } + + if !(pTab != 0) { + // Allocate new SessionTable object. + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionTable{})) + uint64(nName)) + uint64(1))) + pTab = sessionMalloc64(tls, pSession, int64(nByte)) + if !(pTab != 0) { + rc = SQLITE_NOMEM + } else { + // Populate the new SessionTable object and link it into the list. + // The new object must be linked onto the end of the list, not + // simply added to the start of it in order to ensure that tables + // appear in the correct order when a changeset or patchset is + // eventually generated. + var ppTab uintptr + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zName, (uint64(nName + 1))) + for ppTab = (pSession + 88 /* &.pTable */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } + } + } + + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return rc +} + +// Ensure that there is room in the buffer to append nByte bytes of data. +// If not, use sqlite3_realloc() to grow the buffer so that there is. +// +// If successful, return zero. Otherwise, if an OOM condition is encountered, +// set *pRc to SQLITE_NOMEM and return non-zero. +func sessionBufferGrow(tls *libc.TLS, p uintptr, nByte I64, pRc uintptr) int32 { /* sqlite3.c:208620:12: */ + var nReq I64 = (I64((*SessionBuffer)(unsafe.Pointer(p)).FnBuf) + nByte) + if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (nReq > I64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc)) { + var aNew uintptr + var nNew I64 + if (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc != 0 { + nNew = int64((*SessionBuffer)(unsafe.Pointer(p)).FnAlloc) + } else { + nNew = int64(128) + } + + for ok := true; ok; ok = (nNew < nReq) { + nNew = (nNew * int64(2)) + } + + // The value of SESSION_MAX_BUFFER_SZ is copied from the implementation + // of sqlite3_realloc64(). Allocations greater than this size in bytes + // always fail. It is used here to ensure that this routine can always + // allocate up to this limit - instead of up to the largest power of + // two smaller than the limit. + if nNew > (int64(0x7FFFFF00 - 1)) { + nNew = (int64(0x7FFFFF00 - 1)) + if nNew < nReq { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + return 1 + } + } + + aNew = Xsqlite3_realloc64(tls, (*SessionBuffer)(unsafe.Pointer(p)).FaBuf, uint64(nNew)) + if uintptr(0) == aNew { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } else { + (*SessionBuffer)(unsafe.Pointer(p)).FaBuf = aNew + (*SessionBuffer)(unsafe.Pointer(p)).FnAlloc = int32(nNew) + } + } + return (libc.Bool32(*(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK)) +} + +// Append the value passed as the second argument to the buffer passed +// as the first. +// +// This function is a no-op if *pRc is non-zero when it is called. +// Otherwise, if an error occurs, *pRc is set to an SQLite error code +// before returning. +func sessionAppendValue(tls *libc.TLS, p uintptr, pVal uintptr, pRc uintptr) { /* sqlite3.c:208663:13: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = *(*int32)(unsafe.Pointer(pRc)) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)) = int64(0) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, uintptr(0), pVal, bp /* &nByte */) + sessionBufferGrow(tls, p, *(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)), bp+8 /* &rc */) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionSerializeValue(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), pVal, uintptr(0)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += int32((*(*Sqlite3_int64)(unsafe.Pointer(bp /* nByte */)))) + } else { + *(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) + } + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single byte to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendByte(tls *libc.TLS, p uintptr, v U8, pRc uintptr) { /* sqlite3.c:208685:13: */ + if 0 == sessionBufferGrow(tls, p, int64(1), pRc) { + *(*U8)(unsafe.Pointer((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr(libc.PostIncInt32(&(*SessionBuffer)(unsafe.Pointer(p)).FnBuf, 1)))) = v + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a single varint to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendVarint(tls *libc.TLS, p uintptr, v int32, pRc uintptr) { /* sqlite3.c:208698:13: */ + if 0 == sessionBufferGrow(tls, p, int64(9), pRc) { + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (sessionVarintPut(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), v)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a blob of data to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendBlob(tls *libc.TLS, p uintptr, aBlob uintptr, nBlob int32, pRc uintptr) { /* sqlite3.c:208711:13: */ + if (nBlob > 0) && (0 == sessionBufferGrow(tls, p, int64(nBlob), pRc)) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), aBlob, uint64(nBlob)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nBlob) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append a string to the buffer. All bytes in the string +// up to (but not including) the nul-terminator are written to the buffer. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendStr(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208731:13: */ + var nStr int32 = Xsqlite3Strlen30(tls, zStr) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + libc.Xmemcpy(tls, ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)), zStr, uint64(nStr)) + *(*int32)(unsafe.Pointer(p + 8 /* &.nBuf */)) += (nStr) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string representation of integer iVal +// to the buffer. No nul-terminator is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendInteger(tls *libc.TLS, p uintptr, iVal int32, pRc uintptr) { /* sqlite3.c:208751:13: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + // var aBuf [24]int8 at bp+8, 24 + + Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([24]int8{})) - uint64(1))), bp+8 /* &aBuf[0] */, ts+5451 /* "%d" */, libc.VaList(bp, iVal)) + sessionAppendStr(tls, p, bp+8 /* &aBuf[0] */, pRc) +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwise, append the string zStr enclosed in quotes (") and +// with any embedded quote characters escaped to the buffer. No +// nul-terminator byte is written. +// +// If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +// returning. +func sessionAppendIdent(tls *libc.TLS, p uintptr, zStr uintptr, pRc uintptr) { /* sqlite3.c:208770:13: */ + var nStr int32 = (((Xsqlite3Strlen30(tls, zStr) * 2) + 2) + 1) + if 0 == sessionBufferGrow(tls, p, int64(nStr), pRc) { + var zOut uintptr = ((*SessionBuffer)(unsafe.Pointer(p)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(p)).FnBuf)) + var zIn uintptr = zStr + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + for *(*int8)(unsafe.Pointer(zIn)) != 0 { + if int32(*(*int8)(unsafe.Pointer(zIn))) == '"' { + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zIn, 1))) + } + *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = int8('"') + (*SessionBuffer)(unsafe.Pointer(p)).FnBuf = (int32((int64(zOut) - int64((*SessionBuffer)(unsafe.Pointer(p)).FaBuf)) / 1)) + } +} + +// This function is a no-op if *pRc is other than SQLITE_OK when it is +// called. Otherwse, it appends the serialized version of the value stored +// in column iCol of the row that SQL statement pStmt currently points +// to to the buffer. +func sessionAppendCol(tls *libc.TLS, p uintptr, pStmt uintptr, iCol int32, pRc uintptr) { /* sqlite3.c:208795:13: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var eType int32 = Xsqlite3_column_type(tls, pStmt, iCol) + sessionAppendByte(tls, p, U8(eType), pRc) + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + // var i Sqlite3_int64 at bp, 8 + + // var aBuf [8]U8 at bp+16, 8 + + if eType == SQLITE_INTEGER { + *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */)) = Xsqlite3_column_int64(tls, pStmt, iCol) + } else { + *(*float64)(unsafe.Pointer(bp + 8 /* r */)) = Xsqlite3_column_double(tls, pStmt, iCol) + libc.Xmemcpy(tls, bp /* &i */, bp+8 /* &r */, uint64(8)) + } + sessionPutI64(tls, bp+16 /* &aBuf[0] */, *(*Sqlite3_int64)(unsafe.Pointer(bp /* i */))) + sessionAppendBlob(tls, p, bp+16 /* &aBuf[0] */, 8, pRc) + } + if (eType == SQLITE_BLOB) || (eType == SQLITE_TEXT) { + var z uintptr + var nByte int32 + if eType == SQLITE_BLOB { + z = Xsqlite3_column_blob(tls, pStmt, iCol) + } else { + z = Xsqlite3_column_text(tls, pStmt, iCol) + } + nByte = Xsqlite3_column_bytes(tls, pStmt, iCol) + if (z != 0) || ((eType == SQLITE_BLOB) && (nByte == 0)) { + sessionAppendVarint(tls, p, nByte, pRc) + sessionAppendBlob(tls, p, z, nByte, pRc) + } else { + *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM + } + } + } +} + +// +// This function appends an update change to the buffer (see the comments +// under "CHANGESET FORMAT" at the top of the file). An update change +// consists of: +// +// 1 byte: SQLITE_UPDATE (0x17) +// n bytes: old.* record (see RECORD FORMAT) +// m bytes: new.* record (see RECORD FORMAT) +// +// The SessionChange object passed as the third argument contains the +// values that were stored in the row when the session began (the old.* +// values). The statement handle passed as the second argument points +// at the current version of the row (the new.* values). +// +// If all of the old.* values are equal to their corresponding new.* value +// (i.e. nothing has changed), then no data at all is appended to the buffer. +// +// Otherwise, the old.* record contains all primary key values and the +// original values of any fields that have been modified. The new.* record +// contains the new values of only those fields that have been modified. +func sessionAppendUpdate(tls *libc.TLS, pBuf uintptr, bPatchset int32, pStmt uintptr, p uintptr, abPK uintptr) int32 { /* sqlite3.c:208857:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp + 32 /* buf2 */)) = SessionBuffer{} // Buffer to accumulate new.* record in + var bNoop int32 = 1 // Set to zero if any values are modified + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf // Set to zero if any values are modified + var i int32 // Used to iterate through columns + var pCsr uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord // Used to iterate through old.* values + + sessionAppendByte(tls, pBuf, uint8(SQLITE_UPDATE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + for i = 0; i < Xsqlite3_column_count(tls, pStmt); i++ { + var bChanged int32 = 0 + var nAdvance int32 + var eType int32 = int32(*(*U8)(unsafe.Pointer(pCsr))) + switch eType { + case SQLITE_NULL: + nAdvance = 1 + if Xsqlite3_column_type(tls, pStmt, i) != SQLITE_NULL { + bChanged = 1 + } + break + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + { + nAdvance = 9 + if eType == Xsqlite3_column_type(tls, pStmt, i) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) = sessionGetI64(tls, (pCsr + 1)) + if eType == SQLITE_INTEGER { + if *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)) == Xsqlite3_column_int64(tls, pStmt, i) { + break + } + } else { + // var dVal float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &dVal */, bp+16 /* &iVal */, uint64(8)) + if *(*float64)(unsafe.Pointer(bp + 8 /* dVal */)) == Xsqlite3_column_double(tls, pStmt, i) { + break + } + } + } + bChanged = 1 + break + + } + + default: + { + // var n int32 at bp+24, 4 + + var nHdr int32 = (1 + sessionVarintGet(tls, (pCsr+1), bp+24 /* &n */)) + + nAdvance = (nHdr + *(*int32)(unsafe.Pointer(bp + 24 /* n */))) + if ((eType == Xsqlite3_column_type(tls, pStmt, i)) && + (*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == Xsqlite3_column_bytes(tls, pStmt, i))) && + ((*(*int32)(unsafe.Pointer(bp + 24 /* n */)) == 0) || (0 == libc.Xmemcmp(tls, (pCsr+uintptr(nHdr)), Xsqlite3_column_blob(tls, pStmt, i), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* n */)))))) { + break + } + bChanged = 1 + + } + } + + // If at least one field has been modified, this is not a no-op. + if bChanged != 0 { + bNoop = 0 + } + + // Add a field to the old.* record. This is omitted if this modules is + // currently generating a patchset. + if bPatchset == 0 { + if (bChanged != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + sessionAppendBlob(tls, pBuf, pCsr, nAdvance, bp /* &rc */) + } else { + sessionAppendByte(tls, pBuf, uint8(0), bp /* &rc */) + } + } + + // Add a field to the new.* record. Or the only record if currently + // generating a patchset. + if (bChanged != 0) || ((bPatchset != 0) && (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0)) { + sessionAppendCol(tls, bp+32 /* &buf2 */, pStmt, i, bp /* &rc */) + } else { + sessionAppendByte(tls, bp+32 /* &buf2 */, uint8(0), bp /* &rc */) + } + + pCsr += uintptr(nAdvance) + } + + if bNoop != 0 { + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = nRewind + } else { + sessionAppendBlob(tls, pBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FnBuf, bp /* &rc */) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+32 /* &buf2 */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Append a DELETE change to the buffer passed as the first argument. Use +// the changeset format if argument bPatchset is zero, or the patchset +// format otherwise. +func sessionAppendDelete(tls *libc.TLS, pBuf uintptr, bPatchset int32, p uintptr, nCol int32, abPK uintptr) int32 { /* sqlite3.c:208956:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + + sessionAppendByte(tls, pBuf, uint8(SQLITE_DELETE), bp /* &rc */) + sessionAppendByte(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp /* &rc */) + + if bPatchset == 0 { + sessionAppendBlob(tls, pBuf, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp /* &rc */) + } else { + var i int32 + var a uintptr = (*SessionChange)(unsafe.Pointer(p)).FaRecord + for i = 0; i < nCol; i++ { + var pStart uintptr = a + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + fallthrough + + case SQLITE_FLOAT: + fallthrough + case SQLITE_INTEGER: + a += uintptr(8) + break + fallthrough + + default: + { + // var n int32 at bp+4, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+4 /* &n */)) + a += uintptr(*(*int32)(unsafe.Pointer(bp + 4 /* n */))) + break + + } + } + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendBlob(tls, pBuf, pStart, (int32((int64(a) - int64(pStart)) / 1)), bp /* &rc */) + } + } + + } + + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Formulate and prepare a SELECT statement to retrieve a row from table +// zTab in database zDb based on its primary key. i.e. +// +// SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... +func sessionSelectStmt(tls *libc.TLS, db uintptr, zDb uintptr, zTab uintptr, nCol int32, azCol uintptr, abPK uintptr, ppStmt uintptr) int32 { /* sqlite3.c:209011:12: */ + bp := tls.Alloc(28) + defer tls.Free(28) + + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + var zSql uintptr = uintptr(0) + var nSql int32 = -1 + + if 0 == Xsqlite3_stricmp(tls, ts+11434 /* "sqlite_stat1" */, zTab) { + zSql = Xsqlite3_mprintf(tls, + + ts+32318 /* "SELECT tbl, ?2, ..." */, libc.VaList(bp, zDb)) + if zSql == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_NOMEM + } + } else { + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*SessionBuffer)(unsafe.Pointer(bp + 8 /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp+8 /* &buf */, ts+32428 /* "SELECT * FROM " */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zDb, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+768 /* "." */, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, zTab, bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+32443 /* " WHERE " */, bp+24 /* &rc */) + for i = 0; i < nCol; i++ { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + sessionAppendStr(tls, bp+8 /* &buf */, zSep, bp+24 /* &rc */) + sessionAppendIdent(tls, bp+8 /* &buf */, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), bp+24 /* &rc */) + sessionAppendStr(tls, bp+8 /* &buf */, ts+32451 /* " IS ?" */, bp+24 /* &rc */) + sessionAppendInteger(tls, bp+8 /* &buf */, (i + 1), bp+24 /* &rc */) + zSep = ts + 21256 /* " AND " */ + } + } + zSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FaBuf + nSql = (*SessionBuffer)(unsafe.Pointer(bp + 8 /* &buf */)).FnBuf + } + + if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, uintptr(0)) + } + Xsqlite3_free(tls, zSql) + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) +} + +// Bind the PRIMARY KEY values from the change passed in argument pChange +// to the SELECT statement passed as the first argument. The SELECT statement +// is as prepared by function sessionSelectStmt(). +// +// Return SQLITE_OK if all PK values are successfully bound, or an SQLite +// error code (e.g. SQLITE_NOMEM) otherwise. +func sessionSelectBind(tls *libc.TLS, pSelect uintptr, nCol int32, abPK uintptr, pChange uintptr) int32 { /* sqlite3.c:209068:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 + var rc int32 = SQLITE_OK + var a uintptr = (*SessionChange)(unsafe.Pointer(pChange)).FaRecord + + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1)))) + + switch eType { + case 0: + fallthrough + case SQLITE_NULL: + + break + + case SQLITE_INTEGER: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + var iVal I64 = sessionGetI64(tls, a) + rc = Xsqlite3_bind_int64(tls, pSelect, (i + 1), iVal) + } + a += uintptr(8) + break + + } + + case SQLITE_FLOAT: + { + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + // var rVal float64 at bp, 8 + + *(*I64)(unsafe.Pointer(bp + 8 /* iVal */)) = sessionGetI64(tls, a) + libc.Xmemcpy(tls, bp /* &rVal */, bp+8 /* &iVal */, uint64(8)) + rc = Xsqlite3_bind_double(tls, pSelect, (i + 1), *(*float64)(unsafe.Pointer(bp /* rVal */))) + } + a += uintptr(8) + break + + } + + case SQLITE_TEXT: + { + // var n int32 at bp+16, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+16 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_text(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 16 /* n */))) + break + + } + + default: + { + // var n int32 at bp+20, 4 + + a += uintptr(sessionVarintGet(tls, a, bp+20 /* &n */)) + if *(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0 { + rc = Xsqlite3_bind_blob(tls, pSelect, (i + 1), a, *(*int32)(unsafe.Pointer(bp + 20 /* n */)), libc.UintptrFromInt32(-1)) + } + a += uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* n */))) + break + + } + } + } + + return rc +} + +// This function is a no-op if *pRc is set to other than SQLITE_OK when it +// is called. Otherwise, append a serialized table header (part of the binary +// changeset format) to buffer *pBuf. If an error occurs, set *pRc to an +// SQLite error code before returning. +func sessionAppendTableHdr(tls *libc.TLS, pBuf uintptr, bPatchset int32, pTab uintptr, pRc uintptr) { /* sqlite3.c:209139:13: */ + // Write a table header + sessionAppendByte(tls, pBuf, func() uint8 { + if bPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), pRc) + sessionAppendVarint(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, pRc) + sessionAppendBlob(tls, pBuf, (*SessionTable)(unsafe.Pointer(pTab)).FzName, (int32(libc.Xstrlen(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName)) + 1), pRc) +} + +// Generate either a changeset (if argument bPatchset is zero) or a patchset +// (if it is non-zero) based on the current contents of the session object +// passed as the first argument. +// +// If no error occurs, SQLITE_OK is returned and the new changeset/patchset +// stored in output variables *pnChangeset and *ppChangeset. Or, if an error +// occurs, an SQLite error code is returned and both output variables set +// to 0. +func sessionGenerateChangeset(tls *libc.TLS, pSession uintptr, bPatchset int32, xOutput uintptr, pOut uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209162:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + var db uintptr = (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb // Source database handle + var pTab uintptr // Used to iterate through attached tables + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* buf */)) = SessionBuffer{} // Buffer in which to accumlate changeset + // var rc int32 at bp+40, 4 + // Return code + + // Zero the output variables in case an error occurs. If this session + // object is already in the error state (sqlite3_session.rc != SQLITE_OK), + // this call will be a no-op. + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = 0 + *(*uintptr)(unsafe.Pointer(ppChangeset)) = uintptr(0) + } + + if (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc != 0 { + return (*Sqlite3_session)(unsafe.Pointer(pSession)).Frc + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_exec(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb, ts+32457 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) + } + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry != 0 { + var zName uintptr = (*SessionTable)(unsafe.Pointer(pTab)).FzName + // var nCol int32 at bp, 4 + // Number of columns in table + // var abPK uintptr at bp+16, 8 + // Primary key array + *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)) = uintptr(0) // Table columns + var i int32 // Used to iterate through hash buckets + *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)) = uintptr(0) // SELECT statement to query table pTab + var nRewind int32 = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf // Initial size of write buffer + var nNoop int32 // Size of buffer after writing tbl header + + // Check the table schema is still Ok. + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionTableInfo(tls, uintptr(0), db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, bp /* &nCol */, uintptr(0), bp+8 /* &azCol */, bp+16 /* &abPK */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) && (((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp /* nCol */))) || (libc.Xmemcmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), (*SessionTable)(unsafe.Pointer(pTab)).FabPK, uint64(*(*int32)(unsafe.Pointer(bp /* nCol */)))) != 0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_SCHEMA + } + + // Write a table header + sessionAppendTableHdr(tls, bp+24 /* &buf */, bPatchset, pTab, bp+40 /* &rc */) + + // Build and compile a statement to execute: + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectStmt(tls, + db, (*Sqlite3_session)(unsafe.Pointer(pSession)).FzDb, zName, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), bp+48 /* &pSel */) + } + + nNoop = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + for i = 0; (i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange) && (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK); i++ { + var p uintptr // Used to iterate through changes + + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (p != 0); p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionSelectBind(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */)), p) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { + continue + } + if Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) == SQLITE_ROW { + if int32((*SessionChange)(unsafe.Pointer(p)).Fop) == SQLITE_INSERT { + var iCol int32 + sessionAppendByte(tls, bp+24 /* &buf */, uint8(SQLITE_INSERT), bp+40 /* &rc */) + sessionAppendByte(tls, bp+24 /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+40 /* &rc */) + for iCol = 0; iCol < *(*int32)(unsafe.Pointer(bp /* nCol */)); iCol++ { + sessionAppendCol(tls, bp+24 /* &buf */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), iCol, bp+40 /* &rc */) + } + } else { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendUpdate(tls, bp+24 /* &buf */, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */)), p, *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + } else if int32((*SessionChange)(unsafe.Pointer(p)).Fop) != SQLITE_INSERT { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionAppendDelete(tls, bp+24 /* &buf */, bPatchset, p, *(*int32)(unsafe.Pointer(bp /* nCol */)), *(*uintptr)(unsafe.Pointer(bp + 16 /* abPK */))) + } + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + } + + // If the buffer is now larger than sessions_strm_chunk_size, pass + // its contents to the xOutput() callback. + if (((xOutput != 0) && + (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > nNoop)) && + ((*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + nNoop = -1 + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = 0 + } + + } + } + + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pSel */))) + if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf == nNoop { + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf = nRewind + } + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* azCol */))) // cast works around VC++ bug + } + } + + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + if xOutput == uintptr(0) { + *(*int32)(unsafe.Pointer(pnChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppChangeset)) = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &buf */)).FaBuf = uintptr(0) + } else if (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FnBuf) + } + } + + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &buf */)).FaBuf) + Xsqlite3_exec(tls, db, ts+32477 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Obtain a changeset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_changeset(tls *libc.TLS, pSession uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* sqlite3.c:209288:16: */ + var rc int32 = sessionGenerateChangeset(tls, pSession, 0, uintptr(0), uintptr(0), pnChangeset, ppChangeset) + + return rc +} + +// Streaming version of sqlite3session_changeset(). +func Xsqlite3session_changeset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209303:16: */ + return sessionGenerateChangeset(tls, pSession, 0, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Streaming version of sqlite3session_patchset(). +func Xsqlite3session_patchset_strm(tls *libc.TLS, pSession uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:209314:16: */ + return sessionGenerateChangeset(tls, pSession, 1, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Obtain a patchset object containing all changes recorded by the +// session object passed as the first argument. +// +// It is the responsibility of the caller to eventually free the buffer +// using sqlite3_free(). +func Xsqlite3session_patchset(tls *libc.TLS, pSession uintptr, pnPatchset uintptr, ppPatchset uintptr) int32 { /* sqlite3.c:209329:16: */ + return sessionGenerateChangeset(tls, pSession, 1, uintptr(0), uintptr(0), pnPatchset, ppPatchset) +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_enable(tls *libc.TLS, pSession uintptr, bEnable int32) int32 { /* sqlite3.c:209340:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bEnable >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable = bEnable + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnable + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Enable or disable the session object passed as the first argument. +func Xsqlite3session_indirect(tls *libc.TLS, pSession uintptr, bIndirect int32) int32 { /* sqlite3.c:209354:16: */ + var ret int32 + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + if bIndirect >= 0 { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect = bIndirect + } + ret = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbIndirect + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + return ret +} + +// Return true if there have been no changes to monitored tables recorded +// by the session object passed as the only argument. +func Xsqlite3session_isempty(tls *libc.TLS, pSession uintptr) int32 { /* sqlite3.c:209369:16: */ + var ret int32 = 0 + var pTab uintptr + + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + for pTab = (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable; (pTab != 0) && (ret == 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + ret = (libc.Bool32((*SessionTable)(unsafe.Pointer(pTab)).FnEntry > 0)) + } + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, (*Sqlite3_session)(unsafe.Pointer(pSession)).Fdb)) + + return (libc.Bool32(ret == 0)) +} + +// Return the amount of heap memory in use. +func Xsqlite3session_memory_used(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209385:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMalloc +} + +// Configure the session object passed as the first argument. +func Xsqlite3session_object_config(tls *libc.TLS, pSession uintptr, op int32, pArg uintptr) int32 { /* sqlite3.c:209392:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_OBJCONFIG_SIZE: + { + var iArg int32 = *(*int32)(unsafe.Pointer(pArg)) + if iArg >= 0 { + if (*Sqlite3_session)(unsafe.Pointer(pSession)).FpTable != 0 { + rc = SQLITE_MISUSE + } else { + (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize = (libc.Bool32(iArg != 0)) + } + } + *(*int32)(unsafe.Pointer(pArg)) = (*Sqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize + break + + } + + default: + rc = SQLITE_MISUSE + } + + return rc +} + +// Return the maximum size of sqlite3session_changeset() output. +func Xsqlite3session_changeset_size(tls *libc.TLS, pSession uintptr) Sqlite3_int64 { /* sqlite3.c:209418:26: */ + return (*Sqlite3_session)(unsafe.Pointer(pSession)).FnMaxChangesetSize +} + +// Do the work for either sqlite3changeset_start() or start_strm(). +func sessionChangesetStart(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, nChangeset int32, pChangeset uintptr, bInvert int32, bSkipEmpty int32) int32 { /* sqlite3.c:209425:12: */ + var pRet uintptr // Iterator to return + var nByte int32 // Number of bytes to allocate for iterator + + // Zero the output variable in case an error occurs. + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + + // Allocate and initialize the iterator structure. + nByte = int32(unsafe.Sizeof(Sqlite3_changeset_iter{})) + pRet = Xsqlite3_malloc(tls, nByte) + if !(pRet != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pRet, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FaData = pChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FnData = nChangeset + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FxInput = xInput + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FpIn = pIn + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).Fin.FbEof = func() int32 { + if xInput != 0 { + return 0 + } + return 1 + }() + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbInvert = bInvert + (*Sqlite3_changeset_iter)(unsafe.Pointer(pRet)).FbSkipEmpty = bSkipEmpty + + // Populate the output variable and return success. + *(*uintptr)(unsafe.Pointer(pp)) = pRet + return SQLITE_OK +} + +// Create an iterator used to iterate through the contents of a changeset. +func Xsqlite3changeset_start(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr) int32 { /* sqlite3.c:209463:16: */ + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, 0, 0) +} + +func Xsqlite3changeset_start_v2(tls *libc.TLS, pp uintptr, nChangeset int32, pChangeset uintptr, flags int32) int32 { /* sqlite3.c:209470:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, uintptr(0), uintptr(0), nChangeset, pChangeset, bInvert, 0) +} + +// Streaming version of sqlite3changeset_start(). +func Xsqlite3changeset_start_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:209483:16: */ + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), 0, 0) +} + +func Xsqlite3changeset_start_v2_strm(tls *libc.TLS, pp uintptr, xInput uintptr, pIn uintptr, flags int32) int32 { /* sqlite3.c:209490:16: */ + var bInvert int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETSTART_INVERT) != 0))) + return sessionChangesetStart(tls, pp, xInput, pIn, 0, uintptr(0), bInvert, 0) +} + +// If the SessionInput object passed as the only argument is a streaming +// object and the buffer is full, discard some data to free up space. +func sessionDiscardData(tls *libc.TLS, pIn uintptr) { /* sqlite3.c:209504:13: */ + if ((*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0) && ((*SessionInput)(unsafe.Pointer(pIn)).FiNext >= sessions_strm_chunk_size) { + var nMove int32 = ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf - (*SessionInput)(unsafe.Pointer(pIn)).FiNext) + + if nMove > 0 { + libc.Xmemmove(tls, (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), uint64(nMove)) + } + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) -= ((*SessionInput)(unsafe.Pointer(pIn)).FiNext) + (*SessionInput)(unsafe.Pointer(pIn)).FiNext = 0 + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } +} + +// Ensure that there are at least nByte bytes available in the buffer. Or, +// if there are not nByte bytes remaining in the input, that all available +// data is in the buffer. +// +// Return an SQLite error code if an error occurs, or SQLITE_OK otherwise. +func sessionInputBuffer(tls *libc.TLS, pIn uintptr, nByte int32) int32 { /* sqlite3.c:209524:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionInput)(unsafe.Pointer(pIn)).FxInput != 0 { + for (!((*SessionInput)(unsafe.Pointer(pIn)).FbEof != 0) && (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte) >= (*SessionInput)(unsafe.Pointer(pIn)).FnData)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) { + *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) = sessions_strm_chunk_size + + if (*SessionInput)(unsafe.Pointer(pIn)).FbNoDiscard == 0 { + sessionDiscardData(tls, pIn) + } + if SQLITE_OK == sessionBufferGrow(tls, (pIn+32 /* &.buf */), int64(*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))), bp /* &rc */) { + *(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pIn + 48 /* &.xInput */))))(tls, (*SessionInput)(unsafe.Pointer(pIn)).FpIn, ((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + uintptr((*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf)), bp+4 /* &nNew */) + if *(*int32)(unsafe.Pointer(bp + 4 /* nNew */)) == 0 { + (*SessionInput)(unsafe.Pointer(pIn)).FbEof = 1 + } else { + *(*int32)(unsafe.Pointer(pIn + 32 /* &.buf */ + 8 /* &.nBuf */)) += (*(*int32)(unsafe.Pointer(bp + 4 /* nNew */))) + } + } + + (*SessionInput)(unsafe.Pointer(pIn)).FaData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FaBuf + (*SessionInput)(unsafe.Pointer(pIn)).FnData = (*SessionInput)(unsafe.Pointer(pIn)).Fbuf.FnBuf + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// When this function is called, *ppRec points to the start of a record +// that contains nCol values. This function advances the pointer *ppRec +// until it points to the byte immediately following that record. +func sessionSkipRecord(tls *libc.TLS, ppRec uintptr, nCol int32) { /* sqlite3.c:209552:13: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var aRec uintptr = *(*uintptr)(unsafe.Pointer(ppRec)) + var i int32 + for i = 0; i < nCol; i++ { + var eType int32 = int32(*(*U8)(unsafe.Pointer(libc.PostIncUintptr(&aRec, 1)))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + aRec += uintptr(sessionVarintGet(tls, aRec, bp /* &nByte */)) + aRec += uintptr(*(*int32)(unsafe.Pointer(bp /* nByte */))) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + aRec += uintptr(8) + } + } + + *(*uintptr)(unsafe.Pointer(ppRec)) = aRec +} + +// This function sets the value of the sqlite3_value object passed as the +// first argument to a copy of the string or blob held in the aData[] +// buffer. SQLITE_OK is returned if successful, or SQLITE_NOMEM if an OOM +// error occurs. +func sessionValueSetStr(tls *libc.TLS, pVal uintptr, aData uintptr, nData int32, enc U8) int32 { /* sqlite3.c:209578:12: */ + // In theory this code could just pass SQLITE_TRANSIENT as the final + // argument to sqlite3ValueSetStr() and have the copy created + // automatically. But doing so makes it difficult to detect any OOM + // error. Hence the code to create the copy externally. + var aCopy uintptr = Xsqlite3_malloc64(tls, (uint64(Sqlite3_int64(nData) + int64(1)))) + if aCopy == uintptr(0) { + return SQLITE_NOMEM + } + libc.Xmemcpy(tls, aCopy, aData, uint64(nData)) + Xsqlite3ValueSetStr(tls, pVal, nData, aCopy, enc, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{Xsqlite3_free}))) + return SQLITE_OK +} + +// Deserialize a single record from a buffer in memory. See "RECORD FORMAT" +// for details. +// +// When this function is called, *paChange points to the start of the record +// to deserialize. Assuming no error occurs, *paChange is set to point to +// one byte after the end of the same record before this function returns. +// If the argument abPK is NULL, then the record contains nCol values. Or, +// if abPK is other than NULL, then the record contains only the PK fields +// (in other words, it is a patchset DELETE record). +// +// If successful, each element of the apOut[] array (allocated by the caller) +// is set to point to an sqlite3_value object containing the value read +// from the corresponding position in the record. If that value is not +// included in the record (i.e. because the record is part of an UPDATE change +// and the field was not modified), the corresponding element of apOut[] is +// set to NULL. +// +// It is the responsibility of the caller to free all sqlite_value structures +// using sqlite3_free(). +// +// If an error occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned. +// The apOut[] array may have been partially populated in this case. +func sessionReadRecord(tls *libc.TLS, pIn uintptr, nCol int32, abPK uintptr, apOut uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209619:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + var i int32 // Used to iterate through columns + var rc int32 = SQLITE_OK + + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 1 + } + for i = 0; (i < nCol) && (rc == SQLITE_OK); i++ { + var eType int32 = 0 // Type of value (SQLITE_NULL, TEXT etc.) + if (abPK != 0) && (int32(*(*U8)(unsafe.Pointer(abPK + uintptr(i)))) == 0) { + continue + } + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + if (*SessionInput)(unsafe.Pointer(pIn)).FiNext >= (*SessionInput)(unsafe.Pointer(pIn)).FnData { + rc = Xsqlite3CorruptError(tls, 209637) + } else { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(libc.PostIncInt32(&(*SessionInput)(unsafe.Pointer(pIn)).FiNext, 1))))) + + if eType != 0 { + if pbEmpty != 0 { + *(*int32)(unsafe.Pointer(pbEmpty)) = 0 + } + *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)) = Xsqlite3ValueNew(tls, uintptr(0)) + if !(int32(*(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8))) != 0) { + rc = SQLITE_NOMEM + } + } + } + } + + if rc == SQLITE_OK { + var aVal uintptr = ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var nByte int32 at bp, 4 + + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (sessionVarintGet(tls, aVal, bp /* &nByte */)) + rc = sessionInputBuffer(tls, pIn, *(*int32)(unsafe.Pointer(bp /* nByte */))) + if rc == SQLITE_OK { + if (*(*int32)(unsafe.Pointer(bp /* nByte */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nByte */)) > ((*SessionInput)(unsafe.Pointer(pIn)).FnData - (*SessionInput)(unsafe.Pointer(pIn)).FiNext)) { + rc = Xsqlite3CorruptError(tls, 209657) + } else { + var enc U8 = func() uint8 { + if eType == SQLITE_TEXT { + return uint8(SQLITE_UTF8) + } + return uint8(0) + }() + rc = sessionValueSetStr(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pIn)).FiNext)), *(*int32)(unsafe.Pointer(bp /* nByte */)), enc) + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nByte */))) + } + } + } + if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */)) = sessionGetI64(tls, aVal) + if eType == SQLITE_INTEGER { + Xsqlite3VdbeMemSetInt64(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*Sqlite3_int64)(unsafe.Pointer(bp + 16 /* v */))) + } else { + // var d float64 at bp+8, 8 + + libc.Xmemcpy(tls, bp+8 /* &d */, bp+16 /* &v */, uint64(8)) + Xsqlite3VdbeMemSetDouble(tls, *(*uintptr)(unsafe.Pointer(apOut + uintptr(i)*8)), *(*float64)(unsafe.Pointer(bp + 8 /* d */))) + } + *(*int32)(unsafe.Pointer(pIn + 8 /* &.iNext */)) += (8) + } + } + } + + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function ensures that all of the above is present in the input +// buffer (i.e. that it can be accessed without any calls to xInput()). +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. +// The input pointer is not moved. +func sessionChangesetBufferTblhdr(tls *libc.TLS, pIn uintptr, pnByte uintptr) int32 { /* sqlite3.c:209695:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + *(*int32)(unsafe.Pointer(bp /* nCol */)) = 0 + var nRead int32 = 0 + + rc = sessionInputBuffer(tls, pIn, 9) + if rc == SQLITE_OK { + nRead = nRead + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead))), bp /* &nCol */)) + // The hard upper limit for the number of columns in an SQLite + // database table is, according to sqliteLimit.h, 32676. So + // consider any table-header that purports to have more than 65536 + // columns to be corrupt. This is convenient because otherwise, + // if the (nCol>65536) condition below were omitted, a sufficiently + // large value for nCol may cause nRead to wrap around and become + // negative. Leading to a crash. + if (*(*int32)(unsafe.Pointer(bp /* nCol */)) < 0) || (*(*int32)(unsafe.Pointer(bp /* nCol */)) > 65536) { + rc = Xsqlite3CorruptError(tls, 209711) + } else { + rc = sessionInputBuffer(tls, pIn, ((nRead + *(*int32)(unsafe.Pointer(bp /* nCol */))) + 100)) + nRead = nRead + (*(*int32)(unsafe.Pointer(bp /* nCol */))) + } + } + + for rc == SQLITE_OK { + for (((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData) && (*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead)))) != 0) { + nRead++ + } + if ((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nRead) < (*SessionInput)(unsafe.Pointer(pIn)).FnData { + break + } + rc = sessionInputBuffer(tls, pIn, (nRead + 100)) + } + *(*int32)(unsafe.Pointer(pnByte)) = (nRead + 1) + return rc +} + +// The input pointer currently points to the first byte of the first field +// of a record consisting of nCol columns. This function ensures the entire +// record is buffered. It does not move the input pointer. +// +// If successful, SQLITE_OK is returned and *pnByte is set to the size of +// the record in bytes. Otherwise, an SQLite error code is returned. The +// final value of *pnByte is undefined in this case. +func sessionChangesetBufferRecord(tls *libc.TLS, pIn uintptr, nCol int32, pnByte uintptr) int32 { /* sqlite3.c:209738:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + var rc int32 = SQLITE_OK + var nByte int32 = 0 + var i int32 + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + var eType int32 + rc = sessionInputBuffer(tls, pIn, (nByte + 10)) + if rc == SQLITE_OK { + eType = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + libc.PostIncInt32(&nByte, 1)))))) + if (eType == SQLITE_TEXT) || (eType == SQLITE_BLOB) { + // var n int32 at bp, 4 + + nByte = nByte + (sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pIn)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pIn)).FiNext + nByte))), bp /* &n */)) + nByte = nByte + (*(*int32)(unsafe.Pointer(bp /* n */))) + rc = sessionInputBuffer(tls, pIn, nByte) + } else if (eType == SQLITE_INTEGER) || (eType == SQLITE_FLOAT) { + nByte = nByte + (8) + } + } + } + *(*int32)(unsafe.Pointer(pnByte)) = nByte + return rc +} + +// The input pointer currently points to the second byte of a table-header. +// Specifically, to the following: +// +// + number of columns in table (varint) +// + array of PK flags (1 byte per column), +// + table name (nul terminated). +// +// This function decodes the table-header and populates the p->nCol, +// p->zTab and p->abPK[] variables accordingly. The p->apValue[] array is +// also allocated or resized according to the new value of p->nCol. The +// input pointer is left pointing to the byte following the table header. +// +// If successful, SQLITE_OK is returned. Otherwise, an SQLite error code +// is returned and the final values of the various fields enumerated above +// are undefined. +func sessionChangesetReadTblhdr(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209782:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var rc int32 at bp+4, 4 + + // var nCopy int32 at bp, 4 + + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sessionChangesetBufferTblhdr(tls, (p /* &.in */), bp /* &nCopy */) + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var nByte int32 + var nVarint int32 + nVarint = sessionVarintGet(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), (p + 120 /* &.nCol */)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol > 0 { + *(*int32)(unsafe.Pointer(bp /* nCopy */)) -= nVarint + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (nVarint) + nByte = (int32(((uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol) * uint64(unsafe.Sizeof(uintptr(0)))) * uint64(2)) + uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */))))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FnBuf = 0 + sessionBufferGrow(tls, (p + 72 /* &.tblhdr */), int64(nByte), bp+4 /* &rc */) + } else { + *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = Xsqlite3CorruptError(tls, 209799) + } + } + + if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK { + var iPK Size_t = ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2)) + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf, 0, iPK) + libc.Xmemcpy(tls, ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + uintptr(iPK)), ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)), uint64(*(*int32)(unsafe.Pointer(bp /* nCopy */)))) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp /* nCopy */))) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue == uintptr(0) { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = uintptr(0) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = uintptr(0) + } else { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol*2))*8) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) + } + return uintptr(0) + }() + } + return libc.AssignPtrInt32(p+100 /* &.rc */, *(*int32)(unsafe.Pointer(bp + 4 /* rc */))) +} + +// Advance the changeset iterator to the next change. The differences between +// this function and sessionChangesetNext() are that +// +// * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE +// that modifies no columns), this function sets (*pbEmpty) to 1. +// +// * If the iterator is configured to skip no-op UPDATEs, +// sessionChangesetNext() does that. This function does not. +func sessionChangesetNextOne(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr, pbEmpty uintptr) int32 { /* sqlite3.c:209831:12: */ + var i int32 + var op U8 + + // If the iterator is in the error-state, return immediately. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // Free the current contents of p->apValue[], if any. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)) * uint64(2))) + } + + // Make sure the buffer contains at least 10 bytes of input data, or all + // remaining data if there are less than 10 bytes available. This is + // sufficient either for the 'T' or 'P' byte and the varint that follows + // it, or for the two single byte values otherwise. + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionInputBuffer(tls, (p /* &.in */), 2) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + + // If the iterator is already at the end of the changeset, return DONE. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + + sessionDiscardData(tls, (p /* &.in */)) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + for (int32(op) == 'T') || (int32(op) == 'P') { + if pbNew != 0 { + *(*int32)(unsafe.Pointer(pbNew)) = 1 + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset = (libc.Bool32(int32(op) == 'P')) + if sessionChangesetReadTblhdr(tls, p) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + if libc.AssignPtrInt32(p+100 /* &.rc */, sessionInputBuffer(tls, (p /* &.in */), 2)) != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiCurrent = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext >= (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FnData { + return SQLITE_DONE + } + op = *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1)))) + } + + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FzTab == uintptr(0)) || (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) { + // The first record in the changeset is not a table header. Must be a + // corrupt changeset. + + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209885)) + } + + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = int32(op) + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbIndirect = int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr(libc.PostIncInt32(&(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext, 1))))) + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209891)) + } + + if paRec != 0 { + var nVal int32 // Number of values to buffer + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) && (int32(op) == SQLITE_UPDATE) { + nVal = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2) + } else if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) && (int32(op) == SQLITE_DELETE) { + nVal = 0 + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nVal++ + } + } + } else { + nVal = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionChangesetBufferRecord(tls, (p /* &.in */), nVal, pnRec) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + *(*uintptr)(unsafe.Pointer(paRec)) = ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.FiNext)) + *(*int32)(unsafe.Pointer(p /* &.in */ + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(pnRec))) + } else { + var apOld uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + } + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + }() + var apNew uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + } + return ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol)*8) + }() + + // If this is an UPDATE or DELETE, read the old.* record. + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_INSERT) && (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset == 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE)) { + var abPK uintptr + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0 { + abPK = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + } else { + abPK = uintptr(0) + } + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, abPK, apOld, uintptr(0)) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + // If this is an INSERT or UPDATE, read the new.* record. + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop != SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc = sessionReadRecord(tls, (p /* &.in */), (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol, uintptr(0), apNew, pbEmpty) + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc != SQLITE_OK { + return (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + } + } + + if (((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbPatchset != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0)) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_UPDATE) { + // If this is an UPDATE that is part of a patchset, then all PK and + // modified fields are present in the new.* record. The old.* record + // is currently completely empty. This block shifts the PK fields from + // new.* to old.*, to accommodate the code that reads these arrays. + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol; i++ { + + if *(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8)) == uintptr(0) { + return libc.AssignPtrInt32(p+100 /* &.rc */, Xsqlite3CorruptError(tls, 209935)) + } + *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr((i+(*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol))*8)) = uintptr(0) + } + } + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbInvert != 0 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_INSERT { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_DELETE + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop == SQLITE_DELETE { + (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fop = SQLITE_INSERT + } + } + } + + return SQLITE_ROW +} + +// Advance the changeset iterator to the next change. +// +// If both paRec and pnRec are NULL, then this function works like the public +// API sqlite3changeset_next(). If SQLITE_ROW is returned, then the +// sqlite3changeset_new() and old() APIs may be used to query for values. +// +// Otherwise, if paRec and pnRec are not NULL, then a pointer to the change +// record is written to *paRec before returning and the number of bytes in +// the record to *pnRec. +// +// Either way, this function returns SQLITE_ROW if the iterator is +// successfully advanced to the next change in the changeset, an SQLite +// error code if an error occurs, or SQLITE_DONE if there are no further +// changes in the changeset. +func sessionChangesetNext(tls *libc.TLS, p uintptr, paRec uintptr, pnRec uintptr, pbNew uintptr) int32 { /* sqlite3.c:209964:12: */ + bp := tls.Alloc(4) + defer tls.Free(4) + + // var bEmpty int32 at bp, 4 + + var rc int32 + for ok := true; ok; ok = (((rc == SQLITE_ROW) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FbSkipEmpty != 0)) && (*(*int32)(unsafe.Pointer(bp /* bEmpty */)) != 0)) { + *(*int32)(unsafe.Pointer(bp /* bEmpty */)) = 0 + rc = sessionChangesetNextOne(tls, p, paRec, pnRec, pbNew, bp /* &bEmpty */) + } + return rc +} + +// Advance an iterator created by sqlite3changeset_start() to the next +// change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE +// or SQLITE_CORRUPT. +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_next(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:209987:16: */ + return sessionChangesetNext(tls, p, uintptr(0), uintptr(0), uintptr(0)) +} + +// The following function extracts information on the current change +// from a changeset iterator. It may only be called after changeset_next() +// has returned SQLITE_ROW. +func Xsqlite3changeset_op(tls *libc.TLS, pIter uintptr, pzTab uintptr, pnCol uintptr, pOp uintptr, pbIndirect uintptr) int32 { /* sqlite3.c:209996:16: */ + *(*int32)(unsafe.Pointer(pOp)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + *(*uintptr)(unsafe.Pointer(pzTab)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + if pbIndirect != 0 { + *(*int32)(unsafe.Pointer(pbIndirect)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect + } + return SQLITE_OK +} + +// Return information regarding the PRIMARY KEY and number of columns in +// the database table affected by the change that pIter currently points +// to. This function may only be called after changeset_next() returns +// SQLITE_ROW. +func Xsqlite3changeset_pk(tls *libc.TLS, pIter uintptr, pabPK uintptr, pnCol uintptr) int32 { /* sqlite3.c:210016:16: */ + *(*uintptr)(unsafe.Pointer(pabPK)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + if pnCol != 0 { + *(*int32)(unsafe.Pointer(pnCol)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + } + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_DELETE change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the old.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified and is not a PK column), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_old(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210039:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_DELETE) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(iVal)*8)) + return SQLITE_OK +} + +// This function may only be called while the iterator is pointing to an +// SQLITE_UPDATE or SQLITE_INSERT change (see sqlite3changeset_op()). +// Otherwise, SQLITE_MISUSE is returned. +// +// It sets *ppValue to point to an sqlite3_value structure containing the +// iVal'th value in the new.* record. Or, if that particular value is not +// included in the record (because the change is an UPDATE and the field +// was not modified), set *ppValue to NULL. +// +// If value iVal is out-of-range, SQLITE_RANGE is returned and *ppValue is +// not modified. Otherwise, SQLITE_OK. +func Xsqlite3changeset_new(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210067:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_UPDATE) && ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop != SQLITE_INSERT) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol+iVal))*8)) + return SQLITE_OK +} + +// The following two macros are used internally. They are similar to the +// sqlite3changeset_new() and sqlite3changeset_old() functions, except that +// they omit all error checking and return a pointer to the requested value. + +// This function may only be called with a changeset iterator that has been +// passed to an SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT +// conflict-handler function. Otherwise, SQLITE_MISUSE is returned. +// +// If successful, *ppValue is set to point to an sqlite3_value structure +// containing the iVal'th value of the conflicting record. +// +// If value iVal is out-of-range or some other error occurs, an SQLite error +// code is returned. Otherwise, SQLITE_OK. +func Xsqlite3changeset_conflict(tls *libc.TLS, pIter uintptr, iVal int32, ppValue uintptr) int32 { /* sqlite3.c:210101:16: */ + if !(int32((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict) != 0) { + return SQLITE_MISUSE + } + if (iVal < 0) || (iVal >= (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) { + return SQLITE_RANGE + } + *(*uintptr)(unsafe.Pointer(ppValue)) = Xsqlite3_column_value(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict, iVal) + return SQLITE_OK +} + +// This function may only be called with an iterator passed to an +// SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case +// it sets the output variable to the total number of known foreign key +// violations in the destination database and returns SQLITE_OK. +// +// In all other cases this function returns SQLITE_MISUSE. +func Xsqlite3changeset_fk_conflicts(tls *libc.TLS, pIter uintptr, pnOut uintptr) int32 { /* sqlite3.c:210124:16: */ + if ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict != 0) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FapValue != 0) { + return SQLITE_MISUSE + } + *(*int32)(unsafe.Pointer(pnOut)) = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + return SQLITE_OK +} + +// Finalize an iterator allocated with sqlite3changeset_start(). +// +// This function may not be called on iterators passed to a conflict handler +// callback by changeset_apply(). +func Xsqlite3changeset_finalize(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:210142:16: */ + var rc int32 = SQLITE_OK + if p != 0 { + var i int32 // Used to iterate through p->apValue[] + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Frc + if (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue != 0 { + for i = 0; i < ((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FnCol * 2); i++ { + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(p)).FapValue + uintptr(i)*8))) + } + } + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Ftblhdr.FaBuf) + Xsqlite3_free(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(p)).Fin.Fbuf.FaBuf) + Xsqlite3_free(tls, p) + } + return rc +} + +func sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOut uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210157:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + // var rc int32 at bp+40, 4 + // Return value + // var sOut SessionBuffer at bp, 16 + // Output buffer + // var nCol int32 at bp+20, 4 + // Number of cols in current table + var abPK uintptr // PK array for current table + var apVal uintptr // Space for values for UPDATE inversion + // var sPK SessionBuffer at bp+24, 16 + + // A 'table' record consists of: + // + // * A constant 'T' character, + // * Number of columns in said table (a varint), + // * An array of nCol bytes (sPK), + // * A nul-terminated table name. + // var nByte int32 at bp+16, 4 + + var nVar int32 + // var nByte1 int32 at bp+44, 4 + + var bIndirect int32 + var eType2 int32 + var pVal uintptr + var pVal1 uintptr + var iCol int32 + var eType U8 + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) = 0 + abPK = uintptr(0) + apVal = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 24 /* sPK */)) = SessionBuffer{} // PK array for current table + + // Initialize the output buffer + libc.Xmemset(tls, bp /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // Zero the output variables in case an error occurs. + if !(ppInverted != 0) { + goto __1 + } + *(*uintptr)(unsafe.Pointer(ppInverted)) = uintptr(0) + *(*int32)(unsafe.Pointer(pnInverted)) = 0 +__1: + ; + +__2: + if !(1 != 0) { + goto __3 + } + + // Test for EOF. + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionInputBuffer(tls, pInput, 2)) != 0) { + goto __4 + } + goto finished_invert +__4: + ; + if !((*SessionInput)(unsafe.Pointer(pInput)).FiNext >= (*SessionInput)(unsafe.Pointer(pInput)).FnData) { + goto __5 + } + goto __3 +__5: + ; + eType = *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext))) + + switch int32(eType) { + case 'T': + goto __7 + + case SQLITE_INSERT: + goto __8 + case SQLITE_DELETE: + goto __9 + + case SQLITE_UPDATE: + goto __10 + + default: + goto __11 + } + goto __6 +__7: + (*SessionInput)(unsafe.Pointer(pInput)).FiNext++ + if !(libc.AssignPtrInt32(bp+40 /* rc */, sessionChangesetBufferTblhdr(tls, pInput, bp+16 /* &nByte */)) != 0) { + goto __12 + } + goto finished_invert +__12: + ; + nVar = sessionVarintGet(tls, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), bp+20 /* &nCol */) + (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FnBuf = 0 + sessionAppendBlob(tls, bp+24 /* &sPK */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + nVar))), *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 16 /* nByte */)), bp+40 /* &rc */) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __13 + } + goto finished_invert +__13: + ; + + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 16 /* nByte */))) + Xsqlite3_free(tls, apVal) + apVal = uintptr(0) + abPK = (*SessionBuffer)(unsafe.Pointer(bp + 24 /* &sPK */)).FaBuf + goto __6 + +__8: +__9: + bIndirect = int32(*(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1))))) + eType2 = func() int32 { + if int32(eType) == SQLITE_DELETE { + return SQLITE_INSERT + } + return SQLITE_DELETE + }() + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionChangesetBufferRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), bp+44 /* &nByte1 */) + sessionAppendByte(tls, bp /* &sOut */, uint8(eType2), bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, uint8(bIndirect), bp+40 /* &rc */) + sessionAppendBlob(tls, bp /* &sOut */, ((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr((*SessionInput)(unsafe.Pointer(pInput)).FiNext)), *(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */)), bp+40 /* &rc */) + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (*(*int32)(unsafe.Pointer(bp + 44 /* nByte1 */))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0) { + goto __14 + } + goto finished_invert +__14: + ; + goto __6 + +__10: + + if !(uintptr(0) == apVal) { + goto __15 + } + apVal = Xsqlite3_malloc64(tls, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) + if !(uintptr(0) == apVal) { + goto __16 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM + goto finished_invert +__16: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) +__15: + ; + + // Write the header for the new UPDATE change. Same as the original. + sessionAppendByte(tls, bp /* &sOut */, eType, bp+40 /* &rc */) + sessionAppendByte(tls, bp /* &sOut */, *(*U8)(unsafe.Pointer((*SessionInput)(unsafe.Pointer(pInput)).FaData + uintptr(((*SessionInput)(unsafe.Pointer(pInput)).FiNext + 1)))), bp+40 /* &rc */) + + // Read the old.* and new.* records for the update change. + *(*int32)(unsafe.Pointer(pInput + 8 /* &.iNext */)) += (2) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal), uintptr(0)) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) { + goto __17 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sessionReadRecord(tls, pInput, *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)), uintptr(0), (apVal + uintptr(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))*8), uintptr(0)) +__17: + ; + + // Write the new old.* record. Consists of the PK columns from the + // original old.* record, and the other values from the original + // new.* record. + iCol = 0 +__18: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __20 + } + pVal = *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+(func() int32 { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return 0 + } + return *(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) + }())))*8)) + sessionAppendValue(tls, bp /* &sOut */, pVal, bp+40 /* &rc */) + goto __19 +__19: + iCol++ + goto __18 + goto __20 +__20: + ; + + // Write the new new.* record. Consists of a copy of all values + // from the original old.* record, except for the PK columns, which + // are set to "undefined". + iCol = 0 +__21: + if !(iCol < *(*int32)(unsafe.Pointer(bp + 20 /* nCol */))) { + goto __23 + } + pVal1 = func() uintptr { + if *(*U8)(unsafe.Pointer(abPK + uintptr(iCol))) != 0 { + return uintptr(0) + } + return *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8)) + }() + sessionAppendValue(tls, bp /* &sOut */, pVal1, bp+40 /* &rc */) + goto __22 +__22: + iCol++ + goto __21 + goto __23 +__23: + ; + + iCol = 0 +__24: + if !(iCol < (*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)) * 2)) { + goto __26 + } + Xsqlite3ValueFree(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(iCol)*8))) + goto __25 +__25: + iCol++ + goto __24 + goto __26 +__26: + ; + libc.Xmemset(tls, apVal, 0, ((uint64(unsafe.Sizeof(uintptr(0))) * uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nCol */)))) * uint64(2))) + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __27 + } + goto finished_invert +__27: + ; + + goto __6 + +__11: + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = Xsqlite3CorruptError(tls, 210284) + goto finished_invert +__6: + ; + + if !((xOutput != 0) && ((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf >= sessions_strm_chunk_size)) { + goto __28 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf = 0 + if !(*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK) { + goto __29 + } + goto finished_invert +__29: + ; +__28: + ; + goto __2 +__3: + ; + + if !(pnInverted != 0) { + goto __30 + } + *(*int32)(unsafe.Pointer(pnInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf + *(*uintptr)(unsafe.Pointer(ppInverted)) = (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf = uintptr(0) + goto __31 +__30: + if !((*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf > 0) { + goto __32 + } + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FnBuf) +__32: + ; +__31: + ; + +finished_invert: + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &sOut */)).FaBuf) + Xsqlite3_free(tls, apVal) + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+24 /* &sPK */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) +} + +// Invert a changeset object. +func Xsqlite3changeset_invert(tls *libc.TLS, nChangeset int32, pChangeset uintptr, pnInverted uintptr, ppInverted uintptr) int32 { /* sqlite3.c:210316:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FnData = nChangeset + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FaData = pChangeset + + return sessionChangesetInvert(tls, bp /* &sInput */, uintptr(0), uintptr(0), pnInverted, ppInverted) +} + +// Streaming version of sqlite3changeset_invert(). +func Xsqlite3changeset_invert_strm(tls *libc.TLS, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:210335:16: */ + bp := tls.Alloc(72) + defer tls.Free(72) + + // var sInput SessionInput at bp, 72 + + var rc int32 + + // Set up the input stream + libc.Xmemset(tls, bp /* &sInput */, 0, uint64(unsafe.Sizeof(SessionInput{}))) + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FxInput = xInput + (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).FpIn = pIn + + rc = sessionChangesetInvert(tls, bp /* &sInput */, xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3_free(tls, (*SessionInput)(unsafe.Pointer(bp /* &sInput */)).Fbuf.FaBuf) + return rc +} + +type SessionUpdate1 = struct { + FpStmt uintptr + FaMask uintptr + FpNext uintptr +} /* sqlite3.c:210355:9 */ + +type SessionUpdate = SessionUpdate1 /* sqlite3.c:210355:30 */ + +type SessionApplyCtx1 = struct { + Fdb uintptr + FpDelete uintptr + FpInsert uintptr + FpSelect uintptr + FnCol int32 + _ [4]byte + FazCol uintptr + FabPK uintptr + FaUpdateMask uintptr + FpUp uintptr + FbStat1 int32 + FbDeferConstraints int32 + FbInvertConstraints int32 + _ [4]byte + Fconstraints SessionBuffer + Frebase SessionBuffer + FbRebaseStarted U8 + FbRebase U8 + _ [6]byte +} /* sqlite3.c:210362:9 */ + +type SessionApplyCtx = SessionApplyCtx1 /* sqlite3.c:210362:32 */ + +// Number of prepared UPDATE statements to cache. + +// Find a prepared UPDATE statement suitable for the UPDATE step currently +// being visited by the iterator. The UPDATE is of the form: +// +// UPDATE tbl SET col = ?, col2 = ? WHERE pk1 IS ? AND pk2 IS ? +func sessionUpdateFind(tls *libc.TLS, pIter uintptr, p uintptr, bPatchset int32, ppStmt uintptr) int32 { /* sqlite3.c:210391:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var pUp uintptr = uintptr(0) + var nCol int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + var nU32 int32 = (((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol + 33) / 32) + var ii int32 + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = Xsqlite3_malloc(tls, (int32(uint64(nU32) * uint64(unsafe.Sizeof(U32(0)))))) + if (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, 0, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_CORRUPT + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((ii/32))*4)) |= (U32(int32(1) << (ii % 32))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if bPatchset != 0 { + *(*U32)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask + uintptr((nCol/32))*4)) |= (U32(int32(1) << (nCol % 32))) + } + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp != 0 { + var nUp int32 = 0 + var pp uintptr = (p + 64 /* &.pUp */) + for 1 != 0 { + nUp++ + if 0 == libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaMask, (uint64(nU32)*uint64(unsafe.Sizeof(U32(0))))) { + pUp = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + break + } + + if (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext != 0 { + pp = (*(*uintptr)(unsafe.Pointer(pp)) + 16 /* &.pNext */) + } else { + if nUp >= SESSION_UPDATE_CACHE_SZ { + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpStmt) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pp))) + *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) + } + break + } + } + } + + if pUp == uintptr(0) { + var nByte int32 = (int32((uint64(unsafe.Sizeof(SessionUpdate{})) * uint64(nU32)) * uint64(unsafe.Sizeof(U32(0))))) + var bStat1 int32 = (libc.Bool32(Xsqlite3_stricmp(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, ts+11434 /* "sqlite_stat1" */) == 0)) + pUp = Xsqlite3_malloc(tls, nByte) + if pUp == uintptr(0) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_NOMEM + } else { + var zSep uintptr = ts + 755 /* "" */ + // var buf SessionBuffer at bp, 16 + + libc.Xmemset(tls, bp /* &buf */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask = (pUp + 1*24) + libc.Xmemcpy(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FaMask, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask, (uint64(nU32) * uint64(unsafe.Sizeof(U32(0))))) + + sessionAppendStr(tls, bp /* &buf */, ts+32495 /* "UPDATE main." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32508 /* " SET " */, bp+16 /* &rc */) + + // Create the assignments part of the UPDATE + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii)))) == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(ii)))*8)) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32514 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 1), bp+16 /* &rc */) + zSep = ts + 14691 /* ", " */ + } + } + + // Create the WHERE clause part of the UPDATE + zSep = ts + 755 /* "" */ + sessionAppendStr(tls, bp /* &buf */, ts+32443 /* " WHERE " */, bp+16 /* &rc */) + for ii = 0; ii < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; ii++ { + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(ii))) != 0) || ((bPatchset == 0) && (*(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(ii)*8)) != 0)) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + if (bStat1 != 0) && (ii == 1) { + + sessionAppendStr(tls, bp, /* &buf */ + + ts+32519 /* "idx IS CASE WHEN..." */, bp+16 /* &rc */) + } else { + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(ii)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32451 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((ii * 2) + 2), bp+16 /* &rc */) + } + zSep = ts + 21256 /* " AND " */ + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + var zSql uintptr = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, zSql, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (pUp /* &.pStmt */), uintptr(0)) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, pUp) + pUp = uintptr(0) + } else { + (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = pUp + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + } + } + } + + if pUp != 0 { + *(*uintptr)(unsafe.Pointer(ppStmt)) = (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt + } else { + *(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0) + } + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Free all cached UPDATE statements. +func sessionUpdateFree(tls *libc.TLS, p uintptr) { /* sqlite3.c:210530:13: */ + var pUp uintptr + var pNext uintptr + for pUp = (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp; pUp != 0; pUp = pNext { + pNext = (*SessionUpdate)(unsafe.Pointer(pUp)).FpNext + Xsqlite3_finalize(tls, (*SessionUpdate)(unsafe.Pointer(pUp)).FpStmt) + Xsqlite3_free(tls, pUp) + } + (*SessionApplyCtx)(unsafe.Pointer(p)).FpUp = uintptr(0) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask) + (*SessionApplyCtx)(unsafe.Pointer(p)).FaUpdateMask = uintptr(0) +} + +// Formulate a statement to DELETE a row from database db. Assuming a table +// structure like this: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The DELETE statement looks like this: +// +// DELETE FROM x WHERE a = :1 AND c = :3 AND (:5 OR b IS :2 AND d IS :4) +// +// Variable :5 (nCol+1) is a boolean. It should be set to 0 if we require +// matching b and d values, or 1 otherwise. The second case comes up if the +// conflict handler is invoked with NOTFOUND and returns CHANGESET_REPLACE. +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pDelete is left +// pointing to the prepared version of the SQL statement. +func sessionDeleteRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210560:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var i int32 + var zSep uintptr = ts + 755 /* "" */ + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var nPk int32 = 0 + + sessionAppendStr(tls, bp /* &buf */, ts+32594 /* "DELETE FROM main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32443 /* " WHERE " */, bp+16 /* &rc */) + + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0 { + nPk++ + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32514 /* " = ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 21256 /* " AND " */ + } + } + + if nPk < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol { + sessionAppendStr(tls, bp /* &buf */, ts+32612 /* " AND (?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, ((*SessionApplyCtx)(unsafe.Pointer(p)).FnCol + 1), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32155 /* " OR " */, bp+16 /* &rc */) + + zSep = ts + 755 /* "" */ + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if !(int32(*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i)))) != 0) { + sessionAppendStr(tls, bp /* &buf */, zSep, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+32451 /* " IS ?" */, bp+16 /* &rc */) + sessionAppendInteger(tls, bp /* &buf */, (i + 1), bp+16 /* &rc */) + zSep = ts + 32620 /* "AND " */ + } + } + sessionAppendStr(tls, bp /* &buf */, ts+5428 /* ")" */, bp+16 /* &rc */) + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 8 /* &.pDelete */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Formulate and prepare an SQL statement to query table zTab by primary +// key. Assuming the following table structure: +// +// CREATE TABLE x(a, b, c, d, PRIMARY KEY(a, c)); +// +// The SELECT statement looks like this: +// +// SELECT * FROM x WHERE a = ?1 AND c = ?3 +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pSelect is left +// pointing to the prepared version of the SQL statement. +func sessionSelectRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210625:12: */ + return sessionSelectStmt(tls, + db, ts+6820 /* "main" */, zTab, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FazCol, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (p + 24 /* &.pSelect */)) +} + +// Formulate and prepare an INSERT statement to add a record to table zTab. +// For example: +// +// INSERT INTO main."zTab" VALUES(?1, ?2, ?3 ...); +// +// If successful, SQLITE_OK is returned and SessionApplyCtx.pInsert is left +// pointing to the prepared version of the SQL statement. +func sessionInsertRow(tls *libc.TLS, db uintptr, zTab uintptr, p uintptr) int32 { /* sqlite3.c:210643:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + var i int32 + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + + sessionAppendStr(tls, bp /* &buf */, ts+32625 /* "INSERT INTO main..." */, bp+16 /* &rc */) + sessionAppendIdent(tls, bp /* &buf */, zTab, bp+16 /* &rc */) + sessionAppendStr(tls, bp /* &buf */, ts+21262 /* "(" */, bp+16 /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + if i != 0 { + sessionAppendStr(tls, bp /* &buf */, ts+14691 /* ", " */, bp+16 /* &rc */) + } + sessionAppendIdent(tls, bp /* &buf */, *(*uintptr)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)), bp+16 /* &rc */) + } + + sessionAppendStr(tls, bp /* &buf */, ts+32643 /* ") VALUES(?" */, bp+16 /* &rc */) + for i = 1; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + sessionAppendStr(tls, bp /* &buf */, ts+32654 /* ", ?" */, bp+16 /* &rc */) + } + sessionAppendStr(tls, bp /* &buf */, ts+5428 /* ")" */, bp+16 /* &rc */) + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v2(tls, db, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf, (p + 16 /* &.pInsert */), uintptr(0)) + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +func sessionPrepare(tls *libc.TLS, db uintptr, pp uintptr, zSql uintptr) int32 { /* sqlite3.c:210673:12: */ + return Xsqlite3_prepare_v2(tls, db, zSql, -1, pp, uintptr(0)) +} + +// Prepare statements for applying changes to the sqlite_stat1 table. +// These are similar to those created by sessionSelectRow(), +// sessionInsertRow(), sessionUpdateRow() and sessionDeleteRow() for +// other tables. +func sessionStat1Sql(tls *libc.TLS, db uintptr, p uintptr) int32 { /* sqlite3.c:210683:12: */ + var rc int32 = sessionSelectRow(tls, db, ts+11434 /* "sqlite_stat1" */, p) + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 16 /* &.pInsert */), + + ts+32658 /* "INSERT INTO main..." */) + } + if rc == SQLITE_OK { + rc = sessionPrepare(tls, db, (p + 8 /* &.pDelete */), + + ts+32771 /* "DELETE FROM main..." */) + } + return rc +} + +// A wrapper around sqlite3_bind_value() that detects an extra problem. +// See comments in the body of this function for details. +func sessionBindValue(tls *libc.TLS, pStmt uintptr, i int32, pVal uintptr) int32 { /* sqlite3.c:210706:12: */ + var eType int32 = Xsqlite3_value_type(tls, pVal) + // COVERAGE: The (pVal->z==0) branch is never true using current versions + // of SQLite. If a malloc fails in an sqlite3_value_xxx() function, either + // the (pVal->z) variable remains as it was or the type of the value is + // set to SQLITE_NULL. + if ((eType == SQLITE_TEXT) || (eType == SQLITE_BLOB)) && ((*Sqlite3_value)(unsafe.Pointer(pVal)).Fz == uintptr(0)) { + // This condition occurs when an earlier OOM in a call to + // sqlite3_value_text() or sqlite3_value_blob() (perhaps from within + // a conflict-handler) has zeroed the pVal->z pointer. Return NOMEM. + return SQLITE_NOMEM + } + return Xsqlite3_bind_value(tls, pStmt, i, pVal) +} + +// Iterator pIter must point to an SQLITE_INSERT entry. This function +// transfers new.* values from the current iterator entry to statement +// pStmt. The table being inserted into has nCol columns. +// +// New.* value $i from the iterator is bound to variable ($i+1) of +// statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1) +// are transfered to the statement. Otherwise, if abPK is not NULL, it points +// to an array nCol elements in size. In this case only those values for +// which abPK[$i] is true are read from the iterator and bound to the +// statement. +// +// An SQLite error code is returned if an error occurs. Otherwise, SQLITE_OK. +func sessionBindRow(tls *libc.TLS, pIter uintptr, xValue uintptr, nCol int32, abPK uintptr, pStmt uintptr) int32 { /* sqlite3.c:210739:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + var i int32 + var rc int32 = SQLITE_OK + + // Neither sqlite3changeset_old or sqlite3changeset_new can fail if the + // argument iterator points to a suitable entry. Make sure that xValue + // is one of these to guarantee that it is safe to ignore the return + // in the code below. + + for i = 0; (rc == SQLITE_OK) && (i < nCol); i++ { + if !(abPK != 0) || (*(*U8)(unsafe.Pointer(abPK + uintptr(i))) != 0) { + // var pVal uintptr at bp, 8 + + (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xValue)))(tls, pIter, i, bp /* &pVal */) + if *(*uintptr)(unsafe.Pointer(bp /* pVal */)) == uintptr(0) { + // The value in the changeset was "undefined". This indicates a + // corrupt changeset blob. + rc = Xsqlite3CorruptError(tls, 210762) + } else { + rc = sessionBindValue(tls, pStmt, (i + 1), *(*uintptr)(unsafe.Pointer(bp /* pVal */))) + } + } + } + return rc +} + +// SQL statement pSelect is as generated by the sessionSelectRow() function. +// This function binds the primary key values from the change that changeset +// iterator pIter points to to the SELECT and attempts to seek to the table +// entry. If a row is found, the SELECT statement left pointing at the row +// and SQLITE_ROW is returned. Otherwise, if no row is found and no error +// has occured, the statement is reset and SQLITE_OK is returned. If an +// error occurs, the statement is reset and an SQLite error code is returned. +// +// If this function returns SQLITE_ROW, the caller must eventually reset() +// statement pSelect. If any other value is returned, the statement does +// not require a reset(). +// +// If the iterator currently points to an INSERT record, bind values from the +// new.* record to the SELECT statement. Or, if it points to a DELETE or +// UPDATE, bind values from the old.* record. +func sessionSeekToRow(tls *libc.TLS, db uintptr, pIter uintptr, abPK uintptr, pSelect uintptr) int32 { /* sqlite3.c:210788:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + var rc int32 // Return code + // var nCol int32 at bp+8, 4 + // Number of columns in table + // var op int32 at bp+12, 4 + // Changset operation (SQLITE_UPDATE etc.) + // var zDummy uintptr at bp, 8 + // Unused + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + rc = sessionBindRow(tls, pIter, + func() uintptr { + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT { + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})) + } + return *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})) + }(), + *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, pSelect) + + if rc == SQLITE_OK { + rc = Xsqlite3_step(tls, pSelect) + if rc != SQLITE_ROW { + rc = Xsqlite3_reset(tls, pSelect) + } + } + + return rc +} + +// This function is called from within sqlite3changeset_apply_v2() when +// a conflict is encountered and resolved using conflict resolution +// mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. +// It adds a conflict resolution record to the buffer in +// SessionApplyCtx.rebase, which will eventually be returned to the caller +// of apply_v2() as the "rebase" buffer. +// +// Return SQLITE_OK if successful, or an SQLite error code otherwise. +func sessionRebaseAdd(tls *libc.TLS, p uintptr, eType int32, pIter uintptr) int32 { /* sqlite3.c:210823:12: */ + bp := tls.Alloc(16) + defer tls.Free(16) + + *(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebase != 0 { + var i int32 + var eOp int32 = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop + if int32((*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted) == 0 { + // Append a table-header to the rebase buffer + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + sessionAppendByte(tls, (p + 104 /* &.rebase */), uint8('T'), bp /* &rc */) + sessionAppendVarint(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol, bp /* &rc */) + sessionAppendBlob(tls, (p + 104 /* &.rebase */), zTab, (int32(libc.Xstrlen(tls, zTab)) + 1), bp /* &rc */) + (*SessionApplyCtx)(unsafe.Pointer(p)).FbRebaseStarted = U8(1) + } + + sessionAppendByte(tls, (p + 104 /* &.rebase */), + func() uint8 { + if eOp == SQLITE_DELETE { + return uint8(SQLITE_DELETE) + } + return uint8(SQLITE_INSERT) + }(), bp /* &rc */) + sessionAppendByte(tls, (p + 104 /* &.rebase */), (uint8(libc.Bool32(eType == SQLITE_CHANGESET_REPLACE))), bp /* &rc */) + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(p)).FnCol; i++ { + *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)) = uintptr(0) + if (eOp == SQLITE_DELETE) || ((eOp == SQLITE_UPDATE) && (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0)) { + Xsqlite3changeset_old(tls, pIter, i, bp+8 /* &pVal */) + } else { + Xsqlite3changeset_new(tls, pIter, i, bp+8 /* &pVal */) + } + sessionAppendValue(tls, (p + 104 /* &.rebase */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pVal */)), bp /* &rc */) + } + } + return *(*int32)(unsafe.Pointer(bp /* rc */)) +} + +// Invoke the conflict handler for the change that the changeset iterator +// currently points to. +// +// Argument eType must be either CHANGESET_DATA or CHANGESET_CONFLICT. +// If argument pbReplace is NULL, then the type of conflict handler invoked +// depends solely on eType, as follows: +// +// eType value Value passed to xConflict +// ------------------------------------------------- +// CHANGESET_DATA CHANGESET_NOTFOUND +// CHANGESET_CONFLICT CHANGESET_CONSTRAINT +// +// Or, if pbReplace is not NULL, then an attempt is made to find an existing +// record with the same primary key as the record about to be deleted, updated +// or inserted. If such a record can be found, it is available to the conflict +// handler as the "conflicting" record. In this case the type of conflict +// handler invoked is as follows: +// +// eType value PK Record found? Value passed to xConflict +// ---------------------------------------------------------------- +// CHANGESET_DATA Yes CHANGESET_DATA +// CHANGESET_DATA No CHANGESET_NOTFOUND +// CHANGESET_CONFLICT Yes CHANGESET_CONFLICT +// CHANGESET_CONFLICT No CHANGESET_CONSTRAINT +// +// If pbReplace is not NULL, and a record with a matching PK is found, and +// the conflict handler function returns SQLITE_CHANGESET_REPLACE, *pbReplace +// is set to non-zero before returning SQLITE_OK. +// +// If the conflict handler returns SQLITE_CHANGESET_ABORT, SQLITE_ABORT is +// returned. Or, if the conflict handler returns an invalid value, +// SQLITE_MISUSE. If the conflict handler returns SQLITE_CHANGESET_OMIT, +// this function returns SQLITE_OK. +func sessionConflictHandler(tls *libc.TLS, eType int32, p uintptr, pIter uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr) int32 { /* sqlite3.c:210897:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + var res int32 = 0 // Value returned by conflict handler + // var rc int32 at bp+16, 4 + + // var nCol int32 at bp+8, 4 + + // var op int32 at bp+12, 4 + + // var zDummy uintptr at bp, 8 + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + // Bind the new.* PRIMARY KEY values to the SELECT statement. + if pbReplace != 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_ROW { + // There exists another row with the new.* primary key. + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, eType, pIter) + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FpConflict = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } else if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if ((*SessionApplyCtx)(unsafe.Pointer(p)).FbDeferConstraints != 0) && (eType == SQLITE_CHANGESET_CONFLICT) { + // Instead of invoking the conflict handler, append the change blob + // to the SessionApplyCtx.constraints buffer. + var aBlob uintptr = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FaData + uintptr((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent)) + var nBlob int32 = ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiNext - (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FiCurrent) + sessionAppendBlob(tls, (p + 88 /* &.constraints */), aBlob, nBlob, bp+16 /* &rc */) + return SQLITE_OK + } else { + // No other row with the new.* primary key. + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, (eType + 1), pIter) + if res == SQLITE_CHANGESET_REPLACE { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + switch res { + case SQLITE_CHANGESET_REPLACE: + + *(*int32)(unsafe.Pointer(pbReplace)) = 1 + break + fallthrough + + case SQLITE_CHANGESET_OMIT: + break + fallthrough + + case SQLITE_CHANGESET_ABORT: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ABORT + break + fallthrough + + default: + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISUSE + break + } + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sessionRebaseAdd(tls, p, res, pIter) + } + } + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// If argument pbRetry is NULL, then ignore any CHANGESET_DATA conflict. If +// one is encountered, update or delete the row with the matching primary key +// instead. Or, if pbRetry is not NULL and a CHANGESET_DATA conflict occurs, +// invoke the conflict handler. If it returns CHANGESET_REPLACE, set *pbRetry +// to true before returning. In this case the caller will invoke this function +// again, this time with pbRetry set to NULL. +// +// If argument pbReplace is NULL and a CHANGESET_CONFLICT conflict is +// encountered invoke the conflict handler with CHANGESET_CONSTRAINT instead. +// Or, if pbReplace is not NULL, invoke it with CHANGESET_CONFLICT. If such +// an invocation returns SQLITE_CHANGESET_REPLACE, set *pbReplace to true +// before retrying. In this case the caller attempts to remove the conflicting +// row before invoking this function again, this time with pbReplace set +// to NULL. +// +// If any conflict handler returns SQLITE_CHANGESET_ABORT, this function +// returns SQLITE_ABORT. Otherwise, if no error occurs, SQLITE_OK is +// returned. +func sessionApplyOneOp(tls *libc.TLS, pIter uintptr, p uintptr, xConflict uintptr, pCtx uintptr, pbReplace uintptr, pbRetry uintptr) int32 { /* sqlite3.c:210995:12: */ + bp := tls.Alloc(24) + defer tls.Free(24) + + // var zDummy uintptr at bp, 8 + + // var op int32 at bp+12, 4 + + // var nCol int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + + Xsqlite3changeset_op(tls, pIter, bp /* &zDummy */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0)) + + if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE { + + // Bind values to the DELETE statement. If conflict handling is required, + // bind values for all columns and set bound variable (nCol+1) to true. + // Or, if conflict handling is not required, bind just the PK column + // values and, if it exists, set (nCol+1) to false. Conflict handling + // is not required if: + // + // * this is a patchset, or + // * (pbRetry==0), or + // * all columns of the table are PK columns (in this case there is + // no (nCol+1) variable to bind to). + var abPK uintptr = func() uintptr { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + } + return uintptr(0) + }() + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_old})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), abPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_bind_parameter_count(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) > *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))) { + rc = Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete, (*(*int32)(unsafe.Pointer(bp + 8 /* nCol */)) + 1), (libc.Bool32((pbRetry == uintptr(0)) || (abPK != 0)))) + } + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpDelete) + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE { + var i int32 + *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)) = uintptr(0) + var bPatchset int32 = (libc.Bool32((pbRetry == uintptr(0)) || ((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0))) + + rc = sessionUpdateFind(tls, pIter, p, bPatchset, bp+16 /* &pUp */) + + // Bind values to the UPDATE statement. + for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */))); i++ { + var pOld uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(i)*8)) + var pNew uintptr = *(*uintptr)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FapValue + uintptr(((*Sqlite3_changeset_iter)(unsafe.Pointer((pIter))).FnCol+(i)))*8)) + if (*(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(p)).FabPK + uintptr(i))) != 0) || ((bPatchset == 0) && (pOld != 0)) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 2), pOld) + } + if (rc == SQLITE_OK) && (pNew != 0) { + rc = sessionBindValue(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */)), ((i * 2) + 1), pNew) + } + } + if rc != SQLITE_OK { + return rc + } + + // Attempt the UPDATE. In the case of a NOTFOUND or DATA conflict, + // the result will be SQLITE_OK with 0 rows modified. + Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pUp */))) + + if (rc == SQLITE_OK) && (Xsqlite3_changes(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb) == 0) { + // A NOTFOUND or DATA error. Search the table to see if it contains + // a row with a matching primary key. If so, this is a DATA conflict. + // Otherwise, if there is no primary key match, it is a NOTFOUND. + + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry) + + } else if (rc & 0xff) == SQLITE_CONSTRAINT { + // This is always a CONSTRAINT conflict. + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, uintptr(0)) + } + + } else { + + if (*SessionApplyCtx)(unsafe.Pointer(p)).FbStat1 != 0 { + // Check if there is a conflicting row. For sqlite_stat1, this needs + // to be done using a SELECT, as there is no PRIMARY KEY in the + // database schema to throw an exception if a duplicate is inserted. + rc = sessionSeekToRow(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).Fdb, pIter, (*SessionApplyCtx)(unsafe.Pointer(p)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + if rc == SQLITE_ROW { + rc = SQLITE_CONSTRAINT + Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpSelect) + } + } + + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), uintptr(0), (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + if rc != SQLITE_OK { + return rc + } + + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(p)).FpInsert) + } + + if (rc & 0xff) == SQLITE_CONSTRAINT { + rc = sessionConflictHandler(tls, + SQLITE_CHANGESET_CONFLICT, p, pIter, xConflict, pCtx, pbReplace) + } + } + + return rc +} + +// Attempt to apply the change that the iterator passed as the first argument +// currently points to to the database. If a conflict is encountered, invoke +// the conflict handler callback. +// +// The difference between this function and sessionApplyOne() is that this +// function handles the case where the conflict-handler is invoked and +// returns SQLITE_CHANGESET_REPLACE - indicating that the change should be +// retried in some manner. +func sessionApplyOneWithRetry(tls *libc.TLS, db uintptr, pIter uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211128:12: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*int32)(unsafe.Pointer(bp /* bReplace */)) = 0 + *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) = 0 + var rc int32 + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, bp /* &bReplace */, bp+4 /* &bRetry */) + if rc == SQLITE_OK { + // If the bRetry flag is set, the change has not been applied due to an + // SQLITE_CHANGESET_DATA problem (i.e. this is an UPDATE or DELETE and + // a row with the correct PK is present in the db, but one or more other + // fields do not contain the expected values) and the conflict handler + // returned SQLITE_CHANGESET_REPLACE. In this case retry the operation, + // but pass NULL as the final argument so that sessionApplyOneOp() ignores + // the SQLITE_CHANGESET_DATA problem. + if *(*int32)(unsafe.Pointer(bp + 4 /* bRetry */)) != 0 { + + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } else if *(*int32)(unsafe.Pointer(bp /* bReplace */)) != 0 { + + rc = Xsqlite3_exec(tls, db, ts+32915 /* "SAVEPOINT replac..." */, uintptr(0), uintptr(0), uintptr(0)) + if rc == SQLITE_OK { + rc = sessionBindRow(tls, pIter, + *(*uintptr)(unsafe.Pointer(&struct { + f func(*libc.TLS, uintptr, int32, uintptr) int32 + }{Xsqlite3changeset_new})), (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + Xsqlite3_bind_int(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete, ((*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + 1), 1) + } + if rc == SQLITE_OK { + Xsqlite3_step(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + rc = Xsqlite3_reset(tls, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FpDelete) + } + if rc == SQLITE_OK { + rc = sessionApplyOneOp(tls, pIter, pApply, xConflict, pCtx, uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32936 /* "RELEASE replace_..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + } + + return rc +} + +// Retry the changes accumulated in the pApply->constraints buffer. +func sessionRetryConstraints(tls *libc.TLS, db uintptr, bPatchset int32, zTab uintptr, pApply uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211185:12: */ + bp := tls.Alloc(12) + defer tls.Free(12) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + + for (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf != 0 { + *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) = uintptr(0) + var cons = (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints + libc.Xmemset(tls, (pApply + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionChangesetStart(tls, + bp /* &pIter2 */, uintptr(0), uintptr(0), cons.FnBuf, cons.FaBuf, (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbInvertConstraints, 1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + var nByte Size_t = ((uint64(2 * (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol)) * uint64(unsafe.Sizeof(uintptr(0)))) + var rc2 int32 + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FbPatchset = bPatchset + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FzTab = zTab + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FnCol = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FnCol + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FabPK = (*SessionApplyCtx)(unsafe.Pointer(pApply)).FabPK + sessionBufferGrow(tls, (*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)) + 72 /* &.tblhdr */), int64(nByte), bp+8 /* &rc */) + (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue = (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).Ftblhdr.FaBuf + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + libc.Xmemset(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))).FapValue, 0, nByte) + } + + for (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)))) { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sessionApplyOneWithRetry(tls, db, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */)), pApply, xConflict, pCtx) + } + + rc2 = Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter2 */))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = rc2 + } + } + + Xsqlite3_free(tls, cons.FaBuf) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK { + break + } + if (*SessionApplyCtx)(unsafe.Pointer(pApply)).Fconstraints.FnBuf >= cons.FnBuf { + // No progress was made on the last round. + (*SessionApplyCtx)(unsafe.Pointer(pApply)).FbDeferConstraints = 0 + } + } + + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) +} + +// Argument pIter is a changeset iterator that has been initialized, but +// not yet passed to sqlite3changeset_next(). This function applies the +// changeset to the main database attached to handle "db". The supplied +// conflict handler callback is invoked to resolve any conflicts encountered +// while applying the change. +func sessionChangesetApply(tls *libc.TLS, db uintptr, pIter uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211241:12: */ + bp := tls.Alloc(368) + defer tls.Free(368) + + var schemaMismatch int32 = 0 + var rc int32 = SQLITE_OK // Return code + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = uintptr(0) // Name of current table + var nTab int32 = 0 // Result of sqlite3Strlen30(zTab) + // var sApply SessionApplyCtx at bp+48, 128 + // changeset_apply() context object + var bPatchset int32 + + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fin.FbNoDiscard = 1 + libc.Xmemset(tls, bp+48 /* &sApply */, 0, uint64(unsafe.Sizeof(SessionApplyCtx{}))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebase = (U8(libc.Bool32((ppRebase != 0) && (pnRebase != 0)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbInvertConstraints = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + Xsqlite3_mutex_enter(tls, Xsqlite3_db_mutex(tls, db)) + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + rc = Xsqlite3_exec(tls, db, ts+32955 /* "SAVEPOINT change..." */, uintptr(0), uintptr(0), uintptr(0)) + } + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+32981 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + } + for (rc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3changeset_next(tls, pIter)) { + // var nCol int32 at bp+184, 4 + + // var op int32 at bp+188, 4 + + // var zNew uintptr at bp+176, 8 + + Xsqlite3changeset_op(tls, pIter, bp+176 /* &zNew */, bp+184 /* &nCol */, bp+188 /* &op */, uintptr(0)) + + if (*(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0)) || (Xsqlite3_strnicmp(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (nTab+1)) != 0) { + // var abPK uintptr at bp+192, 8 + + rc = sessionRetryConstraints(tls, + db, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + if rc != SQLITE_OK { + break + } + + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Fdb = db + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpDelete = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpInsert = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FpSelect = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FabPK = uintptr(0) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbDeferConstraints = 1 + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbRebaseStarted = U8(0) + libc.Xmemset(tls, (bp + 48 /* &sApply */ + 88 /* &.constraints */), 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + + // If an xFilter() callback was specified, invoke it now. If the + // xFilter callback returns zero, skip this table. If it returns + // non-zero, proceed. + schemaMismatch = (libc.Bool32((xFilter != 0) && (0 == (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&xFilter)))(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))))) + if schemaMismatch != 0 { + *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)))) + if *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) == uintptr(0) { + rc = SQLITE_NOMEM + break + } + nTab = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FazCol = *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)) + } else { + var nMinCol int32 = 0 + var i int32 + + Xsqlite3changeset_pk(tls, pIter, bp+192 /* &abPK */, uintptr(0)) + rc = sessionTableInfo(tls, uintptr(0), + db, ts+6820 /* "main" */, *(*uintptr)(unsafe.Pointer(bp + 176 /* zNew */)), (bp + 48 /* &sApply */ + 32 /* &.nCol */), bp+200 /* &zTab */, (bp + 48 /* &sApply */ + 40 /* &.azCol */), (bp + 48 /* &sApply */ + 48 /* &.abPK */)) + if rc != SQLITE_OK { + break + } + for i = 0; i < (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol; i++ { + if *(*U8)(unsafe.Pointer((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK + uintptr(i))) != 0 { + nMinCol = (i + 1) + } + } + + if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol == 0 { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+33011 /* "sqlite3changeset..." */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else if (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol < *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + + ts+33055, /* "sqlite3changeset..." */ + libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FnCol, *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) + } else if (*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) < nMinCol) || (libc.Xmemcmp(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 192 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 184 /* nCol */)))) != 0) { + schemaMismatch = 1 + Xsqlite3_log(tls, SQLITE_SCHEMA, + ts+33126 /* "sqlite3changeset..." */, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)))) + } else { + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FnCol = *(*int32)(unsafe.Pointer(bp + 184 /* nCol */)) + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), ts+11434 /* "sqlite_stat1" */) { + if libc.AssignInt32(&rc, sessionStat1Sql(tls, db, bp+48 /* &sApply */)) != 0 { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 1 + } else { + if ((libc.AssignInt32(&rc, sessionSelectRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) || + (libc.AssignInt32(&rc, sessionDeleteRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0)) || + (libc.AssignInt32(&rc, sessionInsertRow(tls, db, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */)) != 0) { + break + } + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).FbStat1 = 0 + } + } + nTab = Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */))) + } + } + + // If there is a schema mismatch on the current table, proceed to the + // next change. A log message has already been issued. + if schemaMismatch != 0 { + continue + } + + rc = sessionApplyOneWithRetry(tls, db, pIter, bp+48 /* &sApply */, xConflict, pCtx) + } + + bPatchset = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + if rc == SQLITE_OK { + rc = Xsqlite3changeset_finalize(tls, pIter) + } else { + Xsqlite3changeset_finalize(tls, pIter) + } + + if rc == SQLITE_OK { + rc = sessionRetryConstraints(tls, db, bPatchset, *(*uintptr)(unsafe.Pointer(bp + 200 /* zTab */)), bp+48 /* &sApply */, xConflict, pCtx) + } + + if rc == SQLITE_OK { + // var nFk int32 at bp+208, 4 + + // var notUsed int32 at bp+212, 4 + + Xsqlite3_db_status(tls, db, SQLITE_DBSTATUS_DEFERRED_FKS, bp+208 /* &nFk */, bp+212 /* ¬Used */, 0) + if *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) != 0 { + var res int32 = SQLITE_CHANGESET_ABORT + // var sIter Sqlite3_changeset_iter at bp+216, 152 + + libc.Xmemset(tls, bp+216 /* &sIter */, 0, uint64(unsafe.Sizeof(Sqlite3_changeset_iter{}))) + (*Sqlite3_changeset_iter)(unsafe.Pointer(bp + 216 /* &sIter */)).FnCol = *(*int32)(unsafe.Pointer(bp + 208 /* nFk */)) + res = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(&xConflict)))(tls, pCtx, SQLITE_CHANGESET_FOREIGN_KEY, bp+216 /* &sIter */) + if res != SQLITE_CHANGESET_OMIT { + rc = SQLITE_CONSTRAINT + } + } + } + Xsqlite3_exec(tls, db, ts+33186 /* "PRAGMA defer_for..." */, uintptr(0), uintptr(0), uintptr(0)) + + if (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT) == 0 { + if rc == SQLITE_OK { + rc = Xsqlite3_exec(tls, db, ts+33216 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } else { + Xsqlite3_exec(tls, db, ts+33240 /* "ROLLBACK TO chan..." */, uintptr(0), uintptr(0), uintptr(0)) + Xsqlite3_exec(tls, db, ts+33216 /* "RELEASE changese..." */, uintptr(0), uintptr(0), uintptr(0)) + } + } + + if ((rc == SQLITE_OK) && (bPatchset == 0)) && ((*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FbRebase != 0) { + *(*uintptr)(unsafe.Pointer(ppRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf + *(*int32)(unsafe.Pointer(pnRebase)) = (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FnBuf + (*SessionApplyCtx)(unsafe.Pointer(bp + 48 /* &sApply */)).Frebase.FaBuf = uintptr(0) + } + sessionUpdateFree(tls, bp+48 /* &sApply */) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpInsert) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpDelete) + Xsqlite3_finalize(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FpSelect) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).FazCol) // cast works around VC++ bug + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Fconstraints.FaBuf) + Xsqlite3_free(tls, (*SessionApplyCtx)(unsafe.Pointer(bp+48 /* &sApply */)).Frebase.FaBuf) + Xsqlite3_mutex_leave(tls, Xsqlite3_db_mutex(tls, db)) + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main +// database attached to handle "db". +func Xsqlite3changeset_apply_v2(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211439:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInv int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, uintptr(0), uintptr(0), nChangeset, pChangeset, bInv, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +// Apply the changeset passed via pChangeset/nChangeset to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply(tls *libc.TLS, db uintptr, nChangeset int32, pChangeset uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211472:16: */ + return Xsqlite3changeset_apply_v2(tls, + db, nChangeset, pChangeset, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// Apply the changeset passed via xInput/pIn to the main database +// attached to handle "db". Invoke the supplied conflict handler callback +// to resolve any conflicts encountered while applying the change. +func Xsqlite3changeset_apply_v2_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr, ppRebase uintptr, pnRebase uintptr, flags int32) int32 { /* sqlite3.c:211497:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator to skip through changeset + var bInverse int32 = libc.BoolInt32(!(!((flags & SQLITE_CHANGESETAPPLY_INVERT) != 0))) + var rc int32 = sessionChangesetStart(tls, bp /* &pIter */, xInput, pIn, 0, uintptr(0), bInverse, 1) + if rc == SQLITE_OK { + rc = sessionChangesetApply(tls, + db, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xFilter, xConflict, pCtx, ppRebase, pnRebase, flags) + } + return rc +} + +func Xsqlite3changeset_apply_strm(tls *libc.TLS, db uintptr, xInput uintptr, pIn uintptr, xFilter uintptr, xConflict uintptr, pCtx uintptr) int32 { /* sqlite3.c:211524:16: */ + return Xsqlite3changeset_apply_v2_strm(tls, + db, xInput, pIn, xFilter, xConflict, pCtx, uintptr(0), uintptr(0), 0) +} + +// This function is called to merge two changes to the same row together as +// part of an sqlite3changeset_concat() operation. A new change object is +// allocated and a pointer to it stored in *ppNew. +func sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset int32, pExist uintptr, op2 int32, bIndirect int32, aRec uintptr, nRec int32, ppNew uintptr) int32 { /* sqlite3.c:211558:12: */ + bp := tls.Alloc(32) + defer tls.Free(32) + + var pNew uintptr = uintptr(0) + var rc int32 = SQLITE_OK + + if !(pExist != 0) { + pNew = Xsqlite3_malloc64(tls, (uint64(unsafe.Sizeof(SessionChange{})) + uint64(nRec))) + if !(pNew != 0) { + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = U8(bIndirect) + (*SessionChange)(unsafe.Pointer(pNew)).FaRecord = (pNew + 1*32) + if (bIndirect == 0) || (bRebase == 0) { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = nRec + libc.Xmemcpy(tls, (*SessionChange)(unsafe.Pointer(pNew)).FaRecord, aRec, uint64(nRec)) + } else { + var i int32 + var pIn uintptr = aRec + var pOut uintptr = (*SessionChange)(unsafe.Pointer(pNew)).FaRecord + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var nIn int32 = sessionSerialLen(tls, pIn) + if int32(*(*U8)(unsafe.Pointer(pIn))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } else if int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0 { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else { + libc.Xmemcpy(tls, pOut, pIn, uint64(nIn)) + pOut += uintptr(nIn) + } + pIn += uintptr(nIn) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + } else if bRebase != 0 { + if (int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) == SQLITE_DELETE) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0) { + *(*uintptr)(unsafe.Pointer(ppNew)) = pExist + } else { + var nByte Sqlite3_int64 = (Sqlite3_int64((uint64(nRec + (*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(unsafe.Sizeof(SessionChange{})))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + var i int32 + var a1 uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var a2 uintptr = aRec + var pOut uintptr + + libc.Xmemset(tls, pNew, 0, uint64(nByte)) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) || ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(op2) + pOut = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) || ((int32(*(*U8)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(i)))) == 0) && (bIndirect != 0)) { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0xFF) + } else if int32(*(*U8)(unsafe.Pointer(a2))) == 0 { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(pOut) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } else { + var op1 int32 = int32((*SessionChange)(unsafe.Pointer(pExist)).Fop) + + // op1=INSERT, op2=INSERT -> Unsupported. Discard op2. + // op1=INSERT, op2=UPDATE -> INSERT. + // op1=INSERT, op2=DELETE -> (none) + // + // op1=UPDATE, op2=INSERT -> Unsupported. Discard op2. + // op1=UPDATE, op2=UPDATE -> UPDATE. + // op1=UPDATE, op2=DELETE -> DELETE. + // + // op1=DELETE, op2=INSERT -> UPDATE. + // op1=DELETE, op2=UPDATE -> Unsupported. Discard op2. + // op1=DELETE, op2=DELETE -> Unsupported. Discard op2. + if ((((op1 == SQLITE_INSERT) && (op2 == SQLITE_INSERT)) || + ((op1 == SQLITE_UPDATE) && (op2 == SQLITE_INSERT))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_UPDATE))) || + ((op1 == SQLITE_DELETE) && (op2 == SQLITE_DELETE)) { + pNew = pExist + } else if (op1 == SQLITE_INSERT) && (op2 == SQLITE_DELETE) { + Xsqlite3_free(tls, pExist) + + } else { + var aExist uintptr = (*SessionChange)(unsafe.Pointer(pExist)).FaRecord + var nByte Sqlite3_int64 + // var aCsr uintptr at bp+8, 8 + + // Allocate a new SessionChange object. Ensure that the aRecord[] + // buffer of the new object is large enough to hold any record that + // may be generated by combining the input records. + nByte = (Sqlite3_int64((uint64(unsafe.Sizeof(SessionChange{})) + uint64((*SessionChange)(unsafe.Pointer(pExist)).FnRecord)) + uint64(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(nByte)) + if !(pNew != 0) { + Xsqlite3_free(tls, pExist) + return SQLITE_NOMEM + } + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(SessionChange{}))) + (*SessionChange)(unsafe.Pointer(pNew)).FbIndirect = (U8(libc.Bool32((bIndirect != 0) && ((*SessionChange)(unsafe.Pointer(pExist)).FbIndirect != 0)))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) = libc.AssignPtrUintptr(pNew+16 /* &.aRecord */, (pNew + 1*32)) + + if op1 == SQLITE_INSERT { // INSERT + UPDATE + *(*uintptr)(unsafe.Pointer(bp /* a1 */)) = aRec + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_INSERT) + if bPatchset == 0 { + sessionSkipRecord(tls, bp /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aExist, *(*uintptr)(unsafe.Pointer(bp /* a1 */))) + } else if op1 == SQLITE_DELETE { // DELETE + INSERT + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aExist, uintptr(0), aRec, uintptr(0)) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } + } else if op2 == SQLITE_UPDATE { // UPDATE + UPDATE + *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)) = aExist + *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */)) = aRec + + if bPatchset == 0 { + sessionSkipRecord(tls, bp+16 /* &a1 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + sessionSkipRecord(tls, bp+24 /* &a2 */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol) + } + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_UPDATE) + if 0 == sessionMergeUpdate(tls, bp+8 /* &aCsr */, pTab, bPatchset, aRec, aExist, *(*uintptr)(unsafe.Pointer(bp + 16 /* a1 */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* a2 */))) { + Xsqlite3_free(tls, pNew) + pNew = uintptr(0) + } + } else { // UPDATE + DELETE + + (*SessionChange)(unsafe.Pointer(pNew)).Fop = U8(SQLITE_DELETE) + if bPatchset != 0 { + libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)), aRec, uint64(nRec)) + *(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */)) += uintptr(nRec) + } else { + sessionMergeRecord(tls, bp+8 /* &aCsr */, (*SessionTable)(unsafe.Pointer(pTab)).FnCol, aRec, aExist) + } + } + + if pNew != 0 { + (*SessionChange)(unsafe.Pointer(pNew)).FnRecord = (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 8 /* aCsr */))) - int64((*SessionChange)(unsafe.Pointer(pNew)).FaRecord)) / 1)) + } + Xsqlite3_free(tls, pExist) + } + } + + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Add all changes in the changeset traversed by the iterator passed as +// the first argument to the changegroup hash tables. +func sessionChangesetToHash(tls *libc.TLS, pIter uintptr, pGrp uintptr, bRebase int32) int32 { /* sqlite3.c:211740:12: */ + bp := tls.Alloc(56) + defer tls.Free(56) + + // var aRec uintptr at bp, 8 + + // var nRec int32 at bp+8, 4 + + var rc int32 = SQLITE_OK + var pTab uintptr = uintptr(0) + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, uintptr(0)) { + // var zNew uintptr at bp+16, 8 + + // var nCol int32 at bp+24, 4 + + // var op int32 at bp+28, 4 + + var iHash int32 + // var bIndirect int32 at bp+32, 4 + + // var pChange uintptr at bp+48, 8 + + var pExist uintptr = uintptr(0) + var pp uintptr + + if (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList == uintptr(0) { + (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset + } else if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch { + rc = SQLITE_ERROR + break + } + + Xsqlite3changeset_op(tls, pIter, bp+16 /* &zNew */, bp+24 /* &nCol */, bp+28 /* &op */, bp+32 /* &bIndirect */) + if !(pTab != 0) || (Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (*SessionTable)(unsafe.Pointer(pTab)).FzName) != 0) { + // Search the list for a matching table + var nNew int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)))) + // var abPK uintptr at bp+40, 8 + + Xsqlite3changeset_pk(tls, pIter, bp+40 /* &abPK */, uintptr(0)) + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_strnicmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (nNew+1)) { + break + } + } + if !(pTab != 0) { + var ppTab uintptr + + pTab = Xsqlite3_malloc64(tls, (((uint64(unsafe.Sizeof(SessionTable{})) + uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + uint64(nNew)) + uint64(1))) + if !(pTab != 0) { + rc = SQLITE_NOMEM + break + } + libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(SessionTable{}))) + (*SessionTable)(unsafe.Pointer(pTab)).FnCol = *(*int32)(unsafe.Pointer(bp + 24 /* nCol */)) + (*SessionTable)(unsafe.Pointer(pTab)).FabPK = (pTab + 1*56) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + (*SessionTable)(unsafe.Pointer(pTab)).FzName = ((*SessionTable)(unsafe.Pointer(pTab)).FabPK + uintptr(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) + libc.Xmemcpy(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, *(*uintptr)(unsafe.Pointer(bp + 16 /* zNew */)), (uint64(nNew + 1))) + + // The new object must be linked on to the end of the list, not + // simply added to the start of it. This is to ensure that the + // tables within the output of sqlite3changegroup_output() are in + // the right order. + for ppTab = (pGrp + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(ppTab)) != 0; ppTab = (*(*uintptr)(unsafe.Pointer(ppTab)) /* &.pNext */) { + } + *(*uintptr)(unsafe.Pointer(ppTab)) = pTab + } else if ((*SessionTable)(unsafe.Pointer(pTab)).FnCol != *(*int32)(unsafe.Pointer(bp + 24 /* nCol */))) || (libc.Xmemcmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FabPK, *(*uintptr)(unsafe.Pointer(bp + 40 /* abPK */)), uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nCol */)))) != 0) { + rc = SQLITE_SCHEMA + break + } + } + + if sessionGrowHash(tls, uintptr(0), (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pTab) != 0 { + rc = SQLITE_NOMEM + break + } + iHash = int32(sessionChangeHash(tls, + pTab, (libc.Bool32(((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0) && (*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE))), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + // Search for existing entry. If found, remove it from the hash table. + // Code below may link it back in. + for pp = ((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8); *(*uintptr)(unsafe.Pointer(pp)) != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 24 /* &.pNext */) { + var bPkOnly1 int32 = 0 + var bPkOnly2 int32 = 0 + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + bPkOnly1 = (libc.Bool32(int32((*SessionChange)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(pp))))).Fop) == SQLITE_DELETE)) + bPkOnly2 = (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 28 /* op */)) == SQLITE_DELETE)) + } + if sessionChangeEqual(tls, pTab, bPkOnly1, (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FaRecord, bPkOnly2, *(*uintptr)(unsafe.Pointer(bp /* aRec */))) != 0 { + pExist = *(*uintptr)(unsafe.Pointer(pp)) + *(*uintptr)(unsafe.Pointer(pp)) = (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry-- + break + } + } + + rc = sessionChangeMerge(tls, pTab, bRebase, + (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset, pExist, *(*int32)(unsafe.Pointer(bp + 28 /* op */)), *(*int32)(unsafe.Pointer(bp + 32 /* bIndirect */)), *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+48 /* &pChange */) + if rc != 0 { + break + } + if *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) != 0 { + (*SessionChange)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)))).FpNext = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) + *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* pChange */)) + (*SessionTable)(unsafe.Pointer(pTab)).FnEntry++ + } + } + + if rc == SQLITE_OK { + rc = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Frc + } + return rc +} + +// Serialize a changeset (or patchset) based on all changesets (or patchsets) +// added to the changegroup object passed as the first argument. +// +// If xOutput is not NULL, then the changeset/patchset is returned to the +// user via one or more calls to xOutput, as with the other streaming +// interfaces. +// +// Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a +// buffer containing the output changeset before this function returns. In +// this case (*pnOut) is set to the size of the output buffer in bytes. It +// is the responsibility of the caller to free the output buffer using +// sqlite3_free() when it is no longer required. +// +// If successful, SQLITE_OK is returned. Or, if an error occurs, an SQLite +// error code. If an error occurs and xOutput is NULL, (*ppOut) and (*pnOut) +// are both set to 0 before returning. +func sessionChangegroupOutput(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211863:12: */ + bp := tls.Alloc(20) + defer tls.Free(20) + + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*SessionBuffer)(unsafe.Pointer(bp /* buf */)) = SessionBuffer{} + var pTab uintptr + + // Create the serialized output changeset based on the contents of the + // hash tables attached to the SessionTable objects in list p->pList. + for pTab = (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList; (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (pTab != 0); pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + var i int32 + if (*SessionTable)(unsafe.Pointer(pTab)).FnEntry == 0 { + continue + } + + sessionAppendTableHdr(tls, bp /* &buf */, (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FbPatch, pTab, bp+16 /* &rc */) + for i = 0; i < (*SessionTable)(unsafe.Pointer(pTab)).FnChange; i++ { + var p uintptr + for p = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(i)*8)); p != 0; p = (*SessionChange)(unsafe.Pointer(p)).FpNext { + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).Fop, bp+16 /* &rc */) + sessionAppendByte(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FbIndirect, bp+16 /* &rc */) + sessionAppendBlob(tls, bp /* &buf */, (*SessionChange)(unsafe.Pointer(p)).FaRecord, (*SessionChange)(unsafe.Pointer(p)).FnRecord, bp+16 /* &rc */) + if ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf >= sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf = 0 + } + } + } + } + + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp /* &buf */)).FaBuf) + + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) +} + +// Allocate a new, empty, sqlite3_changegroup. +func Xsqlite3changegroup_new(tls *libc.TLS, pp uintptr) int32 { /* sqlite3.c:211914:16: */ + var rc int32 = SQLITE_OK // Return code + var p uintptr // New object + p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_changegroup{}))) + if p == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Sqlite3_changegroup{}))) + } + *(*uintptr)(unsafe.Pointer(pp)) = p + return rc +} + +// Add the changeset currently stored in buffer pData, size nData bytes, +// to changeset-group p. +func Xsqlite3changegroup_add(tls *libc.TLS, pGrp uintptr, nData int32, pData uintptr) int32 { /* sqlite3.c:211931:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nData, pData) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Obtain a buffer containing a changeset representing the concatenation +// of all changesets added to the group so far. +func Xsqlite3changegroup_output(tls *libc.TLS, pGrp uintptr, pnData uintptr, ppData uintptr) int32 { /* sqlite3.c:211947:16: */ + return sessionChangegroupOutput(tls, pGrp, uintptr(0), uintptr(0), pnData, ppData) +} + +// Streaming versions of changegroup_add(). +func Xsqlite3changegroup_add_strm(tls *libc.TLS, pGrp uintptr, xInput uintptr, pIn uintptr) int32 { /* sqlite3.c:211958:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pIter uintptr at bp, 8 + // Iterator opened on pData/nData + var rc int32 // Return code + + rc = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), pGrp, 0) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Streaming versions of changegroup_output(). +func Xsqlite3changegroup_output_strm(tls *libc.TLS, pGrp uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:211977:16: */ + return sessionChangegroupOutput(tls, pGrp, xOutput, pOut, uintptr(0), uintptr(0)) +} + +// Delete a changegroup object. +func Xsqlite3changegroup_delete(tls *libc.TLS, pGrp uintptr) { /* sqlite3.c:211988:17: */ + if pGrp != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_changegroup)(unsafe.Pointer(pGrp)).FpList) + Xsqlite3_free(tls, pGrp) + } +} + +// Combine two changesets together. +func Xsqlite3changeset_concat(tls *libc.TLS, nLeft int32, pLeft uintptr, nRight int32, pRight uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:211998:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nLeft, pLeft) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), nRight, pRight) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), pnOut, ppOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Streaming version of sqlite3changeset_concat(). +func Xsqlite3changeset_concat_strm(tls *libc.TLS, xInputA uintptr, pInA uintptr, xInputB uintptr, pInB uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212027:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + // var pGrp uintptr at bp, 8 + + var rc int32 + + rc = Xsqlite3changegroup_new(tls, bp /* &pGrp */) + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputA, pInA) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_add_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xInputB, pInB) + } + if rc == SQLITE_OK { + rc = Xsqlite3changegroup_output_strm(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */)), xOutput, pOut) + } + Xsqlite3changegroup_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pGrp */))) + + return rc +} + +// Buffers a1 and a2 must both contain a sessions module record nCol +// fields in size. This function appends an nCol sessions module +// record to buffer pBuf that is a copy of a1, except that for +// each field that is undefined in a1[], swap in the field from a2[]. +func sessionAppendRecordMerge(tls *libc.TLS, pBuf uintptr, nCol int32, a1 uintptr, n1 int32, a2 uintptr, n2 int32, pRc uintptr) { /* sqlite3.c:212066:13: */ + sessionBufferGrow(tls, pBuf, (int64(n1 + n2)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var i int32 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + for i = 0; i < nCol; i++ { + var nn1 int32 = sessionSerialLen(tls, a1) + var nn2 int32 = sessionSerialLen(tls, a2) + if (int32(*(*U8)(unsafe.Pointer(a1))) == 0) || (int32(*(*U8)(unsafe.Pointer(a1))) == 0xFF) { + libc.Xmemcpy(tls, pOut, a2, uint64(nn2)) + pOut += uintptr(nn2) + } else { + libc.Xmemcpy(tls, pOut, a1, uint64(nn1)) + pOut += uintptr(nn1) + } + a1 += uintptr(nn1) + a2 += uintptr(nn2) + } + + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + + } +} + +// This function is called when rebasing a local UPDATE change against one +// or more remote UPDATE changes. The aRec/nRec buffer contains the current +// old.* and new.* records for the change. The rebase buffer (a single +// record) is in aChange/nChange. The rebased change is appended to buffer +// pBuf. +// +// Rebasing the UPDATE involves: +// +// * Removing any changes to fields for which the corresponding field +// in the rebase buffer is set to "replaced" (type 0xFF). If this +// means the UPDATE change updates no fields, nothing is appended +// to the output buffer. +// +// * For each field modified by the local change for which the +// corresponding field in the rebase buffer is not "undefined" (0x00) +// or "replaced" (0xFF), the old.* value is replaced by the value +// in the rebase buffer. +func sessionAppendPartialUpdate(tls *libc.TLS, pBuf uintptr, pIter uintptr, aRec uintptr, nRec int32, aChange uintptr, nChange int32, pRc uintptr) { /* sqlite3.c:212115:13: */ + sessionBufferGrow(tls, pBuf, (int64((2 + nRec) + nChange)), pRc) + if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { + var bData int32 = 0 + var pOut uintptr = ((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf + uintptr((*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf)) + var i int32 + var a1 uintptr = aRec + var a2 uintptr = aChange + + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(SQLITE_UPDATE) + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect) + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) == 0) { + if !(int32(*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i)))) != 0) && (*(*U8)(unsafe.Pointer(a1)) != 0) { + bData = 1 + } + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else if int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF { + bData = 1 + libc.Xmemcpy(tls, pOut, a2, uint64(n2)) + pOut += uintptr(n2) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + if bData != 0 { + a2 = aChange + for i = 0; i < (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol; i++ { + var n1 int32 = sessionSerialLen(tls, a1) + var n2 int32 = sessionSerialLen(tls, a2) + if (*(*U8)(unsafe.Pointer((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK + uintptr(i))) != 0) || (int32(*(*U8)(unsafe.Pointer(a2))) != 0xFF) { + libc.Xmemcpy(tls, pOut, a1, uint64(n1)) + pOut += uintptr(n1) + } else { + *(*U8)(unsafe.Pointer(libc.PostIncUintptr(&pOut, 1))) = U8(0) + } + a1 += uintptr(n1) + a2 += uintptr(n2) + } + (*SessionBuffer)(unsafe.Pointer(pBuf)).FnBuf = (int32((int64(pOut) - int64((*SessionBuffer)(unsafe.Pointer(pBuf)).FaBuf)) / 1)) + } + } +} + +// pIter is configured to iterate through a changeset. This function rebases +// that changeset according to the current configuration of the rebaser +// object passed as the first argument. If no error occurs and argument xOutput +// is not NULL, then the changeset is returned to the caller by invoking +// xOutput zero or more times and SQLITE_OK returned. Or, if xOutput is NULL, +// then (*ppOut) is set to point to a buffer containing the rebased changeset +// before this function returns. In this case (*pnOut) is set to the size of +// the buffer in bytes. It is the responsibility of the caller to eventually +// free the (*ppOut) buffer using sqlite3_free(). +// +// If an error occurs, an SQLite error code is returned. If ppOut and +// pnOut are not NULL, then the two output parameters are set to 0 before +// returning. +func sessionRebase(tls *libc.TLS, p uintptr, pIter uintptr, xOutput uintptr, pOut uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212183:12: */ + bp := tls.Alloc(48) + defer tls.Free(48) + + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp /* aRec */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)) = 0 + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + var pTab uintptr = uintptr(0) + *(*SessionBuffer)(unsafe.Pointer(bp + 16 /* sOut */)) = SessionBuffer{} + + for SQLITE_ROW == sessionChangesetNext(tls, pIter, bp /* &aRec */, bp+8 /* &nRec */, bp+12 /* &bNew */) { + var pChange uintptr = uintptr(0) + var bDone int32 = 0 + + if *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) != 0 { + var zTab uintptr = (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab + for pTab = (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList; pTab != 0; pTab = (*SessionTable)(unsafe.Pointer(pTab)).FpNext { + if 0 == Xsqlite3_stricmp(tls, (*SessionTable)(unsafe.Pointer(pTab)).FzName, zTab) { + break + } + } + *(*int32)(unsafe.Pointer(bp + 12 /* bNew */)) = 0 + + // A patchset may not be rebased + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + } + + // Append a table header to the output for this new table + sessionAppendByte(tls, bp+16 /* &sOut */, func() uint8 { + if (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbPatchset != 0 { + return uint8('P') + } + return uint8('T') + }(), bp+32 /* &rc */) + sessionAppendVarint(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FabPK, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab, (int32(libc.Xstrlen(tls, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FzTab)) + 1), bp+32 /* &rc */) + } + + if (pTab != 0) && (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) { + var iHash int32 = int32(sessionChangeHash(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), (*SessionTable)(unsafe.Pointer(pTab)).FnChange)) + + for pChange = *(*uintptr)(unsafe.Pointer((*SessionTable)(unsafe.Pointer(pTab)).FapChange + uintptr(iHash)*8)); pChange != 0; pChange = (*SessionChange)(unsafe.Pointer(pChange)).FpNext { + if sessionChangeEqual(tls, pTab, 0, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), 0, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord) != 0 { + break + } + } + } + + if pChange != 0 { + + switch (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop { + case SQLITE_INSERT: + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_UPDATE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + } + break + fallthrough + + case SQLITE_UPDATE: + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_DELETE { + if int32((*SessionChange)(unsafe.Pointer(pChange)).FbIndirect) == 0 { + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)) = *(*uintptr)(unsafe.Pointer(bp /* aRec */)) + sessionSkipRecord(tls, bp+40 /* &pCsr */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_INSERT), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + *(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */)), (int32(int64(*(*int32)(unsafe.Pointer(bp + 8 /* nRec */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 40 /* pCsr */))) - int64(*(*uintptr)(unsafe.Pointer(bp /* aRec */)))) / 1))), + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + } else { + sessionAppendPartialUpdate(tls, bp+16 /* &sOut */, pIter, + *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, bp+32 /* &rc */) + } + break + fallthrough + + default: + + bDone = 1 + if int32((*SessionChange)(unsafe.Pointer(pChange)).Fop) == SQLITE_INSERT { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8(SQLITE_DELETE), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendRecordMerge(tls, bp+16 /* &sOut */, (*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FnCol, + (*SessionChange)(unsafe.Pointer(pChange)).FaRecord, (*SessionChange)(unsafe.Pointer(pChange)).FnRecord, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + break + } + } + + if bDone == 0 { + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).Fop), bp+32 /* &rc */) + sessionAppendByte(tls, bp+16 /* &sOut */, uint8((*Sqlite3_changeset_iter)(unsafe.Pointer(pIter)).FbIndirect), bp+32 /* &rc */) + sessionAppendBlob(tls, bp+16 /* &sOut */, *(*uintptr)(unsafe.Pointer(bp /* aRec */)), *(*int32)(unsafe.Pointer(bp + 8 /* nRec */)), bp+32 /* &rc */) + } + if ((*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (xOutput != 0)) && ((*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > sessions_strm_chunk_size) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf = 0 + } + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != 0 { + break + } + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) != SQLITE_OK { + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + libc.Xmemset(tls, bp+16 /* &sOut */, 0, uint64(unsafe.Sizeof(SessionBuffer{}))) + } + + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if xOutput != 0 { + if (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf > 0 { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(&xOutput)))(tls, pOut, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FnBuf) + } + } else { + *(*uintptr)(unsafe.Pointer(ppOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf + *(*int32)(unsafe.Pointer(pnOut)) = (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FnBuf + (*SessionBuffer)(unsafe.Pointer(bp + 16 /* &sOut */)).FaBuf = uintptr(0) + } + } + Xsqlite3_free(tls, (*SessionBuffer)(unsafe.Pointer(bp+16 /* &sOut */)).FaBuf) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) +} + +// Create a new rebaser object. +func Xsqlite3rebaser_create(tls *libc.TLS, ppNew uintptr) int32 { /* sqlite3.c:212315:16: */ + var rc int32 = SQLITE_OK + var pNew uintptr + + pNew = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Sqlite3_rebaser{}))) + if pNew == uintptr(0) { + rc = SQLITE_NOMEM + } else { + libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(Sqlite3_rebaser{}))) + } + *(*uintptr)(unsafe.Pointer(ppNew)) = pNew + return rc +} + +// Call this one or more times to configure a rebaser. +func Xsqlite3rebaser_configure(tls *libc.TLS, p uintptr, nRebase int32, pRebase uintptr) int32 { /* sqlite3.c:212332:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator opened on pData/nData + var rc int32 // Return code + rc = Xsqlite3changeset_start(tls, bp /* &pIter */, nRebase, pRebase) + if rc == SQLITE_OK { + rc = sessionChangesetToHash(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), (p /* &.grp */), 1) + } + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase(tls *libc.TLS, p uintptr, nIn int32, pIn uintptr, pnOut uintptr, ppOut uintptr) int32 { /* sqlite3.c:212349:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start(tls, bp /* &pIter */, nIn, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), uintptr(0), uintptr(0), pnOut, ppOut) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Rebase a changeset according to current rebaser configuration +func Xsqlite3rebaser_rebase_strm(tls *libc.TLS, p uintptr, xInput uintptr, pIn uintptr, xOutput uintptr, pOut uintptr) int32 { /* sqlite3.c:212368:16: */ + bp := tls.Alloc(8) + defer tls.Free(8) + + *(*uintptr)(unsafe.Pointer(bp /* pIter */)) = uintptr(0) // Iterator to skip through input + var rc int32 = Xsqlite3changeset_start_strm(tls, bp /* &pIter */, xInput, pIn) + + if rc == SQLITE_OK { + rc = sessionRebase(tls, p, *(*uintptr)(unsafe.Pointer(bp /* pIter */)), xOutput, pOut, uintptr(0), uintptr(0)) + Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pIter */))) + } + + return rc +} + +// Destroy a rebaser object +func Xsqlite3rebaser_delete(tls *libc.TLS, p uintptr) { /* sqlite3.c:212389:17: */ + if p != 0 { + sessionDeleteTable(tls, uintptr(0), (*Sqlite3_rebaser)(unsafe.Pointer(p)).Fgrp.FpList) + Xsqlite3_free(tls, p) + } +} + +// Global configuration +func Xsqlite3session_config(tls *libc.TLS, op int32, pArg uintptr) int32 { /* sqlite3.c:212399:16: */ + var rc int32 = SQLITE_OK + switch op { + case SQLITE_SESSION_CONFIG_STRMSIZE: + { + var pInt uintptr = pArg + if *(*int32)(unsafe.Pointer(pInt)) > 0 { + sessions_strm_chunk_size = *(*int32)(unsafe.Pointer(pInt)) + } + *(*int32)(unsafe.Pointer(pInt)) = sessions_strm_chunk_size + break + + } + default: + rc = SQLITE_MISUSE + break + } + return rc +} + //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -209672,71 +215847,6 @@ type Fts5Global1 = struct { FpCsr uintptr } /* sqlite3.c:213118:9 */ -//************************************************************************ - -//************* End of sqlite3rbu.c ***************************************** -//************* Begin file dbstat.c ***************************************** -// 2010 July 12 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "dbstat" virtual table. -// -// The dbstat virtual table is used to extract low-level storage -// information from an SQLite database in order to implement the -// "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script -// for an example implementation. -// -// Additional information is available on the "dbstat.html" page of the -// official SQLite documentation. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbstat.c ********************************************* -//************* Begin file dbpage.c ***************************************** -// 2017-10-11 -// -// The author disclaims copyright to this source code. In place of -// a legal notice, here is a blessing: -// -// May you do good and not evil. -// May you find forgiveness for yourself and forgive others. -// May you share freely, never taking more than you give. -// -// -// -// This file contains an implementation of the "sqlite_dbpage" virtual table. -// -// The sqlite_dbpage virtual table is used to read or write whole raw -// pages of the database file. The pager interface is used so that -// uncommitted changes and changes recorded in the WAL file are correctly -// retrieved. -// -// Usage example: -// -// SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123; -// -// This is an eponymous virtual table so it does not need to be created before -// use. The optional argument to the sqlite_dbpage() table name is the -// schema for the database file that is to be read. The default schema is -// "main". -// -// The data field of sqlite_dbpage table can be updated. The new -// value must be a BLOB which is the correct page size, otherwise the -// update fails. Rows may not be deleted or inserted. - -// #include "sqliteInt.h" ** Requires access to internal data structures ** - -//************* End of dbpage.c ********************************************* -//************* Begin file sqlite3session.c ********************************* - //************* End of sqlite3session.c ************************************* //************* Begin file fts5.c ******************************************* @@ -210566,7 +216676,7 @@ func fts5yyStackOverflow(tls *libc.TLS, fts5yypParser uintptr) { /* sqlite3.c:21 // stack every overflows //******* Begin %stack_overflow code ***************************************** - sqlite3Fts5ParseError(tls, pParse, ts+31915 /* "fts5: parser sta..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+33268 /* "fts5: parser sta..." */, 0) //******* End %stack_overflow code ******************************************* (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument var @@ -210880,8 +216990,8 @@ func fts5yy_reduce(tls *libc.TLS, fts5yypParser uintptr, fts5yyruleno uint32, ft // The following code executes when a syntax error first occurs. func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32, fts5yyminor Fts5Token) { /* sqlite3.c:215056:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pParse uintptr = (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse @@ -210889,7 +216999,7 @@ func fts5yy_syntax_error(tls *libc.TLS, fts5yypParser uintptr, fts5yymajor int32 _ = fts5yymajor // Silence a compiler warning sqlite3Fts5ParseError(tls, - pParse, ts+31943 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) + pParse, ts+33296 /* "fts5: syntax err..." */, libc.VaList(bp, fts5yyminor.Fn, fts5yyminor.Fp)) //*********** End %syntax_error code ***************************************** (*Fts5yyParser)(unsafe.Pointer(fts5yypParser)).FpParse = pParse // Suppress warning about unused %extra_argument variable @@ -211153,14 +217263,14 @@ type HighlightContext = HighlightContext1 /* sqlite3.c:215457:33 */ // called, it is a no-op. If an error (i.e. an OOM condition) is encountered, // *pRc is set to an error code before returning. func fts5HighlightAppend(tls *libc.TLS, pRc uintptr, p uintptr, z uintptr, n int32) { /* sqlite3.c:215480:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) if (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) && (z != 0) { if n < 0 { n = int32(libc.Xstrlen(tls, z)) } - (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+31974 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) + (*HighlightContext)(unsafe.Pointer(p)).FzOut = Xsqlite3_mprintf(tls, ts+33327 /* "%z%.*s" */, libc.VaList(bp, (*HighlightContext)(unsafe.Pointer(p)).FzOut, n, z)) if (*HighlightContext)(unsafe.Pointer(p)).FzOut == uintptr(0) { *(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM } @@ -211234,7 +217344,7 @@ func fts5HighlightFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintp var iCol int32 if nVal != 3 { - var zErr uintptr = ts + 31981 /* "wrong number of ..." */ + var zErr uintptr = ts + 33334 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -211401,7 +217511,7 @@ func fts5ValueToText(tls *libc.TLS, pVal uintptr) uintptr { /* sqlite3.c:215713: if zRet != 0 { return zRet } - return ts + 740 /* "" */ + return ts + 755 /* "" */ } // Implementation of snippet() function. @@ -211428,7 +217538,7 @@ func fts5SnippetFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr var nCol int32 if nVal != 5 { - var zErr uintptr = ts + 32031 /* "wrong number of ..." */ + var zErr uintptr = ts + 33384 /* "wrong number of ..." */ Xsqlite3_result_error(tls, pCtx, zErr, -1) return } @@ -211770,13 +217880,13 @@ func sqlite3Fts5AuxInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c:216036 defer tls.Free(96) *(*[3]Builtin)(unsafe.Pointer(bp /* aBuiltin */)) = [3]Builtin{ - {FzFunc: ts + 32079 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 33432 /* "snippet" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5SnippetFunction}))}, - {FzFunc: ts + 32087 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 33440 /* "highlight" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5HighlightFunction}))}, - {FzFunc: ts + 32097 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { + {FzFunc: ts + 33450 /* "bm25" */, FxFunc: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) }{fts5Bm25Function}))}, } @@ -212270,7 +218380,7 @@ func fts5ConfigSkipLiteral(tls *libc.TLS, pIn uintptr) uintptr { /* sqlite3.c:21 case 'n': fallthrough case 'N': - if Xsqlite3_strnicmp(tls, ts+6605 /* "null" */, p, 4) == 0 { + if Xsqlite3_strnicmp(tls, ts+6620 /* "null" */, p, 4) == 0 { p = (p + 4) } else { p = uintptr(0) @@ -212444,19 +218554,19 @@ func fts5ConfigSetEnum(tls *libc.TLS, aEnum uintptr, zEnum uintptr, peVal uintpt // may be left in *pzErr. It is the responsibility of the caller to // eventually free any such error message using sqlite3_free(). func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCmd uintptr, zArg uintptr, pzErr uintptr) int32 { /* sqlite3.c:216705:12: */ - bp := tls.Alloc(136) - defer tls.Free(136) + bp := tls.Alloc(112) + defer tls.Free(112) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK var nCmd int32 = int32(libc.Xstrlen(tls, zCmd)) - if Xsqlite3_strnicmp(tls, ts+32102 /* "prefix" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+33455 /* "prefix" */, zCmd, nCmd) == 0 { var nByte int32 = (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(FTS5_MAX_PREFIX_INDEXES))) var p uintptr var bFirst int32 = 1 if (*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix == uintptr(0) { - (*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix = sqlite3Fts5MallocZero(tls, bp+64 /* &rc */, int64(nByte)) - if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) != 0 { - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FaPrefix = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, int64(nByte)) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0 { + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } } @@ -212476,15 +218586,15 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm break } if (int32(*(*int8)(unsafe.Pointer(p))) < '0') || (int32(*(*int8)(unsafe.Pointer(p))) > '9') { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32109 /* "malformed prefix..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33462 /* "malformed prefix..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } if (*Fts5Config)(unsafe.Pointer(pConfig)).FnPrefix == FTS5_MAX_PREFIX_INDEXES { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+32140 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + ts+33493 /* "too many prefix ..." */, libc.VaList(bp, FTS5_MAX_PREFIX_INDEXES)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -212494,8 +218604,8 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } if (nPre <= 0) || (nPre >= 1000) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32173 /* "prefix length ou..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33526 /* "prefix length ou..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR break } @@ -212504,20 +218614,20 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm bFirst = 0 } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+32210 /* "tokenize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+33563 /* "tokenize" */, zCmd, nCmd) == 0 { var p uintptr = zArg var nArg Sqlite3_int64 = (Sqlite3_int64(libc.Xstrlen(tls, zArg) + uint64(1))) - var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+64 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) - var pDel uintptr = sqlite3Fts5MallocZero(tls, bp+64 /* &rc */, (nArg * int64(2))) + var azArg uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nArg)))) + var pDel uintptr = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, (nArg * int64(2))) var pSpace uintptr = pDel if (azArg != 0) && (pSpace != 0) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FpTok != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32219 /* "multiple tokeniz..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33572 /* "multiple tokeniz..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { for nArg = int64(0); (p != 0) && (*(*int8)(unsafe.Pointer(p)) != 0); nArg++ { var p2 uintptr = fts5ConfigSkipWhitespace(tls, p) @@ -212535,10 +218645,10 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm } } if p == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32252 /* "parse error in t..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33605 /* "parse error in t..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3Fts5GetTokenizer(tls, pGlobal, azArg, int32(nArg), pConfig, pzErr) } @@ -212547,59 +218657,59 @@ func fts5ConfigParseSpecial(tls *libc.TLS, pGlobal uintptr, pConfig uintptr, zCm Xsqlite3_free(tls, azArg) Xsqlite3_free(tls, pDel) - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+32286 /* "content" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+33639 /* "content" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32294 /* "multiple content..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33647 /* "multiple content..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if *(*int8)(unsafe.Pointer(zArg)) != 0 { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_EXTERNAL - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+64 /* &rc */, ts+32326 /* "%Q.%Q" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContent = sqlite3Fts5Mprintf(tls, bp+40 /* &rc */, ts+33679 /* "%Q.%Q" */, libc.VaList(bp+8, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, zArg)) } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent = FTS5_CONTENT_NONE } } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+32332 /* "content_rowid" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+33685 /* "content_rowid" */, zCmd, nCmd) == 0 { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32346 /* "multiple content..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33699 /* "multiple content..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { - (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+64 /* &rc */, zArg, -1) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, zArg, -1) } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+32384 /* "columnsize" */, zCmd, nCmd) == 0 { + if Xsqlite3_strnicmp(tls, ts+33737 /* "columnsize" */, zCmd, nCmd) == 0 { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32395 /* "malformed column..." */, 0) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33748 /* "malformed column..." */, 0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize = (libc.Bool32(int32(*(*int8)(unsafe.Pointer(zArg))) == '1')) } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - if Xsqlite3_strnicmp(tls, ts+5536 /* "detail" */, zCmd, nCmd) == 0 { - *(*[4]Fts5Enum)(unsafe.Pointer(bp + 72 /* aDetail */)) = [4]Fts5Enum{ - {FzName: ts + 17192 /* "none" */, FeVal: FTS5_DETAIL_NONE}, - {FzName: ts + 17197 /* "full" */}, - {FzName: ts + 32430 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, + if Xsqlite3_strnicmp(tls, ts+5551 /* "detail" */, zCmd, nCmd) == 0 { + *(*[4]Fts5Enum)(unsafe.Pointer(bp + 48 /* aDetail */)) = [4]Fts5Enum{ + {FzName: ts + 17207 /* "none" */, FeVal: FTS5_DETAIL_NONE}, + {FzName: ts + 17212 /* "full" */}, + {FzName: ts + 33783 /* "columns" */, FeVal: FTS5_DETAIL_COLUMNS}, {}, } - if libc.AssignPtrInt32(bp+64 /* rc */, fts5ConfigSetEnum(tls, bp+72 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32438 /* "malformed detail..." */, 0) + if libc.AssignPtrInt32(bp+40 /* rc */, fts5ConfigSetEnum(tls, bp+48 /* &aDetail[0] */, zArg, (pConfig+92 /* &.eDetail */))) != 0 { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33791 /* "malformed detail..." */, 0) } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32469 /* "unrecognized opt..." */, libc.VaList(bp+40, nCmd, zCmd)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33822 /* "unrecognized opt..." */, libc.VaList(bp+24, nCmd, zCmd)) return SQLITE_ERROR } @@ -212659,19 +218769,19 @@ func fts5ConfigGobbleWord(tls *libc.TLS, pRc uintptr, zIn uintptr, pzOut uintptr } func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, pzErr uintptr) int32 { /* sqlite3.c:216929:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) var rc int32 = SQLITE_OK - if (0 == Xsqlite3_stricmp(tls, zCol, ts+21861 /* "rank" */)) || - (0 == Xsqlite3_stricmp(tls, zCol, ts+16110 /* "rowid" */)) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32497 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) + if (0 == Xsqlite3_stricmp(tls, zCol, ts+21876 /* "rank" */)) || + (0 == Xsqlite3_stricmp(tls, zCol, ts+16125 /* "rowid" */)) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33850 /* "reserved fts5 co..." */, libc.VaList(bp, zCol)) rc = SQLITE_ERROR } else if zArg != 0 { - if 0 == Xsqlite3_stricmp(tls, zArg, ts+32527 /* "unindexed" */) { + if 0 == Xsqlite3_stricmp(tls, zArg, ts+33880 /* "unindexed" */) { *(*U8)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FabUnindexed + uintptr((*Fts5Config)(unsafe.Pointer(p)).FnCol))) = U8(1) } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32537 /* "unrecognized col..." */, libc.VaList(bp+16, zArg)) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33890 /* "unrecognized col..." */, libc.VaList(bp+8, zArg)) rc = SQLITE_ERROR } } @@ -212682,26 +218792,26 @@ func fts5ConfigParseColumn(tls *libc.TLS, p uintptr, zCol uintptr, zArg uintptr, // Populate the Fts5Config.zContentExprlist string. func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:216957:12: */ - bp := tls.Alloc(72) - defer tls.Free(72) + bp := tls.Alloc(48) + defer tls.Free(48) var i int32 - *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK - *(*Fts5Buffer)(unsafe.Pointer(bp + 56 /* buf */)) = Fts5Buffer{} + *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK + *(*Fts5Buffer)(unsafe.Pointer(bp + 32 /* buf */)) = Fts5Buffer{} - sqlite3Fts5BufferAppendPrintf(tls, bp+48 /* &rc */, bp+56 /* &buf */, ts+32568 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+33921 /* "T.%Q" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(p)).FzContentRowid)) if (*Fts5Config)(unsafe.Pointer(p)).FeContent != FTS5_CONTENT_NONE { for i = 0; i < (*Fts5Config)(unsafe.Pointer(p)).FnCol; i++ { if (*Fts5Config)(unsafe.Pointer(p)).FeContent == FTS5_CONTENT_EXTERNAL { - sqlite3Fts5BufferAppendPrintf(tls, bp+48 /* &rc */, bp+56 /* &buf */, ts+32573 /* ", T.%Q" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+33926 /* ", T.%Q" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(p)).FazCol + uintptr(i)*8)))) } else { - sqlite3Fts5BufferAppendPrintf(tls, bp+48 /* &rc */, bp+56 /* &buf */, ts+32580 /* ", T.c%d" */, libc.VaList(bp+32, i)) + sqlite3Fts5BufferAppendPrintf(tls, bp+24 /* &rc */, bp+32 /* &buf */, ts+33933 /* ", T.c%d" */, libc.VaList(bp+16, i)) } } } - (*Fts5Config)(unsafe.Pointer(p)).FzContentExprlist = (*Fts5Buffer)(unsafe.Pointer(bp + 56 /* &buf */)).Fp - return *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) + (*Fts5Config)(unsafe.Pointer(p)).FzContentExprlist = (*Fts5Buffer)(unsafe.Pointer(bp + 32 /* &buf */)).Fp + return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) } // Arguments nArg/azArg contain the string arguments passed to the xCreate @@ -212715,10 +218825,10 @@ func fts5ConfigMakeExprlist(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:21695 // *pzErr. It is the responsibility of the caller to eventually free any // such error message using sqlite3_free(). func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int32, azArg uintptr, ppOut uintptr, pzErr uintptr) int32 { /* sqlite3.c:216990:12: */ - bp := tls.Alloc(100) - defer tls.Free(100) + bp := tls.Alloc(76) + defer tls.Free(76) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK // Return code + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK // Return code var pRet uintptr // New object to return var i int32 var nByte Sqlite3_int64 @@ -212732,109 +218842,109 @@ func sqlite3Fts5ConfigParse(tls *libc.TLS, pGlobal uintptr, db uintptr, nArg int (*Fts5Config)(unsafe.Pointer(pRet)).FiCookie = -1 nByte = (Sqlite3_int64(uint64(nArg) * (uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(U8(0)))))) - (*Fts5Config)(unsafe.Pointer(pRet)).FazCol = sqlite3Fts5MallocZero(tls, bp+64 /* &rc */, nByte) + (*Fts5Config)(unsafe.Pointer(pRet)).FazCol = sqlite3Fts5MallocZero(tls, bp+40 /* &rc */, nByte) (*Fts5Config)(unsafe.Pointer(pRet)).FabUnindexed = func() uintptr { if (*Fts5Config)(unsafe.Pointer(pRet)).FazCol != 0 { return ((*Fts5Config)(unsafe.Pointer(pRet)).FazCol + uintptr(nArg)*8) } return uintptr(0) }() - (*Fts5Config)(unsafe.Pointer(pRet)).FzDb = sqlite3Fts5Strndup(tls, bp+64 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 1*8)), -1) - (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+64 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzDb = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 1*8)), -1) + (*Fts5Config)(unsafe.Pointer(pRet)).FzName = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + 2*8)), -1) (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize = 1 (*Fts5Config)(unsafe.Pointer(pRet)).FeDetail = FTS5_DETAIL_FULL - if (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+21861 /* "rank" */) == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32588 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (Xsqlite3_stricmp(tls, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, ts+21876 /* "rank" */) == 0) { + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33941 /* "reserved fts5 ta..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pRet)).FzName)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } - for i = 3; (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && (i < nArg); i++ { + for i = 3; (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (i < nArg); i++ { var zOrig uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)) var z uintptr - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOne */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 88 /* zTwo */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) = uintptr(0) var bOption int32 = 0 - *(*int32)(unsafe.Pointer(bp + 80 /* bMustBeCol */)) = 0 + *(*int32)(unsafe.Pointer(bp + 56 /* bMustBeCol */)) = 0 - z = fts5ConfigGobbleWord(tls, bp+64 /* &rc */, zOrig, bp+72 /* &zOne */, bp+80 /* &bMustBeCol */) + z = fts5ConfigGobbleWord(tls, bp+40 /* &rc */, zOrig, bp+48 /* &zOne */, bp+56 /* &bMustBeCol */) z = fts5ConfigSkipWhitespace(tls, z) if (z != 0) && (int32(*(*int8)(unsafe.Pointer(z))) == '=') { bOption = 1 z++ - if *(*int32)(unsafe.Pointer(bp + 80 /* bMustBeCol */)) != 0 { + if *(*int32)(unsafe.Pointer(bp + 56 /* bMustBeCol */)) != 0 { z = uintptr(0) } } z = fts5ConfigSkipWhitespace(tls, z) if (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) { - // var bDummy int32 at bp+96, 4 + // var bDummy int32 at bp+72, 4 - z = fts5ConfigGobbleWord(tls, bp+64 /* &rc */, z, bp+88 /* &zTwo */, bp+96 /* &bDummy */) + z = fts5ConfigGobbleWord(tls, bp+40 /* &rc */, z, bp+64 /* &zTwo */, bp+72 /* &bDummy */) if (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) { z = uintptr(0) } } - if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { if z == uintptr(0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+32617 /* "parse error in \"..." */, libc.VaList(bp+16, zOrig)) - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+33970 /* "parse error in \"..." */, libc.VaList(bp+8, zOrig)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR } else { if bOption != 0 { - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = fts5ConfigParseSpecial(tls, pGlobal, pRet, *(*uintptr)(unsafe.Pointer(bp + 72 /* zOne */)), func() uintptr { - if *(*uintptr)(unsafe.Pointer(bp + 88 /* zTwo */)) != 0 { - return *(*uintptr)(unsafe.Pointer(bp + 88 /* zTwo */)) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseSpecial(tls, pGlobal, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), func() uintptr { + if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) != 0 { + return *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)) } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), pzErr) } else { - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 72 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 88 /* zTwo */)), pzErr) - *(*uintptr)(unsafe.Pointer(bp + 72 /* zOne */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigParseColumn(tls, pRet, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)), *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */)), pzErr) + *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */)) = uintptr(0) } } } - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* zOne */))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* zTwo */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zOne */))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zTwo */))) } // If a tokenizer= option was successfully parsed, the tokenizer has // already been allocated. Otherwise, allocate an instance of the default // tokenizer (unicode61) now. - if (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FpTok == uintptr(0)) { - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = fts5ConfigDefaultTokenizer(tls, pGlobal, pRet) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FpTok == uintptr(0)) { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigDefaultTokenizer(tls, pGlobal, pRet) } // If no zContent option was specified, fill in the default values. - if (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0)) { + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContent == uintptr(0)) { var zTail uintptr = uintptr(0) if (*Fts5Config)(unsafe.Pointer(pRet)).FeContent == FTS5_CONTENT_NORMAL { - zTail = ts + 32286 /* "content" */ + zTail = ts + 33639 /* "content" */ } else if (*Fts5Config)(unsafe.Pointer(pRet)).FbColumnsize != 0 { - zTail = ts + 32637 /* "docsize" */ + zTail = ts + 33990 /* "docsize" */ } if zTail != 0 { (*Fts5Config)(unsafe.Pointer(pRet)).FzContent = sqlite3Fts5Mprintf(tls, - bp+64 /* &rc */, ts+32645 /* "%Q.'%q_%s'" */, libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) + bp+40 /* &rc */, ts+33998 /* "%Q.'%q_%s'" */, libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pRet)).FzDb, (*Fts5Config)(unsafe.Pointer(pRet)).FzName, zTail)) } } - if (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { - (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+64 /* &rc */, ts+16110 /* "rowid" */, -1) + if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid == uintptr(0)) { + (*Fts5Config)(unsafe.Pointer(pRet)).FzContentRowid = sqlite3Fts5Strndup(tls, bp+40 /* &rc */, ts+16125 /* "rowid" */, -1) } // Formulate the zContentExprlist text - if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = fts5ConfigMakeExprlist(tls, pRet) + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = fts5ConfigMakeExprlist(tls, pRet) } - if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) != SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK { sqlite3Fts5ConfigFree(tls, pRet) *(*uintptr)(unsafe.Pointer(ppOut)) = uintptr(0) } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) } // Free the configuration object passed as the only argument. @@ -212864,32 +218974,32 @@ func sqlite3Fts5ConfigFree(tls *libc.TLS, pConfig uintptr) { /* sqlite3.c:217109 // object passed as the only argument. Return SQLITE_OK if successful, or // an SQLite error code if an error occurs. func sqlite3Fts5ConfigDeclareVtab(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:217136:12: */ - bp := tls.Alloc(68) - defer tls.Free(68) + bp := tls.Alloc(52) + defer tls.Free(52) var i int32 - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK var zSql uintptr - zSql = sqlite3Fts5Mprintf(tls, bp+64 /* &rc */, ts+32656 /* "CREATE TABLE x(" */, 0) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+34009 /* "CREATE TABLE x(" */, 0) for i = 0; (zSql != 0) && (i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol); i++ { var zSep uintptr = func() uintptr { if i == 0 { - return ts + 740 /* "" */ + return ts + 755 /* "" */ } - return ts + 14676 /* ", " */ + return ts + 14691 /* ", " */ }() - zSql = sqlite3Fts5Mprintf(tls, bp+64 /* &rc */, ts+32672 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+34025 /* "%z%s%Q" */, libc.VaList(bp, zSql, zSep, *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FazCol + uintptr(i)*8)))) } - zSql = sqlite3Fts5Mprintf(tls, bp+64 /* &rc */, ts+32679, /* "%z, %Q HIDDEN, %..." */ - libc.VaList(bp+32, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+21861 /* "rank" */)) + zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, ts+34032, /* "%z, %Q HIDDEN, %..." */ + libc.VaList(bp+24, zSql, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, ts+21876 /* "rank" */)) if zSql != 0 { - *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) + *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_declare_vtab(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql) Xsqlite3_free(tls, zSql) } - return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) } // Tokenize the text passed via the second and third arguments. @@ -213022,7 +219132,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa var rc int32 = SQLITE_OK - if 0 == Xsqlite3_stricmp(tls, zKey, ts+32705 /* "pgsz" */) { + if 0 == Xsqlite3_stricmp(tls, zKey, ts+34058 /* "pgsz" */) { var pgsz int32 = 0 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { pgsz = Xsqlite3_value_int(tls, pVal) @@ -213032,7 +219142,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).Fpgsz = pgsz } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32710 /* "hashsize" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+34063 /* "hashsize" */) { var nHashSize int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nHashSize = Xsqlite3_value_int(tls, pVal) @@ -213042,7 +219152,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = nHashSize } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32719 /* "automerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+34072 /* "automerge" */) { var nAutomerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nAutomerge = Xsqlite3_value_int(tls, pVal) @@ -213055,7 +219165,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnAutomerge = nAutomerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32729 /* "usermerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+34082 /* "usermerge" */) { var nUsermerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nUsermerge = Xsqlite3_value_int(tls, pVal) @@ -213065,7 +219175,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FnUsermerge = nUsermerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+32739 /* "crisismerge" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+34092 /* "crisismerge" */) { var nCrisisMerge int32 = -1 if SQLITE_INTEGER == Xsqlite3_value_numeric_type(tls, pVal) { nCrisisMerge = Xsqlite3_value_int(tls, pVal) @@ -213081,7 +219191,7 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa } (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = nCrisisMerge } - } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+21861 /* "rank" */) { + } else if 0 == Xsqlite3_stricmp(tls, zKey, ts+21876 /* "rank" */) { var zIn uintptr = Xsqlite3_value_text(tls, pVal) // var zRank uintptr at bp, 8 @@ -213105,13 +219215,13 @@ func sqlite3Fts5ConfigSetValue(tls *libc.TLS, pConfig uintptr, zKey uintptr, pVa // Load the contents of the %_config table into memory. func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 { /* sqlite3.c:217381:12: */ - bp := tls.Alloc(68) - defer tls.Free(68) + bp := tls.Alloc(52) + defer tls.Free(52) - var zSelect uintptr = ts + 32751 /* "SELECT k, v FROM..." */ + var zSelect uintptr = ts + 34104 /* "SELECT k, v FROM..." */ var zSql uintptr - *(*uintptr)(unsafe.Pointer(bp + 56 /* p */)) = uintptr(0) - *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK var iVersion int32 = 0 // Set default values @@ -213121,40 +219231,40 @@ func sqlite3Fts5ConfigLoad(tls *libc.TLS, pConfig uintptr, iCookie int32) int32 (*Fts5Config)(unsafe.Pointer(pConfig)).FnCrisisMerge = FTS5_DEFAULT_CRISISMERGE (*Fts5Config)(unsafe.Pointer(pConfig)).FnHashSize = (1024 * 1024) - zSql = sqlite3Fts5Mprintf(tls, bp+48 /* &rc */, zSelect, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + zSql = sqlite3Fts5Mprintf(tls, bp+32 /* &rc */, zSelect, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if zSql != 0 { - *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, bp+56 /* &p */, uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, bp+40 /* &p */, uintptr(0)) Xsqlite3_free(tls, zSql) } - if *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK { - for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* p */))) { - var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* p */)), 0) - var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* p */)), 1) - if 0 == Xsqlite3_stricmp(tls, zK, ts+32783 /* "version" */) { + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + for SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) { + var zK uintptr = Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 0) + var pVal uintptr = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */)), 1) + if 0 == Xsqlite3_stricmp(tls, zK, ts+34136 /* "version" */) { iVersion = Xsqlite3_value_int(tls, pVal) } else { - *(*int32)(unsafe.Pointer(bp + 64 /* bDummy */)) = 0 - sqlite3Fts5ConfigSetValue(tls, pConfig, zK, pVal, bp+64 /* &bDummy */) + *(*int32)(unsafe.Pointer(bp + 48 /* bDummy */)) = 0 + sqlite3Fts5ConfigSetValue(tls, pConfig, zK, pVal, bp+48 /* &bDummy */) } } - *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* p */))) + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* p */))) } - if (*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && (iVersion != FTS5_CURRENT_VERSION) { - *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = SQLITE_ERROR + if (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (iVersion != FTS5_CURRENT_VERSION) { + *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR if (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+32791, /* "invalid fts5 fil..." */ - libc.VaList(bp+24, iVersion, FTS5_CURRENT_VERSION)) + ts+34144, /* "invalid fts5 fil..." */ + libc.VaList(bp+16, iVersion, FTS5_CURRENT_VERSION)) } } - if *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { (*Fts5Config)(unsafe.Pointer(pConfig)).FiCookie = iCookie } - return *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) } // 2014 May 31 @@ -213219,8 +219329,8 @@ func fts5ExprIsspace(tls *libc.TLS, t int8) int32 { /* sqlite3.c:217576:12: */ // Read the first token from the nul-terminated string at *pz. func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) int32 { /* sqlite3.c:217583:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var z uintptr = *(*uintptr)(unsafe.Pointer(pz)) var tok int32 @@ -213280,7 +219390,7 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) } } if int32(*(*int8)(unsafe.Pointer(z2))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+32856 /* "unterminated str..." */, 0) + sqlite3Fts5ParseError(tls, pParse, ts+34209 /* "unterminated str..." */, 0) return FTS5_EOF } } @@ -213293,20 +219403,20 @@ func fts5ExprGetToken(tls *libc.TLS, pParse uintptr, pz uintptr, pToken uintptr) { var z2 uintptr if sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z))) == 0 { - sqlite3Fts5ParseError(tls, pParse, ts+32876 /* "fts5: syntax err..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+34229 /* "fts5: syntax err..." */, libc.VaList(bp, z)) return FTS5_EOF } tok = FTS5_STRING for z2 = (z + 1); sqlite3Fts5IsBareword(tls, *(*int8)(unsafe.Pointer(z2))) != 0; z2++ { } (*Fts5Token)(unsafe.Pointer(pToken)).Fn = (int32((int64(z2) - int64(z)) / 1)) - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32907 /* "OR" */, uint64(2)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 2) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+34260 /* "OR" */, uint64(2)) == 0) { tok = FTS5_OR } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+32910 /* "NOT" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+34263 /* "NOT" */, uint64(3)) == 0) { tok = FTS5_NOT } - if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+29656 /* "AND" */, uint64(3)) == 0) { + if ((*Fts5Token)(unsafe.Pointer(pToken)).Fn == 3) && (libc.Xmemcmp(tls, (*Fts5Token)(unsafe.Pointer(pToken)).Fp, ts+29671 /* "AND" */, uint64(3)) == 0) { tok = FTS5_AND } break @@ -215276,18 +221386,18 @@ func sqlite3Fts5ExprClonePhrase(tls *libc.TLS, pExpr uintptr, iPhrase int32, ppN // is expected. If token pTok does not contain "NEAR", store an error // in the pParse object. func sqlite3Fts5ParseNear(tls *libc.TLS, pParse uintptr, pTok uintptr) { /* sqlite3.c:219344:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) - if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+32914 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { + if ((*Fts5Token)(unsafe.Pointer(pTok)).Fn != 4) || (libc.Xmemcmp(tls, ts+34267 /* "NEAR" */, (*Fts5Token)(unsafe.Pointer(pTok)).Fp, uint64(4)) != 0) { sqlite3Fts5ParseError(tls, - pParse, ts+31943 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) + pParse, ts+33296 /* "fts5: syntax err..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(pTok)).Fn, (*Fts5Token)(unsafe.Pointer(pTok)).Fp)) } } func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p uintptr) { /* sqlite3.c:219352:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if pNear != 0 { var nNear int32 = 0 @@ -215297,7 +221407,7 @@ func sqlite3Fts5ParseSetDistance(tls *libc.TLS, pParse uintptr, pNear uintptr, p var c int8 = *(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i))) if (int32(c) < '0') || (int32(c) > '9') { sqlite3Fts5ParseError(tls, - pParse, ts+32919 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) + pParse, ts+34272 /* "expected integer..." */, libc.VaList(bp, (*Fts5Token)(unsafe.Pointer(p)).Fn, (*Fts5Token)(unsafe.Pointer(p)).Fp)) return } nNear = ((nNear * 10) + (int32(*(*int8)(unsafe.Pointer((*Fts5Token)(unsafe.Pointer(p)).Fp + uintptr(i)))) - '0')) @@ -215377,8 +221487,8 @@ func sqlite3Fts5ParseColsetInvert(tls *libc.TLS, pParse uintptr, p uintptr) uint } func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p uintptr) uintptr { /* sqlite3.c:219451:19: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pRet uintptr = uintptr(0) var iCol int32 @@ -215394,7 +221504,7 @@ func sqlite3Fts5ParseColset(tls *libc.TLS, pParse uintptr, pColset uintptr, p ui } } if iCol == (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol { - sqlite3Fts5ParseError(tls, pParse, ts+20244 /* "no such column: ..." */, libc.VaList(bp, z)) + sqlite3Fts5ParseError(tls, pParse, ts+20259 /* "no such column: ..." */, libc.VaList(bp, z)) } else { pRet = fts5ParseColset(tls, pParse, pColset, iCol) } @@ -215490,7 +221600,7 @@ func sqlite3Fts5ParseSetColset(tls *libc.TLS, pParse uintptr, pExpr uintptr, pCo if (*Fts5Config)(unsafe.Pointer((*Fts5Parse)(unsafe.Pointer(pParse)).FpConfig)).FeDetail == FTS5_DETAIL_NONE { (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+32948 /* "fts5: column que..." */, 0) + ts+34301 /* "fts5: column que..." */, 0) } else { fts5ParseSetColset(tls, pParse, pExpr, pColset, bp /* &pFree */) } @@ -215612,8 +221722,8 @@ func fts5ParsePhraseToAnd(tls *libc.TLS, pParse uintptr, pNear uintptr) uintptr // Allocate and return a new expression object. If anything goes wrong (i.e. // OOM error), leave an error code in pParse and return NULL. func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uintptr, pRight uintptr, pNear uintptr) uintptr { /* sqlite3.c:219698:21: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pRet uintptr = uintptr(0) @@ -215674,12 +221784,12 @@ func sqlite3Fts5ParseNode(tls *libc.TLS, pParse uintptr, eType int32, pLeft uint (*Fts5Parse)(unsafe.Pointer(pParse)).Frc = SQLITE_ERROR (*Fts5Parse)(unsafe.Pointer(pParse)).FzErr = Xsqlite3_mprintf(tls, - ts+33001, /* "fts5: %s queries..." */ + ts+34354, /* "fts5: %s queries..." */ libc.VaList(bp, func() uintptr { if (*Fts5ExprNearset)(unsafe.Pointer(pNear)).FnPhrase == 1 { - return ts + 33051 /* "phrase" */ + return ts + 34404 /* "phrase" */ } - return ts + 32914 /* "NEAR" */ + return ts + 34267 /* "NEAR" */ }())) Xsqlite3_free(tls, pRet) pRet = uintptr(0) @@ -217152,7 +223262,7 @@ func fts5DataRead(tls *libc.TLS, p uintptr, iRowid I64) uintptr { /* sqlite3.c:2 if ((*Fts5Index)(unsafe.Pointer(p)).FpReader == uintptr(0)) && (rc == SQLITE_OK) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, - (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+33058 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) + (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, ts+34411 /* "block" */, iRowid, 0, (p + 56 /* &.pReader */)) } // If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls @@ -217230,8 +223340,8 @@ func fts5IndexPrepareStmt(tls *libc.TLS, p uintptr, ppStmt uintptr, zSql uintptr // INSERT OR REPLACE a record into the %_data table. func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData int32) { /* sqlite3.c:221797:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { return @@ -217240,7 +223350,7 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in if (*Fts5Index)(unsafe.Pointer(p)).FpWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 64 /* &.pWriter */), Xsqlite3_mprintf(tls, - ts+33064, /* "REPLACE INTO '%q..." */ + ts+34417, /* "REPLACE INTO '%q..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return @@ -217258,8 +223368,8 @@ func fts5DataWrite(tls *libc.TLS, p uintptr, iRowid I64, pData uintptr, nData in // // DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite3.c:221821:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Fts5Index)(unsafe.Pointer(p)).Frc != SQLITE_OK { return @@ -217268,7 +223378,7 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite if (*Fts5Index)(unsafe.Pointer(p)).FpDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig var zSql uintptr = Xsqlite3_mprintf(tls, - ts+33115, /* "DELETE FROM '%q'..." */ + ts+34468, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if fts5IndexPrepareStmt(tls, p, (p+72 /* &.pDeleter */), zSql) != 0 { return @@ -217283,8 +223393,8 @@ func fts5DataDelete(tls *libc.TLS, p uintptr, iFirst I64, iLast I64) { /* sqlite // Remove all records associated with segment iSegid. func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3.c:221842:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var iFirst I64 = (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (int64(0))) var iLast I64 = ((((((I64(iSegid + 1)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (int64(0))) - int64(1)) @@ -217292,7 +223402,7 @@ func fts5DataRemoveSegment(tls *libc.TLS, p uintptr, iSegid int32) { /* sqlite3. if (*Fts5Index)(unsafe.Pointer(p)).FpIdxDeleter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 88 /* &.pIdxDeleter */), Xsqlite3_mprintf(tls, - ts+33164, /* "DELETE FROM '%q'..." */ + ts+34517, /* "DELETE FROM '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { @@ -217492,15 +223602,15 @@ func fts5StructureReadUncached(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c: } func fts5IndexDataVersion(tls *libc.TLS, p uintptr) I64 { /* sqlite3.c:222059:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var iVersion I64 = int64(0) if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { if (*Fts5Index)(unsafe.Pointer(p)).FpDataVersion == uintptr(0) { (*Fts5Index)(unsafe.Pointer(p)).Frc = fts5IndexPrepareStmt(tls, p, (p + 112 /* &.pDataVersion */), - Xsqlite3_mprintf(tls, ts+33204 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) + Xsqlite3_mprintf(tls, ts+34557 /* "PRAGMA %Q.data_v..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).FzDb))) if (*Fts5Index)(unsafe.Pointer(p)).Frc != 0 { return int64(0) } @@ -218928,14 +225038,14 @@ __31: } func fts5IdxSelectStmt(tls *libc.TLS, p uintptr) uintptr { /* sqlite3.c:223398:21: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) if (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 96 /* &.pIdxSelect */), Xsqlite3_mprintf(tls, - ts+33227, /* "SELECT pgno FROM..." */ + ts+34580, /* "SELECT pgno FROM..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } return (*Fts5Index)(unsafe.Pointer(p)).FpIdxSelect @@ -220192,7 +226302,7 @@ func fts5WriteFlushBtree(tls *libc.TLS, p uintptr, pWriter uintptr) { /* sqlite3 if (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fn > 0 { return (*Fts5SegWriter)(unsafe.Pointer(pWriter)).Fbtterm.Fp } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }() // The following was already done in fts5WriteInit(): // sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); @@ -220513,8 +226623,8 @@ func fts5WriteFinish(tls *libc.TLS, p uintptr, pWriter uintptr, pnLeaf uintptr) } func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* sqlite3.c:225137:13: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var nBuffer int32 = ((*Fts5Config)(unsafe.Pointer((*Fts5Index)(unsafe.Pointer(p)).FpConfig)).Fpgsz + FTS5_DATA_PADDING) @@ -220533,7 +226643,7 @@ func fts5WriteInit(tls *libc.TLS, p uintptr, pWriter uintptr, iSegid int32) { /* if (*Fts5Index)(unsafe.Pointer(p)).FpIdxWriter == uintptr(0) { var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig fts5IndexPrepareStmt(tls, p, (p + 80 /* &.pIdxWriter */), Xsqlite3_mprintf(tls, - ts+33311, /* "INSERT INTO '%q'..." */ + ts+34664, /* "INSERT INTO '%q'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName))) } @@ -221750,7 +227860,7 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 fts5StructureInvalidate(tls, p) fts5IndexDiscardData(tls, p) libc.Xmemset(tls, bp /* &s */, 0, uint64(unsafe.Sizeof(Fts5Structure{}))) - fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+740 /* "" */, 0) + fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), ts+755 /* "" */, 0) fts5StructureWrite(tls, p, bp /* &s */) return fts5IndexReturn(tls, p) } @@ -221761,36 +227871,36 @@ func sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:22636 // If successful, set *pp to point to the new object and return SQLITE_OK. // Otherwise, set *pp to NULL and return an SQLite error code. func sqlite3Fts5IndexOpen(tls *libc.TLS, pConfig uintptr, bCreate int32, pp uintptr, pzErr uintptr) int32 { /* sqlite3.c:226378:12: */ - bp := tls.Alloc(20) - defer tls.Free(20) + bp := tls.Alloc(12) + defer tls.Free(12) - *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK var p uintptr // New object - *(*uintptr)(unsafe.Pointer(pp)) = libc.AssignUintptr(&p, sqlite3Fts5MallocZero(tls, bp+16 /* &rc */, int64(unsafe.Sizeof(Fts5Index{})))) - if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*uintptr)(unsafe.Pointer(pp)) = libc.AssignUintptr(&p, sqlite3Fts5MallocZero(tls, bp+8 /* &rc */, int64(unsafe.Sizeof(Fts5Index{})))) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).FpConfig = pConfig (*Fts5Index)(unsafe.Pointer(p)).FnWorkUnit = FTS5_WORK_UNIT - (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+33368 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl = sqlite3Fts5Mprintf(tls, bp+8 /* &rc */, ts+34721 /* "%s_data" */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if ((*Fts5Index)(unsafe.Pointer(p)).FzDataTbl != 0) && (bCreate != 0) { - *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5CreateTable(tls, - pConfig, ts+24687 /* "data" */, ts+33376 /* "id INTEGER PRIMA..." */, 0, pzErr) - if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+11559, /* "idx" */ - ts+33411, /* "segid, term, pgn..." */ + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, + pConfig, ts+24702 /* "data" */, ts+34729 /* "id INTEGER PRIMA..." */, 0, pzErr) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5CreateTable(tls, pConfig, ts+11574, /* "idx" */ + ts+34764, /* "segid, term, pgn..." */ 1, pzErr) } - if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5IndexReinit(tls, p) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3Fts5IndexReinit(tls, p) } } } - if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != 0 { + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != 0 { sqlite3Fts5IndexClose(tls, p) *(*uintptr)(unsafe.Pointer(pp)) = uintptr(0) } - return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) } // Close a handle opened by an earlier call to sqlite3Fts5IndexOpen(). @@ -222083,7 +228193,7 @@ func sqlite3Fts5IndexSetCookie(tls *libc.TLS, p uintptr, iNew int32) int32 { /* sqlite3Fts5Put32(tls, bp /* &aCookie[0] */, iNew) rc = Xsqlite3_blob_open(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Index)(unsafe.Pointer(p)).FzDataTbl, - ts+33058 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) + ts+34411 /* "block" */, int64(FTS5_STRUCTURE_ROWID), 1, bp+8 /* &pBlob */) if rc == SQLITE_OK { Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */)), bp /* &aCookie[0] */, 4, 0) rc = Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))) @@ -222205,11 +228315,11 @@ func fts5IntegrityCheckPgidx(tls *libc.TLS, p uintptr, pLeaf uintptr) { /* sqlit } func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* sqlite3.c:227051:13: */ - bp := tls.Alloc(56) - defer tls.Free(56) + bp := tls.Alloc(48) + defer tls.Free(48) var pConfig uintptr = (*Fts5Index)(unsafe.Pointer(p)).FpConfig - *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) var rc2 int32 var iIdxPrevLeaf int32 = ((*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoFirst - 1) var iDlidxPrevLeaf int32 = (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FpgnoLast @@ -222218,20 +228328,20 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* return } - fts5IndexPrepareStmt(tls, p, bp+32 /* &pStmt */, Xsqlite3_mprintf(tls, + fts5IndexPrepareStmt(tls, p, bp+24 /* &pStmt */, Xsqlite3_mprintf(tls, - ts+33455, /* "SELECT segid, te..." */ + ts+34808, /* "SELECT segid, te..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5StructureSegment)(unsafe.Pointer(pSeg)).FiSegid))) // Iterate through the b-tree hierarchy. - for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))) { + for ((*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK) && (SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)))) { var iRow I64 // Rowid for this leaf var pLeaf uintptr // Data for this leaf - var zIdxTerm uintptr = Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 1) - var nIdxTerm int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 1) - var iIdxLeaf int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 2) - var bIdxDlidx int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), 3) + var zIdxTerm uintptr = Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 1) + var nIdxTerm int32 = Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 1) + var iIdxLeaf int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 2) + var bIdxDlidx int32 = Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), 3) // If the leaf in question has already been trimmed from the segment, // ignore this b-tree entry. Otherwise, load it into memory. @@ -222253,7 +228363,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* } else { var iOff int32 // Offset of first term on leaf var iRowidOff int32 // Offset of first rowid on leaf - // var nTerm int32 at bp+40, 4 + // var nTerm int32 at bp+32, 4 // Size of term on leaf in bytes var res int32 // Comparison of term and split-key @@ -222262,25 +228372,25 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* if (iRowidOff >= iOff) || (iOff >= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf) { (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) } else { - iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), bp+40 /* &nTerm */)) + iOff = iOff + (sqlite3Fts5GetVarint32(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), bp+32 /* &nTerm */)) res = func() int32 { if (func() int32 { - if (*(*int32)(unsafe.Pointer(bp + 40 /* nTerm */))) < (nIdxTerm) { - return *(*int32)(unsafe.Pointer(bp + 40 /* nTerm */)) + if (*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */))) < (nIdxTerm) { + return *(*int32)(unsafe.Pointer(bp + 32 /* nTerm */)) } return nIdxTerm }()) == 0 { return 0 } return libc.Xmemcmp(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iOff)), zIdxTerm, func() uint64 { - if (*(*int32)(unsafe.Pointer(bp + 40 /* nTerm */))) < (nIdxTerm) { - return uint64(*(*int32)(unsafe.Pointer(bp + 40 /* nTerm */))) + if (*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */))) < (nIdxTerm) { + return uint64(*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */))) } return uint64(nIdxTerm) }()) }() if res == 0 { - res = (*(*int32)(unsafe.Pointer(bp + 40 /* nTerm */)) - nIdxTerm) + res = (*(*int32)(unsafe.Pointer(bp + 32 /* nTerm */)) - nIdxTerm) } if res < 0 { (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) @@ -222330,15 +228440,15 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* iKey = (((((I64(iSegid)) << ((FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B) + FTS5_DATA_DLI_B)) + (I64((int64(0))) << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B))) + (I64((int64(0))) << (FTS5_DATA_PAGE_B))) + (I64(iPrevLeaf))) pLeaf = fts5DataRead(tls, p, iKey) if pLeaf != 0 { - // var iRowid I64 at bp+48, 8 + // var iRowid I64 at bp+40, 8 var iRowidOff int32 = int32(fts5GetU16(tls, (*Fts5Data)(unsafe.Pointer(pLeaf)).Fp)) if iRowidOff >= (*Fts5Data)(unsafe.Pointer(pLeaf)).FszLeaf { (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) } else { - sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iRowidOff)), bp+48 /* &iRowid */) - if *(*I64)(unsafe.Pointer(bp + 48 /* iRowid */)) != fts5DlidxIterRowid(tls, pDlidx) { + sqlite3Fts5GetVarint(tls, ((*Fts5Data)(unsafe.Pointer(pLeaf)).Fp + uintptr(iRowidOff)), bp+40 /* &iRowid */) + if *(*I64)(unsafe.Pointer(bp + 40 /* iRowid */)) != fts5DlidxIterRowid(tls, pDlidx) { (*Fts5Index)(unsafe.Pointer(p)).Frc = (SQLITE_CORRUPT | (int32(1) << 8)) } } @@ -222357,7 +228467,7 @@ func fts5IndexIntegrityCheckSegment(tls *libc.TLS, p uintptr, pSeg uintptr) { /* iIdxPrevLeaf = iIdxLeaf } - rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))) + rc2 = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) if (*Fts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK { (*Fts5Index)(unsafe.Pointer(p)).Frc = rc2 } @@ -222430,7 +228540,7 @@ func sqlite3Fts5IndexIntegrityCheck(tls *libc.TLS, p uintptr, cksum U64, bUseCks } else { (*Fts5Buffer)(unsafe.Pointer(bp + 16 /* &poslist */)).Fn = 0 fts5SegiterPoslist(tls, p, ((*(*uintptr)(unsafe.Pointer(bp /* pIter */)) + 96 /* &.aSeg */) + uintptr((*Fts5CResult)(unsafe.Pointer((*Fts5Iter)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pIter */)))).FaFirst+1*4)).FiFirst)*120), uintptr(0), bp+16 /* &poslist */) - sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+33541 /* "\x00\x00\x00\x00" */) + sqlite3Fts5BufferAppendBlob(tls, (p + 52 /* &.rc */), bp+16 /* &poslist */, uint32(4), ts+34894 /* "\x00\x00\x00\x00" */) for 0 == sqlite3Fts5PoslistNext64(tls, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fp, (*Fts5Buffer)(unsafe.Pointer(bp+16 /* &poslist */)).Fn, bp+32 /* &iOff */, bp+40 /* &iPos */) { var iCol int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) >> 32)) var iTokOff int32 = (int32(*(*I64)(unsafe.Pointer(bp + 40 /* iPos */)) & int64(0x7FFFFFFF))) @@ -222821,8 +228931,8 @@ func fts5UsePatternMatch(tls *libc.TLS, pConfig uintptr, p uintptr) int32 { /* s // // Costs are not modified by the ORDER BY clause. func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* sqlite3.c:228337:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(16) + defer tls.Free(16) var pTab uintptr = pVTab var pConfig uintptr = (*Fts5Table)(unsafe.Pointer(pTab)).FpConfig @@ -222841,7 +228951,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* if (*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0 { (*Fts5Table)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+33546 /* "recursively defi..." */, 0) + ts+34899 /* "recursively defi..." */, 0) return SQLITE_ERROR } @@ -222875,7 +228985,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } else if iCol >= 0 { bSeenMatch = 1 *(*int8)(unsafe.Pointer(idxStr + uintptr(libc.PostIncInt32(&iIdxStr, 1)))) = int8('M') - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+5436 /* "%d" */, libc.VaList(bp, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+5451 /* "%d" */, libc.VaList(bp, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) } @@ -222891,7 +229001,7 @@ func fts5BestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* } return int8('G') }() - Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+5436 /* "%d" */, libc.VaList(bp+16, iCol)) + Xsqlite3_snprintf(tls, 6, (idxStr + uintptr(iIdxStr)), ts+5451 /* "%d" */, libc.VaList(bp+8, iCol)) idxStr += uintptr(libc.Xstrlen(tls, (idxStr + uintptr(iIdxStr)))) (*sqlite3_index_constraint_usage)(unsafe.Pointer((*Sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&iCons, 1) @@ -223190,15 +229300,15 @@ func fts5CursorReseek(tls *libc.TLS, pCsr uintptr, pbSkip uintptr) int32 { /* sq // even if we reach end-of-file. The fts5EofMethod() will be called // subsequently to determine whether or not an EOF was hit. func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688:12: */ - bp := tls.Alloc(20) - defer tls.Free(20) + bp := tls.Alloc(12) + defer tls.Free(12) var pCsr uintptr = pCursor var rc int32 if (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan < 3 { - *(*int32)(unsafe.Pointer(bp + 16 /* bSkip */)) = 0 - if (libc.AssignInt32(&rc, fts5CursorReseek(tls, pCsr, bp+16 /* &bSkip */)) != 0) || (*(*int32)(unsafe.Pointer(bp + 16 /* bSkip */)) != 0) { + *(*int32)(unsafe.Pointer(bp + 8 /* bSkip */)) = 0 + if (libc.AssignInt32(&rc, fts5CursorReseek(tls, pCsr, bp+8 /* &bSkip */)) != 0) || (*(*int32)(unsafe.Pointer(bp + 8 /* bSkip */)) != 0) { return rc } rc = sqlite3Fts5ExprNext(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpExpr, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiLastRowid) @@ -223234,7 +229344,7 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: rc = Xsqlite3_reset(tls, (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpStmt) if rc != SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer((*Sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } } else { rc = SQLITE_OK @@ -223249,10 +229359,10 @@ func fts5NextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* sqlite3.c:228688: } func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt uintptr, va uintptr) int32 { /* sqlite3.c:228741:12: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) - *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) = uintptr(0) var rc int32 var zSql uintptr var ap Va_list @@ -223264,21 +229374,21 @@ func fts5PrepareStatement(tls *libc.TLS, ppStmt uintptr, pConfig uintptr, zFmt u rc = SQLITE_NOMEM } else { rc = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, - uint32(SQLITE_PREPARE_PERSISTENT), bp+16 /* &pRet */, uintptr(0)) + uint32(SQLITE_PREPARE_PERSISTENT), bp+8 /* &pRet */, uintptr(0)) if rc != SQLITE_OK { - *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) + *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb))) } Xsqlite3_free(tls, zSql) } _ = ap - *(*uintptr)(unsafe.Pointer(ppStmt)) = *(*uintptr)(unsafe.Pointer(bp + 16 /* pRet */)) + *(*uintptr)(unsafe.Pointer(ppStmt)) = *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) return rc } func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int32) int32 { /* sqlite3.c:228770:12: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(56) + defer tls.Free(56) var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig var pSorter uintptr @@ -223305,25 +229415,25 @@ func fts5CursorFirstSorted(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int3 // // If SQLite a built-in statement cache, this wouldn't be a problem. rc = fts5PrepareStatement(tls, (pSorter /* &.pStmt */), pConfig, - ts+33585, /* "SELECT rowid, ra..." */ + ts+34938, /* "SELECT rowid, ra..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zRank, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, func() uintptr { if zRankArgs != 0 { - return ts + 14676 /* ", " */ + return ts + 14691 /* ", " */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if zRankArgs != 0 { return zRankArgs } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }(), func() uintptr { if bDesc != 0 { - return ts + 33640 /* "DESC" */ + return ts + 34993 /* "DESC" */ } - return ts + 33645 /* "ASC" */ + return ts + 34998 /* "ASC" */ }())) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpSorter = pSorter @@ -223359,8 +229469,8 @@ func fts5CursorFirst(tls *libc.TLS, pTab uintptr, pCsr uintptr, bDesc int32) int // the text passed to the MATCH operator are used as the special query // parameters. func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) int32 { /* sqlite3.c:228839:12: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var rc int32 = SQLITE_OK // Return code var z uintptr = zQuery // Special query text @@ -223374,13 +229484,13 @@ func fts5SpecialMatch(tls *libc.TLS, pTab uintptr, pCsr uintptr, zQuery uintptr) (*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan = FTS5_PLAN_SPECIAL - if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+33649 /* "reads" */, z, n)) { + if (n == 5) && (0 == Xsqlite3_strnicmp(tls, ts+35002 /* "reads" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = I64(sqlite3Fts5IndexReads(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpIndex)) - } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+5518 /* "id" */, z, n)) { + } else if (n == 2) && (0 == Xsqlite3_strnicmp(tls, ts+5533 /* "id" */, z, n)) { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiSpecial = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FiCsrId } else { // An unrecognized directive. Return an error message. - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33655 /* "unknown special ..." */, libc.VaList(bp, n, z)) + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+35008 /* "unknown special ..." */, libc.VaList(bp, n, z)) rc = SQLITE_ERROR } @@ -223404,89 +229514,89 @@ func fts5FindAuxiliary(tls *libc.TLS, pTab uintptr, zName uintptr) uintptr { /* } func fts5FindRankFunction(tls *libc.TLS, pCsr uintptr) int32 { /* sqlite3.c:228886:12: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(32) + defer tls.Free(32) var pTab uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig - *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK var pAux uintptr = uintptr(0) var zRank uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank var zRankArgs uintptr = (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs if zRankArgs != 0 { - var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+32 /* &rc */, ts+33683 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) + var zSql uintptr = sqlite3Fts5Mprintf(tls, bp+16 /* &rc */, ts+35036 /* "SELECT %s" */, libc.VaList(bp, zRankArgs)) if zSql != 0 { - *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt */)) = uintptr(0) - *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, - uint32(SQLITE_PREPARE_PERSISTENT), bp+40 /* &pStmt */, uintptr(0)) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_prepare_v3(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, + uint32(SQLITE_PREPARE_PERSISTENT), bp+24 /* &pStmt */, uintptr(0)) Xsqlite3_free(tls, zSql) - if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { - if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt */))) { + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) { var nByte Sqlite3_int64 - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt */))) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) nByte = (Sqlite3_int64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg))) - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg = sqlite3Fts5MallocZero(tls, bp+32 /* &rc */, nByte) - if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg = sqlite3Fts5MallocZero(tls, bp+16 /* &rc */, nByte) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { var i int32 for i = 0; i < (*Fts5Cursor)(unsafe.Pointer(pCsr)).FnRankArg; i++ { - *(*uintptr)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt */)), i) + *(*uintptr)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).FapRankArg + uintptr(i)*8)) = Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)), i) } } - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt = *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt */)) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRankArgStmt = *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */)) } else { - *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt */))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt */))) } } } } - if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { pAux = fts5FindAuxiliary(tls, pTab, zRank) if pAux == uintptr(0) { - (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+33693 /* "no such function..." */, libc.VaList(bp+16, zRank)) - *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR + (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, ts+35046 /* "no such function..." */, libc.VaList(bp+8, zRank)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } } (*Fts5Cursor)(unsafe.Pointer(pCsr)).FpRank = pAux - return *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) } func fts5CursorParseRank(tls *libc.TLS, pConfig uintptr, pCsr uintptr, pRank uintptr) int32 { /* sqlite3.c:228937:12: */ - bp := tls.Alloc(32) - defer tls.Free(32) + bp := tls.Alloc(24) + defer tls.Free(24) var rc int32 = SQLITE_OK if pRank != 0 { var z uintptr = Xsqlite3_value_text(tls, pRank) - *(*uintptr)(unsafe.Pointer(bp + 16 /* zRank */)) = uintptr(0) - *(*uintptr)(unsafe.Pointer(bp + 24 /* zRankArgs */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* zRank */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 16 /* zRankArgs */)) = uintptr(0) if z == uintptr(0) { if Xsqlite3_value_type(tls, pRank) == SQLITE_NULL { rc = SQLITE_ERROR } } else { - rc = sqlite3Fts5ConfigParseRank(tls, z, bp+16 /* &zRank */, bp+24 /* &zRankArgs */) + rc = sqlite3Fts5ConfigParseRank(tls, z, bp+8 /* &zRank */, bp+16 /* &zRankArgs */) } if rc == SQLITE_OK { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = *(*uintptr)(unsafe.Pointer(bp + 16 /* zRank */)) - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = *(*uintptr)(unsafe.Pointer(bp + 24 /* zRankArgs */)) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = *(*uintptr)(unsafe.Pointer(bp + 8 /* zRank */)) + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = *(*uintptr)(unsafe.Pointer(bp + 16 /* zRankArgs */)) *(*int32)(unsafe.Pointer(pCsr + 80 /* &.csrflags */)) |= (FTS5CSR_FREE_ZRANK) } else if rc == SQLITE_ERROR { (*Sqlite3_vtab)(unsafe.Pointer((*Fts5Cursor)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+33714 /* "parse error in r..." */, libc.VaList(bp, z)) + ts+35067 /* "parse error in r..." */, libc.VaList(bp, z)) } } else { if (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank != 0 { (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRank (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = (*Fts5Config)(unsafe.Pointer(pConfig)).FzRankArgs } else { - (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 32097 /* "bm25" */ + (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRank = ts + 33450 /* "bm25" */ (*Fts5Cursor)(unsafe.Pointer(pCsr)).FzRankArgs = uintptr(0) } } @@ -223513,8 +229623,8 @@ func fts5GetRowidLimit(tls *libc.TLS, pVal uintptr, iDefault I64) I64 { /* sqlit // 2. A by-rowid lookup. // 3. A full-table scan. func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, nVal int32, apVal uintptr) int32 { /* sqlite3.c:228995:12: */ - bp := tls.Alloc(24) - defer tls.Free(24) + bp := tls.Alloc(16) + defer tls.Free(16) var pTab uintptr var pConfig uintptr @@ -223530,7 +229640,7 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp var pzErrmsg uintptr var i int32 var iIdxStr int32 - // var pExpr uintptr at bp+16, 8 + // var pExpr uintptr at bp+8, 8 var pzErr uintptr var zText uintptr @@ -223546,13 +229656,13 @@ func fts5FilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintp pRowidGe = uintptr(0) pzErrmsg = (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg iIdxStr = 0 - *(*uintptr)(unsafe.Pointer(bp + 16 /* pExpr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */)) = uintptr(0) if !((*Fts5Config)(unsafe.Pointer(pConfig)).FbLock != 0) { goto __1 } (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+33546 /* "recursively defi..." */, 0) + ts+34899 /* "recursively defi..." */, 0) return SQLITE_ERROR __1: ; @@ -223598,7 +229708,7 @@ __8: if !(zText == uintptr(0)) { goto __14 } - zText = ts + 740 /* "" */ + zText = ts + 755 /* "" */ __14: ; iCol = 0 @@ -223625,12 +229735,12 @@ __17: goto __19 __18: pzErr = (pTab /* &.p */ /* &.base */ + 16 /* &.zErrMsg */) - rc = sqlite3Fts5ExprNew(tls, pConfig, 0, iCol, zText, bp+16 /* &pExpr */, pzErr) + rc = sqlite3Fts5ExprNew(tls, pConfig, 0, iCol, zText, bp+8 /* &pExpr */, pzErr) if !(rc == SQLITE_OK) { goto __20 } - rc = sqlite3Fts5ExprAnd(tls, (pCsr + 64 /* &.pExpr */), *(*uintptr)(unsafe.Pointer(bp + 16 /* pExpr */))) - *(*uintptr)(unsafe.Pointer(bp + 16 /* pExpr */)) = uintptr(0) + rc = sqlite3Fts5ExprAnd(tls, (pCsr + 64 /* &.pExpr */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */)) = uintptr(0) __20: ; if !(rc != SQLITE_OK) { @@ -223663,14 +229773,14 @@ __24: if !(zText1 != 0) { goto __25 } - rc = sqlite3Fts5ExprPattern(tls, pConfig, bGlob, iCol, zText1, bp+16 /* &pExpr */) + rc = sqlite3Fts5ExprPattern(tls, pConfig, bGlob, iCol, zText1, bp+8 /* &pExpr */) __25: ; if !(rc == SQLITE_OK) { goto __26 } - rc = sqlite3Fts5ExprAnd(tls, (pCsr + 64 /* &.pExpr */), *(*uintptr)(unsafe.Pointer(bp + 16 /* pExpr */))) - *(*uintptr)(unsafe.Pointer(bp + 16 /* pExpr */)) = uintptr(0) + rc = sqlite3Fts5ExprAnd(tls, (pCsr + 64 /* &.pExpr */), *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */))) + *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */)) = uintptr(0) __26: ; if !(rc != SQLITE_OK) { @@ -223787,7 +229897,7 @@ __35: goto __40 } *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+33747 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+35100 /* "%s: table does n..." */, libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) rc = SQLITE_ERROR goto __41 __40: @@ -223825,7 +229935,7 @@ __32: ; filter_out: - sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pExpr */))) + sqlite3Fts5ExprFree(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pExpr */))) (*Fts5Config)(unsafe.Pointer(pConfig)).FpzErrmsg = pzErrmsg return rc } @@ -223888,8 +229998,8 @@ func fts5RowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* // If argument bErrormsg is true and an error occurs, an error message may // be left in sqlite3_vtab.zErrMsg. func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sqlite3.c:229244:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = SQLITE_OK @@ -223924,7 +230034,7 @@ func fts5SeekCursor(tls *libc.TLS, pCsr uintptr, bErrormsg int32) int32 { /* sql rc = (SQLITE_CORRUPT | (int32(1) << 8)) } else if (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg != 0 { *(*uintptr)(unsafe.Pointer((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).FpzErrmsg)) = Xsqlite3_mprintf(tls, - ts+3615 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) + ts+3630 /* "%s" */, libc.VaList(bp, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pTab)).FpConfig)).Fdb))) } } } @@ -223961,29 +230071,29 @@ func fts5SpecialInsert(tls *libc.TLS, pTab uintptr, zCmd uintptr, pVal uintptr) var rc int32 = SQLITE_OK *(*int32)(unsafe.Pointer(bp /* bError */)) = 0 - if 0 == Xsqlite3_stricmp(tls, ts+33783 /* "delete-all" */, zCmd) { + if 0 == Xsqlite3_stricmp(tls, ts+35136 /* "delete-all" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { fts5SetVtabError(tls, pTab, - ts+33794 /* "'delete-all' may..." */, 0) + ts+35147 /* "'delete-all' may..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageDeleteAll(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+33874 /* "rebuild" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+35227 /* "rebuild" */, zCmd) { if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NONE { fts5SetVtabError(tls, pTab, - ts+33882 /* "'rebuild' may no..." */, 0) + ts+35235 /* "'rebuild' may no..." */, 0) rc = SQLITE_ERROR } else { rc = sqlite3Fts5StorageRebuild(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) } - } else if 0 == Xsqlite3_stricmp(tls, ts+16802 /* "optimize" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+16817 /* "optimize" */, zCmd) { rc = sqlite3Fts5StorageOptimize(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage) - } else if 0 == Xsqlite3_stricmp(tls, ts+33938 /* "merge" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+35291 /* "merge" */, zCmd) { var nMerge int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageMerge(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, nMerge) - } else if 0 == Xsqlite3_stricmp(tls, ts+33944 /* "integrity-check" */, zCmd) { + } else if 0 == Xsqlite3_stricmp(tls, ts+35297 /* "integrity-check" */, zCmd) { var iArg int32 = Xsqlite3_value_int(tls, pVal) rc = sqlite3Fts5StorageIntegrity(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iArg) } else { @@ -224036,13 +230146,13 @@ func fts5StorageInsert(tls *libc.TLS, pRc uintptr, pTab uintptr, apVal uintptr, // 3. Values for each of the nCol matchable columns. // 4. Values for the two hidden columns ( and "rank"). func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, pRowid uintptr) int32 { /* sqlite3.c:229405:12: */ - bp := tls.Alloc(28) - defer tls.Free(28) + bp := tls.Alloc(20) + defer tls.Free(20) var pTab uintptr = pVtab var pConfig uintptr = (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig var eType0 int32 // value_type() of apVal[0] - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK // Return code + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK // Return code // A transaction must be open when this is called. @@ -224057,10 +230167,10 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // A "special" INSERT op. These are handled separately. var z uintptr = Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol))*8))) if ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent != FTS5_CONTENT_NORMAL) && - (0 == Xsqlite3_stricmp(tls, ts+17331 /* "delete" */, z)) { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) + (0 == Xsqlite3_stricmp(tls, ts+17346 /* "delete" */, z)) { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialDelete(tls, pTab, apVal) } else { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = fts5SpecialInsert(tls, pTab, z, *(*uintptr)(unsafe.Pointer(apVal + uintptr(((2+(*Fts5Config)(unsafe.Pointer(pConfig)).FnCol)+1))*8))) } } else { // A regular INSERT, UPDATE or DELETE statement. The trick here is that @@ -224082,58 +230192,58 @@ func fts5UpdateMethod(tls *libc.TLS, pVtab uintptr, nArg int32, apVal uintptr, p // This is not suported. if (eType0 == SQLITE_INTEGER) && (fts5IsContentless(tls, pTab) != 0) { (*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.Fbase.FzErrMsg = Xsqlite3_mprintf(tls, - ts+33960, /* "cannot %s conten..." */ + ts+35313, /* "cannot %s conten..." */ libc.VaList(bp, func() uintptr { if nArg > 1 { - return ts + 20145 /* "UPDATE" */ + return ts + 20160 /* "UPDATE" */ } - return ts + 33997 /* "DELETE from" */ + return ts + 35350 /* "DELETE from" */ }(), (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_ERROR + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR } else if nArg == 1 { var iDel I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal))) // Rowid to delete - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iDel, uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iDel, uintptr(0)) } else { var eType1 int32 = Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) if (eType1 != SQLITE_INTEGER) && (eType1 != SQLITE_NULL) { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_MISMATCH + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_MISMATCH } else if eType0 != SQLITE_INTEGER { // If this is a REPLACE, first remove the current entry (if any) if (eConflict == SQLITE_REPLACE) && (eType1 == SQLITE_INTEGER) { var iNew I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) // Rowid to delete - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iNew, uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iNew, uintptr(0)) } - fts5StorageInsert(tls, bp+24 /* &rc */, pTab, apVal, pRowid) + fts5StorageInsert(tls, bp+16 /* &rc */, pTab, apVal, pRowid) } else { var iOld I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal))) // Old rowid var iNew I64 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8))) // New rowid if (eType1 == SQLITE_INTEGER) && (iOld != iNew) { if eConflict == SQLITE_REPLACE { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) - if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iNew, uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iNew, uintptr(0)) } - fts5StorageInsert(tls, bp+24 /* &rc */, pTab, apVal, pRowid) + fts5StorageInsert(tls, bp+16 /* &rc */, pTab, apVal, pRowid) } else { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageContentInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, pRowid) - if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageContentInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, pRowid) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) } - if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageIndexInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, *(*Sqlite_int64)(unsafe.Pointer(pRowid))) + if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageIndexInsert(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, apVal, *(*Sqlite_int64)(unsafe.Pointer(pRowid))) } } } else { - *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) - fts5StorageInsert(tls, bp+24 /* &rc */, pTab, apVal, pRowid) + *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3Fts5StorageDelete(tls, (*Fts5FullTable)(unsafe.Pointer(pTab)).FpStorage, iOld, uintptr(0)) + fts5StorageInsert(tls, bp+16 /* &rc */, pTab, apVal, pRowid) } } } } (*Fts5Config)(unsafe.Pointer((*Fts5FullTable)(unsafe.Pointer(pTab)).Fp.FpConfig)).FpzErrmsg = uintptr(0) - return *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) } // Implementation of xSync() method. @@ -224745,8 +230855,8 @@ func fts5CursorFromCsrid(tls *libc.TLS, pGlobal uintptr, iCsrId I64) uintptr { / } func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* sqlite3.c:230147:13: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pAux uintptr var pCsr uintptr @@ -224757,7 +230867,7 @@ func fts5ApiCallback(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { pCsr = fts5CursorFromCsrid(tls, (*Fts5Auxiliary)(unsafe.Pointer(pAux)).FpGlobal, iCsrId) if (pCsr == uintptr(0)) || ((*Fts5Cursor)(unsafe.Pointer(pCsr)).FePlan == 0) { - var zErr uintptr = Xsqlite3_mprintf(tls, ts+34009 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) + var zErr uintptr = Xsqlite3_mprintf(tls, ts+35362 /* "no such cursor: ..." */, libc.VaList(bp, iCsrId)) Xsqlite3_result_error(tls, context, zErr, -1) Xsqlite3_free(tls, zErr) } else { @@ -225047,8 +231157,8 @@ func fts5FindTokenizer(tls *libc.TLS, pApi uintptr, zName uintptr, ppUserData ui } func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg int32, pConfig uintptr, pzErr uintptr) int32 { /* sqlite3.c:230505:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var pMod uintptr var rc int32 = SQLITE_OK @@ -225062,7 +231172,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg if pMod == uintptr(0) { rc = SQLITE_ERROR - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34030 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35383 /* "no such tokenize..." */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(azArg)))) } else { rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pMod + 16 /* &.x */ /* &.xCreate */))))(tls, (*Fts5TokenizerModule)(unsafe.Pointer(pMod)).FpUserData, func() uintptr { @@ -225079,7 +231189,7 @@ func sqlite3Fts5GetTokenizer(tls *libc.TLS, pGlobal uintptr, azArg uintptr, nArg (*Fts5Config)(unsafe.Pointer(pConfig)).FpTokApi = (pMod + 16 /* &.x */) if rc != SQLITE_OK { if pzErr != 0 { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+34052 /* "error in tokeniz..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35405 /* "error in tokeniz..." */, 0) } } else { (*Fts5Config)(unsafe.Pointer(pConfig)).FePattern = sqlite3Fts5TokenizerPattern(tls, @@ -225126,7 +231236,7 @@ func fts5Fts5Func(tls *libc.TLS, pCtx uintptr, nArg int32, apArg uintptr) { /* s var ppApi uintptr _ = nArg - ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+34083 /* "fts5_api_ptr" */) + ppApi = Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(apArg)), ts+35436 /* "fts5_api_ptr" */) if ppApi != 0 { *(*uintptr)(unsafe.Pointer(ppApi)) = (pGlobal /* &.api */) } @@ -225137,7 +231247,7 @@ func fts5SourceIdFunc(tls *libc.TLS, pCtx uintptr, nArg int32, apUnused uintptr) _ = nArg _ = apUnused - Xsqlite3_result_text(tls, pCtx, ts+34096 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) + Xsqlite3_result_text(tls, pCtx, ts+35449 /* "fts5: 2021-06-18..." */, -1, libc.UintptrFromInt32(-1)) } // Return true if zName is the extension on one of the shadow tables used @@ -225153,7 +231263,7 @@ func fts5ShadowName(tls *libc.TLS, zName uintptr) int32 { /* sqlite3.c:230592:12 } var azName2 = [5]uintptr{ - ts + 34187 /* "config" */, ts + 32286 /* "content" */, ts + 24687 /* "data" */, ts + 32637 /* "docsize" */, ts + 11559, /* "idx" */ + ts + 35540 /* "config" */, ts + 33639 /* "content" */, ts + 24702 /* "data" */, ts + 33990 /* "docsize" */, ts + 11574, /* "idx" */ } /* sqlite3.c:230593:21 */ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ @@ -225177,7 +231287,7 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ (*Fts5Global)(unsafe.Pointer(pGlobal)).Fapi.FxFindTokenizer = *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32 }{fts5FindTokenizer})) - rc = Xsqlite3_create_module_v2(tls, db, ts+34194 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) + rc = Xsqlite3_create_module_v2(tls, db, ts+35547 /* "fts5" */, uintptr(unsafe.Pointer(&fts5Mod)), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5ModuleDestroy}))) if rc == SQLITE_OK { rc = sqlite3Fts5IndexInit(tls, db) } @@ -225195,13 +231305,13 @@ func fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230603:12: */ } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+34194 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+35547 /* "fts5" */, 1, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5Fts5Func})), uintptr(0), uintptr(0)) } if rc == SQLITE_OK { rc = Xsqlite3_create_function(tls, - db, ts+34199 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { + db, ts+35552 /* "fts5_source_id" */, 0, SQLITE_UTF8, p, *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, int32, uintptr) }{fts5SourceIdFunc})), uintptr(0), uintptr(0)) } @@ -225257,8 +231367,8 @@ func Xsqlite3Fts5Init(tls *libc.TLS, db uintptr) int32 { /* sqlite3.c:230712:20: // Return SQLITE_OK if successful, or an SQLite error code if an error // occurs. func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, pzErrMsg uintptr) int32 { /* sqlite3.c:230770:12: */ - bp := tls.Alloc(264) - defer tls.Free(264) + bp := tls.Alloc(216) + defer tls.Free(216) var rc int32 = SQLITE_OK @@ -225266,28 +231376,28 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p // statements to operate on it. if *(*uintptr)(unsafe.Pointer((p + 40 /* &.aStmt */) + uintptr(eStmt)*8)) == uintptr(0) { - *(*[11]uintptr)(unsafe.Pointer(bp + 176 /* azStmt */)) = [11]uintptr{ - ts + 34214, /* "SELECT %s FROM %..." */ - ts + 34282, /* "SELECT %s FROM %..." */ - ts + 34351, /* "SELECT %s FROM %..." */ // LOOKUP + *(*[11]uintptr)(unsafe.Pointer(bp + 128 /* azStmt */)) = [11]uintptr{ + ts + 35567, /* "SELECT %s FROM %..." */ + ts + 35635, /* "SELECT %s FROM %..." */ + ts + 35704, /* "SELECT %s FROM %..." */ // LOOKUP - ts + 34384, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT - ts + 34423, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT - ts + 34463, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT - ts + 34502, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE - ts + 34543, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE + ts + 35737, /* "INSERT INTO %Q.'..." */ // INSERT_CONTENT + ts + 35776, /* "REPLACE INTO %Q...." */ // REPLACE_CONTENT + ts + 35816, /* "DELETE FROM %Q.'..." */ // DELETE_CONTENT + ts + 35855, /* "REPLACE INTO %Q...." */ // REPLACE_DOCSIZE + ts + 35896, /* "DELETE FROM %Q.'..." */ // DELETE_DOCSIZE - ts + 34582, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE + ts + 35935, /* "SELECT sz FROM %..." */ // LOOKUP_DOCSIZE - ts + 34624, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG - ts + 34664, /* "SELECT %s FROM %..." */ // SCAN + ts + 35977, /* "REPLACE INTO %Q...." */ // REPLACE_CONFIG + ts + 36017, /* "SELECT %s FROM %..." */ // SCAN } var pC uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr = uintptr(0) switch eStmt { case FTS5_STMT_SCAN: - zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &azStmt[0] */ + uintptr(eStmt)*8)), + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, (*Fts5Config)(unsafe.Pointer(pC)).FzContent)) break fallthrough @@ -225295,15 +231405,15 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p case FTS5_STMT_SCAN_ASC: fallthrough case FTS5_STMT_SCAN_DESC: - zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+24, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+16, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, (*Fts5Config)(unsafe.Pointer(pC)).FzContent, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid)) break fallthrough case FTS5_STMT_LOOKUP: - zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &azStmt[0] */ + uintptr(eStmt)*8)), - libc.VaList(bp+72, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, (*Fts5Config)(unsafe.Pointer(pC)).FzContent, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid)) + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), + libc.VaList(bp+56, (*Fts5Config)(unsafe.Pointer(pC)).FzContentExprlist, (*Fts5Config)(unsafe.Pointer(pC)).FzContent, (*Fts5Config)(unsafe.Pointer(pC)).FzContentRowid)) break fallthrough @@ -225322,7 +231432,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p *(*int8)(unsafe.Pointer(zBind + uintptr(((i * 2) + 1)))) = int8(',') } *(*int8)(unsafe.Pointer(zBind + uintptr(((i * 2) - 1)))) = int8(0) - zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+104, (*Fts5Config)(unsafe.Pointer(pC)).FzDb, (*Fts5Config)(unsafe.Pointer(pC)).FzName, zBind)) + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+80, (*Fts5Config)(unsafe.Pointer(pC)).FzDb, (*Fts5Config)(unsafe.Pointer(pC)).FzName, zBind)) Xsqlite3_free(tls, zBind) } break @@ -225331,7 +231441,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p fallthrough default: - zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+136, (*Fts5Config)(unsafe.Pointer(pC)).FzDb, (*Fts5Config)(unsafe.Pointer(pC)).FzName)) + zSql = Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* &azStmt[0] */ + uintptr(eStmt)*8)), libc.VaList(bp+104, (*Fts5Config)(unsafe.Pointer(pC)).FzDb, (*Fts5Config)(unsafe.Pointer(pC)).FzName)) break } @@ -225347,7 +231457,7 @@ func fts5StorageGetStmt(tls *libc.TLS, p uintptr, eStmt int32, ppStmt uintptr, p (*Fts5Config)(unsafe.Pointer((*Fts5Storage)(unsafe.Pointer(p)).FpConfig)).FbLock-- Xsqlite3_free(tls, zSql) if (rc != SQLITE_OK) && (pzErrMsg != 0) { - *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+3615 /* "%s" */, libc.VaList(bp+160, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) + *(*uintptr)(unsafe.Pointer(pzErrMsg)) = Xsqlite3_mprintf(tls, ts+3630 /* "%s" */, libc.VaList(bp+120, Xsqlite3_errmsg(tls, (*Fts5Config)(unsafe.Pointer(pC)).Fdb))) } } } @@ -225380,35 +231490,35 @@ func fts5ExecPrintf(tls *libc.TLS, db uintptr, pzErr uintptr, zFormat uintptr, v // Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error // code otherwise. func sqlite3Fts5DropAll(tls *libc.TLS, pConfig uintptr) int32 { /* sqlite3.c:230901:12: */ - bp := tls.Alloc(104) - defer tls.Free(104) + bp := tls.Alloc(80) + defer tls.Free(80) var rc int32 = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34687, /* "DROP TABLE IF EX..." */ + ts+36040, /* "DROP TABLE IF EX..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34791, /* "DROP TABLE IF EX..." */ - libc.VaList(bp+56, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+36144, /* "DROP TABLE IF EX..." */ + libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34829, /* "DROP TABLE IF EX..." */ - libc.VaList(bp+80, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+36182, /* "DROP TABLE IF EX..." */ + libc.VaList(bp+64, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } return rc } func fts5StorageRenameOne(tls *libc.TLS, pConfig uintptr, pRc uintptr, zTail uintptr, zName uintptr) { /* sqlite3.c:230925:13: */ - bp := tls.Alloc(48) - defer tls.Free(48) + bp := tls.Alloc(40) + defer tls.Free(40) if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK { *(*int32)(unsafe.Pointer(pRc)) = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+34867, /* "ALTER TABLE %Q.'..." */ + ts+36220, /* "ALTER TABLE %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zTail, zName, zTail)) } } @@ -225420,14 +231530,14 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(pStorage)).FpConfig *(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3Fts5StorageSync(tls, pStorage) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+24687 /* "data" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+11559 /* "idx" */, zName) - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+34187 /* "config" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+24702 /* "data" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+11574 /* "idx" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+35540 /* "config" */, zName) if (*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0 { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32637 /* "docsize" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+33990 /* "docsize" */, zName) } if (*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL { - fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+32286 /* "content" */, zName) + fts5StorageRenameOne(tls, pConfig, bp /* &rc */, ts+33639 /* "content" */, zName) } return *(*int32)(unsafe.Pointer(bp /* rc */)) } @@ -225435,25 +231545,25 @@ func sqlite3Fts5StorageRename(tls *libc.TLS, pStorage uintptr, zName uintptr) in // Create the shadow table named zPost, with definition zDefn. Return // SQLITE_OK if successful, or an SQLite error code otherwise. func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn uintptr, bWithout int32, pzErr uintptr) int32 { /* sqlite3.c:230959:12: */ - bp := tls.Alloc(88) - defer tls.Free(88) + bp := tls.Alloc(72) + defer tls.Free(72) var rc int32 - *(*uintptr)(unsafe.Pointer(bp + 80 /* zErr */)) = uintptr(0) + *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) = uintptr(0) - rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+80 /* &zErr */, ts+34909, /* "CREATE TABLE %Q...." */ + rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, bp+64 /* &zErr */, ts+36262, /* "CREATE TABLE %Q...." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, zDefn, func() uintptr { if bWithout != 0 { - return ts + 29302 /* " WITHOUT ROWID" */ + return ts + 29317 /* " WITHOUT ROWID" */ } - return ts + 740 /* "" */ + return ts + 755 /* "" */ }())) - if *(*uintptr)(unsafe.Pointer(bp + 80 /* zErr */)) != 0 { + if *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)) != 0 { *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, - ts+34939, /* "fts5: error crea..." */ - libc.VaList(bp+48, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 80 /* zErr */)))) - Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* zErr */))) + ts+36292, /* "fts5: error crea..." */ + libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zPost, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */)))) + Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zErr */))) } return rc @@ -225465,8 +231575,8 @@ func sqlite3Fts5CreateTable(tls *libc.TLS, pConfig uintptr, zPost uintptr, zDefn // If successful, set *pp to point to the new object and return SQLITE_OK. // Otherwise, set *pp to NULL and return an SQLite error code. func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCreate int32, pp uintptr, pzErr uintptr) int32 { /* sqlite3.c:230994:12: */ - bp := tls.Alloc(16) - defer tls.Free(16) + bp := tls.Alloc(8) + defer tls.Free(8) var rc int32 = SQLITE_OK var p uintptr // New object @@ -225493,27 +231603,27 @@ func sqlite3Fts5StorageOpen(tls *libc.TLS, pConfig uintptr, pIndex uintptr, bCre } else { var i int32 var iOff int32 - Xsqlite3_snprintf(tls, nDefn, zDefn, ts+34983 /* "id INTEGER PRIMA..." */, 0) + Xsqlite3_snprintf(tls, nDefn, zDefn, ts+36336 /* "id INTEGER PRIMA..." */, 0) iOff = int32(libc.Xstrlen(tls, zDefn)) for i = 0; i < (*Fts5Config)(unsafe.Pointer(pConfig)).FnCol; i++ { - Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+35006 /* ", c%d" */, libc.VaList(bp, i)) + Xsqlite3_snprintf(tls, (nDefn - iOff), (zDefn + uintptr(iOff)), ts+36359 /* ", c%d" */, libc.VaList(bp, i)) iOff = iOff + (int32(libc.Xstrlen(tls, (zDefn + uintptr(iOff))))) } - rc = sqlite3Fts5CreateTable(tls, pConfig, ts+32286 /* "content" */, zDefn, 0, pzErr) + rc = sqlite3Fts5CreateTable(tls, pConfig, ts+33639 /* "content" */, zDefn, 0, pzErr) } Xsqlite3_free(tls, zDefn) } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+32637 /* "docsize" */, ts+35012 /* "id INTEGER PRIMA..." */, 0, pzErr) + pConfig, ts+33990 /* "docsize" */, ts+36365 /* "id INTEGER PRIMA..." */, 0, pzErr) } if rc == SQLITE_OK { rc = sqlite3Fts5CreateTable(tls, - pConfig, ts+34187 /* "config" */, ts+35044 /* "k PRIMARY KEY, v" */, 1, pzErr) + pConfig, ts+35540 /* "config" */, ts+36397 /* "k PRIMARY KEY, v" */, 1, pzErr) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32783 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+34136 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } } @@ -225739,8 +231849,8 @@ func sqlite3Fts5StorageDelete(tls *libc.TLS, p uintptr, iDel I64, apVal uintptr) // Delete all entries in the FTS5 index. func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c:231282:12: */ - bp := tls.Alloc(64) - defer tls.Free(64) + bp := tls.Alloc(48) + defer tls.Free(48) var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var rc int32 @@ -225750,13 +231860,13 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: // Delete the contents of the %_data and %_docsize tables. rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+35061, /* "DELETE FROM %Q.'..." */ + ts+36414, /* "DELETE FROM %Q.'..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { rc = fts5ExecPrintf(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, uintptr(0), - ts+35111, /* "DELETE FROM %Q.'..." */ - libc.VaList(bp+40, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) + ts+36464, /* "DELETE FROM %Q.'..." */ + libc.VaList(bp+32, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName)) } // Reinitialize the %_data table. This call creates the initial structure @@ -225765,7 +231875,7 @@ func sqlite3Fts5StorageDeleteAll(tls *libc.TLS, p uintptr) int32 { /* sqlite3.c: rc = sqlite3Fts5IndexReinit(tls, (*Fts5Storage)(unsafe.Pointer(p)).FpIndex) } if rc == SQLITE_OK { - rc = sqlite3Fts5StorageConfigValue(tls, p, ts+32783 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) + rc = sqlite3Fts5StorageConfigValue(tls, p, ts+34136 /* "version" */, uintptr(0), FTS5_CURRENT_VERSION) } return rc } @@ -225953,25 +232063,25 @@ func sqlite3Fts5StorageIndexInsert(tls *libc.TLS, p uintptr, apVal uintptr, iRow } func fts5StorageCount(tls *libc.TLS, p uintptr, zSuffix uintptr, pnRow uintptr) int32 { /* sqlite3.c:231488:12: */ - bp := tls.Alloc(40) - defer tls.Free(40) + bp := tls.Alloc(32) + defer tls.Free(32) var pConfig uintptr = (*Fts5Storage)(unsafe.Pointer(p)).FpConfig var zSql uintptr var rc int32 - zSql = Xsqlite3_mprintf(tls, ts+35140, /* "SELECT count(*) ..." */ + zSql = Xsqlite3_mprintf(tls, ts+36493, /* "SELECT count(*) ..." */ libc.VaList(bp, (*Fts5Config)(unsafe.Pointer(pConfig)).FzDb, (*Fts5Config)(unsafe.Pointer(pConfig)).FzName, zSuffix)) if zSql == uintptr(0) { rc = SQLITE_NOMEM } else { - *(*uintptr)(unsafe.Pointer(bp + 32 /* pCnt */)) = uintptr(0) - rc = Xsqlite3_prepare_v2(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, bp+32 /* &pCnt */, uintptr(0)) + *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */)) = uintptr(0) + rc = Xsqlite3_prepare_v2(tls, (*Fts5Config)(unsafe.Pointer(pConfig)).Fdb, zSql, -1, bp+24 /* &pCnt */, uintptr(0)) if rc == SQLITE_OK { - if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pCnt */))) { - *(*I64)(unsafe.Pointer(pnRow)) = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pCnt */)), 0) + if SQLITE_ROW == Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */))) { + *(*I64)(unsafe.Pointer(pnRow)) = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */)), 0) } - rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pCnt */))) + rc = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pCnt */))) } } @@ -226157,14 +232267,14 @@ func sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) int32 { / // number of rows. if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FeContent == FTS5_CONTENT_NORMAL) { *(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+32286 /* "content" */, bp+48 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+33639 /* "content" */, bp+48 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 48 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } } if (rc == SQLITE_OK) && ((*Fts5Config)(unsafe.Pointer(pConfig)).FbColumnsize != 0) { *(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) = int64(0) - rc = fts5StorageCount(tls, p, ts+32637 /* "docsize" */, bp+56 /* &nRow */) + rc = fts5StorageCount(tls, p, ts+33990 /* "docsize" */, bp+56 /* &nRow */) if (rc == SQLITE_OK) && (*(*I64)(unsafe.Pointer(bp + 56 /* nRow */)) != (*Fts5Storage)(unsafe.Pointer(p)).FnTotalRow) { rc = (SQLITE_CORRUPT | (int32(1) << 8)) } @@ -226400,9 +232510,9 @@ func fts5AsciiCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, libc.Xmemcpy(tls, p /* &.aTokenChar */, uintptr(unsafe.Pointer(&aAsciiTokenChar)), uint64(unsafe.Sizeof(aAsciiTokenChar))) for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35172 /* "tokenchars" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36525 /* "tokenchars" */) { fts5AsciiAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35183 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36536 /* "separators" */) { fts5AsciiAddExceptions(tls, p, zArg, 0) } else { rc = SQLITE_ERROR @@ -226642,7 +232752,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 } else { p = Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Unicode61Tokenizer{}))) if p != 0 { - var zCat uintptr = ts + 35194 /* "L* N* Co" */ + var zCat uintptr = ts + 36547 /* "L* N* Co" */ var i int32 libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Unicode61Tokenizer{}))) @@ -226655,7 +232765,7 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 // Search for a "categories" argument for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35203 /* "categories" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36556 /* "categories" */) { zCat = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) } } @@ -226666,18 +232776,18 @@ func fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35214 /* "remove_diacritic..." */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36567 /* "remove_diacritic..." */) { if (((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) && (int32(*(*int8)(unsafe.Pointer(zArg))) != '2')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { (*Unicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = (int32(*(*int8)(unsafe.Pointer(zArg))) - '0') } - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35172 /* "tokenchars" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36525 /* "tokenchars" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 1) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35183 /* "separators" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36536 /* "separators" */) { rc = fts5UnicodeAddExceptions(tls, p, zArg, 0) - } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35203 /* "categories" */) { + } else if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36556 /* "categories" */) { // no-op } else { rc = SQLITE_ERROR @@ -226989,7 +233099,7 @@ func fts5PorterCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, pp var rc int32 = SQLITE_OK var pRet uintptr *(*uintptr)(unsafe.Pointer(bp /* pUserdata */)) = uintptr(0) - var zBase uintptr = ts + 35232 /* "unicode61" */ + var zBase uintptr = ts + 36585 /* "unicode61" */ if nArg > 0 { zBase = *(*uintptr)(unsafe.Pointer(azArg)) @@ -227142,7 +233252,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35242 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36595 /* "al" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -227150,11 +233260,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35245 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36598 /* "ance" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35250 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36603 /* "ence" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -227162,7 +233272,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'e': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35255 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36608 /* "er" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -227170,7 +233280,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35258 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36611 /* "ic" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -227178,11 +233288,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'l': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35261 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36614 /* "able" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35266 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36619 /* "ible" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -227190,19 +233300,19 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35271 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36624 /* "ant" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35275 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36628 /* "ement" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35281 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36634 /* "ment" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35286 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36639 /* "ent" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227210,11 +233320,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'o': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35290 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36643 /* "ion" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1_and_S_or_T(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35294 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36647 /* "ou" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) } @@ -227222,7 +233332,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 's': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35297 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36650 /* "ism" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227230,11 +233340,11 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35301 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36654 /* "ate" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35305 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36658 /* "iti" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227242,7 +233352,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35309 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36662 /* "ous" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227250,7 +233360,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35313 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36666 /* "ive" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227258,7 +233368,7 @@ func fts5PorterStep4(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35317 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36670 /* "ize" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt1(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227275,24 +233385,24 @@ func fts5PorterStep1B2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sq switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35321 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35301 /* "ate" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36674 /* "at" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+36654 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'b': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35324 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35327 /* "ble" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36677 /* "bl" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+36680 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } break case 'i': - if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35331 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+35317 /* "ize" */, uint64(3)) + if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36684 /* "iz" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 2))), ts+36670 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 2) + 3) ret = 1 } @@ -227308,137 +233418,137 @@ func fts5PorterStep2(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35334 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+36687 /* "ational" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35301 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+36654 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35342 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+36695 /* "tional" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35349 /* "tion" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+36702 /* "tion" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 4) } } break case 'c': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35354 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36707 /* "enci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35250 /* "ence" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+36603 /* "ence" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35359 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36712 /* "anci" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35245 /* "ance" */, uint64(4)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+36598 /* "ance" */, uint64(4)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 4) } } break case 'e': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35364 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36717 /* "izer" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35317 /* "ize" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+36670 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'g': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35369 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36722 /* "logi" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+16131 /* "log" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+16146 /* "log" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 'l': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35374 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36727 /* "bli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35327 /* "ble" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+36680 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35378 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36731 /* "alli" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35242 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+36595 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35383 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36736 /* "entli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35286 /* "ent" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36639 /* "ent" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35389 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + } else if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36742 /* "eli" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35393 /* "e" */, uint64(1)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+36746 /* "e" */, uint64(1)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 1) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35395 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36748 /* "ousli" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35309 /* "ous" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36662 /* "ous" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } } break case 'o': - if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35401 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+36754 /* "ization" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35317 /* "ize" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+36670 /* "ize" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35409 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36762 /* "ation" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35301 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36654 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35415 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + } else if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36768 /* "ator" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35301 /* "ate" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+36654 /* "ate" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 3) } } break case 's': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35420 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36773 /* "alism" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35242 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36595 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35426 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+36779 /* "iveness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35313 /* "ive" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+36666 /* "ive" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35434 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+36787 /* "fulness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35442 /* "ful" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+36795 /* "ful" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } - } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+35446 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { + } else if (nBuf > 7) && (0 == libc.Xmemcmp(tls, ts+36799 /* "ousness" */, (aBuf+uintptr((nBuf-7))), uint64(7))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-7)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+35309 /* "ous" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 7))), ts+36662 /* "ous" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 7) + 3) } } break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35454 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36807 /* "aliti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35242 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36595 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35460 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36813 /* "iviti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35313 /* "ive" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36666 /* "ive" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 3) } - } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+35466 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { + } else if (nBuf > 6) && (0 == libc.Xmemcmp(tls, ts+36819 /* "biliti" */, (aBuf+uintptr((nBuf-6))), uint64(6))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-6)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+35327 /* "ble" */, uint64(3)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 6))), ts+36680 /* "ble" */, uint64(3)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 6) + 3) } } @@ -227454,16 +233564,16 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'a': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35473 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36826 /* "ical" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+35258 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 4))), ts+36611 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 4) + 2) } } break case 's': - if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+35478 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { + if (nBuf > 4) && (0 == libc.Xmemcmp(tls, ts+36831 /* "ness" */, (aBuf+uintptr((nBuf-4))), uint64(4))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-4)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 4) } @@ -227471,21 +233581,21 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 't': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35483 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36836 /* "icate" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35258 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36611 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } - } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35489 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + } else if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36842 /* "iciti" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35258 /* "ic" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36611 /* "ic" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } break case 'u': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35442 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36795 /* "ful" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) } @@ -227493,7 +233603,7 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'v': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35495 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36848 /* "ative" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 5) } @@ -227501,9 +233611,9 @@ func fts5PorterStep3(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sqli break case 'z': - if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+35501 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { + if (nBuf > 5) && (0 == libc.Xmemcmp(tls, ts+36854 /* "alize" */, (aBuf+uintptr((nBuf-5))), uint64(5))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-5)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+35242 /* "al" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 5))), ts+36595 /* "al" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 5) + 2) } } @@ -227519,12 +233629,12 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql switch int32(*(*int8)(unsafe.Pointer(aBuf + uintptr((nBuf - 2))))) { case 'e': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35507 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36860 /* "eed" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_MGt0(tls, aBuf, (nBuf-3)) != 0 { - libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+35511 /* "ee" */, uint64(2)) + libc.Xmemcpy(tls, (aBuf + uintptr((nBuf - 3))), ts+36864 /* "ee" */, uint64(2)) *(*int32)(unsafe.Pointer(pnBuf)) = ((nBuf - 3) + 2) } - } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+35514 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { + } else if (nBuf > 2) && (0 == libc.Xmemcmp(tls, ts+36867 /* "ed" */, (aBuf+uintptr((nBuf-2))), uint64(2))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-2)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 2) ret = 1 @@ -227533,7 +233643,7 @@ func fts5PorterStep1B(tls *libc.TLS, aBuf uintptr, pnBuf uintptr) int32 { /* sql break case 'n': - if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+35517 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { + if (nBuf > 3) && (0 == libc.Xmemcmp(tls, ts+36870 /* "ing" */, (aBuf+uintptr((nBuf-3))), uint64(3))) { if fts5Porter_Vowel(tls, aBuf, (nBuf-3)) != 0 { *(*int32)(unsafe.Pointer(pnBuf)) = (nBuf - 3) ret = 1 @@ -227703,7 +233813,7 @@ func fts5TriCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int32, pp (*TrigramTokenizer)(unsafe.Pointer(pNew)).FbFold = 1 for i = 0; (rc == SQLITE_OK) && (i < nArg); i = i + (2) { var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + uintptr((i+1))*8)) - if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+35521 /* "case_sensitive" */) { + if 0 == Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), ts+36874 /* "case_sensitive" */) { if ((int32(*(*int8)(unsafe.Pointer(zArg))) != '0') && (int32(*(*int8)(unsafe.Pointer(zArg))) != '1')) || (*(*int8)(unsafe.Pointer(zArg + 1)) != 0) { rc = SQLITE_ERROR } else { @@ -227893,22 +234003,22 @@ func sqlite3Fts5TokenizerInit(tls *libc.TLS, pApi uintptr) int32 { /* sqlite3.c: defer tls.Free(128) *(*[4]BuiltinTokenizer)(unsafe.Pointer(bp /* aBuiltin */)) = [4]BuiltinTokenizer{ - {FzName: ts + 35232 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 36585 /* "unicode61" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5UnicodeCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5UnicodeDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5UnicodeTokenize}))}}, - {FzName: ts + 35536 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 36889 /* "ascii" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5AsciiCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5AsciiDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5AsciiTokenize}))}}, - {FzName: ts + 35542 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 36895 /* "porter" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5PorterCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5PorterDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 }{fts5PorterTokenize}))}}, - {FzName: ts + 35549 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { + {FzName: ts + 36902 /* "trigram" */, Fx: Fts5_tokenizer{FxCreate: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32 }{fts5TriCreate})), FxDelete: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{fts5TriDelete})), FxTokenize: *(*uintptr)(unsafe.Pointer(&struct { f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32 @@ -229248,27 +235358,27 @@ type Fts5VocabCursor = Fts5VocabCursor1 /* sqlite3.c:234462:32 */ // value and return SQLITE_OK. Otherwise, set *pzErr to an error message // and return SQLITE_ERROR. func fts5VocabTableType(tls *libc.TLS, zType uintptr, pzErr uintptr, peType uintptr) int32 { /* sqlite3.c:234521:12: */ - bp := tls.Alloc(20) - defer tls.Free(20) + bp := tls.Alloc(12) + defer tls.Free(12) - *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK - var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+16 /* &rc */, zType, -1) - if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK + var zCopy uintptr = sqlite3Fts5Strndup(tls, bp+8 /* &rc */, zType, -1) + if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK { sqlite3Fts5Dequote(tls, zCopy) - if Xsqlite3_stricmp(tls, zCopy, ts+35557 /* "col" */) == 0 { + if Xsqlite3_stricmp(tls, zCopy, ts+36910 /* "col" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_COL - } else if Xsqlite3_stricmp(tls, zCopy, ts+35561 /* "row" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+36914 /* "row" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_ROW - } else if Xsqlite3_stricmp(tls, zCopy, ts+35565 /* "instance" */) == 0 { + } else if Xsqlite3_stricmp(tls, zCopy, ts+36918 /* "instance" */) == 0 { *(*int32)(unsafe.Pointer(peType)) = FTS5_VOCAB_INSTANCE } else { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35574 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) - *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_ERROR + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+36927 /* "fts5vocab: unkno..." */, libc.VaList(bp, zCopy)) + *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR } Xsqlite3_free(tls, zCopy) } - return *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) } // The xDisconnect() virtual table method. @@ -229309,19 +235419,19 @@ func fts5VocabInitVtab(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv defer tls.Free(36) *(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azSchema */)) = [3]uintptr{ - ts + 35608, /* "CREATE TABlE voc..." */ - ts + 35648, /* "CREATE TABlE voc..." */ - ts + 35683, /* "CREATE TABlE voc..." */ + ts + 36961, /* "CREATE TABlE voc..." */ + ts + 37001, /* "CREATE TABlE voc..." */ + ts + 37036, /* "CREATE TABlE voc..." */ } var pRet uintptr = uintptr(0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK // Return code var bDb int32 - bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+22989 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) + bDb = (libc.Bool32(((argc == 6) && (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == uint64(4))) && (libc.Xmemcmp(tls, ts+23004 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint64(4)) == 0))) if (argc != 5) && (bDb == 0) { - *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+35726 /* "wrong number of ..." */, 0) + *(*uintptr)(unsafe.Pointer(pzErr)) = Xsqlite3_mprintf(tls, ts+37079 /* "wrong number of ..." */, 0) *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_ERROR } else { var nByte int32 // Bytes of space to allocate @@ -229461,70 +235571,70 @@ func fts5VocabBestIndexMethod(tls *libc.TLS, pUnused uintptr, pInfo uintptr) int // Implementation of xOpen method. func fts5VocabOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* sqlite3.c:234743:12: */ - bp := tls.Alloc(104) - defer tls.Free(104) + bp := tls.Alloc(80) + defer tls.Free(80) var pTab uintptr = pVTab var pFts5 uintptr = uintptr(0) var pCsr uintptr = uintptr(0) - *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_OK - *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) = uintptr(0) + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK + *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) var zSql uintptr = uintptr(0) if (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy != 0 { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+35759 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + ts+37112 /* "recursive defini..." */, libc.VaList(bp, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) return SQLITE_ERROR } - zSql = sqlite3Fts5Mprintf(tls, bp+88, /* &rc */ - ts+35790, /* "SELECT t.%Q FROM..." */ - libc.VaList(bp+24, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + zSql = sqlite3Fts5Mprintf(tls, bp+64, /* &rc */ + ts+37143, /* "SELECT t.%Q FROM..." */ + libc.VaList(bp+16, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) if zSql != 0 { - *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+96 /* &pStmt */, uintptr(0)) + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_prepare_v2(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).Fdb, zSql, -1, bp+72 /* &pStmt */, uintptr(0)) } Xsqlite3_free(tls, zSql) - if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_ERROR { - *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_OK + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_ERROR { + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_OK } (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy = uint32(1) - if (*(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) != 0) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */))) == SQLITE_ROW) { - var iId I64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)), 0) + if (*(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) != 0) && (Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) == SQLITE_ROW) { + var iId I64 = Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)), 0) pFts5 = sqlite3Fts5TableFromCsrid(tls, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FpGlobal, iId) } (*Fts5VocabTable)(unsafe.Pointer(pTab)).FbBusy = uint32(0) - if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { if pFts5 == uintptr(0) { - *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */))) - *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) = uintptr(0) - if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK { + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) + *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) = uintptr(0) + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { (*Sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = Xsqlite3_mprintf(tls, - ts+35841 /* "no such fts5 tab..." */, libc.VaList(bp+64, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) - *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_ERROR + ts+37194 /* "no such fts5 tab..." */, libc.VaList(bp+48, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Db, (*Fts5VocabTable)(unsafe.Pointer(pTab)).FzFts5Tbl)) + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR } } else { - *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3Fts5FlushToDisk(tls, pFts5) + *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = sqlite3Fts5FlushToDisk(tls, pFts5) } } - if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK { + if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK { var nByte int32 = (int32(((uint64((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pFts5)).FpConfig)).FnCol) * uint64(unsafe.Sizeof(I64(0)))) * uint64(2)) + uint64(unsafe.Sizeof(Fts5VocabCursor{})))) - pCsr = sqlite3Fts5MallocZero(tls, bp+88 /* &rc */, int64(nByte)) + pCsr = sqlite3Fts5MallocZero(tls, bp+64 /* &rc */, int64(nByte)) } if pCsr != 0 { (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpFts5 = pFts5 - (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) + (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt = (pCsr + 1*120) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaDoc = ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FaCnt + uintptr((*Fts5Config)(unsafe.Pointer((*Fts5Table)(unsafe.Pointer(pFts5)).FpConfig)).FnCol)*8) } else { - Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */))) + Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) } *(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr - return *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) + return *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) } func fts5VocabResetCursor(tls *libc.TLS, pCsr uintptr) { /* sqlite3.c:234811:13: */ @@ -229789,7 +235899,7 @@ func fts5VocabFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, zUnused if pLe != 0 { var zCopy uintptr = Xsqlite3_value_text(tls, pLe) if zCopy == uintptr(0) { - zCopy = ts + 740 /* "" */ + zCopy = ts + 755 /* "" */ } (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm = Xsqlite3_value_bytes(tls, pLe) (*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FzLeTerm = Xsqlite3_malloc(tls, ((*Fts5VocabCursor)(unsafe.Pointer(pCsr)).FnLeTerm + 1)) @@ -229906,7 +236016,7 @@ func fts5VocabRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 func sqlite3Fts5VocabInit(tls *libc.TLS, pGlobal uintptr, db uintptr) int32 { /* sqlite3.c:235171:12: */ var p uintptr = pGlobal - return Xsqlite3_create_module_v2(tls, db, ts+35867 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) + return Xsqlite3_create_module_v2(tls, db, ts+37220 /* "fts5vocab" */, uintptr(unsafe.Pointer(&fts5Vocab)), p, uintptr(0)) } var fts5Vocab = Sqlite3_module{ @@ -229951,7 +236061,7 @@ var fts5Vocab = Sqlite3_module{ //************* End of stmt.c *********************************************** // Return the source-id for this library func Xsqlite3_sourceid(tls *libc.TLS) uintptr { /* sqlite3.c:235516:23: */ - return ts + 35877 /* "2021-06-18 18:36..." */ + return ts + 37230 /* "2021-06-18 18:36..." */ } //************************* End of sqlite3.c ***************************** @@ -230929,5 +237039,5 @@ func init() { *(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&winVfs)) + 160 /* .xNextSystemCall */)) = winNextSystemCall // sqlite3.c:48390:5: } -var ts1 = "COMPILER=msvc-1900\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00AreFileApisANSI\x00CharLowerW\x00CharUpperW\x00CloseHandle\x00CreateFileA\x00CreateFileW\x00CreateFileMappingA\x00CreateFileMappingW\x00CreateMutexW\x00DeleteFileA\x00DeleteFileW\x00FileTimeToLocalFileTime\x00FileTimeToSystemTime\x00FlushFileBuffers\x00FormatMessageA\x00FormatMessageW\x00FreeLibrary\x00GetCurrentProcessId\x00GetDiskFreeSpaceA\x00GetDiskFreeSpaceW\x00GetFileAttributesA\x00GetFileAttributesW\x00GetFileAttributesExW\x00GetFileSize\x00GetFullPathNameA\x00GetFullPathNameW\x00GetLastError\x00GetProcAddressA\x00GetSystemInfo\x00GetSystemTime\x00GetSystemTimeAsFileTime\x00GetTempPathA\x00GetTempPathW\x00GetTickCount\x00GetVersionExA\x00GetVersionExW\x00HeapAlloc\x00HeapCreate\x00HeapDestroy\x00HeapFree\x00HeapReAlloc\x00HeapSize\x00HeapValidate\x00HeapCompact\x00LoadLibraryA\x00LoadLibraryW\x00LocalFree\x00LockFile\x00LockFileEx\x00MapViewOfFile\x00MultiByteToWideChar\x00QueryPerformanceCounter\x00ReadFile\x00SetEndOfFile\x00SetFilePointer\x00Sleep\x00SystemTimeToFileTime\x00UnlockFile\x00UnlockFileEx\x00UnmapViewOfFile\x00WideCharToMultiByte\x00WriteFile\x00CreateEventExW\x00WaitForSingleObject\x00WaitForSingleObjectEx\x00SetFilePointerEx\x00GetFileInformationByHandleEx\x00MapViewOfFileFromApp\x00CreateFile2\x00LoadPackagedLibrary\x00GetTickCount64\x00GetNativeSystemInfo\x00OutputDebugStringA\x00OutputDebugStringW\x00GetProcessHeap\x00CreateFileMappingFromApp\x00InterlockedCompareExchange\x00UuidCreate\x00UuidCreateSequential\x00FlushViewOfFile\x00%s\x00OsError 0x%lx (%lu)\x00os_win.c:%d: (%lu) %s(%s) - %s\x00delayed %dms for lock/sharing conflict at line %d\x00winSeekFile\x00winClose\x00winRead\x00winWrite1\x00winWrite2\x00winTruncate1\x00winTruncate2\x00winSync1\x00winSync2\x00winFileSize\x00winUnlockReadLock\x00winUnlock\x00winLockSharedMemory\x00%s-shm\x00readonly_shm\x00winOpenShm\x00winShmMap1\x00winShmMap2\x00winShmMap3\x00winUnmapfile1\x00winUnmapfile2\x00winMapfile1\x00winMapfile2\x00etilqs_\x00winGetTempname1\x00winGetTempname2\x00winGetTempname3\x00winGetTempname4\x00winGetTempname5\x00abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x00exclusive\x00winOpen\x00psow\x00winDelete\x00winAccess\x00%s%c%s\x00winFullPathname1\x00winFullPathname2\x00winFullPathname3\x00winFullPathname4\x00win32\x00win32-longpath\x00win32-none\x00win32-longpath-none\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00stat\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00dll\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_store_directory\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00access\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" +var ts1 = "COMPILER=msvc-1900\x00ENABLE_COLUMN_METADATA\x00ENABLE_FTS5\x00ENABLE_GEOPOLY\x00ENABLE_JSON1\x00ENABLE_MEMORY_MANAGEMENT\x00ENABLE_OFFSET_SQL_FUNC\x00ENABLE_PREUPDATE_HOOK\x00ENABLE_RBU\x00ENABLE_RTREE\x00ENABLE_SESSION\x00ENABLE_SNAPSHOT\x00ENABLE_STAT4\x00ENABLE_UNLOCK_NOTIFY\x00LIKE_DOESNT_MATCH_BLOBS\x00MUTEX_NOOP\x00SOUNDEX\x00SYSTEM_MALLOC\x00THREADSAFE=1\x003.36.0\x00BINARY\x0020b:20e\x0020c:20e\x0020e\x0040f-21a-21d\x00now\x00local time unavailable\x00second\x00minute\x00hour\x00day\x00month\x00year\x00localtime\x00unixepoch\x00utc\x00weekday \x00start of \x00%04d-%02d-%02d %02d:%02d:%02d\x00%02d:%02d:%02d\x00%04d-%02d-%02d\x00%02d\x00%06.3f\x00%03d\x00%.16g\x00%04d\x00julianday\x00date\x00time\x00datetime\x00strftime\x00current_time\x00current_timestamp\x00current_date\x00failed to allocate %u bytes of memory\x00failed memory resize %u to %u bytes\x000123456789ABCDEF0123456789abcdef\x00-x0\x00X0\x00%\x00NaN\x00Inf\x00\x00NULL\x00(NULL)\x00.\x00SUBQUERY %u\x00thstndrd\x00922337203685477580\x00API call with %s database connection pointer\x00unopened\x00invalid\x00Savepoint\x00AutoCommit\x00Transaction\x00SorterNext\x00Prev\x00Next\x00Checkpoint\x00JournalMode\x00Vacuum\x00VFilter\x00VUpdate\x00Goto\x00Gosub\x00InitCoroutine\x00Yield\x00MustBeInt\x00Jump\x00Once\x00If\x00Not\x00IfNot\x00IfNullRow\x00SeekLT\x00SeekLE\x00SeekGE\x00SeekGT\x00IfNotOpen\x00IfNoHope\x00NoConflict\x00NotFound\x00Found\x00SeekRowid\x00NotExists\x00Last\x00IfSmaller\x00SorterSort\x00Sort\x00Rewind\x00IdxLE\x00IdxGT\x00IdxLT\x00IdxGE\x00RowSetRead\x00Or\x00And\x00RowSetTest\x00Program\x00FkIfZero\x00IfPos\x00IfNotZero\x00IsNull\x00NotNull\x00Ne\x00Eq\x00Gt\x00Le\x00Lt\x00Ge\x00ElseEq\x00DecrJumpZero\x00IncrVacuum\x00VNext\x00Init\x00PureFunc\x00Function\x00Return\x00EndCoroutine\x00HaltIfNull\x00Halt\x00Integer\x00Int64\x00String\x00Null\x00SoftNull\x00Blob\x00Variable\x00Move\x00Copy\x00SCopy\x00IntCopy\x00ChngCntRow\x00ResultRow\x00CollSeq\x00AddImm\x00RealAffinity\x00Cast\x00Permutation\x00Compare\x00IsTrue\x00ZeroOrNull\x00Offset\x00Column\x00Affinity\x00MakeRecord\x00Count\x00ReadCookie\x00SetCookie\x00ReopenIdx\x00OpenRead\x00OpenWrite\x00OpenDup\x00OpenAutoindex\x00BitAnd\x00BitOr\x00ShiftLeft\x00ShiftRight\x00Add\x00Subtract\x00Multiply\x00Divide\x00Remainder\x00Concat\x00OpenEphemeral\x00BitNot\x00SorterOpen\x00SequenceTest\x00String8\x00OpenPseudo\x00Close\x00ColumnsUsed\x00SeekScan\x00SeekHit\x00Sequence\x00NewRowid\x00Insert\x00RowCell\x00Delete\x00ResetCount\x00SorterCompare\x00SorterData\x00RowData\x00Rowid\x00NullRow\x00SeekEnd\x00IdxInsert\x00SorterInsert\x00IdxDelete\x00DeferredSeek\x00IdxRowid\x00FinishSeek\x00Destroy\x00Clear\x00ResetSorter\x00CreateBtree\x00SqlExec\x00ParseSchema\x00LoadAnalysis\x00DropTable\x00DropIndex\x00DropTrigger\x00IntegrityCk\x00RowSetAdd\x00Real\x00Param\x00FkCounter\x00MemMax\x00OffsetLimit\x00AggInverse\x00AggStep\x00AggStep1\x00AggValue\x00AggFinal\x00Expire\x00CursorLock\x00CursorUnlock\x00TableLock\x00VBegin\x00VCreate\x00VDestroy\x00VOpen\x00VColumn\x00VRename\x00Pagecount\x00MaxPgcnt\x00Trace\x00CursorHint\x00ReleaseReg\x00Noop\x00Explain\x00Abortable\x00AreFileApisANSI\x00CharLowerW\x00CharUpperW\x00CloseHandle\x00CreateFileA\x00CreateFileW\x00CreateFileMappingA\x00CreateFileMappingW\x00CreateMutexW\x00DeleteFileA\x00DeleteFileW\x00FileTimeToLocalFileTime\x00FileTimeToSystemTime\x00FlushFileBuffers\x00FormatMessageA\x00FormatMessageW\x00FreeLibrary\x00GetCurrentProcessId\x00GetDiskFreeSpaceA\x00GetDiskFreeSpaceW\x00GetFileAttributesA\x00GetFileAttributesW\x00GetFileAttributesExW\x00GetFileSize\x00GetFullPathNameA\x00GetFullPathNameW\x00GetLastError\x00GetProcAddressA\x00GetSystemInfo\x00GetSystemTime\x00GetSystemTimeAsFileTime\x00GetTempPathA\x00GetTempPathW\x00GetTickCount\x00GetVersionExA\x00GetVersionExW\x00HeapAlloc\x00HeapCreate\x00HeapDestroy\x00HeapFree\x00HeapReAlloc\x00HeapSize\x00HeapValidate\x00HeapCompact\x00LoadLibraryA\x00LoadLibraryW\x00LocalFree\x00LockFile\x00LockFileEx\x00MapViewOfFile\x00MultiByteToWideChar\x00QueryPerformanceCounter\x00ReadFile\x00SetEndOfFile\x00SetFilePointer\x00Sleep\x00SystemTimeToFileTime\x00UnlockFile\x00UnlockFileEx\x00UnmapViewOfFile\x00WideCharToMultiByte\x00WriteFile\x00CreateEventExW\x00WaitForSingleObject\x00WaitForSingleObjectEx\x00SetFilePointerEx\x00GetFileInformationByHandleEx\x00MapViewOfFileFromApp\x00CreateFile2\x00LoadPackagedLibrary\x00GetTickCount64\x00GetNativeSystemInfo\x00OutputDebugStringA\x00OutputDebugStringW\x00GetProcessHeap\x00CreateFileMappingFromApp\x00InterlockedCompareExchange\x00UuidCreate\x00UuidCreateSequential\x00FlushViewOfFile\x00%s\x00OsError 0x%lx (%lu)\x00os_win.c:%d: (%lu) %s(%s) - %s\x00delayed %dms for lock/sharing conflict at line %d\x00winSeekFile\x00winClose\x00winRead\x00winWrite1\x00winWrite2\x00winTruncate1\x00winTruncate2\x00winSync1\x00winSync2\x00winFileSize\x00winUnlockReadLock\x00winUnlock\x00winLockSharedMemory\x00%s-shm\x00readonly_shm\x00winOpenShm\x00winShmMap1\x00winShmMap2\x00winShmMap3\x00winUnmapfile1\x00winUnmapfile2\x00winMapfile1\x00winMapfile2\x00etilqs_\x00winGetTempname1\x00winGetTempname2\x00winGetTempname3\x00winGetTempname4\x00winGetTempname5\x00abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\x00exclusive\x00winOpen\x00psow\x00winDelete\x00winAccess\x00%s%c%s\x00winFullPathname1\x00winFullPathname2\x00winFullPathname3\x00winFullPathname4\x00win32\x00win32-longpath\x00win32-none\x00win32-longpath-none\x00memdb\x00memdb(%p,%lld)\x00PRAGMA \"%w\".page_count\x00ATTACH x AS %Q\x00recovered %d pages from %s\x00-journal\x00-wal\x00nolock\x00immutable\x00recovered %d frames from WAL file %s\x00cannot limit WAL size: %s\x00SQLite format 3\x00:memory:\x00@ \x00\n\x00invalid page number %d\x002nd reference to page %d\x00Failed to read ptrmap key=%d\x00Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\x00failed to get page %d\x00freelist leaf count too big on page %d\x00%s is %d but should be %d\x00size\x00overflow list length\x00Page %u: \x00unable to get the page. error code=%d\x00btreeInitPage() returns error code %d\x00free space corruption\x00On tree page %u cell %d: \x00On page %u at right child: \x00Offset %d out of range %d..%d\x00Extends off end of page\x00Rowid %lld out of order\x00Child page depth differs\x00Multiple uses for byte %u of page %u\x00Fragmentation of %d bytes reported as %d on page %u\x00Main freelist: \x00max rootpage (%d) disagrees with header (%d)\x00incremental_vacuum enabled with a max rootpage of zero\x00Page %d is never used\x00Pointer map page %d is referenced\x00unknown database %s\x00destination database is in use\x00source and destination must be distinct\x00%!.15g\x00-\x00%s%s\x00k(%d\x00B\x00,%s%s%s\x00N.\x00)\x00%.18s-%s\x00%s(%d)\x00%lld\x00%d\x00(blob)\x00vtab:%p\x00%c%u\x00]\x00program\x00?\x008\x0016LE\x0016BE\x00addr\x00opcode\x00p1\x00p2\x00p3\x00p4\x00p5\x00comment\x00id\x00parent\x00notused\x00detail\x00%.4c%s%.16c\x00MJ delete: %s\x00MJ collide: %s\x00-mj%06X9%02X\x00FOREIGN KEY constraint failed\x00a CHECK constraint\x00a generated column\x00an index\x00non-deterministic use of %s() in %s\x00API called with finalized prepared statement\x00API called with NULL prepared statement\x00string or blob too big\x00bind on a busy prepared statement: [%s]\x00-- \x00'%.*q'\x00zeroblob(%d)\x00x'\x00%02x\x00'\x00%s constraint failed\x00%z: %s\x00abort at %d in [%s]: %s\x00cannot open savepoint - SQL statements in progress\x00no such savepoint: %s\x00cannot release savepoint - SQL statements in progress\x00cannot commit transaction - SQL statements in progress\x00cannot start a transaction within a transaction\x00cannot rollback - no transaction is active\x00cannot commit - no transaction is active\x00database schema has changed\x00index corruption\x00sqlite_master\x00SELECT*FROM\"%w\".%s WHERE %s ORDER BY rowid\x00too many levels of trigger recursion\x00cannot change %s wal mode from within a transaction\x00into\x00out of\x00database table is locked: %s\x00-- %s\x00statement aborts at %d: [%s] %s\x00out of memory\x00NOT NULL\x00UNIQUE\x00CHECK\x00FOREIGN KEY\x00cannot open value of type %s\x00null\x00real\x00integer\x00no such rowid: %lld\x00cannot open virtual table: %s\x00cannot open table without rowid: %s\x00cannot open view: %s\x00no such column: \"%s\"\x00foreign key\x00indexed\x00cannot open %s column for writing\x00main\x00new\x00old\x00excluded\x00misuse of aliased aggregate %s\x00misuse of aliased window function %s\x00row value misused\x00double-quoted string literal: \"%w\"\x00no such column\x00ambiguous column name\x00%s: %s.%s.%s\x00%s: %s.%s\x00%s: %s\x00partial index WHERE clauses\x00index expressions\x00CHECK constraints\x00generated columns\x00%s prohibited in %s\x00true\x00false\x00the \".\" operator\x00second argument to likelihood() must be a constant between 0.0 and 1.0\x00not authorized to use function: %s\x00non-deterministic functions\x00%.*s() may not be used as a window function\x00window\x00aggregate\x00misuse of %s function %.*s()\x00no such function: %.*s\x00wrong number of arguments to function %.*s()\x00FILTER may not be used with non-aggregate %.*s()\x00subqueries\x00parameters\x00%r %s BY term out of range - should be between 1 and %d\x00too many terms in ORDER BY clause\x00ORDER\x00%r ORDER BY term does not match any column in the result set\x00too many terms in %s BY clause\x00a GROUP BY clause is required before HAVING\x00GROUP\x00aggregate functions are not allowed in the GROUP BY clause\x00Expression tree is too large (maximum depth %d)\x000\x00too many arguments on function %T\x00unsafe use of %s()\x00variable number must be between ?1 and ?%d\x00too many SQL variables\x00%d columns assigned %d values\x00too many columns in %s\x00_ROWID_\x00ROWID\x00OID\x00USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR\x00USING INDEX %s FOR IN-OPERATOR\x00sub-select returns %d columns - expected %d\x00REUSE LIST SUBQUERY %d\x00%sLIST SUBQUERY %d\x00CORRELATED \x00REUSE SUBQUERY %d\x00%sSCALAR SUBQUERY %d\x001\x000x\x00hex literal too big: %s%s\x00generated column loop on \"%s\"\x00misuse of aggregate: %s()\x00unknown function: %s()\x00RAISE() may only be used within a trigger-program\x00B\x00C\x00D\x00E\x00sqlite_\x00table %s may not be altered\x00SELECT 1 FROM \"%w\".sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL \x00SELECT 1 FROM temp.sqlite_master WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%' AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL \x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_quotefix(%Q, sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_quotefix('temp', sql)WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND sql NOT LIKE 'create virtual%%'\x00there is already another table or index with this name: %s\x00table\x00view %s may not be altered\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'\x00UPDATE %Q.sqlite_master SET tbl_name = %Q, name = CASE WHEN type='table' THEN %Q WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' AND type='index' THEN 'sqlite_autoindex_' || %Q || substr(name,%d+18) ELSE name END WHERE tbl_name=%Q COLLATE nocase AND (type='table' OR type='index' OR type='trigger');\x00sqlite_sequence\x00UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q\x00UPDATE sqlite_temp_schema SET sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), tbl_name = CASE WHEN tbl_name=%Q COLLATE nocase AND sqlite_rename_test(%Q, sql, type, name, 1, 'after rename', 0) THEN %Q ELSE tbl_name END WHERE type IN ('view', 'trigger')\x00after rename\x00SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"\x00Cannot add a PRIMARY KEY column\x00Cannot add a UNIQUE column\x00Cannot add a REFERENCES column with non-NULL default value\x00Cannot add a NOT NULL column with default value NULL\x00Cannot add a column with non-constant default\x00cannot add a STORED column\x00UPDATE \"%w\".sqlite_master SET sql = printf('%%.%ds, ',sql) || %Q || substr(sql,1+length(printf('%%.%ds',sql))) WHERE type = 'table' AND name = %Q\x00virtual tables may not be altered\x00Cannot add a column to a view\x00sqlite_altertab_%s\x00view\x00virtual table\x00cannot %s %s \"%s\"\x00drop column from\x00rename columns of\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' AND (type != 'index' OR tbl_name = %Q) AND sql NOT LIKE 'create virtual%%'\x00UPDATE temp.sqlite_master SET sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) WHERE type IN ('trigger', 'view')\x00error in %s %s%s%s: %s\x00 \x00\"%w\" \x00%Q%s\x00%.*s%s\x00cannot drop %s column: \"%s\"\x00PRIMARY KEY\x00cannot drop column \"%s\": no other columns exist\x00UPDATE \"%w\".sqlite_master SET sql = sqlite_drop_column(%d, sql, %d) WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)\x00after drop column\x00sqlite_rename_column\x00sqlite_rename_table\x00sqlite_rename_test\x00sqlite_drop_column\x00sqlite_rename_quotefix\x00CREATE TABLE %Q.%s(%s)\x00DELETE FROM %Q.%s WHERE %s=%Q\x00DELETE FROM %Q.%s\x00sqlite_stat1\x00tbl,idx,stat\x00sqlite_stat4\x00tbl,idx,neq,nlt,ndlt,sample\x00sqlite_stat3\x00stat_init\x00stat_push\x00%llu\x00 %llu\x00%llu \x00stat_get\x00sqlite\\_%\x00BBB\x00idx\x00tbl\x00unordered*\x00sz=[0-9]*\x00noskipscan*\x00SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\x00SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\x00SELECT tbl,idx,stat FROM %Q.sqlite_stat1\x00x\x00\x00too many attached databases - max %d\x00database %s is already in use\x00database is already attached\x00attached databases must use the same text encoding as main database\x00unable to open database: %s\x00no such database: %s\x00cannot detach database %s\x00database %s is locked\x00sqlite_detach\x00sqlite_attach\x00%s cannot use variables\x00%s %T cannot reference objects in database %s\x00authorizer malfunction\x00%s.%s\x00%s.%z\x00access to %z is prohibited\x00not authorized\x00sqlite_temp_schema\x00sqlite_schema\x00sqlite_temp_master\x00pragma_\x00no such view\x00no such table\x00corrupt database\x00unknown database %T\x00object name reserved for internal use: %s\x00temporary table name must be unqualified\x00table %T already exists\x00there is already an index named %s\x00sqlite_returning\x00cannot use RETURNING in a trigger\x00too many columns on %s\x00duplicate column name: %s\x00default value of column [%s] is not constant\x00cannot use DEFAULT on a generated column\x00generated columns cannot be part of the PRIMARY KEY\x00table \"%s\" has more than one primary key\x00INTEGER\x00AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY\x00virtual tables cannot use computed columns\x00virtual\x00stored\x00error in generated column \"%s\"\x00,\x00\n \x00,\n \x00\n)\x00CREATE TABLE \x00 TEXT\x00 NUM\x00 INT\x00 REAL\x00AUTOINCREMENT not allowed on WITHOUT ROWID tables\x00PRIMARY KEY missing on table %s\x00must have at least one non-generated column\x00TABLE\x00VIEW\x00CREATE %s %.*s\x00UPDATE %Q.sqlite_master SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q WHERE rowid=#%d\x00CREATE TABLE %Q.sqlite_sequence(name,seq)\x00tbl_name='%q' AND type!='trigger'\x00parameters are not allowed in views\x00view %s is circularly defined\x00corrupt schema\x00UPDATE %Q.sqlite_master SET rootpage=%d WHERE #%d AND rootpage=#%d\x00sqlite_stat%d\x00DELETE FROM %Q.sqlite_sequence WHERE name=%Q\x00DELETE FROM %Q.sqlite_master WHERE tbl_name=%Q and type!='trigger'\x00stat\x00table %s may not be dropped\x00use DROP TABLE to delete table %s\x00use DROP VIEW to delete view %s\x00foreign key on %s should reference only one column of table %T\x00number of columns in foreign key does not match the number of columns in the referenced table\x00unknown column \"%s\" in foreign key definition\x00unsupported use of NULLS %s\x00FIRST\x00LAST\x00index\x00cannot create a TEMP index on non-TEMP table \"%s\"\x00table %s may not be indexed\x00views may not be indexed\x00virtual tables may not be indexed\x00there is already a table named %s\x00index %s already exists\x00sqlite_autoindex_%s_%d\x00expressions prohibited in PRIMARY KEY and UNIQUE constraints\x00conflicting ON CONFLICT clauses specified\x00invalid rootpage\x00CREATE%s INDEX %.*s\x00 UNIQUE\x00INSERT INTO %Q.sqlite_master VALUES('index',%Q,%Q,#%d,%Q);\x00name='%q' AND type='index'\x00no such index: %S\x00index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='index'\x00too many FROM clause terms, max: %d\x00a JOIN clause is required before %s\x00ON\x00USING\x00BEGIN\x00ROLLBACK\x00COMMIT\x00RELEASE\x00unable to open a temporary database file for storing temporary tables\x00index '%q'\x00, \x00%s.rowid\x00unable to identify the object to be reindexed\x00duplicate WITH table name: %s\x00no such collation sequence: %s\x00table %s may not be modified\x00cannot modify %s because it is a view\x00rows deleted\x00text\x00blob\x00integer overflow\x00%.*f\x00LIKE or GLOB pattern too complex\x00ESCAPE expression must be a single character\x00%!.20e\x00?000\x00MATCH\x00like\x00implies_nonnull_row\x00expr_compare\x00expr_implies_expr\x00soundex\x00load_extension\x00sqlite_compileoption_used\x00sqlite_compileoption_get\x00unlikely\x00likelihood\x00likely\x00sqlite_offset\x00ltrim\x00rtrim\x00trim\x00min\x00max\x00typeof\x00length\x00instr\x00printf\x00unicode\x00char\x00abs\x00round\x00upper\x00lower\x00hex\x00ifnull\x00random\x00randomblob\x00nullif\x00sqlite_version\x00sqlite_source_id\x00sqlite_log\x00quote\x00last_insert_rowid\x00changes\x00total_changes\x00replace\x00zeroblob\x00substr\x00substring\x00sum\x00total\x00avg\x00count\x00group_concat\x00glob\x00coalesce\x00sign\x00iif\x00foreign key mismatch - \"%w\" referencing \"%w\"\x00cannot INSERT into generated column \"%s\"\x00table %S has no column named %s\x00table %S has %d columns but %d values were supplied\x00%d values for %d columns\x00UPSERT not implemented for virtual table \"%s\"\x00cannot UPSERT a view\x00rows inserted\x00sqlite3_extension_init\x00sqlite3_\x00lib\x00_init\x00no entry point [%s] in shared library [%s]\x00error during initialization: %s\x00unable to open shared library [%.*s]\x00dll\x00automatic extension loading failed: %s\x00seq\x00from\x00to\x00on_update\x00on_delete\x00match\x00cid\x00name\x00type\x00notnull\x00dflt_value\x00pk\x00hidden\x00seqno\x00desc\x00coll\x00key\x00builtin\x00enc\x00narg\x00flags\x00wdth\x00hght\x00flgs\x00unique\x00origin\x00partial\x00rowid\x00fkid\x00file\x00busy\x00log\x00checkpointed\x00database\x00status\x00cache_size\x00timeout\x00analysis_limit\x00application_id\x00auto_vacuum\x00automatic_index\x00busy_timeout\x00cache_spill\x00case_sensitive_like\x00cell_size_check\x00checkpoint_fullfsync\x00collation_list\x00compile_options\x00count_changes\x00data_store_directory\x00data_version\x00database_list\x00default_cache_size\x00defer_foreign_keys\x00empty_result_callbacks\x00encoding\x00foreign_key_check\x00foreign_key_list\x00foreign_keys\x00freelist_count\x00full_column_names\x00fullfsync\x00function_list\x00hard_heap_limit\x00ignore_check_constraints\x00incremental_vacuum\x00index_info\x00index_list\x00index_xinfo\x00integrity_check\x00journal_mode\x00journal_size_limit\x00legacy_alter_table\x00locking_mode\x00max_page_count\x00mmap_size\x00module_list\x00optimize\x00page_count\x00page_size\x00pragma_list\x00query_only\x00quick_check\x00read_uncommitted\x00recursive_triggers\x00reverse_unordered_selects\x00schema_version\x00secure_delete\x00short_column_names\x00shrink_memory\x00soft_heap_limit\x00synchronous\x00table_info\x00table_xinfo\x00temp_store\x00temp_store_directory\x00threads\x00trusted_schema\x00user_version\x00wal_autocheckpoint\x00wal_checkpoint\x00writable_schema\x00onoffalseyestruextrafull\x00normal\x00none\x00full\x00incremental\x00memory\x00temporary storage cannot be changed from within a transaction\x00SET NULL\x00SET DEFAULT\x00CASCADE\x00RESTRICT\x00NO ACTION\x00delete\x00persist\x00off\x00truncate\x00wal\x00w\x00a\x00s\x00sissii\x00utf8\x00utf16le\x00utf16be\x00-%T\x00fast\x00not a writable directory\x00Safety level may not be changed inside a transaction\x00issisii\x00issisi\x00iisX\x00isiX\x00c\x00u\x00isisi\x00iss\x00is\x00iissssss\x00NONE\x00siX\x00*** in database %s ***\n\x00NULL value in %s.%s\x00CHECK constraint failed in %s\x00row \x00 missing from index \x00non-unique entry in index \x00wrong # of entries in index \x00ok\x00unsupported encoding: %s\x00restart\x00ANALYZE \"%w\".\"%w\"\x00UTF8\x00UTF-8\x00UTF-16le\x00UTF-16be\x00UTF16le\x00UTF16be\x00UTF-16\x00UTF16\x00CREATE TABLE x\x00%c\"%s\"\x00(\"%s\"\x00,arg HIDDEN\x00,schema HIDDEN\x00PRAGMA \x00%Q.\x00=%Q\x00error in %s %s after %s: %s\x00rename\x00drop column\x00malformed database schema (%s)\x00%z - %s\x00orphan index\x00CREATE TABLE x(type text,name text,tbl_name text,rootpage int,sql text)\x00unsupported file format\x00SELECT*FROM\"%w\".%s ORDER BY rowid\x00database schema is locked: %s\x00statement too long\x00unknown or unsupported join type: %T %T%s%T\x00RIGHT and FULL OUTER JOINs are not currently supported\x00naturaleftouterightfullinnercross\x00a NATURAL join may not have an ON or USING clause\x00cannot have both ON and USING clauses in the same join\x00cannot join using column %s - column not present in both tables\x00UNION ALL\x00INTERSECT\x00EXCEPT\x00UNION\x00USE TEMP B-TREE FOR %s\x00column%d\x00%.*z:%u\x00cannot use window functions in recursive queries\x00recursive aggregate queries not supported\x00SETUP\x00RECURSIVE STEP\x00SCAN %d CONSTANT ROW%s\x00S\x00COMPOUND QUERY\x00LEFT-MOST SUBQUERY\x00%s USING TEMP B-TREE\x00all VALUES must have the same number of terms\x00SELECTs to the left and right of %s do not have the same number of result columns\x00MERGE (%s)\x00LEFT\x00RIGHT\x00no such index: %s\x00'%s' is not a function\x00multiple references to recursive table: %s\x00circular reference: %s\x00table %s has %d values for %d columns\x00multiple recursive references: %s\x00recursive reference in a subquery: %s\x00subquery_%u\x00too many references to \"%s\": max 65535\x00access to view \"%s\" prohibited\x00unsafe use of virtual table \"%s\"\x00*\x00%s.%s.%s\x00no such table: %s\x00no tables specified\x00too many columns in result set\x00DISTINCT aggregates must have exactly one argument\x00USE TEMP B-TREE FOR %s(DISTINCT)\x00SCAN %s%s%s\x00 USING COVERING INDEX \x00target object/alias may not appear in FROM clause: %s\x00expected %d columns for '%s' but got %d\x00CO-ROUTINE %!S\x00MATERIALIZE %!S\x00DISTINCT\x00GROUP BY\x00RIGHT PART OF ORDER BY\x00ORDER BY\x00sqlite3_get_table() called with two or more incompatible queries\x00temporary trigger may not have qualified name\x00trigger\x00cannot create triggers on virtual tables\x00trigger %T already exists\x00cannot create trigger on system table\x00cannot create %s trigger on view: %S\x00BEFORE\x00AFTER\x00cannot create INSTEAD OF trigger on table: %S\x00INSERT INTO %Q.sqlite_master VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\x00type='trigger' AND name='%q'\x00no such trigger: %S\x00DELETE FROM %Q.sqlite_master WHERE name=%Q AND type='trigger'\x00%s RETURNING is not available on virtual tables\x00DELETE\x00UPDATE\x00RETURNING may not use \"TABLE.*\" wildcards\x00-- TRIGGER %s\x00cannot UPDATE generated column \"%s\"\x00no such column: %s\x00rows updated\x00%r \x00%sON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint\x00CRE\x00INS\x00cannot VACUUM from within a transaction\x00cannot VACUUM - SQL statements in progress\x00non-text filename\x00ATTACH %Q AS vacuum_db\x00output file already exists\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='table'AND name<>'sqlite_sequence' AND coalesce(rootpage,1)>0\x00SELECT sql FROM \"%w\".sqlite_schema WHERE type='index'\x00SELECT'INSERT INTO vacuum_db.'||quote(name)||' SELECT*FROM\"%w\".'||quote(name)FROM vacuum_db.sqlite_schema WHERE type='table'AND coalesce(rootpage,1)>0\x00INSERT INTO vacuum_db.sqlite_schema SELECT*FROM \"%w\".sqlite_schema WHERE type IN('view','trigger') OR(type='table'AND rootpage=0)\x00CREATE VIRTUAL TABLE %T\x00UPDATE %Q.sqlite_master SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q WHERE rowid=#%d\x00name=%Q AND sql=%Q\x00vtable constructor called recursively: %s\x00vtable constructor failed: %s\x00vtable constructor did not declare schema: %s\x00no such module: %s\x00\x00 AND \x00(\x00 (\x00%s=?\x00ANY(%s)\x00>\x00<\x00%s %S\x00SEARCH\x00SCAN\x00AUTOMATIC PARTIAL COVERING INDEX\x00AUTOMATIC COVERING INDEX\x00COVERING INDEX %s\x00INDEX %s\x00 USING \x00=\x00>? AND rowid<\x00 USING INTEGER PRIMARY KEY (rowid%s?)\x00 VIRTUAL TABLE INDEX %d:%s\x00MULTI-INDEX OR\x00INDEX %d\x00regexp\x00ON clause references tables to its right\x00NOCASE\x00too many arguments on %s() - max %d\x00automatic index on %s(%s)\x00auto-index\x00%s.xBestIndex malfunction\x00abbreviated query algorithm search\x00no query solution\x00at most %d tables in a join\x00SCAN CONSTANT ROW\x00second argument to nth_value must be a positive integer\x00argument of ntile must be a positive integer\x00row_number\x00dense_rank\x00rank\x00percent_rank\x00cume_dist\x00ntile\x00last_value\x00nth_value\x00first_value\x00lead\x00lag\x00no such window: %s\x00RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression\x00FILTER clause may only be used with aggregate window functions\x00unsupported frame specification\x00PARTITION clause\x00ORDER BY clause\x00frame specification\x00cannot override %s of window: %s\x00DISTINCT is not supported for window functions\x00frame starting offset must be a non-negative integer\x00frame ending offset must be a non-negative integer\x00frame starting offset must be a non-negative number\x00frame ending offset must be a non-negative number\x00%s clause should come after %s not before\x00LIMIT\x00too many terms in compound SELECT\x00syntax error after column name \"%.*s\"\x00parser stack overflow\x00unknown table option: %.*s\x00set list\x00near \"%T\": syntax error\x00qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers\x00the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers\x00the NOT INDEXED clause is not allowed on UPDATE or DELETE statements within triggers\x00incomplete input\x00unrecognized token: \"%.*s\"\x00%s in \"%s\"\x00create\x00temp\x00temporary\x00end\x00explain\x00unable to close due to unfinalized statements or unfinished backups\x00unknown error\x00abort due to ROLLBACK\x00another row available\x00no more rows available\x00not an error\x00SQL logic error\x00access permission denied\x00query aborted\x00database is locked\x00database table is locked\x00attempt to write a readonly database\x00interrupted\x00disk I/O error\x00database disk image is malformed\x00unknown operation\x00database or disk is full\x00unable to open database file\x00locking protocol\x00constraint failed\x00datatype mismatch\x00bad parameter or other API misuse\x00authorization denied\x00column index out of range\x00file is not a database\x00notification message\x00warning message\x00unable to delete/modify user-function due to active statements\x00unable to use function %s in the requested context\x00unknown database: %s\x00unable to delete/modify collation sequence due to active statements\x00file:\x00localhost\x00invalid uri authority: %.*s\x00vfs\x00cache\x00mode\x00access\x00no such %s mode: %s\x00%s mode not allowed: %s\x00no such vfs: %s\x00shared\x00private\x00ro\x00rw\x00rwc\x00RTRIM\x00\x00\x00\x00%s at line %d of [%.10s]\x00database corruption\x00misuse\x00cannot open file\x00no such table column: %s.%s\x00SQLITE_\x00database is deadlocked\x00array\x00object\x000123456789abcdef\x00JSON cannot hold BLOB values\x00malformed JSON\x00[0]\x00JSON path error near '%q'\x00json_%s() needs an odd number of arguments\x00json_object() requires an even number of arguments\x00json_object() labels must be TEXT\x00set\x00insert\x00[]\x00{}\x00CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,json HIDDEN,root HIDDEN)\x00[%d]\x00.%.*s\x00$\x00json\x00json_array\x00json_array_length\x00json_extract\x00json_insert\x00json_object\x00json_patch\x00json_quote\x00json_remove\x00json_replace\x00json_set\x00json_type\x00json_valid\x00json_group_array\x00json_group_object\x00json_each\x00json_tree\x00%s_node\x00data\x00DROP TABLE '%q'.'%q_node';DROP TABLE '%q'.'%q_rowid';DROP TABLE '%q'.'%q_parent';\x00RtreeMatchArg\x00SELECT * FROM %Q.%Q\x00UNIQUE constraint failed: %s.%s\x00rtree constraint failed: %s.(%s<=%s)\x00ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";\x00SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\x00node\x00CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY,nodeno\x00,a%d\x00);CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY,data);\x00CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY,parentnode);\x00INSERT INTO \"%w\".\"%w_node\"VALUES(1,zeroblob(%d))\x00INSERT INTO\"%w\".\"%w_rowid\"(rowid,nodeno)VALUES(?1,?2)ON CONFLICT(rowid)DO UPDATE SET nodeno=excluded.nodeno\x00SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1\x00UPDATE \"%w\".\"%w_rowid\"SET \x00a%d=coalesce(?%d,a%d)\x00a%d=?%d\x00 WHERE rowid=?1\x00INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_node' WHERE nodeno = ?1\x00SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_rowid' WHERE rowid = ?1\x00SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(?1, ?2)\x00DELETE FROM '%q'.'%q_parent' WHERE nodeno = ?1\x00PRAGMA %Q.page_size\x00SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\x00undersize RTree blobs in \"%q_node\"\x00Wrong number of columns for an rtree table\x00Too few columns for an rtree table\x00Too many columns for an rtree table\x00Auxiliary rtree columns must be last\x00CREATE TABLE x(%.*s INT\x00,%.*s\x00);\x00,%.*s REAL\x00,%.*s INT\x00{%lld\x00 %g\x00}\x00Invalid argument to rtreedepth()\x00%z%s%z\x00SELECT data FROM %Q.'%q_node' WHERE nodeno=?\x00Node %lld missing from database\x00SELECT parentnode FROM %Q.'%q_parent' WHERE nodeno=?1\x00SELECT nodeno FROM %Q.'%q_rowid' WHERE rowid=?1\x00Mapping (%lld -> %lld) missing from %s table\x00%_rowid\x00%_parent\x00Found (%lld -> %lld) in %s table, expected (%lld -> %lld)\x00Dimension %d of cell %d on node %lld is corrupt\x00Dimension %d of cell %d on node %lld is corrupt relative to parent\x00Node %lld is too small (%d bytes)\x00Rtree depth out of range (%d)\x00Node %lld is too small for cell count of %d (%d bytes)\x00SELECT count(*) FROM %Q.'%q%s'\x00Wrong number of entries in %%%s table - expected %lld, actual %lld\x00SELECT * FROM %Q.'%q_rowid'\x00Schema corrupt or not an rtree\x00_rowid\x00_parent\x00END\x00wrong number of arguments to function rtreecheck()\x00[\x00[%!g,%!g],\x00[%!g,%!g]]\x00\x00CREATE TABLE x(_shape\x00,%s\x00rtree\x00fullscan\x00_shape does not contain a valid polygon\x00geopoly_overlap\x00geopoly_within\x00geopoly\x00geopoly_area\x00geopoly_blob\x00geopoly_json\x00geopoly_svg\x00geopoly_contains_point\x00geopoly_debug\x00geopoly_bbox\x00geopoly_xform\x00geopoly_regular\x00geopoly_ccw\x00geopoly_group_bbox\x00rtreenode\x00rtreedepth\x00rtreecheck\x00rtree_i32\x00corrupt fossil delta\x00DROP TRIGGER IF EXISTS temp.rbu_insert_tr;DROP TRIGGER IF EXISTS temp.rbu_update1_tr;DROP TRIGGER IF EXISTS temp.rbu_update2_tr;DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\x00SELECT rbu_target_name(name, type='view') AS target, name FROM sqlite_schema WHERE type IN ('table', 'view') AND target IS NOT NULL %s ORDER BY name\x00AND rootpage!=0 AND rootpage IS NOT NULL\x00SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' FROM main.sqlite_schema WHERE type='index' AND tbl_name = ?\x00SELECT (sql LIKE 'create virtual%%'), rootpage FROM sqlite_schema WHERE name=%Q\x00PRAGMA index_list=%Q\x00SELECT rootpage FROM sqlite_schema WHERE name = %Q\x00PRAGMA table_info=%Q\x00PRAGMA main.index_list = %Q\x00PRAGMA main.index_xinfo = %Q\x00SELECT * FROM '%q'\x00rbu_\x00rbu_rowid\x00table %q %s rbu_rowid column\x00may not have\x00requires\x00PRAGMA table_info(%Q)\x00column missing from %q: %s\x00%z%s\"%w\"\x00%z%s%s\"%w\"%s\x00SELECT max(_rowid_) FROM \"%s%w\"\x00 WHERE _rowid_ > %lld \x00 DESC\x00quote(\x00||','||\x00SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1\x00 WHERE (%s) > (%s) \x00_rowid_\x00%z%s \"%w\" COLLATE %Q\x00%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC\x00%z%s quote(\"rbu_imp_%d%w\")\x00SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1\x00%z%s%s\x00(%s) > (%s)\x00%z%s(%.*s) COLLATE %Q\x00%z%s\"%w\" COLLATE %Q\x00%z%s\"rbu_imp_%d%w\"%s\x00%z%s\"rbu_imp_%d%w\" %s COLLATE %Q\x00%z%s\"rbu_imp_%d%w\" IS ?\x00%z%s%s.\"%w\"\x00%z%sNULL\x00%z, %s._rowid_\x00_rowid_ = ?%d\x00%z%sc%d=?%d\x00_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\x00%z%s\"%w\"=?%d\x00invalid rbu_control value\x00%z%s\"%w\"=rbu_delta(\"%w\", ?%d)\x00%z%s\"%w\"=rbu_fossil_delta(\"%w\", ?%d)\x00PRIMARY KEY(\x00%z%s\"%w\"%s\x00%z)\x00SELECT name FROM sqlite_schema WHERE rootpage = ?\x00%z%sc%d %s COLLATE %Q\x00%z%sc%d%s\x00%z, id INTEGER\x00CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\x00PRIMARY KEY \x00%z%s\"%w\" %s %sCOLLATE %Q%s\x00 NOT NULL\x00%z, %z\x00CREATE TABLE \"rbu_imp_%w\"(%z)%s\x00 WITHOUT ROWID\x00INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\x00SELECT trim(sql) FROM sqlite_schema WHERE type='index' AND name=?\x00 LIMIT -1 OFFSET %d\x00CREATE TABLE \"rbu_imp_%w\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\x00INSERT INTO \"rbu_imp_%w\" VALUES(%s)\x00DELETE FROM \"rbu_imp_%w\" WHERE %s\x00SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s\x00AND\x00WHERE\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s\x00SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s UNION ALL SELECT %s, rbu_control FROM '%q' %s %s typeof(rbu_control)='integer' AND rbu_control!=1 ORDER BY %s%s\x00rbu_imp_\x00INSERT INTO \"%s%w\"(%s%s) VALUES(%s)\x00, _rowid_\x00DELETE FROM \"%s%w\" WHERE %s\x00, rbu_rowid\x00CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS SELECT *%s FROM '%q' WHERE 0;\x00, 0 AS rbu_rowid\x00CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(3, %s);END;CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(4, %s);END;\x00CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \"%s%w\" BEGIN SELECT rbu_tmp_insert(0, %s);END;\x00,_rowid_ \x00,rbu_rowid\x00SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s\x000 AS \x00UPDATE \"%s%w\" SET %s WHERE %s\x00SELECT k, v FROM %s.rbu_state\x00file://%s-vacuum?modeof=%s\x00ATTACH %Q AS stat\x00CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\x00cannot vacuum wal mode database\x00file:%s-vactmp?rbu_memory=1%s%s\x00&\x00rbu_tmp_insert\x00rbu_fossil_delta\x00rbu_target_name\x00SELECT * FROM sqlite_schema\x00rbu vfs not found\x00PRAGMA main.wal_checkpoint=restart\x00%s-oal\x00%s-wal\x00PRAGMA schema_version\x00PRAGMA schema_version = %d\x00INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES (%d, %d), (%d, %Q), (%d, %Q), (%d, %d), (%d, %d), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %lld), (%d, %Q) \x00PRAGMA main.%s\x00PRAGMA main.%s = %d\x00PRAGMA writable_schema=1\x00SELECT sql FROM sqlite_schema WHERE sql!='' AND rootpage!=0 AND name!='sqlite_sequence' ORDER BY type DESC\x00SELECT * FROM sqlite_schema WHERE rootpage=0 OR rootpage IS NULL\x00INSERT INTO sqlite_schema VALUES(?,?,?,?,?)\x00PRAGMA writable_schema=0\x00DELETE FROM %s.'rbu_tmp_%q'\x00rbu_state mismatch error\x00rbu_vfs_%d\x00SELECT count(*) FROM sqlite_schema WHERE type='index' AND tbl_name = %Q\x00rbu_index_cnt\x00SELECT 1 FROM sqlite_schema WHERE tbl_name = 'rbu_count'\x00SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))FROM rbu_count\x00cannot update wal mode database\x00database modified during rbu %s\x00vacuum\x00update\x00BEGIN IMMEDIATE\x00PRAGMA journal_mode=off\x00-vactmp\x00DELETE FROM stat.rbu_state\x00rbu/zipvfs setup error\x00rbu(%s)/%z\x00rbu_memory\x00SELECT 0, 'tbl', '', 0, '', 1 UNION ALL SELECT 1, 'idx', '', 0, '', 2 UNION ALL SELECT 2, 'stat', '', 0, '', 0\x00PRAGMA '%q'.table_info('%q')\x00%z%s\"%w\".\"%w\".\"%w\"=\"%w\".\"%w\".\"%w\"\x00%z%s\"%w\".\"%w\".\"%w\" IS NOT \"%w\".\"%w\".\"%w\"\x00 OR \x00SELECT * FROM \"%w\".\"%w\" WHERE NOT EXISTS ( SELECT 1 FROM \"%w\".\"%w\" WHERE %s)\x00SELECT * FROM \"%w\".\"%w\", \"%w\".\"%w\" WHERE %s AND (%z)\x00table schemas do not match\x00SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)\x00SELECT * FROM \x00 WHERE \x00 IS ?\x00SAVEPOINT changeset\x00RELEASE changeset\x00UPDATE main.\x00 SET \x00 = ?\x00idx IS CASE WHEN length(?4)=0 AND typeof(?4)='blob' THEN NULL ELSE ?4 END \x00DELETE FROM main.\x00 AND (?\x00AND \x00INSERT INTO main.\x00) VALUES(?\x00, ?\x00INSERT INTO main.sqlite_stat1 VALUES(?1, CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, ?3)\x00DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END AND (?4 OR stat IS ?3)\x00SAVEPOINT replace_op\x00RELEASE replace_op\x00SAVEPOINT changeset_apply\x00PRAGMA defer_foreign_keys = 1\x00sqlite3changeset_apply(): no such table: %s\x00sqlite3changeset_apply(): table %s has %d columns, expected %d or more\x00sqlite3changeset_apply(): primary key mismatch for table %s\x00PRAGMA defer_foreign_keys = 0\x00RELEASE changeset_apply\x00ROLLBACK TO changeset_apply\x00fts5: parser stack overflow\x00fts5: syntax error near \"%.*s\"\x00%z%.*s\x00wrong number of arguments to function highlight()\x00wrong number of arguments to function snippet()\x00snippet\x00highlight\x00bm25\x00prefix\x00malformed prefix=... directive\x00too many prefix indexes (max %d)\x00prefix length out of range (max 999)\x00tokenize\x00multiple tokenize=... directives\x00parse error in tokenize directive\x00content\x00multiple content=... directives\x00%Q.%Q\x00content_rowid\x00multiple content_rowid=... directives\x00columnsize\x00malformed columnsize=... directive\x00columns\x00malformed detail=... directive\x00unrecognized option: \"%.*s\"\x00reserved fts5 column name: %s\x00unindexed\x00unrecognized column option: %s\x00T.%Q\x00, T.%Q\x00, T.c%d\x00reserved fts5 table name: %s\x00parse error in \"%s\"\x00docsize\x00%Q.'%q_%s'\x00CREATE TABLE x(\x00%z%s%Q\x00%z, %Q HIDDEN, %s HIDDEN)\x00pgsz\x00hashsize\x00automerge\x00usermerge\x00crisismerge\x00SELECT k, v FROM %Q.'%q_config'\x00version\x00invalid fts5 file format (found %d, expected %d) - run 'rebuild'\x00unterminated string\x00fts5: syntax error near \"%.1s\"\x00OR\x00NOT\x00NEAR\x00expected integer, got \"%.*s\"\x00fts5: column queries are not supported (detail=none)\x00fts5: %s queries are not supported (detail!=full)\x00phrase\x00block\x00REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\x00DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\x00DELETE FROM '%q'.'%q_idx' WHERE segid=?\x00PRAGMA %Q.data_version\x00SELECT pgno FROM '%q'.'%q_idx' WHERE segid=? AND term<=? ORDER BY term DESC LIMIT 1\x00INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\x00%s_data\x00id INTEGER PRIMARY KEY, block BLOB\x00segid, term, pgno, PRIMARY KEY(segid, term)\x00SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d ORDER BY 1, 2\x00\x00\x00\x00\x00\x00recursively defined fts5 content table\x00SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s\x00DESC\x00ASC\x00reads\x00unknown special query: %.*s\x00SELECT %s\x00no such function: %s\x00parse error in rank function: %s\x00%s: table does not support scanning\x00delete-all\x00'delete-all' may only be used with a contentless or external content fts5 table\x00rebuild\x00'rebuild' may not be used with a contentless fts5 table\x00merge\x00integrity-check\x00cannot %s contentless fts5 table: %s\x00DELETE from\x00no such cursor: %lld\x00no such tokenizer: %s\x00error in tokenizer constructor\x00fts5_api_ptr\x00fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00config\x00fts5\x00fts5_source_id\x00SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\x00SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\x00SELECT %s FROM %s T WHERE T.%Q=?\x00INSERT INTO %Q.'%q_content' VALUES(%s)\x00REPLACE INTO %Q.'%q_content' VALUES(%s)\x00DELETE FROM %Q.'%q_content' WHERE id=?\x00REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\x00DELETE FROM %Q.'%q_docsize' WHERE id=?\x00SELECT sz FROM %Q.'%q_docsize' WHERE id=?\x00REPLACE INTO %Q.'%q_config' VALUES(?,?)\x00SELECT %s FROM %s AS T\x00DROP TABLE IF EXISTS %Q.'%q_data';DROP TABLE IF EXISTS %Q.'%q_idx';DROP TABLE IF EXISTS %Q.'%q_config';\x00DROP TABLE IF EXISTS %Q.'%q_docsize';\x00DROP TABLE IF EXISTS %Q.'%q_content';\x00ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\x00CREATE TABLE %Q.'%q_%q'(%s)%s\x00fts5: error creating shadow table %q_%s: %s\x00id INTEGER PRIMARY KEY\x00, c%d\x00id INTEGER PRIMARY KEY, sz BLOB\x00k PRIMARY KEY, v\x00DELETE FROM %Q.'%q_data';DELETE FROM %Q.'%q_idx';\x00DELETE FROM %Q.'%q_docsize';\x00SELECT count(*) FROM %Q.'%q_%s'\x00tokenchars\x00separators\x00L* N* Co\x00categories\x00remove_diacritics\x00unicode61\x00al\x00ance\x00ence\x00er\x00ic\x00able\x00ible\x00ant\x00ement\x00ment\x00ent\x00ion\x00ou\x00ism\x00ate\x00iti\x00ous\x00ive\x00ize\x00at\x00bl\x00ble\x00iz\x00ational\x00tional\x00tion\x00enci\x00anci\x00izer\x00logi\x00bli\x00alli\x00entli\x00eli\x00e\x00ousli\x00ization\x00ation\x00ator\x00alism\x00iveness\x00fulness\x00ful\x00ousness\x00aliti\x00iviti\x00biliti\x00ical\x00ness\x00icate\x00iciti\x00ative\x00alize\x00eed\x00ee\x00ed\x00ing\x00case_sensitive\x00ascii\x00porter\x00trigram\x00col\x00row\x00instance\x00fts5vocab: unknown table type: %Q\x00CREATE TABlE vocab(term, col, doc, cnt)\x00CREATE TABlE vocab(term, doc, cnt)\x00CREATE TABlE vocab(term, doc, col, offset)\x00wrong number of vtable arguments\x00recursive definition for %s.%s\x00SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\x00no such fts5 table: %s.%s\x00fts5vocab\x002021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5\x00" var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/sqlite/rlimit.go b/vendor/modernc.org/sqlite/rlimit.go new file mode 100644 index 00000000..4a107604 --- /dev/null +++ b/vendor/modernc.org/sqlite/rlimit.go @@ -0,0 +1,10 @@ +// Copyright 2021 The Sqlite Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !freebsd +// +build !freebsd + +package sqlite // import "modernc.org/sqlite" + +func setMaxOpenFiles(n int) error { return nil } diff --git a/vendor/modernc.org/sqlite/rlimit_freebsd.go b/vendor/modernc.org/sqlite/rlimit_freebsd.go new file mode 100644 index 00000000..c3d4ddbc --- /dev/null +++ b/vendor/modernc.org/sqlite/rlimit_freebsd.go @@ -0,0 +1,16 @@ +// Copyright 2021 The Sqlite Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sqlite // import "modernc.org/sqlite" + +import ( + "golang.org/x/sys/unix" +) + +func setMaxOpenFiles(n int64) error { + var rLimit unix.Rlimit + rLimit.Max = n + rLimit.Cur = n + return unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit) +} diff --git a/vendor/modernc.org/sqlite/sqlite.go b/vendor/modernc.org/sqlite/sqlite.go index a3a0f123..ccf079ec 100644 --- a/vendor/modernc.org/sqlite/sqlite.go +++ b/vendor/modernc.org/sqlite/sqlite.go @@ -11,12 +11,16 @@ import ( "context" "database/sql" "database/sql/driver" + "errors" "fmt" "io" "math" + "net/url" "reflect" "strconv" "strings" + "sync" + "sync/atomic" "time" "unsafe" @@ -471,14 +475,14 @@ func toNamedValues(vals []driver.Value) (r []driver.NamedValue) { func (s *stmt) exec(ctx context.Context, args []driver.NamedValue) (r driver.Result, err error) { var pstmt uintptr - done := false + var done int32 if ctx != nil && ctx.Done() != nil { donech := make(chan struct{}) go func() { select { case <-ctx.Done(): - done = true + atomic.AddInt32(&done, 1) s.c.interrupt(s.c.db) case <-donech: } @@ -489,7 +493,7 @@ func (s *stmt) exec(ctx context.Context, args []driver.NamedValue) (r driver.Res }() } - for psql := s.psql; *(*byte)(unsafe.Pointer(psql)) != 0 && !done; { + for psql := s.psql; *(*byte)(unsafe.Pointer(psql)) != 0 && atomic.LoadInt32(&done) == 0; { if pstmt, err = s.c.prepareV2(&psql); err != nil { return nil, err } @@ -568,15 +572,14 @@ func (s *stmt) Query(args []driver.Value) (driver.Rows, error) { //TODO StmtQuer func (s *stmt) query(ctx context.Context, args []driver.NamedValue) (r driver.Rows, err error) { var pstmt uintptr - - done := false + var done int32 if ctx != nil && ctx.Done() != nil { donech := make(chan struct{}) go func() { select { case <-ctx.Done(): - done = true + atomic.AddInt32(&done, 1) s.c.interrupt(s.c.db) case <-donech: } @@ -588,7 +591,7 @@ func (s *stmt) query(ctx context.Context, args []driver.NamedValue) (r driver.Ro } var allocs []uintptr - for psql := s.psql; *(*byte)(unsafe.Pointer(psql)) != 0 && !done; { + for psql := s.psql; *(*byte)(unsafe.Pointer(psql)) != 0 && atomic.LoadInt32(&done) == 0; { if pstmt, err = s.c.prepareV2(&psql); err != nil { return nil, err } @@ -720,12 +723,29 @@ func (t *tx) exec(ctx context.Context, sql string) (err error) { type conn struct { db uintptr // *sqlite3.Xsqlite3 tls *libc.TLS + + // Context handling can cause conn.Close and conn.interrupt to be invoked + // concurrently. + sync.Mutex } -func newConn(name string) (*conn, error) { +func newConn(dsn string) (*conn, error) { + var query string + + // Parse the query parameters from the dsn and them from the dsn if not prefixed by file: + // https://github.com/mattn/go-sqlite3/blob/3392062c729d77820afc1f5cae3427f0de39e954/sqlite3.go#L1046 + // https://github.com/mattn/go-sqlite3/blob/3392062c729d77820afc1f5cae3427f0de39e954/sqlite3.go#L1383 + pos := strings.IndexRune(dsn, '?') + if pos >= 1 { + query = dsn[pos+1:] + if !strings.HasPrefix(dsn, "file:") { + dsn = dsn[:pos] + } + } + c := &conn{tls: libc.NewTLS()} db, err := c.openV2( - name, + dsn, sqlite3.SQLITE_OPEN_READWRITE|sqlite3.SQLITE_OPEN_CREATE| sqlite3.SQLITE_OPEN_FULLMUTEX| sqlite3.SQLITE_OPEN_URI, @@ -740,9 +760,29 @@ func newConn(name string) (*conn, error) { return nil, err } + if err = applyPragmas(c, query); err != nil { + c.Close() + return nil, err + } + return c, nil } +func applyPragmas(c *conn, query string) error { + q, err := url.ParseQuery(query) + if err != nil { + return err + } + for _, v := range q["_pragma"] { + cmd := "pragma " + v + _, err := c.exec(context.Background(), cmd, nil) + if err != nil { + return err + } + } + return nil +} + // const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); func (c *conn) columnBlob(pstmt uintptr, iCol int) (v []byte, err error) { p := sqlite3.Xsqlite3_column_blob(c.tls, pstmt, int32(iCol)) @@ -833,12 +873,17 @@ func (c *conn) changes() (int, error) { func (c *conn) step(pstmt uintptr) (int, error) { for { switch rc := sqlite3.Xsqlite3_step(c.tls, pstmt); rc { - case sqliteLockedSharedcache, sqlite3.SQLITE_BUSY: + case sqliteLockedSharedcache: if err := c.retry(pstmt); err != nil { return sqlite3.SQLITE_LOCKED, err } - default: + case + sqlite3.SQLITE_DONE, + sqlite3.SQLITE_ROW: + return int(rc), nil + default: + return int(rc), errors.New(ErrorCodeString[int(rc)]) } } } @@ -1096,7 +1141,7 @@ func (c *conn) prepareV2(zSQL *uintptr) (pstmt uintptr, err error) { case sqlite3.SQLITE_OK: *zSQL = *(*uintptr)(unsafe.Pointer(pptail)) return *(*uintptr)(unsafe.Pointer(ppstmt)), nil - case sqliteLockedSharedcache, sqlite3.SQLITE_BUSY: + case sqliteLockedSharedcache: if err := c.retry(0); err != nil { return 0, err } @@ -1108,7 +1153,13 @@ func (c *conn) prepareV2(zSQL *uintptr) (pstmt uintptr, err error) { // void sqlite3_interrupt(sqlite3*); func (c *conn) interrupt(pdb uintptr) (err error) { - sqlite3.Xsqlite3_interrupt(c.tls, pdb) + c.Lock() // Defend against race with .Close invoked by context handling. + + defer c.Unlock() + + if c.tls != nil { + sqlite3.Xsqlite3_interrupt(c.tls, pdb) + } return nil } @@ -1200,6 +1251,10 @@ func (c *conn) begin(ctx context.Context, opts driver.TxOptions) (t driver.Tx, e // Close when there's a surplus of idle connections, it shouldn't be necessary // for drivers to do their own connection caching. func (c *conn) Close() error { + c.Lock() // Defend against race with .interrupt invoked by context handling. + + defer c.Unlock() + if c.db != 0 { if err := c.closeV2(c.db); err != nil { return err diff --git a/vendor/modernc.org/sqlite/sqlite_go18.go b/vendor/modernc.org/sqlite/sqlite_go18.go index 74b3e9da..474d0027 100644 --- a/vendor/modernc.org/sqlite/sqlite_go18.go +++ b/vendor/modernc.org/sqlite/sqlite_go18.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.8 // +build go1.8 package sqlite // import "modernc.org/sqlite" diff --git a/vendor/modules.txt b/vendor/modules.txt index 8c964a97..e5915fd3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -7,25 +7,26 @@ github.com/TwinProduction/health # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile -# github.com/cespare/xxhash/v2 v2.1.1 +# github.com/cespare/xxhash/v2 v2.1.2 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663 +# github.com/go-ping/ping v0.0.0-20210911151512-381826476871 ## explicit; go 1.14 github.com/go-ping/ping # github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 ## explicit github.com/golang/freetype/raster github.com/golang/freetype/truetype -# github.com/golang/protobuf v1.4.3 +# github.com/golang/protobuf v1.5.2 ## explicit; go 1.9 github.com/golang/protobuf/proto github.com/golang/protobuf/ptypes github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/timestamp -# github.com/google/go-cmp v0.5.4 -## explicit; go 1.8 +# github.com/google/uuid v1.3.0 +## explicit +github.com/google/uuid # github.com/gorilla/mux v1.8.0 ## explicit; go 1.12 github.com/gorilla/mux @@ -37,17 +38,17 @@ github.com/kballard/go-shellquote github.com/lib/pq github.com/lib/pq/oid github.com/lib/pq/scram -# github.com/mattn/go-isatty v0.0.12 +# github.com/mattn/go-isatty v0.0.14 ## explicit; go 1.12 github.com/mattn/go-isatty # github.com/matttproud/golang_protobuf_extensions v1.0.1 ## explicit github.com/matttproud/golang_protobuf_extensions/pbutil -# github.com/miekg/dns v1.1.35 -## explicit; go 1.12 +# github.com/miekg/dns v1.1.43 +## explicit; go 1.14 github.com/miekg/dns -# github.com/prometheus/client_golang v1.9.0 -## explicit; go 1.11 +# github.com/prometheus/client_golang v1.11.0 +## explicit; go 1.13 github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/internal github.com/prometheus/client_golang/prometheus/promauto @@ -55,13 +56,13 @@ github.com/prometheus/client_golang/prometheus/promhttp # github.com/prometheus/client_model v0.2.0 ## explicit; go 1.9 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.15.0 -## explicit; go 1.11 +# github.com/prometheus/common v0.31.1 +## explicit; go 1.13 github.com/prometheus/common/expfmt github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg github.com/prometheus/common/model -# github.com/prometheus/procfs v0.2.0 -## explicit; go 1.12 +# github.com/prometheus/procfs v0.7.3 +## explicit; go 1.13 github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util @@ -74,37 +75,37 @@ github.com/wcharczuk/go-chart/v2 github.com/wcharczuk/go-chart/v2/drawing github.com/wcharczuk/go-chart/v2/matrix github.com/wcharczuk/go-chart/v2/roboto -# go.etcd.io/bbolt v1.3.5 +# go.etcd.io/bbolt v1.3.6 ## explicit; go 1.12 go.etcd.io/bbolt -# golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad -## explicit; go 1.11 -golang.org/x/crypto/ed25519 -golang.org/x/crypto/ed25519/internal/edwards25519 # golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d ## explicit; go 1.12 golang.org/x/image/draw golang.org/x/image/font golang.org/x/image/math/f64 golang.org/x/image/math/fixed -# golang.org/x/mod v0.4.0 -## explicit; go 1.12 +# golang.org/x/mod v0.5.1 +## explicit; go 1.17 golang.org/x/mod/semver -# golang.org/x/net v0.0.0-20201224014010-6772e930b67b -## explicit; go 1.11 +# golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6 +## explicit; go 1.17 golang.org/x/net/bpf golang.org/x/net/icmp golang.org/x/net/internal/iana golang.org/x/net/internal/socket golang.org/x/net/ipv4 golang.org/x/net/ipv6 -# golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c -## explicit; go 1.12 +# golang.org/x/sync v0.0.0-20210220032951-036812b2e83c +## explicit +golang.org/x/sync/errgroup +# golang.org/x/sys v0.0.0-20211003122950-b1ebd4e1001c +## explicit; go 1.17 +golang.org/x/sys/execabs golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/tools v0.0.0-20201208233053-a543418bbed2 -## explicit; go 1.12 +# golang.org/x/tools v0.1.7 +## explicit; go 1.17 golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/gcimporter golang.org/x/tools/go/internal/packagesdriver @@ -115,12 +116,13 @@ golang.org/x/tools/internal/event/keys golang.org/x/tools/internal/event/label golang.org/x/tools/internal/gocommand golang.org/x/tools/internal/packagesinternal +golang.org/x/tools/internal/typeparams golang.org/x/tools/internal/typesinternal # golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 ## explicit; go 1.11 golang.org/x/xerrors golang.org/x/xerrors/internal -# google.golang.org/protobuf v1.25.0 +# google.golang.org/protobuf v1.27.1 ## explicit; go 1.9 google.golang.org/protobuf/encoding/prototext google.golang.org/protobuf/encoding/protowire @@ -132,22 +134,23 @@ google.golang.org/protobuf/internal/encoding/messageset google.golang.org/protobuf/internal/encoding/tag google.golang.org/protobuf/internal/encoding/text google.golang.org/protobuf/internal/errors -google.golang.org/protobuf/internal/fieldsort google.golang.org/protobuf/internal/filedesc google.golang.org/protobuf/internal/filetype google.golang.org/protobuf/internal/flags google.golang.org/protobuf/internal/genid google.golang.org/protobuf/internal/impl -google.golang.org/protobuf/internal/mapsort +google.golang.org/protobuf/internal/order google.golang.org/protobuf/internal/pragma google.golang.org/protobuf/internal/set google.golang.org/protobuf/internal/strs google.golang.org/protobuf/internal/version google.golang.org/protobuf/proto +google.golang.org/protobuf/reflect/protodesc google.golang.org/protobuf/reflect/protoreflect google.golang.org/protobuf/reflect/protoregistry google.golang.org/protobuf/runtime/protoiface google.golang.org/protobuf/runtime/protoimpl +google.golang.org/protobuf/types/descriptorpb google.golang.org/protobuf/types/known/anypb google.golang.org/protobuf/types/known/durationpb google.golang.org/protobuf/types/known/timestamppb @@ -157,13 +160,13 @@ gopkg.in/yaml.v2 # lukechampine.com/uint128 v1.1.1 ## explicit; go 1.12 lukechampine.com/uint128 -# modernc.org/cc/v3 v3.33.6 +# modernc.org/cc/v3 v3.35.8 ## explicit; go 1.15 modernc.org/cc/v3 -# modernc.org/ccgo/v3 v3.9.5 +# modernc.org/ccgo/v3 v3.12.16 ## explicit; go 1.15 modernc.org/ccgo/v3/lib -# modernc.org/libc v1.9.11 +# modernc.org/libc v1.11.22 ## explicit; go 1.15 modernc.org/libc modernc.org/libc/errno @@ -188,16 +191,16 @@ modernc.org/libc/time modernc.org/libc/unistd modernc.org/libc/utime modernc.org/libc/uuid/uuid -# modernc.org/mathutil v1.4.0 +# modernc.org/mathutil v1.4.1 ## explicit; go 1.13 modernc.org/mathutil -# modernc.org/memory v1.0.4 +# modernc.org/memory v1.0.5 ## explicit; go 1.15 modernc.org/memory # modernc.org/opt v0.1.1 ## explicit; go 1.13 modernc.org/opt -# modernc.org/sqlite v1.11.2 +# modernc.org/sqlite v1.13.1 ## explicit; go 1.15 modernc.org/sqlite modernc.org/sqlite/lib